diff --git a/go.mod b/go.mod index 2ba999e2a..6c0fbc1a4 100644 --- a/go.mod +++ b/go.mod @@ -2,90 +2,39 @@ module github.com/cilium/hubble go 1.22.2 -require github.com/cilium/cilium v1.16.0-pre.2 +require github.com/cilium/cilium v1.16.0-pre.3 require ( - cel.dev/expr v0.15.0 // indirect github.com/antlr4-go/antlr/v4 v4.13.0 // indirect - github.com/armon/go-metrics v0.4.1 // indirect github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect - github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver/v4 v4.0.0 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/cilium/ebpf v0.15.0 // indirect - github.com/cilium/hive v0.0.0-20240425092031-f6d2f20c979b // indirect - github.com/cilium/proxy v0.0.0-20240418093727-2c7164c53e26 // indirect - github.com/cilium/stream v0.0.0-20240226091623-f979d32855f8 // indirect - github.com/cncf/xds/go v0.0.0-20240329184929-0c46c01016dc // indirect - github.com/coreos/go-semver v0.3.1 // indirect - github.com/coreos/go-systemd/v22 v22.5.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/emicklei/go-restful/v3 v3.11.2 // indirect - github.com/envoyproxy/protoc-gen-validate v1.0.4 // indirect - github.com/evanphx/json-patch v5.9.0+incompatible // indirect - github.com/fatih/color v1.16.0 // indirect + github.com/fatih/color v1.17.0 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/go-logr/logr v1.4.1 // indirect - github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/analysis v0.23.0 // indirect github.com/go-openapi/errors v0.22.0 // indirect github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/jsonreference v0.21.0 // indirect github.com/go-openapi/loads v0.22.0 // indirect - github.com/go-openapi/runtime v0.28.0 // indirect github.com/go-openapi/spec v0.21.0 // indirect github.com/go-openapi/strfmt v0.23.0 // indirect github.com/go-openapi/swag v0.23.0 // indirect github.com/go-openapi/validate v0.24.0 // indirect - github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.4 // indirect github.com/google/cel-go v0.20.1 // indirect - github.com/google/gnostic-models v0.6.8 // indirect - github.com/google/go-cmp v0.6.0 // indirect - github.com/google/gofuzz v1.2.0 // indirect - github.com/google/gopacket v1.1.19 // indirect github.com/google/uuid v1.6.0 // indirect github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 // indirect - github.com/hashicorp/consul/api v1.28.2 // indirect - github.com/hashicorp/errwrap v1.1.0 // indirect - github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-hclog v1.5.0 // indirect - github.com/hashicorp/go-immutable-radix v1.3.1 // indirect - github.com/hashicorp/go-immutable-radix/v2 v2.1.0 // indirect - github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-rootcerts v1.0.2 // indirect - github.com/hashicorp/golang-lru v0.5.4 // indirect - github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/hashicorp/hcl v1.0.1-vault-5 // indirect - github.com/hashicorp/serf v0.10.1 // indirect - github.com/imdario/mergo v0.3.16 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/josharian/intern v1.0.0 // indirect - github.com/json-iterator/go v1.1.12 // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/kr/text v0.2.0 // indirect - github.com/mackerelio/go-osstat v0.2.4 // indirect + github.com/mackerelio/go-osstat v0.2.5 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oklog/ulid v1.3.1 // indirect - github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b // indirect - github.com/pelletier/go-toml/v2 v2.2.1 // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect - github.com/pkg/errors v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.0 // indirect - github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.48.0 // indirect - github.com/prometheus/procfs v0.14.0 // indirect - github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect @@ -95,53 +44,34 @@ require ( github.com/spf13/cast v1.6.0 // indirect github.com/spf13/cobra v1.8.0 // indirect github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace // indirect - github.com/spf13/viper v1.18.2 // indirect + github.com/spf13/viper v1.19.0 // indirect github.com/stoewer/go-strcase v1.3.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/vishvananda/netlink v1.2.1-beta.2.0.20231127184239-0ced8385386a // indirect + github.com/vishvananda/netlink v1.2.1-beta.2.0.20240524165444-4d4ba1473f21 // indirect github.com/vishvananda/netns v0.0.4 // indirect - go.etcd.io/etcd/api/v3 v3.5.13 // indirect - go.etcd.io/etcd/client/pkg/v3 v3.5.13 // indirect - go.etcd.io/etcd/client/v3 v3.5.13 // indirect go.mongodb.org/mongo-driver v1.14.0 // indirect - go.opentelemetry.io/otel v1.26.0 // indirect - go.opentelemetry.io/otel/metric v1.26.0 // indirect - go.opentelemetry.io/otel/trace v1.26.0 // indirect - go.uber.org/dig v1.17.1 // indirect go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.27.0 // indirect go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect - golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect - golang.org/x/net v0.24.0 // indirect - golang.org/x/oauth2 v0.17.0 // indirect + golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect + golang.org/x/net v0.25.0 // indirect golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.19.0 // indirect - golang.org/x/term v0.19.0 // indirect - golang.org/x/text v0.14.0 // indirect + golang.org/x/sys v0.20.0 // indirect + golang.org/x/text v0.15.0 // indirect golang.org/x/time v0.5.0 // indirect - google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240429193739-8cf5692501f6 // indirect - google.golang.org/grpc v1.63.2 // indirect - google.golang.org/protobuf v1.34.0 // indirect - gopkg.in/inf.v0 v0.9.1 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect + google.golang.org/grpc v1.64.0 // indirect + google.golang.org/protobuf v1.34.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/api v0.30.0 // indirect - k8s.io/apiextensions-apiserver v0.30.0 // indirect k8s.io/apimachinery v0.30.0 // indirect k8s.io/client-go v0.30.0 // indirect k8s.io/klog/v2 v2.120.1 // indirect - k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect k8s.io/utils v0.0.0-20240102154912-e7106e64919e // indirect - sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect - sigs.k8s.io/yaml v1.4.0 // indirect ) // Replace directives from github.com/cilium/cilium. Keep in sync when updating Cilium! -// Copied from https://github.com/cilium/cilium/blob/v1.16.0-pre.2/go.mod#L287-L293 +// Copied from https://github.com/cilium/cilium/blob/v1.16.0-pre.3/go.mod#L287-L293 replace ( go.universe.tf/metallb => github.com/cilium/metallb v0.1.1-0.20220829170633-5d7dfb1129f7 diff --git a/go.sum b/go.sum index d2200f292..994c15a9a 100644 --- a/go.sum +++ b/go.sum @@ -1,80 +1,32 @@ -cel.dev/expr v0.15.0 h1:O1jzfJCQBfL5BFoYktaxwIhuttaQPsVWerH9/EEKx0w= -cel.dev/expr v0.15.0/go.mod h1:TRSuuV7DlVCE/uwv5QbAiW/v8l5O8C4eEPHeu7gf7Sg= -github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 h1:bvDV9vkmnHYOMsOr4WLk+Vo07yKIzd94sVoIqshQ4bU= -github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8= -github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI= github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA= -github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= -github.com/census-instrumentation/opencensus-proto v0.4.1 h1:iKLQ0xPNFxR/2hzXZMrBo8f1j86j5WHzznCCQxV/b8g= -github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cilium/checkmate v1.0.3 h1:CQC5eOmlAZeEjPrVZY3ZwEBH64lHlx9mXYdUehEwI5w= -github.com/cilium/checkmate v1.0.3/go.mod h1:KiBTasf39/F2hf2yAmHw21YFl3hcEyP4Yk6filxc12A= -github.com/cilium/cilium v1.16.0-pre.2 h1:7lMNYh/LhegbZOalC13k5xrYQN6u7cmz3veqEd2r76c= -github.com/cilium/cilium v1.16.0-pre.2/go.mod h1:SfgrNsFP9qW8vJEvxQqq8AENwLShtgwlXZ4QAfljoSc= +github.com/cilium/cilium v1.16.0-pre.3 h1:fI4S5fWenqqaGNHlDcaZ6BGCs7+LKQg1YD1e3Py4Lds= +github.com/cilium/cilium v1.16.0-pre.3/go.mod h1:cj+4oNX096CcuLO1XMK4nqF7BVN97yPCDvUlmI5g90s= github.com/cilium/ebpf v0.15.0 h1:7NxJhNiBT3NG8pZJ3c+yfrVdHY8ScgKD27sScgjLMMk= github.com/cilium/ebpf v0.15.0/go.mod h1:DHp1WyrLeiBh19Cf/tfiSMhqheEiK8fXFZ4No0P1Hso= -github.com/cilium/hive v0.0.0-20240425092031-f6d2f20c979b h1:abOzr/jbQ9/QvHPku/i9Uy9nXX21+xZdVlsZuUtoYjY= -github.com/cilium/hive v0.0.0-20240425092031-f6d2f20c979b/go.mod h1:6tW1eCwSq8Wz8IVtpZE0MemoCWSrEOUa8aLKotmBRCo= +github.com/cilium/hive v0.0.0-20240529072208-d997f86e4219 h1:iX4v9lg63iTv8x8MWUMVbeWqtAGcV6yh/w3Zp9sP3ME= +github.com/cilium/hive v0.0.0-20240529072208-d997f86e4219/go.mod h1:6tW1eCwSq8Wz8IVtpZE0MemoCWSrEOUa8aLKotmBRCo= github.com/cilium/proxy v0.0.0-20240418093727-2c7164c53e26 h1:wzm/nEkcMO6oGSySoqe3/bMcF1sxrxI2ByidN3gg30A= github.com/cilium/proxy v0.0.0-20240418093727-2c7164c53e26/go.mod h1:jzAmtWhlyR3kx+AwYdQvGM04lmHwsWhq1ySfAVpY/SA= -github.com/cilium/stream v0.0.0-20240226091623-f979d32855f8 h1:j6VF1s6gz3etRH5ObCr0UUyJblP9cK5fbgkQTz8fTRA= -github.com/cilium/stream v0.0.0-20240226091623-f979d32855f8/go.mod h1:/e83AwqvNKpyg4n3C41qmnmj1x2G9DwzI+jb7GkF4lI= -github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= -github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= -github.com/cncf/xds/go v0.0.0-20240329184929-0c46c01016dc h1:Xo7J+m6Iq9pGYXnooTSpxZ11PzNzI7cKU9V81dpKSRQ= -github.com/cncf/xds/go v0.0.0-20240329184929-0c46c01016dc/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= -github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4= -github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= -github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= -github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/emicklei/go-restful/v3 v3.11.2 h1:1onLa9DcsMYO9P+CXaL0dStDqQ2EHHXLiz+BtnqkLAU= -github.com/emicklei/go-restful/v3 v3.11.2/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= -github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= -github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lShz4oaXpDTX2bLe7ls= -github.com/evanphx/json-patch v5.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= -github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= -github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= +github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= +github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= @@ -99,222 +51,79 @@ github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+Gr github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= github.com/go-openapi/validate v0.24.0 h1:LdfDKwNbpB6Vn40xhTdNZAnfLECL81w+VX3BumrGD58= github.com/go-openapi/validate v0.24.0/go.mod h1:iyeX1sEufmv3nPbBdX3ieNviWnOZaJ1+zquzJEf2BAQ= -github.com/go-quicktest/qt v1.101.0 h1:O1K29Txy5P2OK0dGo59b7b0LR6wKfIhttaAhHUyn7eI= -github.com/go-quicktest/qt v1.101.0/go.mod h1:14Bz/f7NwaXPtdYEgzsx46kqSxVwTbzVZsDC26tQJow= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= -github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= -github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= github.com/google/cel-go v0.20.1 h1:nDx9r8S3L4pE61eDdt8igGj8rf5kjYR3ILxWIpWNi84= github.com/google/cel-go v0.20.1/go.mod h1:kWcIzTsPX0zmQ+H3TirHstLLf9ep5QTsZBN9u4dOYLg= -github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= -github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8= github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= -github.com/google/pprof v0.0.0-20230323073829-e72429f035bd h1:r8yyd+DJDmsUhGrRBxH5Pj7KeFK5l+Y3FsgT8keqKtk= -github.com/google/pprof v0.0.0-20230323073829-e72429f035bd/go.mod h1:79YE0hCXdHag9sBkw2o+N/YnZtTkXi0UT9Nnixa5eYk= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 h1:pRhl55Yx1eC7BZ1N+BBWwnKaMyD8uC+34TLdndZMAKk= github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0/go.mod h1:XKMd7iuf/RGPSMJ/U4HP0zS2Z9Fh8Ps9a+6X26m/tmI= -github.com/hashicorp/consul/api v1.28.2 h1:mXfkRHrpHN4YY3RqL09nXU1eHKLNiuAN4kHvDQ16k/8= -github.com/hashicorp/consul/api v1.28.2/go.mod h1:KyzqzgMEya+IZPcD65YFoOVAgPpbfERu4I/tzG6/ueE= -github.com/hashicorp/consul/sdk v0.16.0 h1:SE9m0W6DEfgIVCJX7xU+iv/hUl4m/nxqMTnCdMxDpJ8= -github.com/hashicorp/consul/sdk v0.16.0/go.mod h1:7pxqqhqoaPqnBnzXD1StKed62LqJeClzVsUEy85Zr0A= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= -github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= -github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= -github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= -github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-immutable-radix/v2 v2.1.0 h1:CUW5RYIcysz+D3B+l1mDeXrQ7fUvGGCwJfdASSzbrfo= -github.com/hashicorp/go-immutable-radix/v2 v2.1.0/go.mod h1:hgdqLXA4f6NIjRVisM1TJ9aOJVNRqKZj+xDGF6m7PBw= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-msgpack v1.1.5 h1:9byZdVjKTe5mce63pRVNP1L7UAmdHOTEMGehn6KvJWs= -github.com/hashicorp/go-msgpack v1.1.5/go.mod h1:gWVc3sv/wbDmR3rQsj1CAktEZzoz1YNK9NfGLXJ69/4= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= -github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= -github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= -github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= -github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-sockaddr v1.0.5 h1:dvk7TIXCZpmfOlM+9mlcrWmWjw/wlKT+VDq2wMvfPJU= -github.com/hashicorp/go-sockaddr v1.0.5/go.mod h1:uoUUmtwU7n9Dv3O4SNLeFvg0SxQ3lyjsj6+CCykpaxI= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= -github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= -github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= -github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= -github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hashicorp/hcl v1.0.1-vault-5 h1:kI3hhbbyzr4dldA8UdTb7ZlVVlI2DACdCfz31RPDgJM= github.com/hashicorp/hcl v1.0.1-vault-5/go.mod h1:XYhtn6ijBSAj6n4YqAaf7RBPS4I06AItNorpy+MoQNM= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= -github.com/hashicorp/memberlist v0.5.0 h1:EtYPN8DpAURiapus508I4n9CzHs2W+8NZGbmmR/prTM= -github.com/hashicorp/memberlist v0.5.0/go.mod h1:yvyXLpo0QaGE59Y7hDTsTzDD25JYBZ4mHgHUZ8lrOI0= -github.com/hashicorp/serf v0.10.1 h1:Z1H2J60yRKvfDYAOZLd2MU0ND4AH/WDz7xYHDWQsIPY= -github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4= -github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= -github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/mackerelio/go-osstat v0.2.4 h1:qxGbdPkFo65PXOb/F/nhDKpF2nGmGaCFDLXoZjJTtUs= -github.com/mackerelio/go-osstat v0.2.4/go.mod h1:Zy+qzGdZs3A9cuIqmgbJvwbmLQH9dJvtio5ZjJTbdlQ= +github.com/mackerelio/go-osstat v0.2.5 h1:+MqTbZUhoIt4m8qzkVoXUJg1EuifwlAJSk4Yl2GXh+o= +github.com/mackerelio/go-osstat v0.2.5/go.mod h1:atxwWF+POUZcdtR1wnsUcQxTytoHG4uhl2AKKzrOajY= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= -github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= -github.com/miekg/dns v1.1.57 h1:Jzi7ApEIzwEPLHWRcafCN9LZSBbqQpxjt/wpgvg7wcM= -github.com/miekg/dns v1.1.57/go.mod h1:uqRjCRUuEAA6qsOiJvDd+CFo/vW+y5WR6SNmHE55hZk= -github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= -github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= -github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM= -github.com/onsi/gomega v1.32.0 h1:JRYU78fJ1LPxlckP6Txi/EYqJvjtMrDC04/MM5XRHPk= -github.com/onsi/gomega v1.32.0/go.mod h1:a4x4gW6Pz2yK1MAmvluYme5lvYTn61afQ2ETw/8n4Lg= github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b h1:FfH+VrHHk6Lxt9HdVS0PXzSXFyS2NbZKXv33FYPol0A= github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b/go.mod h1:AC62GU6hc0BrNm+9RK9VSiwa/EUe1bkIeFORAMcHvJU= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= -github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml/v2 v2.2.1 h1:9TA9+T8+8CUCO2+WYnDLCgrYi9+omqKXyjDtosvtEhg= -github.com/pelletier/go-toml/v2 v2.2.1/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU= -github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= +github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.48.0 h1:QO8U2CdOzSn1BBsmXJXduaaW+dY/5QLjfB8svtSzKKE= github.com/prometheus/common v0.48.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/prometheus/procfs v0.14.0 h1:Lw4VdGGoKEZilJsayHf0B+9YgLGREba2C6xr+Fdfq6s= -github.com/prometheus/procfs v0.14.0/go.mod h1:XL+Iwz8k8ZabyZfMFHPiilCniixqQarAy5Mu67pHlNQ= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= +github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= @@ -328,22 +137,16 @@ github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyh github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace h1:9PNP1jnUjRhfmGMlkXHjYPishpcw4jpSt/V/xYY3FMA= github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= -github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= +github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= +github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs= github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= @@ -351,185 +154,73 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= -github.com/vishvananda/netlink v1.2.1-beta.2.0.20231127184239-0ced8385386a h1:PdKmLjqKUM8AfjGqDbrF/C56RvuGFDMYB0Z+8TMmGpU= -github.com/vishvananda/netlink v1.2.1-beta.2.0.20231127184239-0ced8385386a/go.mod h1:whJevzBpTrid75eZy99s3DqCmy05NfibNaF2Ol5Ox5A= +github.com/vishvananda/netlink v1.2.1-beta.2.0.20240524165444-4d4ba1473f21 h1:tcHUxOT8j/R+0S+A1j8D2InqguXFNxAiij+8QFOlX7Y= +github.com/vishvananda/netlink v1.2.1-beta.2.0.20240524165444-4d4ba1473f21/go.mod h1:whJevzBpTrid75eZy99s3DqCmy05NfibNaF2Ol5Ox5A= github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0= github.com/vishvananda/netns v0.0.4 h1:Oeaw1EM2JMxD51g9uhtC0D7erkIjgmj8+JZc26m1YX8= github.com/vishvananda/netns v0.0.4/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.etcd.io/etcd/api/v3 v3.5.13 h1:8WXU2/NBge6AUF1K1gOexB6e07NgsN1hXK0rSTtgSp4= -go.etcd.io/etcd/api/v3 v3.5.13/go.mod h1:gBqlqkcMMZMVTMm4NDZloEVJzxQOQIls8splbqBDa0c= -go.etcd.io/etcd/client/pkg/v3 v3.5.13 h1:RVZSAnWWWiI5IrYAXjQorajncORbS0zI48LQlE2kQWg= -go.etcd.io/etcd/client/pkg/v3 v3.5.13/go.mod h1:XxHT4u1qU12E2+po+UVPrEeL94Um6zL58ppuJWXSAB8= -go.etcd.io/etcd/client/v3 v3.5.13 h1:o0fHTNJLeO0MyVbc7I3fsCf6nrOqn5d+diSarKnB2js= -go.etcd.io/etcd/client/v3 v3.5.13/go.mod h1:cqiAeY8b5DEEcpxvgWKsbLIWNM/8Wy2xJSDMtioMcoI= go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80= go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c= -go.opentelemetry.io/otel v1.26.0 h1:LQwgL5s/1W7YiiRwxf03QGnWLb2HW4pLiAhaA5cZXBs= -go.opentelemetry.io/otel v1.26.0/go.mod h1:UmLkJHUAidDval2EICqBMbnAd0/m2vmpf/dAM+fvFs4= -go.opentelemetry.io/otel/metric v1.26.0 h1:7S39CLuY5Jgg9CrnA9HHiEjGMF/X2VHvoXGgSllRz30= -go.opentelemetry.io/otel/metric v1.26.0/go.mod h1:SY+rHOI4cEawI9a7N1A4nIg/nTQXe1ccCNWYOJUrpX4= -go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw= -go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= -go.opentelemetry.io/otel/trace v1.26.0 h1:1ieeAUb4y0TE26jUFrCIXKpTuVK7uJGN9/Z/2LP5sQA= -go.opentelemetry.io/otel/trace v1.26.0/go.mod h1:4iDxvGDQuUkHve82hJJ8UqrwswHYsZuWCBllGV2U2y0= +go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= +go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= +go.opentelemetry.io/otel/metric v1.27.0 h1:hvj3vdEKyeCi4YaYfNjv2NUje8FqKqUY8IlF0FxV/ik= +go.opentelemetry.io/otel/metric v1.27.0/go.mod h1:mVFgmRlhljgBiuk/MP/oKylr4hs85GZAylncepAX/ak= +go.opentelemetry.io/otel/trace v1.27.0 h1:IqYb813p7cmbHk0a5y6pD5JPakbVfftRXABGt5/Rscw= +go.opentelemetry.io/otel/trace v1.27.0/go.mod h1:6RiD1hkAprV4/q+yd2ln1HG9GoPx39SuvvstaLBl+l4= go.uber.org/dig v1.17.1 h1:Tga8Lz8PcYNsWsyHMZ1Vm0OQOUaJNDyvPImgbAu9YSc= go.uber.org/dig v1.17.1/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= -go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= -go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= -go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBseWJUpBw5I82+2U4M= go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f h1:99ci1mjWVBWwJiEKYY6jWa4d2nTQVIEhZIptnrVb1XY= -golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= -golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= -golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc h1:O9NuF4s+E/PvMIy+9IUZB9znFwUIXEWSstNjek6VpVg= +golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= -golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= -golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= -golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= -google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be h1:Zz7rLWqp0ApfsR/l7+zSHhY3PMiH2xqgxlfYfAfNpoU= google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be/go.mod h1:dvdCTIoAGbkWbcIKBniID56/7XHTt6WfxXNMxuziJ+w= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240429193739-8cf5692501f6 h1:DujSIu+2tC9Ht0aPNA7jgj23Iq8Ewi5sgkQ++wdvonE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240429193739-8cf5692501f6/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= -google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= -google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.34.0 h1:Qo/qEd2RZPCf2nKuorzksSknv0d3ERwp1vFG38gSmH4= -google.golang.org/protobuf v1.34.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 h1:Zy9XzmMEflZ/MAaA7vNcoebnRAld7FsPW1EeBB7V0m8= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= +google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= +google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= +google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= +google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.30.0 h1:siWhRq7cNjy2iHssOB9SCGNCl2spiF1dO3dABqZ8niA= -k8s.io/api v0.30.0/go.mod h1:OPlaYhoHs8EQ1ql0R/TsUgaRPhpKNxIMrKQfWUp8QSE= -k8s.io/apiextensions-apiserver v0.30.0 h1:jcZFKMqnICJfRxTgnC4E+Hpcq8UEhT8B2lhBcQ+6uAs= -k8s.io/apiextensions-apiserver v0.30.0/go.mod h1:N9ogQFGcrbWqAY9p2mUAL5mGxsLqwgtUce127VtRX5Y= k8s.io/apimachinery v0.30.0 h1:qxVPsyDM5XS96NIh9Oj6LavoVFYff/Pon9cZeDIkHHA= k8s.io/apimachinery v0.30.0/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= k8s.io/client-go v0.30.0 h1:sB1AGGlhY/o7KCyCEQ0bPWzYDL0pwOZO4vAtTSh/gJQ= k8s.io/client-go v0.30.0/go.mod h1:g7li5O5256qe6TYdAMyX/otJqMhIiGgTapdLchhmOaY= k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= -k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCfRziVtos3ofG/sQ= k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= -sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= -sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/vendor/cel.dev/expr/.bazelversion b/vendor/cel.dev/expr/.bazelversion deleted file mode 100644 index 579c9d21e..000000000 --- a/vendor/cel.dev/expr/.bazelversion +++ /dev/null @@ -1,2 +0,0 @@ -6.4.0 -# Keep this pinned version in parity with cel-go diff --git a/vendor/cel.dev/expr/.gitattributes b/vendor/cel.dev/expr/.gitattributes deleted file mode 100644 index 3de1ec213..000000000 --- a/vendor/cel.dev/expr/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -*.pb.go linguist-generated=true -*.pb.go -diff -merge diff --git a/vendor/cel.dev/expr/.gitignore b/vendor/cel.dev/expr/.gitignore deleted file mode 100644 index ac51a054d..000000000 --- a/vendor/cel.dev/expr/.gitignore +++ /dev/null @@ -1 +0,0 @@ -bazel-* diff --git a/vendor/cel.dev/expr/BUILD.bazel b/vendor/cel.dev/expr/BUILD.bazel deleted file mode 100644 index f631b6df0..000000000 --- a/vendor/cel.dev/expr/BUILD.bazel +++ /dev/null @@ -1,3 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) # Apache 2.0 diff --git a/vendor/cel.dev/expr/CODE_OF_CONDUCT.md b/vendor/cel.dev/expr/CODE_OF_CONDUCT.md deleted file mode 100644 index 59908e2d8..000000000 --- a/vendor/cel.dev/expr/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,25 +0,0 @@ -# Contributor Code of Conduct -## Version 0.1.1 (adapted from 0.3b-angular) - -As contributors and maintainers of the Common Expression Language -(CEL) project, we pledge to respect everyone who contributes by -posting issues, updating documentation, submitting pull requests, -providing feedback in comments, and any other activities. - -Communication through any of CEL's channels (GitHub, Gitter, IRC, -mailing lists, Google+, Twitter, etc.) must be constructive and never -resort to personal attacks, trolling, public or private harassment, -insults, or other unprofessional conduct. - -We promise to extend courtesy and respect to everyone involved in this -project regardless of gender, gender identity, sexual orientation, -disability, age, race, ethnicity, religion, or level of experience. We -expect anyone contributing to the project to do the same. - -If any member of the community violates this code of conduct, the -maintainers of the CEL project may take action, removing issues, -comments, and PRs or blocking accounts as deemed appropriate. - -If you are subject to or witness unacceptable behavior, or have any -other concerns, please email us at -[cel-conduct@google.com](mailto:cel-conduct@google.com). diff --git a/vendor/cel.dev/expr/CONTRIBUTING.md b/vendor/cel.dev/expr/CONTRIBUTING.md deleted file mode 100644 index 8f5fd5c31..000000000 --- a/vendor/cel.dev/expr/CONTRIBUTING.md +++ /dev/null @@ -1,32 +0,0 @@ -# How to Contribute - -We'd love to accept your patches and contributions to this project. There are a -few 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 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](https://help.github.com/articles/about-pull-requests/) for more -information on using pull requests. - -## What to expect from maintainers - -Expect maintainers to respond to new issues or pull requests within a week. -For outstanding and ongoing issues and particularly for long-running -pull requests, expect the maintainers to review within a week of a -contributor asking for a new review. There is no commitment to resolution -- -merging or closing a pull request, or fixing or closing an issue -- because some -issues will require more discussion than others. diff --git a/vendor/cel.dev/expr/GOVERNANCE.md b/vendor/cel.dev/expr/GOVERNANCE.md deleted file mode 100644 index 0a525bc17..000000000 --- a/vendor/cel.dev/expr/GOVERNANCE.md +++ /dev/null @@ -1,43 +0,0 @@ -# Project Governance - -This document defines the governance process for the CEL language. CEL is -Google-developed, but openly governed. Major contributors to the CEL -specification and its corresponding implementations constitute the CEL -Language Council. New members may be added by a unanimous vote of the -Council. - -The MAINTAINERS.md file lists the members of the CEL Language Council, and -unofficially indicates the "areas of expertise" of each member with respect -to the publicly available CEL repos. - -## Code Changes - -Code changes must follow the standard pull request (PR) model documented in the -CONTRIBUTING.md for each CEL repo. All fixes and features must be reviewed by a -maintainer. The maintainer reserves the right to request that any feature -request (FR) or PR be reviewed by the language council. - -## Syntax and Semantic Changes - -Syntactic and semantic changes must be reviewed by the CEL Language Council. -Maintainers may also request language council review at their discretion. - -The review process is as follows: - -- Create a Feature Request in the CEL-Spec repo. The feature description will - serve as an abstract for the detailed design document. -- Co-develop a design document with the Language Council. -- Once the proposer gives the design document approval, the document will be - linked to the FR in the CEL-Spec repo and opened for comments to members of - the cel-lang-discuss@googlegroups.com. -- The Language Council will review the design doc at the next council meeting - (once every three weeks) and the council decision included in the document. - -If the proposal is approved, the spec will be updated by a maintainer (if -applicable) and a rationale will be included in the CEL-Spec wiki to ensure -future developers may follow CEL's growth and direction over time. - -Approved proposals may be implemented by the proposer or by the maintainers as -the parties see fit. At the discretion of the maintainer, changes from the -approved design are permitted during implementation if they improve the user -experience and clarity of the feature. diff --git a/vendor/cel.dev/expr/LICENSE b/vendor/cel.dev/expr/LICENSE deleted file mode 100644 index d64569567..000000000 --- a/vendor/cel.dev/expr/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - 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. diff --git a/vendor/cel.dev/expr/MAINTAINERS.md b/vendor/cel.dev/expr/MAINTAINERS.md deleted file mode 100644 index 1ed2eb8ab..000000000 --- a/vendor/cel.dev/expr/MAINTAINERS.md +++ /dev/null @@ -1,13 +0,0 @@ -# CEL Language Council - -| Name | Company | Area of Expertise | -|-----------------|--------------|-------------------| -| Alfred Fuller | Facebook | cel-cpp, cel-spec | -| Jim Larson | Google | cel-go, cel-spec | -| Matthais Blume | Google | cel-spec | -| Tristan Swadell | Google | cel-go, cel-spec | - -## Emeritus - -* Sanjay Ghemawat (Google) -* Wolfgang Grieskamp (Facebook) diff --git a/vendor/cel.dev/expr/README.md b/vendor/cel.dev/expr/README.md deleted file mode 100644 index 2da1e7f2f..000000000 --- a/vendor/cel.dev/expr/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# Common Expression Language - -The Common Expression Language (CEL) implements common semantics for expression -evaluation, enabling different applications to more easily interoperate. - -Key Applications - -* Security policy: organizations have complex infrastructure and need common - tooling to reason about the system as a whole -* Protocols: expressions are a useful data type and require interoperability - across programming languages and platforms. - - -Guiding philosophy: - -1. Keep it small & fast. - * CEL evaluates in linear time, is mutation free, and not Turing-complete. - This limitation is a feature of the language design, which allows the - implementation to evaluate orders of magnitude faster than equivalently - sandboxed JavaScript. -2. Make it extensible. - * CEL is designed to be embedded in applications, and allows for - extensibility via its context which allows for functions and data to be - provided by the software that embeds it. -3. Developer-friendly. - * The language is approachable to developers. The initial spec was based - on the experience of developing Firebase Rules and usability testing - many prior iterations. - * The library itself and accompanying toolings should be easy to adopt by - teams that seek to integrate CEL into their platforms. - -The required components of a system that supports CEL are: - -* The textual representation of an expression as written by a developer. It is - of similar syntax to expressions in C/C++/Java/JavaScript -* A binary representation of an expression. It is an abstract syntax tree - (AST). -* A compiler library that converts the textual representation to the binary - representation. This can be done ahead of time (in the control plane) or - just before evaluation (in the data plane). -* A context containing one or more typed variables, often protobuf messages. - Most use-cases will use `attribute_context.proto` -* An evaluator library that takes the binary format in the context and - produces a result, usually a Boolean. - -Example of boolean conditions and object construction: - -``` c -// Condition -account.balance >= transaction.withdrawal - || (account.overdraftProtection - && account.overdraftLimit >= transaction.withdrawal - account.balance) - -// Object construction -common.GeoPoint{ latitude: 10.0, longitude: -5.5 } -``` - -For more detail, see: - -* [Introduction](doc/intro.md) -* [Language Definition](doc/langdef.md) - -Released under the [Apache License](LICENSE). - -Disclaimer: This is not an official Google product. diff --git a/vendor/cel.dev/expr/WORKSPACE b/vendor/cel.dev/expr/WORKSPACE deleted file mode 100644 index bb4c469ad..000000000 --- a/vendor/cel.dev/expr/WORKSPACE +++ /dev/null @@ -1,145 +0,0 @@ -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -http_archive( - name = "io_bazel_rules_go", - sha256 = "099a9fb96a376ccbbb7d291ed4ecbdfd42f6bc822ab77ae6f1b5cb9e914e94fa", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.35.0/rules_go-v0.35.0.zip", - "https://github.com/bazelbuild/rules_go/releases/download/v0.35.0/rules_go-v0.35.0.zip", - ], -) - -http_archive( - name = "bazel_gazelle", - sha256 = "ecba0f04f96b4960a5b250c8e8eeec42281035970aa8852dda73098274d14a1d", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz", - "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz", - ], -) - -http_archive( - name = "rules_proto", - sha256 = "e017528fd1c91c5a33f15493e3a398181a9e821a804eb7ff5acdd1d2d6c2b18d", - strip_prefix = "rules_proto-4.0.0-3.20.0", - urls = [ - "https://github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0-3.20.0.tar.gz", - ], -) - -# googleapis as of 05/26/2023 -http_archive( - name = "com_google_googleapis", - strip_prefix = "googleapis-07c27163ac591955d736f3057b1619ece66f5b99", - sha256 = "bd8e735d881fb829751ecb1a77038dda4a8d274c45490cb9fcf004583ee10571", - urls = [ - "https://github.com/googleapis/googleapis/archive/07c27163ac591955d736f3057b1619ece66f5b99.tar.gz", - ], -) - -# protobuf -http_archive( - name = "com_google_protobuf", - sha256 = "8242327e5df8c80ba49e4165250b8f79a76bd11765facefaaecfca7747dc8da2", - strip_prefix = "protobuf-3.21.5", - urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.21.5.zip"], -) - -# googletest -http_archive( - name = "com_google_googletest", - urls = ["https://github.com/google/googletest/archive/master.zip"], - strip_prefix = "googletest-master", -) - -# gflags -http_archive( - name = "com_github_gflags_gflags", - sha256 = "6e16c8bc91b1310a44f3965e616383dbda48f83e8c1eaa2370a215057b00cabe", - strip_prefix = "gflags-77592648e3f3be87d6c7123eb81cbad75f9aef5a", - urls = [ - "https://mirror.bazel.build/github.com/gflags/gflags/archive/77592648e3f3be87d6c7123eb81cbad75f9aef5a.tar.gz", - "https://github.com/gflags/gflags/archive/77592648e3f3be87d6c7123eb81cbad75f9aef5a.tar.gz", - ], -) - -# glog -http_archive( - name = "com_google_glog", - sha256 = "1ee310e5d0a19b9d584a855000434bb724aa744745d5b8ab1855c85bff8a8e21", - strip_prefix = "glog-028d37889a1e80e8a07da1b8945ac706259e5fd8", - urls = [ - "https://mirror.bazel.build/github.com/google/glog/archive/028d37889a1e80e8a07da1b8945ac706259e5fd8.tar.gz", - "https://github.com/google/glog/archive/028d37889a1e80e8a07da1b8945ac706259e5fd8.tar.gz", - ], -) - -# absl -http_archive( - name = "com_google_absl", - strip_prefix = "abseil-cpp-master", - urls = ["https://github.com/abseil/abseil-cpp/archive/master.zip"], -) - -load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains") -load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository") -load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language") -load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains") -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") - -switched_rules_by_language( - name = "com_google_googleapis_imports", - cc = True, -) - -# Do *not* call *_dependencies(), etc, yet. See comment at the end. - -# Generated Google APIs protos for Golang -# Generated Google APIs protos for Golang 05/25/2023 -go_repository( - name = "org_golang_google_genproto_googleapis_api", - build_file_proto_mode = "disable_global", - importpath = "google.golang.org/genproto/googleapis/api", - sum = "h1:m8v1xLLLzMe1m5P+gCTF8nJB9epwZQUBERm20Oy1poQ=", - version = "v0.0.0-20230525234035-dd9d682886f9", -) - -# Generated Google APIs protos for Golang 05/25/2023 -go_repository( - name = "org_golang_google_genproto_googleapis_rpc", - build_file_proto_mode = "disable_global", - importpath = "google.golang.org/genproto/googleapis/rpc", - sum = "h1:0nDDozoAU19Qb2HwhXadU8OcsiO/09cnTqhUtq2MEOM=", - version = "v0.0.0-20230525234030-28d5490b6b19", -) - -# gRPC deps -go_repository( - name = "org_golang_google_grpc", - build_file_proto_mode = "disable_global", - importpath = "google.golang.org/grpc", - tag = "v1.49.0", -) - -go_repository( - name = "org_golang_x_net", - importpath = "golang.org/x/net", - sum = "h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=", - version = "v0.0.0-20190311183353-d8887717615a", -) - -go_repository( - name = "org_golang_x_text", - importpath = "golang.org/x/text", - sum = "h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=", - version = "v0.3.2", -) - -# Run the dependencies at the end. These will silently try to import some -# of the above repositories but at different versions, so ours must come first. -go_rules_dependencies() -go_register_toolchains(version = "1.19.1") -gazelle_dependencies() -rules_proto_dependencies() -rules_proto_toolchains() -protobuf_deps() diff --git a/vendor/cel.dev/expr/checked.pb.go b/vendor/cel.dev/expr/checked.pb.go deleted file mode 100644 index bb225c8ab..000000000 --- a/vendor/cel.dev/expr/checked.pb.go +++ /dev/null @@ -1,1432 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 -// source: cel/expr/checked.proto - -package expr - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - emptypb "google.golang.org/protobuf/types/known/emptypb" - structpb "google.golang.org/protobuf/types/known/structpb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type Type_PrimitiveType int32 - -const ( - Type_PRIMITIVE_TYPE_UNSPECIFIED Type_PrimitiveType = 0 - Type_BOOL Type_PrimitiveType = 1 - Type_INT64 Type_PrimitiveType = 2 - Type_UINT64 Type_PrimitiveType = 3 - Type_DOUBLE Type_PrimitiveType = 4 - Type_STRING Type_PrimitiveType = 5 - Type_BYTES Type_PrimitiveType = 6 -) - -// Enum value maps for Type_PrimitiveType. -var ( - Type_PrimitiveType_name = map[int32]string{ - 0: "PRIMITIVE_TYPE_UNSPECIFIED", - 1: "BOOL", - 2: "INT64", - 3: "UINT64", - 4: "DOUBLE", - 5: "STRING", - 6: "BYTES", - } - Type_PrimitiveType_value = map[string]int32{ - "PRIMITIVE_TYPE_UNSPECIFIED": 0, - "BOOL": 1, - "INT64": 2, - "UINT64": 3, - "DOUBLE": 4, - "STRING": 5, - "BYTES": 6, - } -) - -func (x Type_PrimitiveType) Enum() *Type_PrimitiveType { - p := new(Type_PrimitiveType) - *p = x - return p -} - -func (x Type_PrimitiveType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Type_PrimitiveType) Descriptor() protoreflect.EnumDescriptor { - return file_cel_expr_checked_proto_enumTypes[0].Descriptor() -} - -func (Type_PrimitiveType) Type() protoreflect.EnumType { - return &file_cel_expr_checked_proto_enumTypes[0] -} - -func (x Type_PrimitiveType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Type_PrimitiveType.Descriptor instead. -func (Type_PrimitiveType) EnumDescriptor() ([]byte, []int) { - return file_cel_expr_checked_proto_rawDescGZIP(), []int{1, 0} -} - -type Type_WellKnownType int32 - -const ( - Type_WELL_KNOWN_TYPE_UNSPECIFIED Type_WellKnownType = 0 - Type_ANY Type_WellKnownType = 1 - Type_TIMESTAMP Type_WellKnownType = 2 - Type_DURATION Type_WellKnownType = 3 -) - -// Enum value maps for Type_WellKnownType. -var ( - Type_WellKnownType_name = map[int32]string{ - 0: "WELL_KNOWN_TYPE_UNSPECIFIED", - 1: "ANY", - 2: "TIMESTAMP", - 3: "DURATION", - } - Type_WellKnownType_value = map[string]int32{ - "WELL_KNOWN_TYPE_UNSPECIFIED": 0, - "ANY": 1, - "TIMESTAMP": 2, - "DURATION": 3, - } -) - -func (x Type_WellKnownType) Enum() *Type_WellKnownType { - p := new(Type_WellKnownType) - *p = x - return p -} - -func (x Type_WellKnownType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Type_WellKnownType) Descriptor() protoreflect.EnumDescriptor { - return file_cel_expr_checked_proto_enumTypes[1].Descriptor() -} - -func (Type_WellKnownType) Type() protoreflect.EnumType { - return &file_cel_expr_checked_proto_enumTypes[1] -} - -func (x Type_WellKnownType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Type_WellKnownType.Descriptor instead. -func (Type_WellKnownType) EnumDescriptor() ([]byte, []int) { - return file_cel_expr_checked_proto_rawDescGZIP(), []int{1, 1} -} - -type CheckedExpr struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ReferenceMap map[int64]*Reference `protobuf:"bytes,2,rep,name=reference_map,json=referenceMap,proto3" json:"reference_map,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - TypeMap map[int64]*Type `protobuf:"bytes,3,rep,name=type_map,json=typeMap,proto3" json:"type_map,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - SourceInfo *SourceInfo `protobuf:"bytes,5,opt,name=source_info,json=sourceInfo,proto3" json:"source_info,omitempty"` - ExprVersion string `protobuf:"bytes,6,opt,name=expr_version,json=exprVersion,proto3" json:"expr_version,omitempty"` - Expr *Expr `protobuf:"bytes,4,opt,name=expr,proto3" json:"expr,omitempty"` -} - -func (x *CheckedExpr) Reset() { - *x = CheckedExpr{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_checked_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CheckedExpr) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CheckedExpr) ProtoMessage() {} - -func (x *CheckedExpr) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_checked_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CheckedExpr.ProtoReflect.Descriptor instead. -func (*CheckedExpr) Descriptor() ([]byte, []int) { - return file_cel_expr_checked_proto_rawDescGZIP(), []int{0} -} - -func (x *CheckedExpr) GetReferenceMap() map[int64]*Reference { - if x != nil { - return x.ReferenceMap - } - return nil -} - -func (x *CheckedExpr) GetTypeMap() map[int64]*Type { - if x != nil { - return x.TypeMap - } - return nil -} - -func (x *CheckedExpr) GetSourceInfo() *SourceInfo { - if x != nil { - return x.SourceInfo - } - return nil -} - -func (x *CheckedExpr) GetExprVersion() string { - if x != nil { - return x.ExprVersion - } - return "" -} - -func (x *CheckedExpr) GetExpr() *Expr { - if x != nil { - return x.Expr - } - return nil -} - -type Type struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to TypeKind: - // - // *Type_Dyn - // *Type_Null - // *Type_Primitive - // *Type_Wrapper - // *Type_WellKnown - // *Type_ListType_ - // *Type_MapType_ - // *Type_Function - // *Type_MessageType - // *Type_TypeParam - // *Type_Type - // *Type_Error - // *Type_AbstractType_ - TypeKind isType_TypeKind `protobuf_oneof:"type_kind"` -} - -func (x *Type) Reset() { - *x = Type{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_checked_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Type) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Type) ProtoMessage() {} - -func (x *Type) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_checked_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Type.ProtoReflect.Descriptor instead. -func (*Type) Descriptor() ([]byte, []int) { - return file_cel_expr_checked_proto_rawDescGZIP(), []int{1} -} - -func (m *Type) GetTypeKind() isType_TypeKind { - if m != nil { - return m.TypeKind - } - return nil -} - -func (x *Type) GetDyn() *emptypb.Empty { - if x, ok := x.GetTypeKind().(*Type_Dyn); ok { - return x.Dyn - } - return nil -} - -func (x *Type) GetNull() structpb.NullValue { - if x, ok := x.GetTypeKind().(*Type_Null); ok { - return x.Null - } - return structpb.NullValue(0) -} - -func (x *Type) GetPrimitive() Type_PrimitiveType { - if x, ok := x.GetTypeKind().(*Type_Primitive); ok { - return x.Primitive - } - return Type_PRIMITIVE_TYPE_UNSPECIFIED -} - -func (x *Type) GetWrapper() Type_PrimitiveType { - if x, ok := x.GetTypeKind().(*Type_Wrapper); ok { - return x.Wrapper - } - return Type_PRIMITIVE_TYPE_UNSPECIFIED -} - -func (x *Type) GetWellKnown() Type_WellKnownType { - if x, ok := x.GetTypeKind().(*Type_WellKnown); ok { - return x.WellKnown - } - return Type_WELL_KNOWN_TYPE_UNSPECIFIED -} - -func (x *Type) GetListType() *Type_ListType { - if x, ok := x.GetTypeKind().(*Type_ListType_); ok { - return x.ListType - } - return nil -} - -func (x *Type) GetMapType() *Type_MapType { - if x, ok := x.GetTypeKind().(*Type_MapType_); ok { - return x.MapType - } - return nil -} - -func (x *Type) GetFunction() *Type_FunctionType { - if x, ok := x.GetTypeKind().(*Type_Function); ok { - return x.Function - } - return nil -} - -func (x *Type) GetMessageType() string { - if x, ok := x.GetTypeKind().(*Type_MessageType); ok { - return x.MessageType - } - return "" -} - -func (x *Type) GetTypeParam() string { - if x, ok := x.GetTypeKind().(*Type_TypeParam); ok { - return x.TypeParam - } - return "" -} - -func (x *Type) GetType() *Type { - if x, ok := x.GetTypeKind().(*Type_Type); ok { - return x.Type - } - return nil -} - -func (x *Type) GetError() *emptypb.Empty { - if x, ok := x.GetTypeKind().(*Type_Error); ok { - return x.Error - } - return nil -} - -func (x *Type) GetAbstractType() *Type_AbstractType { - if x, ok := x.GetTypeKind().(*Type_AbstractType_); ok { - return x.AbstractType - } - return nil -} - -type isType_TypeKind interface { - isType_TypeKind() -} - -type Type_Dyn struct { - Dyn *emptypb.Empty `protobuf:"bytes,1,opt,name=dyn,proto3,oneof"` -} - -type Type_Null struct { - Null structpb.NullValue `protobuf:"varint,2,opt,name=null,proto3,enum=google.protobuf.NullValue,oneof"` -} - -type Type_Primitive struct { - Primitive Type_PrimitiveType `protobuf:"varint,3,opt,name=primitive,proto3,enum=cel.expr.Type_PrimitiveType,oneof"` -} - -type Type_Wrapper struct { - Wrapper Type_PrimitiveType `protobuf:"varint,4,opt,name=wrapper,proto3,enum=cel.expr.Type_PrimitiveType,oneof"` -} - -type Type_WellKnown struct { - WellKnown Type_WellKnownType `protobuf:"varint,5,opt,name=well_known,json=wellKnown,proto3,enum=cel.expr.Type_WellKnownType,oneof"` -} - -type Type_ListType_ struct { - ListType *Type_ListType `protobuf:"bytes,6,opt,name=list_type,json=listType,proto3,oneof"` -} - -type Type_MapType_ struct { - MapType *Type_MapType `protobuf:"bytes,7,opt,name=map_type,json=mapType,proto3,oneof"` -} - -type Type_Function struct { - Function *Type_FunctionType `protobuf:"bytes,8,opt,name=function,proto3,oneof"` -} - -type Type_MessageType struct { - MessageType string `protobuf:"bytes,9,opt,name=message_type,json=messageType,proto3,oneof"` -} - -type Type_TypeParam struct { - TypeParam string `protobuf:"bytes,10,opt,name=type_param,json=typeParam,proto3,oneof"` -} - -type Type_Type struct { - Type *Type `protobuf:"bytes,11,opt,name=type,proto3,oneof"` -} - -type Type_Error struct { - Error *emptypb.Empty `protobuf:"bytes,12,opt,name=error,proto3,oneof"` -} - -type Type_AbstractType_ struct { - AbstractType *Type_AbstractType `protobuf:"bytes,14,opt,name=abstract_type,json=abstractType,proto3,oneof"` -} - -func (*Type_Dyn) isType_TypeKind() {} - -func (*Type_Null) isType_TypeKind() {} - -func (*Type_Primitive) isType_TypeKind() {} - -func (*Type_Wrapper) isType_TypeKind() {} - -func (*Type_WellKnown) isType_TypeKind() {} - -func (*Type_ListType_) isType_TypeKind() {} - -func (*Type_MapType_) isType_TypeKind() {} - -func (*Type_Function) isType_TypeKind() {} - -func (*Type_MessageType) isType_TypeKind() {} - -func (*Type_TypeParam) isType_TypeKind() {} - -func (*Type_Type) isType_TypeKind() {} - -func (*Type_Error) isType_TypeKind() {} - -func (*Type_AbstractType_) isType_TypeKind() {} - -type Decl struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Types that are assignable to DeclKind: - // - // *Decl_Ident - // *Decl_Function - DeclKind isDecl_DeclKind `protobuf_oneof:"decl_kind"` -} - -func (x *Decl) Reset() { - *x = Decl{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_checked_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Decl) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Decl) ProtoMessage() {} - -func (x *Decl) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_checked_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Decl.ProtoReflect.Descriptor instead. -func (*Decl) Descriptor() ([]byte, []int) { - return file_cel_expr_checked_proto_rawDescGZIP(), []int{2} -} - -func (x *Decl) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (m *Decl) GetDeclKind() isDecl_DeclKind { - if m != nil { - return m.DeclKind - } - return nil -} - -func (x *Decl) GetIdent() *Decl_IdentDecl { - if x, ok := x.GetDeclKind().(*Decl_Ident); ok { - return x.Ident - } - return nil -} - -func (x *Decl) GetFunction() *Decl_FunctionDecl { - if x, ok := x.GetDeclKind().(*Decl_Function); ok { - return x.Function - } - return nil -} - -type isDecl_DeclKind interface { - isDecl_DeclKind() -} - -type Decl_Ident struct { - Ident *Decl_IdentDecl `protobuf:"bytes,2,opt,name=ident,proto3,oneof"` -} - -type Decl_Function struct { - Function *Decl_FunctionDecl `protobuf:"bytes,3,opt,name=function,proto3,oneof"` -} - -func (*Decl_Ident) isDecl_DeclKind() {} - -func (*Decl_Function) isDecl_DeclKind() {} - -type Reference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - OverloadId []string `protobuf:"bytes,3,rep,name=overload_id,json=overloadId,proto3" json:"overload_id,omitempty"` - Value *Constant `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *Reference) Reset() { - *x = Reference{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_checked_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Reference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Reference) ProtoMessage() {} - -func (x *Reference) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_checked_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Reference.ProtoReflect.Descriptor instead. -func (*Reference) Descriptor() ([]byte, []int) { - return file_cel_expr_checked_proto_rawDescGZIP(), []int{3} -} - -func (x *Reference) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Reference) GetOverloadId() []string { - if x != nil { - return x.OverloadId - } - return nil -} - -func (x *Reference) GetValue() *Constant { - if x != nil { - return x.Value - } - return nil -} - -type Type_ListType struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ElemType *Type `protobuf:"bytes,1,opt,name=elem_type,json=elemType,proto3" json:"elem_type,omitempty"` -} - -func (x *Type_ListType) Reset() { - *x = Type_ListType{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_checked_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Type_ListType) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Type_ListType) ProtoMessage() {} - -func (x *Type_ListType) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_checked_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Type_ListType.ProtoReflect.Descriptor instead. -func (*Type_ListType) Descriptor() ([]byte, []int) { - return file_cel_expr_checked_proto_rawDescGZIP(), []int{1, 0} -} - -func (x *Type_ListType) GetElemType() *Type { - if x != nil { - return x.ElemType - } - return nil -} - -type Type_MapType struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - KeyType *Type `protobuf:"bytes,1,opt,name=key_type,json=keyType,proto3" json:"key_type,omitempty"` - ValueType *Type `protobuf:"bytes,2,opt,name=value_type,json=valueType,proto3" json:"value_type,omitempty"` -} - -func (x *Type_MapType) Reset() { - *x = Type_MapType{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_checked_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Type_MapType) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Type_MapType) ProtoMessage() {} - -func (x *Type_MapType) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_checked_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Type_MapType.ProtoReflect.Descriptor instead. -func (*Type_MapType) Descriptor() ([]byte, []int) { - return file_cel_expr_checked_proto_rawDescGZIP(), []int{1, 1} -} - -func (x *Type_MapType) GetKeyType() *Type { - if x != nil { - return x.KeyType - } - return nil -} - -func (x *Type_MapType) GetValueType() *Type { - if x != nil { - return x.ValueType - } - return nil -} - -type Type_FunctionType struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ResultType *Type `protobuf:"bytes,1,opt,name=result_type,json=resultType,proto3" json:"result_type,omitempty"` - ArgTypes []*Type `protobuf:"bytes,2,rep,name=arg_types,json=argTypes,proto3" json:"arg_types,omitempty"` -} - -func (x *Type_FunctionType) Reset() { - *x = Type_FunctionType{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_checked_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Type_FunctionType) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Type_FunctionType) ProtoMessage() {} - -func (x *Type_FunctionType) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_checked_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Type_FunctionType.ProtoReflect.Descriptor instead. -func (*Type_FunctionType) Descriptor() ([]byte, []int) { - return file_cel_expr_checked_proto_rawDescGZIP(), []int{1, 2} -} - -func (x *Type_FunctionType) GetResultType() *Type { - if x != nil { - return x.ResultType - } - return nil -} - -func (x *Type_FunctionType) GetArgTypes() []*Type { - if x != nil { - return x.ArgTypes - } - return nil -} - -type Type_AbstractType struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - ParameterTypes []*Type `protobuf:"bytes,2,rep,name=parameter_types,json=parameterTypes,proto3" json:"parameter_types,omitempty"` -} - -func (x *Type_AbstractType) Reset() { - *x = Type_AbstractType{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_checked_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Type_AbstractType) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Type_AbstractType) ProtoMessage() {} - -func (x *Type_AbstractType) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_checked_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Type_AbstractType.ProtoReflect.Descriptor instead. -func (*Type_AbstractType) Descriptor() ([]byte, []int) { - return file_cel_expr_checked_proto_rawDescGZIP(), []int{1, 3} -} - -func (x *Type_AbstractType) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Type_AbstractType) GetParameterTypes() []*Type { - if x != nil { - return x.ParameterTypes - } - return nil -} - -type Decl_IdentDecl struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type *Type `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Value *Constant `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - Doc string `protobuf:"bytes,3,opt,name=doc,proto3" json:"doc,omitempty"` -} - -func (x *Decl_IdentDecl) Reset() { - *x = Decl_IdentDecl{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_checked_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Decl_IdentDecl) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Decl_IdentDecl) ProtoMessage() {} - -func (x *Decl_IdentDecl) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_checked_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Decl_IdentDecl.ProtoReflect.Descriptor instead. -func (*Decl_IdentDecl) Descriptor() ([]byte, []int) { - return file_cel_expr_checked_proto_rawDescGZIP(), []int{2, 0} -} - -func (x *Decl_IdentDecl) GetType() *Type { - if x != nil { - return x.Type - } - return nil -} - -func (x *Decl_IdentDecl) GetValue() *Constant { - if x != nil { - return x.Value - } - return nil -} - -func (x *Decl_IdentDecl) GetDoc() string { - if x != nil { - return x.Doc - } - return "" -} - -type Decl_FunctionDecl struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Overloads []*Decl_FunctionDecl_Overload `protobuf:"bytes,1,rep,name=overloads,proto3" json:"overloads,omitempty"` -} - -func (x *Decl_FunctionDecl) Reset() { - *x = Decl_FunctionDecl{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_checked_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Decl_FunctionDecl) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Decl_FunctionDecl) ProtoMessage() {} - -func (x *Decl_FunctionDecl) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_checked_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Decl_FunctionDecl.ProtoReflect.Descriptor instead. -func (*Decl_FunctionDecl) Descriptor() ([]byte, []int) { - return file_cel_expr_checked_proto_rawDescGZIP(), []int{2, 1} -} - -func (x *Decl_FunctionDecl) GetOverloads() []*Decl_FunctionDecl_Overload { - if x != nil { - return x.Overloads - } - return nil -} - -type Decl_FunctionDecl_Overload struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - OverloadId string `protobuf:"bytes,1,opt,name=overload_id,json=overloadId,proto3" json:"overload_id,omitempty"` - Params []*Type `protobuf:"bytes,2,rep,name=params,proto3" json:"params,omitempty"` - TypeParams []string `protobuf:"bytes,3,rep,name=type_params,json=typeParams,proto3" json:"type_params,omitempty"` - ResultType *Type `protobuf:"bytes,4,opt,name=result_type,json=resultType,proto3" json:"result_type,omitempty"` - IsInstanceFunction bool `protobuf:"varint,5,opt,name=is_instance_function,json=isInstanceFunction,proto3" json:"is_instance_function,omitempty"` - Doc string `protobuf:"bytes,6,opt,name=doc,proto3" json:"doc,omitempty"` -} - -func (x *Decl_FunctionDecl_Overload) Reset() { - *x = Decl_FunctionDecl_Overload{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_checked_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Decl_FunctionDecl_Overload) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Decl_FunctionDecl_Overload) ProtoMessage() {} - -func (x *Decl_FunctionDecl_Overload) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_checked_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Decl_FunctionDecl_Overload.ProtoReflect.Descriptor instead. -func (*Decl_FunctionDecl_Overload) Descriptor() ([]byte, []int) { - return file_cel_expr_checked_proto_rawDescGZIP(), []int{2, 1, 0} -} - -func (x *Decl_FunctionDecl_Overload) GetOverloadId() string { - if x != nil { - return x.OverloadId - } - return "" -} - -func (x *Decl_FunctionDecl_Overload) GetParams() []*Type { - if x != nil { - return x.Params - } - return nil -} - -func (x *Decl_FunctionDecl_Overload) GetTypeParams() []string { - if x != nil { - return x.TypeParams - } - return nil -} - -func (x *Decl_FunctionDecl_Overload) GetResultType() *Type { - if x != nil { - return x.ResultType - } - return nil -} - -func (x *Decl_FunctionDecl_Overload) GetIsInstanceFunction() bool { - if x != nil { - return x.IsInstanceFunction - } - return false -} - -func (x *Decl_FunctionDecl_Overload) GetDoc() string { - if x != nil { - return x.Doc - } - return "" -} - -var File_cel_expr_checked_proto protoreflect.FileDescriptor - -var file_cel_expr_checked_proto_rawDesc = []byte{ - 0x0a, 0x16, 0x63, 0x65, 0x6c, 0x2f, 0x65, 0x78, 0x70, 0x72, 0x2f, 0x63, 0x68, 0x65, 0x63, 0x6b, - 0x65, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, - 0x70, 0x72, 0x1a, 0x15, 0x63, 0x65, 0x6c, 0x2f, 0x65, 0x78, 0x70, 0x72, 0x2f, 0x73, 0x79, 0x6e, - 0x74, 0x61, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xba, 0x03, 0x0a, 0x0b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x64, - 0x45, 0x78, 0x70, 0x72, 0x12, 0x4c, 0x0a, 0x0d, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x65, - 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x64, 0x45, 0x78, - 0x70, 0x72, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x4d, 0x61, 0x70, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0c, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x4d, - 0x61, 0x70, 0x12, 0x3d, 0x0a, 0x08, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x64, 0x45, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, - 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x74, 0x79, 0x70, 0x65, 0x4d, 0x61, - 0x70, 0x12, 0x35, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, - 0x72, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x21, 0x0a, 0x0c, 0x65, 0x78, 0x70, 0x72, - 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, - 0x65, 0x78, 0x70, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x22, 0x0a, 0x04, 0x65, - 0x78, 0x70, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, - 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52, 0x04, 0x65, 0x78, 0x70, 0x72, 0x1a, - 0x54, 0x0a, 0x11, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x4d, 0x61, 0x70, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x29, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, - 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x4a, 0x0a, 0x0c, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x61, 0x70, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x24, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, - 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, - 0x01, 0x22, 0xe6, 0x09, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x03, 0x64, 0x79, - 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x48, - 0x00, 0x52, 0x03, 0x64, 0x79, 0x6e, 0x12, 0x30, 0x0a, 0x04, 0x6e, 0x75, 0x6c, 0x6c, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x48, 0x00, 0x52, 0x04, 0x6e, 0x75, 0x6c, 0x6c, 0x12, 0x3c, 0x0a, 0x09, 0x70, 0x72, 0x69, 0x6d, - 0x69, 0x74, 0x69, 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x63, 0x65, - 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x50, 0x72, 0x69, 0x6d, - 0x69, 0x74, 0x69, 0x76, 0x65, 0x54, 0x79, 0x70, 0x65, 0x48, 0x00, 0x52, 0x09, 0x70, 0x72, 0x69, - 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, - 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, - 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, - 0x65, 0x54, 0x79, 0x70, 0x65, 0x48, 0x00, 0x52, 0x07, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, - 0x12, 0x3d, 0x0a, 0x0a, 0x77, 0x65, 0x6c, 0x6c, 0x5f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, - 0x54, 0x79, 0x70, 0x65, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, - 0x70, 0x65, 0x48, 0x00, 0x52, 0x09, 0x77, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x12, - 0x36, 0x0a, 0x09, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, - 0x70, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x48, 0x00, 0x52, 0x08, 0x6c, - 0x69, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x61, 0x70, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x65, 0x6c, 0x2e, - 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x4d, 0x61, 0x70, 0x54, 0x79, 0x70, - 0x65, 0x48, 0x00, 0x52, 0x07, 0x6d, 0x61, 0x70, 0x54, 0x79, 0x70, 0x65, 0x12, 0x39, 0x0a, 0x08, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, - 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x46, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x48, 0x00, 0x52, 0x08, 0x66, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, - 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0a, - 0x74, 0x79, 0x70, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, - 0x48, 0x00, 0x52, 0x09, 0x74, 0x79, 0x70, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x24, 0x0a, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, - 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x48, 0x00, 0x52, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x12, 0x2e, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x0c, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x48, 0x00, 0x52, 0x05, 0x65, 0x72, - 0x72, 0x6f, 0x72, 0x12, 0x42, 0x0a, 0x0d, 0x61, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x65, 0x6c, - 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x41, 0x62, 0x73, 0x74, 0x72, - 0x61, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x48, 0x00, 0x52, 0x0c, 0x61, 0x62, 0x73, 0x74, 0x72, - 0x61, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x1a, 0x37, 0x0a, 0x08, 0x4c, 0x69, 0x73, 0x74, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x2b, 0x0a, 0x09, 0x65, 0x6c, 0x65, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, - 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x08, 0x65, 0x6c, 0x65, 0x6d, 0x54, 0x79, 0x70, 0x65, - 0x1a, 0x63, 0x0a, 0x07, 0x4d, 0x61, 0x70, 0x54, 0x79, 0x70, 0x65, 0x12, 0x29, 0x0a, 0x08, 0x6b, - 0x65, 0x79, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, - 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x6b, - 0x65, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2d, 0x0a, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, - 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x54, 0x79, 0x70, 0x65, 0x1a, 0x6c, 0x0a, 0x0c, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2f, 0x0a, 0x0b, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, - 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2b, 0x0a, 0x09, 0x61, 0x72, 0x67, 0x5f, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, - 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x08, 0x61, 0x72, 0x67, 0x54, 0x79, - 0x70, 0x65, 0x73, 0x1a, 0x5b, 0x0a, 0x0c, 0x41, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x0f, 0x70, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, - 0x52, 0x0e, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x73, - 0x22, 0x73, 0x0a, 0x0d, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x1e, 0x0a, 0x1a, 0x50, 0x52, 0x49, 0x4d, 0x49, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, - 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, - 0x00, 0x12, 0x08, 0x0a, 0x04, 0x42, 0x4f, 0x4f, 0x4c, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x49, - 0x4e, 0x54, 0x36, 0x34, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, - 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, 0x10, 0x04, 0x12, 0x0a, - 0x0a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x05, 0x12, 0x09, 0x0a, 0x05, 0x42, 0x59, - 0x54, 0x45, 0x53, 0x10, 0x06, 0x22, 0x56, 0x0a, 0x0d, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, - 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x1b, 0x57, 0x45, 0x4c, 0x4c, 0x5f, 0x4b, - 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, - 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x59, 0x10, 0x01, - 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x49, 0x4d, 0x45, 0x53, 0x54, 0x41, 0x4d, 0x50, 0x10, 0x02, 0x12, - 0x0c, 0x0a, 0x08, 0x44, 0x55, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x03, 0x42, 0x0b, 0x0a, - 0x09, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0xc2, 0x04, 0x0a, 0x04, 0x44, - 0x65, 0x63, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x05, 0x69, 0x64, 0x65, 0x6e, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, - 0x72, 0x2e, 0x44, 0x65, 0x63, 0x6c, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x63, 0x6c, - 0x48, 0x00, 0x52, 0x05, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x12, 0x39, 0x0a, 0x08, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x65, - 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x44, 0x65, 0x63, 0x6c, 0x2e, 0x46, 0x75, 0x6e, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x63, 0x6c, 0x48, 0x00, 0x52, 0x08, 0x66, 0x75, 0x6e, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x6b, 0x0a, 0x09, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x63, - 0x6c, 0x12, 0x22, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, - 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, - 0x10, 0x0a, 0x03, 0x64, 0x6f, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, 0x6f, - 0x63, 0x1a, 0xbe, 0x02, 0x0a, 0x0c, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, - 0x63, 0x6c, 0x12, 0x42, 0x0a, 0x09, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, - 0x2e, 0x44, 0x65, 0x63, 0x6c, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, - 0x63, 0x6c, 0x2e, 0x4f, 0x76, 0x65, 0x72, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x09, 0x6f, 0x76, 0x65, - 0x72, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x1a, 0xe9, 0x01, 0x0a, 0x08, 0x4f, 0x76, 0x65, 0x72, 0x6c, - 0x6f, 0x61, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x6f, 0x61, 0x64, 0x5f, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x6f, - 0x61, 0x64, 0x49, 0x64, 0x12, 0x26, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, - 0x54, 0x79, 0x70, 0x65, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1f, 0x0a, 0x0b, - 0x74, 0x79, 0x70, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x0a, 0x74, 0x79, 0x70, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x2f, 0x0a, - 0x0b, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, - 0x70, 0x65, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x30, - 0x0a, 0x14, 0x69, 0x73, 0x5f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x66, 0x75, - 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x69, 0x73, - 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x10, 0x0a, 0x03, 0x64, 0x6f, 0x63, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, - 0x6f, 0x63, 0x42, 0x0b, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x6c, 0x5f, 0x6b, 0x69, 0x6e, 0x64, 0x22, - 0x6a, 0x0a, 0x09, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x69, 0x64, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x6f, 0x61, 0x64, 0x49, - 0x64, 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x12, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x73, - 0x74, 0x61, 0x6e, 0x74, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x2c, 0x0a, 0x0c, 0x64, - 0x65, 0x76, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x42, 0x09, 0x44, 0x65, 0x63, - 0x6c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x0c, 0x63, 0x65, 0x6c, 0x2e, 0x64, 0x65, - 0x76, 0x2f, 0x65, 0x78, 0x70, 0x72, 0xf8, 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} - -var ( - file_cel_expr_checked_proto_rawDescOnce sync.Once - file_cel_expr_checked_proto_rawDescData = file_cel_expr_checked_proto_rawDesc -) - -func file_cel_expr_checked_proto_rawDescGZIP() []byte { - file_cel_expr_checked_proto_rawDescOnce.Do(func() { - file_cel_expr_checked_proto_rawDescData = protoimpl.X.CompressGZIP(file_cel_expr_checked_proto_rawDescData) - }) - return file_cel_expr_checked_proto_rawDescData -} - -var file_cel_expr_checked_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_cel_expr_checked_proto_msgTypes = make([]protoimpl.MessageInfo, 13) -var file_cel_expr_checked_proto_goTypes = []interface{}{ - (Type_PrimitiveType)(0), // 0: cel.expr.Type.PrimitiveType - (Type_WellKnownType)(0), // 1: cel.expr.Type.WellKnownType - (*CheckedExpr)(nil), // 2: cel.expr.CheckedExpr - (*Type)(nil), // 3: cel.expr.Type - (*Decl)(nil), // 4: cel.expr.Decl - (*Reference)(nil), // 5: cel.expr.Reference - nil, // 6: cel.expr.CheckedExpr.ReferenceMapEntry - nil, // 7: cel.expr.CheckedExpr.TypeMapEntry - (*Type_ListType)(nil), // 8: cel.expr.Type.ListType - (*Type_MapType)(nil), // 9: cel.expr.Type.MapType - (*Type_FunctionType)(nil), // 10: cel.expr.Type.FunctionType - (*Type_AbstractType)(nil), // 11: cel.expr.Type.AbstractType - (*Decl_IdentDecl)(nil), // 12: cel.expr.Decl.IdentDecl - (*Decl_FunctionDecl)(nil), // 13: cel.expr.Decl.FunctionDecl - (*Decl_FunctionDecl_Overload)(nil), // 14: cel.expr.Decl.FunctionDecl.Overload - (*SourceInfo)(nil), // 15: cel.expr.SourceInfo - (*Expr)(nil), // 16: cel.expr.Expr - (*emptypb.Empty)(nil), // 17: google.protobuf.Empty - (structpb.NullValue)(0), // 18: google.protobuf.NullValue - (*Constant)(nil), // 19: cel.expr.Constant -} -var file_cel_expr_checked_proto_depIdxs = []int32{ - 6, // 0: cel.expr.CheckedExpr.reference_map:type_name -> cel.expr.CheckedExpr.ReferenceMapEntry - 7, // 1: cel.expr.CheckedExpr.type_map:type_name -> cel.expr.CheckedExpr.TypeMapEntry - 15, // 2: cel.expr.CheckedExpr.source_info:type_name -> cel.expr.SourceInfo - 16, // 3: cel.expr.CheckedExpr.expr:type_name -> cel.expr.Expr - 17, // 4: cel.expr.Type.dyn:type_name -> google.protobuf.Empty - 18, // 5: cel.expr.Type.null:type_name -> google.protobuf.NullValue - 0, // 6: cel.expr.Type.primitive:type_name -> cel.expr.Type.PrimitiveType - 0, // 7: cel.expr.Type.wrapper:type_name -> cel.expr.Type.PrimitiveType - 1, // 8: cel.expr.Type.well_known:type_name -> cel.expr.Type.WellKnownType - 8, // 9: cel.expr.Type.list_type:type_name -> cel.expr.Type.ListType - 9, // 10: cel.expr.Type.map_type:type_name -> cel.expr.Type.MapType - 10, // 11: cel.expr.Type.function:type_name -> cel.expr.Type.FunctionType - 3, // 12: cel.expr.Type.type:type_name -> cel.expr.Type - 17, // 13: cel.expr.Type.error:type_name -> google.protobuf.Empty - 11, // 14: cel.expr.Type.abstract_type:type_name -> cel.expr.Type.AbstractType - 12, // 15: cel.expr.Decl.ident:type_name -> cel.expr.Decl.IdentDecl - 13, // 16: cel.expr.Decl.function:type_name -> cel.expr.Decl.FunctionDecl - 19, // 17: cel.expr.Reference.value:type_name -> cel.expr.Constant - 5, // 18: cel.expr.CheckedExpr.ReferenceMapEntry.value:type_name -> cel.expr.Reference - 3, // 19: cel.expr.CheckedExpr.TypeMapEntry.value:type_name -> cel.expr.Type - 3, // 20: cel.expr.Type.ListType.elem_type:type_name -> cel.expr.Type - 3, // 21: cel.expr.Type.MapType.key_type:type_name -> cel.expr.Type - 3, // 22: cel.expr.Type.MapType.value_type:type_name -> cel.expr.Type - 3, // 23: cel.expr.Type.FunctionType.result_type:type_name -> cel.expr.Type - 3, // 24: cel.expr.Type.FunctionType.arg_types:type_name -> cel.expr.Type - 3, // 25: cel.expr.Type.AbstractType.parameter_types:type_name -> cel.expr.Type - 3, // 26: cel.expr.Decl.IdentDecl.type:type_name -> cel.expr.Type - 19, // 27: cel.expr.Decl.IdentDecl.value:type_name -> cel.expr.Constant - 14, // 28: cel.expr.Decl.FunctionDecl.overloads:type_name -> cel.expr.Decl.FunctionDecl.Overload - 3, // 29: cel.expr.Decl.FunctionDecl.Overload.params:type_name -> cel.expr.Type - 3, // 30: cel.expr.Decl.FunctionDecl.Overload.result_type:type_name -> cel.expr.Type - 31, // [31:31] is the sub-list for method output_type - 31, // [31:31] is the sub-list for method input_type - 31, // [31:31] is the sub-list for extension type_name - 31, // [31:31] is the sub-list for extension extendee - 0, // [0:31] is the sub-list for field type_name -} - -func init() { file_cel_expr_checked_proto_init() } -func file_cel_expr_checked_proto_init() { - if File_cel_expr_checked_proto != nil { - return - } - file_cel_expr_syntax_proto_init() - if !protoimpl.UnsafeEnabled { - file_cel_expr_checked_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CheckedExpr); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_checked_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Type); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_checked_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Decl); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_checked_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Reference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_checked_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Type_ListType); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_checked_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Type_MapType); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_checked_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Type_FunctionType); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_checked_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Type_AbstractType); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_checked_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Decl_IdentDecl); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_checked_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Decl_FunctionDecl); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_checked_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Decl_FunctionDecl_Overload); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_cel_expr_checked_proto_msgTypes[1].OneofWrappers = []interface{}{ - (*Type_Dyn)(nil), - (*Type_Null)(nil), - (*Type_Primitive)(nil), - (*Type_Wrapper)(nil), - (*Type_WellKnown)(nil), - (*Type_ListType_)(nil), - (*Type_MapType_)(nil), - (*Type_Function)(nil), - (*Type_MessageType)(nil), - (*Type_TypeParam)(nil), - (*Type_Type)(nil), - (*Type_Error)(nil), - (*Type_AbstractType_)(nil), - } - file_cel_expr_checked_proto_msgTypes[2].OneofWrappers = []interface{}{ - (*Decl_Ident)(nil), - (*Decl_Function)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cel_expr_checked_proto_rawDesc, - NumEnums: 2, - NumMessages: 13, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_cel_expr_checked_proto_goTypes, - DependencyIndexes: file_cel_expr_checked_proto_depIdxs, - EnumInfos: file_cel_expr_checked_proto_enumTypes, - MessageInfos: file_cel_expr_checked_proto_msgTypes, - }.Build() - File_cel_expr_checked_proto = out.File - file_cel_expr_checked_proto_rawDesc = nil - file_cel_expr_checked_proto_goTypes = nil - file_cel_expr_checked_proto_depIdxs = nil -} diff --git a/vendor/cel.dev/expr/cloudbuild.yaml b/vendor/cel.dev/expr/cloudbuild.yaml deleted file mode 100644 index 8a8ea3763..000000000 --- a/vendor/cel.dev/expr/cloudbuild.yaml +++ /dev/null @@ -1,9 +0,0 @@ -steps: -- name: 'gcr.io/cloud-builders/bazel:6.4.0' - entrypoint: bazel - args: ['test', '--test_output=errors', '...'] - id: bazel-test - waitFor: ['-'] -timeout: 15m -options: - machineType: 'N1_HIGHCPU_32' diff --git a/vendor/cel.dev/expr/eval.pb.go b/vendor/cel.dev/expr/eval.pb.go deleted file mode 100644 index 8f651f9cc..000000000 --- a/vendor/cel.dev/expr/eval.pb.go +++ /dev/null @@ -1,490 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 -// source: cel/expr/eval.proto - -package expr - -import ( - status "google.golang.org/genproto/googleapis/rpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type EvalState struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Values []*ExprValue `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` - Results []*EvalState_Result `protobuf:"bytes,3,rep,name=results,proto3" json:"results,omitempty"` -} - -func (x *EvalState) Reset() { - *x = EvalState{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_eval_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EvalState) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EvalState) ProtoMessage() {} - -func (x *EvalState) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_eval_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EvalState.ProtoReflect.Descriptor instead. -func (*EvalState) Descriptor() ([]byte, []int) { - return file_cel_expr_eval_proto_rawDescGZIP(), []int{0} -} - -func (x *EvalState) GetValues() []*ExprValue { - if x != nil { - return x.Values - } - return nil -} - -func (x *EvalState) GetResults() []*EvalState_Result { - if x != nil { - return x.Results - } - return nil -} - -type ExprValue struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Kind: - // - // *ExprValue_Value - // *ExprValue_Error - // *ExprValue_Unknown - Kind isExprValue_Kind `protobuf_oneof:"kind"` -} - -func (x *ExprValue) Reset() { - *x = ExprValue{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_eval_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ExprValue) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExprValue) ProtoMessage() {} - -func (x *ExprValue) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_eval_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExprValue.ProtoReflect.Descriptor instead. -func (*ExprValue) Descriptor() ([]byte, []int) { - return file_cel_expr_eval_proto_rawDescGZIP(), []int{1} -} - -func (m *ExprValue) GetKind() isExprValue_Kind { - if m != nil { - return m.Kind - } - return nil -} - -func (x *ExprValue) GetValue() *Value { - if x, ok := x.GetKind().(*ExprValue_Value); ok { - return x.Value - } - return nil -} - -func (x *ExprValue) GetError() *ErrorSet { - if x, ok := x.GetKind().(*ExprValue_Error); ok { - return x.Error - } - return nil -} - -func (x *ExprValue) GetUnknown() *UnknownSet { - if x, ok := x.GetKind().(*ExprValue_Unknown); ok { - return x.Unknown - } - return nil -} - -type isExprValue_Kind interface { - isExprValue_Kind() -} - -type ExprValue_Value struct { - Value *Value `protobuf:"bytes,1,opt,name=value,proto3,oneof"` -} - -type ExprValue_Error struct { - Error *ErrorSet `protobuf:"bytes,2,opt,name=error,proto3,oneof"` -} - -type ExprValue_Unknown struct { - Unknown *UnknownSet `protobuf:"bytes,3,opt,name=unknown,proto3,oneof"` -} - -func (*ExprValue_Value) isExprValue_Kind() {} - -func (*ExprValue_Error) isExprValue_Kind() {} - -func (*ExprValue_Unknown) isExprValue_Kind() {} - -type ErrorSet struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Errors []*status.Status `protobuf:"bytes,1,rep,name=errors,proto3" json:"errors,omitempty"` -} - -func (x *ErrorSet) Reset() { - *x = ErrorSet{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_eval_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ErrorSet) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ErrorSet) ProtoMessage() {} - -func (x *ErrorSet) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_eval_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ErrorSet.ProtoReflect.Descriptor instead. -func (*ErrorSet) Descriptor() ([]byte, []int) { - return file_cel_expr_eval_proto_rawDescGZIP(), []int{2} -} - -func (x *ErrorSet) GetErrors() []*status.Status { - if x != nil { - return x.Errors - } - return nil -} - -type UnknownSet struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Exprs []int64 `protobuf:"varint,1,rep,packed,name=exprs,proto3" json:"exprs,omitempty"` -} - -func (x *UnknownSet) Reset() { - *x = UnknownSet{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_eval_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UnknownSet) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UnknownSet) ProtoMessage() {} - -func (x *UnknownSet) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_eval_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UnknownSet.ProtoReflect.Descriptor instead. -func (*UnknownSet) Descriptor() ([]byte, []int) { - return file_cel_expr_eval_proto_rawDescGZIP(), []int{3} -} - -func (x *UnknownSet) GetExprs() []int64 { - if x != nil { - return x.Exprs - } - return nil -} - -type EvalState_Result struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Expr int64 `protobuf:"varint,1,opt,name=expr,proto3" json:"expr,omitempty"` - Value int64 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *EvalState_Result) Reset() { - *x = EvalState_Result{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_eval_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EvalState_Result) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EvalState_Result) ProtoMessage() {} - -func (x *EvalState_Result) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_eval_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EvalState_Result.ProtoReflect.Descriptor instead. -func (*EvalState_Result) Descriptor() ([]byte, []int) { - return file_cel_expr_eval_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *EvalState_Result) GetExpr() int64 { - if x != nil { - return x.Expr - } - return 0 -} - -func (x *EvalState_Result) GetValue() int64 { - if x != nil { - return x.Value - } - return 0 -} - -var File_cel_expr_eval_proto protoreflect.FileDescriptor - -var file_cel_expr_eval_proto_rawDesc = []byte{ - 0x0a, 0x13, 0x63, 0x65, 0x6c, 0x2f, 0x65, 0x78, 0x70, 0x72, 0x2f, 0x65, 0x76, 0x61, 0x6c, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x1a, - 0x14, 0x63, 0x65, 0x6c, 0x2f, 0x65, 0x78, 0x70, 0x72, 0x2f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x72, 0x70, - 0x63, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa2, - 0x01, 0x0a, 0x09, 0x45, 0x76, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2b, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, - 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x34, 0x0a, 0x07, 0x72, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x63, 0x65, 0x6c, - 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x76, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x2e, - 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x1a, - 0x32, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x65, 0x78, 0x70, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x65, 0x78, 0x70, 0x72, 0x12, 0x14, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x22, 0x9a, 0x01, 0x0a, 0x09, 0x45, 0x78, 0x70, 0x72, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x12, 0x27, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0f, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x48, 0x00, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, - 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x65, 0x6c, 0x2e, - 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x53, 0x65, 0x74, 0x48, 0x00, 0x52, - 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x30, 0x0a, 0x07, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, - 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, - 0x70, 0x72, 0x2e, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x53, 0x65, 0x74, 0x48, 0x00, 0x52, - 0x07, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, - 0x22, 0x36, 0x0a, 0x08, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x53, 0x65, 0x74, 0x12, 0x2a, 0x0a, 0x06, - 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x52, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x22, 0x22, 0x0a, 0x0a, 0x55, 0x6e, 0x6b, 0x6e, - 0x6f, 0x77, 0x6e, 0x53, 0x65, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x70, 0x72, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x03, 0x52, 0x05, 0x65, 0x78, 0x70, 0x72, 0x73, 0x42, 0x2c, 0x0a, 0x0c, - 0x64, 0x65, 0x76, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x42, 0x09, 0x45, 0x76, - 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x0c, 0x63, 0x65, 0x6c, 0x2e, 0x64, - 0x65, 0x76, 0x2f, 0x65, 0x78, 0x70, 0x72, 0xf8, 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_cel_expr_eval_proto_rawDescOnce sync.Once - file_cel_expr_eval_proto_rawDescData = file_cel_expr_eval_proto_rawDesc -) - -func file_cel_expr_eval_proto_rawDescGZIP() []byte { - file_cel_expr_eval_proto_rawDescOnce.Do(func() { - file_cel_expr_eval_proto_rawDescData = protoimpl.X.CompressGZIP(file_cel_expr_eval_proto_rawDescData) - }) - return file_cel_expr_eval_proto_rawDescData -} - -var file_cel_expr_eval_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_cel_expr_eval_proto_goTypes = []interface{}{ - (*EvalState)(nil), // 0: cel.expr.EvalState - (*ExprValue)(nil), // 1: cel.expr.ExprValue - (*ErrorSet)(nil), // 2: cel.expr.ErrorSet - (*UnknownSet)(nil), // 3: cel.expr.UnknownSet - (*EvalState_Result)(nil), // 4: cel.expr.EvalState.Result - (*Value)(nil), // 5: cel.expr.Value - (*status.Status)(nil), // 6: google.rpc.Status -} -var file_cel_expr_eval_proto_depIdxs = []int32{ - 1, // 0: cel.expr.EvalState.values:type_name -> cel.expr.ExprValue - 4, // 1: cel.expr.EvalState.results:type_name -> cel.expr.EvalState.Result - 5, // 2: cel.expr.ExprValue.value:type_name -> cel.expr.Value - 2, // 3: cel.expr.ExprValue.error:type_name -> cel.expr.ErrorSet - 3, // 4: cel.expr.ExprValue.unknown:type_name -> cel.expr.UnknownSet - 6, // 5: cel.expr.ErrorSet.errors:type_name -> google.rpc.Status - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name -} - -func init() { file_cel_expr_eval_proto_init() } -func file_cel_expr_eval_proto_init() { - if File_cel_expr_eval_proto != nil { - return - } - file_cel_expr_value_proto_init() - if !protoimpl.UnsafeEnabled { - file_cel_expr_eval_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EvalState); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_eval_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExprValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_eval_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ErrorSet); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_eval_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UnknownSet); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_eval_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EvalState_Result); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_cel_expr_eval_proto_msgTypes[1].OneofWrappers = []interface{}{ - (*ExprValue_Value)(nil), - (*ExprValue_Error)(nil), - (*ExprValue_Unknown)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cel_expr_eval_proto_rawDesc, - NumEnums: 0, - NumMessages: 5, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_cel_expr_eval_proto_goTypes, - DependencyIndexes: file_cel_expr_eval_proto_depIdxs, - MessageInfos: file_cel_expr_eval_proto_msgTypes, - }.Build() - File_cel_expr_eval_proto = out.File - file_cel_expr_eval_proto_rawDesc = nil - file_cel_expr_eval_proto_goTypes = nil - file_cel_expr_eval_proto_depIdxs = nil -} diff --git a/vendor/cel.dev/expr/explain.pb.go b/vendor/cel.dev/expr/explain.pb.go deleted file mode 100644 index 79fd5443b..000000000 --- a/vendor/cel.dev/expr/explain.pb.go +++ /dev/null @@ -1,236 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 -// source: cel/expr/explain.proto - -package expr - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// Deprecated: Do not use. -type Explain struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Values []*Value `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` - ExprSteps []*Explain_ExprStep `protobuf:"bytes,2,rep,name=expr_steps,json=exprSteps,proto3" json:"expr_steps,omitempty"` -} - -func (x *Explain) Reset() { - *x = Explain{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_explain_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Explain) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Explain) ProtoMessage() {} - -func (x *Explain) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_explain_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Explain.ProtoReflect.Descriptor instead. -func (*Explain) Descriptor() ([]byte, []int) { - return file_cel_expr_explain_proto_rawDescGZIP(), []int{0} -} - -func (x *Explain) GetValues() []*Value { - if x != nil { - return x.Values - } - return nil -} - -func (x *Explain) GetExprSteps() []*Explain_ExprStep { - if x != nil { - return x.ExprSteps - } - return nil -} - -type Explain_ExprStep struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - ValueIndex int32 `protobuf:"varint,2,opt,name=value_index,json=valueIndex,proto3" json:"value_index,omitempty"` -} - -func (x *Explain_ExprStep) Reset() { - *x = Explain_ExprStep{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_explain_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Explain_ExprStep) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Explain_ExprStep) ProtoMessage() {} - -func (x *Explain_ExprStep) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_explain_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Explain_ExprStep.ProtoReflect.Descriptor instead. -func (*Explain_ExprStep) Descriptor() ([]byte, []int) { - return file_cel_expr_explain_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *Explain_ExprStep) GetId() int64 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *Explain_ExprStep) GetValueIndex() int32 { - if x != nil { - return x.ValueIndex - } - return 0 -} - -var File_cel_expr_explain_proto protoreflect.FileDescriptor - -var file_cel_expr_explain_proto_rawDesc = []byte{ - 0x0a, 0x16, 0x63, 0x65, 0x6c, 0x2f, 0x65, 0x78, 0x70, 0x72, 0x2f, 0x65, 0x78, 0x70, 0x6c, 0x61, - 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, - 0x70, 0x72, 0x1a, 0x14, 0x63, 0x65, 0x6c, 0x2f, 0x65, 0x78, 0x70, 0x72, 0x2f, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xae, 0x01, 0x0a, 0x07, 0x45, 0x78, 0x70, - 0x6c, 0x61, 0x69, 0x6e, 0x12, 0x27, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x39, 0x0a, - 0x0a, 0x65, 0x78, 0x70, 0x72, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, - 0x6c, 0x61, 0x69, 0x6e, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x53, 0x74, 0x65, 0x70, 0x52, 0x09, 0x65, - 0x78, 0x70, 0x72, 0x53, 0x74, 0x65, 0x70, 0x73, 0x1a, 0x3b, 0x0a, 0x08, 0x45, 0x78, 0x70, 0x72, - 0x53, 0x74, 0x65, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x02, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x69, 0x6e, - 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x49, 0x6e, 0x64, 0x65, 0x78, 0x3a, 0x02, 0x18, 0x01, 0x42, 0x2f, 0x0a, 0x0c, 0x64, 0x65, 0x76, - 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x42, 0x0c, 0x45, 0x78, 0x70, 0x6c, 0x61, - 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x0c, 0x63, 0x65, 0x6c, 0x2e, 0x64, - 0x65, 0x76, 0x2f, 0x65, 0x78, 0x70, 0x72, 0xf8, 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_cel_expr_explain_proto_rawDescOnce sync.Once - file_cel_expr_explain_proto_rawDescData = file_cel_expr_explain_proto_rawDesc -) - -func file_cel_expr_explain_proto_rawDescGZIP() []byte { - file_cel_expr_explain_proto_rawDescOnce.Do(func() { - file_cel_expr_explain_proto_rawDescData = protoimpl.X.CompressGZIP(file_cel_expr_explain_proto_rawDescData) - }) - return file_cel_expr_explain_proto_rawDescData -} - -var file_cel_expr_explain_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_cel_expr_explain_proto_goTypes = []interface{}{ - (*Explain)(nil), // 0: cel.expr.Explain - (*Explain_ExprStep)(nil), // 1: cel.expr.Explain.ExprStep - (*Value)(nil), // 2: cel.expr.Value -} -var file_cel_expr_explain_proto_depIdxs = []int32{ - 2, // 0: cel.expr.Explain.values:type_name -> cel.expr.Value - 1, // 1: cel.expr.Explain.expr_steps:type_name -> cel.expr.Explain.ExprStep - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_cel_expr_explain_proto_init() } -func file_cel_expr_explain_proto_init() { - if File_cel_expr_explain_proto != nil { - return - } - file_cel_expr_value_proto_init() - if !protoimpl.UnsafeEnabled { - file_cel_expr_explain_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Explain); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_explain_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Explain_ExprStep); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cel_expr_explain_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_cel_expr_explain_proto_goTypes, - DependencyIndexes: file_cel_expr_explain_proto_depIdxs, - MessageInfos: file_cel_expr_explain_proto_msgTypes, - }.Build() - File_cel_expr_explain_proto = out.File - file_cel_expr_explain_proto_rawDesc = nil - file_cel_expr_explain_proto_goTypes = nil - file_cel_expr_explain_proto_depIdxs = nil -} diff --git a/vendor/cel.dev/expr/regen_go_proto.sh b/vendor/cel.dev/expr/regen_go_proto.sh deleted file mode 100644 index abf2f9788..000000000 --- a/vendor/cel.dev/expr/regen_go_proto.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -bazel build //proto/test/... -files=($(bazel aquery 'kind(proto, //proto/...)' | grep Outputs | grep "[.]pb[.]go" | sed 's/Outputs: \[//' | sed 's/\]//' | tr "," "\n")) -for src in ${files[@]}; -do - dst=$(echo $src | sed 's/\(.*\%\/github.com\/google\/cel-spec\/\(.*\)\)/\2/') - echo "copying $dst" - $(cp $src $dst) -done diff --git a/vendor/cel.dev/expr/regen_go_proto_canonical_protos.sh b/vendor/cel.dev/expr/regen_go_proto_canonical_protos.sh deleted file mode 100644 index 9a13479e4..000000000 --- a/vendor/cel.dev/expr/regen_go_proto_canonical_protos.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -bazel build //proto/cel/expr:all - -rm -vf ./*.pb.go - -files=( $(bazel cquery //proto/cel/expr:expr_go_proto --output=starlark --starlark:expr="'\n'.join([f.path for f in target.output_groups.go_generated_srcs.to_list()])") ) -for src in "${files[@]}"; -do - cp -v "${src}" ./ -done diff --git a/vendor/cel.dev/expr/syntax.pb.go b/vendor/cel.dev/expr/syntax.pb.go deleted file mode 100644 index 48a952872..000000000 --- a/vendor/cel.dev/expr/syntax.pb.go +++ /dev/null @@ -1,1633 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 -// source: cel/expr/syntax.proto - -package expr - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - durationpb "google.golang.org/protobuf/types/known/durationpb" - structpb "google.golang.org/protobuf/types/known/structpb" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type SourceInfo_Extension_Component int32 - -const ( - SourceInfo_Extension_COMPONENT_UNSPECIFIED SourceInfo_Extension_Component = 0 - SourceInfo_Extension_COMPONENT_PARSER SourceInfo_Extension_Component = 1 - SourceInfo_Extension_COMPONENT_TYPE_CHECKER SourceInfo_Extension_Component = 2 - SourceInfo_Extension_COMPONENT_RUNTIME SourceInfo_Extension_Component = 3 -) - -// Enum value maps for SourceInfo_Extension_Component. -var ( - SourceInfo_Extension_Component_name = map[int32]string{ - 0: "COMPONENT_UNSPECIFIED", - 1: "COMPONENT_PARSER", - 2: "COMPONENT_TYPE_CHECKER", - 3: "COMPONENT_RUNTIME", - } - SourceInfo_Extension_Component_value = map[string]int32{ - "COMPONENT_UNSPECIFIED": 0, - "COMPONENT_PARSER": 1, - "COMPONENT_TYPE_CHECKER": 2, - "COMPONENT_RUNTIME": 3, - } -) - -func (x SourceInfo_Extension_Component) Enum() *SourceInfo_Extension_Component { - p := new(SourceInfo_Extension_Component) - *p = x - return p -} - -func (x SourceInfo_Extension_Component) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (SourceInfo_Extension_Component) Descriptor() protoreflect.EnumDescriptor { - return file_cel_expr_syntax_proto_enumTypes[0].Descriptor() -} - -func (SourceInfo_Extension_Component) Type() protoreflect.EnumType { - return &file_cel_expr_syntax_proto_enumTypes[0] -} - -func (x SourceInfo_Extension_Component) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use SourceInfo_Extension_Component.Descriptor instead. -func (SourceInfo_Extension_Component) EnumDescriptor() ([]byte, []int) { - return file_cel_expr_syntax_proto_rawDescGZIP(), []int{3, 2, 0} -} - -type ParsedExpr struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Expr *Expr `protobuf:"bytes,2,opt,name=expr,proto3" json:"expr,omitempty"` - SourceInfo *SourceInfo `protobuf:"bytes,3,opt,name=source_info,json=sourceInfo,proto3" json:"source_info,omitempty"` -} - -func (x *ParsedExpr) Reset() { - *x = ParsedExpr{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ParsedExpr) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ParsedExpr) ProtoMessage() {} - -func (x *ParsedExpr) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_syntax_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ParsedExpr.ProtoReflect.Descriptor instead. -func (*ParsedExpr) Descriptor() ([]byte, []int) { - return file_cel_expr_syntax_proto_rawDescGZIP(), []int{0} -} - -func (x *ParsedExpr) GetExpr() *Expr { - if x != nil { - return x.Expr - } - return nil -} - -func (x *ParsedExpr) GetSourceInfo() *SourceInfo { - if x != nil { - return x.SourceInfo - } - return nil -} - -type Expr struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id int64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` - // Types that are assignable to ExprKind: - // - // *Expr_ConstExpr - // *Expr_IdentExpr - // *Expr_SelectExpr - // *Expr_CallExpr - // *Expr_ListExpr - // *Expr_StructExpr - // *Expr_ComprehensionExpr - ExprKind isExpr_ExprKind `protobuf_oneof:"expr_kind"` -} - -func (x *Expr) Reset() { - *x = Expr{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Expr) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Expr) ProtoMessage() {} - -func (x *Expr) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_syntax_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Expr.ProtoReflect.Descriptor instead. -func (*Expr) Descriptor() ([]byte, []int) { - return file_cel_expr_syntax_proto_rawDescGZIP(), []int{1} -} - -func (x *Expr) GetId() int64 { - if x != nil { - return x.Id - } - return 0 -} - -func (m *Expr) GetExprKind() isExpr_ExprKind { - if m != nil { - return m.ExprKind - } - return nil -} - -func (x *Expr) GetConstExpr() *Constant { - if x, ok := x.GetExprKind().(*Expr_ConstExpr); ok { - return x.ConstExpr - } - return nil -} - -func (x *Expr) GetIdentExpr() *Expr_Ident { - if x, ok := x.GetExprKind().(*Expr_IdentExpr); ok { - return x.IdentExpr - } - return nil -} - -func (x *Expr) GetSelectExpr() *Expr_Select { - if x, ok := x.GetExprKind().(*Expr_SelectExpr); ok { - return x.SelectExpr - } - return nil -} - -func (x *Expr) GetCallExpr() *Expr_Call { - if x, ok := x.GetExprKind().(*Expr_CallExpr); ok { - return x.CallExpr - } - return nil -} - -func (x *Expr) GetListExpr() *Expr_CreateList { - if x, ok := x.GetExprKind().(*Expr_ListExpr); ok { - return x.ListExpr - } - return nil -} - -func (x *Expr) GetStructExpr() *Expr_CreateStruct { - if x, ok := x.GetExprKind().(*Expr_StructExpr); ok { - return x.StructExpr - } - return nil -} - -func (x *Expr) GetComprehensionExpr() *Expr_Comprehension { - if x, ok := x.GetExprKind().(*Expr_ComprehensionExpr); ok { - return x.ComprehensionExpr - } - return nil -} - -type isExpr_ExprKind interface { - isExpr_ExprKind() -} - -type Expr_ConstExpr struct { - ConstExpr *Constant `protobuf:"bytes,3,opt,name=const_expr,json=constExpr,proto3,oneof"` -} - -type Expr_IdentExpr struct { - IdentExpr *Expr_Ident `protobuf:"bytes,4,opt,name=ident_expr,json=identExpr,proto3,oneof"` -} - -type Expr_SelectExpr struct { - SelectExpr *Expr_Select `protobuf:"bytes,5,opt,name=select_expr,json=selectExpr,proto3,oneof"` -} - -type Expr_CallExpr struct { - CallExpr *Expr_Call `protobuf:"bytes,6,opt,name=call_expr,json=callExpr,proto3,oneof"` -} - -type Expr_ListExpr struct { - ListExpr *Expr_CreateList `protobuf:"bytes,7,opt,name=list_expr,json=listExpr,proto3,oneof"` -} - -type Expr_StructExpr struct { - StructExpr *Expr_CreateStruct `protobuf:"bytes,8,opt,name=struct_expr,json=structExpr,proto3,oneof"` -} - -type Expr_ComprehensionExpr struct { - ComprehensionExpr *Expr_Comprehension `protobuf:"bytes,9,opt,name=comprehension_expr,json=comprehensionExpr,proto3,oneof"` -} - -func (*Expr_ConstExpr) isExpr_ExprKind() {} - -func (*Expr_IdentExpr) isExpr_ExprKind() {} - -func (*Expr_SelectExpr) isExpr_ExprKind() {} - -func (*Expr_CallExpr) isExpr_ExprKind() {} - -func (*Expr_ListExpr) isExpr_ExprKind() {} - -func (*Expr_StructExpr) isExpr_ExprKind() {} - -func (*Expr_ComprehensionExpr) isExpr_ExprKind() {} - -type Constant struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to ConstantKind: - // - // *Constant_NullValue - // *Constant_BoolValue - // *Constant_Int64Value - // *Constant_Uint64Value - // *Constant_DoubleValue - // *Constant_StringValue - // *Constant_BytesValue - // *Constant_DurationValue - // *Constant_TimestampValue - ConstantKind isConstant_ConstantKind `protobuf_oneof:"constant_kind"` -} - -func (x *Constant) Reset() { - *x = Constant{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Constant) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Constant) ProtoMessage() {} - -func (x *Constant) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_syntax_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Constant.ProtoReflect.Descriptor instead. -func (*Constant) Descriptor() ([]byte, []int) { - return file_cel_expr_syntax_proto_rawDescGZIP(), []int{2} -} - -func (m *Constant) GetConstantKind() isConstant_ConstantKind { - if m != nil { - return m.ConstantKind - } - return nil -} - -func (x *Constant) GetNullValue() structpb.NullValue { - if x, ok := x.GetConstantKind().(*Constant_NullValue); ok { - return x.NullValue - } - return structpb.NullValue(0) -} - -func (x *Constant) GetBoolValue() bool { - if x, ok := x.GetConstantKind().(*Constant_BoolValue); ok { - return x.BoolValue - } - return false -} - -func (x *Constant) GetInt64Value() int64 { - if x, ok := x.GetConstantKind().(*Constant_Int64Value); ok { - return x.Int64Value - } - return 0 -} - -func (x *Constant) GetUint64Value() uint64 { - if x, ok := x.GetConstantKind().(*Constant_Uint64Value); ok { - return x.Uint64Value - } - return 0 -} - -func (x *Constant) GetDoubleValue() float64 { - if x, ok := x.GetConstantKind().(*Constant_DoubleValue); ok { - return x.DoubleValue - } - return 0 -} - -func (x *Constant) GetStringValue() string { - if x, ok := x.GetConstantKind().(*Constant_StringValue); ok { - return x.StringValue - } - return "" -} - -func (x *Constant) GetBytesValue() []byte { - if x, ok := x.GetConstantKind().(*Constant_BytesValue); ok { - return x.BytesValue - } - return nil -} - -// Deprecated: Do not use. -func (x *Constant) GetDurationValue() *durationpb.Duration { - if x, ok := x.GetConstantKind().(*Constant_DurationValue); ok { - return x.DurationValue - } - return nil -} - -// Deprecated: Do not use. -func (x *Constant) GetTimestampValue() *timestamppb.Timestamp { - if x, ok := x.GetConstantKind().(*Constant_TimestampValue); ok { - return x.TimestampValue - } - return nil -} - -type isConstant_ConstantKind interface { - isConstant_ConstantKind() -} - -type Constant_NullValue struct { - NullValue structpb.NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,proto3,enum=google.protobuf.NullValue,oneof"` -} - -type Constant_BoolValue struct { - BoolValue bool `protobuf:"varint,2,opt,name=bool_value,json=boolValue,proto3,oneof"` -} - -type Constant_Int64Value struct { - Int64Value int64 `protobuf:"varint,3,opt,name=int64_value,json=int64Value,proto3,oneof"` -} - -type Constant_Uint64Value struct { - Uint64Value uint64 `protobuf:"varint,4,opt,name=uint64_value,json=uint64Value,proto3,oneof"` -} - -type Constant_DoubleValue struct { - DoubleValue float64 `protobuf:"fixed64,5,opt,name=double_value,json=doubleValue,proto3,oneof"` -} - -type Constant_StringValue struct { - StringValue string `protobuf:"bytes,6,opt,name=string_value,json=stringValue,proto3,oneof"` -} - -type Constant_BytesValue struct { - BytesValue []byte `protobuf:"bytes,7,opt,name=bytes_value,json=bytesValue,proto3,oneof"` -} - -type Constant_DurationValue struct { - // Deprecated: Do not use. - DurationValue *durationpb.Duration `protobuf:"bytes,8,opt,name=duration_value,json=durationValue,proto3,oneof"` -} - -type Constant_TimestampValue struct { - // Deprecated: Do not use. - TimestampValue *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=timestamp_value,json=timestampValue,proto3,oneof"` -} - -func (*Constant_NullValue) isConstant_ConstantKind() {} - -func (*Constant_BoolValue) isConstant_ConstantKind() {} - -func (*Constant_Int64Value) isConstant_ConstantKind() {} - -func (*Constant_Uint64Value) isConstant_ConstantKind() {} - -func (*Constant_DoubleValue) isConstant_ConstantKind() {} - -func (*Constant_StringValue) isConstant_ConstantKind() {} - -func (*Constant_BytesValue) isConstant_ConstantKind() {} - -func (*Constant_DurationValue) isConstant_ConstantKind() {} - -func (*Constant_TimestampValue) isConstant_ConstantKind() {} - -type SourceInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SyntaxVersion string `protobuf:"bytes,1,opt,name=syntax_version,json=syntaxVersion,proto3" json:"syntax_version,omitempty"` - Location string `protobuf:"bytes,2,opt,name=location,proto3" json:"location,omitempty"` - LineOffsets []int32 `protobuf:"varint,3,rep,packed,name=line_offsets,json=lineOffsets,proto3" json:"line_offsets,omitempty"` - Positions map[int64]int32 `protobuf:"bytes,4,rep,name=positions,proto3" json:"positions,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` - MacroCalls map[int64]*Expr `protobuf:"bytes,5,rep,name=macro_calls,json=macroCalls,proto3" json:"macro_calls,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Extensions []*SourceInfo_Extension `protobuf:"bytes,6,rep,name=extensions,proto3" json:"extensions,omitempty"` -} - -func (x *SourceInfo) Reset() { - *x = SourceInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SourceInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SourceInfo) ProtoMessage() {} - -func (x *SourceInfo) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_syntax_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SourceInfo.ProtoReflect.Descriptor instead. -func (*SourceInfo) Descriptor() ([]byte, []int) { - return file_cel_expr_syntax_proto_rawDescGZIP(), []int{3} -} - -func (x *SourceInfo) GetSyntaxVersion() string { - if x != nil { - return x.SyntaxVersion - } - return "" -} - -func (x *SourceInfo) GetLocation() string { - if x != nil { - return x.Location - } - return "" -} - -func (x *SourceInfo) GetLineOffsets() []int32 { - if x != nil { - return x.LineOffsets - } - return nil -} - -func (x *SourceInfo) GetPositions() map[int64]int32 { - if x != nil { - return x.Positions - } - return nil -} - -func (x *SourceInfo) GetMacroCalls() map[int64]*Expr { - if x != nil { - return x.MacroCalls - } - return nil -} - -func (x *SourceInfo) GetExtensions() []*SourceInfo_Extension { - if x != nil { - return x.Extensions - } - return nil -} - -type Expr_Ident struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` -} - -func (x *Expr_Ident) Reset() { - *x = Expr_Ident{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Expr_Ident) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Expr_Ident) ProtoMessage() {} - -func (x *Expr_Ident) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_syntax_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Expr_Ident.ProtoReflect.Descriptor instead. -func (*Expr_Ident) Descriptor() ([]byte, []int) { - return file_cel_expr_syntax_proto_rawDescGZIP(), []int{1, 0} -} - -func (x *Expr_Ident) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type Expr_Select struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Operand *Expr `protobuf:"bytes,1,opt,name=operand,proto3" json:"operand,omitempty"` - Field string `protobuf:"bytes,2,opt,name=field,proto3" json:"field,omitempty"` - TestOnly bool `protobuf:"varint,3,opt,name=test_only,json=testOnly,proto3" json:"test_only,omitempty"` -} - -func (x *Expr_Select) Reset() { - *x = Expr_Select{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Expr_Select) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Expr_Select) ProtoMessage() {} - -func (x *Expr_Select) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_syntax_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Expr_Select.ProtoReflect.Descriptor instead. -func (*Expr_Select) Descriptor() ([]byte, []int) { - return file_cel_expr_syntax_proto_rawDescGZIP(), []int{1, 1} -} - -func (x *Expr_Select) GetOperand() *Expr { - if x != nil { - return x.Operand - } - return nil -} - -func (x *Expr_Select) GetField() string { - if x != nil { - return x.Field - } - return "" -} - -func (x *Expr_Select) GetTestOnly() bool { - if x != nil { - return x.TestOnly - } - return false -} - -type Expr_Call struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Target *Expr `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` - Function string `protobuf:"bytes,2,opt,name=function,proto3" json:"function,omitempty"` - Args []*Expr `protobuf:"bytes,3,rep,name=args,proto3" json:"args,omitempty"` -} - -func (x *Expr_Call) Reset() { - *x = Expr_Call{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Expr_Call) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Expr_Call) ProtoMessage() {} - -func (x *Expr_Call) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_syntax_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Expr_Call.ProtoReflect.Descriptor instead. -func (*Expr_Call) Descriptor() ([]byte, []int) { - return file_cel_expr_syntax_proto_rawDescGZIP(), []int{1, 2} -} - -func (x *Expr_Call) GetTarget() *Expr { - if x != nil { - return x.Target - } - return nil -} - -func (x *Expr_Call) GetFunction() string { - if x != nil { - return x.Function - } - return "" -} - -func (x *Expr_Call) GetArgs() []*Expr { - if x != nil { - return x.Args - } - return nil -} - -type Expr_CreateList struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Elements []*Expr `protobuf:"bytes,1,rep,name=elements,proto3" json:"elements,omitempty"` - OptionalIndices []int32 `protobuf:"varint,2,rep,packed,name=optional_indices,json=optionalIndices,proto3" json:"optional_indices,omitempty"` -} - -func (x *Expr_CreateList) Reset() { - *x = Expr_CreateList{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Expr_CreateList) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Expr_CreateList) ProtoMessage() {} - -func (x *Expr_CreateList) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_syntax_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Expr_CreateList.ProtoReflect.Descriptor instead. -func (*Expr_CreateList) Descriptor() ([]byte, []int) { - return file_cel_expr_syntax_proto_rawDescGZIP(), []int{1, 3} -} - -func (x *Expr_CreateList) GetElements() []*Expr { - if x != nil { - return x.Elements - } - return nil -} - -func (x *Expr_CreateList) GetOptionalIndices() []int32 { - if x != nil { - return x.OptionalIndices - } - return nil -} - -type Expr_CreateStruct struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - MessageName string `protobuf:"bytes,1,opt,name=message_name,json=messageName,proto3" json:"message_name,omitempty"` - Entries []*Expr_CreateStruct_Entry `protobuf:"bytes,2,rep,name=entries,proto3" json:"entries,omitempty"` -} - -func (x *Expr_CreateStruct) Reset() { - *x = Expr_CreateStruct{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Expr_CreateStruct) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Expr_CreateStruct) ProtoMessage() {} - -func (x *Expr_CreateStruct) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_syntax_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Expr_CreateStruct.ProtoReflect.Descriptor instead. -func (*Expr_CreateStruct) Descriptor() ([]byte, []int) { - return file_cel_expr_syntax_proto_rawDescGZIP(), []int{1, 4} -} - -func (x *Expr_CreateStruct) GetMessageName() string { - if x != nil { - return x.MessageName - } - return "" -} - -func (x *Expr_CreateStruct) GetEntries() []*Expr_CreateStruct_Entry { - if x != nil { - return x.Entries - } - return nil -} - -type Expr_Comprehension struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - IterVar string `protobuf:"bytes,1,opt,name=iter_var,json=iterVar,proto3" json:"iter_var,omitempty"` - IterRange *Expr `protobuf:"bytes,2,opt,name=iter_range,json=iterRange,proto3" json:"iter_range,omitempty"` - AccuVar string `protobuf:"bytes,3,opt,name=accu_var,json=accuVar,proto3" json:"accu_var,omitempty"` - AccuInit *Expr `protobuf:"bytes,4,opt,name=accu_init,json=accuInit,proto3" json:"accu_init,omitempty"` - LoopCondition *Expr `protobuf:"bytes,5,opt,name=loop_condition,json=loopCondition,proto3" json:"loop_condition,omitempty"` - LoopStep *Expr `protobuf:"bytes,6,opt,name=loop_step,json=loopStep,proto3" json:"loop_step,omitempty"` - Result *Expr `protobuf:"bytes,7,opt,name=result,proto3" json:"result,omitempty"` -} - -func (x *Expr_Comprehension) Reset() { - *x = Expr_Comprehension{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Expr_Comprehension) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Expr_Comprehension) ProtoMessage() {} - -func (x *Expr_Comprehension) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_syntax_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Expr_Comprehension.ProtoReflect.Descriptor instead. -func (*Expr_Comprehension) Descriptor() ([]byte, []int) { - return file_cel_expr_syntax_proto_rawDescGZIP(), []int{1, 5} -} - -func (x *Expr_Comprehension) GetIterVar() string { - if x != nil { - return x.IterVar - } - return "" -} - -func (x *Expr_Comprehension) GetIterRange() *Expr { - if x != nil { - return x.IterRange - } - return nil -} - -func (x *Expr_Comprehension) GetAccuVar() string { - if x != nil { - return x.AccuVar - } - return "" -} - -func (x *Expr_Comprehension) GetAccuInit() *Expr { - if x != nil { - return x.AccuInit - } - return nil -} - -func (x *Expr_Comprehension) GetLoopCondition() *Expr { - if x != nil { - return x.LoopCondition - } - return nil -} - -func (x *Expr_Comprehension) GetLoopStep() *Expr { - if x != nil { - return x.LoopStep - } - return nil -} - -func (x *Expr_Comprehension) GetResult() *Expr { - if x != nil { - return x.Result - } - return nil -} - -type Expr_CreateStruct_Entry struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - // Types that are assignable to KeyKind: - // - // *Expr_CreateStruct_Entry_FieldKey - // *Expr_CreateStruct_Entry_MapKey - KeyKind isExpr_CreateStruct_Entry_KeyKind `protobuf_oneof:"key_kind"` - Value *Expr `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` - OptionalEntry bool `protobuf:"varint,5,opt,name=optional_entry,json=optionalEntry,proto3" json:"optional_entry,omitempty"` -} - -func (x *Expr_CreateStruct_Entry) Reset() { - *x = Expr_CreateStruct_Entry{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Expr_CreateStruct_Entry) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Expr_CreateStruct_Entry) ProtoMessage() {} - -func (x *Expr_CreateStruct_Entry) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_syntax_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Expr_CreateStruct_Entry.ProtoReflect.Descriptor instead. -func (*Expr_CreateStruct_Entry) Descriptor() ([]byte, []int) { - return file_cel_expr_syntax_proto_rawDescGZIP(), []int{1, 4, 0} -} - -func (x *Expr_CreateStruct_Entry) GetId() int64 { - if x != nil { - return x.Id - } - return 0 -} - -func (m *Expr_CreateStruct_Entry) GetKeyKind() isExpr_CreateStruct_Entry_KeyKind { - if m != nil { - return m.KeyKind - } - return nil -} - -func (x *Expr_CreateStruct_Entry) GetFieldKey() string { - if x, ok := x.GetKeyKind().(*Expr_CreateStruct_Entry_FieldKey); ok { - return x.FieldKey - } - return "" -} - -func (x *Expr_CreateStruct_Entry) GetMapKey() *Expr { - if x, ok := x.GetKeyKind().(*Expr_CreateStruct_Entry_MapKey); ok { - return x.MapKey - } - return nil -} - -func (x *Expr_CreateStruct_Entry) GetValue() *Expr { - if x != nil { - return x.Value - } - return nil -} - -func (x *Expr_CreateStruct_Entry) GetOptionalEntry() bool { - if x != nil { - return x.OptionalEntry - } - return false -} - -type isExpr_CreateStruct_Entry_KeyKind interface { - isExpr_CreateStruct_Entry_KeyKind() -} - -type Expr_CreateStruct_Entry_FieldKey struct { - FieldKey string `protobuf:"bytes,2,opt,name=field_key,json=fieldKey,proto3,oneof"` -} - -type Expr_CreateStruct_Entry_MapKey struct { - MapKey *Expr `protobuf:"bytes,3,opt,name=map_key,json=mapKey,proto3,oneof"` -} - -func (*Expr_CreateStruct_Entry_FieldKey) isExpr_CreateStruct_Entry_KeyKind() {} - -func (*Expr_CreateStruct_Entry_MapKey) isExpr_CreateStruct_Entry_KeyKind() {} - -type SourceInfo_Extension struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - AffectedComponents []SourceInfo_Extension_Component `protobuf:"varint,2,rep,packed,name=affected_components,json=affectedComponents,proto3,enum=cel.expr.SourceInfo_Extension_Component" json:"affected_components,omitempty"` - Version *SourceInfo_Extension_Version `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` -} - -func (x *SourceInfo_Extension) Reset() { - *x = SourceInfo_Extension{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SourceInfo_Extension) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SourceInfo_Extension) ProtoMessage() {} - -func (x *SourceInfo_Extension) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_syntax_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SourceInfo_Extension.ProtoReflect.Descriptor instead. -func (*SourceInfo_Extension) Descriptor() ([]byte, []int) { - return file_cel_expr_syntax_proto_rawDescGZIP(), []int{3, 2} -} - -func (x *SourceInfo_Extension) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *SourceInfo_Extension) GetAffectedComponents() []SourceInfo_Extension_Component { - if x != nil { - return x.AffectedComponents - } - return nil -} - -func (x *SourceInfo_Extension) GetVersion() *SourceInfo_Extension_Version { - if x != nil { - return x.Version - } - return nil -} - -type SourceInfo_Extension_Version struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Major int64 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"` - Minor int64 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"` -} - -func (x *SourceInfo_Extension_Version) Reset() { - *x = SourceInfo_Extension_Version{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SourceInfo_Extension_Version) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SourceInfo_Extension_Version) ProtoMessage() {} - -func (x *SourceInfo_Extension_Version) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_syntax_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SourceInfo_Extension_Version.ProtoReflect.Descriptor instead. -func (*SourceInfo_Extension_Version) Descriptor() ([]byte, []int) { - return file_cel_expr_syntax_proto_rawDescGZIP(), []int{3, 2, 0} -} - -func (x *SourceInfo_Extension_Version) GetMajor() int64 { - if x != nil { - return x.Major - } - return 0 -} - -func (x *SourceInfo_Extension_Version) GetMinor() int64 { - if x != nil { - return x.Minor - } - return 0 -} - -var File_cel_expr_syntax_proto protoreflect.FileDescriptor - -var file_cel_expr_syntax_proto_rawDesc = []byte{ - 0x0a, 0x15, 0x63, 0x65, 0x6c, 0x2f, 0x65, 0x78, 0x70, 0x72, 0x2f, 0x73, 0x79, 0x6e, 0x74, 0x61, - 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, - 0x72, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x67, 0x0a, 0x0a, 0x50, 0x61, 0x72, 0x73, 0x65, 0x64, 0x45, 0x78, 0x70, 0x72, 0x12, 0x22, - 0x0a, 0x04, 0x65, 0x78, 0x70, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, - 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52, 0x04, 0x65, 0x78, - 0x70, 0x72, 0x12, 0x35, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x6e, 0x66, - 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, - 0x70, 0x72, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0xfd, 0x0a, 0x0a, 0x04, 0x45, 0x78, - 0x70, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, - 0x69, 0x64, 0x12, 0x33, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x5f, 0x65, 0x78, 0x70, 0x72, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, - 0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x09, 0x63, 0x6f, - 0x6e, 0x73, 0x74, 0x45, 0x78, 0x70, 0x72, 0x12, 0x35, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, - 0x5f, 0x65, 0x78, 0x70, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x65, - 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x2e, 0x49, 0x64, 0x65, 0x6e, - 0x74, 0x48, 0x00, 0x52, 0x09, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x45, 0x78, 0x70, 0x72, 0x12, 0x38, - 0x0a, 0x0b, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, - 0x78, 0x70, 0x72, 0x2e, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x48, 0x00, 0x52, 0x0a, 0x73, 0x65, - 0x6c, 0x65, 0x63, 0x74, 0x45, 0x78, 0x70, 0x72, 0x12, 0x32, 0x0a, 0x09, 0x63, 0x61, 0x6c, 0x6c, - 0x5f, 0x65, 0x78, 0x70, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x65, - 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x2e, 0x43, 0x61, 0x6c, 0x6c, - 0x48, 0x00, 0x52, 0x08, 0x63, 0x61, 0x6c, 0x6c, 0x45, 0x78, 0x70, 0x72, 0x12, 0x38, 0x0a, 0x09, - 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x2e, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x00, 0x52, 0x08, 0x6c, 0x69, - 0x73, 0x74, 0x45, 0x78, 0x70, 0x72, 0x12, 0x3e, 0x0a, 0x0b, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, - 0x5f, 0x65, 0x78, 0x70, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x65, - 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x2e, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x48, 0x00, 0x52, 0x0a, 0x73, 0x74, 0x72, 0x75, - 0x63, 0x74, 0x45, 0x78, 0x70, 0x72, 0x12, 0x4d, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, - 0x68, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, - 0x70, 0x72, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x68, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x48, 0x00, 0x52, 0x11, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x68, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x45, 0x78, 0x70, 0x72, 0x1a, 0x1b, 0x0a, 0x05, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x12, 0x12, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x1a, 0x65, 0x0a, 0x06, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x12, 0x28, 0x0a, 0x07, - 0x6f, 0x70, 0x65, 0x72, 0x61, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, - 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52, 0x07, 0x6f, - 0x70, 0x65, 0x72, 0x61, 0x6e, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x1b, 0x0a, 0x09, - 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x08, 0x74, 0x65, 0x73, 0x74, 0x4f, 0x6e, 0x6c, 0x79, 0x1a, 0x6e, 0x0a, 0x04, 0x43, 0x61, 0x6c, - 0x6c, 0x12, 0x26, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, - 0x72, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x22, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, - 0x78, 0x70, 0x72, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x1a, 0x63, 0x0a, 0x0a, 0x43, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x08, 0x65, 0x6c, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, - 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52, 0x08, 0x65, 0x6c, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, - 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0f, 0x6f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x1a, 0xab, - 0x02, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, - 0x21, 0x0a, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4e, 0x61, - 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, - 0x78, 0x70, 0x72, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, - 0x2e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x1a, - 0xba, 0x01, 0x0a, 0x05, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x09, 0x66, 0x69, 0x65, - 0x6c, 0x64, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, - 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4b, 0x65, 0x79, 0x12, 0x29, 0x0a, 0x07, 0x6d, 0x61, 0x70, 0x5f, - 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, - 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x48, 0x00, 0x52, 0x06, 0x6d, 0x61, 0x70, - 0x4b, 0x65, 0x79, 0x12, 0x24, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, - 0x70, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x0d, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x42, 0x0a, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x5f, 0x6b, 0x69, 0x6e, 0x64, 0x1a, 0xad, 0x02, 0x0a, - 0x0d, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x68, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x19, - 0x0a, 0x08, 0x69, 0x74, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x69, 0x74, 0x65, 0x72, 0x56, 0x61, 0x72, 0x12, 0x2d, 0x0a, 0x0a, 0x69, 0x74, 0x65, - 0x72, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, - 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52, 0x09, 0x69, - 0x74, 0x65, 0x72, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x75, - 0x5f, 0x76, 0x61, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x63, 0x63, 0x75, - 0x56, 0x61, 0x72, 0x12, 0x2b, 0x0a, 0x09, 0x61, 0x63, 0x63, 0x75, 0x5f, 0x69, 0x6e, 0x69, 0x74, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, - 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52, 0x08, 0x61, 0x63, 0x63, 0x75, 0x49, 0x6e, 0x69, 0x74, - 0x12, 0x35, 0x0a, 0x0e, 0x6c, 0x6f, 0x6f, 0x70, 0x5f, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, - 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52, 0x0d, 0x6c, 0x6f, 0x6f, 0x70, 0x43, 0x6f, - 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x0a, 0x09, 0x6c, 0x6f, 0x6f, 0x70, 0x5f, - 0x73, 0x74, 0x65, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, - 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52, 0x08, 0x6c, 0x6f, 0x6f, 0x70, - 0x53, 0x74, 0x65, 0x70, 0x12, 0x26, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, - 0x45, 0x78, 0x70, 0x72, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x0b, 0x0a, 0x09, - 0x65, 0x78, 0x70, 0x72, 0x5f, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0xc1, 0x03, 0x0a, 0x08, 0x43, 0x6f, - 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x12, 0x3b, 0x0a, 0x0a, 0x6e, 0x75, 0x6c, 0x6c, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4e, 0x75, 0x6c, - 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6e, 0x75, 0x6c, 0x6c, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x0a, 0x69, 0x6e, 0x74, - 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x36, - 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, - 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, - 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x01, 0x48, 0x00, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x0a, 0x62, - 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x46, 0x0a, 0x0e, 0x64, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x02, 0x18, 0x01, - 0x48, 0x00, 0x52, 0x0d, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x12, 0x49, 0x0a, 0x0f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x02, 0x18, 0x01, 0x48, 0x00, 0x52, 0x0e, 0x74, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x0f, 0x0a, 0x0d, - 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x5f, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0xac, 0x06, - 0x0a, 0x0a, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x25, 0x0a, 0x0e, - 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x21, 0x0a, 0x0c, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0b, 0x6c, 0x69, 0x6e, 0x65, 0x4f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x73, 0x12, 0x41, 0x0a, 0x09, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, - 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, - 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x50, 0x6f, 0x73, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x70, 0x6f, 0x73, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x61, 0x63, 0x72, 0x6f, 0x5f, 0x63, - 0x61, 0x6c, 0x6c, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x65, 0x6c, - 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, - 0x2e, 0x4d, 0x61, 0x63, 0x72, 0x6f, 0x43, 0x61, 0x6c, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x52, 0x0a, 0x6d, 0x61, 0x63, 0x72, 0x6f, 0x43, 0x61, 0x6c, 0x6c, 0x73, 0x12, 0x3e, 0x0a, 0x0a, - 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x1e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x53, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x3c, 0x0a, 0x0e, - 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x4d, 0x0a, 0x0f, 0x4d, 0x61, - 0x63, 0x72, 0x6f, 0x43, 0x61, 0x6c, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x24, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, - 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0xe0, 0x02, 0x0a, 0x09, 0x45, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x59, 0x0a, 0x13, 0x61, 0x66, 0x66, 0x65, 0x63, - 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, - 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x52, 0x12, - 0x61, 0x66, 0x66, 0x65, 0x63, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, - 0x74, 0x73, 0x12, 0x40, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x53, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0x35, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, - 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x22, 0x6f, 0x0a, 0x09, 0x43, - 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x12, 0x19, 0x0a, 0x15, 0x43, 0x4f, 0x4d, 0x50, - 0x4f, 0x4e, 0x45, 0x4e, 0x54, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, - 0x44, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x43, 0x4f, 0x4d, 0x50, 0x4f, 0x4e, 0x45, 0x4e, 0x54, - 0x5f, 0x50, 0x41, 0x52, 0x53, 0x45, 0x52, 0x10, 0x01, 0x12, 0x1a, 0x0a, 0x16, 0x43, 0x4f, 0x4d, - 0x50, 0x4f, 0x4e, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x48, 0x45, 0x43, - 0x4b, 0x45, 0x52, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x43, 0x4f, 0x4d, 0x50, 0x4f, 0x4e, 0x45, - 0x4e, 0x54, 0x5f, 0x52, 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x10, 0x03, 0x42, 0x2e, 0x0a, 0x0c, - 0x64, 0x65, 0x76, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x42, 0x0b, 0x53, 0x79, - 0x6e, 0x74, 0x61, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x0c, 0x63, 0x65, 0x6c, - 0x2e, 0x64, 0x65, 0x76, 0x2f, 0x65, 0x78, 0x70, 0x72, 0xf8, 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_cel_expr_syntax_proto_rawDescOnce sync.Once - file_cel_expr_syntax_proto_rawDescData = file_cel_expr_syntax_proto_rawDesc -) - -func file_cel_expr_syntax_proto_rawDescGZIP() []byte { - file_cel_expr_syntax_proto_rawDescOnce.Do(func() { - file_cel_expr_syntax_proto_rawDescData = protoimpl.X.CompressGZIP(file_cel_expr_syntax_proto_rawDescData) - }) - return file_cel_expr_syntax_proto_rawDescData -} - -var file_cel_expr_syntax_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_cel_expr_syntax_proto_msgTypes = make([]protoimpl.MessageInfo, 15) -var file_cel_expr_syntax_proto_goTypes = []interface{}{ - (SourceInfo_Extension_Component)(0), // 0: cel.expr.SourceInfo.Extension.Component - (*ParsedExpr)(nil), // 1: cel.expr.ParsedExpr - (*Expr)(nil), // 2: cel.expr.Expr - (*Constant)(nil), // 3: cel.expr.Constant - (*SourceInfo)(nil), // 4: cel.expr.SourceInfo - (*Expr_Ident)(nil), // 5: cel.expr.Expr.Ident - (*Expr_Select)(nil), // 6: cel.expr.Expr.Select - (*Expr_Call)(nil), // 7: cel.expr.Expr.Call - (*Expr_CreateList)(nil), // 8: cel.expr.Expr.CreateList - (*Expr_CreateStruct)(nil), // 9: cel.expr.Expr.CreateStruct - (*Expr_Comprehension)(nil), // 10: cel.expr.Expr.Comprehension - (*Expr_CreateStruct_Entry)(nil), // 11: cel.expr.Expr.CreateStruct.Entry - nil, // 12: cel.expr.SourceInfo.PositionsEntry - nil, // 13: cel.expr.SourceInfo.MacroCallsEntry - (*SourceInfo_Extension)(nil), // 14: cel.expr.SourceInfo.Extension - (*SourceInfo_Extension_Version)(nil), // 15: cel.expr.SourceInfo.Extension.Version - (structpb.NullValue)(0), // 16: google.protobuf.NullValue - (*durationpb.Duration)(nil), // 17: google.protobuf.Duration - (*timestamppb.Timestamp)(nil), // 18: google.protobuf.Timestamp -} -var file_cel_expr_syntax_proto_depIdxs = []int32{ - 2, // 0: cel.expr.ParsedExpr.expr:type_name -> cel.expr.Expr - 4, // 1: cel.expr.ParsedExpr.source_info:type_name -> cel.expr.SourceInfo - 3, // 2: cel.expr.Expr.const_expr:type_name -> cel.expr.Constant - 5, // 3: cel.expr.Expr.ident_expr:type_name -> cel.expr.Expr.Ident - 6, // 4: cel.expr.Expr.select_expr:type_name -> cel.expr.Expr.Select - 7, // 5: cel.expr.Expr.call_expr:type_name -> cel.expr.Expr.Call - 8, // 6: cel.expr.Expr.list_expr:type_name -> cel.expr.Expr.CreateList - 9, // 7: cel.expr.Expr.struct_expr:type_name -> cel.expr.Expr.CreateStruct - 10, // 8: cel.expr.Expr.comprehension_expr:type_name -> cel.expr.Expr.Comprehension - 16, // 9: cel.expr.Constant.null_value:type_name -> google.protobuf.NullValue - 17, // 10: cel.expr.Constant.duration_value:type_name -> google.protobuf.Duration - 18, // 11: cel.expr.Constant.timestamp_value:type_name -> google.protobuf.Timestamp - 12, // 12: cel.expr.SourceInfo.positions:type_name -> cel.expr.SourceInfo.PositionsEntry - 13, // 13: cel.expr.SourceInfo.macro_calls:type_name -> cel.expr.SourceInfo.MacroCallsEntry - 14, // 14: cel.expr.SourceInfo.extensions:type_name -> cel.expr.SourceInfo.Extension - 2, // 15: cel.expr.Expr.Select.operand:type_name -> cel.expr.Expr - 2, // 16: cel.expr.Expr.Call.target:type_name -> cel.expr.Expr - 2, // 17: cel.expr.Expr.Call.args:type_name -> cel.expr.Expr - 2, // 18: cel.expr.Expr.CreateList.elements:type_name -> cel.expr.Expr - 11, // 19: cel.expr.Expr.CreateStruct.entries:type_name -> cel.expr.Expr.CreateStruct.Entry - 2, // 20: cel.expr.Expr.Comprehension.iter_range:type_name -> cel.expr.Expr - 2, // 21: cel.expr.Expr.Comprehension.accu_init:type_name -> cel.expr.Expr - 2, // 22: cel.expr.Expr.Comprehension.loop_condition:type_name -> cel.expr.Expr - 2, // 23: cel.expr.Expr.Comprehension.loop_step:type_name -> cel.expr.Expr - 2, // 24: cel.expr.Expr.Comprehension.result:type_name -> cel.expr.Expr - 2, // 25: cel.expr.Expr.CreateStruct.Entry.map_key:type_name -> cel.expr.Expr - 2, // 26: cel.expr.Expr.CreateStruct.Entry.value:type_name -> cel.expr.Expr - 2, // 27: cel.expr.SourceInfo.MacroCallsEntry.value:type_name -> cel.expr.Expr - 0, // 28: cel.expr.SourceInfo.Extension.affected_components:type_name -> cel.expr.SourceInfo.Extension.Component - 15, // 29: cel.expr.SourceInfo.Extension.version:type_name -> cel.expr.SourceInfo.Extension.Version - 30, // [30:30] is the sub-list for method output_type - 30, // [30:30] is the sub-list for method input_type - 30, // [30:30] is the sub-list for extension type_name - 30, // [30:30] is the sub-list for extension extendee - 0, // [0:30] is the sub-list for field type_name -} - -func init() { file_cel_expr_syntax_proto_init() } -func file_cel_expr_syntax_proto_init() { - if File_cel_expr_syntax_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_cel_expr_syntax_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParsedExpr); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_syntax_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Expr); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_syntax_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Constant); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_syntax_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SourceInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_syntax_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Expr_Ident); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_syntax_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Expr_Select); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_syntax_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Expr_Call); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_syntax_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Expr_CreateList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_syntax_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Expr_CreateStruct); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_syntax_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Expr_Comprehension); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_syntax_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Expr_CreateStruct_Entry); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_syntax_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SourceInfo_Extension); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_syntax_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SourceInfo_Extension_Version); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_cel_expr_syntax_proto_msgTypes[1].OneofWrappers = []interface{}{ - (*Expr_ConstExpr)(nil), - (*Expr_IdentExpr)(nil), - (*Expr_SelectExpr)(nil), - (*Expr_CallExpr)(nil), - (*Expr_ListExpr)(nil), - (*Expr_StructExpr)(nil), - (*Expr_ComprehensionExpr)(nil), - } - file_cel_expr_syntax_proto_msgTypes[2].OneofWrappers = []interface{}{ - (*Constant_NullValue)(nil), - (*Constant_BoolValue)(nil), - (*Constant_Int64Value)(nil), - (*Constant_Uint64Value)(nil), - (*Constant_DoubleValue)(nil), - (*Constant_StringValue)(nil), - (*Constant_BytesValue)(nil), - (*Constant_DurationValue)(nil), - (*Constant_TimestampValue)(nil), - } - file_cel_expr_syntax_proto_msgTypes[10].OneofWrappers = []interface{}{ - (*Expr_CreateStruct_Entry_FieldKey)(nil), - (*Expr_CreateStruct_Entry_MapKey)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cel_expr_syntax_proto_rawDesc, - NumEnums: 1, - NumMessages: 15, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_cel_expr_syntax_proto_goTypes, - DependencyIndexes: file_cel_expr_syntax_proto_depIdxs, - EnumInfos: file_cel_expr_syntax_proto_enumTypes, - MessageInfos: file_cel_expr_syntax_proto_msgTypes, - }.Build() - File_cel_expr_syntax_proto = out.File - file_cel_expr_syntax_proto_rawDesc = nil - file_cel_expr_syntax_proto_goTypes = nil - file_cel_expr_syntax_proto_depIdxs = nil -} diff --git a/vendor/cel.dev/expr/value.pb.go b/vendor/cel.dev/expr/value.pb.go deleted file mode 100644 index e5e29228c..000000000 --- a/vendor/cel.dev/expr/value.pb.go +++ /dev/null @@ -1,653 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 -// source: cel/expr/value.proto - -package expr - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - structpb "google.golang.org/protobuf/types/known/structpb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type Value struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Kind: - // - // *Value_NullValue - // *Value_BoolValue - // *Value_Int64Value - // *Value_Uint64Value - // *Value_DoubleValue - // *Value_StringValue - // *Value_BytesValue - // *Value_EnumValue - // *Value_ObjectValue - // *Value_MapValue - // *Value_ListValue - // *Value_TypeValue - Kind isValue_Kind `protobuf_oneof:"kind"` -} - -func (x *Value) Reset() { - *x = Value{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_value_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Value) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Value) ProtoMessage() {} - -func (x *Value) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_value_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Value.ProtoReflect.Descriptor instead. -func (*Value) Descriptor() ([]byte, []int) { - return file_cel_expr_value_proto_rawDescGZIP(), []int{0} -} - -func (m *Value) GetKind() isValue_Kind { - if m != nil { - return m.Kind - } - return nil -} - -func (x *Value) GetNullValue() structpb.NullValue { - if x, ok := x.GetKind().(*Value_NullValue); ok { - return x.NullValue - } - return structpb.NullValue(0) -} - -func (x *Value) GetBoolValue() bool { - if x, ok := x.GetKind().(*Value_BoolValue); ok { - return x.BoolValue - } - return false -} - -func (x *Value) GetInt64Value() int64 { - if x, ok := x.GetKind().(*Value_Int64Value); ok { - return x.Int64Value - } - return 0 -} - -func (x *Value) GetUint64Value() uint64 { - if x, ok := x.GetKind().(*Value_Uint64Value); ok { - return x.Uint64Value - } - return 0 -} - -func (x *Value) GetDoubleValue() float64 { - if x, ok := x.GetKind().(*Value_DoubleValue); ok { - return x.DoubleValue - } - return 0 -} - -func (x *Value) GetStringValue() string { - if x, ok := x.GetKind().(*Value_StringValue); ok { - return x.StringValue - } - return "" -} - -func (x *Value) GetBytesValue() []byte { - if x, ok := x.GetKind().(*Value_BytesValue); ok { - return x.BytesValue - } - return nil -} - -func (x *Value) GetEnumValue() *EnumValue { - if x, ok := x.GetKind().(*Value_EnumValue); ok { - return x.EnumValue - } - return nil -} - -func (x *Value) GetObjectValue() *anypb.Any { - if x, ok := x.GetKind().(*Value_ObjectValue); ok { - return x.ObjectValue - } - return nil -} - -func (x *Value) GetMapValue() *MapValue { - if x, ok := x.GetKind().(*Value_MapValue); ok { - return x.MapValue - } - return nil -} - -func (x *Value) GetListValue() *ListValue { - if x, ok := x.GetKind().(*Value_ListValue); ok { - return x.ListValue - } - return nil -} - -func (x *Value) GetTypeValue() string { - if x, ok := x.GetKind().(*Value_TypeValue); ok { - return x.TypeValue - } - return "" -} - -type isValue_Kind interface { - isValue_Kind() -} - -type Value_NullValue struct { - NullValue structpb.NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,proto3,enum=google.protobuf.NullValue,oneof"` -} - -type Value_BoolValue struct { - BoolValue bool `protobuf:"varint,2,opt,name=bool_value,json=boolValue,proto3,oneof"` -} - -type Value_Int64Value struct { - Int64Value int64 `protobuf:"varint,3,opt,name=int64_value,json=int64Value,proto3,oneof"` -} - -type Value_Uint64Value struct { - Uint64Value uint64 `protobuf:"varint,4,opt,name=uint64_value,json=uint64Value,proto3,oneof"` -} - -type Value_DoubleValue struct { - DoubleValue float64 `protobuf:"fixed64,5,opt,name=double_value,json=doubleValue,proto3,oneof"` -} - -type Value_StringValue struct { - StringValue string `protobuf:"bytes,6,opt,name=string_value,json=stringValue,proto3,oneof"` -} - -type Value_BytesValue struct { - BytesValue []byte `protobuf:"bytes,7,opt,name=bytes_value,json=bytesValue,proto3,oneof"` -} - -type Value_EnumValue struct { - EnumValue *EnumValue `protobuf:"bytes,9,opt,name=enum_value,json=enumValue,proto3,oneof"` -} - -type Value_ObjectValue struct { - ObjectValue *anypb.Any `protobuf:"bytes,10,opt,name=object_value,json=objectValue,proto3,oneof"` -} - -type Value_MapValue struct { - MapValue *MapValue `protobuf:"bytes,11,opt,name=map_value,json=mapValue,proto3,oneof"` -} - -type Value_ListValue struct { - ListValue *ListValue `protobuf:"bytes,12,opt,name=list_value,json=listValue,proto3,oneof"` -} - -type Value_TypeValue struct { - TypeValue string `protobuf:"bytes,15,opt,name=type_value,json=typeValue,proto3,oneof"` -} - -func (*Value_NullValue) isValue_Kind() {} - -func (*Value_BoolValue) isValue_Kind() {} - -func (*Value_Int64Value) isValue_Kind() {} - -func (*Value_Uint64Value) isValue_Kind() {} - -func (*Value_DoubleValue) isValue_Kind() {} - -func (*Value_StringValue) isValue_Kind() {} - -func (*Value_BytesValue) isValue_Kind() {} - -func (*Value_EnumValue) isValue_Kind() {} - -func (*Value_ObjectValue) isValue_Kind() {} - -func (*Value_MapValue) isValue_Kind() {} - -func (*Value_ListValue) isValue_Kind() {} - -func (*Value_TypeValue) isValue_Kind() {} - -type EnumValue struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Value int32 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *EnumValue) Reset() { - *x = EnumValue{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_value_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EnumValue) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EnumValue) ProtoMessage() {} - -func (x *EnumValue) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_value_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EnumValue.ProtoReflect.Descriptor instead. -func (*EnumValue) Descriptor() ([]byte, []int) { - return file_cel_expr_value_proto_rawDescGZIP(), []int{1} -} - -func (x *EnumValue) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *EnumValue) GetValue() int32 { - if x != nil { - return x.Value - } - return 0 -} - -type ListValue struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Values []*Value `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` -} - -func (x *ListValue) Reset() { - *x = ListValue{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_value_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListValue) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListValue) ProtoMessage() {} - -func (x *ListValue) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_value_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListValue.ProtoReflect.Descriptor instead. -func (*ListValue) Descriptor() ([]byte, []int) { - return file_cel_expr_value_proto_rawDescGZIP(), []int{2} -} - -func (x *ListValue) GetValues() []*Value { - if x != nil { - return x.Values - } - return nil -} - -type MapValue struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Entries []*MapValue_Entry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"` -} - -func (x *MapValue) Reset() { - *x = MapValue{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_value_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MapValue) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MapValue) ProtoMessage() {} - -func (x *MapValue) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_value_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MapValue.ProtoReflect.Descriptor instead. -func (*MapValue) Descriptor() ([]byte, []int) { - return file_cel_expr_value_proto_rawDescGZIP(), []int{3} -} - -func (x *MapValue) GetEntries() []*MapValue_Entry { - if x != nil { - return x.Entries - } - return nil -} - -type MapValue_Entry struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Key *Value `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value *Value `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *MapValue_Entry) Reset() { - *x = MapValue_Entry{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_value_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MapValue_Entry) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MapValue_Entry) ProtoMessage() {} - -func (x *MapValue_Entry) ProtoReflect() protoreflect.Message { - mi := &file_cel_expr_value_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MapValue_Entry.ProtoReflect.Descriptor instead. -func (*MapValue_Entry) Descriptor() ([]byte, []int) { - return file_cel_expr_value_proto_rawDescGZIP(), []int{3, 0} -} - -func (x *MapValue_Entry) GetKey() *Value { - if x != nil { - return x.Key - } - return nil -} - -func (x *MapValue_Entry) GetValue() *Value { - if x != nil { - return x.Value - } - return nil -} - -var File_cel_expr_value_proto protoreflect.FileDescriptor - -var file_cel_expr_value_proto_rawDesc = []byte{ - 0x0a, 0x14, 0x63, 0x65, 0x6c, 0x2f, 0x65, 0x78, 0x70, 0x72, 0x2f, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, - 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, - 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9d, 0x04, 0x0a, 0x05, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x6e, 0x75, 0x6c, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4e, 0x75, 0x6c, 0x6c, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x12, 0x1f, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x0b, 0x75, 0x69, - 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x64, 0x6f, 0x75, - 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x01, 0x48, - 0x00, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, - 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x0a, 0x62, 0x79, 0x74, 0x65, - 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x34, 0x0a, 0x0a, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x65, 0x6c, - 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, - 0x00, 0x52, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x39, 0x0a, 0x0c, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0a, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x48, 0x00, 0x52, 0x0b, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x31, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x65, 0x6c, - 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, - 0x52, 0x08, 0x6d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x34, 0x0a, 0x0a, 0x6c, 0x69, - 0x73, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, - 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x12, 0x1f, 0x0a, 0x0a, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0f, - 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x09, 0x74, 0x79, 0x70, 0x65, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0x35, 0x0a, 0x09, 0x45, 0x6e, 0x75, - 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x22, 0x34, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x27, 0x0a, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, - 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0x91, 0x01, 0x0a, 0x08, 0x4d, 0x61, 0x70, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, - 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, - 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x1a, 0x51, 0x0a, 0x05, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x12, 0x21, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, - 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x2d, 0x0a, 0x0c, 0x64, 0x65, - 0x76, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x42, 0x0a, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x0c, 0x63, 0x65, 0x6c, 0x2e, 0x64, 0x65, - 0x76, 0x2f, 0x65, 0x78, 0x70, 0x72, 0xf8, 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} - -var ( - file_cel_expr_value_proto_rawDescOnce sync.Once - file_cel_expr_value_proto_rawDescData = file_cel_expr_value_proto_rawDesc -) - -func file_cel_expr_value_proto_rawDescGZIP() []byte { - file_cel_expr_value_proto_rawDescOnce.Do(func() { - file_cel_expr_value_proto_rawDescData = protoimpl.X.CompressGZIP(file_cel_expr_value_proto_rawDescData) - }) - return file_cel_expr_value_proto_rawDescData -} - -var file_cel_expr_value_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_cel_expr_value_proto_goTypes = []interface{}{ - (*Value)(nil), // 0: cel.expr.Value - (*EnumValue)(nil), // 1: cel.expr.EnumValue - (*ListValue)(nil), // 2: cel.expr.ListValue - (*MapValue)(nil), // 3: cel.expr.MapValue - (*MapValue_Entry)(nil), // 4: cel.expr.MapValue.Entry - (structpb.NullValue)(0), // 5: google.protobuf.NullValue - (*anypb.Any)(nil), // 6: google.protobuf.Any -} -var file_cel_expr_value_proto_depIdxs = []int32{ - 5, // 0: cel.expr.Value.null_value:type_name -> google.protobuf.NullValue - 1, // 1: cel.expr.Value.enum_value:type_name -> cel.expr.EnumValue - 6, // 2: cel.expr.Value.object_value:type_name -> google.protobuf.Any - 3, // 3: cel.expr.Value.map_value:type_name -> cel.expr.MapValue - 2, // 4: cel.expr.Value.list_value:type_name -> cel.expr.ListValue - 0, // 5: cel.expr.ListValue.values:type_name -> cel.expr.Value - 4, // 6: cel.expr.MapValue.entries:type_name -> cel.expr.MapValue.Entry - 0, // 7: cel.expr.MapValue.Entry.key:type_name -> cel.expr.Value - 0, // 8: cel.expr.MapValue.Entry.value:type_name -> cel.expr.Value - 9, // [9:9] is the sub-list for method output_type - 9, // [9:9] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name -} - -func init() { file_cel_expr_value_proto_init() } -func file_cel_expr_value_proto_init() { - if File_cel_expr_value_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_cel_expr_value_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Value); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_value_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EnumValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_value_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_value_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MapValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_value_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MapValue_Entry); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_cel_expr_value_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*Value_NullValue)(nil), - (*Value_BoolValue)(nil), - (*Value_Int64Value)(nil), - (*Value_Uint64Value)(nil), - (*Value_DoubleValue)(nil), - (*Value_StringValue)(nil), - (*Value_BytesValue)(nil), - (*Value_EnumValue)(nil), - (*Value_ObjectValue)(nil), - (*Value_MapValue)(nil), - (*Value_ListValue)(nil), - (*Value_TypeValue)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cel_expr_value_proto_rawDesc, - NumEnums: 0, - NumMessages: 5, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_cel_expr_value_proto_goTypes, - DependencyIndexes: file_cel_expr_value_proto_depIdxs, - MessageInfos: file_cel_expr_value_proto_msgTypes, - }.Build() - File_cel_expr_value_proto = out.File - file_cel_expr_value_proto_rawDesc = nil - file_cel_expr_value_proto_goTypes = nil - file_cel_expr_value_proto_depIdxs = nil -} diff --git a/vendor/github.com/armon/go-metrics/.gitignore b/vendor/github.com/armon/go-metrics/.gitignore deleted file mode 100644 index e5750f572..000000000 --- a/vendor/github.com/armon/go-metrics/.gitignore +++ /dev/null @@ -1,26 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe - -/metrics.out - -.idea diff --git a/vendor/github.com/armon/go-metrics/.travis.yml b/vendor/github.com/armon/go-metrics/.travis.yml deleted file mode 100644 index 87d230c8d..000000000 --- a/vendor/github.com/armon/go-metrics/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: go - -go: - - "1.x" - -env: - - GO111MODULE=on - -install: - - go get ./... - -script: - - go test ./... diff --git a/vendor/github.com/armon/go-metrics/LICENSE b/vendor/github.com/armon/go-metrics/LICENSE deleted file mode 100644 index 106569e54..000000000 --- a/vendor/github.com/armon/go-metrics/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 Armon Dadgar - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/armon/go-metrics/README.md b/vendor/github.com/armon/go-metrics/README.md deleted file mode 100644 index aa73348c0..000000000 --- a/vendor/github.com/armon/go-metrics/README.md +++ /dev/null @@ -1,91 +0,0 @@ -go-metrics -========== - -This library provides a `metrics` package which can be used to instrument code, -expose application metrics, and profile runtime performance in a flexible manner. - -Current API: [![GoDoc](https://godoc.org/github.com/armon/go-metrics?status.svg)](https://godoc.org/github.com/armon/go-metrics) - -Sinks ------ - -The `metrics` package makes use of a `MetricSink` interface to support delivery -to any type of backend. Currently the following sinks are provided: - -* StatsiteSink : Sinks to a [statsite](https://github.com/armon/statsite/) instance (TCP) -* StatsdSink: Sinks to a [StatsD](https://github.com/etsy/statsd/) / statsite instance (UDP) -* PrometheusSink: Sinks to a [Prometheus](http://prometheus.io/) metrics endpoint (exposed via HTTP for scrapes) -* InmemSink : Provides in-memory aggregation, can be used to export stats -* FanoutSink : Sinks to multiple sinks. Enables writing to multiple statsite instances for example. -* BlackholeSink : Sinks to nowhere - -In addition to the sinks, the `InmemSignal` can be used to catch a signal, -and dump a formatted output of recent metrics. For example, when a process gets -a SIGUSR1, it can dump to stderr recent performance metrics for debugging. - -Labels ------- - -Most metrics do have an equivalent ending with `WithLabels`, such methods -allow to push metrics with labels and use some features of underlying Sinks -(ex: translated into Prometheus labels). - -Since some of these labels may increase greatly cardinality of metrics, the -library allow to filter labels using a blacklist/whitelist filtering system -which is global to all metrics. - -* If `Config.AllowedLabels` is not nil, then only labels specified in this value will be sent to underlying Sink, otherwise, all labels are sent by default. -* If `Config.BlockedLabels` is not nil, any label specified in this value will not be sent to underlying Sinks. - -By default, both `Config.AllowedLabels` and `Config.BlockedLabels` are nil, meaning that -no tags are filetered at all, but it allow to a user to globally block some tags with high -cardinality at application level. - -Examples --------- - -Here is an example of using the package: - -```go -func SlowMethod() { - // Profiling the runtime of a method - defer metrics.MeasureSince([]string{"SlowMethod"}, time.Now()) -} - -// Configure a statsite sink as the global metrics sink -sink, _ := metrics.NewStatsiteSink("statsite:8125") -metrics.NewGlobal(metrics.DefaultConfig("service-name"), sink) - -// Emit a Key/Value pair -metrics.EmitKey([]string{"questions", "meaning of life"}, 42) -``` - -Here is an example of setting up a signal handler: - -```go -// Setup the inmem sink and signal handler -inm := metrics.NewInmemSink(10*time.Second, time.Minute) -sig := metrics.DefaultInmemSignal(inm) -metrics.NewGlobal(metrics.DefaultConfig("service-name"), inm) - -// Run some code -inm.SetGauge([]string{"foo"}, 42) -inm.EmitKey([]string{"bar"}, 30) - -inm.IncrCounter([]string{"baz"}, 42) -inm.IncrCounter([]string{"baz"}, 1) -inm.IncrCounter([]string{"baz"}, 80) - -inm.AddSample([]string{"method", "wow"}, 42) -inm.AddSample([]string{"method", "wow"}, 100) -inm.AddSample([]string{"method", "wow"}, 22) - -.... -``` - -When a signal comes in, output like the following will be dumped to stderr: - - [2014-01-28 14:57:33.04 -0800 PST][G] 'foo': 42.000 - [2014-01-28 14:57:33.04 -0800 PST][P] 'bar': 30.000 - [2014-01-28 14:57:33.04 -0800 PST][C] 'baz': Count: 3 Min: 1.000 Mean: 41.000 Max: 80.000 Stddev: 39.509 - [2014-01-28 14:57:33.04 -0800 PST][S] 'method.wow': Count: 3 Min: 22.000 Mean: 54.667 Max: 100.000 Stddev: 40.513 \ No newline at end of file diff --git a/vendor/github.com/armon/go-metrics/const_unix.go b/vendor/github.com/armon/go-metrics/const_unix.go deleted file mode 100644 index 31098dd57..000000000 --- a/vendor/github.com/armon/go-metrics/const_unix.go +++ /dev/null @@ -1,12 +0,0 @@ -// +build !windows - -package metrics - -import ( - "syscall" -) - -const ( - // DefaultSignal is used with DefaultInmemSignal - DefaultSignal = syscall.SIGUSR1 -) diff --git a/vendor/github.com/armon/go-metrics/const_windows.go b/vendor/github.com/armon/go-metrics/const_windows.go deleted file mode 100644 index 38136af3e..000000000 --- a/vendor/github.com/armon/go-metrics/const_windows.go +++ /dev/null @@ -1,13 +0,0 @@ -// +build windows - -package metrics - -import ( - "syscall" -) - -const ( - // DefaultSignal is used with DefaultInmemSignal - // Windows has no SIGUSR1, use SIGBREAK - DefaultSignal = syscall.Signal(21) -) diff --git a/vendor/github.com/armon/go-metrics/inmem.go b/vendor/github.com/armon/go-metrics/inmem.go deleted file mode 100644 index 7c427aca9..000000000 --- a/vendor/github.com/armon/go-metrics/inmem.go +++ /dev/null @@ -1,339 +0,0 @@ -package metrics - -import ( - "bytes" - "fmt" - "math" - "net/url" - "strings" - "sync" - "time" -) - -var spaceReplacer = strings.NewReplacer(" ", "_") - -// InmemSink provides a MetricSink that does in-memory aggregation -// without sending metrics over a network. It can be embedded within -// an application to provide profiling information. -type InmemSink struct { - // How long is each aggregation interval - interval time.Duration - - // Retain controls how many metrics interval we keep - retain time.Duration - - // maxIntervals is the maximum length of intervals. - // It is retain / interval. - maxIntervals int - - // intervals is a slice of the retained intervals - intervals []*IntervalMetrics - intervalLock sync.RWMutex - - rateDenom float64 -} - -// IntervalMetrics stores the aggregated metrics -// for a specific interval -type IntervalMetrics struct { - sync.RWMutex - - // The start time of the interval - Interval time.Time - - // Gauges maps the key to the last set value - Gauges map[string]GaugeValue - - // Points maps the string to the list of emitted values - // from EmitKey - Points map[string][]float32 - - // Counters maps the string key to a sum of the counter - // values - Counters map[string]SampledValue - - // Samples maps the key to an AggregateSample, - // which has the rolled up view of a sample - Samples map[string]SampledValue - - // done is closed when this interval has ended, and a new IntervalMetrics - // has been created to receive any future metrics. - done chan struct{} -} - -// NewIntervalMetrics creates a new IntervalMetrics for a given interval -func NewIntervalMetrics(intv time.Time) *IntervalMetrics { - return &IntervalMetrics{ - Interval: intv, - Gauges: make(map[string]GaugeValue), - Points: make(map[string][]float32), - Counters: make(map[string]SampledValue), - Samples: make(map[string]SampledValue), - done: make(chan struct{}), - } -} - -// AggregateSample is used to hold aggregate metrics -// about a sample -type AggregateSample struct { - Count int // The count of emitted pairs - Rate float64 // The values rate per time unit (usually 1 second) - Sum float64 // The sum of values - SumSq float64 `json:"-"` // The sum of squared values - Min float64 // Minimum value - Max float64 // Maximum value - LastUpdated time.Time `json:"-"` // When value was last updated -} - -// Computes a Stddev of the values -func (a *AggregateSample) Stddev() float64 { - num := (float64(a.Count) * a.SumSq) - math.Pow(a.Sum, 2) - div := float64(a.Count * (a.Count - 1)) - if div == 0 { - return 0 - } - return math.Sqrt(num / div) -} - -// Computes a mean of the values -func (a *AggregateSample) Mean() float64 { - if a.Count == 0 { - return 0 - } - return a.Sum / float64(a.Count) -} - -// Ingest is used to update a sample -func (a *AggregateSample) Ingest(v float64, rateDenom float64) { - a.Count++ - a.Sum += v - a.SumSq += (v * v) - if v < a.Min || a.Count == 1 { - a.Min = v - } - if v > a.Max || a.Count == 1 { - a.Max = v - } - a.Rate = float64(a.Sum) / rateDenom - a.LastUpdated = time.Now() -} - -func (a *AggregateSample) String() string { - if a.Count == 0 { - return "Count: 0" - } else if a.Stddev() == 0 { - return fmt.Sprintf("Count: %d Sum: %0.3f LastUpdated: %s", a.Count, a.Sum, a.LastUpdated) - } else { - return fmt.Sprintf("Count: %d Min: %0.3f Mean: %0.3f Max: %0.3f Stddev: %0.3f Sum: %0.3f LastUpdated: %s", - a.Count, a.Min, a.Mean(), a.Max, a.Stddev(), a.Sum, a.LastUpdated) - } -} - -// NewInmemSinkFromURL creates an InmemSink from a URL. It is used -// (and tested) from NewMetricSinkFromURL. -func NewInmemSinkFromURL(u *url.URL) (MetricSink, error) { - params := u.Query() - - interval, err := time.ParseDuration(params.Get("interval")) - if err != nil { - return nil, fmt.Errorf("Bad 'interval' param: %s", err) - } - - retain, err := time.ParseDuration(params.Get("retain")) - if err != nil { - return nil, fmt.Errorf("Bad 'retain' param: %s", err) - } - - return NewInmemSink(interval, retain), nil -} - -// NewInmemSink is used to construct a new in-memory sink. -// Uses an aggregation interval and maximum retention period. -func NewInmemSink(interval, retain time.Duration) *InmemSink { - rateTimeUnit := time.Second - i := &InmemSink{ - interval: interval, - retain: retain, - maxIntervals: int(retain / interval), - rateDenom: float64(interval.Nanoseconds()) / float64(rateTimeUnit.Nanoseconds()), - } - i.intervals = make([]*IntervalMetrics, 0, i.maxIntervals) - return i -} - -func (i *InmemSink) SetGauge(key []string, val float32) { - i.SetGaugeWithLabels(key, val, nil) -} - -func (i *InmemSink) SetGaugeWithLabels(key []string, val float32, labels []Label) { - k, name := i.flattenKeyLabels(key, labels) - intv := i.getInterval() - - intv.Lock() - defer intv.Unlock() - intv.Gauges[k] = GaugeValue{Name: name, Value: val, Labels: labels} -} - -func (i *InmemSink) EmitKey(key []string, val float32) { - k := i.flattenKey(key) - intv := i.getInterval() - - intv.Lock() - defer intv.Unlock() - vals := intv.Points[k] - intv.Points[k] = append(vals, val) -} - -func (i *InmemSink) IncrCounter(key []string, val float32) { - i.IncrCounterWithLabels(key, val, nil) -} - -func (i *InmemSink) IncrCounterWithLabels(key []string, val float32, labels []Label) { - k, name := i.flattenKeyLabels(key, labels) - intv := i.getInterval() - - intv.Lock() - defer intv.Unlock() - - agg, ok := intv.Counters[k] - if !ok { - agg = SampledValue{ - Name: name, - AggregateSample: &AggregateSample{}, - Labels: labels, - } - intv.Counters[k] = agg - } - agg.Ingest(float64(val), i.rateDenom) -} - -func (i *InmemSink) AddSample(key []string, val float32) { - i.AddSampleWithLabels(key, val, nil) -} - -func (i *InmemSink) AddSampleWithLabels(key []string, val float32, labels []Label) { - k, name := i.flattenKeyLabels(key, labels) - intv := i.getInterval() - - intv.Lock() - defer intv.Unlock() - - agg, ok := intv.Samples[k] - if !ok { - agg = SampledValue{ - Name: name, - AggregateSample: &AggregateSample{}, - Labels: labels, - } - intv.Samples[k] = agg - } - agg.Ingest(float64(val), i.rateDenom) -} - -// Data is used to retrieve all the aggregated metrics -// Intervals may be in use, and a read lock should be acquired -func (i *InmemSink) Data() []*IntervalMetrics { - // Get the current interval, forces creation - i.getInterval() - - i.intervalLock.RLock() - defer i.intervalLock.RUnlock() - - n := len(i.intervals) - intervals := make([]*IntervalMetrics, n) - - copy(intervals[:n-1], i.intervals[:n-1]) - current := i.intervals[n-1] - - // make its own copy for current interval - intervals[n-1] = &IntervalMetrics{} - copyCurrent := intervals[n-1] - current.RLock() - *copyCurrent = *current - // RWMutex is not safe to copy, so create a new instance on the copy - copyCurrent.RWMutex = sync.RWMutex{} - - copyCurrent.Gauges = make(map[string]GaugeValue, len(current.Gauges)) - for k, v := range current.Gauges { - copyCurrent.Gauges[k] = v - } - // saved values will be not change, just copy its link - copyCurrent.Points = make(map[string][]float32, len(current.Points)) - for k, v := range current.Points { - copyCurrent.Points[k] = v - } - copyCurrent.Counters = make(map[string]SampledValue, len(current.Counters)) - for k, v := range current.Counters { - copyCurrent.Counters[k] = v.deepCopy() - } - copyCurrent.Samples = make(map[string]SampledValue, len(current.Samples)) - for k, v := range current.Samples { - copyCurrent.Samples[k] = v.deepCopy() - } - current.RUnlock() - - return intervals -} - -// getInterval returns the current interval. A new interval is created if no -// previous interval exists, or if the current time is beyond the window for the -// current interval. -func (i *InmemSink) getInterval() *IntervalMetrics { - intv := time.Now().Truncate(i.interval) - - // Attempt to return the existing interval first, because it only requires - // a read lock. - i.intervalLock.RLock() - n := len(i.intervals) - if n > 0 && i.intervals[n-1].Interval == intv { - defer i.intervalLock.RUnlock() - return i.intervals[n-1] - } - i.intervalLock.RUnlock() - - i.intervalLock.Lock() - defer i.intervalLock.Unlock() - - // Re-check for an existing interval now that the lock is re-acquired. - n = len(i.intervals) - if n > 0 && i.intervals[n-1].Interval == intv { - return i.intervals[n-1] - } - - current := NewIntervalMetrics(intv) - i.intervals = append(i.intervals, current) - if n > 0 { - close(i.intervals[n-1].done) - } - - n++ - // Prune old intervals if the count exceeds the max. - if n >= i.maxIntervals { - copy(i.intervals[0:], i.intervals[n-i.maxIntervals:]) - i.intervals = i.intervals[:i.maxIntervals] - } - return current -} - -// Flattens the key for formatting, removes spaces -func (i *InmemSink) flattenKey(parts []string) string { - buf := &bytes.Buffer{} - - joined := strings.Join(parts, ".") - - spaceReplacer.WriteString(buf, joined) - - return buf.String() -} - -// Flattens the key for formatting along with its labels, removes spaces -func (i *InmemSink) flattenKeyLabels(parts []string, labels []Label) (string, string) { - key := i.flattenKey(parts) - buf := bytes.NewBufferString(key) - - for _, label := range labels { - spaceReplacer.WriteString(buf, fmt.Sprintf(";%s=%s", label.Name, label.Value)) - } - - return buf.String(), key -} diff --git a/vendor/github.com/armon/go-metrics/inmem_endpoint.go b/vendor/github.com/armon/go-metrics/inmem_endpoint.go deleted file mode 100644 index 24eefa963..000000000 --- a/vendor/github.com/armon/go-metrics/inmem_endpoint.go +++ /dev/null @@ -1,162 +0,0 @@ -package metrics - -import ( - "context" - "fmt" - "net/http" - "sort" - "time" -) - -// MetricsSummary holds a roll-up of metrics info for a given interval -type MetricsSummary struct { - Timestamp string - Gauges []GaugeValue - Points []PointValue - Counters []SampledValue - Samples []SampledValue -} - -type GaugeValue struct { - Name string - Hash string `json:"-"` - Value float32 - - Labels []Label `json:"-"` - DisplayLabels map[string]string `json:"Labels"` -} - -type PointValue struct { - Name string - Points []float32 -} - -type SampledValue struct { - Name string - Hash string `json:"-"` - *AggregateSample - Mean float64 - Stddev float64 - - Labels []Label `json:"-"` - DisplayLabels map[string]string `json:"Labels"` -} - -// deepCopy allocates a new instance of AggregateSample -func (source *SampledValue) deepCopy() SampledValue { - dest := *source - if source.AggregateSample != nil { - dest.AggregateSample = &AggregateSample{} - *dest.AggregateSample = *source.AggregateSample - } - return dest -} - -// DisplayMetrics returns a summary of the metrics from the most recent finished interval. -func (i *InmemSink) DisplayMetrics(resp http.ResponseWriter, req *http.Request) (interface{}, error) { - data := i.Data() - - var interval *IntervalMetrics - n := len(data) - switch { - case n == 0: - return nil, fmt.Errorf("no metric intervals have been initialized yet") - case n == 1: - // Show the current interval if it's all we have - interval = data[0] - default: - // Show the most recent finished interval if we have one - interval = data[n-2] - } - - return newMetricSummaryFromInterval(interval), nil -} - -func newMetricSummaryFromInterval(interval *IntervalMetrics) MetricsSummary { - interval.RLock() - defer interval.RUnlock() - - summary := MetricsSummary{ - Timestamp: interval.Interval.Round(time.Second).UTC().String(), - Gauges: make([]GaugeValue, 0, len(interval.Gauges)), - Points: make([]PointValue, 0, len(interval.Points)), - } - - // Format and sort the output of each metric type, so it gets displayed in a - // deterministic order. - for name, points := range interval.Points { - summary.Points = append(summary.Points, PointValue{name, points}) - } - sort.Slice(summary.Points, func(i, j int) bool { - return summary.Points[i].Name < summary.Points[j].Name - }) - - for hash, value := range interval.Gauges { - value.Hash = hash - value.DisplayLabels = make(map[string]string) - for _, label := range value.Labels { - value.DisplayLabels[label.Name] = label.Value - } - value.Labels = nil - - summary.Gauges = append(summary.Gauges, value) - } - sort.Slice(summary.Gauges, func(i, j int) bool { - return summary.Gauges[i].Hash < summary.Gauges[j].Hash - }) - - summary.Counters = formatSamples(interval.Counters) - summary.Samples = formatSamples(interval.Samples) - - return summary -} - -func formatSamples(source map[string]SampledValue) []SampledValue { - output := make([]SampledValue, 0, len(source)) - for hash, sample := range source { - displayLabels := make(map[string]string) - for _, label := range sample.Labels { - displayLabels[label.Name] = label.Value - } - - output = append(output, SampledValue{ - Name: sample.Name, - Hash: hash, - AggregateSample: sample.AggregateSample, - Mean: sample.AggregateSample.Mean(), - Stddev: sample.AggregateSample.Stddev(), - DisplayLabels: displayLabels, - }) - } - sort.Slice(output, func(i, j int) bool { - return output[i].Hash < output[j].Hash - }) - - return output -} - -type Encoder interface { - Encode(interface{}) error -} - -// Stream writes metrics using encoder.Encode each time an interval ends. Runs -// until the request context is cancelled, or the encoder returns an error. -// The caller is responsible for logging any errors from encoder. -func (i *InmemSink) Stream(ctx context.Context, encoder Encoder) { - interval := i.getInterval() - - for { - select { - case <-interval.done: - summary := newMetricSummaryFromInterval(interval) - if err := encoder.Encode(summary); err != nil { - return - } - - // update interval to the next one - interval = i.getInterval() - case <-ctx.Done(): - return - } - } -} diff --git a/vendor/github.com/armon/go-metrics/inmem_signal.go b/vendor/github.com/armon/go-metrics/inmem_signal.go deleted file mode 100644 index 0937f4aed..000000000 --- a/vendor/github.com/armon/go-metrics/inmem_signal.go +++ /dev/null @@ -1,117 +0,0 @@ -package metrics - -import ( - "bytes" - "fmt" - "io" - "os" - "os/signal" - "strings" - "sync" - "syscall" -) - -// InmemSignal is used to listen for a given signal, and when received, -// to dump the current metrics from the InmemSink to an io.Writer -type InmemSignal struct { - signal syscall.Signal - inm *InmemSink - w io.Writer - sigCh chan os.Signal - - stop bool - stopCh chan struct{} - stopLock sync.Mutex -} - -// NewInmemSignal creates a new InmemSignal which listens for a given signal, -// and dumps the current metrics out to a writer -func NewInmemSignal(inmem *InmemSink, sig syscall.Signal, w io.Writer) *InmemSignal { - i := &InmemSignal{ - signal: sig, - inm: inmem, - w: w, - sigCh: make(chan os.Signal, 1), - stopCh: make(chan struct{}), - } - signal.Notify(i.sigCh, sig) - go i.run() - return i -} - -// DefaultInmemSignal returns a new InmemSignal that responds to SIGUSR1 -// and writes output to stderr. Windows uses SIGBREAK -func DefaultInmemSignal(inmem *InmemSink) *InmemSignal { - return NewInmemSignal(inmem, DefaultSignal, os.Stderr) -} - -// Stop is used to stop the InmemSignal from listening -func (i *InmemSignal) Stop() { - i.stopLock.Lock() - defer i.stopLock.Unlock() - - if i.stop { - return - } - i.stop = true - close(i.stopCh) - signal.Stop(i.sigCh) -} - -// run is a long running routine that handles signals -func (i *InmemSignal) run() { - for { - select { - case <-i.sigCh: - i.dumpStats() - case <-i.stopCh: - return - } - } -} - -// dumpStats is used to dump the data to output writer -func (i *InmemSignal) dumpStats() { - buf := bytes.NewBuffer(nil) - - data := i.inm.Data() - // Skip the last period which is still being aggregated - for j := 0; j < len(data)-1; j++ { - intv := data[j] - intv.RLock() - for _, val := range intv.Gauges { - name := i.flattenLabels(val.Name, val.Labels) - fmt.Fprintf(buf, "[%v][G] '%s': %0.3f\n", intv.Interval, name, val.Value) - } - for name, vals := range intv.Points { - for _, val := range vals { - fmt.Fprintf(buf, "[%v][P] '%s': %0.3f\n", intv.Interval, name, val) - } - } - for _, agg := range intv.Counters { - name := i.flattenLabels(agg.Name, agg.Labels) - fmt.Fprintf(buf, "[%v][C] '%s': %s\n", intv.Interval, name, agg.AggregateSample) - } - for _, agg := range intv.Samples { - name := i.flattenLabels(agg.Name, agg.Labels) - fmt.Fprintf(buf, "[%v][S] '%s': %s\n", intv.Interval, name, agg.AggregateSample) - } - intv.RUnlock() - } - - // Write out the bytes - i.w.Write(buf.Bytes()) -} - -// Flattens the key for formatting along with its labels, removes spaces -func (i *InmemSignal) flattenLabels(name string, labels []Label) string { - buf := bytes.NewBufferString(name) - replacer := strings.NewReplacer(" ", "_", ":", "_") - - for _, label := range labels { - replacer.WriteString(buf, ".") - replacer.WriteString(buf, label.Value) - } - - return buf.String() -} diff --git a/vendor/github.com/armon/go-metrics/metrics.go b/vendor/github.com/armon/go-metrics/metrics.go deleted file mode 100644 index 36642a429..000000000 --- a/vendor/github.com/armon/go-metrics/metrics.go +++ /dev/null @@ -1,299 +0,0 @@ -package metrics - -import ( - "runtime" - "strings" - "time" - - iradix "github.com/hashicorp/go-immutable-radix" -) - -type Label struct { - Name string - Value string -} - -func (m *Metrics) SetGauge(key []string, val float32) { - m.SetGaugeWithLabels(key, val, nil) -} - -func (m *Metrics) SetGaugeWithLabels(key []string, val float32, labels []Label) { - if m.HostName != "" { - if m.EnableHostnameLabel { - labels = append(labels, Label{"host", m.HostName}) - } else if m.EnableHostname { - key = insert(0, m.HostName, key) - } - } - if m.EnableTypePrefix { - key = insert(0, "gauge", key) - } - if m.ServiceName != "" { - if m.EnableServiceLabel { - labels = append(labels, Label{"service", m.ServiceName}) - } else { - key = insert(0, m.ServiceName, key) - } - } - allowed, labelsFiltered := m.allowMetric(key, labels) - if !allowed { - return - } - m.sink.SetGaugeWithLabels(key, val, labelsFiltered) -} - -func (m *Metrics) EmitKey(key []string, val float32) { - if m.EnableTypePrefix { - key = insert(0, "kv", key) - } - if m.ServiceName != "" { - key = insert(0, m.ServiceName, key) - } - allowed, _ := m.allowMetric(key, nil) - if !allowed { - return - } - m.sink.EmitKey(key, val) -} - -func (m *Metrics) IncrCounter(key []string, val float32) { - m.IncrCounterWithLabels(key, val, nil) -} - -func (m *Metrics) IncrCounterWithLabels(key []string, val float32, labels []Label) { - if m.HostName != "" && m.EnableHostnameLabel { - labels = append(labels, Label{"host", m.HostName}) - } - if m.EnableTypePrefix { - key = insert(0, "counter", key) - } - if m.ServiceName != "" { - if m.EnableServiceLabel { - labels = append(labels, Label{"service", m.ServiceName}) - } else { - key = insert(0, m.ServiceName, key) - } - } - allowed, labelsFiltered := m.allowMetric(key, labels) - if !allowed { - return - } - m.sink.IncrCounterWithLabels(key, val, labelsFiltered) -} - -func (m *Metrics) AddSample(key []string, val float32) { - m.AddSampleWithLabels(key, val, nil) -} - -func (m *Metrics) AddSampleWithLabels(key []string, val float32, labels []Label) { - if m.HostName != "" && m.EnableHostnameLabel { - labels = append(labels, Label{"host", m.HostName}) - } - if m.EnableTypePrefix { - key = insert(0, "sample", key) - } - if m.ServiceName != "" { - if m.EnableServiceLabel { - labels = append(labels, Label{"service", m.ServiceName}) - } else { - key = insert(0, m.ServiceName, key) - } - } - allowed, labelsFiltered := m.allowMetric(key, labels) - if !allowed { - return - } - m.sink.AddSampleWithLabels(key, val, labelsFiltered) -} - -func (m *Metrics) MeasureSince(key []string, start time.Time) { - m.MeasureSinceWithLabels(key, start, nil) -} - -func (m *Metrics) MeasureSinceWithLabels(key []string, start time.Time, labels []Label) { - if m.HostName != "" && m.EnableHostnameLabel { - labels = append(labels, Label{"host", m.HostName}) - } - if m.EnableTypePrefix { - key = insert(0, "timer", key) - } - if m.ServiceName != "" { - if m.EnableServiceLabel { - labels = append(labels, Label{"service", m.ServiceName}) - } else { - key = insert(0, m.ServiceName, key) - } - } - allowed, labelsFiltered := m.allowMetric(key, labels) - if !allowed { - return - } - now := time.Now() - elapsed := now.Sub(start) - msec := float32(elapsed.Nanoseconds()) / float32(m.TimerGranularity) - m.sink.AddSampleWithLabels(key, msec, labelsFiltered) -} - -// UpdateFilter overwrites the existing filter with the given rules. -func (m *Metrics) UpdateFilter(allow, block []string) { - m.UpdateFilterAndLabels(allow, block, m.AllowedLabels, m.BlockedLabels) -} - -// UpdateFilterAndLabels overwrites the existing filter with the given rules. -func (m *Metrics) UpdateFilterAndLabels(allow, block, allowedLabels, blockedLabels []string) { - m.filterLock.Lock() - defer m.filterLock.Unlock() - - m.AllowedPrefixes = allow - m.BlockedPrefixes = block - - if allowedLabels == nil { - // Having a white list means we take only elements from it - m.allowedLabels = nil - } else { - m.allowedLabels = make(map[string]bool) - for _, v := range allowedLabels { - m.allowedLabels[v] = true - } - } - m.blockedLabels = make(map[string]bool) - for _, v := range blockedLabels { - m.blockedLabels[v] = true - } - m.AllowedLabels = allowedLabels - m.BlockedLabels = blockedLabels - - m.filter = iradix.New() - for _, prefix := range m.AllowedPrefixes { - m.filter, _, _ = m.filter.Insert([]byte(prefix), true) - } - for _, prefix := range m.BlockedPrefixes { - m.filter, _, _ = m.filter.Insert([]byte(prefix), false) - } -} - -func (m *Metrics) Shutdown() { - if ss, ok := m.sink.(ShutdownSink); ok { - ss.Shutdown() - } -} - -// labelIsAllowed return true if a should be included in metric -// the caller should lock m.filterLock while calling this method -func (m *Metrics) labelIsAllowed(label *Label) bool { - labelName := (*label).Name - if m.blockedLabels != nil { - _, ok := m.blockedLabels[labelName] - if ok { - // If present, let's remove this label - return false - } - } - if m.allowedLabels != nil { - _, ok := m.allowedLabels[labelName] - return ok - } - // Allow by default - return true -} - -// filterLabels return only allowed labels -// the caller should lock m.filterLock while calling this method -func (m *Metrics) filterLabels(labels []Label) []Label { - if labels == nil { - return nil - } - toReturn := []Label{} - for _, label := range labels { - if m.labelIsAllowed(&label) { - toReturn = append(toReturn, label) - } - } - return toReturn -} - -// Returns whether the metric should be allowed based on configured prefix filters -// Also return the applicable labels -func (m *Metrics) allowMetric(key []string, labels []Label) (bool, []Label) { - m.filterLock.RLock() - defer m.filterLock.RUnlock() - - if m.filter == nil || m.filter.Len() == 0 { - return m.Config.FilterDefault, m.filterLabels(labels) - } - - _, allowed, ok := m.filter.Root().LongestPrefix([]byte(strings.Join(key, "."))) - if !ok { - return m.Config.FilterDefault, m.filterLabels(labels) - } - - return allowed.(bool), m.filterLabels(labels) -} - -// Periodically collects runtime stats to publish -func (m *Metrics) collectStats() { - for { - time.Sleep(m.ProfileInterval) - m.EmitRuntimeStats() - } -} - -// Emits various runtime statsitics -func (m *Metrics) EmitRuntimeStats() { - // Export number of Goroutines - numRoutines := runtime.NumGoroutine() - m.SetGauge([]string{"runtime", "num_goroutines"}, float32(numRoutines)) - - // Export memory stats - var stats runtime.MemStats - runtime.ReadMemStats(&stats) - m.SetGauge([]string{"runtime", "alloc_bytes"}, float32(stats.Alloc)) - m.SetGauge([]string{"runtime", "sys_bytes"}, float32(stats.Sys)) - m.SetGauge([]string{"runtime", "malloc_count"}, float32(stats.Mallocs)) - m.SetGauge([]string{"runtime", "free_count"}, float32(stats.Frees)) - m.SetGauge([]string{"runtime", "heap_objects"}, float32(stats.HeapObjects)) - m.SetGauge([]string{"runtime", "total_gc_pause_ns"}, float32(stats.PauseTotalNs)) - m.SetGauge([]string{"runtime", "total_gc_runs"}, float32(stats.NumGC)) - - // Export info about the last few GC runs - num := stats.NumGC - - // Handle wrap around - if num < m.lastNumGC { - m.lastNumGC = 0 - } - - // Ensure we don't scan more than 256 - if num-m.lastNumGC >= 256 { - m.lastNumGC = num - 255 - } - - for i := m.lastNumGC; i < num; i++ { - pause := stats.PauseNs[i%256] - m.AddSample([]string{"runtime", "gc_pause_ns"}, float32(pause)) - } - m.lastNumGC = num -} - -// Creates a new slice with the provided string value as the first element -// and the provided slice values as the remaining values. -// Ordering of the values in the provided input slice is kept in tact in the output slice. -func insert(i int, v string, s []string) []string { - // Allocate new slice to avoid modifying the input slice - newS := make([]string, len(s)+1) - - // Copy s[0, i-1] into newS - for j := 0; j < i; j++ { - newS[j] = s[j] - } - - // Insert provided element at index i - newS[i] = v - - // Copy s[i, len(s)-1] into newS starting at newS[i+1] - for j := i; j < len(s); j++ { - newS[j+1] = s[j] - } - - return newS -} diff --git a/vendor/github.com/armon/go-metrics/sink.go b/vendor/github.com/armon/go-metrics/sink.go deleted file mode 100644 index 6f4108ff4..000000000 --- a/vendor/github.com/armon/go-metrics/sink.go +++ /dev/null @@ -1,132 +0,0 @@ -package metrics - -import ( - "fmt" - "net/url" -) - -// The MetricSink interface is used to transmit metrics information -// to an external system -type MetricSink interface { - // A Gauge should retain the last value it is set to - SetGauge(key []string, val float32) - SetGaugeWithLabels(key []string, val float32, labels []Label) - - // Should emit a Key/Value pair for each call - EmitKey(key []string, val float32) - - // Counters should accumulate values - IncrCounter(key []string, val float32) - IncrCounterWithLabels(key []string, val float32, labels []Label) - - // Samples are for timing information, where quantiles are used - AddSample(key []string, val float32) - AddSampleWithLabels(key []string, val float32, labels []Label) -} - -type ShutdownSink interface { - MetricSink - - // Shutdown the metric sink, flush metrics to storage, and cleanup resources. - // Called immediately prior to application exit. Implementations must block - // until metrics are flushed to storage. - Shutdown() -} - -// BlackholeSink is used to just blackhole messages -type BlackholeSink struct{} - -func (*BlackholeSink) SetGauge(key []string, val float32) {} -func (*BlackholeSink) SetGaugeWithLabels(key []string, val float32, labels []Label) {} -func (*BlackholeSink) EmitKey(key []string, val float32) {} -func (*BlackholeSink) IncrCounter(key []string, val float32) {} -func (*BlackholeSink) IncrCounterWithLabels(key []string, val float32, labels []Label) {} -func (*BlackholeSink) AddSample(key []string, val float32) {} -func (*BlackholeSink) AddSampleWithLabels(key []string, val float32, labels []Label) {} - -// FanoutSink is used to sink to fanout values to multiple sinks -type FanoutSink []MetricSink - -func (fh FanoutSink) SetGauge(key []string, val float32) { - fh.SetGaugeWithLabels(key, val, nil) -} - -func (fh FanoutSink) SetGaugeWithLabels(key []string, val float32, labels []Label) { - for _, s := range fh { - s.SetGaugeWithLabels(key, val, labels) - } -} - -func (fh FanoutSink) EmitKey(key []string, val float32) { - for _, s := range fh { - s.EmitKey(key, val) - } -} - -func (fh FanoutSink) IncrCounter(key []string, val float32) { - fh.IncrCounterWithLabels(key, val, nil) -} - -func (fh FanoutSink) IncrCounterWithLabels(key []string, val float32, labels []Label) { - for _, s := range fh { - s.IncrCounterWithLabels(key, val, labels) - } -} - -func (fh FanoutSink) AddSample(key []string, val float32) { - fh.AddSampleWithLabels(key, val, nil) -} - -func (fh FanoutSink) AddSampleWithLabels(key []string, val float32, labels []Label) { - for _, s := range fh { - s.AddSampleWithLabels(key, val, labels) - } -} - -func (fh FanoutSink) Shutdown() { - for _, s := range fh { - if ss, ok := s.(ShutdownSink); ok { - ss.Shutdown() - } - } -} - -// sinkURLFactoryFunc is an generic interface around the *SinkFromURL() function provided -// by each sink type -type sinkURLFactoryFunc func(*url.URL) (MetricSink, error) - -// sinkRegistry supports the generic NewMetricSink function by mapping URL -// schemes to metric sink factory functions -var sinkRegistry = map[string]sinkURLFactoryFunc{ - "statsd": NewStatsdSinkFromURL, - "statsite": NewStatsiteSinkFromURL, - "inmem": NewInmemSinkFromURL, -} - -// NewMetricSinkFromURL allows a generic URL input to configure any of the -// supported sinks. The scheme of the URL identifies the type of the sink, the -// and query parameters are used to set options. -// -// "statsd://" - Initializes a StatsdSink. The host and port are passed through -// as the "addr" of the sink -// -// "statsite://" - Initializes a StatsiteSink. The host and port become the -// "addr" of the sink -// -// "inmem://" - Initializes an InmemSink. The host and port are ignored. The -// "interval" and "duration" query parameters must be specified with valid -// durations, see NewInmemSink for details. -func NewMetricSinkFromURL(urlStr string) (MetricSink, error) { - u, err := url.Parse(urlStr) - if err != nil { - return nil, err - } - - sinkURLFactoryFunc := sinkRegistry[u.Scheme] - if sinkURLFactoryFunc == nil { - return nil, fmt.Errorf( - "cannot create metric sink, unrecognized sink name: %q", u.Scheme) - } - - return sinkURLFactoryFunc(u) -} diff --git a/vendor/github.com/armon/go-metrics/start.go b/vendor/github.com/armon/go-metrics/start.go deleted file mode 100644 index 38976f8dc..000000000 --- a/vendor/github.com/armon/go-metrics/start.go +++ /dev/null @@ -1,158 +0,0 @@ -package metrics - -import ( - "os" - "sync" - "sync/atomic" - "time" - - iradix "github.com/hashicorp/go-immutable-radix" -) - -// Config is used to configure metrics settings -type Config struct { - ServiceName string // Prefixed with keys to separate services - HostName string // Hostname to use. If not provided and EnableHostname, it will be os.Hostname - EnableHostname bool // Enable prefixing gauge values with hostname - EnableHostnameLabel bool // Enable adding hostname to labels - EnableServiceLabel bool // Enable adding service to labels - EnableRuntimeMetrics bool // Enables profiling of runtime metrics (GC, Goroutines, Memory) - EnableTypePrefix bool // Prefixes key with a type ("counter", "gauge", "timer") - TimerGranularity time.Duration // Granularity of timers. - ProfileInterval time.Duration // Interval to profile runtime metrics - - AllowedPrefixes []string // A list of metric prefixes to allow, with '.' as the separator - BlockedPrefixes []string // A list of metric prefixes to block, with '.' as the separator - AllowedLabels []string // A list of metric labels to allow, with '.' as the separator - BlockedLabels []string // A list of metric labels to block, with '.' as the separator - FilterDefault bool // Whether to allow metrics by default -} - -// Metrics represents an instance of a metrics sink that can -// be used to emit -type Metrics struct { - Config - lastNumGC uint32 - sink MetricSink - filter *iradix.Tree - allowedLabels map[string]bool - blockedLabels map[string]bool - filterLock sync.RWMutex // Lock filters and allowedLabels/blockedLabels access -} - -// Shared global metrics instance -var globalMetrics atomic.Value // *Metrics - -func init() { - // Initialize to a blackhole sink to avoid errors - globalMetrics.Store(&Metrics{sink: &BlackholeSink{}}) -} - -// Default returns the shared global metrics instance. -func Default() *Metrics { - return globalMetrics.Load().(*Metrics) -} - -// DefaultConfig provides a sane default configuration -func DefaultConfig(serviceName string) *Config { - c := &Config{ - ServiceName: serviceName, // Use client provided service - HostName: "", - EnableHostname: true, // Enable hostname prefix - EnableRuntimeMetrics: true, // Enable runtime profiling - EnableTypePrefix: false, // Disable type prefix - TimerGranularity: time.Millisecond, // Timers are in milliseconds - ProfileInterval: time.Second, // Poll runtime every second - FilterDefault: true, // Don't filter metrics by default - } - - // Try to get the hostname - name, _ := os.Hostname() - c.HostName = name - return c -} - -// New is used to create a new instance of Metrics -func New(conf *Config, sink MetricSink) (*Metrics, error) { - met := &Metrics{} - met.Config = *conf - met.sink = sink - met.UpdateFilterAndLabels(conf.AllowedPrefixes, conf.BlockedPrefixes, conf.AllowedLabels, conf.BlockedLabels) - - // Start the runtime collector - if conf.EnableRuntimeMetrics { - go met.collectStats() - } - return met, nil -} - -// NewGlobal is the same as New, but it assigns the metrics object to be -// used globally as well as returning it. -func NewGlobal(conf *Config, sink MetricSink) (*Metrics, error) { - metrics, err := New(conf, sink) - if err == nil { - globalMetrics.Store(metrics) - } - return metrics, err -} - -// Proxy all the methods to the globalMetrics instance -func SetGauge(key []string, val float32) { - globalMetrics.Load().(*Metrics).SetGauge(key, val) -} - -func SetGaugeWithLabels(key []string, val float32, labels []Label) { - globalMetrics.Load().(*Metrics).SetGaugeWithLabels(key, val, labels) -} - -func EmitKey(key []string, val float32) { - globalMetrics.Load().(*Metrics).EmitKey(key, val) -} - -func IncrCounter(key []string, val float32) { - globalMetrics.Load().(*Metrics).IncrCounter(key, val) -} - -func IncrCounterWithLabels(key []string, val float32, labels []Label) { - globalMetrics.Load().(*Metrics).IncrCounterWithLabels(key, val, labels) -} - -func AddSample(key []string, val float32) { - globalMetrics.Load().(*Metrics).AddSample(key, val) -} - -func AddSampleWithLabels(key []string, val float32, labels []Label) { - globalMetrics.Load().(*Metrics).AddSampleWithLabels(key, val, labels) -} - -func MeasureSince(key []string, start time.Time) { - globalMetrics.Load().(*Metrics).MeasureSince(key, start) -} - -func MeasureSinceWithLabels(key []string, start time.Time, labels []Label) { - globalMetrics.Load().(*Metrics).MeasureSinceWithLabels(key, start, labels) -} - -func UpdateFilter(allow, block []string) { - globalMetrics.Load().(*Metrics).UpdateFilter(allow, block) -} - -// UpdateFilterAndLabels set allow/block prefixes of metrics while allowedLabels -// and blockedLabels - when not nil - allow filtering of labels in order to -// block/allow globally labels (especially useful when having large number of -// values for a given label). See README.md for more information about usage. -func UpdateFilterAndLabels(allow, block, allowedLabels, blockedLabels []string) { - globalMetrics.Load().(*Metrics).UpdateFilterAndLabels(allow, block, allowedLabels, blockedLabels) -} - -// Shutdown disables metric collection, then blocks while attempting to flush metrics to storage. -// WARNING: Not all MetricSink backends support this functionality, and calling this will cause them to leak resources. -// This is intended for use immediately prior to application exit. -func Shutdown() { - m := globalMetrics.Load().(*Metrics) - // Swap whatever MetricSink is currently active with a BlackholeSink. Callers must not have a - // reason to expect that calls to the library will successfully collect metrics after Shutdown - // has been called. - globalMetrics.Store(&Metrics{sink: &BlackholeSink{}}) - m.Shutdown() -} diff --git a/vendor/github.com/armon/go-metrics/statsd.go b/vendor/github.com/armon/go-metrics/statsd.go deleted file mode 100644 index 1bfffce46..000000000 --- a/vendor/github.com/armon/go-metrics/statsd.go +++ /dev/null @@ -1,184 +0,0 @@ -package metrics - -import ( - "bytes" - "fmt" - "log" - "net" - "net/url" - "strings" - "time" -) - -const ( - // statsdMaxLen is the maximum size of a packet - // to send to statsd - statsdMaxLen = 1400 -) - -// StatsdSink provides a MetricSink that can be used -// with a statsite or statsd metrics server. It uses -// only UDP packets, while StatsiteSink uses TCP. -type StatsdSink struct { - addr string - metricQueue chan string -} - -// NewStatsdSinkFromURL creates an StatsdSink from a URL. It is used -// (and tested) from NewMetricSinkFromURL. -func NewStatsdSinkFromURL(u *url.URL) (MetricSink, error) { - return NewStatsdSink(u.Host) -} - -// NewStatsdSink is used to create a new StatsdSink -func NewStatsdSink(addr string) (*StatsdSink, error) { - s := &StatsdSink{ - addr: addr, - metricQueue: make(chan string, 4096), - } - go s.flushMetrics() - return s, nil -} - -// Close is used to stop flushing to statsd -func (s *StatsdSink) Shutdown() { - close(s.metricQueue) -} - -func (s *StatsdSink) SetGauge(key []string, val float32) { - flatKey := s.flattenKey(key) - s.pushMetric(fmt.Sprintf("%s:%f|g\n", flatKey, val)) -} - -func (s *StatsdSink) SetGaugeWithLabels(key []string, val float32, labels []Label) { - flatKey := s.flattenKeyLabels(key, labels) - s.pushMetric(fmt.Sprintf("%s:%f|g\n", flatKey, val)) -} - -func (s *StatsdSink) EmitKey(key []string, val float32) { - flatKey := s.flattenKey(key) - s.pushMetric(fmt.Sprintf("%s:%f|kv\n", flatKey, val)) -} - -func (s *StatsdSink) IncrCounter(key []string, val float32) { - flatKey := s.flattenKey(key) - s.pushMetric(fmt.Sprintf("%s:%f|c\n", flatKey, val)) -} - -func (s *StatsdSink) IncrCounterWithLabels(key []string, val float32, labels []Label) { - flatKey := s.flattenKeyLabels(key, labels) - s.pushMetric(fmt.Sprintf("%s:%f|c\n", flatKey, val)) -} - -func (s *StatsdSink) AddSample(key []string, val float32) { - flatKey := s.flattenKey(key) - s.pushMetric(fmt.Sprintf("%s:%f|ms\n", flatKey, val)) -} - -func (s *StatsdSink) AddSampleWithLabels(key []string, val float32, labels []Label) { - flatKey := s.flattenKeyLabels(key, labels) - s.pushMetric(fmt.Sprintf("%s:%f|ms\n", flatKey, val)) -} - -// Flattens the key for formatting, removes spaces -func (s *StatsdSink) flattenKey(parts []string) string { - joined := strings.Join(parts, ".") - return strings.Map(func(r rune) rune { - switch r { - case ':': - fallthrough - case ' ': - return '_' - default: - return r - } - }, joined) -} - -// Flattens the key along with labels for formatting, removes spaces -func (s *StatsdSink) flattenKeyLabels(parts []string, labels []Label) string { - for _, label := range labels { - parts = append(parts, label.Value) - } - return s.flattenKey(parts) -} - -// Does a non-blocking push to the metrics queue -func (s *StatsdSink) pushMetric(m string) { - select { - case s.metricQueue <- m: - default: - } -} - -// Flushes metrics -func (s *StatsdSink) flushMetrics() { - var sock net.Conn - var err error - var wait <-chan time.Time - ticker := time.NewTicker(flushInterval) - defer ticker.Stop() - -CONNECT: - // Create a buffer - buf := bytes.NewBuffer(nil) - - // Attempt to connect - sock, err = net.Dial("udp", s.addr) - if err != nil { - log.Printf("[ERR] Error connecting to statsd! Err: %s", err) - goto WAIT - } - - for { - select { - case metric, ok := <-s.metricQueue: - // Get a metric from the queue - if !ok { - goto QUIT - } - - // Check if this would overflow the packet size - if len(metric)+buf.Len() > statsdMaxLen { - _, err := sock.Write(buf.Bytes()) - buf.Reset() - if err != nil { - log.Printf("[ERR] Error writing to statsd! Err: %s", err) - goto WAIT - } - } - - // Append to the buffer - buf.WriteString(metric) - - case <-ticker.C: - if buf.Len() == 0 { - continue - } - - _, err := sock.Write(buf.Bytes()) - buf.Reset() - if err != nil { - log.Printf("[ERR] Error flushing to statsd! Err: %s", err) - goto WAIT - } - } - } - -WAIT: - // Wait for a while - wait = time.After(time.Duration(5) * time.Second) - for { - select { - // Dequeue the messages to avoid backlog - case _, ok := <-s.metricQueue: - if !ok { - goto QUIT - } - case <-wait: - goto CONNECT - } - } -QUIT: - s.metricQueue = nil -} diff --git a/vendor/github.com/armon/go-metrics/statsite.go b/vendor/github.com/armon/go-metrics/statsite.go deleted file mode 100644 index 6c0d284d2..000000000 --- a/vendor/github.com/armon/go-metrics/statsite.go +++ /dev/null @@ -1,172 +0,0 @@ -package metrics - -import ( - "bufio" - "fmt" - "log" - "net" - "net/url" - "strings" - "time" -) - -const ( - // We force flush the statsite metrics after this period of - // inactivity. Prevents stats from getting stuck in a buffer - // forever. - flushInterval = 100 * time.Millisecond -) - -// NewStatsiteSinkFromURL creates an StatsiteSink from a URL. It is used -// (and tested) from NewMetricSinkFromURL. -func NewStatsiteSinkFromURL(u *url.URL) (MetricSink, error) { - return NewStatsiteSink(u.Host) -} - -// StatsiteSink provides a MetricSink that can be used with a -// statsite metrics server -type StatsiteSink struct { - addr string - metricQueue chan string -} - -// NewStatsiteSink is used to create a new StatsiteSink -func NewStatsiteSink(addr string) (*StatsiteSink, error) { - s := &StatsiteSink{ - addr: addr, - metricQueue: make(chan string, 4096), - } - go s.flushMetrics() - return s, nil -} - -// Close is used to stop flushing to statsite -func (s *StatsiteSink) Shutdown() { - close(s.metricQueue) -} - -func (s *StatsiteSink) SetGauge(key []string, val float32) { - flatKey := s.flattenKey(key) - s.pushMetric(fmt.Sprintf("%s:%f|g\n", flatKey, val)) -} - -func (s *StatsiteSink) SetGaugeWithLabels(key []string, val float32, labels []Label) { - flatKey := s.flattenKeyLabels(key, labels) - s.pushMetric(fmt.Sprintf("%s:%f|g\n", flatKey, val)) -} - -func (s *StatsiteSink) EmitKey(key []string, val float32) { - flatKey := s.flattenKey(key) - s.pushMetric(fmt.Sprintf("%s:%f|kv\n", flatKey, val)) -} - -func (s *StatsiteSink) IncrCounter(key []string, val float32) { - flatKey := s.flattenKey(key) - s.pushMetric(fmt.Sprintf("%s:%f|c\n", flatKey, val)) -} - -func (s *StatsiteSink) IncrCounterWithLabels(key []string, val float32, labels []Label) { - flatKey := s.flattenKeyLabels(key, labels) - s.pushMetric(fmt.Sprintf("%s:%f|c\n", flatKey, val)) -} - -func (s *StatsiteSink) AddSample(key []string, val float32) { - flatKey := s.flattenKey(key) - s.pushMetric(fmt.Sprintf("%s:%f|ms\n", flatKey, val)) -} - -func (s *StatsiteSink) AddSampleWithLabels(key []string, val float32, labels []Label) { - flatKey := s.flattenKeyLabels(key, labels) - s.pushMetric(fmt.Sprintf("%s:%f|ms\n", flatKey, val)) -} - -// Flattens the key for formatting, removes spaces -func (s *StatsiteSink) flattenKey(parts []string) string { - joined := strings.Join(parts, ".") - return strings.Map(func(r rune) rune { - switch r { - case ':': - fallthrough - case ' ': - return '_' - default: - return r - } - }, joined) -} - -// Flattens the key along with labels for formatting, removes spaces -func (s *StatsiteSink) flattenKeyLabels(parts []string, labels []Label) string { - for _, label := range labels { - parts = append(parts, label.Value) - } - return s.flattenKey(parts) -} - -// Does a non-blocking push to the metrics queue -func (s *StatsiteSink) pushMetric(m string) { - select { - case s.metricQueue <- m: - default: - } -} - -// Flushes metrics -func (s *StatsiteSink) flushMetrics() { - var sock net.Conn - var err error - var wait <-chan time.Time - var buffered *bufio.Writer - ticker := time.NewTicker(flushInterval) - defer ticker.Stop() - -CONNECT: - // Attempt to connect - sock, err = net.Dial("tcp", s.addr) - if err != nil { - log.Printf("[ERR] Error connecting to statsite! Err: %s", err) - goto WAIT - } - - // Create a buffered writer - buffered = bufio.NewWriter(sock) - - for { - select { - case metric, ok := <-s.metricQueue: - // Get a metric from the queue - if !ok { - goto QUIT - } - - // Try to send to statsite - _, err := buffered.Write([]byte(metric)) - if err != nil { - log.Printf("[ERR] Error writing to statsite! Err: %s", err) - goto WAIT - } - case <-ticker.C: - if err := buffered.Flush(); err != nil { - log.Printf("[ERR] Error flushing to statsite! Err: %s", err) - goto WAIT - } - } - } - -WAIT: - // Wait for a while - wait = time.After(time.Duration(5) * time.Second) - for { - select { - // Dequeue the messages to avoid backlog - case _, ok := <-s.metricQueue: - if !ok { - goto QUIT - } - case <-wait: - goto CONNECT - } - } -QUIT: - s.metricQueue = nil -} diff --git a/vendor/github.com/beorn7/perks/LICENSE b/vendor/github.com/beorn7/perks/LICENSE deleted file mode 100644 index 339177be6..000000000 --- a/vendor/github.com/beorn7/perks/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (C) 2013 Blake Mizerany - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/beorn7/perks/quantile/exampledata.txt b/vendor/github.com/beorn7/perks/quantile/exampledata.txt deleted file mode 100644 index 1602287d7..000000000 --- a/vendor/github.com/beorn7/perks/quantile/exampledata.txt +++ /dev/null @@ -1,2388 +0,0 @@ -8 -5 -26 -12 -5 -235 -13 -6 -28 -30 -3 -3 -3 -3 -5 -2 -33 -7 -2 -4 -7 -12 -14 -5 -8 -3 -10 -4 -5 -3 -6 -6 -209 -20 -3 -10 -14 -3 -4 -6 -8 -5 -11 -7 -3 -2 -3 -3 -212 -5 -222 -4 -10 -10 -5 -6 -3 -8 -3 -10 -254 -220 -2 -3 -5 -24 -5 -4 -222 -7 -3 -3 -223 -8 -15 -12 -14 -14 -3 -2 -2 -3 -13 -3 -11 -4 -4 -6 -5 -7 -13 -5 -3 -5 -2 -5 -3 -5 -2 -7 -15 -17 -14 -3 -6 -6 -3 -17 -5 -4 -7 -6 -4 -4 -8 -6 -8 -3 -9 -3 -6 -3 -4 -5 -3 -3 -660 -4 -6 -10 -3 -6 -3 -2 -5 -13 -2 -4 -4 -10 -4 -8 -4 -3 -7 -9 -9 -3 -10 -37 -3 -13 -4 -12 -3 -6 -10 -8 -5 -21 -2 -3 -8 -3 -2 -3 -3 -4 -12 -2 -4 -8 -8 -4 -3 -2 -20 -1 -6 -32 -2 -11 -6 -18 -3 -8 -11 -3 -212 -3 -4 -2 -6 -7 -12 -11 -3 -2 -16 -10 -6 -4 -6 -3 -2 -7 -3 -2 -2 -2 -2 -5 -6 -4 -3 -10 -3 -4 -6 -5 -3 -4 -4 -5 -6 -4 -3 -4 -4 -5 -7 -5 -5 -3 -2 -7 -2 -4 -12 -4 -5 -6 -2 -4 -4 -8 -4 -15 -13 -7 -16 -5 -3 -23 -5 -5 -7 -3 -2 -9 -8 -7 -5 -8 -11 -4 -10 -76 -4 -47 -4 -3 -2 -7 -4 -2 -3 -37 -10 -4 -2 -20 -5 -4 -4 -10 -10 -4 -3 -7 -23 -240 -7 -13 -5 -5 -3 -3 -2 -5 -4 -2 -8 -7 -19 -2 -23 -8 -7 -2 -5 -3 -8 -3 -8 -13 -5 -5 -5 -2 -3 -23 -4 -9 -8 -4 -3 -3 -5 -220 -2 -3 -4 -6 -14 -3 -53 -6 -2 -5 -18 -6 -3 -219 -6 -5 -2 -5 -3 -6 -5 -15 -4 -3 -17 -3 -2 -4 -7 -2 -3 -3 -4 -4 -3 -2 -664 -6 -3 -23 -5 -5 -16 -5 -8 -2 -4 -2 -24 -12 -3 -2 -3 -5 -8 -3 -5 -4 -3 -14 -3 -5 -8 -2 -3 -7 -9 -4 -2 -3 -6 -8 -4 -3 -4 -6 -5 -3 -3 -6 -3 -19 -4 -4 -6 -3 -6 -3 -5 -22 -5 -4 -4 -3 -8 -11 -4 -9 -7 -6 -13 -4 -4 -4 -6 -17 -9 -3 -3 -3 -4 -3 -221 -5 -11 -3 -4 -2 -12 -6 -3 -5 -7 -5 -7 -4 -9 -7 -14 -37 -19 -217 -16 -3 -5 -2 -2 -7 -19 -7 -6 -7 -4 -24 -5 -11 -4 -7 -7 -9 -13 -3 -4 -3 -6 -28 -4 -4 -5 -5 -2 -5 -6 -4 -4 -6 -10 -5 -4 -3 -2 -3 -3 -6 -5 -5 -4 -3 -2 -3 -7 -4 -6 -18 -16 -8 -16 -4 -5 -8 -6 -9 -13 -1545 -6 -215 -6 -5 -6 -3 -45 -31 -5 -2 -2 -4 -3 -3 -2 -5 -4 -3 -5 -7 -7 -4 -5 -8 -5 -4 -749 -2 -31 -9 -11 -2 -11 -5 -4 -4 -7 -9 -11 -4 -5 -4 -7 -3 -4 -6 -2 -15 -3 -4 -3 -4 -3 -5 -2 -13 -5 -5 -3 -3 -23 -4 -4 -5 -7 -4 -13 -2 -4 -3 -4 -2 -6 -2 -7 -3 -5 -5 -3 -29 -5 -4 -4 -3 -10 -2 -3 -79 -16 -6 -6 -7 -7 -3 -5 -5 -7 -4 -3 -7 -9 -5 -6 -5 -9 -6 -3 -6 -4 -17 -2 -10 -9 -3 -6 -2 -3 -21 -22 -5 -11 -4 -2 -17 -2 -224 -2 -14 -3 -4 -4 -2 -4 -4 -4 -4 -5 -3 -4 -4 -10 -2 -6 -3 -3 -5 -7 -2 -7 -5 -6 -3 -218 -2 -2 -5 -2 -6 -3 -5 -222 -14 -6 -33 -3 -2 -5 -3 -3 -3 -9 -5 -3 -3 -2 -7 -4 -3 -4 -3 -5 -6 -5 -26 -4 -13 -9 -7 -3 -221 -3 -3 -4 -4 -4 -4 -2 -18 -5 -3 -7 -9 -6 -8 -3 -10 -3 -11 -9 -5 -4 -17 -5 -5 -6 -6 -3 -2 -4 -12 -17 -6 -7 -218 -4 -2 -4 -10 -3 -5 -15 -3 -9 -4 -3 -3 -6 -29 -3 -3 -4 -5 -5 -3 -8 -5 -6 -6 -7 -5 -3 -5 -3 -29 -2 -31 -5 -15 -24 -16 -5 -207 -4 -3 -3 -2 -15 -4 -4 -13 -5 -5 -4 -6 -10 -2 -7 -8 -4 -6 -20 -5 -3 -4 -3 -12 -12 -5 -17 -7 -3 -3 -3 -6 -10 -3 -5 -25 -80 -4 -9 -3 -2 -11 -3 -3 -2 -3 -8 -7 -5 -5 -19 -5 -3 -3 -12 -11 -2 -6 -5 -5 -5 -3 -3 -3 -4 -209 -14 -3 -2 -5 -19 -4 -4 -3 -4 -14 -5 -6 -4 -13 -9 -7 -4 -7 -10 -2 -9 -5 -7 -2 -8 -4 -6 -5 -5 -222 -8 -7 -12 -5 -216 -3 -4 -4 -6 -3 -14 -8 -7 -13 -4 -3 -3 -3 -3 -17 -5 -4 -3 -33 -6 -6 -33 -7 -5 -3 -8 -7 -5 -2 -9 -4 -2 -233 -24 -7 -4 -8 -10 -3 -4 -15 -2 -16 -3 -3 -13 -12 -7 -5 -4 -207 -4 -2 -4 -27 -15 -2 -5 -2 -25 -6 -5 -5 -6 -13 -6 -18 -6 -4 -12 -225 -10 -7 -5 -2 -2 -11 -4 -14 -21 -8 -10 -3 -5 -4 -232 -2 -5 -5 -3 -7 -17 -11 -6 -6 -23 -4 -6 -3 -5 -4 -2 -17 -3 -6 -5 -8 -3 -2 -2 -14 -9 -4 -4 -2 -5 -5 -3 -7 -6 -12 -6 -10 -3 -6 -2 -2 -19 -5 -4 -4 -9 -2 -4 -13 -3 -5 -6 -3 -6 -5 -4 -9 -6 -3 -5 -7 -3 -6 -6 -4 -3 -10 -6 -3 -221 -3 -5 -3 -6 -4 -8 -5 -3 -6 -4 -4 -2 -54 -5 -6 -11 -3 -3 -4 -4 -4 -3 -7 -3 -11 -11 -7 -10 -6 -13 -223 -213 -15 -231 -7 -3 -7 -228 -2 -3 -4 -4 -5 -6 -7 -4 -13 -3 -4 -5 -3 -6 -4 -6 -7 -2 -4 -3 -4 -3 -3 -6 -3 -7 -3 -5 -18 -5 -6 -8 -10 -3 -3 -3 -2 -4 -2 -4 -4 -5 -6 -6 -4 -10 -13 -3 -12 -5 -12 -16 -8 -4 -19 -11 -2 -4 -5 -6 -8 -5 -6 -4 -18 -10 -4 -2 -216 -6 -6 -6 -2 -4 -12 -8 -3 -11 -5 -6 -14 -5 -3 -13 -4 -5 -4 -5 -3 -28 -6 -3 -7 -219 -3 -9 -7 -3 -10 -6 -3 -4 -19 -5 -7 -11 -6 -15 -19 -4 -13 -11 -3 -7 -5 -10 -2 -8 -11 -2 -6 -4 -6 -24 -6 -3 -3 -3 -3 -6 -18 -4 -11 -4 -2 -5 -10 -8 -3 -9 -5 -3 -4 -5 -6 -2 -5 -7 -4 -4 -14 -6 -4 -4 -5 -5 -7 -2 -4 -3 -7 -3 -3 -6 -4 -5 -4 -4 -4 -3 -3 -3 -3 -8 -14 -2 -3 -5 -3 -2 -4 -5 -3 -7 -3 -3 -18 -3 -4 -4 -5 -7 -3 -3 -3 -13 -5 -4 -8 -211 -5 -5 -3 -5 -2 -5 -4 -2 -655 -6 -3 -5 -11 -2 -5 -3 -12 -9 -15 -11 -5 -12 -217 -2 -6 -17 -3 -3 -207 -5 -5 -4 -5 -9 -3 -2 -8 -5 -4 -3 -2 -5 -12 -4 -14 -5 -4 -2 -13 -5 -8 -4 -225 -4 -3 -4 -5 -4 -3 -3 -6 -23 -9 -2 -6 -7 -233 -4 -4 -6 -18 -3 -4 -6 -3 -4 -4 -2 -3 -7 -4 -13 -227 -4 -3 -5 -4 -2 -12 -9 -17 -3 -7 -14 -6 -4 -5 -21 -4 -8 -9 -2 -9 -25 -16 -3 -6 -4 -7 -8 -5 -2 -3 -5 -4 -3 -3 -5 -3 -3 -3 -2 -3 -19 -2 -4 -3 -4 -2 -3 -4 -4 -2 -4 -3 -3 -3 -2 -6 -3 -17 -5 -6 -4 -3 -13 -5 -3 -3 -3 -4 -9 -4 -2 -14 -12 -4 -5 -24 -4 -3 -37 -12 -11 -21 -3 -4 -3 -13 -4 -2 -3 -15 -4 -11 -4 -4 -3 -8 -3 -4 -4 -12 -8 -5 -3 -3 -4 -2 -220 -3 -5 -223 -3 -3 -3 -10 -3 -15 -4 -241 -9 -7 -3 -6 -6 -23 -4 -13 -7 -3 -4 -7 -4 -9 -3 -3 -4 -10 -5 -5 -1 -5 -24 -2 -4 -5 -5 -6 -14 -3 -8 -2 -3 -5 -13 -13 -3 -5 -2 -3 -15 -3 -4 -2 -10 -4 -4 -4 -5 -5 -3 -5 -3 -4 -7 -4 -27 -3 -6 -4 -15 -3 -5 -6 -6 -5 -4 -8 -3 -9 -2 -6 -3 -4 -3 -7 -4 -18 -3 -11 -3 -3 -8 -9 -7 -24 -3 -219 -7 -10 -4 -5 -9 -12 -2 -5 -4 -4 -4 -3 -3 -19 -5 -8 -16 -8 -6 -22 -3 -23 -3 -242 -9 -4 -3 -3 -5 -7 -3 -3 -5 -8 -3 -7 -5 -14 -8 -10 -3 -4 -3 -7 -4 -6 -7 -4 -10 -4 -3 -11 -3 -7 -10 -3 -13 -6 -8 -12 -10 -5 -7 -9 -3 -4 -7 -7 -10 -8 -30 -9 -19 -4 -3 -19 -15 -4 -13 -3 -215 -223 -4 -7 -4 -8 -17 -16 -3 -7 -6 -5 -5 -4 -12 -3 -7 -4 -4 -13 -4 -5 -2 -5 -6 -5 -6 -6 -7 -10 -18 -23 -9 -3 -3 -6 -5 -2 -4 -2 -7 -3 -3 -2 -5 -5 -14 -10 -224 -6 -3 -4 -3 -7 -5 -9 -3 -6 -4 -2 -5 -11 -4 -3 -3 -2 -8 -4 -7 -4 -10 -7 -3 -3 -18 -18 -17 -3 -3 -3 -4 -5 -3 -3 -4 -12 -7 -3 -11 -13 -5 -4 -7 -13 -5 -4 -11 -3 -12 -3 -6 -4 -4 -21 -4 -6 -9 -5 -3 -10 -8 -4 -6 -4 -4 -6 -5 -4 -8 -6 -4 -6 -4 -4 -5 -9 -6 -3 -4 -2 -9 -3 -18 -2 -4 -3 -13 -3 -6 -6 -8 -7 -9 -3 -2 -16 -3 -4 -6 -3 -2 -33 -22 -14 -4 -9 -12 -4 -5 -6 -3 -23 -9 -4 -3 -5 -5 -3 -4 -5 -3 -5 -3 -10 -4 -5 -5 -8 -4 -4 -6 -8 -5 -4 -3 -4 -6 -3 -3 -3 -5 -9 -12 -6 -5 -9 -3 -5 -3 -2 -2 -2 -18 -3 -2 -21 -2 -5 -4 -6 -4 -5 -10 -3 -9 -3 -2 -10 -7 -3 -6 -6 -4 -4 -8 -12 -7 -3 -7 -3 -3 -9 -3 -4 -5 -4 -4 -5 -5 -10 -15 -4 -4 -14 -6 -227 -3 -14 -5 -216 -22 -5 -4 -2 -2 -6 -3 -4 -2 -9 -9 -4 -3 -28 -13 -11 -4 -5 -3 -3 -2 -3 -3 -5 -3 -4 -3 -5 -23 -26 -3 -4 -5 -6 -4 -6 -3 -5 -5 -3 -4 -3 -2 -2 -2 -7 -14 -3 -6 -7 -17 -2 -2 -15 -14 -16 -4 -6 -7 -13 -6 -4 -5 -6 -16 -3 -3 -28 -3 -6 -15 -3 -9 -2 -4 -6 -3 -3 -22 -4 -12 -6 -7 -2 -5 -4 -10 -3 -16 -6 -9 -2 -5 -12 -7 -5 -5 -5 -5 -2 -11 -9 -17 -4 -3 -11 -7 -3 -5 -15 -4 -3 -4 -211 -8 -7 -5 -4 -7 -6 -7 -6 -3 -6 -5 -6 -5 -3 -4 -4 -26 -4 -6 -10 -4 -4 -3 -2 -3 -3 -4 -5 -9 -3 -9 -4 -4 -5 -5 -8 -2 -4 -2 -3 -8 -4 -11 -19 -5 -8 -6 -3 -5 -6 -12 -3 -2 -4 -16 -12 -3 -4 -4 -8 -6 -5 -6 -6 -219 -8 -222 -6 -16 -3 -13 -19 -5 -4 -3 -11 -6 -10 -4 -7 -7 -12 -5 -3 -3 -5 -6 -10 -3 -8 -2 -5 -4 -7 -2 -4 -4 -2 -12 -9 -6 -4 -2 -40 -2 -4 -10 -4 -223 -4 -2 -20 -6 -7 -24 -5 -4 -5 -2 -20 -16 -6 -5 -13 -2 -3 -3 -19 -3 -2 -4 -5 -6 -7 -11 -12 -5 -6 -7 -7 -3 -5 -3 -5 -3 -14 -3 -4 -4 -2 -11 -1 -7 -3 -9 -6 -11 -12 -5 -8 -6 -221 -4 -2 -12 -4 -3 -15 -4 -5 -226 -7 -218 -7 -5 -4 -5 -18 -4 -5 -9 -4 -4 -2 -9 -18 -18 -9 -5 -6 -6 -3 -3 -7 -3 -5 -4 -4 -4 -12 -3 -6 -31 -5 -4 -7 -3 -6 -5 -6 -5 -11 -2 -2 -11 -11 -6 -7 -5 -8 -7 -10 -5 -23 -7 -4 -3 -5 -34 -2 -5 -23 -7 -3 -6 -8 -4 -4 -4 -2 -5 -3 -8 -5 -4 -8 -25 -2 -3 -17 -8 -3 -4 -8 -7 -3 -15 -6 -5 -7 -21 -9 -5 -6 -6 -5 -3 -2 -3 -10 -3 -6 -3 -14 -7 -4 -4 -8 -7 -8 -2 -6 -12 -4 -213 -6 -5 -21 -8 -2 -5 -23 -3 -11 -2 -3 -6 -25 -2 -3 -6 -7 -6 -6 -4 -4 -6 -3 -17 -9 -7 -6 -4 -3 -10 -7 -2 -3 -3 -3 -11 -8 -3 -7 -6 -4 -14 -36 -3 -4 -3 -3 -22 -13 -21 -4 -2 -7 -4 -4 -17 -15 -3 -7 -11 -2 -4 -7 -6 -209 -6 -3 -2 -2 -24 -4 -9 -4 -3 -3 -3 -29 -2 -2 -4 -3 -3 -5 -4 -6 -3 -3 -2 -4 diff --git a/vendor/github.com/beorn7/perks/quantile/stream.go b/vendor/github.com/beorn7/perks/quantile/stream.go deleted file mode 100644 index d7d14f8eb..000000000 --- a/vendor/github.com/beorn7/perks/quantile/stream.go +++ /dev/null @@ -1,316 +0,0 @@ -// Package quantile computes approximate quantiles over an unbounded data -// stream within low memory and CPU bounds. -// -// A small amount of accuracy is traded to achieve the above properties. -// -// Multiple streams can be merged before calling Query to generate a single set -// of results. This is meaningful when the streams represent the same type of -// data. See Merge and Samples. -// -// For more detailed information about the algorithm used, see: -// -// Effective Computation of Biased Quantiles over Data Streams -// -// http://www.cs.rutgers.edu/~muthu/bquant.pdf -package quantile - -import ( - "math" - "sort" -) - -// Sample holds an observed value and meta information for compression. JSON -// tags have been added for convenience. -type Sample struct { - Value float64 `json:",string"` - Width float64 `json:",string"` - Delta float64 `json:",string"` -} - -// Samples represents a slice of samples. It implements sort.Interface. -type Samples []Sample - -func (a Samples) Len() int { return len(a) } -func (a Samples) Less(i, j int) bool { return a[i].Value < a[j].Value } -func (a Samples) Swap(i, j int) { a[i], a[j] = a[j], a[i] } - -type invariant func(s *stream, r float64) float64 - -// NewLowBiased returns an initialized Stream for low-biased quantiles -// (e.g. 0.01, 0.1, 0.5) where the needed quantiles are not known a priori, but -// error guarantees can still be given even for the lower ranks of the data -// distribution. -// -// The provided epsilon is a relative error, i.e. the true quantile of a value -// returned by a query is guaranteed to be within (1±Epsilon)*Quantile. -// -// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error -// properties. -func NewLowBiased(epsilon float64) *Stream { - ƒ := func(s *stream, r float64) float64 { - return 2 * epsilon * r - } - return newStream(ƒ) -} - -// NewHighBiased returns an initialized Stream for high-biased quantiles -// (e.g. 0.01, 0.1, 0.5) where the needed quantiles are not known a priori, but -// error guarantees can still be given even for the higher ranks of the data -// distribution. -// -// The provided epsilon is a relative error, i.e. the true quantile of a value -// returned by a query is guaranteed to be within 1-(1±Epsilon)*(1-Quantile). -// -// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error -// properties. -func NewHighBiased(epsilon float64) *Stream { - ƒ := func(s *stream, r float64) float64 { - return 2 * epsilon * (s.n - r) - } - return newStream(ƒ) -} - -// NewTargeted returns an initialized Stream concerned with a particular set of -// quantile values that are supplied a priori. Knowing these a priori reduces -// space and computation time. The targets map maps the desired quantiles to -// their absolute errors, i.e. the true quantile of a value returned by a query -// is guaranteed to be within (Quantile±Epsilon). -// -// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error properties. -func NewTargeted(targetMap map[float64]float64) *Stream { - // Convert map to slice to avoid slow iterations on a map. - // ƒ is called on the hot path, so converting the map to a slice - // beforehand results in significant CPU savings. - targets := targetMapToSlice(targetMap) - - ƒ := func(s *stream, r float64) float64 { - var m = math.MaxFloat64 - var f float64 - for _, t := range targets { - if t.quantile*s.n <= r { - f = (2 * t.epsilon * r) / t.quantile - } else { - f = (2 * t.epsilon * (s.n - r)) / (1 - t.quantile) - } - if f < m { - m = f - } - } - return m - } - return newStream(ƒ) -} - -type target struct { - quantile float64 - epsilon float64 -} - -func targetMapToSlice(targetMap map[float64]float64) []target { - targets := make([]target, 0, len(targetMap)) - - for quantile, epsilon := range targetMap { - t := target{ - quantile: quantile, - epsilon: epsilon, - } - targets = append(targets, t) - } - - return targets -} - -// Stream computes quantiles for a stream of float64s. It is not thread-safe by -// design. Take care when using across multiple goroutines. -type Stream struct { - *stream - b Samples - sorted bool -} - -func newStream(ƒ invariant) *Stream { - x := &stream{ƒ: ƒ} - return &Stream{x, make(Samples, 0, 500), true} -} - -// Insert inserts v into the stream. -func (s *Stream) Insert(v float64) { - s.insert(Sample{Value: v, Width: 1}) -} - -func (s *Stream) insert(sample Sample) { - s.b = append(s.b, sample) - s.sorted = false - if len(s.b) == cap(s.b) { - s.flush() - } -} - -// Query returns the computed qth percentiles value. If s was created with -// NewTargeted, and q is not in the set of quantiles provided a priori, Query -// will return an unspecified result. -func (s *Stream) Query(q float64) float64 { - if !s.flushed() { - // Fast path when there hasn't been enough data for a flush; - // this also yields better accuracy for small sets of data. - l := len(s.b) - if l == 0 { - return 0 - } - i := int(math.Ceil(float64(l) * q)) - if i > 0 { - i -= 1 - } - s.maybeSort() - return s.b[i].Value - } - s.flush() - return s.stream.query(q) -} - -// Merge merges samples into the underlying streams samples. This is handy when -// merging multiple streams from separate threads, database shards, etc. -// -// ATTENTION: This method is broken and does not yield correct results. The -// underlying algorithm is not capable of merging streams correctly. -func (s *Stream) Merge(samples Samples) { - sort.Sort(samples) - s.stream.merge(samples) -} - -// Reset reinitializes and clears the list reusing the samples buffer memory. -func (s *Stream) Reset() { - s.stream.reset() - s.b = s.b[:0] -} - -// Samples returns stream samples held by s. -func (s *Stream) Samples() Samples { - if !s.flushed() { - return s.b - } - s.flush() - return s.stream.samples() -} - -// Count returns the total number of samples observed in the stream -// since initialization. -func (s *Stream) Count() int { - return len(s.b) + s.stream.count() -} - -func (s *Stream) flush() { - s.maybeSort() - s.stream.merge(s.b) - s.b = s.b[:0] -} - -func (s *Stream) maybeSort() { - if !s.sorted { - s.sorted = true - sort.Sort(s.b) - } -} - -func (s *Stream) flushed() bool { - return len(s.stream.l) > 0 -} - -type stream struct { - n float64 - l []Sample - ƒ invariant -} - -func (s *stream) reset() { - s.l = s.l[:0] - s.n = 0 -} - -func (s *stream) insert(v float64) { - s.merge(Samples{{v, 1, 0}}) -} - -func (s *stream) merge(samples Samples) { - // TODO(beorn7): This tries to merge not only individual samples, but - // whole summaries. The paper doesn't mention merging summaries at - // all. Unittests show that the merging is inaccurate. Find out how to - // do merges properly. - var r float64 - i := 0 - for _, sample := range samples { - for ; i < len(s.l); i++ { - c := s.l[i] - if c.Value > sample.Value { - // Insert at position i. - s.l = append(s.l, Sample{}) - copy(s.l[i+1:], s.l[i:]) - s.l[i] = Sample{ - sample.Value, - sample.Width, - math.Max(sample.Delta, math.Floor(s.ƒ(s, r))-1), - // TODO(beorn7): How to calculate delta correctly? - } - i++ - goto inserted - } - r += c.Width - } - s.l = append(s.l, Sample{sample.Value, sample.Width, 0}) - i++ - inserted: - s.n += sample.Width - r += sample.Width - } - s.compress() -} - -func (s *stream) count() int { - return int(s.n) -} - -func (s *stream) query(q float64) float64 { - t := math.Ceil(q * s.n) - t += math.Ceil(s.ƒ(s, t) / 2) - p := s.l[0] - var r float64 - for _, c := range s.l[1:] { - r += p.Width - if r+c.Width+c.Delta > t { - return p.Value - } - p = c - } - return p.Value -} - -func (s *stream) compress() { - if len(s.l) < 2 { - return - } - x := s.l[len(s.l)-1] - xi := len(s.l) - 1 - r := s.n - 1 - x.Width - - for i := len(s.l) - 2; i >= 0; i-- { - c := s.l[i] - if c.Width+x.Width+x.Delta <= s.ƒ(s, r) { - x.Width += c.Width - s.l[xi] = x - // Remove element at i. - copy(s.l[i:], s.l[i+1:]) - s.l = s.l[:len(s.l)-1] - xi -= 1 - } else { - x = c - xi = i - } - r -= c.Width - } -} - -func (s *stream) samples() Samples { - samples := make(Samples, len(s.l)) - copy(samples, s.l) - return samples -} diff --git a/vendor/github.com/cespare/xxhash/v2/LICENSE.txt b/vendor/github.com/cespare/xxhash/v2/LICENSE.txt deleted file mode 100644 index 24b53065f..000000000 --- a/vendor/github.com/cespare/xxhash/v2/LICENSE.txt +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2016 Caleb Spare - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/cespare/xxhash/v2/README.md b/vendor/github.com/cespare/xxhash/v2/README.md deleted file mode 100644 index 8bf0e5b78..000000000 --- a/vendor/github.com/cespare/xxhash/v2/README.md +++ /dev/null @@ -1,72 +0,0 @@ -# xxhash - -[![Go Reference](https://pkg.go.dev/badge/github.com/cespare/xxhash/v2.svg)](https://pkg.go.dev/github.com/cespare/xxhash/v2) -[![Test](https://github.com/cespare/xxhash/actions/workflows/test.yml/badge.svg)](https://github.com/cespare/xxhash/actions/workflows/test.yml) - -xxhash is a Go implementation of the 64-bit [xxHash] algorithm, XXH64. This is a -high-quality hashing algorithm that is much faster than anything in the Go -standard library. - -This package provides a straightforward API: - -``` -func Sum64(b []byte) uint64 -func Sum64String(s string) uint64 -type Digest struct{ ... } - func New() *Digest -``` - -The `Digest` type implements hash.Hash64. Its key methods are: - -``` -func (*Digest) Write([]byte) (int, error) -func (*Digest) WriteString(string) (int, error) -func (*Digest) Sum64() uint64 -``` - -The package is written with optimized pure Go and also contains even faster -assembly implementations for amd64 and arm64. If desired, the `purego` build tag -opts into using the Go code even on those architectures. - -[xxHash]: http://cyan4973.github.io/xxHash/ - -## Compatibility - -This package is in a module and the latest code is in version 2 of the module. -You need a version of Go with at least "minimal module compatibility" to use -github.com/cespare/xxhash/v2: - -* 1.9.7+ for Go 1.9 -* 1.10.3+ for Go 1.10 -* Go 1.11 or later - -I recommend using the latest release of Go. - -## Benchmarks - -Here are some quick benchmarks comparing the pure-Go and assembly -implementations of Sum64. - -| input size | purego | asm | -| ---------- | --------- | --------- | -| 4 B | 1.3 GB/s | 1.2 GB/s | -| 16 B | 2.9 GB/s | 3.5 GB/s | -| 100 B | 6.9 GB/s | 8.1 GB/s | -| 4 KB | 11.7 GB/s | 16.7 GB/s | -| 10 MB | 12.0 GB/s | 17.3 GB/s | - -These numbers were generated on Ubuntu 20.04 with an Intel Xeon Platinum 8252C -CPU using the following commands under Go 1.19.2: - -``` -benchstat <(go test -tags purego -benchtime 500ms -count 15 -bench 'Sum64$') -benchstat <(go test -benchtime 500ms -count 15 -bench 'Sum64$') -``` - -## Projects using this package - -- [InfluxDB](https://github.com/influxdata/influxdb) -- [Prometheus](https://github.com/prometheus/prometheus) -- [VictoriaMetrics](https://github.com/VictoriaMetrics/VictoriaMetrics) -- [FreeCache](https://github.com/coocood/freecache) -- [FastCache](https://github.com/VictoriaMetrics/fastcache) diff --git a/vendor/github.com/cespare/xxhash/v2/testall.sh b/vendor/github.com/cespare/xxhash/v2/testall.sh deleted file mode 100644 index 94b9c4439..000000000 --- a/vendor/github.com/cespare/xxhash/v2/testall.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -eu -o pipefail - -# Small convenience script for running the tests with various combinations of -# arch/tags. This assumes we're running on amd64 and have qemu available. - -go test ./... -go test -tags purego ./... -GOARCH=arm64 go test -GOARCH=arm64 go test -tags purego diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash.go b/vendor/github.com/cespare/xxhash/v2/xxhash.go deleted file mode 100644 index a9e0d45c9..000000000 --- a/vendor/github.com/cespare/xxhash/v2/xxhash.go +++ /dev/null @@ -1,228 +0,0 @@ -// Package xxhash implements the 64-bit variant of xxHash (XXH64) as described -// at http://cyan4973.github.io/xxHash/. -package xxhash - -import ( - "encoding/binary" - "errors" - "math/bits" -) - -const ( - prime1 uint64 = 11400714785074694791 - prime2 uint64 = 14029467366897019727 - prime3 uint64 = 1609587929392839161 - prime4 uint64 = 9650029242287828579 - prime5 uint64 = 2870177450012600261 -) - -// Store the primes in an array as well. -// -// The consts are used when possible in Go code to avoid MOVs but we need a -// contiguous array of the assembly code. -var primes = [...]uint64{prime1, prime2, prime3, prime4, prime5} - -// Digest implements hash.Hash64. -type Digest struct { - v1 uint64 - v2 uint64 - v3 uint64 - v4 uint64 - total uint64 - mem [32]byte - n int // how much of mem is used -} - -// New creates a new Digest that computes the 64-bit xxHash algorithm. -func New() *Digest { - var d Digest - d.Reset() - return &d -} - -// Reset clears the Digest's state so that it can be reused. -func (d *Digest) Reset() { - d.v1 = primes[0] + prime2 - d.v2 = prime2 - d.v3 = 0 - d.v4 = -primes[0] - d.total = 0 - d.n = 0 -} - -// Size always returns 8 bytes. -func (d *Digest) Size() int { return 8 } - -// BlockSize always returns 32 bytes. -func (d *Digest) BlockSize() int { return 32 } - -// Write adds more data to d. It always returns len(b), nil. -func (d *Digest) Write(b []byte) (n int, err error) { - n = len(b) - d.total += uint64(n) - - memleft := d.mem[d.n&(len(d.mem)-1):] - - if d.n+n < 32 { - // This new data doesn't even fill the current block. - copy(memleft, b) - d.n += n - return - } - - if d.n > 0 { - // Finish off the partial block. - c := copy(memleft, b) - d.v1 = round(d.v1, u64(d.mem[0:8])) - d.v2 = round(d.v2, u64(d.mem[8:16])) - d.v3 = round(d.v3, u64(d.mem[16:24])) - d.v4 = round(d.v4, u64(d.mem[24:32])) - b = b[c:] - d.n = 0 - } - - if len(b) >= 32 { - // One or more full blocks left. - nw := writeBlocks(d, b) - b = b[nw:] - } - - // Store any remaining partial block. - copy(d.mem[:], b) - d.n = len(b) - - return -} - -// Sum appends the current hash to b and returns the resulting slice. -func (d *Digest) Sum(b []byte) []byte { - s := d.Sum64() - return append( - b, - byte(s>>56), - byte(s>>48), - byte(s>>40), - byte(s>>32), - byte(s>>24), - byte(s>>16), - byte(s>>8), - byte(s), - ) -} - -// Sum64 returns the current hash. -func (d *Digest) Sum64() uint64 { - var h uint64 - - if d.total >= 32 { - v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4 - h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4) - h = mergeRound(h, v1) - h = mergeRound(h, v2) - h = mergeRound(h, v3) - h = mergeRound(h, v4) - } else { - h = d.v3 + prime5 - } - - h += d.total - - b := d.mem[:d.n&(len(d.mem)-1)] - for ; len(b) >= 8; b = b[8:] { - k1 := round(0, u64(b[:8])) - h ^= k1 - h = rol27(h)*prime1 + prime4 - } - if len(b) >= 4 { - h ^= uint64(u32(b[:4])) * prime1 - h = rol23(h)*prime2 + prime3 - b = b[4:] - } - for ; len(b) > 0; b = b[1:] { - h ^= uint64(b[0]) * prime5 - h = rol11(h) * prime1 - } - - h ^= h >> 33 - h *= prime2 - h ^= h >> 29 - h *= prime3 - h ^= h >> 32 - - return h -} - -const ( - magic = "xxh\x06" - marshaledSize = len(magic) + 8*5 + 32 -) - -// MarshalBinary implements the encoding.BinaryMarshaler interface. -func (d *Digest) MarshalBinary() ([]byte, error) { - b := make([]byte, 0, marshaledSize) - b = append(b, magic...) - b = appendUint64(b, d.v1) - b = appendUint64(b, d.v2) - b = appendUint64(b, d.v3) - b = appendUint64(b, d.v4) - b = appendUint64(b, d.total) - b = append(b, d.mem[:d.n]...) - b = b[:len(b)+len(d.mem)-d.n] - return b, nil -} - -// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. -func (d *Digest) UnmarshalBinary(b []byte) error { - if len(b) < len(magic) || string(b[:len(magic)]) != magic { - return errors.New("xxhash: invalid hash state identifier") - } - if len(b) != marshaledSize { - return errors.New("xxhash: invalid hash state size") - } - b = b[len(magic):] - b, d.v1 = consumeUint64(b) - b, d.v2 = consumeUint64(b) - b, d.v3 = consumeUint64(b) - b, d.v4 = consumeUint64(b) - b, d.total = consumeUint64(b) - copy(d.mem[:], b) - d.n = int(d.total % uint64(len(d.mem))) - return nil -} - -func appendUint64(b []byte, x uint64) []byte { - var a [8]byte - binary.LittleEndian.PutUint64(a[:], x) - return append(b, a[:]...) -} - -func consumeUint64(b []byte) ([]byte, uint64) { - x := u64(b) - return b[8:], x -} - -func u64(b []byte) uint64 { return binary.LittleEndian.Uint64(b) } -func u32(b []byte) uint32 { return binary.LittleEndian.Uint32(b) } - -func round(acc, input uint64) uint64 { - acc += input * prime2 - acc = rol31(acc) - acc *= prime1 - return acc -} - -func mergeRound(acc, val uint64) uint64 { - val = round(0, val) - acc ^= val - acc = acc*prime1 + prime4 - return acc -} - -func rol1(x uint64) uint64 { return bits.RotateLeft64(x, 1) } -func rol7(x uint64) uint64 { return bits.RotateLeft64(x, 7) } -func rol11(x uint64) uint64 { return bits.RotateLeft64(x, 11) } -func rol12(x uint64) uint64 { return bits.RotateLeft64(x, 12) } -func rol18(x uint64) uint64 { return bits.RotateLeft64(x, 18) } -func rol23(x uint64) uint64 { return bits.RotateLeft64(x, 23) } -func rol27(x uint64) uint64 { return bits.RotateLeft64(x, 27) } -func rol31(x uint64) uint64 { return bits.RotateLeft64(x, 31) } diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s b/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s deleted file mode 100644 index 3e8b13257..000000000 --- a/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s +++ /dev/null @@ -1,209 +0,0 @@ -//go:build !appengine && gc && !purego -// +build !appengine -// +build gc -// +build !purego - -#include "textflag.h" - -// Registers: -#define h AX -#define d AX -#define p SI // pointer to advance through b -#define n DX -#define end BX // loop end -#define v1 R8 -#define v2 R9 -#define v3 R10 -#define v4 R11 -#define x R12 -#define prime1 R13 -#define prime2 R14 -#define prime4 DI - -#define round(acc, x) \ - IMULQ prime2, x \ - ADDQ x, acc \ - ROLQ $31, acc \ - IMULQ prime1, acc - -// round0 performs the operation x = round(0, x). -#define round0(x) \ - IMULQ prime2, x \ - ROLQ $31, x \ - IMULQ prime1, x - -// mergeRound applies a merge round on the two registers acc and x. -// It assumes that prime1, prime2, and prime4 have been loaded. -#define mergeRound(acc, x) \ - round0(x) \ - XORQ x, acc \ - IMULQ prime1, acc \ - ADDQ prime4, acc - -// blockLoop processes as many 32-byte blocks as possible, -// updating v1, v2, v3, and v4. It assumes that there is at least one block -// to process. -#define blockLoop() \ -loop: \ - MOVQ +0(p), x \ - round(v1, x) \ - MOVQ +8(p), x \ - round(v2, x) \ - MOVQ +16(p), x \ - round(v3, x) \ - MOVQ +24(p), x \ - round(v4, x) \ - ADDQ $32, p \ - CMPQ p, end \ - JLE loop - -// func Sum64(b []byte) uint64 -TEXT ·Sum64(SB), NOSPLIT|NOFRAME, $0-32 - // Load fixed primes. - MOVQ ·primes+0(SB), prime1 - MOVQ ·primes+8(SB), prime2 - MOVQ ·primes+24(SB), prime4 - - // Load slice. - MOVQ b_base+0(FP), p - MOVQ b_len+8(FP), n - LEAQ (p)(n*1), end - - // The first loop limit will be len(b)-32. - SUBQ $32, end - - // Check whether we have at least one block. - CMPQ n, $32 - JLT noBlocks - - // Set up initial state (v1, v2, v3, v4). - MOVQ prime1, v1 - ADDQ prime2, v1 - MOVQ prime2, v2 - XORQ v3, v3 - XORQ v4, v4 - SUBQ prime1, v4 - - blockLoop() - - MOVQ v1, h - ROLQ $1, h - MOVQ v2, x - ROLQ $7, x - ADDQ x, h - MOVQ v3, x - ROLQ $12, x - ADDQ x, h - MOVQ v4, x - ROLQ $18, x - ADDQ x, h - - mergeRound(h, v1) - mergeRound(h, v2) - mergeRound(h, v3) - mergeRound(h, v4) - - JMP afterBlocks - -noBlocks: - MOVQ ·primes+32(SB), h - -afterBlocks: - ADDQ n, h - - ADDQ $24, end - CMPQ p, end - JG try4 - -loop8: - MOVQ (p), x - ADDQ $8, p - round0(x) - XORQ x, h - ROLQ $27, h - IMULQ prime1, h - ADDQ prime4, h - - CMPQ p, end - JLE loop8 - -try4: - ADDQ $4, end - CMPQ p, end - JG try1 - - MOVL (p), x - ADDQ $4, p - IMULQ prime1, x - XORQ x, h - - ROLQ $23, h - IMULQ prime2, h - ADDQ ·primes+16(SB), h - -try1: - ADDQ $4, end - CMPQ p, end - JGE finalize - -loop1: - MOVBQZX (p), x - ADDQ $1, p - IMULQ ·primes+32(SB), x - XORQ x, h - ROLQ $11, h - IMULQ prime1, h - - CMPQ p, end - JL loop1 - -finalize: - MOVQ h, x - SHRQ $33, x - XORQ x, h - IMULQ prime2, h - MOVQ h, x - SHRQ $29, x - XORQ x, h - IMULQ ·primes+16(SB), h - MOVQ h, x - SHRQ $32, x - XORQ x, h - - MOVQ h, ret+24(FP) - RET - -// func writeBlocks(d *Digest, b []byte) int -TEXT ·writeBlocks(SB), NOSPLIT|NOFRAME, $0-40 - // Load fixed primes needed for round. - MOVQ ·primes+0(SB), prime1 - MOVQ ·primes+8(SB), prime2 - - // Load slice. - MOVQ b_base+8(FP), p - MOVQ b_len+16(FP), n - LEAQ (p)(n*1), end - SUBQ $32, end - - // Load vN from d. - MOVQ s+0(FP), d - MOVQ 0(d), v1 - MOVQ 8(d), v2 - MOVQ 16(d), v3 - MOVQ 24(d), v4 - - // We don't need to check the loop condition here; this function is - // always called with at least one block of data to process. - blockLoop() - - // Copy vN back to d. - MOVQ v1, 0(d) - MOVQ v2, 8(d) - MOVQ v3, 16(d) - MOVQ v4, 24(d) - - // The number of bytes written is p minus the old base pointer. - SUBQ b_base+8(FP), p - MOVQ p, ret+32(FP) - - RET diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_arm64.s b/vendor/github.com/cespare/xxhash/v2/xxhash_arm64.s deleted file mode 100644 index 7e3145a22..000000000 --- a/vendor/github.com/cespare/xxhash/v2/xxhash_arm64.s +++ /dev/null @@ -1,183 +0,0 @@ -//go:build !appengine && gc && !purego -// +build !appengine -// +build gc -// +build !purego - -#include "textflag.h" - -// Registers: -#define digest R1 -#define h R2 // return value -#define p R3 // input pointer -#define n R4 // input length -#define nblocks R5 // n / 32 -#define prime1 R7 -#define prime2 R8 -#define prime3 R9 -#define prime4 R10 -#define prime5 R11 -#define v1 R12 -#define v2 R13 -#define v3 R14 -#define v4 R15 -#define x1 R20 -#define x2 R21 -#define x3 R22 -#define x4 R23 - -#define round(acc, x) \ - MADD prime2, acc, x, acc \ - ROR $64-31, acc \ - MUL prime1, acc - -// round0 performs the operation x = round(0, x). -#define round0(x) \ - MUL prime2, x \ - ROR $64-31, x \ - MUL prime1, x - -#define mergeRound(acc, x) \ - round0(x) \ - EOR x, acc \ - MADD acc, prime4, prime1, acc - -// blockLoop processes as many 32-byte blocks as possible, -// updating v1, v2, v3, and v4. It assumes that n >= 32. -#define blockLoop() \ - LSR $5, n, nblocks \ - PCALIGN $16 \ - loop: \ - LDP.P 16(p), (x1, x2) \ - LDP.P 16(p), (x3, x4) \ - round(v1, x1) \ - round(v2, x2) \ - round(v3, x3) \ - round(v4, x4) \ - SUB $1, nblocks \ - CBNZ nblocks, loop - -// func Sum64(b []byte) uint64 -TEXT ·Sum64(SB), NOSPLIT|NOFRAME, $0-32 - LDP b_base+0(FP), (p, n) - - LDP ·primes+0(SB), (prime1, prime2) - LDP ·primes+16(SB), (prime3, prime4) - MOVD ·primes+32(SB), prime5 - - CMP $32, n - CSEL LT, prime5, ZR, h // if n < 32 { h = prime5 } else { h = 0 } - BLT afterLoop - - ADD prime1, prime2, v1 - MOVD prime2, v2 - MOVD $0, v3 - NEG prime1, v4 - - blockLoop() - - ROR $64-1, v1, x1 - ROR $64-7, v2, x2 - ADD x1, x2 - ROR $64-12, v3, x3 - ROR $64-18, v4, x4 - ADD x3, x4 - ADD x2, x4, h - - mergeRound(h, v1) - mergeRound(h, v2) - mergeRound(h, v3) - mergeRound(h, v4) - -afterLoop: - ADD n, h - - TBZ $4, n, try8 - LDP.P 16(p), (x1, x2) - - round0(x1) - - // NOTE: here and below, sequencing the EOR after the ROR (using a - // rotated register) is worth a small but measurable speedup for small - // inputs. - ROR $64-27, h - EOR x1 @> 64-27, h, h - MADD h, prime4, prime1, h - - round0(x2) - ROR $64-27, h - EOR x2 @> 64-27, h, h - MADD h, prime4, prime1, h - -try8: - TBZ $3, n, try4 - MOVD.P 8(p), x1 - - round0(x1) - ROR $64-27, h - EOR x1 @> 64-27, h, h - MADD h, prime4, prime1, h - -try4: - TBZ $2, n, try2 - MOVWU.P 4(p), x2 - - MUL prime1, x2 - ROR $64-23, h - EOR x2 @> 64-23, h, h - MADD h, prime3, prime2, h - -try2: - TBZ $1, n, try1 - MOVHU.P 2(p), x3 - AND $255, x3, x1 - LSR $8, x3, x2 - - MUL prime5, x1 - ROR $64-11, h - EOR x1 @> 64-11, h, h - MUL prime1, h - - MUL prime5, x2 - ROR $64-11, h - EOR x2 @> 64-11, h, h - MUL prime1, h - -try1: - TBZ $0, n, finalize - MOVBU (p), x4 - - MUL prime5, x4 - ROR $64-11, h - EOR x4 @> 64-11, h, h - MUL prime1, h - -finalize: - EOR h >> 33, h - MUL prime2, h - EOR h >> 29, h - MUL prime3, h - EOR h >> 32, h - - MOVD h, ret+24(FP) - RET - -// func writeBlocks(d *Digest, b []byte) int -TEXT ·writeBlocks(SB), NOSPLIT|NOFRAME, $0-40 - LDP ·primes+0(SB), (prime1, prime2) - - // Load state. Assume v[1-4] are stored contiguously. - MOVD d+0(FP), digest - LDP 0(digest), (v1, v2) - LDP 16(digest), (v3, v4) - - LDP b_base+8(FP), (p, n) - - blockLoop() - - // Store updated state. - STP (v1, v2), 0(digest) - STP (v3, v4), 16(digest) - - BIC $31, n - MOVD n, ret+32(FP) - RET diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_asm.go b/vendor/github.com/cespare/xxhash/v2/xxhash_asm.go deleted file mode 100644 index 9216e0a40..000000000 --- a/vendor/github.com/cespare/xxhash/v2/xxhash_asm.go +++ /dev/null @@ -1,15 +0,0 @@ -//go:build (amd64 || arm64) && !appengine && gc && !purego -// +build amd64 arm64 -// +build !appengine -// +build gc -// +build !purego - -package xxhash - -// Sum64 computes the 64-bit xxHash digest of b. -// -//go:noescape -func Sum64(b []byte) uint64 - -//go:noescape -func writeBlocks(d *Digest, b []byte) int diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_other.go b/vendor/github.com/cespare/xxhash/v2/xxhash_other.go deleted file mode 100644 index 26df13bba..000000000 --- a/vendor/github.com/cespare/xxhash/v2/xxhash_other.go +++ /dev/null @@ -1,76 +0,0 @@ -//go:build (!amd64 && !arm64) || appengine || !gc || purego -// +build !amd64,!arm64 appengine !gc purego - -package xxhash - -// Sum64 computes the 64-bit xxHash digest of b. -func Sum64(b []byte) uint64 { - // A simpler version would be - // d := New() - // d.Write(b) - // return d.Sum64() - // but this is faster, particularly for small inputs. - - n := len(b) - var h uint64 - - if n >= 32 { - v1 := primes[0] + prime2 - v2 := prime2 - v3 := uint64(0) - v4 := -primes[0] - for len(b) >= 32 { - v1 = round(v1, u64(b[0:8:len(b)])) - v2 = round(v2, u64(b[8:16:len(b)])) - v3 = round(v3, u64(b[16:24:len(b)])) - v4 = round(v4, u64(b[24:32:len(b)])) - b = b[32:len(b):len(b)] - } - h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4) - h = mergeRound(h, v1) - h = mergeRound(h, v2) - h = mergeRound(h, v3) - h = mergeRound(h, v4) - } else { - h = prime5 - } - - h += uint64(n) - - for ; len(b) >= 8; b = b[8:] { - k1 := round(0, u64(b[:8])) - h ^= k1 - h = rol27(h)*prime1 + prime4 - } - if len(b) >= 4 { - h ^= uint64(u32(b[:4])) * prime1 - h = rol23(h)*prime2 + prime3 - b = b[4:] - } - for ; len(b) > 0; b = b[1:] { - h ^= uint64(b[0]) * prime5 - h = rol11(h) * prime1 - } - - h ^= h >> 33 - h *= prime2 - h ^= h >> 29 - h *= prime3 - h ^= h >> 32 - - return h -} - -func writeBlocks(d *Digest, b []byte) int { - v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4 - n := len(b) - for len(b) >= 32 { - v1 = round(v1, u64(b[0:8:len(b)])) - v2 = round(v2, u64(b[8:16:len(b)])) - v3 = round(v3, u64(b[16:24:len(b)])) - v4 = round(v4, u64(b[24:32:len(b)])) - b = b[32:len(b):len(b)] - } - d.v1, d.v2, d.v3, d.v4 = v1, v2, v3, v4 - return n - len(b) -} diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go b/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go deleted file mode 100644 index e86f1b5fd..000000000 --- a/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go +++ /dev/null @@ -1,16 +0,0 @@ -//go:build appengine -// +build appengine - -// This file contains the safe implementations of otherwise unsafe-using code. - -package xxhash - -// Sum64String computes the 64-bit xxHash digest of s. -func Sum64String(s string) uint64 { - return Sum64([]byte(s)) -} - -// WriteString adds more data to d. It always returns len(s), nil. -func (d *Digest) WriteString(s string) (n int, err error) { - return d.Write([]byte(s)) -} diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go b/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go deleted file mode 100644 index 1c1638fd8..000000000 --- a/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go +++ /dev/null @@ -1,58 +0,0 @@ -//go:build !appengine -// +build !appengine - -// This file encapsulates usage of unsafe. -// xxhash_safe.go contains the safe implementations. - -package xxhash - -import ( - "unsafe" -) - -// In the future it's possible that compiler optimizations will make these -// XxxString functions unnecessary by realizing that calls such as -// Sum64([]byte(s)) don't need to copy s. See https://go.dev/issue/2205. -// If that happens, even if we keep these functions they can be replaced with -// the trivial safe code. - -// NOTE: The usual way of doing an unsafe string-to-[]byte conversion is: -// -// var b []byte -// bh := (*reflect.SliceHeader)(unsafe.Pointer(&b)) -// bh.Data = (*reflect.StringHeader)(unsafe.Pointer(&s)).Data -// bh.Len = len(s) -// bh.Cap = len(s) -// -// Unfortunately, as of Go 1.15.3 the inliner's cost model assigns a high enough -// weight to this sequence of expressions that any function that uses it will -// not be inlined. Instead, the functions below use a different unsafe -// conversion designed to minimize the inliner weight and allow both to be -// inlined. There is also a test (TestInlining) which verifies that these are -// inlined. -// -// See https://github.com/golang/go/issues/42739 for discussion. - -// Sum64String computes the 64-bit xxHash digest of s. -// It may be faster than Sum64([]byte(s)) by avoiding a copy. -func Sum64String(s string) uint64 { - b := *(*[]byte)(unsafe.Pointer(&sliceHeader{s, len(s)})) - return Sum64(b) -} - -// WriteString adds more data to d. It always returns len(s), nil. -// It may be faster than Write([]byte(s)) by avoiding a copy. -func (d *Digest) WriteString(s string) (n int, err error) { - d.Write(*(*[]byte)(unsafe.Pointer(&sliceHeader{s, len(s)}))) - // d.Write always returns len(s), nil. - // Ignoring the return output and returning these fixed values buys a - // savings of 6 in the inliner's cost model. - return len(s), nil -} - -// sliceHeader is similar to reflect.SliceHeader, but it assumes that the layout -// of the first two words is the same as the layout of a string. -type sliceHeader struct { - s string - cap int -} diff --git a/vendor/github.com/cilium/cilium/AUTHORS b/vendor/github.com/cilium/cilium/AUTHORS index 440c5f22c..e82263f98 100644 --- a/vendor/github.com/cilium/cilium/AUTHORS +++ b/vendor/github.com/cilium/cilium/AUTHORS @@ -1,6 +1,7 @@ The following people, in alphabetical order, have either authored or signed off on commits in the Cilium repository: +a5r0n a5r0n@users.noreply.github.com Aaron Ecay aaron.ecay@sky.uk Àbéjídé Àyodélé abejideayodele@gmail.com Abirdcfly fp544037857@gmail.com @@ -29,6 +30,7 @@ Alex Katsman alexkats@google.com Alex Romanov alex@romanov.ws Alex Szakaly alex.szakaly@gmail.com Alex Waring alex.waring@starlingbank.com +Alkama Hasan gl3118@myamu.ac.in Alois Petutschnig alois@petutschnig.net Amey Bhide amey@covalent.io Amir Kheirkhahan amir.kheirkhahan@dbschenker.com @@ -192,6 +194,7 @@ David Donchez donch@dailymotion.com David Korczynski david@adalogics.com David Leadbeater dgl@dgl.cx David Schlosnagle davids@palantir.com +David Swafford dswafford@coreweave.com David Wolffberg 1350533+wolffberg@users.noreply.github.com Dawn lx1960753013@gmail.com dddddai dddwq@foxmail.com @@ -262,6 +265,7 @@ Filip Nikolic oss.filipn@gmail.com Fish-pro zechun.chen@daocloud.io Florian Koch f0@users.noreply.github.com Florian Lehner dev@der-flo.net +Foyer Unix foyerunix@foyer.lu Francois Allard francois@breathelife.com François Joulaud francois.joulaud@radiofrance.com Frank Villaro-Dixon frank.villaro@infomaniak.com @@ -285,7 +289,7 @@ Glen Yu glen.yu@gmail.com Glib Smaga code@gsmaga.com Gobinath Krishnamoorthy gobinathk@google.com Gowtham Sundara gowtham.sundara@rapyuta-robotics.com -Gray Lian gray.liang@isovalent.com +Gray Liang gray.liang@isovalent.com guangwu guoguangwug@gmail.com Guilherme Oki guilherme.oki@wildlifestudios.com Guilherme Souza 101073+guilhermef@users.noreply.github.com @@ -303,6 +307,7 @@ Hector Monsalve hmonsalv@gmail.com Heiko Rothe me@heikorothe.com Hemanth Malla hemanth.malla@datadoghq.com Hemslo Wang hemslo.wang@gmail.com +Hong Chen hong.chen.7219@gmail.com Hrittik hrittikcom@gmail.com Huagong Wang wanghuagong@kylinos.cn huangxuesen huangxuesen@kuaishou.com @@ -314,6 +319,7 @@ hxysayhi 51870525+hxysayhi@users.noreply.github.c Ian Vernon ian@cilium.io Ifeanyi Ubah ify1992@yahoo.com Iiqbal2000 iqbalhafizh2000@gmail.com +Ilia Chernov cherno8.ilya@gmail.com Ilya Dmitrichenko errordeveloper@gmail.com Ilya Shaisultanov ilya.shaisultanov@gmail.com Ioannis Androulidakis androulidakis.ioannis@gmail.com @@ -348,6 +354,7 @@ jignyasamishra iamjignyasa@gmail.com Jim Angel jimangel@google.com.com Jimmy Song rootsongjc@gmail.com Jim Ntosas ntosas@gmail.com +Jingyuan Liang jingyuanliang@google.com JinLin Fu withlin@apache.org Jiong Wang jiong.wang@netronome.com jiuker 2818723467@qq.com @@ -438,6 +445,7 @@ Lucas Leblow lucasleblow@mailbox.org Lucas Rattz lucas.rattz@syself.com lucming 2876757716@qq.com Ludovic Ortega ludovic.ortega@adminafk.fr +Lukas Stehlik stehlik.lukas@gmail.com Maartje Eyskens maartje@eyskens.me Maciej Fijalkowski maciej.fijalkowski@intel.com Maciej Kwiek maciej@isovalent.com @@ -461,6 +469,7 @@ Marco Iorio marco.iorio@isovalent.com Marco Kilchhofer mkilchhofer@users.noreply.github.com Marc 'risson' Schmitt marc.schmitt@risson.space Marc Stulz m@footek.ch +Marc Suñé marc.sune@isovalent.com Marek Chodor mchodor@google.com Marga Manterola marga@isovalent.com Marino Wijay 45947861+distributethe6ix@users.noreply.github.com @@ -502,6 +511,7 @@ Michael Fischer fiscmi@amazon.com Michael Fornaro 20387402+xUnholy@users.noreply.github.com Michael Francis michael@melenion.com Michael Kashin mmkashin@gmail.com +Michael Mykhaylov 32168861+mikemykhaylov@users.noreply.github.com Michael Petrov michael@openai.com Michael Ryan Dempsey bluestealth@bluestealth.pw michaelsaah michael.saah@segment.com @@ -701,6 +711,7 @@ Sugang Li sugangli@google.com Sven Haardiek sven.haardiek@uni-muenster.de Swaminathan Vasudevan svasudevan@suse.com Taeung Song treeze.taeung@gmail.com +Taizeng Wu wutaizeng@gmail.com Takayoshi Nishida takayoshi.nishida@gmail.com Tamilmani tamanoha@microsoft.com Tam Mach tam.mach@cilium.io @@ -753,7 +764,7 @@ Viktor Kuzmin kvaster@gmail.com Viktor Oreshkin imselfish@stek29.rocks Ville Ojamo bluikko@users.noreply.github.com Vincent Li vincent.mc.li@gmail.com -Vipul Singh vipul21sept@gmail.com +Vipul Singh singhvipul@microsoft.com Vishal Choudhary sendtovishalchoudhary@gmail.com Vishnu Soman K vishnusomank05@gmail.com Vlad Artamonov 742047+vladdy@users.noreply.github.com diff --git a/vendor/github.com/cilium/cilium/api/v1/client/bgp/bgp_client.go b/vendor/github.com/cilium/cilium/api/v1/client/bgp/bgp_client.go deleted file mode 100644 index e7ee6fb08..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/bgp/bgp_client.go +++ /dev/null @@ -1,171 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package bgp - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// New creates a new bgp API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { - return &Client{transport: transport, formats: formats} -} - -/* -Client for bgp API -*/ -type Client struct { - transport runtime.ClientTransport - formats strfmt.Registry -} - -// ClientOption is the option for Client methods -type ClientOption func(*runtime.ClientOperation) - -// ClientService is the interface for Client methods -type ClientService interface { - GetBgpPeers(params *GetBgpPeersParams, opts ...ClientOption) (*GetBgpPeersOK, error) - - GetBgpRoutePolicies(params *GetBgpRoutePoliciesParams, opts ...ClientOption) (*GetBgpRoutePoliciesOK, error) - - GetBgpRoutes(params *GetBgpRoutesParams, opts ...ClientOption) (*GetBgpRoutesOK, error) - - SetTransport(transport runtime.ClientTransport) -} - -/* - GetBgpPeers lists operational state of b g p peers - - Retrieves current operational state of BGP peers created by - -Cilium BGP virtual router. This includes session state, uptime, -information per address family, etc. -*/ -func (a *Client) GetBgpPeers(params *GetBgpPeersParams, opts ...ClientOption) (*GetBgpPeersOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetBgpPeersParams() - } - op := &runtime.ClientOperation{ - ID: "GetBgpPeers", - Method: "GET", - PathPattern: "/bgp/peers", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetBgpPeersReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetBgpPeersOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetBgpPeers: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetBgpRoutePolicies lists b g p route policies configured in b g p control plane - -Retrieves route policies from BGP Control Plane. -*/ -func (a *Client) GetBgpRoutePolicies(params *GetBgpRoutePoliciesParams, opts ...ClientOption) (*GetBgpRoutePoliciesOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetBgpRoutePoliciesParams() - } - op := &runtime.ClientOperation{ - ID: "GetBgpRoutePolicies", - Method: "GET", - PathPattern: "/bgp/route-policies", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetBgpRoutePoliciesReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetBgpRoutePoliciesOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetBgpRoutePolicies: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetBgpRoutes lists b g p routes from b g p control plane r i b - -Retrieves routes from BGP Control Plane RIB filtered by parameters you specify -*/ -func (a *Client) GetBgpRoutes(params *GetBgpRoutesParams, opts ...ClientOption) (*GetBgpRoutesOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetBgpRoutesParams() - } - op := &runtime.ClientOperation{ - ID: "GetBgpRoutes", - Method: "GET", - PathPattern: "/bgp/routes", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetBgpRoutesReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetBgpRoutesOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetBgpRoutes: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -// SetTransport changes the transport on the client -func (a *Client) SetTransport(transport runtime.ClientTransport) { - a.transport = transport -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/bgp/get_bgp_peers_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/bgp/get_bgp_peers_parameters.go deleted file mode 100644 index 9b4fb3d7c..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/bgp/get_bgp_peers_parameters.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package bgp - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetBgpPeersParams creates a new GetBgpPeersParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetBgpPeersParams() *GetBgpPeersParams { - return &GetBgpPeersParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetBgpPeersParamsWithTimeout creates a new GetBgpPeersParams object -// with the ability to set a timeout on a request. -func NewGetBgpPeersParamsWithTimeout(timeout time.Duration) *GetBgpPeersParams { - return &GetBgpPeersParams{ - timeout: timeout, - } -} - -// NewGetBgpPeersParamsWithContext creates a new GetBgpPeersParams object -// with the ability to set a context for a request. -func NewGetBgpPeersParamsWithContext(ctx context.Context) *GetBgpPeersParams { - return &GetBgpPeersParams{ - Context: ctx, - } -} - -// NewGetBgpPeersParamsWithHTTPClient creates a new GetBgpPeersParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetBgpPeersParamsWithHTTPClient(client *http.Client) *GetBgpPeersParams { - return &GetBgpPeersParams{ - HTTPClient: client, - } -} - -/* -GetBgpPeersParams contains all the parameters to send to the API endpoint - - for the get bgp peers operation. - - Typically these are written to a http.Request. -*/ -type GetBgpPeersParams struct { - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get bgp peers params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetBgpPeersParams) WithDefaults() *GetBgpPeersParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get bgp peers params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetBgpPeersParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get bgp peers params -func (o *GetBgpPeersParams) WithTimeout(timeout time.Duration) *GetBgpPeersParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get bgp peers params -func (o *GetBgpPeersParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get bgp peers params -func (o *GetBgpPeersParams) WithContext(ctx context.Context) *GetBgpPeersParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get bgp peers params -func (o *GetBgpPeersParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get bgp peers params -func (o *GetBgpPeersParams) WithHTTPClient(client *http.Client) *GetBgpPeersParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get bgp peers params -func (o *GetBgpPeersParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *GetBgpPeersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/bgp/get_bgp_peers_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/bgp/get_bgp_peers_responses.go deleted file mode 100644 index ca1dfe0c6..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/bgp/get_bgp_peers_responses.go +++ /dev/null @@ -1,248 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package bgp - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetBgpPeersReader is a Reader for the GetBgpPeers structure. -type GetBgpPeersReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetBgpPeersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetBgpPeersOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 500: - result := NewGetBgpPeersInternalServerError() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 501: - result := NewGetBgpPeersDisabled() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /bgp/peers] GetBgpPeers", response, response.Code()) - } -} - -// NewGetBgpPeersOK creates a GetBgpPeersOK with default headers values -func NewGetBgpPeersOK() *GetBgpPeersOK { - return &GetBgpPeersOK{} -} - -/* -GetBgpPeersOK describes a response with status code 200, with default header values. - -Success -*/ -type GetBgpPeersOK struct { - Payload []*models.BgpPeer -} - -// IsSuccess returns true when this get bgp peers o k response has a 2xx status code -func (o *GetBgpPeersOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get bgp peers o k response has a 3xx status code -func (o *GetBgpPeersOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get bgp peers o k response has a 4xx status code -func (o *GetBgpPeersOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get bgp peers o k response has a 5xx status code -func (o *GetBgpPeersOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get bgp peers o k response a status code equal to that given -func (o *GetBgpPeersOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get bgp peers o k response -func (o *GetBgpPeersOK) Code() int { - return 200 -} - -func (o *GetBgpPeersOK) Error() string { - return fmt.Sprintf("[GET /bgp/peers][%d] getBgpPeersOK %+v", 200, o.Payload) -} - -func (o *GetBgpPeersOK) String() string { - return fmt.Sprintf("[GET /bgp/peers][%d] getBgpPeersOK %+v", 200, o.Payload) -} - -func (o *GetBgpPeersOK) GetPayload() []*models.BgpPeer { - return o.Payload -} - -func (o *GetBgpPeersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetBgpPeersInternalServerError creates a GetBgpPeersInternalServerError with default headers values -func NewGetBgpPeersInternalServerError() *GetBgpPeersInternalServerError { - return &GetBgpPeersInternalServerError{} -} - -/* -GetBgpPeersInternalServerError describes a response with status code 500, with default header values. - -Internal Server Error -*/ -type GetBgpPeersInternalServerError struct { - Payload models.Error -} - -// IsSuccess returns true when this get bgp peers internal server error response has a 2xx status code -func (o *GetBgpPeersInternalServerError) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get bgp peers internal server error response has a 3xx status code -func (o *GetBgpPeersInternalServerError) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get bgp peers internal server error response has a 4xx status code -func (o *GetBgpPeersInternalServerError) IsClientError() bool { - return false -} - -// IsServerError returns true when this get bgp peers internal server error response has a 5xx status code -func (o *GetBgpPeersInternalServerError) IsServerError() bool { - return true -} - -// IsCode returns true when this get bgp peers internal server error response a status code equal to that given -func (o *GetBgpPeersInternalServerError) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the get bgp peers internal server error response -func (o *GetBgpPeersInternalServerError) Code() int { - return 500 -} - -func (o *GetBgpPeersInternalServerError) Error() string { - return fmt.Sprintf("[GET /bgp/peers][%d] getBgpPeersInternalServerError %+v", 500, o.Payload) -} - -func (o *GetBgpPeersInternalServerError) String() string { - return fmt.Sprintf("[GET /bgp/peers][%d] getBgpPeersInternalServerError %+v", 500, o.Payload) -} - -func (o *GetBgpPeersInternalServerError) GetPayload() models.Error { - return o.Payload -} - -func (o *GetBgpPeersInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetBgpPeersDisabled creates a GetBgpPeersDisabled with default headers values -func NewGetBgpPeersDisabled() *GetBgpPeersDisabled { - return &GetBgpPeersDisabled{} -} - -/* -GetBgpPeersDisabled describes a response with status code 501, with default header values. - -BGP Control Plane disabled -*/ -type GetBgpPeersDisabled struct { - Payload models.Error -} - -// IsSuccess returns true when this get bgp peers disabled response has a 2xx status code -func (o *GetBgpPeersDisabled) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get bgp peers disabled response has a 3xx status code -func (o *GetBgpPeersDisabled) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get bgp peers disabled response has a 4xx status code -func (o *GetBgpPeersDisabled) IsClientError() bool { - return false -} - -// IsServerError returns true when this get bgp peers disabled response has a 5xx status code -func (o *GetBgpPeersDisabled) IsServerError() bool { - return true -} - -// IsCode returns true when this get bgp peers disabled response a status code equal to that given -func (o *GetBgpPeersDisabled) IsCode(code int) bool { - return code == 501 -} - -// Code gets the status code for the get bgp peers disabled response -func (o *GetBgpPeersDisabled) Code() int { - return 501 -} - -func (o *GetBgpPeersDisabled) Error() string { - return fmt.Sprintf("[GET /bgp/peers][%d] getBgpPeersDisabled %+v", 501, o.Payload) -} - -func (o *GetBgpPeersDisabled) String() string { - return fmt.Sprintf("[GET /bgp/peers][%d] getBgpPeersDisabled %+v", 501, o.Payload) -} - -func (o *GetBgpPeersDisabled) GetPayload() models.Error { - return o.Payload -} - -func (o *GetBgpPeersDisabled) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/bgp/get_bgp_route_policies_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/bgp/get_bgp_route_policies_parameters.go deleted file mode 100644 index db2421c1a..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/bgp/get_bgp_route_policies_parameters.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package bgp - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetBgpRoutePoliciesParams creates a new GetBgpRoutePoliciesParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetBgpRoutePoliciesParams() *GetBgpRoutePoliciesParams { - return &GetBgpRoutePoliciesParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetBgpRoutePoliciesParamsWithTimeout creates a new GetBgpRoutePoliciesParams object -// with the ability to set a timeout on a request. -func NewGetBgpRoutePoliciesParamsWithTimeout(timeout time.Duration) *GetBgpRoutePoliciesParams { - return &GetBgpRoutePoliciesParams{ - timeout: timeout, - } -} - -// NewGetBgpRoutePoliciesParamsWithContext creates a new GetBgpRoutePoliciesParams object -// with the ability to set a context for a request. -func NewGetBgpRoutePoliciesParamsWithContext(ctx context.Context) *GetBgpRoutePoliciesParams { - return &GetBgpRoutePoliciesParams{ - Context: ctx, - } -} - -// NewGetBgpRoutePoliciesParamsWithHTTPClient creates a new GetBgpRoutePoliciesParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetBgpRoutePoliciesParamsWithHTTPClient(client *http.Client) *GetBgpRoutePoliciesParams { - return &GetBgpRoutePoliciesParams{ - HTTPClient: client, - } -} - -/* -GetBgpRoutePoliciesParams contains all the parameters to send to the API endpoint - - for the get bgp route policies operation. - - Typically these are written to a http.Request. -*/ -type GetBgpRoutePoliciesParams struct { - - /* RouterAsn. - - Autonomous System Number (ASN) identifying a BGP virtual router instance. - If not specified, all virtual router instances are selected. - - */ - RouterAsn *int64 - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get bgp route policies params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetBgpRoutePoliciesParams) WithDefaults() *GetBgpRoutePoliciesParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get bgp route policies params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetBgpRoutePoliciesParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get bgp route policies params -func (o *GetBgpRoutePoliciesParams) WithTimeout(timeout time.Duration) *GetBgpRoutePoliciesParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get bgp route policies params -func (o *GetBgpRoutePoliciesParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get bgp route policies params -func (o *GetBgpRoutePoliciesParams) WithContext(ctx context.Context) *GetBgpRoutePoliciesParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get bgp route policies params -func (o *GetBgpRoutePoliciesParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get bgp route policies params -func (o *GetBgpRoutePoliciesParams) WithHTTPClient(client *http.Client) *GetBgpRoutePoliciesParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get bgp route policies params -func (o *GetBgpRoutePoliciesParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithRouterAsn adds the routerAsn to the get bgp route policies params -func (o *GetBgpRoutePoliciesParams) WithRouterAsn(routerAsn *int64) *GetBgpRoutePoliciesParams { - o.SetRouterAsn(routerAsn) - return o -} - -// SetRouterAsn adds the routerAsn to the get bgp route policies params -func (o *GetBgpRoutePoliciesParams) SetRouterAsn(routerAsn *int64) { - o.RouterAsn = routerAsn -} - -// WriteToRequest writes these params to a swagger request -func (o *GetBgpRoutePoliciesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if o.RouterAsn != nil { - - // query param router_asn - var qrRouterAsn int64 - - if o.RouterAsn != nil { - qrRouterAsn = *o.RouterAsn - } - qRouterAsn := swag.FormatInt64(qrRouterAsn) - if qRouterAsn != "" { - - if err := r.SetQueryParam("router_asn", qRouterAsn); err != nil { - return err - } - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/bgp/get_bgp_route_policies_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/bgp/get_bgp_route_policies_responses.go deleted file mode 100644 index e5f5bc74f..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/bgp/get_bgp_route_policies_responses.go +++ /dev/null @@ -1,248 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package bgp - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetBgpRoutePoliciesReader is a Reader for the GetBgpRoutePolicies structure. -type GetBgpRoutePoliciesReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetBgpRoutePoliciesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetBgpRoutePoliciesOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 500: - result := NewGetBgpRoutePoliciesInternalServerError() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 501: - result := NewGetBgpRoutePoliciesDisabled() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /bgp/route-policies] GetBgpRoutePolicies", response, response.Code()) - } -} - -// NewGetBgpRoutePoliciesOK creates a GetBgpRoutePoliciesOK with default headers values -func NewGetBgpRoutePoliciesOK() *GetBgpRoutePoliciesOK { - return &GetBgpRoutePoliciesOK{} -} - -/* -GetBgpRoutePoliciesOK describes a response with status code 200, with default header values. - -Success -*/ -type GetBgpRoutePoliciesOK struct { - Payload []*models.BgpRoutePolicy -} - -// IsSuccess returns true when this get bgp route policies o k response has a 2xx status code -func (o *GetBgpRoutePoliciesOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get bgp route policies o k response has a 3xx status code -func (o *GetBgpRoutePoliciesOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get bgp route policies o k response has a 4xx status code -func (o *GetBgpRoutePoliciesOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get bgp route policies o k response has a 5xx status code -func (o *GetBgpRoutePoliciesOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get bgp route policies o k response a status code equal to that given -func (o *GetBgpRoutePoliciesOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get bgp route policies o k response -func (o *GetBgpRoutePoliciesOK) Code() int { - return 200 -} - -func (o *GetBgpRoutePoliciesOK) Error() string { - return fmt.Sprintf("[GET /bgp/route-policies][%d] getBgpRoutePoliciesOK %+v", 200, o.Payload) -} - -func (o *GetBgpRoutePoliciesOK) String() string { - return fmt.Sprintf("[GET /bgp/route-policies][%d] getBgpRoutePoliciesOK %+v", 200, o.Payload) -} - -func (o *GetBgpRoutePoliciesOK) GetPayload() []*models.BgpRoutePolicy { - return o.Payload -} - -func (o *GetBgpRoutePoliciesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetBgpRoutePoliciesInternalServerError creates a GetBgpRoutePoliciesInternalServerError with default headers values -func NewGetBgpRoutePoliciesInternalServerError() *GetBgpRoutePoliciesInternalServerError { - return &GetBgpRoutePoliciesInternalServerError{} -} - -/* -GetBgpRoutePoliciesInternalServerError describes a response with status code 500, with default header values. - -Internal Server Error -*/ -type GetBgpRoutePoliciesInternalServerError struct { - Payload models.Error -} - -// IsSuccess returns true when this get bgp route policies internal server error response has a 2xx status code -func (o *GetBgpRoutePoliciesInternalServerError) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get bgp route policies internal server error response has a 3xx status code -func (o *GetBgpRoutePoliciesInternalServerError) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get bgp route policies internal server error response has a 4xx status code -func (o *GetBgpRoutePoliciesInternalServerError) IsClientError() bool { - return false -} - -// IsServerError returns true when this get bgp route policies internal server error response has a 5xx status code -func (o *GetBgpRoutePoliciesInternalServerError) IsServerError() bool { - return true -} - -// IsCode returns true when this get bgp route policies internal server error response a status code equal to that given -func (o *GetBgpRoutePoliciesInternalServerError) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the get bgp route policies internal server error response -func (o *GetBgpRoutePoliciesInternalServerError) Code() int { - return 500 -} - -func (o *GetBgpRoutePoliciesInternalServerError) Error() string { - return fmt.Sprintf("[GET /bgp/route-policies][%d] getBgpRoutePoliciesInternalServerError %+v", 500, o.Payload) -} - -func (o *GetBgpRoutePoliciesInternalServerError) String() string { - return fmt.Sprintf("[GET /bgp/route-policies][%d] getBgpRoutePoliciesInternalServerError %+v", 500, o.Payload) -} - -func (o *GetBgpRoutePoliciesInternalServerError) GetPayload() models.Error { - return o.Payload -} - -func (o *GetBgpRoutePoliciesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetBgpRoutePoliciesDisabled creates a GetBgpRoutePoliciesDisabled with default headers values -func NewGetBgpRoutePoliciesDisabled() *GetBgpRoutePoliciesDisabled { - return &GetBgpRoutePoliciesDisabled{} -} - -/* -GetBgpRoutePoliciesDisabled describes a response with status code 501, with default header values. - -BGP Control Plane disabled -*/ -type GetBgpRoutePoliciesDisabled struct { - Payload models.Error -} - -// IsSuccess returns true when this get bgp route policies disabled response has a 2xx status code -func (o *GetBgpRoutePoliciesDisabled) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get bgp route policies disabled response has a 3xx status code -func (o *GetBgpRoutePoliciesDisabled) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get bgp route policies disabled response has a 4xx status code -func (o *GetBgpRoutePoliciesDisabled) IsClientError() bool { - return false -} - -// IsServerError returns true when this get bgp route policies disabled response has a 5xx status code -func (o *GetBgpRoutePoliciesDisabled) IsServerError() bool { - return true -} - -// IsCode returns true when this get bgp route policies disabled response a status code equal to that given -func (o *GetBgpRoutePoliciesDisabled) IsCode(code int) bool { - return code == 501 -} - -// Code gets the status code for the get bgp route policies disabled response -func (o *GetBgpRoutePoliciesDisabled) Code() int { - return 501 -} - -func (o *GetBgpRoutePoliciesDisabled) Error() string { - return fmt.Sprintf("[GET /bgp/route-policies][%d] getBgpRoutePoliciesDisabled %+v", 501, o.Payload) -} - -func (o *GetBgpRoutePoliciesDisabled) String() string { - return fmt.Sprintf("[GET /bgp/route-policies][%d] getBgpRoutePoliciesDisabled %+v", 501, o.Payload) -} - -func (o *GetBgpRoutePoliciesDisabled) GetPayload() models.Error { - return o.Payload -} - -func (o *GetBgpRoutePoliciesDisabled) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/bgp/get_bgp_routes_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/bgp/get_bgp_routes_parameters.go deleted file mode 100644 index 9fa279b03..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/bgp/get_bgp_routes_parameters.go +++ /dev/null @@ -1,286 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package bgp - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetBgpRoutesParams creates a new GetBgpRoutesParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetBgpRoutesParams() *GetBgpRoutesParams { - return &GetBgpRoutesParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetBgpRoutesParamsWithTimeout creates a new GetBgpRoutesParams object -// with the ability to set a timeout on a request. -func NewGetBgpRoutesParamsWithTimeout(timeout time.Duration) *GetBgpRoutesParams { - return &GetBgpRoutesParams{ - timeout: timeout, - } -} - -// NewGetBgpRoutesParamsWithContext creates a new GetBgpRoutesParams object -// with the ability to set a context for a request. -func NewGetBgpRoutesParamsWithContext(ctx context.Context) *GetBgpRoutesParams { - return &GetBgpRoutesParams{ - Context: ctx, - } -} - -// NewGetBgpRoutesParamsWithHTTPClient creates a new GetBgpRoutesParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetBgpRoutesParamsWithHTTPClient(client *http.Client) *GetBgpRoutesParams { - return &GetBgpRoutesParams{ - HTTPClient: client, - } -} - -/* -GetBgpRoutesParams contains all the parameters to send to the API endpoint - - for the get bgp routes operation. - - Typically these are written to a http.Request. -*/ -type GetBgpRoutesParams struct { - - /* Afi. - - Address Family Indicator (AFI) of a BGP route - */ - Afi string - - /* Neighbor. - - IP address specifying a BGP neighbor. - Has to be specified only when table type is adj-rib-in or adj-rib-out. - - */ - Neighbor *string - - /* RouterAsn. - - Autonomous System Number (ASN) identifying a BGP virtual router instance. - If not specified, all virtual router instances are selected. - - */ - RouterAsn *int64 - - /* Safi. - - Subsequent Address Family Indicator (SAFI) of a BGP route - */ - Safi string - - /* TableType. - - BGP Routing Information Base (RIB) table type - */ - TableType string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get bgp routes params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetBgpRoutesParams) WithDefaults() *GetBgpRoutesParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get bgp routes params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetBgpRoutesParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get bgp routes params -func (o *GetBgpRoutesParams) WithTimeout(timeout time.Duration) *GetBgpRoutesParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get bgp routes params -func (o *GetBgpRoutesParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get bgp routes params -func (o *GetBgpRoutesParams) WithContext(ctx context.Context) *GetBgpRoutesParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get bgp routes params -func (o *GetBgpRoutesParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get bgp routes params -func (o *GetBgpRoutesParams) WithHTTPClient(client *http.Client) *GetBgpRoutesParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get bgp routes params -func (o *GetBgpRoutesParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithAfi adds the afi to the get bgp routes params -func (o *GetBgpRoutesParams) WithAfi(afi string) *GetBgpRoutesParams { - o.SetAfi(afi) - return o -} - -// SetAfi adds the afi to the get bgp routes params -func (o *GetBgpRoutesParams) SetAfi(afi string) { - o.Afi = afi -} - -// WithNeighbor adds the neighbor to the get bgp routes params -func (o *GetBgpRoutesParams) WithNeighbor(neighbor *string) *GetBgpRoutesParams { - o.SetNeighbor(neighbor) - return o -} - -// SetNeighbor adds the neighbor to the get bgp routes params -func (o *GetBgpRoutesParams) SetNeighbor(neighbor *string) { - o.Neighbor = neighbor -} - -// WithRouterAsn adds the routerAsn to the get bgp routes params -func (o *GetBgpRoutesParams) WithRouterAsn(routerAsn *int64) *GetBgpRoutesParams { - o.SetRouterAsn(routerAsn) - return o -} - -// SetRouterAsn adds the routerAsn to the get bgp routes params -func (o *GetBgpRoutesParams) SetRouterAsn(routerAsn *int64) { - o.RouterAsn = routerAsn -} - -// WithSafi adds the safi to the get bgp routes params -func (o *GetBgpRoutesParams) WithSafi(safi string) *GetBgpRoutesParams { - o.SetSafi(safi) - return o -} - -// SetSafi adds the safi to the get bgp routes params -func (o *GetBgpRoutesParams) SetSafi(safi string) { - o.Safi = safi -} - -// WithTableType adds the tableType to the get bgp routes params -func (o *GetBgpRoutesParams) WithTableType(tableType string) *GetBgpRoutesParams { - o.SetTableType(tableType) - return o -} - -// SetTableType adds the tableType to the get bgp routes params -func (o *GetBgpRoutesParams) SetTableType(tableType string) { - o.TableType = tableType -} - -// WriteToRequest writes these params to a swagger request -func (o *GetBgpRoutesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - // query param afi - qrAfi := o.Afi - qAfi := qrAfi - if qAfi != "" { - - if err := r.SetQueryParam("afi", qAfi); err != nil { - return err - } - } - - if o.Neighbor != nil { - - // query param neighbor - var qrNeighbor string - - if o.Neighbor != nil { - qrNeighbor = *o.Neighbor - } - qNeighbor := qrNeighbor - if qNeighbor != "" { - - if err := r.SetQueryParam("neighbor", qNeighbor); err != nil { - return err - } - } - } - - if o.RouterAsn != nil { - - // query param router_asn - var qrRouterAsn int64 - - if o.RouterAsn != nil { - qrRouterAsn = *o.RouterAsn - } - qRouterAsn := swag.FormatInt64(qrRouterAsn) - if qRouterAsn != "" { - - if err := r.SetQueryParam("router_asn", qRouterAsn); err != nil { - return err - } - } - } - - // query param safi - qrSafi := o.Safi - qSafi := qrSafi - if qSafi != "" { - - if err := r.SetQueryParam("safi", qSafi); err != nil { - return err - } - } - - // query param table_type - qrTableType := o.TableType - qTableType := qrTableType - if qTableType != "" { - - if err := r.SetQueryParam("table_type", qTableType); err != nil { - return err - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/bgp/get_bgp_routes_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/bgp/get_bgp_routes_responses.go deleted file mode 100644 index 9391a46f6..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/bgp/get_bgp_routes_responses.go +++ /dev/null @@ -1,248 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package bgp - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetBgpRoutesReader is a Reader for the GetBgpRoutes structure. -type GetBgpRoutesReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetBgpRoutesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetBgpRoutesOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 500: - result := NewGetBgpRoutesInternalServerError() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 501: - result := NewGetBgpRoutesDisabled() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /bgp/routes] GetBgpRoutes", response, response.Code()) - } -} - -// NewGetBgpRoutesOK creates a GetBgpRoutesOK with default headers values -func NewGetBgpRoutesOK() *GetBgpRoutesOK { - return &GetBgpRoutesOK{} -} - -/* -GetBgpRoutesOK describes a response with status code 200, with default header values. - -Success -*/ -type GetBgpRoutesOK struct { - Payload []*models.BgpRoute -} - -// IsSuccess returns true when this get bgp routes o k response has a 2xx status code -func (o *GetBgpRoutesOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get bgp routes o k response has a 3xx status code -func (o *GetBgpRoutesOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get bgp routes o k response has a 4xx status code -func (o *GetBgpRoutesOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get bgp routes o k response has a 5xx status code -func (o *GetBgpRoutesOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get bgp routes o k response a status code equal to that given -func (o *GetBgpRoutesOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get bgp routes o k response -func (o *GetBgpRoutesOK) Code() int { - return 200 -} - -func (o *GetBgpRoutesOK) Error() string { - return fmt.Sprintf("[GET /bgp/routes][%d] getBgpRoutesOK %+v", 200, o.Payload) -} - -func (o *GetBgpRoutesOK) String() string { - return fmt.Sprintf("[GET /bgp/routes][%d] getBgpRoutesOK %+v", 200, o.Payload) -} - -func (o *GetBgpRoutesOK) GetPayload() []*models.BgpRoute { - return o.Payload -} - -func (o *GetBgpRoutesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetBgpRoutesInternalServerError creates a GetBgpRoutesInternalServerError with default headers values -func NewGetBgpRoutesInternalServerError() *GetBgpRoutesInternalServerError { - return &GetBgpRoutesInternalServerError{} -} - -/* -GetBgpRoutesInternalServerError describes a response with status code 500, with default header values. - -Internal Server Error -*/ -type GetBgpRoutesInternalServerError struct { - Payload models.Error -} - -// IsSuccess returns true when this get bgp routes internal server error response has a 2xx status code -func (o *GetBgpRoutesInternalServerError) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get bgp routes internal server error response has a 3xx status code -func (o *GetBgpRoutesInternalServerError) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get bgp routes internal server error response has a 4xx status code -func (o *GetBgpRoutesInternalServerError) IsClientError() bool { - return false -} - -// IsServerError returns true when this get bgp routes internal server error response has a 5xx status code -func (o *GetBgpRoutesInternalServerError) IsServerError() bool { - return true -} - -// IsCode returns true when this get bgp routes internal server error response a status code equal to that given -func (o *GetBgpRoutesInternalServerError) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the get bgp routes internal server error response -func (o *GetBgpRoutesInternalServerError) Code() int { - return 500 -} - -func (o *GetBgpRoutesInternalServerError) Error() string { - return fmt.Sprintf("[GET /bgp/routes][%d] getBgpRoutesInternalServerError %+v", 500, o.Payload) -} - -func (o *GetBgpRoutesInternalServerError) String() string { - return fmt.Sprintf("[GET /bgp/routes][%d] getBgpRoutesInternalServerError %+v", 500, o.Payload) -} - -func (o *GetBgpRoutesInternalServerError) GetPayload() models.Error { - return o.Payload -} - -func (o *GetBgpRoutesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetBgpRoutesDisabled creates a GetBgpRoutesDisabled with default headers values -func NewGetBgpRoutesDisabled() *GetBgpRoutesDisabled { - return &GetBgpRoutesDisabled{} -} - -/* -GetBgpRoutesDisabled describes a response with status code 501, with default header values. - -BGP Control Plane disabled -*/ -type GetBgpRoutesDisabled struct { - Payload models.Error -} - -// IsSuccess returns true when this get bgp routes disabled response has a 2xx status code -func (o *GetBgpRoutesDisabled) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get bgp routes disabled response has a 3xx status code -func (o *GetBgpRoutesDisabled) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get bgp routes disabled response has a 4xx status code -func (o *GetBgpRoutesDisabled) IsClientError() bool { - return false -} - -// IsServerError returns true when this get bgp routes disabled response has a 5xx status code -func (o *GetBgpRoutesDisabled) IsServerError() bool { - return true -} - -// IsCode returns true when this get bgp routes disabled response a status code equal to that given -func (o *GetBgpRoutesDisabled) IsCode(code int) bool { - return code == 501 -} - -// Code gets the status code for the get bgp routes disabled response -func (o *GetBgpRoutesDisabled) Code() int { - return 501 -} - -func (o *GetBgpRoutesDisabled) Error() string { - return fmt.Sprintf("[GET /bgp/routes][%d] getBgpRoutesDisabled %+v", 501, o.Payload) -} - -func (o *GetBgpRoutesDisabled) String() string { - return fmt.Sprintf("[GET /bgp/routes][%d] getBgpRoutesDisabled %+v", 501, o.Payload) -} - -func (o *GetBgpRoutesDisabled) GetPayload() models.Error { - return o.Payload -} - -func (o *GetBgpRoutesDisabled) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/cilium_api_client.go b/vendor/github.com/cilium/cilium/api/v1/client/cilium_api_client.go deleted file mode 100644 index 109454afa..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/cilium_api_client.go +++ /dev/null @@ -1,160 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package client - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "github.com/go-openapi/runtime" - httptransport "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/client/bgp" - "github.com/cilium/cilium/api/v1/client/daemon" - "github.com/cilium/cilium/api/v1/client/endpoint" - "github.com/cilium/cilium/api/v1/client/ipam" - "github.com/cilium/cilium/api/v1/client/metrics" - "github.com/cilium/cilium/api/v1/client/policy" - "github.com/cilium/cilium/api/v1/client/prefilter" - "github.com/cilium/cilium/api/v1/client/recorder" - "github.com/cilium/cilium/api/v1/client/service" - "github.com/cilium/cilium/api/v1/client/statedb" -) - -// Default cilium API HTTP client. -var Default = NewHTTPClient(nil) - -const ( - // DefaultHost is the default Host - // found in Meta (info) section of spec file - DefaultHost string = "localhost" - // DefaultBasePath is the default BasePath - // found in Meta (info) section of spec file - DefaultBasePath string = "/v1" -) - -// DefaultSchemes are the default schemes found in Meta (info) section of spec file -var DefaultSchemes = []string{"http"} - -// NewHTTPClient creates a new cilium API HTTP client. -func NewHTTPClient(formats strfmt.Registry) *CiliumAPI { - return NewHTTPClientWithConfig(formats, nil) -} - -// NewHTTPClientWithConfig creates a new cilium API HTTP client, -// using a customizable transport config. -func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *CiliumAPI { - // ensure nullable parameters have default - if cfg == nil { - cfg = DefaultTransportConfig() - } - - // create transport and client - transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes) - return New(transport, formats) -} - -// New creates a new cilium API client -func New(transport runtime.ClientTransport, formats strfmt.Registry) *CiliumAPI { - // ensure nullable parameters have default - if formats == nil { - formats = strfmt.Default - } - - cli := new(CiliumAPI) - cli.Transport = transport - cli.Bgp = bgp.New(transport, formats) - cli.Daemon = daemon.New(transport, formats) - cli.Endpoint = endpoint.New(transport, formats) - cli.Ipam = ipam.New(transport, formats) - cli.Metrics = metrics.New(transport, formats) - cli.Policy = policy.New(transport, formats) - cli.Prefilter = prefilter.New(transport, formats) - cli.Recorder = recorder.New(transport, formats) - cli.Service = service.New(transport, formats) - cli.Statedb = statedb.New(transport, formats) - return cli -} - -// DefaultTransportConfig creates a TransportConfig with the -// default settings taken from the meta section of the spec file. -func DefaultTransportConfig() *TransportConfig { - return &TransportConfig{ - Host: DefaultHost, - BasePath: DefaultBasePath, - Schemes: DefaultSchemes, - } -} - -// TransportConfig contains the transport related info, -// found in the meta section of the spec file. -type TransportConfig struct { - Host string - BasePath string - Schemes []string -} - -// WithHost overrides the default host, -// provided by the meta section of the spec file. -func (cfg *TransportConfig) WithHost(host string) *TransportConfig { - cfg.Host = host - return cfg -} - -// WithBasePath overrides the default basePath, -// provided by the meta section of the spec file. -func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig { - cfg.BasePath = basePath - return cfg -} - -// WithSchemes overrides the default schemes, -// provided by the meta section of the spec file. -func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { - cfg.Schemes = schemes - return cfg -} - -// CiliumAPI is a client for cilium API -type CiliumAPI struct { - Bgp bgp.ClientService - - Daemon daemon.ClientService - - Endpoint endpoint.ClientService - - Ipam ipam.ClientService - - Metrics metrics.ClientService - - Policy policy.ClientService - - Prefilter prefilter.ClientService - - Recorder recorder.ClientService - - Service service.ClientService - - Statedb statedb.ClientService - - Transport runtime.ClientTransport -} - -// SetTransport changes the transport on the client and all its subresources -func (c *CiliumAPI) SetTransport(transport runtime.ClientTransport) { - c.Transport = transport - c.Bgp.SetTransport(transport) - c.Daemon.SetTransport(transport) - c.Endpoint.SetTransport(transport) - c.Ipam.SetTransport(transport) - c.Metrics.SetTransport(transport) - c.Policy.SetTransport(transport) - c.Prefilter.SetTransport(transport) - c.Recorder.SetTransport(transport) - c.Service.SetTransport(transport) - c.Statedb.SetTransport(transport) -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/daemon/daemon_client.go b/vendor/github.com/cilium/cilium/api/v1/client/daemon/daemon_client.go deleted file mode 100644 index a633fd7cb..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/daemon/daemon_client.go +++ /dev/null @@ -1,459 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package daemon - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// New creates a new daemon API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { - return &Client{transport: transport, formats: formats} -} - -/* -Client for daemon API -*/ -type Client struct { - transport runtime.ClientTransport - formats strfmt.Registry -} - -// ClientOption is the option for Client methods -type ClientOption func(*runtime.ClientOperation) - -// ClientService is the interface for Client methods -type ClientService interface { - GetCgroupDumpMetadata(params *GetCgroupDumpMetadataParams, opts ...ClientOption) (*GetCgroupDumpMetadataOK, error) - - GetClusterNodes(params *GetClusterNodesParams, opts ...ClientOption) (*GetClusterNodesOK, error) - - GetConfig(params *GetConfigParams, opts ...ClientOption) (*GetConfigOK, error) - - GetDebuginfo(params *GetDebuginfoParams, opts ...ClientOption) (*GetDebuginfoOK, error) - - GetHealthz(params *GetHealthzParams, opts ...ClientOption) (*GetHealthzOK, error) - - GetMap(params *GetMapParams, opts ...ClientOption) (*GetMapOK, error) - - GetMapName(params *GetMapNameParams, opts ...ClientOption) (*GetMapNameOK, error) - - GetMapNameEvents(params *GetMapNameEventsParams, writer io.Writer, opts ...ClientOption) (*GetMapNameEventsOK, error) - - GetNodeIds(params *GetNodeIdsParams, opts ...ClientOption) (*GetNodeIdsOK, error) - - PatchConfig(params *PatchConfigParams, opts ...ClientOption) (*PatchConfigOK, error) - - SetTransport(transport runtime.ClientTransport) -} - -/* -GetCgroupDumpMetadata retrieves cgroup metadata for all pods -*/ -func (a *Client) GetCgroupDumpMetadata(params *GetCgroupDumpMetadataParams, opts ...ClientOption) (*GetCgroupDumpMetadataOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetCgroupDumpMetadataParams() - } - op := &runtime.ClientOperation{ - ID: "GetCgroupDumpMetadata", - Method: "GET", - PathPattern: "/cgroup-dump-metadata", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetCgroupDumpMetadataReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetCgroupDumpMetadataOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetCgroupDumpMetadata: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetClusterNodes gets nodes information stored in the cilium agent -*/ -func (a *Client) GetClusterNodes(params *GetClusterNodesParams, opts ...ClientOption) (*GetClusterNodesOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetClusterNodesParams() - } - op := &runtime.ClientOperation{ - ID: "GetClusterNodes", - Method: "GET", - PathPattern: "/cluster/nodes", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetClusterNodesReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetClusterNodesOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetClusterNodes: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetConfig gets configuration of cilium daemon - -Returns the configuration of the Cilium daemon. -*/ -func (a *Client) GetConfig(params *GetConfigParams, opts ...ClientOption) (*GetConfigOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetConfigParams() - } - op := &runtime.ClientOperation{ - ID: "GetConfig", - Method: "GET", - PathPattern: "/config", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetConfigReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetConfigOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetConfig: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetDebuginfo retrieves information about the agent and environment for debugging -*/ -func (a *Client) GetDebuginfo(params *GetDebuginfoParams, opts ...ClientOption) (*GetDebuginfoOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetDebuginfoParams() - } - op := &runtime.ClientOperation{ - ID: "GetDebuginfo", - Method: "GET", - PathPattern: "/debuginfo", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetDebuginfoReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetDebuginfoOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetDebuginfo: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* - GetHealthz gets health of cilium daemon - - Returns health and status information of the Cilium daemon and related - -components such as the local container runtime, connected datastore, -Kubernetes integration and Hubble. -*/ -func (a *Client) GetHealthz(params *GetHealthzParams, opts ...ClientOption) (*GetHealthzOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetHealthzParams() - } - op := &runtime.ClientOperation{ - ID: "GetHealthz", - Method: "GET", - PathPattern: "/healthz", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetHealthzReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetHealthzOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetHealthz: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetMap lists all open maps -*/ -func (a *Client) GetMap(params *GetMapParams, opts ...ClientOption) (*GetMapOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetMapParams() - } - op := &runtime.ClientOperation{ - ID: "GetMap", - Method: "GET", - PathPattern: "/map", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetMapReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetMapOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetMap: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetMapName retrieves contents of b p f map -*/ -func (a *Client) GetMapName(params *GetMapNameParams, opts ...ClientOption) (*GetMapNameOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetMapNameParams() - } - op := &runtime.ClientOperation{ - ID: "GetMapName", - Method: "GET", - PathPattern: "/map/{name}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetMapNameReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetMapNameOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetMapName: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetMapNameEvents retrieves the recent event logs associated with this endpoint -*/ -func (a *Client) GetMapNameEvents(params *GetMapNameEventsParams, writer io.Writer, opts ...ClientOption) (*GetMapNameEventsOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetMapNameEventsParams() - } - op := &runtime.ClientOperation{ - ID: "GetMapNameEvents", - Method: "GET", - PathPattern: "/map/{name}/events", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetMapNameEventsReader{formats: a.formats, writer: writer}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetMapNameEventsOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetMapNameEvents: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* - GetNodeIds lists information about known node i ds - - Retrieves a list of node IDs allocated by the agent and their - -associated node IP addresses. -*/ -func (a *Client) GetNodeIds(params *GetNodeIdsParams, opts ...ClientOption) (*GetNodeIdsOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetNodeIdsParams() - } - op := &runtime.ClientOperation{ - ID: "GetNodeIds", - Method: "GET", - PathPattern: "/node/ids", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetNodeIdsReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetNodeIdsOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetNodeIds: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* - PatchConfig modifies daemon configuration - - Updates the daemon configuration by applying the provided - -ConfigurationMap and regenerates & recompiles all required datapath -components. -*/ -func (a *Client) PatchConfig(params *PatchConfigParams, opts ...ClientOption) (*PatchConfigOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPatchConfigParams() - } - op := &runtime.ClientOperation{ - ID: "PatchConfig", - Method: "PATCH", - PathPattern: "/config", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PatchConfigReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*PatchConfigOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PatchConfig: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -// SetTransport changes the transport on the client -func (a *Client) SetTransport(transport runtime.ClientTransport) { - a.transport = transport -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_cgroup_dump_metadata_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_cgroup_dump_metadata_parameters.go deleted file mode 100644 index 70b51046c..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_cgroup_dump_metadata_parameters.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package daemon - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetCgroupDumpMetadataParams creates a new GetCgroupDumpMetadataParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetCgroupDumpMetadataParams() *GetCgroupDumpMetadataParams { - return &GetCgroupDumpMetadataParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetCgroupDumpMetadataParamsWithTimeout creates a new GetCgroupDumpMetadataParams object -// with the ability to set a timeout on a request. -func NewGetCgroupDumpMetadataParamsWithTimeout(timeout time.Duration) *GetCgroupDumpMetadataParams { - return &GetCgroupDumpMetadataParams{ - timeout: timeout, - } -} - -// NewGetCgroupDumpMetadataParamsWithContext creates a new GetCgroupDumpMetadataParams object -// with the ability to set a context for a request. -func NewGetCgroupDumpMetadataParamsWithContext(ctx context.Context) *GetCgroupDumpMetadataParams { - return &GetCgroupDumpMetadataParams{ - Context: ctx, - } -} - -// NewGetCgroupDumpMetadataParamsWithHTTPClient creates a new GetCgroupDumpMetadataParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetCgroupDumpMetadataParamsWithHTTPClient(client *http.Client) *GetCgroupDumpMetadataParams { - return &GetCgroupDumpMetadataParams{ - HTTPClient: client, - } -} - -/* -GetCgroupDumpMetadataParams contains all the parameters to send to the API endpoint - - for the get cgroup dump metadata operation. - - Typically these are written to a http.Request. -*/ -type GetCgroupDumpMetadataParams struct { - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get cgroup dump metadata params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetCgroupDumpMetadataParams) WithDefaults() *GetCgroupDumpMetadataParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get cgroup dump metadata params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetCgroupDumpMetadataParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get cgroup dump metadata params -func (o *GetCgroupDumpMetadataParams) WithTimeout(timeout time.Duration) *GetCgroupDumpMetadataParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get cgroup dump metadata params -func (o *GetCgroupDumpMetadataParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get cgroup dump metadata params -func (o *GetCgroupDumpMetadataParams) WithContext(ctx context.Context) *GetCgroupDumpMetadataParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get cgroup dump metadata params -func (o *GetCgroupDumpMetadataParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get cgroup dump metadata params -func (o *GetCgroupDumpMetadataParams) WithHTTPClient(client *http.Client) *GetCgroupDumpMetadataParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get cgroup dump metadata params -func (o *GetCgroupDumpMetadataParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *GetCgroupDumpMetadataParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_cgroup_dump_metadata_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_cgroup_dump_metadata_responses.go deleted file mode 100644 index 3130b50ff..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_cgroup_dump_metadata_responses.go +++ /dev/null @@ -1,178 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package daemon - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetCgroupDumpMetadataReader is a Reader for the GetCgroupDumpMetadata structure. -type GetCgroupDumpMetadataReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetCgroupDumpMetadataReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetCgroupDumpMetadataOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 500: - result := NewGetCgroupDumpMetadataFailure() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /cgroup-dump-metadata] GetCgroupDumpMetadata", response, response.Code()) - } -} - -// NewGetCgroupDumpMetadataOK creates a GetCgroupDumpMetadataOK with default headers values -func NewGetCgroupDumpMetadataOK() *GetCgroupDumpMetadataOK { - return &GetCgroupDumpMetadataOK{} -} - -/* -GetCgroupDumpMetadataOK describes a response with status code 200, with default header values. - -Success -*/ -type GetCgroupDumpMetadataOK struct { - Payload *models.CgroupDumpMetadata -} - -// IsSuccess returns true when this get cgroup dump metadata o k response has a 2xx status code -func (o *GetCgroupDumpMetadataOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get cgroup dump metadata o k response has a 3xx status code -func (o *GetCgroupDumpMetadataOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get cgroup dump metadata o k response has a 4xx status code -func (o *GetCgroupDumpMetadataOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get cgroup dump metadata o k response has a 5xx status code -func (o *GetCgroupDumpMetadataOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get cgroup dump metadata o k response a status code equal to that given -func (o *GetCgroupDumpMetadataOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get cgroup dump metadata o k response -func (o *GetCgroupDumpMetadataOK) Code() int { - return 200 -} - -func (o *GetCgroupDumpMetadataOK) Error() string { - return fmt.Sprintf("[GET /cgroup-dump-metadata][%d] getCgroupDumpMetadataOK %+v", 200, o.Payload) -} - -func (o *GetCgroupDumpMetadataOK) String() string { - return fmt.Sprintf("[GET /cgroup-dump-metadata][%d] getCgroupDumpMetadataOK %+v", 200, o.Payload) -} - -func (o *GetCgroupDumpMetadataOK) GetPayload() *models.CgroupDumpMetadata { - return o.Payload -} - -func (o *GetCgroupDumpMetadataOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.CgroupDumpMetadata) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetCgroupDumpMetadataFailure creates a GetCgroupDumpMetadataFailure with default headers values -func NewGetCgroupDumpMetadataFailure() *GetCgroupDumpMetadataFailure { - return &GetCgroupDumpMetadataFailure{} -} - -/* -GetCgroupDumpMetadataFailure describes a response with status code 500, with default header values. - -CgroupDumpMetadata get failed -*/ -type GetCgroupDumpMetadataFailure struct { - Payload models.Error -} - -// IsSuccess returns true when this get cgroup dump metadata failure response has a 2xx status code -func (o *GetCgroupDumpMetadataFailure) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get cgroup dump metadata failure response has a 3xx status code -func (o *GetCgroupDumpMetadataFailure) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get cgroup dump metadata failure response has a 4xx status code -func (o *GetCgroupDumpMetadataFailure) IsClientError() bool { - return false -} - -// IsServerError returns true when this get cgroup dump metadata failure response has a 5xx status code -func (o *GetCgroupDumpMetadataFailure) IsServerError() bool { - return true -} - -// IsCode returns true when this get cgroup dump metadata failure response a status code equal to that given -func (o *GetCgroupDumpMetadataFailure) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the get cgroup dump metadata failure response -func (o *GetCgroupDumpMetadataFailure) Code() int { - return 500 -} - -func (o *GetCgroupDumpMetadataFailure) Error() string { - return fmt.Sprintf("[GET /cgroup-dump-metadata][%d] getCgroupDumpMetadataFailure %+v", 500, o.Payload) -} - -func (o *GetCgroupDumpMetadataFailure) String() string { - return fmt.Sprintf("[GET /cgroup-dump-metadata][%d] getCgroupDumpMetadataFailure %+v", 500, o.Payload) -} - -func (o *GetCgroupDumpMetadataFailure) GetPayload() models.Error { - return o.Payload -} - -func (o *GetCgroupDumpMetadataFailure) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_cluster_nodes_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_cluster_nodes_parameters.go deleted file mode 100644 index f99962195..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_cluster_nodes_parameters.go +++ /dev/null @@ -1,161 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package daemon - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetClusterNodesParams creates a new GetClusterNodesParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetClusterNodesParams() *GetClusterNodesParams { - return &GetClusterNodesParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetClusterNodesParamsWithTimeout creates a new GetClusterNodesParams object -// with the ability to set a timeout on a request. -func NewGetClusterNodesParamsWithTimeout(timeout time.Duration) *GetClusterNodesParams { - return &GetClusterNodesParams{ - timeout: timeout, - } -} - -// NewGetClusterNodesParamsWithContext creates a new GetClusterNodesParams object -// with the ability to set a context for a request. -func NewGetClusterNodesParamsWithContext(ctx context.Context) *GetClusterNodesParams { - return &GetClusterNodesParams{ - Context: ctx, - } -} - -// NewGetClusterNodesParamsWithHTTPClient creates a new GetClusterNodesParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetClusterNodesParamsWithHTTPClient(client *http.Client) *GetClusterNodesParams { - return &GetClusterNodesParams{ - HTTPClient: client, - } -} - -/* -GetClusterNodesParams contains all the parameters to send to the API endpoint - - for the get cluster nodes operation. - - Typically these are written to a http.Request. -*/ -type GetClusterNodesParams struct { - - /* ClientID. - - Client UUID should be used when the client wants to request - a diff of nodes added and / or removed since the last time - that client has made a request. - - */ - ClientID *int64 - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get cluster nodes params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetClusterNodesParams) WithDefaults() *GetClusterNodesParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get cluster nodes params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetClusterNodesParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get cluster nodes params -func (o *GetClusterNodesParams) WithTimeout(timeout time.Duration) *GetClusterNodesParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get cluster nodes params -func (o *GetClusterNodesParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get cluster nodes params -func (o *GetClusterNodesParams) WithContext(ctx context.Context) *GetClusterNodesParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get cluster nodes params -func (o *GetClusterNodesParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get cluster nodes params -func (o *GetClusterNodesParams) WithHTTPClient(client *http.Client) *GetClusterNodesParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get cluster nodes params -func (o *GetClusterNodesParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithClientID adds the clientID to the get cluster nodes params -func (o *GetClusterNodesParams) WithClientID(clientID *int64) *GetClusterNodesParams { - o.SetClientID(clientID) - return o -} - -// SetClientID adds the clientId to the get cluster nodes params -func (o *GetClusterNodesParams) SetClientID(clientID *int64) { - o.ClientID = clientID -} - -// WriteToRequest writes these params to a swagger request -func (o *GetClusterNodesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if o.ClientID != nil { - - // header param client-id - if err := r.SetHeaderParam("client-id", swag.FormatInt64(*o.ClientID)); err != nil { - return err - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_cluster_nodes_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_cluster_nodes_responses.go deleted file mode 100644 index 76e715fef..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_cluster_nodes_responses.go +++ /dev/null @@ -1,106 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package daemon - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetClusterNodesReader is a Reader for the GetClusterNodes structure. -type GetClusterNodesReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetClusterNodesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetClusterNodesOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - return nil, runtime.NewAPIError("[GET /cluster/nodes] GetClusterNodes", response, response.Code()) - } -} - -// NewGetClusterNodesOK creates a GetClusterNodesOK with default headers values -func NewGetClusterNodesOK() *GetClusterNodesOK { - return &GetClusterNodesOK{} -} - -/* -GetClusterNodesOK describes a response with status code 200, with default header values. - -Success -*/ -type GetClusterNodesOK struct { - Payload *models.ClusterNodeStatus -} - -// IsSuccess returns true when this get cluster nodes o k response has a 2xx status code -func (o *GetClusterNodesOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get cluster nodes o k response has a 3xx status code -func (o *GetClusterNodesOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get cluster nodes o k response has a 4xx status code -func (o *GetClusterNodesOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get cluster nodes o k response has a 5xx status code -func (o *GetClusterNodesOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get cluster nodes o k response a status code equal to that given -func (o *GetClusterNodesOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get cluster nodes o k response -func (o *GetClusterNodesOK) Code() int { - return 200 -} - -func (o *GetClusterNodesOK) Error() string { - return fmt.Sprintf("[GET /cluster/nodes][%d] getClusterNodesOK %+v", 200, o.Payload) -} - -func (o *GetClusterNodesOK) String() string { - return fmt.Sprintf("[GET /cluster/nodes][%d] getClusterNodesOK %+v", 200, o.Payload) -} - -func (o *GetClusterNodesOK) GetPayload() *models.ClusterNodeStatus { - return o.Payload -} - -func (o *GetClusterNodesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.ClusterNodeStatus) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_config_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_config_parameters.go deleted file mode 100644 index e741bd356..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_config_parameters.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package daemon - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetConfigParams creates a new GetConfigParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetConfigParams() *GetConfigParams { - return &GetConfigParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetConfigParamsWithTimeout creates a new GetConfigParams object -// with the ability to set a timeout on a request. -func NewGetConfigParamsWithTimeout(timeout time.Duration) *GetConfigParams { - return &GetConfigParams{ - timeout: timeout, - } -} - -// NewGetConfigParamsWithContext creates a new GetConfigParams object -// with the ability to set a context for a request. -func NewGetConfigParamsWithContext(ctx context.Context) *GetConfigParams { - return &GetConfigParams{ - Context: ctx, - } -} - -// NewGetConfigParamsWithHTTPClient creates a new GetConfigParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetConfigParamsWithHTTPClient(client *http.Client) *GetConfigParams { - return &GetConfigParams{ - HTTPClient: client, - } -} - -/* -GetConfigParams contains all the parameters to send to the API endpoint - - for the get config operation. - - Typically these are written to a http.Request. -*/ -type GetConfigParams struct { - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get config params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetConfigParams) WithDefaults() *GetConfigParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get config params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetConfigParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get config params -func (o *GetConfigParams) WithTimeout(timeout time.Duration) *GetConfigParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get config params -func (o *GetConfigParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get config params -func (o *GetConfigParams) WithContext(ctx context.Context) *GetConfigParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get config params -func (o *GetConfigParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get config params -func (o *GetConfigParams) WithHTTPClient(client *http.Client) *GetConfigParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get config params -func (o *GetConfigParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *GetConfigParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_config_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_config_responses.go deleted file mode 100644 index 310e80e20..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_config_responses.go +++ /dev/null @@ -1,106 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package daemon - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetConfigReader is a Reader for the GetConfig structure. -type GetConfigReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetConfigReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetConfigOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - return nil, runtime.NewAPIError("[GET /config] GetConfig", response, response.Code()) - } -} - -// NewGetConfigOK creates a GetConfigOK with default headers values -func NewGetConfigOK() *GetConfigOK { - return &GetConfigOK{} -} - -/* -GetConfigOK describes a response with status code 200, with default header values. - -Success -*/ -type GetConfigOK struct { - Payload *models.DaemonConfiguration -} - -// IsSuccess returns true when this get config o k response has a 2xx status code -func (o *GetConfigOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get config o k response has a 3xx status code -func (o *GetConfigOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get config o k response has a 4xx status code -func (o *GetConfigOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get config o k response has a 5xx status code -func (o *GetConfigOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get config o k response a status code equal to that given -func (o *GetConfigOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get config o k response -func (o *GetConfigOK) Code() int { - return 200 -} - -func (o *GetConfigOK) Error() string { - return fmt.Sprintf("[GET /config][%d] getConfigOK %+v", 200, o.Payload) -} - -func (o *GetConfigOK) String() string { - return fmt.Sprintf("[GET /config][%d] getConfigOK %+v", 200, o.Payload) -} - -func (o *GetConfigOK) GetPayload() *models.DaemonConfiguration { - return o.Payload -} - -func (o *GetConfigOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.DaemonConfiguration) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_debuginfo_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_debuginfo_parameters.go deleted file mode 100644 index 28eed7d3a..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_debuginfo_parameters.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package daemon - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetDebuginfoParams creates a new GetDebuginfoParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetDebuginfoParams() *GetDebuginfoParams { - return &GetDebuginfoParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetDebuginfoParamsWithTimeout creates a new GetDebuginfoParams object -// with the ability to set a timeout on a request. -func NewGetDebuginfoParamsWithTimeout(timeout time.Duration) *GetDebuginfoParams { - return &GetDebuginfoParams{ - timeout: timeout, - } -} - -// NewGetDebuginfoParamsWithContext creates a new GetDebuginfoParams object -// with the ability to set a context for a request. -func NewGetDebuginfoParamsWithContext(ctx context.Context) *GetDebuginfoParams { - return &GetDebuginfoParams{ - Context: ctx, - } -} - -// NewGetDebuginfoParamsWithHTTPClient creates a new GetDebuginfoParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetDebuginfoParamsWithHTTPClient(client *http.Client) *GetDebuginfoParams { - return &GetDebuginfoParams{ - HTTPClient: client, - } -} - -/* -GetDebuginfoParams contains all the parameters to send to the API endpoint - - for the get debuginfo operation. - - Typically these are written to a http.Request. -*/ -type GetDebuginfoParams struct { - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get debuginfo params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetDebuginfoParams) WithDefaults() *GetDebuginfoParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get debuginfo params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetDebuginfoParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get debuginfo params -func (o *GetDebuginfoParams) WithTimeout(timeout time.Duration) *GetDebuginfoParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get debuginfo params -func (o *GetDebuginfoParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get debuginfo params -func (o *GetDebuginfoParams) WithContext(ctx context.Context) *GetDebuginfoParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get debuginfo params -func (o *GetDebuginfoParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get debuginfo params -func (o *GetDebuginfoParams) WithHTTPClient(client *http.Client) *GetDebuginfoParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get debuginfo params -func (o *GetDebuginfoParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *GetDebuginfoParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_debuginfo_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_debuginfo_responses.go deleted file mode 100644 index e781ad47a..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_debuginfo_responses.go +++ /dev/null @@ -1,178 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package daemon - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetDebuginfoReader is a Reader for the GetDebuginfo structure. -type GetDebuginfoReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetDebuginfoReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetDebuginfoOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 500: - result := NewGetDebuginfoFailure() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /debuginfo] GetDebuginfo", response, response.Code()) - } -} - -// NewGetDebuginfoOK creates a GetDebuginfoOK with default headers values -func NewGetDebuginfoOK() *GetDebuginfoOK { - return &GetDebuginfoOK{} -} - -/* -GetDebuginfoOK describes a response with status code 200, with default header values. - -Success -*/ -type GetDebuginfoOK struct { - Payload *models.DebugInfo -} - -// IsSuccess returns true when this get debuginfo o k response has a 2xx status code -func (o *GetDebuginfoOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get debuginfo o k response has a 3xx status code -func (o *GetDebuginfoOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get debuginfo o k response has a 4xx status code -func (o *GetDebuginfoOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get debuginfo o k response has a 5xx status code -func (o *GetDebuginfoOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get debuginfo o k response a status code equal to that given -func (o *GetDebuginfoOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get debuginfo o k response -func (o *GetDebuginfoOK) Code() int { - return 200 -} - -func (o *GetDebuginfoOK) Error() string { - return fmt.Sprintf("[GET /debuginfo][%d] getDebuginfoOK %+v", 200, o.Payload) -} - -func (o *GetDebuginfoOK) String() string { - return fmt.Sprintf("[GET /debuginfo][%d] getDebuginfoOK %+v", 200, o.Payload) -} - -func (o *GetDebuginfoOK) GetPayload() *models.DebugInfo { - return o.Payload -} - -func (o *GetDebuginfoOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.DebugInfo) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetDebuginfoFailure creates a GetDebuginfoFailure with default headers values -func NewGetDebuginfoFailure() *GetDebuginfoFailure { - return &GetDebuginfoFailure{} -} - -/* -GetDebuginfoFailure describes a response with status code 500, with default header values. - -DebugInfo get failed -*/ -type GetDebuginfoFailure struct { - Payload models.Error -} - -// IsSuccess returns true when this get debuginfo failure response has a 2xx status code -func (o *GetDebuginfoFailure) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get debuginfo failure response has a 3xx status code -func (o *GetDebuginfoFailure) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get debuginfo failure response has a 4xx status code -func (o *GetDebuginfoFailure) IsClientError() bool { - return false -} - -// IsServerError returns true when this get debuginfo failure response has a 5xx status code -func (o *GetDebuginfoFailure) IsServerError() bool { - return true -} - -// IsCode returns true when this get debuginfo failure response a status code equal to that given -func (o *GetDebuginfoFailure) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the get debuginfo failure response -func (o *GetDebuginfoFailure) Code() int { - return 500 -} - -func (o *GetDebuginfoFailure) Error() string { - return fmt.Sprintf("[GET /debuginfo][%d] getDebuginfoFailure %+v", 500, o.Payload) -} - -func (o *GetDebuginfoFailure) String() string { - return fmt.Sprintf("[GET /debuginfo][%d] getDebuginfoFailure %+v", 500, o.Payload) -} - -func (o *GetDebuginfoFailure) GetPayload() models.Error { - return o.Payload -} - -func (o *GetDebuginfoFailure) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_healthz_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_healthz_parameters.go deleted file mode 100644 index 235c69da3..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_healthz_parameters.go +++ /dev/null @@ -1,159 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package daemon - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetHealthzParams creates a new GetHealthzParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetHealthzParams() *GetHealthzParams { - return &GetHealthzParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetHealthzParamsWithTimeout creates a new GetHealthzParams object -// with the ability to set a timeout on a request. -func NewGetHealthzParamsWithTimeout(timeout time.Duration) *GetHealthzParams { - return &GetHealthzParams{ - timeout: timeout, - } -} - -// NewGetHealthzParamsWithContext creates a new GetHealthzParams object -// with the ability to set a context for a request. -func NewGetHealthzParamsWithContext(ctx context.Context) *GetHealthzParams { - return &GetHealthzParams{ - Context: ctx, - } -} - -// NewGetHealthzParamsWithHTTPClient creates a new GetHealthzParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetHealthzParamsWithHTTPClient(client *http.Client) *GetHealthzParams { - return &GetHealthzParams{ - HTTPClient: client, - } -} - -/* -GetHealthzParams contains all the parameters to send to the API endpoint - - for the get healthz operation. - - Typically these are written to a http.Request. -*/ -type GetHealthzParams struct { - - /* Brief. - - Brief will return a brief representation of the Cilium status. - - */ - Brief *bool - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get healthz params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetHealthzParams) WithDefaults() *GetHealthzParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get healthz params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetHealthzParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get healthz params -func (o *GetHealthzParams) WithTimeout(timeout time.Duration) *GetHealthzParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get healthz params -func (o *GetHealthzParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get healthz params -func (o *GetHealthzParams) WithContext(ctx context.Context) *GetHealthzParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get healthz params -func (o *GetHealthzParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get healthz params -func (o *GetHealthzParams) WithHTTPClient(client *http.Client) *GetHealthzParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get healthz params -func (o *GetHealthzParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithBrief adds the brief to the get healthz params -func (o *GetHealthzParams) WithBrief(brief *bool) *GetHealthzParams { - o.SetBrief(brief) - return o -} - -// SetBrief adds the brief to the get healthz params -func (o *GetHealthzParams) SetBrief(brief *bool) { - o.Brief = brief -} - -// WriteToRequest writes these params to a swagger request -func (o *GetHealthzParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if o.Brief != nil { - - // header param brief - if err := r.SetHeaderParam("brief", swag.FormatBool(*o.Brief)); err != nil { - return err - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_healthz_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_healthz_responses.go deleted file mode 100644 index ae234754f..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_healthz_responses.go +++ /dev/null @@ -1,106 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package daemon - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetHealthzReader is a Reader for the GetHealthz structure. -type GetHealthzReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetHealthzReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetHealthzOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - return nil, runtime.NewAPIError("[GET /healthz] GetHealthz", response, response.Code()) - } -} - -// NewGetHealthzOK creates a GetHealthzOK with default headers values -func NewGetHealthzOK() *GetHealthzOK { - return &GetHealthzOK{} -} - -/* -GetHealthzOK describes a response with status code 200, with default header values. - -Success -*/ -type GetHealthzOK struct { - Payload *models.StatusResponse -} - -// IsSuccess returns true when this get healthz o k response has a 2xx status code -func (o *GetHealthzOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get healthz o k response has a 3xx status code -func (o *GetHealthzOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get healthz o k response has a 4xx status code -func (o *GetHealthzOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get healthz o k response has a 5xx status code -func (o *GetHealthzOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get healthz o k response a status code equal to that given -func (o *GetHealthzOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get healthz o k response -func (o *GetHealthzOK) Code() int { - return 200 -} - -func (o *GetHealthzOK) Error() string { - return fmt.Sprintf("[GET /healthz][%d] getHealthzOK %+v", 200, o.Payload) -} - -func (o *GetHealthzOK) String() string { - return fmt.Sprintf("[GET /healthz][%d] getHealthzOK %+v", 200, o.Payload) -} - -func (o *GetHealthzOK) GetPayload() *models.StatusResponse { - return o.Payload -} - -func (o *GetHealthzOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.StatusResponse) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_map_name_events_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_map_name_events_parameters.go deleted file mode 100644 index 41520f507..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_map_name_events_parameters.go +++ /dev/null @@ -1,189 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package daemon - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetMapNameEventsParams creates a new GetMapNameEventsParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetMapNameEventsParams() *GetMapNameEventsParams { - return &GetMapNameEventsParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetMapNameEventsParamsWithTimeout creates a new GetMapNameEventsParams object -// with the ability to set a timeout on a request. -func NewGetMapNameEventsParamsWithTimeout(timeout time.Duration) *GetMapNameEventsParams { - return &GetMapNameEventsParams{ - timeout: timeout, - } -} - -// NewGetMapNameEventsParamsWithContext creates a new GetMapNameEventsParams object -// with the ability to set a context for a request. -func NewGetMapNameEventsParamsWithContext(ctx context.Context) *GetMapNameEventsParams { - return &GetMapNameEventsParams{ - Context: ctx, - } -} - -// NewGetMapNameEventsParamsWithHTTPClient creates a new GetMapNameEventsParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetMapNameEventsParamsWithHTTPClient(client *http.Client) *GetMapNameEventsParams { - return &GetMapNameEventsParams{ - HTTPClient: client, - } -} - -/* -GetMapNameEventsParams contains all the parameters to send to the API endpoint - - for the get map name events operation. - - Typically these are written to a http.Request. -*/ -type GetMapNameEventsParams struct { - - /* Follow. - - Whether to follow streamed requests - */ - Follow *bool - - /* Name. - - Name of map - */ - Name string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get map name events params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetMapNameEventsParams) WithDefaults() *GetMapNameEventsParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get map name events params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetMapNameEventsParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get map name events params -func (o *GetMapNameEventsParams) WithTimeout(timeout time.Duration) *GetMapNameEventsParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get map name events params -func (o *GetMapNameEventsParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get map name events params -func (o *GetMapNameEventsParams) WithContext(ctx context.Context) *GetMapNameEventsParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get map name events params -func (o *GetMapNameEventsParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get map name events params -func (o *GetMapNameEventsParams) WithHTTPClient(client *http.Client) *GetMapNameEventsParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get map name events params -func (o *GetMapNameEventsParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithFollow adds the follow to the get map name events params -func (o *GetMapNameEventsParams) WithFollow(follow *bool) *GetMapNameEventsParams { - o.SetFollow(follow) - return o -} - -// SetFollow adds the follow to the get map name events params -func (o *GetMapNameEventsParams) SetFollow(follow *bool) { - o.Follow = follow -} - -// WithName adds the name to the get map name events params -func (o *GetMapNameEventsParams) WithName(name string) *GetMapNameEventsParams { - o.SetName(name) - return o -} - -// SetName adds the name to the get map name events params -func (o *GetMapNameEventsParams) SetName(name string) { - o.Name = name -} - -// WriteToRequest writes these params to a swagger request -func (o *GetMapNameEventsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if o.Follow != nil { - - // query param follow - var qrFollow bool - - if o.Follow != nil { - qrFollow = *o.Follow - } - qFollow := swag.FormatBool(qrFollow) - if qFollow != "" { - - if err := r.SetQueryParam("follow", qFollow); err != nil { - return err - } - } - } - - // path param name - if err := r.SetPathParam("name", o.Name); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_map_name_events_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_map_name_events_responses.go deleted file mode 100644 index 39a9423b7..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_map_name_events_responses.go +++ /dev/null @@ -1,168 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package daemon - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// GetMapNameEventsReader is a Reader for the GetMapNameEvents structure. -type GetMapNameEventsReader struct { - formats strfmt.Registry - writer io.Writer -} - -// ReadResponse reads a server response into the received o. -func (o *GetMapNameEventsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetMapNameEventsOK(o.writer) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 404: - result := NewGetMapNameEventsNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /map/{name}/events] GetMapNameEvents", response, response.Code()) - } -} - -// NewGetMapNameEventsOK creates a GetMapNameEventsOK with default headers values -func NewGetMapNameEventsOK(writer io.Writer) *GetMapNameEventsOK { - return &GetMapNameEventsOK{ - - Payload: writer, - } -} - -/* -GetMapNameEventsOK describes a response with status code 200, with default header values. - -Success -*/ -type GetMapNameEventsOK struct { - Payload io.Writer -} - -// IsSuccess returns true when this get map name events o k response has a 2xx status code -func (o *GetMapNameEventsOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get map name events o k response has a 3xx status code -func (o *GetMapNameEventsOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get map name events o k response has a 4xx status code -func (o *GetMapNameEventsOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get map name events o k response has a 5xx status code -func (o *GetMapNameEventsOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get map name events o k response a status code equal to that given -func (o *GetMapNameEventsOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get map name events o k response -func (o *GetMapNameEventsOK) Code() int { - return 200 -} - -func (o *GetMapNameEventsOK) Error() string { - return fmt.Sprintf("[GET /map/{name}/events][%d] getMapNameEventsOK %+v", 200, o.Payload) -} - -func (o *GetMapNameEventsOK) String() string { - return fmt.Sprintf("[GET /map/{name}/events][%d] getMapNameEventsOK %+v", 200, o.Payload) -} - -func (o *GetMapNameEventsOK) GetPayload() io.Writer { - return o.Payload -} - -func (o *GetMapNameEventsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetMapNameEventsNotFound creates a GetMapNameEventsNotFound with default headers values -func NewGetMapNameEventsNotFound() *GetMapNameEventsNotFound { - return &GetMapNameEventsNotFound{} -} - -/* -GetMapNameEventsNotFound describes a response with status code 404, with default header values. - -Map not found -*/ -type GetMapNameEventsNotFound struct { -} - -// IsSuccess returns true when this get map name events not found response has a 2xx status code -func (o *GetMapNameEventsNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get map name events not found response has a 3xx status code -func (o *GetMapNameEventsNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get map name events not found response has a 4xx status code -func (o *GetMapNameEventsNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this get map name events not found response has a 5xx status code -func (o *GetMapNameEventsNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this get map name events not found response a status code equal to that given -func (o *GetMapNameEventsNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the get map name events not found response -func (o *GetMapNameEventsNotFound) Code() int { - return 404 -} - -func (o *GetMapNameEventsNotFound) Error() string { - return fmt.Sprintf("[GET /map/{name}/events][%d] getMapNameEventsNotFound ", 404) -} - -func (o *GetMapNameEventsNotFound) String() string { - return fmt.Sprintf("[GET /map/{name}/events][%d] getMapNameEventsNotFound ", 404) -} - -func (o *GetMapNameEventsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_map_name_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_map_name_parameters.go deleted file mode 100644 index 9465ac2bb..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_map_name_parameters.go +++ /dev/null @@ -1,154 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package daemon - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetMapNameParams creates a new GetMapNameParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetMapNameParams() *GetMapNameParams { - return &GetMapNameParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetMapNameParamsWithTimeout creates a new GetMapNameParams object -// with the ability to set a timeout on a request. -func NewGetMapNameParamsWithTimeout(timeout time.Duration) *GetMapNameParams { - return &GetMapNameParams{ - timeout: timeout, - } -} - -// NewGetMapNameParamsWithContext creates a new GetMapNameParams object -// with the ability to set a context for a request. -func NewGetMapNameParamsWithContext(ctx context.Context) *GetMapNameParams { - return &GetMapNameParams{ - Context: ctx, - } -} - -// NewGetMapNameParamsWithHTTPClient creates a new GetMapNameParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetMapNameParamsWithHTTPClient(client *http.Client) *GetMapNameParams { - return &GetMapNameParams{ - HTTPClient: client, - } -} - -/* -GetMapNameParams contains all the parameters to send to the API endpoint - - for the get map name operation. - - Typically these are written to a http.Request. -*/ -type GetMapNameParams struct { - - /* Name. - - Name of map - */ - Name string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get map name params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetMapNameParams) WithDefaults() *GetMapNameParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get map name params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetMapNameParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get map name params -func (o *GetMapNameParams) WithTimeout(timeout time.Duration) *GetMapNameParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get map name params -func (o *GetMapNameParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get map name params -func (o *GetMapNameParams) WithContext(ctx context.Context) *GetMapNameParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get map name params -func (o *GetMapNameParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get map name params -func (o *GetMapNameParams) WithHTTPClient(client *http.Client) *GetMapNameParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get map name params -func (o *GetMapNameParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithName adds the name to the get map name params -func (o *GetMapNameParams) WithName(name string) *GetMapNameParams { - o.SetName(name) - return o -} - -// SetName adds the name to the get map name params -func (o *GetMapNameParams) SetName(name string) { - o.Name = name -} - -// WriteToRequest writes these params to a swagger request -func (o *GetMapNameParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - // path param name - if err := r.SetPathParam("name", o.Name); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_map_name_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_map_name_responses.go deleted file mode 100644 index 553290f23..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_map_name_responses.go +++ /dev/null @@ -1,168 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package daemon - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetMapNameReader is a Reader for the GetMapName structure. -type GetMapNameReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetMapNameReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetMapNameOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 404: - result := NewGetMapNameNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /map/{name}] GetMapName", response, response.Code()) - } -} - -// NewGetMapNameOK creates a GetMapNameOK with default headers values -func NewGetMapNameOK() *GetMapNameOK { - return &GetMapNameOK{} -} - -/* -GetMapNameOK describes a response with status code 200, with default header values. - -Success -*/ -type GetMapNameOK struct { - Payload *models.BPFMap -} - -// IsSuccess returns true when this get map name o k response has a 2xx status code -func (o *GetMapNameOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get map name o k response has a 3xx status code -func (o *GetMapNameOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get map name o k response has a 4xx status code -func (o *GetMapNameOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get map name o k response has a 5xx status code -func (o *GetMapNameOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get map name o k response a status code equal to that given -func (o *GetMapNameOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get map name o k response -func (o *GetMapNameOK) Code() int { - return 200 -} - -func (o *GetMapNameOK) Error() string { - return fmt.Sprintf("[GET /map/{name}][%d] getMapNameOK %+v", 200, o.Payload) -} - -func (o *GetMapNameOK) String() string { - return fmt.Sprintf("[GET /map/{name}][%d] getMapNameOK %+v", 200, o.Payload) -} - -func (o *GetMapNameOK) GetPayload() *models.BPFMap { - return o.Payload -} - -func (o *GetMapNameOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.BPFMap) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetMapNameNotFound creates a GetMapNameNotFound with default headers values -func NewGetMapNameNotFound() *GetMapNameNotFound { - return &GetMapNameNotFound{} -} - -/* -GetMapNameNotFound describes a response with status code 404, with default header values. - -Map not found -*/ -type GetMapNameNotFound struct { -} - -// IsSuccess returns true when this get map name not found response has a 2xx status code -func (o *GetMapNameNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get map name not found response has a 3xx status code -func (o *GetMapNameNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get map name not found response has a 4xx status code -func (o *GetMapNameNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this get map name not found response has a 5xx status code -func (o *GetMapNameNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this get map name not found response a status code equal to that given -func (o *GetMapNameNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the get map name not found response -func (o *GetMapNameNotFound) Code() int { - return 404 -} - -func (o *GetMapNameNotFound) Error() string { - return fmt.Sprintf("[GET /map/{name}][%d] getMapNameNotFound ", 404) -} - -func (o *GetMapNameNotFound) String() string { - return fmt.Sprintf("[GET /map/{name}][%d] getMapNameNotFound ", 404) -} - -func (o *GetMapNameNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_map_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_map_parameters.go deleted file mode 100644 index 05cca29d7..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_map_parameters.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package daemon - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetMapParams creates a new GetMapParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetMapParams() *GetMapParams { - return &GetMapParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetMapParamsWithTimeout creates a new GetMapParams object -// with the ability to set a timeout on a request. -func NewGetMapParamsWithTimeout(timeout time.Duration) *GetMapParams { - return &GetMapParams{ - timeout: timeout, - } -} - -// NewGetMapParamsWithContext creates a new GetMapParams object -// with the ability to set a context for a request. -func NewGetMapParamsWithContext(ctx context.Context) *GetMapParams { - return &GetMapParams{ - Context: ctx, - } -} - -// NewGetMapParamsWithHTTPClient creates a new GetMapParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetMapParamsWithHTTPClient(client *http.Client) *GetMapParams { - return &GetMapParams{ - HTTPClient: client, - } -} - -/* -GetMapParams contains all the parameters to send to the API endpoint - - for the get map operation. - - Typically these are written to a http.Request. -*/ -type GetMapParams struct { - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get map params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetMapParams) WithDefaults() *GetMapParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get map params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetMapParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get map params -func (o *GetMapParams) WithTimeout(timeout time.Duration) *GetMapParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get map params -func (o *GetMapParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get map params -func (o *GetMapParams) WithContext(ctx context.Context) *GetMapParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get map params -func (o *GetMapParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get map params -func (o *GetMapParams) WithHTTPClient(client *http.Client) *GetMapParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get map params -func (o *GetMapParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *GetMapParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_map_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_map_responses.go deleted file mode 100644 index 98bf166c9..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_map_responses.go +++ /dev/null @@ -1,106 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package daemon - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetMapReader is a Reader for the GetMap structure. -type GetMapReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetMapReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetMapOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - return nil, runtime.NewAPIError("[GET /map] GetMap", response, response.Code()) - } -} - -// NewGetMapOK creates a GetMapOK with default headers values -func NewGetMapOK() *GetMapOK { - return &GetMapOK{} -} - -/* -GetMapOK describes a response with status code 200, with default header values. - -Success -*/ -type GetMapOK struct { - Payload *models.BPFMapList -} - -// IsSuccess returns true when this get map o k response has a 2xx status code -func (o *GetMapOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get map o k response has a 3xx status code -func (o *GetMapOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get map o k response has a 4xx status code -func (o *GetMapOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get map o k response has a 5xx status code -func (o *GetMapOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get map o k response a status code equal to that given -func (o *GetMapOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get map o k response -func (o *GetMapOK) Code() int { - return 200 -} - -func (o *GetMapOK) Error() string { - return fmt.Sprintf("[GET /map][%d] getMapOK %+v", 200, o.Payload) -} - -func (o *GetMapOK) String() string { - return fmt.Sprintf("[GET /map][%d] getMapOK %+v", 200, o.Payload) -} - -func (o *GetMapOK) GetPayload() *models.BPFMapList { - return o.Payload -} - -func (o *GetMapOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.BPFMapList) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_node_ids_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_node_ids_parameters.go deleted file mode 100644 index 19fce1163..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_node_ids_parameters.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package daemon - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetNodeIdsParams creates a new GetNodeIdsParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetNodeIdsParams() *GetNodeIdsParams { - return &GetNodeIdsParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetNodeIdsParamsWithTimeout creates a new GetNodeIdsParams object -// with the ability to set a timeout on a request. -func NewGetNodeIdsParamsWithTimeout(timeout time.Duration) *GetNodeIdsParams { - return &GetNodeIdsParams{ - timeout: timeout, - } -} - -// NewGetNodeIdsParamsWithContext creates a new GetNodeIdsParams object -// with the ability to set a context for a request. -func NewGetNodeIdsParamsWithContext(ctx context.Context) *GetNodeIdsParams { - return &GetNodeIdsParams{ - Context: ctx, - } -} - -// NewGetNodeIdsParamsWithHTTPClient creates a new GetNodeIdsParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetNodeIdsParamsWithHTTPClient(client *http.Client) *GetNodeIdsParams { - return &GetNodeIdsParams{ - HTTPClient: client, - } -} - -/* -GetNodeIdsParams contains all the parameters to send to the API endpoint - - for the get node ids operation. - - Typically these are written to a http.Request. -*/ -type GetNodeIdsParams struct { - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get node ids params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetNodeIdsParams) WithDefaults() *GetNodeIdsParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get node ids params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetNodeIdsParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get node ids params -func (o *GetNodeIdsParams) WithTimeout(timeout time.Duration) *GetNodeIdsParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get node ids params -func (o *GetNodeIdsParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get node ids params -func (o *GetNodeIdsParams) WithContext(ctx context.Context) *GetNodeIdsParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get node ids params -func (o *GetNodeIdsParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get node ids params -func (o *GetNodeIdsParams) WithHTTPClient(client *http.Client) *GetNodeIdsParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get node ids params -func (o *GetNodeIdsParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *GetNodeIdsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_node_ids_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_node_ids_responses.go deleted file mode 100644 index 6a7d0735e..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/daemon/get_node_ids_responses.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package daemon - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetNodeIdsReader is a Reader for the GetNodeIds structure. -type GetNodeIdsReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetNodeIdsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetNodeIdsOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - return nil, runtime.NewAPIError("[GET /node/ids] GetNodeIds", response, response.Code()) - } -} - -// NewGetNodeIdsOK creates a GetNodeIdsOK with default headers values -func NewGetNodeIdsOK() *GetNodeIdsOK { - return &GetNodeIdsOK{} -} - -/* -GetNodeIdsOK describes a response with status code 200, with default header values. - -Success -*/ -type GetNodeIdsOK struct { - Payload []*models.NodeID -} - -// IsSuccess returns true when this get node ids o k response has a 2xx status code -func (o *GetNodeIdsOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get node ids o k response has a 3xx status code -func (o *GetNodeIdsOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get node ids o k response has a 4xx status code -func (o *GetNodeIdsOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get node ids o k response has a 5xx status code -func (o *GetNodeIdsOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get node ids o k response a status code equal to that given -func (o *GetNodeIdsOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get node ids o k response -func (o *GetNodeIdsOK) Code() int { - return 200 -} - -func (o *GetNodeIdsOK) Error() string { - return fmt.Sprintf("[GET /node/ids][%d] getNodeIdsOK %+v", 200, o.Payload) -} - -func (o *GetNodeIdsOK) String() string { - return fmt.Sprintf("[GET /node/ids][%d] getNodeIdsOK %+v", 200, o.Payload) -} - -func (o *GetNodeIdsOK) GetPayload() []*models.NodeID { - return o.Payload -} - -func (o *GetNodeIdsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/daemon/patch_config_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/daemon/patch_config_parameters.go deleted file mode 100644 index a95be301c..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/daemon/patch_config_parameters.go +++ /dev/null @@ -1,153 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package daemon - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// NewPatchConfigParams creates a new PatchConfigParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewPatchConfigParams() *PatchConfigParams { - return &PatchConfigParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewPatchConfigParamsWithTimeout creates a new PatchConfigParams object -// with the ability to set a timeout on a request. -func NewPatchConfigParamsWithTimeout(timeout time.Duration) *PatchConfigParams { - return &PatchConfigParams{ - timeout: timeout, - } -} - -// NewPatchConfigParamsWithContext creates a new PatchConfigParams object -// with the ability to set a context for a request. -func NewPatchConfigParamsWithContext(ctx context.Context) *PatchConfigParams { - return &PatchConfigParams{ - Context: ctx, - } -} - -// NewPatchConfigParamsWithHTTPClient creates a new PatchConfigParams object -// with the ability to set a custom HTTPClient for a request. -func NewPatchConfigParamsWithHTTPClient(client *http.Client) *PatchConfigParams { - return &PatchConfigParams{ - HTTPClient: client, - } -} - -/* -PatchConfigParams contains all the parameters to send to the API endpoint - - for the patch config operation. - - Typically these are written to a http.Request. -*/ -type PatchConfigParams struct { - - // Configuration. - Configuration *models.DaemonConfigurationSpec - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the patch config params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PatchConfigParams) WithDefaults() *PatchConfigParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the patch config params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PatchConfigParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the patch config params -func (o *PatchConfigParams) WithTimeout(timeout time.Duration) *PatchConfigParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the patch config params -func (o *PatchConfigParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the patch config params -func (o *PatchConfigParams) WithContext(ctx context.Context) *PatchConfigParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the patch config params -func (o *PatchConfigParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the patch config params -func (o *PatchConfigParams) WithHTTPClient(client *http.Client) *PatchConfigParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the patch config params -func (o *PatchConfigParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithConfiguration adds the configuration to the patch config params -func (o *PatchConfigParams) WithConfiguration(configuration *models.DaemonConfigurationSpec) *PatchConfigParams { - o.SetConfiguration(configuration) - return o -} - -// SetConfiguration adds the configuration to the patch config params -func (o *PatchConfigParams) SetConfiguration(configuration *models.DaemonConfigurationSpec) { - o.Configuration = configuration -} - -// WriteToRequest writes these params to a swagger request -func (o *PatchConfigParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if o.Configuration != nil { - if err := r.SetBodyParam(o.Configuration); err != nil { - return err - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/daemon/patch_config_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/daemon/patch_config_responses.go deleted file mode 100644 index 601049818..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/daemon/patch_config_responses.go +++ /dev/null @@ -1,300 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package daemon - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// PatchConfigReader is a Reader for the PatchConfig structure. -type PatchConfigReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *PatchConfigReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewPatchConfigOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 400: - result := NewPatchConfigBadRequest() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 403: - result := NewPatchConfigForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewPatchConfigFailure() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[PATCH /config] PatchConfig", response, response.Code()) - } -} - -// NewPatchConfigOK creates a PatchConfigOK with default headers values -func NewPatchConfigOK() *PatchConfigOK { - return &PatchConfigOK{} -} - -/* -PatchConfigOK describes a response with status code 200, with default header values. - -Success -*/ -type PatchConfigOK struct { -} - -// IsSuccess returns true when this patch config o k response has a 2xx status code -func (o *PatchConfigOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this patch config o k response has a 3xx status code -func (o *PatchConfigOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch config o k response has a 4xx status code -func (o *PatchConfigOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this patch config o k response has a 5xx status code -func (o *PatchConfigOK) IsServerError() bool { - return false -} - -// IsCode returns true when this patch config o k response a status code equal to that given -func (o *PatchConfigOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the patch config o k response -func (o *PatchConfigOK) Code() int { - return 200 -} - -func (o *PatchConfigOK) Error() string { - return fmt.Sprintf("[PATCH /config][%d] patchConfigOK ", 200) -} - -func (o *PatchConfigOK) String() string { - return fmt.Sprintf("[PATCH /config][%d] patchConfigOK ", 200) -} - -func (o *PatchConfigOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPatchConfigBadRequest creates a PatchConfigBadRequest with default headers values -func NewPatchConfigBadRequest() *PatchConfigBadRequest { - return &PatchConfigBadRequest{} -} - -/* -PatchConfigBadRequest describes a response with status code 400, with default header values. - -Bad configuration parameters -*/ -type PatchConfigBadRequest struct { - Payload models.Error -} - -// IsSuccess returns true when this patch config bad request response has a 2xx status code -func (o *PatchConfigBadRequest) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this patch config bad request response has a 3xx status code -func (o *PatchConfigBadRequest) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch config bad request response has a 4xx status code -func (o *PatchConfigBadRequest) IsClientError() bool { - return true -} - -// IsServerError returns true when this patch config bad request response has a 5xx status code -func (o *PatchConfigBadRequest) IsServerError() bool { - return false -} - -// IsCode returns true when this patch config bad request response a status code equal to that given -func (o *PatchConfigBadRequest) IsCode(code int) bool { - return code == 400 -} - -// Code gets the status code for the patch config bad request response -func (o *PatchConfigBadRequest) Code() int { - return 400 -} - -func (o *PatchConfigBadRequest) Error() string { - return fmt.Sprintf("[PATCH /config][%d] patchConfigBadRequest %+v", 400, o.Payload) -} - -func (o *PatchConfigBadRequest) String() string { - return fmt.Sprintf("[PATCH /config][%d] patchConfigBadRequest %+v", 400, o.Payload) -} - -func (o *PatchConfigBadRequest) GetPayload() models.Error { - return o.Payload -} - -func (o *PatchConfigBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewPatchConfigForbidden creates a PatchConfigForbidden with default headers values -func NewPatchConfigForbidden() *PatchConfigForbidden { - return &PatchConfigForbidden{} -} - -/* -PatchConfigForbidden describes a response with status code 403, with default header values. - -Forbidden -*/ -type PatchConfigForbidden struct { -} - -// IsSuccess returns true when this patch config forbidden response has a 2xx status code -func (o *PatchConfigForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this patch config forbidden response has a 3xx status code -func (o *PatchConfigForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch config forbidden response has a 4xx status code -func (o *PatchConfigForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this patch config forbidden response has a 5xx status code -func (o *PatchConfigForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this patch config forbidden response a status code equal to that given -func (o *PatchConfigForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the patch config forbidden response -func (o *PatchConfigForbidden) Code() int { - return 403 -} - -func (o *PatchConfigForbidden) Error() string { - return fmt.Sprintf("[PATCH /config][%d] patchConfigForbidden ", 403) -} - -func (o *PatchConfigForbidden) String() string { - return fmt.Sprintf("[PATCH /config][%d] patchConfigForbidden ", 403) -} - -func (o *PatchConfigForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPatchConfigFailure creates a PatchConfigFailure with default headers values -func NewPatchConfigFailure() *PatchConfigFailure { - return &PatchConfigFailure{} -} - -/* -PatchConfigFailure describes a response with status code 500, with default header values. - -Recompilation failed -*/ -type PatchConfigFailure struct { - Payload models.Error -} - -// IsSuccess returns true when this patch config failure response has a 2xx status code -func (o *PatchConfigFailure) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this patch config failure response has a 3xx status code -func (o *PatchConfigFailure) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch config failure response has a 4xx status code -func (o *PatchConfigFailure) IsClientError() bool { - return false -} - -// IsServerError returns true when this patch config failure response has a 5xx status code -func (o *PatchConfigFailure) IsServerError() bool { - return true -} - -// IsCode returns true when this patch config failure response a status code equal to that given -func (o *PatchConfigFailure) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the patch config failure response -func (o *PatchConfigFailure) Code() int { - return 500 -} - -func (o *PatchConfigFailure) Error() string { - return fmt.Sprintf("[PATCH /config][%d] patchConfigFailure %+v", 500, o.Payload) -} - -func (o *PatchConfigFailure) String() string { - return fmt.Sprintf("[PATCH /config][%d] patchConfigFailure %+v", 500, o.Payload) -} - -func (o *PatchConfigFailure) GetPayload() models.Error { - return o.Payload -} - -func (o *PatchConfigFailure) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/delete_endpoint_id_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/delete_endpoint_id_parameters.go deleted file mode 100644 index 28d2c6237..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/delete_endpoint_id_parameters.go +++ /dev/null @@ -1,168 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewDeleteEndpointIDParams creates a new DeleteEndpointIDParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewDeleteEndpointIDParams() *DeleteEndpointIDParams { - return &DeleteEndpointIDParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewDeleteEndpointIDParamsWithTimeout creates a new DeleteEndpointIDParams object -// with the ability to set a timeout on a request. -func NewDeleteEndpointIDParamsWithTimeout(timeout time.Duration) *DeleteEndpointIDParams { - return &DeleteEndpointIDParams{ - timeout: timeout, - } -} - -// NewDeleteEndpointIDParamsWithContext creates a new DeleteEndpointIDParams object -// with the ability to set a context for a request. -func NewDeleteEndpointIDParamsWithContext(ctx context.Context) *DeleteEndpointIDParams { - return &DeleteEndpointIDParams{ - Context: ctx, - } -} - -// NewDeleteEndpointIDParamsWithHTTPClient creates a new DeleteEndpointIDParams object -// with the ability to set a custom HTTPClient for a request. -func NewDeleteEndpointIDParamsWithHTTPClient(client *http.Client) *DeleteEndpointIDParams { - return &DeleteEndpointIDParams{ - HTTPClient: client, - } -} - -/* -DeleteEndpointIDParams contains all the parameters to send to the API endpoint - - for the delete endpoint ID operation. - - Typically these are written to a http.Request. -*/ -type DeleteEndpointIDParams struct { - - /* ID. - - String describing an endpoint with the format ``[prefix:]id``. If no prefix - is specified, a prefix of ``cilium-local:`` is assumed. Not all endpoints - will be addressable by all endpoint ID prefixes with the exception of the - local Cilium UUID which is assigned to all endpoints. - - Supported endpoint id prefixes: - - cilium-local: Local Cilium endpoint UUID, e.g. cilium-local:3389595 - - cilium-global: Global Cilium endpoint UUID, e.g. cilium-global:cluster1:nodeX:452343 - - cni-attachment-id: CNI attachment ID, e.g. cni-attachment-id:22222:eth0 - - container-id: Container runtime ID, e.g. container-id:22222 (deprecated, may not be unique) - - container-name: Container name, e.g. container-name:foobar (deprecated, may not be unique) - - pod-name: pod name for this container if K8s is enabled, e.g. pod-name:default:foobar (deprecated, may not be unique) - - cep-name: cep name for this container if K8s is enabled, e.g. pod-name:default:foobar-net1 - - docker-endpoint: Docker libnetwork endpoint ID, e.g. docker-endpoint:4444 - - */ - ID string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the delete endpoint ID params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeleteEndpointIDParams) WithDefaults() *DeleteEndpointIDParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the delete endpoint ID params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeleteEndpointIDParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the delete endpoint ID params -func (o *DeleteEndpointIDParams) WithTimeout(timeout time.Duration) *DeleteEndpointIDParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the delete endpoint ID params -func (o *DeleteEndpointIDParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the delete endpoint ID params -func (o *DeleteEndpointIDParams) WithContext(ctx context.Context) *DeleteEndpointIDParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the delete endpoint ID params -func (o *DeleteEndpointIDParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the delete endpoint ID params -func (o *DeleteEndpointIDParams) WithHTTPClient(client *http.Client) *DeleteEndpointIDParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the delete endpoint ID params -func (o *DeleteEndpointIDParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithID adds the id to the delete endpoint ID params -func (o *DeleteEndpointIDParams) WithID(id string) *DeleteEndpointIDParams { - o.SetID(id) - return o -} - -// SetID adds the id to the delete endpoint ID params -func (o *DeleteEndpointIDParams) SetID(id string) { - o.ID = id -} - -// WriteToRequest writes these params to a swagger request -func (o *DeleteEndpointIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - // path param id - if err := r.SetPathParam("id", o.ID); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/delete_endpoint_id_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/delete_endpoint_id_responses.go deleted file mode 100644 index 861e32d4e..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/delete_endpoint_id_responses.go +++ /dev/null @@ -1,426 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// DeleteEndpointIDReader is a Reader for the DeleteEndpointID structure. -type DeleteEndpointIDReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *DeleteEndpointIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewDeleteEndpointIDOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 206: - result := NewDeleteEndpointIDErrors() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 400: - result := NewDeleteEndpointIDInvalid() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 403: - result := NewDeleteEndpointIDForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewDeleteEndpointIDNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 429: - result := NewDeleteEndpointIDTooManyRequests() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[DELETE /endpoint/{id}] DeleteEndpointID", response, response.Code()) - } -} - -// NewDeleteEndpointIDOK creates a DeleteEndpointIDOK with default headers values -func NewDeleteEndpointIDOK() *DeleteEndpointIDOK { - return &DeleteEndpointIDOK{} -} - -/* -DeleteEndpointIDOK describes a response with status code 200, with default header values. - -Success -*/ -type DeleteEndpointIDOK struct { -} - -// IsSuccess returns true when this delete endpoint Id o k response has a 2xx status code -func (o *DeleteEndpointIDOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this delete endpoint Id o k response has a 3xx status code -func (o *DeleteEndpointIDOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete endpoint Id o k response has a 4xx status code -func (o *DeleteEndpointIDOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this delete endpoint Id o k response has a 5xx status code -func (o *DeleteEndpointIDOK) IsServerError() bool { - return false -} - -// IsCode returns true when this delete endpoint Id o k response a status code equal to that given -func (o *DeleteEndpointIDOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the delete endpoint Id o k response -func (o *DeleteEndpointIDOK) Code() int { - return 200 -} - -func (o *DeleteEndpointIDOK) Error() string { - return fmt.Sprintf("[DELETE /endpoint/{id}][%d] deleteEndpointIdOK ", 200) -} - -func (o *DeleteEndpointIDOK) String() string { - return fmt.Sprintf("[DELETE /endpoint/{id}][%d] deleteEndpointIdOK ", 200) -} - -func (o *DeleteEndpointIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewDeleteEndpointIDErrors creates a DeleteEndpointIDErrors with default headers values -func NewDeleteEndpointIDErrors() *DeleteEndpointIDErrors { - return &DeleteEndpointIDErrors{} -} - -/* -DeleteEndpointIDErrors describes a response with status code 206, with default header values. - -Deleted with a number of errors encountered -*/ -type DeleteEndpointIDErrors struct { - Payload int64 -} - -// IsSuccess returns true when this delete endpoint Id errors response has a 2xx status code -func (o *DeleteEndpointIDErrors) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this delete endpoint Id errors response has a 3xx status code -func (o *DeleteEndpointIDErrors) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete endpoint Id errors response has a 4xx status code -func (o *DeleteEndpointIDErrors) IsClientError() bool { - return false -} - -// IsServerError returns true when this delete endpoint Id errors response has a 5xx status code -func (o *DeleteEndpointIDErrors) IsServerError() bool { - return false -} - -// IsCode returns true when this delete endpoint Id errors response a status code equal to that given -func (o *DeleteEndpointIDErrors) IsCode(code int) bool { - return code == 206 -} - -// Code gets the status code for the delete endpoint Id errors response -func (o *DeleteEndpointIDErrors) Code() int { - return 206 -} - -func (o *DeleteEndpointIDErrors) Error() string { - return fmt.Sprintf("[DELETE /endpoint/{id}][%d] deleteEndpointIdErrors %+v", 206, o.Payload) -} - -func (o *DeleteEndpointIDErrors) String() string { - return fmt.Sprintf("[DELETE /endpoint/{id}][%d] deleteEndpointIdErrors %+v", 206, o.Payload) -} - -func (o *DeleteEndpointIDErrors) GetPayload() int64 { - return o.Payload -} - -func (o *DeleteEndpointIDErrors) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewDeleteEndpointIDInvalid creates a DeleteEndpointIDInvalid with default headers values -func NewDeleteEndpointIDInvalid() *DeleteEndpointIDInvalid { - return &DeleteEndpointIDInvalid{} -} - -/* - DeleteEndpointIDInvalid describes a response with status code 400, with default header values. - - Invalid endpoint ID format for specified type. Details in error - -message -*/ -type DeleteEndpointIDInvalid struct { - Payload models.Error -} - -// IsSuccess returns true when this delete endpoint Id invalid response has a 2xx status code -func (o *DeleteEndpointIDInvalid) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete endpoint Id invalid response has a 3xx status code -func (o *DeleteEndpointIDInvalid) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete endpoint Id invalid response has a 4xx status code -func (o *DeleteEndpointIDInvalid) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete endpoint Id invalid response has a 5xx status code -func (o *DeleteEndpointIDInvalid) IsServerError() bool { - return false -} - -// IsCode returns true when this delete endpoint Id invalid response a status code equal to that given -func (o *DeleteEndpointIDInvalid) IsCode(code int) bool { - return code == 400 -} - -// Code gets the status code for the delete endpoint Id invalid response -func (o *DeleteEndpointIDInvalid) Code() int { - return 400 -} - -func (o *DeleteEndpointIDInvalid) Error() string { - return fmt.Sprintf("[DELETE /endpoint/{id}][%d] deleteEndpointIdInvalid %+v", 400, o.Payload) -} - -func (o *DeleteEndpointIDInvalid) String() string { - return fmt.Sprintf("[DELETE /endpoint/{id}][%d] deleteEndpointIdInvalid %+v", 400, o.Payload) -} - -func (o *DeleteEndpointIDInvalid) GetPayload() models.Error { - return o.Payload -} - -func (o *DeleteEndpointIDInvalid) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewDeleteEndpointIDForbidden creates a DeleteEndpointIDForbidden with default headers values -func NewDeleteEndpointIDForbidden() *DeleteEndpointIDForbidden { - return &DeleteEndpointIDForbidden{} -} - -/* -DeleteEndpointIDForbidden describes a response with status code 403, with default header values. - -Forbidden -*/ -type DeleteEndpointIDForbidden struct { -} - -// IsSuccess returns true when this delete endpoint Id forbidden response has a 2xx status code -func (o *DeleteEndpointIDForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete endpoint Id forbidden response has a 3xx status code -func (o *DeleteEndpointIDForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete endpoint Id forbidden response has a 4xx status code -func (o *DeleteEndpointIDForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete endpoint Id forbidden response has a 5xx status code -func (o *DeleteEndpointIDForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this delete endpoint Id forbidden response a status code equal to that given -func (o *DeleteEndpointIDForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the delete endpoint Id forbidden response -func (o *DeleteEndpointIDForbidden) Code() int { - return 403 -} - -func (o *DeleteEndpointIDForbidden) Error() string { - return fmt.Sprintf("[DELETE /endpoint/{id}][%d] deleteEndpointIdForbidden ", 403) -} - -func (o *DeleteEndpointIDForbidden) String() string { - return fmt.Sprintf("[DELETE /endpoint/{id}][%d] deleteEndpointIdForbidden ", 403) -} - -func (o *DeleteEndpointIDForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewDeleteEndpointIDNotFound creates a DeleteEndpointIDNotFound with default headers values -func NewDeleteEndpointIDNotFound() *DeleteEndpointIDNotFound { - return &DeleteEndpointIDNotFound{} -} - -/* -DeleteEndpointIDNotFound describes a response with status code 404, with default header values. - -Endpoint not found -*/ -type DeleteEndpointIDNotFound struct { -} - -// IsSuccess returns true when this delete endpoint Id not found response has a 2xx status code -func (o *DeleteEndpointIDNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete endpoint Id not found response has a 3xx status code -func (o *DeleteEndpointIDNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete endpoint Id not found response has a 4xx status code -func (o *DeleteEndpointIDNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete endpoint Id not found response has a 5xx status code -func (o *DeleteEndpointIDNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this delete endpoint Id not found response a status code equal to that given -func (o *DeleteEndpointIDNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the delete endpoint Id not found response -func (o *DeleteEndpointIDNotFound) Code() int { - return 404 -} - -func (o *DeleteEndpointIDNotFound) Error() string { - return fmt.Sprintf("[DELETE /endpoint/{id}][%d] deleteEndpointIdNotFound ", 404) -} - -func (o *DeleteEndpointIDNotFound) String() string { - return fmt.Sprintf("[DELETE /endpoint/{id}][%d] deleteEndpointIdNotFound ", 404) -} - -func (o *DeleteEndpointIDNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewDeleteEndpointIDTooManyRequests creates a DeleteEndpointIDTooManyRequests with default headers values -func NewDeleteEndpointIDTooManyRequests() *DeleteEndpointIDTooManyRequests { - return &DeleteEndpointIDTooManyRequests{} -} - -/* -DeleteEndpointIDTooManyRequests describes a response with status code 429, with default header values. - -Rate-limiting too many requests in the given time frame -*/ -type DeleteEndpointIDTooManyRequests struct { -} - -// IsSuccess returns true when this delete endpoint Id too many requests response has a 2xx status code -func (o *DeleteEndpointIDTooManyRequests) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete endpoint Id too many requests response has a 3xx status code -func (o *DeleteEndpointIDTooManyRequests) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete endpoint Id too many requests response has a 4xx status code -func (o *DeleteEndpointIDTooManyRequests) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete endpoint Id too many requests response has a 5xx status code -func (o *DeleteEndpointIDTooManyRequests) IsServerError() bool { - return false -} - -// IsCode returns true when this delete endpoint Id too many requests response a status code equal to that given -func (o *DeleteEndpointIDTooManyRequests) IsCode(code int) bool { - return code == 429 -} - -// Code gets the status code for the delete endpoint Id too many requests response -func (o *DeleteEndpointIDTooManyRequests) Code() int { - return 429 -} - -func (o *DeleteEndpointIDTooManyRequests) Error() string { - return fmt.Sprintf("[DELETE /endpoint/{id}][%d] deleteEndpointIdTooManyRequests ", 429) -} - -func (o *DeleteEndpointIDTooManyRequests) String() string { - return fmt.Sprintf("[DELETE /endpoint/{id}][%d] deleteEndpointIdTooManyRequests ", 429) -} - -func (o *DeleteEndpointIDTooManyRequests) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/delete_endpoint_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/delete_endpoint_parameters.go deleted file mode 100644 index 8d28629fe..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/delete_endpoint_parameters.go +++ /dev/null @@ -1,153 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// NewDeleteEndpointParams creates a new DeleteEndpointParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewDeleteEndpointParams() *DeleteEndpointParams { - return &DeleteEndpointParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewDeleteEndpointParamsWithTimeout creates a new DeleteEndpointParams object -// with the ability to set a timeout on a request. -func NewDeleteEndpointParamsWithTimeout(timeout time.Duration) *DeleteEndpointParams { - return &DeleteEndpointParams{ - timeout: timeout, - } -} - -// NewDeleteEndpointParamsWithContext creates a new DeleteEndpointParams object -// with the ability to set a context for a request. -func NewDeleteEndpointParamsWithContext(ctx context.Context) *DeleteEndpointParams { - return &DeleteEndpointParams{ - Context: ctx, - } -} - -// NewDeleteEndpointParamsWithHTTPClient creates a new DeleteEndpointParams object -// with the ability to set a custom HTTPClient for a request. -func NewDeleteEndpointParamsWithHTTPClient(client *http.Client) *DeleteEndpointParams { - return &DeleteEndpointParams{ - HTTPClient: client, - } -} - -/* -DeleteEndpointParams contains all the parameters to send to the API endpoint - - for the delete endpoint operation. - - Typically these are written to a http.Request. -*/ -type DeleteEndpointParams struct { - - // Endpoint. - Endpoint *models.EndpointBatchDeleteRequest - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the delete endpoint params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeleteEndpointParams) WithDefaults() *DeleteEndpointParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the delete endpoint params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeleteEndpointParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the delete endpoint params -func (o *DeleteEndpointParams) WithTimeout(timeout time.Duration) *DeleteEndpointParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the delete endpoint params -func (o *DeleteEndpointParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the delete endpoint params -func (o *DeleteEndpointParams) WithContext(ctx context.Context) *DeleteEndpointParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the delete endpoint params -func (o *DeleteEndpointParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the delete endpoint params -func (o *DeleteEndpointParams) WithHTTPClient(client *http.Client) *DeleteEndpointParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the delete endpoint params -func (o *DeleteEndpointParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithEndpoint adds the endpoint to the delete endpoint params -func (o *DeleteEndpointParams) WithEndpoint(endpoint *models.EndpointBatchDeleteRequest) *DeleteEndpointParams { - o.SetEndpoint(endpoint) - return o -} - -// SetEndpoint adds the endpoint to the delete endpoint params -func (o *DeleteEndpointParams) SetEndpoint(endpoint *models.EndpointBatchDeleteRequest) { - o.Endpoint = endpoint -} - -// WriteToRequest writes these params to a swagger request -func (o *DeleteEndpointParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if o.Endpoint != nil { - if err := r.SetBodyParam(o.Endpoint); err != nil { - return err - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/delete_endpoint_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/delete_endpoint_responses.go deleted file mode 100644 index ee5c87f40..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/delete_endpoint_responses.go +++ /dev/null @@ -1,350 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// DeleteEndpointReader is a Reader for the DeleteEndpoint structure. -type DeleteEndpointReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *DeleteEndpointReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewDeleteEndpointOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 206: - result := NewDeleteEndpointErrors() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 400: - result := NewDeleteEndpointInvalid() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewDeleteEndpointNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 429: - result := NewDeleteEndpointTooManyRequests() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[DELETE /endpoint] DeleteEndpoint", response, response.Code()) - } -} - -// NewDeleteEndpointOK creates a DeleteEndpointOK with default headers values -func NewDeleteEndpointOK() *DeleteEndpointOK { - return &DeleteEndpointOK{} -} - -/* -DeleteEndpointOK describes a response with status code 200, with default header values. - -Success -*/ -type DeleteEndpointOK struct { -} - -// IsSuccess returns true when this delete endpoint o k response has a 2xx status code -func (o *DeleteEndpointOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this delete endpoint o k response has a 3xx status code -func (o *DeleteEndpointOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete endpoint o k response has a 4xx status code -func (o *DeleteEndpointOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this delete endpoint o k response has a 5xx status code -func (o *DeleteEndpointOK) IsServerError() bool { - return false -} - -// IsCode returns true when this delete endpoint o k response a status code equal to that given -func (o *DeleteEndpointOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the delete endpoint o k response -func (o *DeleteEndpointOK) Code() int { - return 200 -} - -func (o *DeleteEndpointOK) Error() string { - return fmt.Sprintf("[DELETE /endpoint][%d] deleteEndpointOK ", 200) -} - -func (o *DeleteEndpointOK) String() string { - return fmt.Sprintf("[DELETE /endpoint][%d] deleteEndpointOK ", 200) -} - -func (o *DeleteEndpointOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewDeleteEndpointErrors creates a DeleteEndpointErrors with default headers values -func NewDeleteEndpointErrors() *DeleteEndpointErrors { - return &DeleteEndpointErrors{} -} - -/* -DeleteEndpointErrors describes a response with status code 206, with default header values. - -Deleted with a number of errors encountered -*/ -type DeleteEndpointErrors struct { - Payload int64 -} - -// IsSuccess returns true when this delete endpoint errors response has a 2xx status code -func (o *DeleteEndpointErrors) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this delete endpoint errors response has a 3xx status code -func (o *DeleteEndpointErrors) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete endpoint errors response has a 4xx status code -func (o *DeleteEndpointErrors) IsClientError() bool { - return false -} - -// IsServerError returns true when this delete endpoint errors response has a 5xx status code -func (o *DeleteEndpointErrors) IsServerError() bool { - return false -} - -// IsCode returns true when this delete endpoint errors response a status code equal to that given -func (o *DeleteEndpointErrors) IsCode(code int) bool { - return code == 206 -} - -// Code gets the status code for the delete endpoint errors response -func (o *DeleteEndpointErrors) Code() int { - return 206 -} - -func (o *DeleteEndpointErrors) Error() string { - return fmt.Sprintf("[DELETE /endpoint][%d] deleteEndpointErrors %+v", 206, o.Payload) -} - -func (o *DeleteEndpointErrors) String() string { - return fmt.Sprintf("[DELETE /endpoint][%d] deleteEndpointErrors %+v", 206, o.Payload) -} - -func (o *DeleteEndpointErrors) GetPayload() int64 { - return o.Payload -} - -func (o *DeleteEndpointErrors) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewDeleteEndpointInvalid creates a DeleteEndpointInvalid with default headers values -func NewDeleteEndpointInvalid() *DeleteEndpointInvalid { - return &DeleteEndpointInvalid{} -} - -/* -DeleteEndpointInvalid describes a response with status code 400, with default header values. - -Invalid endpoint delete request -*/ -type DeleteEndpointInvalid struct { -} - -// IsSuccess returns true when this delete endpoint invalid response has a 2xx status code -func (o *DeleteEndpointInvalid) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete endpoint invalid response has a 3xx status code -func (o *DeleteEndpointInvalid) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete endpoint invalid response has a 4xx status code -func (o *DeleteEndpointInvalid) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete endpoint invalid response has a 5xx status code -func (o *DeleteEndpointInvalid) IsServerError() bool { - return false -} - -// IsCode returns true when this delete endpoint invalid response a status code equal to that given -func (o *DeleteEndpointInvalid) IsCode(code int) bool { - return code == 400 -} - -// Code gets the status code for the delete endpoint invalid response -func (o *DeleteEndpointInvalid) Code() int { - return 400 -} - -func (o *DeleteEndpointInvalid) Error() string { - return fmt.Sprintf("[DELETE /endpoint][%d] deleteEndpointInvalid ", 400) -} - -func (o *DeleteEndpointInvalid) String() string { - return fmt.Sprintf("[DELETE /endpoint][%d] deleteEndpointInvalid ", 400) -} - -func (o *DeleteEndpointInvalid) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewDeleteEndpointNotFound creates a DeleteEndpointNotFound with default headers values -func NewDeleteEndpointNotFound() *DeleteEndpointNotFound { - return &DeleteEndpointNotFound{} -} - -/* -DeleteEndpointNotFound describes a response with status code 404, with default header values. - -No endpoints with provided parameters found -*/ -type DeleteEndpointNotFound struct { -} - -// IsSuccess returns true when this delete endpoint not found response has a 2xx status code -func (o *DeleteEndpointNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete endpoint not found response has a 3xx status code -func (o *DeleteEndpointNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete endpoint not found response has a 4xx status code -func (o *DeleteEndpointNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete endpoint not found response has a 5xx status code -func (o *DeleteEndpointNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this delete endpoint not found response a status code equal to that given -func (o *DeleteEndpointNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the delete endpoint not found response -func (o *DeleteEndpointNotFound) Code() int { - return 404 -} - -func (o *DeleteEndpointNotFound) Error() string { - return fmt.Sprintf("[DELETE /endpoint][%d] deleteEndpointNotFound ", 404) -} - -func (o *DeleteEndpointNotFound) String() string { - return fmt.Sprintf("[DELETE /endpoint][%d] deleteEndpointNotFound ", 404) -} - -func (o *DeleteEndpointNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewDeleteEndpointTooManyRequests creates a DeleteEndpointTooManyRequests with default headers values -func NewDeleteEndpointTooManyRequests() *DeleteEndpointTooManyRequests { - return &DeleteEndpointTooManyRequests{} -} - -/* -DeleteEndpointTooManyRequests describes a response with status code 429, with default header values. - -Rate-limiting too many requests in the given time frame -*/ -type DeleteEndpointTooManyRequests struct { -} - -// IsSuccess returns true when this delete endpoint too many requests response has a 2xx status code -func (o *DeleteEndpointTooManyRequests) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete endpoint too many requests response has a 3xx status code -func (o *DeleteEndpointTooManyRequests) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete endpoint too many requests response has a 4xx status code -func (o *DeleteEndpointTooManyRequests) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete endpoint too many requests response has a 5xx status code -func (o *DeleteEndpointTooManyRequests) IsServerError() bool { - return false -} - -// IsCode returns true when this delete endpoint too many requests response a status code equal to that given -func (o *DeleteEndpointTooManyRequests) IsCode(code int) bool { - return code == 429 -} - -// Code gets the status code for the delete endpoint too many requests response -func (o *DeleteEndpointTooManyRequests) Code() int { - return 429 -} - -func (o *DeleteEndpointTooManyRequests) Error() string { - return fmt.Sprintf("[DELETE /endpoint][%d] deleteEndpointTooManyRequests ", 429) -} - -func (o *DeleteEndpointTooManyRequests) String() string { - return fmt.Sprintf("[DELETE /endpoint][%d] deleteEndpointTooManyRequests ", 429) -} - -func (o *DeleteEndpointTooManyRequests) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/endpoint_client.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/endpoint_client.go deleted file mode 100644 index 72f7b68ea..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/endpoint_client.go +++ /dev/null @@ -1,555 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// New creates a new endpoint API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { - return &Client{transport: transport, formats: formats} -} - -/* -Client for endpoint API -*/ -type Client struct { - transport runtime.ClientTransport - formats strfmt.Registry -} - -// ClientOption is the option for Client methods -type ClientOption func(*runtime.ClientOperation) - -// ClientService is the interface for Client methods -type ClientService interface { - DeleteEndpoint(params *DeleteEndpointParams, opts ...ClientOption) (*DeleteEndpointOK, *DeleteEndpointErrors, error) - - DeleteEndpointID(params *DeleteEndpointIDParams, opts ...ClientOption) (*DeleteEndpointIDOK, *DeleteEndpointIDErrors, error) - - GetEndpoint(params *GetEndpointParams, opts ...ClientOption) (*GetEndpointOK, error) - - GetEndpointID(params *GetEndpointIDParams, opts ...ClientOption) (*GetEndpointIDOK, error) - - GetEndpointIDConfig(params *GetEndpointIDConfigParams, opts ...ClientOption) (*GetEndpointIDConfigOK, error) - - GetEndpointIDHealthz(params *GetEndpointIDHealthzParams, opts ...ClientOption) (*GetEndpointIDHealthzOK, error) - - GetEndpointIDLabels(params *GetEndpointIDLabelsParams, opts ...ClientOption) (*GetEndpointIDLabelsOK, error) - - GetEndpointIDLog(params *GetEndpointIDLogParams, opts ...ClientOption) (*GetEndpointIDLogOK, error) - - PatchEndpointID(params *PatchEndpointIDParams, opts ...ClientOption) (*PatchEndpointIDOK, error) - - PatchEndpointIDConfig(params *PatchEndpointIDConfigParams, opts ...ClientOption) (*PatchEndpointIDConfigOK, error) - - PatchEndpointIDLabels(params *PatchEndpointIDLabelsParams, opts ...ClientOption) (*PatchEndpointIDLabelsOK, error) - - PutEndpointID(params *PutEndpointIDParams, opts ...ClientOption) (*PutEndpointIDCreated, error) - - SetTransport(transport runtime.ClientTransport) -} - -/* -DeleteEndpoint deletes a list of endpoints - -Deletes a list of endpoints that have endpoints matching the provided properties -*/ -func (a *Client) DeleteEndpoint(params *DeleteEndpointParams, opts ...ClientOption) (*DeleteEndpointOK, *DeleteEndpointErrors, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewDeleteEndpointParams() - } - op := &runtime.ClientOperation{ - ID: "DeleteEndpoint", - Method: "DELETE", - PathPattern: "/endpoint", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &DeleteEndpointReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, nil, err - } - switch value := result.(type) { - case *DeleteEndpointOK: - return value, nil, nil - case *DeleteEndpointErrors: - return nil, value, nil - } - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for endpoint: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* - DeleteEndpointID deletes endpoint - - Deletes the endpoint specified by the ID. Deletion is imminent and - -atomic, if the deletion request is valid and the endpoint exists, -deletion will occur even if errors are encountered in the process. If -errors have been encountered, the code 202 will be returned, otherwise -200 on success. - -All resources associated with the endpoint will be freed and the -workload represented by the endpoint will be disconnected.It will no -longer be able to initiate or receive communications of any sort. -*/ -func (a *Client) DeleteEndpointID(params *DeleteEndpointIDParams, opts ...ClientOption) (*DeleteEndpointIDOK, *DeleteEndpointIDErrors, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewDeleteEndpointIDParams() - } - op := &runtime.ClientOperation{ - ID: "DeleteEndpointID", - Method: "DELETE", - PathPattern: "/endpoint/{id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &DeleteEndpointIDReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, nil, err - } - switch value := result.(type) { - case *DeleteEndpointIDOK: - return value, nil, nil - case *DeleteEndpointIDErrors: - return nil, value, nil - } - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for endpoint: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetEndpoint retrieves a list of endpoints that have metadata matching the provided parameters - -Retrieves a list of endpoints that have metadata matching the provided parameters, or all endpoints if no parameters provided. -*/ -func (a *Client) GetEndpoint(params *GetEndpointParams, opts ...ClientOption) (*GetEndpointOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetEndpointParams() - } - op := &runtime.ClientOperation{ - ID: "GetEndpoint", - Method: "GET", - PathPattern: "/endpoint", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetEndpointReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetEndpointOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetEndpoint: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetEndpointID gets endpoint by endpoint ID - -Returns endpoint information -*/ -func (a *Client) GetEndpointID(params *GetEndpointIDParams, opts ...ClientOption) (*GetEndpointIDOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetEndpointIDParams() - } - op := &runtime.ClientOperation{ - ID: "GetEndpointID", - Method: "GET", - PathPattern: "/endpoint/{id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetEndpointIDReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetEndpointIDOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetEndpointID: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetEndpointIDConfig retrieves endpoint configuration - -Retrieves the configuration of the specified endpoint. -*/ -func (a *Client) GetEndpointIDConfig(params *GetEndpointIDConfigParams, opts ...ClientOption) (*GetEndpointIDConfigOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetEndpointIDConfigParams() - } - op := &runtime.ClientOperation{ - ID: "GetEndpointIDConfig", - Method: "GET", - PathPattern: "/endpoint/{id}/config", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetEndpointIDConfigReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetEndpointIDConfigOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetEndpointIDConfig: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetEndpointIDHealthz retrieves the status logs associated with this endpoint -*/ -func (a *Client) GetEndpointIDHealthz(params *GetEndpointIDHealthzParams, opts ...ClientOption) (*GetEndpointIDHealthzOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetEndpointIDHealthzParams() - } - op := &runtime.ClientOperation{ - ID: "GetEndpointIDHealthz", - Method: "GET", - PathPattern: "/endpoint/{id}/healthz", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetEndpointIDHealthzReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetEndpointIDHealthzOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetEndpointIDHealthz: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetEndpointIDLabels retrieves the list of labels associated with an endpoint -*/ -func (a *Client) GetEndpointIDLabels(params *GetEndpointIDLabelsParams, opts ...ClientOption) (*GetEndpointIDLabelsOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetEndpointIDLabelsParams() - } - op := &runtime.ClientOperation{ - ID: "GetEndpointIDLabels", - Method: "GET", - PathPattern: "/endpoint/{id}/labels", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetEndpointIDLabelsReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetEndpointIDLabelsOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetEndpointIDLabels: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetEndpointIDLog retrieves the status logs associated with this endpoint -*/ -func (a *Client) GetEndpointIDLog(params *GetEndpointIDLogParams, opts ...ClientOption) (*GetEndpointIDLogOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetEndpointIDLogParams() - } - op := &runtime.ClientOperation{ - ID: "GetEndpointIDLog", - Method: "GET", - PathPattern: "/endpoint/{id}/log", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetEndpointIDLogReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetEndpointIDLogOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetEndpointIDLog: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -PatchEndpointID modifies existing endpoint - -Applies the endpoint change request to an existing endpoint -*/ -func (a *Client) PatchEndpointID(params *PatchEndpointIDParams, opts ...ClientOption) (*PatchEndpointIDOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPatchEndpointIDParams() - } - op := &runtime.ClientOperation{ - ID: "PatchEndpointID", - Method: "PATCH", - PathPattern: "/endpoint/{id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PatchEndpointIDReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*PatchEndpointIDOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PatchEndpointID: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* - PatchEndpointIDConfig modifies mutable endpoint configuration - - Update the configuration of an existing endpoint and regenerates & - -recompiles the corresponding programs automatically. -*/ -func (a *Client) PatchEndpointIDConfig(params *PatchEndpointIDConfigParams, opts ...ClientOption) (*PatchEndpointIDConfigOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPatchEndpointIDConfigParams() - } - op := &runtime.ClientOperation{ - ID: "PatchEndpointIDConfig", - Method: "PATCH", - PathPattern: "/endpoint/{id}/config", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PatchEndpointIDConfigReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*PatchEndpointIDConfigOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PatchEndpointIDConfig: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* - PatchEndpointIDLabels sets label configuration of endpoint - - Sets labels associated with an endpoint. These can be user provided or - -derived from the orchestration system. -*/ -func (a *Client) PatchEndpointIDLabels(params *PatchEndpointIDLabelsParams, opts ...ClientOption) (*PatchEndpointIDLabelsOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPatchEndpointIDLabelsParams() - } - op := &runtime.ClientOperation{ - ID: "PatchEndpointIDLabels", - Method: "PATCH", - PathPattern: "/endpoint/{id}/labels", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PatchEndpointIDLabelsReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*PatchEndpointIDLabelsOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PatchEndpointIDLabels: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -PutEndpointID creates endpoint - -Creates a new endpoint -*/ -func (a *Client) PutEndpointID(params *PutEndpointIDParams, opts ...ClientOption) (*PutEndpointIDCreated, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPutEndpointIDParams() - } - op := &runtime.ClientOperation{ - ID: "PutEndpointID", - Method: "PUT", - PathPattern: "/endpoint/{id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PutEndpointIDReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*PutEndpointIDCreated) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PutEndpointID: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -// SetTransport changes the transport on the client -func (a *Client) SetTransport(transport runtime.ClientTransport) { - a.transport = transport -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_config_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_config_parameters.go deleted file mode 100644 index 971bf69f0..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_config_parameters.go +++ /dev/null @@ -1,168 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetEndpointIDConfigParams creates a new GetEndpointIDConfigParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetEndpointIDConfigParams() *GetEndpointIDConfigParams { - return &GetEndpointIDConfigParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetEndpointIDConfigParamsWithTimeout creates a new GetEndpointIDConfigParams object -// with the ability to set a timeout on a request. -func NewGetEndpointIDConfigParamsWithTimeout(timeout time.Duration) *GetEndpointIDConfigParams { - return &GetEndpointIDConfigParams{ - timeout: timeout, - } -} - -// NewGetEndpointIDConfigParamsWithContext creates a new GetEndpointIDConfigParams object -// with the ability to set a context for a request. -func NewGetEndpointIDConfigParamsWithContext(ctx context.Context) *GetEndpointIDConfigParams { - return &GetEndpointIDConfigParams{ - Context: ctx, - } -} - -// NewGetEndpointIDConfigParamsWithHTTPClient creates a new GetEndpointIDConfigParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetEndpointIDConfigParamsWithHTTPClient(client *http.Client) *GetEndpointIDConfigParams { - return &GetEndpointIDConfigParams{ - HTTPClient: client, - } -} - -/* -GetEndpointIDConfigParams contains all the parameters to send to the API endpoint - - for the get endpoint ID config operation. - - Typically these are written to a http.Request. -*/ -type GetEndpointIDConfigParams struct { - - /* ID. - - String describing an endpoint with the format ``[prefix:]id``. If no prefix - is specified, a prefix of ``cilium-local:`` is assumed. Not all endpoints - will be addressable by all endpoint ID prefixes with the exception of the - local Cilium UUID which is assigned to all endpoints. - - Supported endpoint id prefixes: - - cilium-local: Local Cilium endpoint UUID, e.g. cilium-local:3389595 - - cilium-global: Global Cilium endpoint UUID, e.g. cilium-global:cluster1:nodeX:452343 - - cni-attachment-id: CNI attachment ID, e.g. cni-attachment-id:22222:eth0 - - container-id: Container runtime ID, e.g. container-id:22222 (deprecated, may not be unique) - - container-name: Container name, e.g. container-name:foobar (deprecated, may not be unique) - - pod-name: pod name for this container if K8s is enabled, e.g. pod-name:default:foobar (deprecated, may not be unique) - - cep-name: cep name for this container if K8s is enabled, e.g. pod-name:default:foobar-net1 - - docker-endpoint: Docker libnetwork endpoint ID, e.g. docker-endpoint:4444 - - */ - ID string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get endpoint ID config params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetEndpointIDConfigParams) WithDefaults() *GetEndpointIDConfigParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get endpoint ID config params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetEndpointIDConfigParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get endpoint ID config params -func (o *GetEndpointIDConfigParams) WithTimeout(timeout time.Duration) *GetEndpointIDConfigParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get endpoint ID config params -func (o *GetEndpointIDConfigParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get endpoint ID config params -func (o *GetEndpointIDConfigParams) WithContext(ctx context.Context) *GetEndpointIDConfigParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get endpoint ID config params -func (o *GetEndpointIDConfigParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get endpoint ID config params -func (o *GetEndpointIDConfigParams) WithHTTPClient(client *http.Client) *GetEndpointIDConfigParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get endpoint ID config params -func (o *GetEndpointIDConfigParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithID adds the id to the get endpoint ID config params -func (o *GetEndpointIDConfigParams) WithID(id string) *GetEndpointIDConfigParams { - o.SetID(id) - return o -} - -// SetID adds the id to the get endpoint ID config params -func (o *GetEndpointIDConfigParams) SetID(id string) { - o.ID = id -} - -// WriteToRequest writes these params to a swagger request -func (o *GetEndpointIDConfigParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - // path param id - if err := r.SetPathParam("id", o.ID); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_config_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_config_responses.go deleted file mode 100644 index 41148f08f..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_config_responses.go +++ /dev/null @@ -1,230 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetEndpointIDConfigReader is a Reader for the GetEndpointIDConfig structure. -type GetEndpointIDConfigReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetEndpointIDConfigReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetEndpointIDConfigOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 404: - result := NewGetEndpointIDConfigNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 429: - result := NewGetEndpointIDConfigTooManyRequests() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /endpoint/{id}/config] GetEndpointIDConfig", response, response.Code()) - } -} - -// NewGetEndpointIDConfigOK creates a GetEndpointIDConfigOK with default headers values -func NewGetEndpointIDConfigOK() *GetEndpointIDConfigOK { - return &GetEndpointIDConfigOK{} -} - -/* -GetEndpointIDConfigOK describes a response with status code 200, with default header values. - -Success -*/ -type GetEndpointIDConfigOK struct { - Payload *models.EndpointConfigurationStatus -} - -// IsSuccess returns true when this get endpoint Id config o k response has a 2xx status code -func (o *GetEndpointIDConfigOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get endpoint Id config o k response has a 3xx status code -func (o *GetEndpointIDConfigOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get endpoint Id config o k response has a 4xx status code -func (o *GetEndpointIDConfigOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get endpoint Id config o k response has a 5xx status code -func (o *GetEndpointIDConfigOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get endpoint Id config o k response a status code equal to that given -func (o *GetEndpointIDConfigOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get endpoint Id config o k response -func (o *GetEndpointIDConfigOK) Code() int { - return 200 -} - -func (o *GetEndpointIDConfigOK) Error() string { - return fmt.Sprintf("[GET /endpoint/{id}/config][%d] getEndpointIdConfigOK %+v", 200, o.Payload) -} - -func (o *GetEndpointIDConfigOK) String() string { - return fmt.Sprintf("[GET /endpoint/{id}/config][%d] getEndpointIdConfigOK %+v", 200, o.Payload) -} - -func (o *GetEndpointIDConfigOK) GetPayload() *models.EndpointConfigurationStatus { - return o.Payload -} - -func (o *GetEndpointIDConfigOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.EndpointConfigurationStatus) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetEndpointIDConfigNotFound creates a GetEndpointIDConfigNotFound with default headers values -func NewGetEndpointIDConfigNotFound() *GetEndpointIDConfigNotFound { - return &GetEndpointIDConfigNotFound{} -} - -/* -GetEndpointIDConfigNotFound describes a response with status code 404, with default header values. - -Endpoint not found -*/ -type GetEndpointIDConfigNotFound struct { -} - -// IsSuccess returns true when this get endpoint Id config not found response has a 2xx status code -func (o *GetEndpointIDConfigNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get endpoint Id config not found response has a 3xx status code -func (o *GetEndpointIDConfigNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get endpoint Id config not found response has a 4xx status code -func (o *GetEndpointIDConfigNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this get endpoint Id config not found response has a 5xx status code -func (o *GetEndpointIDConfigNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this get endpoint Id config not found response a status code equal to that given -func (o *GetEndpointIDConfigNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the get endpoint Id config not found response -func (o *GetEndpointIDConfigNotFound) Code() int { - return 404 -} - -func (o *GetEndpointIDConfigNotFound) Error() string { - return fmt.Sprintf("[GET /endpoint/{id}/config][%d] getEndpointIdConfigNotFound ", 404) -} - -func (o *GetEndpointIDConfigNotFound) String() string { - return fmt.Sprintf("[GET /endpoint/{id}/config][%d] getEndpointIdConfigNotFound ", 404) -} - -func (o *GetEndpointIDConfigNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewGetEndpointIDConfigTooManyRequests creates a GetEndpointIDConfigTooManyRequests with default headers values -func NewGetEndpointIDConfigTooManyRequests() *GetEndpointIDConfigTooManyRequests { - return &GetEndpointIDConfigTooManyRequests{} -} - -/* -GetEndpointIDConfigTooManyRequests describes a response with status code 429, with default header values. - -Rate-limiting too many requests in the given time frame -*/ -type GetEndpointIDConfigTooManyRequests struct { -} - -// IsSuccess returns true when this get endpoint Id config too many requests response has a 2xx status code -func (o *GetEndpointIDConfigTooManyRequests) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get endpoint Id config too many requests response has a 3xx status code -func (o *GetEndpointIDConfigTooManyRequests) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get endpoint Id config too many requests response has a 4xx status code -func (o *GetEndpointIDConfigTooManyRequests) IsClientError() bool { - return true -} - -// IsServerError returns true when this get endpoint Id config too many requests response has a 5xx status code -func (o *GetEndpointIDConfigTooManyRequests) IsServerError() bool { - return false -} - -// IsCode returns true when this get endpoint Id config too many requests response a status code equal to that given -func (o *GetEndpointIDConfigTooManyRequests) IsCode(code int) bool { - return code == 429 -} - -// Code gets the status code for the get endpoint Id config too many requests response -func (o *GetEndpointIDConfigTooManyRequests) Code() int { - return 429 -} - -func (o *GetEndpointIDConfigTooManyRequests) Error() string { - return fmt.Sprintf("[GET /endpoint/{id}/config][%d] getEndpointIdConfigTooManyRequests ", 429) -} - -func (o *GetEndpointIDConfigTooManyRequests) String() string { - return fmt.Sprintf("[GET /endpoint/{id}/config][%d] getEndpointIdConfigTooManyRequests ", 429) -} - -func (o *GetEndpointIDConfigTooManyRequests) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_healthz_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_healthz_parameters.go deleted file mode 100644 index b211692ce..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_healthz_parameters.go +++ /dev/null @@ -1,168 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetEndpointIDHealthzParams creates a new GetEndpointIDHealthzParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetEndpointIDHealthzParams() *GetEndpointIDHealthzParams { - return &GetEndpointIDHealthzParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetEndpointIDHealthzParamsWithTimeout creates a new GetEndpointIDHealthzParams object -// with the ability to set a timeout on a request. -func NewGetEndpointIDHealthzParamsWithTimeout(timeout time.Duration) *GetEndpointIDHealthzParams { - return &GetEndpointIDHealthzParams{ - timeout: timeout, - } -} - -// NewGetEndpointIDHealthzParamsWithContext creates a new GetEndpointIDHealthzParams object -// with the ability to set a context for a request. -func NewGetEndpointIDHealthzParamsWithContext(ctx context.Context) *GetEndpointIDHealthzParams { - return &GetEndpointIDHealthzParams{ - Context: ctx, - } -} - -// NewGetEndpointIDHealthzParamsWithHTTPClient creates a new GetEndpointIDHealthzParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetEndpointIDHealthzParamsWithHTTPClient(client *http.Client) *GetEndpointIDHealthzParams { - return &GetEndpointIDHealthzParams{ - HTTPClient: client, - } -} - -/* -GetEndpointIDHealthzParams contains all the parameters to send to the API endpoint - - for the get endpoint ID healthz operation. - - Typically these are written to a http.Request. -*/ -type GetEndpointIDHealthzParams struct { - - /* ID. - - String describing an endpoint with the format ``[prefix:]id``. If no prefix - is specified, a prefix of ``cilium-local:`` is assumed. Not all endpoints - will be addressable by all endpoint ID prefixes with the exception of the - local Cilium UUID which is assigned to all endpoints. - - Supported endpoint id prefixes: - - cilium-local: Local Cilium endpoint UUID, e.g. cilium-local:3389595 - - cilium-global: Global Cilium endpoint UUID, e.g. cilium-global:cluster1:nodeX:452343 - - cni-attachment-id: CNI attachment ID, e.g. cni-attachment-id:22222:eth0 - - container-id: Container runtime ID, e.g. container-id:22222 (deprecated, may not be unique) - - container-name: Container name, e.g. container-name:foobar (deprecated, may not be unique) - - pod-name: pod name for this container if K8s is enabled, e.g. pod-name:default:foobar (deprecated, may not be unique) - - cep-name: cep name for this container if K8s is enabled, e.g. pod-name:default:foobar-net1 - - docker-endpoint: Docker libnetwork endpoint ID, e.g. docker-endpoint:4444 - - */ - ID string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get endpoint ID healthz params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetEndpointIDHealthzParams) WithDefaults() *GetEndpointIDHealthzParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get endpoint ID healthz params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetEndpointIDHealthzParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get endpoint ID healthz params -func (o *GetEndpointIDHealthzParams) WithTimeout(timeout time.Duration) *GetEndpointIDHealthzParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get endpoint ID healthz params -func (o *GetEndpointIDHealthzParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get endpoint ID healthz params -func (o *GetEndpointIDHealthzParams) WithContext(ctx context.Context) *GetEndpointIDHealthzParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get endpoint ID healthz params -func (o *GetEndpointIDHealthzParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get endpoint ID healthz params -func (o *GetEndpointIDHealthzParams) WithHTTPClient(client *http.Client) *GetEndpointIDHealthzParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get endpoint ID healthz params -func (o *GetEndpointIDHealthzParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithID adds the id to the get endpoint ID healthz params -func (o *GetEndpointIDHealthzParams) WithID(id string) *GetEndpointIDHealthzParams { - o.SetID(id) - return o -} - -// SetID adds the id to the get endpoint ID healthz params -func (o *GetEndpointIDHealthzParams) SetID(id string) { - o.ID = id -} - -// WriteToRequest writes these params to a swagger request -func (o *GetEndpointIDHealthzParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - // path param id - if err := r.SetPathParam("id", o.ID); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_healthz_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_healthz_responses.go deleted file mode 100644 index 1b15782c6..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_healthz_responses.go +++ /dev/null @@ -1,292 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetEndpointIDHealthzReader is a Reader for the GetEndpointIDHealthz structure. -type GetEndpointIDHealthzReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetEndpointIDHealthzReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetEndpointIDHealthzOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 400: - result := NewGetEndpointIDHealthzInvalid() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewGetEndpointIDHealthzNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 429: - result := NewGetEndpointIDHealthzTooManyRequests() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /endpoint/{id}/healthz] GetEndpointIDHealthz", response, response.Code()) - } -} - -// NewGetEndpointIDHealthzOK creates a GetEndpointIDHealthzOK with default headers values -func NewGetEndpointIDHealthzOK() *GetEndpointIDHealthzOK { - return &GetEndpointIDHealthzOK{} -} - -/* -GetEndpointIDHealthzOK describes a response with status code 200, with default header values. - -Success -*/ -type GetEndpointIDHealthzOK struct { - Payload *models.EndpointHealth -} - -// IsSuccess returns true when this get endpoint Id healthz o k response has a 2xx status code -func (o *GetEndpointIDHealthzOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get endpoint Id healthz o k response has a 3xx status code -func (o *GetEndpointIDHealthzOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get endpoint Id healthz o k response has a 4xx status code -func (o *GetEndpointIDHealthzOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get endpoint Id healthz o k response has a 5xx status code -func (o *GetEndpointIDHealthzOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get endpoint Id healthz o k response a status code equal to that given -func (o *GetEndpointIDHealthzOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get endpoint Id healthz o k response -func (o *GetEndpointIDHealthzOK) Code() int { - return 200 -} - -func (o *GetEndpointIDHealthzOK) Error() string { - return fmt.Sprintf("[GET /endpoint/{id}/healthz][%d] getEndpointIdHealthzOK %+v", 200, o.Payload) -} - -func (o *GetEndpointIDHealthzOK) String() string { - return fmt.Sprintf("[GET /endpoint/{id}/healthz][%d] getEndpointIdHealthzOK %+v", 200, o.Payload) -} - -func (o *GetEndpointIDHealthzOK) GetPayload() *models.EndpointHealth { - return o.Payload -} - -func (o *GetEndpointIDHealthzOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.EndpointHealth) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetEndpointIDHealthzInvalid creates a GetEndpointIDHealthzInvalid with default headers values -func NewGetEndpointIDHealthzInvalid() *GetEndpointIDHealthzInvalid { - return &GetEndpointIDHealthzInvalid{} -} - -/* -GetEndpointIDHealthzInvalid describes a response with status code 400, with default header values. - -Invalid identity provided -*/ -type GetEndpointIDHealthzInvalid struct { -} - -// IsSuccess returns true when this get endpoint Id healthz invalid response has a 2xx status code -func (o *GetEndpointIDHealthzInvalid) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get endpoint Id healthz invalid response has a 3xx status code -func (o *GetEndpointIDHealthzInvalid) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get endpoint Id healthz invalid response has a 4xx status code -func (o *GetEndpointIDHealthzInvalid) IsClientError() bool { - return true -} - -// IsServerError returns true when this get endpoint Id healthz invalid response has a 5xx status code -func (o *GetEndpointIDHealthzInvalid) IsServerError() bool { - return false -} - -// IsCode returns true when this get endpoint Id healthz invalid response a status code equal to that given -func (o *GetEndpointIDHealthzInvalid) IsCode(code int) bool { - return code == 400 -} - -// Code gets the status code for the get endpoint Id healthz invalid response -func (o *GetEndpointIDHealthzInvalid) Code() int { - return 400 -} - -func (o *GetEndpointIDHealthzInvalid) Error() string { - return fmt.Sprintf("[GET /endpoint/{id}/healthz][%d] getEndpointIdHealthzInvalid ", 400) -} - -func (o *GetEndpointIDHealthzInvalid) String() string { - return fmt.Sprintf("[GET /endpoint/{id}/healthz][%d] getEndpointIdHealthzInvalid ", 400) -} - -func (o *GetEndpointIDHealthzInvalid) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewGetEndpointIDHealthzNotFound creates a GetEndpointIDHealthzNotFound with default headers values -func NewGetEndpointIDHealthzNotFound() *GetEndpointIDHealthzNotFound { - return &GetEndpointIDHealthzNotFound{} -} - -/* -GetEndpointIDHealthzNotFound describes a response with status code 404, with default header values. - -Endpoint not found -*/ -type GetEndpointIDHealthzNotFound struct { -} - -// IsSuccess returns true when this get endpoint Id healthz not found response has a 2xx status code -func (o *GetEndpointIDHealthzNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get endpoint Id healthz not found response has a 3xx status code -func (o *GetEndpointIDHealthzNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get endpoint Id healthz not found response has a 4xx status code -func (o *GetEndpointIDHealthzNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this get endpoint Id healthz not found response has a 5xx status code -func (o *GetEndpointIDHealthzNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this get endpoint Id healthz not found response a status code equal to that given -func (o *GetEndpointIDHealthzNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the get endpoint Id healthz not found response -func (o *GetEndpointIDHealthzNotFound) Code() int { - return 404 -} - -func (o *GetEndpointIDHealthzNotFound) Error() string { - return fmt.Sprintf("[GET /endpoint/{id}/healthz][%d] getEndpointIdHealthzNotFound ", 404) -} - -func (o *GetEndpointIDHealthzNotFound) String() string { - return fmt.Sprintf("[GET /endpoint/{id}/healthz][%d] getEndpointIdHealthzNotFound ", 404) -} - -func (o *GetEndpointIDHealthzNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewGetEndpointIDHealthzTooManyRequests creates a GetEndpointIDHealthzTooManyRequests with default headers values -func NewGetEndpointIDHealthzTooManyRequests() *GetEndpointIDHealthzTooManyRequests { - return &GetEndpointIDHealthzTooManyRequests{} -} - -/* -GetEndpointIDHealthzTooManyRequests describes a response with status code 429, with default header values. - -Rate-limiting too many requests in the given time frame -*/ -type GetEndpointIDHealthzTooManyRequests struct { -} - -// IsSuccess returns true when this get endpoint Id healthz too many requests response has a 2xx status code -func (o *GetEndpointIDHealthzTooManyRequests) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get endpoint Id healthz too many requests response has a 3xx status code -func (o *GetEndpointIDHealthzTooManyRequests) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get endpoint Id healthz too many requests response has a 4xx status code -func (o *GetEndpointIDHealthzTooManyRequests) IsClientError() bool { - return true -} - -// IsServerError returns true when this get endpoint Id healthz too many requests response has a 5xx status code -func (o *GetEndpointIDHealthzTooManyRequests) IsServerError() bool { - return false -} - -// IsCode returns true when this get endpoint Id healthz too many requests response a status code equal to that given -func (o *GetEndpointIDHealthzTooManyRequests) IsCode(code int) bool { - return code == 429 -} - -// Code gets the status code for the get endpoint Id healthz too many requests response -func (o *GetEndpointIDHealthzTooManyRequests) Code() int { - return 429 -} - -func (o *GetEndpointIDHealthzTooManyRequests) Error() string { - return fmt.Sprintf("[GET /endpoint/{id}/healthz][%d] getEndpointIdHealthzTooManyRequests ", 429) -} - -func (o *GetEndpointIDHealthzTooManyRequests) String() string { - return fmt.Sprintf("[GET /endpoint/{id}/healthz][%d] getEndpointIdHealthzTooManyRequests ", 429) -} - -func (o *GetEndpointIDHealthzTooManyRequests) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_labels_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_labels_parameters.go deleted file mode 100644 index 27dc404ab..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_labels_parameters.go +++ /dev/null @@ -1,168 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetEndpointIDLabelsParams creates a new GetEndpointIDLabelsParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetEndpointIDLabelsParams() *GetEndpointIDLabelsParams { - return &GetEndpointIDLabelsParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetEndpointIDLabelsParamsWithTimeout creates a new GetEndpointIDLabelsParams object -// with the ability to set a timeout on a request. -func NewGetEndpointIDLabelsParamsWithTimeout(timeout time.Duration) *GetEndpointIDLabelsParams { - return &GetEndpointIDLabelsParams{ - timeout: timeout, - } -} - -// NewGetEndpointIDLabelsParamsWithContext creates a new GetEndpointIDLabelsParams object -// with the ability to set a context for a request. -func NewGetEndpointIDLabelsParamsWithContext(ctx context.Context) *GetEndpointIDLabelsParams { - return &GetEndpointIDLabelsParams{ - Context: ctx, - } -} - -// NewGetEndpointIDLabelsParamsWithHTTPClient creates a new GetEndpointIDLabelsParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetEndpointIDLabelsParamsWithHTTPClient(client *http.Client) *GetEndpointIDLabelsParams { - return &GetEndpointIDLabelsParams{ - HTTPClient: client, - } -} - -/* -GetEndpointIDLabelsParams contains all the parameters to send to the API endpoint - - for the get endpoint ID labels operation. - - Typically these are written to a http.Request. -*/ -type GetEndpointIDLabelsParams struct { - - /* ID. - - String describing an endpoint with the format ``[prefix:]id``. If no prefix - is specified, a prefix of ``cilium-local:`` is assumed. Not all endpoints - will be addressable by all endpoint ID prefixes with the exception of the - local Cilium UUID which is assigned to all endpoints. - - Supported endpoint id prefixes: - - cilium-local: Local Cilium endpoint UUID, e.g. cilium-local:3389595 - - cilium-global: Global Cilium endpoint UUID, e.g. cilium-global:cluster1:nodeX:452343 - - cni-attachment-id: CNI attachment ID, e.g. cni-attachment-id:22222:eth0 - - container-id: Container runtime ID, e.g. container-id:22222 (deprecated, may not be unique) - - container-name: Container name, e.g. container-name:foobar (deprecated, may not be unique) - - pod-name: pod name for this container if K8s is enabled, e.g. pod-name:default:foobar (deprecated, may not be unique) - - cep-name: cep name for this container if K8s is enabled, e.g. pod-name:default:foobar-net1 - - docker-endpoint: Docker libnetwork endpoint ID, e.g. docker-endpoint:4444 - - */ - ID string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get endpoint ID labels params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetEndpointIDLabelsParams) WithDefaults() *GetEndpointIDLabelsParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get endpoint ID labels params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetEndpointIDLabelsParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get endpoint ID labels params -func (o *GetEndpointIDLabelsParams) WithTimeout(timeout time.Duration) *GetEndpointIDLabelsParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get endpoint ID labels params -func (o *GetEndpointIDLabelsParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get endpoint ID labels params -func (o *GetEndpointIDLabelsParams) WithContext(ctx context.Context) *GetEndpointIDLabelsParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get endpoint ID labels params -func (o *GetEndpointIDLabelsParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get endpoint ID labels params -func (o *GetEndpointIDLabelsParams) WithHTTPClient(client *http.Client) *GetEndpointIDLabelsParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get endpoint ID labels params -func (o *GetEndpointIDLabelsParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithID adds the id to the get endpoint ID labels params -func (o *GetEndpointIDLabelsParams) WithID(id string) *GetEndpointIDLabelsParams { - o.SetID(id) - return o -} - -// SetID adds the id to the get endpoint ID labels params -func (o *GetEndpointIDLabelsParams) SetID(id string) { - o.ID = id -} - -// WriteToRequest writes these params to a swagger request -func (o *GetEndpointIDLabelsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - // path param id - if err := r.SetPathParam("id", o.ID); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_labels_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_labels_responses.go deleted file mode 100644 index 73d800164..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_labels_responses.go +++ /dev/null @@ -1,230 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetEndpointIDLabelsReader is a Reader for the GetEndpointIDLabels structure. -type GetEndpointIDLabelsReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetEndpointIDLabelsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetEndpointIDLabelsOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 404: - result := NewGetEndpointIDLabelsNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 429: - result := NewGetEndpointIDLabelsTooManyRequests() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /endpoint/{id}/labels] GetEndpointIDLabels", response, response.Code()) - } -} - -// NewGetEndpointIDLabelsOK creates a GetEndpointIDLabelsOK with default headers values -func NewGetEndpointIDLabelsOK() *GetEndpointIDLabelsOK { - return &GetEndpointIDLabelsOK{} -} - -/* -GetEndpointIDLabelsOK describes a response with status code 200, with default header values. - -Success -*/ -type GetEndpointIDLabelsOK struct { - Payload *models.LabelConfiguration -} - -// IsSuccess returns true when this get endpoint Id labels o k response has a 2xx status code -func (o *GetEndpointIDLabelsOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get endpoint Id labels o k response has a 3xx status code -func (o *GetEndpointIDLabelsOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get endpoint Id labels o k response has a 4xx status code -func (o *GetEndpointIDLabelsOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get endpoint Id labels o k response has a 5xx status code -func (o *GetEndpointIDLabelsOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get endpoint Id labels o k response a status code equal to that given -func (o *GetEndpointIDLabelsOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get endpoint Id labels o k response -func (o *GetEndpointIDLabelsOK) Code() int { - return 200 -} - -func (o *GetEndpointIDLabelsOK) Error() string { - return fmt.Sprintf("[GET /endpoint/{id}/labels][%d] getEndpointIdLabelsOK %+v", 200, o.Payload) -} - -func (o *GetEndpointIDLabelsOK) String() string { - return fmt.Sprintf("[GET /endpoint/{id}/labels][%d] getEndpointIdLabelsOK %+v", 200, o.Payload) -} - -func (o *GetEndpointIDLabelsOK) GetPayload() *models.LabelConfiguration { - return o.Payload -} - -func (o *GetEndpointIDLabelsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.LabelConfiguration) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetEndpointIDLabelsNotFound creates a GetEndpointIDLabelsNotFound with default headers values -func NewGetEndpointIDLabelsNotFound() *GetEndpointIDLabelsNotFound { - return &GetEndpointIDLabelsNotFound{} -} - -/* -GetEndpointIDLabelsNotFound describes a response with status code 404, with default header values. - -Endpoint not found -*/ -type GetEndpointIDLabelsNotFound struct { -} - -// IsSuccess returns true when this get endpoint Id labels not found response has a 2xx status code -func (o *GetEndpointIDLabelsNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get endpoint Id labels not found response has a 3xx status code -func (o *GetEndpointIDLabelsNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get endpoint Id labels not found response has a 4xx status code -func (o *GetEndpointIDLabelsNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this get endpoint Id labels not found response has a 5xx status code -func (o *GetEndpointIDLabelsNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this get endpoint Id labels not found response a status code equal to that given -func (o *GetEndpointIDLabelsNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the get endpoint Id labels not found response -func (o *GetEndpointIDLabelsNotFound) Code() int { - return 404 -} - -func (o *GetEndpointIDLabelsNotFound) Error() string { - return fmt.Sprintf("[GET /endpoint/{id}/labels][%d] getEndpointIdLabelsNotFound ", 404) -} - -func (o *GetEndpointIDLabelsNotFound) String() string { - return fmt.Sprintf("[GET /endpoint/{id}/labels][%d] getEndpointIdLabelsNotFound ", 404) -} - -func (o *GetEndpointIDLabelsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewGetEndpointIDLabelsTooManyRequests creates a GetEndpointIDLabelsTooManyRequests with default headers values -func NewGetEndpointIDLabelsTooManyRequests() *GetEndpointIDLabelsTooManyRequests { - return &GetEndpointIDLabelsTooManyRequests{} -} - -/* -GetEndpointIDLabelsTooManyRequests describes a response with status code 429, with default header values. - -Rate-limiting too many requests in the given time frame -*/ -type GetEndpointIDLabelsTooManyRequests struct { -} - -// IsSuccess returns true when this get endpoint Id labels too many requests response has a 2xx status code -func (o *GetEndpointIDLabelsTooManyRequests) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get endpoint Id labels too many requests response has a 3xx status code -func (o *GetEndpointIDLabelsTooManyRequests) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get endpoint Id labels too many requests response has a 4xx status code -func (o *GetEndpointIDLabelsTooManyRequests) IsClientError() bool { - return true -} - -// IsServerError returns true when this get endpoint Id labels too many requests response has a 5xx status code -func (o *GetEndpointIDLabelsTooManyRequests) IsServerError() bool { - return false -} - -// IsCode returns true when this get endpoint Id labels too many requests response a status code equal to that given -func (o *GetEndpointIDLabelsTooManyRequests) IsCode(code int) bool { - return code == 429 -} - -// Code gets the status code for the get endpoint Id labels too many requests response -func (o *GetEndpointIDLabelsTooManyRequests) Code() int { - return 429 -} - -func (o *GetEndpointIDLabelsTooManyRequests) Error() string { - return fmt.Sprintf("[GET /endpoint/{id}/labels][%d] getEndpointIdLabelsTooManyRequests ", 429) -} - -func (o *GetEndpointIDLabelsTooManyRequests) String() string { - return fmt.Sprintf("[GET /endpoint/{id}/labels][%d] getEndpointIdLabelsTooManyRequests ", 429) -} - -func (o *GetEndpointIDLabelsTooManyRequests) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_log_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_log_parameters.go deleted file mode 100644 index f93b295ca..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_log_parameters.go +++ /dev/null @@ -1,168 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetEndpointIDLogParams creates a new GetEndpointIDLogParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetEndpointIDLogParams() *GetEndpointIDLogParams { - return &GetEndpointIDLogParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetEndpointIDLogParamsWithTimeout creates a new GetEndpointIDLogParams object -// with the ability to set a timeout on a request. -func NewGetEndpointIDLogParamsWithTimeout(timeout time.Duration) *GetEndpointIDLogParams { - return &GetEndpointIDLogParams{ - timeout: timeout, - } -} - -// NewGetEndpointIDLogParamsWithContext creates a new GetEndpointIDLogParams object -// with the ability to set a context for a request. -func NewGetEndpointIDLogParamsWithContext(ctx context.Context) *GetEndpointIDLogParams { - return &GetEndpointIDLogParams{ - Context: ctx, - } -} - -// NewGetEndpointIDLogParamsWithHTTPClient creates a new GetEndpointIDLogParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetEndpointIDLogParamsWithHTTPClient(client *http.Client) *GetEndpointIDLogParams { - return &GetEndpointIDLogParams{ - HTTPClient: client, - } -} - -/* -GetEndpointIDLogParams contains all the parameters to send to the API endpoint - - for the get endpoint ID log operation. - - Typically these are written to a http.Request. -*/ -type GetEndpointIDLogParams struct { - - /* ID. - - String describing an endpoint with the format ``[prefix:]id``. If no prefix - is specified, a prefix of ``cilium-local:`` is assumed. Not all endpoints - will be addressable by all endpoint ID prefixes with the exception of the - local Cilium UUID which is assigned to all endpoints. - - Supported endpoint id prefixes: - - cilium-local: Local Cilium endpoint UUID, e.g. cilium-local:3389595 - - cilium-global: Global Cilium endpoint UUID, e.g. cilium-global:cluster1:nodeX:452343 - - cni-attachment-id: CNI attachment ID, e.g. cni-attachment-id:22222:eth0 - - container-id: Container runtime ID, e.g. container-id:22222 (deprecated, may not be unique) - - container-name: Container name, e.g. container-name:foobar (deprecated, may not be unique) - - pod-name: pod name for this container if K8s is enabled, e.g. pod-name:default:foobar (deprecated, may not be unique) - - cep-name: cep name for this container if K8s is enabled, e.g. pod-name:default:foobar-net1 - - docker-endpoint: Docker libnetwork endpoint ID, e.g. docker-endpoint:4444 - - */ - ID string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get endpoint ID log params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetEndpointIDLogParams) WithDefaults() *GetEndpointIDLogParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get endpoint ID log params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetEndpointIDLogParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get endpoint ID log params -func (o *GetEndpointIDLogParams) WithTimeout(timeout time.Duration) *GetEndpointIDLogParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get endpoint ID log params -func (o *GetEndpointIDLogParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get endpoint ID log params -func (o *GetEndpointIDLogParams) WithContext(ctx context.Context) *GetEndpointIDLogParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get endpoint ID log params -func (o *GetEndpointIDLogParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get endpoint ID log params -func (o *GetEndpointIDLogParams) WithHTTPClient(client *http.Client) *GetEndpointIDLogParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get endpoint ID log params -func (o *GetEndpointIDLogParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithID adds the id to the get endpoint ID log params -func (o *GetEndpointIDLogParams) WithID(id string) *GetEndpointIDLogParams { - o.SetID(id) - return o -} - -// SetID adds the id to the get endpoint ID log params -func (o *GetEndpointIDLogParams) SetID(id string) { - o.ID = id -} - -// WriteToRequest writes these params to a swagger request -func (o *GetEndpointIDLogParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - // path param id - if err := r.SetPathParam("id", o.ID); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_log_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_log_responses.go deleted file mode 100644 index 9ee4dd5f6..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_log_responses.go +++ /dev/null @@ -1,290 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetEndpointIDLogReader is a Reader for the GetEndpointIDLog structure. -type GetEndpointIDLogReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetEndpointIDLogReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetEndpointIDLogOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 400: - result := NewGetEndpointIDLogInvalid() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewGetEndpointIDLogNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 429: - result := NewGetEndpointIDLogTooManyRequests() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /endpoint/{id}/log] GetEndpointIDLog", response, response.Code()) - } -} - -// NewGetEndpointIDLogOK creates a GetEndpointIDLogOK with default headers values -func NewGetEndpointIDLogOK() *GetEndpointIDLogOK { - return &GetEndpointIDLogOK{} -} - -/* -GetEndpointIDLogOK describes a response with status code 200, with default header values. - -Success -*/ -type GetEndpointIDLogOK struct { - Payload models.EndpointStatusLog -} - -// IsSuccess returns true when this get endpoint Id log o k response has a 2xx status code -func (o *GetEndpointIDLogOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get endpoint Id log o k response has a 3xx status code -func (o *GetEndpointIDLogOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get endpoint Id log o k response has a 4xx status code -func (o *GetEndpointIDLogOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get endpoint Id log o k response has a 5xx status code -func (o *GetEndpointIDLogOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get endpoint Id log o k response a status code equal to that given -func (o *GetEndpointIDLogOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get endpoint Id log o k response -func (o *GetEndpointIDLogOK) Code() int { - return 200 -} - -func (o *GetEndpointIDLogOK) Error() string { - return fmt.Sprintf("[GET /endpoint/{id}/log][%d] getEndpointIdLogOK %+v", 200, o.Payload) -} - -func (o *GetEndpointIDLogOK) String() string { - return fmt.Sprintf("[GET /endpoint/{id}/log][%d] getEndpointIdLogOK %+v", 200, o.Payload) -} - -func (o *GetEndpointIDLogOK) GetPayload() models.EndpointStatusLog { - return o.Payload -} - -func (o *GetEndpointIDLogOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetEndpointIDLogInvalid creates a GetEndpointIDLogInvalid with default headers values -func NewGetEndpointIDLogInvalid() *GetEndpointIDLogInvalid { - return &GetEndpointIDLogInvalid{} -} - -/* -GetEndpointIDLogInvalid describes a response with status code 400, with default header values. - -Invalid identity provided -*/ -type GetEndpointIDLogInvalid struct { -} - -// IsSuccess returns true when this get endpoint Id log invalid response has a 2xx status code -func (o *GetEndpointIDLogInvalid) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get endpoint Id log invalid response has a 3xx status code -func (o *GetEndpointIDLogInvalid) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get endpoint Id log invalid response has a 4xx status code -func (o *GetEndpointIDLogInvalid) IsClientError() bool { - return true -} - -// IsServerError returns true when this get endpoint Id log invalid response has a 5xx status code -func (o *GetEndpointIDLogInvalid) IsServerError() bool { - return false -} - -// IsCode returns true when this get endpoint Id log invalid response a status code equal to that given -func (o *GetEndpointIDLogInvalid) IsCode(code int) bool { - return code == 400 -} - -// Code gets the status code for the get endpoint Id log invalid response -func (o *GetEndpointIDLogInvalid) Code() int { - return 400 -} - -func (o *GetEndpointIDLogInvalid) Error() string { - return fmt.Sprintf("[GET /endpoint/{id}/log][%d] getEndpointIdLogInvalid ", 400) -} - -func (o *GetEndpointIDLogInvalid) String() string { - return fmt.Sprintf("[GET /endpoint/{id}/log][%d] getEndpointIdLogInvalid ", 400) -} - -func (o *GetEndpointIDLogInvalid) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewGetEndpointIDLogNotFound creates a GetEndpointIDLogNotFound with default headers values -func NewGetEndpointIDLogNotFound() *GetEndpointIDLogNotFound { - return &GetEndpointIDLogNotFound{} -} - -/* -GetEndpointIDLogNotFound describes a response with status code 404, with default header values. - -Endpoint not found -*/ -type GetEndpointIDLogNotFound struct { -} - -// IsSuccess returns true when this get endpoint Id log not found response has a 2xx status code -func (o *GetEndpointIDLogNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get endpoint Id log not found response has a 3xx status code -func (o *GetEndpointIDLogNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get endpoint Id log not found response has a 4xx status code -func (o *GetEndpointIDLogNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this get endpoint Id log not found response has a 5xx status code -func (o *GetEndpointIDLogNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this get endpoint Id log not found response a status code equal to that given -func (o *GetEndpointIDLogNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the get endpoint Id log not found response -func (o *GetEndpointIDLogNotFound) Code() int { - return 404 -} - -func (o *GetEndpointIDLogNotFound) Error() string { - return fmt.Sprintf("[GET /endpoint/{id}/log][%d] getEndpointIdLogNotFound ", 404) -} - -func (o *GetEndpointIDLogNotFound) String() string { - return fmt.Sprintf("[GET /endpoint/{id}/log][%d] getEndpointIdLogNotFound ", 404) -} - -func (o *GetEndpointIDLogNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewGetEndpointIDLogTooManyRequests creates a GetEndpointIDLogTooManyRequests with default headers values -func NewGetEndpointIDLogTooManyRequests() *GetEndpointIDLogTooManyRequests { - return &GetEndpointIDLogTooManyRequests{} -} - -/* -GetEndpointIDLogTooManyRequests describes a response with status code 429, with default header values. - -Rate-limiting too many requests in the given time frame -*/ -type GetEndpointIDLogTooManyRequests struct { -} - -// IsSuccess returns true when this get endpoint Id log too many requests response has a 2xx status code -func (o *GetEndpointIDLogTooManyRequests) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get endpoint Id log too many requests response has a 3xx status code -func (o *GetEndpointIDLogTooManyRequests) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get endpoint Id log too many requests response has a 4xx status code -func (o *GetEndpointIDLogTooManyRequests) IsClientError() bool { - return true -} - -// IsServerError returns true when this get endpoint Id log too many requests response has a 5xx status code -func (o *GetEndpointIDLogTooManyRequests) IsServerError() bool { - return false -} - -// IsCode returns true when this get endpoint Id log too many requests response a status code equal to that given -func (o *GetEndpointIDLogTooManyRequests) IsCode(code int) bool { - return code == 429 -} - -// Code gets the status code for the get endpoint Id log too many requests response -func (o *GetEndpointIDLogTooManyRequests) Code() int { - return 429 -} - -func (o *GetEndpointIDLogTooManyRequests) Error() string { - return fmt.Sprintf("[GET /endpoint/{id}/log][%d] getEndpointIdLogTooManyRequests ", 429) -} - -func (o *GetEndpointIDLogTooManyRequests) String() string { - return fmt.Sprintf("[GET /endpoint/{id}/log][%d] getEndpointIdLogTooManyRequests ", 429) -} - -func (o *GetEndpointIDLogTooManyRequests) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_parameters.go deleted file mode 100644 index 4bad76a97..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_parameters.go +++ /dev/null @@ -1,168 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetEndpointIDParams creates a new GetEndpointIDParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetEndpointIDParams() *GetEndpointIDParams { - return &GetEndpointIDParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetEndpointIDParamsWithTimeout creates a new GetEndpointIDParams object -// with the ability to set a timeout on a request. -func NewGetEndpointIDParamsWithTimeout(timeout time.Duration) *GetEndpointIDParams { - return &GetEndpointIDParams{ - timeout: timeout, - } -} - -// NewGetEndpointIDParamsWithContext creates a new GetEndpointIDParams object -// with the ability to set a context for a request. -func NewGetEndpointIDParamsWithContext(ctx context.Context) *GetEndpointIDParams { - return &GetEndpointIDParams{ - Context: ctx, - } -} - -// NewGetEndpointIDParamsWithHTTPClient creates a new GetEndpointIDParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetEndpointIDParamsWithHTTPClient(client *http.Client) *GetEndpointIDParams { - return &GetEndpointIDParams{ - HTTPClient: client, - } -} - -/* -GetEndpointIDParams contains all the parameters to send to the API endpoint - - for the get endpoint ID operation. - - Typically these are written to a http.Request. -*/ -type GetEndpointIDParams struct { - - /* ID. - - String describing an endpoint with the format ``[prefix:]id``. If no prefix - is specified, a prefix of ``cilium-local:`` is assumed. Not all endpoints - will be addressable by all endpoint ID prefixes with the exception of the - local Cilium UUID which is assigned to all endpoints. - - Supported endpoint id prefixes: - - cilium-local: Local Cilium endpoint UUID, e.g. cilium-local:3389595 - - cilium-global: Global Cilium endpoint UUID, e.g. cilium-global:cluster1:nodeX:452343 - - cni-attachment-id: CNI attachment ID, e.g. cni-attachment-id:22222:eth0 - - container-id: Container runtime ID, e.g. container-id:22222 (deprecated, may not be unique) - - container-name: Container name, e.g. container-name:foobar (deprecated, may not be unique) - - pod-name: pod name for this container if K8s is enabled, e.g. pod-name:default:foobar (deprecated, may not be unique) - - cep-name: cep name for this container if K8s is enabled, e.g. pod-name:default:foobar-net1 - - docker-endpoint: Docker libnetwork endpoint ID, e.g. docker-endpoint:4444 - - */ - ID string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get endpoint ID params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetEndpointIDParams) WithDefaults() *GetEndpointIDParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get endpoint ID params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetEndpointIDParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get endpoint ID params -func (o *GetEndpointIDParams) WithTimeout(timeout time.Duration) *GetEndpointIDParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get endpoint ID params -func (o *GetEndpointIDParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get endpoint ID params -func (o *GetEndpointIDParams) WithContext(ctx context.Context) *GetEndpointIDParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get endpoint ID params -func (o *GetEndpointIDParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get endpoint ID params -func (o *GetEndpointIDParams) WithHTTPClient(client *http.Client) *GetEndpointIDParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get endpoint ID params -func (o *GetEndpointIDParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithID adds the id to the get endpoint ID params -func (o *GetEndpointIDParams) WithID(id string) *GetEndpointIDParams { - o.SetID(id) - return o -} - -// SetID adds the id to the get endpoint ID params -func (o *GetEndpointIDParams) SetID(id string) { - o.ID = id -} - -// WriteToRequest writes these params to a swagger request -func (o *GetEndpointIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - // path param id - if err := r.SetPathParam("id", o.ID); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_responses.go deleted file mode 100644 index e2e9a0955..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_id_responses.go +++ /dev/null @@ -1,302 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetEndpointIDReader is a Reader for the GetEndpointID structure. -type GetEndpointIDReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetEndpointIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetEndpointIDOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 400: - result := NewGetEndpointIDInvalid() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewGetEndpointIDNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 429: - result := NewGetEndpointIDTooManyRequests() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /endpoint/{id}] GetEndpointID", response, response.Code()) - } -} - -// NewGetEndpointIDOK creates a GetEndpointIDOK with default headers values -func NewGetEndpointIDOK() *GetEndpointIDOK { - return &GetEndpointIDOK{} -} - -/* -GetEndpointIDOK describes a response with status code 200, with default header values. - -Success -*/ -type GetEndpointIDOK struct { - Payload *models.Endpoint -} - -// IsSuccess returns true when this get endpoint Id o k response has a 2xx status code -func (o *GetEndpointIDOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get endpoint Id o k response has a 3xx status code -func (o *GetEndpointIDOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get endpoint Id o k response has a 4xx status code -func (o *GetEndpointIDOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get endpoint Id o k response has a 5xx status code -func (o *GetEndpointIDOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get endpoint Id o k response a status code equal to that given -func (o *GetEndpointIDOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get endpoint Id o k response -func (o *GetEndpointIDOK) Code() int { - return 200 -} - -func (o *GetEndpointIDOK) Error() string { - return fmt.Sprintf("[GET /endpoint/{id}][%d] getEndpointIdOK %+v", 200, o.Payload) -} - -func (o *GetEndpointIDOK) String() string { - return fmt.Sprintf("[GET /endpoint/{id}][%d] getEndpointIdOK %+v", 200, o.Payload) -} - -func (o *GetEndpointIDOK) GetPayload() *models.Endpoint { - return o.Payload -} - -func (o *GetEndpointIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.Endpoint) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetEndpointIDInvalid creates a GetEndpointIDInvalid with default headers values -func NewGetEndpointIDInvalid() *GetEndpointIDInvalid { - return &GetEndpointIDInvalid{} -} - -/* -GetEndpointIDInvalid describes a response with status code 400, with default header values. - -Invalid endpoint ID format for specified type -*/ -type GetEndpointIDInvalid struct { - Payload models.Error -} - -// IsSuccess returns true when this get endpoint Id invalid response has a 2xx status code -func (o *GetEndpointIDInvalid) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get endpoint Id invalid response has a 3xx status code -func (o *GetEndpointIDInvalid) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get endpoint Id invalid response has a 4xx status code -func (o *GetEndpointIDInvalid) IsClientError() bool { - return true -} - -// IsServerError returns true when this get endpoint Id invalid response has a 5xx status code -func (o *GetEndpointIDInvalid) IsServerError() bool { - return false -} - -// IsCode returns true when this get endpoint Id invalid response a status code equal to that given -func (o *GetEndpointIDInvalid) IsCode(code int) bool { - return code == 400 -} - -// Code gets the status code for the get endpoint Id invalid response -func (o *GetEndpointIDInvalid) Code() int { - return 400 -} - -func (o *GetEndpointIDInvalid) Error() string { - return fmt.Sprintf("[GET /endpoint/{id}][%d] getEndpointIdInvalid %+v", 400, o.Payload) -} - -func (o *GetEndpointIDInvalid) String() string { - return fmt.Sprintf("[GET /endpoint/{id}][%d] getEndpointIdInvalid %+v", 400, o.Payload) -} - -func (o *GetEndpointIDInvalid) GetPayload() models.Error { - return o.Payload -} - -func (o *GetEndpointIDInvalid) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetEndpointIDNotFound creates a GetEndpointIDNotFound with default headers values -func NewGetEndpointIDNotFound() *GetEndpointIDNotFound { - return &GetEndpointIDNotFound{} -} - -/* -GetEndpointIDNotFound describes a response with status code 404, with default header values. - -Endpoint not found -*/ -type GetEndpointIDNotFound struct { -} - -// IsSuccess returns true when this get endpoint Id not found response has a 2xx status code -func (o *GetEndpointIDNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get endpoint Id not found response has a 3xx status code -func (o *GetEndpointIDNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get endpoint Id not found response has a 4xx status code -func (o *GetEndpointIDNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this get endpoint Id not found response has a 5xx status code -func (o *GetEndpointIDNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this get endpoint Id not found response a status code equal to that given -func (o *GetEndpointIDNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the get endpoint Id not found response -func (o *GetEndpointIDNotFound) Code() int { - return 404 -} - -func (o *GetEndpointIDNotFound) Error() string { - return fmt.Sprintf("[GET /endpoint/{id}][%d] getEndpointIdNotFound ", 404) -} - -func (o *GetEndpointIDNotFound) String() string { - return fmt.Sprintf("[GET /endpoint/{id}][%d] getEndpointIdNotFound ", 404) -} - -func (o *GetEndpointIDNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewGetEndpointIDTooManyRequests creates a GetEndpointIDTooManyRequests with default headers values -func NewGetEndpointIDTooManyRequests() *GetEndpointIDTooManyRequests { - return &GetEndpointIDTooManyRequests{} -} - -/* -GetEndpointIDTooManyRequests describes a response with status code 429, with default header values. - -Rate-limiting too many requests in the given time frame -*/ -type GetEndpointIDTooManyRequests struct { -} - -// IsSuccess returns true when this get endpoint Id too many requests response has a 2xx status code -func (o *GetEndpointIDTooManyRequests) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get endpoint Id too many requests response has a 3xx status code -func (o *GetEndpointIDTooManyRequests) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get endpoint Id too many requests response has a 4xx status code -func (o *GetEndpointIDTooManyRequests) IsClientError() bool { - return true -} - -// IsServerError returns true when this get endpoint Id too many requests response has a 5xx status code -func (o *GetEndpointIDTooManyRequests) IsServerError() bool { - return false -} - -// IsCode returns true when this get endpoint Id too many requests response a status code equal to that given -func (o *GetEndpointIDTooManyRequests) IsCode(code int) bool { - return code == 429 -} - -// Code gets the status code for the get endpoint Id too many requests response -func (o *GetEndpointIDTooManyRequests) Code() int { - return 429 -} - -func (o *GetEndpointIDTooManyRequests) Error() string { - return fmt.Sprintf("[GET /endpoint/{id}][%d] getEndpointIdTooManyRequests ", 429) -} - -func (o *GetEndpointIDTooManyRequests) String() string { - return fmt.Sprintf("[GET /endpoint/{id}][%d] getEndpointIdTooManyRequests ", 429) -} - -func (o *GetEndpointIDTooManyRequests) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_parameters.go deleted file mode 100644 index fa20da9d3..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_parameters.go +++ /dev/null @@ -1,157 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// NewGetEndpointParams creates a new GetEndpointParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetEndpointParams() *GetEndpointParams { - return &GetEndpointParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetEndpointParamsWithTimeout creates a new GetEndpointParams object -// with the ability to set a timeout on a request. -func NewGetEndpointParamsWithTimeout(timeout time.Duration) *GetEndpointParams { - return &GetEndpointParams{ - timeout: timeout, - } -} - -// NewGetEndpointParamsWithContext creates a new GetEndpointParams object -// with the ability to set a context for a request. -func NewGetEndpointParamsWithContext(ctx context.Context) *GetEndpointParams { - return &GetEndpointParams{ - Context: ctx, - } -} - -// NewGetEndpointParamsWithHTTPClient creates a new GetEndpointParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetEndpointParamsWithHTTPClient(client *http.Client) *GetEndpointParams { - return &GetEndpointParams{ - HTTPClient: client, - } -} - -/* -GetEndpointParams contains all the parameters to send to the API endpoint - - for the get endpoint operation. - - Typically these are written to a http.Request. -*/ -type GetEndpointParams struct { - - /* Labels. - - List of labels - - */ - Labels models.Labels - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get endpoint params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetEndpointParams) WithDefaults() *GetEndpointParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get endpoint params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetEndpointParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get endpoint params -func (o *GetEndpointParams) WithTimeout(timeout time.Duration) *GetEndpointParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get endpoint params -func (o *GetEndpointParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get endpoint params -func (o *GetEndpointParams) WithContext(ctx context.Context) *GetEndpointParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get endpoint params -func (o *GetEndpointParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get endpoint params -func (o *GetEndpointParams) WithHTTPClient(client *http.Client) *GetEndpointParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get endpoint params -func (o *GetEndpointParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithLabels adds the labels to the get endpoint params -func (o *GetEndpointParams) WithLabels(labels models.Labels) *GetEndpointParams { - o.SetLabels(labels) - return o -} - -// SetLabels adds the labels to the get endpoint params -func (o *GetEndpointParams) SetLabels(labels models.Labels) { - o.Labels = labels -} - -// WriteToRequest writes these params to a swagger request -func (o *GetEndpointParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if o.Labels != nil { - if err := r.SetBodyParam(o.Labels); err != nil { - return err - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_responses.go deleted file mode 100644 index dae5541d4..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/get_endpoint_responses.go +++ /dev/null @@ -1,228 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetEndpointReader is a Reader for the GetEndpoint structure. -type GetEndpointReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetEndpointReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetEndpointOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 404: - result := NewGetEndpointNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 429: - result := NewGetEndpointTooManyRequests() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /endpoint] GetEndpoint", response, response.Code()) - } -} - -// NewGetEndpointOK creates a GetEndpointOK with default headers values -func NewGetEndpointOK() *GetEndpointOK { - return &GetEndpointOK{} -} - -/* -GetEndpointOK describes a response with status code 200, with default header values. - -Success -*/ -type GetEndpointOK struct { - Payload []*models.Endpoint -} - -// IsSuccess returns true when this get endpoint o k response has a 2xx status code -func (o *GetEndpointOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get endpoint o k response has a 3xx status code -func (o *GetEndpointOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get endpoint o k response has a 4xx status code -func (o *GetEndpointOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get endpoint o k response has a 5xx status code -func (o *GetEndpointOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get endpoint o k response a status code equal to that given -func (o *GetEndpointOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get endpoint o k response -func (o *GetEndpointOK) Code() int { - return 200 -} - -func (o *GetEndpointOK) Error() string { - return fmt.Sprintf("[GET /endpoint][%d] getEndpointOK %+v", 200, o.Payload) -} - -func (o *GetEndpointOK) String() string { - return fmt.Sprintf("[GET /endpoint][%d] getEndpointOK %+v", 200, o.Payload) -} - -func (o *GetEndpointOK) GetPayload() []*models.Endpoint { - return o.Payload -} - -func (o *GetEndpointOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetEndpointNotFound creates a GetEndpointNotFound with default headers values -func NewGetEndpointNotFound() *GetEndpointNotFound { - return &GetEndpointNotFound{} -} - -/* -GetEndpointNotFound describes a response with status code 404, with default header values. - -Endpoints with provided parameters not found -*/ -type GetEndpointNotFound struct { -} - -// IsSuccess returns true when this get endpoint not found response has a 2xx status code -func (o *GetEndpointNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get endpoint not found response has a 3xx status code -func (o *GetEndpointNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get endpoint not found response has a 4xx status code -func (o *GetEndpointNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this get endpoint not found response has a 5xx status code -func (o *GetEndpointNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this get endpoint not found response a status code equal to that given -func (o *GetEndpointNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the get endpoint not found response -func (o *GetEndpointNotFound) Code() int { - return 404 -} - -func (o *GetEndpointNotFound) Error() string { - return fmt.Sprintf("[GET /endpoint][%d] getEndpointNotFound ", 404) -} - -func (o *GetEndpointNotFound) String() string { - return fmt.Sprintf("[GET /endpoint][%d] getEndpointNotFound ", 404) -} - -func (o *GetEndpointNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewGetEndpointTooManyRequests creates a GetEndpointTooManyRequests with default headers values -func NewGetEndpointTooManyRequests() *GetEndpointTooManyRequests { - return &GetEndpointTooManyRequests{} -} - -/* -GetEndpointTooManyRequests describes a response with status code 429, with default header values. - -Rate-limiting too many requests in the given time frame -*/ -type GetEndpointTooManyRequests struct { -} - -// IsSuccess returns true when this get endpoint too many requests response has a 2xx status code -func (o *GetEndpointTooManyRequests) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get endpoint too many requests response has a 3xx status code -func (o *GetEndpointTooManyRequests) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get endpoint too many requests response has a 4xx status code -func (o *GetEndpointTooManyRequests) IsClientError() bool { - return true -} - -// IsServerError returns true when this get endpoint too many requests response has a 5xx status code -func (o *GetEndpointTooManyRequests) IsServerError() bool { - return false -} - -// IsCode returns true when this get endpoint too many requests response a status code equal to that given -func (o *GetEndpointTooManyRequests) IsCode(code int) bool { - return code == 429 -} - -// Code gets the status code for the get endpoint too many requests response -func (o *GetEndpointTooManyRequests) Code() int { - return 429 -} - -func (o *GetEndpointTooManyRequests) Error() string { - return fmt.Sprintf("[GET /endpoint][%d] getEndpointTooManyRequests ", 429) -} - -func (o *GetEndpointTooManyRequests) String() string { - return fmt.Sprintf("[GET /endpoint][%d] getEndpointTooManyRequests ", 429) -} - -func (o *GetEndpointTooManyRequests) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/patch_endpoint_id_config_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/patch_endpoint_id_config_parameters.go deleted file mode 100644 index 9ecd8ef8a..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/patch_endpoint_id_config_parameters.go +++ /dev/null @@ -1,189 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// NewPatchEndpointIDConfigParams creates a new PatchEndpointIDConfigParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewPatchEndpointIDConfigParams() *PatchEndpointIDConfigParams { - return &PatchEndpointIDConfigParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewPatchEndpointIDConfigParamsWithTimeout creates a new PatchEndpointIDConfigParams object -// with the ability to set a timeout on a request. -func NewPatchEndpointIDConfigParamsWithTimeout(timeout time.Duration) *PatchEndpointIDConfigParams { - return &PatchEndpointIDConfigParams{ - timeout: timeout, - } -} - -// NewPatchEndpointIDConfigParamsWithContext creates a new PatchEndpointIDConfigParams object -// with the ability to set a context for a request. -func NewPatchEndpointIDConfigParamsWithContext(ctx context.Context) *PatchEndpointIDConfigParams { - return &PatchEndpointIDConfigParams{ - Context: ctx, - } -} - -// NewPatchEndpointIDConfigParamsWithHTTPClient creates a new PatchEndpointIDConfigParams object -// with the ability to set a custom HTTPClient for a request. -func NewPatchEndpointIDConfigParamsWithHTTPClient(client *http.Client) *PatchEndpointIDConfigParams { - return &PatchEndpointIDConfigParams{ - HTTPClient: client, - } -} - -/* -PatchEndpointIDConfigParams contains all the parameters to send to the API endpoint - - for the patch endpoint ID config operation. - - Typically these are written to a http.Request. -*/ -type PatchEndpointIDConfigParams struct { - - // EndpointConfiguration. - EndpointConfiguration *models.EndpointConfigurationSpec - - /* ID. - - String describing an endpoint with the format ``[prefix:]id``. If no prefix - is specified, a prefix of ``cilium-local:`` is assumed. Not all endpoints - will be addressable by all endpoint ID prefixes with the exception of the - local Cilium UUID which is assigned to all endpoints. - - Supported endpoint id prefixes: - - cilium-local: Local Cilium endpoint UUID, e.g. cilium-local:3389595 - - cilium-global: Global Cilium endpoint UUID, e.g. cilium-global:cluster1:nodeX:452343 - - cni-attachment-id: CNI attachment ID, e.g. cni-attachment-id:22222:eth0 - - container-id: Container runtime ID, e.g. container-id:22222 (deprecated, may not be unique) - - container-name: Container name, e.g. container-name:foobar (deprecated, may not be unique) - - pod-name: pod name for this container if K8s is enabled, e.g. pod-name:default:foobar (deprecated, may not be unique) - - cep-name: cep name for this container if K8s is enabled, e.g. pod-name:default:foobar-net1 - - docker-endpoint: Docker libnetwork endpoint ID, e.g. docker-endpoint:4444 - - */ - ID string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the patch endpoint ID config params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PatchEndpointIDConfigParams) WithDefaults() *PatchEndpointIDConfigParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the patch endpoint ID config params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PatchEndpointIDConfigParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the patch endpoint ID config params -func (o *PatchEndpointIDConfigParams) WithTimeout(timeout time.Duration) *PatchEndpointIDConfigParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the patch endpoint ID config params -func (o *PatchEndpointIDConfigParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the patch endpoint ID config params -func (o *PatchEndpointIDConfigParams) WithContext(ctx context.Context) *PatchEndpointIDConfigParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the patch endpoint ID config params -func (o *PatchEndpointIDConfigParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the patch endpoint ID config params -func (o *PatchEndpointIDConfigParams) WithHTTPClient(client *http.Client) *PatchEndpointIDConfigParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the patch endpoint ID config params -func (o *PatchEndpointIDConfigParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithEndpointConfiguration adds the endpointConfiguration to the patch endpoint ID config params -func (o *PatchEndpointIDConfigParams) WithEndpointConfiguration(endpointConfiguration *models.EndpointConfigurationSpec) *PatchEndpointIDConfigParams { - o.SetEndpointConfiguration(endpointConfiguration) - return o -} - -// SetEndpointConfiguration adds the endpointConfiguration to the patch endpoint ID config params -func (o *PatchEndpointIDConfigParams) SetEndpointConfiguration(endpointConfiguration *models.EndpointConfigurationSpec) { - o.EndpointConfiguration = endpointConfiguration -} - -// WithID adds the id to the patch endpoint ID config params -func (o *PatchEndpointIDConfigParams) WithID(id string) *PatchEndpointIDConfigParams { - o.SetID(id) - return o -} - -// SetID adds the id to the patch endpoint ID config params -func (o *PatchEndpointIDConfigParams) SetID(id string) { - o.ID = id -} - -// WriteToRequest writes these params to a swagger request -func (o *PatchEndpointIDConfigParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if o.EndpointConfiguration != nil { - if err := r.SetBodyParam(o.EndpointConfiguration); err != nil { - return err - } - } - - // path param id - if err := r.SetPathParam("id", o.ID); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/patch_endpoint_id_config_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/patch_endpoint_id_config_responses.go deleted file mode 100644 index 993fc07ef..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/patch_endpoint_id_config_responses.go +++ /dev/null @@ -1,414 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// PatchEndpointIDConfigReader is a Reader for the PatchEndpointIDConfig structure. -type PatchEndpointIDConfigReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *PatchEndpointIDConfigReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewPatchEndpointIDConfigOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 400: - result := NewPatchEndpointIDConfigInvalid() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 403: - result := NewPatchEndpointIDConfigForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewPatchEndpointIDConfigNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 429: - result := NewPatchEndpointIDConfigTooManyRequests() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewPatchEndpointIDConfigFailed() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[PATCH /endpoint/{id}/config] PatchEndpointIDConfig", response, response.Code()) - } -} - -// NewPatchEndpointIDConfigOK creates a PatchEndpointIDConfigOK with default headers values -func NewPatchEndpointIDConfigOK() *PatchEndpointIDConfigOK { - return &PatchEndpointIDConfigOK{} -} - -/* -PatchEndpointIDConfigOK describes a response with status code 200, with default header values. - -Success -*/ -type PatchEndpointIDConfigOK struct { -} - -// IsSuccess returns true when this patch endpoint Id config o k response has a 2xx status code -func (o *PatchEndpointIDConfigOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this patch endpoint Id config o k response has a 3xx status code -func (o *PatchEndpointIDConfigOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch endpoint Id config o k response has a 4xx status code -func (o *PatchEndpointIDConfigOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this patch endpoint Id config o k response has a 5xx status code -func (o *PatchEndpointIDConfigOK) IsServerError() bool { - return false -} - -// IsCode returns true when this patch endpoint Id config o k response a status code equal to that given -func (o *PatchEndpointIDConfigOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the patch endpoint Id config o k response -func (o *PatchEndpointIDConfigOK) Code() int { - return 200 -} - -func (o *PatchEndpointIDConfigOK) Error() string { - return fmt.Sprintf("[PATCH /endpoint/{id}/config][%d] patchEndpointIdConfigOK ", 200) -} - -func (o *PatchEndpointIDConfigOK) String() string { - return fmt.Sprintf("[PATCH /endpoint/{id}/config][%d] patchEndpointIdConfigOK ", 200) -} - -func (o *PatchEndpointIDConfigOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPatchEndpointIDConfigInvalid creates a PatchEndpointIDConfigInvalid with default headers values -func NewPatchEndpointIDConfigInvalid() *PatchEndpointIDConfigInvalid { - return &PatchEndpointIDConfigInvalid{} -} - -/* -PatchEndpointIDConfigInvalid describes a response with status code 400, with default header values. - -Invalid configuration request -*/ -type PatchEndpointIDConfigInvalid struct { -} - -// IsSuccess returns true when this patch endpoint Id config invalid response has a 2xx status code -func (o *PatchEndpointIDConfigInvalid) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this patch endpoint Id config invalid response has a 3xx status code -func (o *PatchEndpointIDConfigInvalid) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch endpoint Id config invalid response has a 4xx status code -func (o *PatchEndpointIDConfigInvalid) IsClientError() bool { - return true -} - -// IsServerError returns true when this patch endpoint Id config invalid response has a 5xx status code -func (o *PatchEndpointIDConfigInvalid) IsServerError() bool { - return false -} - -// IsCode returns true when this patch endpoint Id config invalid response a status code equal to that given -func (o *PatchEndpointIDConfigInvalid) IsCode(code int) bool { - return code == 400 -} - -// Code gets the status code for the patch endpoint Id config invalid response -func (o *PatchEndpointIDConfigInvalid) Code() int { - return 400 -} - -func (o *PatchEndpointIDConfigInvalid) Error() string { - return fmt.Sprintf("[PATCH /endpoint/{id}/config][%d] patchEndpointIdConfigInvalid ", 400) -} - -func (o *PatchEndpointIDConfigInvalid) String() string { - return fmt.Sprintf("[PATCH /endpoint/{id}/config][%d] patchEndpointIdConfigInvalid ", 400) -} - -func (o *PatchEndpointIDConfigInvalid) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPatchEndpointIDConfigForbidden creates a PatchEndpointIDConfigForbidden with default headers values -func NewPatchEndpointIDConfigForbidden() *PatchEndpointIDConfigForbidden { - return &PatchEndpointIDConfigForbidden{} -} - -/* -PatchEndpointIDConfigForbidden describes a response with status code 403, with default header values. - -Forbidden -*/ -type PatchEndpointIDConfigForbidden struct { -} - -// IsSuccess returns true when this patch endpoint Id config forbidden response has a 2xx status code -func (o *PatchEndpointIDConfigForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this patch endpoint Id config forbidden response has a 3xx status code -func (o *PatchEndpointIDConfigForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch endpoint Id config forbidden response has a 4xx status code -func (o *PatchEndpointIDConfigForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this patch endpoint Id config forbidden response has a 5xx status code -func (o *PatchEndpointIDConfigForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this patch endpoint Id config forbidden response a status code equal to that given -func (o *PatchEndpointIDConfigForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the patch endpoint Id config forbidden response -func (o *PatchEndpointIDConfigForbidden) Code() int { - return 403 -} - -func (o *PatchEndpointIDConfigForbidden) Error() string { - return fmt.Sprintf("[PATCH /endpoint/{id}/config][%d] patchEndpointIdConfigForbidden ", 403) -} - -func (o *PatchEndpointIDConfigForbidden) String() string { - return fmt.Sprintf("[PATCH /endpoint/{id}/config][%d] patchEndpointIdConfigForbidden ", 403) -} - -func (o *PatchEndpointIDConfigForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPatchEndpointIDConfigNotFound creates a PatchEndpointIDConfigNotFound with default headers values -func NewPatchEndpointIDConfigNotFound() *PatchEndpointIDConfigNotFound { - return &PatchEndpointIDConfigNotFound{} -} - -/* -PatchEndpointIDConfigNotFound describes a response with status code 404, with default header values. - -Endpoint not found -*/ -type PatchEndpointIDConfigNotFound struct { -} - -// IsSuccess returns true when this patch endpoint Id config not found response has a 2xx status code -func (o *PatchEndpointIDConfigNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this patch endpoint Id config not found response has a 3xx status code -func (o *PatchEndpointIDConfigNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch endpoint Id config not found response has a 4xx status code -func (o *PatchEndpointIDConfigNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this patch endpoint Id config not found response has a 5xx status code -func (o *PatchEndpointIDConfigNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this patch endpoint Id config not found response a status code equal to that given -func (o *PatchEndpointIDConfigNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the patch endpoint Id config not found response -func (o *PatchEndpointIDConfigNotFound) Code() int { - return 404 -} - -func (o *PatchEndpointIDConfigNotFound) Error() string { - return fmt.Sprintf("[PATCH /endpoint/{id}/config][%d] patchEndpointIdConfigNotFound ", 404) -} - -func (o *PatchEndpointIDConfigNotFound) String() string { - return fmt.Sprintf("[PATCH /endpoint/{id}/config][%d] patchEndpointIdConfigNotFound ", 404) -} - -func (o *PatchEndpointIDConfigNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPatchEndpointIDConfigTooManyRequests creates a PatchEndpointIDConfigTooManyRequests with default headers values -func NewPatchEndpointIDConfigTooManyRequests() *PatchEndpointIDConfigTooManyRequests { - return &PatchEndpointIDConfigTooManyRequests{} -} - -/* -PatchEndpointIDConfigTooManyRequests describes a response with status code 429, with default header values. - -Rate-limiting too many requests in the given time frame -*/ -type PatchEndpointIDConfigTooManyRequests struct { -} - -// IsSuccess returns true when this patch endpoint Id config too many requests response has a 2xx status code -func (o *PatchEndpointIDConfigTooManyRequests) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this patch endpoint Id config too many requests response has a 3xx status code -func (o *PatchEndpointIDConfigTooManyRequests) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch endpoint Id config too many requests response has a 4xx status code -func (o *PatchEndpointIDConfigTooManyRequests) IsClientError() bool { - return true -} - -// IsServerError returns true when this patch endpoint Id config too many requests response has a 5xx status code -func (o *PatchEndpointIDConfigTooManyRequests) IsServerError() bool { - return false -} - -// IsCode returns true when this patch endpoint Id config too many requests response a status code equal to that given -func (o *PatchEndpointIDConfigTooManyRequests) IsCode(code int) bool { - return code == 429 -} - -// Code gets the status code for the patch endpoint Id config too many requests response -func (o *PatchEndpointIDConfigTooManyRequests) Code() int { - return 429 -} - -func (o *PatchEndpointIDConfigTooManyRequests) Error() string { - return fmt.Sprintf("[PATCH /endpoint/{id}/config][%d] patchEndpointIdConfigTooManyRequests ", 429) -} - -func (o *PatchEndpointIDConfigTooManyRequests) String() string { - return fmt.Sprintf("[PATCH /endpoint/{id}/config][%d] patchEndpointIdConfigTooManyRequests ", 429) -} - -func (o *PatchEndpointIDConfigTooManyRequests) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPatchEndpointIDConfigFailed creates a PatchEndpointIDConfigFailed with default headers values -func NewPatchEndpointIDConfigFailed() *PatchEndpointIDConfigFailed { - return &PatchEndpointIDConfigFailed{} -} - -/* -PatchEndpointIDConfigFailed describes a response with status code 500, with default header values. - -Update failed. Details in message. -*/ -type PatchEndpointIDConfigFailed struct { - Payload models.Error -} - -// IsSuccess returns true when this patch endpoint Id config failed response has a 2xx status code -func (o *PatchEndpointIDConfigFailed) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this patch endpoint Id config failed response has a 3xx status code -func (o *PatchEndpointIDConfigFailed) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch endpoint Id config failed response has a 4xx status code -func (o *PatchEndpointIDConfigFailed) IsClientError() bool { - return false -} - -// IsServerError returns true when this patch endpoint Id config failed response has a 5xx status code -func (o *PatchEndpointIDConfigFailed) IsServerError() bool { - return true -} - -// IsCode returns true when this patch endpoint Id config failed response a status code equal to that given -func (o *PatchEndpointIDConfigFailed) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the patch endpoint Id config failed response -func (o *PatchEndpointIDConfigFailed) Code() int { - return 500 -} - -func (o *PatchEndpointIDConfigFailed) Error() string { - return fmt.Sprintf("[PATCH /endpoint/{id}/config][%d] patchEndpointIdConfigFailed %+v", 500, o.Payload) -} - -func (o *PatchEndpointIDConfigFailed) String() string { - return fmt.Sprintf("[PATCH /endpoint/{id}/config][%d] patchEndpointIdConfigFailed %+v", 500, o.Payload) -} - -func (o *PatchEndpointIDConfigFailed) GetPayload() models.Error { - return o.Payload -} - -func (o *PatchEndpointIDConfigFailed) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/patch_endpoint_id_labels_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/patch_endpoint_id_labels_parameters.go deleted file mode 100644 index 8091565f5..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/patch_endpoint_id_labels_parameters.go +++ /dev/null @@ -1,189 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// NewPatchEndpointIDLabelsParams creates a new PatchEndpointIDLabelsParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewPatchEndpointIDLabelsParams() *PatchEndpointIDLabelsParams { - return &PatchEndpointIDLabelsParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewPatchEndpointIDLabelsParamsWithTimeout creates a new PatchEndpointIDLabelsParams object -// with the ability to set a timeout on a request. -func NewPatchEndpointIDLabelsParamsWithTimeout(timeout time.Duration) *PatchEndpointIDLabelsParams { - return &PatchEndpointIDLabelsParams{ - timeout: timeout, - } -} - -// NewPatchEndpointIDLabelsParamsWithContext creates a new PatchEndpointIDLabelsParams object -// with the ability to set a context for a request. -func NewPatchEndpointIDLabelsParamsWithContext(ctx context.Context) *PatchEndpointIDLabelsParams { - return &PatchEndpointIDLabelsParams{ - Context: ctx, - } -} - -// NewPatchEndpointIDLabelsParamsWithHTTPClient creates a new PatchEndpointIDLabelsParams object -// with the ability to set a custom HTTPClient for a request. -func NewPatchEndpointIDLabelsParamsWithHTTPClient(client *http.Client) *PatchEndpointIDLabelsParams { - return &PatchEndpointIDLabelsParams{ - HTTPClient: client, - } -} - -/* -PatchEndpointIDLabelsParams contains all the parameters to send to the API endpoint - - for the patch endpoint ID labels operation. - - Typically these are written to a http.Request. -*/ -type PatchEndpointIDLabelsParams struct { - - // Configuration. - Configuration *models.LabelConfigurationSpec - - /* ID. - - String describing an endpoint with the format ``[prefix:]id``. If no prefix - is specified, a prefix of ``cilium-local:`` is assumed. Not all endpoints - will be addressable by all endpoint ID prefixes with the exception of the - local Cilium UUID which is assigned to all endpoints. - - Supported endpoint id prefixes: - - cilium-local: Local Cilium endpoint UUID, e.g. cilium-local:3389595 - - cilium-global: Global Cilium endpoint UUID, e.g. cilium-global:cluster1:nodeX:452343 - - cni-attachment-id: CNI attachment ID, e.g. cni-attachment-id:22222:eth0 - - container-id: Container runtime ID, e.g. container-id:22222 (deprecated, may not be unique) - - container-name: Container name, e.g. container-name:foobar (deprecated, may not be unique) - - pod-name: pod name for this container if K8s is enabled, e.g. pod-name:default:foobar (deprecated, may not be unique) - - cep-name: cep name for this container if K8s is enabled, e.g. pod-name:default:foobar-net1 - - docker-endpoint: Docker libnetwork endpoint ID, e.g. docker-endpoint:4444 - - */ - ID string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the patch endpoint ID labels params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PatchEndpointIDLabelsParams) WithDefaults() *PatchEndpointIDLabelsParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the patch endpoint ID labels params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PatchEndpointIDLabelsParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the patch endpoint ID labels params -func (o *PatchEndpointIDLabelsParams) WithTimeout(timeout time.Duration) *PatchEndpointIDLabelsParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the patch endpoint ID labels params -func (o *PatchEndpointIDLabelsParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the patch endpoint ID labels params -func (o *PatchEndpointIDLabelsParams) WithContext(ctx context.Context) *PatchEndpointIDLabelsParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the patch endpoint ID labels params -func (o *PatchEndpointIDLabelsParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the patch endpoint ID labels params -func (o *PatchEndpointIDLabelsParams) WithHTTPClient(client *http.Client) *PatchEndpointIDLabelsParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the patch endpoint ID labels params -func (o *PatchEndpointIDLabelsParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithConfiguration adds the configuration to the patch endpoint ID labels params -func (o *PatchEndpointIDLabelsParams) WithConfiguration(configuration *models.LabelConfigurationSpec) *PatchEndpointIDLabelsParams { - o.SetConfiguration(configuration) - return o -} - -// SetConfiguration adds the configuration to the patch endpoint ID labels params -func (o *PatchEndpointIDLabelsParams) SetConfiguration(configuration *models.LabelConfigurationSpec) { - o.Configuration = configuration -} - -// WithID adds the id to the patch endpoint ID labels params -func (o *PatchEndpointIDLabelsParams) WithID(id string) *PatchEndpointIDLabelsParams { - o.SetID(id) - return o -} - -// SetID adds the id to the patch endpoint ID labels params -func (o *PatchEndpointIDLabelsParams) SetID(id string) { - o.ID = id -} - -// WriteToRequest writes these params to a swagger request -func (o *PatchEndpointIDLabelsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if o.Configuration != nil { - if err := r.SetBodyParam(o.Configuration); err != nil { - return err - } - } - - // path param id - if err := r.SetPathParam("id", o.ID); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/patch_endpoint_id_labels_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/patch_endpoint_id_labels_responses.go deleted file mode 100644 index 5341a3055..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/patch_endpoint_id_labels_responses.go +++ /dev/null @@ -1,352 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// PatchEndpointIDLabelsReader is a Reader for the PatchEndpointIDLabels structure. -type PatchEndpointIDLabelsReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *PatchEndpointIDLabelsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewPatchEndpointIDLabelsOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 403: - result := NewPatchEndpointIDLabelsForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewPatchEndpointIDLabelsNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 429: - result := NewPatchEndpointIDLabelsTooManyRequests() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewPatchEndpointIDLabelsUpdateFailed() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[PATCH /endpoint/{id}/labels] PatchEndpointIDLabels", response, response.Code()) - } -} - -// NewPatchEndpointIDLabelsOK creates a PatchEndpointIDLabelsOK with default headers values -func NewPatchEndpointIDLabelsOK() *PatchEndpointIDLabelsOK { - return &PatchEndpointIDLabelsOK{} -} - -/* -PatchEndpointIDLabelsOK describes a response with status code 200, with default header values. - -Success -*/ -type PatchEndpointIDLabelsOK struct { -} - -// IsSuccess returns true when this patch endpoint Id labels o k response has a 2xx status code -func (o *PatchEndpointIDLabelsOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this patch endpoint Id labels o k response has a 3xx status code -func (o *PatchEndpointIDLabelsOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch endpoint Id labels o k response has a 4xx status code -func (o *PatchEndpointIDLabelsOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this patch endpoint Id labels o k response has a 5xx status code -func (o *PatchEndpointIDLabelsOK) IsServerError() bool { - return false -} - -// IsCode returns true when this patch endpoint Id labels o k response a status code equal to that given -func (o *PatchEndpointIDLabelsOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the patch endpoint Id labels o k response -func (o *PatchEndpointIDLabelsOK) Code() int { - return 200 -} - -func (o *PatchEndpointIDLabelsOK) Error() string { - return fmt.Sprintf("[PATCH /endpoint/{id}/labels][%d] patchEndpointIdLabelsOK ", 200) -} - -func (o *PatchEndpointIDLabelsOK) String() string { - return fmt.Sprintf("[PATCH /endpoint/{id}/labels][%d] patchEndpointIdLabelsOK ", 200) -} - -func (o *PatchEndpointIDLabelsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPatchEndpointIDLabelsForbidden creates a PatchEndpointIDLabelsForbidden with default headers values -func NewPatchEndpointIDLabelsForbidden() *PatchEndpointIDLabelsForbidden { - return &PatchEndpointIDLabelsForbidden{} -} - -/* -PatchEndpointIDLabelsForbidden describes a response with status code 403, with default header values. - -Forbidden -*/ -type PatchEndpointIDLabelsForbidden struct { -} - -// IsSuccess returns true when this patch endpoint Id labels forbidden response has a 2xx status code -func (o *PatchEndpointIDLabelsForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this patch endpoint Id labels forbidden response has a 3xx status code -func (o *PatchEndpointIDLabelsForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch endpoint Id labels forbidden response has a 4xx status code -func (o *PatchEndpointIDLabelsForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this patch endpoint Id labels forbidden response has a 5xx status code -func (o *PatchEndpointIDLabelsForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this patch endpoint Id labels forbidden response a status code equal to that given -func (o *PatchEndpointIDLabelsForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the patch endpoint Id labels forbidden response -func (o *PatchEndpointIDLabelsForbidden) Code() int { - return 403 -} - -func (o *PatchEndpointIDLabelsForbidden) Error() string { - return fmt.Sprintf("[PATCH /endpoint/{id}/labels][%d] patchEndpointIdLabelsForbidden ", 403) -} - -func (o *PatchEndpointIDLabelsForbidden) String() string { - return fmt.Sprintf("[PATCH /endpoint/{id}/labels][%d] patchEndpointIdLabelsForbidden ", 403) -} - -func (o *PatchEndpointIDLabelsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPatchEndpointIDLabelsNotFound creates a PatchEndpointIDLabelsNotFound with default headers values -func NewPatchEndpointIDLabelsNotFound() *PatchEndpointIDLabelsNotFound { - return &PatchEndpointIDLabelsNotFound{} -} - -/* -PatchEndpointIDLabelsNotFound describes a response with status code 404, with default header values. - -Endpoint not found -*/ -type PatchEndpointIDLabelsNotFound struct { -} - -// IsSuccess returns true when this patch endpoint Id labels not found response has a 2xx status code -func (o *PatchEndpointIDLabelsNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this patch endpoint Id labels not found response has a 3xx status code -func (o *PatchEndpointIDLabelsNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch endpoint Id labels not found response has a 4xx status code -func (o *PatchEndpointIDLabelsNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this patch endpoint Id labels not found response has a 5xx status code -func (o *PatchEndpointIDLabelsNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this patch endpoint Id labels not found response a status code equal to that given -func (o *PatchEndpointIDLabelsNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the patch endpoint Id labels not found response -func (o *PatchEndpointIDLabelsNotFound) Code() int { - return 404 -} - -func (o *PatchEndpointIDLabelsNotFound) Error() string { - return fmt.Sprintf("[PATCH /endpoint/{id}/labels][%d] patchEndpointIdLabelsNotFound ", 404) -} - -func (o *PatchEndpointIDLabelsNotFound) String() string { - return fmt.Sprintf("[PATCH /endpoint/{id}/labels][%d] patchEndpointIdLabelsNotFound ", 404) -} - -func (o *PatchEndpointIDLabelsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPatchEndpointIDLabelsTooManyRequests creates a PatchEndpointIDLabelsTooManyRequests with default headers values -func NewPatchEndpointIDLabelsTooManyRequests() *PatchEndpointIDLabelsTooManyRequests { - return &PatchEndpointIDLabelsTooManyRequests{} -} - -/* -PatchEndpointIDLabelsTooManyRequests describes a response with status code 429, with default header values. - -Rate-limiting too many requests in the given time frame -*/ -type PatchEndpointIDLabelsTooManyRequests struct { -} - -// IsSuccess returns true when this patch endpoint Id labels too many requests response has a 2xx status code -func (o *PatchEndpointIDLabelsTooManyRequests) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this patch endpoint Id labels too many requests response has a 3xx status code -func (o *PatchEndpointIDLabelsTooManyRequests) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch endpoint Id labels too many requests response has a 4xx status code -func (o *PatchEndpointIDLabelsTooManyRequests) IsClientError() bool { - return true -} - -// IsServerError returns true when this patch endpoint Id labels too many requests response has a 5xx status code -func (o *PatchEndpointIDLabelsTooManyRequests) IsServerError() bool { - return false -} - -// IsCode returns true when this patch endpoint Id labels too many requests response a status code equal to that given -func (o *PatchEndpointIDLabelsTooManyRequests) IsCode(code int) bool { - return code == 429 -} - -// Code gets the status code for the patch endpoint Id labels too many requests response -func (o *PatchEndpointIDLabelsTooManyRequests) Code() int { - return 429 -} - -func (o *PatchEndpointIDLabelsTooManyRequests) Error() string { - return fmt.Sprintf("[PATCH /endpoint/{id}/labels][%d] patchEndpointIdLabelsTooManyRequests ", 429) -} - -func (o *PatchEndpointIDLabelsTooManyRequests) String() string { - return fmt.Sprintf("[PATCH /endpoint/{id}/labels][%d] patchEndpointIdLabelsTooManyRequests ", 429) -} - -func (o *PatchEndpointIDLabelsTooManyRequests) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPatchEndpointIDLabelsUpdateFailed creates a PatchEndpointIDLabelsUpdateFailed with default headers values -func NewPatchEndpointIDLabelsUpdateFailed() *PatchEndpointIDLabelsUpdateFailed { - return &PatchEndpointIDLabelsUpdateFailed{} -} - -/* -PatchEndpointIDLabelsUpdateFailed describes a response with status code 500, with default header values. - -Error while updating labels -*/ -type PatchEndpointIDLabelsUpdateFailed struct { - Payload models.Error -} - -// IsSuccess returns true when this patch endpoint Id labels update failed response has a 2xx status code -func (o *PatchEndpointIDLabelsUpdateFailed) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this patch endpoint Id labels update failed response has a 3xx status code -func (o *PatchEndpointIDLabelsUpdateFailed) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch endpoint Id labels update failed response has a 4xx status code -func (o *PatchEndpointIDLabelsUpdateFailed) IsClientError() bool { - return false -} - -// IsServerError returns true when this patch endpoint Id labels update failed response has a 5xx status code -func (o *PatchEndpointIDLabelsUpdateFailed) IsServerError() bool { - return true -} - -// IsCode returns true when this patch endpoint Id labels update failed response a status code equal to that given -func (o *PatchEndpointIDLabelsUpdateFailed) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the patch endpoint Id labels update failed response -func (o *PatchEndpointIDLabelsUpdateFailed) Code() int { - return 500 -} - -func (o *PatchEndpointIDLabelsUpdateFailed) Error() string { - return fmt.Sprintf("[PATCH /endpoint/{id}/labels][%d] patchEndpointIdLabelsUpdateFailed %+v", 500, o.Payload) -} - -func (o *PatchEndpointIDLabelsUpdateFailed) String() string { - return fmt.Sprintf("[PATCH /endpoint/{id}/labels][%d] patchEndpointIdLabelsUpdateFailed %+v", 500, o.Payload) -} - -func (o *PatchEndpointIDLabelsUpdateFailed) GetPayload() models.Error { - return o.Payload -} - -func (o *PatchEndpointIDLabelsUpdateFailed) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/patch_endpoint_id_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/patch_endpoint_id_parameters.go deleted file mode 100644 index f718d1982..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/patch_endpoint_id_parameters.go +++ /dev/null @@ -1,189 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// NewPatchEndpointIDParams creates a new PatchEndpointIDParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewPatchEndpointIDParams() *PatchEndpointIDParams { - return &PatchEndpointIDParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewPatchEndpointIDParamsWithTimeout creates a new PatchEndpointIDParams object -// with the ability to set a timeout on a request. -func NewPatchEndpointIDParamsWithTimeout(timeout time.Duration) *PatchEndpointIDParams { - return &PatchEndpointIDParams{ - timeout: timeout, - } -} - -// NewPatchEndpointIDParamsWithContext creates a new PatchEndpointIDParams object -// with the ability to set a context for a request. -func NewPatchEndpointIDParamsWithContext(ctx context.Context) *PatchEndpointIDParams { - return &PatchEndpointIDParams{ - Context: ctx, - } -} - -// NewPatchEndpointIDParamsWithHTTPClient creates a new PatchEndpointIDParams object -// with the ability to set a custom HTTPClient for a request. -func NewPatchEndpointIDParamsWithHTTPClient(client *http.Client) *PatchEndpointIDParams { - return &PatchEndpointIDParams{ - HTTPClient: client, - } -} - -/* -PatchEndpointIDParams contains all the parameters to send to the API endpoint - - for the patch endpoint ID operation. - - Typically these are written to a http.Request. -*/ -type PatchEndpointIDParams struct { - - // Endpoint. - Endpoint *models.EndpointChangeRequest - - /* ID. - - String describing an endpoint with the format ``[prefix:]id``. If no prefix - is specified, a prefix of ``cilium-local:`` is assumed. Not all endpoints - will be addressable by all endpoint ID prefixes with the exception of the - local Cilium UUID which is assigned to all endpoints. - - Supported endpoint id prefixes: - - cilium-local: Local Cilium endpoint UUID, e.g. cilium-local:3389595 - - cilium-global: Global Cilium endpoint UUID, e.g. cilium-global:cluster1:nodeX:452343 - - cni-attachment-id: CNI attachment ID, e.g. cni-attachment-id:22222:eth0 - - container-id: Container runtime ID, e.g. container-id:22222 (deprecated, may not be unique) - - container-name: Container name, e.g. container-name:foobar (deprecated, may not be unique) - - pod-name: pod name for this container if K8s is enabled, e.g. pod-name:default:foobar (deprecated, may not be unique) - - cep-name: cep name for this container if K8s is enabled, e.g. pod-name:default:foobar-net1 - - docker-endpoint: Docker libnetwork endpoint ID, e.g. docker-endpoint:4444 - - */ - ID string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the patch endpoint ID params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PatchEndpointIDParams) WithDefaults() *PatchEndpointIDParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the patch endpoint ID params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PatchEndpointIDParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the patch endpoint ID params -func (o *PatchEndpointIDParams) WithTimeout(timeout time.Duration) *PatchEndpointIDParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the patch endpoint ID params -func (o *PatchEndpointIDParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the patch endpoint ID params -func (o *PatchEndpointIDParams) WithContext(ctx context.Context) *PatchEndpointIDParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the patch endpoint ID params -func (o *PatchEndpointIDParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the patch endpoint ID params -func (o *PatchEndpointIDParams) WithHTTPClient(client *http.Client) *PatchEndpointIDParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the patch endpoint ID params -func (o *PatchEndpointIDParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithEndpoint adds the endpoint to the patch endpoint ID params -func (o *PatchEndpointIDParams) WithEndpoint(endpoint *models.EndpointChangeRequest) *PatchEndpointIDParams { - o.SetEndpoint(endpoint) - return o -} - -// SetEndpoint adds the endpoint to the patch endpoint ID params -func (o *PatchEndpointIDParams) SetEndpoint(endpoint *models.EndpointChangeRequest) { - o.Endpoint = endpoint -} - -// WithID adds the id to the patch endpoint ID params -func (o *PatchEndpointIDParams) WithID(id string) *PatchEndpointIDParams { - o.SetID(id) - return o -} - -// SetID adds the id to the patch endpoint ID params -func (o *PatchEndpointIDParams) SetID(id string) { - o.ID = id -} - -// WriteToRequest writes these params to a swagger request -func (o *PatchEndpointIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if o.Endpoint != nil { - if err := r.SetBodyParam(o.Endpoint); err != nil { - return err - } - } - - // path param id - if err := r.SetPathParam("id", o.ID); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/patch_endpoint_id_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/patch_endpoint_id_responses.go deleted file mode 100644 index f957c1ca6..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/patch_endpoint_id_responses.go +++ /dev/null @@ -1,424 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// PatchEndpointIDReader is a Reader for the PatchEndpointID structure. -type PatchEndpointIDReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *PatchEndpointIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewPatchEndpointIDOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 400: - result := NewPatchEndpointIDInvalid() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 403: - result := NewPatchEndpointIDForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewPatchEndpointIDNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 429: - result := NewPatchEndpointIDTooManyRequests() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewPatchEndpointIDFailed() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[PATCH /endpoint/{id}] PatchEndpointID", response, response.Code()) - } -} - -// NewPatchEndpointIDOK creates a PatchEndpointIDOK with default headers values -func NewPatchEndpointIDOK() *PatchEndpointIDOK { - return &PatchEndpointIDOK{} -} - -/* -PatchEndpointIDOK describes a response with status code 200, with default header values. - -Success -*/ -type PatchEndpointIDOK struct { -} - -// IsSuccess returns true when this patch endpoint Id o k response has a 2xx status code -func (o *PatchEndpointIDOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this patch endpoint Id o k response has a 3xx status code -func (o *PatchEndpointIDOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch endpoint Id o k response has a 4xx status code -func (o *PatchEndpointIDOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this patch endpoint Id o k response has a 5xx status code -func (o *PatchEndpointIDOK) IsServerError() bool { - return false -} - -// IsCode returns true when this patch endpoint Id o k response a status code equal to that given -func (o *PatchEndpointIDOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the patch endpoint Id o k response -func (o *PatchEndpointIDOK) Code() int { - return 200 -} - -func (o *PatchEndpointIDOK) Error() string { - return fmt.Sprintf("[PATCH /endpoint/{id}][%d] patchEndpointIdOK ", 200) -} - -func (o *PatchEndpointIDOK) String() string { - return fmt.Sprintf("[PATCH /endpoint/{id}][%d] patchEndpointIdOK ", 200) -} - -func (o *PatchEndpointIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPatchEndpointIDInvalid creates a PatchEndpointIDInvalid with default headers values -func NewPatchEndpointIDInvalid() *PatchEndpointIDInvalid { - return &PatchEndpointIDInvalid{} -} - -/* -PatchEndpointIDInvalid describes a response with status code 400, with default header values. - -Invalid modify endpoint request -*/ -type PatchEndpointIDInvalid struct { - Payload models.Error -} - -// IsSuccess returns true when this patch endpoint Id invalid response has a 2xx status code -func (o *PatchEndpointIDInvalid) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this patch endpoint Id invalid response has a 3xx status code -func (o *PatchEndpointIDInvalid) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch endpoint Id invalid response has a 4xx status code -func (o *PatchEndpointIDInvalid) IsClientError() bool { - return true -} - -// IsServerError returns true when this patch endpoint Id invalid response has a 5xx status code -func (o *PatchEndpointIDInvalid) IsServerError() bool { - return false -} - -// IsCode returns true when this patch endpoint Id invalid response a status code equal to that given -func (o *PatchEndpointIDInvalid) IsCode(code int) bool { - return code == 400 -} - -// Code gets the status code for the patch endpoint Id invalid response -func (o *PatchEndpointIDInvalid) Code() int { - return 400 -} - -func (o *PatchEndpointIDInvalid) Error() string { - return fmt.Sprintf("[PATCH /endpoint/{id}][%d] patchEndpointIdInvalid %+v", 400, o.Payload) -} - -func (o *PatchEndpointIDInvalid) String() string { - return fmt.Sprintf("[PATCH /endpoint/{id}][%d] patchEndpointIdInvalid %+v", 400, o.Payload) -} - -func (o *PatchEndpointIDInvalid) GetPayload() models.Error { - return o.Payload -} - -func (o *PatchEndpointIDInvalid) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewPatchEndpointIDForbidden creates a PatchEndpointIDForbidden with default headers values -func NewPatchEndpointIDForbidden() *PatchEndpointIDForbidden { - return &PatchEndpointIDForbidden{} -} - -/* -PatchEndpointIDForbidden describes a response with status code 403, with default header values. - -Forbidden -*/ -type PatchEndpointIDForbidden struct { -} - -// IsSuccess returns true when this patch endpoint Id forbidden response has a 2xx status code -func (o *PatchEndpointIDForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this patch endpoint Id forbidden response has a 3xx status code -func (o *PatchEndpointIDForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch endpoint Id forbidden response has a 4xx status code -func (o *PatchEndpointIDForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this patch endpoint Id forbidden response has a 5xx status code -func (o *PatchEndpointIDForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this patch endpoint Id forbidden response a status code equal to that given -func (o *PatchEndpointIDForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the patch endpoint Id forbidden response -func (o *PatchEndpointIDForbidden) Code() int { - return 403 -} - -func (o *PatchEndpointIDForbidden) Error() string { - return fmt.Sprintf("[PATCH /endpoint/{id}][%d] patchEndpointIdForbidden ", 403) -} - -func (o *PatchEndpointIDForbidden) String() string { - return fmt.Sprintf("[PATCH /endpoint/{id}][%d] patchEndpointIdForbidden ", 403) -} - -func (o *PatchEndpointIDForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPatchEndpointIDNotFound creates a PatchEndpointIDNotFound with default headers values -func NewPatchEndpointIDNotFound() *PatchEndpointIDNotFound { - return &PatchEndpointIDNotFound{} -} - -/* -PatchEndpointIDNotFound describes a response with status code 404, with default header values. - -Endpoint does not exist -*/ -type PatchEndpointIDNotFound struct { -} - -// IsSuccess returns true when this patch endpoint Id not found response has a 2xx status code -func (o *PatchEndpointIDNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this patch endpoint Id not found response has a 3xx status code -func (o *PatchEndpointIDNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch endpoint Id not found response has a 4xx status code -func (o *PatchEndpointIDNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this patch endpoint Id not found response has a 5xx status code -func (o *PatchEndpointIDNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this patch endpoint Id not found response a status code equal to that given -func (o *PatchEndpointIDNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the patch endpoint Id not found response -func (o *PatchEndpointIDNotFound) Code() int { - return 404 -} - -func (o *PatchEndpointIDNotFound) Error() string { - return fmt.Sprintf("[PATCH /endpoint/{id}][%d] patchEndpointIdNotFound ", 404) -} - -func (o *PatchEndpointIDNotFound) String() string { - return fmt.Sprintf("[PATCH /endpoint/{id}][%d] patchEndpointIdNotFound ", 404) -} - -func (o *PatchEndpointIDNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPatchEndpointIDTooManyRequests creates a PatchEndpointIDTooManyRequests with default headers values -func NewPatchEndpointIDTooManyRequests() *PatchEndpointIDTooManyRequests { - return &PatchEndpointIDTooManyRequests{} -} - -/* -PatchEndpointIDTooManyRequests describes a response with status code 429, with default header values. - -Rate-limiting too many requests in the given time frame -*/ -type PatchEndpointIDTooManyRequests struct { -} - -// IsSuccess returns true when this patch endpoint Id too many requests response has a 2xx status code -func (o *PatchEndpointIDTooManyRequests) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this patch endpoint Id too many requests response has a 3xx status code -func (o *PatchEndpointIDTooManyRequests) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch endpoint Id too many requests response has a 4xx status code -func (o *PatchEndpointIDTooManyRequests) IsClientError() bool { - return true -} - -// IsServerError returns true when this patch endpoint Id too many requests response has a 5xx status code -func (o *PatchEndpointIDTooManyRequests) IsServerError() bool { - return false -} - -// IsCode returns true when this patch endpoint Id too many requests response a status code equal to that given -func (o *PatchEndpointIDTooManyRequests) IsCode(code int) bool { - return code == 429 -} - -// Code gets the status code for the patch endpoint Id too many requests response -func (o *PatchEndpointIDTooManyRequests) Code() int { - return 429 -} - -func (o *PatchEndpointIDTooManyRequests) Error() string { - return fmt.Sprintf("[PATCH /endpoint/{id}][%d] patchEndpointIdTooManyRequests ", 429) -} - -func (o *PatchEndpointIDTooManyRequests) String() string { - return fmt.Sprintf("[PATCH /endpoint/{id}][%d] patchEndpointIdTooManyRequests ", 429) -} - -func (o *PatchEndpointIDTooManyRequests) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPatchEndpointIDFailed creates a PatchEndpointIDFailed with default headers values -func NewPatchEndpointIDFailed() *PatchEndpointIDFailed { - return &PatchEndpointIDFailed{} -} - -/* -PatchEndpointIDFailed describes a response with status code 500, with default header values. - -Endpoint update failed -*/ -type PatchEndpointIDFailed struct { - Payload models.Error -} - -// IsSuccess returns true when this patch endpoint Id failed response has a 2xx status code -func (o *PatchEndpointIDFailed) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this patch endpoint Id failed response has a 3xx status code -func (o *PatchEndpointIDFailed) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch endpoint Id failed response has a 4xx status code -func (o *PatchEndpointIDFailed) IsClientError() bool { - return false -} - -// IsServerError returns true when this patch endpoint Id failed response has a 5xx status code -func (o *PatchEndpointIDFailed) IsServerError() bool { - return true -} - -// IsCode returns true when this patch endpoint Id failed response a status code equal to that given -func (o *PatchEndpointIDFailed) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the patch endpoint Id failed response -func (o *PatchEndpointIDFailed) Code() int { - return 500 -} - -func (o *PatchEndpointIDFailed) Error() string { - return fmt.Sprintf("[PATCH /endpoint/{id}][%d] patchEndpointIdFailed %+v", 500, o.Payload) -} - -func (o *PatchEndpointIDFailed) String() string { - return fmt.Sprintf("[PATCH /endpoint/{id}][%d] patchEndpointIdFailed %+v", 500, o.Payload) -} - -func (o *PatchEndpointIDFailed) GetPayload() models.Error { - return o.Payload -} - -func (o *PatchEndpointIDFailed) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/put_endpoint_id_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/put_endpoint_id_parameters.go deleted file mode 100644 index a7342cba0..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/put_endpoint_id_parameters.go +++ /dev/null @@ -1,189 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// NewPutEndpointIDParams creates a new PutEndpointIDParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewPutEndpointIDParams() *PutEndpointIDParams { - return &PutEndpointIDParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewPutEndpointIDParamsWithTimeout creates a new PutEndpointIDParams object -// with the ability to set a timeout on a request. -func NewPutEndpointIDParamsWithTimeout(timeout time.Duration) *PutEndpointIDParams { - return &PutEndpointIDParams{ - timeout: timeout, - } -} - -// NewPutEndpointIDParamsWithContext creates a new PutEndpointIDParams object -// with the ability to set a context for a request. -func NewPutEndpointIDParamsWithContext(ctx context.Context) *PutEndpointIDParams { - return &PutEndpointIDParams{ - Context: ctx, - } -} - -// NewPutEndpointIDParamsWithHTTPClient creates a new PutEndpointIDParams object -// with the ability to set a custom HTTPClient for a request. -func NewPutEndpointIDParamsWithHTTPClient(client *http.Client) *PutEndpointIDParams { - return &PutEndpointIDParams{ - HTTPClient: client, - } -} - -/* -PutEndpointIDParams contains all the parameters to send to the API endpoint - - for the put endpoint ID operation. - - Typically these are written to a http.Request. -*/ -type PutEndpointIDParams struct { - - // Endpoint. - Endpoint *models.EndpointChangeRequest - - /* ID. - - String describing an endpoint with the format ``[prefix:]id``. If no prefix - is specified, a prefix of ``cilium-local:`` is assumed. Not all endpoints - will be addressable by all endpoint ID prefixes with the exception of the - local Cilium UUID which is assigned to all endpoints. - - Supported endpoint id prefixes: - - cilium-local: Local Cilium endpoint UUID, e.g. cilium-local:3389595 - - cilium-global: Global Cilium endpoint UUID, e.g. cilium-global:cluster1:nodeX:452343 - - cni-attachment-id: CNI attachment ID, e.g. cni-attachment-id:22222:eth0 - - container-id: Container runtime ID, e.g. container-id:22222 (deprecated, may not be unique) - - container-name: Container name, e.g. container-name:foobar (deprecated, may not be unique) - - pod-name: pod name for this container if K8s is enabled, e.g. pod-name:default:foobar (deprecated, may not be unique) - - cep-name: cep name for this container if K8s is enabled, e.g. pod-name:default:foobar-net1 - - docker-endpoint: Docker libnetwork endpoint ID, e.g. docker-endpoint:4444 - - */ - ID string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the put endpoint ID params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PutEndpointIDParams) WithDefaults() *PutEndpointIDParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the put endpoint ID params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PutEndpointIDParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the put endpoint ID params -func (o *PutEndpointIDParams) WithTimeout(timeout time.Duration) *PutEndpointIDParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the put endpoint ID params -func (o *PutEndpointIDParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the put endpoint ID params -func (o *PutEndpointIDParams) WithContext(ctx context.Context) *PutEndpointIDParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the put endpoint ID params -func (o *PutEndpointIDParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the put endpoint ID params -func (o *PutEndpointIDParams) WithHTTPClient(client *http.Client) *PutEndpointIDParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the put endpoint ID params -func (o *PutEndpointIDParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithEndpoint adds the endpoint to the put endpoint ID params -func (o *PutEndpointIDParams) WithEndpoint(endpoint *models.EndpointChangeRequest) *PutEndpointIDParams { - o.SetEndpoint(endpoint) - return o -} - -// SetEndpoint adds the endpoint to the put endpoint ID params -func (o *PutEndpointIDParams) SetEndpoint(endpoint *models.EndpointChangeRequest) { - o.Endpoint = endpoint -} - -// WithID adds the id to the put endpoint ID params -func (o *PutEndpointIDParams) WithID(id string) *PutEndpointIDParams { - o.SetID(id) - return o -} - -// SetID adds the id to the put endpoint ID params -func (o *PutEndpointIDParams) SetID(id string) { - o.ID = id -} - -// WriteToRequest writes these params to a swagger request -func (o *PutEndpointIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if o.Endpoint != nil { - if err := r.SetBodyParam(o.Endpoint); err != nil { - return err - } - } - - // path param id - if err := r.SetPathParam("id", o.ID); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/put_endpoint_id_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/endpoint/put_endpoint_id_responses.go deleted file mode 100644 index 231ef62b5..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/endpoint/put_endpoint_id_responses.go +++ /dev/null @@ -1,436 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package endpoint - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// PutEndpointIDReader is a Reader for the PutEndpointID structure. -type PutEndpointIDReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *PutEndpointIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 201: - result := NewPutEndpointIDCreated() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 400: - result := NewPutEndpointIDInvalid() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 403: - result := NewPutEndpointIDForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 409: - result := NewPutEndpointIDExists() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 429: - result := NewPutEndpointIDTooManyRequests() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewPutEndpointIDFailed() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[PUT /endpoint/{id}] PutEndpointID", response, response.Code()) - } -} - -// NewPutEndpointIDCreated creates a PutEndpointIDCreated with default headers values -func NewPutEndpointIDCreated() *PutEndpointIDCreated { - return &PutEndpointIDCreated{} -} - -/* -PutEndpointIDCreated describes a response with status code 201, with default header values. - -Created -*/ -type PutEndpointIDCreated struct { - Payload *models.Endpoint -} - -// IsSuccess returns true when this put endpoint Id created response has a 2xx status code -func (o *PutEndpointIDCreated) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this put endpoint Id created response has a 3xx status code -func (o *PutEndpointIDCreated) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put endpoint Id created response has a 4xx status code -func (o *PutEndpointIDCreated) IsClientError() bool { - return false -} - -// IsServerError returns true when this put endpoint Id created response has a 5xx status code -func (o *PutEndpointIDCreated) IsServerError() bool { - return false -} - -// IsCode returns true when this put endpoint Id created response a status code equal to that given -func (o *PutEndpointIDCreated) IsCode(code int) bool { - return code == 201 -} - -// Code gets the status code for the put endpoint Id created response -func (o *PutEndpointIDCreated) Code() int { - return 201 -} - -func (o *PutEndpointIDCreated) Error() string { - return fmt.Sprintf("[PUT /endpoint/{id}][%d] putEndpointIdCreated %+v", 201, o.Payload) -} - -func (o *PutEndpointIDCreated) String() string { - return fmt.Sprintf("[PUT /endpoint/{id}][%d] putEndpointIdCreated %+v", 201, o.Payload) -} - -func (o *PutEndpointIDCreated) GetPayload() *models.Endpoint { - return o.Payload -} - -func (o *PutEndpointIDCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.Endpoint) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewPutEndpointIDInvalid creates a PutEndpointIDInvalid with default headers values -func NewPutEndpointIDInvalid() *PutEndpointIDInvalid { - return &PutEndpointIDInvalid{} -} - -/* -PutEndpointIDInvalid describes a response with status code 400, with default header values. - -Invalid endpoint in request -*/ -type PutEndpointIDInvalid struct { - Payload models.Error -} - -// IsSuccess returns true when this put endpoint Id invalid response has a 2xx status code -func (o *PutEndpointIDInvalid) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put endpoint Id invalid response has a 3xx status code -func (o *PutEndpointIDInvalid) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put endpoint Id invalid response has a 4xx status code -func (o *PutEndpointIDInvalid) IsClientError() bool { - return true -} - -// IsServerError returns true when this put endpoint Id invalid response has a 5xx status code -func (o *PutEndpointIDInvalid) IsServerError() bool { - return false -} - -// IsCode returns true when this put endpoint Id invalid response a status code equal to that given -func (o *PutEndpointIDInvalid) IsCode(code int) bool { - return code == 400 -} - -// Code gets the status code for the put endpoint Id invalid response -func (o *PutEndpointIDInvalid) Code() int { - return 400 -} - -func (o *PutEndpointIDInvalid) Error() string { - return fmt.Sprintf("[PUT /endpoint/{id}][%d] putEndpointIdInvalid %+v", 400, o.Payload) -} - -func (o *PutEndpointIDInvalid) String() string { - return fmt.Sprintf("[PUT /endpoint/{id}][%d] putEndpointIdInvalid %+v", 400, o.Payload) -} - -func (o *PutEndpointIDInvalid) GetPayload() models.Error { - return o.Payload -} - -func (o *PutEndpointIDInvalid) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewPutEndpointIDForbidden creates a PutEndpointIDForbidden with default headers values -func NewPutEndpointIDForbidden() *PutEndpointIDForbidden { - return &PutEndpointIDForbidden{} -} - -/* -PutEndpointIDForbidden describes a response with status code 403, with default header values. - -Forbidden -*/ -type PutEndpointIDForbidden struct { -} - -// IsSuccess returns true when this put endpoint Id forbidden response has a 2xx status code -func (o *PutEndpointIDForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put endpoint Id forbidden response has a 3xx status code -func (o *PutEndpointIDForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put endpoint Id forbidden response has a 4xx status code -func (o *PutEndpointIDForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this put endpoint Id forbidden response has a 5xx status code -func (o *PutEndpointIDForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this put endpoint Id forbidden response a status code equal to that given -func (o *PutEndpointIDForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the put endpoint Id forbidden response -func (o *PutEndpointIDForbidden) Code() int { - return 403 -} - -func (o *PutEndpointIDForbidden) Error() string { - return fmt.Sprintf("[PUT /endpoint/{id}][%d] putEndpointIdForbidden ", 403) -} - -func (o *PutEndpointIDForbidden) String() string { - return fmt.Sprintf("[PUT /endpoint/{id}][%d] putEndpointIdForbidden ", 403) -} - -func (o *PutEndpointIDForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPutEndpointIDExists creates a PutEndpointIDExists with default headers values -func NewPutEndpointIDExists() *PutEndpointIDExists { - return &PutEndpointIDExists{} -} - -/* -PutEndpointIDExists describes a response with status code 409, with default header values. - -Endpoint already exists -*/ -type PutEndpointIDExists struct { -} - -// IsSuccess returns true when this put endpoint Id exists response has a 2xx status code -func (o *PutEndpointIDExists) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put endpoint Id exists response has a 3xx status code -func (o *PutEndpointIDExists) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put endpoint Id exists response has a 4xx status code -func (o *PutEndpointIDExists) IsClientError() bool { - return true -} - -// IsServerError returns true when this put endpoint Id exists response has a 5xx status code -func (o *PutEndpointIDExists) IsServerError() bool { - return false -} - -// IsCode returns true when this put endpoint Id exists response a status code equal to that given -func (o *PutEndpointIDExists) IsCode(code int) bool { - return code == 409 -} - -// Code gets the status code for the put endpoint Id exists response -func (o *PutEndpointIDExists) Code() int { - return 409 -} - -func (o *PutEndpointIDExists) Error() string { - return fmt.Sprintf("[PUT /endpoint/{id}][%d] putEndpointIdExists ", 409) -} - -func (o *PutEndpointIDExists) String() string { - return fmt.Sprintf("[PUT /endpoint/{id}][%d] putEndpointIdExists ", 409) -} - -func (o *PutEndpointIDExists) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPutEndpointIDTooManyRequests creates a PutEndpointIDTooManyRequests with default headers values -func NewPutEndpointIDTooManyRequests() *PutEndpointIDTooManyRequests { - return &PutEndpointIDTooManyRequests{} -} - -/* -PutEndpointIDTooManyRequests describes a response with status code 429, with default header values. - -Rate-limiting too many requests in the given time frame -*/ -type PutEndpointIDTooManyRequests struct { -} - -// IsSuccess returns true when this put endpoint Id too many requests response has a 2xx status code -func (o *PutEndpointIDTooManyRequests) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put endpoint Id too many requests response has a 3xx status code -func (o *PutEndpointIDTooManyRequests) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put endpoint Id too many requests response has a 4xx status code -func (o *PutEndpointIDTooManyRequests) IsClientError() bool { - return true -} - -// IsServerError returns true when this put endpoint Id too many requests response has a 5xx status code -func (o *PutEndpointIDTooManyRequests) IsServerError() bool { - return false -} - -// IsCode returns true when this put endpoint Id too many requests response a status code equal to that given -func (o *PutEndpointIDTooManyRequests) IsCode(code int) bool { - return code == 429 -} - -// Code gets the status code for the put endpoint Id too many requests response -func (o *PutEndpointIDTooManyRequests) Code() int { - return 429 -} - -func (o *PutEndpointIDTooManyRequests) Error() string { - return fmt.Sprintf("[PUT /endpoint/{id}][%d] putEndpointIdTooManyRequests ", 429) -} - -func (o *PutEndpointIDTooManyRequests) String() string { - return fmt.Sprintf("[PUT /endpoint/{id}][%d] putEndpointIdTooManyRequests ", 429) -} - -func (o *PutEndpointIDTooManyRequests) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPutEndpointIDFailed creates a PutEndpointIDFailed with default headers values -func NewPutEndpointIDFailed() *PutEndpointIDFailed { - return &PutEndpointIDFailed{} -} - -/* -PutEndpointIDFailed describes a response with status code 500, with default header values. - -Endpoint creation failed -*/ -type PutEndpointIDFailed struct { - Payload models.Error -} - -// IsSuccess returns true when this put endpoint Id failed response has a 2xx status code -func (o *PutEndpointIDFailed) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put endpoint Id failed response has a 3xx status code -func (o *PutEndpointIDFailed) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put endpoint Id failed response has a 4xx status code -func (o *PutEndpointIDFailed) IsClientError() bool { - return false -} - -// IsServerError returns true when this put endpoint Id failed response has a 5xx status code -func (o *PutEndpointIDFailed) IsServerError() bool { - return true -} - -// IsCode returns true when this put endpoint Id failed response a status code equal to that given -func (o *PutEndpointIDFailed) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the put endpoint Id failed response -func (o *PutEndpointIDFailed) Code() int { - return 500 -} - -func (o *PutEndpointIDFailed) Error() string { - return fmt.Sprintf("[PUT /endpoint/{id}][%d] putEndpointIdFailed %+v", 500, o.Payload) -} - -func (o *PutEndpointIDFailed) String() string { - return fmt.Sprintf("[PUT /endpoint/{id}][%d] putEndpointIdFailed %+v", 500, o.Payload) -} - -func (o *PutEndpointIDFailed) GetPayload() models.Error { - return o.Payload -} - -func (o *PutEndpointIDFailed) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/ipam/delete_ipam_ip_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/ipam/delete_ipam_ip_parameters.go deleted file mode 100644 index 73cc82d51..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/ipam/delete_ipam_ip_parameters.go +++ /dev/null @@ -1,185 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package ipam - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewDeleteIpamIPParams creates a new DeleteIpamIPParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewDeleteIpamIPParams() *DeleteIpamIPParams { - return &DeleteIpamIPParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewDeleteIpamIPParamsWithTimeout creates a new DeleteIpamIPParams object -// with the ability to set a timeout on a request. -func NewDeleteIpamIPParamsWithTimeout(timeout time.Duration) *DeleteIpamIPParams { - return &DeleteIpamIPParams{ - timeout: timeout, - } -} - -// NewDeleteIpamIPParamsWithContext creates a new DeleteIpamIPParams object -// with the ability to set a context for a request. -func NewDeleteIpamIPParamsWithContext(ctx context.Context) *DeleteIpamIPParams { - return &DeleteIpamIPParams{ - Context: ctx, - } -} - -// NewDeleteIpamIPParamsWithHTTPClient creates a new DeleteIpamIPParams object -// with the ability to set a custom HTTPClient for a request. -func NewDeleteIpamIPParamsWithHTTPClient(client *http.Client) *DeleteIpamIPParams { - return &DeleteIpamIPParams{ - HTTPClient: client, - } -} - -/* -DeleteIpamIPParams contains all the parameters to send to the API endpoint - - for the delete ipam IP operation. - - Typically these are written to a http.Request. -*/ -type DeleteIpamIPParams struct { - - /* IP. - - IP address - */ - IP string - - // Pool. - Pool *string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the delete ipam IP params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeleteIpamIPParams) WithDefaults() *DeleteIpamIPParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the delete ipam IP params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeleteIpamIPParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the delete ipam IP params -func (o *DeleteIpamIPParams) WithTimeout(timeout time.Duration) *DeleteIpamIPParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the delete ipam IP params -func (o *DeleteIpamIPParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the delete ipam IP params -func (o *DeleteIpamIPParams) WithContext(ctx context.Context) *DeleteIpamIPParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the delete ipam IP params -func (o *DeleteIpamIPParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the delete ipam IP params -func (o *DeleteIpamIPParams) WithHTTPClient(client *http.Client) *DeleteIpamIPParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the delete ipam IP params -func (o *DeleteIpamIPParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithIP adds the ip to the delete ipam IP params -func (o *DeleteIpamIPParams) WithIP(ip string) *DeleteIpamIPParams { - o.SetIP(ip) - return o -} - -// SetIP adds the ip to the delete ipam IP params -func (o *DeleteIpamIPParams) SetIP(ip string) { - o.IP = ip -} - -// WithPool adds the pool to the delete ipam IP params -func (o *DeleteIpamIPParams) WithPool(pool *string) *DeleteIpamIPParams { - o.SetPool(pool) - return o -} - -// SetPool adds the pool to the delete ipam IP params -func (o *DeleteIpamIPParams) SetPool(pool *string) { - o.Pool = pool -} - -// WriteToRequest writes these params to a swagger request -func (o *DeleteIpamIPParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - // path param ip - if err := r.SetPathParam("ip", o.IP); err != nil { - return err - } - - if o.Pool != nil { - - // query param pool - var qrPool string - - if o.Pool != nil { - qrPool = *o.Pool - } - qPool := qrPool - if qPool != "" { - - if err := r.SetQueryParam("pool", qPool); err != nil { - return err - } - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/ipam/delete_ipam_ip_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/ipam/delete_ipam_ip_responses.go deleted file mode 100644 index c05dd86d2..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/ipam/delete_ipam_ip_responses.go +++ /dev/null @@ -1,414 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package ipam - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// DeleteIpamIPReader is a Reader for the DeleteIpamIP structure. -type DeleteIpamIPReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *DeleteIpamIPReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewDeleteIpamIPOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 400: - result := NewDeleteIpamIPInvalid() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 403: - result := NewDeleteIpamIPForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewDeleteIpamIPNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewDeleteIpamIPFailure() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 501: - result := NewDeleteIpamIPDisabled() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[DELETE /ipam/{ip}] DeleteIpamIP", response, response.Code()) - } -} - -// NewDeleteIpamIPOK creates a DeleteIpamIPOK with default headers values -func NewDeleteIpamIPOK() *DeleteIpamIPOK { - return &DeleteIpamIPOK{} -} - -/* -DeleteIpamIPOK describes a response with status code 200, with default header values. - -Success -*/ -type DeleteIpamIPOK struct { -} - -// IsSuccess returns true when this delete ipam Ip o k response has a 2xx status code -func (o *DeleteIpamIPOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this delete ipam Ip o k response has a 3xx status code -func (o *DeleteIpamIPOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete ipam Ip o k response has a 4xx status code -func (o *DeleteIpamIPOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this delete ipam Ip o k response has a 5xx status code -func (o *DeleteIpamIPOK) IsServerError() bool { - return false -} - -// IsCode returns true when this delete ipam Ip o k response a status code equal to that given -func (o *DeleteIpamIPOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the delete ipam Ip o k response -func (o *DeleteIpamIPOK) Code() int { - return 200 -} - -func (o *DeleteIpamIPOK) Error() string { - return fmt.Sprintf("[DELETE /ipam/{ip}][%d] deleteIpamIpOK ", 200) -} - -func (o *DeleteIpamIPOK) String() string { - return fmt.Sprintf("[DELETE /ipam/{ip}][%d] deleteIpamIpOK ", 200) -} - -func (o *DeleteIpamIPOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewDeleteIpamIPInvalid creates a DeleteIpamIPInvalid with default headers values -func NewDeleteIpamIPInvalid() *DeleteIpamIPInvalid { - return &DeleteIpamIPInvalid{} -} - -/* -DeleteIpamIPInvalid describes a response with status code 400, with default header values. - -Invalid IP address -*/ -type DeleteIpamIPInvalid struct { -} - -// IsSuccess returns true when this delete ipam Ip invalid response has a 2xx status code -func (o *DeleteIpamIPInvalid) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete ipam Ip invalid response has a 3xx status code -func (o *DeleteIpamIPInvalid) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete ipam Ip invalid response has a 4xx status code -func (o *DeleteIpamIPInvalid) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete ipam Ip invalid response has a 5xx status code -func (o *DeleteIpamIPInvalid) IsServerError() bool { - return false -} - -// IsCode returns true when this delete ipam Ip invalid response a status code equal to that given -func (o *DeleteIpamIPInvalid) IsCode(code int) bool { - return code == 400 -} - -// Code gets the status code for the delete ipam Ip invalid response -func (o *DeleteIpamIPInvalid) Code() int { - return 400 -} - -func (o *DeleteIpamIPInvalid) Error() string { - return fmt.Sprintf("[DELETE /ipam/{ip}][%d] deleteIpamIpInvalid ", 400) -} - -func (o *DeleteIpamIPInvalid) String() string { - return fmt.Sprintf("[DELETE /ipam/{ip}][%d] deleteIpamIpInvalid ", 400) -} - -func (o *DeleteIpamIPInvalid) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewDeleteIpamIPForbidden creates a DeleteIpamIPForbidden with default headers values -func NewDeleteIpamIPForbidden() *DeleteIpamIPForbidden { - return &DeleteIpamIPForbidden{} -} - -/* -DeleteIpamIPForbidden describes a response with status code 403, with default header values. - -Forbidden -*/ -type DeleteIpamIPForbidden struct { -} - -// IsSuccess returns true when this delete ipam Ip forbidden response has a 2xx status code -func (o *DeleteIpamIPForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete ipam Ip forbidden response has a 3xx status code -func (o *DeleteIpamIPForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete ipam Ip forbidden response has a 4xx status code -func (o *DeleteIpamIPForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete ipam Ip forbidden response has a 5xx status code -func (o *DeleteIpamIPForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this delete ipam Ip forbidden response a status code equal to that given -func (o *DeleteIpamIPForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the delete ipam Ip forbidden response -func (o *DeleteIpamIPForbidden) Code() int { - return 403 -} - -func (o *DeleteIpamIPForbidden) Error() string { - return fmt.Sprintf("[DELETE /ipam/{ip}][%d] deleteIpamIpForbidden ", 403) -} - -func (o *DeleteIpamIPForbidden) String() string { - return fmt.Sprintf("[DELETE /ipam/{ip}][%d] deleteIpamIpForbidden ", 403) -} - -func (o *DeleteIpamIPForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewDeleteIpamIPNotFound creates a DeleteIpamIPNotFound with default headers values -func NewDeleteIpamIPNotFound() *DeleteIpamIPNotFound { - return &DeleteIpamIPNotFound{} -} - -/* -DeleteIpamIPNotFound describes a response with status code 404, with default header values. - -IP address not found -*/ -type DeleteIpamIPNotFound struct { -} - -// IsSuccess returns true when this delete ipam Ip not found response has a 2xx status code -func (o *DeleteIpamIPNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete ipam Ip not found response has a 3xx status code -func (o *DeleteIpamIPNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete ipam Ip not found response has a 4xx status code -func (o *DeleteIpamIPNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete ipam Ip not found response has a 5xx status code -func (o *DeleteIpamIPNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this delete ipam Ip not found response a status code equal to that given -func (o *DeleteIpamIPNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the delete ipam Ip not found response -func (o *DeleteIpamIPNotFound) Code() int { - return 404 -} - -func (o *DeleteIpamIPNotFound) Error() string { - return fmt.Sprintf("[DELETE /ipam/{ip}][%d] deleteIpamIpNotFound ", 404) -} - -func (o *DeleteIpamIPNotFound) String() string { - return fmt.Sprintf("[DELETE /ipam/{ip}][%d] deleteIpamIpNotFound ", 404) -} - -func (o *DeleteIpamIPNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewDeleteIpamIPFailure creates a DeleteIpamIPFailure with default headers values -func NewDeleteIpamIPFailure() *DeleteIpamIPFailure { - return &DeleteIpamIPFailure{} -} - -/* -DeleteIpamIPFailure describes a response with status code 500, with default header values. - -Address release failure -*/ -type DeleteIpamIPFailure struct { - Payload models.Error -} - -// IsSuccess returns true when this delete ipam Ip failure response has a 2xx status code -func (o *DeleteIpamIPFailure) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete ipam Ip failure response has a 3xx status code -func (o *DeleteIpamIPFailure) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete ipam Ip failure response has a 4xx status code -func (o *DeleteIpamIPFailure) IsClientError() bool { - return false -} - -// IsServerError returns true when this delete ipam Ip failure response has a 5xx status code -func (o *DeleteIpamIPFailure) IsServerError() bool { - return true -} - -// IsCode returns true when this delete ipam Ip failure response a status code equal to that given -func (o *DeleteIpamIPFailure) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the delete ipam Ip failure response -func (o *DeleteIpamIPFailure) Code() int { - return 500 -} - -func (o *DeleteIpamIPFailure) Error() string { - return fmt.Sprintf("[DELETE /ipam/{ip}][%d] deleteIpamIpFailure %+v", 500, o.Payload) -} - -func (o *DeleteIpamIPFailure) String() string { - return fmt.Sprintf("[DELETE /ipam/{ip}][%d] deleteIpamIpFailure %+v", 500, o.Payload) -} - -func (o *DeleteIpamIPFailure) GetPayload() models.Error { - return o.Payload -} - -func (o *DeleteIpamIPFailure) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewDeleteIpamIPDisabled creates a DeleteIpamIPDisabled with default headers values -func NewDeleteIpamIPDisabled() *DeleteIpamIPDisabled { - return &DeleteIpamIPDisabled{} -} - -/* -DeleteIpamIPDisabled describes a response with status code 501, with default header values. - -Allocation for address family disabled -*/ -type DeleteIpamIPDisabled struct { -} - -// IsSuccess returns true when this delete ipam Ip disabled response has a 2xx status code -func (o *DeleteIpamIPDisabled) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete ipam Ip disabled response has a 3xx status code -func (o *DeleteIpamIPDisabled) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete ipam Ip disabled response has a 4xx status code -func (o *DeleteIpamIPDisabled) IsClientError() bool { - return false -} - -// IsServerError returns true when this delete ipam Ip disabled response has a 5xx status code -func (o *DeleteIpamIPDisabled) IsServerError() bool { - return true -} - -// IsCode returns true when this delete ipam Ip disabled response a status code equal to that given -func (o *DeleteIpamIPDisabled) IsCode(code int) bool { - return code == 501 -} - -// Code gets the status code for the delete ipam Ip disabled response -func (o *DeleteIpamIPDisabled) Code() int { - return 501 -} - -func (o *DeleteIpamIPDisabled) Error() string { - return fmt.Sprintf("[DELETE /ipam/{ip}][%d] deleteIpamIpDisabled ", 501) -} - -func (o *DeleteIpamIPDisabled) String() string { - return fmt.Sprintf("[DELETE /ipam/{ip}][%d] deleteIpamIpDisabled ", 501) -} - -func (o *DeleteIpamIPDisabled) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/ipam/ipam_client.go b/vendor/github.com/cilium/cilium/api/v1/client/ipam/ipam_client.go deleted file mode 100644 index bff4193d6..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/ipam/ipam_client.go +++ /dev/null @@ -1,162 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package ipam - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// New creates a new ipam API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { - return &Client{transport: transport, formats: formats} -} - -/* -Client for ipam API -*/ -type Client struct { - transport runtime.ClientTransport - formats strfmt.Registry -} - -// ClientOption is the option for Client methods -type ClientOption func(*runtime.ClientOperation) - -// ClientService is the interface for Client methods -type ClientService interface { - DeleteIpamIP(params *DeleteIpamIPParams, opts ...ClientOption) (*DeleteIpamIPOK, error) - - PostIpam(params *PostIpamParams, opts ...ClientOption) (*PostIpamCreated, error) - - PostIpamIP(params *PostIpamIPParams, opts ...ClientOption) (*PostIpamIPOK, error) - - SetTransport(transport runtime.ClientTransport) -} - -/* -DeleteIpamIP releases an allocated IP address -*/ -func (a *Client) DeleteIpamIP(params *DeleteIpamIPParams, opts ...ClientOption) (*DeleteIpamIPOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewDeleteIpamIPParams() - } - op := &runtime.ClientOperation{ - ID: "DeleteIpamIP", - Method: "DELETE", - PathPattern: "/ipam/{ip}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &DeleteIpamIPReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*DeleteIpamIPOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for DeleteIpamIP: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -PostIpam allocates an IP address -*/ -func (a *Client) PostIpam(params *PostIpamParams, opts ...ClientOption) (*PostIpamCreated, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPostIpamParams() - } - op := &runtime.ClientOperation{ - ID: "PostIpam", - Method: "POST", - PathPattern: "/ipam", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PostIpamReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*PostIpamCreated) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PostIpam: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -PostIpamIP allocates an IP address -*/ -func (a *Client) PostIpamIP(params *PostIpamIPParams, opts ...ClientOption) (*PostIpamIPOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPostIpamIPParams() - } - op := &runtime.ClientOperation{ - ID: "PostIpamIP", - Method: "POST", - PathPattern: "/ipam/{ip}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PostIpamIPReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*PostIpamIPOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PostIpamIP: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -// SetTransport changes the transport on the client -func (a *Client) SetTransport(transport runtime.ClientTransport) { - a.transport = transport -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/ipam/post_ipam_ip_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/ipam/post_ipam_ip_parameters.go deleted file mode 100644 index 6dbf02985..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/ipam/post_ipam_ip_parameters.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package ipam - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewPostIpamIPParams creates a new PostIpamIPParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewPostIpamIPParams() *PostIpamIPParams { - return &PostIpamIPParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewPostIpamIPParamsWithTimeout creates a new PostIpamIPParams object -// with the ability to set a timeout on a request. -func NewPostIpamIPParamsWithTimeout(timeout time.Duration) *PostIpamIPParams { - return &PostIpamIPParams{ - timeout: timeout, - } -} - -// NewPostIpamIPParamsWithContext creates a new PostIpamIPParams object -// with the ability to set a context for a request. -func NewPostIpamIPParamsWithContext(ctx context.Context) *PostIpamIPParams { - return &PostIpamIPParams{ - Context: ctx, - } -} - -// NewPostIpamIPParamsWithHTTPClient creates a new PostIpamIPParams object -// with the ability to set a custom HTTPClient for a request. -func NewPostIpamIPParamsWithHTTPClient(client *http.Client) *PostIpamIPParams { - return &PostIpamIPParams{ - HTTPClient: client, - } -} - -/* -PostIpamIPParams contains all the parameters to send to the API endpoint - - for the post ipam IP operation. - - Typically these are written to a http.Request. -*/ -type PostIpamIPParams struct { - - /* IP. - - IP address - */ - IP string - - // Owner. - Owner *string - - // Pool. - Pool *string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the post ipam IP params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PostIpamIPParams) WithDefaults() *PostIpamIPParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the post ipam IP params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PostIpamIPParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the post ipam IP params -func (o *PostIpamIPParams) WithTimeout(timeout time.Duration) *PostIpamIPParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the post ipam IP params -func (o *PostIpamIPParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the post ipam IP params -func (o *PostIpamIPParams) WithContext(ctx context.Context) *PostIpamIPParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the post ipam IP params -func (o *PostIpamIPParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the post ipam IP params -func (o *PostIpamIPParams) WithHTTPClient(client *http.Client) *PostIpamIPParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the post ipam IP params -func (o *PostIpamIPParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithIP adds the ip to the post ipam IP params -func (o *PostIpamIPParams) WithIP(ip string) *PostIpamIPParams { - o.SetIP(ip) - return o -} - -// SetIP adds the ip to the post ipam IP params -func (o *PostIpamIPParams) SetIP(ip string) { - o.IP = ip -} - -// WithOwner adds the owner to the post ipam IP params -func (o *PostIpamIPParams) WithOwner(owner *string) *PostIpamIPParams { - o.SetOwner(owner) - return o -} - -// SetOwner adds the owner to the post ipam IP params -func (o *PostIpamIPParams) SetOwner(owner *string) { - o.Owner = owner -} - -// WithPool adds the pool to the post ipam IP params -func (o *PostIpamIPParams) WithPool(pool *string) *PostIpamIPParams { - o.SetPool(pool) - return o -} - -// SetPool adds the pool to the post ipam IP params -func (o *PostIpamIPParams) SetPool(pool *string) { - o.Pool = pool -} - -// WriteToRequest writes these params to a swagger request -func (o *PostIpamIPParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - // path param ip - if err := r.SetPathParam("ip", o.IP); err != nil { - return err - } - - if o.Owner != nil { - - // query param owner - var qrOwner string - - if o.Owner != nil { - qrOwner = *o.Owner - } - qOwner := qrOwner - if qOwner != "" { - - if err := r.SetQueryParam("owner", qOwner); err != nil { - return err - } - } - } - - if o.Pool != nil { - - // query param pool - var qrPool string - - if o.Pool != nil { - qrPool = *o.Pool - } - qPool := qrPool - if qPool != "" { - - if err := r.SetQueryParam("pool", qPool); err != nil { - return err - } - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/ipam/post_ipam_ip_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/ipam/post_ipam_ip_responses.go deleted file mode 100644 index f858257f1..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/ipam/post_ipam_ip_responses.go +++ /dev/null @@ -1,414 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package ipam - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// PostIpamIPReader is a Reader for the PostIpamIP structure. -type PostIpamIPReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *PostIpamIPReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewPostIpamIPOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 400: - result := NewPostIpamIPInvalid() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 403: - result := NewPostIpamIPForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 409: - result := NewPostIpamIPExists() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewPostIpamIPFailure() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 501: - result := NewPostIpamIPDisabled() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[POST /ipam/{ip}] PostIpamIP", response, response.Code()) - } -} - -// NewPostIpamIPOK creates a PostIpamIPOK with default headers values -func NewPostIpamIPOK() *PostIpamIPOK { - return &PostIpamIPOK{} -} - -/* -PostIpamIPOK describes a response with status code 200, with default header values. - -Success -*/ -type PostIpamIPOK struct { -} - -// IsSuccess returns true when this post ipam Ip o k response has a 2xx status code -func (o *PostIpamIPOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this post ipam Ip o k response has a 3xx status code -func (o *PostIpamIPOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this post ipam Ip o k response has a 4xx status code -func (o *PostIpamIPOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this post ipam Ip o k response has a 5xx status code -func (o *PostIpamIPOK) IsServerError() bool { - return false -} - -// IsCode returns true when this post ipam Ip o k response a status code equal to that given -func (o *PostIpamIPOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the post ipam Ip o k response -func (o *PostIpamIPOK) Code() int { - return 200 -} - -func (o *PostIpamIPOK) Error() string { - return fmt.Sprintf("[POST /ipam/{ip}][%d] postIpamIpOK ", 200) -} - -func (o *PostIpamIPOK) String() string { - return fmt.Sprintf("[POST /ipam/{ip}][%d] postIpamIpOK ", 200) -} - -func (o *PostIpamIPOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPostIpamIPInvalid creates a PostIpamIPInvalid with default headers values -func NewPostIpamIPInvalid() *PostIpamIPInvalid { - return &PostIpamIPInvalid{} -} - -/* -PostIpamIPInvalid describes a response with status code 400, with default header values. - -Invalid IP address -*/ -type PostIpamIPInvalid struct { -} - -// IsSuccess returns true when this post ipam Ip invalid response has a 2xx status code -func (o *PostIpamIPInvalid) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this post ipam Ip invalid response has a 3xx status code -func (o *PostIpamIPInvalid) IsRedirect() bool { - return false -} - -// IsClientError returns true when this post ipam Ip invalid response has a 4xx status code -func (o *PostIpamIPInvalid) IsClientError() bool { - return true -} - -// IsServerError returns true when this post ipam Ip invalid response has a 5xx status code -func (o *PostIpamIPInvalid) IsServerError() bool { - return false -} - -// IsCode returns true when this post ipam Ip invalid response a status code equal to that given -func (o *PostIpamIPInvalid) IsCode(code int) bool { - return code == 400 -} - -// Code gets the status code for the post ipam Ip invalid response -func (o *PostIpamIPInvalid) Code() int { - return 400 -} - -func (o *PostIpamIPInvalid) Error() string { - return fmt.Sprintf("[POST /ipam/{ip}][%d] postIpamIpInvalid ", 400) -} - -func (o *PostIpamIPInvalid) String() string { - return fmt.Sprintf("[POST /ipam/{ip}][%d] postIpamIpInvalid ", 400) -} - -func (o *PostIpamIPInvalid) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPostIpamIPForbidden creates a PostIpamIPForbidden with default headers values -func NewPostIpamIPForbidden() *PostIpamIPForbidden { - return &PostIpamIPForbidden{} -} - -/* -PostIpamIPForbidden describes a response with status code 403, with default header values. - -Forbidden -*/ -type PostIpamIPForbidden struct { -} - -// IsSuccess returns true when this post ipam Ip forbidden response has a 2xx status code -func (o *PostIpamIPForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this post ipam Ip forbidden response has a 3xx status code -func (o *PostIpamIPForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this post ipam Ip forbidden response has a 4xx status code -func (o *PostIpamIPForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this post ipam Ip forbidden response has a 5xx status code -func (o *PostIpamIPForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this post ipam Ip forbidden response a status code equal to that given -func (o *PostIpamIPForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the post ipam Ip forbidden response -func (o *PostIpamIPForbidden) Code() int { - return 403 -} - -func (o *PostIpamIPForbidden) Error() string { - return fmt.Sprintf("[POST /ipam/{ip}][%d] postIpamIpForbidden ", 403) -} - -func (o *PostIpamIPForbidden) String() string { - return fmt.Sprintf("[POST /ipam/{ip}][%d] postIpamIpForbidden ", 403) -} - -func (o *PostIpamIPForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPostIpamIPExists creates a PostIpamIPExists with default headers values -func NewPostIpamIPExists() *PostIpamIPExists { - return &PostIpamIPExists{} -} - -/* -PostIpamIPExists describes a response with status code 409, with default header values. - -IP already allocated -*/ -type PostIpamIPExists struct { -} - -// IsSuccess returns true when this post ipam Ip exists response has a 2xx status code -func (o *PostIpamIPExists) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this post ipam Ip exists response has a 3xx status code -func (o *PostIpamIPExists) IsRedirect() bool { - return false -} - -// IsClientError returns true when this post ipam Ip exists response has a 4xx status code -func (o *PostIpamIPExists) IsClientError() bool { - return true -} - -// IsServerError returns true when this post ipam Ip exists response has a 5xx status code -func (o *PostIpamIPExists) IsServerError() bool { - return false -} - -// IsCode returns true when this post ipam Ip exists response a status code equal to that given -func (o *PostIpamIPExists) IsCode(code int) bool { - return code == 409 -} - -// Code gets the status code for the post ipam Ip exists response -func (o *PostIpamIPExists) Code() int { - return 409 -} - -func (o *PostIpamIPExists) Error() string { - return fmt.Sprintf("[POST /ipam/{ip}][%d] postIpamIpExists ", 409) -} - -func (o *PostIpamIPExists) String() string { - return fmt.Sprintf("[POST /ipam/{ip}][%d] postIpamIpExists ", 409) -} - -func (o *PostIpamIPExists) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPostIpamIPFailure creates a PostIpamIPFailure with default headers values -func NewPostIpamIPFailure() *PostIpamIPFailure { - return &PostIpamIPFailure{} -} - -/* -PostIpamIPFailure describes a response with status code 500, with default header values. - -IP allocation failure. Details in message. -*/ -type PostIpamIPFailure struct { - Payload models.Error -} - -// IsSuccess returns true when this post ipam Ip failure response has a 2xx status code -func (o *PostIpamIPFailure) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this post ipam Ip failure response has a 3xx status code -func (o *PostIpamIPFailure) IsRedirect() bool { - return false -} - -// IsClientError returns true when this post ipam Ip failure response has a 4xx status code -func (o *PostIpamIPFailure) IsClientError() bool { - return false -} - -// IsServerError returns true when this post ipam Ip failure response has a 5xx status code -func (o *PostIpamIPFailure) IsServerError() bool { - return true -} - -// IsCode returns true when this post ipam Ip failure response a status code equal to that given -func (o *PostIpamIPFailure) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the post ipam Ip failure response -func (o *PostIpamIPFailure) Code() int { - return 500 -} - -func (o *PostIpamIPFailure) Error() string { - return fmt.Sprintf("[POST /ipam/{ip}][%d] postIpamIpFailure %+v", 500, o.Payload) -} - -func (o *PostIpamIPFailure) String() string { - return fmt.Sprintf("[POST /ipam/{ip}][%d] postIpamIpFailure %+v", 500, o.Payload) -} - -func (o *PostIpamIPFailure) GetPayload() models.Error { - return o.Payload -} - -func (o *PostIpamIPFailure) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewPostIpamIPDisabled creates a PostIpamIPDisabled with default headers values -func NewPostIpamIPDisabled() *PostIpamIPDisabled { - return &PostIpamIPDisabled{} -} - -/* -PostIpamIPDisabled describes a response with status code 501, with default header values. - -Allocation for address family disabled -*/ -type PostIpamIPDisabled struct { -} - -// IsSuccess returns true when this post ipam Ip disabled response has a 2xx status code -func (o *PostIpamIPDisabled) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this post ipam Ip disabled response has a 3xx status code -func (o *PostIpamIPDisabled) IsRedirect() bool { - return false -} - -// IsClientError returns true when this post ipam Ip disabled response has a 4xx status code -func (o *PostIpamIPDisabled) IsClientError() bool { - return false -} - -// IsServerError returns true when this post ipam Ip disabled response has a 5xx status code -func (o *PostIpamIPDisabled) IsServerError() bool { - return true -} - -// IsCode returns true when this post ipam Ip disabled response a status code equal to that given -func (o *PostIpamIPDisabled) IsCode(code int) bool { - return code == 501 -} - -// Code gets the status code for the post ipam Ip disabled response -func (o *PostIpamIPDisabled) Code() int { - return 501 -} - -func (o *PostIpamIPDisabled) Error() string { - return fmt.Sprintf("[POST /ipam/{ip}][%d] postIpamIpDisabled ", 501) -} - -func (o *PostIpamIPDisabled) String() string { - return fmt.Sprintf("[POST /ipam/{ip}][%d] postIpamIpDisabled ", 501) -} - -func (o *PostIpamIPDisabled) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/ipam/post_ipam_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/ipam/post_ipam_parameters.go deleted file mode 100644 index 8e2075849..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/ipam/post_ipam_parameters.go +++ /dev/null @@ -1,248 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package ipam - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewPostIpamParams creates a new PostIpamParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewPostIpamParams() *PostIpamParams { - return &PostIpamParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewPostIpamParamsWithTimeout creates a new PostIpamParams object -// with the ability to set a timeout on a request. -func NewPostIpamParamsWithTimeout(timeout time.Duration) *PostIpamParams { - return &PostIpamParams{ - timeout: timeout, - } -} - -// NewPostIpamParamsWithContext creates a new PostIpamParams object -// with the ability to set a context for a request. -func NewPostIpamParamsWithContext(ctx context.Context) *PostIpamParams { - return &PostIpamParams{ - Context: ctx, - } -} - -// NewPostIpamParamsWithHTTPClient creates a new PostIpamParams object -// with the ability to set a custom HTTPClient for a request. -func NewPostIpamParamsWithHTTPClient(client *http.Client) *PostIpamParams { - return &PostIpamParams{ - HTTPClient: client, - } -} - -/* -PostIpamParams contains all the parameters to send to the API endpoint - - for the post ipam operation. - - Typically these are written to a http.Request. -*/ -type PostIpamParams struct { - - // Expiration. - Expiration *bool - - // Family. - Family *string - - // Owner. - Owner *string - - // Pool. - Pool *string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the post ipam params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PostIpamParams) WithDefaults() *PostIpamParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the post ipam params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PostIpamParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the post ipam params -func (o *PostIpamParams) WithTimeout(timeout time.Duration) *PostIpamParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the post ipam params -func (o *PostIpamParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the post ipam params -func (o *PostIpamParams) WithContext(ctx context.Context) *PostIpamParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the post ipam params -func (o *PostIpamParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the post ipam params -func (o *PostIpamParams) WithHTTPClient(client *http.Client) *PostIpamParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the post ipam params -func (o *PostIpamParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithExpiration adds the expiration to the post ipam params -func (o *PostIpamParams) WithExpiration(expiration *bool) *PostIpamParams { - o.SetExpiration(expiration) - return o -} - -// SetExpiration adds the expiration to the post ipam params -func (o *PostIpamParams) SetExpiration(expiration *bool) { - o.Expiration = expiration -} - -// WithFamily adds the family to the post ipam params -func (o *PostIpamParams) WithFamily(family *string) *PostIpamParams { - o.SetFamily(family) - return o -} - -// SetFamily adds the family to the post ipam params -func (o *PostIpamParams) SetFamily(family *string) { - o.Family = family -} - -// WithOwner adds the owner to the post ipam params -func (o *PostIpamParams) WithOwner(owner *string) *PostIpamParams { - o.SetOwner(owner) - return o -} - -// SetOwner adds the owner to the post ipam params -func (o *PostIpamParams) SetOwner(owner *string) { - o.Owner = owner -} - -// WithPool adds the pool to the post ipam params -func (o *PostIpamParams) WithPool(pool *string) *PostIpamParams { - o.SetPool(pool) - return o -} - -// SetPool adds the pool to the post ipam params -func (o *PostIpamParams) SetPool(pool *string) { - o.Pool = pool -} - -// WriteToRequest writes these params to a swagger request -func (o *PostIpamParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if o.Expiration != nil { - - // header param expiration - if err := r.SetHeaderParam("expiration", swag.FormatBool(*o.Expiration)); err != nil { - return err - } - } - - if o.Family != nil { - - // query param family - var qrFamily string - - if o.Family != nil { - qrFamily = *o.Family - } - qFamily := qrFamily - if qFamily != "" { - - if err := r.SetQueryParam("family", qFamily); err != nil { - return err - } - } - } - - if o.Owner != nil { - - // query param owner - var qrOwner string - - if o.Owner != nil { - qrOwner = *o.Owner - } - qOwner := qrOwner - if qOwner != "" { - - if err := r.SetQueryParam("owner", qOwner); err != nil { - return err - } - } - } - - if o.Pool != nil { - - // query param pool - var qrPool string - - if o.Pool != nil { - qrPool = *o.Pool - } - qPool := qrPool - if qPool != "" { - - if err := r.SetQueryParam("pool", qPool); err != nil { - return err - } - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/ipam/post_ipam_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/ipam/post_ipam_responses.go deleted file mode 100644 index 01eb516cc..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/ipam/post_ipam_responses.go +++ /dev/null @@ -1,240 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package ipam - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// PostIpamReader is a Reader for the PostIpam structure. -type PostIpamReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *PostIpamReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 201: - result := NewPostIpamCreated() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 403: - result := NewPostIpamForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 502: - result := NewPostIpamFailure() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[POST /ipam] PostIpam", response, response.Code()) - } -} - -// NewPostIpamCreated creates a PostIpamCreated with default headers values -func NewPostIpamCreated() *PostIpamCreated { - return &PostIpamCreated{} -} - -/* -PostIpamCreated describes a response with status code 201, with default header values. - -Success -*/ -type PostIpamCreated struct { - Payload *models.IPAMResponse -} - -// IsSuccess returns true when this post ipam created response has a 2xx status code -func (o *PostIpamCreated) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this post ipam created response has a 3xx status code -func (o *PostIpamCreated) IsRedirect() bool { - return false -} - -// IsClientError returns true when this post ipam created response has a 4xx status code -func (o *PostIpamCreated) IsClientError() bool { - return false -} - -// IsServerError returns true when this post ipam created response has a 5xx status code -func (o *PostIpamCreated) IsServerError() bool { - return false -} - -// IsCode returns true when this post ipam created response a status code equal to that given -func (o *PostIpamCreated) IsCode(code int) bool { - return code == 201 -} - -// Code gets the status code for the post ipam created response -func (o *PostIpamCreated) Code() int { - return 201 -} - -func (o *PostIpamCreated) Error() string { - return fmt.Sprintf("[POST /ipam][%d] postIpamCreated %+v", 201, o.Payload) -} - -func (o *PostIpamCreated) String() string { - return fmt.Sprintf("[POST /ipam][%d] postIpamCreated %+v", 201, o.Payload) -} - -func (o *PostIpamCreated) GetPayload() *models.IPAMResponse { - return o.Payload -} - -func (o *PostIpamCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.IPAMResponse) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewPostIpamForbidden creates a PostIpamForbidden with default headers values -func NewPostIpamForbidden() *PostIpamForbidden { - return &PostIpamForbidden{} -} - -/* -PostIpamForbidden describes a response with status code 403, with default header values. - -Forbidden -*/ -type PostIpamForbidden struct { -} - -// IsSuccess returns true when this post ipam forbidden response has a 2xx status code -func (o *PostIpamForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this post ipam forbidden response has a 3xx status code -func (o *PostIpamForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this post ipam forbidden response has a 4xx status code -func (o *PostIpamForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this post ipam forbidden response has a 5xx status code -func (o *PostIpamForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this post ipam forbidden response a status code equal to that given -func (o *PostIpamForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the post ipam forbidden response -func (o *PostIpamForbidden) Code() int { - return 403 -} - -func (o *PostIpamForbidden) Error() string { - return fmt.Sprintf("[POST /ipam][%d] postIpamForbidden ", 403) -} - -func (o *PostIpamForbidden) String() string { - return fmt.Sprintf("[POST /ipam][%d] postIpamForbidden ", 403) -} - -func (o *PostIpamForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPostIpamFailure creates a PostIpamFailure with default headers values -func NewPostIpamFailure() *PostIpamFailure { - return &PostIpamFailure{} -} - -/* -PostIpamFailure describes a response with status code 502, with default header values. - -Allocation failure -*/ -type PostIpamFailure struct { - Payload models.Error -} - -// IsSuccess returns true when this post ipam failure response has a 2xx status code -func (o *PostIpamFailure) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this post ipam failure response has a 3xx status code -func (o *PostIpamFailure) IsRedirect() bool { - return false -} - -// IsClientError returns true when this post ipam failure response has a 4xx status code -func (o *PostIpamFailure) IsClientError() bool { - return false -} - -// IsServerError returns true when this post ipam failure response has a 5xx status code -func (o *PostIpamFailure) IsServerError() bool { - return true -} - -// IsCode returns true when this post ipam failure response a status code equal to that given -func (o *PostIpamFailure) IsCode(code int) bool { - return code == 502 -} - -// Code gets the status code for the post ipam failure response -func (o *PostIpamFailure) Code() int { - return 502 -} - -func (o *PostIpamFailure) Error() string { - return fmt.Sprintf("[POST /ipam][%d] postIpamFailure %+v", 502, o.Payload) -} - -func (o *PostIpamFailure) String() string { - return fmt.Sprintf("[POST /ipam][%d] postIpamFailure %+v", 502, o.Payload) -} - -func (o *PostIpamFailure) GetPayload() models.Error { - return o.Payload -} - -func (o *PostIpamFailure) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/metrics/get_metrics_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/metrics/get_metrics_parameters.go deleted file mode 100644 index 7dd482af5..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/metrics/get_metrics_parameters.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package metrics - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetMetricsParams creates a new GetMetricsParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetMetricsParams() *GetMetricsParams { - return &GetMetricsParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetMetricsParamsWithTimeout creates a new GetMetricsParams object -// with the ability to set a timeout on a request. -func NewGetMetricsParamsWithTimeout(timeout time.Duration) *GetMetricsParams { - return &GetMetricsParams{ - timeout: timeout, - } -} - -// NewGetMetricsParamsWithContext creates a new GetMetricsParams object -// with the ability to set a context for a request. -func NewGetMetricsParamsWithContext(ctx context.Context) *GetMetricsParams { - return &GetMetricsParams{ - Context: ctx, - } -} - -// NewGetMetricsParamsWithHTTPClient creates a new GetMetricsParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetMetricsParamsWithHTTPClient(client *http.Client) *GetMetricsParams { - return &GetMetricsParams{ - HTTPClient: client, - } -} - -/* -GetMetricsParams contains all the parameters to send to the API endpoint - - for the get metrics operation. - - Typically these are written to a http.Request. -*/ -type GetMetricsParams struct { - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get metrics params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetMetricsParams) WithDefaults() *GetMetricsParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get metrics params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetMetricsParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get metrics params -func (o *GetMetricsParams) WithTimeout(timeout time.Duration) *GetMetricsParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get metrics params -func (o *GetMetricsParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get metrics params -func (o *GetMetricsParams) WithContext(ctx context.Context) *GetMetricsParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get metrics params -func (o *GetMetricsParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get metrics params -func (o *GetMetricsParams) WithHTTPClient(client *http.Client) *GetMetricsParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get metrics params -func (o *GetMetricsParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *GetMetricsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/metrics/get_metrics_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/metrics/get_metrics_responses.go deleted file mode 100644 index 92601d400..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/metrics/get_metrics_responses.go +++ /dev/null @@ -1,166 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package metrics - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetMetricsReader is a Reader for the GetMetrics structure. -type GetMetricsReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetMetricsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetMetricsOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 500: - result := NewGetMetricsInternalServerError() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /metrics/] GetMetrics", response, response.Code()) - } -} - -// NewGetMetricsOK creates a GetMetricsOK with default headers values -func NewGetMetricsOK() *GetMetricsOK { - return &GetMetricsOK{} -} - -/* -GetMetricsOK describes a response with status code 200, with default header values. - -Success -*/ -type GetMetricsOK struct { - Payload []*models.Metric -} - -// IsSuccess returns true when this get metrics o k response has a 2xx status code -func (o *GetMetricsOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get metrics o k response has a 3xx status code -func (o *GetMetricsOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get metrics o k response has a 4xx status code -func (o *GetMetricsOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get metrics o k response has a 5xx status code -func (o *GetMetricsOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get metrics o k response a status code equal to that given -func (o *GetMetricsOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get metrics o k response -func (o *GetMetricsOK) Code() int { - return 200 -} - -func (o *GetMetricsOK) Error() string { - return fmt.Sprintf("[GET /metrics/][%d] getMetricsOK %+v", 200, o.Payload) -} - -func (o *GetMetricsOK) String() string { - return fmt.Sprintf("[GET /metrics/][%d] getMetricsOK %+v", 200, o.Payload) -} - -func (o *GetMetricsOK) GetPayload() []*models.Metric { - return o.Payload -} - -func (o *GetMetricsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetMetricsInternalServerError creates a GetMetricsInternalServerError with default headers values -func NewGetMetricsInternalServerError() *GetMetricsInternalServerError { - return &GetMetricsInternalServerError{} -} - -/* -GetMetricsInternalServerError describes a response with status code 500, with default header values. - -Metrics cannot be retrieved -*/ -type GetMetricsInternalServerError struct { -} - -// IsSuccess returns true when this get metrics internal server error response has a 2xx status code -func (o *GetMetricsInternalServerError) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get metrics internal server error response has a 3xx status code -func (o *GetMetricsInternalServerError) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get metrics internal server error response has a 4xx status code -func (o *GetMetricsInternalServerError) IsClientError() bool { - return false -} - -// IsServerError returns true when this get metrics internal server error response has a 5xx status code -func (o *GetMetricsInternalServerError) IsServerError() bool { - return true -} - -// IsCode returns true when this get metrics internal server error response a status code equal to that given -func (o *GetMetricsInternalServerError) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the get metrics internal server error response -func (o *GetMetricsInternalServerError) Code() int { - return 500 -} - -func (o *GetMetricsInternalServerError) Error() string { - return fmt.Sprintf("[GET /metrics/][%d] getMetricsInternalServerError ", 500) -} - -func (o *GetMetricsInternalServerError) String() string { - return fmt.Sprintf("[GET /metrics/][%d] getMetricsInternalServerError ", 500) -} - -func (o *GetMetricsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/metrics/metrics_client.go b/vendor/github.com/cilium/cilium/api/v1/client/metrics/metrics_client.go deleted file mode 100644 index d51858ef4..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/metrics/metrics_client.go +++ /dev/null @@ -1,82 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package metrics - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// New creates a new metrics API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { - return &Client{transport: transport, formats: formats} -} - -/* -Client for metrics API -*/ -type Client struct { - transport runtime.ClientTransport - formats strfmt.Registry -} - -// ClientOption is the option for Client methods -type ClientOption func(*runtime.ClientOperation) - -// ClientService is the interface for Client methods -type ClientService interface { - GetMetrics(params *GetMetricsParams, opts ...ClientOption) (*GetMetricsOK, error) - - SetTransport(transport runtime.ClientTransport) -} - -/* -GetMetrics retrieves cilium metrics -*/ -func (a *Client) GetMetrics(params *GetMetricsParams, opts ...ClientOption) (*GetMetricsOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetMetricsParams() - } - op := &runtime.ClientOperation{ - ID: "GetMetrics", - Method: "GET", - PathPattern: "/metrics/", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetMetricsReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetMetricsOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetMetrics: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -// SetTransport changes the transport on the client -func (a *Client) SetTransport(transport runtime.ClientTransport) { - a.transport = transport -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/delete_fqdn_cache_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/delete_fqdn_cache_parameters.go deleted file mode 100644 index c53a2f7cf..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/delete_fqdn_cache_parameters.go +++ /dev/null @@ -1,166 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewDeleteFqdnCacheParams creates a new DeleteFqdnCacheParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewDeleteFqdnCacheParams() *DeleteFqdnCacheParams { - return &DeleteFqdnCacheParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewDeleteFqdnCacheParamsWithTimeout creates a new DeleteFqdnCacheParams object -// with the ability to set a timeout on a request. -func NewDeleteFqdnCacheParamsWithTimeout(timeout time.Duration) *DeleteFqdnCacheParams { - return &DeleteFqdnCacheParams{ - timeout: timeout, - } -} - -// NewDeleteFqdnCacheParamsWithContext creates a new DeleteFqdnCacheParams object -// with the ability to set a context for a request. -func NewDeleteFqdnCacheParamsWithContext(ctx context.Context) *DeleteFqdnCacheParams { - return &DeleteFqdnCacheParams{ - Context: ctx, - } -} - -// NewDeleteFqdnCacheParamsWithHTTPClient creates a new DeleteFqdnCacheParams object -// with the ability to set a custom HTTPClient for a request. -func NewDeleteFqdnCacheParamsWithHTTPClient(client *http.Client) *DeleteFqdnCacheParams { - return &DeleteFqdnCacheParams{ - HTTPClient: client, - } -} - -/* -DeleteFqdnCacheParams contains all the parameters to send to the API endpoint - - for the delete fqdn cache operation. - - Typically these are written to a http.Request. -*/ -type DeleteFqdnCacheParams struct { - - /* Matchpattern. - - A toFQDNs compatible matchPattern expression - */ - Matchpattern *string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the delete fqdn cache params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeleteFqdnCacheParams) WithDefaults() *DeleteFqdnCacheParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the delete fqdn cache params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeleteFqdnCacheParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the delete fqdn cache params -func (o *DeleteFqdnCacheParams) WithTimeout(timeout time.Duration) *DeleteFqdnCacheParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the delete fqdn cache params -func (o *DeleteFqdnCacheParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the delete fqdn cache params -func (o *DeleteFqdnCacheParams) WithContext(ctx context.Context) *DeleteFqdnCacheParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the delete fqdn cache params -func (o *DeleteFqdnCacheParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the delete fqdn cache params -func (o *DeleteFqdnCacheParams) WithHTTPClient(client *http.Client) *DeleteFqdnCacheParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the delete fqdn cache params -func (o *DeleteFqdnCacheParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithMatchpattern adds the matchpattern to the delete fqdn cache params -func (o *DeleteFqdnCacheParams) WithMatchpattern(matchpattern *string) *DeleteFqdnCacheParams { - o.SetMatchpattern(matchpattern) - return o -} - -// SetMatchpattern adds the matchpattern to the delete fqdn cache params -func (o *DeleteFqdnCacheParams) SetMatchpattern(matchpattern *string) { - o.Matchpattern = matchpattern -} - -// WriteToRequest writes these params to a swagger request -func (o *DeleteFqdnCacheParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if o.Matchpattern != nil { - - // query param matchpattern - var qrMatchpattern string - - if o.Matchpattern != nil { - qrMatchpattern = *o.Matchpattern - } - qMatchpattern := qrMatchpattern - if qMatchpattern != "" { - - if err := r.SetQueryParam("matchpattern", qMatchpattern); err != nil { - return err - } - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/delete_fqdn_cache_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/delete_fqdn_cache_responses.go deleted file mode 100644 index 69bcaa947..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/delete_fqdn_cache_responses.go +++ /dev/null @@ -1,228 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// DeleteFqdnCacheReader is a Reader for the DeleteFqdnCache structure. -type DeleteFqdnCacheReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *DeleteFqdnCacheReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewDeleteFqdnCacheOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 400: - result := NewDeleteFqdnCacheBadRequest() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 403: - result := NewDeleteFqdnCacheForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[DELETE /fqdn/cache] DeleteFqdnCache", response, response.Code()) - } -} - -// NewDeleteFqdnCacheOK creates a DeleteFqdnCacheOK with default headers values -func NewDeleteFqdnCacheOK() *DeleteFqdnCacheOK { - return &DeleteFqdnCacheOK{} -} - -/* -DeleteFqdnCacheOK describes a response with status code 200, with default header values. - -Success -*/ -type DeleteFqdnCacheOK struct { -} - -// IsSuccess returns true when this delete fqdn cache o k response has a 2xx status code -func (o *DeleteFqdnCacheOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this delete fqdn cache o k response has a 3xx status code -func (o *DeleteFqdnCacheOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete fqdn cache o k response has a 4xx status code -func (o *DeleteFqdnCacheOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this delete fqdn cache o k response has a 5xx status code -func (o *DeleteFqdnCacheOK) IsServerError() bool { - return false -} - -// IsCode returns true when this delete fqdn cache o k response a status code equal to that given -func (o *DeleteFqdnCacheOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the delete fqdn cache o k response -func (o *DeleteFqdnCacheOK) Code() int { - return 200 -} - -func (o *DeleteFqdnCacheOK) Error() string { - return fmt.Sprintf("[DELETE /fqdn/cache][%d] deleteFqdnCacheOK ", 200) -} - -func (o *DeleteFqdnCacheOK) String() string { - return fmt.Sprintf("[DELETE /fqdn/cache][%d] deleteFqdnCacheOK ", 200) -} - -func (o *DeleteFqdnCacheOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewDeleteFqdnCacheBadRequest creates a DeleteFqdnCacheBadRequest with default headers values -func NewDeleteFqdnCacheBadRequest() *DeleteFqdnCacheBadRequest { - return &DeleteFqdnCacheBadRequest{} -} - -/* -DeleteFqdnCacheBadRequest describes a response with status code 400, with default header values. - -Invalid request (error parsing parameters) -*/ -type DeleteFqdnCacheBadRequest struct { - Payload models.Error -} - -// IsSuccess returns true when this delete fqdn cache bad request response has a 2xx status code -func (o *DeleteFqdnCacheBadRequest) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete fqdn cache bad request response has a 3xx status code -func (o *DeleteFqdnCacheBadRequest) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete fqdn cache bad request response has a 4xx status code -func (o *DeleteFqdnCacheBadRequest) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete fqdn cache bad request response has a 5xx status code -func (o *DeleteFqdnCacheBadRequest) IsServerError() bool { - return false -} - -// IsCode returns true when this delete fqdn cache bad request response a status code equal to that given -func (o *DeleteFqdnCacheBadRequest) IsCode(code int) bool { - return code == 400 -} - -// Code gets the status code for the delete fqdn cache bad request response -func (o *DeleteFqdnCacheBadRequest) Code() int { - return 400 -} - -func (o *DeleteFqdnCacheBadRequest) Error() string { - return fmt.Sprintf("[DELETE /fqdn/cache][%d] deleteFqdnCacheBadRequest %+v", 400, o.Payload) -} - -func (o *DeleteFqdnCacheBadRequest) String() string { - return fmt.Sprintf("[DELETE /fqdn/cache][%d] deleteFqdnCacheBadRequest %+v", 400, o.Payload) -} - -func (o *DeleteFqdnCacheBadRequest) GetPayload() models.Error { - return o.Payload -} - -func (o *DeleteFqdnCacheBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewDeleteFqdnCacheForbidden creates a DeleteFqdnCacheForbidden with default headers values -func NewDeleteFqdnCacheForbidden() *DeleteFqdnCacheForbidden { - return &DeleteFqdnCacheForbidden{} -} - -/* -DeleteFqdnCacheForbidden describes a response with status code 403, with default header values. - -Forbidden -*/ -type DeleteFqdnCacheForbidden struct { -} - -// IsSuccess returns true when this delete fqdn cache forbidden response has a 2xx status code -func (o *DeleteFqdnCacheForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete fqdn cache forbidden response has a 3xx status code -func (o *DeleteFqdnCacheForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete fqdn cache forbidden response has a 4xx status code -func (o *DeleteFqdnCacheForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete fqdn cache forbidden response has a 5xx status code -func (o *DeleteFqdnCacheForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this delete fqdn cache forbidden response a status code equal to that given -func (o *DeleteFqdnCacheForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the delete fqdn cache forbidden response -func (o *DeleteFqdnCacheForbidden) Code() int { - return 403 -} - -func (o *DeleteFqdnCacheForbidden) Error() string { - return fmt.Sprintf("[DELETE /fqdn/cache][%d] deleteFqdnCacheForbidden ", 403) -} - -func (o *DeleteFqdnCacheForbidden) String() string { - return fmt.Sprintf("[DELETE /fqdn/cache][%d] deleteFqdnCacheForbidden ", 403) -} - -func (o *DeleteFqdnCacheForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/delete_policy_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/delete_policy_parameters.go deleted file mode 100644 index 437ef67af..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/delete_policy_parameters.go +++ /dev/null @@ -1,153 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// NewDeletePolicyParams creates a new DeletePolicyParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewDeletePolicyParams() *DeletePolicyParams { - return &DeletePolicyParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewDeletePolicyParamsWithTimeout creates a new DeletePolicyParams object -// with the ability to set a timeout on a request. -func NewDeletePolicyParamsWithTimeout(timeout time.Duration) *DeletePolicyParams { - return &DeletePolicyParams{ - timeout: timeout, - } -} - -// NewDeletePolicyParamsWithContext creates a new DeletePolicyParams object -// with the ability to set a context for a request. -func NewDeletePolicyParamsWithContext(ctx context.Context) *DeletePolicyParams { - return &DeletePolicyParams{ - Context: ctx, - } -} - -// NewDeletePolicyParamsWithHTTPClient creates a new DeletePolicyParams object -// with the ability to set a custom HTTPClient for a request. -func NewDeletePolicyParamsWithHTTPClient(client *http.Client) *DeletePolicyParams { - return &DeletePolicyParams{ - HTTPClient: client, - } -} - -/* -DeletePolicyParams contains all the parameters to send to the API endpoint - - for the delete policy operation. - - Typically these are written to a http.Request. -*/ -type DeletePolicyParams struct { - - // Labels. - Labels models.Labels - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the delete policy params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeletePolicyParams) WithDefaults() *DeletePolicyParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the delete policy params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeletePolicyParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the delete policy params -func (o *DeletePolicyParams) WithTimeout(timeout time.Duration) *DeletePolicyParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the delete policy params -func (o *DeletePolicyParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the delete policy params -func (o *DeletePolicyParams) WithContext(ctx context.Context) *DeletePolicyParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the delete policy params -func (o *DeletePolicyParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the delete policy params -func (o *DeletePolicyParams) WithHTTPClient(client *http.Client) *DeletePolicyParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the delete policy params -func (o *DeletePolicyParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithLabels adds the labels to the delete policy params -func (o *DeletePolicyParams) WithLabels(labels models.Labels) *DeletePolicyParams { - o.SetLabels(labels) - return o -} - -// SetLabels adds the labels to the delete policy params -func (o *DeletePolicyParams) SetLabels(labels models.Labels) { - o.Labels = labels -} - -// WriteToRequest writes these params to a swagger request -func (o *DeletePolicyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if o.Labels != nil { - if err := r.SetBodyParam(o.Labels); err != nil { - return err - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/delete_policy_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/delete_policy_responses.go deleted file mode 100644 index 338dc21e6..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/delete_policy_responses.go +++ /dev/null @@ -1,374 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// DeletePolicyReader is a Reader for the DeletePolicy structure. -type DeletePolicyReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *DeletePolicyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewDeletePolicyOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 400: - result := NewDeletePolicyInvalid() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 403: - result := NewDeletePolicyForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewDeletePolicyNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewDeletePolicyFailure() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[DELETE /policy] DeletePolicy", response, response.Code()) - } -} - -// NewDeletePolicyOK creates a DeletePolicyOK with default headers values -func NewDeletePolicyOK() *DeletePolicyOK { - return &DeletePolicyOK{} -} - -/* -DeletePolicyOK describes a response with status code 200, with default header values. - -Success -*/ -type DeletePolicyOK struct { - Payload *models.Policy -} - -// IsSuccess returns true when this delete policy o k response has a 2xx status code -func (o *DeletePolicyOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this delete policy o k response has a 3xx status code -func (o *DeletePolicyOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete policy o k response has a 4xx status code -func (o *DeletePolicyOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this delete policy o k response has a 5xx status code -func (o *DeletePolicyOK) IsServerError() bool { - return false -} - -// IsCode returns true when this delete policy o k response a status code equal to that given -func (o *DeletePolicyOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the delete policy o k response -func (o *DeletePolicyOK) Code() int { - return 200 -} - -func (o *DeletePolicyOK) Error() string { - return fmt.Sprintf("[DELETE /policy][%d] deletePolicyOK %+v", 200, o.Payload) -} - -func (o *DeletePolicyOK) String() string { - return fmt.Sprintf("[DELETE /policy][%d] deletePolicyOK %+v", 200, o.Payload) -} - -func (o *DeletePolicyOK) GetPayload() *models.Policy { - return o.Payload -} - -func (o *DeletePolicyOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.Policy) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewDeletePolicyInvalid creates a DeletePolicyInvalid with default headers values -func NewDeletePolicyInvalid() *DeletePolicyInvalid { - return &DeletePolicyInvalid{} -} - -/* -DeletePolicyInvalid describes a response with status code 400, with default header values. - -Invalid request -*/ -type DeletePolicyInvalid struct { - Payload models.Error -} - -// IsSuccess returns true when this delete policy invalid response has a 2xx status code -func (o *DeletePolicyInvalid) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete policy invalid response has a 3xx status code -func (o *DeletePolicyInvalid) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete policy invalid response has a 4xx status code -func (o *DeletePolicyInvalid) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete policy invalid response has a 5xx status code -func (o *DeletePolicyInvalid) IsServerError() bool { - return false -} - -// IsCode returns true when this delete policy invalid response a status code equal to that given -func (o *DeletePolicyInvalid) IsCode(code int) bool { - return code == 400 -} - -// Code gets the status code for the delete policy invalid response -func (o *DeletePolicyInvalid) Code() int { - return 400 -} - -func (o *DeletePolicyInvalid) Error() string { - return fmt.Sprintf("[DELETE /policy][%d] deletePolicyInvalid %+v", 400, o.Payload) -} - -func (o *DeletePolicyInvalid) String() string { - return fmt.Sprintf("[DELETE /policy][%d] deletePolicyInvalid %+v", 400, o.Payload) -} - -func (o *DeletePolicyInvalid) GetPayload() models.Error { - return o.Payload -} - -func (o *DeletePolicyInvalid) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewDeletePolicyForbidden creates a DeletePolicyForbidden with default headers values -func NewDeletePolicyForbidden() *DeletePolicyForbidden { - return &DeletePolicyForbidden{} -} - -/* -DeletePolicyForbidden describes a response with status code 403, with default header values. - -Forbidden -*/ -type DeletePolicyForbidden struct { -} - -// IsSuccess returns true when this delete policy forbidden response has a 2xx status code -func (o *DeletePolicyForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete policy forbidden response has a 3xx status code -func (o *DeletePolicyForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete policy forbidden response has a 4xx status code -func (o *DeletePolicyForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete policy forbidden response has a 5xx status code -func (o *DeletePolicyForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this delete policy forbidden response a status code equal to that given -func (o *DeletePolicyForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the delete policy forbidden response -func (o *DeletePolicyForbidden) Code() int { - return 403 -} - -func (o *DeletePolicyForbidden) Error() string { - return fmt.Sprintf("[DELETE /policy][%d] deletePolicyForbidden ", 403) -} - -func (o *DeletePolicyForbidden) String() string { - return fmt.Sprintf("[DELETE /policy][%d] deletePolicyForbidden ", 403) -} - -func (o *DeletePolicyForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewDeletePolicyNotFound creates a DeletePolicyNotFound with default headers values -func NewDeletePolicyNotFound() *DeletePolicyNotFound { - return &DeletePolicyNotFound{} -} - -/* -DeletePolicyNotFound describes a response with status code 404, with default header values. - -Policy not found -*/ -type DeletePolicyNotFound struct { -} - -// IsSuccess returns true when this delete policy not found response has a 2xx status code -func (o *DeletePolicyNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete policy not found response has a 3xx status code -func (o *DeletePolicyNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete policy not found response has a 4xx status code -func (o *DeletePolicyNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete policy not found response has a 5xx status code -func (o *DeletePolicyNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this delete policy not found response a status code equal to that given -func (o *DeletePolicyNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the delete policy not found response -func (o *DeletePolicyNotFound) Code() int { - return 404 -} - -func (o *DeletePolicyNotFound) Error() string { - return fmt.Sprintf("[DELETE /policy][%d] deletePolicyNotFound ", 404) -} - -func (o *DeletePolicyNotFound) String() string { - return fmt.Sprintf("[DELETE /policy][%d] deletePolicyNotFound ", 404) -} - -func (o *DeletePolicyNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewDeletePolicyFailure creates a DeletePolicyFailure with default headers values -func NewDeletePolicyFailure() *DeletePolicyFailure { - return &DeletePolicyFailure{} -} - -/* -DeletePolicyFailure describes a response with status code 500, with default header values. - -Error while deleting policy -*/ -type DeletePolicyFailure struct { - Payload models.Error -} - -// IsSuccess returns true when this delete policy failure response has a 2xx status code -func (o *DeletePolicyFailure) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete policy failure response has a 3xx status code -func (o *DeletePolicyFailure) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete policy failure response has a 4xx status code -func (o *DeletePolicyFailure) IsClientError() bool { - return false -} - -// IsServerError returns true when this delete policy failure response has a 5xx status code -func (o *DeletePolicyFailure) IsServerError() bool { - return true -} - -// IsCode returns true when this delete policy failure response a status code equal to that given -func (o *DeletePolicyFailure) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the delete policy failure response -func (o *DeletePolicyFailure) Code() int { - return 500 -} - -func (o *DeletePolicyFailure) Error() string { - return fmt.Sprintf("[DELETE /policy][%d] deletePolicyFailure %+v", 500, o.Payload) -} - -func (o *DeletePolicyFailure) String() string { - return fmt.Sprintf("[DELETE /policy][%d] deletePolicyFailure %+v", 500, o.Payload) -} - -func (o *DeletePolicyFailure) GetPayload() models.Error { - return o.Payload -} - -func (o *DeletePolicyFailure) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_fqdn_cache_id_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/get_fqdn_cache_id_parameters.go deleted file mode 100644 index e4da10fca..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_fqdn_cache_id_parameters.go +++ /dev/null @@ -1,270 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetFqdnCacheIDParams creates a new GetFqdnCacheIDParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetFqdnCacheIDParams() *GetFqdnCacheIDParams { - return &GetFqdnCacheIDParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetFqdnCacheIDParamsWithTimeout creates a new GetFqdnCacheIDParams object -// with the ability to set a timeout on a request. -func NewGetFqdnCacheIDParamsWithTimeout(timeout time.Duration) *GetFqdnCacheIDParams { - return &GetFqdnCacheIDParams{ - timeout: timeout, - } -} - -// NewGetFqdnCacheIDParamsWithContext creates a new GetFqdnCacheIDParams object -// with the ability to set a context for a request. -func NewGetFqdnCacheIDParamsWithContext(ctx context.Context) *GetFqdnCacheIDParams { - return &GetFqdnCacheIDParams{ - Context: ctx, - } -} - -// NewGetFqdnCacheIDParamsWithHTTPClient creates a new GetFqdnCacheIDParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetFqdnCacheIDParamsWithHTTPClient(client *http.Client) *GetFqdnCacheIDParams { - return &GetFqdnCacheIDParams{ - HTTPClient: client, - } -} - -/* -GetFqdnCacheIDParams contains all the parameters to send to the API endpoint - - for the get fqdn cache ID operation. - - Typically these are written to a http.Request. -*/ -type GetFqdnCacheIDParams struct { - - /* Cidr. - - A CIDR range of IPs - */ - Cidr *string - - /* ID. - - String describing an endpoint with the format ``[prefix:]id``. If no prefix - is specified, a prefix of ``cilium-local:`` is assumed. Not all endpoints - will be addressable by all endpoint ID prefixes with the exception of the - local Cilium UUID which is assigned to all endpoints. - - Supported endpoint id prefixes: - - cilium-local: Local Cilium endpoint UUID, e.g. cilium-local:3389595 - - cilium-global: Global Cilium endpoint UUID, e.g. cilium-global:cluster1:nodeX:452343 - - cni-attachment-id: CNI attachment ID, e.g. cni-attachment-id:22222:eth0 - - container-id: Container runtime ID, e.g. container-id:22222 (deprecated, may not be unique) - - container-name: Container name, e.g. container-name:foobar (deprecated, may not be unique) - - pod-name: pod name for this container if K8s is enabled, e.g. pod-name:default:foobar (deprecated, may not be unique) - - cep-name: cep name for this container if K8s is enabled, e.g. pod-name:default:foobar-net1 - - docker-endpoint: Docker libnetwork endpoint ID, e.g. docker-endpoint:4444 - - */ - ID string - - /* Matchpattern. - - A toFQDNs compatible matchPattern expression - */ - Matchpattern *string - - /* Source. - - Source from which FQDN entries come from - */ - Source *string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get fqdn cache ID params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetFqdnCacheIDParams) WithDefaults() *GetFqdnCacheIDParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get fqdn cache ID params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetFqdnCacheIDParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get fqdn cache ID params -func (o *GetFqdnCacheIDParams) WithTimeout(timeout time.Duration) *GetFqdnCacheIDParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get fqdn cache ID params -func (o *GetFqdnCacheIDParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get fqdn cache ID params -func (o *GetFqdnCacheIDParams) WithContext(ctx context.Context) *GetFqdnCacheIDParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get fqdn cache ID params -func (o *GetFqdnCacheIDParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get fqdn cache ID params -func (o *GetFqdnCacheIDParams) WithHTTPClient(client *http.Client) *GetFqdnCacheIDParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get fqdn cache ID params -func (o *GetFqdnCacheIDParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithCidr adds the cidr to the get fqdn cache ID params -func (o *GetFqdnCacheIDParams) WithCidr(cidr *string) *GetFqdnCacheIDParams { - o.SetCidr(cidr) - return o -} - -// SetCidr adds the cidr to the get fqdn cache ID params -func (o *GetFqdnCacheIDParams) SetCidr(cidr *string) { - o.Cidr = cidr -} - -// WithID adds the id to the get fqdn cache ID params -func (o *GetFqdnCacheIDParams) WithID(id string) *GetFqdnCacheIDParams { - o.SetID(id) - return o -} - -// SetID adds the id to the get fqdn cache ID params -func (o *GetFqdnCacheIDParams) SetID(id string) { - o.ID = id -} - -// WithMatchpattern adds the matchpattern to the get fqdn cache ID params -func (o *GetFqdnCacheIDParams) WithMatchpattern(matchpattern *string) *GetFqdnCacheIDParams { - o.SetMatchpattern(matchpattern) - return o -} - -// SetMatchpattern adds the matchpattern to the get fqdn cache ID params -func (o *GetFqdnCacheIDParams) SetMatchpattern(matchpattern *string) { - o.Matchpattern = matchpattern -} - -// WithSource adds the source to the get fqdn cache ID params -func (o *GetFqdnCacheIDParams) WithSource(source *string) *GetFqdnCacheIDParams { - o.SetSource(source) - return o -} - -// SetSource adds the source to the get fqdn cache ID params -func (o *GetFqdnCacheIDParams) SetSource(source *string) { - o.Source = source -} - -// WriteToRequest writes these params to a swagger request -func (o *GetFqdnCacheIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if o.Cidr != nil { - - // query param cidr - var qrCidr string - - if o.Cidr != nil { - qrCidr = *o.Cidr - } - qCidr := qrCidr - if qCidr != "" { - - if err := r.SetQueryParam("cidr", qCidr); err != nil { - return err - } - } - } - - // path param id - if err := r.SetPathParam("id", o.ID); err != nil { - return err - } - - if o.Matchpattern != nil { - - // query param matchpattern - var qrMatchpattern string - - if o.Matchpattern != nil { - qrMatchpattern = *o.Matchpattern - } - qMatchpattern := qrMatchpattern - if qMatchpattern != "" { - - if err := r.SetQueryParam("matchpattern", qMatchpattern); err != nil { - return err - } - } - } - - if o.Source != nil { - - // query param source - var qrSource string - - if o.Source != nil { - qrSource = *o.Source - } - qSource := qrSource - if qSource != "" { - - if err := r.SetQueryParam("source", qSource); err != nil { - return err - } - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_fqdn_cache_id_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/get_fqdn_cache_id_responses.go deleted file mode 100644 index 57ce63088..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_fqdn_cache_id_responses.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetFqdnCacheIDReader is a Reader for the GetFqdnCacheID structure. -type GetFqdnCacheIDReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetFqdnCacheIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetFqdnCacheIDOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 400: - result := NewGetFqdnCacheIDBadRequest() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewGetFqdnCacheIDNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /fqdn/cache/{id}] GetFqdnCacheID", response, response.Code()) - } -} - -// NewGetFqdnCacheIDOK creates a GetFqdnCacheIDOK with default headers values -func NewGetFqdnCacheIDOK() *GetFqdnCacheIDOK { - return &GetFqdnCacheIDOK{} -} - -/* -GetFqdnCacheIDOK describes a response with status code 200, with default header values. - -Success -*/ -type GetFqdnCacheIDOK struct { - Payload []*models.DNSLookup -} - -// IsSuccess returns true when this get fqdn cache Id o k response has a 2xx status code -func (o *GetFqdnCacheIDOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get fqdn cache Id o k response has a 3xx status code -func (o *GetFqdnCacheIDOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get fqdn cache Id o k response has a 4xx status code -func (o *GetFqdnCacheIDOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get fqdn cache Id o k response has a 5xx status code -func (o *GetFqdnCacheIDOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get fqdn cache Id o k response a status code equal to that given -func (o *GetFqdnCacheIDOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get fqdn cache Id o k response -func (o *GetFqdnCacheIDOK) Code() int { - return 200 -} - -func (o *GetFqdnCacheIDOK) Error() string { - return fmt.Sprintf("[GET /fqdn/cache/{id}][%d] getFqdnCacheIdOK %+v", 200, o.Payload) -} - -func (o *GetFqdnCacheIDOK) String() string { - return fmt.Sprintf("[GET /fqdn/cache/{id}][%d] getFqdnCacheIdOK %+v", 200, o.Payload) -} - -func (o *GetFqdnCacheIDOK) GetPayload() []*models.DNSLookup { - return o.Payload -} - -func (o *GetFqdnCacheIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetFqdnCacheIDBadRequest creates a GetFqdnCacheIDBadRequest with default headers values -func NewGetFqdnCacheIDBadRequest() *GetFqdnCacheIDBadRequest { - return &GetFqdnCacheIDBadRequest{} -} - -/* -GetFqdnCacheIDBadRequest describes a response with status code 400, with default header values. - -Invalid request (error parsing parameters) -*/ -type GetFqdnCacheIDBadRequest struct { - Payload models.Error -} - -// IsSuccess returns true when this get fqdn cache Id bad request response has a 2xx status code -func (o *GetFqdnCacheIDBadRequest) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get fqdn cache Id bad request response has a 3xx status code -func (o *GetFqdnCacheIDBadRequest) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get fqdn cache Id bad request response has a 4xx status code -func (o *GetFqdnCacheIDBadRequest) IsClientError() bool { - return true -} - -// IsServerError returns true when this get fqdn cache Id bad request response has a 5xx status code -func (o *GetFqdnCacheIDBadRequest) IsServerError() bool { - return false -} - -// IsCode returns true when this get fqdn cache Id bad request response a status code equal to that given -func (o *GetFqdnCacheIDBadRequest) IsCode(code int) bool { - return code == 400 -} - -// Code gets the status code for the get fqdn cache Id bad request response -func (o *GetFqdnCacheIDBadRequest) Code() int { - return 400 -} - -func (o *GetFqdnCacheIDBadRequest) Error() string { - return fmt.Sprintf("[GET /fqdn/cache/{id}][%d] getFqdnCacheIdBadRequest %+v", 400, o.Payload) -} - -func (o *GetFqdnCacheIDBadRequest) String() string { - return fmt.Sprintf("[GET /fqdn/cache/{id}][%d] getFqdnCacheIdBadRequest %+v", 400, o.Payload) -} - -func (o *GetFqdnCacheIDBadRequest) GetPayload() models.Error { - return o.Payload -} - -func (o *GetFqdnCacheIDBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetFqdnCacheIDNotFound creates a GetFqdnCacheIDNotFound with default headers values -func NewGetFqdnCacheIDNotFound() *GetFqdnCacheIDNotFound { - return &GetFqdnCacheIDNotFound{} -} - -/* -GetFqdnCacheIDNotFound describes a response with status code 404, with default header values. - -No DNS data with provided parameters found -*/ -type GetFqdnCacheIDNotFound struct { -} - -// IsSuccess returns true when this get fqdn cache Id not found response has a 2xx status code -func (o *GetFqdnCacheIDNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get fqdn cache Id not found response has a 3xx status code -func (o *GetFqdnCacheIDNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get fqdn cache Id not found response has a 4xx status code -func (o *GetFqdnCacheIDNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this get fqdn cache Id not found response has a 5xx status code -func (o *GetFqdnCacheIDNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this get fqdn cache Id not found response a status code equal to that given -func (o *GetFqdnCacheIDNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the get fqdn cache Id not found response -func (o *GetFqdnCacheIDNotFound) Code() int { - return 404 -} - -func (o *GetFqdnCacheIDNotFound) Error() string { - return fmt.Sprintf("[GET /fqdn/cache/{id}][%d] getFqdnCacheIdNotFound ", 404) -} - -func (o *GetFqdnCacheIDNotFound) String() string { - return fmt.Sprintf("[GET /fqdn/cache/{id}][%d] getFqdnCacheIdNotFound ", 404) -} - -func (o *GetFqdnCacheIDNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_fqdn_cache_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/get_fqdn_cache_parameters.go deleted file mode 100644 index d6eb10e11..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_fqdn_cache_parameters.go +++ /dev/null @@ -1,234 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetFqdnCacheParams creates a new GetFqdnCacheParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetFqdnCacheParams() *GetFqdnCacheParams { - return &GetFqdnCacheParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetFqdnCacheParamsWithTimeout creates a new GetFqdnCacheParams object -// with the ability to set a timeout on a request. -func NewGetFqdnCacheParamsWithTimeout(timeout time.Duration) *GetFqdnCacheParams { - return &GetFqdnCacheParams{ - timeout: timeout, - } -} - -// NewGetFqdnCacheParamsWithContext creates a new GetFqdnCacheParams object -// with the ability to set a context for a request. -func NewGetFqdnCacheParamsWithContext(ctx context.Context) *GetFqdnCacheParams { - return &GetFqdnCacheParams{ - Context: ctx, - } -} - -// NewGetFqdnCacheParamsWithHTTPClient creates a new GetFqdnCacheParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetFqdnCacheParamsWithHTTPClient(client *http.Client) *GetFqdnCacheParams { - return &GetFqdnCacheParams{ - HTTPClient: client, - } -} - -/* -GetFqdnCacheParams contains all the parameters to send to the API endpoint - - for the get fqdn cache operation. - - Typically these are written to a http.Request. -*/ -type GetFqdnCacheParams struct { - - /* Cidr. - - A CIDR range of IPs - */ - Cidr *string - - /* Matchpattern. - - A toFQDNs compatible matchPattern expression - */ - Matchpattern *string - - /* Source. - - Source from which FQDN entries come from - */ - Source *string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get fqdn cache params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetFqdnCacheParams) WithDefaults() *GetFqdnCacheParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get fqdn cache params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetFqdnCacheParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get fqdn cache params -func (o *GetFqdnCacheParams) WithTimeout(timeout time.Duration) *GetFqdnCacheParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get fqdn cache params -func (o *GetFqdnCacheParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get fqdn cache params -func (o *GetFqdnCacheParams) WithContext(ctx context.Context) *GetFqdnCacheParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get fqdn cache params -func (o *GetFqdnCacheParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get fqdn cache params -func (o *GetFqdnCacheParams) WithHTTPClient(client *http.Client) *GetFqdnCacheParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get fqdn cache params -func (o *GetFqdnCacheParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithCidr adds the cidr to the get fqdn cache params -func (o *GetFqdnCacheParams) WithCidr(cidr *string) *GetFqdnCacheParams { - o.SetCidr(cidr) - return o -} - -// SetCidr adds the cidr to the get fqdn cache params -func (o *GetFqdnCacheParams) SetCidr(cidr *string) { - o.Cidr = cidr -} - -// WithMatchpattern adds the matchpattern to the get fqdn cache params -func (o *GetFqdnCacheParams) WithMatchpattern(matchpattern *string) *GetFqdnCacheParams { - o.SetMatchpattern(matchpattern) - return o -} - -// SetMatchpattern adds the matchpattern to the get fqdn cache params -func (o *GetFqdnCacheParams) SetMatchpattern(matchpattern *string) { - o.Matchpattern = matchpattern -} - -// WithSource adds the source to the get fqdn cache params -func (o *GetFqdnCacheParams) WithSource(source *string) *GetFqdnCacheParams { - o.SetSource(source) - return o -} - -// SetSource adds the source to the get fqdn cache params -func (o *GetFqdnCacheParams) SetSource(source *string) { - o.Source = source -} - -// WriteToRequest writes these params to a swagger request -func (o *GetFqdnCacheParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if o.Cidr != nil { - - // query param cidr - var qrCidr string - - if o.Cidr != nil { - qrCidr = *o.Cidr - } - qCidr := qrCidr - if qCidr != "" { - - if err := r.SetQueryParam("cidr", qCidr); err != nil { - return err - } - } - } - - if o.Matchpattern != nil { - - // query param matchpattern - var qrMatchpattern string - - if o.Matchpattern != nil { - qrMatchpattern = *o.Matchpattern - } - qMatchpattern := qrMatchpattern - if qMatchpattern != "" { - - if err := r.SetQueryParam("matchpattern", qMatchpattern); err != nil { - return err - } - } - } - - if o.Source != nil { - - // query param source - var qrSource string - - if o.Source != nil { - qrSource = *o.Source - } - qSource := qrSource - if qSource != "" { - - if err := r.SetQueryParam("source", qSource); err != nil { - return err - } - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_fqdn_cache_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/get_fqdn_cache_responses.go deleted file mode 100644 index fc655cb4c..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_fqdn_cache_responses.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetFqdnCacheReader is a Reader for the GetFqdnCache structure. -type GetFqdnCacheReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetFqdnCacheReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetFqdnCacheOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 400: - result := NewGetFqdnCacheBadRequest() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewGetFqdnCacheNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /fqdn/cache] GetFqdnCache", response, response.Code()) - } -} - -// NewGetFqdnCacheOK creates a GetFqdnCacheOK with default headers values -func NewGetFqdnCacheOK() *GetFqdnCacheOK { - return &GetFqdnCacheOK{} -} - -/* -GetFqdnCacheOK describes a response with status code 200, with default header values. - -Success -*/ -type GetFqdnCacheOK struct { - Payload []*models.DNSLookup -} - -// IsSuccess returns true when this get fqdn cache o k response has a 2xx status code -func (o *GetFqdnCacheOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get fqdn cache o k response has a 3xx status code -func (o *GetFqdnCacheOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get fqdn cache o k response has a 4xx status code -func (o *GetFqdnCacheOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get fqdn cache o k response has a 5xx status code -func (o *GetFqdnCacheOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get fqdn cache o k response a status code equal to that given -func (o *GetFqdnCacheOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get fqdn cache o k response -func (o *GetFqdnCacheOK) Code() int { - return 200 -} - -func (o *GetFqdnCacheOK) Error() string { - return fmt.Sprintf("[GET /fqdn/cache][%d] getFqdnCacheOK %+v", 200, o.Payload) -} - -func (o *GetFqdnCacheOK) String() string { - return fmt.Sprintf("[GET /fqdn/cache][%d] getFqdnCacheOK %+v", 200, o.Payload) -} - -func (o *GetFqdnCacheOK) GetPayload() []*models.DNSLookup { - return o.Payload -} - -func (o *GetFqdnCacheOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetFqdnCacheBadRequest creates a GetFqdnCacheBadRequest with default headers values -func NewGetFqdnCacheBadRequest() *GetFqdnCacheBadRequest { - return &GetFqdnCacheBadRequest{} -} - -/* -GetFqdnCacheBadRequest describes a response with status code 400, with default header values. - -Invalid request (error parsing parameters) -*/ -type GetFqdnCacheBadRequest struct { - Payload models.Error -} - -// IsSuccess returns true when this get fqdn cache bad request response has a 2xx status code -func (o *GetFqdnCacheBadRequest) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get fqdn cache bad request response has a 3xx status code -func (o *GetFqdnCacheBadRequest) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get fqdn cache bad request response has a 4xx status code -func (o *GetFqdnCacheBadRequest) IsClientError() bool { - return true -} - -// IsServerError returns true when this get fqdn cache bad request response has a 5xx status code -func (o *GetFqdnCacheBadRequest) IsServerError() bool { - return false -} - -// IsCode returns true when this get fqdn cache bad request response a status code equal to that given -func (o *GetFqdnCacheBadRequest) IsCode(code int) bool { - return code == 400 -} - -// Code gets the status code for the get fqdn cache bad request response -func (o *GetFqdnCacheBadRequest) Code() int { - return 400 -} - -func (o *GetFqdnCacheBadRequest) Error() string { - return fmt.Sprintf("[GET /fqdn/cache][%d] getFqdnCacheBadRequest %+v", 400, o.Payload) -} - -func (o *GetFqdnCacheBadRequest) String() string { - return fmt.Sprintf("[GET /fqdn/cache][%d] getFqdnCacheBadRequest %+v", 400, o.Payload) -} - -func (o *GetFqdnCacheBadRequest) GetPayload() models.Error { - return o.Payload -} - -func (o *GetFqdnCacheBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetFqdnCacheNotFound creates a GetFqdnCacheNotFound with default headers values -func NewGetFqdnCacheNotFound() *GetFqdnCacheNotFound { - return &GetFqdnCacheNotFound{} -} - -/* -GetFqdnCacheNotFound describes a response with status code 404, with default header values. - -No DNS data with provided parameters found -*/ -type GetFqdnCacheNotFound struct { -} - -// IsSuccess returns true when this get fqdn cache not found response has a 2xx status code -func (o *GetFqdnCacheNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get fqdn cache not found response has a 3xx status code -func (o *GetFqdnCacheNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get fqdn cache not found response has a 4xx status code -func (o *GetFqdnCacheNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this get fqdn cache not found response has a 5xx status code -func (o *GetFqdnCacheNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this get fqdn cache not found response a status code equal to that given -func (o *GetFqdnCacheNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the get fqdn cache not found response -func (o *GetFqdnCacheNotFound) Code() int { - return 404 -} - -func (o *GetFqdnCacheNotFound) Error() string { - return fmt.Sprintf("[GET /fqdn/cache][%d] getFqdnCacheNotFound ", 404) -} - -func (o *GetFqdnCacheNotFound) String() string { - return fmt.Sprintf("[GET /fqdn/cache][%d] getFqdnCacheNotFound ", 404) -} - -func (o *GetFqdnCacheNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_fqdn_names_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/get_fqdn_names_parameters.go deleted file mode 100644 index 1b6743281..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_fqdn_names_parameters.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetFqdnNamesParams creates a new GetFqdnNamesParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetFqdnNamesParams() *GetFqdnNamesParams { - return &GetFqdnNamesParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetFqdnNamesParamsWithTimeout creates a new GetFqdnNamesParams object -// with the ability to set a timeout on a request. -func NewGetFqdnNamesParamsWithTimeout(timeout time.Duration) *GetFqdnNamesParams { - return &GetFqdnNamesParams{ - timeout: timeout, - } -} - -// NewGetFqdnNamesParamsWithContext creates a new GetFqdnNamesParams object -// with the ability to set a context for a request. -func NewGetFqdnNamesParamsWithContext(ctx context.Context) *GetFqdnNamesParams { - return &GetFqdnNamesParams{ - Context: ctx, - } -} - -// NewGetFqdnNamesParamsWithHTTPClient creates a new GetFqdnNamesParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetFqdnNamesParamsWithHTTPClient(client *http.Client) *GetFqdnNamesParams { - return &GetFqdnNamesParams{ - HTTPClient: client, - } -} - -/* -GetFqdnNamesParams contains all the parameters to send to the API endpoint - - for the get fqdn names operation. - - Typically these are written to a http.Request. -*/ -type GetFqdnNamesParams struct { - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get fqdn names params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetFqdnNamesParams) WithDefaults() *GetFqdnNamesParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get fqdn names params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetFqdnNamesParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get fqdn names params -func (o *GetFqdnNamesParams) WithTimeout(timeout time.Duration) *GetFqdnNamesParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get fqdn names params -func (o *GetFqdnNamesParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get fqdn names params -func (o *GetFqdnNamesParams) WithContext(ctx context.Context) *GetFqdnNamesParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get fqdn names params -func (o *GetFqdnNamesParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get fqdn names params -func (o *GetFqdnNamesParams) WithHTTPClient(client *http.Client) *GetFqdnNamesParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get fqdn names params -func (o *GetFqdnNamesParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *GetFqdnNamesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_fqdn_names_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/get_fqdn_names_responses.go deleted file mode 100644 index 502a9afbd..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_fqdn_names_responses.go +++ /dev/null @@ -1,178 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetFqdnNamesReader is a Reader for the GetFqdnNames structure. -type GetFqdnNamesReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetFqdnNamesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetFqdnNamesOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 400: - result := NewGetFqdnNamesBadRequest() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /fqdn/names] GetFqdnNames", response, response.Code()) - } -} - -// NewGetFqdnNamesOK creates a GetFqdnNamesOK with default headers values -func NewGetFqdnNamesOK() *GetFqdnNamesOK { - return &GetFqdnNamesOK{} -} - -/* -GetFqdnNamesOK describes a response with status code 200, with default header values. - -Success -*/ -type GetFqdnNamesOK struct { - Payload *models.NameManager -} - -// IsSuccess returns true when this get fqdn names o k response has a 2xx status code -func (o *GetFqdnNamesOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get fqdn names o k response has a 3xx status code -func (o *GetFqdnNamesOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get fqdn names o k response has a 4xx status code -func (o *GetFqdnNamesOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get fqdn names o k response has a 5xx status code -func (o *GetFqdnNamesOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get fqdn names o k response a status code equal to that given -func (o *GetFqdnNamesOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get fqdn names o k response -func (o *GetFqdnNamesOK) Code() int { - return 200 -} - -func (o *GetFqdnNamesOK) Error() string { - return fmt.Sprintf("[GET /fqdn/names][%d] getFqdnNamesOK %+v", 200, o.Payload) -} - -func (o *GetFqdnNamesOK) String() string { - return fmt.Sprintf("[GET /fqdn/names][%d] getFqdnNamesOK %+v", 200, o.Payload) -} - -func (o *GetFqdnNamesOK) GetPayload() *models.NameManager { - return o.Payload -} - -func (o *GetFqdnNamesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.NameManager) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetFqdnNamesBadRequest creates a GetFqdnNamesBadRequest with default headers values -func NewGetFqdnNamesBadRequest() *GetFqdnNamesBadRequest { - return &GetFqdnNamesBadRequest{} -} - -/* -GetFqdnNamesBadRequest describes a response with status code 400, with default header values. - -Invalid request (error parsing parameters) -*/ -type GetFqdnNamesBadRequest struct { - Payload models.Error -} - -// IsSuccess returns true when this get fqdn names bad request response has a 2xx status code -func (o *GetFqdnNamesBadRequest) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get fqdn names bad request response has a 3xx status code -func (o *GetFqdnNamesBadRequest) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get fqdn names bad request response has a 4xx status code -func (o *GetFqdnNamesBadRequest) IsClientError() bool { - return true -} - -// IsServerError returns true when this get fqdn names bad request response has a 5xx status code -func (o *GetFqdnNamesBadRequest) IsServerError() bool { - return false -} - -// IsCode returns true when this get fqdn names bad request response a status code equal to that given -func (o *GetFqdnNamesBadRequest) IsCode(code int) bool { - return code == 400 -} - -// Code gets the status code for the get fqdn names bad request response -func (o *GetFqdnNamesBadRequest) Code() int { - return 400 -} - -func (o *GetFqdnNamesBadRequest) Error() string { - return fmt.Sprintf("[GET /fqdn/names][%d] getFqdnNamesBadRequest %+v", 400, o.Payload) -} - -func (o *GetFqdnNamesBadRequest) String() string { - return fmt.Sprintf("[GET /fqdn/names][%d] getFqdnNamesBadRequest %+v", 400, o.Payload) -} - -func (o *GetFqdnNamesBadRequest) GetPayload() models.Error { - return o.Payload -} - -func (o *GetFqdnNamesBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_identity_endpoints_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/get_identity_endpoints_parameters.go deleted file mode 100644 index 6a2182829..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_identity_endpoints_parameters.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetIdentityEndpointsParams creates a new GetIdentityEndpointsParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetIdentityEndpointsParams() *GetIdentityEndpointsParams { - return &GetIdentityEndpointsParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetIdentityEndpointsParamsWithTimeout creates a new GetIdentityEndpointsParams object -// with the ability to set a timeout on a request. -func NewGetIdentityEndpointsParamsWithTimeout(timeout time.Duration) *GetIdentityEndpointsParams { - return &GetIdentityEndpointsParams{ - timeout: timeout, - } -} - -// NewGetIdentityEndpointsParamsWithContext creates a new GetIdentityEndpointsParams object -// with the ability to set a context for a request. -func NewGetIdentityEndpointsParamsWithContext(ctx context.Context) *GetIdentityEndpointsParams { - return &GetIdentityEndpointsParams{ - Context: ctx, - } -} - -// NewGetIdentityEndpointsParamsWithHTTPClient creates a new GetIdentityEndpointsParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetIdentityEndpointsParamsWithHTTPClient(client *http.Client) *GetIdentityEndpointsParams { - return &GetIdentityEndpointsParams{ - HTTPClient: client, - } -} - -/* -GetIdentityEndpointsParams contains all the parameters to send to the API endpoint - - for the get identity endpoints operation. - - Typically these are written to a http.Request. -*/ -type GetIdentityEndpointsParams struct { - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get identity endpoints params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetIdentityEndpointsParams) WithDefaults() *GetIdentityEndpointsParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get identity endpoints params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetIdentityEndpointsParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get identity endpoints params -func (o *GetIdentityEndpointsParams) WithTimeout(timeout time.Duration) *GetIdentityEndpointsParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get identity endpoints params -func (o *GetIdentityEndpointsParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get identity endpoints params -func (o *GetIdentityEndpointsParams) WithContext(ctx context.Context) *GetIdentityEndpointsParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get identity endpoints params -func (o *GetIdentityEndpointsParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get identity endpoints params -func (o *GetIdentityEndpointsParams) WithHTTPClient(client *http.Client) *GetIdentityEndpointsParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get identity endpoints params -func (o *GetIdentityEndpointsParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *GetIdentityEndpointsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_identity_endpoints_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/get_identity_endpoints_responses.go deleted file mode 100644 index 2f079618e..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_identity_endpoints_responses.go +++ /dev/null @@ -1,166 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetIdentityEndpointsReader is a Reader for the GetIdentityEndpoints structure. -type GetIdentityEndpointsReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetIdentityEndpointsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetIdentityEndpointsOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 404: - result := NewGetIdentityEndpointsNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /identity/endpoints] GetIdentityEndpoints", response, response.Code()) - } -} - -// NewGetIdentityEndpointsOK creates a GetIdentityEndpointsOK with default headers values -func NewGetIdentityEndpointsOK() *GetIdentityEndpointsOK { - return &GetIdentityEndpointsOK{} -} - -/* -GetIdentityEndpointsOK describes a response with status code 200, with default header values. - -Success -*/ -type GetIdentityEndpointsOK struct { - Payload []*models.IdentityEndpoints -} - -// IsSuccess returns true when this get identity endpoints o k response has a 2xx status code -func (o *GetIdentityEndpointsOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get identity endpoints o k response has a 3xx status code -func (o *GetIdentityEndpointsOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get identity endpoints o k response has a 4xx status code -func (o *GetIdentityEndpointsOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get identity endpoints o k response has a 5xx status code -func (o *GetIdentityEndpointsOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get identity endpoints o k response a status code equal to that given -func (o *GetIdentityEndpointsOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get identity endpoints o k response -func (o *GetIdentityEndpointsOK) Code() int { - return 200 -} - -func (o *GetIdentityEndpointsOK) Error() string { - return fmt.Sprintf("[GET /identity/endpoints][%d] getIdentityEndpointsOK %+v", 200, o.Payload) -} - -func (o *GetIdentityEndpointsOK) String() string { - return fmt.Sprintf("[GET /identity/endpoints][%d] getIdentityEndpointsOK %+v", 200, o.Payload) -} - -func (o *GetIdentityEndpointsOK) GetPayload() []*models.IdentityEndpoints { - return o.Payload -} - -func (o *GetIdentityEndpointsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetIdentityEndpointsNotFound creates a GetIdentityEndpointsNotFound with default headers values -func NewGetIdentityEndpointsNotFound() *GetIdentityEndpointsNotFound { - return &GetIdentityEndpointsNotFound{} -} - -/* -GetIdentityEndpointsNotFound describes a response with status code 404, with default header values. - -Set of identities which are being used by local endpoints could not be found. -*/ -type GetIdentityEndpointsNotFound struct { -} - -// IsSuccess returns true when this get identity endpoints not found response has a 2xx status code -func (o *GetIdentityEndpointsNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get identity endpoints not found response has a 3xx status code -func (o *GetIdentityEndpointsNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get identity endpoints not found response has a 4xx status code -func (o *GetIdentityEndpointsNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this get identity endpoints not found response has a 5xx status code -func (o *GetIdentityEndpointsNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this get identity endpoints not found response a status code equal to that given -func (o *GetIdentityEndpointsNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the get identity endpoints not found response -func (o *GetIdentityEndpointsNotFound) Code() int { - return 404 -} - -func (o *GetIdentityEndpointsNotFound) Error() string { - return fmt.Sprintf("[GET /identity/endpoints][%d] getIdentityEndpointsNotFound ", 404) -} - -func (o *GetIdentityEndpointsNotFound) String() string { - return fmt.Sprintf("[GET /identity/endpoints][%d] getIdentityEndpointsNotFound ", 404) -} - -func (o *GetIdentityEndpointsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_identity_id_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/get_identity_id_parameters.go deleted file mode 100644 index f17fa6651..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_identity_id_parameters.go +++ /dev/null @@ -1,155 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetIdentityIDParams creates a new GetIdentityIDParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetIdentityIDParams() *GetIdentityIDParams { - return &GetIdentityIDParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetIdentityIDParamsWithTimeout creates a new GetIdentityIDParams object -// with the ability to set a timeout on a request. -func NewGetIdentityIDParamsWithTimeout(timeout time.Duration) *GetIdentityIDParams { - return &GetIdentityIDParams{ - timeout: timeout, - } -} - -// NewGetIdentityIDParamsWithContext creates a new GetIdentityIDParams object -// with the ability to set a context for a request. -func NewGetIdentityIDParamsWithContext(ctx context.Context) *GetIdentityIDParams { - return &GetIdentityIDParams{ - Context: ctx, - } -} - -// NewGetIdentityIDParamsWithHTTPClient creates a new GetIdentityIDParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetIdentityIDParamsWithHTTPClient(client *http.Client) *GetIdentityIDParams { - return &GetIdentityIDParams{ - HTTPClient: client, - } -} - -/* -GetIdentityIDParams contains all the parameters to send to the API endpoint - - for the get identity ID operation. - - Typically these are written to a http.Request. -*/ -type GetIdentityIDParams struct { - - /* ID. - - Cluster wide unique identifier of a security identity. - - */ - ID string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get identity ID params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetIdentityIDParams) WithDefaults() *GetIdentityIDParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get identity ID params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetIdentityIDParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get identity ID params -func (o *GetIdentityIDParams) WithTimeout(timeout time.Duration) *GetIdentityIDParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get identity ID params -func (o *GetIdentityIDParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get identity ID params -func (o *GetIdentityIDParams) WithContext(ctx context.Context) *GetIdentityIDParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get identity ID params -func (o *GetIdentityIDParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get identity ID params -func (o *GetIdentityIDParams) WithHTTPClient(client *http.Client) *GetIdentityIDParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get identity ID params -func (o *GetIdentityIDParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithID adds the id to the get identity ID params -func (o *GetIdentityIDParams) WithID(id string) *GetIdentityIDParams { - o.SetID(id) - return o -} - -// SetID adds the id to the get identity ID params -func (o *GetIdentityIDParams) SetID(id string) { - o.ID = id -} - -// WriteToRequest writes these params to a swagger request -func (o *GetIdentityIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - // path param id - if err := r.SetPathParam("id", o.ID); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_identity_id_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/get_identity_id_responses.go deleted file mode 100644 index 80a71d730..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_identity_id_responses.go +++ /dev/null @@ -1,374 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetIdentityIDReader is a Reader for the GetIdentityID structure. -type GetIdentityIDReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetIdentityIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetIdentityIDOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 400: - result := NewGetIdentityIDBadRequest() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewGetIdentityIDNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 520: - result := NewGetIdentityIDUnreachable() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 521: - result := NewGetIdentityIDInvalidStorageFormat() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /identity/{id}] GetIdentityID", response, response.Code()) - } -} - -// NewGetIdentityIDOK creates a GetIdentityIDOK with default headers values -func NewGetIdentityIDOK() *GetIdentityIDOK { - return &GetIdentityIDOK{} -} - -/* -GetIdentityIDOK describes a response with status code 200, with default header values. - -Success -*/ -type GetIdentityIDOK struct { - Payload *models.Identity -} - -// IsSuccess returns true when this get identity Id o k response has a 2xx status code -func (o *GetIdentityIDOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get identity Id o k response has a 3xx status code -func (o *GetIdentityIDOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get identity Id o k response has a 4xx status code -func (o *GetIdentityIDOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get identity Id o k response has a 5xx status code -func (o *GetIdentityIDOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get identity Id o k response a status code equal to that given -func (o *GetIdentityIDOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get identity Id o k response -func (o *GetIdentityIDOK) Code() int { - return 200 -} - -func (o *GetIdentityIDOK) Error() string { - return fmt.Sprintf("[GET /identity/{id}][%d] getIdentityIdOK %+v", 200, o.Payload) -} - -func (o *GetIdentityIDOK) String() string { - return fmt.Sprintf("[GET /identity/{id}][%d] getIdentityIdOK %+v", 200, o.Payload) -} - -func (o *GetIdentityIDOK) GetPayload() *models.Identity { - return o.Payload -} - -func (o *GetIdentityIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.Identity) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetIdentityIDBadRequest creates a GetIdentityIDBadRequest with default headers values -func NewGetIdentityIDBadRequest() *GetIdentityIDBadRequest { - return &GetIdentityIDBadRequest{} -} - -/* -GetIdentityIDBadRequest describes a response with status code 400, with default header values. - -Invalid identity provided -*/ -type GetIdentityIDBadRequest struct { -} - -// IsSuccess returns true when this get identity Id bad request response has a 2xx status code -func (o *GetIdentityIDBadRequest) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get identity Id bad request response has a 3xx status code -func (o *GetIdentityIDBadRequest) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get identity Id bad request response has a 4xx status code -func (o *GetIdentityIDBadRequest) IsClientError() bool { - return true -} - -// IsServerError returns true when this get identity Id bad request response has a 5xx status code -func (o *GetIdentityIDBadRequest) IsServerError() bool { - return false -} - -// IsCode returns true when this get identity Id bad request response a status code equal to that given -func (o *GetIdentityIDBadRequest) IsCode(code int) bool { - return code == 400 -} - -// Code gets the status code for the get identity Id bad request response -func (o *GetIdentityIDBadRequest) Code() int { - return 400 -} - -func (o *GetIdentityIDBadRequest) Error() string { - return fmt.Sprintf("[GET /identity/{id}][%d] getIdentityIdBadRequest ", 400) -} - -func (o *GetIdentityIDBadRequest) String() string { - return fmt.Sprintf("[GET /identity/{id}][%d] getIdentityIdBadRequest ", 400) -} - -func (o *GetIdentityIDBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewGetIdentityIDNotFound creates a GetIdentityIDNotFound with default headers values -func NewGetIdentityIDNotFound() *GetIdentityIDNotFound { - return &GetIdentityIDNotFound{} -} - -/* -GetIdentityIDNotFound describes a response with status code 404, with default header values. - -Identity not found -*/ -type GetIdentityIDNotFound struct { -} - -// IsSuccess returns true when this get identity Id not found response has a 2xx status code -func (o *GetIdentityIDNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get identity Id not found response has a 3xx status code -func (o *GetIdentityIDNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get identity Id not found response has a 4xx status code -func (o *GetIdentityIDNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this get identity Id not found response has a 5xx status code -func (o *GetIdentityIDNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this get identity Id not found response a status code equal to that given -func (o *GetIdentityIDNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the get identity Id not found response -func (o *GetIdentityIDNotFound) Code() int { - return 404 -} - -func (o *GetIdentityIDNotFound) Error() string { - return fmt.Sprintf("[GET /identity/{id}][%d] getIdentityIdNotFound ", 404) -} - -func (o *GetIdentityIDNotFound) String() string { - return fmt.Sprintf("[GET /identity/{id}][%d] getIdentityIdNotFound ", 404) -} - -func (o *GetIdentityIDNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewGetIdentityIDUnreachable creates a GetIdentityIDUnreachable with default headers values -func NewGetIdentityIDUnreachable() *GetIdentityIDUnreachable { - return &GetIdentityIDUnreachable{} -} - -/* -GetIdentityIDUnreachable describes a response with status code 520, with default header values. - -Identity storage unreachable. Likely a network problem. -*/ -type GetIdentityIDUnreachable struct { - Payload models.Error -} - -// IsSuccess returns true when this get identity Id unreachable response has a 2xx status code -func (o *GetIdentityIDUnreachable) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get identity Id unreachable response has a 3xx status code -func (o *GetIdentityIDUnreachable) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get identity Id unreachable response has a 4xx status code -func (o *GetIdentityIDUnreachable) IsClientError() bool { - return false -} - -// IsServerError returns true when this get identity Id unreachable response has a 5xx status code -func (o *GetIdentityIDUnreachable) IsServerError() bool { - return true -} - -// IsCode returns true when this get identity Id unreachable response a status code equal to that given -func (o *GetIdentityIDUnreachable) IsCode(code int) bool { - return code == 520 -} - -// Code gets the status code for the get identity Id unreachable response -func (o *GetIdentityIDUnreachable) Code() int { - return 520 -} - -func (o *GetIdentityIDUnreachable) Error() string { - return fmt.Sprintf("[GET /identity/{id}][%d] getIdentityIdUnreachable %+v", 520, o.Payload) -} - -func (o *GetIdentityIDUnreachable) String() string { - return fmt.Sprintf("[GET /identity/{id}][%d] getIdentityIdUnreachable %+v", 520, o.Payload) -} - -func (o *GetIdentityIDUnreachable) GetPayload() models.Error { - return o.Payload -} - -func (o *GetIdentityIDUnreachable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetIdentityIDInvalidStorageFormat creates a GetIdentityIDInvalidStorageFormat with default headers values -func NewGetIdentityIDInvalidStorageFormat() *GetIdentityIDInvalidStorageFormat { - return &GetIdentityIDInvalidStorageFormat{} -} - -/* -GetIdentityIDInvalidStorageFormat describes a response with status code 521, with default header values. - -Invalid identity format in storage -*/ -type GetIdentityIDInvalidStorageFormat struct { - Payload models.Error -} - -// IsSuccess returns true when this get identity Id invalid storage format response has a 2xx status code -func (o *GetIdentityIDInvalidStorageFormat) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get identity Id invalid storage format response has a 3xx status code -func (o *GetIdentityIDInvalidStorageFormat) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get identity Id invalid storage format response has a 4xx status code -func (o *GetIdentityIDInvalidStorageFormat) IsClientError() bool { - return false -} - -// IsServerError returns true when this get identity Id invalid storage format response has a 5xx status code -func (o *GetIdentityIDInvalidStorageFormat) IsServerError() bool { - return true -} - -// IsCode returns true when this get identity Id invalid storage format response a status code equal to that given -func (o *GetIdentityIDInvalidStorageFormat) IsCode(code int) bool { - return code == 521 -} - -// Code gets the status code for the get identity Id invalid storage format response -func (o *GetIdentityIDInvalidStorageFormat) Code() int { - return 521 -} - -func (o *GetIdentityIDInvalidStorageFormat) Error() string { - return fmt.Sprintf("[GET /identity/{id}][%d] getIdentityIdInvalidStorageFormat %+v", 521, o.Payload) -} - -func (o *GetIdentityIDInvalidStorageFormat) String() string { - return fmt.Sprintf("[GET /identity/{id}][%d] getIdentityIdInvalidStorageFormat %+v", 521, o.Payload) -} - -func (o *GetIdentityIDInvalidStorageFormat) GetPayload() models.Error { - return o.Payload -} - -func (o *GetIdentityIDInvalidStorageFormat) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_identity_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/get_identity_parameters.go deleted file mode 100644 index a5a0fe298..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_identity_parameters.go +++ /dev/null @@ -1,157 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// NewGetIdentityParams creates a new GetIdentityParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetIdentityParams() *GetIdentityParams { - return &GetIdentityParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetIdentityParamsWithTimeout creates a new GetIdentityParams object -// with the ability to set a timeout on a request. -func NewGetIdentityParamsWithTimeout(timeout time.Duration) *GetIdentityParams { - return &GetIdentityParams{ - timeout: timeout, - } -} - -// NewGetIdentityParamsWithContext creates a new GetIdentityParams object -// with the ability to set a context for a request. -func NewGetIdentityParamsWithContext(ctx context.Context) *GetIdentityParams { - return &GetIdentityParams{ - Context: ctx, - } -} - -// NewGetIdentityParamsWithHTTPClient creates a new GetIdentityParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetIdentityParamsWithHTTPClient(client *http.Client) *GetIdentityParams { - return &GetIdentityParams{ - HTTPClient: client, - } -} - -/* -GetIdentityParams contains all the parameters to send to the API endpoint - - for the get identity operation. - - Typically these are written to a http.Request. -*/ -type GetIdentityParams struct { - - /* Labels. - - List of labels - - */ - Labels models.Labels - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get identity params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetIdentityParams) WithDefaults() *GetIdentityParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get identity params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetIdentityParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get identity params -func (o *GetIdentityParams) WithTimeout(timeout time.Duration) *GetIdentityParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get identity params -func (o *GetIdentityParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get identity params -func (o *GetIdentityParams) WithContext(ctx context.Context) *GetIdentityParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get identity params -func (o *GetIdentityParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get identity params -func (o *GetIdentityParams) WithHTTPClient(client *http.Client) *GetIdentityParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get identity params -func (o *GetIdentityParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithLabels adds the labels to the get identity params -func (o *GetIdentityParams) WithLabels(labels models.Labels) *GetIdentityParams { - o.SetLabels(labels) - return o -} - -// SetLabels adds the labels to the get identity params -func (o *GetIdentityParams) SetLabels(labels models.Labels) { - o.Labels = labels -} - -// WriteToRequest writes these params to a swagger request -func (o *GetIdentityParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if o.Labels != nil { - if err := r.SetBodyParam(o.Labels); err != nil { - return err - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_identity_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/get_identity_responses.go deleted file mode 100644 index 23fc0a845..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_identity_responses.go +++ /dev/null @@ -1,310 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetIdentityReader is a Reader for the GetIdentity structure. -type GetIdentityReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetIdentityReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetIdentityOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 404: - result := NewGetIdentityNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 520: - result := NewGetIdentityUnreachable() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 521: - result := NewGetIdentityInvalidStorageFormat() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /identity] GetIdentity", response, response.Code()) - } -} - -// NewGetIdentityOK creates a GetIdentityOK with default headers values -func NewGetIdentityOK() *GetIdentityOK { - return &GetIdentityOK{} -} - -/* -GetIdentityOK describes a response with status code 200, with default header values. - -Success -*/ -type GetIdentityOK struct { - Payload []*models.Identity -} - -// IsSuccess returns true when this get identity o k response has a 2xx status code -func (o *GetIdentityOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get identity o k response has a 3xx status code -func (o *GetIdentityOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get identity o k response has a 4xx status code -func (o *GetIdentityOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get identity o k response has a 5xx status code -func (o *GetIdentityOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get identity o k response a status code equal to that given -func (o *GetIdentityOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get identity o k response -func (o *GetIdentityOK) Code() int { - return 200 -} - -func (o *GetIdentityOK) Error() string { - return fmt.Sprintf("[GET /identity][%d] getIdentityOK %+v", 200, o.Payload) -} - -func (o *GetIdentityOK) String() string { - return fmt.Sprintf("[GET /identity][%d] getIdentityOK %+v", 200, o.Payload) -} - -func (o *GetIdentityOK) GetPayload() []*models.Identity { - return o.Payload -} - -func (o *GetIdentityOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetIdentityNotFound creates a GetIdentityNotFound with default headers values -func NewGetIdentityNotFound() *GetIdentityNotFound { - return &GetIdentityNotFound{} -} - -/* -GetIdentityNotFound describes a response with status code 404, with default header values. - -Identities with provided parameters not found -*/ -type GetIdentityNotFound struct { -} - -// IsSuccess returns true when this get identity not found response has a 2xx status code -func (o *GetIdentityNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get identity not found response has a 3xx status code -func (o *GetIdentityNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get identity not found response has a 4xx status code -func (o *GetIdentityNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this get identity not found response has a 5xx status code -func (o *GetIdentityNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this get identity not found response a status code equal to that given -func (o *GetIdentityNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the get identity not found response -func (o *GetIdentityNotFound) Code() int { - return 404 -} - -func (o *GetIdentityNotFound) Error() string { - return fmt.Sprintf("[GET /identity][%d] getIdentityNotFound ", 404) -} - -func (o *GetIdentityNotFound) String() string { - return fmt.Sprintf("[GET /identity][%d] getIdentityNotFound ", 404) -} - -func (o *GetIdentityNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewGetIdentityUnreachable creates a GetIdentityUnreachable with default headers values -func NewGetIdentityUnreachable() *GetIdentityUnreachable { - return &GetIdentityUnreachable{} -} - -/* -GetIdentityUnreachable describes a response with status code 520, with default header values. - -Identity storage unreachable. Likely a network problem. -*/ -type GetIdentityUnreachable struct { - Payload models.Error -} - -// IsSuccess returns true when this get identity unreachable response has a 2xx status code -func (o *GetIdentityUnreachable) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get identity unreachable response has a 3xx status code -func (o *GetIdentityUnreachable) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get identity unreachable response has a 4xx status code -func (o *GetIdentityUnreachable) IsClientError() bool { - return false -} - -// IsServerError returns true when this get identity unreachable response has a 5xx status code -func (o *GetIdentityUnreachable) IsServerError() bool { - return true -} - -// IsCode returns true when this get identity unreachable response a status code equal to that given -func (o *GetIdentityUnreachable) IsCode(code int) bool { - return code == 520 -} - -// Code gets the status code for the get identity unreachable response -func (o *GetIdentityUnreachable) Code() int { - return 520 -} - -func (o *GetIdentityUnreachable) Error() string { - return fmt.Sprintf("[GET /identity][%d] getIdentityUnreachable %+v", 520, o.Payload) -} - -func (o *GetIdentityUnreachable) String() string { - return fmt.Sprintf("[GET /identity][%d] getIdentityUnreachable %+v", 520, o.Payload) -} - -func (o *GetIdentityUnreachable) GetPayload() models.Error { - return o.Payload -} - -func (o *GetIdentityUnreachable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetIdentityInvalidStorageFormat creates a GetIdentityInvalidStorageFormat with default headers values -func NewGetIdentityInvalidStorageFormat() *GetIdentityInvalidStorageFormat { - return &GetIdentityInvalidStorageFormat{} -} - -/* -GetIdentityInvalidStorageFormat describes a response with status code 521, with default header values. - -Invalid identity format in storage -*/ -type GetIdentityInvalidStorageFormat struct { - Payload models.Error -} - -// IsSuccess returns true when this get identity invalid storage format response has a 2xx status code -func (o *GetIdentityInvalidStorageFormat) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get identity invalid storage format response has a 3xx status code -func (o *GetIdentityInvalidStorageFormat) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get identity invalid storage format response has a 4xx status code -func (o *GetIdentityInvalidStorageFormat) IsClientError() bool { - return false -} - -// IsServerError returns true when this get identity invalid storage format response has a 5xx status code -func (o *GetIdentityInvalidStorageFormat) IsServerError() bool { - return true -} - -// IsCode returns true when this get identity invalid storage format response a status code equal to that given -func (o *GetIdentityInvalidStorageFormat) IsCode(code int) bool { - return code == 521 -} - -// Code gets the status code for the get identity invalid storage format response -func (o *GetIdentityInvalidStorageFormat) Code() int { - return 521 -} - -func (o *GetIdentityInvalidStorageFormat) Error() string { - return fmt.Sprintf("[GET /identity][%d] getIdentityInvalidStorageFormat %+v", 521, o.Payload) -} - -func (o *GetIdentityInvalidStorageFormat) String() string { - return fmt.Sprintf("[GET /identity][%d] getIdentityInvalidStorageFormat %+v", 521, o.Payload) -} - -func (o *GetIdentityInvalidStorageFormat) GetPayload() models.Error { - return o.Payload -} - -func (o *GetIdentityInvalidStorageFormat) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_ip_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/get_ip_parameters.go deleted file mode 100644 index 2f7c23112..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_ip_parameters.go +++ /dev/null @@ -1,166 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetIPParams creates a new GetIPParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetIPParams() *GetIPParams { - return &GetIPParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetIPParamsWithTimeout creates a new GetIPParams object -// with the ability to set a timeout on a request. -func NewGetIPParamsWithTimeout(timeout time.Duration) *GetIPParams { - return &GetIPParams{ - timeout: timeout, - } -} - -// NewGetIPParamsWithContext creates a new GetIPParams object -// with the ability to set a context for a request. -func NewGetIPParamsWithContext(ctx context.Context) *GetIPParams { - return &GetIPParams{ - Context: ctx, - } -} - -// NewGetIPParamsWithHTTPClient creates a new GetIPParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetIPParamsWithHTTPClient(client *http.Client) *GetIPParams { - return &GetIPParams{ - HTTPClient: client, - } -} - -/* -GetIPParams contains all the parameters to send to the API endpoint - - for the get IP operation. - - Typically these are written to a http.Request. -*/ -type GetIPParams struct { - - /* Cidr. - - A CIDR range of IPs - */ - Cidr *string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get IP params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetIPParams) WithDefaults() *GetIPParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get IP params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetIPParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get IP params -func (o *GetIPParams) WithTimeout(timeout time.Duration) *GetIPParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get IP params -func (o *GetIPParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get IP params -func (o *GetIPParams) WithContext(ctx context.Context) *GetIPParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get IP params -func (o *GetIPParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get IP params -func (o *GetIPParams) WithHTTPClient(client *http.Client) *GetIPParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get IP params -func (o *GetIPParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithCidr adds the cidr to the get IP params -func (o *GetIPParams) WithCidr(cidr *string) *GetIPParams { - o.SetCidr(cidr) - return o -} - -// SetCidr adds the cidr to the get IP params -func (o *GetIPParams) SetCidr(cidr *string) { - o.Cidr = cidr -} - -// WriteToRequest writes these params to a swagger request -func (o *GetIPParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if o.Cidr != nil { - - // query param cidr - var qrCidr string - - if o.Cidr != nil { - qrCidr = *o.Cidr - } - qCidr := qrCidr - if qCidr != "" { - - if err := r.SetQueryParam("cidr", qCidr); err != nil { - return err - } - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_ip_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/get_ip_responses.go deleted file mode 100644 index 0f9ca3a89..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_ip_responses.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetIPReader is a Reader for the GetIP structure. -type GetIPReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetIPReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetIPOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 400: - result := NewGetIPBadRequest() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewGetIPNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /ip] GetIP", response, response.Code()) - } -} - -// NewGetIPOK creates a GetIPOK with default headers values -func NewGetIPOK() *GetIPOK { - return &GetIPOK{} -} - -/* -GetIPOK describes a response with status code 200, with default header values. - -Success -*/ -type GetIPOK struct { - Payload []*models.IPListEntry -} - -// IsSuccess returns true when this get Ip o k response has a 2xx status code -func (o *GetIPOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get Ip o k response has a 3xx status code -func (o *GetIPOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get Ip o k response has a 4xx status code -func (o *GetIPOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get Ip o k response has a 5xx status code -func (o *GetIPOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get Ip o k response a status code equal to that given -func (o *GetIPOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get Ip o k response -func (o *GetIPOK) Code() int { - return 200 -} - -func (o *GetIPOK) Error() string { - return fmt.Sprintf("[GET /ip][%d] getIpOK %+v", 200, o.Payload) -} - -func (o *GetIPOK) String() string { - return fmt.Sprintf("[GET /ip][%d] getIpOK %+v", 200, o.Payload) -} - -func (o *GetIPOK) GetPayload() []*models.IPListEntry { - return o.Payload -} - -func (o *GetIPOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetIPBadRequest creates a GetIPBadRequest with default headers values -func NewGetIPBadRequest() *GetIPBadRequest { - return &GetIPBadRequest{} -} - -/* -GetIPBadRequest describes a response with status code 400, with default header values. - -Invalid request (error parsing parameters) -*/ -type GetIPBadRequest struct { - Payload models.Error -} - -// IsSuccess returns true when this get Ip bad request response has a 2xx status code -func (o *GetIPBadRequest) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get Ip bad request response has a 3xx status code -func (o *GetIPBadRequest) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get Ip bad request response has a 4xx status code -func (o *GetIPBadRequest) IsClientError() bool { - return true -} - -// IsServerError returns true when this get Ip bad request response has a 5xx status code -func (o *GetIPBadRequest) IsServerError() bool { - return false -} - -// IsCode returns true when this get Ip bad request response a status code equal to that given -func (o *GetIPBadRequest) IsCode(code int) bool { - return code == 400 -} - -// Code gets the status code for the get Ip bad request response -func (o *GetIPBadRequest) Code() int { - return 400 -} - -func (o *GetIPBadRequest) Error() string { - return fmt.Sprintf("[GET /ip][%d] getIpBadRequest %+v", 400, o.Payload) -} - -func (o *GetIPBadRequest) String() string { - return fmt.Sprintf("[GET /ip][%d] getIpBadRequest %+v", 400, o.Payload) -} - -func (o *GetIPBadRequest) GetPayload() models.Error { - return o.Payload -} - -func (o *GetIPBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetIPNotFound creates a GetIPNotFound with default headers values -func NewGetIPNotFound() *GetIPNotFound { - return &GetIPNotFound{} -} - -/* -GetIPNotFound describes a response with status code 404, with default header values. - -No IP cache entries with provided parameters found -*/ -type GetIPNotFound struct { -} - -// IsSuccess returns true when this get Ip not found response has a 2xx status code -func (o *GetIPNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get Ip not found response has a 3xx status code -func (o *GetIPNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get Ip not found response has a 4xx status code -func (o *GetIPNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this get Ip not found response has a 5xx status code -func (o *GetIPNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this get Ip not found response a status code equal to that given -func (o *GetIPNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the get Ip not found response -func (o *GetIPNotFound) Code() int { - return 404 -} - -func (o *GetIPNotFound) Error() string { - return fmt.Sprintf("[GET /ip][%d] getIpNotFound ", 404) -} - -func (o *GetIPNotFound) String() string { - return fmt.Sprintf("[GET /ip][%d] getIpNotFound ", 404) -} - -func (o *GetIPNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_policy_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/get_policy_parameters.go deleted file mode 100644 index 33c66c92a..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_policy_parameters.go +++ /dev/null @@ -1,153 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// NewGetPolicyParams creates a new GetPolicyParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetPolicyParams() *GetPolicyParams { - return &GetPolicyParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetPolicyParamsWithTimeout creates a new GetPolicyParams object -// with the ability to set a timeout on a request. -func NewGetPolicyParamsWithTimeout(timeout time.Duration) *GetPolicyParams { - return &GetPolicyParams{ - timeout: timeout, - } -} - -// NewGetPolicyParamsWithContext creates a new GetPolicyParams object -// with the ability to set a context for a request. -func NewGetPolicyParamsWithContext(ctx context.Context) *GetPolicyParams { - return &GetPolicyParams{ - Context: ctx, - } -} - -// NewGetPolicyParamsWithHTTPClient creates a new GetPolicyParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetPolicyParamsWithHTTPClient(client *http.Client) *GetPolicyParams { - return &GetPolicyParams{ - HTTPClient: client, - } -} - -/* -GetPolicyParams contains all the parameters to send to the API endpoint - - for the get policy operation. - - Typically these are written to a http.Request. -*/ -type GetPolicyParams struct { - - // Labels. - Labels models.Labels - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get policy params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetPolicyParams) WithDefaults() *GetPolicyParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get policy params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetPolicyParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get policy params -func (o *GetPolicyParams) WithTimeout(timeout time.Duration) *GetPolicyParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get policy params -func (o *GetPolicyParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get policy params -func (o *GetPolicyParams) WithContext(ctx context.Context) *GetPolicyParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get policy params -func (o *GetPolicyParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get policy params -func (o *GetPolicyParams) WithHTTPClient(client *http.Client) *GetPolicyParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get policy params -func (o *GetPolicyParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithLabels adds the labels to the get policy params -func (o *GetPolicyParams) WithLabels(labels models.Labels) *GetPolicyParams { - o.SetLabels(labels) - return o -} - -// SetLabels adds the labels to the get policy params -func (o *GetPolicyParams) SetLabels(labels models.Labels) { - o.Labels = labels -} - -// WriteToRequest writes these params to a swagger request -func (o *GetPolicyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if o.Labels != nil { - if err := r.SetBodyParam(o.Labels); err != nil { - return err - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_policy_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/get_policy_responses.go deleted file mode 100644 index da464ed21..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_policy_responses.go +++ /dev/null @@ -1,168 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetPolicyReader is a Reader for the GetPolicy structure. -type GetPolicyReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetPolicyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetPolicyOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 404: - result := NewGetPolicyNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /policy] GetPolicy", response, response.Code()) - } -} - -// NewGetPolicyOK creates a GetPolicyOK with default headers values -func NewGetPolicyOK() *GetPolicyOK { - return &GetPolicyOK{} -} - -/* -GetPolicyOK describes a response with status code 200, with default header values. - -Success -*/ -type GetPolicyOK struct { - Payload *models.Policy -} - -// IsSuccess returns true when this get policy o k response has a 2xx status code -func (o *GetPolicyOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get policy o k response has a 3xx status code -func (o *GetPolicyOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get policy o k response has a 4xx status code -func (o *GetPolicyOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get policy o k response has a 5xx status code -func (o *GetPolicyOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get policy o k response a status code equal to that given -func (o *GetPolicyOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get policy o k response -func (o *GetPolicyOK) Code() int { - return 200 -} - -func (o *GetPolicyOK) Error() string { - return fmt.Sprintf("[GET /policy][%d] getPolicyOK %+v", 200, o.Payload) -} - -func (o *GetPolicyOK) String() string { - return fmt.Sprintf("[GET /policy][%d] getPolicyOK %+v", 200, o.Payload) -} - -func (o *GetPolicyOK) GetPayload() *models.Policy { - return o.Payload -} - -func (o *GetPolicyOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.Policy) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetPolicyNotFound creates a GetPolicyNotFound with default headers values -func NewGetPolicyNotFound() *GetPolicyNotFound { - return &GetPolicyNotFound{} -} - -/* -GetPolicyNotFound describes a response with status code 404, with default header values. - -No policy rules found -*/ -type GetPolicyNotFound struct { -} - -// IsSuccess returns true when this get policy not found response has a 2xx status code -func (o *GetPolicyNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get policy not found response has a 3xx status code -func (o *GetPolicyNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get policy not found response has a 4xx status code -func (o *GetPolicyNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this get policy not found response has a 5xx status code -func (o *GetPolicyNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this get policy not found response a status code equal to that given -func (o *GetPolicyNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the get policy not found response -func (o *GetPolicyNotFound) Code() int { - return 404 -} - -func (o *GetPolicyNotFound) Error() string { - return fmt.Sprintf("[GET /policy][%d] getPolicyNotFound ", 404) -} - -func (o *GetPolicyNotFound) String() string { - return fmt.Sprintf("[GET /policy][%d] getPolicyNotFound ", 404) -} - -func (o *GetPolicyNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_policy_selectors_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/get_policy_selectors_parameters.go deleted file mode 100644 index 388f81f59..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_policy_selectors_parameters.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetPolicySelectorsParams creates a new GetPolicySelectorsParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetPolicySelectorsParams() *GetPolicySelectorsParams { - return &GetPolicySelectorsParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetPolicySelectorsParamsWithTimeout creates a new GetPolicySelectorsParams object -// with the ability to set a timeout on a request. -func NewGetPolicySelectorsParamsWithTimeout(timeout time.Duration) *GetPolicySelectorsParams { - return &GetPolicySelectorsParams{ - timeout: timeout, - } -} - -// NewGetPolicySelectorsParamsWithContext creates a new GetPolicySelectorsParams object -// with the ability to set a context for a request. -func NewGetPolicySelectorsParamsWithContext(ctx context.Context) *GetPolicySelectorsParams { - return &GetPolicySelectorsParams{ - Context: ctx, - } -} - -// NewGetPolicySelectorsParamsWithHTTPClient creates a new GetPolicySelectorsParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetPolicySelectorsParamsWithHTTPClient(client *http.Client) *GetPolicySelectorsParams { - return &GetPolicySelectorsParams{ - HTTPClient: client, - } -} - -/* -GetPolicySelectorsParams contains all the parameters to send to the API endpoint - - for the get policy selectors operation. - - Typically these are written to a http.Request. -*/ -type GetPolicySelectorsParams struct { - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get policy selectors params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetPolicySelectorsParams) WithDefaults() *GetPolicySelectorsParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get policy selectors params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetPolicySelectorsParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get policy selectors params -func (o *GetPolicySelectorsParams) WithTimeout(timeout time.Duration) *GetPolicySelectorsParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get policy selectors params -func (o *GetPolicySelectorsParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get policy selectors params -func (o *GetPolicySelectorsParams) WithContext(ctx context.Context) *GetPolicySelectorsParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get policy selectors params -func (o *GetPolicySelectorsParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get policy selectors params -func (o *GetPolicySelectorsParams) WithHTTPClient(client *http.Client) *GetPolicySelectorsParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get policy selectors params -func (o *GetPolicySelectorsParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *GetPolicySelectorsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_policy_selectors_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/get_policy_selectors_responses.go deleted file mode 100644 index 633d4d1e7..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/get_policy_selectors_responses.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetPolicySelectorsReader is a Reader for the GetPolicySelectors structure. -type GetPolicySelectorsReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetPolicySelectorsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetPolicySelectorsOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - return nil, runtime.NewAPIError("[GET /policy/selectors] GetPolicySelectors", response, response.Code()) - } -} - -// NewGetPolicySelectorsOK creates a GetPolicySelectorsOK with default headers values -func NewGetPolicySelectorsOK() *GetPolicySelectorsOK { - return &GetPolicySelectorsOK{} -} - -/* -GetPolicySelectorsOK describes a response with status code 200, with default header values. - -Success -*/ -type GetPolicySelectorsOK struct { - Payload models.SelectorCache -} - -// IsSuccess returns true when this get policy selectors o k response has a 2xx status code -func (o *GetPolicySelectorsOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get policy selectors o k response has a 3xx status code -func (o *GetPolicySelectorsOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get policy selectors o k response has a 4xx status code -func (o *GetPolicySelectorsOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get policy selectors o k response has a 5xx status code -func (o *GetPolicySelectorsOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get policy selectors o k response a status code equal to that given -func (o *GetPolicySelectorsOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get policy selectors o k response -func (o *GetPolicySelectorsOK) Code() int { - return 200 -} - -func (o *GetPolicySelectorsOK) Error() string { - return fmt.Sprintf("[GET /policy/selectors][%d] getPolicySelectorsOK %+v", 200, o.Payload) -} - -func (o *GetPolicySelectorsOK) String() string { - return fmt.Sprintf("[GET /policy/selectors][%d] getPolicySelectorsOK %+v", 200, o.Payload) -} - -func (o *GetPolicySelectorsOK) GetPayload() models.SelectorCache { - return o.Payload -} - -func (o *GetPolicySelectorsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/policy_client.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/policy_client.go deleted file mode 100644 index c72927034..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/policy_client.go +++ /dev/null @@ -1,548 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// New creates a new policy API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { - return &Client{transport: transport, formats: formats} -} - -/* -Client for policy API -*/ -type Client struct { - transport runtime.ClientTransport - formats strfmt.Registry -} - -// ClientOption is the option for Client methods -type ClientOption func(*runtime.ClientOperation) - -// ClientService is the interface for Client methods -type ClientService interface { - DeleteFqdnCache(params *DeleteFqdnCacheParams, opts ...ClientOption) (*DeleteFqdnCacheOK, error) - - DeletePolicy(params *DeletePolicyParams, opts ...ClientOption) (*DeletePolicyOK, error) - - GetFqdnCache(params *GetFqdnCacheParams, opts ...ClientOption) (*GetFqdnCacheOK, error) - - GetFqdnCacheID(params *GetFqdnCacheIDParams, opts ...ClientOption) (*GetFqdnCacheIDOK, error) - - GetFqdnNames(params *GetFqdnNamesParams, opts ...ClientOption) (*GetFqdnNamesOK, error) - - GetIP(params *GetIPParams, opts ...ClientOption) (*GetIPOK, error) - - GetIdentity(params *GetIdentityParams, opts ...ClientOption) (*GetIdentityOK, error) - - GetIdentityEndpoints(params *GetIdentityEndpointsParams, opts ...ClientOption) (*GetIdentityEndpointsOK, error) - - GetIdentityID(params *GetIdentityIDParams, opts ...ClientOption) (*GetIdentityIDOK, error) - - GetPolicy(params *GetPolicyParams, opts ...ClientOption) (*GetPolicyOK, error) - - GetPolicySelectors(params *GetPolicySelectorsParams, opts ...ClientOption) (*GetPolicySelectorsOK, error) - - PutPolicy(params *PutPolicyParams, opts ...ClientOption) (*PutPolicyOK, error) - - SetTransport(transport runtime.ClientTransport) -} - -/* - DeleteFqdnCache deletes matching DNS lookups from the policy generation cache - - Deletes matching DNS lookups from the cache, optionally restricted by - -DNS name. The removed IP data will no longer be used in generated -policies. -*/ -func (a *Client) DeleteFqdnCache(params *DeleteFqdnCacheParams, opts ...ClientOption) (*DeleteFqdnCacheOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewDeleteFqdnCacheParams() - } - op := &runtime.ClientOperation{ - ID: "DeleteFqdnCache", - Method: "DELETE", - PathPattern: "/fqdn/cache", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &DeleteFqdnCacheReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*DeleteFqdnCacheOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for DeleteFqdnCache: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -DeletePolicy deletes a policy sub tree -*/ -func (a *Client) DeletePolicy(params *DeletePolicyParams, opts ...ClientOption) (*DeletePolicyOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewDeletePolicyParams() - } - op := &runtime.ClientOperation{ - ID: "DeletePolicy", - Method: "DELETE", - PathPattern: "/policy", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &DeletePolicyReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*DeletePolicyOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for DeletePolicy: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* - GetFqdnCache retrieves the list of DNS lookups intercepted from all endpoints - - Retrieves the list of DNS lookups intercepted from endpoints, - -optionally filtered by DNS name, CIDR IP range or source. -*/ -func (a *Client) GetFqdnCache(params *GetFqdnCacheParams, opts ...ClientOption) (*GetFqdnCacheOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetFqdnCacheParams() - } - op := &runtime.ClientOperation{ - ID: "GetFqdnCache", - Method: "GET", - PathPattern: "/fqdn/cache", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetFqdnCacheReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetFqdnCacheOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetFqdnCache: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* - GetFqdnCacheID retrieves the list of DNS lookups intercepted from an endpoint - - Retrieves the list of DNS lookups intercepted from the specific endpoint, - -optionally filtered by endpoint id, DNS name, CIDR IP range or source. -*/ -func (a *Client) GetFqdnCacheID(params *GetFqdnCacheIDParams, opts ...ClientOption) (*GetFqdnCacheIDOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetFqdnCacheIDParams() - } - op := &runtime.ClientOperation{ - ID: "GetFqdnCacheID", - Method: "GET", - PathPattern: "/fqdn/cache/{id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetFqdnCacheIDReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetFqdnCacheIDOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetFqdnCacheID: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* - GetFqdnNames lists internal DNS selector representations - - Retrieves the list of DNS-related fields (names to poll, selectors and - -their corresponding regexes). -*/ -func (a *Client) GetFqdnNames(params *GetFqdnNamesParams, opts ...ClientOption) (*GetFqdnNamesOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetFqdnNamesParams() - } - op := &runtime.ClientOperation{ - ID: "GetFqdnNames", - Method: "GET", - PathPattern: "/fqdn/names", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetFqdnNamesReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetFqdnNamesOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetFqdnNames: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* - GetIP lists information about known IP addresses - - Retrieves a list of IPs with known associated information such as - -their identities, host addresses, Kubernetes pod names, etc. -The list can optionally filtered by a CIDR IP range. -*/ -func (a *Client) GetIP(params *GetIPParams, opts ...ClientOption) (*GetIPOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetIPParams() - } - op := &runtime.ClientOperation{ - ID: "GetIP", - Method: "GET", - PathPattern: "/ip", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetIPReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetIPOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetIP: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetIdentity retrieves a list of identities that have metadata matching the provided parameters - -Retrieves a list of identities that have metadata matching the provided parameters, or all identities if no parameters are provided. -*/ -func (a *Client) GetIdentity(params *GetIdentityParams, opts ...ClientOption) (*GetIdentityOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetIdentityParams() - } - op := &runtime.ClientOperation{ - ID: "GetIdentity", - Method: "GET", - PathPattern: "/identity", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetIdentityReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetIdentityOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetIdentity: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetIdentityEndpoints retrieves identities which are being used by local endpoints -*/ -func (a *Client) GetIdentityEndpoints(params *GetIdentityEndpointsParams, opts ...ClientOption) (*GetIdentityEndpointsOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetIdentityEndpointsParams() - } - op := &runtime.ClientOperation{ - ID: "GetIdentityEndpoints", - Method: "GET", - PathPattern: "/identity/endpoints", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetIdentityEndpointsReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetIdentityEndpointsOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetIdentityEndpoints: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetIdentityID retrieves identity -*/ -func (a *Client) GetIdentityID(params *GetIdentityIDParams, opts ...ClientOption) (*GetIdentityIDOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetIdentityIDParams() - } - op := &runtime.ClientOperation{ - ID: "GetIdentityID", - Method: "GET", - PathPattern: "/identity/{id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetIdentityIDReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetIdentityIDOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetIdentityID: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetPolicy retrieves entire policy tree - -Returns the entire policy tree with all children. -*/ -func (a *Client) GetPolicy(params *GetPolicyParams, opts ...ClientOption) (*GetPolicyOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetPolicyParams() - } - op := &runtime.ClientOperation{ - ID: "GetPolicy", - Method: "GET", - PathPattern: "/policy", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetPolicyReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetPolicyOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetPolicy: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetPolicySelectors sees what selectors match which identities -*/ -func (a *Client) GetPolicySelectors(params *GetPolicySelectorsParams, opts ...ClientOption) (*GetPolicySelectorsOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetPolicySelectorsParams() - } - op := &runtime.ClientOperation{ - ID: "GetPolicySelectors", - Method: "GET", - PathPattern: "/policy/selectors", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetPolicySelectorsReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetPolicySelectorsOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetPolicySelectors: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -PutPolicy creates or update a policy sub tree -*/ -func (a *Client) PutPolicy(params *PutPolicyParams, opts ...ClientOption) (*PutPolicyOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPutPolicyParams() - } - op := &runtime.ClientOperation{ - ID: "PutPolicy", - Method: "PUT", - PathPattern: "/policy", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PutPolicyReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*PutPolicyOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PutPolicy: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -// SetTransport changes the transport on the client -func (a *Client) SetTransport(transport runtime.ClientTransport) { - a.transport = transport -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/put_policy_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/put_policy_parameters.go deleted file mode 100644 index ef09ec796..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/put_policy_parameters.go +++ /dev/null @@ -1,232 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewPutPolicyParams creates a new PutPolicyParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewPutPolicyParams() *PutPolicyParams { - return &PutPolicyParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewPutPolicyParamsWithTimeout creates a new PutPolicyParams object -// with the ability to set a timeout on a request. -func NewPutPolicyParamsWithTimeout(timeout time.Duration) *PutPolicyParams { - return &PutPolicyParams{ - timeout: timeout, - } -} - -// NewPutPolicyParamsWithContext creates a new PutPolicyParams object -// with the ability to set a context for a request. -func NewPutPolicyParamsWithContext(ctx context.Context) *PutPolicyParams { - return &PutPolicyParams{ - Context: ctx, - } -} - -// NewPutPolicyParamsWithHTTPClient creates a new PutPolicyParams object -// with the ability to set a custom HTTPClient for a request. -func NewPutPolicyParamsWithHTTPClient(client *http.Client) *PutPolicyParams { - return &PutPolicyParams{ - HTTPClient: client, - } -} - -/* -PutPolicyParams contains all the parameters to send to the API endpoint - - for the put policy operation. - - Typically these are written to a http.Request. -*/ -type PutPolicyParams struct { - - /* Policy. - - Policy rules - */ - Policy string - - /* Replace. - - If true, indicates that existing rules with identical labels should be replaced. - */ - Replace *bool - - /* ReplaceWithLabels. - - If present, indicates that existing rules with the given labels should be deleted. - */ - ReplaceWithLabels []string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the put policy params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PutPolicyParams) WithDefaults() *PutPolicyParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the put policy params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PutPolicyParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the put policy params -func (o *PutPolicyParams) WithTimeout(timeout time.Duration) *PutPolicyParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the put policy params -func (o *PutPolicyParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the put policy params -func (o *PutPolicyParams) WithContext(ctx context.Context) *PutPolicyParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the put policy params -func (o *PutPolicyParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the put policy params -func (o *PutPolicyParams) WithHTTPClient(client *http.Client) *PutPolicyParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the put policy params -func (o *PutPolicyParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithPolicy adds the policy to the put policy params -func (o *PutPolicyParams) WithPolicy(policy string) *PutPolicyParams { - o.SetPolicy(policy) - return o -} - -// SetPolicy adds the policy to the put policy params -func (o *PutPolicyParams) SetPolicy(policy string) { - o.Policy = policy -} - -// WithReplace adds the replace to the put policy params -func (o *PutPolicyParams) WithReplace(replace *bool) *PutPolicyParams { - o.SetReplace(replace) - return o -} - -// SetReplace adds the replace to the put policy params -func (o *PutPolicyParams) SetReplace(replace *bool) { - o.Replace = replace -} - -// WithReplaceWithLabels adds the replaceWithLabels to the put policy params -func (o *PutPolicyParams) WithReplaceWithLabels(replaceWithLabels []string) *PutPolicyParams { - o.SetReplaceWithLabels(replaceWithLabels) - return o -} - -// SetReplaceWithLabels adds the replaceWithLabels to the put policy params -func (o *PutPolicyParams) SetReplaceWithLabels(replaceWithLabels []string) { - o.ReplaceWithLabels = replaceWithLabels -} - -// WriteToRequest writes these params to a swagger request -func (o *PutPolicyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if err := r.SetBodyParam(o.Policy); err != nil { - return err - } - - if o.Replace != nil { - - // query param replace - var qrReplace bool - - if o.Replace != nil { - qrReplace = *o.Replace - } - qReplace := swag.FormatBool(qrReplace) - if qReplace != "" { - - if err := r.SetQueryParam("replace", qReplace); err != nil { - return err - } - } - } - - if o.ReplaceWithLabels != nil { - - // binding items for replace-with-labels - joinedReplaceWithLabels := o.bindParamReplaceWithLabels(reg) - - // query array param replace-with-labels - if err := r.SetQueryParam("replace-with-labels", joinedReplaceWithLabels...); err != nil { - return err - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParamPutPolicy binds the parameter replace-with-labels -func (o *PutPolicyParams) bindParamReplaceWithLabels(formats strfmt.Registry) []string { - replaceWithLabelsIR := o.ReplaceWithLabels - - var replaceWithLabelsIC []string - for _, replaceWithLabelsIIR := range replaceWithLabelsIR { // explode []string - - replaceWithLabelsIIV := replaceWithLabelsIIR // string as string - replaceWithLabelsIC = append(replaceWithLabelsIC, replaceWithLabelsIIV) - } - - // items.CollectionFormat: "" - replaceWithLabelsIS := swag.JoinByFormat(replaceWithLabelsIC, "") - - return replaceWithLabelsIS -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/policy/put_policy_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/policy/put_policy_responses.go deleted file mode 100644 index 2d3246899..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/policy/put_policy_responses.go +++ /dev/null @@ -1,384 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// PutPolicyReader is a Reader for the PutPolicy structure. -type PutPolicyReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *PutPolicyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewPutPolicyOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 400: - result := NewPutPolicyInvalidPolicy() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 403: - result := NewPutPolicyForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 460: - result := NewPutPolicyInvalidPath() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewPutPolicyFailure() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[PUT /policy] PutPolicy", response, response.Code()) - } -} - -// NewPutPolicyOK creates a PutPolicyOK with default headers values -func NewPutPolicyOK() *PutPolicyOK { - return &PutPolicyOK{} -} - -/* -PutPolicyOK describes a response with status code 200, with default header values. - -Success -*/ -type PutPolicyOK struct { - Payload *models.Policy -} - -// IsSuccess returns true when this put policy o k response has a 2xx status code -func (o *PutPolicyOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this put policy o k response has a 3xx status code -func (o *PutPolicyOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put policy o k response has a 4xx status code -func (o *PutPolicyOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this put policy o k response has a 5xx status code -func (o *PutPolicyOK) IsServerError() bool { - return false -} - -// IsCode returns true when this put policy o k response a status code equal to that given -func (o *PutPolicyOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the put policy o k response -func (o *PutPolicyOK) Code() int { - return 200 -} - -func (o *PutPolicyOK) Error() string { - return fmt.Sprintf("[PUT /policy][%d] putPolicyOK %+v", 200, o.Payload) -} - -func (o *PutPolicyOK) String() string { - return fmt.Sprintf("[PUT /policy][%d] putPolicyOK %+v", 200, o.Payload) -} - -func (o *PutPolicyOK) GetPayload() *models.Policy { - return o.Payload -} - -func (o *PutPolicyOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.Policy) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewPutPolicyInvalidPolicy creates a PutPolicyInvalidPolicy with default headers values -func NewPutPolicyInvalidPolicy() *PutPolicyInvalidPolicy { - return &PutPolicyInvalidPolicy{} -} - -/* -PutPolicyInvalidPolicy describes a response with status code 400, with default header values. - -Invalid policy -*/ -type PutPolicyInvalidPolicy struct { - Payload models.Error -} - -// IsSuccess returns true when this put policy invalid policy response has a 2xx status code -func (o *PutPolicyInvalidPolicy) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put policy invalid policy response has a 3xx status code -func (o *PutPolicyInvalidPolicy) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put policy invalid policy response has a 4xx status code -func (o *PutPolicyInvalidPolicy) IsClientError() bool { - return true -} - -// IsServerError returns true when this put policy invalid policy response has a 5xx status code -func (o *PutPolicyInvalidPolicy) IsServerError() bool { - return false -} - -// IsCode returns true when this put policy invalid policy response a status code equal to that given -func (o *PutPolicyInvalidPolicy) IsCode(code int) bool { - return code == 400 -} - -// Code gets the status code for the put policy invalid policy response -func (o *PutPolicyInvalidPolicy) Code() int { - return 400 -} - -func (o *PutPolicyInvalidPolicy) Error() string { - return fmt.Sprintf("[PUT /policy][%d] putPolicyInvalidPolicy %+v", 400, o.Payload) -} - -func (o *PutPolicyInvalidPolicy) String() string { - return fmt.Sprintf("[PUT /policy][%d] putPolicyInvalidPolicy %+v", 400, o.Payload) -} - -func (o *PutPolicyInvalidPolicy) GetPayload() models.Error { - return o.Payload -} - -func (o *PutPolicyInvalidPolicy) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewPutPolicyForbidden creates a PutPolicyForbidden with default headers values -func NewPutPolicyForbidden() *PutPolicyForbidden { - return &PutPolicyForbidden{} -} - -/* -PutPolicyForbidden describes a response with status code 403, with default header values. - -Forbidden -*/ -type PutPolicyForbidden struct { -} - -// IsSuccess returns true when this put policy forbidden response has a 2xx status code -func (o *PutPolicyForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put policy forbidden response has a 3xx status code -func (o *PutPolicyForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put policy forbidden response has a 4xx status code -func (o *PutPolicyForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this put policy forbidden response has a 5xx status code -func (o *PutPolicyForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this put policy forbidden response a status code equal to that given -func (o *PutPolicyForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the put policy forbidden response -func (o *PutPolicyForbidden) Code() int { - return 403 -} - -func (o *PutPolicyForbidden) Error() string { - return fmt.Sprintf("[PUT /policy][%d] putPolicyForbidden ", 403) -} - -func (o *PutPolicyForbidden) String() string { - return fmt.Sprintf("[PUT /policy][%d] putPolicyForbidden ", 403) -} - -func (o *PutPolicyForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPutPolicyInvalidPath creates a PutPolicyInvalidPath with default headers values -func NewPutPolicyInvalidPath() *PutPolicyInvalidPath { - return &PutPolicyInvalidPath{} -} - -/* -PutPolicyInvalidPath describes a response with status code 460, with default header values. - -Invalid path -*/ -type PutPolicyInvalidPath struct { - Payload models.Error -} - -// IsSuccess returns true when this put policy invalid path response has a 2xx status code -func (o *PutPolicyInvalidPath) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put policy invalid path response has a 3xx status code -func (o *PutPolicyInvalidPath) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put policy invalid path response has a 4xx status code -func (o *PutPolicyInvalidPath) IsClientError() bool { - return true -} - -// IsServerError returns true when this put policy invalid path response has a 5xx status code -func (o *PutPolicyInvalidPath) IsServerError() bool { - return false -} - -// IsCode returns true when this put policy invalid path response a status code equal to that given -func (o *PutPolicyInvalidPath) IsCode(code int) bool { - return code == 460 -} - -// Code gets the status code for the put policy invalid path response -func (o *PutPolicyInvalidPath) Code() int { - return 460 -} - -func (o *PutPolicyInvalidPath) Error() string { - return fmt.Sprintf("[PUT /policy][%d] putPolicyInvalidPath %+v", 460, o.Payload) -} - -func (o *PutPolicyInvalidPath) String() string { - return fmt.Sprintf("[PUT /policy][%d] putPolicyInvalidPath %+v", 460, o.Payload) -} - -func (o *PutPolicyInvalidPath) GetPayload() models.Error { - return o.Payload -} - -func (o *PutPolicyInvalidPath) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewPutPolicyFailure creates a PutPolicyFailure with default headers values -func NewPutPolicyFailure() *PutPolicyFailure { - return &PutPolicyFailure{} -} - -/* -PutPolicyFailure describes a response with status code 500, with default header values. - -Policy import failed -*/ -type PutPolicyFailure struct { - Payload models.Error -} - -// IsSuccess returns true when this put policy failure response has a 2xx status code -func (o *PutPolicyFailure) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put policy failure response has a 3xx status code -func (o *PutPolicyFailure) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put policy failure response has a 4xx status code -func (o *PutPolicyFailure) IsClientError() bool { - return false -} - -// IsServerError returns true when this put policy failure response has a 5xx status code -func (o *PutPolicyFailure) IsServerError() bool { - return true -} - -// IsCode returns true when this put policy failure response a status code equal to that given -func (o *PutPolicyFailure) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the put policy failure response -func (o *PutPolicyFailure) Code() int { - return 500 -} - -func (o *PutPolicyFailure) Error() string { - return fmt.Sprintf("[PUT /policy][%d] putPolicyFailure %+v", 500, o.Payload) -} - -func (o *PutPolicyFailure) String() string { - return fmt.Sprintf("[PUT /policy][%d] putPolicyFailure %+v", 500, o.Payload) -} - -func (o *PutPolicyFailure) GetPayload() models.Error { - return o.Payload -} - -func (o *PutPolicyFailure) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/prefilter/delete_prefilter_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/prefilter/delete_prefilter_parameters.go deleted file mode 100644 index 889f2d2e9..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/prefilter/delete_prefilter_parameters.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package prefilter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// NewDeletePrefilterParams creates a new DeletePrefilterParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewDeletePrefilterParams() *DeletePrefilterParams { - return &DeletePrefilterParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewDeletePrefilterParamsWithTimeout creates a new DeletePrefilterParams object -// with the ability to set a timeout on a request. -func NewDeletePrefilterParamsWithTimeout(timeout time.Duration) *DeletePrefilterParams { - return &DeletePrefilterParams{ - timeout: timeout, - } -} - -// NewDeletePrefilterParamsWithContext creates a new DeletePrefilterParams object -// with the ability to set a context for a request. -func NewDeletePrefilterParamsWithContext(ctx context.Context) *DeletePrefilterParams { - return &DeletePrefilterParams{ - Context: ctx, - } -} - -// NewDeletePrefilterParamsWithHTTPClient creates a new DeletePrefilterParams object -// with the ability to set a custom HTTPClient for a request. -func NewDeletePrefilterParamsWithHTTPClient(client *http.Client) *DeletePrefilterParams { - return &DeletePrefilterParams{ - HTTPClient: client, - } -} - -/* -DeletePrefilterParams contains all the parameters to send to the API endpoint - - for the delete prefilter operation. - - Typically these are written to a http.Request. -*/ -type DeletePrefilterParams struct { - - /* PrefilterSpec. - - List of CIDR ranges for filter table - */ - PrefilterSpec *models.PrefilterSpec - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the delete prefilter params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeletePrefilterParams) WithDefaults() *DeletePrefilterParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the delete prefilter params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeletePrefilterParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the delete prefilter params -func (o *DeletePrefilterParams) WithTimeout(timeout time.Duration) *DeletePrefilterParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the delete prefilter params -func (o *DeletePrefilterParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the delete prefilter params -func (o *DeletePrefilterParams) WithContext(ctx context.Context) *DeletePrefilterParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the delete prefilter params -func (o *DeletePrefilterParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the delete prefilter params -func (o *DeletePrefilterParams) WithHTTPClient(client *http.Client) *DeletePrefilterParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the delete prefilter params -func (o *DeletePrefilterParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithPrefilterSpec adds the prefilterSpec to the delete prefilter params -func (o *DeletePrefilterParams) WithPrefilterSpec(prefilterSpec *models.PrefilterSpec) *DeletePrefilterParams { - o.SetPrefilterSpec(prefilterSpec) - return o -} - -// SetPrefilterSpec adds the prefilterSpec to the delete prefilter params -func (o *DeletePrefilterParams) SetPrefilterSpec(prefilterSpec *models.PrefilterSpec) { - o.PrefilterSpec = prefilterSpec -} - -// WriteToRequest writes these params to a swagger request -func (o *DeletePrefilterParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if o.PrefilterSpec != nil { - if err := r.SetBodyParam(o.PrefilterSpec); err != nil { - return err - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/prefilter/delete_prefilter_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/prefilter/delete_prefilter_responses.go deleted file mode 100644 index 9a7b228f6..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/prefilter/delete_prefilter_responses.go +++ /dev/null @@ -1,312 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package prefilter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// DeletePrefilterReader is a Reader for the DeletePrefilter structure. -type DeletePrefilterReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *DeletePrefilterReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewDeletePrefilterOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 403: - result := NewDeletePrefilterForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 461: - result := NewDeletePrefilterInvalidCIDR() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewDeletePrefilterFailure() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[DELETE /prefilter] DeletePrefilter", response, response.Code()) - } -} - -// NewDeletePrefilterOK creates a DeletePrefilterOK with default headers values -func NewDeletePrefilterOK() *DeletePrefilterOK { - return &DeletePrefilterOK{} -} - -/* -DeletePrefilterOK describes a response with status code 200, with default header values. - -Deleted -*/ -type DeletePrefilterOK struct { - Payload *models.Prefilter -} - -// IsSuccess returns true when this delete prefilter o k response has a 2xx status code -func (o *DeletePrefilterOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this delete prefilter o k response has a 3xx status code -func (o *DeletePrefilterOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete prefilter o k response has a 4xx status code -func (o *DeletePrefilterOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this delete prefilter o k response has a 5xx status code -func (o *DeletePrefilterOK) IsServerError() bool { - return false -} - -// IsCode returns true when this delete prefilter o k response a status code equal to that given -func (o *DeletePrefilterOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the delete prefilter o k response -func (o *DeletePrefilterOK) Code() int { - return 200 -} - -func (o *DeletePrefilterOK) Error() string { - return fmt.Sprintf("[DELETE /prefilter][%d] deletePrefilterOK %+v", 200, o.Payload) -} - -func (o *DeletePrefilterOK) String() string { - return fmt.Sprintf("[DELETE /prefilter][%d] deletePrefilterOK %+v", 200, o.Payload) -} - -func (o *DeletePrefilterOK) GetPayload() *models.Prefilter { - return o.Payload -} - -func (o *DeletePrefilterOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.Prefilter) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewDeletePrefilterForbidden creates a DeletePrefilterForbidden with default headers values -func NewDeletePrefilterForbidden() *DeletePrefilterForbidden { - return &DeletePrefilterForbidden{} -} - -/* -DeletePrefilterForbidden describes a response with status code 403, with default header values. - -Forbidden -*/ -type DeletePrefilterForbidden struct { -} - -// IsSuccess returns true when this delete prefilter forbidden response has a 2xx status code -func (o *DeletePrefilterForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete prefilter forbidden response has a 3xx status code -func (o *DeletePrefilterForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete prefilter forbidden response has a 4xx status code -func (o *DeletePrefilterForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete prefilter forbidden response has a 5xx status code -func (o *DeletePrefilterForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this delete prefilter forbidden response a status code equal to that given -func (o *DeletePrefilterForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the delete prefilter forbidden response -func (o *DeletePrefilterForbidden) Code() int { - return 403 -} - -func (o *DeletePrefilterForbidden) Error() string { - return fmt.Sprintf("[DELETE /prefilter][%d] deletePrefilterForbidden ", 403) -} - -func (o *DeletePrefilterForbidden) String() string { - return fmt.Sprintf("[DELETE /prefilter][%d] deletePrefilterForbidden ", 403) -} - -func (o *DeletePrefilterForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewDeletePrefilterInvalidCIDR creates a DeletePrefilterInvalidCIDR with default headers values -func NewDeletePrefilterInvalidCIDR() *DeletePrefilterInvalidCIDR { - return &DeletePrefilterInvalidCIDR{} -} - -/* -DeletePrefilterInvalidCIDR describes a response with status code 461, with default header values. - -Invalid CIDR prefix -*/ -type DeletePrefilterInvalidCIDR struct { - Payload models.Error -} - -// IsSuccess returns true when this delete prefilter invalid c Id r response has a 2xx status code -func (o *DeletePrefilterInvalidCIDR) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete prefilter invalid c Id r response has a 3xx status code -func (o *DeletePrefilterInvalidCIDR) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete prefilter invalid c Id r response has a 4xx status code -func (o *DeletePrefilterInvalidCIDR) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete prefilter invalid c Id r response has a 5xx status code -func (o *DeletePrefilterInvalidCIDR) IsServerError() bool { - return false -} - -// IsCode returns true when this delete prefilter invalid c Id r response a status code equal to that given -func (o *DeletePrefilterInvalidCIDR) IsCode(code int) bool { - return code == 461 -} - -// Code gets the status code for the delete prefilter invalid c Id r response -func (o *DeletePrefilterInvalidCIDR) Code() int { - return 461 -} - -func (o *DeletePrefilterInvalidCIDR) Error() string { - return fmt.Sprintf("[DELETE /prefilter][%d] deletePrefilterInvalidCIdR %+v", 461, o.Payload) -} - -func (o *DeletePrefilterInvalidCIDR) String() string { - return fmt.Sprintf("[DELETE /prefilter][%d] deletePrefilterInvalidCIdR %+v", 461, o.Payload) -} - -func (o *DeletePrefilterInvalidCIDR) GetPayload() models.Error { - return o.Payload -} - -func (o *DeletePrefilterInvalidCIDR) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewDeletePrefilterFailure creates a DeletePrefilterFailure with default headers values -func NewDeletePrefilterFailure() *DeletePrefilterFailure { - return &DeletePrefilterFailure{} -} - -/* -DeletePrefilterFailure describes a response with status code 500, with default header values. - -Prefilter delete failed -*/ -type DeletePrefilterFailure struct { - Payload models.Error -} - -// IsSuccess returns true when this delete prefilter failure response has a 2xx status code -func (o *DeletePrefilterFailure) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete prefilter failure response has a 3xx status code -func (o *DeletePrefilterFailure) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete prefilter failure response has a 4xx status code -func (o *DeletePrefilterFailure) IsClientError() bool { - return false -} - -// IsServerError returns true when this delete prefilter failure response has a 5xx status code -func (o *DeletePrefilterFailure) IsServerError() bool { - return true -} - -// IsCode returns true when this delete prefilter failure response a status code equal to that given -func (o *DeletePrefilterFailure) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the delete prefilter failure response -func (o *DeletePrefilterFailure) Code() int { - return 500 -} - -func (o *DeletePrefilterFailure) Error() string { - return fmt.Sprintf("[DELETE /prefilter][%d] deletePrefilterFailure %+v", 500, o.Payload) -} - -func (o *DeletePrefilterFailure) String() string { - return fmt.Sprintf("[DELETE /prefilter][%d] deletePrefilterFailure %+v", 500, o.Payload) -} - -func (o *DeletePrefilterFailure) GetPayload() models.Error { - return o.Payload -} - -func (o *DeletePrefilterFailure) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/prefilter/get_prefilter_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/prefilter/get_prefilter_parameters.go deleted file mode 100644 index 40c5e7bfa..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/prefilter/get_prefilter_parameters.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package prefilter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetPrefilterParams creates a new GetPrefilterParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetPrefilterParams() *GetPrefilterParams { - return &GetPrefilterParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetPrefilterParamsWithTimeout creates a new GetPrefilterParams object -// with the ability to set a timeout on a request. -func NewGetPrefilterParamsWithTimeout(timeout time.Duration) *GetPrefilterParams { - return &GetPrefilterParams{ - timeout: timeout, - } -} - -// NewGetPrefilterParamsWithContext creates a new GetPrefilterParams object -// with the ability to set a context for a request. -func NewGetPrefilterParamsWithContext(ctx context.Context) *GetPrefilterParams { - return &GetPrefilterParams{ - Context: ctx, - } -} - -// NewGetPrefilterParamsWithHTTPClient creates a new GetPrefilterParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetPrefilterParamsWithHTTPClient(client *http.Client) *GetPrefilterParams { - return &GetPrefilterParams{ - HTTPClient: client, - } -} - -/* -GetPrefilterParams contains all the parameters to send to the API endpoint - - for the get prefilter operation. - - Typically these are written to a http.Request. -*/ -type GetPrefilterParams struct { - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get prefilter params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetPrefilterParams) WithDefaults() *GetPrefilterParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get prefilter params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetPrefilterParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get prefilter params -func (o *GetPrefilterParams) WithTimeout(timeout time.Duration) *GetPrefilterParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get prefilter params -func (o *GetPrefilterParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get prefilter params -func (o *GetPrefilterParams) WithContext(ctx context.Context) *GetPrefilterParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get prefilter params -func (o *GetPrefilterParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get prefilter params -func (o *GetPrefilterParams) WithHTTPClient(client *http.Client) *GetPrefilterParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get prefilter params -func (o *GetPrefilterParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *GetPrefilterParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/prefilter/get_prefilter_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/prefilter/get_prefilter_responses.go deleted file mode 100644 index a9cbacb7c..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/prefilter/get_prefilter_responses.go +++ /dev/null @@ -1,178 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package prefilter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetPrefilterReader is a Reader for the GetPrefilter structure. -type GetPrefilterReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetPrefilterReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetPrefilterOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 500: - result := NewGetPrefilterFailure() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /prefilter] GetPrefilter", response, response.Code()) - } -} - -// NewGetPrefilterOK creates a GetPrefilterOK with default headers values -func NewGetPrefilterOK() *GetPrefilterOK { - return &GetPrefilterOK{} -} - -/* -GetPrefilterOK describes a response with status code 200, with default header values. - -Success -*/ -type GetPrefilterOK struct { - Payload *models.Prefilter -} - -// IsSuccess returns true when this get prefilter o k response has a 2xx status code -func (o *GetPrefilterOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get prefilter o k response has a 3xx status code -func (o *GetPrefilterOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get prefilter o k response has a 4xx status code -func (o *GetPrefilterOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get prefilter o k response has a 5xx status code -func (o *GetPrefilterOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get prefilter o k response a status code equal to that given -func (o *GetPrefilterOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get prefilter o k response -func (o *GetPrefilterOK) Code() int { - return 200 -} - -func (o *GetPrefilterOK) Error() string { - return fmt.Sprintf("[GET /prefilter][%d] getPrefilterOK %+v", 200, o.Payload) -} - -func (o *GetPrefilterOK) String() string { - return fmt.Sprintf("[GET /prefilter][%d] getPrefilterOK %+v", 200, o.Payload) -} - -func (o *GetPrefilterOK) GetPayload() *models.Prefilter { - return o.Payload -} - -func (o *GetPrefilterOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.Prefilter) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetPrefilterFailure creates a GetPrefilterFailure with default headers values -func NewGetPrefilterFailure() *GetPrefilterFailure { - return &GetPrefilterFailure{} -} - -/* -GetPrefilterFailure describes a response with status code 500, with default header values. - -Prefilter get failed -*/ -type GetPrefilterFailure struct { - Payload models.Error -} - -// IsSuccess returns true when this get prefilter failure response has a 2xx status code -func (o *GetPrefilterFailure) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get prefilter failure response has a 3xx status code -func (o *GetPrefilterFailure) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get prefilter failure response has a 4xx status code -func (o *GetPrefilterFailure) IsClientError() bool { - return false -} - -// IsServerError returns true when this get prefilter failure response has a 5xx status code -func (o *GetPrefilterFailure) IsServerError() bool { - return true -} - -// IsCode returns true when this get prefilter failure response a status code equal to that given -func (o *GetPrefilterFailure) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the get prefilter failure response -func (o *GetPrefilterFailure) Code() int { - return 500 -} - -func (o *GetPrefilterFailure) Error() string { - return fmt.Sprintf("[GET /prefilter][%d] getPrefilterFailure %+v", 500, o.Payload) -} - -func (o *GetPrefilterFailure) String() string { - return fmt.Sprintf("[GET /prefilter][%d] getPrefilterFailure %+v", 500, o.Payload) -} - -func (o *GetPrefilterFailure) GetPayload() models.Error { - return o.Payload -} - -func (o *GetPrefilterFailure) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/prefilter/patch_prefilter_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/prefilter/patch_prefilter_parameters.go deleted file mode 100644 index 14e6a56cf..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/prefilter/patch_prefilter_parameters.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package prefilter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// NewPatchPrefilterParams creates a new PatchPrefilterParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewPatchPrefilterParams() *PatchPrefilterParams { - return &PatchPrefilterParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewPatchPrefilterParamsWithTimeout creates a new PatchPrefilterParams object -// with the ability to set a timeout on a request. -func NewPatchPrefilterParamsWithTimeout(timeout time.Duration) *PatchPrefilterParams { - return &PatchPrefilterParams{ - timeout: timeout, - } -} - -// NewPatchPrefilterParamsWithContext creates a new PatchPrefilterParams object -// with the ability to set a context for a request. -func NewPatchPrefilterParamsWithContext(ctx context.Context) *PatchPrefilterParams { - return &PatchPrefilterParams{ - Context: ctx, - } -} - -// NewPatchPrefilterParamsWithHTTPClient creates a new PatchPrefilterParams object -// with the ability to set a custom HTTPClient for a request. -func NewPatchPrefilterParamsWithHTTPClient(client *http.Client) *PatchPrefilterParams { - return &PatchPrefilterParams{ - HTTPClient: client, - } -} - -/* -PatchPrefilterParams contains all the parameters to send to the API endpoint - - for the patch prefilter operation. - - Typically these are written to a http.Request. -*/ -type PatchPrefilterParams struct { - - /* PrefilterSpec. - - List of CIDR ranges for filter table - */ - PrefilterSpec *models.PrefilterSpec - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the patch prefilter params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PatchPrefilterParams) WithDefaults() *PatchPrefilterParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the patch prefilter params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PatchPrefilterParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the patch prefilter params -func (o *PatchPrefilterParams) WithTimeout(timeout time.Duration) *PatchPrefilterParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the patch prefilter params -func (o *PatchPrefilterParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the patch prefilter params -func (o *PatchPrefilterParams) WithContext(ctx context.Context) *PatchPrefilterParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the patch prefilter params -func (o *PatchPrefilterParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the patch prefilter params -func (o *PatchPrefilterParams) WithHTTPClient(client *http.Client) *PatchPrefilterParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the patch prefilter params -func (o *PatchPrefilterParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithPrefilterSpec adds the prefilterSpec to the patch prefilter params -func (o *PatchPrefilterParams) WithPrefilterSpec(prefilterSpec *models.PrefilterSpec) *PatchPrefilterParams { - o.SetPrefilterSpec(prefilterSpec) - return o -} - -// SetPrefilterSpec adds the prefilterSpec to the patch prefilter params -func (o *PatchPrefilterParams) SetPrefilterSpec(prefilterSpec *models.PrefilterSpec) { - o.PrefilterSpec = prefilterSpec -} - -// WriteToRequest writes these params to a swagger request -func (o *PatchPrefilterParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if o.PrefilterSpec != nil { - if err := r.SetBodyParam(o.PrefilterSpec); err != nil { - return err - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/prefilter/patch_prefilter_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/prefilter/patch_prefilter_responses.go deleted file mode 100644 index d275a4c2e..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/prefilter/patch_prefilter_responses.go +++ /dev/null @@ -1,312 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package prefilter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// PatchPrefilterReader is a Reader for the PatchPrefilter structure. -type PatchPrefilterReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *PatchPrefilterReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewPatchPrefilterOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 403: - result := NewPatchPrefilterForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 461: - result := NewPatchPrefilterInvalidCIDR() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewPatchPrefilterFailure() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[PATCH /prefilter] PatchPrefilter", response, response.Code()) - } -} - -// NewPatchPrefilterOK creates a PatchPrefilterOK with default headers values -func NewPatchPrefilterOK() *PatchPrefilterOK { - return &PatchPrefilterOK{} -} - -/* -PatchPrefilterOK describes a response with status code 200, with default header values. - -Updated -*/ -type PatchPrefilterOK struct { - Payload *models.Prefilter -} - -// IsSuccess returns true when this patch prefilter o k response has a 2xx status code -func (o *PatchPrefilterOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this patch prefilter o k response has a 3xx status code -func (o *PatchPrefilterOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch prefilter o k response has a 4xx status code -func (o *PatchPrefilterOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this patch prefilter o k response has a 5xx status code -func (o *PatchPrefilterOK) IsServerError() bool { - return false -} - -// IsCode returns true when this patch prefilter o k response a status code equal to that given -func (o *PatchPrefilterOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the patch prefilter o k response -func (o *PatchPrefilterOK) Code() int { - return 200 -} - -func (o *PatchPrefilterOK) Error() string { - return fmt.Sprintf("[PATCH /prefilter][%d] patchPrefilterOK %+v", 200, o.Payload) -} - -func (o *PatchPrefilterOK) String() string { - return fmt.Sprintf("[PATCH /prefilter][%d] patchPrefilterOK %+v", 200, o.Payload) -} - -func (o *PatchPrefilterOK) GetPayload() *models.Prefilter { - return o.Payload -} - -func (o *PatchPrefilterOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.Prefilter) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewPatchPrefilterForbidden creates a PatchPrefilterForbidden with default headers values -func NewPatchPrefilterForbidden() *PatchPrefilterForbidden { - return &PatchPrefilterForbidden{} -} - -/* -PatchPrefilterForbidden describes a response with status code 403, with default header values. - -Forbidden -*/ -type PatchPrefilterForbidden struct { -} - -// IsSuccess returns true when this patch prefilter forbidden response has a 2xx status code -func (o *PatchPrefilterForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this patch prefilter forbidden response has a 3xx status code -func (o *PatchPrefilterForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch prefilter forbidden response has a 4xx status code -func (o *PatchPrefilterForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this patch prefilter forbidden response has a 5xx status code -func (o *PatchPrefilterForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this patch prefilter forbidden response a status code equal to that given -func (o *PatchPrefilterForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the patch prefilter forbidden response -func (o *PatchPrefilterForbidden) Code() int { - return 403 -} - -func (o *PatchPrefilterForbidden) Error() string { - return fmt.Sprintf("[PATCH /prefilter][%d] patchPrefilterForbidden ", 403) -} - -func (o *PatchPrefilterForbidden) String() string { - return fmt.Sprintf("[PATCH /prefilter][%d] patchPrefilterForbidden ", 403) -} - -func (o *PatchPrefilterForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPatchPrefilterInvalidCIDR creates a PatchPrefilterInvalidCIDR with default headers values -func NewPatchPrefilterInvalidCIDR() *PatchPrefilterInvalidCIDR { - return &PatchPrefilterInvalidCIDR{} -} - -/* -PatchPrefilterInvalidCIDR describes a response with status code 461, with default header values. - -Invalid CIDR prefix -*/ -type PatchPrefilterInvalidCIDR struct { - Payload models.Error -} - -// IsSuccess returns true when this patch prefilter invalid c Id r response has a 2xx status code -func (o *PatchPrefilterInvalidCIDR) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this patch prefilter invalid c Id r response has a 3xx status code -func (o *PatchPrefilterInvalidCIDR) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch prefilter invalid c Id r response has a 4xx status code -func (o *PatchPrefilterInvalidCIDR) IsClientError() bool { - return true -} - -// IsServerError returns true when this patch prefilter invalid c Id r response has a 5xx status code -func (o *PatchPrefilterInvalidCIDR) IsServerError() bool { - return false -} - -// IsCode returns true when this patch prefilter invalid c Id r response a status code equal to that given -func (o *PatchPrefilterInvalidCIDR) IsCode(code int) bool { - return code == 461 -} - -// Code gets the status code for the patch prefilter invalid c Id r response -func (o *PatchPrefilterInvalidCIDR) Code() int { - return 461 -} - -func (o *PatchPrefilterInvalidCIDR) Error() string { - return fmt.Sprintf("[PATCH /prefilter][%d] patchPrefilterInvalidCIdR %+v", 461, o.Payload) -} - -func (o *PatchPrefilterInvalidCIDR) String() string { - return fmt.Sprintf("[PATCH /prefilter][%d] patchPrefilterInvalidCIdR %+v", 461, o.Payload) -} - -func (o *PatchPrefilterInvalidCIDR) GetPayload() models.Error { - return o.Payload -} - -func (o *PatchPrefilterInvalidCIDR) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewPatchPrefilterFailure creates a PatchPrefilterFailure with default headers values -func NewPatchPrefilterFailure() *PatchPrefilterFailure { - return &PatchPrefilterFailure{} -} - -/* -PatchPrefilterFailure describes a response with status code 500, with default header values. - -Prefilter update failed -*/ -type PatchPrefilterFailure struct { - Payload models.Error -} - -// IsSuccess returns true when this patch prefilter failure response has a 2xx status code -func (o *PatchPrefilterFailure) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this patch prefilter failure response has a 3xx status code -func (o *PatchPrefilterFailure) IsRedirect() bool { - return false -} - -// IsClientError returns true when this patch prefilter failure response has a 4xx status code -func (o *PatchPrefilterFailure) IsClientError() bool { - return false -} - -// IsServerError returns true when this patch prefilter failure response has a 5xx status code -func (o *PatchPrefilterFailure) IsServerError() bool { - return true -} - -// IsCode returns true when this patch prefilter failure response a status code equal to that given -func (o *PatchPrefilterFailure) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the patch prefilter failure response -func (o *PatchPrefilterFailure) Code() int { - return 500 -} - -func (o *PatchPrefilterFailure) Error() string { - return fmt.Sprintf("[PATCH /prefilter][%d] patchPrefilterFailure %+v", 500, o.Payload) -} - -func (o *PatchPrefilterFailure) String() string { - return fmt.Sprintf("[PATCH /prefilter][%d] patchPrefilterFailure %+v", 500, o.Payload) -} - -func (o *PatchPrefilterFailure) GetPayload() models.Error { - return o.Payload -} - -func (o *PatchPrefilterFailure) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/prefilter/prefilter_client.go b/vendor/github.com/cilium/cilium/api/v1/client/prefilter/prefilter_client.go deleted file mode 100644 index c577a739a..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/prefilter/prefilter_client.go +++ /dev/null @@ -1,162 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package prefilter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// New creates a new prefilter API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { - return &Client{transport: transport, formats: formats} -} - -/* -Client for prefilter API -*/ -type Client struct { - transport runtime.ClientTransport - formats strfmt.Registry -} - -// ClientOption is the option for Client methods -type ClientOption func(*runtime.ClientOperation) - -// ClientService is the interface for Client methods -type ClientService interface { - DeletePrefilter(params *DeletePrefilterParams, opts ...ClientOption) (*DeletePrefilterOK, error) - - GetPrefilter(params *GetPrefilterParams, opts ...ClientOption) (*GetPrefilterOK, error) - - PatchPrefilter(params *PatchPrefilterParams, opts ...ClientOption) (*PatchPrefilterOK, error) - - SetTransport(transport runtime.ClientTransport) -} - -/* -DeletePrefilter deletes list of c ID rs -*/ -func (a *Client) DeletePrefilter(params *DeletePrefilterParams, opts ...ClientOption) (*DeletePrefilterOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewDeletePrefilterParams() - } - op := &runtime.ClientOperation{ - ID: "DeletePrefilter", - Method: "DELETE", - PathPattern: "/prefilter", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &DeletePrefilterReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*DeletePrefilterOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for DeletePrefilter: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetPrefilter retrieves list of c ID rs -*/ -func (a *Client) GetPrefilter(params *GetPrefilterParams, opts ...ClientOption) (*GetPrefilterOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetPrefilterParams() - } - op := &runtime.ClientOperation{ - ID: "GetPrefilter", - Method: "GET", - PathPattern: "/prefilter", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetPrefilterReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetPrefilterOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetPrefilter: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -PatchPrefilter updates list of c ID rs -*/ -func (a *Client) PatchPrefilter(params *PatchPrefilterParams, opts ...ClientOption) (*PatchPrefilterOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPatchPrefilterParams() - } - op := &runtime.ClientOperation{ - ID: "PatchPrefilter", - Method: "PATCH", - PathPattern: "/prefilter", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PatchPrefilterReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*PatchPrefilterOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PatchPrefilter: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -// SetTransport changes the transport on the client -func (a *Client) SetTransport(transport runtime.ClientTransport) { - a.transport = transport -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/recorder/delete_recorder_id_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/recorder/delete_recorder_id_parameters.go deleted file mode 100644 index 6a9a3f362..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/recorder/delete_recorder_id_parameters.go +++ /dev/null @@ -1,155 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package recorder - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteRecorderIDParams creates a new DeleteRecorderIDParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewDeleteRecorderIDParams() *DeleteRecorderIDParams { - return &DeleteRecorderIDParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewDeleteRecorderIDParamsWithTimeout creates a new DeleteRecorderIDParams object -// with the ability to set a timeout on a request. -func NewDeleteRecorderIDParamsWithTimeout(timeout time.Duration) *DeleteRecorderIDParams { - return &DeleteRecorderIDParams{ - timeout: timeout, - } -} - -// NewDeleteRecorderIDParamsWithContext creates a new DeleteRecorderIDParams object -// with the ability to set a context for a request. -func NewDeleteRecorderIDParamsWithContext(ctx context.Context) *DeleteRecorderIDParams { - return &DeleteRecorderIDParams{ - Context: ctx, - } -} - -// NewDeleteRecorderIDParamsWithHTTPClient creates a new DeleteRecorderIDParams object -// with the ability to set a custom HTTPClient for a request. -func NewDeleteRecorderIDParamsWithHTTPClient(client *http.Client) *DeleteRecorderIDParams { - return &DeleteRecorderIDParams{ - HTTPClient: client, - } -} - -/* -DeleteRecorderIDParams contains all the parameters to send to the API endpoint - - for the delete recorder ID operation. - - Typically these are written to a http.Request. -*/ -type DeleteRecorderIDParams struct { - - /* ID. - - ID of recorder - */ - ID int64 - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the delete recorder ID params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeleteRecorderIDParams) WithDefaults() *DeleteRecorderIDParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the delete recorder ID params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeleteRecorderIDParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the delete recorder ID params -func (o *DeleteRecorderIDParams) WithTimeout(timeout time.Duration) *DeleteRecorderIDParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the delete recorder ID params -func (o *DeleteRecorderIDParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the delete recorder ID params -func (o *DeleteRecorderIDParams) WithContext(ctx context.Context) *DeleteRecorderIDParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the delete recorder ID params -func (o *DeleteRecorderIDParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the delete recorder ID params -func (o *DeleteRecorderIDParams) WithHTTPClient(client *http.Client) *DeleteRecorderIDParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the delete recorder ID params -func (o *DeleteRecorderIDParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithID adds the id to the delete recorder ID params -func (o *DeleteRecorderIDParams) WithID(id int64) *DeleteRecorderIDParams { - o.SetID(id) - return o -} - -// SetID adds the id to the delete recorder ID params -func (o *DeleteRecorderIDParams) SetID(id int64) { - o.ID = id -} - -// WriteToRequest writes these params to a swagger request -func (o *DeleteRecorderIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - // path param id - if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/recorder/delete_recorder_id_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/recorder/delete_recorder_id_responses.go deleted file mode 100644 index d4b7773ce..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/recorder/delete_recorder_id_responses.go +++ /dev/null @@ -1,290 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package recorder - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// DeleteRecorderIDReader is a Reader for the DeleteRecorderID structure. -type DeleteRecorderIDReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *DeleteRecorderIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewDeleteRecorderIDOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 403: - result := NewDeleteRecorderIDForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewDeleteRecorderIDNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewDeleteRecorderIDFailure() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[DELETE /recorder/{id}] DeleteRecorderID", response, response.Code()) - } -} - -// NewDeleteRecorderIDOK creates a DeleteRecorderIDOK with default headers values -func NewDeleteRecorderIDOK() *DeleteRecorderIDOK { - return &DeleteRecorderIDOK{} -} - -/* -DeleteRecorderIDOK describes a response with status code 200, with default header values. - -Success -*/ -type DeleteRecorderIDOK struct { -} - -// IsSuccess returns true when this delete recorder Id o k response has a 2xx status code -func (o *DeleteRecorderIDOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this delete recorder Id o k response has a 3xx status code -func (o *DeleteRecorderIDOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete recorder Id o k response has a 4xx status code -func (o *DeleteRecorderIDOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this delete recorder Id o k response has a 5xx status code -func (o *DeleteRecorderIDOK) IsServerError() bool { - return false -} - -// IsCode returns true when this delete recorder Id o k response a status code equal to that given -func (o *DeleteRecorderIDOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the delete recorder Id o k response -func (o *DeleteRecorderIDOK) Code() int { - return 200 -} - -func (o *DeleteRecorderIDOK) Error() string { - return fmt.Sprintf("[DELETE /recorder/{id}][%d] deleteRecorderIdOK ", 200) -} - -func (o *DeleteRecorderIDOK) String() string { - return fmt.Sprintf("[DELETE /recorder/{id}][%d] deleteRecorderIdOK ", 200) -} - -func (o *DeleteRecorderIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewDeleteRecorderIDForbidden creates a DeleteRecorderIDForbidden with default headers values -func NewDeleteRecorderIDForbidden() *DeleteRecorderIDForbidden { - return &DeleteRecorderIDForbidden{} -} - -/* -DeleteRecorderIDForbidden describes a response with status code 403, with default header values. - -Forbidden -*/ -type DeleteRecorderIDForbidden struct { -} - -// IsSuccess returns true when this delete recorder Id forbidden response has a 2xx status code -func (o *DeleteRecorderIDForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete recorder Id forbidden response has a 3xx status code -func (o *DeleteRecorderIDForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete recorder Id forbidden response has a 4xx status code -func (o *DeleteRecorderIDForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete recorder Id forbidden response has a 5xx status code -func (o *DeleteRecorderIDForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this delete recorder Id forbidden response a status code equal to that given -func (o *DeleteRecorderIDForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the delete recorder Id forbidden response -func (o *DeleteRecorderIDForbidden) Code() int { - return 403 -} - -func (o *DeleteRecorderIDForbidden) Error() string { - return fmt.Sprintf("[DELETE /recorder/{id}][%d] deleteRecorderIdForbidden ", 403) -} - -func (o *DeleteRecorderIDForbidden) String() string { - return fmt.Sprintf("[DELETE /recorder/{id}][%d] deleteRecorderIdForbidden ", 403) -} - -func (o *DeleteRecorderIDForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewDeleteRecorderIDNotFound creates a DeleteRecorderIDNotFound with default headers values -func NewDeleteRecorderIDNotFound() *DeleteRecorderIDNotFound { - return &DeleteRecorderIDNotFound{} -} - -/* -DeleteRecorderIDNotFound describes a response with status code 404, with default header values. - -Recorder not found -*/ -type DeleteRecorderIDNotFound struct { -} - -// IsSuccess returns true when this delete recorder Id not found response has a 2xx status code -func (o *DeleteRecorderIDNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete recorder Id not found response has a 3xx status code -func (o *DeleteRecorderIDNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete recorder Id not found response has a 4xx status code -func (o *DeleteRecorderIDNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete recorder Id not found response has a 5xx status code -func (o *DeleteRecorderIDNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this delete recorder Id not found response a status code equal to that given -func (o *DeleteRecorderIDNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the delete recorder Id not found response -func (o *DeleteRecorderIDNotFound) Code() int { - return 404 -} - -func (o *DeleteRecorderIDNotFound) Error() string { - return fmt.Sprintf("[DELETE /recorder/{id}][%d] deleteRecorderIdNotFound ", 404) -} - -func (o *DeleteRecorderIDNotFound) String() string { - return fmt.Sprintf("[DELETE /recorder/{id}][%d] deleteRecorderIdNotFound ", 404) -} - -func (o *DeleteRecorderIDNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewDeleteRecorderIDFailure creates a DeleteRecorderIDFailure with default headers values -func NewDeleteRecorderIDFailure() *DeleteRecorderIDFailure { - return &DeleteRecorderIDFailure{} -} - -/* -DeleteRecorderIDFailure describes a response with status code 500, with default header values. - -Recorder deletion failed -*/ -type DeleteRecorderIDFailure struct { - Payload models.Error -} - -// IsSuccess returns true when this delete recorder Id failure response has a 2xx status code -func (o *DeleteRecorderIDFailure) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete recorder Id failure response has a 3xx status code -func (o *DeleteRecorderIDFailure) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete recorder Id failure response has a 4xx status code -func (o *DeleteRecorderIDFailure) IsClientError() bool { - return false -} - -// IsServerError returns true when this delete recorder Id failure response has a 5xx status code -func (o *DeleteRecorderIDFailure) IsServerError() bool { - return true -} - -// IsCode returns true when this delete recorder Id failure response a status code equal to that given -func (o *DeleteRecorderIDFailure) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the delete recorder Id failure response -func (o *DeleteRecorderIDFailure) Code() int { - return 500 -} - -func (o *DeleteRecorderIDFailure) Error() string { - return fmt.Sprintf("[DELETE /recorder/{id}][%d] deleteRecorderIdFailure %+v", 500, o.Payload) -} - -func (o *DeleteRecorderIDFailure) String() string { - return fmt.Sprintf("[DELETE /recorder/{id}][%d] deleteRecorderIdFailure %+v", 500, o.Payload) -} - -func (o *DeleteRecorderIDFailure) GetPayload() models.Error { - return o.Payload -} - -func (o *DeleteRecorderIDFailure) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/recorder/get_recorder_id_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/recorder/get_recorder_id_parameters.go deleted file mode 100644 index 4aae52c7d..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/recorder/get_recorder_id_parameters.go +++ /dev/null @@ -1,155 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package recorder - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetRecorderIDParams creates a new GetRecorderIDParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetRecorderIDParams() *GetRecorderIDParams { - return &GetRecorderIDParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetRecorderIDParamsWithTimeout creates a new GetRecorderIDParams object -// with the ability to set a timeout on a request. -func NewGetRecorderIDParamsWithTimeout(timeout time.Duration) *GetRecorderIDParams { - return &GetRecorderIDParams{ - timeout: timeout, - } -} - -// NewGetRecorderIDParamsWithContext creates a new GetRecorderIDParams object -// with the ability to set a context for a request. -func NewGetRecorderIDParamsWithContext(ctx context.Context) *GetRecorderIDParams { - return &GetRecorderIDParams{ - Context: ctx, - } -} - -// NewGetRecorderIDParamsWithHTTPClient creates a new GetRecorderIDParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetRecorderIDParamsWithHTTPClient(client *http.Client) *GetRecorderIDParams { - return &GetRecorderIDParams{ - HTTPClient: client, - } -} - -/* -GetRecorderIDParams contains all the parameters to send to the API endpoint - - for the get recorder ID operation. - - Typically these are written to a http.Request. -*/ -type GetRecorderIDParams struct { - - /* ID. - - ID of recorder - */ - ID int64 - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get recorder ID params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetRecorderIDParams) WithDefaults() *GetRecorderIDParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get recorder ID params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetRecorderIDParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get recorder ID params -func (o *GetRecorderIDParams) WithTimeout(timeout time.Duration) *GetRecorderIDParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get recorder ID params -func (o *GetRecorderIDParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get recorder ID params -func (o *GetRecorderIDParams) WithContext(ctx context.Context) *GetRecorderIDParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get recorder ID params -func (o *GetRecorderIDParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get recorder ID params -func (o *GetRecorderIDParams) WithHTTPClient(client *http.Client) *GetRecorderIDParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get recorder ID params -func (o *GetRecorderIDParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithID adds the id to the get recorder ID params -func (o *GetRecorderIDParams) WithID(id int64) *GetRecorderIDParams { - o.SetID(id) - return o -} - -// SetID adds the id to the get recorder ID params -func (o *GetRecorderIDParams) SetID(id int64) { - o.ID = id -} - -// WriteToRequest writes these params to a swagger request -func (o *GetRecorderIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - // path param id - if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/recorder/get_recorder_id_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/recorder/get_recorder_id_responses.go deleted file mode 100644 index f688a9099..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/recorder/get_recorder_id_responses.go +++ /dev/null @@ -1,168 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package recorder - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetRecorderIDReader is a Reader for the GetRecorderID structure. -type GetRecorderIDReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetRecorderIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetRecorderIDOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 404: - result := NewGetRecorderIDNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /recorder/{id}] GetRecorderID", response, response.Code()) - } -} - -// NewGetRecorderIDOK creates a GetRecorderIDOK with default headers values -func NewGetRecorderIDOK() *GetRecorderIDOK { - return &GetRecorderIDOK{} -} - -/* -GetRecorderIDOK describes a response with status code 200, with default header values. - -Success -*/ -type GetRecorderIDOK struct { - Payload *models.Recorder -} - -// IsSuccess returns true when this get recorder Id o k response has a 2xx status code -func (o *GetRecorderIDOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get recorder Id o k response has a 3xx status code -func (o *GetRecorderIDOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get recorder Id o k response has a 4xx status code -func (o *GetRecorderIDOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get recorder Id o k response has a 5xx status code -func (o *GetRecorderIDOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get recorder Id o k response a status code equal to that given -func (o *GetRecorderIDOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get recorder Id o k response -func (o *GetRecorderIDOK) Code() int { - return 200 -} - -func (o *GetRecorderIDOK) Error() string { - return fmt.Sprintf("[GET /recorder/{id}][%d] getRecorderIdOK %+v", 200, o.Payload) -} - -func (o *GetRecorderIDOK) String() string { - return fmt.Sprintf("[GET /recorder/{id}][%d] getRecorderIdOK %+v", 200, o.Payload) -} - -func (o *GetRecorderIDOK) GetPayload() *models.Recorder { - return o.Payload -} - -func (o *GetRecorderIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.Recorder) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetRecorderIDNotFound creates a GetRecorderIDNotFound with default headers values -func NewGetRecorderIDNotFound() *GetRecorderIDNotFound { - return &GetRecorderIDNotFound{} -} - -/* -GetRecorderIDNotFound describes a response with status code 404, with default header values. - -Recorder not found -*/ -type GetRecorderIDNotFound struct { -} - -// IsSuccess returns true when this get recorder Id not found response has a 2xx status code -func (o *GetRecorderIDNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get recorder Id not found response has a 3xx status code -func (o *GetRecorderIDNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get recorder Id not found response has a 4xx status code -func (o *GetRecorderIDNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this get recorder Id not found response has a 5xx status code -func (o *GetRecorderIDNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this get recorder Id not found response a status code equal to that given -func (o *GetRecorderIDNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the get recorder Id not found response -func (o *GetRecorderIDNotFound) Code() int { - return 404 -} - -func (o *GetRecorderIDNotFound) Error() string { - return fmt.Sprintf("[GET /recorder/{id}][%d] getRecorderIdNotFound ", 404) -} - -func (o *GetRecorderIDNotFound) String() string { - return fmt.Sprintf("[GET /recorder/{id}][%d] getRecorderIdNotFound ", 404) -} - -func (o *GetRecorderIDNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/recorder/get_recorder_masks_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/recorder/get_recorder_masks_parameters.go deleted file mode 100644 index 4dd487344..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/recorder/get_recorder_masks_parameters.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package recorder - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetRecorderMasksParams creates a new GetRecorderMasksParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetRecorderMasksParams() *GetRecorderMasksParams { - return &GetRecorderMasksParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetRecorderMasksParamsWithTimeout creates a new GetRecorderMasksParams object -// with the ability to set a timeout on a request. -func NewGetRecorderMasksParamsWithTimeout(timeout time.Duration) *GetRecorderMasksParams { - return &GetRecorderMasksParams{ - timeout: timeout, - } -} - -// NewGetRecorderMasksParamsWithContext creates a new GetRecorderMasksParams object -// with the ability to set a context for a request. -func NewGetRecorderMasksParamsWithContext(ctx context.Context) *GetRecorderMasksParams { - return &GetRecorderMasksParams{ - Context: ctx, - } -} - -// NewGetRecorderMasksParamsWithHTTPClient creates a new GetRecorderMasksParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetRecorderMasksParamsWithHTTPClient(client *http.Client) *GetRecorderMasksParams { - return &GetRecorderMasksParams{ - HTTPClient: client, - } -} - -/* -GetRecorderMasksParams contains all the parameters to send to the API endpoint - - for the get recorder masks operation. - - Typically these are written to a http.Request. -*/ -type GetRecorderMasksParams struct { - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get recorder masks params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetRecorderMasksParams) WithDefaults() *GetRecorderMasksParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get recorder masks params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetRecorderMasksParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get recorder masks params -func (o *GetRecorderMasksParams) WithTimeout(timeout time.Duration) *GetRecorderMasksParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get recorder masks params -func (o *GetRecorderMasksParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get recorder masks params -func (o *GetRecorderMasksParams) WithContext(ctx context.Context) *GetRecorderMasksParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get recorder masks params -func (o *GetRecorderMasksParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get recorder masks params -func (o *GetRecorderMasksParams) WithHTTPClient(client *http.Client) *GetRecorderMasksParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get recorder masks params -func (o *GetRecorderMasksParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *GetRecorderMasksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/recorder/get_recorder_masks_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/recorder/get_recorder_masks_responses.go deleted file mode 100644 index bfcc29a64..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/recorder/get_recorder_masks_responses.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package recorder - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetRecorderMasksReader is a Reader for the GetRecorderMasks structure. -type GetRecorderMasksReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetRecorderMasksReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetRecorderMasksOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - return nil, runtime.NewAPIError("[GET /recorder/masks] GetRecorderMasks", response, response.Code()) - } -} - -// NewGetRecorderMasksOK creates a GetRecorderMasksOK with default headers values -func NewGetRecorderMasksOK() *GetRecorderMasksOK { - return &GetRecorderMasksOK{} -} - -/* -GetRecorderMasksOK describes a response with status code 200, with default header values. - -Success -*/ -type GetRecorderMasksOK struct { - Payload []*models.RecorderMask -} - -// IsSuccess returns true when this get recorder masks o k response has a 2xx status code -func (o *GetRecorderMasksOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get recorder masks o k response has a 3xx status code -func (o *GetRecorderMasksOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get recorder masks o k response has a 4xx status code -func (o *GetRecorderMasksOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get recorder masks o k response has a 5xx status code -func (o *GetRecorderMasksOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get recorder masks o k response a status code equal to that given -func (o *GetRecorderMasksOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get recorder masks o k response -func (o *GetRecorderMasksOK) Code() int { - return 200 -} - -func (o *GetRecorderMasksOK) Error() string { - return fmt.Sprintf("[GET /recorder/masks][%d] getRecorderMasksOK %+v", 200, o.Payload) -} - -func (o *GetRecorderMasksOK) String() string { - return fmt.Sprintf("[GET /recorder/masks][%d] getRecorderMasksOK %+v", 200, o.Payload) -} - -func (o *GetRecorderMasksOK) GetPayload() []*models.RecorderMask { - return o.Payload -} - -func (o *GetRecorderMasksOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/recorder/get_recorder_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/recorder/get_recorder_parameters.go deleted file mode 100644 index d7ff113b2..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/recorder/get_recorder_parameters.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package recorder - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetRecorderParams creates a new GetRecorderParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetRecorderParams() *GetRecorderParams { - return &GetRecorderParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetRecorderParamsWithTimeout creates a new GetRecorderParams object -// with the ability to set a timeout on a request. -func NewGetRecorderParamsWithTimeout(timeout time.Duration) *GetRecorderParams { - return &GetRecorderParams{ - timeout: timeout, - } -} - -// NewGetRecorderParamsWithContext creates a new GetRecorderParams object -// with the ability to set a context for a request. -func NewGetRecorderParamsWithContext(ctx context.Context) *GetRecorderParams { - return &GetRecorderParams{ - Context: ctx, - } -} - -// NewGetRecorderParamsWithHTTPClient creates a new GetRecorderParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetRecorderParamsWithHTTPClient(client *http.Client) *GetRecorderParams { - return &GetRecorderParams{ - HTTPClient: client, - } -} - -/* -GetRecorderParams contains all the parameters to send to the API endpoint - - for the get recorder operation. - - Typically these are written to a http.Request. -*/ -type GetRecorderParams struct { - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get recorder params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetRecorderParams) WithDefaults() *GetRecorderParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get recorder params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetRecorderParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get recorder params -func (o *GetRecorderParams) WithTimeout(timeout time.Duration) *GetRecorderParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get recorder params -func (o *GetRecorderParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get recorder params -func (o *GetRecorderParams) WithContext(ctx context.Context) *GetRecorderParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get recorder params -func (o *GetRecorderParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get recorder params -func (o *GetRecorderParams) WithHTTPClient(client *http.Client) *GetRecorderParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get recorder params -func (o *GetRecorderParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *GetRecorderParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/recorder/get_recorder_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/recorder/get_recorder_responses.go deleted file mode 100644 index 0d6492666..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/recorder/get_recorder_responses.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package recorder - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetRecorderReader is a Reader for the GetRecorder structure. -type GetRecorderReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetRecorderReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetRecorderOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - return nil, runtime.NewAPIError("[GET /recorder] GetRecorder", response, response.Code()) - } -} - -// NewGetRecorderOK creates a GetRecorderOK with default headers values -func NewGetRecorderOK() *GetRecorderOK { - return &GetRecorderOK{} -} - -/* -GetRecorderOK describes a response with status code 200, with default header values. - -Success -*/ -type GetRecorderOK struct { - Payload []*models.Recorder -} - -// IsSuccess returns true when this get recorder o k response has a 2xx status code -func (o *GetRecorderOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get recorder o k response has a 3xx status code -func (o *GetRecorderOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get recorder o k response has a 4xx status code -func (o *GetRecorderOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get recorder o k response has a 5xx status code -func (o *GetRecorderOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get recorder o k response a status code equal to that given -func (o *GetRecorderOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get recorder o k response -func (o *GetRecorderOK) Code() int { - return 200 -} - -func (o *GetRecorderOK) Error() string { - return fmt.Sprintf("[GET /recorder][%d] getRecorderOK %+v", 200, o.Payload) -} - -func (o *GetRecorderOK) String() string { - return fmt.Sprintf("[GET /recorder][%d] getRecorderOK %+v", 200, o.Payload) -} - -func (o *GetRecorderOK) GetPayload() []*models.Recorder { - return o.Payload -} - -func (o *GetRecorderOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/recorder/put_recorder_id_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/recorder/put_recorder_id_parameters.go deleted file mode 100644 index 3515d3c76..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/recorder/put_recorder_id_parameters.go +++ /dev/null @@ -1,179 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package recorder - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/cilium/cilium/api/v1/models" -) - -// NewPutRecorderIDParams creates a new PutRecorderIDParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewPutRecorderIDParams() *PutRecorderIDParams { - return &PutRecorderIDParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewPutRecorderIDParamsWithTimeout creates a new PutRecorderIDParams object -// with the ability to set a timeout on a request. -func NewPutRecorderIDParamsWithTimeout(timeout time.Duration) *PutRecorderIDParams { - return &PutRecorderIDParams{ - timeout: timeout, - } -} - -// NewPutRecorderIDParamsWithContext creates a new PutRecorderIDParams object -// with the ability to set a context for a request. -func NewPutRecorderIDParamsWithContext(ctx context.Context) *PutRecorderIDParams { - return &PutRecorderIDParams{ - Context: ctx, - } -} - -// NewPutRecorderIDParamsWithHTTPClient creates a new PutRecorderIDParams object -// with the ability to set a custom HTTPClient for a request. -func NewPutRecorderIDParamsWithHTTPClient(client *http.Client) *PutRecorderIDParams { - return &PutRecorderIDParams{ - HTTPClient: client, - } -} - -/* -PutRecorderIDParams contains all the parameters to send to the API endpoint - - for the put recorder ID operation. - - Typically these are written to a http.Request. -*/ -type PutRecorderIDParams struct { - - /* Config. - - Recorder configuration - */ - Config *models.RecorderSpec - - /* ID. - - ID of recorder - */ - ID int64 - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the put recorder ID params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PutRecorderIDParams) WithDefaults() *PutRecorderIDParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the put recorder ID params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PutRecorderIDParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the put recorder ID params -func (o *PutRecorderIDParams) WithTimeout(timeout time.Duration) *PutRecorderIDParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the put recorder ID params -func (o *PutRecorderIDParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the put recorder ID params -func (o *PutRecorderIDParams) WithContext(ctx context.Context) *PutRecorderIDParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the put recorder ID params -func (o *PutRecorderIDParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the put recorder ID params -func (o *PutRecorderIDParams) WithHTTPClient(client *http.Client) *PutRecorderIDParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the put recorder ID params -func (o *PutRecorderIDParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithConfig adds the config to the put recorder ID params -func (o *PutRecorderIDParams) WithConfig(config *models.RecorderSpec) *PutRecorderIDParams { - o.SetConfig(config) - return o -} - -// SetConfig adds the config to the put recorder ID params -func (o *PutRecorderIDParams) SetConfig(config *models.RecorderSpec) { - o.Config = config -} - -// WithID adds the id to the put recorder ID params -func (o *PutRecorderIDParams) WithID(id int64) *PutRecorderIDParams { - o.SetID(id) - return o -} - -// SetID adds the id to the put recorder ID params -func (o *PutRecorderIDParams) SetID(id int64) { - o.ID = id -} - -// WriteToRequest writes these params to a swagger request -func (o *PutRecorderIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if o.Config != nil { - if err := r.SetBodyParam(o.Config); err != nil { - return err - } - } - - // path param id - if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/recorder/put_recorder_id_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/recorder/put_recorder_id_responses.go deleted file mode 100644 index f3947985a..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/recorder/put_recorder_id_responses.go +++ /dev/null @@ -1,290 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package recorder - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// PutRecorderIDReader is a Reader for the PutRecorderID structure. -type PutRecorderIDReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *PutRecorderIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewPutRecorderIDOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 201: - result := NewPutRecorderIDCreated() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 403: - result := NewPutRecorderIDForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewPutRecorderIDFailure() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[PUT /recorder/{id}] PutRecorderID", response, response.Code()) - } -} - -// NewPutRecorderIDOK creates a PutRecorderIDOK with default headers values -func NewPutRecorderIDOK() *PutRecorderIDOK { - return &PutRecorderIDOK{} -} - -/* -PutRecorderIDOK describes a response with status code 200, with default header values. - -Updated -*/ -type PutRecorderIDOK struct { -} - -// IsSuccess returns true when this put recorder Id o k response has a 2xx status code -func (o *PutRecorderIDOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this put recorder Id o k response has a 3xx status code -func (o *PutRecorderIDOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put recorder Id o k response has a 4xx status code -func (o *PutRecorderIDOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this put recorder Id o k response has a 5xx status code -func (o *PutRecorderIDOK) IsServerError() bool { - return false -} - -// IsCode returns true when this put recorder Id o k response a status code equal to that given -func (o *PutRecorderIDOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the put recorder Id o k response -func (o *PutRecorderIDOK) Code() int { - return 200 -} - -func (o *PutRecorderIDOK) Error() string { - return fmt.Sprintf("[PUT /recorder/{id}][%d] putRecorderIdOK ", 200) -} - -func (o *PutRecorderIDOK) String() string { - return fmt.Sprintf("[PUT /recorder/{id}][%d] putRecorderIdOK ", 200) -} - -func (o *PutRecorderIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPutRecorderIDCreated creates a PutRecorderIDCreated with default headers values -func NewPutRecorderIDCreated() *PutRecorderIDCreated { - return &PutRecorderIDCreated{} -} - -/* -PutRecorderIDCreated describes a response with status code 201, with default header values. - -Created -*/ -type PutRecorderIDCreated struct { -} - -// IsSuccess returns true when this put recorder Id created response has a 2xx status code -func (o *PutRecorderIDCreated) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this put recorder Id created response has a 3xx status code -func (o *PutRecorderIDCreated) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put recorder Id created response has a 4xx status code -func (o *PutRecorderIDCreated) IsClientError() bool { - return false -} - -// IsServerError returns true when this put recorder Id created response has a 5xx status code -func (o *PutRecorderIDCreated) IsServerError() bool { - return false -} - -// IsCode returns true when this put recorder Id created response a status code equal to that given -func (o *PutRecorderIDCreated) IsCode(code int) bool { - return code == 201 -} - -// Code gets the status code for the put recorder Id created response -func (o *PutRecorderIDCreated) Code() int { - return 201 -} - -func (o *PutRecorderIDCreated) Error() string { - return fmt.Sprintf("[PUT /recorder/{id}][%d] putRecorderIdCreated ", 201) -} - -func (o *PutRecorderIDCreated) String() string { - return fmt.Sprintf("[PUT /recorder/{id}][%d] putRecorderIdCreated ", 201) -} - -func (o *PutRecorderIDCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPutRecorderIDForbidden creates a PutRecorderIDForbidden with default headers values -func NewPutRecorderIDForbidden() *PutRecorderIDForbidden { - return &PutRecorderIDForbidden{} -} - -/* -PutRecorderIDForbidden describes a response with status code 403, with default header values. - -Forbidden -*/ -type PutRecorderIDForbidden struct { -} - -// IsSuccess returns true when this put recorder Id forbidden response has a 2xx status code -func (o *PutRecorderIDForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put recorder Id forbidden response has a 3xx status code -func (o *PutRecorderIDForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put recorder Id forbidden response has a 4xx status code -func (o *PutRecorderIDForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this put recorder Id forbidden response has a 5xx status code -func (o *PutRecorderIDForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this put recorder Id forbidden response a status code equal to that given -func (o *PutRecorderIDForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the put recorder Id forbidden response -func (o *PutRecorderIDForbidden) Code() int { - return 403 -} - -func (o *PutRecorderIDForbidden) Error() string { - return fmt.Sprintf("[PUT /recorder/{id}][%d] putRecorderIdForbidden ", 403) -} - -func (o *PutRecorderIDForbidden) String() string { - return fmt.Sprintf("[PUT /recorder/{id}][%d] putRecorderIdForbidden ", 403) -} - -func (o *PutRecorderIDForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPutRecorderIDFailure creates a PutRecorderIDFailure with default headers values -func NewPutRecorderIDFailure() *PutRecorderIDFailure { - return &PutRecorderIDFailure{} -} - -/* -PutRecorderIDFailure describes a response with status code 500, with default header values. - -Error while creating recorder -*/ -type PutRecorderIDFailure struct { - Payload models.Error -} - -// IsSuccess returns true when this put recorder Id failure response has a 2xx status code -func (o *PutRecorderIDFailure) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put recorder Id failure response has a 3xx status code -func (o *PutRecorderIDFailure) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put recorder Id failure response has a 4xx status code -func (o *PutRecorderIDFailure) IsClientError() bool { - return false -} - -// IsServerError returns true when this put recorder Id failure response has a 5xx status code -func (o *PutRecorderIDFailure) IsServerError() bool { - return true -} - -// IsCode returns true when this put recorder Id failure response a status code equal to that given -func (o *PutRecorderIDFailure) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the put recorder Id failure response -func (o *PutRecorderIDFailure) Code() int { - return 500 -} - -func (o *PutRecorderIDFailure) Error() string { - return fmt.Sprintf("[PUT /recorder/{id}][%d] putRecorderIdFailure %+v", 500, o.Payload) -} - -func (o *PutRecorderIDFailure) String() string { - return fmt.Sprintf("[PUT /recorder/{id}][%d] putRecorderIdFailure %+v", 500, o.Payload) -} - -func (o *PutRecorderIDFailure) GetPayload() models.Error { - return o.Payload -} - -func (o *PutRecorderIDFailure) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/recorder/recorder_client.go b/vendor/github.com/cilium/cilium/api/v1/client/recorder/recorder_client.go deleted file mode 100644 index 883e304be..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/recorder/recorder_client.go +++ /dev/null @@ -1,243 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package recorder - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// New creates a new recorder API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { - return &Client{transport: transport, formats: formats} -} - -/* -Client for recorder API -*/ -type Client struct { - transport runtime.ClientTransport - formats strfmt.Registry -} - -// ClientOption is the option for Client methods -type ClientOption func(*runtime.ClientOperation) - -// ClientService is the interface for Client methods -type ClientService interface { - DeleteRecorderID(params *DeleteRecorderIDParams, opts ...ClientOption) (*DeleteRecorderIDOK, error) - - GetRecorder(params *GetRecorderParams, opts ...ClientOption) (*GetRecorderOK, error) - - GetRecorderID(params *GetRecorderIDParams, opts ...ClientOption) (*GetRecorderIDOK, error) - - GetRecorderMasks(params *GetRecorderMasksParams, opts ...ClientOption) (*GetRecorderMasksOK, error) - - PutRecorderID(params *PutRecorderIDParams, opts ...ClientOption) (*PutRecorderIDOK, *PutRecorderIDCreated, error) - - SetTransport(transport runtime.ClientTransport) -} - -/* -DeleteRecorderID deletes a recorder -*/ -func (a *Client) DeleteRecorderID(params *DeleteRecorderIDParams, opts ...ClientOption) (*DeleteRecorderIDOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewDeleteRecorderIDParams() - } - op := &runtime.ClientOperation{ - ID: "DeleteRecorderID", - Method: "DELETE", - PathPattern: "/recorder/{id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &DeleteRecorderIDReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*DeleteRecorderIDOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for DeleteRecorderID: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetRecorder retrieves list of all recorders -*/ -func (a *Client) GetRecorder(params *GetRecorderParams, opts ...ClientOption) (*GetRecorderOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetRecorderParams() - } - op := &runtime.ClientOperation{ - ID: "GetRecorder", - Method: "GET", - PathPattern: "/recorder", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetRecorderReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetRecorderOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetRecorder: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetRecorderID retrieves configuration of a recorder -*/ -func (a *Client) GetRecorderID(params *GetRecorderIDParams, opts ...ClientOption) (*GetRecorderIDOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetRecorderIDParams() - } - op := &runtime.ClientOperation{ - ID: "GetRecorderID", - Method: "GET", - PathPattern: "/recorder/{id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetRecorderIDReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetRecorderIDOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetRecorderID: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetRecorderMasks retrieves list of all recorder masks -*/ -func (a *Client) GetRecorderMasks(params *GetRecorderMasksParams, opts ...ClientOption) (*GetRecorderMasksOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetRecorderMasksParams() - } - op := &runtime.ClientOperation{ - ID: "GetRecorderMasks", - Method: "GET", - PathPattern: "/recorder/masks", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetRecorderMasksReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetRecorderMasksOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetRecorderMasks: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -PutRecorderID creates or update recorder -*/ -func (a *Client) PutRecorderID(params *PutRecorderIDParams, opts ...ClientOption) (*PutRecorderIDOK, *PutRecorderIDCreated, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPutRecorderIDParams() - } - op := &runtime.ClientOperation{ - ID: "PutRecorderID", - Method: "PUT", - PathPattern: "/recorder/{id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PutRecorderIDReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, nil, err - } - switch value := result.(type) { - case *PutRecorderIDOK: - return value, nil, nil - case *PutRecorderIDCreated: - return nil, value, nil - } - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for recorder: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -// SetTransport changes the transport on the client -func (a *Client) SetTransport(transport runtime.ClientTransport) { - a.transport = transport -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/service/delete_service_id_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/service/delete_service_id_parameters.go deleted file mode 100644 index a464423c8..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/service/delete_service_id_parameters.go +++ /dev/null @@ -1,155 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteServiceIDParams creates a new DeleteServiceIDParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewDeleteServiceIDParams() *DeleteServiceIDParams { - return &DeleteServiceIDParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewDeleteServiceIDParamsWithTimeout creates a new DeleteServiceIDParams object -// with the ability to set a timeout on a request. -func NewDeleteServiceIDParamsWithTimeout(timeout time.Duration) *DeleteServiceIDParams { - return &DeleteServiceIDParams{ - timeout: timeout, - } -} - -// NewDeleteServiceIDParamsWithContext creates a new DeleteServiceIDParams object -// with the ability to set a context for a request. -func NewDeleteServiceIDParamsWithContext(ctx context.Context) *DeleteServiceIDParams { - return &DeleteServiceIDParams{ - Context: ctx, - } -} - -// NewDeleteServiceIDParamsWithHTTPClient creates a new DeleteServiceIDParams object -// with the ability to set a custom HTTPClient for a request. -func NewDeleteServiceIDParamsWithHTTPClient(client *http.Client) *DeleteServiceIDParams { - return &DeleteServiceIDParams{ - HTTPClient: client, - } -} - -/* -DeleteServiceIDParams contains all the parameters to send to the API endpoint - - for the delete service ID operation. - - Typically these are written to a http.Request. -*/ -type DeleteServiceIDParams struct { - - /* ID. - - ID of service - */ - ID int64 - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the delete service ID params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeleteServiceIDParams) WithDefaults() *DeleteServiceIDParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the delete service ID params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeleteServiceIDParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the delete service ID params -func (o *DeleteServiceIDParams) WithTimeout(timeout time.Duration) *DeleteServiceIDParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the delete service ID params -func (o *DeleteServiceIDParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the delete service ID params -func (o *DeleteServiceIDParams) WithContext(ctx context.Context) *DeleteServiceIDParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the delete service ID params -func (o *DeleteServiceIDParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the delete service ID params -func (o *DeleteServiceIDParams) WithHTTPClient(client *http.Client) *DeleteServiceIDParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the delete service ID params -func (o *DeleteServiceIDParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithID adds the id to the delete service ID params -func (o *DeleteServiceIDParams) WithID(id int64) *DeleteServiceIDParams { - o.SetID(id) - return o -} - -// SetID adds the id to the delete service ID params -func (o *DeleteServiceIDParams) SetID(id int64) { - o.ID = id -} - -// WriteToRequest writes these params to a swagger request -func (o *DeleteServiceIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - // path param id - if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/service/delete_service_id_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/service/delete_service_id_responses.go deleted file mode 100644 index a5008e23d..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/service/delete_service_id_responses.go +++ /dev/null @@ -1,290 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// DeleteServiceIDReader is a Reader for the DeleteServiceID structure. -type DeleteServiceIDReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *DeleteServiceIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewDeleteServiceIDOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 403: - result := NewDeleteServiceIDForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewDeleteServiceIDNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewDeleteServiceIDFailure() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[DELETE /service/{id}] DeleteServiceID", response, response.Code()) - } -} - -// NewDeleteServiceIDOK creates a DeleteServiceIDOK with default headers values -func NewDeleteServiceIDOK() *DeleteServiceIDOK { - return &DeleteServiceIDOK{} -} - -/* -DeleteServiceIDOK describes a response with status code 200, with default header values. - -Success -*/ -type DeleteServiceIDOK struct { -} - -// IsSuccess returns true when this delete service Id o k response has a 2xx status code -func (o *DeleteServiceIDOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this delete service Id o k response has a 3xx status code -func (o *DeleteServiceIDOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete service Id o k response has a 4xx status code -func (o *DeleteServiceIDOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this delete service Id o k response has a 5xx status code -func (o *DeleteServiceIDOK) IsServerError() bool { - return false -} - -// IsCode returns true when this delete service Id o k response a status code equal to that given -func (o *DeleteServiceIDOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the delete service Id o k response -func (o *DeleteServiceIDOK) Code() int { - return 200 -} - -func (o *DeleteServiceIDOK) Error() string { - return fmt.Sprintf("[DELETE /service/{id}][%d] deleteServiceIdOK ", 200) -} - -func (o *DeleteServiceIDOK) String() string { - return fmt.Sprintf("[DELETE /service/{id}][%d] deleteServiceIdOK ", 200) -} - -func (o *DeleteServiceIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewDeleteServiceIDForbidden creates a DeleteServiceIDForbidden with default headers values -func NewDeleteServiceIDForbidden() *DeleteServiceIDForbidden { - return &DeleteServiceIDForbidden{} -} - -/* -DeleteServiceIDForbidden describes a response with status code 403, with default header values. - -Forbidden -*/ -type DeleteServiceIDForbidden struct { -} - -// IsSuccess returns true when this delete service Id forbidden response has a 2xx status code -func (o *DeleteServiceIDForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete service Id forbidden response has a 3xx status code -func (o *DeleteServiceIDForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete service Id forbidden response has a 4xx status code -func (o *DeleteServiceIDForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete service Id forbidden response has a 5xx status code -func (o *DeleteServiceIDForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this delete service Id forbidden response a status code equal to that given -func (o *DeleteServiceIDForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the delete service Id forbidden response -func (o *DeleteServiceIDForbidden) Code() int { - return 403 -} - -func (o *DeleteServiceIDForbidden) Error() string { - return fmt.Sprintf("[DELETE /service/{id}][%d] deleteServiceIdForbidden ", 403) -} - -func (o *DeleteServiceIDForbidden) String() string { - return fmt.Sprintf("[DELETE /service/{id}][%d] deleteServiceIdForbidden ", 403) -} - -func (o *DeleteServiceIDForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewDeleteServiceIDNotFound creates a DeleteServiceIDNotFound with default headers values -func NewDeleteServiceIDNotFound() *DeleteServiceIDNotFound { - return &DeleteServiceIDNotFound{} -} - -/* -DeleteServiceIDNotFound describes a response with status code 404, with default header values. - -Service not found -*/ -type DeleteServiceIDNotFound struct { -} - -// IsSuccess returns true when this delete service Id not found response has a 2xx status code -func (o *DeleteServiceIDNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete service Id not found response has a 3xx status code -func (o *DeleteServiceIDNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete service Id not found response has a 4xx status code -func (o *DeleteServiceIDNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this delete service Id not found response has a 5xx status code -func (o *DeleteServiceIDNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this delete service Id not found response a status code equal to that given -func (o *DeleteServiceIDNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the delete service Id not found response -func (o *DeleteServiceIDNotFound) Code() int { - return 404 -} - -func (o *DeleteServiceIDNotFound) Error() string { - return fmt.Sprintf("[DELETE /service/{id}][%d] deleteServiceIdNotFound ", 404) -} - -func (o *DeleteServiceIDNotFound) String() string { - return fmt.Sprintf("[DELETE /service/{id}][%d] deleteServiceIdNotFound ", 404) -} - -func (o *DeleteServiceIDNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewDeleteServiceIDFailure creates a DeleteServiceIDFailure with default headers values -func NewDeleteServiceIDFailure() *DeleteServiceIDFailure { - return &DeleteServiceIDFailure{} -} - -/* -DeleteServiceIDFailure describes a response with status code 500, with default header values. - -Service deletion failed -*/ -type DeleteServiceIDFailure struct { - Payload models.Error -} - -// IsSuccess returns true when this delete service Id failure response has a 2xx status code -func (o *DeleteServiceIDFailure) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this delete service Id failure response has a 3xx status code -func (o *DeleteServiceIDFailure) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete service Id failure response has a 4xx status code -func (o *DeleteServiceIDFailure) IsClientError() bool { - return false -} - -// IsServerError returns true when this delete service Id failure response has a 5xx status code -func (o *DeleteServiceIDFailure) IsServerError() bool { - return true -} - -// IsCode returns true when this delete service Id failure response a status code equal to that given -func (o *DeleteServiceIDFailure) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the delete service Id failure response -func (o *DeleteServiceIDFailure) Code() int { - return 500 -} - -func (o *DeleteServiceIDFailure) Error() string { - return fmt.Sprintf("[DELETE /service/{id}][%d] deleteServiceIdFailure %+v", 500, o.Payload) -} - -func (o *DeleteServiceIDFailure) String() string { - return fmt.Sprintf("[DELETE /service/{id}][%d] deleteServiceIdFailure %+v", 500, o.Payload) -} - -func (o *DeleteServiceIDFailure) GetPayload() models.Error { - return o.Payload -} - -func (o *DeleteServiceIDFailure) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/service/get_lrp_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/service/get_lrp_parameters.go deleted file mode 100644 index beb277ecd..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/service/get_lrp_parameters.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetLrpParams creates a new GetLrpParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetLrpParams() *GetLrpParams { - return &GetLrpParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetLrpParamsWithTimeout creates a new GetLrpParams object -// with the ability to set a timeout on a request. -func NewGetLrpParamsWithTimeout(timeout time.Duration) *GetLrpParams { - return &GetLrpParams{ - timeout: timeout, - } -} - -// NewGetLrpParamsWithContext creates a new GetLrpParams object -// with the ability to set a context for a request. -func NewGetLrpParamsWithContext(ctx context.Context) *GetLrpParams { - return &GetLrpParams{ - Context: ctx, - } -} - -// NewGetLrpParamsWithHTTPClient creates a new GetLrpParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetLrpParamsWithHTTPClient(client *http.Client) *GetLrpParams { - return &GetLrpParams{ - HTTPClient: client, - } -} - -/* -GetLrpParams contains all the parameters to send to the API endpoint - - for the get lrp operation. - - Typically these are written to a http.Request. -*/ -type GetLrpParams struct { - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get lrp params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetLrpParams) WithDefaults() *GetLrpParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get lrp params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetLrpParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get lrp params -func (o *GetLrpParams) WithTimeout(timeout time.Duration) *GetLrpParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get lrp params -func (o *GetLrpParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get lrp params -func (o *GetLrpParams) WithContext(ctx context.Context) *GetLrpParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get lrp params -func (o *GetLrpParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get lrp params -func (o *GetLrpParams) WithHTTPClient(client *http.Client) *GetLrpParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get lrp params -func (o *GetLrpParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *GetLrpParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/service/get_lrp_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/service/get_lrp_responses.go deleted file mode 100644 index 60d0f1996..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/service/get_lrp_responses.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetLrpReader is a Reader for the GetLrp structure. -type GetLrpReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetLrpReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetLrpOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - return nil, runtime.NewAPIError("[GET /lrp] GetLrp", response, response.Code()) - } -} - -// NewGetLrpOK creates a GetLrpOK with default headers values -func NewGetLrpOK() *GetLrpOK { - return &GetLrpOK{} -} - -/* -GetLrpOK describes a response with status code 200, with default header values. - -Success -*/ -type GetLrpOK struct { - Payload []*models.LRPSpec -} - -// IsSuccess returns true when this get lrp o k response has a 2xx status code -func (o *GetLrpOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get lrp o k response has a 3xx status code -func (o *GetLrpOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get lrp o k response has a 4xx status code -func (o *GetLrpOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get lrp o k response has a 5xx status code -func (o *GetLrpOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get lrp o k response a status code equal to that given -func (o *GetLrpOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get lrp o k response -func (o *GetLrpOK) Code() int { - return 200 -} - -func (o *GetLrpOK) Error() string { - return fmt.Sprintf("[GET /lrp][%d] getLrpOK %+v", 200, o.Payload) -} - -func (o *GetLrpOK) String() string { - return fmt.Sprintf("[GET /lrp][%d] getLrpOK %+v", 200, o.Payload) -} - -func (o *GetLrpOK) GetPayload() []*models.LRPSpec { - return o.Payload -} - -func (o *GetLrpOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/service/get_service_id_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/service/get_service_id_parameters.go deleted file mode 100644 index dac152aae..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/service/get_service_id_parameters.go +++ /dev/null @@ -1,155 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetServiceIDParams creates a new GetServiceIDParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetServiceIDParams() *GetServiceIDParams { - return &GetServiceIDParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetServiceIDParamsWithTimeout creates a new GetServiceIDParams object -// with the ability to set a timeout on a request. -func NewGetServiceIDParamsWithTimeout(timeout time.Duration) *GetServiceIDParams { - return &GetServiceIDParams{ - timeout: timeout, - } -} - -// NewGetServiceIDParamsWithContext creates a new GetServiceIDParams object -// with the ability to set a context for a request. -func NewGetServiceIDParamsWithContext(ctx context.Context) *GetServiceIDParams { - return &GetServiceIDParams{ - Context: ctx, - } -} - -// NewGetServiceIDParamsWithHTTPClient creates a new GetServiceIDParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetServiceIDParamsWithHTTPClient(client *http.Client) *GetServiceIDParams { - return &GetServiceIDParams{ - HTTPClient: client, - } -} - -/* -GetServiceIDParams contains all the parameters to send to the API endpoint - - for the get service ID operation. - - Typically these are written to a http.Request. -*/ -type GetServiceIDParams struct { - - /* ID. - - ID of service - */ - ID int64 - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get service ID params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetServiceIDParams) WithDefaults() *GetServiceIDParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get service ID params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetServiceIDParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get service ID params -func (o *GetServiceIDParams) WithTimeout(timeout time.Duration) *GetServiceIDParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get service ID params -func (o *GetServiceIDParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get service ID params -func (o *GetServiceIDParams) WithContext(ctx context.Context) *GetServiceIDParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get service ID params -func (o *GetServiceIDParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get service ID params -func (o *GetServiceIDParams) WithHTTPClient(client *http.Client) *GetServiceIDParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get service ID params -func (o *GetServiceIDParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithID adds the id to the get service ID params -func (o *GetServiceIDParams) WithID(id int64) *GetServiceIDParams { - o.SetID(id) - return o -} - -// SetID adds the id to the get service ID params -func (o *GetServiceIDParams) SetID(id int64) { - o.ID = id -} - -// WriteToRequest writes these params to a swagger request -func (o *GetServiceIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - // path param id - if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/service/get_service_id_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/service/get_service_id_responses.go deleted file mode 100644 index a5f81c101..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/service/get_service_id_responses.go +++ /dev/null @@ -1,168 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetServiceIDReader is a Reader for the GetServiceID structure. -type GetServiceIDReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetServiceIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetServiceIDOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 404: - result := NewGetServiceIDNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /service/{id}] GetServiceID", response, response.Code()) - } -} - -// NewGetServiceIDOK creates a GetServiceIDOK with default headers values -func NewGetServiceIDOK() *GetServiceIDOK { - return &GetServiceIDOK{} -} - -/* -GetServiceIDOK describes a response with status code 200, with default header values. - -Success -*/ -type GetServiceIDOK struct { - Payload *models.Service -} - -// IsSuccess returns true when this get service Id o k response has a 2xx status code -func (o *GetServiceIDOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get service Id o k response has a 3xx status code -func (o *GetServiceIDOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get service Id o k response has a 4xx status code -func (o *GetServiceIDOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get service Id o k response has a 5xx status code -func (o *GetServiceIDOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get service Id o k response a status code equal to that given -func (o *GetServiceIDOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get service Id o k response -func (o *GetServiceIDOK) Code() int { - return 200 -} - -func (o *GetServiceIDOK) Error() string { - return fmt.Sprintf("[GET /service/{id}][%d] getServiceIdOK %+v", 200, o.Payload) -} - -func (o *GetServiceIDOK) String() string { - return fmt.Sprintf("[GET /service/{id}][%d] getServiceIdOK %+v", 200, o.Payload) -} - -func (o *GetServiceIDOK) GetPayload() *models.Service { - return o.Payload -} - -func (o *GetServiceIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.Service) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetServiceIDNotFound creates a GetServiceIDNotFound with default headers values -func NewGetServiceIDNotFound() *GetServiceIDNotFound { - return &GetServiceIDNotFound{} -} - -/* -GetServiceIDNotFound describes a response with status code 404, with default header values. - -Service not found -*/ -type GetServiceIDNotFound struct { -} - -// IsSuccess returns true when this get service Id not found response has a 2xx status code -func (o *GetServiceIDNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get service Id not found response has a 3xx status code -func (o *GetServiceIDNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get service Id not found response has a 4xx status code -func (o *GetServiceIDNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this get service Id not found response has a 5xx status code -func (o *GetServiceIDNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this get service Id not found response a status code equal to that given -func (o *GetServiceIDNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the get service Id not found response -func (o *GetServiceIDNotFound) Code() int { - return 404 -} - -func (o *GetServiceIDNotFound) Error() string { - return fmt.Sprintf("[GET /service/{id}][%d] getServiceIdNotFound ", 404) -} - -func (o *GetServiceIDNotFound) String() string { - return fmt.Sprintf("[GET /service/{id}][%d] getServiceIdNotFound ", 404) -} - -func (o *GetServiceIDNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/service/get_service_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/service/get_service_parameters.go deleted file mode 100644 index ff7dfcb84..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/service/get_service_parameters.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetServiceParams creates a new GetServiceParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetServiceParams() *GetServiceParams { - return &GetServiceParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetServiceParamsWithTimeout creates a new GetServiceParams object -// with the ability to set a timeout on a request. -func NewGetServiceParamsWithTimeout(timeout time.Duration) *GetServiceParams { - return &GetServiceParams{ - timeout: timeout, - } -} - -// NewGetServiceParamsWithContext creates a new GetServiceParams object -// with the ability to set a context for a request. -func NewGetServiceParamsWithContext(ctx context.Context) *GetServiceParams { - return &GetServiceParams{ - Context: ctx, - } -} - -// NewGetServiceParamsWithHTTPClient creates a new GetServiceParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetServiceParamsWithHTTPClient(client *http.Client) *GetServiceParams { - return &GetServiceParams{ - HTTPClient: client, - } -} - -/* -GetServiceParams contains all the parameters to send to the API endpoint - - for the get service operation. - - Typically these are written to a http.Request. -*/ -type GetServiceParams struct { - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get service params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetServiceParams) WithDefaults() *GetServiceParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get service params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetServiceParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get service params -func (o *GetServiceParams) WithTimeout(timeout time.Duration) *GetServiceParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get service params -func (o *GetServiceParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get service params -func (o *GetServiceParams) WithContext(ctx context.Context) *GetServiceParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get service params -func (o *GetServiceParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get service params -func (o *GetServiceParams) WithHTTPClient(client *http.Client) *GetServiceParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get service params -func (o *GetServiceParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *GetServiceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/service/get_service_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/service/get_service_responses.go deleted file mode 100644 index 5a6bd669c..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/service/get_service_responses.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetServiceReader is a Reader for the GetService structure. -type GetServiceReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetServiceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetServiceOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - return nil, runtime.NewAPIError("[GET /service] GetService", response, response.Code()) - } -} - -// NewGetServiceOK creates a GetServiceOK with default headers values -func NewGetServiceOK() *GetServiceOK { - return &GetServiceOK{} -} - -/* -GetServiceOK describes a response with status code 200, with default header values. - -Success -*/ -type GetServiceOK struct { - Payload []*models.Service -} - -// IsSuccess returns true when this get service o k response has a 2xx status code -func (o *GetServiceOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get service o k response has a 3xx status code -func (o *GetServiceOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get service o k response has a 4xx status code -func (o *GetServiceOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get service o k response has a 5xx status code -func (o *GetServiceOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get service o k response a status code equal to that given -func (o *GetServiceOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get service o k response -func (o *GetServiceOK) Code() int { - return 200 -} - -func (o *GetServiceOK) Error() string { - return fmt.Sprintf("[GET /service][%d] getServiceOK %+v", 200, o.Payload) -} - -func (o *GetServiceOK) String() string { - return fmt.Sprintf("[GET /service][%d] getServiceOK %+v", 200, o.Payload) -} - -func (o *GetServiceOK) GetPayload() []*models.Service { - return o.Payload -} - -func (o *GetServiceOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/service/put_service_id_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/service/put_service_id_parameters.go deleted file mode 100644 index b1877e4b7..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/service/put_service_id_parameters.go +++ /dev/null @@ -1,179 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/cilium/cilium/api/v1/models" -) - -// NewPutServiceIDParams creates a new PutServiceIDParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewPutServiceIDParams() *PutServiceIDParams { - return &PutServiceIDParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewPutServiceIDParamsWithTimeout creates a new PutServiceIDParams object -// with the ability to set a timeout on a request. -func NewPutServiceIDParamsWithTimeout(timeout time.Duration) *PutServiceIDParams { - return &PutServiceIDParams{ - timeout: timeout, - } -} - -// NewPutServiceIDParamsWithContext creates a new PutServiceIDParams object -// with the ability to set a context for a request. -func NewPutServiceIDParamsWithContext(ctx context.Context) *PutServiceIDParams { - return &PutServiceIDParams{ - Context: ctx, - } -} - -// NewPutServiceIDParamsWithHTTPClient creates a new PutServiceIDParams object -// with the ability to set a custom HTTPClient for a request. -func NewPutServiceIDParamsWithHTTPClient(client *http.Client) *PutServiceIDParams { - return &PutServiceIDParams{ - HTTPClient: client, - } -} - -/* -PutServiceIDParams contains all the parameters to send to the API endpoint - - for the put service ID operation. - - Typically these are written to a http.Request. -*/ -type PutServiceIDParams struct { - - /* Config. - - Service configuration - */ - Config *models.ServiceSpec - - /* ID. - - ID of service - */ - ID int64 - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the put service ID params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PutServiceIDParams) WithDefaults() *PutServiceIDParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the put service ID params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PutServiceIDParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the put service ID params -func (o *PutServiceIDParams) WithTimeout(timeout time.Duration) *PutServiceIDParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the put service ID params -func (o *PutServiceIDParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the put service ID params -func (o *PutServiceIDParams) WithContext(ctx context.Context) *PutServiceIDParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the put service ID params -func (o *PutServiceIDParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the put service ID params -func (o *PutServiceIDParams) WithHTTPClient(client *http.Client) *PutServiceIDParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the put service ID params -func (o *PutServiceIDParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithConfig adds the config to the put service ID params -func (o *PutServiceIDParams) WithConfig(config *models.ServiceSpec) *PutServiceIDParams { - o.SetConfig(config) - return o -} - -// SetConfig adds the config to the put service ID params -func (o *PutServiceIDParams) SetConfig(config *models.ServiceSpec) { - o.Config = config -} - -// WithID adds the id to the put service ID params -func (o *PutServiceIDParams) WithID(id int64) *PutServiceIDParams { - o.SetID(id) - return o -} - -// SetID adds the id to the put service ID params -func (o *PutServiceIDParams) SetID(id int64) { - o.ID = id -} - -// WriteToRequest writes these params to a swagger request -func (o *PutServiceIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if o.Config != nil { - if err := r.SetBodyParam(o.Config); err != nil { - return err - } - } - - // path param id - if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/service/put_service_id_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/service/put_service_id_responses.go deleted file mode 100644 index a2a4e006c..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/service/put_service_id_responses.go +++ /dev/null @@ -1,506 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// PutServiceIDReader is a Reader for the PutServiceID structure. -type PutServiceIDReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *PutServiceIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewPutServiceIDOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 201: - result := NewPutServiceIDCreated() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 403: - result := NewPutServiceIDForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 460: - result := NewPutServiceIDInvalidFrontend() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 461: - result := NewPutServiceIDInvalidBackend() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewPutServiceIDFailure() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 501: - result := NewPutServiceIDUpdateBackendFailure() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[PUT /service/{id}] PutServiceID", response, response.Code()) - } -} - -// NewPutServiceIDOK creates a PutServiceIDOK with default headers values -func NewPutServiceIDOK() *PutServiceIDOK { - return &PutServiceIDOK{} -} - -/* -PutServiceIDOK describes a response with status code 200, with default header values. - -Updated -*/ -type PutServiceIDOK struct { -} - -// IsSuccess returns true when this put service Id o k response has a 2xx status code -func (o *PutServiceIDOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this put service Id o k response has a 3xx status code -func (o *PutServiceIDOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put service Id o k response has a 4xx status code -func (o *PutServiceIDOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this put service Id o k response has a 5xx status code -func (o *PutServiceIDOK) IsServerError() bool { - return false -} - -// IsCode returns true when this put service Id o k response a status code equal to that given -func (o *PutServiceIDOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the put service Id o k response -func (o *PutServiceIDOK) Code() int { - return 200 -} - -func (o *PutServiceIDOK) Error() string { - return fmt.Sprintf("[PUT /service/{id}][%d] putServiceIdOK ", 200) -} - -func (o *PutServiceIDOK) String() string { - return fmt.Sprintf("[PUT /service/{id}][%d] putServiceIdOK ", 200) -} - -func (o *PutServiceIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPutServiceIDCreated creates a PutServiceIDCreated with default headers values -func NewPutServiceIDCreated() *PutServiceIDCreated { - return &PutServiceIDCreated{} -} - -/* -PutServiceIDCreated describes a response with status code 201, with default header values. - -Created -*/ -type PutServiceIDCreated struct { -} - -// IsSuccess returns true when this put service Id created response has a 2xx status code -func (o *PutServiceIDCreated) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this put service Id created response has a 3xx status code -func (o *PutServiceIDCreated) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put service Id created response has a 4xx status code -func (o *PutServiceIDCreated) IsClientError() bool { - return false -} - -// IsServerError returns true when this put service Id created response has a 5xx status code -func (o *PutServiceIDCreated) IsServerError() bool { - return false -} - -// IsCode returns true when this put service Id created response a status code equal to that given -func (o *PutServiceIDCreated) IsCode(code int) bool { - return code == 201 -} - -// Code gets the status code for the put service Id created response -func (o *PutServiceIDCreated) Code() int { - return 201 -} - -func (o *PutServiceIDCreated) Error() string { - return fmt.Sprintf("[PUT /service/{id}][%d] putServiceIdCreated ", 201) -} - -func (o *PutServiceIDCreated) String() string { - return fmt.Sprintf("[PUT /service/{id}][%d] putServiceIdCreated ", 201) -} - -func (o *PutServiceIDCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPutServiceIDForbidden creates a PutServiceIDForbidden with default headers values -func NewPutServiceIDForbidden() *PutServiceIDForbidden { - return &PutServiceIDForbidden{} -} - -/* -PutServiceIDForbidden describes a response with status code 403, with default header values. - -Forbidden -*/ -type PutServiceIDForbidden struct { -} - -// IsSuccess returns true when this put service Id forbidden response has a 2xx status code -func (o *PutServiceIDForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put service Id forbidden response has a 3xx status code -func (o *PutServiceIDForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put service Id forbidden response has a 4xx status code -func (o *PutServiceIDForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this put service Id forbidden response has a 5xx status code -func (o *PutServiceIDForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this put service Id forbidden response a status code equal to that given -func (o *PutServiceIDForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the put service Id forbidden response -func (o *PutServiceIDForbidden) Code() int { - return 403 -} - -func (o *PutServiceIDForbidden) Error() string { - return fmt.Sprintf("[PUT /service/{id}][%d] putServiceIdForbidden ", 403) -} - -func (o *PutServiceIDForbidden) String() string { - return fmt.Sprintf("[PUT /service/{id}][%d] putServiceIdForbidden ", 403) -} - -func (o *PutServiceIDForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPutServiceIDInvalidFrontend creates a PutServiceIDInvalidFrontend with default headers values -func NewPutServiceIDInvalidFrontend() *PutServiceIDInvalidFrontend { - return &PutServiceIDInvalidFrontend{} -} - -/* -PutServiceIDInvalidFrontend describes a response with status code 460, with default header values. - -Invalid frontend in service configuration -*/ -type PutServiceIDInvalidFrontend struct { - Payload models.Error -} - -// IsSuccess returns true when this put service Id invalid frontend response has a 2xx status code -func (o *PutServiceIDInvalidFrontend) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put service Id invalid frontend response has a 3xx status code -func (o *PutServiceIDInvalidFrontend) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put service Id invalid frontend response has a 4xx status code -func (o *PutServiceIDInvalidFrontend) IsClientError() bool { - return true -} - -// IsServerError returns true when this put service Id invalid frontend response has a 5xx status code -func (o *PutServiceIDInvalidFrontend) IsServerError() bool { - return false -} - -// IsCode returns true when this put service Id invalid frontend response a status code equal to that given -func (o *PutServiceIDInvalidFrontend) IsCode(code int) bool { - return code == 460 -} - -// Code gets the status code for the put service Id invalid frontend response -func (o *PutServiceIDInvalidFrontend) Code() int { - return 460 -} - -func (o *PutServiceIDInvalidFrontend) Error() string { - return fmt.Sprintf("[PUT /service/{id}][%d] putServiceIdInvalidFrontend %+v", 460, o.Payload) -} - -func (o *PutServiceIDInvalidFrontend) String() string { - return fmt.Sprintf("[PUT /service/{id}][%d] putServiceIdInvalidFrontend %+v", 460, o.Payload) -} - -func (o *PutServiceIDInvalidFrontend) GetPayload() models.Error { - return o.Payload -} - -func (o *PutServiceIDInvalidFrontend) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewPutServiceIDInvalidBackend creates a PutServiceIDInvalidBackend with default headers values -func NewPutServiceIDInvalidBackend() *PutServiceIDInvalidBackend { - return &PutServiceIDInvalidBackend{} -} - -/* -PutServiceIDInvalidBackend describes a response with status code 461, with default header values. - -Invalid backend in service configuration -*/ -type PutServiceIDInvalidBackend struct { - Payload models.Error -} - -// IsSuccess returns true when this put service Id invalid backend response has a 2xx status code -func (o *PutServiceIDInvalidBackend) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put service Id invalid backend response has a 3xx status code -func (o *PutServiceIDInvalidBackend) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put service Id invalid backend response has a 4xx status code -func (o *PutServiceIDInvalidBackend) IsClientError() bool { - return true -} - -// IsServerError returns true when this put service Id invalid backend response has a 5xx status code -func (o *PutServiceIDInvalidBackend) IsServerError() bool { - return false -} - -// IsCode returns true when this put service Id invalid backend response a status code equal to that given -func (o *PutServiceIDInvalidBackend) IsCode(code int) bool { - return code == 461 -} - -// Code gets the status code for the put service Id invalid backend response -func (o *PutServiceIDInvalidBackend) Code() int { - return 461 -} - -func (o *PutServiceIDInvalidBackend) Error() string { - return fmt.Sprintf("[PUT /service/{id}][%d] putServiceIdInvalidBackend %+v", 461, o.Payload) -} - -func (o *PutServiceIDInvalidBackend) String() string { - return fmt.Sprintf("[PUT /service/{id}][%d] putServiceIdInvalidBackend %+v", 461, o.Payload) -} - -func (o *PutServiceIDInvalidBackend) GetPayload() models.Error { - return o.Payload -} - -func (o *PutServiceIDInvalidBackend) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewPutServiceIDFailure creates a PutServiceIDFailure with default headers values -func NewPutServiceIDFailure() *PutServiceIDFailure { - return &PutServiceIDFailure{} -} - -/* -PutServiceIDFailure describes a response with status code 500, with default header values. - -Error while creating service -*/ -type PutServiceIDFailure struct { - Payload models.Error -} - -// IsSuccess returns true when this put service Id failure response has a 2xx status code -func (o *PutServiceIDFailure) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put service Id failure response has a 3xx status code -func (o *PutServiceIDFailure) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put service Id failure response has a 4xx status code -func (o *PutServiceIDFailure) IsClientError() bool { - return false -} - -// IsServerError returns true when this put service Id failure response has a 5xx status code -func (o *PutServiceIDFailure) IsServerError() bool { - return true -} - -// IsCode returns true when this put service Id failure response a status code equal to that given -func (o *PutServiceIDFailure) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the put service Id failure response -func (o *PutServiceIDFailure) Code() int { - return 500 -} - -func (o *PutServiceIDFailure) Error() string { - return fmt.Sprintf("[PUT /service/{id}][%d] putServiceIdFailure %+v", 500, o.Payload) -} - -func (o *PutServiceIDFailure) String() string { - return fmt.Sprintf("[PUT /service/{id}][%d] putServiceIdFailure %+v", 500, o.Payload) -} - -func (o *PutServiceIDFailure) GetPayload() models.Error { - return o.Payload -} - -func (o *PutServiceIDFailure) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewPutServiceIDUpdateBackendFailure creates a PutServiceIDUpdateBackendFailure with default headers values -func NewPutServiceIDUpdateBackendFailure() *PutServiceIDUpdateBackendFailure { - return &PutServiceIDUpdateBackendFailure{} -} - -/* -PutServiceIDUpdateBackendFailure describes a response with status code 501, with default header values. - -Error while updating backend states -*/ -type PutServiceIDUpdateBackendFailure struct { - Payload models.Error -} - -// IsSuccess returns true when this put service Id update backend failure response has a 2xx status code -func (o *PutServiceIDUpdateBackendFailure) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put service Id update backend failure response has a 3xx status code -func (o *PutServiceIDUpdateBackendFailure) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put service Id update backend failure response has a 4xx status code -func (o *PutServiceIDUpdateBackendFailure) IsClientError() bool { - return false -} - -// IsServerError returns true when this put service Id update backend failure response has a 5xx status code -func (o *PutServiceIDUpdateBackendFailure) IsServerError() bool { - return true -} - -// IsCode returns true when this put service Id update backend failure response a status code equal to that given -func (o *PutServiceIDUpdateBackendFailure) IsCode(code int) bool { - return code == 501 -} - -// Code gets the status code for the put service Id update backend failure response -func (o *PutServiceIDUpdateBackendFailure) Code() int { - return 501 -} - -func (o *PutServiceIDUpdateBackendFailure) Error() string { - return fmt.Sprintf("[PUT /service/{id}][%d] putServiceIdUpdateBackendFailure %+v", 501, o.Payload) -} - -func (o *PutServiceIDUpdateBackendFailure) String() string { - return fmt.Sprintf("[PUT /service/{id}][%d] putServiceIdUpdateBackendFailure %+v", 501, o.Payload) -} - -func (o *PutServiceIDUpdateBackendFailure) GetPayload() models.Error { - return o.Payload -} - -func (o *PutServiceIDUpdateBackendFailure) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/service/service_client.go b/vendor/github.com/cilium/cilium/api/v1/client/service/service_client.go deleted file mode 100644 index 332799a98..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/service/service_client.go +++ /dev/null @@ -1,243 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// New creates a new service API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { - return &Client{transport: transport, formats: formats} -} - -/* -Client for service API -*/ -type Client struct { - transport runtime.ClientTransport - formats strfmt.Registry -} - -// ClientOption is the option for Client methods -type ClientOption func(*runtime.ClientOperation) - -// ClientService is the interface for Client methods -type ClientService interface { - DeleteServiceID(params *DeleteServiceIDParams, opts ...ClientOption) (*DeleteServiceIDOK, error) - - GetLrp(params *GetLrpParams, opts ...ClientOption) (*GetLrpOK, error) - - GetService(params *GetServiceParams, opts ...ClientOption) (*GetServiceOK, error) - - GetServiceID(params *GetServiceIDParams, opts ...ClientOption) (*GetServiceIDOK, error) - - PutServiceID(params *PutServiceIDParams, opts ...ClientOption) (*PutServiceIDOK, *PutServiceIDCreated, error) - - SetTransport(transport runtime.ClientTransport) -} - -/* -DeleteServiceID deletes a service -*/ -func (a *Client) DeleteServiceID(params *DeleteServiceIDParams, opts ...ClientOption) (*DeleteServiceIDOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewDeleteServiceIDParams() - } - op := &runtime.ClientOperation{ - ID: "DeleteServiceID", - Method: "DELETE", - PathPattern: "/service/{id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &DeleteServiceIDReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*DeleteServiceIDOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for DeleteServiceID: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetLrp retrieves list of all local redirect policies -*/ -func (a *Client) GetLrp(params *GetLrpParams, opts ...ClientOption) (*GetLrpOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetLrpParams() - } - op := &runtime.ClientOperation{ - ID: "GetLrp", - Method: "GET", - PathPattern: "/lrp", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetLrpReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetLrpOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetLrp: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetService retrieves list of all services -*/ -func (a *Client) GetService(params *GetServiceParams, opts ...ClientOption) (*GetServiceOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetServiceParams() - } - op := &runtime.ClientOperation{ - ID: "GetService", - Method: "GET", - PathPattern: "/service", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetServiceReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetServiceOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetService: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetServiceID retrieves configuration of a service -*/ -func (a *Client) GetServiceID(params *GetServiceIDParams, opts ...ClientOption) (*GetServiceIDOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetServiceIDParams() - } - op := &runtime.ClientOperation{ - ID: "GetServiceID", - Method: "GET", - PathPattern: "/service/{id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetServiceIDReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetServiceIDOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetServiceID: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -PutServiceID creates or update service -*/ -func (a *Client) PutServiceID(params *PutServiceIDParams, opts ...ClientOption) (*PutServiceIDOK, *PutServiceIDCreated, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPutServiceIDParams() - } - op := &runtime.ClientOperation{ - ID: "PutServiceID", - Method: "PUT", - PathPattern: "/service/{id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PutServiceIDReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, nil, err - } - switch value := result.(type) { - case *PutServiceIDOK: - return value, nil, nil - case *PutServiceIDCreated: - return nil, value, nil - } - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for service: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -// SetTransport changes the transport on the client -func (a *Client) SetTransport(transport runtime.ClientTransport) { - a.transport = transport -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/statedb/get_statedb_dump_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/statedb/get_statedb_dump_parameters.go deleted file mode 100644 index fe1c3ff1a..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/statedb/get_statedb_dump_parameters.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package statedb - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetStatedbDumpParams creates a new GetStatedbDumpParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetStatedbDumpParams() *GetStatedbDumpParams { - return &GetStatedbDumpParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetStatedbDumpParamsWithTimeout creates a new GetStatedbDumpParams object -// with the ability to set a timeout on a request. -func NewGetStatedbDumpParamsWithTimeout(timeout time.Duration) *GetStatedbDumpParams { - return &GetStatedbDumpParams{ - timeout: timeout, - } -} - -// NewGetStatedbDumpParamsWithContext creates a new GetStatedbDumpParams object -// with the ability to set a context for a request. -func NewGetStatedbDumpParamsWithContext(ctx context.Context) *GetStatedbDumpParams { - return &GetStatedbDumpParams{ - Context: ctx, - } -} - -// NewGetStatedbDumpParamsWithHTTPClient creates a new GetStatedbDumpParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetStatedbDumpParamsWithHTTPClient(client *http.Client) *GetStatedbDumpParams { - return &GetStatedbDumpParams{ - HTTPClient: client, - } -} - -/* -GetStatedbDumpParams contains all the parameters to send to the API endpoint - - for the get statedb dump operation. - - Typically these are written to a http.Request. -*/ -type GetStatedbDumpParams struct { - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get statedb dump params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetStatedbDumpParams) WithDefaults() *GetStatedbDumpParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get statedb dump params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetStatedbDumpParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get statedb dump params -func (o *GetStatedbDumpParams) WithTimeout(timeout time.Duration) *GetStatedbDumpParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get statedb dump params -func (o *GetStatedbDumpParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get statedb dump params -func (o *GetStatedbDumpParams) WithContext(ctx context.Context) *GetStatedbDumpParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get statedb dump params -func (o *GetStatedbDumpParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get statedb dump params -func (o *GetStatedbDumpParams) WithHTTPClient(client *http.Client) *GetStatedbDumpParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get statedb dump params -func (o *GetStatedbDumpParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *GetStatedbDumpParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/statedb/get_statedb_dump_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/statedb/get_statedb_dump_responses.go deleted file mode 100644 index 6434ceb10..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/statedb/get_statedb_dump_responses.go +++ /dev/null @@ -1,106 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package statedb - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// GetStatedbDumpReader is a Reader for the GetStatedbDump structure. -type GetStatedbDumpReader struct { - formats strfmt.Registry - writer io.Writer -} - -// ReadResponse reads a server response into the received o. -func (o *GetStatedbDumpReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetStatedbDumpOK(o.writer) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - return nil, runtime.NewAPIError("[GET /statedb/dump] GetStatedbDump", response, response.Code()) - } -} - -// NewGetStatedbDumpOK creates a GetStatedbDumpOK with default headers values -func NewGetStatedbDumpOK(writer io.Writer) *GetStatedbDumpOK { - return &GetStatedbDumpOK{ - - Payload: writer, - } -} - -/* -GetStatedbDumpOK describes a response with status code 200, with default header values. - -Success -*/ -type GetStatedbDumpOK struct { - Payload io.Writer -} - -// IsSuccess returns true when this get statedb dump o k response has a 2xx status code -func (o *GetStatedbDumpOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get statedb dump o k response has a 3xx status code -func (o *GetStatedbDumpOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get statedb dump o k response has a 4xx status code -func (o *GetStatedbDumpOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get statedb dump o k response has a 5xx status code -func (o *GetStatedbDumpOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get statedb dump o k response a status code equal to that given -func (o *GetStatedbDumpOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get statedb dump o k response -func (o *GetStatedbDumpOK) Code() int { - return 200 -} - -func (o *GetStatedbDumpOK) Error() string { - return fmt.Sprintf("[GET /statedb/dump][%d] getStatedbDumpOK %+v", 200, o.Payload) -} - -func (o *GetStatedbDumpOK) String() string { - return fmt.Sprintf("[GET /statedb/dump][%d] getStatedbDumpOK %+v", 200, o.Payload) -} - -func (o *GetStatedbDumpOK) GetPayload() io.Writer { - return o.Payload -} - -func (o *GetStatedbDumpOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/statedb/get_statedb_query_table_parameters.go b/vendor/github.com/cilium/cilium/api/v1/client/statedb/get_statedb_query_table_parameters.go deleted file mode 100644 index b936411ea..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/statedb/get_statedb_query_table_parameters.go +++ /dev/null @@ -1,236 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package statedb - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetStatedbQueryTableParams creates a new GetStatedbQueryTableParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetStatedbQueryTableParams() *GetStatedbQueryTableParams { - return &GetStatedbQueryTableParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetStatedbQueryTableParamsWithTimeout creates a new GetStatedbQueryTableParams object -// with the ability to set a timeout on a request. -func NewGetStatedbQueryTableParamsWithTimeout(timeout time.Duration) *GetStatedbQueryTableParams { - return &GetStatedbQueryTableParams{ - timeout: timeout, - } -} - -// NewGetStatedbQueryTableParamsWithContext creates a new GetStatedbQueryTableParams object -// with the ability to set a context for a request. -func NewGetStatedbQueryTableParamsWithContext(ctx context.Context) *GetStatedbQueryTableParams { - return &GetStatedbQueryTableParams{ - Context: ctx, - } -} - -// NewGetStatedbQueryTableParamsWithHTTPClient creates a new GetStatedbQueryTableParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetStatedbQueryTableParamsWithHTTPClient(client *http.Client) *GetStatedbQueryTableParams { - return &GetStatedbQueryTableParams{ - HTTPClient: client, - } -} - -/* -GetStatedbQueryTableParams contains all the parameters to send to the API endpoint - - for the get statedb query table operation. - - Typically these are written to a http.Request. -*/ -type GetStatedbQueryTableParams struct { - - /* Index. - - StateDB index name - */ - Index string - - /* Key. - - Query key (base64 encoded) - */ - Key string - - /* Lowerbound. - - If true perform a LowerBound search - */ - Lowerbound bool - - /* Table. - - StateDB table name - */ - Table string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get statedb query table params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetStatedbQueryTableParams) WithDefaults() *GetStatedbQueryTableParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get statedb query table params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetStatedbQueryTableParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get statedb query table params -func (o *GetStatedbQueryTableParams) WithTimeout(timeout time.Duration) *GetStatedbQueryTableParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get statedb query table params -func (o *GetStatedbQueryTableParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get statedb query table params -func (o *GetStatedbQueryTableParams) WithContext(ctx context.Context) *GetStatedbQueryTableParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get statedb query table params -func (o *GetStatedbQueryTableParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get statedb query table params -func (o *GetStatedbQueryTableParams) WithHTTPClient(client *http.Client) *GetStatedbQueryTableParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get statedb query table params -func (o *GetStatedbQueryTableParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithIndex adds the index to the get statedb query table params -func (o *GetStatedbQueryTableParams) WithIndex(index string) *GetStatedbQueryTableParams { - o.SetIndex(index) - return o -} - -// SetIndex adds the index to the get statedb query table params -func (o *GetStatedbQueryTableParams) SetIndex(index string) { - o.Index = index -} - -// WithKey adds the key to the get statedb query table params -func (o *GetStatedbQueryTableParams) WithKey(key string) *GetStatedbQueryTableParams { - o.SetKey(key) - return o -} - -// SetKey adds the key to the get statedb query table params -func (o *GetStatedbQueryTableParams) SetKey(key string) { - o.Key = key -} - -// WithLowerbound adds the lowerbound to the get statedb query table params -func (o *GetStatedbQueryTableParams) WithLowerbound(lowerbound bool) *GetStatedbQueryTableParams { - o.SetLowerbound(lowerbound) - return o -} - -// SetLowerbound adds the lowerbound to the get statedb query table params -func (o *GetStatedbQueryTableParams) SetLowerbound(lowerbound bool) { - o.Lowerbound = lowerbound -} - -// WithTable adds the table to the get statedb query table params -func (o *GetStatedbQueryTableParams) WithTable(table string) *GetStatedbQueryTableParams { - o.SetTable(table) - return o -} - -// SetTable adds the table to the get statedb query table params -func (o *GetStatedbQueryTableParams) SetTable(table string) { - o.Table = table -} - -// WriteToRequest writes these params to a swagger request -func (o *GetStatedbQueryTableParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - // query param index - qrIndex := o.Index - qIndex := qrIndex - if qIndex != "" { - - if err := r.SetQueryParam("index", qIndex); err != nil { - return err - } - } - - // query param key - qrKey := o.Key - qKey := qrKey - if qKey != "" { - - if err := r.SetQueryParam("key", qKey); err != nil { - return err - } - } - - // query param lowerbound - qrLowerbound := o.Lowerbound - qLowerbound := swag.FormatBool(qrLowerbound) - if qLowerbound != "" { - - if err := r.SetQueryParam("lowerbound", qLowerbound); err != nil { - return err - } - } - - // path param table - if err := r.SetPathParam("table", o.Table); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/statedb/get_statedb_query_table_responses.go b/vendor/github.com/cilium/cilium/api/v1/client/statedb/get_statedb_query_table_responses.go deleted file mode 100644 index 7c0df347e..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/statedb/get_statedb_query_table_responses.go +++ /dev/null @@ -1,242 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package statedb - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetStatedbQueryTableReader is a Reader for the GetStatedbQueryTable structure. -type GetStatedbQueryTableReader struct { - formats strfmt.Registry - writer io.Writer -} - -// ReadResponse reads a server response into the received o. -func (o *GetStatedbQueryTableReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetStatedbQueryTableOK(o.writer) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 400: - result := NewGetStatedbQueryTableBadRequest() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewGetStatedbQueryTableNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /statedb/query/{table}] GetStatedbQueryTable", response, response.Code()) - } -} - -// NewGetStatedbQueryTableOK creates a GetStatedbQueryTableOK with default headers values -func NewGetStatedbQueryTableOK(writer io.Writer) *GetStatedbQueryTableOK { - return &GetStatedbQueryTableOK{ - - Payload: writer, - } -} - -/* -GetStatedbQueryTableOK describes a response with status code 200, with default header values. - -Success -*/ -type GetStatedbQueryTableOK struct { - Payload io.Writer -} - -// IsSuccess returns true when this get statedb query table o k response has a 2xx status code -func (o *GetStatedbQueryTableOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get statedb query table o k response has a 3xx status code -func (o *GetStatedbQueryTableOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get statedb query table o k response has a 4xx status code -func (o *GetStatedbQueryTableOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get statedb query table o k response has a 5xx status code -func (o *GetStatedbQueryTableOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get statedb query table o k response a status code equal to that given -func (o *GetStatedbQueryTableOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get statedb query table o k response -func (o *GetStatedbQueryTableOK) Code() int { - return 200 -} - -func (o *GetStatedbQueryTableOK) Error() string { - return fmt.Sprintf("[GET /statedb/query/{table}][%d] getStatedbQueryTableOK %+v", 200, o.Payload) -} - -func (o *GetStatedbQueryTableOK) String() string { - return fmt.Sprintf("[GET /statedb/query/{table}][%d] getStatedbQueryTableOK %+v", 200, o.Payload) -} - -func (o *GetStatedbQueryTableOK) GetPayload() io.Writer { - return o.Payload -} - -func (o *GetStatedbQueryTableOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetStatedbQueryTableBadRequest creates a GetStatedbQueryTableBadRequest with default headers values -func NewGetStatedbQueryTableBadRequest() *GetStatedbQueryTableBadRequest { - return &GetStatedbQueryTableBadRequest{} -} - -/* -GetStatedbQueryTableBadRequest describes a response with status code 400, with default header values. - -Invalid parameters -*/ -type GetStatedbQueryTableBadRequest struct { - Payload models.Error -} - -// IsSuccess returns true when this get statedb query table bad request response has a 2xx status code -func (o *GetStatedbQueryTableBadRequest) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get statedb query table bad request response has a 3xx status code -func (o *GetStatedbQueryTableBadRequest) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get statedb query table bad request response has a 4xx status code -func (o *GetStatedbQueryTableBadRequest) IsClientError() bool { - return true -} - -// IsServerError returns true when this get statedb query table bad request response has a 5xx status code -func (o *GetStatedbQueryTableBadRequest) IsServerError() bool { - return false -} - -// IsCode returns true when this get statedb query table bad request response a status code equal to that given -func (o *GetStatedbQueryTableBadRequest) IsCode(code int) bool { - return code == 400 -} - -// Code gets the status code for the get statedb query table bad request response -func (o *GetStatedbQueryTableBadRequest) Code() int { - return 400 -} - -func (o *GetStatedbQueryTableBadRequest) Error() string { - return fmt.Sprintf("[GET /statedb/query/{table}][%d] getStatedbQueryTableBadRequest %+v", 400, o.Payload) -} - -func (o *GetStatedbQueryTableBadRequest) String() string { - return fmt.Sprintf("[GET /statedb/query/{table}][%d] getStatedbQueryTableBadRequest %+v", 400, o.Payload) -} - -func (o *GetStatedbQueryTableBadRequest) GetPayload() models.Error { - return o.Payload -} - -func (o *GetStatedbQueryTableBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetStatedbQueryTableNotFound creates a GetStatedbQueryTableNotFound with default headers values -func NewGetStatedbQueryTableNotFound() *GetStatedbQueryTableNotFound { - return &GetStatedbQueryTableNotFound{} -} - -/* -GetStatedbQueryTableNotFound describes a response with status code 404, with default header values. - -Table or Index not found -*/ -type GetStatedbQueryTableNotFound struct { -} - -// IsSuccess returns true when this get statedb query table not found response has a 2xx status code -func (o *GetStatedbQueryTableNotFound) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get statedb query table not found response has a 3xx status code -func (o *GetStatedbQueryTableNotFound) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get statedb query table not found response has a 4xx status code -func (o *GetStatedbQueryTableNotFound) IsClientError() bool { - return true -} - -// IsServerError returns true when this get statedb query table not found response has a 5xx status code -func (o *GetStatedbQueryTableNotFound) IsServerError() bool { - return false -} - -// IsCode returns true when this get statedb query table not found response a status code equal to that given -func (o *GetStatedbQueryTableNotFound) IsCode(code int) bool { - return code == 404 -} - -// Code gets the status code for the get statedb query table not found response -func (o *GetStatedbQueryTableNotFound) Code() int { - return 404 -} - -func (o *GetStatedbQueryTableNotFound) Error() string { - return fmt.Sprintf("[GET /statedb/query/{table}][%d] getStatedbQueryTableNotFound ", 404) -} - -func (o *GetStatedbQueryTableNotFound) String() string { - return fmt.Sprintf("[GET /statedb/query/{table}][%d] getStatedbQueryTableNotFound ", 404) -} - -func (o *GetStatedbQueryTableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/client/statedb/statedb_client.go b/vendor/github.com/cilium/cilium/api/v1/client/statedb/statedb_client.go deleted file mode 100644 index 4009fff8e..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/client/statedb/statedb_client.go +++ /dev/null @@ -1,123 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package statedb - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// New creates a new statedb API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { - return &Client{transport: transport, formats: formats} -} - -/* -Client for statedb API -*/ -type Client struct { - transport runtime.ClientTransport - formats strfmt.Registry -} - -// ClientOption is the option for Client methods -type ClientOption func(*runtime.ClientOperation) - -// ClientService is the interface for Client methods -type ClientService interface { - GetStatedbDump(params *GetStatedbDumpParams, writer io.Writer, opts ...ClientOption) (*GetStatedbDumpOK, error) - - GetStatedbQueryTable(params *GetStatedbQueryTableParams, writer io.Writer, opts ...ClientOption) (*GetStatedbQueryTableOK, error) - - SetTransport(transport runtime.ClientTransport) -} - -/* -GetStatedbDump dumps state d b contents -*/ -func (a *Client) GetStatedbDump(params *GetStatedbDumpParams, writer io.Writer, opts ...ClientOption) (*GetStatedbDumpOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetStatedbDumpParams() - } - op := &runtime.ClientOperation{ - ID: "GetStatedbDump", - Method: "GET", - PathPattern: "/statedb/dump", - ProducesMediaTypes: []string{"application/octet-stream"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetStatedbDumpReader{formats: a.formats, writer: writer}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetStatedbDumpOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetStatedbDump: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* -GetStatedbQueryTable performs a query against a state d b table -*/ -func (a *Client) GetStatedbQueryTable(params *GetStatedbQueryTableParams, writer io.Writer, opts ...ClientOption) (*GetStatedbQueryTableOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetStatedbQueryTableParams() - } - op := &runtime.ClientOperation{ - ID: "GetStatedbQueryTable", - Method: "GET", - PathPattern: "/statedb/query/{table}", - ProducesMediaTypes: []string{"application/octet-stream"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetStatedbQueryTableReader{formats: a.formats, writer: writer}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetStatedbQueryTableOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetStatedbQueryTable: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -// SetTransport changes the transport on the client -func (a *Client) SetTransport(transport runtime.ClientTransport) { - a.transport = transport -} diff --git a/vendor/github.com/cilium/cilium/api/v1/flow/README.md b/vendor/github.com/cilium/cilium/api/v1/flow/README.md index ae4bacedd..f3a88b5e6 100644 --- a/vendor/github.com/cilium/cilium/api/v1/flow/README.md +++ b/vendor/github.com/cilium/cilium/api/v1/flow/README.md @@ -179,6 +179,7 @@ DNS flow. This is basically directly mapped from Cilium's [LogRecordDNS](htt | ----- | ---- | ----- | ----------- | | ID | [uint32](#uint32) | | | | identity | [uint32](#uint32) | | | +| cluster_name | [string](#string) | | | | namespace | [string](#string) | | | | labels | [string](#string) | repeated | labels in `foo=bar` format. | | pod_name | [string](#string) | | | @@ -321,6 +322,7 @@ multiple fields are set, then all fields must match for the filter to match. | ----- | ---- | ----- | ----------- | | uuid | [string](#string) | repeated | uuid filters by a list of flow uuids. | | source_ip | [string](#string) | repeated | source_ip filters by a list of source ips. Each of the source ips can be specified as an exact match (e.g. "1.1.1.1") or as a CIDR range (e.g. "1.1.1.0/24"). | +| source_ip_xlated | [string](#string) | repeated | source_ip_xlated filters by a list IPs. Each of the IPs can be specified as an exact match (e.g. "1.1.1.1") or as a CIDR range (e.g. "1.1.1.0/24"). | | source_pod | [string](#string) | repeated | source_pod filters by a list of source pod name prefixes, optionally within a given namespace (e.g. "xwing", "kube-system/coredns-"). The pod name can be omitted to only filter by namespace (e.g. "kube-system/") or the namespace can be omitted to filter for pods in any namespace (e.g. "/xwing") | | source_fqdn | [string](#string) | repeated | source_fqdn filters by a list of source fully qualified domain names | | source_label | [string](#string) | repeated | source_labels filters on a list of source label selectors. Selectors support the full Kubernetes label selector syntax. | @@ -335,6 +337,7 @@ multiple fields are set, then all fields must match for the filter to match. | traffic_direction | [TrafficDirection](#flow-TrafficDirection) | repeated | traffic_direction filters flow by direction of the connection, e.g. ingress or egress. | | verdict | [Verdict](#flow-Verdict) | repeated | only return Flows that were classified with a particular verdict. | | drop_reason_desc | [DropReason](#flow-DropReason) | repeated | only applicable to Verdict = DROPPED (e.g. "POLICY_DENIED", "UNSUPPORTED_L3_PROTOCOL") | +| interface | [NetworkInterface](#flow-NetworkInterface) | repeated | interface is the network interface on which this flow was observed. | | event_type | [EventTypeFilter](#flow-EventTypeFilter) | repeated | event_type is the list of event types to filter on | | http_status_code | [string](#string) | repeated | http_status_code is a list of string prefixes (e.g. "4+", "404", "5+") to filter on the HTTP status code | | protocol | [string](#string) | repeated | protocol filters flows by L4 or L7 protocol, e.g. (e.g. "tcp", "http") | @@ -451,6 +454,7 @@ L7 information for HTTP flows. It corresponds to Cilium's [accesslog.LogReco | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | source | [string](#string) | | | +| source_xlated | [string](#string) | | source_xlated is the post translation source IP when the flow was SNATed (and in that case source is the the original source IP). | | destination | [string](#string) | | | | ipVersion | [IPVersion](#flow-IPVersion) | | | | encrypted | [bool](#bool) | | This field indicates whether the TraceReasonEncryptMask is set or not. https://github.com/cilium/cilium/blob/ba0ed147bd5bb342f67b1794c2ad13c6e99d5236/pkg/monitor/datapath_trace.go#L27 | diff --git a/vendor/github.com/cilium/cilium/api/v1/flow/flow.pb.go b/vendor/github.com/cilium/cilium/api/v1/flow/flow.pb.go index 1b7d13285..4b9ee9719 100644 --- a/vendor/github.com/cilium/cilium/api/v1/flow/flow.pb.go +++ b/vendor/github.com/cilium/cilium/api/v1/flow/flow.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.24.0 +// protoc v5.27.0 // source: flow/flow.proto package flow @@ -550,22 +550,23 @@ const ( DropReason_INVALID_VNI DropReason = 183 DropReason_INVALID_TC_BUFFER DropReason = 184 DropReason_NO_SID DropReason = 185 - DropReason_MISSING_SRV6_STATE DropReason = 186 - DropReason_NAT46 DropReason = 187 - DropReason_NAT64 DropReason = 188 - DropReason_AUTH_REQUIRED DropReason = 189 - DropReason_CT_NO_MAP_FOUND DropReason = 190 - DropReason_SNAT_NO_MAP_FOUND DropReason = 191 - DropReason_INVALID_CLUSTER_ID DropReason = 192 - DropReason_UNSUPPORTED_PROTOCOL_FOR_DSR_ENCAP DropReason = 193 - DropReason_NO_EGRESS_GATEWAY DropReason = 194 - DropReason_UNENCRYPTED_TRAFFIC DropReason = 195 - DropReason_TTL_EXCEEDED DropReason = 196 - DropReason_NO_NODE_ID DropReason = 197 - DropReason_DROP_RATE_LIMITED DropReason = 198 - DropReason_IGMP_HANDLED DropReason = 199 - DropReason_IGMP_SUBSCRIBED DropReason = 200 - DropReason_MULTICAST_HANDLED DropReason = 201 + // Deprecated: Marked as deprecated in flow/flow.proto. + DropReason_MISSING_SRV6_STATE DropReason = 186 + DropReason_NAT46 DropReason = 187 + DropReason_NAT64 DropReason = 188 + DropReason_AUTH_REQUIRED DropReason = 189 + DropReason_CT_NO_MAP_FOUND DropReason = 190 + DropReason_SNAT_NO_MAP_FOUND DropReason = 191 + DropReason_INVALID_CLUSTER_ID DropReason = 192 + DropReason_UNSUPPORTED_PROTOCOL_FOR_DSR_ENCAP DropReason = 193 + DropReason_NO_EGRESS_GATEWAY DropReason = 194 + DropReason_UNENCRYPTED_TRAFFIC DropReason = 195 + DropReason_TTL_EXCEEDED DropReason = 196 + DropReason_NO_NODE_ID DropReason = 197 + DropReason_DROP_RATE_LIMITED DropReason = 198 + DropReason_IGMP_HANDLED DropReason = 199 + DropReason_IGMP_SUBSCRIBED DropReason = 200 + DropReason_MULTICAST_HANDLED DropReason = 201 // A BPF program wants to tail call into bpf_host, but the host datapath // hasn't been loaded yet. DropReason_DROP_HOST_NOT_READY DropReason = 202 @@ -2107,9 +2108,10 @@ type Endpoint struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ID uint32 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - Identity uint32 `protobuf:"varint,2,opt,name=identity,proto3" json:"identity,omitempty"` - Namespace string `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"` + ID uint32 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + Identity uint32 `protobuf:"varint,2,opt,name=identity,proto3" json:"identity,omitempty"` + ClusterName string `protobuf:"bytes,7,opt,name=cluster_name,json=clusterName,proto3" json:"cluster_name,omitempty"` + Namespace string `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"` // labels in `foo=bar` format. Labels []string `protobuf:"bytes,4,rep,name=labels,proto3" json:"labels,omitempty"` PodName string `protobuf:"bytes,5,opt,name=pod_name,json=podName,proto3" json:"pod_name,omitempty"` @@ -2162,6 +2164,13 @@ func (x *Endpoint) GetIdentity() uint32 { return 0 } +func (x *Endpoint) GetClusterName() string { + if x != nil { + return x.ClusterName + } + return "" +} + func (x *Endpoint) GetNamespace() string { if x != nil { return x.Namespace @@ -2313,9 +2322,12 @@ type IP struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Source string `protobuf:"bytes,1,opt,name=source,proto3" json:"source,omitempty"` - Destination string `protobuf:"bytes,2,opt,name=destination,proto3" json:"destination,omitempty"` - IpVersion IPVersion `protobuf:"varint,3,opt,name=ipVersion,proto3,enum=flow.IPVersion" json:"ipVersion,omitempty"` + Source string `protobuf:"bytes,1,opt,name=source,proto3" json:"source,omitempty"` + // source_xlated is the post translation source IP when the flow was SNATed + // (and in that case source is the the original source IP). + SourceXlated string `protobuf:"bytes,5,opt,name=source_xlated,json=sourceXlated,proto3" json:"source_xlated,omitempty"` + Destination string `protobuf:"bytes,2,opt,name=destination,proto3" json:"destination,omitempty"` + IpVersion IPVersion `protobuf:"varint,3,opt,name=ipVersion,proto3,enum=flow.IPVersion" json:"ipVersion,omitempty"` // This field indicates whether the TraceReasonEncryptMask is set or not. // https://github.com/cilium/cilium/blob/ba0ed147bd5bb342f67b1794c2ad13c6e99d5236/pkg/monitor/datapath_trace.go#L27 Encrypted bool `protobuf:"varint,4,opt,name=encrypted,proto3" json:"encrypted,omitempty"` @@ -2360,6 +2372,13 @@ func (x *IP) GetSource() string { return "" } +func (x *IP) GetSourceXlated() string { + if x != nil { + return x.SourceXlated + } + return "" +} + func (x *IP) GetDestination() string { if x != nil { return x.Destination @@ -2983,6 +3002,10 @@ type FlowFilter struct { // specified as an exact match (e.g. "1.1.1.1") or as a CIDR range (e.g. // "1.1.1.0/24"). SourceIp []string `protobuf:"bytes,1,rep,name=source_ip,json=sourceIp,proto3" json:"source_ip,omitempty"` + // source_ip_xlated filters by a list IPs. Each of the IPs can be specified + // as an exact match (e.g. "1.1.1.1") or as a CIDR range (e.g. + // "1.1.1.0/24"). + SourceIpXlated []string `protobuf:"bytes,34,rep,name=source_ip_xlated,json=sourceIpXlated,proto3" json:"source_ip_xlated,omitempty"` // source_pod filters by a list of source pod name prefixes, optionally // within a given namespace (e.g. "xwing", "kube-system/coredns-"). // The pod name can be omitted to only filter by namespace @@ -3019,7 +3042,9 @@ type FlowFilter struct { // only return Flows that were classified with a particular verdict. Verdict []Verdict `protobuf:"varint,5,rep,packed,name=verdict,proto3,enum=flow.Verdict" json:"verdict,omitempty"` // only applicable to Verdict = DROPPED (e.g. "POLICY_DENIED", "UNSUPPORTED_L3_PROTOCOL") - DropReasonDesc []DropReason `protobuf:"varint,35,rep,packed,name=drop_reason_desc,json=dropReasonDesc,proto3,enum=flow.DropReason" json:"drop_reason_desc,omitempty"` + DropReasonDesc []DropReason `protobuf:"varint,33,rep,packed,name=drop_reason_desc,json=dropReasonDesc,proto3,enum=flow.DropReason" json:"drop_reason_desc,omitempty"` + // interface is the network interface on which this flow was observed. + Interface []*NetworkInterface `protobuf:"bytes,35,rep,name=interface,proto3" json:"interface,omitempty"` // event_type is the list of event types to filter on EventType []*EventTypeFilter `protobuf:"bytes,6,rep,name=event_type,json=eventType,proto3" json:"event_type,omitempty"` // http_status_code is a list of string prefixes (e.g. "4+", "404", "5+") @@ -3108,6 +3133,13 @@ func (x *FlowFilter) GetSourceIp() []string { return nil } +func (x *FlowFilter) GetSourceIpXlated() []string { + if x != nil { + return x.SourceIpXlated + } + return nil +} + func (x *FlowFilter) GetSourcePod() []string { if x != nil { return x.SourcePod @@ -3206,6 +3238,13 @@ func (x *FlowFilter) GetDropReasonDesc() []DropReason { return nil } +func (x *FlowFilter) GetInterface() []*NetworkInterface { + if x != nil { + return x.Interface + } + return nil +} + func (x *FlowFilter) GetEventType() []*EventTypeFilter { if x != nil { return x.EventType @@ -4766,7 +4805,7 @@ type FlowFilter_Experimental struct { // Using CEL has performance cost compared to other filters, so prefer // using non-CEL filters when possible, and try to specify CEL filters // last in the list of FlowFilters. - CelExpression []string `protobuf:"bytes,33,rep,name=cel_expression,json=celExpression,proto3" json:"cel_expression,omitempty"` + CelExpression []string `protobuf:"bytes,1,rep,name=cel_expression,json=celExpression,proto3" json:"cel_expression,omitempty"` } func (x *FlowFilter_Experimental) Reset() { @@ -4963,735 +5002,746 @@ var file_flow_flow_proto_rawDesc = []byte{ 0x63, 0x65, 0x50, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x22, 0x28, 0x0a, 0x0b, 0x54, 0x72, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x72, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x65, 0x49, 0x64, 0x22, 0xb5, 0x01, 0x0a, 0x08, 0x45, + 0x09, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x65, 0x49, 0x64, 0x22, 0xd8, 0x01, 0x0a, 0x08, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x74, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, - 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x6f, 0x64, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x6f, 0x64, - 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x09, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, - 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x57, - 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x09, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, - 0x64, 0x73, 0x22, 0x32, 0x0a, 0x08, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x12, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0x77, 0x0a, 0x03, 0x54, 0x43, 0x50, 0x12, 0x1f, 0x0a, - 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x29, - 0x0a, 0x10, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6f, - 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x24, 0x0a, 0x05, 0x66, 0x6c, 0x61, - 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, - 0x54, 0x43, 0x50, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x52, 0x05, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x22, - 0x8b, 0x01, 0x0a, 0x02, 0x49, 0x50, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x20, - 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x2d, 0x0a, 0x09, 0x69, 0x70, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x49, 0x50, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x69, 0x70, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x1c, 0x0a, 0x09, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x09, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x22, 0x44, 0x0a, - 0x08, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, + 0x69, 0x74, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6c, 0x75, 0x73, 0x74, + 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x04, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x19, 0x0a, 0x08, + 0x70, 0x6f, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x70, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x09, 0x77, 0x6f, 0x72, 0x6b, 0x6c, + 0x6f, 0x61, 0x64, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x66, 0x6c, 0x6f, + 0x77, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x09, 0x77, 0x6f, 0x72, 0x6b, + 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x22, 0x32, 0x0a, 0x08, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, + 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0x77, 0x0a, 0x03, 0x54, 0x43, 0x50, + 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x50, 0x6f, 0x72, + 0x74, 0x12, 0x29, 0x0a, 0x10, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x64, 0x65, 0x73, + 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x24, 0x0a, 0x05, + 0x66, 0x6c, 0x61, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x66, 0x6c, + 0x6f, 0x77, 0x2e, 0x54, 0x43, 0x50, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x52, 0x05, 0x66, 0x6c, 0x61, + 0x67, 0x73, 0x22, 0xb0, 0x01, 0x0a, 0x02, 0x49, 0x50, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x22, 0xaa, 0x01, 0x0a, 0x08, 0x54, 0x43, 0x50, 0x46, 0x6c, 0x61, 0x67, 0x73, - 0x12, 0x10, 0x0a, 0x03, 0x46, 0x49, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x46, - 0x49, 0x4e, 0x12, 0x10, 0x0a, 0x03, 0x53, 0x59, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x03, 0x53, 0x59, 0x4e, 0x12, 0x10, 0x0a, 0x03, 0x52, 0x53, 0x54, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x03, 0x52, 0x53, 0x54, 0x12, 0x10, 0x0a, 0x03, 0x50, 0x53, 0x48, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x03, 0x50, 0x53, 0x48, 0x12, 0x10, 0x0a, 0x03, 0x41, 0x43, 0x4b, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x41, 0x43, 0x4b, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x52, - 0x47, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x55, 0x52, 0x47, 0x12, 0x10, 0x0a, 0x03, - 0x45, 0x43, 0x45, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x45, 0x43, 0x45, 0x12, 0x10, - 0x0a, 0x03, 0x43, 0x57, 0x52, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x43, 0x57, 0x52, - 0x12, 0x0e, 0x0a, 0x02, 0x4e, 0x53, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x4e, 0x53, - 0x22, 0x51, 0x0a, 0x03, 0x55, 0x44, 0x50, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x64, 0x65, 0x73, 0x74, - 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x0f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, - 0x6f, 0x72, 0x74, 0x22, 0x52, 0x0a, 0x04, 0x53, 0x43, 0x54, 0x50, 0x12, 0x1f, 0x0a, 0x0b, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x29, 0x0a, 0x10, - 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6f, 0x72, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x72, 0x74, 0x22, 0x30, 0x0a, 0x06, 0x49, 0x43, 0x4d, 0x50, 0x76, - 0x34, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x30, 0x0a, 0x06, 0x49, 0x43, 0x4d, - 0x50, 0x76, 0x36, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x6e, 0x0a, 0x06, 0x50, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, - 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, - 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, - 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, - 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x66, 0x0a, 0x0f, 0x45, - 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x12, + 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x78, 0x6c, 0x61, 0x74, + 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x58, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, + 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x09, 0x69, 0x70, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x66, 0x6c, + 0x6f, 0x77, 0x2e, 0x49, 0x50, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x69, 0x70, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x6e, 0x63, 0x72, 0x79, + 0x70, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x65, 0x6e, 0x63, 0x72, + 0x79, 0x70, 0x74, 0x65, 0x64, 0x22, 0x44, 0x0a, 0x08, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, + 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, + 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xaa, 0x01, 0x0a, 0x08, + 0x54, 0x43, 0x50, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x46, 0x49, 0x4e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x46, 0x49, 0x4e, 0x12, 0x10, 0x0a, 0x03, 0x53, 0x59, + 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x53, 0x59, 0x4e, 0x12, 0x10, 0x0a, 0x03, + 0x52, 0x53, 0x54, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x52, 0x53, 0x54, 0x12, 0x10, + 0x0a, 0x03, 0x50, 0x53, 0x48, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x50, 0x53, 0x48, + 0x12, 0x10, 0x0a, 0x03, 0x41, 0x43, 0x4b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x41, + 0x43, 0x4b, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x52, 0x47, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x03, 0x55, 0x52, 0x47, 0x12, 0x10, 0x0a, 0x03, 0x45, 0x43, 0x45, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x03, 0x45, 0x43, 0x45, 0x12, 0x10, 0x0a, 0x03, 0x43, 0x57, 0x52, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x03, 0x43, 0x57, 0x52, 0x12, 0x0e, 0x0a, 0x02, 0x4e, 0x53, 0x18, 0x09, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x4e, 0x53, 0x22, 0x51, 0x0a, 0x03, 0x55, 0x44, 0x50, 0x12, + 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, + 0x12, 0x29, 0x0a, 0x10, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x64, 0x65, 0x73, 0x74, + 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x72, 0x74, 0x22, 0x52, 0x0a, 0x04, 0x53, + 0x43, 0x54, 0x50, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x70, 0x6f, + 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x50, 0x6f, 0x72, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, + 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x72, 0x74, 0x22, + 0x30, 0x0a, 0x06, 0x49, 0x43, 0x4d, 0x50, 0x76, 0x34, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, + 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x63, 0x6f, 0x64, + 0x65, 0x22, 0x30, 0x0a, 0x06, 0x49, 0x43, 0x4d, 0x50, 0x76, 0x36, 0x12, 0x12, 0x0a, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, + 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x63, + 0x6f, 0x64, 0x65, 0x22, 0x6e, 0x0a, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, + 0x16, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, + 0x69, 0x6f, 0x6e, 0x22, 0x66, 0x0a, 0x0f, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, + 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x6d, 0x61, + 0x74, 0x63, 0x68, 0x5f, 0x73, 0x75, 0x62, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x0c, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x19, 0x0a, 0x08, 0x73, 0x75, 0x62, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x07, 0x73, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, 0x22, 0x40, 0x0a, 0x0f, 0x43, + 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, - 0x70, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x73, 0x75, 0x62, 0x5f, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x6d, 0x61, 0x74, 0x63, - 0x68, 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x75, 0x62, 0x5f, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x75, 0x62, 0x54, - 0x79, 0x70, 0x65, 0x22, 0x40, 0x0a, 0x0f, 0x43, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x45, 0x76, 0x65, - 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x75, - 0x62, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x75, - 0x62, 0x54, 0x79, 0x70, 0x65, 0x22, 0xb9, 0x0b, 0x0a, 0x0a, 0x46, 0x6c, 0x6f, 0x77, 0x46, 0x69, - 0x6c, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x1d, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x5f, 0x69, 0x70, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x49, 0x70, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, - 0x70, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x50, 0x6f, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x66, - 0x71, 0x64, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x46, 0x71, 0x64, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, - 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x10, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x0d, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, - 0x37, 0x0a, 0x0f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, - 0x61, 0x64, 0x18, 0x1a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, - 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x0e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x65, 0x73, 0x74, - 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x70, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x0d, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x70, 0x12, - 0x27, 0x0a, 0x0f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, - 0x6f, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x64, 0x12, 0x29, 0x0a, 0x10, 0x64, 0x65, 0x73, 0x74, - 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x71, 0x64, 0x6e, 0x18, 0x08, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x0f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, - 0x71, 0x64, 0x6e, 0x12, 0x2b, 0x0a, 0x11, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, - 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x61, 0x62, 0x65, 0x6c, - 0x12, 0x2f, 0x0a, 0x13, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x11, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x64, - 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x12, 0x41, 0x0a, 0x14, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x1b, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x0e, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x52, - 0x13, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, - 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x43, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x5f, - 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x1e, 0x20, 0x03, 0x28, 0x0e, 0x32, - 0x16, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x44, 0x69, - 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x10, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, - 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x07, 0x76, 0x65, 0x72, - 0x64, 0x69, 0x63, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x66, 0x6c, 0x6f, - 0x77, 0x2e, 0x56, 0x65, 0x72, 0x64, 0x69, 0x63, 0x74, 0x52, 0x07, 0x76, 0x65, 0x72, 0x64, 0x69, - 0x63, 0x74, 0x12, 0x3a, 0x0a, 0x10, 0x64, 0x72, 0x6f, 0x70, 0x5f, 0x72, 0x65, 0x61, 0x73, 0x6f, - 0x6e, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x18, 0x23, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x66, - 0x6c, 0x6f, 0x77, 0x2e, 0x44, 0x72, 0x6f, 0x70, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x0e, - 0x64, 0x72, 0x6f, 0x70, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x44, 0x65, 0x73, 0x63, 0x12, 0x34, - 0x0a, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, - 0x79, 0x70, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x09, 0x65, 0x76, 0x65, 0x6e, 0x74, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x28, 0x0a, 0x10, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x73, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, - 0x68, 0x74, 0x74, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1a, - 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x64, - 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, - 0x0e, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x18, - 0x0f, 0x20, 0x03, 0x28, 0x08, 0x52, 0x05, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1b, 0x0a, 0x09, - 0x64, 0x6e, 0x73, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x12, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x08, 0x64, 0x6e, 0x73, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x13, 0x20, 0x03, - 0x28, 0x0d, 0x52, 0x0e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x74, 0x79, 0x12, 0x31, 0x0a, 0x14, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0d, - 0x52, 0x13, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x6d, 0x65, - 0x74, 0x68, 0x6f, 0x64, 0x18, 0x15, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x68, 0x74, 0x74, 0x70, - 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x70, - 0x61, 0x74, 0x68, 0x18, 0x16, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x68, 0x74, 0x74, 0x70, 0x50, - 0x61, 0x74, 0x68, 0x12, 0x19, 0x0a, 0x08, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x75, 0x72, 0x6c, 0x18, - 0x1f, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x68, 0x74, 0x74, 0x70, 0x55, 0x72, 0x6c, 0x12, 0x31, - 0x0a, 0x0b, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x20, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x48, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x68, 0x74, 0x74, 0x70, 0x48, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x12, 0x2b, 0x0a, 0x09, 0x74, 0x63, 0x70, 0x5f, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x18, 0x17, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x54, 0x43, 0x50, 0x46, - 0x6c, 0x61, 0x67, 0x73, 0x52, 0x08, 0x74, 0x63, 0x70, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x12, 0x1b, - 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x18, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2e, 0x0a, 0x0a, 0x69, - 0x70, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x19, 0x20, 0x03, 0x28, 0x0e, 0x32, - 0x0f, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x49, 0x50, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x52, 0x09, 0x69, 0x70, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x74, - 0x72, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x1c, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x74, - 0x72, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x42, 0x0a, 0x0c, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, - 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x6c, 0x18, 0xe7, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, - 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x46, 0x6c, 0x6f, 0x77, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x2e, - 0x45, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x6c, 0x52, 0x0c, 0x65, 0x78, - 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x6c, 0x1a, 0x35, 0x0a, 0x0c, 0x45, 0x78, - 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x6c, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x65, - 0x6c, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x21, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x0d, 0x63, 0x65, 0x6c, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x22, 0xce, 0x01, 0x0a, 0x03, 0x44, 0x4e, 0x53, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, - 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, - 0x10, 0x0a, 0x03, 0x69, 0x70, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x69, 0x70, - 0x73, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, - 0x74, 0x74, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x04, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x2d, 0x0a, 0x12, 0x6f, - 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x63, - 0x6f, 0x64, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x72, 0x63, 0x6f, 0x64, 0x65, - 0x12, 0x16, 0x0a, 0x06, 0x71, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x06, 0x71, 0x74, 0x79, 0x70, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x72, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x72, 0x72, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x22, 0x34, 0x0a, 0x0a, 0x48, 0x54, 0x54, 0x50, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, - 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8c, 0x01, 0x0a, 0x04, 0x48, 0x54, 0x54, - 0x50, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x10, 0x0a, - 0x03, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, - 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x2a, 0x0a, 0x07, 0x68, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x66, - 0x6c, 0x6f, 0x77, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x07, - 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x22, 0x9d, 0x01, 0x0a, 0x05, 0x4b, 0x61, 0x66, 0x6b, - 0x61, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, - 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x61, 0x70, 0x69, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x61, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, - 0x72, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x0d, 0x63, 0x6f, 0x72, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, - 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x22, 0x3b, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x22, 0x91, 0x01, 0x0a, 0x09, 0x4c, 0x6f, 0x73, 0x74, 0x45, 0x76, 0x65, - 0x6e, 0x74, 0x12, 0x2d, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x4c, 0x6f, 0x73, 0x74, 0x45, 0x76, - 0x65, 0x6e, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x75, 0x6d, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x5f, - 0x6c, 0x6f, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x6e, 0x75, 0x6d, 0x45, - 0x76, 0x65, 0x6e, 0x74, 0x73, 0x4c, 0x6f, 0x73, 0x74, 0x12, 0x2d, 0x0a, 0x03, 0x63, 0x70, 0x75, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x03, 0x63, 0x70, 0x75, 0x22, 0xf6, 0x04, 0x0a, 0x0a, 0x41, 0x67, 0x65, - 0x6e, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x41, 0x67, 0x65, - 0x6e, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x12, 0x33, 0x0a, 0x07, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x18, 0x64, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x45, - 0x76, 0x65, 0x6e, 0x74, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x48, 0x00, 0x52, 0x07, 0x75, - 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x12, 0x39, 0x0a, 0x0b, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x66, 0x6c, - 0x6f, 0x77, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0a, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x72, - 0x74, 0x12, 0x45, 0x0a, 0x0d, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x75, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x18, 0x66, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, - 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, - 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0c, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x52, 0x0a, 0x13, 0x65, 0x6e, 0x64, 0x70, - 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x18, - 0x67, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x45, 0x6e, 0x64, - 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x12, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, - 0x6e, 0x74, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x12, 0x4b, 0x0a, 0x0f, - 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, - 0x68, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x45, 0x6e, 0x64, - 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0e, 0x65, 0x6e, 0x64, 0x70, 0x6f, - 0x69, 0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x42, 0x0a, 0x0e, 0x69, 0x70, 0x63, - 0x61, 0x63, 0x68, 0x65, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x69, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x49, 0x50, 0x43, 0x61, 0x63, 0x68, 0x65, - 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0d, - 0x69, 0x70, 0x63, 0x61, 0x63, 0x68, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x48, 0x0a, - 0x0e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x75, 0x70, 0x73, 0x65, 0x72, 0x74, 0x18, - 0x6a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x12, 0x48, 0x0a, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x6b, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1f, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x48, 0x00, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x42, 0x0e, 0x0a, 0x0c, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x22, 0x4b, 0x0a, 0x11, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x55, - 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x6e, 0x6f, - 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0c, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x42, - 0x0a, 0x10, 0x54, 0x69, 0x6d, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x04, 0x74, 0x69, - 0x6d, 0x65, 0x22, 0x6d, 0x0a, 0x18, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, - 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, - 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, - 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x75, 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x72, 0x75, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x22, 0x59, 0x0a, 0x19, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x65, 0x67, - 0x65, 0x6e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, - 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, - 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x93, 0x01, 0x0a, - 0x1a, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, - 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6c, - 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x61, 0x62, - 0x65, 0x6c, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x6f, 0x64, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x6f, 0x64, - 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, - 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x22, 0x99, 0x02, 0x0a, 0x13, 0x49, 0x50, 0x43, 0x61, 0x63, 0x68, 0x65, 0x4e, 0x6f, - 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x69, - 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x69, 0x64, 0x72, 0x12, 0x1a, - 0x0a, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x3f, 0x0a, 0x0c, 0x6f, 0x6c, - 0x64, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0b, - 0x6f, 0x6c, 0x64, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x17, 0x0a, 0x07, 0x68, - 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x6f, - 0x73, 0x74, 0x49, 0x70, 0x12, 0x1e, 0x0a, 0x0b, 0x6f, 0x6c, 0x64, 0x5f, 0x68, 0x6f, 0x73, 0x74, - 0x5f, 0x69, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x6c, 0x64, 0x48, 0x6f, - 0x73, 0x74, 0x49, 0x70, 0x12, 0x1f, 0x0a, 0x0b, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x5f, - 0x6b, 0x65, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x65, 0x6e, 0x63, 0x72, 0x79, - 0x70, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x6f, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x43, - 0x0a, 0x1d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4e, - 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, - 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x70, - 0x6f, 0x72, 0x74, 0x22, 0x9a, 0x03, 0x0a, 0x19, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, - 0x70, 0x73, 0x65, 0x72, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, - 0x64, 0x12, 0x4e, 0x0a, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x5f, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x66, 0x6c, - 0x6f, 0x77, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, - 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x72, - 0x52, 0x0f, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x12, 0x50, 0x0a, 0x11, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x5f, 0x61, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x66, - 0x6c, 0x6f, 0x77, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x70, 0x73, 0x65, 0x72, - 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, - 0x72, 0x52, 0x10, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x29, 0x0a, 0x0e, 0x74, 0x72, 0x61, 0x66, 0x66, - 0x69, 0x63, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x02, 0x18, 0x01, 0x52, 0x0d, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x50, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x65, 0x78, 0x74, 0x5f, 0x74, 0x72, 0x61, 0x66, - 0x66, 0x69, 0x63, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x10, 0x65, 0x78, 0x74, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x50, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x12, 0x2c, 0x0a, 0x12, 0x69, 0x6e, 0x74, 0x5f, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69, - 0x63, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, - 0x69, 0x6e, 0x74, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x22, 0x2b, 0x0a, 0x19, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x22, 0x3c, 0x0a, - 0x10, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, - 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xef, 0x02, 0x0a, 0x0a, - 0x44, 0x65, 0x62, 0x75, 0x67, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, - 0x44, 0x65, 0x62, 0x75, 0x67, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x12, 0x26, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x45, 0x6e, 0x64, 0x70, - 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x30, 0x0a, 0x04, - 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, - 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x30, - 0x0a, 0x04, 0x61, 0x72, 0x67, 0x31, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, - 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x04, 0x61, 0x72, 0x67, 0x31, - 0x12, 0x30, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x32, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, + 0x70, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x75, 0x62, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, 0x22, 0x99, 0x0c, + 0x0a, 0x0a, 0x46, 0x6c, 0x6f, 0x77, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, + 0x75, 0x75, 0x69, 0x64, 0x18, 0x1d, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, + 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x70, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x08, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x70, 0x12, 0x28, 0x0a, + 0x10, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x70, 0x5f, 0x78, 0x6c, 0x61, 0x74, 0x65, + 0x64, 0x18, 0x22, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, + 0x70, 0x58, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x5f, 0x70, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x50, 0x6f, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x5f, 0x66, 0x71, 0x64, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x46, 0x71, 0x64, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x10, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x0d, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x37, 0x0a, 0x0f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x77, 0x6f, 0x72, 0x6b, + 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x1a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x66, 0x6c, 0x6f, + 0x77, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x0e, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x65, + 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x70, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x0d, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, + 0x70, 0x12, 0x27, 0x0a, 0x0f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x70, 0x6f, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x64, 0x65, 0x73, 0x74, + 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x64, 0x12, 0x29, 0x0a, 0x10, 0x64, 0x65, + 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x71, 0x64, 0x6e, 0x18, 0x08, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x46, 0x71, 0x64, 0x6e, 0x12, 0x2b, 0x0a, 0x11, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x10, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x61, 0x62, + 0x65, 0x6c, 0x12, 0x2f, 0x0a, 0x13, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x11, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x12, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x12, 0x41, 0x0a, 0x14, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x1b, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x0e, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, + 0x64, 0x52, 0x13, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x57, 0x6f, + 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x43, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69, + 0x63, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x1e, 0x20, 0x03, 0x28, + 0x0e, 0x32, 0x16, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, + 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x10, 0x74, 0x72, 0x61, 0x66, 0x66, + 0x69, 0x63, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x07, 0x76, + 0x65, 0x72, 0x64, 0x69, 0x63, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x66, + 0x6c, 0x6f, 0x77, 0x2e, 0x56, 0x65, 0x72, 0x64, 0x69, 0x63, 0x74, 0x52, 0x07, 0x76, 0x65, 0x72, + 0x64, 0x69, 0x63, 0x74, 0x12, 0x3a, 0x0a, 0x10, 0x64, 0x72, 0x6f, 0x70, 0x5f, 0x72, 0x65, 0x61, + 0x73, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x18, 0x21, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x10, + 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x44, 0x72, 0x6f, 0x70, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, + 0x52, 0x0e, 0x64, 0x72, 0x6f, 0x70, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x44, 0x65, 0x73, 0x63, + 0x12, 0x34, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x18, 0x23, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, + 0x72, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x52, 0x09, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x12, 0x34, 0x0a, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x66, 0x6c, 0x6f, + 0x77, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, + 0x72, 0x52, 0x09, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x28, 0x0a, 0x10, + 0x68, 0x74, 0x74, 0x70, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x63, 0x6f, 0x64, 0x65, + 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x68, 0x74, 0x74, 0x70, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, + 0x6f, 0x6c, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, + 0x6f, 0x6c, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x70, 0x6f, 0x72, + 0x74, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x50, + 0x6f, 0x72, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x64, + 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x14, + 0x0a, 0x05, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x08, 0x52, 0x05, 0x72, + 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x6e, 0x73, 0x5f, 0x71, 0x75, 0x65, 0x72, + 0x79, 0x18, 0x12, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x64, 0x6e, 0x73, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x74, 0x79, 0x18, 0x13, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x0e, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x31, 0x0a, 0x14, 0x64, 0x65, + 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x13, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x1f, 0x0a, + 0x0b, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x15, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x0a, 0x68, 0x74, 0x74, 0x70, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x1b, + 0x0a, 0x09, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x16, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x08, 0x68, 0x74, 0x74, 0x70, 0x50, 0x61, 0x74, 0x68, 0x12, 0x19, 0x0a, 0x08, 0x68, + 0x74, 0x74, 0x70, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x1f, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x68, + 0x74, 0x74, 0x70, 0x55, 0x72, 0x6c, 0x12, 0x31, 0x0a, 0x0b, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x20, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x66, 0x6c, + 0x6f, 0x77, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x68, + 0x74, 0x74, 0x70, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x2b, 0x0a, 0x09, 0x74, 0x63, 0x70, + 0x5f, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x18, 0x17, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x66, + 0x6c, 0x6f, 0x77, 0x2e, 0x54, 0x43, 0x50, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x52, 0x08, 0x74, 0x63, + 0x70, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x18, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x2e, 0x0a, 0x0a, 0x69, 0x70, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x18, 0x19, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x49, + 0x50, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x69, 0x70, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x72, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, + 0x1c, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x42, + 0x0a, 0x0c, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x6c, 0x18, 0xe7, + 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x46, 0x6c, 0x6f, + 0x77, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, + 0x6e, 0x74, 0x61, 0x6c, 0x52, 0x0c, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, + 0x61, 0x6c, 0x1a, 0x35, 0x0a, 0x0c, 0x45, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, + 0x61, 0x6c, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x65, 0x6c, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x65, 0x6c, 0x45, + 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xce, 0x01, 0x0a, 0x03, 0x44, 0x4e, + 0x53, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x70, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x69, 0x70, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x63, + 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6e, 0x61, + 0x6d, 0x65, 0x73, 0x12, 0x2d, 0x0a, 0x12, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x11, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x05, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x71, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x71, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x12, 0x18, 0x0a, 0x07, 0x72, 0x72, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x07, 0x72, 0x72, 0x74, 0x79, 0x70, 0x65, 0x73, 0x22, 0x34, 0x0a, 0x0a, 0x48, 0x54, + 0x54, 0x50, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x22, 0x8c, 0x01, 0x0a, 0x04, 0x48, 0x54, 0x54, 0x50, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, + 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, + 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x6f, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x6f, 0x6c, 0x12, 0x2a, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x05, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x48, 0x54, 0x54, 0x50, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x22, + 0x9d, 0x01, 0x0a, 0x05, 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x72, 0x72, + 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x65, + 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x70, 0x69, 0x5f, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x61, + 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x61, 0x70, 0x69, + 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x70, 0x69, 0x4b, + 0x65, 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x72, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x63, 0x6f, 0x72, 0x72, + 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, + 0x69, 0x63, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x22, + 0x3b, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, + 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, 0x91, 0x01, 0x0a, + 0x09, 0x4c, 0x6f, 0x73, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x2d, 0x0a, 0x06, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x66, 0x6c, 0x6f, + 0x77, 0x2e, 0x4c, 0x6f, 0x73, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x75, 0x6d, + 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x5f, 0x6c, 0x6f, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x0d, 0x6e, 0x75, 0x6d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x4c, 0x6f, 0x73, + 0x74, 0x12, 0x2d, 0x0a, 0x03, 0x63, 0x70, 0x75, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x04, 0x61, 0x72, - 0x67, 0x32, 0x12, 0x30, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x33, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x04, - 0x61, 0x72, 0x67, 0x33, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x2d, - 0x0a, 0x03, 0x63, 0x70, 0x75, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, - 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x03, 0x63, 0x70, 0x75, 0x2a, 0x39, 0x0a, - 0x08, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x55, 0x4e, 0x4b, - 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x4c, - 0x33, 0x5f, 0x4c, 0x34, 0x10, 0x01, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x37, 0x10, 0x02, 0x12, 0x08, - 0x0a, 0x04, 0x53, 0x4f, 0x43, 0x4b, 0x10, 0x03, 0x2a, 0x39, 0x0a, 0x08, 0x41, 0x75, 0x74, 0x68, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x41, 0x42, 0x4c, 0x45, 0x44, - 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x50, 0x49, 0x52, 0x45, 0x10, 0x01, 0x12, 0x14, 0x0a, - 0x10, 0x54, 0x45, 0x53, 0x54, 0x5f, 0x41, 0x4c, 0x57, 0x41, 0x59, 0x53, 0x5f, 0x46, 0x41, 0x49, - 0x4c, 0x10, 0x02, 0x2a, 0xea, 0x01, 0x0a, 0x15, 0x54, 0x72, 0x61, 0x63, 0x65, 0x4f, 0x62, 0x73, - 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x11, 0x0a, - 0x0d, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x50, 0x4f, 0x49, 0x4e, 0x54, 0x10, 0x00, - 0x12, 0x0c, 0x0a, 0x08, 0x54, 0x4f, 0x5f, 0x50, 0x52, 0x4f, 0x58, 0x59, 0x10, 0x01, 0x12, 0x0b, - 0x0a, 0x07, 0x54, 0x4f, 0x5f, 0x48, 0x4f, 0x53, 0x54, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x54, - 0x4f, 0x5f, 0x53, 0x54, 0x41, 0x43, 0x4b, 0x10, 0x03, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x4f, 0x5f, - 0x4f, 0x56, 0x45, 0x52, 0x4c, 0x41, 0x59, 0x10, 0x04, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x4f, 0x5f, - 0x45, 0x4e, 0x44, 0x50, 0x4f, 0x49, 0x4e, 0x54, 0x10, 0x65, 0x12, 0x11, 0x0a, 0x0d, 0x46, 0x52, - 0x4f, 0x4d, 0x5f, 0x45, 0x4e, 0x44, 0x50, 0x4f, 0x49, 0x4e, 0x54, 0x10, 0x05, 0x12, 0x0e, 0x0a, - 0x0a, 0x46, 0x52, 0x4f, 0x4d, 0x5f, 0x50, 0x52, 0x4f, 0x58, 0x59, 0x10, 0x06, 0x12, 0x0d, 0x0a, - 0x09, 0x46, 0x52, 0x4f, 0x4d, 0x5f, 0x48, 0x4f, 0x53, 0x54, 0x10, 0x07, 0x12, 0x0e, 0x0a, 0x0a, - 0x46, 0x52, 0x4f, 0x4d, 0x5f, 0x53, 0x54, 0x41, 0x43, 0x4b, 0x10, 0x08, 0x12, 0x10, 0x0a, 0x0c, - 0x46, 0x52, 0x4f, 0x4d, 0x5f, 0x4f, 0x56, 0x45, 0x52, 0x4c, 0x41, 0x59, 0x10, 0x09, 0x12, 0x10, - 0x0a, 0x0c, 0x46, 0x52, 0x4f, 0x4d, 0x5f, 0x4e, 0x45, 0x54, 0x57, 0x4f, 0x52, 0x4b, 0x10, 0x0a, - 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x4f, 0x5f, 0x4e, 0x45, 0x54, 0x57, 0x4f, 0x52, 0x4b, 0x10, 0x0b, - 0x2a, 0x9c, 0x01, 0x0a, 0x0b, 0x54, 0x72, 0x61, 0x63, 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, - 0x12, 0x18, 0x0a, 0x14, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, - 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x4e, 0x45, - 0x57, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x45, 0x53, 0x54, 0x41, 0x42, 0x4c, 0x49, 0x53, 0x48, - 0x45, 0x44, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x45, 0x50, 0x4c, 0x59, 0x10, 0x03, 0x12, - 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x4c, 0x41, 0x54, 0x45, 0x44, 0x10, 0x04, 0x12, 0x0c, 0x0a, 0x08, - 0x52, 0x45, 0x4f, 0x50, 0x45, 0x4e, 0x45, 0x44, 0x10, 0x05, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x52, - 0x56, 0x36, 0x5f, 0x45, 0x4e, 0x43, 0x41, 0x50, 0x10, 0x06, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x52, - 0x56, 0x36, 0x5f, 0x44, 0x45, 0x43, 0x41, 0x50, 0x10, 0x07, 0x12, 0x13, 0x0a, 0x0f, 0x45, 0x4e, - 0x43, 0x52, 0x59, 0x50, 0x54, 0x5f, 0x4f, 0x56, 0x45, 0x52, 0x4c, 0x41, 0x59, 0x10, 0x08, 0x2a, - 0x48, 0x0a, 0x0a, 0x4c, 0x37, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x79, 0x70, 0x65, 0x12, 0x13, 0x0a, - 0x0f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x4c, 0x37, 0x5f, 0x54, 0x59, 0x50, 0x45, - 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x01, 0x12, - 0x0c, 0x0a, 0x08, 0x52, 0x45, 0x53, 0x50, 0x4f, 0x4e, 0x53, 0x45, 0x10, 0x02, 0x12, 0x0a, 0x0a, - 0x06, 0x53, 0x41, 0x4d, 0x50, 0x4c, 0x45, 0x10, 0x03, 0x2a, 0x30, 0x0a, 0x09, 0x49, 0x50, 0x56, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x50, 0x5f, 0x4e, 0x4f, 0x54, - 0x5f, 0x55, 0x53, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x50, 0x76, 0x34, 0x10, - 0x01, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x50, 0x76, 0x36, 0x10, 0x02, 0x2a, 0x7c, 0x0a, 0x07, 0x56, - 0x65, 0x72, 0x64, 0x69, 0x63, 0x74, 0x12, 0x13, 0x0a, 0x0f, 0x56, 0x45, 0x52, 0x44, 0x49, 0x43, - 0x54, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x46, - 0x4f, 0x52, 0x57, 0x41, 0x52, 0x44, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x52, - 0x4f, 0x50, 0x50, 0x45, 0x44, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, - 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x55, 0x44, 0x49, 0x54, 0x10, 0x04, 0x12, 0x0e, 0x0a, - 0x0a, 0x52, 0x45, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x45, 0x44, 0x10, 0x05, 0x12, 0x0a, 0x0a, - 0x06, 0x54, 0x52, 0x41, 0x43, 0x45, 0x44, 0x10, 0x06, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x52, 0x41, - 0x4e, 0x53, 0x4c, 0x41, 0x54, 0x45, 0x44, 0x10, 0x07, 0x2a, 0x93, 0x11, 0x0a, 0x0a, 0x44, 0x72, - 0x6f, 0x70, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x13, 0x44, 0x52, 0x4f, 0x50, - 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, - 0x00, 0x12, 0x1b, 0x0a, 0x12, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x53, 0x4f, 0x55, - 0x52, 0x43, 0x45, 0x5f, 0x4d, 0x41, 0x43, 0x10, 0x82, 0x01, 0x1a, 0x02, 0x08, 0x01, 0x12, 0x20, - 0x0a, 0x17, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x44, 0x45, 0x53, 0x54, 0x49, 0x4e, - 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x41, 0x43, 0x10, 0x83, 0x01, 0x1a, 0x02, 0x08, 0x01, - 0x12, 0x16, 0x0a, 0x11, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x53, 0x4f, 0x55, 0x52, - 0x43, 0x45, 0x5f, 0x49, 0x50, 0x10, 0x84, 0x01, 0x12, 0x12, 0x0a, 0x0d, 0x50, 0x4f, 0x4c, 0x49, - 0x43, 0x59, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x85, 0x01, 0x12, 0x1b, 0x0a, 0x16, - 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x44, - 0x52, 0x4f, 0x50, 0x50, 0x45, 0x44, 0x10, 0x86, 0x01, 0x12, 0x23, 0x0a, 0x1e, 0x43, 0x54, 0x5f, - 0x54, 0x52, 0x55, 0x4e, 0x43, 0x41, 0x54, 0x45, 0x44, 0x5f, 0x4f, 0x52, 0x5f, 0x49, 0x4e, 0x56, - 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x10, 0x87, 0x01, 0x12, 0x1c, - 0x0a, 0x17, 0x43, 0x54, 0x5f, 0x4d, 0x49, 0x53, 0x53, 0x49, 0x4e, 0x47, 0x5f, 0x54, 0x43, 0x50, - 0x5f, 0x41, 0x43, 0x4b, 0x5f, 0x46, 0x4c, 0x41, 0x47, 0x10, 0x88, 0x01, 0x12, 0x1b, 0x0a, 0x16, - 0x43, 0x54, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x4c, 0x34, 0x5f, 0x50, 0x52, - 0x4f, 0x54, 0x4f, 0x43, 0x4f, 0x4c, 0x10, 0x89, 0x01, 0x12, 0x2b, 0x0a, 0x22, 0x43, 0x54, 0x5f, - 0x43, 0x41, 0x4e, 0x4e, 0x4f, 0x54, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x5f, 0x45, 0x4e, - 0x54, 0x52, 0x59, 0x5f, 0x46, 0x52, 0x4f, 0x4d, 0x5f, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x10, - 0x8a, 0x01, 0x1a, 0x02, 0x08, 0x01, 0x12, 0x1c, 0x0a, 0x17, 0x55, 0x4e, 0x53, 0x55, 0x50, 0x50, - 0x4f, 0x52, 0x54, 0x45, 0x44, 0x5f, 0x4c, 0x33, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x43, 0x4f, - 0x4c, 0x10, 0x8b, 0x01, 0x12, 0x15, 0x0a, 0x10, 0x4d, 0x49, 0x53, 0x53, 0x45, 0x44, 0x5f, 0x54, - 0x41, 0x49, 0x4c, 0x5f, 0x43, 0x41, 0x4c, 0x4c, 0x10, 0x8c, 0x01, 0x12, 0x1c, 0x0a, 0x17, 0x45, - 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x57, 0x52, 0x49, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x54, 0x4f, 0x5f, - 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x10, 0x8d, 0x01, 0x12, 0x18, 0x0a, 0x13, 0x55, 0x4e, 0x4b, - 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x4c, 0x34, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x43, 0x4f, 0x4c, - 0x10, 0x8e, 0x01, 0x12, 0x18, 0x0a, 0x13, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x49, - 0x43, 0x4d, 0x50, 0x56, 0x34, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x10, 0x8f, 0x01, 0x12, 0x18, 0x0a, - 0x13, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x49, 0x43, 0x4d, 0x50, 0x56, 0x34, 0x5f, - 0x54, 0x59, 0x50, 0x45, 0x10, 0x90, 0x01, 0x12, 0x18, 0x0a, 0x13, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, - 0x57, 0x4e, 0x5f, 0x49, 0x43, 0x4d, 0x50, 0x56, 0x36, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x10, 0x91, - 0x01, 0x12, 0x18, 0x0a, 0x13, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x49, 0x43, 0x4d, - 0x50, 0x56, 0x36, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x10, 0x92, 0x01, 0x12, 0x20, 0x0a, 0x1b, 0x45, - 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x52, 0x45, 0x54, 0x52, 0x49, 0x45, 0x56, 0x49, 0x4e, 0x47, 0x5f, - 0x54, 0x55, 0x4e, 0x4e, 0x45, 0x4c, 0x5f, 0x4b, 0x45, 0x59, 0x10, 0x93, 0x01, 0x12, 0x28, 0x0a, - 0x1f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x52, 0x45, 0x54, 0x52, 0x49, 0x45, 0x56, 0x49, 0x4e, - 0x47, 0x5f, 0x54, 0x55, 0x4e, 0x4e, 0x45, 0x4c, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x53, - 0x10, 0x94, 0x01, 0x1a, 0x02, 0x08, 0x01, 0x12, 0x1e, 0x0a, 0x15, 0x49, 0x4e, 0x56, 0x41, 0x4c, - 0x49, 0x44, 0x5f, 0x47, 0x45, 0x4e, 0x45, 0x56, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, - 0x10, 0x95, 0x01, 0x1a, 0x02, 0x08, 0x01, 0x12, 0x1e, 0x0a, 0x19, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, - 0x57, 0x4e, 0x5f, 0x4c, 0x33, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x41, 0x44, 0x44, - 0x52, 0x45, 0x53, 0x53, 0x10, 0x96, 0x01, 0x12, 0x1b, 0x0a, 0x16, 0x53, 0x54, 0x41, 0x4c, 0x45, - 0x5f, 0x4f, 0x52, 0x5f, 0x55, 0x4e, 0x52, 0x4f, 0x55, 0x54, 0x41, 0x42, 0x4c, 0x45, 0x5f, 0x49, - 0x50, 0x10, 0x97, 0x01, 0x12, 0x2a, 0x0a, 0x21, 0x4e, 0x4f, 0x5f, 0x4d, 0x41, 0x54, 0x43, 0x48, - 0x49, 0x4e, 0x47, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, - 0x4e, 0x45, 0x52, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x98, 0x01, 0x1a, 0x02, 0x08, 0x01, - 0x12, 0x27, 0x0a, 0x22, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x57, 0x48, 0x49, 0x4c, 0x45, 0x5f, - 0x43, 0x4f, 0x52, 0x52, 0x45, 0x43, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x4c, 0x33, 0x5f, 0x43, 0x48, - 0x45, 0x43, 0x4b, 0x53, 0x55, 0x4d, 0x10, 0x99, 0x01, 0x12, 0x27, 0x0a, 0x22, 0x45, 0x52, 0x52, - 0x4f, 0x52, 0x5f, 0x57, 0x48, 0x49, 0x4c, 0x45, 0x5f, 0x43, 0x4f, 0x52, 0x52, 0x45, 0x43, 0x54, - 0x49, 0x4e, 0x47, 0x5f, 0x4c, 0x34, 0x5f, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x53, 0x55, 0x4d, 0x10, - 0x9a, 0x01, 0x12, 0x1c, 0x0a, 0x17, 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x50, 0x5f, 0x49, 0x4e, 0x53, - 0x45, 0x52, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x9b, 0x01, - 0x12, 0x22, 0x0a, 0x1d, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x49, 0x50, 0x56, 0x36, - 0x5f, 0x45, 0x58, 0x54, 0x45, 0x4e, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x45, - 0x52, 0x10, 0x9c, 0x01, 0x12, 0x23, 0x0a, 0x1e, 0x49, 0x50, 0x5f, 0x46, 0x52, 0x41, 0x47, 0x4d, - 0x45, 0x4e, 0x54, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x53, 0x55, 0x50, - 0x50, 0x4f, 0x52, 0x54, 0x45, 0x44, 0x10, 0x9d, 0x01, 0x12, 0x1e, 0x0a, 0x19, 0x53, 0x45, 0x52, - 0x56, 0x49, 0x43, 0x45, 0x5f, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x4e, 0x4f, 0x54, - 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x9e, 0x01, 0x12, 0x28, 0x0a, 0x23, 0x4e, 0x4f, 0x5f, - 0x54, 0x55, 0x4e, 0x4e, 0x45, 0x4c, 0x5f, 0x4f, 0x52, 0x5f, 0x45, 0x4e, 0x43, 0x41, 0x50, 0x53, - 0x55, 0x4c, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x45, 0x4e, 0x44, 0x50, 0x4f, 0x49, 0x4e, 0x54, - 0x10, 0xa0, 0x01, 0x12, 0x23, 0x0a, 0x1e, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x5f, 0x54, 0x4f, - 0x5f, 0x49, 0x4e, 0x53, 0x45, 0x52, 0x54, 0x5f, 0x49, 0x4e, 0x54, 0x4f, 0x5f, 0x50, 0x52, 0x4f, - 0x58, 0x59, 0x4d, 0x41, 0x50, 0x10, 0xa1, 0x01, 0x12, 0x2b, 0x0a, 0x26, 0x52, 0x45, 0x41, 0x43, - 0x48, 0x45, 0x44, 0x5f, 0x45, 0x44, 0x54, 0x5f, 0x52, 0x41, 0x54, 0x45, 0x5f, 0x4c, 0x49, 0x4d, - 0x49, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x44, 0x52, 0x4f, 0x50, 0x5f, 0x48, 0x4f, 0x52, 0x49, 0x5a, - 0x4f, 0x4e, 0x10, 0xa2, 0x01, 0x12, 0x26, 0x0a, 0x21, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, - 0x5f, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x52, 0x41, 0x43, - 0x4b, 0x49, 0x4e, 0x47, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x10, 0xa3, 0x01, 0x12, 0x1e, 0x0a, - 0x19, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x5f, 0x48, 0x4f, 0x53, 0x54, 0x5f, 0x49, 0x53, 0x5f, 0x55, - 0x4e, 0x52, 0x45, 0x41, 0x43, 0x48, 0x41, 0x42, 0x4c, 0x45, 0x10, 0xa4, 0x01, 0x12, 0x3a, 0x0a, - 0x35, 0x4e, 0x4f, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x55, 0x52, 0x41, 0x54, 0x49, 0x4f, - 0x4e, 0x5f, 0x41, 0x56, 0x41, 0x49, 0x4c, 0x41, 0x42, 0x4c, 0x45, 0x5f, 0x54, 0x4f, 0x5f, 0x50, - 0x45, 0x52, 0x46, 0x4f, 0x52, 0x4d, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x44, 0x45, - 0x43, 0x49, 0x53, 0x49, 0x4f, 0x4e, 0x10, 0xa5, 0x01, 0x12, 0x1c, 0x0a, 0x17, 0x55, 0x4e, 0x53, - 0x55, 0x50, 0x50, 0x4f, 0x52, 0x54, 0x45, 0x44, 0x5f, 0x4c, 0x32, 0x5f, 0x50, 0x52, 0x4f, 0x54, - 0x4f, 0x43, 0x4f, 0x4c, 0x10, 0xa6, 0x01, 0x12, 0x22, 0x0a, 0x1d, 0x4e, 0x4f, 0x5f, 0x4d, 0x41, - 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x46, 0x4f, 0x52, 0x5f, 0x4e, 0x41, 0x54, 0x5f, 0x4d, 0x41, - 0x53, 0x51, 0x55, 0x45, 0x52, 0x41, 0x44, 0x45, 0x10, 0xa7, 0x01, 0x12, 0x2c, 0x0a, 0x27, 0x55, - 0x4e, 0x53, 0x55, 0x50, 0x50, 0x4f, 0x52, 0x54, 0x45, 0x44, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, - 0x43, 0x4f, 0x4c, 0x5f, 0x46, 0x4f, 0x52, 0x5f, 0x4e, 0x41, 0x54, 0x5f, 0x4d, 0x41, 0x53, 0x51, - 0x55, 0x45, 0x52, 0x41, 0x44, 0x45, 0x10, 0xa8, 0x01, 0x12, 0x16, 0x0a, 0x11, 0x46, 0x49, 0x42, - 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0xa9, - 0x01, 0x12, 0x28, 0x0a, 0x23, 0x45, 0x4e, 0x43, 0x41, 0x50, 0x53, 0x55, 0x4c, 0x41, 0x54, 0x49, - 0x4f, 0x4e, 0x5f, 0x54, 0x52, 0x41, 0x46, 0x46, 0x49, 0x43, 0x5f, 0x49, 0x53, 0x5f, 0x50, 0x52, - 0x4f, 0x48, 0x49, 0x42, 0x49, 0x54, 0x45, 0x44, 0x10, 0xaa, 0x01, 0x12, 0x15, 0x0a, 0x10, 0x49, - 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x49, 0x54, 0x59, 0x10, - 0xab, 0x01, 0x12, 0x13, 0x0a, 0x0e, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x53, 0x45, - 0x4e, 0x44, 0x45, 0x52, 0x10, 0xac, 0x01, 0x12, 0x13, 0x0a, 0x0e, 0x4e, 0x41, 0x54, 0x5f, 0x4e, - 0x4f, 0x54, 0x5f, 0x4e, 0x45, 0x45, 0x44, 0x45, 0x44, 0x10, 0xad, 0x01, 0x12, 0x13, 0x0a, 0x0e, - 0x49, 0x53, 0x5f, 0x41, 0x5f, 0x43, 0x4c, 0x55, 0x53, 0x54, 0x45, 0x52, 0x49, 0x50, 0x10, 0xae, - 0x01, 0x12, 0x2e, 0x0a, 0x29, 0x46, 0x49, 0x52, 0x53, 0x54, 0x5f, 0x4c, 0x4f, 0x47, 0x49, 0x43, - 0x41, 0x4c, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x47, 0x52, 0x41, 0x4d, 0x5f, 0x46, 0x52, 0x41, 0x47, - 0x4d, 0x45, 0x4e, 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0xaf, - 0x01, 0x12, 0x1d, 0x0a, 0x18, 0x46, 0x4f, 0x52, 0x42, 0x49, 0x44, 0x44, 0x45, 0x4e, 0x5f, 0x49, - 0x43, 0x4d, 0x50, 0x56, 0x36, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0xb0, 0x01, - 0x12, 0x21, 0x0a, 0x1c, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x5f, 0x42, 0x59, 0x5f, 0x4c, 0x42, - 0x5f, 0x53, 0x52, 0x43, 0x5f, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x5f, 0x43, 0x48, 0x45, 0x43, 0x4b, - 0x10, 0xb1, 0x01, 0x12, 0x19, 0x0a, 0x14, 0x53, 0x4f, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4c, 0x4f, - 0x4f, 0x4b, 0x55, 0x50, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0xb2, 0x01, 0x12, 0x19, - 0x0a, 0x14, 0x53, 0x4f, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x41, 0x53, 0x53, 0x49, 0x47, 0x4e, 0x5f, - 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0xb3, 0x01, 0x12, 0x31, 0x0a, 0x2c, 0x50, 0x52, 0x4f, - 0x58, 0x59, 0x5f, 0x52, 0x45, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4e, - 0x4f, 0x54, 0x5f, 0x53, 0x55, 0x50, 0x50, 0x4f, 0x52, 0x54, 0x45, 0x44, 0x5f, 0x46, 0x4f, 0x52, - 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x43, 0x4f, 0x4c, 0x10, 0xb4, 0x01, 0x12, 0x10, 0x0a, 0x0b, - 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x44, 0x45, 0x4e, 0x59, 0x10, 0xb5, 0x01, 0x12, 0x12, - 0x0a, 0x0d, 0x56, 0x4c, 0x41, 0x4e, 0x5f, 0x46, 0x49, 0x4c, 0x54, 0x45, 0x52, 0x45, 0x44, 0x10, - 0xb6, 0x01, 0x12, 0x10, 0x0a, 0x0b, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x56, 0x4e, - 0x49, 0x10, 0xb7, 0x01, 0x12, 0x16, 0x0a, 0x11, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, - 0x54, 0x43, 0x5f, 0x42, 0x55, 0x46, 0x46, 0x45, 0x52, 0x10, 0xb8, 0x01, 0x12, 0x0b, 0x0a, 0x06, - 0x4e, 0x4f, 0x5f, 0x53, 0x49, 0x44, 0x10, 0xb9, 0x01, 0x12, 0x17, 0x0a, 0x12, 0x4d, 0x49, 0x53, - 0x53, 0x49, 0x4e, 0x47, 0x5f, 0x53, 0x52, 0x56, 0x36, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x10, - 0xba, 0x01, 0x12, 0x0a, 0x0a, 0x05, 0x4e, 0x41, 0x54, 0x34, 0x36, 0x10, 0xbb, 0x01, 0x12, 0x0a, - 0x0a, 0x05, 0x4e, 0x41, 0x54, 0x36, 0x34, 0x10, 0xbc, 0x01, 0x12, 0x12, 0x0a, 0x0d, 0x41, 0x55, - 0x54, 0x48, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x49, 0x52, 0x45, 0x44, 0x10, 0xbd, 0x01, 0x12, 0x14, - 0x0a, 0x0f, 0x43, 0x54, 0x5f, 0x4e, 0x4f, 0x5f, 0x4d, 0x41, 0x50, 0x5f, 0x46, 0x4f, 0x55, 0x4e, - 0x44, 0x10, 0xbe, 0x01, 0x12, 0x16, 0x0a, 0x11, 0x53, 0x4e, 0x41, 0x54, 0x5f, 0x4e, 0x4f, 0x5f, - 0x4d, 0x41, 0x50, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0xbf, 0x01, 0x12, 0x17, 0x0a, 0x12, - 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x43, 0x4c, 0x55, 0x53, 0x54, 0x45, 0x52, 0x5f, - 0x49, 0x44, 0x10, 0xc0, 0x01, 0x12, 0x27, 0x0a, 0x22, 0x55, 0x4e, 0x53, 0x55, 0x50, 0x50, 0x4f, - 0x52, 0x54, 0x45, 0x44, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x43, 0x4f, 0x4c, 0x5f, 0x46, 0x4f, - 0x52, 0x5f, 0x44, 0x53, 0x52, 0x5f, 0x45, 0x4e, 0x43, 0x41, 0x50, 0x10, 0xc1, 0x01, 0x12, 0x16, - 0x0a, 0x11, 0x4e, 0x4f, 0x5f, 0x45, 0x47, 0x52, 0x45, 0x53, 0x53, 0x5f, 0x47, 0x41, 0x54, 0x45, - 0x57, 0x41, 0x59, 0x10, 0xc2, 0x01, 0x12, 0x18, 0x0a, 0x13, 0x55, 0x4e, 0x45, 0x4e, 0x43, 0x52, - 0x59, 0x50, 0x54, 0x45, 0x44, 0x5f, 0x54, 0x52, 0x41, 0x46, 0x46, 0x49, 0x43, 0x10, 0xc3, 0x01, - 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x54, 0x4c, 0x5f, 0x45, 0x58, 0x43, 0x45, 0x45, 0x44, 0x45, 0x44, - 0x10, 0xc4, 0x01, 0x12, 0x0f, 0x0a, 0x0a, 0x4e, 0x4f, 0x5f, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x49, - 0x44, 0x10, 0xc5, 0x01, 0x12, 0x16, 0x0a, 0x11, 0x44, 0x52, 0x4f, 0x50, 0x5f, 0x52, 0x41, 0x54, - 0x45, 0x5f, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x10, 0xc6, 0x01, 0x12, 0x11, 0x0a, 0x0c, - 0x49, 0x47, 0x4d, 0x50, 0x5f, 0x48, 0x41, 0x4e, 0x44, 0x4c, 0x45, 0x44, 0x10, 0xc7, 0x01, 0x12, - 0x14, 0x0a, 0x0f, 0x49, 0x47, 0x4d, 0x50, 0x5f, 0x53, 0x55, 0x42, 0x53, 0x43, 0x52, 0x49, 0x42, - 0x45, 0x44, 0x10, 0xc8, 0x01, 0x12, 0x16, 0x0a, 0x11, 0x4d, 0x55, 0x4c, 0x54, 0x49, 0x43, 0x41, - 0x53, 0x54, 0x5f, 0x48, 0x41, 0x4e, 0x44, 0x4c, 0x45, 0x44, 0x10, 0xc9, 0x01, 0x12, 0x18, 0x0a, - 0x13, 0x44, 0x52, 0x4f, 0x50, 0x5f, 0x48, 0x4f, 0x53, 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x52, - 0x45, 0x41, 0x44, 0x59, 0x10, 0xca, 0x01, 0x12, 0x16, 0x0a, 0x11, 0x44, 0x52, 0x4f, 0x50, 0x5f, - 0x45, 0x50, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x52, 0x45, 0x41, 0x44, 0x59, 0x10, 0xcb, 0x01, 0x2a, - 0x4a, 0x0a, 0x10, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x19, 0x54, 0x52, 0x41, 0x46, 0x46, 0x49, 0x43, 0x5f, 0x44, - 0x49, 0x52, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, - 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x47, 0x52, 0x45, 0x53, 0x53, 0x10, 0x01, 0x12, - 0x0a, 0x0a, 0x06, 0x45, 0x47, 0x52, 0x45, 0x53, 0x53, 0x10, 0x02, 0x2a, 0x8d, 0x02, 0x0a, 0x11, - 0x44, 0x65, 0x62, 0x75, 0x67, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x50, 0x6f, 0x69, 0x6e, - 0x74, 0x12, 0x1d, 0x0a, 0x19, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x41, 0x50, 0x54, 0x55, 0x52, 0x45, - 0x5f, 0x50, 0x4f, 0x49, 0x4e, 0x54, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, - 0x12, 0x18, 0x0a, 0x14, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x41, 0x50, 0x54, 0x55, 0x52, 0x45, 0x5f, - 0x44, 0x45, 0x4c, 0x49, 0x56, 0x45, 0x52, 0x59, 0x10, 0x04, 0x12, 0x17, 0x0a, 0x13, 0x44, 0x42, - 0x47, 0x5f, 0x43, 0x41, 0x50, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x46, 0x52, 0x4f, 0x4d, 0x5f, 0x4c, - 0x42, 0x10, 0x05, 0x12, 0x19, 0x0a, 0x15, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x41, 0x50, 0x54, 0x55, - 0x52, 0x45, 0x5f, 0x41, 0x46, 0x54, 0x45, 0x52, 0x5f, 0x56, 0x34, 0x36, 0x10, 0x06, 0x12, 0x19, - 0x0a, 0x15, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x41, 0x50, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x41, 0x46, - 0x54, 0x45, 0x52, 0x5f, 0x56, 0x36, 0x34, 0x10, 0x07, 0x12, 0x19, 0x0a, 0x15, 0x44, 0x42, 0x47, - 0x5f, 0x43, 0x41, 0x50, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x50, 0x52, 0x4f, 0x58, 0x59, 0x5f, 0x50, - 0x52, 0x45, 0x10, 0x08, 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x41, 0x50, 0x54, - 0x55, 0x52, 0x45, 0x5f, 0x50, 0x52, 0x4f, 0x58, 0x59, 0x5f, 0x50, 0x4f, 0x53, 0x54, 0x10, 0x09, - 0x12, 0x18, 0x0a, 0x14, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x41, 0x50, 0x54, 0x55, 0x52, 0x45, 0x5f, - 0x53, 0x4e, 0x41, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x10, 0x0a, 0x12, 0x19, 0x0a, 0x15, 0x44, 0x42, - 0x47, 0x5f, 0x43, 0x41, 0x50, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x53, 0x4e, 0x41, 0x54, 0x5f, 0x50, - 0x4f, 0x53, 0x54, 0x10, 0x0b, 0x22, 0x04, 0x08, 0x01, 0x10, 0x03, 0x2a, 0x39, 0x0a, 0x09, 0x45, - 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, - 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x61, - 0x6d, 0x70, 0x6c, 0x65, 0x10, 0x09, 0x12, 0x0e, 0x0a, 0x0a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, - 0x4c, 0x6f, 0x73, 0x74, 0x10, 0x02, 0x2a, 0x7f, 0x0a, 0x0f, 0x4c, 0x6f, 0x73, 0x74, 0x45, 0x76, - 0x65, 0x6e, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x55, 0x4e, 0x4b, - 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x4c, 0x4f, 0x53, 0x54, 0x5f, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, - 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x50, 0x45, 0x52, 0x46, - 0x5f, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x42, 0x55, 0x46, 0x46, - 0x45, 0x52, 0x10, 0x01, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x42, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, - 0x5f, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x53, 0x5f, 0x51, 0x55, 0x45, 0x55, 0x45, 0x10, 0x02, 0x12, - 0x16, 0x0a, 0x12, 0x48, 0x55, 0x42, 0x42, 0x4c, 0x45, 0x5f, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x42, - 0x55, 0x46, 0x46, 0x45, 0x52, 0x10, 0x03, 0x2a, 0xae, 0x02, 0x0a, 0x0e, 0x41, 0x67, 0x65, 0x6e, - 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x13, 0x41, 0x47, - 0x45, 0x4e, 0x54, 0x5f, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, - 0x4e, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x41, 0x47, 0x45, 0x4e, 0x54, 0x5f, 0x53, 0x54, 0x41, - 0x52, 0x54, 0x45, 0x44, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, - 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x44, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x50, 0x4f, - 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x44, 0x10, 0x04, 0x12, 0x1f, - 0x0a, 0x1b, 0x45, 0x4e, 0x44, 0x50, 0x4f, 0x49, 0x4e, 0x54, 0x5f, 0x52, 0x45, 0x47, 0x45, 0x4e, - 0x45, 0x52, 0x41, 0x54, 0x45, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x05, 0x12, - 0x1f, 0x0a, 0x1b, 0x45, 0x4e, 0x44, 0x50, 0x4f, 0x49, 0x4e, 0x54, 0x5f, 0x52, 0x45, 0x47, 0x45, - 0x4e, 0x45, 0x52, 0x41, 0x54, 0x45, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x10, 0x06, - 0x12, 0x14, 0x0a, 0x10, 0x45, 0x4e, 0x44, 0x50, 0x4f, 0x49, 0x4e, 0x54, 0x5f, 0x43, 0x52, 0x45, - 0x41, 0x54, 0x45, 0x44, 0x10, 0x07, 0x12, 0x14, 0x0a, 0x10, 0x45, 0x4e, 0x44, 0x50, 0x4f, 0x49, - 0x4e, 0x54, 0x5f, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x44, 0x10, 0x08, 0x12, 0x14, 0x0a, 0x10, - 0x49, 0x50, 0x43, 0x41, 0x43, 0x48, 0x45, 0x5f, 0x55, 0x50, 0x53, 0x45, 0x52, 0x54, 0x45, 0x44, - 0x10, 0x09, 0x12, 0x13, 0x0a, 0x0f, 0x49, 0x50, 0x43, 0x41, 0x43, 0x48, 0x45, 0x5f, 0x44, 0x45, - 0x4c, 0x45, 0x54, 0x45, 0x44, 0x10, 0x0a, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x45, 0x52, 0x56, 0x49, - 0x43, 0x45, 0x5f, 0x55, 0x50, 0x53, 0x45, 0x52, 0x54, 0x45, 0x44, 0x10, 0x0b, 0x12, 0x13, 0x0a, - 0x0f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x5f, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x44, - 0x10, 0x0c, 0x22, 0x04, 0x08, 0x01, 0x10, 0x01, 0x2a, 0xd8, 0x01, 0x0a, 0x16, 0x53, 0x6f, 0x63, - 0x6b, 0x65, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, - 0x69, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x18, 0x53, 0x4f, 0x43, 0x4b, 0x5f, 0x58, 0x4c, 0x41, 0x54, - 0x45, 0x5f, 0x50, 0x4f, 0x49, 0x4e, 0x54, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, - 0x00, 0x12, 0x26, 0x0a, 0x22, 0x53, 0x4f, 0x43, 0x4b, 0x5f, 0x58, 0x4c, 0x41, 0x54, 0x45, 0x5f, - 0x50, 0x4f, 0x49, 0x4e, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x5f, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, - 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x57, 0x44, 0x10, 0x01, 0x12, 0x27, 0x0a, 0x23, 0x53, 0x4f, 0x43, - 0x4b, 0x5f, 0x58, 0x4c, 0x41, 0x54, 0x45, 0x5f, 0x50, 0x4f, 0x49, 0x4e, 0x54, 0x5f, 0x50, 0x4f, - 0x53, 0x54, 0x5f, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x57, 0x44, - 0x10, 0x02, 0x12, 0x26, 0x0a, 0x22, 0x53, 0x4f, 0x43, 0x4b, 0x5f, 0x58, 0x4c, 0x41, 0x54, 0x45, - 0x5f, 0x50, 0x4f, 0x49, 0x4e, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x5f, 0x44, 0x49, 0x52, 0x45, 0x43, - 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x45, 0x56, 0x10, 0x03, 0x12, 0x27, 0x0a, 0x23, 0x53, 0x4f, - 0x43, 0x4b, 0x5f, 0x58, 0x4c, 0x41, 0x54, 0x45, 0x5f, 0x50, 0x4f, 0x49, 0x4e, 0x54, 0x5f, 0x50, - 0x4f, 0x53, 0x54, 0x5f, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x45, - 0x56, 0x10, 0x04, 0x2a, 0x81, 0x0d, 0x0a, 0x0e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x45, 0x76, 0x65, - 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x44, 0x42, 0x47, 0x5f, 0x45, 0x56, - 0x45, 0x4e, 0x54, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0f, 0x0a, - 0x0b, 0x44, 0x42, 0x47, 0x5f, 0x47, 0x45, 0x4e, 0x45, 0x52, 0x49, 0x43, 0x10, 0x01, 0x12, 0x16, - 0x0a, 0x12, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x5f, 0x44, 0x45, 0x4c, 0x49, - 0x56, 0x45, 0x52, 0x59, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x42, 0x47, 0x5f, 0x45, 0x4e, - 0x43, 0x41, 0x50, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x58, 0x43, - 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x44, 0x42, 0x47, 0x5f, - 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x05, 0x12, - 0x11, 0x0a, 0x0d, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x54, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, - 0x10, 0x06, 0x12, 0x15, 0x0a, 0x11, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x54, 0x5f, 0x4c, 0x4f, 0x4f, - 0x4b, 0x55, 0x50, 0x5f, 0x52, 0x45, 0x56, 0x10, 0x07, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x42, 0x47, - 0x5f, 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x10, 0x08, 0x12, 0x12, 0x0a, 0x0e, 0x44, - 0x42, 0x47, 0x5f, 0x43, 0x54, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x44, 0x10, 0x09, 0x12, - 0x13, 0x0a, 0x0f, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x54, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, - 0x44, 0x32, 0x10, 0x0a, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x42, 0x47, 0x5f, 0x49, 0x43, 0x4d, 0x50, - 0x36, 0x5f, 0x48, 0x41, 0x4e, 0x44, 0x4c, 0x45, 0x10, 0x0b, 0x12, 0x15, 0x0a, 0x11, 0x44, 0x42, - 0x47, 0x5f, 0x49, 0x43, 0x4d, 0x50, 0x36, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, - 0x0c, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x42, 0x47, 0x5f, 0x49, 0x43, 0x4d, 0x50, 0x36, 0x5f, 0x4e, - 0x53, 0x10, 0x0d, 0x12, 0x1b, 0x0a, 0x17, 0x44, 0x42, 0x47, 0x5f, 0x49, 0x43, 0x4d, 0x50, 0x36, - 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x5f, 0x45, 0x58, 0x43, 0x45, 0x45, 0x44, 0x45, 0x44, 0x10, 0x0e, - 0x12, 0x12, 0x0a, 0x0e, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x54, 0x5f, 0x56, 0x45, 0x52, 0x44, 0x49, - 0x43, 0x54, 0x10, 0x0f, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x42, 0x47, 0x5f, 0x44, 0x45, 0x43, 0x41, - 0x50, 0x10, 0x10, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x42, 0x47, 0x5f, 0x50, 0x4f, 0x52, 0x54, 0x5f, - 0x4d, 0x41, 0x50, 0x10, 0x11, 0x12, 0x11, 0x0a, 0x0d, 0x44, 0x42, 0x47, 0x5f, 0x45, 0x52, 0x52, - 0x4f, 0x52, 0x5f, 0x52, 0x45, 0x54, 0x10, 0x12, 0x12, 0x0f, 0x0a, 0x0b, 0x44, 0x42, 0x47, 0x5f, - 0x54, 0x4f, 0x5f, 0x48, 0x4f, 0x53, 0x54, 0x10, 0x13, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x42, 0x47, - 0x5f, 0x54, 0x4f, 0x5f, 0x53, 0x54, 0x41, 0x43, 0x4b, 0x10, 0x14, 0x12, 0x10, 0x0a, 0x0c, 0x44, - 0x42, 0x47, 0x5f, 0x50, 0x4b, 0x54, 0x5f, 0x48, 0x41, 0x53, 0x48, 0x10, 0x15, 0x12, 0x1b, 0x0a, - 0x17, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, 0x36, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x5f, - 0x46, 0x52, 0x4f, 0x4e, 0x54, 0x45, 0x4e, 0x44, 0x10, 0x16, 0x12, 0x20, 0x0a, 0x1c, 0x44, 0x42, - 0x47, 0x5f, 0x4c, 0x42, 0x36, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x5f, 0x46, 0x52, 0x4f, - 0x4e, 0x54, 0x45, 0x4e, 0x44, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x10, 0x17, 0x12, 0x1f, 0x0a, 0x1b, - 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, 0x36, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x5f, 0x42, - 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x53, 0x4c, 0x4f, 0x54, 0x10, 0x18, 0x12, 0x27, 0x0a, - 0x23, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, 0x36, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x5f, - 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x53, 0x4c, 0x4f, 0x54, 0x5f, 0x53, 0x55, 0x43, - 0x43, 0x45, 0x53, 0x53, 0x10, 0x19, 0x12, 0x27, 0x0a, 0x23, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, - 0x36, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x5f, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, - 0x5f, 0x53, 0x4c, 0x4f, 0x54, 0x5f, 0x56, 0x32, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x10, 0x1a, 0x12, - 0x1f, 0x0a, 0x1b, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, 0x36, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, - 0x50, 0x5f, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x10, 0x1b, - 0x12, 0x1e, 0x0a, 0x1a, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, 0x36, 0x5f, 0x52, 0x45, 0x56, 0x45, - 0x52, 0x53, 0x45, 0x5f, 0x4e, 0x41, 0x54, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x10, 0x1c, - 0x12, 0x17, 0x0a, 0x13, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, 0x36, 0x5f, 0x52, 0x45, 0x56, 0x45, - 0x52, 0x53, 0x45, 0x5f, 0x4e, 0x41, 0x54, 0x10, 0x1d, 0x12, 0x1b, 0x0a, 0x17, 0x44, 0x42, 0x47, - 0x5f, 0x4c, 0x42, 0x34, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x5f, 0x46, 0x52, 0x4f, 0x4e, - 0x54, 0x45, 0x4e, 0x44, 0x10, 0x1e, 0x12, 0x20, 0x0a, 0x1c, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, - 0x34, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x5f, 0x46, 0x52, 0x4f, 0x4e, 0x54, 0x45, 0x4e, - 0x44, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x10, 0x1f, 0x12, 0x1f, 0x0a, 0x1b, 0x44, 0x42, 0x47, 0x5f, - 0x4c, 0x42, 0x34, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x5f, 0x42, 0x41, 0x43, 0x4b, 0x45, - 0x4e, 0x44, 0x5f, 0x53, 0x4c, 0x4f, 0x54, 0x10, 0x20, 0x12, 0x27, 0x0a, 0x23, 0x44, 0x42, 0x47, - 0x5f, 0x4c, 0x42, 0x34, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x5f, 0x42, 0x41, 0x43, 0x4b, + 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x03, 0x63, 0x70, 0x75, + 0x22, 0xf6, 0x04, 0x0a, 0x0a, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, + 0x28, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, + 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, + 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x33, 0x0a, 0x07, 0x75, 0x6e, 0x6b, + 0x6e, 0x6f, 0x77, 0x6e, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x66, 0x6c, 0x6f, + 0x77, 0x2e, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x55, 0x6e, 0x6b, 0x6e, + 0x6f, 0x77, 0x6e, 0x48, 0x00, 0x52, 0x07, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x12, 0x39, + 0x0a, 0x0b, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x65, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x4e, + 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0a, 0x61, + 0x67, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x45, 0x0a, 0x0d, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x66, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1e, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x48, 0x00, 0x52, 0x0c, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x12, 0x52, 0x0a, 0x13, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x72, 0x65, 0x67, + 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x18, 0x67, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, + 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x65, 0x67, + 0x65, 0x6e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, + 0x52, 0x12, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x74, 0x65, 0x12, 0x4b, 0x0a, 0x0f, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, + 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x68, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, + 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, + 0x00, 0x52, 0x0e, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x12, 0x42, 0x0a, 0x0e, 0x69, 0x70, 0x63, 0x61, 0x63, 0x68, 0x65, 0x5f, 0x75, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x18, 0x69, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x66, 0x6c, 0x6f, 0x77, + 0x2e, 0x49, 0x50, 0x43, 0x61, 0x63, 0x68, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0d, 0x69, 0x70, 0x63, 0x61, 0x63, 0x68, 0x65, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x48, 0x0a, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x5f, 0x75, 0x70, 0x73, 0x65, 0x72, 0x74, 0x18, 0x6a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, + 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x70, 0x73, 0x65, + 0x72, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, + 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x12, + 0x48, 0x0a, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x18, 0x6b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, + 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x0e, 0x0a, 0x0c, 0x6e, 0x6f, 0x74, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4b, 0x0a, 0x11, 0x41, 0x67, 0x65, + 0x6e, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x12, 0x12, + 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, + 0x70, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x42, 0x0a, 0x10, 0x54, 0x69, 0x6d, 0x65, 0x4e, 0x6f, + 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x69, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x6d, 0x0a, 0x18, 0x50, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x1a, + 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x75, + 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, + 0x72, 0x75, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x59, 0x0a, 0x19, 0x45, 0x6e, 0x64, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x14, + 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, + 0x72, 0x72, 0x6f, 0x72, 0x22, 0x93, 0x01, 0x0a, 0x1a, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, + 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x65, + 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x6f, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, + 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, 0x99, 0x02, 0x0a, 0x13, 0x49, + 0x50, 0x43, 0x61, 0x63, 0x68, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x69, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x63, 0x69, 0x64, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x12, 0x3f, 0x0a, 0x0c, 0x6f, 0x6c, 0x64, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, + 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0b, 0x6f, 0x6c, 0x64, 0x49, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x12, 0x17, 0x0a, 0x07, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x70, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x6f, 0x73, 0x74, 0x49, 0x70, 0x12, 0x1e, 0x0a, 0x0b, + 0x6f, 0x6c, 0x64, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x6f, 0x6c, 0x64, 0x48, 0x6f, 0x73, 0x74, 0x49, 0x70, 0x12, 0x1f, 0x0a, 0x0b, + 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x0a, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, + 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x70, + 0x6f, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, + 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x43, 0x0a, 0x1d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x9a, 0x03, 0x0a, 0x19, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4e, 0x6f, 0x74, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x4e, 0x0a, 0x10, 0x66, 0x72, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x52, 0x0f, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x50, 0x0a, 0x11, 0x62, 0x61, 0x63, + 0x6b, 0x65, 0x6e, 0x64, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x52, 0x10, 0x62, 0x61, 0x63, 0x6b, 0x65, + 0x6e, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, + 0x29, 0x0a, 0x0e, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0d, 0x74, 0x72, 0x61, + 0x66, 0x66, 0x69, 0x63, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, + 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x2c, 0x0a, 0x12, + 0x65, 0x78, 0x74, 0x5f, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x5f, 0x70, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x65, 0x78, 0x74, 0x54, 0x72, 0x61, + 0x66, 0x66, 0x69, 0x63, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x2c, 0x0a, 0x12, 0x69, 0x6e, + 0x74, 0x5f, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x69, 0x6e, 0x74, 0x54, 0x72, 0x61, 0x66, 0x66, + 0x69, 0x63, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0x2b, 0x0a, 0x19, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x02, 0x69, 0x64, 0x22, 0x3c, 0x0a, 0x10, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, + 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, + 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x22, 0xef, 0x02, 0x0a, 0x0a, 0x44, 0x65, 0x62, 0x75, 0x67, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x14, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x26, 0x0a, 0x06, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x66, + 0x6c, 0x6f, 0x77, 0x2e, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x06, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x12, 0x30, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x30, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x31, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x52, 0x04, 0x61, 0x72, 0x67, 0x31, 0x12, 0x30, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x32, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x52, 0x04, 0x61, 0x72, 0x67, 0x32, 0x12, 0x30, 0x0a, 0x04, 0x61, 0x72, + 0x67, 0x33, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, + 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x04, 0x61, 0x72, 0x67, 0x33, 0x12, 0x18, 0x0a, 0x07, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x2d, 0x0a, 0x03, 0x63, 0x70, 0x75, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x52, 0x03, 0x63, 0x70, 0x75, 0x2a, 0x39, 0x0a, 0x08, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x4c, 0x33, 0x5f, 0x4c, 0x34, 0x10, 0x01, 0x12, 0x06, + 0x0a, 0x02, 0x4c, 0x37, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x4f, 0x43, 0x4b, 0x10, 0x03, + 0x2a, 0x39, 0x0a, 0x08, 0x41, 0x75, 0x74, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, + 0x44, 0x49, 0x53, 0x41, 0x42, 0x4c, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x50, + 0x49, 0x52, 0x45, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x45, 0x53, 0x54, 0x5f, 0x41, 0x4c, + 0x57, 0x41, 0x59, 0x53, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x10, 0x02, 0x2a, 0xea, 0x01, 0x0a, 0x15, + 0x54, 0x72, 0x61, 0x63, 0x65, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x11, 0x0a, 0x0d, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, + 0x5f, 0x50, 0x4f, 0x49, 0x4e, 0x54, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x54, 0x4f, 0x5f, 0x50, + 0x52, 0x4f, 0x58, 0x59, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x54, 0x4f, 0x5f, 0x48, 0x4f, 0x53, + 0x54, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x54, 0x4f, 0x5f, 0x53, 0x54, 0x41, 0x43, 0x4b, 0x10, + 0x03, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x4f, 0x5f, 0x4f, 0x56, 0x45, 0x52, 0x4c, 0x41, 0x59, 0x10, + 0x04, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x4f, 0x5f, 0x45, 0x4e, 0x44, 0x50, 0x4f, 0x49, 0x4e, 0x54, + 0x10, 0x65, 0x12, 0x11, 0x0a, 0x0d, 0x46, 0x52, 0x4f, 0x4d, 0x5f, 0x45, 0x4e, 0x44, 0x50, 0x4f, + 0x49, 0x4e, 0x54, 0x10, 0x05, 0x12, 0x0e, 0x0a, 0x0a, 0x46, 0x52, 0x4f, 0x4d, 0x5f, 0x50, 0x52, + 0x4f, 0x58, 0x59, 0x10, 0x06, 0x12, 0x0d, 0x0a, 0x09, 0x46, 0x52, 0x4f, 0x4d, 0x5f, 0x48, 0x4f, + 0x53, 0x54, 0x10, 0x07, 0x12, 0x0e, 0x0a, 0x0a, 0x46, 0x52, 0x4f, 0x4d, 0x5f, 0x53, 0x54, 0x41, + 0x43, 0x4b, 0x10, 0x08, 0x12, 0x10, 0x0a, 0x0c, 0x46, 0x52, 0x4f, 0x4d, 0x5f, 0x4f, 0x56, 0x45, + 0x52, 0x4c, 0x41, 0x59, 0x10, 0x09, 0x12, 0x10, 0x0a, 0x0c, 0x46, 0x52, 0x4f, 0x4d, 0x5f, 0x4e, + 0x45, 0x54, 0x57, 0x4f, 0x52, 0x4b, 0x10, 0x0a, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x4f, 0x5f, 0x4e, + 0x45, 0x54, 0x57, 0x4f, 0x52, 0x4b, 0x10, 0x0b, 0x2a, 0x9c, 0x01, 0x0a, 0x0b, 0x54, 0x72, 0x61, + 0x63, 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x14, 0x54, 0x52, 0x41, 0x43, + 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, + 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x4e, 0x45, 0x57, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x45, + 0x53, 0x54, 0x41, 0x42, 0x4c, 0x49, 0x53, 0x48, 0x45, 0x44, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, + 0x52, 0x45, 0x50, 0x4c, 0x59, 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x4c, 0x41, 0x54, + 0x45, 0x44, 0x10, 0x04, 0x12, 0x0c, 0x0a, 0x08, 0x52, 0x45, 0x4f, 0x50, 0x45, 0x4e, 0x45, 0x44, + 0x10, 0x05, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x52, 0x56, 0x36, 0x5f, 0x45, 0x4e, 0x43, 0x41, 0x50, + 0x10, 0x06, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x52, 0x56, 0x36, 0x5f, 0x44, 0x45, 0x43, 0x41, 0x50, + 0x10, 0x07, 0x12, 0x13, 0x0a, 0x0f, 0x45, 0x4e, 0x43, 0x52, 0x59, 0x50, 0x54, 0x5f, 0x4f, 0x56, + 0x45, 0x52, 0x4c, 0x41, 0x59, 0x10, 0x08, 0x2a, 0x48, 0x0a, 0x0a, 0x4c, 0x37, 0x46, 0x6c, 0x6f, + 0x77, 0x54, 0x79, 0x70, 0x65, 0x12, 0x13, 0x0a, 0x0f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, + 0x5f, 0x4c, 0x37, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, + 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x52, 0x45, 0x53, 0x50, 0x4f, + 0x4e, 0x53, 0x45, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x41, 0x4d, 0x50, 0x4c, 0x45, 0x10, + 0x03, 0x2a, 0x30, 0x0a, 0x09, 0x49, 0x50, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0f, + 0x0a, 0x0b, 0x49, 0x50, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x55, 0x53, 0x45, 0x44, 0x10, 0x00, 0x12, + 0x08, 0x0a, 0x04, 0x49, 0x50, 0x76, 0x34, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x50, 0x76, + 0x36, 0x10, 0x02, 0x2a, 0x7c, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x64, 0x69, 0x63, 0x74, 0x12, 0x13, + 0x0a, 0x0f, 0x56, 0x45, 0x52, 0x44, 0x49, 0x43, 0x54, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, + 0x4e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x46, 0x4f, 0x52, 0x57, 0x41, 0x52, 0x44, 0x45, 0x44, + 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x52, 0x4f, 0x50, 0x50, 0x45, 0x44, 0x10, 0x02, 0x12, + 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x55, + 0x44, 0x49, 0x54, 0x10, 0x04, 0x12, 0x0e, 0x0a, 0x0a, 0x52, 0x45, 0x44, 0x49, 0x52, 0x45, 0x43, + 0x54, 0x45, 0x44, 0x10, 0x05, 0x12, 0x0a, 0x0a, 0x06, 0x54, 0x52, 0x41, 0x43, 0x45, 0x44, 0x10, + 0x06, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x4c, 0x41, 0x54, 0x45, 0x44, 0x10, + 0x07, 0x2a, 0x97, 0x11, 0x0a, 0x0a, 0x44, 0x72, 0x6f, 0x70, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, + 0x12, 0x17, 0x0a, 0x13, 0x44, 0x52, 0x4f, 0x50, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, + 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x12, 0x49, 0x4e, 0x56, + 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x4d, 0x41, 0x43, 0x10, + 0x82, 0x01, 0x1a, 0x02, 0x08, 0x01, 0x12, 0x20, 0x0a, 0x17, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, + 0x44, 0x5f, 0x44, 0x45, 0x53, 0x54, 0x49, 0x4e, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x41, + 0x43, 0x10, 0x83, 0x01, 0x1a, 0x02, 0x08, 0x01, 0x12, 0x16, 0x0a, 0x11, 0x49, 0x4e, 0x56, 0x41, + 0x4c, 0x49, 0x44, 0x5f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x49, 0x50, 0x10, 0x84, 0x01, + 0x12, 0x12, 0x0a, 0x0d, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, + 0x44, 0x10, 0x85, 0x01, 0x12, 0x1b, 0x0a, 0x16, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, + 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x44, 0x52, 0x4f, 0x50, 0x50, 0x45, 0x44, 0x10, 0x86, + 0x01, 0x12, 0x23, 0x0a, 0x1e, 0x43, 0x54, 0x5f, 0x54, 0x52, 0x55, 0x4e, 0x43, 0x41, 0x54, 0x45, + 0x44, 0x5f, 0x4f, 0x52, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x48, 0x45, 0x41, + 0x44, 0x45, 0x52, 0x10, 0x87, 0x01, 0x12, 0x1c, 0x0a, 0x17, 0x43, 0x54, 0x5f, 0x4d, 0x49, 0x53, + 0x53, 0x49, 0x4e, 0x47, 0x5f, 0x54, 0x43, 0x50, 0x5f, 0x41, 0x43, 0x4b, 0x5f, 0x46, 0x4c, 0x41, + 0x47, 0x10, 0x88, 0x01, 0x12, 0x1b, 0x0a, 0x16, 0x43, 0x54, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, + 0x57, 0x4e, 0x5f, 0x4c, 0x34, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x43, 0x4f, 0x4c, 0x10, 0x89, + 0x01, 0x12, 0x2b, 0x0a, 0x22, 0x43, 0x54, 0x5f, 0x43, 0x41, 0x4e, 0x4e, 0x4f, 0x54, 0x5f, 0x43, + 0x52, 0x45, 0x41, 0x54, 0x45, 0x5f, 0x45, 0x4e, 0x54, 0x52, 0x59, 0x5f, 0x46, 0x52, 0x4f, 0x4d, + 0x5f, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x10, 0x8a, 0x01, 0x1a, 0x02, 0x08, 0x01, 0x12, 0x1c, + 0x0a, 0x17, 0x55, 0x4e, 0x53, 0x55, 0x50, 0x50, 0x4f, 0x52, 0x54, 0x45, 0x44, 0x5f, 0x4c, 0x33, + 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x43, 0x4f, 0x4c, 0x10, 0x8b, 0x01, 0x12, 0x15, 0x0a, 0x10, + 0x4d, 0x49, 0x53, 0x53, 0x45, 0x44, 0x5f, 0x54, 0x41, 0x49, 0x4c, 0x5f, 0x43, 0x41, 0x4c, 0x4c, + 0x10, 0x8c, 0x01, 0x12, 0x1c, 0x0a, 0x17, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x57, 0x52, 0x49, + 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x54, 0x4f, 0x5f, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x10, 0x8d, + 0x01, 0x12, 0x18, 0x0a, 0x13, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x4c, 0x34, 0x5f, + 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x43, 0x4f, 0x4c, 0x10, 0x8e, 0x01, 0x12, 0x18, 0x0a, 0x13, 0x55, + 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x49, 0x43, 0x4d, 0x50, 0x56, 0x34, 0x5f, 0x43, 0x4f, + 0x44, 0x45, 0x10, 0x8f, 0x01, 0x12, 0x18, 0x0a, 0x13, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, + 0x5f, 0x49, 0x43, 0x4d, 0x50, 0x56, 0x34, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x10, 0x90, 0x01, 0x12, + 0x18, 0x0a, 0x13, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x49, 0x43, 0x4d, 0x50, 0x56, + 0x36, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x10, 0x91, 0x01, 0x12, 0x18, 0x0a, 0x13, 0x55, 0x4e, 0x4b, + 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x49, 0x43, 0x4d, 0x50, 0x56, 0x36, 0x5f, 0x54, 0x59, 0x50, 0x45, + 0x10, 0x92, 0x01, 0x12, 0x20, 0x0a, 0x1b, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x52, 0x45, 0x54, + 0x52, 0x49, 0x45, 0x56, 0x49, 0x4e, 0x47, 0x5f, 0x54, 0x55, 0x4e, 0x4e, 0x45, 0x4c, 0x5f, 0x4b, + 0x45, 0x59, 0x10, 0x93, 0x01, 0x12, 0x28, 0x0a, 0x1f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x52, + 0x45, 0x54, 0x52, 0x49, 0x45, 0x56, 0x49, 0x4e, 0x47, 0x5f, 0x54, 0x55, 0x4e, 0x4e, 0x45, 0x4c, + 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x10, 0x94, 0x01, 0x1a, 0x02, 0x08, 0x01, 0x12, + 0x1e, 0x0a, 0x15, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x47, 0x45, 0x4e, 0x45, 0x56, + 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x95, 0x01, 0x1a, 0x02, 0x08, 0x01, 0x12, + 0x1e, 0x0a, 0x19, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x4c, 0x33, 0x5f, 0x54, 0x41, + 0x52, 0x47, 0x45, 0x54, 0x5f, 0x41, 0x44, 0x44, 0x52, 0x45, 0x53, 0x53, 0x10, 0x96, 0x01, 0x12, + 0x1b, 0x0a, 0x16, 0x53, 0x54, 0x41, 0x4c, 0x45, 0x5f, 0x4f, 0x52, 0x5f, 0x55, 0x4e, 0x52, 0x4f, + 0x55, 0x54, 0x41, 0x42, 0x4c, 0x45, 0x5f, 0x49, 0x50, 0x10, 0x97, 0x01, 0x12, 0x2a, 0x0a, 0x21, + 0x4e, 0x4f, 0x5f, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x49, 0x4e, 0x47, 0x5f, 0x4c, 0x4f, 0x43, 0x41, + 0x4c, 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x46, 0x4f, 0x55, 0x4e, + 0x44, 0x10, 0x98, 0x01, 0x1a, 0x02, 0x08, 0x01, 0x12, 0x27, 0x0a, 0x22, 0x45, 0x52, 0x52, 0x4f, + 0x52, 0x5f, 0x57, 0x48, 0x49, 0x4c, 0x45, 0x5f, 0x43, 0x4f, 0x52, 0x52, 0x45, 0x43, 0x54, 0x49, + 0x4e, 0x47, 0x5f, 0x4c, 0x33, 0x5f, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x53, 0x55, 0x4d, 0x10, 0x99, + 0x01, 0x12, 0x27, 0x0a, 0x22, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x57, 0x48, 0x49, 0x4c, 0x45, + 0x5f, 0x43, 0x4f, 0x52, 0x52, 0x45, 0x43, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x4c, 0x34, 0x5f, 0x43, + 0x48, 0x45, 0x43, 0x4b, 0x53, 0x55, 0x4d, 0x10, 0x9a, 0x01, 0x12, 0x1c, 0x0a, 0x17, 0x43, 0x54, + 0x5f, 0x4d, 0x41, 0x50, 0x5f, 0x49, 0x4e, 0x53, 0x45, 0x52, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, + 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x9b, 0x01, 0x12, 0x22, 0x0a, 0x1d, 0x49, 0x4e, 0x56, 0x41, + 0x4c, 0x49, 0x44, 0x5f, 0x49, 0x50, 0x56, 0x36, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x4e, 0x53, 0x49, + 0x4f, 0x4e, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x10, 0x9c, 0x01, 0x12, 0x23, 0x0a, 0x1e, + 0x49, 0x50, 0x5f, 0x46, 0x52, 0x41, 0x47, 0x4d, 0x45, 0x4e, 0x54, 0x41, 0x54, 0x49, 0x4f, 0x4e, + 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x53, 0x55, 0x50, 0x50, 0x4f, 0x52, 0x54, 0x45, 0x44, 0x10, 0x9d, + 0x01, 0x12, 0x1e, 0x0a, 0x19, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x5f, 0x42, 0x41, 0x43, + 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x9e, + 0x01, 0x12, 0x28, 0x0a, 0x23, 0x4e, 0x4f, 0x5f, 0x54, 0x55, 0x4e, 0x4e, 0x45, 0x4c, 0x5f, 0x4f, + 0x52, 0x5f, 0x45, 0x4e, 0x43, 0x41, 0x50, 0x53, 0x55, 0x4c, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, + 0x45, 0x4e, 0x44, 0x50, 0x4f, 0x49, 0x4e, 0x54, 0x10, 0xa0, 0x01, 0x12, 0x23, 0x0a, 0x1e, 0x46, + 0x41, 0x49, 0x4c, 0x45, 0x44, 0x5f, 0x54, 0x4f, 0x5f, 0x49, 0x4e, 0x53, 0x45, 0x52, 0x54, 0x5f, + 0x49, 0x4e, 0x54, 0x4f, 0x5f, 0x50, 0x52, 0x4f, 0x58, 0x59, 0x4d, 0x41, 0x50, 0x10, 0xa1, 0x01, + 0x12, 0x2b, 0x0a, 0x26, 0x52, 0x45, 0x41, 0x43, 0x48, 0x45, 0x44, 0x5f, 0x45, 0x44, 0x54, 0x5f, + 0x52, 0x41, 0x54, 0x45, 0x5f, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x44, 0x52, + 0x4f, 0x50, 0x5f, 0x48, 0x4f, 0x52, 0x49, 0x5a, 0x4f, 0x4e, 0x10, 0xa2, 0x01, 0x12, 0x26, 0x0a, + 0x21, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, + 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x52, 0x41, 0x43, 0x4b, 0x49, 0x4e, 0x47, 0x5f, 0x53, 0x54, 0x41, + 0x54, 0x45, 0x10, 0xa3, 0x01, 0x12, 0x1e, 0x0a, 0x19, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x5f, 0x48, + 0x4f, 0x53, 0x54, 0x5f, 0x49, 0x53, 0x5f, 0x55, 0x4e, 0x52, 0x45, 0x41, 0x43, 0x48, 0x41, 0x42, + 0x4c, 0x45, 0x10, 0xa4, 0x01, 0x12, 0x3a, 0x0a, 0x35, 0x4e, 0x4f, 0x5f, 0x43, 0x4f, 0x4e, 0x46, + 0x49, 0x47, 0x55, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x56, 0x41, 0x49, 0x4c, 0x41, + 0x42, 0x4c, 0x45, 0x5f, 0x54, 0x4f, 0x5f, 0x50, 0x45, 0x52, 0x46, 0x4f, 0x52, 0x4d, 0x5f, 0x50, + 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x44, 0x45, 0x43, 0x49, 0x53, 0x49, 0x4f, 0x4e, 0x10, 0xa5, + 0x01, 0x12, 0x1c, 0x0a, 0x17, 0x55, 0x4e, 0x53, 0x55, 0x50, 0x50, 0x4f, 0x52, 0x54, 0x45, 0x44, + 0x5f, 0x4c, 0x32, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x43, 0x4f, 0x4c, 0x10, 0xa6, 0x01, 0x12, + 0x22, 0x0a, 0x1d, 0x4e, 0x4f, 0x5f, 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x46, 0x4f, + 0x52, 0x5f, 0x4e, 0x41, 0x54, 0x5f, 0x4d, 0x41, 0x53, 0x51, 0x55, 0x45, 0x52, 0x41, 0x44, 0x45, + 0x10, 0xa7, 0x01, 0x12, 0x2c, 0x0a, 0x27, 0x55, 0x4e, 0x53, 0x55, 0x50, 0x50, 0x4f, 0x52, 0x54, + 0x45, 0x44, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x43, 0x4f, 0x4c, 0x5f, 0x46, 0x4f, 0x52, 0x5f, + 0x4e, 0x41, 0x54, 0x5f, 0x4d, 0x41, 0x53, 0x51, 0x55, 0x45, 0x52, 0x41, 0x44, 0x45, 0x10, 0xa8, + 0x01, 0x12, 0x16, 0x0a, 0x11, 0x46, 0x49, 0x42, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x5f, + 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0xa9, 0x01, 0x12, 0x28, 0x0a, 0x23, 0x45, 0x4e, 0x43, + 0x41, 0x50, 0x53, 0x55, 0x4c, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x52, 0x41, 0x46, 0x46, + 0x49, 0x43, 0x5f, 0x49, 0x53, 0x5f, 0x50, 0x52, 0x4f, 0x48, 0x49, 0x42, 0x49, 0x54, 0x45, 0x44, + 0x10, 0xaa, 0x01, 0x12, 0x15, 0x0a, 0x10, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x49, + 0x44, 0x45, 0x4e, 0x54, 0x49, 0x54, 0x59, 0x10, 0xab, 0x01, 0x12, 0x13, 0x0a, 0x0e, 0x55, 0x4e, + 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x53, 0x45, 0x4e, 0x44, 0x45, 0x52, 0x10, 0xac, 0x01, 0x12, + 0x13, 0x0a, 0x0e, 0x4e, 0x41, 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x4e, 0x45, 0x45, 0x44, 0x45, + 0x44, 0x10, 0xad, 0x01, 0x12, 0x13, 0x0a, 0x0e, 0x49, 0x53, 0x5f, 0x41, 0x5f, 0x43, 0x4c, 0x55, + 0x53, 0x54, 0x45, 0x52, 0x49, 0x50, 0x10, 0xae, 0x01, 0x12, 0x2e, 0x0a, 0x29, 0x46, 0x49, 0x52, + 0x53, 0x54, 0x5f, 0x4c, 0x4f, 0x47, 0x49, 0x43, 0x41, 0x4c, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x47, + 0x52, 0x41, 0x4d, 0x5f, 0x46, 0x52, 0x41, 0x47, 0x4d, 0x45, 0x4e, 0x54, 0x5f, 0x4e, 0x4f, 0x54, + 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0xaf, 0x01, 0x12, 0x1d, 0x0a, 0x18, 0x46, 0x4f, 0x52, + 0x42, 0x49, 0x44, 0x44, 0x45, 0x4e, 0x5f, 0x49, 0x43, 0x4d, 0x50, 0x56, 0x36, 0x5f, 0x4d, 0x45, + 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0xb0, 0x01, 0x12, 0x21, 0x0a, 0x1c, 0x44, 0x45, 0x4e, 0x49, + 0x45, 0x44, 0x5f, 0x42, 0x59, 0x5f, 0x4c, 0x42, 0x5f, 0x53, 0x52, 0x43, 0x5f, 0x52, 0x41, 0x4e, + 0x47, 0x45, 0x5f, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x10, 0xb1, 0x01, 0x12, 0x19, 0x0a, 0x14, 0x53, + 0x4f, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x5f, 0x46, 0x41, 0x49, + 0x4c, 0x45, 0x44, 0x10, 0xb2, 0x01, 0x12, 0x19, 0x0a, 0x14, 0x53, 0x4f, 0x43, 0x4b, 0x45, 0x54, + 0x5f, 0x41, 0x53, 0x53, 0x49, 0x47, 0x4e, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0xb3, + 0x01, 0x12, 0x31, 0x0a, 0x2c, 0x50, 0x52, 0x4f, 0x58, 0x59, 0x5f, 0x52, 0x45, 0x44, 0x49, 0x52, + 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x53, 0x55, 0x50, 0x50, 0x4f, + 0x52, 0x54, 0x45, 0x44, 0x5f, 0x46, 0x4f, 0x52, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x43, 0x4f, + 0x4c, 0x10, 0xb4, 0x01, 0x12, 0x10, 0x0a, 0x0b, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x44, + 0x45, 0x4e, 0x59, 0x10, 0xb5, 0x01, 0x12, 0x12, 0x0a, 0x0d, 0x56, 0x4c, 0x41, 0x4e, 0x5f, 0x46, + 0x49, 0x4c, 0x54, 0x45, 0x52, 0x45, 0x44, 0x10, 0xb6, 0x01, 0x12, 0x10, 0x0a, 0x0b, 0x49, 0x4e, + 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x56, 0x4e, 0x49, 0x10, 0xb7, 0x01, 0x12, 0x16, 0x0a, 0x11, + 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x54, 0x43, 0x5f, 0x42, 0x55, 0x46, 0x46, 0x45, + 0x52, 0x10, 0xb8, 0x01, 0x12, 0x0b, 0x0a, 0x06, 0x4e, 0x4f, 0x5f, 0x53, 0x49, 0x44, 0x10, 0xb9, + 0x01, 0x12, 0x1b, 0x0a, 0x12, 0x4d, 0x49, 0x53, 0x53, 0x49, 0x4e, 0x47, 0x5f, 0x53, 0x52, 0x56, + 0x36, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x10, 0xba, 0x01, 0x1a, 0x02, 0x08, 0x01, 0x12, 0x0a, + 0x0a, 0x05, 0x4e, 0x41, 0x54, 0x34, 0x36, 0x10, 0xbb, 0x01, 0x12, 0x0a, 0x0a, 0x05, 0x4e, 0x41, + 0x54, 0x36, 0x34, 0x10, 0xbc, 0x01, 0x12, 0x12, 0x0a, 0x0d, 0x41, 0x55, 0x54, 0x48, 0x5f, 0x52, + 0x45, 0x51, 0x55, 0x49, 0x52, 0x45, 0x44, 0x10, 0xbd, 0x01, 0x12, 0x14, 0x0a, 0x0f, 0x43, 0x54, + 0x5f, 0x4e, 0x4f, 0x5f, 0x4d, 0x41, 0x50, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0xbe, 0x01, + 0x12, 0x16, 0x0a, 0x11, 0x53, 0x4e, 0x41, 0x54, 0x5f, 0x4e, 0x4f, 0x5f, 0x4d, 0x41, 0x50, 0x5f, + 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0xbf, 0x01, 0x12, 0x17, 0x0a, 0x12, 0x49, 0x4e, 0x56, 0x41, + 0x4c, 0x49, 0x44, 0x5f, 0x43, 0x4c, 0x55, 0x53, 0x54, 0x45, 0x52, 0x5f, 0x49, 0x44, 0x10, 0xc0, + 0x01, 0x12, 0x27, 0x0a, 0x22, 0x55, 0x4e, 0x53, 0x55, 0x50, 0x50, 0x4f, 0x52, 0x54, 0x45, 0x44, + 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x43, 0x4f, 0x4c, 0x5f, 0x46, 0x4f, 0x52, 0x5f, 0x44, 0x53, + 0x52, 0x5f, 0x45, 0x4e, 0x43, 0x41, 0x50, 0x10, 0xc1, 0x01, 0x12, 0x16, 0x0a, 0x11, 0x4e, 0x4f, + 0x5f, 0x45, 0x47, 0x52, 0x45, 0x53, 0x53, 0x5f, 0x47, 0x41, 0x54, 0x45, 0x57, 0x41, 0x59, 0x10, + 0xc2, 0x01, 0x12, 0x18, 0x0a, 0x13, 0x55, 0x4e, 0x45, 0x4e, 0x43, 0x52, 0x59, 0x50, 0x54, 0x45, + 0x44, 0x5f, 0x54, 0x52, 0x41, 0x46, 0x46, 0x49, 0x43, 0x10, 0xc3, 0x01, 0x12, 0x11, 0x0a, 0x0c, + 0x54, 0x54, 0x4c, 0x5f, 0x45, 0x58, 0x43, 0x45, 0x45, 0x44, 0x45, 0x44, 0x10, 0xc4, 0x01, 0x12, + 0x0f, 0x0a, 0x0a, 0x4e, 0x4f, 0x5f, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x49, 0x44, 0x10, 0xc5, 0x01, + 0x12, 0x16, 0x0a, 0x11, 0x44, 0x52, 0x4f, 0x50, 0x5f, 0x52, 0x41, 0x54, 0x45, 0x5f, 0x4c, 0x49, + 0x4d, 0x49, 0x54, 0x45, 0x44, 0x10, 0xc6, 0x01, 0x12, 0x11, 0x0a, 0x0c, 0x49, 0x47, 0x4d, 0x50, + 0x5f, 0x48, 0x41, 0x4e, 0x44, 0x4c, 0x45, 0x44, 0x10, 0xc7, 0x01, 0x12, 0x14, 0x0a, 0x0f, 0x49, + 0x47, 0x4d, 0x50, 0x5f, 0x53, 0x55, 0x42, 0x53, 0x43, 0x52, 0x49, 0x42, 0x45, 0x44, 0x10, 0xc8, + 0x01, 0x12, 0x16, 0x0a, 0x11, 0x4d, 0x55, 0x4c, 0x54, 0x49, 0x43, 0x41, 0x53, 0x54, 0x5f, 0x48, + 0x41, 0x4e, 0x44, 0x4c, 0x45, 0x44, 0x10, 0xc9, 0x01, 0x12, 0x18, 0x0a, 0x13, 0x44, 0x52, 0x4f, + 0x50, 0x5f, 0x48, 0x4f, 0x53, 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x52, 0x45, 0x41, 0x44, 0x59, + 0x10, 0xca, 0x01, 0x12, 0x16, 0x0a, 0x11, 0x44, 0x52, 0x4f, 0x50, 0x5f, 0x45, 0x50, 0x5f, 0x4e, + 0x4f, 0x54, 0x5f, 0x52, 0x45, 0x41, 0x44, 0x59, 0x10, 0xcb, 0x01, 0x2a, 0x4a, 0x0a, 0x10, 0x54, + 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x1d, 0x0a, 0x19, 0x54, 0x52, 0x41, 0x46, 0x46, 0x49, 0x43, 0x5f, 0x44, 0x49, 0x52, 0x45, 0x43, + 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0b, + 0x0a, 0x07, 0x49, 0x4e, 0x47, 0x52, 0x45, 0x53, 0x53, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x45, + 0x47, 0x52, 0x45, 0x53, 0x53, 0x10, 0x02, 0x2a, 0x8d, 0x02, 0x0a, 0x11, 0x44, 0x65, 0x62, 0x75, + 0x67, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1d, 0x0a, + 0x19, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x41, 0x50, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x50, 0x4f, 0x49, + 0x4e, 0x54, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x18, 0x0a, 0x14, + 0x44, 0x42, 0x47, 0x5f, 0x43, 0x41, 0x50, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x44, 0x45, 0x4c, 0x49, + 0x56, 0x45, 0x52, 0x59, 0x10, 0x04, 0x12, 0x17, 0x0a, 0x13, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x41, + 0x50, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x46, 0x52, 0x4f, 0x4d, 0x5f, 0x4c, 0x42, 0x10, 0x05, 0x12, + 0x19, 0x0a, 0x15, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x41, 0x50, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x41, + 0x46, 0x54, 0x45, 0x52, 0x5f, 0x56, 0x34, 0x36, 0x10, 0x06, 0x12, 0x19, 0x0a, 0x15, 0x44, 0x42, + 0x47, 0x5f, 0x43, 0x41, 0x50, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x41, 0x46, 0x54, 0x45, 0x52, 0x5f, + 0x56, 0x36, 0x34, 0x10, 0x07, 0x12, 0x19, 0x0a, 0x15, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x41, 0x50, + 0x54, 0x55, 0x52, 0x45, 0x5f, 0x50, 0x52, 0x4f, 0x58, 0x59, 0x5f, 0x50, 0x52, 0x45, 0x10, 0x08, + 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x41, 0x50, 0x54, 0x55, 0x52, 0x45, 0x5f, + 0x50, 0x52, 0x4f, 0x58, 0x59, 0x5f, 0x50, 0x4f, 0x53, 0x54, 0x10, 0x09, 0x12, 0x18, 0x0a, 0x14, + 0x44, 0x42, 0x47, 0x5f, 0x43, 0x41, 0x50, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x53, 0x4e, 0x41, 0x54, + 0x5f, 0x50, 0x52, 0x45, 0x10, 0x0a, 0x12, 0x19, 0x0a, 0x15, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x41, + 0x50, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x53, 0x4e, 0x41, 0x54, 0x5f, 0x50, 0x4f, 0x53, 0x54, 0x10, + 0x0b, 0x22, 0x04, 0x08, 0x01, 0x10, 0x03, 0x2a, 0x39, 0x0a, 0x09, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, + 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, + 0x10, 0x09, 0x12, 0x0e, 0x0a, 0x0a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x4c, 0x6f, 0x73, 0x74, + 0x10, 0x02, 0x2a, 0x7f, 0x0a, 0x0f, 0x4c, 0x6f, 0x73, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, + 0x5f, 0x4c, 0x4f, 0x53, 0x54, 0x5f, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x53, 0x4f, 0x55, 0x52, + 0x43, 0x45, 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x50, 0x45, 0x52, 0x46, 0x5f, 0x45, 0x56, 0x45, + 0x4e, 0x54, 0x5f, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x42, 0x55, 0x46, 0x46, 0x45, 0x52, 0x10, 0x01, + 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x42, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x45, 0x56, 0x45, + 0x4e, 0x54, 0x53, 0x5f, 0x51, 0x55, 0x45, 0x55, 0x45, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x48, + 0x55, 0x42, 0x42, 0x4c, 0x45, 0x5f, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x42, 0x55, 0x46, 0x46, 0x45, + 0x52, 0x10, 0x03, 0x2a, 0xae, 0x02, 0x0a, 0x0e, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x13, 0x41, 0x47, 0x45, 0x4e, 0x54, 0x5f, + 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, + 0x11, 0x0a, 0x0d, 0x41, 0x47, 0x45, 0x4e, 0x54, 0x5f, 0x53, 0x54, 0x41, 0x52, 0x54, 0x45, 0x44, + 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x55, 0x50, 0x44, + 0x41, 0x54, 0x45, 0x44, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, + 0x5f, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x44, 0x10, 0x04, 0x12, 0x1f, 0x0a, 0x1b, 0x45, 0x4e, + 0x44, 0x50, 0x4f, 0x49, 0x4e, 0x54, 0x5f, 0x52, 0x45, 0x47, 0x45, 0x4e, 0x45, 0x52, 0x41, 0x54, + 0x45, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x05, 0x12, 0x1f, 0x0a, 0x1b, 0x45, + 0x4e, 0x44, 0x50, 0x4f, 0x49, 0x4e, 0x54, 0x5f, 0x52, 0x45, 0x47, 0x45, 0x4e, 0x45, 0x52, 0x41, + 0x54, 0x45, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x10, 0x06, 0x12, 0x14, 0x0a, 0x10, + 0x45, 0x4e, 0x44, 0x50, 0x4f, 0x49, 0x4e, 0x54, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x44, + 0x10, 0x07, 0x12, 0x14, 0x0a, 0x10, 0x45, 0x4e, 0x44, 0x50, 0x4f, 0x49, 0x4e, 0x54, 0x5f, 0x44, + 0x45, 0x4c, 0x45, 0x54, 0x45, 0x44, 0x10, 0x08, 0x12, 0x14, 0x0a, 0x10, 0x49, 0x50, 0x43, 0x41, + 0x43, 0x48, 0x45, 0x5f, 0x55, 0x50, 0x53, 0x45, 0x52, 0x54, 0x45, 0x44, 0x10, 0x09, 0x12, 0x13, + 0x0a, 0x0f, 0x49, 0x50, 0x43, 0x41, 0x43, 0x48, 0x45, 0x5f, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, + 0x44, 0x10, 0x0a, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x5f, 0x55, + 0x50, 0x53, 0x45, 0x52, 0x54, 0x45, 0x44, 0x10, 0x0b, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x45, 0x52, + 0x56, 0x49, 0x43, 0x45, 0x5f, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x44, 0x10, 0x0c, 0x22, 0x04, + 0x08, 0x01, 0x10, 0x01, 0x2a, 0xd8, 0x01, 0x0a, 0x16, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, + 0x1c, 0x0a, 0x18, 0x53, 0x4f, 0x43, 0x4b, 0x5f, 0x58, 0x4c, 0x41, 0x54, 0x45, 0x5f, 0x50, 0x4f, + 0x49, 0x4e, 0x54, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x26, 0x0a, + 0x22, 0x53, 0x4f, 0x43, 0x4b, 0x5f, 0x58, 0x4c, 0x41, 0x54, 0x45, 0x5f, 0x50, 0x4f, 0x49, 0x4e, + 0x54, 0x5f, 0x50, 0x52, 0x45, 0x5f, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, + 0x46, 0x57, 0x44, 0x10, 0x01, 0x12, 0x27, 0x0a, 0x23, 0x53, 0x4f, 0x43, 0x4b, 0x5f, 0x58, 0x4c, + 0x41, 0x54, 0x45, 0x5f, 0x50, 0x4f, 0x49, 0x4e, 0x54, 0x5f, 0x50, 0x4f, 0x53, 0x54, 0x5f, 0x44, + 0x49, 0x52, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x57, 0x44, 0x10, 0x02, 0x12, 0x26, + 0x0a, 0x22, 0x53, 0x4f, 0x43, 0x4b, 0x5f, 0x58, 0x4c, 0x41, 0x54, 0x45, 0x5f, 0x50, 0x4f, 0x49, + 0x4e, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x5f, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, + 0x5f, 0x52, 0x45, 0x56, 0x10, 0x03, 0x12, 0x27, 0x0a, 0x23, 0x53, 0x4f, 0x43, 0x4b, 0x5f, 0x58, + 0x4c, 0x41, 0x54, 0x45, 0x5f, 0x50, 0x4f, 0x49, 0x4e, 0x54, 0x5f, 0x50, 0x4f, 0x53, 0x54, 0x5f, + 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x45, 0x56, 0x10, 0x04, 0x2a, + 0x81, 0x0d, 0x0a, 0x0e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x44, 0x42, 0x47, 0x5f, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, + 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x44, 0x42, 0x47, + 0x5f, 0x47, 0x45, 0x4e, 0x45, 0x52, 0x49, 0x43, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x44, 0x42, + 0x47, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x5f, 0x44, 0x45, 0x4c, 0x49, 0x56, 0x45, 0x52, 0x59, + 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x42, 0x47, 0x5f, 0x45, 0x4e, 0x43, 0x41, 0x50, 0x10, + 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x58, 0x43, 0x5f, 0x46, 0x4f, 0x55, + 0x4e, 0x44, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x44, 0x42, 0x47, 0x5f, 0x50, 0x4f, 0x4c, 0x49, + 0x43, 0x59, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x05, 0x12, 0x11, 0x0a, 0x0d, 0x44, + 0x42, 0x47, 0x5f, 0x43, 0x54, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x10, 0x06, 0x12, 0x15, + 0x0a, 0x11, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x54, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x5f, + 0x52, 0x45, 0x56, 0x10, 0x07, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x54, 0x5f, + 0x4d, 0x41, 0x54, 0x43, 0x48, 0x10, 0x08, 0x12, 0x12, 0x0a, 0x0e, 0x44, 0x42, 0x47, 0x5f, 0x43, + 0x54, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x44, 0x10, 0x09, 0x12, 0x13, 0x0a, 0x0f, 0x44, + 0x42, 0x47, 0x5f, 0x43, 0x54, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x44, 0x32, 0x10, 0x0a, + 0x12, 0x14, 0x0a, 0x10, 0x44, 0x42, 0x47, 0x5f, 0x49, 0x43, 0x4d, 0x50, 0x36, 0x5f, 0x48, 0x41, + 0x4e, 0x44, 0x4c, 0x45, 0x10, 0x0b, 0x12, 0x15, 0x0a, 0x11, 0x44, 0x42, 0x47, 0x5f, 0x49, 0x43, + 0x4d, 0x50, 0x36, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x0c, 0x12, 0x10, 0x0a, + 0x0c, 0x44, 0x42, 0x47, 0x5f, 0x49, 0x43, 0x4d, 0x50, 0x36, 0x5f, 0x4e, 0x53, 0x10, 0x0d, 0x12, + 0x1b, 0x0a, 0x17, 0x44, 0x42, 0x47, 0x5f, 0x49, 0x43, 0x4d, 0x50, 0x36, 0x5f, 0x54, 0x49, 0x4d, + 0x45, 0x5f, 0x45, 0x58, 0x43, 0x45, 0x45, 0x44, 0x45, 0x44, 0x10, 0x0e, 0x12, 0x12, 0x0a, 0x0e, + 0x44, 0x42, 0x47, 0x5f, 0x43, 0x54, 0x5f, 0x56, 0x45, 0x52, 0x44, 0x49, 0x43, 0x54, 0x10, 0x0f, + 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x42, 0x47, 0x5f, 0x44, 0x45, 0x43, 0x41, 0x50, 0x10, 0x10, 0x12, + 0x10, 0x0a, 0x0c, 0x44, 0x42, 0x47, 0x5f, 0x50, 0x4f, 0x52, 0x54, 0x5f, 0x4d, 0x41, 0x50, 0x10, + 0x11, 0x12, 0x11, 0x0a, 0x0d, 0x44, 0x42, 0x47, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x52, + 0x45, 0x54, 0x10, 0x12, 0x12, 0x0f, 0x0a, 0x0b, 0x44, 0x42, 0x47, 0x5f, 0x54, 0x4f, 0x5f, 0x48, + 0x4f, 0x53, 0x54, 0x10, 0x13, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x42, 0x47, 0x5f, 0x54, 0x4f, 0x5f, + 0x53, 0x54, 0x41, 0x43, 0x4b, 0x10, 0x14, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x42, 0x47, 0x5f, 0x50, + 0x4b, 0x54, 0x5f, 0x48, 0x41, 0x53, 0x48, 0x10, 0x15, 0x12, 0x1b, 0x0a, 0x17, 0x44, 0x42, 0x47, + 0x5f, 0x4c, 0x42, 0x36, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x5f, 0x46, 0x52, 0x4f, 0x4e, + 0x54, 0x45, 0x4e, 0x44, 0x10, 0x16, 0x12, 0x20, 0x0a, 0x1c, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, + 0x36, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x5f, 0x46, 0x52, 0x4f, 0x4e, 0x54, 0x45, 0x4e, + 0x44, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x10, 0x17, 0x12, 0x1f, 0x0a, 0x1b, 0x44, 0x42, 0x47, 0x5f, + 0x4c, 0x42, 0x36, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x5f, 0x42, 0x41, 0x43, 0x4b, 0x45, + 0x4e, 0x44, 0x5f, 0x53, 0x4c, 0x4f, 0x54, 0x10, 0x18, 0x12, 0x27, 0x0a, 0x23, 0x44, 0x42, 0x47, + 0x5f, 0x4c, 0x42, 0x36, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x5f, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x53, 0x4c, 0x4f, 0x54, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, - 0x10, 0x21, 0x12, 0x27, 0x0a, 0x23, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, 0x34, 0x5f, 0x4c, 0x4f, + 0x10, 0x19, 0x12, 0x27, 0x0a, 0x23, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, 0x36, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x5f, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x53, 0x4c, 0x4f, - 0x54, 0x5f, 0x56, 0x32, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x10, 0x22, 0x12, 0x1f, 0x0a, 0x1b, 0x44, - 0x42, 0x47, 0x5f, 0x4c, 0x42, 0x34, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x5f, 0x42, 0x41, - 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x10, 0x23, 0x12, 0x1e, 0x0a, 0x1a, - 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, 0x34, 0x5f, 0x52, 0x45, 0x56, 0x45, 0x52, 0x53, 0x45, 0x5f, - 0x4e, 0x41, 0x54, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x10, 0x24, 0x12, 0x17, 0x0a, 0x13, - 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, 0x34, 0x5f, 0x52, 0x45, 0x56, 0x45, 0x52, 0x53, 0x45, 0x5f, - 0x4e, 0x41, 0x54, 0x10, 0x25, 0x12, 0x19, 0x0a, 0x15, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, 0x34, - 0x5f, 0x4c, 0x4f, 0x4f, 0x50, 0x42, 0x41, 0x43, 0x4b, 0x5f, 0x53, 0x4e, 0x41, 0x54, 0x10, 0x26, - 0x12, 0x1d, 0x0a, 0x19, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, 0x34, 0x5f, 0x4c, 0x4f, 0x4f, 0x50, - 0x42, 0x41, 0x43, 0x4b, 0x5f, 0x53, 0x4e, 0x41, 0x54, 0x5f, 0x52, 0x45, 0x56, 0x10, 0x27, 0x12, - 0x12, 0x0a, 0x0e, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x54, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, - 0x34, 0x10, 0x28, 0x12, 0x1b, 0x0a, 0x17, 0x44, 0x42, 0x47, 0x5f, 0x52, 0x52, 0x5f, 0x42, 0x41, - 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x53, 0x4c, 0x4f, 0x54, 0x5f, 0x53, 0x45, 0x4c, 0x10, 0x29, - 0x12, 0x18, 0x0a, 0x14, 0x44, 0x42, 0x47, 0x5f, 0x52, 0x45, 0x56, 0x5f, 0x50, 0x52, 0x4f, 0x58, - 0x59, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x10, 0x2a, 0x12, 0x17, 0x0a, 0x13, 0x44, 0x42, - 0x47, 0x5f, 0x52, 0x45, 0x56, 0x5f, 0x50, 0x52, 0x4f, 0x58, 0x59, 0x5f, 0x46, 0x4f, 0x55, 0x4e, - 0x44, 0x10, 0x2b, 0x12, 0x18, 0x0a, 0x14, 0x44, 0x42, 0x47, 0x5f, 0x52, 0x45, 0x56, 0x5f, 0x50, - 0x52, 0x4f, 0x58, 0x59, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x2c, 0x12, 0x11, 0x0a, - 0x0d, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x34, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x10, 0x2d, - 0x12, 0x19, 0x0a, 0x15, 0x44, 0x42, 0x47, 0x5f, 0x4e, 0x45, 0x54, 0x44, 0x45, 0x56, 0x5f, 0x49, - 0x4e, 0x5f, 0x43, 0x4c, 0x55, 0x53, 0x54, 0x45, 0x52, 0x10, 0x2e, 0x12, 0x15, 0x0a, 0x11, 0x44, - 0x42, 0x47, 0x5f, 0x4e, 0x45, 0x54, 0x44, 0x45, 0x56, 0x5f, 0x45, 0x4e, 0x43, 0x41, 0x50, 0x34, - 0x10, 0x2f, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x54, 0x5f, 0x4c, 0x4f, 0x4f, - 0x4b, 0x55, 0x50, 0x34, 0x5f, 0x31, 0x10, 0x30, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x42, 0x47, 0x5f, - 0x43, 0x54, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x34, 0x5f, 0x32, 0x10, 0x31, 0x12, 0x13, - 0x0a, 0x0f, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x54, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x44, - 0x34, 0x10, 0x32, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x54, 0x5f, 0x4c, 0x4f, - 0x4f, 0x4b, 0x55, 0x50, 0x36, 0x5f, 0x31, 0x10, 0x33, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x42, 0x47, - 0x5f, 0x43, 0x54, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x36, 0x5f, 0x32, 0x10, 0x34, 0x12, - 0x13, 0x0a, 0x0f, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x54, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, - 0x44, 0x36, 0x10, 0x35, 0x12, 0x12, 0x0a, 0x0e, 0x44, 0x42, 0x47, 0x5f, 0x53, 0x4b, 0x49, 0x50, - 0x5f, 0x50, 0x52, 0x4f, 0x58, 0x59, 0x10, 0x36, 0x12, 0x11, 0x0a, 0x0d, 0x44, 0x42, 0x47, 0x5f, - 0x4c, 0x34, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x10, 0x37, 0x12, 0x19, 0x0a, 0x15, 0x44, - 0x42, 0x47, 0x5f, 0x49, 0x50, 0x5f, 0x49, 0x44, 0x5f, 0x4d, 0x41, 0x50, 0x5f, 0x46, 0x41, 0x49, - 0x4c, 0x45, 0x44, 0x34, 0x10, 0x38, 0x12, 0x19, 0x0a, 0x15, 0x44, 0x42, 0x47, 0x5f, 0x49, 0x50, - 0x5f, 0x49, 0x44, 0x5f, 0x4d, 0x41, 0x50, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x36, 0x10, - 0x39, 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x42, 0x47, 0x5f, 0x49, 0x50, 0x5f, 0x49, 0x44, 0x5f, 0x4d, - 0x41, 0x50, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x45, 0x44, 0x34, 0x10, 0x3a, 0x12, 0x1a, 0x0a, + 0x54, 0x5f, 0x56, 0x32, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x10, 0x1a, 0x12, 0x1f, 0x0a, 0x1b, 0x44, + 0x42, 0x47, 0x5f, 0x4c, 0x42, 0x36, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x5f, 0x42, 0x41, + 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x10, 0x1b, 0x12, 0x1e, 0x0a, 0x1a, + 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, 0x36, 0x5f, 0x52, 0x45, 0x56, 0x45, 0x52, 0x53, 0x45, 0x5f, + 0x4e, 0x41, 0x54, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x10, 0x1c, 0x12, 0x17, 0x0a, 0x13, + 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, 0x36, 0x5f, 0x52, 0x45, 0x56, 0x45, 0x52, 0x53, 0x45, 0x5f, + 0x4e, 0x41, 0x54, 0x10, 0x1d, 0x12, 0x1b, 0x0a, 0x17, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, 0x34, + 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x5f, 0x46, 0x52, 0x4f, 0x4e, 0x54, 0x45, 0x4e, 0x44, + 0x10, 0x1e, 0x12, 0x20, 0x0a, 0x1c, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, 0x34, 0x5f, 0x4c, 0x4f, + 0x4f, 0x4b, 0x55, 0x50, 0x5f, 0x46, 0x52, 0x4f, 0x4e, 0x54, 0x45, 0x4e, 0x44, 0x5f, 0x46, 0x41, + 0x49, 0x4c, 0x10, 0x1f, 0x12, 0x1f, 0x0a, 0x1b, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, 0x34, 0x5f, + 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x5f, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x53, + 0x4c, 0x4f, 0x54, 0x10, 0x20, 0x12, 0x27, 0x0a, 0x23, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, 0x34, + 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x5f, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, + 0x53, 0x4c, 0x4f, 0x54, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x21, 0x12, 0x27, + 0x0a, 0x23, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, 0x34, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, + 0x5f, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x53, 0x4c, 0x4f, 0x54, 0x5f, 0x56, 0x32, + 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x10, 0x22, 0x12, 0x1f, 0x0a, 0x1b, 0x44, 0x42, 0x47, 0x5f, 0x4c, + 0x42, 0x34, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x5f, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, + 0x44, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x10, 0x23, 0x12, 0x1e, 0x0a, 0x1a, 0x44, 0x42, 0x47, 0x5f, + 0x4c, 0x42, 0x34, 0x5f, 0x52, 0x45, 0x56, 0x45, 0x52, 0x53, 0x45, 0x5f, 0x4e, 0x41, 0x54, 0x5f, + 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x10, 0x24, 0x12, 0x17, 0x0a, 0x13, 0x44, 0x42, 0x47, 0x5f, + 0x4c, 0x42, 0x34, 0x5f, 0x52, 0x45, 0x56, 0x45, 0x52, 0x53, 0x45, 0x5f, 0x4e, 0x41, 0x54, 0x10, + 0x25, 0x12, 0x19, 0x0a, 0x15, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, 0x34, 0x5f, 0x4c, 0x4f, 0x4f, + 0x50, 0x42, 0x41, 0x43, 0x4b, 0x5f, 0x53, 0x4e, 0x41, 0x54, 0x10, 0x26, 0x12, 0x1d, 0x0a, 0x19, + 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, 0x34, 0x5f, 0x4c, 0x4f, 0x4f, 0x50, 0x42, 0x41, 0x43, 0x4b, + 0x5f, 0x53, 0x4e, 0x41, 0x54, 0x5f, 0x52, 0x45, 0x56, 0x10, 0x27, 0x12, 0x12, 0x0a, 0x0e, 0x44, + 0x42, 0x47, 0x5f, 0x43, 0x54, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x34, 0x10, 0x28, 0x12, + 0x1b, 0x0a, 0x17, 0x44, 0x42, 0x47, 0x5f, 0x52, 0x52, 0x5f, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, + 0x44, 0x5f, 0x53, 0x4c, 0x4f, 0x54, 0x5f, 0x53, 0x45, 0x4c, 0x10, 0x29, 0x12, 0x18, 0x0a, 0x14, + 0x44, 0x42, 0x47, 0x5f, 0x52, 0x45, 0x56, 0x5f, 0x50, 0x52, 0x4f, 0x58, 0x59, 0x5f, 0x4c, 0x4f, + 0x4f, 0x4b, 0x55, 0x50, 0x10, 0x2a, 0x12, 0x17, 0x0a, 0x13, 0x44, 0x42, 0x47, 0x5f, 0x52, 0x45, + 0x56, 0x5f, 0x50, 0x52, 0x4f, 0x58, 0x59, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x2b, 0x12, + 0x18, 0x0a, 0x14, 0x44, 0x42, 0x47, 0x5f, 0x52, 0x45, 0x56, 0x5f, 0x50, 0x52, 0x4f, 0x58, 0x59, + 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x2c, 0x12, 0x11, 0x0a, 0x0d, 0x44, 0x42, 0x47, + 0x5f, 0x4c, 0x34, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x10, 0x2d, 0x12, 0x19, 0x0a, 0x15, + 0x44, 0x42, 0x47, 0x5f, 0x4e, 0x45, 0x54, 0x44, 0x45, 0x56, 0x5f, 0x49, 0x4e, 0x5f, 0x43, 0x4c, + 0x55, 0x53, 0x54, 0x45, 0x52, 0x10, 0x2e, 0x12, 0x15, 0x0a, 0x11, 0x44, 0x42, 0x47, 0x5f, 0x4e, + 0x45, 0x54, 0x44, 0x45, 0x56, 0x5f, 0x45, 0x4e, 0x43, 0x41, 0x50, 0x34, 0x10, 0x2f, 0x12, 0x14, + 0x0a, 0x10, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x54, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x34, + 0x5f, 0x31, 0x10, 0x30, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x54, 0x5f, 0x4c, + 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x34, 0x5f, 0x32, 0x10, 0x31, 0x12, 0x13, 0x0a, 0x0f, 0x44, 0x42, + 0x47, 0x5f, 0x43, 0x54, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x44, 0x34, 0x10, 0x32, 0x12, + 0x14, 0x0a, 0x10, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x54, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, + 0x36, 0x5f, 0x31, 0x10, 0x33, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x42, 0x47, 0x5f, 0x43, 0x54, 0x5f, + 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x36, 0x5f, 0x32, 0x10, 0x34, 0x12, 0x13, 0x0a, 0x0f, 0x44, + 0x42, 0x47, 0x5f, 0x43, 0x54, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x44, 0x36, 0x10, 0x35, + 0x12, 0x12, 0x0a, 0x0e, 0x44, 0x42, 0x47, 0x5f, 0x53, 0x4b, 0x49, 0x50, 0x5f, 0x50, 0x52, 0x4f, + 0x58, 0x59, 0x10, 0x36, 0x12, 0x11, 0x0a, 0x0d, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x34, 0x5f, 0x43, + 0x52, 0x45, 0x41, 0x54, 0x45, 0x10, 0x37, 0x12, 0x19, 0x0a, 0x15, 0x44, 0x42, 0x47, 0x5f, 0x49, + 0x50, 0x5f, 0x49, 0x44, 0x5f, 0x4d, 0x41, 0x50, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x34, + 0x10, 0x38, 0x12, 0x19, 0x0a, 0x15, 0x44, 0x42, 0x47, 0x5f, 0x49, 0x50, 0x5f, 0x49, 0x44, 0x5f, + 0x4d, 0x41, 0x50, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x36, 0x10, 0x39, 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x42, 0x47, 0x5f, 0x49, 0x50, 0x5f, 0x49, 0x44, 0x5f, 0x4d, 0x41, 0x50, 0x5f, 0x53, - 0x55, 0x43, 0x43, 0x45, 0x45, 0x44, 0x36, 0x10, 0x3b, 0x12, 0x13, 0x0a, 0x0f, 0x44, 0x42, 0x47, - 0x5f, 0x4c, 0x42, 0x5f, 0x53, 0x54, 0x41, 0x4c, 0x45, 0x5f, 0x43, 0x54, 0x10, 0x3c, 0x12, 0x18, - 0x0a, 0x14, 0x44, 0x42, 0x47, 0x5f, 0x49, 0x4e, 0x48, 0x45, 0x52, 0x49, 0x54, 0x5f, 0x49, 0x44, - 0x45, 0x4e, 0x54, 0x49, 0x54, 0x59, 0x10, 0x3d, 0x12, 0x12, 0x0a, 0x0e, 0x44, 0x42, 0x47, 0x5f, - 0x53, 0x4b, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x34, 0x10, 0x3e, 0x12, 0x12, 0x0a, 0x0e, - 0x44, 0x42, 0x47, 0x5f, 0x53, 0x4b, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x36, 0x10, 0x3f, - 0x12, 0x11, 0x0a, 0x0d, 0x44, 0x42, 0x47, 0x5f, 0x53, 0x4b, 0x5f, 0x41, 0x53, 0x53, 0x49, 0x47, - 0x4e, 0x10, 0x40, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x37, 0x5f, 0x4c, 0x42, - 0x10, 0x41, 0x12, 0x13, 0x0a, 0x0f, 0x44, 0x42, 0x47, 0x5f, 0x53, 0x4b, 0x49, 0x50, 0x5f, 0x50, - 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x10, 0x42, 0x42, 0x26, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x63, 0x69, 0x6c, - 0x69, 0x75, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x6c, 0x6f, 0x77, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x55, 0x43, 0x43, 0x45, 0x45, 0x44, 0x34, 0x10, 0x3a, 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x42, 0x47, + 0x5f, 0x49, 0x50, 0x5f, 0x49, 0x44, 0x5f, 0x4d, 0x41, 0x50, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, + 0x45, 0x44, 0x36, 0x10, 0x3b, 0x12, 0x13, 0x0a, 0x0f, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x42, 0x5f, + 0x53, 0x54, 0x41, 0x4c, 0x45, 0x5f, 0x43, 0x54, 0x10, 0x3c, 0x12, 0x18, 0x0a, 0x14, 0x44, 0x42, + 0x47, 0x5f, 0x49, 0x4e, 0x48, 0x45, 0x52, 0x49, 0x54, 0x5f, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x49, + 0x54, 0x59, 0x10, 0x3d, 0x12, 0x12, 0x0a, 0x0e, 0x44, 0x42, 0x47, 0x5f, 0x53, 0x4b, 0x5f, 0x4c, + 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x34, 0x10, 0x3e, 0x12, 0x12, 0x0a, 0x0e, 0x44, 0x42, 0x47, 0x5f, + 0x53, 0x4b, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x36, 0x10, 0x3f, 0x12, 0x11, 0x0a, 0x0d, + 0x44, 0x42, 0x47, 0x5f, 0x53, 0x4b, 0x5f, 0x41, 0x53, 0x53, 0x49, 0x47, 0x4e, 0x10, 0x40, 0x12, + 0x0d, 0x0a, 0x09, 0x44, 0x42, 0x47, 0x5f, 0x4c, 0x37, 0x5f, 0x4c, 0x42, 0x10, 0x41, 0x12, 0x13, + 0x0a, 0x0f, 0x44, 0x42, 0x47, 0x5f, 0x53, 0x4b, 0x49, 0x50, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, + 0x59, 0x10, 0x42, 0x42, 0x26, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x6c, 0x6f, 0x77, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -5814,39 +5864,40 @@ var file_flow_flow_proto_depIdxs = []int32{ 8, // 42: flow.FlowFilter.traffic_direction:type_name -> flow.TrafficDirection 6, // 43: flow.FlowFilter.verdict:type_name -> flow.Verdict 7, // 44: flow.FlowFilter.drop_reason_desc:type_name -> flow.DropReason - 31, // 45: flow.FlowFilter.event_type:type_name -> flow.EventTypeFilter - 35, // 46: flow.FlowFilter.http_header:type_name -> flow.HTTPHeader - 25, // 47: flow.FlowFilter.tcp_flags:type_name -> flow.TCPFlags - 5, // 48: flow.FlowFilter.ip_version:type_name -> flow.IPVersion - 52, // 49: flow.FlowFilter.experimental:type_name -> flow.FlowFilter.Experimental - 35, // 50: flow.HTTP.headers:type_name -> flow.HTTPHeader - 11, // 51: flow.LostEvent.source:type_name -> flow.LostEventSource - 56, // 52: flow.LostEvent.cpu:type_name -> google.protobuf.Int32Value - 12, // 53: flow.AgentEvent.type:type_name -> flow.AgentEventType - 41, // 54: flow.AgentEvent.unknown:type_name -> flow.AgentEventUnknown - 42, // 55: flow.AgentEvent.agent_start:type_name -> flow.TimeNotification - 43, // 56: flow.AgentEvent.policy_update:type_name -> flow.PolicyUpdateNotification - 44, // 57: flow.AgentEvent.endpoint_regenerate:type_name -> flow.EndpointRegenNotification - 45, // 58: flow.AgentEvent.endpoint_update:type_name -> flow.EndpointUpdateNotification - 46, // 59: flow.AgentEvent.ipcache_update:type_name -> flow.IPCacheNotification - 48, // 60: flow.AgentEvent.service_upsert:type_name -> flow.ServiceUpsertNotification - 49, // 61: flow.AgentEvent.service_delete:type_name -> flow.ServiceDeleteNotification - 53, // 62: flow.TimeNotification.time:type_name -> google.protobuf.Timestamp - 57, // 63: flow.IPCacheNotification.old_identity:type_name -> google.protobuf.UInt32Value - 47, // 64: flow.ServiceUpsertNotification.frontend_address:type_name -> flow.ServiceUpsertNotificationAddr - 47, // 65: flow.ServiceUpsertNotification.backend_addresses:type_name -> flow.ServiceUpsertNotificationAddr - 14, // 66: flow.DebugEvent.type:type_name -> flow.DebugEventType - 20, // 67: flow.DebugEvent.source:type_name -> flow.Endpoint - 57, // 68: flow.DebugEvent.hash:type_name -> google.protobuf.UInt32Value - 57, // 69: flow.DebugEvent.arg1:type_name -> google.protobuf.UInt32Value - 57, // 70: flow.DebugEvent.arg2:type_name -> google.protobuf.UInt32Value - 57, // 71: flow.DebugEvent.arg3:type_name -> google.protobuf.UInt32Value - 56, // 72: flow.DebugEvent.cpu:type_name -> google.protobuf.Int32Value - 73, // [73:73] is the sub-list for method output_type - 73, // [73:73] is the sub-list for method input_type - 73, // [73:73] is the sub-list for extension type_name - 73, // [73:73] is the sub-list for extension extendee - 0, // [0:73] is the sub-list for field type_name + 50, // 45: flow.FlowFilter.interface:type_name -> flow.NetworkInterface + 31, // 46: flow.FlowFilter.event_type:type_name -> flow.EventTypeFilter + 35, // 47: flow.FlowFilter.http_header:type_name -> flow.HTTPHeader + 25, // 48: flow.FlowFilter.tcp_flags:type_name -> flow.TCPFlags + 5, // 49: flow.FlowFilter.ip_version:type_name -> flow.IPVersion + 52, // 50: flow.FlowFilter.experimental:type_name -> flow.FlowFilter.Experimental + 35, // 51: flow.HTTP.headers:type_name -> flow.HTTPHeader + 11, // 52: flow.LostEvent.source:type_name -> flow.LostEventSource + 56, // 53: flow.LostEvent.cpu:type_name -> google.protobuf.Int32Value + 12, // 54: flow.AgentEvent.type:type_name -> flow.AgentEventType + 41, // 55: flow.AgentEvent.unknown:type_name -> flow.AgentEventUnknown + 42, // 56: flow.AgentEvent.agent_start:type_name -> flow.TimeNotification + 43, // 57: flow.AgentEvent.policy_update:type_name -> flow.PolicyUpdateNotification + 44, // 58: flow.AgentEvent.endpoint_regenerate:type_name -> flow.EndpointRegenNotification + 45, // 59: flow.AgentEvent.endpoint_update:type_name -> flow.EndpointUpdateNotification + 46, // 60: flow.AgentEvent.ipcache_update:type_name -> flow.IPCacheNotification + 48, // 61: flow.AgentEvent.service_upsert:type_name -> flow.ServiceUpsertNotification + 49, // 62: flow.AgentEvent.service_delete:type_name -> flow.ServiceDeleteNotification + 53, // 63: flow.TimeNotification.time:type_name -> google.protobuf.Timestamp + 57, // 64: flow.IPCacheNotification.old_identity:type_name -> google.protobuf.UInt32Value + 47, // 65: flow.ServiceUpsertNotification.frontend_address:type_name -> flow.ServiceUpsertNotificationAddr + 47, // 66: flow.ServiceUpsertNotification.backend_addresses:type_name -> flow.ServiceUpsertNotificationAddr + 14, // 67: flow.DebugEvent.type:type_name -> flow.DebugEventType + 20, // 68: flow.DebugEvent.source:type_name -> flow.Endpoint + 57, // 69: flow.DebugEvent.hash:type_name -> google.protobuf.UInt32Value + 57, // 70: flow.DebugEvent.arg1:type_name -> google.protobuf.UInt32Value + 57, // 71: flow.DebugEvent.arg2:type_name -> google.protobuf.UInt32Value + 57, // 72: flow.DebugEvent.arg3:type_name -> google.protobuf.UInt32Value + 56, // 73: flow.DebugEvent.cpu:type_name -> google.protobuf.Int32Value + 74, // [74:74] is the sub-list for method output_type + 74, // [74:74] is the sub-list for method input_type + 74, // [74:74] is the sub-list for extension type_name + 74, // [74:74] is the sub-list for extension extendee + 0, // [0:74] is the sub-list for field type_name } func init() { file_flow_flow_proto_init() } diff --git a/vendor/github.com/cilium/cilium/api/v1/flow/flow.pb.json.go b/vendor/github.com/cilium/cilium/api/v1/flow/flow.pb.json.go index faad3adca..3ce01d7ba 100644 --- a/vendor/github.com/cilium/cilium/api/v1/flow/flow.pb.json.go +++ b/vendor/github.com/cilium/cilium/api/v1/flow/flow.pb.json.go @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Authors of Hubble + // Code generated by protoc-gen-go-json. DO NOT EDIT. // source: flow/flow.proto @@ -10,607 +13,455 @@ import ( // MarshalJSON implements json.Marshaler func (msg *Flow) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *Flow) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *Layer4) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *Layer4) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *Layer7) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *Layer7) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *TraceContext) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *TraceContext) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *TraceParent) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *TraceParent) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *Endpoint) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *Endpoint) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *Workload) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *Workload) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *TCP) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *TCP) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *IP) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *IP) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *Ethernet) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *Ethernet) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *TCPFlags) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *TCPFlags) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *UDP) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *UDP) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *SCTP) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *SCTP) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *ICMPv4) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *ICMPv4) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *ICMPv6) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *ICMPv6) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *Policy) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *Policy) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *EventTypeFilter) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *EventTypeFilter) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *CiliumEventType) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *CiliumEventType) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *FlowFilter) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *FlowFilter) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *FlowFilter_Experimental) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *FlowFilter_Experimental) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *DNS) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *DNS) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *HTTPHeader) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *HTTPHeader) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *HTTP) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *HTTP) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *Kafka) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *Kafka) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *Service) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *Service) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *LostEvent) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *LostEvent) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *AgentEvent) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *AgentEvent) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *AgentEventUnknown) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *AgentEventUnknown) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *TimeNotification) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *TimeNotification) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *PolicyUpdateNotification) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *PolicyUpdateNotification) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *EndpointRegenNotification) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *EndpointRegenNotification) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *EndpointUpdateNotification) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *EndpointUpdateNotification) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *IPCacheNotification) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *IPCacheNotification) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *ServiceUpsertNotificationAddr) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *ServiceUpsertNotificationAddr) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *ServiceUpsertNotification) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *ServiceUpsertNotification) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *ServiceDeleteNotification) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *ServiceDeleteNotification) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *NetworkInterface) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *NetworkInterface) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *DebugEvent) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *DebugEvent) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } diff --git a/vendor/github.com/cilium/cilium/api/v1/flow/flow.proto b/vendor/github.com/cilium/cilium/api/v1/flow/flow.proto index 3d7905bc0..990f91876 100644 --- a/vendor/github.com/cilium/cilium/api/v1/flow/flow.proto +++ b/vendor/github.com/cilium/cilium/api/v1/flow/flow.proto @@ -252,6 +252,7 @@ message TraceParent { message Endpoint { uint32 ID = 1; uint32 identity = 2; + string cluster_name = 7; string namespace = 3; // labels in `foo=bar` format. repeated string labels = 4; @@ -272,6 +273,9 @@ message TCP { message IP { string source = 1; + // source_xlated is the post translation source IP when the flow was SNATed + // (and in that case source is the the original source IP). + string source_xlated = 5; string destination = 2; IPVersion ipVersion = 3; // This field indicates whether the TraceReasonEncryptMask is set or not. @@ -409,7 +413,7 @@ enum DropReason { INVALID_VNI = 183; INVALID_TC_BUFFER = 184; NO_SID = 185; - MISSING_SRV6_STATE = 186; + MISSING_SRV6_STATE = 186 [deprecated = true]; NAT46 = 187; NAT64 = 188; AUTH_REQUIRED = 189; @@ -496,6 +500,10 @@ message FlowFilter { // specified as an exact match (e.g. "1.1.1.1") or as a CIDR range (e.g. // "1.1.1.0/24"). repeated string source_ip = 1; + // source_ip_xlated filters by a list IPs. Each of the IPs can be specified + // as an exact match (e.g. "1.1.1.1") or as a CIDR range (e.g. + // "1.1.1.0/24"). + repeated string source_ip_xlated = 34; // source_pod filters by a list of source pod name prefixes, optionally // within a given namespace (e.g. "xwing", "kube-system/coredns-"). // The pod name can be omitted to only filter by namespace @@ -531,11 +539,12 @@ message FlowFilter { // traffic_direction filters flow by direction of the connection, e.g. // ingress or egress. repeated TrafficDirection traffic_direction = 30; - // only return Flows that were classified with a particular verdict. repeated Verdict verdict = 5; // only applicable to Verdict = DROPPED (e.g. "POLICY_DENIED", "UNSUPPORTED_L3_PROTOCOL") - repeated DropReason drop_reason_desc = 35; + repeated DropReason drop_reason_desc = 33; + // interface is the network interface on which this flow was observed. + repeated NetworkInterface interface = 35; // event_type is the list of event types to filter on repeated EventTypeFilter event_type = 6; // http_status_code is a list of string prefixes (e.g. "4+", "404", "5+") @@ -593,7 +602,7 @@ message FlowFilter { // Using CEL has performance cost compared to other filters, so prefer // using non-CEL filters when possible, and try to specify CEL filters // last in the list of FlowFilters. - repeated string cel_expression = 33; + repeated string cel_expression = 1; } // experimental contains filters that are not stable yet. Support for // experimental features is always optional and subject to change. diff --git a/vendor/github.com/cilium/cilium/api/v1/health/client/cilium_health_api_client.go b/vendor/github.com/cilium/cilium/api/v1/health/client/cilium_health_api_client.go deleted file mode 100644 index b6887e63d..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/health/client/cilium_health_api_client.go +++ /dev/null @@ -1,120 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package client - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "github.com/go-openapi/runtime" - httptransport "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/health/client/connectivity" - "github.com/cilium/cilium/api/v1/health/client/restapi" -) - -// Default cilium health API HTTP client. -var Default = NewHTTPClient(nil) - -const ( - // DefaultHost is the default Host - // found in Meta (info) section of spec file - DefaultHost string = "localhost" - // DefaultBasePath is the default BasePath - // found in Meta (info) section of spec file - DefaultBasePath string = "/v1beta" -) - -// DefaultSchemes are the default schemes found in Meta (info) section of spec file -var DefaultSchemes = []string{"http"} - -// NewHTTPClient creates a new cilium health API HTTP client. -func NewHTTPClient(formats strfmt.Registry) *CiliumHealthAPI { - return NewHTTPClientWithConfig(formats, nil) -} - -// NewHTTPClientWithConfig creates a new cilium health API HTTP client, -// using a customizable transport config. -func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *CiliumHealthAPI { - // ensure nullable parameters have default - if cfg == nil { - cfg = DefaultTransportConfig() - } - - // create transport and client - transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes) - return New(transport, formats) -} - -// New creates a new cilium health API client -func New(transport runtime.ClientTransport, formats strfmt.Registry) *CiliumHealthAPI { - // ensure nullable parameters have default - if formats == nil { - formats = strfmt.Default - } - - cli := new(CiliumHealthAPI) - cli.Transport = transport - cli.Connectivity = connectivity.New(transport, formats) - cli.Restapi = restapi.New(transport, formats) - return cli -} - -// DefaultTransportConfig creates a TransportConfig with the -// default settings taken from the meta section of the spec file. -func DefaultTransportConfig() *TransportConfig { - return &TransportConfig{ - Host: DefaultHost, - BasePath: DefaultBasePath, - Schemes: DefaultSchemes, - } -} - -// TransportConfig contains the transport related info, -// found in the meta section of the spec file. -type TransportConfig struct { - Host string - BasePath string - Schemes []string -} - -// WithHost overrides the default host, -// provided by the meta section of the spec file. -func (cfg *TransportConfig) WithHost(host string) *TransportConfig { - cfg.Host = host - return cfg -} - -// WithBasePath overrides the default basePath, -// provided by the meta section of the spec file. -func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig { - cfg.BasePath = basePath - return cfg -} - -// WithSchemes overrides the default schemes, -// provided by the meta section of the spec file. -func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { - cfg.Schemes = schemes - return cfg -} - -// CiliumHealthAPI is a client for cilium health API -type CiliumHealthAPI struct { - Connectivity connectivity.ClientService - - Restapi restapi.ClientService - - Transport runtime.ClientTransport -} - -// SetTransport changes the transport on the client and all its subresources -func (c *CiliumHealthAPI) SetTransport(transport runtime.ClientTransport) { - c.Transport = transport - c.Connectivity.SetTransport(transport) - c.Restapi.SetTransport(transport) -} diff --git a/vendor/github.com/cilium/cilium/api/v1/health/client/connectivity/connectivity_client.go b/vendor/github.com/cilium/cilium/api/v1/health/client/connectivity/connectivity_client.go deleted file mode 100644 index b8918f4b2..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/health/client/connectivity/connectivity_client.go +++ /dev/null @@ -1,130 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package connectivity - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// New creates a new connectivity API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { - return &Client{transport: transport, formats: formats} -} - -/* -Client for connectivity API -*/ -type Client struct { - transport runtime.ClientTransport - formats strfmt.Registry -} - -// ClientOption is the option for Client methods -type ClientOption func(*runtime.ClientOperation) - -// ClientService is the interface for Client methods -type ClientService interface { - GetStatus(params *GetStatusParams, opts ...ClientOption) (*GetStatusOK, error) - - PutStatusProbe(params *PutStatusProbeParams, opts ...ClientOption) (*PutStatusProbeOK, error) - - SetTransport(transport runtime.ClientTransport) -} - -/* - GetStatus gets connectivity status of the cilium cluster - - Returns the connectivity status to all other cilium-health instances - -using interval-based probing. -*/ -func (a *Client) GetStatus(params *GetStatusParams, opts ...ClientOption) (*GetStatusOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetStatusParams() - } - op := &runtime.ClientOperation{ - ID: "GetStatus", - Method: "GET", - PathPattern: "/status", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetStatusReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetStatusOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetStatus: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* - PutStatusProbe runs synchronous connectivity probe to determine status of the cilium cluster - - Runs a synchronous probe to all other cilium-health instances and - -returns the connectivity status. -*/ -func (a *Client) PutStatusProbe(params *PutStatusProbeParams, opts ...ClientOption) (*PutStatusProbeOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPutStatusProbeParams() - } - op := &runtime.ClientOperation{ - ID: "PutStatusProbe", - Method: "PUT", - PathPattern: "/status/probe", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PutStatusProbeReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*PutStatusProbeOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PutStatusProbe: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -// SetTransport changes the transport on the client -func (a *Client) SetTransport(transport runtime.ClientTransport) { - a.transport = transport -} diff --git a/vendor/github.com/cilium/cilium/api/v1/health/client/connectivity/get_status_parameters.go b/vendor/github.com/cilium/cilium/api/v1/health/client/connectivity/get_status_parameters.go deleted file mode 100644 index bf0cf9138..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/health/client/connectivity/get_status_parameters.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package connectivity - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetStatusParams creates a new GetStatusParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetStatusParams() *GetStatusParams { - return &GetStatusParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetStatusParamsWithTimeout creates a new GetStatusParams object -// with the ability to set a timeout on a request. -func NewGetStatusParamsWithTimeout(timeout time.Duration) *GetStatusParams { - return &GetStatusParams{ - timeout: timeout, - } -} - -// NewGetStatusParamsWithContext creates a new GetStatusParams object -// with the ability to set a context for a request. -func NewGetStatusParamsWithContext(ctx context.Context) *GetStatusParams { - return &GetStatusParams{ - Context: ctx, - } -} - -// NewGetStatusParamsWithHTTPClient creates a new GetStatusParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetStatusParamsWithHTTPClient(client *http.Client) *GetStatusParams { - return &GetStatusParams{ - HTTPClient: client, - } -} - -/* -GetStatusParams contains all the parameters to send to the API endpoint - - for the get status operation. - - Typically these are written to a http.Request. -*/ -type GetStatusParams struct { - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get status params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetStatusParams) WithDefaults() *GetStatusParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get status params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetStatusParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get status params -func (o *GetStatusParams) WithTimeout(timeout time.Duration) *GetStatusParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get status params -func (o *GetStatusParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get status params -func (o *GetStatusParams) WithContext(ctx context.Context) *GetStatusParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get status params -func (o *GetStatusParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get status params -func (o *GetStatusParams) WithHTTPClient(client *http.Client) *GetStatusParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get status params -func (o *GetStatusParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *GetStatusParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/health/client/connectivity/get_status_responses.go b/vendor/github.com/cilium/cilium/api/v1/health/client/connectivity/get_status_responses.go deleted file mode 100644 index a839504c5..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/health/client/connectivity/get_status_responses.go +++ /dev/null @@ -1,106 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package connectivity - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/health/models" -) - -// GetStatusReader is a Reader for the GetStatus structure. -type GetStatusReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetStatusReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetStatusOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - return nil, runtime.NewAPIError("[GET /status] GetStatus", response, response.Code()) - } -} - -// NewGetStatusOK creates a GetStatusOK with default headers values -func NewGetStatusOK() *GetStatusOK { - return &GetStatusOK{} -} - -/* -GetStatusOK describes a response with status code 200, with default header values. - -Success -*/ -type GetStatusOK struct { - Payload *models.HealthStatusResponse -} - -// IsSuccess returns true when this get status o k response has a 2xx status code -func (o *GetStatusOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get status o k response has a 3xx status code -func (o *GetStatusOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get status o k response has a 4xx status code -func (o *GetStatusOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get status o k response has a 5xx status code -func (o *GetStatusOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get status o k response a status code equal to that given -func (o *GetStatusOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get status o k response -func (o *GetStatusOK) Code() int { - return 200 -} - -func (o *GetStatusOK) Error() string { - return fmt.Sprintf("[GET /status][%d] getStatusOK %+v", 200, o.Payload) -} - -func (o *GetStatusOK) String() string { - return fmt.Sprintf("[GET /status][%d] getStatusOK %+v", 200, o.Payload) -} - -func (o *GetStatusOK) GetPayload() *models.HealthStatusResponse { - return o.Payload -} - -func (o *GetStatusOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HealthStatusResponse) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/health/client/connectivity/put_status_probe_parameters.go b/vendor/github.com/cilium/cilium/api/v1/health/client/connectivity/put_status_probe_parameters.go deleted file mode 100644 index 8708a9a2a..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/health/client/connectivity/put_status_probe_parameters.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package connectivity - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewPutStatusProbeParams creates a new PutStatusProbeParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewPutStatusProbeParams() *PutStatusProbeParams { - return &PutStatusProbeParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewPutStatusProbeParamsWithTimeout creates a new PutStatusProbeParams object -// with the ability to set a timeout on a request. -func NewPutStatusProbeParamsWithTimeout(timeout time.Duration) *PutStatusProbeParams { - return &PutStatusProbeParams{ - timeout: timeout, - } -} - -// NewPutStatusProbeParamsWithContext creates a new PutStatusProbeParams object -// with the ability to set a context for a request. -func NewPutStatusProbeParamsWithContext(ctx context.Context) *PutStatusProbeParams { - return &PutStatusProbeParams{ - Context: ctx, - } -} - -// NewPutStatusProbeParamsWithHTTPClient creates a new PutStatusProbeParams object -// with the ability to set a custom HTTPClient for a request. -func NewPutStatusProbeParamsWithHTTPClient(client *http.Client) *PutStatusProbeParams { - return &PutStatusProbeParams{ - HTTPClient: client, - } -} - -/* -PutStatusProbeParams contains all the parameters to send to the API endpoint - - for the put status probe operation. - - Typically these are written to a http.Request. -*/ -type PutStatusProbeParams struct { - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the put status probe params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PutStatusProbeParams) WithDefaults() *PutStatusProbeParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the put status probe params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PutStatusProbeParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the put status probe params -func (o *PutStatusProbeParams) WithTimeout(timeout time.Duration) *PutStatusProbeParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the put status probe params -func (o *PutStatusProbeParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the put status probe params -func (o *PutStatusProbeParams) WithContext(ctx context.Context) *PutStatusProbeParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the put status probe params -func (o *PutStatusProbeParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the put status probe params -func (o *PutStatusProbeParams) WithHTTPClient(client *http.Client) *PutStatusProbeParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the put status probe params -func (o *PutStatusProbeParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *PutStatusProbeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/health/client/connectivity/put_status_probe_responses.go b/vendor/github.com/cilium/cilium/api/v1/health/client/connectivity/put_status_probe_responses.go deleted file mode 100644 index 2c392753f..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/health/client/connectivity/put_status_probe_responses.go +++ /dev/null @@ -1,240 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package connectivity - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/health/models" -) - -// PutStatusProbeReader is a Reader for the PutStatusProbe structure. -type PutStatusProbeReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *PutStatusProbeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewPutStatusProbeOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 403: - result := NewPutStatusProbeForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewPutStatusProbeFailed() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[PUT /status/probe] PutStatusProbe", response, response.Code()) - } -} - -// NewPutStatusProbeOK creates a PutStatusProbeOK with default headers values -func NewPutStatusProbeOK() *PutStatusProbeOK { - return &PutStatusProbeOK{} -} - -/* -PutStatusProbeOK describes a response with status code 200, with default header values. - -Success -*/ -type PutStatusProbeOK struct { - Payload *models.HealthStatusResponse -} - -// IsSuccess returns true when this put status probe o k response has a 2xx status code -func (o *PutStatusProbeOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this put status probe o k response has a 3xx status code -func (o *PutStatusProbeOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put status probe o k response has a 4xx status code -func (o *PutStatusProbeOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this put status probe o k response has a 5xx status code -func (o *PutStatusProbeOK) IsServerError() bool { - return false -} - -// IsCode returns true when this put status probe o k response a status code equal to that given -func (o *PutStatusProbeOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the put status probe o k response -func (o *PutStatusProbeOK) Code() int { - return 200 -} - -func (o *PutStatusProbeOK) Error() string { - return fmt.Sprintf("[PUT /status/probe][%d] putStatusProbeOK %+v", 200, o.Payload) -} - -func (o *PutStatusProbeOK) String() string { - return fmt.Sprintf("[PUT /status/probe][%d] putStatusProbeOK %+v", 200, o.Payload) -} - -func (o *PutStatusProbeOK) GetPayload() *models.HealthStatusResponse { - return o.Payload -} - -func (o *PutStatusProbeOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HealthStatusResponse) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewPutStatusProbeForbidden creates a PutStatusProbeForbidden with default headers values -func NewPutStatusProbeForbidden() *PutStatusProbeForbidden { - return &PutStatusProbeForbidden{} -} - -/* -PutStatusProbeForbidden describes a response with status code 403, with default header values. - -Forbidden -*/ -type PutStatusProbeForbidden struct { -} - -// IsSuccess returns true when this put status probe forbidden response has a 2xx status code -func (o *PutStatusProbeForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put status probe forbidden response has a 3xx status code -func (o *PutStatusProbeForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put status probe forbidden response has a 4xx status code -func (o *PutStatusProbeForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this put status probe forbidden response has a 5xx status code -func (o *PutStatusProbeForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this put status probe forbidden response a status code equal to that given -func (o *PutStatusProbeForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the put status probe forbidden response -func (o *PutStatusProbeForbidden) Code() int { - return 403 -} - -func (o *PutStatusProbeForbidden) Error() string { - return fmt.Sprintf("[PUT /status/probe][%d] putStatusProbeForbidden ", 403) -} - -func (o *PutStatusProbeForbidden) String() string { - return fmt.Sprintf("[PUT /status/probe][%d] putStatusProbeForbidden ", 403) -} - -func (o *PutStatusProbeForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPutStatusProbeFailed creates a PutStatusProbeFailed with default headers values -func NewPutStatusProbeFailed() *PutStatusProbeFailed { - return &PutStatusProbeFailed{} -} - -/* -PutStatusProbeFailed describes a response with status code 500, with default header values. - -Internal error occurred while conducting connectivity probe -*/ -type PutStatusProbeFailed struct { - Payload models.Error -} - -// IsSuccess returns true when this put status probe failed response has a 2xx status code -func (o *PutStatusProbeFailed) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this put status probe failed response has a 3xx status code -func (o *PutStatusProbeFailed) IsRedirect() bool { - return false -} - -// IsClientError returns true when this put status probe failed response has a 4xx status code -func (o *PutStatusProbeFailed) IsClientError() bool { - return false -} - -// IsServerError returns true when this put status probe failed response has a 5xx status code -func (o *PutStatusProbeFailed) IsServerError() bool { - return true -} - -// IsCode returns true when this put status probe failed response a status code equal to that given -func (o *PutStatusProbeFailed) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the put status probe failed response -func (o *PutStatusProbeFailed) Code() int { - return 500 -} - -func (o *PutStatusProbeFailed) Error() string { - return fmt.Sprintf("[PUT /status/probe][%d] putStatusProbeFailed %+v", 500, o.Payload) -} - -func (o *PutStatusProbeFailed) String() string { - return fmt.Sprintf("[PUT /status/probe][%d] putStatusProbeFailed %+v", 500, o.Payload) -} - -func (o *PutStatusProbeFailed) GetPayload() models.Error { - return o.Payload -} - -func (o *PutStatusProbeFailed) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/health/client/restapi/get_healthz_parameters.go b/vendor/github.com/cilium/cilium/api/v1/health/client/restapi/get_healthz_parameters.go deleted file mode 100644 index 3eb0ce8c8..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/health/client/restapi/get_healthz_parameters.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package restapi - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetHealthzParams creates a new GetHealthzParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetHealthzParams() *GetHealthzParams { - return &GetHealthzParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetHealthzParamsWithTimeout creates a new GetHealthzParams object -// with the ability to set a timeout on a request. -func NewGetHealthzParamsWithTimeout(timeout time.Duration) *GetHealthzParams { - return &GetHealthzParams{ - timeout: timeout, - } -} - -// NewGetHealthzParamsWithContext creates a new GetHealthzParams object -// with the ability to set a context for a request. -func NewGetHealthzParamsWithContext(ctx context.Context) *GetHealthzParams { - return &GetHealthzParams{ - Context: ctx, - } -} - -// NewGetHealthzParamsWithHTTPClient creates a new GetHealthzParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetHealthzParamsWithHTTPClient(client *http.Client) *GetHealthzParams { - return &GetHealthzParams{ - HTTPClient: client, - } -} - -/* -GetHealthzParams contains all the parameters to send to the API endpoint - - for the get healthz operation. - - Typically these are written to a http.Request. -*/ -type GetHealthzParams struct { - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get healthz params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetHealthzParams) WithDefaults() *GetHealthzParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get healthz params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetHealthzParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get healthz params -func (o *GetHealthzParams) WithTimeout(timeout time.Duration) *GetHealthzParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get healthz params -func (o *GetHealthzParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get healthz params -func (o *GetHealthzParams) WithContext(ctx context.Context) *GetHealthzParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get healthz params -func (o *GetHealthzParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get healthz params -func (o *GetHealthzParams) WithHTTPClient(client *http.Client) *GetHealthzParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get healthz params -func (o *GetHealthzParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *GetHealthzParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/health/client/restapi/get_healthz_responses.go b/vendor/github.com/cilium/cilium/api/v1/health/client/restapi/get_healthz_responses.go deleted file mode 100644 index 938cfc356..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/health/client/restapi/get_healthz_responses.go +++ /dev/null @@ -1,178 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package restapi - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/cilium/cilium/api/v1/health/models" -) - -// GetHealthzReader is a Reader for the GetHealthz structure. -type GetHealthzReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetHealthzReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetHealthzOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 500: - result := NewGetHealthzFailed() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /healthz] GetHealthz", response, response.Code()) - } -} - -// NewGetHealthzOK creates a GetHealthzOK with default headers values -func NewGetHealthzOK() *GetHealthzOK { - return &GetHealthzOK{} -} - -/* -GetHealthzOK describes a response with status code 200, with default header values. - -Success -*/ -type GetHealthzOK struct { - Payload *models.HealthResponse -} - -// IsSuccess returns true when this get healthz o k response has a 2xx status code -func (o *GetHealthzOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get healthz o k response has a 3xx status code -func (o *GetHealthzOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get healthz o k response has a 4xx status code -func (o *GetHealthzOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get healthz o k response has a 5xx status code -func (o *GetHealthzOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get healthz o k response a status code equal to that given -func (o *GetHealthzOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get healthz o k response -func (o *GetHealthzOK) Code() int { - return 200 -} - -func (o *GetHealthzOK) Error() string { - return fmt.Sprintf("[GET /healthz][%d] getHealthzOK %+v", 200, o.Payload) -} - -func (o *GetHealthzOK) String() string { - return fmt.Sprintf("[GET /healthz][%d] getHealthzOK %+v", 200, o.Payload) -} - -func (o *GetHealthzOK) GetPayload() *models.HealthResponse { - return o.Payload -} - -func (o *GetHealthzOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HealthResponse) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetHealthzFailed creates a GetHealthzFailed with default headers values -func NewGetHealthzFailed() *GetHealthzFailed { - return &GetHealthzFailed{} -} - -/* -GetHealthzFailed describes a response with status code 500, with default header values. - -Failed to contact local Cilium daemon -*/ -type GetHealthzFailed struct { - Payload models.Error -} - -// IsSuccess returns true when this get healthz failed response has a 2xx status code -func (o *GetHealthzFailed) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this get healthz failed response has a 3xx status code -func (o *GetHealthzFailed) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get healthz failed response has a 4xx status code -func (o *GetHealthzFailed) IsClientError() bool { - return false -} - -// IsServerError returns true when this get healthz failed response has a 5xx status code -func (o *GetHealthzFailed) IsServerError() bool { - return true -} - -// IsCode returns true when this get healthz failed response a status code equal to that given -func (o *GetHealthzFailed) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the get healthz failed response -func (o *GetHealthzFailed) Code() int { - return 500 -} - -func (o *GetHealthzFailed) Error() string { - return fmt.Sprintf("[GET /healthz][%d] getHealthzFailed %+v", 500, o.Payload) -} - -func (o *GetHealthzFailed) String() string { - return fmt.Sprintf("[GET /healthz][%d] getHealthzFailed %+v", 500, o.Payload) -} - -func (o *GetHealthzFailed) GetPayload() models.Error { - return o.Payload -} - -func (o *GetHealthzFailed) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/health/client/restapi/restapi_client.go b/vendor/github.com/cilium/cilium/api/v1/health/client/restapi/restapi_client.go deleted file mode 100644 index 6e5b1614a..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/health/client/restapi/restapi_client.go +++ /dev/null @@ -1,87 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package restapi - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// New creates a new restapi API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { - return &Client{transport: transport, formats: formats} -} - -/* -Client for restapi API -*/ -type Client struct { - transport runtime.ClientTransport - formats strfmt.Registry -} - -// ClientOption is the option for Client methods -type ClientOption func(*runtime.ClientOperation) - -// ClientService is the interface for Client methods -type ClientService interface { - GetHealthz(params *GetHealthzParams, opts ...ClientOption) (*GetHealthzOK, error) - - SetTransport(transport runtime.ClientTransport) -} - -/* - GetHealthz gets health of cilium node - - Returns health and status information of the local node including - -load and uptime, as well as the status of related components including -the Cilium daemon. -*/ -func (a *Client) GetHealthz(params *GetHealthzParams, opts ...ClientOption) (*GetHealthzOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetHealthzParams() - } - op := &runtime.ClientOperation{ - ID: "GetHealthz", - Method: "GET", - PathPattern: "/healthz", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetHealthzReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetHealthzOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetHealthz: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -// SetTransport changes the transport on the client -func (a *Client) SetTransport(transport runtime.ClientTransport) { - a.transport = transport -} diff --git a/vendor/github.com/cilium/cilium/api/v1/health/models/connectivity_status.go b/vendor/github.com/cilium/cilium/api/v1/health/models/connectivity_status.go deleted file mode 100644 index 123e3b416..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/health/models/connectivity_status.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// ConnectivityStatus Connectivity status of a path -// -// swagger:model ConnectivityStatus -type ConnectivityStatus struct { - - // Round trip time to node in nanoseconds - Latency int64 `json:"latency,omitempty"` - - // Human readable status/error/warning message - Status string `json:"status,omitempty"` -} - -// Validate validates this connectivity status -func (m *ConnectivityStatus) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this connectivity status based on context it is used -func (m *ConnectivityStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *ConnectivityStatus) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *ConnectivityStatus) UnmarshalBinary(b []byte) error { - var res ConnectivityStatus - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/health/models/endpoint_status.go b/vendor/github.com/cilium/cilium/api/v1/health/models/endpoint_status.go deleted file mode 100644 index b46fe8cdc..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/health/models/endpoint_status.go +++ /dev/null @@ -1,175 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// EndpointStatus Connectivity status to host cilium-health endpoints via different paths -// -// swagger:model EndpointStatus -type EndpointStatus struct { - - // primary address - PrimaryAddress *PathStatus `json:"primary-address,omitempty"` - - // secondary addresses - SecondaryAddresses []*PathStatus `json:"secondary-addresses"` -} - -// Validate validates this endpoint status -func (m *EndpointStatus) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validatePrimaryAddress(formats); err != nil { - res = append(res, err) - } - - if err := m.validateSecondaryAddresses(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *EndpointStatus) validatePrimaryAddress(formats strfmt.Registry) error { - if swag.IsZero(m.PrimaryAddress) { // not required - return nil - } - - if m.PrimaryAddress != nil { - if err := m.PrimaryAddress.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("primary-address") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("primary-address") - } - return err - } - } - - return nil -} - -func (m *EndpointStatus) validateSecondaryAddresses(formats strfmt.Registry) error { - if swag.IsZero(m.SecondaryAddresses) { // not required - return nil - } - - for i := 0; i < len(m.SecondaryAddresses); i++ { - if swag.IsZero(m.SecondaryAddresses[i]) { // not required - continue - } - - if m.SecondaryAddresses[i] != nil { - if err := m.SecondaryAddresses[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("secondary-addresses" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("secondary-addresses" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this endpoint status based on the context it is used -func (m *EndpointStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidatePrimaryAddress(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateSecondaryAddresses(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *EndpointStatus) contextValidatePrimaryAddress(ctx context.Context, formats strfmt.Registry) error { - - if m.PrimaryAddress != nil { - - if swag.IsZero(m.PrimaryAddress) { // not required - return nil - } - - if err := m.PrimaryAddress.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("primary-address") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("primary-address") - } - return err - } - } - - return nil -} - -func (m *EndpointStatus) contextValidateSecondaryAddresses(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.SecondaryAddresses); i++ { - - if m.SecondaryAddresses[i] != nil { - - if swag.IsZero(m.SecondaryAddresses[i]) { // not required - return nil - } - - if err := m.SecondaryAddresses[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("secondary-addresses" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("secondary-addresses" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *EndpointStatus) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *EndpointStatus) UnmarshalBinary(b []byte) error { - var res EndpointStatus - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/health/models/error.go b/vendor/github.com/cilium/cilium/api/v1/health/models/error.go deleted file mode 100644 index 83eccc860..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/health/models/error.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" -) - -// Error error -// -// swagger:model error -type Error string - -// Validate validates this error -func (m Error) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this error based on context it is used -func (m Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/health/models/health_response.go b/vendor/github.com/cilium/cilium/api/v1/health/models/health_response.go deleted file mode 100644 index b6108f41b..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/health/models/health_response.go +++ /dev/null @@ -1,162 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - ciliumModels "github.com/cilium/cilium/api/v1/models" - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// HealthResponse Health and status information of local node -// -// swagger:model HealthResponse -type HealthResponse struct { - - // Status of Cilium daemon - Cilium ciliumModels.StatusResponse `json:"cilium,omitempty"` - - // System load on node - SystemLoad *LoadResponse `json:"system-load,omitempty"` - - // Uptime of cilium-health instance - Uptime string `json:"uptime,omitempty"` -} - -// Validate validates this health response -func (m *HealthResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateCilium(formats); err != nil { - res = append(res, err) - } - - if err := m.validateSystemLoad(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HealthResponse) validateCilium(formats strfmt.Registry) error { - if swag.IsZero(m.Cilium) { // not required - return nil - } - - if err := m.Cilium.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("cilium") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("cilium") - } - return err - } - - return nil -} - -func (m *HealthResponse) validateSystemLoad(formats strfmt.Registry) error { - if swag.IsZero(m.SystemLoad) { // not required - return nil - } - - if m.SystemLoad != nil { - if err := m.SystemLoad.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("system-load") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("system-load") - } - return err - } - } - - return nil -} - -// ContextValidate validate this health response based on the context it is used -func (m *HealthResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateCilium(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateSystemLoad(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HealthResponse) contextValidateCilium(ctx context.Context, formats strfmt.Registry) error { - - if swag.IsZero(m.Cilium) { // not required - return nil - } - - if err := m.Cilium.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("cilium") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("cilium") - } - return err - } - - return nil -} - -func (m *HealthResponse) contextValidateSystemLoad(ctx context.Context, formats strfmt.Registry) error { - - if m.SystemLoad != nil { - - if swag.IsZero(m.SystemLoad) { // not required - return nil - } - - if err := m.SystemLoad.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("system-load") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("system-load") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *HealthResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HealthResponse) UnmarshalBinary(b []byte) error { - var res HealthResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/health/models/health_status_response.go b/vendor/github.com/cilium/cilium/api/v1/health/models/health_status_response.go deleted file mode 100644 index 4b189c09c..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/health/models/health_status_response.go +++ /dev/null @@ -1,178 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// HealthStatusResponse Connectivity status to other daemons -// -// swagger:model HealthStatusResponse -type HealthStatusResponse struct { - - // Description of the local node - Local *SelfStatus `json:"local,omitempty"` - - // Connectivity status to each other node - Nodes []*NodeStatus `json:"nodes"` - - // timestamp - Timestamp string `json:"timestamp,omitempty"` -} - -// Validate validates this health status response -func (m *HealthStatusResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateLocal(formats); err != nil { - res = append(res, err) - } - - if err := m.validateNodes(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HealthStatusResponse) validateLocal(formats strfmt.Registry) error { - if swag.IsZero(m.Local) { // not required - return nil - } - - if m.Local != nil { - if err := m.Local.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("local") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("local") - } - return err - } - } - - return nil -} - -func (m *HealthStatusResponse) validateNodes(formats strfmt.Registry) error { - if swag.IsZero(m.Nodes) { // not required - return nil - } - - for i := 0; i < len(m.Nodes); i++ { - if swag.IsZero(m.Nodes[i]) { // not required - continue - } - - if m.Nodes[i] != nil { - if err := m.Nodes[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("nodes" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("nodes" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this health status response based on the context it is used -func (m *HealthStatusResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateLocal(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateNodes(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HealthStatusResponse) contextValidateLocal(ctx context.Context, formats strfmt.Registry) error { - - if m.Local != nil { - - if swag.IsZero(m.Local) { // not required - return nil - } - - if err := m.Local.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("local") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("local") - } - return err - } - } - - return nil -} - -func (m *HealthStatusResponse) contextValidateNodes(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Nodes); i++ { - - if m.Nodes[i] != nil { - - if swag.IsZero(m.Nodes[i]) { // not required - return nil - } - - if err := m.Nodes[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("nodes" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("nodes" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *HealthStatusResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HealthStatusResponse) UnmarshalBinary(b []byte) error { - var res HealthStatusResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/health/models/host_status.go b/vendor/github.com/cilium/cilium/api/v1/health/models/host_status.go deleted file mode 100644 index c40da6d4a..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/health/models/host_status.go +++ /dev/null @@ -1,176 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// HostStatus Connectivity status to host cilium-health instance via different paths, -// probing via all known IP addresses -// -// swagger:model HostStatus -type HostStatus struct { - - // primary address - PrimaryAddress *PathStatus `json:"primary-address,omitempty"` - - // secondary addresses - SecondaryAddresses []*PathStatus `json:"secondary-addresses"` -} - -// Validate validates this host status -func (m *HostStatus) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validatePrimaryAddress(formats); err != nil { - res = append(res, err) - } - - if err := m.validateSecondaryAddresses(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HostStatus) validatePrimaryAddress(formats strfmt.Registry) error { - if swag.IsZero(m.PrimaryAddress) { // not required - return nil - } - - if m.PrimaryAddress != nil { - if err := m.PrimaryAddress.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("primary-address") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("primary-address") - } - return err - } - } - - return nil -} - -func (m *HostStatus) validateSecondaryAddresses(formats strfmt.Registry) error { - if swag.IsZero(m.SecondaryAddresses) { // not required - return nil - } - - for i := 0; i < len(m.SecondaryAddresses); i++ { - if swag.IsZero(m.SecondaryAddresses[i]) { // not required - continue - } - - if m.SecondaryAddresses[i] != nil { - if err := m.SecondaryAddresses[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("secondary-addresses" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("secondary-addresses" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this host status based on the context it is used -func (m *HostStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidatePrimaryAddress(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateSecondaryAddresses(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HostStatus) contextValidatePrimaryAddress(ctx context.Context, formats strfmt.Registry) error { - - if m.PrimaryAddress != nil { - - if swag.IsZero(m.PrimaryAddress) { // not required - return nil - } - - if err := m.PrimaryAddress.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("primary-address") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("primary-address") - } - return err - } - } - - return nil -} - -func (m *HostStatus) contextValidateSecondaryAddresses(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.SecondaryAddresses); i++ { - - if m.SecondaryAddresses[i] != nil { - - if swag.IsZero(m.SecondaryAddresses[i]) { // not required - return nil - } - - if err := m.SecondaryAddresses[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("secondary-addresses" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("secondary-addresses" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *HostStatus) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HostStatus) UnmarshalBinary(b []byte) error { - var res HostStatus - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/health/models/load_response.go b/vendor/github.com/cilium/cilium/api/v1/health/models/load_response.go deleted file mode 100644 index d0ceddba7..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/health/models/load_response.go +++ /dev/null @@ -1,59 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// LoadResponse System load on node -// -// swagger:model LoadResponse -type LoadResponse struct { - - // Load average over the past 15 minutes - Last15min string `json:"last15min,omitempty"` - - // Load average over the past minute - Last1min string `json:"last1min,omitempty"` - - // Load average over the past 5 minutes - Last5min string `json:"last5min,omitempty"` -} - -// Validate validates this load response -func (m *LoadResponse) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this load response based on context it is used -func (m *LoadResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *LoadResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *LoadResponse) UnmarshalBinary(b []byte) error { - var res LoadResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/health/models/node_status.go b/vendor/github.com/cilium/cilium/api/v1/health/models/node_status.go deleted file mode 100644 index 82f2b33fe..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/health/models/node_status.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NodeStatus Connectivity status of a remote cilium-health instance -// -// swagger:model NodeStatus -type NodeStatus struct { - - // DEPRECATED: Please use the health-endpoint field instead, which - // supports reporting the status of different addresses for the endpoint - // - Endpoint *PathStatus `json:"endpoint,omitempty"` - - // Connectivity status to simulated endpoint on the node - HealthEndpoint *EndpointStatus `json:"health-endpoint,omitempty"` - - // Connectivity status to cilium-health instance on node IP - Host *HostStatus `json:"host,omitempty"` - - // Identifying name for the node - Name string `json:"name,omitempty"` -} - -// Validate validates this node status -func (m *NodeStatus) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateEndpoint(formats); err != nil { - res = append(res, err) - } - - if err := m.validateHealthEndpoint(formats); err != nil { - res = append(res, err) - } - - if err := m.validateHost(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *NodeStatus) validateEndpoint(formats strfmt.Registry) error { - if swag.IsZero(m.Endpoint) { // not required - return nil - } - - if m.Endpoint != nil { - if err := m.Endpoint.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("endpoint") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("endpoint") - } - return err - } - } - - return nil -} - -func (m *NodeStatus) validateHealthEndpoint(formats strfmt.Registry) error { - if swag.IsZero(m.HealthEndpoint) { // not required - return nil - } - - if m.HealthEndpoint != nil { - if err := m.HealthEndpoint.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("health-endpoint") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("health-endpoint") - } - return err - } - } - - return nil -} - -func (m *NodeStatus) validateHost(formats strfmt.Registry) error { - if swag.IsZero(m.Host) { // not required - return nil - } - - if m.Host != nil { - if err := m.Host.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("host") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("host") - } - return err - } - } - - return nil -} - -// ContextValidate validate this node status based on the context it is used -func (m *NodeStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateEndpoint(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateHealthEndpoint(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateHost(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *NodeStatus) contextValidateEndpoint(ctx context.Context, formats strfmt.Registry) error { - - if m.Endpoint != nil { - - if swag.IsZero(m.Endpoint) { // not required - return nil - } - - if err := m.Endpoint.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("endpoint") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("endpoint") - } - return err - } - } - - return nil -} - -func (m *NodeStatus) contextValidateHealthEndpoint(ctx context.Context, formats strfmt.Registry) error { - - if m.HealthEndpoint != nil { - - if swag.IsZero(m.HealthEndpoint) { // not required - return nil - } - - if err := m.HealthEndpoint.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("health-endpoint") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("health-endpoint") - } - return err - } - } - - return nil -} - -func (m *NodeStatus) contextValidateHost(ctx context.Context, formats strfmt.Registry) error { - - if m.Host != nil { - - if swag.IsZero(m.Host) { // not required - return nil - } - - if err := m.Host.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("host") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("host") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *NodeStatus) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *NodeStatus) UnmarshalBinary(b []byte) error { - var res NodeStatus - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/health/models/path_status.go b/vendor/github.com/cilium/cilium/api/v1/health/models/path_status.go deleted file mode 100644 index b9b6fc7d0..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/health/models/path_status.go +++ /dev/null @@ -1,167 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// PathStatus Connectivity status via different paths, for example using different -// policies or service redirection -// -// swagger:model PathStatus -type PathStatus struct { - - // Connectivity status without policy applied - HTTP *ConnectivityStatus `json:"http,omitempty"` - - // Basic ping connectivity status to node IP - Icmp *ConnectivityStatus `json:"icmp,omitempty"` - - // IP address queried for the connectivity status - IP string `json:"ip,omitempty"` -} - -// Validate validates this path status -func (m *PathStatus) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateHTTP(formats); err != nil { - res = append(res, err) - } - - if err := m.validateIcmp(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PathStatus) validateHTTP(formats strfmt.Registry) error { - if swag.IsZero(m.HTTP) { // not required - return nil - } - - if m.HTTP != nil { - if err := m.HTTP.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("http") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("http") - } - return err - } - } - - return nil -} - -func (m *PathStatus) validateIcmp(formats strfmt.Registry) error { - if swag.IsZero(m.Icmp) { // not required - return nil - } - - if m.Icmp != nil { - if err := m.Icmp.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("icmp") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("icmp") - } - return err - } - } - - return nil -} - -// ContextValidate validate this path status based on the context it is used -func (m *PathStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateHTTP(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateIcmp(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PathStatus) contextValidateHTTP(ctx context.Context, formats strfmt.Registry) error { - - if m.HTTP != nil { - - if swag.IsZero(m.HTTP) { // not required - return nil - } - - if err := m.HTTP.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("http") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("http") - } - return err - } - } - - return nil -} - -func (m *PathStatus) contextValidateIcmp(ctx context.Context, formats strfmt.Registry) error { - - if m.Icmp != nil { - - if swag.IsZero(m.Icmp) { // not required - return nil - } - - if err := m.Icmp.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("icmp") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("icmp") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *PathStatus) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *PathStatus) UnmarshalBinary(b []byte) error { - var res PathStatus - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/health/models/self_status.go b/vendor/github.com/cilium/cilium/api/v1/health/models/self_status.go deleted file mode 100644 index 0f8609367..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/health/models/self_status.go +++ /dev/null @@ -1,53 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// SelfStatus Description of the cilium-health node -// -// swagger:model SelfStatus -type SelfStatus struct { - - // Name associated with this node - Name string `json:"name,omitempty"` -} - -// Validate validates this self status -func (m *SelfStatus) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this self status based on context it is used -func (m *SelfStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *SelfStatus) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *SelfStatus) UnmarshalBinary(b []byte) error { - var res SelfStatus - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/models/backend_address.go b/vendor/github.com/cilium/cilium/api/v1/models/backend_address.go index 3f17b81f4..678d83c50 100644 --- a/vendor/github.com/cilium/cilium/api/v1/models/backend_address.go +++ b/vendor/github.com/cilium/cilium/api/v1/models/backend_address.go @@ -43,6 +43,9 @@ type BackendAddress struct { // Backend weight Weight *uint16 `json:"weight,omitempty"` + + // Optional name of the zone in which this backend runs + Zone string `json:"zone,omitempty"` } // Validate validates this backend address diff --git a/vendor/github.com/cilium/cilium/api/v1/models/daemon_configuration_status.go b/vendor/github.com/cilium/cilium/api/v1/models/daemon_configuration_status.go index 8e6d846c5..24fc78379 100644 --- a/vendor/github.com/cilium/cilium/api/v1/models/daemon_configuration_status.go +++ b/vendor/github.com/cilium/cilium/api/v1/models/daemon_configuration_status.go @@ -53,6 +53,9 @@ type DaemonConfigurationStatus struct { // Immutable configuration (read-only) Immutable ConfigurationMap `json:"immutable,omitempty"` + // Comma-separated list of IP ports should be reserved in the workload network namespace + IPLocalReservedPorts string `json:"ipLocalReservedPorts,omitempty"` + // Configured IPAM mode IpamMode string `json:"ipam-mode,omitempty"` diff --git a/vendor/github.com/cilium/cilium/api/v1/models/endpoint_change_request.go b/vendor/github.com/cilium/cilium/api/v1/models/endpoint_change_request.go index 57bb1ac50..47f52efbe 100644 --- a/vendor/github.com/cilium/cilium/api/v1/models/endpoint_change_request.go +++ b/vendor/github.com/cilium/cilium/api/v1/models/endpoint_change_request.go @@ -67,6 +67,9 @@ type EndpointChangeRequest struct { // Kubernetes pod name K8sPodName string `json:"k8s-pod-name,omitempty"` + // Kubernetes pod UID + K8sUID string `json:"k8s-uid,omitempty"` + // Labels describing the identity Labels Labels `json:"labels,omitempty"` diff --git a/vendor/github.com/cilium/cilium/api/v1/observer/observer.pb.go b/vendor/github.com/cilium/cilium/api/v1/observer/observer.pb.go index 78d54e054..d832d8f98 100644 --- a/vendor/github.com/cilium/cilium/api/v1/observer/observer.pb.go +++ b/vendor/github.com/cilium/cilium/api/v1/observer/observer.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.24.0 +// protoc v5.27.0 // source: observer/observer.proto package observer diff --git a/vendor/github.com/cilium/cilium/api/v1/observer/observer.pb.json.go b/vendor/github.com/cilium/cilium/api/v1/observer/observer.pb.json.go index cf61f823c..0b88fed03 100644 --- a/vendor/github.com/cilium/cilium/api/v1/observer/observer.pb.json.go +++ b/vendor/github.com/cilium/cilium/api/v1/observer/observer.pb.json.go @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Authors of Hubble + // Code generated by protoc-gen-go-json. DO NOT EDIT. // source: observer/observer.proto @@ -10,271 +13,203 @@ import ( // MarshalJSON implements json.Marshaler func (msg *ServerStatusRequest) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *ServerStatusRequest) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *ServerStatusResponse) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *ServerStatusResponse) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *GetFlowsRequest) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *GetFlowsRequest) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *GetFlowsRequest_Experimental) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *GetFlowsRequest_Experimental) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *GetFlowsResponse) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *GetFlowsResponse) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *GetAgentEventsRequest) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *GetAgentEventsRequest) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *GetAgentEventsResponse) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *GetAgentEventsResponse) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *GetDebugEventsRequest) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *GetDebugEventsRequest) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *GetDebugEventsResponse) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *GetDebugEventsResponse) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *GetNodesRequest) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *GetNodesRequest) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *GetNodesResponse) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *GetNodesResponse) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *Node) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *Node) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *TLS) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *TLS) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *GetNamespacesRequest) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *GetNamespacesRequest) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *GetNamespacesResponse) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *GetNamespacesResponse) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *Namespace) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *Namespace) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *ExportEvent) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *ExportEvent) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } diff --git a/vendor/github.com/cilium/cilium/api/v1/observer/observer_grpc.pb.go b/vendor/github.com/cilium/cilium/api/v1/observer/observer_grpc.pb.go index fc67208cb..41865072f 100644 --- a/vendor/github.com/cilium/cilium/api/v1/observer/observer_grpc.pb.go +++ b/vendor/github.com/cilium/cilium/api/v1/observer/observer_grpc.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.24.0 +// - protoc v5.27.0 // source: observer/observer.proto package observer @@ -18,8 +18,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.62.0 or later. +const _ = grpc.SupportPackageIsVersion8 const ( Observer_GetFlows_FullMethodName = "/observer.Observer/GetFlows" @@ -33,6 +33,9 @@ const ( // ObserverClient is the client API for Observer service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// Observer returns a stream of Flows depending on which filter the user want +// to observe. type ObserverClient interface { // GetFlows returning structured data, meant to eventually obsolete GetLastNFlows. GetFlows(ctx context.Context, in *GetFlowsRequest, opts ...grpc.CallOption) (Observer_GetFlowsClient, error) @@ -60,11 +63,12 @@ func NewObserverClient(cc grpc.ClientConnInterface) ObserverClient { } func (c *observerClient) GetFlows(ctx context.Context, in *GetFlowsRequest, opts ...grpc.CallOption) (Observer_GetFlowsClient, error) { - stream, err := c.cc.NewStream(ctx, &Observer_ServiceDesc.Streams[0], Observer_GetFlows_FullMethodName, opts...) + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &Observer_ServiceDesc.Streams[0], Observer_GetFlows_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &observerGetFlowsClient{stream} + x := &observerGetFlowsClient{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -92,11 +96,12 @@ func (x *observerGetFlowsClient) Recv() (*GetFlowsResponse, error) { } func (c *observerClient) GetAgentEvents(ctx context.Context, in *GetAgentEventsRequest, opts ...grpc.CallOption) (Observer_GetAgentEventsClient, error) { - stream, err := c.cc.NewStream(ctx, &Observer_ServiceDesc.Streams[1], Observer_GetAgentEvents_FullMethodName, opts...) + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &Observer_ServiceDesc.Streams[1], Observer_GetAgentEvents_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &observerGetAgentEventsClient{stream} + x := &observerGetAgentEventsClient{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -124,11 +129,12 @@ func (x *observerGetAgentEventsClient) Recv() (*GetAgentEventsResponse, error) { } func (c *observerClient) GetDebugEvents(ctx context.Context, in *GetDebugEventsRequest, opts ...grpc.CallOption) (Observer_GetDebugEventsClient, error) { - stream, err := c.cc.NewStream(ctx, &Observer_ServiceDesc.Streams[2], Observer_GetDebugEvents_FullMethodName, opts...) + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &Observer_ServiceDesc.Streams[2], Observer_GetDebugEvents_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &observerGetDebugEventsClient{stream} + x := &observerGetDebugEventsClient{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -156,8 +162,9 @@ func (x *observerGetDebugEventsClient) Recv() (*GetDebugEventsResponse, error) { } func (c *observerClient) GetNodes(ctx context.Context, in *GetNodesRequest, opts ...grpc.CallOption) (*GetNodesResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(GetNodesResponse) - err := c.cc.Invoke(ctx, Observer_GetNodes_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Observer_GetNodes_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -165,8 +172,9 @@ func (c *observerClient) GetNodes(ctx context.Context, in *GetNodesRequest, opts } func (c *observerClient) GetNamespaces(ctx context.Context, in *GetNamespacesRequest, opts ...grpc.CallOption) (*GetNamespacesResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(GetNamespacesResponse) - err := c.cc.Invoke(ctx, Observer_GetNamespaces_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Observer_GetNamespaces_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -174,8 +182,9 @@ func (c *observerClient) GetNamespaces(ctx context.Context, in *GetNamespacesReq } func (c *observerClient) ServerStatus(ctx context.Context, in *ServerStatusRequest, opts ...grpc.CallOption) (*ServerStatusResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ServerStatusResponse) - err := c.cc.Invoke(ctx, Observer_ServerStatus_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Observer_ServerStatus_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -185,6 +194,9 @@ func (c *observerClient) ServerStatus(ctx context.Context, in *ServerStatusReque // ObserverServer is the server API for Observer service. // All implementations should embed UnimplementedObserverServer // for forward compatibility +// +// Observer returns a stream of Flows depending on which filter the user want +// to observe. type ObserverServer interface { // GetFlows returning structured data, meant to eventually obsolete GetLastNFlows. GetFlows(*GetFlowsRequest, Observer_GetFlowsServer) error @@ -242,7 +254,7 @@ func _Observer_GetFlows_Handler(srv interface{}, stream grpc.ServerStream) error if err := stream.RecvMsg(m); err != nil { return err } - return srv.(ObserverServer).GetFlows(m, &observerGetFlowsServer{stream}) + return srv.(ObserverServer).GetFlows(m, &observerGetFlowsServer{ServerStream: stream}) } type Observer_GetFlowsServer interface { @@ -263,7 +275,7 @@ func _Observer_GetAgentEvents_Handler(srv interface{}, stream grpc.ServerStream) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(ObserverServer).GetAgentEvents(m, &observerGetAgentEventsServer{stream}) + return srv.(ObserverServer).GetAgentEvents(m, &observerGetAgentEventsServer{ServerStream: stream}) } type Observer_GetAgentEventsServer interface { @@ -284,7 +296,7 @@ func _Observer_GetDebugEvents_Handler(srv interface{}, stream grpc.ServerStream) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(ObserverServer).GetDebugEvents(m, &observerGetDebugEventsServer{stream}) + return srv.(ObserverServer).GetDebugEvents(m, &observerGetDebugEventsServer{ServerStream: stream}) } type Observer_GetDebugEventsServer interface { diff --git a/vendor/github.com/cilium/cilium/api/v1/peer/peer.pb.go b/vendor/github.com/cilium/cilium/api/v1/peer/peer.pb.go index 4a2712ba8..110c69b25 100644 --- a/vendor/github.com/cilium/cilium/api/v1/peer/peer.pb.go +++ b/vendor/github.com/cilium/cilium/api/v1/peer/peer.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.24.0 +// protoc v5.27.0 // source: peer/peer.proto package peer diff --git a/vendor/github.com/cilium/cilium/api/v1/peer/peer.pb.json.go b/vendor/github.com/cilium/cilium/api/v1/peer/peer.pb.json.go index b31578aa7..2e3123285 100644 --- a/vendor/github.com/cilium/cilium/api/v1/peer/peer.pb.json.go +++ b/vendor/github.com/cilium/cilium/api/v1/peer/peer.pb.json.go @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Authors of Hubble + // Code generated by protoc-gen-go-json. DO NOT EDIT. // source: peer/peer.proto @@ -10,47 +13,35 @@ import ( // MarshalJSON implements json.Marshaler func (msg *NotifyRequest) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *NotifyRequest) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *ChangeNotification) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *ChangeNotification) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *TLS) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *TLS) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } diff --git a/vendor/github.com/cilium/cilium/api/v1/peer/peer_grpc.pb.go b/vendor/github.com/cilium/cilium/api/v1/peer/peer_grpc.pb.go index 03032c2b4..65b6c2187 100644 --- a/vendor/github.com/cilium/cilium/api/v1/peer/peer_grpc.pb.go +++ b/vendor/github.com/cilium/cilium/api/v1/peer/peer_grpc.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.24.0 +// - protoc v5.27.0 // source: peer/peer.proto package peer @@ -18,8 +18,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.62.0 or later. +const _ = grpc.SupportPackageIsVersion8 const ( Peer_Notify_FullMethodName = "/peer.Peer/Notify" @@ -28,6 +28,8 @@ const ( // PeerClient is the client API for Peer service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// Peer lists hubble peers and notifies of changes. type PeerClient interface { // Notify sends information about hubble peers in the cluster. // When Notify is called, it sends information about all the peers that are @@ -45,11 +47,12 @@ func NewPeerClient(cc grpc.ClientConnInterface) PeerClient { } func (c *peerClient) Notify(ctx context.Context, in *NotifyRequest, opts ...grpc.CallOption) (Peer_NotifyClient, error) { - stream, err := c.cc.NewStream(ctx, &Peer_ServiceDesc.Streams[0], Peer_Notify_FullMethodName, opts...) + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &Peer_ServiceDesc.Streams[0], Peer_Notify_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &peerNotifyClient{stream} + x := &peerNotifyClient{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -79,6 +82,8 @@ func (x *peerNotifyClient) Recv() (*ChangeNotification, error) { // PeerServer is the server API for Peer service. // All implementations should embed UnimplementedPeerServer // for forward compatibility +// +// Peer lists hubble peers and notifies of changes. type PeerServer interface { // Notify sends information about hubble peers in the cluster. // When Notify is called, it sends information about all the peers that are @@ -111,7 +116,7 @@ func _Peer_Notify_Handler(srv interface{}, stream grpc.ServerStream) error { if err := stream.RecvMsg(m); err != nil { return err } - return srv.(PeerServer).Notify(m, &peerNotifyServer{stream}) + return srv.(PeerServer).Notify(m, &peerNotifyServer{ServerStream: stream}) } type Peer_NotifyServer interface { diff --git a/vendor/github.com/cilium/cilium/api/v1/recorder/recorder.pb.go b/vendor/github.com/cilium/cilium/api/v1/recorder/recorder.pb.go index 93e1259d3..f7b75d2e1 100644 --- a/vendor/github.com/cilium/cilium/api/v1/recorder/recorder.pb.go +++ b/vendor/github.com/cilium/cilium/api/v1/recorder/recorder.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.24.0 +// protoc v5.27.0 // source: recorder/recorder.proto package recorder diff --git a/vendor/github.com/cilium/cilium/api/v1/recorder/recorder.pb.json.go b/vendor/github.com/cilium/cilium/api/v1/recorder/recorder.pb.json.go index e745a92d7..2b5c145e5 100644 --- a/vendor/github.com/cilium/cilium/api/v1/recorder/recorder.pb.json.go +++ b/vendor/github.com/cilium/cilium/api/v1/recorder/recorder.pb.json.go @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Authors of Hubble + // Code generated by protoc-gen-go-json. DO NOT EDIT. // source: recorder/recorder.proto @@ -10,175 +13,131 @@ import ( // MarshalJSON implements json.Marshaler func (msg *RecordRequest) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *RecordRequest) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *StartRecording) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *StartRecording) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *StopCondition) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *StopCondition) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *FileSinkConfiguration) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *FileSinkConfiguration) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *Filter) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *Filter) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *StopRecording) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *StopRecording) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *RecordResponse) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *RecordResponse) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *RecordingStatistics) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *RecordingStatistics) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *RecordingRunningResponse) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *RecordingRunningResponse) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *RecordingStoppedResponse) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *RecordingStoppedResponse) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } // MarshalJSON implements json.Marshaler func (msg *FileSinkResult) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *FileSinkResult) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } diff --git a/vendor/github.com/cilium/cilium/api/v1/recorder/recorder_grpc.pb.go b/vendor/github.com/cilium/cilium/api/v1/recorder/recorder_grpc.pb.go index 508364e87..79858e03a 100644 --- a/vendor/github.com/cilium/cilium/api/v1/recorder/recorder_grpc.pb.go +++ b/vendor/github.com/cilium/cilium/api/v1/recorder/recorder_grpc.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.24.0 +// - protoc v5.27.0 // source: recorder/recorder.proto package recorder @@ -18,8 +18,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.62.0 or later. +const _ = grpc.SupportPackageIsVersion8 const ( Recorder_Record_FullMethodName = "/recorder.Recorder/Record" @@ -28,6 +28,8 @@ const ( // RecorderClient is the client API for Recorder service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// Recorder implements the Hubble module for capturing network packets type RecorderClient interface { // Record can start and stop a single recording. The recording is // automatically stopped if the client aborts this rpc call. @@ -43,11 +45,12 @@ func NewRecorderClient(cc grpc.ClientConnInterface) RecorderClient { } func (c *recorderClient) Record(ctx context.Context, opts ...grpc.CallOption) (Recorder_RecordClient, error) { - stream, err := c.cc.NewStream(ctx, &Recorder_ServiceDesc.Streams[0], Recorder_Record_FullMethodName, opts...) + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &Recorder_ServiceDesc.Streams[0], Recorder_Record_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &recorderRecordClient{stream} + x := &recorderRecordClient{ClientStream: stream} return x, nil } @@ -76,6 +79,8 @@ func (x *recorderRecordClient) Recv() (*RecordResponse, error) { // RecorderServer is the server API for Recorder service. // All implementations should embed UnimplementedRecorderServer // for forward compatibility +// +// Recorder implements the Hubble module for capturing network packets type RecorderServer interface { // Record can start and stop a single recording. The recording is // automatically stopped if the client aborts this rpc call. @@ -102,7 +107,7 @@ func RegisterRecorderServer(s grpc.ServiceRegistrar, srv RecorderServer) { } func _Recorder_Record_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(RecorderServer).Record(&recorderRecordServer{stream}) + return srv.(RecorderServer).Record(&recorderRecordServer{ServerStream: stream}) } type Recorder_RecordServer interface { diff --git a/vendor/github.com/cilium/cilium/api/v1/relay/relay.pb.go b/vendor/github.com/cilium/cilium/api/v1/relay/relay.pb.go index a4ae994cc..a94969d35 100644 --- a/vendor/github.com/cilium/cilium/api/v1/relay/relay.pb.go +++ b/vendor/github.com/cilium/cilium/api/v1/relay/relay.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.24.0 +// protoc v5.27.0 // source: relay/relay.proto package relay diff --git a/vendor/github.com/cilium/cilium/api/v1/relay/relay.pb.json.go b/vendor/github.com/cilium/cilium/api/v1/relay/relay.pb.json.go index ab155d5a1..7cbdbea94 100644 --- a/vendor/github.com/cilium/cilium/api/v1/relay/relay.pb.json.go +++ b/vendor/github.com/cilium/cilium/api/v1/relay/relay.pb.json.go @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Authors of Cilium + // Code generated by protoc-gen-go-json. DO NOT EDIT. // source: relay/relay.proto @@ -10,15 +13,11 @@ import ( // MarshalJSON implements json.Marshaler func (msg *NodeStatusEvent) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: false, - UseProtoNames: true, + UseProtoNames: true, }.Marshal(msg) } // UnmarshalJSON implements json.Unmarshaler func (msg *NodeStatusEvent) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) + return protojson.UnmarshalOptions{}.Unmarshal(b, msg) } diff --git a/vendor/github.com/cilium/cilium/api/v1/server/restapi/statedb/get_statedb_dump.go b/vendor/github.com/cilium/cilium/api/v1/server/restapi/statedb/get_statedb_dump.go deleted file mode 100644 index c389ebf5d..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/server/restapi/statedb/get_statedb_dump.go +++ /dev/null @@ -1,59 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package statedb - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetStatedbDumpHandlerFunc turns a function with the right signature into a get statedb dump handler -type GetStatedbDumpHandlerFunc func(GetStatedbDumpParams) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetStatedbDumpHandlerFunc) Handle(params GetStatedbDumpParams) middleware.Responder { - return fn(params) -} - -// GetStatedbDumpHandler interface for that can handle valid get statedb dump params -type GetStatedbDumpHandler interface { - Handle(GetStatedbDumpParams) middleware.Responder -} - -// NewGetStatedbDump creates a new http.Handler for the get statedb dump operation -func NewGetStatedbDump(ctx *middleware.Context, handler GetStatedbDumpHandler) *GetStatedbDump { - return &GetStatedbDump{Context: ctx, Handler: handler} -} - -/* - GetStatedbDump swagger:route GET /statedb/dump statedb getStatedbDump - -Dump StateDB contents -*/ -type GetStatedbDump struct { - Context *middleware.Context - Handler GetStatedbDumpHandler -} - -func (o *GetStatedbDump) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetStatedbDumpParams() - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/vendor/github.com/cilium/cilium/api/v1/server/restapi/statedb/get_statedb_dump_parameters.go b/vendor/github.com/cilium/cilium/api/v1/server/restapi/statedb/get_statedb_dump_parameters.go deleted file mode 100644 index 47d71347d..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/server/restapi/statedb/get_statedb_dump_parameters.go +++ /dev/null @@ -1,49 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package statedb - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetStatedbDumpParams creates a new GetStatedbDumpParams object -// -// There are no default values defined in the spec. -func NewGetStatedbDumpParams() GetStatedbDumpParams { - - return GetStatedbDumpParams{} -} - -// GetStatedbDumpParams contains all the bound params for the get statedb dump operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetStatedbDump -type GetStatedbDumpParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetStatedbDumpParams() beforehand. -func (o *GetStatedbDumpParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/server/restapi/statedb/get_statedb_dump_responses.go b/vendor/github.com/cilium/cilium/api/v1/server/restapi/statedb/get_statedb_dump_responses.go deleted file mode 100644 index 0ea7ecc22..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/server/restapi/statedb/get_statedb_dump_responses.go +++ /dev/null @@ -1,59 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package statedb - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/runtime" -) - -// GetStatedbDumpOKCode is the HTTP code returned for type GetStatedbDumpOK -const GetStatedbDumpOKCode int = 200 - -/* -GetStatedbDumpOK Success - -swagger:response getStatedbDumpOK -*/ -type GetStatedbDumpOK struct { - - /* - In: Body - */ - Payload io.ReadCloser `json:"body,omitempty"` -} - -// NewGetStatedbDumpOK creates GetStatedbDumpOK with default headers values -func NewGetStatedbDumpOK() *GetStatedbDumpOK { - - return &GetStatedbDumpOK{} -} - -// WithPayload adds the payload to the get statedb dump o k response -func (o *GetStatedbDumpOK) WithPayload(payload io.ReadCloser) *GetStatedbDumpOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get statedb dump o k response -func (o *GetStatedbDumpOK) SetPayload(payload io.ReadCloser) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStatedbDumpOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} diff --git a/vendor/github.com/cilium/cilium/api/v1/server/restapi/statedb/get_statedb_query_table.go b/vendor/github.com/cilium/cilium/api/v1/server/restapi/statedb/get_statedb_query_table.go deleted file mode 100644 index bcfd5482a..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/server/restapi/statedb/get_statedb_query_table.go +++ /dev/null @@ -1,59 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package statedb - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetStatedbQueryTableHandlerFunc turns a function with the right signature into a get statedb query table handler -type GetStatedbQueryTableHandlerFunc func(GetStatedbQueryTableParams) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetStatedbQueryTableHandlerFunc) Handle(params GetStatedbQueryTableParams) middleware.Responder { - return fn(params) -} - -// GetStatedbQueryTableHandler interface for that can handle valid get statedb query table params -type GetStatedbQueryTableHandler interface { - Handle(GetStatedbQueryTableParams) middleware.Responder -} - -// NewGetStatedbQueryTable creates a new http.Handler for the get statedb query table operation -func NewGetStatedbQueryTable(ctx *middleware.Context, handler GetStatedbQueryTableHandler) *GetStatedbQueryTable { - return &GetStatedbQueryTable{Context: ctx, Handler: handler} -} - -/* - GetStatedbQueryTable swagger:route GET /statedb/query/{table} statedb getStatedbQueryTable - -Perform a query against a StateDB table -*/ -type GetStatedbQueryTable struct { - Context *middleware.Context - Handler GetStatedbQueryTableHandler -} - -func (o *GetStatedbQueryTable) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetStatedbQueryTableParams() - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/vendor/github.com/cilium/cilium/api/v1/server/restapi/statedb/get_statedb_query_table_parameters.go b/vendor/github.com/cilium/cilium/api/v1/server/restapi/statedb/get_statedb_query_table_parameters.go deleted file mode 100644 index 84c8774e7..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/server/restapi/statedb/get_statedb_query_table_parameters.go +++ /dev/null @@ -1,177 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package statedb - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// NewGetStatedbQueryTableParams creates a new GetStatedbQueryTableParams object -// -// There are no default values defined in the spec. -func NewGetStatedbQueryTableParams() GetStatedbQueryTableParams { - - return GetStatedbQueryTableParams{} -} - -// GetStatedbQueryTableParams contains all the bound params for the get statedb query table operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetStatedbQueryTable -type GetStatedbQueryTableParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*StateDB index name - Required: true - In: query - */ - Index string - /*Query key (base64 encoded) - Required: true - In: query - */ - Key string - /*If true perform a LowerBound search - Required: true - In: query - */ - Lowerbound bool - /*StateDB table name - Required: true - In: path - */ - Table string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetStatedbQueryTableParams() beforehand. -func (o *GetStatedbQueryTableParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qIndex, qhkIndex, _ := qs.GetOK("index") - if err := o.bindIndex(qIndex, qhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - qKey, qhkKey, _ := qs.GetOK("key") - if err := o.bindKey(qKey, qhkKey, route.Formats); err != nil { - res = append(res, err) - } - - qLowerbound, qhkLowerbound, _ := qs.GetOK("lowerbound") - if err := o.bindLowerbound(qLowerbound, qhkLowerbound, route.Formats); err != nil { - res = append(res, err) - } - - rTable, rhkTable, _ := route.Params.GetOK("table") - if err := o.bindTable(rTable, rhkTable, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from query. -func (o *GetStatedbQueryTableParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("index", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("index", "query", raw); err != nil { - return err - } - o.Index = raw - - return nil -} - -// bindKey binds and validates parameter Key from query. -func (o *GetStatedbQueryTableParams) bindKey(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("key", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("key", "query", raw); err != nil { - return err - } - o.Key = raw - - return nil -} - -// bindLowerbound binds and validates parameter Lowerbound from query. -func (o *GetStatedbQueryTableParams) bindLowerbound(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("lowerbound", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("lowerbound", "query", raw); err != nil { - return err - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("lowerbound", "query", "bool", raw) - } - o.Lowerbound = value - - return nil -} - -// bindTable binds and validates parameter Table from path. -func (o *GetStatedbQueryTableParams) bindTable(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Table = raw - - return nil -} diff --git a/vendor/github.com/cilium/cilium/api/v1/server/restapi/statedb/get_statedb_query_table_responses.go b/vendor/github.com/cilium/cilium/api/v1/server/restapi/statedb/get_statedb_query_table_responses.go deleted file mode 100644 index 89a4ea146..000000000 --- a/vendor/github.com/cilium/cilium/api/v1/server/restapi/statedb/get_statedb_query_table_responses.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright Authors of Cilium -// SPDX-License-Identifier: Apache-2.0 - -package statedb - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/cilium/cilium/api/v1/models" -) - -// GetStatedbQueryTableOKCode is the HTTP code returned for type GetStatedbQueryTableOK -const GetStatedbQueryTableOKCode int = 200 - -/* -GetStatedbQueryTableOK Success - -swagger:response getStatedbQueryTableOK -*/ -type GetStatedbQueryTableOK struct { - - /* - In: Body - */ - Payload io.ReadCloser `json:"body,omitempty"` -} - -// NewGetStatedbQueryTableOK creates GetStatedbQueryTableOK with default headers values -func NewGetStatedbQueryTableOK() *GetStatedbQueryTableOK { - - return &GetStatedbQueryTableOK{} -} - -// WithPayload adds the payload to the get statedb query table o k response -func (o *GetStatedbQueryTableOK) WithPayload(payload io.ReadCloser) *GetStatedbQueryTableOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get statedb query table o k response -func (o *GetStatedbQueryTableOK) SetPayload(payload io.ReadCloser) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStatedbQueryTableOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// GetStatedbQueryTableBadRequestCode is the HTTP code returned for type GetStatedbQueryTableBadRequest -const GetStatedbQueryTableBadRequestCode int = 400 - -/* -GetStatedbQueryTableBadRequest Invalid parameters - -swagger:response getStatedbQueryTableBadRequest -*/ -type GetStatedbQueryTableBadRequest struct { - - /* - In: Body - */ - Payload models.Error `json:"body,omitempty"` -} - -// NewGetStatedbQueryTableBadRequest creates GetStatedbQueryTableBadRequest with default headers values -func NewGetStatedbQueryTableBadRequest() *GetStatedbQueryTableBadRequest { - - return &GetStatedbQueryTableBadRequest{} -} - -// WithPayload adds the payload to the get statedb query table bad request response -func (o *GetStatedbQueryTableBadRequest) WithPayload(payload models.Error) *GetStatedbQueryTableBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get statedb query table bad request response -func (o *GetStatedbQueryTableBadRequest) SetPayload(payload models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStatedbQueryTableBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(400) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// GetStatedbQueryTableNotFoundCode is the HTTP code returned for type GetStatedbQueryTableNotFound -const GetStatedbQueryTableNotFoundCode int = 404 - -/* -GetStatedbQueryTableNotFound Table or Index not found - -swagger:response getStatedbQueryTableNotFound -*/ -type GetStatedbQueryTableNotFound struct { -} - -// NewGetStatedbQueryTableNotFound creates GetStatedbQueryTableNotFound with default headers values -func NewGetStatedbQueryTableNotFound() *GetStatedbQueryTableNotFound { - - return &GetStatedbQueryTableNotFound{} -} - -// WriteResponse to the client -func (o *GetStatedbQueryTableNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(404) -} diff --git a/vendor/github.com/cilium/cilium/hubble/cmd/observe/flows.go b/vendor/github.com/cilium/cilium/hubble/cmd/observe/flows.go index d71d8b2e1..9bfdccb7a 100644 --- a/vendor/github.com/cilium/cilium/hubble/cmd/observe/flows.go +++ b/vendor/github.com/cilium/cilium/hubble/cmd/observe/flows.go @@ -419,9 +419,12 @@ func newFlowsCmdHelper(usage cmdUsage, vp *viper.Viper, ofilter *flowFilter) *co filterFlags.Var(filterVar( "from-ip", ofilter, "Show all flows originating at the given IP address. Each of the source IPs can be specified as an exact match (e.g. '1.1.1.1') or as a CIDR range (e.g.'1.1.1.0/24').")) + filterFlags.Var(filterVar( + "snat-ip", ofilter, + "Show all flows SNATed with the given IP address. Each of the SNAT IPs can be specified as an exact match (e.g. '1.1.1.1') or as a CIDR range (e.g.'1.1.1.0/24').")) filterFlags.Var(filterVar( "ip", ofilter, - "Show all flows related to the given IP address. Each of the IPs can be specified as an exact match (e.g. '1.1.1.1') or as a CIDR range (e.g.'1.1.1.0/24').")) + "Show all flows originating or terminating at the given IP address. Each of the IPs can be specified as an exact match (e.g. '1.1.1.1') or as a CIDR range (e.g.'1.1.1.0/24').")) filterFlags.Var(filterVar( "to-ip", ofilter, "Show all flows terminating at the given IP address. Each of the destination IPs can be specified as an exact match (e.g. '1.1.1.1') or as a CIDR range (e.g.'1.1.1.0/24').")) @@ -526,6 +529,9 @@ func newFlowsCmdHelper(usage cmdUsage, vp *viper.Viper, ofilter *flowFilter) *co filterFlags.Var(filterVar( "cel-expression", ofilter, "Filter flows using the given CEL expression")) + filterFlags.Var(filterVar( + "interface", ofilter, + "Show all flows observed at the given interface name (e.g. eth0)")) rawFilterFlags.StringArray(allowlistFlag, []string{}, "Specify allowlist as JSON encoded FlowFilters") rawFilterFlags.StringArray(denylistFlag, []string{}, "Specify denylist as JSON encoded FlowFilters") diff --git a/vendor/github.com/cilium/cilium/hubble/cmd/observe/flows_filter.go b/vendor/github.com/cilium/cilium/hubble/cmd/observe/flows_filter.go index 26330fe25..42884ca4a 100644 --- a/vendor/github.com/cilium/cilium/hubble/cmd/observe/flows_filter.go +++ b/vendor/github.com/cilium/cilium/hubble/cmd/observe/flows_filter.go @@ -189,6 +189,7 @@ func newFlowFilter() *flowFilter { {"from-pod", "namespace", "all-namespaces"}, {"to-service", "namespace", "all-namespaces"}, {"from-service", "namespace", "all-namespaces"}, + {"snat-ip"}, {"label", "from-label"}, {"label", "to-label"}, {"service", "from-service"}, @@ -424,6 +425,14 @@ func (of *flowFilter) set(f *filterTracker, name, val string, track bool) error f.DestinationPod = append(f.GetDestinationPod(), val) }) // ip filters + case "from-ip": + f.apply(func(f *flowpb.FlowFilter) { + f.SourceIp = append(f.GetSourceIp(), val) + }) + case "snat-ip": + f.apply(func(f *flowpb.FlowFilter) { + f.SourceIpXlated = append(f.SourceIpXlated, val) + }) case "ip": f.applyLeft(func(f *flowpb.FlowFilter) { f.SourceIp = append(f.GetSourceIp(), val) @@ -431,10 +440,6 @@ func (of *flowFilter) set(f *filterTracker, name, val string, track bool) error f.applyRight(func(f *flowpb.FlowFilter) { f.DestinationIp = append(f.GetDestinationIp(), val) }) - case "from-ip": - f.apply(func(f *flowpb.FlowFilter) { - f.SourceIp = append(f.GetSourceIp(), val) - }) case "to-ip": f.apply(func(f *flowpb.FlowFilter) { f.DestinationIp = append(f.GetDestinationIp(), val) @@ -720,7 +725,6 @@ func (of *flowFilter) set(f *filterTracker, name, val string, track bool) error default: return fmt.Errorf("%s: invalid traffic direction, expected ingress or egress", td) } - case "cel-expression": f.apply(func(f *flowpb.FlowFilter) { if f.GetExperimental() == nil { @@ -728,6 +732,10 @@ func (of *flowFilter) set(f *filterTracker, name, val string, track bool) error } f.Experimental.CelExpression = append(f.Experimental.CelExpression, val) }) + case "interface": + f.apply(func(f *flowpb.FlowFilter) { + f.Interface = append(f.Interface, &flowpb.NetworkInterface{Name: val}) + }) } if err := f.checkNamespaceConflicts(f.left); err != nil { diff --git a/vendor/github.com/cilium/cilium/hubble/cmd/observe_help.txt b/vendor/github.com/cilium/cilium/hubble/cmd/observe_help.txt index 219103e43..b62f01998 100644 --- a/vendor/github.com/cilium/cilium/hubble/cmd/observe_help.txt +++ b/vendor/github.com/cilium/cilium/hubble/cmd/observe_help.txt @@ -59,7 +59,8 @@ Filters Flags: --http-status filter Show only flows which match this HTTP status code prefix (e.g. "404", "5+") --http-url filter Show only flows which match this HTTP URL regular expressions (e.g. "http://.*cilium\.io/page/\\d+") --identity filter Show all flows related to an endpoint with the given security identity - --ip filter Show all flows related to the given IP address. Each of the IPs can be specified as an exact match (e.g. '1.1.1.1') or as a CIDR range (e.g.'1.1.1.0/24'). + --interface filter Show all flows observed at the given interface name (e.g. eth0) + --ip filter Show all flows originating or terminating at the given IP address. Each of the IPs can be specified as an exact match (e.g. '1.1.1.1') or as a CIDR range (e.g.'1.1.1.0/24'). --ip-version filter Show only IPv4, IPv6 flows or non IP flows (e.g. ARP packets) (ie: "none", "v4", "v6") -4, --ipv4 filter[=v4] Show only IPv4 flows -6, --ipv6 filter[=v6] Show only IPv6 flows @@ -71,6 +72,7 @@ Filters Flags: --port filter Show only flows with given port in either source or destination (e.g. 8080) --protocol filter Show only flows which match the given L4/L7 flow protocol (e.g. "udp", "http") --service filter Shows flows where either the source or destination IP address matches the ClusterIP address of the given service name prefix ([namespace/]). If namespace is not provided, 'default' is used. + --snat-ip filter Show all flows SNATed with the given IP address. Each of the SNAT IPs can be specified as an exact match (e.g. '1.1.1.1') or as a CIDR range (e.g.'1.1.1.0/24'). --tcp-flags filter Show only flows which match the given TCP flags (e.g. "syn", "ack", "fin") --to-all-namespaces filter[=true] Show flows terminating in any Kubernetes namespace. --to-fqdn filter Show all flows terminating at the given fully qualified domain name (e.g. "*.cilium.io"). diff --git a/vendor/github.com/cilium/cilium/pkg/alibabacloud/eni/types/doc.go b/vendor/github.com/cilium/cilium/pkg/alibabacloud/eni/types/doc.go deleted file mode 100644 index a4d5ab3b9..000000000 --- a/vendor/github.com/cilium/cilium/pkg/alibabacloud/eni/types/doc.go +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// +k8s:deepcopy-gen=package -// +deepequal-gen=package - -// Package types provides Alibaba Cloud specific types -package types diff --git a/vendor/github.com/cilium/cilium/pkg/alibabacloud/eni/types/types.go b/vendor/github.com/cilium/cilium/pkg/alibabacloud/eni/types/types.go deleted file mode 100644 index b57975813..000000000 --- a/vendor/github.com/cilium/cilium/pkg/alibabacloud/eni/types/types.go +++ /dev/null @@ -1,203 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package types - -import ( - "github.com/cilium/cilium/pkg/ipam/types" -) - -// Spec is the ENI specification of a node. This specification is considered -// by the cilium-operator to act as an IPAM operator and makes ENI IPs available -// via the IPAMSpec section. -// -// The ENI specification can either be provided explicitly by the user or the -// cilium-agent running on the node can be instructed to create the CiliumNode -// custom resource along with an ENI specification when the node registers -// itself to the Kubernetes cluster. -type Spec struct { - // InstanceType is the ECS instance type, e.g. "ecs.g6.2xlarge" - // - // +kubebuilder:validation:Optional - InstanceType string `json:"instance-type,omitempty"` - - // AvailabilityZone is the availability zone to use when allocating - // ENIs. - // - // +kubebuilder:validation:Optional - AvailabilityZone string `json:"availability-zone,omitempty"` - - // VPCID is the VPC ID to use when allocating ENIs. - // - // +kubebuilder:validation:Optional - VPCID string `json:"vpc-id,omitempty"` - - // CIDRBlock is vpc ipv4 CIDR - // - // +kubebuilder:validation:Optional - CIDRBlock string `json:"cidr-block,omitempty"` - - // VSwitches is the ID of vSwitch available for ENI - // - // +kubebuilder:validation:Optional - VSwitches []string `json:"vswitches,omitempty"` - - // VSwitchTags is the list of tags to use when evaluating which - // vSwitch to use for the ENI. - // - // +kubebuilder:validation:Optional - VSwitchTags map[string]string `json:"vswitch-tags,omitempty"` - - // SecurityGroups is the list of security groups to attach to any ENI - // that is created and attached to the instance. - // - // +kubebuilder:validation:Optional - SecurityGroups []string `json:"security-groups,omitempty"` - - // SecurityGroupTags is the list of tags to use when evaluating which - // security groups to use for the ENI. - // - // +kubebuilder:validation:Optional - SecurityGroupTags map[string]string `json:"security-group-tags,omitempty"` -} - -const ( - // ENITypePrimary is the type for ENI - ENITypePrimary string = "Primary" - // ENITypeSecondary is the type for ENI - ENITypeSecondary string = "Secondary" -) - -// ENI represents an AlibabaCloud Elastic Network Interface -type ENI struct { - // NetworkInterfaceID is the ENI id - // - // +optional - NetworkInterfaceID string `json:"network-interface-id,omitempty"` - - // MACAddress is the mac address of the ENI - // - // +optional - MACAddress string `json:"mac-address,omitempty"` - - // Type is the ENI type Primary or Secondary - // - // +optional - Type string `json:"type,omitempty"` - - // InstanceID is the InstanceID using this ENI - // - // +optional - InstanceID string `json:"instance-id,omitempty"` - - // SecurityGroupIDs is the security group ids used by this ENI - // - // +optional - SecurityGroupIDs []string `json:"security-groupids,omitempty"` - - // VPC is the vpc to which the ENI belongs - // - // +optional - VPC VPC `json:"vpc,omitempty"` - - // ZoneID is the zone to which the ENI belongs - // - // +optional - ZoneID string `json:"zone-id,omitempty"` - - // VSwitch is the vSwitch the ENI is using - // - // +optional - VSwitch VSwitch `json:"vswitch,omitempty"` - - // PrimaryIPAddress is the primary IP on ENI - // - // +optional - PrimaryIPAddress string `json:"primary-ip-address,omitempty"` - - // PrivateIPSets is the list of all IPs on the ENI, including PrimaryIPAddress - // - // +optional - PrivateIPSets []PrivateIPSet `json:"private-ipsets,omitempty"` - - // Tags is the tags on this ENI - // - // +optional - Tags map[string]string `json:"tags,omitempty"` -} - -func (e *ENI) DeepCopyInterface() types.Interface { - return e.DeepCopy() -} - -// InterfaceID returns the identifier of the interface -func (e *ENI) InterfaceID() string { - return e.NetworkInterfaceID -} - -// ForeachAddress iterates over all addresses and calls fn -func (e *ENI) ForeachAddress(id string, fn types.AddressIterator) error { - for _, address := range e.PrivateIPSets { - if address.Primary { - continue - } - if err := fn(id, e.NetworkInterfaceID, address.PrivateIpAddress, "", address); err != nil { - return err - } - } - - return nil -} - -// ENIStatus is the status of ENI addressing of the node -type ENIStatus struct { - // ENIs is the list of ENIs on the node - // - // +optional - ENIs map[string]ENI `json:"enis,omitempty"` -} - -// PrivateIPSet is a nested struct in ecs response -type PrivateIPSet struct { - PrivateIpAddress string `json:"private-ip-address,omitempty"` - Primary bool `json:"primary,omitempty" ` -} - -type VPC struct { - // VPCID is the vpc to which the ENI belongs - // - // +optional - VPCID string `json:"vpc-id,omitempty"` - - // CIDRBlock is the VPC IPv4 CIDR - // - // +optional - CIDRBlock string `json:"cidr,omitempty"` - - // IPv6CIDRBlock is the VPC IPv6 CIDR - // - // +optional - IPv6CIDRBlock string `json:"ipv6-cidr,omitempty"` - - // SecondaryCIDRs is the list of Secondary CIDRs associated with the VPC - // - // +optional - SecondaryCIDRs []string `json:"secondary-cidrs,omitempty"` -} - -type VSwitch struct { - // VSwitchID is the vSwitch to which the ENI belongs - // - // +optional - VSwitchID string `json:"vswitch-id,omitempty"` - - // CIDRBlock is the vSwitch IPv4 CIDR - // - // +optional - CIDRBlock string `json:"cidr,omitempty"` - - // IPv6CIDRBlock is the vSwitch IPv6 CIDR - // - // +optional - IPv6CIDRBlock string `json:"ipv6-cidr,omitempty"` -} diff --git a/vendor/github.com/cilium/cilium/pkg/alibabacloud/eni/types/zz_generated.deepcopy.go b/vendor/github.com/cilium/cilium/pkg/alibabacloud/eni/types/zz_generated.deepcopy.go deleted file mode 100644 index 309101578..000000000 --- a/vendor/github.com/cilium/cilium/pkg/alibabacloud/eni/types/zz_generated.deepcopy.go +++ /dev/null @@ -1,160 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package types - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ENI) DeepCopyInto(out *ENI) { - *out = *in - if in.SecurityGroupIDs != nil { - in, out := &in.SecurityGroupIDs, &out.SecurityGroupIDs - *out = make([]string, len(*in)) - copy(*out, *in) - } - in.VPC.DeepCopyInto(&out.VPC) - out.VSwitch = in.VSwitch - if in.PrivateIPSets != nil { - in, out := &in.PrivateIPSets, &out.PrivateIPSets - *out = make([]PrivateIPSet, len(*in)) - copy(*out, *in) - } - if in.Tags != nil { - in, out := &in.Tags, &out.Tags - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ENI. -func (in *ENI) DeepCopy() *ENI { - if in == nil { - return nil - } - out := new(ENI) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ENIStatus) DeepCopyInto(out *ENIStatus) { - *out = *in - if in.ENIs != nil { - in, out := &in.ENIs, &out.ENIs - *out = make(map[string]ENI, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ENIStatus. -func (in *ENIStatus) DeepCopy() *ENIStatus { - if in == nil { - return nil - } - out := new(ENIStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PrivateIPSet) DeepCopyInto(out *PrivateIPSet) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrivateIPSet. -func (in *PrivateIPSet) DeepCopy() *PrivateIPSet { - if in == nil { - return nil - } - out := new(PrivateIPSet) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Spec) DeepCopyInto(out *Spec) { - *out = *in - if in.VSwitches != nil { - in, out := &in.VSwitches, &out.VSwitches - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.VSwitchTags != nil { - in, out := &in.VSwitchTags, &out.VSwitchTags - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.SecurityGroups != nil { - in, out := &in.SecurityGroups, &out.SecurityGroups - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.SecurityGroupTags != nil { - in, out := &in.SecurityGroupTags, &out.SecurityGroupTags - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Spec. -func (in *Spec) DeepCopy() *Spec { - if in == nil { - return nil - } - out := new(Spec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VPC) DeepCopyInto(out *VPC) { - *out = *in - if in.SecondaryCIDRs != nil { - in, out := &in.SecondaryCIDRs, &out.SecondaryCIDRs - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VPC. -func (in *VPC) DeepCopy() *VPC { - if in == nil { - return nil - } - out := new(VPC) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VSwitch) DeepCopyInto(out *VSwitch) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VSwitch. -func (in *VSwitch) DeepCopy() *VSwitch { - if in == nil { - return nil - } - out := new(VSwitch) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/github.com/cilium/cilium/pkg/alibabacloud/eni/types/zz_generated.deepequal.go b/vendor/github.com/cilium/cilium/pkg/alibabacloud/eni/types/zz_generated.deepequal.go deleted file mode 100644 index 55fea351a..000000000 --- a/vendor/github.com/cilium/cilium/pkg/alibabacloud/eni/types/zz_generated.deepequal.go +++ /dev/null @@ -1,302 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepequal-gen. DO NOT EDIT. - -package types - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ENI) DeepEqual(other *ENI) bool { - if other == nil { - return false - } - - if in.NetworkInterfaceID != other.NetworkInterfaceID { - return false - } - if in.MACAddress != other.MACAddress { - return false - } - if in.Type != other.Type { - return false - } - if in.InstanceID != other.InstanceID { - return false - } - if ((in.SecurityGroupIDs != nil) && (other.SecurityGroupIDs != nil)) || ((in.SecurityGroupIDs == nil) != (other.SecurityGroupIDs == nil)) { - in, other := &in.SecurityGroupIDs, &other.SecurityGroupIDs - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if !in.VPC.DeepEqual(&other.VPC) { - return false - } - - if in.ZoneID != other.ZoneID { - return false - } - if in.VSwitch != other.VSwitch { - return false - } - - if in.PrimaryIPAddress != other.PrimaryIPAddress { - return false - } - if ((in.PrivateIPSets != nil) && (other.PrivateIPSets != nil)) || ((in.PrivateIPSets == nil) != (other.PrivateIPSets == nil)) { - in, other := &in.PrivateIPSets, &other.PrivateIPSets - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.Tags != nil) && (other.Tags != nil)) || ((in.Tags == nil) != (other.Tags == nil)) { - in, other := &in.Tags, &other.Tags - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if inValue != otherValue { - return false - } - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ENIStatus) DeepEqual(other *ENIStatus) bool { - if other == nil { - return false - } - - if ((in.ENIs != nil) && (other.ENIs != nil)) || ((in.ENIs == nil) != (other.ENIs == nil)) { - in, other := &in.ENIs, &other.ENIs - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if !inValue.DeepEqual(&otherValue) { - return false - } - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PrivateIPSet) DeepEqual(other *PrivateIPSet) bool { - if other == nil { - return false - } - - if in.PrivateIpAddress != other.PrivateIpAddress { - return false - } - if in.Primary != other.Primary { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Spec) DeepEqual(other *Spec) bool { - if other == nil { - return false - } - - if in.InstanceType != other.InstanceType { - return false - } - if in.AvailabilityZone != other.AvailabilityZone { - return false - } - if in.VPCID != other.VPCID { - return false - } - if in.CIDRBlock != other.CIDRBlock { - return false - } - if ((in.VSwitches != nil) && (other.VSwitches != nil)) || ((in.VSwitches == nil) != (other.VSwitches == nil)) { - in, other := &in.VSwitches, &other.VSwitches - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if ((in.VSwitchTags != nil) && (other.VSwitchTags != nil)) || ((in.VSwitchTags == nil) != (other.VSwitchTags == nil)) { - in, other := &in.VSwitchTags, &other.VSwitchTags - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if inValue != otherValue { - return false - } - } - } - } - } - - if ((in.SecurityGroups != nil) && (other.SecurityGroups != nil)) || ((in.SecurityGroups == nil) != (other.SecurityGroups == nil)) { - in, other := &in.SecurityGroups, &other.SecurityGroups - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if ((in.SecurityGroupTags != nil) && (other.SecurityGroupTags != nil)) || ((in.SecurityGroupTags == nil) != (other.SecurityGroupTags == nil)) { - in, other := &in.SecurityGroupTags, &other.SecurityGroupTags - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if inValue != otherValue { - return false - } - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *VPC) DeepEqual(other *VPC) bool { - if other == nil { - return false - } - - if in.VPCID != other.VPCID { - return false - } - if in.CIDRBlock != other.CIDRBlock { - return false - } - if in.IPv6CIDRBlock != other.IPv6CIDRBlock { - return false - } - if ((in.SecondaryCIDRs != nil) && (other.SecondaryCIDRs != nil)) || ((in.SecondaryCIDRs == nil) != (other.SecondaryCIDRs == nil)) { - in, other := &in.SecondaryCIDRs, &other.SecondaryCIDRs - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *VSwitch) DeepEqual(other *VSwitch) bool { - if other == nil { - return false - } - - if in.VSwitchID != other.VSwitchID { - return false - } - if in.CIDRBlock != other.CIDRBlock { - return false - } - if in.IPv6CIDRBlock != other.IPv6CIDRBlock { - return false - } - - return true -} diff --git a/vendor/github.com/cilium/cilium/pkg/allocator/allocator.go b/vendor/github.com/cilium/cilium/pkg/allocator/allocator.go deleted file mode 100644 index 2792a3108..000000000 --- a/vendor/github.com/cilium/cilium/pkg/allocator/allocator.go +++ /dev/null @@ -1,1069 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package allocator - -import ( - "context" - "errors" - "fmt" - - "github.com/google/uuid" - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/pkg/backoff" - "github.com/cilium/cilium/pkg/idpool" - "github.com/cilium/cilium/pkg/inctimer" - "github.com/cilium/cilium/pkg/kvstore" - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/option" - "github.com/cilium/cilium/pkg/rate" - "github.com/cilium/cilium/pkg/time" -) - -var ( - log = logging.DefaultLogger.WithField(logfields.LogSubsys, "allocator") -) - -const ( - // maxAllocAttempts is the number of attempted allocation requests - // performed before failing. - maxAllocAttempts = 16 -) - -// Allocator is a distributed ID allocator backed by a KVstore. It maps -// arbitrary keys to identifiers. Multiple users on different cluster nodes can -// in parallel request the ID for keys and are guaranteed to retrieve the same -// ID for an identical key. -// -// While the details of how keys are stored is delegated to Backend -// implementations, some expectations exist. See pkg/kvstore/allocator for -// details about the kvstore implementation. -// -// A node takes a reference to an identity when it is in-use on that node, and -// the identity remains in-use if there is any node reference to it. When an -// identity no longer has any node references, it may be garbage collected. No -// guarantees are made at that point and the numeric identity may be reused. -// Note that the numeric IDs are selected locally and verified with the Backend. -// -// Lookup ID by key: -// 1. Return ID from local cache updated by watcher (no Backend interactions) -// 2. Do ListPrefix() on slave key excluding node suffix, return the first -// result that matches the exact prefix. -// -// Lookup key by ID: -// 1. Return key from local cache updated by watcher (no Backend interactions) -// 2. Do Get() on master key, return result -// -// Allocate: -// 1. Check local key cache, increment, and return if key is already in use -// locally (no Backend interactions) -// 2. Check local cache updated by watcher, if... -// -// ... match found: -// -// 2.1 Create a new slave key. This operation is potentially racy as the master -// key can be removed in the meantime. -// - etcd: Create is made conditional on existence of master key -// - consul: locking -// -// ... match not found: -// -// 2.1 Select new unused id from local cache -// 2.2 Create a new master key with the condition that it may not exist -// 2.3 Create a new slave key -// -// 1.1. If found, increment and return (no Backend interactions) -// 2. Lookup ID by key in local cache or via first slave key found in Backend -// -// Release: -// 1. Reduce local reference count until last use (no Backend interactions) -// 2. Delete slave key (basePath/value/key1/node1) -// This automatically guarantees that when the last node has released the -// key, the key is no longer found by Get() -// 3. If the node goes down, all slave keys of that node are removed after -// the TTL expires (auto release). -type Allocator struct { - // events is a channel which will receive AllocatorEvent as IDs are - // added, modified or removed from the allocator - events AllocatorEventSendChan - - // keyType is an instance of the type to be used as allocator key. - keyType AllocatorKey - - // min is the lower limit when allocating IDs. The allocator will never - // allocate an ID lesser than this value. - min idpool.ID - - // max is the upper limit when allocating IDs. The allocator will never - // allocate an ID greater than this value. - max idpool.ID - - // prefixMask if set, will be ORed to all selected IDs prior to - // allocation - prefixMask idpool.ID - - // localKeys contains all keys including their reference count for keys - // which have been allocated and are in local use - localKeys *localKeys - - // suffix is the suffix attached to keys which must be node specific, - // this is typical set to the node's IP address - suffix string - - // backoffTemplate is the backoff configuration while allocating - backoffTemplate backoff.Exponential - - // slaveKeysMutex protects the concurrent access of the slave key by this - // agent. - slaveKeysMutex lock.Mutex - - // mainCache is the main cache, representing the allocator contents of - // the primary kvstore connection - mainCache cache - - // remoteCachesMutex protects accesse to remoteCaches - remoteCachesMutex lock.RWMutex - - // remoteCaches is the list of additional remote caches being watched - // in addition to the main cache - remoteCaches map[string]*RemoteCache - - // stopGC is the channel used to stop the garbage collector - stopGC chan struct{} - - // initialListDone is a channel that is closed when the initial - // synchronization has completed - initialListDone waitChan - - // idPool maintains a pool of available ids for allocation. - idPool *idpool.IDPool - - // enableMasterKeyProtection if true, causes master keys that are still in - // local use to be automatically re-created - enableMasterKeyProtection bool - - // disableGC disables the garbage collector - disableGC bool - - // disableAutostart prevents starting the allocator when it is initialized - disableAutostart bool - - // backend is the upstream, shared, backend to which we syncronize local - // information - backend Backend -} - -// AllocatorOption is the base type for allocator options -type AllocatorOption func(*Allocator) - -// NewAllocatorForGC returns an allocator that can be used to run RunGC() -// -// The allocator can be configured by passing in additional options: -// - WithMin(id) - minimum ID to allocate (default: 1) -// - WithMax(id) - maximum ID to allocate (default max(uint64)) -func NewAllocatorForGC(backend Backend, opts ...AllocatorOption) *Allocator { - a := &Allocator{ - backend: backend, - min: idpool.ID(1), - max: idpool.ID(^uint64(0)), - } - - for _, fn := range opts { - fn(a) - } - - return a -} - -type GCStats struct { - // Alive is the number of identities alive - Alive int - - // Deleted is the number of identities deleted - Deleted int -} - -// Backend represents clients to remote ID allocation systems, such as KV -// Stores. These are used to coordinate key->ID allocation between cilium -// nodes. -type Backend interface { - // DeleteAllKeys will delete all keys. It is used in tests. - DeleteAllKeys(ctx context.Context) - - // Encode encodes a key string as required to conform to the key - // restrictions of the backend - Encode(string) string - - // AllocateID creates a new key->ID association. This is expected to be a - // create-only operation, and the ID may be allocated by another node. An - // error in that case is not expected to be fatal. The actual ID is obtained - // by Allocator from the local idPool, which is updated with used-IDs as the - // Backend makes calls to the handler in ListAndWatch. - // The implementation of the backend might return an AllocatorKey that is - // a copy of 'key' with an internal reference of the backend key or, if it - // doesn't use the internal reference of the backend key it simply returns - // 'key'. In case of an error the returned 'AllocatorKey' should be nil. - AllocateID(ctx context.Context, id idpool.ID, key AllocatorKey) (AllocatorKey, error) - - // AllocateIDIfLocked behaves like AllocateID but when lock is non-nil the - // operation proceeds only if it is still valid. - // The implementation of the backend might return an AllocatorKey that is - // a copy of 'key' with an internal reference of the backend key or, if it - // doesn't use the internal reference of the backend key it simply returns - // 'key'. In case of an error the returned 'AllocatorKey' should be nil. - AllocateIDIfLocked(ctx context.Context, id idpool.ID, key AllocatorKey, lock kvstore.KVLocker) (AllocatorKey, error) - - // AcquireReference records that this node is using this key->ID mapping. - // This is distinct from any reference counting within this agent; only one - // reference exists for this node for any number of managed endpoints using - // it. - // The semantics of cleaning up stale references is delegated to the Backend - // implementation. RunGC may need to be invoked. - // This can race, and so lock can be provided (via a Lock call, below). - AcquireReference(ctx context.Context, id idpool.ID, key AllocatorKey, lock kvstore.KVLocker) error - - // Release releases the use of an ID associated with the provided key. It - // does not guard against concurrent calls to - // releases.Release(ctx context.Context, key AllocatorKey) (err error) - Release(ctx context.Context, id idpool.ID, key AllocatorKey) (err error) - - // UpdateKey refreshes the record that this node is using this key -> id - // mapping. When reliablyMissing is set it will also recreate missing master or - // slave keys. - UpdateKey(ctx context.Context, id idpool.ID, key AllocatorKey, reliablyMissing bool) error - - // UpdateKeyIfLocked behaves like UpdateKey but when lock is non-nil the operation proceeds only if it is still valid. - UpdateKeyIfLocked(ctx context.Context, id idpool.ID, key AllocatorKey, reliablyMissing bool, lock kvstore.KVLocker) error - - // Get returns the allocated ID for this key as seen by the Backend. This may - // have been created by other agents. - Get(ctx context.Context, key AllocatorKey) (idpool.ID, error) - - // GetIfLocked behaves like Get, but but when lock is non-nil the - // operation proceeds only if it is still valid. - GetIfLocked(ctx context.Context, key AllocatorKey, lock kvstore.KVLocker) (idpool.ID, error) - - // GetByID returns the key associated with this ID, as seen by the Backend. - // This may have been created by other agents. - GetByID(ctx context.Context, id idpool.ID) (AllocatorKey, error) - - // Lock provides an opaque lock object that can be used, later, to ensure - // that the key has not changed since the lock was created. This can be done - // with GetIfLocked. - Lock(ctx context.Context, key AllocatorKey) (kvstore.KVLocker, error) - - // ListAndWatch begins synchronizing the local Backend instance with its - // remote. - ListAndWatch(ctx context.Context, handler CacheMutations, stopChan chan struct{}) - - // RunGC reaps stale or unused identities within the Backend and makes them - // available for reuse. It is used by the cilium-operator and is not invoked - // by cilium-agent. - // Note: not all Backend implemenations rely on this, such as the kvstore - // backends, and may use leases to expire keys. - RunGC(ctx context.Context, rateLimit *rate.Limiter, staleKeysPrevRound map[string]uint64, minID idpool.ID, maxID idpool.ID) (map[string]uint64, *GCStats, error) - - // RunLocksGC reaps stale or unused locks within the Backend. It is used by - // the cilium-operator and is not invoked by cilium-agent. Returns - // a map of locks currently being held in the KVStore including the ones - // that failed to be GCed. - // Note: not all Backend implementations rely on this, such as the kvstore - // backends, and may use leases to expire keys. - RunLocksGC(ctx context.Context, staleKeysPrevRound map[string]kvstore.Value) (map[string]kvstore.Value, error) - - // Status returns a human-readable status of the Backend. - Status() (string, error) -} - -// NewAllocator creates a new Allocator. Any type can be used as key as long as -// the type implements the AllocatorKey interface. A variable of the type has -// to be passed into NewAllocator() to make the type known. The specified base -// path is used to prefix all keys in the kvstore. The provided path must be -// unique. -// -// The allocator can be configured by passing in additional options: -// - WithEvents() - enable Events channel -// - WithMin(id) - minimum ID to allocate (default: 1) -// - WithMax(id) - maximum ID to allocate (default max(uint64)) -// -// After creation, IDs can be allocated with Allocate() and released with -// Release() -func NewAllocator(typ AllocatorKey, backend Backend, opts ...AllocatorOption) (*Allocator, error) { - a := &Allocator{ - keyType: typ, - backend: backend, - min: idpool.ID(1), - max: idpool.ID(^uint64(0)), - localKeys: newLocalKeys(), - stopGC: make(chan struct{}), - suffix: uuid.New().String()[:10], - remoteCaches: map[string]*RemoteCache{}, - backoffTemplate: backoff.Exponential{ - Min: time.Duration(20) * time.Millisecond, - Factor: 2.0, - }, - } - - for _, fn := range opts { - fn(a) - } - - a.mainCache = newCache(a) - - if a.suffix == "" { - return nil, errors.New("allocator suffix is and unlikely unique") - } - - if a.min < 1 { - return nil, errors.New("minimum ID must be >= 1") - } - - if a.max <= a.min { - return nil, fmt.Errorf("maximum ID must be greater than minimum ID: configured max %v, min %v", a.max, a.min) - } - - a.idPool = idpool.NewIDPool(a.min, a.max) - - if !a.disableAutostart { - a.start() - } - - return a, nil -} - -func (a *Allocator) start() { - a.initialListDone = a.mainCache.start() - if !a.disableGC { - go func() { - select { - case <-a.initialListDone: - case <-time.After(option.Config.AllocatorListTimeout): - log.Fatalf("Timeout while waiting for initial allocator state") - } - a.startLocalKeySync() - }() - } -} - -// WithBackend sets this allocator to use backend. It is expected to be used at -// initialization. -func WithBackend(backend Backend) AllocatorOption { - return func(a *Allocator) { - a.backend = backend - } -} - -// WithEvents enables receiving of events. -// -// CAUTION: When using this function. The provided channel must be continuously -// read while NewAllocator() is being called to ensure that the channel does -// not block indefinitely while NewAllocator() emits events on it while -// populating the initial cache. -func WithEvents(events AllocatorEventSendChan) AllocatorOption { - return func(a *Allocator) { a.events = events } -} - -// WithMin sets the minimum identifier to be allocated -func WithMin(id idpool.ID) AllocatorOption { - return func(a *Allocator) { a.min = id } -} - -// WithMax sets the maximum identifier to be allocated -func WithMax(id idpool.ID) AllocatorOption { - return func(a *Allocator) { a.max = id } -} - -// WithPrefixMask sets the prefix used for all ID allocations. If set, the mask -// will be ORed to all selected IDs prior to allocation. It is the -// responsibility of the caller to ensure that the mask is not conflicting with -// min..max. -func WithPrefixMask(mask idpool.ID) AllocatorOption { - return func(a *Allocator) { a.prefixMask = mask } -} - -// WithMasterKeyProtection will watch for delete events on master keys and -// re-created them if local usage suggests that the key is still in use -func WithMasterKeyProtection() AllocatorOption { - return func(a *Allocator) { a.enableMasterKeyProtection = true } -} - -// WithoutGC disables the use of the garbage collector -func WithoutGC() AllocatorOption { - return func(a *Allocator) { a.disableGC = true } -} - -// WithoutAutostart prevents starting the allocator when it is initialized -func WithoutAutostart() AllocatorOption { - return func(a *Allocator) { a.disableAutostart = true } -} - -// GetEvents returns the events channel given to the allocator when -// constructed. -// Note: This channel is not owned by the allocator! -func (a *Allocator) GetEvents() AllocatorEventSendChan { - return a.events -} - -// Delete deletes an allocator and stops the garbage collector -func (a *Allocator) Delete() { - close(a.stopGC) - a.mainCache.stop() -} - -// WaitForInitialSync waits until the initial sync is complete -func (a *Allocator) WaitForInitialSync(ctx context.Context) error { - select { - case <-a.initialListDone: - case <-ctx.Done(): - return fmt.Errorf("identity sync was cancelled: %w", ctx.Err()) - } - - return nil -} - -// RangeFunc is the function called by RangeCache -type RangeFunc func(idpool.ID, AllocatorKey) - -// ForeachCache iterates over the allocator cache and calls RangeFunc on each -// cached entry -func (a *Allocator) ForeachCache(cb RangeFunc) { - a.mainCache.foreach(cb) - - a.remoteCachesMutex.RLock() - for _, rc := range a.remoteCaches { - rc.cache.foreach(cb) - } - a.remoteCachesMutex.RUnlock() -} - -// selectAvailableID selects an available ID. -// Returns a triple of the selected ID ORed with prefixMask, the ID string and -// the originally selected ID. -func (a *Allocator) selectAvailableID() (idpool.ID, string, idpool.ID) { - if id := a.idPool.LeaseAvailableID(); id != idpool.NoID { - unmaskedID := id - id |= a.prefixMask - return id, id.String(), unmaskedID - } - - return 0, "", 0 -} - -// AllocatorKey is the interface to implement in order for a type to be used as -// key for the allocator. The key's data is assumed to be a collection of -// pkg/label.Label, and the functions reflect this somewhat. -type AllocatorKey interface { - fmt.Stringer - - // GetKey returns the canonical string representation of the key - GetKey() string - - // PutKey stores the information in v into the key. This is the inverse - // operation to GetKey - PutKey(v string) AllocatorKey - - // GetAsMap returns the key as a collection of "labels" with a key and value. - // This is the inverse operation to PutKeyFromMap. - GetAsMap() map[string]string - - // PutKeyFromMap stores the labels in v into the key to be used later. This - // is the inverse operation to GetAsMap. - PutKeyFromMap(v map[string]string) AllocatorKey - - // PutValue puts metadata inside the global identity for the given 'key' with - // the given 'value'. - PutValue(key any, value any) AllocatorKey - - // Value returns the value stored in the metadata map. - Value(key any) any -} - -func (a *Allocator) encodeKey(key AllocatorKey) string { - return a.backend.Encode(key.GetKey()) -} - -// Return values: -// 1. allocated ID -// 2. whether the ID is newly allocated from kvstore -// 3. whether this is the first owner that holds a reference to the key in -// localkeys store -// 4. error in case of failure -func (a *Allocator) lockedAllocate(ctx context.Context, key AllocatorKey) (idpool.ID, bool, bool, error) { - var firstUse bool - - kvstore.Trace("Allocating key in kvstore", nil, logrus.Fields{fieldKey: key}) - - k := a.encodeKey(key) - lock, err := a.backend.Lock(ctx, key) - if err != nil { - return 0, false, false, err - } - - defer lock.Unlock(context.Background()) - - // fetch first key that matches /value/ while ignoring the - // node suffix - value, err := a.GetIfLocked(ctx, key, lock) - if err != nil { - return 0, false, false, err - } - - kvstore.Trace("kvstore state is: ", nil, logrus.Fields{fieldID: value}) - - a.slaveKeysMutex.Lock() - defer a.slaveKeysMutex.Unlock() - - // We shouldn't assume the fact the master key does not exist in the kvstore - // that localKeys does not have it. The KVStore might have lost all of its - // data but the local agent still holds a reference for the given master key. - if value == 0 { - value = a.localKeys.lookupKey(k) - if value != 0 { - // re-create master key - if err := a.backend.UpdateKeyIfLocked(ctx, value, key, true, lock); err != nil { - return 0, false, false, fmt.Errorf("unable to re-create missing master key '%s': %s while allocating ID: %w", key, value, err) - } - } - } else { - _, firstUse, err = a.localKeys.allocate(k, key, value) - if err != nil { - return 0, false, false, fmt.Errorf("unable to reserve local key '%s': %w", k, err) - } - - if firstUse { - log.WithField(fieldKey, k).Debug("Reserved new local key") - } else { - log.WithField(fieldKey, k).Debug("Reusing existing local key") - } - } - - if value != 0 { - log.WithField(fieldKey, k).Info("Reusing existing global key") - - if err = a.backend.AcquireReference(ctx, value, key, lock); err != nil { - a.localKeys.release(k) - return 0, false, false, fmt.Errorf("unable to create secondary key '%s': %w", k, err) - } - - // mark the key as verified in the local cache - if err := a.localKeys.verify(k); err != nil { - log.WithError(err).Error("BUG: Unable to verify local key") - } - - return value, false, firstUse, nil - } - - log.WithField(fieldKey, k).Debug("Allocating new master ID") - id, strID, unmaskedID := a.selectAvailableID() - if id == 0 { - return 0, false, false, fmt.Errorf("no more available IDs in configured space") - } - - kvstore.Trace("Selected available key ID", nil, logrus.Fields{fieldID: id}) - - releaseKeyAndID := func() { - a.localKeys.release(k) - a.idPool.Release(unmaskedID) // This returns this ID to be re-used for other keys - } - - oldID, firstUse, err := a.localKeys.allocate(k, key, id) - if err != nil { - a.idPool.Release(unmaskedID) - return 0, false, false, fmt.Errorf("unable to reserve local key '%s': %w", k, err) - } - - // Another local writer beat us to allocating an ID for the same key, - // start over - if id != oldID { - releaseKeyAndID() - return 0, false, false, fmt.Errorf("another writer has allocated key %s", k) - } - - // Check that this key has not been allocated in the cluster during our - // operation here - value, err = a.GetNoCache(ctx, key) - if err != nil { - releaseKeyAndID() - return 0, false, false, err - } - if value != 0 { - releaseKeyAndID() - return 0, false, false, fmt.Errorf("Found master key after proceeding with new allocation for %s", k) - } - - // Assigned to 'key' from 'key2' since in case of an error, we don't replace - // the original 'key' variable with 'nil'. - key2 := key - key, err = a.backend.AllocateIDIfLocked(ctx, id, key2, lock) - if err != nil { - // Creation failed. Another agent most likely beat us to allocting this - // ID, retry. - releaseKeyAndID() - return 0, false, false, fmt.Errorf("unable to allocate ID %s for key %s: %w", strID, key2, err) - } - - // Notify pool that leased ID is now in-use. - a.idPool.Use(unmaskedID) - - if err = a.backend.AcquireReference(ctx, id, key, lock); err != nil { - // We will leak the master key here as the key has already been - // exposed and may be in use by other nodes. The garbage - // collector will release it again. - releaseKeyAndID() - return 0, false, false, fmt.Errorf("secondary key creation failed '%s': %w", k, err) - } - - // mark the key as verified in the local cache - if err := a.localKeys.verify(k); err != nil { - log.WithError(err).Error("BUG: Unable to verify local key") - } - - log.WithField(fieldKey, k).Info("Allocated new global key") - - return id, true, firstUse, nil -} - -// Allocate will retrieve the ID for the provided key. If no ID has been -// allocated for this key yet, a key will be allocated. If allocation fails, -// most likely due to a parallel allocation of the same ID by another user, -// allocation is re-attempted for maxAllocAttempts times. -// -// Return values: -// 1. allocated ID -// 2. whether the ID is newly allocated from kvstore -// 3. whether this is the first owner that holds a reference to the key in -// localkeys store -// 4. error in case of failure -func (a *Allocator) Allocate(ctx context.Context, key AllocatorKey) (idpool.ID, bool, bool, error) { - var ( - err error - value idpool.ID - isNew bool - firstUse bool - k = a.encodeKey(key) - ) - - log.WithField(fieldKey, key).Debug("Allocating key") - - select { - case <-a.initialListDone: - case <-ctx.Done(): - return 0, false, false, fmt.Errorf("allocation was cancelled while waiting for initial key list to be received: %w", ctx.Err()) - } - - kvstore.Trace("Allocating from kvstore", nil, logrus.Fields{fieldKey: key}) - - // make a copy of the template and customize it - boff := a.backoffTemplate - boff.Name = key.String() - - for attempt := 0; attempt < maxAllocAttempts; attempt++ { - // Check our list of local keys already in use and increment the - // refcnt. The returned key must be released afterwards. No kvstore - // operation was performed for this allocation. - // We also do this on every loop as a different Allocate call might have - // allocated the key while we are attempting to allocate in this - // execution thread. It does not hurt to check if localKeys contains a - // reference for the key that we are attempting to allocate. - if val := a.localKeys.use(k); val != idpool.NoID { - kvstore.Trace("Reusing local id", nil, logrus.Fields{fieldID: val, fieldKey: key}) - a.mainCache.insert(key, val) - return val, false, false, nil - } - - // FIXME: Add non-locking variant - value, isNew, firstUse, err = a.lockedAllocate(ctx, key) - if err == nil { - a.mainCache.insert(key, value) - log.WithField(fieldKey, key).WithField(fieldID, value).Debug("Allocated key") - return value, isNew, firstUse, nil - } - - scopedLog := log.WithFields(logrus.Fields{ - fieldKey: key, - logfields.Attempt: attempt, - }) - - select { - case <-ctx.Done(): - scopedLog.WithError(ctx.Err()).Warning("Ongoing key allocation has been cancelled") - return 0, false, false, fmt.Errorf("key allocation cancelled: %w", ctx.Err()) - default: - scopedLog.WithError(err).Warning("Key allocation attempt failed") - } - - kvstore.Trace("Allocation attempt failed", err, logrus.Fields{fieldKey: key, logfields.Attempt: attempt}) - - if waitErr := boff.Wait(ctx); waitErr != nil { - return 0, false, false, waitErr - } - } - - return 0, false, false, err -} - -// GetIfLocked returns the ID which is allocated to a key. Returns an ID of NoID if no ID -// has been allocated to this key yet if the client is still holding the given -// lock. -func (a *Allocator) GetIfLocked(ctx context.Context, key AllocatorKey, lock kvstore.KVLocker) (idpool.ID, error) { - if id := a.mainCache.get(a.encodeKey(key)); id != idpool.NoID { - return id, nil - } - - return a.backend.GetIfLocked(ctx, key, lock) -} - -// Get returns the ID which is allocated to a key. Returns an ID of NoID if no ID -// has been allocated to this key yet. -func (a *Allocator) Get(ctx context.Context, key AllocatorKey) (idpool.ID, error) { - if id := a.mainCache.get(a.encodeKey(key)); id != idpool.NoID { - return id, nil - } - - return a.GetNoCache(ctx, key) -} - -// GetNoCache returns the ID which is allocated to a key in the kvstore, -// bypassing the local copy of allocated keys. -func (a *Allocator) GetNoCache(ctx context.Context, key AllocatorKey) (idpool.ID, error) { - return a.backend.Get(ctx, key) -} - -// GetByID returns the key associated with an ID. Returns nil if no key is -// associated with the ID. -func (a *Allocator) GetByID(ctx context.Context, id idpool.ID) (AllocatorKey, error) { - if key := a.mainCache.getByID(id); key != nil { - return key, nil - } - - return a.backend.GetByID(ctx, id) -} - -// GetIncludeRemoteCaches returns the ID which is allocated to a key. Includes the -// caches of watched remote kvstores in the query. Returns an ID of NoID if no -// ID has been allocated in any remote kvstore to this key yet. -func (a *Allocator) GetIncludeRemoteCaches(ctx context.Context, key AllocatorKey) (idpool.ID, error) { - encoded := a.encodeKey(key) - - // check main cache first - if id := a.mainCache.get(encoded); id != idpool.NoID { - return id, nil - } - - // check remote caches - a.remoteCachesMutex.RLock() - for _, rc := range a.remoteCaches { - if id := rc.cache.get(encoded); id != idpool.NoID { - a.remoteCachesMutex.RUnlock() - return id, nil - } - } - a.remoteCachesMutex.RUnlock() - - // check main backend - if id, err := a.backend.Get(ctx, key); id != idpool.NoID || err != nil { - return id, err - } - - // we skip checking remote backends explicitly here, to avoid - // accidentally overloading them in case of lookups for invalid identities - - return idpool.NoID, nil -} - -// GetByIDIncludeRemoteCaches returns the key associated with an ID. Includes -// the caches of watched remote kvstores in the query. -// Returns nil if no key is associated with the ID. -func (a *Allocator) GetByIDIncludeRemoteCaches(ctx context.Context, id idpool.ID) (AllocatorKey, error) { - // check main cache first - if key := a.mainCache.getByID(id); key != nil { - return key, nil - } - - // check remote caches - a.remoteCachesMutex.RLock() - for _, rc := range a.remoteCaches { - if key := rc.cache.getByID(id); key != nil { - a.remoteCachesMutex.RUnlock() - return key, nil - } - } - a.remoteCachesMutex.RUnlock() - - // check main backend - if key, err := a.backend.GetByID(ctx, id); key != nil || err != nil { - return key, err - } - - // we skip checking remote backends explicitly here, to avoid - // accidentally overloading them in case of lookups for invalid identities - - return nil, nil -} - -// Release releases the use of an ID associated with the provided key. After -// the last user has released the ID, the key is removed in the KVstore and -// the returned lastUse value is true. -func (a *Allocator) Release(ctx context.Context, key AllocatorKey) (lastUse bool, err error) { - log.WithField(fieldKey, key).Info("Releasing key") - - select { - case <-a.initialListDone: - case <-ctx.Done(): - return false, fmt.Errorf("release was cancelled while waiting for initial key list to be received: %w", ctx.Err()) - } - - k := a.encodeKey(key) - - a.slaveKeysMutex.Lock() - defer a.slaveKeysMutex.Unlock() - - // release the key locally, if it was the last use, remove the node - // specific value key to remove the global reference mark - var id idpool.ID - lastUse, id, err = a.localKeys.release(k) - if err != nil { - return lastUse, err - } - if lastUse { - // Since in CRD mode we don't have a way to map which identity is being - // used by a node, we need to also pass the ID to the release function. - // This allows the CRD store to find the right identity by its ID and - // remove the node reference on that identity. - a.backend.Release(ctx, id, key) - } - - return lastUse, err -} - -// RunGC scans the kvstore for unused master keys and removes them -func (a *Allocator) RunGC(rateLimit *rate.Limiter, staleKeysPrevRound map[string]uint64) (map[string]uint64, *GCStats, error) { - return a.backend.RunGC(context.TODO(), rateLimit, staleKeysPrevRound, a.min, a.max) -} - -// RunLocksGC scans the kvstore for stale locks and removes them -func (a *Allocator) RunLocksGC(ctx context.Context, staleLocksPrevRound map[string]kvstore.Value) (map[string]kvstore.Value, error) { - return a.backend.RunLocksGC(ctx, staleLocksPrevRound) -} - -// DeleteAllKeys will delete all keys. It is expected to be used in tests. -func (a *Allocator) DeleteAllKeys() { - a.backend.DeleteAllKeys(context.TODO()) -} - -// syncLocalKeys checks the kvstore and verifies that a master key exists for -// all locally used allocations. This will restore master keys if deleted for -// some reason. -func (a *Allocator) syncLocalKeys() error { - // Create a local copy of all local allocations to not require to hold - // any locks while performing kvstore operations. Local use can - // disappear while we perform the sync but that is fine as worst case, - // a master key is created for a slave key that no longer exists. The - // garbage collector will remove it again. - ids := a.localKeys.getVerifiedIDs() - - for id, value := range ids { - if err := a.backend.UpdateKey(context.TODO(), id, value, false); err != nil { - log.WithError(err).WithFields(logrus.Fields{ - fieldKey: value, - fieldID: id, - }).Warning("Unable to sync key") - } - } - - return nil -} - -func (a *Allocator) startLocalKeySync() { - go func(a *Allocator) { - kvTimer, kvTimerDone := inctimer.New() - defer kvTimerDone() - for { - if err := a.syncLocalKeys(); err != nil { - log.WithError(err).Warning("Unable to run local key sync routine") - } - - select { - case <-a.stopGC: - log.Debug("Stopped master key sync routine") - return - case <-kvTimer.After(option.Config.KVstorePeriodicSync): - } - } - }(a) -} - -// AllocatorEventChan is a channel to receive allocator events on -type AllocatorEventChan chan AllocatorEvent - -// Send- and receive-only versions of the above. -type AllocatorEventRecvChan = <-chan AllocatorEvent -type AllocatorEventSendChan = chan<- AllocatorEvent - -// AllocatorEvent is an event sent over AllocatorEventChan -type AllocatorEvent struct { - // Typ is the type of event (create / modify / delete) - Typ kvstore.EventType - - // ID is the allocated ID - ID idpool.ID - - // Key is the key associated with the ID - Key AllocatorKey -} - -// RemoteCache represents the cache content of an additional kvstore managing -// identities. The contents are not directly accessible but will be merged into -// the ForeachCache() function. -type RemoteCache struct { - name string - - allocator *Allocator - cache *cache - - watchFunc func(ctx context.Context, remote *RemoteCache, onSync func(context.Context)) -} - -func (a *Allocator) NewRemoteCache(remoteName string, remoteAlloc *Allocator) *RemoteCache { - return &RemoteCache{ - name: remoteName, - allocator: remoteAlloc, - cache: &remoteAlloc.mainCache, - - watchFunc: a.WatchRemoteKVStore, - } -} - -// WatchRemoteKVStore starts watching an allocator base prefix the kvstore -// represents by the provided backend. A local cache of all identities of that -// kvstore will be maintained in the RemoteCache structure returned and will -// start being reported in the identities returned by the ForeachCache() -// function. RemoteName should be unique per logical "remote". -func (a *Allocator) WatchRemoteKVStore(ctx context.Context, rc *RemoteCache, onSync func(context.Context)) { - scopedLog := log.WithField(logfields.ClusterName, rc.name) - scopedLog.Info("Starting remote kvstore watcher") - - rc.allocator.start() - - select { - case <-ctx.Done(): - scopedLog.Debug("Context canceled before remote kvstore watcher synchronization completed: stale identities will now be drained") - rc.close() - - a.remoteCachesMutex.RLock() - old := a.remoteCaches[rc.name] - a.remoteCachesMutex.RUnlock() - - if old != nil { - old.cache.mutex.RLock() - defer old.cache.mutex.RUnlock() - } - - // Drain all entries that might have been received until now, and that - // are not present in the current cache (if any). This ensures we do not - // leak any stale identity, and at the same time we do not invalidate the - // current state. - rc.cache.drainIf(func(id idpool.ID) bool { - if old == nil { - return true - } - - _, ok := old.cache.nextCache[id] - return !ok - }) - return - - case <-rc.cache.listDone: - scopedLog.Info("Remote kvstore watcher successfully synchronized and registered") - } - - a.remoteCachesMutex.Lock() - old := a.remoteCaches[rc.name] - a.remoteCaches[rc.name] = rc - a.remoteCachesMutex.Unlock() - - if old != nil { - // In case of reconnection, let's emit a deletion event for all stale identities - // that are no longer present in the kvstore. We take the lock of the new cache - // to ensure that we observe a stable state during this process (i.e., no keys - // are added/removed in the meanwhile). - scopedLog.Debug("Another kvstore watcher was already registered: deleting stale identities") - rc.cache.mutex.RLock() - old.cache.drainIf(func(id idpool.ID) bool { - _, ok := rc.cache.nextCache[id] - return !ok - }) - rc.cache.mutex.RUnlock() - } - - // Execute the on-sync callback handler. - onSync(ctx) - - <-ctx.Done() - rc.close() - scopedLog.Info("Stopped remote kvstore watcher") -} - -// RemoveRemoteKVStore removes any reference to a remote allocator / kvstore, emitting -// a deletion event for all previously known identities. -func (a *Allocator) RemoveRemoteKVStore(remoteName string) { - a.remoteCachesMutex.Lock() - old := a.remoteCaches[remoteName] - delete(a.remoteCaches, remoteName) - a.remoteCachesMutex.Unlock() - - if old != nil { - old.cache.drain() - log.WithField(logfields.ClusterName, remoteName).Info("Remote kvstore watcher unregistered") - } -} - -// Watch starts watching the remote kvstore and synchronize the identities in -// the local cache. It blocks until the context is closed. -func (rc *RemoteCache) Watch(ctx context.Context, onSync func(context.Context)) { - rc.watchFunc(ctx, rc, onSync) -} - -// NumEntries returns the number of entries in the remote cache -func (rc *RemoteCache) NumEntries() int { - if rc == nil { - return 0 - } - - return rc.cache.numEntries() -} - -// Synced returns whether the initial list of entries has been retrieved from -// the kvstore, and new events are currently being watched. -func (rc *RemoteCache) Synced() bool { - if rc == nil { - return false - } - - select { - case <-rc.cache.stopChan: - return false - default: - select { - case <-rc.cache.listDone: - return true - default: - return false - } - } -} - -// close stops watching for identities in the kvstore associated with the -// remote cache. -func (rc *RemoteCache) close() { - rc.cache.allocator.Delete() -} - -// Observe the identity changes. Conforms to stream.Observable. -// Replays the current state of the cache when subscribing. -func (a *Allocator) Observe(ctx context.Context, next func(AllocatorChange), complete func(error)) { - a.mainCache.Observe(ctx, next, complete) -} diff --git a/vendor/github.com/cilium/cilium/pkg/allocator/cache.go b/vendor/github.com/cilium/cilium/pkg/allocator/cache.go deleted file mode 100644 index 4b19697c8..000000000 --- a/vendor/github.com/cilium/cilium/pkg/allocator/cache.go +++ /dev/null @@ -1,381 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package allocator - -import ( - "context" - "sync" - - "github.com/cilium/stream" - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/pkg/controller" - "github.com/cilium/cilium/pkg/idpool" - "github.com/cilium/cilium/pkg/kvstore" - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/time" -) - -// backendOpTimeout is the time allowed for operations sent to backends in -// response to events such as create/modify/delete. -const backendOpTimeout = 10 * time.Second - -// idMap provides mapping from ID to an AllocatorKey -type idMap map[idpool.ID]AllocatorKey - -// keyMap provides mapping from AllocatorKey to ID -type keyMap map[string]idpool.ID - -type cache struct { - controllers *controller.Manager - - allocator *Allocator - - stopChan chan struct{} - - // mutex protects all cache data structures - mutex lock.RWMutex - - // cache is a local cache of all IDs allocated in the kvstore. It is - // being maintained by watching for kvstore events and can thus lag - // behind. - cache idMap - - // keyCache shadows cache and allows access by key - keyCache keyMap - - // nextCache is the cache is constantly being filled by startWatch(), - // when startWatch has successfully performed the initial fill using - // ListPrefix, the cache above will be pointed to nextCache. If the - // startWatch() fails to perform the initial list, then the cache is - // never pointed to nextCache. This guarantees that a valid cache is - // kept at all times. - nextCache idMap - - // nextKeyCache follows the same logic as nextCache but for keyCache - nextKeyCache keyMap - - listDone waitChan - - // stopWatchWg is a wait group that gets conditions added when a - // watcher is started with the conditions marked as done when the - // watcher has exited - stopWatchWg sync.WaitGroup - - changeSrc stream.Observable[AllocatorChange] - emitChange func(AllocatorChange) - completeChangeSrc func(error) -} - -func newCache(a *Allocator) (c cache) { - c = cache{ - allocator: a, - cache: idMap{}, - keyCache: keyMap{}, - stopChan: make(chan struct{}), - controllers: controller.NewManager(), - } - c.changeSrc, c.emitChange, c.completeChangeSrc = stream.Multicast[AllocatorChange]() - return -} - -type waitChan chan struct{} - -// CacheMutations are the operations given to a Backend's ListAndWatch command. -// They are called on changes to identities. -type CacheMutations interface { - // OnListDone is called when the initial full-sync is complete. - OnListDone() - - // OnAdd is called when a new key->ID appears. - OnAdd(id idpool.ID, key AllocatorKey) - - // OnModify is called when a key->ID mapping is modified. This may happen - // when leases are updated, and does not mean the actual mapping had changed. - OnModify(id idpool.ID, key AllocatorKey) - - // OnDelete is called when a key->ID mapping is removed. This may trigger - // master-key protection, if enabled, where the local allocator will recreate - // the key->ID association is recreated because the local node is still using - // it. - OnDelete(id idpool.ID, key AllocatorKey) -} - -func (c *cache) sendEvent(typ kvstore.EventType, id idpool.ID, key AllocatorKey) { - if events := c.allocator.events; events != nil { - events <- AllocatorEvent{Typ: typ, ID: id, Key: key} - } -} - -func (c *cache) OnListDone() { - c.mutex.Lock() - // nextCache is valid, point the live cache to it - c.cache = c.nextCache - c.keyCache = c.nextKeyCache - c.mutex.Unlock() - - log.Debug("Initial list of identities received") - - // report that the list operation has - // been completed and the allocator is - // ready to use - close(c.listDone) -} - -func (c *cache) OnAdd(id idpool.ID, key AllocatorKey) { - c.mutex.Lock() - defer c.mutex.Unlock() - - c.nextCache[id] = key - if key != nil { - c.nextKeyCache[c.allocator.encodeKey(key)] = id - } - c.allocator.idPool.Remove(id) - - c.emitChange(AllocatorChange{Kind: AllocatorChangeUpsert, ID: id, Key: key}) - - c.sendEvent(kvstore.EventTypeCreate, id, key) -} - -func (c *cache) OnModify(id idpool.ID, key AllocatorKey) { - c.mutex.Lock() - defer c.mutex.Unlock() - - if k, ok := c.nextCache[id]; ok { - delete(c.nextKeyCache, c.allocator.encodeKey(k)) - } - - c.nextCache[id] = key - if key != nil { - c.nextKeyCache[c.allocator.encodeKey(key)] = id - } - - c.emitChange(AllocatorChange{Kind: AllocatorChangeUpsert, ID: id, Key: key}) - - c.sendEvent(kvstore.EventTypeModify, id, key) -} - -func (c *cache) OnDelete(id idpool.ID, key AllocatorKey) { - c.mutex.Lock() - defer c.mutex.Unlock() - - c.onDeleteLocked(id, key, true) -} - -const syncIdentityControllerGroup = "sync-identity" - -func syncControllerName(id idpool.ID) string { - return syncIdentityControllerGroup + "-" + id.String() -} - -// no max interval by default, exposed as a variable for testing. -var masterKeyRecreateMaxInterval = time.Duration(0) - -var syncIdentityGroup = controller.NewGroup(syncIdentityControllerGroup) - -// onDeleteLocked must be called while holding c.Mutex for writing -func (c *cache) onDeleteLocked(id idpool.ID, key AllocatorKey, recreateMissingLocalKeys bool) { - a := c.allocator - if a.enableMasterKeyProtection && recreateMissingLocalKeys { - if value := a.localKeys.lookupID(id); value != nil { - c.controllers.UpdateController(syncControllerName(id), controller.ControllerParams{ - Context: context.Background(), - MaxRetryInterval: masterKeyRecreateMaxInterval, - Group: syncIdentityGroup, - DoFunc: func(ctx context.Context) error { - c.mutex.Lock() - defer c.mutex.Unlock() - // For each attempt, check if this ciliumidentity is still a candidate for recreation. - // It's possible that since the last iteration that this agent has legitimately deleted - // the key, in which case we can stop trying to recreate it. - if value := c.allocator.localKeys.lookupID(id); value == nil { - return nil - } - - ctx, cancel := context.WithTimeout(ctx, backendOpTimeout) - defer cancel() - - // Each iteration will attempt to grab the key reference, if that succeeds - // then this completes (i.e. the key exists). - // Otherwise we will attempt to create the key, this process repeats until - // the key is created. - if err := a.backend.UpdateKey(ctx, id, value, true); err != nil { - log.WithField("id", id).WithError(err).Error("OnDelete MasterKeyProtection update for key") - return err - } - log.WithField("id", id).Info("OnDelete MasterKeyProtection update succeeded") - return nil - }, - }) - - return - } - } - - if k, ok := c.nextCache[id]; ok && k != nil { - delete(c.nextKeyCache, c.allocator.encodeKey(k)) - } - - delete(c.nextCache, id) - a.idPool.Insert(id) - - c.emitChange(AllocatorChange{Kind: AllocatorChangeDelete, ID: id, Key: key}) - - c.sendEvent(kvstore.EventTypeDelete, id, key) -} - -// start requests a LIST operation from the kvstore and starts watching the -// prefix in a go subroutine. -func (c *cache) start() waitChan { - c.listDone = make(waitChan) - - c.mutex.Lock() - - // start with a fresh nextCache - c.nextCache = idMap{} - c.nextKeyCache = keyMap{} - c.mutex.Unlock() - - c.stopWatchWg.Add(1) - - go func() { - c.allocator.backend.ListAndWatch(context.TODO(), c, c.stopChan) - c.stopWatchWg.Done() - }() - - return c.listDone -} - -func (c *cache) stop() { - close(c.stopChan) - c.stopWatchWg.Wait() - // Drain/stop any remaining sync identity controllers. - // Backend watch is now stopped, any running controllers attempting to - // sync identities will complete and stop (possibly in a unresolved state). - c.controllers.RemoveAllAndWait() - c.completeChangeSrc(nil) -} - -// drain emits a deletion event for all known IDs. It must be called after the -// cache has been stopped, to ensure that no new events can be received afterwards. -func (c *cache) drain() { - // Make sure we wait until the watch loop has been properly stopped. - c.stopWatchWg.Wait() - - c.mutex.Lock() - for id, key := range c.nextCache { - c.onDeleteLocked(id, key, false) - } - c.mutex.Unlock() -} - -// drainIf emits a deletion event for all known IDs that are stale according to -// the isStale function. It must be called after the cache has been stopped, to -// ensure that no new events can be received afterwards. -func (c *cache) drainIf(isStale func(id idpool.ID) bool) { - // Make sure we wait until the watch loop has been properly stopped, otherwise - // new IDs might be added afterwards we complete the draining process. - c.stopWatchWg.Wait() - - c.mutex.Lock() - for id, key := range c.nextCache { - if isStale(id) { - c.onDeleteLocked(id, key, false) - log.WithFields(logrus.Fields{fieldID: id, fieldKey: key}). - Debug("Stale identity deleted") - } - } - c.mutex.Unlock() -} - -func (c *cache) get(key string) idpool.ID { - c.mutex.RLock() - if id, ok := c.keyCache[key]; ok { - c.mutex.RUnlock() - return id - } - c.mutex.RUnlock() - - return idpool.NoID -} - -func (c *cache) getByID(id idpool.ID) AllocatorKey { - c.mutex.RLock() - if v, ok := c.cache[id]; ok { - c.mutex.RUnlock() - return v - } - c.mutex.RUnlock() - - return nil -} - -func (c *cache) foreach(cb RangeFunc) { - c.mutex.RLock() - for k, v := range c.cache { - cb(k, v) - } - c.mutex.RUnlock() -} - -func (c *cache) insert(key AllocatorKey, val idpool.ID) { - c.mutex.Lock() - c.nextCache[val] = key - c.nextKeyCache[c.allocator.encodeKey(key)] = val - c.mutex.Unlock() -} - -func (c *cache) numEntries() int { - c.mutex.RLock() - defer c.mutex.RUnlock() - return len(c.nextCache) -} - -type AllocatorChangeKind string - -const ( - AllocatorChangeSync AllocatorChangeKind = "sync" - AllocatorChangeUpsert AllocatorChangeKind = "upsert" - AllocatorChangeDelete AllocatorChangeKind = "delete" -) - -type AllocatorChange struct { - Kind AllocatorChangeKind - ID idpool.ID - Key AllocatorKey -} - -// Observe the allocator changes. Conforms to stream.Observable. -// Replays the current state of the cache when subscribing. -func (c *cache) Observe(ctx context.Context, next func(AllocatorChange), complete func(error)) { - // This short-lived go routine serves the purpose of replaying the current state of the cache before starting - // to observe the actual source changeSrc. ChangeSrc is backed by a stream.FuncObservable, that will start its own - // go routine. Therefore, the current go routine will stop and free the lock on the mutex after the registration. - go func() { - // Wait until initial listing has completed before - // replaying the state. - select { - case <-c.listDone: - case <-ctx.Done(): - complete(ctx.Err()) - return - } - - c.mutex.RLock() - defer c.mutex.RUnlock() - - for id, key := range c.cache { - next(AllocatorChange{Kind: AllocatorChangeUpsert, ID: id, Key: key}) - } - - // Emit a sync event to inform the subscriber that it has received a consistent - // initial state. - next(AllocatorChange{Kind: AllocatorChangeSync}) - - // And subscribe to new events. Since we held the read-lock there won't be any - // missed or duplicate events. - c.changeSrc.Observe(ctx, next, complete) - }() - -} diff --git a/vendor/github.com/cilium/cilium/pkg/allocator/doc.go b/vendor/github.com/cilium/cilium/pkg/allocator/doc.go deleted file mode 100644 index 26c9a9aad..000000000 --- a/vendor/github.com/cilium/cilium/pkg/allocator/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Package allocator provides a kvstore based ID allocator -package allocator diff --git a/vendor/github.com/cilium/cilium/pkg/allocator/localkeys.go b/vendor/github.com/cilium/cilium/pkg/allocator/localkeys.go deleted file mode 100644 index 48820d736..000000000 --- a/vendor/github.com/cilium/cilium/pkg/allocator/localkeys.go +++ /dev/null @@ -1,156 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package allocator - -import ( - "fmt" - - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/pkg/idpool" - "github.com/cilium/cilium/pkg/kvstore" - "github.com/cilium/cilium/pkg/lock" -) - -type localKey struct { - val idpool.ID - key AllocatorKey - refcnt uint64 - - // verified is true when the key has been synced with the kvstore - verified bool -} - -// localKeys is a map of keys in use locally. Keys can be used multiple times. -// A refcnt is managed to know when a key is no longer in use -type localKeys struct { - lock.RWMutex - keys map[string]*localKey - ids map[idpool.ID]*localKey -} - -func newLocalKeys() *localKeys { - return &localKeys{ - keys: map[string]*localKey{}, - ids: map[idpool.ID]*localKey{}, - } -} - -// allocate creates an entry for key in localKeys if needed and increments the -// refcnt. The value associated with the key must match the local cache or an -// error is returned -func (lk *localKeys) allocate(keyString string, key AllocatorKey, val idpool.ID) (idpool.ID, bool, error) { - lk.Lock() - defer lk.Unlock() - - var firstUse bool - - if k, ok := lk.keys[keyString]; ok { - if val != k.val { - return idpool.NoID, firstUse, fmt.Errorf("local key already allocated with different value (%s != %s)", val, k.val) - } - - k.refcnt++ - kvstore.Trace("Incremented local key refcnt", nil, logrus.Fields{fieldKey: keyString, fieldID: val, fieldRefCnt: k.refcnt}) - return k.val, firstUse, nil - } - - firstUse = true - k := &localKey{key: key, val: val, refcnt: 1} - lk.keys[keyString] = k - lk.ids[val] = k - kvstore.Trace("New local key", nil, logrus.Fields{fieldKey: keyString, fieldID: val, fieldRefCnt: 1}) - return val, firstUse, nil -} - -func (lk *localKeys) verify(key string) error { - lk.Lock() - defer lk.Unlock() - - if k, ok := lk.keys[key]; ok { - k.verified = true - kvstore.Trace("Local key verified", nil, logrus.Fields{fieldKey: key}) - return nil - } - - return fmt.Errorf("key %s not found", key) -} - -// lookupKey returns the idpool.ID of the key is present in the map of keys. -// if it isn't present, returns idpool.NoID -func (lk *localKeys) lookupKey(key string) idpool.ID { - lk.RLock() - defer lk.RUnlock() - - if k, ok := lk.keys[key]; ok { - return k.val - } - - return idpool.NoID -} - -// lookupID returns the key for a given ID or an empty string -func (lk *localKeys) lookupID(id idpool.ID) AllocatorKey { - lk.RLock() - defer lk.RUnlock() - - if k, ok := lk.ids[id]; ok { - return k.key - } - - return nil -} - -// use increments the refcnt of the key and returns its value -func (lk *localKeys) use(key string) idpool.ID { - lk.Lock() - defer lk.Unlock() - - if k, ok := lk.keys[key]; ok { - // unverified keys behave as if they do not exist - if !k.verified { - return idpool.NoID - } - - k.refcnt++ - kvstore.Trace("Incremented local key refcnt", nil, logrus.Fields{fieldKey: key, fieldID: k.val, fieldRefCnt: k.refcnt}) - return k.val - } - - return idpool.NoID -} - -// release releases the refcnt of a key. It returns the ID associated with the -// given key. When the last reference was released, the key is deleted and the -// returned lastUse value is true. -func (lk *localKeys) release(key string) (lastUse bool, id idpool.ID, err error) { - lk.Lock() - defer lk.Unlock() - if k, ok := lk.keys[key]; ok { - k.refcnt-- - kvstore.Trace("Decremented local key refcnt", nil, logrus.Fields{fieldKey: key, fieldID: k.val, fieldRefCnt: k.refcnt}) - if k.refcnt == 0 { - delete(lk.keys, key) - delete(lk.ids, k.val) - return true, k.val, nil - } - - return false, k.val, nil - } - - return false, idpool.NoID, fmt.Errorf("unable to find key in local cache") -} - -func (lk *localKeys) getVerifiedIDs() map[idpool.ID]AllocatorKey { - ids := map[idpool.ID]AllocatorKey{} - lk.RLock() - for id, localKey := range lk.ids { - if localKey.verified { - ids[id] = localKey.key - } - } - lk.RUnlock() - - return ids -} diff --git a/vendor/github.com/cilium/cilium/pkg/allocator/logfields.go b/vendor/github.com/cilium/cilium/pkg/allocator/logfields.go deleted file mode 100644 index 59df55405..000000000 --- a/vendor/github.com/cilium/cilium/pkg/allocator/logfields.go +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package allocator - -const ( - fieldID = "id" - fieldKey = "key" - fieldRefCnt = "refcnt" -) diff --git a/vendor/github.com/cilium/cilium/pkg/annotation/k8s.go b/vendor/github.com/cilium/cilium/pkg/annotation/k8s.go deleted file mode 100644 index f5ee55124..000000000 --- a/vendor/github.com/cilium/cilium/pkg/annotation/k8s.go +++ /dev/null @@ -1,180 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package annotation - -import ( - "regexp" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -const ( - // Prefix is the common prefix for all annotations - Prefix = "io.cilium" - - // ConfigPrefix is the common prefix for configuration related annotations. - ConfigPrefix = "config.cilium.io" - - // IngressPrefix is the common prefix for ingress related annotations. - IngressPrefix = "ingress.cilium.io" - - // NetworkPrefix is the common prefix for network related annotations. - NetworkPrefix = "network.cilium.io" - - // PolicyPrefix is the common prefix for policy related annotations. - PolicyPrefix = "policy.cilium.io" - - // ServicePrefix is the common prefix for service related annotations. - ServicePrefix = "service.cilium.io" - - // IPAMPrefix is the common prefix for IPAM related annotations. - IPAMPrefix = "ipam.cilium.io" - - // LBIPAMPrefix is the common prefix for LB IPAM related annotations. - LBIPAMPrefix = "lbipam.cilium.io" - - // CNIPrefix is the common prefix for CNI related annotations. - CNIPrefix = "cni.cilium.io" - - // PodAnnotationMAC is used to store the MAC address of the Pod. - PodAnnotationMAC = CNIPrefix + "/mac-address" - - // PolicyName / PolicyNameAlias is an optional annotation to the NetworkPolicy - // resource which specifies the name of the policy node to which all - // rules should be applied to. - PolicyName = PolicyPrefix + "/name" - PolicyNameAlias = Prefix + ".name" - - // V4CIDRName / V4CIDRNameAlias is the annotation name used to store the IPv4 - // pod CIDR in the node's annotations. - V4CIDRName = NetworkPrefix + "/ipv4-pod-cidr" - V4CIDRNameAlias = Prefix + ".network.ipv4-pod-cidr" - // V6CIDRName / V6CIDRNameAlias is the annotation name used to store the IPv6 - // pod CIDR in the node's annotations. - V6CIDRName = NetworkPrefix + "/ipv6-pod-cidr" - V6CIDRNameAlias = Prefix + ".network.ipv6-pod-cidr" - - // V4HealthName / V4HealthNameAlias is the annotation name used to store the - // IPv4 address of the cilium-health endpoint in the node's annotations. - V4HealthName = NetworkPrefix + "/ipv4-health-ip" - V4HealthNameAlias = Prefix + ".network.ipv4-health-ip" - // V6HealthName / V6HealthNameAlias is the annotation name used to store the - // IPv6 address of the cilium-health endpoint in the node's annotations. - V6HealthName = NetworkPrefix + "/ipv6-health-ip" - V6HealthNameAlias = Prefix + ".network.ipv6-health-ip" - - // V4IngressName / V4IngressNameAlias is the annotation name used to store - // the IPv4 address of the Ingress listener in the node's annotations. - V4IngressName = NetworkPrefix + "/ipv4-Ingress-ip" - V4IngressNameAlias = Prefix + ".network.ipv4-Ingress-ip" - // V6IngressName / V6IngressNameAlias is the annotation name used to store - // the IPv6 address of the Ingress listener in the node's annotations. - V6IngressName = NetworkPrefix + "/ipv6-Ingress-ip" - V6IngressNameAlias = Prefix + ".network.ipv6-Ingress-ip" - - // CiliumHostIP / CiliumHostIPAlias is the annotation name used to store the - // IPv4 address of the cilium host interface in the node's annotations. - CiliumHostIP = NetworkPrefix + "/ipv4-cilium-host" - CiliumHostIPAlias = Prefix + ".network.ipv4-cilium-host" - - // CiliumHostIPv6 / CiliumHostIPv6Alias is the annotation name used to store - // the IPv6 address of the cilium host interface in the node's annotation. - CiliumHostIPv6 = NetworkPrefix + "/ipv6-cilium-host" - CiliumHostIPv6Alias = Prefix + ".network.ipv6-cilium-host" - - // CiliumEncryptionKey / CiliumEncryptionKeyAlias is the annotation name used to - // store the encryption key of the cilium host interface in the node's annotation. - CiliumEncryptionKey = NetworkPrefix + "/encryption-key" - CiliumEncryptionKeyAlias = Prefix + ".network.encryption-key" - - // GlobalService / GlobalServiceAlias if set to true, marks a service to - // become a global service. - GlobalService = ServicePrefix + "/global" - GlobalServiceAlias = Prefix + "/global-service" - - // GlobalServiceSyncEndpointSlice if set to true, marks a service to - // synchronize remote clusters endpoint slices to the local Kubernetes API - GlobalServiceSyncEndpointSlices = ServicePrefix + "/global-sync-endpoint-slices" - - // SharedService / SharedServiceAlias if set to false, prevents a service - // from being shared, the default is true if GlobalService is set, otherwise - // false. Setting the annotation SharedService to false while setting - // GlobalService to true allows to expose remote endpoints without - // sharing local endpoints. - SharedService = ServicePrefix + "/shared" - SharedServiceAlias = Prefix + "/shared-service" - - // ServiceAffinity / ServiceAffinityAlias annotations determines the - // preferred endpoint destination. - // Allowed values: - // - local - // preferred endpoints from local cluster if available - // - remote - // preferred endpoints from remote cluster if available - // - none (default) - // no preference. Default behavior if this annotation does not exist - ServiceAffinity = ServicePrefix + "/affinity" - ServiceAffinityAlias = Prefix + "/service-affinity" - - // ProxyVisibility / ProxyVisibilityAlias is the annotation name used to - // indicate whether proxy visibility should be enabled for a given pod (i.e., - // all traffic for the pod is redirected to the proxy for the given port / - // protocol in the annotation - ProxyVisibility = PolicyPrefix + "/proxy-visibility" - ProxyVisibilityAlias = Prefix + ".proxy-visibility" - - // NoTrack / NoTrackAlias is the annotation name used to store the port and - // protocol that we should bypass kernel conntrack for a given pod. This - // applies for both TCP and UDP connection. Current use case is NodeLocalDNS. - NoTrack = PolicyPrefix + "/no-track-port" - NoTrackAlias = Prefix + ".no-track-port" - - // WireguardPubKey / WireguardPubKeyAlias is the annotation name used to store - // the WireGuard public key in the CiliumNode CRD that we need to use to encrypt - // traffic to that node. - WireguardPubKey = NetworkPrefix + "/wg-pub-key" - WireguardPubKeyAlias = Prefix + ".network.wg-pub-key" - - // BGPVRouterAnnoPrefix is the prefix used for all Virtual Router annotations - // Its just a prefix, because the ASN of the Router is part of the annotation itself - BGPVRouterAnnoPrefix = "cilium.io/bgp-virtual-router." - - // IPAMPoolKey is the annotation name used to store the IPAM pool name from - // which workloads should allocate their IP from - IPAMPoolKey = IPAMPrefix + "/ip-pool" - - // IPAMIPv4PoolKey is the annotation name used to store the IPAM IPv4 pool name from - // which workloads should allocate their IP from - IPAMIPv4PoolKey = IPAMPrefix + "/ipv4-pool" - - // IPAMIPv6PoolKey is the annotation name used to store the IPAM IPv6 pool name from - // which workloads should allocate their IP from - IPAMIPv6PoolKey = IPAMPrefix + "/ipv6-pool" - - LBIPAMIPsKey = LBIPAMPrefix + "/ips" - LBIPAMIPKeyAlias = Prefix + "/lb-ipam-ips" - - LBIPAMSharingKey = LBIPAMPrefix + "/sharing-key" - LBIPAMSharingKeyAlias = Prefix + "/lb-ipam-sharing-key" - LBIPAMSharingAcrossNamespace = LBIPAMPrefix + "/sharing-cross-namespace" - LBIPAMSharingAcrossNamespaceAlias = Prefix + "/lb-ipam-sharing-cross-namespace" -) - -var ( - // CiliumPrefixRegex is a regex matching Cilium specific annotations. - CiliumPrefixRegex = regexp.MustCompile(`^([A-Za-z0-9]+\.)*cilium.io/`) -) - -// Get returns the annotation value associated with the given key, or any of -// the additional aliases if not found. -func Get(obj metav1.Object, key string, aliases ...string) (value string, ok bool) { - keys := append([]string{key}, aliases...) - for _, k := range keys { - if value, ok = obj.GetAnnotations()[k]; ok { - return value, ok - } - } - - return "", false -} diff --git a/vendor/github.com/cilium/cilium/pkg/api/apidisable.go b/vendor/github.com/cilium/cilium/pkg/api/apidisable.go deleted file mode 100644 index ef3ed5d42..000000000 --- a/vendor/github.com/cilium/cilium/pkg/api/apidisable.go +++ /dev/null @@ -1,42 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package api - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/pkg/logging/logfields" -) - -type AdminDisableHandler struct { - name string -} - -func NewAdminDisableHandler(name string) *AdminDisableHandler { - return &AdminDisableHandler{ - name: name, - } -} - -func (a *AdminDisableHandler) ServeHTTP(wr http.ResponseWriter, req *http.Request) { - wr.WriteHeader(http.StatusForbidden) - log.WithFields(logrus.Fields{ - logfields.Endpoint: a.name, - }).Info("Denied API request on administratively disabled API endpoint") - _, _ = wr.Write([]byte("This API is administratively disabled. Contact your administrator for more details.")) -} - -// DisableAPIs configures the API middleware for all of the paths in the -// provided PathSet such that those APIs will be administratively disabled at -// runtime. -func DisableAPIs(paths PathSet, addMiddleware func(method, path string, builder middleware.Builder)) { - for k, pm := range paths { - addMiddleware(pm.Method, pm.Path, func(_ http.Handler) http.Handler { - return NewAdminDisableHandler(k) - }) - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/api/apierror.go b/vendor/github.com/cilium/cilium/pkg/api/apierror.go deleted file mode 100644 index 7ee425a22..000000000 --- a/vendor/github.com/cilium/cilium/pkg/api/apierror.go +++ /dev/null @@ -1,66 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package api - -import ( - "fmt" - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/cilium/cilium/api/v1/models" -) - -// APIError is the error representation for the API. -type APIError struct { - code int - msg string -} - -// New creates a API error from the code, msg and extra arguments. -func New(code int, msg string, args ...interface{}) *APIError { - if code <= 0 { - code = 500 - } - - if len(args) > 0 { - return &APIError{code: code, msg: fmt.Sprintf(msg, args...)} - } - return &APIError{code: code, msg: msg} -} - -// GetCode returns the code for the API Error. -func (a *APIError) GetCode() int { - return a.code -} - -// Error creates a new API error from the code and error. -func Error(code int, err error) *APIError { - if err == nil { - err = fmt.Errorf("Error pointer was nil") - } - - return New(code, err.Error()) -} - -// Error returns the API error message. -func (a *APIError) Error() string { - return a.msg -} - -// GetModel returns model error. -func (a *APIError) GetModel() *models.Error { - m := models.Error(a.msg) - return &m -} - -// WriteResponse to the client. -func (a *APIError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - rw.WriteHeader(a.code) - m := a.GetModel() - if err := producer.Produce(rw, m); err != nil { - panic(err) - } - -} diff --git a/vendor/github.com/cilium/cilium/pkg/api/apipanic.go b/vendor/github.com/cilium/cilium/pkg/api/apipanic.go deleted file mode 100644 index 38481b26d..000000000 --- a/vendor/github.com/cilium/cilium/pkg/api/apipanic.go +++ /dev/null @@ -1,43 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package api - -import ( - "net/http" - "os" - "runtime/debug" - - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/pkg/logging" -) - -// APIPanicHandler recovers from API panics and logs encountered panics -type APIPanicHandler struct { - Next http.Handler -} - -// ServeHTTP implements the http.Handler interface. -// It recovers from panics of all next handlers and logs them -func (h *APIPanicHandler) ServeHTTP(wr http.ResponseWriter, req *http.Request) { - defer func() { - if r := recover(); r != nil { - fields := logrus.Fields{ - "panic_message": r, - "url": req.URL.String(), - "method": req.Method, - "client": req.RemoteAddr, - } - log.WithFields(fields).Warn("Cilium API handler panicked") - if logging.DefaultLogger.IsLevelEnabled(logrus.DebugLevel) { - os.Stdout.Write(debug.Stack()) - } - wr.WriteHeader(http.StatusInternalServerError) - if _, err := wr.Write([]byte("Internal error occurred, check Cilium logs for details.")); err != nil { - log.WithError(err).Debug("Failed to write API response") - } - } - }() - h.Next.ServeHTTP(wr, req) -} diff --git a/vendor/github.com/cilium/cilium/pkg/api/config.go b/vendor/github.com/cilium/cilium/pkg/api/config.go deleted file mode 100644 index 1087927ce..000000000 --- a/vendor/github.com/cilium/cilium/pkg/api/config.go +++ /dev/null @@ -1,137 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package api - -import ( - "fmt" - "strings" - - "github.com/go-openapi/loads" - "github.com/go-openapi/spec" -) - -var ( - ErrUnknownWildcard = fmt.Errorf("Unsupported API wildcard") - ErrUnknownFlag = fmt.Errorf("Unknown API flag") -) - -func pascalize(in string) string { - if len(in) < 2 { - return strings.ToUpper(in) - } - switch in { - case "bgp": - return "BGP" - case "id": - return "ID" - case "ip": - return "IP" - case "ipam": - return "IPAM" - case "lrp": - return "LRP" - } - return strings.ToUpper(in[0:1]) + strings.ToLower(in[1:]) -} - -func pathToFlagSuffix(path string) string { - result := "" - path = strings.TrimPrefix(path, "/") - for _, hunk := range strings.Split(path, "/") { - // TODO: Maybe we can just rename the /cgroup-dump-metadata API to /cgroups to avoid this loop? - for _, word := range strings.Split(hunk, "-") { - trimmed := strings.Trim(word, "{}") - result = result + pascalize(trimmed) - } - } - - return result -} - -func parseSpecPaths(paths *spec.Paths) PathSet { - results := make(PathSet) - - for path, item := range paths.Paths { - suffix := pathToFlagSuffix(path) - ops := map[string]*spec.Operation{ - "Delete": item.Delete, - "Get": item.Get, - "Patch": item.Patch, - "Post": item.Post, - "Put": item.Put, - } - for prefix, op := range ops { - if op != nil { - flag := prefix + suffix - results[flag] = Endpoint{ - Method: strings.ToUpper(prefix), - Path: path, - Description: op.Description, - } - } - } - } - - return PathSet(results) -} - -func generateDeniedAPIEndpoints(allPaths PathSet, allowed []string) (PathSet, error) { - // default to "deny all", then allow specified APIs by flag - denied := allPaths - - var wildcardPrefixes []string - for _, opt := range allowed { - switch strings.Index(opt, "*") { - case -1: // No wildcard - break - case len(opt) - 1: // suffix - prefix := strings.TrimSuffix(opt, "*") - if len(prefix) == 0 { // Full opt "*", ie allow all - return PathSet{}, nil - } - wildcardPrefixes = append(wildcardPrefixes, prefix) - continue - default: - return nil, fmt.Errorf("%w: %q", ErrUnknownWildcard, opt) - } - if _, ok := denied[opt]; ok { - delete(denied, opt) - } else { - return nil, fmt.Errorf("%w: %q", ErrUnknownFlag, opt) - } - } - - for _, prefix := range wildcardPrefixes { - for f := range denied { - if strings.HasPrefix(f, prefix) { - delete(denied, f) - } - } - } - return denied, nil -} - -// Endpoint is an API Endpoint for a parsed API specification. -type Endpoint struct { - Method string - Path string - Description string -} - -// PathSet is a set of APIs in the form of a map of canonical pascalized flag -// name to MethodPath, for example: -// "GetEndpointID": {"GET", "/endpoint/{id}"} -type PathSet map[string]Endpoint - -func NewPathSet(spec *loads.Document) PathSet { - return parseSpecPaths(spec.Spec().Paths) -} - -// AllowedFlagsToDeniedPaths parses the input API specification and the provided -// commandline flags, and returns the PathSet that should be administratively -// disabled using a subsequent call to DisableAPIs(). -func AllowedFlagsToDeniedPaths(spec *loads.Document, allowed []string) (PathSet, error) { - paths := parseSpecPaths(spec.Spec().Paths) - return generateDeniedAPIEndpoints(paths, allowed) -} diff --git a/vendor/github.com/cilium/cilium/pkg/api/const.go b/vendor/github.com/cilium/cilium/pkg/api/const.go deleted file mode 100644 index 356c6ddb3..000000000 --- a/vendor/github.com/cilium/cilium/pkg/api/const.go +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package api - -import ( - "os" - "time" -) - -const ( - // CiliumGroupName is the cilium's unix group name. - CiliumGroupName = "cilium" - // SocketFileMode is the default file mode for the sockets. - SocketFileMode os.FileMode = 0660 - // ClientTimeout specifies timeout to be used by clients - ClientTimeout = 90 * time.Second -) diff --git a/vendor/github.com/cilium/cilium/pkg/api/doc.go b/vendor/github.com/cilium/cilium/pkg/api/doc.go deleted file mode 100644 index 83b4b5bfb..000000000 --- a/vendor/github.com/cilium/cilium/pkg/api/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Package api provides the Cilium useful helpers for the external API -package api diff --git a/vendor/github.com/cilium/cilium/pkg/api/socket.go b/vendor/github.com/cilium/cilium/pkg/api/socket.go deleted file mode 100644 index 6af237a1e..000000000 --- a/vendor/github.com/cilium/cilium/pkg/api/socket.go +++ /dev/null @@ -1,49 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package api - -import ( - "fmt" - "os" - "os/user" - "strconv" - - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" -) - -var log = logging.DefaultLogger.WithField(logfields.LogSubsys, "api") - -// getGroupIDByName returns the group ID for the given grpName. -func getGroupIDByName(grpName string) (int, error) { - group, err := user.LookupGroup(grpName) - if err != nil { - return -1, err - } - return strconv.Atoi(group.Gid) -} - -// SetDefaultPermissions sets the given socket's group to `CiliumGroupName` and -// mode to `SocketFileMode`. -func SetDefaultPermissions(socketPath string) error { - gid, err := getGroupIDByName(CiliumGroupName) - if err != nil { - log.WithError(err).WithFields(logrus.Fields{ - logfields.Path: socketPath, - "group": CiliumGroupName, - }).Debug("Group not found") - } else { - if err := os.Chown(socketPath, 0, gid); err != nil { - return fmt.Errorf("failed while setting up %s's group ID"+ - " in %q: %s", CiliumGroupName, socketPath, err) - } - } - if err := os.Chmod(socketPath, SocketFileMode); err != nil { - return fmt.Errorf("failed while setting up file permissions in %q: %w", - socketPath, err) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/aws/eni/types/doc.go b/vendor/github.com/cilium/cilium/pkg/aws/eni/types/doc.go deleted file mode 100644 index 0b0cb83f7..000000000 --- a/vendor/github.com/cilium/cilium/pkg/aws/eni/types/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// +k8s:deepcopy-gen=package -// +deepequal-gen=package - -package types diff --git a/vendor/github.com/cilium/cilium/pkg/aws/eni/types/types.go b/vendor/github.com/cilium/cilium/pkg/aws/eni/types/types.go deleted file mode 100644 index c2cba6c38..000000000 --- a/vendor/github.com/cilium/cilium/pkg/aws/eni/types/types.go +++ /dev/null @@ -1,274 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package types - -import ( - "github.com/cilium/cilium/pkg/ipam/types" -) - -// ENISpec is the ENI specification of a node. This specification is considered -// by the cilium-operator to act as an IPAM operator and makes ENI IPs available -// via the IPAMSpec section. -// -// The ENI specification can either be provided explicitly by the user or the -// cilium agent running on the node can be instructed to create the CiliumNode -// custom resource along with an ENI specification when the node registers -// itself to the Kubernetes cluster. -type ENISpec struct { - // InstanceID is the AWS InstanceId of the node. The InstanceID is used - // to retrieve AWS metadata for the node. - // - // OBSOLETE: This field is obsolete, please use Spec.InstanceID - // - // +kubebuilder:validation:Optional - InstanceID string `json:"instance-id,omitempty"` - - // InstanceType is the AWS EC2 instance type, e.g. "m5.large" - // - // +kubebuilder:validation:Optional - InstanceType string `json:"instance-type,omitempty"` - - // MinAllocate is the minimum number of IPs that must be allocated when - // the node is first bootstrapped. It defines the minimum base socket - // of addresses that must be available. After reaching this watermark, - // the PreAllocate and MaxAboveWatermark logic takes over to continue - // allocating IPs. - // - // OBSOLETE: This field is obsolete, please use Spec.IPAM.MinAllocate - // - // +kubebuilder:validation:Minimum=0 - // +kubebuilder:validation:Optional - MinAllocate int `json:"min-allocate,omitempty"` - - // PreAllocate defines the number of IP addresses that must be - // available for allocation in the IPAMspec. It defines the buffer of - // addresses available immediately without requiring cilium-operator to - // get involved. - // - // OBSOLETE: This field is obsolete, please use Spec.IPAM.PreAllocate - // - // +kubebuilder:validation:Minimum=0 - // +kubebuilder:validation:Optional - PreAllocate int `json:"pre-allocate,omitempty"` - - // MaxAboveWatermark is the maximum number of addresses to allocate - // beyond the addresses needed to reach the PreAllocate watermark. - // Going above the watermark can help reduce the number of API calls to - // allocate IPs, e.g. when a new ENI is allocated, as many secondary - // IPs as possible are allocated. Limiting the amount can help reduce - // waste of IPs. - // - // OBSOLETE: This field is obsolete, please use Spec.IPAM.MaxAboveWatermark - // - // +kubebuilder:validation:Minimum=0 - // +kubebuilder:validation:Optional - MaxAboveWatermark int `json:"max-above-watermark,omitempty"` - - // FirstInterfaceIndex is the index of the first ENI to use for IP - // allocation, e.g. if the node has eth0, eth1, eth2 and - // FirstInterfaceIndex is set to 1, then only eth1 and eth2 will be - // used for IP allocation, eth0 will be ignored for PodIP allocation. - // - // +kubebuilder:validation:Minimum=0 - // +kubebuilder:validation:Optional - FirstInterfaceIndex *int `json:"first-interface-index,omitempty"` - - // SecurityGroups is the list of security groups to attach to any ENI - // that is created and attached to the instance. - // - // +kubebuilder:validation:Optional - SecurityGroups []string `json:"security-groups,omitempty"` - - // SecurityGroupTags is the list of tags to use when evaliating what - // AWS security groups to use for the ENI. - // - // +kubebuilder:validation:Optional - SecurityGroupTags map[string]string `json:"security-group-tags,omitempty"` - - // SubnetIDs is the list of subnet ids to use when evaluating what AWS - // subnets to use for ENI and IP allocation. - // - // +kubebuilder:validation:Optional - SubnetIDs []string `json:"subnet-ids,omitempty"` - - // SubnetTags is the list of tags to use when evaluating what AWS - // subnets to use for ENI and IP allocation. - // - // +kubebuilder:validation:Optional - SubnetTags map[string]string `json:"subnet-tags,omitempty"` - - // NodeSubnetID is the subnet of the primary ENI the instance was brought up - // with. It is used as a sensible default subnet to create ENIs in. - // - // +kubebuilder:validation:Optional - NodeSubnetID string `json:"node-subnet-id,omitempty"` - - // VpcID is the VPC ID to use when allocating ENIs. - // - // +kubebuilder:validation:Optional - VpcID string `json:"vpc-id,omitempty"` - - // AvailabilityZone is the availability zone to use when allocating - // ENIs. - // - // +kubebuilder:validation:Optional - AvailabilityZone string `json:"availability-zone,omitempty"` - - // ExcludeInterfaceTags is the list of tags to use when excluding ENIs for - // Cilium IP allocation. Any interface matching this set of tags will not - // be managed by Cilium. - // - // +kubebuilder:validation:Optional - ExcludeInterfaceTags map[string]string `json:"exclude-interface-tags,omitempty"` - - // DeleteOnTermination defines that the ENI should be deleted when the - // associated instance is terminated. If the parameter is not set the - // default behavior is to delete the ENI on instance termination. - // - // +kubebuilder:validation:Optional - DeleteOnTermination *bool `json:"delete-on-termination,omitempty"` - - // UsePrimaryAddress determines whether an ENI's primary address - // should be available for allocations on the node - // - // +kubebuilder:validation:Optional - UsePrimaryAddress *bool `json:"use-primary-address,omitempty"` - - // DisablePrefixDelegation determines whether ENI prefix delegation should be - // disabled on this node. - // - // +kubebuilder:validation:Optional - DisablePrefixDelegation *bool `json:"disable-prefix-delegation,omitempty"` -} - -// ENI represents an AWS Elastic Network Interface -// -// More details: -// https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html -type ENI struct { - // ID is the ENI ID - // - // +optional - ID string `json:"id,omitempty"` - - // IP is the primary IP of the ENI - // - // +optional - IP string `json:"ip,omitempty"` - - // MAC is the mac address of the ENI - // - // +optional - MAC string `json:"mac,omitempty"` - - // AvailabilityZone is the availability zone of the ENI - // - // +optional - AvailabilityZone string `json:"availability-zone,omitempty"` - - // Description is the description field of the ENI - // - // +optional - Description string `json:"description,omitempty"` - - // Number is the interface index, it used in combination with - // FirstInterfaceIndex - // - // +optional - Number int `json:"number,omitempty"` - - // Subnet is the subnet the ENI is associated with - // - // +optional - Subnet AwsSubnet `json:"subnet,omitempty"` - - // VPC is the VPC information to which the ENI is attached to - // - // +optional - VPC AwsVPC `json:"vpc,omitempty"` - - // Addresses is the list of all secondary IPs associated with the ENI - // - // +optional - Addresses []string `json:"addresses,omitempty"` - - // Prefixes is the list of all /28 prefixes associated with the ENI - // - // +optional - Prefixes []string `json:"prefixes,omitempty"` - - // SecurityGroups are the security groups associated with the ENI - SecurityGroups []string `json:"security-groups,omitempty"` - - // Tags is the set of tags of the ENI. Used to detect ENIs which should - // not be managed by Cilium - // - // +optional - Tags map[string]string `json:"tags,omitempty"` -} - -func (e *ENI) DeepCopyInterface() types.Interface { - return e.DeepCopy() -} - -// InterfaceID returns the identifier of the interface -func (e *ENI) InterfaceID() string { - return e.ID -} - -// ForeachAddress iterates over all addresses and calls fn -func (e *ENI) ForeachAddress(id string, fn types.AddressIterator) error { - for _, address := range e.Addresses { - if err := fn(id, e.ID, address, "", address); err != nil { - return err - } - } - - return nil -} - -// IsExcludedBySpec returns true if the ENI is excluded by the provided spec and -// therefore should not be managed by Cilium. -func (e *ENI) IsExcludedBySpec(spec ENISpec) bool { - if spec.FirstInterfaceIndex != nil && e.Number < *spec.FirstInterfaceIndex { - return true - } - - if len(spec.ExcludeInterfaceTags) > 0 { - if types.Tags(e.Tags).Match(spec.ExcludeInterfaceTags) { - return true - } - } - - return false -} - -// ENIStatus is the status of ENI addressing of the node -type ENIStatus struct { - // ENIs is the list of ENIs on the node - // - // +optional - ENIs map[string]ENI `json:"enis,omitempty"` -} - -// AwsSubnet stores information regarding an AWS subnet -type AwsSubnet struct { - // ID is the ID of the subnet - ID string `json:"id,omitempty"` - - // CIDR is the CIDR range associated with the subnet - CIDR string `json:"cidr,omitempty"` -} - -// AwsVPC stores information regarding an AWS VPC -type AwsVPC struct { - /// ID is the ID of a VPC - ID string `json:"id,omitempty"` - - // PrimaryCIDR is the primary CIDR of the VPC - PrimaryCIDR string `json:"primary-cidr,omitempty"` - - // CIDRs is the list of CIDR ranges associated with the VPC - CIDRs []string `json:"cidrs,omitempty"` -} diff --git a/vendor/github.com/cilium/cilium/pkg/aws/eni/types/zz_generated.deepcopy.go b/vendor/github.com/cilium/cilium/pkg/aws/eni/types/zz_generated.deepcopy.go deleted file mode 100644 index a5011d397..000000000 --- a/vendor/github.com/cilium/cilium/pkg/aws/eni/types/zz_generated.deepcopy.go +++ /dev/null @@ -1,176 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package types - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AwsSubnet) DeepCopyInto(out *AwsSubnet) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AwsSubnet. -func (in *AwsSubnet) DeepCopy() *AwsSubnet { - if in == nil { - return nil - } - out := new(AwsSubnet) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AwsVPC) DeepCopyInto(out *AwsVPC) { - *out = *in - if in.CIDRs != nil { - in, out := &in.CIDRs, &out.CIDRs - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AwsVPC. -func (in *AwsVPC) DeepCopy() *AwsVPC { - if in == nil { - return nil - } - out := new(AwsVPC) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ENI) DeepCopyInto(out *ENI) { - *out = *in - out.Subnet = in.Subnet - in.VPC.DeepCopyInto(&out.VPC) - if in.Addresses != nil { - in, out := &in.Addresses, &out.Addresses - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Prefixes != nil { - in, out := &in.Prefixes, &out.Prefixes - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.SecurityGroups != nil { - in, out := &in.SecurityGroups, &out.SecurityGroups - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Tags != nil { - in, out := &in.Tags, &out.Tags - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ENI. -func (in *ENI) DeepCopy() *ENI { - if in == nil { - return nil - } - out := new(ENI) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ENISpec) DeepCopyInto(out *ENISpec) { - *out = *in - if in.FirstInterfaceIndex != nil { - in, out := &in.FirstInterfaceIndex, &out.FirstInterfaceIndex - *out = new(int) - **out = **in - } - if in.SecurityGroups != nil { - in, out := &in.SecurityGroups, &out.SecurityGroups - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.SecurityGroupTags != nil { - in, out := &in.SecurityGroupTags, &out.SecurityGroupTags - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.SubnetIDs != nil { - in, out := &in.SubnetIDs, &out.SubnetIDs - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.SubnetTags != nil { - in, out := &in.SubnetTags, &out.SubnetTags - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.ExcludeInterfaceTags != nil { - in, out := &in.ExcludeInterfaceTags, &out.ExcludeInterfaceTags - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.DeleteOnTermination != nil { - in, out := &in.DeleteOnTermination, &out.DeleteOnTermination - *out = new(bool) - **out = **in - } - if in.UsePrimaryAddress != nil { - in, out := &in.UsePrimaryAddress, &out.UsePrimaryAddress - *out = new(bool) - **out = **in - } - if in.DisablePrefixDelegation != nil { - in, out := &in.DisablePrefixDelegation, &out.DisablePrefixDelegation - *out = new(bool) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ENISpec. -func (in *ENISpec) DeepCopy() *ENISpec { - if in == nil { - return nil - } - out := new(ENISpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ENIStatus) DeepCopyInto(out *ENIStatus) { - *out = *in - if in.ENIs != nil { - in, out := &in.ENIs, &out.ENIs - *out = make(map[string]ENI, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ENIStatus. -func (in *ENIStatus) DeepCopy() *ENIStatus { - if in == nil { - return nil - } - out := new(ENIStatus) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/github.com/cilium/cilium/pkg/aws/eni/types/zz_generated.deepequal.go b/vendor/github.com/cilium/cilium/pkg/aws/eni/types/zz_generated.deepequal.go deleted file mode 100644 index 4c1c93fc0..000000000 --- a/vendor/github.com/cilium/cilium/pkg/aws/eni/types/zz_generated.deepequal.go +++ /dev/null @@ -1,361 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepequal-gen. DO NOT EDIT. - -package types - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *AwsSubnet) DeepEqual(other *AwsSubnet) bool { - if other == nil { - return false - } - - if in.ID != other.ID { - return false - } - if in.CIDR != other.CIDR { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *AwsVPC) DeepEqual(other *AwsVPC) bool { - if other == nil { - return false - } - - if in.ID != other.ID { - return false - } - if in.PrimaryCIDR != other.PrimaryCIDR { - return false - } - if ((in.CIDRs != nil) && (other.CIDRs != nil)) || ((in.CIDRs == nil) != (other.CIDRs == nil)) { - in, other := &in.CIDRs, &other.CIDRs - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ENI) DeepEqual(other *ENI) bool { - if other == nil { - return false - } - - if in.ID != other.ID { - return false - } - if in.IP != other.IP { - return false - } - if in.MAC != other.MAC { - return false - } - if in.AvailabilityZone != other.AvailabilityZone { - return false - } - if in.Description != other.Description { - return false - } - if in.Number != other.Number { - return false - } - if in.Subnet != other.Subnet { - return false - } - - if !in.VPC.DeepEqual(&other.VPC) { - return false - } - - if ((in.Addresses != nil) && (other.Addresses != nil)) || ((in.Addresses == nil) != (other.Addresses == nil)) { - in, other := &in.Addresses, &other.Addresses - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if ((in.Prefixes != nil) && (other.Prefixes != nil)) || ((in.Prefixes == nil) != (other.Prefixes == nil)) { - in, other := &in.Prefixes, &other.Prefixes - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if ((in.SecurityGroups != nil) && (other.SecurityGroups != nil)) || ((in.SecurityGroups == nil) != (other.SecurityGroups == nil)) { - in, other := &in.SecurityGroups, &other.SecurityGroups - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if ((in.Tags != nil) && (other.Tags != nil)) || ((in.Tags == nil) != (other.Tags == nil)) { - in, other := &in.Tags, &other.Tags - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if inValue != otherValue { - return false - } - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ENISpec) DeepEqual(other *ENISpec) bool { - if other == nil { - return false - } - - if in.InstanceID != other.InstanceID { - return false - } - if in.InstanceType != other.InstanceType { - return false - } - if in.MinAllocate != other.MinAllocate { - return false - } - if in.PreAllocate != other.PreAllocate { - return false - } - if in.MaxAboveWatermark != other.MaxAboveWatermark { - return false - } - if (in.FirstInterfaceIndex == nil) != (other.FirstInterfaceIndex == nil) { - return false - } else if in.FirstInterfaceIndex != nil { - if *in.FirstInterfaceIndex != *other.FirstInterfaceIndex { - return false - } - } - - if ((in.SecurityGroups != nil) && (other.SecurityGroups != nil)) || ((in.SecurityGroups == nil) != (other.SecurityGroups == nil)) { - in, other := &in.SecurityGroups, &other.SecurityGroups - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if ((in.SecurityGroupTags != nil) && (other.SecurityGroupTags != nil)) || ((in.SecurityGroupTags == nil) != (other.SecurityGroupTags == nil)) { - in, other := &in.SecurityGroupTags, &other.SecurityGroupTags - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if inValue != otherValue { - return false - } - } - } - } - } - - if ((in.SubnetIDs != nil) && (other.SubnetIDs != nil)) || ((in.SubnetIDs == nil) != (other.SubnetIDs == nil)) { - in, other := &in.SubnetIDs, &other.SubnetIDs - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if ((in.SubnetTags != nil) && (other.SubnetTags != nil)) || ((in.SubnetTags == nil) != (other.SubnetTags == nil)) { - in, other := &in.SubnetTags, &other.SubnetTags - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if inValue != otherValue { - return false - } - } - } - } - } - - if in.NodeSubnetID != other.NodeSubnetID { - return false - } - if in.VpcID != other.VpcID { - return false - } - if in.AvailabilityZone != other.AvailabilityZone { - return false - } - if ((in.ExcludeInterfaceTags != nil) && (other.ExcludeInterfaceTags != nil)) || ((in.ExcludeInterfaceTags == nil) != (other.ExcludeInterfaceTags == nil)) { - in, other := &in.ExcludeInterfaceTags, &other.ExcludeInterfaceTags - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if inValue != otherValue { - return false - } - } - } - } - } - - if (in.DeleteOnTermination == nil) != (other.DeleteOnTermination == nil) { - return false - } else if in.DeleteOnTermination != nil { - if *in.DeleteOnTermination != *other.DeleteOnTermination { - return false - } - } - - if (in.UsePrimaryAddress == nil) != (other.UsePrimaryAddress == nil) { - return false - } else if in.UsePrimaryAddress != nil { - if *in.UsePrimaryAddress != *other.UsePrimaryAddress { - return false - } - } - - if (in.DisablePrefixDelegation == nil) != (other.DisablePrefixDelegation == nil) { - return false - } else if in.DisablePrefixDelegation != nil { - if *in.DisablePrefixDelegation != *other.DisablePrefixDelegation { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ENIStatus) DeepEqual(other *ENIStatus) bool { - if other == nil { - return false - } - - if ((in.ENIs != nil) && (other.ENIs != nil)) || ((in.ENIs == nil) != (other.ENIs == nil)) { - in, other := &in.ENIs, &other.ENIs - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if !inValue.DeepEqual(&otherValue) { - return false - } - } - } - } - } - - return true -} diff --git a/vendor/github.com/cilium/cilium/pkg/azure/types/doc.go b/vendor/github.com/cilium/cilium/pkg/azure/types/doc.go deleted file mode 100644 index 6d56b146b..000000000 --- a/vendor/github.com/cilium/cilium/pkg/azure/types/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// +deepequal-gen=package - -// +groupName=azure -package types diff --git a/vendor/github.com/cilium/cilium/pkg/azure/types/types.go b/vendor/github.com/cilium/cilium/pkg/azure/types/types.go deleted file mode 100644 index ba7419a24..000000000 --- a/vendor/github.com/cilium/cilium/pkg/azure/types/types.go +++ /dev/null @@ -1,194 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package types - -import ( - "strings" - - "github.com/cilium/cilium/pkg/ipam/types" -) - -const ( - // ProviderPrefix is the prefix used to indicate that a k8s ProviderID - // represents an Azure resource - ProviderPrefix = "azure://" - - // InterfaceAddressLimit is the maximum number of addresses on an interface - // - // - // For more information: - // https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-subscription-service-limits?toc=%2fazure%2fvirtual-network%2ftoc.json#networking-limits - InterfaceAddressLimit = 256 - - // StateSucceeded is the address state for a successfully provisioned address - StateSucceeded = "succeeded" -) - -// AzureSpec is the Azure specification of a node running via the Azure IPAM -// -// The Azure specification can either be provided explicitly by the user or the -// cilium agent running on the node can be instructed to create the CiliumNode -// custom resource along with an Azure specification when the node registers -// itself to the Kubernetes cluster. -// This struct is embedded into v2.CiliumNode -// -// +k8s:deepcopy-gen=true -type AzureSpec struct { - // InterfaceName is the name of the interface the cilium-operator - // will use to allocate all the IPs on - // - // +kubebuilder:validation:Optional - InterfaceName string `json:"interface-name,omitempty"` -} - -// AzureStatus is the status of Azure addressing of the node. -// This struct is embedded into v2.CiliumNode -// -// +k8s:deepcopy-gen=true -type AzureStatus struct { - // Interfaces is the list of interfaces on the node - // - // +optional - Interfaces []AzureInterface `json:"interfaces,omitempty"` -} - -// AzureAddress is an IP address assigned to an AzureInterface -type AzureAddress struct { - // IP is the ip address of the address - IP string `json:"ip,omitempty"` - - // Subnet is the subnet the address belongs to - Subnet string `json:"subnet,omitempty"` - - // State is the provisioning state of the address - State string `json:"state,omitempty"` -} - -// AzureInterface represents an Azure Interface -// -// +k8s:deepcopy-gen=true -type AzureInterface struct { - // ID is the identifier - // - // +optional - ID string `json:"id,omitempty"` - - // Name is the name of the interface - // - // +optional - Name string `json:"name,omitempty"` - - // MAC is the mac address - // - // +optional - MAC string `json:"mac,omitempty"` - - // State is the provisioning state - // - // +optional - State string `json:"state,omitempty"` - - // Addresses is the list of all IPs associated with the interface, - // including all secondary addresses - // - // +optional - Addresses []AzureAddress `json:"addresses,omitempty"` - - // SecurityGroup is the security group associated with the interface - SecurityGroup string `json:"security-group,omitempty"` - - // GatewayIP is the interface's subnet's default route - // - // OBSOLETE: This field is obsolete, please use Gateway field instead. - // - // +optional - GatewayIP string `json:"GatewayIP"` - - // Gateway is the interface's subnet's default route - // - // +optional - Gateway string `json:"gateway"` - - // CIDR is the range that the interface belongs to. - // - // +optional - CIDR string `json:"cidr,omitempty"` - - // vmssName is the name of the virtual machine scale set. This field is - // set by extractIDs() - vmssName string `json:"-"` - - // vmID is the ID of the virtual machine - vmID string `json:"-"` - - // resourceGroup is the resource group the interface belongs to - resourceGroup string `json:"-"` -} - -func (a *AzureInterface) DeepCopyInterface() types.Interface { - return a.DeepCopy() -} - -// SetID sets the Azure interface ID, as well as extracting other fields from -// the ID itself. -func (a *AzureInterface) SetID(id string) { - a.ID = id - a.extractIDs() -} - -// InterfaceID returns the identifier of the interface -func (a *AzureInterface) InterfaceID() string { - return a.ID -} - -func (a *AzureInterface) extractIDs() { - switch { - // Interface from a VMSS instance: - // //subscriptions/xxx/resourceGroups/yyy/providers/Microsoft.Compute/virtualMachineScaleSets/ssss/virtualMachines/vvv/networkInterfaces/iii - case strings.Contains(a.ID, "virtualMachineScaleSets"): - segs := strings.Split(a.ID, "/") - if len(segs) >= 5 { - a.resourceGroup = segs[4] - } - if len(segs) >= 9 { - a.vmssName = segs[8] - } - if len(segs) >= 11 { - a.vmID = segs[10] - } - // Interface from a standalone instance: - // //subscriptions/xxx/resourceGroups/yyy/providers/Microsoft.Network/networkInterfaces/iii - case strings.Contains(a.ID, "/Microsoft.Network/"): - segs := strings.Split(a.ID, "/") - if len(segs) >= 5 { - a.resourceGroup = segs[4] - } - } -} - -// GetResourceGroup returns the resource group the interface belongs to -func (a *AzureInterface) GetResourceGroup() string { - return a.resourceGroup -} - -// GetVMScaleSetName returns the VM scale set name the interface belongs to -func (a *AzureInterface) GetVMScaleSetName() string { - return a.vmssName -} - -// GetVMID returns the VM ID the interface belongs to -func (a *AzureInterface) GetVMID() string { - return a.vmID -} - -// ForeachAddress iterates over all addresses and calls fn -func (a *AzureInterface) ForeachAddress(id string, fn types.AddressIterator) error { - for _, address := range a.Addresses { - if err := fn(id, a.ID, address.IP, address.Subnet, address); err != nil { - return err - } - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/azure/types/zz_generated.deepcopy.go b/vendor/github.com/cilium/cilium/pkg/azure/types/zz_generated.deepcopy.go deleted file mode 100644 index ad51b4527..000000000 --- a/vendor/github.com/cilium/cilium/pkg/azure/types/zz_generated.deepcopy.go +++ /dev/null @@ -1,69 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package types - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureInterface) DeepCopyInto(out *AzureInterface) { - *out = *in - if in.Addresses != nil { - in, out := &in.Addresses, &out.Addresses - *out = make([]AzureAddress, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureInterface. -func (in *AzureInterface) DeepCopy() *AzureInterface { - if in == nil { - return nil - } - out := new(AzureInterface) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureSpec) DeepCopyInto(out *AzureSpec) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureSpec. -func (in *AzureSpec) DeepCopy() *AzureSpec { - if in == nil { - return nil - } - out := new(AzureSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureStatus) DeepCopyInto(out *AzureStatus) { - *out = *in - if in.Interfaces != nil { - in, out := &in.Interfaces, &out.Interfaces - *out = make([]AzureInterface, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStatus. -func (in *AzureStatus) DeepCopy() *AzureStatus { - if in == nil { - return nil - } - out := new(AzureStatus) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/github.com/cilium/cilium/pkg/azure/types/zz_generated.deepequal.go b/vendor/github.com/cilium/cilium/pkg/azure/types/zz_generated.deepequal.go deleted file mode 100644 index 8761f1949..000000000 --- a/vendor/github.com/cilium/cilium/pkg/azure/types/zz_generated.deepequal.go +++ /dev/null @@ -1,131 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepequal-gen. DO NOT EDIT. - -package types - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *AzureAddress) DeepEqual(other *AzureAddress) bool { - if other == nil { - return false - } - - if in.IP != other.IP { - return false - } - if in.Subnet != other.Subnet { - return false - } - if in.State != other.State { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *AzureInterface) DeepEqual(other *AzureInterface) bool { - if other == nil { - return false - } - - if in.ID != other.ID { - return false - } - if in.Name != other.Name { - return false - } - if in.MAC != other.MAC { - return false - } - if in.State != other.State { - return false - } - if ((in.Addresses != nil) && (other.Addresses != nil)) || ((in.Addresses == nil) != (other.Addresses == nil)) { - in, other := &in.Addresses, &other.Addresses - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if in.SecurityGroup != other.SecurityGroup { - return false - } - if in.GatewayIP != other.GatewayIP { - return false - } - if in.Gateway != other.Gateway { - return false - } - if in.CIDR != other.CIDR { - return false - } - if in.vmssName != other.vmssName { - return false - } - if in.vmID != other.vmID { - return false - } - if in.resourceGroup != other.resourceGroup { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *AzureSpec) DeepEqual(other *AzureSpec) bool { - if other == nil { - return false - } - - if in.InterfaceName != other.InterfaceName { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *AzureStatus) DeepEqual(other *AzureStatus) bool { - if other == nil { - return false - } - - if ((in.Interfaces != nil) && (other.Interfaces != nil)) || ((in.Interfaces == nil) != (other.Interfaces == nil)) { - in, other := &in.Interfaces, &other.Interfaces - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} diff --git a/vendor/github.com/cilium/cilium/pkg/backoff/backoff.go b/vendor/github.com/cilium/cilium/pkg/backoff/backoff.go deleted file mode 100644 index 3ddada530..000000000 --- a/vendor/github.com/cilium/cilium/pkg/backoff/backoff.go +++ /dev/null @@ -1,203 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package backoff - -import ( - "context" - "fmt" - "math" - - "github.com/google/uuid" - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/rand" - "github.com/cilium/cilium/pkg/time" -) - -var ( - log = logging.DefaultLogger.WithField(logfields.LogSubsys, "backoff") - - randGen = rand.NewSafeRand(time.Now().UnixNano()) -) - -// NodeManager is the interface required to implement cluster size dependent -// intervals -type NodeManager interface { - ClusterSizeDependantInterval(baseInterval time.Duration) time.Duration -} - -// nodeManager is a wrapper to enable using a plain function as NodeManager to implement -// cluster size dependent intervals -type nodeManager struct { - clusterSizeDependantInterval func(baseInterval time.Duration) time.Duration -} - -// NewNodeManager returns a new NodeManager implementing cluster size dependent intervals -// based on the given function. If the function is nil, then no tuning is performed. -func NewNodeManager(clusterSizeDependantInterval func(baseInterval time.Duration) time.Duration) NodeManager { - return &nodeManager{clusterSizeDependantInterval: clusterSizeDependantInterval} -} - -func (n *nodeManager) ClusterSizeDependantInterval(baseInterval time.Duration) time.Duration { - if n.clusterSizeDependantInterval == nil { - return baseInterval - } - - return n.clusterSizeDependantInterval(baseInterval) -} - -// Exponential implements an exponential backoff -type Exponential struct { - // Min is the minimal backoff time, if unspecified, 1 second will be - // used - Min time.Duration - - // Max is the maximum backoff time, if unspecified, no maximum time is - // applied - Max time.Duration - - // Factor is the factor the backoff time grows exponentially, if - // unspecified, a factor of 2.0 will be used - Factor float64 - - // Jitter, when enabled, adds random jitter to the interval - Jitter bool - - // NodeManager enables the use of cluster size dependent backoff - // intervals, i.e. the larger the cluster, the longer the backoff - // interval - NodeManager NodeManager - - // Name is a free form string describing the operation subject to the - // backoff, if unspecified, a UUID is generated. This string is used - // for logging purposes. - Name string - - // ResetAfter will reset the exponential back-off if no attempt is made for the amount of time specified here. - // Needs to be larger than the Max duration, otherwise it will be ignored to avoid accidental resets. - // If unspecified, no reset is performed. - ResetAfter time.Duration - - lastBackoffStart time.Time - - attempt int -} - -// CalculateDuration calculates the backoff duration based on minimum base -// interval, exponential factor, jitter and number of failures. -func CalculateDuration(min, max time.Duration, factor float64, jitter bool, failures int) time.Duration { - minFloat := float64(min) - maxFloat := float64(max) - - t := minFloat * math.Pow(factor, float64(failures)) - if max != time.Duration(0) && t > maxFloat { - t = maxFloat - } - - if jitter { - t = randGen.Float64()*(t-minFloat) + minFloat - } - - return time.Duration(t) -} - -// ClusterSizeDependantInterval returns a time.Duration that is dependent on -// the cluster size, i.e. the number of nodes that have been discovered. This -// can be used to control sync intervals of shared or centralized resources to -// avoid overloading these resources as the cluster grows. -// -// Example sync interval with baseInterval = 1 * time.Minute -// -// nodes | sync interval -// ------+----------------- -// 1 | 41.588830833s -// 2 | 1m05.916737320s -// 4 | 1m36.566274746s -// 8 | 2m11.833474640s -// 16 | 2m49.992800643s -// 32 | 3m29.790453687s -// 64 | 4m10.463236193s -// 128 | 4m51.588744261s -// 256 | 5m32.944565093s -// 512 | 6m14.416550710s -// 1024 | 6m55.946873494s -// 2048 | 7m37.506428894s -// 4096 | 8m19.080616652s -// 8192 | 9m00.662124608s -// 16384 | 9m42.247293667s -func ClusterSizeDependantInterval(baseInterval time.Duration, numNodes int) time.Duration { - // no nodes are being managed, no work will be performed, return - // baseInterval to check again in a reasonable timeframe - if numNodes == 0 { - return baseInterval - } - - waitNanoseconds := float64(baseInterval.Nanoseconds()) * math.Log1p(float64(numNodes)) - return time.Duration(int64(waitNanoseconds)) -} - -// Reset backoff attempt counter -func (b *Exponential) Reset() { - b.attempt = 0 -} - -// Wait waits for the required time using an exponential backoff -func (b *Exponential) Wait(ctx context.Context) error { - if resetDuration := b.ResetAfter; resetDuration != time.Duration(0) && resetDuration > b.Max { - if !b.lastBackoffStart.IsZero() { - if time.Since(b.lastBackoffStart) > resetDuration { - b.Reset() - } - } - } - - b.lastBackoffStart = time.Now() - b.attempt++ - t := b.Duration(b.attempt) - - log.WithFields(logrus.Fields{ - "time": t, - "attempt": b.attempt, - "name": b.Name, - }).Debug("Sleeping with exponential backoff") - - select { - case <-ctx.Done(): - return fmt.Errorf("exponential backoff cancelled via context: %w", ctx.Err()) - case <-time.After(t): - } - - return nil -} - -// Duration returns the wait duration for the nth attempt -func (b *Exponential) Duration(attempt int) time.Duration { - if b.Name == "" { - b.Name = uuid.New().String() - } - - min := time.Duration(1) * time.Second - if b.Min != time.Duration(0) { - min = b.Min - } - - factor := float64(2) - if b.Factor != float64(0) { - factor = b.Factor - } - - t := CalculateDuration(min, b.Max, factor, b.Jitter, attempt) - - if b.NodeManager != nil { - t = b.NodeManager.ClusterSizeDependantInterval(t) - } - - if b.Max != time.Duration(0) && t > b.Max { - t = b.Max - } - - return t -} diff --git a/vendor/github.com/cilium/cilium/pkg/byteorder/byteorder.go b/vendor/github.com/cilium/cilium/pkg/byteorder/byteorder.go deleted file mode 100644 index caa855d21..000000000 --- a/vendor/github.com/cilium/cilium/pkg/byteorder/byteorder.go +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package byteorder - -import ( - "net" - "net/netip" -) - -// NetIPv4ToHost32 converts an net.IP to a uint32 in host byte order. ip -// must be a IPv4 address, otherwise the function will panic. -func NetIPv4ToHost32(ip net.IP) uint32 { - ipv4 := ip.To4() - _ = ipv4[3] // Assert length of ipv4. - return Native.Uint32(ipv4) -} - -func NetIPAddrToHost32(ip netip.Addr) uint32 { - ipv4 := ip.As4() - return Native.Uint32(ipv4[:]) -} diff --git a/vendor/github.com/cilium/cilium/pkg/byteorder/byteorder_bigendian.go b/vendor/github.com/cilium/cilium/pkg/byteorder/byteorder_bigendian.go deleted file mode 100644 index 7b0873f82..000000000 --- a/vendor/github.com/cilium/cilium/pkg/byteorder/byteorder_bigendian.go +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -//go:build armbe || arm64be || mips || mips64 || ppc64 - -package byteorder - -import "encoding/binary" - -var Native binary.ByteOrder = binary.BigEndian - -func HostToNetwork16(u uint16) uint16 { return u } -func HostToNetwork32(u uint32) uint32 { return u } -func HostToNetwork64(u uint64) uint64 { return u } -func NetworkToHost16(u uint16) uint16 { return u } -func NetworkToHost32(u uint32) uint32 { return u } -func NetworkToHost64(u uint64) uint64 { return u } diff --git a/vendor/github.com/cilium/cilium/pkg/byteorder/byteorder_littleendian.go b/vendor/github.com/cilium/cilium/pkg/byteorder/byteorder_littleendian.go deleted file mode 100644 index 0fffee1b2..000000000 --- a/vendor/github.com/cilium/cilium/pkg/byteorder/byteorder_littleendian.go +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -//go:build 386 || amd64 || arm || arm64 || mips64le || ppc64le || riscv64 || wasm - -package byteorder - -import ( - "encoding/binary" - "math/bits" -) - -var Native binary.ByteOrder = binary.LittleEndian - -func HostToNetwork16(u uint16) uint16 { return bits.ReverseBytes16(u) } -func HostToNetwork32(u uint32) uint32 { return bits.ReverseBytes32(u) } -func HostToNetwork64(u uint64) uint64 { return bits.ReverseBytes64(u) } -func NetworkToHost16(u uint16) uint16 { return bits.ReverseBytes16(u) } -func NetworkToHost32(u uint32) uint32 { return bits.ReverseBytes32(u) } -func NetworkToHost64(u uint64) uint64 { return bits.ReverseBytes64(u) } diff --git a/vendor/github.com/cilium/cilium/pkg/byteorder/doc.go b/vendor/github.com/cilium/cilium/pkg/byteorder/doc.go deleted file mode 100644 index 1c2497c75..000000000 --- a/vendor/github.com/cilium/cilium/pkg/byteorder/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Package byteorder provides functions to convert from and to network byte order. -package byteorder diff --git a/vendor/github.com/cilium/cilium/pkg/client/client.go b/vendor/github.com/cilium/cilium/pkg/client/client.go deleted file mode 100644 index 859762431..000000000 --- a/vendor/github.com/cilium/cilium/pkg/client/client.go +++ /dev/null @@ -1,810 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package client - -import ( - "context" - "errors" - "fmt" - "io" - "net" - "net/http" - "net/url" - "os" - "sort" - "strings" - "text/tabwriter" - "time" - - runtime_client "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - - clientapi "github.com/cilium/cilium/api/v1/client" - "github.com/cilium/cilium/api/v1/models" - "github.com/cilium/cilium/pkg/defaults" -) - -type Client struct { - clientapi.CiliumAPI -} - -// DefaultSockPath returns default UNIX domain socket path or -// path set using CILIUM_SOCK env variable -func DefaultSockPath() string { - // Check if environment variable points to socket - e := os.Getenv(defaults.SockPathEnv) - if e == "" { - // If unset, fall back to default value - e = defaults.SockPath - } - return "unix://" + e - -} - -func configureTransport(tr *http.Transport, proto, addr string) *http.Transport { - if tr == nil { - tr = &http.Transport{} - } - - if proto == "unix" { - // No need for compression in local communications. - tr.DisableCompression = true - tr.DialContext = func(_ context.Context, _, _ string) (net.Conn, error) { - return net.Dial(proto, addr) - } - } else { - tr.Proxy = http.ProxyFromEnvironment - tr.DialContext = (&net.Dialer{}).DialContext - } - - return tr -} - -// NewDefaultClient creates a client with default parameters connecting to UNIX domain socket. -func NewDefaultClient() (*Client, error) { - return NewClient("") -} - -// NewDefaultClientWithTimeout creates a client with default parameters connecting to UNIX -// domain socket and waits for cilium-agent availability. -func NewDefaultClientWithTimeout(timeout time.Duration) (*Client, error) { - timeoutAfter := time.After(timeout) - var c *Client - var err error - for { - select { - case <-timeoutAfter: - return nil, fmt.Errorf("failed to create cilium agent client after %f seconds timeout: %w", timeout.Seconds(), err) - default: - } - - c, err = NewDefaultClient() - if err != nil { - time.Sleep(500 * time.Millisecond) - continue - } - - for { - select { - case <-timeoutAfter: - return nil, fmt.Errorf("failed to create cilium agent client after %f seconds timeout: %w", timeout.Seconds(), err) - default: - } - // This is an API call that we do to the cilium-agent to check - // if it is up and running. - _, err = c.Daemon.GetConfig(nil) - if err != nil { - time.Sleep(500 * time.Millisecond) - continue - } - return c, nil - } - } -} - -// NewClient creates a client for the given `host`. -// If host is nil then use SockPath provided by CILIUM_SOCK -// or the cilium default SockPath -func NewClient(host string) (*Client, error) { - clientTrans, err := NewRuntime(WithHost(host)) - return &Client{*clientapi.New(clientTrans, strfmt.Default)}, err -} - -type runtimeOptions struct { - host string - basePath string -} - -func WithHost(host string) func(options *runtimeOptions) { - return func(options *runtimeOptions) { - options.host = host - } -} - -func WithBasePath(basePath string) func(options *runtimeOptions) { - return func(options *runtimeOptions) { - options.basePath = basePath - } -} - -func NewRuntime(opts ...func(options *runtimeOptions)) (*runtime_client.Runtime, error) { - r := runtimeOptions{} - for _, opt := range opts { - opt(&r) - } - - host := r.host - if host == "" { - host = DefaultSockPath() - } - basePath := r.basePath - if basePath == "" { - basePath = clientapi.DefaultBasePath - } - - tmp := strings.SplitN(host, "://", 2) - if len(tmp) != 2 { - return nil, fmt.Errorf("invalid host format '%s'", host) - } - - hostHeader := tmp[1] - - switch tmp[0] { - case "tcp": - if _, err := url.Parse("tcp://" + tmp[1]); err != nil { - return nil, err - } - host = "http://" + tmp[1] - case "unix": - host = tmp[1] - // For local communication (unix domain sockets), the hostname is not used. Leave - // Host header empty because otherwise it would be rejected by net/http client-side - // sanitization, see https://go.dev/issue/60374. - hostHeader = "localhost" - } - - transport := configureTransport(nil, tmp[0], host) - httpClient := &http.Client{Transport: transport} - clientTrans := runtime_client.NewWithClient(hostHeader, basePath, - clientapi.DefaultSchemes, httpClient) - return clientTrans, nil -} - -// Hint tries to improve the error message displayed to the user. -func Hint(err error) error { - if err == nil { - return err - } - - if errors.Is(err, context.DeadlineExceeded) { - return fmt.Errorf("Cilium API client timeout exceeded") - } - - e, _ := url.PathUnescape(err.Error()) - if strings.Contains(err.Error(), defaults.SockPath) { - return fmt.Errorf("%s\nIs the agent running?", e) - } - return fmt.Errorf("%s", e) -} - -func timeSince(since time.Time) string { - out := "never" - if !since.IsZero() { - t := time.Since(since) - out = t.Truncate(time.Second).String() + " ago" - } - - return out -} - -func stateUnhealthy(state string) bool { - return state == models.StatusStateWarning || - state == models.StatusStateFailure -} - -func statusUnhealthy(s *models.Status) bool { - if s != nil { - return stateUnhealthy(s.State) - } - return false -} - -// FormatStatusResponseBrief writes a one-line status to the writer. If -// everything ok, this is "ok", otherwise a message of the form "error in ..." -func FormatStatusResponseBrief(w io.Writer, sr *models.StatusResponse) { - msg := "" - - switch { - case statusUnhealthy(sr.Kvstore): - msg = fmt.Sprintf("kvstore: %s", sr.Kvstore.Msg) - case statusUnhealthy(sr.ContainerRuntime): - msg = fmt.Sprintf("container runtime: %s", sr.ContainerRuntime.Msg) - case sr.Kubernetes != nil && stateUnhealthy(sr.Kubernetes.State): - msg = fmt.Sprintf("kubernetes: %s", sr.Kubernetes.Msg) - case statusUnhealthy(sr.Cilium): - msg = fmt.Sprintf("cilium: %s", sr.Cilium.Msg) - case sr.Cluster != nil && statusUnhealthy(sr.Cluster.CiliumHealth): - msg = fmt.Sprintf("cilium-health: %s", sr.Cluster.CiliumHealth.Msg) - } - - // Only bother looking at controller failures if everything else is ok - if msg == "" { - for _, ctrl := range sr.Controllers { - if ctrl.Status == nil { - continue - } - if ctrl.Status.LastFailureMsg != "" { - msg = fmt.Sprintf("controller %s: %s", - ctrl.Name, ctrl.Status.LastFailureMsg) - break - } - } - } - - if msg == "" { - fmt.Fprintf(w, "OK\n") - } else { - fmt.Fprintf(w, "error in %s\n", msg) - } -} - -func clusterReadiness(cluster *models.RemoteCluster) string { - if !cluster.Ready { - return "not-ready" - } - return "ready" -} - -func numReadyClusters(clustermesh *models.ClusterMeshStatus) int { - numReady := 0 - for _, cluster := range clustermesh.Clusters { - if cluster.Ready { - numReady++ - } - } - return numReady -} - -type StatusDetails struct { - // AllAddress causes all addresses to be printed by FormatStatusResponse. - AllAddresses bool - // AllControllers causes all controllers to be printed by FormatStatusResponse. - AllControllers bool - // AllNodes causes all nodes to be printed by FormatStatusResponse. - AllNodes bool - // AllRedirects causes all redirects to be printed by FormatStatusResponse. - AllRedirects bool - // AllClusters causes all clusters to be printed by FormatStatusResponse. - AllClusters bool - // BPFMapDetails causes BPF map details to be printed by FormatStatusResponse. - BPFMapDetails bool - // KubeProxyReplacementDetails causes BPF kube-proxy details to be printed by FormatStatusResponse. - KubeProxyReplacementDetails bool - // ClockSourceDetails causes BPF time-keeping internals to be printed by FormatStatusResponse. - ClockSourceDetails bool -} - -var ( - // StatusAllDetails causes no additional status details to be printed by - // FormatStatusResponse. - StatusNoDetails = StatusDetails{} - // StatusAllDetails causes all status details to be printed by FormatStatusResponse. - StatusAllDetails = StatusDetails{ - AllAddresses: true, - AllControllers: true, - AllNodes: true, - AllRedirects: true, - AllClusters: true, - BPFMapDetails: true, - KubeProxyReplacementDetails: true, - ClockSourceDetails: true, - } -) - -// FormatStatusResponse writes a StatusResponse as a string to the writer. The bit mask sd controls -// whether a additional details are printed about a certain aspect of the status. In case there are -// errors, some details may be printed regardless of the value of sd. -func FormatStatusResponse(w io.Writer, sr *models.StatusResponse, sd StatusDetails) { - if sr.Kvstore != nil { - fmt.Fprintf(w, "KVStore:\t%s\t%s\n", sr.Kvstore.State, sr.Kvstore.Msg) - } - if sr.ContainerRuntime != nil { - fmt.Fprintf(w, "ContainerRuntime:\t%s\t%s\n", - sr.ContainerRuntime.State, sr.ContainerRuntime.Msg) - } - - kubeProxyDevices := "" - if sr.Kubernetes != nil { - fmt.Fprintf(w, "Kubernetes:\t%s\t%s\n", sr.Kubernetes.State, sr.Kubernetes.Msg) - if sr.Kubernetes.State != models.K8sStatusStateDisabled { - sort.Strings(sr.Kubernetes.K8sAPIVersions) - fmt.Fprintf(w, "Kubernetes APIs:\t[\"%s\"]\n", strings.Join(sr.Kubernetes.K8sAPIVersions, "\", \"")) - } - - } - if sr.KubeProxyReplacement != nil { - devices := "" - if sr.KubeProxyReplacement.Mode != models.KubeProxyReplacementModeFalse { - for i, dev := range sr.KubeProxyReplacement.DeviceList { - kubeProxyDevices += fmt.Sprintf("%s %s", dev.Name, strings.Join(dev.IP, " ")) - if dev.Name == sr.KubeProxyReplacement.DirectRoutingDevice { - kubeProxyDevices += " (Direct Routing)" - } - if i+1 != len(sr.KubeProxyReplacement.Devices) { - kubeProxyDevices += ", " - } - } - if len(sr.KubeProxyReplacement.DeviceList) > 0 { - devices = "[" + kubeProxyDevices + "]" - } - } - fmt.Fprintf(w, "KubeProxyReplacement:\t%s\t%s\n", - sr.KubeProxyReplacement.Mode, devices) - } - if sr.HostFirewall != nil { - fmt.Fprintf(w, "Host firewall:\t%s", sr.HostFirewall.Mode) - if sr.HostFirewall.Mode != models.HostFirewallModeDisabled { - fmt.Fprintf(w, "\t[%s]", strings.Join(sr.HostFirewall.Devices, ", ")) - } - fmt.Fprintf(w, "\n") - } - - if sr.Srv6 != nil { - var fields []string - - status := "Disabled" - fields = append(fields, status) - - if sr.Srv6.Enabled { - fields[0] = "Enabled" - fields = append(fields, fmt.Sprintf("[encap-mode: %s]", sr.Srv6.Srv6EncapMode)) - } - - fmt.Fprintf(w, "SRv6:\t%s\n", strings.Join(fields, "\t")) - } - - if sr.CniChaining != nil { - fmt.Fprintf(w, "CNI Chaining:\t%s\n", sr.CniChaining.Mode) - } - - if sr.CniFile != nil { - fmt.Fprintf(w, "CNI Config file:\t%s\n", sr.CniFile.Msg) - } - - if sr.Cilium != nil { - fmt.Fprintf(w, "Cilium:\t%s %s\n", sr.Cilium.State, sr.Cilium.Msg) - } - - if sr.Stale != nil { - sortedProbes := make([]string, 0, len(sr.Stale)) - for probe := range sr.Stale { - sortedProbes = append(sortedProbes, probe) - } - sort.Strings(sortedProbes) - - stalesStr := make([]string, 0, len(sr.Stale)) - for _, probe := range sortedProbes { - stalesStr = append(stalesStr, fmt.Sprintf("%q since %s", probe, sr.Stale[probe])) - } - - fmt.Fprintf(w, "Stale status:\t%s\n", strings.Join(stalesStr, ", ")) - } - - if nm := sr.NodeMonitor; nm != nil { - fmt.Fprintf(w, "NodeMonitor:\tListening for events on %d CPUs with %dx%d of shared memory\n", - nm.Cpus, nm.Npages, nm.Pagesize) - if nm.Lost != 0 || nm.Unknown != 0 { - fmt.Fprintf(w, "\t%d events lost, %d unknown notifications\n", nm.Lost, nm.Unknown) - } - } else { - fmt.Fprintf(w, "NodeMonitor:\tDisabled\n") - } - - if sr.Cluster != nil { - if sr.Cluster.CiliumHealth != nil { - ch := sr.Cluster.CiliumHealth - fmt.Fprintf(w, "Cilium health daemon:\t%s\t%s\n", ch.State, ch.Msg) - } - } - - if sr.Ipam != nil { - fmt.Fprintf(w, "IPAM:\t%s\n", sr.Ipam.Status) - if sd.AllAddresses { - fmt.Fprintf(w, "Allocated addresses:\n") - out := make([]string, 0, len(sr.Ipam.Allocations)) - for ip, owner := range sr.Ipam.Allocations { - out = append(out, fmt.Sprintf(" %s (%s)", ip, owner)) - } - sort.Strings(out) - for _, line := range out { - fmt.Fprintln(w, line) - } - } - } - - if sr.ClusterMesh != nil { - fmt.Fprintf(w, "ClusterMesh:\t%d/%d clusters ready, %d global-services\n", - numReadyClusters(sr.ClusterMesh), len(sr.ClusterMesh.Clusters), sr.ClusterMesh.NumGlobalServices) - - for _, cluster := range sr.ClusterMesh.Clusters { - if sd.AllClusters || !cluster.Ready { - fmt.Fprintf(w, " %s: %s, %d nodes, %d endpoints, %d identities, %d services, %d failures (last: %s)\n", - cluster.Name, clusterReadiness(cluster), cluster.NumNodes, - cluster.NumEndpoints, cluster.NumIdentities, cluster.NumSharedServices, - cluster.NumFailures, timeSince(time.Time(cluster.LastFailure))) - fmt.Fprintf(w, " └ %s\n", cluster.Status) - - fmt.Fprint(w, " └ remote configuration: ") - if cluster.Config != nil { - fmt.Fprintf(w, "expected=%t, retrieved=%t", cluster.Config.Required, cluster.Config.Retrieved) - if cluster.Config.Retrieved { - fmt.Fprintf(w, ", cluster-id=%d, kvstoremesh=%t, sync-canaries=%t", - cluster.Config.ClusterID, cluster.Config.Kvstoremesh, cluster.Config.SyncCanaries) - } - } else { - fmt.Fprint(w, "expected=unknown, retrieved=unknown") - } - fmt.Fprint(w, "\n") - - if cluster.Synced != nil { - fmt.Fprintf(w, " └ synchronization status: nodes=%v, endpoints=%v, identities=%v, services=%v\n", - cluster.Synced.Nodes, cluster.Synced.Endpoints, cluster.Synced.Identities, cluster.Synced.Services) - } - } - } - } - - if sr.IPV4BigTCP != nil { - status := "Disabled" - if sr.IPV4BigTCP.Enabled { - max := fmt.Sprintf("[%d]", sr.IPV4BigTCP.MaxGSO) - if sr.IPV4BigTCP.MaxGRO != sr.IPV4BigTCP.MaxGSO { - max = fmt.Sprintf("[%d, %d]", sr.IPV4BigTCP.MaxGRO, sr.IPV4BigTCP.MaxGSO) - } - status = fmt.Sprintf("Enabled\t%s", max) - } - fmt.Fprintf(w, "IPv4 BIG TCP:\t%s\n", status) - } - - if sr.IPV6BigTCP != nil { - status := "Disabled" - if sr.IPV6BigTCP.Enabled { - max := fmt.Sprintf("[%d]", sr.IPV6BigTCP.MaxGSO) - if sr.IPV6BigTCP.MaxGRO != sr.IPV6BigTCP.MaxGSO { - max = fmt.Sprintf("[%d, %d]", sr.IPV6BigTCP.MaxGRO, sr.IPV6BigTCP.MaxGSO) - } - status = fmt.Sprintf("Enabled\t%s", max) - } - fmt.Fprintf(w, "IPv6 BIG TCP:\t%s\n", status) - } - - if sr.BandwidthManager != nil { - var status string - if !sr.BandwidthManager.Enabled { - status = "Disabled" - } else { - status = fmt.Sprintf("EDT with BPF [%s] [%s]", - strings.ToUpper(sr.BandwidthManager.CongestionControl), - strings.Join(sr.BandwidthManager.Devices, ", ")) - } - fmt.Fprintf(w, "BandwidthManager:\t%s\n", status) - } - - if sr.Routing != nil { - status := "Network: " + sr.Routing.InterHostRoutingMode - if sr.Routing.InterHostRoutingMode == models.RoutingInterHostRoutingModeTunnel { - status = status + " [" + sr.Routing.TunnelProtocol + "]" - } - status = status + "\tHost: " + sr.Routing.IntraHostRoutingMode - - fmt.Fprintf(w, "Routing:\t%s\n", status) - } - - if sr.AttachMode != "" { - status := "Legacy TC" - if sr.AttachMode == models.AttachModeTcx { - status = "TCX" - } - fmt.Fprintf(w, "Attach Mode:\t%s\n", status) - } - - if sr.Masquerading != nil { - var status string - - enabled := func(enabled bool) string { - if enabled { - return "Enabled" - } - return "Disabled" - } - - if sr.Masquerading.EnabledProtocols == nil { - status = enabled(sr.Masquerading.Enabled) - } else if !sr.Masquerading.EnabledProtocols.IPV4 && !sr.Masquerading.EnabledProtocols.IPV6 { - status = enabled(false) - } else { - if sr.Masquerading.Mode == models.MasqueradingModeBPF { - if sr.Masquerading.IPMasqAgent { - status = "BPF (ip-masq-agent)" - } else { - status = "BPF" - } - if sr.KubeProxyReplacement != nil { - // When BPF Masquerading is enabled we don't do any masquerading for IPv6 - // traffic so no SNAT Exclusion IPv6 CIDR is listed in status output. - devStr := "" - for i, dev := range sr.KubeProxyReplacement.DeviceList { - devStr += dev.Name - if i+1 != len(sr.KubeProxyReplacement.DeviceList) { - devStr += ", " - } - } - status += fmt.Sprintf("\t[%s]\t%s", - devStr, - sr.Masquerading.SnatExclusionCidrV4) - } - - } else if sr.Masquerading.Mode == models.MasqueradingModeIptables { - status = "IPTables" - } - - status = fmt.Sprintf("%s [IPv4: %s, IPv6: %s]", status, - enabled(sr.Masquerading.EnabledProtocols.IPV4), enabled(sr.Masquerading.EnabledProtocols.IPV6)) - } - fmt.Fprintf(w, "Masquerading:\t%s\n", status) - } - - if sd.ClockSourceDetails && sr.ClockSource != nil { - status := sr.ClockSource.Mode - if sr.ClockSource.Mode == models.ClockSourceModeJiffies { - status = fmt.Sprintf("%s\t[%d Hz]", - sr.ClockSource.Mode, sr.ClockSource.Hertz) - } - fmt.Fprintf(w, "Clock Source for BPF:\t%s\n", status) - } - - if sr.Controllers != nil { - nFailing, out := 0, []string{" Name\tLast success\tLast error\tCount\tMessage\n"} - for _, ctrl := range sr.Controllers { - status := ctrl.Status - if status == nil { - continue - } - - if status.ConsecutiveFailureCount > 0 { - nFailing++ - } else if !sd.AllControllers { - continue - } - - failSince := timeSince(time.Time(status.LastFailureTimestamp)) - successSince := timeSince(time.Time(status.LastSuccessTimestamp)) - - err := "no error" - if status.LastFailureMsg != "" { - err = status.LastFailureMsg - } - - out = append(out, fmt.Sprintf(" %s\t%s\t%s\t%d\t%s\t\n", - ctrl.Name, successSince, failSince, status.ConsecutiveFailureCount, err)) - } - - nOK := len(sr.Controllers) - nFailing - fmt.Fprintf(w, "Controller Status:\t%d/%d healthy\n", nOK, len(sr.Controllers)) - if len(out) > 1 { - tab := tabwriter.NewWriter(w, 0, 0, 3, ' ', 0) - sort.Strings(out) - for _, s := range out { - fmt.Fprint(tab, s) - } - tab.Flush() - } - - } - - if sr.Proxy != nil { - fmt.Fprintf(w, "Proxy Status:\tOK, ip %s, %d redirects active on ports %s, Envoy: %s\n", - sr.Proxy.IP, sr.Proxy.TotalRedirects, sr.Proxy.PortRange, sr.Proxy.EnvoyDeploymentMode) - if sd.AllRedirects && sr.Proxy.TotalRedirects > 0 { - out := make([]string, 0, len(sr.Proxy.Redirects)+1) - for _, r := range sr.Proxy.Redirects { - out = append(out, fmt.Sprintf(" %s\t%s\t%d\n", r.Proxy, r.Name, r.ProxyPort)) - } - tab := tabwriter.NewWriter(w, 0, 0, 3, ' ', 0) - fmt.Fprint(tab, " Protocol\tRedirect\tProxy Port\n") - sort.Strings(out) - for _, s := range out { - fmt.Fprint(tab, s) - } - tab.Flush() - } - } else { - fmt.Fprintf(w, "Proxy Status:\tNo managed proxy redirect\n") - } - - if sr.IdentityRange != nil { - fmt.Fprintf(w, "Global Identity Range:\tmin %d, max %d\n", - sr.IdentityRange.MinIdentity, sr.IdentityRange.MaxIdentity) - } else { - fmt.Fprintf(w, "Global Identity Range:\tUnknown\n") - } - - if sr.Hubble != nil { - var fields []string - - state := sr.Hubble.State - if sr.Hubble.Msg != "" { - state = fmt.Sprintf("%s %s", state, sr.Hubble.Msg) - } - fields = append(fields, state) - - if o := sr.Hubble.Observer; o != nil { - var observer []string - - if o.MaxFlows > 0 { - observer = append(observer, fmt.Sprintf("Current/Max Flows: %d/%d (%.2f%%)", - o.CurrentFlows, o.MaxFlows, (float64(o.CurrentFlows)/float64(o.MaxFlows))*100)) - } - if o.Uptime > 0 { - observer = append(observer, fmt.Sprintf("Flows/s: %.2f", - float64(o.SeenFlows)/time.Duration(o.Uptime).Seconds())) - } - - fields = append(fields, strings.Join(observer, ", ")) - } - - if sr.Hubble.Metrics != nil { - fields = append(fields, fmt.Sprintf("Metrics: %s", sr.Hubble.Metrics.State)) - } - - fmt.Fprintf(w, "Hubble:\t%s\n", strings.Join(fields, "\t")) - } - - if sd.KubeProxyReplacementDetails && sr.Kubernetes != nil && sr.KubeProxyReplacement != nil { - var selection, mode, dsrMode, xdp string - - lb := "Disabled" - cIP := "Enabled" - nPort := "Disabled" - if np := sr.KubeProxyReplacement.Features.NodePort; np.Enabled { - selection = np.Algorithm - if selection == models.KubeProxyReplacementFeaturesNodePortAlgorithmMaglev { - selection = fmt.Sprintf("%s (Table Size: %d)", np.Algorithm, np.LutSize) - } - xdp = np.Acceleration - mode = np.Mode - if mode == models.KubeProxyReplacementFeaturesNodePortModeDSR || - mode == models.KubeProxyReplacementFeaturesNodePortModeHybrid { - dsrMode = np.DsrMode - } - nPort = fmt.Sprintf("Enabled (Range: %d-%d)", np.PortMin, np.PortMax) - lb = "Enabled" - } - - affinity := "Disabled" - if sr.KubeProxyReplacement.Features.SessionAffinity.Enabled { - affinity = "Enabled" - } - - hPort := "Disabled" - if sr.KubeProxyReplacement.Features.HostPort.Enabled { - hPort = "Enabled" - } - - eIP := "Disabled" - if sr.KubeProxyReplacement.Features.ExternalIPs.Enabled { - eIP = "Enabled" - } - - socketLB := "Disabled" - if slb := sr.KubeProxyReplacement.Features.SocketLB; slb.Enabled { - socketLB = "Enabled" - } - - socketLBTracing := "Disabled" - if st := sr.KubeProxyReplacement.Features.SocketLBTracing; st.Enabled { - socketLBTracing = "Enabled" - } - - socketLBCoverage := "Full" - if sr.KubeProxyReplacement.Features.BpfSocketLBHostnsOnly { - socketLBCoverage = "Hostns-only" - } - - gracefulTerm := "Disabled" - if sr.KubeProxyReplacement.Features.GracefulTermination.Enabled { - gracefulTerm = "Enabled" - } - - nat46X64 := "Disabled" - nat46X64GW := "Disabled" - nat46X64SVC := "Disabled" - prefixes := "" - if sr.KubeProxyReplacement.Features.Nat46X64.Enabled { - nat46X64 = "Enabled" - if svc := sr.KubeProxyReplacement.Features.Nat46X64.Service; svc.Enabled { - nat46X64SVC = "Enabled" - } - if gw := sr.KubeProxyReplacement.Features.Nat46X64.Gateway; gw.Enabled { - nat46X64GW = "Enabled" - prefixes = strings.Join(gw.Prefixes, ", ") - } - } - - fmt.Fprintf(w, "KubeProxyReplacement Details:\n") - tab := tabwriter.NewWriter(w, 0, 0, 3, ' ', 0) - fmt.Fprintf(tab, " Status:\t%s\n", sr.KubeProxyReplacement.Mode) - fmt.Fprintf(tab, " Socket LB:\t%s\n", socketLB) - fmt.Fprintf(tab, " Socket LB Tracing:\t%s\n", socketLBTracing) - fmt.Fprintf(tab, " Socket LB Coverage:\t%s\n", socketLBCoverage) - if kubeProxyDevices != "" { - fmt.Fprintf(tab, " Devices:\t%s\n", kubeProxyDevices) - } - if mode != "" { - fmt.Fprintf(tab, " Mode:\t%s\n", mode) - } - if dsrMode != "" { - fmt.Fprintf(tab, " DSR Dispatch Mode:\t%s\n", dsrMode) - } - if selection != "" { - fmt.Fprintf(tab, " Backend Selection:\t%s\n", selection) - } - fmt.Fprintf(tab, " Session Affinity:\t%s\n", affinity) - fmt.Fprintf(tab, " Graceful Termination:\t%s\n", gracefulTerm) - if nat46X64 == "Disabled" { - fmt.Fprintf(tab, " NAT46/64 Support:\t%s\n", nat46X64) - } else { - fmt.Fprintf(tab, " NAT46/64 Support:\n") - fmt.Fprintf(tab, " - Services:\t%s\n", nat46X64SVC) - fmt.Fprintf(tab, " - Gateway:\t%s\n", nat46X64GW) - if nat46X64GW == "Enabled" && prefixes != "" { - fmt.Fprintf(tab, " Prefixes:\t%s\n", prefixes) - } - } - if xdp != "" { - fmt.Fprintf(tab, " XDP Acceleration:\t%s\n", xdp) - } - fmt.Fprintf(tab, " Services:\n") - fmt.Fprintf(tab, " - ClusterIP:\t%s\n", cIP) - fmt.Fprintf(tab, " - NodePort:\t%s \n", nPort) - fmt.Fprintf(tab, " - LoadBalancer:\t%s \n", lb) - fmt.Fprintf(tab, " - externalIPs:\t%s \n", eIP) - fmt.Fprintf(tab, " - HostPort:\t%s\n", hPort) - tab.Flush() - } - - if sd.BPFMapDetails && sr.BpfMaps != nil { - dynamicSizingStatus := "off" - ratio := sr.BpfMaps.DynamicSizeRatio - if 0.0 < ratio && ratio <= 1.0 { - dynamicSizingStatus = fmt.Sprintf("on (ratio: %f)", ratio) - } - fmt.Fprintf(w, "BPF Maps:\tdynamic sizing: %s\n", dynamicSizingStatus) - tab := tabwriter.NewWriter(w, 0, 0, 3, ' ', 0) - fmt.Fprintf(tab, " Name\tSize\n") - for _, m := range sr.BpfMaps.Maps { - fmt.Fprintf(tab, " %s\t%d\n", m.Name, m.Size) - } - tab.Flush() - } - - if sr.Encryption != nil { - var fields []string - - if sr.Encryption.Msg != "" { - fields = append(fields, sr.Encryption.Msg) - } else if wg := sr.Encryption.Wireguard; wg != nil { - fields = append(fields, fmt.Sprintf("[NodeEncryption: %s", wg.NodeEncryption)) - ifaces := make([]string, 0, len(wg.Interfaces)) - for _, i := range wg.Interfaces { - iface := fmt.Sprintf("%s (Pubkey: %s, Port: %d, Peers: %d)", - i.Name, i.PublicKey, i.ListenPort, i.PeerCount) - ifaces = append(ifaces, iface) - } - fields = append(fields, fmt.Sprintf("%s]", strings.Join(ifaces, ", "))) - } - - fmt.Fprintf(w, "Encryption:\t%s\t%s\n", sr.Encryption.Mode, strings.Join(fields, ", ")) - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/client/config.go b/vendor/github.com/cilium/cilium/pkg/client/config.go deleted file mode 100644 index 3775abe2e..000000000 --- a/vendor/github.com/cilium/cilium/pkg/client/config.go +++ /dev/null @@ -1,38 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package client - -import ( - "github.com/cilium/cilium/api/v1/client/daemon" - "github.com/cilium/cilium/api/v1/models" - "github.com/cilium/cilium/pkg/api" -) - -// ConfigGet returns a daemon configuration. -func (c *Client) ConfigGet() (*models.DaemonConfiguration, error) { - resp, err := c.Daemon.GetConfig(nil) - if err != nil { - return nil, Hint(err) - } - return resp.Payload, nil -} - -// ConfigPatch modifies the daemon configuration. -func (c *Client) ConfigPatch(cfg models.DaemonConfigurationSpec) error { - fullCfg, err := c.ConfigGet() - if err != nil { - return err - } - - for opt, value := range cfg.Options { - fullCfg.Spec.Options[opt] = value - } - if cfg.PolicyEnforcement != "" { - fullCfg.Spec.PolicyEnforcement = cfg.PolicyEnforcement - } - - params := daemon.NewPatchConfigParams().WithConfiguration(fullCfg.Spec).WithTimeout(api.ClientTimeout) - _, err = c.Daemon.PatchConfig(params) - return Hint(err) -} diff --git a/vendor/github.com/cilium/cilium/pkg/client/endpoint.go b/vendor/github.com/cilium/cilium/pkg/client/endpoint.go deleted file mode 100644 index 7563a8ce2..000000000 --- a/vendor/github.com/cilium/cilium/pkg/client/endpoint.go +++ /dev/null @@ -1,151 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package client - -import ( - "github.com/cilium/cilium/api/v1/client/endpoint" - "github.com/cilium/cilium/api/v1/models" - "github.com/cilium/cilium/pkg/api" - pkgEndpointID "github.com/cilium/cilium/pkg/endpoint/id" - "github.com/cilium/cilium/pkg/labels" -) - -// EndpointList returns a list of all endpoints -func (c *Client) EndpointList() ([]*models.Endpoint, error) { - resp, err := c.Endpoint.GetEndpoint(nil) - if err != nil { - return nil, Hint(err) - } - return resp.Payload, nil -} - -// EndpointDeleteMany deletes multiple endpoints -func (c *Client) EndpointDeleteMany(req *models.EndpointBatchDeleteRequest) error { - params := endpoint.NewDeleteEndpointParams().WithEndpoint(req).WithTimeout(api.ClientTimeout) - _, _, err := c.Endpoint.DeleteEndpoint(params) - return Hint(err) -} - -// EndpointGet returns endpoint by ID -func (c *Client) EndpointGet(id string) (*models.Endpoint, error) { - params := endpoint.NewGetEndpointIDParams().WithID(id).WithTimeout(api.ClientTimeout) - resp, err := c.Endpoint.GetEndpointID(params) - if err != nil { - /* Since plugins rely on checking the error type, we don't wrap this - * with Hint(...) - */ - return nil, err - } - return resp.Payload, nil -} - -// EndpointCreate creates a new endpoint -func (c *Client) EndpointCreate(ep *models.EndpointChangeRequest) (*models.Endpoint, error) { - id := pkgEndpointID.NewCiliumID(ep.ID) - params := endpoint.NewPutEndpointIDParams().WithID(id).WithEndpoint(ep).WithTimeout(api.ClientTimeout) - resp, err := c.Endpoint.PutEndpointID(params) - if err != nil { - return nil, Hint(err) - } - return resp.Payload, nil -} - -// EndpointPatch modifies the endpoint -func (c *Client) EndpointPatch(id string, ep *models.EndpointChangeRequest) error { - params := endpoint.NewPatchEndpointIDParams().WithID(id).WithEndpoint(ep).WithTimeout(api.ClientTimeout) - _, err := c.Endpoint.PatchEndpointID(params) - return Hint(err) -} - -// EndpointDelete deletes endpoint -func (c *Client) EndpointDelete(id string) error { - params := endpoint.NewDeleteEndpointIDParams().WithID(id).WithTimeout(api.ClientTimeout) - _, _, err := c.Endpoint.DeleteEndpointID(params) - return Hint(err) -} - -// EndpointLogGet returns endpoint log -func (c *Client) EndpointLogGet(id string) (models.EndpointStatusLog, error) { - params := endpoint.NewGetEndpointIDLogParams().WithID(id).WithTimeout(api.ClientTimeout) - resp, err := c.Endpoint.GetEndpointIDLog(params) - if err != nil { - return nil, Hint(err) - } - return resp.Payload, nil -} - -// EndpointHealthGet returns endpoint healthz -func (c *Client) EndpointHealthGet(id string) (*models.EndpointHealth, error) { - params := endpoint.NewGetEndpointIDHealthzParams().WithID(id).WithTimeout(api.ClientTimeout) - resp, err := c.Endpoint.GetEndpointIDHealthz(params) - if err != nil { - return nil, Hint(err) - } - return resp.Payload, nil -} - -// EndpointConfigGet returns endpoint configuration -func (c *Client) EndpointConfigGet(id string) (*models.EndpointConfigurationStatus, error) { - params := endpoint.NewGetEndpointIDConfigParams().WithID(id).WithTimeout(api.ClientTimeout) - resp, err := c.Endpoint.GetEndpointIDConfig(params) - if err != nil { - return nil, Hint(err) - } - return resp.Payload, nil -} - -// EndpointConfigPatch modifies endpoint configuration -func (c *Client) EndpointConfigPatch(id string, cfg *models.EndpointConfigurationSpec) error { - params := endpoint.NewPatchEndpointIDConfigParams().WithID(id).WithTimeout(api.ClientTimeout) - if cfg != nil { - params.SetEndpointConfiguration(cfg) - } - - _, err := c.Endpoint.PatchEndpointIDConfig(params) - return Hint(err) -} - -// EndpointLabelsGet returns endpoint label configuration -func (c *Client) EndpointLabelsGet(id string) (*models.LabelConfiguration, error) { - params := endpoint.NewGetEndpointIDLabelsParams().WithID(id).WithTimeout(api.ClientTimeout) - resp, err := c.Endpoint.GetEndpointIDLabels(params) - if err != nil { - return nil, Hint(err) - } - return resp.Payload, nil -} - -// EndpointLabelsPut modifies endpoint label configuration -// add: List of labels to add and enable. If the label is an orchestration -// system label which has been disabled before, it will be removed from -// the disabled list and readded to the orchestration list. Otherwise -// it will be added to the custom label list. -// -// delete: List of labels to delete. If the label is an orchestration system -// label, then it will be deleted from the orchestration list and -// added to the disabled list. Otherwise it will be removed from the -// custom list. -func (c *Client) EndpointLabelsPatch(id string, toAdd, toDelete models.Labels) error { - currentCfg, err := c.EndpointLabelsGet(id) - if err != nil { - return err - } - - userLbl := labels.NewLabelsFromModel(currentCfg.Status.Realized.User) - for _, lbl := range toAdd { - lblParsed := labels.ParseLabel(lbl) - if _, found := userLbl[lblParsed.Key]; !found { - userLbl[lblParsed.Key] = lblParsed - } - } - for _, lbl := range toDelete { - lblParsed := labels.ParseLabel(lbl) - delete(userLbl, lblParsed.Key) - } - currentCfg.Spec.User = userLbl.GetModel() - - params := endpoint.NewPatchEndpointIDLabelsParams().WithID(id).WithTimeout(api.ClientTimeout) - _, err = c.Endpoint.PatchEndpointIDLabels(params.WithConfiguration(currentCfg.Spec)) - return Hint(err) -} diff --git a/vendor/github.com/cilium/cilium/pkg/client/identity.go b/vendor/github.com/cilium/cilium/pkg/client/identity.go deleted file mode 100644 index 483509ea7..000000000 --- a/vendor/github.com/cilium/cilium/pkg/client/identity.go +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package client - -import ( - "github.com/cilium/cilium/api/v1/client/policy" - "github.com/cilium/cilium/api/v1/models" - "github.com/cilium/cilium/pkg/api" -) - -// IdentityGet returns a security identity. -func (c *Client) IdentityGet(id string) (*models.Identity, error) { - params := policy.NewGetIdentityIDParams().WithID(id).WithTimeout(api.ClientTimeout) - - resp, err := c.Policy.GetIdentityID(params) - if err != nil { - return nil, Hint(err) - } - return resp.Payload, nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/client/ipam.go b/vendor/github.com/cilium/cilium/pkg/client/ipam.go deleted file mode 100644 index e50bbfb51..000000000 --- a/vendor/github.com/cilium/cilium/pkg/client/ipam.go +++ /dev/null @@ -1,57 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package client - -import ( - "github.com/cilium/cilium/api/v1/client/ipam" - "github.com/cilium/cilium/api/v1/models" - "github.com/cilium/cilium/pkg/api" -) - -const ( - AddressFamilyIPv6 = "ipv6" - AddressFamilyIPv4 = "ipv4" -) - -// IPAMAllocate allocates an IP address out of address family specific pool. -func (c *Client) IPAMAllocate(family, owner, pool string, expiration bool) (*models.IPAMResponse, error) { - params := ipam.NewPostIpamParams().WithTimeout(api.ClientTimeout) - - if family != "" { - params.SetFamily(&family) - } - if owner != "" { - params.SetOwner(&owner) - } - if pool != "" { - params.SetPool(&pool) - } - params.SetExpiration(&expiration) - - resp, err := c.Ipam.PostIpam(params) - if err != nil { - return nil, Hint(err) - } - return resp.Payload, nil -} - -// IPAMAllocateIP tries to allocate a particular IP address. -func (c *Client) IPAMAllocateIP(ip, owner, pool string) error { - params := ipam.NewPostIpamIPParams().WithIP(ip).WithOwner(&owner).WithTimeout(api.ClientTimeout) - if pool != "" { - params.SetPool(&pool) - } - _, err := c.Ipam.PostIpamIP(params) - return Hint(err) -} - -// IPAMReleaseIP releases a IP address back to the pool. -func (c *Client) IPAMReleaseIP(ip, pool string) error { - params := ipam.NewDeleteIpamIPParams().WithIP(ip).WithTimeout(api.ClientTimeout) - if pool != "" { - params.SetPool(&pool) - } - _, err := c.Ipam.DeleteIpamIP(params) - return Hint(err) -} diff --git a/vendor/github.com/cilium/cilium/pkg/client/lrp.go b/vendor/github.com/cilium/cilium/pkg/client/lrp.go deleted file mode 100644 index c1108b497..000000000 --- a/vendor/github.com/cilium/cilium/pkg/client/lrp.go +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package client - -import ( - "github.com/cilium/cilium/api/v1/models" -) - -// GetLRPs returns a list of all local redirect policies. -func (c *Client) GetLRPs() ([]*models.LRPSpec, error) { - resp, err := c.Service.GetLrp(nil) - if err != nil { - return nil, Hint(err) - } - return resp.Payload, nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/client/policy.go b/vendor/github.com/cilium/cilium/pkg/client/policy.go deleted file mode 100644 index f90cd86a7..000000000 --- a/vendor/github.com/cilium/cilium/pkg/client/policy.go +++ /dev/null @@ -1,60 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package client - -import ( - "github.com/cilium/cilium/api/v1/client/policy" - "github.com/cilium/cilium/api/v1/models" - "github.com/cilium/cilium/pkg/api" -) - -// PolicyPut inserts the `policyJSON` -func (c *Client) PolicyPut(policyJSON string) (*models.Policy, error) { - params := policy.NewPutPolicyParams().WithPolicy(policyJSON).WithTimeout(api.ClientTimeout) - resp, err := c.Policy.PutPolicy(params) - if err != nil { - return nil, Hint(err) - } - return resp.Payload, nil -} - -// PolicyReplace replaces the `policyJSON` -func (c *Client) PolicyReplace(policyJSON string, replace bool, replaceWithLabels []string) (*models.Policy, error) { - params := policy.NewPutPolicyParams().WithPolicy(policyJSON).WithReplace(&replace).WithReplaceWithLabels(replaceWithLabels).WithTimeout(api.ClientTimeout) - resp, err := c.Policy.PutPolicy(params) - if err != nil { - return nil, Hint(err) - } - return resp.Payload, nil -} - -// PolicyGet returns policy rules -func (c *Client) PolicyGet(labels []string) (*models.Policy, error) { - params := policy.NewGetPolicyParams().WithLabels(labels).WithTimeout(api.ClientTimeout) - resp, err := c.Policy.GetPolicy(params) - if err != nil { - return nil, Hint(err) - } - return resp.Payload, nil -} - -// PolicyCacheGet returns the contents of a SelectorCache. -func (c *Client) PolicyCacheGet() (models.SelectorCache, error) { - params := policy.NewGetPolicySelectorsParams().WithTimeout(api.ClientTimeout) - resp, err := c.Policy.GetPolicySelectors(params) - if err != nil { - return nil, Hint(err) - } - return resp.Payload, nil -} - -// PolicyDelete deletes policy rules -func (c *Client) PolicyDelete(labels []string) (*models.Policy, error) { - params := policy.NewDeletePolicyParams().WithLabels(labels).WithTimeout(api.ClientTimeout) - resp, err := c.Policy.DeletePolicy(params) - if err != nil { - return nil, Hint(err) - } - return resp.Payload, Hint(err) -} diff --git a/vendor/github.com/cilium/cilium/pkg/client/prefilter.go b/vendor/github.com/cilium/cilium/pkg/client/prefilter.go deleted file mode 100644 index 79de98e1b..000000000 --- a/vendor/github.com/cilium/cilium/pkg/client/prefilter.go +++ /dev/null @@ -1,39 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package client - -import ( - "github.com/cilium/cilium/api/v1/client/prefilter" - "github.com/cilium/cilium/api/v1/models" - "github.com/cilium/cilium/pkg/api" -) - -// GetPrefilter returns a list of all CIDR prefixes -func (c *Client) GetPrefilter() (*models.Prefilter, error) { - resp, err := c.Prefilter.GetPrefilter(nil) - if err != nil { - return nil, Hint(err) - } - return resp.Payload, nil -} - -// PatchPrefilter sets a list of CIDR prefixes -func (c *Client) PatchPrefilter(spec *models.PrefilterSpec) (*models.Prefilter, error) { - params := prefilter.NewPatchPrefilterParams().WithPrefilterSpec(spec).WithTimeout(api.ClientTimeout) - resp, err := c.Prefilter.PatchPrefilter(params) - if err != nil { - return nil, Hint(err) - } - return resp.Payload, nil -} - -// DeletePrefilter deletes a list of CIDR prefixes -func (c *Client) DeletePrefilter(spec *models.PrefilterSpec) (*models.Prefilter, error) { - params := prefilter.NewDeletePrefilterParams().WithPrefilterSpec(spec).WithTimeout(api.ClientTimeout) - resp, err := c.Prefilter.DeletePrefilter(params) - if err != nil { - return nil, Hint(err) - } - return resp.Payload, nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/client/recorder.go b/vendor/github.com/cilium/cilium/pkg/client/recorder.go deleted file mode 100644 index 4da24a72b..000000000 --- a/vendor/github.com/cilium/cilium/pkg/client/recorder.go +++ /dev/null @@ -1,47 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package client - -import ( - "github.com/cilium/cilium/api/v1/client/recorder" - "github.com/cilium/cilium/api/v1/models" - "github.com/cilium/cilium/pkg/api" -) - -func (c *Client) GetRecorder() ([]*models.Recorder, error) { - resp, err := c.Recorder.GetRecorder(nil) - if err != nil { - return nil, Hint(err) - } - return resp.Payload, nil -} - -func (c *Client) GetRecorderMasks() ([]*models.RecorderMask, error) { - resp, err := c.Recorder.GetRecorderMasks(nil) - if err != nil { - return nil, Hint(err) - } - return resp.Payload, nil -} - -func (c *Client) GetRecorderID(id int64) (*models.Recorder, error) { - params := recorder.NewGetRecorderIDParams().WithID(id).WithTimeout(api.ClientTimeout) - resp, err := c.Recorder.GetRecorderID(params) - if err != nil { - return nil, Hint(err) - } - return resp.Payload, nil -} - -func (c *Client) PutRecorderID(id int64, rec *models.RecorderSpec) (bool, error) { - params := recorder.NewPutRecorderIDParams().WithID(id).WithConfig(rec).WithTimeout(api.ClientTimeout) - _, created, err := c.Recorder.PutRecorderID(params) - return created != nil, Hint(err) -} - -func (c *Client) DeleteRecorderID(id int64) error { - params := recorder.NewDeleteRecorderIDParams().WithID(id).WithTimeout(api.ClientTimeout) - _, err := c.Recorder.DeleteRecorderID(params) - return Hint(err) -} diff --git a/vendor/github.com/cilium/cilium/pkg/client/service.go b/vendor/github.com/cilium/cilium/pkg/client/service.go deleted file mode 100644 index fa53468c7..000000000 --- a/vendor/github.com/cilium/cilium/pkg/client/service.go +++ /dev/null @@ -1,44 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package client - -import ( - "github.com/cilium/cilium/api/v1/client/service" - "github.com/cilium/cilium/api/v1/models" - "github.com/cilium/cilium/pkg/api" -) - -// GetServices returns a list of all services. -func (c *Client) GetServices() ([]*models.Service, error) { - resp, err := c.Service.GetService(nil) - if err != nil { - return nil, Hint(err) - } - return resp.Payload, nil -} - -// GetServiceID returns a service by ID. -func (c *Client) GetServiceID(id int64) (*models.Service, error) { - params := service.NewGetServiceIDParams().WithID(id).WithTimeout(api.ClientTimeout) - resp, err := c.Service.GetServiceID(params) - if err != nil { - return nil, Hint(err) - } - return resp.Payload, nil -} - -// PutServiceID creates or updates a service. Returns true if service was created. -func (c *Client) PutServiceID(id int64, svc *models.ServiceSpec) (bool, error) { - svc.ID = id - params := service.NewPutServiceIDParams().WithID(id).WithConfig(svc).WithTimeout(api.ClientTimeout) - _, created, err := c.Service.PutServiceID(params) - return created != nil, Hint(err) -} - -// DeleteServiceID deletes a service by ID. -func (c *Client) DeleteServiceID(id int64) error { - params := service.NewDeleteServiceIDParams().WithID(id).WithTimeout(api.ClientTimeout) - _, err := c.Service.DeleteServiceID(params) - return Hint(err) -} diff --git a/vendor/github.com/cilium/cilium/pkg/clustermesh/types/option.go b/vendor/github.com/cilium/cilium/pkg/clustermesh/types/option.go index 0ec16ac98..547d3fc2c 100644 --- a/vendor/github.com/cilium/cilium/pkg/clustermesh/types/option.go +++ b/vendor/github.com/cilium/cilium/pkg/clustermesh/types/option.go @@ -4,7 +4,6 @@ package types import ( - "errors" "fmt" "github.com/spf13/pflag" @@ -81,18 +80,8 @@ func (c ClusterInfo) ExtendedClusterMeshEnabled() bool { } // ValidateRemoteConfig validates the remote CiliumClusterConfig to ensure -// compatibility with this cluster's configuration. When configRequired is -// false, a missing configuration or one with ID=0 is allowed for backward -// compatibility, otherwise it is flagged as an error. -func (c ClusterInfo) ValidateRemoteConfig(configRequired bool, config *CiliumClusterConfig) error { - if config == nil || config.ID == 0 { - if configRequired || c.ExtendedClusterMeshEnabled() { - return errors.New("remote cluster is missing cluster configuration") - } - - return nil - } - +// compatibility with this cluster's configuration. +func (c ClusterInfo) ValidateRemoteConfig(config CiliumClusterConfig) error { if err := ValidateClusterID(config.ID); err != nil { return err } diff --git a/vendor/github.com/cilium/cilium/pkg/clustermesh/types/types.go b/vendor/github.com/cilium/cilium/pkg/clustermesh/types/types.go index 8137467fe..775003687 100644 --- a/vendor/github.com/cilium/cilium/pkg/clustermesh/types/types.go +++ b/vendor/github.com/cilium/cilium/pkg/clustermesh/types/types.go @@ -13,6 +13,8 @@ const ( // ClusterIDMin is the minimum value of the cluster ID ClusterIDMin = 0 ClusterIDExt511 = 511 + + ClusterIDUnset = ClusterIDMin ) // ClusterIDMax is the maximum value of the cluster ID @@ -61,12 +63,3 @@ type CiliumClusterConfigCapabilities struct { // The maximum number of clusters the given cluster can support in a ClusterMesh. MaxConnectedClusters uint32 `json:"maxConnectedClusters,omitempty"` } - -// ValidationMode defines if a missing CiliumClusterConfig should be allowed for -// backward compatibility, or it should be flagged as an error. -type ValidationMode bool - -const ( - BackwardCompatible ValidationMode = false - Strict ValidationMode = true -) diff --git a/vendor/github.com/cilium/cilium/pkg/command/exec/doc.go b/vendor/github.com/cilium/cilium/pkg/command/exec/doc.go deleted file mode 100644 index 959e90373..000000000 --- a/vendor/github.com/cilium/cilium/pkg/command/exec/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Package exec provides useful wrappers around the standard "exec" library. -package exec diff --git a/vendor/github.com/cilium/cilium/pkg/command/exec/exec.go b/vendor/github.com/cilium/cilium/pkg/command/exec/exec.go deleted file mode 100644 index 1762e5dbb..000000000 --- a/vendor/github.com/cilium/cilium/pkg/command/exec/exec.go +++ /dev/null @@ -1,124 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package exec - -import ( - "bufio" - "bytes" - "context" - "errors" - "fmt" - "os/exec" - - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/pkg/time" -) - -func warnToLog(cmd *exec.Cmd, out []byte, scopedLog *logrus.Entry, err error) { - scopedLog.WithError(err).WithField("cmd", cmd.Args).Error("Command execution failed") - scanner := bufio.NewScanner(bytes.NewReader(out)) - for scanner.Scan() { - scopedLog.Warn(scanner.Text()) - } -} - -// combinedOutput is the core implementation of catching deadline exceeded -// options and logging errors. -func combinedOutput(ctx context.Context, cmd *exec.Cmd, scopedLog *logrus.Entry, verbose bool) ([]byte, error) { - out, err := cmd.CombinedOutput() - if ctx.Err() != nil { - if !errors.Is(ctx.Err(), context.Canceled) { - scopedLog.WithError(err).WithField("cmd", cmd.Args).Error("Command execution failed") - } - return nil, fmt.Errorf("Command execution failed for %s: %w", cmd.Args, ctx.Err()) - } - if err != nil && verbose { - warnToLog(cmd, out, scopedLog, err) - } - return out, err -} - -// output is the equivalent to combinedOutput with only capturing stdout -func output(ctx context.Context, cmd *exec.Cmd, scopedLog *logrus.Entry, verbose bool) ([]byte, error) { - out, err := cmd.Output() - if ctx.Err() != nil { - if !errors.Is(ctx.Err(), context.Canceled) { - scopedLog.WithError(err).WithField("cmd", cmd.Args).Error("Command execution failed") - } - return nil, fmt.Errorf("Command execution failed for %s: %w", cmd.Args, ctx.Err()) - } - if err != nil { - var exitErr *exec.ExitError - if errors.As(err, &exitErr) { - err = fmt.Errorf("%w stderr=%q", exitErr, exitErr.Stderr) - } - if verbose { - warnToLog(cmd, out, scopedLog, err) - } - } - return out, err -} - -// Cmd wraps exec.Cmd with a context to provide convenient execution of a -// command with nice checking of the context timeout in the form: -// -// err := exec.Prog().WithTimeout(5*time.Second, myprog, myargs...).CombinedOutput(log, verbose) -type Cmd struct { - *exec.Cmd - ctx context.Context - cancelFn func() -} - -// CommandContext wraps exec.CommandContext to allow this package to be used as -// a drop-in replacement for the standard exec library. -func CommandContext(ctx context.Context, prog string, args ...string) *Cmd { - return &Cmd{ - Cmd: exec.CommandContext(ctx, prog, args...), - ctx: ctx, - } -} - -// WithTimeout creates a Cmd with a context that times out after the specified -// duration. -func WithTimeout(timeout time.Duration, prog string, args ...string) *Cmd { - ctx, cancel := context.WithTimeout(context.Background(), timeout) - cmd := CommandContext(ctx, prog, args...) - cmd.cancelFn = cancel - return cmd -} - -// WithCancel creates a Cmd with a context that can be cancelled by calling the -// resulting Cancel() function. -func WithCancel(ctx context.Context, prog string, args ...string) (*Cmd, context.CancelFunc) { - newCtx, cancel := context.WithCancel(ctx) - cmd := CommandContext(newCtx, prog, args...) - return cmd, cancel -} - -// CombinedOutput runs the command and returns its combined standard output and -// standard error. Unlike the standard library, if the context is exceeded, it -// will return an error indicating so. -// -// Logs any errors that occur to the specified logger. -func (c *Cmd) CombinedOutput(scopedLog *logrus.Entry, verbose bool) ([]byte, error) { - out, err := combinedOutput(c.ctx, c.Cmd, scopedLog, verbose) - if c.cancelFn != nil { - c.cancelFn() - } - return out, err -} - -// Output runs the command and returns only standard output, but not the -// standard error. Unlike the standard library, if the context is exceeded, -// it will return an error indicating so. -// -// Logs any errors that occur to the specified logger. -func (c *Cmd) Output(scopedLog *logrus.Entry, verbose bool) ([]byte, error) { - out, err := output(c.ctx, c.Cmd, scopedLog, verbose) - if c.cancelFn != nil { - c.cancelFn() - } - return out, err -} diff --git a/vendor/github.com/cilium/cilium/pkg/common/const.go b/vendor/github.com/cilium/cilium/pkg/common/const.go deleted file mode 100644 index e9a0718a5..000000000 --- a/vendor/github.com/cilium/cilium/pkg/common/const.go +++ /dev/null @@ -1,19 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package common - -const ( - // Miscellaneous dedicated constants - - // CHeaderFileName is the name of the C header file for BPF programs for a - // particular endpoint. - CHeaderFileName = "ep_config.h" - - // EndpointStateFileName is used as the file name for the JSON representation - // of endpoint state. - EndpointStateFileName = "ep_config.json" - - // PossibleCPUSysfsPath is used to retrieve the number of CPUs for per-CPU maps. - PossibleCPUSysfsPath = "/sys/devices/system/cpu/possible" -) diff --git a/vendor/github.com/cilium/cilium/pkg/common/utils.go b/vendor/github.com/cilium/cilium/pkg/common/utils.go deleted file mode 100644 index b8a5a5d40..000000000 --- a/vendor/github.com/cilium/cilium/pkg/common/utils.go +++ /dev/null @@ -1,137 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package common - -import ( - "fmt" - "io" - "os" - "strconv" - "strings" - - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/pkg/safeio" -) - -// C2GoArray transforms an hexadecimal string representation into a byte slice. -// Example: -// str := "0x12, 0xff, 0x0, 0x1" -// fmt.Print(C2GoArray(str)) //`{0x12, 0xFF, 0x0, 0x01}`" -func C2GoArray(str string) []byte { - ret := []byte{} - - if str == "" { - return ret - } - - hexStr := strings.Split(str, ", ") - for _, hexDigit := range hexStr { - strDigit := strings.TrimPrefix(hexDigit, "0x") - digitUint64, err := strconv.ParseUint(strDigit, 16, 8) - if err != nil { - return nil - } - ret = append(ret, byte(digitUint64)) - } - return ret -} - -// GoArray2C transforms a byte slice into its hexadecimal string representation. -// Example: -// array := []byte{0x12, 0xFF, 0x0, 0x01} -// fmt.Print(GoArray2C(array)) // "{ 0x12, 0xff, 0x0, 0x1 }" -func GoArray2C(array []byte) string { - return goArray2C(array, true) -} - -// GoArray2CNoSpaces does the same as GoArray2C, but no spaces are used in -// the final output. -// Example: -// array := []byte{0x12, 0xFF, 0x0, 0x01} -// fmt.Print(GoArray2CNoSpaces(array)) // "{0x12,0xff,0x0,0x1}" -func GoArray2CNoSpaces(array []byte) string { - return goArray2C(array, false) -} - -func goArray2C(array []byte, space bool) string { - ret := "" - format := ",%#x" - if space { - format = ", %#x" - } - - for i, e := range array { - if i == 0 { - ret = ret + fmt.Sprintf("%#x", e) - } else { - ret = ret + fmt.Sprintf(format, e) - } - } - return ret -} - -// RequireRootPrivilege checks if the user running cmd is root. If not, it exits the program -func RequireRootPrivilege(cmd string) { - if os.Getuid() != 0 { - fmt.Fprintf(os.Stderr, "Please run %q command(s) with root privileges.\n", cmd) - os.Exit(1) - } -} - -// MapStringStructToSlice returns a slice with all keys of the given -// map[string]struct{} -func MapStringStructToSlice(m map[string]struct{}) []string { - s := make([]string, 0, len(m)) - for k := range m { - s = append(s, k) - } - return s -} - -// GetNumPossibleCPUs returns a total number of possible CPUS, i.e. CPUs that -// have been allocated resources and can be brought online if they are present. -// The number is retrieved by parsing /sys/devices/system/cpu/possible. -// -// See https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/cpumask.h?h=v4.19#n50 -// for more details. -func GetNumPossibleCPUs(log logrus.FieldLogger) int { - f, err := os.Open(PossibleCPUSysfsPath) - if err != nil { - log.WithError(err).Errorf("unable to open %q", PossibleCPUSysfsPath) - return 0 - } - defer f.Close() - - return getNumPossibleCPUsFromReader(log, f) -} - -func getNumPossibleCPUsFromReader(log logrus.FieldLogger, r io.Reader) int { - out, err := safeio.ReadAllLimit(r, safeio.KB) - if err != nil { - log.WithError(err).Errorf("unable to read %q to get CPU count", PossibleCPUSysfsPath) - return 0 - } - - var start, end int - count := 0 - for _, s := range strings.Split(string(out), ",") { - // Go's scanf will return an error if a format cannot be fully matched. - // So, just ignore it, as a partial match (e.g. when there is only one - // CPU) is expected. - n, err := fmt.Sscanf(s, "%d-%d", &start, &end) - - switch n { - case 0: - log.WithError(err).Errorf("failed to scan %q to retrieve number of possible CPUs!", s) - return 0 - case 1: - count++ - default: - count += (end - start + 1) - } - } - - return count -} diff --git a/vendor/github.com/cilium/cilium/pkg/comparator/comparator.go b/vendor/github.com/cilium/cilium/pkg/comparator/comparator.go deleted file mode 100644 index 689629d80..000000000 --- a/vendor/github.com/cilium/cilium/pkg/comparator/comparator.go +++ /dev/null @@ -1,65 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package comparator - -import ( - "github.com/kr/pretty" - "github.com/pmezard/go-difflib/difflib" -) - -// CompareWithNames compares two interfaces and emits a unified diff as string -func CompareWithNames(a, b interface{}, nameA, nameB string) string { - stringA := pretty.Sprintf("%# v", a) - stringB := pretty.Sprintf("%# v", b) - diff := difflib.UnifiedDiff{ - A: difflib.SplitLines(stringA), - B: difflib.SplitLines(stringB), - FromFile: nameA, - ToFile: nameB, - Context: 32, - } - - out, err := difflib.GetUnifiedDiffString(diff) - if err != nil { - return err.Error() - } - return "Unified diff:\n" + out -} - -// MapStringEqualsIgnoreKeys returns true if both maps have the same values for -// the keys that are not present in the 'ignoreKeys'. -func MapStringEqualsIgnoreKeys(m1, m2 map[string]string, ignoreKeys []string) bool { - switch { - case m1 == nil && m2 == nil: - return true - case m1 == nil && m2 != nil, - m1 != nil && m2 == nil: - return false - } - ignoredM1 := 0 - for k1, v1 := range m1 { - var ignore bool - for _, ig := range ignoreKeys { - if k1 == ig { - ignore = true - break - } - } - if ignore { - ignoredM1++ - continue - } - if v2, ok := m2[k1]; !ok || v2 != v1 { - return false - } - } - - ignoredM2 := 0 - for _, ig := range ignoreKeys { - if _, ok := m2[ig]; ok { - ignoredM2++ - } - } - return len(m1)-ignoredM1 == len(m2)-ignoredM2 -} diff --git a/vendor/github.com/cilium/cilium/pkg/controller/cell.go b/vendor/github.com/cilium/cilium/pkg/controller/cell.go deleted file mode 100644 index e9146e069..000000000 --- a/vendor/github.com/cilium/cilium/pkg/controller/cell.go +++ /dev/null @@ -1,74 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package controller - -import ( - "github.com/cilium/hive/cell" - "github.com/spf13/pflag" - - "github.com/cilium/cilium/pkg/metrics" - "github.com/cilium/cilium/pkg/metrics/metric" -) - -const ( - controllerGroupMetrics = "controller-group-metrics" - - // labelControllerGroupName is the label used - // to identify controller-specific metrics - labelControllerGroupName = "group_name" -) - -var ( - // GroupMetricEnabled is populated with the set of ControllerGroups for which metrics are enabled - groupMetricEnabled = map[string]bool{} - - // GroupRuns is a Prometheus-compatible metric for Controller - // runs, labeled by completion status and Group name - GroupRuns = metrics.NoOpCounterVec -) - -var Cell = cell.Module( - "controller", - "Controllers and Controller Lifecycle management", - cell.Config(Config{}), - metrics.Metric(NewMetrics), - cell.Invoke(Init), -) - -type Metrics struct { - ControllerGroupRuns metric.Vec[metric.Counter] -} - -func NewMetrics() Metrics { - return Metrics{ - ControllerGroupRuns: metric.NewCounterVec(metric.CounterOpts{ - ConfigName: metrics.Namespace + "_controllers_group_runs_total", - Namespace: metrics.Namespace, - Name: "controllers_group_runs_total", - Help: "Number of times that a controller group was run, labeled by completion status and controller group name", - }, []string{labelControllerGroupName, metrics.LabelStatus}), - } -} - -type Config struct { - // ControllerGroupMetrics is an option which specifies the set of ControllerGroups names - // for which metrics will be enabled. The special values 'all' and 'none' are supported. - ControllerGroupMetrics []string -} - -func (cfg Config) Flags(flags *pflag.FlagSet) { - flags.StringSlice(controllerGroupMetrics, cfg.ControllerGroupMetrics, - "List of controller group names for which to to enable metrics. "+ - "Accepts 'all' and 'none'. "+ - "The set of controller group names available is not guaranteed to be stable between Cilium versions.") -} - -func Init(cfg Config, m Metrics) { - // Initialize package-scoped references to Cell configuration - for _, name := range cfg.ControllerGroupMetrics { - groupMetricEnabled[name] = true - } - - GroupRuns = m.ControllerGroupRuns -} diff --git a/vendor/github.com/cilium/cilium/pkg/controller/controller.go b/vendor/github.com/cilium/cilium/pkg/controller/controller.go deleted file mode 100644 index 6ee59316b..000000000 --- a/vendor/github.com/cilium/cilium/pkg/controller/controller.go +++ /dev/null @@ -1,405 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package controller - -import ( - "context" - "errors" - "fmt" - "math" - - "github.com/cilium/hive/cell" - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/pkg/inctimer" - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/metrics" - "github.com/cilium/cilium/pkg/time" -) - -const ( - success = "success" - failure = "failure" - - // special Group "names" for metrics config - allControllerMetricsEnabled = "all" - noControllerMetricsEnabled = "none" -) - -// ControllerFunc is a function that the controller runs. This type is used for -// DoFunc and StopFunc. -type ControllerFunc func(ctx context.Context) error - -// ExitReason is a returnable type from DoFunc that causes the -// controller to exit. This reason is recorded in the controller's status. The -// controller is not removed from any manager. -// Construct one with NewExitReason("a reason") -type ExitReason struct { - // This is constucted in this odd way because the type assertion in - // runController didn't work otherwise. - error -} - -// NewExitReason returns a new ExitReason -func NewExitReason(reason string) ExitReason { - return ExitReason{errors.New(reason)} -} - -// Group contains metadata about a group of controllers -type Group struct { - // Name of the controller group. - // - // This name MUST NOT be dynamically generated based on - // resource identifier in order to limit metrics cardinality. - Name string -} - -func NewGroup(name string) Group { - return Group{Name: name} -} - -// ControllerParams contains all parameters of a controller -type ControllerParams struct { - // Group is used for aggregate metrics collection. - // The Group.Name must NOT be dynamically generated from a - // resource identifier in order to limit metrics cardinality. - Group Group - - Health cell.Health - - // DoFunc is the function that will be run until it succeeds and/or - // using the interval RunInterval if not 0. - // An unset DoFunc is an error and will be logged as one. - DoFunc ControllerFunc - - // CancelDoFuncOnUpdate when set to true cancels the controller context - // (the DoFunc) to allow quick termination of controller - CancelDoFuncOnUpdate bool - - // StopFunc is called when the controller stops. It is intended to run any - // clean-up tasks for the controller (e.g. deallocate/release resources) - // It is guaranteed that DoFunc is called at least once before StopFunc is - // called. - // An unset StopFunc is not an error (and will be a no-op) - // Note: Since this occurs on controller exit, error counts and tracking may - // not be checked after StopFunc is run. - StopFunc ControllerFunc - - // If set to any other value than 0, will cause DoFunc to be run in the - // specified interval. The interval starts from when the DoFunc has - // returned last - RunInterval time.Duration - - // If set to any other value than 0, will cap the error retry interval - // to the specified interval. - MaxRetryInterval time.Duration - - // ErrorRetryBaseDuration is the initial time to wait to run DoFunc - // again on return of an error. On each consecutive error, this value - // is multiplied by the number of consecutive errors to provide a - // constant back off. The default is 1s. - ErrorRetryBaseDuration time.Duration - - // NoErrorRetry when set to true, disabled retries on errors - NoErrorRetry bool - - Context context.Context -} - -// undefinedDoFunc is used when no DoFunc is set. controller.DoFunc is set to this -// when the controller is incorrectly initialised. -func undefinedDoFunc(name string) error { - return fmt.Errorf("controller %s DoFunc is nil", name) -} - -// NoopFunc is a no-op placeholder for DoFunc & StopFunc. -// It is automatically used when StopFunc is undefined, and can be used as a -// DoFunc stub when the controller should only run StopFunc. -func NoopFunc(ctx context.Context) error { - return nil -} - -// isGroupMetricEnabled returns true if metrics are enabled for the Group -// -// The controller metrics config option is used to determine -// if "all", "none" (takes precedence over "all"), or the -// given set of Group names should be enabled. -// -// If no controller metrics config option was provided, -// only then is the DefaultMetricsEnabled field used. -func isGroupMetricEnabled(g Group) bool { - var metricsEnabled = groupMetricEnabled - if metricsEnabled == nil { - // There is currently no guarantee that a caller of this function - // has initialized the configuration map using the hive cell. - return false - } - - if metricsEnabled[noControllerMetricsEnabled] { - // "none" takes precedence over "all" - return false - } else if metricsEnabled[allControllerMetricsEnabled] { - return true - } else { - return metricsEnabled[g.Name] - } -} - -// Controller is a simple pattern that allows to perform the following -// tasks: -// - Run an operation in the background and retry until it succeeds -// - Perform a regular sync operation in the background -// -// A controller has configurable retry intervals and will collect statistics -// on number of successful runs, number of failures, last error message, -// and last error timestamp. -// -// Controllers have a name and are tied to a Manager. The manager is typically -// bound to higher level objects such as endpoint. These higher level objects -// can then run multiple controllers to perform async tasks such as: -// - Annotating k8s resources with values -// - Synchronizing an object with the kvstore -// - Any other async operation to may fail and require retries -// -// Embedding the Manager into higher level resources allows to bind controllers -// to the lifetime of that object. Controllers also have a UUID to allow -// correlating all log messages of a controller instance. -// -// Guidelines to writing controllers: -// - Make sure that the task the controller performs is done in an atomic -// fashion, e.g. if a controller modifies a resource in multiple steps, an -// intermediate manipulation operation failing should not leave behind -// an inconsistent state. This can typically be achieved by locking the -// resource and rolling back or by using transactions. -// - Controllers typically act on behalf of a higher level object such as an -// endpoint. The controller must ensure that the higher level object is -// properly locked when accessing any fields. -// - Controllers run asynchronously in the background, it is the responsibility -// of the controller to be aware of the lifecycle of the owning higher level -// object. This is typically achieved by removing all controllers when the -// owner dies. It is the responsibility of the owner to either lock the owner -// in a way that will delay destruction throughout the controller run or to -// check for the destruction throughout the run. -type controller struct { - // Constant after creation, safe to access without locking - group Group - name string - uuid string - logger *logrus.Entry - - // Channels written to and/or closed by the manager - stop chan struct{} - update chan ControllerParams - trigger chan struct{} - - // terminated is closed by the controller goroutine when it terminates - terminated chan struct{} - - // Manipulated by the controller, read by the Manager, requires locking - mutex lock.RWMutex - successCount int - lastSuccessStamp time.Time - failureCount int - consecutiveErrors int - lastError error - lastErrorStamp time.Time - lastDuration time.Duration -} - -// GetSuccessCount returns the number of successful controller runs -func (c *controller) GetSuccessCount() int { - c.mutex.RLock() - defer c.mutex.RUnlock() - - return c.successCount -} - -// GetFailureCount returns the number of failed controller runs -func (c *controller) GetFailureCount() int { - c.mutex.RLock() - defer c.mutex.RUnlock() - - return c.failureCount -} - -// GetLastError returns the last error returned -func (c *controller) GetLastError() error { - c.mutex.RLock() - defer c.mutex.RUnlock() - - return c.lastError -} - -// GetLastErrorTimestamp returns the last error returned -func (c *controller) GetLastErrorTimestamp() time.Time { - c.mutex.RLock() - defer c.mutex.RUnlock() - - return c.lastErrorStamp -} - -func (c *controller) runController(params ControllerParams) { - errorRetries := 1 - - runTimer, timerDone := inctimer.New() - defer timerDone() - - for { - var err error - - interval := params.RunInterval - - start := time.Now() - err = params.DoFunc(params.Context) - duration := time.Since(start) - - c.mutex.Lock() - c.lastDuration = duration - c.getLogger().Debug("Controller func execution time: ", c.lastDuration) - - if err != nil { - if params.Context.Err() != nil { - // The controller's context was canceled. Let's wait for the - // next controller update (or stop). - err = NewExitReason("controller context canceled") - } - - var exitReason ExitReason - if errors.As(err, &exitReason) { - // This is actually not an error case, but it causes an exit - c.recordSuccess(params.Health) - c.lastError = exitReason // This will be shown in the controller status - - // Don't exit the goroutine, since that only happens when the - // controller is explicitly stopped. Instead, just wait for - // the next update. - c.getLogger().Debug("Controller run succeeded; waiting for next controller update or stop") - interval = time.Duration(math.MaxInt64) - - } else { - c.getLogger().WithField(fieldConsecutiveErrors, errorRetries). - WithError(err).Debug("Controller run failed") - c.recordError(err, params.Health) - - if !params.NoErrorRetry { - if params.ErrorRetryBaseDuration != time.Duration(0) { - interval = time.Duration(errorRetries) * params.ErrorRetryBaseDuration - } else { - interval = time.Duration(errorRetries) * time.Second - } - - if params.MaxRetryInterval > 0 && interval > params.MaxRetryInterval { - c.getLogger().WithFields(logrus.Fields{ - "calculatedInterval": interval, - "maxAllowedInterval": params.MaxRetryInterval, - }).Debug("Cap retry interval to max allowed value") - interval = params.MaxRetryInterval - } - - errorRetries++ - } - } - } else { - c.recordSuccess(params.Health) - - // reset error retries after successful attempt - errorRetries = 1 - - // If no run interval is specified, no further updates - // are required. - if interval == time.Duration(0) { - // Don't exit the goroutine, since that only happens when the - // controller is explicitly stopped. Instead, just wait for - // the next update. - c.getLogger().Debug("Controller run succeeded; waiting for next controller update or stop") - interval = time.Duration(math.MaxInt64) - } - } - - c.mutex.Unlock() - - select { - case <-c.stop: - goto shutdown - - case params = <-c.update: - // update channel is never closed - case <-runTimer.After(interval): - // timer channel is not yet closed - case <-c.trigger: - // trigger channel is never closed - } - - // If we receive a signal on multiple channels golang will pick one randomly. - // This select will make sure we don't execute the controller - // while we are shutting down. - select { - case <-c.stop: - goto shutdown - default: - } - } - -shutdown: - c.getLogger().Debug("Shutting down controller") - - if err := params.StopFunc(context.TODO()); err != nil { - c.mutex.Lock() - c.recordError(err, params.Health) - c.mutex.Unlock() - c.getLogger().WithField(fieldConsecutiveErrors, errorRetries). - WithError(err).Warn("Error on Controller stop") - } - - close(c.terminated) -} - -// logger returns a logrus object with controllerName and UUID fields. -func (c *controller) getLogger() *logrus.Entry { - if c.logger == nil { - c.logger = log.WithFields(logrus.Fields{ - fieldControllerName: c.name, - fieldUUID: c.uuid, - }) - } - - return c.logger -} - -// recordError updates all statistic collection variables on error -// c.mutex must be held. -func (c *controller) recordError(err error, h cell.Health) { - if h != nil { - h.Degraded(c.name, err) - } - c.lastError = err - c.lastErrorStamp = time.Now() - c.failureCount++ - c.consecutiveErrors++ - - metrics.ControllerRuns.WithLabelValues(failure).Inc() - if isGroupMetricEnabled(c.group) { - GroupRuns.WithLabelValues(c.group.Name, failure).Inc() - } - metrics.ControllerRunsDuration.WithLabelValues(failure).Observe(c.lastDuration.Seconds()) -} - -// recordSuccess updates all statistic collection variables on success -// c.mutex must be held. -func (c *controller) recordSuccess(h cell.Health) { - if h != nil { - h.OK(c.name) - } - - c.lastError = nil - c.lastSuccessStamp = time.Now() - c.successCount++ - c.consecutiveErrors = 0 - - metrics.ControllerRuns.WithLabelValues(success).Inc() - if isGroupMetricEnabled(c.group) { - GroupRuns.WithLabelValues(c.group.Name, success).Inc() - } - metrics.ControllerRunsDuration.WithLabelValues(success).Observe(c.lastDuration.Seconds()) -} diff --git a/vendor/github.com/cilium/cilium/pkg/controller/doc.go b/vendor/github.com/cilium/cilium/pkg/controller/doc.go deleted file mode 100644 index 0bab327fd..000000000 --- a/vendor/github.com/cilium/cilium/pkg/controller/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Package controller provide a simple pattern for async operations that -// require retries and/or regular intervals. -package controller diff --git a/vendor/github.com/cilium/cilium/pkg/controller/logfields.go b/vendor/github.com/cilium/cilium/pkg/controller/logfields.go deleted file mode 100644 index ff1446925..000000000 --- a/vendor/github.com/cilium/cilium/pkg/controller/logfields.go +++ /dev/null @@ -1,26 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package controller - -import ( - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" -) - -// logging field definitions -const ( - // fieldControllerName is the name of the controller - fieldControllerName = "name" - - // fieldUUID is the UUID of the controller - fieldUUID = "uuid" - - // fieldConsecutiveErrors is the number of consecutive errors of a controller - fieldConsecutiveErrors = "consecutiveErrors" -) - -var ( - // log is the controller package logger object. - log = logging.DefaultLogger.WithField(logfields.LogSubsys, "controller") -) diff --git a/vendor/github.com/cilium/cilium/pkg/controller/manager.go b/vendor/github.com/cilium/cilium/pkg/controller/manager.go deleted file mode 100644 index cd9a2c73a..000000000 --- a/vendor/github.com/cilium/cilium/pkg/controller/manager.go +++ /dev/null @@ -1,345 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package controller - -import ( - "context" - "fmt" - - "github.com/go-openapi/strfmt" - "github.com/google/uuid" - - "github.com/cilium/cilium/api/v1/models" - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/option" - "github.com/cilium/cilium/pkg/time" -) - -var ( - // globalStatus is the global status of all controllers - globalStatus = NewManager() -) - -type controllerMap map[string]*managedController - -// Manager is a list of controllers -type Manager struct { - controllers controllerMap - mutex lock.RWMutex -} - -// NewManager allocates a new manager -func NewManager() *Manager { - return &Manager{ - controllers: controllerMap{}, - } -} - -// GetGlobalStatus returns the status of all controllers -func GetGlobalStatus() models.ControllerStatuses { - return globalStatus.GetStatusModel() -} - -// UpdateController installs or updates a controller in the -// manager. A controller is primarily identified by its name. -// If a controller with the name already exists, the controller -// will be shut down and replaced with the provided controller. -// -// Updating a controller will cause the DoFunc to be run immediately regardless -// of any previous conditions. It will also cause any statistics to be reset. -func (m *Manager) UpdateController(name string, params ControllerParams) { - m.updateController(name, params) -} - -func (m *Manager) updateController(name string, params ControllerParams) *managedController { - start := time.Now() - - m.mutex.Lock() - defer m.mutex.Unlock() - - if m.controllers == nil { - m.controllers = controllerMap{} - } - - if params.Group.Name == "" { - log.Errorf( - "Controller initialized with unpopulated group information. " + - "Metrics will not be exported for this controller.") - } - - ctrl := m.lookupLocked(name) - if ctrl != nil { - ctrl.getLogger().Debug("Updating existing controller") - ctrl.updateParamsLocked(params) - - // Notify the goroutine of the params update. - select { - case ctrl.update <- ctrl.params: - default: - } - - ctrl.getLogger().Debug("Controller update time: ", time.Since(start)) - } else { - return m.createControllerLocked(name, params) - } - - return ctrl -} - -func (m *Manager) createControllerLocked(name string, params ControllerParams) *managedController { - ctrl := &managedController{ - controller: controller{ - name: name, - group: params.Group, - uuid: uuid.New().String(), - stop: make(chan struct{}), - update: make(chan ControllerParams, 1), - trigger: make(chan struct{}, 1), - terminated: make(chan struct{}), - }, - } - ctrl.updateParamsLocked(params) - ctrl.getLogger().Debug("Starting new controller") - - m.controllers[ctrl.name] = ctrl - - globalStatus.mutex.Lock() - globalStatus.controllers[ctrl.uuid] = ctrl - globalStatus.mutex.Unlock() - - go ctrl.runController(ctrl.params) - return ctrl -} - -// CreateController installs a new controller in the -// manager. If a controller with the name already exists -// this method returns false without triggering, otherwise -// creates the controller and runs it immediately. -func (m *Manager) CreateController(name string, params ControllerParams) bool { - m.mutex.Lock() - defer m.mutex.Unlock() - - if m.controllers != nil { - if ctrl := m.lookupLocked(name); ctrl != nil { - return false - } - } else { - m.controllers = controllerMap{} - } - m.createControllerLocked(name, params) - return true -} - -func (m *Manager) removeController(ctrl *managedController) { - ctrl.stopController() - delete(m.controllers, ctrl.name) - - globalStatus.mutex.Lock() - delete(globalStatus.controllers, ctrl.uuid) - globalStatus.mutex.Unlock() - - ctrl.getLogger().Debug("Removed controller") -} - -func (m *Manager) lookup(name string) *managedController { - m.mutex.RLock() - defer m.mutex.RUnlock() - return m.lookupLocked(name) -} - -func (m *Manager) lookupLocked(name string) *managedController { - if c, ok := m.controllers[name]; ok { - return c - } - return nil -} - -func (m *Manager) removeAndReturnController(name string) (*managedController, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - if m.controllers == nil { - return nil, fmt.Errorf("empty controller map") - } - - oldCtrl := m.lookupLocked(name) - if oldCtrl == nil { - return nil, fmt.Errorf("unable to find controller %s", name) - } - - m.removeController(oldCtrl) - - return oldCtrl, nil -} - -// RemoveController stops and removes a controller from the manager. If DoFunc -// is currently running, DoFunc is allowed to complete in the background. -func (m *Manager) RemoveController(name string) error { - _, err := m.removeAndReturnController(name) - return err -} - -// RemoveControllerAndWait stops and removes a controller using -// RemoveController() and then waits for it to run to completion. -func (m *Manager) RemoveControllerAndWait(name string) error { - oldCtrl, err := m.removeAndReturnController(name) - if err == nil { - <-oldCtrl.terminated - } - - return err -} - -func (m *Manager) removeAll() []*managedController { - ctrls := []*managedController{} - - m.mutex.Lock() - defer m.mutex.Unlock() - - if m.controllers == nil { - return ctrls - } - - for _, ctrl := range m.controllers { - m.removeController(ctrl) - ctrls = append(ctrls, ctrl) - } - - return ctrls -} - -// RemoveAll stops and removes all controllers of the manager -func (m *Manager) RemoveAll() { - m.removeAll() -} - -// RemoveAllAndWait stops and removes all controllers of the manager and then -// waits for all controllers to exit -func (m *Manager) RemoveAllAndWait() { - ctrls := m.removeAll() - for _, ctrl := range ctrls { - <-ctrl.terminated - } -} - -// GetStatusModel returns the status of all controllers as models.ControllerStatuses -func (m *Manager) GetStatusModel() models.ControllerStatuses { - // Create a copy of pointers to current controller so we can unlock the - // manager mutex quickly again - controllers := controllerMap{} - m.mutex.RLock() - for key, c := range m.controllers { - controllers[key] = c - } - m.mutex.RUnlock() - - statuses := models.ControllerStatuses{} - for _, c := range controllers { - statuses = append(statuses, c.GetStatusModel()) - } - - return statuses -} - -// TriggerController triggers the controller with the specified name. -func (m *Manager) TriggerController(name string) { - ctrl := m.lookup(name) - if ctrl == nil { - return - } - - select { - case ctrl.trigger <- struct{}{}: - default: - } -} - -type managedController struct { - controller - - params ControllerParams - cancelDoFunc context.CancelFunc -} - -// updateParamsLocked sanitizes and sets the controller's parameters. -// -// If the RunInterval exceeds ControllerMaxInterval, it will be capped. -// -// Manager's mutex must be held -func (c *managedController) updateParamsLocked(params ControllerParams) { - // ensure the callbacks are valid - if params.DoFunc == nil { - params.DoFunc = func(ctx context.Context) error { - return undefinedDoFunc(c.name) - } - } - if params.StopFunc == nil { - params.StopFunc = NoopFunc - } - - // Enforce max controller interval - maxInterval := time.Duration(option.Config.MaxControllerInterval) * time.Second - if maxInterval > 0 && params.RunInterval > maxInterval { - c.getLogger().Infof("Limiting interval to %s", maxInterval) - params.RunInterval = maxInterval - } - - // Save current context on update if not canceling - ctx := c.params.Context - // Check if the current context needs to be cancelled - if c.params.CancelDoFuncOnUpdate && c.cancelDoFunc != nil { - c.cancelDoFunc() - c.params.Context = nil - } - - // (re)set the context as the previous might have been cancelled - if c.params.Context == nil { - if params.Context == nil { - ctx, c.cancelDoFunc = context.WithCancel(context.Background()) - } else { - ctx, c.cancelDoFunc = context.WithCancel(params.Context) - } - } - - c.params = params - c.params.Context = ctx -} - -func (c *managedController) stopController() { - if c.cancelDoFunc != nil { - c.cancelDoFunc() - } - - close(c.stop) -} - -// GetStatusModel returns a models.ControllerStatus representing the -// controller's configuration & status -func (c *managedController) GetStatusModel() *models.ControllerStatus { - c.mutex.RLock() - defer c.mutex.RUnlock() - - status := &models.ControllerStatus{ - Name: c.name, - UUID: strfmt.UUID(c.uuid), - Configuration: &models.ControllerStatusConfiguration{ - ErrorRetry: !c.params.NoErrorRetry, - ErrorRetryBase: strfmt.Duration(c.params.ErrorRetryBaseDuration), - Interval: strfmt.Duration(c.params.RunInterval), - }, - Status: &models.ControllerStatusStatus{ - SuccessCount: int64(c.successCount), - LastSuccessTimestamp: strfmt.DateTime(c.lastSuccessStamp), - FailureCount: int64(c.failureCount), - LastFailureTimestamp: strfmt.DateTime(c.lastErrorStamp), - ConsecutiveFailureCount: int64(c.consecutiveErrors), - }, - } - - if c.lastError != nil { - status.Status.LastFailureMsg = c.lastError.Error() - } - - return status -} diff --git a/vendor/github.com/cilium/cilium/pkg/crypto/certificatemanager/certificate_manager.go b/vendor/github.com/cilium/cilium/pkg/crypto/certificatemanager/certificate_manager.go deleted file mode 100644 index fd4993250..000000000 --- a/vendor/github.com/cilium/cilium/pkg/crypto/certificatemanager/certificate_manager.go +++ /dev/null @@ -1,177 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package certificatemanager - -import ( - "context" - "fmt" - "os" - "path/filepath" - - "github.com/cilium/hive/cell" - "github.com/spf13/pflag" - - k8sClient "github.com/cilium/cilium/pkg/k8s/client" - "github.com/cilium/cilium/pkg/policy/api" -) - -var Cell = cell.Module( - "certificate-manager", - "Provides TLS certificates and secrets", - - cell.Provide(NewManager), - - cell.Config(defaultManagerConfig), -) - -type CertificateManager interface { - GetTLSContext(ctx context.Context, tlsCtx *api.TLSContext, ns string) (ca, public, private string, err error) -} - -type SecretManager interface { - GetSecrets(ctx context.Context, secret *api.Secret, ns string) (string, map[string][]byte, error) - GetSecretString(ctx context.Context, secret *api.Secret, ns string) (string, error) -} - -var defaultManagerConfig = managerConfig{ - CertificatesDirectory: "/var/run/cilium/certs", -} - -type managerConfig struct { - // CertificatesDirectory is the root directory to be used by cilium to find - // certificates locally. - CertificatesDirectory string -} - -func (mc managerConfig) Flags(flags *pflag.FlagSet) { - flags.String("certificates-directory", mc.CertificatesDirectory, "Root directory to find certificates specified in L7 TLS policy enforcement") -} - -// Manager will manage the way certificates are retrieved based in the given -// k8sClient and rootPath. -type manager struct { - rootPath string - k8sClient k8sClient.Clientset -} - -// NewManager returns a new manager. -func NewManager(cfg managerConfig, clientset k8sClient.Clientset) (CertificateManager, SecretManager) { - m := &manager{ - rootPath: cfg.CertificatesDirectory, - k8sClient: clientset, - } - - return m, m -} - -// GetSecrets returns either local or k8s secrets, giving precedence for local secrets if configured. -// The 'ns' parameter is used as the secret namespace if 'secret.Namespace' is an empty string. -func (m *manager) GetSecrets(ctx context.Context, secret *api.Secret, ns string) (string, map[string][]byte, error) { - if secret == nil { - return "", nil, fmt.Errorf("Secret must not be nil") - } - - if secret.Namespace != "" { - ns = secret.Namespace - } - - if secret.Name == "" { - return ns, nil, fmt.Errorf("Missing Secret name") - } - nsName := filepath.Join(ns, secret.Name) - - // Give priority to local secrets. - // K8s API request is only done if the local secret directory can't be read! - certPath := filepath.Join(m.rootPath, nsName) - files, ioErr := os.ReadDir(certPath) - if ioErr == nil { - secrets := make(map[string][]byte, len(files)) - for _, file := range files { - var bytes []byte - - path := filepath.Join(certPath, file.Name()) - bytes, ioErr = os.ReadFile(path) - if ioErr == nil { - secrets[file.Name()] = bytes - } - } - // Return the (latest) error only if no secrets were found - if len(secrets) == 0 && ioErr != nil { - return nsName, nil, ioErr - } - return nsName, secrets, nil - } - secrets, err := m.k8sClient.GetSecrets(ctx, ns, secret.Name) - return nsName, secrets, err -} - -const ( - caDefaultName = "ca.crt" - publicDefaultName = "tls.crt" - privateDefaultName = "tls.key" -) - -// GetTLSContext returns a new ca, public and private certificates found based -// in the given api.TLSContext. -func (m *manager) GetTLSContext(ctx context.Context, tlsCtx *api.TLSContext, ns string) (ca, public, private string, err error) { - name, secrets, err := m.GetSecrets(ctx, tlsCtx.Secret, ns) - if err != nil { - return "", "", "", err - } - - caName := caDefaultName - if tlsCtx.TrustedCA != "" { - caName = tlsCtx.TrustedCA - } - caBytes, ok := secrets[caName] - if ok { - ca = string(caBytes) - } else if tlsCtx.TrustedCA != "" { - return "", "", "", fmt.Errorf("Trusted CA %s not found in secret %s", caName, name) - } - - publicName := publicDefaultName - if tlsCtx.Certificate != "" { - publicName = tlsCtx.Certificate - } - publicBytes, ok := secrets[publicName] - if ok { - public = string(publicBytes) - } else if tlsCtx.Certificate != "" { - return "", "", "", fmt.Errorf("Certificate %s not found in secret %s", publicName, name) - } - - privateName := privateDefaultName - if tlsCtx.PrivateKey != "" { - privateName = tlsCtx.PrivateKey - } - privateBytes, ok := secrets[privateName] - if ok { - private = string(privateBytes) - } else if tlsCtx.PrivateKey != "" { - return "", "", "", fmt.Errorf("Private Key %s not found in secret %s", privateName, name) - } - - if caBytes == nil && publicBytes == nil && privateBytes == nil { - return "", "", "", fmt.Errorf("TLS certificates not found in secret %s ", name) - } - - return ca, public, private, nil -} - -// GetSecretString returns a secret string stored in a k8s secret -func (m *manager) GetSecretString(ctx context.Context, secret *api.Secret, ns string) (string, error) { - name, secrets, err := m.GetSecrets(ctx, secret, ns) - if err != nil { - return "", err - } - - if len(secrets) == 1 { - // get the lone item by looping into the map - for _, value := range secrets { - return string(value), nil - } - } - return "", fmt.Errorf("Secret %s must have exactly one item", name) -} diff --git a/vendor/github.com/cilium/cilium/pkg/datapath/linux/config/defines/defines.go b/vendor/github.com/cilium/cilium/pkg/datapath/linux/config/defines/defines.go deleted file mode 100644 index ca5d5367e..000000000 --- a/vendor/github.com/cilium/cilium/pkg/datapath/linux/config/defines/defines.go +++ /dev/null @@ -1,52 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package defines - -import ( - "fmt" - - "github.com/cilium/hive/cell" -) - -// Map is the type containing the key-value pairs representing extra define -// directives for datapath node configuration. -type Map map[string]string - -func (m Map) Merge(other Map) error { - for key, value := range other { - if _, ok := m[key]; ok { - return fmt.Errorf("extra node define overwrites key %q", key) - } - - m[key] = value - } - return nil -} - -// NodeOut allows injecting configuration into the datapath. -type NodeOut struct { - cell.Out - NodeDefines Map `group:"header-node-defines"` -} - -// Fn is a function returning the key-value pairs representing extra define -// directives for datapath node configuration. -type Fn func() (Map, error) - -// NodeFnOut allows injecting configuration into the datapath -// by invoking a callback. -// -// Prefer using [NodeOut] if possible since it has a valid zero value. -type NodeFnOut struct { - cell.Out - // Fn must not be nil. - Fn `group:"header-node-define-fns"` -} - -// NewNodeFnOut wraps a function returning the key-value pairs representing -// extra define directives for datapath node configuration, so that it can be -// provided through the hive framework. -func NewNodeFnOut(fn Fn) NodeFnOut { - return NodeFnOut{Fn: fn} -} diff --git a/vendor/github.com/cilium/cilium/pkg/datapath/linux/probes/attach_cgroup.go b/vendor/github.com/cilium/cilium/pkg/datapath/linux/probes/attach_cgroup.go deleted file mode 100644 index 33ca88426..000000000 --- a/vendor/github.com/cilium/cilium/pkg/datapath/linux/probes/attach_cgroup.go +++ /dev/null @@ -1,69 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package probes - -import ( - "errors" - "fmt" - "sync" - - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/asm" - "github.com/cilium/ebpf/link" - "golang.org/x/sys/unix" -) - -// HaveAttachCgroup returns nil if the kernel is compiled with -// CONFIG_CGROUP_BPF. -// -// It's only an approximation and doesn't execute a successful cgroup attachment -// under the hood. If any unexpected errors are encountered, the original error -// is returned. -func HaveAttachCgroup() error { - attachCgroupOnce.Do(func() { - attachCgroupResult = haveAttachCgroup() - }) - - return attachCgroupResult -} - -func haveAttachCgroup() error { - // Load known-good program supported by the earliest kernels with cgroup - // support. - spec := &ebpf.ProgramSpec{ - Type: ebpf.CGroupSKB, - AttachType: ebpf.AttachCGroupInetIngress, - Instructions: asm.Instructions{ - asm.LoadImm(asm.R0, 0, asm.DWord), - asm.Return(), - }, - } - - p, err := ebpf.NewProgramWithOptions(spec, ebpf.ProgramOptions{ - LogDisabled: true, - }) - if err != nil { - return fmt.Errorf("create cgroup program: %w: %w", err, ebpf.ErrNotSupported) - } - defer p.Close() - - // Attaching to a non-cgroup node should result in EBADF when creating the - // link, compared to EINVAL if the kernel does not support or was compiled - // without CONFIG_CGROUP_BPF. - _, err = link.AttachCgroup(link.CgroupOptions{Path: "/dev/null", Program: p, Attach: spec.AttachType}) - if errors.Is(err, unix.EBADF) { - // The kernel checked the given file descriptor from within the cgroup prog - // attach handler. Assume it supports attaching cgroup progs. - return nil - } - if err != nil { - // Preserve the original error in the error string. Needs Go 1.20. - return fmt.Errorf("link cgroup program to /dev/null: %w: %w", err, ebpf.ErrNotSupported) - } - - return errors.New("attaching prog to /dev/null did not result in error") -} - -var attachCgroupOnce sync.Once -var attachCgroupResult error diff --git a/vendor/github.com/cilium/cilium/pkg/datapath/linux/probes/attach_type.go b/vendor/github.com/cilium/cilium/pkg/datapath/linux/probes/attach_type.go deleted file mode 100644 index 67ac02c8a..000000000 --- a/vendor/github.com/cilium/cilium/pkg/datapath/linux/probes/attach_type.go +++ /dev/null @@ -1,80 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package probes - -import ( - "errors" - - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/asm" - "github.com/cilium/ebpf/features" - "golang.org/x/sys/unix" - - "github.com/cilium/cilium/pkg/lock" -) - -// HaveAttachType returns nil if the given program/attach type combination is -// supported by the underlying kernel. Returns ebpf.ErrNotSupported if loading a -// program with the given Program/AttachType fails. If the probe is inconclusive -// due to an unrecognized return code, the original error is returned. -// -// Note that program types that don't use attach types will silently succeed if -// an attach type is specified. -// -// Probe results are cached by the package and shouldn't be memoized by the -// caller. -func HaveAttachType(pt ebpf.ProgramType, at ebpf.AttachType) (err error) { - if err := features.HaveProgramType(pt); err != nil { - return err - } - - attachProbesMu.Lock() - defer attachProbesMu.Unlock() - if err, ok := attachProbes[attachProbe{pt, at}]; ok { - return err - } - - defer func() { - // Closes over named return variable err to cache any returned errors. - attachProbes[attachProbe{pt, at}] = err - }() - - spec := &ebpf.ProgramSpec{ - Type: pt, - AttachType: at, - Instructions: asm.Instructions{ - // recvmsg and peername require a return value of 1, use it for all probes. - asm.LoadImm(asm.R0, 1, asm.DWord), - asm.Return(), - }, - } - - prog, err := ebpf.NewProgramWithOptions(spec, ebpf.ProgramOptions{ - LogDisabled: true, - }) - if err == nil { - prog.Close() - } - - // EINVAL occurs when attempting to create a program with an unknown type. - // E2BIG occurs when ProgLoadAttr contains non-zero bytes past the end - // of the struct known by the running kernel, meaning the kernel is too old - // to support the given prog type. - if errors.Is(err, unix.EINVAL) || errors.Is(err, unix.E2BIG) { - err = ebpf.ErrNotSupported - } - if err != nil { - return err - } - - return nil -} - -type attachProbe struct { - pt ebpf.ProgramType - at ebpf.AttachType -} - -var attachProbesMu lock.Mutex -var attachProbes map[attachProbe]error = make(map[attachProbe]error) diff --git a/vendor/github.com/cilium/cilium/pkg/datapath/linux/probes/doc.go b/vendor/github.com/cilium/cilium/pkg/datapath/linux/probes/doc.go deleted file mode 100644 index 285c8851d..000000000 --- a/vendor/github.com/cilium/cilium/pkg/datapath/linux/probes/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Package probes provides BPF features checks based on bpftool. -package probes diff --git a/vendor/github.com/cilium/cilium/pkg/datapath/linux/probes/kernel_hz.go b/vendor/github.com/cilium/cilium/pkg/datapath/linux/probes/kernel_hz.go deleted file mode 100644 index c815eb729..000000000 --- a/vendor/github.com/cilium/cilium/pkg/datapath/linux/probes/kernel_hz.go +++ /dev/null @@ -1,151 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package probes - -import ( - "bufio" - "errors" - "fmt" - "io" - "math" - "os" - "time" -) - -// Available CONFIG_HZ values, sorted from highest to lowest. -var hzValues = []uint16{1000, 300, 250, 100} - -// KernelHZ attempts to estimate the kernel's CONFIG_HZ compile-time value by -// making snapshots of the kernel timestamp with a time interval in between. -// -// Blocks for at least 100ms while the measurement is in progress. Can block -// significantly longer under some hypervisors like VirtualBox due to buggy -// clocks, interrupt coalescing and low timer resolution. -func KernelHZ() (uint16, error) { - f, err := os.Open("/proc/schedstat") - if err != nil { - return 0, err - } - defer f.Close() - - // Measure the kernel timestamp at least 100ms apart, giving kernel timer and - // wall clock ample opportunity to advance for adequate sample size. - j1, err := readSchedstat(f) - if err != nil { - return 0, err - } - - // On some platforms, this can put the goroutine to sleep for significantly - // longer than 100ms. Do not rely on readings being anywhere near 100ms apart. - time.Sleep(time.Millisecond * 100) - - j2, err := readSchedstat(f) - if err != nil { - return 0, err - } - - hz, err := j1.interpolate(j2) - if err != nil { - return 0, fmt.Errorf("interpolating hz value: %w", err) - } - - return nearest(hz, hzValues) -} - -// Jiffies returns the kernel's internal timestamp in jiffies read from -// /proc/schedstat. -func Jiffies() (uint64, error) { - f, err := os.Open("/proc/schedstat") - if err != nil { - return 0, err - } - defer f.Close() - - k, err := readSchedstat(f) - if err != nil { - return 0, err - } - - return k.k, nil -} - -// readSchedstat expects to read /proc/schedstat and returns the first line -// matching 'timestamp %d'. Upon return, f is rewound to allow reuse. -// -// Should not be called concurrently. -func readSchedstat(f io.ReadSeeker) (ktime, error) { - // Rewind the file when done so the next call gets fresh data. - defer func() { _, _ = f.Seek(0, 0) }() - - var j uint64 - var t = time.Now() - - s := bufio.NewScanner(f) - for s.Scan() { - if _, err := fmt.Sscanf(s.Text(), "timestamp %d", &j); err == nil { - return ktime{j, t}, nil - } - } - - return ktime{}, errors.New("no kernel timestamp found") -} - -type ktime struct { - k uint64 - t time.Time -} - -// interpolate returns the amount of jiffies (ktime) that would have elapsed if -// both ktimes were measured exactly 1 second apart. Using linear interpolation, -// the delta between both kernel timestamps is adjusted based on the elapsed -// wall time between both measurements. -func (old ktime) interpolate(new ktime) (uint16, error) { - if old.t.After(new.t) { - return 0, fmt.Errorf("old wall time %v is more recent than %v", old.t, new.t) - } - if old.k > new.k { - return 0, fmt.Errorf("old kernel timer %d is higher than %d", old.k, new.k) - } - - // Jiffy and duration delta. - kd := new.k - old.k - td := new.t.Sub(old.t) - - // Linear interpolation to represent elapsed jiffies as a per-second value. - hz := float64(kd) / td.Seconds() - hz = math.Round(hz) - if hz > math.MaxUint16 { - return 0, fmt.Errorf("interpolated hz value would overflow uint16: %f", hz) - } - - return uint16(hz), nil -} - -// nearest returns the entry from values that's closest to in. If in has an -// equal distance to multiple values, the value that appears the earliest in -// values wins. Returns error if values is empty. -func nearest(in uint16, values []uint16) (uint16, error) { - if len(values) == 0 { - return 0, errors.New("values cannot be empty") - } - - var out uint16 - min := ^uint16(0) - for _, v := range values { - // Get absolute distance between in and v. - d := uint16(in - v) - if in < v { - d = v - in - } - - // Check if the distance to the current number is smaller than to the - // previous number. - if d < min { - min = d - out = v - } - } - - return out, nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/datapath/linux/probes/managed_neighbors.go b/vendor/github.com/cilium/cilium/pkg/datapath/linux/probes/managed_neighbors.go deleted file mode 100644 index 596e30ab1..000000000 --- a/vendor/github.com/cilium/cilium/pkg/datapath/linux/probes/managed_neighbors.go +++ /dev/null @@ -1,93 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package probes - -import ( - "errors" - "fmt" - "net" - "sync" - - "github.com/vishvananda/netlink" - - "github.com/cilium/cilium/pkg/netns" -) - -var ( - managedNeighborOnce sync.Once - managedNeighborResult error -) - -// HaveManagedNeighbors returns nil if the host supports managed neighbor entries (NTF_EXT_MANAGED). -// On unexpected probe results this function will terminate with log.Fatal(). -func HaveManagedNeighbors() error { - managedNeighborOnce.Do(func() { - ns, err := netns.New() - if err != nil { - managedNeighborResult = fmt.Errorf("create netns: %w", err) - return - } - defer ns.Close() - - // In order to call haveManagedNeighbors safely, it has to be started - // in a standalone netns - managedNeighborResult = ns.Do(func() error { - return haveManagedNeighbors() - }) - - // if we encounter a different error than ErrNotSupported, terminate the agent. - if managedNeighborResult != nil && !errors.Is(managedNeighborResult, ErrNotSupported) { - log.WithError(managedNeighborResult).Fatal("failed to probe managed neighbor support") - } - }) - - return managedNeighborResult -} - -func haveManagedNeighbors() (outer error) { - // Use a veth device instead of a dummy to avoid the kernel having to modprobe - // the dummy kmod, which could potentially be compiled out. veth is currently - // a hard dependency for Cilium, so safe to assume the module is available if - // not already loaded. - veth := &netlink.Veth{ - LinkAttrs: netlink.LinkAttrs{Name: "veth0"}, - PeerName: "veth1", - } - - if err := netlink.LinkAdd(veth); err != nil { - return fmt.Errorf("failed to add dummy veth: %w", err) - } - - neigh := netlink.Neigh{ - LinkIndex: veth.Index, - IP: net.IPv4(0, 0, 0, 1), - Flags: NTF_EXT_LEARNED, - FlagsExt: NTF_EXT_MANAGED, - } - - if err := netlink.NeighAdd(&neigh); err != nil { - return fmt.Errorf("failed to add neighbor: %w", err) - } - - nl, err := netlink.NeighList(veth.Index, 0) - if err != nil { - return fmt.Errorf("failed to list neighbors: %w", err) - } - - for _, n := range nl { - if !n.IP.Equal(neigh.IP) { - continue - } - if n.Flags != NTF_EXT_LEARNED { - continue - } - if n.FlagsExt != NTF_EXT_MANAGED { - continue - } - - return nil - } - - return ErrNotSupported -} diff --git a/vendor/github.com/cilium/cilium/pkg/datapath/linux/probes/probes.go b/vendor/github.com/cilium/cilium/pkg/datapath/linux/probes/probes.go deleted file mode 100644 index 603440711..000000000 --- a/vendor/github.com/cilium/cilium/pkg/datapath/linux/probes/probes.go +++ /dev/null @@ -1,778 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package probes - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - "io" - "net" - "os" - "path/filepath" - "strings" - "sync" - "text/template" - - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/asm" - "github.com/cilium/ebpf/features" - "github.com/cilium/ebpf/link" - "github.com/google/gopacket" - "github.com/google/gopacket/layers" - "golang.org/x/sys/unix" - - "github.com/cilium/cilium/pkg/command/exec" - "github.com/cilium/cilium/pkg/defaults" - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/netns" -) - -var ( - log = logging.DefaultLogger.WithField(logfields.LogSubsys, "probes") - once sync.Once - probeManager *ProbeManager - tpl = template.New("headerfile") -) - -func init() { - const content = ` -/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ -/* Copyright Authors of Cilium */ - -/* THIS FILE WAS GENERATED DURING AGENT STARTUP. */ - -#pragma once - -{{- if not .Common}} -#include "features.h" -{{- end}} - -{{- range $key, $value := .Features}} -{{- if $value}} -#define {{$key}} 1 -{{end}} -{{- end}} -` - var err error - tpl, err = tpl.Parse(content) - if err != nil { - log.WithError(err).Fatal("could not parse headerfile template") - } -} - -// ErrNotSupported indicates that a feature is not supported by the current kernel. -var ErrNotSupported = errors.New("not supported") - -// KernelParam is a type based on string which represents CONFIG_* kernel -// parameters which usually have values "y", "n" or "m". -type KernelParam string - -// Enabled checks whether the kernel parameter is enabled. -func (kp KernelParam) Enabled() bool { - return kp == "y" -} - -// Module checks whether the kernel parameter is enabled as a module. -func (kp KernelParam) Module() bool { - return kp == "m" -} - -// kernelOption holds information about kernel parameters to probe. -type kernelOption struct { - Description string - Enabled bool - CanBeModule bool -} - -type ProgramHelper struct { - Program ebpf.ProgramType - Helper asm.BuiltinFunc -} - -type miscFeatures struct { - HaveFibIfindex bool -} - -type FeatureProbes struct { - ProgramHelpers map[ProgramHelper]bool - Misc miscFeatures -} - -// SystemConfig contains kernel configuration and sysctl parameters related to -// BPF functionality. -type SystemConfig struct { - UnprivilegedBpfDisabled int `json:"unprivileged_bpf_disabled"` - BpfJitEnable int `json:"bpf_jit_enable"` - BpfJitHarden int `json:"bpf_jit_harden"` - BpfJitKallsyms int `json:"bpf_jit_kallsyms"` - BpfJitLimit int `json:"bpf_jit_limit"` - ConfigBpf KernelParam `json:"CONFIG_BPF"` - ConfigBpfSyscall KernelParam `json:"CONFIG_BPF_SYSCALL"` - ConfigHaveEbpfJit KernelParam `json:"CONFIG_HAVE_EBPF_JIT"` - ConfigBpfJit KernelParam `json:"CONFIG_BPF_JIT"` - ConfigBpfJitAlwaysOn KernelParam `json:"CONFIG_BPF_JIT_ALWAYS_ON"` - ConfigCgroups KernelParam `json:"CONFIG_CGROUPS"` - ConfigCgroupBpf KernelParam `json:"CONFIG_CGROUP_BPF"` - ConfigCgroupNetClassID KernelParam `json:"CONFIG_CGROUP_NET_CLASSID"` - ConfigSockCgroupData KernelParam `json:"CONFIG_SOCK_CGROUP_DATA"` - ConfigBpfEvents KernelParam `json:"CONFIG_BPF_EVENTS"` - ConfigKprobeEvents KernelParam `json:"CONFIG_KPROBE_EVENTS"` - ConfigUprobeEvents KernelParam `json:"CONFIG_UPROBE_EVENTS"` - ConfigTracing KernelParam `json:"CONFIG_TRACING"` - ConfigFtraceSyscalls KernelParam `json:"CONFIG_FTRACE_SYSCALLS"` - ConfigFunctionErrorInjection KernelParam `json:"CONFIG_FUNCTION_ERROR_INJECTION"` - ConfigBpfKprobeOverride KernelParam `json:"CONFIG_BPF_KPROBE_OVERRIDE"` - ConfigNet KernelParam `json:"CONFIG_NET"` - ConfigXdpSockets KernelParam `json:"CONFIG_XDP_SOCKETS"` - ConfigLwtunnelBpf KernelParam `json:"CONFIG_LWTUNNEL_BPF"` - ConfigNetActBpf KernelParam `json:"CONFIG_NET_ACT_BPF"` - ConfigNetClsBpf KernelParam `json:"CONFIG_NET_CLS_BPF"` - ConfigNetClsAct KernelParam `json:"CONFIG_NET_CLS_ACT"` - ConfigNetSchIngress KernelParam `json:"CONFIG_NET_SCH_INGRESS"` - ConfigXfrm KernelParam `json:"CONFIG_XFRM"` - ConfigIPRouteClassID KernelParam `json:"CONFIG_IP_ROUTE_CLASSID"` - ConfigIPv6Seg6Bpf KernelParam `json:"CONFIG_IPV6_SEG6_BPF"` - ConfigBpfLircMode2 KernelParam `json:"CONFIG_BPF_LIRC_MODE2"` - ConfigBpfStreamParser KernelParam `json:"CONFIG_BPF_STREAM_PARSER"` - ConfigNetfilterXtMatchBpf KernelParam `json:"CONFIG_NETFILTER_XT_MATCH_BPF"` - ConfigBpfilter KernelParam `json:"CONFIG_BPFILTER"` - ConfigBpfilterUmh KernelParam `json:"CONFIG_BPFILTER_UMH"` - ConfigTestBpf KernelParam `json:"CONFIG_TEST_BPF"` - ConfigKernelHz KernelParam `json:"CONFIG_HZ"` -} - -// MapTypes contains bools indicating which types of BPF maps the currently -// running kernel supports. -type MapTypes struct { - HaveHashMapType bool `json:"have_hash_map_type"` - HaveArrayMapType bool `json:"have_array_map_type"` - HaveProgArrayMapType bool `json:"have_prog_array_map_type"` - HavePerfEventArrayMapType bool `json:"have_perf_event_array_map_type"` - HavePercpuHashMapType bool `json:"have_percpu_hash_map_type"` - HavePercpuArrayMapType bool `json:"have_percpu_array_map_type"` - HaveStackTraceMapType bool `json:"have_stack_trace_map_type"` - HaveCgroupArrayMapType bool `json:"have_cgroup_array_map_type"` - HaveLruHashMapType bool `json:"have_lru_hash_map_type"` - HaveLruPercpuHashMapType bool `json:"have_lru_percpu_hash_map_type"` - HaveLpmTrieMapType bool `json:"have_lpm_trie_map_type"` - HaveArrayOfMapsMapType bool `json:"have_array_of_maps_map_type"` - HaveHashOfMapsMapType bool `json:"have_hash_of_maps_map_type"` - HaveDevmapMapType bool `json:"have_devmap_map_type"` - HaveSockmapMapType bool `json:"have_sockmap_map_type"` - HaveCpumapMapType bool `json:"have_cpumap_map_type"` - HaveXskmapMapType bool `json:"have_xskmap_map_type"` - HaveSockhashMapType bool `json:"have_sockhash_map_type"` - HaveCgroupStorageMapType bool `json:"have_cgroup_storage_map_type"` - HaveReuseportSockarrayMapType bool `json:"have_reuseport_sockarray_map_type"` - HavePercpuCgroupStorageMapType bool `json:"have_percpu_cgroup_storage_map_type"` - HaveQueueMapType bool `json:"have_queue_map_type"` - HaveStackMapType bool `json:"have_stack_map_type"` -} - -// Features contains BPF feature checks returned by bpftool. -type Features struct { - SystemConfig `json:"system_config"` - MapTypes `json:"map_types"` -} - -// ProbeManager is a manager of BPF feature checks. -type ProbeManager struct { - features Features -} - -// NewProbeManager returns a new instance of ProbeManager - a manager of BPF -// feature checks. -func NewProbeManager() *ProbeManager { - newProbeManager := func() { - probeManager = &ProbeManager{} - probeManager.features = probeManager.Probe() - } - once.Do(newProbeManager) - return probeManager -} - -// Probe probes the underlying kernel for features. -func (*ProbeManager) Probe() Features { - var features Features - out, err := exec.WithTimeout( - defaults.ExecTimeout, - "bpftool", "-j", "feature", "probe", - ).CombinedOutput(log, true) - if err != nil { - log.WithError(err).Fatal("could not run bpftool") - } - if err := json.Unmarshal(out, &features); err != nil { - log.WithError(err).Fatal("could not parse bpftool output") - } - return features -} - -// SystemConfigProbes performs a check of kernel configuration parameters. It -// returns an error when parameters required by Cilium are not enabled. It logs -// warnings when optional parameters are not enabled. -// -// When kernel config file is not found, bpftool can't probe kernel configuration -// parameter real setting, so only return error log when kernel config file exists -// and kernel configuration parameter setting is disabled -func (p *ProbeManager) SystemConfigProbes() error { - var notFound bool - if !p.KernelConfigAvailable() { - notFound = true - log.Info("Kernel config file not found: if the agent fails to start, check the system requirements at https://docs.cilium.io/en/stable/operations/system_requirements") - } - requiredParams := p.GetRequiredConfig() - for param, kernelOption := range requiredParams { - if !kernelOption.Enabled && !notFound { - module := "" - if kernelOption.CanBeModule { - module = " or module" - } - return fmt.Errorf("%s kernel parameter%s is required (needed for: %s)", param, module, kernelOption.Description) - } - } - optionalParams := p.GetOptionalConfig() - for param, kernelOption := range optionalParams { - if !kernelOption.Enabled && !notFound { - module := "" - if kernelOption.CanBeModule { - module = " or module" - } - log.Warningf("%s optional kernel parameter%s is not in kernel (needed for: %s)", param, module, kernelOption.Description) - } - } - return nil -} - -// GetRequiredConfig performs a check of mandatory kernel configuration options. It -// returns a map indicating which required kernel parameters are enabled - and which are not. -// GetRequiredConfig is being used by CLI "cilium kernel-check". -func (p *ProbeManager) GetRequiredConfig() map[KernelParam]kernelOption { - config := p.features.SystemConfig - coreInfraDescription := "Essential eBPF infrastructure" - kernelParams := make(map[KernelParam]kernelOption) - - kernelParams["CONFIG_BPF"] = kernelOption{ - Enabled: config.ConfigBpf.Enabled(), - Description: coreInfraDescription, - CanBeModule: false, - } - kernelParams["CONFIG_BPF_SYSCALL"] = kernelOption{ - Enabled: config.ConfigBpfSyscall.Enabled(), - Description: coreInfraDescription, - CanBeModule: false, - } - kernelParams["CONFIG_NET_SCH_INGRESS"] = kernelOption{ - Enabled: config.ConfigNetSchIngress.Enabled() || config.ConfigNetSchIngress.Module(), - Description: coreInfraDescription, - CanBeModule: true, - } - kernelParams["CONFIG_NET_CLS_BPF"] = kernelOption{ - Enabled: config.ConfigNetClsBpf.Enabled() || config.ConfigNetClsBpf.Module(), - Description: coreInfraDescription, - CanBeModule: true, - } - kernelParams["CONFIG_NET_CLS_ACT"] = kernelOption{ - Enabled: config.ConfigNetClsAct.Enabled(), - Description: coreInfraDescription, - CanBeModule: false, - } - kernelParams["CONFIG_BPF_JIT"] = kernelOption{ - Enabled: config.ConfigBpfJit.Enabled(), - Description: coreInfraDescription, - CanBeModule: false, - } - kernelParams["CONFIG_HAVE_EBPF_JIT"] = kernelOption{ - Enabled: config.ConfigHaveEbpfJit.Enabled(), - Description: coreInfraDescription, - CanBeModule: false, - } - - return kernelParams -} - -// GetOptionalConfig performs a check of *optional* kernel configuration options. It -// returns a map indicating which optional/non-mandatory kernel parameters are enabled. -// GetOptionalConfig is being used by CLI "cilium kernel-check". -func (p *ProbeManager) GetOptionalConfig() map[KernelParam]kernelOption { - config := p.features.SystemConfig - kernelParams := make(map[KernelParam]kernelOption) - - kernelParams["CONFIG_CGROUP_BPF"] = kernelOption{ - Enabled: config.ConfigCgroupBpf.Enabled(), - Description: "Host Reachable Services and Sockmap optimization", - CanBeModule: false, - } - kernelParams["CONFIG_LWTUNNEL_BPF"] = kernelOption{ - Enabled: config.ConfigLwtunnelBpf.Enabled(), - Description: "Lightweight Tunnel hook for IP-in-IP encapsulation", - CanBeModule: false, - } - kernelParams["CONFIG_BPF_EVENTS"] = kernelOption{ - Enabled: config.ConfigBpfEvents.Enabled(), - Description: "Visibility and congestion management with datapath", - CanBeModule: false, - } - - return kernelParams -} - -// KernelConfigAvailable checks if the Kernel Config is available on the -// system or not. -func (p *ProbeManager) KernelConfigAvailable() bool { - // Check Kernel Config is available or not. - // We are replicating BPFTools logic here to check if kernel config is available - // https://elixir.bootlin.com/linux/v5.7/source/tools/bpf/bpftool/feature.c#L390 - info := unix.Utsname{} - err := unix.Uname(&info) - if err != nil { - return false - } - release := strings.TrimSpace(string(bytes.Trim(info.Release[:], "\x00"))) - - // Any error checking these files will return Kernel config not found error - if _, err := os.Stat(fmt.Sprintf("/boot/config-%s", release)); err != nil { - if _, err = os.Stat("/proc/config.gz"); err != nil { - return false - } - } - - return true -} - -// HaveProgramHelper is a wrapper around features.HaveProgramHelper() to -// check if a certain BPF program/helper copmbination is supported by the kernel. -// On unexpected probe results this function will terminate with log.Fatal(). -func HaveProgramHelper(pt ebpf.ProgramType, helper asm.BuiltinFunc) error { - err := features.HaveProgramHelper(pt, helper) - if errors.Is(err, ebpf.ErrNotSupported) { - return err - } - if err != nil { - log.WithError(err).WithField("programtype", pt).WithField("helper", helper).Fatal("failed to probe helper") - } - return nil -} - -// HaveLargeInstructionLimit is a wrapper around features.HaveLargeInstructions() -// to check if the kernel supports the 1 Million instruction limit. -// On unexpected probe results this function will terminate with log.Fatal(). -func HaveLargeInstructionLimit() error { - err := features.HaveLargeInstructions() - if errors.Is(err, ebpf.ErrNotSupported) { - return err - } - if err != nil { - log.WithError(err).Fatal("failed to probe large instruction limit") - } - return nil -} - -// HaveBoundedLoops is a wrapper around features.HaveBoundedLoops() -// to check if the kernel supports bounded loops in BPF programs. -// On unexpected probe results this function will terminate with log.Fatal(). -func HaveBoundedLoops() error { - err := features.HaveBoundedLoops() - if errors.Is(err, ebpf.ErrNotSupported) { - return err - } - if err != nil { - log.WithError(err).Fatal("failed to probe bounded loops") - } - return nil -} - -// HaveFibIfindex checks if kernel has d1c362e1dd68 ("bpf: Always return target -// ifindex in bpf_fib_lookup") which is 5.10+. This got merged in the same kernel -// as the new redirect helpers. -func HaveFibIfindex() error { - return features.HaveProgramHelper(ebpf.SchedCLS, asm.FnRedirectPeer) -} - -// HaveV2ISA is a wrapper around features.HaveV2ISA() to check if the kernel -// supports the V2 ISA. -// On unexpected probe results this function will terminate with log.Fatal(). -func HaveV2ISA() error { - err := features.HaveV2ISA() - if errors.Is(err, ebpf.ErrNotSupported) { - return err - } - if err != nil { - log.WithError(err).Fatal("failed to probe V2 ISA") - } - return nil -} - -// HaveV3ISA is a wrapper around features.HaveV3ISA() to check if the kernel -// supports the V3 ISA. -// On unexpected probe results this function will terminate with log.Fatal(). -func HaveV3ISA() error { - err := features.HaveV3ISA() - if errors.Is(err, ebpf.ErrNotSupported) { - return err - } - if err != nil { - log.WithError(err).Fatal("failed to probe V3 ISA") - } - return nil -} - -// HaveTCX returns nil if the running kernel supports attaching bpf programs to -// tcx hooks. -var HaveTCX = sync.OnceValue(func() error { - prog, err := ebpf.NewProgram(&ebpf.ProgramSpec{ - Type: ebpf.SchedCLS, - Instructions: asm.Instructions{ - asm.Mov.Imm(asm.R0, 0), - asm.Return(), - }, - License: "Apache-2.0", - }) - if err != nil { - return err - } - defer prog.Close() - - ns, err := netns.New() - if err != nil { - return fmt.Errorf("create netns: %w", err) - } - defer ns.Close() - - // link.AttachTCX already performs its own feature detection and returns - // ebpf.ErrNotSupported if the host kernel doesn't have tcx. - return ns.Do(func() error { - l, err := link.AttachTCX(link.TCXOptions{ - Program: prog, - Attach: ebpf.AttachTCXIngress, - Interface: 1, // lo - Anchor: link.Tail(), - }) - if err != nil { - return fmt.Errorf("creating link: %w", err) - } - if err := l.Close(); err != nil { - return fmt.Errorf("closing link: %w", err) - } - - return nil - }) -}) - -// HaveOuterSourceIPSupport tests whether the kernel support setting the outer -// source IP address via the bpf_skb_set_tunnel_key BPF helper. We can't rely -// on the verifier to reject a program using the new support because the -// verifier just accepts any argument size for that helper; non-supported -// fields will simply not be used. Instead, we set the outer source IP and -// retrieve it with bpf_skb_get_tunnel_key right after. If the retrieved value -// equals the value set, we have a confirmation the kernel supports it. -func HaveOuterSourceIPSupport() (err error) { - defer func() { - if err != nil && !errors.Is(err, ebpf.ErrNotSupported) { - log.WithError(err).Fatal("failed to probe for outer source IP support") - } - }() - - progSpec := &ebpf.ProgramSpec{ - Name: "set_tunnel_key_probe", - Type: ebpf.SchedACT, - License: "GPL", - } - progSpec.Instructions = asm.Instructions{ - asm.Mov.Reg(asm.R8, asm.R1), - - asm.Mov.Imm(asm.R2, 0), - asm.StoreMem(asm.RFP, -8, asm.R2, asm.DWord), - asm.StoreMem(asm.RFP, -16, asm.R2, asm.DWord), - asm.StoreMem(asm.RFP, -24, asm.R2, asm.DWord), - asm.StoreMem(asm.RFP, -32, asm.R2, asm.DWord), - asm.StoreMem(asm.RFP, -40, asm.R2, asm.DWord), - asm.Mov.Imm(asm.R2, 42), - asm.StoreMem(asm.RFP, -44, asm.R2, asm.Word), - asm.Mov.Reg(asm.R2, asm.RFP), - asm.Add.Imm(asm.R2, -44), - asm.Mov.Imm(asm.R3, 44), // sizeof(struct bpf_tunnel_key) when setting the outer source IP is supported. - asm.Mov.Imm(asm.R4, 0), - asm.FnSkbSetTunnelKey.Call(), - - asm.Mov.Reg(asm.R1, asm.R8), - asm.Mov.Reg(asm.R2, asm.RFP), - asm.Add.Imm(asm.R2, -44), - asm.Mov.Imm(asm.R3, 44), - asm.Mov.Imm(asm.R4, 0), - asm.FnSkbGetTunnelKey.Call(), - - asm.LoadMem(asm.R0, asm.RFP, -44, asm.Word), - asm.Return(), - } - prog, err := ebpf.NewProgram(progSpec) - if err != nil { - return err - } - defer prog.Close() - - pkt := []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - ret, _, err := prog.Test(pkt) - if err != nil { - return err - } - if ret != 42 { - return ebpf.ErrNotSupported - } - return nil -} - -// HaveSKBAdjustRoomL2RoomMACSupport tests whether the kernel supports the `bpf_skb_adjust_room` helper -// with the `BPF_ADJ_ROOM_MAC` mode. To do so, we create a program that requests the passed in SKB -// to be expanded by 20 bytes. The helper checks the `mode` argument and will return -ENOSUPP if -// the mode is unknown. Otherwise it should resize the SKB by 20 bytes and return 0. -func HaveSKBAdjustRoomL2RoomMACSupport() (err error) { - defer func() { - if err != nil && !errors.Is(err, ebpf.ErrNotSupported) { - log.WithError(err).Fatal("failed to probe for bpf_skb_adjust_room L2 room MAC support") - } - }() - - progSpec := &ebpf.ProgramSpec{ - Name: "adjust_mac_room", - Type: ebpf.SchedCLS, - License: "GPL", - } - progSpec.Instructions = asm.Instructions{ - asm.Mov.Imm(asm.R2, 20), // len_diff - asm.Mov.Imm(asm.R3, 1), // mode: BPF_ADJ_ROOM_MAC - asm.Mov.Imm(asm.R4, 0), // flags: 0 - asm.FnSkbAdjustRoom.Call(), - asm.Return(), - } - prog, err := ebpf.NewProgram(progSpec) - if err != nil { - return err - } - defer prog.Close() - - // This is a Eth + IPv4 + UDP + data packet. The helper relies on a valid packet being passed in - // since it wants to know offsets of the different layers. - buf := gopacket.NewSerializeBuffer() - err = gopacket.SerializeLayers(buf, gopacket.SerializeOptions{}, - &layers.Ethernet{ - DstMAC: net.HardwareAddr{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - SrcMAC: net.HardwareAddr{0x0e, 0xf5, 0x16, 0x3d, 0x6b, 0xab}, - EthernetType: layers.EthernetTypeIPv4, - }, - &layers.IPv4{ - Version: 4, - IHL: 5, - Length: 49, - Id: 0xCECB, - TTL: 64, - Protocol: layers.IPProtocolUDP, - SrcIP: net.IPv4(0xc0, 0xa8, 0xb2, 0x56), - DstIP: net.IPv4(0xc0, 0xa8, 0xb2, 0xff), - }, - &layers.UDP{ - SrcPort: 23939, - DstPort: 32412, - }, - gopacket.Payload("M-SEARCH * HTTP/1.1\x0d\x0a"), - ) - if err != nil { - return fmt.Errorf("craft packet: %w", err) - } - - ret, _, err := prog.Test(buf.Bytes()) - if err != nil { - return err - } - if ret != 0 { - return ebpf.ErrNotSupported - } - return nil -} - -// HaveDeadCodeElim tests whether the kernel supports dead code elimination. -func HaveDeadCodeElim() error { - spec := ebpf.ProgramSpec{ - Name: "test", - Type: ebpf.XDP, - Instructions: asm.Instructions{ - asm.Mov.Imm(asm.R1, 0), - asm.JEq.Imm(asm.R1, 1, "else"), - asm.Mov.Imm(asm.R0, 2), - asm.Ja.Label("end"), - asm.Mov.Imm(asm.R0, 3).WithSymbol("else"), - asm.Return().WithSymbol("end"), - }, - } - - prog, err := ebpf.NewProgram(&spec) - if err != nil { - return fmt.Errorf("loading program: %w", err) - } - - info, err := prog.Info() - if err != nil { - return fmt.Errorf("get prog info: %w", err) - } - infoInst, err := info.Instructions() - if err != nil { - return fmt.Errorf("get instructions: %w", err) - } - - for _, inst := range infoInst { - if inst.OpCode.Class().IsJump() && inst.OpCode.JumpOp() != asm.Exit { - return fmt.Errorf("Jump instruction found in the final program, no dead code elimination performed") - } - } - - return nil -} - -// HaveIPv6Support tests whether kernel can open an IPv6 socket. This will -// also implicitly auto-load IPv6 kernel module if available and not yet -// loaded. -func HaveIPv6Support() error { - fd, err := unix.Socket(unix.AF_INET6, unix.SOCK_STREAM, 0) - if errors.Is(err, unix.EAFNOSUPPORT) || errors.Is(err, unix.EPROTONOSUPPORT) { - return ErrNotSupported - } - unix.Close(fd) - return nil -} - -// CreateHeaderFiles creates C header files with macros indicating which BPF -// features are available in the kernel. -func CreateHeaderFiles(headerDir string, probes *FeatureProbes) error { - common, err := os.Create(filepath.Join(headerDir, "features.h")) - if err != nil { - return fmt.Errorf("could not create common features header file: %w", err) - } - defer common.Close() - if err := writeCommonHeader(common, probes); err != nil { - return fmt.Errorf("could not write common features header file: %w", err) - } - - skb, err := os.Create(filepath.Join(headerDir, "features_skb.h")) - if err != nil { - return fmt.Errorf("could not create skb related features header file: %w", err) - } - defer skb.Close() - if err := writeSkbHeader(skb, probes); err != nil { - return fmt.Errorf("could not write skb related features header file: %w", err) - } - - xdp, err := os.Create(filepath.Join(headerDir, "features_xdp.h")) - if err != nil { - return fmt.Errorf("could not create xdp related features header file: %w", err) - } - defer xdp.Close() - if err := writeXdpHeader(xdp, probes); err != nil { - return fmt.Errorf("could not write xdp related features header file: %w", err) - } - - return nil -} - -// ExecuteHeaderProbes probes the kernel for a specific set of BPF features -// which are currently used to generate various feature macros for the datapath. -// The probe results returned in FeatureProbes are then used in the respective -// function that writes the actual C macro definitions. -// Further needed probes should be added here, while new macro strings need to -// be added in the correct `write*Header()` function. -func ExecuteHeaderProbes() *FeatureProbes { - probes := FeatureProbes{ - ProgramHelpers: make(map[ProgramHelper]bool), - Misc: miscFeatures{}, - } - - progHelpers := []ProgramHelper{ - // common probes - {ebpf.CGroupSock, asm.FnGetNetnsCookie}, - {ebpf.CGroupSockAddr, asm.FnGetNetnsCookie}, - {ebpf.CGroupSockAddr, asm.FnGetSocketCookie}, - {ebpf.CGroupSock, asm.FnJiffies64}, - {ebpf.CGroupSockAddr, asm.FnJiffies64}, - {ebpf.SchedCLS, asm.FnJiffies64}, - {ebpf.XDP, asm.FnJiffies64}, - {ebpf.CGroupSockAddr, asm.FnSkLookupTcp}, - {ebpf.CGroupSockAddr, asm.FnSkLookupUdp}, - {ebpf.CGroupSockAddr, asm.FnGetCurrentCgroupId}, - {ebpf.CGroupSock, asm.FnSetRetval}, - {ebpf.SchedCLS, asm.FnRedirectNeigh}, - {ebpf.SchedCLS, asm.FnRedirectPeer}, - - // skb related probes - {ebpf.SchedCLS, asm.FnSkbChangeTail}, - {ebpf.SchedCLS, asm.FnCsumLevel}, - - // xdp related probes - {ebpf.XDP, asm.FnXdpGetBuffLen}, - {ebpf.XDP, asm.FnXdpLoadBytes}, - {ebpf.XDP, asm.FnXdpStoreBytes}, - } - for _, ph := range progHelpers { - probes.ProgramHelpers[ph] = (HaveProgramHelper(ph.Program, ph.Helper) == nil) - } - - probes.Misc.HaveFibIfindex = (HaveFibIfindex() == nil) - - return &probes -} - -// writeCommonHeader defines macross for bpf/include/bpf/features.h -func writeCommonHeader(writer io.Writer, probes *FeatureProbes) error { - features := map[string]bool{ - "HAVE_NETNS_COOKIE": probes.ProgramHelpers[ProgramHelper{ebpf.CGroupSock, asm.FnGetNetnsCookie}] && - probes.ProgramHelpers[ProgramHelper{ebpf.CGroupSockAddr, asm.FnGetNetnsCookie}], - "HAVE_SOCKET_COOKIE": probes.ProgramHelpers[ProgramHelper{ebpf.CGroupSockAddr, asm.FnGetSocketCookie}], - "HAVE_JIFFIES": probes.ProgramHelpers[ProgramHelper{ebpf.CGroupSock, asm.FnJiffies64}] && - probes.ProgramHelpers[ProgramHelper{ebpf.CGroupSockAddr, asm.FnJiffies64}] && - probes.ProgramHelpers[ProgramHelper{ebpf.SchedCLS, asm.FnJiffies64}] && - probes.ProgramHelpers[ProgramHelper{ebpf.XDP, asm.FnJiffies64}], - "HAVE_CGROUP_ID": probes.ProgramHelpers[ProgramHelper{ebpf.CGroupSockAddr, asm.FnGetCurrentCgroupId}], - "HAVE_SET_RETVAL": probes.ProgramHelpers[ProgramHelper{ebpf.CGroupSock, asm.FnSetRetval}], - "HAVE_FIB_NEIGH": probes.ProgramHelpers[ProgramHelper{ebpf.SchedCLS, asm.FnRedirectNeigh}], - "HAVE_FIB_IFINDEX": probes.Misc.HaveFibIfindex, - } - - return writeFeatureHeader(writer, features, true) -} - -// writeSkbHeader defines macros for bpf/include/bpf/features_skb.h -func writeSkbHeader(writer io.Writer, probes *FeatureProbes) error { - featuresSkb := map[string]bool{ - "HAVE_CSUM_LEVEL": probes.ProgramHelpers[ProgramHelper{ebpf.SchedCLS, asm.FnCsumLevel}], - } - - return writeFeatureHeader(writer, featuresSkb, false) -} - -// writeXdpHeader defines macros for bpf/include/bpf/features_xdp.h -func writeXdpHeader(writer io.Writer, probes *FeatureProbes) error { - featuresXdp := map[string]bool{ - "HAVE_XDP_GET_BUFF_LEN": probes.ProgramHelpers[ProgramHelper{ebpf.XDP, asm.FnXdpGetBuffLen}], - "HAVE_XDP_LOAD_BYTES": probes.ProgramHelpers[ProgramHelper{ebpf.XDP, asm.FnXdpLoadBytes}], - "HAVE_XDP_STORE_BYTES": probes.ProgramHelpers[ProgramHelper{ebpf.XDP, asm.FnXdpStoreBytes}], - } - - return writeFeatureHeader(writer, featuresXdp, false) -} - -func writeFeatureHeader(writer io.Writer, features map[string]bool, common bool) error { - input := struct { - Common bool - Features map[string]bool - }{ - Common: common, - Features: features, - } - - if err := tpl.Execute(writer, input); err != nil { - return fmt.Errorf("could not write template: %w", err) - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/datapath/linux/probes/probes_linux.go b/vendor/github.com/cilium/cilium/pkg/datapath/linux/probes/probes_linux.go deleted file mode 100644 index 846e9c28e..000000000 --- a/vendor/github.com/cilium/cilium/pkg/datapath/linux/probes/probes_linux.go +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package probes - -import "github.com/vishvananda/netlink" - -// Family type definitions -const ( - NTF_EXT_LEARNED = netlink.NTF_EXT_LEARNED - NTF_EXT_MANAGED = netlink.NTF_EXT_MANAGED -) diff --git a/vendor/github.com/cilium/cilium/pkg/datapath/linux/probes/probes_unspecified.go b/vendor/github.com/cilium/cilium/pkg/datapath/linux/probes/probes_unspecified.go deleted file mode 100644 index f92efd499..000000000 --- a/vendor/github.com/cilium/cilium/pkg/datapath/linux/probes/probes_unspecified.go +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -//go:build !linux - -package probes - -// Dummy values on non-linux platform -const ( - NTF_EXT_LEARNED = iota - NTF_EXT_MANAGED -) diff --git a/vendor/github.com/cilium/cilium/pkg/datapath/loader/metrics/metrics.go b/vendor/github.com/cilium/cilium/pkg/datapath/loader/metrics/metrics.go deleted file mode 100644 index 4896dc830..000000000 --- a/vendor/github.com/cilium/cilium/pkg/datapath/loader/metrics/metrics.go +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package metrics - -import ( - "github.com/cilium/cilium/pkg/spanstat" -) - -// SpanStat is a statistics structure for storing metrics related to datapath -// load operations. -type SpanStat struct { - BpfCompilation spanstat.SpanStat - BpfWaitForELF spanstat.SpanStat - BpfWriteELF spanstat.SpanStat - BpfLoadProg spanstat.SpanStat -} - -// GetMap returns a map of statistic names to stats -func (s *SpanStat) GetMap() map[string]*spanstat.SpanStat { - return map[string]*spanstat.SpanStat{ - "bpfCompilation": &s.BpfCompilation, - "bpfWaitForELF": &s.BpfWaitForELF, - "bpfWriteELF": &s.BpfWriteELF, - "bpfLoadProg": &s.BpfLoadProg, - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/datapath/tunnel/cell.go b/vendor/github.com/cilium/cilium/pkg/datapath/tunnel/cell.go deleted file mode 100644 index 17bcd5324..000000000 --- a/vendor/github.com/cilium/cilium/pkg/datapath/tunnel/cell.go +++ /dev/null @@ -1,53 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package tunnel - -import ( - "github.com/cilium/hive/cell" - - "github.com/cilium/cilium/pkg/defaults" - "github.com/cilium/cilium/pkg/option" -) - -// Cell is a cell that provides the parameters for the Cilium tunnel, -// based on user configuration and requests from external modules. -var Cell = cell.Module( - "datapath-tunnel-config", - "Tunneling configurations", - - cell.Config(userCfg{TunnelProtocol: defaults.TunnelProtocol}), - - cell.Provide( - newConfig, - - // Provide the datapath options. - Config.datapathConfigProvider, - - // Enable tunnel configuration when it is the primary routing mode. - func(dcfg *option.DaemonConfig) EnablerOut { - return NewEnabler(dcfg.TunnelingEnabled()) - }, - - // Enable tunnel configuration when DSR Geneve is enabled (this is currently - // handled here, as the corresponding logic has not yet been modularized). - func(dcfg *option.DaemonConfig) EnablerOut { - return NewEnabler( - (dcfg.EnableNodePort || - dcfg.KubeProxyReplacement == option.KubeProxyReplacementTrue) && - dcfg.LoadBalancerUsesDSR() && - dcfg.LoadBalancerDSRDispatch == option.DSRDispatchGeneve, - // The datapath logic takes care of the MTU overhead. So no need to - // take it into account here. - // See encap_geneve_dsr_opt[4,6] in nodeport.h - WithoutMTUAdaptation(), - ) - }, - - // Enable tunnel configuration when High Scale IPCache is enabled (this is - // currently handled here, as the corresponding logic has not yet been modularized). - func(dcfg *option.DaemonConfig) EnablerOut { - return NewEnabler(dcfg.EnableHighScaleIPcache) - }, - ), -) diff --git a/vendor/github.com/cilium/cilium/pkg/datapath/tunnel/tunnel.go b/vendor/github.com/cilium/cilium/pkg/datapath/tunnel/tunnel.go deleted file mode 100644 index d925d55de..000000000 --- a/vendor/github.com/cilium/cilium/pkg/datapath/tunnel/tunnel.go +++ /dev/null @@ -1,221 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package tunnel - -import ( - "fmt" - "strings" - - "github.com/cilium/hive/cell" - "github.com/spf13/pflag" - "github.com/vishvananda/netlink" - - dpcfgdef "github.com/cilium/cilium/pkg/datapath/linux/config/defines" - "github.com/cilium/cilium/pkg/defaults" -) - -// Protocol represents the valid types of encapsulation protocols. -type Protocol string - -const ( - // VXLAN specifies VXLAN encapsulation - VXLAN Protocol = "vxlan" - - // Geneve specifies Geneve encapsulation - Geneve Protocol = "geneve" - - // Disabled specifies to disable encapsulation - Disabled Protocol = "" -) - -func (tp Protocol) String() string { return string(tp) } - -func (tp Protocol) toDpID() string { - switch tp { - case VXLAN: - return "1" - case Geneve: - return "2" - default: - return "" - } -} - -// Config represents the materialized tunneling configuration to be used, -// depending on the user configuration and optional overrides required by -// additional features. -type Config struct { - protocol Protocol - port uint16 - deviceName string - shouldAdaptMTU bool -} - -type newConfigIn struct { - cell.In - - Cfg userCfg - Enablers []enabler `group:"request-enable-tunneling"` -} - -func newConfig(in newConfigIn) (Config, error) { - switch Protocol(in.Cfg.TunnelProtocol) { - case VXLAN, Geneve: - default: - return Config{}, fmt.Errorf("invalid tunnel protocol %q", in.Cfg.TunnelProtocol) - } - - cfg := Config{ - protocol: Protocol(in.Cfg.TunnelProtocol), - port: in.Cfg.TunnelPort, - } - - var enabled bool - for _, e := range in.Enablers { - if e.enable { - enabled = true - cfg.shouldAdaptMTU = cfg.shouldAdaptMTU || e.needsMTUAdaptation - - for _, validator := range e.validators { - if err := validator(cfg.protocol); err != nil { - return Config{}, err - } - } - } - } - - if !enabled { - return Config{protocol: Disabled}, nil - } - - switch cfg.protocol { - case VXLAN: - cfg.deviceName = defaults.VxlanDevice - - if cfg.port == 0 { - cfg.port = defaults.TunnelPortVXLAN - } - case Geneve: - cfg.deviceName = defaults.GeneveDevice - - if cfg.port == 0 { - cfg.port = defaults.TunnelPortGeneve - } - } - - return cfg, nil -} - -// NewTestConfig returns a new TunnelConfig for testing purposes. -func NewTestConfig(proto Protocol) Config { - cfg := Config{protocol: proto} - - switch proto { - case VXLAN: - cfg.port = defaults.TunnelPortVXLAN - cfg.deviceName = defaults.VxlanDevice - case Geneve: - cfg.port = defaults.TunnelPortGeneve - cfg.deviceName = defaults.GeneveDevice - } - - return cfg -} - -// Protocol returns the enabled tunnel protocol. The tunnel protocol may be -// set to either VXLAN or Geneve even when the primary mode is native routing, in -// case an additional feature (e.g., egress gateway) may request some traffic to -// be routed through a tunnel. -func (cfg Config) Protocol() Protocol { return cfg.protocol } - -// Port returns the port used by the tunnel (0 if disabled). -func (cfg Config) Port() uint16 { return cfg.port } - -// DeviceName returns the name of the tunnel device (empty if disabled). -func (cfg Config) DeviceName() string { return cfg.deviceName } - -// ShouldAdaptMTU returns whether we should adapt the MTU calculation to -// account for encapsulation. -func (cfg Config) ShouldAdaptMTU() bool { return cfg.shouldAdaptMTU } - -func (cfg Config) datapathConfigProvider() (dpcfgdef.NodeOut, dpcfgdef.NodeFnOut) { - defines := make(dpcfgdef.Map) - definesFn := func() (dpcfgdef.Map, error) { return nil, nil } - - if cfg.Protocol() != Disabled { - defines[fmt.Sprintf("TUNNEL_PROTOCOL_%s", strings.ToUpper(VXLAN.String()))] = VXLAN.toDpID() - defines[fmt.Sprintf("TUNNEL_PROTOCOL_%s", strings.ToUpper(Geneve.String()))] = Geneve.toDpID() - defines["TUNNEL_PROTOCOL"] = cfg.Protocol().toDpID() - defines["TUNNEL_PORT"] = fmt.Sprintf("%d", cfg.Port()) - - definesFn = func() (dpcfgdef.Map, error) { - tunnelDev, err := netlink.LinkByName(cfg.DeviceName()) - if err != nil { - return nil, fmt.Errorf("failed to retrieve device info for %q: %w", cfg.DeviceName(), err) - } - - return dpcfgdef.Map{ - "ENCAP_IFINDEX": fmt.Sprintf("%d", tunnelDev.Attrs().Index), - }, nil - } - } - - return dpcfgdef.NodeOut{NodeDefines: defines}, dpcfgdef.NewNodeFnOut(definesFn) -} - -// EnablerOut allows requesting to enable tunneling functionalities. -type EnablerOut struct { - cell.Out - Enabler enabler `group:"request-enable-tunneling"` -} - -// NewEnabler returns an object to be injected through hive to request to -// enable tunneling functionalities. Extra options are meaningful only when -// enable is set to true, and are ignored otherwise. -func NewEnabler(enable bool, opts ...enablerOpt) EnablerOut { - enabler := enabler{enable: enable, needsMTUAdaptation: enable} - - for _, opt := range opts { - opt(&enabler) - } - - return EnablerOut{Enabler: enabler} -} - -// WithValidator allows to register extra validation functions -// to assert that the configured tunnel protocol matches the one expected by -// the given feature. -func WithValidator(validator func(Protocol) error) enablerOpt { - return func(te *enabler) { - te.validators = append(te.validators, validator) - } -} - -// WithoutMTUAdaptation conveys that the given feature request -// to enable tunneling, but the MTU adaptation is already handled externally. -func WithoutMTUAdaptation() enablerOpt { - return func(te *enabler) { - te.needsMTUAdaptation = false - } -} - -type enabler struct { - enable bool - needsMTUAdaptation bool - validators []func(Protocol) error -} - -type enablerOpt func(*enabler) - -// userCfg wraps the tunnel-related user configurations. -type userCfg struct { - TunnelProtocol string - TunnelPort uint16 -} - -// Flags implements the cell.Flagger interface, to register the given flags. -func (def userCfg) Flags(flags *pflag.FlagSet) { - flags.String("tunnel-protocol", def.TunnelProtocol, "Encapsulation protocol to use for the overlay (\"vxlan\" or \"geneve\")") - flags.Uint16("tunnel-port", def.TunnelPort, fmt.Sprintf("Tunnel port (default %d for \"vxlan\" and %d for \"geneve\")", defaults.TunnelPortVXLAN, defaults.TunnelPortGeneve)) -} diff --git a/vendor/github.com/cilium/cilium/pkg/datapath/types/bandwidth.go b/vendor/github.com/cilium/cilium/pkg/datapath/types/bandwidth.go deleted file mode 100644 index cb9c2e4b3..000000000 --- a/vendor/github.com/cilium/cilium/pkg/datapath/types/bandwidth.go +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package types - -type BandwidthManager interface { - BBREnabled() bool - DeleteEndpointBandwidthLimit(epID uint16) error - Enabled() bool -} diff --git a/vendor/github.com/cilium/cilium/pkg/datapath/types/config.go b/vendor/github.com/cilium/cilium/pkg/datapath/types/config.go deleted file mode 100644 index ca6328fa6..000000000 --- a/vendor/github.com/cilium/cilium/pkg/datapath/types/config.go +++ /dev/null @@ -1,138 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package types - -import ( - "io" - "net/netip" - - "github.com/cilium/cilium/pkg/cidr" - "github.com/cilium/cilium/pkg/identity" - "github.com/cilium/cilium/pkg/mac" - "github.com/cilium/cilium/pkg/node" - nodeTypes "github.com/cilium/cilium/pkg/node/types" - "github.com/cilium/cilium/pkg/option" -) - -// NodeNeighborEnqueuer provides an interface for clients to push node updates -// for further processing. -type NodeNeighborEnqueuer interface { - // Enqueue enqueues a node for processing node neighbors updates. - Enqueue(*nodeTypes.Node, bool) -} - -// DeviceConfiguration is an interface for injecting configuration of datapath -// options that affect lookups and logic applied at a per-device level, whether -// those are devices associated with the endpoint or associated with the host. -type DeviceConfiguration interface { - // GetOptions fetches the configurable datapath options from the owner. - GetOptions() *option.IntOptions -} - -// LoadTimeConfiguration provides datapath implementations a clean interface -// to access endpoint-specific configuration that can be changed at load time. -type LoadTimeConfiguration interface { - // GetID returns a locally-significant endpoint identification number. - GetID() uint64 - // StringID returns the string-formatted version of the ID from GetID(). - StringID() string - // GetIdentity returns a globally-significant numeric security identity. - GetIdentity() identity.NumericIdentity - - // GetIdentityLocked returns a globally-significant numeric security - // identity while assuming that the backing data structure is locked. - // This function should be removed in favour of GetIdentity() - GetIdentityLocked() identity.NumericIdentity - - IPv4Address() netip.Addr - IPv6Address() netip.Addr - GetNodeMAC() mac.MAC -} - -// CompileTimeConfiguration provides datapath implementations a clean interface -// to access endpoint-specific configuration that can only be changed at -// compile time. -type CompileTimeConfiguration interface { - DeviceConfiguration - - // TODO: Move this detail into the datapath - ConntrackLocalLocked() bool - - // RequireARPPassthrough returns true if the datapath must implement - // ARP passthrough for this endpoint - RequireARPPassthrough() bool - - // RequireEgressProg returns true if the endpoint requires an egress - // program attached to the InterfaceName() invoking the section - // "to-container" - RequireEgressProg() bool - - // RequireRouting returns true if the endpoint requires BPF routing to - // be enabled, when disabled, routing is delegated to Linux routing - RequireRouting() bool - - // RequireEndpointRoute returns true if the endpoint wishes to have a - // per endpoint route installed in the host's routing table to point to - // the endpoint's interface - RequireEndpointRoute() bool - - // GetPolicyVerdictLogFilter returns the PolicyVerdictLogFilter for the endpoint - GetPolicyVerdictLogFilter() uint32 - - // IsHost returns true if the endpoint is the host endpoint. - IsHost() bool -} - -// EndpointConfiguration provides datapath implementations a clean interface -// to access endpoint-specific configuration when configuring the datapath. -type EndpointConfiguration interface { - CompileTimeConfiguration - LoadTimeConfiguration -} - -// ConfigWriter is anything which writes the configuration for various datapath -// program types. -type ConfigWriter interface { - // WriteNodeConfig writes the implementation-specific configuration of - // node-wide options into the specified writer. - WriteNodeConfig(io.Writer, *LocalNodeConfiguration) error - - // WriteNetdevConfig writes the implementation-specific configuration - // of configurable options to the specified writer. Options specified - // here will apply to base programs and not to endpoints, though - // endpoints may have equivalent configurable options. - WriteNetdevConfig(io.Writer, *option.IntOptions) error - - // WriteTemplateConfig writes the implementation-specific configuration - // of configurable options for BPF templates to the specified writer. - WriteTemplateConfig(w io.Writer, cfg EndpointConfiguration) error - - // WriteEndpointConfig writes the implementation-specific configuration - // of configurable options for the endpoint to the specified writer. - WriteEndpointConfig(w io.Writer, cfg EndpointConfiguration) error -} - -// RemoteSNATDstAddrExclusionCIDRv4 returns a CIDR for SNAT exclusion. Any -// packet sent from a local endpoint to an IP address belonging to the CIDR -// should not be SNAT'd. -func RemoteSNATDstAddrExclusionCIDRv4() *cidr.CIDR { - if c := option.Config.GetIPv4NativeRoutingCIDR(); c != nil { - // ipv4-native-routing-cidr is set, so use it - return c - } - - return node.GetIPv4AllocRange() -} - -// RemoteSNATDstAddrExclusionCIDRv6 returns a IPv6 CIDR for SNAT exclusion. Any -// packet sent from a local endpoint to an IP address belonging to the CIDR -// should not be SNAT'd. -func RemoteSNATDstAddrExclusionCIDRv6() *cidr.CIDR { - if c := option.Config.GetIPv6NativeRoutingCIDR(); c != nil { - // ipv6-native-routing-cidr is set, so use it - return c - } - - return node.GetIPv6AllocRange() -} diff --git a/vendor/github.com/cilium/cilium/pkg/datapath/types/datapath.go b/vendor/github.com/cilium/cilium/pkg/datapath/types/datapath.go deleted file mode 100644 index 16d852328..000000000 --- a/vendor/github.com/cilium/cilium/pkg/datapath/types/datapath.go +++ /dev/null @@ -1,37 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package types - -// Datapath is the interface to abstract all datapath interactions. The -// abstraction allows to implement the datapath requirements with multiple -// implementations -type Datapath interface { - ConfigWriter - IptablesManager - - // Node must return the handler for node events - Node() NodeHandler - - NodeIDs() NodeIDHandler - - NodeNeighbors() NodeNeighbors - - // LocalNodeAddressing must return the node addressing implementation - // of the local node - LocalNodeAddressing() NodeAddressing - - // Loader must return the implementation of the loader, which is responsible - // for loading, reloading, and compiling datapath programs. - Loader() Loader - - // WireguardAgent returns the WireGuard agent for the local node - WireguardAgent() WireguardAgent - - // LBMap returns the load-balancer map - LBMap() LBMap - - BandwidthManager() BandwidthManager - - Orchestrator() Orchestrator -} diff --git a/vendor/github.com/cilium/cilium/pkg/datapath/types/endpoint.go b/vendor/github.com/cilium/cilium/pkg/datapath/types/endpoint.go deleted file mode 100644 index df3bc01aa..000000000 --- a/vendor/github.com/cilium/cilium/pkg/datapath/types/endpoint.go +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package types - -import "github.com/sirupsen/logrus" - -// Endpoint provides access endpoint configuration information that is necessary -// to compile and load the datapath. -type Endpoint interface { - EndpointConfiguration - InterfaceName() string - Logger(subsystem string) *logrus.Entry - StateDir() string -} diff --git a/vendor/github.com/cilium/cilium/pkg/datapath/types/ipsec.go b/vendor/github.com/cilium/cilium/pkg/datapath/types/ipsec.go deleted file mode 100644 index a62f7800a..000000000 --- a/vendor/github.com/cilium/cilium/pkg/datapath/types/ipsec.go +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package types - -type IPsecKeyCustodian interface { - AuthKeySize() int - SPI() uint8 - StartBackgroundJobs(NodeHandler) error -} diff --git a/vendor/github.com/cilium/cilium/pkg/datapath/types/lbmap.go b/vendor/github.com/cilium/cilium/pkg/datapath/types/lbmap.go deleted file mode 100644 index 955876e8d..000000000 --- a/vendor/github.com/cilium/cilium/pkg/datapath/types/lbmap.go +++ /dev/null @@ -1,109 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package types - -import ( - "net" - "sort" - - "github.com/cilium/cilium/pkg/cidr" - "github.com/cilium/cilium/pkg/loadbalancer" -) - -// LBMap is the interface describing methods for manipulating service maps. -type LBMap interface { - UpsertService(*UpsertServiceParams) error - UpsertMaglevLookupTable(uint16, map[string]*loadbalancer.Backend, bool) error - IsMaglevLookupTableRecreated(bool) bool - DeleteService(loadbalancer.L3n4AddrID, int, bool, loadbalancer.SVCNatPolicy) error - AddBackend(*loadbalancer.Backend, bool) error - UpdateBackendWithState(*loadbalancer.Backend) error - DeleteBackendByID(loadbalancer.BackendID) error - AddAffinityMatch(uint16, loadbalancer.BackendID) error - DeleteAffinityMatch(uint16, loadbalancer.BackendID) error - UpdateSourceRanges(uint16, []*cidr.CIDR, []*cidr.CIDR, bool) error - DumpServiceMaps() ([]*loadbalancer.SVC, []error) - DumpBackendMaps() ([]*loadbalancer.Backend, error) - DumpAffinityMatches() (BackendIDByServiceIDSet, error) - DumpSourceRanges(bool) (SourceRangeSetByServiceID, error) - ExistsSockRevNat(cookie uint64, addr net.IP, port uint16) bool -} - -type UpsertServiceParams struct { - ID uint16 - IP net.IP - Port uint16 - - // PreferredBackends is a subset of ActiveBackends - // Note: this is only used in clustermesh with service affinity annotation. - PreferredBackends map[string]*loadbalancer.Backend - ActiveBackends map[string]*loadbalancer.Backend - NonActiveBackends []loadbalancer.BackendID - PrevBackendsCount int - IPv6 bool - Type loadbalancer.SVCType - NatPolicy loadbalancer.SVCNatPolicy - ExtLocal bool - IntLocal bool - Scope uint8 - SessionAffinity bool - SessionAffinityTimeoutSec uint32 - CheckSourceRange bool - UseMaglev bool - L7LBProxyPort uint16 // Non-zero for L7 LB services - Name loadbalancer.ServiceName // Fully qualified name of the service - LoopbackHostport bool -} - -// GetOrderedBackends returns an ordered list of backends with all the sorted -// preferred backend followed by active and non-active backends. -// Encapsulates logic to be also used in unit tests. -func (p *UpsertServiceParams) GetOrderedBackends() []loadbalancer.BackendID { - backendIDs := make([]loadbalancer.BackendID, 0, len(p.ActiveBackends)+len(p.NonActiveBackends)) - for _, b := range p.ActiveBackends { - backendIDs = append(backendIDs, b.ID) - } - - preferredMap := map[loadbalancer.BackendID]struct{}{} - for _, b := range p.PreferredBackends { - preferredMap[b.ID] = struct{}{} - } - - // Map iterations are non-deterministic so sort the backends by their IDs - // in order to maintain the same order before they are populated in BPF maps. - // This will minimize disruption to existing connections to the backends in the datapath. - sort.Slice(backendIDs, func(i, j int) bool { - // compare preferred flags of two backend IDs - _, firstPreferred := preferredMap[backendIDs[i]] - _, secondPreferred := preferredMap[backendIDs[j]] - - if firstPreferred && secondPreferred { - return backendIDs[i] < backendIDs[j] - } - - if firstPreferred { - return true - } - - if secondPreferred { - return false - } - - return backendIDs[i] < backendIDs[j] - }) - - // Add the non-active backends to the end of preferred/active backends list so that they are - // not considered while selecting backends to load-balance service traffic. - if len(p.NonActiveBackends) > 0 { - backendIDs = append(backendIDs, p.NonActiveBackends...) - } - - return backendIDs -} - -// BackendIDByServiceIDSet is the type of a set for checking whether a backend -// belongs to a given service -type BackendIDByServiceIDSet map[uint16]map[loadbalancer.BackendID]struct{} // svc ID => backend ID - -type SourceRangeSetByServiceID map[uint16][]*cidr.CIDR // svc ID => src range CIDRs diff --git a/vendor/github.com/cilium/cilium/pkg/datapath/types/loader.go b/vendor/github.com/cilium/cilium/pkg/datapath/types/loader.go deleted file mode 100644 index 9ed113964..000000000 --- a/vendor/github.com/cilium/cilium/pkg/datapath/types/loader.go +++ /dev/null @@ -1,87 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package types - -import ( - "context" - "io" - "net" - "net/netip" - - "github.com/cilium/cilium/pkg/datapath/loader/metrics" - "github.com/cilium/cilium/pkg/datapath/tunnel" -) - -// Loader is an interface to abstract out loading of datapath programs. -type Loader interface { - CallsMapPath(id uint16) string - CustomCallsMapPath(id uint16) string - CompileOrLoad(ctx context.Context, ep Endpoint, stats *metrics.SpanStat) error - ReloadDatapath(ctx context.Context, ep Endpoint, stats *metrics.SpanStat) error - ReinitializeXDP(ctx context.Context, extraCArgs []string) error - EndpointHash(cfg EndpointConfiguration) (string, error) - Unload(ep Endpoint) - Reinitialize(ctx context.Context, tunnelConfig tunnel.Config, deviceMTU int, iptMgr IptablesManager, p Proxy) error - HostDatapathInitialized() <-chan struct{} - RestoreTemplates(stateDir string) error -} - -// PreFilter an interface for an XDP pre-filter. -type PreFilter interface { - Enabled() bool - WriteConfig(fw io.Writer) - Dump(to []string) ([]string, int64) - Insert(revision int64, cidrs []net.IPNet) error - Delete(revision int64, cidrs []net.IPNet) error -} - -// Proxy is any type which installs rules related to redirecting traffic to -// a proxy. -type Proxy interface { - ReinstallRoutingRules() error -} - -// IptablesManager manages iptables rules. -type IptablesManager interface { - // InstallProxyRules creates the necessary datapath config (e.g., iptables - // rules for redirecting host proxy traffic on a specific ProxyPort) - InstallProxyRules(proxyPort uint16, localOnly bool, name string) - - // SupportsOriginalSourceAddr tells if the datapath supports - // use of original source addresses in proxy upstream - // connections. - SupportsOriginalSourceAddr() bool - - // GetProxyPort fetches the existing proxy port configured for the - // specified listener. Used early in bootstrap to reopen proxy ports. - GetProxyPort(listener string) uint16 - - // InstallNoTrackRules is explicitly called when a pod has valid - // "policy.cilium.io/no-track-port" annotation. When - // InstallNoConntrackIptRules flag is set, a super set of v4 NOTRACK - // rules will be automatically installed upon agent bootstrap (via - // function addNoTrackPodTrafficRules) and this function will be - // skipped. When InstallNoConntrackIptRules is not set, this function - // will be executed to install NOTRACK rules. The rules installed by - // this function is very specific, for now, the only user is - // node-local-dns pods. - InstallNoTrackRules(ip netip.Addr, port uint16) - - // See comments for InstallNoTrackRules. - RemoveNoTrackRules(ip netip.Addr, port uint16) -} - -// CompilationLock is a interface over a mutex, it is used by both the loader, daemon -// and endpoint manager to lock the compilation process. This is a bit of a layer violation -// since certain methods on the loader such as CompileAndLoad and CompileOrLoad expect the -// lock to be taken before being called. -// -// Once we have moved header file generation from the endpoint manager into the loader, we can -// remove this interface and have the loader manage the lock internally. -type CompilationLock interface { - Lock() - Unlock() - RLock() - RUnlock() -} diff --git a/vendor/github.com/cilium/cilium/pkg/datapath/types/node.go b/vendor/github.com/cilium/cilium/pkg/datapath/types/node.go deleted file mode 100644 index fbe81acb9..000000000 --- a/vendor/github.com/cilium/cilium/pkg/datapath/types/node.go +++ /dev/null @@ -1,163 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package types - -import ( - "context" - "net" - - "github.com/cilium/cilium/api/v1/models" - "github.com/cilium/cilium/pkg/cidr" - nodeTypes "github.com/cilium/cilium/pkg/node/types" -) - -type MTUConfiguration interface { - GetDeviceMTU() int - GetRouteMTU() int - GetRoutePostEncryptMTU() int -} - -// LocalNodeConfiguration represents the configuration of the local node -type LocalNodeConfiguration struct { - // MtuConfig is the MTU configuration of the node. - // - // This field is immutable at runtime. The value will not change in - // subsequent calls to NodeConfigurationChanged(). - MtuConfig MTUConfiguration - - // AuxiliaryPrefixes is the list of auxiliary prefixes that should be - // configured in addition to the node PodCIDR - // - // This field is mutable. The implementation of - // NodeConfigurationChanged() must adjust the routes accordingly. - AuxiliaryPrefixes []*cidr.CIDR - - // EnableIPv4 enables use of IPv4. Routing to the IPv4 allocation CIDR - // of other nodes must be enabled. - // - // This field is immutable at runtime. The value will not change in - // subsequent calls to NodeConfigurationChanged(). - EnableIPv4 bool - - // EnableIPv6 enables use of IPv6. Routing to the IPv6 allocation CIDR - // of other nodes must be enabled. - // - // This field is immutable at runtime. The value will not change in - // subsequent calls to NodeConfigurationChanged(). - EnableIPv6 bool - - // EnableEncapsulation enables use of encapsulation in communication - // between nodes. - // - // This field is immutable at runtime. The value will not change in - // subsequent calls to NodeConfigurationChanged(). - EnableEncapsulation bool - - // EnableAutoDirectRouting enables the use of direct routes for - // communication between nodes if two nodes have direct L2 - // connectivity. - // - // EnableAutoDirectRouting must be compatible with EnableEncapsulation - // and must provide a fallback to use encapsulation if direct routing - // is not feasible and encapsulation is enabled. - // - // This field is immutable at runtime. The value will not change in - // subsequent calls to NodeConfigurationChanged(). - EnableAutoDirectRouting bool - - // EnableLocalNodeRoute enables installation of the route which points - // the allocation prefix of the local node. Disabling this option is - // useful when another component is responsible for the routing of the - // allocation CIDR IPs into Cilium endpoints. - EnableLocalNodeRoute bool - - // EnableIPSec enables IPSec routes - EnableIPSec bool - - // EncryptNode enables encrypting NodeIP traffic requires EnableIPSec - EncryptNode bool - - // IPv4PodSubnets is a list of IPv4 subnets that pod IPs are assigned from - // these are then used when encryption is enabled to configure the node - // for encryption over these subnets at node initialization. - IPv4PodSubnets []*net.IPNet - - // IPv6PodSubnets is a list of IPv6 subnets that pod IPs are assigned from - // these are then used when encryption is enabled to configure the node - // for encryption over these subnets at node initialization. - IPv6PodSubnets []*net.IPNet -} - -// NodeHandler handles node related events such as addition, update or deletion -// of nodes or changes to the local node configuration. -// -// Node events apply to the local node as well as to remote nodes. The -// implementation can differ between the own local node and remote nodes by -// calling node.IsLocal(). -type NodeHandler interface { - // Name identifies the handler, this is used in logging/reporting handler - // reconciliation errors. - Name() string - - // NodeAdd is called when a node is discovered for the first time. - NodeAdd(newNode nodeTypes.Node) error - - // NodeUpdate is called when a node definition changes. Both the old - // and new node definition is provided. NodeUpdate() is never called - // before NodeAdd() is called for a particular node. - NodeUpdate(oldNode, newNode nodeTypes.Node) error - - // NodeDelete is called after a node has been deleted - NodeDelete(node nodeTypes.Node) error - - // AllNodeValidateImplementation is called to validate the implementation - // of all nodes in the node cache. - AllNodeValidateImplementation() - - // NodeValidateImplementation is called to validate the implementation of - // the node in the datapath. This function is intended to be run on an - // interval to ensure that the datapath is consistently converged. - NodeValidateImplementation(node nodeTypes.Node) error - - // NodeConfigurationChanged is called when the local node configuration - // has changed - NodeConfigurationChanged(config LocalNodeConfiguration) error -} - -type NodeNeighbors interface { - // NodeNeighDiscoveryEnabled returns whether node neighbor discovery is enabled - NodeNeighDiscoveryEnabled() bool - - // NodeNeighborRefresh is called to refresh node neighbor table - NodeNeighborRefresh(ctx context.Context, node nodeTypes.Node, refresh bool) error - - // NodeCleanNeighbors cleans all neighbor entries for the direct routing device - // and the encrypt interface. - NodeCleanNeighbors(migrateOnly bool) - - // InsertMiscNeighbor inserts a neighbor entry for the address passed via newNode. - // This is needed for in-agent users where neighbors outside the cluster need to - // be added, for example, for external service backends. - InsertMiscNeighbor(newNode *nodeTypes.Node) - - // DeleteMiscNeighbor delets a eighbor entry for the address passed via oldNode. - // This is needed to delete the entries which have been inserted at an earlier - // point in time through InsertMiscNeighbor. - DeleteMiscNeighbor(oldNode *nodeTypes.Node) -} - -type NodeIDHandler interface { - // GetNodeIP returns the string node IP that was previously registered as the given node ID. - GetNodeIP(uint16) string - - // GetNodeID gets the node ID for the given node IP. If none is found, exists is false. - GetNodeID(nodeIP net.IP) (nodeID uint16, exists bool) - - // DumpNodeIDs returns all node IDs and their associated IP addresses. - DumpNodeIDs() []*models.NodeID - - // RestoreNodeIDs restores node IDs and their associated IP addresses from the - // BPF map and into the node handler in-memory copy. - RestoreNodeIDs() -} diff --git a/vendor/github.com/cilium/cilium/pkg/datapath/types/node_addressing.go b/vendor/github.com/cilium/cilium/pkg/datapath/types/node_addressing.go deleted file mode 100644 index 4582958b3..000000000 --- a/vendor/github.com/cilium/cilium/pkg/datapath/types/node_addressing.go +++ /dev/null @@ -1,44 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package types - -import ( - "net" - - "github.com/cilium/cilium/pkg/cidr" -) - -// NodeAddressingFamily is the node addressing information for a particular -// address family -type NodeAddressingFamily interface { - // Router is the address that will act as the router on each node where - // an agent is running on. Endpoints have a default route that points - // to this address. - Router() net.IP - - // PrimaryExternal is the primary external address of the node. Nodes - // must be able to reach each other via this address. - PrimaryExternal() net.IP - - // AllocationCIDR is the CIDR used for IP allocation of all endpoints - // on the node - AllocationCIDR() *cidr.CIDR - - // LocalAddresses lists all local addresses - LocalAddresses() ([]net.IP, error) - - // LoadBalancerNodeAddresses lists all addresses on which HostPort and - // NodePort services should be responded to - LoadBalancerNodeAddresses() []net.IP - - // DirectRouting returns the interface index and IP address for - // direct routing. - DirectRouting() (int, net.IP, bool) -} - -// NodeAddressing implements addressing of a node -type NodeAddressing interface { - IPv6() NodeAddressingFamily - IPv4() NodeAddressingFamily -} diff --git a/vendor/github.com/cilium/cilium/pkg/datapath/types/orchestrator.go b/vendor/github.com/cilium/cilium/pkg/datapath/types/orchestrator.go deleted file mode 100644 index 8300683ff..000000000 --- a/vendor/github.com/cilium/cilium/pkg/datapath/types/orchestrator.go +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package types - -import ( - "context" -) - -type Orchestrator interface { - Reinitialize(ctx context.Context) error -} diff --git a/vendor/github.com/cilium/cilium/pkg/datapath/types/wireguard.go b/vendor/github.com/cilium/cilium/pkg/datapath/types/wireguard.go deleted file mode 100644 index 46aa3ca2d..000000000 --- a/vendor/github.com/cilium/cilium/pkg/datapath/types/wireguard.go +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package types - -import ( - "net" - - "github.com/cilium/cilium/api/v1/models" -) - -// WireguardAgent manages the WireGuard peers -type WireguardAgent interface { - UpdatePeer(nodeName, pubKeyHex string, nodeIPv4, nodeIPv6 net.IP) error - DeletePeer(nodeName string) error - Status(includePeers bool) (*models.WireguardStatus, error) -} diff --git a/vendor/github.com/cilium/cilium/pkg/debug/subsystem.go b/vendor/github.com/cilium/cilium/pkg/debug/subsystem.go deleted file mode 100644 index 62162e364..000000000 --- a/vendor/github.com/cilium/cilium/pkg/debug/subsystem.go +++ /dev/null @@ -1,94 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package debug - -import ( - "fmt" - - "github.com/cilium/cilium/pkg/lock" -) - -// StatusFunc is a function returning the debug status of a subsytem. It is -// passed into RegisterStatusFunc(). -type StatusFunc func() string - -// StatusMap is the collection of debug status of all subsystems. The key is -// the subsystem name. The value is the subsystem debug status. -type StatusMap map[string]string - -// StatusObject is the interface an object must impelement to be able to be -// passed into RegisterStatusObject(). -type StatusObject interface { - // DebugStatus() is the equivalent of StatusFunc. It must return the - // debug status as a string. - DebugStatus() string -} - -type functionMap map[string]StatusFunc - -type statusFunctions struct { - functions functionMap - mutex lock.RWMutex -} - -func newStatusFunctions() statusFunctions { - return statusFunctions{ - functions: functionMap{}, - } -} - -func (s *statusFunctions) register(name string, fn StatusFunc) error { - s.mutex.Lock() - defer s.mutex.Unlock() - - if _, ok := s.functions[name]; ok { - return fmt.Errorf("subsystem already registered") - } - - s.functions[name] = fn - - return nil -} - -func (s *statusFunctions) registerStatusObject(name string, obj StatusObject) error { - return s.register(name, func() string { return obj.DebugStatus() }) -} - -func (s *statusFunctions) collectStatus() StatusMap { - fnCopy := functionMap{} - - // Make a copy to not hold the mutex while collecting the status - s.mutex.RLock() - for name, fn := range s.functions { - fnCopy[name] = fn - } - s.mutex.RUnlock() - - status := StatusMap{} - - for name, fn := range fnCopy { - status[name] = fn() - } - - return status -} - -var globalStatusFunctions = newStatusFunctions() - -// RegisterStatusFunc registers a subsystem and associates a status function to -// call for debug status collection -func RegisterStatusFunc(name string, fn StatusFunc) error { - return globalStatusFunctions.register(name, fn) -} - -// RegisterStatusObject registers a subsystem and associated a status object on -// which DebugStatus() is called to collect debug status -func RegisterStatusObject(name string, obj StatusObject) error { - return globalStatusFunctions.registerStatusObject(name, obj) -} - -// CollectSubsystemStatus collects the status of all subsystems and returns it -func CollectSubsystemStatus() StatusMap { - return globalStatusFunctions.collectStatus() -} diff --git a/vendor/github.com/cilium/cilium/pkg/defaults/defaults.go b/vendor/github.com/cilium/cilium/pkg/defaults/defaults.go index a8aebdb97..01781eb50 100644 --- a/vendor/github.com/cilium/cilium/pkg/defaults/defaults.go +++ b/vendor/github.com/cilium/cilium/pkg/defaults/defaults.go @@ -56,8 +56,9 @@ const ( // TemplatesDir is the default path for the compiled template objects relative to StateDir TemplatesDir = "templates" - // TemplatePath is the default path for a symlink to a template relative to StateDir/ - TemplatePath = "template.o" + // TemplateIDPath is the name of a file which contains the ID (aka hash) of + // the template used by the endpoint. + TemplateIDPath = "template.txt" // BpfDir is the default path for template files relative to LibDir BpfDir = "bpf" @@ -180,13 +181,25 @@ const ( // DNSProxyEnableTransparentMode enables transparent mode for the DNS proxy. DNSProxyEnableTransparentMode = false + // DNSProxyLockCount is the default array size containing mutexes which protect + // against parallel handling of DNS response names. + DNSProxyLockCount = 131 + + // DNSProxyLockTimeout is the default timeout when acquiring the locks controlled by + // DNSProxyLockCount. + DNSProxyLockTimeout = 500 * time.Millisecond + // IdentityChangeGracePeriod is the default value for // option.IdentityChangeGracePeriod IdentityChangeGracePeriod = 5 * time.Second - // IdentityRestoreGracePeriod is the default value for - // option.IdentityRestoreGracePeriod - IdentityRestoreGracePeriod = 10 * time.Minute + // IdentityRestoreGracePeriodKvstore is the default value for + // option.IdentityRestoreGracePeriod when kvstore is enabled. + IdentityRestoreGracePeriodKvstore = 10 * time.Minute + + // IdentityRestoreGracePeriodKvstore is the default value for + // option.IdentityRestoreGracePeriod when only k8s is in use + IdentityRestoreGracePeriodK8s = 30 * time.Second // ExecTimeout is a timeout for executing commands. ExecTimeout = 300 * time.Second @@ -244,6 +257,10 @@ const ( // be necessary on key rotations. EnableIPsecKeyWatcher = true + // Enable caching for XfrmState for IPSec. Significantly reduces CPU usage + // in large clusters. + EnableIPSecXfrmStateCaching = true + // Enable IPSec encrypted overlay // // This feature will encrypt overlay traffic before it leaves the cluster. @@ -508,11 +525,9 @@ const ( // InstallNoConntrackRules instructs Cilium to install Iptables rules to skip netfilter connection tracking on all pod traffic. InstallNoConntrackIptRules = false - // WireguardSubnetV4 is a default WireGuard tunnel subnet - WireguardSubnetV4 = "172.16.43.0/24" - - // WireguardSubnetV6 is a default WireGuard tunnel subnet - WireguardSubnetV6 = "fdc9:281f:04d7:9ee9::1/64" + // ContainerIPLocalReservedPortsAuto instructs the Cilium CNI plugin to reserve + // an auto-generated list of ports in the container network namespace + ContainerIPLocalReservedPortsAuto = "auto" // ExternalClusterIP enables cluster external access to ClusterIP services. // Defaults to false to retain prior behaviour of not routing external packets to ClusterIPs. @@ -569,6 +584,9 @@ const ( // BPFEventsTraceEnabled controls whether the Cilium datapath exposes "trace" events to Cilium monitor and Hubble. BPFEventsTraceEnabled = true + + // EnableEnvoyConfig is the default value for option.EnableEnvoyConfig + EnableEnvoyConfig = false ) var ( diff --git a/vendor/github.com/cilium/cilium/pkg/endpoint/id/id.go b/vendor/github.com/cilium/cilium/pkg/endpoint/id/id.go deleted file mode 100644 index 96b8d7b10..000000000 --- a/vendor/github.com/cilium/cilium/pkg/endpoint/id/id.go +++ /dev/null @@ -1,159 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package id - -import ( - "fmt" - "math" - "net/netip" - "strconv" - "strings" -) - -// MaxEndpointID is the maximum endpoint identifier. -const MaxEndpointID = math.MaxUint16 - -// PrefixType describes the type of endpoint identifier -type PrefixType string - -func (s PrefixType) String() string { return string(s) } - -const ( - // CiliumLocalIdPrefix is a numeric identifier with local scope. It has - // no cluster wide meaning and is only unique in the scope of a single - // agent. An endpoint is guaranteed to always have a local scope identifier. - CiliumLocalIdPrefix PrefixType = "cilium-local" - - // CiliumGlobalIdPrefix is an endpoint identifier with global scope. - // This addressing mechanism is currently unused. - CiliumGlobalIdPrefix PrefixType = "cilium-global" - - // ContainerIdPrefix is used to address an endpoint via its primary - // container ID. The container ID is specific to the container runtime - // in use. Only the primary container that defines the networking scope - // can be used to address an endpoint. - // This can only be used to look up endpoints which have not opted-out of - // legacy identifiers. - // Deprecated. Use CNIAttachmentIdPrefix instead - ContainerIdPrefix PrefixType = "container-id" - - // CNIAttachmentIdPrefix is used to address an endpoint via its primary - // container ID and container interface passed to the CNI plugin. - // This attachment ID uniquely identifies a CNI ADD and CNI DEL invocation pair. - CNIAttachmentIdPrefix PrefixType = "cni-attachment-id" - - // DockerEndpointPrefix is used to address an endpoint via the Docker - // endpoint ID. This method is only possible if the endpoint was - // created via the cilium-docker plugin and the container is backed by - // the libnetwork abstraction. - DockerEndpointPrefix PrefixType = "docker-endpoint" - - // ContainerNamePrefix is used to address the endpoint via the - // container's name. This addressing mechanism depends on the container - // runtime. Only the primary container that the networking scope can be - // used to address an endpoint. - // This can only be used to look up endpoints which have not opted-out of - // legacy identifiers. - // Deprecated. Use CNIAttachmentIdPrefix instead - ContainerNamePrefix PrefixType = "container-name" - - // CEPNamePrefix is used to address an endpoint via its Kubernetes - // CiliumEndpoint resource name. This addressing only works if the endpoint - // is represented as a Kubernetes CiliumEndpoint resource. - CEPNamePrefix PrefixType = "cep-name" - - // PodNamePrefix is used to address an endpoint via the Kubernetes pod - // name. This addressing only works if the endpoint represents as - // Kubernetes pod. - // This can only be used to look up endpoints which have not opted-out of - // legacy identifiers. - // Deprecated. May not be unique. Use CEPNamePrefix instead. - PodNamePrefix PrefixType = "pod-name" - - // IPv4Prefix is used to address an endpoint via the endpoint's IPv4 - // address. - IPv4Prefix PrefixType = "ipv4" - - // IPv6Prefix is the prefix used to refer to an endpoint via IPv6 address - IPv6Prefix PrefixType = "ipv6" -) - -// NewCiliumID returns a new endpoint identifier of type CiliumLocalIdPrefix -func NewCiliumID(id int64) string { - return NewID(CiliumLocalIdPrefix, strconv.FormatInt(id, 10)) -} - -// NewID returns a new endpoint identifier -func NewID(prefix PrefixType, id string) string { - return string(prefix) + ":" + id -} - -// NewIPPrefixID returns an identifier based on the IP address specified. If ip -// is invalid, an empty string is returned. -func NewIPPrefixID(ip netip.Addr) string { - if ip.IsValid() { - if ip.Is4() { - return NewID(IPv4Prefix, ip.String()) - } - return NewID(IPv6Prefix, ip.String()) - } - return "" -} - -// NewCNIAttachmentID returns an identifier based on the CNI attachment ID. If -// the containerIfName is empty, only the containerID will be used. -func NewCNIAttachmentID(containerID, containerIfName string) string { - id := containerID - if containerIfName != "" { - id = containerID + ":" + containerIfName - } - return NewID(CNIAttachmentIdPrefix, id) -} - -// splitID splits ID into prefix and id. No validation is performed on prefix. -func splitID(id string) (PrefixType, string) { - if idx := strings.IndexByte(id, ':'); idx > -1 { - return PrefixType(id[:idx]), id[idx+1:] - } - - // default prefix - return CiliumLocalIdPrefix, id -} - -// ParseCiliumID parses id as cilium endpoint id and returns numeric portion. -func ParseCiliumID(id string) (int64, error) { - prefix, id := splitID(id) - if prefix != CiliumLocalIdPrefix { - return 0, fmt.Errorf("not a cilium identifier") - } - n, err := strconv.ParseInt(id, 0, 64) - if err != nil || n < 0 { - return 0, fmt.Errorf("invalid numeric cilium id: %w", err) - } - if n > MaxEndpointID { - return 0, fmt.Errorf("endpoint id too large: %d", n) - } - return n, nil -} - -// Parse parses a string as an endpoint identified consists of an optional -// prefix [prefix:] followed by the identifier. -func Parse(id string) (PrefixType, string, error) { - prefix, id := splitID(id) - switch prefix { - case CiliumLocalIdPrefix, - CiliumGlobalIdPrefix, - CNIAttachmentIdPrefix, - ContainerIdPrefix, - DockerEndpointPrefix, - ContainerNamePrefix, - CEPNamePrefix, - PodNamePrefix, - IPv4Prefix, - IPv6Prefix: - return prefix, id, nil - } - - return "", "", fmt.Errorf("unknown endpoint ID prefix \"%s\"", prefix) -} diff --git a/vendor/github.com/cilium/cilium/pkg/endpoint/id/identifiers.go b/vendor/github.com/cilium/cilium/pkg/endpoint/id/identifiers.go deleted file mode 100644 index d2deaa391..000000000 --- a/vendor/github.com/cilium/cilium/pkg/endpoint/id/identifiers.go +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package id - -// Identifiers is a collection of attributes that identify the Endpoint through -// different systems. For examples of the type of Identifiers, see PrefixType. -type Identifiers map[PrefixType]string diff --git a/vendor/github.com/cilium/cilium/pkg/endpoint/regeneration/owner.go b/vendor/github.com/cilium/cilium/pkg/endpoint/regeneration/owner.go deleted file mode 100644 index eb435d4e6..000000000 --- a/vendor/github.com/cilium/cilium/pkg/endpoint/regeneration/owner.go +++ /dev/null @@ -1,37 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package regeneration - -import ( - "context" - - datapath "github.com/cilium/cilium/pkg/datapath/types" - "github.com/cilium/cilium/pkg/fqdn/restore" - monitorAPI "github.com/cilium/cilium/pkg/monitor/api" -) - -// Owner is the interface defines the requirements for anybody owning policies. -type Owner interface { - // QueueEndpointBuild puts the given endpoint in the processing queue - QueueEndpointBuild(ctx context.Context, epID uint64) (func(), error) - - // GetCompilationLock returns the mutex responsible for synchronizing compilation - // of BPF programs. - GetCompilationLock() datapath.CompilationLock - - // SendNotification is called to emit an agent notification - SendNotification(msg monitorAPI.AgentNotifyMessage) error - - // Datapath returns a reference to the datapath implementation. - Datapath() datapath.Datapath - - // GetDNSRules creates a fresh copy of DNS rules that can be used when - // endpoint is restored on a restart. - // The endpoint lock must not be held while calling this function. - GetDNSRules(epID uint16) restore.DNSRules - - // RemoveRestoredDNSRules removes any restored DNS rules for - // this endpoint from the DNS proxy. - RemoveRestoredDNSRules(epID uint16) -} diff --git a/vendor/github.com/cilium/cilium/pkg/endpoint/regeneration/regeneration_context.go b/vendor/github.com/cilium/cilium/pkg/endpoint/regeneration/regeneration_context.go deleted file mode 100644 index fde15602f..000000000 --- a/vendor/github.com/cilium/cilium/pkg/endpoint/regeneration/regeneration_context.go +++ /dev/null @@ -1,58 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package regeneration - -import ( - "context" -) - -// DatapathRegenerationLevel determines what is expected of the datapath when -// a regeneration event is processed. -type DatapathRegenerationLevel int - -const ( - // Invalid is the default level to enforce explicit setting of - // the regeneration level. - Invalid DatapathRegenerationLevel = iota - // RegenerateWithoutDatapath indicates that datapath rebuild or reload - // is not required to implement this regeneration. - RegenerateWithoutDatapath - // RegenerateWithDatapathLoad indicates that the datapath must be - // reloaded but not recompiled to implement this regeneration. - RegenerateWithDatapathLoad - // RegenerateWithDatapathRewrite indicates that the datapath must be - // recompiled and reloaded to implement this regeneration. - RegenerateWithDatapathRewrite -) - -// String converts a DatapathRegenerationLevel into a human-readable string. -func (r DatapathRegenerationLevel) String() string { - switch r { - case Invalid: - return "invalid" - case RegenerateWithoutDatapath: - return "no-rebuild" - case RegenerateWithDatapathLoad: - return "reload" - case RegenerateWithDatapathRewrite: - return "rewrite+load" - default: - break - } - return "BUG: Unknown DatapathRegenerationLevel" -} - -// ExternalRegenerationMetadata contains any information about a regeneration that -// the endpoint subsystem should be made aware of for a given endpoint. -type ExternalRegenerationMetadata struct { - // Reason provides context to source for the regeneration, which is - // used to generate useful log messages. - Reason string - - // RegenerationLevel forces datapath regeneration according to the - // levels defined in the DatapathRegenerationLevel description. - RegenerationLevel DatapathRegenerationLevel - - ParentContext context.Context -} diff --git a/vendor/github.com/cilium/cilium/pkg/eventqueue/doc.go b/vendor/github.com/cilium/cilium/pkg/eventqueue/doc.go deleted file mode 100644 index 62b82c19d..000000000 --- a/vendor/github.com/cilium/cilium/pkg/eventqueue/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Package eventqueue implements a queue-based system for event processing in a -// generic fashion in a first-in, first-out manner. -package eventqueue diff --git a/vendor/github.com/cilium/cilium/pkg/eventqueue/eventqueue.go b/vendor/github.com/cilium/cilium/pkg/eventqueue/eventqueue.go deleted file mode 100644 index e4bd753c7..000000000 --- a/vendor/github.com/cilium/cilium/pkg/eventqueue/eventqueue.go +++ /dev/null @@ -1,314 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package eventqueue - -import ( - "fmt" - "reflect" - "sync" - "sync/atomic" - - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/option" - "github.com/cilium/cilium/pkg/spanstat" -) - -var ( - log = logging.DefaultLogger.WithField(logfields.LogSubsys, "eventqueue") -) - -// EventQueue is a structure which is utilized to handle Events in a first-in, -// first-out order. An EventQueue may be closed, in which case all events which -// are queued up, but have not been processed yet, will be cancelled (i.e., not -// ran). It is guaranteed that no events will be scheduled onto an EventQueue -// after it has been closed; if any event is attempted to be scheduled onto an -// EventQueue after it has been closed, it will be cancelled immediately. For -// any event to be processed by the EventQueue, it must implement the -// `EventHandler` interface. This allows for different types of events to be -// processed by anything which chooses to utilize an `EventQueue`. -type EventQueue struct { - // events represents the queue of events. This should always be a buffered - // channel. - events chan *Event - - // close is closed once the EventQueue has been closed. - close chan struct{} - - // drain is closed when the EventQueue is stopped. Any Event which is - // Enqueued after this channel is closed will be cancelled / not processed - // by the queue. If an Event has been Enqueued, but has not been processed - // before this channel is closed, it will be cancelled and not processed - // as well. - drain chan struct{} - - // eventQueueOnce is used to ensure that the EventQueue business logic can - // only be ran once. - eventQueueOnce sync.Once - - // closeOnce is used to ensure that the EventQueue can only be closed once. - closeOnce sync.Once - - // name is used to differentiate this EventQueue from other EventQueues that - // are also running in logs - name string - - eventsMu lock.RWMutex - - // eventsClosed is a channel that's closed when the event loop (Run()) - // terminates. - eventsClosed chan struct{} -} - -// NewEventQueue returns an EventQueue with a capacity for only one event at -// a time. -func NewEventQueue() *EventQueue { - return NewEventQueueBuffered("", 1) -} - -// NewEventQueueBuffered returns an EventQueue with a capacity of, -// numBufferedEvents at a time, and all other needed fields initialized. -func NewEventQueueBuffered(name string, numBufferedEvents int) *EventQueue { - log.WithFields(logrus.Fields{ - "name": name, - "numBufferedEvents": numBufferedEvents, - }).Debug("creating new EventQueue") - return &EventQueue{ - name: name, - // Up to numBufferedEvents can be Enqueued until Enqueueing blocks. - events: make(chan *Event, numBufferedEvents), - close: make(chan struct{}), - drain: make(chan struct{}), - eventsClosed: make(chan struct{}), - } -} - -// Enqueue pushes the given event onto the EventQueue. If the queue has been -// stopped, the Event will not be enqueued, and its cancel channel will be -// closed, indicating that the Event was not ran. This function may block if -// the queue is at its capacity for events. If a single Event has Enqueue -// called on it multiple times asynchronously, there is no guarantee as to -// which one will return the channel which passes results back to the caller. -// It is up to the caller to check whether the returned channel is nil, as -// waiting to receive on such a channel will block forever. Returns an error -// if the Event has been previously enqueued, if the Event is nil, or the queue -// itself is not initialized properly. -func (q *EventQueue) Enqueue(ev *Event) (<-chan interface{}, error) { - if q.notSafeToAccess() || ev == nil { - return nil, fmt.Errorf("unable to Enqueue event") - } - - // Events can only be enqueued once. - if !ev.enqueued.CompareAndSwap(false, true) { - return nil, fmt.Errorf("unable to Enqueue event; event has already had Enqueue called on it") - } - - // Multiple Enqueues can occur at the same time. Ensure that events channel - // is not closed while we are enqueueing events. - q.eventsMu.RLock() - defer q.eventsMu.RUnlock() - - select { - // The event should be drained from the queue (e.g., it should not be - // processed). - case <-q.drain: - // Closed eventResults channel signifies cancellation. - close(ev.cancelled) - close(ev.eventResults) - - return ev.eventResults, nil - default: - // The events channel may be closed even if an event has been pushed - // onto the events channel, as events are consumed off of the events - // channel asynchronously! If the EventQueue is closed before this - // event is processed, then it will be cancelled. - - ev.stats.waitEnqueue.Start() - ev.stats.waitConsumeOffQueue.Start() - q.events <- ev - ev.stats.waitEnqueue.End(true) - return ev.eventResults, nil - } -} - -// Event is an event that can be enqueued onto an EventQueue. -type Event struct { - // Metadata is the information about the event which is sent - // by its queuer. Metadata must implement the EventHandler interface in - // order for the Event to be successfully processed by the EventQueue. - Metadata EventHandler - - // eventResults is a channel on which the results of the event are sent. - // It is populated by the EventQueue itself, not by the queuer. This channel - // is closed if the event is cancelled. - eventResults chan interface{} - - // cancelled signals that the given Event was not ran. This can happen - // if the EventQueue processing this Event was closed before the Event was - // Enqueued onto the Event queue, or if the Event was Enqueued onto an - // EventQueue, and the EventQueue on which the Event was scheduled was - // closed. - cancelled chan struct{} - - // stats is a field which contains information about when this event is - // enqueued, dequeued, etc. - stats eventStatistics - - // enqueued specifies whether this event has been enqueued on an EventQueue. - enqueued atomic.Bool -} - -type eventStatistics struct { - - // waitEnqueue shows how long a given event was waiting on the queue before - // it was actually processed. - waitEnqueue spanstat.SpanStat - - // durationStat shows how long the actual processing of the event took. This - // is the time for how long Handle() takes for the event. - durationStat spanstat.SpanStat - - // waitConsumeOffQueue shows how long it took for the event to be consumed - // plus the time it the event waited in the queue. - waitConsumeOffQueue spanstat.SpanStat -} - -// NewEvent returns an Event with all fields initialized. -func NewEvent(meta EventHandler) *Event { - return &Event{ - Metadata: meta, - eventResults: make(chan interface{}, 1), - cancelled: make(chan struct{}), - stats: eventStatistics{}, - } -} - -// WasCancelled returns whether the cancelled channel for the given Event has -// been closed or not. Cancellation occurs if the event was not processed yet -// by an EventQueue onto which this Event was Enqueued, and the queue is closed, -// or if the event was attempted to be scheduled onto an EventQueue which has -// already been closed. -func (ev *Event) WasCancelled() bool { - select { - case <-ev.cancelled: - return true - default: - return false - } -} - -func (ev *Event) printStats(q *EventQueue) { - if option.Config.Debug { - q.getLogger().WithFields(logrus.Fields{ - "eventType": reflect.TypeOf(ev.Metadata).String(), - "eventHandlingDuration": ev.stats.durationStat.Total(), - "eventEnqueueWaitTime": ev.stats.waitEnqueue.Total(), - "eventConsumeOffQueueWaitTime": ev.stats.waitConsumeOffQueue.Total(), - }).Debug("EventQueue event processing statistics") - } -} - -// Run consumes events that have been queued for this EventQueue. It -// is presumed that the eventQueue is a buffered channel with a length of one -// (i.e., only one event can be processed at a time). All business logic for -// handling queued events is contained within this function. The events in the -// queue must implement the EventHandler interface. If the event queue is -// closed, then all events which were queued up, but not processed, are -// cancelled; any event which is currently being processed will not be -// cancelled. -func (q *EventQueue) Run() { - if q.notSafeToAccess() { - return - } - - go q.run() -} - -func (q *EventQueue) run() { - q.eventQueueOnce.Do(func() { - defer close(q.eventsClosed) - for ev := range q.events { - select { - case <-q.drain: - ev.stats.waitConsumeOffQueue.End(false) - close(ev.cancelled) - close(ev.eventResults) - ev.printStats(q) - default: - ev.stats.waitConsumeOffQueue.End(true) - ev.stats.durationStat.Start() - ev.Metadata.Handle(ev.eventResults) - // Always indicate success for now. - ev.stats.durationStat.End(true) - // Ensures that no more results can be sent as the event has - // already been processed. - ev.printStats(q) - close(ev.eventResults) - } - } - }) -} - -func (q *EventQueue) notSafeToAccess() bool { - return q == nil || q.close == nil || q.drain == nil || q.events == nil -} - -// Stop stops any further events from being processed by the EventQueue. Any -// event which is currently being processed by the EventQueue will continue to -// run. All other events waiting to be processed, and all events that may be -// enqueued will not be processed by the event queue; they will be cancelled. -// If the queue has already been stopped, this is a no-op. -func (q *EventQueue) Stop() { - if q.notSafeToAccess() { - return - } - - q.closeOnce.Do(func() { - q.getLogger().Debug("stopping EventQueue") - // Any event that is sent to the queue at this point will be cancelled - // immediately in Enqueue(). - close(q.drain) - - // Signal that the queue has been drained. - close(q.close) - - q.eventsMu.Lock() - close(q.events) - q.eventsMu.Unlock() - }) -} - -// WaitToBeDrained returns the channel which waits for the EventQueue to have been -// stopped. This allows for queuers to ensure that all events in the queue have -// been processed or cancelled. If the queue is nil, returns immediately. -func (q *EventQueue) WaitToBeDrained() { - if q == nil { - return - } - <-q.close - - // If the queue is running, then in-flight events may still be ongoing. - // Wait for them to be completed for the queue to be fully drained. If the - // queue is not running, we must forcefully run it because nothing else - // will so that it can be drained. - go q.run() - <-q.eventsClosed -} - -func (q *EventQueue) getLogger() *logrus.Entry { - return log.WithFields( - logrus.Fields{ - "name": q.name, - }) -} - -// EventHandler is an interface for allowing an EventQueue to handle events -// in a generic way. To be processed by the EventQueue, all event types must -// implement any function specified in this interface. -type EventHandler interface { - Handle(chan interface{}) -} diff --git a/vendor/github.com/cilium/cilium/pkg/fqdn/dns/dns.go b/vendor/github.com/cilium/cilium/pkg/fqdn/dns/dns.go deleted file mode 100644 index 1c089a785..000000000 --- a/vendor/github.com/cilium/cilium/pkg/fqdn/dns/dns.go +++ /dev/null @@ -1,39 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Based on code from github.com/miekg/dns which is: -// -// Copyright 2009 The Go Authors. All rights reserved. -// Copyright 2011 Miek Gieben. All rights reserved. -// Copyright 2014 CloudFlare. All rights reserved. - -package dns - -import "strings" - -// These functions were copied and adapted from github.com/miekg/dns. - -// isFQDN reports whether the domain name s is fully qualified. -func isFQDN(s string) bool { - s2 := strings.TrimSuffix(s, ".") - if s == s2 { - return false - } - - i := strings.LastIndexFunc(s2, func(r rune) bool { - return r != '\\' - }) - - // Test whether we have an even number of escape sequences before - // the dot or none. - return (len(s2)-i)%2 != 0 -} - -// FQDN returns the fully qualified domain name from s. -// If s is already fully qualified, it behaves as the identity function. -func FQDN(s string) string { - if isFQDN(s) { - return strings.ToLower(s) - } - return strings.ToLower(s) + "." -} diff --git a/vendor/github.com/cilium/cilium/pkg/fqdn/matchpattern/matchpattern.go b/vendor/github.com/cilium/cilium/pkg/fqdn/matchpattern/matchpattern.go deleted file mode 100644 index 68e083175..000000000 --- a/vendor/github.com/cilium/cilium/pkg/fqdn/matchpattern/matchpattern.go +++ /dev/null @@ -1,107 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package matchpattern - -import ( - "errors" - "regexp" - "strings" - - "github.com/cilium/cilium/pkg/fqdn/dns" - "github.com/cilium/cilium/pkg/fqdn/re" -) - -const allowedDNSCharsREGroup = "[-a-zA-Z0-9_]" - -// MatchAllAnchoredPattern is the simplest pattern that match all inputs. This resulting -// parsed regular expression is the same as an empty string regex (""), but this -// value is easier to reason about when serializing to and from json. -const MatchAllAnchoredPattern = "(?:)" - -// MatchAllUnAnchoredPattern is the same as MatchAllAnchoredPattern, except that -// it can be or-ed (joined with "|") with other rules, and still match all rules. -const MatchAllUnAnchoredPattern = ".*" - -// Validate ensures that pattern is a parseable matchPattern. It returns the -// regexp generated when validating. -func Validate(pattern string) (matcher *regexp.Regexp, err error) { - if err := prevalidate(pattern); err != nil { - return nil, err - } - return re.CompileRegex(ToAnchoredRegexp(pattern)) -} - -// ValidateWithoutCache is the same as Validate() but doesn't consult the regex -// LRU. -func ValidateWithoutCache(pattern string) (matcher *regexp.Regexp, err error) { - if err := prevalidate(pattern); err != nil { - return nil, err - } - return regexp.Compile(ToAnchoredRegexp(pattern)) -} - -func prevalidate(pattern string) error { - pattern = strings.TrimSpace(pattern) - pattern = strings.ToLower(pattern) - - // error check - if strings.ContainsAny(pattern, "[]+{},") { - return errors.New(`Only alphanumeric ASCII characters, the hyphen "-", underscore "_", "." and "*" are allowed in a matchPattern`) - } - - return nil -} - -// Sanitize canonicalized the pattern for use by ToAnchoredRegexp -func Sanitize(pattern string) string { - if pattern == "*" { - return pattern - } - - return dns.FQDN(pattern) -} - -// ToAnchoredRegexp converts a MatchPattern field into a regexp string. It does not -// validate the pattern. It also adds anchors to ensure it match the whole string. -// It supports: -// * to select 0 or more DNS valid characters -func ToAnchoredRegexp(pattern string) string { - pattern = strings.TrimSpace(pattern) - pattern = strings.ToLower(pattern) - - // handle the * match-all case. This will filter down to the end. - if pattern == "*" { - return "(^(" + allowedDNSCharsREGroup + "+[.])+$)|(^[.]$)" - } - - pattern = escapeRegexpCharacters(pattern) - - // Anchor the match to require the whole string to match this expression - return "^" + pattern + "$" -} - -// ToUnAnchoredRegexp converts a MatchPattern field into a regexp string. It does not -// validate the pattern. It does not add regexp anchors. -// It supports: -// * to select 0 or more DNS valid characters -func ToUnAnchoredRegexp(pattern string) string { - pattern = strings.TrimSpace(pattern) - pattern = strings.ToLower(pattern) - // handle the * match-all case. This will filter down to the end. - if pattern == "*" { - return MatchAllUnAnchoredPattern - } - pattern = escapeRegexpCharacters(pattern) - return pattern -} - -func escapeRegexpCharacters(pattern string) string { - // base case. "." becomes a literal . - pattern = strings.Replace(pattern, ".", "[.]", -1) - - // base case. * becomes .*, but only for DNS valid characters - // NOTE: this only works because the case above does not leave the * - pattern = strings.Replace(pattern, "*", allowedDNSCharsREGroup+"*", -1) - return pattern -} diff --git a/vendor/github.com/cilium/cilium/pkg/fqdn/re/re.go b/vendor/github.com/cilium/cilium/pkg/fqdn/re/re.go deleted file mode 100644 index 73dd06339..000000000 --- a/vendor/github.com/cilium/cilium/pkg/fqdn/re/re.go +++ /dev/null @@ -1,81 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Package re provides a simple function to access compile regex objects for -// the FQDN subsystem. -package re - -import ( - "errors" - "fmt" - "regexp" - "sync/atomic" - - lru "github.com/golang/groupcache/lru" - - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/option" -) - -var ( - log = logging.DefaultLogger.WithField(logfields.LogSubsys, "fqdn/re") -) - -// CompileRegex compiles a pattern p into a regex and returns the regex object. -// The regex object will be cached by an LRU. If p has already been compiled -// and cached, this function will return the cached regex object. If not -// already cached, it will compile p into a regex object and cache it in the -// LRU. This function will return an error if the LRU has not already been -// initialized. -func CompileRegex(p string) (*regexp.Regexp, error) { - lru := regexCompileLRU.Load() - if lru == nil { - return nil, errors.New("FQDN regex compilation LRU not yet initialized") - } - lru.Lock() - r, ok := lru.Get(p) - lru.Unlock() - if ok { - return r.(*regexp.Regexp), nil - } - n, err := regexp.Compile(p) - if err != nil { - return nil, fmt.Errorf("failed to compile regex: %w", err) - } - lru.Lock() - lru.Add(p, n) - lru.Unlock() - return n, nil -} - -// InitRegexCompileLRU creates a new instance of the regex compilation LRU. -func InitRegexCompileLRU(size int) error { - if size < 0 { - return fmt.Errorf("failed to initialize FQDN regex compilation LRU due to invalid size %d", size) - } else if size == 0 { - log.Warnf( - "FQDN regex compilation LRU size is unlimited, which can grow unbounded potentially consuming too much memory. Consider passing a maximum size via --%s.", - option.FQDNRegexCompileLRUSize) - } - regexCompileLRU.Store(&RegexCompileLRU{ - Mutex: &lock.Mutex{}, - Cache: lru.New(size), - }) - return nil -} - -// regexCompileLRU is the singleton instance of the LRU that's shared -// throughout Cilium. -var regexCompileLRU atomic.Pointer[RegexCompileLRU] - -// RegexCompileLRU is an LRU cache for storing compiled regex objects of FQDN -// names or patterns, used in CiliumNetworkPolicy or -// ClusterwideCiliumNetworkPolicy. -type RegexCompileLRU struct { - // The lru package doesn't provide any concurrency guarantees so we must - // provide our own locking. - *lock.Mutex - *lru.Cache -} diff --git a/vendor/github.com/cilium/cilium/pkg/fqdn/restore/restore.go b/vendor/github.com/cilium/cilium/pkg/fqdn/restore/restore.go deleted file mode 100644 index 3a0ab9f53..000000000 --- a/vendor/github.com/cilium/cilium/pkg/fqdn/restore/restore.go +++ /dev/null @@ -1,128 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// The restore package provides data structures important to restoring -// DNS proxy rules. This package serves as a central source for these -// structures. -// Note that these are marshaled as JSON and any changes need to be compatible -// across an upgrade! -package restore - -import ( - "fmt" - "sort" - "testing" -) - -// PortProtoV2 is 1 value at bit position 24. -const PortProtoV2 = 1 << 24 - -// PortProto is uint32 that encodes two different -// versions of port protocol keys. Version 1 is protocol -// agnostic and (naturally) encodes no values at bit -// positions 16-31. Version 2 encodes protocol at bit -// positions 16-23, and bit position 24 encodes a 1 -// value to indicate that it is Version 2. Both versions -// encode the port at the -// bit positions 0-15. -// -// This works because Version 1 will naturally encode -// no values at postions 16-31 as the original Version 1 -// was a uint16. Version 2 enforces a 1 value at the 24th -// bit position, so it will alway be legible. -type PortProto uint32 - -// MakeV2PortProto returns a Version 2 port protocol. -func MakeV2PortProto(port uint16, proto uint8) PortProto { - return PortProto(PortProtoV2 | (uint32(proto) << 16) | uint32(port)) -} - -// IsPortV2 returns true if the PortProto -// is Version 2. -func (pp PortProto) IsPortV2() bool { - return PortProtoV2&pp == PortProtoV2 -} - -// Port returns the port of the PortProto -func (pp PortProto) Port() uint16 { - return uint16(pp & 0x0000_ffff) -} - -// Protocol returns the protocol of the -// PortProto. It returns "0" for Version 1. -func (pp PortProto) Protocol() uint8 { - return uint8((pp & 0xff_0000) >> 16) -} - -// ToV1 returns the Version 1 (that is, "port") -// version of the PortProto. -func (pp PortProto) ToV1() PortProto { - return pp & 0x0000_ffff -} - -// String returns the decimal representation -// of PortProtocol in string form. -func (pp PortProto) String() string { - return fmt.Sprintf("%d", pp) -} - -// DNSRules contains IP-based DNS rules for a set of port-protocols (e.g., UDP/53) -type DNSRules map[PortProto]IPRules - -// IPRules is an unsorted collection of IPrules -type IPRules []IPRule - -// IPRule stores the allowed destination IPs for a DNS names matching a regex -type IPRule struct { - Re RuleRegex - IPs map[string]struct{} // IPs, nil set is wildcard and allows all IPs! -} - -// RuleRegex is a wrapper for a pointer to a string so that we can define marshalers for it. -type RuleRegex struct { - Pattern *string -} - -// Sort is only used for testing -// Sorts in place, but returns IPRules for convenience -func (r IPRules) Sort(_ *testing.T) IPRules { - sort.SliceStable(r, func(i, j int) bool { - if r[i].Re.Pattern != nil && r[j].Re.Pattern != nil { - return *r[i].Re.Pattern < *r[j].Re.Pattern - } - if r[i].Re.Pattern != nil { - return true - } - return false - }) - - return r -} - -// Sort is only used for testing -// Sorts in place, but returns DNSRules for convenience -func (r DNSRules) Sort(_ *testing.T) DNSRules { - for pp, ipRules := range r { - if len(ipRules) > 0 { - ipRules = ipRules.Sort(nil) - r[pp] = ipRules - } - } - return r -} - -// UnmarshalText unmarshals json into a RuleRegex -// This must have a pointer receiver, otherwise the RuleRegex remains empty. -func (r *RuleRegex) UnmarshalText(b []byte) error { - pattern := string(b) - r.Pattern = &pattern - return nil -} - -// MarshalText marshals RuleRegex as string -func (r RuleRegex) MarshalText() ([]byte, error) { - if r.Pattern != nil { - return []byte(*r.Pattern), nil - } - return nil, nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/health/client/client.go b/vendor/github.com/cilium/cilium/pkg/health/client/client.go deleted file mode 100644 index dd943633b..000000000 --- a/vendor/github.com/cilium/cilium/pkg/health/client/client.go +++ /dev/null @@ -1,424 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package client - -import ( - "fmt" - "io" - "net" - "net/http" - "net/url" - "os" - "sort" - "strings" - "time" - - runtime_client "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - - clientapi "github.com/cilium/cilium/api/v1/health/client" - "github.com/cilium/cilium/api/v1/health/models" - "github.com/cilium/cilium/pkg/health/defaults" -) - -type ConnectivityStatusType int - -const ( - ipUnavailable = "Unavailable" - - ConnStatusReachable ConnectivityStatusType = 0 - ConnStatusUnreachable ConnectivityStatusType = 1 - ConnStatusUnknown ConnectivityStatusType = 2 -) - -func (c ConnectivityStatusType) String() string { - switch c { - case ConnStatusReachable: - return "reachable" - case ConnStatusUnreachable: - return "unreachable" - default: - return "unknown" - } -} - -// Client is a client for cilium health -type Client struct { - clientapi.CiliumHealthAPI -} - -func configureTransport(tr *http.Transport, proto, addr string) *http.Transport { - if tr == nil { - tr = &http.Transport{} - } - - if proto == "unix" { - // No need for compression in local communications. - tr.DisableCompression = true - tr.Dial = func(_, _ string) (net.Conn, error) { - return net.Dial(proto, addr) - } - } else { - tr.Proxy = http.ProxyFromEnvironment - tr.Dial = (&net.Dialer{}).Dial - } - - return tr -} - -// NewDefaultClient creates a client with default parameters connecting to UNIX domain socket. -func NewDefaultClient() (*Client, error) { - return NewClient("") -} - -// NewClient creates a client for the given `host`. -func NewClient(host string) (*Client, error) { - if host == "" { - // Check if environment variable points to socket - e := os.Getenv(defaults.SockPathEnv) - if e == "" { - // If unset, fall back to default value - e = defaults.SockPath - } - host = "unix://" + e - } - tmp := strings.SplitN(host, "://", 2) - if len(tmp) != 2 { - return nil, fmt.Errorf("invalid host format '%s'", host) - } - - hostHeader := tmp[1] - - switch tmp[0] { - case "tcp": - if _, err := url.Parse("tcp://" + tmp[1]); err != nil { - return nil, err - } - host = "http://" + tmp[1] - case "unix": - host = tmp[1] - // For local communication (unix domain sockets), the hostname is not used. Leave - // Host header empty because otherwise it would be rejected by net/http client-side - // sanitization, see https://go.dev/issue/60374. - hostHeader = "localhost" - } - - transport := configureTransport(nil, tmp[0], host) - httpClient := &http.Client{Transport: transport} - clientTrans := runtime_client.NewWithClient(hostHeader, clientapi.DefaultBasePath, - clientapi.DefaultSchemes, httpClient) - return &Client{*clientapi.New(clientTrans, strfmt.Default)}, nil -} - -// Hint tries to improve the error message displayed to the user. -func Hint(err error) error { - if err == nil { - return err - } - e, _ := url.PathUnescape(err.Error()) - if strings.Contains(err.Error(), defaults.SockPath) { - return fmt.Errorf("%s\nIs the agent running?", e) - } - return fmt.Errorf("%s", e) -} - -func GetConnectivityStatusType(cs *models.ConnectivityStatus) ConnectivityStatusType { - // If the connecticity status is nil, it means that there was no - // successful probe, but also no failed probe with a concrete reason. In - // that case, the status is unknown and it usually means that the new - // is still in the beginning of the bootstraping process. - if cs == nil { - return ConnStatusUnknown - } - // Empty status means successful probe. - if cs.Status == "" { - return ConnStatusReachable - } - // Non-empty status means that there was an explicit reason of failure. - return ConnStatusUnreachable -} - -func GetPathConnectivityStatusType(cp *models.PathStatus) ConnectivityStatusType { - if cp == nil { - return ConnStatusUnreachable - } - statuses := []*models.ConnectivityStatus{ - cp.Icmp, - cp.HTTP, - } - // Initially assume healthy status. - status := ConnStatusReachable - for _, cs := range statuses { - switch GetConnectivityStatusType(cs) { - case ConnStatusUnreachable: - // If any status is unreachable, return it immediately. - return ConnStatusUnreachable - case ConnStatusUnknown: - // If the status is unknown, prepare to return it. It's - // going to be returned if there is no unreachable - // status in next iterations. - status = ConnStatusUnknown - } - } - return status -} - -func SummarizePathConnectivityStatusType(cps []*models.PathStatus) ConnectivityStatusType { - status := ConnStatusReachable - for _, cp := range cps { - switch GetPathConnectivityStatusType(cp) { - case ConnStatusUnreachable: - // If any status is unreachable, return it immediately. - return ConnStatusUnreachable - case ConnStatusUnknown: - // If the status is unknown, prepare to return it. It's - // going to be returned if there is no unreachable - // status in next iterations. - status = ConnStatusUnknown - } - } - return status -} - -func formatConnectivityStatus(w io.Writer, cs *models.ConnectivityStatus, path, indent string) { - status := cs.Status - switch GetConnectivityStatusType(cs) { - case ConnStatusReachable: - latency := time.Duration(cs.Latency) - status = fmt.Sprintf("OK, RTT=%s", latency) - } - fmt.Fprintf(w, "%s%s:\t%s\n", indent, path, status) -} - -func formatPathStatus(w io.Writer, name string, cp *models.PathStatus, indent string, verbose bool) { - if cp == nil { - if verbose { - fmt.Fprintf(w, "%s%s connectivity:\tnil\n", indent, name) - } - return - } - fmt.Fprintf(w, "%s%s connectivity to %s:\n", indent, name, cp.IP) - indent = fmt.Sprintf("%s ", indent) - - if cp.Icmp != nil { - formatConnectivityStatus(w, cp.Icmp, "ICMP to stack", indent) - } - if cp.HTTP != nil { - formatConnectivityStatus(w, cp.HTTP, "HTTP to agent", indent) - } -} - -// allPathsAreHealthyOrUnknown checks whether ICMP and TCP(HTTP) connectivity -// to the given paths is available or had no explicit error status -// (which usually is the case when the new node is provisioned). -func allPathsAreHealthyOrUnknown(cps []*models.PathStatus) bool { - for _, cp := range cps { - if cp == nil { - return false - } - - statuses := []*models.ConnectivityStatus{ - cp.Icmp, - cp.HTTP, - } - for _, status := range statuses { - switch GetConnectivityStatusType(status) { - case ConnStatusUnreachable: - return false - } - } - } - return true -} - -func nodeIsHealthy(node *models.NodeStatus) bool { - return allPathsAreHealthyOrUnknown(GetAllHostAddresses(node)) && - allPathsAreHealthyOrUnknown(GetAllEndpointAddresses(node)) -} - -func nodeIsLocalhost(node *models.NodeStatus, self *models.SelfStatus) bool { - return self != nil && node.Name == self.Name -} - -func getPrimaryAddressIP(node *models.NodeStatus) string { - if node.Host == nil || node.Host.PrimaryAddress == nil { - return ipUnavailable - } - - return node.Host.PrimaryAddress.IP -} - -// GetHostPrimaryAddress returns the PrimaryAddress for the Host within node. -// If node.Host is nil, returns nil. -func GetHostPrimaryAddress(node *models.NodeStatus) *models.PathStatus { - if node.Host == nil { - return nil - } - - return node.Host.PrimaryAddress -} - -// GetHostSecondaryAddresses returns the secondary host addresses (if any) -func GetHostSecondaryAddresses(node *models.NodeStatus) []*models.PathStatus { - if node.Host == nil { - return nil - } - - return node.Host.SecondaryAddresses -} - -// GetAllHostAddresses returns a list of all addresses (primary and any -// and any secondary) for the host of a given node. If node.Host is nil, -// returns nil. -func GetAllHostAddresses(node *models.NodeStatus) []*models.PathStatus { - if node.Host == nil { - return nil - } - - return append([]*models.PathStatus{node.Host.PrimaryAddress}, node.Host.SecondaryAddresses...) -} - -// GetEndpointPrimaryAddress returns the PrimaryAddress for the health endpoint -// within node. If node.HealthEndpoint is nil, returns nil. -func GetEndpointPrimaryAddress(node *models.NodeStatus) *models.PathStatus { - if node.HealthEndpoint == nil { - return nil - } - - return node.HealthEndpoint.PrimaryAddress -} - -// GetEndpointSecondaryAddresses returns the secondary health endpoint addresses -// (if any) -func GetEndpointSecondaryAddresses(node *models.NodeStatus) []*models.PathStatus { - if node.HealthEndpoint == nil { - return nil - } - - return node.HealthEndpoint.SecondaryAddresses -} - -// GetAllEndpointAddresses returns a list of all addresses (primary and any -// secondary) for the health endpoint within a given node. -// If node.HealthEndpoint is nil, returns nil. -func GetAllEndpointAddresses(node *models.NodeStatus) []*models.PathStatus { - if node.HealthEndpoint == nil { - return nil - } - - return append([]*models.PathStatus{node.HealthEndpoint.PrimaryAddress}, node.HealthEndpoint.SecondaryAddresses...) -} - -func formatNodeStatus(w io.Writer, node *models.NodeStatus, printAll, succinct, verbose, localhost bool) { - localStr := "" - if localhost { - localStr = " (localhost)" - } - if succinct { - if printAll || !nodeIsHealthy(node) { - ips := []string{getPrimaryAddressIP(node)} - for _, addr := range GetHostSecondaryAddresses(node) { - if addr == nil { - continue - } - ips = append(ips, addr.IP) - } - fmt.Fprintf(w, " %s%s\t%s\t%s\t%s\n", node.Name, - localStr, strings.Join(ips, ","), - SummarizePathConnectivityStatusType(GetAllHostAddresses(node)).String(), - SummarizePathConnectivityStatusType(GetAllEndpointAddresses(node)).String()) - } - } else { - fmt.Fprintf(w, " %s%s:\n", node.Name, localStr) - formatPathStatus(w, "Host", GetHostPrimaryAddress(node), " ", verbose) - unhealthyPaths := !allPathsAreHealthyOrUnknown(GetHostSecondaryAddresses(node)) - if (verbose || unhealthyPaths) && node.Host != nil { - for _, addr := range node.Host.SecondaryAddresses { - formatPathStatus(w, "Secondary", addr, " ", verbose) - } - } - formatPathStatus(w, "Endpoint", GetEndpointPrimaryAddress(node), " ", verbose) - unhealthyPaths = !allPathsAreHealthyOrUnknown(GetEndpointSecondaryAddresses(node)) - if (verbose || unhealthyPaths) && node.HealthEndpoint != nil { - for _, addr := range node.HealthEndpoint.SecondaryAddresses { - formatPathStatus(w, "Secondary", addr, " ", verbose) - } - } - } -} - -// FormatHealthStatusResponse writes a HealthStatusResponse as a string to the -// writer. -// -// 'printAll', if true, causes all nodes to be printed regardless of status -// 'succinct', if true, causes node health to be output as one line per node -// 'verbose', if true, overrides 'succinct' and prints all information -// 'maxLines', if nonzero, determines the maximum number of lines to print -func FormatHealthStatusResponse(w io.Writer, sr *models.HealthStatusResponse, printAll, succinct, verbose bool, maxLines int) { - var ( - healthy int - localhost *models.NodeStatus - ) - for _, node := range sr.Nodes { - if nodeIsHealthy(node) { - healthy++ - } - if nodeIsLocalhost(node, sr.Local) { - localhost = node - } - } - if succinct { - fmt.Fprintf(w, "Cluster health:\t%d/%d reachable\t(%s)\n", - healthy, len(sr.Nodes), sr.Timestamp) - if printAll || healthy < len(sr.Nodes) { - fmt.Fprintf(w, " Name\tIP\tNode\tEndpoints\n") - } - } else { - fmt.Fprintf(w, "Probe time:\t%s\n", sr.Timestamp) - fmt.Fprintf(w, "Nodes:\n") - } - - if localhost != nil { - formatNodeStatus(w, localhost, printAll, succinct, verbose, true) - maxLines-- - } - - nodes := sr.Nodes - sort.Slice(nodes, func(i, j int) bool { - return strings.Compare(nodes[i].Name, nodes[j].Name) < 0 - }) - for n, node := range nodes { - if maxLines > 0 && n > maxLines { - break - } - if node == localhost { - continue - } - formatNodeStatus(w, node, printAll, succinct, verbose, false) - } - if maxLines > 0 && len(sr.Nodes)-healthy > maxLines { - fmt.Fprintf(w, " ...") - } -} - -// GetAndFormatHealthStatus fetches the health status from the cilium-health -// daemon via the default channel and formats its output as a string to the -// writer. -// -// 'succinct', 'verbose' and 'maxLines' are handled the same as in -// FormatHealthStatusResponse(). -func GetAndFormatHealthStatus(w io.Writer, succinct, verbose bool, maxLines int) { - client, err := NewClient("") - if err != nil { - fmt.Fprintf(w, "Cluster health:\t\t\tClient error: %s\n", err) - return - } - hr, err := client.Connectivity.GetStatus(nil) - if err != nil { - // The regular `cilium status` output will print the reason why. - fmt.Fprintf(w, "Cluster health:\t\t\tWarning\tcilium-health daemon unreachable\n") - return - } - FormatHealthStatusResponse(w, hr.Payload, verbose, succinct, verbose, maxLines) -} diff --git a/vendor/github.com/cilium/cilium/pkg/health/client/modules.go b/vendor/github.com/cilium/cilium/pkg/health/client/modules.go deleted file mode 100644 index 870d35bb9..000000000 --- a/vendor/github.com/cilium/cilium/pkg/health/client/modules.go +++ /dev/null @@ -1,153 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package client - -import ( - "fmt" - "io" - "os" - "sort" - "strings" - "time" - - "k8s.io/apimachinery/pkg/util/duration" - - "github.com/cilium/cilium/pkg/healthv2/types" -) - -const ( - noPod = "(/)" - rootNode = "" - noErr = "" -) - -// GetAndFormatModulesHealth retrieves modules health and formats output. -// -// Deprecated: Following #30925 we will move to either a separate cilium-dbg command or -// use healthv2 statedb dump data to render status reports externally. -// Following this we should remove this output as part of status in version v1.17. -func GetAndFormatModulesHealth(w io.Writer, ss []types.Status, verbose bool) { - // Although status' is received from the statedb remote table according to - // the order in which it's queried (in our case, by primary index identifier). - // We sort this to ensure order stability regardless. - sort.Slice(ss, func(i, j int) bool { - return ss[i].ID.String() < ss[j].ID.String() - }) - fmt.Fprintf(w, "Modules Health:") - if verbose { - r := newRoot(rootNode) - for _, s := range ss { - stack := strings.Split(s.ID.String(), ".") - upsertTree(r, &s, stack) - } - r = r.nodes[0] - r.parent = nil - body := strings.ReplaceAll(r.String(), "\n", "\n ") - fmt.Fprintln(w, "\n\t\t"+body) - return - } - tally := make(map[types.Level]int, 4) - for _, s := range ss { - tally[types.Level(s.Level)] += 1 - } - fmt.Fprintf(w, "\t%s(%d) %s(%d) %s(%d)\n", - types.LevelStopped, - tally[types.LevelStopped], - types.LevelDegraded, - tally[types.LevelDegraded], - types.LevelOK, - tally[types.LevelOK], - ) -} - -type TreeView struct { - root *node -} - -func NewTreeView() *TreeView { - return &TreeView{ - root: newRoot("agent"), - } -} - -func (t *TreeView) Render() { - fmt.Fprintln(os.Stdout, "\n"+t.root.String()) -} - -func (t *TreeView) UpsertStatus(ss []types.Status) { - for _, s := range ss { - upsertTree(t.root, &s, strings.Split(s.ID.String(), ".")) - } -} - -func Render(ss []types.Status) { - n := newRoot("agent") - for _, s := range ss { - upsertTree(n, &s, strings.Split(s.ID.String(), ".")) - } - body := strings.ReplaceAll(n.String(), "\n", "\n ") - fmt.Fprintln(os.Stdout, "\n\t\t"+body) -} - -// upsertTree inserts a health report, using a stack of path tokens into -// a tree used for displaying health data. -// -// Because there is no longer a distinction between reporter leaves and parent nodes -// (i.e. parents of subtrees can have their own health status) we modify the tree to -// move all such "parent" reports down to a immediate child, such that in our output -// all health reports appear as leaves. - -// upsertTree inserts a health report, using a stack of path tokens into -// a tree used for displaying health data. -// -// Because there is no longer a distinction between reporter leaves and parent nodes -// (i.e. parents of subtrees can have their own health status) we modify the tree to -// move all such "parent" reports down to a immediate child, such that in our output -// all health reports appear as leaves. -func upsertTree(r *node, report *types.Status, stack []string) { - if len(stack) == 1 { - name := stack[0] - meta := fmt.Sprintf("[%s] %s", strings.ToUpper(string(report.Level)), report.Message) - meta += fmt.Sprintf(" (%s, x%d)", ToAgeHuman(report.Updated), report.Count) - for _, c := range r.nodes { - if c.val == name { - c.meta = meta - c.report = report - return - } - } - r.addNodeWithMeta(name, meta, report) - return - } - pop := stack[0] - stack = stack[1:] - for _, c := range r.nodes { - if c.val == pop { - // In this case, if the node was a leaf, it may contain a status. - // Because parent nodes can now also have health status reports we - // fix this up by moving the report to a leaf node, thus maintaining - // the condition that only leaves have reporters. - if c.report != nil { - // Move former parent nodes health report to child leaf. - upsertTree(c, c.report, []string{"[reporter]"}) - c.report = nil - c.meta = "" - } - upsertTree(c, report, stack) - return - } - } - // Add parent node. - n := r.addNode(pop, nil) - upsertTree(n, report, stack) -} - -// ToAgeHuman converts time to duration. -func ToAgeHuman(t time.Time) string { - if t.IsZero() { - return "n/a" - } - - return duration.HumanDuration(time.Since(t)) -} diff --git a/vendor/github.com/cilium/cilium/pkg/health/client/tree.go b/vendor/github.com/cilium/cilium/pkg/health/client/tree.go deleted file mode 100644 index 44ccd48a9..000000000 --- a/vendor/github.com/cilium/cilium/pkg/health/client/tree.go +++ /dev/null @@ -1,220 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package client - -import ( - "bytes" - "fmt" - "io" - "sort" - "strconv" - "strings" - - "github.com/cilium/cilium/pkg/healthv2/types" -) - -const ( - indentSize = 3 - leafMaxWidth = 40 - link decoration = "│" - mid decoration = "├──" - end decoration = "└──" -) - -type decoration string - -func newRoot(r string) *node { - return &node{val: r} -} - -type node struct { - val, meta string - parent *node - nodes []*node - report *types.Status -} - -func (n *node) addNode(v string, r *types.Status) *node { - return n.addNodeWithMeta(v, "", r) -} - -func (n *node) addNodeWithMeta(v, m string, r *types.Status) *node { - node := node{ - parent: n, - val: v, - meta: m, - report: r, - } - n.nodes = append(n.nodes, &node) - - return &node -} - -func (n *node) addBranch(v string) *node { - return n.addBranchWithMeta(v, "") -} - -func (n *node) addBranchWithMeta(v, m string) *node { - b := node{ - parent: n, - meta: m, - val: v, - } - n.nodes = append(n.nodes, &b) - - return &b -} - -func (n *node) find(val string) *node { - if n.val == val { - return n - } - for _, node := range n.nodes { - if node.val == val { - return node - } - if v := node.find(val); v != nil { - return v - } - } - - return nil -} - -func (n *node) asBytes() []byte { - var ( - w = new(bytes.Buffer) - levelsEnded []int - max = computeMaxLevel(0, n) - ) - if n.parent == nil { - w.WriteString(n.val) - if n.meta != "" { - w.WriteString(" " + n.meta) - } - fmt.Fprintln(w) - } else { - edge := mid - if len(n.nodes) == 0 { - edge = end - levelsEnded = append(levelsEnded, 0) - } - dumpVals(w, 0, max, levelsEnded, edge, n) - } - if len(n.nodes) > 0 { - dumpNodes(w, 0, max, levelsEnded, n.nodes) - } - - return w.Bytes() -} - -func (n *node) String() string { - return string(n.asBytes()) -} - -func (n *node) lastNode() *node { - c := len(n.nodes) - if c == 0 { - return nil - } - - return n.nodes[c-1] -} - -func computeMaxLevel(level int, n *node) int { - if n == nil || len(n.nodes) == 0 { - return level - } - var max int - for _, n := range n.nodes { - m := computeMaxLevel(level+1, n) - if m > max { - max = m - } - } - - return max -} - -func dumpNodes(w io.Writer, level, maxLevel int, levelsEnded []int, nodes []*node) { - sort.Slice(nodes, func(i, j int) bool { - return nodes[i].val < nodes[j].val - }) - - for i, node := range nodes { - edge := mid - if i == len(nodes)-1 { - levelsEnded = append(levelsEnded, level) - edge = end - } - dumpVals(w, level, maxLevel, levelsEnded, edge, node) - if len(node.nodes) > 0 { - dumpNodes(w, level+1, maxLevel, levelsEnded, node.nodes) - } - } -} - -func dumpVals(w io.Writer, level, maxLevel int, levelsEnded []int, edge decoration, node *node) { - for i := 0; i < level; i++ { - if isEnded(levelsEnded, i) { - fmt.Fprint(w, strings.Repeat(" ", indentSize+1)) - continue - } - fmt.Fprintf(w, "%s%s", link, strings.Repeat(" ", indentSize)) - } - - val := dumpVal(level, node) - if node.meta != "" { - c := maxLevel - level - if c < 0 { - c = 0 - } - fmt.Fprintf(w, "%s %-"+strconv.Itoa(leafMaxWidth+c*2)+"s%s%s\n", edge, val, strings.Repeat(" ", c), node.meta) - return - } - fmt.Fprintf(w, "%s %s\n", edge, val) -} - -func isEnded(levelsEnded []int, level int) bool { - for _, l := range levelsEnded { - if l == level { - return true - } - } - - return false -} - -func dumpVal(level int, node *node) string { - lines := strings.Split(node.val, "\n") - if len(lines) < 2 { - return node.val - } - - pad := indent(level, node) - for i := 1; i < len(lines); i++ { - lines[i] = fmt.Sprintf("%s%s", pad, lines[i]) - } - - return strings.Join(lines, "\n") -} - -func indent(level int, node *node) string { - links := make([]string, level+1) - for node.parent != nil { - if isLast(node) { - links[level] = strings.Repeat(" ", indentSize+1) - } else { - links[level] = fmt.Sprintf("%s%s", link, strings.Repeat(" ", indentSize)) - } - level-- - node = node.parent - } - - return strings.Join(links, "") -} - -func isLast(n *node) bool { - return n == n.parent.lastNode() -} diff --git a/vendor/github.com/cilium/cilium/pkg/health/defaults/defaults.go b/vendor/github.com/cilium/cilium/pkg/health/defaults/defaults.go deleted file mode 100644 index d84cecd2c..000000000 --- a/vendor/github.com/cilium/cilium/pkg/health/defaults/defaults.go +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package defaults - -import ( - daemon "github.com/cilium/cilium/pkg/defaults" -) - -const ( - // SockPath is the path to the UNIX domain socket exposing the API to clients locally - SockPath = daemon.RuntimePath + "/health.sock" - - // SockPathEnv is the environment variable to overwrite SockPath - SockPathEnv = "CILIUM_HEALTH_SOCK" - - // HTTPPathPort is used for probing base HTTP path connectivity - HTTPPathPort = daemon.ClusterHealthPort - - // HealthEPName is the name used for the health endpoint, which is also - // used by the CLI client to detect when connectivity health is enabled - HealthEPName = "cilium-health-ep" -) diff --git a/vendor/github.com/cilium/cilium/pkg/healthv2/cell.go b/vendor/github.com/cilium/cilium/pkg/healthv2/cell.go deleted file mode 100644 index 84fc011c6..000000000 --- a/vendor/github.com/cilium/cilium/pkg/healthv2/cell.go +++ /dev/null @@ -1,58 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package healthv2 - -import ( - "github.com/cilium/hive/cell" - - "github.com/cilium/cilium/pkg/healthv2/types" - "github.com/cilium/cilium/pkg/statedb" - "github.com/cilium/cilium/pkg/statedb/index" -) - -var Cell = cell.Module( - "healthv2", - "Modular Health Provider V2", - cell.ProvidePrivate(newTablesPrivate), - cell.Provide( - newHealthV2Provider, - statedb.RWTable[types.Status].ToTable, - ), -) - -var ( - PrimaryIndex = statedb.Index[types.Status, types.HealthID]{ - Name: "identifier", - FromObject: func(s types.Status) index.KeySet { - return index.NewKeySet([]byte(s.ID.String())) - }, - FromKey: func(k types.HealthID) index.Key { - return index.Key([]byte(k)) - }, - Unique: true, - } - LevelIndex = statedb.Index[types.Status, types.Level]{ - Name: "level", - FromObject: func(s types.Status) index.KeySet { - return index.NewKeySet([]byte(s.Level)) - }, - FromKey: func(key types.Level) index.Key { - return index.Key([]byte(key)) - }, - Unique: false, - } -) - -func newTablesPrivate(db *statedb.DB) (statedb.RWTable[types.Status], error) { - statusTable, err := statedb.NewTable(HealthTableName, - PrimaryIndex, - LevelIndex) - if err != nil { - return nil, err - } - if err := db.RegisterTable(statusTable); err != nil { - return nil, err - } - return statusTable, nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/healthv2/provider.go b/vendor/github.com/cilium/cilium/pkg/healthv2/provider.go deleted file mode 100644 index 0b38dab29..000000000 --- a/vendor/github.com/cilium/cilium/pkg/healthv2/provider.go +++ /dev/null @@ -1,223 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package healthv2 - -import ( - "context" - "fmt" - "sync/atomic" - - "github.com/cilium/hive/cell" - - "github.com/cilium/cilium/pkg/healthv2/types" - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/statedb" - "github.com/cilium/cilium/pkg/time" -) - -var logger = logging.DefaultLogger.WithField(logfields.LogSubsys, "healthv2") - -type HealthProviderParams struct { - cell.In - - DB *statedb.DB - Lifecycle cell.Lifecycle - StatusTable statedb.RWTable[types.Status] -} - -type HealthProvider struct { - db *statedb.DB - - stopped atomic.Bool - statusTable statedb.RWTable[types.Status] -} - -const HealthTableName = "health" - -func newHealthV2Provider(params HealthProviderParams) types.Provider { - p := &HealthProvider{ - statusTable: params.StatusTable, - db: params.DB, - } - params.Lifecycle.Append(p) - return p -} - -func (p *HealthProvider) Start(ctx cell.HookContext) error { - return nil -} - -func (p *HealthProvider) Stop(ctx cell.HookContext) error { - p.stopped.Store(true) - tx := p.db.ReadTxn() - iter, _ := p.statusTable.All(tx) - for { - s, rev, ok := iter.Next() - if !ok { - break - } - logger.Infof("%s (rev=%d)", s.ID.String(), rev) - } - return nil -} - -func (p *HealthProvider) ForModule(mid cell.FullModuleID) cell.Health { - return &moduleReporter{ - id: types.Identifier{Module: mid}, - upsert: func(s types.Status) error { - if p.stopped.Load() { - return fmt.Errorf("provider is stopped, no more updates will take place") - } - tx := p.db.WriteTxn(p.statusTable) - defer tx.Abort() - old, _, found := p.statusTable.First(tx, PrimaryIndex.QueryFromObject(s)) - if found && !old.Stopped.IsZero() { - return fmt.Errorf("reporting for %q has been stopped", s.ID) - } - s.Count = 1 - // If a similar status already exists, increment count, otherwise start back - // at zero. - if found && old.Level == s.Level && old.Message == s.Message { - s.Count = old.Count + 1 - } - if _, _, err := p.statusTable.Insert(tx, s); err != nil { - return fmt.Errorf("upsert status %s: %w", s, err) - } - - logger.WithField("reporter-id", s.ID.String()). - WithField("status", s). - Debugf("upserting health status") - tx.Commit() - return nil - }, - deletePrefix: func(i types.Identifier) error { - if p.stopped.Load() { - return fmt.Errorf("provider is stopped, no more updates will take place") - } - tx := p.db.WriteTxn(p.statusTable) - defer tx.Abort() - q := PrimaryIndex.Query(types.HealthID(i.String())) - iter, _ := p.statusTable.LowerBound(tx, q) - var deleted int - for { - o, _, ok := iter.Next() - if !ok { - break - } - if _, _, err := p.statusTable.Delete(tx, types.Status{ - ID: o.ID, - }); err != nil { - return fmt.Errorf("deleting prunable child %s: %w", i, err) - } - deleted++ - } - - logger.WithField("prefix", i). - WithField("deleted", deleted). - Debugf("delete health sub-tree") - tx.Commit() - return nil - }, - stop: func(i types.Identifier) error { - if p.stopped.Load() { - return fmt.Errorf("provider is stopped, no more updates will take place") - } - tx := p.db.WriteTxn(p.statusTable) - defer tx.Abort() - old, _, found := p.statusTable.First(tx, PrimaryIndex.QueryFromObject(types.Status{ID: i})) - if found && !old.Stopped.IsZero() { - return fmt.Errorf("reporting for %q has been stopped", i) - } - old.Stopped = time.Now() - if _, _, err := p.statusTable.Insert(tx, old); err != nil { - return fmt.Errorf("stopping reporter - upsert status %s: %w", old, err) - } - tx.Commit() - logger.WithField("reporter-id", i.String()). - Debugf("stopping health reporter") - return nil - }, - providerStopped: p.stopped.Load, - } -} - -type moduleReporter struct { - id types.Identifier - stopped atomic.Bool - providerStopped func() bool - upsert func(types.Status) error - stop func(types.Identifier) error - deletePrefix func(types.Identifier) error -} - -func (r *moduleReporter) newScope(name string) *moduleReporter { - return &moduleReporter{ - id: r.id.WithSubComponent(name), - upsert: r.upsert, - deletePrefix: r.deletePrefix, - stop: r.stop, - } -} - -func (r *moduleReporter) NewScope(name string) cell.Health { - return r.newScope(name) -} - -func (r *moduleReporter) NewScopeWithContext(ctx context.Context, name string) cell.Health { - s := r.newScope(name) - go func() { - <-ctx.Done() - s.stopped.Store(true) - s.Close() - }() - return s -} - -func (r *moduleReporter) OK(msg string) { - if r.stopped.Load() { - logger.WithField("id", r.id).Warn("report on stopped reporter") - } - ts := time.Now() - if err := r.upsert(types.Status{ - ID: r.id, - Level: types.LevelOK, - Message: msg, - LastOK: ts, - Updated: ts, - }); err != nil { - logger.WithError(err).Errorf("failed to upsert ok health status") - } -} - -func (r *moduleReporter) Degraded(msg string, err error) { - if r.stopped.Load() { - logger.WithField("id", r.id).Warn("report on stopped reporter") - } - if err := r.upsert(types.Status{ - ID: r.id, - Level: types.LevelDegraded, - Error: err, - Updated: time.Now(), - }); err != nil { - logger.WithError(err).Errorf("failed to upsert degraded health status") - } -} - -// Stopped declares a reporter scope stopped, and will block further updates to it while -// maintaining the last known status of the reporter. -func (r *moduleReporter) Stopped(msg string) { - r.stopped.Store(true) - if err := r.stop(r.id); err != nil { - logger.WithError(err).Error("failed to delete reporter status tree") - } -} - -// Close completely closes out a tree, it will remove all health statuses below -// this reporter scope. -func (r *moduleReporter) Close() { - if err := r.deletePrefix(r.id); err != nil { - logger.WithError(err).Error("failed to delete reporter status tree") - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/healthv2/types.go b/vendor/github.com/cilium/cilium/pkg/healthv2/types.go deleted file mode 100644 index 7ec3d0faa..000000000 --- a/vendor/github.com/cilium/cilium/pkg/healthv2/types.go +++ /dev/null @@ -1,4 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package healthv2 diff --git a/vendor/github.com/cilium/cilium/pkg/healthv2/types/types.go b/vendor/github.com/cilium/cilium/pkg/healthv2/types/types.go deleted file mode 100644 index 2ff95860a..000000000 --- a/vendor/github.com/cilium/cilium/pkg/healthv2/types/types.go +++ /dev/null @@ -1,86 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package types - -import ( - "fmt" - "strings" - "time" - - "github.com/cilium/hive/cell" -) - -// Provider has functionality to create health reporters, scoped a -// module. -type Provider interface { - ForModule(mid cell.FullModuleID) cell.Health -} - -type pathIdent []string - -func (p pathIdent) String() string { - if len(p) == 0 { - return "" - } - return strings.Join(p, ".") -} - -// HealthID is used as the key for the primary index for health status -// tables. -type HealthID string - -// Identifier is a fully qualified, path based identifier for health status -// which is made up of module ID and component ID parts. -type Identifier struct { - Module cell.FullModuleID - Component pathIdent -} - -// WithSubComponent returns view of an identifier with an appended -// subcomponent. -func (i Identifier) WithSubComponent(name string) Identifier { - return Identifier{ - Module: i.Module, - Component: append(i.Component, name), - } -} - -func (i Identifier) String() string { - return strings.Join([]string{i.Module.String(), i.Component.String()}, ".") -} - -// Status represents a current health status update. -type Status struct { - ID Identifier - Level Level - Message string - Error error - LastOK time.Time - Updated time.Time - Stopped time.Time - // Final is the final message set when a status is stopped. - Final string - Count uint64 -} - -func (Status) TableHeader() []string { - return []string{"Module", "Component", "Level", "Message", "LastOK", "UpdatedAt", "Count"} -} - -func (s Status) TableRow() []string { - return []string{s.ID.Module.String(), s.ID.Component.String(), string(s.Level), s.Message, s.LastOK.Format(time.RFC3339), - s.Updated.Format(time.RFC3339), fmt.Sprintf("%d", s.Count)} -} - -func (s Status) String() string { - return fmt.Sprintf("%s: [%s] %s", s.ID.String(), s.Level, s.Message) -} - -type Level string - -const ( - LevelOK = "OK" - LevelDegraded = "Degraded" - LevelStopped = "Stopped" -) diff --git a/vendor/github.com/cilium/cilium/pkg/hive/hive.go b/vendor/github.com/cilium/cilium/pkg/hive/hive.go deleted file mode 100644 index 87c3158ef..000000000 --- a/vendor/github.com/cilium/cilium/pkg/hive/hive.go +++ /dev/null @@ -1,103 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package hive - -import ( - "log/slog" - "reflect" - "runtime/pprof" - "time" - - upstream "github.com/cilium/hive" - "github.com/cilium/hive/cell" - "github.com/cilium/hive/job" - "github.com/sirupsen/logrus" - "golang.org/x/exp/slices" - - "github.com/cilium/cilium/pkg/cidr" - "github.com/cilium/cilium/pkg/healthv2" - healthTypes "github.com/cilium/cilium/pkg/healthv2/types" - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/statedb" - "github.com/cilium/cilium/pkg/statedb/reconciler" -) - -type ( - Hive = upstream.Hive - Options = upstream.Options - Shutdowner = upstream.Shutdowner -) - -var ( - ShutdownWithError = upstream.ShutdownWithError -) - -// New wraps the hive.New to create a hive with defaults used by cilium-agent. -// pkg/hive should eventually go away and this code should live in e.g. daemon/cmd -// or operator/cmd. -func New(cells ...cell.Cell) *Hive { - cells = append( - slices.Clone(cells), - - healthv2.Cell, - job.Cell, - statedb.Cell, - reconciler.Cell, - - cell.Provide( - func() logrus.FieldLogger { return logging.DefaultLogger }, - func(provider healthTypes.Provider) cell.Health { - return provider.ForModule(nil) - }, - )) - // Scope logging and health by module ID. - moduleDecorators := []cell.ModuleDecorator{ - func(log logrus.FieldLogger, mid cell.ModuleID) logrus.FieldLogger { - return log.WithField(logfields.LogSubsys, mid) - }, - func(hp healthTypes.Provider, fmid cell.FullModuleID) cell.Health { - return hp.ForModule(fmid) - }, - } - return upstream.NewWithOptions( - upstream.Options{ - EnvPrefix: "CILIUM_", - ModulePrivateProviders: []cell.ModulePrivateProvider{jobGroupProvider}, - ModuleDecorators: moduleDecorators, - DecodeHooks: decodeHooks, - StartTimeout: 5 * time.Minute, - StopTimeout: 1 * time.Minute, - LogThreshold: 100 * time.Millisecond, - }, - cells..., - ) -} - -var decodeHooks = cell.DecodeHooks{ - // Decode *cidr.CIDR fields - func(from reflect.Type, to reflect.Type, data interface{}) (interface{}, error) { - if from.Kind() != reflect.String { - return data, nil - } - s := data.(string) - if to != reflect.TypeOf((*cidr.CIDR)(nil)) { - return data, nil - } - return cidr.ParseCIDR(s) - }, -} - -func AddConfigOverride[Cfg cell.Flagger](h *Hive, override func(*Cfg)) { - upstream.AddConfigOverride[Cfg](h, override) -} - -// jobGroupProvider provides a (private) job group to modules, with scoped health reporting, logging and metrics. -func jobGroupProvider(reg job.Registry, h cell.Health, l *slog.Logger, lc cell.Lifecycle, mid cell.ModuleID) job.Group { - g := reg.NewGroup(h, - job.WithLogger(l), - job.WithPprofLabels(pprof.Labels("cell", string(mid)))) - lc.Append(g) - return g -} diff --git a/vendor/github.com/cilium/cilium/pkg/hubble/api/v1/interface.go b/vendor/github.com/cilium/cilium/pkg/hubble/api/v1/interface.go deleted file mode 100644 index 6854993eb..000000000 --- a/vendor/github.com/cilium/cilium/pkg/hubble/api/v1/interface.go +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Hubble - -package v1 - -import ( - "github.com/cilium/cilium/pkg/identity" - slim_corev1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - "github.com/cilium/cilium/pkg/labels" - "github.com/cilium/cilium/pkg/policy" -) - -// EndpointInfo defines readable fields of a Cilium endpoint. -type EndpointInfo interface { - GetID() uint64 - GetIdentity() identity.NumericIdentity - GetK8sPodName() string - GetK8sNamespace() string - GetLabels() []string - GetPod() *slim_corev1.Pod - GetRealizedPolicyRuleLabelsForKey(key policy.Key) (derivedFrom labels.LabelArrayList, revision uint64, ok bool) -} diff --git a/vendor/github.com/cilium/cilium/pkg/hubble/filters/filters.go b/vendor/github.com/cilium/cilium/pkg/hubble/filters/filters.go index 90dc3bb28..d50741ad4 100644 --- a/vendor/github.com/cilium/cilium/pkg/hubble/filters/filters.go +++ b/vendor/github.com/cilium/cilium/pkg/hubble/filters/filters.go @@ -148,5 +148,6 @@ func DefaultFilters(log logrus.FieldLogger) []OnBuildFilter { &TraceIDFilter{}, &TrafficDirectionFilter{}, &CELExpressionFilter{log: log}, + &NetworkInterfaceFilter{}, } } diff --git a/vendor/github.com/cilium/cilium/pkg/hubble/filters/ip.go b/vendor/github.com/cilium/cilium/pkg/hubble/filters/ip.go index c857b48d4..5f6354191 100644 --- a/vendor/github.com/cilium/cilium/pkg/hubble/filters/ip.go +++ b/vendor/github.com/cilium/cilium/pkg/hubble/filters/ip.go @@ -21,6 +21,10 @@ func destinationIP(ev *v1.Event) string { return ev.GetFlow().GetIP().GetDestination() } +func sourceIPXlated(ev *v1.Event) string { + return ev.GetFlow().GetIP().GetSourceXlated() +} + func filterByIPs(ips []string, getIP func(*v1.Event) string) (FilterFunc, error) { // IP filter can either be an exact match (e.g. "1.1.1.1") or a CIDR range // (e.g. "1.1.1.0/24"). Put them into 2 separate lists here. @@ -90,6 +94,14 @@ func (f *IPFilter) OnBuildFilter(ctx context.Context, ff *flowpb.FlowFilter) ([] fs = append(fs, ipf) } + if ff.GetSourceIpXlated() != nil { + ipf, err := filterByIPs(ff.GetSourceIpXlated(), sourceIPXlated) + if err != nil { + return nil, err + } + fs = append(fs, ipf) + } + return fs, nil } diff --git a/vendor/github.com/cilium/cilium/pkg/hubble/filters/network_interface.go b/vendor/github.com/cilium/cilium/pkg/hubble/filters/network_interface.go new file mode 100644 index 000000000..a5510d0fd --- /dev/null +++ b/vendor/github.com/cilium/cilium/pkg/hubble/filters/network_interface.go @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Authors of Hubble + +package filters + +import ( + "context" + + flowpb "github.com/cilium/cilium/api/v1/flow" + v1 "github.com/cilium/cilium/pkg/hubble/api/v1" +) + +func filterByNetworkInterface(ifaces []*flowpb.NetworkInterface) FilterFunc { + return func(ev *v1.Event) bool { + iface := ev.GetFlow().GetInterface() + if iface == nil { + return false + } + for _, f := range ifaces { + if idx := f.GetIndex(); idx > 0 && idx != iface.GetIndex() { + continue + } + if name := f.GetName(); name != "" && name != iface.GetName() { + continue + } + return true + } + return false + } +} + +// NetworkInterfaceFilter implements filtering based on flow network interface. +type NetworkInterfaceFilter struct{} + +// OnBuildFilter builds a a flow network interface filter. +func (e *NetworkInterfaceFilter) OnBuildFilter(ctx context.Context, ff *flowpb.FlowFilter) ([]FilterFunc, error) { + var fs []FilterFunc + + if ifaces := ff.GetInterface(); len(ifaces) > 0 { + fs = append(fs, filterByNetworkInterface(ifaces)) + } + + return fs, nil +} diff --git a/vendor/github.com/cilium/cilium/pkg/iana/svcname.go b/vendor/github.com/cilium/cilium/pkg/iana/svcname.go deleted file mode 100644 index f888b87e1..000000000 --- a/vendor/github.com/cilium/cilium/pkg/iana/svcname.go +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package iana - -import ( - "regexp" -) - -// IANA Service Name consists of alphanumeric characters of which at -// least one is not a number, as well as non-consecutive dashes ('-') -// except for in the beginning or the end. -// Note: Character case must be ignored when comparing service names. -var isSvcName = regexp.MustCompile(`^([a-zA-Z0-9]-?)*[a-zA-Z](-?[a-zA-Z0-9])*$`).MatchString - -// IsSvcName returns true if the string conforms to IANA Service Name specification -// (RFC 6335 Section 5.1. Service Name Syntax) -func IsSvcName(name string) bool { - return len(name) > 0 && len(name) <= 15 && isSvcName(name) -} diff --git a/vendor/github.com/cilium/cilium/pkg/identity/cache/allocator.go b/vendor/github.com/cilium/cilium/pkg/identity/cache/allocator.go deleted file mode 100644 index 2a01495f6..000000000 --- a/vendor/github.com/cilium/cilium/pkg/identity/cache/allocator.go +++ /dev/null @@ -1,551 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package cache - -import ( - "context" - "errors" - "fmt" - "path" - - "github.com/cilium/stream" - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/pkg/allocator" - "github.com/cilium/cilium/pkg/identity" - "github.com/cilium/cilium/pkg/identity/key" - "github.com/cilium/cilium/pkg/idpool" - clientset "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned" - "github.com/cilium/cilium/pkg/k8s/identitybackend" - "github.com/cilium/cilium/pkg/kvstore" - kvstoreallocator "github.com/cilium/cilium/pkg/kvstore/allocator" - "github.com/cilium/cilium/pkg/labels" - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/metrics" - "github.com/cilium/cilium/pkg/option" -) - -var ( - // IdentitiesPath is the path to where identities are stored in the - // key-value store. - IdentitiesPath = path.Join(kvstore.BaseKeyPrefix, "state", "identities", "v1") -) - -// CachingIdentityAllocator manages the allocation of identities for both -// global and local identities. -type CachingIdentityAllocator struct { - // IdentityAllocator is an allocator for security identities from the - // kvstore. - IdentityAllocator *allocator.Allocator - - // globalIdentityAllocatorInitialized is closed whenever the global identity - // allocator is initialized. - globalIdentityAllocatorInitialized chan struct{} - - localIdentities *localIdentityCache - - localNodeIdentities *localIdentityCache - - identitiesPath string - - // This field exists is to hand out references that are either for sending - // and receiving. It should not be used directly without converting it first - // to a AllocatorEventSendChan or AllocatorEventRecvChan. - events allocator.AllocatorEventChan - watcher identityWatcher - - // setupMutex synchronizes InitIdentityAllocator() and Close() - setupMutex lock.Mutex - - owner IdentityAllocatorOwner -} - -// IdentityAllocatorOwner is the interface the owner of an identity allocator -// must implement -type IdentityAllocatorOwner interface { - // UpdateIdentities will be called when identities have changed - // - // The caller is responsible for making sure the same identity - // is not present in both 'added' and 'deleted', so that they - // can be processed in either order. - UpdateIdentities(added, deleted IdentityCache) - - // GetSuffix must return the node specific suffix to use - GetNodeSuffix() string -} - -// IdentityAllocator is any type which is responsible for allocating security -// identities based of sets of labels, and caching information about identities -// locally. -type IdentityAllocator interface { - // Identity changes are observable. - stream.Observable[IdentityChange] - - // WaitForInitialGlobalIdentities waits for the initial set of global - // security identities to have been received. - WaitForInitialGlobalIdentities(context.Context) error - - // AllocateIdentity allocates an identity described by the specified labels. - // A possible previously used numeric identity for these labels can be passed - // in as the last parameter; identity.InvalidIdentity must be passed if no - // previous numeric identity exists. - AllocateIdentity(context.Context, labels.Labels, bool, identity.NumericIdentity) (*identity.Identity, bool, error) - - // Release is the reverse operation of AllocateIdentity() and releases the - // specified identity. - Release(context.Context, *identity.Identity, bool) (released bool, err error) - - // LookupIdentityByID returns the identity that corresponds to the given - // labels. - LookupIdentity(ctx context.Context, lbls labels.Labels) *identity.Identity - - // LookupIdentityByID returns the identity that corresponds to the given - // numeric identity. - LookupIdentityByID(ctx context.Context, id identity.NumericIdentity) *identity.Identity - - // GetIdentityCache returns the current cache of identities that the - // allocator has allocated. The caller should not modify the resulting - // identities by pointer. - GetIdentityCache() IdentityCache - - // GetIdentities returns a copy of the current cache of identities. - GetIdentities() IdentitiesModel - - // WithholdLocalIdentities holds a set of numeric identities out of the local - // allocation pool(s). Once withheld, a numeric identity can only be used - // when explicitly requested via AllocateIdentity(..., oldNID). - WithholdLocalIdentities(nids []identity.NumericIdentity) - - // UnwithholdLocalIdentities removes numeric identities from the withheld set, - // freeing them for general allocation. - UnwithholdLocalIdentities(nids []identity.NumericIdentity) -} - -// InitIdentityAllocator creates the global identity allocator. Only the first -// invocation of this function will have an effect. The Caller must have -// initialized well known identities before calling this (by calling -// identity.InitWellKnownIdentities()). -// The client is only used by the CRD identity allocator currently. -// Returns a channel which is closed when initialization of the allocator is -// completed. -// TODO: identity backends are initialized directly in this function, pulling -// in dependencies on kvstore and k8s. It would be better to decouple this, -// since the backends are an interface. -func (m *CachingIdentityAllocator) InitIdentityAllocator(client clientset.Interface) <-chan struct{} { - m.setupMutex.Lock() - defer m.setupMutex.Unlock() - - if m.IdentityAllocator != nil { - log.Panic("InitIdentityAllocator() in succession without calling Close()") - } - - log.Info("Initializing identity allocator") - - minID := idpool.ID(identity.GetMinimalAllocationIdentity()) - maxID := idpool.ID(identity.GetMaximumAllocationIdentity()) - - log.WithFields(map[string]interface{}{ - "min": minID, - "max": maxID, - "cluster-id": option.Config.ClusterID, - }).Info("Allocating identities between range") - - // In the case of the allocator being closed, we need to create a new events channel - // and start a new watch. - if m.events == nil { - m.events = make(allocator.AllocatorEventChan, eventsQueueSize) - m.watcher.watch(m.events) - } - - // Asynchronously set up the global identity allocator since it connects - // to the kvstore. - go func(owner IdentityAllocatorOwner, events allocator.AllocatorEventSendChan, minID, maxID idpool.ID) { - m.setupMutex.Lock() - defer m.setupMutex.Unlock() - - var ( - backend allocator.Backend - err error - ) - - switch option.Config.IdentityAllocationMode { - case option.IdentityAllocationModeKVstore: - log.Debug("Identity allocation backed by KVStore") - backend, err = kvstoreallocator.NewKVStoreBackend(m.identitiesPath, owner.GetNodeSuffix(), &key.GlobalIdentity{}, kvstore.Client()) - if err != nil { - log.WithError(err).Fatal("Unable to initialize kvstore backend for identity allocation") - } - - case option.IdentityAllocationModeCRD: - log.Debug("Identity allocation backed by CRD") - backend, err = identitybackend.NewCRDBackend(identitybackend.CRDBackendConfiguration{ - Store: nil, - Client: client, - KeyFunc: (&key.GlobalIdentity{}).PutKeyFromMap, - }) - if err != nil { - log.WithError(err).Fatal("Unable to initialize Kubernetes CRD backend for identity allocation") - } - - default: - log.Fatalf("Unsupported identity allocation mode %s", option.Config.IdentityAllocationMode) - } - - a, err := allocator.NewAllocator(&key.GlobalIdentity{}, backend, - allocator.WithMax(maxID), allocator.WithMin(minID), - allocator.WithEvents(events), - allocator.WithMasterKeyProtection(), - allocator.WithPrefixMask(idpool.ID(option.Config.ClusterID< identity.MaxNumericIdentity { - return nil, false, fmt.Errorf("%d: numeric identity too large", idp) - } - - if option.Config.Debug { - log.WithFields(logrus.Fields{ - logfields.Identity: idp, - logfields.IdentityLabels: lbls.String(), - "isNew": isNew, - "isNewLocally": isNewLocally, - }).Debug("Resolved identity") - } - - return identity.NewIdentity(identity.NumericIdentity(idp), lbls), isNew, nil -} - -func (m *CachingIdentityAllocator) WithholdLocalIdentities(nids []identity.NumericIdentity) { - log.WithField(logfields.Identity, nids).Debug("Withholding numeric identities for later restoration") - - // The allocators will return any identities that are not in-scope. - nids = m.localIdentities.withhold(nids) - nids = m.localNodeIdentities.withhold(nids) - if len(nids) > 0 { - log.WithField(logfields.Identity, nids).Error("Attempt to restore invalid numeric identities.") - } -} - -func (m *CachingIdentityAllocator) UnwithholdLocalIdentities(nids []identity.NumericIdentity) { - log.WithField(logfields.Identity, nids).Debug("Unwithholding numeric identities") - - // The allocators will ignore any identities that are not in-scope. - m.localIdentities.unwithhold(nids) - m.localNodeIdentities.unwithhold(nids) -} - -// Release is the reverse operation of AllocateIdentity() and releases the -// identity again. This function may result in kvstore operations. -// After the last user has released the ID, the returned lastUse value is true. -func (m *CachingIdentityAllocator) Release(ctx context.Context, id *identity.Identity, notifyOwner bool) (released bool, err error) { - defer func() { - if released { - if id.ID.HasLocalScope() { - metrics.Identity.WithLabelValues(identity.NodeLocalIdentityType).Dec() - } else if id.ID.HasRemoteNodeScope() { - metrics.Identity.WithLabelValues(identity.RemoteNodeIdentityType).Dec() - } else if id.ID.IsReservedIdentity() { - metrics.Identity.WithLabelValues(identity.ReservedIdentityType).Dec() - } else { - metrics.Identity.WithLabelValues(identity.ClusterLocalIdentityType).Dec() - } - } - if m.owner != nil && released && notifyOwner { - deleted := IdentityCache{ - id.ID: id.LabelArray, - } - m.owner.UpdateIdentities(nil, deleted) - } - }() - - // Ignore reserved identities. - if id.IsReserved() { - return false, nil - } - - switch identity.ScopeForLabels(id.Labels) { - case identity.IdentityScopeLocal: - return m.localIdentities.release(id, notifyOwner), nil - case identity.IdentityScopeRemoteNode: - return m.localNodeIdentities.release(id, notifyOwner), nil - } - - // This will block until the kvstore can be accessed and all identities - // were successfully synced - err = m.WaitForInitialGlobalIdentities(ctx) - if err != nil { - return false, err - } - - if m.IdentityAllocator == nil { - return false, fmt.Errorf("allocator not initialized") - } - - // Rely on the eventual Kv-Store events for delete - // notifications of kv-store allocated identities. Even if an - // ID is no longer used locally, it may still be used by - // remote nodes, so we can't rely on the locally computed - // "lastUse". - return m.IdentityAllocator.Release(ctx, &key.GlobalIdentity{LabelArray: id.LabelArray}) -} - -// WatchRemoteIdentities returns a RemoteCache instance which can be later -// started to watch identities in another kvstore and sync them to the local -// identity cache. remoteName should be unique unless replacing an existing -// remote's backend. When cachedPrefix is set, identities are assumed to be -// stored under the "cilium/cache" prefix, and the watcher is adapted accordingly. -func (m *CachingIdentityAllocator) WatchRemoteIdentities(remoteName string, backend kvstore.BackendOperations, cachedPrefix bool) (*allocator.RemoteCache, error) { - <-m.globalIdentityAllocatorInitialized - - prefix := m.identitiesPath - if cachedPrefix { - prefix = path.Join(kvstore.StateToCachePrefix(prefix), remoteName) - } - - remoteAllocatorBackend, err := kvstoreallocator.NewKVStoreBackend(prefix, m.owner.GetNodeSuffix(), &key.GlobalIdentity{}, backend) - if err != nil { - return nil, fmt.Errorf("error setting up remote allocator backend: %w", err) - } - - remoteAlloc, err := allocator.NewAllocator(&key.GlobalIdentity{}, remoteAllocatorBackend, - allocator.WithEvents(m.IdentityAllocator.GetEvents()), allocator.WithoutGC(), allocator.WithoutAutostart()) - if err != nil { - return nil, fmt.Errorf("unable to initialize remote Identity Allocator: %w", err) - } - - return m.IdentityAllocator.NewRemoteCache(remoteName, remoteAlloc), nil -} - -func (m *CachingIdentityAllocator) RemoveRemoteIdentities(name string) { - if m.IdentityAllocator != nil { - m.IdentityAllocator.RemoveRemoteKVStore(name) - } -} - -type IdentityChangeKind string - -const ( - IdentityChangeSync IdentityChangeKind = IdentityChangeKind(allocator.AllocatorChangeSync) - IdentityChangeUpsert IdentityChangeKind = IdentityChangeKind(allocator.AllocatorChangeUpsert) - IdentityChangeDelete IdentityChangeKind = IdentityChangeKind(allocator.AllocatorChangeDelete) -) - -type IdentityChange struct { - Kind IdentityChangeKind - ID identity.NumericIdentity - Labels labels.Labels -} - -// Observe the identity changes. Conforms to stream.Observable. -// Replays the current state of the cache when subscribing. -func (m *CachingIdentityAllocator) Observe(ctx context.Context, next func(IdentityChange), complete func(error)) { - // This short-lived go routine serves the purpose of waiting for the global identity allocator becoming ready - // before starting to observe the underlying allocator for changes. - // m.IdentityAllocator is backed by a stream.FuncObservable, that will start its own - // go routine. Therefore, the current go routine will stop and free the lock on the setupMutex after the registration. - go func() { - if err := m.WaitForInitialGlobalIdentities(ctx); err != nil { - complete(ctx.Err()) - return - } - - m.setupMutex.Lock() - defer m.setupMutex.Unlock() - - if m.IdentityAllocator == nil { - complete(errors.New("allocator no longer initialized")) - return - } - - // Observe the underlying allocator for changes and map the events to identities. - stream.Map[allocator.AllocatorChange, IdentityChange]( - m.IdentityAllocator, - func(change allocator.AllocatorChange) IdentityChange { - return IdentityChange{ - Kind: IdentityChangeKind(change.Kind), - ID: identity.NumericIdentity(change.ID), - Labels: mapLabels(change.Key), - } - }, - ).Observe(ctx, next, complete) - }() -} - -func mapLabels(allocatorKey allocator.AllocatorKey) labels.Labels { - var idLabels labels.Labels = nil - - if allocatorKey != nil { - idLabels = labels.Labels{} - for k, v := range allocatorKey.GetAsMap() { - label := labels.ParseLabel(k + "=" + v) - idLabels[label.Key] = label - } - } - - return idLabels -} diff --git a/vendor/github.com/cilium/cilium/pkg/identity/cache/cache.go b/vendor/github.com/cilium/cilium/pkg/identity/cache/cache.go deleted file mode 100644 index 7a0b4c194..000000000 --- a/vendor/github.com/cilium/cilium/pkg/identity/cache/cache.go +++ /dev/null @@ -1,280 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package cache - -import ( - "context" - "reflect" - - "github.com/cilium/cilium/api/v1/models" - "github.com/cilium/cilium/pkg/allocator" - "github.com/cilium/cilium/pkg/identity" - "github.com/cilium/cilium/pkg/identity/key" - identitymodel "github.com/cilium/cilium/pkg/identity/model" - "github.com/cilium/cilium/pkg/idpool" - "github.com/cilium/cilium/pkg/kvstore" - "github.com/cilium/cilium/pkg/labels" - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" -) - -var ( - log = logging.DefaultLogger.WithField(logfields.LogSubsys, "identity-cache") -) - -// IdentityCache is a cache of identity to labels mapping -type IdentityCache map[identity.NumericIdentity]labels.LabelArray - -// IdentitiesModel is a wrapper so that we can implement the sort.Interface -// to sort the slice by ID -type IdentitiesModel []*models.Identity - -// Less returns true if the element in index `i` is lower than the element -// in index `j` -func (s IdentitiesModel) Less(i, j int) bool { - return s[i].ID < s[j].ID -} - -// FromIdentityCache populates the provided model from an identity cache. -func (s IdentitiesModel) FromIdentityCache(cache IdentityCache) IdentitiesModel { - for id, lbls := range cache { - s = append(s, identitymodel.CreateModel(&identity.Identity{ - ID: id, - Labels: lbls.Labels(), - })) - } - return s -} - -// GetIdentityCache returns a cache of all known identities -func (m *CachingIdentityAllocator) GetIdentityCache() IdentityCache { - log.Debug("getting identity cache for identity allocator manager") - cache := IdentityCache{} - - if m.isGlobalIdentityAllocatorInitialized() { - m.IdentityAllocator.ForeachCache(func(id idpool.ID, val allocator.AllocatorKey) { - if val != nil { - if gi, ok := val.(*key.GlobalIdentity); ok { - cache[identity.NumericIdentity(id)] = gi.LabelArray - } else { - log.Warningf("Ignoring unknown identity type '%s': %+v", - reflect.TypeOf(val), val) - } - } - }) - } - - identity.IterateReservedIdentities(func(ni identity.NumericIdentity, id *identity.Identity) { - cache[ni] = id.Labels.LabelArray() - }) - - for _, identity := range m.localIdentities.GetIdentities() { - cache[identity.ID] = identity.Labels.LabelArray() - } - for _, identity := range m.localNodeIdentities.GetIdentities() { - cache[identity.ID] = identity.Labels.LabelArray() - } - - return cache -} - -// GetIdentities returns all known identities -func (m *CachingIdentityAllocator) GetIdentities() IdentitiesModel { - identities := IdentitiesModel{} - - if m.isGlobalIdentityAllocatorInitialized() { - m.IdentityAllocator.ForeachCache(func(id idpool.ID, val allocator.AllocatorKey) { - if gi, ok := val.(*key.GlobalIdentity); ok { - identity := identity.NewIdentityFromLabelArray(identity.NumericIdentity(id), gi.LabelArray) - identities = append(identities, identitymodel.CreateModel(identity)) - } - - }) - } - identity.IterateReservedIdentities(func(ni identity.NumericIdentity, id *identity.Identity) { - identities = append(identities, identitymodel.CreateModel(id)) - }) - - for _, v := range m.localIdentities.GetIdentities() { - identities = append(identities, identitymodel.CreateModel(v)) - } - for _, v := range m.localNodeIdentities.GetIdentities() { - identities = append(identities, identitymodel.CreateModel(v)) - } - - return identities -} - -type identityWatcher struct { - owner IdentityAllocatorOwner -} - -// collectEvent records the 'event' as an added or deleted identity, -// and makes sure that any identity is present in only one of the sets -// (added or deleted). -func collectEvent(event allocator.AllocatorEvent, added, deleted IdentityCache) bool { - id := identity.NumericIdentity(event.ID) - // Only create events have the key - if event.Typ == kvstore.EventTypeCreate { - if gi, ok := event.Key.(*key.GlobalIdentity); ok { - // Un-delete the added ID if previously - // 'deleted' so that collected events can be - // processed in any order. - delete(deleted, id) - added[id] = gi.LabelArray - return true - } - log.Warningf("collectEvent: Ignoring unknown identity type '%s': %+v", - reflect.TypeOf(event.Key), event.Key) - return false - } - // Reverse an add when subsequently deleted - delete(added, id) - // record the id deleted even if an add was reversed, as the - // id may also have previously existed, in which case the - // result is not no-op! - deleted[id] = labels.LabelArray{} - - return true -} - -// watch starts the identity watcher -func (w *identityWatcher) watch(events allocator.AllocatorEventRecvChan) { - - go func() { - for { - added := IdentityCache{} - deleted := IdentityCache{} - First: - for { - event, ok := <-events - // Wait for one identity add or delete or stop - if !ok { - // 'events' was closed - return - } - // Collect first added and deleted labels - switch event.Typ { - case kvstore.EventTypeCreate, kvstore.EventTypeDelete: - if collectEvent(event, added, deleted) { - // First event collected - break First - } - default: - // Ignore modify events - } - } - - More: - for { - // see if there is more, but do not wait nor stop - select { - case event, ok := <-events: - if !ok { - // 'events' was closed - break More - } - // Collect more added and deleted labels - switch event.Typ { - case kvstore.EventTypeCreate, kvstore.EventTypeDelete: - collectEvent(event, added, deleted) - default: - // Ignore modify events - } - default: - // No more events available without blocking - break More - } - } - // Issue collected updates - w.owner.UpdateIdentities(added, deleted) // disjoint sets - } - }() -} - -// isGlobalIdentityAllocatorInitialized returns true if m.IdentityAllocator is not nil. -// Note: This does not mean that the identities have been synchronized, -// see WaitForInitialGlobalIdentities to wait for a fully populated cache. -func (m *CachingIdentityAllocator) isGlobalIdentityAllocatorInitialized() bool { - select { - case <-m.globalIdentityAllocatorInitialized: - return m.IdentityAllocator != nil - default: - return false - } -} - -// LookupIdentity looks up the identity by its labels but does not create it. -// This function will first search through the local cache, then the caches for -// remote kvstores and finally fall back to the main kvstore. -// May return nil for lookups if the allocator has not yet been synchronized. -func (m *CachingIdentityAllocator) LookupIdentity(ctx context.Context, lbls labels.Labels) *identity.Identity { - if reservedIdentity := identity.LookupReservedIdentityByLabels(lbls); reservedIdentity != nil { - return reservedIdentity - } - - switch identity.ScopeForLabels(lbls) { - case identity.IdentityScopeLocal: - return m.localIdentities.lookup(lbls) - case identity.IdentityScopeRemoteNode: - return m.localNodeIdentities.lookup(lbls) - } - - if !m.isGlobalIdentityAllocatorInitialized() { - return nil - } - - lblArray := lbls.LabelArray() - id, err := m.IdentityAllocator.GetIncludeRemoteCaches(ctx, &key.GlobalIdentity{LabelArray: lblArray}) - if err != nil { - return nil - } - if id > identity.MaxNumericIdentity { - return nil - } - - if id == idpool.NoID { - return nil - } - - return identity.NewIdentityFromLabelArray(identity.NumericIdentity(id), lblArray) -} - -var unknownIdentity = identity.NewIdentity(identity.IdentityUnknown, labels.Labels{labels.IDNameUnknown: labels.NewLabel(labels.IDNameUnknown, "", labels.LabelSourceReserved)}) - -// LookupIdentityByID returns the identity by ID. This function will first -// search through the local cache, then the caches for remote kvstores and -// finally fall back to the main kvstore -// May return nil for lookups if the allocator has not yet been synchronized. -func (m *CachingIdentityAllocator) LookupIdentityByID(ctx context.Context, id identity.NumericIdentity) *identity.Identity { - if id == identity.IdentityUnknown { - return unknownIdentity - } - - if identity := identity.LookupReservedIdentity(id); identity != nil { - return identity - } - - switch id.Scope() { - case identity.IdentityScopeLocal: - return m.localIdentities.lookupByID(id) - case identity.IdentityScopeRemoteNode: - return m.localNodeIdentities.lookupByID(id) - } - - if !m.isGlobalIdentityAllocatorInitialized() { - return nil - } - - allocatorKey, err := m.IdentityAllocator.GetByIDIncludeRemoteCaches(ctx, idpool.ID(id)) - if err != nil { - return nil - } - - if gi, ok := allocatorKey.(*key.GlobalIdentity); ok { - return identity.NewIdentityFromLabelArray(id, gi.LabelArray) - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/identity/cache/local.go b/vendor/github.com/cilium/cilium/pkg/identity/cache/local.go deleted file mode 100644 index 6a2a67919..000000000 --- a/vendor/github.com/cilium/cilium/pkg/identity/cache/local.go +++ /dev/null @@ -1,265 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package cache - -import ( - "fmt" - - "github.com/cilium/cilium/pkg/allocator" - "github.com/cilium/cilium/pkg/identity" - "github.com/cilium/cilium/pkg/identity/key" - "github.com/cilium/cilium/pkg/idpool" - "github.com/cilium/cilium/pkg/kvstore" - "github.com/cilium/cilium/pkg/labels" - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/logging/logfields" -) - -type localIdentityCache struct { - mutex lock.RWMutex - identitiesByID map[identity.NumericIdentity]*identity.Identity - identitiesByLabels map[string]*identity.Identity - nextNumericIdentity identity.NumericIdentity - scope identity.NumericIdentity - minID identity.NumericIdentity - maxID identity.NumericIdentity - events allocator.AllocatorEventSendChan - - // withheldIdentities is a set of identities that should be considered unavailable for allocation, - // but not yet allocated. - // They are used during agent restart, where local identities are restored to prevent unnecessary - // ID flapping on restart. - // - // If an old nID is passed to lookupOrCreate(), then it is allowed to use a withhend entry here. Otherwise - // it must allocate a new ID not in this set. - withheldIdentities map[identity.NumericIdentity]struct{} -} - -func newLocalIdentityCache(scope, minID, maxID identity.NumericIdentity, events allocator.AllocatorEventSendChan) *localIdentityCache { - return &localIdentityCache{ - identitiesByID: map[identity.NumericIdentity]*identity.Identity{}, - identitiesByLabels: map[string]*identity.Identity{}, - nextNumericIdentity: minID, - scope: scope, - minID: minID, - maxID: maxID, - events: events, - withheldIdentities: map[identity.NumericIdentity]struct{}{}, - } -} - -func (l *localIdentityCache) bumpNextNumericIdentity() { - if l.nextNumericIdentity == l.maxID { - l.nextNumericIdentity = l.minID - } else { - l.nextNumericIdentity++ - } -} - -// getNextFreeNumericIdentity returns the next available numeric identity or an error -// If idCandidate has the local scope and is available, it will be returned instead of -// searching for a new numeric identity. -// The l.mutex must be held -func (l *localIdentityCache) getNextFreeNumericIdentity(idCandidate identity.NumericIdentity) (identity.NumericIdentity, error) { - // Try first with the given candidate - if idCandidate.Scope() == l.scope { - if _, taken := l.identitiesByID[idCandidate]; !taken { - // let nextNumericIdentity be, allocated identities will be skipped anyway - log.Debugf("Reallocated restored local identity: %d", idCandidate) - return idCandidate, nil - } else { - log.WithField(logfields.Identity, idCandidate).Debug("Requested local identity not available to allocate") - } - } - firstID := l.nextNumericIdentity - for { - idCandidate = l.nextNumericIdentity | l.scope - _, taken := l.identitiesByID[idCandidate] - _, withheld := l.withheldIdentities[idCandidate] - if !taken && !withheld { - l.bumpNextNumericIdentity() - return idCandidate, nil - } - - l.bumpNextNumericIdentity() - if l.nextNumericIdentity == firstID { - // Desperation: no local identities left (unlikely). If there are withheld - // but not-taken identities, claim one of them. - for withheldID := range l.withheldIdentities { - if _, taken := l.identitiesByID[withheldID]; !taken { - delete(l.withheldIdentities, withheldID) - log.WithField(logfields.Identity, withheldID).Warn("Local identity allocator full; claiming first withheld identity. This may cause momentary policy drops") - return withheldID, nil - } - } - - return 0, fmt.Errorf("out of local identity space") - } - } -} - -// lookupOrCreate searches for the existence of a local identity with the given -// labels. If it exists, the reference count is incremented and the identity is -// returned. If it does not exist, a new identity is created with a unique -// numeric identity. All identities returned by lookupOrCreate() must be -// released again via localIdentityCache.release(). -// A possible previously used numeric identity for these labels can be passed -// in as the 'oldNID' parameter; identity.InvalidIdentity must be passed if no -// previous numeric identity exists. 'oldNID' will be reallocated if available. -func (l *localIdentityCache) lookupOrCreate(lbls labels.Labels, oldNID identity.NumericIdentity, notifyOwner bool) (*identity.Identity, bool, error) { - // Not converting to string saves an allocation, as byte key lookups into - // string maps are optimized by the compiler, see - // https://github.com/golang/go/issues/3512. - repr := lbls.SortedList() - - l.mutex.Lock() - defer l.mutex.Unlock() - - if id, ok := l.identitiesByLabels[string(repr)]; ok { - id.ReferenceCount++ - return id, false, nil - } - - numericIdentity, err := l.getNextFreeNumericIdentity(oldNID) - if err != nil { - return nil, false, err - } - - id := &identity.Identity{ - ID: numericIdentity, - Labels: lbls, - LabelArray: lbls.LabelArray(), - ReferenceCount: 1, - } - - l.identitiesByLabels[string(repr)] = id - l.identitiesByID[numericIdentity] = id - - if l.events != nil && notifyOwner { - l.events <- allocator.AllocatorEvent{ - Typ: kvstore.EventTypeCreate, - ID: idpool.ID(id.ID), - Key: &key.GlobalIdentity{LabelArray: id.LabelArray}, - } - } - - return id, true, nil -} - -// release releases a local identity from the cache. true is returned when the -// last use of the identity has been released and the identity has been -// forgotten. -func (l *localIdentityCache) release(id *identity.Identity, notifyOwner bool) bool { - l.mutex.Lock() - defer l.mutex.Unlock() - - if id, ok := l.identitiesByID[id.ID]; ok { - switch { - case id.ReferenceCount > 1: - id.ReferenceCount-- - return false - - case id.ReferenceCount == 1: - // Release is only attempted once, when the reference count is - // hitting the last use - delete(l.identitiesByLabels, string(id.Labels.SortedList())) - delete(l.identitiesByID, id.ID) - - if l.events != nil && notifyOwner { - l.events <- allocator.AllocatorEvent{ - Typ: kvstore.EventTypeDelete, - ID: idpool.ID(id.ID), - } - } - - return true - } - } - - return false -} - -// withhold marks the nids as unavailable. Any out-of-scope identities are returned. -func (l *localIdentityCache) withhold(nids []identity.NumericIdentity) []identity.NumericIdentity { - if len(nids) == 0 { - return nil - } - - unused := make([]identity.NumericIdentity, 0, len(nids)) - l.mutex.Lock() - defer l.mutex.Unlock() - for _, nid := range nids { - if nid.Scope() != l.scope { - unused = append(unused, nid) - continue - } - l.withheldIdentities[nid] = struct{}{} - } - - return unused -} - -func (l *localIdentityCache) unwithhold(nids []identity.NumericIdentity) { - if len(nids) == 0 { - return - } - l.mutex.Lock() - defer l.mutex.Unlock() - for _, nid := range nids { - if nid.Scope() != l.scope { - continue - } - delete(l.withheldIdentities, nid) - } -} - -// lookup searches for a local identity matching the given labels and returns -// it. If found, the reference count is NOT incremented and thus release must -// NOT be called. -func (l *localIdentityCache) lookup(lbls labels.Labels) *identity.Identity { - l.mutex.RLock() - defer l.mutex.RUnlock() - - if id, ok := l.identitiesByLabels[string(lbls.SortedList())]; ok { - return id - } - - return nil -} - -// lookupByID searches for a local identity matching the given ID and returns -// it. If found, the reference count is NOT incremented and thus release must -// NOT be called. -func (l *localIdentityCache) lookupByID(id identity.NumericIdentity) *identity.Identity { - l.mutex.RLock() - defer l.mutex.RUnlock() - - if id, ok := l.identitiesByID[id]; ok { - return id - } - - return nil -} - -// GetIdentities returns all local identities -func (l *localIdentityCache) GetIdentities() map[identity.NumericIdentity]*identity.Identity { - cache := map[identity.NumericIdentity]*identity.Identity{} - - l.mutex.RLock() - defer l.mutex.RUnlock() - - for key, id := range l.identitiesByID { - cache[key] = id - } - - return cache -} - -// close removes the events channel. -func (l *localIdentityCache) close() { - l.mutex.Lock() - defer l.mutex.Unlock() - - l.events = nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/identity/identity.go b/vendor/github.com/cilium/cilium/pkg/identity/identity.go index d834d1c84..e818fc287 100644 --- a/vendor/github.com/cilium/cilium/pkg/identity/identity.go +++ b/vendor/github.com/cilium/cilium/pkg/identity/identity.go @@ -202,7 +202,7 @@ func ScopeForLabels(lbls labels.Labels) NumericIdentity { for _, label := range lbls { switch label.Source { - case labels.LabelSourceCIDR, labels.LabelSourceReserved: + case labels.LabelSourceCIDR, labels.LabelSourceFQDN, labels.LabelSourceReserved: scope = IdentityScopeLocal default: return IdentityScopeGlobal diff --git a/vendor/github.com/cilium/cilium/pkg/identity/identitymanager/doc.go b/vendor/github.com/cilium/cilium/pkg/identity/identitymanager/doc.go deleted file mode 100644 index fbf1b56fa..000000000 --- a/vendor/github.com/cilium/cilium/pkg/identity/identitymanager/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Package identitymanager tracks which global identities are being used by -// the currently running cilium-agent -package identitymanager diff --git a/vendor/github.com/cilium/cilium/pkg/identity/identitymanager/log.go b/vendor/github.com/cilium/cilium/pkg/identity/identitymanager/log.go deleted file mode 100644 index b038e68ce..000000000 --- a/vendor/github.com/cilium/cilium/pkg/identity/identitymanager/log.go +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package identitymanager - -import ( - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" -) - -var ( - log = logging.DefaultLogger.WithField(logfields.LogSubsys, "identitymanager") -) diff --git a/vendor/github.com/cilium/cilium/pkg/identity/identitymanager/manager.go b/vendor/github.com/cilium/cilium/pkg/identity/identitymanager/manager.go deleted file mode 100644 index 81766a099..000000000 --- a/vendor/github.com/cilium/cilium/pkg/identity/identitymanager/manager.go +++ /dev/null @@ -1,216 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package identitymanager - -import ( - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/api/v1/models" - "github.com/cilium/cilium/pkg/identity" - "github.com/cilium/cilium/pkg/identity/model" - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/logging/logfields" -) - -var ( - // GlobalIdentityManager is a singleton instance of an IdentityManager, used - // for easy updating / tracking lifecycles of identities on the local node - // without having to pass around a specific instance of an IdentityManager - // throughout Cilium. - GlobalIdentityManager = NewIdentityManager() -) - -// IdentityManager caches information about a set of identities, currently a -// reference count of how many users there are for each identity. -type IdentityManager struct { - mutex lock.RWMutex - identities map[identity.NumericIdentity]*identityMetadata - observers map[Observer]struct{} -} - -type identityMetadata struct { - identity *identity.Identity - refCount uint -} - -// NewIdentityManager returns an initialized IdentityManager. -func NewIdentityManager() *IdentityManager { - return &IdentityManager{ - identities: make(map[identity.NumericIdentity]*identityMetadata), - observers: make(map[Observer]struct{}), - } -} - -// Add inserts the identity into the GlobalIdentityManager. -func Add(identity *identity.Identity) { - GlobalIdentityManager.Add(identity) -} - -// Remove deletes the identity from the GlobalIdentityManager. -func Remove(identity *identity.Identity) { - GlobalIdentityManager.Remove(identity) -} - -// RemoveAll deletes all identities from the GlobalIdentityManager. -func RemoveAll() { - GlobalIdentityManager.RemoveAll() -} - -// Add inserts the identity into the identity manager. If the identity is -// already in the identity manager, the reference count for the identity is -// incremented. -func (idm *IdentityManager) Add(identity *identity.Identity) { - log.WithFields(logrus.Fields{ - logfields.Identity: identity, - }).Debug("Adding identity to the identity manager") - - idm.mutex.Lock() - defer idm.mutex.Unlock() - idm.add(identity) -} - -func (idm *IdentityManager) add(identity *identity.Identity) { - - if identity == nil { - return - } - - idMeta, exists := idm.identities[identity.ID] - if !exists { - idm.identities[identity.ID] = &identityMetadata{ - identity: identity, - refCount: 1, - } - for o := range idm.observers { - o.LocalEndpointIdentityAdded(identity) - } - - } else { - idMeta.refCount++ - } -} - -// RemoveOldAddNew removes old from the identity manager and inserts new -// into the IdentityManager. -// Caller must have previously added the old identity with Add(). -// This is a no-op if both identities have the same numeric ID. -func (idm *IdentityManager) RemoveOldAddNew(old, new *identity.Identity) { - idm.mutex.Lock() - defer idm.mutex.Unlock() - - if old == nil && new == nil { - return - } - // The host endpoint will always retain its reserved ID, but its labels may - // change so we need to update its identity. - if old != nil && new != nil && old.ID == new.ID && new.ID != identity.ReservedIdentityHost { - return - } - - log.WithFields(logrus.Fields{ - "old": old, - "new": new, - }).Debug("removing old and adding new identity") - - idm.remove(old) - idm.add(new) -} - -// RemoveOldAddNew removes old from and inserts new into the -// GlobalIdentityManager. -func RemoveOldAddNew(old, new *identity.Identity) { - GlobalIdentityManager.RemoveOldAddNew(old, new) -} - -// RemoveAll removes all identities. -func (idm *IdentityManager) RemoveAll() { - idm.mutex.Lock() - defer idm.mutex.Unlock() - - for id := range idm.identities { - idm.remove(idm.identities[id].identity) - } -} - -// Remove deletes the identity from the identity manager. If the identity is -// already in the identity manager, the reference count for the identity is -// decremented. If the identity is not in the cache, this is a no-op. If the -// ref count becomes zero, the identity is removed from the cache. -func (idm *IdentityManager) Remove(identity *identity.Identity) { - log.WithFields(logrus.Fields{ - logfields.Identity: identity, - }).Debug("Removing identity from the identity manager") - - idm.mutex.Lock() - defer idm.mutex.Unlock() - idm.remove(identity) -} - -func (idm *IdentityManager) remove(identity *identity.Identity) { - - if identity == nil { - return - } - - idMeta, exists := idm.identities[identity.ID] - if !exists { - log.WithFields(logrus.Fields{ - logfields.Identity: identity, - }).Error("removing identity not added to the identity manager!") - return - } - idMeta.refCount-- - if idMeta.refCount == 0 { - delete(idm.identities, identity.ID) - for o := range idm.observers { - o.LocalEndpointIdentityRemoved(identity) - } - } - -} - -// GetIdentityModels returns the API representation of the IdentityManager. -func (idm *IdentityManager) GetIdentityModels() []*models.IdentityEndpoints { - idm.mutex.RLock() - defer idm.mutex.RUnlock() - - identities := make([]*models.IdentityEndpoints, 0, len(idm.identities)) - - for _, v := range idm.identities { - identities = append(identities, &models.IdentityEndpoints{ - Identity: model.CreateModel(v.identity), - RefCount: int64(v.refCount), - }) - } - - return identities -} - -func (idm *IdentityManager) subscribe(o Observer) { - idm.mutex.Lock() - defer idm.mutex.Unlock() - idm.observers[o] = struct{}{} -} - -// GetIdentityModels returns the API model of all identities in the -// GlobalIdentityManager. -func GetIdentityModels() []*models.IdentityEndpoints { - return GlobalIdentityManager.GetIdentityModels() -} - -// IdentitiesModel is a wrapper so that we can implement the sort.Interface -// to sort the slice by ID -type IdentitiesModel []*models.IdentityEndpoints - -// Less returns true if the element in index `i` is lower than the element -// in index `j` -func (s IdentitiesModel) Less(i, j int) bool { - return s[i].Identity.ID < s[j].Identity.ID -} - -// Subscribe adds the specified Observer to the global identity manager, to be -// notified upon changes to local identity usage. -func Subscribe(o Observer) { - GlobalIdentityManager.subscribe(o) -} diff --git a/vendor/github.com/cilium/cilium/pkg/identity/identitymanager/observer.go b/vendor/github.com/cilium/cilium/pkg/identity/identitymanager/observer.go deleted file mode 100644 index c5eacc078..000000000 --- a/vendor/github.com/cilium/cilium/pkg/identity/identitymanager/observer.go +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package identitymanager - -import ( - "github.com/cilium/cilium/pkg/identity" -) - -// Observer can sign up to receive events whenever local identities are removed. -type Observer interface { - // LocalEndpointIdentityAdded is called when an identity first becomes - // used on the node. Implementations must ensure that the callback - // returns within a reasonable period. - LocalEndpointIdentityAdded(*identity.Identity) - - // LocalEndpointIdentityRemoved is called when an identity is no longer - // in use on the node. Implementations must ensure that the callback - // returns within a reasonable period. - LocalEndpointIdentityRemoved(*identity.Identity) -} diff --git a/vendor/github.com/cilium/cilium/pkg/identity/key/global_identity.go b/vendor/github.com/cilium/cilium/pkg/identity/key/global_identity.go deleted file mode 100644 index 96582a5d4..000000000 --- a/vendor/github.com/cilium/cilium/pkg/identity/key/global_identity.go +++ /dev/null @@ -1,72 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package key - -import ( - "maps" - "strings" - - "github.com/cilium/cilium/pkg/allocator" - "github.com/cilium/cilium/pkg/labels" -) - -const ( - // MetadataKeyBackendKey is the key used to store the backend key. - MetadataKeyBackendKey = iota -) - -// GlobalIdentity is the structure used to store an identity -type GlobalIdentity struct { - labels.LabelArray - - // metadata contains metadata that are stored for example by the backends. - metadata map[any]any -} - -// GetKey encodes an Identity as string -func (gi *GlobalIdentity) GetKey() string { - var str strings.Builder - for _, l := range gi.LabelArray { - str.Write(l.FormatForKVStore()) - } - return str.String() -} - -// GetAsMap encodes a GlobalIdentity a map of keys to values. The keys will -// include a source delimted by a ':'. This output is pareable by PutKeyFromMap. -func (gi *GlobalIdentity) GetAsMap() map[string]string { - return gi.StringMap() -} - -// PutKey decodes an Identity from its string representation -func (gi *GlobalIdentity) PutKey(v string) allocator.AllocatorKey { - return &GlobalIdentity{LabelArray: labels.NewLabelArrayFromSortedList(v)} -} - -// PutKeyFromMap decodes an Identity from a map of key to value. Output -// from GetAsMap can be parsed. -// Note: NewLabelArrayFromMap will parse the ':' separated label source from -// the keys because the source parameter is "" -func (gi *GlobalIdentity) PutKeyFromMap(v map[string]string) allocator.AllocatorKey { - return &GlobalIdentity{LabelArray: labels.Map2Labels(v, "").LabelArray()} -} - -// PutValue puts metadata inside the global identity for the given 'key' with -// the given 'value'. -func (gi *GlobalIdentity) PutValue(key, value any) allocator.AllocatorKey { - newMap := map[any]any{} - if gi.metadata != nil { - newMap = maps.Clone(gi.metadata) - } - newMap[key] = value - return &GlobalIdentity{ - LabelArray: gi.LabelArray, - metadata: newMap, - } -} - -// Value returns the value stored in the metadata map. -func (gi *GlobalIdentity) Value(key any) any { - return gi.metadata[key] -} diff --git a/vendor/github.com/cilium/cilium/pkg/identity/model/identity.go b/vendor/github.com/cilium/cilium/pkg/identity/model/identity.go deleted file mode 100644 index 4b99df3aa..000000000 --- a/vendor/github.com/cilium/cilium/pkg/identity/model/identity.go +++ /dev/null @@ -1,44 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package model - -import ( - "github.com/cilium/cilium/api/v1/models" - "github.com/cilium/cilium/pkg/identity" - "github.com/cilium/cilium/pkg/labels" -) - -func NewIdentityFromModel(base *models.Identity) *identity.Identity { - if base == nil { - return nil - } - - id := &identity.Identity{ - ID: identity.NumericIdentity(base.ID), - Labels: make(labels.Labels, len(base.Labels)), - } - for _, v := range base.Labels { - lbl := labels.ParseLabel(v) - id.Labels[lbl.Key] = lbl - } - id.Sanitize() - - return id -} - -func CreateModel(id *identity.Identity) *models.Identity { - if id == nil { - return nil - } - - ret := &models.Identity{ - ID: int64(id.ID), - Labels: make([]string, 0, len(id.Labels)), - } - - for _, v := range id.Labels { - ret.Labels = append(ret.Labels, v.String()) - } - return ret -} diff --git a/vendor/github.com/cilium/cilium/pkg/idpool/idpool.go b/vendor/github.com/cilium/cilium/pkg/idpool/idpool.go deleted file mode 100644 index d37ca983a..000000000 --- a/vendor/github.com/cilium/cilium/pkg/idpool/idpool.go +++ /dev/null @@ -1,239 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package idpool - -import ( - "strconv" - - "github.com/cilium/cilium/pkg/lock" -) - -// ID is a numeric identifier -type ID uint64 - -// NoID is a special ID that represents "no ID available" -const NoID ID = 0 - -// String returns the string representation of an allocated ID -func (i ID) String() string { - return strconv.FormatUint(uint64(i), 10) -} - -// IDPool represents a pool of IDs that can be managed concurrently -// via local usage and external events. -// -// An intermediate state (leased) is introduced to the life cycle -// of an ID in the pool, in order to prevent lost updates to the -// pool that can occur as a result of employing both management schemes -// simultaneously. -// Local usage of an ID becomes a two stage process of leasing -// the ID from the pool, and later, Use()ing or Release()ing the ID on -// the pool upon successful or unsuccessful usage respectively, -// -// The table below shows the state transitions in the ID's life cycle. -// In the case of LeaseAvailableID() the ID is returned rather -// than provided as an input to the operation. -// All ID's begin in the available state. -/* ---------------------------------------------------------------------- -|state\event | LeaseAvailableID | Release | Use | Insert | Remove | ---------------------------------------------------------------------- -|1 available | 2 | * | * | * | 3 | ---------------------------------------------------------------------- -|2 leased | ** | 1 | 3 | * | 3 | ---------------------------------------------------------------------- -|3 unavailable | ** | * | * | 1 | * | ---------------------------------------------------------------------- -* The event has no effect. -** This is guaranteed never to occur. -*/ -type IDPool struct { - // mutex protects all IDPool data structures - mutex lock.Mutex - - // min is the lower limit when leasing IDs. The pool will never - // return an ID lesser than this value. - minID ID - - // max is the upper limit when leasing IDs. The pool will never - // return an ID greater than this value. - maxID ID - - // idCache is a cache of IDs backing the pool. - idCache *idCache -} - -// NewIDPool returns a new ID pool -func NewIDPool(minID ID, maxID ID) *IDPool { - return &IDPool{ - minID: minID, - maxID: maxID, - idCache: newIDCache(minID, maxID), - } -} - -// LeaseAvailableID returns an available ID at random from the pool. -// Returns an ID or NoID if no there is no available ID in the pool. -func (p *IDPool) LeaseAvailableID() ID { - p.mutex.Lock() - defer p.mutex.Unlock() - - return p.idCache.leaseAvailableID() -} - -// AllocateID returns a random available ID. Unlike LeaseAvailableID, the ID is -// immediately marked for use and there is no need to call Use(). -func (p *IDPool) AllocateID() ID { - p.mutex.Lock() - defer p.mutex.Unlock() - - return p.idCache.allocateID() -} - -// Release returns a leased ID back to the pool. -// This operation accounts for IDs that were previously leased -// from the pool but were unused, e.g if allocation was unsuccessful. -// Thus, it has no effect if the ID is not currently leased in the -// pool, or the pool has since been refreshed. -// -// Returns true if the ID was returned back to the pool as -// a result of this call. -func (p *IDPool) Release(id ID) bool { - p.mutex.Lock() - defer p.mutex.Unlock() - - return p.idCache.release(id) -} - -// Use makes a leased ID unavailable in the pool and has no effect -// otherwise. Returns true if the ID was made unavailable -// as a result of this call. -func (p *IDPool) Use(id ID) bool { - p.mutex.Lock() - defer p.mutex.Unlock() - - return p.idCache.use(id) -} - -// Insert makes an unavailable ID available in the pool -// and has no effect otherwise. Returns true if the ID -// was added back to the pool. -func (p *IDPool) Insert(id ID) bool { - p.mutex.Lock() - defer p.mutex.Unlock() - - return p.idCache.insert(id) -} - -// Remove makes an ID unavailable in the pool. -// Returns true if the ID was previously available in the pool. -func (p *IDPool) Remove(id ID) bool { - p.mutex.Lock() - defer p.mutex.Unlock() - - return p.idCache.remove(id) -} - -type idCache struct { - // ids is a slice of IDs available in this idCache. - ids map[ID]struct{} - - // leased is the set of IDs that are leased in this idCache. - leased map[ID]struct{} -} - -func newIDCache(minID ID, maxID ID) *idCache { - n := int(maxID - minID + 1) - if n < 0 { - n = 0 - } - - c := &idCache{ - ids: make(map[ID]struct{}, n), - leased: make(map[ID]struct{}), - } - - for id := minID; id < maxID+1; id++ { - c.ids[id] = struct{}{} - } - - return c -} - -// allocateID returns a random available ID without leasing it -func (c *idCache) allocateID() ID { - for id := range c.ids { - delete(c.ids, id) - return id - } - - return NoID -} - -// leaseAvailableID returns a random available ID. -func (c *idCache) leaseAvailableID() ID { - id := c.allocateID() - if id == NoID { - return NoID - } - - // Mark as leased - c.leased[id] = struct{}{} - - return id -} - -// release makes the ID available again if it is currently -// leased and has no effect otherwise. Returns true if the -// ID was made available as a result of this call. -func (c *idCache) release(id ID) bool { - if _, exists := c.leased[id]; !exists { - return false - } - - delete(c.leased, id) - c.insert(id) - - return true -} - -// use makes the ID unavailable if it is currently -// leased and has no effect otherwise. Returns true if the -// ID was made unavailable as a result of this call. -func (c *idCache) use(id ID) bool { - if _, exists := c.leased[id]; !exists { - return false - } - - delete(c.leased, id) - return true -} - -// insert adds the ID into the cache if it is currently unavailable. -// Returns true if the ID was added to the cache. -func (c *idCache) insert(id ID) bool { - if _, ok := c.ids[id]; ok { - return false - } - - if _, exists := c.leased[id]; exists { - return false - } - - c.ids[id] = struct{}{} - return true -} - -// remove removes the ID from the cache. -// Returns true if the ID was available in the cache. -func (c *idCache) remove(id ID) bool { - delete(c.leased, id) - - if _, ok := c.ids[id]; ok { - delete(c.ids, id) - return true - } - - return false -} diff --git a/vendor/github.com/cilium/cilium/pkg/inctimer/inctimer.go b/vendor/github.com/cilium/cilium/pkg/inctimer/inctimer.go deleted file mode 100644 index 072c02a56..000000000 --- a/vendor/github.com/cilium/cilium/pkg/inctimer/inctimer.go +++ /dev/null @@ -1,80 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package inctimer - -import "time" - -// IncTimer should be the preferred mechanism over -// calling `time.After` when wanting an `After`-like -// function in a loop. This prevents memory build up -// as the `time.After` method creates a new timer -// instance every time it is called, and it is not -// garbage collected until after it fires. Conversely, -// IncTimer only uses one timer and correctly stops -// the timer, clears its channel, and resets it -// everytime that `After` is called. -type IncTimer interface { - After(time.Duration) <-chan time.Time -} - -type incTimer struct { - t *time.Timer -} - -// New creates a new IncTimer and a done function. -// IncTimer only uses one timer and correctly stops -// the timer, clears the channel, and resets it every -// time the `After` function is called. -// WARNING: Concurrent use is not expected. The use -// of this timer should be for only one goroutine. -func New() (IncTimer, func() bool) { - it := &incTimer{} - return it, it.stop -} - -// stop returns true if a scheduled timer has been stopped before execution. -func (it *incTimer) stop() bool { - if it.t == nil { - return false - } - return it.t.Stop() -} - -// After returns a channel that will fire after -// the specified duration. -func (it *incTimer) After(d time.Duration) <-chan time.Time { - // Stop the previous timer (if any) to garbage collect it. - // The old timer channel will be garbage collected even if not drained. - it.stop() - - // We have to create a new timer for each invocation, because it is not - // possible to safely use https://golang.org/pkg/time/#Timer.Reset if we - // do not know if the timer channel has already been drained or not (which - // is the case here, as the client might have drained the channel already). - // Even after stopping a timer, it's not safe to attempt to drain its - // timer channel with a default case (for the case where the client has - // drained the channel already), as there is a small window where a timer - // is considered expired, but the channel has not received a value yet [1]. - // This would cause us to erroneously take the default case (assuming the - // channel has been drained by the client), when in fact the channel just - // has not received a value yet. Because the two cases (client has drained - // vs. value not received yet) are indistinguishable for us, we cannot use - // Timer.Reset and need to create a new timer. - // - // [1] The reason why this small window occurs, is because the Go runtime - // will remove a timer from the heap and and mark it as deleted _before_ - // it actually executes the timer function f: - // https://github.com/golang/go/blob/go1.16/src/runtime/time.go#L876 - // This causes t.Stop to report the timer as already expired while it is - // in fact currently running: - // https://github.com/golang/go/blob/go1.16/src/runtime/time.go#L352 - it.t = time.NewTimer(d) - return it.t.C -} - -// After wraps the time.After function to get around the /timeafter linter -// warning for cases where it is inconvenient to use the instantiated version. -func After(d time.Duration) <-chan time.Time { - return time.After(d) -} diff --git a/vendor/github.com/cilium/cilium/pkg/ipam/types/doc.go b/vendor/github.com/cilium/cilium/pkg/ipam/types/doc.go deleted file mode 100644 index e9d435b8d..000000000 --- a/vendor/github.com/cilium/cilium/pkg/ipam/types/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// +k8s:deepcopy-gen=package,register -// +k8s:openapi-gen=true -// +deepequal-gen=package - -// +groupName=ipam -package types diff --git a/vendor/github.com/cilium/cilium/pkg/ipam/types/types.go b/vendor/github.com/cilium/cilium/pkg/ipam/types/types.go deleted file mode 100644 index 81c6e5ebc..000000000 --- a/vendor/github.com/cilium/cilium/pkg/ipam/types/types.go +++ /dev/null @@ -1,614 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package types - -import ( - "fmt" - "net/netip" - - "github.com/cilium/cilium/pkg/cidr" - "github.com/cilium/cilium/pkg/lock" -) - -// Limits specifies the IPAM relevant instance limits -type Limits struct { - // Adapters specifies the maximum number of interfaces that can be - // attached to the instance - Adapters int - - // IPv4 is the maximum number of IPv4 addresses per adapter/interface - IPv4 int - - // IPv6 is the maximum number of IPv6 addresses per adapter/interface - IPv6 int - - // HypervisorType tracks the instance's hypervisor type if available. Used to determine if features like prefix - // delegation are supported on an instance. Bare metal instances would have empty string. - HypervisorType string -} - -// AllocationIP is an IP which is available for allocation, or already -// has been allocated -type AllocationIP struct { - // Owner is the owner of the IP. This field is set if the IP has been - // allocated. It will be set to the pod name or another identifier - // representing the usage of the IP - // - // The owner field is left blank for an entry in Spec.IPAM.Pool and - // filled out as the IP is used and also added to Status.IPAM.Used. - // - // +optional - Owner string `json:"owner,omitempty"` - - // Resource is set for both available and allocated IPs, it represents - // what resource the IP is associated with, e.g. in combination with - // AWS ENI, this will refer to the ID of the ENI - // - // +optional - Resource string `json:"resource,omitempty"` -} - -// AllocationMap is a map of allocated IPs indexed by IP -type AllocationMap map[string]AllocationIP - -// IPAMPodCIDR is a pod CIDR -// -// +kubebuilder:validation:Format=cidr -type IPAMPodCIDR string - -func (c *IPAMPodCIDR) ToPrefix() (*netip.Prefix, error) { - if c == nil { - return nil, fmt.Errorf("nil ipam cidr") - } - - prefix, err := netip.ParsePrefix(string(*c)) - if err != nil { - return nil, fmt.Errorf("failed to parse ipam cidr %v: %w", c, err) - } - - return &prefix, nil -} - -// IPAMPoolAllocation describes an allocation of an IPAM pool from the operator to the -// node. It contains the assigned PodCIDRs allocated from this pool -type IPAMPoolAllocation struct { - // Pool is the name of the IPAM pool backing this allocation - // - // +kubebuilder:validation:MinLength=1 - Pool string `json:"pool"` - - // CIDRs contains a list of pod CIDRs currently allocated from this pool - // - // +optional - CIDRs []IPAMPodCIDR `json:"cidrs,omitempty"` -} - -type IPAMPoolRequest struct { - // Pool is the name of the IPAM pool backing this request - // - // +kubebuilder:validation:MinLength=1 - Pool string `json:"pool"` - - // Needed indicates how many IPs out of the above Pool this node requests - // from the operator. The operator runs a reconciliation loop to ensure each - // node always has enough PodCIDRs allocated in each pool to fulfill the - // requested number of IPs here. - // - // +optional - Needed IPAMPoolDemand `json:"needed,omitempty"` -} - -type IPAMPoolSpec struct { - // Requested contains a list of IPAM pool requests, i.e. indicates how many - // addresses this node requests out of each pool listed here. This field - // is owned and written to by cilium-agent and read by the operator. - // - // +optional - Requested []IPAMPoolRequest `json:"requested,omitempty"` - - // Allocated contains the list of pooled CIDR assigned to this node. The - // operator will add new pod CIDRs to this field, whereas the agent will - // remove CIDRs it has released. - // - // +optional - Allocated []IPAMPoolAllocation `json:"allocated,omitempty"` -} - -// IPAMSpec is the IPAM specification of the node -// -// This structure is embedded into v2.CiliumNode -type IPAMSpec struct { - // Pool is the list of IPv4 addresses available to the node for allocation. - // When an IPv4 address is used, it will remain on this list but will be added to - // Status.IPAM.Used - // - // +optional - Pool AllocationMap `json:"pool,omitempty"` - - // IPv6Pool is the list of IPv6 addresses available to the node for allocation. - // When an IPv6 address is used, it will remain on this list but will be added to - // Status.IPAM.IPv6Used - // - // +optional - IPv6Pool AllocationMap `json:"ipv6-pool,omitempty"` - - // Pools contains the list of assigned IPAM pools for this node. - // - // +optional - Pools IPAMPoolSpec `json:"pools,omitempty"` - - // PodCIDRs is the list of CIDRs available to the node for allocation. - // When an IP is used, the IP will be added to Status.IPAM.Used - // - // +optional - PodCIDRs []string `json:"podCIDRs,omitempty"` - - // MinAllocate is the minimum number of IPs that must be allocated when - // the node is first bootstrapped. It defines the minimum base socket - // of addresses that must be available. After reaching this watermark, - // the PreAllocate and MaxAboveWatermark logic takes over to continue - // allocating IPs. - // - // +kubebuilder:validation:Minimum=0 - MinAllocate int `json:"min-allocate,omitempty"` - - // MaxAllocate is the maximum number of IPs that can be allocated to the - // node. When the current amount of allocated IPs will approach this value, - // the considered value for PreAllocate will decrease down to 0 in order to - // not attempt to allocate more addresses than defined. - // - // +kubebuilder:validation:Minimum=0 - MaxAllocate int `json:"max-allocate,omitempty"` - - // PreAllocate defines the number of IP addresses that must be - // available for allocation in the IPAMspec. It defines the buffer of - // addresses available immediately without requiring cilium-operator to - // get involved. - // - // +kubebuilder:validation:Minimum=0 - PreAllocate int `json:"pre-allocate,omitempty"` - - // MaxAboveWatermark is the maximum number of addresses to allocate - // beyond the addresses needed to reach the PreAllocate watermark. - // Going above the watermark can help reduce the number of API calls to - // allocate IPs, e.g. when a new ENI is allocated, as many secondary - // IPs as possible are allocated. Limiting the amount can help reduce - // waste of IPs. - // - // +kubebuilder:validation:Minimum=0 - MaxAboveWatermark int `json:"max-above-watermark,omitempty"` -} - -// IPReleaseStatus defines the valid states in IP release handshake -// -// +kubebuilder:validation:Enum=marked-for-release;ready-for-release;do-not-release;released -type IPReleaseStatus string - -// IPAMStatus is the IPAM status of a node -// -// This structure is embedded into v2.CiliumNode -type IPAMStatus struct { - // Used lists all IPv4 addresses out of Spec.IPAM.Pool which have been allocated - // and are in use. - // - // +optional - Used AllocationMap `json:"used,omitempty"` - - // IPv6Used lists all IPv6 addresses out of Spec.IPAM.IPv6Pool which have been - // allocated and are in use. - // - // +optional - IPv6Used AllocationMap `json:"ipv6-used,omitempty"` - - // PodCIDRs lists the status of each pod CIDR allocated to this node. - // - // +optional - PodCIDRs PodCIDRMap `json:"pod-cidrs,omitempty"` - - // Operator is the Operator status of the node - // - // +optional - OperatorStatus OperatorStatus `json:"operator-status,omitempty"` - - // ReleaseIPs tracks the state for every IPv4 address considered for release. - // The value can be one of the following strings: - // * marked-for-release : Set by operator as possible candidate for IP - // * ready-for-release : Acknowledged as safe to release by agent - // * do-not-release : IP already in use / not owned by the node. Set by agent - // * released : IP successfully released. Set by operator - // - // +optional - ReleaseIPs map[string]IPReleaseStatus `json:"release-ips,omitempty"` - - // ReleaseIPv6s tracks the state for every IPv6 address considered for release. - // The value can be one of the following strings: - // * marked-for-release : Set by operator as possible candidate for IP - // * ready-for-release : Acknowledged as safe to release by agent - // * do-not-release : IP already in use / not owned by the node. Set by agent - // * released : IP successfully released. Set by operator - // - // +optional - ReleaseIPv6s map[string]IPReleaseStatus `json:"release-ipv6s,omitempty"` -} - -// IPAMPoolRequest is a request from the agent to the operator, indicating how -// may IPs it requires from a given pool -type IPAMPoolDemand struct { - // IPv4Addrs contains the number of requested IPv4 addresses out of a given - // pool - // - // +optional - IPv4Addrs int `json:"ipv4-addrs,omitempty"` - - // IPv6Addrs contains the number of requested IPv6 addresses out of a given - // pool - // - // +optional - IPv6Addrs int `json:"ipv6-addrs,omitempty"` -} - -type PodCIDRMap map[string]PodCIDRMapEntry - -// +kubebuilder:validation:Enum=released;depleted;in-use -type PodCIDRStatus string - -const ( - PodCIDRStatusReleased PodCIDRStatus = "released" - PodCIDRStatusDepleted PodCIDRStatus = "depleted" - PodCIDRStatusInUse PodCIDRStatus = "in-use" -) - -type PodCIDRMapEntry struct { - // Status describes the status of a pod CIDR - // - // +optional - Status PodCIDRStatus `json:"status,omitempty"` -} - -// OperatorStatus is the status used by cilium-operator to report -// errors in case the allocation CIDR failed. -type OperatorStatus struct { - // Error is the error message set by cilium-operator. - // - // +optional - Error string `json:"error,omitempty"` -} - -// Tags implements generic key value tags -type Tags map[string]string - -// Match returns true if the required tags are all found -func (t Tags) Match(required Tags) bool { - for k, neededvalue := range required { - haveValue, ok := t[k] - if !ok || (ok && neededvalue != haveValue) { - return false - } - } - return true -} - -// Subnet is a representation of a subnet -type Subnet struct { - // ID is the subnet ID - ID string - - // Name is the subnet name - Name string - - // CIDR is the IPv4 CIDR associated with the subnet - CIDR *cidr.CIDR - - // IPv6CIDR is the IPv6 CIDR associated with the subnet - IPv6CIDR *cidr.CIDR - - // AvailabilityZone is the availability zone of the subnet - AvailabilityZone string - - // VirtualNetworkID is the virtual network the subnet is in - VirtualNetworkID string - - // AvailableAddresses is the number of IPv4 addresses available for - // allocation - AvailableAddresses int - - // AvailableIPv6Addresses is the number of IPv6 addresses available for - // allocation - AvailableIPv6Addresses int - - // Tags is the tags of the subnet - Tags Tags -} - -// SubnetMap indexes subnets by subnet ID -type SubnetMap map[string]*Subnet - -// FirstSubnetWithAvailableAddresses returns the first pool ID in the list of -// subnets with available addresses. If any of the preferred pool IDs have -// available addresses, the first pool ID with available addresses is returned. -func (m SubnetMap) FirstSubnetWithAvailableAddresses(preferredPoolIDs []PoolID) (PoolID, int) { - for _, p := range preferredPoolIDs { - if s := m[string(p)]; s != nil { - if s.AvailableAddresses > 0 { - return p, s.AvailableAddresses - } - } - } - - for poolID, s := range m { - if s.AvailableAddresses > 0 { - return PoolID(poolID), s.AvailableAddresses - } - } - - return PoolNotExists, 0 -} - -// VirtualNetwork is the representation of a virtual network -type VirtualNetwork struct { - // ID is the ID of the virtual network - ID string - - // PrimaryCIDR is the primary IPv4 CIDR - PrimaryCIDR string - - // CIDRs is the list of secondary IPv4 CIDR ranges associated with the VPC - CIDRs []string - - // IPv6CIDRs is the list of IPv6 CIDR ranges associated with the VPC - IPv6CIDRs []string -} - -// VirtualNetworkMap indexes virtual networks by their ID -type VirtualNetworkMap map[string]*VirtualNetwork - -// PoolNotExists indicate that no such pool ID exists -const PoolNotExists = PoolID("") - -// PoolUnspec indicates that the pool ID is unspecified -const PoolUnspec = PoolNotExists - -// PoolID is the type used to identify an IPAM pool -type PoolID string - -// PoolQuota defines the limits of an IPAM pool -type PoolQuota struct { - // AvailabilityZone is the availability zone in which the IPAM pool resides in - AvailabilityZone string - - // AvailableIPs is the number of available IPs in the pool - AvailableIPs int - - // AvailableIPv6s is the number of available IPv6 addresses in the pool - AvailableIPv6s int -} - -// PoolQuotaMap is a map of pool quotas indexes by pool identifier -type PoolQuotaMap map[PoolID]PoolQuota - -// Interface is the implementation of a IPAM relevant network interface -// +k8s:deepcopy-gen=false -// +deepequal-gen=false -type Interface interface { - // InterfaceID must return the identifier of the interface - InterfaceID() string - - // ForeachAddress must iterate over all addresses of the interface and - // call fn for each address - ForeachAddress(instanceID string, fn AddressIterator) error - - // DeepCopyInterface returns a deep copy of the underlying interface type. - DeepCopyInterface() Interface -} - -// InterfaceRevision is the configurationr revision of a network interface. It -// consists of a revision hash representing the current configuration version -// and the resource itself. -// -// +k8s:deepcopy-gen=false -// +deepequal-gen=false -type InterfaceRevision struct { - // Resource is the interface resource - Resource Interface - - // Fingerprint is the fingerprint reprsenting the network interface - // configuration. It is typically implemented as the result of a hash - // function calculated off the resource. This field is optional, not - // all IPAM backends make use of fingerprints. - Fingerprint string -} - -// Instance is the representation of an instance, typically a VM, subject to -// per-node IPAM logic -// -// +k8s:deepcopy-gen=false -// +deepequal-gen=false -type Instance struct { - // interfaces is a map of all interfaces attached to the instance - // indexed by the interface ID - Interfaces map[string]InterfaceRevision -} - -// InstanceMap is the list of all instances indexed by instance ID -// -// +k8s:deepcopy-gen=false -// +deepequal-gen=false -type InstanceMap struct { - mutex lock.RWMutex - data map[string]*Instance -} - -// NewInstanceMap returns a new InstanceMap -func NewInstanceMap() *InstanceMap { - return &InstanceMap{data: map[string]*Instance{}} -} - -// UpdateInstance updates the interfaces map for a particular instance. -func (m *InstanceMap) UpdateInstance(instanceID string, instance *Instance) { - m.mutex.Lock() - m.data[instanceID] = instance - m.mutex.Unlock() -} - -// Update updates the definition of an interface for a particular instance. If -// the interface is already known, the definition is updated, otherwise the -// interface is added to the instance. -func (m *InstanceMap) Update(instanceID string, iface InterfaceRevision) { - m.mutex.Lock() - m.updateLocked(instanceID, iface) - m.mutex.Unlock() -} - -func (m *InstanceMap) updateLocked(instanceID string, iface InterfaceRevision) { - if iface.Resource == nil { - return - } - - i, ok := m.data[instanceID] - if !ok { - i = &Instance{} - m.data[instanceID] = i - } - - if i.Interfaces == nil { - i.Interfaces = map[string]InterfaceRevision{} - } - - i.Interfaces[iface.Resource.InterfaceID()] = iface -} - -type Address interface{} - -// AddressIterator is the function called by the ForeachAddress iterator -type AddressIterator func(instanceID, interfaceID, ip, poolID string, address Address) error - -func foreachAddress(instanceID string, instance *Instance, fn AddressIterator) error { - for _, rev := range instance.Interfaces { - if err := rev.Resource.ForeachAddress(instanceID, fn); err != nil { - return err - } - } - - return nil -} - -// ForeachAddress calls fn for each address on each interface attached to each -// instance. If an instanceID is specified, the only the interfaces and -// addresses of the specified instance are considered. -// -// The InstanceMap is read-locked throughout the iteration process, i.e., no -// updates will occur. However, the address object given to the AddressIterator -// will point to live data and must be deep copied if used outside of the -// context of the iterator function. -func (m *InstanceMap) ForeachAddress(instanceID string, fn AddressIterator) error { - m.mutex.RLock() - defer m.mutex.RUnlock() - - if instanceID != "" { - if instance := m.data[instanceID]; instance != nil { - return foreachAddress(instanceID, instance, fn) - } - return fmt.Errorf("instance does not exist: %q", instanceID) - } - - for instanceID, instance := range m.data { - if err := foreachAddress(instanceID, instance, fn); err != nil { - return err - } - } - - return nil -} - -// InterfaceIterator is the function called by the ForeachInterface iterator -type InterfaceIterator func(instanceID, interfaceID string, iface InterfaceRevision) error - -func foreachInterface(instanceID string, instance *Instance, fn InterfaceIterator) error { - for _, rev := range instance.Interfaces { - if err := fn(instanceID, rev.Resource.InterfaceID(), rev); err != nil { - return err - } - } - - return nil -} - -// ForeachInterface calls fn for each interface on each interface attached to -// each instance. If an instanceID is specified, the only the interfaces and -// addresses of the specified instance are considered. -// -// The InstanceMap is read-locked throughout the iteration process, i.e., no -// updates will occur. However, the address object given to the InterfaceIterator -// will point to live data and must be deep copied if used outside of the -// context of the iterator function. -func (m *InstanceMap) ForeachInterface(instanceID string, fn InterfaceIterator) error { - m.mutex.RLock() - defer m.mutex.RUnlock() - - if instanceID != "" { - if instance := m.data[instanceID]; instance != nil { - return foreachInterface(instanceID, instance, fn) - } - return fmt.Errorf("instance does not exist: %q", instanceID) - } - for instanceID, instance := range m.data { - if err := foreachInterface(instanceID, instance, fn); err != nil { - return err - } - } - - return nil -} - -// GetInterface returns returns a particular interface of an instance. The -// boolean indicates whether the interface was found or not. -func (m *InstanceMap) GetInterface(instanceID, interfaceID string) (InterfaceRevision, bool) { - m.mutex.RLock() - defer m.mutex.RUnlock() - - if instance := m.data[instanceID]; instance != nil { - if rev, ok := instance.Interfaces[interfaceID]; ok { - return rev, true - } - } - - return InterfaceRevision{}, false -} - -// DeepCopy returns a deep copy -func (m *InstanceMap) DeepCopy() *InstanceMap { - c := NewInstanceMap() - m.ForeachInterface("", func(instanceID, interfaceID string, rev InterfaceRevision) error { - // c is not exposed yet, we can access it without locking it - rev.Resource = rev.Resource.DeepCopyInterface() - c.updateLocked(instanceID, rev) - return nil - }) - return c -} - -// NumInstances returns the number of instances in the instance map -func (m *InstanceMap) NumInstances() (size int) { - m.mutex.RLock() - size = len(m.data) - m.mutex.RUnlock() - return -} - -// Exists returns whether the instance ID is in the instanceMap -func (m *InstanceMap) Exists(instanceID string) (exists bool) { - m.mutex.RLock() - defer m.mutex.RUnlock() - if instance := m.data[instanceID]; instance != nil { - return true - } - return false -} - -// Delete instance from m.data -func (m *InstanceMap) Delete(instanceID string) { - m.mutex.Lock() - defer m.mutex.Unlock() - delete(m.data, instanceID) -} diff --git a/vendor/github.com/cilium/cilium/pkg/ipam/types/zz_generated.deepcopy.go b/vendor/github.com/cilium/cilium/pkg/ipam/types/zz_generated.deepcopy.go deleted file mode 100644 index fb9303d76..000000000 --- a/vendor/github.com/cilium/cilium/pkg/ipam/types/zz_generated.deepcopy.go +++ /dev/null @@ -1,464 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package types - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AllocationIP) DeepCopyInto(out *AllocationIP) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AllocationIP. -func (in *AllocationIP) DeepCopy() *AllocationIP { - if in == nil { - return nil - } - out := new(AllocationIP) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in AllocationMap) DeepCopyInto(out *AllocationMap) { - { - in := &in - *out = make(AllocationMap, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AllocationMap. -func (in AllocationMap) DeepCopy() AllocationMap { - if in == nil { - return nil - } - out := new(AllocationMap) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPAMPoolAllocation) DeepCopyInto(out *IPAMPoolAllocation) { - *out = *in - if in.CIDRs != nil { - in, out := &in.CIDRs, &out.CIDRs - *out = make([]IPAMPodCIDR, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAMPoolAllocation. -func (in *IPAMPoolAllocation) DeepCopy() *IPAMPoolAllocation { - if in == nil { - return nil - } - out := new(IPAMPoolAllocation) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPAMPoolDemand) DeepCopyInto(out *IPAMPoolDemand) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAMPoolDemand. -func (in *IPAMPoolDemand) DeepCopy() *IPAMPoolDemand { - if in == nil { - return nil - } - out := new(IPAMPoolDemand) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPAMPoolRequest) DeepCopyInto(out *IPAMPoolRequest) { - *out = *in - out.Needed = in.Needed - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAMPoolRequest. -func (in *IPAMPoolRequest) DeepCopy() *IPAMPoolRequest { - if in == nil { - return nil - } - out := new(IPAMPoolRequest) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPAMPoolSpec) DeepCopyInto(out *IPAMPoolSpec) { - *out = *in - if in.Requested != nil { - in, out := &in.Requested, &out.Requested - *out = make([]IPAMPoolRequest, len(*in)) - copy(*out, *in) - } - if in.Allocated != nil { - in, out := &in.Allocated, &out.Allocated - *out = make([]IPAMPoolAllocation, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAMPoolSpec. -func (in *IPAMPoolSpec) DeepCopy() *IPAMPoolSpec { - if in == nil { - return nil - } - out := new(IPAMPoolSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPAMSpec) DeepCopyInto(out *IPAMSpec) { - *out = *in - if in.Pool != nil { - in, out := &in.Pool, &out.Pool - *out = make(AllocationMap, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.IPv6Pool != nil { - in, out := &in.IPv6Pool, &out.IPv6Pool - *out = make(AllocationMap, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - in.Pools.DeepCopyInto(&out.Pools) - if in.PodCIDRs != nil { - in, out := &in.PodCIDRs, &out.PodCIDRs - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAMSpec. -func (in *IPAMSpec) DeepCopy() *IPAMSpec { - if in == nil { - return nil - } - out := new(IPAMSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPAMStatus) DeepCopyInto(out *IPAMStatus) { - *out = *in - if in.Used != nil { - in, out := &in.Used, &out.Used - *out = make(AllocationMap, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.IPv6Used != nil { - in, out := &in.IPv6Used, &out.IPv6Used - *out = make(AllocationMap, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.PodCIDRs != nil { - in, out := &in.PodCIDRs, &out.PodCIDRs - *out = make(PodCIDRMap, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - out.OperatorStatus = in.OperatorStatus - if in.ReleaseIPs != nil { - in, out := &in.ReleaseIPs, &out.ReleaseIPs - *out = make(map[string]IPReleaseStatus, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.ReleaseIPv6s != nil { - in, out := &in.ReleaseIPv6s, &out.ReleaseIPv6s - *out = make(map[string]IPReleaseStatus, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAMStatus. -func (in *IPAMStatus) DeepCopy() *IPAMStatus { - if in == nil { - return nil - } - out := new(IPAMStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Limits) DeepCopyInto(out *Limits) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Limits. -func (in *Limits) DeepCopy() *Limits { - if in == nil { - return nil - } - out := new(Limits) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OperatorStatus) DeepCopyInto(out *OperatorStatus) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OperatorStatus. -func (in *OperatorStatus) DeepCopy() *OperatorStatus { - if in == nil { - return nil - } - out := new(OperatorStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in PodCIDRMap) DeepCopyInto(out *PodCIDRMap) { - { - in := &in - *out = make(PodCIDRMap, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodCIDRMap. -func (in PodCIDRMap) DeepCopy() PodCIDRMap { - if in == nil { - return nil - } - out := new(PodCIDRMap) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodCIDRMapEntry) DeepCopyInto(out *PodCIDRMapEntry) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodCIDRMapEntry. -func (in *PodCIDRMapEntry) DeepCopy() *PodCIDRMapEntry { - if in == nil { - return nil - } - out := new(PodCIDRMapEntry) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PoolQuota) DeepCopyInto(out *PoolQuota) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PoolQuota. -func (in *PoolQuota) DeepCopy() *PoolQuota { - if in == nil { - return nil - } - out := new(PoolQuota) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in PoolQuotaMap) DeepCopyInto(out *PoolQuotaMap) { - { - in := &in - *out = make(PoolQuotaMap, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PoolQuotaMap. -func (in PoolQuotaMap) DeepCopy() PoolQuotaMap { - if in == nil { - return nil - } - out := new(PoolQuotaMap) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Subnet) DeepCopyInto(out *Subnet) { - *out = *in - if in.CIDR != nil { - in, out := &in.CIDR, &out.CIDR - *out = (*in).DeepCopy() - } - if in.IPv6CIDR != nil { - in, out := &in.IPv6CIDR, &out.IPv6CIDR - *out = (*in).DeepCopy() - } - if in.Tags != nil { - in, out := &in.Tags, &out.Tags - *out = make(Tags, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subnet. -func (in *Subnet) DeepCopy() *Subnet { - if in == nil { - return nil - } - out := new(Subnet) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in SubnetMap) DeepCopyInto(out *SubnetMap) { - { - in := &in - *out = make(SubnetMap, len(*in)) - for key, val := range *in { - var outVal *Subnet - if val == nil { - (*out)[key] = nil - } else { - in, out := &val, &outVal - *out = new(Subnet) - (*in).DeepCopyInto(*out) - } - (*out)[key] = outVal - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubnetMap. -func (in SubnetMap) DeepCopy() SubnetMap { - if in == nil { - return nil - } - out := new(SubnetMap) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in Tags) DeepCopyInto(out *Tags) { - { - in := &in - *out = make(Tags, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Tags. -func (in Tags) DeepCopy() Tags { - if in == nil { - return nil - } - out := new(Tags) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VirtualNetwork) DeepCopyInto(out *VirtualNetwork) { - *out = *in - if in.CIDRs != nil { - in, out := &in.CIDRs, &out.CIDRs - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.IPv6CIDRs != nil { - in, out := &in.IPv6CIDRs, &out.IPv6CIDRs - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualNetwork. -func (in *VirtualNetwork) DeepCopy() *VirtualNetwork { - if in == nil { - return nil - } - out := new(VirtualNetwork) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in VirtualNetworkMap) DeepCopyInto(out *VirtualNetworkMap) { - { - in := &in - *out = make(VirtualNetworkMap, len(*in)) - for key, val := range *in { - var outVal *VirtualNetwork - if val == nil { - (*out)[key] = nil - } else { - in, out := &val, &outVal - *out = new(VirtualNetwork) - (*in).DeepCopyInto(*out) - } - (*out)[key] = outVal - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualNetworkMap. -func (in VirtualNetworkMap) DeepCopy() VirtualNetworkMap { - if in == nil { - return nil - } - out := new(VirtualNetworkMap) - in.DeepCopyInto(out) - return *out -} diff --git a/vendor/github.com/cilium/cilium/pkg/ipam/types/zz_generated.deepequal.go b/vendor/github.com/cilium/cilium/pkg/ipam/types/zz_generated.deepequal.go deleted file mode 100644 index cc2d82b01..000000000 --- a/vendor/github.com/cilium/cilium/pkg/ipam/types/zz_generated.deepequal.go +++ /dev/null @@ -1,585 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepequal-gen. DO NOT EDIT. - -package types - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *AllocationIP) DeepEqual(other *AllocationIP) bool { - if other == nil { - return false - } - - if in.Owner != other.Owner { - return false - } - if in.Resource != other.Resource { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *AllocationMap) DeepEqual(other *AllocationMap) bool { - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if !inValue.DeepEqual(&otherValue) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *IPAMPoolAllocation) DeepEqual(other *IPAMPoolAllocation) bool { - if other == nil { - return false - } - - if in.Pool != other.Pool { - return false - } - if ((in.CIDRs != nil) && (other.CIDRs != nil)) || ((in.CIDRs == nil) != (other.CIDRs == nil)) { - in, other := &in.CIDRs, &other.CIDRs - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *IPAMPoolDemand) DeepEqual(other *IPAMPoolDemand) bool { - if other == nil { - return false - } - - if in.IPv4Addrs != other.IPv4Addrs { - return false - } - if in.IPv6Addrs != other.IPv6Addrs { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *IPAMPoolRequest) DeepEqual(other *IPAMPoolRequest) bool { - if other == nil { - return false - } - - if in.Pool != other.Pool { - return false - } - if in.Needed != other.Needed { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *IPAMPoolSpec) DeepEqual(other *IPAMPoolSpec) bool { - if other == nil { - return false - } - - if ((in.Requested != nil) && (other.Requested != nil)) || ((in.Requested == nil) != (other.Requested == nil)) { - in, other := &in.Requested, &other.Requested - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.Allocated != nil) && (other.Allocated != nil)) || ((in.Allocated == nil) != (other.Allocated == nil)) { - in, other := &in.Allocated, &other.Allocated - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *IPAMSpec) DeepEqual(other *IPAMSpec) bool { - if other == nil { - return false - } - - if ((in.Pool != nil) && (other.Pool != nil)) || ((in.Pool == nil) != (other.Pool == nil)) { - in, other := &in.Pool, &other.Pool - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if ((in.IPv6Pool != nil) && (other.IPv6Pool != nil)) || ((in.IPv6Pool == nil) != (other.IPv6Pool == nil)) { - in, other := &in.IPv6Pool, &other.IPv6Pool - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if !in.Pools.DeepEqual(&other.Pools) { - return false - } - - if ((in.PodCIDRs != nil) && (other.PodCIDRs != nil)) || ((in.PodCIDRs == nil) != (other.PodCIDRs == nil)) { - in, other := &in.PodCIDRs, &other.PodCIDRs - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if in.MinAllocate != other.MinAllocate { - return false - } - if in.MaxAllocate != other.MaxAllocate { - return false - } - if in.PreAllocate != other.PreAllocate { - return false - } - if in.MaxAboveWatermark != other.MaxAboveWatermark { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *IPAMStatus) DeepEqual(other *IPAMStatus) bool { - if other == nil { - return false - } - - if ((in.Used != nil) && (other.Used != nil)) || ((in.Used == nil) != (other.Used == nil)) { - in, other := &in.Used, &other.Used - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if ((in.IPv6Used != nil) && (other.IPv6Used != nil)) || ((in.IPv6Used == nil) != (other.IPv6Used == nil)) { - in, other := &in.IPv6Used, &other.IPv6Used - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if ((in.PodCIDRs != nil) && (other.PodCIDRs != nil)) || ((in.PodCIDRs == nil) != (other.PodCIDRs == nil)) { - in, other := &in.PodCIDRs, &other.PodCIDRs - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if in.OperatorStatus != other.OperatorStatus { - return false - } - - if ((in.ReleaseIPs != nil) && (other.ReleaseIPs != nil)) || ((in.ReleaseIPs == nil) != (other.ReleaseIPs == nil)) { - in, other := &in.ReleaseIPs, &other.ReleaseIPs - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if inValue != otherValue { - return false - } - } - } - } - } - - if ((in.ReleaseIPv6s != nil) && (other.ReleaseIPv6s != nil)) || ((in.ReleaseIPv6s == nil) != (other.ReleaseIPv6s == nil)) { - in, other := &in.ReleaseIPv6s, &other.ReleaseIPv6s - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if inValue != otherValue { - return false - } - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Limits) DeepEqual(other *Limits) bool { - if other == nil { - return false - } - - if in.Adapters != other.Adapters { - return false - } - if in.IPv4 != other.IPv4 { - return false - } - if in.IPv6 != other.IPv6 { - return false - } - if in.HypervisorType != other.HypervisorType { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *OperatorStatus) DeepEqual(other *OperatorStatus) bool { - if other == nil { - return false - } - - if in.Error != other.Error { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PodCIDRMap) DeepEqual(other *PodCIDRMap) bool { - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if !inValue.DeepEqual(&otherValue) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PodCIDRMapEntry) DeepEqual(other *PodCIDRMapEntry) bool { - if other == nil { - return false - } - - if in.Status != other.Status { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PoolQuota) DeepEqual(other *PoolQuota) bool { - if other == nil { - return false - } - - if in.AvailabilityZone != other.AvailabilityZone { - return false - } - if in.AvailableIPs != other.AvailableIPs { - return false - } - if in.AvailableIPv6s != other.AvailableIPv6s { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PoolQuotaMap) DeepEqual(other *PoolQuotaMap) bool { - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if !inValue.DeepEqual(&otherValue) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Subnet) DeepEqual(other *Subnet) bool { - if other == nil { - return false - } - - if in.ID != other.ID { - return false - } - if in.Name != other.Name { - return false - } - if (in.CIDR == nil) != (other.CIDR == nil) { - return false - } else if in.CIDR != nil { - if !in.CIDR.DeepEqual(other.CIDR) { - return false - } - } - - if (in.IPv6CIDR == nil) != (other.IPv6CIDR == nil) { - return false - } else if in.IPv6CIDR != nil { - if !in.IPv6CIDR.DeepEqual(other.IPv6CIDR) { - return false - } - } - - if in.AvailabilityZone != other.AvailabilityZone { - return false - } - if in.VirtualNetworkID != other.VirtualNetworkID { - return false - } - if in.AvailableAddresses != other.AvailableAddresses { - return false - } - if in.AvailableIPv6Addresses != other.AvailableIPv6Addresses { - return false - } - if ((in.Tags != nil) && (other.Tags != nil)) || ((in.Tags == nil) != (other.Tags == nil)) { - in, other := &in.Tags, &other.Tags - if other == nil || !in.DeepEqual(other) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *SubnetMap) DeepEqual(other *SubnetMap) bool { - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if !inValue.DeepEqual(otherValue) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Tags) DeepEqual(other *Tags) bool { - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if inValue != otherValue { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *VirtualNetwork) DeepEqual(other *VirtualNetwork) bool { - if other == nil { - return false - } - - if in.ID != other.ID { - return false - } - if in.PrimaryCIDR != other.PrimaryCIDR { - return false - } - if ((in.CIDRs != nil) && (other.CIDRs != nil)) || ((in.CIDRs == nil) != (other.CIDRs == nil)) { - in, other := &in.CIDRs, &other.CIDRs - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if ((in.IPv6CIDRs != nil) && (other.IPv6CIDRs != nil)) || ((in.IPv6CIDRs == nil) != (other.IPv6CIDRs == nil)) { - in, other := &in.IPv6CIDRs, &other.IPv6CIDRs - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *VirtualNetworkMap) DeepEqual(other *VirtualNetworkMap) bool { - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if !inValue.DeepEqual(otherValue) { - return false - } - } - } - } - - return true -} diff --git a/vendor/github.com/cilium/cilium/pkg/ipcache/types/entries.go b/vendor/github.com/cilium/cilium/pkg/ipcache/types/entries.go deleted file mode 100644 index ff78e832c..000000000 --- a/vendor/github.com/cilium/cilium/pkg/ipcache/types/entries.go +++ /dev/null @@ -1,34 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package types - -import ( - "net/netip" - - "github.com/cilium/cilium/api/v1/models" -) - -type IPListEntrySlice []*models.IPListEntry - -func (s IPListEntrySlice) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} - -// Less sorts the IPListEntry objects by CIDR prefix then IP address. -// Given that the same IP cannot map to more than one identity, no further -// sorting is performed. -func (s IPListEntrySlice) Less(i, j int) bool { - iNet, _ := netip.ParsePrefix(*s[i].Cidr) - jNet, _ := netip.ParsePrefix(*s[j].Cidr) - iPrefixSize := iNet.Bits() - jPrefixSize := jNet.Bits() - if iPrefixSize == jPrefixSize { - return iNet.Addr().Less(jNet.Addr()) - } - return iPrefixSize < jPrefixSize -} - -func (s IPListEntrySlice) Len() int { - return len(s) -} diff --git a/vendor/github.com/cilium/cilium/pkg/ipcache/types/types.go b/vendor/github.com/cilium/cilium/pkg/ipcache/types/types.go deleted file mode 100644 index d5b3c9e73..000000000 --- a/vendor/github.com/cilium/cilium/pkg/ipcache/types/types.go +++ /dev/null @@ -1,109 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package types - -import ( - "context" - "net" - "net/netip" - "strconv" - "strings" - "sync" - - "github.com/cilium/cilium/pkg/identity" - "github.com/cilium/cilium/pkg/identity/cache" -) - -// PolicyHandler is responsible for handling identity updates into the core -// policy engine. See SelectorCache.UpdateIdentities() for more details. -type PolicyHandler interface { - UpdateIdentities(added, deleted cache.IdentityCache, wg *sync.WaitGroup) -} - -// DatapathHandler is responsible for ensuring that policy updates in the -// core policy engine are pushed into the underlying BPF policy maps, to ensure -// that the policies are actively being enforced in the datapath for any new -// identities that have been updated using 'PolicyHandler'. -// -// Wait on the returned sync.WaitGroup to ensure that the operation is complete -// before updating the datapath's IPCache maps. -type DatapathHandler interface { - UpdatePolicyMaps(context.Context, *sync.WaitGroup) *sync.WaitGroup -} - -// ResourceID identifies a unique copy of a resource that provides a source for -// information tied to an IP address in the IPCache. -type ResourceID string - -// ResourceKind determines the source of the ResourceID. Typically this is the -// short name for the k8s resource. -type ResourceKind string - -var ( - ResourceKindCNP = ResourceKind("cnp") - ResourceKindCCNP = ResourceKind("ccnp") - ResourceKindDaemon = ResourceKind("daemon") - ResourceKindEndpoint = ResourceKind("ep") - ResourceKindNetpol = ResourceKind("netpol") - ResourceKindNode = ResourceKind("node") -) - -// NewResourceID returns a ResourceID populated with the standard fields for -// uniquely identifying a source of IPCache information. -func NewResourceID(kind ResourceKind, namespace, name string) ResourceID { - str := strings.Builder{} - str.Grow(len(kind) + 1 + len(namespace) + 1 + len(name)) - str.WriteString(string(kind)) - str.WriteRune('/') - str.WriteString(namespace) - str.WriteRune('/') - str.WriteString(name) - return ResourceID(str.String()) -} - -// TunnelPeer is the IP address of the host associated with this prefix. This is -// typically used to establish a tunnel, e.g. in tunnel mode or for encryption. -// This type implements ipcache.IPMetadata -type TunnelPeer struct{ netip.Addr } - -func (t TunnelPeer) IP() net.IP { - return t.AsSlice() -} - -// EncryptKey is the identity of the encryption key. -// This type implements ipcache.IPMetadata -type EncryptKey uint8 - -const EncryptKeyEmpty = EncryptKey(0) - -func (e EncryptKey) IsValid() bool { - return e != EncryptKeyEmpty -} - -func (e EncryptKey) Uint8() uint8 { - return uint8(e) -} - -func (e EncryptKey) String() string { - return strconv.Itoa(int(e)) -} - -// RequestedIdentity is a desired numeric identity for the prefix. When the -// prefix is next injected, this numeric ID will be requested from the local -// allocator. If the allocator can accommodate that request, it will do so. -// In order for this to be useful, the prefix must not already have an identity -// (or its set of labels must have changed), and that numeric identity must -// be free. -// Thus, the numeric ID should have already been held-aside in the allocator -// using WithholdLocalIdentities(). That will ensure the numeric ID remains free -// for the prefix to request. -type RequestedIdentity identity.NumericIdentity - -func (id RequestedIdentity) IsValid() bool { - return id != 0 -} - -func (id RequestedIdentity) ID() identity.NumericIdentity { - return identity.NumericIdentity(id) -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/const.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/const.go index 8ec0dc5b9..98b457073 100644 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/const.go +++ b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/const.go @@ -34,9 +34,12 @@ const ( // kubernetes namespace's labels. PodNamespaceMetaLabels = LabelPrefix + ".namespace.labels" + // PodNamespaceMetaLabelsPrefix is the prefix used for kubernetes namespace's labels + PodNamespaceMetaLabelsPrefix = PodNamespaceMetaLabels + "." + // PodNamespaceMetaNameLabel is the label that Kubernetes automatically adds // to namespaces. - PodNamespaceMetaNameLabel = PodNamespaceMetaLabels + "." + LabelMetadataName + PodNamespaceMetaNameLabel = PodNamespaceMetaLabelsPrefix + LabelMetadataName // LabelMetadataName is the label name which, in-tree, is used to // automatically label namespaces, so they can be selected easily by tools diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/register.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/register.go index 7ca1ced52..4ea730e3f 100644 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/register.go +++ b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/register.go @@ -15,5 +15,5 @@ const ( // // Maintainers: Run ./Documentation/check-crd-compat-table.sh for each release // Developers: Bump patch for each change in the CRD schema. - CustomResourceDefinitionSchemaVersion = "1.29.5" + CustomResourceDefinitionSchemaVersion = "1.29.7" ) diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/utils/utils.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/utils/utils.go deleted file mode 100644 index d66005103..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/utils/utils.go +++ /dev/null @@ -1,364 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package utils - -import ( - "github.com/sirupsen/logrus" - "k8s.io/apimachinery/pkg/types" - - k8sConst "github.com/cilium/cilium/pkg/k8s/apis/cilium.io" - slim_metav1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" - "github.com/cilium/cilium/pkg/labels" - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/policy/api" -) - -const ( - // subsysK8s is the value for logfields.LogSubsys - subsysK8s = "k8s" - // podPrefixLbl is the value the prefix used in the label selector to - // represent pods on the default namespace. - podPrefixLbl = labels.LabelSourceK8sKeyPrefix + k8sConst.PodNamespaceLabel - - // podAnyPrefixLbl is the value of the prefix used in the label selector to - // represent pods in the default namespace for any source type. - podAnyPrefixLbl = labels.LabelSourceAnyKeyPrefix + k8sConst.PodNamespaceLabel - - // podInitLbl is the label used in a label selector to match on - // initializing pods. - podInitLbl = labels.LabelSourceReservedKeyPrefix + labels.IDNameInit - - // ResourceTypeCiliumNetworkPolicy is the resource type used for the - // PolicyLabelDerivedFrom label - ResourceTypeCiliumNetworkPolicy = "CiliumNetworkPolicy" - - // ResourceTypeCiliumClusterwideNetworkPolicy is the resource type used for the - // PolicyLabelDerivedFrom label - ResourceTypeCiliumClusterwideNetworkPolicy = "CiliumClusterwideNetworkPolicy" -) - -var ( - // log is the k8s package logger object. - log = logging.DefaultLogger.WithField(logfields.LogSubsys, subsysK8s) -) - -// GetPolicyLabels returns a LabelArray for the given namespace and name. -func GetPolicyLabels(ns, name string, uid types.UID, derivedFrom string) labels.LabelArray { - // Keep labels sorted by the key. - labelsArr := labels.LabelArray{ - labels.NewLabel(k8sConst.PolicyLabelDerivedFrom, derivedFrom, labels.LabelSourceK8s), - labels.NewLabel(k8sConst.PolicyLabelName, name, labels.LabelSourceK8s), - } - - // For clusterwide policy namespace will be empty. - if ns != "" { - nsLabel := labels.NewLabel(k8sConst.PolicyLabelNamespace, ns, labels.LabelSourceK8s) - labelsArr = append(labelsArr, nsLabel) - } - - srcLabel := labels.NewLabel(k8sConst.PolicyLabelUID, string(uid), labels.LabelSourceK8s) - return append(labelsArr, srcLabel) -} - -// getEndpointSelector converts the provided labelSelector into an EndpointSelector, -// adding the relevant matches for namespaces based on the provided options. -// If no namespace is provided then it is assumed that the selector is global to the cluster -// this is when translating selectors for CiliumClusterwideNetworkPolicy. -func getEndpointSelector(namespace string, labelSelector *slim_metav1.LabelSelector, addK8sPrefix, matchesInit bool) api.EndpointSelector { - es := api.NewESFromK8sLabelSelector("", labelSelector) - - // The k8s prefix must not be added to reserved labels. - if addK8sPrefix && es.HasKeyPrefix(labels.LabelSourceReservedKeyPrefix) { - return es - } - - // The user can explicitly specify the namespace in the - // FromEndpoints selector. If omitted, we limit the - // scope to the namespace the policy lives in. - // - // Policies applying on initializing pods are a special case. - // Those pods don't have any labels, so they don't have a namespace label either. - // Don't add a namespace label to those endpoint selectors, or we wouldn't be - // able to match on those pods. - if !es.HasKey(podPrefixLbl) && !es.HasKey(podAnyPrefixLbl) { - if namespace == "" { - // For a clusterwide policy if a namespace is not specified in the labels we add - // a selector to only match endpoints that contains a namespace label. - // This is to make sure that we are only allowing traffic for cilium managed k8s endpoints - // and even if a wildcard is provided in the selector we don't proceed with a truly - // empty(allow all) endpoint selector for the policy. - if !matchesInit { - es.AddMatchExpression(podPrefixLbl, slim_metav1.LabelSelectorOpExists, []string{}) - } - } else { - es.AddMatch(podPrefixLbl, namespace) - } - } - - return es -} - -func parseToCiliumIngressCommonRule(namespace string, es api.EndpointSelector, ing api.IngressCommonRule) api.IngressCommonRule { - matchesInit := matchesPodInit(es) - var retRule api.IngressCommonRule - - if ing.FromEndpoints != nil { - retRule.FromEndpoints = make([]api.EndpointSelector, len(ing.FromEndpoints)) - for j, ep := range ing.FromEndpoints { - retRule.FromEndpoints[j] = getEndpointSelector(namespace, ep.LabelSelector, true, matchesInit) - } - } - - if ing.FromNodes != nil { - retRule.FromNodes = make([]api.EndpointSelector, len(ing.FromNodes)) - for j, node := range ing.FromNodes { - retRule.FromNodes[j] = api.NewESFromK8sLabelSelector("", node.LabelSelector) - } - } - - if ing.FromCIDR != nil { - retRule.FromCIDR = make([]api.CIDR, len(ing.FromCIDR)) - copy(retRule.FromCIDR, ing.FromCIDR) - } - - if ing.FromCIDRSet != nil { - retRule.FromCIDRSet = make([]api.CIDRRule, len(ing.FromCIDRSet)) - copy(retRule.FromCIDRSet, ing.FromCIDRSet) - } - - if ing.FromRequires != nil { - retRule.FromRequires = make([]api.EndpointSelector, len(ing.FromRequires)) - for j, ep := range ing.FromRequires { - retRule.FromRequires[j] = getEndpointSelector(namespace, ep.LabelSelector, false, matchesInit) - } - } - - if ing.FromEntities != nil { - retRule.FromEntities = make([]api.Entity, len(ing.FromEntities)) - copy(retRule.FromEntities, ing.FromEntities) - } - - return retRule -} - -func parseToCiliumIngressRule(namespace string, es api.EndpointSelector, inRules []api.IngressRule) []api.IngressRule { - var retRules []api.IngressRule - - if inRules != nil { - retRules = make([]api.IngressRule, len(inRules)) - for i, ing := range inRules { - if ing.ToPorts != nil { - retRules[i].ToPorts = make([]api.PortRule, len(ing.ToPorts)) - copy(retRules[i].ToPorts, ing.ToPorts) - } - if ing.ICMPs != nil { - retRules[i].ICMPs = make(api.ICMPRules, len(ing.ICMPs)) - copy(retRules[i].ICMPs, ing.ICMPs) - } - retRules[i].IngressCommonRule = parseToCiliumIngressCommonRule(namespace, es, ing.IngressCommonRule) - retRules[i].Authentication = ing.Authentication.DeepCopy() - retRules[i].SetAggregatedSelectors() - } - } - return retRules -} - -func parseToCiliumIngressDenyRule(namespace string, es api.EndpointSelector, inRules []api.IngressDenyRule) []api.IngressDenyRule { - var retRules []api.IngressDenyRule - - if inRules != nil { - retRules = make([]api.IngressDenyRule, len(inRules)) - for i, ing := range inRules { - if ing.ToPorts != nil { - retRules[i].ToPorts = make([]api.PortDenyRule, len(ing.ToPorts)) - copy(retRules[i].ToPorts, ing.ToPorts) - } - if ing.ICMPs != nil { - retRules[i].ICMPs = make(api.ICMPRules, len(ing.ICMPs)) - copy(retRules[i].ICMPs, ing.ICMPs) - } - retRules[i].IngressCommonRule = parseToCiliumIngressCommonRule(namespace, es, ing.IngressCommonRule) - retRules[i].SetAggregatedSelectors() - } - } - return retRules -} - -func parseToCiliumEgressCommonRule(namespace string, es api.EndpointSelector, egr api.EgressCommonRule) api.EgressCommonRule { - matchesInit := matchesPodInit(es) - var retRule api.EgressCommonRule - if egr.ToEndpoints != nil { - retRule.ToEndpoints = make([]api.EndpointSelector, len(egr.ToEndpoints)) - for j, ep := range egr.ToEndpoints { - retRule.ToEndpoints[j] = getEndpointSelector(namespace, ep.LabelSelector, true, matchesInit) - } - } - - if egr.ToCIDR != nil { - retRule.ToCIDR = make([]api.CIDR, len(egr.ToCIDR)) - copy(retRule.ToCIDR, egr.ToCIDR) - } - - if egr.ToCIDRSet != nil { - retRule.ToCIDRSet = make(api.CIDRRuleSlice, len(egr.ToCIDRSet)) - copy(retRule.ToCIDRSet, egr.ToCIDRSet) - } - - if egr.ToRequires != nil { - retRule.ToRequires = make([]api.EndpointSelector, len(egr.ToRequires)) - for j, ep := range egr.ToRequires { - retRule.ToRequires[j] = getEndpointSelector(namespace, ep.LabelSelector, false, matchesInit) - } - } - - if egr.ToServices != nil { - retRule.ToServices = make([]api.Service, len(egr.ToServices)) - copy(retRule.ToServices, egr.ToServices) - } - - if egr.ToEntities != nil { - retRule.ToEntities = make([]api.Entity, len(egr.ToEntities)) - copy(retRule.ToEntities, egr.ToEntities) - } - - if egr.ToNodes != nil { - retRule.ToNodes = make([]api.EndpointSelector, len(egr.ToNodes)) - for j, node := range egr.ToNodes { - retRule.ToNodes[j] = api.NewESFromK8sLabelSelector("", node.LabelSelector) - } - } - - if egr.ToGroups != nil { - retRule.ToGroups = make([]api.Groups, len(egr.ToGroups)) - copy(retRule.ToGroups, egr.ToGroups) - } - - return retRule -} - -func parseToCiliumEgressRule(namespace string, es api.EndpointSelector, inRules []api.EgressRule) []api.EgressRule { - var retRules []api.EgressRule - - if inRules != nil { - retRules = make([]api.EgressRule, len(inRules)) - for i, egr := range inRules { - if egr.ToPorts != nil { - retRules[i].ToPorts = make([]api.PortRule, len(egr.ToPorts)) - copy(retRules[i].ToPorts, egr.ToPorts) - } - - if egr.ICMPs != nil { - retRules[i].ICMPs = make(api.ICMPRules, len(egr.ICMPs)) - copy(retRules[i].ICMPs, egr.ICMPs) - } - - if egr.ToFQDNs != nil { - retRules[i].ToFQDNs = make([]api.FQDNSelector, len(egr.ToFQDNs)) - copy(retRules[i].ToFQDNs, egr.ToFQDNs) - } - - retRules[i].EgressCommonRule = parseToCiliumEgressCommonRule(namespace, es, egr.EgressCommonRule) - retRules[i].Authentication = egr.Authentication - retRules[i].SetAggregatedSelectors() - } - } - return retRules -} - -func parseToCiliumEgressDenyRule(namespace string, es api.EndpointSelector, inRules []api.EgressDenyRule) []api.EgressDenyRule { - var retRules []api.EgressDenyRule - - if inRules != nil { - retRules = make([]api.EgressDenyRule, len(inRules)) - for i, egr := range inRules { - if egr.ToPorts != nil { - retRules[i].ToPorts = make([]api.PortDenyRule, len(egr.ToPorts)) - copy(retRules[i].ToPorts, egr.ToPorts) - } - - if egr.ICMPs != nil { - retRules[i].ICMPs = make(api.ICMPRules, len(egr.ICMPs)) - copy(retRules[i].ICMPs, egr.ICMPs) - } - - retRules[i].EgressCommonRule = parseToCiliumEgressCommonRule(namespace, es, egr.EgressCommonRule) - retRules[i].SetAggregatedSelectors() - } - } - return retRules -} - -func matchesPodInit(epSelector api.EndpointSelector) bool { - if epSelector.LabelSelector == nil { - return false - } - return epSelector.HasKey(podInitLbl) -} - -// namespacesAreValid checks the set of namespaces from a rule returns true if -// they are not specified, or if they are specified and match the namespace -// where the rule is being inserted. -func namespacesAreValid(namespace string, userNamespaces []string) bool { - return len(userNamespaces) == 0 || - (len(userNamespaces) == 1 && userNamespaces[0] == namespace) -} - -// ParseToCiliumRule returns an api.Rule with all the labels parsed into cilium -// labels. If the namespace provided is empty then the rule is cluster scoped, this -// might happen in case of CiliumClusterwideNetworkPolicy which enforces a policy on the cluster -// instead of the particular namespace. -func ParseToCiliumRule(namespace, name string, uid types.UID, r *api.Rule) *api.Rule { - retRule := &api.Rule{} - if r.EndpointSelector.LabelSelector != nil { - retRule.EndpointSelector = api.NewESFromK8sLabelSelector("", r.EndpointSelector.LabelSelector) - // The PodSelector should only reflect to the same namespace - // the policy is being stored, thus we add the namespace to - // the MatchLabels map. - // - // Policies applying to all namespaces are a special case. - // Such policies can match on any traffic from Pods or Nodes, - // so it wouldn't make sense to inject a namespace match for - // those policies. - if namespace != "" { - userNamespace, present := r.EndpointSelector.GetMatch(podPrefixLbl) - if present && !namespacesAreValid(namespace, userNamespace) { - log.WithFields(logrus.Fields{ - logfields.K8sNamespace: namespace, - logfields.CiliumNetworkPolicyName: name, - logfields.K8sNamespace + ".illegal": userNamespace, - }).Warn("CiliumNetworkPolicy contains illegal namespace match in EndpointSelector." + - " EndpointSelector always applies in namespace of the policy resource, removing illegal namespace match'.") - } - retRule.EndpointSelector.AddMatch(podPrefixLbl, namespace) - } - } else if r.NodeSelector.LabelSelector != nil { - retRule.NodeSelector = api.NewESFromK8sLabelSelector("", r.NodeSelector.LabelSelector) - } - - retRule.Ingress = parseToCiliumIngressRule(namespace, r.EndpointSelector, r.Ingress) - retRule.IngressDeny = parseToCiliumIngressDenyRule(namespace, r.EndpointSelector, r.IngressDeny) - retRule.Egress = parseToCiliumEgressRule(namespace, r.EndpointSelector, r.Egress) - retRule.EgressDeny = parseToCiliumEgressDenyRule(namespace, r.EndpointSelector, r.EgressDeny) - - retRule.Labels = ParseToCiliumLabels(namespace, name, uid, r.Labels) - - retRule.Description = r.Description - retRule.EnableDefaultDeny = r.EnableDefaultDeny - - return retRule -} - -// ParseToCiliumLabels returns all ruleLbls appended with a specific label that -// represents the given namespace and name along with a label that specifies -// these labels were derived from a CiliumNetworkPolicy. -func ParseToCiliumLabels(namespace, name string, uid types.UID, ruleLbs labels.LabelArray) labels.LabelArray { - resourceType := ResourceTypeCiliumNetworkPolicy - if namespace == "" { - resourceType = ResourceTypeCiliumClusterwideNetworkPolicy - } - - policyLbls := GetPolicyLabels(namespace, name, uid, resourceType) - return append(policyLbls, ruleLbs...).Sort() -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/ccec_types.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/ccec_types.go deleted file mode 100644 index 48823bf8b..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/ccec_types.go +++ /dev/null @@ -1,39 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v2 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:categories={cilium},singular="ciliumclusterwideenvoyconfig",path="ciliumclusterwideenvoyconfigs",scope="Cluster",shortName={ccec} -// +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",description="The age of the identity",name="Age",type=date -// +kubebuilder:storageversion - -type CiliumClusterwideEnvoyConfig struct { - // +k8s:openapi-gen=false - // +deepequal-gen=false - metav1.TypeMeta `json:",inline"` - // +k8s:openapi-gen=false - // +deepequal-gen=false - metav1.ObjectMeta `json:"metadata"` - - // +k8s:openapi-gen=false - Spec CiliumEnvoyConfigSpec `json:"spec,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +deepequal-gen=false - -// CiliumClusterwideEnvoyConfigList is a list of CiliumClusterwideEnvoyConfig objects. -type CiliumClusterwideEnvoyConfigList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - // Items is a list of CiliumClusterwideEnvoyConfig. - Items []CiliumClusterwideEnvoyConfig `json:"items"` -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/ccnp_types.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/ccnp_types.go deleted file mode 100644 index 14ff2c20c..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/ccnp_types.go +++ /dev/null @@ -1,141 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v2 - -import ( - "fmt" - "reflect" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - k8sCiliumUtils "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/utils" - "github.com/cilium/cilium/pkg/policy/api" -) - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +deepequal-gen:private-method=true -// +kubebuilder:resource:categories={cilium,ciliumpolicy},singular="ciliumclusterwidenetworkpolicy",path="ciliumclusterwidenetworkpolicies",scope="Cluster",shortName={ccnp} -// +kubebuilder:subresource:status -// +kubebuilder:storageversion - -// CiliumClusterwideNetworkPolicy is a Kubernetes third-party resource with an -// modified version of CiliumNetworkPolicy which is cluster scoped rather than -// namespace scoped. -type CiliumClusterwideNetworkPolicy struct { - // +deepequal-gen=false - metav1.TypeMeta `json:",inline"` - // +deepequal-gen=false - metav1.ObjectMeta `json:"metadata"` - - // Spec is the desired Cilium specific rule specification. - Spec *api.Rule `json:"spec,omitempty"` - - // Specs is a list of desired Cilium specific rule specification. - Specs api.Rules `json:"specs,omitempty"` - - // Status is the status of the Cilium policy rule. - // - // The reason this field exists in this structure is due a bug in the k8s - // code-generator that doesn't create a `UpdateStatus` method because the - // field does not exist in the structure. - // - // +kubebuilder:validation:Optional - Status CiliumNetworkPolicyStatus `json:"status"` -} - -// DeepEqual compares 2 CCNPs while ignoring the LastAppliedConfigAnnotation -// and ignoring the Status field of the CCNP. -func (in *CiliumClusterwideNetworkPolicy) DeepEqual(other *CiliumClusterwideNetworkPolicy) bool { - return objectMetaDeepEqual(in.ObjectMeta, other.ObjectMeta) && in.deepEqual(other) -} - -// GetPolicyStatus returns the CiliumClusterwideNetworkPolicyNodeStatus corresponding to -// nodeName in the provided CiliumClusterwideNetworkPolicy. If Nodes within the rule's -// Status is nil, returns an empty CiliumClusterwideNetworkPolicyNodeStatus. -func (r *CiliumClusterwideNetworkPolicy) GetPolicyStatus(nodeName string) CiliumNetworkPolicyNodeStatus { - if r.Status.Nodes == nil { - return CiliumNetworkPolicyNodeStatus{} - } - return r.Status.Nodes[nodeName] -} - -// SetPolicyStatus sets the given policy status for the given nodes' map. -func (r *CiliumClusterwideNetworkPolicy) SetPolicyStatus(nodeName string, cnpns CiliumNetworkPolicyNodeStatus) { - if r.Status.Nodes == nil { - r.Status.Nodes = map[string]CiliumNetworkPolicyNodeStatus{} - } - r.Status.Nodes[nodeName] = cnpns -} - -// SetDerivedPolicyStatus set the derivative policy status for the given -// derivative policy name. -func (r *CiliumClusterwideNetworkPolicy) SetDerivedPolicyStatus(derivativePolicyName string, status CiliumNetworkPolicyNodeStatus) { - if r.Status.DerivativePolicies == nil { - r.Status.DerivativePolicies = map[string]CiliumNetworkPolicyNodeStatus{} - } - r.Status.DerivativePolicies[derivativePolicyName] = status -} - -// AnnotationsEquals returns true if ObjectMeta.Annotations of each -// CiliumClusterwideNetworkPolicy are equivalent (i.e., they contain equivalent key-value -// pairs). -func (r *CiliumClusterwideNetworkPolicy) AnnotationsEquals(o *CiliumClusterwideNetworkPolicy) bool { - if o == nil { - return r == nil - } - return reflect.DeepEqual(r.ObjectMeta.Annotations, o.ObjectMeta.Annotations) -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:openapi-gen=false -// +deepequal-gen=false - -// CiliumClusterwideNetworkPolicyList is a list of -// CiliumClusterwideNetworkPolicy objects. -type CiliumClusterwideNetworkPolicyList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - // Items is a list of CiliumClusterwideNetworkPolicies. - Items []CiliumClusterwideNetworkPolicy `json:"items"` -} - -// Parse parses a CiliumClusterwideNetworkPolicy and returns a list of cilium -// policy rules. -func (r *CiliumClusterwideNetworkPolicy) Parse() (api.Rules, error) { - if r.ObjectMeta.Name == "" { - return nil, NewErrParse("CiliumClusterwideNetworkPolicy must have name") - } - - name := r.ObjectMeta.Name - uid := r.ObjectMeta.UID - - retRules := api.Rules{} - - if r.Spec == nil && r.Specs == nil { - return nil, ErrEmptyCCNP - } - - if r.Spec != nil { - if err := r.Spec.Sanitize(); err != nil { - return nil, NewErrParse(fmt.Sprintf("Invalid CiliumClusterwideNetworkPolicy spec: %s", err)) - } - cr := k8sCiliumUtils.ParseToCiliumRule("", name, uid, r.Spec) - retRules = append(retRules, cr) - } - if r.Specs != nil { - for _, rule := range r.Specs { - if err := rule.Sanitize(); err != nil { - return nil, NewErrParse(fmt.Sprintf("Invalid CiliumClusterwideNetworkPolicy specs: %s", err)) - - } - cr := k8sCiliumUtils.ParseToCiliumRule("", name, uid, rule) - retRules = append(retRules, cr) - } - } - - return retRules, nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/cec_types.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/cec_types.go deleted file mode 100644 index 4fd3150e2..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/cec_types.go +++ /dev/null @@ -1,173 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v2 - -import ( - "bytes" - "encoding/json" - "fmt" - - "google.golang.org/protobuf/encoding/protojson" - "google.golang.org/protobuf/encoding/prototext" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/types/known/anypb" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - slim_metav1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" - "github.com/cilium/cilium/pkg/option" -) - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:categories={cilium},singular="ciliumenvoyconfig",path="ciliumenvoyconfigs",scope="Namespaced",shortName={cec} -// +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",description="The age of the identity",name="Age",type=date -// +kubebuilder:storageversion - -type CiliumEnvoyConfig struct { - // +k8s:openapi-gen=false - // +deepequal-gen=false - metav1.TypeMeta `json:",inline"` - // +k8s:openapi-gen=false - // +deepequal-gen=false - metav1.ObjectMeta `json:"metadata"` - - // +k8s:openapi-gen=false - Spec CiliumEnvoyConfigSpec `json:"spec,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +deepequal-gen=false - -// CiliumEnvoyConfigList is a list of CiliumEnvoyConfig objects. -type CiliumEnvoyConfigList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - // Items is a list of CiliumEnvoyConfig. - Items []CiliumEnvoyConfig `json:"items"` -} - -type CiliumEnvoyConfigSpec struct { - // Services specifies Kubernetes services for which traffic is - // forwarded to an Envoy listener for L7 load balancing. Backends - // of these services are automatically synced to Envoy usign EDS. - // - // +kubebuilder:validation:Optional - Services []*ServiceListener `json:"services,omitempty"` - - // BackendServices specifies Kubernetes services whose backends - // are automatically synced to Envoy using EDS. Traffic for these - // services is not forwarded to an Envoy listener. This allows an - // Envoy listener load balance traffic to these backends while - // normal Cilium service load balancing takes care of balancing - // traffic for these services at the same time. - // - // +kubebuilder:validation:Optional - BackendServices []*Service `json:"backendServices,omitempty"` - - // Envoy xDS resources, a list of the following Envoy resource types: - // type.googleapis.com/envoy.config.listener.v3.Listener, - // type.googleapis.com/envoy.config.route.v3.RouteConfiguration, - // type.googleapis.com/envoy.config.cluster.v3.Cluster, - // type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment, and - // type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.Secret. - // - // +kubebuilder:validation:Required - Resources []XDSResource `json:"resources,omitempty"` - - // NodeSelector is a label selector that determines to which nodes - // this configuration applies. - // If nil, then this config applies to all nodes. - // - // +kubebuilder:validation:Optional - NodeSelector *slim_metav1.LabelSelector `json:"nodeSelector,omitempty"` -} - -type Service struct { - // Name is the name of a destination Kubernetes service that identifies traffic - // to be redirected. - // - // +kubebuilder:validation:Required - Name string `json:"name"` - - // Namespace is the Kubernetes service namespace. - // In CiliumEnvoyConfig namespace defaults to the namespace of the CEC, - // In CiliumClusterwideEnvoyConfig namespace defaults to "default". - // +kubebuilder:validation:Optional - Namespace string `json:"namespace"` - - // Port is the port number, which can be used for filtering in case of underlying - // is exposing multiple port numbers. - // - // +kubebuilder:validation:Optional - Ports []string `json:"number,omitempty"` -} - -type ServiceListener struct { - // Name is the name of a destination Kubernetes service that identifies traffic - // to be redirected. - // - // +kubebuilder:validation:Required - Name string `json:"name"` - - // Namespace is the Kubernetes service namespace. - // In CiliumEnvoyConfig namespace this is overridden to the namespace of the CEC, - // In CiliumClusterwideEnvoyConfig namespace defaults to "default". - // +kubebuilder:validation:Optional - Namespace string `json:"namespace"` - - // Listener specifies the name of the Envoy listener the - // service traffic is redirected to. The listener must be - // specified in the Envoy 'resources' of the same - // CiliumEnvoyConfig. - // - // If omitted, the first listener specified in 'resources' is - // used. - // - // +kubebuilder:validation:Optional - Listener string `json:"listener"` -} - -// +kubebuilder:pruning:PreserveUnknownFields -type XDSResource struct { - *anypb.Any `json:"-"` -} - -// DeepCopyInto deep copies 'in' into 'out'. -func (in *XDSResource) DeepCopyInto(out *XDSResource) { - out.Any, _ = proto.Clone(in.Any).(*anypb.Any) -} - -// DeepEqual returns 'true' if 'a' and 'b' are equal. -func (a *XDSResource) DeepEqual(b *XDSResource) bool { - return proto.Equal(a.Any, b.Any) -} - -// MarshalJSON ensures that the unstructured object produces proper -// JSON when passed to Go's standard JSON library. -func (u *XDSResource) MarshalJSON() ([]byte, error) { - return protojson.Marshal(u.Any) -} - -// UnmarshalJSON ensures that the unstructured object properly decodes -// JSON when passed to Go's standard JSON library. -func (u *XDSResource) UnmarshalJSON(b []byte) (err error) { - // xDS resources are not validated in K8s, recover from possible panics - defer func() { - if r := recover(); r != nil { - err = fmt.Errorf("CEC JSON decoding paniced: %v", r) - } - }() - u.Any = &anypb.Any{} - err = protojson.Unmarshal(b, u.Any) - if err != nil { - var buf bytes.Buffer - json.Indent(&buf, b, "", "\t") - log.Warningf("Ignoring invalid CiliumEnvoyConfig JSON (%s): %s", - err, buf.String()) - } else if option.Config.Debug { - log.Debugf("CEC unmarshaled XDS Resource: %v", prototext.Format(u.Any)) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/cegp_types.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/cegp_types.go deleted file mode 100644 index 9eb408a03..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/cegp_types.go +++ /dev/null @@ -1,118 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v2 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - slimv1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" -) - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:categories={cilium,ciliumpolicy},singular="ciliumegressgatewaypolicy",path="ciliumegressgatewaypolicies",scope="Cluster",shortName={cegp} -// +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",name="Age",type=date -// +kubebuilder:storageversion - -type CiliumEgressGatewayPolicy struct { - // +k8s:openapi-gen=false - // +deepequal-gen=false - metav1.TypeMeta `json:",inline"` - // +k8s:openapi-gen=false - // +deepequal-gen=false - metav1.ObjectMeta `json:"metadata"` - - Spec CiliumEgressGatewayPolicySpec `json:"spec,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:openapi-gen=false -// +deepequal-gen=false - -// CiliumEgressGatewayPolicyList is a list of CiliumEgressGatewayPolicy objects. -type CiliumEgressGatewayPolicyList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - // Items is a list of CiliumEgressGatewayPolicy. - Items []CiliumEgressGatewayPolicy `json:"items"` -} - -// +kubebuilder:validation:Pattern=`^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/([0-9]|[1-2][0-9]|3[0-2])$` -type IPv4CIDR string - -type CiliumEgressGatewayPolicySpec struct { - // Egress represents a list of rules by which egress traffic is - // filtered from the source pods. - Selectors []EgressRule `json:"selectors"` - - // DestinationCIDRs is a list of destination CIDRs for destination IP addresses. - // If a destination IP matches any one CIDR, it will be selected. - DestinationCIDRs []IPv4CIDR `json:"destinationCIDRs"` - - // ExcludedCIDRs is a list of destination CIDRs that will be excluded - // from the egress gateway redirection and SNAT logic. - // Should be a subset of destinationCIDRs otherwise it will not have any - // effect. - // - // +kubebuilder:validation:Optional - ExcludedCIDRs []IPv4CIDR `json:"excludedCIDRs"` - - // EgressGateway is the gateway node responsible for SNATing traffic. - EgressGateway *EgressGateway `json:"egressGateway"` -} - -// EgressGateway identifies the node that should act as egress gateway for a -// given egress Gateway policy. In addition to that it also specifies the -// configuration of said node (which egress IP or network interface should be -// used to SNAT traffic). -type EgressGateway struct { - // This is a label selector which selects the node that should act as - // egress gateway for the given policy. - // In case multiple nodes are selected, only the first one in the - // lexical ordering over the node names will be used. - // This field follows standard label selector semantics. - // - // +kubebuilder:validation:Required - NodeSelector *slimv1.LabelSelector `json:"nodeSelector"` - - // Interface is the network interface to which the egress IP address - // that the traffic is SNATed with is assigned. - // - // Example: - // When set to "eth1", matching egress traffic will be redirected to the - // node matching the NodeSelector field and SNATed with the first IPv4 - // address assigned to the eth1 interface. - // - // When none of the Interface or EgressIP fields is specified, the - // policy will use the first IPv4 assigned to the interface with the - // default route. - Interface string `json:"interface,omitempty"` - - // EgressIP is the source IP address that the egress traffic is SNATed - // with. - // - // Example: - // When set to "192.168.1.100", matching egress traffic will be - // redirected to the node matching the NodeSelector field and SNATed - // with IP address 192.168.1.100. - // - // When none of the Interface or EgressIP fields is specified, the - // policy will use the first IPv4 assigned to the interface with the - // default route. - // - // +kubebuilder:validation:Pattern=`((^\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\s*$)|(^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$))` - EgressIP string `json:"egressIP,omitempty"` -} - -type EgressRule struct { - // Selects Namespaces using cluster-scoped labels. This field follows standard label - // selector semantics; if present but empty, it selects all namespaces. - NamespaceSelector *slimv1.LabelSelector `json:"namespaceSelector,omitempty"` - - // This is a label selector which selects Pods. This field follows standard label - // selector semantics; if present but empty, it selects all pods. - PodSelector *slimv1.LabelSelector `json:"podSelector,omitempty"` -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/cew_types.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/cew_types.go deleted file mode 100644 index 8d6081182..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/cew_types.go +++ /dev/null @@ -1,84 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v2 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:categories={cilium},singular="ciliumexternalworkload",path="ciliumexternalworkloads",scope="Cluster",shortName={cew} -// +kubebuilder:printcolumn:JSONPath=".status.id",name="Cilium ID",type=integer -// +kubebuilder:printcolumn:JSONPath=".status.ip",name="IP",type=string -// +kubebuilder:subresource:status - -// CiliumExternalWorkload is a Kubernetes Custom Resource that -// contains a specification for an external workload that can join the -// cluster. The name of the CRD is the FQDN of the external workload, -// and it needs to match the name in the workload registration. The -// labels on the CRD object are the labels that will be used to -// allocate a Cilium Identity for the external workload. If -// 'io.kubernetes.pod.namespace' or 'io.kubernetes.pod.name' labels -// are not explicitly specified, they will be defaulted to 'default' -// and , respectively. 'io.cilium.k8s.policy.cluster' -// will always be defined as the name of the current cluster, which -// defaults to "default". -type CiliumExternalWorkload struct { - // +k8s:openapi-gen=false - // +deepequal-gen=false - metav1.TypeMeta `json:",inline"` - // +k8s:openapi-gen=false - // +deepequal-gen=false - metav1.ObjectMeta `json:"metadata"` - - // Spec is the desired configuration of the external Cilium workload. - Spec CiliumExternalWorkloadSpec `json:"spec,omitempty"` - - // Status is the most recent status of the external Cilium workload. - // It is a read-only field. - // - // +deepequal-gen=false - // +kubebuilder:validation:Optional - Status CiliumExternalWorkloadStatus `json:"status"` -} - -// CiliumExternalWorkloadSpec specifies the configurations for redirecting traffic -// within a workload. -type CiliumExternalWorkloadSpec struct { - // IPv4AllocCIDR is the range of IPv4 addresses in the CIDR format that the external workload can - // use to allocate IP addresses for the tunnel device and the health endpoint. - // - // +kubebuilder:validation:Pattern=`^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/([0-9]|[1-2][0-9]|3[0-2])$` - IPv4AllocCIDR string `json:"ipv4-alloc-cidr,omitempty"` - - // IPv6AllocCIDR is the range of IPv6 addresses in the CIDR format that the external workload can - // use to allocate IP addresses for the tunnel device and the health endpoint. - // - // +kubebuilder:validation:Pattern=`^s*((([0-9A-Fa-f]{1,4}:){7}(:|([0-9A-Fa-f]{1,4})))|(([0-9A-Fa-f]{1,4}:){6}:([0-9A-Fa-f]{1,4})?)|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){0,1}):([0-9A-Fa-f]{1,4})?))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){0,2}):([0-9A-Fa-f]{1,4})?))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){0,3}):([0-9A-Fa-f]{1,4})?))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){0,4}):([0-9A-Fa-f]{1,4})?))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){0,5}):([0-9A-Fa-f]{1,4})?))|(:(:|((:[0-9A-Fa-f]{1,4}){1,7}))))(%.+)?s*/([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8])$` - IPv6AllocCIDR string `json:"ipv6-alloc-cidr,omitempty"` -} - -// CiliumExternalWorkloadStatus is the status of a the external Cilium workload. -type CiliumExternalWorkloadStatus struct { - // ID is the numeric identity allocated for the external workload. - ID uint64 `json:"id,omitempty"` - - // IP is the IP address of the workload. Empty if the workload has not registered. - IP string `json:"ip,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:openapi-gen=false -// +deepequal-gen=false - -// CiliumExternalWorkloadList is a list of CiliumExternalWorkload objects. -type CiliumExternalWorkloadList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - // Items is a list of CiliumExternalWorkload - Items []CiliumExternalWorkload `json:"items"` -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/clrp_types.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/clrp_types.go deleted file mode 100644 index bf8892cc9..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/clrp_types.go +++ /dev/null @@ -1,252 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v2 - -import ( - "fmt" - "strconv" - "strings" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - "github.com/cilium/cilium/pkg/iana" - slim_metav1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" - lb "github.com/cilium/cilium/pkg/loadbalancer" - "github.com/cilium/cilium/pkg/policy/api" -) - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:categories={cilium,ciliumpolicy},singular="ciliumlocalredirectpolicy",path="ciliumlocalredirectpolicies",scope="Namespaced",shortName={clrp} -// +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",name="Age",type=date - -// CiliumLocalRedirectPolicy is a Kubernetes Custom Resource that contains a -// specification to redirect traffic locally within a node. -type CiliumLocalRedirectPolicy struct { - // +k8s:openapi-gen=false - // +deepequal-gen=false - metav1.TypeMeta `json:",inline"` - // +k8s:openapi-gen=false - // +deepequal-gen=false - metav1.ObjectMeta `json:"metadata"` - - // Spec is the desired behavior of the local redirect policy. - Spec CiliumLocalRedirectPolicySpec `json:"spec,omitempty"` - - // Status is the most recent status of the local redirect policy. - // It is a read-only field. - // - // +deepequal-gen=false - // +kubebuilder:validation:Optional - Status CiliumLocalRedirectPolicyStatus `json:"status"` -} - -type Frontend struct { - // IP is a destination ip address for traffic to be redirected. - // - // Example: - // When it is set to "169.254.169.254", traffic destined to - // "169.254.169.254" is redirected. - // - // +kubebuilder:validation:Pattern=`((^\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\s*$)|(^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$))` - // +kubebuilder:validation:Required - IP string `json:"ip"` - - // ToPorts is a list of destination L4 ports with protocol for traffic - // to be redirected. - // When multiple ports are specified, the ports must be named. - // - // Example: - // When set to Port: "53" and Protocol: UDP, traffic destined to port '53' - // with UDP protocol is redirected. - // - // +kubebuilder:validation:Required - ToPorts []PortInfo `json:"toPorts"` -} - -// RedirectFrontend is a frontend configuration that matches traffic that needs to be redirected. -// The configuration must be specified using a ip/port tuple or a Kubernetes service. -type RedirectFrontend struct { - // AddressMatcher is a tuple {IP, port, protocol} that matches traffic to be - // redirected. - // - // +kubebuilder:validation:OneOf - AddressMatcher *Frontend `json:"addressMatcher,omitempty"` - - // ServiceMatcher specifies Kubernetes service and port that matches - // traffic to be redirected. - // - // +kubebuilder:validation:OneOf - ServiceMatcher *ServiceInfo `json:"serviceMatcher,omitempty"` -} - -// PortInfo specifies L4 port number and name along with the transport protocol -type PortInfo struct { - // Port is an L4 port number. The string will be strictly parsed as a single uint16. - // - // +kubebuilder:validation:Pattern=`^()([1-9]|[1-5]?[0-9]{2,4}|6[1-4][0-9]{3}|65[1-4][0-9]{2}|655[1-2][0-9]|6553[1-5])$` - // +kubebuilder:validation:Required - Port string `json:"port"` - - // Protocol is the L4 protocol. - // Accepted values: "TCP", "UDP" - // - // +kubebuilder:validation:Enum=TCP;UDP - // +kubebuilder:validation:Required - Protocol api.L4Proto `json:"protocol"` - - // Name is a port name, which must contain at least one [a-z], - // and may also contain [0-9] and '-' anywhere except adjacent to another - // '-' or in the beginning or the end. - // - // +kubebuilder:validation:Pattern=`^([0-9]{1,4})|([a-zA-Z0-9]-?)*[a-zA-Z](-?[a-zA-Z0-9])*$` - // +kubebuilder:validation:Optional - Name string `json:"name"` -} - -type ServiceInfo struct { - // Name is the name of a destination Kubernetes service that identifies traffic - // to be redirected. - // The service type needs to be ClusterIP. - // - // Example: - // When this field is populated with 'serviceName:myService', all the traffic - // destined to the cluster IP of this service at the (specified) - // service port(s) will be redirected. - // - // +kubebuilder:validation:Required - Name string `json:"serviceName"` - - // Namespace is the Kubernetes service namespace. - // The service namespace must match the namespace of the parent Local - // Redirect Policy. For Cluster-wide Local Redirect Policy, this - // can be any namespace. - // +kubebuilder:validation:Required - Namespace string `json:"namespace"` - - // ToPorts is a list of destination service L4 ports with protocol for - // traffic to be redirected. If not specified, traffic for all the service - // ports will be redirected. - // When multiple ports are specified, the ports must be named. - // - // +kubebuilder:validation:Optional - ToPorts []PortInfo `json:"toPorts,omitempty"` -} - -// RedirectBackend is a backend configuration that determines where traffic needs to be redirected to. -type RedirectBackend struct { - // LocalEndpointSelector selects node local pod(s) where traffic is redirected to. - // - // +kubebuilder:validation:Required - LocalEndpointSelector slim_metav1.LabelSelector `json:"localEndpointSelector"` - - // ToPorts is a list of L4 ports with protocol of node local pod(s) where traffic - // is redirected to. - // When multiple ports are specified, the ports must be named. - // - // +kubebuilder:validation:Required - ToPorts []PortInfo `json:"toPorts"` -} - -// CiliumLocalRedirectPolicySpec specifies the configurations for redirecting traffic -// within a node. -type CiliumLocalRedirectPolicySpec struct { - // RedirectFrontend specifies frontend configuration to redirect traffic from. - // It can not be empty. - // - // +kubebuilder:validation:Required - RedirectFrontend RedirectFrontend `json:"redirectFrontend"` - - // RedirectBackend specifies backend configuration to redirect traffic to. - // It can not be empty. - // - // +kubebuilder:validation:Required - RedirectBackend RedirectBackend `json:"redirectBackend"` - - // SkipRedirectFromBackend indicates whether traffic matching RedirectFrontend - // from RedirectBackend should skip redirection, and hence the traffic will - // be forwarded as-is. - // - // The default is false which means traffic matching RedirectFrontend will - // get redirected from all pods, including the RedirectBackend(s). - // - // Example: If RedirectFrontend is configured to "169.254.169.254:80" as the traffic - // that needs to be redirected to backends selected by RedirectBackend, if - // SkipRedirectFromBackend is set to true, traffic going to "169.254.169.254:80" - // from such backends will not be redirected back to the backends. Instead, - // the matched traffic from the backends will be forwarded to the original - // destination "169.254.169.254:80". - // - // +kubebuilder:validation:Optional - SkipRedirectFromBackend bool `json:"skipRedirectFromBackend"` - - // Description can be used by the creator of the policy to describe the - // purpose of this policy. - // - // +kubebuilder:validation:Optional - Description string `json:"description,omitempty"` -} - -// CiliumLocalRedirectPolicyStatus is the status of a Local Redirect Policy. -type CiliumLocalRedirectPolicyStatus struct { - // TODO Define status(aditi) - OK bool `json:"ok,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:openapi-gen=false -// +deepequal-gen=false - -// CiliumLocalRedirectPolicyList is a list of CiliumLocalRedirectPolicy objects. -type CiliumLocalRedirectPolicyList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - // Items is a list of CiliumLocalRedirectPolicy - Items []CiliumLocalRedirectPolicy `json:"items"` -} - -// SanitizePortInfo sanitizes all the fields in the PortInfo. -// It returns port number, name, and protocol derived from the given input and error (failure cases). -func (pInfo *PortInfo) SanitizePortInfo(checkNamedPort bool) (uint16, string, lb.L4Type, error) { - var ( - pInt uint16 - pName string - protocol lb.L4Type - ) - // Sanitize port - if pInfo.Port == "" { - return pInt, pName, protocol, fmt.Errorf("port must be specified") - } else { - p, err := strconv.ParseUint(pInfo.Port, 0, 16) - if err != nil { - return pInt, pName, protocol, fmt.Errorf("unable to parse port: %w", err) - } - if p == 0 { - return pInt, pName, protocol, fmt.Errorf("port cannot be 0") - } - pInt = uint16(p) - } - // Sanitize name - if checkNamedPort { - if pInfo.Name == "" { - return pInt, pName, protocol, fmt.Errorf("port %s in the local "+ - "redirect policy spec must have a valid IANA_SVC_NAME, as there are multiple ports", pInfo.Port) - - } - if !iana.IsSvcName(pInfo.Name) { - return pInt, pName, protocol, fmt.Errorf("port name %s isn't a "+ - "valid IANA_SVC_NAME", pInfo.Name) - } - } - pName = strings.ToLower(pInfo.Name) // Normalize for case insensitive comparison - - // Sanitize protocol - var err error - protocol, err = lb.NewL4Type(string(pInfo.Protocol)) - if err != nil { - return pInt, pName, protocol, err - } - return pInt, pName, protocol, nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/cnp_types.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/cnp_types.go deleted file mode 100644 index 87574f72a..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/cnp_types.go +++ /dev/null @@ -1,282 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v2 - -import ( - "fmt" - "reflect" - - v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - "github.com/cilium/cilium/pkg/comparator" - k8sCiliumUtils "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/utils" - slimv1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" - k8sUtils "github.com/cilium/cilium/pkg/k8s/utils" - "github.com/cilium/cilium/pkg/labels" - "github.com/cilium/cilium/pkg/policy/api" -) - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +deepequal-gen:private-method=true -// +kubebuilder:resource:categories={cilium,ciliumpolicy},singular="ciliumnetworkpolicy",path="ciliumnetworkpolicies",scope="Namespaced",shortName={cnp,ciliumnp} -// +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",name="Age",type=date -// +kubebuilder:subresource:status -// +kubebuilder:storageversion - -// CiliumNetworkPolicy is a Kubernetes third-party resource with an extended -// version of NetworkPolicy. -type CiliumNetworkPolicy struct { - // +deepequal-gen=false - metav1.TypeMeta `json:",inline"` - // +deepequal-gen=false - metav1.ObjectMeta `json:"metadata"` - - // Spec is the desired Cilium specific rule specification. - Spec *api.Rule `json:"spec,omitempty"` - - // Specs is a list of desired Cilium specific rule specification. - Specs api.Rules `json:"specs,omitempty"` - - // Status is the status of the Cilium policy rule - // - // +deepequal-gen=false - // +kubebuilder:validation:Optional - Status CiliumNetworkPolicyStatus `json:"status"` -} - -// DeepEqual compares 2 CNPs. -func (in *CiliumNetworkPolicy) DeepEqual(other *CiliumNetworkPolicy) bool { - return objectMetaDeepEqual(in.ObjectMeta, other.ObjectMeta) && in.deepEqual(other) -} - -// objectMetaDeepEqual performs an equality check for metav1.ObjectMeta that -// ignores the LastAppliedConfigAnnotation. This function's usage is shared -// among CNP and CCNP as they have the same structure. -func objectMetaDeepEqual(in, other metav1.ObjectMeta) bool { - if !(in.Name == other.Name && in.Namespace == other.Namespace) { - return false - } - - return comparator.MapStringEqualsIgnoreKeys( - in.GetAnnotations(), - other.GetAnnotations(), - // Ignore v1.LastAppliedConfigAnnotation annotation - []string{v1.LastAppliedConfigAnnotation}) -} - -// +deepequal-gen=true - -// CiliumNetworkPolicyStatus is the status of a Cilium policy rule. -type CiliumNetworkPolicyStatus struct { - // Nodes is the Cilium policy status for each node - Nodes map[string]CiliumNetworkPolicyNodeStatus `json:"nodes,omitempty"` - - // DerivativePolicies is the status of all policies derived from the Cilium - // policy - DerivativePolicies map[string]CiliumNetworkPolicyNodeStatus `json:"derivativePolicies,omitempty"` -} - -// +deepequal-gen=true - -// CiliumNetworkPolicyNodeStatus is the status of a Cilium policy rule for a -// specific node. -type CiliumNetworkPolicyNodeStatus struct { - // OK is true when the policy has been parsed and imported successfully - // into the in-memory policy repository on the node. - OK bool `json:"ok,omitempty"` - - // Error describes any error that occurred when parsing or importing the - // policy, or realizing the policy for the endpoints to which it applies - // on the node. - Error string `json:"error,omitempty"` - - // LastUpdated contains the last time this status was updated - LastUpdated slimv1.Time `json:"lastUpdated,omitempty"` - - // Revision is the policy revision of the repository which first implemented - // this policy. - Revision uint64 `json:"localPolicyRevision,omitempty"` - - // Enforcing is set to true once all endpoints present at the time the - // policy has been imported are enforcing this policy. - Enforcing bool `json:"enforcing,omitempty"` - - // Annotations corresponds to the Annotations in the ObjectMeta of the CNP - // that have been realized on the node for CNP. That is, if a CNP has been - // imported and has been assigned annotation X=Y by the user, - // Annotations in CiliumNetworkPolicyNodeStatus will be X=Y once the - // CNP that was imported corresponding to Annotation X=Y has been realized on - // the node. - Annotations map[string]string `json:"annotations,omitempty"` -} - -// CreateCNPNodeStatus returns a CiliumNetworkPolicyNodeStatus created from the -// provided fields. -func CreateCNPNodeStatus(enforcing, ok bool, cnpError error, rev uint64, annotations map[string]string) CiliumNetworkPolicyNodeStatus { - cnpns := CiliumNetworkPolicyNodeStatus{ - Enforcing: enforcing, - Revision: rev, - OK: ok, - LastUpdated: slimv1.Now(), - Annotations: annotations, - } - if cnpError != nil { - cnpns.Error = cnpError.Error() - } - return cnpns -} - -func (r *CiliumNetworkPolicy) String() string { - result := "" - result += fmt.Sprintf("TypeMeta: %s, ", r.TypeMeta.String()) - result += fmt.Sprintf("ObjectMeta: %s, ", r.ObjectMeta.String()) - if r.Spec != nil { - result += fmt.Sprintf("Spec: %v", *(r.Spec)) - } - if r.Specs != nil { - result += fmt.Sprintf("Specs: %v", r.Specs) - } - result += fmt.Sprintf("Status: %v", r.Status) - return result -} - -// GetPolicyStatus returns the CiliumNetworkPolicyNodeStatus corresponding to -// nodeName in the provided CiliumNetworkPolicy. If Nodes within the rule's -// Status is nil, returns an empty CiliumNetworkPolicyNodeStatus. -func (r *CiliumNetworkPolicy) GetPolicyStatus(nodeName string) CiliumNetworkPolicyNodeStatus { - if r.Status.Nodes == nil { - return CiliumNetworkPolicyNodeStatus{} - } - return r.Status.Nodes[nodeName] -} - -// SetPolicyStatus sets the given policy status for the given nodes' map. -func (r *CiliumNetworkPolicy) SetPolicyStatus(nodeName string, cnpns CiliumNetworkPolicyNodeStatus) { - if r.Status.Nodes == nil { - r.Status.Nodes = map[string]CiliumNetworkPolicyNodeStatus{} - } - r.Status.Nodes[nodeName] = cnpns -} - -// SetDerivedPolicyStatus set the derivative policy status for the given -// derivative policy name. -func (r *CiliumNetworkPolicy) SetDerivedPolicyStatus(derivativePolicyName string, status CiliumNetworkPolicyNodeStatus) { - if r.Status.DerivativePolicies == nil { - r.Status.DerivativePolicies = map[string]CiliumNetworkPolicyNodeStatus{} - } - r.Status.DerivativePolicies[derivativePolicyName] = status -} - -// AnnotationsEquals returns true if ObjectMeta.Annotations of each -// CiliumNetworkPolicy are equivalent (i.e., they contain equivalent key-value -// pairs). -func (r *CiliumNetworkPolicy) AnnotationsEquals(o *CiliumNetworkPolicy) bool { - if o == nil { - return r == nil - } - return reflect.DeepEqual(r.ObjectMeta.Annotations, o.ObjectMeta.Annotations) -} - -// Parse parses a CiliumNetworkPolicy and returns a list of cilium policy -// rules. -func (r *CiliumNetworkPolicy) Parse() (api.Rules, error) { - if r.ObjectMeta.Name == "" { - return nil, NewErrParse("CiliumNetworkPolicy must have name") - } - - namespace := k8sUtils.ExtractNamespace(&r.ObjectMeta) - // Temporary fix for CCNPs. See #12834. - // TL;DR. CCNPs are converted into SlimCNPs and end up here so we need to - // convert them back to CCNPs to allow proper parsing. - if namespace == "" { - ccnp := CiliumClusterwideNetworkPolicy{ - TypeMeta: r.TypeMeta, - ObjectMeta: r.ObjectMeta, - Spec: r.Spec, - Specs: r.Specs, - Status: r.Status, - } - return ccnp.Parse() - } - name := r.ObjectMeta.Name - uid := r.ObjectMeta.UID - - retRules := api.Rules{} - - if r.Spec == nil && r.Specs == nil { - return nil, ErrEmptyCNP - } - - if r.Spec != nil { - if err := r.Spec.Sanitize(); err != nil { - return nil, NewErrParse(fmt.Sprintf("Invalid CiliumNetworkPolicy spec: %s", err)) - } - if r.Spec.NodeSelector.LabelSelector != nil { - return nil, NewErrParse("Invalid CiliumNetworkPolicy spec: rule cannot have NodeSelector") - } - cr := k8sCiliumUtils.ParseToCiliumRule(namespace, name, uid, r.Spec) - retRules = append(retRules, cr) - } - if r.Specs != nil { - for _, rule := range r.Specs { - if err := rule.Sanitize(); err != nil { - return nil, NewErrParse(fmt.Sprintf("Invalid CiliumNetworkPolicy specs: %s", err)) - - } - cr := k8sCiliumUtils.ParseToCiliumRule(namespace, name, uid, rule) - retRules = append(retRules, cr) - } - } - - return retRules, nil -} - -// GetIdentityLabels returns all rule labels in the CiliumNetworkPolicy. -func (r *CiliumNetworkPolicy) GetIdentityLabels() labels.LabelArray { - namespace := k8sUtils.ExtractNamespace(&r.ObjectMeta) - name := r.ObjectMeta.Name - uid := r.ObjectMeta.UID - - // Even though the struct represents CiliumNetworkPolicy, we use it both for - // CiliumNetworkPolicy and CiliumClusterwideNetworkPolicy, so here we check for namespace - // to send correct derivedFrom label to get the correct policy labels. - derivedFrom := k8sCiliumUtils.ResourceTypeCiliumNetworkPolicy - if namespace == "" { - derivedFrom = k8sCiliumUtils.ResourceTypeCiliumClusterwideNetworkPolicy - } - return k8sCiliumUtils.GetPolicyLabels(namespace, name, uid, derivedFrom) -} - -// RequiresDerivative return true if the CNP has any rule that will create a new -// derivative rule. -func (r *CiliumNetworkPolicy) RequiresDerivative() bool { - if r.Spec != nil { - if r.Spec.RequiresDerivative() { - return true - } - } - if r.Specs != nil { - for _, rule := range r.Specs { - if rule.RequiresDerivative() { - return true - } - } - } - return false -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:openapi-gen=false -// +deepequal-gen=false - -// CiliumNetworkPolicyList is a list of CiliumNetworkPolicy objects. -type CiliumNetworkPolicyList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - // Items is a list of CiliumNetworkPolicy - Items []CiliumNetworkPolicy `json:"items"` -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/doc.go deleted file mode 100644 index 8b8c1ed19..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/doc.go +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// +k8s:deepcopy-gen=package,register -// +k8s:openapi-gen=true -// +deepequal-gen=package - -// Package v2 is the v2 version of the API. -// +groupName=cilium.io -package v2 diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/errors.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/errors.go deleted file mode 100644 index cc8a0653d..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/errors.go +++ /dev/null @@ -1,44 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v2 - -var ( - // ErrEmptyCNP is an error representing a CNP that is empty, which means it is - // missing both a `spec` and `specs` (both are nil). - ErrEmptyCNP = NewErrParse("Invalid CiliumNetworkPolicy spec(s): empty policy") - - // ErrEmptyCCNP is an error representing a CCNP that is empty, which means it is - // missing both a `spec` and `specs` (both are nil). - ErrEmptyCCNP = NewErrParse("Invalid CiliumClusterwideNetworkPolicy spec(s): empty policy") - - // ParsingErr is for comparison when checking error types. - ParsingErr = NewErrParse("") -) - -// ErrParse is an error to describe where policy fails to parse due any invalid -// rule. -// -// +k8s:deepcopy-gen=false -// +deepequal-gen=false -type ErrParse struct { - msg string -} - -// NewErrParse returns a new ErrParse. -func NewErrParse(msg string) ErrParse { - return ErrParse{ - msg: msg, - } -} - -// Error returns the error message for parsing -func (e ErrParse) Error() string { - return e.msg -} - -// Is returns true if the given error is the type of 'ErrParse'. -func (_ ErrParse) Is(e error) bool { - _, ok := e.(ErrParse) - return ok -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/logfields.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/logfields.go deleted file mode 100644 index b4f556373..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/logfields.go +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v2 - -import ( - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" -) - -var log = logging.DefaultLogger.WithField(logfields.LogSubsys, "k8s-apis-cilium.io-v2") diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/register.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/register.go deleted file mode 100644 index 3197b4613..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/register.go +++ /dev/null @@ -1,197 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v2 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - - k8sconst "github.com/cilium/cilium/pkg/k8s/apis/cilium.io" -) - -const ( - // CustomResourceDefinitionGroup is the name of the third party resource group - CustomResourceDefinitionGroup = k8sconst.CustomResourceDefinitionGroup - - // CustomResourceDefinitionVersion is the current version of the resource - CustomResourceDefinitionVersion = "v2" - - // Cilium Network Policy (CNP) - - // CNPPluralName is the plural name of Cilium Network Policy - CNPPluralName = "ciliumnetworkpolicies" - - // CNPKindDefinition is the kind name for Cilium Network Policy - CNPKindDefinition = "CiliumNetworkPolicy" - - // CNPName is the full name of Cilium Network Policy - CNPName = CNPPluralName + "." + CustomResourceDefinitionGroup - - // Cilium Cluster wide Network Policy (CCNP) - - // CCNPPluralName is the plural name of Cilium Cluster wide Network Policy - CCNPPluralName = "ciliumclusterwidenetworkpolicies" - - // CCNPKindDefinition is the kind name for Cilium Cluster wide Network Policy - CCNPKindDefinition = "CiliumClusterwideNetworkPolicy" - - // CCNPName is the full name of Cilium Cluster wide Network Policy - CCNPName = CCNPPluralName + "." + CustomResourceDefinitionGroup - - // Cilium Egress Gateway Policy (CEGP) - - // CEGPPluralName is the plural name of Cilium Egress Gateway Policy - CEGPPluralName = "ciliumegressgatewaypolicies" - - // CEGPKindDefinition is the kind name of Cilium Egress Gateway Policy - CEGPKindDefinition = "CiliumEgressGatewayPolicy" - - // CEGPName is the full name of Cilium Egress Gateway Policy - CEGPName = CEGPPluralName + "." + CustomResourceDefinitionGroup - - // Cilium Endpoint (CEP) - - // CEPluralName is the plural name of Cilium Endpoint - CEPPluralName = "ciliumendpoints" - - // CEKindDefinition is the kind name for Cilium Endpoint - CEPKindDefinition = "CiliumEndpoint" - - // CEPName is the full name of Cilium Endpoint - CEPName = CEPPluralName + "." + CustomResourceDefinitionGroup - - // Cilium Node (CN) - - // CNPluralName is the plural name of Cilium Node - CNPluralName = "ciliumnodes" - - // CNKindDefinition is the kind name for Cilium Node - CNKindDefinition = "CiliumNode" - - // CNName is the full name of Cilium Node - CNName = CNPluralName + "." + CustomResourceDefinitionGroup - - // Cilium Identity - - // CIDPluralName is the plural name of Cilium Identity - CIDPluralName = "ciliumidentities" - - // CIDKindDefinition is the kind name for Cilium Identity - CIDKindDefinition = "CiliumIdentity" - - // CIDName is the full name of Cilium Identity - CIDName = CIDPluralName + "." + CustomResourceDefinitionGroup - - // Cilium Local Redirect Policy (CLRP) - - // CLRPPluralName is the plural name of Local Redirect Policy - CLRPPluralName = "ciliumlocalredirectpolicies" - - // CLRPKindDefinition is the kind name for Local Redirect Policy - CLRPKindDefinition = "CiliumLocalRedirectPolicy" - - // CLRPName is the full name of Local Redirect Policy - CLRPName = CLRPPluralName + "." + CustomResourceDefinitionGroup - - // Cilium External Workload (CEW) - - // CEWPluralName is the plural name of Cilium External Workload - CEWPluralName = "ciliumexternalworkloads" - - // CEWKindDefinition is the kind name for Cilium External Workload - CEWKindDefinition = "CiliumExternalWorkload" - - // CEWName is the full name of Cilium External Workload - CEWName = CEWPluralName + "." + CustomResourceDefinitionGroup - - // Cilium Cluster Envoy Config (CCEC) - - // CCECPluralName is the plural name of Cilium Clusterwide Envoy Config - CCECPluralName = "ciliumclusterwideenvoyconfigs" - - // CCECKindDefinition is the kind name of Cilium Clusterwide Envoy Config - CCECKindDefinition = "CiliumClusterwideEnvoyConfig" - - // CCECName is the full name of Cilium Clusterwide Envoy Config - CCECName = CCECPluralName + "." + CustomResourceDefinitionGroup - - // Cilium Envoy Config (CEC) - - // CECPluralName is the plural name of Cilium Envoy Config - CECPluralName = "ciliumenvoyconfigs" - - // CECKindDefinition is the kind name of Cilium Envoy Config - CECKindDefinition = "CiliumEnvoyConfig" - - // CECName is the full name of Cilium Envoy Config - CECName = CECPluralName + "." + CustomResourceDefinitionGroup -) - -// SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{ - Group: CustomResourceDefinitionGroup, - Version: CustomResourceDefinitionVersion, -} - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -var ( - // SchemeBuilder is needed by DeepCopy generator. - SchemeBuilder runtime.SchemeBuilder - // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. - localSchemeBuilder = &SchemeBuilder - - // AddToScheme adds all types of this clientset into the given scheme. - // This allows composition of clientsets, like in: - // - // import ( - // "k8s.io/client-go/kubernetes" - // clientsetscheme "k8s.io/client-go/kubernetes/scheme" - // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" - // ) - // - // kclientset, _ := kubernetes.NewForConfig(c) - // aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) - AddToScheme = localSchemeBuilder.AddToScheme -) - -func init() { - // We only register manually written functions here. The registration of the - // generated functions takes place in the generated files. The separation - // makes the code compile even when the generated files are missing. - localSchemeBuilder.Register(addKnownTypes) -} - -// Adds the list of known types to api.Scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &CiliumNetworkPolicy{}, - &CiliumNetworkPolicyList{}, - &CiliumClusterwideNetworkPolicy{}, - &CiliumClusterwideNetworkPolicyList{}, - &CiliumEgressGatewayPolicy{}, - &CiliumEgressGatewayPolicyList{}, - &CiliumEndpoint{}, - &CiliumEndpointList{}, - &CiliumNode{}, - &CiliumNodeList{}, - &CiliumExternalWorkload{}, - &CiliumExternalWorkloadList{}, - &CiliumIdentity{}, - &CiliumIdentityList{}, - &CiliumLocalRedirectPolicy{}, - &CiliumLocalRedirectPolicyList{}, - &CiliumEnvoyConfig{}, - &CiliumEnvoyConfigList{}, - &CiliumClusterwideEnvoyConfig{}, - &CiliumClusterwideEnvoyConfigList{}, - ) - - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/types.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/types.go deleted file mode 100644 index 7e0641258..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/types.go +++ /dev/null @@ -1,487 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v2 - -import ( - "net" - "sort" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - "github.com/cilium/cilium/api/v1/models" - alibabaCloudTypes "github.com/cilium/cilium/pkg/alibabacloud/eni/types" - eniTypes "github.com/cilium/cilium/pkg/aws/eni/types" - azureTypes "github.com/cilium/cilium/pkg/azure/types" - ipamTypes "github.com/cilium/cilium/pkg/ipam/types" - "github.com/cilium/cilium/pkg/node/addressing" -) - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:openapi-gen=false -// +kubebuilder:resource:categories={cilium},singular="ciliumendpoint",path="ciliumendpoints",scope="Namespaced",shortName={cep,ciliumep} -// +kubebuilder:printcolumn:JSONPath=".status.identity.id",description="Security Identity",name="Security Identity",type=integer -// +kubebuilder:printcolumn:JSONPath=".status.policy.ingress.state",description="Ingress enforcement in the endpoint",name="Ingress Enforcement",type=string,priority=1 -// +kubebuilder:printcolumn:JSONPath=".status.policy.egress.state",description="Egress enforcement in the endpoint",name="Egress Enforcement",type=string,priority=1 -// +kubebuilder:printcolumn:JSONPath=".status.visibility-policy-status",description="Status of visibility policy in the endpoint",name="Visibility Policy",type=string,priority=1 -// +kubebuilder:printcolumn:JSONPath=".status.state",description="Endpoint current state",name="Endpoint State",type=string -// +kubebuilder:printcolumn:JSONPath=".status.networking.addressing[0].ipv4",description="Endpoint IPv4 address",name="IPv4",type=string -// +kubebuilder:printcolumn:JSONPath=".status.networking.addressing[0].ipv6",description="Endpoint IPv6 address",name="IPv6",type=string -// +kubebuilder:storageversion - -// CiliumEndpoint is the status of a Cilium policy rule. -type CiliumEndpoint struct { - // +deepequal-gen=false - metav1.TypeMeta `json:",inline"` - // +deepequal-gen=false - metav1.ObjectMeta `json:"metadata"` - - // +kubebuilder:validation:Optional - Status EndpointStatus `json:"status"` -} - -// EndpointPolicyState defines the state of the Policy mode: "enforcing", "non-enforcing", "disabled" -type EndpointPolicyState string - -// EndpointStatus is the status of a Cilium endpoint. -type EndpointStatus struct { - // ID is the cilium-agent-local ID of the endpoint. - ID int64 `json:"id,omitempty"` - - // Controllers is the list of failing controllers for this endpoint. - Controllers ControllerList `json:"controllers,omitempty"` - - // ExternalIdentifiers is a set of identifiers to identify the endpoint - // apart from the pod name. This includes container runtime IDs. - ExternalIdentifiers *models.EndpointIdentifiers `json:"external-identifiers,omitempty"` - - // Health is the overall endpoint & subcomponent health. - Health *models.EndpointHealth `json:"health,omitempty"` - - // Identity is the security identity associated with the endpoint - Identity *EndpointIdentity `json:"identity,omitempty"` - - // Log is the list of the last few warning and error log entries - Log []*models.EndpointStatusChange `json:"log,omitempty"` - - // Networking is the networking properties of the endpoint. - // - // +kubebuilder:validation:Optional - Networking *EndpointNetworking `json:"networking,omitempty"` - - // Encryption is the encryption configuration of the node - // - // +kubebuilder:validation:Optional - Encryption EncryptionSpec `json:"encryption,omitempty"` - - Policy *EndpointPolicy `json:"policy,omitempty"` - - VisibilityPolicyStatus *string `json:"visibility-policy-status,omitempty"` - - // State is the state of the endpoint. - // - // +kubebuilder:validation:Enum=creating;waiting-for-identity;not-ready;waiting-to-regenerate;regenerating;restoring;ready;disconnecting;disconnected;invalid - State string `json:"state,omitempty"` - - NamedPorts models.NamedPorts `json:"named-ports,omitempty"` -} - -// +k8s:deepcopy-gen=false - -// ControllerList is a list of ControllerStatus. -type ControllerList []ControllerStatus - -// Sort sorts the ControllerList by controller name -func (c ControllerList) Sort() { - sort.Slice(c, func(i, j int) bool { return c[i].Name < c[j].Name }) -} - -// ControllerStatus is the status of a failing controller. -type ControllerStatus struct { - // Name is the name of the controller - Name string `json:"name,omitempty"` - - // Configuration is the controller configuration - Configuration *models.ControllerStatusConfiguration `json:"configuration,omitempty"` - - // Status is the status of the controller - Status ControllerStatusStatus `json:"status,omitempty"` - - // UUID is the UUID of the controller - UUID string `json:"uuid,omitempty"` -} - -// +k8s:deepcopy-gen=false - -// ControllerStatusStatus is the detailed status section of a controller. -type ControllerStatusStatus struct { - ConsecutiveFailureCount int64 `json:"consecutive-failure-count,omitempty"` - FailureCount int64 `json:"failure-count,omitempty"` - LastFailureMsg string `json:"last-failure-msg,omitempty"` - LastFailureTimestamp string `json:"last-failure-timestamp,omitempty"` - LastSuccessTimestamp string `json:"last-success-timestamp,omitempty"` - SuccessCount int64 `json:"success-count,omitempty"` -} - -// EndpointPolicy represents the endpoint's policy by listing all allowed -// ingress and egress identities in combination with L4 port and protocol. -type EndpointPolicy struct { - Ingress *EndpointPolicyDirection `json:"ingress,omitempty"` - Egress *EndpointPolicyDirection `json:"egress,omitempty"` -} - -// EndpointPolicyDirection is the list of allowed identities per direction. -type EndpointPolicyDirection struct { - Enforcing bool `json:"enforcing"` - Allowed AllowedIdentityList `json:"allowed,omitempty"` - Denied DenyIdentityList `json:"denied,omitempty"` - // Deprecated - Removing AllowedIdentityList `json:"removing,omitempty"` - // Deprecated - Adding AllowedIdentityList `json:"adding,omitempty"` - State EndpointPolicyState `json:"state,omitempty"` -} - -// IdentityTuple specifies a peer by identity, destination port and protocol. -type IdentityTuple struct { - Identity uint64 `json:"identity,omitempty"` - IdentityLabels map[string]string `json:"identity-labels,omitempty"` - DestPort uint16 `json:"dest-port,omitempty"` - Protocol uint8 `json:"protocol,omitempty"` -} - -// +k8s:deepcopy-gen=false - -// IdentityList is a list of IdentityTuple. -type IdentityList []IdentityTuple - -// Sort sorts a list IdentityList by numeric identity, port and protocol. -func (a IdentityList) Sort() { - sort.Slice(a, func(i, j int) bool { - if a[i].Identity < a[j].Identity { - return true - } else if a[i].Identity == a[j].Identity { - if a[i].DestPort < a[j].DestPort { - return true - } else if a[i].DestPort == a[j].DestPort { - return a[i].Protocol < a[j].Protocol - } - } - return false - }) -} - -// +k8s:deepcopy-gen=false - -// AllowedIdentityList is a list of IdentityTuples that species peers that are -// allowed. -type AllowedIdentityList IdentityList - -// Sort sorts a list IdentityList by numeric identity, port and protocol. -func (a AllowedIdentityList) Sort() { - IdentityList(a).Sort() -} - -// +k8s:deepcopy-gen=false - -// DenyIdentityList is a list of IdentityTuples that species peers that are -// denied. -type DenyIdentityList IdentityList - -// Sort sorts a list IdentityList by numeric identity, port and protocol. -func (d DenyIdentityList) Sort() { - IdentityList(d).Sort() -} - -// EndpointIdentity is the identity information of an endpoint. -type EndpointIdentity struct { - // ID is the numeric identity of the endpoint - ID int64 `json:"id,omitempty"` - - // Labels is the list of labels associated with the identity - Labels []string `json:"labels,omitempty"` -} - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:categories={cilium},singular="ciliumidentity",path="ciliumidentities",scope="Cluster",shortName={ciliumid} -// +kubebuilder:printcolumn:JSONPath=".metadata.labels.io\\.kubernetes\\.pod\\.namespace",description="The namespace of the entity",name="Namespace",type=string -// +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",description="The age of the identity",name="Age",type=date -// +kubebuilder:subresource:status -// +kubebuilder:storageversion - -// CiliumIdentity is a CRD that represents an identity managed by Cilium. -// It is intended as a backing store for identity allocation, acting as the -// global coordination backend, and can be used in place of a KVStore (such as -// etcd). -// The name of the CRD is the numeric identity and the labels on the CRD object -// are the kubernetes sourced labels seen by cilium. This is currently the -// only label source possible when running under kubernetes. Non-kubernetes -// labels are filtered but all labels, from all sources, are places in the -// SecurityLabels field. These also include the source and are used to define -// the identity. -// The labels under metav1.ObjectMeta can be used when searching for -// CiliumIdentity instances that include particular labels. This can be done -// with invocations such as: -// -// kubectl get ciliumid -l 'foo=bar' -type CiliumIdentity struct { - // +deepequal-gen=false - metav1.TypeMeta `json:",inline"` - // +deepequal-gen=false - metav1.ObjectMeta `json:"metadata"` - - // SecurityLabels is the source-of-truth set of labels for this identity. - SecurityLabels map[string]string `json:"security-labels"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +deepequal-gen=false - -// CiliumIdentityList is a list of CiliumIdentity objects. -type CiliumIdentityList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - // Items is a list of CiliumIdentity - Items []CiliumIdentity `json:"items"` -} - -// +k8s:deepcopy-gen=false - -// AddressPair is a pair of IPv4 and/or IPv6 address. -type AddressPair struct { - IPV4 string `json:"ipv4,omitempty"` - IPV6 string `json:"ipv6,omitempty"` -} - -// +k8s:deepcopy-gen=false - -// AddressPairList is a list of address pairs. -type AddressPairList []*AddressPair - -// Sort sorts an AddressPairList by IPv4 and IPv6 address. -func (a AddressPairList) Sort() { - sort.Slice(a, func(i, j int) bool { - if a[i].IPV4 < a[j].IPV4 { - return true - } else if a[i].IPV4 == a[j].IPV4 { - return a[i].IPV6 < a[j].IPV6 - } - return false - }) -} - -// EndpointNetworking is the addressing information of an endpoint. -type EndpointNetworking struct { - // IP4/6 addresses assigned to this Endpoint - Addressing AddressPairList `json:"addressing"` - - // NodeIP is the IP of the node the endpoint is running on. The IP must - // be reachable between nodes. - NodeIP string `json:"node,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:openapi-gen=false -// +deepequal-gen=false - -// CiliumEndpointList is a list of CiliumEndpoint objects. -type CiliumEndpointList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - // Items is a list of CiliumEndpoint - Items []CiliumEndpoint `json:"items"` -} - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:categories={cilium},singular="ciliumnode",path="ciliumnodes",scope="Cluster",shortName={cn,ciliumn} -// +kubebuilder:printcolumn:JSONPath=".spec.addresses[?(@.type==\"CiliumInternalIP\")].ip",description="Cilium internal IP for this node",name="CiliumInternalIP",type=string -// +kubebuilder:printcolumn:JSONPath=".spec.addresses[?(@.type==\"InternalIP\")].ip",description="IP of the node",name="InternalIP",type=string -// +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",description="Time duration since creation of Ciliumnode",name="Age",type=date -// +kubebuilder:storageversion -// +kubebuilder:subresource:status - -// CiliumNode represents a node managed by Cilium. It contains a specification -// to control various node specific configuration aspects and a status section -// to represent the status of the node. -type CiliumNode struct { - // +deepequal-gen=false - metav1.TypeMeta `json:",inline"` - // +deepequal-gen=false - metav1.ObjectMeta `json:"metadata"` - - // Spec defines the desired specification/configuration of the node. - Spec NodeSpec `json:"spec"` - - // Status defines the realized specification/configuration and status - // of the node. - // - // +kubebuilder:validation:Optional - Status NodeStatus `json:"status,omitempty"` -} - -// NodeAddress is a node address. -type NodeAddress struct { - // Type is the type of the node address - Type addressing.AddressType `json:"type,omitempty"` - - // IP is an IP of a node - IP string `json:"ip,omitempty"` -} - -// NodeSpec is the configuration specific to a node. -type NodeSpec struct { - // InstanceID is the identifier of the node. This is different from the - // node name which is typically the FQDN of the node. The InstanceID - // typically refers to the identifier used by the cloud provider or - // some other means of identification. - InstanceID string `json:"instance-id,omitempty"` - - // BootID is a unique node identifier generated on boot - // - // +kubebuilder:validation:Optional - BootID string `json:"bootid,omitempty"` - - // Addresses is the list of all node addresses. - // - // +kubebuilder:validation:Optional - Addresses []NodeAddress `json:"addresses,omitempty"` - - // HealthAddressing is the addressing information for health connectivity - // checking. - // - // +kubebuilder:validation:Optional - HealthAddressing HealthAddressingSpec `json:"health,omitempty"` - - // IngressAddressing is the addressing information for Ingress listener. - // - // +kubebuilder:validation:Optional - IngressAddressing AddressPair `json:"ingress,omitempty"` - - // Encryption is the encryption configuration of the node. - // - // +kubebuilder:validation:Optional - Encryption EncryptionSpec `json:"encryption,omitempty"` - - // ENI is the AWS ENI specific configuration. - // - // +kubebuilder:validation:Optional - ENI eniTypes.ENISpec `json:"eni,omitempty"` - - // Azure is the Azure IPAM specific configuration. - // - // +kubebuilder:validation:Optional - Azure azureTypes.AzureSpec `json:"azure,omitempty"` - - // AlibabaCloud is the AlibabaCloud IPAM specific configuration. - // - // +kubebuilder:validation:Optional - AlibabaCloud alibabaCloudTypes.Spec `json:"alibaba-cloud,omitempty"` - - // IPAM is the address management specification. This section can be - // populated by a user or it can be automatically populated by an IPAM - // operator. - // - // +kubebuilder:validation:Optional - IPAM ipamTypes.IPAMSpec `json:"ipam,omitempty"` - - // NodeIdentity is the Cilium numeric identity allocated for the node, if any. - // - // +kubebuilder:validation:Optional - NodeIdentity uint64 `json:"nodeidentity,omitempty"` -} - -// HealthAddressingSpec is the addressing information required to do -// connectivity health checking. -type HealthAddressingSpec struct { - // IPv4 is the IPv4 address of the IPv4 health endpoint. - // - // +kubebuilder:validation:Optional - IPv4 string `json:"ipv4,omitempty"` - - // IPv6 is the IPv6 address of the IPv4 health endpoint. - // - // +kubebuilder:validation:Optional - IPv6 string `json:"ipv6,omitempty"` -} - -// EncryptionSpec defines the encryption relevant configuration of a node. -type EncryptionSpec struct { - // Key is the index to the key to use for encryption or 0 if encryption is - // disabled. - // - // +kubebuilder:validation:Optional - Key int `json:"key,omitempty"` -} - -// NodeStatus is the status of a node. -type NodeStatus struct { - // ENI is the AWS ENI specific status of the node. - // - // +kubebuilder:validation:Optional - ENI eniTypes.ENIStatus `json:"eni,omitempty"` - - // Azure is the Azure specific status of the node. - // - // +kubebuilder:validation:Optional - Azure azureTypes.AzureStatus `json:"azure,omitempty"` - - // IPAM is the IPAM status of the node. - // - // +kubebuilder:validation:Optional - IPAM ipamTypes.IPAMStatus `json:"ipam,omitempty"` - - // AlibabaCloud is the AlibabaCloud specific status of the node. - // - // +kubebuilder:validation:Optional - AlibabaCloud alibabaCloudTypes.ENIStatus `json:"alibaba-cloud,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +deepequal-gen=false - -// CiliumNodeList is a list of CiliumNode objects. -type CiliumNodeList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - // Items is a list of CiliumNode - Items []CiliumNode `json:"items"` -} - -// InstanceID returns the InstanceID of a CiliumNode. -func (n *CiliumNode) InstanceID() (instanceID string) { - if n != nil { - instanceID = n.Spec.InstanceID - // OBSOLETE: This fallback can be removed in Cilium 1.9 - if instanceID == "" { - instanceID = n.Spec.ENI.InstanceID - } - } - return -} - -func (n NodeAddress) ToString() string { - return n.IP -} - -func (n NodeAddress) AddrType() addressing.AddressType { - return n.Type -} - -// GetIP returns one of the CiliumNode's IP addresses available with the -// following priority: -// - NodeInternalIP -// - NodeExternalIP -// - other IP address type -// An error is returned if GetIP fails to extract an IP from the CiliumNode -// based on the provided address family. -func (n *CiliumNode) GetIP(ipv6 bool) net.IP { - return addressing.ExtractNodeIP[NodeAddress](n.Spec.Addresses, ipv6) -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/zz_generated.deepcopy.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/zz_generated.deepcopy.go deleted file mode 100644 index 60a599d7d..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/zz_generated.deepcopy.go +++ /dev/null @@ -1,1400 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v2 - -import ( - models "github.com/cilium/cilium/api/v1/models" - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" - api "github.com/cilium/cilium/pkg/policy/api" - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumClusterwideEnvoyConfig) DeepCopyInto(out *CiliumClusterwideEnvoyConfig) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumClusterwideEnvoyConfig. -func (in *CiliumClusterwideEnvoyConfig) DeepCopy() *CiliumClusterwideEnvoyConfig { - if in == nil { - return nil - } - out := new(CiliumClusterwideEnvoyConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumClusterwideEnvoyConfig) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumClusterwideEnvoyConfigList) DeepCopyInto(out *CiliumClusterwideEnvoyConfigList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CiliumClusterwideEnvoyConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumClusterwideEnvoyConfigList. -func (in *CiliumClusterwideEnvoyConfigList) DeepCopy() *CiliumClusterwideEnvoyConfigList { - if in == nil { - return nil - } - out := new(CiliumClusterwideEnvoyConfigList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumClusterwideEnvoyConfigList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumClusterwideNetworkPolicy) DeepCopyInto(out *CiliumClusterwideNetworkPolicy) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - if in.Spec != nil { - in, out := &in.Spec, &out.Spec - *out = new(api.Rule) - (*in).DeepCopyInto(*out) - } - if in.Specs != nil { - in, out := &in.Specs, &out.Specs - *out = make(api.Rules, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(api.Rule) - (*in).DeepCopyInto(*out) - } - } - } - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumClusterwideNetworkPolicy. -func (in *CiliumClusterwideNetworkPolicy) DeepCopy() *CiliumClusterwideNetworkPolicy { - if in == nil { - return nil - } - out := new(CiliumClusterwideNetworkPolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumClusterwideNetworkPolicy) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumClusterwideNetworkPolicyList) DeepCopyInto(out *CiliumClusterwideNetworkPolicyList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CiliumClusterwideNetworkPolicy, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumClusterwideNetworkPolicyList. -func (in *CiliumClusterwideNetworkPolicyList) DeepCopy() *CiliumClusterwideNetworkPolicyList { - if in == nil { - return nil - } - out := new(CiliumClusterwideNetworkPolicyList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumClusterwideNetworkPolicyList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumEgressGatewayPolicy) DeepCopyInto(out *CiliumEgressGatewayPolicy) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumEgressGatewayPolicy. -func (in *CiliumEgressGatewayPolicy) DeepCopy() *CiliumEgressGatewayPolicy { - if in == nil { - return nil - } - out := new(CiliumEgressGatewayPolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumEgressGatewayPolicy) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumEgressGatewayPolicyList) DeepCopyInto(out *CiliumEgressGatewayPolicyList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CiliumEgressGatewayPolicy, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumEgressGatewayPolicyList. -func (in *CiliumEgressGatewayPolicyList) DeepCopy() *CiliumEgressGatewayPolicyList { - if in == nil { - return nil - } - out := new(CiliumEgressGatewayPolicyList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumEgressGatewayPolicyList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumEgressGatewayPolicySpec) DeepCopyInto(out *CiliumEgressGatewayPolicySpec) { - *out = *in - if in.Selectors != nil { - in, out := &in.Selectors, &out.Selectors - *out = make([]EgressRule, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.DestinationCIDRs != nil { - in, out := &in.DestinationCIDRs, &out.DestinationCIDRs - *out = make([]IPv4CIDR, len(*in)) - copy(*out, *in) - } - if in.ExcludedCIDRs != nil { - in, out := &in.ExcludedCIDRs, &out.ExcludedCIDRs - *out = make([]IPv4CIDR, len(*in)) - copy(*out, *in) - } - if in.EgressGateway != nil { - in, out := &in.EgressGateway, &out.EgressGateway - *out = new(EgressGateway) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumEgressGatewayPolicySpec. -func (in *CiliumEgressGatewayPolicySpec) DeepCopy() *CiliumEgressGatewayPolicySpec { - if in == nil { - return nil - } - out := new(CiliumEgressGatewayPolicySpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumEndpoint) DeepCopyInto(out *CiliumEndpoint) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumEndpoint. -func (in *CiliumEndpoint) DeepCopy() *CiliumEndpoint { - if in == nil { - return nil - } - out := new(CiliumEndpoint) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumEndpoint) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumEndpointList) DeepCopyInto(out *CiliumEndpointList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CiliumEndpoint, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumEndpointList. -func (in *CiliumEndpointList) DeepCopy() *CiliumEndpointList { - if in == nil { - return nil - } - out := new(CiliumEndpointList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumEndpointList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumEnvoyConfig) DeepCopyInto(out *CiliumEnvoyConfig) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumEnvoyConfig. -func (in *CiliumEnvoyConfig) DeepCopy() *CiliumEnvoyConfig { - if in == nil { - return nil - } - out := new(CiliumEnvoyConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumEnvoyConfig) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumEnvoyConfigList) DeepCopyInto(out *CiliumEnvoyConfigList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CiliumEnvoyConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumEnvoyConfigList. -func (in *CiliumEnvoyConfigList) DeepCopy() *CiliumEnvoyConfigList { - if in == nil { - return nil - } - out := new(CiliumEnvoyConfigList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumEnvoyConfigList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumEnvoyConfigSpec) DeepCopyInto(out *CiliumEnvoyConfigSpec) { - *out = *in - if in.Services != nil { - in, out := &in.Services, &out.Services - *out = make([]*ServiceListener, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(ServiceListener) - **out = **in - } - } - } - if in.BackendServices != nil { - in, out := &in.BackendServices, &out.BackendServices - *out = make([]*Service, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(Service) - (*in).DeepCopyInto(*out) - } - } - } - if in.Resources != nil { - in, out := &in.Resources, &out.Resources - *out = make([]XDSResource, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.NodeSelector != nil { - in, out := &in.NodeSelector, &out.NodeSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumEnvoyConfigSpec. -func (in *CiliumEnvoyConfigSpec) DeepCopy() *CiliumEnvoyConfigSpec { - if in == nil { - return nil - } - out := new(CiliumEnvoyConfigSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumExternalWorkload) DeepCopyInto(out *CiliumExternalWorkload) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - out.Status = in.Status - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumExternalWorkload. -func (in *CiliumExternalWorkload) DeepCopy() *CiliumExternalWorkload { - if in == nil { - return nil - } - out := new(CiliumExternalWorkload) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumExternalWorkload) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumExternalWorkloadList) DeepCopyInto(out *CiliumExternalWorkloadList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CiliumExternalWorkload, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumExternalWorkloadList. -func (in *CiliumExternalWorkloadList) DeepCopy() *CiliumExternalWorkloadList { - if in == nil { - return nil - } - out := new(CiliumExternalWorkloadList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumExternalWorkloadList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumExternalWorkloadSpec) DeepCopyInto(out *CiliumExternalWorkloadSpec) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumExternalWorkloadSpec. -func (in *CiliumExternalWorkloadSpec) DeepCopy() *CiliumExternalWorkloadSpec { - if in == nil { - return nil - } - out := new(CiliumExternalWorkloadSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumExternalWorkloadStatus) DeepCopyInto(out *CiliumExternalWorkloadStatus) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumExternalWorkloadStatus. -func (in *CiliumExternalWorkloadStatus) DeepCopy() *CiliumExternalWorkloadStatus { - if in == nil { - return nil - } - out := new(CiliumExternalWorkloadStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumIdentity) DeepCopyInto(out *CiliumIdentity) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - if in.SecurityLabels != nil { - in, out := &in.SecurityLabels, &out.SecurityLabels - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumIdentity. -func (in *CiliumIdentity) DeepCopy() *CiliumIdentity { - if in == nil { - return nil - } - out := new(CiliumIdentity) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumIdentity) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumIdentityList) DeepCopyInto(out *CiliumIdentityList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CiliumIdentity, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumIdentityList. -func (in *CiliumIdentityList) DeepCopy() *CiliumIdentityList { - if in == nil { - return nil - } - out := new(CiliumIdentityList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumIdentityList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumLocalRedirectPolicy) DeepCopyInto(out *CiliumLocalRedirectPolicy) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumLocalRedirectPolicy. -func (in *CiliumLocalRedirectPolicy) DeepCopy() *CiliumLocalRedirectPolicy { - if in == nil { - return nil - } - out := new(CiliumLocalRedirectPolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumLocalRedirectPolicy) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumLocalRedirectPolicyList) DeepCopyInto(out *CiliumLocalRedirectPolicyList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CiliumLocalRedirectPolicy, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumLocalRedirectPolicyList. -func (in *CiliumLocalRedirectPolicyList) DeepCopy() *CiliumLocalRedirectPolicyList { - if in == nil { - return nil - } - out := new(CiliumLocalRedirectPolicyList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumLocalRedirectPolicyList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumLocalRedirectPolicySpec) DeepCopyInto(out *CiliumLocalRedirectPolicySpec) { - *out = *in - in.RedirectFrontend.DeepCopyInto(&out.RedirectFrontend) - in.RedirectBackend.DeepCopyInto(&out.RedirectBackend) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumLocalRedirectPolicySpec. -func (in *CiliumLocalRedirectPolicySpec) DeepCopy() *CiliumLocalRedirectPolicySpec { - if in == nil { - return nil - } - out := new(CiliumLocalRedirectPolicySpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumLocalRedirectPolicyStatus) DeepCopyInto(out *CiliumLocalRedirectPolicyStatus) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumLocalRedirectPolicyStatus. -func (in *CiliumLocalRedirectPolicyStatus) DeepCopy() *CiliumLocalRedirectPolicyStatus { - if in == nil { - return nil - } - out := new(CiliumLocalRedirectPolicyStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumNetworkPolicy) DeepCopyInto(out *CiliumNetworkPolicy) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - if in.Spec != nil { - in, out := &in.Spec, &out.Spec - *out = new(api.Rule) - (*in).DeepCopyInto(*out) - } - if in.Specs != nil { - in, out := &in.Specs, &out.Specs - *out = make(api.Rules, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(api.Rule) - (*in).DeepCopyInto(*out) - } - } - } - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumNetworkPolicy. -func (in *CiliumNetworkPolicy) DeepCopy() *CiliumNetworkPolicy { - if in == nil { - return nil - } - out := new(CiliumNetworkPolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumNetworkPolicy) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumNetworkPolicyList) DeepCopyInto(out *CiliumNetworkPolicyList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CiliumNetworkPolicy, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumNetworkPolicyList. -func (in *CiliumNetworkPolicyList) DeepCopy() *CiliumNetworkPolicyList { - if in == nil { - return nil - } - out := new(CiliumNetworkPolicyList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumNetworkPolicyList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumNetworkPolicyNodeStatus) DeepCopyInto(out *CiliumNetworkPolicyNodeStatus) { - *out = *in - in.LastUpdated.DeepCopyInto(&out.LastUpdated) - if in.Annotations != nil { - in, out := &in.Annotations, &out.Annotations - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumNetworkPolicyNodeStatus. -func (in *CiliumNetworkPolicyNodeStatus) DeepCopy() *CiliumNetworkPolicyNodeStatus { - if in == nil { - return nil - } - out := new(CiliumNetworkPolicyNodeStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumNetworkPolicyStatus) DeepCopyInto(out *CiliumNetworkPolicyStatus) { - *out = *in - if in.Nodes != nil { - in, out := &in.Nodes, &out.Nodes - *out = make(map[string]CiliumNetworkPolicyNodeStatus, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } - if in.DerivativePolicies != nil { - in, out := &in.DerivativePolicies, &out.DerivativePolicies - *out = make(map[string]CiliumNetworkPolicyNodeStatus, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumNetworkPolicyStatus. -func (in *CiliumNetworkPolicyStatus) DeepCopy() *CiliumNetworkPolicyStatus { - if in == nil { - return nil - } - out := new(CiliumNetworkPolicyStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumNode) DeepCopyInto(out *CiliumNode) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumNode. -func (in *CiliumNode) DeepCopy() *CiliumNode { - if in == nil { - return nil - } - out := new(CiliumNode) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumNode) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumNodeList) DeepCopyInto(out *CiliumNodeList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CiliumNode, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumNodeList. -func (in *CiliumNodeList) DeepCopy() *CiliumNodeList { - if in == nil { - return nil - } - out := new(CiliumNodeList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumNodeList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ControllerStatus) DeepCopyInto(out *ControllerStatus) { - *out = *in - if in.Configuration != nil { - in, out := &in.Configuration, &out.Configuration - *out = new(models.ControllerStatusConfiguration) - **out = **in - } - out.Status = in.Status - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControllerStatus. -func (in *ControllerStatus) DeepCopy() *ControllerStatus { - if in == nil { - return nil - } - out := new(ControllerStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EgressGateway) DeepCopyInto(out *EgressGateway) { - *out = *in - if in.NodeSelector != nil { - in, out := &in.NodeSelector, &out.NodeSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EgressGateway. -func (in *EgressGateway) DeepCopy() *EgressGateway { - if in == nil { - return nil - } - out := new(EgressGateway) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EgressRule) DeepCopyInto(out *EgressRule) { - *out = *in - if in.NamespaceSelector != nil { - in, out := &in.NamespaceSelector, &out.NamespaceSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - if in.PodSelector != nil { - in, out := &in.PodSelector, &out.PodSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EgressRule. -func (in *EgressRule) DeepCopy() *EgressRule { - if in == nil { - return nil - } - out := new(EgressRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EncryptionSpec) DeepCopyInto(out *EncryptionSpec) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EncryptionSpec. -func (in *EncryptionSpec) DeepCopy() *EncryptionSpec { - if in == nil { - return nil - } - out := new(EncryptionSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointIdentity) DeepCopyInto(out *EndpointIdentity) { - *out = *in - if in.Labels != nil { - in, out := &in.Labels, &out.Labels - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointIdentity. -func (in *EndpointIdentity) DeepCopy() *EndpointIdentity { - if in == nil { - return nil - } - out := new(EndpointIdentity) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointNetworking) DeepCopyInto(out *EndpointNetworking) { - *out = *in - if in.Addressing != nil { - in, out := &in.Addressing, &out.Addressing - *out = make(AddressPairList, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(AddressPair) - **out = **in - } - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointNetworking. -func (in *EndpointNetworking) DeepCopy() *EndpointNetworking { - if in == nil { - return nil - } - out := new(EndpointNetworking) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointPolicy) DeepCopyInto(out *EndpointPolicy) { - *out = *in - if in.Ingress != nil { - in, out := &in.Ingress, &out.Ingress - *out = new(EndpointPolicyDirection) - (*in).DeepCopyInto(*out) - } - if in.Egress != nil { - in, out := &in.Egress, &out.Egress - *out = new(EndpointPolicyDirection) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointPolicy. -func (in *EndpointPolicy) DeepCopy() *EndpointPolicy { - if in == nil { - return nil - } - out := new(EndpointPolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointPolicyDirection) DeepCopyInto(out *EndpointPolicyDirection) { - *out = *in - if in.Allowed != nil { - in, out := &in.Allowed, &out.Allowed - *out = make(AllowedIdentityList, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Denied != nil { - in, out := &in.Denied, &out.Denied - *out = make(DenyIdentityList, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Removing != nil { - in, out := &in.Removing, &out.Removing - *out = make(AllowedIdentityList, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Adding != nil { - in, out := &in.Adding, &out.Adding - *out = make(AllowedIdentityList, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointPolicyDirection. -func (in *EndpointPolicyDirection) DeepCopy() *EndpointPolicyDirection { - if in == nil { - return nil - } - out := new(EndpointPolicyDirection) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointStatus) DeepCopyInto(out *EndpointStatus) { - *out = *in - if in.Controllers != nil { - in, out := &in.Controllers, &out.Controllers - *out = make(ControllerList, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.ExternalIdentifiers != nil { - in, out := &in.ExternalIdentifiers, &out.ExternalIdentifiers - *out = new(models.EndpointIdentifiers) - **out = **in - } - if in.Health != nil { - in, out := &in.Health, &out.Health - *out = new(models.EndpointHealth) - **out = **in - } - if in.Identity != nil { - in, out := &in.Identity, &out.Identity - *out = new(EndpointIdentity) - (*in).DeepCopyInto(*out) - } - if in.Log != nil { - in, out := &in.Log, &out.Log - *out = make([]*models.EndpointStatusChange, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(models.EndpointStatusChange) - **out = **in - } - } - } - if in.Networking != nil { - in, out := &in.Networking, &out.Networking - *out = new(EndpointNetworking) - (*in).DeepCopyInto(*out) - } - out.Encryption = in.Encryption - if in.Policy != nil { - in, out := &in.Policy, &out.Policy - *out = new(EndpointPolicy) - (*in).DeepCopyInto(*out) - } - if in.VisibilityPolicyStatus != nil { - in, out := &in.VisibilityPolicyStatus, &out.VisibilityPolicyStatus - *out = new(string) - **out = **in - } - if in.NamedPorts != nil { - in, out := &in.NamedPorts, &out.NamedPorts - *out = make(models.NamedPorts, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(models.Port) - **out = **in - } - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointStatus. -func (in *EndpointStatus) DeepCopy() *EndpointStatus { - if in == nil { - return nil - } - out := new(EndpointStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Frontend) DeepCopyInto(out *Frontend) { - *out = *in - if in.ToPorts != nil { - in, out := &in.ToPorts, &out.ToPorts - *out = make([]PortInfo, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Frontend. -func (in *Frontend) DeepCopy() *Frontend { - if in == nil { - return nil - } - out := new(Frontend) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HealthAddressingSpec) DeepCopyInto(out *HealthAddressingSpec) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HealthAddressingSpec. -func (in *HealthAddressingSpec) DeepCopy() *HealthAddressingSpec { - if in == nil { - return nil - } - out := new(HealthAddressingSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IdentityTuple) DeepCopyInto(out *IdentityTuple) { - *out = *in - if in.IdentityLabels != nil { - in, out := &in.IdentityLabels, &out.IdentityLabels - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IdentityTuple. -func (in *IdentityTuple) DeepCopy() *IdentityTuple { - if in == nil { - return nil - } - out := new(IdentityTuple) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeAddress) DeepCopyInto(out *NodeAddress) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAddress. -func (in *NodeAddress) DeepCopy() *NodeAddress { - if in == nil { - return nil - } - out := new(NodeAddress) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeSpec) DeepCopyInto(out *NodeSpec) { - *out = *in - if in.Addresses != nil { - in, out := &in.Addresses, &out.Addresses - *out = make([]NodeAddress, len(*in)) - copy(*out, *in) - } - out.HealthAddressing = in.HealthAddressing - out.IngressAddressing = in.IngressAddressing - out.Encryption = in.Encryption - in.ENI.DeepCopyInto(&out.ENI) - out.Azure = in.Azure - in.AlibabaCloud.DeepCopyInto(&out.AlibabaCloud) - in.IPAM.DeepCopyInto(&out.IPAM) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSpec. -func (in *NodeSpec) DeepCopy() *NodeSpec { - if in == nil { - return nil - } - out := new(NodeSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeStatus) DeepCopyInto(out *NodeStatus) { - *out = *in - in.ENI.DeepCopyInto(&out.ENI) - in.Azure.DeepCopyInto(&out.Azure) - in.IPAM.DeepCopyInto(&out.IPAM) - in.AlibabaCloud.DeepCopyInto(&out.AlibabaCloud) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeStatus. -func (in *NodeStatus) DeepCopy() *NodeStatus { - if in == nil { - return nil - } - out := new(NodeStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PortInfo) DeepCopyInto(out *PortInfo) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortInfo. -func (in *PortInfo) DeepCopy() *PortInfo { - if in == nil { - return nil - } - out := new(PortInfo) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RedirectBackend) DeepCopyInto(out *RedirectBackend) { - *out = *in - in.LocalEndpointSelector.DeepCopyInto(&out.LocalEndpointSelector) - if in.ToPorts != nil { - in, out := &in.ToPorts, &out.ToPorts - *out = make([]PortInfo, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedirectBackend. -func (in *RedirectBackend) DeepCopy() *RedirectBackend { - if in == nil { - return nil - } - out := new(RedirectBackend) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RedirectFrontend) DeepCopyInto(out *RedirectFrontend) { - *out = *in - if in.AddressMatcher != nil { - in, out := &in.AddressMatcher, &out.AddressMatcher - *out = new(Frontend) - (*in).DeepCopyInto(*out) - } - if in.ServiceMatcher != nil { - in, out := &in.ServiceMatcher, &out.ServiceMatcher - *out = new(ServiceInfo) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedirectFrontend. -func (in *RedirectFrontend) DeepCopy() *RedirectFrontend { - if in == nil { - return nil - } - out := new(RedirectFrontend) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Service) DeepCopyInto(out *Service) { - *out = *in - if in.Ports != nil { - in, out := &in.Ports, &out.Ports - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Service. -func (in *Service) DeepCopy() *Service { - if in == nil { - return nil - } - out := new(Service) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ServiceInfo) DeepCopyInto(out *ServiceInfo) { - *out = *in - if in.ToPorts != nil { - in, out := &in.ToPorts, &out.ToPorts - *out = make([]PortInfo, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceInfo. -func (in *ServiceInfo) DeepCopy() *ServiceInfo { - if in == nil { - return nil - } - out := new(ServiceInfo) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ServiceListener) DeepCopyInto(out *ServiceListener) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceListener. -func (in *ServiceListener) DeepCopy() *ServiceListener { - if in == nil { - return nil - } - out := new(ServiceListener) - in.DeepCopyInto(out) - return out -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new XDSResource. -func (in *XDSResource) DeepCopy() *XDSResource { - if in == nil { - return nil - } - out := new(XDSResource) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/zz_generated.deepequal.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/zz_generated.deepequal.go deleted file mode 100644 index 4faa8b5cb..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2/zz_generated.deepequal.go +++ /dev/null @@ -1,1326 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepequal-gen. DO NOT EDIT. - -package v2 - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *AddressPair) DeepEqual(other *AddressPair) bool { - if other == nil { - return false - } - - if in.IPV4 != other.IPV4 { - return false - } - if in.IPV6 != other.IPV6 { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *AddressPairList) DeepEqual(other *AddressPairList) bool { - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual((*other)[i]) { - return false - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *AllowedIdentityList) DeepEqual(other *AllowedIdentityList) bool { - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumClusterwideEnvoyConfig) DeepEqual(other *CiliumClusterwideEnvoyConfig) bool { - if other == nil { - return false - } - - if !in.Spec.DeepEqual(&other.Spec) { - return false - } - - return true -} - -// deepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumClusterwideNetworkPolicy) deepEqual(other *CiliumClusterwideNetworkPolicy) bool { - if other == nil { - return false - } - - if (in.Spec == nil) != (other.Spec == nil) { - return false - } else if in.Spec != nil { - if !in.Spec.DeepEqual(other.Spec) { - return false - } - } - - if ((in.Specs != nil) && (other.Specs != nil)) || ((in.Specs == nil) != (other.Specs == nil)) { - in, other := &in.Specs, &other.Specs - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if !in.Status.DeepEqual(&other.Status) { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumEgressGatewayPolicy) DeepEqual(other *CiliumEgressGatewayPolicy) bool { - if other == nil { - return false - } - - if !in.Spec.DeepEqual(&other.Spec) { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumEgressGatewayPolicySpec) DeepEqual(other *CiliumEgressGatewayPolicySpec) bool { - if other == nil { - return false - } - - if ((in.Selectors != nil) && (other.Selectors != nil)) || ((in.Selectors == nil) != (other.Selectors == nil)) { - in, other := &in.Selectors, &other.Selectors - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.DestinationCIDRs != nil) && (other.DestinationCIDRs != nil)) || ((in.DestinationCIDRs == nil) != (other.DestinationCIDRs == nil)) { - in, other := &in.DestinationCIDRs, &other.DestinationCIDRs - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if ((in.ExcludedCIDRs != nil) && (other.ExcludedCIDRs != nil)) || ((in.ExcludedCIDRs == nil) != (other.ExcludedCIDRs == nil)) { - in, other := &in.ExcludedCIDRs, &other.ExcludedCIDRs - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if (in.EgressGateway == nil) != (other.EgressGateway == nil) { - return false - } else if in.EgressGateway != nil { - if !in.EgressGateway.DeepEqual(other.EgressGateway) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumEndpoint) DeepEqual(other *CiliumEndpoint) bool { - if other == nil { - return false - } - - if !in.Status.DeepEqual(&other.Status) { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumEnvoyConfig) DeepEqual(other *CiliumEnvoyConfig) bool { - if other == nil { - return false - } - - if !in.Spec.DeepEqual(&other.Spec) { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumEnvoyConfigSpec) DeepEqual(other *CiliumEnvoyConfigSpec) bool { - if other == nil { - return false - } - - if ((in.Services != nil) && (other.Services != nil)) || ((in.Services == nil) != (other.Services == nil)) { - in, other := &in.Services, &other.Services - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual((*other)[i]) { - return false - } - } - } - } - - if ((in.BackendServices != nil) && (other.BackendServices != nil)) || ((in.BackendServices == nil) != (other.BackendServices == nil)) { - in, other := &in.BackendServices, &other.BackendServices - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual((*other)[i]) { - return false - } - } - } - } - - if ((in.Resources != nil) && (other.Resources != nil)) || ((in.Resources == nil) != (other.Resources == nil)) { - in, other := &in.Resources, &other.Resources - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if (in.NodeSelector == nil) != (other.NodeSelector == nil) { - return false - } else if in.NodeSelector != nil { - if !in.NodeSelector.DeepEqual(other.NodeSelector) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumExternalWorkload) DeepEqual(other *CiliumExternalWorkload) bool { - if other == nil { - return false - } - - if in.Spec != other.Spec { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumExternalWorkloadSpec) DeepEqual(other *CiliumExternalWorkloadSpec) bool { - if other == nil { - return false - } - - if in.IPv4AllocCIDR != other.IPv4AllocCIDR { - return false - } - if in.IPv6AllocCIDR != other.IPv6AllocCIDR { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumExternalWorkloadStatus) DeepEqual(other *CiliumExternalWorkloadStatus) bool { - if other == nil { - return false - } - - if in.ID != other.ID { - return false - } - if in.IP != other.IP { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumIdentity) DeepEqual(other *CiliumIdentity) bool { - if other == nil { - return false - } - - if ((in.SecurityLabels != nil) && (other.SecurityLabels != nil)) || ((in.SecurityLabels == nil) != (other.SecurityLabels == nil)) { - in, other := &in.SecurityLabels, &other.SecurityLabels - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if inValue != otherValue { - return false - } - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumLocalRedirectPolicy) DeepEqual(other *CiliumLocalRedirectPolicy) bool { - if other == nil { - return false - } - - if !in.Spec.DeepEqual(&other.Spec) { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumLocalRedirectPolicySpec) DeepEqual(other *CiliumLocalRedirectPolicySpec) bool { - if other == nil { - return false - } - - if !in.RedirectFrontend.DeepEqual(&other.RedirectFrontend) { - return false - } - - if !in.RedirectBackend.DeepEqual(&other.RedirectBackend) { - return false - } - - if in.SkipRedirectFromBackend != other.SkipRedirectFromBackend { - return false - } - if in.Description != other.Description { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumLocalRedirectPolicyStatus) DeepEqual(other *CiliumLocalRedirectPolicyStatus) bool { - if other == nil { - return false - } - - if in.OK != other.OK { - return false - } - - return true -} - -// deepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumNetworkPolicy) deepEqual(other *CiliumNetworkPolicy) bool { - if other == nil { - return false - } - - if (in.Spec == nil) != (other.Spec == nil) { - return false - } else if in.Spec != nil { - if !in.Spec.DeepEqual(other.Spec) { - return false - } - } - - if ((in.Specs != nil) && (other.Specs != nil)) || ((in.Specs == nil) != (other.Specs == nil)) { - in, other := &in.Specs, &other.Specs - if other == nil || !in.DeepEqual(other) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumNetworkPolicyNodeStatus) DeepEqual(other *CiliumNetworkPolicyNodeStatus) bool { - if other == nil { - return false - } - - if in.OK != other.OK { - return false - } - if in.Error != other.Error { - return false - } - if !in.LastUpdated.DeepEqual(&other.LastUpdated) { - return false - } - - if in.Revision != other.Revision { - return false - } - if in.Enforcing != other.Enforcing { - return false - } - if ((in.Annotations != nil) && (other.Annotations != nil)) || ((in.Annotations == nil) != (other.Annotations == nil)) { - in, other := &in.Annotations, &other.Annotations - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if inValue != otherValue { - return false - } - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumNetworkPolicyStatus) DeepEqual(other *CiliumNetworkPolicyStatus) bool { - if other == nil { - return false - } - - if ((in.Nodes != nil) && (other.Nodes != nil)) || ((in.Nodes == nil) != (other.Nodes == nil)) { - in, other := &in.Nodes, &other.Nodes - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if !inValue.DeepEqual(&otherValue) { - return false - } - } - } - } - } - - if ((in.DerivativePolicies != nil) && (other.DerivativePolicies != nil)) || ((in.DerivativePolicies == nil) != (other.DerivativePolicies == nil)) { - in, other := &in.DerivativePolicies, &other.DerivativePolicies - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if !inValue.DeepEqual(&otherValue) { - return false - } - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumNode) DeepEqual(other *CiliumNode) bool { - if other == nil { - return false - } - - if !in.Spec.DeepEqual(&other.Spec) { - return false - } - - if !in.Status.DeepEqual(&other.Status) { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ControllerList) DeepEqual(other *ControllerList) bool { - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ControllerStatus) DeepEqual(other *ControllerStatus) bool { - if other == nil { - return false - } - - if in.Name != other.Name { - return false - } - if (in.Configuration == nil) != (other.Configuration == nil) { - return false - } else if in.Configuration != nil { - if !in.Configuration.DeepEqual(other.Configuration) { - return false - } - } - - if in.Status != other.Status { - return false - } - - if in.UUID != other.UUID { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ControllerStatusStatus) DeepEqual(other *ControllerStatusStatus) bool { - if other == nil { - return false - } - - if in.ConsecutiveFailureCount != other.ConsecutiveFailureCount { - return false - } - if in.FailureCount != other.FailureCount { - return false - } - if in.LastFailureMsg != other.LastFailureMsg { - return false - } - if in.LastFailureTimestamp != other.LastFailureTimestamp { - return false - } - if in.LastSuccessTimestamp != other.LastSuccessTimestamp { - return false - } - if in.SuccessCount != other.SuccessCount { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *DenyIdentityList) DeepEqual(other *DenyIdentityList) bool { - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EgressGateway) DeepEqual(other *EgressGateway) bool { - if other == nil { - return false - } - - if (in.NodeSelector == nil) != (other.NodeSelector == nil) { - return false - } else if in.NodeSelector != nil { - if !in.NodeSelector.DeepEqual(other.NodeSelector) { - return false - } - } - - if in.Interface != other.Interface { - return false - } - if in.EgressIP != other.EgressIP { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EgressRule) DeepEqual(other *EgressRule) bool { - if other == nil { - return false - } - - if (in.NamespaceSelector == nil) != (other.NamespaceSelector == nil) { - return false - } else if in.NamespaceSelector != nil { - if !in.NamespaceSelector.DeepEqual(other.NamespaceSelector) { - return false - } - } - - if (in.PodSelector == nil) != (other.PodSelector == nil) { - return false - } else if in.PodSelector != nil { - if !in.PodSelector.DeepEqual(other.PodSelector) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EncryptionSpec) DeepEqual(other *EncryptionSpec) bool { - if other == nil { - return false - } - - if in.Key != other.Key { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EndpointIdentity) DeepEqual(other *EndpointIdentity) bool { - if other == nil { - return false - } - - if in.ID != other.ID { - return false - } - if ((in.Labels != nil) && (other.Labels != nil)) || ((in.Labels == nil) != (other.Labels == nil)) { - in, other := &in.Labels, &other.Labels - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EndpointNetworking) DeepEqual(other *EndpointNetworking) bool { - if other == nil { - return false - } - - if ((in.Addressing != nil) && (other.Addressing != nil)) || ((in.Addressing == nil) != (other.Addressing == nil)) { - in, other := &in.Addressing, &other.Addressing - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if in.NodeIP != other.NodeIP { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EndpointPolicy) DeepEqual(other *EndpointPolicy) bool { - if other == nil { - return false - } - - if (in.Ingress == nil) != (other.Ingress == nil) { - return false - } else if in.Ingress != nil { - if !in.Ingress.DeepEqual(other.Ingress) { - return false - } - } - - if (in.Egress == nil) != (other.Egress == nil) { - return false - } else if in.Egress != nil { - if !in.Egress.DeepEqual(other.Egress) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EndpointPolicyDirection) DeepEqual(other *EndpointPolicyDirection) bool { - if other == nil { - return false - } - - if in.Enforcing != other.Enforcing { - return false - } - if ((in.Allowed != nil) && (other.Allowed != nil)) || ((in.Allowed == nil) != (other.Allowed == nil)) { - in, other := &in.Allowed, &other.Allowed - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if ((in.Denied != nil) && (other.Denied != nil)) || ((in.Denied == nil) != (other.Denied == nil)) { - in, other := &in.Denied, &other.Denied - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if ((in.Removing != nil) && (other.Removing != nil)) || ((in.Removing == nil) != (other.Removing == nil)) { - in, other := &in.Removing, &other.Removing - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if ((in.Adding != nil) && (other.Adding != nil)) || ((in.Adding == nil) != (other.Adding == nil)) { - in, other := &in.Adding, &other.Adding - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if in.State != other.State { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EndpointStatus) DeepEqual(other *EndpointStatus) bool { - if other == nil { - return false - } - - if in.ID != other.ID { - return false - } - if ((in.Controllers != nil) && (other.Controllers != nil)) || ((in.Controllers == nil) != (other.Controllers == nil)) { - in, other := &in.Controllers, &other.Controllers - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if (in.ExternalIdentifiers == nil) != (other.ExternalIdentifiers == nil) { - return false - } else if in.ExternalIdentifiers != nil { - if !in.ExternalIdentifiers.DeepEqual(other.ExternalIdentifiers) { - return false - } - } - - if (in.Health == nil) != (other.Health == nil) { - return false - } else if in.Health != nil { - if !in.Health.DeepEqual(other.Health) { - return false - } - } - - if (in.Identity == nil) != (other.Identity == nil) { - return false - } else if in.Identity != nil { - if !in.Identity.DeepEqual(other.Identity) { - return false - } - } - - if ((in.Log != nil) && (other.Log != nil)) || ((in.Log == nil) != (other.Log == nil)) { - in, other := &in.Log, &other.Log - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual((*other)[i]) { - return false - } - } - } - } - - if (in.Networking == nil) != (other.Networking == nil) { - return false - } else if in.Networking != nil { - if !in.Networking.DeepEqual(other.Networking) { - return false - } - } - - if in.Encryption != other.Encryption { - return false - } - - if (in.Policy == nil) != (other.Policy == nil) { - return false - } else if in.Policy != nil { - if !in.Policy.DeepEqual(other.Policy) { - return false - } - } - - if (in.VisibilityPolicyStatus == nil) != (other.VisibilityPolicyStatus == nil) { - return false - } else if in.VisibilityPolicyStatus != nil { - if *in.VisibilityPolicyStatus != *other.VisibilityPolicyStatus { - return false - } - } - - if in.State != other.State { - return false - } - if ((in.NamedPorts != nil) && (other.NamedPorts != nil)) || ((in.NamedPorts == nil) != (other.NamedPorts == nil)) { - in, other := &in.NamedPorts, &other.NamedPorts - if other == nil || !in.DeepEqual(other) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Frontend) DeepEqual(other *Frontend) bool { - if other == nil { - return false - } - - if in.IP != other.IP { - return false - } - if ((in.ToPorts != nil) && (other.ToPorts != nil)) || ((in.ToPorts == nil) != (other.ToPorts == nil)) { - in, other := &in.ToPorts, &other.ToPorts - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *HealthAddressingSpec) DeepEqual(other *HealthAddressingSpec) bool { - if other == nil { - return false - } - - if in.IPv4 != other.IPv4 { - return false - } - if in.IPv6 != other.IPv6 { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *IdentityList) DeepEqual(other *IdentityList) bool { - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *IdentityTuple) DeepEqual(other *IdentityTuple) bool { - if other == nil { - return false - } - - if in.Identity != other.Identity { - return false - } - if ((in.IdentityLabels != nil) && (other.IdentityLabels != nil)) || ((in.IdentityLabels == nil) != (other.IdentityLabels == nil)) { - in, other := &in.IdentityLabels, &other.IdentityLabels - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if inValue != otherValue { - return false - } - } - } - } - } - - if in.DestPort != other.DestPort { - return false - } - if in.Protocol != other.Protocol { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *NodeAddress) DeepEqual(other *NodeAddress) bool { - if other == nil { - return false - } - - if in.Type != other.Type { - return false - } - if in.IP != other.IP { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *NodeSpec) DeepEqual(other *NodeSpec) bool { - if other == nil { - return false - } - - if in.InstanceID != other.InstanceID { - return false - } - if in.BootID != other.BootID { - return false - } - if ((in.Addresses != nil) && (other.Addresses != nil)) || ((in.Addresses == nil) != (other.Addresses == nil)) { - in, other := &in.Addresses, &other.Addresses - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if in.HealthAddressing != other.HealthAddressing { - return false - } - - if in.IngressAddressing != other.IngressAddressing { - return false - } - - if in.Encryption != other.Encryption { - return false - } - - if !in.ENI.DeepEqual(&other.ENI) { - return false - } - - if in.Azure != other.Azure { - return false - } - - if !in.AlibabaCloud.DeepEqual(&other.AlibabaCloud) { - return false - } - - if !in.IPAM.DeepEqual(&other.IPAM) { - return false - } - - if in.NodeIdentity != other.NodeIdentity { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *NodeStatus) DeepEqual(other *NodeStatus) bool { - if other == nil { - return false - } - - if !in.ENI.DeepEqual(&other.ENI) { - return false - } - - if !in.Azure.DeepEqual(&other.Azure) { - return false - } - - if !in.IPAM.DeepEqual(&other.IPAM) { - return false - } - - if !in.AlibabaCloud.DeepEqual(&other.AlibabaCloud) { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PortInfo) DeepEqual(other *PortInfo) bool { - if other == nil { - return false - } - - if in.Port != other.Port { - return false - } - if in.Protocol != other.Protocol { - return false - } - if in.Name != other.Name { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *RedirectBackend) DeepEqual(other *RedirectBackend) bool { - if other == nil { - return false - } - - if !in.LocalEndpointSelector.DeepEqual(&other.LocalEndpointSelector) { - return false - } - - if ((in.ToPorts != nil) && (other.ToPorts != nil)) || ((in.ToPorts == nil) != (other.ToPorts == nil)) { - in, other := &in.ToPorts, &other.ToPorts - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *RedirectFrontend) DeepEqual(other *RedirectFrontend) bool { - if other == nil { - return false - } - - if (in.AddressMatcher == nil) != (other.AddressMatcher == nil) { - return false - } else if in.AddressMatcher != nil { - if !in.AddressMatcher.DeepEqual(other.AddressMatcher) { - return false - } - } - - if (in.ServiceMatcher == nil) != (other.ServiceMatcher == nil) { - return false - } else if in.ServiceMatcher != nil { - if !in.ServiceMatcher.DeepEqual(other.ServiceMatcher) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Service) DeepEqual(other *Service) bool { - if other == nil { - return false - } - - if in.Name != other.Name { - return false - } - if in.Namespace != other.Namespace { - return false - } - if ((in.Ports != nil) && (other.Ports != nil)) || ((in.Ports == nil) != (other.Ports == nil)) { - in, other := &in.Ports, &other.Ports - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ServiceInfo) DeepEqual(other *ServiceInfo) bool { - if other == nil { - return false - } - - if in.Name != other.Name { - return false - } - if in.Namespace != other.Namespace { - return false - } - if ((in.ToPorts != nil) && (other.ToPorts != nil)) || ((in.ToPorts == nil) != (other.ToPorts == nil)) { - in, other := &in.ToPorts, &other.ToPorts - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ServiceListener) DeepEqual(other *ServiceListener) bool { - if other == nil { - return false - } - - if in.Name != other.Name { - return false - } - if in.Namespace != other.Namespace { - return false - } - if in.Listener != other.Listener { - return false - } - - return true -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/bgp_advert_types.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/bgp_advert_types.go deleted file mode 100644 index 624f1adcc..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/bgp_advert_types.go +++ /dev/null @@ -1,146 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v2alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - slimv1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" -) - -// BGPAdvertisementType defines type of advertisement. -// -// Note list of supported advertisements is not exhaustive and can be extended in the future. -// Consumer of this API should be able to handle unknown values. -// -// +kubebuilder:validation:Enum=PodCIDR;CiliumPodIPPool;Service -type BGPAdvertisementType string - -const ( - // BGPPodCIDRAdvert when configured, Cilium will advertise pod CIDRs to BGP peers. - BGPPodCIDRAdvert BGPAdvertisementType = "PodCIDR" - - // BGPCiliumPodIPPoolAdvert when configured, Cilium will advertise prefixes from CiliumPodIPPools to BGP peers. - BGPCiliumPodIPPoolAdvert BGPAdvertisementType = "CiliumPodIPPool" - - // BGPServiceAdvert when configured, Cilium will advertise service related routes to BGP peers. - // - BGPServiceAdvert BGPAdvertisementType = "Service" -) - -// BGPServiceAddressType defines type of service address to be advertised. -// -// Note list of supported service addresses is not exhaustive and can be extended in the future. -// Consumer of this API should be able to handle unknown values. -// -// +kubebuilder:validation:Enum=LoadBalancerIP;ClusterIP;ExternalIP -type BGPServiceAddressType string - -const ( - // BGPLoadBalancerIPAddr when configured, Cilium will advertise load balancer services IPs to BGP peers. - // The loadBalancerClass for a service must be nil or specify a class supported by Cilium, - // e.g. "io.cilium/bgp-control-plane". - // - // Refer to the following document for additional details regarding load balancer - // classes: https://kubernetes.io/docs/concepts/services-networking/service/#load-balancer-class - BGPLoadBalancerIPAddr BGPServiceAddressType = "LoadBalancerIP" - - // BGPClusterIPAddr when configured, Cilium will advertise cluster IP prefix of a service to BGP peers. - // Cluster IP for a service is defined here - // https://kubernetes.io/docs/concepts/services-networking/service/#type-clusterip - BGPClusterIPAddr BGPServiceAddressType = "ClusterIP" - - // BGPExternalIPAddr when configured, Cilium will advertise external IP prefix of a service to BGP peers. - // External IP for a service is defined here - // https://kubernetes.io/docs/concepts/services-networking/service/#external-ips - BGPExternalIPAddr BGPServiceAddressType = "ExternalIP" -) - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:categories={cilium,ciliumbgp},singular="ciliumbgpadvertisement",path="ciliumbgpadvertisements",scope="Cluster",shortName={cbgpadvert} -// +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",name="Age",type=date -// +kubebuilder:storageversion - -// CiliumBGPAdvertisement is the Schema for the ciliumbgpadvertisements API -type CiliumBGPAdvertisement struct { - // +deepequal-gen=false - metav1.TypeMeta `json:",inline"` - // +deepequal-gen=false - metav1.ObjectMeta `json:"metadata"` - - Spec CiliumBGPAdvertisementSpec `json:"spec"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:openapi-gen=false -// +deepequal-gen=false - -// CiliumBGPAdvertisementList contains a list of CiliumBGPAdvertisement -type CiliumBGPAdvertisementList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - // Items is a list of CiliumBGPAdvertisement. - Items []CiliumBGPAdvertisement `json:"items"` -} - -type CiliumBGPAdvertisementSpec struct { - // Advertisements is a list of BGP advertisements. - // - // +kubebuilder:validation:Required - // +kubebuilder:validation:MinItems=1 - Advertisements []BGPAdvertisement `json:"advertisements"` -} - -// BGPAdvertisement defines which routes Cilium should advertise to BGP peers. Optionally, additional attributes can be -// set to the advertised routes. -type BGPAdvertisement struct { - // AdvertisementType defines type of advertisement which has to be advertised. - // - // +kubebuilder:validation:Required - AdvertisementType BGPAdvertisementType `json:"advertisementType"` - - // Service defines configuration options for advertisementType service. - // - // +kubebuilder:validation:Optional - Service *BGPServiceOptions `json:"service,omitempty"` - - // Selector is a label selector to select objects of the type specified by AdvertisementType. - // If not specified, all objects of the type specified by AdvertisementType are selected for advertisement. - // - // +kubebuilder:validation:Optional - Selector *slimv1.LabelSelector `json:"selector,omitempty"` - - // Attributes defines additional attributes to set to the advertised routes. - // If not specified, no additional attributes are set. - // - // +kubebuilder:validation:Optional - Attributes *BGPAttributes `json:"attributes,omitempty"` -} - -// BGPServiceOptions defines the configuration for Service advertisement type. -type BGPServiceOptions struct { - // Addresses is a list of service address types which needs to be advertised via BGP. - // - // +kubebuilder:validation:Required - // +kubebuilder:validation:MinItems=1 - Addresses []BGPServiceAddressType `json:"addresses,omitempty"` -} - -// BGPAttributes defines additional attributes to set to the advertised NLRIs. -type BGPAttributes struct { - // Communities sets the community attributes in the route. - // If not specified, no community attribute is set. - // - // +kubebuilder:validation:Optional - Communities *BGPCommunities `json:"communities,omitempty"` - - // LocalPreference sets the local preference attribute in the route. - // If not specified, no local preference attribute is set. - // - // +kubebuilder:validation:Optional - LocalPreference *int64 `json:"localPreference,omitempty"` -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/bgp_cluster_types.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/bgp_cluster_types.go deleted file mode 100644 index dad7bb87f..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/bgp_cluster_types.go +++ /dev/null @@ -1,138 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v2alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - slimv1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" -) - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:categories={cilium,ciliumbgp},singular="ciliumbgpclusterconfig",path="ciliumbgpclusterconfigs",scope="Cluster",shortName={cbgpcluster} -// +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",name="Age",type=date -// +kubebuilder:storageversion - -// CiliumBGPClusterConfig is the Schema for the CiliumBGPClusterConfig API -type CiliumBGPClusterConfig struct { - // +deepequal-gen=false - metav1.TypeMeta `json:",inline"` - // +deepequal-gen=false - metav1.ObjectMeta `json:"metadata"` - - // Spec defines the desired cluster configuration of the BGP control plane. - Spec CiliumBGPClusterConfigSpec `json:"spec"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:openapi-gen=false -// +deepequal-gen=false - -// CiliumBGPClusterConfigList is a list of CiliumBGPClusterConfig objects. -type CiliumBGPClusterConfigList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - // Items is a list of CiliumBGPClusterConfig. - Items []CiliumBGPClusterConfig `json:"items"` -} - -type CiliumBGPClusterConfigSpec struct { - // NodeSelector selects a group of nodes where this BGP Cluster - // config applies. - // If empty / nil this config applies to all nodes. - // - // +kubebuilder:validation:Optional - NodeSelector *slimv1.LabelSelector `json:"nodeSelector,omitempty"` - - // A list of CiliumBGPInstance(s) which instructs - // the BGP control plane how to instantiate virtual BGP routers. - // - // +kubebuilder:validation:Required - // +kubebuilder:validation:MinItems=1 - // +kubebuilder:validation:MaxItems=16 - // +listType=map - // +listMapKey=name - BGPInstances []CiliumBGPInstance `json:"bgpInstances"` -} - -type CiliumBGPInstance struct { - // Name is the name of the BGP instance. It is a unique identifier for the BGP instance - // within the cluster configuration. - // - // +kubebuilder:validation:Required - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=255 - Name string `json:"name"` - - // LocalASN is the ASN of this BGP instance. - // Supports extended 32bit ASNs. - // - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Minimum=1 - // +kubebuilder:validation:Maximum=4294967295 - LocalASN *int64 `json:"localASN,omitempty"` - - // Peers is a list of neighboring BGP peers for this virtual router - // - // +kubebuilder:validation:Optional - // +listType=map - // +listMapKey=name - Peers []CiliumBGPPeer `json:"peers,omitempty"` -} - -type CiliumBGPPeer struct { - // Name is the name of the BGP peer. It is a unique identifier for the peer within the BGP instance. - // - // +kubebuilder:validation:Required - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=255 - Name string `json:"name"` - - // PeerAddress is the IP address of the neighbor. - // Supports IPv4 and IPv6 addresses. - // - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Pattern=`((^\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\s*$)|(^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$))` - PeerAddress *string `json:"peerAddress,omitempty"` - - // PeerASN is the ASN of the peer BGP router. - // Supports extended 32bit ASNs. - // - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Minimum=1 - // +kubebuilder:validation:Maximum=4294967295 - PeerASN *int64 `json:"peerASN,omitempty"` - - // PeerConfigRef is a reference to a peer configuration resource. - // If not specified, the default BGP configuration is used for this peer. - // - // +kubebuilder:validation:Optional - PeerConfigRef *PeerConfigReference `json:"peerConfigRef,omitempty"` -} - -// PeerConfigReference is a reference to a peer configuration resource. -type PeerConfigReference struct { - // Group is the group of the peer config resource. - // If not specified, the default of "cilium.io" is used. - // - // +kubebuilder:validation:Optional - // +kubebuilder:default="cilium.io" - Group string `json:"group"` - - // Kind is the kind of the peer config resource. - // If not specified, the default of "CiliumBGPPeerConfig" is used. - // - // +kubebuilder:validation:Optional - // +kubebuilder:default="CiliumBGPPeerConfig" - Kind string `json:"kind"` - - // Name is the name of the peer config resource. - // Name refers to the name of a Kubernetes object (typically a CiliumBGPPeerConfig). - // - // +kubebuilder:validation:Required - Name string `json:"name"` -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/bgp_node_override_types.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/bgp_node_override_types.go deleted file mode 100644 index f14bdb419..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/bgp_node_override_types.go +++ /dev/null @@ -1,101 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v2alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:categories={cilium,ciliumbgp},singular="ciliumbgpnodeconfigoverride",path="ciliumbgpnodeconfigoverrides",scope="Cluster",shortName={cbgpnodeoverride} -// +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",name="Age",type=date -// +kubebuilder:storageversion - -// CiliumBGPNodeConfigOverride specifies configuration overrides for a CiliumBGPNodeConfig. -// It allows fine-tuning of BGP behavior on a per-node basis. For the override to be effective, -// the names in CiliumBGPNodeConfigOverride and CiliumBGPNodeConfig must match exactly. This -// matching ensures that specific node configurations are applied correctly and only where intended. -type CiliumBGPNodeConfigOverride struct { - // +deepequal-gen=false - metav1.TypeMeta `json:",inline"` - // +deepequal-gen=false - metav1.ObjectMeta `json:"metadata"` - - // Spec is the specification of the desired behavior of the CiliumBGPNodeConfigOverride. - Spec CiliumBGPNodeConfigOverrideSpec `json:"spec"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:openapi-gen=false -// +deepequal-gen=false - -// CiliumBGPNodeConfigOverrideList is a list of CiliumBGPNodeConfigOverride objects. -type CiliumBGPNodeConfigOverrideList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - // Items is a list of CiliumBGPNodeConfigOverride. - Items []CiliumBGPNodeConfigOverride `json:"items"` -} - -type CiliumBGPNodeConfigOverrideSpec struct { - // BGPInstances is a list of BGP instances to override. - // - // +kubebuilder:validation:Required - // +kubebuilder:validation:MinItems=1 - // +listType=map - // +listMapKey=name - BGPInstances []CiliumBGPNodeConfigInstanceOverride `json:"bgpInstances"` -} - -// CiliumBGPNodeConfigInstanceOverride defines configuration options which can be overridden for a specific BGP instance. -type CiliumBGPNodeConfigInstanceOverride struct { - // Name is the name of the BGP instance for which the configuration is overridden. - // - // +kubebuilder:validation:Required - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=255 - Name string `json:"name"` - - // RouterID is BGP router id to use for this instance. It must be unique across all BGP instances. - // - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Format=ipv4 - RouterID *string `json:"routerID,omitempty"` - - // LocalPort is port to use for this BGP instance. - // - // +kubebuilder:validation:Optional - LocalPort *int32 `json:"localPort,omitempty"` - - // Peers is a list of peer configurations to override. - // - // +kubebuilder:validation:Optional - // +listType=map - // +listMapKey=name - Peers []CiliumBGPNodeConfigPeerOverride `json:"peers,omitempty"` -} - -// CiliumBGPNodeConfigPeerOverride defines configuration options which can be overridden for a specific peer. -type CiliumBGPNodeConfigPeerOverride struct { - // Name is the name of the peer for which the configuration is overridden. - // - // +kubebuilder:validation:Required - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=255 - Name string `json:"name"` - - // LocalAddress is the IP address to use for connecting to this peer. - // - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Pattern=`((^\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\s*$)|(^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$))` - LocalAddress *string `json:"localAddress,omitempty"` - - // LocalPort is source port to use for connecting to this peer. - // - // +kubebuilder:validation:Optional - LocalPort *int32 `json:"localPort,omitempty"` -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/bgp_node_types.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/bgp_node_types.go deleted file mode 100644 index b9c284567..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/bgp_node_types.go +++ /dev/null @@ -1,218 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v2alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:categories={cilium,ciliumbgp},singular="ciliumbgpnodeconfig",path="ciliumbgpnodeconfigs",scope="Cluster",shortName={cbgpnode} -// +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",name="Age",type=date -// +kubebuilder:storageversion - -// CiliumBGPNodeConfig is node local configuration for BGP agent. Name of the object should be node name. -// This resource will be created by Cilium operator and is read-only for the users. -type CiliumBGPNodeConfig struct { - // +deepequal-gen=false - metav1.TypeMeta `json:",inline"` - // +deepequal-gen=false - metav1.ObjectMeta `json:"metadata"` - - // Spec is the specification of the desired behavior of the CiliumBGPNodeConfig. - Spec CiliumBGPNodeSpec `json:"spec"` - - // Status is the most recently observed status of the CiliumBGPNodeConfig. - // +kubebuilder:validation:Optional - Status CiliumBGPNodeStatus `json:"status"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:openapi-gen=false -// +deepequal-gen=false - -// CiliumBGPNodeConfigList is a list of CiliumBGPNodeConfig objects. -type CiliumBGPNodeConfigList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - // Items is a list of CiliumBGPNodeConfig. - Items []CiliumBGPNodeConfig `json:"items"` -} - -type CiliumBGPNodeSpec struct { - // BGPInstances is a list of BGP router instances on the node. - // - // +kubebuilder:validation:Required - // +kubebuilder:validation:MinItems=1 - // +kubebuilder:validation:MaxItems=16 - // +listType=map - // +listMapKey=name - BGPInstances []CiliumBGPNodeInstance `json:"bgpInstances"` -} - -// CiliumBGPNodeInstance is a single BGP router instance configuration on the node. -type CiliumBGPNodeInstance struct { - // Name is the name of the BGP instance. This name is used to identify the BGP instance on the node. - // - // +kubebuilder:validation:Required - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=255 - Name string `json:"name"` - - // LocalASN is the ASN of this virtual router. - // Supports extended 32bit ASNs. - // - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Minimum=1 - // +kubebuilder:validation:Maximum=4294967295 - LocalASN *int64 `json:"localASN,omitempty"` - - // RouterID is the BGP router ID of this virtual router. - // This configuration is derived from CiliumBGPNodeConfigOverride resource. - // - // If not specified, the router ID will be derived from the node local address. - // - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Format=ipv4 - RouterID *string `json:"routerID,omitempty"` - - // LocalPort is the port on which the BGP daemon listens for incoming connections. - // - // If not specified, BGP instance will not listen for incoming connections. - // - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Minimum=1 - // +kubebuilder:validation:Maximum=65535 - LocalPort *int32 `json:"localPort,omitempty"` - - // Peers is a list of neighboring BGP peers for this virtual router - // - // +kubebuilder:validation:Optional - // +listType=map - // +listMapKey=name - Peers []CiliumBGPNodePeer `json:"peers,omitempty"` -} - -type CiliumBGPNodePeer struct { - // Name is the name of the BGP peer. This name is used to identify the BGP peer for the BGP instance. - // - // +kubebuilder:validation:Required - Name string `json:"name"` - - // PeerAddress is the IP address of the neighbor. - // Supports IPv4 and IPv6 addresses. - // - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Pattern=`((^\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\s*$)|(^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$))` - PeerAddress *string `json:"peerAddress,omitempty"` - - // PeerASN is the ASN of the peer BGP router. - // Supports extended 32bit ASNs - // - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Minimum=1 - // +kubebuilder:validation:Maximum=4294967295 - PeerASN *int64 `json:"peerASN,omitempty"` - - // LocalAddress is the IP address of the local interface to use for the peering session. - // This configuration is derived from CiliumBGPNodeConfigOverride resource. If not specified, the local address will be used for setting up peering. - // - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Pattern=`((^\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\s*$)|(^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$))` - LocalAddress *string `json:"localAddress,omitempty"` - - // PeerConfigRef is a reference to a peer configuration resource. - // If not specified, the default BGP configuration is used for this peer. - // - // +kubebuilder:validation:Optional - PeerConfigRef *PeerConfigReference `json:"peerConfigRef,omitempty"` -} - -// CiliumBGPNodeStatus is the status of the CiliumBGPNodeConfig. -type CiliumBGPNodeStatus struct { - // BGPInstances is the status of the BGP instances on the node. - // - // +kubebuilder:validation:Optional - // +listType=map - // +listMapKey=name - BGPInstances []CiliumBGPNodeInstanceStatus `json:"bgpInstances,omitempty"` -} - -type CiliumBGPNodeInstanceStatus struct { - // Name is the name of the BGP instance. This name is used to identify the BGP instance on the node. - // - // +kubebuilder:validation:Required - Name string `json:"name"` - - // LocalASN is the ASN of this BGP instance. - // - // +kubebuilder:validation:Optional - LocalASN *int64 `json:"localASN,omitempty"` - - // PeerStatuses is the state of the BGP peers for this BGP instance. - // - // +kubebuilder:validation:Optional - // +listType=map - // +listMapKey=name - PeerStatuses []CiliumBGPNodePeerStatus `json:"peers,omitempty"` -} - -// CiliumBGPNodePeerStatus is the status of a BGP peer. -type CiliumBGPNodePeerStatus struct { - // Name is the name of the BGP peer. - // - // +kubebuilder:validation:Required - Name string `json:"name"` - - // PeerAddress is the IP address of the neighbor. - // - // +kubebuilder:validation:Required - PeerAddress string `json:"peerAddress"` - - // PeerASN is the ASN of the neighbor. - // - // +kubebuilder:validation:Optional - PeerASN *int64 `json:"peerASN,omitempty"` - - // PeeringState is last known state of the peering session. - // - // +kubebuilder:validation:Optional - PeeringState *string `json:"peeringState,omitempty"` - - // Timers is the state of the negotiated BGP timers for this peer. - // - // +kubebuilder:validation:Optional - Timers *CiliumBGPTimersState `json:"timers,omitempty"` - - // Uptime is the time since the last peering session was established. - // - // +kubebuilder:validation:Optional - Uptime *string `json:"uptime,omitempty"` - - // RoutesReceived is the number of routes received from this peer. - // - // +kubebuilder:validation:Optional - RoutesReceived *int32 `json:"routesReceived,omitempty"` - - // RoutesAdvertised is the number of routes advertised to this peer. - // - // +kubebuilder:validation:Optional - RoutesAdvertised *int32 `json:"routesAdvertised,omitempty"` -} - -// CiliumBGPTimersState is the state of the negotiated BGP timers for a peer. -type CiliumBGPTimersState struct { - // AppliedHoldTimeSeconds is the negotiated hold time for this peer. - // - // +kubebuilder:validation:Optional - AppliedHoldTimeSeconds *int32 `json:"appliedHoldTimeSeconds,omitempty"` - - // AppliedKeepaliveSeconds is the negotiated keepalive time for this peer. - // - // +kubebuilder:validation:Optional - AppliedKeepaliveSeconds *int32 `json:"appliedKeepaliveSeconds,omitempty"` -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/bgp_peer_types.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/bgp_peer_types.go deleted file mode 100644 index 525243fbc..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/bgp_peer_types.go +++ /dev/null @@ -1,246 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v2alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/utils/ptr" - - slimv1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" -) - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:openapi-gen=false -// +deepequal-gen=false - -// CiliumBGPPeerConfigList is a list of CiliumBGPPeer objects. -type CiliumBGPPeerConfigList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - // Items is a list of CiliumBGPPeer. - Items []CiliumBGPPeerConfig `json:"items"` -} - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:categories={cilium,ciliumbgp},singular="ciliumbgppeerconfig",path="ciliumbgppeerconfigs",scope="Cluster",shortName={cbgppeer} -// +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",name="Age",type=date -// +kubebuilder:storageversion - -type CiliumBGPPeerConfig struct { - // +deepequal-gen=false - metav1.TypeMeta `json:",inline"` - // +deepequal-gen=false - metav1.ObjectMeta `json:"metadata"` - - // Spec is the specification of the desired behavior of the CiliumBGPPeerConfig. - Spec CiliumBGPPeerConfigSpec `json:"spec"` -} - -type CiliumBGPPeerConfigSpec struct { - // Transport defines the BGP transport parameters for the peer. - // - // If not specified, the default transport parameters are used. - // - // +kubebuilder:validation:Optional - Transport *CiliumBGPTransport `json:"transport,omitempty"` - - // Timers defines the BGP timers for the peer. - // - // If not specified, the default timers are used. - // - // +kubebuilder:validation:Optional - Timers *CiliumBGPTimers `json:"timers,omitempty"` - - // AuthSecretRef is the name of the secret to use to fetch a TCP - // authentication password for this peer. - // - // If not specified, no authentication is used. - // - // +kubebuilder:validation:Optional - AuthSecretRef *string `json:"authSecretRef,omitempty"` - - // GracefulRestart defines graceful restart parameters which are negotiated - // with this peer. - // - // If not specified, the graceful restart capability is disabled. - // - // +kubebuilder:validation:Optional - GracefulRestart *CiliumBGPNeighborGracefulRestart `json:"gracefulRestart,omitempty"` - - // EBGPMultihopTTL controls the multi-hop feature for eBGP peers. - // Its value defines the Time To Live (TTL) value used in BGP - // packets sent to the peer. - // - // If not specified, EBGP multihop is disabled. This field is ignored for iBGP neighbors. - // - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Minimum=1 - // +kubebuilder:validation:Maximum=255 - // +kubebuilder:default=1 - EBGPMultihop *int32 `json:"ebgpMultihop,omitempty"` - - // Families, if provided, defines a set of AFI/SAFIs the speaker will - // negotiate with it's peer. - // - // If not specified, the default families of IPv6/unicast and IPv4/unicast will be created. - // - // +kubebuilder:validation:Optional - Families []CiliumBGPFamilyWithAdverts `json:"families,omitempty"` -} - -// CiliumBGPFamily represents a AFI/SAFI address family pair. -type CiliumBGPFamily struct { - // Afi is the Address Family Identifier (AFI) of the family. - // - // +kubebuilder:validation:Enum=ipv4;ipv6;l2vpn;ls;opaque - // +kubebuilder:validation:Required - Afi string `json:"afi"` - - // Safi is the Subsequent Address Family Identifier (SAFI) of the family. - // - // +kubebuilder:validation:Enum=unicast;multicast;mpls_label;encapsulation;vpls;evpn;ls;sr_policy;mup;mpls_vpn;mpls_vpn_multicast;route_target_constraints;flowspec_unicast;flowspec_vpn;key_value - // +kubebuilder:validation:Required - Safi string `json:"safi"` -} - -// CiliumBGPFamilyWithAdverts represents a AFI/SAFI address family pair along with reference to BGP Advertisements. -type CiliumBGPFamilyWithAdverts struct { - CiliumBGPFamily `json:",inline"` - - // Advertisements selects group of BGP Advertisement(s) to advertise for this family. - // - // If not specified, no advertisements are sent for this family. - // - // This field is ignored in CiliumBGPNeighbor which is used in CiliumBGPPeeringPolicy. - // Use CiliumBGPPeeringPolicy advertisement options instead. - // - // +kubebuilder:validation:Optional - Advertisements *slimv1.LabelSelector `json:"advertisements,omitempty"` -} - -// CiliumBGPTransport defines the BGP transport parameters for the peer. -type CiliumBGPTransport struct { - // LocalPort is the local port to be used for the BGP session. - // - // If not specified, defaults to TCP port 179. - // - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Minimum=1 - // +kubebuilder:validation:Maximum=65535 - // +kubebuilder:default=179 - LocalPort *int32 `json:"localPort,omitempty"` - - // PeerPort is the peer port to be used for the BGP session. - // - // If not specified, defaults to TCP port 179. - // - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Minimum=1 - // +kubebuilder:validation:Maximum=65535 - // +kubebuilder:default=179 - PeerPort *int32 `json:"peerPort,omitempty"` -} - -func (t *CiliumBGPTransport) SetDefaults() { - if t.LocalPort == nil || *t.LocalPort == 0 { - t.LocalPort = ptr.To[int32](DefaultBGPPeerLocalPort) - } - - if t.PeerPort == nil || *t.PeerPort == 0 { - t.PeerPort = ptr.To[int32](DefaultBGPPeerPort) - } -} - -type CiliumBGPTimers struct { - // ConnectRetryTimeSeconds defines the initial value for the BGP ConnectRetryTimer (RFC 4271, Section 8). - // - // If not specified, defaults to 120 seconds. - // - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Minimum=1 - // +kubebuilder:validation:Maximum=2147483647 - // +kubebuilder:default=120 - ConnectRetryTimeSeconds *int32 `json:"connectRetryTimeSeconds,omitempty"` - - // HoldTimeSeconds defines the initial value for the BGP HoldTimer (RFC 4271, Section 4.2). - // Updating this value will cause a session reset. - // - // If not specified, defaults to 90 seconds. - // - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Minimum=3 - // +kubebuilder:validation:Maximum=65535 - // +kubebuilder:default=90 - HoldTimeSeconds *int32 `json:"holdTimeSeconds,omitempty"` - - // KeepaliveTimeSeconds defines the initial value for the BGP KeepaliveTimer (RFC 4271, Section 8). - // It can not be larger than HoldTimeSeconds. Updating this value will cause a session reset. - // - // If not specified, defaults to 30 seconds. - // - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Minimum=1 - // +kubebuilder:validation:Maximum=65535 - // +kubebuilder:default=30 - KeepAliveTimeSeconds *int32 `json:"keepAliveTimeSeconds,omitempty"` -} - -func (t *CiliumBGPTimers) SetDefaults() { - if t.ConnectRetryTimeSeconds == nil || *t.ConnectRetryTimeSeconds == 0 { - t.ConnectRetryTimeSeconds = ptr.To[int32](DefaultBGPConnectRetryTimeSeconds) - } - - if t.HoldTimeSeconds == nil || *t.HoldTimeSeconds == 0 { - t.HoldTimeSeconds = ptr.To[int32](DefaultBGPHoldTimeSeconds) - } - - if t.KeepAliveTimeSeconds == nil || *t.KeepAliveTimeSeconds == 0 { - t.KeepAliveTimeSeconds = ptr.To[int32](DefaultBGPKeepAliveTimeSeconds) - } -} - -func (p *CiliumBGPPeerConfigSpec) SetDefaults() { - if p == nil { - return - } - - if p.Transport == nil { - p.Transport = &CiliumBGPTransport{} - } - p.Transport.SetDefaults() - - if p.Timers == nil { - p.Timers = &CiliumBGPTimers{} - } - p.Timers.SetDefaults() - - if p.EBGPMultihop == nil { - p.EBGPMultihop = ptr.To[int32](DefaultBGPEBGPMultihopTTL) - } - - if p.GracefulRestart == nil { - p.GracefulRestart = &CiliumBGPNeighborGracefulRestart{} - } - p.GracefulRestart.SetDefaults() - - if len(p.Families) == 0 { - p.Families = []CiliumBGPFamilyWithAdverts{ - { - CiliumBGPFamily: CiliumBGPFamily{ - Afi: "ipv6", - Safi: "unicast", - }, - }, - { - CiliumBGPFamily: CiliumBGPFamily{ - Afi: "ipv4", - Safi: "unicast", - }, - }, - } - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/bgpp_types.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/bgpp_types.go deleted file mode 100644 index b7690cdbc..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/bgpp_types.go +++ /dev/null @@ -1,413 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v2alpha1 - -import ( - "fmt" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/utils/pointer" - - slimv1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" -) - -const ( - // DefaultBGPExportPodCIDR defines the default value for ExportPodCIDR determining whether to export the Node's private CIDR block. - DefaultBGPExportPodCIDR = false - // DefaultBGPPeerLocalPort defines the default value for the local port over which to connect to the peer. - // By default, BGP control plane will not set this value, and the kernel will pick a random port source port. - DefaultBGPPeerLocalPort = 0 - // DefaultBGPPeerPort defines the TCP port number of a CiliumBGPNeighbor when PeerPort is unspecified. - DefaultBGPPeerPort = 179 - // DefaultBGPEBGPMultihopTTL defines the default value for the TTL value used in BGP packets sent to the eBGP neighbors. - DefaultBGPEBGPMultihopTTL = 1 - // DefaultBGPConnectRetryTimeSeconds defines the default initial value for the BGP ConnectRetryTimer (RFC 4271, Section 8). - DefaultBGPConnectRetryTimeSeconds = 120 - // DefaultBGPHoldTimeSeconds defines the default initial value for the BGP HoldTimer (RFC 4271, Section 4.2). - DefaultBGPHoldTimeSeconds = 90 - // DefaultBGPKeepAliveTimeSeconds defines the default initial value for the BGP KeepaliveTimer (RFC 4271, Section 8). - DefaultBGPKeepAliveTimeSeconds = 30 - // DefaultBGPGRRestartTimeSeconds defines default Restart Time for graceful restart (RFC 4724, section 4.2) - DefaultBGPGRRestartTimeSeconds = 120 - // BGPLoadBalancerClass defines the BGP Control Plane load balancer class for Services. - BGPLoadBalancerClass = "io.cilium/bgp-control-plane" - // PodCIDRSelectorName defines the name for a selector matching Pod CIDRs - // (standard cluster scope / Kubernetes IPAM CIDRs, not Multi-Pool IPAM CIDRs). - PodCIDRSelectorName = "PodCIDR" - // CiliumLoadBalancerIPPoolSelectorName defines the name for a selector matching CiliumLoadBalancerIPPool resources. - CiliumLoadBalancerIPPoolSelectorName = "CiliumLoadBalancerIPPool" - // CiliumPodIPPoolSelectorName defines the name for a selector matching CiliumPodIPPool resources. - CiliumPodIPPoolSelectorName = CPIPKindDefinition -) - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:categories={cilium,ciliumbgp},singular="ciliumbgppeeringpolicy",path="ciliumbgppeeringpolicies",scope="Cluster",shortName={bgpp} -// +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",name="Age",type=date -// +kubebuilder:storageversion - -// CiliumBGPPeeringPolicy is a Kubernetes third-party resource for instructing -// Cilium's BGP control plane to create virtual BGP routers. -type CiliumBGPPeeringPolicy struct { - // +deepequal-gen=false - metav1.TypeMeta `json:",inline"` - // +deepequal-gen=false - metav1.ObjectMeta `json:"metadata"` - - // Spec is a human readable description of a BGP peering policy - // - // +kubebuilder:validation:Optional - Spec CiliumBGPPeeringPolicySpec `json:"spec,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:openapi-gen=false -// +deepequal-gen=false - -// CiliumBGPPeeringPolicyList is a list of -// CiliumBGPPeeringPolicy objects. -type CiliumBGPPeeringPolicyList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - // Items is a list of CiliumBGPPeeringPolicies. - Items []CiliumBGPPeeringPolicy `json:"items"` -} - -// CiliumBGPPeeringPolicySpec specifies one or more CiliumBGPVirtualRouter(s) -// to apply to nodes matching it's label selector. -type CiliumBGPPeeringPolicySpec struct { - // NodeSelector selects a group of nodes where this BGP Peering - // Policy applies. - // - // If empty / nil this policy applies to all nodes. - // - // +kubebuilder:validation:Optional - NodeSelector *slimv1.LabelSelector `json:"nodeSelector,omitempty"` - // A list of CiliumBGPVirtualRouter(s) which instructs - // the BGP control plane how to instantiate virtual BGP routers. - // - // +kubebuilder:validation:Required - // +kubebuilder:validation:MinItems=1 - VirtualRouters []CiliumBGPVirtualRouter `json:"virtualRouters"` -} - -type CiliumBGPNeighborGracefulRestart struct { - // Enabled flag, when set enables graceful restart capability. - // - // +kubebuilder:validation:Required - Enabled bool `json:"enabled"` - // RestartTimeSeconds is the estimated time it will take for the BGP - // session to be re-established with peer after a restart. - // After this period, peer will remove stale routes. This is - // described RFC 4724 section 4.2. - // - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Minimum=1 - // +kubebuilder:validation:Maximum=4095 - // +kubebuilder:default=120 - RestartTimeSeconds *int32 `json:"restartTimeSeconds,omitempty"` -} - -func (gr *CiliumBGPNeighborGracefulRestart) SetDefaults() { - if gr.RestartTimeSeconds == nil || *gr.RestartTimeSeconds == 0 { - gr.RestartTimeSeconds = pointer.Int32(DefaultBGPGRRestartTimeSeconds) - } -} - -// BGPStandardCommunity type represents a value of the "standard" 32-bit BGP Communities Attribute (RFC 1997) -// as a 4-byte decimal number or two 2-byte decimal numbers separated by a colon (<0-65535>:<0-65535>). -// For example, no-export community value is 65553:65281. -// +kubebuilder:validation:Pattern=`^([0-9]|[1-9][0-9]{1,8}|[1-3][0-9]{9}|4[01][0-9]{8}|42[0-8][0-9]{7}|429[0-3][0-9]{6}|4294[0-8][0-9]{5}|42949[0-5][0-9]{4}|429496[0-6][0-9]{3}|4294967[01][0-9]{2}|42949672[0-8][0-9]|429496729[0-5])$|^([0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]):([0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$` -type BGPStandardCommunity string - -// BGPWellKnownCommunity type represents a value of the "standard" 32-bit BGP Communities Attribute (RFC 1997) -// as a well-known string alias to its numeric value. Allowed values and their mapping to the numeric values: -// -// internet = 0x00000000 (0:0) -// planned-shut = 0xffff0000 (65535:0) -// accept-own = 0xffff0001 (65535:1) -// route-filter-translated-v4 = 0xffff0002 (65535:2) -// route-filter-v4 = 0xffff0003 (65535:3) -// route-filter-translated-v6 = 0xffff0004 (65535:4) -// route-filter-v6 = 0xffff0005 (65535:5) -// llgr-stale = 0xffff0006 (65535:6) -// no-llgr = 0xffff0007 (65535:7) -// blackhole = 0xffff029a (65535:666) -// no-export = 0xffffff01 (65535:65281) -// no-advertise = 0xffffff02 (65535:65282) -// no-export-subconfed = 0xffffff03 (65535:65283) -// no-peer = 0xffffff04 (65535:65284) -// -// +kubebuilder:validation:Enum=internet;planned-shut;accept-own;route-filter-translated-v4;route-filter-v4;route-filter-translated-v6;route-filter-v6;llgr-stale;no-llgr;blackhole;no-export;no-advertise;no-export-subconfed;no-peer -type BGPWellKnownCommunity string - -// BGPLargeCommunity type represents a value of the BGP Large Communities Attribute (RFC 8092), -// as three 4-byte decimal numbers separated by colons. -// +kubebuilder:validation:Pattern=`^([0-9]|[1-9][0-9]{1,8}|[1-3][0-9]{9}|4[01][0-9]{8}|42[0-8][0-9]{7}|429[0-3][0-9]{6}|4294[0-8][0-9]{5}|42949[0-5][0-9]{4}|429496[0-6][0-9]{3}|4294967[01][0-9]{2}|42949672[0-8][0-9]|429496729[0-5]):([0-9]|[1-9][0-9]{1,8}|[1-3][0-9]{9}|4[01][0-9]{8}|42[0-8][0-9]{7}|429[0-3][0-9]{6}|4294[0-8][0-9]{5}|42949[0-5][0-9]{4}|429496[0-6][0-9]{3}|4294967[01][0-9]{2}|42949672[0-8][0-9]|429496729[0-5]):([0-9]|[1-9][0-9]{1,8}|[1-3][0-9]{9}|4[01][0-9]{8}|42[0-8][0-9]{7}|429[0-3][0-9]{6}|4294[0-8][0-9]{5}|42949[0-5][0-9]{4}|429496[0-6][0-9]{3}|4294967[01][0-9]{2}|42949672[0-8][0-9]|429496729[0-5])$` -type BGPLargeCommunity string - -// BGPCommunities holds community values of the supported BGP community path attributes. -type BGPCommunities struct { - // Standard holds a list of "standard" 32-bit BGP Communities Attribute (RFC 1997) values defined as numeric values. - // - // +kubebuilder:validation:Optional - Standard []BGPStandardCommunity `json:"standard,omitempty"` - - // WellKnown holds a list "standard" 32-bit BGP Communities Attribute (RFC 1997) values defined as - // well-known string aliases to their numeric values. - // - // +kubebuilder:validation:Optional - WellKnown []BGPWellKnownCommunity `json:"wellKnown,omitempty"` - - // Large holds a list of the BGP Large Communities Attribute (RFC 8092) values. - // - // +kubebuilder:validation:Optional - Large []BGPLargeCommunity `json:"large,omitempty"` -} - -// CiliumBGPPathAttributes can be used to apply additional path attributes -// to matched routes when advertising them to a BGP peer. -type CiliumBGPPathAttributes struct { - // SelectorType defines the object type on which the Selector applies: - // - For "PodCIDR" the Selector matches k8s CiliumNode resources - // (path attributes apply to routes announced for PodCIDRs of selected CiliumNodes. - // Only affects routes of cluster scope / Kubernetes IPAM CIDRs, not Multi-Pool IPAM CIDRs. - // - For "CiliumLoadBalancerIPPool" the Selector matches CiliumLoadBalancerIPPool custom resources - // (path attributes apply to routes announced for selected CiliumLoadBalancerIPPools). - // - For "CiliumPodIPPool" the Selector matches CiliumPodIPPool custom resources - // (path attributes apply to routes announced for allocated CIDRs of selected CiliumPodIPPools). - // - // +kubebuilder:validation:Enum=PodCIDR;CiliumLoadBalancerIPPool;CiliumPodIPPool - // +kubebuilder:validation:Required - SelectorType string `json:"selectorType"` - - // Selector selects a group of objects of the SelectorType - // resulting into routes that will be announced with the configured Attributes. - // If nil / not set, all objects of the SelectorType are selected. - // - // +kubebuilder:validation:Optional - Selector *slimv1.LabelSelector `json:"selector,omitempty"` - - // Communities defines a set of community values advertised in the supported BGP Communities path attributes. - // If nil / not set, no BGP Communities path attribute will be advertised. - // - // +kubebuilder:validation:Optional - Communities *BGPCommunities `json:"communities,omitempty"` - - // LocalPreference defines the preference value advertised in the BGP Local Preference path attribute. - // As Local Preference is only valid for iBGP peers, this value will be ignored for eBGP peers - // (no Local Preference path attribute will be advertised). - // If nil / not set, the default Local Preference of 100 will be advertised in - // the Local Preference path attribute for iBGP peers. - // - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Minimum=0 - // +kubebuilder:validation:Maximum=4294967295 - LocalPreference *int64 `json:"localPreference,omitempty"` -} - -// CiliumBGPNeighbor is a neighboring peer for use in a -// CiliumBGPVirtualRouter configuration. -type CiliumBGPNeighbor struct { - // PeerAddress is the IP address of the peer. - // This must be in CIDR notation and use a /32 to express - // a single host. - // - // +kubebuilder:validation:Required - // +kubebuilder:validation:Format=cidr - PeerAddress string `json:"peerAddress"` - // PeerPort is the TCP port of the peer. 1-65535 is the range of - // valid port numbers that can be specified. If unset, defaults to 179. - // - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Minimum=1 - // +kubebuilder:validation:Maximum=65535 - // +kubebuilder:default=179 - PeerPort *int32 `json:"peerPort,omitempty"` - // PeerASN is the ASN of the peer BGP router. - // Supports extended 32bit ASNs - // - // +kubebuilder:validation:Required - // +kubebuilder:validation:Minimum=0 - // +kubebuilder:validation:Maximum=4294967295 - PeerASN int64 `json:"peerASN"` - // AuthSecretRef is the name of the secret to use to fetch a TCP - // authentication password for this peer. - // +kubebuilder:validation:Optional - AuthSecretRef *string `json:"authSecretRef,omitempty"` - // EBGPMultihopTTL controls the multi-hop feature for eBGP peers. - // Its value defines the Time To Live (TTL) value used in BGP packets sent to the neighbor. - // The value 1 implies that eBGP multi-hop feature is disabled (only a single hop is allowed). - // This field is ignored for iBGP peers. - // - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Minimum=1 - // +kubebuilder:validation:Maximum=255 - // +kubebuilder:default=1 - EBGPMultihopTTL *int32 `json:"eBGPMultihopTTL,omitempty"` - // ConnectRetryTimeSeconds defines the initial value for the BGP ConnectRetryTimer (RFC 4271, Section 8). - // - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Minimum=1 - // +kubebuilder:validation:Maximum=2147483647 - // +kubebuilder:default=120 - ConnectRetryTimeSeconds *int32 `json:"connectRetryTimeSeconds,omitempty"` - // HoldTimeSeconds defines the initial value for the BGP HoldTimer (RFC 4271, Section 4.2). - // Updating this value will cause a session reset. - // - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Minimum=3 - // +kubebuilder:validation:Maximum=65535 - // +kubebuilder:default=90 - HoldTimeSeconds *int32 `json:"holdTimeSeconds,omitempty"` - // KeepaliveTimeSeconds defines the initial value for the BGP KeepaliveTimer (RFC 4271, Section 8). - // It can not be larger than HoldTimeSeconds. Updating this value will cause a session reset. - // - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Minimum=1 - // +kubebuilder:validation:Maximum=65535 - // +kubebuilder:default=30 - KeepAliveTimeSeconds *int32 `json:"keepAliveTimeSeconds,omitempty"` - // GracefulRestart defines graceful restart parameters which are negotiated - // with this neighbor. If empty / nil, the graceful restart capability is disabled. - // - // +kubebuilder:validation:Optional - GracefulRestart *CiliumBGPNeighborGracefulRestart `json:"gracefulRestart,omitempty"` - // Families, if provided, defines a set of AFI/SAFIs the speaker will - // negotiate with it's peer. - // - // If this slice is not provided the default families of IPv6 and IPv4 will - // be provided. - // - // +kubebuilder:validation:Optional - Families []CiliumBGPFamily `json:"families"` - // AdvertisedPathAttributes can be used to apply additional path attributes - // to selected routes when advertising them to the peer. - // If empty / nil, no additional path attributes are advertised. - // - // +kubebuilder:validation:Optional - AdvertisedPathAttributes []CiliumBGPPathAttributes `json:"advertisedPathAttributes,omitempty"` -} - -// CiliumBGPVirtualRouter defines a discrete BGP virtual router configuration. -type CiliumBGPVirtualRouter struct { - // LocalASN is the ASN of this virtual router. - // Supports extended 32bit ASNs - // - // +kubebuilder:validation:Required - // +kubebuilder:validation:Minimum=0 - // +kubebuilder:validation:Maximum=4294967295 - LocalASN int64 `json:"localASN"` - // ExportPodCIDR determines whether to export the Node's private CIDR block - // to the configured neighbors. - // - // +kubebuilder:validation:Optional - // +kubebuilder:default=false - ExportPodCIDR *bool `json:"exportPodCIDR,omitempty"` - // PodIPPoolSelector selects CiliumPodIPPools based on labels. The virtual - // router will announce allocated CIDRs of matching CiliumPodIPPools. - // - // If empty / nil no CiliumPodIPPools will be announced. - // - // +kubebuilder:validation:Optional - PodIPPoolSelector *slimv1.LabelSelector `json:"podIPPoolSelector,omitempty"` - // ServiceSelector selects a group of load balancer services which this - // virtual router will announce. The loadBalancerClass for a service must - // be nil or specify a class supported by Cilium, e.g. "io.cilium/bgp-control-plane". - // Refer to the following document for additional details regarding load balancer - // classes: - // - // https://kubernetes.io/docs/concepts/services-networking/service/#load-balancer-class - // - // If empty / nil no services will be announced. - // - // +kubebuilder:validation:Optional - ServiceSelector *slimv1.LabelSelector `json:"serviceSelector,omitempty"` - // ServiceAdvertisements selects a group of BGP Advertisement(s) to advertise - // for the selected services. - // - // +kubebuilder:validation:Optional - // +kubebuilder:default={LoadBalancerIP} - ServiceAdvertisements []BGPServiceAddressType `json:"serviceAdvertisements,omitempty"` - // Neighbors is a list of neighboring BGP peers for this virtual router - // - // +kubebuilder:validation:Required - // +kubebuilder:validation:MinItems=1 - Neighbors []CiliumBGPNeighbor `json:"neighbors"` -} - -// SetDefaults applies default values on the CiliumBGPPeeringPolicy. -// This is normally done by kube-apiserver for fields with explicit static defaults, -// the main use of this method is to avoid the need for nil-checks in the controller code. -func (p *CiliumBGPPeeringPolicy) SetDefaults() { - for i := range p.Spec.VirtualRouters { - p.Spec.VirtualRouters[i].SetDefaults() - } -} - -// SetDefaults applies default values on the CiliumBGPVirtualRouter. -// This is normally done by kube-apiserver for fields with explicit static defaults, -// the main use of this method is to avoid the need for nil-checks in the controller code. -func (r *CiliumBGPVirtualRouter) SetDefaults() { - if r.ExportPodCIDR == nil { - r.ExportPodCIDR = pointer.Bool(DefaultBGPExportPodCIDR) - } - for i := range r.Neighbors { - r.Neighbors[i].SetDefaults() - } - - if r.ServiceAdvertisements == nil { - r.ServiceAdvertisements = []BGPServiceAddressType{BGPLoadBalancerIPAddr} - } -} - -// SetDefaults applies default values on the CiliumBGPNeighbor. -// This is normally done by kube-apiserver for fields with explicit static defaults, -// the main use of this method is to avoid the need for nil-checks in the controller code. -func (n *CiliumBGPNeighbor) SetDefaults() { - if n.PeerPort == nil || *n.PeerPort == 0 { - n.PeerPort = pointer.Int32(DefaultBGPPeerPort) - } - if n.EBGPMultihopTTL == nil { - n.EBGPMultihopTTL = pointer.Int32(DefaultBGPEBGPMultihopTTL) - } - if n.ConnectRetryTimeSeconds == nil || *n.ConnectRetryTimeSeconds == 0 { - n.ConnectRetryTimeSeconds = pointer.Int32(DefaultBGPConnectRetryTimeSeconds) - } - if n.HoldTimeSeconds == nil || *n.HoldTimeSeconds == 0 { - n.HoldTimeSeconds = pointer.Int32(DefaultBGPHoldTimeSeconds) - } - if n.KeepAliveTimeSeconds == nil || *n.KeepAliveTimeSeconds == 0 { - n.KeepAliveTimeSeconds = pointer.Int32(DefaultBGPKeepAliveTimeSeconds) - } - if n.GracefulRestart != nil && n.GracefulRestart.Enabled && - (n.GracefulRestart.RestartTimeSeconds == nil || *n.GracefulRestart.RestartTimeSeconds == 0) { - n.GracefulRestart.RestartTimeSeconds = pointer.Int32(DefaultBGPGRRestartTimeSeconds) - } - if len(n.Families) == 0 { - n.Families = []CiliumBGPFamily{ - { - Afi: "ipv4", - Safi: "unicast", - }, - { - Afi: "ipv6", - Safi: "unicast", - }, - } - } -} - -// Validate validates CiliumBGPNeighbor's configuration constraints -// that can not be expressed using the kubebuilder validation markers. -func (n *CiliumBGPNeighbor) Validate() error { - keepAliveTime := pointer.Int32Deref(n.KeepAliveTimeSeconds, DefaultBGPKeepAliveTimeSeconds) - holdTime := pointer.Int32Deref(n.HoldTimeSeconds, DefaultBGPHoldTimeSeconds) - if keepAliveTime > holdTime { - return fmt.Errorf("KeepAliveTimeSeconds larger than HoldTimeSeconds for peer ASN:%d IP:%s", n.PeerASN, n.PeerAddress) - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/cidrgroups_types.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/cidrgroups_types.go deleted file mode 100644 index 28bb78003..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/cidrgroups_types.go +++ /dev/null @@ -1,50 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v2alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - "github.com/cilium/cilium/pkg/policy/api" -) - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:categories={cilium},singular="ciliumcidrgroup",path="ciliumcidrgroups",scope="Cluster",shortName={ccg} -// +kubebuilder:object:root=true -// +kubebuilder:storageversion -// +deepequal-gen=false - -// CiliumCIDRGroup is a list of external CIDRs (i.e: CIDRs selecting peers -// outside the clusters) that can be referenced as a single entity from -// CiliumNetworkPolicies. -type CiliumCIDRGroup struct { - // +deepequal-gen=false - metav1.TypeMeta `json:",inline"` - // +deepequal-gen=false - metav1.ObjectMeta `json:"metadata,omitempty"` - - // +kubebuilder:validation:Required - Spec CiliumCIDRGroupSpec `json:"spec"` -} - -type CiliumCIDRGroupSpec struct { - // ExternalCIDRs is a list of CIDRs selecting peers outside the clusters. - // - // +kubebuilder:validation:Required - // +kubebuilder:validation:MinItems=0 - ExternalCIDRs []api.CIDR `json:"externalCIDRs"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +deepequal-gen=false - -type CiliumCIDRGroupList struct { - // +deepequal-gen=false - metav1.TypeMeta `json:",inline"` - // +deepequal-gen=false - metav1.ListMeta `json:"metadata,omitempty"` - Items []CiliumCIDRGroup `json:"items"` -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/cnc_types.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/cnc_types.go deleted file mode 100644 index 81a7e135e..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/cnc_types.go +++ /dev/null @@ -1,55 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v2alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -//+genclient -//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -//+kubebuilder:resource:categories={cilium} -//+kubebuilder:object:root=true -//+deepequal-gen=false -//+kubebuilder:storageversion - -// CiliumNodeConfig is a list of configuration key-value pairs. It is applied to -// nodes indicated by a label selector. -// -// If multiple overrides apply to the same node, they will be ordered by name -// with later Overrides overwriting any conflicting keys. -type CiliumNodeConfig struct { - // +deepequal-gen=false - metav1.TypeMeta `json:",inline"` - // +deepequal-gen=false - metav1.ObjectMeta `json:"metadata,omitempty"` - - // Spec is the desired Cilium configuration overrides for a given node - Spec CiliumNodeConfigSpec `json:"spec"` -} - -// +deepequal-gen=false -type CiliumNodeConfigSpec struct { - // Defaults is treated the same as the cilium-config ConfigMap - a set - // of key-value pairs parsed by the agent and operator processes. - // Each key must be a valid config-map data field (i.e. a-z, A-Z, -, _, and .) - Defaults map[string]string `json:"defaults"` - - // NodeSelector is a label selector that determines to which nodes - // this configuration applies. - // If not supplied, then this config applies to no nodes. If - // empty, then it applies to all nodes. - NodeSelector *metav1.LabelSelector `json:"nodeSelector"` -} - -//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -//+deepequal-gen=false - -type CiliumNodeConfigList struct { - // +deepequal-gen=false - metav1.TypeMeta `json:",inline"` - // +deepequal-gen=false - metav1.ListMeta `json:"metadata,omitempty"` - Items []CiliumNodeConfig `json:"items"` -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/doc.go deleted file mode 100644 index d90d9acc8..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/doc.go +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// +k8s:deepcopy-gen=package,register -// +k8s:openapi-gen=true -// +deepequal-gen=package - -// Package v2alpha1 is the v2alpha1 version of the API. -// +groupName=cilium.io -package v2alpha1 diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/ippool_types.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/ippool_types.go deleted file mode 100644 index a0e8792f2..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/ippool_types.go +++ /dev/null @@ -1,86 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v2alpha1 - -import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:categories={cilium},singular="ciliumpodippool",path="ciliumpodippools",scope="Cluster",shortName={cpip} -// +kubebuilder:object:root=true -// +kubebuilder:storageversion - -// CiliumPodIPPool defines an IP pool that can be used for pooled IPAM (i.e. the multi-pool IPAM -// mode). -type CiliumPodIPPool struct { - // +deepequal-gen=false - metav1.TypeMeta `json:",inline"` - // +deepequal-gen=false - metav1.ObjectMeta `json:"metadata,omitempty"` - - // +kubebuilder:validation:Required - Spec IPPoolSpec `json:"spec"` -} - -type IPPoolSpec struct { - // IPv4 specifies the IPv4 CIDRs and mask sizes of the pool - // - // +kubebuilder:validation:Optional - IPv4 *IPv4PoolSpec `json:"ipv4"` - - // IPv6 specifies the IPv6 CIDRs and mask sizes of the pool - // - // +kubebuilder:validation:Optional - IPv6 *IPv6PoolSpec `json:"ipv6"` -} - -type IPv4PoolSpec struct { - // CIDRs is a list of IPv4 CIDRs that are part of the pool. - // - // +kubebuilder:validation:Required - // +kubebuilder:validation:MinItems=1 - CIDRs []PoolCIDR `json:"cidrs"` - - // MaskSize is the mask size of the pool. - // - // +kubebuilder:validation:Required - // +kubebuilder:validation:Minimum=1 - // +kubebuilder:validation:Maximum=32 - // +kubebuilder:validation:ExclusiveMaximum=false - MaskSize uint8 `json:"maskSize"` -} - -type IPv6PoolSpec struct { - // CIDRs is a list of IPv6 CIDRs that are part of the pool. - // - // +kubebuilder:validation:Required - // +kubebuilder:validation:MinItems=1 - CIDRs []PoolCIDR `json:"cidrs"` - - // MaskSize is the mask size of the pool. - // - // +kubebuilder:validation:Required - // +kubebuilder:validation:Minimum=1 - // +kubebuilder:validation:Maximum=128 - // +kubebuilder:validation:ExclusiveMaximum=false - MaskSize uint8 `json:"maskSize"` -} - -// PoolCIDR is an IP pool CIDR. -// -// +kubebuilder:validation:Format=cidr -type PoolCIDR string - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +deepequal-gen=false - -// CiliumPodIPPoolList is a list of CiliumPodIPPool objects. -type CiliumPodIPPoolList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - - // Items is a list of CiliumPodIPPools. - Items []CiliumPodIPPool `json:"items"` -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/l2announcement_types.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/l2announcement_types.go deleted file mode 100644 index 717026045..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/l2announcement_types.go +++ /dev/null @@ -1,109 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v2alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - slimv1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" -) - -// L2AnnounceLoadBalancerClass defines the L2 Announcer load balancer class for Services. -const L2AnnounceLoadBalancerClass = "io.cilium/l2-announcer" - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:categories={cilium},singular="ciliuml2announcementpolicy",path="ciliuml2announcementpolicies",scope="Cluster",shortName={l2announcement} -// +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",name="Age",type=date -// +kubebuilder:subresource:status -// +kubebuilder:storageversion - -// CiliumL2AnnouncementPolicy is a Kubernetes third-party resource which -// is used to defined which nodes should announce what services on the -// L2 network. -type CiliumL2AnnouncementPolicy struct { - // +deepequal-gen=false - metav1.TypeMeta `json:",inline"` - // +deepequal-gen=false - metav1.ObjectMeta `json:"metadata"` - - // Spec is a human readable description of a L2 announcement policy - // - // +kubebuilder:validation:Optional - Spec CiliumL2AnnouncementPolicySpec `json:"spec,omitempty"` - - // Status is the status of the policy. - // - // +deepequal-gen=false - // +kubebuilder:validation:Optional - Status CiliumL2AnnouncementPolicyStatus `json:"status"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:openapi-gen=false -// +deepequal-gen=false - -// CiliumL2AnnouncementPolicyList is a list of -// CiliumL2AnnouncementPolicy objects. -type CiliumL2AnnouncementPolicyList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - // Items is a list of CiliumL2AnnouncementPolicies. - Items []CiliumL2AnnouncementPolicy `json:"items"` -} - -// +deepequal-gen=true - -// CiliumL2AnnouncementPolicySpec specifies which nodes should announce what -// services to the L2 networks attached to the given list of interfaces. -type CiliumL2AnnouncementPolicySpec struct { - // NodeSelector selects a group of nodes which will announce the IPs for - // the services selected by the service selector. - // - // If nil this policy applies to all nodes. - // - // +kubebuilder:validation:Optional - NodeSelector *slimv1.LabelSelector `json:"nodeSelector"` - // ServiceSelector selects a set of services which will be announced over L2 networks. - // The loadBalancerClass for a service must be nil or specify a supported class, e.g. - // "io.cilium/l2-announcer". Refer to the following document for additional details - // regarding load balancer classes: - // - // https://kubernetes.io/docs/concepts/services-networking/service/#load-balancer-class - // - // If nil this policy applies to all services. - // - // +kubebuilder:validation:Optional - ServiceSelector *slimv1.LabelSelector `json:"serviceSelector"` - // If true, the loadbalancer IPs of the services are announced - // - // If nil this policy applies to all services. - // - // +kubebuilder:validation:Optional - LoadBalancerIPs bool `json:"loadBalancerIPs"` - // If true, the external IPs of the services are announced - // - // +kubebuilder:validation:Optional - ExternalIPs bool `json:"externalIPs"` - // A list of regular expressions that express which network interface(s) should be used - // to announce the services over. If nil, all network interfaces are used. - // - // +kubebuilder:validation:Optional - Interfaces []string `json:"interfaces"` -} - -// +deepequal-gen=false - -// CiliumL2AnnouncementPolicyStatus contains the status of a CiliumL2AnnouncementPolicy. -type CiliumL2AnnouncementPolicyStatus struct { - // Current service state - // +optional - // +patchMergeKey=type - // +patchStrategy=merge - // +listType=map - // +listMapKey=type - Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/lbipam_types.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/lbipam_types.go deleted file mode 100644 index 95d5414f7..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/lbipam_types.go +++ /dev/null @@ -1,126 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v2alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - slimv1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" -) - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:categories={cilium},singular="ciliumloadbalancerippool",path="ciliumloadbalancerippools",scope="Cluster",shortName={ippools,ippool,lbippool,lbippools} -// +kubebuilder:printcolumn:JSONPath=".spec.disabled",name="Disabled",type=boolean -// +kubebuilder:printcolumn:name="Conflicting",type=string,JSONPath=`.status.conditions[?(@.type=="cilium.io/PoolConflict")].status` -// +kubebuilder:printcolumn:name="IPs Available",type=string,JSONPath=`.status.conditions[?(@.type=="cilium.io/IPsAvailable")].message` -// +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",name="Age",type=date -// +kubebuilder:subresource:status -// +kubebuilder:storageversion - -// CiliumLoadBalancerIPPool is a Kubernetes third-party resource which -// is used to defined pools of IPs which the operator can use to to allocate -// and advertise IPs for Services of type LoadBalancer. -type CiliumLoadBalancerIPPool struct { - // +deepequal-gen=false - metav1.TypeMeta `json:",inline"` - // +deepequal-gen=false - metav1.ObjectMeta `json:"metadata"` - - // Spec is a human readable description for a BGP load balancer - // ip pool. - // - // +kubebuilder:validation:Required - Spec CiliumLoadBalancerIPPoolSpec `json:"spec,omitempty"` - - // Status is the status of the IP Pool. - // - // It might be possible for users to define overlapping IP Pools, we can't validate or enforce non-overlapping pools - // during object creation. The Cilium operator will do this validation and update the status to reflect the ability - // to allocate IPs from this pool. - // - // +deepequal-gen=false - // +kubebuilder:validation:Optional - Status CiliumLoadBalancerIPPoolStatus `json:"status"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:openapi-gen=false -// +deepequal-gen=false - -// CiliumLoadBalancerIPPoolList is a list of -// CiliumLoadBalancerIPPool objects. -type CiliumLoadBalancerIPPoolList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - // Items is a list of CiliumBGPLoadBalancerIPPools. - Items []CiliumLoadBalancerIPPool `json:"items"` -} - -// +deepequal-gen=true - -// CiliumLoadBalancerIPPoolSpec is a human readable description for -// a load balancer IP pool. -type CiliumLoadBalancerIPPoolSpec struct { - // ServiceSelector selects a set of services which are eligible to receive IPs from this - // - // +kubebuilder:validation:Optional - ServiceSelector *slimv1.LabelSelector `json:"serviceSelector"` - // AllowFirstLastIPs, if set to `yes` means that the first and last IPs of each CIDR will be allocatable. - // If `no` or undefined, these IPs will be reserved. This field is ignored for /{31,32} and /{127,128} CIDRs since - // reserving the first and last IPs would make the CIDRs unusable. - // - // +kubebuilder:validation:Optional - AllowFirstLastIPs AllowFirstLastIPType `json:"allowFirstLastIPs,omitempty"` - // Cidrs is a list of CIDRs comprising this IP Pool - // Deprecated: please use the `blocks` field instead. This field will be removed in a future release. - // https://github.com/cilium/cilium/issues/28590 - // - // +kubebuilder:validation:Optional - Cidrs []CiliumLoadBalancerIPPoolIPBlock `json:"cidrs,omitempty"` - // Blocks is a list of CIDRs comprising this IP Pool - // - // +kubebuilder:validation:Optional - Blocks []CiliumLoadBalancerIPPoolIPBlock `json:"blocks,omitempty"` - // Disabled, if set to true means that no new IPs will be allocated from this pool. - // Existing allocations will not be removed from services. - // - // +kubebuilder:validation:Optional - // +kubebuilder:default=false - Disabled bool `json:"disabled"` -} - -// +kubebuilder:validation:Enum=Yes;No -type AllowFirstLastIPType string - -const ( - AllowFirstLastIPNo AllowFirstLastIPType = "No" - AllowFirstLastIPYes AllowFirstLastIPType = "Yes" -) - -// CiliumLoadBalancerIPPoolIPBlock describes a single IP block. -type CiliumLoadBalancerIPPoolIPBlock struct { - // +kubebuilder:validation:Format=cidr - // +kubebuilder:validation:Optional - Cidr IPv4orIPv6CIDR `json:"cidr"` - // +kubebuilder:validation:Optional - Start string `json:"start,omitempty"` - // +kubebuilder:validation:Optional - Stop string `json:"stop,omitempty"` -} - -// +deepequal-gen=false - -// CiliumLoadBalancerIPPoolStatus contains the status of a CiliumLoadBalancerIPPool. -type CiliumLoadBalancerIPPoolStatus struct { - // Current service state - // +optional - // +patchMergeKey=type - // +patchStrategy=merge - // +listType=map - // +listMapKey=type - Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/register.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/register.go deleted file mode 100644 index 54d7f9014..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/register.go +++ /dev/null @@ -1,180 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v2alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - - k8sconst "github.com/cilium/cilium/pkg/k8s/apis/cilium.io" -) - -const ( - // CustomResourceDefinitionGroup is the name of the third party resource group - CustomResourceDefinitionGroup = k8sconst.CustomResourceDefinitionGroup - - // CustomResourceDefinitionVersion is the current version of the resource - CustomResourceDefinitionVersion = "v2alpha1" - - // Cilium Endpoint Slice (CES) - - // CESPluralName is the plural name of Cilium Endpoint Slice - CESPluralName = "ciliumendpointslices" - - // CESKindDefinition is the kind name of Cilium Endpoint Slice - CESKindDefinition = "CiliumEndpointSlice" - - // CESName is the full name of Cilium Endpoint Slice - CESName = CESPluralName + "." + CustomResourceDefinitionGroup - - // Cilium BGP Peering Policy (BGPP) - - // BGPPPluralName is the plural name of Cilium BGP Peering Policy - BGPPPluralName = "ciliumbgppeeringpolicies" - - // BGPPKindDefinition is the kind name of Cilium BGP Peering Policy - BGPPKindDefinition = "CiliumBGPPeeringPolicy" - - // BGPPName is the full name of Cilium BGP Peering Policy - BGPPName = BGPPPluralName + "." + CustomResourceDefinitionGroup - - // BGPClusterConfig (BGPCC) - BGPCCPluralName = "ciliumbgpclusterconfigs" - BGPCCKindDefinition = "CiliumBGPClusterConfig" - BGPCCName = BGPCCPluralName + "." + CustomResourceDefinitionGroup - - // BGPPeerConfig (BGPPC) - BGPPCPluralName = "ciliumbgppeerconfigs" - BGPPCKindDefinition = "CiliumBGPPeerConfig" - BGPPCName = BGPPCPluralName + "." + CustomResourceDefinitionGroup - - // BGPAdvertisement (BGPA) - BGPAPluralName = "ciliumbgpadvertisements" - BGPAKindDefinition = "CiliumBGPAdvertisement" - BGPAName = BGPAPluralName + "." + CustomResourceDefinitionGroup - - // BGPNodeConfig (BGPNC) - BGPNCPluralName = "ciliumbgpnodeconfigs" - BGPNCKindDefinition = "CiliumBGPNodeConfig" - BGPNCName = BGPNCPluralName + "." + CustomResourceDefinitionGroup - - // BGPNodeConfigOverride (BGPNCO) - BGPNCOPluralName = "ciliumbgpnodeconfigoverrides" - BGPNCOKindDefinition = "CiliumBGPNodeConfigOverride" - BGPNCOName = BGPNCOPluralName + "." + CustomResourceDefinitionGroup - - // Cilium Load Balancer IP Pool (IPPool) - - // PoolPluralName is the plural name of Cilium Load Balancer IP Pool - PoolPluralName = "ciliumloadbalancerippools" - - // PoolKindDefinition is the kind name of Cilium Peering Policy - PoolKindDefinition = "CiliumLoadBalancerIPPool" - - // LBIPPoolName is the full name of Cilium Load Balancer IP Pool - LBIPPoolName = PoolPluralName + "." + CustomResourceDefinitionGroup - - // CiliumNodeConfig (CNC) - CNCPluralName = "ciliumnodeconfigs" - CNCKindDefinition = "CiliumNodeConfig" - CNCName = CNCPluralName + "." + CustomResourceDefinitionGroup - - // CiliumCIDRGroup (CCG) - CCGPluralName = "ciliumcidrgroups" - CCGKindDefinition = "CiliumCIDRGroup" - CCGName = CCGPluralName + "." + CustomResourceDefinitionGroup - - // Cilium L2 Announcement policy - - // L2AnnouncementSingularName is the singular name ofCilium L2 announcement policy - L2AnnouncementSingularName = "ciliuml2announcementpolicy" - - // L2AnnouncementPluralName is the plural name of Cilium L2 announcement policy - L2AnnouncementPluralName = "ciliuml2announcementpolicies" - - // L2AnnouncementKindDefinition is the kind name of Cilium L2 announcement policy - L2AnnouncementKindDefinition = "CiliumL2AnnouncementPolicy" - - // L2AnnouncementName is the full name of Cilium L2 announcement policy - L2AnnouncementName = L2AnnouncementPluralName + "." + CustomResourceDefinitionGroup - - // CiliumPodIPPool (CPIP) - CPIPPluralName = "ciliumpodippools" - CPIPKindDefinition = "CiliumPodIPPool" - CPIPName = CPIPPluralName + "." + CustomResourceDefinitionGroup -) - -// SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{ - Group: CustomResourceDefinitionGroup, - Version: CustomResourceDefinitionVersion, -} - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -var ( - // SchemeBuilder is needed by DeepCopy generator. - SchemeBuilder runtime.SchemeBuilder - // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. - localSchemeBuilder = &SchemeBuilder - - // AddToScheme adds all types of this clientset into the given scheme. - // This allows composition of clientsets, like in: - // - // import ( - // "k8s.io/client-go/kubernetes" - // clientsetscheme "k8s.io/client-go/kubernetes/scheme" - // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" - // ) - // - // kclientset, _ := kubernetes.NewForConfig(c) - // aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) - AddToScheme = localSchemeBuilder.AddToScheme -) - -func init() { - // We only register manually written functions here. The registration of the - // generated functions takes place in the generated files. The separation - // makes the code compile even when the generated files are missing. - localSchemeBuilder.Register(addKnownTypes) -} - -// Adds the list of known types to api.Scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &CiliumEndpointSlice{}, - &CiliumEndpointSliceList{}, - &CiliumBGPPeeringPolicy{}, - &CiliumBGPPeeringPolicyList{}, - &CiliumLoadBalancerIPPool{}, - &CiliumLoadBalancerIPPoolList{}, - &CiliumNodeConfig{}, - &CiliumNodeConfigList{}, - &CiliumCIDRGroup{}, - &CiliumCIDRGroupList{}, - &CiliumL2AnnouncementPolicy{}, - &CiliumL2AnnouncementPolicyList{}, - &CiliumPodIPPool{}, - &CiliumPodIPPoolList{}, - - // new BGP types - &CiliumBGPClusterConfig{}, - &CiliumBGPClusterConfigList{}, - &CiliumBGPPeerConfig{}, - &CiliumBGPPeerConfigList{}, - &CiliumBGPAdvertisement{}, - &CiliumBGPAdvertisementList{}, - &CiliumBGPNodeConfig{}, - &CiliumBGPNodeConfigList{}, - &CiliumBGPNodeConfigOverride{}, - &CiliumBGPNodeConfigOverrideList{}, - ) - - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/types.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/types.go deleted file mode 100644 index df388cc5c..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/types.go +++ /dev/null @@ -1,77 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v2alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - "github.com/cilium/cilium/api/v1/models" - cilium_v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - slimv1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" -) - -// +kubebuilder:validation:Format=cidr -type IPv4orIPv6CIDR string - -type EgressRule struct { - // Selects Namespaces using cluster-scoped labels. This field follows standard label - // selector semantics; if present but empty, it selects all namespaces. - NamespaceSelector *slimv1.LabelSelector `json:"namespaceSelector,omitempty"` - - // This is a label selector which selects Pods. This field follows standard label - // selector semantics; if present but empty, it selects all pods. - PodSelector *slimv1.LabelSelector `json:"podSelector,omitempty"` -} - -// CoreCiliumEndpoint is slim version of status of CiliumEndpoint. -type CoreCiliumEndpoint struct { - // Name indicate as CiliumEndpoint name. - Name string `json:"name,omitempty"` - // IdentityID is the numeric identity of the endpoint - IdentityID int64 `json:"id,omitempty"` - // Networking is the networking properties of the endpoint. - - // +kubebuilder:validation:Optional - Networking *cilium_v2.EndpointNetworking `json:"networking,omitempty"` - // Encryption is the encryption configuration of the node - - // +kubebuilder:validation:Optional - Encryption cilium_v2.EncryptionSpec `json:"encryption,omitempty"` - NamedPorts models.NamedPorts `json:"named-ports,omitempty"` -} - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:categories={cilium},singular="ciliumendpointslice",path="ciliumendpointslices",scope="Cluster",shortName={ces} -// +kubebuilder:storageversion - -// CiliumEndpointSlice contains a group of CoreCiliumendpoints. -type CiliumEndpointSlice struct { - // +deepequal-gen=false - metav1.TypeMeta `json:",inline"` - // +deepequal-gen=false - metav1.ObjectMeta `json:"metadata"` - - // Namespace indicate as CiliumEndpointSlice namespace. - // All the CiliumEndpoints within the same namespace are put together - // in CiliumEndpointSlice. - Namespace string `json:"namespace,omitempty"` - - // Endpoints is a list of coreCEPs packed in a CiliumEndpointSlice - Endpoints []CoreCiliumEndpoint `json:"endpoints"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:openapi-gen=false -// +deepequal-gen=false - -// CiliumEndpointSliceList is a list of CiliumEndpointSlice objects. -type CiliumEndpointSliceList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - // Items is a list of CiliumEndpointSlice. - Items []CiliumEndpointSlice `json:"items"` -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/zz_generated.deepcopy.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/zz_generated.deepcopy.go deleted file mode 100644 index eff3945de..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,1913 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - models "github.com/cilium/cilium/api/v1/models" - v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" - api "github.com/cilium/cilium/pkg/policy/api" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BGPAdvertisement) DeepCopyInto(out *BGPAdvertisement) { - *out = *in - if in.Service != nil { - in, out := &in.Service, &out.Service - *out = new(BGPServiceOptions) - (*in).DeepCopyInto(*out) - } - if in.Selector != nil { - in, out := &in.Selector, &out.Selector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - if in.Attributes != nil { - in, out := &in.Attributes, &out.Attributes - *out = new(BGPAttributes) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPAdvertisement. -func (in *BGPAdvertisement) DeepCopy() *BGPAdvertisement { - if in == nil { - return nil - } - out := new(BGPAdvertisement) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BGPAttributes) DeepCopyInto(out *BGPAttributes) { - *out = *in - if in.Communities != nil { - in, out := &in.Communities, &out.Communities - *out = new(BGPCommunities) - (*in).DeepCopyInto(*out) - } - if in.LocalPreference != nil { - in, out := &in.LocalPreference, &out.LocalPreference - *out = new(int64) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPAttributes. -func (in *BGPAttributes) DeepCopy() *BGPAttributes { - if in == nil { - return nil - } - out := new(BGPAttributes) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BGPCommunities) DeepCopyInto(out *BGPCommunities) { - *out = *in - if in.Standard != nil { - in, out := &in.Standard, &out.Standard - *out = make([]BGPStandardCommunity, len(*in)) - copy(*out, *in) - } - if in.WellKnown != nil { - in, out := &in.WellKnown, &out.WellKnown - *out = make([]BGPWellKnownCommunity, len(*in)) - copy(*out, *in) - } - if in.Large != nil { - in, out := &in.Large, &out.Large - *out = make([]BGPLargeCommunity, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPCommunities. -func (in *BGPCommunities) DeepCopy() *BGPCommunities { - if in == nil { - return nil - } - out := new(BGPCommunities) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BGPServiceOptions) DeepCopyInto(out *BGPServiceOptions) { - *out = *in - if in.Addresses != nil { - in, out := &in.Addresses, &out.Addresses - *out = make([]BGPServiceAddressType, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPServiceOptions. -func (in *BGPServiceOptions) DeepCopy() *BGPServiceOptions { - if in == nil { - return nil - } - out := new(BGPServiceOptions) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPAdvertisement) DeepCopyInto(out *CiliumBGPAdvertisement) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPAdvertisement. -func (in *CiliumBGPAdvertisement) DeepCopy() *CiliumBGPAdvertisement { - if in == nil { - return nil - } - out := new(CiliumBGPAdvertisement) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumBGPAdvertisement) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPAdvertisementList) DeepCopyInto(out *CiliumBGPAdvertisementList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CiliumBGPAdvertisement, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPAdvertisementList. -func (in *CiliumBGPAdvertisementList) DeepCopy() *CiliumBGPAdvertisementList { - if in == nil { - return nil - } - out := new(CiliumBGPAdvertisementList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumBGPAdvertisementList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPAdvertisementSpec) DeepCopyInto(out *CiliumBGPAdvertisementSpec) { - *out = *in - if in.Advertisements != nil { - in, out := &in.Advertisements, &out.Advertisements - *out = make([]BGPAdvertisement, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPAdvertisementSpec. -func (in *CiliumBGPAdvertisementSpec) DeepCopy() *CiliumBGPAdvertisementSpec { - if in == nil { - return nil - } - out := new(CiliumBGPAdvertisementSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPClusterConfig) DeepCopyInto(out *CiliumBGPClusterConfig) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPClusterConfig. -func (in *CiliumBGPClusterConfig) DeepCopy() *CiliumBGPClusterConfig { - if in == nil { - return nil - } - out := new(CiliumBGPClusterConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumBGPClusterConfig) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPClusterConfigList) DeepCopyInto(out *CiliumBGPClusterConfigList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CiliumBGPClusterConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPClusterConfigList. -func (in *CiliumBGPClusterConfigList) DeepCopy() *CiliumBGPClusterConfigList { - if in == nil { - return nil - } - out := new(CiliumBGPClusterConfigList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumBGPClusterConfigList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPClusterConfigSpec) DeepCopyInto(out *CiliumBGPClusterConfigSpec) { - *out = *in - if in.NodeSelector != nil { - in, out := &in.NodeSelector, &out.NodeSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - if in.BGPInstances != nil { - in, out := &in.BGPInstances, &out.BGPInstances - *out = make([]CiliumBGPInstance, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPClusterConfigSpec. -func (in *CiliumBGPClusterConfigSpec) DeepCopy() *CiliumBGPClusterConfigSpec { - if in == nil { - return nil - } - out := new(CiliumBGPClusterConfigSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPFamily) DeepCopyInto(out *CiliumBGPFamily) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPFamily. -func (in *CiliumBGPFamily) DeepCopy() *CiliumBGPFamily { - if in == nil { - return nil - } - out := new(CiliumBGPFamily) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPFamilyWithAdverts) DeepCopyInto(out *CiliumBGPFamilyWithAdverts) { - *out = *in - out.CiliumBGPFamily = in.CiliumBGPFamily - if in.Advertisements != nil { - in, out := &in.Advertisements, &out.Advertisements - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPFamilyWithAdverts. -func (in *CiliumBGPFamilyWithAdverts) DeepCopy() *CiliumBGPFamilyWithAdverts { - if in == nil { - return nil - } - out := new(CiliumBGPFamilyWithAdverts) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPInstance) DeepCopyInto(out *CiliumBGPInstance) { - *out = *in - if in.LocalASN != nil { - in, out := &in.LocalASN, &out.LocalASN - *out = new(int64) - **out = **in - } - if in.Peers != nil { - in, out := &in.Peers, &out.Peers - *out = make([]CiliumBGPPeer, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPInstance. -func (in *CiliumBGPInstance) DeepCopy() *CiliumBGPInstance { - if in == nil { - return nil - } - out := new(CiliumBGPInstance) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPNeighbor) DeepCopyInto(out *CiliumBGPNeighbor) { - *out = *in - if in.PeerPort != nil { - in, out := &in.PeerPort, &out.PeerPort - *out = new(int32) - **out = **in - } - if in.AuthSecretRef != nil { - in, out := &in.AuthSecretRef, &out.AuthSecretRef - *out = new(string) - **out = **in - } - if in.EBGPMultihopTTL != nil { - in, out := &in.EBGPMultihopTTL, &out.EBGPMultihopTTL - *out = new(int32) - **out = **in - } - if in.ConnectRetryTimeSeconds != nil { - in, out := &in.ConnectRetryTimeSeconds, &out.ConnectRetryTimeSeconds - *out = new(int32) - **out = **in - } - if in.HoldTimeSeconds != nil { - in, out := &in.HoldTimeSeconds, &out.HoldTimeSeconds - *out = new(int32) - **out = **in - } - if in.KeepAliveTimeSeconds != nil { - in, out := &in.KeepAliveTimeSeconds, &out.KeepAliveTimeSeconds - *out = new(int32) - **out = **in - } - if in.GracefulRestart != nil { - in, out := &in.GracefulRestart, &out.GracefulRestart - *out = new(CiliumBGPNeighborGracefulRestart) - (*in).DeepCopyInto(*out) - } - if in.Families != nil { - in, out := &in.Families, &out.Families - *out = make([]CiliumBGPFamily, len(*in)) - copy(*out, *in) - } - if in.AdvertisedPathAttributes != nil { - in, out := &in.AdvertisedPathAttributes, &out.AdvertisedPathAttributes - *out = make([]CiliumBGPPathAttributes, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPNeighbor. -func (in *CiliumBGPNeighbor) DeepCopy() *CiliumBGPNeighbor { - if in == nil { - return nil - } - out := new(CiliumBGPNeighbor) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPNeighborGracefulRestart) DeepCopyInto(out *CiliumBGPNeighborGracefulRestart) { - *out = *in - if in.RestartTimeSeconds != nil { - in, out := &in.RestartTimeSeconds, &out.RestartTimeSeconds - *out = new(int32) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPNeighborGracefulRestart. -func (in *CiliumBGPNeighborGracefulRestart) DeepCopy() *CiliumBGPNeighborGracefulRestart { - if in == nil { - return nil - } - out := new(CiliumBGPNeighborGracefulRestart) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPNodeConfig) DeepCopyInto(out *CiliumBGPNodeConfig) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPNodeConfig. -func (in *CiliumBGPNodeConfig) DeepCopy() *CiliumBGPNodeConfig { - if in == nil { - return nil - } - out := new(CiliumBGPNodeConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumBGPNodeConfig) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPNodeConfigInstanceOverride) DeepCopyInto(out *CiliumBGPNodeConfigInstanceOverride) { - *out = *in - if in.RouterID != nil { - in, out := &in.RouterID, &out.RouterID - *out = new(string) - **out = **in - } - if in.LocalPort != nil { - in, out := &in.LocalPort, &out.LocalPort - *out = new(int32) - **out = **in - } - if in.Peers != nil { - in, out := &in.Peers, &out.Peers - *out = make([]CiliumBGPNodeConfigPeerOverride, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPNodeConfigInstanceOverride. -func (in *CiliumBGPNodeConfigInstanceOverride) DeepCopy() *CiliumBGPNodeConfigInstanceOverride { - if in == nil { - return nil - } - out := new(CiliumBGPNodeConfigInstanceOverride) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPNodeConfigList) DeepCopyInto(out *CiliumBGPNodeConfigList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CiliumBGPNodeConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPNodeConfigList. -func (in *CiliumBGPNodeConfigList) DeepCopy() *CiliumBGPNodeConfigList { - if in == nil { - return nil - } - out := new(CiliumBGPNodeConfigList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumBGPNodeConfigList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPNodeConfigOverride) DeepCopyInto(out *CiliumBGPNodeConfigOverride) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPNodeConfigOverride. -func (in *CiliumBGPNodeConfigOverride) DeepCopy() *CiliumBGPNodeConfigOverride { - if in == nil { - return nil - } - out := new(CiliumBGPNodeConfigOverride) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumBGPNodeConfigOverride) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPNodeConfigOverrideList) DeepCopyInto(out *CiliumBGPNodeConfigOverrideList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CiliumBGPNodeConfigOverride, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPNodeConfigOverrideList. -func (in *CiliumBGPNodeConfigOverrideList) DeepCopy() *CiliumBGPNodeConfigOverrideList { - if in == nil { - return nil - } - out := new(CiliumBGPNodeConfigOverrideList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumBGPNodeConfigOverrideList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPNodeConfigOverrideSpec) DeepCopyInto(out *CiliumBGPNodeConfigOverrideSpec) { - *out = *in - if in.BGPInstances != nil { - in, out := &in.BGPInstances, &out.BGPInstances - *out = make([]CiliumBGPNodeConfigInstanceOverride, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPNodeConfigOverrideSpec. -func (in *CiliumBGPNodeConfigOverrideSpec) DeepCopy() *CiliumBGPNodeConfigOverrideSpec { - if in == nil { - return nil - } - out := new(CiliumBGPNodeConfigOverrideSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPNodeConfigPeerOverride) DeepCopyInto(out *CiliumBGPNodeConfigPeerOverride) { - *out = *in - if in.LocalAddress != nil { - in, out := &in.LocalAddress, &out.LocalAddress - *out = new(string) - **out = **in - } - if in.LocalPort != nil { - in, out := &in.LocalPort, &out.LocalPort - *out = new(int32) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPNodeConfigPeerOverride. -func (in *CiliumBGPNodeConfigPeerOverride) DeepCopy() *CiliumBGPNodeConfigPeerOverride { - if in == nil { - return nil - } - out := new(CiliumBGPNodeConfigPeerOverride) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPNodeInstance) DeepCopyInto(out *CiliumBGPNodeInstance) { - *out = *in - if in.LocalASN != nil { - in, out := &in.LocalASN, &out.LocalASN - *out = new(int64) - **out = **in - } - if in.RouterID != nil { - in, out := &in.RouterID, &out.RouterID - *out = new(string) - **out = **in - } - if in.LocalPort != nil { - in, out := &in.LocalPort, &out.LocalPort - *out = new(int32) - **out = **in - } - if in.Peers != nil { - in, out := &in.Peers, &out.Peers - *out = make([]CiliumBGPNodePeer, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPNodeInstance. -func (in *CiliumBGPNodeInstance) DeepCopy() *CiliumBGPNodeInstance { - if in == nil { - return nil - } - out := new(CiliumBGPNodeInstance) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPNodeInstanceStatus) DeepCopyInto(out *CiliumBGPNodeInstanceStatus) { - *out = *in - if in.LocalASN != nil { - in, out := &in.LocalASN, &out.LocalASN - *out = new(int64) - **out = **in - } - if in.PeerStatuses != nil { - in, out := &in.PeerStatuses, &out.PeerStatuses - *out = make([]CiliumBGPNodePeerStatus, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPNodeInstanceStatus. -func (in *CiliumBGPNodeInstanceStatus) DeepCopy() *CiliumBGPNodeInstanceStatus { - if in == nil { - return nil - } - out := new(CiliumBGPNodeInstanceStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPNodePeer) DeepCopyInto(out *CiliumBGPNodePeer) { - *out = *in - if in.PeerAddress != nil { - in, out := &in.PeerAddress, &out.PeerAddress - *out = new(string) - **out = **in - } - if in.PeerASN != nil { - in, out := &in.PeerASN, &out.PeerASN - *out = new(int64) - **out = **in - } - if in.LocalAddress != nil { - in, out := &in.LocalAddress, &out.LocalAddress - *out = new(string) - **out = **in - } - if in.PeerConfigRef != nil { - in, out := &in.PeerConfigRef, &out.PeerConfigRef - *out = new(PeerConfigReference) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPNodePeer. -func (in *CiliumBGPNodePeer) DeepCopy() *CiliumBGPNodePeer { - if in == nil { - return nil - } - out := new(CiliumBGPNodePeer) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPNodePeerStatus) DeepCopyInto(out *CiliumBGPNodePeerStatus) { - *out = *in - if in.PeerASN != nil { - in, out := &in.PeerASN, &out.PeerASN - *out = new(int64) - **out = **in - } - if in.PeeringState != nil { - in, out := &in.PeeringState, &out.PeeringState - *out = new(string) - **out = **in - } - if in.Timers != nil { - in, out := &in.Timers, &out.Timers - *out = new(CiliumBGPTimersState) - (*in).DeepCopyInto(*out) - } - if in.Uptime != nil { - in, out := &in.Uptime, &out.Uptime - *out = new(string) - **out = **in - } - if in.RoutesReceived != nil { - in, out := &in.RoutesReceived, &out.RoutesReceived - *out = new(int32) - **out = **in - } - if in.RoutesAdvertised != nil { - in, out := &in.RoutesAdvertised, &out.RoutesAdvertised - *out = new(int32) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPNodePeerStatus. -func (in *CiliumBGPNodePeerStatus) DeepCopy() *CiliumBGPNodePeerStatus { - if in == nil { - return nil - } - out := new(CiliumBGPNodePeerStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPNodeSpec) DeepCopyInto(out *CiliumBGPNodeSpec) { - *out = *in - if in.BGPInstances != nil { - in, out := &in.BGPInstances, &out.BGPInstances - *out = make([]CiliumBGPNodeInstance, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPNodeSpec. -func (in *CiliumBGPNodeSpec) DeepCopy() *CiliumBGPNodeSpec { - if in == nil { - return nil - } - out := new(CiliumBGPNodeSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPNodeStatus) DeepCopyInto(out *CiliumBGPNodeStatus) { - *out = *in - if in.BGPInstances != nil { - in, out := &in.BGPInstances, &out.BGPInstances - *out = make([]CiliumBGPNodeInstanceStatus, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPNodeStatus. -func (in *CiliumBGPNodeStatus) DeepCopy() *CiliumBGPNodeStatus { - if in == nil { - return nil - } - out := new(CiliumBGPNodeStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPPathAttributes) DeepCopyInto(out *CiliumBGPPathAttributes) { - *out = *in - if in.Selector != nil { - in, out := &in.Selector, &out.Selector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - if in.Communities != nil { - in, out := &in.Communities, &out.Communities - *out = new(BGPCommunities) - (*in).DeepCopyInto(*out) - } - if in.LocalPreference != nil { - in, out := &in.LocalPreference, &out.LocalPreference - *out = new(int64) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPPathAttributes. -func (in *CiliumBGPPathAttributes) DeepCopy() *CiliumBGPPathAttributes { - if in == nil { - return nil - } - out := new(CiliumBGPPathAttributes) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPPeer) DeepCopyInto(out *CiliumBGPPeer) { - *out = *in - if in.PeerAddress != nil { - in, out := &in.PeerAddress, &out.PeerAddress - *out = new(string) - **out = **in - } - if in.PeerASN != nil { - in, out := &in.PeerASN, &out.PeerASN - *out = new(int64) - **out = **in - } - if in.PeerConfigRef != nil { - in, out := &in.PeerConfigRef, &out.PeerConfigRef - *out = new(PeerConfigReference) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPPeer. -func (in *CiliumBGPPeer) DeepCopy() *CiliumBGPPeer { - if in == nil { - return nil - } - out := new(CiliumBGPPeer) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPPeerConfig) DeepCopyInto(out *CiliumBGPPeerConfig) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPPeerConfig. -func (in *CiliumBGPPeerConfig) DeepCopy() *CiliumBGPPeerConfig { - if in == nil { - return nil - } - out := new(CiliumBGPPeerConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumBGPPeerConfig) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPPeerConfigList) DeepCopyInto(out *CiliumBGPPeerConfigList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CiliumBGPPeerConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPPeerConfigList. -func (in *CiliumBGPPeerConfigList) DeepCopy() *CiliumBGPPeerConfigList { - if in == nil { - return nil - } - out := new(CiliumBGPPeerConfigList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumBGPPeerConfigList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPPeerConfigSpec) DeepCopyInto(out *CiliumBGPPeerConfigSpec) { - *out = *in - if in.Transport != nil { - in, out := &in.Transport, &out.Transport - *out = new(CiliumBGPTransport) - (*in).DeepCopyInto(*out) - } - if in.Timers != nil { - in, out := &in.Timers, &out.Timers - *out = new(CiliumBGPTimers) - (*in).DeepCopyInto(*out) - } - if in.AuthSecretRef != nil { - in, out := &in.AuthSecretRef, &out.AuthSecretRef - *out = new(string) - **out = **in - } - if in.GracefulRestart != nil { - in, out := &in.GracefulRestart, &out.GracefulRestart - *out = new(CiliumBGPNeighborGracefulRestart) - (*in).DeepCopyInto(*out) - } - if in.EBGPMultihop != nil { - in, out := &in.EBGPMultihop, &out.EBGPMultihop - *out = new(int32) - **out = **in - } - if in.Families != nil { - in, out := &in.Families, &out.Families - *out = make([]CiliumBGPFamilyWithAdverts, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPPeerConfigSpec. -func (in *CiliumBGPPeerConfigSpec) DeepCopy() *CiliumBGPPeerConfigSpec { - if in == nil { - return nil - } - out := new(CiliumBGPPeerConfigSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPPeeringPolicy) DeepCopyInto(out *CiliumBGPPeeringPolicy) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPPeeringPolicy. -func (in *CiliumBGPPeeringPolicy) DeepCopy() *CiliumBGPPeeringPolicy { - if in == nil { - return nil - } - out := new(CiliumBGPPeeringPolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumBGPPeeringPolicy) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPPeeringPolicyList) DeepCopyInto(out *CiliumBGPPeeringPolicyList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CiliumBGPPeeringPolicy, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPPeeringPolicyList. -func (in *CiliumBGPPeeringPolicyList) DeepCopy() *CiliumBGPPeeringPolicyList { - if in == nil { - return nil - } - out := new(CiliumBGPPeeringPolicyList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumBGPPeeringPolicyList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPPeeringPolicySpec) DeepCopyInto(out *CiliumBGPPeeringPolicySpec) { - *out = *in - if in.NodeSelector != nil { - in, out := &in.NodeSelector, &out.NodeSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - if in.VirtualRouters != nil { - in, out := &in.VirtualRouters, &out.VirtualRouters - *out = make([]CiliumBGPVirtualRouter, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPPeeringPolicySpec. -func (in *CiliumBGPPeeringPolicySpec) DeepCopy() *CiliumBGPPeeringPolicySpec { - if in == nil { - return nil - } - out := new(CiliumBGPPeeringPolicySpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPTimers) DeepCopyInto(out *CiliumBGPTimers) { - *out = *in - if in.ConnectRetryTimeSeconds != nil { - in, out := &in.ConnectRetryTimeSeconds, &out.ConnectRetryTimeSeconds - *out = new(int32) - **out = **in - } - if in.HoldTimeSeconds != nil { - in, out := &in.HoldTimeSeconds, &out.HoldTimeSeconds - *out = new(int32) - **out = **in - } - if in.KeepAliveTimeSeconds != nil { - in, out := &in.KeepAliveTimeSeconds, &out.KeepAliveTimeSeconds - *out = new(int32) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPTimers. -func (in *CiliumBGPTimers) DeepCopy() *CiliumBGPTimers { - if in == nil { - return nil - } - out := new(CiliumBGPTimers) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPTimersState) DeepCopyInto(out *CiliumBGPTimersState) { - *out = *in - if in.AppliedHoldTimeSeconds != nil { - in, out := &in.AppliedHoldTimeSeconds, &out.AppliedHoldTimeSeconds - *out = new(int32) - **out = **in - } - if in.AppliedKeepaliveSeconds != nil { - in, out := &in.AppliedKeepaliveSeconds, &out.AppliedKeepaliveSeconds - *out = new(int32) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPTimersState. -func (in *CiliumBGPTimersState) DeepCopy() *CiliumBGPTimersState { - if in == nil { - return nil - } - out := new(CiliumBGPTimersState) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPTransport) DeepCopyInto(out *CiliumBGPTransport) { - *out = *in - if in.LocalPort != nil { - in, out := &in.LocalPort, &out.LocalPort - *out = new(int32) - **out = **in - } - if in.PeerPort != nil { - in, out := &in.PeerPort, &out.PeerPort - *out = new(int32) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPTransport. -func (in *CiliumBGPTransport) DeepCopy() *CiliumBGPTransport { - if in == nil { - return nil - } - out := new(CiliumBGPTransport) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumBGPVirtualRouter) DeepCopyInto(out *CiliumBGPVirtualRouter) { - *out = *in - if in.ExportPodCIDR != nil { - in, out := &in.ExportPodCIDR, &out.ExportPodCIDR - *out = new(bool) - **out = **in - } - if in.PodIPPoolSelector != nil { - in, out := &in.PodIPPoolSelector, &out.PodIPPoolSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - if in.ServiceSelector != nil { - in, out := &in.ServiceSelector, &out.ServiceSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - if in.ServiceAdvertisements != nil { - in, out := &in.ServiceAdvertisements, &out.ServiceAdvertisements - *out = make([]BGPServiceAddressType, len(*in)) - copy(*out, *in) - } - if in.Neighbors != nil { - in, out := &in.Neighbors, &out.Neighbors - *out = make([]CiliumBGPNeighbor, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumBGPVirtualRouter. -func (in *CiliumBGPVirtualRouter) DeepCopy() *CiliumBGPVirtualRouter { - if in == nil { - return nil - } - out := new(CiliumBGPVirtualRouter) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumCIDRGroup) DeepCopyInto(out *CiliumCIDRGroup) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumCIDRGroup. -func (in *CiliumCIDRGroup) DeepCopy() *CiliumCIDRGroup { - if in == nil { - return nil - } - out := new(CiliumCIDRGroup) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumCIDRGroup) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumCIDRGroupList) DeepCopyInto(out *CiliumCIDRGroupList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CiliumCIDRGroup, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumCIDRGroupList. -func (in *CiliumCIDRGroupList) DeepCopy() *CiliumCIDRGroupList { - if in == nil { - return nil - } - out := new(CiliumCIDRGroupList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumCIDRGroupList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumCIDRGroupSpec) DeepCopyInto(out *CiliumCIDRGroupSpec) { - *out = *in - if in.ExternalCIDRs != nil { - in, out := &in.ExternalCIDRs, &out.ExternalCIDRs - *out = make([]api.CIDR, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumCIDRGroupSpec. -func (in *CiliumCIDRGroupSpec) DeepCopy() *CiliumCIDRGroupSpec { - if in == nil { - return nil - } - out := new(CiliumCIDRGroupSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumEndpointSlice) DeepCopyInto(out *CiliumEndpointSlice) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - if in.Endpoints != nil { - in, out := &in.Endpoints, &out.Endpoints - *out = make([]CoreCiliumEndpoint, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumEndpointSlice. -func (in *CiliumEndpointSlice) DeepCopy() *CiliumEndpointSlice { - if in == nil { - return nil - } - out := new(CiliumEndpointSlice) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumEndpointSlice) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumEndpointSliceList) DeepCopyInto(out *CiliumEndpointSliceList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CiliumEndpointSlice, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumEndpointSliceList. -func (in *CiliumEndpointSliceList) DeepCopy() *CiliumEndpointSliceList { - if in == nil { - return nil - } - out := new(CiliumEndpointSliceList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumEndpointSliceList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumL2AnnouncementPolicy) DeepCopyInto(out *CiliumL2AnnouncementPolicy) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumL2AnnouncementPolicy. -func (in *CiliumL2AnnouncementPolicy) DeepCopy() *CiliumL2AnnouncementPolicy { - if in == nil { - return nil - } - out := new(CiliumL2AnnouncementPolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumL2AnnouncementPolicy) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumL2AnnouncementPolicyList) DeepCopyInto(out *CiliumL2AnnouncementPolicyList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CiliumL2AnnouncementPolicy, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumL2AnnouncementPolicyList. -func (in *CiliumL2AnnouncementPolicyList) DeepCopy() *CiliumL2AnnouncementPolicyList { - if in == nil { - return nil - } - out := new(CiliumL2AnnouncementPolicyList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumL2AnnouncementPolicyList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumL2AnnouncementPolicySpec) DeepCopyInto(out *CiliumL2AnnouncementPolicySpec) { - *out = *in - if in.NodeSelector != nil { - in, out := &in.NodeSelector, &out.NodeSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - if in.ServiceSelector != nil { - in, out := &in.ServiceSelector, &out.ServiceSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - if in.Interfaces != nil { - in, out := &in.Interfaces, &out.Interfaces - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumL2AnnouncementPolicySpec. -func (in *CiliumL2AnnouncementPolicySpec) DeepCopy() *CiliumL2AnnouncementPolicySpec { - if in == nil { - return nil - } - out := new(CiliumL2AnnouncementPolicySpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumL2AnnouncementPolicyStatus) DeepCopyInto(out *CiliumL2AnnouncementPolicyStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]metav1.Condition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumL2AnnouncementPolicyStatus. -func (in *CiliumL2AnnouncementPolicyStatus) DeepCopy() *CiliumL2AnnouncementPolicyStatus { - if in == nil { - return nil - } - out := new(CiliumL2AnnouncementPolicyStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumLoadBalancerIPPool) DeepCopyInto(out *CiliumLoadBalancerIPPool) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumLoadBalancerIPPool. -func (in *CiliumLoadBalancerIPPool) DeepCopy() *CiliumLoadBalancerIPPool { - if in == nil { - return nil - } - out := new(CiliumLoadBalancerIPPool) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumLoadBalancerIPPool) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumLoadBalancerIPPoolIPBlock) DeepCopyInto(out *CiliumLoadBalancerIPPoolIPBlock) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumLoadBalancerIPPoolIPBlock. -func (in *CiliumLoadBalancerIPPoolIPBlock) DeepCopy() *CiliumLoadBalancerIPPoolIPBlock { - if in == nil { - return nil - } - out := new(CiliumLoadBalancerIPPoolIPBlock) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumLoadBalancerIPPoolList) DeepCopyInto(out *CiliumLoadBalancerIPPoolList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CiliumLoadBalancerIPPool, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumLoadBalancerIPPoolList. -func (in *CiliumLoadBalancerIPPoolList) DeepCopy() *CiliumLoadBalancerIPPoolList { - if in == nil { - return nil - } - out := new(CiliumLoadBalancerIPPoolList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumLoadBalancerIPPoolList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumLoadBalancerIPPoolSpec) DeepCopyInto(out *CiliumLoadBalancerIPPoolSpec) { - *out = *in - if in.ServiceSelector != nil { - in, out := &in.ServiceSelector, &out.ServiceSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - if in.Cidrs != nil { - in, out := &in.Cidrs, &out.Cidrs - *out = make([]CiliumLoadBalancerIPPoolIPBlock, len(*in)) - copy(*out, *in) - } - if in.Blocks != nil { - in, out := &in.Blocks, &out.Blocks - *out = make([]CiliumLoadBalancerIPPoolIPBlock, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumLoadBalancerIPPoolSpec. -func (in *CiliumLoadBalancerIPPoolSpec) DeepCopy() *CiliumLoadBalancerIPPoolSpec { - if in == nil { - return nil - } - out := new(CiliumLoadBalancerIPPoolSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumLoadBalancerIPPoolStatus) DeepCopyInto(out *CiliumLoadBalancerIPPoolStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]metav1.Condition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumLoadBalancerIPPoolStatus. -func (in *CiliumLoadBalancerIPPoolStatus) DeepCopy() *CiliumLoadBalancerIPPoolStatus { - if in == nil { - return nil - } - out := new(CiliumLoadBalancerIPPoolStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumNodeConfig) DeepCopyInto(out *CiliumNodeConfig) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumNodeConfig. -func (in *CiliumNodeConfig) DeepCopy() *CiliumNodeConfig { - if in == nil { - return nil - } - out := new(CiliumNodeConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumNodeConfig) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumNodeConfigList) DeepCopyInto(out *CiliumNodeConfigList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CiliumNodeConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumNodeConfigList. -func (in *CiliumNodeConfigList) DeepCopy() *CiliumNodeConfigList { - if in == nil { - return nil - } - out := new(CiliumNodeConfigList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumNodeConfigList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumNodeConfigSpec) DeepCopyInto(out *CiliumNodeConfigSpec) { - *out = *in - if in.Defaults != nil { - in, out := &in.Defaults, &out.Defaults - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.NodeSelector != nil { - in, out := &in.NodeSelector, &out.NodeSelector - *out = new(metav1.LabelSelector) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumNodeConfigSpec. -func (in *CiliumNodeConfigSpec) DeepCopy() *CiliumNodeConfigSpec { - if in == nil { - return nil - } - out := new(CiliumNodeConfigSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumPodIPPool) DeepCopyInto(out *CiliumPodIPPool) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumPodIPPool. -func (in *CiliumPodIPPool) DeepCopy() *CiliumPodIPPool { - if in == nil { - return nil - } - out := new(CiliumPodIPPool) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumPodIPPool) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CiliumPodIPPoolList) DeepCopyInto(out *CiliumPodIPPoolList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CiliumPodIPPool, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CiliumPodIPPoolList. -func (in *CiliumPodIPPoolList) DeepCopy() *CiliumPodIPPoolList { - if in == nil { - return nil - } - out := new(CiliumPodIPPoolList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CiliumPodIPPoolList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CoreCiliumEndpoint) DeepCopyInto(out *CoreCiliumEndpoint) { - *out = *in - if in.Networking != nil { - in, out := &in.Networking, &out.Networking - *out = new(v2.EndpointNetworking) - (*in).DeepCopyInto(*out) - } - out.Encryption = in.Encryption - if in.NamedPorts != nil { - in, out := &in.NamedPorts, &out.NamedPorts - *out = make(models.NamedPorts, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(models.Port) - **out = **in - } - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CoreCiliumEndpoint. -func (in *CoreCiliumEndpoint) DeepCopy() *CoreCiliumEndpoint { - if in == nil { - return nil - } - out := new(CoreCiliumEndpoint) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EgressRule) DeepCopyInto(out *EgressRule) { - *out = *in - if in.NamespaceSelector != nil { - in, out := &in.NamespaceSelector, &out.NamespaceSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - if in.PodSelector != nil { - in, out := &in.PodSelector, &out.PodSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EgressRule. -func (in *EgressRule) DeepCopy() *EgressRule { - if in == nil { - return nil - } - out := new(EgressRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPPoolSpec) DeepCopyInto(out *IPPoolSpec) { - *out = *in - if in.IPv4 != nil { - in, out := &in.IPv4, &out.IPv4 - *out = new(IPv4PoolSpec) - (*in).DeepCopyInto(*out) - } - if in.IPv6 != nil { - in, out := &in.IPv6, &out.IPv6 - *out = new(IPv6PoolSpec) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPPoolSpec. -func (in *IPPoolSpec) DeepCopy() *IPPoolSpec { - if in == nil { - return nil - } - out := new(IPPoolSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPv4PoolSpec) DeepCopyInto(out *IPv4PoolSpec) { - *out = *in - if in.CIDRs != nil { - in, out := &in.CIDRs, &out.CIDRs - *out = make([]PoolCIDR, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPv4PoolSpec. -func (in *IPv4PoolSpec) DeepCopy() *IPv4PoolSpec { - if in == nil { - return nil - } - out := new(IPv4PoolSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPv6PoolSpec) DeepCopyInto(out *IPv6PoolSpec) { - *out = *in - if in.CIDRs != nil { - in, out := &in.CIDRs, &out.CIDRs - *out = make([]PoolCIDR, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPv6PoolSpec. -func (in *IPv6PoolSpec) DeepCopy() *IPv6PoolSpec { - if in == nil { - return nil - } - out := new(IPv6PoolSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PeerConfigReference) DeepCopyInto(out *PeerConfigReference) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PeerConfigReference. -func (in *PeerConfigReference) DeepCopy() *PeerConfigReference { - if in == nil { - return nil - } - out := new(PeerConfigReference) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/zz_generated.deepequal.go b/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/zz_generated.deepequal.go deleted file mode 100644 index 1b473d99d..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1/zz_generated.deepequal.go +++ /dev/null @@ -1,1600 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepequal-gen. DO NOT EDIT. - -package v2alpha1 - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *BGPAdvertisement) DeepEqual(other *BGPAdvertisement) bool { - if other == nil { - return false - } - - if in.AdvertisementType != other.AdvertisementType { - return false - } - if (in.Service == nil) != (other.Service == nil) { - return false - } else if in.Service != nil { - if !in.Service.DeepEqual(other.Service) { - return false - } - } - - if (in.Selector == nil) != (other.Selector == nil) { - return false - } else if in.Selector != nil { - if !in.Selector.DeepEqual(other.Selector) { - return false - } - } - - if (in.Attributes == nil) != (other.Attributes == nil) { - return false - } else if in.Attributes != nil { - if !in.Attributes.DeepEqual(other.Attributes) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *BGPAttributes) DeepEqual(other *BGPAttributes) bool { - if other == nil { - return false - } - - if (in.Communities == nil) != (other.Communities == nil) { - return false - } else if in.Communities != nil { - if !in.Communities.DeepEqual(other.Communities) { - return false - } - } - - if (in.LocalPreference == nil) != (other.LocalPreference == nil) { - return false - } else if in.LocalPreference != nil { - if *in.LocalPreference != *other.LocalPreference { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *BGPCommunities) DeepEqual(other *BGPCommunities) bool { - if other == nil { - return false - } - - if ((in.Standard != nil) && (other.Standard != nil)) || ((in.Standard == nil) != (other.Standard == nil)) { - in, other := &in.Standard, &other.Standard - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if ((in.WellKnown != nil) && (other.WellKnown != nil)) || ((in.WellKnown == nil) != (other.WellKnown == nil)) { - in, other := &in.WellKnown, &other.WellKnown - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if ((in.Large != nil) && (other.Large != nil)) || ((in.Large == nil) != (other.Large == nil)) { - in, other := &in.Large, &other.Large - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *BGPServiceOptions) DeepEqual(other *BGPServiceOptions) bool { - if other == nil { - return false - } - - if ((in.Addresses != nil) && (other.Addresses != nil)) || ((in.Addresses == nil) != (other.Addresses == nil)) { - in, other := &in.Addresses, &other.Addresses - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPAdvertisement) DeepEqual(other *CiliumBGPAdvertisement) bool { - if other == nil { - return false - } - - if !in.Spec.DeepEqual(&other.Spec) { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPAdvertisementSpec) DeepEqual(other *CiliumBGPAdvertisementSpec) bool { - if other == nil { - return false - } - - if ((in.Advertisements != nil) && (other.Advertisements != nil)) || ((in.Advertisements == nil) != (other.Advertisements == nil)) { - in, other := &in.Advertisements, &other.Advertisements - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPClusterConfig) DeepEqual(other *CiliumBGPClusterConfig) bool { - if other == nil { - return false - } - - if !in.Spec.DeepEqual(&other.Spec) { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPClusterConfigSpec) DeepEqual(other *CiliumBGPClusterConfigSpec) bool { - if other == nil { - return false - } - - if (in.NodeSelector == nil) != (other.NodeSelector == nil) { - return false - } else if in.NodeSelector != nil { - if !in.NodeSelector.DeepEqual(other.NodeSelector) { - return false - } - } - - if ((in.BGPInstances != nil) && (other.BGPInstances != nil)) || ((in.BGPInstances == nil) != (other.BGPInstances == nil)) { - in, other := &in.BGPInstances, &other.BGPInstances - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPFamily) DeepEqual(other *CiliumBGPFamily) bool { - if other == nil { - return false - } - - if in.Afi != other.Afi { - return false - } - if in.Safi != other.Safi { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPFamilyWithAdverts) DeepEqual(other *CiliumBGPFamilyWithAdverts) bool { - if other == nil { - return false - } - - if in.CiliumBGPFamily != other.CiliumBGPFamily { - return false - } - - if (in.Advertisements == nil) != (other.Advertisements == nil) { - return false - } else if in.Advertisements != nil { - if !in.Advertisements.DeepEqual(other.Advertisements) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPInstance) DeepEqual(other *CiliumBGPInstance) bool { - if other == nil { - return false - } - - if in.Name != other.Name { - return false - } - if (in.LocalASN == nil) != (other.LocalASN == nil) { - return false - } else if in.LocalASN != nil { - if *in.LocalASN != *other.LocalASN { - return false - } - } - - if ((in.Peers != nil) && (other.Peers != nil)) || ((in.Peers == nil) != (other.Peers == nil)) { - in, other := &in.Peers, &other.Peers - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPNeighbor) DeepEqual(other *CiliumBGPNeighbor) bool { - if other == nil { - return false - } - - if in.PeerAddress != other.PeerAddress { - return false - } - if (in.PeerPort == nil) != (other.PeerPort == nil) { - return false - } else if in.PeerPort != nil { - if *in.PeerPort != *other.PeerPort { - return false - } - } - - if in.PeerASN != other.PeerASN { - return false - } - if (in.AuthSecretRef == nil) != (other.AuthSecretRef == nil) { - return false - } else if in.AuthSecretRef != nil { - if *in.AuthSecretRef != *other.AuthSecretRef { - return false - } - } - - if (in.EBGPMultihopTTL == nil) != (other.EBGPMultihopTTL == nil) { - return false - } else if in.EBGPMultihopTTL != nil { - if *in.EBGPMultihopTTL != *other.EBGPMultihopTTL { - return false - } - } - - if (in.ConnectRetryTimeSeconds == nil) != (other.ConnectRetryTimeSeconds == nil) { - return false - } else if in.ConnectRetryTimeSeconds != nil { - if *in.ConnectRetryTimeSeconds != *other.ConnectRetryTimeSeconds { - return false - } - } - - if (in.HoldTimeSeconds == nil) != (other.HoldTimeSeconds == nil) { - return false - } else if in.HoldTimeSeconds != nil { - if *in.HoldTimeSeconds != *other.HoldTimeSeconds { - return false - } - } - - if (in.KeepAliveTimeSeconds == nil) != (other.KeepAliveTimeSeconds == nil) { - return false - } else if in.KeepAliveTimeSeconds != nil { - if *in.KeepAliveTimeSeconds != *other.KeepAliveTimeSeconds { - return false - } - } - - if (in.GracefulRestart == nil) != (other.GracefulRestart == nil) { - return false - } else if in.GracefulRestart != nil { - if !in.GracefulRestart.DeepEqual(other.GracefulRestart) { - return false - } - } - - if ((in.Families != nil) && (other.Families != nil)) || ((in.Families == nil) != (other.Families == nil)) { - in, other := &in.Families, &other.Families - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.AdvertisedPathAttributes != nil) && (other.AdvertisedPathAttributes != nil)) || ((in.AdvertisedPathAttributes == nil) != (other.AdvertisedPathAttributes == nil)) { - in, other := &in.AdvertisedPathAttributes, &other.AdvertisedPathAttributes - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPNeighborGracefulRestart) DeepEqual(other *CiliumBGPNeighborGracefulRestart) bool { - if other == nil { - return false - } - - if in.Enabled != other.Enabled { - return false - } - if (in.RestartTimeSeconds == nil) != (other.RestartTimeSeconds == nil) { - return false - } else if in.RestartTimeSeconds != nil { - if *in.RestartTimeSeconds != *other.RestartTimeSeconds { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPNodeConfig) DeepEqual(other *CiliumBGPNodeConfig) bool { - if other == nil { - return false - } - - if !in.Spec.DeepEqual(&other.Spec) { - return false - } - - if !in.Status.DeepEqual(&other.Status) { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPNodeConfigInstanceOverride) DeepEqual(other *CiliumBGPNodeConfigInstanceOverride) bool { - if other == nil { - return false - } - - if in.Name != other.Name { - return false - } - if (in.RouterID == nil) != (other.RouterID == nil) { - return false - } else if in.RouterID != nil { - if *in.RouterID != *other.RouterID { - return false - } - } - - if (in.LocalPort == nil) != (other.LocalPort == nil) { - return false - } else if in.LocalPort != nil { - if *in.LocalPort != *other.LocalPort { - return false - } - } - - if ((in.Peers != nil) && (other.Peers != nil)) || ((in.Peers == nil) != (other.Peers == nil)) { - in, other := &in.Peers, &other.Peers - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPNodeConfigOverride) DeepEqual(other *CiliumBGPNodeConfigOverride) bool { - if other == nil { - return false - } - - if !in.Spec.DeepEqual(&other.Spec) { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPNodeConfigOverrideSpec) DeepEqual(other *CiliumBGPNodeConfigOverrideSpec) bool { - if other == nil { - return false - } - - if ((in.BGPInstances != nil) && (other.BGPInstances != nil)) || ((in.BGPInstances == nil) != (other.BGPInstances == nil)) { - in, other := &in.BGPInstances, &other.BGPInstances - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPNodeConfigPeerOverride) DeepEqual(other *CiliumBGPNodeConfigPeerOverride) bool { - if other == nil { - return false - } - - if in.Name != other.Name { - return false - } - if (in.LocalAddress == nil) != (other.LocalAddress == nil) { - return false - } else if in.LocalAddress != nil { - if *in.LocalAddress != *other.LocalAddress { - return false - } - } - - if (in.LocalPort == nil) != (other.LocalPort == nil) { - return false - } else if in.LocalPort != nil { - if *in.LocalPort != *other.LocalPort { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPNodeInstance) DeepEqual(other *CiliumBGPNodeInstance) bool { - if other == nil { - return false - } - - if in.Name != other.Name { - return false - } - if (in.LocalASN == nil) != (other.LocalASN == nil) { - return false - } else if in.LocalASN != nil { - if *in.LocalASN != *other.LocalASN { - return false - } - } - - if (in.RouterID == nil) != (other.RouterID == nil) { - return false - } else if in.RouterID != nil { - if *in.RouterID != *other.RouterID { - return false - } - } - - if (in.LocalPort == nil) != (other.LocalPort == nil) { - return false - } else if in.LocalPort != nil { - if *in.LocalPort != *other.LocalPort { - return false - } - } - - if ((in.Peers != nil) && (other.Peers != nil)) || ((in.Peers == nil) != (other.Peers == nil)) { - in, other := &in.Peers, &other.Peers - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPNodeInstanceStatus) DeepEqual(other *CiliumBGPNodeInstanceStatus) bool { - if other == nil { - return false - } - - if in.Name != other.Name { - return false - } - if (in.LocalASN == nil) != (other.LocalASN == nil) { - return false - } else if in.LocalASN != nil { - if *in.LocalASN != *other.LocalASN { - return false - } - } - - if ((in.PeerStatuses != nil) && (other.PeerStatuses != nil)) || ((in.PeerStatuses == nil) != (other.PeerStatuses == nil)) { - in, other := &in.PeerStatuses, &other.PeerStatuses - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPNodePeer) DeepEqual(other *CiliumBGPNodePeer) bool { - if other == nil { - return false - } - - if in.Name != other.Name { - return false - } - if (in.PeerAddress == nil) != (other.PeerAddress == nil) { - return false - } else if in.PeerAddress != nil { - if *in.PeerAddress != *other.PeerAddress { - return false - } - } - - if (in.PeerASN == nil) != (other.PeerASN == nil) { - return false - } else if in.PeerASN != nil { - if *in.PeerASN != *other.PeerASN { - return false - } - } - - if (in.LocalAddress == nil) != (other.LocalAddress == nil) { - return false - } else if in.LocalAddress != nil { - if *in.LocalAddress != *other.LocalAddress { - return false - } - } - - if (in.PeerConfigRef == nil) != (other.PeerConfigRef == nil) { - return false - } else if in.PeerConfigRef != nil { - if !in.PeerConfigRef.DeepEqual(other.PeerConfigRef) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPNodePeerStatus) DeepEqual(other *CiliumBGPNodePeerStatus) bool { - if other == nil { - return false - } - - if in.Name != other.Name { - return false - } - if in.PeerAddress != other.PeerAddress { - return false - } - if (in.PeerASN == nil) != (other.PeerASN == nil) { - return false - } else if in.PeerASN != nil { - if *in.PeerASN != *other.PeerASN { - return false - } - } - - if (in.PeeringState == nil) != (other.PeeringState == nil) { - return false - } else if in.PeeringState != nil { - if *in.PeeringState != *other.PeeringState { - return false - } - } - - if (in.Timers == nil) != (other.Timers == nil) { - return false - } else if in.Timers != nil { - if !in.Timers.DeepEqual(other.Timers) { - return false - } - } - - if (in.Uptime == nil) != (other.Uptime == nil) { - return false - } else if in.Uptime != nil { - if *in.Uptime != *other.Uptime { - return false - } - } - - if (in.RoutesReceived == nil) != (other.RoutesReceived == nil) { - return false - } else if in.RoutesReceived != nil { - if *in.RoutesReceived != *other.RoutesReceived { - return false - } - } - - if (in.RoutesAdvertised == nil) != (other.RoutesAdvertised == nil) { - return false - } else if in.RoutesAdvertised != nil { - if *in.RoutesAdvertised != *other.RoutesAdvertised { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPNodeSpec) DeepEqual(other *CiliumBGPNodeSpec) bool { - if other == nil { - return false - } - - if ((in.BGPInstances != nil) && (other.BGPInstances != nil)) || ((in.BGPInstances == nil) != (other.BGPInstances == nil)) { - in, other := &in.BGPInstances, &other.BGPInstances - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPNodeStatus) DeepEqual(other *CiliumBGPNodeStatus) bool { - if other == nil { - return false - } - - if ((in.BGPInstances != nil) && (other.BGPInstances != nil)) || ((in.BGPInstances == nil) != (other.BGPInstances == nil)) { - in, other := &in.BGPInstances, &other.BGPInstances - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPPathAttributes) DeepEqual(other *CiliumBGPPathAttributes) bool { - if other == nil { - return false - } - - if in.SelectorType != other.SelectorType { - return false - } - if (in.Selector == nil) != (other.Selector == nil) { - return false - } else if in.Selector != nil { - if !in.Selector.DeepEqual(other.Selector) { - return false - } - } - - if (in.Communities == nil) != (other.Communities == nil) { - return false - } else if in.Communities != nil { - if !in.Communities.DeepEqual(other.Communities) { - return false - } - } - - if (in.LocalPreference == nil) != (other.LocalPreference == nil) { - return false - } else if in.LocalPreference != nil { - if *in.LocalPreference != *other.LocalPreference { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPPeer) DeepEqual(other *CiliumBGPPeer) bool { - if other == nil { - return false - } - - if in.Name != other.Name { - return false - } - if (in.PeerAddress == nil) != (other.PeerAddress == nil) { - return false - } else if in.PeerAddress != nil { - if *in.PeerAddress != *other.PeerAddress { - return false - } - } - - if (in.PeerASN == nil) != (other.PeerASN == nil) { - return false - } else if in.PeerASN != nil { - if *in.PeerASN != *other.PeerASN { - return false - } - } - - if (in.PeerConfigRef == nil) != (other.PeerConfigRef == nil) { - return false - } else if in.PeerConfigRef != nil { - if !in.PeerConfigRef.DeepEqual(other.PeerConfigRef) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPPeerConfig) DeepEqual(other *CiliumBGPPeerConfig) bool { - if other == nil { - return false - } - - if !in.Spec.DeepEqual(&other.Spec) { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPPeerConfigSpec) DeepEqual(other *CiliumBGPPeerConfigSpec) bool { - if other == nil { - return false - } - - if (in.Transport == nil) != (other.Transport == nil) { - return false - } else if in.Transport != nil { - if !in.Transport.DeepEqual(other.Transport) { - return false - } - } - - if (in.Timers == nil) != (other.Timers == nil) { - return false - } else if in.Timers != nil { - if !in.Timers.DeepEqual(other.Timers) { - return false - } - } - - if (in.AuthSecretRef == nil) != (other.AuthSecretRef == nil) { - return false - } else if in.AuthSecretRef != nil { - if *in.AuthSecretRef != *other.AuthSecretRef { - return false - } - } - - if (in.GracefulRestart == nil) != (other.GracefulRestart == nil) { - return false - } else if in.GracefulRestart != nil { - if !in.GracefulRestart.DeepEqual(other.GracefulRestart) { - return false - } - } - - if (in.EBGPMultihop == nil) != (other.EBGPMultihop == nil) { - return false - } else if in.EBGPMultihop != nil { - if *in.EBGPMultihop != *other.EBGPMultihop { - return false - } - } - - if ((in.Families != nil) && (other.Families != nil)) || ((in.Families == nil) != (other.Families == nil)) { - in, other := &in.Families, &other.Families - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPPeeringPolicy) DeepEqual(other *CiliumBGPPeeringPolicy) bool { - if other == nil { - return false - } - - if !in.Spec.DeepEqual(&other.Spec) { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPPeeringPolicySpec) DeepEqual(other *CiliumBGPPeeringPolicySpec) bool { - if other == nil { - return false - } - - if (in.NodeSelector == nil) != (other.NodeSelector == nil) { - return false - } else if in.NodeSelector != nil { - if !in.NodeSelector.DeepEqual(other.NodeSelector) { - return false - } - } - - if ((in.VirtualRouters != nil) && (other.VirtualRouters != nil)) || ((in.VirtualRouters == nil) != (other.VirtualRouters == nil)) { - in, other := &in.VirtualRouters, &other.VirtualRouters - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPTimers) DeepEqual(other *CiliumBGPTimers) bool { - if other == nil { - return false - } - - if (in.ConnectRetryTimeSeconds == nil) != (other.ConnectRetryTimeSeconds == nil) { - return false - } else if in.ConnectRetryTimeSeconds != nil { - if *in.ConnectRetryTimeSeconds != *other.ConnectRetryTimeSeconds { - return false - } - } - - if (in.HoldTimeSeconds == nil) != (other.HoldTimeSeconds == nil) { - return false - } else if in.HoldTimeSeconds != nil { - if *in.HoldTimeSeconds != *other.HoldTimeSeconds { - return false - } - } - - if (in.KeepAliveTimeSeconds == nil) != (other.KeepAliveTimeSeconds == nil) { - return false - } else if in.KeepAliveTimeSeconds != nil { - if *in.KeepAliveTimeSeconds != *other.KeepAliveTimeSeconds { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPTimersState) DeepEqual(other *CiliumBGPTimersState) bool { - if other == nil { - return false - } - - if (in.AppliedHoldTimeSeconds == nil) != (other.AppliedHoldTimeSeconds == nil) { - return false - } else if in.AppliedHoldTimeSeconds != nil { - if *in.AppliedHoldTimeSeconds != *other.AppliedHoldTimeSeconds { - return false - } - } - - if (in.AppliedKeepaliveSeconds == nil) != (other.AppliedKeepaliveSeconds == nil) { - return false - } else if in.AppliedKeepaliveSeconds != nil { - if *in.AppliedKeepaliveSeconds != *other.AppliedKeepaliveSeconds { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPTransport) DeepEqual(other *CiliumBGPTransport) bool { - if other == nil { - return false - } - - if (in.LocalPort == nil) != (other.LocalPort == nil) { - return false - } else if in.LocalPort != nil { - if *in.LocalPort != *other.LocalPort { - return false - } - } - - if (in.PeerPort == nil) != (other.PeerPort == nil) { - return false - } else if in.PeerPort != nil { - if *in.PeerPort != *other.PeerPort { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumBGPVirtualRouter) DeepEqual(other *CiliumBGPVirtualRouter) bool { - if other == nil { - return false - } - - if in.LocalASN != other.LocalASN { - return false - } - if (in.ExportPodCIDR == nil) != (other.ExportPodCIDR == nil) { - return false - } else if in.ExportPodCIDR != nil { - if *in.ExportPodCIDR != *other.ExportPodCIDR { - return false - } - } - - if (in.PodIPPoolSelector == nil) != (other.PodIPPoolSelector == nil) { - return false - } else if in.PodIPPoolSelector != nil { - if !in.PodIPPoolSelector.DeepEqual(other.PodIPPoolSelector) { - return false - } - } - - if (in.ServiceSelector == nil) != (other.ServiceSelector == nil) { - return false - } else if in.ServiceSelector != nil { - if !in.ServiceSelector.DeepEqual(other.ServiceSelector) { - return false - } - } - - if ((in.ServiceAdvertisements != nil) && (other.ServiceAdvertisements != nil)) || ((in.ServiceAdvertisements == nil) != (other.ServiceAdvertisements == nil)) { - in, other := &in.ServiceAdvertisements, &other.ServiceAdvertisements - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if ((in.Neighbors != nil) && (other.Neighbors != nil)) || ((in.Neighbors == nil) != (other.Neighbors == nil)) { - in, other := &in.Neighbors, &other.Neighbors - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumCIDRGroupSpec) DeepEqual(other *CiliumCIDRGroupSpec) bool { - if other == nil { - return false - } - - if ((in.ExternalCIDRs != nil) && (other.ExternalCIDRs != nil)) || ((in.ExternalCIDRs == nil) != (other.ExternalCIDRs == nil)) { - in, other := &in.ExternalCIDRs, &other.ExternalCIDRs - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumEndpointSlice) DeepEqual(other *CiliumEndpointSlice) bool { - if other == nil { - return false - } - - if in.Namespace != other.Namespace { - return false - } - if ((in.Endpoints != nil) && (other.Endpoints != nil)) || ((in.Endpoints == nil) != (other.Endpoints == nil)) { - in, other := &in.Endpoints, &other.Endpoints - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumL2AnnouncementPolicy) DeepEqual(other *CiliumL2AnnouncementPolicy) bool { - if other == nil { - return false - } - - if !in.Spec.DeepEqual(&other.Spec) { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumL2AnnouncementPolicySpec) DeepEqual(other *CiliumL2AnnouncementPolicySpec) bool { - if other == nil { - return false - } - - if (in.NodeSelector == nil) != (other.NodeSelector == nil) { - return false - } else if in.NodeSelector != nil { - if !in.NodeSelector.DeepEqual(other.NodeSelector) { - return false - } - } - - if (in.ServiceSelector == nil) != (other.ServiceSelector == nil) { - return false - } else if in.ServiceSelector != nil { - if !in.ServiceSelector.DeepEqual(other.ServiceSelector) { - return false - } - } - - if in.LoadBalancerIPs != other.LoadBalancerIPs { - return false - } - if in.ExternalIPs != other.ExternalIPs { - return false - } - if ((in.Interfaces != nil) && (other.Interfaces != nil)) || ((in.Interfaces == nil) != (other.Interfaces == nil)) { - in, other := &in.Interfaces, &other.Interfaces - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumLoadBalancerIPPool) DeepEqual(other *CiliumLoadBalancerIPPool) bool { - if other == nil { - return false - } - - if !in.Spec.DeepEqual(&other.Spec) { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumLoadBalancerIPPoolIPBlock) DeepEqual(other *CiliumLoadBalancerIPPoolIPBlock) bool { - if other == nil { - return false - } - - if in.Cidr != other.Cidr { - return false - } - if in.Start != other.Start { - return false - } - if in.Stop != other.Stop { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumLoadBalancerIPPoolSpec) DeepEqual(other *CiliumLoadBalancerIPPoolSpec) bool { - if other == nil { - return false - } - - if (in.ServiceSelector == nil) != (other.ServiceSelector == nil) { - return false - } else if in.ServiceSelector != nil { - if !in.ServiceSelector.DeepEqual(other.ServiceSelector) { - return false - } - } - - if in.AllowFirstLastIPs != other.AllowFirstLastIPs { - return false - } - if ((in.Cidrs != nil) && (other.Cidrs != nil)) || ((in.Cidrs == nil) != (other.Cidrs == nil)) { - in, other := &in.Cidrs, &other.Cidrs - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.Blocks != nil) && (other.Blocks != nil)) || ((in.Blocks == nil) != (other.Blocks == nil)) { - in, other := &in.Blocks, &other.Blocks - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if in.Disabled != other.Disabled { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CiliumPodIPPool) DeepEqual(other *CiliumPodIPPool) bool { - if other == nil { - return false - } - - if !in.Spec.DeepEqual(&other.Spec) { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CoreCiliumEndpoint) DeepEqual(other *CoreCiliumEndpoint) bool { - if other == nil { - return false - } - - if in.Name != other.Name { - return false - } - if in.IdentityID != other.IdentityID { - return false - } - if (in.Networking == nil) != (other.Networking == nil) { - return false - } else if in.Networking != nil { - if !in.Networking.DeepEqual(other.Networking) { - return false - } - } - - if in.Encryption != other.Encryption { - return false - } - - if ((in.NamedPorts != nil) && (other.NamedPorts != nil)) || ((in.NamedPorts == nil) != (other.NamedPorts == nil)) { - in, other := &in.NamedPorts, &other.NamedPorts - if other == nil || !in.DeepEqual(other) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EgressRule) DeepEqual(other *EgressRule) bool { - if other == nil { - return false - } - - if (in.NamespaceSelector == nil) != (other.NamespaceSelector == nil) { - return false - } else if in.NamespaceSelector != nil { - if !in.NamespaceSelector.DeepEqual(other.NamespaceSelector) { - return false - } - } - - if (in.PodSelector == nil) != (other.PodSelector == nil) { - return false - } else if in.PodSelector != nil { - if !in.PodSelector.DeepEqual(other.PodSelector) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *IPPoolSpec) DeepEqual(other *IPPoolSpec) bool { - if other == nil { - return false - } - - if (in.IPv4 == nil) != (other.IPv4 == nil) { - return false - } else if in.IPv4 != nil { - if !in.IPv4.DeepEqual(other.IPv4) { - return false - } - } - - if (in.IPv6 == nil) != (other.IPv6 == nil) { - return false - } else if in.IPv6 != nil { - if !in.IPv6.DeepEqual(other.IPv6) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *IPv4PoolSpec) DeepEqual(other *IPv4PoolSpec) bool { - if other == nil { - return false - } - - if ((in.CIDRs != nil) && (other.CIDRs != nil)) || ((in.CIDRs == nil) != (other.CIDRs == nil)) { - in, other := &in.CIDRs, &other.CIDRs - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if in.MaskSize != other.MaskSize { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *IPv6PoolSpec) DeepEqual(other *IPv6PoolSpec) bool { - if other == nil { - return false - } - - if ((in.CIDRs != nil) && (other.CIDRs != nil)) || ((in.CIDRs == nil) != (other.CIDRs == nil)) { - in, other := &in.CIDRs, &other.CIDRs - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if in.MaskSize != other.MaskSize { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PeerConfigReference) DeepEqual(other *PeerConfigReference) bool { - if other == nil { - return false - } - - if in.Group != other.Group { - return false - } - if in.Kind != other.Kind { - return false - } - if in.Name != other.Name { - return false - } - - return true -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/cell.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/cell.go deleted file mode 100644 index 6f12b2386..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/cell.go +++ /dev/null @@ -1,511 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package client - -import ( - "context" - "errors" - "fmt" - "log/slog" - "net" - "net/http" - "os" - "path/filepath" - "strings" - "time" - - "github.com/cilium/hive/cell" - "github.com/sirupsen/logrus" - apiext_clientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" - apiext_fake "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/fake" - k8sErrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - utilnet "k8s.io/apimachinery/pkg/util/net" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" - "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/client-go/discovery" - "k8s.io/client-go/kubernetes" - "k8s.io/client-go/kubernetes/fake" - "k8s.io/client-go/rest" - "k8s.io/client-go/tools/clientcmd" - "k8s.io/client-go/util/connrotation" - - "github.com/cilium/cilium/pkg/controller" - cilium_clientset "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned" - cilium_fake "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/fake" - k8smetrics "github.com/cilium/cilium/pkg/k8s/metrics" - slim_apiextclientsetscheme "github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-client/clientset/versioned/scheme" - slim_apiext_clientset "github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-clientset" - slim_metav1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" - slim_metav1beta1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1" - slim_clientset "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned" - slim_fake "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/fake" - k8sversion "github.com/cilium/cilium/pkg/k8s/version" - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/version" -) - -// client.Cell provides Clientset, a composition of clientsets to Kubernetes resources -// used by Cilium. -var Cell = cell.Module( - "k8s-client", - "Kubernetes Client", - - cell.Config(defaultConfig), - cell.Provide(newClientset), -) - -var k8sHeartbeatControllerGroup = controller.NewGroup("k8s-heartbeat") - -// Type aliases for the clientsets to avoid name collision on 'Clientset' when composing them. -type ( - KubernetesClientset = kubernetes.Clientset - SlimClientset = slim_clientset.Clientset - APIExtClientset = slim_apiext_clientset.Clientset - CiliumClientset = cilium_clientset.Clientset -) - -// Clientset is a composition of the different client sets used by Cilium. -type Clientset interface { - kubernetes.Interface - apiext_clientset.Interface - cilium_clientset.Interface - Getters - - // Slim returns the slim client, which contains some of the same APIs as the - // normal kubernetes client, but with slimmed down messages to reduce memory - // usage. Prefer the slim version when caching messages. - Slim() slim_clientset.Interface - - // IsEnabled returns true if Kubernetes support is enabled and the - // clientset can be used. - IsEnabled() bool - - // Disable disables the client. Panics if called after the clientset has been - // started. - Disable() - - // Config returns the configuration used to create this client. - Config() Config - - // RestConfig returns the deep copy of rest configuration. - RestConfig() *rest.Config -} - -// compositeClientset implements the Clientset using real clients. -type compositeClientset struct { - started bool - disabled bool - - *KubernetesClientset - *APIExtClientset - *CiliumClientset - clientsetGetters - - controller *controller.Manager - slim *SlimClientset - config Config - log logrus.FieldLogger - closeAllConns func() - restConfig *rest.Config -} - -func newClientset(lc cell.Lifecycle, log logrus.FieldLogger, cfg Config) (Clientset, error) { - if !cfg.isEnabled() { - return &compositeClientset{disabled: true}, nil - } - - if cfg.K8sAPIServer != "" && - !strings.HasPrefix(cfg.K8sAPIServer, "http") { - cfg.K8sAPIServer = "http://" + cfg.K8sAPIServer // default to HTTP - } - - client := compositeClientset{ - log: log, - controller: controller.NewManager(), - config: cfg, - } - - restConfig, err := createConfig(cfg.K8sAPIServer, cfg.K8sKubeConfigPath, cfg.K8sClientQPS, cfg.K8sClientBurst) - if err != nil { - return nil, fmt.Errorf("unable to create k8s client rest configuration: %w", err) - } - client.restConfig = restConfig - defaultCloseAllConns := setDialer(cfg, restConfig) - - httpClient, err := rest.HTTPClientFor(restConfig) - if err != nil { - return nil, fmt.Errorf("unable to create k8s REST client: %w", err) - } - - // We are implementing the same logic as Kubelet, see - // https://github.com/kubernetes/kubernetes/blob/v1.24.0-beta.0/cmd/kubelet/app/server.go#L852. - if s := os.Getenv("DISABLE_HTTP2"); len(s) > 0 { - client.closeAllConns = defaultCloseAllConns - } else { - client.closeAllConns = func() { - utilnet.CloseIdleConnectionsFor(restConfig.Transport) - } - } - - // Slim and K8s clients use protobuf marshalling. - restConfig.ContentConfig.ContentType = `application/vnd.kubernetes.protobuf` - - client.slim, err = slim_clientset.NewForConfigAndClient(restConfig, httpClient) - if err != nil { - return nil, fmt.Errorf("unable to create slim k8s client: %w", err) - } - - client.APIExtClientset, err = slim_apiext_clientset.NewForConfigAndClient(restConfig, httpClient) - if err != nil { - return nil, fmt.Errorf("unable to create apiext k8s client: %w", err) - } - - client.KubernetesClientset, err = kubernetes.NewForConfigAndClient(restConfig, httpClient) - if err != nil { - return nil, fmt.Errorf("unable to create k8s client: %w", err) - } - - client.clientsetGetters = clientsetGetters{&client} - - // The cilium client uses JSON marshalling. - restConfig.ContentConfig.ContentType = `application/json` - client.CiliumClientset, err = cilium_clientset.NewForConfigAndClient(restConfig, httpClient) - if err != nil { - return nil, fmt.Errorf("unable to create cilium k8s client: %w", err) - } - - lc.Append(cell.Hook{ - OnStart: client.onStart, - OnStop: client.onStop, - }) - - return &client, nil -} - -func (c *compositeClientset) Slim() slim_clientset.Interface { - return c.slim -} - -func (c *compositeClientset) Discovery() discovery.DiscoveryInterface { - return c.KubernetesClientset.Discovery() -} - -func (c *compositeClientset) IsEnabled() bool { - return c != nil && c.config.isEnabled() && !c.disabled -} - -func (c *compositeClientset) Disable() { - if c.started { - panic("Clientset.Disable() called after it had been started") - } - c.disabled = true -} - -func (c *compositeClientset) Config() Config { - return c.config -} - -func (c *compositeClientset) RestConfig() *rest.Config { - return rest.CopyConfig(c.restConfig) -} - -func (c *compositeClientset) onStart(startCtx cell.HookContext) error { - if !c.IsEnabled() { - return nil - } - - if err := c.waitForConn(startCtx); err != nil { - return err - } - c.startHeartbeat() - - // Update the global K8s clients, K8s version and the capabilities. - if err := k8sversion.Update(c, c.config.EnableK8sAPIDiscovery); err != nil { - return err - } - - if !k8sversion.Capabilities().MinimalVersionMet { - return fmt.Errorf("k8s version (%v) is not meeting the minimal requirement (%v)", - k8sversion.Version(), k8sversion.MinimalVersionConstraint) - } - - c.started = true - - return nil -} - -func (c *compositeClientset) onStop(stopCtx cell.HookContext) error { - if c.IsEnabled() { - c.controller.RemoveAllAndWait() - c.closeAllConns() - } - c.started = false - return nil -} - -func (c *compositeClientset) startHeartbeat() { - restClient := c.KubernetesClientset.RESTClient() - - timeout := c.config.K8sHeartbeatTimeout - if timeout == 0 { - return - } - - heartBeat := func(ctx context.Context) error { - // Kubernetes does a get node of the node that kubelet is running [0]. This seems excessive in - // our case because the amount of data transferred is bigger than doing a Get of /healthz. - // For this reason we have picked to perform a get on `/healthz` instead a get of a node. - // - // [0] https://github.com/kubernetes/kubernetes/blob/v1.17.3/pkg/kubelet/kubelet_node_status.go#L423 - res := restClient.Get().Resource("healthz").Do(ctx) - return res.Error() - } - - c.controller.UpdateController("k8s-heartbeat", - controller.ControllerParams{ - Group: k8sHeartbeatControllerGroup, - DoFunc: func(context.Context) error { - runHeartbeat( - c.log, - heartBeat, - timeout, - c.closeAllConns, - ) - return nil - }, - RunInterval: timeout, - }) -} - -// createConfig creates a rest.Config for connecting to k8s api-server. -// -// The precedence of the configuration selection is the following: -// 1. kubeCfgPath -// 2. apiServerURL (https if specified) -// 3. rest.InClusterConfig(). -func createConfig(apiServerURL, kubeCfgPath string, qps float32, burst int) (*rest.Config, error) { - var ( - config *rest.Config - err error - ) - cmdName := "cilium" - if len(os.Args[0]) != 0 { - cmdName = filepath.Base(os.Args[0]) - } - userAgent := fmt.Sprintf("%s/%s", cmdName, version.Version) - - switch { - // If the apiServerURL and the kubeCfgPath are empty then we can try getting - // the rest.Config from the InClusterConfig - case apiServerURL == "" && kubeCfgPath == "": - if config, err = rest.InClusterConfig(); err != nil { - return nil, err - } - case kubeCfgPath != "": - if config, err = clientcmd.BuildConfigFromFlags("", kubeCfgPath); err != nil { - return nil, err - } - case strings.HasPrefix(apiServerURL, "https://"): - if config, err = rest.InClusterConfig(); err != nil { - return nil, err - } - config.Host = apiServerURL - default: - config = &rest.Config{Host: apiServerURL, UserAgent: userAgent} - } - - setConfig(config, userAgent, qps, burst) - return config, nil -} - -func setConfig(config *rest.Config, userAgent string, qps float32, burst int) { - if userAgent != "" { - config.UserAgent = userAgent - } - if qps != 0.0 { - config.QPS = qps - } - if burst != 0 { - config.Burst = burst - } -} - -func (c *compositeClientset) waitForConn(ctx context.Context) error { - stop := make(chan struct{}) - timeout := time.NewTimer(time.Minute) - defer timeout.Stop() - var err error - wait.Until(func() { - c.log.WithField("host", c.restConfig.Host).Info("Establishing connection to apiserver") - err = isConnReady(c) - if err == nil { - close(stop) - return - } - - select { - case <-ctx.Done(): - case <-timeout.C: - default: - return - } - - c.log.WithError(err).WithField(logfields.IPAddr, c.restConfig.Host).Error("Unable to contact k8s api-server") - close(stop) - }, 5*time.Second, stop) - if err == nil { - c.log.Info("Connected to apiserver") - } - return err -} - -func setDialer(cfg Config, restConfig *rest.Config) func() { - if cfg.K8sHeartbeatTimeout == 0 { - return func() {} - } - ctx := (&net.Dialer{ - Timeout: cfg.K8sHeartbeatTimeout, - KeepAlive: cfg.K8sHeartbeatTimeout, - }).DialContext - dialer := connrotation.NewDialer(ctx) - restConfig.Dial = dialer.DialContext - return dialer.CloseAll -} - -func runHeartbeat(log logrus.FieldLogger, heartBeat func(context.Context) error, timeout time.Duration, closeAllConns ...func()) { - expireDate := time.Now().Add(-timeout) - // Don't even perform a health check if we have received a successful - // k8s event in the last 'timeout' duration - if k8smetrics.LastSuccessInteraction.Time().After(expireDate) { - return - } - - done := make(chan error) - ctx, cancel := context.WithTimeout(context.Background(), timeout) - defer cancel() - go func() { - // If we have reached up to this point to perform a heartbeat to - // kube-apiserver then we should close the connections if we receive - // any error at all except if we receive a http.StatusTooManyRequests - // which means the server is overloaded and only for this reason we - // will not close all connections. - err := heartBeat(ctx) - if err != nil { - statusError := &k8sErrors.StatusError{} - if !errors.As(err, &statusError) || - statusError.ErrStatus.Code != http.StatusTooManyRequests { - done <- err - } - } - close(done) - }() - - select { - case err := <-done: - if err != nil { - log.WithError(err).Warn("Network status error received, restarting client connections") - for _, fn := range closeAllConns { - fn() - } - } - case <-ctx.Done(): - log.Warn("Heartbeat timed out, restarting client connections") - for _, fn := range closeAllConns { - fn() - } - } -} - -// isConnReady returns the err for the kube-system namespace get -func isConnReady(c kubernetes.Interface) error { - _, err := c.CoreV1().Namespaces().Get(context.TODO(), "kube-system", metav1.GetOptions{}) - return err -} - -var FakeClientCell = cell.Provide(NewFakeClientset) - -type ( - KubernetesFakeClientset = fake.Clientset - SlimFakeClientset = slim_fake.Clientset - CiliumFakeClientset = cilium_fake.Clientset - APIExtFakeClientset = apiext_fake.Clientset -) - -type FakeClientset struct { - disabled bool - - *KubernetesFakeClientset - *CiliumFakeClientset - *APIExtFakeClientset - clientsetGetters - - SlimFakeClientset *SlimFakeClientset - - enabled bool -} - -var _ Clientset = &FakeClientset{} - -func (c *FakeClientset) Slim() slim_clientset.Interface { - return c.SlimFakeClientset -} - -func (c *FakeClientset) Discovery() discovery.DiscoveryInterface { - return c.KubernetesFakeClientset.Discovery() -} - -func (c *FakeClientset) IsEnabled() bool { - return !c.disabled -} - -func (c *FakeClientset) Disable() { - c.disabled = true -} - -func (c *FakeClientset) Config() Config { - return Config{} -} - -func (c *FakeClientset) RestConfig() *rest.Config { - return &rest.Config{} -} - -func NewFakeClientset() (*FakeClientset, Clientset) { - client := FakeClientset{ - SlimFakeClientset: slim_fake.NewSimpleClientset(), - CiliumFakeClientset: cilium_fake.NewSimpleClientset(), - APIExtFakeClientset: apiext_fake.NewSimpleClientset(), - KubernetesFakeClientset: fake.NewSimpleClientset(), - enabled: true, - } - client.clientsetGetters = clientsetGetters{&client} - return &client, &client -} - -// NewStandaloneClientset creates a clientset outside hive. To be removed once -// remaining uses of k8s.Init()/k8s.Client()/etc. have been converted. -func NewStandaloneClientset(cfg Config) (Clientset, error) { - log := logging.DefaultLogger - lc := &cell.DefaultLifecycle{} - - clientset, err := newClientset(lc, log, cfg) - if err != nil { - return nil, err - } - - if err := lc.Start(slog.Default(), context.Background()); err != nil { - return nil, err - } - - return clientset, err -} - -func init() { - // Register the metav1.Table and metav1.PartialObjectMetadata for the - // apiextclientset. - utilruntime.Must(slim_metav1.AddMetaToScheme(slim_apiextclientsetscheme.Scheme)) - utilruntime.Must(slim_metav1beta1.AddMetaToScheme(slim_apiextclientsetscheme.Scheme)) -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/clientset.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/clientset.go deleted file mode 100644 index 720686010..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/clientset.go +++ /dev/null @@ -1,120 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package versioned - -import ( - "fmt" - "net/http" - - ciliumv2 "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2" - ciliumv2alpha1 "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1" - discovery "k8s.io/client-go/discovery" - rest "k8s.io/client-go/rest" - flowcontrol "k8s.io/client-go/util/flowcontrol" -) - -type Interface interface { - Discovery() discovery.DiscoveryInterface - CiliumV2() ciliumv2.CiliumV2Interface - CiliumV2alpha1() ciliumv2alpha1.CiliumV2alpha1Interface -} - -// Clientset contains the clients for groups. -type Clientset struct { - *discovery.DiscoveryClient - ciliumV2 *ciliumv2.CiliumV2Client - ciliumV2alpha1 *ciliumv2alpha1.CiliumV2alpha1Client -} - -// CiliumV2 retrieves the CiliumV2Client -func (c *Clientset) CiliumV2() ciliumv2.CiliumV2Interface { - return c.ciliumV2 -} - -// CiliumV2alpha1 retrieves the CiliumV2alpha1Client -func (c *Clientset) CiliumV2alpha1() ciliumv2alpha1.CiliumV2alpha1Interface { - return c.ciliumV2alpha1 -} - -// Discovery retrieves the DiscoveryClient -func (c *Clientset) Discovery() discovery.DiscoveryInterface { - if c == nil { - return nil - } - return c.DiscoveryClient -} - -// NewForConfig creates a new Clientset for the given config. -// If config's RateLimiter is not set and QPS and Burst are acceptable, -// NewForConfig will generate a rate-limiter in configShallowCopy. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*Clientset, error) { - configShallowCopy := *c - - if configShallowCopy.UserAgent == "" { - configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent() - } - - // share the transport between all clients - httpClient, err := rest.HTTPClientFor(&configShallowCopy) - if err != nil { - return nil, err - } - - return NewForConfigAndClient(&configShallowCopy, httpClient) -} - -// NewForConfigAndClient creates a new Clientset for the given config and http client. -// Note the http client provided takes precedence over the configured transport values. -// If config's RateLimiter is not set and QPS and Burst are acceptable, -// NewForConfigAndClient will generate a rate-limiter in configShallowCopy. -func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) { - configShallowCopy := *c - if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { - if configShallowCopy.Burst <= 0 { - return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") - } - configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) - } - - var cs Clientset - var err error - cs.ciliumV2, err = ciliumv2.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - cs.ciliumV2alpha1, err = ciliumv2alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - - cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - return &cs, nil -} - -// NewForConfigOrDie creates a new Clientset for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *Clientset { - cs, err := NewForConfig(c) - if err != nil { - panic(err) - } - return cs -} - -// New creates a new Clientset for the given RESTClient. -func New(c rest.Interface) *Clientset { - var cs Clientset - cs.ciliumV2 = ciliumv2.New(c) - cs.ciliumV2alpha1 = ciliumv2alpha1.New(c) - - cs.DiscoveryClient = discovery.NewDiscoveryClient(c) - return &cs -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/fake/clientset_generated.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/fake/clientset_generated.go deleted file mode 100644 index f39a5d25e..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/fake/clientset_generated.go +++ /dev/null @@ -1,79 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - clientset "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned" - ciliumv2 "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2" - fakeciliumv2 "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake" - ciliumv2alpha1 "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1" - fakeciliumv2alpha1 "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/watch" - "k8s.io/client-go/discovery" - fakediscovery "k8s.io/client-go/discovery/fake" - "k8s.io/client-go/testing" -) - -// NewSimpleClientset returns a clientset that will respond with the provided objects. -// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any validations and/or defaults. It shouldn't be considered a replacement -// for a real clientset and is mostly useful in simple unit tests. -func NewSimpleClientset(objects ...runtime.Object) *Clientset { - o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) - for _, obj := range objects { - if err := o.Add(obj); err != nil { - panic(err) - } - } - - cs := &Clientset{tracker: o} - cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} - cs.AddReactor("*", "*", testing.ObjectReaction(o)) - cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { - gvr := action.GetResource() - ns := action.GetNamespace() - watch, err := o.Watch(gvr, ns) - if err != nil { - return false, nil, err - } - return true, watch, nil - }) - - return cs -} - -// Clientset implements clientset.Interface. Meant to be embedded into a -// struct to get a default implementation. This makes faking out just the method -// you want to test easier. -type Clientset struct { - testing.Fake - discovery *fakediscovery.FakeDiscovery - tracker testing.ObjectTracker -} - -func (c *Clientset) Discovery() discovery.DiscoveryInterface { - return c.discovery -} - -func (c *Clientset) Tracker() testing.ObjectTracker { - return c.tracker -} - -var ( - _ clientset.Interface = &Clientset{} - _ testing.FakeClient = &Clientset{} -) - -// CiliumV2 retrieves the CiliumV2Client -func (c *Clientset) CiliumV2() ciliumv2.CiliumV2Interface { - return &fakeciliumv2.FakeCiliumV2{Fake: &c.Fake} -} - -// CiliumV2alpha1 retrieves the CiliumV2alpha1Client -func (c *Clientset) CiliumV2alpha1() ciliumv2alpha1.CiliumV2alpha1Interface { - return &fakeciliumv2alpha1.FakeCiliumV2alpha1{Fake: &c.Fake} -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/fake/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/fake/doc.go deleted file mode 100644 index 1da8cc9d5..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/fake/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated fake clientset. -package fake diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/fake/register.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/fake/register.go deleted file mode 100644 index 22b7a01cc..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/fake/register.go +++ /dev/null @@ -1,45 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - ciliumv2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - ciliumv2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" -) - -var scheme = runtime.NewScheme() -var codecs = serializer.NewCodecFactory(scheme) - -var localSchemeBuilder = runtime.SchemeBuilder{ - ciliumv2.AddToScheme, - ciliumv2alpha1.AddToScheme, -} - -// AddToScheme adds all types of this clientset into the given scheme. This allows composition -// of clientsets, like in: -// -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) -// -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) -// -// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types -// correctly. -var AddToScheme = localSchemeBuilder.AddToScheme - -func init() { - v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) - utilruntime.Must(AddToScheme(scheme)) -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme/doc.go deleted file mode 100644 index ba3451535..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -// This package contains the scheme of the automatically generated clientset. -package scheme diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme/register.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme/register.go deleted file mode 100644 index 59689a040..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme/register.go +++ /dev/null @@ -1,45 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package scheme - -import ( - ciliumv2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - ciliumv2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" -) - -var Scheme = runtime.NewScheme() -var Codecs = serializer.NewCodecFactory(Scheme) -var ParameterCodec = runtime.NewParameterCodec(Scheme) -var localSchemeBuilder = runtime.SchemeBuilder{ - ciliumv2.AddToScheme, - ciliumv2alpha1.AddToScheme, -} - -// AddToScheme adds all types of this clientset into the given scheme. This allows composition -// of clientsets, like in: -// -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) -// -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) -// -// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types -// correctly. -var AddToScheme = localSchemeBuilder.AddToScheme - -func init() { - v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) - utilruntime.Must(AddToScheme(Scheme)) -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/cilium.io_client.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/cilium.io_client.go deleted file mode 100644 index 39002ac0d..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/cilium.io_client.go +++ /dev/null @@ -1,139 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2 - -import ( - "net/http" - - v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" -) - -type CiliumV2Interface interface { - RESTClient() rest.Interface - CiliumClusterwideEnvoyConfigsGetter - CiliumClusterwideNetworkPoliciesGetter - CiliumEgressGatewayPoliciesGetter - CiliumEndpointsGetter - CiliumEnvoyConfigsGetter - CiliumExternalWorkloadsGetter - CiliumIdentitiesGetter - CiliumLocalRedirectPoliciesGetter - CiliumNetworkPoliciesGetter - CiliumNodesGetter -} - -// CiliumV2Client is used to interact with features provided by the cilium.io group. -type CiliumV2Client struct { - restClient rest.Interface -} - -func (c *CiliumV2Client) CiliumClusterwideEnvoyConfigs() CiliumClusterwideEnvoyConfigInterface { - return newCiliumClusterwideEnvoyConfigs(c) -} - -func (c *CiliumV2Client) CiliumClusterwideNetworkPolicies() CiliumClusterwideNetworkPolicyInterface { - return newCiliumClusterwideNetworkPolicies(c) -} - -func (c *CiliumV2Client) CiliumEgressGatewayPolicies() CiliumEgressGatewayPolicyInterface { - return newCiliumEgressGatewayPolicies(c) -} - -func (c *CiliumV2Client) CiliumEndpoints(namespace string) CiliumEndpointInterface { - return newCiliumEndpoints(c, namespace) -} - -func (c *CiliumV2Client) CiliumEnvoyConfigs(namespace string) CiliumEnvoyConfigInterface { - return newCiliumEnvoyConfigs(c, namespace) -} - -func (c *CiliumV2Client) CiliumExternalWorkloads() CiliumExternalWorkloadInterface { - return newCiliumExternalWorkloads(c) -} - -func (c *CiliumV2Client) CiliumIdentities() CiliumIdentityInterface { - return newCiliumIdentities(c) -} - -func (c *CiliumV2Client) CiliumLocalRedirectPolicies(namespace string) CiliumLocalRedirectPolicyInterface { - return newCiliumLocalRedirectPolicies(c, namespace) -} - -func (c *CiliumV2Client) CiliumNetworkPolicies(namespace string) CiliumNetworkPolicyInterface { - return newCiliumNetworkPolicies(c, namespace) -} - -func (c *CiliumV2Client) CiliumNodes() CiliumNodeInterface { - return newCiliumNodes(c) -} - -// NewForConfig creates a new CiliumV2Client for the given config. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*CiliumV2Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - httpClient, err := rest.HTTPClientFor(&config) - if err != nil { - return nil, err - } - return NewForConfigAndClient(&config, httpClient) -} - -// NewForConfigAndClient creates a new CiliumV2Client for the given config and http client. -// Note the http client provided takes precedence over the configured transport values. -func NewForConfigAndClient(c *rest.Config, h *http.Client) (*CiliumV2Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientForConfigAndClient(&config, h) - if err != nil { - return nil, err - } - return &CiliumV2Client{client}, nil -} - -// NewForConfigOrDie creates a new CiliumV2Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *CiliumV2Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new CiliumV2Client for the given RESTClient. -func New(c rest.Interface) *CiliumV2Client { - return &CiliumV2Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v2.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() - - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *CiliumV2Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumclusterwideenvoyconfig.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumclusterwideenvoyconfig.go deleted file mode 100644 index cf8eecec3..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumclusterwideenvoyconfig.go +++ /dev/null @@ -1,155 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2 - -import ( - "context" - "time" - - v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - scheme "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// CiliumClusterwideEnvoyConfigsGetter has a method to return a CiliumClusterwideEnvoyConfigInterface. -// A group's client should implement this interface. -type CiliumClusterwideEnvoyConfigsGetter interface { - CiliumClusterwideEnvoyConfigs() CiliumClusterwideEnvoyConfigInterface -} - -// CiliumClusterwideEnvoyConfigInterface has methods to work with CiliumClusterwideEnvoyConfig resources. -type CiliumClusterwideEnvoyConfigInterface interface { - Create(ctx context.Context, ciliumClusterwideEnvoyConfig *v2.CiliumClusterwideEnvoyConfig, opts v1.CreateOptions) (*v2.CiliumClusterwideEnvoyConfig, error) - Update(ctx context.Context, ciliumClusterwideEnvoyConfig *v2.CiliumClusterwideEnvoyConfig, opts v1.UpdateOptions) (*v2.CiliumClusterwideEnvoyConfig, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.CiliumClusterwideEnvoyConfig, error) - List(ctx context.Context, opts v1.ListOptions) (*v2.CiliumClusterwideEnvoyConfigList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumClusterwideEnvoyConfig, err error) - CiliumClusterwideEnvoyConfigExpansion -} - -// ciliumClusterwideEnvoyConfigs implements CiliumClusterwideEnvoyConfigInterface -type ciliumClusterwideEnvoyConfigs struct { - client rest.Interface -} - -// newCiliumClusterwideEnvoyConfigs returns a CiliumClusterwideEnvoyConfigs -func newCiliumClusterwideEnvoyConfigs(c *CiliumV2Client) *ciliumClusterwideEnvoyConfigs { - return &ciliumClusterwideEnvoyConfigs{ - client: c.RESTClient(), - } -} - -// Get takes name of the ciliumClusterwideEnvoyConfig, and returns the corresponding ciliumClusterwideEnvoyConfig object, and an error if there is any. -func (c *ciliumClusterwideEnvoyConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.CiliumClusterwideEnvoyConfig, err error) { - result = &v2.CiliumClusterwideEnvoyConfig{} - err = c.client.Get(). - Resource("ciliumclusterwideenvoyconfigs"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CiliumClusterwideEnvoyConfigs that match those selectors. -func (c *ciliumClusterwideEnvoyConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2.CiliumClusterwideEnvoyConfigList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2.CiliumClusterwideEnvoyConfigList{} - err = c.client.Get(). - Resource("ciliumclusterwideenvoyconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ciliumClusterwideEnvoyConfigs. -func (c *ciliumClusterwideEnvoyConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("ciliumclusterwideenvoyconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ciliumClusterwideEnvoyConfig and creates it. Returns the server's representation of the ciliumClusterwideEnvoyConfig, and an error, if there is any. -func (c *ciliumClusterwideEnvoyConfigs) Create(ctx context.Context, ciliumClusterwideEnvoyConfig *v2.CiliumClusterwideEnvoyConfig, opts v1.CreateOptions) (result *v2.CiliumClusterwideEnvoyConfig, err error) { - result = &v2.CiliumClusterwideEnvoyConfig{} - err = c.client.Post(). - Resource("ciliumclusterwideenvoyconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumClusterwideEnvoyConfig). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ciliumClusterwideEnvoyConfig and updates it. Returns the server's representation of the ciliumClusterwideEnvoyConfig, and an error, if there is any. -func (c *ciliumClusterwideEnvoyConfigs) Update(ctx context.Context, ciliumClusterwideEnvoyConfig *v2.CiliumClusterwideEnvoyConfig, opts v1.UpdateOptions) (result *v2.CiliumClusterwideEnvoyConfig, err error) { - result = &v2.CiliumClusterwideEnvoyConfig{} - err = c.client.Put(). - Resource("ciliumclusterwideenvoyconfigs"). - Name(ciliumClusterwideEnvoyConfig.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumClusterwideEnvoyConfig). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ciliumClusterwideEnvoyConfig and deletes it. Returns an error if one occurs. -func (c *ciliumClusterwideEnvoyConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("ciliumclusterwideenvoyconfigs"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ciliumClusterwideEnvoyConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("ciliumclusterwideenvoyconfigs"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ciliumClusterwideEnvoyConfig. -func (c *ciliumClusterwideEnvoyConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumClusterwideEnvoyConfig, err error) { - result = &v2.CiliumClusterwideEnvoyConfig{} - err = c.client.Patch(pt). - Resource("ciliumclusterwideenvoyconfigs"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumclusterwidenetworkpolicy.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumclusterwidenetworkpolicy.go deleted file mode 100644 index 56cde2626..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumclusterwidenetworkpolicy.go +++ /dev/null @@ -1,171 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2 - -import ( - "context" - "time" - - v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - scheme "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// CiliumClusterwideNetworkPoliciesGetter has a method to return a CiliumClusterwideNetworkPolicyInterface. -// A group's client should implement this interface. -type CiliumClusterwideNetworkPoliciesGetter interface { - CiliumClusterwideNetworkPolicies() CiliumClusterwideNetworkPolicyInterface -} - -// CiliumClusterwideNetworkPolicyInterface has methods to work with CiliumClusterwideNetworkPolicy resources. -type CiliumClusterwideNetworkPolicyInterface interface { - Create(ctx context.Context, ciliumClusterwideNetworkPolicy *v2.CiliumClusterwideNetworkPolicy, opts v1.CreateOptions) (*v2.CiliumClusterwideNetworkPolicy, error) - Update(ctx context.Context, ciliumClusterwideNetworkPolicy *v2.CiliumClusterwideNetworkPolicy, opts v1.UpdateOptions) (*v2.CiliumClusterwideNetworkPolicy, error) - UpdateStatus(ctx context.Context, ciliumClusterwideNetworkPolicy *v2.CiliumClusterwideNetworkPolicy, opts v1.UpdateOptions) (*v2.CiliumClusterwideNetworkPolicy, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.CiliumClusterwideNetworkPolicy, error) - List(ctx context.Context, opts v1.ListOptions) (*v2.CiliumClusterwideNetworkPolicyList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumClusterwideNetworkPolicy, err error) - CiliumClusterwideNetworkPolicyExpansion -} - -// ciliumClusterwideNetworkPolicies implements CiliumClusterwideNetworkPolicyInterface -type ciliumClusterwideNetworkPolicies struct { - client rest.Interface -} - -// newCiliumClusterwideNetworkPolicies returns a CiliumClusterwideNetworkPolicies -func newCiliumClusterwideNetworkPolicies(c *CiliumV2Client) *ciliumClusterwideNetworkPolicies { - return &ciliumClusterwideNetworkPolicies{ - client: c.RESTClient(), - } -} - -// Get takes name of the ciliumClusterwideNetworkPolicy, and returns the corresponding ciliumClusterwideNetworkPolicy object, and an error if there is any. -func (c *ciliumClusterwideNetworkPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.CiliumClusterwideNetworkPolicy, err error) { - result = &v2.CiliumClusterwideNetworkPolicy{} - err = c.client.Get(). - Resource("ciliumclusterwidenetworkpolicies"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CiliumClusterwideNetworkPolicies that match those selectors. -func (c *ciliumClusterwideNetworkPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2.CiliumClusterwideNetworkPolicyList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2.CiliumClusterwideNetworkPolicyList{} - err = c.client.Get(). - Resource("ciliumclusterwidenetworkpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ciliumClusterwideNetworkPolicies. -func (c *ciliumClusterwideNetworkPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("ciliumclusterwidenetworkpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ciliumClusterwideNetworkPolicy and creates it. Returns the server's representation of the ciliumClusterwideNetworkPolicy, and an error, if there is any. -func (c *ciliumClusterwideNetworkPolicies) Create(ctx context.Context, ciliumClusterwideNetworkPolicy *v2.CiliumClusterwideNetworkPolicy, opts v1.CreateOptions) (result *v2.CiliumClusterwideNetworkPolicy, err error) { - result = &v2.CiliumClusterwideNetworkPolicy{} - err = c.client.Post(). - Resource("ciliumclusterwidenetworkpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumClusterwideNetworkPolicy). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ciliumClusterwideNetworkPolicy and updates it. Returns the server's representation of the ciliumClusterwideNetworkPolicy, and an error, if there is any. -func (c *ciliumClusterwideNetworkPolicies) Update(ctx context.Context, ciliumClusterwideNetworkPolicy *v2.CiliumClusterwideNetworkPolicy, opts v1.UpdateOptions) (result *v2.CiliumClusterwideNetworkPolicy, err error) { - result = &v2.CiliumClusterwideNetworkPolicy{} - err = c.client.Put(). - Resource("ciliumclusterwidenetworkpolicies"). - Name(ciliumClusterwideNetworkPolicy.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumClusterwideNetworkPolicy). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *ciliumClusterwideNetworkPolicies) UpdateStatus(ctx context.Context, ciliumClusterwideNetworkPolicy *v2.CiliumClusterwideNetworkPolicy, opts v1.UpdateOptions) (result *v2.CiliumClusterwideNetworkPolicy, err error) { - result = &v2.CiliumClusterwideNetworkPolicy{} - err = c.client.Put(). - Resource("ciliumclusterwidenetworkpolicies"). - Name(ciliumClusterwideNetworkPolicy.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumClusterwideNetworkPolicy). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ciliumClusterwideNetworkPolicy and deletes it. Returns an error if one occurs. -func (c *ciliumClusterwideNetworkPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("ciliumclusterwidenetworkpolicies"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ciliumClusterwideNetworkPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("ciliumclusterwidenetworkpolicies"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ciliumClusterwideNetworkPolicy. -func (c *ciliumClusterwideNetworkPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumClusterwideNetworkPolicy, err error) { - result = &v2.CiliumClusterwideNetworkPolicy{} - err = c.client.Patch(pt). - Resource("ciliumclusterwidenetworkpolicies"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumegressgatewaypolicy.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumegressgatewaypolicy.go deleted file mode 100644 index 625a89b74..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumegressgatewaypolicy.go +++ /dev/null @@ -1,155 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2 - -import ( - "context" - "time" - - v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - scheme "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// CiliumEgressGatewayPoliciesGetter has a method to return a CiliumEgressGatewayPolicyInterface. -// A group's client should implement this interface. -type CiliumEgressGatewayPoliciesGetter interface { - CiliumEgressGatewayPolicies() CiliumEgressGatewayPolicyInterface -} - -// CiliumEgressGatewayPolicyInterface has methods to work with CiliumEgressGatewayPolicy resources. -type CiliumEgressGatewayPolicyInterface interface { - Create(ctx context.Context, ciliumEgressGatewayPolicy *v2.CiliumEgressGatewayPolicy, opts v1.CreateOptions) (*v2.CiliumEgressGatewayPolicy, error) - Update(ctx context.Context, ciliumEgressGatewayPolicy *v2.CiliumEgressGatewayPolicy, opts v1.UpdateOptions) (*v2.CiliumEgressGatewayPolicy, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.CiliumEgressGatewayPolicy, error) - List(ctx context.Context, opts v1.ListOptions) (*v2.CiliumEgressGatewayPolicyList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumEgressGatewayPolicy, err error) - CiliumEgressGatewayPolicyExpansion -} - -// ciliumEgressGatewayPolicies implements CiliumEgressGatewayPolicyInterface -type ciliumEgressGatewayPolicies struct { - client rest.Interface -} - -// newCiliumEgressGatewayPolicies returns a CiliumEgressGatewayPolicies -func newCiliumEgressGatewayPolicies(c *CiliumV2Client) *ciliumEgressGatewayPolicies { - return &ciliumEgressGatewayPolicies{ - client: c.RESTClient(), - } -} - -// Get takes name of the ciliumEgressGatewayPolicy, and returns the corresponding ciliumEgressGatewayPolicy object, and an error if there is any. -func (c *ciliumEgressGatewayPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.CiliumEgressGatewayPolicy, err error) { - result = &v2.CiliumEgressGatewayPolicy{} - err = c.client.Get(). - Resource("ciliumegressgatewaypolicies"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CiliumEgressGatewayPolicies that match those selectors. -func (c *ciliumEgressGatewayPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2.CiliumEgressGatewayPolicyList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2.CiliumEgressGatewayPolicyList{} - err = c.client.Get(). - Resource("ciliumegressgatewaypolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ciliumEgressGatewayPolicies. -func (c *ciliumEgressGatewayPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("ciliumegressgatewaypolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ciliumEgressGatewayPolicy and creates it. Returns the server's representation of the ciliumEgressGatewayPolicy, and an error, if there is any. -func (c *ciliumEgressGatewayPolicies) Create(ctx context.Context, ciliumEgressGatewayPolicy *v2.CiliumEgressGatewayPolicy, opts v1.CreateOptions) (result *v2.CiliumEgressGatewayPolicy, err error) { - result = &v2.CiliumEgressGatewayPolicy{} - err = c.client.Post(). - Resource("ciliumegressgatewaypolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumEgressGatewayPolicy). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ciliumEgressGatewayPolicy and updates it. Returns the server's representation of the ciliumEgressGatewayPolicy, and an error, if there is any. -func (c *ciliumEgressGatewayPolicies) Update(ctx context.Context, ciliumEgressGatewayPolicy *v2.CiliumEgressGatewayPolicy, opts v1.UpdateOptions) (result *v2.CiliumEgressGatewayPolicy, err error) { - result = &v2.CiliumEgressGatewayPolicy{} - err = c.client.Put(). - Resource("ciliumegressgatewaypolicies"). - Name(ciliumEgressGatewayPolicy.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumEgressGatewayPolicy). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ciliumEgressGatewayPolicy and deletes it. Returns an error if one occurs. -func (c *ciliumEgressGatewayPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("ciliumegressgatewaypolicies"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ciliumEgressGatewayPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("ciliumegressgatewaypolicies"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ciliumEgressGatewayPolicy. -func (c *ciliumEgressGatewayPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumEgressGatewayPolicy, err error) { - result = &v2.CiliumEgressGatewayPolicy{} - err = c.client.Patch(pt). - Resource("ciliumegressgatewaypolicies"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumendpoint.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumendpoint.go deleted file mode 100644 index 3cd66d46a..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumendpoint.go +++ /dev/null @@ -1,182 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2 - -import ( - "context" - "time" - - v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - scheme "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// CiliumEndpointsGetter has a method to return a CiliumEndpointInterface. -// A group's client should implement this interface. -type CiliumEndpointsGetter interface { - CiliumEndpoints(namespace string) CiliumEndpointInterface -} - -// CiliumEndpointInterface has methods to work with CiliumEndpoint resources. -type CiliumEndpointInterface interface { - Create(ctx context.Context, ciliumEndpoint *v2.CiliumEndpoint, opts v1.CreateOptions) (*v2.CiliumEndpoint, error) - Update(ctx context.Context, ciliumEndpoint *v2.CiliumEndpoint, opts v1.UpdateOptions) (*v2.CiliumEndpoint, error) - UpdateStatus(ctx context.Context, ciliumEndpoint *v2.CiliumEndpoint, opts v1.UpdateOptions) (*v2.CiliumEndpoint, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.CiliumEndpoint, error) - List(ctx context.Context, opts v1.ListOptions) (*v2.CiliumEndpointList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumEndpoint, err error) - CiliumEndpointExpansion -} - -// ciliumEndpoints implements CiliumEndpointInterface -type ciliumEndpoints struct { - client rest.Interface - ns string -} - -// newCiliumEndpoints returns a CiliumEndpoints -func newCiliumEndpoints(c *CiliumV2Client, namespace string) *ciliumEndpoints { - return &ciliumEndpoints{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the ciliumEndpoint, and returns the corresponding ciliumEndpoint object, and an error if there is any. -func (c *ciliumEndpoints) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.CiliumEndpoint, err error) { - result = &v2.CiliumEndpoint{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ciliumendpoints"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CiliumEndpoints that match those selectors. -func (c *ciliumEndpoints) List(ctx context.Context, opts v1.ListOptions) (result *v2.CiliumEndpointList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2.CiliumEndpointList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ciliumendpoints"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ciliumEndpoints. -func (c *ciliumEndpoints) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("ciliumendpoints"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ciliumEndpoint and creates it. Returns the server's representation of the ciliumEndpoint, and an error, if there is any. -func (c *ciliumEndpoints) Create(ctx context.Context, ciliumEndpoint *v2.CiliumEndpoint, opts v1.CreateOptions) (result *v2.CiliumEndpoint, err error) { - result = &v2.CiliumEndpoint{} - err = c.client.Post(). - Namespace(c.ns). - Resource("ciliumendpoints"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumEndpoint). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ciliumEndpoint and updates it. Returns the server's representation of the ciliumEndpoint, and an error, if there is any. -func (c *ciliumEndpoints) Update(ctx context.Context, ciliumEndpoint *v2.CiliumEndpoint, opts v1.UpdateOptions) (result *v2.CiliumEndpoint, err error) { - result = &v2.CiliumEndpoint{} - err = c.client.Put(). - Namespace(c.ns). - Resource("ciliumendpoints"). - Name(ciliumEndpoint.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumEndpoint). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *ciliumEndpoints) UpdateStatus(ctx context.Context, ciliumEndpoint *v2.CiliumEndpoint, opts v1.UpdateOptions) (result *v2.CiliumEndpoint, err error) { - result = &v2.CiliumEndpoint{} - err = c.client.Put(). - Namespace(c.ns). - Resource("ciliumendpoints"). - Name(ciliumEndpoint.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumEndpoint). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ciliumEndpoint and deletes it. Returns an error if one occurs. -func (c *ciliumEndpoints) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("ciliumendpoints"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ciliumEndpoints) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("ciliumendpoints"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ciliumEndpoint. -func (c *ciliumEndpoints) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumEndpoint, err error) { - result = &v2.CiliumEndpoint{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("ciliumendpoints"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumenvoyconfig.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumenvoyconfig.go deleted file mode 100644 index 9f5acd456..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumenvoyconfig.go +++ /dev/null @@ -1,165 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2 - -import ( - "context" - "time" - - v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - scheme "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// CiliumEnvoyConfigsGetter has a method to return a CiliumEnvoyConfigInterface. -// A group's client should implement this interface. -type CiliumEnvoyConfigsGetter interface { - CiliumEnvoyConfigs(namespace string) CiliumEnvoyConfigInterface -} - -// CiliumEnvoyConfigInterface has methods to work with CiliumEnvoyConfig resources. -type CiliumEnvoyConfigInterface interface { - Create(ctx context.Context, ciliumEnvoyConfig *v2.CiliumEnvoyConfig, opts v1.CreateOptions) (*v2.CiliumEnvoyConfig, error) - Update(ctx context.Context, ciliumEnvoyConfig *v2.CiliumEnvoyConfig, opts v1.UpdateOptions) (*v2.CiliumEnvoyConfig, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.CiliumEnvoyConfig, error) - List(ctx context.Context, opts v1.ListOptions) (*v2.CiliumEnvoyConfigList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumEnvoyConfig, err error) - CiliumEnvoyConfigExpansion -} - -// ciliumEnvoyConfigs implements CiliumEnvoyConfigInterface -type ciliumEnvoyConfigs struct { - client rest.Interface - ns string -} - -// newCiliumEnvoyConfigs returns a CiliumEnvoyConfigs -func newCiliumEnvoyConfigs(c *CiliumV2Client, namespace string) *ciliumEnvoyConfigs { - return &ciliumEnvoyConfigs{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the ciliumEnvoyConfig, and returns the corresponding ciliumEnvoyConfig object, and an error if there is any. -func (c *ciliumEnvoyConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.CiliumEnvoyConfig, err error) { - result = &v2.CiliumEnvoyConfig{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ciliumenvoyconfigs"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CiliumEnvoyConfigs that match those selectors. -func (c *ciliumEnvoyConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2.CiliumEnvoyConfigList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2.CiliumEnvoyConfigList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ciliumenvoyconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ciliumEnvoyConfigs. -func (c *ciliumEnvoyConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("ciliumenvoyconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ciliumEnvoyConfig and creates it. Returns the server's representation of the ciliumEnvoyConfig, and an error, if there is any. -func (c *ciliumEnvoyConfigs) Create(ctx context.Context, ciliumEnvoyConfig *v2.CiliumEnvoyConfig, opts v1.CreateOptions) (result *v2.CiliumEnvoyConfig, err error) { - result = &v2.CiliumEnvoyConfig{} - err = c.client.Post(). - Namespace(c.ns). - Resource("ciliumenvoyconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumEnvoyConfig). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ciliumEnvoyConfig and updates it. Returns the server's representation of the ciliumEnvoyConfig, and an error, if there is any. -func (c *ciliumEnvoyConfigs) Update(ctx context.Context, ciliumEnvoyConfig *v2.CiliumEnvoyConfig, opts v1.UpdateOptions) (result *v2.CiliumEnvoyConfig, err error) { - result = &v2.CiliumEnvoyConfig{} - err = c.client.Put(). - Namespace(c.ns). - Resource("ciliumenvoyconfigs"). - Name(ciliumEnvoyConfig.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumEnvoyConfig). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ciliumEnvoyConfig and deletes it. Returns an error if one occurs. -func (c *ciliumEnvoyConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("ciliumenvoyconfigs"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ciliumEnvoyConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("ciliumenvoyconfigs"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ciliumEnvoyConfig. -func (c *ciliumEnvoyConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumEnvoyConfig, err error) { - result = &v2.CiliumEnvoyConfig{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("ciliumenvoyconfigs"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumexternalworkload.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumexternalworkload.go deleted file mode 100644 index 261cbfeed..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumexternalworkload.go +++ /dev/null @@ -1,171 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2 - -import ( - "context" - "time" - - v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - scheme "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// CiliumExternalWorkloadsGetter has a method to return a CiliumExternalWorkloadInterface. -// A group's client should implement this interface. -type CiliumExternalWorkloadsGetter interface { - CiliumExternalWorkloads() CiliumExternalWorkloadInterface -} - -// CiliumExternalWorkloadInterface has methods to work with CiliumExternalWorkload resources. -type CiliumExternalWorkloadInterface interface { - Create(ctx context.Context, ciliumExternalWorkload *v2.CiliumExternalWorkload, opts v1.CreateOptions) (*v2.CiliumExternalWorkload, error) - Update(ctx context.Context, ciliumExternalWorkload *v2.CiliumExternalWorkload, opts v1.UpdateOptions) (*v2.CiliumExternalWorkload, error) - UpdateStatus(ctx context.Context, ciliumExternalWorkload *v2.CiliumExternalWorkload, opts v1.UpdateOptions) (*v2.CiliumExternalWorkload, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.CiliumExternalWorkload, error) - List(ctx context.Context, opts v1.ListOptions) (*v2.CiliumExternalWorkloadList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumExternalWorkload, err error) - CiliumExternalWorkloadExpansion -} - -// ciliumExternalWorkloads implements CiliumExternalWorkloadInterface -type ciliumExternalWorkloads struct { - client rest.Interface -} - -// newCiliumExternalWorkloads returns a CiliumExternalWorkloads -func newCiliumExternalWorkloads(c *CiliumV2Client) *ciliumExternalWorkloads { - return &ciliumExternalWorkloads{ - client: c.RESTClient(), - } -} - -// Get takes name of the ciliumExternalWorkload, and returns the corresponding ciliumExternalWorkload object, and an error if there is any. -func (c *ciliumExternalWorkloads) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.CiliumExternalWorkload, err error) { - result = &v2.CiliumExternalWorkload{} - err = c.client.Get(). - Resource("ciliumexternalworkloads"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CiliumExternalWorkloads that match those selectors. -func (c *ciliumExternalWorkloads) List(ctx context.Context, opts v1.ListOptions) (result *v2.CiliumExternalWorkloadList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2.CiliumExternalWorkloadList{} - err = c.client.Get(). - Resource("ciliumexternalworkloads"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ciliumExternalWorkloads. -func (c *ciliumExternalWorkloads) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("ciliumexternalworkloads"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ciliumExternalWorkload and creates it. Returns the server's representation of the ciliumExternalWorkload, and an error, if there is any. -func (c *ciliumExternalWorkloads) Create(ctx context.Context, ciliumExternalWorkload *v2.CiliumExternalWorkload, opts v1.CreateOptions) (result *v2.CiliumExternalWorkload, err error) { - result = &v2.CiliumExternalWorkload{} - err = c.client.Post(). - Resource("ciliumexternalworkloads"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumExternalWorkload). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ciliumExternalWorkload and updates it. Returns the server's representation of the ciliumExternalWorkload, and an error, if there is any. -func (c *ciliumExternalWorkloads) Update(ctx context.Context, ciliumExternalWorkload *v2.CiliumExternalWorkload, opts v1.UpdateOptions) (result *v2.CiliumExternalWorkload, err error) { - result = &v2.CiliumExternalWorkload{} - err = c.client.Put(). - Resource("ciliumexternalworkloads"). - Name(ciliumExternalWorkload.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumExternalWorkload). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *ciliumExternalWorkloads) UpdateStatus(ctx context.Context, ciliumExternalWorkload *v2.CiliumExternalWorkload, opts v1.UpdateOptions) (result *v2.CiliumExternalWorkload, err error) { - result = &v2.CiliumExternalWorkload{} - err = c.client.Put(). - Resource("ciliumexternalworkloads"). - Name(ciliumExternalWorkload.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumExternalWorkload). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ciliumExternalWorkload and deletes it. Returns an error if one occurs. -func (c *ciliumExternalWorkloads) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("ciliumexternalworkloads"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ciliumExternalWorkloads) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("ciliumexternalworkloads"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ciliumExternalWorkload. -func (c *ciliumExternalWorkloads) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumExternalWorkload, err error) { - result = &v2.CiliumExternalWorkload{} - err = c.client.Patch(pt). - Resource("ciliumexternalworkloads"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumidentity.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumidentity.go deleted file mode 100644 index c23f01726..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumidentity.go +++ /dev/null @@ -1,155 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2 - -import ( - "context" - "time" - - v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - scheme "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// CiliumIdentitiesGetter has a method to return a CiliumIdentityInterface. -// A group's client should implement this interface. -type CiliumIdentitiesGetter interface { - CiliumIdentities() CiliumIdentityInterface -} - -// CiliumIdentityInterface has methods to work with CiliumIdentity resources. -type CiliumIdentityInterface interface { - Create(ctx context.Context, ciliumIdentity *v2.CiliumIdentity, opts v1.CreateOptions) (*v2.CiliumIdentity, error) - Update(ctx context.Context, ciliumIdentity *v2.CiliumIdentity, opts v1.UpdateOptions) (*v2.CiliumIdentity, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.CiliumIdentity, error) - List(ctx context.Context, opts v1.ListOptions) (*v2.CiliumIdentityList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumIdentity, err error) - CiliumIdentityExpansion -} - -// ciliumIdentities implements CiliumIdentityInterface -type ciliumIdentities struct { - client rest.Interface -} - -// newCiliumIdentities returns a CiliumIdentities -func newCiliumIdentities(c *CiliumV2Client) *ciliumIdentities { - return &ciliumIdentities{ - client: c.RESTClient(), - } -} - -// Get takes name of the ciliumIdentity, and returns the corresponding ciliumIdentity object, and an error if there is any. -func (c *ciliumIdentities) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.CiliumIdentity, err error) { - result = &v2.CiliumIdentity{} - err = c.client.Get(). - Resource("ciliumidentities"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CiliumIdentities that match those selectors. -func (c *ciliumIdentities) List(ctx context.Context, opts v1.ListOptions) (result *v2.CiliumIdentityList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2.CiliumIdentityList{} - err = c.client.Get(). - Resource("ciliumidentities"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ciliumIdentities. -func (c *ciliumIdentities) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("ciliumidentities"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ciliumIdentity and creates it. Returns the server's representation of the ciliumIdentity, and an error, if there is any. -func (c *ciliumIdentities) Create(ctx context.Context, ciliumIdentity *v2.CiliumIdentity, opts v1.CreateOptions) (result *v2.CiliumIdentity, err error) { - result = &v2.CiliumIdentity{} - err = c.client.Post(). - Resource("ciliumidentities"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumIdentity). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ciliumIdentity and updates it. Returns the server's representation of the ciliumIdentity, and an error, if there is any. -func (c *ciliumIdentities) Update(ctx context.Context, ciliumIdentity *v2.CiliumIdentity, opts v1.UpdateOptions) (result *v2.CiliumIdentity, err error) { - result = &v2.CiliumIdentity{} - err = c.client.Put(). - Resource("ciliumidentities"). - Name(ciliumIdentity.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumIdentity). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ciliumIdentity and deletes it. Returns an error if one occurs. -func (c *ciliumIdentities) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("ciliumidentities"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ciliumIdentities) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("ciliumidentities"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ciliumIdentity. -func (c *ciliumIdentities) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumIdentity, err error) { - result = &v2.CiliumIdentity{} - err = c.client.Patch(pt). - Resource("ciliumidentities"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumlocalredirectpolicy.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumlocalredirectpolicy.go deleted file mode 100644 index 9c839eb94..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumlocalredirectpolicy.go +++ /dev/null @@ -1,182 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2 - -import ( - "context" - "time" - - v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - scheme "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// CiliumLocalRedirectPoliciesGetter has a method to return a CiliumLocalRedirectPolicyInterface. -// A group's client should implement this interface. -type CiliumLocalRedirectPoliciesGetter interface { - CiliumLocalRedirectPolicies(namespace string) CiliumLocalRedirectPolicyInterface -} - -// CiliumLocalRedirectPolicyInterface has methods to work with CiliumLocalRedirectPolicy resources. -type CiliumLocalRedirectPolicyInterface interface { - Create(ctx context.Context, ciliumLocalRedirectPolicy *v2.CiliumLocalRedirectPolicy, opts v1.CreateOptions) (*v2.CiliumLocalRedirectPolicy, error) - Update(ctx context.Context, ciliumLocalRedirectPolicy *v2.CiliumLocalRedirectPolicy, opts v1.UpdateOptions) (*v2.CiliumLocalRedirectPolicy, error) - UpdateStatus(ctx context.Context, ciliumLocalRedirectPolicy *v2.CiliumLocalRedirectPolicy, opts v1.UpdateOptions) (*v2.CiliumLocalRedirectPolicy, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.CiliumLocalRedirectPolicy, error) - List(ctx context.Context, opts v1.ListOptions) (*v2.CiliumLocalRedirectPolicyList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumLocalRedirectPolicy, err error) - CiliumLocalRedirectPolicyExpansion -} - -// ciliumLocalRedirectPolicies implements CiliumLocalRedirectPolicyInterface -type ciliumLocalRedirectPolicies struct { - client rest.Interface - ns string -} - -// newCiliumLocalRedirectPolicies returns a CiliumLocalRedirectPolicies -func newCiliumLocalRedirectPolicies(c *CiliumV2Client, namespace string) *ciliumLocalRedirectPolicies { - return &ciliumLocalRedirectPolicies{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the ciliumLocalRedirectPolicy, and returns the corresponding ciliumLocalRedirectPolicy object, and an error if there is any. -func (c *ciliumLocalRedirectPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.CiliumLocalRedirectPolicy, err error) { - result = &v2.CiliumLocalRedirectPolicy{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ciliumlocalredirectpolicies"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CiliumLocalRedirectPolicies that match those selectors. -func (c *ciliumLocalRedirectPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2.CiliumLocalRedirectPolicyList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2.CiliumLocalRedirectPolicyList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ciliumlocalredirectpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ciliumLocalRedirectPolicies. -func (c *ciliumLocalRedirectPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("ciliumlocalredirectpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ciliumLocalRedirectPolicy and creates it. Returns the server's representation of the ciliumLocalRedirectPolicy, and an error, if there is any. -func (c *ciliumLocalRedirectPolicies) Create(ctx context.Context, ciliumLocalRedirectPolicy *v2.CiliumLocalRedirectPolicy, opts v1.CreateOptions) (result *v2.CiliumLocalRedirectPolicy, err error) { - result = &v2.CiliumLocalRedirectPolicy{} - err = c.client.Post(). - Namespace(c.ns). - Resource("ciliumlocalredirectpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumLocalRedirectPolicy). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ciliumLocalRedirectPolicy and updates it. Returns the server's representation of the ciliumLocalRedirectPolicy, and an error, if there is any. -func (c *ciliumLocalRedirectPolicies) Update(ctx context.Context, ciliumLocalRedirectPolicy *v2.CiliumLocalRedirectPolicy, opts v1.UpdateOptions) (result *v2.CiliumLocalRedirectPolicy, err error) { - result = &v2.CiliumLocalRedirectPolicy{} - err = c.client.Put(). - Namespace(c.ns). - Resource("ciliumlocalredirectpolicies"). - Name(ciliumLocalRedirectPolicy.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumLocalRedirectPolicy). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *ciliumLocalRedirectPolicies) UpdateStatus(ctx context.Context, ciliumLocalRedirectPolicy *v2.CiliumLocalRedirectPolicy, opts v1.UpdateOptions) (result *v2.CiliumLocalRedirectPolicy, err error) { - result = &v2.CiliumLocalRedirectPolicy{} - err = c.client.Put(). - Namespace(c.ns). - Resource("ciliumlocalredirectpolicies"). - Name(ciliumLocalRedirectPolicy.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumLocalRedirectPolicy). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ciliumLocalRedirectPolicy and deletes it. Returns an error if one occurs. -func (c *ciliumLocalRedirectPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("ciliumlocalredirectpolicies"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ciliumLocalRedirectPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("ciliumlocalredirectpolicies"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ciliumLocalRedirectPolicy. -func (c *ciliumLocalRedirectPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumLocalRedirectPolicy, err error) { - result = &v2.CiliumLocalRedirectPolicy{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("ciliumlocalredirectpolicies"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumnetworkpolicy.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumnetworkpolicy.go deleted file mode 100644 index f5d5ae60a..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumnetworkpolicy.go +++ /dev/null @@ -1,182 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2 - -import ( - "context" - "time" - - v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - scheme "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// CiliumNetworkPoliciesGetter has a method to return a CiliumNetworkPolicyInterface. -// A group's client should implement this interface. -type CiliumNetworkPoliciesGetter interface { - CiliumNetworkPolicies(namespace string) CiliumNetworkPolicyInterface -} - -// CiliumNetworkPolicyInterface has methods to work with CiliumNetworkPolicy resources. -type CiliumNetworkPolicyInterface interface { - Create(ctx context.Context, ciliumNetworkPolicy *v2.CiliumNetworkPolicy, opts v1.CreateOptions) (*v2.CiliumNetworkPolicy, error) - Update(ctx context.Context, ciliumNetworkPolicy *v2.CiliumNetworkPolicy, opts v1.UpdateOptions) (*v2.CiliumNetworkPolicy, error) - UpdateStatus(ctx context.Context, ciliumNetworkPolicy *v2.CiliumNetworkPolicy, opts v1.UpdateOptions) (*v2.CiliumNetworkPolicy, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.CiliumNetworkPolicy, error) - List(ctx context.Context, opts v1.ListOptions) (*v2.CiliumNetworkPolicyList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumNetworkPolicy, err error) - CiliumNetworkPolicyExpansion -} - -// ciliumNetworkPolicies implements CiliumNetworkPolicyInterface -type ciliumNetworkPolicies struct { - client rest.Interface - ns string -} - -// newCiliumNetworkPolicies returns a CiliumNetworkPolicies -func newCiliumNetworkPolicies(c *CiliumV2Client, namespace string) *ciliumNetworkPolicies { - return &ciliumNetworkPolicies{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the ciliumNetworkPolicy, and returns the corresponding ciliumNetworkPolicy object, and an error if there is any. -func (c *ciliumNetworkPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.CiliumNetworkPolicy, err error) { - result = &v2.CiliumNetworkPolicy{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ciliumnetworkpolicies"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CiliumNetworkPolicies that match those selectors. -func (c *ciliumNetworkPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2.CiliumNetworkPolicyList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2.CiliumNetworkPolicyList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ciliumnetworkpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ciliumNetworkPolicies. -func (c *ciliumNetworkPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("ciliumnetworkpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ciliumNetworkPolicy and creates it. Returns the server's representation of the ciliumNetworkPolicy, and an error, if there is any. -func (c *ciliumNetworkPolicies) Create(ctx context.Context, ciliumNetworkPolicy *v2.CiliumNetworkPolicy, opts v1.CreateOptions) (result *v2.CiliumNetworkPolicy, err error) { - result = &v2.CiliumNetworkPolicy{} - err = c.client.Post(). - Namespace(c.ns). - Resource("ciliumnetworkpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumNetworkPolicy). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ciliumNetworkPolicy and updates it. Returns the server's representation of the ciliumNetworkPolicy, and an error, if there is any. -func (c *ciliumNetworkPolicies) Update(ctx context.Context, ciliumNetworkPolicy *v2.CiliumNetworkPolicy, opts v1.UpdateOptions) (result *v2.CiliumNetworkPolicy, err error) { - result = &v2.CiliumNetworkPolicy{} - err = c.client.Put(). - Namespace(c.ns). - Resource("ciliumnetworkpolicies"). - Name(ciliumNetworkPolicy.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumNetworkPolicy). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *ciliumNetworkPolicies) UpdateStatus(ctx context.Context, ciliumNetworkPolicy *v2.CiliumNetworkPolicy, opts v1.UpdateOptions) (result *v2.CiliumNetworkPolicy, err error) { - result = &v2.CiliumNetworkPolicy{} - err = c.client.Put(). - Namespace(c.ns). - Resource("ciliumnetworkpolicies"). - Name(ciliumNetworkPolicy.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumNetworkPolicy). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ciliumNetworkPolicy and deletes it. Returns an error if one occurs. -func (c *ciliumNetworkPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("ciliumnetworkpolicies"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ciliumNetworkPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("ciliumnetworkpolicies"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ciliumNetworkPolicy. -func (c *ciliumNetworkPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumNetworkPolicy, err error) { - result = &v2.CiliumNetworkPolicy{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("ciliumnetworkpolicies"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumnode.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumnode.go deleted file mode 100644 index 9cc2e5555..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/ciliumnode.go +++ /dev/null @@ -1,171 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2 - -import ( - "context" - "time" - - v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - scheme "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// CiliumNodesGetter has a method to return a CiliumNodeInterface. -// A group's client should implement this interface. -type CiliumNodesGetter interface { - CiliumNodes() CiliumNodeInterface -} - -// CiliumNodeInterface has methods to work with CiliumNode resources. -type CiliumNodeInterface interface { - Create(ctx context.Context, ciliumNode *v2.CiliumNode, opts v1.CreateOptions) (*v2.CiliumNode, error) - Update(ctx context.Context, ciliumNode *v2.CiliumNode, opts v1.UpdateOptions) (*v2.CiliumNode, error) - UpdateStatus(ctx context.Context, ciliumNode *v2.CiliumNode, opts v1.UpdateOptions) (*v2.CiliumNode, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.CiliumNode, error) - List(ctx context.Context, opts v1.ListOptions) (*v2.CiliumNodeList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumNode, err error) - CiliumNodeExpansion -} - -// ciliumNodes implements CiliumNodeInterface -type ciliumNodes struct { - client rest.Interface -} - -// newCiliumNodes returns a CiliumNodes -func newCiliumNodes(c *CiliumV2Client) *ciliumNodes { - return &ciliumNodes{ - client: c.RESTClient(), - } -} - -// Get takes name of the ciliumNode, and returns the corresponding ciliumNode object, and an error if there is any. -func (c *ciliumNodes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.CiliumNode, err error) { - result = &v2.CiliumNode{} - err = c.client.Get(). - Resource("ciliumnodes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CiliumNodes that match those selectors. -func (c *ciliumNodes) List(ctx context.Context, opts v1.ListOptions) (result *v2.CiliumNodeList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2.CiliumNodeList{} - err = c.client.Get(). - Resource("ciliumnodes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ciliumNodes. -func (c *ciliumNodes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("ciliumnodes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ciliumNode and creates it. Returns the server's representation of the ciliumNode, and an error, if there is any. -func (c *ciliumNodes) Create(ctx context.Context, ciliumNode *v2.CiliumNode, opts v1.CreateOptions) (result *v2.CiliumNode, err error) { - result = &v2.CiliumNode{} - err = c.client.Post(). - Resource("ciliumnodes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumNode). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ciliumNode and updates it. Returns the server's representation of the ciliumNode, and an error, if there is any. -func (c *ciliumNodes) Update(ctx context.Context, ciliumNode *v2.CiliumNode, opts v1.UpdateOptions) (result *v2.CiliumNode, err error) { - result = &v2.CiliumNode{} - err = c.client.Put(). - Resource("ciliumnodes"). - Name(ciliumNode.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumNode). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *ciliumNodes) UpdateStatus(ctx context.Context, ciliumNode *v2.CiliumNode, opts v1.UpdateOptions) (result *v2.CiliumNode, err error) { - result = &v2.CiliumNode{} - err = c.client.Put(). - Resource("ciliumnodes"). - Name(ciliumNode.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumNode). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ciliumNode and deletes it. Returns an error if one occurs. -func (c *ciliumNodes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("ciliumnodes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ciliumNodes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("ciliumnodes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ciliumNode. -func (c *ciliumNodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumNode, err error) { - result = &v2.CiliumNode{} - err = c.client.Patch(pt). - Resource("ciliumnodes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/doc.go deleted file mode 100644 index b3757ef24..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated typed clients. -package v2 diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/doc.go deleted file mode 100644 index 57bd090ef..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -// Package fake has the automatically generated clients. -package fake diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_cilium.io_client.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_cilium.io_client.go deleted file mode 100644 index 9ed059f64..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_cilium.io_client.go +++ /dev/null @@ -1,63 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v2 "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeCiliumV2 struct { - *testing.Fake -} - -func (c *FakeCiliumV2) CiliumClusterwideEnvoyConfigs() v2.CiliumClusterwideEnvoyConfigInterface { - return &FakeCiliumClusterwideEnvoyConfigs{c} -} - -func (c *FakeCiliumV2) CiliumClusterwideNetworkPolicies() v2.CiliumClusterwideNetworkPolicyInterface { - return &FakeCiliumClusterwideNetworkPolicies{c} -} - -func (c *FakeCiliumV2) CiliumEgressGatewayPolicies() v2.CiliumEgressGatewayPolicyInterface { - return &FakeCiliumEgressGatewayPolicies{c} -} - -func (c *FakeCiliumV2) CiliumEndpoints(namespace string) v2.CiliumEndpointInterface { - return &FakeCiliumEndpoints{c, namespace} -} - -func (c *FakeCiliumV2) CiliumEnvoyConfigs(namespace string) v2.CiliumEnvoyConfigInterface { - return &FakeCiliumEnvoyConfigs{c, namespace} -} - -func (c *FakeCiliumV2) CiliumExternalWorkloads() v2.CiliumExternalWorkloadInterface { - return &FakeCiliumExternalWorkloads{c} -} - -func (c *FakeCiliumV2) CiliumIdentities() v2.CiliumIdentityInterface { - return &FakeCiliumIdentities{c} -} - -func (c *FakeCiliumV2) CiliumLocalRedirectPolicies(namespace string) v2.CiliumLocalRedirectPolicyInterface { - return &FakeCiliumLocalRedirectPolicies{c, namespace} -} - -func (c *FakeCiliumV2) CiliumNetworkPolicies(namespace string) v2.CiliumNetworkPolicyInterface { - return &FakeCiliumNetworkPolicies{c, namespace} -} - -func (c *FakeCiliumV2) CiliumNodes() v2.CiliumNodeInterface { - return &FakeCiliumNodes{c} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeCiliumV2) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumclusterwideenvoyconfig.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumclusterwideenvoyconfig.go deleted file mode 100644 index ecabad97a..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumclusterwideenvoyconfig.go +++ /dev/null @@ -1,108 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeCiliumClusterwideEnvoyConfigs implements CiliumClusterwideEnvoyConfigInterface -type FakeCiliumClusterwideEnvoyConfigs struct { - Fake *FakeCiliumV2 -} - -var ciliumclusterwideenvoyconfigsResource = v2.SchemeGroupVersion.WithResource("ciliumclusterwideenvoyconfigs") - -var ciliumclusterwideenvoyconfigsKind = v2.SchemeGroupVersion.WithKind("CiliumClusterwideEnvoyConfig") - -// Get takes name of the ciliumClusterwideEnvoyConfig, and returns the corresponding ciliumClusterwideEnvoyConfig object, and an error if there is any. -func (c *FakeCiliumClusterwideEnvoyConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.CiliumClusterwideEnvoyConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(ciliumclusterwideenvoyconfigsResource, name), &v2.CiliumClusterwideEnvoyConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumClusterwideEnvoyConfig), err -} - -// List takes label and field selectors, and returns the list of CiliumClusterwideEnvoyConfigs that match those selectors. -func (c *FakeCiliumClusterwideEnvoyConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2.CiliumClusterwideEnvoyConfigList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(ciliumclusterwideenvoyconfigsResource, ciliumclusterwideenvoyconfigsKind, opts), &v2.CiliumClusterwideEnvoyConfigList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2.CiliumClusterwideEnvoyConfigList{ListMeta: obj.(*v2.CiliumClusterwideEnvoyConfigList).ListMeta} - for _, item := range obj.(*v2.CiliumClusterwideEnvoyConfigList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ciliumClusterwideEnvoyConfigs. -func (c *FakeCiliumClusterwideEnvoyConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(ciliumclusterwideenvoyconfigsResource, opts)) -} - -// Create takes the representation of a ciliumClusterwideEnvoyConfig and creates it. Returns the server's representation of the ciliumClusterwideEnvoyConfig, and an error, if there is any. -func (c *FakeCiliumClusterwideEnvoyConfigs) Create(ctx context.Context, ciliumClusterwideEnvoyConfig *v2.CiliumClusterwideEnvoyConfig, opts v1.CreateOptions) (result *v2.CiliumClusterwideEnvoyConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(ciliumclusterwideenvoyconfigsResource, ciliumClusterwideEnvoyConfig), &v2.CiliumClusterwideEnvoyConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumClusterwideEnvoyConfig), err -} - -// Update takes the representation of a ciliumClusterwideEnvoyConfig and updates it. Returns the server's representation of the ciliumClusterwideEnvoyConfig, and an error, if there is any. -func (c *FakeCiliumClusterwideEnvoyConfigs) Update(ctx context.Context, ciliumClusterwideEnvoyConfig *v2.CiliumClusterwideEnvoyConfig, opts v1.UpdateOptions) (result *v2.CiliumClusterwideEnvoyConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(ciliumclusterwideenvoyconfigsResource, ciliumClusterwideEnvoyConfig), &v2.CiliumClusterwideEnvoyConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumClusterwideEnvoyConfig), err -} - -// Delete takes name of the ciliumClusterwideEnvoyConfig and deletes it. Returns an error if one occurs. -func (c *FakeCiliumClusterwideEnvoyConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(ciliumclusterwideenvoyconfigsResource, name, opts), &v2.CiliumClusterwideEnvoyConfig{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeCiliumClusterwideEnvoyConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(ciliumclusterwideenvoyconfigsResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2.CiliumClusterwideEnvoyConfigList{}) - return err -} - -// Patch applies the patch and returns the patched ciliumClusterwideEnvoyConfig. -func (c *FakeCiliumClusterwideEnvoyConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumClusterwideEnvoyConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(ciliumclusterwideenvoyconfigsResource, name, pt, data, subresources...), &v2.CiliumClusterwideEnvoyConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumClusterwideEnvoyConfig), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumclusterwidenetworkpolicy.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumclusterwidenetworkpolicy.go deleted file mode 100644 index d3d2be624..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumclusterwidenetworkpolicy.go +++ /dev/null @@ -1,119 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeCiliumClusterwideNetworkPolicies implements CiliumClusterwideNetworkPolicyInterface -type FakeCiliumClusterwideNetworkPolicies struct { - Fake *FakeCiliumV2 -} - -var ciliumclusterwidenetworkpoliciesResource = v2.SchemeGroupVersion.WithResource("ciliumclusterwidenetworkpolicies") - -var ciliumclusterwidenetworkpoliciesKind = v2.SchemeGroupVersion.WithKind("CiliumClusterwideNetworkPolicy") - -// Get takes name of the ciliumClusterwideNetworkPolicy, and returns the corresponding ciliumClusterwideNetworkPolicy object, and an error if there is any. -func (c *FakeCiliumClusterwideNetworkPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.CiliumClusterwideNetworkPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(ciliumclusterwidenetworkpoliciesResource, name), &v2.CiliumClusterwideNetworkPolicy{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumClusterwideNetworkPolicy), err -} - -// List takes label and field selectors, and returns the list of CiliumClusterwideNetworkPolicies that match those selectors. -func (c *FakeCiliumClusterwideNetworkPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2.CiliumClusterwideNetworkPolicyList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(ciliumclusterwidenetworkpoliciesResource, ciliumclusterwidenetworkpoliciesKind, opts), &v2.CiliumClusterwideNetworkPolicyList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2.CiliumClusterwideNetworkPolicyList{ListMeta: obj.(*v2.CiliumClusterwideNetworkPolicyList).ListMeta} - for _, item := range obj.(*v2.CiliumClusterwideNetworkPolicyList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ciliumClusterwideNetworkPolicies. -func (c *FakeCiliumClusterwideNetworkPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(ciliumclusterwidenetworkpoliciesResource, opts)) -} - -// Create takes the representation of a ciliumClusterwideNetworkPolicy and creates it. Returns the server's representation of the ciliumClusterwideNetworkPolicy, and an error, if there is any. -func (c *FakeCiliumClusterwideNetworkPolicies) Create(ctx context.Context, ciliumClusterwideNetworkPolicy *v2.CiliumClusterwideNetworkPolicy, opts v1.CreateOptions) (result *v2.CiliumClusterwideNetworkPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(ciliumclusterwidenetworkpoliciesResource, ciliumClusterwideNetworkPolicy), &v2.CiliumClusterwideNetworkPolicy{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumClusterwideNetworkPolicy), err -} - -// Update takes the representation of a ciliumClusterwideNetworkPolicy and updates it. Returns the server's representation of the ciliumClusterwideNetworkPolicy, and an error, if there is any. -func (c *FakeCiliumClusterwideNetworkPolicies) Update(ctx context.Context, ciliumClusterwideNetworkPolicy *v2.CiliumClusterwideNetworkPolicy, opts v1.UpdateOptions) (result *v2.CiliumClusterwideNetworkPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(ciliumclusterwidenetworkpoliciesResource, ciliumClusterwideNetworkPolicy), &v2.CiliumClusterwideNetworkPolicy{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumClusterwideNetworkPolicy), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeCiliumClusterwideNetworkPolicies) UpdateStatus(ctx context.Context, ciliumClusterwideNetworkPolicy *v2.CiliumClusterwideNetworkPolicy, opts v1.UpdateOptions) (*v2.CiliumClusterwideNetworkPolicy, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(ciliumclusterwidenetworkpoliciesResource, "status", ciliumClusterwideNetworkPolicy), &v2.CiliumClusterwideNetworkPolicy{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumClusterwideNetworkPolicy), err -} - -// Delete takes name of the ciliumClusterwideNetworkPolicy and deletes it. Returns an error if one occurs. -func (c *FakeCiliumClusterwideNetworkPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(ciliumclusterwidenetworkpoliciesResource, name, opts), &v2.CiliumClusterwideNetworkPolicy{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeCiliumClusterwideNetworkPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(ciliumclusterwidenetworkpoliciesResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2.CiliumClusterwideNetworkPolicyList{}) - return err -} - -// Patch applies the patch and returns the patched ciliumClusterwideNetworkPolicy. -func (c *FakeCiliumClusterwideNetworkPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumClusterwideNetworkPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(ciliumclusterwidenetworkpoliciesResource, name, pt, data, subresources...), &v2.CiliumClusterwideNetworkPolicy{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumClusterwideNetworkPolicy), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumegressgatewaypolicy.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumegressgatewaypolicy.go deleted file mode 100644 index 993ab79e2..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumegressgatewaypolicy.go +++ /dev/null @@ -1,108 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeCiliumEgressGatewayPolicies implements CiliumEgressGatewayPolicyInterface -type FakeCiliumEgressGatewayPolicies struct { - Fake *FakeCiliumV2 -} - -var ciliumegressgatewaypoliciesResource = v2.SchemeGroupVersion.WithResource("ciliumegressgatewaypolicies") - -var ciliumegressgatewaypoliciesKind = v2.SchemeGroupVersion.WithKind("CiliumEgressGatewayPolicy") - -// Get takes name of the ciliumEgressGatewayPolicy, and returns the corresponding ciliumEgressGatewayPolicy object, and an error if there is any. -func (c *FakeCiliumEgressGatewayPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.CiliumEgressGatewayPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(ciliumegressgatewaypoliciesResource, name), &v2.CiliumEgressGatewayPolicy{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumEgressGatewayPolicy), err -} - -// List takes label and field selectors, and returns the list of CiliumEgressGatewayPolicies that match those selectors. -func (c *FakeCiliumEgressGatewayPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2.CiliumEgressGatewayPolicyList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(ciliumegressgatewaypoliciesResource, ciliumegressgatewaypoliciesKind, opts), &v2.CiliumEgressGatewayPolicyList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2.CiliumEgressGatewayPolicyList{ListMeta: obj.(*v2.CiliumEgressGatewayPolicyList).ListMeta} - for _, item := range obj.(*v2.CiliumEgressGatewayPolicyList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ciliumEgressGatewayPolicies. -func (c *FakeCiliumEgressGatewayPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(ciliumegressgatewaypoliciesResource, opts)) -} - -// Create takes the representation of a ciliumEgressGatewayPolicy and creates it. Returns the server's representation of the ciliumEgressGatewayPolicy, and an error, if there is any. -func (c *FakeCiliumEgressGatewayPolicies) Create(ctx context.Context, ciliumEgressGatewayPolicy *v2.CiliumEgressGatewayPolicy, opts v1.CreateOptions) (result *v2.CiliumEgressGatewayPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(ciliumegressgatewaypoliciesResource, ciliumEgressGatewayPolicy), &v2.CiliumEgressGatewayPolicy{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumEgressGatewayPolicy), err -} - -// Update takes the representation of a ciliumEgressGatewayPolicy and updates it. Returns the server's representation of the ciliumEgressGatewayPolicy, and an error, if there is any. -func (c *FakeCiliumEgressGatewayPolicies) Update(ctx context.Context, ciliumEgressGatewayPolicy *v2.CiliumEgressGatewayPolicy, opts v1.UpdateOptions) (result *v2.CiliumEgressGatewayPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(ciliumegressgatewaypoliciesResource, ciliumEgressGatewayPolicy), &v2.CiliumEgressGatewayPolicy{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumEgressGatewayPolicy), err -} - -// Delete takes name of the ciliumEgressGatewayPolicy and deletes it. Returns an error if one occurs. -func (c *FakeCiliumEgressGatewayPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(ciliumegressgatewaypoliciesResource, name, opts), &v2.CiliumEgressGatewayPolicy{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeCiliumEgressGatewayPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(ciliumegressgatewaypoliciesResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2.CiliumEgressGatewayPolicyList{}) - return err -} - -// Patch applies the patch and returns the patched ciliumEgressGatewayPolicy. -func (c *FakeCiliumEgressGatewayPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumEgressGatewayPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(ciliumegressgatewaypoliciesResource, name, pt, data, subresources...), &v2.CiliumEgressGatewayPolicy{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumEgressGatewayPolicy), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumendpoint.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumendpoint.go deleted file mode 100644 index 5ec15c48b..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumendpoint.go +++ /dev/null @@ -1,128 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeCiliumEndpoints implements CiliumEndpointInterface -type FakeCiliumEndpoints struct { - Fake *FakeCiliumV2 - ns string -} - -var ciliumendpointsResource = v2.SchemeGroupVersion.WithResource("ciliumendpoints") - -var ciliumendpointsKind = v2.SchemeGroupVersion.WithKind("CiliumEndpoint") - -// Get takes name of the ciliumEndpoint, and returns the corresponding ciliumEndpoint object, and an error if there is any. -func (c *FakeCiliumEndpoints) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.CiliumEndpoint, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(ciliumendpointsResource, c.ns, name), &v2.CiliumEndpoint{}) - - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumEndpoint), err -} - -// List takes label and field selectors, and returns the list of CiliumEndpoints that match those selectors. -func (c *FakeCiliumEndpoints) List(ctx context.Context, opts v1.ListOptions) (result *v2.CiliumEndpointList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(ciliumendpointsResource, ciliumendpointsKind, c.ns, opts), &v2.CiliumEndpointList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2.CiliumEndpointList{ListMeta: obj.(*v2.CiliumEndpointList).ListMeta} - for _, item := range obj.(*v2.CiliumEndpointList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ciliumEndpoints. -func (c *FakeCiliumEndpoints) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(ciliumendpointsResource, c.ns, opts)) - -} - -// Create takes the representation of a ciliumEndpoint and creates it. Returns the server's representation of the ciliumEndpoint, and an error, if there is any. -func (c *FakeCiliumEndpoints) Create(ctx context.Context, ciliumEndpoint *v2.CiliumEndpoint, opts v1.CreateOptions) (result *v2.CiliumEndpoint, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(ciliumendpointsResource, c.ns, ciliumEndpoint), &v2.CiliumEndpoint{}) - - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumEndpoint), err -} - -// Update takes the representation of a ciliumEndpoint and updates it. Returns the server's representation of the ciliumEndpoint, and an error, if there is any. -func (c *FakeCiliumEndpoints) Update(ctx context.Context, ciliumEndpoint *v2.CiliumEndpoint, opts v1.UpdateOptions) (result *v2.CiliumEndpoint, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(ciliumendpointsResource, c.ns, ciliumEndpoint), &v2.CiliumEndpoint{}) - - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumEndpoint), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeCiliumEndpoints) UpdateStatus(ctx context.Context, ciliumEndpoint *v2.CiliumEndpoint, opts v1.UpdateOptions) (*v2.CiliumEndpoint, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(ciliumendpointsResource, "status", c.ns, ciliumEndpoint), &v2.CiliumEndpoint{}) - - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumEndpoint), err -} - -// Delete takes name of the ciliumEndpoint and deletes it. Returns an error if one occurs. -func (c *FakeCiliumEndpoints) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(ciliumendpointsResource, c.ns, name, opts), &v2.CiliumEndpoint{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeCiliumEndpoints) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(ciliumendpointsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v2.CiliumEndpointList{}) - return err -} - -// Patch applies the patch and returns the patched ciliumEndpoint. -func (c *FakeCiliumEndpoints) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumEndpoint, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(ciliumendpointsResource, c.ns, name, pt, data, subresources...), &v2.CiliumEndpoint{}) - - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumEndpoint), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumenvoyconfig.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumenvoyconfig.go deleted file mode 100644 index fa0592695..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumenvoyconfig.go +++ /dev/null @@ -1,116 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeCiliumEnvoyConfigs implements CiliumEnvoyConfigInterface -type FakeCiliumEnvoyConfigs struct { - Fake *FakeCiliumV2 - ns string -} - -var ciliumenvoyconfigsResource = v2.SchemeGroupVersion.WithResource("ciliumenvoyconfigs") - -var ciliumenvoyconfigsKind = v2.SchemeGroupVersion.WithKind("CiliumEnvoyConfig") - -// Get takes name of the ciliumEnvoyConfig, and returns the corresponding ciliumEnvoyConfig object, and an error if there is any. -func (c *FakeCiliumEnvoyConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.CiliumEnvoyConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(ciliumenvoyconfigsResource, c.ns, name), &v2.CiliumEnvoyConfig{}) - - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumEnvoyConfig), err -} - -// List takes label and field selectors, and returns the list of CiliumEnvoyConfigs that match those selectors. -func (c *FakeCiliumEnvoyConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2.CiliumEnvoyConfigList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(ciliumenvoyconfigsResource, ciliumenvoyconfigsKind, c.ns, opts), &v2.CiliumEnvoyConfigList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2.CiliumEnvoyConfigList{ListMeta: obj.(*v2.CiliumEnvoyConfigList).ListMeta} - for _, item := range obj.(*v2.CiliumEnvoyConfigList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ciliumEnvoyConfigs. -func (c *FakeCiliumEnvoyConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(ciliumenvoyconfigsResource, c.ns, opts)) - -} - -// Create takes the representation of a ciliumEnvoyConfig and creates it. Returns the server's representation of the ciliumEnvoyConfig, and an error, if there is any. -func (c *FakeCiliumEnvoyConfigs) Create(ctx context.Context, ciliumEnvoyConfig *v2.CiliumEnvoyConfig, opts v1.CreateOptions) (result *v2.CiliumEnvoyConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(ciliumenvoyconfigsResource, c.ns, ciliumEnvoyConfig), &v2.CiliumEnvoyConfig{}) - - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumEnvoyConfig), err -} - -// Update takes the representation of a ciliumEnvoyConfig and updates it. Returns the server's representation of the ciliumEnvoyConfig, and an error, if there is any. -func (c *FakeCiliumEnvoyConfigs) Update(ctx context.Context, ciliumEnvoyConfig *v2.CiliumEnvoyConfig, opts v1.UpdateOptions) (result *v2.CiliumEnvoyConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(ciliumenvoyconfigsResource, c.ns, ciliumEnvoyConfig), &v2.CiliumEnvoyConfig{}) - - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumEnvoyConfig), err -} - -// Delete takes name of the ciliumEnvoyConfig and deletes it. Returns an error if one occurs. -func (c *FakeCiliumEnvoyConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(ciliumenvoyconfigsResource, c.ns, name, opts), &v2.CiliumEnvoyConfig{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeCiliumEnvoyConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(ciliumenvoyconfigsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v2.CiliumEnvoyConfigList{}) - return err -} - -// Patch applies the patch and returns the patched ciliumEnvoyConfig. -func (c *FakeCiliumEnvoyConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumEnvoyConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(ciliumenvoyconfigsResource, c.ns, name, pt, data, subresources...), &v2.CiliumEnvoyConfig{}) - - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumEnvoyConfig), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumexternalworkload.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumexternalworkload.go deleted file mode 100644 index e947be5f1..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumexternalworkload.go +++ /dev/null @@ -1,119 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeCiliumExternalWorkloads implements CiliumExternalWorkloadInterface -type FakeCiliumExternalWorkloads struct { - Fake *FakeCiliumV2 -} - -var ciliumexternalworkloadsResource = v2.SchemeGroupVersion.WithResource("ciliumexternalworkloads") - -var ciliumexternalworkloadsKind = v2.SchemeGroupVersion.WithKind("CiliumExternalWorkload") - -// Get takes name of the ciliumExternalWorkload, and returns the corresponding ciliumExternalWorkload object, and an error if there is any. -func (c *FakeCiliumExternalWorkloads) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.CiliumExternalWorkload, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(ciliumexternalworkloadsResource, name), &v2.CiliumExternalWorkload{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumExternalWorkload), err -} - -// List takes label and field selectors, and returns the list of CiliumExternalWorkloads that match those selectors. -func (c *FakeCiliumExternalWorkloads) List(ctx context.Context, opts v1.ListOptions) (result *v2.CiliumExternalWorkloadList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(ciliumexternalworkloadsResource, ciliumexternalworkloadsKind, opts), &v2.CiliumExternalWorkloadList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2.CiliumExternalWorkloadList{ListMeta: obj.(*v2.CiliumExternalWorkloadList).ListMeta} - for _, item := range obj.(*v2.CiliumExternalWorkloadList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ciliumExternalWorkloads. -func (c *FakeCiliumExternalWorkloads) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(ciliumexternalworkloadsResource, opts)) -} - -// Create takes the representation of a ciliumExternalWorkload and creates it. Returns the server's representation of the ciliumExternalWorkload, and an error, if there is any. -func (c *FakeCiliumExternalWorkloads) Create(ctx context.Context, ciliumExternalWorkload *v2.CiliumExternalWorkload, opts v1.CreateOptions) (result *v2.CiliumExternalWorkload, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(ciliumexternalworkloadsResource, ciliumExternalWorkload), &v2.CiliumExternalWorkload{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumExternalWorkload), err -} - -// Update takes the representation of a ciliumExternalWorkload and updates it. Returns the server's representation of the ciliumExternalWorkload, and an error, if there is any. -func (c *FakeCiliumExternalWorkloads) Update(ctx context.Context, ciliumExternalWorkload *v2.CiliumExternalWorkload, opts v1.UpdateOptions) (result *v2.CiliumExternalWorkload, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(ciliumexternalworkloadsResource, ciliumExternalWorkload), &v2.CiliumExternalWorkload{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumExternalWorkload), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeCiliumExternalWorkloads) UpdateStatus(ctx context.Context, ciliumExternalWorkload *v2.CiliumExternalWorkload, opts v1.UpdateOptions) (*v2.CiliumExternalWorkload, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(ciliumexternalworkloadsResource, "status", ciliumExternalWorkload), &v2.CiliumExternalWorkload{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumExternalWorkload), err -} - -// Delete takes name of the ciliumExternalWorkload and deletes it. Returns an error if one occurs. -func (c *FakeCiliumExternalWorkloads) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(ciliumexternalworkloadsResource, name, opts), &v2.CiliumExternalWorkload{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeCiliumExternalWorkloads) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(ciliumexternalworkloadsResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2.CiliumExternalWorkloadList{}) - return err -} - -// Patch applies the patch and returns the patched ciliumExternalWorkload. -func (c *FakeCiliumExternalWorkloads) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumExternalWorkload, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(ciliumexternalworkloadsResource, name, pt, data, subresources...), &v2.CiliumExternalWorkload{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumExternalWorkload), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumidentity.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumidentity.go deleted file mode 100644 index 745193c7d..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumidentity.go +++ /dev/null @@ -1,108 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeCiliumIdentities implements CiliumIdentityInterface -type FakeCiliumIdentities struct { - Fake *FakeCiliumV2 -} - -var ciliumidentitiesResource = v2.SchemeGroupVersion.WithResource("ciliumidentities") - -var ciliumidentitiesKind = v2.SchemeGroupVersion.WithKind("CiliumIdentity") - -// Get takes name of the ciliumIdentity, and returns the corresponding ciliumIdentity object, and an error if there is any. -func (c *FakeCiliumIdentities) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.CiliumIdentity, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(ciliumidentitiesResource, name), &v2.CiliumIdentity{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumIdentity), err -} - -// List takes label and field selectors, and returns the list of CiliumIdentities that match those selectors. -func (c *FakeCiliumIdentities) List(ctx context.Context, opts v1.ListOptions) (result *v2.CiliumIdentityList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(ciliumidentitiesResource, ciliumidentitiesKind, opts), &v2.CiliumIdentityList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2.CiliumIdentityList{ListMeta: obj.(*v2.CiliumIdentityList).ListMeta} - for _, item := range obj.(*v2.CiliumIdentityList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ciliumIdentities. -func (c *FakeCiliumIdentities) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(ciliumidentitiesResource, opts)) -} - -// Create takes the representation of a ciliumIdentity and creates it. Returns the server's representation of the ciliumIdentity, and an error, if there is any. -func (c *FakeCiliumIdentities) Create(ctx context.Context, ciliumIdentity *v2.CiliumIdentity, opts v1.CreateOptions) (result *v2.CiliumIdentity, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(ciliumidentitiesResource, ciliumIdentity), &v2.CiliumIdentity{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumIdentity), err -} - -// Update takes the representation of a ciliumIdentity and updates it. Returns the server's representation of the ciliumIdentity, and an error, if there is any. -func (c *FakeCiliumIdentities) Update(ctx context.Context, ciliumIdentity *v2.CiliumIdentity, opts v1.UpdateOptions) (result *v2.CiliumIdentity, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(ciliumidentitiesResource, ciliumIdentity), &v2.CiliumIdentity{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumIdentity), err -} - -// Delete takes name of the ciliumIdentity and deletes it. Returns an error if one occurs. -func (c *FakeCiliumIdentities) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(ciliumidentitiesResource, name, opts), &v2.CiliumIdentity{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeCiliumIdentities) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(ciliumidentitiesResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2.CiliumIdentityList{}) - return err -} - -// Patch applies the patch and returns the patched ciliumIdentity. -func (c *FakeCiliumIdentities) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumIdentity, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(ciliumidentitiesResource, name, pt, data, subresources...), &v2.CiliumIdentity{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumIdentity), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumlocalredirectpolicy.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumlocalredirectpolicy.go deleted file mode 100644 index 308309ee1..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumlocalredirectpolicy.go +++ /dev/null @@ -1,128 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeCiliumLocalRedirectPolicies implements CiliumLocalRedirectPolicyInterface -type FakeCiliumLocalRedirectPolicies struct { - Fake *FakeCiliumV2 - ns string -} - -var ciliumlocalredirectpoliciesResource = v2.SchemeGroupVersion.WithResource("ciliumlocalredirectpolicies") - -var ciliumlocalredirectpoliciesKind = v2.SchemeGroupVersion.WithKind("CiliumLocalRedirectPolicy") - -// Get takes name of the ciliumLocalRedirectPolicy, and returns the corresponding ciliumLocalRedirectPolicy object, and an error if there is any. -func (c *FakeCiliumLocalRedirectPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.CiliumLocalRedirectPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(ciliumlocalredirectpoliciesResource, c.ns, name), &v2.CiliumLocalRedirectPolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumLocalRedirectPolicy), err -} - -// List takes label and field selectors, and returns the list of CiliumLocalRedirectPolicies that match those selectors. -func (c *FakeCiliumLocalRedirectPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2.CiliumLocalRedirectPolicyList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(ciliumlocalredirectpoliciesResource, ciliumlocalredirectpoliciesKind, c.ns, opts), &v2.CiliumLocalRedirectPolicyList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2.CiliumLocalRedirectPolicyList{ListMeta: obj.(*v2.CiliumLocalRedirectPolicyList).ListMeta} - for _, item := range obj.(*v2.CiliumLocalRedirectPolicyList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ciliumLocalRedirectPolicies. -func (c *FakeCiliumLocalRedirectPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(ciliumlocalredirectpoliciesResource, c.ns, opts)) - -} - -// Create takes the representation of a ciliumLocalRedirectPolicy and creates it. Returns the server's representation of the ciliumLocalRedirectPolicy, and an error, if there is any. -func (c *FakeCiliumLocalRedirectPolicies) Create(ctx context.Context, ciliumLocalRedirectPolicy *v2.CiliumLocalRedirectPolicy, opts v1.CreateOptions) (result *v2.CiliumLocalRedirectPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(ciliumlocalredirectpoliciesResource, c.ns, ciliumLocalRedirectPolicy), &v2.CiliumLocalRedirectPolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumLocalRedirectPolicy), err -} - -// Update takes the representation of a ciliumLocalRedirectPolicy and updates it. Returns the server's representation of the ciliumLocalRedirectPolicy, and an error, if there is any. -func (c *FakeCiliumLocalRedirectPolicies) Update(ctx context.Context, ciliumLocalRedirectPolicy *v2.CiliumLocalRedirectPolicy, opts v1.UpdateOptions) (result *v2.CiliumLocalRedirectPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(ciliumlocalredirectpoliciesResource, c.ns, ciliumLocalRedirectPolicy), &v2.CiliumLocalRedirectPolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumLocalRedirectPolicy), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeCiliumLocalRedirectPolicies) UpdateStatus(ctx context.Context, ciliumLocalRedirectPolicy *v2.CiliumLocalRedirectPolicy, opts v1.UpdateOptions) (*v2.CiliumLocalRedirectPolicy, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(ciliumlocalredirectpoliciesResource, "status", c.ns, ciliumLocalRedirectPolicy), &v2.CiliumLocalRedirectPolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumLocalRedirectPolicy), err -} - -// Delete takes name of the ciliumLocalRedirectPolicy and deletes it. Returns an error if one occurs. -func (c *FakeCiliumLocalRedirectPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(ciliumlocalredirectpoliciesResource, c.ns, name, opts), &v2.CiliumLocalRedirectPolicy{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeCiliumLocalRedirectPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(ciliumlocalredirectpoliciesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v2.CiliumLocalRedirectPolicyList{}) - return err -} - -// Patch applies the patch and returns the patched ciliumLocalRedirectPolicy. -func (c *FakeCiliumLocalRedirectPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumLocalRedirectPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(ciliumlocalredirectpoliciesResource, c.ns, name, pt, data, subresources...), &v2.CiliumLocalRedirectPolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumLocalRedirectPolicy), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumnetworkpolicy.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumnetworkpolicy.go deleted file mode 100644 index b40b9740e..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumnetworkpolicy.go +++ /dev/null @@ -1,128 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeCiliumNetworkPolicies implements CiliumNetworkPolicyInterface -type FakeCiliumNetworkPolicies struct { - Fake *FakeCiliumV2 - ns string -} - -var ciliumnetworkpoliciesResource = v2.SchemeGroupVersion.WithResource("ciliumnetworkpolicies") - -var ciliumnetworkpoliciesKind = v2.SchemeGroupVersion.WithKind("CiliumNetworkPolicy") - -// Get takes name of the ciliumNetworkPolicy, and returns the corresponding ciliumNetworkPolicy object, and an error if there is any. -func (c *FakeCiliumNetworkPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.CiliumNetworkPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(ciliumnetworkpoliciesResource, c.ns, name), &v2.CiliumNetworkPolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumNetworkPolicy), err -} - -// List takes label and field selectors, and returns the list of CiliumNetworkPolicies that match those selectors. -func (c *FakeCiliumNetworkPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2.CiliumNetworkPolicyList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(ciliumnetworkpoliciesResource, ciliumnetworkpoliciesKind, c.ns, opts), &v2.CiliumNetworkPolicyList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2.CiliumNetworkPolicyList{ListMeta: obj.(*v2.CiliumNetworkPolicyList).ListMeta} - for _, item := range obj.(*v2.CiliumNetworkPolicyList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ciliumNetworkPolicies. -func (c *FakeCiliumNetworkPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(ciliumnetworkpoliciesResource, c.ns, opts)) - -} - -// Create takes the representation of a ciliumNetworkPolicy and creates it. Returns the server's representation of the ciliumNetworkPolicy, and an error, if there is any. -func (c *FakeCiliumNetworkPolicies) Create(ctx context.Context, ciliumNetworkPolicy *v2.CiliumNetworkPolicy, opts v1.CreateOptions) (result *v2.CiliumNetworkPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(ciliumnetworkpoliciesResource, c.ns, ciliumNetworkPolicy), &v2.CiliumNetworkPolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumNetworkPolicy), err -} - -// Update takes the representation of a ciliumNetworkPolicy and updates it. Returns the server's representation of the ciliumNetworkPolicy, and an error, if there is any. -func (c *FakeCiliumNetworkPolicies) Update(ctx context.Context, ciliumNetworkPolicy *v2.CiliumNetworkPolicy, opts v1.UpdateOptions) (result *v2.CiliumNetworkPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(ciliumnetworkpoliciesResource, c.ns, ciliumNetworkPolicy), &v2.CiliumNetworkPolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumNetworkPolicy), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeCiliumNetworkPolicies) UpdateStatus(ctx context.Context, ciliumNetworkPolicy *v2.CiliumNetworkPolicy, opts v1.UpdateOptions) (*v2.CiliumNetworkPolicy, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(ciliumnetworkpoliciesResource, "status", c.ns, ciliumNetworkPolicy), &v2.CiliumNetworkPolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumNetworkPolicy), err -} - -// Delete takes name of the ciliumNetworkPolicy and deletes it. Returns an error if one occurs. -func (c *FakeCiliumNetworkPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(ciliumnetworkpoliciesResource, c.ns, name, opts), &v2.CiliumNetworkPolicy{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeCiliumNetworkPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(ciliumnetworkpoliciesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v2.CiliumNetworkPolicyList{}) - return err -} - -// Patch applies the patch and returns the patched ciliumNetworkPolicy. -func (c *FakeCiliumNetworkPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumNetworkPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(ciliumnetworkpoliciesResource, c.ns, name, pt, data, subresources...), &v2.CiliumNetworkPolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumNetworkPolicy), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumnode.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumnode.go deleted file mode 100644 index 73e91b1f9..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/fake/fake_ciliumnode.go +++ /dev/null @@ -1,119 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeCiliumNodes implements CiliumNodeInterface -type FakeCiliumNodes struct { - Fake *FakeCiliumV2 -} - -var ciliumnodesResource = v2.SchemeGroupVersion.WithResource("ciliumnodes") - -var ciliumnodesKind = v2.SchemeGroupVersion.WithKind("CiliumNode") - -// Get takes name of the ciliumNode, and returns the corresponding ciliumNode object, and an error if there is any. -func (c *FakeCiliumNodes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.CiliumNode, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(ciliumnodesResource, name), &v2.CiliumNode{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumNode), err -} - -// List takes label and field selectors, and returns the list of CiliumNodes that match those selectors. -func (c *FakeCiliumNodes) List(ctx context.Context, opts v1.ListOptions) (result *v2.CiliumNodeList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(ciliumnodesResource, ciliumnodesKind, opts), &v2.CiliumNodeList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2.CiliumNodeList{ListMeta: obj.(*v2.CiliumNodeList).ListMeta} - for _, item := range obj.(*v2.CiliumNodeList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ciliumNodes. -func (c *FakeCiliumNodes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(ciliumnodesResource, opts)) -} - -// Create takes the representation of a ciliumNode and creates it. Returns the server's representation of the ciliumNode, and an error, if there is any. -func (c *FakeCiliumNodes) Create(ctx context.Context, ciliumNode *v2.CiliumNode, opts v1.CreateOptions) (result *v2.CiliumNode, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(ciliumnodesResource, ciliumNode), &v2.CiliumNode{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumNode), err -} - -// Update takes the representation of a ciliumNode and updates it. Returns the server's representation of the ciliumNode, and an error, if there is any. -func (c *FakeCiliumNodes) Update(ctx context.Context, ciliumNode *v2.CiliumNode, opts v1.UpdateOptions) (result *v2.CiliumNode, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(ciliumnodesResource, ciliumNode), &v2.CiliumNode{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumNode), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeCiliumNodes) UpdateStatus(ctx context.Context, ciliumNode *v2.CiliumNode, opts v1.UpdateOptions) (*v2.CiliumNode, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(ciliumnodesResource, "status", ciliumNode), &v2.CiliumNode{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumNode), err -} - -// Delete takes name of the ciliumNode and deletes it. Returns an error if one occurs. -func (c *FakeCiliumNodes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(ciliumnodesResource, name, opts), &v2.CiliumNode{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeCiliumNodes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(ciliumnodesResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2.CiliumNodeList{}) - return err -} - -// Patch applies the patch and returns the patched ciliumNode. -func (c *FakeCiliumNodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.CiliumNode, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(ciliumnodesResource, name, pt, data, subresources...), &v2.CiliumNode{}) - if obj == nil { - return nil, err - } - return obj.(*v2.CiliumNode), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/generated_expansion.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/generated_expansion.go deleted file mode 100644 index 15b434bac..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2/generated_expansion.go +++ /dev/null @@ -1,26 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2 - -type CiliumClusterwideEnvoyConfigExpansion interface{} - -type CiliumClusterwideNetworkPolicyExpansion interface{} - -type CiliumEgressGatewayPolicyExpansion interface{} - -type CiliumEndpointExpansion interface{} - -type CiliumEnvoyConfigExpansion interface{} - -type CiliumExternalWorkloadExpansion interface{} - -type CiliumIdentityExpansion interface{} - -type CiliumLocalRedirectPolicyExpansion interface{} - -type CiliumNetworkPolicyExpansion interface{} - -type CiliumNodeExpansion interface{} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/cilium.io_client.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/cilium.io_client.go deleted file mode 100644 index a217d05b8..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/cilium.io_client.go +++ /dev/null @@ -1,149 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "net/http" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" -) - -type CiliumV2alpha1Interface interface { - RESTClient() rest.Interface - CiliumBGPAdvertisementsGetter - CiliumBGPClusterConfigsGetter - CiliumBGPNodeConfigsGetter - CiliumBGPNodeConfigOverridesGetter - CiliumBGPPeerConfigsGetter - CiliumBGPPeeringPoliciesGetter - CiliumCIDRGroupsGetter - CiliumEndpointSlicesGetter - CiliumL2AnnouncementPoliciesGetter - CiliumLoadBalancerIPPoolsGetter - CiliumNodeConfigsGetter - CiliumPodIPPoolsGetter -} - -// CiliumV2alpha1Client is used to interact with features provided by the cilium.io group. -type CiliumV2alpha1Client struct { - restClient rest.Interface -} - -func (c *CiliumV2alpha1Client) CiliumBGPAdvertisements() CiliumBGPAdvertisementInterface { - return newCiliumBGPAdvertisements(c) -} - -func (c *CiliumV2alpha1Client) CiliumBGPClusterConfigs() CiliumBGPClusterConfigInterface { - return newCiliumBGPClusterConfigs(c) -} - -func (c *CiliumV2alpha1Client) CiliumBGPNodeConfigs() CiliumBGPNodeConfigInterface { - return newCiliumBGPNodeConfigs(c) -} - -func (c *CiliumV2alpha1Client) CiliumBGPNodeConfigOverrides() CiliumBGPNodeConfigOverrideInterface { - return newCiliumBGPNodeConfigOverrides(c) -} - -func (c *CiliumV2alpha1Client) CiliumBGPPeerConfigs() CiliumBGPPeerConfigInterface { - return newCiliumBGPPeerConfigs(c) -} - -func (c *CiliumV2alpha1Client) CiliumBGPPeeringPolicies() CiliumBGPPeeringPolicyInterface { - return newCiliumBGPPeeringPolicies(c) -} - -func (c *CiliumV2alpha1Client) CiliumCIDRGroups() CiliumCIDRGroupInterface { - return newCiliumCIDRGroups(c) -} - -func (c *CiliumV2alpha1Client) CiliumEndpointSlices() CiliumEndpointSliceInterface { - return newCiliumEndpointSlices(c) -} - -func (c *CiliumV2alpha1Client) CiliumL2AnnouncementPolicies() CiliumL2AnnouncementPolicyInterface { - return newCiliumL2AnnouncementPolicies(c) -} - -func (c *CiliumV2alpha1Client) CiliumLoadBalancerIPPools() CiliumLoadBalancerIPPoolInterface { - return newCiliumLoadBalancerIPPools(c) -} - -func (c *CiliumV2alpha1Client) CiliumNodeConfigs(namespace string) CiliumNodeConfigInterface { - return newCiliumNodeConfigs(c, namespace) -} - -func (c *CiliumV2alpha1Client) CiliumPodIPPools() CiliumPodIPPoolInterface { - return newCiliumPodIPPools(c) -} - -// NewForConfig creates a new CiliumV2alpha1Client for the given config. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*CiliumV2alpha1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - httpClient, err := rest.HTTPClientFor(&config) - if err != nil { - return nil, err - } - return NewForConfigAndClient(&config, httpClient) -} - -// NewForConfigAndClient creates a new CiliumV2alpha1Client for the given config and http client. -// Note the http client provided takes precedence over the configured transport values. -func NewForConfigAndClient(c *rest.Config, h *http.Client) (*CiliumV2alpha1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientForConfigAndClient(&config, h) - if err != nil { - return nil, err - } - return &CiliumV2alpha1Client{client}, nil -} - -// NewForConfigOrDie creates a new CiliumV2alpha1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *CiliumV2alpha1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new CiliumV2alpha1Client for the given RESTClient. -func New(c rest.Interface) *CiliumV2alpha1Client { - return &CiliumV2alpha1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v2alpha1.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() - - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *CiliumV2alpha1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumbgpadvertisement.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumbgpadvertisement.go deleted file mode 100644 index 3488a9470..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumbgpadvertisement.go +++ /dev/null @@ -1,155 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - "time" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - scheme "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// CiliumBGPAdvertisementsGetter has a method to return a CiliumBGPAdvertisementInterface. -// A group's client should implement this interface. -type CiliumBGPAdvertisementsGetter interface { - CiliumBGPAdvertisements() CiliumBGPAdvertisementInterface -} - -// CiliumBGPAdvertisementInterface has methods to work with CiliumBGPAdvertisement resources. -type CiliumBGPAdvertisementInterface interface { - Create(ctx context.Context, ciliumBGPAdvertisement *v2alpha1.CiliumBGPAdvertisement, opts v1.CreateOptions) (*v2alpha1.CiliumBGPAdvertisement, error) - Update(ctx context.Context, ciliumBGPAdvertisement *v2alpha1.CiliumBGPAdvertisement, opts v1.UpdateOptions) (*v2alpha1.CiliumBGPAdvertisement, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.CiliumBGPAdvertisement, error) - List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.CiliumBGPAdvertisementList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumBGPAdvertisement, err error) - CiliumBGPAdvertisementExpansion -} - -// ciliumBGPAdvertisements implements CiliumBGPAdvertisementInterface -type ciliumBGPAdvertisements struct { - client rest.Interface -} - -// newCiliumBGPAdvertisements returns a CiliumBGPAdvertisements -func newCiliumBGPAdvertisements(c *CiliumV2alpha1Client) *ciliumBGPAdvertisements { - return &ciliumBGPAdvertisements{ - client: c.RESTClient(), - } -} - -// Get takes name of the ciliumBGPAdvertisement, and returns the corresponding ciliumBGPAdvertisement object, and an error if there is any. -func (c *ciliumBGPAdvertisements) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CiliumBGPAdvertisement, err error) { - result = &v2alpha1.CiliumBGPAdvertisement{} - err = c.client.Get(). - Resource("ciliumbgpadvertisements"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CiliumBGPAdvertisements that match those selectors. -func (c *ciliumBGPAdvertisements) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CiliumBGPAdvertisementList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2alpha1.CiliumBGPAdvertisementList{} - err = c.client.Get(). - Resource("ciliumbgpadvertisements"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ciliumBGPAdvertisements. -func (c *ciliumBGPAdvertisements) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("ciliumbgpadvertisements"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ciliumBGPAdvertisement and creates it. Returns the server's representation of the ciliumBGPAdvertisement, and an error, if there is any. -func (c *ciliumBGPAdvertisements) Create(ctx context.Context, ciliumBGPAdvertisement *v2alpha1.CiliumBGPAdvertisement, opts v1.CreateOptions) (result *v2alpha1.CiliumBGPAdvertisement, err error) { - result = &v2alpha1.CiliumBGPAdvertisement{} - err = c.client.Post(). - Resource("ciliumbgpadvertisements"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumBGPAdvertisement). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ciliumBGPAdvertisement and updates it. Returns the server's representation of the ciliumBGPAdvertisement, and an error, if there is any. -func (c *ciliumBGPAdvertisements) Update(ctx context.Context, ciliumBGPAdvertisement *v2alpha1.CiliumBGPAdvertisement, opts v1.UpdateOptions) (result *v2alpha1.CiliumBGPAdvertisement, err error) { - result = &v2alpha1.CiliumBGPAdvertisement{} - err = c.client.Put(). - Resource("ciliumbgpadvertisements"). - Name(ciliumBGPAdvertisement.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumBGPAdvertisement). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ciliumBGPAdvertisement and deletes it. Returns an error if one occurs. -func (c *ciliumBGPAdvertisements) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("ciliumbgpadvertisements"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ciliumBGPAdvertisements) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("ciliumbgpadvertisements"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ciliumBGPAdvertisement. -func (c *ciliumBGPAdvertisements) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumBGPAdvertisement, err error) { - result = &v2alpha1.CiliumBGPAdvertisement{} - err = c.client.Patch(pt). - Resource("ciliumbgpadvertisements"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumbgpclusterconfig.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumbgpclusterconfig.go deleted file mode 100644 index b40c50f25..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumbgpclusterconfig.go +++ /dev/null @@ -1,155 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - "time" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - scheme "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// CiliumBGPClusterConfigsGetter has a method to return a CiliumBGPClusterConfigInterface. -// A group's client should implement this interface. -type CiliumBGPClusterConfigsGetter interface { - CiliumBGPClusterConfigs() CiliumBGPClusterConfigInterface -} - -// CiliumBGPClusterConfigInterface has methods to work with CiliumBGPClusterConfig resources. -type CiliumBGPClusterConfigInterface interface { - Create(ctx context.Context, ciliumBGPClusterConfig *v2alpha1.CiliumBGPClusterConfig, opts v1.CreateOptions) (*v2alpha1.CiliumBGPClusterConfig, error) - Update(ctx context.Context, ciliumBGPClusterConfig *v2alpha1.CiliumBGPClusterConfig, opts v1.UpdateOptions) (*v2alpha1.CiliumBGPClusterConfig, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.CiliumBGPClusterConfig, error) - List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.CiliumBGPClusterConfigList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumBGPClusterConfig, err error) - CiliumBGPClusterConfigExpansion -} - -// ciliumBGPClusterConfigs implements CiliumBGPClusterConfigInterface -type ciliumBGPClusterConfigs struct { - client rest.Interface -} - -// newCiliumBGPClusterConfigs returns a CiliumBGPClusterConfigs -func newCiliumBGPClusterConfigs(c *CiliumV2alpha1Client) *ciliumBGPClusterConfigs { - return &ciliumBGPClusterConfigs{ - client: c.RESTClient(), - } -} - -// Get takes name of the ciliumBGPClusterConfig, and returns the corresponding ciliumBGPClusterConfig object, and an error if there is any. -func (c *ciliumBGPClusterConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CiliumBGPClusterConfig, err error) { - result = &v2alpha1.CiliumBGPClusterConfig{} - err = c.client.Get(). - Resource("ciliumbgpclusterconfigs"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CiliumBGPClusterConfigs that match those selectors. -func (c *ciliumBGPClusterConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CiliumBGPClusterConfigList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2alpha1.CiliumBGPClusterConfigList{} - err = c.client.Get(). - Resource("ciliumbgpclusterconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ciliumBGPClusterConfigs. -func (c *ciliumBGPClusterConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("ciliumbgpclusterconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ciliumBGPClusterConfig and creates it. Returns the server's representation of the ciliumBGPClusterConfig, and an error, if there is any. -func (c *ciliumBGPClusterConfigs) Create(ctx context.Context, ciliumBGPClusterConfig *v2alpha1.CiliumBGPClusterConfig, opts v1.CreateOptions) (result *v2alpha1.CiliumBGPClusterConfig, err error) { - result = &v2alpha1.CiliumBGPClusterConfig{} - err = c.client.Post(). - Resource("ciliumbgpclusterconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumBGPClusterConfig). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ciliumBGPClusterConfig and updates it. Returns the server's representation of the ciliumBGPClusterConfig, and an error, if there is any. -func (c *ciliumBGPClusterConfigs) Update(ctx context.Context, ciliumBGPClusterConfig *v2alpha1.CiliumBGPClusterConfig, opts v1.UpdateOptions) (result *v2alpha1.CiliumBGPClusterConfig, err error) { - result = &v2alpha1.CiliumBGPClusterConfig{} - err = c.client.Put(). - Resource("ciliumbgpclusterconfigs"). - Name(ciliumBGPClusterConfig.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumBGPClusterConfig). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ciliumBGPClusterConfig and deletes it. Returns an error if one occurs. -func (c *ciliumBGPClusterConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("ciliumbgpclusterconfigs"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ciliumBGPClusterConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("ciliumbgpclusterconfigs"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ciliumBGPClusterConfig. -func (c *ciliumBGPClusterConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumBGPClusterConfig, err error) { - result = &v2alpha1.CiliumBGPClusterConfig{} - err = c.client.Patch(pt). - Resource("ciliumbgpclusterconfigs"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumbgpnodeconfig.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumbgpnodeconfig.go deleted file mode 100644 index 005a60d64..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumbgpnodeconfig.go +++ /dev/null @@ -1,171 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - "time" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - scheme "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// CiliumBGPNodeConfigsGetter has a method to return a CiliumBGPNodeConfigInterface. -// A group's client should implement this interface. -type CiliumBGPNodeConfigsGetter interface { - CiliumBGPNodeConfigs() CiliumBGPNodeConfigInterface -} - -// CiliumBGPNodeConfigInterface has methods to work with CiliumBGPNodeConfig resources. -type CiliumBGPNodeConfigInterface interface { - Create(ctx context.Context, ciliumBGPNodeConfig *v2alpha1.CiliumBGPNodeConfig, opts v1.CreateOptions) (*v2alpha1.CiliumBGPNodeConfig, error) - Update(ctx context.Context, ciliumBGPNodeConfig *v2alpha1.CiliumBGPNodeConfig, opts v1.UpdateOptions) (*v2alpha1.CiliumBGPNodeConfig, error) - UpdateStatus(ctx context.Context, ciliumBGPNodeConfig *v2alpha1.CiliumBGPNodeConfig, opts v1.UpdateOptions) (*v2alpha1.CiliumBGPNodeConfig, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.CiliumBGPNodeConfig, error) - List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.CiliumBGPNodeConfigList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumBGPNodeConfig, err error) - CiliumBGPNodeConfigExpansion -} - -// ciliumBGPNodeConfigs implements CiliumBGPNodeConfigInterface -type ciliumBGPNodeConfigs struct { - client rest.Interface -} - -// newCiliumBGPNodeConfigs returns a CiliumBGPNodeConfigs -func newCiliumBGPNodeConfigs(c *CiliumV2alpha1Client) *ciliumBGPNodeConfigs { - return &ciliumBGPNodeConfigs{ - client: c.RESTClient(), - } -} - -// Get takes name of the ciliumBGPNodeConfig, and returns the corresponding ciliumBGPNodeConfig object, and an error if there is any. -func (c *ciliumBGPNodeConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CiliumBGPNodeConfig, err error) { - result = &v2alpha1.CiliumBGPNodeConfig{} - err = c.client.Get(). - Resource("ciliumbgpnodeconfigs"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CiliumBGPNodeConfigs that match those selectors. -func (c *ciliumBGPNodeConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CiliumBGPNodeConfigList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2alpha1.CiliumBGPNodeConfigList{} - err = c.client.Get(). - Resource("ciliumbgpnodeconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ciliumBGPNodeConfigs. -func (c *ciliumBGPNodeConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("ciliumbgpnodeconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ciliumBGPNodeConfig and creates it. Returns the server's representation of the ciliumBGPNodeConfig, and an error, if there is any. -func (c *ciliumBGPNodeConfigs) Create(ctx context.Context, ciliumBGPNodeConfig *v2alpha1.CiliumBGPNodeConfig, opts v1.CreateOptions) (result *v2alpha1.CiliumBGPNodeConfig, err error) { - result = &v2alpha1.CiliumBGPNodeConfig{} - err = c.client.Post(). - Resource("ciliumbgpnodeconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumBGPNodeConfig). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ciliumBGPNodeConfig and updates it. Returns the server's representation of the ciliumBGPNodeConfig, and an error, if there is any. -func (c *ciliumBGPNodeConfigs) Update(ctx context.Context, ciliumBGPNodeConfig *v2alpha1.CiliumBGPNodeConfig, opts v1.UpdateOptions) (result *v2alpha1.CiliumBGPNodeConfig, err error) { - result = &v2alpha1.CiliumBGPNodeConfig{} - err = c.client.Put(). - Resource("ciliumbgpnodeconfigs"). - Name(ciliumBGPNodeConfig.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumBGPNodeConfig). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *ciliumBGPNodeConfigs) UpdateStatus(ctx context.Context, ciliumBGPNodeConfig *v2alpha1.CiliumBGPNodeConfig, opts v1.UpdateOptions) (result *v2alpha1.CiliumBGPNodeConfig, err error) { - result = &v2alpha1.CiliumBGPNodeConfig{} - err = c.client.Put(). - Resource("ciliumbgpnodeconfigs"). - Name(ciliumBGPNodeConfig.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumBGPNodeConfig). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ciliumBGPNodeConfig and deletes it. Returns an error if one occurs. -func (c *ciliumBGPNodeConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("ciliumbgpnodeconfigs"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ciliumBGPNodeConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("ciliumbgpnodeconfigs"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ciliumBGPNodeConfig. -func (c *ciliumBGPNodeConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumBGPNodeConfig, err error) { - result = &v2alpha1.CiliumBGPNodeConfig{} - err = c.client.Patch(pt). - Resource("ciliumbgpnodeconfigs"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumbgpnodeconfigoverride.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumbgpnodeconfigoverride.go deleted file mode 100644 index 6c2276fde..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumbgpnodeconfigoverride.go +++ /dev/null @@ -1,155 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - "time" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - scheme "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// CiliumBGPNodeConfigOverridesGetter has a method to return a CiliumBGPNodeConfigOverrideInterface. -// A group's client should implement this interface. -type CiliumBGPNodeConfigOverridesGetter interface { - CiliumBGPNodeConfigOverrides() CiliumBGPNodeConfigOverrideInterface -} - -// CiliumBGPNodeConfigOverrideInterface has methods to work with CiliumBGPNodeConfigOverride resources. -type CiliumBGPNodeConfigOverrideInterface interface { - Create(ctx context.Context, ciliumBGPNodeConfigOverride *v2alpha1.CiliumBGPNodeConfigOverride, opts v1.CreateOptions) (*v2alpha1.CiliumBGPNodeConfigOverride, error) - Update(ctx context.Context, ciliumBGPNodeConfigOverride *v2alpha1.CiliumBGPNodeConfigOverride, opts v1.UpdateOptions) (*v2alpha1.CiliumBGPNodeConfigOverride, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.CiliumBGPNodeConfigOverride, error) - List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.CiliumBGPNodeConfigOverrideList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumBGPNodeConfigOverride, err error) - CiliumBGPNodeConfigOverrideExpansion -} - -// ciliumBGPNodeConfigOverrides implements CiliumBGPNodeConfigOverrideInterface -type ciliumBGPNodeConfigOverrides struct { - client rest.Interface -} - -// newCiliumBGPNodeConfigOverrides returns a CiliumBGPNodeConfigOverrides -func newCiliumBGPNodeConfigOverrides(c *CiliumV2alpha1Client) *ciliumBGPNodeConfigOverrides { - return &ciliumBGPNodeConfigOverrides{ - client: c.RESTClient(), - } -} - -// Get takes name of the ciliumBGPNodeConfigOverride, and returns the corresponding ciliumBGPNodeConfigOverride object, and an error if there is any. -func (c *ciliumBGPNodeConfigOverrides) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CiliumBGPNodeConfigOverride, err error) { - result = &v2alpha1.CiliumBGPNodeConfigOverride{} - err = c.client.Get(). - Resource("ciliumbgpnodeconfigoverrides"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CiliumBGPNodeConfigOverrides that match those selectors. -func (c *ciliumBGPNodeConfigOverrides) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CiliumBGPNodeConfigOverrideList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2alpha1.CiliumBGPNodeConfigOverrideList{} - err = c.client.Get(). - Resource("ciliumbgpnodeconfigoverrides"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ciliumBGPNodeConfigOverrides. -func (c *ciliumBGPNodeConfigOverrides) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("ciliumbgpnodeconfigoverrides"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ciliumBGPNodeConfigOverride and creates it. Returns the server's representation of the ciliumBGPNodeConfigOverride, and an error, if there is any. -func (c *ciliumBGPNodeConfigOverrides) Create(ctx context.Context, ciliumBGPNodeConfigOverride *v2alpha1.CiliumBGPNodeConfigOverride, opts v1.CreateOptions) (result *v2alpha1.CiliumBGPNodeConfigOverride, err error) { - result = &v2alpha1.CiliumBGPNodeConfigOverride{} - err = c.client.Post(). - Resource("ciliumbgpnodeconfigoverrides"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumBGPNodeConfigOverride). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ciliumBGPNodeConfigOverride and updates it. Returns the server's representation of the ciliumBGPNodeConfigOverride, and an error, if there is any. -func (c *ciliumBGPNodeConfigOverrides) Update(ctx context.Context, ciliumBGPNodeConfigOverride *v2alpha1.CiliumBGPNodeConfigOverride, opts v1.UpdateOptions) (result *v2alpha1.CiliumBGPNodeConfigOverride, err error) { - result = &v2alpha1.CiliumBGPNodeConfigOverride{} - err = c.client.Put(). - Resource("ciliumbgpnodeconfigoverrides"). - Name(ciliumBGPNodeConfigOverride.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumBGPNodeConfigOverride). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ciliumBGPNodeConfigOverride and deletes it. Returns an error if one occurs. -func (c *ciliumBGPNodeConfigOverrides) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("ciliumbgpnodeconfigoverrides"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ciliumBGPNodeConfigOverrides) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("ciliumbgpnodeconfigoverrides"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ciliumBGPNodeConfigOverride. -func (c *ciliumBGPNodeConfigOverrides) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumBGPNodeConfigOverride, err error) { - result = &v2alpha1.CiliumBGPNodeConfigOverride{} - err = c.client.Patch(pt). - Resource("ciliumbgpnodeconfigoverrides"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumbgppeerconfig.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumbgppeerconfig.go deleted file mode 100644 index da9915267..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumbgppeerconfig.go +++ /dev/null @@ -1,155 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - "time" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - scheme "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// CiliumBGPPeerConfigsGetter has a method to return a CiliumBGPPeerConfigInterface. -// A group's client should implement this interface. -type CiliumBGPPeerConfigsGetter interface { - CiliumBGPPeerConfigs() CiliumBGPPeerConfigInterface -} - -// CiliumBGPPeerConfigInterface has methods to work with CiliumBGPPeerConfig resources. -type CiliumBGPPeerConfigInterface interface { - Create(ctx context.Context, ciliumBGPPeerConfig *v2alpha1.CiliumBGPPeerConfig, opts v1.CreateOptions) (*v2alpha1.CiliumBGPPeerConfig, error) - Update(ctx context.Context, ciliumBGPPeerConfig *v2alpha1.CiliumBGPPeerConfig, opts v1.UpdateOptions) (*v2alpha1.CiliumBGPPeerConfig, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.CiliumBGPPeerConfig, error) - List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.CiliumBGPPeerConfigList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumBGPPeerConfig, err error) - CiliumBGPPeerConfigExpansion -} - -// ciliumBGPPeerConfigs implements CiliumBGPPeerConfigInterface -type ciliumBGPPeerConfigs struct { - client rest.Interface -} - -// newCiliumBGPPeerConfigs returns a CiliumBGPPeerConfigs -func newCiliumBGPPeerConfigs(c *CiliumV2alpha1Client) *ciliumBGPPeerConfigs { - return &ciliumBGPPeerConfigs{ - client: c.RESTClient(), - } -} - -// Get takes name of the ciliumBGPPeerConfig, and returns the corresponding ciliumBGPPeerConfig object, and an error if there is any. -func (c *ciliumBGPPeerConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CiliumBGPPeerConfig, err error) { - result = &v2alpha1.CiliumBGPPeerConfig{} - err = c.client.Get(). - Resource("ciliumbgppeerconfigs"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CiliumBGPPeerConfigs that match those selectors. -func (c *ciliumBGPPeerConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CiliumBGPPeerConfigList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2alpha1.CiliumBGPPeerConfigList{} - err = c.client.Get(). - Resource("ciliumbgppeerconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ciliumBGPPeerConfigs. -func (c *ciliumBGPPeerConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("ciliumbgppeerconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ciliumBGPPeerConfig and creates it. Returns the server's representation of the ciliumBGPPeerConfig, and an error, if there is any. -func (c *ciliumBGPPeerConfigs) Create(ctx context.Context, ciliumBGPPeerConfig *v2alpha1.CiliumBGPPeerConfig, opts v1.CreateOptions) (result *v2alpha1.CiliumBGPPeerConfig, err error) { - result = &v2alpha1.CiliumBGPPeerConfig{} - err = c.client.Post(). - Resource("ciliumbgppeerconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumBGPPeerConfig). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ciliumBGPPeerConfig and updates it. Returns the server's representation of the ciliumBGPPeerConfig, and an error, if there is any. -func (c *ciliumBGPPeerConfigs) Update(ctx context.Context, ciliumBGPPeerConfig *v2alpha1.CiliumBGPPeerConfig, opts v1.UpdateOptions) (result *v2alpha1.CiliumBGPPeerConfig, err error) { - result = &v2alpha1.CiliumBGPPeerConfig{} - err = c.client.Put(). - Resource("ciliumbgppeerconfigs"). - Name(ciliumBGPPeerConfig.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumBGPPeerConfig). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ciliumBGPPeerConfig and deletes it. Returns an error if one occurs. -func (c *ciliumBGPPeerConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("ciliumbgppeerconfigs"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ciliumBGPPeerConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("ciliumbgppeerconfigs"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ciliumBGPPeerConfig. -func (c *ciliumBGPPeerConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumBGPPeerConfig, err error) { - result = &v2alpha1.CiliumBGPPeerConfig{} - err = c.client.Patch(pt). - Resource("ciliumbgppeerconfigs"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumbgppeeringpolicy.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumbgppeeringpolicy.go deleted file mode 100644 index e19727c07..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumbgppeeringpolicy.go +++ /dev/null @@ -1,155 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - "time" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - scheme "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// CiliumBGPPeeringPoliciesGetter has a method to return a CiliumBGPPeeringPolicyInterface. -// A group's client should implement this interface. -type CiliumBGPPeeringPoliciesGetter interface { - CiliumBGPPeeringPolicies() CiliumBGPPeeringPolicyInterface -} - -// CiliumBGPPeeringPolicyInterface has methods to work with CiliumBGPPeeringPolicy resources. -type CiliumBGPPeeringPolicyInterface interface { - Create(ctx context.Context, ciliumBGPPeeringPolicy *v2alpha1.CiliumBGPPeeringPolicy, opts v1.CreateOptions) (*v2alpha1.CiliumBGPPeeringPolicy, error) - Update(ctx context.Context, ciliumBGPPeeringPolicy *v2alpha1.CiliumBGPPeeringPolicy, opts v1.UpdateOptions) (*v2alpha1.CiliumBGPPeeringPolicy, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.CiliumBGPPeeringPolicy, error) - List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.CiliumBGPPeeringPolicyList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumBGPPeeringPolicy, err error) - CiliumBGPPeeringPolicyExpansion -} - -// ciliumBGPPeeringPolicies implements CiliumBGPPeeringPolicyInterface -type ciliumBGPPeeringPolicies struct { - client rest.Interface -} - -// newCiliumBGPPeeringPolicies returns a CiliumBGPPeeringPolicies -func newCiliumBGPPeeringPolicies(c *CiliumV2alpha1Client) *ciliumBGPPeeringPolicies { - return &ciliumBGPPeeringPolicies{ - client: c.RESTClient(), - } -} - -// Get takes name of the ciliumBGPPeeringPolicy, and returns the corresponding ciliumBGPPeeringPolicy object, and an error if there is any. -func (c *ciliumBGPPeeringPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CiliumBGPPeeringPolicy, err error) { - result = &v2alpha1.CiliumBGPPeeringPolicy{} - err = c.client.Get(). - Resource("ciliumbgppeeringpolicies"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CiliumBGPPeeringPolicies that match those selectors. -func (c *ciliumBGPPeeringPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CiliumBGPPeeringPolicyList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2alpha1.CiliumBGPPeeringPolicyList{} - err = c.client.Get(). - Resource("ciliumbgppeeringpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ciliumBGPPeeringPolicies. -func (c *ciliumBGPPeeringPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("ciliumbgppeeringpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ciliumBGPPeeringPolicy and creates it. Returns the server's representation of the ciliumBGPPeeringPolicy, and an error, if there is any. -func (c *ciliumBGPPeeringPolicies) Create(ctx context.Context, ciliumBGPPeeringPolicy *v2alpha1.CiliumBGPPeeringPolicy, opts v1.CreateOptions) (result *v2alpha1.CiliumBGPPeeringPolicy, err error) { - result = &v2alpha1.CiliumBGPPeeringPolicy{} - err = c.client.Post(). - Resource("ciliumbgppeeringpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumBGPPeeringPolicy). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ciliumBGPPeeringPolicy and updates it. Returns the server's representation of the ciliumBGPPeeringPolicy, and an error, if there is any. -func (c *ciliumBGPPeeringPolicies) Update(ctx context.Context, ciliumBGPPeeringPolicy *v2alpha1.CiliumBGPPeeringPolicy, opts v1.UpdateOptions) (result *v2alpha1.CiliumBGPPeeringPolicy, err error) { - result = &v2alpha1.CiliumBGPPeeringPolicy{} - err = c.client.Put(). - Resource("ciliumbgppeeringpolicies"). - Name(ciliumBGPPeeringPolicy.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumBGPPeeringPolicy). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ciliumBGPPeeringPolicy and deletes it. Returns an error if one occurs. -func (c *ciliumBGPPeeringPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("ciliumbgppeeringpolicies"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ciliumBGPPeeringPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("ciliumbgppeeringpolicies"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ciliumBGPPeeringPolicy. -func (c *ciliumBGPPeeringPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumBGPPeeringPolicy, err error) { - result = &v2alpha1.CiliumBGPPeeringPolicy{} - err = c.client.Patch(pt). - Resource("ciliumbgppeeringpolicies"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumcidrgroup.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumcidrgroup.go deleted file mode 100644 index 42f93365b..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumcidrgroup.go +++ /dev/null @@ -1,155 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - "time" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - scheme "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// CiliumCIDRGroupsGetter has a method to return a CiliumCIDRGroupInterface. -// A group's client should implement this interface. -type CiliumCIDRGroupsGetter interface { - CiliumCIDRGroups() CiliumCIDRGroupInterface -} - -// CiliumCIDRGroupInterface has methods to work with CiliumCIDRGroup resources. -type CiliumCIDRGroupInterface interface { - Create(ctx context.Context, ciliumCIDRGroup *v2alpha1.CiliumCIDRGroup, opts v1.CreateOptions) (*v2alpha1.CiliumCIDRGroup, error) - Update(ctx context.Context, ciliumCIDRGroup *v2alpha1.CiliumCIDRGroup, opts v1.UpdateOptions) (*v2alpha1.CiliumCIDRGroup, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.CiliumCIDRGroup, error) - List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.CiliumCIDRGroupList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumCIDRGroup, err error) - CiliumCIDRGroupExpansion -} - -// ciliumCIDRGroups implements CiliumCIDRGroupInterface -type ciliumCIDRGroups struct { - client rest.Interface -} - -// newCiliumCIDRGroups returns a CiliumCIDRGroups -func newCiliumCIDRGroups(c *CiliumV2alpha1Client) *ciliumCIDRGroups { - return &ciliumCIDRGroups{ - client: c.RESTClient(), - } -} - -// Get takes name of the ciliumCIDRGroup, and returns the corresponding ciliumCIDRGroup object, and an error if there is any. -func (c *ciliumCIDRGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CiliumCIDRGroup, err error) { - result = &v2alpha1.CiliumCIDRGroup{} - err = c.client.Get(). - Resource("ciliumcidrgroups"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CiliumCIDRGroups that match those selectors. -func (c *ciliumCIDRGroups) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CiliumCIDRGroupList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2alpha1.CiliumCIDRGroupList{} - err = c.client.Get(). - Resource("ciliumcidrgroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ciliumCIDRGroups. -func (c *ciliumCIDRGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("ciliumcidrgroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ciliumCIDRGroup and creates it. Returns the server's representation of the ciliumCIDRGroup, and an error, if there is any. -func (c *ciliumCIDRGroups) Create(ctx context.Context, ciliumCIDRGroup *v2alpha1.CiliumCIDRGroup, opts v1.CreateOptions) (result *v2alpha1.CiliumCIDRGroup, err error) { - result = &v2alpha1.CiliumCIDRGroup{} - err = c.client.Post(). - Resource("ciliumcidrgroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumCIDRGroup). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ciliumCIDRGroup and updates it. Returns the server's representation of the ciliumCIDRGroup, and an error, if there is any. -func (c *ciliumCIDRGroups) Update(ctx context.Context, ciliumCIDRGroup *v2alpha1.CiliumCIDRGroup, opts v1.UpdateOptions) (result *v2alpha1.CiliumCIDRGroup, err error) { - result = &v2alpha1.CiliumCIDRGroup{} - err = c.client.Put(). - Resource("ciliumcidrgroups"). - Name(ciliumCIDRGroup.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumCIDRGroup). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ciliumCIDRGroup and deletes it. Returns an error if one occurs. -func (c *ciliumCIDRGroups) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("ciliumcidrgroups"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ciliumCIDRGroups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("ciliumcidrgroups"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ciliumCIDRGroup. -func (c *ciliumCIDRGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumCIDRGroup, err error) { - result = &v2alpha1.CiliumCIDRGroup{} - err = c.client.Patch(pt). - Resource("ciliumcidrgroups"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumendpointslice.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumendpointslice.go deleted file mode 100644 index 55cdaf11b..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumendpointslice.go +++ /dev/null @@ -1,155 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - "time" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - scheme "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// CiliumEndpointSlicesGetter has a method to return a CiliumEndpointSliceInterface. -// A group's client should implement this interface. -type CiliumEndpointSlicesGetter interface { - CiliumEndpointSlices() CiliumEndpointSliceInterface -} - -// CiliumEndpointSliceInterface has methods to work with CiliumEndpointSlice resources. -type CiliumEndpointSliceInterface interface { - Create(ctx context.Context, ciliumEndpointSlice *v2alpha1.CiliumEndpointSlice, opts v1.CreateOptions) (*v2alpha1.CiliumEndpointSlice, error) - Update(ctx context.Context, ciliumEndpointSlice *v2alpha1.CiliumEndpointSlice, opts v1.UpdateOptions) (*v2alpha1.CiliumEndpointSlice, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.CiliumEndpointSlice, error) - List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.CiliumEndpointSliceList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumEndpointSlice, err error) - CiliumEndpointSliceExpansion -} - -// ciliumEndpointSlices implements CiliumEndpointSliceInterface -type ciliumEndpointSlices struct { - client rest.Interface -} - -// newCiliumEndpointSlices returns a CiliumEndpointSlices -func newCiliumEndpointSlices(c *CiliumV2alpha1Client) *ciliumEndpointSlices { - return &ciliumEndpointSlices{ - client: c.RESTClient(), - } -} - -// Get takes name of the ciliumEndpointSlice, and returns the corresponding ciliumEndpointSlice object, and an error if there is any. -func (c *ciliumEndpointSlices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CiliumEndpointSlice, err error) { - result = &v2alpha1.CiliumEndpointSlice{} - err = c.client.Get(). - Resource("ciliumendpointslices"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CiliumEndpointSlices that match those selectors. -func (c *ciliumEndpointSlices) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CiliumEndpointSliceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2alpha1.CiliumEndpointSliceList{} - err = c.client.Get(). - Resource("ciliumendpointslices"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ciliumEndpointSlices. -func (c *ciliumEndpointSlices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("ciliumendpointslices"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ciliumEndpointSlice and creates it. Returns the server's representation of the ciliumEndpointSlice, and an error, if there is any. -func (c *ciliumEndpointSlices) Create(ctx context.Context, ciliumEndpointSlice *v2alpha1.CiliumEndpointSlice, opts v1.CreateOptions) (result *v2alpha1.CiliumEndpointSlice, err error) { - result = &v2alpha1.CiliumEndpointSlice{} - err = c.client.Post(). - Resource("ciliumendpointslices"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumEndpointSlice). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ciliumEndpointSlice and updates it. Returns the server's representation of the ciliumEndpointSlice, and an error, if there is any. -func (c *ciliumEndpointSlices) Update(ctx context.Context, ciliumEndpointSlice *v2alpha1.CiliumEndpointSlice, opts v1.UpdateOptions) (result *v2alpha1.CiliumEndpointSlice, err error) { - result = &v2alpha1.CiliumEndpointSlice{} - err = c.client.Put(). - Resource("ciliumendpointslices"). - Name(ciliumEndpointSlice.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumEndpointSlice). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ciliumEndpointSlice and deletes it. Returns an error if one occurs. -func (c *ciliumEndpointSlices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("ciliumendpointslices"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ciliumEndpointSlices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("ciliumendpointslices"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ciliumEndpointSlice. -func (c *ciliumEndpointSlices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumEndpointSlice, err error) { - result = &v2alpha1.CiliumEndpointSlice{} - err = c.client.Patch(pt). - Resource("ciliumendpointslices"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliuml2announcementpolicy.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliuml2announcementpolicy.go deleted file mode 100644 index bed50df46..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliuml2announcementpolicy.go +++ /dev/null @@ -1,171 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - "time" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - scheme "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// CiliumL2AnnouncementPoliciesGetter has a method to return a CiliumL2AnnouncementPolicyInterface. -// A group's client should implement this interface. -type CiliumL2AnnouncementPoliciesGetter interface { - CiliumL2AnnouncementPolicies() CiliumL2AnnouncementPolicyInterface -} - -// CiliumL2AnnouncementPolicyInterface has methods to work with CiliumL2AnnouncementPolicy resources. -type CiliumL2AnnouncementPolicyInterface interface { - Create(ctx context.Context, ciliumL2AnnouncementPolicy *v2alpha1.CiliumL2AnnouncementPolicy, opts v1.CreateOptions) (*v2alpha1.CiliumL2AnnouncementPolicy, error) - Update(ctx context.Context, ciliumL2AnnouncementPolicy *v2alpha1.CiliumL2AnnouncementPolicy, opts v1.UpdateOptions) (*v2alpha1.CiliumL2AnnouncementPolicy, error) - UpdateStatus(ctx context.Context, ciliumL2AnnouncementPolicy *v2alpha1.CiliumL2AnnouncementPolicy, opts v1.UpdateOptions) (*v2alpha1.CiliumL2AnnouncementPolicy, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.CiliumL2AnnouncementPolicy, error) - List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.CiliumL2AnnouncementPolicyList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumL2AnnouncementPolicy, err error) - CiliumL2AnnouncementPolicyExpansion -} - -// ciliumL2AnnouncementPolicies implements CiliumL2AnnouncementPolicyInterface -type ciliumL2AnnouncementPolicies struct { - client rest.Interface -} - -// newCiliumL2AnnouncementPolicies returns a CiliumL2AnnouncementPolicies -func newCiliumL2AnnouncementPolicies(c *CiliumV2alpha1Client) *ciliumL2AnnouncementPolicies { - return &ciliumL2AnnouncementPolicies{ - client: c.RESTClient(), - } -} - -// Get takes name of the ciliumL2AnnouncementPolicy, and returns the corresponding ciliumL2AnnouncementPolicy object, and an error if there is any. -func (c *ciliumL2AnnouncementPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CiliumL2AnnouncementPolicy, err error) { - result = &v2alpha1.CiliumL2AnnouncementPolicy{} - err = c.client.Get(). - Resource("ciliuml2announcementpolicies"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CiliumL2AnnouncementPolicies that match those selectors. -func (c *ciliumL2AnnouncementPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CiliumL2AnnouncementPolicyList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2alpha1.CiliumL2AnnouncementPolicyList{} - err = c.client.Get(). - Resource("ciliuml2announcementpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ciliumL2AnnouncementPolicies. -func (c *ciliumL2AnnouncementPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("ciliuml2announcementpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ciliumL2AnnouncementPolicy and creates it. Returns the server's representation of the ciliumL2AnnouncementPolicy, and an error, if there is any. -func (c *ciliumL2AnnouncementPolicies) Create(ctx context.Context, ciliumL2AnnouncementPolicy *v2alpha1.CiliumL2AnnouncementPolicy, opts v1.CreateOptions) (result *v2alpha1.CiliumL2AnnouncementPolicy, err error) { - result = &v2alpha1.CiliumL2AnnouncementPolicy{} - err = c.client.Post(). - Resource("ciliuml2announcementpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumL2AnnouncementPolicy). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ciliumL2AnnouncementPolicy and updates it. Returns the server's representation of the ciliumL2AnnouncementPolicy, and an error, if there is any. -func (c *ciliumL2AnnouncementPolicies) Update(ctx context.Context, ciliumL2AnnouncementPolicy *v2alpha1.CiliumL2AnnouncementPolicy, opts v1.UpdateOptions) (result *v2alpha1.CiliumL2AnnouncementPolicy, err error) { - result = &v2alpha1.CiliumL2AnnouncementPolicy{} - err = c.client.Put(). - Resource("ciliuml2announcementpolicies"). - Name(ciliumL2AnnouncementPolicy.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumL2AnnouncementPolicy). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *ciliumL2AnnouncementPolicies) UpdateStatus(ctx context.Context, ciliumL2AnnouncementPolicy *v2alpha1.CiliumL2AnnouncementPolicy, opts v1.UpdateOptions) (result *v2alpha1.CiliumL2AnnouncementPolicy, err error) { - result = &v2alpha1.CiliumL2AnnouncementPolicy{} - err = c.client.Put(). - Resource("ciliuml2announcementpolicies"). - Name(ciliumL2AnnouncementPolicy.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumL2AnnouncementPolicy). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ciliumL2AnnouncementPolicy and deletes it. Returns an error if one occurs. -func (c *ciliumL2AnnouncementPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("ciliuml2announcementpolicies"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ciliumL2AnnouncementPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("ciliuml2announcementpolicies"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ciliumL2AnnouncementPolicy. -func (c *ciliumL2AnnouncementPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumL2AnnouncementPolicy, err error) { - result = &v2alpha1.CiliumL2AnnouncementPolicy{} - err = c.client.Patch(pt). - Resource("ciliuml2announcementpolicies"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumloadbalancerippool.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumloadbalancerippool.go deleted file mode 100644 index bdc76f4a5..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumloadbalancerippool.go +++ /dev/null @@ -1,171 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - "time" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - scheme "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// CiliumLoadBalancerIPPoolsGetter has a method to return a CiliumLoadBalancerIPPoolInterface. -// A group's client should implement this interface. -type CiliumLoadBalancerIPPoolsGetter interface { - CiliumLoadBalancerIPPools() CiliumLoadBalancerIPPoolInterface -} - -// CiliumLoadBalancerIPPoolInterface has methods to work with CiliumLoadBalancerIPPool resources. -type CiliumLoadBalancerIPPoolInterface interface { - Create(ctx context.Context, ciliumLoadBalancerIPPool *v2alpha1.CiliumLoadBalancerIPPool, opts v1.CreateOptions) (*v2alpha1.CiliumLoadBalancerIPPool, error) - Update(ctx context.Context, ciliumLoadBalancerIPPool *v2alpha1.CiliumLoadBalancerIPPool, opts v1.UpdateOptions) (*v2alpha1.CiliumLoadBalancerIPPool, error) - UpdateStatus(ctx context.Context, ciliumLoadBalancerIPPool *v2alpha1.CiliumLoadBalancerIPPool, opts v1.UpdateOptions) (*v2alpha1.CiliumLoadBalancerIPPool, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.CiliumLoadBalancerIPPool, error) - List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.CiliumLoadBalancerIPPoolList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumLoadBalancerIPPool, err error) - CiliumLoadBalancerIPPoolExpansion -} - -// ciliumLoadBalancerIPPools implements CiliumLoadBalancerIPPoolInterface -type ciliumLoadBalancerIPPools struct { - client rest.Interface -} - -// newCiliumLoadBalancerIPPools returns a CiliumLoadBalancerIPPools -func newCiliumLoadBalancerIPPools(c *CiliumV2alpha1Client) *ciliumLoadBalancerIPPools { - return &ciliumLoadBalancerIPPools{ - client: c.RESTClient(), - } -} - -// Get takes name of the ciliumLoadBalancerIPPool, and returns the corresponding ciliumLoadBalancerIPPool object, and an error if there is any. -func (c *ciliumLoadBalancerIPPools) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CiliumLoadBalancerIPPool, err error) { - result = &v2alpha1.CiliumLoadBalancerIPPool{} - err = c.client.Get(). - Resource("ciliumloadbalancerippools"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CiliumLoadBalancerIPPools that match those selectors. -func (c *ciliumLoadBalancerIPPools) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CiliumLoadBalancerIPPoolList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2alpha1.CiliumLoadBalancerIPPoolList{} - err = c.client.Get(). - Resource("ciliumloadbalancerippools"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ciliumLoadBalancerIPPools. -func (c *ciliumLoadBalancerIPPools) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("ciliumloadbalancerippools"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ciliumLoadBalancerIPPool and creates it. Returns the server's representation of the ciliumLoadBalancerIPPool, and an error, if there is any. -func (c *ciliumLoadBalancerIPPools) Create(ctx context.Context, ciliumLoadBalancerIPPool *v2alpha1.CiliumLoadBalancerIPPool, opts v1.CreateOptions) (result *v2alpha1.CiliumLoadBalancerIPPool, err error) { - result = &v2alpha1.CiliumLoadBalancerIPPool{} - err = c.client.Post(). - Resource("ciliumloadbalancerippools"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumLoadBalancerIPPool). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ciliumLoadBalancerIPPool and updates it. Returns the server's representation of the ciliumLoadBalancerIPPool, and an error, if there is any. -func (c *ciliumLoadBalancerIPPools) Update(ctx context.Context, ciliumLoadBalancerIPPool *v2alpha1.CiliumLoadBalancerIPPool, opts v1.UpdateOptions) (result *v2alpha1.CiliumLoadBalancerIPPool, err error) { - result = &v2alpha1.CiliumLoadBalancerIPPool{} - err = c.client.Put(). - Resource("ciliumloadbalancerippools"). - Name(ciliumLoadBalancerIPPool.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumLoadBalancerIPPool). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *ciliumLoadBalancerIPPools) UpdateStatus(ctx context.Context, ciliumLoadBalancerIPPool *v2alpha1.CiliumLoadBalancerIPPool, opts v1.UpdateOptions) (result *v2alpha1.CiliumLoadBalancerIPPool, err error) { - result = &v2alpha1.CiliumLoadBalancerIPPool{} - err = c.client.Put(). - Resource("ciliumloadbalancerippools"). - Name(ciliumLoadBalancerIPPool.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumLoadBalancerIPPool). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ciliumLoadBalancerIPPool and deletes it. Returns an error if one occurs. -func (c *ciliumLoadBalancerIPPools) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("ciliumloadbalancerippools"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ciliumLoadBalancerIPPools) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("ciliumloadbalancerippools"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ciliumLoadBalancerIPPool. -func (c *ciliumLoadBalancerIPPools) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumLoadBalancerIPPool, err error) { - result = &v2alpha1.CiliumLoadBalancerIPPool{} - err = c.client.Patch(pt). - Resource("ciliumloadbalancerippools"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumnodeconfig.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumnodeconfig.go deleted file mode 100644 index bff4996a0..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumnodeconfig.go +++ /dev/null @@ -1,165 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - "time" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - scheme "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// CiliumNodeConfigsGetter has a method to return a CiliumNodeConfigInterface. -// A group's client should implement this interface. -type CiliumNodeConfigsGetter interface { - CiliumNodeConfigs(namespace string) CiliumNodeConfigInterface -} - -// CiliumNodeConfigInterface has methods to work with CiliumNodeConfig resources. -type CiliumNodeConfigInterface interface { - Create(ctx context.Context, ciliumNodeConfig *v2alpha1.CiliumNodeConfig, opts v1.CreateOptions) (*v2alpha1.CiliumNodeConfig, error) - Update(ctx context.Context, ciliumNodeConfig *v2alpha1.CiliumNodeConfig, opts v1.UpdateOptions) (*v2alpha1.CiliumNodeConfig, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.CiliumNodeConfig, error) - List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.CiliumNodeConfigList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumNodeConfig, err error) - CiliumNodeConfigExpansion -} - -// ciliumNodeConfigs implements CiliumNodeConfigInterface -type ciliumNodeConfigs struct { - client rest.Interface - ns string -} - -// newCiliumNodeConfigs returns a CiliumNodeConfigs -func newCiliumNodeConfigs(c *CiliumV2alpha1Client, namespace string) *ciliumNodeConfigs { - return &ciliumNodeConfigs{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the ciliumNodeConfig, and returns the corresponding ciliumNodeConfig object, and an error if there is any. -func (c *ciliumNodeConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CiliumNodeConfig, err error) { - result = &v2alpha1.CiliumNodeConfig{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ciliumnodeconfigs"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CiliumNodeConfigs that match those selectors. -func (c *ciliumNodeConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CiliumNodeConfigList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2alpha1.CiliumNodeConfigList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ciliumnodeconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ciliumNodeConfigs. -func (c *ciliumNodeConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("ciliumnodeconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ciliumNodeConfig and creates it. Returns the server's representation of the ciliumNodeConfig, and an error, if there is any. -func (c *ciliumNodeConfigs) Create(ctx context.Context, ciliumNodeConfig *v2alpha1.CiliumNodeConfig, opts v1.CreateOptions) (result *v2alpha1.CiliumNodeConfig, err error) { - result = &v2alpha1.CiliumNodeConfig{} - err = c.client.Post(). - Namespace(c.ns). - Resource("ciliumnodeconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumNodeConfig). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ciliumNodeConfig and updates it. Returns the server's representation of the ciliumNodeConfig, and an error, if there is any. -func (c *ciliumNodeConfigs) Update(ctx context.Context, ciliumNodeConfig *v2alpha1.CiliumNodeConfig, opts v1.UpdateOptions) (result *v2alpha1.CiliumNodeConfig, err error) { - result = &v2alpha1.CiliumNodeConfig{} - err = c.client.Put(). - Namespace(c.ns). - Resource("ciliumnodeconfigs"). - Name(ciliumNodeConfig.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumNodeConfig). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ciliumNodeConfig and deletes it. Returns an error if one occurs. -func (c *ciliumNodeConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("ciliumnodeconfigs"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ciliumNodeConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("ciliumnodeconfigs"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ciliumNodeConfig. -func (c *ciliumNodeConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumNodeConfig, err error) { - result = &v2alpha1.CiliumNodeConfig{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("ciliumnodeconfigs"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumpodippool.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumpodippool.go deleted file mode 100644 index 024442952..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/ciliumpodippool.go +++ /dev/null @@ -1,155 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - "time" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - scheme "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// CiliumPodIPPoolsGetter has a method to return a CiliumPodIPPoolInterface. -// A group's client should implement this interface. -type CiliumPodIPPoolsGetter interface { - CiliumPodIPPools() CiliumPodIPPoolInterface -} - -// CiliumPodIPPoolInterface has methods to work with CiliumPodIPPool resources. -type CiliumPodIPPoolInterface interface { - Create(ctx context.Context, ciliumPodIPPool *v2alpha1.CiliumPodIPPool, opts v1.CreateOptions) (*v2alpha1.CiliumPodIPPool, error) - Update(ctx context.Context, ciliumPodIPPool *v2alpha1.CiliumPodIPPool, opts v1.UpdateOptions) (*v2alpha1.CiliumPodIPPool, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.CiliumPodIPPool, error) - List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.CiliumPodIPPoolList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumPodIPPool, err error) - CiliumPodIPPoolExpansion -} - -// ciliumPodIPPools implements CiliumPodIPPoolInterface -type ciliumPodIPPools struct { - client rest.Interface -} - -// newCiliumPodIPPools returns a CiliumPodIPPools -func newCiliumPodIPPools(c *CiliumV2alpha1Client) *ciliumPodIPPools { - return &ciliumPodIPPools{ - client: c.RESTClient(), - } -} - -// Get takes name of the ciliumPodIPPool, and returns the corresponding ciliumPodIPPool object, and an error if there is any. -func (c *ciliumPodIPPools) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CiliumPodIPPool, err error) { - result = &v2alpha1.CiliumPodIPPool{} - err = c.client.Get(). - Resource("ciliumpodippools"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CiliumPodIPPools that match those selectors. -func (c *ciliumPodIPPools) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CiliumPodIPPoolList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2alpha1.CiliumPodIPPoolList{} - err = c.client.Get(). - Resource("ciliumpodippools"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ciliumPodIPPools. -func (c *ciliumPodIPPools) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("ciliumpodippools"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ciliumPodIPPool and creates it. Returns the server's representation of the ciliumPodIPPool, and an error, if there is any. -func (c *ciliumPodIPPools) Create(ctx context.Context, ciliumPodIPPool *v2alpha1.CiliumPodIPPool, opts v1.CreateOptions) (result *v2alpha1.CiliumPodIPPool, err error) { - result = &v2alpha1.CiliumPodIPPool{} - err = c.client.Post(). - Resource("ciliumpodippools"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumPodIPPool). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ciliumPodIPPool and updates it. Returns the server's representation of the ciliumPodIPPool, and an error, if there is any. -func (c *ciliumPodIPPools) Update(ctx context.Context, ciliumPodIPPool *v2alpha1.CiliumPodIPPool, opts v1.UpdateOptions) (result *v2alpha1.CiliumPodIPPool, err error) { - result = &v2alpha1.CiliumPodIPPool{} - err = c.client.Put(). - Resource("ciliumpodippools"). - Name(ciliumPodIPPool.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ciliumPodIPPool). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ciliumPodIPPool and deletes it. Returns an error if one occurs. -func (c *ciliumPodIPPools) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("ciliumpodippools"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ciliumPodIPPools) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("ciliumpodippools"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ciliumPodIPPool. -func (c *ciliumPodIPPools) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumPodIPPool, err error) { - result = &v2alpha1.CiliumPodIPPool{} - err = c.client.Patch(pt). - Resource("ciliumpodippools"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/doc.go deleted file mode 100644 index 0caa68e33..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated typed clients. -package v2alpha1 diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/doc.go deleted file mode 100644 index 57bd090ef..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -// Package fake has the automatically generated clients. -package fake diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_cilium.io_client.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_cilium.io_client.go deleted file mode 100644 index a1c62d0ec..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_cilium.io_client.go +++ /dev/null @@ -1,71 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v2alpha1 "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeCiliumV2alpha1 struct { - *testing.Fake -} - -func (c *FakeCiliumV2alpha1) CiliumBGPAdvertisements() v2alpha1.CiliumBGPAdvertisementInterface { - return &FakeCiliumBGPAdvertisements{c} -} - -func (c *FakeCiliumV2alpha1) CiliumBGPClusterConfigs() v2alpha1.CiliumBGPClusterConfigInterface { - return &FakeCiliumBGPClusterConfigs{c} -} - -func (c *FakeCiliumV2alpha1) CiliumBGPNodeConfigs() v2alpha1.CiliumBGPNodeConfigInterface { - return &FakeCiliumBGPNodeConfigs{c} -} - -func (c *FakeCiliumV2alpha1) CiliumBGPNodeConfigOverrides() v2alpha1.CiliumBGPNodeConfigOverrideInterface { - return &FakeCiliumBGPNodeConfigOverrides{c} -} - -func (c *FakeCiliumV2alpha1) CiliumBGPPeerConfigs() v2alpha1.CiliumBGPPeerConfigInterface { - return &FakeCiliumBGPPeerConfigs{c} -} - -func (c *FakeCiliumV2alpha1) CiliumBGPPeeringPolicies() v2alpha1.CiliumBGPPeeringPolicyInterface { - return &FakeCiliumBGPPeeringPolicies{c} -} - -func (c *FakeCiliumV2alpha1) CiliumCIDRGroups() v2alpha1.CiliumCIDRGroupInterface { - return &FakeCiliumCIDRGroups{c} -} - -func (c *FakeCiliumV2alpha1) CiliumEndpointSlices() v2alpha1.CiliumEndpointSliceInterface { - return &FakeCiliumEndpointSlices{c} -} - -func (c *FakeCiliumV2alpha1) CiliumL2AnnouncementPolicies() v2alpha1.CiliumL2AnnouncementPolicyInterface { - return &FakeCiliumL2AnnouncementPolicies{c} -} - -func (c *FakeCiliumV2alpha1) CiliumLoadBalancerIPPools() v2alpha1.CiliumLoadBalancerIPPoolInterface { - return &FakeCiliumLoadBalancerIPPools{c} -} - -func (c *FakeCiliumV2alpha1) CiliumNodeConfigs(namespace string) v2alpha1.CiliumNodeConfigInterface { - return &FakeCiliumNodeConfigs{c, namespace} -} - -func (c *FakeCiliumV2alpha1) CiliumPodIPPools() v2alpha1.CiliumPodIPPoolInterface { - return &FakeCiliumPodIPPools{c} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeCiliumV2alpha1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumbgpadvertisement.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumbgpadvertisement.go deleted file mode 100644 index 1afca1780..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumbgpadvertisement.go +++ /dev/null @@ -1,108 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeCiliumBGPAdvertisements implements CiliumBGPAdvertisementInterface -type FakeCiliumBGPAdvertisements struct { - Fake *FakeCiliumV2alpha1 -} - -var ciliumbgpadvertisementsResource = v2alpha1.SchemeGroupVersion.WithResource("ciliumbgpadvertisements") - -var ciliumbgpadvertisementsKind = v2alpha1.SchemeGroupVersion.WithKind("CiliumBGPAdvertisement") - -// Get takes name of the ciliumBGPAdvertisement, and returns the corresponding ciliumBGPAdvertisement object, and an error if there is any. -func (c *FakeCiliumBGPAdvertisements) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CiliumBGPAdvertisement, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(ciliumbgpadvertisementsResource, name), &v2alpha1.CiliumBGPAdvertisement{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPAdvertisement), err -} - -// List takes label and field selectors, and returns the list of CiliumBGPAdvertisements that match those selectors. -func (c *FakeCiliumBGPAdvertisements) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CiliumBGPAdvertisementList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(ciliumbgpadvertisementsResource, ciliumbgpadvertisementsKind, opts), &v2alpha1.CiliumBGPAdvertisementList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2alpha1.CiliumBGPAdvertisementList{ListMeta: obj.(*v2alpha1.CiliumBGPAdvertisementList).ListMeta} - for _, item := range obj.(*v2alpha1.CiliumBGPAdvertisementList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ciliumBGPAdvertisements. -func (c *FakeCiliumBGPAdvertisements) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(ciliumbgpadvertisementsResource, opts)) -} - -// Create takes the representation of a ciliumBGPAdvertisement and creates it. Returns the server's representation of the ciliumBGPAdvertisement, and an error, if there is any. -func (c *FakeCiliumBGPAdvertisements) Create(ctx context.Context, ciliumBGPAdvertisement *v2alpha1.CiliumBGPAdvertisement, opts v1.CreateOptions) (result *v2alpha1.CiliumBGPAdvertisement, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(ciliumbgpadvertisementsResource, ciliumBGPAdvertisement), &v2alpha1.CiliumBGPAdvertisement{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPAdvertisement), err -} - -// Update takes the representation of a ciliumBGPAdvertisement and updates it. Returns the server's representation of the ciliumBGPAdvertisement, and an error, if there is any. -func (c *FakeCiliumBGPAdvertisements) Update(ctx context.Context, ciliumBGPAdvertisement *v2alpha1.CiliumBGPAdvertisement, opts v1.UpdateOptions) (result *v2alpha1.CiliumBGPAdvertisement, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(ciliumbgpadvertisementsResource, ciliumBGPAdvertisement), &v2alpha1.CiliumBGPAdvertisement{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPAdvertisement), err -} - -// Delete takes name of the ciliumBGPAdvertisement and deletes it. Returns an error if one occurs. -func (c *FakeCiliumBGPAdvertisements) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(ciliumbgpadvertisementsResource, name, opts), &v2alpha1.CiliumBGPAdvertisement{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeCiliumBGPAdvertisements) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(ciliumbgpadvertisementsResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2alpha1.CiliumBGPAdvertisementList{}) - return err -} - -// Patch applies the patch and returns the patched ciliumBGPAdvertisement. -func (c *FakeCiliumBGPAdvertisements) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumBGPAdvertisement, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(ciliumbgpadvertisementsResource, name, pt, data, subresources...), &v2alpha1.CiliumBGPAdvertisement{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPAdvertisement), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumbgpclusterconfig.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumbgpclusterconfig.go deleted file mode 100644 index f01cc1930..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumbgpclusterconfig.go +++ /dev/null @@ -1,108 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeCiliumBGPClusterConfigs implements CiliumBGPClusterConfigInterface -type FakeCiliumBGPClusterConfigs struct { - Fake *FakeCiliumV2alpha1 -} - -var ciliumbgpclusterconfigsResource = v2alpha1.SchemeGroupVersion.WithResource("ciliumbgpclusterconfigs") - -var ciliumbgpclusterconfigsKind = v2alpha1.SchemeGroupVersion.WithKind("CiliumBGPClusterConfig") - -// Get takes name of the ciliumBGPClusterConfig, and returns the corresponding ciliumBGPClusterConfig object, and an error if there is any. -func (c *FakeCiliumBGPClusterConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CiliumBGPClusterConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(ciliumbgpclusterconfigsResource, name), &v2alpha1.CiliumBGPClusterConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPClusterConfig), err -} - -// List takes label and field selectors, and returns the list of CiliumBGPClusterConfigs that match those selectors. -func (c *FakeCiliumBGPClusterConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CiliumBGPClusterConfigList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(ciliumbgpclusterconfigsResource, ciliumbgpclusterconfigsKind, opts), &v2alpha1.CiliumBGPClusterConfigList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2alpha1.CiliumBGPClusterConfigList{ListMeta: obj.(*v2alpha1.CiliumBGPClusterConfigList).ListMeta} - for _, item := range obj.(*v2alpha1.CiliumBGPClusterConfigList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ciliumBGPClusterConfigs. -func (c *FakeCiliumBGPClusterConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(ciliumbgpclusterconfigsResource, opts)) -} - -// Create takes the representation of a ciliumBGPClusterConfig and creates it. Returns the server's representation of the ciliumBGPClusterConfig, and an error, if there is any. -func (c *FakeCiliumBGPClusterConfigs) Create(ctx context.Context, ciliumBGPClusterConfig *v2alpha1.CiliumBGPClusterConfig, opts v1.CreateOptions) (result *v2alpha1.CiliumBGPClusterConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(ciliumbgpclusterconfigsResource, ciliumBGPClusterConfig), &v2alpha1.CiliumBGPClusterConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPClusterConfig), err -} - -// Update takes the representation of a ciliumBGPClusterConfig and updates it. Returns the server's representation of the ciliumBGPClusterConfig, and an error, if there is any. -func (c *FakeCiliumBGPClusterConfigs) Update(ctx context.Context, ciliumBGPClusterConfig *v2alpha1.CiliumBGPClusterConfig, opts v1.UpdateOptions) (result *v2alpha1.CiliumBGPClusterConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(ciliumbgpclusterconfigsResource, ciliumBGPClusterConfig), &v2alpha1.CiliumBGPClusterConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPClusterConfig), err -} - -// Delete takes name of the ciliumBGPClusterConfig and deletes it. Returns an error if one occurs. -func (c *FakeCiliumBGPClusterConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(ciliumbgpclusterconfigsResource, name, opts), &v2alpha1.CiliumBGPClusterConfig{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeCiliumBGPClusterConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(ciliumbgpclusterconfigsResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2alpha1.CiliumBGPClusterConfigList{}) - return err -} - -// Patch applies the patch and returns the patched ciliumBGPClusterConfig. -func (c *FakeCiliumBGPClusterConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumBGPClusterConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(ciliumbgpclusterconfigsResource, name, pt, data, subresources...), &v2alpha1.CiliumBGPClusterConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPClusterConfig), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumbgpnodeconfig.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumbgpnodeconfig.go deleted file mode 100644 index 9bd9953a2..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumbgpnodeconfig.go +++ /dev/null @@ -1,119 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeCiliumBGPNodeConfigs implements CiliumBGPNodeConfigInterface -type FakeCiliumBGPNodeConfigs struct { - Fake *FakeCiliumV2alpha1 -} - -var ciliumbgpnodeconfigsResource = v2alpha1.SchemeGroupVersion.WithResource("ciliumbgpnodeconfigs") - -var ciliumbgpnodeconfigsKind = v2alpha1.SchemeGroupVersion.WithKind("CiliumBGPNodeConfig") - -// Get takes name of the ciliumBGPNodeConfig, and returns the corresponding ciliumBGPNodeConfig object, and an error if there is any. -func (c *FakeCiliumBGPNodeConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CiliumBGPNodeConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(ciliumbgpnodeconfigsResource, name), &v2alpha1.CiliumBGPNodeConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPNodeConfig), err -} - -// List takes label and field selectors, and returns the list of CiliumBGPNodeConfigs that match those selectors. -func (c *FakeCiliumBGPNodeConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CiliumBGPNodeConfigList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(ciliumbgpnodeconfigsResource, ciliumbgpnodeconfigsKind, opts), &v2alpha1.CiliumBGPNodeConfigList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2alpha1.CiliumBGPNodeConfigList{ListMeta: obj.(*v2alpha1.CiliumBGPNodeConfigList).ListMeta} - for _, item := range obj.(*v2alpha1.CiliumBGPNodeConfigList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ciliumBGPNodeConfigs. -func (c *FakeCiliumBGPNodeConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(ciliumbgpnodeconfigsResource, opts)) -} - -// Create takes the representation of a ciliumBGPNodeConfig and creates it. Returns the server's representation of the ciliumBGPNodeConfig, and an error, if there is any. -func (c *FakeCiliumBGPNodeConfigs) Create(ctx context.Context, ciliumBGPNodeConfig *v2alpha1.CiliumBGPNodeConfig, opts v1.CreateOptions) (result *v2alpha1.CiliumBGPNodeConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(ciliumbgpnodeconfigsResource, ciliumBGPNodeConfig), &v2alpha1.CiliumBGPNodeConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPNodeConfig), err -} - -// Update takes the representation of a ciliumBGPNodeConfig and updates it. Returns the server's representation of the ciliumBGPNodeConfig, and an error, if there is any. -func (c *FakeCiliumBGPNodeConfigs) Update(ctx context.Context, ciliumBGPNodeConfig *v2alpha1.CiliumBGPNodeConfig, opts v1.UpdateOptions) (result *v2alpha1.CiliumBGPNodeConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(ciliumbgpnodeconfigsResource, ciliumBGPNodeConfig), &v2alpha1.CiliumBGPNodeConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPNodeConfig), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeCiliumBGPNodeConfigs) UpdateStatus(ctx context.Context, ciliumBGPNodeConfig *v2alpha1.CiliumBGPNodeConfig, opts v1.UpdateOptions) (*v2alpha1.CiliumBGPNodeConfig, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(ciliumbgpnodeconfigsResource, "status", ciliumBGPNodeConfig), &v2alpha1.CiliumBGPNodeConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPNodeConfig), err -} - -// Delete takes name of the ciliumBGPNodeConfig and deletes it. Returns an error if one occurs. -func (c *FakeCiliumBGPNodeConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(ciliumbgpnodeconfigsResource, name, opts), &v2alpha1.CiliumBGPNodeConfig{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeCiliumBGPNodeConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(ciliumbgpnodeconfigsResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2alpha1.CiliumBGPNodeConfigList{}) - return err -} - -// Patch applies the patch and returns the patched ciliumBGPNodeConfig. -func (c *FakeCiliumBGPNodeConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumBGPNodeConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(ciliumbgpnodeconfigsResource, name, pt, data, subresources...), &v2alpha1.CiliumBGPNodeConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPNodeConfig), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumbgpnodeconfigoverride.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumbgpnodeconfigoverride.go deleted file mode 100644 index c13613f23..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumbgpnodeconfigoverride.go +++ /dev/null @@ -1,108 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeCiliumBGPNodeConfigOverrides implements CiliumBGPNodeConfigOverrideInterface -type FakeCiliumBGPNodeConfigOverrides struct { - Fake *FakeCiliumV2alpha1 -} - -var ciliumbgpnodeconfigoverridesResource = v2alpha1.SchemeGroupVersion.WithResource("ciliumbgpnodeconfigoverrides") - -var ciliumbgpnodeconfigoverridesKind = v2alpha1.SchemeGroupVersion.WithKind("CiliumBGPNodeConfigOverride") - -// Get takes name of the ciliumBGPNodeConfigOverride, and returns the corresponding ciliumBGPNodeConfigOverride object, and an error if there is any. -func (c *FakeCiliumBGPNodeConfigOverrides) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CiliumBGPNodeConfigOverride, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(ciliumbgpnodeconfigoverridesResource, name), &v2alpha1.CiliumBGPNodeConfigOverride{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPNodeConfigOverride), err -} - -// List takes label and field selectors, and returns the list of CiliumBGPNodeConfigOverrides that match those selectors. -func (c *FakeCiliumBGPNodeConfigOverrides) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CiliumBGPNodeConfigOverrideList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(ciliumbgpnodeconfigoverridesResource, ciliumbgpnodeconfigoverridesKind, opts), &v2alpha1.CiliumBGPNodeConfigOverrideList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2alpha1.CiliumBGPNodeConfigOverrideList{ListMeta: obj.(*v2alpha1.CiliumBGPNodeConfigOverrideList).ListMeta} - for _, item := range obj.(*v2alpha1.CiliumBGPNodeConfigOverrideList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ciliumBGPNodeConfigOverrides. -func (c *FakeCiliumBGPNodeConfigOverrides) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(ciliumbgpnodeconfigoverridesResource, opts)) -} - -// Create takes the representation of a ciliumBGPNodeConfigOverride and creates it. Returns the server's representation of the ciliumBGPNodeConfigOverride, and an error, if there is any. -func (c *FakeCiliumBGPNodeConfigOverrides) Create(ctx context.Context, ciliumBGPNodeConfigOverride *v2alpha1.CiliumBGPNodeConfigOverride, opts v1.CreateOptions) (result *v2alpha1.CiliumBGPNodeConfigOverride, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(ciliumbgpnodeconfigoverridesResource, ciliumBGPNodeConfigOverride), &v2alpha1.CiliumBGPNodeConfigOverride{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPNodeConfigOverride), err -} - -// Update takes the representation of a ciliumBGPNodeConfigOverride and updates it. Returns the server's representation of the ciliumBGPNodeConfigOverride, and an error, if there is any. -func (c *FakeCiliumBGPNodeConfigOverrides) Update(ctx context.Context, ciliumBGPNodeConfigOverride *v2alpha1.CiliumBGPNodeConfigOverride, opts v1.UpdateOptions) (result *v2alpha1.CiliumBGPNodeConfigOverride, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(ciliumbgpnodeconfigoverridesResource, ciliumBGPNodeConfigOverride), &v2alpha1.CiliumBGPNodeConfigOverride{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPNodeConfigOverride), err -} - -// Delete takes name of the ciliumBGPNodeConfigOverride and deletes it. Returns an error if one occurs. -func (c *FakeCiliumBGPNodeConfigOverrides) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(ciliumbgpnodeconfigoverridesResource, name, opts), &v2alpha1.CiliumBGPNodeConfigOverride{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeCiliumBGPNodeConfigOverrides) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(ciliumbgpnodeconfigoverridesResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2alpha1.CiliumBGPNodeConfigOverrideList{}) - return err -} - -// Patch applies the patch and returns the patched ciliumBGPNodeConfigOverride. -func (c *FakeCiliumBGPNodeConfigOverrides) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumBGPNodeConfigOverride, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(ciliumbgpnodeconfigoverridesResource, name, pt, data, subresources...), &v2alpha1.CiliumBGPNodeConfigOverride{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPNodeConfigOverride), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumbgppeerconfig.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumbgppeerconfig.go deleted file mode 100644 index 393f2fb07..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumbgppeerconfig.go +++ /dev/null @@ -1,108 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeCiliumBGPPeerConfigs implements CiliumBGPPeerConfigInterface -type FakeCiliumBGPPeerConfigs struct { - Fake *FakeCiliumV2alpha1 -} - -var ciliumbgppeerconfigsResource = v2alpha1.SchemeGroupVersion.WithResource("ciliumbgppeerconfigs") - -var ciliumbgppeerconfigsKind = v2alpha1.SchemeGroupVersion.WithKind("CiliumBGPPeerConfig") - -// Get takes name of the ciliumBGPPeerConfig, and returns the corresponding ciliumBGPPeerConfig object, and an error if there is any. -func (c *FakeCiliumBGPPeerConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CiliumBGPPeerConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(ciliumbgppeerconfigsResource, name), &v2alpha1.CiliumBGPPeerConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPPeerConfig), err -} - -// List takes label and field selectors, and returns the list of CiliumBGPPeerConfigs that match those selectors. -func (c *FakeCiliumBGPPeerConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CiliumBGPPeerConfigList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(ciliumbgppeerconfigsResource, ciliumbgppeerconfigsKind, opts), &v2alpha1.CiliumBGPPeerConfigList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2alpha1.CiliumBGPPeerConfigList{ListMeta: obj.(*v2alpha1.CiliumBGPPeerConfigList).ListMeta} - for _, item := range obj.(*v2alpha1.CiliumBGPPeerConfigList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ciliumBGPPeerConfigs. -func (c *FakeCiliumBGPPeerConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(ciliumbgppeerconfigsResource, opts)) -} - -// Create takes the representation of a ciliumBGPPeerConfig and creates it. Returns the server's representation of the ciliumBGPPeerConfig, and an error, if there is any. -func (c *FakeCiliumBGPPeerConfigs) Create(ctx context.Context, ciliumBGPPeerConfig *v2alpha1.CiliumBGPPeerConfig, opts v1.CreateOptions) (result *v2alpha1.CiliumBGPPeerConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(ciliumbgppeerconfigsResource, ciliumBGPPeerConfig), &v2alpha1.CiliumBGPPeerConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPPeerConfig), err -} - -// Update takes the representation of a ciliumBGPPeerConfig and updates it. Returns the server's representation of the ciliumBGPPeerConfig, and an error, if there is any. -func (c *FakeCiliumBGPPeerConfigs) Update(ctx context.Context, ciliumBGPPeerConfig *v2alpha1.CiliumBGPPeerConfig, opts v1.UpdateOptions) (result *v2alpha1.CiliumBGPPeerConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(ciliumbgppeerconfigsResource, ciliumBGPPeerConfig), &v2alpha1.CiliumBGPPeerConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPPeerConfig), err -} - -// Delete takes name of the ciliumBGPPeerConfig and deletes it. Returns an error if one occurs. -func (c *FakeCiliumBGPPeerConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(ciliumbgppeerconfigsResource, name, opts), &v2alpha1.CiliumBGPPeerConfig{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeCiliumBGPPeerConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(ciliumbgppeerconfigsResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2alpha1.CiliumBGPPeerConfigList{}) - return err -} - -// Patch applies the patch and returns the patched ciliumBGPPeerConfig. -func (c *FakeCiliumBGPPeerConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumBGPPeerConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(ciliumbgppeerconfigsResource, name, pt, data, subresources...), &v2alpha1.CiliumBGPPeerConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPPeerConfig), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumbgppeeringpolicy.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumbgppeeringpolicy.go deleted file mode 100644 index 9da1136d4..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumbgppeeringpolicy.go +++ /dev/null @@ -1,108 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeCiliumBGPPeeringPolicies implements CiliumBGPPeeringPolicyInterface -type FakeCiliumBGPPeeringPolicies struct { - Fake *FakeCiliumV2alpha1 -} - -var ciliumbgppeeringpoliciesResource = v2alpha1.SchemeGroupVersion.WithResource("ciliumbgppeeringpolicies") - -var ciliumbgppeeringpoliciesKind = v2alpha1.SchemeGroupVersion.WithKind("CiliumBGPPeeringPolicy") - -// Get takes name of the ciliumBGPPeeringPolicy, and returns the corresponding ciliumBGPPeeringPolicy object, and an error if there is any. -func (c *FakeCiliumBGPPeeringPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CiliumBGPPeeringPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(ciliumbgppeeringpoliciesResource, name), &v2alpha1.CiliumBGPPeeringPolicy{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPPeeringPolicy), err -} - -// List takes label and field selectors, and returns the list of CiliumBGPPeeringPolicies that match those selectors. -func (c *FakeCiliumBGPPeeringPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CiliumBGPPeeringPolicyList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(ciliumbgppeeringpoliciesResource, ciliumbgppeeringpoliciesKind, opts), &v2alpha1.CiliumBGPPeeringPolicyList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2alpha1.CiliumBGPPeeringPolicyList{ListMeta: obj.(*v2alpha1.CiliumBGPPeeringPolicyList).ListMeta} - for _, item := range obj.(*v2alpha1.CiliumBGPPeeringPolicyList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ciliumBGPPeeringPolicies. -func (c *FakeCiliumBGPPeeringPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(ciliumbgppeeringpoliciesResource, opts)) -} - -// Create takes the representation of a ciliumBGPPeeringPolicy and creates it. Returns the server's representation of the ciliumBGPPeeringPolicy, and an error, if there is any. -func (c *FakeCiliumBGPPeeringPolicies) Create(ctx context.Context, ciliumBGPPeeringPolicy *v2alpha1.CiliumBGPPeeringPolicy, opts v1.CreateOptions) (result *v2alpha1.CiliumBGPPeeringPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(ciliumbgppeeringpoliciesResource, ciliumBGPPeeringPolicy), &v2alpha1.CiliumBGPPeeringPolicy{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPPeeringPolicy), err -} - -// Update takes the representation of a ciliumBGPPeeringPolicy and updates it. Returns the server's representation of the ciliumBGPPeeringPolicy, and an error, if there is any. -func (c *FakeCiliumBGPPeeringPolicies) Update(ctx context.Context, ciliumBGPPeeringPolicy *v2alpha1.CiliumBGPPeeringPolicy, opts v1.UpdateOptions) (result *v2alpha1.CiliumBGPPeeringPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(ciliumbgppeeringpoliciesResource, ciliumBGPPeeringPolicy), &v2alpha1.CiliumBGPPeeringPolicy{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPPeeringPolicy), err -} - -// Delete takes name of the ciliumBGPPeeringPolicy and deletes it. Returns an error if one occurs. -func (c *FakeCiliumBGPPeeringPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(ciliumbgppeeringpoliciesResource, name, opts), &v2alpha1.CiliumBGPPeeringPolicy{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeCiliumBGPPeeringPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(ciliumbgppeeringpoliciesResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2alpha1.CiliumBGPPeeringPolicyList{}) - return err -} - -// Patch applies the patch and returns the patched ciliumBGPPeeringPolicy. -func (c *FakeCiliumBGPPeeringPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumBGPPeeringPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(ciliumbgppeeringpoliciesResource, name, pt, data, subresources...), &v2alpha1.CiliumBGPPeeringPolicy{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumBGPPeeringPolicy), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumcidrgroup.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumcidrgroup.go deleted file mode 100644 index ec271bbc4..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumcidrgroup.go +++ /dev/null @@ -1,108 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeCiliumCIDRGroups implements CiliumCIDRGroupInterface -type FakeCiliumCIDRGroups struct { - Fake *FakeCiliumV2alpha1 -} - -var ciliumcidrgroupsResource = v2alpha1.SchemeGroupVersion.WithResource("ciliumcidrgroups") - -var ciliumcidrgroupsKind = v2alpha1.SchemeGroupVersion.WithKind("CiliumCIDRGroup") - -// Get takes name of the ciliumCIDRGroup, and returns the corresponding ciliumCIDRGroup object, and an error if there is any. -func (c *FakeCiliumCIDRGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CiliumCIDRGroup, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(ciliumcidrgroupsResource, name), &v2alpha1.CiliumCIDRGroup{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumCIDRGroup), err -} - -// List takes label and field selectors, and returns the list of CiliumCIDRGroups that match those selectors. -func (c *FakeCiliumCIDRGroups) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CiliumCIDRGroupList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(ciliumcidrgroupsResource, ciliumcidrgroupsKind, opts), &v2alpha1.CiliumCIDRGroupList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2alpha1.CiliumCIDRGroupList{ListMeta: obj.(*v2alpha1.CiliumCIDRGroupList).ListMeta} - for _, item := range obj.(*v2alpha1.CiliumCIDRGroupList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ciliumCIDRGroups. -func (c *FakeCiliumCIDRGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(ciliumcidrgroupsResource, opts)) -} - -// Create takes the representation of a ciliumCIDRGroup and creates it. Returns the server's representation of the ciliumCIDRGroup, and an error, if there is any. -func (c *FakeCiliumCIDRGroups) Create(ctx context.Context, ciliumCIDRGroup *v2alpha1.CiliumCIDRGroup, opts v1.CreateOptions) (result *v2alpha1.CiliumCIDRGroup, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(ciliumcidrgroupsResource, ciliumCIDRGroup), &v2alpha1.CiliumCIDRGroup{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumCIDRGroup), err -} - -// Update takes the representation of a ciliumCIDRGroup and updates it. Returns the server's representation of the ciliumCIDRGroup, and an error, if there is any. -func (c *FakeCiliumCIDRGroups) Update(ctx context.Context, ciliumCIDRGroup *v2alpha1.CiliumCIDRGroup, opts v1.UpdateOptions) (result *v2alpha1.CiliumCIDRGroup, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(ciliumcidrgroupsResource, ciliumCIDRGroup), &v2alpha1.CiliumCIDRGroup{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumCIDRGroup), err -} - -// Delete takes name of the ciliumCIDRGroup and deletes it. Returns an error if one occurs. -func (c *FakeCiliumCIDRGroups) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(ciliumcidrgroupsResource, name, opts), &v2alpha1.CiliumCIDRGroup{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeCiliumCIDRGroups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(ciliumcidrgroupsResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2alpha1.CiliumCIDRGroupList{}) - return err -} - -// Patch applies the patch and returns the patched ciliumCIDRGroup. -func (c *FakeCiliumCIDRGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumCIDRGroup, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(ciliumcidrgroupsResource, name, pt, data, subresources...), &v2alpha1.CiliumCIDRGroup{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumCIDRGroup), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumendpointslice.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumendpointslice.go deleted file mode 100644 index 447afbdde..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumendpointslice.go +++ /dev/null @@ -1,108 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeCiliumEndpointSlices implements CiliumEndpointSliceInterface -type FakeCiliumEndpointSlices struct { - Fake *FakeCiliumV2alpha1 -} - -var ciliumendpointslicesResource = v2alpha1.SchemeGroupVersion.WithResource("ciliumendpointslices") - -var ciliumendpointslicesKind = v2alpha1.SchemeGroupVersion.WithKind("CiliumEndpointSlice") - -// Get takes name of the ciliumEndpointSlice, and returns the corresponding ciliumEndpointSlice object, and an error if there is any. -func (c *FakeCiliumEndpointSlices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CiliumEndpointSlice, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(ciliumendpointslicesResource, name), &v2alpha1.CiliumEndpointSlice{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumEndpointSlice), err -} - -// List takes label and field selectors, and returns the list of CiliumEndpointSlices that match those selectors. -func (c *FakeCiliumEndpointSlices) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CiliumEndpointSliceList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(ciliumendpointslicesResource, ciliumendpointslicesKind, opts), &v2alpha1.CiliumEndpointSliceList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2alpha1.CiliumEndpointSliceList{ListMeta: obj.(*v2alpha1.CiliumEndpointSliceList).ListMeta} - for _, item := range obj.(*v2alpha1.CiliumEndpointSliceList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ciliumEndpointSlices. -func (c *FakeCiliumEndpointSlices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(ciliumendpointslicesResource, opts)) -} - -// Create takes the representation of a ciliumEndpointSlice and creates it. Returns the server's representation of the ciliumEndpointSlice, and an error, if there is any. -func (c *FakeCiliumEndpointSlices) Create(ctx context.Context, ciliumEndpointSlice *v2alpha1.CiliumEndpointSlice, opts v1.CreateOptions) (result *v2alpha1.CiliumEndpointSlice, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(ciliumendpointslicesResource, ciliumEndpointSlice), &v2alpha1.CiliumEndpointSlice{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumEndpointSlice), err -} - -// Update takes the representation of a ciliumEndpointSlice and updates it. Returns the server's representation of the ciliumEndpointSlice, and an error, if there is any. -func (c *FakeCiliumEndpointSlices) Update(ctx context.Context, ciliumEndpointSlice *v2alpha1.CiliumEndpointSlice, opts v1.UpdateOptions) (result *v2alpha1.CiliumEndpointSlice, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(ciliumendpointslicesResource, ciliumEndpointSlice), &v2alpha1.CiliumEndpointSlice{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumEndpointSlice), err -} - -// Delete takes name of the ciliumEndpointSlice and deletes it. Returns an error if one occurs. -func (c *FakeCiliumEndpointSlices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(ciliumendpointslicesResource, name, opts), &v2alpha1.CiliumEndpointSlice{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeCiliumEndpointSlices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(ciliumendpointslicesResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2alpha1.CiliumEndpointSliceList{}) - return err -} - -// Patch applies the patch and returns the patched ciliumEndpointSlice. -func (c *FakeCiliumEndpointSlices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumEndpointSlice, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(ciliumendpointslicesResource, name, pt, data, subresources...), &v2alpha1.CiliumEndpointSlice{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumEndpointSlice), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliuml2announcementpolicy.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliuml2announcementpolicy.go deleted file mode 100644 index 2ad271efc..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliuml2announcementpolicy.go +++ /dev/null @@ -1,119 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeCiliumL2AnnouncementPolicies implements CiliumL2AnnouncementPolicyInterface -type FakeCiliumL2AnnouncementPolicies struct { - Fake *FakeCiliumV2alpha1 -} - -var ciliuml2announcementpoliciesResource = v2alpha1.SchemeGroupVersion.WithResource("ciliuml2announcementpolicies") - -var ciliuml2announcementpoliciesKind = v2alpha1.SchemeGroupVersion.WithKind("CiliumL2AnnouncementPolicy") - -// Get takes name of the ciliumL2AnnouncementPolicy, and returns the corresponding ciliumL2AnnouncementPolicy object, and an error if there is any. -func (c *FakeCiliumL2AnnouncementPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CiliumL2AnnouncementPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(ciliuml2announcementpoliciesResource, name), &v2alpha1.CiliumL2AnnouncementPolicy{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumL2AnnouncementPolicy), err -} - -// List takes label and field selectors, and returns the list of CiliumL2AnnouncementPolicies that match those selectors. -func (c *FakeCiliumL2AnnouncementPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CiliumL2AnnouncementPolicyList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(ciliuml2announcementpoliciesResource, ciliuml2announcementpoliciesKind, opts), &v2alpha1.CiliumL2AnnouncementPolicyList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2alpha1.CiliumL2AnnouncementPolicyList{ListMeta: obj.(*v2alpha1.CiliumL2AnnouncementPolicyList).ListMeta} - for _, item := range obj.(*v2alpha1.CiliumL2AnnouncementPolicyList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ciliumL2AnnouncementPolicies. -func (c *FakeCiliumL2AnnouncementPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(ciliuml2announcementpoliciesResource, opts)) -} - -// Create takes the representation of a ciliumL2AnnouncementPolicy and creates it. Returns the server's representation of the ciliumL2AnnouncementPolicy, and an error, if there is any. -func (c *FakeCiliumL2AnnouncementPolicies) Create(ctx context.Context, ciliumL2AnnouncementPolicy *v2alpha1.CiliumL2AnnouncementPolicy, opts v1.CreateOptions) (result *v2alpha1.CiliumL2AnnouncementPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(ciliuml2announcementpoliciesResource, ciliumL2AnnouncementPolicy), &v2alpha1.CiliumL2AnnouncementPolicy{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumL2AnnouncementPolicy), err -} - -// Update takes the representation of a ciliumL2AnnouncementPolicy and updates it. Returns the server's representation of the ciliumL2AnnouncementPolicy, and an error, if there is any. -func (c *FakeCiliumL2AnnouncementPolicies) Update(ctx context.Context, ciliumL2AnnouncementPolicy *v2alpha1.CiliumL2AnnouncementPolicy, opts v1.UpdateOptions) (result *v2alpha1.CiliumL2AnnouncementPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(ciliuml2announcementpoliciesResource, ciliumL2AnnouncementPolicy), &v2alpha1.CiliumL2AnnouncementPolicy{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumL2AnnouncementPolicy), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeCiliumL2AnnouncementPolicies) UpdateStatus(ctx context.Context, ciliumL2AnnouncementPolicy *v2alpha1.CiliumL2AnnouncementPolicy, opts v1.UpdateOptions) (*v2alpha1.CiliumL2AnnouncementPolicy, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(ciliuml2announcementpoliciesResource, "status", ciliumL2AnnouncementPolicy), &v2alpha1.CiliumL2AnnouncementPolicy{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumL2AnnouncementPolicy), err -} - -// Delete takes name of the ciliumL2AnnouncementPolicy and deletes it. Returns an error if one occurs. -func (c *FakeCiliumL2AnnouncementPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(ciliuml2announcementpoliciesResource, name, opts), &v2alpha1.CiliumL2AnnouncementPolicy{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeCiliumL2AnnouncementPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(ciliuml2announcementpoliciesResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2alpha1.CiliumL2AnnouncementPolicyList{}) - return err -} - -// Patch applies the patch and returns the patched ciliumL2AnnouncementPolicy. -func (c *FakeCiliumL2AnnouncementPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumL2AnnouncementPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(ciliuml2announcementpoliciesResource, name, pt, data, subresources...), &v2alpha1.CiliumL2AnnouncementPolicy{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumL2AnnouncementPolicy), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumloadbalancerippool.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumloadbalancerippool.go deleted file mode 100644 index b150f24fa..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumloadbalancerippool.go +++ /dev/null @@ -1,119 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeCiliumLoadBalancerIPPools implements CiliumLoadBalancerIPPoolInterface -type FakeCiliumLoadBalancerIPPools struct { - Fake *FakeCiliumV2alpha1 -} - -var ciliumloadbalancerippoolsResource = v2alpha1.SchemeGroupVersion.WithResource("ciliumloadbalancerippools") - -var ciliumloadbalancerippoolsKind = v2alpha1.SchemeGroupVersion.WithKind("CiliumLoadBalancerIPPool") - -// Get takes name of the ciliumLoadBalancerIPPool, and returns the corresponding ciliumLoadBalancerIPPool object, and an error if there is any. -func (c *FakeCiliumLoadBalancerIPPools) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CiliumLoadBalancerIPPool, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(ciliumloadbalancerippoolsResource, name), &v2alpha1.CiliumLoadBalancerIPPool{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumLoadBalancerIPPool), err -} - -// List takes label and field selectors, and returns the list of CiliumLoadBalancerIPPools that match those selectors. -func (c *FakeCiliumLoadBalancerIPPools) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CiliumLoadBalancerIPPoolList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(ciliumloadbalancerippoolsResource, ciliumloadbalancerippoolsKind, opts), &v2alpha1.CiliumLoadBalancerIPPoolList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2alpha1.CiliumLoadBalancerIPPoolList{ListMeta: obj.(*v2alpha1.CiliumLoadBalancerIPPoolList).ListMeta} - for _, item := range obj.(*v2alpha1.CiliumLoadBalancerIPPoolList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ciliumLoadBalancerIPPools. -func (c *FakeCiliumLoadBalancerIPPools) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(ciliumloadbalancerippoolsResource, opts)) -} - -// Create takes the representation of a ciliumLoadBalancerIPPool and creates it. Returns the server's representation of the ciliumLoadBalancerIPPool, and an error, if there is any. -func (c *FakeCiliumLoadBalancerIPPools) Create(ctx context.Context, ciliumLoadBalancerIPPool *v2alpha1.CiliumLoadBalancerIPPool, opts v1.CreateOptions) (result *v2alpha1.CiliumLoadBalancerIPPool, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(ciliumloadbalancerippoolsResource, ciliumLoadBalancerIPPool), &v2alpha1.CiliumLoadBalancerIPPool{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumLoadBalancerIPPool), err -} - -// Update takes the representation of a ciliumLoadBalancerIPPool and updates it. Returns the server's representation of the ciliumLoadBalancerIPPool, and an error, if there is any. -func (c *FakeCiliumLoadBalancerIPPools) Update(ctx context.Context, ciliumLoadBalancerIPPool *v2alpha1.CiliumLoadBalancerIPPool, opts v1.UpdateOptions) (result *v2alpha1.CiliumLoadBalancerIPPool, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(ciliumloadbalancerippoolsResource, ciliumLoadBalancerIPPool), &v2alpha1.CiliumLoadBalancerIPPool{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumLoadBalancerIPPool), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeCiliumLoadBalancerIPPools) UpdateStatus(ctx context.Context, ciliumLoadBalancerIPPool *v2alpha1.CiliumLoadBalancerIPPool, opts v1.UpdateOptions) (*v2alpha1.CiliumLoadBalancerIPPool, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(ciliumloadbalancerippoolsResource, "status", ciliumLoadBalancerIPPool), &v2alpha1.CiliumLoadBalancerIPPool{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumLoadBalancerIPPool), err -} - -// Delete takes name of the ciliumLoadBalancerIPPool and deletes it. Returns an error if one occurs. -func (c *FakeCiliumLoadBalancerIPPools) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(ciliumloadbalancerippoolsResource, name, opts), &v2alpha1.CiliumLoadBalancerIPPool{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeCiliumLoadBalancerIPPools) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(ciliumloadbalancerippoolsResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2alpha1.CiliumLoadBalancerIPPoolList{}) - return err -} - -// Patch applies the patch and returns the patched ciliumLoadBalancerIPPool. -func (c *FakeCiliumLoadBalancerIPPools) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumLoadBalancerIPPool, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(ciliumloadbalancerippoolsResource, name, pt, data, subresources...), &v2alpha1.CiliumLoadBalancerIPPool{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumLoadBalancerIPPool), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumnodeconfig.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumnodeconfig.go deleted file mode 100644 index a826f0bc0..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumnodeconfig.go +++ /dev/null @@ -1,116 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeCiliumNodeConfigs implements CiliumNodeConfigInterface -type FakeCiliumNodeConfigs struct { - Fake *FakeCiliumV2alpha1 - ns string -} - -var ciliumnodeconfigsResource = v2alpha1.SchemeGroupVersion.WithResource("ciliumnodeconfigs") - -var ciliumnodeconfigsKind = v2alpha1.SchemeGroupVersion.WithKind("CiliumNodeConfig") - -// Get takes name of the ciliumNodeConfig, and returns the corresponding ciliumNodeConfig object, and an error if there is any. -func (c *FakeCiliumNodeConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CiliumNodeConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(ciliumnodeconfigsResource, c.ns, name), &v2alpha1.CiliumNodeConfig{}) - - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumNodeConfig), err -} - -// List takes label and field selectors, and returns the list of CiliumNodeConfigs that match those selectors. -func (c *FakeCiliumNodeConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CiliumNodeConfigList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(ciliumnodeconfigsResource, ciliumnodeconfigsKind, c.ns, opts), &v2alpha1.CiliumNodeConfigList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2alpha1.CiliumNodeConfigList{ListMeta: obj.(*v2alpha1.CiliumNodeConfigList).ListMeta} - for _, item := range obj.(*v2alpha1.CiliumNodeConfigList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ciliumNodeConfigs. -func (c *FakeCiliumNodeConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(ciliumnodeconfigsResource, c.ns, opts)) - -} - -// Create takes the representation of a ciliumNodeConfig and creates it. Returns the server's representation of the ciliumNodeConfig, and an error, if there is any. -func (c *FakeCiliumNodeConfigs) Create(ctx context.Context, ciliumNodeConfig *v2alpha1.CiliumNodeConfig, opts v1.CreateOptions) (result *v2alpha1.CiliumNodeConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(ciliumnodeconfigsResource, c.ns, ciliumNodeConfig), &v2alpha1.CiliumNodeConfig{}) - - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumNodeConfig), err -} - -// Update takes the representation of a ciliumNodeConfig and updates it. Returns the server's representation of the ciliumNodeConfig, and an error, if there is any. -func (c *FakeCiliumNodeConfigs) Update(ctx context.Context, ciliumNodeConfig *v2alpha1.CiliumNodeConfig, opts v1.UpdateOptions) (result *v2alpha1.CiliumNodeConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(ciliumnodeconfigsResource, c.ns, ciliumNodeConfig), &v2alpha1.CiliumNodeConfig{}) - - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumNodeConfig), err -} - -// Delete takes name of the ciliumNodeConfig and deletes it. Returns an error if one occurs. -func (c *FakeCiliumNodeConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(ciliumnodeconfigsResource, c.ns, name, opts), &v2alpha1.CiliumNodeConfig{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeCiliumNodeConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(ciliumnodeconfigsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v2alpha1.CiliumNodeConfigList{}) - return err -} - -// Patch applies the patch and returns the patched ciliumNodeConfig. -func (c *FakeCiliumNodeConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumNodeConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(ciliumnodeconfigsResource, c.ns, name, pt, data, subresources...), &v2alpha1.CiliumNodeConfig{}) - - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumNodeConfig), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumpodippool.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumpodippool.go deleted file mode 100644 index 6922a8582..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/fake/fake_ciliumpodippool.go +++ /dev/null @@ -1,108 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeCiliumPodIPPools implements CiliumPodIPPoolInterface -type FakeCiliumPodIPPools struct { - Fake *FakeCiliumV2alpha1 -} - -var ciliumpodippoolsResource = v2alpha1.SchemeGroupVersion.WithResource("ciliumpodippools") - -var ciliumpodippoolsKind = v2alpha1.SchemeGroupVersion.WithKind("CiliumPodIPPool") - -// Get takes name of the ciliumPodIPPool, and returns the corresponding ciliumPodIPPool object, and an error if there is any. -func (c *FakeCiliumPodIPPools) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.CiliumPodIPPool, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(ciliumpodippoolsResource, name), &v2alpha1.CiliumPodIPPool{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumPodIPPool), err -} - -// List takes label and field selectors, and returns the list of CiliumPodIPPools that match those selectors. -func (c *FakeCiliumPodIPPools) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.CiliumPodIPPoolList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(ciliumpodippoolsResource, ciliumpodippoolsKind, opts), &v2alpha1.CiliumPodIPPoolList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2alpha1.CiliumPodIPPoolList{ListMeta: obj.(*v2alpha1.CiliumPodIPPoolList).ListMeta} - for _, item := range obj.(*v2alpha1.CiliumPodIPPoolList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ciliumPodIPPools. -func (c *FakeCiliumPodIPPools) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(ciliumpodippoolsResource, opts)) -} - -// Create takes the representation of a ciliumPodIPPool and creates it. Returns the server's representation of the ciliumPodIPPool, and an error, if there is any. -func (c *FakeCiliumPodIPPools) Create(ctx context.Context, ciliumPodIPPool *v2alpha1.CiliumPodIPPool, opts v1.CreateOptions) (result *v2alpha1.CiliumPodIPPool, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(ciliumpodippoolsResource, ciliumPodIPPool), &v2alpha1.CiliumPodIPPool{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumPodIPPool), err -} - -// Update takes the representation of a ciliumPodIPPool and updates it. Returns the server's representation of the ciliumPodIPPool, and an error, if there is any. -func (c *FakeCiliumPodIPPools) Update(ctx context.Context, ciliumPodIPPool *v2alpha1.CiliumPodIPPool, opts v1.UpdateOptions) (result *v2alpha1.CiliumPodIPPool, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(ciliumpodippoolsResource, ciliumPodIPPool), &v2alpha1.CiliumPodIPPool{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumPodIPPool), err -} - -// Delete takes name of the ciliumPodIPPool and deletes it. Returns an error if one occurs. -func (c *FakeCiliumPodIPPools) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(ciliumpodippoolsResource, name, opts), &v2alpha1.CiliumPodIPPool{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeCiliumPodIPPools) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(ciliumpodippoolsResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2alpha1.CiliumPodIPPoolList{}) - return err -} - -// Patch applies the patch and returns the patched ciliumPodIPPool. -func (c *FakeCiliumPodIPPools) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.CiliumPodIPPool, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(ciliumpodippoolsResource, name, pt, data, subresources...), &v2alpha1.CiliumPodIPPool{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.CiliumPodIPPool), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/generated_expansion.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/generated_expansion.go deleted file mode 100644 index 4b25b32bb..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1/generated_expansion.go +++ /dev/null @@ -1,30 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -type CiliumBGPAdvertisementExpansion interface{} - -type CiliumBGPClusterConfigExpansion interface{} - -type CiliumBGPNodeConfigExpansion interface{} - -type CiliumBGPNodeConfigOverrideExpansion interface{} - -type CiliumBGPPeerConfigExpansion interface{} - -type CiliumBGPPeeringPolicyExpansion interface{} - -type CiliumCIDRGroupExpansion interface{} - -type CiliumEndpointSliceExpansion interface{} - -type CiliumL2AnnouncementPolicyExpansion interface{} - -type CiliumLoadBalancerIPPoolExpansion interface{} - -type CiliumNodeConfigExpansion interface{} - -type CiliumPodIPPoolExpansion interface{} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/config.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/config.go deleted file mode 100644 index ac685bb4b..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/config.go +++ /dev/null @@ -1,69 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package client - -import ( - "os" - "time" - - "github.com/spf13/pflag" - - "github.com/cilium/cilium/pkg/defaults" - "github.com/cilium/cilium/pkg/option" -) - -type Config struct { - // EnableK8s is a flag that, when set to false, forcibly disables the clientset, to let cilium - // operates with CNI-compatible orchestrators other than Kubernetes. Default to true. - EnableK8s bool - - // K8sAPIServer is the kubernetes api address server (for https use --k8s-kubeconfig-path instead) - K8sAPIServer string - - // K8sKubeConfigPath is the absolute path of the kubernetes kubeconfig file - K8sKubeConfigPath string - - // K8sClientQPS is the queries per second limit for the K8s client. Defaults to k8s client defaults. - K8sClientQPS float32 - - // K8sClientBurst is the burst value allowed for the K8s client. Defaults to k8s client defaults. - K8sClientBurst int - - // K8sHeartbeatTimeout configures the timeout for apiserver heartbeat - K8sHeartbeatTimeout time.Duration - - // K8sEnableAPIDiscovery enables Kubernetes API discovery - EnableK8sAPIDiscovery bool -} - -var defaultConfig = Config{ - EnableK8s: true, - K8sAPIServer: "", - K8sKubeConfigPath: "", - K8sClientQPS: defaults.K8sClientQPSLimit, - K8sClientBurst: defaults.K8sClientBurst, - K8sHeartbeatTimeout: 30 * time.Second, - EnableK8sAPIDiscovery: defaults.K8sEnableAPIDiscovery, -} - -func (def Config) Flags(flags *pflag.FlagSet) { - flags.Bool(option.EnableK8s, def.EnableK8s, "Enable the k8s clientset") - flags.String(option.K8sAPIServer, def.K8sAPIServer, "Kubernetes API server URL") - flags.String(option.K8sKubeConfigPath, def.K8sKubeConfigPath, "Absolute path of the kubernetes kubeconfig file") - flags.Float32(option.K8sClientQPSLimit, def.K8sClientQPS, "Queries per second limit for the K8s client") - flags.Int(option.K8sClientBurst, def.K8sClientBurst, "Burst value allowed for the K8s client") - flags.Duration(option.K8sHeartbeatTimeout, def.K8sHeartbeatTimeout, "Configures the timeout for api-server heartbeat, set to 0 to disable") - flags.Bool(option.K8sEnableAPIDiscovery, def.EnableK8sAPIDiscovery, "Enable discovery of Kubernetes API groups and resources with the discovery API") -} - -func (cfg Config) isEnabled() bool { - if !cfg.EnableK8s { - return false - } - return cfg.K8sAPIServer != "" || - cfg.K8sKubeConfigPath != "" || - (os.Getenv("KUBERNETES_SERVICE_HOST") != "" && - os.Getenv("KUBERNETES_SERVICE_PORT") != "") || - os.Getenv("K8S_NODE_NAME") != "" -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/client/getters.go b/vendor/github.com/cilium/cilium/pkg/k8s/client/getters.go deleted file mode 100644 index fc4994000..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/client/getters.go +++ /dev/null @@ -1,57 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package client - -import ( - "context" - "fmt" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - cilium_v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - slim_corev1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" -) - -// Getters is a set of methods for retrieving common objects. -type Getters interface { - GetSecrets(ctx context.Context, namespace, name string) (map[string][]byte, error) - GetK8sNode(ctx context.Context, nodeName string) (*slim_corev1.Node, error) - GetCiliumNode(ctx context.Context, nodeName string) (*cilium_v2.CiliumNode, error) -} - -// clientsetGetters implements the Getters interface in terms of the clientset. -type clientsetGetters struct { - Clientset -} - -// GetSecrets returns the secrets found in the given namespace and name. -func (cs *clientsetGetters) GetSecrets(ctx context.Context, ns, name string) (map[string][]byte, error) { - if !cs.IsEnabled() { - return nil, fmt.Errorf("GetSecrets: No k8s, cannot access k8s secrets") - } - - result, err := cs.CoreV1().Secrets(ns).Get(ctx, name, metav1.GetOptions{}) - if err != nil { - return nil, err - } - return result.Data, nil -} - -// GetK8sNode returns the node with the given nodeName. -func (cs *clientsetGetters) GetK8sNode(ctx context.Context, nodeName string) (*slim_corev1.Node, error) { - if !cs.IsEnabled() { - return nil, fmt.Errorf("GetK8sNode: No k8s, cannot access k8s nodes") - } - - return cs.Slim().CoreV1().Nodes().Get(ctx, nodeName, metav1.GetOptions{}) -} - -// GetCiliumNode returns the CiliumNode with the given nodeName. -func (cs *clientsetGetters) GetCiliumNode(ctx context.Context, nodeName string) (*cilium_v2.CiliumNode, error) { - if !cs.IsEnabled() { - return nil, fmt.Errorf("GetK8sNode: No k8s, cannot access k8s nodes") - } - - return cs.CiliumV2().CiliumNodes().Get(ctx, nodeName, metav1.GetOptions{}) -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/constants/const.go b/vendor/github.com/cilium/cilium/pkg/k8s/constants/const.go deleted file mode 100644 index 1f6cb6dde..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/constants/const.go +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package constants - -const ( - // EnvNodeNameSpec is the environment label used by Kubernetes to - // specify the node's name. - EnvNodeNameSpec = "K8S_NODE_NAME" -) diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/identitybackend/identity.go b/vendor/github.com/cilium/cilium/pkg/k8s/identitybackend/identity.go deleted file mode 100644 index d3a867d55..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/identitybackend/identity.go +++ /dev/null @@ -1,416 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package identitybackend - -import ( - "context" - "fmt" - "reflect" - "sort" - "strconv" - "strings" - - "github.com/sirupsen/logrus" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/tools/cache" - - "github.com/cilium/cilium/pkg/allocator" - cacheKey "github.com/cilium/cilium/pkg/identity/key" - "github.com/cilium/cilium/pkg/idpool" - k8sConst "github.com/cilium/cilium/pkg/k8s/apis/cilium.io" - v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - clientset "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned" - "github.com/cilium/cilium/pkg/k8s/informer" - k8sUtils "github.com/cilium/cilium/pkg/k8s/utils" - "github.com/cilium/cilium/pkg/kvstore" - "github.com/cilium/cilium/pkg/labels" - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/rate" -) - -var ( - log = logging.DefaultLogger.WithField(logfields.LogSubsys, "crd-allocator") -) - -const ( - // HeartBeatAnnotation is an annotation applied by the operator to indicate - // that a CiliumIdentity has been marked for deletion. - HeartBeatAnnotation = "io.cilium.heartbeat" - - k8sPrefix = labels.LabelSourceK8s + ":" - k8sNamespaceLabelPrefix = labels.LabelSourceK8s + ":" + k8sConst.PodNamespaceMetaLabels + labels.PathDelimiter - - // byKeyIndex is the name of the index of the identities by key. - byKeyIndex = "by-key-index" -) - -func NewCRDBackend(c CRDBackendConfiguration) (allocator.Backend, error) { - return &crdBackend{CRDBackendConfiguration: c}, nil -} - -type CRDBackendConfiguration struct { - Store cache.Indexer - Client clientset.Interface - KeyFunc func(map[string]string) allocator.AllocatorKey -} - -type crdBackend struct { - CRDBackendConfiguration -} - -func (c *crdBackend) DeleteAllKeys(ctx context.Context) { -} - -// sanitizeK8sLabels strips the 'k8s:' prefix in the labels generated by -// AllocatorKey.GetAsMap (when the key is k8s labels). In the CRD identity case -// we map the labels directly to the ciliumidentity CRD instance, and -// kubernetes does not allow ':' in the name of the label. These labels are not -// the canonical labels of the identity, but used to ease interaction with the -// CRD object. -func sanitizeK8sLabels(old map[string]string) (selected, skipped map[string]string) { - skipped = make(map[string]string, len(old)) - selected = make(map[string]string, len(old)) - for k, v := range old { - // Skip non-k8s labels. - // Skip synthesized labels for k8s namespace labels, since they contain user input which can result in the label - // name being longer than 63 characters. - if !strings.HasPrefix(k, k8sPrefix) || strings.HasPrefix(k, k8sNamespaceLabelPrefix) { - skipped[k] = v - continue // skip non-k8s labels - } - k = strings.TrimPrefix(k, k8sPrefix) // k8s: is redundant - selected[k] = v - } - return selected, skipped -} - -// AllocateID will create an identity CRD, thus creating the identity for this -// key-> ID mapping. -// Note: the lock field is not supported with the k8s CRD allocator. -// Returns an allocator key with the cilium identity stored in it. -func (c *crdBackend) AllocateID(ctx context.Context, id idpool.ID, key allocator.AllocatorKey) (allocator.AllocatorKey, error) { - selectedLabels, skippedLabels := sanitizeK8sLabels(key.GetAsMap()) - log.WithField(logfields.Labels, skippedLabels).Info("Skipped non-kubernetes labels when labelling ciliumidentity. All labels will still be used in identity determination") - - identity := &v2.CiliumIdentity{ - ObjectMeta: metav1.ObjectMeta{ - Name: id.String(), - Labels: selectedLabels, - }, - SecurityLabels: key.GetAsMap(), - } - - ci, err := c.Client.CiliumV2().CiliumIdentities().Create(ctx, identity, metav1.CreateOptions{}) - if err != nil { - return nil, err - } - return key.PutValue(cacheKey.MetadataKeyBackendKey, ci), nil -} - -func (c *crdBackend) AllocateIDIfLocked(ctx context.Context, id idpool.ID, key allocator.AllocatorKey, lock kvstore.KVLocker) (allocator.AllocatorKey, error) { - return c.AllocateID(ctx, id, key) -} - -// AcquireReference acquires a reference to the identity. -func (c *crdBackend) AcquireReference(ctx context.Context, id idpool.ID, key allocator.AllocatorKey, lock kvstore.KVLocker) error { - // For CiliumIdentity-based allocation, the reference counting is - // handled via CiliumEndpoint. Any CiliumEndpoint referring to a - // CiliumIdentity will keep the CiliumIdentity alive. However, - // there is a brief window where a CiliumEndpoint may not exist - // for a given CiliumIdentity (according to the operator), in - // which case the operator marks the CiliumIdentity for deletion. - // This checks to see if the CiliumIdentity has been marked for - // deletion and removes the mark so that the CiliumIdentity can - // be safely used. - // - // NOTE: A race against using a CiliumIdentity that might otherwise - // be (immediately) deleted is prevented by the operator logic that - // validates the ResourceVersion of the CiliumIdentity before deleting - // it. If a CiliumIdentity does (eventually) get deleted by the - // operator, the agent will then have a chance to recreate it. - var ( - ts string - ok bool - ) - // check to see if the cached copy of the identity - // has the annotation - ci, exists, err := c.getById(ctx, id) - if err != nil { - return err - } - if !exists { - // fall back to the key stored in the allocator key. If it's not present - // then return the error. - ci, ok = key.Value(cacheKey.MetadataKeyBackendKey).(*v2.CiliumIdentity) - if !ok { - return fmt.Errorf("identity (id:%q,key:%q) does not exist", id, key) - } - } - - ts, ok = ci.Annotations[HeartBeatAnnotation] - if ok { - log.WithField(logfields.Identity, ci).Infof("Identity marked for deletion (at %s); attempting to unmark it", ts) - ci = ci.DeepCopy() - delete(ci.Annotations, HeartBeatAnnotation) - _, err = c.Client.CiliumV2().CiliumIdentities().Update(ctx, ci, metav1.UpdateOptions{}) - if err != nil { - return err - } - } - return nil -} - -func (c *crdBackend) RunLocksGC(_ context.Context, _ map[string]kvstore.Value) (map[string]kvstore.Value, error) { - return nil, nil -} - -func (c *crdBackend) RunGC(context.Context, *rate.Limiter, map[string]uint64, idpool.ID, idpool.ID) (map[string]uint64, *allocator.GCStats, error) { - return nil, nil, nil -} - -// UpdateKey refreshes the reference that this node is using this key->ID -// mapping. It assumes that the identity already exists but will recreate it if -// reliablyMissing is true. -// Note: the lock field is not supported with the k8s CRD allocator. -func (c *crdBackend) UpdateKey(ctx context.Context, id idpool.ID, key allocator.AllocatorKey, reliablyMissing bool) error { - err := c.AcquireReference(ctx, id, key, nil) - if err == nil { - log.WithFields(logrus.Fields{ - logfields.Identity: id, - logfields.Labels: key, - }).Debug("Acquired reference for identity") - return nil - } - - // The CRD (aka the master key) is missing. Try to recover by recreating it - // if reliablyMissing is set. - log.WithError(err).WithFields(logrus.Fields{ - logfields.Identity: id, - logfields.Labels: key, - }).Warning("Unable update CRD identity information with a reference for this node") - - if reliablyMissing { - // Recreate a missing master key - if _, err = c.AllocateID(ctx, id, key); err != nil { - return fmt.Errorf("Unable recreate missing CRD identity %q->%q: %w", key, id, err) - } - - return nil - } - - return err -} - -func (c *crdBackend) UpdateKeyIfLocked(ctx context.Context, id idpool.ID, key allocator.AllocatorKey, reliablyMissing bool, lock kvstore.KVLocker) error { - return c.UpdateKey(ctx, id, key, reliablyMissing) -} - -// Lock does not return a lock object. Locking is not supported with the k8s -// CRD allocator. It is here to meet interface requirements. -func (c *crdBackend) Lock(ctx context.Context, key allocator.AllocatorKey) (kvstore.KVLocker, error) { - return &crdLock{}, nil -} - -type crdLock struct{} - -// Unlock does not unlock a lock object. Locking is not supported with the k8s -// CRD allocator. It is here to meet interface requirements. -func (c *crdLock) Unlock(ctx context.Context) error { - return nil -} - -// Comparator does nothing. Locking is not supported with the k8s -// CRD allocator. It is here to meet interface requirements. -func (c *crdLock) Comparator() interface{} { - return nil -} - -// get returns the identity found for the given set of labels. -// In the case of duplicate entries, return an identity entry -// from a sorted list. -func (c *crdBackend) get(ctx context.Context, key allocator.AllocatorKey) *v2.CiliumIdentity { - if c.Store == nil { - return nil - } - - identities, err := c.Store.ByIndex(byKeyIndex, key.GetKey()) - if err != nil || len(identities) == 0 { - return nil - } - - sort.Slice(identities, func(i, j int) bool { - left, ok := identities[i].(*v2.CiliumIdentity) - if !ok { - return false - } - - right, ok := identities[j].(*v2.CiliumIdentity) - if !ok { - return false - } - - return left.CreationTimestamp.Before(&right.CreationTimestamp) - }) - - for _, identityObject := range identities { - identity, ok := identityObject.(*v2.CiliumIdentity) - if !ok { - return nil - } - - if reflect.DeepEqual(identity.SecurityLabels, key.GetAsMap()) { - return identity - } - } - return nil -} - -// Get returns the first ID which is allocated to a key in the identity CRDs in -// kubernetes. -// Note: the lock field is not supported with the k8s CRD allocator. -func (c *crdBackend) Get(ctx context.Context, key allocator.AllocatorKey) (idpool.ID, error) { - identity := c.get(ctx, key) - if identity == nil { - return idpool.NoID, nil - } - - id, err := strconv.ParseUint(identity.Name, 10, 64) - if err != nil { - return idpool.NoID, fmt.Errorf("unable to parse value '%s': %w", identity.Name, err) - } - - return idpool.ID(id), nil -} - -func (c *crdBackend) GetIfLocked(ctx context.Context, key allocator.AllocatorKey, lock kvstore.KVLocker) (idpool.ID, error) { - return c.Get(ctx, key) -} - -// getById fetches the identities from the local store. Returns a nil `err` and -// false `exists` if an Identity is not found for the given `id`. -func (c *crdBackend) getById(ctx context.Context, id idpool.ID) (idty *v2.CiliumIdentity, exists bool, err error) { - if c.Store == nil { - return nil, false, fmt.Errorf("store is not available yet") - } - - identityTemplate := &v2.CiliumIdentity{ - ObjectMeta: metav1.ObjectMeta{ - Name: id.String(), - }, - } - - obj, exists, err := c.Store.Get(identityTemplate) - if err != nil { - return nil, exists, err - } - if !exists { - return nil, exists, nil - } - - identity, ok := obj.(*v2.CiliumIdentity) - if !ok { - return nil, false, fmt.Errorf("invalid object %T", obj) - } - return identity, true, nil -} - -// GetByID returns the key associated with an ID. Returns nil if no key is -// associated with the ID. -// Note: the lock field is not supported with the k8s CRD allocator. -func (c *crdBackend) GetByID(ctx context.Context, id idpool.ID) (allocator.AllocatorKey, error) { - identity, exists, err := c.getById(ctx, id) - if err != nil { - return nil, err - } - if !exists { - return nil, nil - } - - return c.KeyFunc(identity.SecurityLabels), nil -} - -// Release dissociates this node from using the identity bound to the given ID. -// When an identity has no references it may be garbage collected. -func (c *crdBackend) Release(ctx context.Context, id idpool.ID, key allocator.AllocatorKey) (err error) { - // For CiliumIdentity-based allocation, the reference counting is - // handled via CiliumEndpoint. Any CiliumEndpoint referring to a - // CiliumIdentity will keep the CiliumIdentity alive. No action is - // needed to release the reference here. - return nil -} - -func getIdentitiesByKeyFunc(keyFunc func(map[string]string) allocator.AllocatorKey) func(obj interface{}) ([]string, error) { - return func(obj interface{}) ([]string, error) { - if identity, ok := obj.(*v2.CiliumIdentity); ok { - return []string{keyFunc(identity.SecurityLabels).GetKey()}, nil - } - return []string{}, fmt.Errorf("object other than CiliumIdentity was pushed to the store") - } -} - -func (c *crdBackend) ListAndWatch(ctx context.Context, handler allocator.CacheMutations, stopChan chan struct{}) { - c.Store = cache.NewIndexer( - cache.DeletionHandlingMetaNamespaceKeyFunc, - cache.Indexers{byKeyIndex: getIdentitiesByKeyFunc(c.KeyFunc)}) - identityInformer := informer.NewInformerWithStore( - k8sUtils.ListerWatcherFromTyped[*v2.CiliumIdentityList](c.Client.CiliumV2().CiliumIdentities()), - &v2.CiliumIdentity{}, - 0, - cache.ResourceEventHandlerFuncs{ - AddFunc: func(obj interface{}) { - if identity, ok := obj.(*v2.CiliumIdentity); ok { - if id, err := strconv.ParseUint(identity.Name, 10, 64); err == nil { - handler.OnAdd(idpool.ID(id), c.KeyFunc(identity.SecurityLabels)) - } - } - }, - UpdateFunc: func(oldObj, newObj interface{}) { - if oldIdentity, ok := newObj.(*v2.CiliumIdentity); ok { - if newIdentity, ok := newObj.(*v2.CiliumIdentity); ok { - if oldIdentity.DeepEqual(newIdentity) { - return - } - if id, err := strconv.ParseUint(newIdentity.Name, 10, 64); err == nil { - handler.OnModify(idpool.ID(id), c.KeyFunc(newIdentity.SecurityLabels)) - } - } - } - }, - DeleteFunc: func(obj interface{}) { - // The delete event is sometimes for items with unknown state that are - // deleted anyway. - if deleteObj, isDeleteObj := obj.(cache.DeletedFinalStateUnknown); isDeleteObj { - obj = deleteObj.Obj - } - - if identity, ok := obj.(*v2.CiliumIdentity); ok { - if id, err := strconv.ParseUint(identity.Name, 10, 64); err == nil { - handler.OnDelete(idpool.ID(id), c.KeyFunc(identity.SecurityLabels)) - } - } else { - log.Debugf("Ignoring unknown delete event %#v", obj) - } - }, - }, - nil, - c.Store, - ) - - go func() { - if ok := cache.WaitForCacheSync(stopChan, identityInformer.HasSynced); ok { - handler.OnListDone() - } - }() - - identityInformer.Run(stopChan) -} - -func (c *crdBackend) Status() (string, error) { - return "OK", nil -} - -func (c *crdBackend) Encode(v string) string { - return v -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/informer/informer.go b/vendor/github.com/cilium/cilium/pkg/k8s/informer/informer.go deleted file mode 100644 index 24680ce73..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/informer/informer.go +++ /dev/null @@ -1,148 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package informer - -import ( - "errors" - "fmt" - "net/http" - - k8sRuntime "k8s.io/apimachinery/pkg/runtime" - utilRuntime "k8s.io/apimachinery/pkg/util/runtime" - "k8s.io/client-go/tools/cache" - - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/time" -) - -var log = logging.DefaultLogger.WithField(logfields.LogSubsys, "k8s") - -func init() { - utilRuntime.PanicHandlers = append( - utilRuntime.PanicHandlers, - func(r interface{}) { - // from k8s library - if err, ok := r.(error); ok && errors.Is(err, http.ErrAbortHandler) { - // honor the http.ErrAbortHandler sentinel panic value: - // ErrAbortHandler is a sentinel panic value to abort a handler. - // While any panic from ServeHTTP aborts the response to the client, - // panicking with ErrAbortHandler also suppresses logging of a stack trace to the server's error log. - return - } - log.Fatal("Panic in Kubernetes runtime handler") - }, - ) -} - -type privateRunner struct { - cache.Controller - cacheMutationDetector cache.MutationDetector -} - -func (p *privateRunner) Run(stopCh <-chan struct{}) { - go p.cacheMutationDetector.Run(stopCh) - p.Controller.Run(stopCh) -} - -// NewInformer is a copy of k8s.io/client-go/tools/cache/NewInformer includes the default cache MutationDetector. -func NewInformer( - lw cache.ListerWatcher, - objType k8sRuntime.Object, - resyncPeriod time.Duration, - h cache.ResourceEventHandler, - transformer cache.TransformFunc, -) (cache.Store, cache.Controller) { - // This will hold the client state, as we know it. - clientState := cache.NewStore(cache.DeletionHandlingMetaNamespaceKeyFunc) - - return clientState, NewInformerWithStore(lw, objType, resyncPeriod, h, transformer, clientState) -} - -// NewIndexerInformer is a copy of k8s.io/client-go/tools/cache/NewIndexerInformer but includes the -// default cache MutationDetector. -func NewIndexerInformer( - lw cache.ListerWatcher, - objType k8sRuntime.Object, - resyncPeriod time.Duration, - h cache.ResourceEventHandler, - transformer cache.TransformFunc, - indexers cache.Indexers, -) (cache.Indexer, cache.Controller) { - clientState := cache.NewIndexer(cache.DeletionHandlingMetaNamespaceKeyFunc, indexers) - return clientState, NewInformerWithStore(lw, objType, resyncPeriod, h, transformer, clientState) -} - -// NewInformerWithStore uses the same arguments as NewInformer for which a caller can also set a -// cache.Store and includes the default cache MutationDetector. -func NewInformerWithStore( - lw cache.ListerWatcher, - objType k8sRuntime.Object, - resyncPeriod time.Duration, - h cache.ResourceEventHandler, - transformer cache.TransformFunc, - clientState cache.Store, -) cache.Controller { - - // This will hold incoming changes. Note how we pass clientState in as a - // KeyLister, that way resync operations will result in the correct set - // of update/delete deltas. - opts := cache.DeltaFIFOOptions{KeyFunction: cache.MetaNamespaceKeyFunc, KnownObjects: clientState} - fifo := cache.NewDeltaFIFOWithOptions(opts) - - cacheMutationDetector := cache.NewCacheMutationDetector(fmt.Sprintf("%T", objType)) - - cfg := &cache.Config{ - Queue: fifo, - ListerWatcher: lw, - ObjectType: objType, - FullResyncPeriod: resyncPeriod, - RetryOnError: false, - - Process: func(obj interface{}, isInInitialList bool) error { - // from oldest to newest - for _, d := range obj.(cache.Deltas) { - - var obj interface{} - if transformer != nil { - var err error - if obj, err = transformer(d.Object); err != nil { - return err - } - } else { - obj = d.Object - } - - // In CI we detect if the objects were modified and panic - // this is a no-op in production environments. - cacheMutationDetector.AddObject(obj) - - switch d.Type { - case cache.Sync, cache.Added, cache.Updated: - if old, exists, err := clientState.Get(obj); err == nil && exists { - if err := clientState.Update(obj); err != nil { - return err - } - h.OnUpdate(old, obj) - } else { - if err := clientState.Add(obj); err != nil { - return err - } - h.OnAdd(obj, isInInitialList) - } - case cache.Deleted: - if err := clientState.Delete(obj); err != nil { - return err - } - h.OnDelete(obj) - } - } - return nil - }, - } - return &privateRunner{ - Controller: cache.New(cfg), - cacheMutationDetector: cacheMutationDetector, - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/metrics/metrics.go b/vendor/github.com/cilium/cilium/pkg/k8s/metrics/metrics.go deleted file mode 100644 index f15385599..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/metrics/metrics.go +++ /dev/null @@ -1,38 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package metrics - -import ( - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/time" -) - -var ( - // LastInteraction is the time at which the last apiserver interaction - // occurred - LastInteraction eventTimestamper - // LastSuccessInteraction is the time at which we have received a successful - // k8s apiserver reply (i.e. a response code 2xx or 4xx). - LastSuccessInteraction eventTimestamper -) - -type eventTimestamper struct { - timestamp time.Time - lock lock.RWMutex -} - -// Reset sets the timestamp to the current time -func (e *eventTimestamper) Reset() { - e.lock.Lock() - e.timestamp = time.Now() - e.lock.Unlock() -} - -// Time returns the timestamp as set per Reset() -func (e *eventTimestamper) Time() time.Time { - e.lock.RLock() - t := e.timestamp - e.lock.RUnlock() - return t -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/doc.go deleted file mode 100644 index dc1108488..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/doc.go +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// +k8s:openapi-gen=true -// +k8s:deepcopy-gen=package -// +k8s:protobuf-gen=package -// +deepequal-gen=package -// +groupGoName=core - -// Package v1 is the v1 version of the core API. -package v1 diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/generated.pb.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/generated.pb.go deleted file mode 100644 index f1887ef11..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/generated.pb.go +++ /dev/null @@ -1,11016 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/generated.proto - -package v1 - -import ( - fmt "fmt" - - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" - - io "io" - - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" - - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" -) - -// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -func (m *ClientIPConfig) Reset() { *m = ClientIPConfig{} } -func (*ClientIPConfig) ProtoMessage() {} -func (*ClientIPConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{0} -} -func (m *ClientIPConfig) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ClientIPConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ClientIPConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClientIPConfig.Merge(m, src) -} -func (m *ClientIPConfig) XXX_Size() int { - return m.Size() -} -func (m *ClientIPConfig) XXX_DiscardUnknown() { - xxx_messageInfo_ClientIPConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_ClientIPConfig proto.InternalMessageInfo - -func (m *Container) Reset() { *m = Container{} } -func (*Container) ProtoMessage() {} -func (*Container) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{1} -} -func (m *Container) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Container) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Container) XXX_Merge(src proto.Message) { - xxx_messageInfo_Container.Merge(m, src) -} -func (m *Container) XXX_Size() int { - return m.Size() -} -func (m *Container) XXX_DiscardUnknown() { - xxx_messageInfo_Container.DiscardUnknown(m) -} - -var xxx_messageInfo_Container proto.InternalMessageInfo - -func (m *ContainerPort) Reset() { *m = ContainerPort{} } -func (*ContainerPort) ProtoMessage() {} -func (*ContainerPort) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{2} -} -func (m *ContainerPort) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ContainerPort) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ContainerPort) XXX_Merge(src proto.Message) { - xxx_messageInfo_ContainerPort.Merge(m, src) -} -func (m *ContainerPort) XXX_Size() int { - return m.Size() -} -func (m *ContainerPort) XXX_DiscardUnknown() { - xxx_messageInfo_ContainerPort.DiscardUnknown(m) -} - -var xxx_messageInfo_ContainerPort proto.InternalMessageInfo - -func (m *ContainerState) Reset() { *m = ContainerState{} } -func (*ContainerState) ProtoMessage() {} -func (*ContainerState) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{3} -} -func (m *ContainerState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ContainerState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ContainerState) XXX_Merge(src proto.Message) { - xxx_messageInfo_ContainerState.Merge(m, src) -} -func (m *ContainerState) XXX_Size() int { - return m.Size() -} -func (m *ContainerState) XXX_DiscardUnknown() { - xxx_messageInfo_ContainerState.DiscardUnknown(m) -} - -var xxx_messageInfo_ContainerState proto.InternalMessageInfo - -func (m *ContainerStateRunning) Reset() { *m = ContainerStateRunning{} } -func (*ContainerStateRunning) ProtoMessage() {} -func (*ContainerStateRunning) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{4} -} -func (m *ContainerStateRunning) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ContainerStateRunning) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ContainerStateRunning) XXX_Merge(src proto.Message) { - xxx_messageInfo_ContainerStateRunning.Merge(m, src) -} -func (m *ContainerStateRunning) XXX_Size() int { - return m.Size() -} -func (m *ContainerStateRunning) XXX_DiscardUnknown() { - xxx_messageInfo_ContainerStateRunning.DiscardUnknown(m) -} - -var xxx_messageInfo_ContainerStateRunning proto.InternalMessageInfo - -func (m *ContainerStatus) Reset() { *m = ContainerStatus{} } -func (*ContainerStatus) ProtoMessage() {} -func (*ContainerStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{5} -} -func (m *ContainerStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ContainerStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ContainerStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_ContainerStatus.Merge(m, src) -} -func (m *ContainerStatus) XXX_Size() int { - return m.Size() -} -func (m *ContainerStatus) XXX_DiscardUnknown() { - xxx_messageInfo_ContainerStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_ContainerStatus proto.InternalMessageInfo - -func (m *EndpointAddress) Reset() { *m = EndpointAddress{} } -func (*EndpointAddress) ProtoMessage() {} -func (*EndpointAddress) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{6} -} -func (m *EndpointAddress) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EndpointAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EndpointAddress) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointAddress.Merge(m, src) -} -func (m *EndpointAddress) XXX_Size() int { - return m.Size() -} -func (m *EndpointAddress) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointAddress.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointAddress proto.InternalMessageInfo - -func (m *EndpointPort) Reset() { *m = EndpointPort{} } -func (*EndpointPort) ProtoMessage() {} -func (*EndpointPort) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{7} -} -func (m *EndpointPort) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EndpointPort) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EndpointPort) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointPort.Merge(m, src) -} -func (m *EndpointPort) XXX_Size() int { - return m.Size() -} -func (m *EndpointPort) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointPort.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointPort proto.InternalMessageInfo - -func (m *EndpointSubset) Reset() { *m = EndpointSubset{} } -func (*EndpointSubset) ProtoMessage() {} -func (*EndpointSubset) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{8} -} -func (m *EndpointSubset) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EndpointSubset) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EndpointSubset) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointSubset.Merge(m, src) -} -func (m *EndpointSubset) XXX_Size() int { - return m.Size() -} -func (m *EndpointSubset) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointSubset.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointSubset proto.InternalMessageInfo - -func (m *Endpoints) Reset() { *m = Endpoints{} } -func (*Endpoints) ProtoMessage() {} -func (*Endpoints) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{9} -} -func (m *Endpoints) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Endpoints) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Endpoints) XXX_Merge(src proto.Message) { - xxx_messageInfo_Endpoints.Merge(m, src) -} -func (m *Endpoints) XXX_Size() int { - return m.Size() -} -func (m *Endpoints) XXX_DiscardUnknown() { - xxx_messageInfo_Endpoints.DiscardUnknown(m) -} - -var xxx_messageInfo_Endpoints proto.InternalMessageInfo - -func (m *EndpointsList) Reset() { *m = EndpointsList{} } -func (*EndpointsList) ProtoMessage() {} -func (*EndpointsList) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{10} -} -func (m *EndpointsList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EndpointsList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EndpointsList) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointsList.Merge(m, src) -} -func (m *EndpointsList) XXX_Size() int { - return m.Size() -} -func (m *EndpointsList) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointsList.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointsList proto.InternalMessageInfo - -func (m *LoadBalancerIngress) Reset() { *m = LoadBalancerIngress{} } -func (*LoadBalancerIngress) ProtoMessage() {} -func (*LoadBalancerIngress) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{11} -} -func (m *LoadBalancerIngress) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LoadBalancerIngress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *LoadBalancerIngress) XXX_Merge(src proto.Message) { - xxx_messageInfo_LoadBalancerIngress.Merge(m, src) -} -func (m *LoadBalancerIngress) XXX_Size() int { - return m.Size() -} -func (m *LoadBalancerIngress) XXX_DiscardUnknown() { - xxx_messageInfo_LoadBalancerIngress.DiscardUnknown(m) -} - -var xxx_messageInfo_LoadBalancerIngress proto.InternalMessageInfo - -func (m *LoadBalancerStatus) Reset() { *m = LoadBalancerStatus{} } -func (*LoadBalancerStatus) ProtoMessage() {} -func (*LoadBalancerStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{12} -} -func (m *LoadBalancerStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LoadBalancerStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *LoadBalancerStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_LoadBalancerStatus.Merge(m, src) -} -func (m *LoadBalancerStatus) XXX_Size() int { - return m.Size() -} -func (m *LoadBalancerStatus) XXX_DiscardUnknown() { - xxx_messageInfo_LoadBalancerStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_LoadBalancerStatus proto.InternalMessageInfo - -func (m *Namespace) Reset() { *m = Namespace{} } -func (*Namespace) ProtoMessage() {} -func (*Namespace) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{13} -} -func (m *Namespace) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Namespace) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Namespace) XXX_Merge(src proto.Message) { - xxx_messageInfo_Namespace.Merge(m, src) -} -func (m *Namespace) XXX_Size() int { - return m.Size() -} -func (m *Namespace) XXX_DiscardUnknown() { - xxx_messageInfo_Namespace.DiscardUnknown(m) -} - -var xxx_messageInfo_Namespace proto.InternalMessageInfo - -func (m *NamespaceList) Reset() { *m = NamespaceList{} } -func (*NamespaceList) ProtoMessage() {} -func (*NamespaceList) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{14} -} -func (m *NamespaceList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NamespaceList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NamespaceList) XXX_Merge(src proto.Message) { - xxx_messageInfo_NamespaceList.Merge(m, src) -} -func (m *NamespaceList) XXX_Size() int { - return m.Size() -} -func (m *NamespaceList) XXX_DiscardUnknown() { - xxx_messageInfo_NamespaceList.DiscardUnknown(m) -} - -var xxx_messageInfo_NamespaceList proto.InternalMessageInfo - -func (m *Node) Reset() { *m = Node{} } -func (*Node) ProtoMessage() {} -func (*Node) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{15} -} -func (m *Node) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Node) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Node) XXX_Merge(src proto.Message) { - xxx_messageInfo_Node.Merge(m, src) -} -func (m *Node) XXX_Size() int { - return m.Size() -} -func (m *Node) XXX_DiscardUnknown() { - xxx_messageInfo_Node.DiscardUnknown(m) -} - -var xxx_messageInfo_Node proto.InternalMessageInfo - -func (m *NodeAddress) Reset() { *m = NodeAddress{} } -func (*NodeAddress) ProtoMessage() {} -func (*NodeAddress) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{16} -} -func (m *NodeAddress) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeAddress) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeAddress.Merge(m, src) -} -func (m *NodeAddress) XXX_Size() int { - return m.Size() -} -func (m *NodeAddress) XXX_DiscardUnknown() { - xxx_messageInfo_NodeAddress.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeAddress proto.InternalMessageInfo - -func (m *NodeCondition) Reset() { *m = NodeCondition{} } -func (*NodeCondition) ProtoMessage() {} -func (*NodeCondition) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{17} -} -func (m *NodeCondition) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeCondition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeCondition) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeCondition.Merge(m, src) -} -func (m *NodeCondition) XXX_Size() int { - return m.Size() -} -func (m *NodeCondition) XXX_DiscardUnknown() { - xxx_messageInfo_NodeCondition.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeCondition proto.InternalMessageInfo - -func (m *NodeList) Reset() { *m = NodeList{} } -func (*NodeList) ProtoMessage() {} -func (*NodeList) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{18} -} -func (m *NodeList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeList) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeList.Merge(m, src) -} -func (m *NodeList) XXX_Size() int { - return m.Size() -} -func (m *NodeList) XXX_DiscardUnknown() { - xxx_messageInfo_NodeList.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeList proto.InternalMessageInfo - -func (m *NodeSpec) Reset() { *m = NodeSpec{} } -func (*NodeSpec) ProtoMessage() {} -func (*NodeSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{19} -} -func (m *NodeSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeSpec.Merge(m, src) -} -func (m *NodeSpec) XXX_Size() int { - return m.Size() -} -func (m *NodeSpec) XXX_DiscardUnknown() { - xxx_messageInfo_NodeSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeSpec proto.InternalMessageInfo - -func (m *NodeStatus) Reset() { *m = NodeStatus{} } -func (*NodeStatus) ProtoMessage() {} -func (*NodeStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{20} -} -func (m *NodeStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeStatus.Merge(m, src) -} -func (m *NodeStatus) XXX_Size() int { - return m.Size() -} -func (m *NodeStatus) XXX_DiscardUnknown() { - xxx_messageInfo_NodeStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeStatus proto.InternalMessageInfo - -func (m *Pod) Reset() { *m = Pod{} } -func (*Pod) ProtoMessage() {} -func (*Pod) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{21} -} -func (m *Pod) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Pod) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Pod) XXX_Merge(src proto.Message) { - xxx_messageInfo_Pod.Merge(m, src) -} -func (m *Pod) XXX_Size() int { - return m.Size() -} -func (m *Pod) XXX_DiscardUnknown() { - xxx_messageInfo_Pod.DiscardUnknown(m) -} - -var xxx_messageInfo_Pod proto.InternalMessageInfo - -func (m *PodCondition) Reset() { *m = PodCondition{} } -func (*PodCondition) ProtoMessage() {} -func (*PodCondition) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{22} -} -func (m *PodCondition) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PodCondition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *PodCondition) XXX_Merge(src proto.Message) { - xxx_messageInfo_PodCondition.Merge(m, src) -} -func (m *PodCondition) XXX_Size() int { - return m.Size() -} -func (m *PodCondition) XXX_DiscardUnknown() { - xxx_messageInfo_PodCondition.DiscardUnknown(m) -} - -var xxx_messageInfo_PodCondition proto.InternalMessageInfo - -func (m *PodIP) Reset() { *m = PodIP{} } -func (*PodIP) ProtoMessage() {} -func (*PodIP) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{23} -} -func (m *PodIP) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PodIP) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *PodIP) XXX_Merge(src proto.Message) { - xxx_messageInfo_PodIP.Merge(m, src) -} -func (m *PodIP) XXX_Size() int { - return m.Size() -} -func (m *PodIP) XXX_DiscardUnknown() { - xxx_messageInfo_PodIP.DiscardUnknown(m) -} - -var xxx_messageInfo_PodIP proto.InternalMessageInfo - -func (m *PodList) Reset() { *m = PodList{} } -func (*PodList) ProtoMessage() {} -func (*PodList) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{24} -} -func (m *PodList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PodList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *PodList) XXX_Merge(src proto.Message) { - xxx_messageInfo_PodList.Merge(m, src) -} -func (m *PodList) XXX_Size() int { - return m.Size() -} -func (m *PodList) XXX_DiscardUnknown() { - xxx_messageInfo_PodList.DiscardUnknown(m) -} - -var xxx_messageInfo_PodList proto.InternalMessageInfo - -func (m *PodReadinessGate) Reset() { *m = PodReadinessGate{} } -func (*PodReadinessGate) ProtoMessage() {} -func (*PodReadinessGate) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{25} -} -func (m *PodReadinessGate) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PodReadinessGate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *PodReadinessGate) XXX_Merge(src proto.Message) { - xxx_messageInfo_PodReadinessGate.Merge(m, src) -} -func (m *PodReadinessGate) XXX_Size() int { - return m.Size() -} -func (m *PodReadinessGate) XXX_DiscardUnknown() { - xxx_messageInfo_PodReadinessGate.DiscardUnknown(m) -} - -var xxx_messageInfo_PodReadinessGate proto.InternalMessageInfo - -func (m *PodSpec) Reset() { *m = PodSpec{} } -func (*PodSpec) ProtoMessage() {} -func (*PodSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{26} -} -func (m *PodSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PodSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *PodSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_PodSpec.Merge(m, src) -} -func (m *PodSpec) XXX_Size() int { - return m.Size() -} -func (m *PodSpec) XXX_DiscardUnknown() { - xxx_messageInfo_PodSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_PodSpec proto.InternalMessageInfo - -func (m *PodStatus) Reset() { *m = PodStatus{} } -func (*PodStatus) ProtoMessage() {} -func (*PodStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{27} -} -func (m *PodStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PodStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *PodStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_PodStatus.Merge(m, src) -} -func (m *PodStatus) XXX_Size() int { - return m.Size() -} -func (m *PodStatus) XXX_DiscardUnknown() { - xxx_messageInfo_PodStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_PodStatus proto.InternalMessageInfo - -func (m *PortStatus) Reset() { *m = PortStatus{} } -func (*PortStatus) ProtoMessage() {} -func (*PortStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{28} -} -func (m *PortStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PortStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *PortStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_PortStatus.Merge(m, src) -} -func (m *PortStatus) XXX_Size() int { - return m.Size() -} -func (m *PortStatus) XXX_DiscardUnknown() { - xxx_messageInfo_PortStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_PortStatus proto.InternalMessageInfo - -func (m *Secret) Reset() { *m = Secret{} } -func (*Secret) ProtoMessage() {} -func (*Secret) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{29} -} -func (m *Secret) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Secret) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Secret) XXX_Merge(src proto.Message) { - xxx_messageInfo_Secret.Merge(m, src) -} -func (m *Secret) XXX_Size() int { - return m.Size() -} -func (m *Secret) XXX_DiscardUnknown() { - xxx_messageInfo_Secret.DiscardUnknown(m) -} - -var xxx_messageInfo_Secret proto.InternalMessageInfo - -func (m *SecretList) Reset() { *m = SecretList{} } -func (*SecretList) ProtoMessage() {} -func (*SecretList) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{30} -} -func (m *SecretList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SecretList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *SecretList) XXX_Merge(src proto.Message) { - xxx_messageInfo_SecretList.Merge(m, src) -} -func (m *SecretList) XXX_Size() int { - return m.Size() -} -func (m *SecretList) XXX_DiscardUnknown() { - xxx_messageInfo_SecretList.DiscardUnknown(m) -} - -var xxx_messageInfo_SecretList proto.InternalMessageInfo - -func (m *Service) Reset() { *m = Service{} } -func (*Service) ProtoMessage() {} -func (*Service) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{31} -} -func (m *Service) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Service) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Service) XXX_Merge(src proto.Message) { - xxx_messageInfo_Service.Merge(m, src) -} -func (m *Service) XXX_Size() int { - return m.Size() -} -func (m *Service) XXX_DiscardUnknown() { - xxx_messageInfo_Service.DiscardUnknown(m) -} - -var xxx_messageInfo_Service proto.InternalMessageInfo - -func (m *ServiceList) Reset() { *m = ServiceList{} } -func (*ServiceList) ProtoMessage() {} -func (*ServiceList) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{32} -} -func (m *ServiceList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ServiceList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ServiceList) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServiceList.Merge(m, src) -} -func (m *ServiceList) XXX_Size() int { - return m.Size() -} -func (m *ServiceList) XXX_DiscardUnknown() { - xxx_messageInfo_ServiceList.DiscardUnknown(m) -} - -var xxx_messageInfo_ServiceList proto.InternalMessageInfo - -func (m *ServicePort) Reset() { *m = ServicePort{} } -func (*ServicePort) ProtoMessage() {} -func (*ServicePort) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{33} -} -func (m *ServicePort) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ServicePort) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ServicePort) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServicePort.Merge(m, src) -} -func (m *ServicePort) XXX_Size() int { - return m.Size() -} -func (m *ServicePort) XXX_DiscardUnknown() { - xxx_messageInfo_ServicePort.DiscardUnknown(m) -} - -var xxx_messageInfo_ServicePort proto.InternalMessageInfo - -func (m *ServiceSpec) Reset() { *m = ServiceSpec{} } -func (*ServiceSpec) ProtoMessage() {} -func (*ServiceSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{34} -} -func (m *ServiceSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ServiceSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ServiceSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServiceSpec.Merge(m, src) -} -func (m *ServiceSpec) XXX_Size() int { - return m.Size() -} -func (m *ServiceSpec) XXX_DiscardUnknown() { - xxx_messageInfo_ServiceSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_ServiceSpec proto.InternalMessageInfo - -func (m *ServiceStatus) Reset() { *m = ServiceStatus{} } -func (*ServiceStatus) ProtoMessage() {} -func (*ServiceStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{35} -} -func (m *ServiceStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ServiceStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ServiceStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServiceStatus.Merge(m, src) -} -func (m *ServiceStatus) XXX_Size() int { - return m.Size() -} -func (m *ServiceStatus) XXX_DiscardUnknown() { - xxx_messageInfo_ServiceStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_ServiceStatus proto.InternalMessageInfo - -func (m *SessionAffinityConfig) Reset() { *m = SessionAffinityConfig{} } -func (*SessionAffinityConfig) ProtoMessage() {} -func (*SessionAffinityConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{36} -} -func (m *SessionAffinityConfig) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SessionAffinityConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *SessionAffinityConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_SessionAffinityConfig.Merge(m, src) -} -func (m *SessionAffinityConfig) XXX_Size() int { - return m.Size() -} -func (m *SessionAffinityConfig) XXX_DiscardUnknown() { - xxx_messageInfo_SessionAffinityConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_SessionAffinityConfig proto.InternalMessageInfo - -func (m *Taint) Reset() { *m = Taint{} } -func (*Taint) ProtoMessage() {} -func (*Taint) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{37} -} -func (m *Taint) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Taint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Taint) XXX_Merge(src proto.Message) { - xxx_messageInfo_Taint.Merge(m, src) -} -func (m *Taint) XXX_Size() int { - return m.Size() -} -func (m *Taint) XXX_DiscardUnknown() { - xxx_messageInfo_Taint.DiscardUnknown(m) -} - -var xxx_messageInfo_Taint proto.InternalMessageInfo - -func (m *TypedLocalObjectReference) Reset() { *m = TypedLocalObjectReference{} } -func (*TypedLocalObjectReference) ProtoMessage() {} -func (*TypedLocalObjectReference) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{38} -} -func (m *TypedLocalObjectReference) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TypedLocalObjectReference) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *TypedLocalObjectReference) XXX_Merge(src proto.Message) { - xxx_messageInfo_TypedLocalObjectReference.Merge(m, src) -} -func (m *TypedLocalObjectReference) XXX_Size() int { - return m.Size() -} -func (m *TypedLocalObjectReference) XXX_DiscardUnknown() { - xxx_messageInfo_TypedLocalObjectReference.DiscardUnknown(m) -} - -var xxx_messageInfo_TypedLocalObjectReference proto.InternalMessageInfo - -func (m *VolumeMount) Reset() { *m = VolumeMount{} } -func (*VolumeMount) ProtoMessage() {} -func (*VolumeMount) Descriptor() ([]byte, []int) { - return fileDescriptor_871504499faea14d, []int{39} -} -func (m *VolumeMount) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VolumeMount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VolumeMount) XXX_Merge(src proto.Message) { - xxx_messageInfo_VolumeMount.Merge(m, src) -} -func (m *VolumeMount) XXX_Size() int { - return m.Size() -} -func (m *VolumeMount) XXX_DiscardUnknown() { - xxx_messageInfo_VolumeMount.DiscardUnknown(m) -} - -var xxx_messageInfo_VolumeMount proto.InternalMessageInfo - -func init() { - proto.RegisterType((*ClientIPConfig)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.ClientIPConfig") - proto.RegisterType((*Container)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.Container") - proto.RegisterType((*ContainerPort)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.ContainerPort") - proto.RegisterType((*ContainerState)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.ContainerState") - proto.RegisterType((*ContainerStateRunning)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.ContainerStateRunning") - proto.RegisterType((*ContainerStatus)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.ContainerStatus") - proto.RegisterType((*EndpointAddress)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.EndpointAddress") - proto.RegisterType((*EndpointPort)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.EndpointPort") - proto.RegisterType((*EndpointSubset)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.EndpointSubset") - proto.RegisterType((*Endpoints)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.Endpoints") - proto.RegisterType((*EndpointsList)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.EndpointsList") - proto.RegisterType((*LoadBalancerIngress)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.LoadBalancerIngress") - proto.RegisterType((*LoadBalancerStatus)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.LoadBalancerStatus") - proto.RegisterType((*Namespace)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.Namespace") - proto.RegisterType((*NamespaceList)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.NamespaceList") - proto.RegisterType((*Node)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.Node") - proto.RegisterType((*NodeAddress)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.NodeAddress") - proto.RegisterType((*NodeCondition)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.NodeCondition") - proto.RegisterType((*NodeList)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.NodeList") - proto.RegisterType((*NodeSpec)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.NodeSpec") - proto.RegisterType((*NodeStatus)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.NodeStatus") - proto.RegisterType((*Pod)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.Pod") - proto.RegisterType((*PodCondition)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.PodCondition") - proto.RegisterType((*PodIP)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.PodIP") - proto.RegisterType((*PodList)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.PodList") - proto.RegisterType((*PodReadinessGate)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.PodReadinessGate") - proto.RegisterType((*PodSpec)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.PodSpec") - proto.RegisterType((*PodStatus)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.PodStatus") - proto.RegisterType((*PortStatus)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.PortStatus") - proto.RegisterType((*Secret)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.Secret") - proto.RegisterMapType((map[string]Bytes)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.Secret.DataEntry") - proto.RegisterMapType((map[string]string)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.Secret.StringDataEntry") - proto.RegisterType((*SecretList)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.SecretList") - proto.RegisterType((*Service)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.Service") - proto.RegisterType((*ServiceList)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.ServiceList") - proto.RegisterType((*ServicePort)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.ServicePort") - proto.RegisterType((*ServiceSpec)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.ServiceSpec") - proto.RegisterMapType((map[string]string)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.ServiceSpec.SelectorEntry") - proto.RegisterType((*ServiceStatus)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.ServiceStatus") - proto.RegisterType((*SessionAffinityConfig)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.SessionAffinityConfig") - proto.RegisterType((*Taint)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.Taint") - proto.RegisterType((*TypedLocalObjectReference)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.TypedLocalObjectReference") - proto.RegisterType((*VolumeMount)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1.VolumeMount") -} - -func init() { - proto.RegisterFile("github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/generated.proto", fileDescriptor_871504499faea14d) -} - -var fileDescriptor_871504499faea14d = []byte{ - // 2691 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x3a, 0xcd, 0x6f, 0x23, 0x49, - 0xf5, 0xd3, 0x76, 0x9c, 0xd8, 0xcf, 0x89, 0xb3, 0xa9, 0xd9, 0xac, 0x7a, 0xf3, 0xdb, 0x4d, 0xf2, - 0xeb, 0x41, 0x68, 0x96, 0x0f, 0x47, 0x3b, 0x10, 0x98, 0x9d, 0xd9, 0x1d, 0x26, 0x76, 0x32, 0x33, - 0xde, 0x4d, 0x66, 0x4c, 0x39, 0x5a, 0x21, 0x38, 0xb0, 0x9d, 0xee, 0x8a, 0xd3, 0x1b, 0xbb, 0xdb, - 0x74, 0x95, 0x33, 0x6b, 0x09, 0xc1, 0xae, 0x10, 0x68, 0x81, 0x91, 0xe0, 0x1f, 0xe0, 0xc2, 0x8d, - 0x33, 0x5c, 0x10, 0x67, 0xa4, 0xe1, 0xb6, 0xdc, 0x46, 0x08, 0x85, 0x9d, 0x20, 0x71, 0xe3, 0x80, - 0x38, 0x11, 0x24, 0x84, 0xaa, 0xba, 0xaa, 0xba, 0xdb, 0xb1, 0x67, 0x12, 0x3b, 0x52, 0xc4, 0xc9, - 0xee, 0xf7, 0x5e, 0xbd, 0x8f, 0xaa, 0xf7, 0x55, 0xaf, 0x1b, 0x36, 0x9a, 0x1e, 0xdb, 0xeb, 0xee, - 0x94, 0x9d, 0xa0, 0xbd, 0xe2, 0x78, 0x2d, 0xaf, 0xab, 0x7f, 0x3a, 0xfb, 0xcd, 0x95, 0xfd, 0xeb, - 0x74, 0x85, 0xb6, 0xbc, 0xb6, 0xf8, 0x63, 0x77, 0xbc, 0x15, 0x27, 0x08, 0xc9, 0xca, 0xc1, 0xeb, - 0x2b, 0x4d, 0xe2, 0x93, 0xd0, 0x66, 0xc4, 0x2d, 0x77, 0xc2, 0x80, 0x05, 0x68, 0x35, 0x66, 0x53, - 0x8e, 0xd6, 0xab, 0x9f, 0xce, 0x7e, 0xb3, 0xbc, 0x7f, 0x9d, 0x96, 0x39, 0x1b, 0xf1, 0xc7, 0xee, - 0x78, 0x65, 0xce, 0xa6, 0x7c, 0xf0, 0xfa, 0xc2, 0x9d, 0x33, 0x49, 0xa7, 0x2b, 0x6d, 0xc2, 0xec, - 0x01, 0xe2, 0x17, 0xbe, 0x98, 0xe0, 0xd3, 0x0c, 0x9a, 0xc1, 0x8a, 0x00, 0xef, 0x74, 0x77, 0xc5, - 0x93, 0x78, 0x10, 0xff, 0x24, 0x39, 0x67, 0x58, 0xf6, 0x02, 0xce, 0xb3, 0x6d, 0x3b, 0x7b, 0x9e, - 0x4f, 0xc2, 0x9e, 0x90, 0x18, 0x76, 0x7d, 0xe6, 0xb5, 0xc9, 0x09, 0xfe, 0x5f, 0x79, 0xde, 0x02, - 0xea, 0xec, 0x91, 0xb6, 0xdd, 0xbf, 0xce, 0xda, 0x84, 0x52, 0xb5, 0xe5, 0x11, 0x9f, 0xd5, 0xea, - 0xd5, 0xc0, 0xdf, 0xf5, 0x9a, 0xe8, 0x06, 0x94, 0xf8, 0x82, 0xa0, 0xcb, 0x1a, 0xc4, 0x09, 0x7c, - 0x97, 0x9a, 0xc6, 0xb2, 0x71, 0x35, 0x57, 0x41, 0x47, 0x87, 0x4b, 0xa5, 0xed, 0x14, 0x06, 0xf7, - 0x51, 0x5a, 0xbf, 0xcb, 0x40, 0xa1, 0x1a, 0xf8, 0xcc, 0xe6, 0xf2, 0xd1, 0x32, 0x4c, 0xf8, 0x76, - 0x9b, 0x88, 0xf5, 0x85, 0xca, 0xf4, 0xe3, 0xc3, 0xa5, 0x4b, 0x47, 0x87, 0x4b, 0x13, 0xf7, 0xed, - 0x36, 0xc1, 0x02, 0x83, 0xae, 0x40, 0xce, 0x6b, 0xdb, 0x4d, 0x62, 0x66, 0x04, 0xc9, 0x8c, 0x24, - 0xc9, 0xd5, 0x38, 0x10, 0x47, 0x38, 0xe4, 0x41, 0xae, 0x13, 0x84, 0x8c, 0x9a, 0x93, 0xcb, 0xd9, - 0xab, 0xc5, 0x6b, 0xeb, 0xe5, 0x91, 0x4e, 0xb2, 0xac, 0xf5, 0xaa, 0x07, 0x21, 0x8b, 0x45, 0xf1, - 0x27, 0x8a, 0x23, 0x09, 0xe8, 0xbb, 0x30, 0x7d, 0x10, 0xb4, 0xba, 0x6d, 0xb2, 0x15, 0x74, 0x7d, - 0x46, 0xcd, 0x82, 0x90, 0x58, 0x19, 0x51, 0xe2, 0xbb, 0x31, 0xab, 0xca, 0x8b, 0x52, 0xde, 0x74, - 0x02, 0x48, 0x71, 0x4a, 0x9a, 0xf5, 0x1f, 0x03, 0x66, 0x52, 0x5a, 0x9e, 0x62, 0x07, 0xbf, 0x00, - 0xf9, 0xbd, 0x80, 0x32, 0x4e, 0x2d, 0x36, 0x31, 0x57, 0x79, 0x41, 0x52, 0xe5, 0xef, 0x49, 0x38, - 0xd6, 0x14, 0xe8, 0x26, 0xcc, 0x38, 0x49, 0x01, 0x66, 0x56, 0x2c, 0x99, 0x97, 0x4b, 0xd2, 0xd2, - 0x71, 0x9a, 0x16, 0x5d, 0x87, 0xbc, 0xf0, 0x19, 0x27, 0x68, 0x99, 0x13, 0x42, 0xa1, 0x57, 0x94, - 0xa8, 0xba, 0x84, 0x1f, 0x27, 0xfe, 0x63, 0x4d, 0x8d, 0x3e, 0x0b, 0x93, 0x5c, 0x85, 0x5a, 0xdd, - 0xcc, 0x89, 0x75, 0x25, 0xb9, 0x6e, 0xf2, 0x9e, 0x80, 0x62, 0x89, 0xb5, 0x7e, 0x68, 0x40, 0x49, - 0xab, 0xd0, 0x60, 0x36, 0x23, 0x88, 0xc2, 0x54, 0xd8, 0xf5, 0x7d, 0xcf, 0x6f, 0x0a, 0xf3, 0x8a, - 0xd7, 0x36, 0xc7, 0x3d, 0x7e, 0xc1, 0x17, 0x47, 0x3c, 0x2b, 0xc5, 0xa3, 0xc3, 0xa5, 0x29, 0xf9, - 0x80, 0x95, 0x24, 0xeb, 0x47, 0x06, 0xcc, 0x0f, 0xa4, 0x47, 0x6d, 0x28, 0x50, 0x66, 0x87, 0x8c, - 0xb8, 0x6b, 0x4c, 0x9c, 0x4a, 0xf1, 0xda, 0x9b, 0x67, 0x53, 0x88, 0x96, 0x79, 0x8a, 0xe0, 0x1a, - 0xf1, 0x58, 0xaa, 0xcc, 0xc9, 0xad, 0x28, 0x34, 0x14, 0x5b, 0x1c, 0x4b, 0xb0, 0x7e, 0x63, 0xc0, - 0x6c, 0x4a, 0x91, 0x2e, 0x45, 0xef, 0x43, 0x8e, 0x72, 0x95, 0xe4, 0x7e, 0x6c, 0x9c, 0xcb, 0x7e, - 0xc4, 0xf1, 0x10, 0x99, 0x1b, 0x89, 0x40, 0xab, 0x50, 0xd4, 0x3e, 0x50, 0x5b, 0x37, 0xf3, 0xe2, - 0xf4, 0x2e, 0x4b, 0xd2, 0x62, 0x35, 0x46, 0xe1, 0x24, 0x1d, 0x3f, 0xc7, 0xd9, 0x0d, 0xdf, 0xed, - 0x04, 0x9e, 0xcf, 0xd6, 0x5c, 0x37, 0x24, 0x94, 0xa2, 0x05, 0xc8, 0x78, 0x1d, 0xe9, 0xc8, 0x20, - 0x39, 0x64, 0x6a, 0x75, 0x9c, 0xf1, 0x3a, 0xca, 0x89, 0x85, 0xab, 0x67, 0x05, 0x45, 0xca, 0x89, - 0x39, 0x1c, 0x6b, 0x0a, 0x74, 0x15, 0xf2, 0x7e, 0xe0, 0x12, 0x1e, 0x04, 0xd2, 0x0f, 0xa7, 0x39, - 0xe5, 0x7d, 0x09, 0xc3, 0x1a, 0x6b, 0x3d, 0x32, 0x60, 0x5a, 0xe9, 0x71, 0xca, 0x78, 0x5a, 0x86, - 0x89, 0x4e, 0x1c, 0x4b, 0x9a, 0x42, 0xc4, 0x83, 0xc0, 0xa4, 0xc2, 0x20, 0x7b, 0x96, 0x30, 0xb0, - 0xfe, 0x69, 0x40, 0x49, 0xa9, 0xd3, 0xe8, 0xee, 0x50, 0xc2, 0xd0, 0x43, 0x28, 0xd8, 0xd1, 0x06, - 0x11, 0x9e, 0x67, 0x79, 0xb6, 0xb9, 0x33, 0xe2, 0x81, 0xf6, 0x6d, 0x78, 0xec, 0x59, 0x6b, 0x4a, - 0x00, 0x8e, 0x65, 0xa1, 0x3d, 0x95, 0x54, 0xb3, 0x42, 0x68, 0x75, 0x4c, 0xa1, 0xc3, 0x73, 0xaa, - 0xf5, 0x0f, 0x03, 0x0a, 0x8a, 0x8c, 0xa2, 0x10, 0xf2, 0xdc, 0xff, 0x5d, 0x9b, 0xd9, 0x32, 0x7e, - 0x2a, 0xa3, 0xc6, 0xcf, 0x83, 0x9d, 0xf7, 0x89, 0xc3, 0xb6, 0x08, 0xb3, 0x2b, 0x48, 0x4a, 0x86, - 0x18, 0x86, 0xb5, 0x1c, 0xd4, 0x81, 0x29, 0x2a, 0xb6, 0x9b, 0x9a, 0x19, 0x61, 0xed, 0xc6, 0x98, - 0xd6, 0x46, 0x87, 0x57, 0x99, 0x95, 0x52, 0xa7, 0xa2, 0x67, 0x8a, 0x95, 0x18, 0xeb, 0x6f, 0x06, - 0xcc, 0x68, 0x9b, 0x37, 0x3d, 0xca, 0x90, 0x7f, 0xc2, 0xee, 0xdb, 0xa3, 0xda, 0xcd, 0xf9, 0x09, - 0xab, 0x75, 0x90, 0x28, 0x48, 0xc2, 0x66, 0x02, 0x39, 0x8f, 0x91, 0xb6, 0xb2, 0xf8, 0xf6, 0x98, - 0x16, 0xd3, 0x44, 0x6d, 0xe6, 0x6c, 0x71, 0xc4, 0xdd, 0xfa, 0x28, 0x03, 0x97, 0x37, 0x03, 0xdb, - 0xad, 0xd8, 0x2d, 0xdb, 0x77, 0x48, 0x58, 0xf3, 0x9b, 0x67, 0x8a, 0xf6, 0xcc, 0x73, 0xa3, 0xfd, - 0x3a, 0x4c, 0x7a, 0x9d, 0xad, 0xc0, 0x55, 0x99, 0x61, 0x99, 0xd7, 0x8d, 0x5a, 0x9d, 0x43, 0x8e, - 0x0f, 0x97, 0x50, 0x4a, 0xb8, 0x80, 0x62, 0x49, 0x8f, 0x76, 0x95, 0x8b, 0x4f, 0x88, 0x2d, 0x58, - 0x1b, 0x71, 0x0b, 0xb8, 0x33, 0x47, 0xa9, 0x77, 0x88, 0x83, 0xff, 0xd4, 0x80, 0x94, 0x1a, 0x32, - 0x4f, 0x77, 0x61, 0xca, 0x8b, 0x76, 0x43, 0x06, 0xf6, 0xdb, 0x23, 0x2a, 0x30, 0x60, 0x7f, 0x63, - 0xd7, 0x93, 0x00, 0xac, 0x64, 0x59, 0xdf, 0x87, 0x02, 0x4f, 0x67, 0xb4, 0x63, 0x3b, 0xe4, 0x22, - 0xa2, 0x4d, 0xf8, 0xbe, 0xd6, 0xe0, 0x7f, 0xd9, 0xf7, 0xb5, 0x11, 0x43, 0x7c, 0xff, 0x71, 0x06, - 0x26, 0x78, 0xd1, 0xb9, 0x90, 0x9c, 0x66, 0xc3, 0x04, 0xed, 0x10, 0x47, 0x36, 0x01, 0x5f, 0x1b, - 0xd5, 0xc4, 0xc0, 0x25, 0x8d, 0x0e, 0x71, 0xe2, 0x42, 0xc7, 0x9f, 0xb0, 0x60, 0x8d, 0x3c, 0x98, - 0xa4, 0xc2, 0x95, 0x45, 0xe4, 0x8d, 0x1e, 0x40, 0x42, 0x48, 0x14, 0x40, 0xba, 0xf1, 0x8b, 0x9e, - 0xb1, 0x14, 0x60, 0xb5, 0xa1, 0xc8, 0xa9, 0x54, 0xaf, 0xf0, 0x25, 0x98, 0x60, 0xbd, 0x8e, 0x2a, - 0xd3, 0x4b, 0x4a, 0xb7, 0xed, 0x5e, 0x87, 0xc7, 0xfc, 0x6c, 0x82, 0x94, 0x83, 0xb0, 0x20, 0x46, - 0xaf, 0xc1, 0x94, 0x2c, 0x6f, 0x32, 0xab, 0xe8, 0x18, 0x91, 0xb4, 0x58, 0xe1, 0xad, 0x5f, 0x71, - 0x17, 0x0d, 0x5c, 0x52, 0x0d, 0x7c, 0xd7, 0x63, 0x5e, 0xe0, 0xa3, 0xd5, 0x94, 0xc4, 0xff, 0xef, - 0x93, 0x38, 0x97, 0x22, 0x4e, 0xc8, 0x7c, 0x43, 0x6f, 0x51, 0x26, 0xb5, 0x50, 0xda, 0xc7, 0x95, - 0xd5, 0xcb, 0xd2, 0x26, 0xf3, 0x9e, 0x38, 0x24, 0x36, 0x0d, 0xfc, 0xfe, 0x9e, 0x18, 0x0b, 0x28, - 0x96, 0x58, 0xeb, 0xcf, 0x06, 0x88, 0xd6, 0xe6, 0x42, 0x22, 0xe9, 0xbd, 0x74, 0x24, 0xdd, 0x1c, - 0xc3, 0x03, 0x86, 0x04, 0xd1, 0xbf, 0xa4, 0x79, 0xdc, 0xef, 0xf8, 0x11, 0x76, 0x02, 0xb7, 0x5a, - 0x5b, 0xc7, 0xf2, 0x20, 0xf4, 0x11, 0xd6, 0x23, 0x30, 0x56, 0x78, 0xde, 0x04, 0xca, 0xbf, 0xd4, - 0x9c, 0x5a, 0xce, 0xaa, 0x26, 0x50, 0xd2, 0x51, 0xac, 0xb1, 0xe8, 0x1a, 0x40, 0x27, 0x0c, 0x0e, - 0x3c, 0x57, 0xb4, 0xb0, 0x51, 0x11, 0xd1, 0xb1, 0x55, 0xd7, 0x18, 0x9c, 0xa0, 0x42, 0x2e, 0x4c, - 0xf2, 0x66, 0x96, 0x51, 0x33, 0x27, 0x0c, 0x7f, 0x73, 0x44, 0xc3, 0xb7, 0x39, 0x93, 0xf8, 0x68, - 0xc5, 0x23, 0xc5, 0x92, 0xb7, 0xf5, 0x6f, 0x03, 0x20, 0x0e, 0x0e, 0xf4, 0x01, 0x80, 0xa3, 0x9c, - 0x45, 0x15, 0xad, 0xf5, 0x31, 0x76, 0x5c, 0x7b, 0x5e, 0x6c, 0xae, 0x06, 0x51, 0x9c, 0x90, 0x85, - 0x68, 0xb2, 0x0b, 0xcd, 0x8d, 0x75, 0xe7, 0x4d, 0xc4, 0xe6, 0xb3, 0x3b, 0x50, 0xeb, 0xf7, 0x19, - 0xc8, 0xd6, 0x03, 0xf7, 0x42, 0xb2, 0xe7, 0x7b, 0xa9, 0xec, 0x79, 0x6b, 0xe4, 0xce, 0xc0, 0x1d, - 0x9a, 0x3c, 0xf7, 0xfa, 0x92, 0xe7, 0xed, 0x31, 0x64, 0x3c, 0x3b, 0x77, 0x3e, 0xc9, 0xc2, 0x34, - 0x77, 0x7b, 0x9d, 0xcb, 0xbe, 0x9c, 0xca, 0x65, 0xcb, 0x7d, 0xb9, 0xec, 0x85, 0x24, 0xed, 0xf9, - 0xa4, 0xb2, 0x1e, 0xcc, 0xb4, 0x6c, 0xca, 0xea, 0x61, 0xb0, 0x43, 0xf8, 0xa5, 0x56, 0x9a, 0x3c, - 0xde, 0xc5, 0x58, 0xcf, 0x24, 0x36, 0x93, 0xac, 0x71, 0x5a, 0x12, 0xfa, 0xd8, 0x00, 0xc4, 0x21, - 0xdb, 0xa1, 0xed, 0xd3, 0xc8, 0x24, 0x4f, 0x5e, 0x0b, 0xc7, 0x55, 0x60, 0x41, 0x2a, 0x80, 0x36, - 0x4f, 0xf0, 0xc7, 0x03, 0x64, 0x9e, 0x36, 0xa1, 0xf3, 0x24, 0xd7, 0x26, 0x94, 0xda, 0x4d, 0x62, - 0x4e, 0xa6, 0x93, 0xdc, 0x56, 0x04, 0xc6, 0x0a, 0x6f, 0x5d, 0x81, 0x5c, 0x3d, 0x70, 0x6b, 0xf5, - 0x67, 0xb5, 0xd3, 0xd6, 0x9f, 0x0c, 0xe0, 0xe9, 0xf1, 0x42, 0xea, 0xc3, 0xb7, 0xd3, 0xf5, 0xe1, - 0xc6, 0xe8, 0x4e, 0x3e, 0xa4, 0x3c, 0x38, 0xc0, 0xfd, 0x15, 0x13, 0xdb, 0xf5, 0x7c, 0x42, 0xe9, - 0x5d, 0x9b, 0x11, 0xf4, 0x40, 0x0c, 0xb1, 0x62, 0x07, 0x96, 0xfb, 0xf2, 0x5a, 0x62, 0x88, 0x15, - 0x23, 0x07, 0x7a, 0x7c, 0x7a, 0xbd, 0xf5, 0xeb, 0xac, 0xd8, 0x41, 0x51, 0x82, 0x3e, 0x34, 0xa0, - 0xe4, 0xf9, 0x1e, 0xd3, 0xb3, 0x0d, 0x6a, 0xbe, 0x38, 0x56, 0x17, 0xa9, 0x19, 0x55, 0x5e, 0x92, - 0x0a, 0x96, 0x6a, 0x29, 0xfe, 0xb8, 0x4f, 0x1e, 0x62, 0xa2, 0x0e, 0x28, 0xe9, 0x99, 0x73, 0x92, - 0x9e, 0xac, 0x01, 0x4a, 0x72, 0x42, 0x0e, 0x7a, 0x1b, 0x10, 0x25, 0xe1, 0x81, 0xe7, 0x90, 0x35, - 0xc7, 0x09, 0xba, 0x3e, 0x13, 0xf3, 0x95, 0x68, 0xe2, 0xa3, 0x43, 0xa1, 0x71, 0x82, 0x02, 0x0f, - 0x58, 0xc5, 0x6f, 0x78, 0x7a, 0x42, 0x03, 0xe9, 0x1b, 0xde, 0xc9, 0x29, 0x0d, 0x5a, 0x85, 0x22, - 0xbf, 0xed, 0xdd, 0x27, 0xec, 0x61, 0x10, 0xee, 0x9b, 0xc5, 0x65, 0xe3, 0x6a, 0x3e, 0x1e, 0x32, - 0xdd, 0x8b, 0x51, 0x38, 0x49, 0x67, 0xfd, 0x32, 0x07, 0x05, 0x9d, 0x1d, 0xd1, 0x0a, 0xe4, 0x3a, - 0x7b, 0x36, 0x55, 0xce, 0xf0, 0xb2, 0xbe, 0xa9, 0x71, 0xe0, 0x71, 0xd4, 0x19, 0x88, 0xff, 0x38, - 0xa2, 0x43, 0x0f, 0x53, 0xd5, 0x36, 0x33, 0xd6, 0x14, 0x24, 0xe9, 0x60, 0xcf, 0x2d, 0xb6, 0xa7, - 0x1c, 0x86, 0xa2, 0x2b, 0xfc, 0xfa, 0xea, 0xd6, 0xea, 0x32, 0x4b, 0x24, 0xee, 0x9e, 0x6e, 0xad, - 0x8e, 0x23, 0x1c, 0x6f, 0x54, 0xc4, 0x1f, 0x6a, 0x4e, 0x8f, 0xd5, 0xa8, 0x08, 0xa6, 0xb1, 0x2a, - 0xe2, 0x91, 0x62, 0xc9, 0x1b, 0x79, 0x72, 0xea, 0x29, 0x72, 0xeb, 0xd4, 0x39, 0xe4, 0xd6, 0x19, - 0x3d, 0xf1, 0x14, 0xe9, 0x34, 0xe6, 0x8e, 0x7e, 0x66, 0xc0, 0x9c, 0x93, 0x9e, 0x78, 0x12, 0x6a, - 0xe6, 0xc7, 0x9a, 0x8c, 0xf5, 0x4d, 0x50, 0xb5, 0x73, 0xcc, 0x55, 0xfb, 0x05, 0xe1, 0x93, 0xb2, - 0xd1, 0x4d, 0xc8, 0x7f, 0x27, 0xa0, 0xd5, 0x96, 0x4d, 0xa9, 0x59, 0x48, 0x5d, 0x48, 0xf2, 0x5f, - 0x7f, 0xd0, 0x10, 0xf0, 0xe3, 0xc3, 0xa5, 0x62, 0x3d, 0x70, 0xd5, 0x23, 0xd6, 0x0b, 0xac, 0x1f, - 0x1b, 0x00, 0xf1, 0x00, 0x41, 0x4f, 0x17, 0x8d, 0x53, 0x4d, 0x17, 0x33, 0x67, 0x1a, 0xb2, 0x2f, - 0x41, 0x8e, 0x84, 0x61, 0x10, 0xca, 0x16, 0xb7, 0xc0, 0x7d, 0x65, 0x83, 0x03, 0x70, 0x04, 0xb7, - 0xfe, 0x30, 0x01, 0x93, 0x0d, 0xe2, 0x84, 0x84, 0x5d, 0x48, 0xcf, 0xf5, 0x79, 0x28, 0x78, 0xed, - 0x76, 0x97, 0xd9, 0x3b, 0x2d, 0x22, 0x5c, 0x3f, 0x1f, 0xb9, 0x41, 0x4d, 0x01, 0x71, 0x8c, 0x47, - 0x21, 0x4c, 0x08, 0xe5, 0xa2, 0xb8, 0xbc, 0x3b, 0xe2, 0xc1, 0x47, 0xd6, 0x96, 0xd7, 0x6d, 0x66, - 0x6f, 0xf8, 0x2c, 0xec, 0xe9, 0xa6, 0x62, 0x82, 0x83, 0x7e, 0xf2, 0x97, 0xa5, 0x5c, 0xa5, 0xc7, - 0x08, 0xc5, 0x42, 0x16, 0xfa, 0xc8, 0x00, 0xa0, 0x2c, 0xf4, 0xfc, 0x26, 0xc7, 0xca, 0x06, 0x7c, - 0x6b, 0x3c, 0xd1, 0x0d, 0xcd, 0x2f, 0x52, 0x40, 0x6f, 0x51, 0x8c, 0xc0, 0x09, 0xa1, 0xa8, 0x2c, - 0x7b, 0xb7, 0x6c, 0x2a, 0xef, 0xaa, 0xde, 0x0d, 0x22, 0xae, 0x71, 0xd7, 0xb6, 0xf0, 0x55, 0x28, - 0x68, 0xe6, 0xe8, 0x05, 0xc8, 0xee, 0x93, 0x5e, 0x94, 0x01, 0x31, 0xff, 0x8b, 0x5e, 0x84, 0xdc, - 0x81, 0xdd, 0xea, 0x46, 0x73, 0xb6, 0x69, 0x1c, 0x3d, 0xdc, 0xc8, 0x5c, 0x37, 0x16, 0xde, 0x82, - 0xd9, 0x3e, 0xdd, 0x9e, 0xb7, 0xbc, 0x90, 0x58, 0x6e, 0x7d, 0x6a, 0x80, 0x54, 0xe6, 0x42, 0xfa, - 0x8e, 0x9d, 0x74, 0xdf, 0xf1, 0xd6, 0x58, 0x87, 0x34, 0xa4, 0xf5, 0xf8, 0x63, 0x06, 0xa6, 0x64, - 0xbd, 0xbb, 0x90, 0x78, 0x71, 0x53, 0x77, 0x94, 0xca, 0xc8, 0x26, 0x0a, 0x0b, 0x86, 0xde, 0x53, - 0x5a, 0x7d, 0xf7, 0x94, 0xf5, 0x31, 0xe5, 0x3c, 0xfb, 0xae, 0x72, 0x64, 0x40, 0x51, 0x52, 0x5e, - 0x88, 0xdf, 0x38, 0x69, 0xbf, 0xb9, 0x35, 0x9e, 0xb1, 0x43, 0x1c, 0xe7, 0xb7, 0xb1, 0x91, 0xa7, - 0x7c, 0xe9, 0x34, 0x7a, 0xd2, 0x57, 0x05, 0x25, 0x3b, 0xb4, 0xa0, 0xc8, 0x5e, 0x4c, 0xbc, 0xed, - 0xcd, 0xa5, 0x5f, 0x10, 0xdf, 0x97, 0x70, 0xac, 0x29, 0xac, 0x47, 0x45, 0xad, 0xbb, 0x68, 0x87, - 0x9b, 0x6a, 0x86, 0x6e, 0x8c, 0x35, 0x15, 0x48, 0x6c, 0xc7, 0x90, 0x37, 0xef, 0xdf, 0x83, 0x3c, - 0x25, 0x2d, 0xe2, 0xb0, 0x20, 0x94, 0x87, 0x53, 0x1f, 0xdf, 0xe3, 0xcb, 0x0d, 0xc9, 0x32, 0x4a, - 0xbe, 0xda, 0x70, 0x05, 0xc6, 0x5a, 0x26, 0x5a, 0x81, 0x82, 0xd3, 0xea, 0x52, 0x46, 0xc2, 0x5a, - 0x5d, 0x66, 0x5f, 0x3d, 0xbe, 0xa8, 0x2a, 0x04, 0x8e, 0x69, 0x50, 0x19, 0x40, 0x3f, 0x50, 0x13, - 0x89, 0x11, 0x54, 0x49, 0xb4, 0x7d, 0x1a, 0x8a, 0x13, 0x14, 0x68, 0x45, 0x66, 0xf6, 0xe8, 0x8d, - 0xe5, 0xff, 0xf5, 0x65, 0x76, 0xb5, 0xe9, 0x89, 0x0b, 0xf9, 0xeb, 0x50, 0x24, 0x1f, 0x30, 0x12, - 0xfa, 0x76, 0x8b, 0x4b, 0xc8, 0x09, 0x09, 0xb3, 0xbc, 0x25, 0xde, 0x88, 0xc1, 0x38, 0x49, 0x83, - 0xb6, 0x61, 0x96, 0x12, 0x4a, 0xbd, 0xc0, 0x5f, 0xdb, 0xdd, 0xe5, 0xb7, 0x8a, 0x9e, 0xe8, 0xd6, - 0x0a, 0x95, 0xcf, 0x49, 0x71, 0xb3, 0x8d, 0x34, 0xfa, 0x58, 0x80, 0xa2, 0xfe, 0x5d, 0x82, 0x70, - 0x3f, 0x0b, 0x74, 0x0b, 0x4a, 0xad, 0xd4, 0x5b, 0x16, 0x79, 0x2b, 0xd0, 0xf7, 0x99, 0xf4, 0x3b, - 0x18, 0xdc, 0x47, 0x8d, 0xbe, 0x01, 0x66, 0x12, 0xd2, 0x08, 0xba, 0xa1, 0x43, 0xb0, 0xed, 0x37, - 0x49, 0xf4, 0x81, 0x45, 0xa1, 0xf2, 0xca, 0xd1, 0xe1, 0x92, 0xb9, 0x39, 0x84, 0x06, 0x0f, 0x5d, - 0x8d, 0x28, 0xcc, 0x2b, 0xf3, 0xb7, 0x43, 0x7b, 0x77, 0xd7, 0x73, 0xea, 0x41, 0xcb, 0x73, 0x7a, - 0xe2, 0x0e, 0x51, 0xa8, 0xbc, 0x25, 0x15, 0x9c, 0xdf, 0x18, 0x44, 0x74, 0x7c, 0xb8, 0xf4, 0x8a, - 0xb4, 0x7d, 0x20, 0x1e, 0x0f, 0xe6, 0x8d, 0xb6, 0xe0, 0xf2, 0x1e, 0xb1, 0x5b, 0x6c, 0xaf, 0xba, - 0x47, 0x9c, 0x7d, 0x15, 0x43, 0xe6, 0xb4, 0x88, 0x2d, 0x75, 0xae, 0x97, 0xef, 0x9d, 0x24, 0xc1, - 0x83, 0xd6, 0xa1, 0x5f, 0x18, 0x30, 0xdf, 0xb7, 0xe3, 0xd1, 0x87, 0x38, 0x66, 0x69, 0xac, 0xef, - 0x1d, 0x1a, 0x83, 0x78, 0x56, 0x5e, 0xe6, 0xdb, 0x31, 0x10, 0x85, 0x07, 0x6b, 0x81, 0x6e, 0x00, - 0x78, 0x9d, 0x3b, 0x76, 0xdb, 0x6b, 0x79, 0x84, 0x9a, 0x97, 0xc5, 0x79, 0x2d, 0x70, 0x3f, 0xaf, - 0xd5, 0x15, 0x94, 0xe7, 0x26, 0xf9, 0xd4, 0xc3, 0x09, 0x6a, 0xb4, 0x09, 0x25, 0xf9, 0xd4, 0x93, - 0x07, 0x33, 0x27, 0x0e, 0xe6, 0x33, 0xe2, 0x16, 0x5c, 0x4f, 0x62, 0x8e, 0x4f, 0x40, 0x70, 0xdf, - 0x5a, 0x54, 0x85, 0xb9, 0xa4, 0x27, 0x44, 0x1d, 0xf9, 0xbc, 0x60, 0x38, 0xcf, 0xbb, 0xf9, 0xcd, - 0x7e, 0x24, 0x3e, 0x49, 0x8f, 0x02, 0x98, 0xf7, 0xfc, 0x41, 0x2e, 0xf3, 0x92, 0x60, 0xf4, 0x06, - 0xdf, 0x9f, 0x9a, 0xff, 0x6c, 0x77, 0x19, 0x88, 0xc7, 0x83, 0xf9, 0x2e, 0xdc, 0x84, 0x99, 0x54, - 0x16, 0x3a, 0x53, 0x9b, 0xf5, 0x28, 0xc3, 0x57, 0x27, 0x2a, 0x2b, 0xfa, 0x81, 0x01, 0xd3, 0x49, - 0xab, 0x64, 0xd9, 0xac, 0x9d, 0xc3, 0xbb, 0x45, 0x59, 0xbb, 0xf5, 0x97, 0x4a, 0x49, 0x1c, 0x4e, - 0x09, 0x45, 0xdd, 0x01, 0x97, 0xe7, 0xb5, 0x51, 0x2b, 0xf7, 0xa9, 0xaf, 0xce, 0xd6, 0xc7, 0x06, - 0x0c, 0x76, 0x5e, 0x14, 0x40, 0xde, 0x91, 0x9f, 0xb1, 0xc9, 0x1d, 0x19, 0xf9, 0xbb, 0x98, 0xd4, - 0xd7, 0x70, 0xd1, 0x5b, 0x05, 0x05, 0xc3, 0x5a, 0x88, 0xf5, 0x77, 0x03, 0x72, 0x62, 0x9c, 0x8f, - 0x5e, 0x4d, 0x9c, 0x67, 0xa5, 0x28, 0x2d, 0xc8, 0xbe, 0x43, 0x7a, 0xd1, 0xe1, 0x5e, 0x49, 0x1d, - 0x6e, 0x5c, 0xfd, 0xde, 0xe5, 0x40, 0x79, 0xd6, 0x68, 0x15, 0x26, 0xc9, 0xee, 0x2e, 0x71, 0x98, - 0x2c, 0x3d, 0xaf, 0xaa, 0xfe, 0x69, 0x43, 0x40, 0x79, 0x81, 0x10, 0xc2, 0xa2, 0x47, 0x2c, 0x89, - 0xf9, 0xbd, 0x9c, 0x79, 0x6d, 0xb2, 0xe6, 0xba, 0xc4, 0x3d, 0x97, 0x99, 0xa7, 0xb8, 0x90, 0x6d, - 0x2b, 0x96, 0x38, 0xe6, 0xce, 0x2f, 0xb2, 0x2f, 0xf3, 0xe2, 0xe4, 0x6e, 0x06, 0x8e, 0xdd, 0x8a, - 0x1a, 0x56, 0x4c, 0x76, 0x49, 0x48, 0x7c, 0x47, 0x7c, 0x92, 0x63, 0x77, 0xbc, 0xbb, 0x61, 0xd0, - 0x55, 0x53, 0x4a, 0xb1, 0x6f, 0x6b, 0xf5, 0x9a, 0x80, 0x61, 0x8d, 0xe5, 0x0d, 0xcb, 0xbe, 0xe7, - 0xbb, 0x72, 0x37, 0x74, 0xc3, 0xf2, 0x8e, 0xe7, 0xbb, 0x58, 0x60, 0x74, 0xbb, 0x94, 0x1d, 0xd6, - 0x2e, 0x59, 0xb7, 0xa0, 0x98, 0xf8, 0x8a, 0x8e, 0x97, 0xee, 0x36, 0xff, 0x53, 0xb7, 0xd9, 0x5e, - 0x7f, 0xe9, 0xde, 0x52, 0x08, 0x1c, 0xd3, 0x54, 0xbe, 0xf5, 0xf8, 0xe9, 0xe2, 0xa5, 0x4f, 0x9e, - 0x2e, 0x5e, 0x7a, 0xf2, 0x74, 0xf1, 0xd2, 0x87, 0x47, 0x8b, 0xc6, 0xe3, 0xa3, 0x45, 0xe3, 0x93, - 0xa3, 0x45, 0xe3, 0xc9, 0xd1, 0xa2, 0xf1, 0xe9, 0xd1, 0xa2, 0xf1, 0xf3, 0xbf, 0x2e, 0x5e, 0xfa, - 0xe6, 0xea, 0x48, 0xdf, 0x9d, 0xfe, 0x37, 0x00, 0x00, 0xff, 0xff, 0x1e, 0xcc, 0xec, 0x45, 0xaf, - 0x2a, 0x00, 0x00, -} - -func (m *ClientIPConfig) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ClientIPConfig) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ClientIPConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.TimeoutSeconds != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.TimeoutSeconds)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Container) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Container) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Container) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.VolumeMounts) > 0 { - for iNdEx := len(m.VolumeMounts) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.VolumeMounts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4a - } - } - if len(m.Ports) > 0 { - for iNdEx := len(m.Ports) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Ports[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - } - i -= len(m.Image) - copy(dAtA[i:], m.Image) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Image))) - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ContainerPort) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ContainerPort) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ContainerPort) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.HostIP) - copy(dAtA[i:], m.HostIP) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.HostIP))) - i-- - dAtA[i] = 0x2a - i -= len(m.Protocol) - copy(dAtA[i:], m.Protocol) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Protocol))) - i-- - dAtA[i] = 0x22 - i = encodeVarintGenerated(dAtA, i, uint64(m.ContainerPort)) - i-- - dAtA[i] = 0x18 - i = encodeVarintGenerated(dAtA, i, uint64(m.HostPort)) - i-- - dAtA[i] = 0x10 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ContainerState) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ContainerState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ContainerState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Running != nil { - { - size, err := m.Running.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} - -func (m *ContainerStateRunning) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ContainerStateRunning) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ContainerStateRunning) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.StartedAt.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ContainerStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ContainerStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ContainerStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.ContainerID) - copy(dAtA[i:], m.ContainerID) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ContainerID))) - i-- - dAtA[i] = 0x42 - { - size, err := m.State.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - return len(dAtA) - i, nil -} - -func (m *EndpointAddress) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EndpointAddress) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EndpointAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.NodeName != nil { - i -= len(*m.NodeName) - copy(dAtA[i:], *m.NodeName) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.NodeName))) - i-- - dAtA[i] = 0x22 - } - i -= len(m.Hostname) - copy(dAtA[i:], m.Hostname) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Hostname))) - i-- - dAtA[i] = 0x1a - i -= len(m.IP) - copy(dAtA[i:], m.IP) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.IP))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EndpointPort) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EndpointPort) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EndpointPort) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Protocol) - copy(dAtA[i:], m.Protocol) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Protocol))) - i-- - dAtA[i] = 0x1a - i = encodeVarintGenerated(dAtA, i, uint64(m.Port)) - i-- - dAtA[i] = 0x10 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EndpointSubset) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EndpointSubset) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EndpointSubset) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Ports) > 0 { - for iNdEx := len(m.Ports) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Ports[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Addresses) > 0 { - for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Addresses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *Endpoints) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Endpoints) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Endpoints) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Subsets) > 0 { - for iNdEx := len(m.Subsets) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Subsets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EndpointsList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EndpointsList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EndpointsList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *LoadBalancerIngress) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LoadBalancerIngress) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LoadBalancerIngress) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Ports) > 0 { - for iNdEx := len(m.Ports) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Ports[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if m.IPMode != nil { - i -= len(*m.IPMode) - copy(dAtA[i:], *m.IPMode) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.IPMode))) - i-- - dAtA[i] = 0x1a - } - i -= len(m.Hostname) - copy(dAtA[i:], m.Hostname) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Hostname))) - i-- - dAtA[i] = 0x12 - i -= len(m.IP) - copy(dAtA[i:], m.IP) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.IP))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *LoadBalancerStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LoadBalancerStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LoadBalancerStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Ingress) > 0 { - for iNdEx := len(m.Ingress) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Ingress[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *Namespace) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Namespace) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Namespace) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NamespaceList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NamespaceList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NamespaceList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Node) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Node) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Node) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeAddress) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeAddress) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0x12 - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeCondition) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeCondition) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeCondition) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Reason) - copy(dAtA[i:], m.Reason) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Reason))) - i-- - dAtA[i] = 0x2a - i -= len(m.Status) - copy(dAtA[i:], m.Status) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Status))) - i-- - dAtA[i] = 0x12 - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.PodCIDRs) > 0 { - for iNdEx := len(m.PodCIDRs) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.PodCIDRs[iNdEx]) - copy(dAtA[i:], m.PodCIDRs[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.PodCIDRs[iNdEx]))) - i-- - dAtA[i] = 0x3a - } - } - if len(m.Taints) > 0 { - for iNdEx := len(m.Taints) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Taints[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - } - i -= len(m.ProviderID) - copy(dAtA[i:], m.ProviderID) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ProviderID))) - i-- - dAtA[i] = 0x1a - i -= len(m.PodCIDR) - copy(dAtA[i:], m.PodCIDR) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.PodCIDR))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Addresses) > 0 { - for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Addresses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - } - if len(m.Conditions) > 0 { - for iNdEx := len(m.Conditions) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Conditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - return len(dAtA) - i, nil -} - -func (m *Pod) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Pod) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Pod) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *PodCondition) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PodCondition) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PodCondition) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Message) - copy(dAtA[i:], m.Message) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Message))) - i-- - dAtA[i] = 0x32 - i -= len(m.Reason) - copy(dAtA[i:], m.Reason) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Reason))) - i-- - dAtA[i] = 0x2a - { - size, err := m.LastTransitionTime.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - { - size, err := m.LastProbeTime.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - i -= len(m.Status) - copy(dAtA[i:], m.Status) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Status))) - i-- - dAtA[i] = 0x12 - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *PodIP) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PodIP) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PodIP) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.IP) - copy(dAtA[i:], m.IP) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.IP))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *PodList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PodList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PodList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *PodReadinessGate) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PodReadinessGate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PodReadinessGate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.ConditionType) - copy(dAtA[i:], m.ConditionType) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ConditionType))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *PodSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PodSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PodSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.InitContainers) > 0 { - for iNdEx := len(m.InitContainers) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.InitContainers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xa2 - } - } - i-- - if m.HostNetwork { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x58 - i -= len(m.NodeName) - copy(dAtA[i:], m.NodeName) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.NodeName))) - i-- - dAtA[i] = 0x52 - i -= len(m.ServiceAccountName) - copy(dAtA[i:], m.ServiceAccountName) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ServiceAccountName))) - i-- - dAtA[i] = 0x42 - if len(m.Containers) > 0 { - for iNdEx := len(m.Containers) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Containers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - return len(dAtA) - i, nil -} - -func (m *PodStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PodStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PodStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.PodIPs) > 0 { - for iNdEx := len(m.PodIPs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.PodIPs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x62 - } - } - i -= len(m.QOSClass) - copy(dAtA[i:], m.QOSClass) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.QOSClass))) - i-- - dAtA[i] = 0x4a - if len(m.ContainerStatuses) > 0 { - for iNdEx := len(m.ContainerStatuses) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ContainerStatuses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x42 - } - } - if m.StartTime != nil { - { - size, err := m.StartTime.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - i -= len(m.PodIP) - copy(dAtA[i:], m.PodIP) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.PodIP))) - i-- - dAtA[i] = 0x32 - i -= len(m.HostIP) - copy(dAtA[i:], m.HostIP) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.HostIP))) - i-- - dAtA[i] = 0x2a - if len(m.Conditions) > 0 { - for iNdEx := len(m.Conditions) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Conditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - i -= len(m.Phase) - copy(dAtA[i:], m.Phase) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Phase))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *PortStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PortStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PortStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Error != nil { - i -= len(*m.Error) - copy(dAtA[i:], *m.Error) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Error))) - i-- - dAtA[i] = 0x1a - } - i -= len(m.Protocol) - copy(dAtA[i:], m.Protocol) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Protocol))) - i-- - dAtA[i] = 0x12 - i = encodeVarintGenerated(dAtA, i, uint64(m.Port)) - i-- - dAtA[i] = 0x8 - return len(dAtA) - i, nil -} - -func (m *Secret) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Secret) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Secret) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Immutable != nil { - i-- - if *m.Immutable { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - } - if len(m.StringData) > 0 { - keysForStringData := make([]string, 0, len(m.StringData)) - for k := range m.StringData { - keysForStringData = append(keysForStringData, string(k)) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForStringData) - for iNdEx := len(keysForStringData) - 1; iNdEx >= 0; iNdEx-- { - v := m.StringData[string(keysForStringData[iNdEx])] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarintGenerated(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(keysForStringData[iNdEx]) - copy(dAtA[i:], keysForStringData[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(keysForStringData[iNdEx]))) - i-- - dAtA[i] = 0xa - i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x22 - } - } - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0x1a - if len(m.Data) > 0 { - keysForData := make([]string, 0, len(m.Data)) - for k := range m.Data { - keysForData = append(keysForData, string(k)) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForData) - for iNdEx := len(keysForData) - 1; iNdEx >= 0; iNdEx-- { - v := m.Data[string(keysForData[iNdEx])] - baseI := i - if v != nil { - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarintGenerated(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - } - i -= len(keysForData[iNdEx]) - copy(dAtA[i:], keysForData[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(keysForData[iNdEx]))) - i-- - dAtA[i] = 0xa - i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *SecretList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SecretList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SecretList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Service) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Service) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Service) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ServiceList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ServiceList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ServiceList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ServicePort) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ServicePort) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ServicePort) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i = encodeVarintGenerated(dAtA, i, uint64(m.NodePort)) - i-- - dAtA[i] = 0x28 - i = encodeVarintGenerated(dAtA, i, uint64(m.Port)) - i-- - dAtA[i] = 0x18 - i -= len(m.Protocol) - copy(dAtA[i:], m.Protocol) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Protocol))) - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ServiceSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ServiceSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ServiceSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.InternalTrafficPolicy != nil { - i -= len(*m.InternalTrafficPolicy) - copy(dAtA[i:], *m.InternalTrafficPolicy) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.InternalTrafficPolicy))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xb2 - } - if m.LoadBalancerClass != nil { - i -= len(*m.LoadBalancerClass) - copy(dAtA[i:], *m.LoadBalancerClass) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.LoadBalancerClass))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xaa - } - if len(m.IPFamilies) > 0 { - for iNdEx := len(m.IPFamilies) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.IPFamilies[iNdEx]) - copy(dAtA[i:], m.IPFamilies[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.IPFamilies[iNdEx]))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x9a - } - } - if len(m.ClusterIPs) > 0 { - for iNdEx := len(m.ClusterIPs) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ClusterIPs[iNdEx]) - copy(dAtA[i:], m.ClusterIPs[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ClusterIPs[iNdEx]))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x92 - } - } - if m.IPFamilyPolicy != nil { - i -= len(*m.IPFamilyPolicy) - copy(dAtA[i:], *m.IPFamilyPolicy) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.IPFamilyPolicy))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x8a - } - if m.SessionAffinityConfig != nil { - { - size, err := m.SessionAffinityConfig.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x72 - } - i = encodeVarintGenerated(dAtA, i, uint64(m.HealthCheckNodePort)) - i-- - dAtA[i] = 0x60 - i -= len(m.ExternalTrafficPolicy) - copy(dAtA[i:], m.ExternalTrafficPolicy) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ExternalTrafficPolicy))) - i-- - dAtA[i] = 0x5a - if len(m.LoadBalancerSourceRanges) > 0 { - for iNdEx := len(m.LoadBalancerSourceRanges) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.LoadBalancerSourceRanges[iNdEx]) - copy(dAtA[i:], m.LoadBalancerSourceRanges[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.LoadBalancerSourceRanges[iNdEx]))) - i-- - dAtA[i] = 0x4a - } - } - i -= len(m.LoadBalancerIP) - copy(dAtA[i:], m.LoadBalancerIP) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.LoadBalancerIP))) - i-- - dAtA[i] = 0x42 - i -= len(m.SessionAffinity) - copy(dAtA[i:], m.SessionAffinity) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.SessionAffinity))) - i-- - dAtA[i] = 0x3a - if len(m.ExternalIPs) > 0 { - for iNdEx := len(m.ExternalIPs) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ExternalIPs[iNdEx]) - copy(dAtA[i:], m.ExternalIPs[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ExternalIPs[iNdEx]))) - i-- - dAtA[i] = 0x2a - } - } - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0x22 - i -= len(m.ClusterIP) - copy(dAtA[i:], m.ClusterIP) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ClusterIP))) - i-- - dAtA[i] = 0x1a - if len(m.Selector) > 0 { - keysForSelector := make([]string, 0, len(m.Selector)) - for k := range m.Selector { - keysForSelector = append(keysForSelector, string(k)) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForSelector) - for iNdEx := len(keysForSelector) - 1; iNdEx >= 0; iNdEx-- { - v := m.Selector[string(keysForSelector[iNdEx])] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarintGenerated(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(keysForSelector[iNdEx]) - copy(dAtA[i:], keysForSelector[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(keysForSelector[iNdEx]))) - i-- - dAtA[i] = 0xa - i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x12 - } - } - if len(m.Ports) > 0 { - for iNdEx := len(m.Ports) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Ports[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *ServiceStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ServiceStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ServiceStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Conditions) > 0 { - for iNdEx := len(m.Conditions) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Conditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.LoadBalancer.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *SessionAffinityConfig) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SessionAffinityConfig) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SessionAffinityConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ClientIP != nil { - { - size, err := m.ClientIP.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Taint) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Taint) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Taint) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.TimeAdded != nil { - { - size, err := m.TimeAdded.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - i -= len(m.Effect) - copy(dAtA[i:], m.Effect) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Effect))) - i-- - dAtA[i] = 0x1a - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *TypedLocalObjectReference) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *TypedLocalObjectReference) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TypedLocalObjectReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x1a - i -= len(m.Kind) - copy(dAtA[i:], m.Kind) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Kind))) - i-- - dAtA[i] = 0x12 - if m.APIGroup != nil { - i -= len(*m.APIGroup) - copy(dAtA[i:], *m.APIGroup) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.APIGroup))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *VolumeMount) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VolumeMount) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VolumeMount) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.MountPath) - copy(dAtA[i:], m.MountPath) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.MountPath))) - i-- - dAtA[i] = 0x1a - return len(dAtA) - i, nil -} - -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ClientIPConfig) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.TimeoutSeconds != nil { - n += 1 + sovGenerated(uint64(*m.TimeoutSeconds)) - } - return n -} - -func (m *Container) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Image) - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Ports) > 0 { - for _, e := range m.Ports { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - if len(m.VolumeMounts) > 0 { - for _, e := range m.VolumeMounts { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *ContainerPort) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - n += 1 + sovGenerated(uint64(m.HostPort)) - n += 1 + sovGenerated(uint64(m.ContainerPort)) - l = len(m.Protocol) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.HostIP) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ContainerState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Running != nil { - l = m.Running.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *ContainerStateRunning) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.StartedAt.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ContainerStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.State.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.ContainerID) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *EndpointAddress) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.IP) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Hostname) - n += 1 + l + sovGenerated(uint64(l)) - if m.NodeName != nil { - l = len(*m.NodeName) - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *EndpointPort) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - n += 1 + sovGenerated(uint64(m.Port)) - l = len(m.Protocol) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *EndpointSubset) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Addresses) > 0 { - for _, e := range m.Addresses { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - if len(m.Ports) > 0 { - for _, e := range m.Ports { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *Endpoints) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Subsets) > 0 { - for _, e := range m.Subsets { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *EndpointsList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *LoadBalancerIngress) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.IP) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Hostname) - n += 1 + l + sovGenerated(uint64(l)) - if m.IPMode != nil { - l = len(*m.IPMode) - n += 1 + l + sovGenerated(uint64(l)) - } - if len(m.Ports) > 0 { - for _, e := range m.Ports { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *LoadBalancerStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Ingress) > 0 { - for _, e := range m.Ingress { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *Namespace) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *NamespaceList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *Node) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *NodeAddress) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Type) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Address) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *NodeCondition) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Type) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Status) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Reason) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *NodeList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *NodeSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.PodCIDR) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.ProviderID) - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Taints) > 0 { - for _, e := range m.Taints { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - if len(m.PodCIDRs) > 0 { - for _, s := range m.PodCIDRs { - l = len(s) - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *NodeStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Conditions) > 0 { - for _, e := range m.Conditions { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - if len(m.Addresses) > 0 { - for _, e := range m.Addresses { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *Pod) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *PodCondition) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Type) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Status) - n += 1 + l + sovGenerated(uint64(l)) - l = m.LastProbeTime.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.LastTransitionTime.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Reason) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Message) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *PodIP) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.IP) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *PodList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *PodReadinessGate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ConditionType) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *PodSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Containers) > 0 { - for _, e := range m.Containers { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - l = len(m.ServiceAccountName) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.NodeName) - n += 1 + l + sovGenerated(uint64(l)) - n += 2 - if len(m.InitContainers) > 0 { - for _, e := range m.InitContainers { - l = e.Size() - n += 2 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *PodStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Phase) - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Conditions) > 0 { - for _, e := range m.Conditions { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - l = len(m.HostIP) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.PodIP) - n += 1 + l + sovGenerated(uint64(l)) - if m.StartTime != nil { - l = m.StartTime.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if len(m.ContainerStatuses) > 0 { - for _, e := range m.ContainerStatuses { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - l = len(m.QOSClass) - n += 1 + l + sovGenerated(uint64(l)) - if len(m.PodIPs) > 0 { - for _, e := range m.PodIPs { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *PortStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovGenerated(uint64(m.Port)) - l = len(m.Protocol) - n += 1 + l + sovGenerated(uint64(l)) - if m.Error != nil { - l = len(*m.Error) - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *Secret) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Data) > 0 { - for k, v := range m.Data { - _ = k - _ = v - l = 0 - if v != nil { - l = 1 + len(v) + sovGenerated(uint64(len(v))) - } - mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + l - n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) - } - } - l = len(m.Type) - n += 1 + l + sovGenerated(uint64(l)) - if len(m.StringData) > 0 { - for k, v := range m.StringData { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v))) - n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) - } - } - if m.Immutable != nil { - n += 2 - } - return n -} - -func (m *SecretList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *Service) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ServiceList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *ServicePort) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Protocol) - n += 1 + l + sovGenerated(uint64(l)) - n += 1 + sovGenerated(uint64(m.Port)) - n += 1 + sovGenerated(uint64(m.NodePort)) - return n -} - -func (m *ServiceSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Ports) > 0 { - for _, e := range m.Ports { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - if len(m.Selector) > 0 { - for k, v := range m.Selector { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v))) - n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) - } - } - l = len(m.ClusterIP) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Type) - n += 1 + l + sovGenerated(uint64(l)) - if len(m.ExternalIPs) > 0 { - for _, s := range m.ExternalIPs { - l = len(s) - n += 1 + l + sovGenerated(uint64(l)) - } - } - l = len(m.SessionAffinity) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.LoadBalancerIP) - n += 1 + l + sovGenerated(uint64(l)) - if len(m.LoadBalancerSourceRanges) > 0 { - for _, s := range m.LoadBalancerSourceRanges { - l = len(s) - n += 1 + l + sovGenerated(uint64(l)) - } - } - l = len(m.ExternalTrafficPolicy) - n += 1 + l + sovGenerated(uint64(l)) - n += 1 + sovGenerated(uint64(m.HealthCheckNodePort)) - if m.SessionAffinityConfig != nil { - l = m.SessionAffinityConfig.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.IPFamilyPolicy != nil { - l = len(*m.IPFamilyPolicy) - n += 2 + l + sovGenerated(uint64(l)) - } - if len(m.ClusterIPs) > 0 { - for _, s := range m.ClusterIPs { - l = len(s) - n += 2 + l + sovGenerated(uint64(l)) - } - } - if len(m.IPFamilies) > 0 { - for _, s := range m.IPFamilies { - l = len(s) - n += 2 + l + sovGenerated(uint64(l)) - } - } - if m.LoadBalancerClass != nil { - l = len(*m.LoadBalancerClass) - n += 2 + l + sovGenerated(uint64(l)) - } - if m.InternalTrafficPolicy != nil { - l = len(*m.InternalTrafficPolicy) - n += 2 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *ServiceStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.LoadBalancer.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Conditions) > 0 { - for _, e := range m.Conditions { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *SessionAffinityConfig) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ClientIP != nil { - l = m.ClientIP.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *Taint) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Value) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Effect) - n += 1 + l + sovGenerated(uint64(l)) - if m.TimeAdded != nil { - l = m.TimeAdded.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *TypedLocalObjectReference) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.APIGroup != nil { - l = len(*m.APIGroup) - n += 1 + l + sovGenerated(uint64(l)) - } - l = len(m.Kind) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *VolumeMount) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.MountPath) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *ClientIPConfig) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ClientIPConfig{`, - `TimeoutSeconds:` + valueToStringGenerated(this.TimeoutSeconds) + `,`, - `}`, - }, "") - return s -} -func (this *Container) String() string { - if this == nil { - return "nil" - } - repeatedStringForPorts := "[]ContainerPort{" - for _, f := range this.Ports { - repeatedStringForPorts += strings.Replace(strings.Replace(f.String(), "ContainerPort", "ContainerPort", 1), `&`, ``, 1) + "," - } - repeatedStringForPorts += "}" - repeatedStringForVolumeMounts := "[]VolumeMount{" - for _, f := range this.VolumeMounts { - repeatedStringForVolumeMounts += strings.Replace(strings.Replace(f.String(), "VolumeMount", "VolumeMount", 1), `&`, ``, 1) + "," - } - repeatedStringForVolumeMounts += "}" - s := strings.Join([]string{`&Container{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Image:` + fmt.Sprintf("%v", this.Image) + `,`, - `Ports:` + repeatedStringForPorts + `,`, - `VolumeMounts:` + repeatedStringForVolumeMounts + `,`, - `}`, - }, "") - return s -} -func (this *ContainerPort) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ContainerPort{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `HostPort:` + fmt.Sprintf("%v", this.HostPort) + `,`, - `ContainerPort:` + fmt.Sprintf("%v", this.ContainerPort) + `,`, - `Protocol:` + fmt.Sprintf("%v", this.Protocol) + `,`, - `HostIP:` + fmt.Sprintf("%v", this.HostIP) + `,`, - `}`, - }, "") - return s -} -func (this *ContainerState) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ContainerState{`, - `Running:` + strings.Replace(this.Running.String(), "ContainerStateRunning", "ContainerStateRunning", 1) + `,`, - `}`, - }, "") - return s -} -func (this *ContainerStateRunning) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ContainerStateRunning{`, - `StartedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.StartedAt), "Time", "v1.Time", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ContainerStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ContainerStatus{`, - `State:` + strings.Replace(strings.Replace(this.State.String(), "ContainerState", "ContainerState", 1), `&`, ``, 1) + `,`, - `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, - `}`, - }, "") - return s -} -func (this *EndpointAddress) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EndpointAddress{`, - `IP:` + fmt.Sprintf("%v", this.IP) + `,`, - `Hostname:` + fmt.Sprintf("%v", this.Hostname) + `,`, - `NodeName:` + valueToStringGenerated(this.NodeName) + `,`, - `}`, - }, "") - return s -} -func (this *EndpointPort) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EndpointPort{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Port:` + fmt.Sprintf("%v", this.Port) + `,`, - `Protocol:` + fmt.Sprintf("%v", this.Protocol) + `,`, - `}`, - }, "") - return s -} -func (this *EndpointSubset) String() string { - if this == nil { - return "nil" - } - repeatedStringForAddresses := "[]EndpointAddress{" - for _, f := range this.Addresses { - repeatedStringForAddresses += strings.Replace(strings.Replace(f.String(), "EndpointAddress", "EndpointAddress", 1), `&`, ``, 1) + "," - } - repeatedStringForAddresses += "}" - repeatedStringForPorts := "[]EndpointPort{" - for _, f := range this.Ports { - repeatedStringForPorts += strings.Replace(strings.Replace(f.String(), "EndpointPort", "EndpointPort", 1), `&`, ``, 1) + "," - } - repeatedStringForPorts += "}" - s := strings.Join([]string{`&EndpointSubset{`, - `Addresses:` + repeatedStringForAddresses + `,`, - `Ports:` + repeatedStringForPorts + `,`, - `}`, - }, "") - return s -} -func (this *Endpoints) String() string { - if this == nil { - return "nil" - } - repeatedStringForSubsets := "[]EndpointSubset{" - for _, f := range this.Subsets { - repeatedStringForSubsets += strings.Replace(strings.Replace(f.String(), "EndpointSubset", "EndpointSubset", 1), `&`, ``, 1) + "," - } - repeatedStringForSubsets += "}" - s := strings.Join([]string{`&Endpoints{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Subsets:` + repeatedStringForSubsets + `,`, - `}`, - }, "") - return s -} -func (this *EndpointsList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]Endpoints{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Endpoints", "Endpoints", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&EndpointsList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *LoadBalancerIngress) String() string { - if this == nil { - return "nil" - } - repeatedStringForPorts := "[]PortStatus{" - for _, f := range this.Ports { - repeatedStringForPorts += strings.Replace(strings.Replace(f.String(), "PortStatus", "PortStatus", 1), `&`, ``, 1) + "," - } - repeatedStringForPorts += "}" - s := strings.Join([]string{`&LoadBalancerIngress{`, - `IP:` + fmt.Sprintf("%v", this.IP) + `,`, - `Hostname:` + fmt.Sprintf("%v", this.Hostname) + `,`, - `IPMode:` + valueToStringGenerated(this.IPMode) + `,`, - `Ports:` + repeatedStringForPorts + `,`, - `}`, - }, "") - return s -} -func (this *LoadBalancerStatus) String() string { - if this == nil { - return "nil" - } - repeatedStringForIngress := "[]LoadBalancerIngress{" - for _, f := range this.Ingress { - repeatedStringForIngress += strings.Replace(strings.Replace(f.String(), "LoadBalancerIngress", "LoadBalancerIngress", 1), `&`, ``, 1) + "," - } - repeatedStringForIngress += "}" - s := strings.Join([]string{`&LoadBalancerStatus{`, - `Ingress:` + repeatedStringForIngress + `,`, - `}`, - }, "") - return s -} -func (this *Namespace) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Namespace{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *NamespaceList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]Namespace{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Namespace", "Namespace", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&NamespaceList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *Node) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Node{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "NodeSpec", "NodeSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "NodeStatus", "NodeStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *NodeAddress) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NodeAddress{`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `Address:` + fmt.Sprintf("%v", this.Address) + `,`, - `}`, - }, "") - return s -} -func (this *NodeCondition) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NodeCondition{`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `Status:` + fmt.Sprintf("%v", this.Status) + `,`, - `Reason:` + fmt.Sprintf("%v", this.Reason) + `,`, - `}`, - }, "") - return s -} -func (this *NodeList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]Node{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Node", "Node", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&NodeList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *NodeSpec) String() string { - if this == nil { - return "nil" - } - repeatedStringForTaints := "[]Taint{" - for _, f := range this.Taints { - repeatedStringForTaints += strings.Replace(strings.Replace(f.String(), "Taint", "Taint", 1), `&`, ``, 1) + "," - } - repeatedStringForTaints += "}" - s := strings.Join([]string{`&NodeSpec{`, - `PodCIDR:` + fmt.Sprintf("%v", this.PodCIDR) + `,`, - `ProviderID:` + fmt.Sprintf("%v", this.ProviderID) + `,`, - `Taints:` + repeatedStringForTaints + `,`, - `PodCIDRs:` + fmt.Sprintf("%v", this.PodCIDRs) + `,`, - `}`, - }, "") - return s -} -func (this *NodeStatus) String() string { - if this == nil { - return "nil" - } - repeatedStringForConditions := "[]NodeCondition{" - for _, f := range this.Conditions { - repeatedStringForConditions += strings.Replace(strings.Replace(f.String(), "NodeCondition", "NodeCondition", 1), `&`, ``, 1) + "," - } - repeatedStringForConditions += "}" - repeatedStringForAddresses := "[]NodeAddress{" - for _, f := range this.Addresses { - repeatedStringForAddresses += strings.Replace(strings.Replace(f.String(), "NodeAddress", "NodeAddress", 1), `&`, ``, 1) + "," - } - repeatedStringForAddresses += "}" - s := strings.Join([]string{`&NodeStatus{`, - `Conditions:` + repeatedStringForConditions + `,`, - `Addresses:` + repeatedStringForAddresses + `,`, - `}`, - }, "") - return s -} -func (this *Pod) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Pod{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "PodSpec", "PodSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "PodStatus", "PodStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *PodCondition) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&PodCondition{`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `Status:` + fmt.Sprintf("%v", this.Status) + `,`, - `LastProbeTime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.LastProbeTime), "Time", "v1.Time", 1), `&`, ``, 1) + `,`, - `LastTransitionTime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.LastTransitionTime), "Time", "v1.Time", 1), `&`, ``, 1) + `,`, - `Reason:` + fmt.Sprintf("%v", this.Reason) + `,`, - `Message:` + fmt.Sprintf("%v", this.Message) + `,`, - `}`, - }, "") - return s -} -func (this *PodIP) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&PodIP{`, - `IP:` + fmt.Sprintf("%v", this.IP) + `,`, - `}`, - }, "") - return s -} -func (this *PodList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]Pod{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Pod", "Pod", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&PodList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *PodReadinessGate) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&PodReadinessGate{`, - `ConditionType:` + fmt.Sprintf("%v", this.ConditionType) + `,`, - `}`, - }, "") - return s -} -func (this *PodSpec) String() string { - if this == nil { - return "nil" - } - repeatedStringForContainers := "[]Container{" - for _, f := range this.Containers { - repeatedStringForContainers += strings.Replace(strings.Replace(f.String(), "Container", "Container", 1), `&`, ``, 1) + "," - } - repeatedStringForContainers += "}" - repeatedStringForInitContainers := "[]Container{" - for _, f := range this.InitContainers { - repeatedStringForInitContainers += strings.Replace(strings.Replace(f.String(), "Container", "Container", 1), `&`, ``, 1) + "," - } - repeatedStringForInitContainers += "}" - s := strings.Join([]string{`&PodSpec{`, - `Containers:` + repeatedStringForContainers + `,`, - `ServiceAccountName:` + fmt.Sprintf("%v", this.ServiceAccountName) + `,`, - `NodeName:` + fmt.Sprintf("%v", this.NodeName) + `,`, - `HostNetwork:` + fmt.Sprintf("%v", this.HostNetwork) + `,`, - `InitContainers:` + repeatedStringForInitContainers + `,`, - `}`, - }, "") - return s -} -func (this *PodStatus) String() string { - if this == nil { - return "nil" - } - repeatedStringForConditions := "[]PodCondition{" - for _, f := range this.Conditions { - repeatedStringForConditions += strings.Replace(strings.Replace(f.String(), "PodCondition", "PodCondition", 1), `&`, ``, 1) + "," - } - repeatedStringForConditions += "}" - repeatedStringForContainerStatuses := "[]ContainerStatus{" - for _, f := range this.ContainerStatuses { - repeatedStringForContainerStatuses += strings.Replace(strings.Replace(f.String(), "ContainerStatus", "ContainerStatus", 1), `&`, ``, 1) + "," - } - repeatedStringForContainerStatuses += "}" - repeatedStringForPodIPs := "[]PodIP{" - for _, f := range this.PodIPs { - repeatedStringForPodIPs += strings.Replace(strings.Replace(f.String(), "PodIP", "PodIP", 1), `&`, ``, 1) + "," - } - repeatedStringForPodIPs += "}" - s := strings.Join([]string{`&PodStatus{`, - `Phase:` + fmt.Sprintf("%v", this.Phase) + `,`, - `Conditions:` + repeatedStringForConditions + `,`, - `HostIP:` + fmt.Sprintf("%v", this.HostIP) + `,`, - `PodIP:` + fmt.Sprintf("%v", this.PodIP) + `,`, - `StartTime:` + strings.Replace(fmt.Sprintf("%v", this.StartTime), "Time", "v1.Time", 1) + `,`, - `ContainerStatuses:` + repeatedStringForContainerStatuses + `,`, - `QOSClass:` + fmt.Sprintf("%v", this.QOSClass) + `,`, - `PodIPs:` + repeatedStringForPodIPs + `,`, - `}`, - }, "") - return s -} -func (this *PortStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&PortStatus{`, - `Port:` + fmt.Sprintf("%v", this.Port) + `,`, - `Protocol:` + fmt.Sprintf("%v", this.Protocol) + `,`, - `Error:` + valueToStringGenerated(this.Error) + `,`, - `}`, - }, "") - return s -} -func (this *Secret) String() string { - if this == nil { - return "nil" - } - keysForData := make([]string, 0, len(this.Data)) - for k := range this.Data { - keysForData = append(keysForData, k) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForData) - mapStringForData := "map[string]Bytes{" - for _, k := range keysForData { - mapStringForData += fmt.Sprintf("%v: %v,", k, this.Data[k]) - } - mapStringForData += "}" - keysForStringData := make([]string, 0, len(this.StringData)) - for k := range this.StringData { - keysForStringData = append(keysForStringData, k) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForStringData) - mapStringForStringData := "map[string]string{" - for _, k := range keysForStringData { - mapStringForStringData += fmt.Sprintf("%v: %v,", k, this.StringData[k]) - } - mapStringForStringData += "}" - s := strings.Join([]string{`&Secret{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Data:` + mapStringForData + `,`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `StringData:` + mapStringForStringData + `,`, - `Immutable:` + valueToStringGenerated(this.Immutable) + `,`, - `}`, - }, "") - return s -} -func (this *SecretList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]Secret{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Secret", "Secret", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&SecretList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *Service) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Service{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ServiceSpec", "ServiceSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "ServiceStatus", "ServiceStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ServiceList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]Service{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Service", "Service", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&ServiceList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *ServicePort) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ServicePort{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Protocol:` + fmt.Sprintf("%v", this.Protocol) + `,`, - `Port:` + fmt.Sprintf("%v", this.Port) + `,`, - `NodePort:` + fmt.Sprintf("%v", this.NodePort) + `,`, - `}`, - }, "") - return s -} -func (this *ServiceSpec) String() string { - if this == nil { - return "nil" - } - repeatedStringForPorts := "[]ServicePort{" - for _, f := range this.Ports { - repeatedStringForPorts += strings.Replace(strings.Replace(f.String(), "ServicePort", "ServicePort", 1), `&`, ``, 1) + "," - } - repeatedStringForPorts += "}" - keysForSelector := make([]string, 0, len(this.Selector)) - for k := range this.Selector { - keysForSelector = append(keysForSelector, k) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForSelector) - mapStringForSelector := "map[string]string{" - for _, k := range keysForSelector { - mapStringForSelector += fmt.Sprintf("%v: %v,", k, this.Selector[k]) - } - mapStringForSelector += "}" - s := strings.Join([]string{`&ServiceSpec{`, - `Ports:` + repeatedStringForPorts + `,`, - `Selector:` + mapStringForSelector + `,`, - `ClusterIP:` + fmt.Sprintf("%v", this.ClusterIP) + `,`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `ExternalIPs:` + fmt.Sprintf("%v", this.ExternalIPs) + `,`, - `SessionAffinity:` + fmt.Sprintf("%v", this.SessionAffinity) + `,`, - `LoadBalancerIP:` + fmt.Sprintf("%v", this.LoadBalancerIP) + `,`, - `LoadBalancerSourceRanges:` + fmt.Sprintf("%v", this.LoadBalancerSourceRanges) + `,`, - `ExternalTrafficPolicy:` + fmt.Sprintf("%v", this.ExternalTrafficPolicy) + `,`, - `HealthCheckNodePort:` + fmt.Sprintf("%v", this.HealthCheckNodePort) + `,`, - `SessionAffinityConfig:` + strings.Replace(this.SessionAffinityConfig.String(), "SessionAffinityConfig", "SessionAffinityConfig", 1) + `,`, - `IPFamilyPolicy:` + valueToStringGenerated(this.IPFamilyPolicy) + `,`, - `ClusterIPs:` + fmt.Sprintf("%v", this.ClusterIPs) + `,`, - `IPFamilies:` + fmt.Sprintf("%v", this.IPFamilies) + `,`, - `LoadBalancerClass:` + valueToStringGenerated(this.LoadBalancerClass) + `,`, - `InternalTrafficPolicy:` + valueToStringGenerated(this.InternalTrafficPolicy) + `,`, - `}`, - }, "") - return s -} -func (this *ServiceStatus) String() string { - if this == nil { - return "nil" - } - repeatedStringForConditions := "[]Condition{" - for _, f := range this.Conditions { - repeatedStringForConditions += fmt.Sprintf("%v", f) + "," - } - repeatedStringForConditions += "}" - s := strings.Join([]string{`&ServiceStatus{`, - `LoadBalancer:` + strings.Replace(strings.Replace(this.LoadBalancer.String(), "LoadBalancerStatus", "LoadBalancerStatus", 1), `&`, ``, 1) + `,`, - `Conditions:` + repeatedStringForConditions + `,`, - `}`, - }, "") - return s -} -func (this *SessionAffinityConfig) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&SessionAffinityConfig{`, - `ClientIP:` + strings.Replace(this.ClientIP.String(), "ClientIPConfig", "ClientIPConfig", 1) + `,`, - `}`, - }, "") - return s -} -func (this *Taint) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Taint{`, - `Key:` + fmt.Sprintf("%v", this.Key) + `,`, - `Value:` + fmt.Sprintf("%v", this.Value) + `,`, - `Effect:` + fmt.Sprintf("%v", this.Effect) + `,`, - `TimeAdded:` + strings.Replace(fmt.Sprintf("%v", this.TimeAdded), "Time", "v1.Time", 1) + `,`, - `}`, - }, "") - return s -} -func (this *TypedLocalObjectReference) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&TypedLocalObjectReference{`, - `APIGroup:` + valueToStringGenerated(this.APIGroup) + `,`, - `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `}`, - }, "") - return s -} -func (this *VolumeMount) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&VolumeMount{`, - `MountPath:` + fmt.Sprintf("%v", this.MountPath) + `,`, - `}`, - }, "") - return s -} -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *ClientIPConfig) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ClientIPConfig: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ClientIPConfig: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeoutSeconds", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.TimeoutSeconds = &v - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Container) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Container: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Container: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Image", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Image = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ports", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Ports = append(m.Ports, ContainerPort{}) - if err := m.Ports[len(m.Ports)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VolumeMounts", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.VolumeMounts = append(m.VolumeMounts, VolumeMount{}) - if err := m.VolumeMounts[len(m.VolumeMounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ContainerPort) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ContainerPort: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ContainerPort: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field HostPort", wireType) - } - m.HostPort = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.HostPort |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ContainerPort", wireType) - } - m.ContainerPort = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ContainerPort |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Protocol", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Protocol = Protocol(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field HostIP", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.HostIP = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ContainerState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ContainerState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ContainerState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Running", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Running == nil { - m.Running = &ContainerStateRunning{} - } - if err := m.Running.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ContainerStateRunning) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ContainerStateRunning: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ContainerStateRunning: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StartedAt", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.StartedAt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ContainerStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ContainerStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ContainerStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.State.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ContainerID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EndpointAddress) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EndpointAddress: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EndpointAddress: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IP", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IP = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hostname", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Hostname = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.NodeName = &s - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EndpointPort) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EndpointPort: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EndpointPort: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Port", wireType) - } - m.Port = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Port |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Protocol", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Protocol = Protocol(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EndpointSubset) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EndpointSubset: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EndpointSubset: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addresses = append(m.Addresses, EndpointAddress{}) - if err := m.Addresses[len(m.Addresses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ports", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Ports = append(m.Ports, EndpointPort{}) - if err := m.Ports[len(m.Ports)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Endpoints) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Endpoints: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Endpoints: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Subsets", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Subsets = append(m.Subsets, EndpointSubset{}) - if err := m.Subsets[len(m.Subsets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EndpointsList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EndpointsList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EndpointsList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, Endpoints{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LoadBalancerIngress) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LoadBalancerIngress: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LoadBalancerIngress: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IP", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IP = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hostname", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Hostname = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IPMode", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := LoadBalancerIPMode(dAtA[iNdEx:postIndex]) - m.IPMode = &s - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ports", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Ports = append(m.Ports, PortStatus{}) - if err := m.Ports[len(m.Ports)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LoadBalancerStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LoadBalancerStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LoadBalancerStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ingress", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Ingress = append(m.Ingress, LoadBalancerIngress{}) - if err := m.Ingress[len(m.Ingress)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Namespace) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Namespace: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Namespace: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NamespaceList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NamespaceList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NamespaceList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, Namespace{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Node) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Node: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Node: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeAddress) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeAddress: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeAddress: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = NodeAddressType(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeCondition) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeCondition: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeCondition: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = NodeConditionType(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Status = ConditionStatus(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Reason", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Reason = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, Node{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PodCIDR", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PodCIDR = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProviderID", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ProviderID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Taints", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Taints = append(m.Taints, Taint{}) - if err := m.Taints[len(m.Taints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PodCIDRs", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PodCIDRs = append(m.PodCIDRs, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Conditions = append(m.Conditions, NodeCondition{}) - if err := m.Conditions[len(m.Conditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addresses = append(m.Addresses, NodeAddress{}) - if err := m.Addresses[len(m.Addresses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Pod) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Pod: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Pod: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PodCondition) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PodCondition: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PodCondition: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = PodConditionType(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Status = ConditionStatus(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastProbeTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.LastProbeTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastTransitionTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.LastTransitionTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Reason", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Reason = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Message = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PodIP) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PodIP: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PodIP: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IP", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IP = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PodList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PodList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PodList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, Pod{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PodReadinessGate) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PodReadinessGate: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PodReadinessGate: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ConditionType = PodConditionType(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PodSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PodSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PodSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Containers", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Containers = append(m.Containers, Container{}) - if err := m.Containers[len(m.Containers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceAccountName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServiceAccountName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NodeName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 11: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field HostNetwork", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.HostNetwork = bool(v != 0) - case 20: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InitContainers", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.InitContainers = append(m.InitContainers, Container{}) - if err := m.InitContainers[len(m.InitContainers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PodStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PodStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PodStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Phase", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Phase = PodPhase(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Conditions = append(m.Conditions, PodCondition{}) - if err := m.Conditions[len(m.Conditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field HostIP", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.HostIP = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PodIP", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PodIP = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.StartTime == nil { - m.StartTime = &v1.Time{} - } - if err := m.StartTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContainerStatuses", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ContainerStatuses = append(m.ContainerStatuses, ContainerStatus{}) - if err := m.ContainerStatuses[len(m.ContainerStatuses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field QOSClass", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.QOSClass = PodQOSClass(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PodIPs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PodIPs = append(m.PodIPs, PodIP{}) - if err := m.PodIPs[len(m.PodIPs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PortStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PortStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PortStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Port", wireType) - } - m.Port = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Port |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Protocol", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Protocol = Protocol(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Error = &s - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Secret) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Secret: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Secret: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Data == nil { - m.Data = make(map[string]Bytes) - } - var mapkey string - mapvalue := []byte{} - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapbyteLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapbyteLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intMapbyteLen := int(mapbyteLen) - if intMapbyteLen < 0 { - return ErrInvalidLengthGenerated - } - postbytesIndex := iNdEx + intMapbyteLen - if postbytesIndex < 0 { - return ErrInvalidLengthGenerated - } - if postbytesIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = make([]byte, mapbyteLen) - copy(mapvalue, dAtA[iNdEx:postbytesIndex]) - iNdEx = postbytesIndex - } else { - iNdEx = entryPreIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Data[mapkey] = ((Bytes)(mapvalue)) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = SecretType(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StringData", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.StringData == nil { - m.StringData = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.StringData[mapkey] = mapvalue - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Immutable", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.Immutable = &b - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SecretList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SecretList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SecretList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, Secret{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Service) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Service: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Service: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ServiceList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ServiceList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ServiceList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, Service{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ServicePort) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ServicePort: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ServicePort: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Protocol", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Protocol = Protocol(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Port", wireType) - } - m.Port = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Port |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NodePort", wireType) - } - m.NodePort = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NodePort |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ServiceSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ServiceSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ServiceSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ports", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Ports = append(m.Ports, ServicePort{}) - if err := m.Ports[len(m.Ports)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Selector == nil { - m.Selector = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Selector[mapkey] = mapvalue - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClusterIP", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClusterIP = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = ServiceType(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExternalIPs", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ExternalIPs = append(m.ExternalIPs, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SessionAffinity", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SessionAffinity = ServiceAffinity(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LoadBalancerIP", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LoadBalancerIP = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LoadBalancerSourceRanges", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LoadBalancerSourceRanges = append(m.LoadBalancerSourceRanges, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExternalTrafficPolicy", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ExternalTrafficPolicy = ServiceExternalTrafficPolicy(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 12: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field HealthCheckNodePort", wireType) - } - m.HealthCheckNodePort = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.HealthCheckNodePort |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 14: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SessionAffinityConfig", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.SessionAffinityConfig == nil { - m.SessionAffinityConfig = &SessionAffinityConfig{} - } - if err := m.SessionAffinityConfig.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 17: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IPFamilyPolicy", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := IPFamilyPolicy(dAtA[iNdEx:postIndex]) - m.IPFamilyPolicy = &s - iNdEx = postIndex - case 18: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClusterIPs", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClusterIPs = append(m.ClusterIPs, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 19: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IPFamilies", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IPFamilies = append(m.IPFamilies, IPFamily(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 21: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LoadBalancerClass", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.LoadBalancerClass = &s - iNdEx = postIndex - case 22: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InternalTrafficPolicy", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := ServiceInternalTrafficPolicy(dAtA[iNdEx:postIndex]) - m.InternalTrafficPolicy = &s - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ServiceStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ServiceStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ServiceStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LoadBalancer", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.LoadBalancer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Conditions = append(m.Conditions, v1.Condition{}) - if err := m.Conditions[len(m.Conditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SessionAffinityConfig) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SessionAffinityConfig: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SessionAffinityConfig: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClientIP", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ClientIP == nil { - m.ClientIP = &ClientIPConfig{} - } - if err := m.ClientIP.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Taint) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Taint: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Taint: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Effect", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Effect = TaintEffect(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeAdded", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.TimeAdded == nil { - m.TimeAdded = &v1.Time{} - } - if err := m.TimeAdded.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TypedLocalObjectReference) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TypedLocalObjectReference: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TypedLocalObjectReference: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field APIGroup", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.APIGroup = &s - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Kind = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VolumeMount) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VolumeMount: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VolumeMount: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MountPath", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MountPath = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenerated(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenerated - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenerated - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenerated - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") -) diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/generated.proto b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/generated.proto deleted file mode 100644 index c30342726..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/generated.proto +++ /dev/null @@ -1,1002 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - - -// This file was autogenerated by go-to-protobuf. Do not edit it manually! - -syntax = "proto2"; - -package github.com.cilium.cilium.pkg.k8s.slim.k8s.api.core.v1; - -import "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; - -// Package-wide variables from generator "generated". -option go_package = "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1"; - -// ClientIPConfig represents the configurations of Client IP based session affinity. -message ClientIPConfig { - // timeoutSeconds specifies the seconds of ClientIP type session sticky time. - // The value must be >0 && <=86400(for 1 day) if ServiceAffinity == "ClientIP". - // Default value is 10800(for 3 hours). - // +optional - optional int32 timeoutSeconds = 1; -} - -// A single application container that you want to run within a pod. -message Container { - // Name of the container specified as a DNS_LABEL. - // Each container in a pod must have a unique name (DNS_LABEL). - // Cannot be updated. - optional string name = 1; - - // Container image name. - // More info: https://kubernetes.io/docs/concepts/containers/images - // This field is optional to allow higher level config management to default or override - // container images in workload controllers like Deployments and StatefulSets. - // +optional - optional string image = 2; - - // List of ports to expose from the container. Not specifying a port here - // DOES NOT prevent that port from being exposed. Any port which is - // listening on the default "0.0.0.0" address inside a container will be - // accessible from the network. - // Modifying this array with strategic merge patch may corrupt the data. - // For more information See https://github.com/kubernetes/kubernetes/issues/108255. - // Cannot be updated. - // +optional - // +patchMergeKey=containerPort - // +patchStrategy=merge - // +listType=map - // +listMapKey=containerPort - // +listMapKey=protocol - repeated ContainerPort ports = 6; - - // Pod volumes to mount into the container's filesystem. - // Cannot be updated. - // +optional - // +patchMergeKey=mountPath - // +patchStrategy=merge - repeated VolumeMount volumeMounts = 9; -} - -// ContainerPort represents a network port in a single container. -message ContainerPort { - // If specified, this must be an IANA_SVC_NAME and unique within the pod. Each - // named port in a pod must have a unique name. Name for the port that can be - // referred to by services. - // +optional - optional string name = 1; - - // Number of port to expose on the host. - // If specified, this must be a valid port number, 0 < x < 65536. - // If HostNetwork is specified, this must match ContainerPort. - // Most containers do not need this. - // +optional - optional int32 hostPort = 2; - - // Number of port to expose on the pod's IP address. - // This must be a valid port number, 0 < x < 65536. - optional int32 containerPort = 3; - - // Protocol for port. Must be UDP, TCP, or SCTP. - // Defaults to "TCP". - // +optional - // +default="TCP" - optional string protocol = 4; - - // What host IP to bind the external port to. - // +optional - optional string hostIP = 5; -} - -// ContainerState holds a possible state of container. -// Only one of its members may be specified. -// If none of them is specified, the default one is ContainerStateWaiting. -message ContainerState { - // Details about a running container - // +optional - optional ContainerStateRunning running = 2; -} - -// ContainerStateRunning is a running state of a container. -message ContainerStateRunning { - // Time at which the container was last (re-)started - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.Time startedAt = 1; -} - -// ContainerStatus contains details for the current status of this container. -message ContainerStatus { - // State holds details about the container's current condition. - // +optional - optional ContainerState state = 2; - - // ContainerID is the ID of the container in the format '://'. - // Where type is a container runtime identifier, returned from Version call of CRI API - // (for example "containerd"). - // +optional - optional string containerID = 8; -} - -// EndpointAddress is a tuple that describes single IP address. -// +structType=atomic -message EndpointAddress { - // The IP of this endpoint. - // May not be loopback (127.0.0.0/8 or ::1), link-local (169.254.0.0/16 or fe80::/10), - // or link-local multicast (224.0.0.0/24 or ff02::/16). - optional string ip = 1; - - // The Hostname of this endpoint - // +optional - optional string hostname = 3; - - // Optional: Node hosting this endpoint. This can be used to determine endpoints local to a node. - // +optional - optional string nodeName = 4; -} - -// EndpointPort is a tuple that describes a single port. -// +structType=atomic -message EndpointPort { - // The name of this port. This must match the 'name' field in the - // corresponding ServicePort. - // Must be a DNS_LABEL. - // Optional only if one port is defined. - // +optional - optional string name = 1; - - // The port number of the endpoint. - optional int32 port = 2; - - // The IP protocol for this port. - // Must be UDP, TCP, or SCTP. - // Default is TCP. - // +optional - optional string protocol = 3; -} - -// EndpointSubset is a group of addresses with a common set of ports. The -// expanded set of endpoints is the Cartesian product of Addresses x Ports. -// For example, given: -// -// { -// Addresses: [{"ip": "10.10.1.1"}, {"ip": "10.10.2.2"}], -// Ports: [{"name": "a", "port": 8675}, {"name": "b", "port": 309}] -// } -// -// The resulting set of endpoints can be viewed as: -// -// a: [ 10.10.1.1:8675, 10.10.2.2:8675 ], -// b: [ 10.10.1.1:309, 10.10.2.2:309 ] -message EndpointSubset { - // IP addresses which offer the related ports that are marked as ready. These endpoints - // should be considered safe for load balancers and clients to utilize. - // +optional - // +listType=atomic - repeated EndpointAddress addresses = 1; - - // Port numbers available on the related IP addresses. - // +optional - // +listType=atomic - repeated EndpointPort ports = 3; -} - -// Endpoints is a collection of endpoints that implement the actual service. Example: -// -// Name: "mysvc", -// Subsets: [ -// { -// Addresses: [{"ip": "10.10.1.1"}, {"ip": "10.10.2.2"}], -// Ports: [{"name": "a", "port": 8675}, {"name": "b", "port": 309}] -// }, -// { -// Addresses: [{"ip": "10.10.3.3"}], -// Ports: [{"name": "a", "port": 93}, {"name": "b", "port": 76}] -// }, -// ] -message Endpoints { - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ObjectMeta metadata = 1; - - // The set of all endpoints is the union of all subsets. Addresses are placed into - // subsets according to the IPs they share. A single address with multiple ports, - // some of which are ready and some of which are not (because they come from - // different containers) will result in the address being displayed in different - // subsets for the different ports. No address will appear in both Addresses and - // NotReadyAddresses in the same subset. - // Sets of addresses and ports that comprise a service. - // +optional - // +listType=atomic - repeated EndpointSubset subsets = 2; -} - -// EndpointsList is a list of endpoints. -message EndpointsList { - // Standard list metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ListMeta metadata = 1; - - // List of endpoints. - repeated Endpoints items = 2; -} - -// LoadBalancerIngress represents the status of a load-balancer ingress point: -// traffic intended for the service should be sent to an ingress point. -message LoadBalancerIngress { - // IP is set for load-balancer ingress points that are IP based - // (typically GCE or OpenStack load-balancers) - // +optional - optional string ip = 1; - - // Hostname is set for load-balancer ingress points that are DNS based - // (typically AWS load-balancers) - // +optional - optional string hostname = 2; - - // IPMode specifies how the load-balancer IP behaves, and may only be specified when the ip field is specified. - // Setting this to "VIP" indicates that traffic is delivered to the node with - // the destination set to the load-balancer's IP and port. - // Setting this to "Proxy" indicates that traffic is delivered to the node or pod with - // the destination set to the node's IP and node port or the pod's IP and port. - // Service implementations may use this information to adjust traffic routing. - // +optional - optional string ipMode = 3; - - // Ports is a list of records of service ports - // If used, every port defined in the service should have an entry in it - // +listType=atomic - // +optional - repeated PortStatus ports = 4; -} - -// LoadBalancerStatus represents the status of a load-balancer. -message LoadBalancerStatus { - // Ingress is a list containing ingress points for the load-balancer. - // Traffic intended for the service should be sent to these ingress points. - // +optional - // +listType=atomic - repeated LoadBalancerIngress ingress = 1; -} - -// Namespace provides a scope for Names. -// Use of multiple namespaces is optional. -message Namespace { - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ObjectMeta metadata = 1; -} - -// NamespaceList is a list of Namespaces. -message NamespaceList { - // Standard list metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ListMeta metadata = 1; - - // Items is the list of Namespace objects in the list. - // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ - repeated Namespace items = 2; -} - -// Node is a worker node in Kubernetes. -// Each node will have a unique identifier in the cache (i.e. in etcd). -message Node { - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ObjectMeta metadata = 1; - - // Spec defines the behavior of a node. - // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional - optional NodeSpec spec = 2; - - // Most recently observed status of the node. - // Populated by the system. - // Read-only. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional - optional NodeStatus status = 3; -} - -// NodeAddress contains information for the node's address. -message NodeAddress { - // Node address type, one of Hostname, ExternalIP or InternalIP. - optional string type = 1; - - // The node address. - optional string address = 2; -} - -// NodeCondition contains condition information for a node. -message NodeCondition { - // Type of node condition. - optional string type = 1; - - // Status of the condition, one of True, False, Unknown. - optional string status = 2; - - // (brief) reason for the condition's last transition. - // +optional - optional string reason = 5; -} - -// NodeList is the whole list of all Nodes which have been registered with master. -message NodeList { - // Standard list metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ListMeta metadata = 1; - - // List of nodes - repeated Node items = 2; -} - -// NodeSpec describes the attributes that a node is created with. -message NodeSpec { - // PodCIDR represents the pod IP range assigned to the node. - // +optional - optional string podCIDR = 1; - - // podCIDRs represents the IP ranges assigned to the node for usage by Pods on that node. If this - // field is specified, the 0th entry must match the podCIDR field. It may contain at most 1 value for - // each of IPv4 and IPv6. - // +optional - // +patchStrategy=merge - // +listType=set - repeated string podCIDRs = 7; - - // ID of the node assigned by the cloud provider in the format: :// - // +optional - optional string providerID = 3; - - // If specified, the node's taints. - // +optional - // +listType=atomic - repeated Taint taints = 5; -} - -// NodeStatus is information about the current status of a node. -message NodeStatus { - // Conditions is an array of current observed node conditions. - // More info: https://kubernetes.io/docs/concepts/nodes/node/#condition - // +optional - // +patchMergeKey=type - // +patchStrategy=merge - // +listType=map - // +listMapKey=type - repeated NodeCondition conditions = 4; - - // List of addresses reachable to the node. - // Queried from cloud provider, if available. - // More info: https://kubernetes.io/docs/concepts/nodes/node/#addresses - // Note: This field is declared as mergeable, but the merge key is not sufficiently - // unique, which can cause data corruption when it is merged. Callers should instead - // use a full-replacement patch. See https://pr.k8s.io/79391 for an example. - // Consumers should assume that addresses can change during the - // lifetime of a Node. However, there are some exceptions where this may not - // be possible, such as Pods that inherit a Node's address in its own status or - // consumers of the downward API (status.hostIP). - // +optional - // +patchMergeKey=type - // +patchStrategy=merge - // +listType=map - // +listMapKey=type - repeated NodeAddress addresses = 5; -} - -// Pod is a collection of containers that can run on a host. This resource is created -// by clients and scheduled onto hosts. -message Pod { - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ObjectMeta metadata = 1; - - // Specification of the desired behavior of the pod. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional - optional PodSpec spec = 2; - - // Most recently observed status of the pod. - // This data may not be up to date. - // Populated by the system. - // Read-only. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional - optional PodStatus status = 3; -} - -// PodCondition contains details for the current condition of this pod. -message PodCondition { - // Type is the type of the condition. - // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions - optional string type = 1; - - // Status is the status of the condition. - // Can be True, False, Unknown. - // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions - optional string status = 2; - - // Last time we probed the condition. - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.Time lastProbeTime = 3; - - // Last time the condition transitioned from one status to another. - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.Time lastTransitionTime = 4; - - // Unique, one-word, CamelCase reason for the condition's last transition. - // +optional - optional string reason = 5; - - // Human-readable message indicating details about last transition. - // +optional - optional string message = 6; -} - -// PodIP represents a single IP address allocated to the pod. -message PodIP { - // IP is the IP address assigned to the pod - optional string ip = 1; -} - -// PodList is a list of Pods. -message PodList { - // Standard list metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ListMeta metadata = 1; - - // List of pods. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md - repeated Pod items = 2; -} - -// PodReadinessGate contains the reference to a pod condition -message PodReadinessGate { - // ConditionType refers to a condition in the pod's condition list with matching type. - optional string conditionType = 1; -} - -// PodSpec is a description of a pod. -message PodSpec { - // List of initialization containers belonging to the pod. - // Init containers are executed in order prior to containers being started. If any - // init container fails, the pod is considered to have failed and is handled according - // to its restartPolicy. The name for an init container or normal container must be - // unique among all containers. - // Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. - // The resourceRequirements of an init container are taken into account during scheduling - // by finding the highest request/limit for each resource type, and then using the max of - // of that value or the sum of the normal containers. Limits are applied to init containers - // in a similar fashion. - // Init containers cannot currently be added or removed. - // Cannot be updated. - // More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ - // +patchMergeKey=name - // +patchStrategy=merge - // +listType=map - // +listMapKey=name - repeated Container initContainers = 20; - - // List of containers belonging to the pod. - // Containers cannot currently be added or removed. - // There must be at least one container in a Pod. - // Cannot be updated. - // +patchMergeKey=name - // +patchStrategy=merge - // +listType=map - // +listMapKey=name - repeated Container containers = 2; - - // ServiceAccountName is the name of the ServiceAccount to use to run this pod. - // More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ - // +optional - optional string serviceAccountName = 8; - - // NodeName is a request to schedule this pod onto a specific node. If it is non-empty, - // the scheduler simply schedules this pod onto that node, assuming that it fits resource - // requirements. - // +optional - optional string nodeName = 10; - - // Host networking requested for this pod. Use the host's network namespace. - // If this option is set, the ports that will be used must be specified. - // Default to false. - // +k8s:conversion-gen=false - // +optional - optional bool hostNetwork = 11; -} - -// PodStatus represents information about the status of a pod. Status may trail the actual -// state of a system, especially if the node that hosts the pod cannot contact the control -// plane. -message PodStatus { - // The phase of a Pod is a simple, high-level summary of where the Pod is in its lifecycle. - // The conditions array, the reason and message fields, and the individual container status - // arrays contain more detail about the pod's status. - // There are five possible phase values: - // - // Pending: The pod has been accepted by the Kubernetes system, but one or more of the - // container images has not been created. This includes time before being scheduled as - // well as time spent downloading images over the network, which could take a while. - // Running: The pod has been bound to a node, and all of the containers have been created. - // At least one container is still running, or is in the process of starting or restarting. - // Succeeded: All containers in the pod have terminated in success, and will not be restarted. - // Failed: All containers in the pod have terminated, and at least one container has - // terminated in failure. The container either exited with non-zero status or was terminated - // by the system. - // Unknown: For some reason the state of the pod could not be obtained, typically due to an - // error in communicating with the host of the pod. - // - // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-phase - // +optional - optional string phase = 1; - - // Current service state of pod. - // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions - // +optional - // +patchMergeKey=type - // +patchStrategy=merge - // +listType=map - // +listMapKey=type - repeated PodCondition conditions = 2; - - // hostIP holds the IP address of the host to which the pod is assigned. Empty if the pod has not started yet. - // A pod can be assigned to a node that has a problem in kubelet which in turns mean that HostIP will - // not be updated even if there is a node is assigned to pod - // +optional - optional string hostIP = 5; - - // podIP address allocated to the pod. Routable at least within the cluster. - // Empty if not yet allocated. - // +optional - optional string podIP = 6; - - // podIPs holds the IP addresses allocated to the pod. If this field is specified, the 0th entry must - // match the podIP field. Pods may be allocated at most 1 value for each of IPv4 and IPv6. This list - // is empty if no IPs have been allocated yet. - // +optional - // +patchStrategy=merge - // +patchMergeKey=ip - // +listType=map - // +listMapKey=ip - repeated PodIP podIPs = 12; - - // RFC 3339 date and time at which the object was acknowledged by the Kubelet. - // This is before the Kubelet pulled the container image(s) for the pod. - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.Time startTime = 7; - - // The list has one entry per container in the manifest. - // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status - // +optional - // +listType=atomic - repeated ContainerStatus containerStatuses = 8; - - // The Quality of Service (QOS) classification assigned to the pod based on resource requirements - // See PodQOSClass type for available QOS classes - // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-qos/#quality-of-service-classes - // +optional - optional string qosClass = 9; -} - -// PortStatus represents the error condition of a service port -message PortStatus { - // Port is the port number of the service port of which status is recorded here - optional int32 port = 1; - - // Protocol is the protocol of the service port of which status is recorded here - // The supported values are: "TCP", "UDP", "SCTP" - optional string protocol = 2; - - // Error is to record the problem with the service port - // The format of the error shall comply with the following rules: - // - built-in error values shall be specified in this file and those shall use - // CamelCase names - // - cloud provider specific error values must have names that comply with the - // format foo.example.com/CamelCase. - // --- - // The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - // +optional - // +kubebuilder:validation:Required - // +kubebuilder:validation:Pattern=`^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$` - // +kubebuilder:validation:MaxLength=316 - optional string error = 3; -} - -// Secret holds secret data of a certain type. The total bytes of the values in -// the Data field must be less than MaxSecretSize bytes. -message Secret { - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ObjectMeta metadata = 1; - - // Immutable, if set to true, ensures that data stored in the Secret cannot - // be updated (only object metadata can be modified). - // If not set to true, the field can be modified at any time. - // Defaulted to nil. - // +optional - optional bool immutable = 5; - - // Data contains the secret data. Each key must consist of alphanumeric - // characters, '-', '_' or '.'. The serialized form of the secret data is a - // base64 encoded string, representing the arbitrary (possibly non-string) - // data value here. Described in https://tools.ietf.org/html/rfc4648#section-4 - // +optional - map data = 2; - - // stringData allows specifying non-binary secret data in string form. - // It is provided as a write-only input field for convenience. - // All keys and values are merged into the data field on write, overwriting any existing values. - // The stringData field is never output when reading from the API. - // +k8s:conversion-gen=false - // +optional - map stringData = 4; - - // Used to facilitate programmatic handling of secret data. - // More info: https://kubernetes.io/docs/concepts/configuration/secret/#secret-types - // +optional - optional string type = 3; -} - -// SecretList is a list of Secret. -message SecretList { - // Standard list metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ListMeta metadata = 1; - - // Items is a list of secret objects. - // More info: https://kubernetes.io/docs/concepts/configuration/secret - repeated Secret items = 2; -} - -// Service is a named abstraction of software service (for example, mysql) consisting of local port -// (for example 3306) that the proxy listens on, and the selector that determines which pods -// will answer requests sent through the proxy. -message Service { - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ObjectMeta metadata = 1; - - // Spec defines the behavior of a service. - // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional - optional ServiceSpec spec = 2; - - // Most recently observed status of the service. - // Populated by the system. - // Read-only. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional - optional ServiceStatus status = 3; -} - -// ServiceList holds a list of services. -message ServiceList { - // Standard list metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ListMeta metadata = 1; - - // List of services - repeated Service items = 2; -} - -// ServicePort contains information on service's port. -message ServicePort { - // The name of this port within the service. This must be a DNS_LABEL. - // All ports within a ServiceSpec must have unique names. When considering - // the endpoints for a Service, this must match the 'name' field in the - // EndpointPort. - // Optional if only one ServicePort is defined on this service. - // +optional - optional string name = 1; - - // The IP protocol for this port. Supports "TCP", "UDP", and "SCTP". - // Default is TCP. - // +default="TCP" - // +optional - optional string protocol = 2; - - // The port that will be exposed by this service. - optional int32 port = 3; - - // The port on each node on which this service is exposed when type is - // NodePort or LoadBalancer. Usually assigned by the system. If a value is - // specified, in-range, and not in use it will be used, otherwise the - // operation will fail. If not specified, a port will be allocated if this - // Service requires one. If this field is specified when creating a - // Service which does not need it, creation will fail. This field will be - // wiped when updating a Service to no longer need it (e.g. changing type - // from NodePort to ClusterIP). - // More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport - // +optional - optional int32 nodePort = 5; -} - -// ServiceSpec describes the attributes that a user creates on a service. -message ServiceSpec { - // The list of ports that are exposed by this service. - // More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies - // +patchMergeKey=port - // +patchStrategy=merge - // +listType=map - // +listMapKey=port - // +listMapKey=protocol - repeated ServicePort ports = 1; - - // Route service traffic to pods with label keys and values matching this - // selector. If empty or not present, the service is assumed to have an - // external process managing its endpoints, which Kubernetes will not - // modify. Only applies to types ClusterIP, NodePort, and LoadBalancer. - // Ignored if type is ExternalName. - // More info: https://kubernetes.io/docs/concepts/services-networking/service/ - // +optional - // +mapType=atomic - map selector = 2; - - // clusterIP is the IP address of the service and is usually assigned - // randomly. If an address is specified manually, is in-range (as per - // system configuration), and is not in use, it will be allocated to the - // service; otherwise creation of the service will fail. This field may not - // be changed through updates unless the type field is also being changed - // to ExternalName (which requires this field to be blank) or the type - // field is being changed from ExternalName (in which case this field may - // optionally be specified, as describe above). Valid values are "None", - // empty string (""), or a valid IP address. Setting this to "None" makes a - // "headless service" (no virtual IP), which is useful when direct endpoint - // connections are preferred and proxying is not required. Only applies to - // types ClusterIP, NodePort, and LoadBalancer. If this field is specified - // when creating a Service of type ExternalName, creation will fail. This - // field will be wiped when updating a Service to type ExternalName. - // More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies - // +optional - optional string clusterIP = 3; - - // ClusterIPs is a list of IP addresses assigned to this service, and are - // usually assigned randomly. If an address is specified manually, is - // in-range (as per system configuration), and is not in use, it will be - // allocated to the service; otherwise creation of the service will fail. - // This field may not be changed through updates unless the type field is - // also being changed to ExternalName (which requires this field to be - // empty) or the type field is being changed from ExternalName (in which - // case this field may optionally be specified, as describe above). Valid - // values are "None", empty string (""), or a valid IP address. Setting - // this to "None" makes a "headless service" (no virtual IP), which is - // useful when direct endpoint connections are preferred and proxying is - // not required. Only applies to types ClusterIP, NodePort, and - // LoadBalancer. If this field is specified when creating a Service of type - // ExternalName, creation will fail. This field will be wiped when updating - // a Service to type ExternalName. If this field is not specified, it will - // be initialized from the clusterIP field. If this field is specified, - // clients must ensure that clusterIPs[0] and clusterIP have the same - // value. - // - // This field may hold a maximum of two entries (dual-stack IPs, in either order). - // These IPs must correspond to the values of the ipFamilies field. Both - // clusterIPs and ipFamilies are governed by the ipFamilyPolicy field. - // More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies - // +listType=atomic - // +optional - repeated string clusterIPs = 18; - - // type determines how the Service is exposed. Defaults to ClusterIP. Valid - // options are ExternalName, ClusterIP, NodePort, and LoadBalancer. - // "ClusterIP" allocates a cluster-internal IP address for load-balancing - // to endpoints. Endpoints are determined by the selector or if that is not - // specified, by manual construction of an Endpoints object or - // EndpointSlice objects. If clusterIP is "None", no virtual IP is - // allocated and the endpoints are published as a set of endpoints rather - // than a virtual IP. - // "NodePort" builds on ClusterIP and allocates a port on every node which - // routes to the same endpoints as the clusterIP. - // "LoadBalancer" builds on NodePort and creates an external load-balancer - // (if supported in the current cloud) which routes to the same endpoints - // as the clusterIP. - // "ExternalName" aliases this service to the specified externalName. - // Several other fields do not apply to ExternalName services. - // More info: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types - // +optional - optional string type = 4; - - // externalIPs is a list of IP addresses for which nodes in the cluster - // will also accept traffic for this service. These IPs are not managed by - // Kubernetes. The user is responsible for ensuring that traffic arrives - // at a node with this IP. A common example is external load-balancers - // that are not part of the Kubernetes system. - // +optional - // +listType=atomic - repeated string externalIPs = 5; - - // Supports "ClientIP" and "None". Used to maintain session affinity. - // Enable client IP based session affinity. - // Must be ClientIP or None. - // Defaults to None. - // More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies - // +optional - optional string sessionAffinity = 7; - - // Only applies to Service Type: LoadBalancer. - // This feature depends on whether the underlying cloud-provider supports specifying - // the loadBalancerIP when a load balancer is created. - // This field will be ignored if the cloud-provider does not support the feature. - // Deprecated: This field was under-specified and its meaning varies across implementations. - // Using it is non-portable and it may not support dual-stack. - // Users are encouraged to use implementation-specific annotations when available. - // +optional - optional string loadBalancerIP = 8; - - // If specified and supported by the platform, this will restrict traffic through the cloud-provider - // load-balancer will be restricted to the specified client IPs. This field will be ignored if the - // cloud-provider does not support the feature." - // More info: https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/ - // +optional - // +listType=atomic - repeated string loadBalancerSourceRanges = 9; - - // externalTrafficPolicy describes how nodes distribute service traffic they - // receive on one of the Service's "externally-facing" addresses (NodePorts, - // ExternalIPs, and LoadBalancer IPs). If set to "Local", the proxy will configure - // the service in a way that assumes that external load balancers will take care - // of balancing the service traffic between nodes, and so each node will deliver - // traffic only to the node-local endpoints of the service, without masquerading - // the client source IP. (Traffic mistakenly sent to a node with no endpoints will - // be dropped.) The default value, "Cluster", uses the standard behavior of - // routing to all endpoints evenly (possibly modified by topology and other - // features). Note that traffic sent to an External IP or LoadBalancer IP from - // within the cluster will always get "Cluster" semantics, but clients sending to - // a NodePort from within the cluster may need to take traffic policy into account - // when picking a node. - // +optional - optional string externalTrafficPolicy = 11; - - // healthCheckNodePort specifies the healthcheck nodePort for the service. - // This only applies when type is set to LoadBalancer and - // externalTrafficPolicy is set to Local. If a value is specified, is - // in-range, and is not in use, it will be used. If not specified, a value - // will be automatically allocated. External systems (e.g. load-balancers) - // can use this port to determine if a given node holds endpoints for this - // service or not. If this field is specified when creating a Service - // which does not need it, creation will fail. This field will be wiped - // when updating a Service to no longer need it (e.g. changing type). - // This field cannot be updated once set. - // +optional - optional int32 healthCheckNodePort = 12; - - // sessionAffinityConfig contains the configurations of session affinity. - // +optional - optional SessionAffinityConfig sessionAffinityConfig = 14; - - // IPFamilies is a list of IP families (e.g. IPv4, IPv6) assigned to this - // service. This field is usually assigned automatically based on cluster - // configuration and the ipFamilyPolicy field. If this field is specified - // manually, the requested family is available in the cluster, - // and ipFamilyPolicy allows it, it will be used; otherwise creation of - // the service will fail. This field is conditionally mutable: it allows - // for adding or removing a secondary IP family, but it does not allow - // changing the primary IP family of the Service. Valid values are "IPv4" - // and "IPv6". This field only applies to Services of types ClusterIP, - // NodePort, and LoadBalancer, and does apply to "headless" services. - // This field will be wiped when updating a Service to type ExternalName. - // - // This field may hold a maximum of two entries (dual-stack families, in - // either order). These families must correspond to the values of the - // clusterIPs field, if specified. Both clusterIPs and ipFamilies are - // governed by the ipFamilyPolicy field. - // +listType=atomic - // +optional - repeated string ipFamilies = 19; - - // IPFamilyPolicy represents the dual-stack-ness requested or required by - // this Service. If there is no value provided, then this field will be set - // to SingleStack. Services can be "SingleStack" (a single IP family), - // "PreferDualStack" (two IP families on dual-stack configured clusters or - // a single IP family on single-stack clusters), or "RequireDualStack" - // (two IP families on dual-stack configured clusters, otherwise fail). The - // ipFamilies and clusterIPs fields depend on the value of this field. This - // field will be wiped when updating a service to type ExternalName. - // +optional - optional string ipFamilyPolicy = 17; - - // loadBalancerClass is the class of the load balancer implementation this Service belongs to. - // If specified, the value of this field must be a label-style identifier, with an optional prefix, - // e.g. "internal-vip" or "example.com/internal-vip". Unprefixed names are reserved for end-users. - // This field can only be set when the Service type is 'LoadBalancer'. If not set, the default load - // balancer implementation is used, today this is typically done through the cloud provider integration, - // but should apply for any default implementation. If set, it is assumed that a load balancer - // implementation is watching for Services with a matching class. Any default load balancer - // implementation (e.g. cloud providers) should ignore Services that set this field. - // This field can only be set when creating or updating a Service to type 'LoadBalancer'. - // Once set, it can not be changed. This field will be wiped when a service is updated to a non 'LoadBalancer' type. - // +optional - optional string loadBalancerClass = 21; - - // InternalTrafficPolicy describes how nodes distribute service traffic they - // receive on the ClusterIP. If set to "Local", the proxy will assume that pods - // only want to talk to endpoints of the service on the same node as the pod, - // dropping the traffic if there are no local endpoints. The default value, - // "Cluster", uses the standard behavior of routing to all endpoints evenly - // (possibly modified by topology and other features). - // +optional - optional string internalTrafficPolicy = 22; -} - -// ServiceStatus represents the current status of a service. -message ServiceStatus { - // LoadBalancer contains the current status of the load-balancer, - // if one is present. - // +optional - optional LoadBalancerStatus loadBalancer = 1; - - // Current service state - // +optional - // +patchMergeKey=type - // +patchStrategy=merge - // +listType=map - // +listMapKey=type - repeated github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.Condition conditions = 2; -} - -// SessionAffinityConfig represents the configurations of session affinity. -message SessionAffinityConfig { - // clientIP contains the configurations of Client IP based session affinity. - // +optional - optional ClientIPConfig clientIP = 1; -} - -// The node this Taint is attached to has the "effect" on -// any pod that does not tolerate the Taint. -message Taint { - // Required. The taint key to be applied to a node. - optional string key = 1; - - // The taint value corresponding to the taint key. - // +optional - optional string value = 2; - - // Required. The effect of the taint on pods - // that do not tolerate the taint. - // Valid effects are NoSchedule, PreferNoSchedule and NoExecute. - optional string effect = 3; - - // TimeAdded represents the time at which the taint was added. - // It is only written for NoExecute taints. - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.Time timeAdded = 4; -} - -// TypedLocalObjectReference contains enough information to let you locate the -// typed referenced object inside the same namespace. -// +structType=atomic -message TypedLocalObjectReference { - // APIGroup is the group for the resource being referenced. - // If APIGroup is not specified, the specified Kind must be in the core API group. - // For any other third-party types, APIGroup is required. - // +optional - optional string apiGroup = 1; - - // Kind is the type of resource being referenced - optional string kind = 2; - - // Name is the name of resource being referenced - optional string name = 3; -} - -// VolumeMount describes a mounting of a Volume within a container. -message VolumeMount { - // Path within the container at which the volume should be mounted. Must - // not contain ':'. - optional string mountPath = 3; -} - diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/register.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/register.go deleted file mode 100644 index 5cdbe4769..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/register.go +++ /dev/null @@ -1,56 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2015 The Kubernetes Authors. - -package v1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -// GroupName is the group name use in this package -const GroupName = "" - -// SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -var ( - // We only register manually written functions here. The registration of the - // generated functions takes place in the generated files. The separation - // makes the code compile even when the generated files are missing. - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - AddToScheme = SchemeBuilder.AddToScheme -) - -// Adds the list of known types to the given scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &Pod{}, - &PodList{}, - &Service{}, - &ServiceList{}, - &Endpoints{}, - &EndpointsList{}, - &Node{}, - &NodeList{}, - &Namespace{}, - &NamespaceList{}, - &Secret{}, - &SecretList{}, - ) - - // Add common types - scheme.AddKnownTypes(SchemeGroupVersion, &metav1.Status{}) - - // Add the watch version that applies - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/taint.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/taint.go deleted file mode 100644 index 9bd88b6d1..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/taint.go +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2017 The Kubernetes Authors. - -package v1 - -import "fmt" - -// MatchTaint checks if the taint matches taintToMatch. Taints are unique by key:effect, -// if the two taints have same key:effect, regard as they match. -func (t *Taint) MatchTaint(taintToMatch *Taint) bool { - return t.Key == taintToMatch.Key && t.Effect == taintToMatch.Effect -} - -// taint.ToString() converts taint struct to string in format '=:', '=:', ':', or ''. -func (t *Taint) ToString() string { - if len(t.Effect) == 0 { - if len(t.Value) == 0 { - return fmt.Sprintf("%v", t.Key) - } - return fmt.Sprintf("%v=%v:", t.Key, t.Value) - } - if len(t.Value) == 0 { - return fmt.Sprintf("%v:%v", t.Key, t.Effect) - } - return fmt.Sprintf("%v=%v:%v", t.Key, t.Value, t.Effect) -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/types.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/types.go deleted file mode 100644 index 778b92e19..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/types.go +++ /dev/null @@ -1,1467 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2015 The Kubernetes Authors. - -package v1 - -import ( - slim_metav1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" -) - -const ( - // NamespaceDefault means the object is in the default namespace which is applied when not specified by clients - NamespaceDefault string = "default" - // NamespaceAll is the default argument to specify on a context when you want to list or filter resources across all namespaces - NamespaceAll string = "" - // NamespaceNodeLease is the namespace where we place node lease objects (used for node heartbeats) - NamespaceNodeLease string = "kube-node-lease" -) - -// Protocol defines network protocols supported for things like container ports. -// +enum -type Protocol string - -const ( - // ProtocolTCP is the TCP protocol. - ProtocolTCP Protocol = "TCP" - // ProtocolUDP is the UDP protocol. - ProtocolUDP Protocol = "UDP" - // ProtocolSCTP is the SCTP protocol. - ProtocolSCTP Protocol = "SCTP" -) - -// ContainerPort represents a network port in a single container. -type ContainerPort struct { - // If specified, this must be an IANA_SVC_NAME and unique within the pod. Each - // named port in a pod must have a unique name. Name for the port that can be - // referred to by services. - // +optional - Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"` - // Number of port to expose on the host. - // If specified, this must be a valid port number, 0 < x < 65536. - // If HostNetwork is specified, this must match ContainerPort. - // Most containers do not need this. - // +optional - HostPort int32 `json:"hostPort,omitempty" protobuf:"varint,2,opt,name=hostPort"` - // Number of port to expose on the pod's IP address. - // This must be a valid port number, 0 < x < 65536. - ContainerPort int32 `json:"containerPort" protobuf:"varint,3,opt,name=containerPort"` - // Protocol for port. Must be UDP, TCP, or SCTP. - // Defaults to "TCP". - // +optional - // +default="TCP" - Protocol Protocol `json:"protocol,omitempty" protobuf:"bytes,4,opt,name=protocol,casttype=Protocol"` - // What host IP to bind the external port to. - // +optional - HostIP string `json:"hostIP,omitempty" protobuf:"bytes,5,opt,name=hostIP"` -} - -// VolumeMount describes a mounting of a Volume within a container. -type VolumeMount struct { - // Path within the container at which the volume should be mounted. Must - // not contain ':'. - MountPath string `json:"mountPath" protobuf:"bytes,3,opt,name=mountPath"` -} - -// A single application container that you want to run within a pod. -type Container struct { - // Name of the container specified as a DNS_LABEL. - // Each container in a pod must have a unique name (DNS_LABEL). - // Cannot be updated. - Name string `json:"name" protobuf:"bytes,1,opt,name=name"` - // Container image name. - // More info: https://kubernetes.io/docs/concepts/containers/images - // This field is optional to allow higher level config management to default or override - // container images in workload controllers like Deployments and StatefulSets. - // +optional - Image string `json:"image,omitempty" protobuf:"bytes,2,opt,name=image"` - // List of ports to expose from the container. Not specifying a port here - // DOES NOT prevent that port from being exposed. Any port which is - // listening on the default "0.0.0.0" address inside a container will be - // accessible from the network. - // Modifying this array with strategic merge patch may corrupt the data. - // For more information See https://github.com/kubernetes/kubernetes/issues/108255. - // Cannot be updated. - // +optional - // +patchMergeKey=containerPort - // +patchStrategy=merge - // +listType=map - // +listMapKey=containerPort - // +listMapKey=protocol - Ports []ContainerPort `json:"ports,omitempty" patchStrategy:"merge" patchMergeKey:"containerPort" protobuf:"bytes,6,rep,name=ports"` - // Pod volumes to mount into the container's filesystem. - // Cannot be updated. - // +optional - // +patchMergeKey=mountPath - // +patchStrategy=merge - VolumeMounts []VolumeMount `json:"volumeMounts,omitempty" patchStrategy:"merge" patchMergeKey:"mountPath" protobuf:"bytes,9,rep,name=volumeMounts"` -} - -type ConditionStatus string - -// These are valid condition statuses. "ConditionTrue" means a resource is in the condition. -// "ConditionFalse" means a resource is not in the condition. "ConditionUnknown" means kubernetes -// can't decide if a resource is in the condition or not. In the future, we could add other -// intermediate conditions, e.g. ConditionDegraded. -const ( - ConditionTrue ConditionStatus = "True" - ConditionFalse ConditionStatus = "False" - ConditionUnknown ConditionStatus = "Unknown" -) - -// ContainerStateRunning is a running state of a container. -type ContainerStateRunning struct { - // Time at which the container was last (re-)started - // +optional - StartedAt slim_metav1.Time `json:"startedAt,omitempty" protobuf:"bytes,1,opt,name=startedAt"` -} - -// ContainerState holds a possible state of container. -// Only one of its members may be specified. -// If none of them is specified, the default one is ContainerStateWaiting. -type ContainerState struct { - // Details about a running container - // +optional - Running *ContainerStateRunning `json:"running,omitempty" protobuf:"bytes,2,opt,name=running"` -} - -// ContainerStatus contains details for the current status of this container. -type ContainerStatus struct { - // State holds details about the container's current condition. - // +optional - State ContainerState `json:"state,omitempty" protobuf:"bytes,2,opt,name=state"` - // ContainerID is the ID of the container in the format '://'. - // Where type is a container runtime identifier, returned from Version call of CRI API - // (for example "containerd"). - // +optional - ContainerID string `json:"containerID,omitempty" protobuf:"bytes,8,opt,name=containerID"` -} - -// PodPhase is a label for the condition of a pod at the current time. -// +enum -type PodPhase string - -// These are the valid statuses of pods. -const ( - // PodPending means the pod has been accepted by the system, but one or more of the containers - // has not been started. This includes time before being bound to a node, as well as time spent - // pulling images onto the host. - PodPending PodPhase = "Pending" - // PodRunning means the pod has been bound to a node and all of the containers have been started. - // At least one container is still running or is in the process of being restarted. - PodRunning PodPhase = "Running" - // PodSucceeded means that all containers in the pod have voluntarily terminated - // with a container exit code of 0, and the system is not going to restart any of these containers. - PodSucceeded PodPhase = "Succeeded" - // PodFailed means that all containers in the pod have terminated, and at least one container has - // terminated in a failure (exited with a non-zero exit code or was stopped by the system). - PodFailed PodPhase = "Failed" - // PodUnknown means that for some reason the state of the pod could not be obtained, typically due - // to an error in communicating with the host of the pod. - // Deprecated: It isn't being set since 2015 (74da3b14b0c0f658b3bb8d2def5094686d0e9095) - PodUnknown PodPhase = "Unknown" -) - -// PodConditionType is a valid value for PodCondition.Type -type PodConditionType string - -// These are built-in conditions of pod. An application may use a custom condition not listed here. -const ( - // ContainersReady indicates whether all containers in the pod are ready. - ContainersReady PodConditionType = "ContainersReady" - // PodInitialized means that all init containers in the pod have started successfully. - PodInitialized PodConditionType = "Initialized" - // PodReady means the pod is able to service requests and should be added to the - // load balancing pools of all matching services. - PodReady PodConditionType = "Ready" - // PodScheduled represents status of the scheduling process for this pod. - PodScheduled PodConditionType = "PodScheduled" - // DisruptionTarget indicates the pod is about to be terminated due to a - // disruption (such as preemption, eviction API or garbage-collection). - DisruptionTarget PodConditionType = "DisruptionTarget" - // PodReadyToStartContainers pod sandbox is successfully configured and - // the pod is ready to launch containers. - PodReadyToStartContainers PodConditionType = "PodReadyToStartContainers" -) - -// These are reasons for a pod's transition to a condition. -const ( - // PodReasonUnschedulable reason in PodScheduled PodCondition means that the scheduler - // can't schedule the pod right now, for example due to insufficient resources in the cluster. - PodReasonUnschedulable = "Unschedulable" - - // PodReasonSchedulingGated reason in PodScheduled PodCondition means that the scheduler - // skips scheduling the pod because one or more scheduling gates are still present. - PodReasonSchedulingGated = "SchedulingGated" - - // PodReasonSchedulerError reason in PodScheduled PodCondition means that some internal error happens - // during scheduling, for example due to nodeAffinity parsing errors. - PodReasonSchedulerError = "SchedulerError" - - // TerminationByKubelet reason in DisruptionTarget pod condition indicates that the termination - // is initiated by kubelet - PodReasonTerminationByKubelet = "TerminationByKubelet" - - // PodReasonPreemptionByScheduler reason in DisruptionTarget pod condition indicates that the - // disruption was initiated by scheduler's preemption. - PodReasonPreemptionByScheduler = "PreemptionByScheduler" -) - -// PodCondition contains details for the current condition of this pod. -type PodCondition struct { - // Type is the type of the condition. - // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions - Type PodConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=PodConditionType"` - // Status is the status of the condition. - // Can be True, False, Unknown. - // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions - Status ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=ConditionStatus"` - // Last time we probed the condition. - // +optional - LastProbeTime slim_metav1.Time `json:"lastProbeTime,omitempty" protobuf:"bytes,3,opt,name=lastProbeTime"` - // Last time the condition transitioned from one status to another. - // +optional - LastTransitionTime slim_metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,4,opt,name=lastTransitionTime"` - // Unique, one-word, CamelCase reason for the condition's last transition. - // +optional - Reason string `json:"reason,omitempty" protobuf:"bytes,5,opt,name=reason"` - // Human-readable message indicating details about last transition. - // +optional - Message string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"` -} - -const ( - // DefaultTerminationGracePeriodSeconds indicates the default duration in - // seconds a pod needs to terminate gracefully. - DefaultTerminationGracePeriodSeconds = 30 -) - -// The node this Taint is attached to has the "effect" on -// any pod that does not tolerate the Taint. -type Taint struct { - // Required. The taint key to be applied to a node. - Key string `json:"key" protobuf:"bytes,1,opt,name=key"` - // The taint value corresponding to the taint key. - // +optional - Value string `json:"value,omitempty" protobuf:"bytes,2,opt,name=value"` - // Required. The effect of the taint on pods - // that do not tolerate the taint. - // Valid effects are NoSchedule, PreferNoSchedule and NoExecute. - Effect TaintEffect `json:"effect" protobuf:"bytes,3,opt,name=effect,casttype=TaintEffect"` - // TimeAdded represents the time at which the taint was added. - // It is only written for NoExecute taints. - // +optional - TimeAdded *slim_metav1.Time `json:"timeAdded,omitempty" protobuf:"bytes,4,opt,name=timeAdded"` -} - -// +enum -type TaintEffect string - -const ( - // Do not allow new pods to schedule onto the node unless they tolerate the taint, - // but allow all pods submitted to Kubelet without going through the scheduler - // to start, and allow all already-running pods to continue running. - // Enforced by the scheduler. - TaintEffectNoSchedule TaintEffect = "NoSchedule" - // Like TaintEffectNoSchedule, but the scheduler tries not to schedule - // new pods onto the node, rather than prohibiting new pods from scheduling - // onto the node entirely. Enforced by the scheduler. - TaintEffectPreferNoSchedule TaintEffect = "PreferNoSchedule" - // NOT YET IMPLEMENTED. TODO: Uncomment field once it is implemented. - // Like TaintEffectNoSchedule, but additionally do not allow pods submitted to - // Kubelet without going through the scheduler to start. - // Enforced by Kubelet and the scheduler. - // TaintEffectNoScheduleNoAdmit TaintEffect = "NoScheduleNoAdmit" - - // Evict any already-running pods that do not tolerate the taint. - // Currently enforced by NodeController. - TaintEffectNoExecute TaintEffect = "NoExecute" -) - -// PodReadinessGate contains the reference to a pod condition -type PodReadinessGate struct { - // ConditionType refers to a condition in the pod's condition list with matching type. - ConditionType PodConditionType `json:"conditionType" protobuf:"bytes,1,opt,name=conditionType,casttype=PodConditionType"` -} - -// PodSpec is a description of a pod. -type PodSpec struct { - // List of initialization containers belonging to the pod. - // Init containers are executed in order prior to containers being started. If any - // init container fails, the pod is considered to have failed and is handled according - // to its restartPolicy. The name for an init container or normal container must be - // unique among all containers. - // Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. - // The resourceRequirements of an init container are taken into account during scheduling - // by finding the highest request/limit for each resource type, and then using the max of - // of that value or the sum of the normal containers. Limits are applied to init containers - // in a similar fashion. - // Init containers cannot currently be added or removed. - // Cannot be updated. - // More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ - // +patchMergeKey=name - // +patchStrategy=merge - // +listType=map - // +listMapKey=name - InitContainers []Container `json:"initContainers,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,20,rep,name=initContainers"` - // List of containers belonging to the pod. - // Containers cannot currently be added or removed. - // There must be at least one container in a Pod. - // Cannot be updated. - // +patchMergeKey=name - // +patchStrategy=merge - // +listType=map - // +listMapKey=name - Containers []Container `json:"containers" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,2,rep,name=containers"` - - // ServiceAccountName is the name of the ServiceAccount to use to run this pod. - // More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ - // +optional - ServiceAccountName string `json:"serviceAccountName,omitempty" protobuf:"bytes,8,opt,name=serviceAccountName"` - - // NodeName is a request to schedule this pod onto a specific node. If it is non-empty, - // the scheduler simply schedules this pod onto that node, assuming that it fits resource - // requirements. - // +optional - NodeName string `json:"nodeName,omitempty" protobuf:"bytes,10,opt,name=nodeName"` - // Host networking requested for this pod. Use the host's network namespace. - // If this option is set, the ports that will be used must be specified. - // Default to false. - // +k8s:conversion-gen=false - // +optional - HostNetwork bool `json:"hostNetwork,omitempty" protobuf:"varint,11,opt,name=hostNetwork"` -} - -// PodQOSClass defines the supported qos classes of Pods. -// +enum -type PodQOSClass string - -const ( - // PodQOSGuaranteed is the Guaranteed qos class. - PodQOSGuaranteed PodQOSClass = "Guaranteed" - // PodQOSBurstable is the Burstable qos class. - PodQOSBurstable PodQOSClass = "Burstable" - // PodQOSBestEffort is the BestEffort qos class. - PodQOSBestEffort PodQOSClass = "BestEffort" -) - -// PodIP represents a single IP address allocated to the pod. -type PodIP struct { - // IP is the IP address assigned to the pod - IP string `json:"ip,omitempty" protobuf:"bytes,1,opt,name=ip"` -} - -// PodStatus represents information about the status of a pod. Status may trail the actual -// state of a system, especially if the node that hosts the pod cannot contact the control -// plane. -type PodStatus struct { - // The phase of a Pod is a simple, high-level summary of where the Pod is in its lifecycle. - // The conditions array, the reason and message fields, and the individual container status - // arrays contain more detail about the pod's status. - // There are five possible phase values: - // - // Pending: The pod has been accepted by the Kubernetes system, but one or more of the - // container images has not been created. This includes time before being scheduled as - // well as time spent downloading images over the network, which could take a while. - // Running: The pod has been bound to a node, and all of the containers have been created. - // At least one container is still running, or is in the process of starting or restarting. - // Succeeded: All containers in the pod have terminated in success, and will not be restarted. - // Failed: All containers in the pod have terminated, and at least one container has - // terminated in failure. The container either exited with non-zero status or was terminated - // by the system. - // Unknown: For some reason the state of the pod could not be obtained, typically due to an - // error in communicating with the host of the pod. - // - // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-phase - // +optional - Phase PodPhase `json:"phase,omitempty" protobuf:"bytes,1,opt,name=phase,casttype=PodPhase"` - // Current service state of pod. - // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions - // +optional - // +patchMergeKey=type - // +patchStrategy=merge - // +listType=map - // +listMapKey=type - Conditions []PodCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,2,rep,name=conditions"` - - // hostIP holds the IP address of the host to which the pod is assigned. Empty if the pod has not started yet. - // A pod can be assigned to a node that has a problem in kubelet which in turns mean that HostIP will - // not be updated even if there is a node is assigned to pod - // +optional - HostIP string `json:"hostIP,omitempty" protobuf:"bytes,5,opt,name=hostIP"` - - // podIP address allocated to the pod. Routable at least within the cluster. - // Empty if not yet allocated. - // +optional - PodIP string `json:"podIP,omitempty" protobuf:"bytes,6,opt,name=podIP"` - - // podIPs holds the IP addresses allocated to the pod. If this field is specified, the 0th entry must - // match the podIP field. Pods may be allocated at most 1 value for each of IPv4 and IPv6. This list - // is empty if no IPs have been allocated yet. - // +optional - // +patchStrategy=merge - // +patchMergeKey=ip - // +listType=map - // +listMapKey=ip - PodIPs []PodIP `json:"podIPs,omitempty" protobuf:"bytes,12,rep,name=podIPs" patchStrategy:"merge" patchMergeKey:"ip"` - - // RFC 3339 date and time at which the object was acknowledged by the Kubelet. - // This is before the Kubelet pulled the container image(s) for the pod. - // +optional - StartTime *slim_metav1.Time `json:"startTime,omitempty" protobuf:"bytes,7,opt,name=startTime"` - - // The list has one entry per container in the manifest. - // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status - // +optional - // +listType=atomic - ContainerStatuses []ContainerStatus `json:"containerStatuses,omitempty" protobuf:"bytes,8,rep,name=containerStatuses"` - // The Quality of Service (QOS) classification assigned to the pod based on resource requirements - // See PodQOSClass type for available QOS classes - // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-qos/#quality-of-service-classes - // +optional - QOSClass PodQOSClass `json:"qosClass,omitempty" protobuf:"bytes,9,rep,name=qosClass"` -} - -// +genclient -// +genclient:method=UpdateEphemeralContainers,verb=update,subresource=ephemeralcontainers -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// Pod is a collection of containers that can run on a host. This resource is created -// by clients and scheduled onto hosts. -type Pod struct { - slim_metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - slim_metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Specification of the desired behavior of the pod. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional - Spec PodSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - - // Most recently observed status of the pod. - // This data may not be up to date. - // Populated by the system. - // Read-only. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional - Status PodStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// PodList is a list of Pods. -type PodList struct { - slim_metav1.TypeMeta `json:",inline"` - // Standard list metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - // +optional - slim_metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // List of pods. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md - Items []Pod `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// Session Affinity Type string -// +enum -type ServiceAffinity string - -const ( - // ServiceAffinityClientIP is the Client IP based. - ServiceAffinityClientIP ServiceAffinity = "ClientIP" - - // ServiceAffinityNone - no session affinity. - ServiceAffinityNone ServiceAffinity = "None" -) - -const DefaultClientIPServiceAffinitySeconds int32 = 10800 - -// SessionAffinityConfig represents the configurations of session affinity. -type SessionAffinityConfig struct { - // clientIP contains the configurations of Client IP based session affinity. - // +optional - ClientIP *ClientIPConfig `json:"clientIP,omitempty" protobuf:"bytes,1,opt,name=clientIP"` -} - -// ClientIPConfig represents the configurations of Client IP based session affinity. -type ClientIPConfig struct { - // timeoutSeconds specifies the seconds of ClientIP type session sticky time. - // The value must be >0 && <=86400(for 1 day) if ServiceAffinity == "ClientIP". - // Default value is 10800(for 3 hours). - // +optional - TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty" protobuf:"varint,1,opt,name=timeoutSeconds"` -} - -// Service Type string describes ingress methods for a service -// +enum -type ServiceType string - -const ( - // ServiceTypeClusterIP means a service will only be accessible inside the - // cluster, via the cluster IP. - ServiceTypeClusterIP ServiceType = "ClusterIP" - - // ServiceTypeNodePort means a service will be exposed on one port of - // every node, in addition to 'ClusterIP' type. - ServiceTypeNodePort ServiceType = "NodePort" - - // ServiceTypeLoadBalancer means a service will be exposed via an - // external load balancer (if the cloud provider supports it), in addition - // to 'NodePort' type. - ServiceTypeLoadBalancer ServiceType = "LoadBalancer" - - // ServiceTypeExternalName means a service consists of only a reference to - // an external name that kubedns or equivalent will return as a CNAME - // record, with no exposing or proxying of any pods involved. - ServiceTypeExternalName ServiceType = "ExternalName" -) - -// ServiceInternalTrafficPolicy describes how nodes distribute service traffic they -// receive on the ClusterIP. -// +enum -type ServiceInternalTrafficPolicy string - -const ( - // ServiceInternalTrafficPolicyCluster routes traffic to all endpoints. - ServiceInternalTrafficPolicyCluster ServiceInternalTrafficPolicy = "Cluster" - - // ServiceInternalTrafficPolicyLocal routes traffic only to endpoints on the same - // node as the client pod (dropping the traffic if there are no local endpoints). - ServiceInternalTrafficPolicyLocal ServiceInternalTrafficPolicy = "Local" -) - -// for backwards compat -// +enum -type ServiceInternalTrafficPolicyType = ServiceInternalTrafficPolicy - -// ServiceExternalTrafficPolicy describes how nodes distribute service traffic they -// receive on one of the Service's "externally-facing" addresses (NodePorts, ExternalIPs, -// and LoadBalancer IPs. -// +enum -type ServiceExternalTrafficPolicy string - -const ( - // ServiceExternalTrafficPolicyCluster routes traffic to all endpoints. - ServiceExternalTrafficPolicyCluster ServiceExternalTrafficPolicy = "Cluster" - - // ServiceExternalTrafficPolicyLocal preserves the source IP of the traffic by - // routing only to endpoints on the same node as the traffic was received on - // (dropping the traffic if there are no local endpoints). - ServiceExternalTrafficPolicyLocal ServiceExternalTrafficPolicy = "Local" -) - -// for backwards compat -// +enum -type ServiceExternalTrafficPolicyType = ServiceExternalTrafficPolicy - -// These are the valid conditions of a service. -const ( - // LoadBalancerPortsError represents the condition of the requested ports - // on the cloud load balancer instance. - LoadBalancerPortsError = "LoadBalancerPortsError" - // LoadBalancerPortsErrorReason reason in ServiceStatus condition LoadBalancerPortsError - // means the LoadBalancer was not able to be configured correctly. - LoadBalancerPortsErrorReason = "LoadBalancerMixedProtocolNotSupported" -) - -// ServiceStatus represents the current status of a service. -type ServiceStatus struct { - // LoadBalancer contains the current status of the load-balancer, - // if one is present. - // +optional - LoadBalancer LoadBalancerStatus `json:"loadBalancer,omitempty" protobuf:"bytes,1,opt,name=loadBalancer"` - // Current service state - // +optional - // +patchMergeKey=type - // +patchStrategy=merge - // +listType=map - // +listMapKey=type - Conditions []slim_metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,2,rep,name=conditions"` -} - -// LoadBalancerStatus represents the status of a load-balancer. -type LoadBalancerStatus struct { - // Ingress is a list containing ingress points for the load-balancer. - // Traffic intended for the service should be sent to these ingress points. - // +optional - // +listType=atomic - Ingress []LoadBalancerIngress `json:"ingress,omitempty" protobuf:"bytes,1,rep,name=ingress"` -} - -// LoadBalancerIngress represents the status of a load-balancer ingress point: -// traffic intended for the service should be sent to an ingress point. -type LoadBalancerIngress struct { - // IP is set for load-balancer ingress points that are IP based - // (typically GCE or OpenStack load-balancers) - // +optional - IP string `json:"ip,omitempty" protobuf:"bytes,1,opt,name=ip"` - - // Hostname is set for load-balancer ingress points that are DNS based - // (typically AWS load-balancers) - // +optional - Hostname string `json:"hostname,omitempty" protobuf:"bytes,2,opt,name=hostname"` - - // IPMode specifies how the load-balancer IP behaves, and may only be specified when the ip field is specified. - // Setting this to "VIP" indicates that traffic is delivered to the node with - // the destination set to the load-balancer's IP and port. - // Setting this to "Proxy" indicates that traffic is delivered to the node or pod with - // the destination set to the node's IP and node port or the pod's IP and port. - // Service implementations may use this information to adjust traffic routing. - // +optional - IPMode *LoadBalancerIPMode `json:"ipMode,omitempty" protobuf:"bytes,3,opt,name=ipMode"` - - // Ports is a list of records of service ports - // If used, every port defined in the service should have an entry in it - // +listType=atomic - // +optional - Ports []PortStatus `json:"ports,omitempty" protobuf:"bytes,4,rep,name=ports"` -} - -// IPFamily represents the IP Family (IPv4 or IPv6). This type is used -// to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). -// +enum -type IPFamily string - -const ( - // IPv4Protocol indicates that this IP is IPv4 protocol - IPv4Protocol IPFamily = "IPv4" - // IPv6Protocol indicates that this IP is IPv6 protocol - IPv6Protocol IPFamily = "IPv6" - // IPFamilyUnknown indicates that this IP is unknown protocol - IPFamilyUnknown IPFamily = "" -) - -// IPFamilyPolicy represents the dual-stack-ness requested or required by a Service -// +enum -type IPFamilyPolicy string - -const ( - // IPFamilyPolicySingleStack indicates that this service is required to have a single IPFamily. - // The IPFamily assigned is based on the default IPFamily used by the cluster - // or as identified by service.spec.ipFamilies field - IPFamilyPolicySingleStack IPFamilyPolicy = "SingleStack" - // IPFamilyPolicyPreferDualStack indicates that this service prefers dual-stack when - // the cluster is configured for dual-stack. If the cluster is not configured - // for dual-stack the service will be assigned a single IPFamily. If the IPFamily is not - // set in service.spec.ipFamilies then the service will be assigned the default IPFamily - // configured on the cluster - IPFamilyPolicyPreferDualStack IPFamilyPolicy = "PreferDualStack" - // IPFamilyPolicyRequireDualStack indicates that this service requires dual-stack. Using - // IPFamilyPolicyRequireDualStack on a single stack cluster will result in validation errors. The - // IPFamilies (and their order) assigned to this service is based on service.spec.ipFamilies. If - // service.spec.ipFamilies was not provided then it will be assigned according to how they are - // configured on the cluster. If service.spec.ipFamilies has only one entry then the alternative - // IPFamily will be added by apiserver - IPFamilyPolicyRequireDualStack IPFamilyPolicy = "RequireDualStack" -) - -// for backwards compat -// +enum -type IPFamilyPolicyType = IPFamilyPolicy - -// ServiceSpec describes the attributes that a user creates on a service. -type ServiceSpec struct { - // The list of ports that are exposed by this service. - // More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies - // +patchMergeKey=port - // +patchStrategy=merge - // +listType=map - // +listMapKey=port - // +listMapKey=protocol - Ports []ServicePort `json:"ports,omitempty" patchStrategy:"merge" patchMergeKey:"port" protobuf:"bytes,1,rep,name=ports"` - - // Route service traffic to pods with label keys and values matching this - // selector. If empty or not present, the service is assumed to have an - // external process managing its endpoints, which Kubernetes will not - // modify. Only applies to types ClusterIP, NodePort, and LoadBalancer. - // Ignored if type is ExternalName. - // More info: https://kubernetes.io/docs/concepts/services-networking/service/ - // +optional - // +mapType=atomic - Selector map[string]string `json:"selector,omitempty" protobuf:"bytes,2,rep,name=selector"` - - // clusterIP is the IP address of the service and is usually assigned - // randomly. If an address is specified manually, is in-range (as per - // system configuration), and is not in use, it will be allocated to the - // service; otherwise creation of the service will fail. This field may not - // be changed through updates unless the type field is also being changed - // to ExternalName (which requires this field to be blank) or the type - // field is being changed from ExternalName (in which case this field may - // optionally be specified, as describe above). Valid values are "None", - // empty string (""), or a valid IP address. Setting this to "None" makes a - // "headless service" (no virtual IP), which is useful when direct endpoint - // connections are preferred and proxying is not required. Only applies to - // types ClusterIP, NodePort, and LoadBalancer. If this field is specified - // when creating a Service of type ExternalName, creation will fail. This - // field will be wiped when updating a Service to type ExternalName. - // More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies - // +optional - ClusterIP string `json:"clusterIP,omitempty" protobuf:"bytes,3,opt,name=clusterIP"` - - // ClusterIPs is a list of IP addresses assigned to this service, and are - // usually assigned randomly. If an address is specified manually, is - // in-range (as per system configuration), and is not in use, it will be - // allocated to the service; otherwise creation of the service will fail. - // This field may not be changed through updates unless the type field is - // also being changed to ExternalName (which requires this field to be - // empty) or the type field is being changed from ExternalName (in which - // case this field may optionally be specified, as describe above). Valid - // values are "None", empty string (""), or a valid IP address. Setting - // this to "None" makes a "headless service" (no virtual IP), which is - // useful when direct endpoint connections are preferred and proxying is - // not required. Only applies to types ClusterIP, NodePort, and - // LoadBalancer. If this field is specified when creating a Service of type - // ExternalName, creation will fail. This field will be wiped when updating - // a Service to type ExternalName. If this field is not specified, it will - // be initialized from the clusterIP field. If this field is specified, - // clients must ensure that clusterIPs[0] and clusterIP have the same - // value. - // - // This field may hold a maximum of two entries (dual-stack IPs, in either order). - // These IPs must correspond to the values of the ipFamilies field. Both - // clusterIPs and ipFamilies are governed by the ipFamilyPolicy field. - // More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies - // +listType=atomic - // +optional - ClusterIPs []string `json:"clusterIPs,omitempty" protobuf:"bytes,18,opt,name=clusterIPs"` - - // type determines how the Service is exposed. Defaults to ClusterIP. Valid - // options are ExternalName, ClusterIP, NodePort, and LoadBalancer. - // "ClusterIP" allocates a cluster-internal IP address for load-balancing - // to endpoints. Endpoints are determined by the selector or if that is not - // specified, by manual construction of an Endpoints object or - // EndpointSlice objects. If clusterIP is "None", no virtual IP is - // allocated and the endpoints are published as a set of endpoints rather - // than a virtual IP. - // "NodePort" builds on ClusterIP and allocates a port on every node which - // routes to the same endpoints as the clusterIP. - // "LoadBalancer" builds on NodePort and creates an external load-balancer - // (if supported in the current cloud) which routes to the same endpoints - // as the clusterIP. - // "ExternalName" aliases this service to the specified externalName. - // Several other fields do not apply to ExternalName services. - // More info: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types - // +optional - Type ServiceType `json:"type,omitempty" protobuf:"bytes,4,opt,name=type,casttype=ServiceType"` - - // externalIPs is a list of IP addresses for which nodes in the cluster - // will also accept traffic for this service. These IPs are not managed by - // Kubernetes. The user is responsible for ensuring that traffic arrives - // at a node with this IP. A common example is external load-balancers - // that are not part of the Kubernetes system. - // +optional - // +listType=atomic - ExternalIPs []string `json:"externalIPs,omitempty" protobuf:"bytes,5,rep,name=externalIPs"` - - // Supports "ClientIP" and "None". Used to maintain session affinity. - // Enable client IP based session affinity. - // Must be ClientIP or None. - // Defaults to None. - // More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies - // +optional - SessionAffinity ServiceAffinity `json:"sessionAffinity,omitempty" protobuf:"bytes,7,opt,name=sessionAffinity,casttype=ServiceAffinity"` - - // Only applies to Service Type: LoadBalancer. - // This feature depends on whether the underlying cloud-provider supports specifying - // the loadBalancerIP when a load balancer is created. - // This field will be ignored if the cloud-provider does not support the feature. - // Deprecated: This field was under-specified and its meaning varies across implementations. - // Using it is non-portable and it may not support dual-stack. - // Users are encouraged to use implementation-specific annotations when available. - // +optional - LoadBalancerIP string `json:"loadBalancerIP,omitempty" protobuf:"bytes,8,opt,name=loadBalancerIP"` - - // If specified and supported by the platform, this will restrict traffic through the cloud-provider - // load-balancer will be restricted to the specified client IPs. This field will be ignored if the - // cloud-provider does not support the feature." - // More info: https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/ - // +optional - // +listType=atomic - LoadBalancerSourceRanges []string `json:"loadBalancerSourceRanges,omitempty" protobuf:"bytes,9,opt,name=loadBalancerSourceRanges"` - - // externalTrafficPolicy describes how nodes distribute service traffic they - // receive on one of the Service's "externally-facing" addresses (NodePorts, - // ExternalIPs, and LoadBalancer IPs). If set to "Local", the proxy will configure - // the service in a way that assumes that external load balancers will take care - // of balancing the service traffic between nodes, and so each node will deliver - // traffic only to the node-local endpoints of the service, without masquerading - // the client source IP. (Traffic mistakenly sent to a node with no endpoints will - // be dropped.) The default value, "Cluster", uses the standard behavior of - // routing to all endpoints evenly (possibly modified by topology and other - // features). Note that traffic sent to an External IP or LoadBalancer IP from - // within the cluster will always get "Cluster" semantics, but clients sending to - // a NodePort from within the cluster may need to take traffic policy into account - // when picking a node. - // +optional - ExternalTrafficPolicy ServiceExternalTrafficPolicy `json:"externalTrafficPolicy,omitempty" protobuf:"bytes,11,opt,name=externalTrafficPolicy"` - - // healthCheckNodePort specifies the healthcheck nodePort for the service. - // This only applies when type is set to LoadBalancer and - // externalTrafficPolicy is set to Local. If a value is specified, is - // in-range, and is not in use, it will be used. If not specified, a value - // will be automatically allocated. External systems (e.g. load-balancers) - // can use this port to determine if a given node holds endpoints for this - // service or not. If this field is specified when creating a Service - // which does not need it, creation will fail. This field will be wiped - // when updating a Service to no longer need it (e.g. changing type). - // This field cannot be updated once set. - // +optional - HealthCheckNodePort int32 `json:"healthCheckNodePort,omitempty" protobuf:"bytes,12,opt,name=healthCheckNodePort"` - - // sessionAffinityConfig contains the configurations of session affinity. - // +optional - SessionAffinityConfig *SessionAffinityConfig `json:"sessionAffinityConfig,omitempty" protobuf:"bytes,14,opt,name=sessionAffinityConfig"` - - // TopologyKeys is tombstoned to show why 16 is reserved protobuf tag. - // TopologyKeys []string `json:"topologyKeys,omitempty" protobuf:"bytes,16,opt,name=topologyKeys"` - - // IPFamily is tombstoned to show why 15 is a reserved protobuf tag. - // IPFamily *IPFamily `json:"ipFamily,omitempty" protobuf:"bytes,15,opt,name=ipFamily,Configcasttype=IPFamily"` - - // IPFamilies is a list of IP families (e.g. IPv4, IPv6) assigned to this - // service. This field is usually assigned automatically based on cluster - // configuration and the ipFamilyPolicy field. If this field is specified - // manually, the requested family is available in the cluster, - // and ipFamilyPolicy allows it, it will be used; otherwise creation of - // the service will fail. This field is conditionally mutable: it allows - // for adding or removing a secondary IP family, but it does not allow - // changing the primary IP family of the Service. Valid values are "IPv4" - // and "IPv6". This field only applies to Services of types ClusterIP, - // NodePort, and LoadBalancer, and does apply to "headless" services. - // This field will be wiped when updating a Service to type ExternalName. - // - // This field may hold a maximum of two entries (dual-stack families, in - // either order). These families must correspond to the values of the - // clusterIPs field, if specified. Both clusterIPs and ipFamilies are - // governed by the ipFamilyPolicy field. - // +listType=atomic - // +optional - IPFamilies []IPFamily `json:"ipFamilies,omitempty" protobuf:"bytes,19,opt,name=ipFamilies,casttype=IPFamily"` - - // IPFamilyPolicy represents the dual-stack-ness requested or required by - // this Service. If there is no value provided, then this field will be set - // to SingleStack. Services can be "SingleStack" (a single IP family), - // "PreferDualStack" (two IP families on dual-stack configured clusters or - // a single IP family on single-stack clusters), or "RequireDualStack" - // (two IP families on dual-stack configured clusters, otherwise fail). The - // ipFamilies and clusterIPs fields depend on the value of this field. This - // field will be wiped when updating a service to type ExternalName. - // +optional - IPFamilyPolicy *IPFamilyPolicy `json:"ipFamilyPolicy,omitempty" protobuf:"bytes,17,opt,name=ipFamilyPolicy,casttype=IPFamilyPolicy"` - - // loadBalancerClass is the class of the load balancer implementation this Service belongs to. - // If specified, the value of this field must be a label-style identifier, with an optional prefix, - // e.g. "internal-vip" or "example.com/internal-vip". Unprefixed names are reserved for end-users. - // This field can only be set when the Service type is 'LoadBalancer'. If not set, the default load - // balancer implementation is used, today this is typically done through the cloud provider integration, - // but should apply for any default implementation. If set, it is assumed that a load balancer - // implementation is watching for Services with a matching class. Any default load balancer - // implementation (e.g. cloud providers) should ignore Services that set this field. - // This field can only be set when creating or updating a Service to type 'LoadBalancer'. - // Once set, it can not be changed. This field will be wiped when a service is updated to a non 'LoadBalancer' type. - // +optional - LoadBalancerClass *string `json:"loadBalancerClass,omitempty" protobuf:"bytes,21,opt,name=loadBalancerClass"` - - // InternalTrafficPolicy describes how nodes distribute service traffic they - // receive on the ClusterIP. If set to "Local", the proxy will assume that pods - // only want to talk to endpoints of the service on the same node as the pod, - // dropping the traffic if there are no local endpoints. The default value, - // "Cluster", uses the standard behavior of routing to all endpoints evenly - // (possibly modified by topology and other features). - // +optional - InternalTrafficPolicy *ServiceInternalTrafficPolicy `json:"internalTrafficPolicy,omitempty" protobuf:"bytes,22,opt,name=internalTrafficPolicy"` -} - -// ServicePort contains information on service's port. -type ServicePort struct { - // The name of this port within the service. This must be a DNS_LABEL. - // All ports within a ServiceSpec must have unique names. When considering - // the endpoints for a Service, this must match the 'name' field in the - // EndpointPort. - // Optional if only one ServicePort is defined on this service. - // +optional - Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"` - - // The IP protocol for this port. Supports "TCP", "UDP", and "SCTP". - // Default is TCP. - // +default="TCP" - // +optional - Protocol Protocol `json:"protocol,omitempty" protobuf:"bytes,2,opt,name=protocol,casttype=Protocol"` - - // The port that will be exposed by this service. - Port int32 `json:"port" protobuf:"varint,3,opt,name=port"` - - // The port on each node on which this service is exposed when type is - // NodePort or LoadBalancer. Usually assigned by the system. If a value is - // specified, in-range, and not in use it will be used, otherwise the - // operation will fail. If not specified, a port will be allocated if this - // Service requires one. If this field is specified when creating a - // Service which does not need it, creation will fail. This field will be - // wiped when updating a Service to no longer need it (e.g. changing type - // from NodePort to ClusterIP). - // More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport - // +optional - NodePort int32 `json:"nodePort,omitempty" protobuf:"varint,5,opt,name=nodePort"` -} - -// +genclient -// +genclient:skipVerbs=deleteCollection -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// Service is a named abstraction of software service (for example, mysql) consisting of local port -// (for example 3306) that the proxy listens on, and the selector that determines which pods -// will answer requests sent through the proxy. -type Service struct { - slim_metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - slim_metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Spec defines the behavior of a service. - // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional - Spec ServiceSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - - // Most recently observed status of the service. - // Populated by the system. - // Read-only. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional - Status ServiceStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// ServiceList holds a list of services. -type ServiceList struct { - slim_metav1.TypeMeta `json:",inline"` - // Standard list metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - // +optional - slim_metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // List of services - Items []Service `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// Endpoints is a collection of endpoints that implement the actual service. Example: -// -// Name: "mysvc", -// Subsets: [ -// { -// Addresses: [{"ip": "10.10.1.1"}, {"ip": "10.10.2.2"}], -// Ports: [{"name": "a", "port": 8675}, {"name": "b", "port": 309}] -// }, -// { -// Addresses: [{"ip": "10.10.3.3"}], -// Ports: [{"name": "a", "port": 93}, {"name": "b", "port": 76}] -// }, -// ] -type Endpoints struct { - slim_metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - slim_metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // The set of all endpoints is the union of all subsets. Addresses are placed into - // subsets according to the IPs they share. A single address with multiple ports, - // some of which are ready and some of which are not (because they come from - // different containers) will result in the address being displayed in different - // subsets for the different ports. No address will appear in both Addresses and - // NotReadyAddresses in the same subset. - // Sets of addresses and ports that comprise a service. - // +optional - // +listType=atomic - Subsets []EndpointSubset `json:"subsets,omitempty" protobuf:"bytes,2,rep,name=subsets"` -} - -// EndpointSubset is a group of addresses with a common set of ports. The -// expanded set of endpoints is the Cartesian product of Addresses x Ports. -// For example, given: -// -// { -// Addresses: [{"ip": "10.10.1.1"}, {"ip": "10.10.2.2"}], -// Ports: [{"name": "a", "port": 8675}, {"name": "b", "port": 309}] -// } -// -// The resulting set of endpoints can be viewed as: -// -// a: [ 10.10.1.1:8675, 10.10.2.2:8675 ], -// b: [ 10.10.1.1:309, 10.10.2.2:309 ] -type EndpointSubset struct { - // IP addresses which offer the related ports that are marked as ready. These endpoints - // should be considered safe for load balancers and clients to utilize. - // +optional - // +listType=atomic - Addresses []EndpointAddress `json:"addresses,omitempty" protobuf:"bytes,1,rep,name=addresses"` - // Port numbers available on the related IP addresses. - // +optional - // +listType=atomic - Ports []EndpointPort `json:"ports,omitempty" protobuf:"bytes,3,rep,name=ports"` -} - -// EndpointAddress is a tuple that describes single IP address. -// +structType=atomic -type EndpointAddress struct { - // The IP of this endpoint. - // May not be loopback (127.0.0.0/8 or ::1), link-local (169.254.0.0/16 or fe80::/10), - // or link-local multicast (224.0.0.0/24 or ff02::/16). - IP string `json:"ip" protobuf:"bytes,1,opt,name=ip"` - // The Hostname of this endpoint - // +optional - Hostname string `json:"hostname,omitempty" protobuf:"bytes,3,opt,name=hostname"` - // Optional: Node hosting this endpoint. This can be used to determine endpoints local to a node. - // +optional - NodeName *string `json:"nodeName,omitempty" protobuf:"bytes,4,opt,name=nodeName"` -} - -// EndpointPort is a tuple that describes a single port. -// +structType=atomic -type EndpointPort struct { - // The name of this port. This must match the 'name' field in the - // corresponding ServicePort. - // Must be a DNS_LABEL. - // Optional only if one port is defined. - // +optional - Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"` - - // The port number of the endpoint. - Port int32 `json:"port" protobuf:"varint,2,opt,name=port"` - - // The IP protocol for this port. - // Must be UDP, TCP, or SCTP. - // Default is TCP. - // +optional - Protocol Protocol `json:"protocol,omitempty" protobuf:"bytes,3,opt,name=protocol,casttype=Protocol"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// EndpointsList is a list of endpoints. -type EndpointsList struct { - slim_metav1.TypeMeta `json:",inline"` - // Standard list metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - // +optional - slim_metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // List of endpoints. - Items []Endpoints `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// NodeSpec describes the attributes that a node is created with. -type NodeSpec struct { - // PodCIDR represents the pod IP range assigned to the node. - // +optional - PodCIDR string `json:"podCIDR,omitempty" protobuf:"bytes,1,opt,name=podCIDR"` - - // podCIDRs represents the IP ranges assigned to the node for usage by Pods on that node. If this - // field is specified, the 0th entry must match the podCIDR field. It may contain at most 1 value for - // each of IPv4 and IPv6. - // +optional - // +patchStrategy=merge - // +listType=set - PodCIDRs []string `json:"podCIDRs,omitempty" protobuf:"bytes,7,opt,name=podCIDRs" patchStrategy:"merge"` - - // ID of the node assigned by the cloud provider in the format: :// - // +optional - ProviderID string `json:"providerID,omitempty" protobuf:"bytes,3,opt,name=providerID"` - // If specified, the node's taints. - // +optional - // +listType=atomic - Taints []Taint `json:"taints,omitempty" protobuf:"bytes,5,opt,name=taints"` -} - -// NodeStatus is information about the current status of a node. -type NodeStatus struct { - // Conditions is an array of current observed node conditions. - // More info: https://kubernetes.io/docs/concepts/nodes/node/#condition - // +optional - // +patchMergeKey=type - // +patchStrategy=merge - // +listType=map - // +listMapKey=type - Conditions []NodeCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,4,rep,name=conditions"` - // List of addresses reachable to the node. - // Queried from cloud provider, if available. - // More info: https://kubernetes.io/docs/concepts/nodes/node/#addresses - // Note: This field is declared as mergeable, but the merge key is not sufficiently - // unique, which can cause data corruption when it is merged. Callers should instead - // use a full-replacement patch. See https://pr.k8s.io/79391 for an example. - // Consumers should assume that addresses can change during the - // lifetime of a Node. However, there are some exceptions where this may not - // be possible, such as Pods that inherit a Node's address in its own status or - // consumers of the downward API (status.hostIP). - // +optional - // +patchMergeKey=type - // +patchStrategy=merge - // +listType=map - // +listMapKey=type - Addresses []NodeAddress `json:"addresses,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,5,rep,name=addresses"` -} - -// +enum -type NodePhase string - -// These are the valid phases of node. -const ( - // NodePending means the node has been created/added by the system, but not configured. - NodePending NodePhase = "Pending" - // NodeRunning means the node has been configured and has Kubernetes components running. - NodeRunning NodePhase = "Running" - // NodeTerminated means the node has been removed from the cluster. - NodeTerminated NodePhase = "Terminated" -) - -type NodeConditionType string - -// These are valid but not exhaustive conditions of node. A cloud provider may set a condition not listed here. -// Relevant events contain "NodeReady", "NodeNotReady", "NodeSchedulable", and "NodeNotSchedulable". -const ( - // NodeReady means kubelet is healthy and ready to accept pods. - NodeReady NodeConditionType = "Ready" - // NodeMemoryPressure means the kubelet is under pressure due to insufficient available memory. - NodeMemoryPressure NodeConditionType = "MemoryPressure" - // NodeDiskPressure means the kubelet is under pressure due to insufficient available disk. - NodeDiskPressure NodeConditionType = "DiskPressure" - // NodePIDPressure means the kubelet is under pressure due to insufficient available PID. - NodePIDPressure NodeConditionType = "PIDPressure" - // NodeNetworkUnavailable means that network for the node is not correctly configured. - NodeNetworkUnavailable NodeConditionType = "NetworkUnavailable" -) - -// NodeCondition contains condition information for a node. -type NodeCondition struct { - // Type of node condition. - Type NodeConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=NodeConditionType"` - // Status of the condition, one of True, False, Unknown. - Status ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=ConditionStatus"` - // (brief) reason for the condition's last transition. - // +optional - Reason string `json:"reason,omitempty" protobuf:"bytes,5,opt,name=reason"` -} - -type NodeAddressType string - -// These are built-in addresses type of node. A cloud provider may set a type not listed here. -const ( - // NodeHostName identifies a name of the node. Although every node can be assumed - // to have a NodeAddress of this type, its exact syntax and semantics are not - // defined, and are not consistent between different clusters. - NodeHostName NodeAddressType = "Hostname" - - // NodeInternalIP identifies an IP address which is assigned to one of the node's - // network interfaces. Every node should have at least one address of this type. - // - // An internal IP is normally expected to be reachable from every other node, but - // may not be visible to hosts outside the cluster. By default it is assumed that - // kube-apiserver can reach node internal IPs, though it is possible to configure - // clusters where this is not the case. - // - // NodeInternalIP is the default type of node IP, and does not necessarily imply - // that the IP is ONLY reachable internally. If a node has multiple internal IPs, - // no specific semantics are assigned to the additional IPs. - NodeInternalIP NodeAddressType = "InternalIP" - - // NodeExternalIP identifies an IP address which is, in some way, intended to be - // more usable from outside the cluster then an internal IP, though no specific - // semantics are defined. It may be a globally routable IP, though it is not - // required to be. - // - // External IPs may be assigned directly to an interface on the node, like a - // NodeInternalIP, or alternatively, packets sent to the external IP may be NAT'ed - // to an internal node IP rather than being delivered directly (making the IP less - // efficient for node-to-node traffic than a NodeInternalIP). - NodeExternalIP NodeAddressType = "ExternalIP" - - // NodeInternalDNS identifies a DNS name which resolves to an IP address which has - // the characteristics of a NodeInternalIP. The IP it resolves to may or may not - // be a listed NodeInternalIP address. - NodeInternalDNS NodeAddressType = "InternalDNS" - - // NodeExternalDNS identifies a DNS name which resolves to an IP address which has - // the characteristics of a NodeExternalIP. The IP it resolves to may or may not - // be a listed NodeExternalIP address. - NodeExternalDNS NodeAddressType = "ExternalDNS" -) - -// NodeAddress contains information for the node's address. -type NodeAddress struct { - // Node address type, one of Hostname, ExternalIP or InternalIP. - Type NodeAddressType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=NodeAddressType"` - // The node address. - Address string `json:"address" protobuf:"bytes,2,opt,name=address"` -} - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// Node is a worker node in Kubernetes. -// Each node will have a unique identifier in the cache (i.e. in etcd). -type Node struct { - slim_metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - slim_metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Spec defines the behavior of a node. - // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional - Spec NodeSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - - // Most recently observed status of the node. - // Populated by the system. - // Read-only. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional - Status NodeStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// NodeList is the whole list of all Nodes which have been registered with master. -type NodeList struct { - slim_metav1.TypeMeta `json:",inline"` - // Standard list metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - // +optional - slim_metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // List of nodes - Items []Node `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// +genclient -// +genclient:nonNamespaced -// +genclient:skipVerbs=deleteCollection -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// Namespace provides a scope for Names. -// Use of multiple namespaces is optional. -type Namespace struct { - slim_metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - slim_metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// NamespaceList is a list of Namespaces. -type NamespaceList struct { - slim_metav1.TypeMeta `json:",inline"` - // Standard list metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - // +optional - slim_metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Items is the list of Namespace objects in the list. - // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ - Items []Namespace `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// TypedLocalObjectReference contains enough information to let you locate the -// typed referenced object inside the same namespace. -// +structType=atomic -type TypedLocalObjectReference struct { - // APIGroup is the group for the resource being referenced. - // If APIGroup is not specified, the specified Kind must be in the core API group. - // For any other third-party types, APIGroup is required. - // +optional - APIGroup *string `json:"apiGroup" protobuf:"bytes,1,opt,name=apiGroup"` - // Kind is the type of resource being referenced - Kind string `json:"kind" protobuf:"bytes,2,opt,name=kind"` - // Name is the name of resource being referenced - Name string `json:"name" protobuf:"bytes,3,opt,name=name"` -} - -// Bytes type is used to avoid issue with deepequal -// deepequal.go:607 Hit an unsupported type []byte for map[string][]byte, from map[string][]byte -type Bytes []byte - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// Secret holds secret data of a certain type. The total bytes of the values in -// the Data field must be less than MaxSecretSize bytes. -type Secret struct { - slim_metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - slim_metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Immutable, if set to true, ensures that data stored in the Secret cannot - // be updated (only object metadata can be modified). - // If not set to true, the field can be modified at any time. - // Defaulted to nil. - // +optional - Immutable *bool `json:"immutable,omitempty" protobuf:"varint,5,opt,name=immutable"` - - // Data contains the secret data. Each key must consist of alphanumeric - // characters, '-', '_' or '.'. The serialized form of the secret data is a - // base64 encoded string, representing the arbitrary (possibly non-string) - // data value here. Described in https://tools.ietf.org/html/rfc4648#section-4 - // +optional - Data map[string]Bytes `json:"data,omitempty" protobuf:"bytes,2,rep,name=data"` - - // stringData allows specifying non-binary secret data in string form. - // It is provided as a write-only input field for convenience. - // All keys and values are merged into the data field on write, overwriting any existing values. - // The stringData field is never output when reading from the API. - // +k8s:conversion-gen=false - // +optional - StringData map[string]string `json:"stringData,omitempty" protobuf:"bytes,4,rep,name=stringData"` - - // Used to facilitate programmatic handling of secret data. - // More info: https://kubernetes.io/docs/concepts/configuration/secret/#secret-types - // +optional - Type SecretType `json:"type,omitempty" protobuf:"bytes,3,opt,name=type,casttype=SecretType"` -} - -const MaxSecretSize = 1 * 1024 * 1024 - -type SecretType string - -const ( - // SecretTypeOpaque is the default. Arbitrary user-defined data - SecretTypeOpaque SecretType = "Opaque" - - // SecretTypeServiceAccountToken contains a token that identifies a service account to the API - // - // Required fields: - // - Secret.Annotations["kubernetes.io/service-account.name"] - the name of the ServiceAccount the token identifies - // - Secret.Annotations["kubernetes.io/service-account.uid"] - the UID of the ServiceAccount the token identifies - // - Secret.Data["token"] - a token that identifies the service account to the API - SecretTypeServiceAccountToken SecretType = "kubernetes.io/service-account-token" - - // ServiceAccountNameKey is the key of the required annotation for SecretTypeServiceAccountToken secrets - ServiceAccountNameKey = "kubernetes.io/service-account.name" - // ServiceAccountUIDKey is the key of the required annotation for SecretTypeServiceAccountToken secrets - ServiceAccountUIDKey = "kubernetes.io/service-account.uid" - // ServiceAccountTokenKey is the key of the required data for SecretTypeServiceAccountToken secrets - ServiceAccountTokenKey = "token" - // ServiceAccountKubeconfigKey is the key of the optional kubeconfig data for SecretTypeServiceAccountToken secrets - ServiceAccountKubeconfigKey = "kubernetes.kubeconfig" - // ServiceAccountRootCAKey is the key of the optional root certificate authority for SecretTypeServiceAccountToken secrets - ServiceAccountRootCAKey = "ca.crt" - // ServiceAccountNamespaceKey is the key of the optional namespace to use as the default for namespaced API calls - ServiceAccountNamespaceKey = "namespace" - - // SecretTypeDockercfg contains a dockercfg file that follows the same format rules as ~/.dockercfg - // - // Required fields: - // - Secret.Data[".dockercfg"] - a serialized ~/.dockercfg file - SecretTypeDockercfg SecretType = "kubernetes.io/dockercfg" - - // DockerConfigKey is the key of the required data for SecretTypeDockercfg secrets - DockerConfigKey = ".dockercfg" - - // SecretTypeDockerConfigJson contains a dockercfg file that follows the same format rules as ~/.docker/config.json - // - // Required fields: - // - Secret.Data[".dockerconfigjson"] - a serialized ~/.docker/config.json file - SecretTypeDockerConfigJson SecretType = "kubernetes.io/dockerconfigjson" - - // DockerConfigJsonKey is the key of the required data for SecretTypeDockerConfigJson secrets - DockerConfigJsonKey = ".dockerconfigjson" - - // SecretTypeBasicAuth contains data needed for basic authentication. - // - // Required at least one of fields: - // - Secret.Data["username"] - username used for authentication - // - Secret.Data["password"] - password or token needed for authentication - SecretTypeBasicAuth SecretType = "kubernetes.io/basic-auth" - - // BasicAuthUsernameKey is the key of the username for SecretTypeBasicAuth secrets - BasicAuthUsernameKey = "username" - // BasicAuthPasswordKey is the key of the password or token for SecretTypeBasicAuth secrets - BasicAuthPasswordKey = "password" - - // SecretTypeSSHAuth contains data needed for SSH authetication. - // - // Required field: - // - Secret.Data["ssh-privatekey"] - private SSH key needed for authentication - SecretTypeSSHAuth SecretType = "kubernetes.io/ssh-auth" - - // SSHAuthPrivateKey is the key of the required SSH private key for SecretTypeSSHAuth secrets - SSHAuthPrivateKey = "ssh-privatekey" - // SecretTypeTLS contains information about a TLS client or server secret. It - // is primarily used with TLS termination of the Ingress resource, but may be - // used in other types. - // - // Required fields: - // - Secret.Data["tls.key"] - TLS private key. - // Secret.Data["tls.crt"] - TLS certificate. - // TODO: Consider supporting different formats, specifying CA/destinationCA. - SecretTypeTLS SecretType = "kubernetes.io/tls" - - // TLSCertKey is the key for tls certificates in a TLS secret. - TLSCertKey = "tls.crt" - // TLSPrivateKeyKey is the key for the private key field in a TLS secret. - TLSPrivateKeyKey = "tls.key" - // SecretTypeBootstrapToken is used during the automated bootstrap process (first - // implemented by kubeadm). It stores tokens that are used to sign well known - // ConfigMaps. They are used for authn. - SecretTypeBootstrapToken SecretType = "bootstrap.kubernetes.io/token" -) - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// SecretList is a list of Secret. -type SecretList struct { - slim_metav1.TypeMeta `json:",inline"` - // Standard list metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - // +optional - slim_metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Items is a list of secret objects. - // More info: https://kubernetes.io/docs/concepts/configuration/secret - Items []Secret `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// PortStatus represents the error condition of a service port -type PortStatus struct { - // Port is the port number of the service port of which status is recorded here - Port int32 `json:"port" protobuf:"varint,1,opt,name=port"` - // Protocol is the protocol of the service port of which status is recorded here - // The supported values are: "TCP", "UDP", "SCTP" - Protocol Protocol `json:"protocol" protobuf:"bytes,2,opt,name=protocol,casttype=Protocol"` - // Error is to record the problem with the service port - // The format of the error shall comply with the following rules: - // - built-in error values shall be specified in this file and those shall use - // CamelCase names - // - cloud provider specific error values must have names that comply with the - // format foo.example.com/CamelCase. - // --- - // The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - // +optional - // +kubebuilder:validation:Required - // +kubebuilder:validation:Pattern=`^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$` - // +kubebuilder:validation:MaxLength=316 - Error *string `json:"error,omitempty" protobuf:"bytes,3,opt,name=error"` -} - -// LoadBalancerIPMode represents the mode of the LoadBalancer ingress IP -type LoadBalancerIPMode string - -const ( - // LoadBalancerIPModeVIP indicates that traffic is delivered to the node with - // the destination set to the load-balancer's IP and port. - LoadBalancerIPModeVIP LoadBalancerIPMode = "VIP" - // LoadBalancerIPModeProxy indicates that traffic is delivered to the node or pod with - // the destination set to the node's IP and port or the pod's IP and port. - LoadBalancerIPModeProxy LoadBalancerIPMode = "Proxy" -) diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/types_cilium.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/types_cilium.go deleted file mode 100644 index 251316114..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/types_cilium.go +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package v1 - -// GetHostIP returns the Host IP of the pod. -func (p *Pod) GetHostIP() string { - return p.Status.HostIP -} - -// GetAPIVersion returns the API Version for the pod. -func (p *Pod) GetAPIVersion() string { - return SchemeGroupVersion.Version -} - -// GetKind returns its Kind. -func (p *Pod) GetKind() string { - return "Pod" -} - -// IsNil returns true if this structure is nil. -func (p *Pod) IsNil() bool { - return p == nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/zz_generated.deepcopy.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/zz_generated.deepcopy.go deleted file mode 100644 index a2947cca6..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/zz_generated.deepcopy.go +++ /dev/null @@ -1,1074 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1 - -import ( - metav1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in Bytes) DeepCopyInto(out *Bytes) { - { - in := &in - *out = make(Bytes, len(*in)) - copy(*out, *in) - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Bytes. -func (in Bytes) DeepCopy() Bytes { - if in == nil { - return nil - } - out := new(Bytes) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClientIPConfig) DeepCopyInto(out *ClientIPConfig) { - *out = *in - if in.TimeoutSeconds != nil { - in, out := &in.TimeoutSeconds, &out.TimeoutSeconds - *out = new(int32) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientIPConfig. -func (in *ClientIPConfig) DeepCopy() *ClientIPConfig { - if in == nil { - return nil - } - out := new(ClientIPConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Container) DeepCopyInto(out *Container) { - *out = *in - if in.Ports != nil { - in, out := &in.Ports, &out.Ports - *out = make([]ContainerPort, len(*in)) - copy(*out, *in) - } - if in.VolumeMounts != nil { - in, out := &in.VolumeMounts, &out.VolumeMounts - *out = make([]VolumeMount, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Container. -func (in *Container) DeepCopy() *Container { - if in == nil { - return nil - } - out := new(Container) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ContainerPort) DeepCopyInto(out *ContainerPort) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerPort. -func (in *ContainerPort) DeepCopy() *ContainerPort { - if in == nil { - return nil - } - out := new(ContainerPort) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ContainerState) DeepCopyInto(out *ContainerState) { - *out = *in - if in.Running != nil { - in, out := &in.Running, &out.Running - *out = new(ContainerStateRunning) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerState. -func (in *ContainerState) DeepCopy() *ContainerState { - if in == nil { - return nil - } - out := new(ContainerState) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ContainerStateRunning) DeepCopyInto(out *ContainerStateRunning) { - *out = *in - in.StartedAt.DeepCopyInto(&out.StartedAt) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerStateRunning. -func (in *ContainerStateRunning) DeepCopy() *ContainerStateRunning { - if in == nil { - return nil - } - out := new(ContainerStateRunning) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ContainerStatus) DeepCopyInto(out *ContainerStatus) { - *out = *in - in.State.DeepCopyInto(&out.State) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerStatus. -func (in *ContainerStatus) DeepCopy() *ContainerStatus { - if in == nil { - return nil - } - out := new(ContainerStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointAddress) DeepCopyInto(out *EndpointAddress) { - *out = *in - if in.NodeName != nil { - in, out := &in.NodeName, &out.NodeName - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointAddress. -func (in *EndpointAddress) DeepCopy() *EndpointAddress { - if in == nil { - return nil - } - out := new(EndpointAddress) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointPort) DeepCopyInto(out *EndpointPort) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointPort. -func (in *EndpointPort) DeepCopy() *EndpointPort { - if in == nil { - return nil - } - out := new(EndpointPort) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointSubset) DeepCopyInto(out *EndpointSubset) { - *out = *in - if in.Addresses != nil { - in, out := &in.Addresses, &out.Addresses - *out = make([]EndpointAddress, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Ports != nil { - in, out := &in.Ports, &out.Ports - *out = make([]EndpointPort, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSubset. -func (in *EndpointSubset) DeepCopy() *EndpointSubset { - if in == nil { - return nil - } - out := new(EndpointSubset) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Endpoints) DeepCopyInto(out *Endpoints) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - if in.Subsets != nil { - in, out := &in.Subsets, &out.Subsets - *out = make([]EndpointSubset, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Endpoints. -func (in *Endpoints) DeepCopy() *Endpoints { - if in == nil { - return nil - } - out := new(Endpoints) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Endpoints) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointsList) DeepCopyInto(out *EndpointsList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Endpoints, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointsList. -func (in *EndpointsList) DeepCopy() *EndpointsList { - if in == nil { - return nil - } - out := new(EndpointsList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *EndpointsList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LoadBalancerIngress) DeepCopyInto(out *LoadBalancerIngress) { - *out = *in - if in.IPMode != nil { - in, out := &in.IPMode, &out.IPMode - *out = new(LoadBalancerIPMode) - **out = **in - } - if in.Ports != nil { - in, out := &in.Ports, &out.Ports - *out = make([]PortStatus, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoadBalancerIngress. -func (in *LoadBalancerIngress) DeepCopy() *LoadBalancerIngress { - if in == nil { - return nil - } - out := new(LoadBalancerIngress) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LoadBalancerStatus) DeepCopyInto(out *LoadBalancerStatus) { - *out = *in - if in.Ingress != nil { - in, out := &in.Ingress, &out.Ingress - *out = make([]LoadBalancerIngress, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoadBalancerStatus. -func (in *LoadBalancerStatus) DeepCopy() *LoadBalancerStatus { - if in == nil { - return nil - } - out := new(LoadBalancerStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Namespace) DeepCopyInto(out *Namespace) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Namespace. -func (in *Namespace) DeepCopy() *Namespace { - if in == nil { - return nil - } - out := new(Namespace) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Namespace) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NamespaceList) DeepCopyInto(out *NamespaceList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Namespace, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceList. -func (in *NamespaceList) DeepCopy() *NamespaceList { - if in == nil { - return nil - } - out := new(NamespaceList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NamespaceList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Node) DeepCopyInto(out *Node) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Node. -func (in *Node) DeepCopy() *Node { - if in == nil { - return nil - } - out := new(Node) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Node) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeAddress) DeepCopyInto(out *NodeAddress) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAddress. -func (in *NodeAddress) DeepCopy() *NodeAddress { - if in == nil { - return nil - } - out := new(NodeAddress) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeCondition) DeepCopyInto(out *NodeCondition) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeCondition. -func (in *NodeCondition) DeepCopy() *NodeCondition { - if in == nil { - return nil - } - out := new(NodeCondition) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeList) DeepCopyInto(out *NodeList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Node, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeList. -func (in *NodeList) DeepCopy() *NodeList { - if in == nil { - return nil - } - out := new(NodeList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NodeList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeSpec) DeepCopyInto(out *NodeSpec) { - *out = *in - if in.PodCIDRs != nil { - in, out := &in.PodCIDRs, &out.PodCIDRs - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Taints != nil { - in, out := &in.Taints, &out.Taints - *out = make([]Taint, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSpec. -func (in *NodeSpec) DeepCopy() *NodeSpec { - if in == nil { - return nil - } - out := new(NodeSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeStatus) DeepCopyInto(out *NodeStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]NodeCondition, len(*in)) - copy(*out, *in) - } - if in.Addresses != nil { - in, out := &in.Addresses, &out.Addresses - *out = make([]NodeAddress, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeStatus. -func (in *NodeStatus) DeepCopy() *NodeStatus { - if in == nil { - return nil - } - out := new(NodeStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Pod) DeepCopyInto(out *Pod) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Pod. -func (in *Pod) DeepCopy() *Pod { - if in == nil { - return nil - } - out := new(Pod) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Pod) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodCondition) DeepCopyInto(out *PodCondition) { - *out = *in - in.LastProbeTime.DeepCopyInto(&out.LastProbeTime) - in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodCondition. -func (in *PodCondition) DeepCopy() *PodCondition { - if in == nil { - return nil - } - out := new(PodCondition) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodIP) DeepCopyInto(out *PodIP) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodIP. -func (in *PodIP) DeepCopy() *PodIP { - if in == nil { - return nil - } - out := new(PodIP) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodList) DeepCopyInto(out *PodList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Pod, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodList. -func (in *PodList) DeepCopy() *PodList { - if in == nil { - return nil - } - out := new(PodList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PodList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodReadinessGate) DeepCopyInto(out *PodReadinessGate) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodReadinessGate. -func (in *PodReadinessGate) DeepCopy() *PodReadinessGate { - if in == nil { - return nil - } - out := new(PodReadinessGate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodSpec) DeepCopyInto(out *PodSpec) { - *out = *in - if in.InitContainers != nil { - in, out := &in.InitContainers, &out.InitContainers - *out = make([]Container, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Containers != nil { - in, out := &in.Containers, &out.Containers - *out = make([]Container, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodSpec. -func (in *PodSpec) DeepCopy() *PodSpec { - if in == nil { - return nil - } - out := new(PodSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodStatus) DeepCopyInto(out *PodStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]PodCondition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.PodIPs != nil { - in, out := &in.PodIPs, &out.PodIPs - *out = make([]PodIP, len(*in)) - copy(*out, *in) - } - if in.StartTime != nil { - in, out := &in.StartTime, &out.StartTime - *out = (*in).DeepCopy() - } - if in.ContainerStatuses != nil { - in, out := &in.ContainerStatuses, &out.ContainerStatuses - *out = make([]ContainerStatus, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodStatus. -func (in *PodStatus) DeepCopy() *PodStatus { - if in == nil { - return nil - } - out := new(PodStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PortStatus) DeepCopyInto(out *PortStatus) { - *out = *in - if in.Error != nil { - in, out := &in.Error, &out.Error - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortStatus. -func (in *PortStatus) DeepCopy() *PortStatus { - if in == nil { - return nil - } - out := new(PortStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Secret) DeepCopyInto(out *Secret) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - if in.Immutable != nil { - in, out := &in.Immutable, &out.Immutable - *out = new(bool) - **out = **in - } - if in.Data != nil { - in, out := &in.Data, &out.Data - *out = make(map[string]Bytes, len(*in)) - for key, val := range *in { - var outVal []byte - if val == nil { - (*out)[key] = nil - } else { - in, out := &val, &outVal - *out = make(Bytes, len(*in)) - copy(*out, *in) - } - (*out)[key] = outVal - } - } - if in.StringData != nil { - in, out := &in.StringData, &out.StringData - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Secret. -func (in *Secret) DeepCopy() *Secret { - if in == nil { - return nil - } - out := new(Secret) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Secret) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SecretList) DeepCopyInto(out *SecretList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Secret, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretList. -func (in *SecretList) DeepCopy() *SecretList { - if in == nil { - return nil - } - out := new(SecretList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *SecretList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Service) DeepCopyInto(out *Service) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Service. -func (in *Service) DeepCopy() *Service { - if in == nil { - return nil - } - out := new(Service) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Service) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ServiceList) DeepCopyInto(out *ServiceList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Service, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceList. -func (in *ServiceList) DeepCopy() *ServiceList { - if in == nil { - return nil - } - out := new(ServiceList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ServiceList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ServicePort) DeepCopyInto(out *ServicePort) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServicePort. -func (in *ServicePort) DeepCopy() *ServicePort { - if in == nil { - return nil - } - out := new(ServicePort) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ServiceSpec) DeepCopyInto(out *ServiceSpec) { - *out = *in - if in.Ports != nil { - in, out := &in.Ports, &out.Ports - *out = make([]ServicePort, len(*in)) - copy(*out, *in) - } - if in.Selector != nil { - in, out := &in.Selector, &out.Selector - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.ClusterIPs != nil { - in, out := &in.ClusterIPs, &out.ClusterIPs - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.ExternalIPs != nil { - in, out := &in.ExternalIPs, &out.ExternalIPs - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.LoadBalancerSourceRanges != nil { - in, out := &in.LoadBalancerSourceRanges, &out.LoadBalancerSourceRanges - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.SessionAffinityConfig != nil { - in, out := &in.SessionAffinityConfig, &out.SessionAffinityConfig - *out = new(SessionAffinityConfig) - (*in).DeepCopyInto(*out) - } - if in.IPFamilies != nil { - in, out := &in.IPFamilies, &out.IPFamilies - *out = make([]IPFamily, len(*in)) - copy(*out, *in) - } - if in.IPFamilyPolicy != nil { - in, out := &in.IPFamilyPolicy, &out.IPFamilyPolicy - *out = new(IPFamilyPolicy) - **out = **in - } - if in.LoadBalancerClass != nil { - in, out := &in.LoadBalancerClass, &out.LoadBalancerClass - *out = new(string) - **out = **in - } - if in.InternalTrafficPolicy != nil { - in, out := &in.InternalTrafficPolicy, &out.InternalTrafficPolicy - *out = new(ServiceInternalTrafficPolicy) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceSpec. -func (in *ServiceSpec) DeepCopy() *ServiceSpec { - if in == nil { - return nil - } - out := new(ServiceSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ServiceStatus) DeepCopyInto(out *ServiceStatus) { - *out = *in - in.LoadBalancer.DeepCopyInto(&out.LoadBalancer) - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]metav1.Condition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceStatus. -func (in *ServiceStatus) DeepCopy() *ServiceStatus { - if in == nil { - return nil - } - out := new(ServiceStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SessionAffinityConfig) DeepCopyInto(out *SessionAffinityConfig) { - *out = *in - if in.ClientIP != nil { - in, out := &in.ClientIP, &out.ClientIP - *out = new(ClientIPConfig) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SessionAffinityConfig. -func (in *SessionAffinityConfig) DeepCopy() *SessionAffinityConfig { - if in == nil { - return nil - } - out := new(SessionAffinityConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Taint) DeepCopyInto(out *Taint) { - *out = *in - if in.TimeAdded != nil { - in, out := &in.TimeAdded, &out.TimeAdded - *out = (*in).DeepCopy() - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Taint. -func (in *Taint) DeepCopy() *Taint { - if in == nil { - return nil - } - out := new(Taint) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TypedLocalObjectReference) DeepCopyInto(out *TypedLocalObjectReference) { - *out = *in - if in.APIGroup != nil { - in, out := &in.APIGroup, &out.APIGroup - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TypedLocalObjectReference. -func (in *TypedLocalObjectReference) DeepCopy() *TypedLocalObjectReference { - if in == nil { - return nil - } - out := new(TypedLocalObjectReference) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeMount) DeepCopyInto(out *VolumeMount) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeMount. -func (in *VolumeMount) DeepCopy() *VolumeMount { - if in == nil { - return nil - } - out := new(VolumeMount) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/zz_generated.deepequal.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/zz_generated.deepequal.go deleted file mode 100644 index e834bbdfd..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/zz_generated.deepequal.go +++ /dev/null @@ -1,1396 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepequal-gen. DO NOT EDIT. - -package v1 - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Bytes) DeepEqual(other *Bytes) bool { - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ClientIPConfig) DeepEqual(other *ClientIPConfig) bool { - if other == nil { - return false - } - - if (in.TimeoutSeconds == nil) != (other.TimeoutSeconds == nil) { - return false - } else if in.TimeoutSeconds != nil { - if *in.TimeoutSeconds != *other.TimeoutSeconds { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Container) DeepEqual(other *Container) bool { - if other == nil { - return false - } - - if in.Name != other.Name { - return false - } - if in.Image != other.Image { - return false - } - if ((in.Ports != nil) && (other.Ports != nil)) || ((in.Ports == nil) != (other.Ports == nil)) { - in, other := &in.Ports, &other.Ports - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.VolumeMounts != nil) && (other.VolumeMounts != nil)) || ((in.VolumeMounts == nil) != (other.VolumeMounts == nil)) { - in, other := &in.VolumeMounts, &other.VolumeMounts - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ContainerPort) DeepEqual(other *ContainerPort) bool { - if other == nil { - return false - } - - if in.Name != other.Name { - return false - } - if in.HostPort != other.HostPort { - return false - } - if in.ContainerPort != other.ContainerPort { - return false - } - if in.Protocol != other.Protocol { - return false - } - if in.HostIP != other.HostIP { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ContainerState) DeepEqual(other *ContainerState) bool { - if other == nil { - return false - } - - if (in.Running == nil) != (other.Running == nil) { - return false - } else if in.Running != nil { - if !in.Running.DeepEqual(other.Running) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ContainerStateRunning) DeepEqual(other *ContainerStateRunning) bool { - if other == nil { - return false - } - - if !in.StartedAt.DeepEqual(&other.StartedAt) { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ContainerStatus) DeepEqual(other *ContainerStatus) bool { - if other == nil { - return false - } - - if !in.State.DeepEqual(&other.State) { - return false - } - - if in.ContainerID != other.ContainerID { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EndpointAddress) DeepEqual(other *EndpointAddress) bool { - if other == nil { - return false - } - - if in.IP != other.IP { - return false - } - if in.Hostname != other.Hostname { - return false - } - if (in.NodeName == nil) != (other.NodeName == nil) { - return false - } else if in.NodeName != nil { - if *in.NodeName != *other.NodeName { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EndpointPort) DeepEqual(other *EndpointPort) bool { - if other == nil { - return false - } - - if in.Name != other.Name { - return false - } - if in.Port != other.Port { - return false - } - if in.Protocol != other.Protocol { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EndpointSubset) DeepEqual(other *EndpointSubset) bool { - if other == nil { - return false - } - - if ((in.Addresses != nil) && (other.Addresses != nil)) || ((in.Addresses == nil) != (other.Addresses == nil)) { - in, other := &in.Addresses, &other.Addresses - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.Ports != nil) && (other.Ports != nil)) || ((in.Ports == nil) != (other.Ports == nil)) { - in, other := &in.Ports, &other.Ports - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Endpoints) DeepEqual(other *Endpoints) bool { - if other == nil { - return false - } - - if in.TypeMeta != other.TypeMeta { - return false - } - - if !in.ObjectMeta.DeepEqual(&other.ObjectMeta) { - return false - } - - if ((in.Subsets != nil) && (other.Subsets != nil)) || ((in.Subsets == nil) != (other.Subsets == nil)) { - in, other := &in.Subsets, &other.Subsets - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EndpointsList) DeepEqual(other *EndpointsList) bool { - if other == nil { - return false - } - - if in.TypeMeta != other.TypeMeta { - return false - } - - if !in.ListMeta.DeepEqual(&other.ListMeta) { - return false - } - - if ((in.Items != nil) && (other.Items != nil)) || ((in.Items == nil) != (other.Items == nil)) { - in, other := &in.Items, &other.Items - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *LoadBalancerIngress) DeepEqual(other *LoadBalancerIngress) bool { - if other == nil { - return false - } - - if in.IP != other.IP { - return false - } - if in.Hostname != other.Hostname { - return false - } - if (in.IPMode == nil) != (other.IPMode == nil) { - return false - } else if in.IPMode != nil { - if *in.IPMode != *other.IPMode { - return false - } - } - - if ((in.Ports != nil) && (other.Ports != nil)) || ((in.Ports == nil) != (other.Ports == nil)) { - in, other := &in.Ports, &other.Ports - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *LoadBalancerStatus) DeepEqual(other *LoadBalancerStatus) bool { - if other == nil { - return false - } - - if ((in.Ingress != nil) && (other.Ingress != nil)) || ((in.Ingress == nil) != (other.Ingress == nil)) { - in, other := &in.Ingress, &other.Ingress - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Namespace) DeepEqual(other *Namespace) bool { - if other == nil { - return false - } - - if in.TypeMeta != other.TypeMeta { - return false - } - - if !in.ObjectMeta.DeepEqual(&other.ObjectMeta) { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *NamespaceList) DeepEqual(other *NamespaceList) bool { - if other == nil { - return false - } - - if in.TypeMeta != other.TypeMeta { - return false - } - - if !in.ListMeta.DeepEqual(&other.ListMeta) { - return false - } - - if ((in.Items != nil) && (other.Items != nil)) || ((in.Items == nil) != (other.Items == nil)) { - in, other := &in.Items, &other.Items - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Node) DeepEqual(other *Node) bool { - if other == nil { - return false - } - - if in.TypeMeta != other.TypeMeta { - return false - } - - if !in.ObjectMeta.DeepEqual(&other.ObjectMeta) { - return false - } - - if !in.Spec.DeepEqual(&other.Spec) { - return false - } - - if !in.Status.DeepEqual(&other.Status) { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *NodeAddress) DeepEqual(other *NodeAddress) bool { - if other == nil { - return false - } - - if in.Type != other.Type { - return false - } - if in.Address != other.Address { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *NodeCondition) DeepEqual(other *NodeCondition) bool { - if other == nil { - return false - } - - if in.Type != other.Type { - return false - } - if in.Status != other.Status { - return false - } - if in.Reason != other.Reason { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *NodeList) DeepEqual(other *NodeList) bool { - if other == nil { - return false - } - - if in.TypeMeta != other.TypeMeta { - return false - } - - if !in.ListMeta.DeepEqual(&other.ListMeta) { - return false - } - - if ((in.Items != nil) && (other.Items != nil)) || ((in.Items == nil) != (other.Items == nil)) { - in, other := &in.Items, &other.Items - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *NodeSpec) DeepEqual(other *NodeSpec) bool { - if other == nil { - return false - } - - if in.PodCIDR != other.PodCIDR { - return false - } - if ((in.PodCIDRs != nil) && (other.PodCIDRs != nil)) || ((in.PodCIDRs == nil) != (other.PodCIDRs == nil)) { - in, other := &in.PodCIDRs, &other.PodCIDRs - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if in.ProviderID != other.ProviderID { - return false - } - if ((in.Taints != nil) && (other.Taints != nil)) || ((in.Taints == nil) != (other.Taints == nil)) { - in, other := &in.Taints, &other.Taints - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *NodeStatus) DeepEqual(other *NodeStatus) bool { - if other == nil { - return false - } - - if ((in.Conditions != nil) && (other.Conditions != nil)) || ((in.Conditions == nil) != (other.Conditions == nil)) { - in, other := &in.Conditions, &other.Conditions - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.Addresses != nil) && (other.Addresses != nil)) || ((in.Addresses == nil) != (other.Addresses == nil)) { - in, other := &in.Addresses, &other.Addresses - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Pod) DeepEqual(other *Pod) bool { - if other == nil { - return false - } - - if in.TypeMeta != other.TypeMeta { - return false - } - - if !in.ObjectMeta.DeepEqual(&other.ObjectMeta) { - return false - } - - if !in.Spec.DeepEqual(&other.Spec) { - return false - } - - if !in.Status.DeepEqual(&other.Status) { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PodCondition) DeepEqual(other *PodCondition) bool { - if other == nil { - return false - } - - if in.Type != other.Type { - return false - } - if in.Status != other.Status { - return false - } - if !in.LastProbeTime.DeepEqual(&other.LastProbeTime) { - return false - } - - if !in.LastTransitionTime.DeepEqual(&other.LastTransitionTime) { - return false - } - - if in.Reason != other.Reason { - return false - } - if in.Message != other.Message { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PodIP) DeepEqual(other *PodIP) bool { - if other == nil { - return false - } - - if in.IP != other.IP { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PodList) DeepEqual(other *PodList) bool { - if other == nil { - return false - } - - if in.TypeMeta != other.TypeMeta { - return false - } - - if !in.ListMeta.DeepEqual(&other.ListMeta) { - return false - } - - if ((in.Items != nil) && (other.Items != nil)) || ((in.Items == nil) != (other.Items == nil)) { - in, other := &in.Items, &other.Items - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PodReadinessGate) DeepEqual(other *PodReadinessGate) bool { - if other == nil { - return false - } - - if in.ConditionType != other.ConditionType { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PodSpec) DeepEqual(other *PodSpec) bool { - if other == nil { - return false - } - - if ((in.InitContainers != nil) && (other.InitContainers != nil)) || ((in.InitContainers == nil) != (other.InitContainers == nil)) { - in, other := &in.InitContainers, &other.InitContainers - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.Containers != nil) && (other.Containers != nil)) || ((in.Containers == nil) != (other.Containers == nil)) { - in, other := &in.Containers, &other.Containers - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if in.ServiceAccountName != other.ServiceAccountName { - return false - } - if in.NodeName != other.NodeName { - return false - } - if in.HostNetwork != other.HostNetwork { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PodStatus) DeepEqual(other *PodStatus) bool { - if other == nil { - return false - } - - if in.Phase != other.Phase { - return false - } - if ((in.Conditions != nil) && (other.Conditions != nil)) || ((in.Conditions == nil) != (other.Conditions == nil)) { - in, other := &in.Conditions, &other.Conditions - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if in.HostIP != other.HostIP { - return false - } - if in.PodIP != other.PodIP { - return false - } - if ((in.PodIPs != nil) && (other.PodIPs != nil)) || ((in.PodIPs == nil) != (other.PodIPs == nil)) { - in, other := &in.PodIPs, &other.PodIPs - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if (in.StartTime == nil) != (other.StartTime == nil) { - return false - } else if in.StartTime != nil { - if !in.StartTime.DeepEqual(other.StartTime) { - return false - } - } - - if ((in.ContainerStatuses != nil) && (other.ContainerStatuses != nil)) || ((in.ContainerStatuses == nil) != (other.ContainerStatuses == nil)) { - in, other := &in.ContainerStatuses, &other.ContainerStatuses - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if in.QOSClass != other.QOSClass { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PortStatus) DeepEqual(other *PortStatus) bool { - if other == nil { - return false - } - - if in.Port != other.Port { - return false - } - if in.Protocol != other.Protocol { - return false - } - if (in.Error == nil) != (other.Error == nil) { - return false - } else if in.Error != nil { - if *in.Error != *other.Error { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Secret) DeepEqual(other *Secret) bool { - if other == nil { - return false - } - - if in.TypeMeta != other.TypeMeta { - return false - } - - if !in.ObjectMeta.DeepEqual(&other.ObjectMeta) { - return false - } - - if (in.Immutable == nil) != (other.Immutable == nil) { - return false - } else if in.Immutable != nil { - if *in.Immutable != *other.Immutable { - return false - } - } - - if ((in.Data != nil) && (other.Data != nil)) || ((in.Data == nil) != (other.Data == nil)) { - in, other := &in.Data, &other.Data - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if !inValue.DeepEqual(&otherValue) { - return false - } - } - } - } - } - - if ((in.StringData != nil) && (other.StringData != nil)) || ((in.StringData == nil) != (other.StringData == nil)) { - in, other := &in.StringData, &other.StringData - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if inValue != otherValue { - return false - } - } - } - } - } - - if in.Type != other.Type { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *SecretList) DeepEqual(other *SecretList) bool { - if other == nil { - return false - } - - if in.TypeMeta != other.TypeMeta { - return false - } - - if !in.ListMeta.DeepEqual(&other.ListMeta) { - return false - } - - if ((in.Items != nil) && (other.Items != nil)) || ((in.Items == nil) != (other.Items == nil)) { - in, other := &in.Items, &other.Items - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Service) DeepEqual(other *Service) bool { - if other == nil { - return false - } - - if in.TypeMeta != other.TypeMeta { - return false - } - - if !in.ObjectMeta.DeepEqual(&other.ObjectMeta) { - return false - } - - if !in.Spec.DeepEqual(&other.Spec) { - return false - } - - if !in.Status.DeepEqual(&other.Status) { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ServiceList) DeepEqual(other *ServiceList) bool { - if other == nil { - return false - } - - if in.TypeMeta != other.TypeMeta { - return false - } - - if !in.ListMeta.DeepEqual(&other.ListMeta) { - return false - } - - if ((in.Items != nil) && (other.Items != nil)) || ((in.Items == nil) != (other.Items == nil)) { - in, other := &in.Items, &other.Items - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ServicePort) DeepEqual(other *ServicePort) bool { - if other == nil { - return false - } - - if in.Name != other.Name { - return false - } - if in.Protocol != other.Protocol { - return false - } - if in.Port != other.Port { - return false - } - if in.NodePort != other.NodePort { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ServiceSpec) DeepEqual(other *ServiceSpec) bool { - if other == nil { - return false - } - - if ((in.Ports != nil) && (other.Ports != nil)) || ((in.Ports == nil) != (other.Ports == nil)) { - in, other := &in.Ports, &other.Ports - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.Selector != nil) && (other.Selector != nil)) || ((in.Selector == nil) != (other.Selector == nil)) { - in, other := &in.Selector, &other.Selector - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if inValue != otherValue { - return false - } - } - } - } - } - - if in.ClusterIP != other.ClusterIP { - return false - } - if ((in.ClusterIPs != nil) && (other.ClusterIPs != nil)) || ((in.ClusterIPs == nil) != (other.ClusterIPs == nil)) { - in, other := &in.ClusterIPs, &other.ClusterIPs - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if in.Type != other.Type { - return false - } - if ((in.ExternalIPs != nil) && (other.ExternalIPs != nil)) || ((in.ExternalIPs == nil) != (other.ExternalIPs == nil)) { - in, other := &in.ExternalIPs, &other.ExternalIPs - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if in.SessionAffinity != other.SessionAffinity { - return false - } - if in.LoadBalancerIP != other.LoadBalancerIP { - return false - } - if ((in.LoadBalancerSourceRanges != nil) && (other.LoadBalancerSourceRanges != nil)) || ((in.LoadBalancerSourceRanges == nil) != (other.LoadBalancerSourceRanges == nil)) { - in, other := &in.LoadBalancerSourceRanges, &other.LoadBalancerSourceRanges - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if in.ExternalTrafficPolicy != other.ExternalTrafficPolicy { - return false - } - if in.HealthCheckNodePort != other.HealthCheckNodePort { - return false - } - if (in.SessionAffinityConfig == nil) != (other.SessionAffinityConfig == nil) { - return false - } else if in.SessionAffinityConfig != nil { - if !in.SessionAffinityConfig.DeepEqual(other.SessionAffinityConfig) { - return false - } - } - - if ((in.IPFamilies != nil) && (other.IPFamilies != nil)) || ((in.IPFamilies == nil) != (other.IPFamilies == nil)) { - in, other := &in.IPFamilies, &other.IPFamilies - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if (in.IPFamilyPolicy == nil) != (other.IPFamilyPolicy == nil) { - return false - } else if in.IPFamilyPolicy != nil { - if *in.IPFamilyPolicy != *other.IPFamilyPolicy { - return false - } - } - - if (in.LoadBalancerClass == nil) != (other.LoadBalancerClass == nil) { - return false - } else if in.LoadBalancerClass != nil { - if *in.LoadBalancerClass != *other.LoadBalancerClass { - return false - } - } - - if (in.InternalTrafficPolicy == nil) != (other.InternalTrafficPolicy == nil) { - return false - } else if in.InternalTrafficPolicy != nil { - if *in.InternalTrafficPolicy != *other.InternalTrafficPolicy { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ServiceStatus) DeepEqual(other *ServiceStatus) bool { - if other == nil { - return false - } - - if !in.LoadBalancer.DeepEqual(&other.LoadBalancer) { - return false - } - - if ((in.Conditions != nil) && (other.Conditions != nil)) || ((in.Conditions == nil) != (other.Conditions == nil)) { - in, other := &in.Conditions, &other.Conditions - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *SessionAffinityConfig) DeepEqual(other *SessionAffinityConfig) bool { - if other == nil { - return false - } - - if (in.ClientIP == nil) != (other.ClientIP == nil) { - return false - } else if in.ClientIP != nil { - if !in.ClientIP.DeepEqual(other.ClientIP) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Taint) DeepEqual(other *Taint) bool { - if other == nil { - return false - } - - if in.Key != other.Key { - return false - } - if in.Value != other.Value { - return false - } - if in.Effect != other.Effect { - return false - } - if (in.TimeAdded == nil) != (other.TimeAdded == nil) { - return false - } else if in.TimeAdded != nil { - if !in.TimeAdded.DeepEqual(other.TimeAdded) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *TypedLocalObjectReference) DeepEqual(other *TypedLocalObjectReference) bool { - if other == nil { - return false - } - - if (in.APIGroup == nil) != (other.APIGroup == nil) { - return false - } else if in.APIGroup != nil { - if *in.APIGroup != *other.APIGroup { - return false - } - } - - if in.Kind != other.Kind { - return false - } - if in.Name != other.Name { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *VolumeMount) DeepEqual(other *VolumeMount) bool { - if other == nil { - return false - } - - if in.MountPath != other.MountPath { - return false - } - - return true -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/doc.go deleted file mode 100644 index 6474070a3..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/doc.go +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// +k8s:deepcopy-gen=package -// +k8s:protobuf-gen=package -// +k8s:openapi-gen=true -// +deepequal-gen=package -// +groupName=discovery.k8s.io - -// Package v1 contains slimmer versions of k8s discovery types. -package v1 diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/generated.pb.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/generated.pb.go deleted file mode 100644 index 271e8b358..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/generated.pb.go +++ /dev/null @@ -1,2138 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/generated.proto - -package v1 - -import ( - fmt "fmt" - - github_com_cilium_cilium_pkg_k8s_slim_k8s_api_core_v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - - io "io" - - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" - - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" -) - -// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -func (m *Endpoint) Reset() { *m = Endpoint{} } -func (*Endpoint) ProtoMessage() {} -func (*Endpoint) Descriptor() ([]byte, []int) { - return fileDescriptor_824daf76e2aebd1d, []int{0} -} -func (m *Endpoint) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Endpoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Endpoint) XXX_Merge(src proto.Message) { - xxx_messageInfo_Endpoint.Merge(m, src) -} -func (m *Endpoint) XXX_Size() int { - return m.Size() -} -func (m *Endpoint) XXX_DiscardUnknown() { - xxx_messageInfo_Endpoint.DiscardUnknown(m) -} - -var xxx_messageInfo_Endpoint proto.InternalMessageInfo - -func (m *EndpointConditions) Reset() { *m = EndpointConditions{} } -func (*EndpointConditions) ProtoMessage() {} -func (*EndpointConditions) Descriptor() ([]byte, []int) { - return fileDescriptor_824daf76e2aebd1d, []int{1} -} -func (m *EndpointConditions) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EndpointConditions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EndpointConditions) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointConditions.Merge(m, src) -} -func (m *EndpointConditions) XXX_Size() int { - return m.Size() -} -func (m *EndpointConditions) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointConditions.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointConditions proto.InternalMessageInfo - -func (m *EndpointHints) Reset() { *m = EndpointHints{} } -func (*EndpointHints) ProtoMessage() {} -func (*EndpointHints) Descriptor() ([]byte, []int) { - return fileDescriptor_824daf76e2aebd1d, []int{2} -} -func (m *EndpointHints) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EndpointHints) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EndpointHints) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointHints.Merge(m, src) -} -func (m *EndpointHints) XXX_Size() int { - return m.Size() -} -func (m *EndpointHints) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointHints.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointHints proto.InternalMessageInfo - -func (m *EndpointPort) Reset() { *m = EndpointPort{} } -func (*EndpointPort) ProtoMessage() {} -func (*EndpointPort) Descriptor() ([]byte, []int) { - return fileDescriptor_824daf76e2aebd1d, []int{3} -} -func (m *EndpointPort) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EndpointPort) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EndpointPort) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointPort.Merge(m, src) -} -func (m *EndpointPort) XXX_Size() int { - return m.Size() -} -func (m *EndpointPort) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointPort.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointPort proto.InternalMessageInfo - -func (m *EndpointSlice) Reset() { *m = EndpointSlice{} } -func (*EndpointSlice) ProtoMessage() {} -func (*EndpointSlice) Descriptor() ([]byte, []int) { - return fileDescriptor_824daf76e2aebd1d, []int{4} -} -func (m *EndpointSlice) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EndpointSlice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EndpointSlice) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointSlice.Merge(m, src) -} -func (m *EndpointSlice) XXX_Size() int { - return m.Size() -} -func (m *EndpointSlice) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointSlice.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointSlice proto.InternalMessageInfo - -func (m *EndpointSliceList) Reset() { *m = EndpointSliceList{} } -func (*EndpointSliceList) ProtoMessage() {} -func (*EndpointSliceList) Descriptor() ([]byte, []int) { - return fileDescriptor_824daf76e2aebd1d, []int{5} -} -func (m *EndpointSliceList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EndpointSliceList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EndpointSliceList) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointSliceList.Merge(m, src) -} -func (m *EndpointSliceList) XXX_Size() int { - return m.Size() -} -func (m *EndpointSliceList) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointSliceList.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointSliceList proto.InternalMessageInfo - -func (m *ForZone) Reset() { *m = ForZone{} } -func (*ForZone) ProtoMessage() {} -func (*ForZone) Descriptor() ([]byte, []int) { - return fileDescriptor_824daf76e2aebd1d, []int{6} -} -func (m *ForZone) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ForZone) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ForZone) XXX_Merge(src proto.Message) { - xxx_messageInfo_ForZone.Merge(m, src) -} -func (m *ForZone) XXX_Size() int { - return m.Size() -} -func (m *ForZone) XXX_DiscardUnknown() { - xxx_messageInfo_ForZone.DiscardUnknown(m) -} - -var xxx_messageInfo_ForZone proto.InternalMessageInfo - -func init() { - proto.RegisterType((*Endpoint)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.discovery.v1.Endpoint") - proto.RegisterMapType((map[string]string)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.discovery.v1.Endpoint.DeprecatedTopologyEntry") - proto.RegisterType((*EndpointConditions)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.discovery.v1.EndpointConditions") - proto.RegisterType((*EndpointHints)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.discovery.v1.EndpointHints") - proto.RegisterType((*EndpointPort)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.discovery.v1.EndpointPort") - proto.RegisterType((*EndpointSlice)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.discovery.v1.EndpointSlice") - proto.RegisterType((*EndpointSliceList)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.discovery.v1.EndpointSliceList") - proto.RegisterType((*ForZone)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.discovery.v1.ForZone") -} - -func init() { - proto.RegisterFile("github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/generated.proto", fileDescriptor_824daf76e2aebd1d) -} - -var fileDescriptor_824daf76e2aebd1d = []byte{ - // 863 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x6b, 0xe4, 0x36, - 0x14, 0x1e, 0xed, 0xc4, 0x8d, 0x47, 0x4e, 0xe8, 0xae, 0x28, 0xd4, 0x84, 0x62, 0x0f, 0x03, 0x85, - 0x81, 0xa5, 0x1e, 0x92, 0x43, 0x09, 0x39, 0x94, 0xae, 0x37, 0x59, 0xb2, 0xa5, 0x4d, 0x17, 0x6d, - 0x4e, 0x4b, 0x0f, 0x75, 0x6c, 0xad, 0x47, 0x99, 0xb1, 0xe4, 0x5a, 0x9a, 0x81, 0xe9, 0xa9, 0xec, - 0xb9, 0xd0, 0xfe, 0x19, 0xbd, 0xf5, 0xd6, 0xbf, 0x21, 0xc7, 0x3d, 0xee, 0xc9, 0x34, 0xee, 0x9f, - 0xd0, 0x5b, 0x4e, 0x45, 0xf2, 0xaf, 0x49, 0x27, 0xa5, 0x64, 0x76, 0x4e, 0x96, 0x3e, 0x3d, 0x7d, - 0xdf, 0xf7, 0xde, 0x93, 0x84, 0xe1, 0x57, 0x31, 0x95, 0xe3, 0xd9, 0x85, 0x17, 0xf2, 0x64, 0x14, - 0xd2, 0x29, 0x9d, 0x35, 0x9f, 0x74, 0x12, 0x8f, 0x26, 0x87, 0x62, 0x24, 0xa6, 0x34, 0xd1, 0x83, - 0x20, 0xa5, 0xa3, 0x88, 0x8a, 0x90, 0xcf, 0x49, 0xb6, 0x18, 0xcd, 0xf7, 0x47, 0x31, 0x61, 0x24, - 0x0b, 0x24, 0x89, 0xbc, 0x34, 0xe3, 0x92, 0xa3, 0xa3, 0x96, 0xcb, 0x2b, 0x49, 0xea, 0x4f, 0x3a, - 0x89, 0xbd, 0xc9, 0xa1, 0xf0, 0x14, 0x97, 0x1e, 0x04, 0x29, 0xf5, 0x1a, 0x2e, 0x6f, 0xbe, 0xbf, - 0x77, 0x72, 0x3f, 0x1f, 0x21, 0xcf, 0xc8, 0x1d, 0x16, 0xf6, 0x9e, 0xdd, 0x8b, 0x46, 0x8c, 0x12, - 0x22, 0x83, 0xbb, 0x78, 0x3e, 0x5b, 0xe2, 0x89, 0x79, 0xcc, 0x47, 0x1a, 0xbe, 0x98, 0xbd, 0xd6, - 0x33, 0x3d, 0xd1, 0xa3, 0x2a, 0x5c, 0x11, 0x7a, 0x94, 0x2b, 0xce, 0x24, 0x08, 0xc7, 0x94, 0xa9, - 0x0a, 0x29, 0xc5, 0x6c, 0xc6, 0x24, 0x4d, 0xc8, 0x0a, 0xff, 0xe7, 0xff, 0xb7, 0x41, 0x84, 0x63, - 0x92, 0x04, 0xff, 0xde, 0x37, 0xf8, 0xd9, 0x80, 0xe6, 0x09, 0x8b, 0x52, 0x4e, 0x99, 0x44, 0x8f, - 0x61, 0x2f, 0x88, 0xa2, 0x8c, 0x08, 0x41, 0x84, 0x0d, 0xfa, 0xdd, 0x61, 0xcf, 0xdf, 0x2d, 0x72, - 0xb7, 0xf7, 0xa4, 0x06, 0x71, 0xbb, 0x8e, 0xde, 0x00, 0x08, 0x43, 0xce, 0x22, 0x2a, 0x29, 0x67, - 0xc2, 0x7e, 0xd0, 0x07, 0x43, 0xeb, 0xe0, 0xcc, 0x5b, 0xbf, 0x65, 0x5e, 0xed, 0xe3, 0x69, 0xc3, - 0xea, 0xa3, 0xab, 0xdc, 0xed, 0x14, 0xb9, 0x0b, 0x5b, 0x0c, 0x2f, 0xa9, 0xa2, 0x21, 0x34, 0xc7, - 0x5c, 0x48, 0x16, 0x24, 0xc4, 0xee, 0xf6, 0xc1, 0xb0, 0xe7, 0xef, 0x14, 0xb9, 0x6b, 0x9e, 0x56, - 0x18, 0x6e, 0x56, 0xd1, 0x6f, 0x00, 0xa2, 0x88, 0xa4, 0x19, 0x09, 0x55, 0xf6, 0xe7, 0x3c, 0xe5, - 0x53, 0x1e, 0x2f, 0x6c, 0xa3, 0xdf, 0x1d, 0x5a, 0x07, 0xdf, 0x6d, 0xc2, 0xb6, 0x77, 0xbc, 0x42, - 0x7f, 0xc2, 0x64, 0xb6, 0xf0, 0xf7, 0xaa, 0x24, 0xd0, 0x6a, 0x00, 0xbe, 0xc3, 0x93, 0x4a, 0x8a, - 0xf1, 0x88, 0x9c, 0xa9, 0xa4, 0x3e, 0x68, 0x93, 0x3a, 0xab, 0x30, 0xdc, 0xac, 0xa2, 0x4f, 0xe0, - 0xd6, 0x8f, 0x9c, 0x11, 0x7b, 0x5b, 0x47, 0x99, 0x45, 0xee, 0x6e, 0xbd, 0xe2, 0x8c, 0x60, 0x8d, - 0xa2, 0x4b, 0x68, 0x8c, 0x29, 0x93, 0xc2, 0x36, 0x75, 0x6f, 0x9e, 0x6f, 0x22, 0xc9, 0x53, 0x45, - 0xe8, 0xf7, 0x8a, 0xdc, 0x35, 0xf4, 0x10, 0x97, 0x12, 0x7b, 0x27, 0xf0, 0xe3, 0xff, 0x48, 0x1f, - 0x3d, 0x84, 0xdd, 0x09, 0x59, 0xd8, 0x40, 0x79, 0xc4, 0x6a, 0x88, 0x3e, 0x82, 0xc6, 0x3c, 0x98, - 0xce, 0x88, 0x3e, 0x34, 0x3d, 0x5c, 0x4e, 0x8e, 0x1e, 0x1c, 0x82, 0xc1, 0x2f, 0x00, 0xa2, 0xd5, - 0x63, 0x80, 0x5c, 0x68, 0x64, 0x24, 0x88, 0x4a, 0x12, 0xb3, 0x94, 0xc7, 0x0a, 0xc0, 0x25, 0x8e, - 0x3e, 0x85, 0xdb, 0x82, 0x64, 0x73, 0xca, 0x62, 0xcd, 0x69, 0xfa, 0x56, 0x91, 0xbb, 0xdb, 0x2f, - 0x4b, 0x08, 0xd7, 0x6b, 0x68, 0x1f, 0x5a, 0x92, 0x64, 0x09, 0x65, 0x81, 0x54, 0xa1, 0x5d, 0x1d, - 0xfa, 0x61, 0x91, 0xbb, 0xd6, 0x79, 0x0b, 0xe3, 0xe5, 0x98, 0xc1, 0x1b, 0x00, 0x77, 0x6f, 0x25, - 0x8f, 0x7e, 0x80, 0xe6, 0x6b, 0x9e, 0xa9, 0x3a, 0x97, 0x97, 0xc4, 0x3a, 0x78, 0xfa, 0x3e, 0x95, - 0x7d, 0x56, 0x72, 0xf9, 0x0f, 0xab, 0x53, 0x62, 0x56, 0x80, 0xc0, 0x8d, 0xcc, 0xe0, 0x0f, 0x00, - 0x77, 0x6a, 0x13, 0x2f, 0x78, 0x26, 0x55, 0xe3, 0xf5, 0x99, 0x07, 0x6d, 0xe3, 0xf5, 0xd1, 0xd0, - 0x28, 0xba, 0x84, 0xa6, 0xbe, 0xdd, 0x21, 0x9f, 0x96, 0x25, 0xf6, 0xcf, 0x14, 0xf1, 0x8b, 0x0a, - 0xbb, 0xc9, 0xdd, 0x2f, 0xd6, 0x7a, 0x1d, 0xbd, 0x9a, 0x01, 0x37, 0xfc, 0xca, 0x49, 0xca, 0x33, - 0xa9, 0x6b, 0x69, 0x94, 0x4e, 0x94, 0x43, 0xac, 0xd1, 0xc1, 0xef, 0xdd, 0xb6, 0x7a, 0x2f, 0xa7, - 0x34, 0x24, 0x28, 0x83, 0xa6, 0x7a, 0x23, 0xa3, 0x40, 0x06, 0xda, 0xbd, 0x75, 0xe0, 0xdf, 0xaf, - 0x7a, 0xc2, 0x53, 0xfb, 0x55, 0xe5, 0xbe, 0xbd, 0xb8, 0x24, 0xa1, 0xfc, 0x86, 0xc8, 0xa0, 0x7d, - 0x27, 0x5a, 0x0c, 0x37, 0x3a, 0xe8, 0x18, 0x5a, 0xd5, 0xbb, 0x75, 0xbe, 0x48, 0x89, 0xbd, 0xa5, - 0x4b, 0x32, 0xa8, 0xb6, 0x58, 0x4f, 0xda, 0xa5, 0x9b, 0xdb, 0x53, 0xbc, 0xbc, 0x0d, 0xcd, 0x60, - 0x8f, 0x54, 0xa9, 0xa8, 0xe7, 0x4e, 0x35, 0xfe, 0x78, 0x13, 0x57, 0xca, 0x7f, 0x54, 0x39, 0xe9, - 0xd5, 0x88, 0xc0, 0xad, 0x12, 0x4a, 0xa0, 0xa1, 0x4a, 0x29, 0xec, 0xae, 0x96, 0x3c, 0xdd, 0x84, - 0xa4, 0xea, 0x90, 0xbf, 0x5b, 0xc9, 0x1a, 0x6a, 0x26, 0x70, 0xa9, 0x32, 0xf8, 0x1b, 0xc0, 0x47, - 0xb7, 0x3a, 0xf6, 0x35, 0x15, 0x12, 0xb1, 0x95, 0xae, 0x7d, 0xb9, 0x6e, 0xd7, 0x14, 0x9f, 0xee, - 0x59, 0x73, 0xe0, 0x6b, 0x64, 0xa9, 0x63, 0x0c, 0x1a, 0x54, 0x92, 0xa4, 0xae, 0xf3, 0x46, 0x9e, - 0x2e, 0x9d, 0x4d, 0x9b, 0xf5, 0x73, 0xc5, 0x8f, 0x4b, 0x99, 0xc1, 0x63, 0xb8, 0x5d, 0x5d, 0x3b, - 0xd4, 0xbf, 0x75, 0xb5, 0x76, 0xaa, 0xf0, 0xa5, 0xeb, 0xe5, 0x7f, 0x7f, 0x75, 0xed, 0x74, 0xde, - 0x5e, 0x3b, 0x9d, 0x77, 0xd7, 0x4e, 0xe7, 0xa7, 0xc2, 0x01, 0x57, 0x85, 0x03, 0xde, 0x16, 0x0e, - 0x78, 0x57, 0x38, 0xe0, 0xcf, 0xc2, 0x01, 0xbf, 0xfe, 0xe5, 0x74, 0x5e, 0x1d, 0xad, 0xff, 0x23, - 0xf4, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x48, 0xa1, 0x02, 0xcf, 0x45, 0x09, 0x00, 0x00, -} - -func (m *Endpoint) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Endpoint) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Endpoint) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Hints != nil { - { - size, err := m.Hints.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x42 - } - if m.Zone != nil { - i -= len(*m.Zone) - copy(dAtA[i:], *m.Zone) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Zone))) - i-- - dAtA[i] = 0x3a - } - if m.NodeName != nil { - i -= len(*m.NodeName) - copy(dAtA[i:], *m.NodeName) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.NodeName))) - i-- - dAtA[i] = 0x32 - } - if len(m.DeprecatedTopology) > 0 { - keysForDeprecatedTopology := make([]string, 0, len(m.DeprecatedTopology)) - for k := range m.DeprecatedTopology { - keysForDeprecatedTopology = append(keysForDeprecatedTopology, string(k)) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForDeprecatedTopology) - for iNdEx := len(keysForDeprecatedTopology) - 1; iNdEx >= 0; iNdEx-- { - v := m.DeprecatedTopology[string(keysForDeprecatedTopology[iNdEx])] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarintGenerated(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(keysForDeprecatedTopology[iNdEx]) - copy(dAtA[i:], keysForDeprecatedTopology[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(keysForDeprecatedTopology[iNdEx]))) - i-- - dAtA[i] = 0xa - i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x2a - } - } - if m.Hostname != nil { - i -= len(*m.Hostname) - copy(dAtA[i:], *m.Hostname) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Hostname))) - i-- - dAtA[i] = 0x1a - } - { - size, err := m.Conditions.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Addresses) > 0 { - for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Addresses[iNdEx]) - copy(dAtA[i:], m.Addresses[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Addresses[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *EndpointConditions) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EndpointConditions) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EndpointConditions) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Terminating != nil { - i-- - if *m.Terminating { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if m.Serving != nil { - i-- - if *m.Serving { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if m.Ready != nil { - i-- - if *m.Ready { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *EndpointHints) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EndpointHints) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EndpointHints) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ForZones) > 0 { - for iNdEx := len(m.ForZones) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ForZones[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *EndpointPort) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EndpointPort) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EndpointPort) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Port != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.Port)) - i-- - dAtA[i] = 0x18 - } - if m.Protocol != nil { - i -= len(*m.Protocol) - copy(dAtA[i:], *m.Protocol) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Protocol))) - i-- - dAtA[i] = 0x12 - } - if m.Name != nil { - i -= len(*m.Name) - copy(dAtA[i:], *m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EndpointSlice) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EndpointSlice) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EndpointSlice) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.AddressType) - copy(dAtA[i:], m.AddressType) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.AddressType))) - i-- - dAtA[i] = 0x22 - if len(m.Ports) > 0 { - for iNdEx := len(m.Ports) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Ports[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Endpoints) > 0 { - for iNdEx := len(m.Endpoints) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Endpoints[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EndpointSliceList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EndpointSliceList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EndpointSliceList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ForZone) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ForZone) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ForZone) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Endpoint) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Addresses) > 0 { - for _, s := range m.Addresses { - l = len(s) - n += 1 + l + sovGenerated(uint64(l)) - } - } - l = m.Conditions.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.Hostname != nil { - l = len(*m.Hostname) - n += 1 + l + sovGenerated(uint64(l)) - } - if len(m.DeprecatedTopology) > 0 { - for k, v := range m.DeprecatedTopology { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v))) - n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) - } - } - if m.NodeName != nil { - l = len(*m.NodeName) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Zone != nil { - l = len(*m.Zone) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Hints != nil { - l = m.Hints.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *EndpointConditions) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Ready != nil { - n += 2 - } - if m.Serving != nil { - n += 2 - } - if m.Terminating != nil { - n += 2 - } - return n -} - -func (m *EndpointHints) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.ForZones) > 0 { - for _, e := range m.ForZones { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *EndpointPort) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Name != nil { - l = len(*m.Name) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Protocol != nil { - l = len(*m.Protocol) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Port != nil { - n += 1 + sovGenerated(uint64(*m.Port)) - } - return n -} - -func (m *EndpointSlice) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Endpoints) > 0 { - for _, e := range m.Endpoints { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - if len(m.Ports) > 0 { - for _, e := range m.Ports { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - l = len(m.AddressType) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *EndpointSliceList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *ForZone) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *Endpoint) String() string { - if this == nil { - return "nil" - } - keysForDeprecatedTopology := make([]string, 0, len(this.DeprecatedTopology)) - for k := range this.DeprecatedTopology { - keysForDeprecatedTopology = append(keysForDeprecatedTopology, k) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForDeprecatedTopology) - mapStringForDeprecatedTopology := "map[string]string{" - for _, k := range keysForDeprecatedTopology { - mapStringForDeprecatedTopology += fmt.Sprintf("%v: %v,", k, this.DeprecatedTopology[k]) - } - mapStringForDeprecatedTopology += "}" - s := strings.Join([]string{`&Endpoint{`, - `Addresses:` + fmt.Sprintf("%v", this.Addresses) + `,`, - `Conditions:` + strings.Replace(strings.Replace(this.Conditions.String(), "EndpointConditions", "EndpointConditions", 1), `&`, ``, 1) + `,`, - `Hostname:` + valueToStringGenerated(this.Hostname) + `,`, - `DeprecatedTopology:` + mapStringForDeprecatedTopology + `,`, - `NodeName:` + valueToStringGenerated(this.NodeName) + `,`, - `Zone:` + valueToStringGenerated(this.Zone) + `,`, - `Hints:` + strings.Replace(this.Hints.String(), "EndpointHints", "EndpointHints", 1) + `,`, - `}`, - }, "") - return s -} -func (this *EndpointConditions) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EndpointConditions{`, - `Ready:` + valueToStringGenerated(this.Ready) + `,`, - `Serving:` + valueToStringGenerated(this.Serving) + `,`, - `Terminating:` + valueToStringGenerated(this.Terminating) + `,`, - `}`, - }, "") - return s -} -func (this *EndpointHints) String() string { - if this == nil { - return "nil" - } - repeatedStringForForZones := "[]ForZone{" - for _, f := range this.ForZones { - repeatedStringForForZones += strings.Replace(strings.Replace(f.String(), "ForZone", "ForZone", 1), `&`, ``, 1) + "," - } - repeatedStringForForZones += "}" - s := strings.Join([]string{`&EndpointHints{`, - `ForZones:` + repeatedStringForForZones + `,`, - `}`, - }, "") - return s -} -func (this *EndpointPort) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EndpointPort{`, - `Name:` + valueToStringGenerated(this.Name) + `,`, - `Protocol:` + valueToStringGenerated(this.Protocol) + `,`, - `Port:` + valueToStringGenerated(this.Port) + `,`, - `}`, - }, "") - return s -} -func (this *EndpointSlice) String() string { - if this == nil { - return "nil" - } - repeatedStringForEndpoints := "[]Endpoint{" - for _, f := range this.Endpoints { - repeatedStringForEndpoints += strings.Replace(strings.Replace(f.String(), "Endpoint", "Endpoint", 1), `&`, ``, 1) + "," - } - repeatedStringForEndpoints += "}" - repeatedStringForPorts := "[]EndpointPort{" - for _, f := range this.Ports { - repeatedStringForPorts += strings.Replace(strings.Replace(f.String(), "EndpointPort", "EndpointPort", 1), `&`, ``, 1) + "," - } - repeatedStringForPorts += "}" - s := strings.Join([]string{`&EndpointSlice{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Endpoints:` + repeatedStringForEndpoints + `,`, - `Ports:` + repeatedStringForPorts + `,`, - `AddressType:` + fmt.Sprintf("%v", this.AddressType) + `,`, - `}`, - }, "") - return s -} -func (this *EndpointSliceList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]EndpointSlice{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "EndpointSlice", "EndpointSlice", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&EndpointSliceList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *ForZone) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ForZone{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `}`, - }, "") - return s -} -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *Endpoint) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Endpoint: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Endpoint: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addresses = append(m.Addresses, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Conditions.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hostname", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Hostname = &s - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DeprecatedTopology", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.DeprecatedTopology == nil { - m.DeprecatedTopology = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.DeprecatedTopology[mapkey] = mapvalue - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.NodeName = &s - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Zone", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Zone = &s - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hints", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Hints == nil { - m.Hints = &EndpointHints{} - } - if err := m.Hints.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EndpointConditions) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EndpointConditions: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EndpointConditions: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Ready", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.Ready = &b - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Serving", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.Serving = &b - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Terminating", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.Terminating = &b - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EndpointHints) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EndpointHints: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EndpointHints: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ForZones", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ForZones = append(m.ForZones, ForZone{}) - if err := m.ForZones[len(m.ForZones)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EndpointPort) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EndpointPort: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EndpointPort: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Name = &s - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Protocol", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := github_com_cilium_cilium_pkg_k8s_slim_k8s_api_core_v1.Protocol(dAtA[iNdEx:postIndex]) - m.Protocol = &s - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Port", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Port = &v - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EndpointSlice) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EndpointSlice: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EndpointSlice: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Endpoints", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Endpoints = append(m.Endpoints, Endpoint{}) - if err := m.Endpoints[len(m.Endpoints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ports", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Ports = append(m.Ports, EndpointPort{}) - if err := m.Ports[len(m.Ports)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AddressType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AddressType = AddressType(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EndpointSliceList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EndpointSliceList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EndpointSliceList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, EndpointSlice{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ForZone) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ForZone: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ForZone: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenerated(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenerated - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenerated - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenerated - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") -) diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/generated.proto b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/generated.proto deleted file mode 100644 index ad0142862..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/generated.proto +++ /dev/null @@ -1,169 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - - -// This file was autogenerated by go-to-protobuf. Do not edit it manually! - -syntax = "proto2"; - -package github.com.cilium.cilium.pkg.k8s.slim.k8s.api.discovery.v1; - -import "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/generated.proto"; -import "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; - -// Package-wide variables from generator "generated". -option go_package = "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1"; - -// Endpoint represents a single logical "backend" implementing a service. -message Endpoint { - // addresses of this endpoint. The contents of this field are interpreted - // according to the corresponding EndpointSlice addressType field. Consumers - // must handle different types of addresses in the context of their own - // capabilities. This must contain at least one address but no more than - // 100. These are all assumed to be fungible and clients may choose to only - // use the first element. Refer to: https://issue.k8s.io/106267 - // +listType=set - repeated string addresses = 1; - - // conditions contains information about the current status of the endpoint. - optional EndpointConditions conditions = 2; - - // hostname of this endpoint. This field may be used by consumers of - // endpoints to distinguish endpoints from each other (e.g. in DNS names). - // Multiple endpoints which use the same hostname should be considered - // fungible (e.g. multiple A values in DNS). Must be lowercase and pass DNS - // Label (RFC 1123) validation. - // +optional - optional string hostname = 3; - - // deprecatedTopology contains topology information part of the v1beta1 - // API. This field is deprecated, and will be removed when the v1beta1 - // API is removed (no sooner than kubernetes v1.24). While this field can - // hold values, it is not writable through the v1 API, and any attempts to - // write to it will be silently ignored. Topology information can be found - // in the zone and nodeName fields instead. - // +optional - map deprecatedTopology = 5; - - // nodeName represents the name of the Node hosting this endpoint. This can - // be used to determine endpoints local to a Node. - // +optional - optional string nodeName = 6; - - // zone is the name of the Zone this endpoint exists in. - // +optional - optional string zone = 7; - - // hints contains information associated with how an endpoint should be - // consumed. - // +optional - optional EndpointHints hints = 8; -} - -// EndpointConditions represents the current condition of an endpoint. -message EndpointConditions { - // ready indicates that this endpoint is prepared to receive traffic, - // according to whatever system is managing the endpoint. A nil value - // indicates an unknown state. In most cases consumers should interpret this - // unknown state as ready. For compatibility reasons, ready should never be - // "true" for terminating endpoints, except when the normal readiness - // behavior is being explicitly overridden, for example when the associated - // Service has set the publishNotReadyAddresses flag. - // +optional - optional bool ready = 1; - - // serving is identical to ready except that it is set regardless of the - // terminating state of endpoints. This condition should be set to true for - // a ready endpoint that is terminating. If nil, consumers should defer to - // the ready condition. - // +optional - optional bool serving = 2; - - // terminating indicates that this endpoint is terminating. A nil value - // indicates an unknown state. Consumers should interpret this unknown state - // to mean that the endpoint is not terminating. - // +optional - optional bool terminating = 3; -} - -// EndpointHints provides hints describing how an endpoint should be consumed. -message EndpointHints { - // forZones indicates the zone(s) this endpoint should be consumed by to - // enable topology aware routing. - // +listType=atomic - repeated ForZone forZones = 1; -} - -// EndpointPort represents a Port used by an EndpointSlice -// +structType=atomic -message EndpointPort { - // name represents the name of this port. All ports in an EndpointSlice must have a unique name. - // If the EndpointSlice is derived from a Kubernetes service, this corresponds to the Service.ports[].name. - // Name must either be an empty string or pass DNS_LABEL validation: - // * must be no more than 63 characters long. - // * must consist of lower case alphanumeric characters or '-'. - // * must start and end with an alphanumeric character. - // Default is empty string. - optional string name = 1; - - // protocol represents the IP protocol for this port. - // Must be UDP, TCP, or SCTP. - // Default is TCP. - optional string protocol = 2; - - // port represents the port number of the endpoint. - // If this is not specified, ports are not restricted and must be - // interpreted in the context of the specific consumer. - optional int32 port = 3; -} - -// EndpointSlice represents a subset of the endpoints that implement a service. -// For a given service there may be multiple EndpointSlice objects, selected by -// labels, which must be joined to produce the full set of endpoints. -message EndpointSlice { - // Standard object's metadata. - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ObjectMeta metadata = 1; - - // addressType specifies the type of address carried by this EndpointSlice. - // All addresses in this slice must be the same type. This field is - // immutable after creation. The following address types are currently - // supported: - // * IPv4: Represents an IPv4 Address. - // * IPv6: Represents an IPv6 Address. - // * FQDN: Represents a Fully Qualified Domain Name. - optional string addressType = 4; - - // endpoints is a list of unique endpoints in this slice. Each slice may - // include a maximum of 1000 endpoints. - // +listType=atomic - repeated Endpoint endpoints = 2; - - // ports specifies the list of network ports exposed by each endpoint in - // this slice. Each port must have a unique name. When ports is empty, it - // indicates that there are no defined ports. When a port is defined with a - // nil port value, it indicates "all ports". Each slice may include a - // maximum of 100 ports. - // +optional - // +listType=atomic - repeated EndpointPort ports = 3; -} - -// EndpointSliceList represents a list of endpoint slices -message EndpointSliceList { - // Standard list metadata. - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ListMeta metadata = 1; - - // items is the list of endpoint slices - repeated EndpointSlice items = 2; -} - -// ForZone provides information about which zones should consume this endpoint. -message ForZone { - // name represents the name of the zone. - optional string name = 1; -} - diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/register.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/register.go deleted file mode 100644 index 228e1cacf..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/register.go +++ /dev/null @@ -1,45 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2019 The Kubernetes Authors. - -package v1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -// GroupName is the group name used in this package -const GroupName = "discovery.k8s.io" - -// SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} - -// Kind takes an unqualified kind and returns a Group qualified GroupKind -func Kind(kind string) schema.GroupKind { - return SchemeGroupVersion.WithKind(kind).GroupKind() -} - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -var ( - // SchemeBuilder is the scheme builder with scheme init functions to run for this API package - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - // AddToScheme is a common registration function for mapping packaged scoped group & version keys to a scheme - AddToScheme = SchemeBuilder.AddToScheme -) - -// Adds the list of known types to the given scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &EndpointSlice{}, - &EndpointSliceList{}, - ) - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/types.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/types.go deleted file mode 100644 index 379fbbc12..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/types.go +++ /dev/null @@ -1,186 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2019 The Kubernetes Authors. - -package v1 - -import ( - slim_corev1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - slim_metav1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" -) - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// EndpointSlice represents a subset of the endpoints that implement a service. -// For a given service there may be multiple EndpointSlice objects, selected by -// labels, which must be joined to produce the full set of endpoints. -type EndpointSlice struct { - slim_metav1.TypeMeta `json:",inline"` - - // Standard object's metadata. - // +optional - slim_metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // addressType specifies the type of address carried by this EndpointSlice. - // All addresses in this slice must be the same type. This field is - // immutable after creation. The following address types are currently - // supported: - // * IPv4: Represents an IPv4 Address. - // * IPv6: Represents an IPv6 Address. - // * FQDN: Represents a Fully Qualified Domain Name. - AddressType AddressType `json:"addressType" protobuf:"bytes,4,rep,name=addressType"` - - // endpoints is a list of unique endpoints in this slice. Each slice may - // include a maximum of 1000 endpoints. - // +listType=atomic - Endpoints []Endpoint `json:"endpoints" protobuf:"bytes,2,rep,name=endpoints"` - - // ports specifies the list of network ports exposed by each endpoint in - // this slice. Each port must have a unique name. When ports is empty, it - // indicates that there are no defined ports. When a port is defined with a - // nil port value, it indicates "all ports". Each slice may include a - // maximum of 100 ports. - // +optional - // +listType=atomic - Ports []EndpointPort `json:"ports" protobuf:"bytes,3,rep,name=ports"` -} - -// AddressType represents the type of address referred to by an endpoint. -// +enum -type AddressType string - -const ( - // AddressTypeIPv4 represents an IPv4 Address. - AddressTypeIPv4 = AddressType(slim_corev1.IPv4Protocol) - - // AddressTypeIPv6 represents an IPv6 Address. - AddressTypeIPv6 = AddressType(slim_corev1.IPv6Protocol) - - // AddressTypeFQDN represents a FQDN. - AddressTypeFQDN = AddressType("FQDN") -) - -// Endpoint represents a single logical "backend" implementing a service. -type Endpoint struct { - // addresses of this endpoint. The contents of this field are interpreted - // according to the corresponding EndpointSlice addressType field. Consumers - // must handle different types of addresses in the context of their own - // capabilities. This must contain at least one address but no more than - // 100. These are all assumed to be fungible and clients may choose to only - // use the first element. Refer to: https://issue.k8s.io/106267 - // +listType=set - Addresses []string `json:"addresses" protobuf:"bytes,1,rep,name=addresses"` - - // conditions contains information about the current status of the endpoint. - Conditions EndpointConditions `json:"conditions,omitempty" protobuf:"bytes,2,opt,name=conditions"` - - // hostname of this endpoint. This field may be used by consumers of - // endpoints to distinguish endpoints from each other (e.g. in DNS names). - // Multiple endpoints which use the same hostname should be considered - // fungible (e.g. multiple A values in DNS). Must be lowercase and pass DNS - // Label (RFC 1123) validation. - // +optional - Hostname *string `json:"hostname,omitempty" protobuf:"bytes,3,opt,name=hostname"` - - // deprecatedTopology contains topology information part of the v1beta1 - // API. This field is deprecated, and will be removed when the v1beta1 - // API is removed (no sooner than kubernetes v1.24). While this field can - // hold values, it is not writable through the v1 API, and any attempts to - // write to it will be silently ignored. Topology information can be found - // in the zone and nodeName fields instead. - // +optional - DeprecatedTopology map[string]string `json:"deprecatedTopology,omitempty" protobuf:"bytes,5,opt,name=deprecatedTopology"` - - // nodeName represents the name of the Node hosting this endpoint. This can - // be used to determine endpoints local to a Node. - // +optional - NodeName *string `json:"nodeName,omitempty" protobuf:"bytes,6,opt,name=nodeName"` - - // zone is the name of the Zone this endpoint exists in. - // +optional - Zone *string `json:"zone,omitempty" protobuf:"bytes,7,opt,name=zone"` - - // hints contains information associated with how an endpoint should be - // consumed. - // +optional - Hints *EndpointHints `json:"hints,omitempty" protobuf:"bytes,8,opt,name=hints"` -} - -// EndpointConditions represents the current condition of an endpoint. -type EndpointConditions struct { - // ready indicates that this endpoint is prepared to receive traffic, - // according to whatever system is managing the endpoint. A nil value - // indicates an unknown state. In most cases consumers should interpret this - // unknown state as ready. For compatibility reasons, ready should never be - // "true" for terminating endpoints, except when the normal readiness - // behavior is being explicitly overridden, for example when the associated - // Service has set the publishNotReadyAddresses flag. - // +optional - Ready *bool `json:"ready,omitempty" protobuf:"bytes,1,name=ready"` - - // serving is identical to ready except that it is set regardless of the - // terminating state of endpoints. This condition should be set to true for - // a ready endpoint that is terminating. If nil, consumers should defer to - // the ready condition. - // +optional - Serving *bool `json:"serving,omitempty" protobuf:"bytes,2,name=serving"` - - // terminating indicates that this endpoint is terminating. A nil value - // indicates an unknown state. Consumers should interpret this unknown state - // to mean that the endpoint is not terminating. - // +optional - Terminating *bool `json:"terminating,omitempty" protobuf:"bytes,3,name=terminating"` -} - -// EndpointHints provides hints describing how an endpoint should be consumed. -type EndpointHints struct { - // forZones indicates the zone(s) this endpoint should be consumed by to - // enable topology aware routing. - // +listType=atomic - ForZones []ForZone `json:"forZones,omitempty" protobuf:"bytes,1,name=forZones"` -} - -// ForZone provides information about which zones should consume this endpoint. -type ForZone struct { - // name represents the name of the zone. - Name string `json:"name" protobuf:"bytes,1,name=name"` -} - -// EndpointPort represents a Port used by an EndpointSlice -// +structType=atomic -type EndpointPort struct { - // name represents the name of this port. All ports in an EndpointSlice must have a unique name. - // If the EndpointSlice is derived from a Kubernetes service, this corresponds to the Service.ports[].name. - // Name must either be an empty string or pass DNS_LABEL validation: - // * must be no more than 63 characters long. - // * must consist of lower case alphanumeric characters or '-'. - // * must start and end with an alphanumeric character. - // Default is empty string. - Name *string `json:"name,omitempty" protobuf:"bytes,1,name=name"` - - // protocol represents the IP protocol for this port. - // Must be UDP, TCP, or SCTP. - // Default is TCP. - Protocol *slim_corev1.Protocol `json:"protocol,omitempty" protobuf:"bytes,2,name=protocol"` - - // port represents the port number of the endpoint. - // If this is not specified, ports are not restricted and must be - // interpreted in the context of the specific consumer. - Port *int32 `json:"port,omitempty" protobuf:"bytes,3,opt,name=port"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// EndpointSliceList represents a list of endpoint slices -type EndpointSliceList struct { - slim_metav1.TypeMeta `json:",inline"` - - // Standard list metadata. - // +optional - slim_metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // items is the list of endpoint slices - Items []EndpointSlice `json:"items" protobuf:"bytes,2,rep,name=items"` -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/well_known_labels.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/well_known_labels.go deleted file mode 100644 index e2b671a3a..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/well_known_labels.go +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2019 The Kubernetes Authors. - -package v1 - -const ( - // LabelServiceName is used to indicate the name of a Kubernetes service. - LabelServiceName = "kubernetes.io/service-name" - // LabelManagedBy is used to indicate the controller or entity that manages - // an EndpointSlice. This label aims to enable different EndpointSlice - // objects to be managed by different controllers or entities within the - // same cluster. It is highly recommended to configure this label for all - // EndpointSlices. - LabelManagedBy = "endpointslice.kubernetes.io/managed-by" - // LabelSkipMirror can be set to true on an Endpoints resource to indicate - // that the EndpointSliceMirroring controller should not mirror this - // resource with EndpointSlices. - LabelSkipMirror = "endpointslice.kubernetes.io/skip-mirror" -) diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/zz_generated.deepcopy.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/zz_generated.deepcopy.go deleted file mode 100644 index 90acba6b6..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/zz_generated.deepcopy.go +++ /dev/null @@ -1,235 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1 - -import ( - corev1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Endpoint) DeepCopyInto(out *Endpoint) { - *out = *in - if in.Addresses != nil { - in, out := &in.Addresses, &out.Addresses - *out = make([]string, len(*in)) - copy(*out, *in) - } - in.Conditions.DeepCopyInto(&out.Conditions) - if in.Hostname != nil { - in, out := &in.Hostname, &out.Hostname - *out = new(string) - **out = **in - } - if in.DeprecatedTopology != nil { - in, out := &in.DeprecatedTopology, &out.DeprecatedTopology - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.NodeName != nil { - in, out := &in.NodeName, &out.NodeName - *out = new(string) - **out = **in - } - if in.Zone != nil { - in, out := &in.Zone, &out.Zone - *out = new(string) - **out = **in - } - if in.Hints != nil { - in, out := &in.Hints, &out.Hints - *out = new(EndpointHints) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Endpoint. -func (in *Endpoint) DeepCopy() *Endpoint { - if in == nil { - return nil - } - out := new(Endpoint) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointConditions) DeepCopyInto(out *EndpointConditions) { - *out = *in - if in.Ready != nil { - in, out := &in.Ready, &out.Ready - *out = new(bool) - **out = **in - } - if in.Serving != nil { - in, out := &in.Serving, &out.Serving - *out = new(bool) - **out = **in - } - if in.Terminating != nil { - in, out := &in.Terminating, &out.Terminating - *out = new(bool) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointConditions. -func (in *EndpointConditions) DeepCopy() *EndpointConditions { - if in == nil { - return nil - } - out := new(EndpointConditions) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointHints) DeepCopyInto(out *EndpointHints) { - *out = *in - if in.ForZones != nil { - in, out := &in.ForZones, &out.ForZones - *out = make([]ForZone, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointHints. -func (in *EndpointHints) DeepCopy() *EndpointHints { - if in == nil { - return nil - } - out := new(EndpointHints) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointPort) DeepCopyInto(out *EndpointPort) { - *out = *in - if in.Name != nil { - in, out := &in.Name, &out.Name - *out = new(string) - **out = **in - } - if in.Protocol != nil { - in, out := &in.Protocol, &out.Protocol - *out = new(corev1.Protocol) - **out = **in - } - if in.Port != nil { - in, out := &in.Port, &out.Port - *out = new(int32) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointPort. -func (in *EndpointPort) DeepCopy() *EndpointPort { - if in == nil { - return nil - } - out := new(EndpointPort) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointSlice) DeepCopyInto(out *EndpointSlice) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - if in.Endpoints != nil { - in, out := &in.Endpoints, &out.Endpoints - *out = make([]Endpoint, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Ports != nil { - in, out := &in.Ports, &out.Ports - *out = make([]EndpointPort, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSlice. -func (in *EndpointSlice) DeepCopy() *EndpointSlice { - if in == nil { - return nil - } - out := new(EndpointSlice) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *EndpointSlice) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointSliceList) DeepCopyInto(out *EndpointSliceList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]EndpointSlice, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSliceList. -func (in *EndpointSliceList) DeepCopy() *EndpointSliceList { - if in == nil { - return nil - } - out := new(EndpointSliceList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *EndpointSliceList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ForZone) DeepCopyInto(out *ForZone) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ForZone. -func (in *ForZone) DeepCopy() *ForZone { - if in == nil { - return nil - } - out := new(ForZone) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/zz_generated.deepequal.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/zz_generated.deepequal.go deleted file mode 100644 index f0c70e712..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1/zz_generated.deepequal.go +++ /dev/null @@ -1,292 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepequal-gen. DO NOT EDIT. - -package v1 - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Endpoint) DeepEqual(other *Endpoint) bool { - if other == nil { - return false - } - - if ((in.Addresses != nil) && (other.Addresses != nil)) || ((in.Addresses == nil) != (other.Addresses == nil)) { - in, other := &in.Addresses, &other.Addresses - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if !in.Conditions.DeepEqual(&other.Conditions) { - return false - } - - if (in.Hostname == nil) != (other.Hostname == nil) { - return false - } else if in.Hostname != nil { - if *in.Hostname != *other.Hostname { - return false - } - } - - if ((in.DeprecatedTopology != nil) && (other.DeprecatedTopology != nil)) || ((in.DeprecatedTopology == nil) != (other.DeprecatedTopology == nil)) { - in, other := &in.DeprecatedTopology, &other.DeprecatedTopology - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if inValue != otherValue { - return false - } - } - } - } - } - - if (in.NodeName == nil) != (other.NodeName == nil) { - return false - } else if in.NodeName != nil { - if *in.NodeName != *other.NodeName { - return false - } - } - - if (in.Zone == nil) != (other.Zone == nil) { - return false - } else if in.Zone != nil { - if *in.Zone != *other.Zone { - return false - } - } - - if (in.Hints == nil) != (other.Hints == nil) { - return false - } else if in.Hints != nil { - if !in.Hints.DeepEqual(other.Hints) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EndpointConditions) DeepEqual(other *EndpointConditions) bool { - if other == nil { - return false - } - - if (in.Ready == nil) != (other.Ready == nil) { - return false - } else if in.Ready != nil { - if *in.Ready != *other.Ready { - return false - } - } - - if (in.Serving == nil) != (other.Serving == nil) { - return false - } else if in.Serving != nil { - if *in.Serving != *other.Serving { - return false - } - } - - if (in.Terminating == nil) != (other.Terminating == nil) { - return false - } else if in.Terminating != nil { - if *in.Terminating != *other.Terminating { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EndpointHints) DeepEqual(other *EndpointHints) bool { - if other == nil { - return false - } - - if ((in.ForZones != nil) && (other.ForZones != nil)) || ((in.ForZones == nil) != (other.ForZones == nil)) { - in, other := &in.ForZones, &other.ForZones - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EndpointPort) DeepEqual(other *EndpointPort) bool { - if other == nil { - return false - } - - if (in.Name == nil) != (other.Name == nil) { - return false - } else if in.Name != nil { - if *in.Name != *other.Name { - return false - } - } - - if (in.Protocol == nil) != (other.Protocol == nil) { - return false - } else if in.Protocol != nil { - if *in.Protocol != *other.Protocol { - return false - } - } - - if (in.Port == nil) != (other.Port == nil) { - return false - } else if in.Port != nil { - if *in.Port != *other.Port { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EndpointSlice) DeepEqual(other *EndpointSlice) bool { - if other == nil { - return false - } - - if in.TypeMeta != other.TypeMeta { - return false - } - - if !in.ObjectMeta.DeepEqual(&other.ObjectMeta) { - return false - } - - if in.AddressType != other.AddressType { - return false - } - if ((in.Endpoints != nil) && (other.Endpoints != nil)) || ((in.Endpoints == nil) != (other.Endpoints == nil)) { - in, other := &in.Endpoints, &other.Endpoints - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.Ports != nil) && (other.Ports != nil)) || ((in.Ports == nil) != (other.Ports == nil)) { - in, other := &in.Ports, &other.Ports - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EndpointSliceList) DeepEqual(other *EndpointSliceList) bool { - if other == nil { - return false - } - - if in.TypeMeta != other.TypeMeta { - return false - } - - if !in.ListMeta.DeepEqual(&other.ListMeta) { - return false - } - - if ((in.Items != nil) && (other.Items != nil)) || ((in.Items == nil) != (other.Items == nil)) { - in, other := &in.Items, &other.Items - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ForZone) DeepEqual(other *ForZone) bool { - if other == nil { - return false - } - - if in.Name != other.Name { - return false - } - - return true -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/doc.go deleted file mode 100644 index 67e6a8769..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/doc.go +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// +k8s:deepcopy-gen=package -// +k8s:protobuf-gen=package -// +k8s:openapi-gen=true -// +k8s:prerelease-lifecycle-gen=true -// +deepequal-gen=package -// +groupName=discovery.k8s.io - -// Package v1beta1 contains slimmer versions of k8s discovery types. -package v1beta1 diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/generated.pb.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/generated.pb.go deleted file mode 100644 index db81324a9..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/generated.pb.go +++ /dev/null @@ -1,2038 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/generated.proto - -package v1beta1 - -import ( - fmt "fmt" - - github_com_cilium_cilium_pkg_k8s_slim_k8s_api_core_v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - - io "io" - - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" - - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" -) - -// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -func (m *Endpoint) Reset() { *m = Endpoint{} } -func (*Endpoint) ProtoMessage() {} -func (*Endpoint) Descriptor() ([]byte, []int) { - return fileDescriptor_db2884f8c881be40, []int{0} -} -func (m *Endpoint) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Endpoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Endpoint) XXX_Merge(src proto.Message) { - xxx_messageInfo_Endpoint.Merge(m, src) -} -func (m *Endpoint) XXX_Size() int { - return m.Size() -} -func (m *Endpoint) XXX_DiscardUnknown() { - xxx_messageInfo_Endpoint.DiscardUnknown(m) -} - -var xxx_messageInfo_Endpoint proto.InternalMessageInfo - -func (m *EndpointConditions) Reset() { *m = EndpointConditions{} } -func (*EndpointConditions) ProtoMessage() {} -func (*EndpointConditions) Descriptor() ([]byte, []int) { - return fileDescriptor_db2884f8c881be40, []int{1} -} -func (m *EndpointConditions) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EndpointConditions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EndpointConditions) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointConditions.Merge(m, src) -} -func (m *EndpointConditions) XXX_Size() int { - return m.Size() -} -func (m *EndpointConditions) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointConditions.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointConditions proto.InternalMessageInfo - -func (m *EndpointHints) Reset() { *m = EndpointHints{} } -func (*EndpointHints) ProtoMessage() {} -func (*EndpointHints) Descriptor() ([]byte, []int) { - return fileDescriptor_db2884f8c881be40, []int{2} -} -func (m *EndpointHints) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EndpointHints) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EndpointHints) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointHints.Merge(m, src) -} -func (m *EndpointHints) XXX_Size() int { - return m.Size() -} -func (m *EndpointHints) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointHints.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointHints proto.InternalMessageInfo - -func (m *EndpointPort) Reset() { *m = EndpointPort{} } -func (*EndpointPort) ProtoMessage() {} -func (*EndpointPort) Descriptor() ([]byte, []int) { - return fileDescriptor_db2884f8c881be40, []int{3} -} -func (m *EndpointPort) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EndpointPort) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EndpointPort) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointPort.Merge(m, src) -} -func (m *EndpointPort) XXX_Size() int { - return m.Size() -} -func (m *EndpointPort) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointPort.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointPort proto.InternalMessageInfo - -func (m *EndpointSlice) Reset() { *m = EndpointSlice{} } -func (*EndpointSlice) ProtoMessage() {} -func (*EndpointSlice) Descriptor() ([]byte, []int) { - return fileDescriptor_db2884f8c881be40, []int{4} -} -func (m *EndpointSlice) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EndpointSlice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EndpointSlice) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointSlice.Merge(m, src) -} -func (m *EndpointSlice) XXX_Size() int { - return m.Size() -} -func (m *EndpointSlice) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointSlice.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointSlice proto.InternalMessageInfo - -func (m *EndpointSliceList) Reset() { *m = EndpointSliceList{} } -func (*EndpointSliceList) ProtoMessage() {} -func (*EndpointSliceList) Descriptor() ([]byte, []int) { - return fileDescriptor_db2884f8c881be40, []int{5} -} -func (m *EndpointSliceList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EndpointSliceList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EndpointSliceList) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointSliceList.Merge(m, src) -} -func (m *EndpointSliceList) XXX_Size() int { - return m.Size() -} -func (m *EndpointSliceList) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointSliceList.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointSliceList proto.InternalMessageInfo - -func (m *ForZone) Reset() { *m = ForZone{} } -func (*ForZone) ProtoMessage() {} -func (*ForZone) Descriptor() ([]byte, []int) { - return fileDescriptor_db2884f8c881be40, []int{6} -} -func (m *ForZone) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ForZone) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ForZone) XXX_Merge(src proto.Message) { - xxx_messageInfo_ForZone.Merge(m, src) -} -func (m *ForZone) XXX_Size() int { - return m.Size() -} -func (m *ForZone) XXX_DiscardUnknown() { - xxx_messageInfo_ForZone.DiscardUnknown(m) -} - -var xxx_messageInfo_ForZone proto.InternalMessageInfo - -func init() { - proto.RegisterType((*Endpoint)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.discovery.v1beta1.Endpoint") - proto.RegisterMapType((map[string]string)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.discovery.v1beta1.Endpoint.TopologyEntry") - proto.RegisterType((*EndpointConditions)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.discovery.v1beta1.EndpointConditions") - proto.RegisterType((*EndpointHints)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.discovery.v1beta1.EndpointHints") - proto.RegisterType((*EndpointPort)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.discovery.v1beta1.EndpointPort") - proto.RegisterType((*EndpointSlice)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.discovery.v1beta1.EndpointSlice") - proto.RegisterType((*EndpointSliceList)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.discovery.v1beta1.EndpointSliceList") - proto.RegisterType((*ForZone)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.discovery.v1beta1.ForZone") -} - -func init() { - proto.RegisterFile("github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/generated.proto", fileDescriptor_db2884f8c881be40) -} - -var fileDescriptor_db2884f8c881be40 = []byte{ - // 821 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x41, 0x6b, 0xdc, 0x46, - 0x18, 0xdd, 0x89, 0xac, 0x5a, 0x1a, 0xd9, 0x34, 0x19, 0x7a, 0x58, 0x4c, 0x91, 0x16, 0x41, 0x61, - 0x21, 0x54, 0xc2, 0x3e, 0x14, 0xd3, 0x42, 0xd3, 0xa8, 0x75, 0x70, 0xa0, 0x71, 0xc2, 0xd8, 0x50, - 0xc8, 0x4d, 0x96, 0x26, 0xf2, 0x64, 0x57, 0x1a, 0xa1, 0x99, 0x5d, 0xd8, 0x9e, 0x7a, 0x29, 0x39, - 0xb6, 0xbf, 0xa6, 0xd0, 0x7f, 0xe0, 0x63, 0x8e, 0xa1, 0x07, 0x51, 0xab, 0x7f, 0xa2, 0xe4, 0x54, - 0x66, 0x34, 0x92, 0xd6, 0x75, 0xa1, 0x38, 0xde, 0xd3, 0xce, 0xbc, 0x99, 0x79, 0xef, 0xcd, 0xf7, - 0xf4, 0x0d, 0x0b, 0x9f, 0x67, 0x54, 0x5c, 0x2c, 0xce, 0x83, 0x84, 0xe5, 0x61, 0x42, 0xe7, 0x74, - 0xd1, 0xff, 0x94, 0xb3, 0x2c, 0x9c, 0x1d, 0xf2, 0x90, 0xcf, 0x69, 0xae, 0x06, 0x71, 0x49, 0xc3, - 0x94, 0xf2, 0x84, 0x2d, 0x49, 0xb5, 0x0a, 0x97, 0xfb, 0xe7, 0x44, 0xc4, 0xfb, 0x61, 0x46, 0x0a, - 0x52, 0xc5, 0x82, 0xa4, 0x41, 0x59, 0x31, 0xc1, 0xd0, 0xa3, 0x81, 0x30, 0x68, 0x99, 0xba, 0x9f, - 0x72, 0x96, 0x05, 0xb3, 0x43, 0x1e, 0x48, 0x42, 0x35, 0x88, 0x4b, 0x1a, 0xf4, 0x84, 0x81, 0x26, - 0xdc, 0x3b, 0xba, 0x9d, 0xa3, 0x84, 0x55, 0x24, 0x5c, 0xde, 0xf0, 0xb1, 0xf7, 0xe4, 0x56, 0x34, - 0x3c, 0xcc, 0x89, 0x88, 0xff, 0x8b, 0xe7, 0xf3, 0x35, 0x9e, 0x8c, 0x65, 0x2c, 0x54, 0xf0, 0xf9, - 0xe2, 0x95, 0x9a, 0xa9, 0x89, 0x1a, 0xe9, 0xed, 0x92, 0x30, 0xa0, 0x4c, 0x72, 0xe6, 0x71, 0x72, - 0x41, 0x0b, 0x59, 0x2b, 0xa9, 0x58, 0x2d, 0x0a, 0x41, 0x73, 0x72, 0x83, 0xff, 0x8b, 0xff, 0x3b, - 0xc0, 0x93, 0x0b, 0x92, 0xc7, 0xff, 0x3e, 0xe7, 0xff, 0x61, 0x40, 0xeb, 0xa8, 0x48, 0x4b, 0x46, - 0x0b, 0x81, 0x1e, 0x42, 0x3b, 0x4e, 0xd3, 0x8a, 0x70, 0x4e, 0xf8, 0x18, 0x4c, 0x8c, 0xa9, 0x1d, - 0xed, 0x36, 0xb5, 0x67, 0x3f, 0xee, 0x40, 0x3c, 0xac, 0xa3, 0x37, 0x00, 0xc2, 0x84, 0x15, 0x29, - 0x15, 0x94, 0x15, 0x7c, 0x7c, 0x6f, 0x02, 0xa6, 0xce, 0xc1, 0x69, 0x70, 0xc7, 0xdc, 0x82, 0xce, - 0xcc, 0xb7, 0x3d, 0x75, 0x84, 0x2e, 0x6b, 0x6f, 0xd4, 0xd4, 0x1e, 0x1c, 0x30, 0xbc, 0x26, 0x8d, - 0xa6, 0xd0, 0xba, 0x60, 0x5c, 0x14, 0x71, 0x4e, 0xc6, 0xc6, 0x04, 0x4c, 0xed, 0x68, 0xa7, 0xa9, - 0x3d, 0xeb, 0x58, 0x63, 0xb8, 0x5f, 0x45, 0x3f, 0x03, 0x68, 0x09, 0x56, 0xb2, 0x39, 0xcb, 0x56, - 0x63, 0x73, 0x62, 0x4c, 0x9d, 0x83, 0x1f, 0x36, 0xe6, 0x38, 0x38, 0xd3, 0xcc, 0x47, 0x85, 0xa8, - 0x56, 0xd1, 0x7d, 0xed, 0xda, 0xea, 0x60, 0xdc, 0x4b, 0x4b, 0xc7, 0x05, 0x4b, 0xc9, 0x89, 0x74, - 0xfc, 0xd1, 0xe0, 0xf8, 0x44, 0x63, 0xb8, 0x5f, 0xdd, 0xfb, 0x0a, 0xee, 0x5e, 0xa3, 0x45, 0xf7, - 0xa1, 0x31, 0x23, 0xab, 0x31, 0x90, 0xa7, 0xb0, 0x1c, 0xa2, 0x4f, 0xa0, 0xb9, 0x8c, 0xe7, 0x0b, - 0xa2, 0x22, 0xb0, 0x71, 0x3b, 0xf9, 0xf2, 0xde, 0x21, 0xf0, 0x7f, 0x01, 0x10, 0xdd, 0xac, 0x27, - 0xf2, 0xa0, 0x59, 0x91, 0x38, 0x6d, 0x49, 0xac, 0xc8, 0x6e, 0x6a, 0xcf, 0xc4, 0x12, 0xc0, 0x2d, - 0x8e, 0x3e, 0x83, 0xdb, 0x9c, 0x54, 0x4b, 0x5a, 0x64, 0x8a, 0xd3, 0x8a, 0x9c, 0xa6, 0xf6, 0xb6, - 0x4f, 0x5b, 0x08, 0x77, 0x6b, 0x68, 0x1f, 0x3a, 0x82, 0x54, 0x39, 0x2d, 0x62, 0x21, 0xb7, 0x1a, - 0x6a, 0xeb, 0xc7, 0x4d, 0xed, 0x39, 0x67, 0x03, 0x8c, 0xd7, 0xf7, 0xf8, 0x6f, 0x00, 0xdc, 0xed, - 0x1c, 0x1d, 0xd3, 0x42, 0x70, 0xb4, 0x84, 0xd6, 0x2b, 0x56, 0xbd, 0x64, 0x85, 0xfe, 0xe4, 0x9c, - 0x83, 0xe3, 0x3b, 0x27, 0xf2, 0xa4, 0x25, 0x1c, 0x22, 0xd0, 0x00, 0xc7, 0xbd, 0x96, 0xff, 0x1b, - 0x80, 0x3b, 0x9d, 0x93, 0x17, 0xac, 0x12, 0xe8, 0x53, 0xb8, 0xa5, 0xbe, 0x20, 0x55, 0xd9, 0xc8, - 0x6a, 0x6a, 0x6f, 0x4b, 0x65, 0xa1, 0x50, 0xf4, 0x1a, 0x5a, 0xaa, 0x61, 0x12, 0x36, 0x6f, 0xeb, - 0x1c, 0x9d, 0x48, 0xe2, 0x17, 0x1a, 0x7b, 0x5f, 0x7b, 0x5f, 0x7f, 0xd0, 0x83, 0x13, 0x74, 0x0c, - 0xb8, 0xe7, 0x97, 0x4e, 0x4a, 0x56, 0x09, 0x55, 0x50, 0xb3, 0x75, 0x22, 0x1d, 0x62, 0x85, 0xfa, - 0xbf, 0x1b, 0x43, 0x09, 0x4f, 0xe7, 0x34, 0x21, 0xa8, 0x82, 0x96, 0x7c, 0x76, 0xd2, 0x58, 0xc4, - 0xca, 0xbd, 0x73, 0x10, 0xdd, 0xae, 0x84, 0x3c, 0x90, 0xe7, 0x83, 0xe5, 0x7e, 0xf0, 0xfc, 0xfc, - 0x35, 0x49, 0xc4, 0x33, 0x22, 0xe2, 0xa1, 0xeb, 0x06, 0x0c, 0xf7, 0x3a, 0xe8, 0x3b, 0xe8, 0xe8, - 0xa7, 0xe0, 0x6c, 0x55, 0x92, 0xf1, 0x96, 0x2a, 0x89, 0xaf, 0x8f, 0x38, 0x8f, 0x87, 0xa5, 0xf7, - 0xd7, 0xa7, 0x78, 0xfd, 0x18, 0xfa, 0x11, 0xda, 0x44, 0x5f, 0x45, 0xbe, 0x20, 0x32, 0xfd, 0xa7, - 0x1b, 0xeb, 0xc7, 0xe8, 0x81, 0xb6, 0x63, 0x77, 0x08, 0xc7, 0x83, 0x1c, 0xaa, 0xa0, 0x29, 0xeb, - 0xc9, 0xc7, 0x86, 0xd2, 0x7d, 0xb6, 0x31, 0x5d, 0x99, 0x55, 0xb4, 0xab, 0xb5, 0x4d, 0x39, 0xe3, - 0xb8, 0x95, 0xf2, 0xff, 0x06, 0xf0, 0xc1, 0xb5, 0xec, 0xbe, 0xa7, 0x5c, 0xa0, 0xe2, 0x46, 0x7e, - 0xdf, 0x7c, 0x68, 0x7e, 0x92, 0x4f, 0xa5, 0xd7, 0x7f, 0xfa, 0x1d, 0xb2, 0x96, 0x1d, 0x87, 0x26, - 0x15, 0x24, 0xef, 0x2a, 0x7e, 0xb2, 0xb1, 0x9b, 0xab, 0x2b, 0x0d, 0x57, 0x7f, 0x2a, 0x45, 0x70, - 0xab, 0xe5, 0x3f, 0x84, 0xdb, 0xba, 0x0b, 0xd1, 0xe4, 0x5a, 0xa7, 0xed, 0xe8, 0xed, 0x6b, 0xdd, - 0x16, 0x91, 0xcb, 0x2b, 0x77, 0xf4, 0xf6, 0xca, 0x1d, 0xbd, 0xbb, 0x72, 0x47, 0x3f, 0x35, 0x2e, - 0xb8, 0x6c, 0x5c, 0xf0, 0xb6, 0x71, 0xc1, 0xbb, 0xc6, 0x05, 0x7f, 0x36, 0x2e, 0xf8, 0xf5, 0x2f, - 0x77, 0xf4, 0xf2, 0xd1, 0x1d, 0xff, 0x74, 0xfc, 0x13, 0x00, 0x00, 0xff, 0xff, 0x51, 0xa7, 0x86, - 0x6d, 0xb6, 0x08, 0x00, 0x00, -} - -func (m *Endpoint) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Endpoint) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Endpoint) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.NodeName != nil { - i -= len(*m.NodeName) - copy(dAtA[i:], *m.NodeName) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.NodeName))) - i-- - dAtA[i] = 0x32 - } - if len(m.Topology) > 0 { - keysForTopology := make([]string, 0, len(m.Topology)) - for k := range m.Topology { - keysForTopology = append(keysForTopology, string(k)) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForTopology) - for iNdEx := len(keysForTopology) - 1; iNdEx >= 0; iNdEx-- { - v := m.Topology[string(keysForTopology[iNdEx])] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarintGenerated(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(keysForTopology[iNdEx]) - copy(dAtA[i:], keysForTopology[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(keysForTopology[iNdEx]))) - i-- - dAtA[i] = 0xa - i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x2a - } - } - if m.Hostname != nil { - i -= len(*m.Hostname) - copy(dAtA[i:], *m.Hostname) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Hostname))) - i-- - dAtA[i] = 0x1a - } - { - size, err := m.Conditions.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Addresses) > 0 { - for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Addresses[iNdEx]) - copy(dAtA[i:], m.Addresses[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Addresses[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *EndpointConditions) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EndpointConditions) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EndpointConditions) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Terminating != nil { - i-- - if *m.Terminating { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if m.Serving != nil { - i-- - if *m.Serving { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if m.Ready != nil { - i-- - if *m.Ready { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *EndpointHints) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EndpointHints) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EndpointHints) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ForZones) > 0 { - for iNdEx := len(m.ForZones) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ForZones[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *EndpointPort) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EndpointPort) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EndpointPort) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Port != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.Port)) - i-- - dAtA[i] = 0x18 - } - if m.Protocol != nil { - i -= len(*m.Protocol) - copy(dAtA[i:], *m.Protocol) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Protocol))) - i-- - dAtA[i] = 0x12 - } - if m.Name != nil { - i -= len(*m.Name) - copy(dAtA[i:], *m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EndpointSlice) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EndpointSlice) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EndpointSlice) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.AddressType) - copy(dAtA[i:], m.AddressType) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.AddressType))) - i-- - dAtA[i] = 0x22 - if len(m.Ports) > 0 { - for iNdEx := len(m.Ports) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Ports[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Endpoints) > 0 { - for iNdEx := len(m.Endpoints) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Endpoints[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EndpointSliceList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EndpointSliceList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EndpointSliceList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ForZone) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ForZone) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ForZone) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Endpoint) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Addresses) > 0 { - for _, s := range m.Addresses { - l = len(s) - n += 1 + l + sovGenerated(uint64(l)) - } - } - l = m.Conditions.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.Hostname != nil { - l = len(*m.Hostname) - n += 1 + l + sovGenerated(uint64(l)) - } - if len(m.Topology) > 0 { - for k, v := range m.Topology { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v))) - n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) - } - } - if m.NodeName != nil { - l = len(*m.NodeName) - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *EndpointConditions) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Ready != nil { - n += 2 - } - if m.Serving != nil { - n += 2 - } - if m.Terminating != nil { - n += 2 - } - return n -} - -func (m *EndpointHints) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.ForZones) > 0 { - for _, e := range m.ForZones { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *EndpointPort) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Name != nil { - l = len(*m.Name) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Protocol != nil { - l = len(*m.Protocol) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Port != nil { - n += 1 + sovGenerated(uint64(*m.Port)) - } - return n -} - -func (m *EndpointSlice) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Endpoints) > 0 { - for _, e := range m.Endpoints { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - if len(m.Ports) > 0 { - for _, e := range m.Ports { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - l = len(m.AddressType) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *EndpointSliceList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *ForZone) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *Endpoint) String() string { - if this == nil { - return "nil" - } - keysForTopology := make([]string, 0, len(this.Topology)) - for k := range this.Topology { - keysForTopology = append(keysForTopology, k) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForTopology) - mapStringForTopology := "map[string]string{" - for _, k := range keysForTopology { - mapStringForTopology += fmt.Sprintf("%v: %v,", k, this.Topology[k]) - } - mapStringForTopology += "}" - s := strings.Join([]string{`&Endpoint{`, - `Addresses:` + fmt.Sprintf("%v", this.Addresses) + `,`, - `Conditions:` + strings.Replace(strings.Replace(this.Conditions.String(), "EndpointConditions", "EndpointConditions", 1), `&`, ``, 1) + `,`, - `Hostname:` + valueToStringGenerated(this.Hostname) + `,`, - `Topology:` + mapStringForTopology + `,`, - `NodeName:` + valueToStringGenerated(this.NodeName) + `,`, - `}`, - }, "") - return s -} -func (this *EndpointConditions) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EndpointConditions{`, - `Ready:` + valueToStringGenerated(this.Ready) + `,`, - `Serving:` + valueToStringGenerated(this.Serving) + `,`, - `Terminating:` + valueToStringGenerated(this.Terminating) + `,`, - `}`, - }, "") - return s -} -func (this *EndpointHints) String() string { - if this == nil { - return "nil" - } - repeatedStringForForZones := "[]ForZone{" - for _, f := range this.ForZones { - repeatedStringForForZones += strings.Replace(strings.Replace(f.String(), "ForZone", "ForZone", 1), `&`, ``, 1) + "," - } - repeatedStringForForZones += "}" - s := strings.Join([]string{`&EndpointHints{`, - `ForZones:` + repeatedStringForForZones + `,`, - `}`, - }, "") - return s -} -func (this *EndpointPort) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EndpointPort{`, - `Name:` + valueToStringGenerated(this.Name) + `,`, - `Protocol:` + valueToStringGenerated(this.Protocol) + `,`, - `Port:` + valueToStringGenerated(this.Port) + `,`, - `}`, - }, "") - return s -} -func (this *EndpointSlice) String() string { - if this == nil { - return "nil" - } - repeatedStringForEndpoints := "[]Endpoint{" - for _, f := range this.Endpoints { - repeatedStringForEndpoints += strings.Replace(strings.Replace(f.String(), "Endpoint", "Endpoint", 1), `&`, ``, 1) + "," - } - repeatedStringForEndpoints += "}" - repeatedStringForPorts := "[]EndpointPort{" - for _, f := range this.Ports { - repeatedStringForPorts += strings.Replace(strings.Replace(f.String(), "EndpointPort", "EndpointPort", 1), `&`, ``, 1) + "," - } - repeatedStringForPorts += "}" - s := strings.Join([]string{`&EndpointSlice{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Endpoints:` + repeatedStringForEndpoints + `,`, - `Ports:` + repeatedStringForPorts + `,`, - `AddressType:` + fmt.Sprintf("%v", this.AddressType) + `,`, - `}`, - }, "") - return s -} -func (this *EndpointSliceList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]EndpointSlice{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "EndpointSlice", "EndpointSlice", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&EndpointSliceList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *ForZone) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ForZone{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `}`, - }, "") - return s -} -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *Endpoint) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Endpoint: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Endpoint: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addresses = append(m.Addresses, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Conditions.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hostname", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Hostname = &s - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Topology", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Topology == nil { - m.Topology = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Topology[mapkey] = mapvalue - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.NodeName = &s - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EndpointConditions) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EndpointConditions: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EndpointConditions: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Ready", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.Ready = &b - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Serving", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.Serving = &b - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Terminating", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.Terminating = &b - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EndpointHints) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EndpointHints: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EndpointHints: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ForZones", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ForZones = append(m.ForZones, ForZone{}) - if err := m.ForZones[len(m.ForZones)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EndpointPort) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EndpointPort: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EndpointPort: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Name = &s - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Protocol", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := github_com_cilium_cilium_pkg_k8s_slim_k8s_api_core_v1.Protocol(dAtA[iNdEx:postIndex]) - m.Protocol = &s - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Port", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Port = &v - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EndpointSlice) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EndpointSlice: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EndpointSlice: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Endpoints", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Endpoints = append(m.Endpoints, Endpoint{}) - if err := m.Endpoints[len(m.Endpoints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ports", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Ports = append(m.Ports, EndpointPort{}) - if err := m.Ports[len(m.Ports)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AddressType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AddressType = AddressType(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EndpointSliceList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EndpointSliceList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EndpointSliceList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, EndpointSlice{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ForZone) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ForZone: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ForZone: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenerated(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenerated - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenerated - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenerated - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") -) diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/generated.proto b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/generated.proto deleted file mode 100644 index 4458196b1..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/generated.proto +++ /dev/null @@ -1,164 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - - -// This file was autogenerated by go-to-protobuf. Do not edit it manually! - -syntax = "proto2"; - -package github.com.cilium.cilium.pkg.k8s.slim.k8s.api.discovery.v1beta1; - -import "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/generated.proto"; -import "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; - -// Package-wide variables from generator "generated". -option go_package = "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1"; - -// Endpoint represents a single logical "backend" implementing a service. -message Endpoint { - // addresses of this endpoint. The contents of this field are interpreted - // according to the corresponding EndpointSlice addressType field. Consumers - // must handle different types of addresses in the context of their own - // capabilities. This must contain at least one address but no more than - // 100. These are all assumed to be fungible and clients may choose to only - // use the first element. Refer to: https://issue.k8s.io/106267 - // +listType=set - repeated string addresses = 1; - - // conditions contains information about the current status of the endpoint. - optional EndpointConditions conditions = 2; - - // hostname of this endpoint. This field may be used by consumers of - // endpoints to distinguish endpoints from each other (e.g. in DNS names). - // Multiple endpoints which use the same hostname should be considered - // fungible (e.g. multiple A values in DNS). Must be lowercase and pass DNS - // Label (RFC 1123) validation. - // +optional - optional string hostname = 3; - - // topology contains arbitrary topology information associated with the - // endpoint. These key/value pairs must conform with the label format. - // https://kubernetes.io/docs/concepts/overview/working-with-objects/labels - // Topology may include a maximum of 16 key/value pairs. This includes, but - // is not limited to the following well known keys: - // * kubernetes.io/hostname: the value indicates the hostname of the node - // where the endpoint is located. This should match the corresponding - // node label. - // * topology.kubernetes.io/zone: the value indicates the zone where the - // endpoint is located. This should match the corresponding node label. - // * topology.kubernetes.io/region: the value indicates the region where the - // endpoint is located. This should match the corresponding node label. - // This field is deprecated and will be removed in future api versions. - // +optional - map topology = 5; - - // nodeName represents the name of the Node hosting this endpoint. This can - // be used to determine endpoints local to a Node. - // +optional - optional string nodeName = 6; -} - -// EndpointConditions represents the current condition of an endpoint. -message EndpointConditions { - // ready indicates that this endpoint is prepared to receive traffic, - // according to whatever system is managing the endpoint. A nil value - // indicates an unknown state. In most cases consumers should interpret this - // unknown state as ready. For compatibility reasons, ready should never be - // "true" for terminating endpoints. - // +optional - optional bool ready = 1; - - // serving is identical to ready except that it is set regardless of the - // terminating state of endpoints. This condition should be set to true for - // a ready endpoint that is terminating. If nil, consumers should defer to - // the ready condition. - // +optional - optional bool serving = 2; - - // terminating indicates that this endpoint is terminating. A nil value - // indicates an unknown state. Consumers should interpret this unknown state - // to mean that the endpoint is not terminating. - // +optional - optional bool terminating = 3; -} - -// EndpointHints provides hints describing how an endpoint should be consumed. -message EndpointHints { - // forZones indicates the zone(s) this endpoint should be consumed by to - // enable topology aware routing. May contain a maximum of 8 entries. - // +listType=atomic - repeated ForZone forZones = 1; -} - -// EndpointPort represents a Port used by an EndpointSlice -message EndpointPort { - // name represents the name of this port. All ports in an EndpointSlice must have a unique name. - // If the EndpointSlice is derived from a Kubernetes service, this corresponds to the Service.ports[].name. - // Name must either be an empty string or pass DNS_LABEL validation: - // * must be no more than 63 characters long. - // * must consist of lower case alphanumeric characters or '-'. - // * must start and end with an alphanumeric character. - // Default is empty string. - optional string name = 1; - - // protocol represents the IP protocol for this port. - // Must be UDP, TCP, or SCTP. - // Default is TCP. - optional string protocol = 2; - - // port represents the port number of the endpoint. - // If this is not specified, ports are not restricted and must be - // interpreted in the context of the specific consumer. - optional int32 port = 3; -} - -// EndpointSlice represents a subset of the endpoints that implement a service. -// For a given service there may be multiple EndpointSlice objects, selected by -// labels, which must be joined to produce the full set of endpoints. -message EndpointSlice { - // Standard object's metadata. - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ObjectMeta metadata = 1; - - // addressType specifies the type of address carried by this EndpointSlice. - // All addresses in this slice must be the same type. This field is - // immutable after creation. The following address types are currently - // supported: - // * IPv4: Represents an IPv4 Address. - // * IPv6: Represents an IPv6 Address. - // * FQDN: Represents a Fully Qualified Domain Name. - optional string addressType = 4; - - // endpoints is a list of unique endpoints in this slice. Each slice may - // include a maximum of 1000 endpoints. - // +listType=atomic - repeated Endpoint endpoints = 2; - - // ports specifies the list of network ports exposed by each endpoint in - // this slice. Each port must have a unique name. When ports is empty, it - // indicates that there are no defined ports. When a port is defined with a - // nil port value, it indicates "all ports". Each slice may include a - // maximum of 100 ports. - // +optional - // +listType=atomic - repeated EndpointPort ports = 3; -} - -// EndpointSliceList represents a list of endpoint slices -message EndpointSliceList { - // Standard list metadata. - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ListMeta metadata = 1; - - // items is the list of endpoint slices - repeated EndpointSlice items = 2; -} - -// ForZone provides information about which zones should consume this endpoint. -message ForZone { - // name represents the name of the zone. - optional string name = 1; -} - diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/register.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/register.go deleted file mode 100644 index 9040aba7b..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/register.go +++ /dev/null @@ -1,45 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2019 The Kubernetes Authors. - -package v1beta1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -// GroupName is the group name used in this package -const GroupName = "discovery.k8s.io" - -// SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"} - -// Kind takes an unqualified kind and returns a Group qualified GroupKind -func Kind(kind string) schema.GroupKind { - return SchemeGroupVersion.WithKind(kind).GroupKind() -} - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -var ( - // SchemeBuilder is the scheme builder with scheme init functions to run for this API package - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - // AddToScheme is a common registration function for mapping packaged scoped group & version keys to a scheme - AddToScheme = SchemeBuilder.AddToScheme -) - -// Adds the list of known types to the given scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &EndpointSlice{}, - &EndpointSliceList{}, - ) - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/types.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/types.go deleted file mode 100644 index da67e061a..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/types.go +++ /dev/null @@ -1,188 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2019 The Kubernetes Authors. - -package v1beta1 - -import ( - slim_corev1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - slim_metav1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" -) - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:prerelease-lifecycle-gen:introduced=1.16 -// +k8s:prerelease-lifecycle-gen:deprecated=1.21 -// +k8s:prerelease-lifecycle-gen:removed=1.25 -// +k8s:prerelease-lifecycle-gen:replacement=discovery.k8s.io,v1,EndpointSlice - -// EndpointSlice represents a subset of the endpoints that implement a service. -// For a given service there may be multiple EndpointSlice objects, selected by -// labels, which must be joined to produce the full set of endpoints. -type EndpointSlice struct { - slim_metav1.TypeMeta `json:",inline"` - - // Standard object's metadata. - // +optional - slim_metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // addressType specifies the type of address carried by this EndpointSlice. - // All addresses in this slice must be the same type. This field is - // immutable after creation. The following address types are currently - // supported: - // * IPv4: Represents an IPv4 Address. - // * IPv6: Represents an IPv6 Address. - // * FQDN: Represents a Fully Qualified Domain Name. - AddressType AddressType `json:"addressType" protobuf:"bytes,4,rep,name=addressType"` - - // endpoints is a list of unique endpoints in this slice. Each slice may - // include a maximum of 1000 endpoints. - // +listType=atomic - Endpoints []Endpoint `json:"endpoints" protobuf:"bytes,2,rep,name=endpoints"` - - // ports specifies the list of network ports exposed by each endpoint in - // this slice. Each port must have a unique name. When ports is empty, it - // indicates that there are no defined ports. When a port is defined with a - // nil port value, it indicates "all ports". Each slice may include a - // maximum of 100 ports. - // +optional - // +listType=atomic - Ports []EndpointPort `json:"ports" protobuf:"bytes,3,rep,name=ports"` -} - -// AddressType represents the type of address referred to by an endpoint. -type AddressType string - -const ( - // AddressTypeIPv4 represents an IPv4 Address. - AddressTypeIPv4 = AddressType(slim_corev1.IPv4Protocol) - - // AddressTypeIPv6 represents an IPv6 Address. - AddressTypeIPv6 = AddressType(slim_corev1.IPv6Protocol) - - // AddressTypeFQDN represents a FQDN. - AddressTypeFQDN = AddressType("FQDN") -) - -// Endpoint represents a single logical "backend" implementing a service. -type Endpoint struct { - // addresses of this endpoint. The contents of this field are interpreted - // according to the corresponding EndpointSlice addressType field. Consumers - // must handle different types of addresses in the context of their own - // capabilities. This must contain at least one address but no more than - // 100. These are all assumed to be fungible and clients may choose to only - // use the first element. Refer to: https://issue.k8s.io/106267 - // +listType=set - Addresses []string `json:"addresses" protobuf:"bytes,1,rep,name=addresses"` - - // conditions contains information about the current status of the endpoint. - Conditions EndpointConditions `json:"conditions,omitempty" protobuf:"bytes,2,opt,name=conditions"` - - // hostname of this endpoint. This field may be used by consumers of - // endpoints to distinguish endpoints from each other (e.g. in DNS names). - // Multiple endpoints which use the same hostname should be considered - // fungible (e.g. multiple A values in DNS). Must be lowercase and pass DNS - // Label (RFC 1123) validation. - // +optional - Hostname *string `json:"hostname,omitempty" protobuf:"bytes,3,opt,name=hostname"` - - // topology contains arbitrary topology information associated with the - // endpoint. These key/value pairs must conform with the label format. - // https://kubernetes.io/docs/concepts/overview/working-with-objects/labels - // Topology may include a maximum of 16 key/value pairs. This includes, but - // is not limited to the following well known keys: - // * kubernetes.io/hostname: the value indicates the hostname of the node - // where the endpoint is located. This should match the corresponding - // node label. - // * topology.kubernetes.io/zone: the value indicates the zone where the - // endpoint is located. This should match the corresponding node label. - // * topology.kubernetes.io/region: the value indicates the region where the - // endpoint is located. This should match the corresponding node label. - // This field is deprecated and will be removed in future api versions. - // +optional - Topology map[string]string `json:"topology,omitempty" protobuf:"bytes,5,opt,name=topology"` - - // nodeName represents the name of the Node hosting this endpoint. This can - // be used to determine endpoints local to a Node. - // +optional - NodeName *string `json:"nodeName,omitempty" protobuf:"bytes,6,opt,name=nodeName"` -} - -// EndpointConditions represents the current condition of an endpoint. -type EndpointConditions struct { - // ready indicates that this endpoint is prepared to receive traffic, - // according to whatever system is managing the endpoint. A nil value - // indicates an unknown state. In most cases consumers should interpret this - // unknown state as ready. For compatibility reasons, ready should never be - // "true" for terminating endpoints. - // +optional - Ready *bool `json:"ready,omitempty" protobuf:"bytes,1,name=ready"` - - // serving is identical to ready except that it is set regardless of the - // terminating state of endpoints. This condition should be set to true for - // a ready endpoint that is terminating. If nil, consumers should defer to - // the ready condition. - // +optional - Serving *bool `json:"serving,omitempty" protobuf:"bytes,2,name=serving"` - - // terminating indicates that this endpoint is terminating. A nil value - // indicates an unknown state. Consumers should interpret this unknown state - // to mean that the endpoint is not terminating. - // +optional - Terminating *bool `json:"terminating,omitempty" protobuf:"bytes,3,name=terminating"` -} - -// EndpointHints provides hints describing how an endpoint should be consumed. -type EndpointHints struct { - // forZones indicates the zone(s) this endpoint should be consumed by to - // enable topology aware routing. May contain a maximum of 8 entries. - // +listType=atomic - ForZones []ForZone `json:"forZones,omitempty" protobuf:"bytes,1,name=forZones"` -} - -// ForZone provides information about which zones should consume this endpoint. -type ForZone struct { - // name represents the name of the zone. - Name string `json:"name" protobuf:"bytes,1,name=name"` -} - -// EndpointPort represents a Port used by an EndpointSlice -type EndpointPort struct { - // name represents the name of this port. All ports in an EndpointSlice must have a unique name. - // If the EndpointSlice is derived from a Kubernetes service, this corresponds to the Service.ports[].name. - // Name must either be an empty string or pass DNS_LABEL validation: - // * must be no more than 63 characters long. - // * must consist of lower case alphanumeric characters or '-'. - // * must start and end with an alphanumeric character. - // Default is empty string. - Name *string `json:"name,omitempty" protobuf:"bytes,1,name=name"` - - // protocol represents the IP protocol for this port. - // Must be UDP, TCP, or SCTP. - // Default is TCP. - Protocol *slim_corev1.Protocol `json:"protocol,omitempty" protobuf:"bytes,2,name=protocol"` - - // port represents the port number of the endpoint. - // If this is not specified, ports are not restricted and must be - // interpreted in the context of the specific consumer. - Port *int32 `json:"port,omitempty" protobuf:"bytes,3,opt,name=port"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:prerelease-lifecycle-gen:introduced=1.16 -// +k8s:prerelease-lifecycle-gen:deprecated=1.21 -// +k8s:prerelease-lifecycle-gen:removed=1.25 -// +k8s:prerelease-lifecycle-gen:replacement=discovery.k8s.io,v1,EndpointSlice - -// EndpointSliceList represents a list of endpoint slices -type EndpointSliceList struct { - slim_metav1.TypeMeta `json:",inline"` - - // Standard list metadata. - // +optional - slim_metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // items is the list of endpoint slices - Items []EndpointSlice `json:"items" protobuf:"bytes,2,rep,name=items"` -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/well_known_labels.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/well_known_labels.go deleted file mode 100644 index b864b949c..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/well_known_labels.go +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2019 The Kubernetes Authors. - -package v1beta1 - -const ( - // LabelServiceName is used to indicate the name of a Kubernetes service. - LabelServiceName = "kubernetes.io/service-name" - // LabelManagedBy is used to indicate the controller or entity that manages - // an EndpointSlice. This label aims to enable different EndpointSlice - // objects to be managed by different controllers or entities within the - // same cluster. It is highly recommended to configure this label for all - // EndpointSlices. - LabelManagedBy = "endpointslice.kubernetes.io/managed-by" - // LabelSkipMirror can be set to true on an Endpoints resource to indicate - // that the EndpointSliceMirroring controller should not mirror this - // resource with EndpointSlices. - LabelSkipMirror = "endpointslice.kubernetes.io/skip-mirror" -) diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/zz_generated.deepcopy.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/zz_generated.deepcopy.go deleted file mode 100644 index da65d87f9..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/zz_generated.deepcopy.go +++ /dev/null @@ -1,225 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1beta1 - -import ( - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Endpoint) DeepCopyInto(out *Endpoint) { - *out = *in - if in.Addresses != nil { - in, out := &in.Addresses, &out.Addresses - *out = make([]string, len(*in)) - copy(*out, *in) - } - in.Conditions.DeepCopyInto(&out.Conditions) - if in.Hostname != nil { - in, out := &in.Hostname, &out.Hostname - *out = new(string) - **out = **in - } - if in.Topology != nil { - in, out := &in.Topology, &out.Topology - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.NodeName != nil { - in, out := &in.NodeName, &out.NodeName - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Endpoint. -func (in *Endpoint) DeepCopy() *Endpoint { - if in == nil { - return nil - } - out := new(Endpoint) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointConditions) DeepCopyInto(out *EndpointConditions) { - *out = *in - if in.Ready != nil { - in, out := &in.Ready, &out.Ready - *out = new(bool) - **out = **in - } - if in.Serving != nil { - in, out := &in.Serving, &out.Serving - *out = new(bool) - **out = **in - } - if in.Terminating != nil { - in, out := &in.Terminating, &out.Terminating - *out = new(bool) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointConditions. -func (in *EndpointConditions) DeepCopy() *EndpointConditions { - if in == nil { - return nil - } - out := new(EndpointConditions) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointHints) DeepCopyInto(out *EndpointHints) { - *out = *in - if in.ForZones != nil { - in, out := &in.ForZones, &out.ForZones - *out = make([]ForZone, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointHints. -func (in *EndpointHints) DeepCopy() *EndpointHints { - if in == nil { - return nil - } - out := new(EndpointHints) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointPort) DeepCopyInto(out *EndpointPort) { - *out = *in - if in.Name != nil { - in, out := &in.Name, &out.Name - *out = new(string) - **out = **in - } - if in.Protocol != nil { - in, out := &in.Protocol, &out.Protocol - *out = new(v1.Protocol) - **out = **in - } - if in.Port != nil { - in, out := &in.Port, &out.Port - *out = new(int32) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointPort. -func (in *EndpointPort) DeepCopy() *EndpointPort { - if in == nil { - return nil - } - out := new(EndpointPort) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointSlice) DeepCopyInto(out *EndpointSlice) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - if in.Endpoints != nil { - in, out := &in.Endpoints, &out.Endpoints - *out = make([]Endpoint, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Ports != nil { - in, out := &in.Ports, &out.Ports - *out = make([]EndpointPort, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSlice. -func (in *EndpointSlice) DeepCopy() *EndpointSlice { - if in == nil { - return nil - } - out := new(EndpointSlice) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *EndpointSlice) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointSliceList) DeepCopyInto(out *EndpointSliceList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]EndpointSlice, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSliceList. -func (in *EndpointSliceList) DeepCopy() *EndpointSliceList { - if in == nil { - return nil - } - out := new(EndpointSliceList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *EndpointSliceList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ForZone) DeepCopyInto(out *ForZone) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ForZone. -func (in *ForZone) DeepCopy() *ForZone { - if in == nil { - return nil - } - out := new(ForZone) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/zz_generated.deepequal.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/zz_generated.deepequal.go deleted file mode 100644 index 5a4ef27b3..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1/zz_generated.deepequal.go +++ /dev/null @@ -1,276 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepequal-gen. DO NOT EDIT. - -package v1beta1 - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Endpoint) DeepEqual(other *Endpoint) bool { - if other == nil { - return false - } - - if ((in.Addresses != nil) && (other.Addresses != nil)) || ((in.Addresses == nil) != (other.Addresses == nil)) { - in, other := &in.Addresses, &other.Addresses - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if !in.Conditions.DeepEqual(&other.Conditions) { - return false - } - - if (in.Hostname == nil) != (other.Hostname == nil) { - return false - } else if in.Hostname != nil { - if *in.Hostname != *other.Hostname { - return false - } - } - - if ((in.Topology != nil) && (other.Topology != nil)) || ((in.Topology == nil) != (other.Topology == nil)) { - in, other := &in.Topology, &other.Topology - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if inValue != otherValue { - return false - } - } - } - } - } - - if (in.NodeName == nil) != (other.NodeName == nil) { - return false - } else if in.NodeName != nil { - if *in.NodeName != *other.NodeName { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EndpointConditions) DeepEqual(other *EndpointConditions) bool { - if other == nil { - return false - } - - if (in.Ready == nil) != (other.Ready == nil) { - return false - } else if in.Ready != nil { - if *in.Ready != *other.Ready { - return false - } - } - - if (in.Serving == nil) != (other.Serving == nil) { - return false - } else if in.Serving != nil { - if *in.Serving != *other.Serving { - return false - } - } - - if (in.Terminating == nil) != (other.Terminating == nil) { - return false - } else if in.Terminating != nil { - if *in.Terminating != *other.Terminating { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EndpointHints) DeepEqual(other *EndpointHints) bool { - if other == nil { - return false - } - - if ((in.ForZones != nil) && (other.ForZones != nil)) || ((in.ForZones == nil) != (other.ForZones == nil)) { - in, other := &in.ForZones, &other.ForZones - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EndpointPort) DeepEqual(other *EndpointPort) bool { - if other == nil { - return false - } - - if (in.Name == nil) != (other.Name == nil) { - return false - } else if in.Name != nil { - if *in.Name != *other.Name { - return false - } - } - - if (in.Protocol == nil) != (other.Protocol == nil) { - return false - } else if in.Protocol != nil { - if *in.Protocol != *other.Protocol { - return false - } - } - - if (in.Port == nil) != (other.Port == nil) { - return false - } else if in.Port != nil { - if *in.Port != *other.Port { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EndpointSlice) DeepEqual(other *EndpointSlice) bool { - if other == nil { - return false - } - - if in.TypeMeta != other.TypeMeta { - return false - } - - if !in.ObjectMeta.DeepEqual(&other.ObjectMeta) { - return false - } - - if in.AddressType != other.AddressType { - return false - } - if ((in.Endpoints != nil) && (other.Endpoints != nil)) || ((in.Endpoints == nil) != (other.Endpoints == nil)) { - in, other := &in.Endpoints, &other.Endpoints - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.Ports != nil) && (other.Ports != nil)) || ((in.Ports == nil) != (other.Ports == nil)) { - in, other := &in.Ports, &other.Ports - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EndpointSliceList) DeepEqual(other *EndpointSliceList) bool { - if other == nil { - return false - } - - if in.TypeMeta != other.TypeMeta { - return false - } - - if !in.ListMeta.DeepEqual(&other.ListMeta) { - return false - } - - if ((in.Items != nil) && (other.Items != nil)) || ((in.Items == nil) != (other.Items == nil)) { - in, other := &in.Items, &other.Items - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ForZone) DeepEqual(other *ForZone) bool { - if other == nil { - return false - } - - if in.Name != other.Name { - return false - } - - return true -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/doc.go deleted file mode 100644 index 269888d36..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/doc.go +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// +k8s:deepcopy-gen=package -// +k8s:protobuf-gen=package -// +k8s:openapi-gen=true -// +deepequal-gen=package -// +groupName=networking.k8s.io - -// Package v1 contains slimmer versions of k8s networking types. -package v1 diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/generated.pb.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/generated.pb.go deleted file mode 100644 index bd02e24d0..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/generated.pb.go +++ /dev/null @@ -1,2195 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/generated.proto - -package v1 - -import ( - fmt "fmt" - - github_com_cilium_cilium_pkg_k8s_slim_k8s_api_core_v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" - intstr "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/util/intstr" - - io "io" - - proto "github.com/gogo/protobuf/proto" - - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" -) - -// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -func (m *IPBlock) Reset() { *m = IPBlock{} } -func (*IPBlock) ProtoMessage() {} -func (*IPBlock) Descriptor() ([]byte, []int) { - return fileDescriptor_5d3be2d57d520df2, []int{0} -} -func (m *IPBlock) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IPBlock) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *IPBlock) XXX_Merge(src proto.Message) { - xxx_messageInfo_IPBlock.Merge(m, src) -} -func (m *IPBlock) XXX_Size() int { - return m.Size() -} -func (m *IPBlock) XXX_DiscardUnknown() { - xxx_messageInfo_IPBlock.DiscardUnknown(m) -} - -var xxx_messageInfo_IPBlock proto.InternalMessageInfo - -func (m *NetworkPolicy) Reset() { *m = NetworkPolicy{} } -func (*NetworkPolicy) ProtoMessage() {} -func (*NetworkPolicy) Descriptor() ([]byte, []int) { - return fileDescriptor_5d3be2d57d520df2, []int{1} -} -func (m *NetworkPolicy) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NetworkPolicy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NetworkPolicy) XXX_Merge(src proto.Message) { - xxx_messageInfo_NetworkPolicy.Merge(m, src) -} -func (m *NetworkPolicy) XXX_Size() int { - return m.Size() -} -func (m *NetworkPolicy) XXX_DiscardUnknown() { - xxx_messageInfo_NetworkPolicy.DiscardUnknown(m) -} - -var xxx_messageInfo_NetworkPolicy proto.InternalMessageInfo - -func (m *NetworkPolicyEgressRule) Reset() { *m = NetworkPolicyEgressRule{} } -func (*NetworkPolicyEgressRule) ProtoMessage() {} -func (*NetworkPolicyEgressRule) Descriptor() ([]byte, []int) { - return fileDescriptor_5d3be2d57d520df2, []int{2} -} -func (m *NetworkPolicyEgressRule) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NetworkPolicyEgressRule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NetworkPolicyEgressRule) XXX_Merge(src proto.Message) { - xxx_messageInfo_NetworkPolicyEgressRule.Merge(m, src) -} -func (m *NetworkPolicyEgressRule) XXX_Size() int { - return m.Size() -} -func (m *NetworkPolicyEgressRule) XXX_DiscardUnknown() { - xxx_messageInfo_NetworkPolicyEgressRule.DiscardUnknown(m) -} - -var xxx_messageInfo_NetworkPolicyEgressRule proto.InternalMessageInfo - -func (m *NetworkPolicyIngressRule) Reset() { *m = NetworkPolicyIngressRule{} } -func (*NetworkPolicyIngressRule) ProtoMessage() {} -func (*NetworkPolicyIngressRule) Descriptor() ([]byte, []int) { - return fileDescriptor_5d3be2d57d520df2, []int{3} -} -func (m *NetworkPolicyIngressRule) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NetworkPolicyIngressRule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NetworkPolicyIngressRule) XXX_Merge(src proto.Message) { - xxx_messageInfo_NetworkPolicyIngressRule.Merge(m, src) -} -func (m *NetworkPolicyIngressRule) XXX_Size() int { - return m.Size() -} -func (m *NetworkPolicyIngressRule) XXX_DiscardUnknown() { - xxx_messageInfo_NetworkPolicyIngressRule.DiscardUnknown(m) -} - -var xxx_messageInfo_NetworkPolicyIngressRule proto.InternalMessageInfo - -func (m *NetworkPolicyList) Reset() { *m = NetworkPolicyList{} } -func (*NetworkPolicyList) ProtoMessage() {} -func (*NetworkPolicyList) Descriptor() ([]byte, []int) { - return fileDescriptor_5d3be2d57d520df2, []int{4} -} -func (m *NetworkPolicyList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NetworkPolicyList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NetworkPolicyList) XXX_Merge(src proto.Message) { - xxx_messageInfo_NetworkPolicyList.Merge(m, src) -} -func (m *NetworkPolicyList) XXX_Size() int { - return m.Size() -} -func (m *NetworkPolicyList) XXX_DiscardUnknown() { - xxx_messageInfo_NetworkPolicyList.DiscardUnknown(m) -} - -var xxx_messageInfo_NetworkPolicyList proto.InternalMessageInfo - -func (m *NetworkPolicyPeer) Reset() { *m = NetworkPolicyPeer{} } -func (*NetworkPolicyPeer) ProtoMessage() {} -func (*NetworkPolicyPeer) Descriptor() ([]byte, []int) { - return fileDescriptor_5d3be2d57d520df2, []int{5} -} -func (m *NetworkPolicyPeer) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NetworkPolicyPeer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NetworkPolicyPeer) XXX_Merge(src proto.Message) { - xxx_messageInfo_NetworkPolicyPeer.Merge(m, src) -} -func (m *NetworkPolicyPeer) XXX_Size() int { - return m.Size() -} -func (m *NetworkPolicyPeer) XXX_DiscardUnknown() { - xxx_messageInfo_NetworkPolicyPeer.DiscardUnknown(m) -} - -var xxx_messageInfo_NetworkPolicyPeer proto.InternalMessageInfo - -func (m *NetworkPolicyPort) Reset() { *m = NetworkPolicyPort{} } -func (*NetworkPolicyPort) ProtoMessage() {} -func (*NetworkPolicyPort) Descriptor() ([]byte, []int) { - return fileDescriptor_5d3be2d57d520df2, []int{6} -} -func (m *NetworkPolicyPort) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NetworkPolicyPort) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NetworkPolicyPort) XXX_Merge(src proto.Message) { - xxx_messageInfo_NetworkPolicyPort.Merge(m, src) -} -func (m *NetworkPolicyPort) XXX_Size() int { - return m.Size() -} -func (m *NetworkPolicyPort) XXX_DiscardUnknown() { - xxx_messageInfo_NetworkPolicyPort.DiscardUnknown(m) -} - -var xxx_messageInfo_NetworkPolicyPort proto.InternalMessageInfo - -func (m *NetworkPolicySpec) Reset() { *m = NetworkPolicySpec{} } -func (*NetworkPolicySpec) ProtoMessage() {} -func (*NetworkPolicySpec) Descriptor() ([]byte, []int) { - return fileDescriptor_5d3be2d57d520df2, []int{7} -} -func (m *NetworkPolicySpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NetworkPolicySpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NetworkPolicySpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_NetworkPolicySpec.Merge(m, src) -} -func (m *NetworkPolicySpec) XXX_Size() int { - return m.Size() -} -func (m *NetworkPolicySpec) XXX_DiscardUnknown() { - xxx_messageInfo_NetworkPolicySpec.DiscardUnknown(m) -} - -var xxx_messageInfo_NetworkPolicySpec proto.InternalMessageInfo - -func init() { - proto.RegisterType((*IPBlock)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.networking.v1.IPBlock") - proto.RegisterType((*NetworkPolicy)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.networking.v1.NetworkPolicy") - proto.RegisterType((*NetworkPolicyEgressRule)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.networking.v1.NetworkPolicyEgressRule") - proto.RegisterType((*NetworkPolicyIngressRule)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.networking.v1.NetworkPolicyIngressRule") - proto.RegisterType((*NetworkPolicyList)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.networking.v1.NetworkPolicyList") - proto.RegisterType((*NetworkPolicyPeer)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.networking.v1.NetworkPolicyPeer") - proto.RegisterType((*NetworkPolicyPort)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.networking.v1.NetworkPolicyPort") - proto.RegisterType((*NetworkPolicySpec)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.api.networking.v1.NetworkPolicySpec") -} - -func init() { - proto.RegisterFile("github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/generated.proto", fileDescriptor_5d3be2d57d520df2) -} - -var fileDescriptor_5d3be2d57d520df2 = []byte{ - // 838 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xcf, 0x6f, 0xe4, 0x34, - 0x14, 0x9e, 0x64, 0xa6, 0x9d, 0xae, 0xcb, 0xb2, 0xd4, 0x08, 0x31, 0x5a, 0x89, 0xa4, 0x8a, 0x84, - 0xb4, 0x17, 0x1c, 0x95, 0x03, 0x5a, 0x69, 0x25, 0x40, 0x61, 0x67, 0xd1, 0x2c, 0xd0, 0x8e, 0xdc, - 0x72, 0xe1, 0x96, 0xc9, 0x78, 0x53, 0x77, 0x92, 0x38, 0xb2, 0x3d, 0x65, 0x2b, 0xed, 0x61, 0x39, - 0x21, 0x21, 0x21, 0xf1, 0x67, 0xf5, 0xb8, 0x12, 0x97, 0x3d, 0x45, 0x34, 0xfc, 0x0b, 0x70, 0xe9, - 0x09, 0xd9, 0x71, 0x26, 0xf3, 0x63, 0x11, 0x9a, 0x76, 0x56, 0x9c, 0x12, 0xbf, 0xd8, 0xdf, 0xf7, - 0xbd, 0xe7, 0xcf, 0xcf, 0x01, 0xdf, 0xc4, 0x54, 0x9e, 0x4e, 0x47, 0x28, 0x62, 0xa9, 0x1f, 0xd1, - 0x84, 0x4e, 0x67, 0x8f, 0x7c, 0x12, 0xfb, 0x93, 0x87, 0xc2, 0x17, 0x09, 0x4d, 0xf5, 0x4b, 0x98, - 0x53, 0x3f, 0x23, 0xf2, 0x47, 0xc6, 0x27, 0x34, 0x8b, 0xfd, 0xf3, 0x03, 0x3f, 0x26, 0x19, 0xe1, - 0xa1, 0x24, 0x63, 0x94, 0x73, 0x26, 0x19, 0x7c, 0xd4, 0x80, 0xa1, 0x0a, 0xa5, 0x7e, 0xe4, 0x93, - 0x18, 0x4d, 0x1e, 0x0a, 0xa4, 0xc0, 0xf4, 0x4b, 0x98, 0x53, 0xd4, 0x80, 0xa1, 0xf3, 0x83, 0xfb, - 0xfd, 0xf5, 0x94, 0x44, 0x8c, 0x93, 0x37, 0x68, 0xb8, 0xff, 0x64, 0x2d, 0x18, 0xe1, 0xa7, 0x44, - 0x86, 0x6f, 0xc2, 0x79, 0xba, 0x26, 0xce, 0x54, 0xd2, 0xc4, 0xa7, 0x99, 0x14, 0x92, 0xaf, 0x60, - 0x7d, 0x32, 0x87, 0x15, 0xb3, 0x98, 0xf9, 0x3a, 0x3c, 0x9a, 0x3e, 0xd3, 0x23, 0x3d, 0xd0, 0x6f, - 0x66, 0xba, 0x02, 0x45, 0x94, 0x29, 0xdc, 0x34, 0x8c, 0x4e, 0x69, 0x46, 0xf8, 0x85, 0x66, 0xe5, - 0xd3, 0x4c, 0xd2, 0x94, 0xac, 0xe0, 0x7f, 0xf6, 0x5f, 0x0b, 0x44, 0x74, 0x4a, 0xd2, 0x70, 0x79, - 0x9d, 0x77, 0x04, 0xba, 0x83, 0x61, 0x90, 0xb0, 0x68, 0x02, 0xf7, 0x41, 0x27, 0xa2, 0x63, 0xde, - 0xb3, 0xf6, 0xad, 0x07, 0x77, 0x82, 0x77, 0x2e, 0x0b, 0xb7, 0x55, 0x16, 0x6e, 0xe7, 0xab, 0xc1, - 0x63, 0x8c, 0xf5, 0x17, 0xe8, 0x81, 0x6d, 0xf2, 0x3c, 0x22, 0xb9, 0xec, 0xd9, 0xfb, 0xed, 0x07, - 0x77, 0x02, 0x50, 0x16, 0xee, 0x76, 0x5f, 0x47, 0xb0, 0xf9, 0xe2, 0xfd, 0x6d, 0x81, 0xbb, 0x87, - 0xd5, 0xae, 0x0e, 0x59, 0x42, 0xa3, 0x0b, 0xc8, 0xc1, 0x8e, 0xaa, 0xf0, 0x38, 0x94, 0xa1, 0xc6, - 0xde, 0xfd, 0x34, 0x40, 0x6b, 0xb9, 0x44, 0x20, 0xb5, 0x1e, 0x9d, 0x1f, 0xa0, 0xa3, 0xd1, 0x19, - 0x89, 0xe4, 0x77, 0x44, 0x86, 0x01, 0x34, 0xfa, 0x40, 0x13, 0xc3, 0x33, 0x1e, 0x98, 0x83, 0x8e, - 0xc8, 0x49, 0xd4, 0xb3, 0x35, 0xdf, 0x21, 0xba, 0x85, 0x2b, 0xd1, 0x42, 0x36, 0xc7, 0x39, 0x89, - 0x9a, 0xda, 0xa8, 0x11, 0xd6, 0x4c, 0xde, 0xb5, 0x05, 0x3e, 0x5c, 0x98, 0xd9, 0x8f, 0x39, 0x11, - 0x02, 0x4f, 0x13, 0x02, 0x05, 0xd8, 0xca, 0x19, 0x97, 0xa2, 0x67, 0xed, 0xb7, 0x37, 0x2b, 0x67, - 0xc8, 0xb8, 0x0c, 0xee, 0x1a, 0x39, 0x5b, 0x6a, 0x24, 0x70, 0xc5, 0x05, 0xcf, 0x80, 0x2d, 0x99, - 0xde, 0xa8, 0xcd, 0x32, 0x12, 0xc2, 0x03, 0x60, 0x18, 0xed, 0x13, 0x86, 0x6d, 0xc9, 0xbc, 0x9f, - 0x6c, 0xd0, 0x5b, 0x98, 0x35, 0xc8, 0xfe, 0xe7, 0xec, 0x73, 0xd0, 0x79, 0xc6, 0x59, 0xfa, 0x96, - 0xf2, 0x9f, 0x19, 0xe0, 0x09, 0x67, 0x29, 0xd6, 0x4c, 0xde, 0x5f, 0x16, 0xd8, 0x5b, 0x98, 0xf9, - 0x2d, 0x15, 0x12, 0x66, 0x2b, 0xe6, 0xff, 0xf2, 0xa6, 0xe6, 0x57, 0x78, 0xda, 0xfa, 0xef, 0x19, - 0xf6, 0x9d, 0x3a, 0x32, 0x67, 0x7c, 0x06, 0xb6, 0xa8, 0x24, 0xa9, 0x30, 0x89, 0x3f, 0xdd, 0x5c, - 0xe2, 0x4d, 0xa1, 0x07, 0x8a, 0x00, 0x57, 0x3c, 0xde, 0xcf, 0xed, 0xa5, 0xb4, 0x55, 0x81, 0xe0, - 0x73, 0xb0, 0x9b, 0xb3, 0xf1, 0x31, 0x49, 0x48, 0x24, 0x19, 0x37, 0x99, 0xf7, 0x6f, 0x9c, 0x79, - 0x38, 0x22, 0x49, 0x0d, 0x16, 0xdc, 0x2b, 0x0b, 0x77, 0x77, 0xd8, 0xa0, 0xe3, 0x79, 0x2a, 0xf8, - 0x8b, 0x05, 0xf6, 0xb2, 0x30, 0x25, 0x22, 0x0f, 0x23, 0x32, 0x13, 0x60, 0x6f, 0x52, 0xc0, 0x07, - 0x65, 0xe1, 0xee, 0x1d, 0x2e, 0x73, 0xe0, 0x55, 0x5a, 0x38, 0x01, 0x5d, 0x9a, 0xeb, 0xee, 0xda, - 0x6b, 0x6b, 0x05, 0x8f, 0x6f, 0xb5, 0x1f, 0xa6, 0x53, 0x07, 0xbb, 0x65, 0xe1, 0xd6, 0x6d, 0x1b, - 0xd7, 0x0c, 0xde, 0xaf, 0xf6, 0xf2, 0x4e, 0x30, 0x2e, 0xe1, 0x19, 0xd8, 0xd1, 0x9d, 0x3e, 0x62, - 0x89, 0xe9, 0xec, 0x87, 0xca, 0x3a, 0x43, 0x13, 0xbb, 0x2e, 0xdc, 0xcf, 0x6f, 0x74, 0xeb, 0xa2, - 0x1a, 0x01, 0xcf, 0xf0, 0x21, 0x01, 0x1d, 0x75, 0xfa, 0x4c, 0xb5, 0xbf, 0x5e, 0xb7, 0xda, 0xea, - 0xfe, 0x44, 0xd5, 0xfd, 0x89, 0x06, 0x99, 0x3c, 0xe2, 0xc7, 0x92, 0xd3, 0x2c, 0x0e, 0x76, 0xd4, - 0x49, 0x53, 0xc9, 0x60, 0x0d, 0x0f, 0x3f, 0x06, 0x5d, 0x92, 0x8d, 0x55, 0x40, 0x57, 0x75, 0xab, - 0xaa, 0x47, 0xbf, 0x0a, 0xe1, 0xfa, 0x9b, 0xf7, 0xfb, 0xb2, 0x33, 0x55, 0xb7, 0x86, 0x2f, 0xde, - 0xa2, 0x33, 0xdf, 0x37, 0x27, 0xe4, 0xdf, 0xdd, 0xf9, 0xd2, 0x02, 0x5d, 0x5a, 0xf5, 0x46, 0x73, - 0x42, 0xbf, 0xdf, 0xdc, 0x09, 0x9d, 0x6b, 0xba, 0xc1, 0x3d, 0x23, 0xa5, 0x5b, 0x07, 0x6b, 0x5a, - 0xf8, 0x02, 0x6c, 0x93, 0x4a, 0x40, 0x5b, 0x0b, 0x38, 0xd9, 0x9c, 0x80, 0xe6, 0xca, 0x0b, 0xde, - 0x35, 0xfc, 0xdb, 0x26, 0x66, 0x38, 0xe1, 0x17, 0xaa, 0xfc, 0x6a, 0xee, 0xc9, 0x45, 0x4e, 0x44, - 0xaf, 0xa3, 0xff, 0x23, 0x3e, 0xaa, 0x6a, 0x36, 0x0b, 0x5f, 0x17, 0x2e, 0x68, 0x86, 0x78, 0x7e, - 0x45, 0x10, 0x5e, 0x5e, 0x39, 0xad, 0x57, 0x57, 0x4e, 0xeb, 0xf5, 0x95, 0xd3, 0x7a, 0x59, 0x3a, - 0xd6, 0x65, 0xe9, 0x58, 0xaf, 0x4a, 0xc7, 0x7a, 0x5d, 0x3a, 0xd6, 0x1f, 0xa5, 0x63, 0xfd, 0xf6, - 0xa7, 0xd3, 0xfa, 0xe1, 0xd1, 0x2d, 0xfe, 0x69, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0x1c, 0xf7, - 0x43, 0xc0, 0x11, 0x0b, 0x00, 0x00, -} - -func (m *IPBlock) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *IPBlock) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IPBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Except) > 0 { - for iNdEx := len(m.Except) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Except[iNdEx]) - copy(dAtA[i:], m.Except[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Except[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - i -= len(m.CIDR) - copy(dAtA[i:], m.CIDR) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.CIDR))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NetworkPolicy) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NetworkPolicy) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NetworkPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NetworkPolicyEgressRule) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NetworkPolicyEgressRule) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NetworkPolicyEgressRule) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.To) > 0 { - for iNdEx := len(m.To) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.To[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Ports) > 0 { - for iNdEx := len(m.Ports) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Ports[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *NetworkPolicyIngressRule) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NetworkPolicyIngressRule) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NetworkPolicyIngressRule) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.From) > 0 { - for iNdEx := len(m.From) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.From[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Ports) > 0 { - for iNdEx := len(m.Ports) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Ports[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *NetworkPolicyList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NetworkPolicyList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NetworkPolicyList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NetworkPolicyPeer) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NetworkPolicyPeer) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NetworkPolicyPeer) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.IPBlock != nil { - { - size, err := m.IPBlock.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.NamespaceSelector != nil { - { - size, err := m.NamespaceSelector.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.PodSelector != nil { - { - size, err := m.PodSelector.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *NetworkPolicyPort) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NetworkPolicyPort) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NetworkPolicyPort) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.EndPort != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.EndPort)) - i-- - dAtA[i] = 0x18 - } - if m.Port != nil { - { - size, err := m.Port.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Protocol != nil { - i -= len(*m.Protocol) - copy(dAtA[i:], *m.Protocol) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Protocol))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *NetworkPolicySpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NetworkPolicySpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NetworkPolicySpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.PolicyTypes) > 0 { - for iNdEx := len(m.PolicyTypes) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.PolicyTypes[iNdEx]) - copy(dAtA[i:], m.PolicyTypes[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.PolicyTypes[iNdEx]))) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Egress) > 0 { - for iNdEx := len(m.Egress) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Egress[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Ingress) > 0 { - for iNdEx := len(m.Ingress) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Ingress[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.PodSelector.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *IPBlock) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.CIDR) - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Except) > 0 { - for _, s := range m.Except { - l = len(s) - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *NetworkPolicy) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *NetworkPolicyEgressRule) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Ports) > 0 { - for _, e := range m.Ports { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - if len(m.To) > 0 { - for _, e := range m.To { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *NetworkPolicyIngressRule) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Ports) > 0 { - for _, e := range m.Ports { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - if len(m.From) > 0 { - for _, e := range m.From { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *NetworkPolicyList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *NetworkPolicyPeer) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.PodSelector != nil { - l = m.PodSelector.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.NamespaceSelector != nil { - l = m.NamespaceSelector.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.IPBlock != nil { - l = m.IPBlock.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *NetworkPolicyPort) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Protocol != nil { - l = len(*m.Protocol) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Port != nil { - l = m.Port.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.EndPort != nil { - n += 1 + sovGenerated(uint64(*m.EndPort)) - } - return n -} - -func (m *NetworkPolicySpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.PodSelector.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Ingress) > 0 { - for _, e := range m.Ingress { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - if len(m.Egress) > 0 { - for _, e := range m.Egress { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - if len(m.PolicyTypes) > 0 { - for _, s := range m.PolicyTypes { - l = len(s) - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *IPBlock) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&IPBlock{`, - `CIDR:` + fmt.Sprintf("%v", this.CIDR) + `,`, - `Except:` + fmt.Sprintf("%v", this.Except) + `,`, - `}`, - }, "") - return s -} -func (this *NetworkPolicy) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NetworkPolicy{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "NetworkPolicySpec", "NetworkPolicySpec", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *NetworkPolicyEgressRule) String() string { - if this == nil { - return "nil" - } - repeatedStringForPorts := "[]NetworkPolicyPort{" - for _, f := range this.Ports { - repeatedStringForPorts += strings.Replace(strings.Replace(f.String(), "NetworkPolicyPort", "NetworkPolicyPort", 1), `&`, ``, 1) + "," - } - repeatedStringForPorts += "}" - repeatedStringForTo := "[]NetworkPolicyPeer{" - for _, f := range this.To { - repeatedStringForTo += strings.Replace(strings.Replace(f.String(), "NetworkPolicyPeer", "NetworkPolicyPeer", 1), `&`, ``, 1) + "," - } - repeatedStringForTo += "}" - s := strings.Join([]string{`&NetworkPolicyEgressRule{`, - `Ports:` + repeatedStringForPorts + `,`, - `To:` + repeatedStringForTo + `,`, - `}`, - }, "") - return s -} -func (this *NetworkPolicyIngressRule) String() string { - if this == nil { - return "nil" - } - repeatedStringForPorts := "[]NetworkPolicyPort{" - for _, f := range this.Ports { - repeatedStringForPorts += strings.Replace(strings.Replace(f.String(), "NetworkPolicyPort", "NetworkPolicyPort", 1), `&`, ``, 1) + "," - } - repeatedStringForPorts += "}" - repeatedStringForFrom := "[]NetworkPolicyPeer{" - for _, f := range this.From { - repeatedStringForFrom += strings.Replace(strings.Replace(f.String(), "NetworkPolicyPeer", "NetworkPolicyPeer", 1), `&`, ``, 1) + "," - } - repeatedStringForFrom += "}" - s := strings.Join([]string{`&NetworkPolicyIngressRule{`, - `Ports:` + repeatedStringForPorts + `,`, - `From:` + repeatedStringForFrom + `,`, - `}`, - }, "") - return s -} -func (this *NetworkPolicyList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]NetworkPolicy{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "NetworkPolicy", "NetworkPolicy", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&NetworkPolicyList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *NetworkPolicyPeer) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NetworkPolicyPeer{`, - `PodSelector:` + strings.Replace(fmt.Sprintf("%v", this.PodSelector), "LabelSelector", "v1.LabelSelector", 1) + `,`, - `NamespaceSelector:` + strings.Replace(fmt.Sprintf("%v", this.NamespaceSelector), "LabelSelector", "v1.LabelSelector", 1) + `,`, - `IPBlock:` + strings.Replace(this.IPBlock.String(), "IPBlock", "IPBlock", 1) + `,`, - `}`, - }, "") - return s -} -func (this *NetworkPolicyPort) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NetworkPolicyPort{`, - `Protocol:` + valueToStringGenerated(this.Protocol) + `,`, - `Port:` + strings.Replace(fmt.Sprintf("%v", this.Port), "IntOrString", "intstr.IntOrString", 1) + `,`, - `EndPort:` + valueToStringGenerated(this.EndPort) + `,`, - `}`, - }, "") - return s -} -func (this *NetworkPolicySpec) String() string { - if this == nil { - return "nil" - } - repeatedStringForIngress := "[]NetworkPolicyIngressRule{" - for _, f := range this.Ingress { - repeatedStringForIngress += strings.Replace(strings.Replace(f.String(), "NetworkPolicyIngressRule", "NetworkPolicyIngressRule", 1), `&`, ``, 1) + "," - } - repeatedStringForIngress += "}" - repeatedStringForEgress := "[]NetworkPolicyEgressRule{" - for _, f := range this.Egress { - repeatedStringForEgress += strings.Replace(strings.Replace(f.String(), "NetworkPolicyEgressRule", "NetworkPolicyEgressRule", 1), `&`, ``, 1) + "," - } - repeatedStringForEgress += "}" - s := strings.Join([]string{`&NetworkPolicySpec{`, - `PodSelector:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.PodSelector), "LabelSelector", "v1.LabelSelector", 1), `&`, ``, 1) + `,`, - `Ingress:` + repeatedStringForIngress + `,`, - `Egress:` + repeatedStringForEgress + `,`, - `PolicyTypes:` + fmt.Sprintf("%v", this.PolicyTypes) + `,`, - `}`, - }, "") - return s -} -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *IPBlock) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IPBlock: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IPBlock: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CIDR", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CIDR = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Except", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Except = append(m.Except, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NetworkPolicy) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NetworkPolicy: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NetworkPolicy: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NetworkPolicyEgressRule) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NetworkPolicyEgressRule: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NetworkPolicyEgressRule: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ports", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Ports = append(m.Ports, NetworkPolicyPort{}) - if err := m.Ports[len(m.Ports)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field To", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.To = append(m.To, NetworkPolicyPeer{}) - if err := m.To[len(m.To)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NetworkPolicyIngressRule) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NetworkPolicyIngressRule: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NetworkPolicyIngressRule: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ports", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Ports = append(m.Ports, NetworkPolicyPort{}) - if err := m.Ports[len(m.Ports)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.From = append(m.From, NetworkPolicyPeer{}) - if err := m.From[len(m.From)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NetworkPolicyList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NetworkPolicyList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NetworkPolicyList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, NetworkPolicy{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NetworkPolicyPeer) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NetworkPolicyPeer: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NetworkPolicyPeer: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PodSelector", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PodSelector == nil { - m.PodSelector = &v1.LabelSelector{} - } - if err := m.PodSelector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NamespaceSelector", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.NamespaceSelector == nil { - m.NamespaceSelector = &v1.LabelSelector{} - } - if err := m.NamespaceSelector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IPBlock", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.IPBlock == nil { - m.IPBlock = &IPBlock{} - } - if err := m.IPBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NetworkPolicyPort) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NetworkPolicyPort: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NetworkPolicyPort: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Protocol", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := github_com_cilium_cilium_pkg_k8s_slim_k8s_api_core_v1.Protocol(dAtA[iNdEx:postIndex]) - m.Protocol = &s - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Port", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Port == nil { - m.Port = &intstr.IntOrString{} - } - if err := m.Port.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EndPort", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.EndPort = &v - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NetworkPolicySpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NetworkPolicySpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NetworkPolicySpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PodSelector", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.PodSelector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ingress", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Ingress = append(m.Ingress, NetworkPolicyIngressRule{}) - if err := m.Ingress[len(m.Ingress)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Egress", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Egress = append(m.Egress, NetworkPolicyEgressRule{}) - if err := m.Egress[len(m.Egress)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PolicyTypes", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PolicyTypes = append(m.PolicyTypes, PolicyType(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenerated(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenerated - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenerated - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenerated - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") -) diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/generated.proto b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/generated.proto deleted file mode 100644 index 6f90ad2e5..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/generated.proto +++ /dev/null @@ -1,199 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - - -// This file was autogenerated by go-to-protobuf. Do not edit it manually! - -syntax = "proto2"; - -package github.com.cilium.cilium.pkg.k8s.slim.k8s.api.networking.v1; - -import "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1/generated.proto"; -import "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/generated.proto"; -import "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/util/intstr/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; - -// Package-wide variables from generator "generated". -option go_package = "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1"; - -// IPBlock describes a particular CIDR (Ex. "192.168.1.0/24","2001:db8::/64") that is allowed -// to the pods matched by a NetworkPolicySpec's podSelector. The except entry describes CIDRs -// that should not be included within this rule. -message IPBlock { - // cidr is a string representing the IPBlock - // Valid examples are "192.168.1.0/24" or "2001:db8::/64" - optional string cidr = 1; - - // except is a slice of CIDRs that should not be included within an IPBlock - // Valid examples are "192.168.1.0/24" or "2001:db8::/64" - // Except values will be rejected if they are outside the cidr range - // +optional - // +listType=atomic - repeated string except = 2; -} - -// NetworkPolicy describes what network traffic is allowed for a set of Pods -message NetworkPolicy { - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ObjectMeta metadata = 1; - - // spec represents the specification of the desired behavior for this NetworkPolicy. - // +optional - optional NetworkPolicySpec spec = 2; -} - -// NetworkPolicyEgressRule describes a particular set of traffic that is allowed out of pods -// matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and to. -// This type is beta-level in 1.8 -message NetworkPolicyEgressRule { - // ports is a list of destination ports for outgoing traffic. - // Each item in this list is combined using a logical OR. If this field is - // empty or missing, this rule matches all ports (traffic not restricted by port). - // If this field is present and contains at least one item, then this rule allows - // traffic only if the traffic matches at least one port in the list. - // +optional - // +listType=atomic - repeated NetworkPolicyPort ports = 1; - - // to is a list of destinations for outgoing traffic of pods selected for this rule. - // Items in this list are combined using a logical OR operation. If this field is - // empty or missing, this rule matches all destinations (traffic not restricted by - // destination). If this field is present and contains at least one item, this rule - // allows traffic only if the traffic matches at least one item in the to list. - // +optional - // +listType=atomic - repeated NetworkPolicyPeer to = 2; -} - -// NetworkPolicyIngressRule describes a particular set of traffic that is allowed to the pods -// matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and from. -message NetworkPolicyIngressRule { - // ports is a list of ports which should be made accessible on the pods selected for - // this rule. Each item in this list is combined using a logical OR. If this field is - // empty or missing, this rule matches all ports (traffic not restricted by port). - // If this field is present and contains at least one item, then this rule allows - // traffic only if the traffic matches at least one port in the list. - // +optional - // +listType=atomic - repeated NetworkPolicyPort ports = 1; - - // from is a list of sources which should be able to access the pods selected for this rule. - // Items in this list are combined using a logical OR operation. If this field is - // empty or missing, this rule matches all sources (traffic not restricted by - // source). If this field is present and contains at least one item, this rule - // allows traffic only if the traffic matches at least one item in the from list. - // +optional - // +listType=atomic - repeated NetworkPolicyPeer from = 2; -} - -// NetworkPolicyList is a list of NetworkPolicy objects. -message NetworkPolicyList { - // Standard list metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ListMeta metadata = 1; - - // items is a list of schema objects. - repeated NetworkPolicy items = 2; -} - -// NetworkPolicyPeer describes a peer to allow traffic to/from. Only certain combinations of -// fields are allowed -message NetworkPolicyPeer { - // podSelector is a label selector which selects pods. This field follows standard label - // selector semantics; if present but empty, it selects all pods. - // - // If namespaceSelector is also set, then the NetworkPolicyPeer as a whole selects - // the pods matching podSelector in the Namespaces selected by NamespaceSelector. - // Otherwise it selects the pods matching podSelector in the policy's own namespace. - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.LabelSelector podSelector = 1; - - // namespaceSelector selects namespaces using cluster-scoped labels. This field follows - // standard label selector semantics; if present but empty, it selects all namespaces. - // - // If podSelector is also set, then the NetworkPolicyPeer as a whole selects - // the pods matching podSelector in the namespaces selected by namespaceSelector. - // Otherwise it selects all pods in the namespaces selected by namespaceSelector. - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.LabelSelector namespaceSelector = 2; - - // ipBlock defines policy on a particular IPBlock. If this field is set then - // neither of the other fields can be. - // +optional - optional IPBlock ipBlock = 3; -} - -// NetworkPolicyPort describes a port to allow traffic on -message NetworkPolicyPort { - // protocol represents the protocol (TCP, UDP, or SCTP) which traffic must match. - // If not specified, this field defaults to TCP. - // +optional - optional string protocol = 1; - - // port represents the port on the given protocol. This can either be a numerical or named - // port on a pod. If this field is not provided, this matches all port names and - // numbers. - // If present, only traffic on the specified protocol AND port will be matched. - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.util.intstr.IntOrString port = 2; - - // endPort indicates that the range of ports from port to endPort if set, inclusive, - // should be allowed by the policy. This field cannot be defined if the port field - // is not defined or if the port field is defined as a named (string) port. - // The endPort must be equal or greater than port. - // +optional - optional int32 endPort = 3; -} - -// NetworkPolicySpec provides the specification of a NetworkPolicy -message NetworkPolicySpec { - // podSelector selects the pods to which this NetworkPolicy object applies. - // The array of ingress rules is applied to any pods selected by this field. - // Multiple network policies can select the same set of pods. In this case, - // the ingress rules for each are combined additively. - // This field is NOT optional and follows standard label selector semantics. - // An empty podSelector matches all pods in this namespace. - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.LabelSelector podSelector = 1; - - // ingress is a list of ingress rules to be applied to the selected pods. - // Traffic is allowed to a pod if there are no NetworkPolicies selecting the pod - // (and cluster policy otherwise allows the traffic), OR if the traffic source is - // the pod's local node, OR if the traffic matches at least one ingress rule - // across all of the NetworkPolicy objects whose podSelector matches the pod. If - // this field is empty then this NetworkPolicy does not allow any traffic (and serves - // solely to ensure that the pods it selects are isolated by default) - // +optional - // +listType=atomic - repeated NetworkPolicyIngressRule ingress = 2; - - // egress is a list of egress rules to be applied to the selected pods. Outgoing traffic - // is allowed if there are no NetworkPolicies selecting the pod (and cluster policy - // otherwise allows the traffic), OR if the traffic matches at least one egress rule - // across all of the NetworkPolicy objects whose podSelector matches the pod. If - // this field is empty then this NetworkPolicy limits all outgoing traffic (and serves - // solely to ensure that the pods it selects are isolated by default). - // This field is beta-level in 1.8 - // +optional - // +listType=atomic - repeated NetworkPolicyEgressRule egress = 3; - - // policyTypes is a list of rule types that the NetworkPolicy relates to. - // Valid options are ["Ingress"], ["Egress"], or ["Ingress", "Egress"]. - // If this field is not specified, it will default based on the existence of ingress or egress rules; - // policies that contain an egress section are assumed to affect egress, and all policies - // (whether or not they contain an ingress section) are assumed to affect ingress. - // If you want to write an egress-only policy, you must explicitly specify policyTypes [ "Egress" ]. - // Likewise, if you want to write a policy that specifies that no egress is allowed, - // you must specify a policyTypes value that include "Egress" (since such a policy would not include - // an egress section and would otherwise default to just [ "Ingress" ]). - // This field is beta-level in 1.8 - // +optional - // +listType=atomic - repeated string policyTypes = 4; -} - diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/register.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/register.go deleted file mode 100644 index db5db6022..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/register.go +++ /dev/null @@ -1,42 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2017 The Kubernetes Authors. - -package v1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -// GroupName is the group name use in this package -const GroupName = "networking.k8s.io" - -// SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -var ( - // TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api. - // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - localSchemeBuilder = &SchemeBuilder - AddToScheme = localSchemeBuilder.AddToScheme -) - -// Adds the list of known types to the given scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &NetworkPolicy{}, - &NetworkPolicyList{}, - ) - - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/types.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/types.go deleted file mode 100644 index b7273ea15..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/types.go +++ /dev/null @@ -1,218 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2017 The Kubernetes Authors. - -package v1 - -import ( - slim_corev1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - slim_metav1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" - "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/util/intstr" -) - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// NetworkPolicy describes what network traffic is allowed for a set of Pods -type NetworkPolicy struct { - slim_metav1.TypeMeta `json:",inline"` - - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - slim_metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // spec represents the specification of the desired behavior for this NetworkPolicy. - // +optional - Spec NetworkPolicySpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - - // Status is tombstoned to show why 3 is a reserved protobuf tag. - // This commented field should remain, so in the future if we decide to reimplement - // NetworkPolicyStatus a different protobuf name and tag SHOULD be used! - // Status NetworkPolicyStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// PolicyType string describes the NetworkPolicy type -// This type is beta-level in 1.8 -// +enum -type PolicyType string - -const ( - // PolicyTypeIngress is a NetworkPolicy that affects ingress traffic on selected pods - PolicyTypeIngress PolicyType = "Ingress" - // PolicyTypeEgress is a NetworkPolicy that affects egress traffic on selected pods - PolicyTypeEgress PolicyType = "Egress" -) - -// NetworkPolicySpec provides the specification of a NetworkPolicy -type NetworkPolicySpec struct { - // podSelector selects the pods to which this NetworkPolicy object applies. - // The array of ingress rules is applied to any pods selected by this field. - // Multiple network policies can select the same set of pods. In this case, - // the ingress rules for each are combined additively. - // This field is NOT optional and follows standard label selector semantics. - // An empty podSelector matches all pods in this namespace. - PodSelector slim_metav1.LabelSelector `json:"podSelector" protobuf:"bytes,1,opt,name=podSelector"` - - // ingress is a list of ingress rules to be applied to the selected pods. - // Traffic is allowed to a pod if there are no NetworkPolicies selecting the pod - // (and cluster policy otherwise allows the traffic), OR if the traffic source is - // the pod's local node, OR if the traffic matches at least one ingress rule - // across all of the NetworkPolicy objects whose podSelector matches the pod. If - // this field is empty then this NetworkPolicy does not allow any traffic (and serves - // solely to ensure that the pods it selects are isolated by default) - // +optional - // +listType=atomic - Ingress []NetworkPolicyIngressRule `json:"ingress,omitempty" protobuf:"bytes,2,rep,name=ingress"` - - // egress is a list of egress rules to be applied to the selected pods. Outgoing traffic - // is allowed if there are no NetworkPolicies selecting the pod (and cluster policy - // otherwise allows the traffic), OR if the traffic matches at least one egress rule - // across all of the NetworkPolicy objects whose podSelector matches the pod. If - // this field is empty then this NetworkPolicy limits all outgoing traffic (and serves - // solely to ensure that the pods it selects are isolated by default). - // This field is beta-level in 1.8 - // +optional - // +listType=atomic - Egress []NetworkPolicyEgressRule `json:"egress,omitempty" protobuf:"bytes,3,rep,name=egress"` - - // policyTypes is a list of rule types that the NetworkPolicy relates to. - // Valid options are ["Ingress"], ["Egress"], or ["Ingress", "Egress"]. - // If this field is not specified, it will default based on the existence of ingress or egress rules; - // policies that contain an egress section are assumed to affect egress, and all policies - // (whether or not they contain an ingress section) are assumed to affect ingress. - // If you want to write an egress-only policy, you must explicitly specify policyTypes [ "Egress" ]. - // Likewise, if you want to write a policy that specifies that no egress is allowed, - // you must specify a policyTypes value that include "Egress" (since such a policy would not include - // an egress section and would otherwise default to just [ "Ingress" ]). - // This field is beta-level in 1.8 - // +optional - // +listType=atomic - PolicyTypes []PolicyType `json:"policyTypes,omitempty" protobuf:"bytes,4,rep,name=policyTypes,casttype=PolicyType"` -} - -// NetworkPolicyIngressRule describes a particular set of traffic that is allowed to the pods -// matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and from. -type NetworkPolicyIngressRule struct { - // ports is a list of ports which should be made accessible on the pods selected for - // this rule. Each item in this list is combined using a logical OR. If this field is - // empty or missing, this rule matches all ports (traffic not restricted by port). - // If this field is present and contains at least one item, then this rule allows - // traffic only if the traffic matches at least one port in the list. - // +optional - // +listType=atomic - Ports []NetworkPolicyPort `json:"ports,omitempty" protobuf:"bytes,1,rep,name=ports"` - - // from is a list of sources which should be able to access the pods selected for this rule. - // Items in this list are combined using a logical OR operation. If this field is - // empty or missing, this rule matches all sources (traffic not restricted by - // source). If this field is present and contains at least one item, this rule - // allows traffic only if the traffic matches at least one item in the from list. - // +optional - // +listType=atomic - From []NetworkPolicyPeer `json:"from,omitempty" protobuf:"bytes,2,rep,name=from"` -} - -// NetworkPolicyEgressRule describes a particular set of traffic that is allowed out of pods -// matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and to. -// This type is beta-level in 1.8 -type NetworkPolicyEgressRule struct { - // ports is a list of destination ports for outgoing traffic. - // Each item in this list is combined using a logical OR. If this field is - // empty or missing, this rule matches all ports (traffic not restricted by port). - // If this field is present and contains at least one item, then this rule allows - // traffic only if the traffic matches at least one port in the list. - // +optional - // +listType=atomic - Ports []NetworkPolicyPort `json:"ports,omitempty" protobuf:"bytes,1,rep,name=ports"` - - // to is a list of destinations for outgoing traffic of pods selected for this rule. - // Items in this list are combined using a logical OR operation. If this field is - // empty or missing, this rule matches all destinations (traffic not restricted by - // destination). If this field is present and contains at least one item, this rule - // allows traffic only if the traffic matches at least one item in the to list. - // +optional - // +listType=atomic - To []NetworkPolicyPeer `json:"to,omitempty" protobuf:"bytes,2,rep,name=to"` -} - -// NetworkPolicyPort describes a port to allow traffic on -type NetworkPolicyPort struct { - // protocol represents the protocol (TCP, UDP, or SCTP) which traffic must match. - // If not specified, this field defaults to TCP. - // +optional - Protocol *slim_corev1.Protocol `json:"protocol,omitempty" protobuf:"bytes,1,opt,name=protocol,casttype=k8s.io/api/core/v1.Protocol"` - - // port represents the port on the given protocol. This can either be a numerical or named - // port on a pod. If this field is not provided, this matches all port names and - // numbers. - // If present, only traffic on the specified protocol AND port will be matched. - // +optional - Port *intstr.IntOrString `json:"port,omitempty" protobuf:"bytes,2,opt,name=port"` - - // endPort indicates that the range of ports from port to endPort if set, inclusive, - // should be allowed by the policy. This field cannot be defined if the port field - // is not defined or if the port field is defined as a named (string) port. - // The endPort must be equal or greater than port. - // +optional - EndPort *int32 `json:"endPort,omitempty" protobuf:"bytes,3,opt,name=endPort"` -} - -// IPBlock describes a particular CIDR (Ex. "192.168.1.0/24","2001:db8::/64") that is allowed -// to the pods matched by a NetworkPolicySpec's podSelector. The except entry describes CIDRs -// that should not be included within this rule. -type IPBlock struct { - // cidr is a string representing the IPBlock - // Valid examples are "192.168.1.0/24" or "2001:db8::/64" - CIDR string `json:"cidr" protobuf:"bytes,1,name=cidr"` - - // except is a slice of CIDRs that should not be included within an IPBlock - // Valid examples are "192.168.1.0/24" or "2001:db8::/64" - // Except values will be rejected if they are outside the cidr range - // +optional - // +listType=atomic - Except []string `json:"except,omitempty" protobuf:"bytes,2,rep,name=except"` -} - -// NetworkPolicyPeer describes a peer to allow traffic to/from. Only certain combinations of -// fields are allowed -type NetworkPolicyPeer struct { - // podSelector is a label selector which selects pods. This field follows standard label - // selector semantics; if present but empty, it selects all pods. - // - // If namespaceSelector is also set, then the NetworkPolicyPeer as a whole selects - // the pods matching podSelector in the Namespaces selected by NamespaceSelector. - // Otherwise it selects the pods matching podSelector in the policy's own namespace. - // +optional - PodSelector *slim_metav1.LabelSelector `json:"podSelector,omitempty" protobuf:"bytes,1,opt,name=podSelector"` - - // namespaceSelector selects namespaces using cluster-scoped labels. This field follows - // standard label selector semantics; if present but empty, it selects all namespaces. - // - // If podSelector is also set, then the NetworkPolicyPeer as a whole selects - // the pods matching podSelector in the namespaces selected by namespaceSelector. - // Otherwise it selects all pods in the namespaces selected by namespaceSelector. - // +optional - NamespaceSelector *slim_metav1.LabelSelector `json:"namespaceSelector,omitempty" protobuf:"bytes,2,opt,name=namespaceSelector"` - - // ipBlock defines policy on a particular IPBlock. If this field is set then - // neither of the other fields can be. - // +optional - IPBlock *IPBlock `json:"ipBlock,omitempty" protobuf:"bytes,3,rep,name=ipBlock"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// NetworkPolicyList is a list of NetworkPolicy objects. -type NetworkPolicyList struct { - slim_metav1.TypeMeta `json:",inline"` - - // Standard list metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - slim_metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // items is a list of schema objects. - Items []NetworkPolicy `json:"items" protobuf:"bytes,2,rep,name=items"` -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/well_known_annotations.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/well_known_annotations.go deleted file mode 100644 index 136d2456a..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/well_known_annotations.go +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2020 The Kubernetes Authors. - -package v1 - -const ( - // AnnotationIsDefaultIngressClass can be used to indicate that an - // IngressClass should be considered default. When a single IngressClass - // resource has this annotation set to true, new Ingress resources without a - // class specified will be assigned this default class. - AnnotationIsDefaultIngressClass = "ingressclass.kubernetes.io/is-default-class" -) diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/zz_generated.deepcopy.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/zz_generated.deepcopy.go deleted file mode 100644 index 3e9b95434..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/zz_generated.deepcopy.go +++ /dev/null @@ -1,255 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1 - -import ( - corev1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - metav1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" - intstr "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/util/intstr" - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPBlock) DeepCopyInto(out *IPBlock) { - *out = *in - if in.Except != nil { - in, out := &in.Except, &out.Except - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPBlock. -func (in *IPBlock) DeepCopy() *IPBlock { - if in == nil { - return nil - } - out := new(IPBlock) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NetworkPolicy) DeepCopyInto(out *NetworkPolicy) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkPolicy. -func (in *NetworkPolicy) DeepCopy() *NetworkPolicy { - if in == nil { - return nil - } - out := new(NetworkPolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NetworkPolicy) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NetworkPolicyEgressRule) DeepCopyInto(out *NetworkPolicyEgressRule) { - *out = *in - if in.Ports != nil { - in, out := &in.Ports, &out.Ports - *out = make([]NetworkPolicyPort, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.To != nil { - in, out := &in.To, &out.To - *out = make([]NetworkPolicyPeer, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkPolicyEgressRule. -func (in *NetworkPolicyEgressRule) DeepCopy() *NetworkPolicyEgressRule { - if in == nil { - return nil - } - out := new(NetworkPolicyEgressRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NetworkPolicyIngressRule) DeepCopyInto(out *NetworkPolicyIngressRule) { - *out = *in - if in.Ports != nil { - in, out := &in.Ports, &out.Ports - *out = make([]NetworkPolicyPort, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.From != nil { - in, out := &in.From, &out.From - *out = make([]NetworkPolicyPeer, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkPolicyIngressRule. -func (in *NetworkPolicyIngressRule) DeepCopy() *NetworkPolicyIngressRule { - if in == nil { - return nil - } - out := new(NetworkPolicyIngressRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NetworkPolicyList) DeepCopyInto(out *NetworkPolicyList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]NetworkPolicy, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkPolicyList. -func (in *NetworkPolicyList) DeepCopy() *NetworkPolicyList { - if in == nil { - return nil - } - out := new(NetworkPolicyList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NetworkPolicyList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NetworkPolicyPeer) DeepCopyInto(out *NetworkPolicyPeer) { - *out = *in - if in.PodSelector != nil { - in, out := &in.PodSelector, &out.PodSelector - *out = new(metav1.LabelSelector) - (*in).DeepCopyInto(*out) - } - if in.NamespaceSelector != nil { - in, out := &in.NamespaceSelector, &out.NamespaceSelector - *out = new(metav1.LabelSelector) - (*in).DeepCopyInto(*out) - } - if in.IPBlock != nil { - in, out := &in.IPBlock, &out.IPBlock - *out = new(IPBlock) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkPolicyPeer. -func (in *NetworkPolicyPeer) DeepCopy() *NetworkPolicyPeer { - if in == nil { - return nil - } - out := new(NetworkPolicyPeer) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NetworkPolicyPort) DeepCopyInto(out *NetworkPolicyPort) { - *out = *in - if in.Protocol != nil { - in, out := &in.Protocol, &out.Protocol - *out = new(corev1.Protocol) - **out = **in - } - if in.Port != nil { - in, out := &in.Port, &out.Port - *out = new(intstr.IntOrString) - **out = **in - } - if in.EndPort != nil { - in, out := &in.EndPort, &out.EndPort - *out = new(int32) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkPolicyPort. -func (in *NetworkPolicyPort) DeepCopy() *NetworkPolicyPort { - if in == nil { - return nil - } - out := new(NetworkPolicyPort) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NetworkPolicySpec) DeepCopyInto(out *NetworkPolicySpec) { - *out = *in - in.PodSelector.DeepCopyInto(&out.PodSelector) - if in.Ingress != nil { - in, out := &in.Ingress, &out.Ingress - *out = make([]NetworkPolicyIngressRule, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Egress != nil { - in, out := &in.Egress, &out.Egress - *out = make([]NetworkPolicyEgressRule, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.PolicyTypes != nil { - in, out := &in.PolicyTypes, &out.PolicyTypes - *out = make([]PolicyType, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkPolicySpec. -func (in *NetworkPolicySpec) DeepCopy() *NetworkPolicySpec { - if in == nil { - return nil - } - out := new(NetworkPolicySpec) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/zz_generated.deepequal.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/zz_generated.deepequal.go deleted file mode 100644 index eec20108d..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1/zz_generated.deepequal.go +++ /dev/null @@ -1,317 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepequal-gen. DO NOT EDIT. - -package v1 - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *IPBlock) DeepEqual(other *IPBlock) bool { - if other == nil { - return false - } - - if in.CIDR != other.CIDR { - return false - } - if ((in.Except != nil) && (other.Except != nil)) || ((in.Except == nil) != (other.Except == nil)) { - in, other := &in.Except, &other.Except - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *NetworkPolicy) DeepEqual(other *NetworkPolicy) bool { - if other == nil { - return false - } - - if in.TypeMeta != other.TypeMeta { - return false - } - - if !in.ObjectMeta.DeepEqual(&other.ObjectMeta) { - return false - } - - if !in.Spec.DeepEqual(&other.Spec) { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *NetworkPolicyEgressRule) DeepEqual(other *NetworkPolicyEgressRule) bool { - if other == nil { - return false - } - - if ((in.Ports != nil) && (other.Ports != nil)) || ((in.Ports == nil) != (other.Ports == nil)) { - in, other := &in.Ports, &other.Ports - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.To != nil) && (other.To != nil)) || ((in.To == nil) != (other.To == nil)) { - in, other := &in.To, &other.To - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *NetworkPolicyIngressRule) DeepEqual(other *NetworkPolicyIngressRule) bool { - if other == nil { - return false - } - - if ((in.Ports != nil) && (other.Ports != nil)) || ((in.Ports == nil) != (other.Ports == nil)) { - in, other := &in.Ports, &other.Ports - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.From != nil) && (other.From != nil)) || ((in.From == nil) != (other.From == nil)) { - in, other := &in.From, &other.From - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *NetworkPolicyList) DeepEqual(other *NetworkPolicyList) bool { - if other == nil { - return false - } - - if in.TypeMeta != other.TypeMeta { - return false - } - - if !in.ListMeta.DeepEqual(&other.ListMeta) { - return false - } - - if ((in.Items != nil) && (other.Items != nil)) || ((in.Items == nil) != (other.Items == nil)) { - in, other := &in.Items, &other.Items - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *NetworkPolicyPeer) DeepEqual(other *NetworkPolicyPeer) bool { - if other == nil { - return false - } - - if (in.PodSelector == nil) != (other.PodSelector == nil) { - return false - } else if in.PodSelector != nil { - if !in.PodSelector.DeepEqual(other.PodSelector) { - return false - } - } - - if (in.NamespaceSelector == nil) != (other.NamespaceSelector == nil) { - return false - } else if in.NamespaceSelector != nil { - if !in.NamespaceSelector.DeepEqual(other.NamespaceSelector) { - return false - } - } - - if (in.IPBlock == nil) != (other.IPBlock == nil) { - return false - } else if in.IPBlock != nil { - if !in.IPBlock.DeepEqual(other.IPBlock) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *NetworkPolicyPort) DeepEqual(other *NetworkPolicyPort) bool { - if other == nil { - return false - } - - if (in.Protocol == nil) != (other.Protocol == nil) { - return false - } else if in.Protocol != nil { - if *in.Protocol != *other.Protocol { - return false - } - } - - if (in.Port == nil) != (other.Port == nil) { - return false - } else if in.Port != nil { - if !in.Port.DeepEqual(other.Port) { - return false - } - } - - if (in.EndPort == nil) != (other.EndPort == nil) { - return false - } else if in.EndPort != nil { - if *in.EndPort != *other.EndPort { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *NetworkPolicySpec) DeepEqual(other *NetworkPolicySpec) bool { - if other == nil { - return false - } - - if !in.PodSelector.DeepEqual(&other.PodSelector) { - return false - } - - if ((in.Ingress != nil) && (other.Ingress != nil)) || ((in.Ingress == nil) != (other.Ingress == nil)) { - in, other := &in.Ingress, &other.Ingress - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.Egress != nil) && (other.Egress != nil)) || ((in.Egress == nil) != (other.Egress == nil)) { - in, other := &in.Egress, &other.Egress - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.PolicyTypes != nil) && (other.PolicyTypes != nil)) || ((in.PolicyTypes == nil) != (other.PolicyTypes == nil)) { - in, other := &in.PolicyTypes, &other.PolicyTypes - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - return true -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-client/clientset/versioned/scheme/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-client/clientset/versioned/scheme/doc.go deleted file mode 100644 index ba3451535..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-client/clientset/versioned/scheme/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -// This package contains the scheme of the automatically generated clientset. -package scheme diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-client/clientset/versioned/scheme/register.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-client/clientset/versioned/scheme/register.go deleted file mode 100644 index cc6ff2709..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-client/clientset/versioned/scheme/register.go +++ /dev/null @@ -1,43 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package scheme - -import ( - apiextensionsv1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" -) - -var Scheme = runtime.NewScheme() -var Codecs = serializer.NewCodecFactory(Scheme) -var ParameterCodec = runtime.NewParameterCodec(Scheme) -var localSchemeBuilder = runtime.SchemeBuilder{ - apiextensionsv1.AddToScheme, -} - -// AddToScheme adds all types of this clientset into the given scheme. This allows composition -// of clientsets, like in: -// -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) -// -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) -// -// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types -// correctly. -var AddToScheme = localSchemeBuilder.AddToScheme - -func init() { - v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) - utilruntime.Must(AddToScheme(Scheme)) -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-client/clientset/versioned/typed/apiextensions/v1/apiextensions_client.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-client/clientset/versioned/typed/apiextensions/v1/apiextensions_client.go deleted file mode 100644 index 5f5e04bd9..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-client/clientset/versioned/typed/apiextensions/v1/apiextensions_client.go +++ /dev/null @@ -1,94 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "net/http" - - "github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-client/clientset/versioned/scheme" - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1" - rest "k8s.io/client-go/rest" -) - -type ApiextensionsV1Interface interface { - RESTClient() rest.Interface - CustomResourceDefinitionsGetter -} - -// ApiextensionsV1Client is used to interact with features provided by the apiextensions.k8s.io group. -type ApiextensionsV1Client struct { - restClient rest.Interface -} - -func (c *ApiextensionsV1Client) CustomResourceDefinitions() CustomResourceDefinitionInterface { - return newCustomResourceDefinitions(c) -} - -// NewForConfig creates a new ApiextensionsV1Client for the given config. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*ApiextensionsV1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - httpClient, err := rest.HTTPClientFor(&config) - if err != nil { - return nil, err - } - return NewForConfigAndClient(&config, httpClient) -} - -// NewForConfigAndClient creates a new ApiextensionsV1Client for the given config and http client. -// Note the http client provided takes precedence over the configured transport values. -func NewForConfigAndClient(c *rest.Config, h *http.Client) (*ApiextensionsV1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientForConfigAndClient(&config, h) - if err != nil { - return nil, err - } - return &ApiextensionsV1Client{client}, nil -} - -// NewForConfigOrDie creates a new ApiextensionsV1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *ApiextensionsV1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new ApiextensionsV1Client for the given RESTClient. -func New(c rest.Interface) *ApiextensionsV1Client { - return &ApiextensionsV1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() - - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *ApiextensionsV1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-client/clientset/versioned/typed/apiextensions/v1/customresourcedefinition.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-client/clientset/versioned/typed/apiextensions/v1/customresourcedefinition.go deleted file mode 100644 index d251544ef..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-client/clientset/versioned/typed/apiextensions/v1/customresourcedefinition.go +++ /dev/null @@ -1,155 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - scheme "github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-client/clientset/versioned/scheme" - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// CustomResourceDefinitionsGetter has a method to return a CustomResourceDefinitionInterface. -// A group's client should implement this interface. -type CustomResourceDefinitionsGetter interface { - CustomResourceDefinitions() CustomResourceDefinitionInterface -} - -// CustomResourceDefinitionInterface has methods to work with CustomResourceDefinition resources. -type CustomResourceDefinitionInterface interface { - Create(ctx context.Context, customResourceDefinition *v1.CustomResourceDefinition, opts metav1.CreateOptions) (*v1.CustomResourceDefinition, error) - Update(ctx context.Context, customResourceDefinition *v1.CustomResourceDefinition, opts metav1.UpdateOptions) (*v1.CustomResourceDefinition, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.CustomResourceDefinition, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.CustomResourceDefinitionList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CustomResourceDefinition, err error) - CustomResourceDefinitionExpansion -} - -// customResourceDefinitions implements CustomResourceDefinitionInterface -type customResourceDefinitions struct { - client rest.Interface -} - -// newCustomResourceDefinitions returns a CustomResourceDefinitions -func newCustomResourceDefinitions(c *ApiextensionsV1Client) *customResourceDefinitions { - return &customResourceDefinitions{ - client: c.RESTClient(), - } -} - -// Get takes name of the customResourceDefinition, and returns the corresponding customResourceDefinition object, and an error if there is any. -func (c *customResourceDefinitions) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CustomResourceDefinition, err error) { - result = &v1.CustomResourceDefinition{} - err = c.client.Get(). - Resource("customresourcedefinitions"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CustomResourceDefinitions that match those selectors. -func (c *customResourceDefinitions) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CustomResourceDefinitionList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.CustomResourceDefinitionList{} - err = c.client.Get(). - Resource("customresourcedefinitions"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested customResourceDefinitions. -func (c *customResourceDefinitions) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("customresourcedefinitions"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a customResourceDefinition and creates it. Returns the server's representation of the customResourceDefinition, and an error, if there is any. -func (c *customResourceDefinitions) Create(ctx context.Context, customResourceDefinition *v1.CustomResourceDefinition, opts metav1.CreateOptions) (result *v1.CustomResourceDefinition, err error) { - result = &v1.CustomResourceDefinition{} - err = c.client.Post(). - Resource("customresourcedefinitions"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(customResourceDefinition). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a customResourceDefinition and updates it. Returns the server's representation of the customResourceDefinition, and an error, if there is any. -func (c *customResourceDefinitions) Update(ctx context.Context, customResourceDefinition *v1.CustomResourceDefinition, opts metav1.UpdateOptions) (result *v1.CustomResourceDefinition, err error) { - result = &v1.CustomResourceDefinition{} - err = c.client.Put(). - Resource("customresourcedefinitions"). - Name(customResourceDefinition.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(customResourceDefinition). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the customResourceDefinition and deletes it. Returns an error if one occurs. -func (c *customResourceDefinitions) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("customresourcedefinitions"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *customResourceDefinitions) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("customresourcedefinitions"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched customResourceDefinition. -func (c *customResourceDefinitions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CustomResourceDefinition, err error) { - result = &v1.CustomResourceDefinition{} - err = c.client.Patch(pt). - Resource("customresourcedefinitions"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-client/clientset/versioned/typed/apiextensions/v1/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-client/clientset/versioned/typed/apiextensions/v1/doc.go deleted file mode 100644 index 50cfbd485..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-client/clientset/versioned/typed/apiextensions/v1/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated typed clients. -package v1 diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-client/clientset/versioned/typed/apiextensions/v1/generated_expansion.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-client/clientset/versioned/typed/apiextensions/v1/generated_expansion.go deleted file mode 100644 index 2ea7378ea..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-client/clientset/versioned/typed/apiextensions/v1/generated_expansion.go +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -type CustomResourceDefinitionExpansion interface{} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-clientset/clientset.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-clientset/clientset.go deleted file mode 100644 index e15d6ef49..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-clientset/clientset.go +++ /dev/null @@ -1,89 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright The Kubernetes Authors. - -package clientset - -import ( - "fmt" - "net/http" - - apiextclientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" - apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1" - apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1" - rest "k8s.io/client-go/rest" - flowcontrol "k8s.io/client-go/util/flowcontrol" - - slim_apiextensionsv1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apiextensions-client/clientset/versioned/typed/apiextensions/v1" -) - -// Clientset contains the clients for groups. Each group has exactly one -// version included in a Clientset. -type Clientset struct { - *apiextclientset.Clientset - apiextensionsV1beta1 *apiextensionsv1beta1.ApiextensionsV1beta1Client - apiextensionsV1 *apiextensionsv1.ApiextensionsV1Client -} - -// ApiextensionsV1 retrieves the ApiextensionsV1Client -func (c *Clientset) ApiextensionsV1() apiextensionsv1.ApiextensionsV1Interface { - return c.apiextensionsV1 -} - -// ApiextensionsV1beta1 retrieves the ApiextensionsV1beta1Client -func (c *Clientset) ApiextensionsV1beta1() apiextensionsv1beta1.ApiextensionsV1beta1Interface { - return c.apiextensionsV1beta1 -} - -// NewForConfigAndClient creates a new Clientset for the given config and http client. -// Note the http client provided takes precedence over the configured transport values. -// If config's RateLimiter is not set and QPS and Burst are acceptable, -// NewForConfigAndClient will generate a rate-limiter in configShallowCopy. -func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) { - configShallowCopy := *c - if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { - if configShallowCopy.Burst <= 0 { - return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") - } - configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) - } - var cs Clientset - var err error - cs.Clientset, err = apiextclientset.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - - // Wrap extensionsV1 with our own implementation - extensionsV1, err := slim_apiextensionsv1.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - cs.apiextensionsV1 = apiextensionsv1.New(extensionsV1.RESTClient()) - - return &cs, nil -} - -// NewForConfigOrDie creates a new Clientset for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *Clientset { - var cs Clientset - cs.Clientset = apiextclientset.NewForConfigOrDie(c) - - // Wrap extensionsV1 with our own implementation - cs.apiextensionsV1 = apiextensionsv1.New(slim_apiextensionsv1.NewForConfigOrDie(c).RESTClient()) - - return &cs -} - -// New creates a new Clientset for the given RESTClient. -func New(c rest.Interface) *Clientset { - var cs Clientset - cs.Clientset = apiextclientset.New(c) - - // Wrap extensionsV1 with our own implementation - cs.apiextensionsV1 = apiextensionsv1.New(slim_apiextensionsv1.New(c).RESTClient()) - - return &cs -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/defaults.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/defaults.go deleted file mode 100644 index 594542ad3..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/defaults.go +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2019 The Kubernetes Authors. - -package v1 - -import ( - "k8s.io/apimachinery/pkg/runtime" -) - -func addDefaultingFuncs(scheme *runtime.Scheme) error { - return RegisterDefaults(scheme) -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/doc.go deleted file mode 100644 index 5a249a342..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/doc.go +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2019 The Kubernetes Authors. - -// +k8s:deepcopy-gen=package -// +k8s:protobuf-gen=package -// +k8s:conversion-gen=false -// +k8s:defaulter-gen=TypeMeta -// +k8s:openapi-gen=true -// +groupName=apiextensions.k8s.io - -// Package v1 is the v1 version of the API. -package v1 diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/generated.pb.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/generated.pb.go deleted file mode 100644 index 231c0608c..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/generated.pb.go +++ /dev/null @@ -1,5348 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/generated.proto - -package v1 - -import ( - encoding_binary "encoding/binary" - fmt "fmt" - - io "io" - - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" - - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" -) - -// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -func (m *CustomResourceDefinition) Reset() { *m = CustomResourceDefinition{} } -func (*CustomResourceDefinition) ProtoMessage() {} -func (*CustomResourceDefinition) Descriptor() ([]byte, []int) { - return fileDescriptor_2ae25e910fba1c55, []int{0} -} -func (m *CustomResourceDefinition) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CustomResourceDefinition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *CustomResourceDefinition) XXX_Merge(src proto.Message) { - xxx_messageInfo_CustomResourceDefinition.Merge(m, src) -} -func (m *CustomResourceDefinition) XXX_Size() int { - return m.Size() -} -func (m *CustomResourceDefinition) XXX_DiscardUnknown() { - xxx_messageInfo_CustomResourceDefinition.DiscardUnknown(m) -} - -var xxx_messageInfo_CustomResourceDefinition proto.InternalMessageInfo - -func (m *CustomResourceDefinitionList) Reset() { *m = CustomResourceDefinitionList{} } -func (*CustomResourceDefinitionList) ProtoMessage() {} -func (*CustomResourceDefinitionList) Descriptor() ([]byte, []int) { - return fileDescriptor_2ae25e910fba1c55, []int{1} -} -func (m *CustomResourceDefinitionList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CustomResourceDefinitionList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *CustomResourceDefinitionList) XXX_Merge(src proto.Message) { - xxx_messageInfo_CustomResourceDefinitionList.Merge(m, src) -} -func (m *CustomResourceDefinitionList) XXX_Size() int { - return m.Size() -} -func (m *CustomResourceDefinitionList) XXX_DiscardUnknown() { - xxx_messageInfo_CustomResourceDefinitionList.DiscardUnknown(m) -} - -var xxx_messageInfo_CustomResourceDefinitionList proto.InternalMessageInfo - -func (m *CustomResourceSubresourceScale) Reset() { *m = CustomResourceSubresourceScale{} } -func (*CustomResourceSubresourceScale) ProtoMessage() {} -func (*CustomResourceSubresourceScale) Descriptor() ([]byte, []int) { - return fileDescriptor_2ae25e910fba1c55, []int{2} -} -func (m *CustomResourceSubresourceScale) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CustomResourceSubresourceScale) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *CustomResourceSubresourceScale) XXX_Merge(src proto.Message) { - xxx_messageInfo_CustomResourceSubresourceScale.Merge(m, src) -} -func (m *CustomResourceSubresourceScale) XXX_Size() int { - return m.Size() -} -func (m *CustomResourceSubresourceScale) XXX_DiscardUnknown() { - xxx_messageInfo_CustomResourceSubresourceScale.DiscardUnknown(m) -} - -var xxx_messageInfo_CustomResourceSubresourceScale proto.InternalMessageInfo - -func (m *CustomResourceSubresourceStatus) Reset() { *m = CustomResourceSubresourceStatus{} } -func (*CustomResourceSubresourceStatus) ProtoMessage() {} -func (*CustomResourceSubresourceStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_2ae25e910fba1c55, []int{3} -} -func (m *CustomResourceSubresourceStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CustomResourceSubresourceStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *CustomResourceSubresourceStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_CustomResourceSubresourceStatus.Merge(m, src) -} -func (m *CustomResourceSubresourceStatus) XXX_Size() int { - return m.Size() -} -func (m *CustomResourceSubresourceStatus) XXX_DiscardUnknown() { - xxx_messageInfo_CustomResourceSubresourceStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_CustomResourceSubresourceStatus proto.InternalMessageInfo - -func (m *CustomResourceSubresources) Reset() { *m = CustomResourceSubresources{} } -func (*CustomResourceSubresources) ProtoMessage() {} -func (*CustomResourceSubresources) Descriptor() ([]byte, []int) { - return fileDescriptor_2ae25e910fba1c55, []int{4} -} -func (m *CustomResourceSubresources) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CustomResourceSubresources) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *CustomResourceSubresources) XXX_Merge(src proto.Message) { - xxx_messageInfo_CustomResourceSubresources.Merge(m, src) -} -func (m *CustomResourceSubresources) XXX_Size() int { - return m.Size() -} -func (m *CustomResourceSubresources) XXX_DiscardUnknown() { - xxx_messageInfo_CustomResourceSubresources.DiscardUnknown(m) -} - -var xxx_messageInfo_CustomResourceSubresources proto.InternalMessageInfo - -func (m *CustomResourceValidation) Reset() { *m = CustomResourceValidation{} } -func (*CustomResourceValidation) ProtoMessage() {} -func (*CustomResourceValidation) Descriptor() ([]byte, []int) { - return fileDescriptor_2ae25e910fba1c55, []int{5} -} -func (m *CustomResourceValidation) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CustomResourceValidation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *CustomResourceValidation) XXX_Merge(src proto.Message) { - xxx_messageInfo_CustomResourceValidation.Merge(m, src) -} -func (m *CustomResourceValidation) XXX_Size() int { - return m.Size() -} -func (m *CustomResourceValidation) XXX_DiscardUnknown() { - xxx_messageInfo_CustomResourceValidation.DiscardUnknown(m) -} - -var xxx_messageInfo_CustomResourceValidation proto.InternalMessageInfo - -func (m *ExternalDocumentation) Reset() { *m = ExternalDocumentation{} } -func (*ExternalDocumentation) ProtoMessage() {} -func (*ExternalDocumentation) Descriptor() ([]byte, []int) { - return fileDescriptor_2ae25e910fba1c55, []int{6} -} -func (m *ExternalDocumentation) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ExternalDocumentation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ExternalDocumentation) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExternalDocumentation.Merge(m, src) -} -func (m *ExternalDocumentation) XXX_Size() int { - return m.Size() -} -func (m *ExternalDocumentation) XXX_DiscardUnknown() { - xxx_messageInfo_ExternalDocumentation.DiscardUnknown(m) -} - -var xxx_messageInfo_ExternalDocumentation proto.InternalMessageInfo - -func (m *JSON) Reset() { *m = JSON{} } -func (*JSON) ProtoMessage() {} -func (*JSON) Descriptor() ([]byte, []int) { - return fileDescriptor_2ae25e910fba1c55, []int{7} -} -func (m *JSON) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *JSON) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *JSON) XXX_Merge(src proto.Message) { - xxx_messageInfo_JSON.Merge(m, src) -} -func (m *JSON) XXX_Size() int { - return m.Size() -} -func (m *JSON) XXX_DiscardUnknown() { - xxx_messageInfo_JSON.DiscardUnknown(m) -} - -var xxx_messageInfo_JSON proto.InternalMessageInfo - -func (m *JSONSchemaProps) Reset() { *m = JSONSchemaProps{} } -func (*JSONSchemaProps) ProtoMessage() {} -func (*JSONSchemaProps) Descriptor() ([]byte, []int) { - return fileDescriptor_2ae25e910fba1c55, []int{8} -} -func (m *JSONSchemaProps) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *JSONSchemaProps) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *JSONSchemaProps) XXX_Merge(src proto.Message) { - xxx_messageInfo_JSONSchemaProps.Merge(m, src) -} -func (m *JSONSchemaProps) XXX_Size() int { - return m.Size() -} -func (m *JSONSchemaProps) XXX_DiscardUnknown() { - xxx_messageInfo_JSONSchemaProps.DiscardUnknown(m) -} - -var xxx_messageInfo_JSONSchemaProps proto.InternalMessageInfo - -func (m *JSONSchemaPropsOrArray) Reset() { *m = JSONSchemaPropsOrArray{} } -func (*JSONSchemaPropsOrArray) ProtoMessage() {} -func (*JSONSchemaPropsOrArray) Descriptor() ([]byte, []int) { - return fileDescriptor_2ae25e910fba1c55, []int{9} -} -func (m *JSONSchemaPropsOrArray) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *JSONSchemaPropsOrArray) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *JSONSchemaPropsOrArray) XXX_Merge(src proto.Message) { - xxx_messageInfo_JSONSchemaPropsOrArray.Merge(m, src) -} -func (m *JSONSchemaPropsOrArray) XXX_Size() int { - return m.Size() -} -func (m *JSONSchemaPropsOrArray) XXX_DiscardUnknown() { - xxx_messageInfo_JSONSchemaPropsOrArray.DiscardUnknown(m) -} - -var xxx_messageInfo_JSONSchemaPropsOrArray proto.InternalMessageInfo - -func (m *JSONSchemaPropsOrBool) Reset() { *m = JSONSchemaPropsOrBool{} } -func (*JSONSchemaPropsOrBool) ProtoMessage() {} -func (*JSONSchemaPropsOrBool) Descriptor() ([]byte, []int) { - return fileDescriptor_2ae25e910fba1c55, []int{10} -} -func (m *JSONSchemaPropsOrBool) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *JSONSchemaPropsOrBool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *JSONSchemaPropsOrBool) XXX_Merge(src proto.Message) { - xxx_messageInfo_JSONSchemaPropsOrBool.Merge(m, src) -} -func (m *JSONSchemaPropsOrBool) XXX_Size() int { - return m.Size() -} -func (m *JSONSchemaPropsOrBool) XXX_DiscardUnknown() { - xxx_messageInfo_JSONSchemaPropsOrBool.DiscardUnknown(m) -} - -var xxx_messageInfo_JSONSchemaPropsOrBool proto.InternalMessageInfo - -func (m *JSONSchemaPropsOrStringArray) Reset() { *m = JSONSchemaPropsOrStringArray{} } -func (*JSONSchemaPropsOrStringArray) ProtoMessage() {} -func (*JSONSchemaPropsOrStringArray) Descriptor() ([]byte, []int) { - return fileDescriptor_2ae25e910fba1c55, []int{11} -} -func (m *JSONSchemaPropsOrStringArray) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *JSONSchemaPropsOrStringArray) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *JSONSchemaPropsOrStringArray) XXX_Merge(src proto.Message) { - xxx_messageInfo_JSONSchemaPropsOrStringArray.Merge(m, src) -} -func (m *JSONSchemaPropsOrStringArray) XXX_Size() int { - return m.Size() -} -func (m *JSONSchemaPropsOrStringArray) XXX_DiscardUnknown() { - xxx_messageInfo_JSONSchemaPropsOrStringArray.DiscardUnknown(m) -} - -var xxx_messageInfo_JSONSchemaPropsOrStringArray proto.InternalMessageInfo - -func (m *ValidationRule) Reset() { *m = ValidationRule{} } -func (*ValidationRule) ProtoMessage() {} -func (*ValidationRule) Descriptor() ([]byte, []int) { - return fileDescriptor_2ae25e910fba1c55, []int{12} -} -func (m *ValidationRule) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ValidationRule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ValidationRule) XXX_Merge(src proto.Message) { - xxx_messageInfo_ValidationRule.Merge(m, src) -} -func (m *ValidationRule) XXX_Size() int { - return m.Size() -} -func (m *ValidationRule) XXX_DiscardUnknown() { - xxx_messageInfo_ValidationRule.DiscardUnknown(m) -} - -var xxx_messageInfo_ValidationRule proto.InternalMessageInfo - -func init() { - proto.RegisterType((*CustomResourceDefinition)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.apiextensions.v1.CustomResourceDefinition") - proto.RegisterType((*CustomResourceDefinitionList)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.apiextensions.v1.CustomResourceDefinitionList") - proto.RegisterType((*CustomResourceSubresourceScale)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.apiextensions.v1.CustomResourceSubresourceScale") - proto.RegisterType((*CustomResourceSubresourceStatus)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.apiextensions.v1.CustomResourceSubresourceStatus") - proto.RegisterType((*CustomResourceSubresources)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.apiextensions.v1.CustomResourceSubresources") - proto.RegisterType((*CustomResourceValidation)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.apiextensions.v1.CustomResourceValidation") - proto.RegisterType((*ExternalDocumentation)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.apiextensions.v1.ExternalDocumentation") - proto.RegisterType((*JSON)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.apiextensions.v1.JSON") - proto.RegisterType((*JSONSchemaProps)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.apiextensions.v1.JSONSchemaProps") - proto.RegisterMapType((JSONSchemaDefinitions)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.apiextensions.v1.JSONSchemaProps.DefinitionsEntry") - proto.RegisterMapType((JSONSchemaDependencies)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.apiextensions.v1.JSONSchemaProps.DependenciesEntry") - proto.RegisterMapType((map[string]JSONSchemaProps)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.apiextensions.v1.JSONSchemaProps.PatternPropertiesEntry") - proto.RegisterMapType((map[string]JSONSchemaProps)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.apiextensions.v1.JSONSchemaProps.PropertiesEntry") - proto.RegisterType((*JSONSchemaPropsOrArray)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.apiextensions.v1.JSONSchemaPropsOrArray") - proto.RegisterType((*JSONSchemaPropsOrBool)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.apiextensions.v1.JSONSchemaPropsOrBool") - proto.RegisterType((*JSONSchemaPropsOrStringArray)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.apiextensions.v1.JSONSchemaPropsOrStringArray") - proto.RegisterType((*ValidationRule)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.apiextensions.v1.ValidationRule") -} - -func init() { - proto.RegisterFile("github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/generated.proto", fileDescriptor_2ae25e910fba1c55) -} - -var fileDescriptor_2ae25e910fba1c55 = []byte{ - // 1977 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x59, 0x4b, 0x73, 0x1b, 0x59, - 0x15, 0x76, 0xcb, 0x2f, 0xf9, 0xc8, 0x8e, 0xad, 0x9b, 0xd8, 0x74, 0x34, 0x19, 0x49, 0x51, 0x98, - 0xe0, 0x30, 0x41, 0xae, 0x84, 0x82, 0x49, 0xf1, 0xa8, 0x60, 0x8d, 0x15, 0xc8, 0x8c, 0x15, 0xb9, - 0xae, 0x27, 0xc1, 0x40, 0x51, 0xcc, 0x95, 0xfa, 0x4a, 0xee, 0x71, 0xbf, 0xa6, 0xfb, 0xb6, 0x23, - 0x6d, 0xa8, 0x59, 0x50, 0xc5, 0x86, 0x1a, 0x66, 0x01, 0x14, 0x1b, 0x58, 0x51, 0xac, 0x58, 0xc0, - 0x02, 0x96, 0xac, 0xb3, 0x9c, 0x2a, 0x36, 0xb3, 0x52, 0x11, 0xf1, 0x23, 0xa8, 0x4a, 0xb1, 0xa0, - 0xee, 0xa3, 0x1f, 0x7a, 0x78, 0x86, 0x10, 0x79, 0xb2, 0x89, 0x5b, 0xe7, 0x3b, 0xf7, 0x7c, 0xdf, - 0x3d, 0x7d, 0x1f, 0xa7, 0x4f, 0xa0, 0xd9, 0x35, 0xd9, 0x71, 0xd8, 0xaa, 0xb6, 0x5d, 0x7b, 0xa7, - 0x6d, 0x5a, 0x66, 0x18, 0xff, 0xf1, 0x4e, 0xba, 0x3b, 0x27, 0x77, 0x82, 0x9d, 0xc0, 0x32, 0x6d, - 0xf1, 0x40, 0x3c, 0x53, 0xfc, 0x43, 0x7b, 0x8c, 0x3a, 0x81, 0xe9, 0x3a, 0xc1, 0xce, 0xe9, 0xad, - 0x9d, 0x2e, 0x75, 0xa8, 0x4f, 0x18, 0x35, 0xaa, 0x9e, 0xef, 0x32, 0x17, 0xdd, 0x4d, 0x02, 0x56, - 0x65, 0xa4, 0xe8, 0x8f, 0x77, 0xd2, 0xad, 0x9e, 0xdc, 0x09, 0xaa, 0x3c, 0xa0, 0x78, 0xe0, 0x01, - 0xab, 0x23, 0x01, 0xab, 0xa7, 0xb7, 0x0a, 0xf7, 0x9e, 0x53, 0x91, 0x4d, 0x19, 0x99, 0x22, 0xa4, - 0xf0, 0x95, 0x54, 0x9c, 0xae, 0xdb, 0x75, 0x77, 0x84, 0xb9, 0x15, 0x76, 0xc4, 0x2f, 0xf1, 0x43, - 0x3c, 0x29, 0x77, 0x1e, 0xb0, 0x6a, 0xba, 0x3c, 0xa6, 0x4d, 0xda, 0xc7, 0xa6, 0x43, 0xfd, 0xbe, - 0x60, 0xf4, 0x43, 0x87, 0x99, 0x36, 0x9d, 0x88, 0xff, 0xf5, 0xcf, 0x1a, 0x10, 0xb4, 0x8f, 0xa9, - 0x4d, 0xc6, 0xc7, 0x55, 0x3e, 0xd4, 0x40, 0x7f, 0x33, 0x0c, 0x98, 0x6b, 0x63, 0x1a, 0xb8, 0xa1, - 0xdf, 0xa6, 0x7b, 0xb4, 0x63, 0x3a, 0x26, 0x33, 0x5d, 0x07, 0xf9, 0x90, 0xe5, 0xf3, 0x31, 0x08, - 0x23, 0xba, 0x56, 0xd6, 0xb6, 0x73, 0xb7, 0x6b, 0xd5, 0xe7, 0x4c, 0x28, 0x1f, 0x5f, 0x3d, 0xbd, - 0x55, 0x6d, 0xb6, 0xde, 0xa3, 0x6d, 0xd6, 0xa0, 0x8c, 0xd4, 0xd0, 0x93, 0x41, 0x69, 0x6e, 0x38, - 0x28, 0x41, 0x62, 0xc3, 0x31, 0x4f, 0xe5, 0xc3, 0x0c, 0x5c, 0x39, 0x4b, 0xd0, 0xbe, 0x19, 0x30, - 0xe4, 0x4c, 0x88, 0xfa, 0xce, 0xff, 0x2b, 0x8a, 0xc7, 0x13, 0x92, 0x36, 0x94, 0xa4, 0x6c, 0x64, - 0x49, 0x04, 0xa1, 0x9f, 0xc2, 0xa2, 0xc9, 0xa8, 0x1d, 0xe8, 0x99, 0xf2, 0xfc, 0x76, 0xee, 0xf6, - 0x0f, 0xaa, 0x2f, 0xb8, 0xa4, 0xaa, 0x67, 0xcd, 0xae, 0xb6, 0xa6, 0x54, 0x2c, 0xde, 0xe7, 0x7c, - 0x58, 0xd2, 0x56, 0xfe, 0xad, 0x41, 0x71, 0x74, 0xc8, 0x61, 0xd8, 0xf2, 0xa3, 0xc7, 0x36, 0xb1, - 0x28, 0xda, 0x83, 0x8d, 0xc0, 0xa3, 0x6d, 0x4c, 0x3d, 0xcb, 0x6c, 0x93, 0xe0, 0x80, 0xb0, 0x63, - 0x91, 0x9a, 0x95, 0x9a, 0xae, 0x42, 0x6e, 0x1c, 0x8e, 0xe1, 0x78, 0x62, 0x04, 0x7a, 0x0b, 0x50, - 0xc0, 0x08, 0x0b, 0x83, 0x91, 0x38, 0x19, 0x11, 0xa7, 0xa0, 0xe2, 0xa0, 0xc3, 0x09, 0x0f, 0x3c, - 0x65, 0x14, 0x7a, 0x13, 0xf2, 0x16, 0x69, 0x51, 0xeb, 0x90, 0x5a, 0xb4, 0xcd, 0x5c, 0x5f, 0x84, - 0x9a, 0x17, 0xa1, 0x36, 0x87, 0x83, 0x52, 0x7e, 0x7f, 0x1c, 0xc4, 0x93, 0xfe, 0x95, 0xab, 0x50, - 0x3a, 0x7b, 0xe2, 0x82, 0xb3, 0xf2, 0xc7, 0x0c, 0x14, 0xce, 0xf4, 0x09, 0xd0, 0xcf, 0x34, 0x58, - 0x92, 0xea, 0xd4, 0x52, 0x79, 0x77, 0xc6, 0x6f, 0x6f, 0x42, 0x51, 0x0d, 0x86, 0x83, 0xd2, 0x92, - 0xca, 0x92, 0xe2, 0x46, 0x1f, 0x68, 0xb0, 0x18, 0xf0, 0x37, 0x25, 0xb2, 0x99, 0xbb, 0xfd, 0x93, - 0x73, 0x54, 0xc1, 0x69, 0x6a, 0x2b, 0x7c, 0x15, 0x89, 0x47, 0x2c, 0x89, 0x2b, 0x7f, 0x9a, 0xd8, - 0xe7, 0x8f, 0x88, 0x65, 0x1a, 0x44, 0xec, 0xf3, 0x5f, 0x6a, 0xb0, 0xee, 0x7a, 0xd4, 0xd9, 0x3d, - 0xb8, 0xff, 0xe8, 0xab, 0x87, 0xe2, 0xa0, 0x50, 0xf9, 0x3a, 0x78, 0x61, 0xa5, 0x6f, 0x1d, 0x36, - 0x1f, 0xc8, 0x90, 0x07, 0xbe, 0xeb, 0x05, 0xb5, 0x8b, 0xc3, 0x41, 0x69, 0xbd, 0x39, 0x4a, 0x86, - 0xc7, 0xd9, 0x2b, 0x36, 0x6c, 0xd6, 0x7b, 0x8c, 0xfa, 0x0e, 0xb1, 0xf6, 0xdc, 0x76, 0x68, 0x53, - 0x87, 0x49, 0xa9, 0x5f, 0x83, 0x9c, 0x41, 0x83, 0xb6, 0x6f, 0x7a, 0xfc, 0xa7, 0x5a, 0xe5, 0x17, - 0xd5, 0xea, 0xcc, 0xed, 0x25, 0x10, 0x4e, 0xfb, 0xa1, 0x57, 0x61, 0x3e, 0xf4, 0x2d, 0xb5, 0x98, - 0x73, 0xca, 0x7d, 0xfe, 0x21, 0xde, 0xc7, 0xdc, 0x5e, 0xb9, 0x0a, 0x0b, 0x5c, 0x27, 0xba, 0x0c, - 0xf3, 0x3e, 0x79, 0x2c, 0xa2, 0xae, 0xd6, 0x96, 0xb9, 0x0b, 0x26, 0x8f, 0x31, 0xb7, 0x55, 0xfe, - 0x73, 0x15, 0xd6, 0xc7, 0xe6, 0x82, 0x0a, 0x90, 0x31, 0x0d, 0xa5, 0x01, 0x54, 0xd0, 0xcc, 0xfd, - 0x3d, 0x9c, 0x31, 0x0d, 0xf4, 0x06, 0x2c, 0xc9, 0x23, 0x57, 0x91, 0x96, 0x14, 0xbe, 0x24, 0x03, - 0x3c, 0x1b, 0x94, 0xd6, 0x92, 0x70, 0x5c, 0x88, 0x72, 0x17, 0x1a, 0x68, 0x47, 0x6d, 0x16, 0xa9, - 0x81, 0x76, 0x30, 0xb7, 0x8d, 0x4f, 0x7e, 0xe1, 0x7f, 0x9c, 0x7c, 0x19, 0x16, 0x58, 0xdf, 0xa3, - 0xfa, 0xa2, 0xf0, 0x5f, 0x55, 0xfe, 0x0b, 0xef, 0xf4, 0x3d, 0x8a, 0x05, 0x82, 0xae, 0xc3, 0x52, - 0xc7, 0xf5, 0x6d, 0xc2, 0xf4, 0x25, 0xe1, 0x73, 0x21, 0x12, 0x7b, 0x4f, 0x58, 0xb1, 0x42, 0xd1, - 0x35, 0x58, 0x64, 0x26, 0xb3, 0xa8, 0xbe, 0x2c, 0xdc, 0xe2, 0x03, 0xeb, 0x1d, 0x6e, 0xc4, 0x12, - 0x43, 0x16, 0x2c, 0x1b, 0xb4, 0x43, 0x42, 0x8b, 0xe9, 0x59, 0xb1, 0x88, 0xea, 0x33, 0x59, 0x44, - 0xb5, 0xdc, 0x70, 0x50, 0x5a, 0xde, 0x93, 0x91, 0x71, 0x44, 0x81, 0x5e, 0x83, 0x65, 0x9b, 0xf4, - 0x4c, 0x3b, 0xb4, 0xf5, 0x95, 0xb2, 0xb6, 0xad, 0x49, 0xb7, 0x86, 0x34, 0xe1, 0x08, 0xe3, 0x47, - 0x24, 0xed, 0xb5, 0xad, 0x30, 0x30, 0x4f, 0xa9, 0x02, 0x75, 0x28, 0x6b, 0xdb, 0xd9, 0xe4, 0x88, - 0xac, 0x8f, 0xe1, 0x78, 0x62, 0x84, 0x20, 0x33, 0x1d, 0x31, 0x38, 0x97, 0x22, 0x93, 0x26, 0x1c, - 0x61, 0xa3, 0x64, 0xca, 0x7f, 0xf5, 0x2c, 0x32, 0x35, 0x78, 0x62, 0x04, 0x7a, 0x1d, 0x56, 0x6c, - 0xd2, 0xdb, 0xa7, 0x4e, 0x97, 0x1d, 0xeb, 0x6b, 0x65, 0x6d, 0x7b, 0xbe, 0xb6, 0x36, 0x1c, 0x94, - 0x56, 0x1a, 0x91, 0x11, 0x27, 0xb8, 0x70, 0x36, 0x1d, 0xe5, 0x7c, 0x21, 0xe5, 0x1c, 0x19, 0x71, - 0x82, 0xa3, 0x1b, 0xb0, 0xec, 0x11, 0xc6, 0xb7, 0x97, 0xbe, 0x2e, 0x5e, 0xe4, 0xba, 0x92, 0xb5, - 0x7c, 0x20, 0xcd, 0x38, 0xc2, 0xd1, 0x36, 0x64, 0x6d, 0xd2, 0x13, 0x17, 0x92, 0xbe, 0x21, 0xc2, - 0xae, 0xf2, 0x7b, 0xb2, 0xa1, 0x6c, 0x38, 0x46, 0x85, 0xa7, 0xe9, 0x48, 0xcf, 0x7c, 0xca, 0x53, - 0xd9, 0x70, 0x8c, 0xf2, 0x65, 0x1c, 0x3a, 0xe6, 0xfb, 0x21, 0x95, 0xce, 0x48, 0x64, 0x26, 0x5e, - 0xc6, 0x0f, 0x13, 0x08, 0xa7, 0xfd, 0x50, 0x15, 0xc0, 0x0e, 0x2d, 0x66, 0x7a, 0x16, 0x6d, 0x76, - 0xf4, 0x8b, 0x22, 0xff, 0x17, 0x78, 0x1d, 0xd1, 0x88, 0xad, 0x38, 0xe5, 0x81, 0xba, 0xb0, 0x40, - 0x9d, 0xd0, 0xd6, 0x2f, 0x89, 0x7b, 0x7b, 0x46, 0x8b, 0x30, 0xde, 0x3d, 0x75, 0x27, 0xb4, 0xb1, - 0x20, 0x40, 0x6f, 0xc0, 0x9a, 0x4d, 0x7a, 0xfc, 0x48, 0xa0, 0x3e, 0x33, 0x69, 0xa0, 0x6f, 0x8a, - 0xe9, 0xe7, 0x87, 0x83, 0xd2, 0x5a, 0x23, 0x0d, 0xe0, 0x51, 0x3f, 0x31, 0xd0, 0x74, 0x52, 0x03, - 0xb7, 0x52, 0x03, 0xd3, 0x00, 0x1e, 0xf5, 0xe3, 0xb9, 0xf6, 0xe9, 0xfb, 0xa1, 0xe9, 0x53, 0x43, - 0xff, 0x42, 0x79, 0x9e, 0xef, 0x6a, 0x9e, 0x6b, 0xac, 0x6c, 0x38, 0x46, 0x51, 0x2f, 0xaa, 0x5e, - 0x74, 0xb1, 0x15, 0xbf, 0x3f, 0xeb, 0xf3, 0xbc, 0xe9, 0xef, 0xfa, 0x3e, 0xe9, 0xcb, 0x1b, 0x27, - 0x5d, 0xb7, 0xa0, 0x10, 0x16, 0x89, 0x65, 0x35, 0x3b, 0xfa, 0x65, 0x91, 0xff, 0xd9, 0xdf, 0x24, - 0xf1, 0xe9, 0xb3, 0xcb, 0x69, 0xb0, 0x64, 0xe3, 0xb4, 0xae, 0xc3, 0x17, 0x48, 0xe1, 0xbc, 0x69, - 0x9b, 0x9c, 0x06, 0x4b, 0x36, 0x31, 0x5b, 0xa7, 0xdf, 0xec, 0xe8, 0xaf, 0x9c, 0xfb, 0x6c, 0x39, - 0x0d, 0x96, 0x6c, 0xe8, 0x04, 0xe6, 0x1d, 0x97, 0xe9, 0x57, 0xce, 0xe9, 0xb2, 0x16, 0xd7, 0xcf, - 0x03, 0x97, 0x61, 0xce, 0x82, 0x7e, 0xa5, 0x01, 0x78, 0xc9, 0x62, 0x7d, 0x55, 0xcc, 0xf4, 0xdd, - 0x59, 0x93, 0x56, 0x93, 0x75, 0x5e, 0x77, 0x98, 0xdf, 0x4f, 0xbe, 0x17, 0x52, 0xfb, 0x21, 0xa5, - 0x03, 0xfd, 0x41, 0x83, 0x4b, 0xc4, 0x30, 0x44, 0x0d, 0x4d, 0xac, 0xd4, 0x6e, 0x2a, 0x8a, 0xac, - 0x3c, 0x9a, 0xfd, 0x92, 0xaf, 0xb9, 0xae, 0x55, 0xd3, 0x87, 0x83, 0xd2, 0xa5, 0xdd, 0x29, 0xbc, - 0x78, 0xaa, 0x1a, 0xf4, 0x67, 0x0d, 0xf2, 0xea, 0x54, 0x4d, 0x69, 0x2c, 0x89, 0x24, 0x76, 0x67, - 0x9f, 0xc4, 0x71, 0x26, 0x99, 0xcb, 0xcb, 0x2a, 0x97, 0xf9, 0x09, 0x1c, 0x4f, 0x8a, 0x43, 0x7f, - 0xd3, 0x60, 0xd5, 0xa0, 0x1e, 0x75, 0x0c, 0xea, 0xb4, 0xb9, 0xda, 0xb2, 0x50, 0xdb, 0x9a, 0xb9, - 0xda, 0xbd, 0x14, 0x89, 0x14, 0x5a, 0x55, 0x42, 0x57, 0xd3, 0xd0, 0xb3, 0x41, 0x69, 0x2b, 0x19, - 0x9a, 0x46, 0xf0, 0x88, 0x4e, 0xf4, 0x6b, 0x0d, 0xd6, 0x93, 0x97, 0x20, 0xaf, 0x99, 0xab, 0xe7, - 0xba, 0x1a, 0x44, 0x59, 0xbb, 0x3b, 0x4a, 0x89, 0xc7, 0x35, 0xa0, 0xbf, 0x68, 0xbc, 0x82, 0x8b, - 0x3e, 0xf8, 0x02, 0xbd, 0x22, 0xf2, 0x49, 0xce, 0x21, 0x9f, 0x31, 0x87, 0x4c, 0xe7, 0xcd, 0xa4, - 0x48, 0x8c, 0x91, 0x67, 0x83, 0xd2, 0x66, 0x3a, 0x9b, 0x31, 0x80, 0xd3, 0x1a, 0xd1, 0x2f, 0x34, - 0x58, 0xa5, 0x49, 0x2d, 0x1e, 0xe8, 0xd7, 0x66, 0x94, 0xc8, 0xa9, 0x05, 0x7e, 0x6d, 0x83, 0xbf, - 0xf4, 0x14, 0x14, 0xe0, 0x11, 0x76, 0x5e, 0x5d, 0xd2, 0x1e, 0xb1, 0x3d, 0x8b, 0xea, 0x5f, 0x9c, - 0x79, 0x75, 0x59, 0x97, 0x91, 0x71, 0x44, 0x81, 0x6e, 0x42, 0xd6, 0x09, 0x2d, 0x8b, 0xb4, 0x2c, - 0xaa, 0xbf, 0x26, 0xea, 0x94, 0xb8, 0x55, 0xf0, 0x40, 0xd9, 0x71, 0xec, 0x81, 0x3a, 0x50, 0xee, - 0xbd, 0x1d, 0xb6, 0xa8, 0xef, 0x50, 0x46, 0x83, 0x03, 0x9f, 0x06, 0xd4, 0x3f, 0xa5, 0x0f, 0x9d, - 0x13, 0xc7, 0x7d, 0xec, 0xdc, 0x33, 0xa9, 0x65, 0x04, 0xfa, 0x75, 0x11, 0xa5, 0x30, 0x1c, 0x94, - 0xb6, 0x8e, 0xa6, 0x7a, 0xe0, 0xcf, 0x8c, 0x81, 0x7e, 0x04, 0xaf, 0xa4, 0x7c, 0xea, 0x76, 0x8b, - 0x1a, 0x06, 0x35, 0xa2, 0x0f, 0x3b, 0xfd, 0x4b, 0x82, 0x22, 0xde, 0xea, 0x47, 0xe3, 0x0e, 0xf8, - 0xd3, 0x46, 0xa3, 0x7d, 0xd8, 0x4a, 0xc1, 0xf7, 0x1d, 0xd6, 0xf4, 0x0f, 0x99, 0x6f, 0x3a, 0x5d, - 0x7d, 0x5b, 0xc4, 0xbd, 0x14, 0xed, 0xcc, 0xa3, 0x14, 0x86, 0xcf, 0x18, 0x83, 0xbe, 0x37, 0x12, - 0x4d, 0xb4, 0x57, 0x88, 0xf7, 0x36, 0xed, 0x07, 0xfa, 0x0d, 0x51, 0xb7, 0x88, 0xd7, 0x7d, 0x94, - 0xb2, 0xe3, 0x33, 0xfc, 0xd1, 0x5d, 0xb8, 0x38, 0x86, 0xf0, 0x0f, 0x18, 0xfd, 0xcb, 0xf2, 0x4b, - 0x84, 0xd7, 0xba, 0x47, 0x91, 0x11, 0x4f, 0xf3, 0x44, 0xdf, 0x02, 0x94, 0x32, 0x37, 0x88, 0x27, - 0xc6, 0xbf, 0x2e, 0x3f, 0x8a, 0xf8, 0x1b, 0x3d, 0x52, 0x36, 0x3c, 0xc5, 0x0f, 0xfd, 0x4e, 0x1b, - 0x99, 0x49, 0xf2, 0xf5, 0x1c, 0xe8, 0x37, 0xc5, 0x2e, 0x6e, 0xbe, 0xf0, 0x3a, 0x4c, 0x62, 0xe2, - 0xd0, 0xa2, 0xa9, 0x44, 0xa7, 0xc8, 0xf0, 0x19, 0x22, 0x0a, 0xfc, 0x1b, 0x7e, 0xec, 0xb4, 0x47, - 0x1b, 0x30, 0x7f, 0x42, 0xfb, 0xf2, 0x03, 0x15, 0xf3, 0x47, 0xd4, 0x81, 0xc5, 0x53, 0x62, 0x85, - 0x51, 0x23, 0x62, 0xe6, 0x15, 0x03, 0x96, 0xe1, 0xbf, 0x91, 0xb9, 0xa3, 0x15, 0x7e, 0xa3, 0xc1, - 0xd6, 0xf4, 0x6b, 0xe8, 0x25, 0x0b, 0xfb, 0xbd, 0x06, 0xf9, 0x89, 0x1b, 0x67, 0x8a, 0xa6, 0x60, - 0x54, 0xd3, 0x8f, 0x67, 0x7f, 0x75, 0xc8, 0x4d, 0x22, 0x2a, 0xe8, 0xb4, 0xc0, 0x8f, 0x34, 0xd8, - 0x18, 0x3f, 0xc2, 0x5f, 0x6e, 0xce, 0x2a, 0xbf, 0xcd, 0xc0, 0xd6, 0xf4, 0xd2, 0x1f, 0xb1, 0xb8, - 0xd3, 0x71, 0x5e, 0x3d, 0x23, 0x48, 0xfa, 0x26, 0x71, 0x9b, 0xe4, 0xe7, 0x1a, 0xe4, 0xde, 0x8b, - 0xfd, 0xa2, 0xee, 0xec, 0x39, 0xf4, 0xab, 0xa2, 0x9b, 0x33, 0x01, 0x02, 0x9c, 0x66, 0xae, 0xfc, - 0x55, 0x83, 0xcd, 0xa9, 0x45, 0x01, 0xba, 0x0e, 0x4b, 0xc4, 0xb2, 0xdc, 0xc7, 0xb2, 0xfb, 0x98, - 0x4d, 0xda, 0x2a, 0xbb, 0xc2, 0x8a, 0x15, 0x9a, 0xca, 0x60, 0xe6, 0xf3, 0xcb, 0x60, 0xe5, 0xef, - 0x1a, 0x5c, 0xf9, 0xb4, 0x15, 0xf9, 0x92, 0x5e, 0xec, 0x36, 0x64, 0x55, 0x71, 0xdf, 0x17, 0x2f, - 0x55, 0x1d, 0xce, 0xea, 0x08, 0xe9, 0xe3, 0x18, 0xad, 0xfc, 0x23, 0x03, 0x17, 0x46, 0xcf, 0x4c, - 0x54, 0x86, 0x05, 0x3f, 0xb4, 0xa8, 0xea, 0xc9, 0xc5, 0x1f, 0xeb, 0x1c, 0xc3, 0x02, 0x41, 0x37, - 0x60, 0xd9, 0xa6, 0x41, 0x40, 0xba, 0x54, 0x35, 0xe6, 0xe2, 0xde, 0x47, 0x43, 0x9a, 0x71, 0x84, - 0xa3, 0xef, 0x42, 0x5e, 0x3d, 0xd6, 0x7b, 0x9e, 0x4f, 0x03, 0x3e, 0x0d, 0xd5, 0x97, 0x8b, 0x2f, - 0xd7, 0xc6, 0xb8, 0x03, 0x9e, 0x1c, 0x83, 0xbe, 0x09, 0x4b, 0x3e, 0x25, 0x41, 0xdc, 0xb2, 0xbb, - 0xc6, 0xa7, 0x8d, 0x85, 0x85, 0x17, 0x61, 0xe2, 0x56, 0x7f, 0xc4, 0xb7, 0x5a, 0xdd, 0xf7, 0x5d, - 0x5f, 0x02, 0x58, 0x0d, 0x41, 0x3b, 0xb0, 0xd2, 0xe1, 0x0e, 0xa2, 0x85, 0x2e, 0x5b, 0x78, 0x79, - 0xc5, 0xbe, 0x72, 0x2f, 0x02, 0x70, 0xe2, 0x83, 0xbe, 0x0d, 0xeb, 0xae, 0x27, 0xab, 0xce, 0xa6, - 0x65, 0x1c, 0x52, 0xab, 0x23, 0xba, 0x7a, 0xd9, 0xa8, 0xf5, 0x3a, 0x02, 0xe1, 0x71, 0xdf, 0x1a, - 0x7d, 0xf2, 0xb4, 0x38, 0xf7, 0xf1, 0xd3, 0xe2, 0xdc, 0x27, 0x4f, 0x8b, 0x73, 0x1f, 0x0c, 0x8b, - 0xda, 0x93, 0x61, 0x51, 0xfb, 0x78, 0x58, 0xd4, 0x3e, 0x19, 0x16, 0xb5, 0x7f, 0x0e, 0x8b, 0xda, - 0x47, 0xff, 0x2a, 0xce, 0xfd, 0xf0, 0xee, 0x0b, 0xfe, 0x4f, 0xdd, 0x7f, 0x03, 0x00, 0x00, 0xff, - 0xff, 0x1e, 0xda, 0x9c, 0x38, 0xeb, 0x1b, 0x00, 0x00, -} - -func (m *CustomResourceDefinition) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CustomResourceDefinition) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CustomResourceDefinition) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *CustomResourceDefinitionList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CustomResourceDefinitionList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CustomResourceDefinitionList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *CustomResourceSubresourceScale) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CustomResourceSubresourceScale) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CustomResourceSubresourceScale) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.LabelSelectorPath != nil { - i -= len(*m.LabelSelectorPath) - copy(dAtA[i:], *m.LabelSelectorPath) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.LabelSelectorPath))) - i-- - dAtA[i] = 0x1a - } - i -= len(m.StatusReplicasPath) - copy(dAtA[i:], m.StatusReplicasPath) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.StatusReplicasPath))) - i-- - dAtA[i] = 0x12 - i -= len(m.SpecReplicasPath) - copy(dAtA[i:], m.SpecReplicasPath) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.SpecReplicasPath))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *CustomResourceSubresourceStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CustomResourceSubresourceStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CustomResourceSubresourceStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *CustomResourceSubresources) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CustomResourceSubresources) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CustomResourceSubresources) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Scale != nil { - { - size, err := m.Scale.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Status != nil { - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CustomResourceValidation) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CustomResourceValidation) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CustomResourceValidation) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.OpenAPIV3Schema != nil { - { - size, err := m.OpenAPIV3Schema.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ExternalDocumentation) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ExternalDocumentation) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ExternalDocumentation) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.URL) - copy(dAtA[i:], m.URL) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.URL))) - i-- - dAtA[i] = 0x12 - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *JSON) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *JSON) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *JSON) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Raw != nil { - i -= len(m.Raw) - copy(dAtA[i:], m.Raw) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Raw))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *JSONSchemaProps) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *JSONSchemaProps) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *JSONSchemaProps) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.XValidations) > 0 { - for iNdEx := len(m.XValidations) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.XValidations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2 - i-- - dAtA[i] = 0xe2 - } - } - if m.XMapType != nil { - i -= len(*m.XMapType) - copy(dAtA[i:], *m.XMapType) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.XMapType))) - i-- - dAtA[i] = 0x2 - i-- - dAtA[i] = 0xda - } - if m.XListType != nil { - i -= len(*m.XListType) - copy(dAtA[i:], *m.XListType) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.XListType))) - i-- - dAtA[i] = 0x2 - i-- - dAtA[i] = 0xd2 - } - if len(m.XListMapKeys) > 0 { - for iNdEx := len(m.XListMapKeys) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.XListMapKeys[iNdEx]) - copy(dAtA[i:], m.XListMapKeys[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.XListMapKeys[iNdEx]))) - i-- - dAtA[i] = 0x2 - i-- - dAtA[i] = 0xca - } - } - i-- - if m.XIntOrString { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x2 - i-- - dAtA[i] = 0xc0 - i-- - if m.XEmbeddedResource { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x2 - i-- - dAtA[i] = 0xb8 - if m.XPreserveUnknownFields != nil { - i-- - if *m.XPreserveUnknownFields { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x2 - i-- - dAtA[i] = 0xb0 - } - i-- - if m.Nullable { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x2 - i-- - dAtA[i] = 0xa8 - if m.Example != nil { - { - size, err := m.Example.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2 - i-- - dAtA[i] = 0xa2 - } - if m.ExternalDocs != nil { - { - size, err := m.ExternalDocs.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2 - i-- - dAtA[i] = 0x9a - } - if len(m.Definitions) > 0 { - keysForDefinitions := make([]string, 0, len(m.Definitions)) - for k := range m.Definitions { - keysForDefinitions = append(keysForDefinitions, string(k)) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForDefinitions) - for iNdEx := len(keysForDefinitions) - 1; iNdEx >= 0; iNdEx-- { - v := m.Definitions[string(keysForDefinitions[iNdEx])] - baseI := i - { - size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - i -= len(keysForDefinitions[iNdEx]) - copy(dAtA[i:], keysForDefinitions[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(keysForDefinitions[iNdEx]))) - i-- - dAtA[i] = 0xa - i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x2 - i-- - dAtA[i] = 0x92 - } - } - if m.AdditionalItems != nil { - { - size, err := m.AdditionalItems.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2 - i-- - dAtA[i] = 0x8a - } - if len(m.Dependencies) > 0 { - keysForDependencies := make([]string, 0, len(m.Dependencies)) - for k := range m.Dependencies { - keysForDependencies = append(keysForDependencies, string(k)) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForDependencies) - for iNdEx := len(keysForDependencies) - 1; iNdEx >= 0; iNdEx-- { - v := m.Dependencies[string(keysForDependencies[iNdEx])] - baseI := i - { - size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - i -= len(keysForDependencies[iNdEx]) - copy(dAtA[i:], keysForDependencies[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(keysForDependencies[iNdEx]))) - i-- - dAtA[i] = 0xa - i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x2 - i-- - dAtA[i] = 0x82 - } - } - if len(m.PatternProperties) > 0 { - keysForPatternProperties := make([]string, 0, len(m.PatternProperties)) - for k := range m.PatternProperties { - keysForPatternProperties = append(keysForPatternProperties, string(k)) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForPatternProperties) - for iNdEx := len(keysForPatternProperties) - 1; iNdEx >= 0; iNdEx-- { - v := m.PatternProperties[string(keysForPatternProperties[iNdEx])] - baseI := i - { - size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - i -= len(keysForPatternProperties[iNdEx]) - copy(dAtA[i:], keysForPatternProperties[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(keysForPatternProperties[iNdEx]))) - i-- - dAtA[i] = 0xa - i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xfa - } - } - if m.AdditionalProperties != nil { - { - size, err := m.AdditionalProperties.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xf2 - } - if len(m.Properties) > 0 { - keysForProperties := make([]string, 0, len(m.Properties)) - for k := range m.Properties { - keysForProperties = append(keysForProperties, string(k)) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForProperties) - for iNdEx := len(keysForProperties) - 1; iNdEx >= 0; iNdEx-- { - v := m.Properties[string(keysForProperties[iNdEx])] - baseI := i - { - size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - i -= len(keysForProperties[iNdEx]) - copy(dAtA[i:], keysForProperties[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(keysForProperties[iNdEx]))) - i-- - dAtA[i] = 0xa - i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xea - } - } - if m.Not != nil { - { - size, err := m.Not.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xe2 - } - if len(m.AnyOf) > 0 { - for iNdEx := len(m.AnyOf) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.AnyOf[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xda - } - } - if len(m.OneOf) > 0 { - for iNdEx := len(m.OneOf) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.OneOf[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xd2 - } - } - if len(m.AllOf) > 0 { - for iNdEx := len(m.AllOf) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.AllOf[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xca - } - } - if m.Items != nil { - { - size, err := m.Items.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xc2 - } - if len(m.Required) > 0 { - for iNdEx := len(m.Required) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Required[iNdEx]) - copy(dAtA[i:], m.Required[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Required[iNdEx]))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xba - } - } - if m.MinProperties != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MinProperties)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xb0 - } - if m.MaxProperties != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MaxProperties)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xa8 - } - if len(m.Enum) > 0 { - for iNdEx := len(m.Enum) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Enum[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xa2 - } - } - if m.MultipleOf != nil { - i -= 8 - encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(*m.MultipleOf)))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x99 - } - i-- - if m.UniqueItems { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x90 - if m.MinItems != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MinItems)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x88 - } - if m.MaxItems != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MaxItems)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x80 - } - i -= len(m.Pattern) - copy(dAtA[i:], m.Pattern) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Pattern))) - i-- - dAtA[i] = 0x7a - if m.MinLength != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MinLength)) - i-- - dAtA[i] = 0x70 - } - if m.MaxLength != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MaxLength)) - i-- - dAtA[i] = 0x68 - } - i-- - if m.ExclusiveMinimum { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x60 - if m.Minimum != nil { - i -= 8 - encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(*m.Minimum)))) - i-- - dAtA[i] = 0x59 - } - i-- - if m.ExclusiveMaximum { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x50 - if m.Maximum != nil { - i -= 8 - encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(*m.Maximum)))) - i-- - dAtA[i] = 0x49 - } - if m.Default != nil { - { - size, err := m.Default.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x42 - } - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0x3a - i -= len(m.Format) - copy(dAtA[i:], m.Format) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Format))) - i-- - dAtA[i] = 0x32 - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0x2a - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x22 - if m.Ref != nil { - i -= len(*m.Ref) - copy(dAtA[i:], *m.Ref) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Ref))) - i-- - dAtA[i] = 0x1a - } - i -= len(m.Schema) - copy(dAtA[i:], m.Schema) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Schema))) - i-- - dAtA[i] = 0x12 - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ID))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *JSONSchemaPropsOrArray) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *JSONSchemaPropsOrArray) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *JSONSchemaPropsOrArray) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.JSONSchemas) > 0 { - for iNdEx := len(m.JSONSchemas) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.JSONSchemas[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Schema != nil { - { - size, err := m.Schema.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *JSONSchemaPropsOrBool) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *JSONSchemaPropsOrBool) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *JSONSchemaPropsOrBool) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Schema != nil { - { - size, err := m.Schema.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - i-- - if m.Allows { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - return len(dAtA) - i, nil -} - -func (m *JSONSchemaPropsOrStringArray) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *JSONSchemaPropsOrStringArray) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *JSONSchemaPropsOrStringArray) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Property) > 0 { - for iNdEx := len(m.Property) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Property[iNdEx]) - copy(dAtA[i:], m.Property[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Property[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if m.Schema != nil { - { - size, err := m.Schema.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ValidationRule) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ValidationRule) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ValidationRule) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.OptionalOldSelf != nil { - i-- - if *m.OptionalOldSelf { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x30 - } - i -= len(m.FieldPath) - copy(dAtA[i:], m.FieldPath) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.FieldPath))) - i-- - dAtA[i] = 0x2a - if m.Reason != nil { - i -= len(*m.Reason) - copy(dAtA[i:], *m.Reason) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Reason))) - i-- - dAtA[i] = 0x22 - } - i -= len(m.MessageExpression) - copy(dAtA[i:], m.MessageExpression) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.MessageExpression))) - i-- - dAtA[i] = 0x1a - i -= len(m.Message) - copy(dAtA[i:], m.Message) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Message))) - i-- - dAtA[i] = 0x12 - i -= len(m.Rule) - copy(dAtA[i:], m.Rule) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Rule))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *CustomResourceDefinition) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *CustomResourceDefinitionList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *CustomResourceSubresourceScale) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.SpecReplicasPath) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.StatusReplicasPath) - n += 1 + l + sovGenerated(uint64(l)) - if m.LabelSelectorPath != nil { - l = len(*m.LabelSelectorPath) - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *CustomResourceSubresourceStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *CustomResourceSubresources) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Status != nil { - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Scale != nil { - l = m.Scale.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *CustomResourceValidation) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.OpenAPIV3Schema != nil { - l = m.OpenAPIV3Schema.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *ExternalDocumentation) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Description) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.URL) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *JSON) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Raw != nil { - l = len(m.Raw) - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *JSONSchemaProps) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ID) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Schema) - n += 1 + l + sovGenerated(uint64(l)) - if m.Ref != nil { - l = len(*m.Ref) - n += 1 + l + sovGenerated(uint64(l)) - } - l = len(m.Description) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Type) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Format) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Title) - n += 1 + l + sovGenerated(uint64(l)) - if m.Default != nil { - l = m.Default.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Maximum != nil { - n += 9 - } - n += 2 - if m.Minimum != nil { - n += 9 - } - n += 2 - if m.MaxLength != nil { - n += 1 + sovGenerated(uint64(*m.MaxLength)) - } - if m.MinLength != nil { - n += 1 + sovGenerated(uint64(*m.MinLength)) - } - l = len(m.Pattern) - n += 1 + l + sovGenerated(uint64(l)) - if m.MaxItems != nil { - n += 2 + sovGenerated(uint64(*m.MaxItems)) - } - if m.MinItems != nil { - n += 2 + sovGenerated(uint64(*m.MinItems)) - } - n += 3 - if m.MultipleOf != nil { - n += 10 - } - if len(m.Enum) > 0 { - for _, e := range m.Enum { - l = e.Size() - n += 2 + l + sovGenerated(uint64(l)) - } - } - if m.MaxProperties != nil { - n += 2 + sovGenerated(uint64(*m.MaxProperties)) - } - if m.MinProperties != nil { - n += 2 + sovGenerated(uint64(*m.MinProperties)) - } - if len(m.Required) > 0 { - for _, s := range m.Required { - l = len(s) - n += 2 + l + sovGenerated(uint64(l)) - } - } - if m.Items != nil { - l = m.Items.Size() - n += 2 + l + sovGenerated(uint64(l)) - } - if len(m.AllOf) > 0 { - for _, e := range m.AllOf { - l = e.Size() - n += 2 + l + sovGenerated(uint64(l)) - } - } - if len(m.OneOf) > 0 { - for _, e := range m.OneOf { - l = e.Size() - n += 2 + l + sovGenerated(uint64(l)) - } - } - if len(m.AnyOf) > 0 { - for _, e := range m.AnyOf { - l = e.Size() - n += 2 + l + sovGenerated(uint64(l)) - } - } - if m.Not != nil { - l = m.Not.Size() - n += 2 + l + sovGenerated(uint64(l)) - } - if len(m.Properties) > 0 { - for k, v := range m.Properties { - _ = k - _ = v - l = v.Size() - mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) - n += mapEntrySize + 2 + sovGenerated(uint64(mapEntrySize)) - } - } - if m.AdditionalProperties != nil { - l = m.AdditionalProperties.Size() - n += 2 + l + sovGenerated(uint64(l)) - } - if len(m.PatternProperties) > 0 { - for k, v := range m.PatternProperties { - _ = k - _ = v - l = v.Size() - mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) - n += mapEntrySize + 2 + sovGenerated(uint64(mapEntrySize)) - } - } - if len(m.Dependencies) > 0 { - for k, v := range m.Dependencies { - _ = k - _ = v - l = v.Size() - mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) - n += mapEntrySize + 2 + sovGenerated(uint64(mapEntrySize)) - } - } - if m.AdditionalItems != nil { - l = m.AdditionalItems.Size() - n += 2 + l + sovGenerated(uint64(l)) - } - if len(m.Definitions) > 0 { - for k, v := range m.Definitions { - _ = k - _ = v - l = v.Size() - mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) - n += mapEntrySize + 2 + sovGenerated(uint64(mapEntrySize)) - } - } - if m.ExternalDocs != nil { - l = m.ExternalDocs.Size() - n += 2 + l + sovGenerated(uint64(l)) - } - if m.Example != nil { - l = m.Example.Size() - n += 2 + l + sovGenerated(uint64(l)) - } - n += 3 - if m.XPreserveUnknownFields != nil { - n += 3 - } - n += 3 - n += 3 - if len(m.XListMapKeys) > 0 { - for _, s := range m.XListMapKeys { - l = len(s) - n += 2 + l + sovGenerated(uint64(l)) - } - } - if m.XListType != nil { - l = len(*m.XListType) - n += 2 + l + sovGenerated(uint64(l)) - } - if m.XMapType != nil { - l = len(*m.XMapType) - n += 2 + l + sovGenerated(uint64(l)) - } - if len(m.XValidations) > 0 { - for _, e := range m.XValidations { - l = e.Size() - n += 2 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *JSONSchemaPropsOrArray) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Schema != nil { - l = m.Schema.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if len(m.JSONSchemas) > 0 { - for _, e := range m.JSONSchemas { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *JSONSchemaPropsOrBool) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 2 - if m.Schema != nil { - l = m.Schema.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *JSONSchemaPropsOrStringArray) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Schema != nil { - l = m.Schema.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if len(m.Property) > 0 { - for _, s := range m.Property { - l = len(s) - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *ValidationRule) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Rule) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Message) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.MessageExpression) - n += 1 + l + sovGenerated(uint64(l)) - if m.Reason != nil { - l = len(*m.Reason) - n += 1 + l + sovGenerated(uint64(l)) - } - l = len(m.FieldPath) - n += 1 + l + sovGenerated(uint64(l)) - if m.OptionalOldSelf != nil { - n += 2 - } - return n -} - -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *CustomResourceDefinition) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&CustomResourceDefinition{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *CustomResourceDefinitionList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]CustomResourceDefinition{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "CustomResourceDefinition", "CustomResourceDefinition", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&CustomResourceDefinitionList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *CustomResourceSubresourceScale) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&CustomResourceSubresourceScale{`, - `SpecReplicasPath:` + fmt.Sprintf("%v", this.SpecReplicasPath) + `,`, - `StatusReplicasPath:` + fmt.Sprintf("%v", this.StatusReplicasPath) + `,`, - `LabelSelectorPath:` + valueToStringGenerated(this.LabelSelectorPath) + `,`, - `}`, - }, "") - return s -} -func (this *CustomResourceSubresourceStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&CustomResourceSubresourceStatus{`, - `}`, - }, "") - return s -} -func (this *CustomResourceSubresources) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&CustomResourceSubresources{`, - `Status:` + strings.Replace(this.Status.String(), "CustomResourceSubresourceStatus", "CustomResourceSubresourceStatus", 1) + `,`, - `Scale:` + strings.Replace(this.Scale.String(), "CustomResourceSubresourceScale", "CustomResourceSubresourceScale", 1) + `,`, - `}`, - }, "") - return s -} -func (this *CustomResourceValidation) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&CustomResourceValidation{`, - `OpenAPIV3Schema:` + strings.Replace(this.OpenAPIV3Schema.String(), "JSONSchemaProps", "JSONSchemaProps", 1) + `,`, - `}`, - }, "") - return s -} -func (this *ExternalDocumentation) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ExternalDocumentation{`, - `Description:` + fmt.Sprintf("%v", this.Description) + `,`, - `URL:` + fmt.Sprintf("%v", this.URL) + `,`, - `}`, - }, "") - return s -} -func (this *JSON) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&JSON{`, - `Raw:` + valueToStringGenerated(this.Raw) + `,`, - `}`, - }, "") - return s -} -func (this *JSONSchemaProps) String() string { - if this == nil { - return "nil" - } - repeatedStringForEnum := "[]JSON{" - for _, f := range this.Enum { - repeatedStringForEnum += strings.Replace(strings.Replace(f.String(), "JSON", "JSON", 1), `&`, ``, 1) + "," - } - repeatedStringForEnum += "}" - repeatedStringForAllOf := "[]JSONSchemaProps{" - for _, f := range this.AllOf { - repeatedStringForAllOf += strings.Replace(strings.Replace(f.String(), "JSONSchemaProps", "JSONSchemaProps", 1), `&`, ``, 1) + "," - } - repeatedStringForAllOf += "}" - repeatedStringForOneOf := "[]JSONSchemaProps{" - for _, f := range this.OneOf { - repeatedStringForOneOf += strings.Replace(strings.Replace(f.String(), "JSONSchemaProps", "JSONSchemaProps", 1), `&`, ``, 1) + "," - } - repeatedStringForOneOf += "}" - repeatedStringForAnyOf := "[]JSONSchemaProps{" - for _, f := range this.AnyOf { - repeatedStringForAnyOf += strings.Replace(strings.Replace(f.String(), "JSONSchemaProps", "JSONSchemaProps", 1), `&`, ``, 1) + "," - } - repeatedStringForAnyOf += "}" - repeatedStringForXValidations := "[]ValidationRule{" - for _, f := range this.XValidations { - repeatedStringForXValidations += strings.Replace(strings.Replace(f.String(), "ValidationRule", "ValidationRule", 1), `&`, ``, 1) + "," - } - repeatedStringForXValidations += "}" - keysForProperties := make([]string, 0, len(this.Properties)) - for k := range this.Properties { - keysForProperties = append(keysForProperties, k) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForProperties) - mapStringForProperties := "map[string]JSONSchemaProps{" - for _, k := range keysForProperties { - mapStringForProperties += fmt.Sprintf("%v: %v,", k, this.Properties[k]) - } - mapStringForProperties += "}" - keysForPatternProperties := make([]string, 0, len(this.PatternProperties)) - for k := range this.PatternProperties { - keysForPatternProperties = append(keysForPatternProperties, k) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForPatternProperties) - mapStringForPatternProperties := "map[string]JSONSchemaProps{" - for _, k := range keysForPatternProperties { - mapStringForPatternProperties += fmt.Sprintf("%v: %v,", k, this.PatternProperties[k]) - } - mapStringForPatternProperties += "}" - keysForDependencies := make([]string, 0, len(this.Dependencies)) - for k := range this.Dependencies { - keysForDependencies = append(keysForDependencies, k) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForDependencies) - mapStringForDependencies := "JSONSchemaDependencies{" - for _, k := range keysForDependencies { - mapStringForDependencies += fmt.Sprintf("%v: %v,", k, this.Dependencies[k]) - } - mapStringForDependencies += "}" - keysForDefinitions := make([]string, 0, len(this.Definitions)) - for k := range this.Definitions { - keysForDefinitions = append(keysForDefinitions, k) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForDefinitions) - mapStringForDefinitions := "JSONSchemaDefinitions{" - for _, k := range keysForDefinitions { - mapStringForDefinitions += fmt.Sprintf("%v: %v,", k, this.Definitions[k]) - } - mapStringForDefinitions += "}" - s := strings.Join([]string{`&JSONSchemaProps{`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, - `Schema:` + fmt.Sprintf("%v", this.Schema) + `,`, - `Ref:` + valueToStringGenerated(this.Ref) + `,`, - `Description:` + fmt.Sprintf("%v", this.Description) + `,`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `Format:` + fmt.Sprintf("%v", this.Format) + `,`, - `Title:` + fmt.Sprintf("%v", this.Title) + `,`, - `Default:` + strings.Replace(this.Default.String(), "JSON", "JSON", 1) + `,`, - `Maximum:` + valueToStringGenerated(this.Maximum) + `,`, - `ExclusiveMaximum:` + fmt.Sprintf("%v", this.ExclusiveMaximum) + `,`, - `Minimum:` + valueToStringGenerated(this.Minimum) + `,`, - `ExclusiveMinimum:` + fmt.Sprintf("%v", this.ExclusiveMinimum) + `,`, - `MaxLength:` + valueToStringGenerated(this.MaxLength) + `,`, - `MinLength:` + valueToStringGenerated(this.MinLength) + `,`, - `Pattern:` + fmt.Sprintf("%v", this.Pattern) + `,`, - `MaxItems:` + valueToStringGenerated(this.MaxItems) + `,`, - `MinItems:` + valueToStringGenerated(this.MinItems) + `,`, - `UniqueItems:` + fmt.Sprintf("%v", this.UniqueItems) + `,`, - `MultipleOf:` + valueToStringGenerated(this.MultipleOf) + `,`, - `Enum:` + repeatedStringForEnum + `,`, - `MaxProperties:` + valueToStringGenerated(this.MaxProperties) + `,`, - `MinProperties:` + valueToStringGenerated(this.MinProperties) + `,`, - `Required:` + fmt.Sprintf("%v", this.Required) + `,`, - `Items:` + strings.Replace(this.Items.String(), "JSONSchemaPropsOrArray", "JSONSchemaPropsOrArray", 1) + `,`, - `AllOf:` + repeatedStringForAllOf + `,`, - `OneOf:` + repeatedStringForOneOf + `,`, - `AnyOf:` + repeatedStringForAnyOf + `,`, - `Not:` + strings.Replace(this.Not.String(), "JSONSchemaProps", "JSONSchemaProps", 1) + `,`, - `Properties:` + mapStringForProperties + `,`, - `AdditionalProperties:` + strings.Replace(this.AdditionalProperties.String(), "JSONSchemaPropsOrBool", "JSONSchemaPropsOrBool", 1) + `,`, - `PatternProperties:` + mapStringForPatternProperties + `,`, - `Dependencies:` + mapStringForDependencies + `,`, - `AdditionalItems:` + strings.Replace(this.AdditionalItems.String(), "JSONSchemaPropsOrBool", "JSONSchemaPropsOrBool", 1) + `,`, - `Definitions:` + mapStringForDefinitions + `,`, - `ExternalDocs:` + strings.Replace(this.ExternalDocs.String(), "ExternalDocumentation", "ExternalDocumentation", 1) + `,`, - `Example:` + strings.Replace(this.Example.String(), "JSON", "JSON", 1) + `,`, - `Nullable:` + fmt.Sprintf("%v", this.Nullable) + `,`, - `XPreserveUnknownFields:` + valueToStringGenerated(this.XPreserveUnknownFields) + `,`, - `XEmbeddedResource:` + fmt.Sprintf("%v", this.XEmbeddedResource) + `,`, - `XIntOrString:` + fmt.Sprintf("%v", this.XIntOrString) + `,`, - `XListMapKeys:` + fmt.Sprintf("%v", this.XListMapKeys) + `,`, - `XListType:` + valueToStringGenerated(this.XListType) + `,`, - `XMapType:` + valueToStringGenerated(this.XMapType) + `,`, - `XValidations:` + repeatedStringForXValidations + `,`, - `}`, - }, "") - return s -} -func (this *JSONSchemaPropsOrArray) String() string { - if this == nil { - return "nil" - } - repeatedStringForJSONSchemas := "[]JSONSchemaProps{" - for _, f := range this.JSONSchemas { - repeatedStringForJSONSchemas += strings.Replace(strings.Replace(f.String(), "JSONSchemaProps", "JSONSchemaProps", 1), `&`, ``, 1) + "," - } - repeatedStringForJSONSchemas += "}" - s := strings.Join([]string{`&JSONSchemaPropsOrArray{`, - `Schema:` + strings.Replace(this.Schema.String(), "JSONSchemaProps", "JSONSchemaProps", 1) + `,`, - `JSONSchemas:` + repeatedStringForJSONSchemas + `,`, - `}`, - }, "") - return s -} -func (this *JSONSchemaPropsOrBool) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&JSONSchemaPropsOrBool{`, - `Allows:` + fmt.Sprintf("%v", this.Allows) + `,`, - `Schema:` + strings.Replace(this.Schema.String(), "JSONSchemaProps", "JSONSchemaProps", 1) + `,`, - `}`, - }, "") - return s -} -func (this *JSONSchemaPropsOrStringArray) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&JSONSchemaPropsOrStringArray{`, - `Schema:` + strings.Replace(this.Schema.String(), "JSONSchemaProps", "JSONSchemaProps", 1) + `,`, - `Property:` + fmt.Sprintf("%v", this.Property) + `,`, - `}`, - }, "") - return s -} -func (this *ValidationRule) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ValidationRule{`, - `Rule:` + fmt.Sprintf("%v", this.Rule) + `,`, - `Message:` + fmt.Sprintf("%v", this.Message) + `,`, - `MessageExpression:` + fmt.Sprintf("%v", this.MessageExpression) + `,`, - `Reason:` + valueToStringGenerated(this.Reason) + `,`, - `FieldPath:` + fmt.Sprintf("%v", this.FieldPath) + `,`, - `OptionalOldSelf:` + valueToStringGenerated(this.OptionalOldSelf) + `,`, - `}`, - }, "") - return s -} -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *CustomResourceDefinition) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CustomResourceDefinition: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CustomResourceDefinition: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CustomResourceDefinitionList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CustomResourceDefinitionList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CustomResourceDefinitionList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, CustomResourceDefinition{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CustomResourceSubresourceScale) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CustomResourceSubresourceScale: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CustomResourceSubresourceScale: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SpecReplicasPath", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SpecReplicasPath = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StatusReplicasPath", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StatusReplicasPath = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LabelSelectorPath", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.LabelSelectorPath = &s - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CustomResourceSubresourceStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CustomResourceSubresourceStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CustomResourceSubresourceStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CustomResourceSubresources) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CustomResourceSubresources: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CustomResourceSubresources: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Status == nil { - m.Status = &CustomResourceSubresourceStatus{} - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Scale", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Scale == nil { - m.Scale = &CustomResourceSubresourceScale{} - } - if err := m.Scale.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CustomResourceValidation) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CustomResourceValidation: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CustomResourceValidation: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OpenAPIV3Schema", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.OpenAPIV3Schema == nil { - m.OpenAPIV3Schema = &JSONSchemaProps{} - } - if err := m.OpenAPIV3Schema.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ExternalDocumentation) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ExternalDocumentation: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ExternalDocumentation: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field URL", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.URL = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *JSON) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: JSON: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: JSON: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Raw", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Raw = append(m.Raw[:0], dAtA[iNdEx:postIndex]...) - if m.Raw == nil { - m.Raw = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *JSONSchemaProps) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: JSONSchemaProps: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: JSONSchemaProps: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Schema = JSONSchemaURL(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ref", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Ref = &s - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Format", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Format = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Default", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Default == nil { - m.Default = &JSON{} - } - if err := m.Default.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 9: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field Maximum", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - v2 := float64(math.Float64frombits(v)) - m.Maximum = &v2 - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExclusiveMaximum", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ExclusiveMaximum = bool(v != 0) - case 11: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field Minimum", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - v2 := float64(math.Float64frombits(v)) - m.Minimum = &v2 - case 12: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExclusiveMinimum", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ExclusiveMinimum = bool(v != 0) - case 13: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxLength", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MaxLength = &v - case 14: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinLength", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MinLength = &v - case 15: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pattern", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Pattern = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 16: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxItems", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MaxItems = &v - case 17: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinItems", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MinItems = &v - case 18: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field UniqueItems", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.UniqueItems = bool(v != 0) - case 19: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field MultipleOf", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - v2 := float64(math.Float64frombits(v)) - m.MultipleOf = &v2 - case 20: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Enum", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Enum = append(m.Enum, JSON{}) - if err := m.Enum[len(m.Enum)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 21: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxProperties", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MaxProperties = &v - case 22: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinProperties", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MinProperties = &v - case 23: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Required", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Required = append(m.Required, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 24: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Items == nil { - m.Items = &JSONSchemaPropsOrArray{} - } - if err := m.Items.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 25: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AllOf", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AllOf = append(m.AllOf, JSONSchemaProps{}) - if err := m.AllOf[len(m.AllOf)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 26: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OneOf", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OneOf = append(m.OneOf, JSONSchemaProps{}) - if err := m.OneOf[len(m.OneOf)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 27: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AnyOf", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AnyOf = append(m.AnyOf, JSONSchemaProps{}) - if err := m.AnyOf[len(m.AnyOf)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 28: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Not", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Not == nil { - m.Not = &JSONSchemaProps{} - } - if err := m.Not.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 29: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Properties", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Properties == nil { - m.Properties = make(map[string]JSONSchemaProps) - } - var mapkey string - mapvalue := &JSONSchemaProps{} - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapmsglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapmsglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return ErrInvalidLengthGenerated - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return ErrInvalidLengthGenerated - } - if postmsgIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = &JSONSchemaProps{} - if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Properties[mapkey] = *mapvalue - iNdEx = postIndex - case 30: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AdditionalProperties", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AdditionalProperties == nil { - m.AdditionalProperties = &JSONSchemaPropsOrBool{} - } - if err := m.AdditionalProperties.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 31: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PatternProperties", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PatternProperties == nil { - m.PatternProperties = make(map[string]JSONSchemaProps) - } - var mapkey string - mapvalue := &JSONSchemaProps{} - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapmsglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapmsglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return ErrInvalidLengthGenerated - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return ErrInvalidLengthGenerated - } - if postmsgIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = &JSONSchemaProps{} - if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.PatternProperties[mapkey] = *mapvalue - iNdEx = postIndex - case 32: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Dependencies", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Dependencies == nil { - m.Dependencies = make(JSONSchemaDependencies) - } - var mapkey string - mapvalue := &JSONSchemaPropsOrStringArray{} - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapmsglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapmsglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return ErrInvalidLengthGenerated - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return ErrInvalidLengthGenerated - } - if postmsgIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = &JSONSchemaPropsOrStringArray{} - if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Dependencies[mapkey] = *mapvalue - iNdEx = postIndex - case 33: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AdditionalItems", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AdditionalItems == nil { - m.AdditionalItems = &JSONSchemaPropsOrBool{} - } - if err := m.AdditionalItems.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 34: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Definitions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Definitions == nil { - m.Definitions = make(JSONSchemaDefinitions) - } - var mapkey string - mapvalue := &JSONSchemaProps{} - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapmsglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapmsglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return ErrInvalidLengthGenerated - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return ErrInvalidLengthGenerated - } - if postmsgIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = &JSONSchemaProps{} - if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Definitions[mapkey] = *mapvalue - iNdEx = postIndex - case 35: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExternalDocs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ExternalDocs == nil { - m.ExternalDocs = &ExternalDocumentation{} - } - if err := m.ExternalDocs.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 36: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Example", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Example == nil { - m.Example = &JSON{} - } - if err := m.Example.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 37: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Nullable", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Nullable = bool(v != 0) - case 38: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field XPreserveUnknownFields", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.XPreserveUnknownFields = &b - case 39: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field XEmbeddedResource", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.XEmbeddedResource = bool(v != 0) - case 40: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field XIntOrString", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.XIntOrString = bool(v != 0) - case 41: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field XListMapKeys", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.XListMapKeys = append(m.XListMapKeys, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 42: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field XListType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.XListType = &s - iNdEx = postIndex - case 43: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field XMapType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.XMapType = &s - iNdEx = postIndex - case 44: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field XValidations", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.XValidations = append(m.XValidations, ValidationRule{}) - if err := m.XValidations[len(m.XValidations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *JSONSchemaPropsOrArray) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: JSONSchemaPropsOrArray: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: JSONSchemaPropsOrArray: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Schema == nil { - m.Schema = &JSONSchemaProps{} - } - if err := m.Schema.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field JSONSchemas", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.JSONSchemas = append(m.JSONSchemas, JSONSchemaProps{}) - if err := m.JSONSchemas[len(m.JSONSchemas)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *JSONSchemaPropsOrBool) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: JSONSchemaPropsOrBool: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: JSONSchemaPropsOrBool: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Allows", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Allows = bool(v != 0) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Schema == nil { - m.Schema = &JSONSchemaProps{} - } - if err := m.Schema.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *JSONSchemaPropsOrStringArray) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: JSONSchemaPropsOrStringArray: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: JSONSchemaPropsOrStringArray: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Schema == nil { - m.Schema = &JSONSchemaProps{} - } - if err := m.Schema.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Property", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Property = append(m.Property, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ValidationRule) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ValidationRule: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ValidationRule: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rule", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Rule = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Message = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MessageExpression", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MessageExpression = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Reason", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := FieldValueErrorReason(dAtA[iNdEx:postIndex]) - m.Reason = &s - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FieldPath", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FieldPath = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field OptionalOldSelf", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.OptionalOldSelf = &b - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenerated(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenerated - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenerated - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenerated - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") -) diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/generated.proto b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/generated.proto deleted file mode 100644 index e3bfbbcf8..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/generated.proto +++ /dev/null @@ -1,454 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - - -// This file was autogenerated by go-to-protobuf. Do not edit it manually! - -syntax = "proto2"; - -package github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.apiextensions.v1; - -import "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; - -// Package-wide variables from generator "generated". -option go_package = "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1"; - -// CustomResourceDefinition represents a resource that should be exposed on the API server. Its name MUST be in the format -// <.spec.name>.<.spec.group>. -message CustomResourceDefinition { - // Standard object's metadata - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ObjectMeta metadata = 1; -} - -// CustomResourceDefinitionList is a list of CustomResourceDefinition objects. -message CustomResourceDefinitionList { - // Standard object's metadata - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ListMeta metadata = 1; - - // items list individual CustomResourceDefinition objects - repeated CustomResourceDefinition items = 2; -} - -// CustomResourceSubresourceScale defines how to serve the scale subresource for CustomResources. -message CustomResourceSubresourceScale { - // specReplicasPath defines the JSON path inside of a custom resource that corresponds to Scale `spec.replicas`. - // Only JSON paths without the array notation are allowed. - // Must be a JSON Path under `.spec`. - // If there is no value under the given path in the custom resource, the `/scale` subresource will return an error on GET. - optional string specReplicasPath = 1; - - // statusReplicasPath defines the JSON path inside of a custom resource that corresponds to Scale `status.replicas`. - // Only JSON paths without the array notation are allowed. - // Must be a JSON Path under `.status`. - // If there is no value under the given path in the custom resource, the `status.replicas` value in the `/scale` subresource - // will default to 0. - optional string statusReplicasPath = 2; - - // labelSelectorPath defines the JSON path inside of a custom resource that corresponds to Scale `status.selector`. - // Only JSON paths without the array notation are allowed. - // Must be a JSON Path under `.status` or `.spec`. - // Must be set to work with HorizontalPodAutoscaler. - // The field pointed by this JSON path must be a string field (not a complex selector struct) - // which contains a serialized label selector in string form. - // More info: https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions#scale-subresource - // If there is no value under the given path in the custom resource, the `status.selector` value in the `/scale` - // subresource will default to the empty string. - // +optional - optional string labelSelectorPath = 3; -} - -// CustomResourceSubresourceStatus defines how to serve the status subresource for CustomResources. -// Status is represented by the `.status` JSON path inside of a CustomResource. When set, -// * exposes a /status subresource for the custom resource -// * PUT requests to the /status subresource take a custom resource object, and ignore changes to anything except the status stanza -// * PUT/POST/PATCH requests to the custom resource ignore changes to the status stanza -message CustomResourceSubresourceStatus { -} - -// CustomResourceSubresources defines the status and scale subresources for CustomResources. -message CustomResourceSubresources { - // status indicates the custom resource should serve a `/status` subresource. - // When enabled: - // 1. requests to the custom resource primary endpoint ignore changes to the `status` stanza of the object. - // 2. requests to the custom resource `/status` subresource ignore changes to anything other than the `status` stanza of the object. - // +optional - optional CustomResourceSubresourceStatus status = 1; - - // scale indicates the custom resource should serve a `/scale` subresource that returns an `autoscaling/v1` Scale object. - // +optional - optional CustomResourceSubresourceScale scale = 2; -} - -// CustomResourceValidation is a list of validation methods for CustomResources. -message CustomResourceValidation { - // openAPIV3Schema is the OpenAPI v3 schema to use for validation and pruning. - // +optional - optional JSONSchemaProps openAPIV3Schema = 1; -} - -// ExternalDocumentation allows referencing an external resource for extended documentation. -message ExternalDocumentation { - optional string description = 1; - - optional string url = 2; -} - -// JSON represents any valid JSON value. -// These types are supported: bool, int64, float64, string, []interface{}, map[string]interface{} and nil. -message JSON { - optional bytes raw = 1; -} - -// JSONSchemaProps is a JSON-Schema following Specification Draft 4 (http://json-schema.org/). -message JSONSchemaProps { - optional string id = 1; - - optional string schema = 2; - - optional string ref = 3; - - optional string description = 4; - - optional string type = 5; - - // format is an OpenAPI v3 format string. Unknown formats are ignored. The following formats are validated: - // - // - bsonobjectid: a bson object ID, i.e. a 24 characters hex string - // - uri: an URI as parsed by Golang net/url.ParseRequestURI - // - email: an email address as parsed by Golang net/mail.ParseAddress - // - hostname: a valid representation for an Internet host name, as defined by RFC 1034, section 3.1 [RFC1034]. - // - ipv4: an IPv4 IP as parsed by Golang net.ParseIP - // - ipv6: an IPv6 IP as parsed by Golang net.ParseIP - // - cidr: a CIDR as parsed by Golang net.ParseCIDR - // - mac: a MAC address as parsed by Golang net.ParseMAC - // - uuid: an UUID that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{12}$ - // - uuid3: an UUID3 that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?3[0-9a-f]{3}-?[0-9a-f]{4}-?[0-9a-f]{12}$ - // - uuid4: an UUID4 that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?4[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12}$ - // - uuid5: an UUID5 that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?5[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12}$ - // - isbn: an ISBN10 or ISBN13 number string like "0321751043" or "978-0321751041" - // - isbn10: an ISBN10 number string like "0321751043" - // - isbn13: an ISBN13 number string like "978-0321751041" - // - creditcard: a credit card number defined by the regex ^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\d{3})\\d{11})$ with any non digit characters mixed in - // - ssn: a U.S. social security number following the regex ^\\d{3}[- ]?\\d{2}[- ]?\\d{4}$ - // - hexcolor: an hexadecimal color code like "#FFFFFF: following the regex ^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$ - // - rgbcolor: an RGB color code like rgb like "rgb(255,255,2559" - // - byte: base64 encoded binary data - // - password: any kind of string - // - date: a date string like "2006-01-02" as defined by full-date in RFC3339 - // - duration: a duration string like "22 ns" as parsed by Golang time.ParseDuration or compatible with Scala duration format - // - datetime: a date time string like "2014-12-15T19:30:20.000Z" as defined by date-time in RFC3339. - optional string format = 6; - - optional string title = 7; - - // default is a default value for undefined object fields. - // Defaulting is a beta feature under the CustomResourceDefaulting feature gate. - // Defaulting requires spec.preserveUnknownFields to be false. - optional JSON default = 8; - - optional double maximum = 9; - - optional bool exclusiveMaximum = 10; - - optional double minimum = 11; - - optional bool exclusiveMinimum = 12; - - optional int64 maxLength = 13; - - optional int64 minLength = 14; - - optional string pattern = 15; - - optional int64 maxItems = 16; - - optional int64 minItems = 17; - - optional bool uniqueItems = 18; - - optional double multipleOf = 19; - - // +listType=atomic - repeated JSON enum = 20; - - optional int64 maxProperties = 21; - - optional int64 minProperties = 22; - - // +listType=atomic - repeated string required = 23; - - optional JSONSchemaPropsOrArray items = 24; - - // +listType=atomic - repeated JSONSchemaProps allOf = 25; - - // +listType=atomic - repeated JSONSchemaProps oneOf = 26; - - // +listType=atomic - repeated JSONSchemaProps anyOf = 27; - - optional JSONSchemaProps not = 28; - - map properties = 29; - - optional JSONSchemaPropsOrBool additionalProperties = 30; - - map patternProperties = 31; - - map dependencies = 32; - - optional JSONSchemaPropsOrBool additionalItems = 33; - - map definitions = 34; - - optional ExternalDocumentation externalDocs = 35; - - optional JSON example = 36; - - optional bool nullable = 37; - - // x-kubernetes-preserve-unknown-fields stops the API server - // decoding step from pruning fields which are not specified - // in the validation schema. This affects fields recursively, - // but switches back to normal pruning behaviour if nested - // properties or additionalProperties are specified in the schema. - // This can either be true or undefined. False is forbidden. - optional bool xKubernetesPreserveUnknownFields = 38; - - // x-kubernetes-embedded-resource defines that the value is an - // embedded Kubernetes runtime.Object, with TypeMeta and - // ObjectMeta. The type must be object. It is allowed to further - // restrict the embedded object. kind, apiVersion and metadata - // are validated automatically. x-kubernetes-preserve-unknown-fields - // is allowed to be true, but does not have to be if the object - // is fully specified (up to kind, apiVersion, metadata). - optional bool xKubernetesEmbeddedResource = 39; - - // x-kubernetes-int-or-string specifies that this value is - // either an integer or a string. If this is true, an empty - // type is allowed and type as child of anyOf is permitted - // if following one of the following patterns: - // - // 1) anyOf: - // - type: integer - // - type: string - // 2) allOf: - // - anyOf: - // - type: integer - // - type: string - // - ... zero or more - optional bool xKubernetesIntOrString = 40; - - // x-kubernetes-list-map-keys annotates an array with the x-kubernetes-list-type `map` by specifying the keys used - // as the index of the map. - // - // This tag MUST only be used on lists that have the "x-kubernetes-list-type" - // extension set to "map". Also, the values specified for this attribute must - // be a scalar typed field of the child structure (no nesting is supported). - // - // The properties specified must either be required or have a default value, - // to ensure those properties are present for all list items. - // - // +optional - // +listType=atomic - repeated string xKubernetesListMapKeys = 41; - - // x-kubernetes-list-type annotates an array to further describe its topology. - // This extension must only be used on lists and may have 3 possible values: - // - // 1) `atomic`: the list is treated as a single entity, like a scalar. - // Atomic lists will be entirely replaced when updated. This extension - // may be used on any type of list (struct, scalar, ...). - // 2) `set`: - // Sets are lists that must not have multiple items with the same value. Each - // value must be a scalar, an object with x-kubernetes-map-type `atomic` or an - // array with x-kubernetes-list-type `atomic`. - // 3) `map`: - // These lists are like maps in that their elements have a non-index key - // used to identify them. Order is preserved upon merge. The map tag - // must only be used on a list with elements of type object. - // Defaults to atomic for arrays. - // +optional - optional string xKubernetesListType = 42; - - // x-kubernetes-map-type annotates an object to further describe its topology. - // This extension must only be used when type is object and may have 2 possible values: - // - // 1) `granular`: - // These maps are actual maps (key-value pairs) and each fields are independent - // from each other (they can each be manipulated by separate actors). This is - // the default behaviour for all maps. - // 2) `atomic`: the list is treated as a single entity, like a scalar. - // Atomic maps will be entirely replaced when updated. - // +optional - optional string xKubernetesMapType = 43; - - // x-kubernetes-validations describes a list of validation rules written in the CEL expression language. - // This field is an alpha-level. Using this field requires the feature gate `CustomResourceValidationExpressions` to be enabled. - // +patchMergeKey=rule - // +patchStrategy=merge - // +listType=map - // +listMapKey=rule - repeated ValidationRule xKubernetesValidations = 44; -} - -// JSONSchemaPropsOrArray represents a value that can either be a JSONSchemaProps -// or an array of JSONSchemaProps. Mainly here for serialization purposes. -message JSONSchemaPropsOrArray { - optional JSONSchemaProps schema = 1; - - // +listType=atomic - repeated JSONSchemaProps jSONSchemas = 2; -} - -// JSONSchemaPropsOrBool represents JSONSchemaProps or a boolean value. -// Defaults to true for the boolean property. -message JSONSchemaPropsOrBool { - optional bool allows = 1; - - optional JSONSchemaProps schema = 2; -} - -// JSONSchemaPropsOrStringArray represents a JSONSchemaProps or a string array. -message JSONSchemaPropsOrStringArray { - optional JSONSchemaProps schema = 1; - - // +listType=atomic - repeated string property = 2; -} - -// ValidationRule describes a validation rule written in the CEL expression language. -message ValidationRule { - // Rule represents the expression which will be evaluated by CEL. - // ref: https://github.com/google/cel-spec - // The Rule is scoped to the location of the x-kubernetes-validations extension in the schema. - // The `self` variable in the CEL expression is bound to the scoped value. - // Example: - // - Rule scoped to the root of a resource with a status subresource: {"rule": "self.status.actual <= self.spec.maxDesired"} - // - // If the Rule is scoped to an object with properties, the accessible properties of the object are field selectable - // via `self.field` and field presence can be checked via `has(self.field)`. Null valued fields are treated as - // absent fields in CEL expressions. - // If the Rule is scoped to an object with additionalProperties (i.e. a map) the value of the map - // are accessible via `self[mapKey]`, map containment can be checked via `mapKey in self` and all entries of the map - // are accessible via CEL macros and functions such as `self.all(...)`. - // If the Rule is scoped to an array, the elements of the array are accessible via `self[i]` and also by macros and - // functions. - // If the Rule is scoped to a scalar, `self` is bound to the scalar value. - // Examples: - // - Rule scoped to a map of objects: {"rule": "self.components['Widget'].priority < 10"} - // - Rule scoped to a list of integers: {"rule": "self.values.all(value, value >= 0 && value < 100)"} - // - Rule scoped to a string value: {"rule": "self.startsWith('kube')"} - // - // The `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the - // object and from any x-kubernetes-embedded-resource annotated objects. No other metadata properties are accessible. - // - // Unknown data preserved in custom resources via x-kubernetes-preserve-unknown-fields is not accessible in CEL - // expressions. This includes: - // - Unknown field values that are preserved by object schemas with x-kubernetes-preserve-unknown-fields. - // - Object properties where the property schema is of an "unknown type". An "unknown type" is recursively defined as: - // - A schema with no type and x-kubernetes-preserve-unknown-fields set to true - // - An array where the items schema is of an "unknown type" - // - An object where the additionalProperties schema is of an "unknown type" - // - // Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. - // Accessible property names are escaped according to the following rules when accessed in the expression: - // - '__' escapes to '__underscores__' - // - '.' escapes to '__dot__' - // - '-' escapes to '__dash__' - // - '/' escapes to '__slash__' - // - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are: - // "true", "false", "null", "in", "as", "break", "const", "continue", "else", "for", "function", "if", - // "import", "let", "loop", "package", "namespace", "return". - // Examples: - // - Rule accessing a property named "namespace": {"rule": "self.__namespace__ > 0"} - // - Rule accessing a property named "x-prop": {"rule": "self.x__dash__prop > 0"} - // - Rule accessing a property named "redact__d": {"rule": "self.redact__underscores__d > 0"} - // - // Equality on arrays with x-kubernetes-list-type of 'set' or 'map' ignores element order, i.e. [1, 2] == [2, 1]. - // Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type: - // - 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and - // non-intersecting elements in `Y` are appended, retaining their partial order. - // - 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values - // are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with - // non-intersecting keys are appended, retaining their partial order. - // - // If `rule` makes use of the `oldSelf` variable it is implicitly a - // `transition rule`. - // - // By default, the `oldSelf` variable is the same type as `self`. - // When `optionalOldSelf` is true, the `oldSelf` variable is a CEL optional - // variable whose value() is the same type as `self`. - // See the documentation for the `optionalOldSelf` field for details. - // - // Transition rules by default are applied only on UPDATE requests and are - // skipped if an old value could not be found. You can opt a transition - // rule into unconditional evaluation by setting `optionalOldSelf` to true. - optional string rule = 1; - - // Message represents the message displayed when validation fails. The message is required if the Rule contains - // line breaks. The message must not contain line breaks. - // If unset, the message is "failed rule: {Rule}". - // e.g. "must be a URL with the host matching spec.host" - optional string message = 2; - - // MessageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails. - // Since messageExpression is used as a failure message, it must evaluate to a string. - // If both message and messageExpression are present on a rule, then messageExpression will be used if validation - // fails. If messageExpression results in a runtime error, the runtime error is logged, and the validation failure message is produced - // as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string - // that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset, and - // the fact that messageExpression produced an empty string/string with only spaces/string with line breaks will be logged. - // messageExpression has access to all the same variables as the rule; the only difference is the return type. - // Example: - // "x must be less than max ("+string(self.max)+")" - // +optional - optional string messageExpression = 3; - - // reason provides a machine-readable validation failure reason that is returned to the caller when a request fails this validation rule. - // The HTTP status code returned to the caller will match the reason of the reason of the first failed validation rule. - // The currently supported reasons are: "FieldValueInvalid", "FieldValueForbidden", "FieldValueRequired", "FieldValueDuplicate". - // If not set, default to use "FieldValueInvalid". - // All future added reasons must be accepted by clients when reading this value and unknown reasons should be treated as FieldValueInvalid. - // +optional - optional string reason = 4; - - // fieldPath represents the field path returned when the validation fails. - // It must be a relative JSON path (i.e. with array notation) scoped to the location of this x-kubernetes-validations extension in the schema and refer to an existing field. - // e.g. when validation checks if a specific attribute `foo` under a map `testMap`, the fieldPath could be set to `.testMap.foo` - // If the validation checks two lists must have unique attributes, the fieldPath could be set to either of the list: e.g. `.testList` - // It does not support list numeric index. - // It supports child operation to refer to an existing field currently. Refer to [JSONPath support in Kubernetes](https://kubernetes.io/docs/reference/kubectl/jsonpath/) for more info. - // Numeric index of array is not supported. - // For field name which contains special characters, use `['specialName']` to refer the field name. - // e.g. for attribute `foo.34$` appears in a list `testList`, the fieldPath could be set to `.testList['foo.34$']` - // +optional - optional string fieldPath = 5; - - // optionalOldSelf is used to opt a transition rule into evaluation - // even when the object is first created, or if the old object is - // missing the value. - // - // When enabled `oldSelf` will be a CEL optional whose value will be - // `None` if there is no old value, or when the object is initially created. - // - // You may check for presence of oldSelf using `oldSelf.hasValue()` and - // unwrap it after checking using `oldSelf.value()`. Check the CEL - // documentation for Optional types for more information: - // https://pkg.go.dev/github.com/google/cel-go/cel#OptionalTypes - // - // May not be set unless `oldSelf` is used in `rule`. - // - // +featureGate=CRDValidationRatcheting - // +optional - optional bool optionalOldSelf = 6; -} - diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/register.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/register.go deleted file mode 100644 index 84e33fcdb..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/register.go +++ /dev/null @@ -1,50 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2017 The Kubernetes Authors. - -package v1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -const GroupName = "apiextensions.k8s.io" - -// SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} - -// Kind takes an unqualified kind and returns back a Group qualified GroupKind -func Kind(kind string) schema.GroupKind { - return SchemeGroupVersion.WithKind(kind).GroupKind() -} - -// Resource takes an unqualified resource and returns back a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -var ( - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes, addDefaultingFuncs) - localSchemeBuilder = &SchemeBuilder - AddToScheme = localSchemeBuilder.AddToScheme -) - -// Adds the list of known types to the given scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &CustomResourceDefinition{}, - &CustomResourceDefinitionList{}, - ) - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} - -func init() { - // We only register manually written functions here. The registration of the - // generated functions takes place in the generated files. The separation - // makes the code compile even when the generated files are missing. - localSchemeBuilder.Register(addDefaultingFuncs) -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/types.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/types.go deleted file mode 100644 index 16bb4003e..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/types.go +++ /dev/null @@ -1,92 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2019 The Kubernetes Authors. - -package v1 - -import ( - metav1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" -) - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// CustomResourceDefinition represents a resource that should be exposed on the API server. Its name MUST be in the format -// <.spec.name>.<.spec.group>. -type CustomResourceDefinition struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// CustomResourceDefinitionList is a list of CustomResourceDefinition objects. -type CustomResourceDefinitionList struct { - metav1.TypeMeta `json:",inline"` - - // Standard object's metadata - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // items list individual CustomResourceDefinition objects - Items []CustomResourceDefinition `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// CustomResourceValidation is a list of validation methods for CustomResources. -type CustomResourceValidation struct { - // openAPIV3Schema is the OpenAPI v3 schema to use for validation and pruning. - // +optional - OpenAPIV3Schema *JSONSchemaProps `json:"openAPIV3Schema,omitempty" protobuf:"bytes,1,opt,name=openAPIV3Schema"` -} - -// CustomResourceSubresources defines the status and scale subresources for CustomResources. -type CustomResourceSubresources struct { - // status indicates the custom resource should serve a `/status` subresource. - // When enabled: - // 1. requests to the custom resource primary endpoint ignore changes to the `status` stanza of the object. - // 2. requests to the custom resource `/status` subresource ignore changes to anything other than the `status` stanza of the object. - // +optional - Status *CustomResourceSubresourceStatus `json:"status,omitempty" protobuf:"bytes,1,opt,name=status"` - // scale indicates the custom resource should serve a `/scale` subresource that returns an `autoscaling/v1` Scale object. - // +optional - Scale *CustomResourceSubresourceScale `json:"scale,omitempty" protobuf:"bytes,2,opt,name=scale"` -} - -// CustomResourceSubresourceStatus defines how to serve the status subresource for CustomResources. -// Status is represented by the `.status` JSON path inside of a CustomResource. When set, -// * exposes a /status subresource for the custom resource -// * PUT requests to the /status subresource take a custom resource object, and ignore changes to anything except the status stanza -// * PUT/POST/PATCH requests to the custom resource ignore changes to the status stanza -type CustomResourceSubresourceStatus struct{} - -// CustomResourceSubresourceScale defines how to serve the scale subresource for CustomResources. -type CustomResourceSubresourceScale struct { - // specReplicasPath defines the JSON path inside of a custom resource that corresponds to Scale `spec.replicas`. - // Only JSON paths without the array notation are allowed. - // Must be a JSON Path under `.spec`. - // If there is no value under the given path in the custom resource, the `/scale` subresource will return an error on GET. - SpecReplicasPath string `json:"specReplicasPath" protobuf:"bytes,1,name=specReplicasPath"` - // statusReplicasPath defines the JSON path inside of a custom resource that corresponds to Scale `status.replicas`. - // Only JSON paths without the array notation are allowed. - // Must be a JSON Path under `.status`. - // If there is no value under the given path in the custom resource, the `status.replicas` value in the `/scale` subresource - // will default to 0. - StatusReplicasPath string `json:"statusReplicasPath" protobuf:"bytes,2,opt,name=statusReplicasPath"` - // labelSelectorPath defines the JSON path inside of a custom resource that corresponds to Scale `status.selector`. - // Only JSON paths without the array notation are allowed. - // Must be a JSON Path under `.status` or `.spec`. - // Must be set to work with HorizontalPodAutoscaler. - // The field pointed by this JSON path must be a string field (not a complex selector struct) - // which contains a serialized label selector in string form. - // More info: https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions#scale-subresource - // If there is no value under the given path in the custom resource, the `status.selector` value in the `/scale` - // subresource will default to the empty string. - // +optional - LabelSelectorPath *string `json:"labelSelectorPath,omitempty" protobuf:"bytes,3,opt,name=labelSelectorPath"` -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/types_jsonschema.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/types_jsonschema.go deleted file mode 100644 index bcc8b18b4..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/types_jsonschema.go +++ /dev/null @@ -1,409 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2019 The Kubernetes Authors. - -package v1 - -// FieldValueErrorReason is a machine-readable value providing more detail about why a field failed the validation. -// +enum -type FieldValueErrorReason string - -const ( - // FieldValueRequired is used to report required values that are not - // provided (e.g. empty strings, null values, or empty arrays). - FieldValueRequired FieldValueErrorReason = "FieldValueRequired" - // FieldValueDuplicate is used to report collisions of values that must be - // unique (e.g. unique IDs). - FieldValueDuplicate FieldValueErrorReason = "FieldValueDuplicate" - // FieldValueInvalid is used to report malformed values (e.g. failed regex - // match, too long, out of bounds). - FieldValueInvalid FieldValueErrorReason = "FieldValueInvalid" - // FieldValueForbidden is used to report valid (as per formatting rules) - // values which would be accepted under some conditions, but which are not - // permitted by the current conditions (such as security policy). - FieldValueForbidden FieldValueErrorReason = "FieldValueForbidden" -) - -// JSONSchemaProps is a JSON-Schema following Specification Draft 4 (http://json-schema.org/). -type JSONSchemaProps struct { - ID string `json:"id,omitempty" protobuf:"bytes,1,opt,name=id"` - Schema JSONSchemaURL `json:"$schema,omitempty" protobuf:"bytes,2,opt,name=schema"` - Ref *string `json:"$ref,omitempty" protobuf:"bytes,3,opt,name=ref"` - Description string `json:"description,omitempty" protobuf:"bytes,4,opt,name=description"` - Type string `json:"type,omitempty" protobuf:"bytes,5,opt,name=type"` - - // format is an OpenAPI v3 format string. Unknown formats are ignored. The following formats are validated: - // - // - bsonobjectid: a bson object ID, i.e. a 24 characters hex string - // - uri: an URI as parsed by Golang net/url.ParseRequestURI - // - email: an email address as parsed by Golang net/mail.ParseAddress - // - hostname: a valid representation for an Internet host name, as defined by RFC 1034, section 3.1 [RFC1034]. - // - ipv4: an IPv4 IP as parsed by Golang net.ParseIP - // - ipv6: an IPv6 IP as parsed by Golang net.ParseIP - // - cidr: a CIDR as parsed by Golang net.ParseCIDR - // - mac: a MAC address as parsed by Golang net.ParseMAC - // - uuid: an UUID that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{12}$ - // - uuid3: an UUID3 that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?3[0-9a-f]{3}-?[0-9a-f]{4}-?[0-9a-f]{12}$ - // - uuid4: an UUID4 that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?4[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12}$ - // - uuid5: an UUID5 that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?5[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12}$ - // - isbn: an ISBN10 or ISBN13 number string like "0321751043" or "978-0321751041" - // - isbn10: an ISBN10 number string like "0321751043" - // - isbn13: an ISBN13 number string like "978-0321751041" - // - creditcard: a credit card number defined by the regex ^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\d{3})\\d{11})$ with any non digit characters mixed in - // - ssn: a U.S. social security number following the regex ^\\d{3}[- ]?\\d{2}[- ]?\\d{4}$ - // - hexcolor: an hexadecimal color code like "#FFFFFF: following the regex ^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$ - // - rgbcolor: an RGB color code like rgb like "rgb(255,255,2559" - // - byte: base64 encoded binary data - // - password: any kind of string - // - date: a date string like "2006-01-02" as defined by full-date in RFC3339 - // - duration: a duration string like "22 ns" as parsed by Golang time.ParseDuration or compatible with Scala duration format - // - datetime: a date time string like "2014-12-15T19:30:20.000Z" as defined by date-time in RFC3339. - Format string `json:"format,omitempty" protobuf:"bytes,6,opt,name=format"` - - Title string `json:"title,omitempty" protobuf:"bytes,7,opt,name=title"` - // default is a default value for undefined object fields. - // Defaulting is a beta feature under the CustomResourceDefaulting feature gate. - // Defaulting requires spec.preserveUnknownFields to be false. - Default *JSON `json:"default,omitempty" protobuf:"bytes,8,opt,name=default"` - Maximum *float64 `json:"maximum,omitempty" protobuf:"bytes,9,opt,name=maximum"` - ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty" protobuf:"bytes,10,opt,name=exclusiveMaximum"` - Minimum *float64 `json:"minimum,omitempty" protobuf:"bytes,11,opt,name=minimum"` - ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty" protobuf:"bytes,12,opt,name=exclusiveMinimum"` - MaxLength *int64 `json:"maxLength,omitempty" protobuf:"bytes,13,opt,name=maxLength"` - MinLength *int64 `json:"minLength,omitempty" protobuf:"bytes,14,opt,name=minLength"` - Pattern string `json:"pattern,omitempty" protobuf:"bytes,15,opt,name=pattern"` - MaxItems *int64 `json:"maxItems,omitempty" protobuf:"bytes,16,opt,name=maxItems"` - MinItems *int64 `json:"minItems,omitempty" protobuf:"bytes,17,opt,name=minItems"` - UniqueItems bool `json:"uniqueItems,omitempty" protobuf:"bytes,18,opt,name=uniqueItems"` - MultipleOf *float64 `json:"multipleOf,omitempty" protobuf:"bytes,19,opt,name=multipleOf"` - // +listType=atomic - Enum []JSON `json:"enum,omitempty" protobuf:"bytes,20,rep,name=enum"` - MaxProperties *int64 `json:"maxProperties,omitempty" protobuf:"bytes,21,opt,name=maxProperties"` - MinProperties *int64 `json:"minProperties,omitempty" protobuf:"bytes,22,opt,name=minProperties"` - // +listType=atomic - Required []string `json:"required,omitempty" protobuf:"bytes,23,rep,name=required"` - Items *JSONSchemaPropsOrArray `json:"items,omitempty" protobuf:"bytes,24,opt,name=items"` - // +listType=atomic - AllOf []JSONSchemaProps `json:"allOf,omitempty" protobuf:"bytes,25,rep,name=allOf"` - // +listType=atomic - OneOf []JSONSchemaProps `json:"oneOf,omitempty" protobuf:"bytes,26,rep,name=oneOf"` - // +listType=atomic - AnyOf []JSONSchemaProps `json:"anyOf,omitempty" protobuf:"bytes,27,rep,name=anyOf"` - Not *JSONSchemaProps `json:"not,omitempty" protobuf:"bytes,28,opt,name=not"` - Properties map[string]JSONSchemaProps `json:"properties,omitempty" protobuf:"bytes,29,rep,name=properties"` - AdditionalProperties *JSONSchemaPropsOrBool `json:"additionalProperties,omitempty" protobuf:"bytes,30,opt,name=additionalProperties"` - PatternProperties map[string]JSONSchemaProps `json:"patternProperties,omitempty" protobuf:"bytes,31,rep,name=patternProperties"` - Dependencies JSONSchemaDependencies `json:"dependencies,omitempty" protobuf:"bytes,32,opt,name=dependencies"` - AdditionalItems *JSONSchemaPropsOrBool `json:"additionalItems,omitempty" protobuf:"bytes,33,opt,name=additionalItems"` - Definitions JSONSchemaDefinitions `json:"definitions,omitempty" protobuf:"bytes,34,opt,name=definitions"` - ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty" protobuf:"bytes,35,opt,name=externalDocs"` - Example *JSON `json:"example,omitempty" protobuf:"bytes,36,opt,name=example"` - Nullable bool `json:"nullable,omitempty" protobuf:"bytes,37,opt,name=nullable"` - - // x-kubernetes-preserve-unknown-fields stops the API server - // decoding step from pruning fields which are not specified - // in the validation schema. This affects fields recursively, - // but switches back to normal pruning behaviour if nested - // properties or additionalProperties are specified in the schema. - // This can either be true or undefined. False is forbidden. - XPreserveUnknownFields *bool `json:"x-kubernetes-preserve-unknown-fields,omitempty" protobuf:"bytes,38,opt,name=xKubernetesPreserveUnknownFields"` - - // x-kubernetes-embedded-resource defines that the value is an - // embedded Kubernetes runtime.Object, with TypeMeta and - // ObjectMeta. The type must be object. It is allowed to further - // restrict the embedded object. kind, apiVersion and metadata - // are validated automatically. x-kubernetes-preserve-unknown-fields - // is allowed to be true, but does not have to be if the object - // is fully specified (up to kind, apiVersion, metadata). - XEmbeddedResource bool `json:"x-kubernetes-embedded-resource,omitempty" protobuf:"bytes,39,opt,name=xKubernetesEmbeddedResource"` - - // x-kubernetes-int-or-string specifies that this value is - // either an integer or a string. If this is true, an empty - // type is allowed and type as child of anyOf is permitted - // if following one of the following patterns: - // - // 1) anyOf: - // - type: integer - // - type: string - // 2) allOf: - // - anyOf: - // - type: integer - // - type: string - // - ... zero or more - XIntOrString bool `json:"x-kubernetes-int-or-string,omitempty" protobuf:"bytes,40,opt,name=xKubernetesIntOrString"` - - // x-kubernetes-list-map-keys annotates an array with the x-kubernetes-list-type `map` by specifying the keys used - // as the index of the map. - // - // This tag MUST only be used on lists that have the "x-kubernetes-list-type" - // extension set to "map". Also, the values specified for this attribute must - // be a scalar typed field of the child structure (no nesting is supported). - // - // The properties specified must either be required or have a default value, - // to ensure those properties are present for all list items. - // - // +optional - // +listType=atomic - XListMapKeys []string `json:"x-kubernetes-list-map-keys,omitempty" protobuf:"bytes,41,rep,name=xKubernetesListMapKeys"` - - // x-kubernetes-list-type annotates an array to further describe its topology. - // This extension must only be used on lists and may have 3 possible values: - // - // 1) `atomic`: the list is treated as a single entity, like a scalar. - // Atomic lists will be entirely replaced when updated. This extension - // may be used on any type of list (struct, scalar, ...). - // 2) `set`: - // Sets are lists that must not have multiple items with the same value. Each - // value must be a scalar, an object with x-kubernetes-map-type `atomic` or an - // array with x-kubernetes-list-type `atomic`. - // 3) `map`: - // These lists are like maps in that their elements have a non-index key - // used to identify them. Order is preserved upon merge. The map tag - // must only be used on a list with elements of type object. - // Defaults to atomic for arrays. - // +optional - XListType *string `json:"x-kubernetes-list-type,omitempty" protobuf:"bytes,42,opt,name=xKubernetesListType"` - - // x-kubernetes-map-type annotates an object to further describe its topology. - // This extension must only be used when type is object and may have 2 possible values: - // - // 1) `granular`: - // These maps are actual maps (key-value pairs) and each fields are independent - // from each other (they can each be manipulated by separate actors). This is - // the default behaviour for all maps. - // 2) `atomic`: the list is treated as a single entity, like a scalar. - // Atomic maps will be entirely replaced when updated. - // +optional - XMapType *string `json:"x-kubernetes-map-type,omitempty" protobuf:"bytes,43,opt,name=xKubernetesMapType"` - - // x-kubernetes-validations describes a list of validation rules written in the CEL expression language. - // This field is an alpha-level. Using this field requires the feature gate `CustomResourceValidationExpressions` to be enabled. - // +patchMergeKey=rule - // +patchStrategy=merge - // +listType=map - // +listMapKey=rule - XValidations ValidationRules `json:"x-kubernetes-validations,omitempty" patchStrategy:"merge" patchMergeKey:"rule" protobuf:"bytes,44,rep,name=xKubernetesValidations"` -} - -// ValidationRules describes a list of validation rules written in the CEL expression language. -type ValidationRules []ValidationRule - -// ValidationRule describes a validation rule written in the CEL expression language. -type ValidationRule struct { - // Rule represents the expression which will be evaluated by CEL. - // ref: https://github.com/google/cel-spec - // The Rule is scoped to the location of the x-kubernetes-validations extension in the schema. - // The `self` variable in the CEL expression is bound to the scoped value. - // Example: - // - Rule scoped to the root of a resource with a status subresource: {"rule": "self.status.actual <= self.spec.maxDesired"} - // - // If the Rule is scoped to an object with properties, the accessible properties of the object are field selectable - // via `self.field` and field presence can be checked via `has(self.field)`. Null valued fields are treated as - // absent fields in CEL expressions. - // If the Rule is scoped to an object with additionalProperties (i.e. a map) the value of the map - // are accessible via `self[mapKey]`, map containment can be checked via `mapKey in self` and all entries of the map - // are accessible via CEL macros and functions such as `self.all(...)`. - // If the Rule is scoped to an array, the elements of the array are accessible via `self[i]` and also by macros and - // functions. - // If the Rule is scoped to a scalar, `self` is bound to the scalar value. - // Examples: - // - Rule scoped to a map of objects: {"rule": "self.components['Widget'].priority < 10"} - // - Rule scoped to a list of integers: {"rule": "self.values.all(value, value >= 0 && value < 100)"} - // - Rule scoped to a string value: {"rule": "self.startsWith('kube')"} - // - // The `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the - // object and from any x-kubernetes-embedded-resource annotated objects. No other metadata properties are accessible. - // - // Unknown data preserved in custom resources via x-kubernetes-preserve-unknown-fields is not accessible in CEL - // expressions. This includes: - // - Unknown field values that are preserved by object schemas with x-kubernetes-preserve-unknown-fields. - // - Object properties where the property schema is of an "unknown type". An "unknown type" is recursively defined as: - // - A schema with no type and x-kubernetes-preserve-unknown-fields set to true - // - An array where the items schema is of an "unknown type" - // - An object where the additionalProperties schema is of an "unknown type" - // - // Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. - // Accessible property names are escaped according to the following rules when accessed in the expression: - // - '__' escapes to '__underscores__' - // - '.' escapes to '__dot__' - // - '-' escapes to '__dash__' - // - '/' escapes to '__slash__' - // - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are: - // "true", "false", "null", "in", "as", "break", "const", "continue", "else", "for", "function", "if", - // "import", "let", "loop", "package", "namespace", "return". - // Examples: - // - Rule accessing a property named "namespace": {"rule": "self.__namespace__ > 0"} - // - Rule accessing a property named "x-prop": {"rule": "self.x__dash__prop > 0"} - // - Rule accessing a property named "redact__d": {"rule": "self.redact__underscores__d > 0"} - // - // Equality on arrays with x-kubernetes-list-type of 'set' or 'map' ignores element order, i.e. [1, 2] == [2, 1]. - // Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type: - // - 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and - // non-intersecting elements in `Y` are appended, retaining their partial order. - // - 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values - // are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with - // non-intersecting keys are appended, retaining their partial order. - // - // If `rule` makes use of the `oldSelf` variable it is implicitly a - // `transition rule`. - // - // By default, the `oldSelf` variable is the same type as `self`. - // When `optionalOldSelf` is true, the `oldSelf` variable is a CEL optional - // variable whose value() is the same type as `self`. - // See the documentation for the `optionalOldSelf` field for details. - // - // Transition rules by default are applied only on UPDATE requests and are - // skipped if an old value could not be found. You can opt a transition - // rule into unconditional evaluation by setting `optionalOldSelf` to true. - // - Rule string `json:"rule" protobuf:"bytes,1,opt,name=rule"` - // Message represents the message displayed when validation fails. The message is required if the Rule contains - // line breaks. The message must not contain line breaks. - // If unset, the message is "failed rule: {Rule}". - // e.g. "must be a URL with the host matching spec.host" - Message string `json:"message,omitempty" protobuf:"bytes,2,opt,name=message"` - // MessageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails. - // Since messageExpression is used as a failure message, it must evaluate to a string. - // If both message and messageExpression are present on a rule, then messageExpression will be used if validation - // fails. If messageExpression results in a runtime error, the runtime error is logged, and the validation failure message is produced - // as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string - // that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset, and - // the fact that messageExpression produced an empty string/string with only spaces/string with line breaks will be logged. - // messageExpression has access to all the same variables as the rule; the only difference is the return type. - // Example: - // "x must be less than max ("+string(self.max)+")" - // +optional - MessageExpression string `json:"messageExpression,omitempty" protobuf:"bytes,3,opt,name=messageExpression"` - // reason provides a machine-readable validation failure reason that is returned to the caller when a request fails this validation rule. - // The HTTP status code returned to the caller will match the reason of the reason of the first failed validation rule. - // The currently supported reasons are: "FieldValueInvalid", "FieldValueForbidden", "FieldValueRequired", "FieldValueDuplicate". - // If not set, default to use "FieldValueInvalid". - // All future added reasons must be accepted by clients when reading this value and unknown reasons should be treated as FieldValueInvalid. - // +optional - Reason *FieldValueErrorReason `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"` - // fieldPath represents the field path returned when the validation fails. - // It must be a relative JSON path (i.e. with array notation) scoped to the location of this x-kubernetes-validations extension in the schema and refer to an existing field. - // e.g. when validation checks if a specific attribute `foo` under a map `testMap`, the fieldPath could be set to `.testMap.foo` - // If the validation checks two lists must have unique attributes, the fieldPath could be set to either of the list: e.g. `.testList` - // It does not support list numeric index. - // It supports child operation to refer to an existing field currently. Refer to [JSONPath support in Kubernetes](https://kubernetes.io/docs/reference/kubectl/jsonpath/) for more info. - // Numeric index of array is not supported. - // For field name which contains special characters, use `['specialName']` to refer the field name. - // e.g. for attribute `foo.34$` appears in a list `testList`, the fieldPath could be set to `.testList['foo.34$']` - // +optional - FieldPath string `json:"fieldPath,omitempty" protobuf:"bytes,5,opt,name=fieldPath"` - - // optionalOldSelf is used to opt a transition rule into evaluation - // even when the object is first created, or if the old object is - // missing the value. - // - // When enabled `oldSelf` will be a CEL optional whose value will be - // `None` if there is no old value, or when the object is initially created. - // - // You may check for presence of oldSelf using `oldSelf.hasValue()` and - // unwrap it after checking using `oldSelf.value()`. Check the CEL - // documentation for Optional types for more information: - // https://pkg.go.dev/github.com/google/cel-go/cel#OptionalTypes - // - // May not be set unless `oldSelf` is used in `rule`. - // - // +featureGate=CRDValidationRatcheting - // +optional - OptionalOldSelf *bool `json:"optionalOldSelf,omitempty" protobuf:"bytes,6,opt,name=optionalOldSelf"` -} - -// JSON represents any valid JSON value. -// These types are supported: bool, int64, float64, string, []interface{}, map[string]interface{} and nil. -type JSON struct { - Raw []byte `json:"-" protobuf:"bytes,1,opt,name=raw"` -} - -// OpenAPISchemaType is used by the kube-openapi generator when constructing -// the OpenAPI spec of this type. -// -// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators -func (_ JSON) OpenAPISchemaType() []string { - // TODO: return actual types when anyOf is supported - return nil -} - -// OpenAPISchemaFormat is used by the kube-openapi generator when constructing -// the OpenAPI spec of this type. -func (_ JSON) OpenAPISchemaFormat() string { return "" } - -// JSONSchemaURL represents a schema url. -type JSONSchemaURL string - -// JSONSchemaPropsOrArray represents a value that can either be a JSONSchemaProps -// or an array of JSONSchemaProps. Mainly here for serialization purposes. -type JSONSchemaPropsOrArray struct { - Schema *JSONSchemaProps `protobuf:"bytes,1,opt,name=schema"` - // +listType=atomic - JSONSchemas []JSONSchemaProps `protobuf:"bytes,2,rep,name=jSONSchemas"` -} - -// OpenAPISchemaType is used by the kube-openapi generator when constructing -// the OpenAPI spec of this type. -// -// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators -func (_ JSONSchemaPropsOrArray) OpenAPISchemaType() []string { - // TODO: return actual types when anyOf is supported - return nil -} - -// OpenAPISchemaFormat is used by the kube-openapi generator when constructing -// the OpenAPI spec of this type. -func (_ JSONSchemaPropsOrArray) OpenAPISchemaFormat() string { return "" } - -// JSONSchemaPropsOrBool represents JSONSchemaProps or a boolean value. -// Defaults to true for the boolean property. -type JSONSchemaPropsOrBool struct { - Allows bool `protobuf:"varint,1,opt,name=allows"` - Schema *JSONSchemaProps `protobuf:"bytes,2,opt,name=schema"` -} - -// OpenAPISchemaType is used by the kube-openapi generator when constructing -// the OpenAPI spec of this type. -// -// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators -func (_ JSONSchemaPropsOrBool) OpenAPISchemaType() []string { - // TODO: return actual types when anyOf is supported - return nil -} - -// OpenAPISchemaFormat is used by the kube-openapi generator when constructing -// the OpenAPI spec of this type. -func (_ JSONSchemaPropsOrBool) OpenAPISchemaFormat() string { return "" } - -// JSONSchemaDependencies represent a dependencies property. -type JSONSchemaDependencies map[string]JSONSchemaPropsOrStringArray - -// JSONSchemaPropsOrStringArray represents a JSONSchemaProps or a string array. -type JSONSchemaPropsOrStringArray struct { - Schema *JSONSchemaProps `protobuf:"bytes,1,opt,name=schema"` - // +listType=atomic - Property []string `protobuf:"bytes,2,rep,name=property"` -} - -// OpenAPISchemaType is used by the kube-openapi generator when constructing -// the OpenAPI spec of this type. -// -// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators -func (_ JSONSchemaPropsOrStringArray) OpenAPISchemaType() []string { - // TODO: return actual types when anyOf is supported - return nil -} - -// OpenAPISchemaFormat is used by the kube-openapi generator when constructing -// the OpenAPI spec of this type. -func (_ JSONSchemaPropsOrStringArray) OpenAPISchemaFormat() string { return "" } - -// JSONSchemaDefinitions contains the models explicitly defined in this spec. -type JSONSchemaDefinitions map[string]JSONSchemaProps - -// ExternalDocumentation allows referencing an external resource for extended documentation. -type ExternalDocumentation struct { - Description string `json:"description,omitempty" protobuf:"bytes,1,opt,name=description"` - URL string `json:"url,omitempty" protobuf:"bytes,2,opt,name=url"` -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/zz_generated.conversion.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/zz_generated.conversion.go deleted file mode 100644 index e475040a2..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/zz_generated.conversion.go +++ /dev/null @@ -1,23 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by conversion-gen. DO NOT EDIT. - -package v1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -func init() { - localSchemeBuilder.Register(RegisterConversions) -} - -// RegisterConversions adds conversion functions to the given scheme. -// Public to allow building arbitrary schemes. -func RegisterConversions(s *runtime.Scheme) error { - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/zz_generated.deepcopy.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/zz_generated.deepcopy.go deleted file mode 100644 index 38419d8c1..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/zz_generated.deepcopy.go +++ /dev/null @@ -1,549 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CustomResourceDefinition) DeepCopyInto(out *CustomResourceDefinition) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomResourceDefinition. -func (in *CustomResourceDefinition) DeepCopy() *CustomResourceDefinition { - if in == nil { - return nil - } - out := new(CustomResourceDefinition) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CustomResourceDefinition) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CustomResourceDefinitionList) DeepCopyInto(out *CustomResourceDefinitionList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CustomResourceDefinition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomResourceDefinitionList. -func (in *CustomResourceDefinitionList) DeepCopy() *CustomResourceDefinitionList { - if in == nil { - return nil - } - out := new(CustomResourceDefinitionList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CustomResourceDefinitionList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CustomResourceSubresourceScale) DeepCopyInto(out *CustomResourceSubresourceScale) { - *out = *in - if in.LabelSelectorPath != nil { - in, out := &in.LabelSelectorPath, &out.LabelSelectorPath - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomResourceSubresourceScale. -func (in *CustomResourceSubresourceScale) DeepCopy() *CustomResourceSubresourceScale { - if in == nil { - return nil - } - out := new(CustomResourceSubresourceScale) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CustomResourceSubresourceStatus) DeepCopyInto(out *CustomResourceSubresourceStatus) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomResourceSubresourceStatus. -func (in *CustomResourceSubresourceStatus) DeepCopy() *CustomResourceSubresourceStatus { - if in == nil { - return nil - } - out := new(CustomResourceSubresourceStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CustomResourceSubresources) DeepCopyInto(out *CustomResourceSubresources) { - *out = *in - if in.Status != nil { - in, out := &in.Status, &out.Status - *out = new(CustomResourceSubresourceStatus) - **out = **in - } - if in.Scale != nil { - in, out := &in.Scale, &out.Scale - *out = new(CustomResourceSubresourceScale) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomResourceSubresources. -func (in *CustomResourceSubresources) DeepCopy() *CustomResourceSubresources { - if in == nil { - return nil - } - out := new(CustomResourceSubresources) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CustomResourceValidation) DeepCopyInto(out *CustomResourceValidation) { - *out = *in - if in.OpenAPIV3Schema != nil { - in, out := &in.OpenAPIV3Schema, &out.OpenAPIV3Schema - *out = new(JSONSchemaProps) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomResourceValidation. -func (in *CustomResourceValidation) DeepCopy() *CustomResourceValidation { - if in == nil { - return nil - } - out := new(CustomResourceValidation) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ExternalDocumentation) DeepCopyInto(out *ExternalDocumentation) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExternalDocumentation. -func (in *ExternalDocumentation) DeepCopy() *ExternalDocumentation { - if in == nil { - return nil - } - out := new(ExternalDocumentation) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *JSON) DeepCopyInto(out *JSON) { - *out = *in - if in.Raw != nil { - in, out := &in.Raw, &out.Raw - *out = make([]byte, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JSON. -func (in *JSON) DeepCopy() *JSON { - if in == nil { - return nil - } - out := new(JSON) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in JSONSchemaDefinitions) DeepCopyInto(out *JSONSchemaDefinitions) { - { - in := &in - *out = make(JSONSchemaDefinitions, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JSONSchemaDefinitions. -func (in JSONSchemaDefinitions) DeepCopy() JSONSchemaDefinitions { - if in == nil { - return nil - } - out := new(JSONSchemaDefinitions) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in JSONSchemaDependencies) DeepCopyInto(out *JSONSchemaDependencies) { - { - in := &in - *out = make(JSONSchemaDependencies, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JSONSchemaDependencies. -func (in JSONSchemaDependencies) DeepCopy() JSONSchemaDependencies { - if in == nil { - return nil - } - out := new(JSONSchemaDependencies) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *JSONSchemaProps) DeepCopyInto(out *JSONSchemaProps) { - *out = *in - if in.Ref != nil { - in, out := &in.Ref, &out.Ref - *out = new(string) - **out = **in - } - if in.Default != nil { - in, out := &in.Default, &out.Default - *out = new(JSON) - (*in).DeepCopyInto(*out) - } - if in.Maximum != nil { - in, out := &in.Maximum, &out.Maximum - *out = new(float64) - **out = **in - } - if in.Minimum != nil { - in, out := &in.Minimum, &out.Minimum - *out = new(float64) - **out = **in - } - if in.MaxLength != nil { - in, out := &in.MaxLength, &out.MaxLength - *out = new(int64) - **out = **in - } - if in.MinLength != nil { - in, out := &in.MinLength, &out.MinLength - *out = new(int64) - **out = **in - } - if in.MaxItems != nil { - in, out := &in.MaxItems, &out.MaxItems - *out = new(int64) - **out = **in - } - if in.MinItems != nil { - in, out := &in.MinItems, &out.MinItems - *out = new(int64) - **out = **in - } - if in.MultipleOf != nil { - in, out := &in.MultipleOf, &out.MultipleOf - *out = new(float64) - **out = **in - } - if in.Enum != nil { - in, out := &in.Enum, &out.Enum - *out = make([]JSON, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.MaxProperties != nil { - in, out := &in.MaxProperties, &out.MaxProperties - *out = new(int64) - **out = **in - } - if in.MinProperties != nil { - in, out := &in.MinProperties, &out.MinProperties - *out = new(int64) - **out = **in - } - if in.Required != nil { - in, out := &in.Required, &out.Required - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = new(JSONSchemaPropsOrArray) - (*in).DeepCopyInto(*out) - } - if in.AllOf != nil { - in, out := &in.AllOf, &out.AllOf - *out = make([]JSONSchemaProps, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.OneOf != nil { - in, out := &in.OneOf, &out.OneOf - *out = make([]JSONSchemaProps, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.AnyOf != nil { - in, out := &in.AnyOf, &out.AnyOf - *out = make([]JSONSchemaProps, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Not != nil { - in, out := &in.Not, &out.Not - *out = new(JSONSchemaProps) - (*in).DeepCopyInto(*out) - } - if in.Properties != nil { - in, out := &in.Properties, &out.Properties - *out = make(map[string]JSONSchemaProps, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } - if in.AdditionalProperties != nil { - in, out := &in.AdditionalProperties, &out.AdditionalProperties - *out = new(JSONSchemaPropsOrBool) - (*in).DeepCopyInto(*out) - } - if in.PatternProperties != nil { - in, out := &in.PatternProperties, &out.PatternProperties - *out = make(map[string]JSONSchemaProps, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } - if in.Dependencies != nil { - in, out := &in.Dependencies, &out.Dependencies - *out = make(JSONSchemaDependencies, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } - if in.AdditionalItems != nil { - in, out := &in.AdditionalItems, &out.AdditionalItems - *out = new(JSONSchemaPropsOrBool) - (*in).DeepCopyInto(*out) - } - if in.Definitions != nil { - in, out := &in.Definitions, &out.Definitions - *out = make(JSONSchemaDefinitions, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } - if in.ExternalDocs != nil { - in, out := &in.ExternalDocs, &out.ExternalDocs - *out = new(ExternalDocumentation) - **out = **in - } - if in.Example != nil { - in, out := &in.Example, &out.Example - *out = new(JSON) - (*in).DeepCopyInto(*out) - } - if in.XPreserveUnknownFields != nil { - in, out := &in.XPreserveUnknownFields, &out.XPreserveUnknownFields - *out = new(bool) - **out = **in - } - if in.XListMapKeys != nil { - in, out := &in.XListMapKeys, &out.XListMapKeys - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.XListType != nil { - in, out := &in.XListType, &out.XListType - *out = new(string) - **out = **in - } - if in.XMapType != nil { - in, out := &in.XMapType, &out.XMapType - *out = new(string) - **out = **in - } - if in.XValidations != nil { - in, out := &in.XValidations, &out.XValidations - *out = make(ValidationRules, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JSONSchemaProps. -func (in *JSONSchemaProps) DeepCopy() *JSONSchemaProps { - if in == nil { - return nil - } - out := new(JSONSchemaProps) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *JSONSchemaPropsOrArray) DeepCopyInto(out *JSONSchemaPropsOrArray) { - *out = *in - if in.Schema != nil { - in, out := &in.Schema, &out.Schema - *out = new(JSONSchemaProps) - (*in).DeepCopyInto(*out) - } - if in.JSONSchemas != nil { - in, out := &in.JSONSchemas, &out.JSONSchemas - *out = make([]JSONSchemaProps, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JSONSchemaPropsOrArray. -func (in *JSONSchemaPropsOrArray) DeepCopy() *JSONSchemaPropsOrArray { - if in == nil { - return nil - } - out := new(JSONSchemaPropsOrArray) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *JSONSchemaPropsOrBool) DeepCopyInto(out *JSONSchemaPropsOrBool) { - *out = *in - if in.Schema != nil { - in, out := &in.Schema, &out.Schema - *out = new(JSONSchemaProps) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JSONSchemaPropsOrBool. -func (in *JSONSchemaPropsOrBool) DeepCopy() *JSONSchemaPropsOrBool { - if in == nil { - return nil - } - out := new(JSONSchemaPropsOrBool) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *JSONSchemaPropsOrStringArray) DeepCopyInto(out *JSONSchemaPropsOrStringArray) { - *out = *in - if in.Schema != nil { - in, out := &in.Schema, &out.Schema - *out = new(JSONSchemaProps) - (*in).DeepCopyInto(*out) - } - if in.Property != nil { - in, out := &in.Property, &out.Property - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JSONSchemaPropsOrStringArray. -func (in *JSONSchemaPropsOrStringArray) DeepCopy() *JSONSchemaPropsOrStringArray { - if in == nil { - return nil - } - out := new(JSONSchemaPropsOrStringArray) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ValidationRule) DeepCopyInto(out *ValidationRule) { - *out = *in - if in.Reason != nil { - in, out := &in.Reason, &out.Reason - *out = new(FieldValueErrorReason) - **out = **in - } - if in.OptionalOldSelf != nil { - in, out := &in.OptionalOldSelf, &out.OptionalOldSelf - *out = new(bool) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ValidationRule. -func (in *ValidationRule) DeepCopy() *ValidationRule { - if in == nil { - return nil - } - out := new(ValidationRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in ValidationRules) DeepCopyInto(out *ValidationRules) { - { - in := &in - *out = make(ValidationRules, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ValidationRules. -func (in ValidationRules) DeepCopy() ValidationRules { - if in == nil { - return nil - } - out := new(ValidationRules) - in.DeepCopyInto(out) - return *out -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/zz_generated.defaults.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/zz_generated.defaults.go deleted file mode 100644 index cd8143c7f..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/apiextensions/v1/zz_generated.defaults.go +++ /dev/null @@ -1,20 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by defaulter-gen. DO NOT EDIT. - -package v1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// RegisterDefaults adds defaulters functions to the given scheme. -// Public to allow building arbitrary schemes. -// All generated defaulters are covering - they call all nested defaulters. -func RegisterDefaults(scheme *runtime.Scheme) error { - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/doc.go deleted file mode 100644 index 9624efbd4..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/doc.go +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// +k8s:conversion-gen=false -// +k8s:deepcopy-gen=package -// +k8s:openapi-gen=true -// +k8s:defaulter-gen=TypeMeta -// +groupName=meta -// +deepequal-gen=package - -// Package types contains slimmer versions of k8s types. -package v1 diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/generated.pb.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/generated.pb.go deleted file mode 100644 index 18629faf2..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/generated.pb.go +++ /dev/null @@ -1,3307 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/generated.proto - -package v1 - -import ( - fmt "fmt" - - io "io" - - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" - - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" - - k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types" -) - -// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -func (m *Condition) Reset() { *m = Condition{} } -func (*Condition) ProtoMessage() {} -func (*Condition) Descriptor() ([]byte, []int) { - return fileDescriptor_e0f89ca41f751b36, []int{0} -} -func (m *Condition) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Condition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Condition) XXX_Merge(src proto.Message) { - xxx_messageInfo_Condition.Merge(m, src) -} -func (m *Condition) XXX_Size() int { - return m.Size() -} -func (m *Condition) XXX_DiscardUnknown() { - xxx_messageInfo_Condition.DiscardUnknown(m) -} - -var xxx_messageInfo_Condition proto.InternalMessageInfo - -func (m *LabelSelector) Reset() { *m = LabelSelector{} } -func (*LabelSelector) ProtoMessage() {} -func (*LabelSelector) Descriptor() ([]byte, []int) { - return fileDescriptor_e0f89ca41f751b36, []int{1} -} -func (m *LabelSelector) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LabelSelector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *LabelSelector) XXX_Merge(src proto.Message) { - xxx_messageInfo_LabelSelector.Merge(m, src) -} -func (m *LabelSelector) XXX_Size() int { - return m.Size() -} -func (m *LabelSelector) XXX_DiscardUnknown() { - xxx_messageInfo_LabelSelector.DiscardUnknown(m) -} - -var xxx_messageInfo_LabelSelector proto.InternalMessageInfo - -func (m *LabelSelectorRequirement) Reset() { *m = LabelSelectorRequirement{} } -func (*LabelSelectorRequirement) ProtoMessage() {} -func (*LabelSelectorRequirement) Descriptor() ([]byte, []int) { - return fileDescriptor_e0f89ca41f751b36, []int{2} -} -func (m *LabelSelectorRequirement) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LabelSelectorRequirement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *LabelSelectorRequirement) XXX_Merge(src proto.Message) { - xxx_messageInfo_LabelSelectorRequirement.Merge(m, src) -} -func (m *LabelSelectorRequirement) XXX_Size() int { - return m.Size() -} -func (m *LabelSelectorRequirement) XXX_DiscardUnknown() { - xxx_messageInfo_LabelSelectorRequirement.DiscardUnknown(m) -} - -var xxx_messageInfo_LabelSelectorRequirement proto.InternalMessageInfo - -func (m *ListMeta) Reset() { *m = ListMeta{} } -func (*ListMeta) ProtoMessage() {} -func (*ListMeta) Descriptor() ([]byte, []int) { - return fileDescriptor_e0f89ca41f751b36, []int{3} -} -func (m *ListMeta) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ListMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ListMeta) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListMeta.Merge(m, src) -} -func (m *ListMeta) XXX_Size() int { - return m.Size() -} -func (m *ListMeta) XXX_DiscardUnknown() { - xxx_messageInfo_ListMeta.DiscardUnknown(m) -} - -var xxx_messageInfo_ListMeta proto.InternalMessageInfo - -func (m *ObjectMeta) Reset() { *m = ObjectMeta{} } -func (*ObjectMeta) ProtoMessage() {} -func (*ObjectMeta) Descriptor() ([]byte, []int) { - return fileDescriptor_e0f89ca41f751b36, []int{4} -} -func (m *ObjectMeta) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ObjectMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ObjectMeta) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectMeta.Merge(m, src) -} -func (m *ObjectMeta) XXX_Size() int { - return m.Size() -} -func (m *ObjectMeta) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectMeta.DiscardUnknown(m) -} - -var xxx_messageInfo_ObjectMeta proto.InternalMessageInfo - -func (m *OwnerReference) Reset() { *m = OwnerReference{} } -func (*OwnerReference) ProtoMessage() {} -func (*OwnerReference) Descriptor() ([]byte, []int) { - return fileDescriptor_e0f89ca41f751b36, []int{5} -} -func (m *OwnerReference) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *OwnerReference) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *OwnerReference) XXX_Merge(src proto.Message) { - xxx_messageInfo_OwnerReference.Merge(m, src) -} -func (m *OwnerReference) XXX_Size() int { - return m.Size() -} -func (m *OwnerReference) XXX_DiscardUnknown() { - xxx_messageInfo_OwnerReference.DiscardUnknown(m) -} - -var xxx_messageInfo_OwnerReference proto.InternalMessageInfo - -func (m *PartialObjectMetadata) Reset() { *m = PartialObjectMetadata{} } -func (*PartialObjectMetadata) ProtoMessage() {} -func (*PartialObjectMetadata) Descriptor() ([]byte, []int) { - return fileDescriptor_e0f89ca41f751b36, []int{6} -} -func (m *PartialObjectMetadata) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PartialObjectMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *PartialObjectMetadata) XXX_Merge(src proto.Message) { - xxx_messageInfo_PartialObjectMetadata.Merge(m, src) -} -func (m *PartialObjectMetadata) XXX_Size() int { - return m.Size() -} -func (m *PartialObjectMetadata) XXX_DiscardUnknown() { - xxx_messageInfo_PartialObjectMetadata.DiscardUnknown(m) -} - -var xxx_messageInfo_PartialObjectMetadata proto.InternalMessageInfo - -func (m *PartialObjectMetadataList) Reset() { *m = PartialObjectMetadataList{} } -func (*PartialObjectMetadataList) ProtoMessage() {} -func (*PartialObjectMetadataList) Descriptor() ([]byte, []int) { - return fileDescriptor_e0f89ca41f751b36, []int{7} -} -func (m *PartialObjectMetadataList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PartialObjectMetadataList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *PartialObjectMetadataList) XXX_Merge(src proto.Message) { - xxx_messageInfo_PartialObjectMetadataList.Merge(m, src) -} -func (m *PartialObjectMetadataList) XXX_Size() int { - return m.Size() -} -func (m *PartialObjectMetadataList) XXX_DiscardUnknown() { - xxx_messageInfo_PartialObjectMetadataList.DiscardUnknown(m) -} - -var xxx_messageInfo_PartialObjectMetadataList proto.InternalMessageInfo - -func (m *Time) Reset() { *m = Time{} } -func (*Time) ProtoMessage() {} -func (*Time) Descriptor() ([]byte, []int) { - return fileDescriptor_e0f89ca41f751b36, []int{8} -} -func (m *Time) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Time.Unmarshal(m, b) -} -func (m *Time) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Time.Marshal(b, m, deterministic) -} -func (m *Time) XXX_Merge(src proto.Message) { - xxx_messageInfo_Time.Merge(m, src) -} -func (m *Time) XXX_Size() int { - return xxx_messageInfo_Time.Size(m) -} -func (m *Time) XXX_DiscardUnknown() { - xxx_messageInfo_Time.DiscardUnknown(m) -} - -var xxx_messageInfo_Time proto.InternalMessageInfo - -func (m *Timestamp) Reset() { *m = Timestamp{} } -func (*Timestamp) ProtoMessage() {} -func (*Timestamp) Descriptor() ([]byte, []int) { - return fileDescriptor_e0f89ca41f751b36, []int{9} -} -func (m *Timestamp) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Timestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Timestamp) XXX_Merge(src proto.Message) { - xxx_messageInfo_Timestamp.Merge(m, src) -} -func (m *Timestamp) XXX_Size() int { - return m.Size() -} -func (m *Timestamp) XXX_DiscardUnknown() { - xxx_messageInfo_Timestamp.DiscardUnknown(m) -} - -var xxx_messageInfo_Timestamp proto.InternalMessageInfo - -func (m *TypeMeta) Reset() { *m = TypeMeta{} } -func (*TypeMeta) ProtoMessage() {} -func (*TypeMeta) Descriptor() ([]byte, []int) { - return fileDescriptor_e0f89ca41f751b36, []int{10} -} -func (m *TypeMeta) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TypeMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *TypeMeta) XXX_Merge(src proto.Message) { - xxx_messageInfo_TypeMeta.Merge(m, src) -} -func (m *TypeMeta) XXX_Size() int { - return m.Size() -} -func (m *TypeMeta) XXX_DiscardUnknown() { - xxx_messageInfo_TypeMeta.DiscardUnknown(m) -} - -var xxx_messageInfo_TypeMeta proto.InternalMessageInfo - -func init() { - proto.RegisterType((*Condition)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.Condition") - proto.RegisterType((*LabelSelector)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.LabelSelector") - proto.RegisterMapType((map[string]string)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.LabelSelector.MatchLabelsEntry") - proto.RegisterType((*LabelSelectorRequirement)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.LabelSelectorRequirement") - proto.RegisterType((*ListMeta)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ListMeta") - proto.RegisterType((*ObjectMeta)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ObjectMeta") - proto.RegisterMapType((map[string]string)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ObjectMeta.AnnotationsEntry") - proto.RegisterMapType((map[string]string)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ObjectMeta.LabelsEntry") - proto.RegisterType((*OwnerReference)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.OwnerReference") - proto.RegisterType((*PartialObjectMetadata)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.PartialObjectMetadata") - proto.RegisterType((*PartialObjectMetadataList)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.PartialObjectMetadataList") - proto.RegisterType((*Time)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.Time") - proto.RegisterType((*Timestamp)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.Timestamp") - proto.RegisterType((*TypeMeta)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.TypeMeta") -} - -func init() { - proto.RegisterFile("github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/generated.proto", fileDescriptor_e0f89ca41f751b36) -} - -var fileDescriptor_e0f89ca41f751b36 = []byte{ - // 1205 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcf, 0x6f, 0x1b, 0xc5, - 0x17, 0xf7, 0x66, 0x13, 0xc7, 0x7e, 0x4e, 0x9b, 0x74, 0xbe, 0xed, 0x97, 0x25, 0x12, 0xb6, 0x6b, - 0x24, 0x94, 0x4a, 0xb0, 0xa6, 0x39, 0x54, 0x69, 0x85, 0x10, 0xdd, 0xf4, 0x87, 0x42, 0x9b, 0xb4, - 0x9a, 0xb4, 0x3d, 0x00, 0x07, 0x26, 0xeb, 0xa9, 0x33, 0x64, 0x77, 0xd6, 0xec, 0x8c, 0x03, 0xbe, - 0x95, 0x5b, 0x01, 0x21, 0x55, 0x1c, 0x10, 0xc7, 0x56, 0xe2, 0x3f, 0xe1, 0xd2, 0x63, 0x8f, 0x3d, - 0x20, 0x8b, 0x1a, 0xfe, 0x08, 0x54, 0x21, 0x81, 0x66, 0x76, 0xd6, 0xbb, 0xfe, 0x51, 0x95, 0xba, - 0x39, 0x79, 0xf7, 0xbd, 0x37, 0x9f, 0xcf, 0x67, 0x76, 0xdf, 0xfb, 0xcc, 0x1a, 0xae, 0xb4, 0x99, - 0xdc, 0xef, 0xee, 0xb9, 0x7e, 0x14, 0x36, 0x7d, 0x16, 0xb0, 0xee, 0xf0, 0xa7, 0x73, 0xd0, 0x6e, - 0x1e, 0x6c, 0x88, 0xa6, 0x08, 0x58, 0xa8, 0x2f, 0x48, 0x87, 0x89, 0x66, 0x48, 0x25, 0x69, 0x1e, - 0x9e, 0x6d, 0xb6, 0x29, 0xa7, 0x31, 0x91, 0xb4, 0xe5, 0x76, 0xe2, 0x48, 0x46, 0xe8, 0x5c, 0x86, - 0xe3, 0x26, 0x00, 0xe9, 0x4f, 0xe7, 0xa0, 0xed, 0x1e, 0x6c, 0x08, 0x57, 0xe1, 0xe8, 0x0b, 0x85, - 0xe3, 0x2a, 0x1c, 0xf7, 0xf0, 0xec, 0xea, 0x7b, 0x39, 0xfe, 0x76, 0xd4, 0x8e, 0x9a, 0x1a, 0x6e, - 0xaf, 0x7b, 0x57, 0xdf, 0xe9, 0x1b, 0x7d, 0x95, 0xd0, 0xac, 0x2a, 0x21, 0x2e, 0x8b, 0x94, 0x96, - 0x90, 0xf8, 0xfb, 0x8c, 0xd3, 0xb8, 0xa7, 0x95, 0xc6, 0x5d, 0x2e, 0x59, 0x48, 0xc7, 0x75, 0xad, - 0x9e, 0x7b, 0xd9, 0x02, 0xe1, 0xef, 0xd3, 0x90, 0x8c, 0xaf, 0x6b, 0xfc, 0x68, 0x43, 0x79, 0x33, - 0xe2, 0x2d, 0x26, 0x59, 0xc4, 0x51, 0x1d, 0xe6, 0x65, 0xaf, 0x43, 0x1d, 0xab, 0x6e, 0xad, 0x95, - 0xbd, 0xa5, 0xc7, 0xfd, 0x5a, 0x61, 0xd0, 0xaf, 0xcd, 0xdf, 0xea, 0x75, 0x28, 0xd6, 0x19, 0x74, - 0x1e, 0x8a, 0x42, 0x12, 0xd9, 0x15, 0xce, 0x9c, 0xae, 0x39, 0x6d, 0x6a, 0x8a, 0xbb, 0x3a, 0xfa, - 0xbc, 0x5f, 0x5b, 0x1e, 0xc2, 0x25, 0x21, 0x6c, 0x16, 0xa0, 0x8f, 0x01, 0x45, 0x7b, 0x82, 0xc6, - 0x87, 0xb4, 0x75, 0x35, 0x51, 0xc1, 0x22, 0xee, 0xd8, 0x75, 0x6b, 0xcd, 0xf6, 0x56, 0x0d, 0x0c, - 0xba, 0x31, 0x51, 0x81, 0xa7, 0xac, 0x42, 0xf7, 0x2d, 0x40, 0x01, 0x11, 0xf2, 0x56, 0x4c, 0xb8, - 0xd0, 0x64, 0xb7, 0x58, 0x48, 0x9d, 0xf9, 0xba, 0xb5, 0x56, 0x59, 0xff, 0xc0, 0x9d, 0xed, 0x25, - 0xb9, 0x0a, 0x23, 0x93, 0x72, 0x7d, 0x02, 0x1f, 0x4f, 0xe1, 0x44, 0xef, 0x40, 0x31, 0xa6, 0x44, - 0x44, 0xdc, 0x59, 0xd0, 0x4f, 0xe4, 0x78, 0xfa, 0x44, 0xb0, 0x8e, 0x62, 0x93, 0x45, 0x67, 0x60, - 0x31, 0xa4, 0x42, 0x90, 0x36, 0x75, 0x8a, 0xba, 0x70, 0xd9, 0x14, 0x2e, 0x6e, 0x27, 0x61, 0x9c, - 0xe6, 0x1b, 0x7f, 0xcd, 0xc1, 0xb1, 0xeb, 0x64, 0x8f, 0x06, 0xbb, 0x34, 0xa0, 0xbe, 0x8c, 0x62, - 0xf4, 0x83, 0x05, 0x95, 0x90, 0x48, 0x7f, 0x5f, 0x87, 0x85, 0x63, 0xd5, 0xed, 0xb5, 0xca, 0xfa, - 0x9d, 0x59, 0x37, 0x3a, 0x02, 0xee, 0x6e, 0x67, 0xc0, 0x97, 0xb9, 0x8c, 0x7b, 0xde, 0xff, 0x8c, - 0xb2, 0x4a, 0x2e, 0x83, 0xf3, 0xfc, 0xe8, 0x27, 0x0b, 0x56, 0xf4, 0xfd, 0xe5, 0xaf, 0x3b, 0x31, - 0x15, 0x82, 0x45, 0x5c, 0x75, 0x84, 0x12, 0x75, 0xf3, 0x48, 0x44, 0x61, 0xfa, 0x65, 0x97, 0xc5, - 0x34, 0xa4, 0x5c, 0x7a, 0x8e, 0x91, 0xb3, 0xb2, 0x3d, 0xc6, 0x88, 0x27, 0x34, 0xac, 0x7e, 0x08, - 0x2b, 0xe3, 0xdb, 0x41, 0x2b, 0x60, 0x1f, 0xd0, 0x5e, 0xd2, 0xd4, 0x58, 0x5d, 0xa2, 0x93, 0xb0, - 0x70, 0x48, 0x82, 0x2e, 0x4d, 0x9a, 0x18, 0x27, 0x37, 0x17, 0xe6, 0x36, 0xac, 0xc6, 0x2f, 0x16, - 0x38, 0x2f, 0x12, 0x82, 0xde, 0xca, 0x01, 0x79, 0x15, 0xa3, 0xca, 0xbe, 0x46, 0x7b, 0x09, 0xea, - 0x65, 0x28, 0x45, 0x1d, 0xd5, 0xa1, 0x51, 0x6c, 0xa6, 0xe3, 0x8c, 0xa9, 0x29, 0xdd, 0x30, 0xf1, - 0xe7, 0xfd, 0xda, 0xa9, 0x11, 0xf8, 0x34, 0x81, 0x87, 0x4b, 0x51, 0x03, 0x8a, 0x5a, 0x8f, 0x70, - 0xec, 0xba, 0xbd, 0x56, 0xf6, 0x40, 0x35, 0xd3, 0x1d, 0x1d, 0xc1, 0x26, 0xd3, 0xf8, 0xd5, 0x82, - 0xd2, 0x75, 0x26, 0xe4, 0x36, 0x95, 0x04, 0x5d, 0x84, 0xe5, 0x98, 0x8a, 0xa8, 0x1b, 0xfb, 0xf4, - 0x0e, 0x8d, 0xd5, 0x73, 0x30, 0xf4, 0x6f, 0x18, 0xfa, 0x65, 0x3c, 0x9a, 0xc6, 0xe3, 0xf5, 0xe8, - 0x5d, 0x28, 0xf9, 0x11, 0x97, 0x8c, 0x77, 0xa9, 0x9e, 0xc8, 0xb2, 0xb7, 0x92, 0x4a, 0xdf, 0x34, - 0x71, 0x3c, 0xac, 0x40, 0x57, 0x00, 0xc5, 0x34, 0x24, 0x8c, 0x33, 0xde, 0xde, 0x92, 0x34, 0xdc, - 0x8c, 0xba, 0x5c, 0xea, 0xe1, 0xb3, 0xbd, 0xff, 0xab, 0xd1, 0xc1, 0x13, 0x59, 0x3c, 0x65, 0x45, - 0xe3, 0xcf, 0x45, 0x80, 0x1b, 0x7b, 0x5f, 0x50, 0x3f, 0xd9, 0x47, 0x1d, 0xe6, 0x39, 0x09, 0x27, - 0xdc, 0x67, 0x87, 0x84, 0x14, 0xeb, 0x0c, 0xda, 0x80, 0xa5, 0xd4, 0xc0, 0x54, 0xd4, 0x6c, 0xf3, - 0xa4, 0xa9, 0x5c, 0xba, 0x9a, 0xcb, 0xe1, 0x91, 0x4a, 0xd4, 0x84, 0xb2, 0x42, 0x10, 0x1d, 0xe2, - 0xa7, 0x3b, 0x3c, 0x61, 0x96, 0x95, 0x77, 0xd2, 0x04, 0xce, 0x6a, 0x90, 0x07, 0x76, 0x97, 0xb5, - 0xcc, 0x4c, 0xbf, 0x9f, 0xbe, 0xeb, 0xdb, 0x5b, 0x97, 0x9e, 0xf7, 0x6b, 0xa7, 0x5f, 0x64, 0xb6, - 0xca, 0x22, 0x85, 0x7b, 0x7b, 0xeb, 0x12, 0x56, 0x8b, 0xa7, 0xbd, 0x98, 0xe2, 0x2b, 0xbe, 0x98, - 0x75, 0x80, 0x76, 0x66, 0x96, 0x8b, 0xfa, 0x11, 0x23, 0xb3, 0x1a, 0x72, 0x26, 0x99, 0xab, 0x42, - 0xdf, 0x58, 0x70, 0xa2, 0x45, 0x03, 0x9a, 0x5a, 0x94, 0x90, 0x24, 0xec, 0x38, 0xe5, 0x23, 0xf0, - 0xc6, 0x53, 0x83, 0x7e, 0xed, 0xc4, 0xa5, 0x71, 0x68, 0x3c, 0xc9, 0x86, 0x0e, 0xa1, 0x18, 0x24, - 0x56, 0x55, 0xd1, 0xae, 0xb0, 0x33, 0x2b, 0x6f, 0xd6, 0x1f, 0x6e, 0xde, 0xa2, 0x86, 0x2e, 0x6b, - 0xdc, 0xc9, 0xb0, 0xa1, 0xef, 0x2c, 0xa8, 0x10, 0xce, 0x23, 0xa9, 0x1f, 0x85, 0x70, 0x96, 0x34, - 0xfb, 0xee, 0x11, 0xb0, 0x5f, 0xcc, 0x50, 0xc7, 0x5c, 0x32, 0x97, 0xc1, 0x79, 0x72, 0xf4, 0xad, - 0x05, 0xcb, 0xd1, 0x57, 0x9c, 0xc6, 0x98, 0xde, 0xa5, 0x31, 0xe5, 0x3e, 0x15, 0xce, 0x31, 0x2d, - 0xe8, 0xca, 0xcc, 0x82, 0x46, 0xe0, 0xb2, 0x46, 0x1a, 0x8d, 0x0b, 0x3c, 0xce, 0xbb, 0x7a, 0x1e, - 0x2a, 0x33, 0x7a, 0xa2, 0xf2, 0xd4, 0xf1, 0xcd, 0xbf, 0x92, 0xa7, 0xfe, 0x6d, 0xc1, 0xf1, 0x51, - 0x7d, 0xaa, 0xad, 0x49, 0x87, 0xa5, 0x43, 0x91, 0x0c, 0xd9, 0xb0, 0xad, 0x2f, 0xde, 0xdc, 0x4a, - 0xe7, 0x21, 0x57, 0xa5, 0xec, 0xe1, 0x80, 0xf1, 0xd6, 0xb8, 0x3d, 0x5c, 0x63, 0xbc, 0x85, 0x75, - 0x66, 0x68, 0x20, 0xf6, 0x0b, 0x0d, 0xc4, 0x4c, 0xf5, 0xfc, 0xeb, 0x4c, 0xb5, 0x0b, 0xa0, 0x9c, - 0x30, 0x8e, 0x82, 0x80, 0xc6, 0x7a, 0xa0, 0x4b, 0xde, 0x71, 0xa5, 0x7b, 0x73, 0x18, 0xc5, 0xb9, - 0x8a, 0xc6, 0xf7, 0x16, 0x9c, 0xba, 0x49, 0x62, 0xc9, 0x48, 0x90, 0xb5, 0x53, 0x8b, 0x48, 0x82, - 0x62, 0x28, 0x85, 0xe6, 0x5a, 0xef, 0xaa, 0xb2, 0xee, 0xbd, 0x7e, 0xa3, 0x66, 0xcf, 0x31, 0x8b, - 0xe1, 0x21, 0x4f, 0xe3, 0x1f, 0x0b, 0xde, 0x9c, 0xaa, 0x46, 0x1d, 0x27, 0x88, 0x4f, 0x28, 0xfa, - 0x68, 0xe6, 0xe3, 0xdc, 0x1c, 0x4f, 0xd9, 0x49, 0x92, 0x46, 0x32, 0x35, 0x28, 0x86, 0x05, 0x26, - 0x69, 0x98, 0x7e, 0x3b, 0x6c, 0xcf, 0x4a, 0x36, 0x75, 0x47, 0xde, 0x31, 0xc3, 0xbc, 0xa0, 0x8e, - 0x1c, 0x81, 0x13, 0xaa, 0x46, 0x00, 0xf3, 0xfa, 0xc3, 0xed, 0x0c, 0x2c, 0x0a, 0xea, 0x47, 0xbc, - 0x25, 0xf4, 0x56, 0xed, 0xec, 0x83, 0x6c, 0x37, 0x09, 0xe3, 0x34, 0x8f, 0xde, 0x86, 0x05, 0x4e, - 0x78, 0x94, 0x7c, 0xf4, 0x2e, 0x64, 0xb8, 0x3b, 0x2a, 0x88, 0x93, 0xdc, 0x85, 0x93, 0x3f, 0x3f, - 0xac, 0x15, 0xee, 0x3f, 0xaa, 0x15, 0x1e, 0x3c, 0xaa, 0x15, 0x1e, 0x3e, 0xaa, 0x15, 0xee, 0xfd, - 0x56, 0x2f, 0x34, 0x3e, 0x85, 0x72, 0xe6, 0x8a, 0x47, 0x4c, 0xd9, 0xf8, 0x1c, 0x4a, 0xea, 0xdb, - 0x3c, 0x3d, 0x3d, 0x5f, 0x32, 0x1e, 0xa3, 0x43, 0x37, 0xf7, 0x5f, 0x86, 0xce, 0xfb, 0xec, 0xf1, - 0xb3, 0x6a, 0xe1, 0xc9, 0xb3, 0x6a, 0xe1, 0xe9, 0xb3, 0x6a, 0xe1, 0xde, 0xa0, 0x6a, 0x3d, 0x1e, - 0x54, 0xad, 0x27, 0x83, 0xaa, 0xf5, 0x74, 0x50, 0xb5, 0x7e, 0x1f, 0x54, 0xad, 0x07, 0x7f, 0x54, - 0x0b, 0x9f, 0x9c, 0x9b, 0xed, 0xdf, 0xd5, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xfd, 0x8c, 0x32, - 0xb1, 0x96, 0x0d, 0x00, 0x00, -} - -func (m *Condition) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Condition) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Condition) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Message) - copy(dAtA[i:], m.Message) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Message))) - i-- - dAtA[i] = 0x32 - i -= len(m.Reason) - copy(dAtA[i:], m.Reason) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Reason))) - i-- - dAtA[i] = 0x2a - { - size, err := m.LastTransitionTime.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - i = encodeVarintGenerated(dAtA, i, uint64(m.ObservedGeneration)) - i-- - dAtA[i] = 0x18 - i -= len(m.Status) - copy(dAtA[i:], m.Status) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Status))) - i-- - dAtA[i] = 0x12 - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *LabelSelector) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LabelSelector) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LabelSelector) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.MatchExpressions) > 0 { - for iNdEx := len(m.MatchExpressions) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.MatchExpressions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.MatchLabels) > 0 { - keysForMatchLabels := make([]string, 0, len(m.MatchLabels)) - for k := range m.MatchLabels { - keysForMatchLabels = append(keysForMatchLabels, string(k)) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForMatchLabels) - for iNdEx := len(keysForMatchLabels) - 1; iNdEx >= 0; iNdEx-- { - v := m.MatchLabels[string(keysForMatchLabels[iNdEx])] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarintGenerated(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(keysForMatchLabels[iNdEx]) - copy(dAtA[i:], keysForMatchLabels[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(keysForMatchLabels[iNdEx]))) - i-- - dAtA[i] = 0xa - i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *LabelSelectorRequirement) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LabelSelectorRequirement) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LabelSelectorRequirement) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Values) > 0 { - for iNdEx := len(m.Values) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Values[iNdEx]) - copy(dAtA[i:], m.Values[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Values[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - i -= len(m.Operator) - copy(dAtA[i:], m.Operator) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Operator))) - i-- - dAtA[i] = 0x12 - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ListMeta) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ListMeta) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ListMeta) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.RemainingItemCount != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.RemainingItemCount)) - i-- - dAtA[i] = 0x20 - } - i -= len(m.Continue) - copy(dAtA[i:], m.Continue) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Continue))) - i-- - dAtA[i] = 0x1a - i -= len(m.ResourceVersion) - copy(dAtA[i:], m.ResourceVersion) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ResourceVersion))) - i-- - dAtA[i] = 0x12 - return len(dAtA) - i, nil -} - -func (m *ObjectMeta) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ObjectMeta) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ObjectMeta) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.OwnerReferences) > 0 { - for iNdEx := len(m.OwnerReferences) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.OwnerReferences[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6a - } - } - if len(m.Annotations) > 0 { - keysForAnnotations := make([]string, 0, len(m.Annotations)) - for k := range m.Annotations { - keysForAnnotations = append(keysForAnnotations, string(k)) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForAnnotations) - for iNdEx := len(keysForAnnotations) - 1; iNdEx >= 0; iNdEx-- { - v := m.Annotations[string(keysForAnnotations[iNdEx])] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarintGenerated(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(keysForAnnotations[iNdEx]) - copy(dAtA[i:], keysForAnnotations[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(keysForAnnotations[iNdEx]))) - i-- - dAtA[i] = 0xa - i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x62 - } - } - if len(m.Labels) > 0 { - keysForLabels := make([]string, 0, len(m.Labels)) - for k := range m.Labels { - keysForLabels = append(keysForLabels, string(k)) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForLabels) - for iNdEx := len(keysForLabels) - 1; iNdEx >= 0; iNdEx-- { - v := m.Labels[string(keysForLabels[iNdEx])] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarintGenerated(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(keysForLabels[iNdEx]) - copy(dAtA[i:], keysForLabels[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(keysForLabels[iNdEx]))) - i-- - dAtA[i] = 0xa - i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x5a - } - } - if m.DeletionTimestamp != nil { - { - size, err := m.DeletionTimestamp.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4a - } - i = encodeVarintGenerated(dAtA, i, uint64(m.Generation)) - i-- - dAtA[i] = 0x38 - i -= len(m.ResourceVersion) - copy(dAtA[i:], m.ResourceVersion) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ResourceVersion))) - i-- - dAtA[i] = 0x32 - i -= len(m.UID) - copy(dAtA[i:], m.UID) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.UID))) - i-- - dAtA[i] = 0x2a - i -= len(m.Namespace) - copy(dAtA[i:], m.Namespace) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Namespace))) - i-- - dAtA[i] = 0x1a - i -= len(m.GenerateName) - copy(dAtA[i:], m.GenerateName) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.GenerateName))) - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *OwnerReference) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *OwnerReference) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *OwnerReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Controller != nil { - i-- - if *m.Controller { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x30 - } - i -= len(m.APIVersion) - copy(dAtA[i:], m.APIVersion) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.APIVersion))) - i-- - dAtA[i] = 0x2a - i -= len(m.UID) - copy(dAtA[i:], m.UID) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.UID))) - i-- - dAtA[i] = 0x22 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x1a - i -= len(m.Kind) - copy(dAtA[i:], m.Kind) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Kind))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *PartialObjectMetadata) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PartialObjectMetadata) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PartialObjectMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *PartialObjectMetadataList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PartialObjectMetadataList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PartialObjectMetadataList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Timestamp) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Timestamp) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Timestamp) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i = encodeVarintGenerated(dAtA, i, uint64(m.Nanos)) - i-- - dAtA[i] = 0x10 - i = encodeVarintGenerated(dAtA, i, uint64(m.Seconds)) - i-- - dAtA[i] = 0x8 - return len(dAtA) - i, nil -} - -func (m *TypeMeta) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *TypeMeta) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TypeMeta) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.APIVersion) - copy(dAtA[i:], m.APIVersion) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.APIVersion))) - i-- - dAtA[i] = 0x12 - i -= len(m.Kind) - copy(dAtA[i:], m.Kind) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Kind))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Condition) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Type) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Status) - n += 1 + l + sovGenerated(uint64(l)) - n += 1 + sovGenerated(uint64(m.ObservedGeneration)) - l = m.LastTransitionTime.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Reason) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Message) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *LabelSelector) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.MatchLabels) > 0 { - for k, v := range m.MatchLabels { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v))) - n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) - } - } - if len(m.MatchExpressions) > 0 { - for _, e := range m.MatchExpressions { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *LabelSelectorRequirement) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Operator) - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Values) > 0 { - for _, s := range m.Values { - l = len(s) - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *ListMeta) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ResourceVersion) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Continue) - n += 1 + l + sovGenerated(uint64(l)) - if m.RemainingItemCount != nil { - n += 1 + sovGenerated(uint64(*m.RemainingItemCount)) - } - return n -} - -func (m *ObjectMeta) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.GenerateName) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Namespace) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.UID) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.ResourceVersion) - n += 1 + l + sovGenerated(uint64(l)) - n += 1 + sovGenerated(uint64(m.Generation)) - if m.DeletionTimestamp != nil { - l = m.DeletionTimestamp.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if len(m.Labels) > 0 { - for k, v := range m.Labels { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v))) - n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) - } - } - if len(m.Annotations) > 0 { - for k, v := range m.Annotations { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v))) - n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) - } - } - if len(m.OwnerReferences) > 0 { - for _, e := range m.OwnerReferences { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *OwnerReference) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Kind) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.UID) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.APIVersion) - n += 1 + l + sovGenerated(uint64(l)) - if m.Controller != nil { - n += 2 - } - return n -} - -func (m *PartialObjectMetadata) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *PartialObjectMetadataList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *Timestamp) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovGenerated(uint64(m.Seconds)) - n += 1 + sovGenerated(uint64(m.Nanos)) - return n -} - -func (m *TypeMeta) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Kind) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.APIVersion) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *Condition) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Condition{`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `Status:` + fmt.Sprintf("%v", this.Status) + `,`, - `ObservedGeneration:` + fmt.Sprintf("%v", this.ObservedGeneration) + `,`, - `LastTransitionTime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.LastTransitionTime), "Time", "Time", 1), `&`, ``, 1) + `,`, - `Reason:` + fmt.Sprintf("%v", this.Reason) + `,`, - `Message:` + fmt.Sprintf("%v", this.Message) + `,`, - `}`, - }, "") - return s -} -func (this *LabelSelector) String() string { - if this == nil { - return "nil" - } - repeatedStringForMatchExpressions := "[]LabelSelectorRequirement{" - for _, f := range this.MatchExpressions { - repeatedStringForMatchExpressions += strings.Replace(strings.Replace(f.String(), "LabelSelectorRequirement", "LabelSelectorRequirement", 1), `&`, ``, 1) + "," - } - repeatedStringForMatchExpressions += "}" - keysForMatchLabels := make([]string, 0, len(this.MatchLabels)) - for k := range this.MatchLabels { - keysForMatchLabels = append(keysForMatchLabels, k) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForMatchLabels) - mapStringForMatchLabels := "map[string]string{" - for _, k := range keysForMatchLabels { - mapStringForMatchLabels += fmt.Sprintf("%v: %v,", k, this.MatchLabels[k]) - } - mapStringForMatchLabels += "}" - s := strings.Join([]string{`&LabelSelector{`, - `MatchLabels:` + mapStringForMatchLabels + `,`, - `MatchExpressions:` + repeatedStringForMatchExpressions + `,`, - `}`, - }, "") - return s -} -func (this *LabelSelectorRequirement) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&LabelSelectorRequirement{`, - `Key:` + fmt.Sprintf("%v", this.Key) + `,`, - `Operator:` + fmt.Sprintf("%v", this.Operator) + `,`, - `Values:` + fmt.Sprintf("%v", this.Values) + `,`, - `}`, - }, "") - return s -} -func (this *ListMeta) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ListMeta{`, - `ResourceVersion:` + fmt.Sprintf("%v", this.ResourceVersion) + `,`, - `Continue:` + fmt.Sprintf("%v", this.Continue) + `,`, - `RemainingItemCount:` + valueToStringGenerated(this.RemainingItemCount) + `,`, - `}`, - }, "") - return s -} -func (this *ObjectMeta) String() string { - if this == nil { - return "nil" - } - repeatedStringForOwnerReferences := "[]OwnerReference{" - for _, f := range this.OwnerReferences { - repeatedStringForOwnerReferences += strings.Replace(strings.Replace(f.String(), "OwnerReference", "OwnerReference", 1), `&`, ``, 1) + "," - } - repeatedStringForOwnerReferences += "}" - keysForLabels := make([]string, 0, len(this.Labels)) - for k := range this.Labels { - keysForLabels = append(keysForLabels, k) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForLabels) - mapStringForLabels := "map[string]string{" - for _, k := range keysForLabels { - mapStringForLabels += fmt.Sprintf("%v: %v,", k, this.Labels[k]) - } - mapStringForLabels += "}" - keysForAnnotations := make([]string, 0, len(this.Annotations)) - for k := range this.Annotations { - keysForAnnotations = append(keysForAnnotations, k) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForAnnotations) - mapStringForAnnotations := "map[string]string{" - for _, k := range keysForAnnotations { - mapStringForAnnotations += fmt.Sprintf("%v: %v,", k, this.Annotations[k]) - } - mapStringForAnnotations += "}" - s := strings.Join([]string{`&ObjectMeta{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `GenerateName:` + fmt.Sprintf("%v", this.GenerateName) + `,`, - `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, - `UID:` + fmt.Sprintf("%v", this.UID) + `,`, - `ResourceVersion:` + fmt.Sprintf("%v", this.ResourceVersion) + `,`, - `Generation:` + fmt.Sprintf("%v", this.Generation) + `,`, - `DeletionTimestamp:` + strings.Replace(fmt.Sprintf("%v", this.DeletionTimestamp), "Time", "Time", 1) + `,`, - `Labels:` + mapStringForLabels + `,`, - `Annotations:` + mapStringForAnnotations + `,`, - `OwnerReferences:` + repeatedStringForOwnerReferences + `,`, - `}`, - }, "") - return s -} -func (this *OwnerReference) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&OwnerReference{`, - `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `UID:` + fmt.Sprintf("%v", this.UID) + `,`, - `APIVersion:` + fmt.Sprintf("%v", this.APIVersion) + `,`, - `Controller:` + valueToStringGenerated(this.Controller) + `,`, - `}`, - }, "") - return s -} -func (this *PartialObjectMetadata) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&PartialObjectMetadata{`, - `ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "ObjectMeta", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *PartialObjectMetadataList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]PartialObjectMetadata{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "PartialObjectMetadata", "PartialObjectMetadata", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&PartialObjectMetadataList{`, - `ListMeta:` + strings.Replace(strings.Replace(this.ListMeta.String(), "ListMeta", "ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *Timestamp) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Timestamp{`, - `Seconds:` + fmt.Sprintf("%v", this.Seconds) + `,`, - `Nanos:` + fmt.Sprintf("%v", this.Nanos) + `,`, - `}`, - }, "") - return s -} -func (this *TypeMeta) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&TypeMeta{`, - `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, - `APIVersion:` + fmt.Sprintf("%v", this.APIVersion) + `,`, - `}`, - }, "") - return s -} -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *Condition) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Condition: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Condition: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Status = ConditionStatus(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ObservedGeneration", wireType) - } - m.ObservedGeneration = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ObservedGeneration |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastTransitionTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.LastTransitionTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Reason", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Reason = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Message = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LabelSelector) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LabelSelector: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LabelSelector: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MatchLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MatchLabels == nil { - m.MatchLabels = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.MatchLabels[mapkey] = mapvalue - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MatchExpressions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MatchExpressions = append(m.MatchExpressions, LabelSelectorRequirement{}) - if err := m.MatchExpressions[len(m.MatchExpressions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LabelSelectorRequirement) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LabelSelectorRequirement: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LabelSelectorRequirement: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Operator = LabelSelectorOperator(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Values = append(m.Values, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ListMeta) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ListMeta: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ListMeta: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResourceVersion", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ResourceVersion = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Continue", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Continue = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RemainingItemCount", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.RemainingItemCount = &v - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ObjectMeta) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ObjectMeta: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ObjectMeta: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GenerateName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.GenerateName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Namespace = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UID", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.UID = k8s_io_apimachinery_pkg_types.UID(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResourceVersion", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ResourceVersion = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Generation", wireType) - } - m.Generation = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Generation |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DeletionTimestamp", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.DeletionTimestamp == nil { - m.DeletionTimestamp = &Time{} - } - if err := m.DeletionTimestamp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Labels == nil { - m.Labels = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Labels[mapkey] = mapvalue - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Annotations", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Annotations == nil { - m.Annotations = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Annotations[mapkey] = mapvalue - iNdEx = postIndex - case 13: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerReferences", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OwnerReferences = append(m.OwnerReferences, OwnerReference{}) - if err := m.OwnerReferences[len(m.OwnerReferences)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *OwnerReference) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: OwnerReference: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: OwnerReference: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Kind = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UID", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.UID = k8s_io_apimachinery_pkg_types.UID(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field APIVersion", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.APIVersion = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Controller", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.Controller = &b - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PartialObjectMetadata) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PartialObjectMetadata: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PartialObjectMetadata: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PartialObjectMetadataList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PartialObjectMetadataList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PartialObjectMetadataList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, PartialObjectMetadata{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Timestamp) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Timestamp: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Timestamp: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Seconds", wireType) - } - m.Seconds = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Seconds |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Nanos", wireType) - } - m.Nanos = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Nanos |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TypeMeta) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TypeMeta: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TypeMeta: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Kind = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field APIVersion", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.APIVersion = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenerated(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenerated - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenerated - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenerated - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") -) diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/generated.proto b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/generated.proto deleted file mode 100644 index f237c9313..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/generated.proto +++ /dev/null @@ -1,379 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - - -// This file was autogenerated by go-to-protobuf. Do not edit it manually! - -syntax = "proto2"; - -package github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1; - -import "k8s.io/apimachinery/pkg/runtime/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; - -// Package-wide variables from generator "generated". -option go_package = "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1"; - -// Condition contains details for one aspect of the current state of this API Resource. -// --- -// This struct is intended for direct use as an array at the field path .status.conditions. For example, -// -// type FooStatus struct{ -// // Represents the observations of a foo's current state. -// // Known .status.conditions.type are: "Available", "Progressing", and "Degraded" -// // +patchMergeKey=type -// // +patchStrategy=merge -// // +listType=map -// // +listMapKey=type -// Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` -// -// // other fields -// } -message Condition { - // type of condition in CamelCase or in foo.example.com/CamelCase. - // --- - // Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - // useful (see .node.status.conditions), the ability to deconflict is important. - // The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - // +required - // +kubebuilder:validation:Required - // +kubebuilder:validation:Pattern=`^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$` - // +kubebuilder:validation:MaxLength=316 - optional string type = 1; - - // status of the condition, one of True, False, Unknown. - // +required - // +kubebuilder:validation:Required - // +kubebuilder:validation:Enum=True;False;Unknown - optional string status = 2; - - // observedGeneration represents the .metadata.generation that the condition was set based upon. - // For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date - // with respect to the current state of the instance. - // +optional - // +kubebuilder:validation:Minimum=0 - optional int64 observedGeneration = 3; - - // lastTransitionTime is the last time the condition transitioned from one status to another. - // This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. - // +required - // +kubebuilder:validation:Required - // +kubebuilder:validation:Type=string - // +kubebuilder:validation:Format=date-time - optional Time lastTransitionTime = 4; - - // reason contains a programmatic identifier indicating the reason for the condition's last transition. - // Producers of specific condition types may define expected values and meanings for this field, - // and whether the values are considered a guaranteed API. - // The value should be a CamelCase string. - // This field may not be empty. - // +required - // +kubebuilder:validation:Required - // +kubebuilder:validation:MaxLength=1024 - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:Pattern=`^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$` - optional string reason = 5; - - // message is a human readable message indicating details about the transition. - // This may be an empty string. - // +required - // +kubebuilder:validation:Required - // +kubebuilder:validation:MaxLength=32768 - optional string message = 6; -} - -// A label selector is a label query over a set of resources. The result of matchLabels and -// matchExpressions are ANDed. An empty label selector matches all objects. A null -// label selector matches no objects. -// +structType=atomic -message LabelSelector { - // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - // map is equivalent to an element of matchExpressions, whose key field is "key", the - // operator is "In", and the values array contains only "value". The requirements are ANDed. - // - // +kubebuilder:validation:Optional - map matchLabels = 1; - - // matchExpressions is a list of label selector requirements. The requirements are ANDed. - // +kubebuilder:validation:Optional - // +listType=atomic - repeated LabelSelectorRequirement matchExpressions = 2; -} - -// A label selector requirement is a selector that contains values, a key, and an operator that -// relates the key and values. -message LabelSelectorRequirement { - // key is the label key that the selector applies to. - optional string key = 1; - - // operator represents a key's relationship to a set of values. - // Valid operators are In, NotIn, Exists and DoesNotExist. - // - // +kubebuilder:validation:Enum=In;NotIn;Exists;DoesNotExist - optional string operator = 2; - - // values is an array of string values. If the operator is In or NotIn, - // the values array must be non-empty. If the operator is Exists or DoesNotExist, - // the values array must be empty. This array is replaced during a strategic - // merge patch. - // +kubebuilder:validation:Optional - // +listType=atomic - repeated string values = 3; -} - -// ListMeta describes metadata that synthetic resources must have, including lists and -// various status objects. A resource may have only one of {ObjectMeta, ListMeta}. -message ListMeta { - // String that identifies the server's internal version of this object that - // can be used by clients to determine when objects have changed. - // Value must be treated as opaque by clients and passed unmodified back to the server. - // Populated by the system. - // Read-only. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency - // +optional - optional string resourceVersion = 2; - - // continue may be set if the user set a limit on the number of items returned, and indicates that - // the server has more data available. The value is opaque and may be used to issue another request - // to the endpoint that served this list to retrieve the next set of available objects. Continuing a - // consistent list may not be possible if the server configuration has changed or more than a few - // minutes have passed. The resourceVersion field returned when using this continue value will be - // identical to the value in the first response, unless you have received this token from an error - // message. - optional string continue = 3; - - // remainingItemCount is the number of subsequent items in the list which are not included in this - // list response. If the list request contained label or field selectors, then the number of - // remaining items is unknown and the field will be left unset and omitted during serialization. - // If the list is complete (either because it is not chunking or because this is the last chunk), - // then there are no more remaining items and this field will be left unset and omitted during - // serialization. - // Servers older than v1.15 do not set this field. - // The intended use of the remainingItemCount is *estimating* the size of a collection. Clients - // should not rely on the remainingItemCount to be set or to be exact. - // +optional - optional int64 remainingItemCount = 4; -} - -// ObjectMeta is metadata that all persisted resources must have, which includes all objects -// users must create. -message ObjectMeta { - // Name must be unique within a namespace. Is required when creating resources, although - // some resources may allow a client to request the generation of an appropriate name - // automatically. Name is primarily intended for creation idempotence and configuration - // definition. - // Cannot be updated. - // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names - // +optional - optional string name = 1; - - // GenerateName is an optional prefix, used by the server, to generate a unique - // name ONLY IF the Name field has not been provided. - // If this field is used, the name returned to the client will be different - // than the name passed. This value will also be combined with a unique suffix. - // The provided value has the same validation rules as the Name field, - // and may be truncated by the length of the suffix required to make the value - // unique on the server. - // - // If this field is specified and the generated name exists, the server will return a 409. - // - // Applied only if Name is not specified. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency - // +optional - optional string generateName = 2; - - // Namespace defines the space within which each name must be unique. An empty namespace is - // equivalent to the "default" namespace, but "default" is the canonical representation. - // Not all objects are required to be scoped to a namespace - the value of this field for - // those objects will be empty. - // - // Must be a DNS_LABEL. - // Cannot be updated. - // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces - // +optional - optional string namespace = 3; - - // UID is the unique in time and space value for this object. It is typically generated by - // the server on successful creation of a resource and is not allowed to change on PUT - // operations. - // - // Populated by the system. - // Read-only. - // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids - // +optional - optional string uid = 5; - - // An opaque value that represents the internal version of this object that can - // be used by clients to determine when objects have changed. May be used for optimistic - // concurrency, change detection, and the watch operation on a resource or set of resources. - // Clients must treat these values as opaque and passed unmodified back to the server. - // They may only be valid for a particular resource or set of resources. - // - // Populated by the system. - // Read-only. - // Value must be treated as opaque by clients and . - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency - // +optional - // +deepequal-gen=false - optional string resourceVersion = 6; - - // A sequence number representing a specific generation of the desired state. - // Populated by the system. Read-only. - // +optional - optional int64 generation = 7; - - // DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This - // field is set by the server when a graceful deletion is requested by the user, and is not - // directly settable by a client. The resource is expected to be deleted (no longer visible - // from resource lists, and not reachable by name) after the time in this field, once the - // finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. - // Once the deletionTimestamp is set, this value may not be unset or be set further into the - // future, although it may be shortened or the resource may be deleted prior to this time. - // For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react - // by sending a graceful termination signal to the containers in the pod. After that 30 seconds, - // the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, - // remove the pod from the API. In the presence of network partitions, this object may still - // exist after this timestamp, until an administrator or automated process can determine the - // resource is fully terminated. - // If not set, graceful deletion of the object has not been requested. - // - // Populated by the system when a graceful deletion is requested. - // Read-only. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - optional Time deletionTimestamp = 9; - - // Map of string keys and values that can be used to organize and categorize - // (scope and select) objects. May match selectors of replication controllers - // and services. - // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels - // +optional - map labels = 11; - - // Annotations is an unstructured key value map stored with a resource that may be - // set by external tools to store and retrieve arbitrary metadata. They are not - // queryable and should be preserved when modifying objects. - // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations - // +optional - map annotations = 12; - - // List of objects depended by this object. If ALL objects in the list have - // been deleted, this object will be garbage collected. If this object is managed by a controller, - // then an entry in this list will point to this controller, with the controller field set to true. - // There cannot be more than one managing controller. - // +optional - // +patchMergeKey=uid - // +patchStrategy=merge - // +listType=map - // +listMapKey=uid - repeated OwnerReference ownerReferences = 13; -} - -// OwnerReference contains enough information to let you identify an owning -// object. An owning object must be in the same namespace as the dependent, or -// be cluster-scoped, so there is no namespace field. -// +structType=atomic -message OwnerReference { - // API version of the referent. - optional string apiVersion = 5; - - // Kind of the referent. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - optional string kind = 1; - - // Name of the referent. - // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names - optional string name = 3; - - // UID of the referent. - // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids - optional string uid = 4; - - // If true, this reference points to the managing controller. - // +optional - optional bool controller = 6; -} - -// PartialObjectMetadata is a generic representation of any object with ObjectMeta. It allows clients -// to get access to a particular ObjectMeta schema without knowing the details of the version. -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message PartialObjectMetadata { - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - optional ObjectMeta metadata = 1; -} - -// PartialObjectMetadataList contains a list of objects containing only their metadata -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message PartialObjectMetadataList { - // Standard list metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - // +optional - optional ListMeta metadata = 1; - - // items contains each of the included items. - repeated PartialObjectMetadata items = 2; -} - -// Time is a wrapper around time.Time which supports correct -// marshaling to YAML and JSON. Wrappers are provided for many -// of the factory methods that the time package offers. -// -// +protobuf.options.marshal=false -// +protobuf.as=Timestamp -// +protobuf.options.(gogoproto.goproto_stringer)=false -// -// +kubebuilder:validation:Format=date-time -// +kubebuilder:validation:Type=string -message Time { - // 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. - optional 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. This field may be limited in precision depending on context. - optional int32 nanos = 2; -} - -// Timestamp is a struct that is equivalent to Time, but intended for -// protobuf marshalling/unmarshalling. It is generated into a serialization -// that matches Time. Do not use in Go structs. -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. - optional 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. This field may be limited in precision depending on context. - optional int32 nanos = 2; -} - -// TypeMeta describes an individual object in an API response or request -// with strings representing the type of the object and its API schema version. -// Structures that are versioned or persisted should inline TypeMeta. -// -// +k8s:deepcopy-gen=false -message TypeMeta { - // Kind is a string value representing the REST resource this object represents. - // Servers may infer this from the endpoint the client submits requests to. - // Cannot be updated. - // In CamelCase. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - // +optional - optional string kind = 1; - - // APIVersion defines the versioned schema of this representation of an object. - // Servers should convert recognized schemas to the latest internal value, and - // may reject unrecognized values. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - // +optional - optional string apiVersion = 2; -} - diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/helpers.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/helpers.go deleted file mode 100644 index d2d08077a..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/helpers.go +++ /dev/null @@ -1,227 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2016 The Kubernetes Authors. - -package v1 - -import ( - "fmt" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/sets" - - "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/labels" - "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/selection" -) - -// LabelSelectorAsSelector converts the LabelSelector api type into a struct that implements -// labels.Selector -// Note: This function should be kept in sync with the selector methods in pkg/labels/selector.go -func LabelSelectorAsSelector(ps *LabelSelector) (labels.Selector, error) { - if ps == nil { - return labels.Nothing(), nil - } - if len(ps.MatchLabels)+len(ps.MatchExpressions) == 0 { - return labels.Everything(), nil - } - requirements := make([]labels.Requirement, 0, len(ps.MatchLabels)+len(ps.MatchExpressions)) - for k, v := range ps.MatchLabels { - r, err := labels.NewRequirement(k, selection.Equals, []string{v}) - if err != nil { - return nil, err - } - requirements = append(requirements, *r) - } - for _, expr := range ps.MatchExpressions { - var op selection.Operator - switch expr.Operator { - case LabelSelectorOpIn: - op = selection.In - case LabelSelectorOpNotIn: - op = selection.NotIn - case LabelSelectorOpExists: - op = selection.Exists - case LabelSelectorOpDoesNotExist: - op = selection.DoesNotExist - default: - return nil, fmt.Errorf("%q is not a valid label selector operator", expr.Operator) - } - r, err := labels.NewRequirement(expr.Key, op, append([]string(nil), expr.Values...)) - if err != nil { - return nil, err - } - requirements = append(requirements, *r) - } - selector := labels.NewSelector() - selector = selector.Add(requirements...) - return selector, nil -} - -// LabelSelectorAsMap converts the LabelSelector api type into a map of strings, ie. the -// original structure of a label selector. Operators that cannot be converted into plain -// labels (Exists, DoesNotExist, NotIn, and In with more than one value) will result in -// an error. -func LabelSelectorAsMap(ps *LabelSelector) (map[string]string, error) { - if ps == nil { - return nil, nil - } - selector := map[string]string{} - for k, v := range ps.MatchLabels { - selector[k] = v - } - for _, expr := range ps.MatchExpressions { - switch expr.Operator { - case LabelSelectorOpIn: - if len(expr.Values) != 1 { - return selector, fmt.Errorf("operator %q without a single value cannot be converted into the old label selector format", expr.Operator) - } - // Should we do anything in case this will override a previous key-value pair? - selector[expr.Key] = expr.Values[0] - case LabelSelectorOpNotIn, LabelSelectorOpExists, LabelSelectorOpDoesNotExist: - return selector, fmt.Errorf("operator %q cannot be converted into the old label selector format", expr.Operator) - default: - return selector, fmt.Errorf("%q is not a valid selector operator", expr.Operator) - } - } - return selector, nil -} - -// ParseToLabelSelector parses a string representing a selector into a LabelSelector object. -// Note: This function should be kept in sync with the parser in pkg/labels/selector.go -func ParseToLabelSelector(selector string) (*LabelSelector, error) { - reqs, err := labels.ParseToRequirements(selector) - if err != nil { - return nil, fmt.Errorf("couldn't parse the selector string \"%s\": %w", selector, err) - } - - labelSelector := &LabelSelector{ - MatchLabels: map[string]string{}, - MatchExpressions: []LabelSelectorRequirement{}, - } - for _, req := range reqs { - var op LabelSelectorOperator - switch req.Operator() { - case selection.Equals, selection.DoubleEquals: - vals := req.Values() - if vals.Len() != 1 { - return nil, fmt.Errorf("equals operator must have exactly one value") - } - val, ok := vals.PopAny() - if !ok { - return nil, fmt.Errorf("equals operator has exactly one value but it cannot be retrieved") - } - labelSelector.MatchLabels[req.Key()] = val - continue - case selection.In: - op = LabelSelectorOpIn - case selection.NotIn: - op = LabelSelectorOpNotIn - case selection.Exists: - op = LabelSelectorOpExists - case selection.DoesNotExist: - op = LabelSelectorOpDoesNotExist - case selection.GreaterThan, selection.LessThan: - // Adding a separate case for these operators to indicate that this is deliberate - return nil, fmt.Errorf("%q isn't supported in label selectors", req.Operator()) - default: - return nil, fmt.Errorf("%q is not a valid label selector operator", req.Operator()) - } - labelSelector.MatchExpressions = append(labelSelector.MatchExpressions, LabelSelectorRequirement{ - Key: req.Key(), - Operator: op, - Values: sets.List(req.Values()), - }) - } - return labelSelector, nil -} - -// SetAsLabelSelector converts the labels.Set object into a LabelSelector api object. -func SetAsLabelSelector(ls labels.Set) *LabelSelector { - if ls == nil { - return nil - } - - selector := &LabelSelector{ - MatchLabels: make(map[string]string, len(ls)), - } - for label, value := range ls { - selector.MatchLabels[label] = value - } - - return selector -} - -// FormatLabelSelector convert labelSelector into plain string -func FormatLabelSelector(labelSelector *LabelSelector) string { - selector, err := LabelSelectorAsSelector(labelSelector) - if err != nil { - return "" - } - - l := selector.String() - if len(l) == 0 { - l = "" - } - return l -} - -// FullOwnerReferences converts slim OwnerReferences to original OwnerReferences -func FullOwnerReferences(references []OwnerReference) []metav1.OwnerReference { - var fullRefs []metav1.OwnerReference - for _, ref := range references { - full := metav1.OwnerReference{ - APIVersion: ref.APIVersion, - UID: ref.UID, - Name: ref.Name, - Kind: ref.Kind, - Controller: ref.Controller, - } - fullRefs = append(fullRefs, full) - } - return fullRefs -} - -// SlimOwnerReferences converts original OwnerReferences to slim OwnerReferences -func SlimOwnerReferences(references []metav1.OwnerReference) []OwnerReference { - var slimRefs []OwnerReference - for _, ref := range references { - slim := OwnerReference{ - APIVersion: ref.APIVersion, - Name: ref.Name, - UID: ref.UID, - Kind: ref.Kind, - Controller: ref.Controller, - } - slimRefs = append(slimRefs, slim) - } - return slimRefs -} - -// HasAnnotation returns a bool if passed in annotation exists -func HasAnnotation(obj ObjectMeta, ann string) bool { - _, found := obj.Annotations[ann] - return found -} - -// SetMetaDataAnnotation sets the annotation and value -func SetMetaDataAnnotation(obj *ObjectMeta, ann string, value string) { - if obj.Annotations == nil { - obj.Annotations = make(map[string]string) - } - obj.Annotations[ann] = value -} - -// HasLabel returns a bool if passed in label exists -func HasLabel(obj ObjectMeta, label string) bool { - _, found := obj.Labels[label] - return found -} - -// SetMetaDataLabel sets the label and value -func SetMetaDataLabel(obj *ObjectMeta, label string, value string) { - if obj.Labels == nil { - obj.Labels = make(map[string]string) - } - obj.Labels[label] = value -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/meta.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/meta.go deleted file mode 100644 index 3ad983183..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/meta.go +++ /dev/null @@ -1,101 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2016 The Kubernetes Authors. - -package v1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/types" -) - -func (meta *ListMeta) GetResourceVersion() string { return meta.ResourceVersion } -func (meta *ListMeta) SetResourceVersion(version string) { meta.ResourceVersion = version } -func (meta *ListMeta) GetSelfLink() string { panic("ListMeta - GetSelfLink() not implemented") } -func (meta *ListMeta) SetSelfLink(_ string) { panic("ListMeta - SetSelfLink() not implemented") } -func (meta *ListMeta) GetContinue() string { return meta.Continue } -func (meta *ListMeta) SetContinue(c string) { meta.Continue = c } -func (meta *ListMeta) GetRemainingItemCount() *int64 { return meta.RemainingItemCount } -func (meta *ListMeta) SetRemainingItemCount(c *int64) { meta.RemainingItemCount = c } - -func (obj *TypeMeta) GetObjectKind() schema.ObjectKind { return obj } - -// SetGroupVersionKind satisfies the ObjectKind interface for all objects that embed TypeMeta -func (obj *TypeMeta) SetGroupVersionKind(gvk schema.GroupVersionKind) { - obj.APIVersion, obj.Kind = gvk.ToAPIVersionAndKind() -} - -// GroupVersionKind satisfies the ObjectKind interface for all objects that embed TypeMeta -func (obj *TypeMeta) GroupVersionKind() schema.GroupVersionKind { - return schema.FromAPIVersionAndKind(obj.APIVersion, obj.Kind) -} - -func (obj *ListMeta) GetListMeta() metav1.ListInterface { return obj } - -func (obj *ObjectMeta) GetObjectMeta() metav1.Object { return obj } - -// Namespace implements metav1.Object for any object with an ObjectMeta typed field. Allows -// fast, direct access to metadata fields for API objects. -func (meta *ObjectMeta) GetNamespace() string { return meta.Namespace } -func (meta *ObjectMeta) SetNamespace(namespace string) { meta.Namespace = namespace } -func (meta *ObjectMeta) GetName() string { return meta.Name } -func (meta *ObjectMeta) SetName(name string) { meta.Name = name } -func (meta *ObjectMeta) GetGenerateName() string { return meta.GenerateName } -func (meta *ObjectMeta) SetGenerateName(generateName string) { meta.GenerateName = generateName } -func (meta *ObjectMeta) GetUID() types.UID { return meta.UID } -func (meta *ObjectMeta) SetUID(uid types.UID) { meta.UID = uid } -func (meta *ObjectMeta) GetResourceVersion() string { return meta.ResourceVersion } -func (meta *ObjectMeta) SetResourceVersion(version string) { meta.ResourceVersion = version } -func (meta *ObjectMeta) GetGeneration() int64 { panic("ObjectMeta - GetGeneration() not implemented") } -func (meta *ObjectMeta) SetGeneration(_ int64) { panic("ObjectMeta - SetGeneration() not implemented") } -func (meta *ObjectMeta) GetSelfLink() string { panic("ObjectMeta - GetSelfLink() not implemented") } -func (meta *ObjectMeta) SetSelfLink(_ string) { - panic("ObjectMeta - SetSelfLink() not implemented") -} -func (meta *ObjectMeta) GetCreationTimestamp() metav1.Time { - panic("ObjectMeta - GetCreationTimestamp() not implemented") -} -func (meta *ObjectMeta) SetCreationTimestamp(_ metav1.Time) { - panic("ObjectMeta - SetCreationTimestamp() not implemented") -} -func (meta *ObjectMeta) GetDeletionTimestamp() *metav1.Time { - if meta.DeletionTimestamp == nil { - return nil - } - return &metav1.Time{ - Time: meta.DeletionTimestamp.Time, - } -} -func (meta *ObjectMeta) SetDeletionTimestamp(_ *metav1.Time) { - panic("ObjectMeta - SetDeletionTimestamp() not implemented") -} -func (meta *ObjectMeta) GetDeletionGracePeriodSeconds() *int64 { - panic("ObjectMeta - GetDeletionGracePeriodSeconds() not implemented") -} -func (meta *ObjectMeta) SetDeletionGracePeriodSeconds(_ *int64) { - panic("ObjectMeta - SetDeletionGracePeriodSeconds() not implemented") -} -func (meta *ObjectMeta) GetLabels() map[string]string { return meta.Labels } -func (meta *ObjectMeta) SetLabels(labels map[string]string) { meta.Labels = labels } -func (meta *ObjectMeta) GetAnnotations() map[string]string { return meta.Annotations } -func (meta *ObjectMeta) SetAnnotations(annotations map[string]string) { meta.Annotations = annotations } -func (meta *ObjectMeta) GetFinalizers() []string { - panic("ObjectMeta - GetFinalizers() not implemented") -} -func (meta *ObjectMeta) SetFinalizers(_ []string) { - panic("ObjectMeta - SetFinalizers() not implemented") -} -func (meta *ObjectMeta) GetOwnerReferences() []metav1.OwnerReference { - return FullOwnerReferences(meta.OwnerReferences) -} -func (meta *ObjectMeta) SetOwnerReferences(references []metav1.OwnerReference) { - meta.OwnerReferences = SlimOwnerReferences(references) -} -func (meta *ObjectMeta) GetManagedFields() []metav1.ManagedFieldsEntry { - panic("ObjectMeta - GetManagedFields() not implemented") -} -func (meta *ObjectMeta) SetManagedFields(_ []metav1.ManagedFieldsEntry) { - panic("ObjectMeta - SetManagedFields() not implemented") -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/register.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/register.go deleted file mode 100644 index d323d5714..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/register.go +++ /dev/null @@ -1,76 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2014 The Kubernetes Authors. - -package v1 - -import ( - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" -) - -// GroupName is the group name for this API. -const GroupName = "meta.k8s.io" - -var ( - // localSchemeBuilder is used to make compiler happy for autogenerated - // conversions. However, it's not used. - schemeBuilder runtime.SchemeBuilder - localSchemeBuilder = &schemeBuilder -) - -// SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} - -// Unversioned is group version for unversioned API objects -// TODO: this should be v1 probably -var Unversioned = schema.GroupVersion{Group: "", Version: "v1"} - -// WatchEventKind is name reserved for serializing watch events. -const WatchEventKind = "WatchEvent" - -// Kind takes an unqualified kind and returns a Group qualified GroupKind -func Kind(kind string) schema.GroupKind { - return SchemeGroupVersion.WithKind(kind).GroupKind() -} - -// scheme is the registry for the common types that adhere to the meta v1 API spec. -var scheme = runtime.NewScheme() - -// ParameterCodec knows about query parameters used with the meta v1 API spec. -var ParameterCodec = runtime.NewParameterCodec(scheme) - -var optionsTypes = []runtime.Object{} - -// AddToGroupVersion registers common meta types into schemas. -func AddToGroupVersion(scheme *runtime.Scheme, groupVersion schema.GroupVersion) { - // Supports legacy code paths, most callers should use metav1.ParameterCodec for now - scheme.AddKnownTypes(groupVersion, optionsTypes...) - // Register Unversioned types under their own special group - scheme.AddUnversionedTypes(Unversioned) - - // register manually. This usually goes through the SchemeBuilder, which we cannot use here. - utilruntime.Must(RegisterConversions(scheme)) - utilruntime.Must(RegisterDefaults(scheme)) -} - -// AddMetaToScheme registers base meta types into schemas. -func AddMetaToScheme(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &PartialObjectMetadata{}, - &PartialObjectMetadataList{}, - ) - - return nil -} - -func init() { - scheme.AddUnversionedTypes(SchemeGroupVersion, optionsTypes...) - - utilruntime.Must(AddMetaToScheme(scheme)) - - // register manually. This usually goes through the SchemeBuilder, which we cannot use here. - utilruntime.Must(RegisterDefaults(scheme)) -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/time.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/time.go deleted file mode 100644 index 4fcf85afc..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/time.go +++ /dev/null @@ -1,184 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2014 The Kubernetes Authors. - -package v1 - -import ( - "encoding/json" - "time" -) - -// Time is a wrapper around time.Time which supports correct -// marshaling to YAML and JSON. Wrappers are provided for many -// of the factory methods that the time package offers. -// -// +protobuf.options.marshal=false -// +protobuf.as=Timestamp -// +protobuf.options.(gogoproto.goproto_stringer)=false -// -// +kubebuilder:validation:Format=date-time -// +kubebuilder:validation:Type=string -type Time struct { - time.Time `protobuf:"-" json:"-"` -} - -// DeepCopyInto creates a deep-copy of the Time value. The underlying time.Time -// type is effectively immutable in the time API, so it is safe to -// copy-by-assign, despite the presence of (unexported) Pointer fields. -func (t *Time) DeepCopyInto(out *Time) { - *out = *t -} - -func (in *Time) DeepEqual(other *Time) bool { - switch { - case (in == nil) != (other == nil): - return false - case (in == nil) && (other == nil): - return true - } - return in.Time.Equal(other.Time) -} - -// NewTime returns a wrapped instance of the provided time -func NewTime(time time.Time) Time { - return Time{time} -} - -// Date returns the Time corresponding to the supplied parameters -// by wrapping time.Date. -func Date(year int, month time.Month, day, hour, min, sec, nsec int, loc *time.Location) Time { - return Time{time.Date(year, month, day, hour, min, sec, nsec, loc)} -} - -// Now returns the current local time. -func Now() Time { - return Time{time.Now()} -} - -// IsZero returns true if the value is nil or time is zero. -func (t *Time) IsZero() bool { - if t == nil { - return true - } - return t.Time.IsZero() -} - -// Before reports whether the time instant t is before u. -func (t *Time) Before(u *Time) bool { - if t != nil && u != nil { - return t.Time.Before(u.Time) - } - return false -} - -// Equal reports whether the time instant t is equal to u. -func (t *Time) Equal(u *Time) bool { - if t == nil && u == nil { - return true - } - if t != nil && u != nil { - return t.Time.Equal(u.Time) - } - return false -} - -// Unix returns the local time corresponding to the given Unix time -// by wrapping time.Unix. -func Unix(sec int64, nsec int64) Time { - return Time{time.Unix(sec, nsec)} -} - -// Rfc3339Copy returns a copy of the Time at second-level precision. -func (t Time) Rfc3339Copy() Time { - copied, _ := time.Parse(time.RFC3339, t.Format(time.RFC3339)) - return Time{copied} -} - -// UnmarshalJSON implements the json.Unmarshaller interface. -func (t *Time) UnmarshalJSON(b []byte) error { - if len(b) == 4 && string(b) == "null" { - t.Time = time.Time{} - return nil - } - - var str string - err := json.Unmarshal(b, &str) - if err != nil { - return err - } - - pt, err := time.Parse(time.RFC3339, str) - if err != nil { - return err - } - - t.Time = pt.Local() - return nil -} - -// UnmarshalQueryParameter converts from a URL query parameter value to an object -func (t *Time) UnmarshalQueryParameter(str string) error { - if len(str) == 0 { - t.Time = time.Time{} - return nil - } - // Tolerate requests from older clients that used JSON serialization to build query params - if len(str) == 4 && str == "null" { - t.Time = time.Time{} - return nil - } - - pt, err := time.Parse(time.RFC3339, str) - if err != nil { - return err - } - - t.Time = pt.Local() - return nil -} - -// MarshalJSON implements the json.Marshaler interface. -func (t Time) MarshalJSON() ([]byte, error) { - if t.IsZero() { - // Encode unset/nil objects as JSON's "null". - return []byte("null"), nil - } - buf := make([]byte, 0, len(time.RFC3339)+2) - buf = append(buf, '"') - // time cannot contain non escapable JSON characters - buf = t.UTC().AppendFormat(buf, time.RFC3339) - buf = append(buf, '"') - return buf, nil -} - -// ToUnstructured implements the value.UnstructuredConverter interface. -func (t Time) ToUnstructured() interface{} { - if t.IsZero() { - return nil - } - buf := make([]byte, 0, len(time.RFC3339)) - buf = t.UTC().AppendFormat(buf, time.RFC3339) - return string(buf) -} - -// OpenAPISchemaType is used by the kube-openapi generator when constructing -// the OpenAPI spec of this type. -// -// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators -func (_ Time) OpenAPISchemaType() []string { return []string{"string"} } - -// OpenAPISchemaFormat is used by the kube-openapi generator when constructing -// the OpenAPI spec of this type. -func (_ Time) OpenAPISchemaFormat() string { return "date-time" } - -// MarshalQueryParameter converts to a URL query parameter value -func (t Time) MarshalQueryParameter() (string, error) { - if t.IsZero() { - // Encode unset/nil objects as an empty string - return "", nil - } - - return t.UTC().Format(time.RFC3339), nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/time_proto.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/time_proto.go deleted file mode 100644 index 475d2165a..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/time_proto.go +++ /dev/null @@ -1,89 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2015 The Kubernetes Authors. - -package v1 - -import ( - "time" -) - -// Timestamp is a struct that is equivalent to Time, but intended for -// protobuf marshalling/unmarshalling. It is generated into a serialization -// that matches Time. Do not use in Go structs. -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 `json:"seconds" protobuf:"varint,1,opt,name=seconds"` - // 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. This field may be limited in precision depending on context. - Nanos int32 `json:"nanos" protobuf:"varint,2,opt,name=nanos"` -} - -// Timestamp returns the Time as a new Timestamp value. -func (m *Time) ProtoTime() *Timestamp { - if m == nil { - return &Timestamp{} - } - return &Timestamp{ - Seconds: m.Time.Unix(), - // leaving this here for the record. our JSON only handled seconds, so this results in writes by - // protobuf clients storing values that aren't read by json clients, which results in unexpected - // field mutation, which fails various validation and equality code. - // Nanos: int32(m.Time.Nanosecond()), - } -} - -// Size implements the protobuf marshalling interface. -func (m *Time) Size() (n int) { - if m == nil || m.Time.IsZero() { - return 0 - } - return m.ProtoTime().Size() -} - -// Reset implements the protobuf marshalling interface. -func (m *Time) Unmarshal(data []byte) error { - if len(data) == 0 { - m.Time = time.Time{} - return nil - } - p := Timestamp{} - if err := p.Unmarshal(data); err != nil { - return err - } - // leaving this here for the record. our JSON only handled seconds, so this results in writes by - // protobuf clients storing values that aren't read by json clients, which results in unexpected - // field mutation, which fails various validation and equality code. - // m.Time = time.Unix(p.Seconds, int64(p.Nanos)).Local() - m.Time = time.Unix(p.Seconds, int64(0)).Local() - return nil -} - -// Marshal implements the protobuf marshaling interface. -func (m *Time) Marshal() (data []byte, err error) { - if m == nil || m.Time.IsZero() { - return nil, nil - } - return m.ProtoTime().Marshal() -} - -// MarshalTo implements the protobuf marshaling interface. -func (m *Time) MarshalTo(data []byte) (int, error) { - if m == nil || m.Time.IsZero() { - return 0, nil - } - return m.ProtoTime().MarshalTo(data) -} - -// MarshalToSizedBuffer implements the protobuf reverse marshaling interface. -func (m *Time) MarshalToSizedBuffer(data []byte) (int, error) { - if m == nil || m.Time.IsZero() { - return 0, nil - } - return m.ProtoTime().MarshalToSizedBuffer(data) -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/types.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/types.go deleted file mode 100644 index d3dea84cc..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/types.go +++ /dev/null @@ -1,412 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2015 The Kubernetes Authors. - -// Package v1 contains API types that are common to all versions. -// -// The package contains two categories of types: -// - external (serialized) types that lack their own version (e.g TypeMeta) -// - internal (never-serialized) types that are needed by several different -// api groups, and so live here, to avoid duplication and/or import loops -// (e.g. LabelSelector). -// -// In the future, we will probably move these categories of objects into -// separate packages. -package v1 - -import ( - "k8s.io/apimachinery/pkg/types" -) - -// TypeMeta describes an individual object in an API response or request -// with strings representing the type of the object and its API schema version. -// Structures that are versioned or persisted should inline TypeMeta. -// -// +k8s:deepcopy-gen=false -type TypeMeta struct { - // Kind is a string value representing the REST resource this object represents. - // Servers may infer this from the endpoint the client submits requests to. - // Cannot be updated. - // In CamelCase. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - // +optional - Kind string `json:"kind,omitempty" protobuf:"bytes,1,opt,name=kind"` - - // APIVersion defines the versioned schema of this representation of an object. - // Servers should convert recognized schemas to the latest internal value, and - // may reject unrecognized values. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - // +optional - APIVersion string `json:"apiVersion,omitempty" protobuf:"bytes,2,opt,name=apiVersion"` -} - -// ListMeta describes metadata that synthetic resources must have, including lists and -// various status objects. A resource may have only one of {ObjectMeta, ListMeta}. -type ListMeta struct { - // String that identifies the server's internal version of this object that - // can be used by clients to determine when objects have changed. - // Value must be treated as opaque by clients and passed unmodified back to the server. - // Populated by the system. - // Read-only. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency - // +optional - ResourceVersion string `json:"resourceVersion,omitempty" protobuf:"bytes,2,opt,name=resourceVersion"` - - // continue may be set if the user set a limit on the number of items returned, and indicates that - // the server has more data available. The value is opaque and may be used to issue another request - // to the endpoint that served this list to retrieve the next set of available objects. Continuing a - // consistent list may not be possible if the server configuration has changed or more than a few - // minutes have passed. The resourceVersion field returned when using this continue value will be - // identical to the value in the first response, unless you have received this token from an error - // message. - Continue string `json:"continue,omitempty" protobuf:"bytes,3,opt,name=continue"` - - // remainingItemCount is the number of subsequent items in the list which are not included in this - // list response. If the list request contained label or field selectors, then the number of - // remaining items is unknown and the field will be left unset and omitted during serialization. - // If the list is complete (either because it is not chunking or because this is the last chunk), - // then there are no more remaining items and this field will be left unset and omitted during - // serialization. - // Servers older than v1.15 do not set this field. - // The intended use of the remainingItemCount is *estimating* the size of a collection. Clients - // should not rely on the remainingItemCount to be set or to be exact. - // +optional - RemainingItemCount *int64 `json:"remainingItemCount,omitempty" protobuf:"bytes,4,opt,name=remainingItemCount"` -} - -// Field path constants that are specific to the internal API -// representation. -const ( - ObjectNameField = "metadata.name" -) - -// These are internal finalizer values for Kubernetes-like APIs, must be qualified name unless defined here -const ( - FinalizerOrphanDependents = "orphan" - FinalizerDeleteDependents = "foregroundDeletion" -) - -// ObjectMeta is metadata that all persisted resources must have, which includes all objects -// users must create. -type ObjectMeta struct { - // Name must be unique within a namespace. Is required when creating resources, although - // some resources may allow a client to request the generation of an appropriate name - // automatically. Name is primarily intended for creation idempotence and configuration - // definition. - // Cannot be updated. - // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names - // +optional - Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"` - - // GenerateName is an optional prefix, used by the server, to generate a unique - // name ONLY IF the Name field has not been provided. - // If this field is used, the name returned to the client will be different - // than the name passed. This value will also be combined with a unique suffix. - // The provided value has the same validation rules as the Name field, - // and may be truncated by the length of the suffix required to make the value - // unique on the server. - // - // If this field is specified and the generated name exists, the server will return a 409. - // - // Applied only if Name is not specified. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency - // +optional - GenerateName string `json:"generateName,omitempty" protobuf:"bytes,2,opt,name=generateName"` - - // Namespace defines the space within which each name must be unique. An empty namespace is - // equivalent to the "default" namespace, but "default" is the canonical representation. - // Not all objects are required to be scoped to a namespace - the value of this field for - // those objects will be empty. - // - // Must be a DNS_LABEL. - // Cannot be updated. - // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces - // +optional - Namespace string `json:"namespace,omitempty" protobuf:"bytes,3,opt,name=namespace"` - - // UID is the unique in time and space value for this object. It is typically generated by - // the server on successful creation of a resource and is not allowed to change on PUT - // operations. - // - // Populated by the system. - // Read-only. - // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids - // +optional - UID types.UID `json:"uid,omitempty" protobuf:"bytes,5,opt,name=uid,casttype=k8s.io/kubernetes/pkg/types.UID"` - - // An opaque value that represents the internal version of this object that can - // be used by clients to determine when objects have changed. May be used for optimistic - // concurrency, change detection, and the watch operation on a resource or set of resources. - // Clients must treat these values as opaque and passed unmodified back to the server. - // They may only be valid for a particular resource or set of resources. - // - // Populated by the system. - // Read-only. - // Value must be treated as opaque by clients and . - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency - // +optional - // +deepequal-gen=false - ResourceVersion string `json:"resourceVersion,omitempty" protobuf:"bytes,6,opt,name=resourceVersion"` - - // A sequence number representing a specific generation of the desired state. - // Populated by the system. Read-only. - // +optional - Generation int64 `json:"generation,omitempty" protobuf:"varint,7,opt,name=generation"` - - // DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This - // field is set by the server when a graceful deletion is requested by the user, and is not - // directly settable by a client. The resource is expected to be deleted (no longer visible - // from resource lists, and not reachable by name) after the time in this field, once the - // finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. - // Once the deletionTimestamp is set, this value may not be unset or be set further into the - // future, although it may be shortened or the resource may be deleted prior to this time. - // For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react - // by sending a graceful termination signal to the containers in the pod. After that 30 seconds, - // the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, - // remove the pod from the API. In the presence of network partitions, this object may still - // exist after this timestamp, until an administrator or automated process can determine the - // resource is fully terminated. - // If not set, graceful deletion of the object has not been requested. - // - // Populated by the system when a graceful deletion is requested. - // Read-only. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - DeletionTimestamp *Time `json:"deletionTimestamp,omitempty" protobuf:"bytes,9,opt,name=deletionTimestamp"` - - // Map of string keys and values that can be used to organize and categorize - // (scope and select) objects. May match selectors of replication controllers - // and services. - // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels - // +optional - Labels map[string]string `json:"labels,omitempty" protobuf:"bytes,11,rep,name=labels"` - - // Annotations is an unstructured key value map stored with a resource that may be - // set by external tools to store and retrieve arbitrary metadata. They are not - // queryable and should be preserved when modifying objects. - // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations - // +optional - Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,12,rep,name=annotations"` - - // List of objects depended by this object. If ALL objects in the list have - // been deleted, this object will be garbage collected. If this object is managed by a controller, - // then an entry in this list will point to this controller, with the controller field set to true. - // There cannot be more than one managing controller. - // +optional - // +patchMergeKey=uid - // +patchStrategy=merge - // +listType=map - // +listMapKey=uid - OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" patchStrategy:"merge" patchMergeKey:"uid" protobuf:"bytes,13,rep,name=ownerReferences"` -} - -const ( - // NamespaceDefault means the object is in the default namespace which is applied when not specified by clients - NamespaceDefault = "default" - // NamespaceAll is the default argument to specify on a context when you want to list or filter resources across all namespaces - NamespaceAll = "" - // NamespaceNone is the argument for a context when there is no namespace. - NamespaceNone = "" - // NamespaceSystem is the system namespace where we place system components. - NamespaceSystem = "kube-system" - // NamespacePublic is the namespace where we place public info (ConfigMaps) - NamespacePublic = "kube-public" -) - -// OwnerReference contains enough information to let you identify an owning -// object. An owning object must be in the same namespace as the dependent, or -// be cluster-scoped, so there is no namespace field. -// +structType=atomic -type OwnerReference struct { - // API version of the referent. - APIVersion string `json:"apiVersion" protobuf:"bytes,5,opt,name=apiVersion"` - // Kind of the referent. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - Kind string `json:"kind" protobuf:"bytes,1,opt,name=kind"` - // Name of the referent. - // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names - Name string `json:"name" protobuf:"bytes,3,opt,name=name"` - // UID of the referent. - // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids - UID types.UID `json:"uid" protobuf:"bytes,4,opt,name=uid,casttype=k8s.io/apimachinery/pkg/types.UID"` - // If true, this reference points to the managing controller. - // +optional - Controller *bool `json:"controller,omitempty" protobuf:"varint,6,opt,name=controller"` -} - -const ( - // FieldValidationIgnore ignores unknown/duplicate fields - FieldValidationIgnore = "Ignore" - // FieldValidationWarn responds with a warning, but successfully serve the request - FieldValidationWarn = "Warn" - // FieldValidationStrict fails the request on unknown/duplicate fields - FieldValidationStrict = "Strict" -) - -// TODO: remove me when watch is refactored -func LabelSelectorQueryParam(version string) string { - return "labelSelector" -} - -// TODO: remove me when watch is refactored -func FieldSelectorQueryParam(version string) string { - return "fieldSelector" -} - -// Note: -// There are two different styles of label selectors used in versioned types: -// an older style which is represented as just a string in versioned types, and a -// newer style that is structured. LabelSelector is an internal representation for the -// latter style. - -// A label selector is a label query over a set of resources. The result of matchLabels and -// matchExpressions are ANDed. An empty label selector matches all objects. A null -// label selector matches no objects. -// +structType=atomic -type LabelSelector struct { - // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - // map is equivalent to an element of matchExpressions, whose key field is "key", the - // operator is "In", and the values array contains only "value". The requirements are ANDed. - // - // +kubebuilder:validation:Optional - MatchLabels map[string]MatchLabelsValue `json:"matchLabels,omitempty" protobuf:"bytes,1,rep,name=matchLabels"` - // matchExpressions is a list of label selector requirements. The requirements are ANDed. - // +kubebuilder:validation:Optional - // +listType=atomic - MatchExpressions []LabelSelectorRequirement `json:"matchExpressions,omitempty" protobuf:"bytes,2,rep,name=matchExpressions"` -} - -// MatchLabelsValue represents the value from the MatchLabels {key,value} pair. -// -// +kubebuilder:validation:MaxLength=63 -// +kubebuilder:validation:Pattern=`^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$` -type MatchLabelsValue = string - -// A label selector requirement is a selector that contains values, a key, and an operator that -// relates the key and values. -type LabelSelectorRequirement struct { - // key is the label key that the selector applies to. - Key string `json:"key" protobuf:"bytes,1,opt,name=key"` - // operator represents a key's relationship to a set of values. - // Valid operators are In, NotIn, Exists and DoesNotExist. - // - // +kubebuilder:validation:Enum=In;NotIn;Exists;DoesNotExist - Operator LabelSelectorOperator `json:"operator" protobuf:"bytes,2,opt,name=operator,casttype=LabelSelectorOperator"` - // values is an array of string values. If the operator is In or NotIn, - // the values array must be non-empty. If the operator is Exists or DoesNotExist, - // the values array must be empty. This array is replaced during a strategic - // merge patch. - // +kubebuilder:validation:Optional - // +listType=atomic - Values []string `json:"values,omitempty" protobuf:"bytes,3,rep,name=values"` -} - -// A label selector operator is the set of operators that can be used in a selector requirement. -type LabelSelectorOperator string - -const ( - LabelSelectorOpIn LabelSelectorOperator = "In" - LabelSelectorOpNotIn LabelSelectorOperator = "NotIn" - LabelSelectorOpExists LabelSelectorOperator = "Exists" - LabelSelectorOpDoesNotExist LabelSelectorOperator = "DoesNotExist" -) - -type ConditionStatus string - -// These are valid condition statuses. "ConditionTrue" means a resource is in the condition. -// "ConditionFalse" means a resource is not in the condition. "ConditionUnknown" means kubernetes -// can't decide if a resource is in the condition or not. In the future, we could add other -// intermediate conditions, e.g. ConditionDegraded. -const ( - ConditionTrue ConditionStatus = "True" - ConditionFalse ConditionStatus = "False" - ConditionUnknown ConditionStatus = "Unknown" -) - -// PartialObjectMetadata is a generic representation of any object with ObjectMeta. It allows clients -// to get access to a particular ObjectMeta schema without knowing the details of the version. -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type PartialObjectMetadata struct { - TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` -} - -// PartialObjectMetadataList contains a list of objects containing only their metadata -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type PartialObjectMetadataList struct { - TypeMeta `json:",inline"` - // Standard list metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - // +optional - ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // items contains each of the included items. - Items []PartialObjectMetadata `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// Condition contains details for one aspect of the current state of this API Resource. -// --- -// This struct is intended for direct use as an array at the field path .status.conditions. For example, -// -// type FooStatus struct{ -// // Represents the observations of a foo's current state. -// // Known .status.conditions.type are: "Available", "Progressing", and "Degraded" -// // +patchMergeKey=type -// // +patchStrategy=merge -// // +listType=map -// // +listMapKey=type -// Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` -// -// // other fields -// } -type Condition struct { - // type of condition in CamelCase or in foo.example.com/CamelCase. - // --- - // Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - // useful (see .node.status.conditions), the ability to deconflict is important. - // The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - // +required - // +kubebuilder:validation:Required - // +kubebuilder:validation:Pattern=`^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$` - // +kubebuilder:validation:MaxLength=316 - Type string `json:"type" protobuf:"bytes,1,opt,name=type"` - // status of the condition, one of True, False, Unknown. - // +required - // +kubebuilder:validation:Required - // +kubebuilder:validation:Enum=True;False;Unknown - Status ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status"` - // observedGeneration represents the .metadata.generation that the condition was set based upon. - // For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date - // with respect to the current state of the instance. - // +optional - // +kubebuilder:validation:Minimum=0 - ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,3,opt,name=observedGeneration"` - // lastTransitionTime is the last time the condition transitioned from one status to another. - // This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. - // +required - // +kubebuilder:validation:Required - // +kubebuilder:validation:Type=string - // +kubebuilder:validation:Format=date-time - LastTransitionTime Time `json:"lastTransitionTime" protobuf:"bytes,4,opt,name=lastTransitionTime"` - // reason contains a programmatic identifier indicating the reason for the condition's last transition. - // Producers of specific condition types may define expected values and meanings for this field, - // and whether the values are considered a guaranteed API. - // The value should be a CamelCase string. - // This field may not be empty. - // +required - // +kubebuilder:validation:Required - // +kubebuilder:validation:MaxLength=1024 - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:Pattern=`^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$` - Reason string `json:"reason" protobuf:"bytes,5,opt,name=reason"` - // message is a human readable message indicating details about the transition. - // This may be an empty string. - // +required - // +kubebuilder:validation:Required - // +kubebuilder:validation:MaxLength=32768 - Message string `json:"message" protobuf:"bytes,6,opt,name=message"` -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/validation/validation.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/validation/validation.go deleted file mode 100644 index 2f9f12b67..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/validation/validation.go +++ /dev/null @@ -1,214 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2015 The Kubernetes Authors. - -package validation - -import ( - "fmt" - "regexp" - "unicode" - - "k8s.io/apimachinery/pkg/util/sets" - "k8s.io/apimachinery/pkg/util/validation" - "k8s.io/apimachinery/pkg/util/validation/field" - - slim_metav1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" -) - -// LabelSelectorValidationOptions is a struct that can be passed to ValidateLabelSelector to record the validate options -type LabelSelectorValidationOptions struct { - // Allow invalid label value in selector - AllowInvalidLabelValueInSelector bool -} - -// LabelSelectorHasInvalidLabelValue returns true if the given selector contains an invalid label value in a match expression. -// This is useful for determining whether AllowInvalidLabelValueInSelector should be set to true when validating an update -// based on existing persisted invalid values. -func LabelSelectorHasInvalidLabelValue(ps *slim_metav1.LabelSelector) bool { - if ps == nil { - return false - } - for _, e := range ps.MatchExpressions { - for _, v := range e.Values { - if len(validation.IsValidLabelValue(v)) > 0 { - return true - } - } - } - return false -} - -// ValidateLabelSelector validate the LabelSelector according to the opts and returns any validation errors. -// opts.AllowInvalidLabelValueInSelector is only expected to be set to true when required for backwards compatibility with existing invalid data. -func ValidateLabelSelector(ps *slim_metav1.LabelSelector, opts LabelSelectorValidationOptions, fldPath *field.Path) field.ErrorList { - allErrs := field.ErrorList{} - if ps == nil { - return allErrs - } - allErrs = append(allErrs, ValidateLabels(ps.MatchLabels, fldPath.Child("matchLabels"))...) - for i, expr := range ps.MatchExpressions { - allErrs = append(allErrs, ValidateLabelSelectorRequirement(expr, opts, fldPath.Child("matchExpressions").Index(i))...) - } - return allErrs -} - -// ValidateLabelSelectorRequirement validate the requirement according to the opts and returns any validation errors. -// opts.AllowInvalidLabelValueInSelector is only expected to be set to true when required for backwards compatibility with existing invalid data. -func ValidateLabelSelectorRequirement(sr slim_metav1.LabelSelectorRequirement, opts LabelSelectorValidationOptions, fldPath *field.Path) field.ErrorList { - allErrs := field.ErrorList{} - switch sr.Operator { - case slim_metav1.LabelSelectorOpIn, slim_metav1.LabelSelectorOpNotIn: - if len(sr.Values) == 0 { - allErrs = append(allErrs, field.Required(fldPath.Child("values"), "must be specified when `operator` is 'In' or 'NotIn'")) - } - case slim_metav1.LabelSelectorOpExists, slim_metav1.LabelSelectorOpDoesNotExist: - if len(sr.Values) > 0 { - allErrs = append(allErrs, field.Forbidden(fldPath.Child("values"), "may not be specified when `operator` is 'Exists' or 'DoesNotExist'")) - } - default: - allErrs = append(allErrs, field.Invalid(fldPath.Child("operator"), sr.Operator, "not a valid selector operator")) - } - allErrs = append(allErrs, ValidateLabelName(sr.Key, fldPath.Child("key"))...) - if !opts.AllowInvalidLabelValueInSelector { - for valueIndex, value := range sr.Values { - for _, msg := range validation.IsValidLabelValue(value) { - allErrs = append(allErrs, field.Invalid(fldPath.Child("values").Index(valueIndex), value, msg)) - } - } - } - return allErrs -} - -// ValidateLabelName validates that the label name is correctly defined. -func ValidateLabelName(labelName string, fldPath *field.Path) field.ErrorList { - allErrs := field.ErrorList{} - for _, msg := range validation.IsQualifiedName(labelName) { - allErrs = append(allErrs, field.Invalid(fldPath, labelName, msg)) - } - return allErrs -} - -// ValidateLabels validates that a set of labels are correctly defined. -func ValidateLabels(labels map[string]string, fldPath *field.Path) field.ErrorList { - allErrs := field.ErrorList{} - for k, v := range labels { - allErrs = append(allErrs, ValidateLabelName(k, fldPath)...) - for _, msg := range validation.IsValidLabelValue(v) { - allErrs = append(allErrs, field.Invalid(fldPath, v, msg)) - } - } - return allErrs -} - -var FieldManagerMaxLength = 128 - -// ValidateFieldManager valides that the fieldManager is the proper length and -// only has printable characters. -func ValidateFieldManager(fieldManager string, fldPath *field.Path) field.ErrorList { - allErrs := field.ErrorList{} - // the field can not be set as a `*string`, so a empty string ("") is - // considered as not set and is defaulted by the rest of the process - // (unless apply is used, in which case it is required). - if len(fieldManager) > FieldManagerMaxLength { - allErrs = append(allErrs, field.TooLong(fldPath, fieldManager, FieldManagerMaxLength)) - } - // Verify that all characters are printable. - for i, r := range fieldManager { - if !unicode.IsPrint(r) { - allErrs = append(allErrs, field.Invalid(fldPath, fieldManager, fmt.Sprintf("invalid character %#U (at position %d)", r, i))) - } - } - - return allErrs -} - -var allowedFieldValidationValues = sets.NewString("", slim_metav1.FieldValidationIgnore, slim_metav1.FieldValidationWarn, slim_metav1.FieldValidationStrict) - -// ValidateFieldValidation validates that a fieldValidation query param only contains allowed values. -func ValidateFieldValidation(fldPath *field.Path, fieldValidation string) field.ErrorList { - allErrs := field.ErrorList{} - if !allowedFieldValidationValues.Has(fieldValidation) { - allErrs = append(allErrs, field.NotSupported(fldPath, fieldValidation, allowedFieldValidationValues.List())) - } - return allErrs - -} - -const MaxSubresourceNameLength = 256 - -func ValidateConditions(conditions []slim_metav1.Condition, fldPath *field.Path) field.ErrorList { - var allErrs field.ErrorList - - conditionTypeToFirstIndex := map[string]int{} - for i, condition := range conditions { - if _, ok := conditionTypeToFirstIndex[condition.Type]; ok { - allErrs = append(allErrs, field.Duplicate(fldPath.Index(i).Child("type"), condition.Type)) - } else { - conditionTypeToFirstIndex[condition.Type] = i - } - - allErrs = append(allErrs, ValidateCondition(condition, fldPath.Index(i))...) - } - - return allErrs -} - -// validConditionStatuses is used internally to check validity and provide a good message -var validConditionStatuses = sets.NewString(string(slim_metav1.ConditionTrue), string(slim_metav1.ConditionFalse), string(slim_metav1.ConditionUnknown)) - -const ( - maxReasonLen = 1 * 1024 - maxMessageLen = 32 * 1024 -) - -func ValidateCondition(condition slim_metav1.Condition, fldPath *field.Path) field.ErrorList { - var allErrs field.ErrorList - - // type is set and is a valid format - allErrs = append(allErrs, ValidateLabelName(condition.Type, fldPath.Child("type"))...) - - // status is set and is an accepted value - if !validConditionStatuses.Has(string(condition.Status)) { - allErrs = append(allErrs, field.NotSupported(fldPath.Child("status"), condition.Status, validConditionStatuses.List())) - } - - if condition.ObservedGeneration < 0 { - allErrs = append(allErrs, field.Invalid(fldPath.Child("observedGeneration"), condition.ObservedGeneration, "must be greater than or equal to zero")) - } - - if condition.LastTransitionTime.IsZero() { - allErrs = append(allErrs, field.Required(fldPath.Child("lastTransitionTime"), "must be set")) - } - - if len(condition.Reason) == 0 { - allErrs = append(allErrs, field.Required(fldPath.Child("reason"), "must be set")) - } else { - for _, currErr := range isValidConditionReason(condition.Reason) { - allErrs = append(allErrs, field.Invalid(fldPath.Child("reason"), condition.Reason, currErr)) - } - if len(condition.Reason) > maxReasonLen { - allErrs = append(allErrs, field.TooLong(fldPath.Child("reason"), condition.Reason, maxReasonLen)) - } - } - - if len(condition.Message) > maxMessageLen { - allErrs = append(allErrs, field.TooLong(fldPath.Child("message"), condition.Message, maxMessageLen)) - } - - return allErrs -} - -const conditionReasonFmt string = "[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?" -const conditionReasonErrMsg string = "a condition reason must start with alphabetic character, optionally followed by a string of alphanumeric characters or '_,:', and must end with an alphanumeric character or '_'" - -var conditionReasonRegexp = regexp.MustCompile("^" + conditionReasonFmt + "$") - -// isValidConditionReason tests for a string that conforms to rules for condition reasons. This checks the format, but not the length. -func isValidConditionReason(value string) []string { - if !conditionReasonRegexp.MatchString(value) { - return []string{validation.RegexError(conditionReasonErrMsg, conditionReasonFmt, "my_name", "MY_NAME", "MyName", "ReasonA,ReasonB", "ReasonA:ReasonB")} - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/zz_generated.conversion.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/zz_generated.conversion.go deleted file mode 100644 index e475040a2..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/zz_generated.conversion.go +++ /dev/null @@ -1,23 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by conversion-gen. DO NOT EDIT. - -package v1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -func init() { - localSchemeBuilder.Register(RegisterConversions) -} - -// RegisterConversions adds conversion functions to the given scheme. -// Public to allow building arbitrary schemes. -func RegisterConversions(s *runtime.Scheme) error { - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/zz_generated.deepcopy.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/zz_generated.deepcopy.go deleted file mode 100644 index 9d8d1ce21..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/zz_generated.deepcopy.go +++ /dev/null @@ -1,249 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Condition) DeepCopyInto(out *Condition) { - *out = *in - in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition. -func (in *Condition) DeepCopy() *Condition { - if in == nil { - return nil - } - out := new(Condition) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LabelSelector) DeepCopyInto(out *LabelSelector) { - *out = *in - if in.MatchLabels != nil { - in, out := &in.MatchLabels, &out.MatchLabels - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.MatchExpressions != nil { - in, out := &in.MatchExpressions, &out.MatchExpressions - *out = make([]LabelSelectorRequirement, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LabelSelector. -func (in *LabelSelector) DeepCopy() *LabelSelector { - if in == nil { - return nil - } - out := new(LabelSelector) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LabelSelectorRequirement) DeepCopyInto(out *LabelSelectorRequirement) { - *out = *in - if in.Values != nil { - in, out := &in.Values, &out.Values - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LabelSelectorRequirement. -func (in *LabelSelectorRequirement) DeepCopy() *LabelSelectorRequirement { - if in == nil { - return nil - } - out := new(LabelSelectorRequirement) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ListMeta) DeepCopyInto(out *ListMeta) { - *out = *in - if in.RemainingItemCount != nil { - in, out := &in.RemainingItemCount, &out.RemainingItemCount - *out = new(int64) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ListMeta. -func (in *ListMeta) DeepCopy() *ListMeta { - if in == nil { - return nil - } - out := new(ListMeta) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ObjectMeta) DeepCopyInto(out *ObjectMeta) { - *out = *in - if in.DeletionTimestamp != nil { - in, out := &in.DeletionTimestamp, &out.DeletionTimestamp - *out = (*in).DeepCopy() - } - if in.Labels != nil { - in, out := &in.Labels, &out.Labels - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.Annotations != nil { - in, out := &in.Annotations, &out.Annotations - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.OwnerReferences != nil { - in, out := &in.OwnerReferences, &out.OwnerReferences - *out = make([]OwnerReference, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectMeta. -func (in *ObjectMeta) DeepCopy() *ObjectMeta { - if in == nil { - return nil - } - out := new(ObjectMeta) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OwnerReference) DeepCopyInto(out *OwnerReference) { - *out = *in - if in.Controller != nil { - in, out := &in.Controller, &out.Controller - *out = new(bool) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OwnerReference. -func (in *OwnerReference) DeepCopy() *OwnerReference { - if in == nil { - return nil - } - out := new(OwnerReference) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PartialObjectMetadata) DeepCopyInto(out *PartialObjectMetadata) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartialObjectMetadata. -func (in *PartialObjectMetadata) DeepCopy() *PartialObjectMetadata { - if in == nil { - return nil - } - out := new(PartialObjectMetadata) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PartialObjectMetadata) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PartialObjectMetadataList) DeepCopyInto(out *PartialObjectMetadataList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]PartialObjectMetadata, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartialObjectMetadataList. -func (in *PartialObjectMetadataList) DeepCopy() *PartialObjectMetadataList { - if in == nil { - return nil - } - out := new(PartialObjectMetadataList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PartialObjectMetadataList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Time. -func (in *Time) DeepCopy() *Time { - if in == nil { - return nil - } - out := new(Time) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Timestamp) DeepCopyInto(out *Timestamp) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Timestamp. -func (in *Timestamp) DeepCopy() *Timestamp { - if in == nil { - return nil - } - out := new(Timestamp) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/zz_generated.deepequal.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/zz_generated.deepequal.go deleted file mode 100644 index 21c8be665..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/zz_generated.deepequal.go +++ /dev/null @@ -1,353 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepequal-gen. DO NOT EDIT. - -package v1 - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Condition) DeepEqual(other *Condition) bool { - if other == nil { - return false - } - - if in.Type != other.Type { - return false - } - if in.Status != other.Status { - return false - } - if in.ObservedGeneration != other.ObservedGeneration { - return false - } - if !in.LastTransitionTime.DeepEqual(&other.LastTransitionTime) { - return false - } - - if in.Reason != other.Reason { - return false - } - if in.Message != other.Message { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *LabelSelector) DeepEqual(other *LabelSelector) bool { - if other == nil { - return false - } - - if ((in.MatchLabels != nil) && (other.MatchLabels != nil)) || ((in.MatchLabels == nil) != (other.MatchLabels == nil)) { - in, other := &in.MatchLabels, &other.MatchLabels - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if inValue != otherValue { - return false - } - } - } - } - } - - if ((in.MatchExpressions != nil) && (other.MatchExpressions != nil)) || ((in.MatchExpressions == nil) != (other.MatchExpressions == nil)) { - in, other := &in.MatchExpressions, &other.MatchExpressions - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *LabelSelectorRequirement) DeepEqual(other *LabelSelectorRequirement) bool { - if other == nil { - return false - } - - if in.Key != other.Key { - return false - } - if in.Operator != other.Operator { - return false - } - if ((in.Values != nil) && (other.Values != nil)) || ((in.Values == nil) != (other.Values == nil)) { - in, other := &in.Values, &other.Values - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ListMeta) DeepEqual(other *ListMeta) bool { - if other == nil { - return false - } - - if in.ResourceVersion != other.ResourceVersion { - return false - } - if in.Continue != other.Continue { - return false - } - if (in.RemainingItemCount == nil) != (other.RemainingItemCount == nil) { - return false - } else if in.RemainingItemCount != nil { - if *in.RemainingItemCount != *other.RemainingItemCount { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ObjectMeta) DeepEqual(other *ObjectMeta) bool { - if other == nil { - return false - } - - if in.Name != other.Name { - return false - } - if in.GenerateName != other.GenerateName { - return false - } - if in.Namespace != other.Namespace { - return false - } - if in.UID != other.UID { - return false - } - if in.Generation != other.Generation { - return false - } - if (in.DeletionTimestamp == nil) != (other.DeletionTimestamp == nil) { - return false - } else if in.DeletionTimestamp != nil { - if !in.DeletionTimestamp.DeepEqual(other.DeletionTimestamp) { - return false - } - } - - if ((in.Labels != nil) && (other.Labels != nil)) || ((in.Labels == nil) != (other.Labels == nil)) { - in, other := &in.Labels, &other.Labels - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if inValue != otherValue { - return false - } - } - } - } - } - - if ((in.Annotations != nil) && (other.Annotations != nil)) || ((in.Annotations == nil) != (other.Annotations == nil)) { - in, other := &in.Annotations, &other.Annotations - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if inValue != otherValue { - return false - } - } - } - } - } - - if ((in.OwnerReferences != nil) && (other.OwnerReferences != nil)) || ((in.OwnerReferences == nil) != (other.OwnerReferences == nil)) { - in, other := &in.OwnerReferences, &other.OwnerReferences - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *OwnerReference) DeepEqual(other *OwnerReference) bool { - if other == nil { - return false - } - - if in.APIVersion != other.APIVersion { - return false - } - if in.Kind != other.Kind { - return false - } - if in.Name != other.Name { - return false - } - if in.UID != other.UID { - return false - } - if (in.Controller == nil) != (other.Controller == nil) { - return false - } else if in.Controller != nil { - if *in.Controller != *other.Controller { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PartialObjectMetadata) DeepEqual(other *PartialObjectMetadata) bool { - if other == nil { - return false - } - - if in.TypeMeta != other.TypeMeta { - return false - } - - if !in.ObjectMeta.DeepEqual(&other.ObjectMeta) { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PartialObjectMetadataList) DeepEqual(other *PartialObjectMetadataList) bool { - if other == nil { - return false - } - - if in.TypeMeta != other.TypeMeta { - return false - } - - if !in.ListMeta.DeepEqual(&other.ListMeta) { - return false - } - - if ((in.Items != nil) && (other.Items != nil)) || ((in.Items == nil) != (other.Items == nil)) { - in, other := &in.Items, &other.Items - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Timestamp) DeepEqual(other *Timestamp) bool { - if other == nil { - return false - } - - if in.Seconds != other.Seconds { - return false - } - if in.Nanos != other.Nanos { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *TypeMeta) DeepEqual(other *TypeMeta) bool { - if other == nil { - return false - } - - if in.Kind != other.Kind { - return false - } - if in.APIVersion != other.APIVersion { - return false - } - - return true -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/zz_generated.defaults.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/zz_generated.defaults.go deleted file mode 100644 index cd8143c7f..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/zz_generated.defaults.go +++ /dev/null @@ -1,20 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by defaulter-gen. DO NOT EDIT. - -package v1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// RegisterDefaults adds defaulters functions to the given scheme. -// Public to allow building arbitrary schemes. -// All generated defaulters are covering - they call all nested defaulters. -func RegisterDefaults(scheme *runtime.Scheme) error { - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1/doc.go deleted file mode 100644 index b55d23db5..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1/doc.go +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2017 The Kubernetes Authors. - -// +k8s:deepcopy-gen=package -// +k8s:openapi-gen=true -// +k8s:defaulter-gen=TypeMeta - -// +groupName=meta - -package v1beta1 diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1/generated.pb.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1/generated.pb.go deleted file mode 100644 index b419723c8..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1/generated.pb.go +++ /dev/null @@ -1,401 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1/generated.proto - -package v1beta1 - -import ( - fmt "fmt" - - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" - - io "io" - - proto "github.com/gogo/protobuf/proto" - - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" -) - -// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -func (m *PartialObjectMetadataList) Reset() { *m = PartialObjectMetadataList{} } -func (*PartialObjectMetadataList) ProtoMessage() {} -func (*PartialObjectMetadataList) Descriptor() ([]byte, []int) { - return fileDescriptor_1a84ae209524fd15, []int{0} -} -func (m *PartialObjectMetadataList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PartialObjectMetadataList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *PartialObjectMetadataList) XXX_Merge(src proto.Message) { - xxx_messageInfo_PartialObjectMetadataList.Merge(m, src) -} -func (m *PartialObjectMetadataList) XXX_Size() int { - return m.Size() -} -func (m *PartialObjectMetadataList) XXX_DiscardUnknown() { - xxx_messageInfo_PartialObjectMetadataList.DiscardUnknown(m) -} - -var xxx_messageInfo_PartialObjectMetadataList proto.InternalMessageInfo - -func init() { - proto.RegisterType((*PartialObjectMetadataList)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1beta1.PartialObjectMetadataList") -} - -func init() { - proto.RegisterFile("github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1/generated.proto", fileDescriptor_1a84ae209524fd15) -} - -var fileDescriptor_1a84ae209524fd15 = []byte{ - // 322 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x92, 0x3f, 0x4f, 0x02, 0x31, - 0x18, 0x87, 0xaf, 0x1a, 0x12, 0x72, 0xc4, 0xc4, 0x30, 0x21, 0x43, 0x21, 0x4e, 0x2c, 0xb6, 0x81, - 0xc1, 0x90, 0xb0, 0x18, 0x06, 0x13, 0xa3, 0x44, 0xc3, 0xe8, 0xf6, 0xde, 0x51, 0x8f, 0x7a, 0xf4, - 0xee, 0x72, 0x7d, 0xcf, 0xc4, 0xcd, 0x8f, 0xe0, 0xc7, 0x62, 0x64, 0x64, 0x22, 0x52, 0x3f, 0x88, - 0xa6, 0xe5, 0x40, 0x43, 0x9c, 0x70, 0x7a, 0xff, 0xa4, 0x79, 0x9e, 0x5f, 0x9b, 0xfa, 0xb7, 0x91, - 0xc4, 0x69, 0x11, 0xb0, 0x30, 0x55, 0x3c, 0x94, 0x33, 0x59, 0xec, 0x4a, 0x16, 0x47, 0x3c, 0xee, - 0x6b, 0xae, 0x67, 0x52, 0xb9, 0x06, 0x32, 0xa9, 0xb9, 0x12, 0x08, 0xfc, 0xa5, 0x1b, 0x08, 0x84, - 0x2e, 0x8f, 0x44, 0x22, 0x72, 0x40, 0x31, 0x61, 0x59, 0x9e, 0x62, 0x5a, 0x1f, 0xfc, 0xc0, 0xd8, - 0x86, 0xb2, 0x2d, 0x59, 0x1c, 0xb1, 0xb8, 0xaf, 0x99, 0x85, 0xb9, 0xc6, 0xc2, 0x98, 0x85, 0xb1, - 0x12, 0xd6, 0xbc, 0x3e, 0x2c, 0xc9, 0x7e, 0x88, 0xe6, 0xc5, 0x2f, 0x4e, 0x94, 0x46, 0x29, 0x77, - 0xeb, 0xa0, 0x78, 0x72, 0x93, 0x1b, 0x5c, 0x57, 0x1e, 0xbf, 0xb4, 0x69, 0x64, 0x6a, 0x99, 0x0a, - 0xc2, 0xa9, 0x4c, 0x44, 0xfe, 0xea, 0x8c, 0x79, 0x91, 0xa0, 0x54, 0x82, 0xeb, 0x70, 0x2a, 0x14, - 0xec, 0x6b, 0xce, 0xbf, 0x88, 0x7f, 0xf6, 0x00, 0x39, 0x4a, 0x98, 0xdd, 0x07, 0xcf, 0x22, 0xc4, - 0x91, 0x40, 0x98, 0x00, 0xc2, 0x9d, 0xd4, 0x58, 0x4f, 0xfc, 0xaa, 0x2a, 0xe7, 0xc6, 0x51, 0x9b, - 0x74, 0x6a, 0xbd, 0x2b, 0x76, 0xd8, 0xe3, 0x30, 0xcb, 0xb3, 0xec, 0xe1, 0xe9, 0x7c, 0xd5, 0xf2, - 0xcc, 0xaa, 0x55, 0xdd, 0x6e, 0xc6, 0x3b, 0x47, 0x3d, 0xf7, 0x2b, 0x12, 0x85, 0xd2, 0x0d, 0xd2, - 0x3e, 0xee, 0xd4, 0x7a, 0xa3, 0x43, 0x65, 0x7f, 0xde, 0x68, 0x78, 0x52, 0x9a, 0x2b, 0x37, 0xd6, - 0x31, 0xde, 0xa8, 0x86, 0x30, 0x5f, 0x53, 0x6f, 0xb1, 0xa6, 0xde, 0x72, 0x4d, 0xbd, 0x37, 0x43, - 0xc9, 0xdc, 0x50, 0xb2, 0x30, 0x94, 0x2c, 0x0d, 0x25, 0x1f, 0x86, 0x92, 0xf7, 0x4f, 0xea, 0x3d, - 0x0e, 0xfe, 0xf1, 0xc1, 0xbe, 0x03, 0x00, 0x00, 0xff, 0xff, 0x8e, 0xe4, 0x91, 0x70, 0x9e, 0x02, - 0x00, 0x00, -} - -func (m *PartialObjectMetadataList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PartialObjectMetadataList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PartialObjectMetadataList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *PartialObjectMetadataList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *PartialObjectMetadataList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]PartialObjectMetadata{" - for _, f := range this.Items { - repeatedStringForItems += fmt.Sprintf("%v", f) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&PartialObjectMetadataList{`, - `Items:` + repeatedStringForItems + `,`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *PartialObjectMetadataList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PartialObjectMetadataList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PartialObjectMetadataList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, v1.PartialObjectMetadata{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenerated(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenerated - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenerated - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenerated - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") -) diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1/generated.proto b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1/generated.proto deleted file mode 100644 index be61fe3a0..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1/generated.proto +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - - -// This file was autogenerated by go-to-protobuf. Do not edit it manually! - -syntax = "proto2"; - -package github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1beta1; - -import "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; - -// Package-wide variables from generator "generated". -option go_package = "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1"; - -// PartialObjectMetadataList contains a list of objects containing only their metadata. -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message PartialObjectMetadataList { - // Standard list metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - // +optional - optional github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.ListMeta metadata = 2; - - // items contains each of the included items. - repeated github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.meta.v1.PartialObjectMetadata items = 1; -} - diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1/register.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1/register.go deleted file mode 100644 index 5d62e0655..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1/register.go +++ /dev/null @@ -1,32 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2017 The Kubernetes Authors. - -package v1beta1 - -import ( - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -// GroupName is the group name for this API. -const GroupName = "meta.k8s.io" - -// SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"} - -// Kind takes an unqualified kind and returns a Group qualified GroupKind -func Kind(kind string) schema.GroupKind { - return SchemeGroupVersion.WithKind(kind).GroupKind() -} - -// AddMetaToScheme registers base meta types into schemas. -func AddMetaToScheme(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &PartialObjectMetadata{}, - &PartialObjectMetadataList{}, - ) - - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1/types.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1/types.go deleted file mode 100644 index 68d581dc3..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1/types.go +++ /dev/null @@ -1,41 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2017 The Kubernetes Authors. - -// package v1beta1 is alpha objects from meta that will be introduced. -package v1beta1 - -import ( - slim_metav1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" -) - -type ConditionStatus = slim_metav1.ConditionStatus - -// PartialObjectMetadata is a generic representation of any object with ObjectMeta. It allows clients -// to get access to a particular ObjectMeta schema without knowing the details of the version. -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type PartialObjectMetadata = slim_metav1.PartialObjectMetadata - -// IMPORTANT: PartialObjectMetadataList has different protobuf field ids in v1beta1 than -// v1 because ListMeta was accidentally omitted prior to 1.15. Therefore this type must -// remain independent of v1.PartialObjectMetadataList to preserve mappings. - -// PartialObjectMetadataList contains a list of objects containing only their metadata. -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type PartialObjectMetadataList struct { - slim_metav1.TypeMeta `json:",inline"` - // Standard list metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - // +optional - slim_metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,2,opt,name=metadata"` - - // items contains each of the included items. - Items []slim_metav1.PartialObjectMetadata `json:"items" protobuf:"bytes,1,rep,name=items"` -} - -const ( - ConditionTrue = slim_metav1.ConditionTrue - ConditionFalse = slim_metav1.ConditionFalse - ConditionUnknown = slim_metav1.ConditionUnknown -) diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1/zz_generated.deepcopy.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1/zz_generated.deepcopy.go deleted file mode 100644 index d3b949f0d..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1/zz_generated.deepcopy.go +++ /dev/null @@ -1,47 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1beta1 - -import ( - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PartialObjectMetadataList) DeepCopyInto(out *PartialObjectMetadataList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1.PartialObjectMetadata, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartialObjectMetadataList. -func (in *PartialObjectMetadataList) DeepCopy() *PartialObjectMetadataList { - if in == nil { - return nil - } - out := new(PartialObjectMetadataList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PartialObjectMetadataList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1/zz_generated.defaults.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1/zz_generated.defaults.go deleted file mode 100644 index e3ff2b7b4..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1beta1/zz_generated.defaults.go +++ /dev/null @@ -1,20 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by defaulter-gen. DO NOT EDIT. - -package v1beta1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// RegisterDefaults adds defaulters functions to the given scheme. -// Public to allow building arbitrary schemes. -// All generated defaulters are covering - they call all nested defaulters. -func RegisterDefaults(scheme *runtime.Scheme) error { - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/util/intstr/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/util/intstr/doc.go deleted file mode 100644 index 3955e271b..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/util/intstr/doc.go +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// +deepequal-gen=package - -// Package types contains slimmer versions of k8s types. -// +groupName=util -package intstr diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/util/intstr/generated.pb.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/util/intstr/generated.pb.go deleted file mode 100644 index 376a6c0f8..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/util/intstr/generated.pb.go +++ /dev/null @@ -1,356 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/util/intstr/generated.proto - -package intstr - -import ( - fmt "fmt" - - io "io" - math "math" - math_bits "math/bits" - - proto "github.com/gogo/protobuf/proto" -) - -// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -func (m *IntOrString) Reset() { *m = IntOrString{} } -func (*IntOrString) ProtoMessage() {} -func (*IntOrString) Descriptor() ([]byte, []int) { - return fileDescriptor_8984be45904ea297, []int{0} -} -func (m *IntOrString) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IntOrString) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *IntOrString) XXX_Merge(src proto.Message) { - xxx_messageInfo_IntOrString.Merge(m, src) -} -func (m *IntOrString) XXX_Size() int { - return m.Size() -} -func (m *IntOrString) XXX_DiscardUnknown() { - xxx_messageInfo_IntOrString.DiscardUnknown(m) -} - -var xxx_messageInfo_IntOrString proto.InternalMessageInfo - -func init() { - proto.RegisterType((*IntOrString)(nil), "github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.util.intstr.IntOrString") -} - -func init() { - proto.RegisterFile("github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/util/intstr/generated.proto", fileDescriptor_8984be45904ea297) -} - -var fileDescriptor_8984be45904ea297 = []byte{ - // 293 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xf2, 0x4a, 0xcf, 0x2c, 0xc9, - 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcc, 0xc9, 0x2c, 0x85, 0x53, 0x05, 0xd9, - 0xe9, 0xfa, 0xd9, 0x16, 0xc5, 0xfa, 0xc5, 0x39, 0x99, 0xb9, 0x60, 0x46, 0x62, 0x41, 0x66, 0xb1, - 0x7e, 0x69, 0x49, 0x66, 0x8e, 0x7e, 0x66, 0x5e, 0x49, 0x71, 0x49, 0x91, 0x7e, 0x7a, 0x6a, 0x5e, - 0x6a, 0x51, 0x62, 0x49, 0x6a, 0x8a, 0x5e, 0x41, 0x51, 0x7e, 0x49, 0xbe, 0x90, 0x15, 0xc2, 0x2c, - 0x3d, 0x88, 0x21, 0x30, 0xaa, 0x20, 0x3b, 0x5d, 0x2f, 0xdb, 0xa2, 0x58, 0x0f, 0x64, 0x16, 0x98, - 0x01, 0x32, 0x4b, 0x0f, 0x64, 0x96, 0x1e, 0xc4, 0x2c, 0x29, 0x5d, 0x24, 0x77, 0xa4, 0xe7, 0xa7, - 0xe7, 0xeb, 0x83, 0x8d, 0x4c, 0x2a, 0x4d, 0x03, 0xf3, 0xc0, 0x1c, 0x30, 0x0b, 0x62, 0x95, 0xd2, - 0x44, 0x46, 0x2e, 0x6e, 0xcf, 0xbc, 0x12, 0xff, 0xa2, 0xe0, 0x92, 0xa2, 0xcc, 0xbc, 0x74, 0x21, - 0x0d, 0x2e, 0x96, 0x92, 0xca, 0x82, 0x54, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x66, 0x27, 0x91, 0x13, - 0xf7, 0xe4, 0x19, 0x1e, 0xdd, 0x93, 0x67, 0x09, 0xa9, 0x2c, 0x48, 0xfd, 0x05, 0xa5, 0x83, 0xc0, - 0x2a, 0x84, 0xd4, 0xb8, 0xd8, 0x32, 0xf3, 0x4a, 0xc2, 0x12, 0x73, 0x24, 0x98, 0x14, 0x18, 0x35, - 0x58, 0x9d, 0xf8, 0xa0, 0x6a, 0xd9, 0x3c, 0xc1, 0xa2, 0x41, 0x50, 0x59, 0x90, 0xba, 0xe2, 0x92, - 0x22, 0x90, 0x3a, 0x66, 0x05, 0x46, 0x0d, 0x4e, 0x84, 0xba, 0x60, 0xb0, 0x68, 0x10, 0x54, 0xd6, - 0x8a, 0x63, 0xc6, 0x02, 0x79, 0x86, 0x86, 0x3b, 0x0a, 0x0c, 0x4e, 0x09, 0x27, 0x1e, 0xca, 0x31, - 0x5c, 0x78, 0x28, 0xc7, 0x70, 0xe3, 0xa1, 0x1c, 0x43, 0xc3, 0x23, 0x39, 0xc6, 0x13, 0x8f, 0xe4, - 0x18, 0x2f, 0x3c, 0x92, 0x63, 0xbc, 0xf1, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, - 0xe5, 0x18, 0xa2, 0xac, 0xc8, 0x0f, 0x70, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x79, 0x17, 0x78, - 0x08, 0xad, 0x01, 0x00, 0x00, -} - -func (m *IntOrString) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *IntOrString) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IntOrString) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.StrVal) - copy(dAtA[i:], m.StrVal) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.StrVal))) - i-- - dAtA[i] = 0x1a - i = encodeVarintGenerated(dAtA, i, uint64(m.IntVal)) - i-- - dAtA[i] = 0x10 - i = encodeVarintGenerated(dAtA, i, uint64(m.Type)) - i-- - dAtA[i] = 0x8 - return len(dAtA) - i, nil -} - -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *IntOrString) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovGenerated(uint64(m.Type)) - n += 1 + sovGenerated(uint64(m.IntVal)) - l = len(m.StrVal) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *IntOrString) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IntOrString: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IntOrString: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= Type(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IntVal", wireType) - } - m.IntVal = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.IntVal |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StrVal", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StrVal = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenerated(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenerated - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenerated - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenerated - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") -) diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/util/intstr/generated.proto b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/util/intstr/generated.proto deleted file mode 100644 index 2d929fd18..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/util/intstr/generated.proto +++ /dev/null @@ -1,30 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - - -// This file was autogenerated by go-to-protobuf. Do not edit it manually! - -syntax = "proto2"; - -package github.com.cilium.cilium.pkg.k8s.slim.k8s.apis.util.intstr; - -// Package-wide variables from generator "generated". -option go_package = "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/util/intstr"; - -// IntOrString is a type that can hold an int32 or a string. When used in -// JSON or YAML marshalling and unmarshalling, it produces or consumes the -// inner type. This allows you to have, for example, a JSON field that can -// accept a name or number. -// TODO: Rename to Int32OrString -// -// +protobuf=true -// +protobuf.options.(gogoproto.goproto_stringer)=false -// +k8s:openapi-gen=true -message IntOrString { - optional int64 type = 1; - - optional int32 intVal = 2; - - optional string strVal = 3; -} - diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/util/intstr/intstr.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/util/intstr/intstr.go deleted file mode 100644 index 2f76aa377..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/util/intstr/intstr.go +++ /dev/null @@ -1,221 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright 2014 The Kubernetes Authors. - -package intstr - -import ( - "encoding/json" - "errors" - "fmt" - "math" - "runtime/debug" - "strconv" - "strings" - - "k8s.io/klog/v2" -) - -// IntOrString is a type that can hold an int32 or a string. When used in -// JSON or YAML marshalling and unmarshalling, it produces or consumes the -// inner type. This allows you to have, for example, a JSON field that can -// accept a name or number. -// TODO: Rename to Int32OrString -// -// +protobuf=true -// +protobuf.options.(gogoproto.goproto_stringer)=false -// +k8s:openapi-gen=true -type IntOrString struct { - Type Type `protobuf:"varint,1,opt,name=type,casttype=Type"` - IntVal int32 `protobuf:"varint,2,opt,name=intVal"` - StrVal string `protobuf:"bytes,3,opt,name=strVal"` -} - -// Type represents the stored type of IntOrString. -type Type int64 - -const ( - Int Type = iota // The IntOrString holds an int. - String // The IntOrString holds a string. -) - -// FromInt creates an IntOrString object with an int32 value. It is -// your responsibility not to call this method with a value greater -// than int32. -// Deprecated: use FromInt32 instead. -func FromInt(val int) IntOrString { - if val > math.MaxInt32 || val < math.MinInt32 { - klog.Errorf("value: %d overflows int32\n%s\n", val, debug.Stack()) - } - return IntOrString{Type: Int, IntVal: int32(val)} -} - -// FromInt32 creates an IntOrString object with an int32 value. -func FromInt32(val int32) IntOrString { - return IntOrString{Type: Int, IntVal: val} -} - -// FromString creates an IntOrString object with a string value. -func FromString(val string) IntOrString { - return IntOrString{Type: String, StrVal: val} -} - -// Parse the given string and try to convert it to an int32 integer before -// setting it as a string value. -func Parse(val string) IntOrString { - i, err := strconv.ParseInt(val, 10, 32) - if err != nil { - return FromString(val) - } - return FromInt32(int32(i)) -} - -// UnmarshalJSON implements the json.Unmarshaller interface. -func (intstr *IntOrString) UnmarshalJSON(value []byte) error { - if value[0] == '"' { - intstr.Type = String - return json.Unmarshal(value, &intstr.StrVal) - } - intstr.Type = Int - return json.Unmarshal(value, &intstr.IntVal) -} - -// String returns the string value, or the Itoa of the int value. -func (intstr *IntOrString) String() string { - if intstr == nil { - return "" - } - if intstr.Type == String { - return intstr.StrVal - } - return strconv.Itoa(intstr.IntValue()) -} - -// IntValue returns the IntVal if type Int, or if -// it is a String, will attempt a conversion to int, -// returning 0 if a parsing error occurs. -func (intstr *IntOrString) IntValue() int { - if intstr.Type == String { - i, _ := strconv.Atoi(intstr.StrVal) - return i - } - return int(intstr.IntVal) -} - -// MarshalJSON implements the json.Marshaller interface. -func (intstr IntOrString) MarshalJSON() ([]byte, error) { - switch intstr.Type { - case Int: - return json.Marshal(intstr.IntVal) - case String: - return json.Marshal(intstr.StrVal) - default: - return []byte{}, fmt.Errorf("impossible IntOrString.Type") - } -} - -// OpenAPISchemaType is used by the kube-openapi generator when constructing -// the OpenAPI spec of this type. -// -// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators -func (IntOrString) OpenAPISchemaType() []string { return []string{"string"} } - -// OpenAPISchemaFormat is used by the kube-openapi generator when constructing -// the OpenAPI spec of this type. -func (IntOrString) OpenAPISchemaFormat() string { return "int-or-string" } - -// OpenAPIV3OneOfTypes is used by the kube-openapi generator when constructing -// the OpenAPI v3 spec of this type. -func (IntOrString) OpenAPIV3OneOfTypes() []string { return []string{"integer", "string"} } - -func ValueOrDefault(intOrPercent *IntOrString, defaultValue IntOrString) *IntOrString { - if intOrPercent == nil { - return &defaultValue - } - return intOrPercent -} - -// GetScaledValueFromIntOrPercent is meant to replace GetValueFromIntOrPercent. -// This method returns a scaled value from an IntOrString type. If the IntOrString -// is a percentage string value it's treated as a percentage and scaled appropriately -// in accordance to the total, if it's an int value it's treated as a simple value and -// if it is a string value which is either non-numeric or numeric but lacking a trailing '%' it returns an error. -func GetScaledValueFromIntOrPercent(intOrPercent *IntOrString, total int, roundUp bool) (int, error) { - if intOrPercent == nil { - return 0, errors.New("nil value for IntOrString") - } - value, isPercent, err := getIntOrPercentValueSafely(intOrPercent) - if err != nil { - return 0, fmt.Errorf("invalid value for IntOrString: %w", err) - } - if isPercent { - if roundUp { - value = int(math.Ceil(float64(value) * (float64(total)) / 100)) - } else { - value = int(math.Floor(float64(value) * (float64(total)) / 100)) - } - } - return value, nil -} - -// GetValueFromIntOrPercent was deprecated in favor of -// GetScaledValueFromIntOrPercent. This method was treating all int as a numeric value and all -// strings with or without a percent symbol as a percentage value. -// Deprecated -func GetValueFromIntOrPercent(intOrPercent *IntOrString, total int, roundUp bool) (int, error) { - if intOrPercent == nil { - return 0, errors.New("nil value for IntOrString") - } - value, isPercent, err := getIntOrPercentValue(intOrPercent) - if err != nil { - return 0, fmt.Errorf("invalid value for IntOrString: %w", err) - } - if isPercent { - if roundUp { - value = int(math.Ceil(float64(value) * (float64(total)) / 100)) - } else { - value = int(math.Floor(float64(value) * (float64(total)) / 100)) - } - } - return value, nil -} - -// getIntOrPercentValue is a legacy function and only meant to be called by GetValueFromIntOrPercent -// For a more correct implementation call getIntOrPercentSafely -func getIntOrPercentValue(intOrStr *IntOrString) (int, bool, error) { - switch intOrStr.Type { - case Int: - return intOrStr.IntValue(), false, nil - case String: - s := strings.Replace(intOrStr.StrVal, "%", "", -1) - v, err := strconv.Atoi(s) - if err != nil { - return 0, false, fmt.Errorf("invalid value %q: %w", intOrStr.StrVal, err) - } - return int(v), true, nil - } - return 0, false, fmt.Errorf("invalid type: neither int nor percentage") -} - -func getIntOrPercentValueSafely(intOrStr *IntOrString) (int, bool, error) { - switch intOrStr.Type { - case Int: - return intOrStr.IntValue(), false, nil - case String: - isPercent := false - s := intOrStr.StrVal - if strings.HasSuffix(s, "%") { - isPercent = true - s = strings.TrimSuffix(intOrStr.StrVal, "%") - } else { - return 0, false, fmt.Errorf("invalid type: string is not a percentage") - } - v, err := strconv.Atoi(s) - if err != nil { - return 0, false, fmt.Errorf("invalid value %q: %w", intOrStr.StrVal, err) - } - return int(v), isPercent, nil - } - return 0, false, fmt.Errorf("invalid type: neither int nor percentage") -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/util/intstr/zz_generated.deepequal.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/util/intstr/zz_generated.deepequal.go deleted file mode 100644 index c9cb4ad58..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/util/intstr/zz_generated.deepequal.go +++ /dev/null @@ -1,29 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepequal-gen. DO NOT EDIT. - -package intstr - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *IntOrString) DeepEqual(other *IntOrString) bool { - if other == nil { - return false - } - - if in.Type != other.Type { - return false - } - if in.IntVal != other.IntVal { - return false - } - if in.StrVal != other.StrVal { - return false - } - - return true -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/clientset.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/clientset.go deleted file mode 100644 index 66370e6d6..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/clientset.go +++ /dev/null @@ -1,146 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package versioned - -import ( - "fmt" - "net/http" - - corev1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1" - discoveryv1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1" - discoveryv1beta1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1" - networkingv1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1" - discovery "k8s.io/client-go/discovery" - rest "k8s.io/client-go/rest" - flowcontrol "k8s.io/client-go/util/flowcontrol" -) - -type Interface interface { - Discovery() discovery.DiscoveryInterface - CoreV1() corev1.CoreV1Interface - DiscoveryV1() discoveryv1.DiscoveryV1Interface - DiscoveryV1beta1() discoveryv1beta1.DiscoveryV1beta1Interface - NetworkingV1() networkingv1.NetworkingV1Interface -} - -// Clientset contains the clients for groups. -type Clientset struct { - *discovery.DiscoveryClient - coreV1 *corev1.CoreV1Client - discoveryV1 *discoveryv1.DiscoveryV1Client - discoveryV1beta1 *discoveryv1beta1.DiscoveryV1beta1Client - networkingV1 *networkingv1.NetworkingV1Client -} - -// CoreV1 retrieves the CoreV1Client -func (c *Clientset) CoreV1() corev1.CoreV1Interface { - return c.coreV1 -} - -// DiscoveryV1 retrieves the DiscoveryV1Client -func (c *Clientset) DiscoveryV1() discoveryv1.DiscoveryV1Interface { - return c.discoveryV1 -} - -// DiscoveryV1beta1 retrieves the DiscoveryV1beta1Client -func (c *Clientset) DiscoveryV1beta1() discoveryv1beta1.DiscoveryV1beta1Interface { - return c.discoveryV1beta1 -} - -// NetworkingV1 retrieves the NetworkingV1Client -func (c *Clientset) NetworkingV1() networkingv1.NetworkingV1Interface { - return c.networkingV1 -} - -// Discovery retrieves the DiscoveryClient -func (c *Clientset) Discovery() discovery.DiscoveryInterface { - if c == nil { - return nil - } - return c.DiscoveryClient -} - -// NewForConfig creates a new Clientset for the given config. -// If config's RateLimiter is not set and QPS and Burst are acceptable, -// NewForConfig will generate a rate-limiter in configShallowCopy. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*Clientset, error) { - configShallowCopy := *c - - if configShallowCopy.UserAgent == "" { - configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent() - } - - // share the transport between all clients - httpClient, err := rest.HTTPClientFor(&configShallowCopy) - if err != nil { - return nil, err - } - - return NewForConfigAndClient(&configShallowCopy, httpClient) -} - -// NewForConfigAndClient creates a new Clientset for the given config and http client. -// Note the http client provided takes precedence over the configured transport values. -// If config's RateLimiter is not set and QPS and Burst are acceptable, -// NewForConfigAndClient will generate a rate-limiter in configShallowCopy. -func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) { - configShallowCopy := *c - if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { - if configShallowCopy.Burst <= 0 { - return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") - } - configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) - } - - var cs Clientset - var err error - cs.coreV1, err = corev1.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - cs.discoveryV1, err = discoveryv1.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - cs.discoveryV1beta1, err = discoveryv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - cs.networkingV1, err = networkingv1.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - - cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - return &cs, nil -} - -// NewForConfigOrDie creates a new Clientset for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *Clientset { - cs, err := NewForConfig(c) - if err != nil { - panic(err) - } - return cs -} - -// New creates a new Clientset for the given RESTClient. -func New(c rest.Interface) *Clientset { - var cs Clientset - cs.coreV1 = corev1.New(c) - cs.discoveryV1 = discoveryv1.New(c) - cs.discoveryV1beta1 = discoveryv1beta1.New(c) - cs.networkingV1 = networkingv1.New(c) - - cs.DiscoveryClient = discovery.NewDiscoveryClient(c) - return &cs -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/fake/clientset_generated.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/fake/clientset_generated.go deleted file mode 100644 index 97b33008d..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/fake/clientset_generated.go +++ /dev/null @@ -1,93 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - clientset "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned" - corev1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1" - fakecorev1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake" - discoveryv1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1" - fakediscoveryv1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1/fake" - discoveryv1beta1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1" - fakediscoveryv1beta1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1/fake" - networkingv1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1" - fakenetworkingv1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1/fake" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/watch" - "k8s.io/client-go/discovery" - fakediscovery "k8s.io/client-go/discovery/fake" - "k8s.io/client-go/testing" -) - -// NewSimpleClientset returns a clientset that will respond with the provided objects. -// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any validations and/or defaults. It shouldn't be considered a replacement -// for a real clientset and is mostly useful in simple unit tests. -func NewSimpleClientset(objects ...runtime.Object) *Clientset { - o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) - for _, obj := range objects { - if err := o.Add(obj); err != nil { - panic(err) - } - } - - cs := &Clientset{tracker: o} - cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} - cs.AddReactor("*", "*", testing.ObjectReaction(o)) - cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { - gvr := action.GetResource() - ns := action.GetNamespace() - watch, err := o.Watch(gvr, ns) - if err != nil { - return false, nil, err - } - return true, watch, nil - }) - - return cs -} - -// Clientset implements clientset.Interface. Meant to be embedded into a -// struct to get a default implementation. This makes faking out just the method -// you want to test easier. -type Clientset struct { - testing.Fake - discovery *fakediscovery.FakeDiscovery - tracker testing.ObjectTracker -} - -func (c *Clientset) Discovery() discovery.DiscoveryInterface { - return c.discovery -} - -func (c *Clientset) Tracker() testing.ObjectTracker { - return c.tracker -} - -var ( - _ clientset.Interface = &Clientset{} - _ testing.FakeClient = &Clientset{} -) - -// CoreV1 retrieves the CoreV1Client -func (c *Clientset) CoreV1() corev1.CoreV1Interface { - return &fakecorev1.FakeCoreV1{Fake: &c.Fake} -} - -// DiscoveryV1 retrieves the DiscoveryV1Client -func (c *Clientset) DiscoveryV1() discoveryv1.DiscoveryV1Interface { - return &fakediscoveryv1.FakeDiscoveryV1{Fake: &c.Fake} -} - -// DiscoveryV1beta1 retrieves the DiscoveryV1beta1Client -func (c *Clientset) DiscoveryV1beta1() discoveryv1beta1.DiscoveryV1beta1Interface { - return &fakediscoveryv1beta1.FakeDiscoveryV1beta1{Fake: &c.Fake} -} - -// NetworkingV1 retrieves the NetworkingV1Client -func (c *Clientset) NetworkingV1() networkingv1.NetworkingV1Interface { - return &fakenetworkingv1.FakeNetworkingV1{Fake: &c.Fake} -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/fake/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/fake/doc.go deleted file mode 100644 index 1da8cc9d5..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/fake/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated fake clientset. -package fake diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/fake/register.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/fake/register.go deleted file mode 100644 index 0fc35ac22..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/fake/register.go +++ /dev/null @@ -1,49 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - corev1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - discoveryv1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1" - discoveryv1beta1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1" - networkingv1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" -) - -var scheme = runtime.NewScheme() -var codecs = serializer.NewCodecFactory(scheme) - -var localSchemeBuilder = runtime.SchemeBuilder{ - corev1.AddToScheme, - discoveryv1.AddToScheme, - discoveryv1beta1.AddToScheme, - networkingv1.AddToScheme, -} - -// AddToScheme adds all types of this clientset into the given scheme. This allows composition -// of clientsets, like in: -// -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) -// -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) -// -// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types -// correctly. -var AddToScheme = localSchemeBuilder.AddToScheme - -func init() { - v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) - utilruntime.Must(AddToScheme(scheme)) -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/scheme/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/scheme/doc.go deleted file mode 100644 index ba3451535..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/scheme/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -// This package contains the scheme of the automatically generated clientset. -package scheme diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/scheme/register.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/scheme/register.go deleted file mode 100644 index a37b29270..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/scheme/register.go +++ /dev/null @@ -1,49 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package scheme - -import ( - corev1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - discoveryv1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1" - discoveryv1beta1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1" - networkingv1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" -) - -var Scheme = runtime.NewScheme() -var Codecs = serializer.NewCodecFactory(Scheme) -var ParameterCodec = runtime.NewParameterCodec(Scheme) -var localSchemeBuilder = runtime.SchemeBuilder{ - corev1.AddToScheme, - discoveryv1.AddToScheme, - discoveryv1beta1.AddToScheme, - networkingv1.AddToScheme, -} - -// AddToScheme adds all types of this clientset into the given scheme. This allows composition -// of clientsets, like in: -// -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) -// -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) -// -// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types -// correctly. -var AddToScheme = localSchemeBuilder.AddToScheme - -func init() { - v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) - utilruntime.Must(AddToScheme(Scheme)) -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/core_client.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/core_client.go deleted file mode 100644 index 25eab1958..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/core_client.go +++ /dev/null @@ -1,119 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "net/http" - - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" -) - -type CoreV1Interface interface { - RESTClient() rest.Interface - EndpointsGetter - NamespacesGetter - NodesGetter - PodsGetter - SecretsGetter - ServicesGetter -} - -// CoreV1Client is used to interact with features provided by the group. -type CoreV1Client struct { - restClient rest.Interface -} - -func (c *CoreV1Client) Endpoints(namespace string) EndpointsInterface { - return newEndpoints(c, namespace) -} - -func (c *CoreV1Client) Namespaces() NamespaceInterface { - return newNamespaces(c) -} - -func (c *CoreV1Client) Nodes() NodeInterface { - return newNodes(c) -} - -func (c *CoreV1Client) Pods(namespace string) PodInterface { - return newPods(c, namespace) -} - -func (c *CoreV1Client) Secrets(namespace string) SecretInterface { - return newSecrets(c, namespace) -} - -func (c *CoreV1Client) Services(namespace string) ServiceInterface { - return newServices(c, namespace) -} - -// NewForConfig creates a new CoreV1Client for the given config. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*CoreV1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - httpClient, err := rest.HTTPClientFor(&config) - if err != nil { - return nil, err - } - return NewForConfigAndClient(&config, httpClient) -} - -// NewForConfigAndClient creates a new CoreV1Client for the given config and http client. -// Note the http client provided takes precedence over the configured transport values. -func NewForConfigAndClient(c *rest.Config, h *http.Client) (*CoreV1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientForConfigAndClient(&config, h) - if err != nil { - return nil, err - } - return &CoreV1Client{client}, nil -} - -// NewForConfigOrDie creates a new CoreV1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *CoreV1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new CoreV1Client for the given RESTClient. -func New(c rest.Interface) *CoreV1Client { - return &CoreV1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/api" - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() - - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *CoreV1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/doc.go deleted file mode 100644 index 50cfbd485..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated typed clients. -package v1 diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/endpoints.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/endpoints.go deleted file mode 100644 index 9f363250e..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/endpoints.go +++ /dev/null @@ -1,165 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - scheme "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// EndpointsGetter has a method to return a EndpointsInterface. -// A group's client should implement this interface. -type EndpointsGetter interface { - Endpoints(namespace string) EndpointsInterface -} - -// EndpointsInterface has methods to work with Endpoints resources. -type EndpointsInterface interface { - Create(ctx context.Context, endpoints *v1.Endpoints, opts metav1.CreateOptions) (*v1.Endpoints, error) - Update(ctx context.Context, endpoints *v1.Endpoints, opts metav1.UpdateOptions) (*v1.Endpoints, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Endpoints, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.EndpointsList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Endpoints, err error) - EndpointsExpansion -} - -// endpoints implements EndpointsInterface -type endpoints struct { - client rest.Interface - ns string -} - -// newEndpoints returns a Endpoints -func newEndpoints(c *CoreV1Client, namespace string) *endpoints { - return &endpoints{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the endpoints, and returns the corresponding endpoints object, and an error if there is any. -func (c *endpoints) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Endpoints, err error) { - result = &v1.Endpoints{} - err = c.client.Get(). - Namespace(c.ns). - Resource("endpoints"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Endpoints that match those selectors. -func (c *endpoints) List(ctx context.Context, opts metav1.ListOptions) (result *v1.EndpointsList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.EndpointsList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("endpoints"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested endpoints. -func (c *endpoints) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("endpoints"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a endpoints and creates it. Returns the server's representation of the endpoints, and an error, if there is any. -func (c *endpoints) Create(ctx context.Context, endpoints *v1.Endpoints, opts metav1.CreateOptions) (result *v1.Endpoints, err error) { - result = &v1.Endpoints{} - err = c.client.Post(). - Namespace(c.ns). - Resource("endpoints"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(endpoints). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a endpoints and updates it. Returns the server's representation of the endpoints, and an error, if there is any. -func (c *endpoints) Update(ctx context.Context, endpoints *v1.Endpoints, opts metav1.UpdateOptions) (result *v1.Endpoints, err error) { - result = &v1.Endpoints{} - err = c.client.Put(). - Namespace(c.ns). - Resource("endpoints"). - Name(endpoints.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(endpoints). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the endpoints and deletes it. Returns an error if one occurs. -func (c *endpoints) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("endpoints"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *endpoints) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("endpoints"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched endpoints. -func (c *endpoints) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Endpoints, err error) { - result = &v1.Endpoints{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("endpoints"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake/doc.go deleted file mode 100644 index 57bd090ef..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -// Package fake has the automatically generated clients. -package fake diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake/fake_core_client.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake/fake_core_client.go deleted file mode 100644 index 60176f481..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake/fake_core_client.go +++ /dev/null @@ -1,47 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeCoreV1 struct { - *testing.Fake -} - -func (c *FakeCoreV1) Endpoints(namespace string) v1.EndpointsInterface { - return &FakeEndpoints{c, namespace} -} - -func (c *FakeCoreV1) Namespaces() v1.NamespaceInterface { - return &FakeNamespaces{c} -} - -func (c *FakeCoreV1) Nodes() v1.NodeInterface { - return &FakeNodes{c} -} - -func (c *FakeCoreV1) Pods(namespace string) v1.PodInterface { - return &FakePods{c, namespace} -} - -func (c *FakeCoreV1) Secrets(namespace string) v1.SecretInterface { - return &FakeSecrets{c, namespace} -} - -func (c *FakeCoreV1) Services(namespace string) v1.ServiceInterface { - return &FakeServices{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeCoreV1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake/fake_endpoints.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake/fake_endpoints.go deleted file mode 100644 index 9029e198c..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake/fake_endpoints.go +++ /dev/null @@ -1,116 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeEndpoints implements EndpointsInterface -type FakeEndpoints struct { - Fake *FakeCoreV1 - ns string -} - -var endpointsResource = v1.SchemeGroupVersion.WithResource("endpoints") - -var endpointsKind = v1.SchemeGroupVersion.WithKind("Endpoints") - -// Get takes name of the endpoints, and returns the corresponding endpoints object, and an error if there is any. -func (c *FakeEndpoints) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Endpoints, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(endpointsResource, c.ns, name), &v1.Endpoints{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.Endpoints), err -} - -// List takes label and field selectors, and returns the list of Endpoints that match those selectors. -func (c *FakeEndpoints) List(ctx context.Context, opts metav1.ListOptions) (result *v1.EndpointsList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(endpointsResource, endpointsKind, c.ns, opts), &v1.EndpointsList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1.EndpointsList{ListMeta: obj.(*v1.EndpointsList).ListMeta} - for _, item := range obj.(*v1.EndpointsList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested endpoints. -func (c *FakeEndpoints) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(endpointsResource, c.ns, opts)) - -} - -// Create takes the representation of a endpoints and creates it. Returns the server's representation of the endpoints, and an error, if there is any. -func (c *FakeEndpoints) Create(ctx context.Context, endpoints *v1.Endpoints, opts metav1.CreateOptions) (result *v1.Endpoints, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(endpointsResource, c.ns, endpoints), &v1.Endpoints{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.Endpoints), err -} - -// Update takes the representation of a endpoints and updates it. Returns the server's representation of the endpoints, and an error, if there is any. -func (c *FakeEndpoints) Update(ctx context.Context, endpoints *v1.Endpoints, opts metav1.UpdateOptions) (result *v1.Endpoints, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(endpointsResource, c.ns, endpoints), &v1.Endpoints{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.Endpoints), err -} - -// Delete takes name of the endpoints and deletes it. Returns an error if one occurs. -func (c *FakeEndpoints) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(endpointsResource, c.ns, name, opts), &v1.Endpoints{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeEndpoints) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - action := testing.NewDeleteCollectionAction(endpointsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1.EndpointsList{}) - return err -} - -// Patch applies the patch and returns the patched endpoints. -func (c *FakeEndpoints) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Endpoints, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(endpointsResource, c.ns, name, pt, data, subresources...), &v1.Endpoints{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.Endpoints), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake/fake_namespace.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake/fake_namespace.go deleted file mode 100644 index 811546583..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake/fake_namespace.go +++ /dev/null @@ -1,100 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeNamespaces implements NamespaceInterface -type FakeNamespaces struct { - Fake *FakeCoreV1 -} - -var namespacesResource = v1.SchemeGroupVersion.WithResource("namespaces") - -var namespacesKind = v1.SchemeGroupVersion.WithKind("Namespace") - -// Get takes name of the namespace, and returns the corresponding namespace object, and an error if there is any. -func (c *FakeNamespaces) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Namespace, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(namespacesResource, name), &v1.Namespace{}) - if obj == nil { - return nil, err - } - return obj.(*v1.Namespace), err -} - -// List takes label and field selectors, and returns the list of Namespaces that match those selectors. -func (c *FakeNamespaces) List(ctx context.Context, opts metav1.ListOptions) (result *v1.NamespaceList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(namespacesResource, namespacesKind, opts), &v1.NamespaceList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1.NamespaceList{ListMeta: obj.(*v1.NamespaceList).ListMeta} - for _, item := range obj.(*v1.NamespaceList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested namespaces. -func (c *FakeNamespaces) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(namespacesResource, opts)) -} - -// Create takes the representation of a namespace and creates it. Returns the server's representation of the namespace, and an error, if there is any. -func (c *FakeNamespaces) Create(ctx context.Context, namespace *v1.Namespace, opts metav1.CreateOptions) (result *v1.Namespace, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(namespacesResource, namespace), &v1.Namespace{}) - if obj == nil { - return nil, err - } - return obj.(*v1.Namespace), err -} - -// Update takes the representation of a namespace and updates it. Returns the server's representation of the namespace, and an error, if there is any. -func (c *FakeNamespaces) Update(ctx context.Context, namespace *v1.Namespace, opts metav1.UpdateOptions) (result *v1.Namespace, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(namespacesResource, namespace), &v1.Namespace{}) - if obj == nil { - return nil, err - } - return obj.(*v1.Namespace), err -} - -// Delete takes name of the namespace and deletes it. Returns an error if one occurs. -func (c *FakeNamespaces) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(namespacesResource, name, opts), &v1.Namespace{}) - return err -} - -// Patch applies the patch and returns the patched namespace. -func (c *FakeNamespaces) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Namespace, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(namespacesResource, name, pt, data, subresources...), &v1.Namespace{}) - if obj == nil { - return nil, err - } - return obj.(*v1.Namespace), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake/fake_node.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake/fake_node.go deleted file mode 100644 index 316a90842..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake/fake_node.go +++ /dev/null @@ -1,119 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeNodes implements NodeInterface -type FakeNodes struct { - Fake *FakeCoreV1 -} - -var nodesResource = v1.SchemeGroupVersion.WithResource("nodes") - -var nodesKind = v1.SchemeGroupVersion.WithKind("Node") - -// Get takes name of the node, and returns the corresponding node object, and an error if there is any. -func (c *FakeNodes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Node, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(nodesResource, name), &v1.Node{}) - if obj == nil { - return nil, err - } - return obj.(*v1.Node), err -} - -// List takes label and field selectors, and returns the list of Nodes that match those selectors. -func (c *FakeNodes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.NodeList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(nodesResource, nodesKind, opts), &v1.NodeList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1.NodeList{ListMeta: obj.(*v1.NodeList).ListMeta} - for _, item := range obj.(*v1.NodeList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested nodes. -func (c *FakeNodes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(nodesResource, opts)) -} - -// Create takes the representation of a node and creates it. Returns the server's representation of the node, and an error, if there is any. -func (c *FakeNodes) Create(ctx context.Context, node *v1.Node, opts metav1.CreateOptions) (result *v1.Node, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(nodesResource, node), &v1.Node{}) - if obj == nil { - return nil, err - } - return obj.(*v1.Node), err -} - -// Update takes the representation of a node and updates it. Returns the server's representation of the node, and an error, if there is any. -func (c *FakeNodes) Update(ctx context.Context, node *v1.Node, opts metav1.UpdateOptions) (result *v1.Node, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(nodesResource, node), &v1.Node{}) - if obj == nil { - return nil, err - } - return obj.(*v1.Node), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeNodes) UpdateStatus(ctx context.Context, node *v1.Node, opts metav1.UpdateOptions) (*v1.Node, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(nodesResource, "status", node), &v1.Node{}) - if obj == nil { - return nil, err - } - return obj.(*v1.Node), err -} - -// Delete takes name of the node and deletes it. Returns an error if one occurs. -func (c *FakeNodes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(nodesResource, name, opts), &v1.Node{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeNodes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(nodesResource, listOpts) - - _, err := c.Fake.Invokes(action, &v1.NodeList{}) - return err -} - -// Patch applies the patch and returns the patched node. -func (c *FakeNodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Node, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(nodesResource, name, pt, data, subresources...), &v1.Node{}) - if obj == nil { - return nil, err - } - return obj.(*v1.Node), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake/fake_pod.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake/fake_pod.go deleted file mode 100644 index dca3fe6f0..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake/fake_pod.go +++ /dev/null @@ -1,139 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakePods implements PodInterface -type FakePods struct { - Fake *FakeCoreV1 - ns string -} - -var podsResource = v1.SchemeGroupVersion.WithResource("pods") - -var podsKind = v1.SchemeGroupVersion.WithKind("Pod") - -// Get takes name of the pod, and returns the corresponding pod object, and an error if there is any. -func (c *FakePods) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Pod, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(podsResource, c.ns, name), &v1.Pod{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.Pod), err -} - -// List takes label and field selectors, and returns the list of Pods that match those selectors. -func (c *FakePods) List(ctx context.Context, opts metav1.ListOptions) (result *v1.PodList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(podsResource, podsKind, c.ns, opts), &v1.PodList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1.PodList{ListMeta: obj.(*v1.PodList).ListMeta} - for _, item := range obj.(*v1.PodList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested pods. -func (c *FakePods) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(podsResource, c.ns, opts)) - -} - -// Create takes the representation of a pod and creates it. Returns the server's representation of the pod, and an error, if there is any. -func (c *FakePods) Create(ctx context.Context, pod *v1.Pod, opts metav1.CreateOptions) (result *v1.Pod, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(podsResource, c.ns, pod), &v1.Pod{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.Pod), err -} - -// Update takes the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any. -func (c *FakePods) Update(ctx context.Context, pod *v1.Pod, opts metav1.UpdateOptions) (result *v1.Pod, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(podsResource, c.ns, pod), &v1.Pod{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.Pod), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakePods) UpdateStatus(ctx context.Context, pod *v1.Pod, opts metav1.UpdateOptions) (*v1.Pod, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(podsResource, "status", c.ns, pod), &v1.Pod{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.Pod), err -} - -// Delete takes name of the pod and deletes it. Returns an error if one occurs. -func (c *FakePods) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(podsResource, c.ns, name, opts), &v1.Pod{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakePods) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - action := testing.NewDeleteCollectionAction(podsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1.PodList{}) - return err -} - -// Patch applies the patch and returns the patched pod. -func (c *FakePods) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Pod, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(podsResource, c.ns, name, pt, data, subresources...), &v1.Pod{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.Pod), err -} - -// UpdateEphemeralContainers takes the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any. -func (c *FakePods) UpdateEphemeralContainers(ctx context.Context, podName string, pod *v1.Pod, opts metav1.UpdateOptions) (result *v1.Pod, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(podsResource, "ephemeralcontainers", c.ns, pod), &v1.Pod{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.Pod), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake/fake_secret.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake/fake_secret.go deleted file mode 100644 index 964116565..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake/fake_secret.go +++ /dev/null @@ -1,116 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeSecrets implements SecretInterface -type FakeSecrets struct { - Fake *FakeCoreV1 - ns string -} - -var secretsResource = v1.SchemeGroupVersion.WithResource("secrets") - -var secretsKind = v1.SchemeGroupVersion.WithKind("Secret") - -// Get takes name of the secret, and returns the corresponding secret object, and an error if there is any. -func (c *FakeSecrets) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Secret, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(secretsResource, c.ns, name), &v1.Secret{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.Secret), err -} - -// List takes label and field selectors, and returns the list of Secrets that match those selectors. -func (c *FakeSecrets) List(ctx context.Context, opts metav1.ListOptions) (result *v1.SecretList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(secretsResource, secretsKind, c.ns, opts), &v1.SecretList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1.SecretList{ListMeta: obj.(*v1.SecretList).ListMeta} - for _, item := range obj.(*v1.SecretList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested secrets. -func (c *FakeSecrets) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(secretsResource, c.ns, opts)) - -} - -// Create takes the representation of a secret and creates it. Returns the server's representation of the secret, and an error, if there is any. -func (c *FakeSecrets) Create(ctx context.Context, secret *v1.Secret, opts metav1.CreateOptions) (result *v1.Secret, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(secretsResource, c.ns, secret), &v1.Secret{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.Secret), err -} - -// Update takes the representation of a secret and updates it. Returns the server's representation of the secret, and an error, if there is any. -func (c *FakeSecrets) Update(ctx context.Context, secret *v1.Secret, opts metav1.UpdateOptions) (result *v1.Secret, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(secretsResource, c.ns, secret), &v1.Secret{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.Secret), err -} - -// Delete takes name of the secret and deletes it. Returns an error if one occurs. -func (c *FakeSecrets) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(secretsResource, c.ns, name, opts), &v1.Secret{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeSecrets) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - action := testing.NewDeleteCollectionAction(secretsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1.SecretList{}) - return err -} - -// Patch applies the patch and returns the patched secret. -func (c *FakeSecrets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Secret, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(secretsResource, c.ns, name, pt, data, subresources...), &v1.Secret{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.Secret), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake/fake_service.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake/fake_service.go deleted file mode 100644 index a68cb6067..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/fake/fake_service.go +++ /dev/null @@ -1,120 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeServices implements ServiceInterface -type FakeServices struct { - Fake *FakeCoreV1 - ns string -} - -var servicesResource = v1.SchemeGroupVersion.WithResource("services") - -var servicesKind = v1.SchemeGroupVersion.WithKind("Service") - -// Get takes name of the service, and returns the corresponding service object, and an error if there is any. -func (c *FakeServices) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Service, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(servicesResource, c.ns, name), &v1.Service{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.Service), err -} - -// List takes label and field selectors, and returns the list of Services that match those selectors. -func (c *FakeServices) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ServiceList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(servicesResource, servicesKind, c.ns, opts), &v1.ServiceList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1.ServiceList{ListMeta: obj.(*v1.ServiceList).ListMeta} - for _, item := range obj.(*v1.ServiceList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested services. -func (c *FakeServices) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(servicesResource, c.ns, opts)) - -} - -// Create takes the representation of a service and creates it. Returns the server's representation of the service, and an error, if there is any. -func (c *FakeServices) Create(ctx context.Context, service *v1.Service, opts metav1.CreateOptions) (result *v1.Service, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(servicesResource, c.ns, service), &v1.Service{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.Service), err -} - -// Update takes the representation of a service and updates it. Returns the server's representation of the service, and an error, if there is any. -func (c *FakeServices) Update(ctx context.Context, service *v1.Service, opts metav1.UpdateOptions) (result *v1.Service, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(servicesResource, c.ns, service), &v1.Service{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.Service), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeServices) UpdateStatus(ctx context.Context, service *v1.Service, opts metav1.UpdateOptions) (*v1.Service, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(servicesResource, "status", c.ns, service), &v1.Service{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.Service), err -} - -// Delete takes name of the service and deletes it. Returns an error if one occurs. -func (c *FakeServices) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(servicesResource, c.ns, name, opts), &v1.Service{}) - - return err -} - -// Patch applies the patch and returns the patched service. -func (c *FakeServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Service, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(servicesResource, c.ns, name, pt, data, subresources...), &v1.Service{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.Service), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/generated_expansion.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/generated_expansion.go deleted file mode 100644 index 4245920ba..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/generated_expansion.go +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -type EndpointsExpansion interface{} - -type NamespaceExpansion interface{} - -type NodeExpansion interface{} - -type PodExpansion interface{} - -type SecretExpansion interface{} - -type ServiceExpansion interface{} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/namespace.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/namespace.go deleted file mode 100644 index 7fea2416d..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/namespace.go +++ /dev/null @@ -1,139 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - scheme "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// NamespacesGetter has a method to return a NamespaceInterface. -// A group's client should implement this interface. -type NamespacesGetter interface { - Namespaces() NamespaceInterface -} - -// NamespaceInterface has methods to work with Namespace resources. -type NamespaceInterface interface { - Create(ctx context.Context, namespace *v1.Namespace, opts metav1.CreateOptions) (*v1.Namespace, error) - Update(ctx context.Context, namespace *v1.Namespace, opts metav1.UpdateOptions) (*v1.Namespace, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Namespace, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.NamespaceList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Namespace, err error) - NamespaceExpansion -} - -// namespaces implements NamespaceInterface -type namespaces struct { - client rest.Interface -} - -// newNamespaces returns a Namespaces -func newNamespaces(c *CoreV1Client) *namespaces { - return &namespaces{ - client: c.RESTClient(), - } -} - -// Get takes name of the namespace, and returns the corresponding namespace object, and an error if there is any. -func (c *namespaces) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Namespace, err error) { - result = &v1.Namespace{} - err = c.client.Get(). - Resource("namespaces"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Namespaces that match those selectors. -func (c *namespaces) List(ctx context.Context, opts metav1.ListOptions) (result *v1.NamespaceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.NamespaceList{} - err = c.client.Get(). - Resource("namespaces"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested namespaces. -func (c *namespaces) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("namespaces"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a namespace and creates it. Returns the server's representation of the namespace, and an error, if there is any. -func (c *namespaces) Create(ctx context.Context, namespace *v1.Namespace, opts metav1.CreateOptions) (result *v1.Namespace, err error) { - result = &v1.Namespace{} - err = c.client.Post(). - Resource("namespaces"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(namespace). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a namespace and updates it. Returns the server's representation of the namespace, and an error, if there is any. -func (c *namespaces) Update(ctx context.Context, namespace *v1.Namespace, opts metav1.UpdateOptions) (result *v1.Namespace, err error) { - result = &v1.Namespace{} - err = c.client.Put(). - Resource("namespaces"). - Name(namespace.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(namespace). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the namespace and deletes it. Returns an error if one occurs. -func (c *namespaces) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("namespaces"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched namespace. -func (c *namespaces) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Namespace, err error) { - result = &v1.Namespace{} - err = c.client.Patch(pt). - Resource("namespaces"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/node.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/node.go deleted file mode 100644 index 6d2e916cf..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/node.go +++ /dev/null @@ -1,171 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - scheme "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// NodesGetter has a method to return a NodeInterface. -// A group's client should implement this interface. -type NodesGetter interface { - Nodes() NodeInterface -} - -// NodeInterface has methods to work with Node resources. -type NodeInterface interface { - Create(ctx context.Context, node *v1.Node, opts metav1.CreateOptions) (*v1.Node, error) - Update(ctx context.Context, node *v1.Node, opts metav1.UpdateOptions) (*v1.Node, error) - UpdateStatus(ctx context.Context, node *v1.Node, opts metav1.UpdateOptions) (*v1.Node, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Node, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.NodeList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Node, err error) - NodeExpansion -} - -// nodes implements NodeInterface -type nodes struct { - client rest.Interface -} - -// newNodes returns a Nodes -func newNodes(c *CoreV1Client) *nodes { - return &nodes{ - client: c.RESTClient(), - } -} - -// Get takes name of the node, and returns the corresponding node object, and an error if there is any. -func (c *nodes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Node, err error) { - result = &v1.Node{} - err = c.client.Get(). - Resource("nodes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Nodes that match those selectors. -func (c *nodes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.NodeList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.NodeList{} - err = c.client.Get(). - Resource("nodes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested nodes. -func (c *nodes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("nodes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a node and creates it. Returns the server's representation of the node, and an error, if there is any. -func (c *nodes) Create(ctx context.Context, node *v1.Node, opts metav1.CreateOptions) (result *v1.Node, err error) { - result = &v1.Node{} - err = c.client.Post(). - Resource("nodes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(node). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a node and updates it. Returns the server's representation of the node, and an error, if there is any. -func (c *nodes) Update(ctx context.Context, node *v1.Node, opts metav1.UpdateOptions) (result *v1.Node, err error) { - result = &v1.Node{} - err = c.client.Put(). - Resource("nodes"). - Name(node.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(node). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *nodes) UpdateStatus(ctx context.Context, node *v1.Node, opts metav1.UpdateOptions) (result *v1.Node, err error) { - result = &v1.Node{} - err = c.client.Put(). - Resource("nodes"). - Name(node.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(node). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the node and deletes it. Returns an error if one occurs. -func (c *nodes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("nodes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *nodes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("nodes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched node. -func (c *nodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Node, err error) { - result = &v1.Node{} - err = c.client.Patch(pt). - Resource("nodes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/pod.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/pod.go deleted file mode 100644 index f46d4d7c3..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/pod.go +++ /dev/null @@ -1,199 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - scheme "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// PodsGetter has a method to return a PodInterface. -// A group's client should implement this interface. -type PodsGetter interface { - Pods(namespace string) PodInterface -} - -// PodInterface has methods to work with Pod resources. -type PodInterface interface { - Create(ctx context.Context, pod *v1.Pod, opts metav1.CreateOptions) (*v1.Pod, error) - Update(ctx context.Context, pod *v1.Pod, opts metav1.UpdateOptions) (*v1.Pod, error) - UpdateStatus(ctx context.Context, pod *v1.Pod, opts metav1.UpdateOptions) (*v1.Pod, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Pod, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.PodList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Pod, err error) - UpdateEphemeralContainers(ctx context.Context, podName string, pod *v1.Pod, opts metav1.UpdateOptions) (*v1.Pod, error) - - PodExpansion -} - -// pods implements PodInterface -type pods struct { - client rest.Interface - ns string -} - -// newPods returns a Pods -func newPods(c *CoreV1Client, namespace string) *pods { - return &pods{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the pod, and returns the corresponding pod object, and an error if there is any. -func (c *pods) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Pod, err error) { - result = &v1.Pod{} - err = c.client.Get(). - Namespace(c.ns). - Resource("pods"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Pods that match those selectors. -func (c *pods) List(ctx context.Context, opts metav1.ListOptions) (result *v1.PodList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.PodList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("pods"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested pods. -func (c *pods) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("pods"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a pod and creates it. Returns the server's representation of the pod, and an error, if there is any. -func (c *pods) Create(ctx context.Context, pod *v1.Pod, opts metav1.CreateOptions) (result *v1.Pod, err error) { - result = &v1.Pod{} - err = c.client.Post(). - Namespace(c.ns). - Resource("pods"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(pod). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any. -func (c *pods) Update(ctx context.Context, pod *v1.Pod, opts metav1.UpdateOptions) (result *v1.Pod, err error) { - result = &v1.Pod{} - err = c.client.Put(). - Namespace(c.ns). - Resource("pods"). - Name(pod.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(pod). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *pods) UpdateStatus(ctx context.Context, pod *v1.Pod, opts metav1.UpdateOptions) (result *v1.Pod, err error) { - result = &v1.Pod{} - err = c.client.Put(). - Namespace(c.ns). - Resource("pods"). - Name(pod.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(pod). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the pod and deletes it. Returns an error if one occurs. -func (c *pods) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("pods"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *pods) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("pods"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched pod. -func (c *pods) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Pod, err error) { - result = &v1.Pod{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("pods"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// UpdateEphemeralContainers takes the top resource name and the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any. -func (c *pods) UpdateEphemeralContainers(ctx context.Context, podName string, pod *v1.Pod, opts metav1.UpdateOptions) (result *v1.Pod, err error) { - result = &v1.Pod{} - err = c.client.Put(). - Namespace(c.ns). - Resource("pods"). - Name(podName). - SubResource("ephemeralcontainers"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(pod). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/secret.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/secret.go deleted file mode 100644 index ccbf30c16..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/secret.go +++ /dev/null @@ -1,165 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - scheme "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// SecretsGetter has a method to return a SecretInterface. -// A group's client should implement this interface. -type SecretsGetter interface { - Secrets(namespace string) SecretInterface -} - -// SecretInterface has methods to work with Secret resources. -type SecretInterface interface { - Create(ctx context.Context, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error) - Update(ctx context.Context, secret *v1.Secret, opts metav1.UpdateOptions) (*v1.Secret, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Secret, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.SecretList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Secret, err error) - SecretExpansion -} - -// secrets implements SecretInterface -type secrets struct { - client rest.Interface - ns string -} - -// newSecrets returns a Secrets -func newSecrets(c *CoreV1Client, namespace string) *secrets { - return &secrets{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the secret, and returns the corresponding secret object, and an error if there is any. -func (c *secrets) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Secret, err error) { - result = &v1.Secret{} - err = c.client.Get(). - Namespace(c.ns). - Resource("secrets"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Secrets that match those selectors. -func (c *secrets) List(ctx context.Context, opts metav1.ListOptions) (result *v1.SecretList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.SecretList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("secrets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested secrets. -func (c *secrets) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("secrets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a secret and creates it. Returns the server's representation of the secret, and an error, if there is any. -func (c *secrets) Create(ctx context.Context, secret *v1.Secret, opts metav1.CreateOptions) (result *v1.Secret, err error) { - result = &v1.Secret{} - err = c.client.Post(). - Namespace(c.ns). - Resource("secrets"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(secret). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a secret and updates it. Returns the server's representation of the secret, and an error, if there is any. -func (c *secrets) Update(ctx context.Context, secret *v1.Secret, opts metav1.UpdateOptions) (result *v1.Secret, err error) { - result = &v1.Secret{} - err = c.client.Put(). - Namespace(c.ns). - Resource("secrets"). - Name(secret.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(secret). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the secret and deletes it. Returns an error if one occurs. -func (c *secrets) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("secrets"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *secrets) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("secrets"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched secret. -func (c *secrets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Secret, err error) { - result = &v1.Secret{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("secrets"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/service.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/service.go deleted file mode 100644 index b981e1979..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/core/v1/service.go +++ /dev/null @@ -1,165 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - scheme "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// ServicesGetter has a method to return a ServiceInterface. -// A group's client should implement this interface. -type ServicesGetter interface { - Services(namespace string) ServiceInterface -} - -// ServiceInterface has methods to work with Service resources. -type ServiceInterface interface { - Create(ctx context.Context, service *v1.Service, opts metav1.CreateOptions) (*v1.Service, error) - Update(ctx context.Context, service *v1.Service, opts metav1.UpdateOptions) (*v1.Service, error) - UpdateStatus(ctx context.Context, service *v1.Service, opts metav1.UpdateOptions) (*v1.Service, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Service, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.ServiceList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Service, err error) - ServiceExpansion -} - -// services implements ServiceInterface -type services struct { - client rest.Interface - ns string -} - -// newServices returns a Services -func newServices(c *CoreV1Client, namespace string) *services { - return &services{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the service, and returns the corresponding service object, and an error if there is any. -func (c *services) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Service, err error) { - result = &v1.Service{} - err = c.client.Get(). - Namespace(c.ns). - Resource("services"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Services that match those selectors. -func (c *services) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ServiceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.ServiceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("services"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested services. -func (c *services) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("services"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a service and creates it. Returns the server's representation of the service, and an error, if there is any. -func (c *services) Create(ctx context.Context, service *v1.Service, opts metav1.CreateOptions) (result *v1.Service, err error) { - result = &v1.Service{} - err = c.client.Post(). - Namespace(c.ns). - Resource("services"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(service). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a service and updates it. Returns the server's representation of the service, and an error, if there is any. -func (c *services) Update(ctx context.Context, service *v1.Service, opts metav1.UpdateOptions) (result *v1.Service, err error) { - result = &v1.Service{} - err = c.client.Put(). - Namespace(c.ns). - Resource("services"). - Name(service.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(service). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *services) UpdateStatus(ctx context.Context, service *v1.Service, opts metav1.UpdateOptions) (result *v1.Service, err error) { - result = &v1.Service{} - err = c.client.Put(). - Namespace(c.ns). - Resource("services"). - Name(service.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(service). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the service and deletes it. Returns an error if one occurs. -func (c *services) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("services"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched service. -func (c *services) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Service, err error) { - result = &v1.Service{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("services"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1/discovery_client.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1/discovery_client.go deleted file mode 100644 index ca9ef1187..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1/discovery_client.go +++ /dev/null @@ -1,94 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "net/http" - - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1" - "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" -) - -type DiscoveryV1Interface interface { - RESTClient() rest.Interface - EndpointSlicesGetter -} - -// DiscoveryV1Client is used to interact with features provided by the discovery.k8s.io group. -type DiscoveryV1Client struct { - restClient rest.Interface -} - -func (c *DiscoveryV1Client) EndpointSlices(namespace string) EndpointSliceInterface { - return newEndpointSlices(c, namespace) -} - -// NewForConfig creates a new DiscoveryV1Client for the given config. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*DiscoveryV1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - httpClient, err := rest.HTTPClientFor(&config) - if err != nil { - return nil, err - } - return NewForConfigAndClient(&config, httpClient) -} - -// NewForConfigAndClient creates a new DiscoveryV1Client for the given config and http client. -// Note the http client provided takes precedence over the configured transport values. -func NewForConfigAndClient(c *rest.Config, h *http.Client) (*DiscoveryV1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientForConfigAndClient(&config, h) - if err != nil { - return nil, err - } - return &DiscoveryV1Client{client}, nil -} - -// NewForConfigOrDie creates a new DiscoveryV1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *DiscoveryV1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new DiscoveryV1Client for the given RESTClient. -func New(c rest.Interface) *DiscoveryV1Client { - return &DiscoveryV1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() - - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *DiscoveryV1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1/doc.go deleted file mode 100644 index 50cfbd485..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated typed clients. -package v1 diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1/endpointslice.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1/endpointslice.go deleted file mode 100644 index cfb4ab528..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1/endpointslice.go +++ /dev/null @@ -1,165 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1" - scheme "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// EndpointSlicesGetter has a method to return a EndpointSliceInterface. -// A group's client should implement this interface. -type EndpointSlicesGetter interface { - EndpointSlices(namespace string) EndpointSliceInterface -} - -// EndpointSliceInterface has methods to work with EndpointSlice resources. -type EndpointSliceInterface interface { - Create(ctx context.Context, endpointSlice *v1.EndpointSlice, opts metav1.CreateOptions) (*v1.EndpointSlice, error) - Update(ctx context.Context, endpointSlice *v1.EndpointSlice, opts metav1.UpdateOptions) (*v1.EndpointSlice, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.EndpointSlice, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.EndpointSliceList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.EndpointSlice, err error) - EndpointSliceExpansion -} - -// endpointSlices implements EndpointSliceInterface -type endpointSlices struct { - client rest.Interface - ns string -} - -// newEndpointSlices returns a EndpointSlices -func newEndpointSlices(c *DiscoveryV1Client, namespace string) *endpointSlices { - return &endpointSlices{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the endpointSlice, and returns the corresponding endpointSlice object, and an error if there is any. -func (c *endpointSlices) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.EndpointSlice, err error) { - result = &v1.EndpointSlice{} - err = c.client.Get(). - Namespace(c.ns). - Resource("endpointslices"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of EndpointSlices that match those selectors. -func (c *endpointSlices) List(ctx context.Context, opts metav1.ListOptions) (result *v1.EndpointSliceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.EndpointSliceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("endpointslices"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested endpointSlices. -func (c *endpointSlices) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("endpointslices"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a endpointSlice and creates it. Returns the server's representation of the endpointSlice, and an error, if there is any. -func (c *endpointSlices) Create(ctx context.Context, endpointSlice *v1.EndpointSlice, opts metav1.CreateOptions) (result *v1.EndpointSlice, err error) { - result = &v1.EndpointSlice{} - err = c.client.Post(). - Namespace(c.ns). - Resource("endpointslices"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(endpointSlice). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a endpointSlice and updates it. Returns the server's representation of the endpointSlice, and an error, if there is any. -func (c *endpointSlices) Update(ctx context.Context, endpointSlice *v1.EndpointSlice, opts metav1.UpdateOptions) (result *v1.EndpointSlice, err error) { - result = &v1.EndpointSlice{} - err = c.client.Put(). - Namespace(c.ns). - Resource("endpointslices"). - Name(endpointSlice.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(endpointSlice). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the endpointSlice and deletes it. Returns an error if one occurs. -func (c *endpointSlices) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("endpointslices"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *endpointSlices) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("endpointslices"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched endpointSlice. -func (c *endpointSlices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.EndpointSlice, err error) { - result = &v1.EndpointSlice{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("endpointslices"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1/fake/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1/fake/doc.go deleted file mode 100644 index 57bd090ef..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1/fake/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -// Package fake has the automatically generated clients. -package fake diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1/fake/fake_discovery_client.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1/fake/fake_discovery_client.go deleted file mode 100644 index 0cee06b99..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1/fake/fake_discovery_client.go +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeDiscoveryV1 struct { - *testing.Fake -} - -func (c *FakeDiscoveryV1) EndpointSlices(namespace string) v1.EndpointSliceInterface { - return &FakeEndpointSlices{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeDiscoveryV1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1/fake/fake_endpointslice.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1/fake/fake_endpointslice.go deleted file mode 100644 index d04fdcf47..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1/fake/fake_endpointslice.go +++ /dev/null @@ -1,116 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeEndpointSlices implements EndpointSliceInterface -type FakeEndpointSlices struct { - Fake *FakeDiscoveryV1 - ns string -} - -var endpointslicesResource = v1.SchemeGroupVersion.WithResource("endpointslices") - -var endpointslicesKind = v1.SchemeGroupVersion.WithKind("EndpointSlice") - -// Get takes name of the endpointSlice, and returns the corresponding endpointSlice object, and an error if there is any. -func (c *FakeEndpointSlices) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.EndpointSlice, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(endpointslicesResource, c.ns, name), &v1.EndpointSlice{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.EndpointSlice), err -} - -// List takes label and field selectors, and returns the list of EndpointSlices that match those selectors. -func (c *FakeEndpointSlices) List(ctx context.Context, opts metav1.ListOptions) (result *v1.EndpointSliceList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(endpointslicesResource, endpointslicesKind, c.ns, opts), &v1.EndpointSliceList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1.EndpointSliceList{ListMeta: obj.(*v1.EndpointSliceList).ListMeta} - for _, item := range obj.(*v1.EndpointSliceList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested endpointSlices. -func (c *FakeEndpointSlices) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(endpointslicesResource, c.ns, opts)) - -} - -// Create takes the representation of a endpointSlice and creates it. Returns the server's representation of the endpointSlice, and an error, if there is any. -func (c *FakeEndpointSlices) Create(ctx context.Context, endpointSlice *v1.EndpointSlice, opts metav1.CreateOptions) (result *v1.EndpointSlice, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(endpointslicesResource, c.ns, endpointSlice), &v1.EndpointSlice{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.EndpointSlice), err -} - -// Update takes the representation of a endpointSlice and updates it. Returns the server's representation of the endpointSlice, and an error, if there is any. -func (c *FakeEndpointSlices) Update(ctx context.Context, endpointSlice *v1.EndpointSlice, opts metav1.UpdateOptions) (result *v1.EndpointSlice, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(endpointslicesResource, c.ns, endpointSlice), &v1.EndpointSlice{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.EndpointSlice), err -} - -// Delete takes name of the endpointSlice and deletes it. Returns an error if one occurs. -func (c *FakeEndpointSlices) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(endpointslicesResource, c.ns, name, opts), &v1.EndpointSlice{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeEndpointSlices) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - action := testing.NewDeleteCollectionAction(endpointslicesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1.EndpointSliceList{}) - return err -} - -// Patch applies the patch and returns the patched endpointSlice. -func (c *FakeEndpointSlices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.EndpointSlice, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(endpointslicesResource, c.ns, name, pt, data, subresources...), &v1.EndpointSlice{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.EndpointSlice), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1/generated_expansion.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1/generated_expansion.go deleted file mode 100644 index 7295b601e..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1/generated_expansion.go +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -type EndpointSliceExpansion interface{} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1/discovery_client.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1/discovery_client.go deleted file mode 100644 index d2d556581..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1/discovery_client.go +++ /dev/null @@ -1,94 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "net/http" - - v1beta1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1" - "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" -) - -type DiscoveryV1beta1Interface interface { - RESTClient() rest.Interface - EndpointSlicesGetter -} - -// DiscoveryV1beta1Client is used to interact with features provided by the discovery.k8s.io group. -type DiscoveryV1beta1Client struct { - restClient rest.Interface -} - -func (c *DiscoveryV1beta1Client) EndpointSlices(namespace string) EndpointSliceInterface { - return newEndpointSlices(c, namespace) -} - -// NewForConfig creates a new DiscoveryV1beta1Client for the given config. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*DiscoveryV1beta1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - httpClient, err := rest.HTTPClientFor(&config) - if err != nil { - return nil, err - } - return NewForConfigAndClient(&config, httpClient) -} - -// NewForConfigAndClient creates a new DiscoveryV1beta1Client for the given config and http client. -// Note the http client provided takes precedence over the configured transport values. -func NewForConfigAndClient(c *rest.Config, h *http.Client) (*DiscoveryV1beta1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientForConfigAndClient(&config, h) - if err != nil { - return nil, err - } - return &DiscoveryV1beta1Client{client}, nil -} - -// NewForConfigOrDie creates a new DiscoveryV1beta1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *DiscoveryV1beta1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new DiscoveryV1beta1Client for the given RESTClient. -func New(c rest.Interface) *DiscoveryV1beta1Client { - return &DiscoveryV1beta1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1beta1.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() - - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *DiscoveryV1beta1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1/doc.go deleted file mode 100644 index 07e23ed4a..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated typed clients. -package v1beta1 diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1/endpointslice.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1/endpointslice.go deleted file mode 100644 index a77bbb97e..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1/endpointslice.go +++ /dev/null @@ -1,165 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "context" - "time" - - v1beta1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1" - scheme "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// EndpointSlicesGetter has a method to return a EndpointSliceInterface. -// A group's client should implement this interface. -type EndpointSlicesGetter interface { - EndpointSlices(namespace string) EndpointSliceInterface -} - -// EndpointSliceInterface has methods to work with EndpointSlice resources. -type EndpointSliceInterface interface { - Create(ctx context.Context, endpointSlice *v1beta1.EndpointSlice, opts v1.CreateOptions) (*v1beta1.EndpointSlice, error) - Update(ctx context.Context, endpointSlice *v1beta1.EndpointSlice, opts v1.UpdateOptions) (*v1beta1.EndpointSlice, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.EndpointSlice, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.EndpointSliceList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.EndpointSlice, err error) - EndpointSliceExpansion -} - -// endpointSlices implements EndpointSliceInterface -type endpointSlices struct { - client rest.Interface - ns string -} - -// newEndpointSlices returns a EndpointSlices -func newEndpointSlices(c *DiscoveryV1beta1Client, namespace string) *endpointSlices { - return &endpointSlices{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the endpointSlice, and returns the corresponding endpointSlice object, and an error if there is any. -func (c *endpointSlices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.EndpointSlice, err error) { - result = &v1beta1.EndpointSlice{} - err = c.client.Get(). - Namespace(c.ns). - Resource("endpointslices"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of EndpointSlices that match those selectors. -func (c *endpointSlices) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.EndpointSliceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.EndpointSliceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("endpointslices"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested endpointSlices. -func (c *endpointSlices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("endpointslices"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a endpointSlice and creates it. Returns the server's representation of the endpointSlice, and an error, if there is any. -func (c *endpointSlices) Create(ctx context.Context, endpointSlice *v1beta1.EndpointSlice, opts v1.CreateOptions) (result *v1beta1.EndpointSlice, err error) { - result = &v1beta1.EndpointSlice{} - err = c.client.Post(). - Namespace(c.ns). - Resource("endpointslices"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(endpointSlice). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a endpointSlice and updates it. Returns the server's representation of the endpointSlice, and an error, if there is any. -func (c *endpointSlices) Update(ctx context.Context, endpointSlice *v1beta1.EndpointSlice, opts v1.UpdateOptions) (result *v1beta1.EndpointSlice, err error) { - result = &v1beta1.EndpointSlice{} - err = c.client.Put(). - Namespace(c.ns). - Resource("endpointslices"). - Name(endpointSlice.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(endpointSlice). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the endpointSlice and deletes it. Returns an error if one occurs. -func (c *endpointSlices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("endpointslices"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *endpointSlices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("endpointslices"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched endpointSlice. -func (c *endpointSlices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.EndpointSlice, err error) { - result = &v1beta1.EndpointSlice{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("endpointslices"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1/fake/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1/fake/doc.go deleted file mode 100644 index 57bd090ef..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1/fake/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -// Package fake has the automatically generated clients. -package fake diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1/fake/fake_discovery_client.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1/fake/fake_discovery_client.go deleted file mode 100644 index a1d258d80..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1/fake/fake_discovery_client.go +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1beta1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeDiscoveryV1beta1 struct { - *testing.Fake -} - -func (c *FakeDiscoveryV1beta1) EndpointSlices(namespace string) v1beta1.EndpointSliceInterface { - return &FakeEndpointSlices{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeDiscoveryV1beta1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1/fake/fake_endpointslice.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1/fake/fake_endpointslice.go deleted file mode 100644 index ddc55497d..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1/fake/fake_endpointslice.go +++ /dev/null @@ -1,116 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1beta1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/discovery/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeEndpointSlices implements EndpointSliceInterface -type FakeEndpointSlices struct { - Fake *FakeDiscoveryV1beta1 - ns string -} - -var endpointslicesResource = v1beta1.SchemeGroupVersion.WithResource("endpointslices") - -var endpointslicesKind = v1beta1.SchemeGroupVersion.WithKind("EndpointSlice") - -// Get takes name of the endpointSlice, and returns the corresponding endpointSlice object, and an error if there is any. -func (c *FakeEndpointSlices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.EndpointSlice, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(endpointslicesResource, c.ns, name), &v1beta1.EndpointSlice{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.EndpointSlice), err -} - -// List takes label and field selectors, and returns the list of EndpointSlices that match those selectors. -func (c *FakeEndpointSlices) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.EndpointSliceList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(endpointslicesResource, endpointslicesKind, c.ns, opts), &v1beta1.EndpointSliceList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1beta1.EndpointSliceList{ListMeta: obj.(*v1beta1.EndpointSliceList).ListMeta} - for _, item := range obj.(*v1beta1.EndpointSliceList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested endpointSlices. -func (c *FakeEndpointSlices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(endpointslicesResource, c.ns, opts)) - -} - -// Create takes the representation of a endpointSlice and creates it. Returns the server's representation of the endpointSlice, and an error, if there is any. -func (c *FakeEndpointSlices) Create(ctx context.Context, endpointSlice *v1beta1.EndpointSlice, opts v1.CreateOptions) (result *v1beta1.EndpointSlice, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(endpointslicesResource, c.ns, endpointSlice), &v1beta1.EndpointSlice{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.EndpointSlice), err -} - -// Update takes the representation of a endpointSlice and updates it. Returns the server's representation of the endpointSlice, and an error, if there is any. -func (c *FakeEndpointSlices) Update(ctx context.Context, endpointSlice *v1beta1.EndpointSlice, opts v1.UpdateOptions) (result *v1beta1.EndpointSlice, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(endpointslicesResource, c.ns, endpointSlice), &v1beta1.EndpointSlice{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.EndpointSlice), err -} - -// Delete takes name of the endpointSlice and deletes it. Returns an error if one occurs. -func (c *FakeEndpointSlices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(endpointslicesResource, c.ns, name, opts), &v1beta1.EndpointSlice{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeEndpointSlices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(endpointslicesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1beta1.EndpointSliceList{}) - return err -} - -// Patch applies the patch and returns the patched endpointSlice. -func (c *FakeEndpointSlices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.EndpointSlice, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(endpointslicesResource, c.ns, name, pt, data, subresources...), &v1beta1.EndpointSlice{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.EndpointSlice), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1/generated_expansion.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1/generated_expansion.go deleted file mode 100644 index 1aa54bf9b..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/discovery/v1beta1/generated_expansion.go +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -type EndpointSliceExpansion interface{} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1/doc.go deleted file mode 100644 index 50cfbd485..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated typed clients. -package v1 diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1/fake/doc.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1/fake/doc.go deleted file mode 100644 index 57bd090ef..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1/fake/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -// Package fake has the automatically generated clients. -package fake diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1/fake/fake_networking_client.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1/fake/fake_networking_client.go deleted file mode 100644 index 6e5f98fde..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1/fake/fake_networking_client.go +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeNetworkingV1 struct { - *testing.Fake -} - -func (c *FakeNetworkingV1) NetworkPolicies(namespace string) v1.NetworkPolicyInterface { - return &FakeNetworkPolicies{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeNetworkingV1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1/fake/fake_networkpolicy.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1/fake/fake_networkpolicy.go deleted file mode 100644 index e51d9f367..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1/fake/fake_networkpolicy.go +++ /dev/null @@ -1,116 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeNetworkPolicies implements NetworkPolicyInterface -type FakeNetworkPolicies struct { - Fake *FakeNetworkingV1 - ns string -} - -var networkpoliciesResource = v1.SchemeGroupVersion.WithResource("networkpolicies") - -var networkpoliciesKind = v1.SchemeGroupVersion.WithKind("NetworkPolicy") - -// Get takes name of the networkPolicy, and returns the corresponding networkPolicy object, and an error if there is any. -func (c *FakeNetworkPolicies) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.NetworkPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(networkpoliciesResource, c.ns, name), &v1.NetworkPolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.NetworkPolicy), err -} - -// List takes label and field selectors, and returns the list of NetworkPolicies that match those selectors. -func (c *FakeNetworkPolicies) List(ctx context.Context, opts metav1.ListOptions) (result *v1.NetworkPolicyList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(networkpoliciesResource, networkpoliciesKind, c.ns, opts), &v1.NetworkPolicyList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1.NetworkPolicyList{ListMeta: obj.(*v1.NetworkPolicyList).ListMeta} - for _, item := range obj.(*v1.NetworkPolicyList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested networkPolicies. -func (c *FakeNetworkPolicies) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(networkpoliciesResource, c.ns, opts)) - -} - -// Create takes the representation of a networkPolicy and creates it. Returns the server's representation of the networkPolicy, and an error, if there is any. -func (c *FakeNetworkPolicies) Create(ctx context.Context, networkPolicy *v1.NetworkPolicy, opts metav1.CreateOptions) (result *v1.NetworkPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(networkpoliciesResource, c.ns, networkPolicy), &v1.NetworkPolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.NetworkPolicy), err -} - -// Update takes the representation of a networkPolicy and updates it. Returns the server's representation of the networkPolicy, and an error, if there is any. -func (c *FakeNetworkPolicies) Update(ctx context.Context, networkPolicy *v1.NetworkPolicy, opts metav1.UpdateOptions) (result *v1.NetworkPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(networkpoliciesResource, c.ns, networkPolicy), &v1.NetworkPolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.NetworkPolicy), err -} - -// Delete takes name of the networkPolicy and deletes it. Returns an error if one occurs. -func (c *FakeNetworkPolicies) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(networkpoliciesResource, c.ns, name, opts), &v1.NetworkPolicy{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeNetworkPolicies) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - action := testing.NewDeleteCollectionAction(networkpoliciesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1.NetworkPolicyList{}) - return err -} - -// Patch applies the patch and returns the patched networkPolicy. -func (c *FakeNetworkPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.NetworkPolicy, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(networkpoliciesResource, c.ns, name, pt, data, subresources...), &v1.NetworkPolicy{}) - - if obj == nil { - return nil, err - } - return obj.(*v1.NetworkPolicy), err -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1/generated_expansion.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1/generated_expansion.go deleted file mode 100644 index e78ec0609..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1/generated_expansion.go +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -type NetworkPolicyExpansion interface{} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1/networking_client.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1/networking_client.go deleted file mode 100644 index ab93e1dfa..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1/networking_client.go +++ /dev/null @@ -1,94 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "net/http" - - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1" - "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" -) - -type NetworkingV1Interface interface { - RESTClient() rest.Interface - NetworkPoliciesGetter -} - -// NetworkingV1Client is used to interact with features provided by the networking.k8s.io group. -type NetworkingV1Client struct { - restClient rest.Interface -} - -func (c *NetworkingV1Client) NetworkPolicies(namespace string) NetworkPolicyInterface { - return newNetworkPolicies(c, namespace) -} - -// NewForConfig creates a new NetworkingV1Client for the given config. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*NetworkingV1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - httpClient, err := rest.HTTPClientFor(&config) - if err != nil { - return nil, err - } - return NewForConfigAndClient(&config, httpClient) -} - -// NewForConfigAndClient creates a new NetworkingV1Client for the given config and http client. -// Note the http client provided takes precedence over the configured transport values. -func NewForConfigAndClient(c *rest.Config, h *http.Client) (*NetworkingV1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientForConfigAndClient(&config, h) - if err != nil { - return nil, err - } - return &NetworkingV1Client{client}, nil -} - -// NewForConfigOrDie creates a new NetworkingV1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *NetworkingV1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new NetworkingV1Client for the given RESTClient. -func New(c rest.Interface) *NetworkingV1Client { - return &NetworkingV1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() - - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *NetworkingV1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1/networkpolicy.go b/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1/networkpolicy.go deleted file mode 100644 index f657e00a3..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/typed/networking/v1/networkpolicy.go +++ /dev/null @@ -1,165 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/networking/v1" - scheme "github.com/cilium/cilium/pkg/k8s/slim/k8s/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// NetworkPoliciesGetter has a method to return a NetworkPolicyInterface. -// A group's client should implement this interface. -type NetworkPoliciesGetter interface { - NetworkPolicies(namespace string) NetworkPolicyInterface -} - -// NetworkPolicyInterface has methods to work with NetworkPolicy resources. -type NetworkPolicyInterface interface { - Create(ctx context.Context, networkPolicy *v1.NetworkPolicy, opts metav1.CreateOptions) (*v1.NetworkPolicy, error) - Update(ctx context.Context, networkPolicy *v1.NetworkPolicy, opts metav1.UpdateOptions) (*v1.NetworkPolicy, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.NetworkPolicy, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.NetworkPolicyList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.NetworkPolicy, err error) - NetworkPolicyExpansion -} - -// networkPolicies implements NetworkPolicyInterface -type networkPolicies struct { - client rest.Interface - ns string -} - -// newNetworkPolicies returns a NetworkPolicies -func newNetworkPolicies(c *NetworkingV1Client, namespace string) *networkPolicies { - return &networkPolicies{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the networkPolicy, and returns the corresponding networkPolicy object, and an error if there is any. -func (c *networkPolicies) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.NetworkPolicy, err error) { - result = &v1.NetworkPolicy{} - err = c.client.Get(). - Namespace(c.ns). - Resource("networkpolicies"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of NetworkPolicies that match those selectors. -func (c *networkPolicies) List(ctx context.Context, opts metav1.ListOptions) (result *v1.NetworkPolicyList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.NetworkPolicyList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("networkpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested networkPolicies. -func (c *networkPolicies) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("networkpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a networkPolicy and creates it. Returns the server's representation of the networkPolicy, and an error, if there is any. -func (c *networkPolicies) Create(ctx context.Context, networkPolicy *v1.NetworkPolicy, opts metav1.CreateOptions) (result *v1.NetworkPolicy, err error) { - result = &v1.NetworkPolicy{} - err = c.client.Post(). - Namespace(c.ns). - Resource("networkpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(networkPolicy). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a networkPolicy and updates it. Returns the server's representation of the networkPolicy, and an error, if there is any. -func (c *networkPolicies) Update(ctx context.Context, networkPolicy *v1.NetworkPolicy, opts metav1.UpdateOptions) (result *v1.NetworkPolicy, err error) { - result = &v1.NetworkPolicy{} - err = c.client.Put(). - Namespace(c.ns). - Resource("networkpolicies"). - Name(networkPolicy.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(networkPolicy). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the networkPolicy and deletes it. Returns an error if one occurs. -func (c *networkPolicies) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("networkpolicies"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *networkPolicies) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("networkpolicies"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched networkPolicy. -func (c *networkPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.NetworkPolicy, err error) { - result = &v1.NetworkPolicy{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("networkpolicies"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/utils/listwatcher.go b/vendor/github.com/cilium/cilium/pkg/k8s/utils/listwatcher.go deleted file mode 100644 index 12d71835f..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/utils/listwatcher.go +++ /dev/null @@ -1,76 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package utils - -import ( - "context" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/fields" - k8sRuntime "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/watch" - "k8s.io/client-go/tools/cache" -) - -// typedListWatcher is a generic interface that all the typed k8s clients match. -type typedListWatcher[T k8sRuntime.Object] interface { - List(ctx context.Context, opts metav1.ListOptions) (T, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) -} - -// genListWatcher takes a typed list watcher and implements cache.ListWatch -// using it. -type genListWatcher[T k8sRuntime.Object] struct { - lw typedListWatcher[T] -} - -func (g *genListWatcher[T]) List(opts metav1.ListOptions) (k8sRuntime.Object, error) { - return g.lw.List(context.Background(), opts) -} - -func (g *genListWatcher[T]) Watch(opts metav1.ListOptions) (watch.Interface, error) { - return g.lw.Watch(context.Background(), opts) -} - -// ListerWatcherFromTyped adapts a typed k8s client to cache.ListerWatcher so it can be used -// with an informer. With this construction we can use fake clients for testing, -// which would not be possible if we used NewListWatchFromClient and RESTClient(). -func ListerWatcherFromTyped[T k8sRuntime.Object](lw typedListWatcher[T]) cache.ListerWatcher { - return &genListWatcher[T]{lw: lw} -} - -type listWatcherWithModifier struct { - inner cache.ListerWatcher - optsModifier func(*metav1.ListOptions) -} - -func (lw *listWatcherWithModifier) List(opts metav1.ListOptions) (k8sRuntime.Object, error) { - lw.optsModifier(&opts) - return lw.inner.List(opts) -} - -func (lw *listWatcherWithModifier) Watch(opts metav1.ListOptions) (watch.Interface, error) { - lw.optsModifier(&opts) - return lw.inner.Watch(opts) -} - -func ListerWatcherWithFields(lw cache.ListerWatcher, fieldSelector fields.Selector) cache.ListerWatcher { - return ListerWatcherWithModifier( - lw, - func(opts *metav1.ListOptions) { opts.FieldSelector = fieldSelector.String() }) -} - -func ListerWatcherWithModifier(lw cache.ListerWatcher, optsModifier func(*metav1.ListOptions)) cache.ListerWatcher { - return &listWatcherWithModifier{ - inner: lw, - optsModifier: optsModifier, - } -} - -func ListerWatcherWithModifiers(lw cache.ListerWatcher, opts ...func(*metav1.ListOptions)) cache.ListerWatcher { - for _, opt := range opts { - lw = ListerWatcherWithModifier(lw, opt) - } - return lw -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/utils/utils.go b/vendor/github.com/cilium/cilium/pkg/k8s/utils/utils.go deleted file mode 100644 index 3964b0e87..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/utils/utils.go +++ /dev/null @@ -1,272 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package utils - -import ( - "net" - "sort" - "strings" - - v1 "k8s.io/api/core/v1" - discoveryv1 "k8s.io/api/discovery/v1" - v1meta "k8s.io/apimachinery/pkg/apis/meta/v1" - - "github.com/cilium/cilium/pkg/ip" - k8sconst "github.com/cilium/cilium/pkg/k8s/apis/cilium.io" - slim_corev1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/labels" - "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/selection" - labelsPkg "github.com/cilium/cilium/pkg/labels" -) - -const ( - // ServiceProxyNameLabel is the label for service proxy name in k8s service related - // objects. - serviceProxyNameLabel = "service.kubernetes.io/service-proxy-name" - // EndpointSliceMeshControllerName is a unique value used with LabelManagedBy to indicate - // the component managing an EndpointSlice. - EndpointSliceMeshControllerName = "endpointslice-mesh-controller.cilium.io" -) - -type NamespaceNameGetter interface { - GetNamespace() string - GetName() string -} - -// ExtractNamespace extracts the namespace of ObjectMeta. -// For cluster scoped objects the Namespace field is empty and this function -// assumes that the object is returned from kubernetes itself implying that -// the namespace is empty only and only when the Object is cluster scoped -// and thus returns empty namespace for such objects. -func ExtractNamespace(np NamespaceNameGetter) string { - return np.GetNamespace() -} - -// ExtractNamespaceOrDefault extracts the namespace of ObjectMeta, it returns default -// namespace if the namespace field in the ObjectMeta is empty. -func ExtractNamespaceOrDefault(np NamespaceNameGetter) string { - ns := np.GetNamespace() - if ns == "" { - return v1.NamespaceDefault - } - - return ns -} - -// GetObjNamespaceName returns the object's namespace and name. -// If the object is cluster scoped then the function returns only the object name -// without any namespace prefix. -func GetObjNamespaceName(obj NamespaceNameGetter) string { - ns := ExtractNamespace(obj) - if ns == "" { - return obj.GetName() - } - - return ns + "/" + obj.GetName() -} - -// PolicyConfiguration is the required configuration for K8s NetworkPolicy -type PolicyConfiguration interface { - // K8sNetworkPolicyEnabled returns true if cilium agent needs to support K8s NetworkPolicy - K8sNetworkPolicyEnabled() bool -} - -// GetEndpointSliceListOptionsModifier returns the options modifier for endpointSlice object list. -// This methods returns a ListOptions modifier which adds a label selector to -// select all endpointSlice objects they are not from remote clusters in Cilium cluster mesh. -// This is mostly the same behavior as kube-proxy except the cluster mesh behavior which is -// tied to how Cilium internally works with clustermesh endpoints and that this function also doesn't ignore headless Services. -// Given label mirroring from the service objects to endpoint slice objects were introduced in Kubernetes PR 94443, -// and released as part of Kubernetes v1.20; we can start using GetServiceAndEndpointListOptionsModifier for -// endpoint slices when dropping support for Kubernetes v1.19 and older. We can do that since the -// serviceProxyNameLabel label will then be mirrored to endpoint slices for services with that label. -// We also ignore Kubernetes endpoints coming from other clusters in the Cilium clustermesh here as -// Cilium does not rely on mirrored Kubernetes EndpointSlice for any of its functionalities. -func GetEndpointSliceListOptionsModifier() (func(options *v1meta.ListOptions), error) { - nonRemoteEndpointSelector, err := labels.NewRequirement(discoveryv1.LabelManagedBy, selection.NotEquals, []string{EndpointSliceMeshControllerName}) - if err != nil { - return nil, err - } - - labelSelector := labels.NewSelector() - labelSelector = labelSelector.Add(*nonRemoteEndpointSelector) - - return func(options *v1meta.ListOptions) { - options.LabelSelector = labelSelector.String() - }, nil -} - -// GetServiceAndEndpointListOptionsModifier returns the options modifier for service and endpoint object lists. -// This methods returns a ListOptions modifier which adds a label selector to only -// select services that are in context of Cilium. -// Unlike kube-proxy Cilium does not select services/endpoints containing k8s headless service label. -// We honor service.kubernetes.io/service-proxy-name label in the service object and only -// handle services that match our service proxy name. If the service proxy name for Cilium -// is an empty string, we assume that Cilium is the default service handler in which case -// we select all services that don't have the above mentioned label. -func GetServiceAndEndpointListOptionsModifier(k8sServiceProxy string) (func(options *v1meta.ListOptions), error) { - var ( - serviceNameSelector *labels.Requirement - err error - ) - - if k8sServiceProxy == "" { - serviceNameSelector, err = labels.NewRequirement( - serviceProxyNameLabel, selection.DoesNotExist, nil) - } else { - serviceNameSelector, err = labels.NewRequirement( - serviceProxyNameLabel, selection.DoubleEquals, []string{k8sServiceProxy}) - } - - if err != nil { - return nil, err - } - - labelSelector := labels.NewSelector() - labelSelector = labelSelector.Add(*serviceNameSelector) - - return func(options *v1meta.ListOptions) { - options.LabelSelector = labelSelector.String() - }, nil -} - -// GetLatestPodReadiness returns the lastest podReady condition on a given pod. -func GetLatestPodReadiness(podStatus slim_corev1.PodStatus) slim_corev1.ConditionStatus { - for _, cond := range podStatus.Conditions { - if cond.Type == slim_corev1.PodReady { - return cond.Status - } - } - return slim_corev1.ConditionUnknown -} - -// ValidIPs return a sorted slice of unique IP addresses retrieved from the given PodStatus. -// Returns an error when no IPs are found. -func ValidIPs(podStatus slim_corev1.PodStatus) []string { - if len(podStatus.PodIPs) == 0 && len(podStatus.PodIP) == 0 { - return nil - } - - // make it a set first to avoid repeated IP addresses - ipsMap := make(map[string]struct{}, 1+len(podStatus.PodIPs)) - if podStatus.PodIP != "" { - ipsMap[podStatus.PodIP] = struct{}{} - } - for _, podIP := range podStatus.PodIPs { - if podIP.IP != "" { - ipsMap[podIP.IP] = struct{}{} - } - } - - ips := make([]string, 0, len(ipsMap)) - for ipStr := range ipsMap { - ips = append(ips, ipStr) - } - sort.Strings(ips) - return ips -} - -// IsPodRunning returns true if the pod is considered to be in running state. -// We consider a Running pod a pod that does not report a Failed nor a Succeeded -// pod Phase. -func IsPodRunning(status slim_corev1.PodStatus) bool { - switch status.Phase { - case slim_corev1.PodFailed, slim_corev1.PodSucceeded: - return false - } - return true -} - -// GetClusterIPByFamily returns a service clusterip by family. -// From - https://github.com/kubernetes/kubernetes/blob/release-1.20/pkg/proxy/util/utils.go#L386-L411 -func GetClusterIPByFamily(ipFamily slim_corev1.IPFamily, service *slim_corev1.Service) string { - // allowing skew - if len(service.Spec.IPFamilies) == 0 { - if len(service.Spec.ClusterIP) == 0 || service.Spec.ClusterIP == v1.ClusterIPNone { - return "" - } - - IsIPv6Family := (ipFamily == slim_corev1.IPv6Protocol) - if IsIPv6Family == ip.IsIPv6(net.ParseIP(service.Spec.ClusterIP)) { - return service.Spec.ClusterIP - } - - return "" - } - - for idx, family := range service.Spec.IPFamilies { - if family == ipFamily { - if idx < len(service.Spec.ClusterIPs) { - return service.Spec.ClusterIPs[idx] - } - } - } - - return "" -} - -// nameLabelsGetter is an interface that returns the name and the labels for -// the namespace. -type nameLabelsGetter interface { - GetName() string - GetLabels() map[string]string -} - -// filterPodLabels returns a copy of the given labels map, without the labels owned by Cilium. -func filterPodLabels(labels map[string]string) map[string]string { - res := map[string]string{} - for k, v := range labels { - if strings.HasPrefix(k, k8sconst.LabelPrefix) { - continue - } - res[k] = v - } - return res -} - -// SanitizePodLabels makes sure that no important pod labels were overridden manually on k8s pod -// object creation. -func SanitizePodLabels(podLabels map[string]string, namespace nameLabelsGetter, serviceAccount, clusterName string) map[string]string { - sanitizedLabels := filterPodLabels(podLabels) - - // Sanitize namespace labels - for k, v := range namespace.GetLabels() { - sanitizedLabels[joinPath(k8sconst.PodNamespaceMetaLabels, k)] = v - } - // Sanitize namespace name label - sanitizedLabels[k8sconst.PodNamespaceLabel] = namespace.GetName() - // Sanitize service account name - if serviceAccount != "" { - sanitizedLabels[k8sconst.PolicyLabelServiceAccount] = serviceAccount - } else { - delete(sanitizedLabels, k8sconst.PolicyLabelServiceAccount) - } - // Sanitize cluster name - sanitizedLabels[k8sconst.PolicyLabelCluster] = clusterName - - return sanitizedLabels -} - -// StripPodSpecialLabels strips labels that are not supposed to be coming from a k8s pod object update. -func StripPodSpecialLabels(labels map[string]string) map[string]string { - sanitizedLabels := make(map[string]string) - for k, v := range filterPodLabels(labels) { - // If the key contains the prefix for namespace labels then we will - // ignore it. - if strings.HasPrefix(k, k8sconst.PodNamespaceMetaLabels) { - continue - } - // Also ignore it if the key is a kubernetes namespace label. - if k == k8sconst.PodNamespaceLabel { - continue - } - sanitizedLabels[k] = v - } - return sanitizedLabels -} - -// joinPath mimics JoinPath from pkg/policy/utils, which could not be imported here due to circular dependency -func joinPath(a, b string) string { - return a + labelsPkg.PathDelimiter + b -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/utils/workload.go b/vendor/github.com/cilium/cilium/pkg/k8s/utils/workload.go deleted file mode 100644 index 4b7d338ee..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/utils/workload.go +++ /dev/null @@ -1,94 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Copyright Istio Authors -// Copyright Authors of Hubble - -// GetWorkloadMetaFromPod and cronJobNameRegexp are copied from -// https://github.com/istio/istio/blob/1aca7a67afd7b3e1d24fafb2fbfbeaf1e41534c0/pkg/kube/util.go -// -// Modifications: -// GetDeployMetaFromPod has been renamed to GetWorkloadMetaFromPod and has -// been updated to use the cilium slim API types. -// We do not store the APIVersion of the owning workload in the TypeMeta -// either, because it isn't needed for our purposes, and our slim types do not -// have this field. -// We fallback to the pod's ownerReference if we cannot find a more suitable -// workload based on heuristics, whereas the original code defaulted to the -// pod's name. This may be the case when using ReplicaSets without a Deployment. - -package utils - -import ( - "regexp" - "strings" - - slim_corev1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1" - slim_metav1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" -) - -var cronJobNameRegexp = regexp.MustCompile(`(.+)-\d{8,10}$`) - -// GetWorkloadMetaFromPod heuristically derives workload metadata from the pod spec. -func GetWorkloadMetaFromPod(pod *slim_corev1.Pod) (slim_metav1.ObjectMeta, slim_metav1.TypeMeta, bool) { - if pod == nil { - return slim_metav1.ObjectMeta{}, slim_metav1.TypeMeta{}, false - } - // try to capture more useful namespace/name info for deployments, etc. - // TODO(dougreid): expand to enable lookup of OWNERs recursively a la kubernetesenv - workloadObjectMeta := pod.ObjectMeta - workloadObjectMeta.OwnerReferences = nil - - var ok bool - var typeMetadata slim_metav1.TypeMeta - if len(pod.GenerateName) > 0 { - // if the pod name was generated (or is scheduled for generation), we can begin an investigation into the controlling reference for the pod. - var controllerRef slim_metav1.OwnerReference - controllerFound := false - for _, ref := range pod.OwnerReferences { - if ref.Controller != nil && *ref.Controller { - controllerRef = ref - controllerFound = true - break - } - } - if controllerFound { - ok = true - // default to the owner kind/name - typeMetadata.Kind = controllerRef.Kind - workloadObjectMeta.Name = controllerRef.Name - - // heuristic for deployment detection - if typeMetadata.Kind == "ReplicaSet" && pod.Labels["pod-template-hash"] != "" && strings.HasSuffix(controllerRef.Name, pod.Labels["pod-template-hash"]) { - name := strings.TrimSuffix(controllerRef.Name, "-"+pod.Labels["pod-template-hash"]) - workloadObjectMeta.Name = name - typeMetadata.Kind = "Deployment" - } else if typeMetadata.Kind == "ReplicaSet" && pod.Labels["pod-template-hash"] == "" { - workloadObjectMeta.Name = controllerRef.Name - typeMetadata.Kind = "ReplicaSet" - } else if typeMetadata.Kind == "ReplicationController" && pod.Labels["deploymentconfig"] != "" { - // If the pod is controlled by the replication controller, which is created by the DeploymentConfig resource in - // Openshift platform, set the deploy name to the deployment config's name, and the kind to 'DeploymentConfig'. - // - // nolint: lll - // For DeploymentConfig details, refer to - // https://docs.openshift.com/container-platform/4.1/applications/deployments/what-deployments-are.html#deployments-and-deploymentconfigs_what-deployments-are - // - // For the reference to the pod label 'deploymentconfig', refer to - // https://github.com/openshift/library-go/blob/7a65fdb398e28782ee1650959a5e0419121e97ae/pkg/apps/appsutil/const.go#L25 - workloadObjectMeta.Name = pod.Labels["deploymentconfig"] - typeMetadata.Kind = "DeploymentConfig" - delete(workloadObjectMeta.Labels, "deploymentconfig") - } else if typeMetadata.Kind == "Job" { - // If job name suffixed with `-`, where the length of digit timestamp is 8~10, - // trim the suffix and set kind to cron job. - if jn := cronJobNameRegexp.FindStringSubmatch(controllerRef.Name); len(jn) == 2 { - workloadObjectMeta.Name = jn[1] - typeMetadata.Kind = "CronJob" - } - } - } - } - - return workloadObjectMeta, typeMetadata, ok -} diff --git a/vendor/github.com/cilium/cilium/pkg/k8s/version/version.go b/vendor/github.com/cilium/cilium/pkg/k8s/version/version.go deleted file mode 100644 index db2bab995..000000000 --- a/vendor/github.com/cilium/cilium/pkg/k8s/version/version.go +++ /dev/null @@ -1,309 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Package version keeps track of the Kubernetes version the client is -// connected to -package version - -import ( - "context" - "fmt" - - "github.com/blang/semver/v4" - "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/kubernetes" - - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/versioncheck" -) - -var log = logging.DefaultLogger.WithField(logfields.LogSubsys, "k8s") - -// ServerCapabilities is a list of server capabilities derived based on -// version, the Kubernetes discovery API, or probing of individual API -// endpoints. -type ServerCapabilities struct { - // MinimalVersionMet is true when the minimal version of Kubernetes - // required to run Cilium has been met - MinimalVersionMet bool - - // EndpointSlice is the ability of k8s server to support endpoint slices - EndpointSlice bool - - // EndpointSliceV1 is the ability of k8s server to support endpoint slices - // v1. This version was introduced in K8s v1.21.0. - EndpointSliceV1 bool - - // LeasesResourceLock is the ability of K8s server to support Lease type - // from coordination.k8s.io/v1 API for leader election purposes(currently only in operator). - // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#lease-v1-coordination-k8s-io - // - // This capability was introduced in K8s version 1.14, prior to which - // we don't support HA mode for the cilium-operator. - LeasesResourceLock bool -} - -type cachedVersion struct { - mutex lock.RWMutex - capabilities ServerCapabilities - version semver.Version -} - -const ( - // MinimalVersionConstraint is the minimal version that Cilium supports to - // run kubernetes. - MinimalVersionConstraint = "1.16.0" -) - -var ( - cached = cachedVersion{} - - discoveryAPIGroupV1beta1 = "discovery.k8s.io/v1beta1" - discoveryAPIGroupV1 = "discovery.k8s.io/v1" - coordinationV1APIGroup = "coordination.k8s.io/v1" - endpointSliceKind = "EndpointSlice" - leaseKind = "Lease" - - // Constraint to check support for discovery/v1 types. Support for v1 - // discovery was introduced in K8s version 1.21. - isGEThanAPIDiscoveryV1 = versioncheck.MustCompile(">=1.21.0") - - // Constraint to check support for discovery/v1beta1 types. Support for - // v1beta1 discovery was introduced in K8s version 1.17. - isGEThanAPIDiscoveryV1Beta1 = versioncheck.MustCompile(">=1.17.0") - - // isGEThanMinimalVersionConstraint is the minimal version required to run - // Cilium - isGEThanMinimalVersionConstraint = versioncheck.MustCompile(">=" + MinimalVersionConstraint) -) - -// Version returns the version of the Kubernetes apiserver -func Version() semver.Version { - cached.mutex.RLock() - c := cached.version - cached.mutex.RUnlock() - return c -} - -// Capabilities returns the capabilities of the Kubernetes apiserver -func Capabilities() ServerCapabilities { - cached.mutex.RLock() - c := cached.capabilities - cached.mutex.RUnlock() - return c -} - -func DisableLeasesResourceLock() { - cached.mutex.Lock() - defer cached.mutex.Unlock() - cached.capabilities.LeasesResourceLock = false -} - -func updateVersion(version semver.Version) { - cached.mutex.Lock() - defer cached.mutex.Unlock() - - cached.version = version - - cached.capabilities.MinimalVersionMet = isGEThanMinimalVersionConstraint(version) - cached.capabilities.EndpointSliceV1 = isGEThanAPIDiscoveryV1(version) - cached.capabilities.EndpointSlice = isGEThanAPIDiscoveryV1Beta1(version) -} - -func updateServerGroupsAndResources(apiResourceLists []*metav1.APIResourceList) { - cached.mutex.Lock() - defer cached.mutex.Unlock() - - cached.capabilities.EndpointSlice = false - cached.capabilities.EndpointSliceV1 = false - cached.capabilities.LeasesResourceLock = false - for _, rscList := range apiResourceLists { - if rscList.GroupVersion == discoveryAPIGroupV1beta1 { - for _, rsc := range rscList.APIResources { - if rsc.Kind == endpointSliceKind { - cached.capabilities.EndpointSlice = true - break - } - } - } - if rscList.GroupVersion == discoveryAPIGroupV1 { - for _, rsc := range rscList.APIResources { - if rsc.Kind == endpointSliceKind { - cached.capabilities.EndpointSlice = true - cached.capabilities.EndpointSliceV1 = true - break - } - } - } - - if rscList.GroupVersion == coordinationV1APIGroup { - for _, rsc := range rscList.APIResources { - if rsc.Kind == leaseKind { - cached.capabilities.LeasesResourceLock = true - break - } - } - } - } -} - -// Force forces the use of a specific version -func Force(version string) error { - ver, err := versioncheck.Version(version) - if err != nil { - return err - } - updateVersion(ver) - return nil -} - -func endpointSlicesFallbackDiscovery(client kubernetes.Interface) error { - // If a k8s version with discovery v1 is used, then do not even bother - // checking for v1beta1 - cached.mutex.Lock() - if cached.capabilities.EndpointSliceV1 { - cached.capabilities.EndpointSlice = true - cached.mutex.Unlock() - return nil - } - cached.mutex.Unlock() - - // Discovery of API groups requires the API services of the apiserver to be - // healthy. Such API services can depend on the readiness of regular pods - // which require Cilium to function correctly. By treating failure to - // discover API groups as fatal, a critial loop can be entered in which - // Cilium cannot start because the API groups can't be discovered. - // - // Here we acknowledge the lack of discovery ability as non Fatal and fall back to probing - // the API directly. - _, err := client.DiscoveryV1beta1().EndpointSlices("default").Get(context.TODO(), "kubernetes", metav1.GetOptions{}) - if err == nil { - cached.mutex.Lock() - cached.capabilities.EndpointSlice = true - cached.mutex.Unlock() - return nil - } - - if errors.IsNotFound(err) { - log.WithError(err).Info("Unable to retrieve EndpointSlices for default/kubernetes. Disabling EndpointSlices") - // StatusNotFound is a safe error, EndpointSlices are - // disabled and the agent can continue. - return nil - } - - // Unknown error, we can't derive whether to enable or disable - // EndpointSlices and need to error out. - return fmt.Errorf("unable to validate EndpointSlices support: %w", err) -} - -func leasesFallbackDiscovery(client kubernetes.Interface, apiDiscoveryEnabled bool) error { - // apiDiscoveryEnabled is used to fallback leases discovery to directly - // probing the API when we cannot discover API groups. - // We require to check for Leases capabilities in operator only, which uses Leases - // for leader election purposes in HA mode. - if !apiDiscoveryEnabled { - log.Debugf("Skipping Leases support fallback discovery") - return nil - } - - // Similar to endpointSlicesFallbackDiscovery here we fallback to probing the Kubernetes - // API directly. `kube-controller-manager` creates a lease in the kube-system namespace - // and here we try and see if that Lease exists. - _, err := client.CoordinationV1().Leases("kube-system").Get(context.TODO(), "kube-controller-manager", metav1.GetOptions{}) - if err == nil { - cached.mutex.Lock() - cached.capabilities.LeasesResourceLock = true - cached.mutex.Unlock() - return nil - } - - if errors.IsNotFound(err) { - log.WithError(err).Info("Unable to retrieve Leases for kube-controller-manager. Disabling LeasesResourceLock") - // StatusNotFound is a safe error, Leases are - // disabled and the agent can continue - return nil - } - - // Unknown error, we can't derive whether to enable or disable - // LeasesResourceLock and need to error out - return fmt.Errorf("unable to validate LeasesResourceLock support: %w", err) -} - -func updateK8sServerVersion(client kubernetes.Interface) error { - var ver semver.Version - - sv, err := client.Discovery().ServerVersion() - if err != nil { - return err - } - - // Try GitVersion first. In case of error fallback to MajorMinor - if sv.GitVersion != "" { - // This is a string like "v1.9.0" - ver, err = versioncheck.Version(sv.GitVersion) - if err == nil { - updateVersion(ver) - return nil - } - } - - if sv.Major != "" && sv.Minor != "" { - ver, err = versioncheck.Version(fmt.Sprintf("%s.%s", sv.Major, sv.Minor)) - if err == nil { - updateVersion(ver) - return nil - } - } - - return fmt.Errorf("cannot parse k8s server version from %+v: %w", sv, err) -} - -// Update retrieves the version of the Kubernetes apiserver and derives the -// capabilities. This function must be called after connectivity to the -// apiserver has been established. -// -// Discovery of capabilities only works if the discovery API of the apiserver -// is functional. If it is not available, a warning is logged and the discovery -// falls back to probing individual API endpoints. -func Update(client kubernetes.Interface, apiDiscoveryEnabled bool) error { - err := updateK8sServerVersion(client) - if err != nil { - return err - } - - if apiDiscoveryEnabled { - // Discovery of API groups requires the API services of the - // apiserver to be healthy. Such API services can depend on the - // readiness of regular pods which require Cilium to function - // correctly. By treating failure to discover API groups as - // fatal, a critical loop can be entered in which Cilium cannot - // start because the API groups can't be discovered and th API - // groups will only become discoverable once Cilium is up. - _, apiResourceLists, err := client.Discovery().ServerGroupsAndResources() - if err != nil { - // It doesn't make sense to retry the retrieval of this - // information at a later point because the capabilities are - // primiarly used while the agent is starting up. Instead, fall - // back to probing API endpoints directly. - log.WithError(err).Warning("Unable to discover API groups and resources") - if err := endpointSlicesFallbackDiscovery(client); err != nil { - return err - } - - return leasesFallbackDiscovery(client, apiDiscoveryEnabled) - } - - updateServerGroupsAndResources(apiResourceLists) - } else { - if err := endpointSlicesFallbackDiscovery(client); err != nil { - return err - } - - return leasesFallbackDiscovery(client, apiDiscoveryEnabled) - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/allocator/allocator.go b/vendor/github.com/cilium/cilium/pkg/kvstore/allocator/allocator.go deleted file mode 100644 index d42ae3bdd..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/allocator/allocator.go +++ /dev/null @@ -1,627 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package allocator - -import ( - "context" - "fmt" - "path" - "strconv" - "strings" - - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/pkg/allocator" - "github.com/cilium/cilium/pkg/idpool" - "github.com/cilium/cilium/pkg/kvstore" - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/rate" -) - -var ( - log = logging.DefaultLogger.WithField(logfields.LogSubsys, "kvstorebackend") -) - -// kvstoreBackend is an implementaton of pkg/allocator.Backend. It store -// identities in the following format: -// -// Slave keys: -// -// Slave keys are owned by individual nodes: -// - basePath/value/key1/node1 => 1001 -// - basePath/value/key1/node2 => 1001 -// - basePath/value/key2/node1 => 1002 -// - basePath/value/key2/node2 => 1002 -// -// If at least one key exists with the prefix basePath/value/keyN then that -// key must be considered to be in use in the allocation space. -// -// Slave keys are protected by a lease and will automatically get removed -// after ~ option.Config.KVstoreLeaseTTL if the node does not renew in time. -// -// Master key: -// - basePath/id/1001 => key1 -// - basePath/id/1002 => key2 -// -// Master keys provide the mapping from ID to key. As long as a master key -// for an ID exists, the ID is still in use. However, if a master key is no -// longer backed by at least one slave key, the garbage collector will -// eventually release the master key and return it back to the pool. -type kvstoreBackend struct { - // basePrefix is the prefix in the kvstore that all keys share which - // are being managed by this allocator. The basePrefix typically - // consists of something like: "space/project/allocatorName" - basePrefix string - - // idPrefix is the kvstore key prefix for all master keys. It is being - // derived from the basePrefix. - idPrefix string - - // valuePrefix is the kvstore key prefix for all slave keys. It is - // being derived from the basePrefix. - valuePrefix string - - // lockPrefix is the prefix to use for all kvstore locks. This prefix - // is different from the idPrefix and valuePrefix to simplify watching - // for ID and key changes. - lockPrefix string - - // suffix is the suffix attached to keys which must be node specific, - // this is typical set to the node's IP address - suffix string - - backend kvstore.BackendOperations - - keyType allocator.AllocatorKey -} - -func prefixMatchesKey(prefix, key string) bool { - // cilium/state/identities/v1/value/label;foo;bar;/172.0.124.60 - lastSlash := strings.LastIndex(key, "/") - return len(prefix) == lastSlash -} - -// NewKVStoreBackend creates a pkg/allocator.Backend compatible instance. The -// specific kvstore used is configured in pkg/kvstore. -func NewKVStoreBackend(basePath, suffix string, typ allocator.AllocatorKey, backend kvstore.BackendOperations) (*kvstoreBackend, error) { - if backend == nil { - return nil, fmt.Errorf("kvstore client not configured") - } - - return &kvstoreBackend{ - basePrefix: basePath, - idPrefix: path.Join(basePath, "id"), - valuePrefix: path.Join(basePath, "value"), - lockPrefix: path.Join(basePath, "locks"), - suffix: suffix, - keyType: typ, - backend: backend, - }, nil -} - -// lockPath locks a key in the scope of an allocator -func (k *kvstoreBackend) lockPath(ctx context.Context, key string) (*kvstore.Lock, error) { - suffix := strings.TrimPrefix(key, k.basePrefix) - return kvstore.LockPath(ctx, k.backend, path.Join(k.lockPrefix, suffix)) -} - -// DeleteAllKeys will delete all keys -func (k *kvstoreBackend) DeleteAllKeys(ctx context.Context) { - k.backend.DeletePrefix(ctx, k.basePrefix) -} - -// AllocateID allocates a key->ID mapping in the kvstore. -func (k *kvstoreBackend) AllocateID(ctx context.Context, id idpool.ID, key allocator.AllocatorKey) (allocator.AllocatorKey, error) { - // create /id/ and fail if it already exists - keyPath := path.Join(k.idPrefix, id.String()) - keyEncoded := []byte(k.backend.Encode([]byte(key.GetKey()))) - success, err := k.backend.CreateOnly(ctx, keyPath, keyEncoded, false) - if err != nil || !success { - return nil, fmt.Errorf("unable to create master key '%s': %w", keyPath, err) - } - - return key, nil -} - -// AllocateID allocates a key->ID mapping in the kvstore. -func (k *kvstoreBackend) AllocateIDIfLocked(ctx context.Context, id idpool.ID, key allocator.AllocatorKey, lock kvstore.KVLocker) (allocator.AllocatorKey, error) { - // create /id/ and fail if it already exists - keyPath := path.Join(k.idPrefix, id.String()) - keyEncoded := []byte(k.backend.Encode([]byte(key.GetKey()))) - success, err := k.backend.CreateOnlyIfLocked(ctx, keyPath, keyEncoded, false, lock) - if err != nil || !success { - return nil, fmt.Errorf("unable to create master key '%s': %w", keyPath, err) - } - - return key, nil -} - -// AcquireReference marks that this node is using this key->ID mapping in the kvstore. -func (k *kvstoreBackend) AcquireReference(ctx context.Context, id idpool.ID, key allocator.AllocatorKey, lock kvstore.KVLocker) error { - keyString := k.backend.Encode([]byte(key.GetKey())) - if err := k.createValueNodeKey(ctx, keyString, id, lock); err != nil { - return fmt.Errorf("unable to create slave key '%s': %w", keyString, err) - } - return nil -} - -// createValueKey records that this "node" is using this key->ID -func (k *kvstoreBackend) createValueNodeKey(ctx context.Context, key string, newID idpool.ID, lock kvstore.KVLocker) error { - // add a new key /value// to account for the reference - // The key is protected with a TTL/lease and will expire after LeaseTTL - valueKey := path.Join(k.valuePrefix, key, k.suffix) - if _, err := k.backend.UpdateIfDifferentIfLocked(ctx, valueKey, []byte(newID.String()), true, lock); err != nil { - return fmt.Errorf("unable to create value-node key '%s': %w", valueKey, err) - } - - return nil -} - -// Lock locks a key in the scope of an allocator -func (k *kvstoreBackend) lock(ctx context.Context, key string) (*kvstore.Lock, error) { - suffix := strings.TrimPrefix(key, k.basePrefix) - return kvstore.LockPath(ctx, k.backend, path.Join(k.lockPrefix, suffix)) -} - -// Lock locks a key in the scope of an allocator -func (k *kvstoreBackend) Lock(ctx context.Context, key allocator.AllocatorKey) (kvstore.KVLocker, error) { - return k.lock(ctx, k.backend.Encode([]byte(key.GetKey()))) -} - -// Get returns the ID which is allocated to a key in the kvstore -func (k *kvstoreBackend) Get(ctx context.Context, key allocator.AllocatorKey) (idpool.ID, error) { - // ListPrefix() will return all keys matching the prefix, the prefix - // can cover multiple different keys, example: - // - // key1 := label1;label2; - // key2 := label1;label2;label3; - // - // In order to retrieve the correct key, the position of the last '/' - // is significant, e.g. - // - // prefix := cilium/state/identities/v1/value/label;foo; - // - // key1 := cilium/state/identities/v1/value/label;foo;/172.0.124.60 - // key2 := cilium/state/identities/v1/value/label;foo;bar;/172.0.124.60 - // - // Only key1 should match - prefix := path.Join(k.valuePrefix, k.backend.Encode([]byte(key.GetKey()))) - pairs, err := k.backend.ListPrefix(ctx, prefix) - kvstore.Trace("ListPrefix", err, logrus.Fields{logfields.Prefix: prefix, logfields.Entries: len(pairs)}) - if err != nil { - return 0, err - } - - for k, v := range pairs { - if prefixMatchesKey(prefix, k) { - id, err := strconv.ParseUint(string(v.Data), 10, 64) - if err == nil { - return idpool.ID(id), nil - } - } - } - - return idpool.NoID, nil -} - -// GetIfLocked returns the ID which is allocated to a key in the kvstore -// if the client is still holding the given lock. -func (k *kvstoreBackend) GetIfLocked(ctx context.Context, key allocator.AllocatorKey, lock kvstore.KVLocker) (idpool.ID, error) { - // ListPrefixIfLocked() will return all keys matching the prefix, the prefix - // can cover multiple different keys, example: - // - // key1 := label1;label2; - // key2 := label1;label2;label3; - // - // In order to retrieve the correct key, the position of the last '/' - // is significant, e.g. - // - // prefix := cilium/state/identities/v1/value/label;foo; - // - // key1 := cilium/state/identities/v1/value/label;foo;/172.0.124.60 - // key2 := cilium/state/identities/v1/value/label;foo;bar;/172.0.124.60 - // - // Only key1 should match - prefix := path.Join(k.valuePrefix, k.backend.Encode([]byte(key.GetKey()))) - pairs, err := k.backend.ListPrefixIfLocked(ctx, prefix, lock) - kvstore.Trace("ListPrefixLocked", err, logrus.Fields{logfields.Prefix: prefix, logfields.Entries: len(pairs)}) - if err != nil { - return 0, err - } - - for k, v := range pairs { - if prefixMatchesKey(prefix, k) { - id, err := strconv.ParseUint(string(v.Data), 10, 64) - if err == nil { - return idpool.ID(id), nil - } - } - } - - return idpool.NoID, nil -} - -// GetByID returns the key associated with an ID. Returns nil if no key is -// associated with the ID. -func (k *kvstoreBackend) GetByID(ctx context.Context, id idpool.ID) (allocator.AllocatorKey, error) { - v, err := k.backend.Get(ctx, path.Join(k.idPrefix, id.String())) - if err != nil { - return nil, err - } - - if v == nil { - return nil, nil - } - - s, err := k.backend.Decode(string(v)) - if err != nil { - return nil, err - } - - return k.keyType.PutKey(string(s)), nil -} - -// UpdateKey refreshes the record that this node is using this key -> id -// mapping. When reliablyMissing is set it will also recreate missing master or -// slave keys. -func (k *kvstoreBackend) UpdateKey(ctx context.Context, id idpool.ID, key allocator.AllocatorKey, reliablyMissing bool) error { - var ( - err error - recreated bool - keyPath = path.Join(k.idPrefix, id.String()) - keyEncoded = []byte(k.backend.Encode([]byte(key.GetKey()))) - valueKey = path.Join(k.valuePrefix, k.backend.Encode([]byte(key.GetKey())), k.suffix) - ) - - // Use of CreateOnly() ensures that any existing potentially - // conflicting key is never overwritten. - success, err := k.backend.CreateOnly(ctx, keyPath, keyEncoded, false) - switch { - case err != nil: - return fmt.Errorf("Unable to re-create missing master key \"%s\" -> \"%s\": %w", logfields.Key, valueKey, err) - case success: - log.WithField(logfields.Key, keyPath).Warning("Re-created missing master key") - } - - // Also re-create the slave key in case it has been deleted. This will - // ensure that the next garbage collection cycle of any participating - // node does not remove the master key again. - if reliablyMissing { - recreated, err = k.backend.CreateOnly(ctx, valueKey, []byte(id.String()), true) - } else { - recreated, err = k.backend.UpdateIfDifferent(ctx, valueKey, []byte(id.String()), true) - } - switch { - case err != nil: - return fmt.Errorf("Unable to re-create missing slave key \"%s\" -> \"%s\": %w", logfields.Key, valueKey, err) - case recreated: - log.WithField(logfields.Key, valueKey).Warning("Re-created missing slave key") - } - - return nil -} - -// UpdateKeyIfLocked refreshes the record that this node is using this key -> id -// mapping. When reliablyMissing is set it will also recreate missing master or -// slave keys. -func (k *kvstoreBackend) UpdateKeyIfLocked(ctx context.Context, id idpool.ID, key allocator.AllocatorKey, reliablyMissing bool, lock kvstore.KVLocker) error { - var ( - err error - recreated bool - keyPath = path.Join(k.idPrefix, id.String()) - keyEncoded = []byte(k.backend.Encode([]byte(key.GetKey()))) - valueKey = path.Join(k.valuePrefix, k.backend.Encode([]byte(key.GetKey())), k.suffix) - ) - - // Use of CreateOnly() ensures that any existing potentially - // conflicting key is never overwritten. - success, err := k.backend.CreateOnlyIfLocked(ctx, keyPath, keyEncoded, false, lock) - switch { - case err != nil: - return fmt.Errorf("Unable to re-create missing master key \"%s\" -> \"%s\": %w", logfields.Key, valueKey, err) - case success: - log.WithField(logfields.Key, keyPath).Warning("Re-created missing master key") - } - - // Also re-create the slave key in case it has been deleted. This will - // ensure that the next garbage collection cycle of any participating - // node does not remove the master key again. - // lock is ignored since the key doesn't exist. - if reliablyMissing { - recreated, err = k.backend.CreateOnly(ctx, valueKey, []byte(id.String()), true) - } else { - recreated, err = k.backend.UpdateIfDifferentIfLocked(ctx, valueKey, []byte(id.String()), true, lock) - } - switch { - case err != nil: - return fmt.Errorf("Unable to re-create missing slave key \"%s\" -> \"%s\": %w", logfields.Key, valueKey, err) - case recreated: - log.WithField(logfields.Key, valueKey).Warning("Re-created missing slave key") - } - - return nil -} - -// Release releases the use of an ID associated with the provided key. It does -// not guard against concurrent releases. This is currently guarded by -// Allocator.slaveKeysMutex when called from pkg/allocator.Allocator.Release. -func (k *kvstoreBackend) Release(ctx context.Context, _ idpool.ID, key allocator.AllocatorKey) (err error) { - valueKey := path.Join(k.valuePrefix, k.backend.Encode([]byte(key.GetKey())), k.suffix) - log.WithField(logfields.Key, key).Info("Released last local use of key, invoking global release") - - // does not need to be deleted with a lock as its protected by the - // Allocator.slaveKeysMutex - if err := k.backend.Delete(ctx, valueKey); err != nil { - log.WithError(err).WithFields(logrus.Fields{logfields.Key: key}).Warning("Ignoring node specific ID") - return err - } - - // if k.lockless { - // FIXME: etcd 3.3 will make it possible to do a lockless - // cleanup of the ID and release it right away. For now we rely - // on the GC to kick in a release unused IDs. - // } - - return nil -} - -// RunLocksGC scans the kvstore for unused locks and removes them. Returns -// a map of locks that are currently being held, including the ones that have -// failed to be GCed. -func (k *kvstoreBackend) RunLocksGC(ctx context.Context, staleKeysPrevRound map[string]kvstore.Value) (map[string]kvstore.Value, error) { - // fetch list of all /../locks keys - allocated, err := k.backend.ListPrefix(ctx, k.lockPrefix) - if err != nil { - return nil, fmt.Errorf("list failed: %w", err) - } - - staleKeys := map[string]kvstore.Value{} - - // iterate over /../locks - for key, v := range allocated { - scopedLog := log.WithFields(logrus.Fields{ - logfields.Key: key, - logfields.LeaseID: strconv.FormatUint(uint64(v.LeaseID), 16), - }) - // Only delete if this key was previously marked as to be deleted - if modRev, ok := staleKeysPrevRound[key]; ok && - // comparing ModRevision ensures the same client is still holding - // this lock since the last GC was called. - modRev.ModRevision == v.ModRevision && - modRev.LeaseID == v.LeaseID && - modRev.SessionID == v.SessionID { - if err := k.backend.Delete(ctx, key); err == nil { - scopedLog.Warning("Forcefully removed distributed lock due to client staleness." + - " Please check the connectivity between the KVStore and the client with that lease ID.") - continue - } - scopedLog.WithError(err). - Warning("Unable to remove distributed lock due to client staleness." + - " Please check the connectivity between the KVStore and the client with that lease ID.") - } - // If the key was not found mark it to be delete in the next RunGC - staleKeys[key] = kvstore.Value{ - ModRevision: v.ModRevision, - LeaseID: v.LeaseID, - SessionID: v.SessionID, - } - } - - return staleKeys, nil -} - -// RunGC scans the kvstore for unused master keys and removes them -func (k *kvstoreBackend) RunGC( - ctx context.Context, - rateLimit *rate.Limiter, - staleKeysPrevRound map[string]uint64, - minID, maxID idpool.ID, -) (map[string]uint64, *allocator.GCStats, error) { - - // fetch list of all /id/ keys - allocated, err := k.backend.ListPrefix(ctx, k.idPrefix) - if err != nil { - return nil, nil, fmt.Errorf("list failed: %w", err) - } - - totalEntries := len(allocated) - deletedEntries := 0 - - staleKeys := map[string]uint64{} - - min := uint64(minID) - max := uint64(maxID) - reasonOutOfRange := "out of local cluster identity range [" + strconv.FormatUint(min, 10) + "," + strconv.FormatUint(max, 10) + "]" - - // iterate over /id/ - for key, v := range allocated { - // if k.lockless { - // FIXME: Add DeleteOnZeroCount support - // } - - // Parse identity ID - items := strings.Split(key, "/") - if len(items) == 0 { - log.WithField(logfields.Key, key).WithError(err).Warning("Unknown identity key found, skipping") - continue - } - - if identityID, err := strconv.ParseUint(items[len(items)-1], 10, 64); err != nil { - log.WithField(logfields.Key, key).WithError(err).Warning("Parse identity failed, skipping") - continue - } else { - // We should not GC those identities that are out of our scope - if identityID < min || identityID > max { - log.WithFields(logrus.Fields{ - logfields.Key: key, - logfields.Reason: reasonOutOfRange, - }).Debug("Skipping this key") - continue - } - } - - lock, err := k.lockPath(ctx, key) - if err != nil { - log.WithError(err).WithField(logfields.Key, key).Warning("allocator garbage collector was unable to lock key") - continue - } - - // fetch list of all /value/ keys - valueKeyPrefix := path.Join(k.valuePrefix, string(v.Data)) - pairs, err := k.backend.ListPrefixIfLocked(ctx, valueKeyPrefix, lock) - if err != nil { - log.WithError(err).WithField(logfields.Prefix, valueKeyPrefix).Warning("allocator garbage collector was unable to list keys") - lock.Unlock(context.Background()) - continue - } - - hasUsers := false - for prefix := range pairs { - if prefixMatchesKey(valueKeyPrefix, prefix) { - hasUsers = true - break - } - } - - var deleted bool - // if ID has no user, delete it - if !hasUsers { - scopedLog := log.WithFields(logrus.Fields{ - logfields.Key: key, - logfields.Identity: path.Base(key), - }) - // Only delete if this key was previously marked as to be deleted - if modRev, ok := staleKeysPrevRound[key]; ok { - // if the v.ModRevision is different than the modRev (which is - // the last seen v.ModRevision) then this key was re-used in - // between GC calls. We should not mark it as stale keys yet, - // but the next GC call will do it. - if modRev == v.ModRevision { - if err := k.backend.DeleteIfLocked(ctx, key, lock); err != nil { - scopedLog.WithError(err).Warning("Unable to delete unused allocator master key") - } else { - deletedEntries++ - scopedLog.Info("Deleted unused allocator master key") - } - // consider the key regardless if there was an error from - // the kvstore. We want to rate limit the number of requests - // done to the KVStore. - deleted = true - } - } else { - // If the key was not found mark it to be delete in the next RunGC - staleKeys[key] = v.ModRevision - } - } - - lock.Unlock(context.Background()) - if deleted { - // Wait after deleted the key. This is not ideal because we have - // done the operation that should be rate limited before checking the - // rate limit. We have to do this here to avoid holding the global lock - // for a long period of time. - err = rateLimit.Wait(ctx) - if err != nil { - return nil, nil, err - } - } - } - - gcStats := &allocator.GCStats{ - Alive: totalEntries - deletedEntries, - Deleted: deletedEntries, - } - return staleKeys, gcStats, nil -} - -func (k *kvstoreBackend) keyToID(key string) (id idpool.ID, err error) { - if !strings.HasPrefix(key, k.idPrefix) { - return idpool.NoID, fmt.Errorf("Found invalid key \"%s\" outside of prefix \"%s\"", key, k.idPrefix) - } - - suffix := strings.TrimPrefix(key, k.idPrefix) - if suffix[0] == '/' { - suffix = suffix[1:] - } - - idParsed, err := strconv.ParseUint(suffix, 10, 64) - if err != nil { - return idpool.NoID, fmt.Errorf("Cannot parse key suffix \"%s\"", suffix) - } - - return idpool.ID(idParsed), nil -} - -func (k *kvstoreBackend) ListAndWatch(ctx context.Context, handler allocator.CacheMutations, stopChan chan struct{}) { - watcher := k.backend.ListAndWatch(ctx, k.idPrefix, 512) - - for { - select { - case event, ok := <-watcher.Events: - if !ok { - goto abort - } - if event.Typ == kvstore.EventTypeListDone { - handler.OnListDone() - continue - } - - id, err := k.keyToID(event.Key) - switch { - case err != nil: - log.WithError(err).WithField(logfields.Key, event.Key).Warning("Invalid key") - - case id != idpool.NoID: - var key allocator.AllocatorKey - - if len(event.Value) > 0 { - s, err := k.backend.Decode(string(event.Value)) - if err != nil { - log.WithError(err).WithFields(logrus.Fields{ - logfields.Key: event.Key, - logfields.Value: event.Value, - }).Warning("Unable to decode key value") - continue - } - - key = k.keyType.PutKey(string(s)) - } else { - if event.Typ != kvstore.EventTypeDelete { - log.WithFields(logrus.Fields{ - logfields.Key: event.Key, - logfields.EventType: event.Typ, - }).Error("Received a key with an empty value") - continue - } - } - - switch event.Typ { - case kvstore.EventTypeCreate: - handler.OnAdd(id, key) - - case kvstore.EventTypeModify: - handler.OnModify(id, key) - - case kvstore.EventTypeDelete: - handler.OnDelete(id, key) - } - } - - case <-stopChan: - goto abort - } - } - -abort: - watcher.Stop() -} - -func (k *kvstoreBackend) Status() (string, error) { - return k.backend.Status() -} - -func (k *kvstoreBackend) Encode(v string) string { - return k.backend.Encode([]byte(v)) -} diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/allocator/doc.go b/vendor/github.com/cilium/cilium/pkg/kvstore/allocator/doc.go deleted file mode 100644 index 26c9a9aad..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/allocator/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Package allocator provides a kvstore based ID allocator -package allocator diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/backend.go b/vendor/github.com/cilium/cilium/pkg/kvstore/backend.go deleted file mode 100644 index b2358c98b..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/backend.go +++ /dev/null @@ -1,225 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package kvstore - -import ( - "context" - - "google.golang.org/grpc" - - "github.com/cilium/cilium/pkg/time" -) - -type backendOption struct { - // description is the description of the option - description string - - // value is the value the option has been configured to - value string - - // validate, if set, is called to validate the value before assignment - validate func(value string) error -} - -type backendOptions map[string]*backendOption - -type ClusterSizeDependantIntervalFunc func(baseInterval time.Duration) time.Duration - -// ExtraOptions represents any options that can not be represented in a textual -// format and need to be set programmatically. -type ExtraOptions struct { - DialOption []grpc.DialOption - - // ClusterSizeDependantInterval defines the function to calculate - // intervals based on cluster size - ClusterSizeDependantInterval ClusterSizeDependantIntervalFunc - - // NoLockQuorumCheck disables the lock acquisition quorum check - NoLockQuorumCheck bool - - // ClusterName is the name of each etcd cluster - ClusterName string - - // BootstrapComplete is an optional channel that can be provided to signal - // to the client that bootstrap is complete. If provided, the client will - // have an initial rate limit equal to etcd.bootstrapQps and be updated to - // etcd.qps after this channel is closed. - BootstrapComplete <-chan struct{} - - // NoEndpointStatusChecks disables the status checks for the endpoints - NoEndpointStatusChecks bool -} - -// StatusCheckInterval returns the interval of status checks depending on the -// cluster size and the current connectivity state -// -// nodes OK Failing -// 1 20s 3s -// 4 45s 7s -// 8 1m05s 11s -// 32 1m45s 18s -// 128 2m25s 24s -// 512 3m07s 32s -// 2048 3m46s 38s -// 8192 4m30s 45s -func (e *ExtraOptions) StatusCheckInterval(allConnected bool) time.Duration { - interval := 30 * time.Second - - // Reduce the interval while connectivity issues are being detected - if !allConnected { - interval = 5 * time.Second - } - - if e != nil && e.ClusterSizeDependantInterval != nil { - interval = e.ClusterSizeDependantInterval(interval) - } - return interval -} - -// backendModule is the interface that each kvstore backend has to implement. -type backendModule interface { - // getName must return the name of the backend - getName() string - - // setConfig must configure the backend with the specified options. - // This function is called once before newClient(). - setConfig(opts map[string]string) error - - // setExtraConfig sets more options in the kvstore that are not able to - // be set by strings. - setExtraConfig(opts *ExtraOptions) error - - // setConfigDummy must configure the backend with dummy configuration - // for testing purposes. This is a replacement for setConfig(). - setConfigDummy() - - // getConfig must return the backend configuration. - getConfig() map[string]string - - // newClient must initializes the backend and create a new kvstore - // client which implements the BackendOperations interface - newClient(ctx context.Context, opts *ExtraOptions) (BackendOperations, chan error) - - // createInstance creates a new instance of the module - createInstance() backendModule -} - -var ( - // registeredBackends is a slice of all backends that have registered - // itself via registerBackend() - registeredBackends = map[string]backendModule{} -) - -// registerBackend must be called by kvstore backends to register themselves -func registerBackend(name string, module backendModule) { - if _, ok := registeredBackends[name]; ok { - log.Panicf("backend with name '%s' already registered", name) - } - - registeredBackends[name] = module -} - -// getBackend finds a registered backend by name -func getBackend(name string) backendModule { - if backend, ok := registeredBackends[name]; ok { - return backend.createInstance() - } - - return nil -} - -// BackendOperations are the individual kvstore operations that each backend -// must implement. Direct use of this interface is possible but will bypass the -// tracing layer. -type BackendOperations interface { - // Connected returns a channel which is closed whenever the kvstore client - // is connected to the kvstore server. - Connected(ctx context.Context) <-chan error - - // Disconnected returns a channel which is closed whenever the kvstore - // client is not connected to the kvstore server. (Only implemented for etcd) - Disconnected() <-chan struct{} - - // Status returns the status of the kvstore client including an - // eventual error - Status() (string, error) - - // StatusCheckErrors returns a channel which receives status check - // errors - StatusCheckErrors() <-chan error - - // LockPath locks the provided path - LockPath(ctx context.Context, path string) (KVLocker, error) - - // Get returns value of key - Get(ctx context.Context, key string) ([]byte, error) - - // GetIfLocked returns value of key if the client is still holding the given lock. - GetIfLocked(ctx context.Context, key string, lock KVLocker) ([]byte, error) - - // Delete deletes a key. It does not return an error if the key does not exist. - Delete(ctx context.Context, key string) error - - // DeleteIfLocked deletes a key if the client is still holding the given lock. It does not return an error if the key does not exist. - DeleteIfLocked(ctx context.Context, key string, lock KVLocker) error - - DeletePrefix(ctx context.Context, path string) error - - // Update creates or updates a key. - Update(ctx context.Context, key string, value []byte, lease bool) error - - // UpdateIfLocked updates a key if the client is still holding the given lock. - UpdateIfLocked(ctx context.Context, key string, value []byte, lease bool, lock KVLocker) error - - // UpdateIfDifferent updates a key if the value is different - UpdateIfDifferent(ctx context.Context, key string, value []byte, lease bool) (bool, error) - - // UpdateIfDifferentIfLocked updates a key if the value is different and if the client is still holding the given lock. - UpdateIfDifferentIfLocked(ctx context.Context, key string, value []byte, lease bool, lock KVLocker) (bool, error) - - // CreateOnly atomically creates a key or fails if it already exists - CreateOnly(ctx context.Context, key string, value []byte, lease bool) (bool, error) - - // CreateOnlyIfLocked atomically creates a key if the client is still holding the given lock or fails if it already exists - CreateOnlyIfLocked(ctx context.Context, key string, value []byte, lease bool, lock KVLocker) (bool, error) - - // ListPrefix returns a list of keys matching the prefix - ListPrefix(ctx context.Context, prefix string) (KeyValuePairs, error) - - // ListPrefixIfLocked returns a list of keys matching the prefix only if the client is still holding the given lock. - ListPrefixIfLocked(ctx context.Context, prefix string, lock KVLocker) (KeyValuePairs, error) - - // Close closes the kvstore client - Close(ctx context.Context) - - // Encodes a binary slice into a character set that the backend - // supports - Encode(in []byte) string - - // Decodes a key previously encoded back into the original binary slice - Decode(in string) ([]byte, error) - - // ListAndWatch creates a new watcher which will watch the specified - // prefix for changes. Before doing this, it will list the current keys - // matching the prefix and report them as new keys. The Events channel is - // created with the specified sizes. Upon every change observed, a - // KeyValueEvent will be sent to the Events channel - ListAndWatch(ctx context.Context, prefix string, chanSize int) *Watcher - - // RegisterLeaseExpiredObserver registers a function which is executed when - // the lease associated with a key having the given prefix is detected as expired. - // If the function is nil, the previous observer (if any) is unregistered. - RegisterLeaseExpiredObserver(prefix string, fn func(key string)) - - BackendOperationsUserMgmt -} - -// BackendOperationsUserMgmt are the kvstore operations for users management. -type BackendOperationsUserMgmt interface { - // UserEnforcePresence creates a user in the kvstore if not already present, and grants the specified roles. - UserEnforcePresence(ctx context.Context, name string, roles []string) error - - // UserEnforcePresence deletes a user from the kvstore, if present. - UserEnforceAbsence(ctx context.Context, name string) error -} diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/backwards_compat.go b/vendor/github.com/cilium/cilium/pkg/kvstore/backwards_compat.go deleted file mode 100644 index a5417c5b1..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/backwards_compat.go +++ /dev/null @@ -1,31 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package kvstore - -import "context" - -const ( - // OperationalPath is the base path to store the operational details in the kvstore. - OperationalPath = "cilium-net/operational" - - // servicePathV1 is the base path for the services stored in the kvstore. - servicePathV1 = OperationalPath + "/Services/" -) - -// deleteLegacyPrefixes removes old kvstore prefixes of non-persistent keys -// which have been used in the past but have been obsoleted since. We remove -// them on agent start to ensure that as users upgrade, we do not leave behind -// stale keys -// -// Rules: -// -// - For non-persistent state, obsoletd prefixes can be deleted as soon as the -// prefix has been declared obsolete -// - For persistent configuration stored in the kvstore, a forward upgrade -// path must be created which automatically removes the old keys on successful -// translation. -func deleteLegacyPrefixes(ctx context.Context) { - // Delete all keys in old services prefix - Client().DeletePrefix(ctx, servicePathV1) -} diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/cell.go b/vendor/github.com/cilium/cilium/pkg/kvstore/cell.go deleted file mode 100644 index e74840a9a..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/cell.go +++ /dev/null @@ -1,155 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package kvstore - -import ( - "context" - "errors" - "fmt" - "sync" - - "github.com/cilium/hive/cell" - "github.com/spf13/pflag" - - "github.com/cilium/cilium/pkg/defaults" - "github.com/cilium/cilium/pkg/hive" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/option" - "github.com/cilium/cilium/pkg/promise" - "github.com/cilium/cilium/pkg/time" -) - -// Cell returns a cell which provides a promise for the global kvstore client. -// The parameter allows to customize the default backend, which can be either -// set to a specific value (e.g., in the case of clustermesh-apiserver) or -// left unset. -var Cell = func(defaultBackend string) cell.Cell { - return cell.Module( - "kvstore-client", - "KVStore Client", - - cell.Config(config{ - KVStore: defaultBackend, - KVStoreConnectivityTimeout: defaults.KVstoreConnectivityTimeout, - KVStoreLeaseTTL: defaults.KVstoreLeaseTTL, - KVStorePeriodicSync: defaults.KVstorePeriodicSync, - }), - - cell.Provide(func(lc cell.Lifecycle, shutdowner hive.Shutdowner, cfg config, opts *ExtraOptions) promise.Promise[BackendOperations] { - resolver, promise := promise.New[BackendOperations]() - if cfg.KVStore == "" { - log.Info("Skipping connection to kvstore, as not configured") - resolver.Reject(errors.New("kvstore not configured")) - return promise - } - - // Propagate the options to the global variables for backward compatibility - option.Config.KVStore = cfg.KVStore - option.Config.KVStoreOpt = cfg.KVStoreOpt - option.Config.KVstoreConnectivityTimeout = cfg.KVStoreConnectivityTimeout - option.Config.KVstoreLeaseTTL = cfg.KVStoreLeaseTTL - option.Config.KVstorePeriodicSync = cfg.KVStorePeriodicSync - - ctx, cancel := context.WithCancel(context.Background()) - var wg sync.WaitGroup - - lc.Append(cell.Hook{ - OnStart: func(cell.HookContext) error { - wg.Add(1) - go func() { - defer wg.Done() - - log := log.WithField(logfields.BackendName, cfg.KVStore) - log.Info("Establishing connection to kvstore") - backend, errCh := NewClient(ctx, cfg.KVStore, cfg.KVStoreOpt, opts) - - if err, isErr := <-errCh; isErr { - log.WithError(err).Error("Failed to establish connection to kvstore") - resolver.Reject(fmt.Errorf("failed connecting to kvstore: %w", err)) - shutdowner.Shutdown(hive.ShutdownWithError(err)) - return - } - - log.Info("Connection to kvstore successfully established") - resolver.Resolve(backend) - }() - return nil - }, - OnStop: func(cell.HookContext) error { - cancel() - wg.Wait() - - // We don't explicitly close the backend here, because that would - // attempt to revoke the lease, causing all entries associated - // with that lease to be deleted. This would not be the - // behavior expected by the consumers of this cell. - return nil - }, - }) - - return promise - }), - ) -} - -type config struct { - KVStore string - KVStoreOpt map[string]string - KVStoreConnectivityTimeout time.Duration - KVStoreLeaseTTL time.Duration - KVStorePeriodicSync time.Duration -} - -func (def config) Flags(flags *pflag.FlagSet) { - flags.String(option.KVStore, def.KVStore, "Key-value store type") - - flags.StringToString(option.KVStoreOpt, def.KVStoreOpt, - "Key-value store options e.g. etcd.address=127.0.0.1:4001") - - flags.Duration(option.KVstoreConnectivityTimeout, def.KVStoreConnectivityTimeout, - "Time after which an incomplete kvstore operation is considered failed") - - flags.Duration(option.KVstoreLeaseTTL, def.KVStoreLeaseTTL, - "Time-to-live for the KVstore lease.") - flags.MarkHidden(option.KVstoreLeaseTTL) - - flags.Duration(option.KVstorePeriodicSync, def.KVStorePeriodicSync, - "Periodic KVstore synchronization interval") -} - -// GlobalUserMgmtClientPromiseCell provides a promise returning the global kvstore client to perform users -// management operations, once it has been initialized. -var GlobalUserMgmtClientPromiseCell = cell.Module( - "global-kvstore-users-client", - "Global KVStore Users Management Client Promise", - - cell.Provide(func(lc cell.Lifecycle, backendPromise promise.Promise[BackendOperations]) promise.Promise[BackendOperationsUserMgmt] { - resolver, promise := promise.New[BackendOperationsUserMgmt]() - ctx, cancel := context.WithCancel(context.Background()) - var wg sync.WaitGroup - - lc.Append(cell.Hook{ - OnStart: func(cell.HookContext) error { - wg.Add(1) - go func() { - backend, err := backendPromise.Await(ctx) - if err != nil { - resolver.Reject(err) - } else { - resolver.Resolve(backend) - } - wg.Done() - }() - return nil - }, - OnStop: func(cell.HookContext) error { - cancel() - wg.Wait() - return nil - }, - }) - - return promise - }), -) diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/client.go b/vendor/github.com/cilium/cilium/pkg/kvstore/client.go deleted file mode 100644 index 60b68f109..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/client.go +++ /dev/null @@ -1,104 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package kvstore - -import ( - "context" - "fmt" - - "github.com/cilium/cilium/pkg/option" - "github.com/cilium/cilium/pkg/time" -) - -var ( - // defaultClient is the default client initialized by initClient - defaultClient BackendOperations - // defaultClientSet is a channel that is closed whenever the defaultClient - // is set. - defaultClientSet = make(chan struct{}) -) - -func initClient(ctx context.Context, module backendModule, opts *ExtraOptions) error { - scopedLog := log.WithField(fieldKVStoreModule, module.getName()) - c, errChan := module.newClient(ctx, opts) - if c == nil { - err := <-errChan - scopedLog.WithError(err).Fatal("Unable to create kvstore client") - } - - defaultClient = c - select { - case <-defaultClientSet: - // avoid closing channel already closed. - default: - close(defaultClientSet) - } - - go func() { - err, isErr := <-errChan - if isErr && err != nil { - scopedLog.WithError(err).Fatal("Unable to connect to kvstore") - } - if !option.Config.JoinCluster { - deleteLegacyPrefixes(ctx) - } - }() - - return nil -} - -// Client returns the global kvstore, blocking until it has been configured -func Client() BackendOperations { - <-defaultClientSet - return defaultClient -} - -// NewClient returns a new kvstore client based on the configuration -func NewClient(ctx context.Context, selectedBackend string, opts map[string]string, options *ExtraOptions) (BackendOperations, chan error) { - // Channel used to report immediate errors, module.newClient will - // create and return a different channel, caller doesn't need to know - errChan := make(chan error, 1) - defer close(errChan) - - module := getBackend(selectedBackend) - if module == nil { - errChan <- fmt.Errorf("unknown key-value store type %q. See cilium.link/err-kvstore for details", selectedBackend) - return nil, errChan - } - - if err := module.setConfig(opts); err != nil { - errChan <- err - return nil, errChan - } - - if err := module.setExtraConfig(options); err != nil { - errChan <- err - return nil, errChan - } - - return module.newClient(ctx, options) -} - -// Connected returns a channel which is closed when the following conditions -// are being met at the same time: -// * The kvstore client is configured -// * Connectivity to the kvstore has been established -// * The kvstore has quorum -// -// The channel will *not* be closed if the kvstore client is closed before -// connectivity or quorum has been achieved. It will wait until a new kvstore -// client is configured to again wait for connectivity and quorum. -func Connected() <-chan struct{} { - c := make(chan struct{}) - go func(c chan struct{}) { - for { - if err := <-Client().Connected(context.Background()); err == nil { - close(c) - return - } - time.Sleep(100 * time.Millisecond) - } - }(c) - return c -} diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/config.go b/vendor/github.com/cilium/cilium/pkg/kvstore/config.go deleted file mode 100644 index 7e85d4f06..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/config.go +++ /dev/null @@ -1,103 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package kvstore - -import ( - "context" - "fmt" - "sync" - - "github.com/cilium/cilium/pkg/logging/logfields" -) - -var ( - // selectedModule is the name of the selected backend module - selectedModule string -) - -// setOpts validates the specified options against the selected backend and -// then modifies the configuration -func setOpts(opts map[string]string, supportedOpts backendOptions) error { - errors := 0 - - for key, val := range opts { - opt, ok := supportedOpts[key] - if !ok { - errors++ - log.WithField(logfields.Key, key).Error("unknown kvstore configuration key") - continue - } - - if opt.validate != nil { - if err := opt.validate(val); err != nil { - log.WithError(err).Errorf("invalid value for key %s", key) - errors++ - } - } - - } - - // if errors have occurred, print the supported configuration keys to - // the log - if errors > 0 { - log.Error("Supported configuration keys:") - for key, val := range supportedOpts { - log.Errorf(" %-12s %s", key, val.description) - } - - return fmt.Errorf("invalid kvstore configuration, see log for details") - } - - // modify the configuration atomically after verification - for key, val := range opts { - supportedOpts[key].value = val - } - - return nil -} - -func getOpts(opts backendOptions) map[string]string { - result := map[string]string{} - - for key, opt := range opts { - result[key] = opt.value - } - - return result -} - -var ( - setupOnce sync.Once -) - -func setup(ctx context.Context, selectedBackend string, opts map[string]string, goOpts *ExtraOptions) error { - module := getBackend(selectedBackend) - if module == nil { - return fmt.Errorf("unknown key-value store type %q. See cilium.link/err-kvstore for details", selectedBackend) - } - - if err := module.setConfig(opts); err != nil { - return err - } - - if err := module.setExtraConfig(goOpts); err != nil { - return err - } - - selectedModule = module.getName() - - return initClient(ctx, module, goOpts) -} - -// Setup sets up the key-value store specified in kvStore and configures it -// with the options provided in opts -func Setup(ctx context.Context, selectedBackend string, opts map[string]string, goOpts *ExtraOptions) error { - var err error - - setupOnce.Do(func() { - err = setup(ctx, selectedBackend, opts, goOpts) - }) - - return err -} diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/consul.go b/vendor/github.com/cilium/cilium/pkg/kvstore/consul.go deleted file mode 100644 index 2c5e9a6fe..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/consul.go +++ /dev/null @@ -1,699 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package kvstore - -import ( - "bytes" - "context" - "encoding/base64" - "errors" - "fmt" - "os" - - consulAPI "github.com/hashicorp/consul/api" - "github.com/sirupsen/logrus" - "gopkg.in/yaml.v3" - - "github.com/cilium/cilium/pkg/backoff" - "github.com/cilium/cilium/pkg/controller" - "github.com/cilium/cilium/pkg/inctimer" - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/option" - "github.com/cilium/cilium/pkg/spanstat" - "github.com/cilium/cilium/pkg/time" -) - -const ( - consulName = "consul" - - // ConsulAddrOption is the string representing the key mapping to the value of the - // address for Consul. - ConsulAddrOption = "consul.address" - ConsulOptionConfig = "consul.tlsconfig" - - // maxLockRetries is the number of retries attempted when acquiring a lock - maxLockRetries = 10 -) - -type consulModule struct { - opts backendOptions - config *consulAPI.Config -} - -var ( - // consulDummyAddress can be overwritten from test invokers using ldflags - consulDummyAddress = "https://127.0.0.1:8501" - // consulDummyConfigFile can be overwritten from test invokers using ldflags - consulDummyConfigFile = "/tmp/cilium-consul-certs/cilium-consul.yaml" - - module = newConsulModule() - - // ErrNotImplemented is the error which is returned when a functionality is not implemented. - ErrNotImplemented = errors.New("not implemented") - - consulLeaseKeepaliveControllerGroup = controller.NewGroup("consul-lease-keepalive") -) - -func init() { - // register consul module for use - registerBackend(consulName, module) -} - -func newConsulModule() backendModule { - return &consulModule{ - opts: backendOptions{ - ConsulAddrOption: &backendOption{ - description: "Addresses of consul cluster", - }, - ConsulOptionConfig: &backendOption{ - description: "Path to consul tls configuration file", - }, - }, - } -} - -func ConsulDummyAddress() string { - return consulDummyAddress -} - -func ConsulDummyConfigFile() string { - return consulDummyConfigFile -} - -func (c *consulModule) createInstance() backendModule { - return newConsulModule() -} - -func (c *consulModule) getName() string { - return consulName -} - -func (c *consulModule) setConfigDummy() { - c.config = consulAPI.DefaultConfig() - c.config.Address = consulDummyAddress - yc := consulAPI.TLSConfig{} - b, err := os.ReadFile(consulDummyConfigFile) - if err != nil { - log.WithError(err).Warnf("unable to read consul tls configuration file %s", consulDummyConfigFile) - } - - err = yaml.Unmarshal(b, &yc) - if err != nil { - log.WithError(err).Warnf("invalid consul tls configuration in %s", consulDummyConfigFile) - } - - c.config.TLSConfig = yc -} - -func (c *consulModule) setConfig(opts map[string]string) error { - return setOpts(opts, c.opts) -} - -func (c *consulModule) setExtraConfig(opts *ExtraOptions) error { - return nil -} - -func (c *consulModule) getConfig() map[string]string { - return getOpts(c.opts) -} - -func (c *consulModule) newClient(ctx context.Context, opts *ExtraOptions) (BackendOperations, chan error) { - log.WithFields(logrus.Fields{ - logfields.URL: "https://cilium.herokuapp.com/", - }).Warning("Support for Consul as a kvstore backend has been deprecated due to lack of maintainers. If you are interested in helping to maintain Consul support in Cilium, please reach out on GitHub or the official Cilium slack") - - errChan := make(chan error, 1) - backend, err := c.connectConsulClient(ctx, opts) - if err != nil { - errChan <- err - } - close(errChan) - return backend, errChan -} - -func (c *consulModule) connectConsulClient(ctx context.Context, opts *ExtraOptions) (BackendOperations, error) { - if c.config == nil { - consulAddr, consulAddrSet := c.opts[ConsulAddrOption] - configPathOpt, configPathOptSet := c.opts[ConsulOptionConfig] - if !consulAddrSet { - return nil, fmt.Errorf("invalid consul configuration, please specify %s option", ConsulAddrOption) - } - - if consulAddr.value == "" { - return nil, fmt.Errorf("invalid consul configuration, please specify %s option", ConsulAddrOption) - } - - addr := consulAddr.value - c.config = consulAPI.DefaultConfig() - if configPathOptSet && configPathOpt.value != "" { - b, err := os.ReadFile(configPathOpt.value) - if err != nil { - return nil, fmt.Errorf("unable to read consul tls configuration file %s: %w", configPathOpt.value, err) - } - yc := consulAPI.TLSConfig{} - err = yaml.Unmarshal(b, &yc) - if err != nil { - return nil, fmt.Errorf("invalid consul tls configuration in %s: %w", configPathOpt.value, err) - } - c.config.TLSConfig = yc - } - - c.config.Address = addr - - } - client, err := newConsulClient(ctx, c.config, opts) - if err != nil { - return nil, err - } - - return client, nil -} - -var ( - maxRetries = 30 -) - -type consulClient struct { - *consulAPI.Client - lease string - controllers *controller.Manager - extraOptions *ExtraOptions - disconnectedMu lock.RWMutex - disconnected chan struct{} - statusCheckErrors chan error -} - -func newConsulClient(ctx context.Context, config *consulAPI.Config, opts *ExtraOptions) (BackendOperations, error) { - var ( - c *consulAPI.Client - err error - ) - if config != nil { - c, err = consulAPI.NewClient(config) - } else { - c, err = consulAPI.NewClient(consulAPI.DefaultConfig()) - } - if err != nil { - return nil, err - } - - boff := backoff.Exponential{Min: time.Duration(100) * time.Millisecond} - - for i := 0; i < maxRetries; i++ { - var leader string - leader, err = c.Status().Leader() - - if err == nil { - if leader != "" { - // happy path - break - } else { - err = errors.New("timeout while waiting for leader to be elected") - } - } - log.Info("Waiting for consul to elect a leader") - boff.Wait(ctx) - } - - if err != nil { - log.WithError(err).Fatal("Unable to contact consul server") - } - - entry := &consulAPI.SessionEntry{ - TTL: fmt.Sprintf("%ds", int(option.Config.KVstoreLeaseTTL.Seconds())), - Behavior: consulAPI.SessionBehaviorDelete, - } - - wo := &consulAPI.WriteOptions{} - lease, _, err := c.Session().Create(entry, wo.WithContext(ctx)) - if err != nil { - return nil, fmt.Errorf("unable to create default lease: %w", err) - } - - client := &consulClient{ - Client: c, - lease: lease, - controllers: controller.NewManager(), - extraOptions: opts, - disconnected: make(chan struct{}), - statusCheckErrors: make(chan error, 128), - } - - client.controllers.UpdateController( - fmt.Sprintf("consul-lease-keepalive-%p", c), - controller.ControllerParams{ - Group: consulLeaseKeepaliveControllerGroup, - DoFunc: func(ctx context.Context) error { - wo := &consulAPI.WriteOptions{} - _, _, err := c.Session().Renew(lease, wo.WithContext(ctx)) - if err != nil { - // consider disconnected! - client.disconnectedMu.Lock() - close(client.disconnected) - client.disconnected = make(chan struct{}) - client.disconnectedMu.Unlock() - } - return err - }, - RunInterval: option.Config.KVstoreKeepAliveInterval, - }, - ) - - return client, nil -} - -type ConsulLocker struct { - *consulAPI.Lock -} - -func (cl *ConsulLocker) Unlock(ctx context.Context) error { - return cl.Lock.Unlock() -} - -func (cl *ConsulLocker) Comparator() interface{} { - return nil -} - -func (c *consulClient) LockPath(ctx context.Context, path string) (KVLocker, error) { - lockKey, err := c.LockOpts(&consulAPI.LockOptions{Key: getLockPath(path)}) - if err != nil { - return nil, err - } - - for retries := 0; retries < maxLockRetries; retries++ { - ch, err := lockKey.Lock(nil) - switch { - case err != nil: - return nil, err - case ch == nil: - Trace("Acquiring lock timed out, retrying", nil, logrus.Fields{fieldKey: path, logfields.Attempt: retries}) - default: - return &ConsulLocker{Lock: lockKey}, err - } - - select { - case <-ctx.Done(): - return nil, fmt.Errorf("lock cancelled via context: %w", ctx.Err()) - default: - } - } - - return nil, fmt.Errorf("maximum retries (%d) reached", maxLockRetries) -} - -// watch starts watching for changes in a prefix -func (c *consulClient) watch(ctx context.Context, w *Watcher) { - // Last known state of all KVPairs matching the prefix - localState := map[string]consulAPI.KVPair{} - nextIndex := uint64(0) - - q := &consulAPI.QueryOptions{ - WaitTime: time.Second, - } - - qo := q.WithContext(ctx) - - sleepTimer, sleepTimerDone := inctimer.New() - defer sleepTimerDone() - - for { - // Initialize sleep time to a millisecond as we don't - // want to sleep in between successful watch cycles - sleepTime := 1 * time.Millisecond - - qo.WaitIndex = nextIndex - pairs, q, err := c.KV().List(w.Prefix, qo) - if err != nil { - sleepTime = 5 * time.Second - Trace("List of Watch failed", err, logrus.Fields{fieldPrefix: w.Prefix}) - } - - if q != nil { - nextIndex = q.LastIndex - } - - // timeout while watching for changes, re-schedule - if qo.WaitIndex != 0 && (q == nil || q.LastIndex == qo.WaitIndex) { - goto wait - } - - for _, newPair := range pairs { - oldPair, ok := localState[newPair.Key] - - // Keys reported for the first time must be new - if !ok { - if newPair.CreateIndex != newPair.ModifyIndex { - log.Debugf("consul: Previously unknown key %s received with CreateIndex(%d) != ModifyIndex(%d)", - newPair.Key, newPair.CreateIndex, newPair.ModifyIndex) - } - - queueStart := spanstat.Start() - w.Events <- KeyValueEvent{ - Typ: EventTypeCreate, - Key: newPair.Key, - Value: newPair.Value, - } - trackEventQueued(newPair.Key, EventTypeCreate, queueStart.End(true).Total()) - } else if oldPair.ModifyIndex != newPair.ModifyIndex { - queueStart := spanstat.Start() - w.Events <- KeyValueEvent{ - Typ: EventTypeModify, - Key: newPair.Key, - Value: newPair.Value, - } - trackEventQueued(newPair.Key, EventTypeModify, queueStart.End(true).Total()) - } - - // Everything left on localState will be assumed to - // have been deleted, therefore remove all keys in - // localState that still exist in the kvstore - delete(localState, newPair.Key) - } - - for k, deletedPair := range localState { - queueStart := spanstat.Start() - w.Events <- KeyValueEvent{ - Typ: EventTypeDelete, - Key: deletedPair.Key, - Value: deletedPair.Value, - } - trackEventQueued(deletedPair.Key, EventTypeDelete, queueStart.End(true).Total()) - delete(localState, k) - } - - for _, newPair := range pairs { - localState[newPair.Key] = *newPair - - } - - // Initial list operation has been completed, signal this - if qo.WaitIndex == 0 { - w.Events <- KeyValueEvent{Typ: EventTypeListDone} - } - - wait: - select { - case <-sleepTimer.After(sleepTime): - case <-w.stopWatch: - close(w.Events) - w.stopWait.Done() - return - } - } -} - -func (c *consulClient) waitForInitLock(ctx context.Context) <-chan struct{} { - initLockSucceeded := make(chan struct{}) - - go func() { - for { - locker, err := c.LockPath(ctx, InitLockPath) - if err == nil { - locker.Unlock(context.Background()) - close(initLockSucceeded) - log.Info("Distributed lock successful, consul has quorum") - return - } - - time.Sleep(100 * time.Millisecond) - } - }() - - return initLockSucceeded -} - -// Connected closes the returned channel when the consul client is connected. -func (c *consulClient) Connected(ctx context.Context) <-chan error { - ch := make(chan error) - go func() { - for { - qo := &consulAPI.QueryOptions{} - // TODO find out if there's a better way to do this for consul - _, _, err := c.Session().Info(c.lease, qo.WithContext(ctx)) - if err == nil { - break - } - time.Sleep(100 * time.Millisecond) - } - <-c.waitForInitLock(ctx) - close(ch) - }() - return ch -} - -// Disconnected closes the returned channel when consul detects the client -// is disconnected from the server. -func (c *consulClient) Disconnected() <-chan struct{} { - c.disconnectedMu.RLock() - ch := c.disconnected - c.disconnectedMu.RUnlock() - return ch -} - -func (c *consulClient) Status() (string, error) { - leader, err := c.Client.Status().Leader() - return "Consul: " + leader, err -} - -func (c *consulClient) DeletePrefix(ctx context.Context, path string) (err error) { - defer func() { Trace("DeletePrefix", err, logrus.Fields{fieldPrefix: path}) }() - - duration := spanstat.Start() - wo := &consulAPI.WriteOptions{} - _, err = c.Client.KV().DeleteTree(path, wo.WithContext(ctx)) - increaseMetric(path, metricDelete, "DeletePrefix", duration.EndError(err).Total(), err) - return err -} - -// DeleteIfLocked deletes a key if the client is still holding the given lock. -func (c *consulClient) DeleteIfLocked(ctx context.Context, key string, lock KVLocker) (err error) { - defer func() { Trace("DeleteIfLocked", err, logrus.Fields{fieldKey: key}) }() - return c.delete(ctx, key) -} - -// Delete deletes a key -func (c *consulClient) Delete(ctx context.Context, key string) (err error) { - defer func() { Trace("Delete", err, logrus.Fields{fieldKey: key}) }() - return c.delete(ctx, key) -} - -func (c *consulClient) delete(ctx context.Context, key string) error { - duration := spanstat.Start() - wo := &consulAPI.WriteOptions{} - _, err := c.KV().Delete(key, wo.WithContext(ctx)) - increaseMetric(key, metricDelete, "Delete", duration.EndError(err).Total(), err) - return err -} - -// GetIfLocked returns value of key if the client is still holding the given lock. -func (c *consulClient) GetIfLocked(ctx context.Context, key string, lock KVLocker) (bv []byte, err error) { - defer func() { Trace("GetIfLocked", err, logrus.Fields{fieldKey: key, fieldValue: string(bv)}) }() - return c.Get(ctx, key) -} - -// Get returns value of key -func (c *consulClient) Get(ctx context.Context, key string) (bv []byte, err error) { - defer func() { Trace("Get", err, logrus.Fields{fieldKey: key, fieldValue: string(bv)}) }() - - duration := spanstat.Start() - qo := &consulAPI.QueryOptions{} - pair, _, err := c.KV().Get(key, qo.WithContext(ctx)) - increaseMetric(key, metricRead, "Get", duration.EndError(err).Total(), err) - if err != nil { - return nil, err - } - if pair == nil { - return nil, nil - } - return pair.Value, nil -} - -// UpdateIfLocked updates a key if the client is still holding the given lock. -func (c *consulClient) UpdateIfLocked(ctx context.Context, key string, value []byte, lease bool, lock KVLocker) error { - return c.Update(ctx, key, value, lease) -} - -// Update creates or updates a key with the value -func (c *consulClient) Update(ctx context.Context, key string, value []byte, lease bool) (err error) { - defer func() { - Trace("Update", err, logrus.Fields{fieldKey: key, fieldValue: string(value), fieldAttachLease: lease}) - }() - - k := &consulAPI.KVPair{Key: key, Value: value} - - if lease { - k.Session = c.lease - } - - opts := &consulAPI.WriteOptions{} - - duration := spanstat.Start() - _, err = c.KV().Put(k, opts.WithContext(ctx)) - increaseMetric(key, metricSet, "Update", duration.EndError(err).Total(), err) - return err -} - -// UpdateIfDifferentIfLocked updates a key if the value is different and if the client is still holding the given lock. -func (c *consulClient) UpdateIfDifferentIfLocked(ctx context.Context, key string, value []byte, lease bool, lock KVLocker) (recreated bool, err error) { - defer func() { - Trace("UpdateIfDifferentIfLocked", err, logrus.Fields{fieldKey: key, fieldValue: value, fieldAttachLease: lease, "recreated": recreated}) - }() - - return c.updateIfDifferent(ctx, key, value, lease) -} - -// UpdateIfDifferent updates a key if the value is different -func (c *consulClient) UpdateIfDifferent(ctx context.Context, key string, value []byte, lease bool) (recreated bool, err error) { - defer func() { - Trace("UpdateIfDifferent", err, logrus.Fields{fieldKey: key, fieldValue: value, fieldAttachLease: lease, "recreated": recreated}) - }() - - return c.updateIfDifferent(ctx, key, value, lease) -} - -func (c *consulClient) updateIfDifferent(ctx context.Context, key string, value []byte, lease bool) (bool, error) { - duration := spanstat.Start() - qo := &consulAPI.QueryOptions{} - getR, _, err := c.KV().Get(key, qo.WithContext(ctx)) - increaseMetric(key, metricRead, "Get", duration.EndError(err).Total(), err) - // On error, attempt update blindly - if err != nil || getR == nil { - return true, c.Update(ctx, key, value, lease) - } - - if lease && getR.Session != c.lease { - return true, c.Update(ctx, key, value, lease) - } - - // if lease is different and value is not equal then update. - if !bytes.Equal(getR.Value, value) { - return true, c.Update(ctx, key, value, lease) - } - - return false, nil -} - -// CreateOnlyIfLocked atomically creates a key if the client is still holding the given lock or fails if it already exists -func (c *consulClient) CreateOnlyIfLocked(ctx context.Context, key string, value []byte, lease bool, lock KVLocker) (success bool, err error) { - defer func() { - Trace("CreateOnlyIfLocked", err, logrus.Fields{fieldKey: key, fieldValue: value, fieldAttachLease: lease, "success": success}) - }() - return c.createOnly(ctx, key, value, lease) -} - -// CreateOnly creates a key with the value and will fail if the key already exists -func (c *consulClient) CreateOnly(ctx context.Context, key string, value []byte, lease bool) (success bool, err error) { - defer func() { - Trace("CreateOnly", err, logrus.Fields{fieldKey: key, fieldValue: value, fieldAttachLease: lease, "success": success}) - }() - - return c.createOnly(ctx, key, value, lease) -} - -func (c *consulClient) createOnly(ctx context.Context, key string, value []byte, lease bool) (bool, error) { - k := &consulAPI.KVPair{ - Key: key, - Value: value, - CreateIndex: 0, - } - - if lease { - k.Session = c.lease - } - opts := &consulAPI.WriteOptions{} - - duration := spanstat.Start() - success, _, err := c.KV().CAS(k, opts.WithContext(ctx)) - increaseMetric(key, metricSet, "CreateOnly", duration.EndError(err).Total(), err) - if err != nil { - return false, fmt.Errorf("unable to compare-and-swap: %w", err) - } - return success, nil -} - -// ListPrefixIfLocked returns a list of keys matching the prefix only if the client is still holding the given lock. -func (c *consulClient) ListPrefixIfLocked(ctx context.Context, prefix string, lock KVLocker) (v KeyValuePairs, err error) { - defer func() { Trace("ListPrefixIfLocked", err, logrus.Fields{fieldPrefix: prefix, fieldNumEntries: len(v)}) }() - return c.listPrefix(ctx, prefix) -} - -// ListPrefix returns a map of matching keys -func (c *consulClient) ListPrefix(ctx context.Context, prefix string) (v KeyValuePairs, err error) { - defer func() { Trace("ListPrefix", err, logrus.Fields{fieldPrefix: prefix, fieldNumEntries: len(v)}) }() - return c.listPrefix(ctx, prefix) -} - -func (c *consulClient) listPrefix(ctx context.Context, prefix string) (KeyValuePairs, error) { - duration := spanstat.Start() - qo := &consulAPI.QueryOptions{} - pairs, _, err := c.KV().List(prefix, qo.WithContext(ctx)) - increaseMetric(prefix, metricRead, "ListPrefix", duration.EndError(err).Total(), err) - if err != nil { - return nil, err - } - - p := KeyValuePairs(make(map[string]Value, len(pairs))) - for i := 0; i < len(pairs); i++ { - p[pairs[i].Key] = Value{ - Data: pairs[i].Value, - ModRevision: pairs[i].ModifyIndex, - SessionID: pairs[i].Session, - } - } - - return p, nil -} - -// Close closes the consul session -func (c *consulClient) Close(ctx context.Context) { - close(c.statusCheckErrors) - if c.controllers != nil { - c.controllers.RemoveAll() - } - if c.lease != "" { - c.Session().Destroy(c.lease, nil) - } -} - -// Encode encodes a binary slice into a character set that the backend supports -func (c *consulClient) Encode(in []byte) (out string) { - defer func() { Trace("Encode", nil, logrus.Fields{"in": in, "out": out}) }() - return base64.URLEncoding.EncodeToString([]byte(in)) -} - -// Decode decodes a key previously encoded back into the original binary slice -func (c *consulClient) Decode(in string) (out []byte, err error) { - defer func() { Trace("Decode", err, logrus.Fields{"in": in, "out": out}) }() - return base64.URLEncoding.DecodeString(in) -} - -// ListAndWatch implements the BackendOperations.ListAndWatch using consul -func (c *consulClient) ListAndWatch(ctx context.Context, prefix string, chanSize int) *Watcher { - w := newWatcher(prefix, chanSize) - - log.WithField(fieldPrefix, prefix).Debug("Starting watcher...") - - go c.watch(ctx, w) - - return w -} - -// StatusCheckErrors returns a channel which receives status check errors -func (c *consulClient) StatusCheckErrors() <-chan error { - return c.statusCheckErrors -} - -// RegisterLeaseExpiredObserver is not implemented for the consul backend -func (c *consulClient) RegisterLeaseExpiredObserver(prefix string, fn func(key string)) {} - -// UserEnforcePresence is not implemented for the consul backend -func (c *consulClient) UserEnforcePresence(ctx context.Context, name string, roles []string) error { - return ErrNotImplemented -} - -// UserEnforceAbsence is not implemented for the consul backend -func (c *consulClient) UserEnforceAbsence(ctx context.Context, name string) error { - return ErrNotImplemented -} diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/doc.go b/vendor/github.com/cilium/cilium/pkg/kvstore/doc.go deleted file mode 100644 index b69800a22..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Package kvstore abstracts KVstore access and provides a high level API to -// atomically manage cluster wide resources -package kvstore diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/dummy.go b/vendor/github.com/cilium/cilium/pkg/kvstore/dummy.go deleted file mode 100644 index 989c24a42..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/dummy.go +++ /dev/null @@ -1,87 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package kvstore - -import ( - "context" - "testing" - - "github.com/cilium/cilium/pkg/inctimer" - "github.com/cilium/cilium/pkg/time" -) - -// SetupDummy sets up kvstore for tests. A lock mechanism it used to prevent -// the creation of two clients at the same time, to avoid interferences in case -// different tests are run in parallel. A cleanup function is automatically -// registered to delete all keys and close the client when the test terminates. -func SetupDummy(tb testing.TB, dummyBackend string) { - SetupDummyWithConfigOpts(tb, dummyBackend, nil) -} - -// SetupDummyWithConfigOpts sets up the dummy kvstore for tests but also -// configures the module with the provided opts. A lock mechanism it used to -// prevent the creation of two clients at the same time, to avoid interferences -// in case different tests are run in parallel. A cleanup function is -// automatically registered to delete all keys and close the client when the -// test terminates. -func SetupDummyWithConfigOpts(tb testing.TB, dummyBackend string, opts map[string]string) { - module := getBackend(dummyBackend) - if module == nil { - tb.Fatalf("Unknown dummy kvstore backend %s", dummyBackend) - } - - module.setConfigDummy() - - if opts != nil { - err := module.setConfig(opts) - if err != nil { - tb.Fatalf("Unable to set config options for kvstore backend module: %v", err) - } - } - - if err := initClient(context.Background(), module, nil); err != nil { - tb.Fatalf("Unable to initialize kvstore client: %v", err) - } - - tb.Cleanup(func() { - if err := Client().DeletePrefix(context.Background(), ""); err != nil { - tb.Fatalf("Unable to delete all kvstore keys: %v", err) - } - - Client().Close(context.Background()) - }) - - ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) - defer cancel() - - if err := <-Client().Connected(ctx); err != nil { - tb.Fatalf("Failed waiting for kvstore connection to be established: %v", err) - } - - timer, done := inctimer.New() - defer done() - - // Multiple tests might be running in parallel by go test if they are part of - // different packages. Let's implement a locking mechanism to ensure that only - // one at a time can access the kvstore, to prevent that they interact with - // each other. Locking is implemented through CreateOnly (rather than using - // the locking abstraction), so that we can release it in the same atomic - // transaction that also removes all the other keys. - for { - succeeded, err := Client().CreateOnly(ctx, ".lock", []byte(""), true) - if err != nil { - tb.Fatalf("Unable to acquire the kvstore lock: %v", err) - } - - if succeeded { - return - } - - select { - case <-timer.After(100 * time.Millisecond): - case <-ctx.Done(): - tb.Fatal("Timed out waiting to acquire the kvstore lock") - } - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/etcd.go b/vendor/github.com/cilium/cilium/pkg/kvstore/etcd.go deleted file mode 100644 index d95a6bf17..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/etcd.go +++ /dev/null @@ -1,1783 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package kvstore - -import ( - "bytes" - "context" - "crypto/tls" - "errors" - "fmt" - "net/url" - "os" - "strconv" - "strings" - - "github.com/sirupsen/logrus" - "go.etcd.io/etcd/api/v3/mvccpb" - v3rpcErrors "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" - "go.etcd.io/etcd/client/pkg/v3/logutil" - "go.etcd.io/etcd/client/pkg/v3/tlsutil" - client "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/client/v3/concurrency" - clientyaml "go.etcd.io/etcd/client/v3/yaml" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" - "golang.org/x/time/rate" - "sigs.k8s.io/yaml" - - "github.com/cilium/cilium/pkg/backoff" - "github.com/cilium/cilium/pkg/defaults" - "github.com/cilium/cilium/pkg/inctimer" - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/option" - "github.com/cilium/cilium/pkg/rand" - ciliumrate "github.com/cilium/cilium/pkg/rate" - ciliumratemetrics "github.com/cilium/cilium/pkg/rate/metrics" - "github.com/cilium/cilium/pkg/spanstat" - "github.com/cilium/cilium/pkg/time" -) - -const ( - // EtcdBackendName is the backend name for etcd - EtcdBackendName = "etcd" - - EtcdAddrOption = "etcd.address" - isEtcdOperatorOption = "etcd.operator" - EtcdOptionConfig = "etcd.config" - EtcdOptionKeepAliveHeartbeat = "etcd.keepaliveHeartbeat" - EtcdOptionKeepAliveTimeout = "etcd.keepaliveTimeout" - - // EtcdRateLimitOption specifies maximum kv operations per second - EtcdRateLimitOption = "etcd.qps" - - // EtcdBootstrapRateLimitOption specifies maximum kv operations per second - // during bootstrapping - EtcdBootstrapRateLimitOption = "etcd.bootstrapQps" - - // EtcdMaxInflightOption specifies maximum inflight concurrent kv store operations - EtcdMaxInflightOption = "etcd.maxInflight" - - // EtcdListLimitOption limits the number of results retrieved in one batch - // by ListAndWatch operations. A 0 value equals to no limit. - EtcdListLimitOption = "etcd.limit" - - // etcdMaxKeysPerLease is the maximum number of keys that can be attached to a lease - etcdMaxKeysPerLease = 1000 -) - -var ( - // ErrLockLeaseExpired is an error whenever the lease of the lock does not - // exist or it was expired. - ErrLockLeaseExpired = errors.New("transaction did not succeed: lock lease expired") - - randGen = rand.NewSafeRand(time.Now().UnixNano()) -) - -type etcdModule struct { - opts backendOptions - config *client.Config -} - -var ( - // statusCheckTimeout is the timeout when performing status checks with - // all etcd endpoints - statusCheckTimeout = 10 * time.Second - - // initialConnectionTimeout is the timeout for the initial connection to - // the etcd server - initialConnectionTimeout = 15 * time.Minute - - // etcdDummyAddress can be overwritten from test invokers using ldflags - etcdDummyAddress = "http://127.0.0.1:4002" - - etcdInstance = newEtcdModule() - - // etcd3ClientLogger is the logger used for the underlying etcd clients. We - // explicitly initialize a logger and propagate it to prevent each client from - // automatically creating a new one, which comes with a significant memory cost. - etcd3ClientLogger *zap.Logger -) - -func EtcdDummyAddress() string { - return etcdDummyAddress -} - -func newEtcdModule() backendModule { - return &etcdModule{ - opts: backendOptions{ - isEtcdOperatorOption: &backendOption{ - description: "if the configuration is setting up an etcd-operator", - }, - EtcdAddrOption: &backendOption{ - description: "Addresses of etcd cluster", - }, - EtcdOptionConfig: &backendOption{ - description: "Path to etcd configuration file", - }, - EtcdOptionKeepAliveTimeout: &backendOption{ - description: "Timeout after which an unanswered heartbeat triggers the connection to be closed", - validate: func(v string) error { - _, err := time.ParseDuration(v) - return err - }, - }, - EtcdOptionKeepAliveHeartbeat: &backendOption{ - description: "Heartbeat interval to keep gRPC connection alive", - validate: func(v string) error { - _, err := time.ParseDuration(v) - return err - }, - }, - EtcdRateLimitOption: &backendOption{ - description: "Rate limit in kv store operations per second", - validate: func(v string) error { - _, err := strconv.Atoi(v) - return err - }, - }, - EtcdBootstrapRateLimitOption: &backendOption{ - description: "Rate limit in kv store operations per second during bootstrapping", - validate: func(v string) error { - _, err := strconv.Atoi(v) - return err - }, - }, - EtcdMaxInflightOption: &backendOption{ - description: "Maximum inflight concurrent kv store operations; defaults to etcd.qps if unset", - validate: func(v string) error { - _, err := strconv.Atoi(v) - return err - }, - }, - EtcdListLimitOption: &backendOption{ - description: "Max number of results retrieved in one batch by ListAndWatch operations (0 = no limit)", - validate: func(v string) error { - _, err := strconv.Atoi(v) - return err - }, - }, - }, - } -} - -func (e *etcdModule) createInstance() backendModule { - return newEtcdModule() -} - -func (e *etcdModule) getName() string { - return EtcdBackendName -} - -func (e *etcdModule) setConfigDummy() { - e.config = &client.Config{} - e.config.Endpoints = []string{etcdDummyAddress} -} - -func (e *etcdModule) setConfig(opts map[string]string) error { - return setOpts(opts, e.opts) -} - -func (e *etcdModule) setExtraConfig(opts *ExtraOptions) error { - if opts != nil && len(opts.DialOption) != 0 { - e.config = &client.Config{} - e.config.DialOptions = append(e.config.DialOptions, opts.DialOption...) - } - return nil -} - -func (e *etcdModule) getConfig() map[string]string { - return getOpts(e.opts) -} - -func shuffleEndpoints(endpoints []string) { - randGen.Shuffle(len(endpoints), func(i, j int) { - endpoints[i], endpoints[j] = endpoints[j], endpoints[i] - }) -} - -type clientOptions struct { - KeepAliveHeartbeat time.Duration - KeepAliveTimeout time.Duration - RateLimit int - BootstrapRateLimit int - MaxInflight int - ListBatchSize int -} - -func (e *etcdModule) newClient(ctx context.Context, opts *ExtraOptions) (BackendOperations, chan error) { - errChan := make(chan error, 10) - - clientOptions := clientOptions{ - KeepAliveHeartbeat: 15 * time.Second, - KeepAliveTimeout: 25 * time.Second, - RateLimit: defaults.KVstoreQPS, - ListBatchSize: 256, - } - - if o, ok := e.opts[EtcdRateLimitOption]; ok && o.value != "" { - clientOptions.RateLimit, _ = strconv.Atoi(o.value) - } - - if o, ok := e.opts[EtcdBootstrapRateLimitOption]; ok && o.value != "" { - clientOptions.BootstrapRateLimit, _ = strconv.Atoi(o.value) - } - - if o, ok := e.opts[EtcdMaxInflightOption]; ok && o.value != "" { - clientOptions.MaxInflight, _ = strconv.Atoi(o.value) - } - - if clientOptions.MaxInflight == 0 { - clientOptions.MaxInflight = clientOptions.RateLimit - } - - if o, ok := e.opts[EtcdListLimitOption]; ok && o.value != "" { - clientOptions.ListBatchSize, _ = strconv.Atoi(o.value) - } - - if o, ok := e.opts[EtcdOptionKeepAliveTimeout]; ok && o.value != "" { - clientOptions.KeepAliveTimeout, _ = time.ParseDuration(o.value) - } - - if o, ok := e.opts[EtcdOptionKeepAliveHeartbeat]; ok && o.value != "" { - clientOptions.KeepAliveHeartbeat, _ = time.ParseDuration(o.value) - } - - endpointsOpt, endpointsSet := e.opts[EtcdAddrOption] - configPathOpt, configSet := e.opts[EtcdOptionConfig] - - var configPath string - if configSet { - configPath = configPathOpt.value - } - if e.config == nil { - if !endpointsSet && !configSet { - errChan <- fmt.Errorf("invalid etcd configuration, %s or %s must be specified", EtcdOptionConfig, EtcdAddrOption) - close(errChan) - return nil, errChan - } - - if endpointsOpt.value == "" && configPath == "" { - errChan <- fmt.Errorf("invalid etcd configuration, %s or %s must be specified", - EtcdOptionConfig, EtcdAddrOption) - close(errChan) - return nil, errChan - } - - e.config = &client.Config{} - } - - if e.config.Endpoints == nil && endpointsSet { - e.config.Endpoints = []string{endpointsOpt.value} - } - - log.WithFields(logrus.Fields{ - "ConfigPath": configPath, - "KeepAliveHeartbeat": clientOptions.KeepAliveHeartbeat, - "KeepAliveTimeout": clientOptions.KeepAliveTimeout, - "RateLimit": clientOptions.RateLimit, - "MaxInflight": clientOptions.MaxInflight, - "ListLimit": clientOptions.ListBatchSize, - }).Info("Creating etcd client") - - for { - // connectEtcdClient will close errChan when the connection attempt has - // been successful - backend, err := connectEtcdClient(ctx, e.config, configPath, errChan, clientOptions, opts) - switch { - case os.IsNotExist(err): - log.WithError(err).Info("Waiting for all etcd configuration files to be available") - time.Sleep(5 * time.Second) - case err != nil: - errChan <- err - close(errChan) - return backend, errChan - default: - return backend, errChan - } - } -} - -func init() { - // register etcd module for use - registerBackend(EtcdBackendName, etcdInstance) - - if duration := os.Getenv("CILIUM_ETCD_STATUS_CHECK_INTERVAL"); duration != "" { - timeout, err := time.ParseDuration(duration) - if err == nil { - statusCheckTimeout = timeout - } - } - - // Initialize the etcd client logger. - l, err := logutil.CreateDefaultZapLogger(etcdClientDebugLevel()) - if err != nil { - log.WithError(err).Warning("Failed to initialize etcd client logger") - l = zap.NewNop() - } - etcd3ClientLogger = l.Named("etcd-client") -} - -// etcdClientDebugLevel translates ETCD_CLIENT_DEBUG into zap log level. -// This is a copy of a private etcd client function: -// https://github.com/etcd-io/etcd/blob/v3.5.9/client/v3/logger.go#L47-L59 -func etcdClientDebugLevel() zapcore.Level { - envLevel := os.Getenv("ETCD_CLIENT_DEBUG") - if envLevel == "" || envLevel == "true" { - return zapcore.InfoLevel - } - var l zapcore.Level - if err := l.Set(envLevel); err != nil { - log.Warning("Invalid value for environment variable 'ETCD_CLIENT_DEBUG'. Using default level: 'info'") - return zapcore.InfoLevel - } - return l -} - -// Hint tries to improve the error message displayed to te user. -func Hint(err error) error { - if errors.Is(err, context.DeadlineExceeded) { - return fmt.Errorf("etcd client timeout exceeded") - } - return err -} - -type etcdClient struct { - // firstSession is a channel that will be closed once the first session - // is set up in the etcd client. If an error occurred and the initial - // session cannot be established, the error is provided via the - // channel. - firstSession chan struct{} - - // stopStatusChecker is closed when the status checker can be terminated - stopStatusChecker chan struct{} - - client *client.Client - - // config and configPath are initialized once and never written to again, they can be accessed without locking - config *client.Config - configPath string - - // statusCheckErrors receives all errors reported by statusChecker() - statusCheckErrors chan error - - // protects all sessions and sessionErr from concurrent access - lock.RWMutex - - sessionErr error - - // leaseManager manages the acquisition of etcd leases for generic purposes - leaseManager *etcdLeaseManager - // lockLeaseManager manages the acquisition of etcd leases for locking - // purposes, associated with a shorter TTL - lockLeaseManager *etcdLeaseManager - - // statusLock protects latestStatusSnapshot and latestErrorStatus for - // read/write access - statusLock lock.RWMutex - - // latestStatusSnapshot is a snapshot of the latest etcd cluster status - latestStatusSnapshot string - - // latestErrorStatus is the latest error condition of the etcd connection - latestErrorStatus error - - extraOptions *ExtraOptions - - limiter *ciliumrate.APILimiter - listBatchSize int - - lastHeartbeat time.Time - - leaseExpiredObservers lock.Map[string, func(string)] - - // logger is the scoped logger associated with this client - logger logrus.FieldLogger -} - -type etcdMutex struct { - mutex *concurrency.Mutex - onUnlock func() -} - -func (e *etcdMutex) Unlock(ctx context.Context) error { - e.onUnlock() - return e.mutex.Unlock(ctx) -} - -func (e *etcdMutex) Comparator() interface{} { - return e.mutex.IsOwner() -} - -// StatusCheckErrors returns a channel which receives status check errors -func (e *etcdClient) StatusCheckErrors() <-chan error { - return e.statusCheckErrors -} - -func (e *etcdClient) waitForInitLock(ctx context.Context) <-chan error { - initLockSucceeded := make(chan error) - - go func() { - for { - select { - case <-e.client.Ctx().Done(): - initLockSucceeded <- fmt.Errorf("client context ended: %w", e.client.Ctx().Err()) - close(initLockSucceeded) - return - case <-ctx.Done(): - initLockSucceeded <- fmt.Errorf("caller context ended: %w", ctx.Err()) - close(initLockSucceeded) - return - default: - } - - if e.extraOptions != nil && e.extraOptions.NoLockQuorumCheck { - close(initLockSucceeded) - return - } - - // Generate a random number so that we can acquire a lock even - // if other agents are killed while locking this path. - randNumber := strconv.FormatUint(randGen.Uint64(), 16) - locker, err := e.LockPath(ctx, InitLockPath+"/"+randNumber) - if err == nil { - locker.Unlock(context.Background()) - close(initLockSucceeded) - e.logger.Debug("Distributed lock successful, etcd has quorum") - return - } - - time.Sleep(100 * time.Millisecond) - } - }() - - return initLockSucceeded -} - -func (e *etcdClient) isConnectedAndHasQuorum(ctx context.Context) error { - ctxTimeout, cancel := context.WithTimeout(ctx, statusCheckTimeout) - defer cancel() - - select { - // Wait for the initial connection to be established - case <-e.firstSession: - if err := e.sessionError(); err != nil { - return err - } - // Client is closing - case <-e.client.Ctx().Done(): - return fmt.Errorf("client is closing") - // Timeout while waiting for initial connection, no success - case <-ctxTimeout.Done(): - recordQuorumError("timeout") - return fmt.Errorf("timeout while waiting for initial connection") - } - - initLockSucceeded := e.waitForInitLock(ctxTimeout) - if err := <-initLockSucceeded; err != nil { - recordQuorumError("lock timeout") - return fmt.Errorf("unable to acquire lock: %w", err) - } - - return nil -} - -// Connected closes the returned channel when the etcd client is connected. If -// the context is cancelled or if the etcd client is closed, an error is -// returned on the channel. -func (e *etcdClient) Connected(ctx context.Context) <-chan error { - out := make(chan error) - go func() { - defer close(out) - for { - select { - case <-e.client.Ctx().Done(): - out <- fmt.Errorf("etcd client context ended") - return - case <-ctx.Done(): - out <- ctx.Err() - return - default: - } - if e.isConnectedAndHasQuorum(ctx) == nil { - return - } - time.Sleep(100 * time.Millisecond) - } - }() - return out -} - -// Disconnected closes the returned channel when the etcd client is -// disconnected after being reconnected. Blocks until the etcd client is first -// connected with the kvstore. -func (e *etcdClient) Disconnected() <-chan struct{} { - <-e.firstSession - - for { - session, err := e.lockLeaseManager.GetSession(context.Background(), InitLockPath) - if err == nil { - return session.Done() - } - - e.logger.WithError(err).Warning("Failed to acquire lock session") - time.Sleep(100 * time.Millisecond) - } -} - -func connectEtcdClient(ctx context.Context, config *client.Config, cfgPath string, errChan chan error, clientOptions clientOptions, opts *ExtraOptions) (BackendOperations, error) { - if cfgPath != "" { - cfg, err := newConfig(cfgPath) - if err != nil { - return nil, err - } - if cfg.TLS != nil { - cfg.TLS.GetClientCertificate, err = getClientCertificateReloader(cfgPath) - if err != nil { - return nil, err - } - } - cfg.DialOptions = append(cfg.DialOptions, config.DialOptions...) - config = cfg - } - - // Shuffle the order of endpoints to avoid all agents connecting to the - // same etcd endpoint and to work around etcd client library failover - // bugs. (https://github.com/etcd-io/etcd/pull/9860) - if config.Endpoints != nil { - shuffleEndpoints(config.Endpoints) - } - - // Set client context so that client can be cancelled from outside - config.Context = ctx - // Set DialTimeout to 0, otherwise the creation of a new client will - // block until DialTimeout is reached or a connection to the server - // is made. - config.DialTimeout = 0 - // Ping the server to verify if the server connection is still valid - config.DialKeepAliveTime = clientOptions.KeepAliveHeartbeat - // Timeout if the server does not reply within 15 seconds and close the - // connection. Ideally it should be lower than staleLockTimeout - config.DialKeepAliveTimeout = clientOptions.KeepAliveTimeout - - // Use the shared etcd client logger to prevent unnecessary allocations. - config.Logger = etcd3ClientLogger - - c, err := client.New(*config) - if err != nil { - return nil, err - } - - errorChan := make(chan error) - - ec := &etcdClient{ - client: c, - config: config, - configPath: cfgPath, - firstSession: make(chan struct{}), - latestStatusSnapshot: "Waiting for initial connection to be established", - stopStatusChecker: make(chan struct{}), - extraOptions: opts, - listBatchSize: clientOptions.ListBatchSize, - statusCheckErrors: make(chan error, 128), - logger: log.WithFields(logrus.Fields{ - "endpoints": config.Endpoints, - "config": cfgPath, - }), - } - - initialLimit := clientOptions.RateLimit - // If BootstrapRateLimit and BootstrapComplete are provided, set the - // initial rate limit to BootstrapRateLimit and apply the standard rate limit - // once the caller has signaled that bootstrap is complete by closing the channel. - if clientOptions.BootstrapRateLimit > 0 && opts != nil && opts.BootstrapComplete != nil { - ec.logger.WithField(logfields.EtcdQPSLimit, clientOptions.BootstrapRateLimit).Info("Setting client QPS limit for bootstrap") - initialLimit = clientOptions.BootstrapRateLimit - go func() { - select { - case <-ec.client.Ctx().Done(): - case <-opts.BootstrapComplete: - ec.logger.WithField(logfields.EtcdQPSLimit, clientOptions.RateLimit).Info("Bootstrap complete, updating client QPS limit") - ec.limiter.SetRateLimit(rate.Limit(clientOptions.RateLimit)) - } - }() - } - - ec.limiter = ciliumrate.NewAPILimiter(makeSessionName("etcd", opts), ciliumrate.APILimiterParameters{ - RateLimit: rate.Limit(initialLimit), - RateBurst: clientOptions.RateLimit, - ParallelRequests: clientOptions.MaxInflight, - }, ciliumratemetrics.APILimiterObserver()) - - ec.logger.Info("Connecting to etcd server...") - - leaseTTL := option.Config.KVstoreLeaseTTL - if option.Config.KVstoreLeaseTTL == 0 { - leaseTTL = defaults.KVstoreLeaseTTL - } - - ec.leaseManager = newEtcdLeaseManager(c, leaseTTL, etcdMaxKeysPerLease, ec.expiredLeaseObserver, ec.logger) - ec.lockLeaseManager = newEtcdLeaseManager(c, defaults.LockLeaseTTL, etcdMaxKeysPerLease, nil, ec.logger) - - // create session in parallel as this is a blocking operation - go func() { - ls, err := ec.lockLeaseManager.GetSession(ctx, InitLockPath) - if err != nil { - errorChan <- err - close(errorChan) - return - } - - ec.logger.Infof("Got lock lease ID %x", ls.Lease()) - close(errorChan) - }() - - handleSessionError := func(err error) { - ec.RWMutex.Lock() - ec.sessionErr = err - ec.RWMutex.Unlock() - - ec.statusLock.Lock() - ec.latestStatusSnapshot = "Failed to establish initial connection" - ec.latestErrorStatus = err - ec.statusLock.Unlock() - - errChan <- err - ec.statusCheckErrors <- err - } - - // wait for session to be created also in parallel - go func() { - err := func() (err error) { - select { - case err = <-errorChan: - if err != nil { - return err - } - case <-time.After(initialConnectionTimeout): - return fmt.Errorf("timed out while waiting for etcd session. Ensure that etcd is running on %s", config.Endpoints) - } - - ec.logger.Info("Initial etcd session established") - - return nil - }() - - if err != nil { - handleSessionError(err) - close(errChan) - close(ec.firstSession) - close(ec.statusCheckErrors) - return - } - - close(errChan) - close(ec.firstSession) - - go ec.statusChecker() - - watcher := ec.ListAndWatch(ctx, HeartbeatPath, 128) - - for { - select { - case _, ok := <-watcher.Events: - if !ok { - ec.logger.Debug("Stopping heartbeat watcher") - watcher.Stop() - return - } - - // It is tempting to compare against the - // heartbeat value stored in the key. However, - // this would require the time on all nodes to - // be synchronized. Instead, assume current - // time and print the heartbeat value in debug - // messages for troubleshooting - ec.RWMutex.Lock() - ec.lastHeartbeat = time.Now() - ec.RWMutex.Unlock() - ec.logger.Debug("Received update notification of heartbeat") - case <-ctx.Done(): - return - } - } - }() - - return ec, nil -} - -// makeSessionName builds up a session/locksession controller name -// clusterName is expected to be empty for main kvstore connection -func makeSessionName(sessionPrefix string, opts *ExtraOptions) string { - if opts != nil && opts.ClusterName != "" { - return sessionPrefix + "-" + opts.ClusterName - } - return sessionPrefix -} - -func (e *etcdClient) sessionError() (err error) { - e.RWMutex.RLock() - err = e.sessionErr - e.RWMutex.RUnlock() - return -} - -func (e *etcdClient) LockPath(ctx context.Context, path string) (KVLocker, error) { - // Create the context first, so that the timeout also accounts for the time - // possibly required to acquire a new session (if not already established). - ctx, cancel := context.WithTimeout(ctx, time.Minute) - defer cancel() - - session, err := e.lockLeaseManager.GetSession(ctx, path) - if err != nil { - return nil, Hint(err) - } - - mu := concurrency.NewMutex(session, path) - err = mu.Lock(ctx) - if err != nil { - e.lockLeaseManager.CancelIfExpired(err, session.Lease()) - return nil, Hint(err) - } - - release := func() { e.lockLeaseManager.Release(path) } - return &etcdMutex{mutex: mu, onUnlock: release}, nil -} - -func (e *etcdClient) DeletePrefix(ctx context.Context, path string) (err error) { - defer func() { - Trace("DeletePrefix", err, logrus.Fields{fieldPrefix: path}) - }() - lr, err := e.limiter.Wait(ctx) - if err != nil { - return Hint(err) - } - - defer func(duration *spanstat.SpanStat) { - increaseMetric(path, metricDelete, "DeletePrefix", duration.EndError(err).Total(), err) - }(spanstat.Start()) - - _, err = e.client.Delete(ctx, path, client.WithPrefix()) - // Using lr.Error for convenience, as it matches lr.Done() when err is nil - lr.Error(err, -1) - - if err == nil { - e.leaseManager.ReleasePrefix(path) - } - - return Hint(err) -} - -// watch starts watching for changes in a prefix -func (e *etcdClient) watch(ctx context.Context, w *Watcher) { - localCache := watcherCache{} - listSignalSent := false - - defer func() { - close(w.Events) - w.stopWait.Done() - - // The watch might be aborted by closing - // the context instead of calling - // w.Stop() from outside. In that case - // we make sure to close everything and - // as this uses sync.Once it can be - // run multiple times (if that's the case). - w.Stop() - }() - - scopedLog := e.logger.WithField(fieldPrefix, w.Prefix) - scopedLog.Debug("Starting watcher...") - - err := <-e.Connected(ctx) - if err != nil { - // The context ended or the etcd client was closed - // before connectivity was achieved - return - } - - // errLimiter is used to rate limit the retry of the first Get request in case an error - // has occurred, to prevent overloading the etcd server due to the more aggressive - // default rate limiter. - errLimiter := backoff.Exponential{ - Name: "etcd-list-before-watch-error", - Min: 50 * time.Millisecond, - Max: 1 * time.Minute, - } - - if e.extraOptions != nil { - errLimiter.NodeManager = backoff.NewNodeManager(e.extraOptions.ClusterSizeDependantInterval) - } - -reList: - for { - select { - case <-e.client.Ctx().Done(): - return - case <-ctx.Done(): - return - default: - } - - lr, err := e.limiter.Wait(ctx) - if err != nil { - continue - } - kvs, revision, err := e.paginatedList(ctx, scopedLog, w.Prefix) - if err != nil { - lr.Error(err, -1) - scopedLog.WithError(Hint(err)).Warn("Unable to list keys before starting watcher") - errLimiter.Wait(ctx) - continue - } - lr.Done() - errLimiter.Reset() - - for _, key := range kvs { - t := EventTypeCreate - if localCache.Exists(key.Key) { - t = EventTypeModify - } - - localCache.MarkInUse(key.Key) - - if traceEnabled { - scopedLog.Debugf("Emitting list result as %s event for %s=%s", t, key.Key, key.Value) - } - - queueStart := spanstat.Start() - w.Events <- KeyValueEvent{ - Key: string(key.Key), - Value: key.Value, - Typ: t, - } - trackEventQueued(string(key.Key), t, queueStart.End(true).Total()) - } - - nextRev := revision + 1 - - // Send out deletion events for all keys that were deleted - // between our last known revision and the latest revision - // received via Get - localCache.RemoveDeleted(func(k string) { - event := KeyValueEvent{ - Key: k, - Typ: EventTypeDelete, - } - - if traceEnabled { - scopedLog.Debugf("Emitting EventTypeDelete event for %s", k) - } - - queueStart := spanstat.Start() - w.Events <- event - trackEventQueued(k, EventTypeDelete, queueStart.End(true).Total()) - }) - - // Only send the list signal once - if !listSignalSent { - w.Events <- KeyValueEvent{Typ: EventTypeListDone} - listSignalSent = true - } - - recreateWatcher: - scopedLog.WithField(fieldRev, nextRev).Debug("Starting to watch a prefix") - - lr, err = e.limiter.Wait(ctx) - if err != nil { - select { - case <-e.client.Ctx().Done(): - return - case <-ctx.Done(): - return - default: - goto recreateWatcher - } - } - - etcdWatch := e.client.Watch(client.WithRequireLeader(ctx), w.Prefix, - client.WithPrefix(), client.WithRev(nextRev)) - lr.Done() - - for { - select { - case <-e.client.Ctx().Done(): - return - case <-ctx.Done(): - return - case <-w.stopWatch: - return - case r, ok := <-etcdWatch: - if !ok { - time.Sleep(50 * time.Millisecond) - goto recreateWatcher - } - - scopedLog := scopedLog.WithField(fieldRev, r.Header.Revision) - - if err := r.Err(); err != nil { - // We tried to watch on a compacted - // revision that may no longer exist, - // recreate the watcher and try to - // watch on the next possible revision - if errors.Is(err, v3rpcErrors.ErrCompacted) { - scopedLog.WithError(Hint(err)).Debug("Tried watching on compacted revision") - } - - // mark all local keys in state for - // deletion unless the upcoming GET - // marks them alive - localCache.MarkAllForDeletion() - - goto reList - } - - nextRev = r.Header.Revision + 1 - if traceEnabled { - scopedLog.Debugf("Received event from etcd: %+v", r) - } - - for _, ev := range r.Events { - event := KeyValueEvent{ - Key: string(ev.Kv.Key), - Value: ev.Kv.Value, - } - - switch { - case ev.Type == client.EventTypeDelete: - event.Typ = EventTypeDelete - localCache.RemoveKey(ev.Kv.Key) - case ev.IsCreate(): - event.Typ = EventTypeCreate - localCache.MarkInUse(ev.Kv.Key) - default: - event.Typ = EventTypeModify - localCache.MarkInUse(ev.Kv.Key) - } - - if traceEnabled { - scopedLog.Debugf("Emitting %s event for %s=%s", event.Typ, event.Key, event.Value) - } - - queueStart := spanstat.Start() - w.Events <- event - trackEventQueued(string(ev.Kv.Key), event.Typ, queueStart.End(true).Total()) - } - } - } - } -} - -func (e *etcdClient) paginatedList(ctx context.Context, log *logrus.Entry, prefix string) (kvs []*mvccpb.KeyValue, revision int64, err error) { - start, end := prefix, client.GetPrefixRangeEnd(prefix) - - for { - res, err := e.client.Get(ctx, start, client.WithRange(end), - client.WithSort(client.SortByKey, client.SortAscend), - client.WithRev(revision), client.WithSerializable(), - client.WithLimit(int64(e.listBatchSize)), - ) - if err != nil { - return nil, 0, err - } - - log.WithFields(logrus.Fields{ - fieldNumEntries: len(res.Kvs), - fieldRemainingEntries: res.Count - int64(len(res.Kvs)), - }).Debug("Received list response from etcd") - - if kvs == nil { - kvs = make([]*mvccpb.KeyValue, 0, res.Count) - } - - kvs = append(kvs, res.Kvs...) - - revision = res.Header.Revision - if !res.More || len(res.Kvs) == 0 { - return kvs, revision, nil - } - - start = string(res.Kvs[len(res.Kvs)-1].Key) + "\x00" - } -} - -func (e *etcdClient) determineEndpointStatus(ctx context.Context, endpointAddress string) (string, error) { - ctxTimeout, cancel := context.WithTimeout(ctx, statusCheckTimeout) - defer cancel() - - e.logger.Debugf("Checking status to etcd endpoint %s", endpointAddress) - - status, err := e.client.Status(ctxTimeout, endpointAddress) - if err != nil { - return fmt.Sprintf("%s - %s", endpointAddress, err), Hint(err) - } - - str := fmt.Sprintf("%s - %s", endpointAddress, status.Version) - if status.Header.MemberId == status.Leader { - str += " (Leader)" - } - - return str, nil -} - -func (e *etcdClient) statusChecker() { - ctx := context.Background() - - consecutiveQuorumErrors := 0 - - statusTimer, statusTimerDone := inctimer.New() - defer statusTimerDone() - - for { - newStatus := []string{} - ok := 0 - - quorumError := e.isConnectedAndHasQuorum(ctx) - - e.RWMutex.RLock() - lastHeartbeat := e.lastHeartbeat - e.RWMutex.RUnlock() - - if heartbeatDelta := time.Since(lastHeartbeat); !lastHeartbeat.IsZero() && heartbeatDelta > 2*HeartbeatWriteInterval { - recordQuorumError("no event received") - quorumError = fmt.Errorf("%s since last heartbeat update has been received", heartbeatDelta) - } - - endpoints := e.client.Endpoints() - if e.extraOptions != nil && e.extraOptions.NoEndpointStatusChecks { - newStatus = append(newStatus, "endpoint status checks are disabled") - - if quorumError == nil { - ok = len(endpoints) - } - } else { - for _, ep := range endpoints { - st, err := e.determineEndpointStatus(ctx, ep) - if err == nil { - ok++ - } - - newStatus = append(newStatus, st) - } - } - - allConnected := len(endpoints) == ok - - quorumString := "true" - if quorumError != nil { - quorumString = quorumError.Error() - consecutiveQuorumErrors++ - quorumString += fmt.Sprintf(", consecutive-errors=%d", consecutiveQuorumErrors) - } else { - consecutiveQuorumErrors = 0 - } - - e.statusLock.Lock() - - switch { - case consecutiveQuorumErrors > option.Config.KVstoreMaxConsecutiveQuorumErrors: - e.latestErrorStatus = fmt.Errorf("quorum check failed %d times in a row: %w", - consecutiveQuorumErrors, quorumError) - e.latestStatusSnapshot = e.latestErrorStatus.Error() - case len(endpoints) > 0 && ok == 0: - e.latestErrorStatus = fmt.Errorf("not able to connect to any etcd endpoints") - e.latestStatusSnapshot = e.latestErrorStatus.Error() - default: - e.latestErrorStatus = nil - e.latestStatusSnapshot = fmt.Sprintf("etcd: %d/%d connected, leases=%d, lock leases=%d, has-quorum=%s: %s", - ok, len(endpoints), e.leaseManager.TotalLeases(), e.lockLeaseManager.TotalLeases(), quorumString, strings.Join(newStatus, "; ")) - } - - e.statusLock.Unlock() - if e.latestErrorStatus != nil { - select { - case e.statusCheckErrors <- e.latestErrorStatus: - default: - // Channel's buffer is full, skip sending errors to the channel but log warnings instead - log.WithError(e.latestErrorStatus). - Warning("Status check error channel is full, dropping this error") - } - } - - select { - case <-e.stopStatusChecker: - close(e.statusCheckErrors) - return - case <-statusTimer.After(e.extraOptions.StatusCheckInterval(allConnected)): - } - } -} - -func (e *etcdClient) Status() (string, error) { - e.statusLock.RLock() - defer e.statusLock.RUnlock() - - return e.latestStatusSnapshot, Hint(e.latestErrorStatus) -} - -// GetIfLocked returns value of key if the client is still holding the given lock. -func (e *etcdClient) GetIfLocked(ctx context.Context, key string, lock KVLocker) (bv []byte, err error) { - defer func() { - Trace("GetIfLocked", err, logrus.Fields{fieldKey: key, fieldValue: string(bv)}) - }() - lr, err := e.limiter.Wait(ctx) - if err != nil { - return nil, Hint(err) - } - defer func(duration *spanstat.SpanStat) { - increaseMetric(key, metricRead, "GetLocked", duration.EndError(err).Total(), err) - }(spanstat.Start()) - - opGet := client.OpGet(key) - cmp := lock.Comparator().(client.Cmp) - txnReply, err := e.client.Txn(ctx).If(cmp).Then(opGet).Commit() - if err == nil && !txnReply.Succeeded { - err = ErrLockLeaseExpired - } - - if err != nil { - lr.Error(err, -1) - return nil, Hint(err) - } - - lr.Done() - getR := txnReply.Responses[0].GetResponseRange() - // RangeResponse - if getR.Count == 0 { - return nil, nil - } - return getR.Kvs[0].Value, nil -} - -// Get returns value of key -func (e *etcdClient) Get(ctx context.Context, key string) (bv []byte, err error) { - defer func() { - Trace("Get", err, logrus.Fields{fieldKey: key, fieldValue: string(bv)}) - }() - lr, err := e.limiter.Wait(ctx) - if err != nil { - return nil, Hint(err) - } - defer func(duration *spanstat.SpanStat) { - increaseMetric(key, metricRead, "Get", duration.EndError(err).Total(), err) - }(spanstat.Start()) - - getR, err := e.client.Get(ctx, key) - if err != nil { - lr.Error(err, -1) - return nil, Hint(err) - } - lr.Done() - - if getR.Count == 0 { - return nil, nil - } - return getR.Kvs[0].Value, nil -} - -// DeleteIfLocked deletes a key if the client is still holding the given lock. -func (e *etcdClient) DeleteIfLocked(ctx context.Context, key string, lock KVLocker) (err error) { - defer func() { - Trace("DeleteIfLocked", err, logrus.Fields{fieldKey: key}) - }() - lr, err := e.limiter.Wait(ctx) - if err != nil { - return Hint(err) - } - defer func(duration *spanstat.SpanStat) { - increaseMetric(key, metricDelete, "DeleteLocked", duration.EndError(err).Total(), err) - }(spanstat.Start()) - - opDel := client.OpDelete(key) - cmp := lock.Comparator().(client.Cmp) - txnReply, err := e.client.Txn(ctx).If(cmp).Then(opDel).Commit() - if err == nil && !txnReply.Succeeded { - err = ErrLockLeaseExpired - } - if err == nil { - e.leaseManager.Release(key) - } - - // Using lr.Error for convenience, as it matches lr.Done() when err is nil - lr.Error(err, -1) - return Hint(err) -} - -// Delete deletes a key -func (e *etcdClient) Delete(ctx context.Context, key string) (err error) { - defer func() { - Trace("Delete", err, logrus.Fields{fieldKey: key}) - }() - lr, err := e.limiter.Wait(ctx) - if err != nil { - return Hint(err) - } - defer func(duration *spanstat.SpanStat) { - increaseMetric(key, metricDelete, "Delete", duration.EndError(err).Total(), err) - }(spanstat.Start()) - - _, err = e.client.Delete(ctx, key) - // Using lr.Error for convenience, as it matches lr.Done() when err is nil - lr.Error(err, -1) - - if err == nil { - e.leaseManager.Release(key) - } - - return Hint(err) -} - -// UpdateIfLocked updates a key if the client is still holding the given lock. -func (e *etcdClient) UpdateIfLocked(ctx context.Context, key string, value []byte, lease bool, lock KVLocker) (err error) { - defer func() { - Trace("UpdateIfLocked", err, logrus.Fields{fieldKey: key, fieldValue: string(value), fieldAttachLease: lease}) - }() - var leaseID client.LeaseID - if lease { - leaseID, err = e.leaseManager.GetLeaseID(ctx, key) - if err != nil { - return Hint(err) - } - } - lr, err := e.limiter.Wait(ctx) - if err != nil { - return Hint(err) - } - defer func(duration *spanstat.SpanStat) { - increaseMetric(key, metricSet, "UpdateIfLocked", duration.EndError(err).Total(), err) - }(spanstat.Start()) - - var txnReply *client.TxnResponse - opPut := client.OpPut(key, string(value), client.WithLease(leaseID)) - cmp := lock.Comparator().(client.Cmp) - txnReply, err = e.client.Txn(ctx).If(cmp).Then(opPut).Commit() - e.leaseManager.CancelIfExpired(err, leaseID) - - if err == nil && !txnReply.Succeeded { - err = ErrLockLeaseExpired - } - - // Using lr.Error for convenience, as it matches lr.Done() when err is nil - lr.Error(err, -1) - return Hint(err) -} - -// Update creates or updates a key -func (e *etcdClient) Update(ctx context.Context, key string, value []byte, lease bool) (err error) { - defer func() { - Trace("Update", err, logrus.Fields{fieldKey: key, fieldValue: string(value), fieldAttachLease: lease}) - }() - var leaseID client.LeaseID - if lease { - leaseID, err = e.leaseManager.GetLeaseID(ctx, key) - if err != nil { - return Hint(err) - } - } - lr, err := e.limiter.Wait(ctx) - if err != nil { - return Hint(err) - } - defer func(duration *spanstat.SpanStat) { - increaseMetric(key, metricSet, "Update", duration.EndError(err).Total(), err) - }(spanstat.Start()) - - _, err = e.client.Put(ctx, key, string(value), client.WithLease(leaseID)) - e.leaseManager.CancelIfExpired(err, leaseID) - - // Using lr.Error for convenience, as it matches lr.Done() when err is nil - lr.Error(err, -1) - return Hint(err) -} - -// UpdateIfDifferentIfLocked updates a key if the value is different and if the client is still holding the given lock. -func (e *etcdClient) UpdateIfDifferentIfLocked(ctx context.Context, key string, value []byte, lease bool, lock KVLocker) (recreated bool, err error) { - defer func() { - Trace("UpdateIfDifferentIfLocked", err, logrus.Fields{fieldKey: key, fieldValue: value, fieldAttachLease: lease, "recreated": recreated}) - }() - lr, err := e.limiter.Wait(ctx) - if err != nil { - return false, Hint(err) - } - duration := spanstat.Start() - - cnds := lock.Comparator().(client.Cmp) - txnresp, err := e.client.Txn(ctx).If(cnds).Then(client.OpGet(key)).Commit() - // Using lr.Error for convenience, as it matches lr.Done() when err is nil - lr.Error(err, -1) - increaseMetric(key, metricRead, "Get", duration.EndError(err).Total(), err) - - // On error, attempt update blindly - if err != nil { - return true, e.UpdateIfLocked(ctx, key, value, lease, lock) - } - - if !txnresp.Succeeded { - return false, ErrLockLeaseExpired - } - - getR := txnresp.Responses[0].GetResponseRange() - if getR.Count == 0 { - return true, e.UpdateIfLocked(ctx, key, value, lease, lock) - } - - if lease && !e.leaseManager.KeyHasLease(key, client.LeaseID(getR.Kvs[0].Lease)) { - return true, e.UpdateIfLocked(ctx, key, value, lease, lock) - } - // if value is not equal then update. - if !bytes.Equal(getR.Kvs[0].Value, value) { - return true, e.UpdateIfLocked(ctx, key, value, lease, lock) - } - - return false, nil -} - -// UpdateIfDifferent updates a key if the value is different -func (e *etcdClient) UpdateIfDifferent(ctx context.Context, key string, value []byte, lease bool) (recreated bool, err error) { - defer func() { - Trace("UpdateIfDifferent", err, logrus.Fields{fieldKey: key, fieldValue: value, fieldAttachLease: lease, "recreated": recreated}) - }() - lr, err := e.limiter.Wait(ctx) - if err != nil { - return false, Hint(err) - } - duration := spanstat.Start() - - getR, err := e.client.Get(ctx, key) - // Using lr.Error for convenience, as it matches lr.Done() when err is nil - lr.Error(err, -1) - increaseMetric(key, metricRead, "Get", duration.EndError(err).Total(), err) - // On error, attempt update blindly - if err != nil || getR.Count == 0 { - return true, e.Update(ctx, key, value, lease) - } - if lease && !e.leaseManager.KeyHasLease(key, client.LeaseID(getR.Kvs[0].Lease)) { - return true, e.Update(ctx, key, value, lease) - } - // if value is not equal then update. - if !bytes.Equal(getR.Kvs[0].Value, value) { - return true, e.Update(ctx, key, value, lease) - } - - return false, nil -} - -// CreateOnlyIfLocked atomically creates a key if the client is still holding the given lock or fails if it already exists -func (e *etcdClient) CreateOnlyIfLocked(ctx context.Context, key string, value []byte, lease bool, lock KVLocker) (success bool, err error) { - defer func() { - Trace("CreateOnlyIfLocked", err, logrus.Fields{fieldKey: key, fieldValue: value, fieldAttachLease: lease, "success": success}) - }() - var leaseID client.LeaseID - if lease { - leaseID, err = e.leaseManager.GetLeaseID(ctx, key) - if err != nil { - return false, Hint(err) - } - } - lr, err := e.limiter.Wait(ctx) - if err != nil { - return false, Hint(err) - } - duration := spanstat.Start() - - req := client.OpPut(key, string(value), client.WithLease(leaseID)) - cnds := []client.Cmp{ - client.Compare(client.Version(key), "=", 0), - lock.Comparator().(client.Cmp), - } - - // We need to do a get in the else of the txn to detect if the lock is still - // valid or not. - opGets := []client.Op{ - client.OpGet(key), - } - txnresp, err := e.client.Txn(ctx).If(cnds...).Then(req).Else(opGets...).Commit() - increaseMetric(key, metricSet, "CreateOnlyLocked", duration.EndError(err).Total(), err) - if err != nil { - lr.Error(err, -1) - e.leaseManager.CancelIfExpired(err, leaseID) - return false, Hint(err) - } - lr.Done() - - // The txn can failed for the following reasons: - // - Key version is not zero; - // - Lock does not exist or is expired. - // For both of those cases, the key that we are comparing might or not - // exist, so we have: - // A - Key does not exist and lock does not exist => ErrLockLeaseExpired - // B - Key does not exist and lock exist => txn should succeed - // C - Key does exist, version is == 0 and lock does not exist => ErrLockLeaseExpired - // D - Key does exist, version is != 0 and lock does not exist => ErrLockLeaseExpired - // E - Key does exist, version is == 0 and lock does exist => txn should succeed - // F - Key does exist, version is != 0 and lock does exist => txn fails but returned is nil! - - if !txnresp.Succeeded { - // case F - if len(txnresp.Responses[0].GetResponseRange().Kvs) != 0 && - txnresp.Responses[0].GetResponseRange().Kvs[0].Version != 0 { - return false, nil - } - - // case A, C and D - return false, ErrLockLeaseExpired - } - - // case B and E - return true, nil -} - -// CreateOnly creates a key with the value and will fail if the key already exists -func (e *etcdClient) CreateOnly(ctx context.Context, key string, value []byte, lease bool) (success bool, err error) { - defer func() { - Trace("CreateOnly", err, logrus.Fields{fieldKey: key, fieldValue: value, fieldAttachLease: lease, "success": success}) - }() - var leaseID client.LeaseID - if lease { - leaseID, err = e.leaseManager.GetLeaseID(ctx, key) - if err != nil { - return false, Hint(err) - } - } - lr, err := e.limiter.Wait(ctx) - if err != nil { - return false, Hint(err) - } - defer func(duration *spanstat.SpanStat) { - increaseMetric(key, metricSet, "CreateOnly", duration.EndError(err).Total(), err) - }(spanstat.Start()) - - req := client.OpPut(key, string(value), client.WithLease(leaseID)) - cond := client.Compare(client.Version(key), "=", 0) - - txnresp, err := e.client.Txn(ctx).If(cond).Then(req).Commit() - - if err != nil { - lr.Error(err, -1) - e.leaseManager.CancelIfExpired(err, leaseID) - return false, Hint(err) - } - - lr.Done() - return txnresp.Succeeded, nil -} - -// ListPrefixIfLocked returns a list of keys matching the prefix only if the client is still holding the given lock. -func (e *etcdClient) ListPrefixIfLocked(ctx context.Context, prefix string, lock KVLocker) (v KeyValuePairs, err error) { - defer func() { - Trace("ListPrefixIfLocked", err, logrus.Fields{fieldPrefix: prefix, fieldNumEntries: len(v)}) - }() - lr, err := e.limiter.Wait(ctx) - if err != nil { - return nil, Hint(err) - } - defer func(duration *spanstat.SpanStat) { - increaseMetric(prefix, metricRead, "ListPrefixLocked", duration.EndError(err).Total(), err) - }(spanstat.Start()) - - opGet := client.OpGet(prefix, client.WithPrefix()) - cmp := lock.Comparator().(client.Cmp) - txnReply, err := e.client.Txn(ctx).If(cmp).Then(opGet).Commit() - if err == nil && !txnReply.Succeeded { - err = ErrLockLeaseExpired - } - if err != nil { - lr.Error(err, -1) - return nil, Hint(err) - } - lr.Done() - getR := txnReply.Responses[0].GetResponseRange() - - pairs := KeyValuePairs(make(map[string]Value, getR.Count)) - for i := int64(0); i < getR.Count; i++ { - pairs[string(getR.Kvs[i].Key)] = Value{ - Data: getR.Kvs[i].Value, - ModRevision: uint64(getR.Kvs[i].ModRevision), - } - - } - - return pairs, nil -} - -// ListPrefix returns a map of matching keys -func (e *etcdClient) ListPrefix(ctx context.Context, prefix string) (v KeyValuePairs, err error) { - defer func() { - Trace("ListPrefix", err, logrus.Fields{fieldPrefix: prefix, fieldNumEntries: len(v)}) - }() - lr, err := e.limiter.Wait(ctx) - if err != nil { - return nil, Hint(err) - } - defer func(duration *spanstat.SpanStat) { - increaseMetric(prefix, metricRead, "ListPrefix", duration.EndError(err).Total(), err) - }(spanstat.Start()) - - getR, err := e.client.Get(ctx, prefix, client.WithPrefix()) - if err != nil { - lr.Error(err, -1) - return nil, Hint(err) - } - lr.Done() - - pairs := KeyValuePairs(make(map[string]Value, getR.Count)) - for i := int64(0); i < getR.Count; i++ { - pairs[string(getR.Kvs[i].Key)] = Value{ - Data: getR.Kvs[i].Value, - ModRevision: uint64(getR.Kvs[i].ModRevision), - LeaseID: getR.Kvs[i].Lease, - } - - } - - return pairs, nil -} - -// Close closes the etcd session -func (e *etcdClient) Close(ctx context.Context) { - close(e.stopStatusChecker) - - if err := e.client.Close(); err != nil { - e.logger.WithError(err).Warning("Failed to close etcd client") - } - - // Wait until all child goroutines spawned by the lease managers have terminated. - e.leaseManager.Wait() - e.lockLeaseManager.Wait() -} - -// Encode encodes a binary slice into a character set that the backend supports -func (e *etcdClient) Encode(in []byte) (out string) { - return string(in) -} - -// Decode decodes a key previously encoded back into the original binary slice -func (e *etcdClient) Decode(in string) (out []byte, err error) { - return []byte(in), nil -} - -// ListAndWatch implements the BackendOperations.ListAndWatch using etcd -func (e *etcdClient) ListAndWatch(ctx context.Context, prefix string, chanSize int) *Watcher { - w := newWatcher(prefix, chanSize) - - go e.watch(ctx, w) - - return w -} - -// RegisterLeaseExpiredObserver registers a function which is executed when -// the lease associated with a key having the given prefix is detected as expired. -// If the function is nil, the previous observer (if any) is unregistered. -func (e *etcdClient) RegisterLeaseExpiredObserver(prefix string, fn func(key string)) { - if fn == nil { - e.leaseExpiredObservers.Delete(prefix) - } else { - e.leaseExpiredObservers.Store(prefix, fn) - } -} - -func (e *etcdClient) expiredLeaseObserver(key string) { - e.leaseExpiredObservers.Range(func(prefix string, fn func(string)) bool { - if strings.HasPrefix(key, prefix) { - fn(key) - } - return true - }) -} - -// UserEnforcePresence creates a user in etcd if not already present, and grants the specified roles. -func (e *etcdClient) UserEnforcePresence(ctx context.Context, name string, roles []string) error { - scopedLog := e.logger.WithField(FieldUser, name) - - scopedLog.Debug("Creating user") - _, err := e.client.Auth.UserAddWithOptions(ctx, name, "", &client.UserAddOptions{NoPassword: true}) - if err != nil { - if errors.Is(err, v3rpcErrors.ErrUserAlreadyExist) { - scopedLog.Debug("User already exists") - } else { - return err - } - } - - for _, role := range roles { - scopedLog.WithField(FieldRole, role).Debug("Granting role to user") - - _, err := e.client.Auth.UserGrantRole(ctx, name, role) - if err != nil { - return err - } - } - - return nil -} - -// UserEnforcePresence deletes a user from etcd, if present. -func (e *etcdClient) UserEnforceAbsence(ctx context.Context, name string) error { - scopedLog := e.logger.WithField(FieldUser, name) - - scopedLog.Debug("Deleting user") - _, err := e.client.Auth.UserDelete(ctx, name) - if err != nil { - if errors.Is(err, v3rpcErrors.ErrUserNotFound) { - scopedLog.Debug("User not found") - } else { - return err - } - } - - return nil -} - -// SplitK8sServiceURL returns the service name and namespace for the given address. -// If the given address is not parseable or it is not the format -// '://>.[optional]', returns an error. -func SplitK8sServiceURL(address string) (string, string, error) { - u, err := url.Parse(address) - if err != nil { - return "", "", err - } - // typical service name "cilium-etcd-client.kube-system.svc" - names := strings.Split(u.Hostname(), ".") - if len(names) >= 2 { - return names[0], names[1], nil - } - return "", "", - fmt.Errorf("invalid service name. expecting .[optional], got: %s", address) -} - -// IsEtcdOperator returns the service name if the configuration is setting up an -// etcd-operator. If the configuration explicitly states it is configured -// to connect to an etcd operator, e.g. with etcd.operator=true, the returned -// service name is the first found within the configuration specified. -func IsEtcdOperator(selectedBackend string, opts map[string]string, k8sNamespace string) (string, bool) { - if selectedBackend != EtcdBackendName { - return "", false - } - - isEtcdOperator := strings.ToLower(opts[isEtcdOperatorOption]) == "true" - - fqdnIsEtcdOperator := func(address string) bool { - svcName, ns, err := SplitK8sServiceURL(address) - return err == nil && - svcName == "cilium-etcd-client" && - ns == k8sNamespace - } - - fqdn := opts[EtcdAddrOption] - if len(fqdn) != 0 { - if fqdnIsEtcdOperator(fqdn) || isEtcdOperator { - return fqdn, true - } - return "", false - } - - bm := newEtcdModule() - err := bm.setConfig(opts) - if err != nil { - return "", false - } - etcdConfig := bm.getConfig()[EtcdOptionConfig] - if len(etcdConfig) == 0 { - return "", false - } - - cfg, err := newConfig(etcdConfig) - if err != nil { - log.WithError(err).Error("Unable to read etcd configuration.") - return "", false - } - for _, endpoint := range cfg.Endpoints { - if fqdnIsEtcdOperator(endpoint) || isEtcdOperator { - return endpoint, true - } - } - - return "", false -} - -// newConfig is a wrapper of clientyaml.NewConfig. Since etcd has deprecated -// the `ca-file` field from yamlConfig in v3.4, the clientyaml.NewConfig won't -// read that field from the etcd configuration file making Cilium fail to -// connect to a TLS-enabled etcd server. Since we should have deprecated the -// usage of this field a long time ago, in this galaxy, we will have this -// wrapper function as a workaround which will still use the `ca-file` field to -// avoid users breaking their connectivity to etcd when upgrading Cilium. -// TODO remove this wrapper in cilium >= 1.8 -func newConfig(fpath string) (*client.Config, error) { - cfg, err := clientyaml.NewConfig(fpath) - if err != nil { - return nil, err - } - if cfg.TLS == nil || cfg.TLS.RootCAs != nil { - return cfg, nil - } - - yc := &yamlConfig{} - b, err := os.ReadFile(fpath) - if err != nil { - return nil, err - } - err = yaml.Unmarshal(b, yc) - if err != nil { - return nil, err - } - if yc.InsecureTransport { - return cfg, nil - } - - if yc.CAfile != "" { - cp, err := tlsutil.NewCertPool([]string{yc.CAfile}) - if err != nil { - return nil, err - } - cfg.TLS.RootCAs = cp - } - return cfg, nil -} - -// reload on-disk certificate and key when needed -func getClientCertificateReloader(fpath string) (func(*tls.CertificateRequestInfo) (*tls.Certificate, error), error) { - yc := &yamlKeyPairConfig{} - b, err := os.ReadFile(fpath) - if err != nil { - return nil, err - } - err = yaml.Unmarshal(b, yc) - if err != nil { - return nil, err - } - if yc.Certfile == "" || yc.Keyfile == "" { - return nil, nil - } - reloader := func(_ *tls.CertificateRequestInfo) (*tls.Certificate, error) { - cer, err := tls.LoadX509KeyPair(yc.Certfile, yc.Keyfile) - return &cer, err - } - return reloader, nil -} - -// copy of relevant internal structure fields in go.etcd.io/etcd/clientv3/yaml -// needed to implement certificates reload, not depending on the deprecated -// newconfig/yamlConfig. -type yamlKeyPairConfig struct { - Certfile string `json:"cert-file"` - Keyfile string `json:"key-file"` -} - -// copy of the internal structure in github.com/etcd-io/etcd/clientv3/yaml so we -// can still use the `ca-file` field for one more release. -type yamlConfig struct { - client.Config - - InsecureTransport bool `json:"insecure-transport"` - InsecureSkipTLSVerify bool `json:"insecure-skip-tls-verify"` - Certfile string `json:"cert-file"` - Keyfile string `json:"key-file"` - TrustedCAfile string `json:"trusted-ca-file"` - - // CAfile is being deprecated. Use 'TrustedCAfile' instead. - // TODO: deprecate this in v4 - CAfile string `json:"ca-file"` -} diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/etcd_lease.go b/vendor/github.com/cilium/cilium/pkg/kvstore/etcd_lease.go deleted file mode 100644 index 2e0a2f6d9..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/etcd_lease.go +++ /dev/null @@ -1,307 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package kvstore - -import ( - "context" - "errors" - "strings" - "sync" - - "github.com/sirupsen/logrus" - v3rpcErrors "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" - client "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/client/v3/concurrency" - - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/spanstat" - "github.com/cilium/cilium/pkg/time" -) - -type leaseInfo struct { - count uint32 - session *concurrency.Session -} - -// etcdLeaseManager manages the acquisition of the leases, and keeps track of -// which lease is attached to which etcd key. -type etcdLeaseManager struct { - client *client.Client - log logrus.FieldLogger - - ttl time.Duration - limit uint32 - expired func(key string) - - mu lock.RWMutex - leases map[client.LeaseID]*leaseInfo - keys map[string]client.LeaseID - current client.LeaseID - - acquiring chan struct{} - wg sync.WaitGroup -} - -// newEtcdLeaseManager builds and returns a new lease manager instance. -func newEtcdLeaseManager(cl *client.Client, ttl time.Duration, limit uint32, expired func(key string), log logrus.FieldLogger) *etcdLeaseManager { - return &etcdLeaseManager{ - client: cl, - log: log, - - ttl: ttl, - limit: limit, - expired: expired, - - current: client.NoLease, - leases: make(map[client.LeaseID]*leaseInfo), - keys: make(map[string]client.LeaseID), - } -} - -// GetLeaseID returns a lease ID, and associates it to the given key. It leverages -// one of the already acquired leases if they are not already attached to too many -// keys, otherwise a new one is acquired. -// -// There's a small possibility that the returned lease is already expired, or gets -// expired immediately before use (due the time window between the lease expiration -// on the etcd server and the subsequent client side detection and garbage collection). -// As we cannot completely remove this uncertainty period, let's adopt the easiest -// approach here, without explicitly checking if the lease is expired before returning -// it (given that it would be a client-side check only). Instead, let's just rely on -// the fact that the operation will fail (as the lease is no longer valid), triggering -// a retry. At that point, a new (hopefully valid) lease will be retrieved again. -func (elm *etcdLeaseManager) GetLeaseID(ctx context.Context, key string) (client.LeaseID, error) { - session, err := elm.GetSession(ctx, key) - if err != nil { - return client.NoLease, err - } - - return session.Lease(), nil -} - -// GetSession returns a session, and associates it to the given key. It leverages -// one of the already acquired leases if they are not already attached to too many -// keys, otherwise a new one is acquired. -// -// There's a small possibility that the returned session is already expired, or gets -// expired immediately before use (due the time window between the lease expiration -// on the etcd server and the subsequent client side detection and garbage collection). -// As we cannot completely remove this uncertainty period, let's adopt the easiest -// approach here, without explicitly checking if the session is expired before returning -// it (given that it would be a client-side check only). Instead, let's just rely on -// the fact that the operation will fail (as the lease is no longer valid), triggering -// a retry. At that point, a new (hopefully valid) session will be retrieved again. -func (elm *etcdLeaseManager) GetSession(ctx context.Context, key string) (*concurrency.Session, error) { - elm.mu.Lock() - - // This key is already attached to a lease, hence just return it. - if leaseID := elm.keys[key]; leaseID != client.NoLease { - // The entry is guaranteed to exist if the lease is associated with a key - info := elm.leases[leaseID] - elm.mu.Unlock() - return info.session, nil - } - - // Return the current lease if it has not been used more than limit times - if info := elm.leases[elm.current]; info != nil && info.count < elm.limit { - info.count++ - elm.keys[key] = elm.current - elm.mu.Unlock() - - return info.session, nil - } - - // Otherwise, loop through the other known leases to see if any has been released - for lease, info := range elm.leases { - if info.count < elm.limit { - elm.current = lease - info.count++ - elm.keys[key] = elm.current - elm.mu.Unlock() - - return info.session, nil - } - } - - // If none is found, we need to acquire a new lease. acquiring is a channel - // used to detect whether we are already in the process of acquiring a new - // lease, to prevent multiple acquisitions in parallel. - acquiring := elm.acquiring - if acquiring == nil { - elm.acquiring = make(chan struct{}) - } - - // Unlock, so that we don't block other paraller operations (e.g., releases) - // while acquiring a new lease, since it might be a slow operation. - elm.mu.Unlock() - - // Someone else is already acquiring a new lease. Wait until - // it completes, and then retry again. - if acquiring != nil { - select { - case <-acquiring: - return elm.GetSession(ctx, key) - case <-ctx.Done(): - return nil, ctx.Err() - case <-elm.client.Ctx().Done(): - return nil, elm.client.Ctx().Err() - } - } - - // Otherwise, we can proceed to acquire a new lease. - session, err := elm.newSession(ctx) - - elm.mu.Lock() - - // Signal that the acquisition process has completed. - close(elm.acquiring) - elm.acquiring = nil - - if err != nil { - elm.mu.Unlock() - return nil, err - } - - elm.current = session.Lease() - elm.leases[session.Lease()] = &leaseInfo{session: session} - elm.mu.Unlock() - - return elm.GetSession(ctx, key) -} - -// Release decrements the counter of the lease attached to the given key. -func (elm *etcdLeaseManager) Release(key string) { - elm.mu.Lock() - defer elm.mu.Unlock() - - elm.releaseUnlocked(key) -} - -// ReleasePrefix decrements the counter of the leases attached to the keys -// starting with the given prefix. -func (elm *etcdLeaseManager) ReleasePrefix(prefix string) { - elm.mu.Lock() - defer elm.mu.Unlock() - - for key, leaseID := range elm.keys { - if strings.HasPrefix(key, prefix) { - if info := elm.leases[leaseID]; info != nil && info.count > 0 { - info.count-- - } - delete(elm.keys, key) - } - } -} - -// KeyHasLease returns whether the given key is associated with the specified lease. -func (elm *etcdLeaseManager) KeyHasLease(key string, leaseID client.LeaseID) bool { - elm.mu.RLock() - defer elm.mu.RUnlock() - - return elm.keys[key] == leaseID -} - -// CancelIfExpired verifies whether the error reports that the given lease has -// expired, and in that case aborts the corresponding keepalive process. -func (elm *etcdLeaseManager) CancelIfExpired(err error, leaseID client.LeaseID) { - if errors.Is(err, v3rpcErrors.ErrLeaseNotFound) { - elm.mu.Lock() - if info := elm.leases[leaseID]; info != nil { - info.session.Orphan() - } - elm.mu.Unlock() - } -} - -// TotalLeases returns the number of managed leases. -func (elm *etcdLeaseManager) TotalLeases() uint32 { - elm.mu.RLock() - defer elm.mu.RUnlock() - - return uint32(len(elm.leases)) -} - -// Wait waits until all child goroutines terminated. -func (elm *etcdLeaseManager) Wait() { - elm.wg.Wait() -} - -func (elm *etcdLeaseManager) newSession(ctx context.Context) (session *concurrency.Session, err error) { - defer func(duration *spanstat.SpanStat) { - increaseMetric("lease", metricSet, "AcquireLease", duration.EndError(err).Total(), err) - }(spanstat.Start()) - resp, err := elm.client.Grant(ctx, int64(elm.ttl.Seconds())) - if err != nil { - return nil, err - } - leaseID := resp.ID - - // Construct the session specifying the lease just acquired. This allows to - // split the possibly blocking operation (i.e., lease acquisition), from the - // non-blocking one (i.e., the setup of the keepalive logic), so that we can use - // different contexts. We want the lease acquisition to be controlled by the - // context associated with the given request, while the keepalive process should - // continue until either the etcd client is closed or the session is orphaned. - session, err = concurrency.NewSession(elm.client, - concurrency.WithLease(leaseID), - concurrency.WithTTL(int(elm.ttl.Seconds())), - ) - if err != nil { - return nil, err - } - - elm.wg.Add(1) - go elm.waitForExpiration(session) - - elm.log.WithFields(logrus.Fields{ - "LeaseID": leaseID, - "TTL": elm.ttl, - }).Info("New lease successfully acquired") - return session, nil -} - -func (elm *etcdLeaseManager) waitForExpiration(session *concurrency.Session) { - defer elm.wg.Done() - - // Block until the session gets orphaned, either because it fails to be - // renewed or the etcd client is closed. - <-session.Done() - - select { - case <-elm.client.Ctx().Done(): - // The context of the etcd client was closed - return - default: - } - - elm.log.WithField("LeaseID", session.Lease()).Warning("Lease expired") - - elm.mu.Lock() - delete(elm.leases, session.Lease()) - - var keys []string - for key, id := range elm.keys { - if id == session.Lease() { - keys = append(keys, key) - delete(elm.keys, key) - } - } - elm.mu.Unlock() - - if elm.expired != nil { - for _, key := range keys { - elm.expired(key) - } - } -} - -func (elm *etcdLeaseManager) releaseUnlocked(key string) { - leaseID := elm.keys[key] - if leaseID != client.NoLease { - if info := elm.leases[leaseID]; info != nil && info.count > 0 { - info.count-- - } - delete(elm.keys, key) - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/events.go b/vendor/github.com/cilium/cilium/pkg/kvstore/events.go deleted file mode 100644 index 56c71b4c5..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/events.go +++ /dev/null @@ -1,91 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium -package kvstore - -import ( - "sync" -) - -// EventType defines the type of watch event that occurred -type EventType int - -const ( - // EventTypeCreate represents a newly created key - EventTypeCreate EventType = iota - // EventTypeModify represents a modified key - EventTypeModify - // EventTypeDelete represents a deleted key - EventTypeDelete - //EventTypeListDone signals that the initial list operation has completed - EventTypeListDone -) - -// String() returns the human readable format of an event type -func (t EventType) String() string { - switch t { - case EventTypeCreate: - return "create" - case EventTypeModify: - return "modify" - case EventTypeDelete: - return "delete" - case EventTypeListDone: - return "listDone" - default: - return "unknown" - } -} - -// KeyValueEvent is a change event for a Key/Value pair -type KeyValueEvent struct { - // Typ is the type of event { EventTypeCreate | EventTypeModify | EventTypeDelete | EventTypeListDone } - Typ EventType - - // Key is the kvstore key that changed - Key string - - // Value is the kvstore value associated with the key - Value []byte -} - -// EventChan is a channel to receive events on -type EventChan chan KeyValueEvent - -// stopChan is the channel used to indicate stopping of the watcher -type stopChan chan struct{} - -// Watcher represents a KVstore watcher -type Watcher struct { - // Events is the channel to which change notifications will be sent to - Events EventChan `json:"-"` - - Prefix string `json:"prefix"` - stopWatch stopChan - - // stopOnce guarantees that Stop() is only called once - stopOnce sync.Once - - // stopWait is the wait group to wait for watchers to exit gracefully - stopWait sync.WaitGroup -} - -func newWatcher(prefix string, chanSize int) *Watcher { - w := &Watcher{ - Prefix: prefix, - Events: make(EventChan, chanSize), - stopWatch: make(stopChan), - } - - w.stopWait.Add(1) - - return w -} - -// Stop stops a watcher previously created and started with Watch() -func (w *Watcher) Stop() { - w.stopOnce.Do(func() { - close(w.stopWatch) - log.WithField(fieldPrefix, w.Prefix).Debug("Stopped watcher") - w.stopWait.Wait() - }) -} diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/kvstore.go b/vendor/github.com/cilium/cilium/pkg/kvstore/kvstore.go deleted file mode 100644 index b483d594e..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/kvstore.go +++ /dev/null @@ -1,64 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package kvstore - -import ( - "strings" - - "github.com/cilium/cilium/pkg/time" -) - -// Value is an abstraction of the data stored in the kvstore as well as the -// mod revision of that data. -type Value struct { - Data []byte - ModRevision uint64 - LeaseID int64 - SessionID string -} - -// KeyValuePairs is a map of key=value pairs -type KeyValuePairs map[string]Value - -const ( - // BaseKeyPrefix is the base prefix that should be used for all keys - BaseKeyPrefix = "cilium" - - // InitLockPath is the path to the init lock to test quorum - InitLockPath = BaseKeyPrefix + "/.initlock" - - // HeartbeatPath is the path to the key at which the operator updates - // the heartbeat - HeartbeatPath = BaseKeyPrefix + "/.heartbeat" - - // HasClusterConfigPath is the path to the key used to convey that the cluster - // configuration will be eventually created, and remote cilium agents shall - // wait until it is present. If this key is not set, the cilium configuration - // might, or might not, be configured, but the agents will continue regardless, - // falling back to the backward compatible behavior. It must be set before that - // the agents have the possibility to connect to the kvstore (that is, when - // it is not yet exposed). The corresponding values is ignored. - HasClusterConfigPath = BaseKeyPrefix + "/.has-cluster-config" - - // ClusterConfigPrefix is the kvstore prefix to cluster configuration - ClusterConfigPrefix = BaseKeyPrefix + "/cluster-config" - - // SyncedPrefix is the kvstore prefix used to convey whether - // synchronization from an external source has completed for a given prefix - SyncedPrefix = BaseKeyPrefix + "/synced" - - // HeartbeatWriteInterval is the interval in which the heartbeat key at - // HeartbeatPath is updated - HeartbeatWriteInterval = time.Minute -) - -// StateToCachePrefix converts a kvstore prefix starting with "cilium/state" -// (holding the cilium state) to the corresponding one holding cached information -// from another kvstore (that is, "cilium/cache"). -func StateToCachePrefix(prefix string) string { - if strings.HasPrefix(prefix, "cilium/state") { - return strings.Replace(prefix, "cilium/state", "cilium/cache", 1) - } - return prefix -} diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/lock.go b/vendor/github.com/cilium/cilium/pkg/kvstore/lock.go deleted file mode 100644 index c70ee8104..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/lock.go +++ /dev/null @@ -1,172 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package kvstore - -import ( - "context" - "fmt" - - "github.com/davecgh/go-spew/spew" - "github.com/google/uuid" - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/pkg/debug" - "github.com/cilium/cilium/pkg/defaults" - "github.com/cilium/cilium/pkg/inctimer" - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/time" -) - -var ( - kvstoreLocks = pathLocks{lockPaths: map[string]lockOwner{}} - - // staleLockTimeout is the timeout after which waiting for a believed - // other local lock user for the same key is given up on and etcd is - // asked directly. It is still highly unlikely that concurrent access - // occurs as only one consumer will manage to acquire the newly - // released lock. The only possibility of concurrent access is if a - // consumer is *still* holding the lock but this is highly unlikely - // given the duration of this timeout. - staleLockTimeout = defaults.KVStoreStaleLockTimeout -) - -type KVLocker interface { - Unlock(ctx context.Context) error - // Comparator returns an object that should be used by the KVStore to make - // sure if the lock is still valid for its client or nil if no such - // verification exists. - Comparator() interface{} -} - -// getLockPath returns the lock path representation of the given path. -func getLockPath(path string) string { - return path + ".lock" -} - -type lockOwner struct { - created time.Time - id uuid.UUID -} - -type pathLocks struct { - mutex lock.RWMutex - lockPaths map[string]lockOwner -} - -func init() { - debug.RegisterStatusObject("kvstore-locks", &kvstoreLocks) -} - -// DebugStatus implements debug.StatusObject to provide debug status collection -// ability -func (pl *pathLocks) DebugStatus() string { - pl.mutex.RLock() - str := spew.Sdump(pl.lockPaths) - pl.mutex.RUnlock() - return str -} - -func (pl *pathLocks) runGC() { - pl.mutex.Lock() - for path, owner := range pl.lockPaths { - if time.Since(owner.created) > staleLockTimeout { - log.WithField("path", path).Error("Forcefully unlocking local kvstore lock") - delete(pl.lockPaths, path) - } - } - pl.mutex.Unlock() -} - -func (pl *pathLocks) lock(ctx context.Context, path string) (id uuid.UUID, err error) { - lockTimer, lockTimerDone := inctimer.New() - defer lockTimerDone() - for { - pl.mutex.Lock() - if _, ok := pl.lockPaths[path]; !ok { - id = uuid.New() - pl.lockPaths[path] = lockOwner{ - created: time.Now(), - id: id, - } - pl.mutex.Unlock() - return - } - pl.mutex.Unlock() - - select { - case <-lockTimer.After(time.Duration(10) * time.Millisecond): - case <-ctx.Done(): - err = fmt.Errorf("lock was cancelled: %w", ctx.Err()) - return - } - } -} - -func (pl *pathLocks) unlock(path string, id uuid.UUID) { - pl.mutex.Lock() - if owner, ok := pl.lockPaths[path]; ok && owner.id == id { - delete(pl.lockPaths, path) - } - pl.mutex.Unlock() -} - -// Lock is a lock return by LockPath -type Lock struct { - path string - id uuid.UUID - kvLock KVLocker -} - -// LockPath locks the specified path. The key for the lock is not the path -// provided itself but the path with a suffix of ".lock" appended. The lock -// returned also contains a patch specific local Mutex which will be held. -// -// It is required to call Unlock() on the returned Lock to unlock -func LockPath(ctx context.Context, backend BackendOperations, path string) (l *Lock, err error) { - id, err := kvstoreLocks.lock(ctx, path) - if err != nil { - return nil, err - } - - lock, err := backend.LockPath(ctx, path) - if err != nil { - kvstoreLocks.unlock(path, id) - Trace("Failed to lock", err, logrus.Fields{fieldKey: path}) - err = fmt.Errorf("error while locking path %s: %w", path, err) - return nil, err - } - - Trace("Successful lock", err, logrus.Fields{fieldKey: path}) - return &Lock{kvLock: lock, path: path, id: id}, err -} - -// RunLockGC inspects all local kvstore locks to determine whether they have -// been held longer than the stale lock timeout, and if so, unlocks them -// forceably. -func RunLockGC() { - kvstoreLocks.runGC() -} - -// Unlock unlocks a lock -func (l *Lock) Unlock(ctx context.Context) error { - if l == nil { - return nil - } - - // Unlock kvstore mutex first - err := l.kvLock.Unlock(ctx) - if err != nil { - log.WithError(err).WithField("path", l.path).Error("Unable to unlock kvstore lock") - } - - // unlock local lock even if kvstore cannot be unlocked - kvstoreLocks.unlock(l.path, l.id) - Trace("Unlocked", nil, logrus.Fields{fieldKey: l.path}) - - return err -} - -func (l *Lock) Comparator() interface{} { - return l.kvLock.Comparator() -} diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/logfields.go b/vendor/github.com/cilium/cilium/pkg/kvstore/logfields.go deleted file mode 100644 index 3cef331fe..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/logfields.go +++ /dev/null @@ -1,43 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package kvstore - -import ( - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" -) - -var log = logging.DefaultLogger.WithField(logfields.LogSubsys, "kvstore") - -const ( - // fieldKVStoreModule is the name of the kvstore backend (etcd or consul) - fieldKVStoreModule = "module" - - // key revision - fieldRev = "revision" - - // fieldPrefix is the prefix of the key used in the operation - fieldPrefix = "prefix" - - // fieldKey is the prefix of the key used in the operation - fieldKey = "key" - - // fieldValue is the prefix of the key used in the operation - fieldValue = "value" - - // fieldNumEntries is the number of entries in the result - fieldNumEntries = "numEntries" - - // fieldRemainingEntries is the number of entries still to be retrieved - fieldRemainingEntries = "remainingEntries" - - // fieldAttachLease is true if the key must be attached to a lease - fieldAttachLease = "attachLease" - - // FieldUser identifies a user in the kvstore - FieldUser = logfields.User - - // FieldRole identifies a role in the kvstore - FieldRole = "role" -) diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/metrics.go b/vendor/github.com/cilium/cilium/pkg/kvstore/metrics.go deleted file mode 100644 index 4f09efd73..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/metrics.go +++ /dev/null @@ -1,53 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package kvstore - -import ( - "fmt" - "strings" - - "github.com/cilium/cilium/pkg/metrics" - "github.com/cilium/cilium/pkg/time" -) - -const ( - metricDelete = "delete" - metricRead = "read" - metricSet = "set" -) - -func GetScopeFromKey(key string) string { - s := strings.SplitN(key, "/", 5) - if len(s) < 4 { - if len(key) >= 12 { - return key[:12] - } - return key - } - return fmt.Sprintf("%s/%s", s[2], s[3]) -} - -func increaseMetric(key, kind, action string, duration time.Duration, err error) { - if !metrics.KVStoreOperationsDuration.IsEnabled() { - return - } - namespace := GetScopeFromKey(key) - outcome := metrics.Error2Outcome(err) - metrics.KVStoreOperationsDuration. - WithLabelValues(namespace, kind, action, outcome).Observe(duration.Seconds()) -} - -func trackEventQueued(key string, typ EventType, duration time.Duration) { - if !metrics.KVStoreEventsQueueDuration.IsEnabled() { - return - } - metrics.KVStoreEventsQueueDuration.WithLabelValues(GetScopeFromKey(key), typ.String()).Observe(duration.Seconds()) -} - -func recordQuorumError(err string) { - if !metrics.KVStoreQuorumErrors.IsEnabled() { - return - } - metrics.KVStoreQuorumErrors.WithLabelValues(err).Inc() -} diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/store/cell.go b/vendor/github.com/cilium/cilium/pkg/kvstore/store/cell.go deleted file mode 100644 index 74730f7c0..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/store/cell.go +++ /dev/null @@ -1,47 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package store - -import ( - "github.com/cilium/hive/cell" - - "github.com/cilium/cilium/pkg/metrics" -) - -var Cell = cell.Module( - "kvstore-utils", - "Provides factory for kvstore related synchronizers", - - cell.Provide(NewFactory), - - metrics.Metric(MetricsProvider), -) - -type Factory interface { - NewSyncStore(clusterName string, backend SyncStoreBackend, prefix string, opts ...WSSOpt) SyncStore - NewWatchStore(clusterName string, keyCreator KeyCreator, observer Observer, opts ...RWSOpt) WatchStore - NewWatchStoreManager(backend WatchStoreBackend, clusterName string) WatchStoreManager -} - -type factoryImpl struct { - metrics *Metrics -} - -func (w *factoryImpl) NewSyncStore(clusterName string, backend SyncStoreBackend, prefix string, opts ...WSSOpt) SyncStore { - return newWorkqueueSyncStore(clusterName, backend, prefix, w.metrics, opts...) -} - -func (w *factoryImpl) NewWatchStore(clusterName string, keyCreator KeyCreator, observer Observer, opts ...RWSOpt) WatchStore { - return newRestartableWatchStore(clusterName, keyCreator, observer, w.metrics, opts...) -} - -func (w *factoryImpl) NewWatchStoreManager(backend WatchStoreBackend, clusterName string) WatchStoreManager { - return newWatchStoreManagerSync(backend, clusterName, w) -} - -func NewFactory(storeMetrics *Metrics) Factory { - return &factoryImpl{ - metrics: storeMetrics, - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/store/doc.go b/vendor/github.com/cilium/cilium/pkg/kvstore/store/doc.go deleted file mode 100644 index 780065293..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/store/doc.go +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Package store implements a shared store backed by a kvstore or similar with -// the following properties: -// -// - A single type is used to represent all keys -// - Any number of collaborators can join the store. Typically a collaborator -// is an individual Cilium agent running on each node. -// - All collaborators can own and contribute keys to the store. Each key is -// owned by exactly one collaborator. It is the responsibility of each -// collaborator to pick a key name which is guaranteed to be unique. -// - All collaborate desire to see all keys within the scope of a store. The -// scope of the store is defined by a common key prefix. For this purpose, -// each collaborator maintains a local cache of all keys in the store by -// subscribing to change events. -package store diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/store/metrics.go b/vendor/github.com/cilium/cilium/pkg/kvstore/store/metrics.go deleted file mode 100644 index 171436f0d..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/store/metrics.go +++ /dev/null @@ -1,38 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package store - -import ( - "github.com/cilium/cilium/pkg/metrics" - "github.com/cilium/cilium/pkg/metrics/metric" -) - -type Metrics struct { - KVStoreSyncQueueSize metric.Vec[metric.Gauge] - KVStoreSyncErrors metric.Vec[metric.Counter] - KVStoreInitialSyncCompleted metric.Vec[metric.Gauge] -} - -func MetricsProvider() *Metrics { - return &Metrics{ - KVStoreSyncQueueSize: metric.NewGaugeVec(metric.GaugeOpts{ - Namespace: metrics.Namespace, - Subsystem: metrics.SubsystemKVStore, - Name: "sync_queue_size", - Help: "Number of elements queued for synchronization in the kvstore", - }, []string{metrics.LabelScope, metrics.LabelSourceCluster}), - KVStoreSyncErrors: metric.NewCounterVec(metric.CounterOpts{ - Namespace: metrics.Namespace, - Subsystem: metrics.SubsystemKVStore, - Name: "sync_errors_total", - Help: "Number of times synchronization to the kvstore failed", - }, []string{metrics.LabelScope, metrics.LabelSourceCluster}), - KVStoreInitialSyncCompleted: metric.NewGaugeVec(metric.GaugeOpts{ - Namespace: metrics.Namespace, - Subsystem: metrics.SubsystemKVStore, - Name: "initial_sync_completed", - Help: "Whether the initial synchronization from/to the kvstore has completed", - }, []string{metrics.LabelScope, metrics.LabelSourceCluster, metrics.LabelAction}), - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/store/store.go b/vendor/github.com/cilium/cilium/pkg/kvstore/store/store.go deleted file mode 100644 index 73a05859b..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/store/store.go +++ /dev/null @@ -1,506 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package store - -import ( - "context" - "fmt" - "path" - "strings" - - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/pkg/controller" - "github.com/cilium/cilium/pkg/kvstore" - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/option" - "github.com/cilium/cilium/pkg/time" -) - -const ( - // listTimeoutDefault is the default timeout to wait while performing - // the initial list operation of objects from the kvstore - listTimeoutDefault = 3 * time.Minute - - // watcherChanSize is the size of the channel to buffer kvstore events - watcherChanSize = 100 -) - -var ( - controllers controller.Manager - - log = logging.DefaultLogger.WithField(logfields.LogSubsys, "shared-store") - - kvstoreSyncControllerGroup = controller.NewGroup("kvstore-sync") -) - -// KeyCreator is the function to create a new empty Key instances. Store -// collaborators must implement this interface and provide the implementation -// in the Configuration structure. -type KeyCreator func() Key - -// Configuration is the set of configuration parameters of a shared store. -type Configuration struct { - // Prefix is the key prefix of the store shared by all keys. The prefix - // is the unique identification of the store. Multiple collaborators - // connected to the same kvstore cluster configuring stores with - // matching prefixes will automatically form a shared store. This - // parameter is required. - Prefix string - - // SynchronizationInterval is the interval in which locally owned keys - // are synchronized with the kvstore. This parameter is optional. - SynchronizationInterval time.Duration - - // SharedKeyDeleteDelay is the delay before a shared key delete is - // handled. This parameter is optional, and defaults to 0 if unset. - SharedKeyDeleteDelay time.Duration - - // KeyCreator is called to allocate a Key instance when a new shared - // key is discovered. This parameter is required. - KeyCreator KeyCreator - - // Backend is the kvstore to use as a backend. If no backend is - // specified, kvstore.Client() is being used. - Backend kvstore.BackendOperations - - // Observer is the observe that will receive events on key mutations - Observer Observer - - Context context.Context -} - -// validate is invoked by JoinSharedStore to validate and complete the -// configuration. It returns nil when the configuration is valid. -func (c *Configuration) validate() error { - if c.Prefix == "" { - return fmt.Errorf("prefix must be specified") - } - - if c.KeyCreator == nil { - return fmt.Errorf("KeyCreator must be specified") - } - - if c.SynchronizationInterval == 0 { - c.SynchronizationInterval = option.Config.KVstorePeriodicSync - } - - if c.Backend == nil { - c.Backend = kvstore.Client() - } - - if c.Context == nil { - c.Context = context.Background() - } - - return nil -} - -// SharedStore is an instance of a shared store. It is created with -// JoinSharedStore() and released with the SharedStore.Close() function. -type SharedStore struct { - // conf is a copy of the store configuration. This field is never - // mutated after JoinSharedStore() so it is safe to access this without - // a lock. - conf Configuration - - // name is the name of the shared store. It is derived from the kvstore - // prefix. - name string - - // controllerName is the name of the controller used to synchronize - // with the kvstore. It is derived from the name. - controllerName string - - // backend is the backend as configured via Configuration - backend kvstore.BackendOperations - - // mutex protects mutations to localKeys and sharedKeys - mutex lock.RWMutex - - // localKeys is a map of keys that are owned by the local instance. All - // local keys are synchronized with the kvstore. This map can be - // modified with UpdateLocalKey() and DeleteLocalKey(). - localKeys map[string]LocalKey - - // sharedKeys is a map of all keys that either have been discovered - // from remote collaborators or successfully shared local keys. This - // map represents the state in the kvstore and is updated based on - // kvstore events. - sharedKeys map[string]Key - - kvstoreWatcher *kvstore.Watcher -} - -// Observer receives events when objects in the store mutate -type Observer interface { - // OnDelete is called when the key has been deleted from the shared store - OnDelete(k NamedKey) - - // OnUpdate is called whenever a change has occurred in the data - // structure represented by the key - OnUpdate(k Key) -} - -// NamedKey is an interface that a data structure must implement in order to -// be deleted from a SharedStore. -type NamedKey interface { - // GetKeyName must return the name of the key. The name of the key must - // be unique within the store and stable for a particular key. The name - // of the key must be identical across agent restarts as the keys - // remain in the kvstore. - GetKeyName() string -} - -// Key is the interface that a data structure must implement in order to be -// stored and shared as a key in a SharedStore. -type Key interface { - NamedKey - - // Marshal is called to retrieve the byte slice representation of the - // data represented by the key to store it in the kvstore. The function - // must ensure that the underlying datatype is properly locked. It is - // typically a good idea to use json.Marshal to implement this - // function. - Marshal() ([]byte, error) - - // Unmarshal is called when an update from the kvstore is received. The - // prefix configured for the store is removed from the key, and the - // byte slice passed to the function is coming from the Marshal - // function from another collaborator. The function must unmarshal and - // update the underlying data type. It is typically a good idea to use - // json.Unmarshal to implement this function. - Unmarshal(key string, data []byte) error -} - -// LocalKey is a Key owned by the local store instance -type LocalKey interface { - Key - - // DeepKeyCopy must return a deep copy of the key - DeepKeyCopy() LocalKey -} - -// KVPair represents a basic implementation of the LocalKey interface -type KVPair struct{ Key, Value string } - -func NewKVPair(key, value string) *KVPair { return &KVPair{Key: key, Value: value} } -func KVPairCreator() Key { return &KVPair{} } - -func (kv *KVPair) GetKeyName() string { return kv.Key } -func (kv *KVPair) Marshal() ([]byte, error) { return []byte(kv.Value), nil } - -func (kv *KVPair) Unmarshal(key string, data []byte) error { - kv.Key, kv.Value = key, string(data) - return nil -} - -func (kv *KVPair) DeepKeyCopy() LocalKey { - return NewKVPair(kv.Key, kv.Value) -} - -// JoinSharedStore creates a new shared store based on the provided -// configuration. An error is returned if the configuration is invalid. The -// store is initialized with the contents of the kvstore. An error is returned -// if the contents cannot be retrieved synchronously from the kvstore. Starts a -// controller to continuously synchronize the store with the kvstore. -func JoinSharedStore(c Configuration) (*SharedStore, error) { - if err := c.validate(); err != nil { - return nil, err - } - - s := &SharedStore{ - conf: c, - localKeys: map[string]LocalKey{}, - sharedKeys: map[string]Key{}, - backend: c.Backend, - } - - s.name = "store-" + s.conf.Prefix - s.controllerName = "kvstore-sync-" + s.name - - if err := s.listAndStartWatcher(); err != nil { - return nil, err - } - - controllers.UpdateController(s.controllerName, - controller.ControllerParams{ - Group: kvstoreSyncControllerGroup, - DoFunc: func(ctx context.Context) error { - return s.syncLocalKeys(ctx, true) - }, - RunInterval: s.conf.SynchronizationInterval, - }, - ) - - return s, nil -} - -func (s *SharedStore) onDelete(k NamedKey) { - if s.conf.Observer != nil { - s.conf.Observer.OnDelete(k) - } -} - -func (s *SharedStore) onUpdate(k Key) { - if s.conf.Observer != nil { - s.conf.Observer.OnUpdate(k) - } -} - -// Release frees all resources own by the store but leaves all keys in the -// kvstore intact -func (s *SharedStore) Release() { - // Wait for all write operations to complete and then block all further - // operations - s.mutex.Lock() - defer s.mutex.Unlock() - - if s.kvstoreWatcher != nil { - s.kvstoreWatcher.Stop() - } - - controllers.RemoveController(s.controllerName) -} - -// Close stops participation with a shared store and removes all keys owned by -// this node in the kvstore. This stops the controller started by -// JoinSharedStore(). -func (s *SharedStore) Close(ctx context.Context) { - s.Release() - - for name, key := range s.localKeys { - if err := s.backend.Delete(ctx, s.keyPath(key)); err != nil { - s.getLogger().WithError(err).Warning("Unable to delete key in kvstore") - } - - delete(s.localKeys, name) - // Since we have received our own notification we also need to remove - // it from the shared keys. - delete(s.sharedKeys, name) - - s.onDelete(key) - } -} - -// keyPath returns the absolute kvstore path of a key -func (s *SharedStore) keyPath(key NamedKey) string { - // WARNING - STABLE API: The composition of the absolute key path - // cannot be changed without breaking up and downgrades. - return path.Join(s.conf.Prefix, key.GetKeyName()) -} - -// syncLocalKey synchronizes a key to the kvstore -func (s *SharedStore) syncLocalKey(ctx context.Context, key LocalKey, lease bool) error { - jsonValue, err := key.Marshal() - if err != nil { - return err - } - - // Update key in kvstore, overwrite an eventual existing key. If requested, attach - // lease to expire entry when agent dies and never comes back up. - if _, err := s.backend.UpdateIfDifferent(ctx, s.keyPath(key), jsonValue, lease); err != nil { - return err - } - - return nil -} - -// syncLocalKeys synchronizes all local keys with the kvstore -func (s *SharedStore) syncLocalKeys(ctx context.Context, lease bool) error { - // Create a copy of all local keys so we can unlock and sync to kvstore - // without holding the lock - s.mutex.RLock() - keys := make([]LocalKey, 0, len(s.localKeys)) - for _, key := range s.localKeys { - keys = append(keys, key) - } - s.mutex.RUnlock() - - for _, key := range keys { - if err := s.syncLocalKey(ctx, key, lease); err != nil { - return err - } - } - - return nil -} - -func (s *SharedStore) lookupLocalKey(name string) LocalKey { - s.mutex.RLock() - defer s.mutex.RUnlock() - - for _, key := range s.localKeys { - if key.GetKeyName() == name { - return key - } - } - - return nil -} - -// NumEntries returns the number of entries in the store -func (s *SharedStore) NumEntries() int { - if s == nil { - return 0 - } - - s.mutex.RLock() - defer s.mutex.RUnlock() - return len(s.sharedKeys) -} - -// SharedKeysMap returns a copy of the SharedKeysMap, the returned map can -// be safely modified but the values of the map represent the actual data -// stored in the internal SharedStore SharedKeys map. -func (s *SharedStore) SharedKeysMap() map[string]Key { - s.mutex.RLock() - defer s.mutex.RUnlock() - sharedKeysCopy := make(map[string]Key, len(s.sharedKeys)) - - for k, v := range s.sharedKeys { - sharedKeysCopy[k] = v - } - return sharedKeysCopy -} - -// UpdateLocalKeySync synchronously synchronizes a local key with the kvstore -// and adds it to the list of local keys to be synchronized if the initial -// synchronous synchronization was successful -func (s *SharedStore) UpdateLocalKeySync(ctx context.Context, key LocalKey) error { - s.mutex.Lock() - defer s.mutex.Unlock() - err := s.syncLocalKey(ctx, key, true) - if err == nil { - s.localKeys[key.GetKeyName()] = key.DeepKeyCopy() - } - return err -} - -// UpdateKeySync synchronously synchronizes a key with the kvstore. -func (s *SharedStore) UpdateKeySync(ctx context.Context, key LocalKey, lease bool) error { - return s.syncLocalKey(ctx, key, lease) -} - -// DeleteLocalKey removes a key from being synchronized with the kvstore -func (s *SharedStore) DeleteLocalKey(ctx context.Context, key NamedKey) { - name := key.GetKeyName() - - s.mutex.Lock() - _, ok := s.localKeys[name] - delete(s.localKeys, name) - s.mutex.Unlock() - - err := s.backend.Delete(ctx, s.keyPath(key)) - - if ok { - if err != nil { - s.getLogger().WithError(err).Warning("Unable to delete key in kvstore") - } - - s.onDelete(key) - } -} - -func (s *SharedStore) getLogger() *logrus.Entry { - return log.WithFields(logrus.Fields{ - "storeName": s.name, - }) -} - -func (s *SharedStore) updateKey(name string, value []byte) error { - newKey := s.conf.KeyCreator() - if err := newKey.Unmarshal(name, value); err != nil { - return err - } - - s.mutex.Lock() - s.sharedKeys[name] = newKey - s.mutex.Unlock() - - s.onUpdate(newKey) - return nil -} - -func (s *SharedStore) deleteSharedKey(name string) { - s.mutex.Lock() - existingKey, ok := s.sharedKeys[name] - delete(s.sharedKeys, name) - s.mutex.Unlock() - - if ok { - go func() { - time.Sleep(s.conf.SharedKeyDeleteDelay) - s.mutex.RLock() - _, ok := s.sharedKeys[name] - s.mutex.RUnlock() - if ok { - s.getLogger().WithFields(logrus.Fields{"key": name, "timeWindow": s.conf.SharedKeyDeleteDelay}). - Warning("Received delete event for key which re-appeared within delay time window") - return - } - - s.onDelete(existingKey) - }() - } else { - s.getLogger().WithField("key", name). - Warning("Unable to find deleted key in local state") - } -} - -func (s *SharedStore) listAndStartWatcher() error { - listDone := make(chan struct{}) - - go s.watcher(listDone) - - select { - case <-listDone: - case <-time.After(listTimeoutDefault): - return fmt.Errorf("timeout while retrieving initial list of objects from kvstore") - } - - return nil -} - -func (s *SharedStore) watcher(listDone chan struct{}) { - s.kvstoreWatcher = s.backend.ListAndWatch(s.conf.Context, s.conf.Prefix, watcherChanSize) - - for event := range s.kvstoreWatcher.Events { - if event.Typ == kvstore.EventTypeListDone { - s.getLogger().Debug("Initial list of objects received from kvstore") - close(listDone) - continue - } - - logger := s.getLogger().WithFields(logrus.Fields{ - "key": event.Key, - "eventType": event.Typ, - }) - - logger.Debugf("Received key update via kvstore [value %s]", string(event.Value)) - - keyName := strings.TrimPrefix(event.Key, s.conf.Prefix) - if keyName[0] == '/' { - keyName = keyName[1:] - } - - switch event.Typ { - case kvstore.EventTypeCreate, kvstore.EventTypeModify: - if err := s.updateKey(keyName, event.Value); err != nil { - logger.WithError(err).Warningf("Unable to unmarshal store value: %s", string(event.Value)) - } - - case kvstore.EventTypeDelete: - if localKey := s.lookupLocalKey(keyName); localKey != nil { - logger.Warning("Received delete event for local key. Re-creating the key in the kvstore") - - s.syncLocalKey(s.conf.Context, localKey, true) - } else { - s.deleteSharedKey(keyName) - } - } - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/store/syncstore.go b/vendor/github.com/cilium/cilium/pkg/kvstore/store/syncstore.go deleted file mode 100644 index f8af6aa99..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/store/syncstore.go +++ /dev/null @@ -1,360 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package store - -import ( - "bytes" - "context" - "fmt" - "path" - "strings" - "sync" - "sync/atomic" - - "github.com/prometheus/client_golang/prometheus" - "github.com/sirupsen/logrus" - "k8s.io/client-go/util/workqueue" - - "github.com/cilium/cilium/pkg/kvstore" - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/metrics" - "github.com/cilium/cilium/pkg/time" -) - -// SyncStore abstracts the operations allowing to synchronize key/value pairs -// into a kvstore. -type SyncStore interface { - // Run starts the SyncStore logic, blocking until the context is closed. - Run(ctx context.Context) - - // UpsertKey upserts a key/value pair into the kvstore. - UpsertKey(ctx context.Context, key Key) error - - // DeleteKey removes a key from the kvstore. - DeleteKey(ctx context.Context, key NamedKey) error - - // Synced triggers the insertion of the "synced" key associated with this - // store into the kvstore once all upsertions already issued have completed - // successfully, eventually executing all specified callbacks (if any). - // Only the first invocation takes effect. - Synced(ctx context.Context, callbacks ...func(ctx context.Context)) error -} - -// SyncStoreBackend represents the subset kvstore.BackendOperations leveraged -// by SyncStore implementations. -type SyncStoreBackend interface { - // Update creates or updates a key. - Update(ctx context.Context, key string, value []byte, lease bool) error - // Delete deletes a key. - Delete(ctx context.Context, key string) error - - // RegisterLeaseExpiredObserver registers a function which is executed when - // the lease associated with a key having the given prefix is detected as expired. - RegisterLeaseExpiredObserver(prefix string, fn func(key string)) -} - -// wqSyncStore implements the SyncStore interface leveraging a workqueue to -// coalescence update/delete requests and handle retries in case of errors. -type wqSyncStore struct { - backend SyncStoreBackend - prefix string - source string - - workers uint - withLease bool - - limiter workqueue.RateLimiter - workqueue workqueue.RateLimitingInterface - state lock.Map[string, []byte] // map[NamedKey.GetKeyName()]Key.Marshal() - - synced atomic.Bool // Synced() has been triggered - pendingSync lock.Map[string, struct{}] // the set of keys still to sync - syncedKey string - syncedCallbacks []func(context.Context) - - log *logrus.Entry - queuedMetric prometheus.Gauge - errorsMetric prometheus.Counter - syncedMetric prometheus.Gauge -} - -type syncCanary struct{ skipCallbacks bool } - -type WSSOpt func(*wqSyncStore) - -// WSSWithRateLimiter sets the rate limiting algorithm to be used when requeueing failed events. -func WSSWithRateLimiter(limiter workqueue.RateLimiter) WSSOpt { - return func(wss *wqSyncStore) { - wss.limiter = limiter - } -} - -// WSSWithWorkers configures the number of workers spawned by Run() to handle update/delete operations. -func WSSWithWorkers(workers uint) WSSOpt { - return func(wss *wqSyncStore) { - wss.workers = workers - } -} - -// WSSWithoutLease disables attaching the lease to upserted keys. -func WSSWithoutLease() WSSOpt { - return func(wss *wqSyncStore) { - wss.withLease = false - } -} - -// WSSWithSyncedKeyOverride overrides the "synced" key inserted into the kvstore -// when initial synchronization completed (by default it corresponds to the prefix). -func WSSWithSyncedKeyOverride(key string) WSSOpt { - return func(wss *wqSyncStore) { - wss.syncedKey = key - } -} - -// NewWorkqueueSyncStore returns a SyncStore instance which leverages a workqueue -// to coalescence update/delete requests and handle retries in case of errors. -func newWorkqueueSyncStore(clusterName string, backend SyncStoreBackend, prefix string, m *Metrics, opts ...WSSOpt) SyncStore { - wss := &wqSyncStore{ - backend: backend, - prefix: prefix, - source: clusterName, - - workers: 1, - withLease: true, - limiter: workqueue.DefaultControllerRateLimiter(), - syncedKey: prefix, - - log: log.WithField(logfields.Prefix, prefix), - } - - for _, opt := range opts { - opt(wss) - } - - wss.log = wss.log.WithField(logfields.ClusterName, wss.source) - wss.workqueue = workqueue.NewRateLimitingQueue(wss.limiter) - wss.queuedMetric = m.KVStoreSyncQueueSize.WithLabelValues(kvstore.GetScopeFromKey(prefix), wss.source) - wss.errorsMetric = m.KVStoreSyncErrors.WithLabelValues(kvstore.GetScopeFromKey(prefix), wss.source) - wss.syncedMetric = m.KVStoreInitialSyncCompleted.WithLabelValues(kvstore.GetScopeFromKey(prefix), wss.source, "write") - return wss -} - -// Run starts the SyncStore logic, blocking until the context is closed. -func (wss *wqSyncStore) Run(ctx context.Context) { - var wg sync.WaitGroup - - wss.syncedMetric.Set(metrics.BoolToFloat64(false)) - defer wss.syncedMetric.Set(metrics.BoolToFloat64(false)) - - wss.backend.RegisterLeaseExpiredObserver(wss.prefix, wss.handleExpiredLease) - wss.backend.RegisterLeaseExpiredObserver(wss.getSyncedKey(), wss.handleExpiredLease) - - wss.log.WithField(logfields.Workers, wss.workers).Info("Starting workqueue-based sync store") - wg.Add(int(wss.workers)) - for i := uint(0); i < wss.workers; i++ { - go func() { - defer wg.Done() - for wss.processNextItem(ctx) { - } - }() - } - - <-ctx.Done() - - wss.backend.RegisterLeaseExpiredObserver(wss.prefix, nil) - wss.backend.RegisterLeaseExpiredObserver(wss.getSyncedKey(), nil) - - wss.log.Info("Shutting down workqueue-based sync store") - wss.workqueue.ShutDown() - wg.Wait() -} - -// UpsertKey registers the key for asynchronous upsertion in the kvstore, if the -// corresponding value has changed. It returns an error in case it is impossible -// to marshal the value, while kvstore failures are automatically handled through -// a retry mechanism. -func (wss *wqSyncStore) UpsertKey(_ context.Context, k Key) error { - key := k.GetKeyName() - value, err := k.Marshal() - if err != nil { - return fmt.Errorf("failed marshaling key %q: %w", k, err) - } - - prevValue, loaded := wss.state.Swap(key, value) - if loaded && bytes.Equal(prevValue, value) { - wss.log.WithField(logfields.Key, k).Debug("ignoring upsert request for already up-to-date key") - } else { - if !wss.synced.Load() { - wss.pendingSync.Store(key, struct{}{}) - } - - wss.workqueue.Add(key) - wss.queuedMetric.Set(float64(wss.workqueue.Len())) - } - - return nil -} - -// DeleteKey registers the key for asynchronous deletion from the kvstore, if it -// was known to be present. It never returns an error, because kvstore failures -// are automatically handled through a retry mechanism. -func (wss *wqSyncStore) DeleteKey(_ context.Context, k NamedKey) error { - key := k.GetKeyName() - if _, loaded := wss.state.LoadAndDelete(key); loaded { - wss.workqueue.Add(key) - wss.queuedMetric.Set(float64(wss.workqueue.Len())) - } else { - wss.log.WithField(logfields.Key, key).Debug("ignoring delete request for non-existing key") - } - - return nil -} - -func (wss *wqSyncStore) Synced(_ context.Context, callbacks ...func(ctx context.Context)) error { - if synced := wss.synced.Swap(true); !synced { - wss.syncedCallbacks = callbacks - wss.workqueue.Add(syncCanary{}) - } - return nil -} - -func (wss *wqSyncStore) processNextItem(ctx context.Context) bool { - // Retrieve the next key to process from the workqueue. - key, shutdown := wss.workqueue.Get() - wss.queuedMetric.Set(float64(wss.workqueue.Len())) - if shutdown { - return false - } - - // We call Done here so the workqueue knows we have finished - // processing this item. - defer func() { - wss.workqueue.Done(key) - // This ensures that the metric is correctly updated in case of requeues. - wss.queuedMetric.Set(float64(wss.workqueue.Len())) - }() - - // Run the handler, passing it the key to be processed as parameter. - if err := wss.handle(ctx, key); err != nil { - // Put the item back on the workqueue to handle any transient errors. - wss.errorsMetric.Inc() - wss.workqueue.AddRateLimited(key) - return true - } - - // Since no error occurred, forget this item so it does not get queued again - // until another change happens. - wss.workqueue.Forget(key) - if skey, ok := key.(string); ok { - wss.pendingSync.Delete(skey) - } - return true -} - -func (wss *wqSyncStore) handle(ctx context.Context, key interface{}) error { - if value, ok := key.(syncCanary); ok { - return wss.handleSync(ctx, value.skipCallbacks) - } - - if value, ok := wss.state.Load(key.(string)); ok { - return wss.handleUpsert(ctx, key.(string), value) - } - - return wss.handleDelete(ctx, key.(string)) -} - -func (wss *wqSyncStore) handleUpsert(ctx context.Context, key string, value []byte) error { - scopedLog := wss.log.WithField(logfields.Key, key) - - err := wss.backend.Update(ctx, wss.keyPath(key), value, wss.withLease) - if err != nil { - scopedLog.WithError(err).Warning("Failed upserting key in kvstore. Retrying...") - return err - } - - scopedLog.Debug("Upserted key in kvstore") - return nil -} - -func (wss *wqSyncStore) handleDelete(ctx context.Context, key string) error { - scopedLog := wss.log.WithField(logfields.Key, key) - - if err := wss.backend.Delete(ctx, wss.keyPath(key)); err != nil { - scopedLog.WithError(err).Warning("Failed deleting key from kvstore. Retrying...") - return err - } - - scopedLog.Debug("Deleted key from kvstore") - return nil -} - -func (wss *wqSyncStore) handleSync(ctx context.Context, skipCallbacks bool) error { - // This could be replaced by wss.toSync.Len() == 0 if it only existed... - syncCompleted := true - wss.pendingSync.Range(func(string, struct{}) bool { - syncCompleted = false - return false - }) - - if !syncCompleted { - return fmt.Errorf("there are still keys to be synchronized") - } - - key := wss.getSyncedKey() - scopedLog := wss.log.WithField(logfields.Key, key) - - err := wss.backend.Update(ctx, key, []byte(time.Now().Format(time.RFC3339)), wss.withLease) - if err != nil { - scopedLog.WithError(err).Warning("Failed upserting synced key in kvstore. Retrying...") - return err - } - - wss.log.Info("Initial synchronization from the external source completed") - wss.syncedMetric.Set(metrics.BoolToFloat64(true)) - - // Execute any callback that might have been registered. - if !skipCallbacks { - for _, callback := range wss.syncedCallbacks { - callback(ctx) - } - } - - return nil -} - -// handleExpiredLease gets executed when the lease attached to a given key expired, -// and is responsible for enqueuing the given key to recreate it. -func (wss *wqSyncStore) handleExpiredLease(key string) { - defer wss.queuedMetric.Set(float64(wss.workqueue.Len())) - - if key == wss.getSyncedKey() { - // Re-enqueue the creation of the sync canary, but make sure that - // the registered callbacks are not executed a second time. - wss.workqueue.Add(syncCanary{skipCallbacks: true}) - return - } - - key = strings.TrimPrefix(strings.TrimPrefix(key, wss.prefix), "/") - _, ok := wss.state.Load(key) - if ok { - wss.log.WithField(logfields.Key, key).Debug("enqueuing upsert request for key as the attached lease expired") - if !wss.synced.Load() { - wss.pendingSync.Store(key, struct{}{}) - } - - wss.workqueue.Add(key) - } -} - -// keyPath returns the absolute kvstore path of a key -func (wss *wqSyncStore) keyPath(key string) string { - // WARNING - STABLE API: The composition of the absolute key path - // cannot be changed without breaking up and downgrades. - return path.Join(wss.prefix, key) -} - -func (wss *wqSyncStore) getSyncedKey() string { - return path.Join(kvstore.SyncedPrefix, wss.source, wss.syncedKey) -} diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/store/watchstore.go b/vendor/github.com/cilium/cilium/pkg/kvstore/store/watchstore.go deleted file mode 100644 index 04881f717..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/store/watchstore.go +++ /dev/null @@ -1,252 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package store - -import ( - "context" - "strings" - "sync/atomic" - - "github.com/prometheus/client_golang/prometheus" - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/pkg/kvstore" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/metrics" - "github.com/cilium/cilium/pkg/metrics/metric" -) - -// WatchStore abstracts the operations allowing to synchronize key/value pairs -// from a kvstore, emitting the corresponding events. -type WatchStore interface { - // Watch starts watching the specified kvstore prefix, blocking until the context is closed. - // Depending on the implementation, it might be executed multiple times. - Watch(ctx context.Context, backend WatchStoreBackend, prefix string) - - // NumEntries returns the number of entries synchronized from the store. - NumEntries() uint64 - - // Synced returns whether the initial list of entries has been retrieved from - // the kvstore, and new events are currently being watched. - Synced() bool - - // Drain emits a deletion event for each known key. It shall be called only - // when no watch operation is in progress. - Drain() -} - -// WatchStoreBackend represents the subset of kvstore.BackendOperations leveraged -// by WatchStore implementations. -type WatchStoreBackend interface { - // ListAndWatch creates a new watcher for the given prefix after listing the existing keys. - ListAndWatch(ctx context.Context, prefix string, chanSize int) *kvstore.Watcher -} - -type RWSOpt func(*restartableWatchStore) - -// WSWithOnSyncCallback registers a function to be executed after -// listing all keys from the kvstore for the first time. Multiple -// callback functions can be registered. -func RWSWithOnSyncCallback(callback func(ctx context.Context)) RWSOpt { - return func(rws *restartableWatchStore) { - rws.onSyncCallbacks = append(rws.onSyncCallbacks, callback) - } -} - -// WSWithEntriesGauge registers a Prometheus gauge metric that is kept -// in sync with the number of entries synchronized from the kvstore. -func RWSWithEntriesMetric(gauge prometheus.Gauge) RWSOpt { - return func(rws *restartableWatchStore) { - rws.entriesMetric = gauge - } -} - -type rwsEntry struct { - key Key - stale bool -} - -// restartableWatchStore implements the WatchStore interface, supporting -// multiple executions of the Watch() operation (granted that the previous one -// already terminated). This allows to transparently handle the case in which -// we had to create a new etcd connection (for instance following a failure) -// which refers to the same remote cluster. -type restartableWatchStore struct { - source string - keyCreator KeyCreator - observer Observer - - watching atomic.Bool - synced atomic.Bool - onSyncCallbacks []func(ctx context.Context) - - // Using a separate entries counter avoids the need for synchronizing the - // access to the state map, since the only concurrent reader is represented - // by the NumEntries() function. - state map[string]*rwsEntry - numEntries atomic.Uint64 - - log *logrus.Entry - entriesMetric prometheus.Gauge - syncMetric metric.Vec[metric.Gauge] -} - -// NewRestartableWatchStore returns a WatchStore instance which supports -// restarting the watch operation multiple times, automatically handling -// the emission of deletion events for all stale entries (if enabled). It -// shall be restarted only once the previous Watch execution terminated. -func newRestartableWatchStore(clusterName string, keyCreator KeyCreator, observer Observer, m *Metrics, opts ...RWSOpt) WatchStore { - rws := &restartableWatchStore{ - source: clusterName, - keyCreator: keyCreator, - observer: observer, - - state: make(map[string]*rwsEntry), - - log: log, - entriesMetric: metrics.NoOpGauge, - syncMetric: m.KVStoreInitialSyncCompleted, - } - - for _, opt := range opts { - opt(rws) - } - - rws.log = rws.log.WithField(logfields.ClusterName, rws.source) - return rws -} - -// Watch starts watching the specified kvstore prefix, blocking until the context is closed. -// It might be executed multiple times, granted that the previous execution already terminated. -func (rws *restartableWatchStore) Watch(ctx context.Context, backend WatchStoreBackend, prefix string) { - // Append a trailing "/" to the prefix, to make sure that we watch only - // sub-elements belonging to that prefix, and not to sibling prefixes - // (for instance in case the last part of the prefix is the cluster name, - // and one is the substring of another). - if !strings.HasSuffix(prefix, "/") { - prefix = prefix + "/" - } - - rws.log = rws.log.WithField(logfields.Prefix, prefix) - syncedMetric := rws.syncMetric.WithLabelValues( - kvstore.GetScopeFromKey(prefix), rws.source, "read") - - rws.log.Info("Starting restartable watch store") - syncedMetric.Set(metrics.BoolToFloat64(false)) - - if rws.watching.Swap(true) { - rws.log.Panic("Cannot start the watch store while still running") - } - - defer func() { - rws.log.Info("Stopped restartable watch store") - syncedMetric.Set(metrics.BoolToFloat64(false)) - rws.watching.Store(false) - rws.synced.Store(false) - }() - - // Mark all known keys as stale. - for _, entry := range rws.state { - entry.stale = true - } - - // The events channel is closed when the context is closed. - watcher := backend.ListAndWatch(ctx, prefix, 0) - for event := range watcher.Events { - if event.Typ == kvstore.EventTypeListDone { - rws.log.Debug("Initial synchronization completed") - rws.drainKeys(true) - syncedMetric.Set(metrics.BoolToFloat64(true)) - rws.synced.Store(true) - - for _, callback := range rws.onSyncCallbacks { - callback(ctx) - } - - // Clear the list of callbacks so that they don't get executed - // a second time in case of reconnections. - rws.onSyncCallbacks = nil - - continue - } - - key := strings.TrimPrefix(event.Key, prefix) - rws.log.WithFields(logrus.Fields{ - logfields.Key: key, - logfields.Event: event.Typ, - }).Debug("Received event from kvstore") - - switch event.Typ { - case kvstore.EventTypeCreate, kvstore.EventTypeModify: - rws.handleUpsert(key, event.Value) - case kvstore.EventTypeDelete: - rws.handleDelete(key) - } - } -} - -// NumEntries returns the number of entries synchronized from the store. -func (rws *restartableWatchStore) NumEntries() uint64 { - return rws.numEntries.Load() -} - -// Synced returns whether the initial list of entries has been retrieved from -// the kvstore, and new events are currently being watched. -func (rws *restartableWatchStore) Synced() bool { - return rws.synced.Load() -} - -// Drain emits a deletion event for each known key. It shall be called only -// when no watch operation is in progress. -func (rws *restartableWatchStore) Drain() { - if rws.watching.Swap(true) { - rws.log.Panic("Cannot drain the watch store while still running") - } - defer rws.watching.Store(false) - - rws.log.Info("Draining restartable watch store") - rws.drainKeys(false) - rws.log.Info("Drained restartable watch store") -} - -// drainKeys emits synthetic deletion events: -// * staleOnly == true: for all keys marked as stale; -// * staleOnly == false: for all known keys; -func (rws *restartableWatchStore) drainKeys(staleOnly bool) { - for key, entry := range rws.state { - if !staleOnly || entry.stale { - rws.log.WithField(logfields.Key, key).Debug("Emitting deletion event for stale key") - rws.handleDelete(key) - } - } -} - -func (rws *restartableWatchStore) handleUpsert(key string, value []byte) { - entry := &rwsEntry{key: rws.keyCreator()} - if err := entry.key.Unmarshal(key, value); err != nil { - rws.log.WithFields(logrus.Fields{ - logfields.Key: key, - logfields.Value: string(value), - }).WithError(err).Warning("Unable to unmarshal value") - return - } - - rws.state[key] = entry - rws.numEntries.Store(uint64(len(rws.state))) - rws.entriesMetric.Set(float64(len(rws.state))) - rws.observer.OnUpdate(entry.key) -} - -func (rws *restartableWatchStore) handleDelete(key string) { - entry, ok := rws.state[key] - if !ok { - rws.log.WithField(logfields.Key, key).Warning("Received deletion event for unknown key") - return - } - - delete(rws.state, key) - rws.numEntries.Store(uint64(len(rws.state))) - rws.entriesMetric.Set(float64(len(rws.state))) - rws.observer.OnDelete(entry.key) -} diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/store/watchstoremgr.go b/vendor/github.com/cilium/cilium/pkg/kvstore/store/watchstoremgr.go deleted file mode 100644 index 44f85114c..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/store/watchstoremgr.go +++ /dev/null @@ -1,144 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package store - -import ( - "context" - "path" - "sync" - "sync/atomic" - - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/pkg/kvstore" - "github.com/cilium/cilium/pkg/logging/logfields" -) - -// WSMFunc if a function which can be registered in the WatchStoreManager. -type WSMFunc func(context.Context) - -// WatchStoreManager enables to register a set of functions to be asynchronously -// executed when the corresponding kvstore prefixes are synchronized (based on -// the implementation). -type WatchStoreManager interface { - // Register registers a function associated with a given kvstore prefix. - // It cannot be called once Run() has started. - Register(prefix string, function WSMFunc) - // Run starts the manager, blocking until the context is closed and all - // started functions terminated. - Run(ctx context.Context) -} - -// wsmCommon implements the common logic shared by WatchStoreManager implementations. -type wsmCommon struct { - wg sync.WaitGroup - functions map[string]WSMFunc - - running atomic.Bool - log *logrus.Entry -} - -func newWSMCommon(clusterName string) wsmCommon { - return wsmCommon{ - functions: make(map[string]WSMFunc), - log: log.WithField(logfields.ClusterName, clusterName), - } -} - -// Register registers a function associated with a given kvstore prefix. -// It cannot be called once Run() has started. -func (mgr *wsmCommon) Register(prefix string, function WSMFunc) { - if mgr.running.Load() { - mgr.log.Panic("Cannot call Register while the watch store manager is running") - } - - mgr.functions[prefix] = function -} - -func (mgr *wsmCommon) ready(ctx context.Context, prefix string) { - if fn := mgr.functions[prefix]; fn != nil { - mgr.log.WithField(logfields.Prefix, prefix).Debug("Starting function for kvstore prefix") - delete(mgr.functions, prefix) - - mgr.wg.Add(1) - go func() { - defer mgr.wg.Done() - fn(ctx) - mgr.log.WithField(logfields.Prefix, prefix).Debug("Function terminated for kvstore prefix") - }() - } else { - mgr.log.WithField(logfields.Prefix, prefix).Debug("Received sync event for unregistered prefix") - } -} - -func (mgr *wsmCommon) run() { - mgr.log.Info("Starting watch store manager") - if mgr.running.Swap(true) { - mgr.log.Panic("Cannot start the watch store manager twice") - } -} - -func (mgr *wsmCommon) wait() { - mgr.wg.Wait() - mgr.log.Info("Stopped watch store manager") -} - -type wsmSync struct { - wsmCommon - - clusterName string - backend WatchStoreBackend - store WatchStore - onUpdate func(prefix string) -} - -// NewWatchStoreManagerSync implements the WatchStoreManager interface, starting the -// registered functions only once the corresponding prefix sync canary has been received. -// This ensures that the synchronization of the keys hosted under the given prefix -// have been successfully synchronized from the external source, even in case an -// ephemeral kvstore is used. -func newWatchStoreManagerSync(backend WatchStoreBackend, clusterName string, factory Factory) WatchStoreManager { - mgr := wsmSync{ - wsmCommon: newWSMCommon(clusterName), - clusterName: clusterName, - backend: backend, - } - - mgr.store = factory.NewWatchStore(clusterName, KVPairCreator, &mgr) - return &mgr -} - -// Run starts the manager, blocking until the context is closed and all -// started functions terminated. -func (mgr *wsmSync) Run(ctx context.Context) { - mgr.run() - mgr.onUpdate = func(prefix string) { mgr.ready(ctx, prefix) } - mgr.store.Watch(ctx, mgr.backend, path.Join(kvstore.SyncedPrefix, mgr.clusterName)) - mgr.wait() -} - -func (mgr *wsmSync) OnUpdate(k Key) { mgr.onUpdate(k.GetKeyName()) } -func (mgr *wsmSync) OnDelete(k NamedKey) {} - -type wsmImmediate struct { - wsmCommon -} - -// NewWatchStoreManagerImmediate implements the WatchStoreManager interface, -// immediately starting the registered functions once Run() is executed. -func NewWatchStoreManagerImmediate(clusterName string) WatchStoreManager { - return &wsmImmediate{ - wsmCommon: newWSMCommon(clusterName), - } -} - -// Run starts the manager, blocking until the context is closed and all -// started functions terminated. -func (mgr *wsmImmediate) Run(ctx context.Context) { - mgr.run() - for prefix := range mgr.functions { - mgr.ready(ctx, prefix) - } - mgr.wait() -} diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/trace.go b/vendor/github.com/cilium/cilium/pkg/kvstore/trace.go deleted file mode 100644 index b06887c0f..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/trace.go +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package kvstore - -import ( - "github.com/sirupsen/logrus" -) - -var ( - traceEnabled bool -) - -// EnableTracing enables kvstore tracing -func EnableTracing() { - traceEnabled = true -} - -// Trace is used to trace kvstore debug messages -func Trace(format string, err error, fields logrus.Fields, a ...interface{}) { - if traceEnabled { - log.WithError(err).WithFields(fields).Debugf(format) - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/kvstore/watcher_cache.go b/vendor/github.com/cilium/cilium/pkg/kvstore/watcher_cache.go deleted file mode 100644 index a3bf7cbf5..000000000 --- a/vendor/github.com/cilium/cilium/pkg/kvstore/watcher_cache.go +++ /dev/null @@ -1,41 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package kvstore - -type watchState struct { - deletionMark bool -} - -type watcherCache map[string]watchState - -func (wc watcherCache) Exists(key []byte) bool { - if _, ok := wc[string(key)]; ok { - return true - } - - return false -} - -func (wc watcherCache) RemoveDeleted(f func(string)) { - for k, localKey := range wc { - if localKey.deletionMark { - f(k) - delete(wc, k) - } - } -} - -func (wc watcherCache) MarkAllForDeletion() { - for k := range wc { - wc[k] = watchState{deletionMark: true} - } -} - -func (wc watcherCache) MarkInUse(key []byte) { - wc[string(key)] = watchState{deletionMark: false} -} - -func (wc watcherCache) RemoveKey(key []byte) { - delete(wc, string(key)) -} diff --git a/vendor/github.com/cilium/cilium/pkg/labels/labels.go b/vendor/github.com/cilium/cilium/pkg/labels/labels.go index 6da67f6ca..4be199efc 100644 --- a/vendor/github.com/cilium/cilium/pkg/labels/labels.go +++ b/vendor/github.com/cilium/cilium/pkg/labels/labels.go @@ -141,6 +141,9 @@ const ( // LabelSourceNode is the label source for remote-nodes. LabelSourceNode = "node" + // LabelSourceFQDN is the label source for IPs resolved by fqdn lookups + LabelSourceFQDN = "fqdn" + // LabelSourceReservedKeyPrefix is the prefix of a reserved label LabelSourceReservedKeyPrefix = LabelSourceReserved + "." @@ -659,6 +662,16 @@ func (l Labels) Has(label Label) bool { return false } +// HasSource returns true if l contains the given label source. +func (l Labels) HasSource(source string) bool { + for _, lbl := range l { + if lbl.Source == source { + return true + } + } + return false +} + // parseSource returns the parsed source of the given str. It also returns the next piece // of text that is after the source. // Example: diff --git a/vendor/github.com/cilium/cilium/pkg/loadbalancer/doc.go b/vendor/github.com/cilium/cilium/pkg/loadbalancer/doc.go deleted file mode 100644 index 997e3f7f1..000000000 --- a/vendor/github.com/cilium/cilium/pkg/loadbalancer/doc.go +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// +k8s:deepcopy-gen=package,register - -// Package loadbalancer contains all logic related with the loadbalancer -// +groupName=pkg -package loadbalancer diff --git a/vendor/github.com/cilium/cilium/pkg/loadbalancer/loadbalancer.go b/vendor/github.com/cilium/cilium/pkg/loadbalancer/loadbalancer.go deleted file mode 100644 index e830b2f06..000000000 --- a/vendor/github.com/cilium/cilium/pkg/loadbalancer/loadbalancer.go +++ /dev/null @@ -1,823 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package loadbalancer - -import ( - "fmt" - "net" - "sort" - "strconv" - "strings" - - "github.com/cilium/cilium/api/v1/models" - "github.com/cilium/cilium/pkg/cidr" - cmtypes "github.com/cilium/cilium/pkg/clustermesh/types" - "github.com/cilium/cilium/pkg/option" -) - -// SVCType is a type of a service. -type SVCType string - -const ( - SVCTypeNone = SVCType("NONE") - SVCTypeHostPort = SVCType("HostPort") - SVCTypeClusterIP = SVCType("ClusterIP") - SVCTypeNodePort = SVCType("NodePort") - SVCTypeExternalIPs = SVCType("ExternalIPs") - SVCTypeLoadBalancer = SVCType("LoadBalancer") - SVCTypeLocalRedirect = SVCType("LocalRedirect") -) - -// SVCTrafficPolicy defines which backends are chosen -type SVCTrafficPolicy string - -const ( - SVCTrafficPolicyNone = SVCTrafficPolicy("NONE") - SVCTrafficPolicyCluster = SVCTrafficPolicy("Cluster") - SVCTrafficPolicyLocal = SVCTrafficPolicy("Local") -) - -// SVCNatPolicy defines whether we need NAT46/64 translation for backends -type SVCNatPolicy string - -const ( - SVCNatPolicyNone = SVCNatPolicy("NONE") - SVCNatPolicyNat46 = SVCNatPolicy("Nat46") - SVCNatPolicyNat64 = SVCNatPolicy("Nat64") -) - -// ServiceFlags is the datapath representation of the service flags that can be -// used (lb{4,6}_service.flags) -type ServiceFlags uint16 - -const ( - serviceFlagNone = 0 - serviceFlagExternalIPs = 1 << 0 - serviceFlagNodePort = 1 << 1 - serviceFlagExtLocalScope = 1 << 2 - serviceFlagHostPort = 1 << 3 - serviceFlagSessionAffinity = 1 << 4 - serviceFlagLoadBalancer = 1 << 5 - serviceFlagRoutable = 1 << 6 - serviceFlagSourceRange = 1 << 7 - serviceFlagLocalRedirect = 1 << 8 - serviceFlagNat46x64 = 1 << 9 - serviceFlagL7LoadBalancer = 1 << 10 - serviceFlagLoopback = 1 << 11 - serviceFlagIntLocalScope = 1 << 12 - serviceFlagTwoScopes = 1 << 13 -) - -type SvcFlagParam struct { - SvcType SVCType - SvcNatPolicy SVCNatPolicy - SvcExtLocal bool - SvcIntLocal bool - SessionAffinity bool - IsRoutable bool - CheckSourceRange bool - L7LoadBalancer bool - LoopbackHostport bool -} - -// NewSvcFlag creates service flag -func NewSvcFlag(p *SvcFlagParam) ServiceFlags { - var flags ServiceFlags - - switch p.SvcType { - case SVCTypeExternalIPs: - flags |= serviceFlagExternalIPs - case SVCTypeNodePort: - flags |= serviceFlagNodePort - case SVCTypeLoadBalancer: - flags |= serviceFlagLoadBalancer - case SVCTypeHostPort: - flags |= serviceFlagHostPort - if p.LoopbackHostport { - flags |= serviceFlagLoopback - } - case SVCTypeLocalRedirect: - flags |= serviceFlagLocalRedirect - } - - switch p.SvcNatPolicy { - case SVCNatPolicyNat46: - fallthrough - case SVCNatPolicyNat64: - flags |= serviceFlagNat46x64 - } - - if p.SvcExtLocal { - flags |= serviceFlagExtLocalScope - } - if p.SvcIntLocal { - flags |= serviceFlagIntLocalScope - } - if p.SessionAffinity { - flags |= serviceFlagSessionAffinity - } - if p.IsRoutable { - flags |= serviceFlagRoutable - } - if p.CheckSourceRange { - flags |= serviceFlagSourceRange - } - if p.L7LoadBalancer { - flags |= serviceFlagL7LoadBalancer - } - if p.SvcExtLocal != p.SvcIntLocal && p.SvcType != SVCTypeClusterIP { - flags |= serviceFlagTwoScopes - } - - return flags -} - -// SVCType returns a service type from the flags -func (s ServiceFlags) SVCType() SVCType { - switch { - case s&serviceFlagExternalIPs != 0: - return SVCTypeExternalIPs - case s&serviceFlagNodePort != 0: - return SVCTypeNodePort - case s&serviceFlagLoadBalancer != 0: - return SVCTypeLoadBalancer - case s&serviceFlagHostPort != 0: - return SVCTypeHostPort - case s&serviceFlagLocalRedirect != 0: - return SVCTypeLocalRedirect - default: - return SVCTypeClusterIP - } -} - -func (s ServiceFlags) IsL7LB() bool { - return s&serviceFlagL7LoadBalancer != 0 -} - -// SVCExtTrafficPolicy returns a service traffic policy from the flags -func (s ServiceFlags) SVCExtTrafficPolicy() SVCTrafficPolicy { - switch { - case s&serviceFlagExtLocalScope != 0: - return SVCTrafficPolicyLocal - default: - return SVCTrafficPolicyCluster - } -} - -// SVCIntTrafficPolicy returns a service traffic policy from the flags -func (s ServiceFlags) SVCIntTrafficPolicy() SVCTrafficPolicy { - switch { - case s&serviceFlagIntLocalScope != 0: - return SVCTrafficPolicyLocal - default: - return SVCTrafficPolicyCluster - } -} - -// SVCNatPolicy returns a service NAT policy from the flags -func (s ServiceFlags) SVCNatPolicy(fe L3n4Addr) SVCNatPolicy { - if s&serviceFlagNat46x64 == 0 { - return SVCNatPolicyNone - } - - if fe.IsIPv6() { - return SVCNatPolicyNat64 - } else { - return SVCNatPolicyNat46 - } -} - -// String returns the string implementation of ServiceFlags. -func (s ServiceFlags) String() string { - var str []string - - str = append(str, string(s.SVCType())) - if s&serviceFlagExtLocalScope != 0 { - str = append(str, string(SVCTrafficPolicyLocal)) - } - if s&serviceFlagIntLocalScope != 0 { - str = append(str, "Internal"+string(SVCTrafficPolicyLocal)) - } - if s&serviceFlagTwoScopes != 0 { - str = append(str, "two-scopes") - } - if s&serviceFlagSessionAffinity != 0 { - str = append(str, "sessionAffinity") - } - if s&serviceFlagRoutable == 0 { - str = append(str, "non-routable") - } - if s&serviceFlagSourceRange != 0 { - str = append(str, "check source-range") - } - if s&serviceFlagNat46x64 != 0 { - str = append(str, "46x64") - } - if s&serviceFlagL7LoadBalancer != 0 { - str = append(str, "l7-load-balancer") - } - if s&serviceFlagLoopback != 0 { - str = append(str, "loopback") - } - - return strings.Join(str, ", ") -} - -// UInt8 returns the UInt16 representation of the ServiceFlags. -func (s ServiceFlags) UInt16() uint16 { - return uint16(s) -} - -const ( - NONE = L4Type("NONE") - // TCP type. - TCP = L4Type("TCP") - // UDP type. - UDP = L4Type("UDP") - // SCTP type. - SCTP = L4Type("SCTP") -) - -const ( - // ScopeExternal is the lookup scope for services from outside the node. - ScopeExternal uint8 = iota - // ScopeInternal is the lookup scope for services from inside the node. - ScopeInternal -) - -// BackendState tracks backend's ability to load-balance service traffic. -// -// Valid transition states for a backend - -// BackendStateActive -> BackendStateTerminating, BackendStateQuarantined, BackendStateMaintenance -// BackendStateTerminating -> No valid state transition -// BackendStateQuarantined -> BackendStateActive, BackendStateTerminating -// BackendStateMaintenance -> BackendStateActive -// -// Sources setting the states - -// BackendStateActive - Kubernetes events, service API -// BackendStateTerminating - Kubernetes events -// BackendStateQuarantined - service API -// BackendStateMaintenance - service API -const ( - // BackendStateActive refers to the backend state when it's available for - // load-balancing traffic. It's the default state for a backend. - // Backends in this state can be health-checked. - BackendStateActive BackendState = iota - // BackendStateTerminating refers to the terminating backend state so that - // it can be gracefully removed. - // Backends in this state won't be health-checked. - BackendStateTerminating - // BackendStateQuarantined refers to the backend state when it's unreachable, - // and will not be selected for load-balancing traffic. - // Backends in this state can be health-checked. - BackendStateQuarantined - // BackendStateMaintenance refers to the backend state where the backend - // is put under maintenance, and will neither be selected for load-balancing - // traffic nor be health-checked. - BackendStateMaintenance - // BackendStateInvalid is an invalid state, and is used to report error conditions. - // Keep this as the last entry. - BackendStateInvalid -) - -// BackendStateFlags is the datapath representation of the backend flags that -// are used in (lb{4,6}_backend.flags) to store backend state. -type BackendStateFlags = uint8 - -const ( - BackendStateActiveFlag = iota - BackendStateTerminatingFlag - BackendStateQuarantinedFlag - BackendStateMaintenanceFlag -) - -func NewBackendFlags(state BackendState) BackendStateFlags { - var flags BackendStateFlags - - switch state { - case BackendStateActive: - flags = BackendStateActiveFlag - case BackendStateTerminating: - flags = BackendStateTerminatingFlag - case BackendStateQuarantined: - flags = BackendStateQuarantinedFlag - case BackendStateMaintenance: - flags = BackendStateMaintenanceFlag - } - - return flags -} - -func GetBackendStateFromFlags(flags uint8) BackendState { - switch flags { - case BackendStateTerminatingFlag: - return BackendStateTerminating - case BackendStateQuarantinedFlag: - return BackendStateQuarantined - case BackendStateMaintenanceFlag: - return BackendStateMaintenance - default: - return BackendStateActive - } -} - -// DefaultBackendWeight is used when backend weight is not set in ServiceSpec -const DefaultBackendWeight = 100 - -var ( - // AllProtocols is the list of all supported L4 protocols - AllProtocols = []L4Type{TCP, UDP, SCTP} -) - -// L4Type name. -type L4Type = string - -// FEPortName is the name of the frontend's port. -type FEPortName string - -// ServiceID is the service's ID. -type ServiceID uint16 - -// ServiceName represents the fully-qualified reference to the service by name, -// including both the namespace and name of the service (and optionally the cluster). -type ServiceName struct { - Namespace string - Name string - Cluster string -} - -func (n ServiceName) String() string { - if n.Cluster != "" { - return n.Cluster + "/" + n.Namespace + "/" + n.Name - } - - return n.Namespace + "/" + n.Name -} - -// BackendID is the backend's ID. -type BackendID uint32 - -// ID is the ID of L3n4Addr endpoint (either service or backend). -type ID uint32 - -// BackendState is the state of a backend for load-balancing service traffic. -type BackendState uint8 - -// Preferred indicates if this backend is preferred to be load balanced. -type Preferred bool - -// Backend represents load balancer backend. -type Backend struct { - // FEPortName is the frontend port name. This is used to filter backends sending to EDS. - FEPortName string - // ID of the backend - ID BackendID - // Weight of backend - Weight uint16 - // Node hosting this backend. This is used to determine backends local to - // a node. - NodeName string - L3n4Addr - // State of the backend for load-balancing service traffic - State BackendState - // Preferred indicates if the healthy backend is preferred - Preferred Preferred -} - -func (b *Backend) String() string { - return b.L3n4Addr.String() -} - -// SVC is a structure for storing service details. -type SVC struct { - Frontend L3n4AddrID // SVC frontend addr and an allocated ID - Backends []*Backend // List of service backends - Type SVCType // Service type - ExtTrafficPolicy SVCTrafficPolicy // Service external traffic policy - IntTrafficPolicy SVCTrafficPolicy // Service internal traffic policy - NatPolicy SVCNatPolicy // Service NAT 46/64 policy - SessionAffinity bool - SessionAffinityTimeoutSec uint32 - HealthCheckNodePort uint16 // Service health check node port - Name ServiceName // Fully qualified service name - LoadBalancerSourceRanges []*cidr.CIDR - L7LBProxyPort uint16 // Non-zero for L7 LB services - LoopbackHostport bool -} - -func (s *SVC) GetModel() *models.Service { - var natPolicy string - type backendPlacement struct { - pos int - id BackendID - } - - if s == nil { - return nil - } - - id := int64(s.Frontend.ID) - if s.NatPolicy != SVCNatPolicyNone { - natPolicy = string(s.NatPolicy) - } - spec := &models.ServiceSpec{ - ID: id, - FrontendAddress: s.Frontend.GetModel(), - BackendAddresses: make([]*models.BackendAddress, len(s.Backends)), - Flags: &models.ServiceSpecFlags{ - Type: string(s.Type), - TrafficPolicy: string(s.ExtTrafficPolicy), - ExtTrafficPolicy: string(s.ExtTrafficPolicy), - IntTrafficPolicy: string(s.IntTrafficPolicy), - NatPolicy: natPolicy, - HealthCheckNodePort: s.HealthCheckNodePort, - - Name: s.Name.Name, - Namespace: s.Name.Namespace, - }, - } - - if s.Name.Cluster != option.Config.ClusterName { - spec.Flags.Cluster = s.Name.Cluster - } - - placements := make([]backendPlacement, len(s.Backends)) - for i, be := range s.Backends { - placements[i] = backendPlacement{pos: i, id: be.ID} - } - sort.Slice(placements, - func(i, j int) bool { return placements[i].id < placements[j].id }) - for i, placement := range placements { - spec.BackendAddresses[i] = s.Backends[placement.pos].GetBackendModel() - } - - return &models.Service{ - Spec: spec, - Status: &models.ServiceStatus{ - Realized: spec, - }, - } -} - -func IsValidStateTransition(old, new BackendState) bool { - if old == new { - return true - } - if new == BackendStateInvalid { - return false - } - - switch old { - case BackendStateActive: - case BackendStateTerminating: - return false - case BackendStateQuarantined: - if new == BackendStateMaintenance { - return false - } - case BackendStateMaintenance: - if new != BackendStateActive { - return false - } - default: - return false - } - return true -} - -func GetBackendState(state string) (BackendState, error) { - switch strings.ToLower(state) { - case models.BackendAddressStateActive, "": - return BackendStateActive, nil - case models.BackendAddressStateTerminating: - return BackendStateTerminating, nil - case models.BackendAddressStateQuarantined: - return BackendStateQuarantined, nil - case models.BackendAddressStateMaintenance: - return BackendStateMaintenance, nil - default: - return BackendStateInvalid, fmt.Errorf("invalid backend state %s", state) - } -} - -func (state BackendState) String() (string, error) { - switch state { - case BackendStateActive: - return models.BackendAddressStateActive, nil - case BackendStateTerminating: - return models.BackendAddressStateTerminating, nil - case BackendStateQuarantined: - return models.BackendAddressStateQuarantined, nil - case BackendStateMaintenance: - return models.BackendAddressStateMaintenance, nil - default: - return "", fmt.Errorf("invalid backend state %d", state) - } -} - -func IsValidBackendState(state string) bool { - _, err := GetBackendState(state) - - return err == nil -} - -func NewL4Type(name string) (L4Type, error) { - switch strings.ToLower(name) { - case "tcp": - return TCP, nil - case "udp": - return UDP, nil - case "sctp": - return SCTP, nil - default: - return "", fmt.Errorf("unknown L4 protocol") - } -} - -// L4Addr is an abstraction for the backend port with a L4Type, usually tcp or udp, and -// the Port number. -// -// +deepequal-gen=true -// +deepequal-gen:private-method=true -type L4Addr struct { - Protocol L4Type - Port uint16 -} - -// DeepEqual returns true if both the receiver and 'o' are deeply equal. -func (l *L4Addr) DeepEqual(o *L4Addr) bool { - if l == nil { - return o == nil - } - return l.deepEqual(o) -} - -// NewL4Addr creates a new L4Addr. -func NewL4Addr(protocol L4Type, number uint16) *L4Addr { - return &L4Addr{Protocol: protocol, Port: number} -} - -// L3n4Addr is used to store, as an unique L3+L4 address in the KVStore. It also -// includes the lookup scope for frontend addresses which is used in service -// handling for externalTrafficPolicy=Local and internalTrafficPolicy=Local, -// that is, Scope{External,Internal}. -// -// +deepequal-gen=true -// +deepequal-gen:private-method=true -type L3n4Addr struct { - AddrCluster cmtypes.AddrCluster - L4Addr - Scope uint8 -} - -// DeepEqual returns true if both the receiver and 'o' are deeply equal. -func (l *L3n4Addr) DeepEqual(o *L3n4Addr) bool { - if l == nil { - return o == nil - } - return l.AddrCluster.Equal(o.AddrCluster) && l.deepEqual(o) -} - -// NewL3n4Addr creates a new L3n4Addr. -func NewL3n4Addr(protocol L4Type, addrCluster cmtypes.AddrCluster, portNumber uint16, scope uint8) *L3n4Addr { - lbport := NewL4Addr(protocol, portNumber) - - addr := L3n4Addr{AddrCluster: addrCluster, L4Addr: *lbport, Scope: scope} - - return &addr -} - -func NewL3n4AddrFromModel(base *models.FrontendAddress) (*L3n4Addr, error) { - var scope uint8 - - if base == nil { - return nil, nil - } - - if base.IP == "" { - return nil, fmt.Errorf("missing IP address") - } - - proto := NONE - if base.Protocol != "" { - p, err := NewL4Type(base.Protocol) - if err != nil { - return nil, err - } - proto = p - } - - l4addr := NewL4Addr(proto, base.Port) - addrCluster, err := cmtypes.ParseAddrCluster(base.IP) - if err != nil { - return nil, err - } - - if base.Scope == models.FrontendAddressScopeExternal { - scope = ScopeExternal - } else if base.Scope == models.FrontendAddressScopeInternal { - scope = ScopeInternal - } else { - return nil, fmt.Errorf("invalid scope \"%s\"", base.Scope) - } - - return &L3n4Addr{AddrCluster: addrCluster, L4Addr: *l4addr, Scope: scope}, nil -} - -// NewBackend creates the Backend struct instance from given params. -// The default state for the returned Backend is BackendStateActive. -func NewBackend(id BackendID, protocol L4Type, addrCluster cmtypes.AddrCluster, portNumber uint16) *Backend { - lbport := NewL4Addr(protocol, portNumber) - b := Backend{ - ID: id, - L3n4Addr: L3n4Addr{AddrCluster: addrCluster, L4Addr: *lbport}, - State: BackendStateActive, - Preferred: Preferred(false), - Weight: DefaultBackendWeight, - } - - return &b -} - -// NewBackendWithState creates the Backend struct instance from given params. -func NewBackendWithState(id BackendID, protocol L4Type, addrCluster cmtypes.AddrCluster, portNumber uint16, - state BackendState) *Backend { - lbport := NewL4Addr(protocol, portNumber) - b := Backend{ - ID: id, - L3n4Addr: L3n4Addr{AddrCluster: addrCluster, L4Addr: *lbport}, - State: state, - Weight: DefaultBackendWeight, - } - - return &b -} - -func NewBackendFromBackendModel(base *models.BackendAddress) (*Backend, error) { - if base.IP == nil { - return nil, fmt.Errorf("missing IP address") - } - - // FIXME: Should this be NONE ? - l4addr := NewL4Addr(NONE, base.Port) - addrCluster, err := cmtypes.ParseAddrCluster(*base.IP) - if err != nil { - return nil, err - } - state, err := GetBackendState(base.State) - if err != nil { - return nil, fmt.Errorf("invalid backend state [%s]", base.State) - } - - b := &Backend{ - NodeName: base.NodeName, - L3n4Addr: L3n4Addr{AddrCluster: addrCluster, L4Addr: *l4addr}, - State: state, - Preferred: Preferred(base.Preferred), - } - - if base.Weight != nil { - b.Weight = *base.Weight - } - - if b.Weight == 0 { - b.State = BackendStateMaintenance - } - - return b, nil -} - -func NewL3n4AddrFromBackendModel(base *models.BackendAddress) (*L3n4Addr, error) { - if base.IP == nil { - return nil, fmt.Errorf("missing IP address") - } - - // FIXME: Should this be NONE ? - l4addr := NewL4Addr(NONE, base.Port) - addrCluster, err := cmtypes.ParseAddrCluster(*base.IP) - if err != nil { - return nil, err - } - return &L3n4Addr{AddrCluster: addrCluster, L4Addr: *l4addr}, nil -} - -func (a *L3n4Addr) GetModel() *models.FrontendAddress { - if a == nil { - return nil - } - - scope := models.FrontendAddressScopeExternal - if a.Scope == ScopeInternal { - scope = models.FrontendAddressScopeInternal - } - return &models.FrontendAddress{ - IP: a.AddrCluster.String(), - Port: a.Port, - Scope: scope, - } -} - -func (b *Backend) GetBackendModel() *models.BackendAddress { - if b == nil { - return nil - } - - addrClusterStr := b.AddrCluster.String() - stateStr, _ := b.State.String() - return &models.BackendAddress{ - IP: &addrClusterStr, - Port: b.Port, - NodeName: b.NodeName, - State: stateStr, - Preferred: bool(b.Preferred), - Weight: &b.Weight, - } -} - -// String returns the L3n4Addr in the "IPv4:Port[/Scope]" format for IPv4 and -// "[IPv6]:Port[/Scope]" format for IPv6. -func (a *L3n4Addr) String() string { - var scope string - if a.Scope == ScopeInternal { - scope = "/i" - } - if a.IsIPv6() { - return "[" + a.AddrCluster.String() + "]:" + strconv.FormatUint(uint64(a.Port), 10) + scope - } - return a.AddrCluster.String() + ":" + strconv.FormatUint(uint64(a.Port), 10) + scope -} - -// StringWithProtocol returns the L3n4Addr in the "IPv4:Port/Protocol[/Scope]" -// format for IPv4 and "[IPv6]:Port/Protocol[/Scope]" format for IPv6. -func (a *L3n4Addr) StringWithProtocol() string { - var scope string - if a.Scope == ScopeInternal { - scope = "/i" - } - if a.IsIPv6() { - return "[" + a.AddrCluster.String() + "]:" + strconv.FormatUint(uint64(a.Port), 10) + "/" + a.Protocol + scope - } - return a.AddrCluster.String() + ":" + strconv.FormatUint(uint64(a.Port), 10) + "/" + a.Protocol + scope -} - -// StringID returns the L3n4Addr as string to be used for unique identification -func (a *L3n4Addr) StringID() string { - // This does not include the protocol right now as the datapath does - // not include the protocol in the lookup of the service IP. - return a.String() -} - -// Hash calculates a unique string of the L3n4Addr e.g for use as a key in maps. -// Note: the resulting string is meant to be used as a key for maps and is not -// readable by a human eye when printed out. -func (a L3n4Addr) Hash() string { - const lenProto = 0 // proto is omitted for now - const lenScope = 1 // scope is uint8 which is an alias for byte - const lenPort = 2 // port is uint16 which is 2 bytes - - b := make([]byte, cmtypes.AddrClusterLen+lenProto+lenScope+lenPort) - ac20 := a.AddrCluster.As20() - copy(b, ac20[:]) - // FIXME: add Protocol once we care about protocols - // scope is a uint8 which is an alias for byte so a cast is safe - b[net.IPv6len+lenProto] = byte(a.Scope) - // port is a uint16, so 2 bytes - b[net.IPv6len+lenProto+lenScope] = byte(a.Port >> 8) - b[net.IPv6len+lenProto+lenScope+1] = byte(a.Port & 0xff) - return string(b) -} - -// IsIPv6 returns true if the IP address in the given L3n4Addr is IPv6 or not. -func (a *L3n4Addr) IsIPv6() bool { - return a.AddrCluster.Is6() -} - -// L3n4AddrID is used to store, as an unique L3+L4 plus the assigned ID, in the -// KVStore. -// -// +deepequal-gen=true -// +deepequal-gen:private-method=true -type L3n4AddrID struct { - L3n4Addr - ID ID -} - -// DeepEqual returns true if both the receiver and 'o' are deeply equal. -func (l *L3n4AddrID) DeepEqual(o *L3n4AddrID) bool { - if l == nil { - return o == nil - } - return l.deepEqual(o) -} - -// NewL3n4AddrID creates a new L3n4AddrID. -func NewL3n4AddrID(protocol L4Type, addrCluster cmtypes.AddrCluster, portNumber uint16, scope uint8, id ID) *L3n4AddrID { - l3n4Addr := NewL3n4Addr(protocol, addrCluster, portNumber, scope) - return &L3n4AddrID{L3n4Addr: *l3n4Addr, ID: id} -} - -// IsIPv6 returns true if the IP address in L3n4Addr's L3n4AddrID is IPv6 or not. -func (l *L3n4AddrID) IsIPv6() bool { - return l.L3n4Addr.IsIPv6() -} diff --git a/vendor/github.com/cilium/cilium/pkg/loadbalancer/zz_generated.deepcopy.go b/vendor/github.com/cilium/cilium/pkg/loadbalancer/zz_generated.deepcopy.go deleted file mode 100644 index 99b764a8a..000000000 --- a/vendor/github.com/cilium/cilium/pkg/loadbalancer/zz_generated.deepcopy.go +++ /dev/null @@ -1,152 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package loadbalancer - -import ( - cidr "github.com/cilium/cilium/pkg/cidr" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Backend) DeepCopyInto(out *Backend) { - *out = *in - in.L3n4Addr.DeepCopyInto(&out.L3n4Addr) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Backend. -func (in *Backend) DeepCopy() *Backend { - if in == nil { - return nil - } - out := new(Backend) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *L3n4Addr) DeepCopyInto(out *L3n4Addr) { - *out = *in - in.AddrCluster.DeepCopyInto(&out.AddrCluster) - out.L4Addr = in.L4Addr - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new L3n4Addr. -func (in *L3n4Addr) DeepCopy() *L3n4Addr { - if in == nil { - return nil - } - out := new(L3n4Addr) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *L3n4AddrID) DeepCopyInto(out *L3n4AddrID) { - *out = *in - in.L3n4Addr.DeepCopyInto(&out.L3n4Addr) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new L3n4AddrID. -func (in *L3n4AddrID) DeepCopy() *L3n4AddrID { - if in == nil { - return nil - } - out := new(L3n4AddrID) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *L4Addr) DeepCopyInto(out *L4Addr) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new L4Addr. -func (in *L4Addr) DeepCopy() *L4Addr { - if in == nil { - return nil - } - out := new(L4Addr) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SVC) DeepCopyInto(out *SVC) { - *out = *in - in.Frontend.DeepCopyInto(&out.Frontend) - if in.Backends != nil { - in, out := &in.Backends, &out.Backends - *out = make([]*Backend, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(Backend) - (*in).DeepCopyInto(*out) - } - } - } - out.Name = in.Name - if in.LoadBalancerSourceRanges != nil { - in, out := &in.LoadBalancerSourceRanges, &out.LoadBalancerSourceRanges - *out = make([]*cidr.CIDR, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = (*in).DeepCopy() - } - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SVC. -func (in *SVC) DeepCopy() *SVC { - if in == nil { - return nil - } - out := new(SVC) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ServiceName) DeepCopyInto(out *ServiceName) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceName. -func (in *ServiceName) DeepCopy() *ServiceName { - if in == nil { - return nil - } - out := new(ServiceName) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SvcFlagParam) DeepCopyInto(out *SvcFlagParam) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SvcFlagParam. -func (in *SvcFlagParam) DeepCopy() *SvcFlagParam { - if in == nil { - return nil - } - out := new(SvcFlagParam) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/github.com/cilium/cilium/pkg/loadbalancer/zz_generated.deepequal.go b/vendor/github.com/cilium/cilium/pkg/loadbalancer/zz_generated.deepequal.go deleted file mode 100644 index 7290c0d25..000000000 --- a/vendor/github.com/cilium/cilium/pkg/loadbalancer/zz_generated.deepequal.go +++ /dev/null @@ -1,66 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepequal-gen. DO NOT EDIT. - -package loadbalancer - -// deepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *L3n4Addr) deepEqual(other *L3n4Addr) bool { - if other == nil { - return false - } - - if !in.AddrCluster.DeepEqual(&other.AddrCluster) { - return false - } - - if in.L4Addr != other.L4Addr { - return false - } - - if in.Scope != other.Scope { - return false - } - - return true -} - -// deepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *L3n4AddrID) deepEqual(other *L3n4AddrID) bool { - if other == nil { - return false - } - - if !in.L3n4Addr.DeepEqual(&other.L3n4Addr) { - return false - } - - if in.ID != other.ID { - return false - } - - return true -} - -// deepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *L4Addr) deepEqual(other *L4Addr) bool { - if other == nil { - return false - } - - if in.Protocol != other.Protocol { - return false - } - if in.Port != other.Port { - return false - } - - return true -} diff --git a/vendor/github.com/cilium/cilium/pkg/logging/logfields/logfields.go b/vendor/github.com/cilium/cilium/pkg/logging/logfields/logfields.go index edc28d908..3ec5299ee 100644 --- a/vendor/github.com/cilium/cilium/pkg/logging/logfields/logfields.go +++ b/vendor/github.com/cilium/cilium/pkg/logging/logfields/logfields.go @@ -32,6 +32,9 @@ const ( // EndpointState is the current endpoint state EndpointState = "endpointState" + // Error is the Go error + Error = "error" + // EventUUID is an event unique identifier EventUUID = "eventID" @@ -202,6 +205,9 @@ const ( // Port is a L4 port Port = "port" + // Ports is a list of L4 ports + Ports = "ports" + // PortName is a k8s ContainerPort Name PortName = "portName" diff --git a/vendor/github.com/cilium/cilium/pkg/metrics/bpf.go b/vendor/github.com/cilium/cilium/pkg/metrics/bpf.go deleted file mode 100644 index c13ca2587..000000000 --- a/vendor/github.com/cilium/cilium/pkg/metrics/bpf.go +++ /dev/null @@ -1,90 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package metrics - -import ( - "context" - "encoding/json" - "fmt" - "os/exec" - - "github.com/prometheus/client_golang/prometheus" - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/pkg/time" -) - -type bpfCollector struct { - bpfMapsMemory *prometheus.Desc - bpfProgMemory *prometheus.Desc -} - -func newbpfCollector() *bpfCollector { - return &bpfCollector{ - bpfMapsMemory: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "", "bpf_maps_virtual_memory_max_bytes"), - "BPF maps kernel max memory usage size in bytes.", - nil, nil, - ), - bpfProgMemory: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "", "bpf_progs_virtual_memory_max_bytes"), - "BPF programs kernel max memory usage size in bytes.", - nil, nil, - ), - } -} - -func (s *bpfCollector) Describe(ch chan<- *prometheus.Desc) { - ch <- s.bpfMapsMemory - ch <- s.bpfProgMemory -} - -type memoryEntry struct { - BytesMemlock uint64 `json:"bytes_memlock"` -} - -func getMemoryUsage(typ string) (uint64, error) { - ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) - defer cancel() - cmd := exec.CommandContext(ctx, "bpftool", "-j", typ, "show") - out, err := cmd.Output() - if err != nil { - return 0, fmt.Errorf("unable to get bpftool output: %w", err) - } - - var memoryEntries []memoryEntry - err = json.Unmarshal(out, &memoryEntries) - if err != nil { - return 0, fmt.Errorf("unable to unmarshal bpftool output: %w", err) - } - var totalMem uint64 - for _, entry := range memoryEntries { - totalMem += entry.BytesMemlock - } - return totalMem, nil -} - -func (s *bpfCollector) Collect(ch chan<- prometheus.Metric) { - mapMem, err := getMemoryUsage("map") - if err != nil { - logrus.WithError(err).Error("Error while getting BPF maps memory usage") - } else { - ch <- prometheus.MustNewConstMetric( - s.bpfMapsMemory, - prometheus.GaugeValue, - float64(mapMem), - ) - } - - progMem, err := getMemoryUsage("prog") - if err != nil { - logrus.WithError(err).Error("Error while getting BPF progs memory usage") - } else { - ch <- prometheus.MustNewConstMetric( - s.bpfProgMemory, - prometheus.GaugeValue, - float64(progMem), - ) - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/metrics/cell.go b/vendor/github.com/cilium/cilium/pkg/metrics/cell.go deleted file mode 100644 index cd37f76d5..000000000 --- a/vendor/github.com/cilium/cilium/pkg/metrics/cell.go +++ /dev/null @@ -1,125 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package metrics - -import ( - "fmt" - "reflect" - - "github.com/cilium/hive/cell" - "github.com/prometheus/client_golang/prometheus" - - pkgmetric "github.com/cilium/cilium/pkg/metrics/metric" -) - -var Cell = cell.Module("metrics", "Metrics", - // Provide registry to hive, but also invoke if case no cells decide to use as dependency - cell.Provide(NewRegistry), - Metric(NewLegacyMetrics), - cell.Config(defaultRegistryConfig), - cell.Invoke(func(_ *Registry) { - // This is a hack to ensure that errors/warnings collected in the pre hive initialization - // phase are emitted as metrics. - FlushLoggingMetrics() - }), -) - -// Metric constructs a new metric cell. -// -// This cell type provides `S` to the hive as returned by `ctor`, it also makes each individual field -// value available via the `hive-metrics` value group. Infrastructure components such as a registry, -// inspection tool, or documentation generator can collect all metrics in the hive via this value group. -// -// The `ctor` constructor must return a struct or pointer to a struct of type `S`. The returned struct -// must only contain public fields. All field types should implement the -// `github.com/cilium/cilium/pkg/metrics/metric.WithMetadata` -// and `github.com/prometheus/client_golang/prometheus.Collector` interfaces. -func Metric[S any](ctor func() S) cell.Cell { - var ( - withMeta pkgmetric.WithMetadata - collector prometheus.Collector - ) - - var nilOut S - outTyp := reflect.TypeOf(nilOut) - if outTyp.Kind() == reflect.Ptr { - outTyp = outTyp.Elem() - } - - if outTyp.Kind() != reflect.Struct { - panic(fmt.Errorf( - "metrics.Metric must be invoked with a constructor function that returns a struct or pointer to a struct, "+ - "a constructor which returns a %s was supplied", - outTyp.Kind(), - )) - } - - // Let's be strict for now, could lift this in the future if we ever need to - if outTyp.NumField() == 0 { - panic(fmt.Errorf( - "metrics.Metric must be invoked with a constructor function that returns exactly a struct with at least 1 " + - "metric, a constructor which returns a struct with zero fields was supplied", - )) - } - - withMetaTyp := reflect.TypeOf(&withMeta).Elem() - collectorTyp := reflect.TypeOf(&collector).Elem() - for i := 0; i < outTyp.NumField(); i++ { - field := outTyp.Field(i) - if !field.IsExported() { - panic(fmt.Errorf( - "The struct returned by the constructor passed to metrics.Metric has a private field '%s', which "+ - "is not allowed. All fields on the returning struct must be exported", - field.Name, - )) - } - - if !field.Type.Implements(withMetaTyp) { - panic(fmt.Errorf( - "The struct returned by the constructor passed to metrics.Metric has a field '%s', which is not metric.WithMetadata.", - field.Name, - )) - } - - if !field.Type.Implements(collectorTyp) { - panic(fmt.Errorf( - "The struct returned by the constructor passed to metrics.Metric has a field '%s', which is not prometheus.Collector.", - field.Name, - )) - } - } - - return cell.Provide(ctor, provideMetrics[S]) -} - -type hiveMetricOut struct { - cell.Out - - Metrics []pkgmetric.WithMetadata `group:"hive-metrics,flatten"` -} - -func provideMetrics[S any](metricSet S) hiveMetricOut { - var metrics []pkgmetric.WithMetadata - - value := reflect.ValueOf(metricSet) - typ := value.Type() - if typ.Kind() == reflect.Pointer { - value = value.Elem() - typ = typ.Elem() - } - - if typ.Kind() != reflect.Struct { - return hiveMetricOut{} - } - - for i := 0; i < typ.NumField(); i++ { - if withMeta, ok := value.Field(i).Interface().(pkgmetric.WithMetadata); ok { - metrics = append(metrics, withMeta) - } - } - - return hiveMetricOut{ - Metrics: metrics, - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/metrics/interfaces.go b/vendor/github.com/cilium/cilium/pkg/metrics/interfaces.go deleted file mode 100644 index 75b67076f..000000000 --- a/vendor/github.com/cilium/cilium/pkg/metrics/interfaces.go +++ /dev/null @@ -1,199 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package metrics - -import ( - "github.com/prometheus/client_golang/prometheus" - dto "github.com/prometheus/client_model/go" - - "github.com/cilium/cilium/api/v1/client/daemon" - "github.com/cilium/cilium/api/v1/health/client/connectivity" - metricpkg "github.com/cilium/cilium/pkg/metrics/metric" -) - -type daemonHealthGetter interface { - GetHealthz(params *daemon.GetHealthzParams, opts ...daemon.ClientOption) (*daemon.GetHealthzOK, error) -} - -type connectivityStatusGetter interface { - GetStatus(params *connectivity.GetStatusParams, opts ...connectivity.ClientOption) (*connectivity.GetStatusOK, error) -} - -var ( - NoOpMetric prometheus.Metric = &mockMetric{} - NoOpCollector prometheus.Collector = &collector{} - - NoOpCounter metricpkg.Counter = &counter{NoOpMetric, NoOpCollector} - NoOpCounterVec metricpkg.Vec[metricpkg.Counter] = &counterVec{NoOpCollector} - NoOpObserver metricpkg.Observer = &observer{} - NoOpHistogram metricpkg.Histogram = &histogram{NoOpCollector} - NoOpObserverVec metricpkg.Vec[metricpkg.Observer] = &observerVec{NoOpCollector} - NoOpGauge metricpkg.Gauge = &gauge{NoOpMetric, NoOpCollector} - NoOpGaugeVec metricpkg.Vec[metricpkg.Gauge] = &gaugeVec{NoOpCollector} - NoOpGaugeDeletableVec metricpkg.DeletableVec[metricpkg.Gauge] = &gaugeDeletableVec{gaugeVec{NoOpCollector}} -) - -// Metric - -type mockMetric struct{} - -// *WARNING*: Desc returns nil so do not register this metric into prometheus -// default register. -func (m *mockMetric) Desc() *prometheus.Desc { return nil } -func (m *mockMetric) Write(*dto.Metric) error { return nil } - -// Collector - -type collector struct{} - -func (c *collector) Describe(chan<- *prometheus.Desc) {} -func (c *collector) Collect(chan<- prometheus.Metric) {} - -// Counter - -type counter struct { - prometheus.Metric - prometheus.Collector -} - -func (cv *counter) Add(float64) {} -func (cv *counter) Get() float64 { return 0 } -func (cv *counter) Inc() {} -func (cv *counter) IsEnabled() bool { return false } -func (cv *counter) SetEnabled(bool) {} -func (cv *counter) Opts() metricpkg.Opts { return metricpkg.Opts{} } - -// CounterVec - -type counterVec struct{ prometheus.Collector } - -func (cv *counterVec) With(prometheus.Labels) metricpkg.Counter { return NoOpGauge } -func (cv *counterVec) WithLabelValues(...string) metricpkg.Counter { return NoOpGauge } - -func (cv *counterVec) CurryWith(prometheus.Labels) (metricpkg.Vec[metricpkg.Counter], error) { - return NoOpCounterVec, nil -} -func (cv *counterVec) MustCurryWith(prometheus.Labels) metricpkg.Vec[metricpkg.Counter] { - return NoOpCounterVec -} -func (cv *counterVec) GetMetricWith(prometheus.Labels) (metricpkg.Counter, error) { - return NoOpCounter, nil -} -func (cv *counterVec) GetMetricWithLabelValues(...string) (metricpkg.Counter, error) { - return NoOpCounter, nil -} -func (cv *counterVec) IsEnabled() bool { return false } -func (cv *counterVec) SetEnabled(bool) {} -func (cv *counterVec) Opts() metricpkg.Opts { return metricpkg.Opts{} } - -// Observer - -type observer struct{} - -func (o *observer) Observe(float64) {} -func (o *observer) IsEnabled() bool { return false } -func (o *observer) SetEnabled(bool) {} -func (o *observer) Opts() metricpkg.Opts { return metricpkg.Opts{} } - -// Histogram - -type histogram struct { - prometheus.Collector -} - -func (h *histogram) Observe(float64) {} - -func (h *histogram) Desc() *prometheus.Desc { return nil } -func (h *histogram) Write(*dto.Metric) error { return nil } -func (h *histogram) IsEnabled() bool { return false } -func (h *histogram) SetEnabled(bool) {} -func (h *histogram) Opts() metricpkg.Opts { return metricpkg.Opts{} } - -// ObserverVec - -type observerVec struct { - prometheus.Collector -} - -func (ov *observerVec) GetMetricWith(prometheus.Labels) (metricpkg.Observer, error) { - return NoOpObserver, nil -} -func (ov *observerVec) GetMetricWithLabelValues(lvs ...string) (metricpkg.Observer, error) { - return NoOpObserver, nil -} - -func (ov *observerVec) With(prometheus.Labels) metricpkg.Observer { return NoOpObserver } -func (ov *observerVec) WithLabelValues(...string) metricpkg.Observer { return NoOpObserver } - -func (ov *observerVec) CurryWith(prometheus.Labels) (metricpkg.Vec[metricpkg.Observer], error) { - return NoOpObserverVec, nil -} -func (ov *observerVec) MustCurryWith(prometheus.Labels) metricpkg.Vec[metricpkg.Observer] { - return NoOpObserverVec -} - -func (ov *observerVec) IsEnabled() bool { return false } -func (ov *observerVec) SetEnabled(bool) {} -func (ov *observerVec) Opts() metricpkg.Opts { return metricpkg.Opts{} } - -// Gauge - -type gauge struct { - prometheus.Metric - prometheus.Collector -} - -func (g *gauge) Set(float64) {} -func (g *gauge) Get() float64 { return 0 } -func (g *gauge) Inc() {} -func (g *gauge) Dec() {} -func (g *gauge) Add(float64) {} -func (g *gauge) Sub(float64) {} -func (g *gauge) SetToCurrentTime() {} -func (g *gauge) IsEnabled() bool { return false } -func (g *gauge) SetEnabled(bool) {} -func (g *gauge) Opts() metricpkg.Opts { return metricpkg.Opts{} } - -// GaugeVec - -type gaugeDeletableVec struct { - gaugeVec -} - -func (*gaugeDeletableVec) Delete(ll prometheus.Labels) bool { - return false -} - -func (*gaugeDeletableVec) DeleteLabelValues(lvs ...string) bool { - return false -} - -func (*gaugeDeletableVec) DeletePartialMatch(labels prometheus.Labels) int { - return 0 -} - -func (*gaugeDeletableVec) Reset() {} - -type gaugeVec struct { - prometheus.Collector -} - -func (gv *gaugeVec) With(prometheus.Labels) metricpkg.Gauge { return NoOpGauge } -func (gv *gaugeVec) WithLabelValues(...string) metricpkg.Gauge { return NoOpGauge } - -func (gv *gaugeVec) CurryWith(prometheus.Labels) (metricpkg.Vec[metricpkg.Gauge], error) { - return NoOpGaugeVec, nil -} -func (gv *gaugeVec) MustCurryWith(prometheus.Labels) metricpkg.Vec[metricpkg.Gauge] { - return NoOpGaugeVec -} -func (gv *gaugeVec) GetMetricWith(prometheus.Labels) (metricpkg.Gauge, error) { - return NoOpGauge, nil -} -func (gv *gaugeVec) GetMetricWithLabelValues(...string) (metricpkg.Gauge, error) { - return NoOpGauge, nil -} -func (gv *gaugeVec) IsEnabled() bool { return false } -func (gv *gaugeVec) SetEnabled(bool) {} -func (gv *gaugeVec) Opts() metricpkg.Opts { return metricpkg.Opts{} } diff --git a/vendor/github.com/cilium/cilium/pkg/metrics/logging_hook.go b/vendor/github.com/cilium/cilium/pkg/metrics/logging_hook.go deleted file mode 100644 index fe876017a..000000000 --- a/vendor/github.com/cilium/cilium/pkg/metrics/logging_hook.go +++ /dev/null @@ -1,96 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package metrics - -import ( - "fmt" - "reflect" - "sync" - "sync/atomic" - - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/pkg/logging/logfields" -) - -var ( - metricsInitialized chan struct{} = make(chan struct{}) - flushMetrics = sync.Once{} -) - -// FlushLoggingMetrics will cause all logging hook metrics accumulated prior -// to the errors_warnings metrics being registered with the Prometheus collector -// to be incremented to their respective errors_warnings metrics tuple. -func FlushLoggingMetrics() { - flushMetrics.Do(func() { - if metricsInitialized != nil { - close(metricsInitialized) - metricsInitialized = nil - } - }) -} - -// LoggingHook is a hook for logrus which counts error and warning messages as a -// Prometheus metric. -type LoggingHook struct { - errs, warn atomic.Uint64 -} - -// NewLoggingHook returns a new instance of LoggingHook for the given Cilium -// component. -func NewLoggingHook() *LoggingHook { - lh := &LoggingHook{} - go func() { - // This channel is closed after registry is created. At this point if the errs/warnings metric - // is enabled we flush counts of errors/warnings we collected before the registry was created. - // This is a hack to ensure that errors/warnings collected in the pre hive initialization - // phase are emitted as metrics. - // Because the ErrorsWarnings metric is a counter, this means that the rate of these errors won't be - // accurate, however init errors can only happen during initialization so it probably doesn't make - // a big difference in practice. - <-metricsInitialized - ErrorsWarnings.WithLabelValues(logrus.ErrorLevel.String(), "init").Add(float64(lh.errs.Load())) - ErrorsWarnings.WithLabelValues(logrus.WarnLevel.String(), "init").Add(float64(lh.warn.Load())) - }() - return lh -} - -// Levels returns the list of logging levels on which the hook is triggered. -func (h *LoggingHook) Levels() []logrus.Level { - return []logrus.Level{ - logrus.ErrorLevel, - logrus.WarnLevel, - } -} - -// Fire is the main method which is called every time when logger has an error -// or warning message. -func (h *LoggingHook) Fire(entry *logrus.Entry) error { - // Get information about subsystem from logging entry field. - iSubsystem, ok := entry.Data[logfields.LogSubsys] - if !ok { - serializedEntry, err := entry.String() - if err != nil { - return fmt.Errorf("log entry cannot be serialized and doesn't contain 'subsys' field") - } - return fmt.Errorf("log entry doesn't contain 'subsys' field: %s", serializedEntry) - } - subsystem, ok := iSubsystem.(string) - if !ok { - return fmt.Errorf("type of the 'subsystem' log entry field is not string but %s", reflect.TypeOf(iSubsystem)) - } - - // We count errors/warnings outside of the prometheus metric. - switch entry.Level { - case logrus.ErrorLevel: - h.errs.Add(1) - case logrus.WarnLevel: - h.warn.Add(1) - } - - // Increment the metric. - ErrorsWarnings.WithLabelValues(entry.Level.String(), subsystem).Inc() - - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/metrics/metric/collections/product.go b/vendor/github.com/cilium/cilium/pkg/metrics/metric/collections/product.go deleted file mode 100644 index 28c24f7f2..000000000 --- a/vendor/github.com/cilium/cilium/pkg/metrics/metric/collections/product.go +++ /dev/null @@ -1,74 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package collections - -// CartesianProduct returns the cartesian product of the input vectors as -// a vector of vectors, each with length the same as the number of input vectors. -func CartesianProduct[T any](vs ...[]T) [][]T { - if len(vs) == 0 { - return [][]T{} - } - - dimension := len(vs) // Each output will be a vector of this length. - // Iterate to find out the number of output vectors. - size := len(vs[0]) - for i := 1; i < len(vs); i++ { - size *= len(vs[i]) - } - - // Allocate the output vectors. - dst := make([][]T, size) - for i := range dst { - dst[i] = make([]T, dimension) - } - - lastm := 1 - for i := 0; i < dimension; i++ { - permuteColumn[T](dst, i, lastm, vs[i]) - lastm = lastm * len(vs[i]) - } - return dst -} - -// permuteColumn fills in the nth column of the output vectors of the cartesian -// product of the input vectors. -// -// leftPermSize is the number of vectors as a result of permuting 0,..,col-1 columns. -// That is, this is the block size upon which we will repeat the values of v0 such that -// every previous permutation is again permuted with each value of v0. -// -// For ex. -// CartesianProduct[string]({"a", "b"}, {"x", "y", "z"}) -// -// Iteration (i.e. col, leftPermSize=1) 1: -// -// dst = [ -// ["a"], -// ["b"], -// ["a"] -// ["b"] -// ["a"] -// ["b"] -// ] -// -// Iteration (leftPermSize=2): -// -// dst = [ -// ["a", "x"], // <- each elem of vec is repeated leftPermSize times. -// ["b", "x"], -// ["a", "y"] -// ["b", "y"] -// ["a", "z"] -// ["b", "z"] -// ] -func permuteColumn[T any](dst [][]T, col int, leftPermSize int, vec []T) { - // Go down the column with the current lhs. - // You want to skip along, lastm elements at a time. - for i := 0; i < len(dst); i += leftPermSize { // So we're skipping n rows at a time, - vi := (i / leftPermSize) % len(vec) - for off := 0; off < leftPermSize; off++ { // this is a repeat - dst[i+off][col] = vec[vi] - } - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/metrics/metric/counter.go b/vendor/github.com/cilium/cilium/pkg/metrics/metric/counter.go deleted file mode 100644 index bcbf938c6..000000000 --- a/vendor/github.com/cilium/cilium/pkg/metrics/metric/counter.go +++ /dev/null @@ -1,205 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package metric - -import ( - "github.com/prometheus/client_golang/prometheus" - dto "github.com/prometheus/client_model/go" -) - -func NewCounter(opts CounterOpts) Counter { - return &counter{ - Counter: prometheus.NewCounter(opts.toPrometheus()), - metric: metric{ - enabled: !opts.Disabled, - opts: Opts(opts), - }, - } -} - -type Counter interface { - prometheus.Counter - WithMetadata - - Get() float64 -} - -type counter struct { - prometheus.Counter - metric -} - -func (c *counter) Collect(metricChan chan<- prometheus.Metric) { - if c.enabled { - c.Counter.Collect(metricChan) - } -} - -func (c *counter) Get() float64 { - var pm dto.Metric - err := c.Counter.Write(&pm) - if err == nil { - return *pm.Counter.Value - } - return 0 -} - -// Inc increments the counter by 1. Use Add to increment it by arbitrary -// non-negative values. -func (c *counter) Inc() { - if c.enabled { - c.Counter.Inc() - } -} - -// Add adds the given value to the counter. It panics if the value is < 0. -func (c *counter) Add(val float64) { - if c.enabled { - c.Counter.Add(val) - } -} - -// NewCounterVec creates a new DeletableVec[Counter] based on the provided CounterOpts and -// partitioned by the given label names. -func NewCounterVec(opts CounterOpts, labelNames []string) *counterVec { - return &counterVec{ - CounterVec: prometheus.NewCounterVec(opts.toPrometheus(), labelNames), - metric: metric{ - enabled: !opts.Disabled, - opts: Opts(opts), - }, - } -} - -// NewCounterVecWithLabels creates a new DeletableVec[Counter] based on the provided CounterOpts and -// partitioned by the given labels. -// This will also initialize the labels with the provided values so that metrics with known label value -// ranges can be pre-initialized to zero upon init. -// -// This should only be used when all label values are known at init, otherwise use of the -// metric vector with uninitialized labels will result in warnings. -// -// Note: Disabled metrics will not have their label values initialized. -// -// For example: -// -// NewCounterVecWithLabels(CounterOpts{ -// Namespace: "cilium", -// Subsystem: "subsystem", -// Name: "cilium_test", -// Disabled: false, -// }, Labels{ -// {Name: "foo", Values: NewValues("0", "1")}, -// {Name: "bar", Values: NewValues("a", "b")}, -// }) -// -// Will initialize the following metrics to: -// -// cilium_subsystem_cilium_test{foo="0", bar="a"} 0 -// cilium_subsystem_cilium_test{foo="0", bar="b"} 0 -// cilium_subsystem_cilium_test{foo="1", bar="a"} 0 -// cilium_subsystem_cilium_test{foo="1", bar="b"} 0 -func NewCounterVecWithLabels(opts CounterOpts, labels Labels) *counterVec { - cv := NewCounterVec(opts, labels.labelNames()) - initLabels[Counter](&cv.metric, labels, cv, opts.Disabled) - return cv -} - -type counterVec struct { - *prometheus.CounterVec - metric -} - -func (cv *counterVec) CurryWith(labels prometheus.Labels) (Vec[Counter], error) { - cv.checkLabels(labels) - vec, err := cv.CounterVec.CurryWith(labels) - if err == nil { - return &counterVec{CounterVec: vec, metric: cv.metric}, nil - } - return nil, err -} - -func (cv *counterVec) GetMetricWith(labels prometheus.Labels) (Counter, error) { - if !cv.enabled { - return &counter{ - metric: metric{enabled: false}, - }, nil - } - - promCounter, err := cv.CounterVec.GetMetricWith(labels) - if err == nil { - return &counter{ - Counter: promCounter, - metric: cv.metric, - }, nil - } - return nil, err -} - -func (cv *counterVec) GetMetricWithLabelValues(lvs ...string) (Counter, error) { - if !cv.enabled { - return &counter{ - metric: metric{enabled: false}, - }, nil - } - - promCounter, err := cv.CounterVec.GetMetricWithLabelValues(lvs...) - if err == nil { - return &counter{ - Counter: promCounter, - metric: cv.metric, - }, nil - } - return nil, err -} - -func (cv *counterVec) With(labels prometheus.Labels) Counter { - cv.checkLabels(labels) - if !cv.enabled { - return &counter{ - metric: metric{enabled: false}, - } - } - - promCounter := cv.CounterVec.With(labels) - return &counter{ - Counter: promCounter, - metric: cv.metric, - } -} - -func (cv *counterVec) WithLabelValues(lvs ...string) Counter { - cv.checkLabelValues(lvs...) - if !cv.enabled { - return &counter{ - metric: metric{enabled: false}, - } - } - - promCounter := cv.CounterVec.WithLabelValues(lvs...) - return &counter{ - Counter: promCounter, - metric: cv.metric, - } -} - -func (cv *counterVec) SetEnabled(e bool) { - if !e { - cv.Reset() - } - - cv.metric.SetEnabled(e) -} - -type CounterOpts Opts - -func (co CounterOpts) toPrometheus() prometheus.CounterOpts { - return prometheus.CounterOpts{ - Name: co.Name, - Namespace: co.Namespace, - Subsystem: co.Subsystem, - Help: co.Help, - ConstLabels: co.ConstLabels, - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/metrics/metric/gauge.go b/vendor/github.com/cilium/cilium/pkg/metrics/metric/gauge.go deleted file mode 100644 index 083caef55..000000000 --- a/vendor/github.com/cilium/cilium/pkg/metrics/metric/gauge.go +++ /dev/null @@ -1,267 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package metric - -import ( - "github.com/prometheus/client_golang/prometheus" - dto "github.com/prometheus/client_model/go" -) - -func NewGauge(opts GaugeOpts) Gauge { - return &gauge{ - Gauge: prometheus.NewGauge(opts.toPrometheus()), - metric: metric{ - enabled: !opts.Disabled, - opts: Opts(opts), - }, - } -} - -type Gauge interface { - prometheus.Gauge - WithMetadata - - Get() float64 -} - -type gauge struct { - prometheus.Gauge - metric -} - -func (g *gauge) Collect(metricChan chan<- prometheus.Metric) { - if g.enabled { - g.Gauge.Collect(metricChan) - } -} - -func (g *gauge) Get() float64 { - if !g.enabled { - return 0 - } - - var pm dto.Metric - err := g.Gauge.Write(&pm) - if err == nil { - return *pm.Gauge.Value - } - return 0 -} - -// Set sets the Gauge to an arbitrary value. -func (g *gauge) Set(val float64) { - if g.enabled { - g.Gauge.Set(val) - } -} - -// Inc increments the Gauge by 1. Use Add to increment it by arbitrary -// values. -func (g *gauge) Inc() { - if g.enabled { - g.Gauge.Inc() - } -} - -// Dec decrements the Gauge by 1. Use Sub to decrement it by arbitrary -// values. -func (g *gauge) Dec() { - if g.enabled { - g.Gauge.Dec() - } -} - -// Add adds the given value to the Gauge. (The value can be negative, -// resulting in a decrease of the Gauge.) -func (g *gauge) Add(val float64) { - if g.enabled { - g.Gauge.Add(val) - } -} - -// Sub subtracts the given value from the Gauge. (The value can be -// negative, resulting in an increase of the Gauge.) -func (g *gauge) Sub(i float64) { - if g.enabled { - g.Gauge.Sub(i) - } -} - -// SetToCurrentTime sets the Gauge to the current Unix time in seconds. -func (g *gauge) SetToCurrentTime() { - if g.enabled { - g.Gauge.SetToCurrentTime() - } -} - -// NewGaugeVec creates a new DeletableVec[Gauge] based on the provided GaugeOpts and -// partitioned by the given label names. -func NewGaugeVec(opts GaugeOpts, labelNames []string) *gaugeVec { - gv := &gaugeVec{ - GaugeVec: prometheus.NewGaugeVec(opts.toPrometheus(), labelNames), - metric: metric{ - enabled: !opts.Disabled, - opts: Opts(opts), - }, - } - return gv -} - -// NewGaugeVecWithLabels creates a new DeletableVec[Gauge] based on the provided CounterOpts and -// partitioned by the given labels. -// This will also initialize the labels with the provided values so that metrics with known label value -// ranges can be pre-initialized to zero upon init. -// -// This should only be used when all label values are known at init, otherwise use of the -// metric vector with uninitialized labels will result in warnings. -// -// Note: Disabled metrics will not have their label values initialized. -// -// For example: -// -// NewGaugeVecWithLabels(GaugeOpts{ -// Namespace: "cilium", -// Subsystem: "subsystem", -// Name: "cilium_test", -// Disabled: false, -// }, Labels{ -// {Name: "foo", Values: NewValues("0", "1")}, -// {Name: "bar", Values: NewValues("a", "b")}, -// }) -// -// Will initialize the following metrics to: -// -// cilium_subsystem_cilium_test{foo="0", bar="a"} 0 -// cilium_subsystem_cilium_test{foo="0", bar="b"} 0 -// cilium_subsystem_cilium_test{foo="1", bar="a"} 0 -// cilium_subsystem_cilium_test{foo="1", bar="b"} 0 -func NewGaugeVecWithLabels(opts GaugeOpts, labels Labels) *gaugeVec { - gv := NewGaugeVec(opts, labels.labelNames()) - initLabels[Gauge](&gv.metric, labels, gv, opts.Disabled) - return gv -} - -type gaugeVec struct { - *prometheus.GaugeVec - metric -} - -func (gv *gaugeVec) CurryWith(labels prometheus.Labels) (Vec[Gauge], error) { - gv.checkLabels(labels) - vec, err := gv.GaugeVec.CurryWith(labels) - if err == nil { - return &gaugeVec{GaugeVec: vec, metric: gv.metric}, nil - } - return nil, err -} - -func (gv *gaugeVec) GetMetricWith(labels prometheus.Labels) (Gauge, error) { - if !gv.enabled { - return &gauge{ - metric: metric{enabled: false}, - }, nil - } - - promGauge, err := gv.GaugeVec.GetMetricWith(labels) - if err == nil { - return &gauge{ - Gauge: promGauge, - metric: gv.metric, - }, nil - } - return nil, err -} - -func (gv *gaugeVec) GetMetricWithLabelValues(lvs ...string) (Gauge, error) { - if !gv.enabled { - return &gauge{ - metric: metric{enabled: false}, - }, nil - } - - promGauge, err := gv.GaugeVec.GetMetricWithLabelValues(lvs...) - if err == nil { - return &gauge{ - Gauge: promGauge, - metric: gv.metric, - }, nil - } - return nil, err -} - -func (gv *gaugeVec) With(labels prometheus.Labels) Gauge { - if !gv.enabled { - return &gauge{ - metric: metric{enabled: false}, - } - } - gv.checkLabels(labels) - - promGauge := gv.GaugeVec.With(labels) - return &gauge{ - Gauge: promGauge, - metric: gv.metric, - } -} - -func (gv *gaugeVec) WithLabelValues(lvs ...string) Gauge { - gv.checkLabelValues(lvs...) - if !gv.enabled { - return &gauge{ - metric: metric{enabled: false}, - } - } - - promGauge := gv.GaugeVec.WithLabelValues(lvs...) - return &gauge{ - Gauge: promGauge, - metric: gv.metric, - } -} - -func (gv *gaugeVec) SetEnabled(e bool) { - if !e { - gv.Reset() - } - - gv.metric.SetEnabled(e) -} - -type GaugeFunc interface { - prometheus.GaugeFunc - WithMetadata -} - -func NewGaugeFunc(opts GaugeOpts, function func() float64) GaugeFunc { - return &gaugeFunc{ - GaugeFunc: prometheus.NewGaugeFunc(opts.toPrometheus(), function), - metric: metric{ - enabled: !opts.Disabled, - opts: Opts(opts), - }, - } -} - -type gaugeFunc struct { - prometheus.GaugeFunc - metric -} - -func (gf *gaugeFunc) Collect(metricChan chan<- prometheus.Metric) { - if gf.enabled { - gf.GaugeFunc.Collect(metricChan) - } -} - -type GaugeOpts Opts - -func (o GaugeOpts) toPrometheus() prometheus.GaugeOpts { - return prometheus.GaugeOpts{ - Namespace: o.Namespace, - Subsystem: o.Subsystem, - Name: o.Name, - Help: o.Help, - ConstLabels: o.ConstLabels, - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/metrics/metric/histogram.go b/vendor/github.com/cilium/cilium/pkg/metrics/metric/histogram.go deleted file mode 100644 index 6d499707d..000000000 --- a/vendor/github.com/cilium/cilium/pkg/metrics/metric/histogram.go +++ /dev/null @@ -1,335 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package metric - -import ( - "time" - - "github.com/prometheus/client_golang/prometheus" -) - -func NewHistogram(opts HistogramOpts) Histogram { - return &histogram{ - Histogram: prometheus.NewHistogram(opts.toPrometheus()), - metric: metric{ - enabled: !opts.Disabled, - opts: opts.opts(), - }, - } -} - -type Histogram interface { - prometheus.Histogram - WithMetadata -} - -type histogram struct { - prometheus.Histogram - metric -} - -func (h *histogram) Collect(metricChan chan<- prometheus.Metric) { - if h.enabled { - h.Histogram.Collect(metricChan) - } -} - -// Observe adds a single observation to the histogram. Observations are -// usually positive or zero. Negative observations are accepted but -// prevent current versions of Prometheus from properly detecting -// counter resets in the sum of observations. (The experimental Native -// Histograms handle negative observations properly.) See -// https://prometheus.io/docs/practices/histograms/#count-and-sum-of-observations -// for details. -func (h *histogram) Observe(val float64) { - if h.enabled { - h.Histogram.Observe(val) - } -} - -type Observer interface { - prometheus.Observer - WithMetadata -} - -type observer struct { - prometheus.Observer - metric -} - -// Observe adds a single observation to the histogram. Observations are -// usually positive or zero. Negative observations are accepted but -// prevent current versions of Prometheus from properly detecting -// counter resets in the sum of observations. (The experimental Native -// Histograms handle negative observations properly.) See -// https://prometheus.io/docs/practices/histograms/#count-and-sum-of-observations -// for details. -func (o *observer) Observe(val float64) { - if o.enabled { - o.Observer.Observe(val) - } -} - -// NewHistogramVec creates a new Vec[Observer] (i.e. Histogram Vec) based on the provided HistogramOpts and -// partitioned by the given label names. -func NewHistogramVec(opts HistogramOpts, labelNames []string) *histogramVec { - return &histogramVec{ - ObserverVec: prometheus.NewHistogramVec(opts.toPrometheus(), labelNames), - metric: metric{ - enabled: !opts.Disabled, - opts: opts.opts(), - }, - } -} - -// NewHistogramVec creates a new Vec[Observer] based on the provided CounterOpts and -// partitioned by the given labels. -// This will also initialize the labels with the provided values so that metrics with known label value -// ranges can be pre-initialized to zero upon init. -// -// This should only be used when all label values are known at init, otherwise use of the -// metric vector with uninitialized labels will result in warnings. -// -// Note: Disabled metrics will not have their label values initialized. -func NewHistogramVecWithLabels(opts HistogramOpts, labels Labels) *histogramVec { - hv := NewHistogramVec(opts, labels.labelNames()) - initLabels(&hv.metric, labels, hv, opts.Disabled) - return hv -} - -type histogramVec struct { - prometheus.ObserverVec - metric -} - -func (cv *histogramVec) CurryWith(labels prometheus.Labels) (Vec[Observer], error) { - cv.checkLabels(labels) - vec, err := cv.ObserverVec.CurryWith(labels) - if err == nil { - return &histogramVec{ObserverVec: vec, metric: cv.metric}, nil - } - return nil, err -} - -func (cv *histogramVec) GetMetricWith(labels prometheus.Labels) (Observer, error) { - if !cv.enabled { - return &observer{ - metric: metric{enabled: false}, - }, nil - } - - promObserver, err := cv.ObserverVec.GetMetricWith(labels) - if err == nil { - return &observer{ - Observer: promObserver, - metric: cv.metric, - }, nil - } - return nil, err -} - -func (cv *histogramVec) GetMetricWithLabelValues(lvs ...string) (Observer, error) { - if !cv.enabled { - return &observer{ - metric: metric{enabled: false}, - }, nil - } - - promObserver, err := cv.ObserverVec.GetMetricWithLabelValues(lvs...) - if err == nil { - return &observer{ - Observer: promObserver, - metric: cv.metric, - }, nil - } - return nil, err -} - -func (cv *histogramVec) With(labels prometheus.Labels) Observer { - if !cv.enabled { - return &observer{ - metric: metric{enabled: false}, - } - } - cv.checkLabels(labels) - - promObserver := cv.ObserverVec.With(labels) - return &observer{ - Observer: promObserver, - metric: cv.metric, - } -} - -func (cv *histogramVec) WithLabelValues(lvs ...string) Observer { - if !cv.enabled { - return &observer{ - metric: metric{enabled: false}, - } - } - cv.checkLabelValues(lvs...) - - promObserver := cv.ObserverVec.WithLabelValues(lvs...) - return &observer{ - Observer: promObserver, - metric: cv.metric, - } -} - -func (cv *histogramVec) SetEnabled(e bool) { - if !e { - if histVec, ok := cv.ObserverVec.(*prometheus.HistogramVec); ok { - histVec.Reset() - } - } - - cv.metric.SetEnabled(e) -} - -// HistogramOpts are a modified and expanded version of the prometheus.HistogramOpts. -// https://pkg.go.dev/github.com/prometheus/client_golang/prometheus#HistogramOpts -type HistogramOpts struct { - // Namespace, Subsystem, and Name are components of the fully-qualified - // name of the Histogram (created by joining these components with - // "_"). Only Name is mandatory, the others merely help structuring the - // name. Note that the fully-qualified name of the Histogram must be a - // valid Prometheus metric name. - Namespace string - Subsystem string - Name string - - // Help provides information about this Histogram. - // - // Metrics with the same fully-qualified name must have the same Help - // string. - Help string - - // ConstLabels are used to attach fixed labels to this metric. Metrics - // with the same fully-qualified name must have the same label names in - // their ConstLabels. - // - // ConstLabels are only used rarely. In particular, do not use them to - // attach the same labels to all your metrics. Those use cases are - // better covered by target labels set by the scraping Prometheus - // server, or by one specific metric (e.g. a build_info or a - // machine_role metric). See also - // https://prometheus.io/docs/instrumenting/writing_exporters/#target-labels-not-static-scraped-labels - ConstLabels prometheus.Labels - - // Buckets defines the buckets into which observations are counted. Each - // element in the slice is the upper inclusive bound of a bucket. The - // values must be sorted in strictly increasing order. There is no need - // to add a highest bucket with +Inf bound, it will be added - // implicitly. If Buckets is left as nil or set to a slice of length - // zero, it is replaced by default buckets. The default buckets are - // DefBuckets if no buckets for a native histogram (see below) are used, - // otherwise the default is no buckets. (In other words, if you want to - // use both reguler buckets and buckets for a native histogram, you have - // to define the regular buckets here explicitly.) - Buckets []float64 - - // If NativeHistogramBucketFactor is greater than one, so-called sparse - // buckets are used (in addition to the regular buckets, if defined - // above). A Histogram with sparse buckets will be ingested as a Native - // Histogram by a Prometheus server with that feature enabled (requires - // Prometheus v2.40+). Sparse buckets are exponential buckets covering - // the whole float64 range (with the exception of the “zero” bucket, see - // SparseBucketsZeroThreshold below). From any one bucket to the next, - // the width of the bucket grows by a constant - // factor. NativeHistogramBucketFactor provides an upper bound for this - // factor (exception see below). The smaller - // NativeHistogramBucketFactor, the more buckets will be used and thus - // the more costly the histogram will become. A generally good trade-off - // between cost and accuracy is a value of 1.1 (each bucket is at most - // 10% wider than the previous one), which will result in each power of - // two divided into 8 buckets (e.g. there will be 8 buckets between 1 - // and 2, same as between 2 and 4, and 4 and 8, etc.). - // - // Details about the actually used factor: The factor is calculated as - // 2^(2^n), where n is an integer number between (and including) -8 and - // 4. n is chosen so that the resulting factor is the largest that is - // still smaller or equal to NativeHistogramBucketFactor. Note that the - // smallest possible factor is therefore approx. 1.00271 (i.e. 2^(2^-8) - // ). If NativeHistogramBucketFactor is greater than 1 but smaller than - // 2^(2^-8), then the actually used factor is still 2^(2^-8) even though - // it is larger than the provided NativeHistogramBucketFactor. - // - // NOTE: Native Histograms are still an experimental feature. Their - // behavior might still change without a major version - // bump. Subsequently, all NativeHistogram... options here might still - // change their behavior or name (or might completely disappear) without - // a major version bump. - NativeHistogramBucketFactor float64 - // All observations with an absolute value of less or equal - // NativeHistogramZeroThreshold are accumulated into a “zero” - // bucket. For best results, this should be close to a bucket - // boundary. This is usually the case if picking a power of two. If - // NativeHistogramZeroThreshold is left at zero, - // DefSparseBucketsZeroThreshold is used as the threshold. To configure - // a zero bucket with an actual threshold of zero (i.e. only - // observations of precisely zero will go into the zero bucket), set - // NativeHistogramZeroThreshold to the NativeHistogramZeroThresholdZero - // constant (or any negative float value). - NativeHistogramZeroThreshold float64 - - // The remaining fields define a strategy to limit the number of - // populated sparse buckets. If NativeHistogramMaxBucketNumber is left - // at zero, the number of buckets is not limited. (Note that this might - // lead to unbounded memory consumption if the values observed by the - // Histogram are sufficiently wide-spread. In particular, this could be - // used as a DoS attack vector. Where the observed values depend on - // external inputs, it is highly recommended to set a - // NativeHistogramMaxBucketNumber.) Once the set - // NativeHistogramMaxBucketNumber is exceeded, the following strategy is - // enacted: First, if the last reset (or the creation) of the histogram - // is at least NativeHistogramMinResetDuration ago, then the whole - // histogram is reset to its initial state (including regular - // buckets). If less time has passed, or if - // NativeHistogramMinResetDuration is zero, no reset is - // performed. Instead, the zero threshold is increased sufficiently to - // reduce the number of buckets to or below - // NativeHistogramMaxBucketNumber, but not to more than - // NativeHistogramMaxZeroThreshold. Thus, if - // NativeHistogramMaxZeroThreshold is already at or below the current - // zero threshold, nothing happens at this step. After that, if the - // number of buckets still exceeds NativeHistogramMaxBucketNumber, the - // resolution of the histogram is reduced by doubling the width of the - // sparse buckets (up to a growth factor between one bucket to the next - // of 2^(2^4) = 65536, see above). - NativeHistogramMaxBucketNumber uint32 - NativeHistogramMinResetDuration time.Duration - NativeHistogramMaxZeroThreshold float64 - - ConfigName string - - // If true, the metric has to be explicitly enabled via config or flags - Disabled bool -} - -func (ho HistogramOpts) opts() Opts { - return Opts{ - Namespace: ho.Namespace, - Subsystem: ho.Subsystem, - Name: ho.Name, - Help: ho.Help, - ConstLabels: ho.ConstLabels, - ConfigName: ho.ConfigName, - Disabled: ho.Disabled, - } -} - -func (ho HistogramOpts) toPrometheus() prometheus.HistogramOpts { - return prometheus.HistogramOpts{ - Namespace: ho.Namespace, - Subsystem: ho.Subsystem, - Name: ho.Name, - Help: ho.Help, - ConstLabels: ho.ConstLabels, - Buckets: ho.Buckets, - NativeHistogramBucketFactor: ho.NativeHistogramBucketFactor, - NativeHistogramZeroThreshold: ho.NativeHistogramZeroThreshold, - NativeHistogramMaxBucketNumber: ho.NativeHistogramMaxBucketNumber, - NativeHistogramMinResetDuration: ho.NativeHistogramMinResetDuration, - NativeHistogramMaxZeroThreshold: ho.NativeHistogramMaxZeroThreshold, - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/metrics/metric/metric.go b/vendor/github.com/cilium/cilium/pkg/metrics/metric/metric.go deleted file mode 100644 index 580e8ff32..000000000 --- a/vendor/github.com/cilium/cilium/pkg/metrics/metric/metric.go +++ /dev/null @@ -1,343 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package metric - -import ( - "fmt" - - "github.com/prometheus/client_golang/prometheus" - "github.com/sirupsen/logrus" - "golang.org/x/exp/maps" - - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/metrics/metric/collections" -) - -var logger = logrus.WithField(logfields.LogSubsys, "metric") - -// WithMetadata is the interface implemented by any metric defined in this package. These typically embed existing -// prometheus metric types and add additional metadata. In addition, these metrics have the concept of being enabled -// or disabled which is used in place of conditional registration so all metric types can always be registered. -type WithMetadata interface { - IsEnabled() bool - SetEnabled(bool) - Opts() Opts -} - -// metric is a "base" structure which can be embedded to provide common functionality. -type metric struct { - enabled bool - opts Opts - labels *labelSet -} - -// forEachLabelVector performs a product of all possible label value combinations -// and calls the provided function for each combination. -func (b *metric) forEachLabelVector(fn func(lvls []string)) { - if b.labels == nil { - return - } - var labelValues [][]string - for _, label := range b.labels.lbls { - labelValues = append(labelValues, maps.Keys(label.Values)) - } - for _, labelVector := range collections.CartesianProduct(labelValues...) { - fn(labelVector) - } -} - -// checkLabelValues checks that the provided label values are within the range -// of provided label values, if labels where defined using the Labels type. -// Violations are logged as errors for detection, but metrics should still -// be collected as is. -func (b *metric) checkLabelValues(lvs ...string) { - if b.labels == nil { - return - } - if err := b.labels.checkLabelValues(lvs); err != nil { - logger.WithError(err). - WithFields(logrus.Fields{ - "metric": b.opts.Name, - }). - Warning("metric label constraints violated, metric will still be collected") - } -} - -func (b *metric) checkLabels(labels prometheus.Labels) { - if b.labels == nil { - return - } - - if err := b.labels.checkLabels(labels); err != nil { - logger.WithError(err). - WithFields(logrus.Fields{ - "metric": b.opts.Name, - }). - Warning("metric label constraints violated, metric will still be collected") - } -} - -func (b *metric) IsEnabled() bool { - return b.enabled -} - -func (b *metric) SetEnabled(e bool) { - b.enabled = e -} - -func (b *metric) Opts() Opts { - return b.opts -} - -// Vec is a generic type to describe the vectorized version of another metric type, for example Vec[Counter] would be -// our version of a prometheus.CounterVec. -type Vec[T any] interface { - prometheus.Collector - WithMetadata - - // CurryWith returns a vector curried with the provided labels, i.e. the - // returned vector has those labels pre-set for all labeled operations performed - // on it. The cardinality of the curried vector is reduced accordingly. The - // order of the remaining labels stays the same (just with the curried labels - // taken out of the sequence – which is relevant for the - // (GetMetric)WithLabelValues methods). It is possible to curry a curried - // vector, but only with labels not yet used for currying before. - // - // The metrics contained in the `Vec[T]` are shared between the curried and - // uncurried vectors. They are just accessed differently. Curried and uncurried - // vectors behave identically in terms of collection. Only one must be - // registered with a given registry (usually the uncurried version). The Reset - // method deletes all metrics, even if called on a curried vector. - CurryWith(labels prometheus.Labels) (Vec[T], error) - - // GetMetricWith returns the `T` for the given Labels map (the label names - // must match those of the variable labels in Desc). If that label map is - // accessed for the first time, a new `T` is created. Implications of - // creating a `T` without using it and keeping the `T` for later use are - // the same as for GetMetricWithLabelValues. - // - // An error is returned if the number and names of the Labels are inconsistent - // with those of the variable labels in Desc (minus any curried labels). - // - // This method is used for the same purpose as - // GetMetricWithLabelValues(...string). See there for pros and cons of the two - // methods. - GetMetricWith(labels prometheus.Labels) (T, error) - - // GetMetricWithLabelValues returns the `T` for the given slice of label - // values (same order as the variable labels in Desc). If that combination of - // label values is accessed for the first time, a new `T` is created. - // - // It is possible to call this method without using the returned `T` to only - // create the new `T` but leave it at its starting value 0. - // - // Keeping the `T` for later use is possible (and should be considered if - // performance is critical), but keep in mind that Reset, DeleteLabelValues and - // Delete can be used to delete the `T` from the `Vec[T]`, assuming it also - // implements `DeletableVec[T]`. In that case, - // the `T` will still exist, but it will not be exported anymore, even if a - // `T` with the same label values is created later. - // - // An error is returned if the number of label values is not the same as the - // number of variable labels in Desc (minus any curried labels). - // - // Note that for more than one label value, this method is prone to mistakes - // caused by an incorrect order of arguments. Consider GetMetricWith(Labels) as - // an alternative to avoid that type of mistake. For higher label numbers, the - // latter has a much more readable (albeit more verbose) syntax, but it comes - // with a performance overhead (for creating and processing the Labels map). - GetMetricWithLabelValues(lvs ...string) (T, error) - - // With works as GetMetricWith, but panics where GetMetricWithLabels would have - // returned an error. Not returning an error allows shortcuts like - // - // myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Add(42) - With(labels prometheus.Labels) T - - // WithLabelValues works as GetMetricWithLabelValues, but panics where - // GetMetricWithLabelValues would have returned an error. Not returning an - // error allows shortcuts like - // - // myVec.WithLabelValues("404", "GET").Add(42) - WithLabelValues(lvs ...string) T -} - -// DeletableVec is a generic type to describe a vectorized version of another metric type, like Vec[T], but with the -// additional ability to remove labels without re-creating the metric. -type DeletableVec[T any] interface { - Vec[T] - - // Delete deletes the metric where the variable labels are the same as those - // passed in as labels. It returns true if a metric was deleted. - // - // It is not an error if the number and names of the Labels are inconsistent - // with those of the VariableLabels in Desc. However, such inconsistent Labels - // can never match an actual metric, so the method will always return false in - // that case. - // - // This method is used for the same purpose as DeleteLabelValues(...string). See - // there for pros and cons of the two methods. - Delete(labels prometheus.Labels) bool - - // DeleteLabelValues removes the metric where the variable labels are the same - // as those passed in as labels (same order as the VariableLabels in Desc). It - // returns true if a metric was deleted. - // - // It is not an error if the number of label values is not the same as the - // number of VariableLabels in Desc. However, such inconsistent label count can - // never match an actual metric, so the method will always return false in that - // case. - // - // Note that for more than one label value, this method is prone to mistakes - // caused by an incorrect order of arguments. Consider Delete(Labels) as an - // alternative to avoid that type of mistake. For higher label numbers, the - // latter has a much more readable (albeit more verbose) syntax, but it comes - // with a performance overhead (for creating and processing the Labels map). - // See also the CounterVec example. - DeleteLabelValues(lvs ...string) bool - - // DeletePartialMatch deletes all metrics where the variable labels contain all of those - // passed in as labels. The order of the labels does not matter. - // It returns the number of metrics deleted. - // - // Note that curried labels will never be matched if deleting from the curried vector. - // To match curried labels with DeletePartialMatch, it must be called on the base vector. - DeletePartialMatch(labels prometheus.Labels) int - - // Reset deletes all metrics in this vector. - Reset() -} - -// Opts are a modified and extended version of the prometheus.Opts -// https://pkg.go.dev/github.com/prometheus/client_golang/prometheus#Opts -type Opts struct { - // Namespace, Subsystem, and Name are components of the fully-qualified - // name of the Metric (created by joining these components with - // "_"). Only Name is mandatory, the others merely help structuring the - // name. Note that the fully-qualified name of the metric must be a - // valid Prometheus metric name. - Namespace string - Subsystem string - Name string - - // Help provides information about this metric. - // - // Metrics with the same fully-qualified name must have the same Help - // string. - Help string - - // ConstLabels are used to attach fixed labels to this metric. Metrics - // with the same fully-qualified name must have the same label names in - // their ConstLabels. - // - // ConstLabels are only used rarely. In particular, do not use them to - // attach the same labels to all your metrics. Those use cases are - // better covered by target labels set by the scraping Prometheus - // server, or by one specific metric (e.g. a build_info or a - // machine_role metric). See also - // https://prometheus.io/docs/instrumenting/writing_exporters/#target-labels-not-static-scraped-labels - ConstLabels prometheus.Labels - - // The name used to enable/disable this metric via the config/flags - ConfigName string - - // If true, the metric has to be explicitly enabled via config or flags - Disabled bool -} - -func (b Opts) GetConfigName() string { - if b.ConfigName == "" { - return prometheus.BuildFQName(b.Namespace, b.Subsystem, b.Name) - } - return b.ConfigName -} - -// Label represents a metric label with a pre-defined range of values. -// This is used with the NewxxxVecWithLabels metrics constructors to initialize -// vector metrics with known label value ranges, avoiding empty metrics. -type Label struct { - Name string - // If defined, only these values are allowed. - Values Values -} - -// Values is a distinct set of possible label values for a particular Label. -type Values map[string]struct{} - -// NewValues constructs a Values type from a set of strings. -func NewValues(vs ...string) Values { - vals := Values{} - for _, v := range vs { - vals[v] = struct{}{} - } - return vals -} - -// Labels is a slice of labels that represents a label set for a vector type -// metric. -type Labels []Label - -func (lbls Labels) labelNames() []string { - lns := make([]string, len(lbls)) - for i, label := range lbls { - lns[i] = label.Name - } - return lns -} - -type labelSet struct { - lbls Labels - m map[string]map[string]struct{} -} - -func (l *labelSet) namesToValues() map[string]map[string]struct{} { - if l.m != nil { - return l.m - } - l.m = make(map[string]map[string]struct{}) - for _, label := range l.lbls { - l.m[label.Name] = label.Values - } - return l.m -} - -func (l *labelSet) checkLabels(labels prometheus.Labels) error { - for name, value := range labels { - if lvs, ok := l.namesToValues()[name]; ok { - if _, ok := lvs[value]; !ok { - return fmt.Errorf("unexpected label vector value for label %q: value %q not defined in label range %v", - name, value, maps.Keys(lvs)) - } - } else { - return fmt.Errorf("invalid label name: %s", name) - } - } - return nil -} - -func (l *labelSet) checkLabelValues(lvs []string) error { - if len(l.lbls) != len(lvs) { - return fmt.Errorf("unexpected label vector length: expected %d, got %d", len(l.lbls), len(lvs)) - } - for i, label := range l.lbls { - if _, ok := label.Values[lvs[i]]; !ok { - return fmt.Errorf("unexpected label vector value for label %q: value %q not defined in label range %v", - label.Name, lvs[i], maps.Keys(label.Values)) - } - } - return nil -} - -// initLabels is a helper function to initialize the labels of a metric. -// It is used by xxxVecWithLabels metrics constructors to initialize the -// labels of the metric and the vector (i.e. registering all possible label value combinations). -func initLabels[T any](m *metric, labels Labels, vec Vec[T], disabled bool) { - if disabled { - return - } - m.labels = &labelSet{lbls: labels} - m.forEachLabelVector(func(vs []string) { - vec.WithLabelValues(vs...) - }) -} diff --git a/vendor/github.com/cilium/cilium/pkg/metrics/metrics.go b/vendor/github.com/cilium/cilium/pkg/metrics/metrics.go deleted file mode 100644 index 811989fbb..000000000 --- a/vendor/github.com/cilium/cilium/pkg/metrics/metrics.go +++ /dev/null @@ -1,1626 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Package metrics holds prometheus metrics objects and related utility functions. It -// does not abstract away the prometheus client but the caller rarely needs to -// refer to prometheus directly. -package metrics - -// Adding a metric -// - Add a metric object of the appropriate type as an exported variable -// - Register the new object in the init function - -import ( - "context" - - "github.com/prometheus/client_golang/prometheus" - dto "github.com/prometheus/client_model/go" - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/api/v1/models" - "github.com/cilium/cilium/pkg/metrics/metric" - "github.com/cilium/cilium/pkg/promise" - "github.com/cilium/cilium/pkg/source" - "github.com/cilium/cilium/pkg/time" - "github.com/cilium/cilium/pkg/version" -) - -const ( - // ErrorTimeout is the value used to notify timeout errors. - ErrorTimeout = "timeout" - - // ErrorProxy is the value used to notify errors on Proxy. - ErrorProxy = "proxy" - - // L7DNS is the value used to report DNS label on metrics - L7DNS = "dns" - - // SubsystemBPF is the subsystem to scope metrics related to the bpf syscalls. - SubsystemBPF = "bpf" - - // SubsystemDatapath is the subsystem to scope metrics related to management of - // the datapath. It is prepended to metric names and separated with a '_'. - SubsystemDatapath = "datapath" - - // SubsystemAgent is the subsystem to scope metrics related to the cilium agent itself. - SubsystemAgent = "agent" - - // SubsystemFQDN is the subsystem to scope metrics related to the FQDN proxy. - SubsystemIPCache = "ipcache" - - // SubsystemK8s is the subsystem to scope metrics related to Kubernetes - SubsystemK8s = "k8s" - - // SubsystemK8sClient is the subsystem to scope metrics related to the kubernetes client. - SubsystemK8sClient = "k8s_client" - - // SubsystemWorkQueue is the subsystem to scope metrics related to the workqueue. - SubsystemWorkQueue = "k8s_workqueue" - - // SubsystemKVStore is the subsystem to scope metrics related to the kvstore. - SubsystemKVStore = "kvstore" - - // SubsystemFQDN is the subsystem to scope metrics related to the FQDN proxy. - SubsystemFQDN = "fqdn" - - // SubsystemNodes is the subsystem to scope metrics related to the node manager. - SubsystemNodes = "nodes" - - // SubsystemTriggers is the subsystem to scope metrics related to the trigger package. - SubsystemTriggers = "triggers" - - // SubsystemAPILimiter is the subsystem to scope metrics related to the API limiter package. - SubsystemAPILimiter = "api_limiter" - - // CiliumAgentNamespace is used to scope metrics from the Cilium Agent - CiliumAgentNamespace = "cilium" - - // CiliumClusterMeshAPIServerNamespace is used to scope metrics from the - // Cilium Cluster Mesh API Server - CiliumClusterMeshAPIServerNamespace = "cilium_clustermesh_apiserver" - - // CiliumClusterMeshAPIServerNamespace is used to scope metrics from - // Cilium KVStoreMesh - CiliumKVStoreMeshNamespace = "cilium_kvstoremesh" - - // CiliumOperatorNamespace is used to scope metrics from the Cilium Operator - CiliumOperatorNamespace = "cilium_operator" - - // LabelError indicates the type of error (string) - LabelError = "error" - - // LabelOutcome indicates whether the outcome of the operation was successful or not - LabelOutcome = "outcome" - - // LabelAttempts is the number of attempts it took to complete the operation - LabelAttempts = "attempts" - - // Labels - - // LabelValueFalse is the string value for true metric label values. - LabelValueTrue = "true" - - // LabelValueFalse is the string value for false metric label values. - LabelValueFalse = "false" - - // LabelValueOutcomeSuccess is used as a successful outcome of an operation - LabelValueOutcomeSuccess = "success" - - // LabelValueOutcomeFail is used as an unsuccessful outcome of an operation - LabelValueOutcomeFail = "fail" - - // LabelValueOutcomeFailure is used as an unsuccessful outcome of an operation. - // NOTE: This should only be used for existing metrics, new metrics should use LabelValueOutcomeFail. - LabelValueOutcomeFailure = "failure" - - // LabelDropReason is used to describe reason for dropping a packets/bytes - LabelDropReason = "reason" - - // LabelEventSourceAPI marks event-related metrics that come from the API - LabelEventSourceAPI = "api" - - // LabelEventSourceK8s marks event-related metrics that come from k8s - LabelEventSourceK8s = "k8s" - - // LabelEventSourceFQDN marks event-related metrics that come from pkg/fqdn - LabelEventSourceFQDN = "fqdn" - - // LabelEventSourceContainerd marks event-related metrics that come from docker - LabelEventSourceContainerd = "docker" - - // LabelDatapathArea marks which area the metrics are related to (eg, which BPF map) - LabelDatapathArea = "area" - - // LabelDatapathName marks a unique identifier for this metric. - // The name should be defined once for a given type of error. - LabelDatapathName = "name" - - // LabelDatapathFamily marks which protocol family (IPv4, IPV6) the metric is related to. - LabelDatapathFamily = "family" - - // LabelProtocol marks the L4 protocol (TCP, ANY) for the metric. - LabelProtocol = "protocol" - - // LabelSignalType marks the signal name - LabelSignalType = "signal" - - // LabelSignalData marks the signal data - LabelSignalData = "data" - - // LabelStatus the label from completed task - LabelStatus = "status" - - // LabelPolicyEnforcement is the label used to see the enforcement status - LabelPolicyEnforcement = "enforcement" - - // LabelPolicySource is the label used to see the enforcement status - LabelPolicySource = "source" - - LabelSource = "source" - - // LabelScope is the label used to defined multiples scopes in the same - // metric. For example, one counter may measure a metric over the scope of - // the entire event (scope=global), or just part of an event - // (scope=slow_path) - LabelScope = "scope" - - // LabelProtocolL7 is the label used when working with layer 7 protocols. - LabelProtocolL7 = "protocol_l7" - - // LabelBuildState is the state a build queue entry is in - LabelBuildState = "state" - - // LabelBuildQueueName is the name of the build queue - LabelBuildQueueName = "name" - - // LabelAction is the label used to defined what kind of action was performed in a metric - LabelAction = "action" - - // LabelSubsystem is the label used to refer to any of the child process - // started by cilium (Envoy, monitor, etc..) - LabelSubsystem = "subsystem" - - // LabelKind is the kind of a label - LabelKind = "kind" - - // LabelEventSource is the source of a label for event metrics - // i.e. k8s, containerd, api. - LabelEventSource = "source" - - // LabelPath is the label for the API path - LabelPath = "path" - // LabelMethod is the label for the HTTP method - LabelMethod = "method" - - // LabelAPIReturnCode is the HTTP code returned for that API path - LabelAPIReturnCode = "return_code" - - // LabelOperation is the label for BPF maps operations - LabelOperation = "operation" - - // LabelMapName is the label for the BPF map name - LabelMapName = "map_name" - - LabelMapGroup = "map_group" - - // LabelVersion is the label for the version number - LabelVersion = "version" - - // LabelVersionRevision is the label for the version revision - LabelVersionRevision = "revision" - - // LabelArch is the label for the platform architecture (e.g. linux/amd64) - LabelArch = "arch" - - // LabelDirection is the label for traffic direction - LabelDirection = "direction" - - // LabelSourceCluster is the label for source cluster name - LabelSourceCluster = "source_cluster" - - // LabelSourceNodeName is the label for source node name - LabelSourceNodeName = "source_node_name" - - // LabelTargetCluster is the label for target cluster name - LabelTargetCluster = "target_cluster" - - // LabelTargetNodeIP is the label for target node IP - LabelTargetNodeIP = "target_node_ip" - - // LabelTargetNodeName is the label for target node name - LabelTargetNodeName = "target_node_name" - - // LabelTargetNodeType is the label for target node type (local_node, remote_intra_cluster, vs remote_inter_cluster) - LabelTargetNodeType = "target_node_type" - - LabelLocationLocalNode = "local_node" - LabelLocationRemoteIntraCluster = "remote_intra_cluster" - LabelLocationRemoteInterCluster = "remote_inter_cluster" - - // Rule label is a label for a L7 rule name. - LabelL7Rule = "rule" - - // LabelL7ProxyType is the label for denoting a L7 proxy type. - LabelL7ProxyType = "proxy_type" - - // LabelType is the label for type in general (e.g. endpoint, node) - LabelType = "type" - LabelPeerEndpoint = "endpoint" - LabelPeerNode = "node" - - LabelTrafficHTTP = "http" - LabelTrafficICMP = "icmp" - - LabelAddressType = "address_type" - LabelAddressTypePrimary = "primary" - LabelAddressTypeSecondary = "secondary" -) - -var ( - // LabelValuesBool is metric label value set for boolean type. - LabelValuesBool = metric.NewValues(LabelValueTrue, LabelValueFalse) - - // Namespace is used to scope metrics from cilium. It is prepended to metric - // names and separated with a '_' - Namespace = CiliumAgentNamespace - - registryResolver, registry = promise.New[*Registry]() - - BPFMapPressure = true - - // BootstrapTimes is the durations of cilium-agent bootstrap sequence. - BootstrapTimes = NoOpObserverVec - - // APIInteractions is the total time taken to process an API call made - // to the cilium-agent - APIInteractions = NoOpObserverVec - - // Status - - // NodeConnectivityStatus is the connectivity status between local node to - // other node intra or inter cluster. - NodeConnectivityStatus = NoOpGaugeDeletableVec - - // NodeConnectivityLatency is the connectivity latency between local node to - // other node intra or inter cluster. - NodeConnectivityLatency = NoOpGaugeDeletableVec - - // Endpoint - - // Endpoint is a function used to collect this metric. - // It must be thread-safe. - Endpoint metric.GaugeFunc - - // EndpointMaxIfindex is the maximum observed interface index for existing endpoints - EndpointMaxIfindex = NoOpGauge - - // EndpointRegenerationTotal is a count of the number of times any endpoint - // has been regenerated and success/fail outcome - EndpointRegenerationTotal = NoOpCounterVec - - // EndpointStateCount is the total count of the endpoints in various states. - EndpointStateCount = NoOpGaugeVec - - // EndpointRegenerationTimeStats is the total time taken to regenerate - // endpoints, labeled by span name and status ("success" or "failure") - EndpointRegenerationTimeStats = NoOpObserverVec - - // EndpointPropagationDelay is the delay between creation of local CiliumEndpoint - // and update for that CiliumEndpoint received through CiliumEndpointSlice. - // Measure of local CEP roundtrip time with CiliumEndpointSlice feature enabled. - EndpointPropagationDelay = NoOpObserverVec - - // Policy - // Policy is the number of policies loaded into the agent - Policy = NoOpGauge - - // PolicyRegenerationCount is the total number of successful policy - // regenerations. - PolicyRegenerationCount = NoOpCounter - - // PolicyRegenerationTimeStats is the total time taken to generate policies - PolicyRegenerationTimeStats = NoOpObserverVec - - // PolicyRevision is the current policy revision number for this agent - PolicyRevision = NoOpGauge - - // PolicyChangeTotal is a count of policy changes by outcome ("success" or - // "failure") - PolicyChangeTotal = NoOpCounterVec - - // PolicyEndpointStatus is the number of endpoints with policy labeled by enforcement type - PolicyEndpointStatus = NoOpGaugeVec - - // PolicyImplementationDelay is a distribution of times taken from adding a - // policy (and incrementing the policy revision) to seeing it in the datapath - // per Endpoint. This reflects the actual delay perceived by traffic flowing - // through the datapath. The longest times will roughly correlate with the - // time taken to fully deploy an endpoint. - PolicyImplementationDelay = NoOpObserverVec - - // CIDRGroup - - // CIDRGroupsReferenced is the number of CNPs and CCNPs referencing at least one CiliumCIDRGroup. - // CNPs with empty or non-existing CIDRGroupRefs are not considered. - CIDRGroupsReferenced = NoOpGauge - - // CIDRGroupTranslationTimeStats is the time taken to translate the policy field `FromCIDRGroupRef` - // after the referenced CIDRGroups have been updated or deleted. - CIDRGroupTranslationTimeStats = NoOpHistogram - - // Identity - - // Identity is the number of identities currently in use on the node by type - Identity = NoOpGaugeVec - - // Events - - // EventTS is the time in seconds since epoch that we last received an - // event that was handled by Cilium. This metric tracks the source of the - // event which can be one of K8s or Cilium's API. - EventTS = NoOpGaugeVec - - // EventLagK8s is the lag calculation for k8s Pod events. - EventLagK8s = NoOpGauge - - // L7 statistics - - // ProxyRedirects is the number of redirects labeled by protocol - ProxyRedirects = NoOpGaugeVec - - // ProxyPolicyL7Total is a count of all l7 requests handled by proxy - ProxyPolicyL7Total = NoOpCounterVec - - // ProxyUpstreamTime is how long the upstream server took to reply labeled - // by error, protocol and span time - ProxyUpstreamTime = NoOpObserverVec - - // ProxyDatapathUpdateTimeout is a count of all the timeouts encountered while - // updating the datapath due to an FQDN IP update - ProxyDatapathUpdateTimeout = NoOpCounter - - // L3-L4 statistics - - // Datapath statistics - - // ConntrackGCRuns is the number of times that the conntrack GC - // process was run. - ConntrackGCRuns = NoOpCounterVec - - // ConntrackGCKeyFallbacks number of times that the conntrack key fallback was invalid. - ConntrackGCKeyFallbacks = NoOpCounterVec - - // ConntrackGCSize the number of entries in the conntrack table - ConntrackGCSize = NoOpGaugeVec - - // NatGCSize the number of entries in the nat table - NatGCSize = NoOpGaugeVec - - // ConntrackGCDuration the duration of the conntrack GC process in milliseconds. - ConntrackGCDuration = NoOpObserverVec - - // ConntrackDumpReset marks the count for conntrack dump resets - ConntrackDumpResets = NoOpCounterVec - - // Signals - - // SignalsHandled is the number of signals received. - SignalsHandled = NoOpCounterVec - - // Services - - // ServicesEventsCount counts the number of services - ServicesEventsCount = NoOpCounterVec - - // ServiceImplementationDelay the execution duration of the service handler in milliseconds. - // The metric reflects the time it took to program the service excluding the event queue latency. - ServiceImplementationDelay = NoOpObserverVec - - // Errors and warnings - - // ErrorsWarnings is the number of errors and warnings in cilium-agent instances - ErrorsWarnings = NoOpCounterVec - - // ControllerRuns is the number of times that a controller process runs. - ControllerRuns = NoOpCounterVec - - // ControllerRunsDuration the duration of the controller process in seconds - ControllerRunsDuration = NoOpObserverVec - - // subprocess, labeled by Subsystem - SubprocessStart = NoOpCounterVec - - // Kubernetes Events - - // KubernetesEventProcessed is the number of Kubernetes events - // processed labeled by scope, action and execution result - KubernetesEventProcessed = NoOpCounterVec - - // KubernetesEventReceived is the number of Kubernetes events received - // labeled by scope, action, valid data and equalness. - KubernetesEventReceived = NoOpCounterVec - - // Kubernetes interactions - - // KubernetesAPIInteractions is the total time taken to process an API call made - // to the kube-apiserver - KubernetesAPIInteractions = NoOpObserverVec - - // KubernetesAPIRateLimiterLatency is the client side rate limiter latency metric - KubernetesAPIRateLimiterLatency = NoOpObserverVec - - // KubernetesAPICallsTotal is the counter for all API calls made to - // kube-apiserver. - KubernetesAPICallsTotal = NoOpCounterVec - - // KubernetesCNPStatusCompletion is the number of seconds it takes to - // complete a CNP status update - KubernetesCNPStatusCompletion = NoOpObserverVec - - // TerminatingEndpointsEvents is the number of terminating endpoint events received from kubernetes. - TerminatingEndpointsEvents = NoOpCounter - - // IPAM events - - // IPAMEvent is the number of IPAM events received labeled by action and - // datapath family type - IPAMEvent = NoOpCounterVec - - // IPAMCapacity tracks the total number of IPs that could be allocated. To - // get the current number of available IPs, it would be this metric - // subtracted by IPAMEvent{allocated}. - IPAMCapacity = NoOpGaugeVec - - // KVstore events - - // KVStoreOperationsDuration records the duration of kvstore operations - KVStoreOperationsDuration = NoOpObserverVec - - // KVStoreEventsQueueDuration records the duration in seconds of time - // received event was blocked before it could be queued - KVStoreEventsQueueDuration = NoOpObserverVec - - // KVStoreQuorumErrors records the number of kvstore quorum errors - KVStoreQuorumErrors = NoOpCounterVec - - // FQDNGarbageCollectorCleanedTotal is the number of domains cleaned by the - // GC job. - FQDNGarbageCollectorCleanedTotal = NoOpCounter - - // FQDNActiveNames is the number of domains inside the DNS cache that have - // not expired (by TTL), per endpoint. - FQDNActiveNames = NoOpGaugeVec - - // FQDNActiveIPs is the number of IPs inside the DNS cache associated with - // a domain that has not expired (by TTL) and are currently active, per - // endpoint. - FQDNActiveIPs = NoOpGaugeVec - - // FQDNAliveZombieConnections is the number IPs associated with domains - // that have expired (by TTL) yet still associated with an active - // connection (aka zombie), per endpoint. - FQDNAliveZombieConnections = NoOpGaugeVec - - // FQDNSemaphoreRejectedTotal is the total number of DNS requests rejected - // by the DNS proxy because too many requests were in flight, as enforced by - // the admission semaphore. - FQDNSemaphoreRejectedTotal = NoOpCounter - - // IPCacheErrorsTotal is the total number of IPCache events handled in - // the IPCache subsystem that resulted in errors. - IPCacheErrorsTotal = NoOpCounterVec - - // IPCacheEventsTotal is the total number of IPCache events handled in - // the IPCache subsystem. - IPCacheEventsTotal = NoOpCounterVec - - // BPFSyscallDuration is the metric for bpf syscalls duration. - BPFSyscallDuration = NoOpObserverVec - - // BPFMapOps is the metric to measure the number of operations done to a - // bpf map. - BPFMapOps = NoOpCounterVec - - // BPFMapCapacity is the max capacity of bpf maps, labelled by map group classification. - BPFMapCapacity = NoOpGaugeVec - - // TriggerPolicyUpdateTotal is the metric to count total number of - // policy update triggers - TriggerPolicyUpdateTotal = NoOpCounterVec - - // TriggerPolicyUpdateFolds is the current level folding that is - // happening when running policy update triggers - TriggerPolicyUpdateFolds = NoOpGauge - - // TriggerPolicyUpdateCallDuration measures the latency and call - // duration of policy update triggers - TriggerPolicyUpdateCallDuration = NoOpObserverVec - - // VersionMetric labelled by Cilium version - VersionMetric = NoOpGaugeVec - - // APILimiterWaitHistoryDuration is a histogram that measures the - // individual wait durations of API limiters - APILimiterWaitHistoryDuration = NoOpObserverVec - - // APILimiterWaitDuration is the gauge of the current mean, min, and - // max wait duration - APILimiterWaitDuration = NoOpGaugeVec - - // APILimiterProcessingDuration is the gauge of the mean and estimated - // processing duration - APILimiterProcessingDuration = NoOpGaugeVec - - // APILimiterRequestsInFlight is the gauge of the current and max - // requests in flight - APILimiterRequestsInFlight = NoOpGaugeVec - - // APILimiterRateLimit is the gauge of the current rate limiting - // configuration including limit and burst - APILimiterRateLimit = NoOpGaugeVec - - // APILimiterAdjustmentFactor is the gauge representing the latest - // adjustment factor that was applied - APILimiterAdjustmentFactor = NoOpGaugeVec - - // APILimiterProcessedRequests is the counter of the number of - // processed (successful and failed) requests - APILimiterProcessedRequests = NoOpCounterVec - - // WorkQueueDepth is the depth of the workqueue - // - // We set actual metrics here instead of NoOp for the workqueue metrics - // because these metrics will be registered with workqueue.SetProvider - // by init function in watcher.go. Otherwise, we will register NoOps. - // - WorkQueueDepth = metric.NewGaugeVec(metric.GaugeOpts{ - ConfigName: Namespace + "_" + SubsystemWorkQueue + "_depth", - Namespace: Namespace, - Subsystem: SubsystemWorkQueue, - Name: "depth", - Help: "Current depth of workqueue.", - }, []string{"name"}) - - // WorkQueueAddsTotal is the total number of adds to the workqueue - WorkQueueAddsTotal = metric.NewCounterVec(metric.CounterOpts{ - ConfigName: Namespace + "_" + SubsystemWorkQueue + "_adds_total", - Namespace: Namespace, - Subsystem: SubsystemWorkQueue, - Name: "adds_total", - Help: "Total number of adds handled by workqueue.", - }, []string{"name"}) - - // WorkQueueLatency is the latency of how long an item stays in the workqueue - WorkQueueLatency = metric.NewHistogramVec(metric.HistogramOpts{ - ConfigName: Namespace + "_" + SubsystemWorkQueue + "_queue_duration_seconds", - Namespace: Namespace, - Subsystem: SubsystemWorkQueue, - Name: "queue_duration_seconds", - Help: "How long in seconds an item stays in workqueue before being requested.", - Buckets: prometheus.ExponentialBuckets(10e-9, 10, 10), - }, []string{"name"}) - - // WorkQueueDuration is the duration of how long processing an item for the workqueue - WorkQueueDuration = metric.NewHistogramVec(metric.HistogramOpts{ - ConfigName: Namespace + "_" + SubsystemWorkQueue + "_work_duration_seconds", - Namespace: Namespace, - Subsystem: SubsystemWorkQueue, - Name: "work_duration_seconds", - Help: "How long in seconds processing an item from workqueue takes.", - Buckets: prometheus.ExponentialBuckets(10e-9, 10, 10), - }, []string{"name"}) - - // WorkQueueUnfinishedWork is how many seconds of work has been done that is in progress - WorkQueueUnfinishedWork = metric.NewGaugeVec(metric.GaugeOpts{ - ConfigName: Namespace + "_" + SubsystemWorkQueue + "_unfinished_work_seconds", - Namespace: Namespace, - Subsystem: SubsystemWorkQueue, - Name: "unfinished_work_seconds", - Help: "How many seconds of work has been done that " + - "is in progress and hasn't been observed by work_duration. Large " + - "values indicate stuck threads. One can deduce the number of stuck " + - "threads by observing the rate at which this increases.", - }, []string{"name"}) - - // WorkQueueLongestRunningProcessor is the longest running processor in the workqueue - WorkQueueLongestRunningProcessor = metric.NewGaugeVec(metric.GaugeOpts{ - ConfigName: Namespace + "_" + SubsystemWorkQueue + "_longest_running_processor_seconds", - Namespace: Namespace, - Subsystem: SubsystemWorkQueue, - Name: "longest_running_processor_seconds", - Help: "How many seconds has the longest running " + - "processor for workqueue been running.", - }, []string{"name"}) - - // WorkQueueRetries is the number of retries for handled by the workqueue - WorkQueueRetries = metric.NewCounterVec(metric.CounterOpts{ - ConfigName: Namespace + "_" + SubsystemWorkQueue + "_retries_total", - Namespace: Namespace, - Subsystem: SubsystemWorkQueue, - Name: "retries_total", - Help: "Total number of retries handled by workqueue.", - }, []string{"name"}) -) - -type LegacyMetrics struct { - BootstrapTimes metric.Vec[metric.Observer] - APIInteractions metric.Vec[metric.Observer] - NodeConnectivityStatus metric.DeletableVec[metric.Gauge] - NodeConnectivityLatency metric.DeletableVec[metric.Gauge] - Endpoint metric.GaugeFunc - EndpointMaxIfindex metric.Gauge - EndpointRegenerationTotal metric.Vec[metric.Counter] - EndpointStateCount metric.Vec[metric.Gauge] - EndpointRegenerationTimeStats metric.Vec[metric.Observer] - EndpointPropagationDelay metric.Vec[metric.Observer] - Policy metric.Gauge - PolicyRegenerationCount metric.Counter - PolicyRegenerationTimeStats metric.Vec[metric.Observer] - PolicyRevision metric.Gauge - PolicyChangeTotal metric.Vec[metric.Counter] - PolicyEndpointStatus metric.Vec[metric.Gauge] - PolicyImplementationDelay metric.Vec[metric.Observer] - CIDRGroupsReferenced metric.Gauge - CIDRGroupTranslationTimeStats metric.Histogram - Identity metric.Vec[metric.Gauge] - EventTS metric.Vec[metric.Gauge] - EventLagK8s metric.Gauge - ProxyRedirects metric.Vec[metric.Gauge] - ProxyPolicyL7Total metric.Vec[metric.Counter] - ProxyUpstreamTime metric.Vec[metric.Observer] - ProxyDatapathUpdateTimeout metric.Counter - ConntrackGCRuns metric.Vec[metric.Counter] - ConntrackGCKeyFallbacks metric.Vec[metric.Counter] - ConntrackGCSize metric.Vec[metric.Gauge] - NatGCSize metric.Vec[metric.Gauge] - ConntrackGCDuration metric.Vec[metric.Observer] - ConntrackDumpResets metric.Vec[metric.Counter] - SignalsHandled metric.Vec[metric.Counter] - ServicesEventsCount metric.Vec[metric.Counter] - ServiceImplementationDelay metric.Vec[metric.Observer] - ErrorsWarnings metric.Vec[metric.Counter] - ControllerRuns metric.Vec[metric.Counter] - ControllerRunsDuration metric.Vec[metric.Observer] - SubprocessStart metric.Vec[metric.Counter] - KubernetesEventProcessed metric.Vec[metric.Counter] - KubernetesEventReceived metric.Vec[metric.Counter] - KubernetesAPIInteractions metric.Vec[metric.Observer] - KubernetesAPIRateLimiterLatency metric.Vec[metric.Observer] - KubernetesAPICallsTotal metric.Vec[metric.Counter] - KubernetesCNPStatusCompletion metric.Vec[metric.Observer] - TerminatingEndpointsEvents metric.Counter - IPAMEvent metric.Vec[metric.Counter] - IPAMCapacity metric.Vec[metric.Gauge] - KVStoreOperationsDuration metric.Vec[metric.Observer] - KVStoreEventsQueueDuration metric.Vec[metric.Observer] - KVStoreQuorumErrors metric.Vec[metric.Counter] - FQDNGarbageCollectorCleanedTotal metric.Counter - FQDNActiveNames metric.Vec[metric.Gauge] - FQDNActiveIPs metric.Vec[metric.Gauge] - FQDNAliveZombieConnections metric.Vec[metric.Gauge] - FQDNSemaphoreRejectedTotal metric.Counter - IPCacheErrorsTotal metric.Vec[metric.Counter] - IPCacheEventsTotal metric.Vec[metric.Counter] - BPFSyscallDuration metric.Vec[metric.Observer] - BPFMapOps metric.Vec[metric.Counter] - BPFMapCapacity metric.Vec[metric.Gauge] - TriggerPolicyUpdateTotal metric.Vec[metric.Counter] - TriggerPolicyUpdateFolds metric.Gauge - TriggerPolicyUpdateCallDuration metric.Vec[metric.Observer] - VersionMetric metric.Vec[metric.Gauge] - APILimiterWaitHistoryDuration metric.Vec[metric.Observer] - APILimiterWaitDuration metric.Vec[metric.Gauge] - APILimiterProcessingDuration metric.Vec[metric.Gauge] - APILimiterRequestsInFlight metric.Vec[metric.Gauge] - APILimiterRateLimit metric.Vec[metric.Gauge] - APILimiterAdjustmentFactor metric.Vec[metric.Gauge] - APILimiterProcessedRequests metric.Vec[metric.Counter] - WorkQueueDepth metric.Vec[metric.Gauge] - WorkQueueAddsTotal metric.Vec[metric.Counter] - WorkQueueLatency metric.Vec[metric.Observer] - WorkQueueDuration metric.Vec[metric.Observer] - WorkQueueUnfinishedWork metric.Vec[metric.Gauge] - WorkQueueLongestRunningProcessor metric.Vec[metric.Gauge] - WorkQueueRetries metric.Vec[metric.Counter] -} - -func NewLegacyMetrics() *LegacyMetrics { - lm := &LegacyMetrics{ - BootstrapTimes: metric.NewHistogramVec(metric.HistogramOpts{ - ConfigName: Namespace + "_" + SubsystemAgent + "_bootstrap_seconds", - Namespace: Namespace, - Subsystem: SubsystemAgent, - Name: "bootstrap_seconds", - Help: "Duration of bootstrap sequence", - }, []string{LabelScope, LabelOutcome}), - - APIInteractions: metric.NewHistogramVec(metric.HistogramOpts{ - ConfigName: Namespace + "_" + SubsystemAgent + "_api_process_time_seconds", - - Namespace: Namespace, - Subsystem: SubsystemAgent, - Name: "api_process_time_seconds", - Help: "Duration of processed API calls labeled by path, method and return code.", - }, []string{LabelPath, LabelMethod, LabelAPIReturnCode}), - - EndpointRegenerationTotal: metric.NewCounterVecWithLabels(metric.CounterOpts{ - ConfigName: Namespace + "_endpoint_regenerations_total", - - Namespace: Namespace, - Name: "endpoint_regenerations_total", - Help: "Count of all endpoint regenerations that have completed, tagged by outcome", - }, metric.Labels{ - { - Name: LabelOutcome, - Values: metric.NewValues(LabelValueOutcomeSuccess, LabelValueOutcomeFailure), - }, - }), - - EndpointStateCount: metric.NewGaugeVec(metric.GaugeOpts{ - ConfigName: Namespace + "_endpoint_state", - Namespace: Namespace, - Name: "endpoint_state", - Help: "Count of all endpoints, tagged by different endpoint states", - }, - []string{"endpoint_state"}, - ), - - EndpointRegenerationTimeStats: metric.NewHistogramVec(metric.HistogramOpts{ - ConfigName: Namespace + "_endpoint_regeneration_time_stats_seconds", - - Namespace: Namespace, - Name: "endpoint_regeneration_time_stats_seconds", - Help: "Endpoint regeneration time stats labeled by the scope", - }, []string{LabelScope, LabelStatus}), - - Policy: metric.NewGauge(metric.GaugeOpts{ - ConfigName: Namespace + "_policy", - Namespace: Namespace, - Name: "policy", - Help: "Number of policies currently loaded", - }), - - PolicyRegenerationCount: metric.NewCounter(metric.CounterOpts{ - ConfigName: Namespace + "_policy_regeneration_total", - Namespace: Namespace, - Name: "policy_regeneration_total", - Help: "Total number of successful policy regenerations", - }), - - PolicyRegenerationTimeStats: metric.NewHistogramVec(metric.HistogramOpts{ - ConfigName: Namespace + "_policy_regeneration_time_stats_seconds", - Namespace: Namespace, - Name: "policy_regeneration_time_stats_seconds", - Help: "Policy regeneration time stats labeled by the scope", - }, []string{LabelScope, LabelStatus}), - - PolicyRevision: metric.NewGauge(metric.GaugeOpts{ - ConfigName: Namespace + "_policy_max_revision", - Namespace: Namespace, - Name: "policy_max_revision", - Help: "Highest policy revision number in the agent", - }), - - PolicyChangeTotal: metric.NewCounterVecWithLabels(metric.CounterOpts{ - ConfigName: Namespace + "_policy_change_total", - - Namespace: Namespace, - Name: "policy_change_total", - Help: "Number of policy changes by outcome", - }, metric.Labels{ - { - Name: LabelOutcome, - Values: metric.NewValues(LabelValueOutcomeSuccess, LabelValueOutcomeFailure), - }, - }), - - PolicyEndpointStatus: metric.NewGaugeVec(metric.GaugeOpts{ - ConfigName: Namespace + "_policy_endpoint_enforcement_status", - - Namespace: Namespace, - Name: "policy_endpoint_enforcement_status", - Help: "Number of endpoints labeled by policy enforcement status", - }, []string{LabelPolicyEnforcement}), - - PolicyImplementationDelay: metric.NewHistogramVecWithLabels(metric.HistogramOpts{ - ConfigName: Namespace + "_policy_implementation_delay", - - Namespace: Namespace, - Name: "policy_implementation_delay", - Help: "Time between a policy change and it being fully deployed into the datapath", - }, metric.Labels{ - { - Name: LabelPolicySource, - Values: metric.NewValues(string(source.Kubernetes), string(source.CustomResource), string(source.LocalAPI)), - }, - }), - - CIDRGroupsReferenced: metric.NewGauge(metric.GaugeOpts{ - ConfigName: Namespace + "cidrgroups_referenced", - - Namespace: Namespace, - Name: "cidrgroups_referenced", - Help: "Number of CNPs and CCNPs referencing at least one CiliumCIDRGroup. CNPs with empty or non-existing CIDRGroupRefs are not considered", - }), - - CIDRGroupTranslationTimeStats: metric.NewHistogram(metric.HistogramOpts{ - ConfigName: Namespace + "cidrgroup_translation_time_stats_seconds", - Disabled: true, - - Namespace: Namespace, - Name: "cidrgroup_translation_time_stats_seconds", - Help: "CIDRGroup translation time stats", - }), - - Identity: metric.NewGaugeVec(metric.GaugeOpts{ - ConfigName: Namespace + "_identity", - - Namespace: Namespace, - Name: "identity", - Help: "Number of identities currently allocated", - }, []string{LabelType}), - - EventTS: metric.NewGaugeVec(metric.GaugeOpts{ - ConfigName: Namespace + "_event_ts", - Namespace: Namespace, - Name: "event_ts", - Help: "Last timestamp when Cilium received an event from a control plane source, per resource and per action", - }, []string{LabelEventSource, LabelScope, LabelAction}), - - EventLagK8s: metric.NewGauge(metric.GaugeOpts{ - ConfigName: Namespace + "_k8s_event_lag_seconds", - Disabled: true, - Namespace: Namespace, - Name: "k8s_event_lag_seconds", - Help: "Lag for Kubernetes events - computed value between receiving a CNI ADD event from kubelet and a Pod event received from kube-api-server", - ConstLabels: prometheus.Labels{"source": LabelEventSourceK8s}, - }), - - ProxyRedirects: metric.NewGaugeVec(metric.GaugeOpts{ - ConfigName: Namespace + "_proxy_redirects", - - Namespace: Namespace, - Name: "proxy_redirects", - Help: "Number of redirects installed for endpoints, labeled by protocol", - }, []string{LabelProtocolL7}), - - ProxyPolicyL7Total: metric.NewCounterVecWithLabels(metric.CounterOpts{ - ConfigName: Namespace + "_policy_l7_total", - Namespace: Namespace, - Name: "policy_l7_total", - Help: "Number of total proxy requests handled", - }, metric.Labels{ - { - Name: LabelL7Rule, - Values: metric.NewValues("received", "forwarded", "denied", "parse_errors"), - }, - { - Name: LabelL7ProxyType, - Values: metric.NewValues("fqdn", "envoy"), - }, - }), - - ProxyUpstreamTime: metric.NewHistogramVec(metric.HistogramOpts{ - ConfigName: Namespace + "_proxy_upstream_reply_seconds", - Namespace: Namespace, - Name: "proxy_upstream_reply_seconds", - Help: "Seconds waited to get a reply from a upstream server", - }, []string{"error", LabelProtocolL7, LabelScope}), - - ProxyDatapathUpdateTimeout: metric.NewCounter(metric.CounterOpts{ - ConfigName: Namespace + "_proxy_datapath_update_timeout_total", - Disabled: true, - - Namespace: Namespace, - Name: "proxy_datapath_update_timeout_total", - Help: "Number of total datapath update timeouts due to FQDN IP updates", - }), - - ConntrackGCRuns: metric.NewCounterVec(metric.CounterOpts{ - ConfigName: Namespace + "_" + SubsystemDatapath + "_conntrack_gc_runs_total", - Namespace: Namespace, - Subsystem: SubsystemDatapath, - Name: "conntrack_gc_runs_total", - Help: "Number of times that the conntrack garbage collector process was run " + - "labeled by completion status", - }, []string{LabelDatapathFamily, LabelProtocol, LabelStatus}), - - ConntrackGCKeyFallbacks: metric.NewCounterVec(metric.CounterOpts{ - ConfigName: Namespace + "_" + SubsystemDatapath + "_conntrack_gc_key_fallbacks_total", - Namespace: Namespace, - Subsystem: SubsystemDatapath, - Name: "conntrack_gc_key_fallbacks_total", - Help: "Number of times a key fallback was needed when iterating over the BPF map", - }, []string{LabelDatapathFamily, LabelProtocol}), - - ConntrackGCSize: metric.NewGaugeVec(metric.GaugeOpts{ - ConfigName: Namespace + "_" + SubsystemDatapath + "_conntrack_gc_entries", - Namespace: Namespace, - Subsystem: SubsystemDatapath, - Name: "conntrack_gc_entries", - Help: "The number of alive and deleted conntrack entries at the end " + - "of a garbage collector run labeled by datapath family.", - }, []string{LabelDatapathFamily, LabelProtocol, LabelStatus}), - - NatGCSize: metric.NewGaugeVec(metric.GaugeOpts{ - ConfigName: Namespace + "_" + SubsystemDatapath + "_nat_gc_entries", - Disabled: true, - Namespace: Namespace, - Subsystem: SubsystemDatapath, - Name: "nat_gc_entries", - Help: "The number of alive and deleted nat entries at the end " + - "of a garbage collector run labeled by datapath family.", - }, []string{LabelDatapathFamily, LabelDirection, LabelStatus}), - - ConntrackGCDuration: metric.NewHistogramVec(metric.HistogramOpts{ - ConfigName: Namespace + "_" + SubsystemDatapath + "_conntrack_gc_duration_seconds", - Namespace: Namespace, - Subsystem: SubsystemDatapath, - Name: "conntrack_gc_duration_seconds", - Help: "Duration in seconds of the garbage collector process " + - "labeled by datapath family and completion status", - }, []string{LabelDatapathFamily, LabelProtocol, LabelStatus}), - - ConntrackDumpResets: metric.NewCounterVec(metric.CounterOpts{ - ConfigName: Namespace + "_" + SubsystemDatapath + "_conntrack_dump_resets_total", - Namespace: Namespace, - Subsystem: SubsystemDatapath, - Name: "conntrack_dump_resets_total", - Help: "Number of conntrack dump resets. Happens when a BPF entry gets removed while dumping the map is in progress", - }, []string{LabelDatapathArea, LabelDatapathName, LabelDatapathFamily}), - - SignalsHandled: metric.NewCounterVec(metric.CounterOpts{ - ConfigName: Namespace + "_" + SubsystemDatapath + "_signals_handled_total", - - Namespace: Namespace, - Subsystem: SubsystemDatapath, - Name: "signals_handled_total", - Help: "Number of times that the datapath signal handler process was run " + - "labeled by signal type, data and completion status", - }, []string{LabelSignalType, LabelSignalData, LabelStatus}), - - ServicesEventsCount: metric.NewCounterVec(metric.CounterOpts{ - ConfigName: Namespace + "_services_events_total", - Namespace: Namespace, - Name: "services_events_total", - Help: "Number of services events labeled by action type", - }, []string{LabelAction}), - - ServiceImplementationDelay: metric.NewHistogramVec(metric.HistogramOpts{ - ConfigName: Namespace + "_service_implementation_delay", - Namespace: Namespace, - Name: "service_implementation_delay", - Help: "Duration in seconds to propagate the data plane programming of a service, its network and endpoints " + - "from the time the service or the service pod was changed excluding the event queue latency", - }, []string{LabelAction}), - - ErrorsWarnings: newErrorsWarningsMetric(), - - ControllerRuns: metric.NewCounterVec(metric.CounterOpts{ - ConfigName: Namespace + "_controllers_runs_total", - Namespace: Namespace, - Name: "controllers_runs_total", - Help: "Number of times that a controller process was run labeled by completion status", - }, []string{LabelStatus}), - - ControllerRunsDuration: metric.NewHistogramVec(metric.HistogramOpts{ - ConfigName: Namespace + "_controllers_runs_duration_seconds", - Namespace: Namespace, - Name: "controllers_runs_duration_seconds", - Help: "Duration in seconds of the controller process labeled by completion status", - }, []string{LabelStatus}), - - SubprocessStart: metric.NewCounterVec(metric.CounterOpts{ - ConfigName: Namespace + "_subprocess_start_total", - Namespace: Namespace, - Name: "subprocess_start_total", - Help: "Number of times that Cilium has started a subprocess, labeled by subsystem", - }, []string{LabelSubsystem}), - - KubernetesEventProcessed: metric.NewCounterVec(metric.CounterOpts{ - ConfigName: Namespace + "_kubernetes_events_total", - Namespace: Namespace, - Name: "kubernetes_events_total", - Help: "Number of Kubernetes events processed labeled by scope, action and execution result", - }, []string{LabelScope, LabelAction, LabelStatus}), - - KubernetesEventReceived: metric.NewCounterVec(metric.CounterOpts{ - ConfigName: Namespace + "_kubernetes_events_received_total", - Namespace: Namespace, - Name: "kubernetes_events_received_total", - Help: "Number of Kubernetes events received labeled by scope, action, valid data and equalness", - }, []string{LabelScope, LabelAction, "valid", "equal"}), - - KubernetesAPIInteractions: metric.NewHistogramVec(metric.HistogramOpts{ - ConfigName: Namespace + "_" + SubsystemK8sClient + "_api_latency_time_seconds", - Namespace: Namespace, - Subsystem: SubsystemK8sClient, - Name: "api_latency_time_seconds", - Help: "Duration of processed API calls labeled by path and method.", - }, []string{LabelPath, LabelMethod}), - - KubernetesAPIRateLimiterLatency: metric.NewHistogramVec(metric.HistogramOpts{ - ConfigName: Namespace + "_" + SubsystemK8sClient + "_rate_limiter_duration_seconds", - Namespace: Namespace, - Subsystem: SubsystemK8sClient, - Name: "rate_limiter_duration_seconds", - Help: "Kubernetes client rate limiter latency in seconds. Broken down by path and method.", - Buckets: []float64{0.005, 0.025, 0.1, 0.25, 0.5, 1.0, 2.0, 4.0, 8.0, 15.0, 30.0, 60.0}, - }, []string{LabelPath, LabelMethod}), - - KubernetesAPICallsTotal: metric.NewCounterVec(metric.CounterOpts{ - ConfigName: Namespace + "_" + SubsystemK8sClient + "_api_calls_total", - Namespace: Namespace, - Subsystem: SubsystemK8sClient, - Name: "api_calls_total", - Help: "Number of API calls made to kube-apiserver labeled by host, method and return code.", - }, []string{"host", LabelMethod, LabelAPIReturnCode}), - - KubernetesCNPStatusCompletion: metric.NewHistogramVec(metric.HistogramOpts{ - ConfigName: Namespace + "_" + SubsystemK8s + "_cnp_status_completion_seconds", - Namespace: Namespace, - Subsystem: SubsystemK8s, - Name: "cnp_status_completion_seconds", - Help: "Duration in seconds in how long it took to complete a CNP status update", - }, []string{LabelAttempts, LabelOutcome}), - - TerminatingEndpointsEvents: metric.NewCounter(metric.CounterOpts{ - ConfigName: Namespace + "_" + SubsystemK8s + "_terminating_endpoints_events_total", - Namespace: Namespace, - Subsystem: SubsystemK8s, - Name: "terminating_endpoints_events_total", - Help: "Number of terminating endpoint events received from Kubernetes", - }), - - IPAMEvent: metric.NewCounterVec(metric.CounterOpts{ - ConfigName: Namespace + "_ipam_events_total", - Namespace: Namespace, - Name: "ipam_events_total", - Help: "Number of IPAM events received labeled by action and datapath family type", - }, []string{LabelAction, LabelDatapathFamily}), - - IPAMCapacity: metric.NewGaugeVec(metric.GaugeOpts{ - ConfigName: Namespace + "_ipam_capacity", - Namespace: Namespace, - Name: "ipam_capacity", - Help: "Total number of IPs in the IPAM pool labeled by family", - }, []string{LabelDatapathFamily}), - - KVStoreOperationsDuration: metric.NewHistogramVec(metric.HistogramOpts{ - ConfigName: Namespace + "_" + SubsystemKVStore + "_operations_duration_seconds", - Namespace: Namespace, - Subsystem: SubsystemKVStore, - Name: "operations_duration_seconds", - Help: "Duration in seconds of kvstore operations", - }, []string{LabelScope, LabelKind, LabelAction, LabelOutcome}), - - KVStoreEventsQueueDuration: metric.NewHistogramVec(metric.HistogramOpts{ - ConfigName: Namespace + "_" + SubsystemKVStore + "_events_queue_seconds", - Namespace: Namespace, - Subsystem: SubsystemKVStore, - Name: "events_queue_seconds", - Help: "Seconds waited before a received event was queued", - Buckets: []float64{.002, .005, .01, .015, .025, .05, .1, .25, .5, .75, 1}, - }, []string{LabelScope, LabelAction}), - - KVStoreQuorumErrors: metric.NewCounterVec(metric.CounterOpts{ - ConfigName: Namespace + "_" + SubsystemKVStore + "_quorum_errors_total", - Namespace: Namespace, - Subsystem: SubsystemKVStore, - Name: "quorum_errors_total", - Help: "Number of quorum errors", - }, []string{LabelError}), - - IPCacheErrorsTotal: metric.NewCounterVec(metric.CounterOpts{ - ConfigName: Namespace + "_" + SubsystemIPCache + "_errors_total", - Namespace: Namespace, - Subsystem: SubsystemIPCache, - Name: "errors_total", - Help: "Number of errors interacting with the IP to Identity cache", - }, []string{LabelType, LabelError}), - - IPCacheEventsTotal: metric.NewCounterVec(metric.CounterOpts{ - ConfigName: Namespace + "_" + SubsystemIPCache + "_events_total", - Disabled: true, - Namespace: Namespace, - Subsystem: SubsystemIPCache, - Name: "events_total", - Help: "Number of events interacting with the IP to Identity cache", - }, []string{LabelType}), - - FQDNGarbageCollectorCleanedTotal: metric.NewCounter(metric.CounterOpts{ - ConfigName: Namespace + "_" + SubsystemFQDN + "_gc_deletions_total", - Namespace: Namespace, - Subsystem: SubsystemFQDN, - Name: "gc_deletions_total", - Help: "Number of FQDNs that have been cleaned on FQDN Garbage collector job", - }), - - FQDNActiveNames: metric.NewGaugeVec(metric.GaugeOpts{ - ConfigName: Namespace + "_" + SubsystemFQDN + "_active_names", - Disabled: true, - Namespace: Namespace, - Subsystem: SubsystemFQDN, - Name: "active_names", - Help: "Number of domains inside the DNS cache that have not expired (by TTL), per endpoint", - }, []string{LabelPeerEndpoint}), - - FQDNActiveIPs: metric.NewGaugeVec(metric.GaugeOpts{ - ConfigName: Namespace + "_" + SubsystemFQDN + "_active_ips", - Disabled: true, - Namespace: Namespace, - Subsystem: SubsystemFQDN, - Name: "active_ips", - Help: "Number of IPs inside the DNS cache associated with a domain that has not expired (by TTL), per endpoint", - }, []string{LabelPeerEndpoint}), - - FQDNAliveZombieConnections: metric.NewGaugeVec(metric.GaugeOpts{ - ConfigName: Namespace + "_" + SubsystemFQDN + "_alive_zombie_connections", - Disabled: true, - Namespace: Namespace, - Subsystem: SubsystemFQDN, - Name: "alive_zombie_connections", - Help: "Number of IPs associated with domains that have expired (by TTL) yet still associated with an active connection (aka zombie), per endpoint", - }, []string{LabelPeerEndpoint}), - - FQDNSemaphoreRejectedTotal: metric.NewCounter(metric.CounterOpts{ - ConfigName: Namespace + "_" + SubsystemFQDN + "_semaphore_rejected_total", - Disabled: true, - Namespace: Namespace, - Subsystem: SubsystemFQDN, - Name: "semaphore_rejected_total", - Help: "Number of DNS request rejected by the DNS Proxy's admission semaphore", - }), - - BPFSyscallDuration: metric.NewHistogramVec(metric.HistogramOpts{ - ConfigName: Namespace + "_" + SubsystemBPF + "_syscall_duration_seconds", - Disabled: true, - Namespace: Namespace, - Subsystem: SubsystemBPF, - Name: "syscall_duration_seconds", - Help: "Duration of BPF system calls", - }, []string{LabelOperation, LabelOutcome}), - - BPFMapOps: metric.NewCounterVec(metric.CounterOpts{ - ConfigName: Namespace + "_" + SubsystemBPF + "_map_ops_total", - Namespace: Namespace, - Subsystem: SubsystemBPF, - Name: "map_ops_total", - Help: "Total operations on map, tagged by map name", - }, []string{LabelMapName, LabelOperation, LabelOutcome}), - - BPFMapCapacity: metric.NewGaugeVec(metric.GaugeOpts{ - ConfigName: Namespace + "_" + SubsystemBPF + "_map_capacity", - Namespace: Namespace, - Subsystem: SubsystemBPF, - Name: "map_capacity", - Help: "Capacity of map, tagged by map group. All maps with a capacity of 65536 are grouped under 'default'", - }, []string{LabelMapGroup}), - - TriggerPolicyUpdateTotal: metric.NewCounterVec(metric.CounterOpts{ - ConfigName: Namespace + "_" + SubsystemTriggers + "_policy_update_total", - Namespace: Namespace, - Subsystem: SubsystemTriggers, - Name: "policy_update_total", - Help: "Total number of policy update trigger invocations labeled by reason", - }, []string{"reason"}), - - TriggerPolicyUpdateFolds: metric.NewGauge(metric.GaugeOpts{ - ConfigName: Namespace + "_" + SubsystemTriggers + "_policy_update_folds", - Namespace: Namespace, - Subsystem: SubsystemTriggers, - Name: "policy_update_folds", - Help: "Current number of folds", - }), - - TriggerPolicyUpdateCallDuration: metric.NewHistogramVec(metric.HistogramOpts{ - ConfigName: Namespace + "_" + SubsystemTriggers + "_policy_update_call_duration_seconds", - Namespace: Namespace, - Subsystem: SubsystemTriggers, - Name: "policy_update_call_duration_seconds", - Help: "Duration of policy update trigger", - }, []string{LabelType}), - - VersionMetric: metric.NewGaugeVec(metric.GaugeOpts{ - ConfigName: Namespace + "_version", - Namespace: Namespace, - Name: "version", - Help: "Cilium version", - }, []string{LabelVersion, LabelVersionRevision, LabelArch}), - - APILimiterWaitHistoryDuration: metric.NewHistogramVec(metric.HistogramOpts{ - ConfigName: Namespace + "_" + SubsystemAPILimiter + "_wait_history_duration_seconds", - Disabled: true, - Namespace: Namespace, - Subsystem: SubsystemAPILimiter, - Name: "wait_history_duration_seconds", - Help: "Histogram over duration of waiting period for API calls subjects to rate limiting", - }, []string{"api_call"}), - - APILimiterWaitDuration: metric.NewGaugeVec(metric.GaugeOpts{ - ConfigName: Namespace + "_" + SubsystemAPILimiter + "_wait_duration_seconds", - Namespace: Namespace, - Subsystem: SubsystemAPILimiter, - Name: "wait_duration_seconds", - Help: "Current wait time for api calls", - }, []string{"api_call", "value"}), - - APILimiterProcessingDuration: metric.NewGaugeVec(metric.GaugeOpts{ - ConfigName: Namespace + "_" + SubsystemAPILimiter + "_processing_duration_seconds", - Namespace: Namespace, - Subsystem: SubsystemAPILimiter, - Name: "processing_duration_seconds", - Help: "Current processing time of api call", - }, []string{"api_call", "value"}), - - APILimiterRequestsInFlight: metric.NewGaugeVec(metric.GaugeOpts{ - ConfigName: Namespace + "_" + SubsystemAPILimiter + "_requests_in_flight", - Namespace: Namespace, - Subsystem: SubsystemAPILimiter, - Name: "requests_in_flight", - Help: "Current requests in flight", - }, []string{"api_call", "value"}), - - APILimiterRateLimit: metric.NewGaugeVec(metric.GaugeOpts{ - ConfigName: Namespace + "_" + SubsystemAPILimiter + "_rate_limit", - Namespace: Namespace, - Subsystem: SubsystemAPILimiter, - Name: "rate_limit", - Help: "Current rate limiting configuration", - }, []string{"api_call", "value"}), - - APILimiterAdjustmentFactor: metric.NewGaugeVec(metric.GaugeOpts{ - ConfigName: Namespace + "_" + SubsystemAPILimiter + "_adjustment_factor", - Namespace: Namespace, - Subsystem: SubsystemAPILimiter, - Name: "adjustment_factor", - Help: "Current adjustment factor while auto adjusting", - }, []string{"api_call"}), - - APILimiterProcessedRequests: metric.NewCounterVec(metric.CounterOpts{ - ConfigName: Namespace + "_" + SubsystemAPILimiter + "_processed_requests_total", - Namespace: Namespace, - Subsystem: SubsystemAPILimiter, - Name: "processed_requests_total", - Help: "Total number of API requests processed", - }, []string{"api_call", LabelOutcome, LabelAPIReturnCode}), - - EndpointPropagationDelay: metric.NewHistogramVec(metric.HistogramOpts{ - ConfigName: Namespace + "_endpoint_propagation_delay_seconds", - Namespace: Namespace, - Name: "endpoint_propagation_delay_seconds", - Help: "CiliumEndpoint roundtrip propagation delay in seconds", - Buckets: []float64{.05, .1, 1, 5, 30, 60, 120, 240, 300, 600}, - }, []string{}), - - NodeConnectivityStatus: metric.NewGaugeVec(metric.GaugeOpts{ - ConfigName: Namespace + "_node_connectivity_status", - Namespace: Namespace, - Name: "node_connectivity_status", - Help: "The last observed status of both ICMP and HTTP connectivity between the current Cilium agent and other Cilium nodes", - }, []string{ - LabelSourceCluster, - LabelSourceNodeName, - LabelTargetCluster, - LabelTargetNodeName, - LabelTargetNodeType, - LabelType, - }), - - NodeConnectivityLatency: metric.NewGaugeVec(metric.GaugeOpts{ - ConfigName: Namespace + "_node_connectivity_latency_seconds", - Namespace: Namespace, - Name: "node_connectivity_latency_seconds", - Help: "The last observed latency between the current Cilium agent and other Cilium nodes in seconds", - }, []string{ - LabelSourceCluster, - LabelSourceNodeName, - LabelTargetCluster, - LabelTargetNodeName, - LabelTargetNodeIP, - LabelTargetNodeType, - LabelType, - LabelProtocol, - LabelAddressType, - }), - - WorkQueueDepth: WorkQueueDepth, - WorkQueueAddsTotal: WorkQueueAddsTotal, - WorkQueueLatency: WorkQueueLatency, - WorkQueueDuration: WorkQueueDuration, - WorkQueueUnfinishedWork: WorkQueueUnfinishedWork, - WorkQueueLongestRunningProcessor: WorkQueueLongestRunningProcessor, - WorkQueueRetries: WorkQueueRetries, - } - - ifindexOpts := metric.GaugeOpts{ - ConfigName: Namespace + "_endpoint_max_ifindex", - Disabled: !enableIfIndexMetric(), - Namespace: Namespace, - Name: "endpoint_max_ifindex", - Help: "Maximum interface index observed for existing endpoints", - } - lm.EndpointMaxIfindex = metric.NewGauge(ifindexOpts) - - v := version.GetCiliumVersion() - lm.VersionMetric.WithLabelValues(v.Version, v.Revision, v.Arch) - lm.BPFMapCapacity.WithLabelValues("default").Set(DefaultMapCapacity) - - BootstrapTimes = lm.BootstrapTimes - APIInteractions = lm.APIInteractions - NodeConnectivityStatus = lm.NodeConnectivityStatus - NodeConnectivityLatency = lm.NodeConnectivityLatency - Endpoint = lm.Endpoint - EndpointMaxIfindex = lm.EndpointMaxIfindex - EndpointRegenerationTotal = lm.EndpointRegenerationTotal - EndpointStateCount = lm.EndpointStateCount - EndpointRegenerationTimeStats = lm.EndpointRegenerationTimeStats - EndpointPropagationDelay = lm.EndpointPropagationDelay - Policy = lm.Policy - PolicyRegenerationCount = lm.PolicyRegenerationCount - PolicyRegenerationTimeStats = lm.PolicyRegenerationTimeStats - PolicyRevision = lm.PolicyRevision - PolicyChangeTotal = lm.PolicyChangeTotal - PolicyEndpointStatus = lm.PolicyEndpointStatus - PolicyImplementationDelay = lm.PolicyImplementationDelay - CIDRGroupsReferenced = lm.CIDRGroupsReferenced - CIDRGroupTranslationTimeStats = lm.CIDRGroupTranslationTimeStats - Identity = lm.Identity - EventTS = lm.EventTS - EventLagK8s = lm.EventLagK8s - ProxyRedirects = lm.ProxyRedirects - ProxyPolicyL7Total = lm.ProxyPolicyL7Total - ProxyUpstreamTime = lm.ProxyUpstreamTime - ProxyDatapathUpdateTimeout = lm.ProxyDatapathUpdateTimeout - ConntrackGCRuns = lm.ConntrackGCRuns - ConntrackGCKeyFallbacks = lm.ConntrackGCKeyFallbacks - ConntrackGCSize = lm.ConntrackGCSize - NatGCSize = lm.NatGCSize - ConntrackGCDuration = lm.ConntrackGCDuration - ConntrackDumpResets = lm.ConntrackDumpResets - SignalsHandled = lm.SignalsHandled - ServicesEventsCount = lm.ServicesEventsCount - ServiceImplementationDelay = lm.ServiceImplementationDelay - ErrorsWarnings = lm.ErrorsWarnings - ControllerRuns = lm.ControllerRuns - ControllerRunsDuration = lm.ControllerRunsDuration - SubprocessStart = lm.SubprocessStart - KubernetesEventProcessed = lm.KubernetesEventProcessed - KubernetesEventReceived = lm.KubernetesEventReceived - KubernetesAPIInteractions = lm.KubernetesAPIInteractions - KubernetesAPIRateLimiterLatency = lm.KubernetesAPIRateLimiterLatency - KubernetesAPICallsTotal = lm.KubernetesAPICallsTotal - KubernetesCNPStatusCompletion = lm.KubernetesCNPStatusCompletion - TerminatingEndpointsEvents = lm.TerminatingEndpointsEvents - IPAMEvent = lm.IPAMEvent - IPAMCapacity = lm.IPAMCapacity - KVStoreOperationsDuration = lm.KVStoreOperationsDuration - KVStoreEventsQueueDuration = lm.KVStoreEventsQueueDuration - KVStoreQuorumErrors = lm.KVStoreQuorumErrors - FQDNGarbageCollectorCleanedTotal = lm.FQDNGarbageCollectorCleanedTotal - FQDNActiveNames = lm.FQDNActiveNames - FQDNActiveIPs = lm.FQDNActiveIPs - FQDNAliveZombieConnections = lm.FQDNAliveZombieConnections - FQDNSemaphoreRejectedTotal = lm.FQDNSemaphoreRejectedTotal - IPCacheErrorsTotal = lm.IPCacheErrorsTotal - IPCacheEventsTotal = lm.IPCacheEventsTotal - BPFSyscallDuration = lm.BPFSyscallDuration - BPFMapOps = lm.BPFMapOps - BPFMapCapacity = lm.BPFMapCapacity - TriggerPolicyUpdateTotal = lm.TriggerPolicyUpdateTotal - TriggerPolicyUpdateFolds = lm.TriggerPolicyUpdateFolds - TriggerPolicyUpdateCallDuration = lm.TriggerPolicyUpdateCallDuration - VersionMetric = lm.VersionMetric - APILimiterWaitHistoryDuration = lm.APILimiterWaitHistoryDuration - APILimiterWaitDuration = lm.APILimiterWaitDuration - APILimiterProcessingDuration = lm.APILimiterProcessingDuration - APILimiterRequestsInFlight = lm.APILimiterRequestsInFlight - APILimiterRateLimit = lm.APILimiterRateLimit - APILimiterAdjustmentFactor = lm.APILimiterAdjustmentFactor - APILimiterProcessedRequests = lm.APILimiterProcessedRequests - - return lm -} - -// InitOperatorMetrics is used to init legacy metrics necessary during operator init. -func InitOperatorMetrics() { - ErrorsWarnings = newErrorsWarningsMetric() -} - -func newErrorsWarningsMetric() metric.Vec[metric.Counter] { - return metric.NewCounterVec(metric.CounterOpts{ - ConfigName: Namespace + "_errors_warnings_total", - Namespace: Namespace, - Name: "errors_warnings_total", - Help: "Number of total errors in cilium-agent instances", - }, []string{"level", "subsystem"}) -} - -// GaugeWithThreshold is a prometheus gauge that registers itself with -// prometheus if over a threshold value and unregisters when under. -type GaugeWithThreshold struct { - gauge prometheus.Gauge - threshold float64 - active bool -} - -// Set the value of the GaugeWithThreshold. -func (gwt *GaugeWithThreshold) Set(value float64) { - overThreshold := value > gwt.threshold - if gwt.active && !overThreshold { - gwt.active = !Unregister(gwt.gauge) - if gwt.active { - logrus.WithField("metric", gwt.gauge.Desc().String()).Warning("Failed to unregister metric") - } - } else if !gwt.active && overThreshold { - err := Register(gwt.gauge) - gwt.active = err == nil - if err != nil { - logrus.WithField("metric", gwt.gauge.Desc().String()).WithError(err).Warning("Failed to register metric") - } - } - - gwt.gauge.Set(value) -} - -// NewGaugeWithThreshold creates a new GaugeWithThreshold. -func NewGaugeWithThreshold(name string, subsystem string, desc string, labels map[string]string, threshold float64) *GaugeWithThreshold { - return &GaugeWithThreshold{ - gauge: prometheus.NewGauge(prometheus.GaugeOpts{ - Namespace: Namespace, - Subsystem: subsystem, - Name: name, - Help: desc, - ConstLabels: labels, - }), - threshold: threshold, - active: false, - } -} - -// NewBPFMapPressureGauge creates a new GaugeWithThreshold for the -// cilium_bpf_map_pressure metric with the map name as constant label. -func NewBPFMapPressureGauge(mapname string, threshold float64) *GaugeWithThreshold { - return NewGaugeWithThreshold( - "map_pressure", - SubsystemBPF, - "Fill percentage of map, tagged by map name", - map[string]string{ - LabelMapName: mapname, - }, - threshold, - ) -} - -func Reinitialize() { - reg, err := registry.Await(context.Background()) - if err == nil { - reg.Reinitialize() - } -} - -// Register registers a collector -func Register(c prometheus.Collector) error { - var err error - - withRegistry(func(reg *Registry) { - err = reg.Register(c) - }) - - return err -} - -// RegisterList registers a list of collectors. If registration of one -// collector fails, no collector is registered. -func RegisterList(list []prometheus.Collector) error { - withRegistry(func(reg *Registry) { - reg.RegisterList(list) - }) - - return nil -} - -// Unregister unregisters a collector -func Unregister(c prometheus.Collector) bool { - ctx, cancel := context.WithTimeout(context.Background(), time.Second) - defer cancel() - reg, err := registry.Await(ctx) - if err == nil { - return reg.Unregister(c) - } - - return false -} - -// DumpMetrics gets the current Cilium metrics and dumps all into a -// models.Metrics structure.If metrics cannot be retrieved, returns an error -func DumpMetrics() ([]*models.Metric, error) { - ctx, cancel := context.WithTimeout(context.Background(), time.Second) - defer cancel() - reg, err := registry.Await(ctx) - if err == nil { - return reg.DumpMetrics() - } - - return nil, nil -} - -// withRegistry waits up to 1 second for the registry promise to resolve, if it does not then -// we might be calling this function before hive has been started, so to avoid a deadlock, -// wait in a routine so actions are deferred until the registry is initialized. -func withRegistry(fn func(reg *Registry)) { - ctx, cancel := context.WithTimeout(context.Background(), time.Second) - reg, err := registry.Await(ctx) - if err == nil { - fn(reg) - cancel() - return - } - cancel() - - go func() { - reg, err := registry.Await(context.Background()) - if err == nil { - fn(reg) - } - }() -} - -// GetCounterValue returns the current value -// stored for the counter -func GetCounterValue(m prometheus.Counter) float64 { - var pm dto.Metric - err := m.Write(&pm) - if err == nil && pm.Counter != nil && pm.Counter.Value != nil { - return *pm.Counter.Value - } - return 0 -} - -// GetGaugeValue returns the current value stored for the gauge. This function -// is useful in tests. -func GetGaugeValue(m prometheus.Gauge) float64 { - var pm dto.Metric - err := m.Write(&pm) - if err == nil && pm.Gauge != nil && pm.Gauge.Value != nil { - return *pm.Gauge.Value - } - return 0 -} - -// Error2Outcome converts an error to LabelOutcome -func Error2Outcome(err error) string { - if err != nil { - return LabelValueOutcomeFail - } - - return LabelValueOutcomeSuccess -} - -// LabelOutcome2Code converts a label outcome to a code -func LabelOutcome2Code(outcome string) int { - if outcome == LabelValueOutcomeSuccess { - return 200 - } - return 500 -} - -func BoolToFloat64(v bool) float64 { - if v { - return 1 - } - return 0 -} - -// In general, most bpf maps are allocated to occupy a 16-bit key size. -// To reduce the number of metrics that need to be emitted for map capacity, -// we assume a default map size of 2^16 entries for all maps, which can be -// assumed unless specified otherwise. -const DefaultMapCapacity = 65536 - -func UpdateMapCapacity(groupName string, capacity uint32) { - if capacity == 0 || capacity == DefaultMapCapacity { - return - } - BPFMapCapacity.WithLabelValues(groupName).Set(float64(capacity)) -} diff --git a/vendor/github.com/cilium/cilium/pkg/metrics/metrics_unix.go b/vendor/github.com/cilium/cilium/pkg/metrics/metrics_unix.go deleted file mode 100644 index 184d3baa7..000000000 --- a/vendor/github.com/cilium/cilium/pkg/metrics/metrics_unix.go +++ /dev/null @@ -1,30 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -//go:build !windows - -package metrics - -import ( - "golang.org/x/sys/unix" - - "github.com/cilium/cilium/pkg/datapath/linux/probes" -) - -// Errno2Outcome converts a unix.Errno to LabelOutcome -func Errno2Outcome(errno unix.Errno) string { - if errno != 0 { - return LabelValueOutcomeFail - } - - return LabelValueOutcomeSuccess -} - -func enableIfIndexMetric() bool { - // On kernels which do not provide ifindex via the FIB, Cilium needs - // to store it in the CT map, with a field limit of max(uint16). - // The EndpointMaxIfindex metric can be used to determine if that - // limit is approaching. However, it should only be enabled by - // default if we observe that the FIB is not providing the ifindex. - return probes.HaveFibIfindex() != nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/metrics/metrics_windows.go b/vendor/github.com/cilium/cilium/pkg/metrics/metrics_windows.go deleted file mode 100644 index dc4333ab3..000000000 --- a/vendor/github.com/cilium/cilium/pkg/metrics/metrics_windows.go +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package metrics - -func enableIfIndexMetric() bool { - return false -} diff --git a/vendor/github.com/cilium/cilium/pkg/metrics/middleware.go b/vendor/github.com/cilium/cilium/pkg/metrics/middleware.go deleted file mode 100644 index be13472a1..000000000 --- a/vendor/github.com/cilium/cilium/pkg/metrics/middleware.go +++ /dev/null @@ -1,68 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package metrics - -import ( - "net/http" - "strconv" - "strings" - - "github.com/cilium/cilium/pkg/metrics/metric" - "github.com/cilium/cilium/pkg/spanstat" -) - -// APIEventTSHelper is intended to be a global middleware to track metrics -// around API calls. -// It records the timestamp of an API call in the provided gauge. -type APIEventTSHelper struct { - Next http.Handler - TSGauge metric.Vec[metric.Gauge] - Histogram metric.Vec[metric.Observer] -} - -type ResponderWrapper struct { - http.ResponseWriter - code int -} - -func (rw *ResponderWrapper) WriteHeader(code int) { - rw.code = code - rw.ResponseWriter.WriteHeader(code) -} - -// getShortPath returns the API path trimmed after the 3rd slash. -// examples: -// -// "/v1/config" -> "/v1/config" -// "/v1/endpoint/cilium-local:0" -> "/v1/endpoint" -// "/v1/endpoint/container-id:597.." -> "/v1/endpoint" -func getShortPath(s string) string { - var idxSum int - for nThSlash := 0; nThSlash < 3; nThSlash++ { - idx := strings.IndexByte(s[idxSum:], '/') - if idx == -1 { - return s - } - idxSum += idx + 1 - } - return s[:idxSum-1] -} - -// ServeHTTP implements the http.Handler interface. It records the timestamp -// this API call began at, then chains to the next handler. -func (m *APIEventTSHelper) ServeHTTP(r http.ResponseWriter, req *http.Request) { - reqOk := req != nil && req.URL != nil && req.URL.Path != "" - var path string - if reqOk { - path = getShortPath(req.URL.Path) - m.TSGauge.WithLabelValues(LabelEventSourceAPI, path, req.Method).SetToCurrentTime() - } - duration := spanstat.Start() - rw := &ResponderWrapper{ResponseWriter: r} - m.Next.ServeHTTP(rw, req) - if reqOk { - took := float64(duration.End(true).Total().Seconds()) - m.Histogram.WithLabelValues(path, req.Method, strconv.Itoa(rw.code)).Observe(took) - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/metrics/registry.go b/vendor/github.com/cilium/cilium/pkg/metrics/registry.go deleted file mode 100644 index 260ecff83..000000000 --- a/vendor/github.com/cilium/cilium/pkg/metrics/registry.go +++ /dev/null @@ -1,249 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package metrics - -import ( - "errors" - "net/http" - "regexp" - "strings" - - "github.com/cilium/hive" - "github.com/cilium/hive/cell" - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/collectors" - "github.com/prometheus/client_golang/prometheus/promhttp" - dto "github.com/prometheus/client_model/go" - "github.com/sirupsen/logrus" - "github.com/spf13/pflag" - - "github.com/cilium/cilium/api/v1/models" - metricpkg "github.com/cilium/cilium/pkg/metrics/metric" - "github.com/cilium/cilium/pkg/option" -) - -var defaultRegistryConfig = RegistryConfig{ - PrometheusServeAddr: "", -} - -type RegistryConfig struct { - // PrometheusServeAddr IP:Port on which to serve prometheus metrics (pass ":Port" to bind on all interfaces, "" is off) - PrometheusServeAddr string - // This is a list of metrics to be enabled or disabled, format is `+`/`-` + `{metric name}` - Metrics []string -} - -func (rc RegistryConfig) Flags(flags *pflag.FlagSet) { - flags.String("prometheus-serve-addr", rc.PrometheusServeAddr, "IP:Port on which to serve prometheus metrics (pass \":Port\" to bind on all interfaces, \"\" is off)") - flags.StringSlice("metrics", rc.Metrics, "Metrics that should be enabled or disabled from the default metric list. (+metric_foo to enable metric_foo, -metric_bar to disable metric_bar)") -} - -// RegistryParams are the parameters needed to construct a Registry -type RegistryParams struct { - cell.In - - Logger logrus.FieldLogger - Shutdowner hive.Shutdowner - Lifecycle cell.Lifecycle - - AutoMetrics []metricpkg.WithMetadata `group:"hive-metrics"` - Config RegistryConfig - - DaemonConfig *option.DaemonConfig -} - -// Registry is a cell around a prometheus registry. This registry starts an HTTP server as part of its lifecycle -// on which all enabled metrics will be available. A reference to this registry can also be used to dynamically -// register or unregister `prometheus.Collector`s. -type Registry struct { - inner *prometheus.Registry - - params RegistryParams -} - -func NewRegistry(params RegistryParams) *Registry { - reg := &Registry{ - params: params, - } - - reg.Reinitialize() - - // Resolve the global registry variable for as long as we still have global functions - registryResolver.Resolve(reg) - - if params.Config.PrometheusServeAddr != "" { - // The Handler function provides a default handler to expose metrics - // via an HTTP server. "/metrics" is the usual endpoint for that. - mux := http.NewServeMux() - mux.Handle("/metrics", promhttp.HandlerFor(reg.inner, promhttp.HandlerOpts{})) - srv := http.Server{ - Addr: params.Config.PrometheusServeAddr, - Handler: mux, - } - - params.Lifecycle.Append(cell.Hook{ - OnStart: func(hc cell.HookContext) error { - go func() { - params.Logger.Infof("Serving prometheus metrics on %s", params.Config.PrometheusServeAddr) - err := srv.ListenAndServe() - if err != nil && !errors.Is(err, http.ErrServerClosed) { - params.Shutdowner.Shutdown(hive.ShutdownWithError(err)) - } - }() - return nil - }, - OnStop: func(hc cell.HookContext) error { - return srv.Shutdown(hc) - }, - }) - } - - return reg -} - -// Register registers a collector -func (r *Registry) Register(c prometheus.Collector) error { - return r.inner.Register(c) -} - -// Unregister unregisters a collector -func (r *Registry) Unregister(c prometheus.Collector) bool { - return r.inner.Unregister(c) -} - -// goCustomCollectorsRX tracks enabled go runtime metrics. -var goCustomCollectorsRX = regexp.MustCompile(`^/sched/latencies:seconds`) - -// Reinitialize creates a new internal registry and re-registers metrics to it. -func (r *Registry) Reinitialize() { - r.inner = prometheus.NewPedanticRegistry() - - // Default metrics which can't be disabled. - r.MustRegister(collectors.NewProcessCollector(collectors.ProcessCollectorOpts{Namespace: Namespace})) - r.MustRegister(collectors.NewGoCollector( - collectors.WithGoCollectorRuntimeMetrics( - collectors.GoRuntimeMetricsRule{Matcher: goCustomCollectorsRX}, - ))) - r.MustRegister(newStatusCollector()) - r.MustRegister(newbpfCollector()) - - metrics := make(map[string]metricpkg.WithMetadata) - for i, autoMetric := range r.params.AutoMetrics { - metrics[autoMetric.Opts().GetConfigName()] = r.params.AutoMetrics[i] - } - - // This is a bodge for a very specific feature, inherited from the old `Daemon.additionalMetrics`. - // We should really find a more generic way to handle such cases. - metricFlags := r.params.Config.Metrics - if r.params.DaemonConfig.DNSProxyConcurrencyLimit > 0 { - metricFlags = append(metricFlags, "+"+Namespace+"_"+SubsystemFQDN+"_semaphore_rejected_total") - } - - for _, metricFlag := range metricFlags { - metricFlag = strings.TrimSpace(metricFlag) - - // This is a temporary hack which allows us to get rid of the centralized metric config without refactoring the - // dynamic map pressure registration/unregistion mechanism. - // Long term the map pressure metric becomes a smarter component so this is no longer needed. - if metricFlag[1:] == "-"+Namespace+"_"+SubsystemBPF+"_map_pressure" { - BPFMapPressure = false - continue - } - - metric := metrics[metricFlag[1:]] - if metric == nil { - continue - } - - switch metricFlag[0] { - case '+': - metric.SetEnabled(true) - case '-': - metric.SetEnabled(false) - default: - r.params.Logger.Warning( - "--metrics flag contains value which does not start with + or -, '%s', ignoring", - metricFlag, - ) - } - } - - for _, m := range metrics { - if c, ok := m.(prometheus.Collector); ok { - r.MustRegister(c) - } - } -} - -// MustRegister adds the collector to the registry, exposing this metric to -// prometheus scrapes. -// It will panic on error. -func (r *Registry) MustRegister(c ...prometheus.Collector) { - r.inner.MustRegister(c...) -} - -// RegisterList registers a list of collectors. If registration of one -// collector fails, no collector is registered. -func (r *Registry) RegisterList(list []prometheus.Collector) error { - registered := []prometheus.Collector{} - - for _, c := range list { - if err := r.Register(c); err != nil { - for _, c := range registered { - r.Unregister(c) - } - return err - } - - registered = append(registered, c) - } - - return nil -} - -// DumpMetrics gets the current Cilium metrics and dumps all into a -// models.Metrics structure.If metrics cannot be retrieved, returns an error -func (r *Registry) DumpMetrics() ([]*models.Metric, error) { - result := []*models.Metric{} - currentMetrics, err := r.inner.Gather() - if err != nil { - return result, err - } - - for _, val := range currentMetrics { - metricName := val.GetName() - metricType := val.GetType() - - for _, metricLabel := range val.Metric { - labels := map[string]string{} - for _, label := range metricLabel.GetLabel() { - labels[label.GetName()] = label.GetValue() - } - - var value float64 - switch metricType { - case dto.MetricType_COUNTER: - value = metricLabel.Counter.GetValue() - case dto.MetricType_GAUGE: - value = metricLabel.GetGauge().GetValue() - case dto.MetricType_UNTYPED: - value = metricLabel.GetUntyped().GetValue() - case dto.MetricType_SUMMARY: - value = metricLabel.GetSummary().GetSampleSum() - case dto.MetricType_HISTOGRAM: - value = metricLabel.GetHistogram().GetSampleSum() - default: - continue - } - - metric := &models.Metric{ - Name: metricName, - Labels: labels, - Value: value, - } - result = append(result, metric) - } - } - return result, nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/metrics/status.go b/vendor/github.com/cilium/cilium/pkg/metrics/status.go deleted file mode 100644 index 98c4c9d9e..000000000 --- a/vendor/github.com/cilium/cilium/pkg/metrics/status.go +++ /dev/null @@ -1,162 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package metrics - -import ( - "github.com/prometheus/client_golang/prometheus" - "github.com/sirupsen/logrus" - - clientPkg "github.com/cilium/cilium/pkg/client" - healthClientPkg "github.com/cilium/cilium/pkg/health/client" -) - -type statusCollector struct { - daemonHealthGetter daemonHealthGetter - connectivityStatusGetter connectivityStatusGetter - - controllersFailingDesc *prometheus.Desc - ipAddressesDesc *prometheus.Desc - unreachableNodesDesc *prometheus.Desc - unreachableHealthEndpointsDesc *prometheus.Desc -} - -func newStatusCollector() *statusCollector { - ciliumClient, err := clientPkg.NewClient("") - if err != nil { - logrus.WithError(err).Fatal("Error while creating Cilium API client") - } - - healthClient, err := healthClientPkg.NewClient("") - if err != nil { - logrus.WithError(err).Fatal("Error while creating cilium-health API client") - } - - return newStatusCollectorWithClients(ciliumClient.Daemon, healthClient.Connectivity) -} - -// newStatusCollectorWithClients provides a constructor with injected clients -func newStatusCollectorWithClients(d daemonHealthGetter, c connectivityStatusGetter) *statusCollector { - return &statusCollector{ - daemonHealthGetter: d, - connectivityStatusGetter: c, - controllersFailingDesc: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "", "controllers_failing"), - "Number of failing controllers", - nil, nil, - ), - ipAddressesDesc: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "", "ip_addresses"), - "Number of allocated IP addresses", - []string{"family"}, nil, - ), - unreachableNodesDesc: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "", "unreachable_nodes"), - "Number of nodes that cannot be reached", - nil, nil, - ), - unreachableHealthEndpointsDesc: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "", "unreachable_health_endpoints"), - "Number of health endpoints that cannot be reached", - nil, nil, - ), - } -} - -func (s *statusCollector) Describe(ch chan<- *prometheus.Desc) { - ch <- s.controllersFailingDesc - ch <- s.ipAddressesDesc - ch <- s.unreachableNodesDesc - ch <- s.unreachableHealthEndpointsDesc -} - -func (s *statusCollector) Collect(ch chan<- prometheus.Metric) { - statusResponse, err := s.daemonHealthGetter.GetHealthz(nil) - if err != nil { - logrus.WithError(err).Error("Error while getting Cilium status") - return - } - - if statusResponse.Payload == nil { - return - } - - // Controllers failing - controllersFailing := 0 - - for _, ctrl := range statusResponse.Payload.Controllers { - if ctrl.Status == nil { - continue - } - if ctrl.Status.ConsecutiveFailureCount > 0 { - controllersFailing++ - } - } - - ch <- prometheus.MustNewConstMetric( - s.controllersFailingDesc, - prometheus.GaugeValue, - float64(controllersFailing), - ) - - if statusResponse.Payload.Ipam != nil { - // Address count - ch <- prometheus.MustNewConstMetric( - s.ipAddressesDesc, - prometheus.GaugeValue, - float64(len(statusResponse.Payload.Ipam.IPV4)), - "ipv4", - ) - - ch <- prometheus.MustNewConstMetric( - s.ipAddressesDesc, - prometheus.GaugeValue, - float64(len(statusResponse.Payload.Ipam.IPV6)), - "ipv6", - ) - } - - healthStatusResponse, err := s.connectivityStatusGetter.GetStatus(nil) - if err != nil { - logrus.WithError(err).Error("Error while getting cilium-health status") - return - } - - if healthStatusResponse.Payload == nil { - return - } - - // Nodes and endpoints healthStatusResponse - var ( - unreachableNodes int - unreachableEndpoints int - ) - - for _, nodeStatus := range healthStatusResponse.Payload.Nodes { - for _, addr := range healthClientPkg.GetAllHostAddresses(nodeStatus) { - if healthClientPkg.GetPathConnectivityStatusType(addr) == healthClientPkg.ConnStatusUnreachable { - unreachableNodes++ - break - } - } - - for _, addr := range healthClientPkg.GetAllEndpointAddresses(nodeStatus) { - if healthClientPkg.GetPathConnectivityStatusType(addr) == healthClientPkg.ConnStatusUnreachable { - unreachableEndpoints++ - break - } - } - } - - ch <- prometheus.MustNewConstMetric( - s.unreachableNodesDesc, - prometheus.GaugeValue, - float64(unreachableNodes), - ) - - ch <- prometheus.MustNewConstMetric( - s.unreachableHealthEndpointsDesc, - prometheus.GaugeValue, - float64(unreachableEndpoints), - ) -} diff --git a/vendor/github.com/cilium/cilium/pkg/netns/doc.go b/vendor/github.com/cilium/cilium/pkg/netns/doc.go deleted file mode 100644 index 4cb8bfa2d..000000000 --- a/vendor/github.com/cilium/cilium/pkg/netns/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Package netns contains various utility functions to work with network -// namespaces -package netns diff --git a/vendor/github.com/cilium/cilium/pkg/netns/netns_linux.go b/vendor/github.com/cilium/cilium/pkg/netns/netns_linux.go deleted file mode 100644 index 5e2f1633c..000000000 --- a/vendor/github.com/cilium/cilium/pkg/netns/netns_linux.go +++ /dev/null @@ -1,245 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package netns - -import ( - "fmt" - "os" - "runtime" - - "golang.org/x/sync/errgroup" - "golang.org/x/sys/unix" -) - -type NetNS struct { - f *os.File -} - -// newNetNS constructs a new NetNS and supplies it with a finalizer. -func newNetNS(f *os.File) *NetNS { - ns := &NetNS{f: f} - - // Prevent resource leaks by eventually closing the underlying file descriptor - // after ns is garbage collected. - runtime.SetFinalizer(ns, (*NetNS).Close) - - return ns -} - -// New creates a network namespace and returns a handle to it. -// -// The namespace created by this call is not pinned and will be closed when the -// last process in the namespace terminates, or when the handle is either -// Close()d explicitly or garbage collected. -// -// Not calling Close() is an error. -func New() (*NetNS, error) { - var f *os.File - - // Perform network namespace creation in a new goroutine to give us the - // possibility of terminating the underlying OS thread (by terminating the - // goroutine) if something goes wrong. - var g errgroup.Group - g.Go(func() error { - restoreUnlock, err := lockOSThread() - if err != nil { - return fmt.Errorf("lock OS thread: %w", err) - } - - // Move the underlying OS thread to a new network namespace. This can be - // undone by calling restoreUnlock(). - if err := unshare(); err != nil { - return fmt.Errorf("create new netns: %w", err) - } - - // Take out a reference to the new netns. - f, err = getCurrent() - if err != nil { - return fmt.Errorf("get current netns: %w (terminating OS thread)", err) - } - - // Restore the OS thread to its original network namespace or implicitly - // terminate it if something went wrong. - if err := restoreUnlock(); err != nil { - return fmt.Errorf("restore current netns: %w (terminating OS thread)", err) - } - - return nil - }) - - if err := g.Wait(); err != nil { - return nil, err - } - - return newNetNS(f), nil -} - -// OpenPinned opens a handle to the existing, pinned network namespace at the -// given path. Useful for running code within a netns managed by another process -// that pinned a network namespace to an nsfs. -// -// Not calling Close() is an error. -func OpenPinned(path string) (*NetNS, error) { - f, err := getFromPath(path) - if err != nil { - return nil, err - } - - return newNetNS(f), nil -} - -// Current returns a handle to the network namespace of the calling goroutine's -// underlying OS thread. -func Current() (*NetNS, error) { - f, err := getCurrent() - if err != nil { - return nil, err - } - - return newNetNS(f), nil -} - -// GetNetNSCookie tries to retrieve the cookie of the host netns. -func GetNetNSCookie() (uint64, error) { - s, err := unix.Socket(unix.AF_INET, unix.SOCK_STREAM, 0) - if err != nil { - return 0, err - } - defer unix.Close(s) - - cookie, err := unix.GetsockoptUint64(s, unix.SOL_SOCKET, unix.SO_NETNS_COOKIE) - if err != nil { - return 0, err - } - - return cookie, nil -} - -// FD returns the underlying file descriptor representing the netns handle. -func (h *NetNS) FD() int { - if h.f == nil { - return -1 - } - - return int(h.f.Fd()) -} - -// Close closes the handle to the network namespace. This does not necessarily -// mean destroying the network namespace itself, which only happens when all -// references to it are gone and all of its processes have been terminated. -func (h *NetNS) Close() error { - if h.f == nil { - return nil - } - - if err := h.f.Close(); err != nil { - return err - } - h.f = nil - - return nil -} - -// Do runs the provided func in the netns without changing the calling thread's -// netns. -// -// The code in f and any code called by f must NOT call [runtime.LockOSThread], -// as this could leave the goroutine created by Do permanently pinned to an OS -// thread. -func (h *NetNS) Do(f func() error) error { - - // Start the func in a new goroutine and lock it to an exclusive thread. This - // ensures that if execution of the goroutine fails unexpectedly before we - // call UnlockOSThread, the go runtime will ensure the underlying OS thread is - // disposed of, rather than reused in a potentially undefined state. - // - // See also: https://pkg.go.dev/runtime#UnlockOSThread - var g errgroup.Group - g.Go(func() error { - // Lock the newly-created goroutine to the OS thread it's running on so we - // can safely move it into another network namespace. (per-thread state) - restoreUnlock, err := lockOSThread() - if err != nil { - return err - } - - if err := set(h.f); err != nil { - return fmt.Errorf("set netns: %w (terminating OS thread)", err) - } - - ferr := f() - - // Attempt to restore the underlying OS thread to its original network - // namespace and unlock the running goroutine from its OS thread. Any - // failures during this process will leave the goroutine locked, making the - // underlying OS thread terminate when this function returns. - if err := restoreUnlock(); err != nil { - return fmt.Errorf("restore original netns: %w (terminating OS thread)", err) - } - return ferr - }) - - return g.Wait() -} - -// lockOSThread locks the calling goroutine to its underlying OS thread and -// returns a function that can later be used to unlock and restore the OS thread -// to its network namespace at the time of the initial call. -func lockOSThread() (func() error, error) { - runtime.LockOSThread() - - orig, err := getCurrent() - if err != nil { - runtime.UnlockOSThread() - return nil, fmt.Errorf("get current namespace: %w", err) - } - - return func() error { - defer orig.Close() - - if err := set(orig); err != nil { - // We didn't manage to restore the OS thread to its original namespace. - // Don't unlock the current goroutine from its thread, so the thread will - // terminate when the current goroutine does. - return err - } - - // Original netns was restored, release the OS thread back into the - // schedulable pool. - runtime.UnlockOSThread() - - return nil - }, nil -} - -// unshare moves the calling OS thread of the calling goroutine to a new network -// namespace. Must only be called after a prior call to lockOSThread(). -func unshare() error { - if err := unix.Unshare(unix.CLONE_NEWNET); err != nil { - return err - } - return nil -} - -// set sets the underlying OS thread of the calling goroutine to the netns -// pointed at by f. -func set(f *os.File) error { - return unix.Setns(int(f.Fd()), unix.CLONE_NEWNET) -} - -// getCurrent gets a file descriptor to the current thread network namespace. -func getCurrent() (*os.File, error) { - return getFromThread(os.Getpid(), unix.Gettid()) -} - -// getFromPath gets a file descriptor to the network namespace pinned at path. -func getFromPath(path string) (*os.File, error) { - return os.OpenFile(path, unix.O_RDONLY|unix.O_CLOEXEC, 0) -} - -// getFromThread gets a file descriptor to the network namespace of a given pid -// and tid. -func getFromThread(pid, tid int) (*os.File, error) { - return getFromPath(fmt.Sprintf("/proc/%d/task/%d/ns/net", pid, tid)) -} diff --git a/vendor/github.com/cilium/cilium/pkg/netns/netns_other.go b/vendor/github.com/cilium/cilium/pkg/netns/netns_other.go deleted file mode 100644 index 2c4a687db..000000000 --- a/vendor/github.com/cilium/cilium/pkg/netns/netns_other.go +++ /dev/null @@ -1,32 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -//go:build !linux - -package netns - -import ( - "fmt" -) - -type NetNS struct{} - -func New() (*NetNS, error) { - return nil, fmt.Errorf("not implemented") -} - -func OpenPinned(string) (*NetNS, error) { - return nil, fmt.Errorf("not implemented") -} - -func (h *NetNS) FD() int { - return -1 -} - -func (h *NetNS) Close() error { - return fmt.Errorf("not implemented") -} - -func (h *NetNS) Do(func() error) error { - return fmt.Errorf("not implemented") -} diff --git a/vendor/github.com/cilium/cilium/pkg/node/address.go b/vendor/github.com/cilium/cilium/pkg/node/address.go deleted file mode 100644 index 0fad86ae0..000000000 --- a/vendor/github.com/cilium/cilium/pkg/node/address.go +++ /dev/null @@ -1,579 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package node - -import ( - "bufio" - "context" - "fmt" - "net" - "os" - "strconv" - "strings" - - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/api/v1/models" - "github.com/cilium/cilium/pkg/byteorder" - "github.com/cilium/cilium/pkg/cidr" - "github.com/cilium/cilium/pkg/common" - "github.com/cilium/cilium/pkg/defaults" - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/option" - wgTypes "github.com/cilium/cilium/pkg/wireguard/types" -) - -const preferPublicIP bool = true - -var ( - // addrsMu protects addrs. Outside the addresses struct - // so that we can Uninitialize() without linter complaining - // about lock copying. - addrsMu lock.RWMutex - addrs addresses - - // localNode holds the current state of the local "types.Node". - // This is defined here until all uses of the getters and - // setters in this file have been migrated to use LocalNodeStore - // directly. - // Initialized to proper instance via an invoke function in LocalNodeStoreCell, - // or temporarily in tests with 'WithTestLocalNodeStore'. - localNode *LocalNodeStore -) - -func getLocalNode() LocalNode { - n, err := localNode.Get(context.TODO()) - if err != nil { - // Only expecting errors if we're called after LocalNodeStore has stopped, e.g. - // we have a component that uses the legacy getters and setters here and does - // not depend on LocalNodeStore. - log.WithError(err).Fatal("getLocalNode: unexpected error") - } - return n -} - -type addresses struct { - ipv4Loopback net.IP - routerInfo RouterInfo -} - -type RouterInfo interface { - GetIPv4CIDRs() []net.IPNet -} - -func makeIPv6HostIP() net.IP { - ipstr := "fc00::10CA:1" - ip := net.ParseIP(ipstr) - if ip == nil { - log.WithField(logfields.IPAddr, ipstr).Fatal("Unable to parse IP") - } - - return ip -} - -// InitDefaultPrefix initializes the node address and allocation prefixes with -// default values derived from the system. device can be set to the primary -// network device of the system in which case the first address with global -// scope will be regarded as the system's node address. -func InitDefaultPrefix(device string) { - localNode.Update(func(n *LocalNode) { - SetDefaultPrefix(option.Config, device, n) - }) -} - -func SetDefaultPrefix(cfg *option.DaemonConfig, device string, node *LocalNode) { - if cfg.EnableIPv4 { - isIPv6 := false - - ip, err := firstGlobalV4Addr(device, node.GetCiliumInternalIP(isIPv6), preferPublicIP) - if err != nil { - return - } - - if node.GetNodeIP(isIPv6) == nil { - node.SetNodeInternalIP(ip) - } - - ipv4range := node.IPv4AllocCIDR - ipv6range := node.IPv6AllocCIDR - - if ipv4range == nil { - // If the IPv6AllocRange is not nil then the IPv4 allocation should be - // derived from the IPv6AllocRange. - // vvvv vvvv - // FD00:0000:0000:0000:0000:0000:0000:0000 - if ipv6range != nil { - ip = net.IPv4( - ipv6range.IP[8], - ipv6range.IP[9], - ipv6range.IP[10], - ipv6range.IP[11]) - } - v4range := fmt.Sprintf(defaults.DefaultIPv4Prefix+"/%d", - ip.To4()[3], defaults.DefaultIPv4PrefixLen) - _, ip4net, err := net.ParseCIDR(v4range) - if err != nil { - log.WithError(err).WithField(logfields.V4Prefix, v4range).Panic("BUG: Invalid default IPv4 prefix") - } - - node.IPv4AllocCIDR = cidr.NewCIDR(ip4net) - log.WithField(logfields.V4Prefix, node.IPv4AllocCIDR).Info("Using autogenerated IPv4 allocation range") - } - } - - if cfg.EnableIPv6 { - isIPv6 := true - ipv4range := node.IPv4AllocCIDR - ipv6range := node.IPv6AllocCIDR - - if node.GetNodeIP(isIPv6) == nil { - // Find a IPv6 node address first - addr, _ := firstGlobalV6Addr(device, node.GetCiliumInternalIP(isIPv6), preferPublicIP) - if addr == nil { - addr = makeIPv6HostIP() - } - node.SetNodeInternalIP(addr) - } - - if ipv6range == nil && ipv4range != nil { - // The IPv6 allocation should be derived from the IPv4 allocation. - ip := ipv4range.IP - v6range := fmt.Sprintf("%s%02x%02x:%02x%02x:0:0/%d", - cfg.IPv6ClusterAllocCIDRBase, ip[0], ip[1], ip[2], ip[3], 96) - - _, ip6net, err := net.ParseCIDR(v6range) - if err != nil { - log.WithError(err).WithField(logfields.V6Prefix, v6range).Panic("BUG: Invalid default IPv6 prefix") - } - - node.IPv6AllocCIDR = cidr.NewCIDR(ip6net) - log.WithField(logfields.V6Prefix, node.IPv6AllocCIDR).Info("Using autogenerated IPv6 allocation range") - } - } -} - -func clone(ip net.IP) net.IP { - if ip == nil { - return nil - } - dup := make(net.IP, len(ip)) - copy(dup, ip) - return dup -} - -// GetIPv4Loopback returns the loopback IPv4 address of this node. -func GetIPv4Loopback() net.IP { - addrsMu.RLock() - defer addrsMu.RUnlock() - return clone(addrs.ipv4Loopback) -} - -// SetIPv4Loopback sets the loopback IPv4 address of this node. -func SetIPv4Loopback(ip net.IP) { - addrsMu.Lock() - addrs.ipv4Loopback = clone(ip) - addrsMu.Unlock() -} - -// GetIPv4AllocRange returns the IPv4 allocation prefix of this node -func GetIPv4AllocRange() *cidr.CIDR { - return getLocalNode().IPv4AllocCIDR.DeepCopy() -} - -// GetIPv6AllocRange returns the IPv6 allocation prefix of this node -func GetIPv6AllocRange() *cidr.CIDR { - return getLocalNode().IPv6AllocCIDR.DeepCopy() -} - -// GetIPv4 returns one of the IPv4 node address available with the following -// priority: -// - NodeInternalIP -// - NodeExternalIP -// - other IP address type. -// It must be reachable on the network. -func GetIPv4() net.IP { - n := getLocalNode() - return clone(n.GetNodeIP(false)) -} - -// GetInternalIPv4 returns node internal ipv4 address else return nil. -func GetInternalIPv4() net.IP { - n := getLocalNode() - return clone(n.GetNodeInternalIPv4()) -} - -// GetInternalIPv6 returns node internal ipv6 address else return nil. -func GetInternalIPv6() net.IP { - n := getLocalNode() - return clone(n.GetNodeInternalIPv6()) -} - -// GetCiliumEndpointNodeIP is the node IP that will be referenced by CiliumEndpoints with endpoints -// running on this node. -func GetCiliumEndpointNodeIP() string { - if option.Config.EnableIPv4 { - return GetIPv4().String() - } - return GetIPv6().String() -} - -// SetInternalIPv4Router sets the cilium internal IPv4 node address, it is allocated from the node prefix. -// This must not be conflated with k8s internal IP as this IP address is only relevant within the -// Cilium-managed network (this means within the node for direct routing mode and on the overlay -// for tunnel mode). -func SetInternalIPv4Router(ip net.IP) { - localNode.Update(func(n *LocalNode) { - n.SetCiliumInternalIP(ip) - }) -} - -// GetInternalIPv4Router returns the cilium internal IPv4 node address. This must not be conflated with -// k8s internal IP as this IP address is only relevant within the Cilium-managed network (this means -// within the node for direct routing mode and on the overlay for tunnel mode). -func GetInternalIPv4Router() net.IP { - n := getLocalNode() - return n.GetCiliumInternalIP(false) -} - -// GetK8sExternalIPv4 returns the external IPv4 node address. It must be a public IP that is routable -// on the network as well as the internet. It can return nil if no External IPv4 address is assigned. -func GetK8sExternalIPv4() net.IP { - n := getLocalNode() - return n.GetExternalIP(false) -} - -// GetRouterInfo returns additional information for the router, the cilium_host interface. -func GetRouterInfo() RouterInfo { - addrsMu.RLock() - defer addrsMu.RUnlock() - return addrs.routerInfo -} - -// SetRouterInfo sets additional information for the router, the cilium_host interface. -func SetRouterInfo(info RouterInfo) { - addrsMu.Lock() - addrs.routerInfo = info - addrsMu.Unlock() -} - -// GetHostMasqueradeIPv4 returns the IPv4 address to be used for masquerading -// any traffic that is being forwarded from the host into the Cilium cluster. -func GetHostMasqueradeIPv4() net.IP { - return GetInternalIPv4Router() -} - -// SetIPv4AllocRange sets the IPv4 address pool to use when allocating -// addresses for local endpoints -func SetIPv4AllocRange(net *cidr.CIDR) { - localNode.Update(func(n *LocalNode) { - n.IPv4AllocCIDR = net - }) -} - -// SetIPv6NodeRange sets the IPv6 address pool to be used on this node -func SetIPv6NodeRange(net *cidr.CIDR) { - localNode.Update(func(n *LocalNode) { - n.IPv6AllocCIDR = net - }) -} - -// AutoComplete completes the parts of addressing that can be auto derived -func AutoComplete() error { - InitDefaultPrefix(option.Config.DirectRoutingDevice) - - if option.Config.EnableIPv6 && GetIPv6AllocRange() == nil { - return fmt.Errorf("IPv6 allocation CIDR is not configured. Please specify --%s", option.IPv6Range) - } - - if option.Config.EnableIPv4 && GetIPv4AllocRange() == nil { - return fmt.Errorf("IPv4 allocation CIDR is not configured. Please specify --%s", option.IPv4Range) - } - - return nil -} - -// ValidatePostInit validates the entire addressing setup and completes it as -// required -func ValidatePostInit() error { - if option.Config.EnableIPv4 || option.Config.TunnelingEnabled() { - if GetIPv4() == nil { - return fmt.Errorf("external IPv4 node address could not be derived, please configure via --ipv4-node") - } - } - - if option.Config.EnableIPv4 && GetInternalIPv4Router() == nil { - return fmt.Errorf("BUG: Internal IPv4 node address was not configured") - } - - return nil -} - -// GetIPv6 returns the IPv6 address of the node -func GetIPv6() net.IP { - n := getLocalNode() - return clone(n.GetNodeIP(true)) -} - -// GetHostMasqueradeIPv6 returns the IPv6 address to be used for masquerading -// any traffic that is being forwarded from the host into the Cilium cluster. -func GetHostMasqueradeIPv6() net.IP { - return GetIPv6Router() -} - -// GetIPv6Router returns the IPv6 address of the router, e.g. address -// of cilium_host device. -func GetIPv6Router() net.IP { - n := getLocalNode() - return clone(n.GetCiliumInternalIP(true)) -} - -// SetIPv6Router sets the IPv6 address of the router address, e.g. address -// of cilium_host device. -func SetIPv6Router(ip net.IP) { - localNode.Update(func(n *LocalNode) { - n.SetCiliumInternalIP(ip) - }) -} - -// GetK8sExternalIPv6 returns the external IPv6 node address. -func GetK8sExternalIPv6() net.IP { - n := getLocalNode() - return clone(n.GetExternalIP(false)) -} - -// GetNodeAddressing returns the NodeAddressing model for the local IPs. -func GetNodeAddressing() *models.NodeAddressing { - a := &models.NodeAddressing{} - - if option.Config.EnableIPv6 { - a.IPV6 = &models.NodeAddressingElement{ - Enabled: option.Config.EnableIPv6, - IP: GetIPv6Router().String(), - AllocRange: GetIPv6AllocRange().String(), - } - } - - if option.Config.EnableIPv4 { - a.IPV4 = &models.NodeAddressingElement{ - Enabled: option.Config.EnableIPv4, - IP: GetInternalIPv4Router().String(), - AllocRange: GetIPv4AllocRange().String(), - } - } - - return a -} - -func getCiliumHostIPsFromFile(nodeConfig string) (ipv4GW, ipv6Router net.IP) { - // ipLen is the length of the IP address stored in the node_config.h - // it has the same length for both IPv4 and IPv6. - const ipLen = net.IPv6len - - var hasIPv4, hasIPv6 bool - f, err := os.Open(nodeConfig) - switch { - case err != nil: - default: - defer f.Close() - scanner := bufio.NewScanner(f) - for scanner.Scan() { - txt := scanner.Text() - switch { - case !hasIPv6 && strings.Contains(txt, defaults.RestoreV6Addr): - defineLine := strings.Split(txt, defaults.RestoreV6Addr) - if len(defineLine) != 2 { - continue - } - ipv6 := common.C2GoArray(defineLine[1]) - if len(ipv6) != ipLen { - continue - } - ipv6Router = net.IP(ipv6) - hasIPv6 = true - case !hasIPv4 && strings.Contains(txt, defaults.RestoreV4Addr): - defineLine := strings.Split(txt, defaults.RestoreV4Addr) - if len(defineLine) != 2 { - continue - } - ipv4 := common.C2GoArray(defineLine[1]) - if len(ipv4) != ipLen { - continue - } - ipv4GW = net.IP(ipv4) - hasIPv4 = true - - // Legacy cases based on the header defines: - case !hasIPv4 && strings.Contains(txt, "IPV4_GATEWAY"): - // #define IPV4_GATEWAY 0xee1c000a - defineLine := strings.Split(txt, " ") - if len(defineLine) != 3 { - continue - } - ipv4GWHex := strings.TrimPrefix(defineLine[2], "0x") - ipv4GWUint64, err := strconv.ParseUint(ipv4GWHex, 16, 32) - if err != nil { - continue - } - if ipv4GWUint64 != 0 { - bs := make([]byte, net.IPv4len) - byteorder.Native.PutUint32(bs, uint32(ipv4GWUint64)) - ipv4GW = net.IPv4(bs[0], bs[1], bs[2], bs[3]) - hasIPv4 = true - } - case !hasIPv6 && strings.Contains(txt, " ROUTER_IP "): - // #define ROUTER_IP 0xf0, 0xd, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8a, 0xd6 - defineLine := strings.Split(txt, " ROUTER_IP ") - if len(defineLine) != 2 { - continue - } - ipv6 := common.C2GoArray(defineLine[1]) - if len(ipv6) != net.IPv6len { - continue - } - ipv6Router = net.IP(ipv6) - hasIPv6 = true - } - } - } - return ipv4GW, ipv6Router -} - -// ExtractCiliumHostIPFromFS returns the Cilium IPv4 gateway and router IPv6 address from -// the node_config.h file if is present; or by deriving it from -// defaults.HostDevice interface, on which only the IPv4 is possible to derive. -func ExtractCiliumHostIPFromFS() (ipv4GW, ipv6Router net.IP) { - nodeConfig := option.Config.GetNodeConfigPath() - ipv4GW, ipv6Router = getCiliumHostIPsFromFile(nodeConfig) - if ipv4GW != nil || ipv6Router != nil { - log.WithFields(logrus.Fields{ - "ipv4": ipv4GW, - "ipv6": ipv6Router, - "file": nodeConfig, - }).Info("Restored router address from node_config") - return ipv4GW, ipv6Router - } - return getCiliumHostIPsFromNetDev(defaults.HostDevice) -} - -// SetIPsecKeyIdentity sets the IPsec key identity an opaque value used to -// identity encryption keys used on the node. -func SetIPsecKeyIdentity(id uint8) { - localNode.Update(func(n *LocalNode) { - n.EncryptionKey = id - }) -} - -// GetK8sNodeIPs returns k8s Node IP addr. -func GetK8sNodeIP() net.IP { - n := getLocalNode() - return n.GetK8sNodeIP() -} - -func GetWireguardPubKey() string { - return getLocalNode().WireguardPubKey -} - -func GetOptOutNodeEncryption() bool { - return getLocalNode().OptOutNodeEncryption -} - -// SetEndpointHealthIPv4 sets the IPv4 cilium-health endpoint address. -func SetEndpointHealthIPv4(ip net.IP) { - localNode.Update(func(n *LocalNode) { - n.IPv4HealthIP = ip - }) -} - -// GetEndpointHealthIPv4 returns the IPv4 cilium-health endpoint address. -func GetEndpointHealthIPv4() net.IP { - return getLocalNode().IPv4HealthIP -} - -// SetEndpointHealthIPv6 sets the IPv6 cilium-health endpoint address. -func SetEndpointHealthIPv6(ip net.IP) { - localNode.Update(func(n *LocalNode) { - n.IPv6HealthIP = ip - }) -} - -// GetEndpointHealthIPv6 returns the IPv6 cilium-health endpoint address. -func GetEndpointHealthIPv6() net.IP { - return getLocalNode().IPv6HealthIP -} - -// SetIngressIPv4 sets the local IPv4 source address for Cilium Ingress. -func SetIngressIPv4(ip net.IP) { - localNode.Update(func(n *LocalNode) { - n.IPv4IngressIP = ip - }) -} - -// GetIngressIPv4 returns the local IPv4 source address for Cilium Ingress. -func GetIngressIPv4() net.IP { - return getLocalNode().IPv4IngressIP -} - -// SetIngressIPv6 sets the local IPv6 source address for Cilium Ingress. -func SetIngressIPv6(ip net.IP) { - localNode.Update(func(n *LocalNode) { - n.IPv6IngressIP = ip - }) -} - -// GetIngressIPv6 returns the local IPv6 source address for Cilium Ingress. -func GetIngressIPv6() net.IP { - return getLocalNode().IPv6IngressIP -} - -// GetEndpointEncryptKeyIndex returns the encryption key value for an endpoint -// owned by the local node. -// With IPSec encryption, this is the ID of the currently loaded key. -// With WireGuard, this returns a non-zero static value. -// Note that the key index returned by this function is only valid for _endpoints_ -// of the local node. If you want to obtain the key index of the local node itself, -// access the `EncryptionKey` field via the LocalNodeStore. -func GetEndpointEncryptKeyIndex() uint8 { - switch { - case option.Config.EnableIPSec: - return getLocalNode().EncryptionKey - case option.Config.EnableWireguard: - return wgTypes.StaticEncryptKey - - } - return 0 -} - -// WithTestLocalNodeStore sets the 'localNode' to a temporary instance and -// runs the given test. Afterwards the 'localNode' is restored to nil. -// This is a temporary workaround for tests until the LocalNodeStoreCell can be -// used. -func WithTestLocalNodeStore(runTest func()) { - SetTestLocalNodeStore() - defer UnsetTestLocalNodeStore() - runTest() -} - -func SetTestLocalNodeStore() { - if localNode != nil { - panic("localNode already set") - } - - // Set the localNode global variable temporarily so that the legacy getters - // and setters can access it. - localNode = NewTestLocalNodeStore(LocalNode{}) -} - -func UnsetTestLocalNodeStore() { - localNode = nil -} - -// UpdateLocalNodeInTest provides access to modifying the local node -// information from tests that are not yet using hive and the LocalNodeStoreCell. -func UpdateLocalNodeInTest(mod func(n *LocalNode)) { - if localNode == nil { - panic("localNode not set, use node.LocalNodeStoreCell or WithTestLocalNodeStore()?") - } - localNode.Update(mod) -} diff --git a/vendor/github.com/cilium/cilium/pkg/node/address_linux.go b/vendor/github.com/cilium/cilium/pkg/node/address_linux.go deleted file mode 100644 index 0f244f0bc..000000000 --- a/vendor/github.com/cilium/cilium/pkg/node/address_linux.go +++ /dev/null @@ -1,199 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -//go:build !darwin - -package node - -import ( - "fmt" - "net" - "sort" - - "github.com/sirupsen/logrus" - "github.com/vishvananda/netlink" - "golang.org/x/sys/unix" - - "github.com/cilium/cilium/pkg/ip" -) - -func firstGlobalAddr(intf string, preferredIP net.IP, family int, preferPublic bool) (net.IP, error) { - var link netlink.Link - var ipLen int - var err error - - ipsToExclude := GetExcludedIPs() - linkScopeMax := unix.RT_SCOPE_UNIVERSE - if family == netlink.FAMILY_V4 { - ipLen = 4 - } else { - ipLen = 16 - } - - if intf != "" && intf != "undefined" { - link, err = netlink.LinkByName(intf) - if err != nil { - link = nil - } else { - ipsToExclude = []net.IP{} - } - } - -retryInterface: - addr, err := netlink.AddrList(link, family) - if err != nil { - return nil, err - } - -retryScope: - ipsPublic := []netlink.Addr{} - ipsPrivate := []netlink.Addr{} - hasPreferred := false - - for _, a := range addr { - if a.Scope > linkScopeMax { - continue - } - if ip.ListContainsIP(ipsToExclude, a.IP) { - continue - } - if len(a.IP) < ipLen { - continue - } - isPreferredIP := a.IP.Equal(preferredIP) - if a.Flags&unix.IFA_F_SECONDARY > 0 && !isPreferredIP { - // Skip secondary addresses if they're not the preferredIP - continue - } - - if ip.IsPublicAddr(a.IP) { - ipsPublic = append(ipsPublic, a) - } else { - ipsPrivate = append(ipsPrivate, a) - } - // If the IP is the same as the preferredIP, that - // means that maybe it is restored from node_config.h, - // so if it is present we prefer this one, even if it - // is a secondary address. - if isPreferredIP { - hasPreferred = true - } - } - - if hasPreferred && !preferPublic { - return preferredIP, nil - } - - if len(ipsPublic) != 0 { - if hasPreferred && ip.IsPublicAddr(preferredIP) { - return preferredIP, nil - } - - // Just make sure that we always return the same one and not a - // random one. More info in the issue GH-7637. - sort.SliceStable(ipsPublic, func(i, j int) bool { - return ipsPublic[i].LinkIndex < ipsPublic[j].LinkIndex - }) - - return ipsPublic[0].IP, nil - } - - if len(ipsPrivate) != 0 { - if hasPreferred && !ip.IsPublicAddr(preferredIP) { - return preferredIP, nil - } - - // Same stable order, see above ipsPublic. - sort.SliceStable(ipsPrivate, func(i, j int) bool { - return ipsPrivate[i].LinkIndex < ipsPrivate[j].LinkIndex - }) - - return ipsPrivate[0].IP, nil - } - - // First, if a device is specified, fall back to anything wider - // than link (site, custom, ...) before trying all devices. - if linkScopeMax != unix.RT_SCOPE_SITE { - linkScopeMax = unix.RT_SCOPE_SITE - goto retryScope - } - - // Fall back with retry for all interfaces with full scope again - // (which then goes back to lower scope again for all interfaces - // before we give up completely). - if link != nil { - linkScopeMax = unix.RT_SCOPE_UNIVERSE - link = nil - goto retryInterface - } - - return nil, fmt.Errorf("No address found") -} - -// firstGlobalV4Addr returns the first IPv4 global IP of an interface, -// where the IPs are sorted in creation order (oldest to newest). -// -// All secondary IPs, except the preferredIP, are filtered out. -// -// Public IPs are preferred over private ones. When intf is defined only -// IPs belonging to that interface are considered. -// -// If preferredIP is present in the IP list it is returned irrespective of -// the sort order. However, if preferPublic is true and preferredIP is a -// private IP, a public IP will be returned if it is assigned to the intf -// -// Passing intf and preferredIP will only return preferredIP if it is in -// the IPs that belong to intf. -// -// In all cases, if intf is not found all interfaces are considered. -// -// If a intf-specific global address couldn't be found, we retry to find -// an address with reduced scope (site, custom) on that particular device. -// -// If the latter fails as well, we retry on all interfaces beginning with -// universe scope again (and then falling back to reduced scope). -// -// In case none of the above helped, we bail out with error. -func firstGlobalV4Addr(intf string, preferredIP net.IP, preferPublic bool) (net.IP, error) { - return firstGlobalAddr(intf, preferredIP, netlink.FAMILY_V4, preferPublic) -} - -// firstGlobalV6Addr returns first IPv6 global IP of an interface, see -// firstGlobalV4Addr for more details. -func firstGlobalV6Addr(intf string, preferredIP net.IP, preferPublic bool) (net.IP, error) { - return firstGlobalAddr(intf, preferredIP, netlink.FAMILY_V6, preferPublic) -} - -// getCiliumHostIPsFromNetDev returns the first IPv4 link local and returns -// it -func getCiliumHostIPsFromNetDev(devName string) (ipv4GW, ipv6Router net.IP) { - hostDev, err := netlink.LinkByName(devName) - if err != nil { - return nil, nil - } - addrs, err := netlink.AddrList(hostDev, netlink.FAMILY_ALL) - if err != nil { - return nil, nil - } - for _, addr := range addrs { - if addr.IP.To4() != nil { - if addr.Scope == int(netlink.SCOPE_LINK) { - ipv4GW = addr.IP - } - } else { - if addr.Scope != int(netlink.SCOPE_LINK) { - ipv6Router = addr.IP - } - } - } - - if ipv4GW != nil || ipv6Router != nil { - log.WithFields(logrus.Fields{ - "ipv4": ipv4GW, - "ipv6": ipv6Router, - "device": devName, - }).Info("Restored router address from device") - } - - return ipv4GW, ipv6Router -} diff --git a/vendor/github.com/cilium/cilium/pkg/node/address_other.go b/vendor/github.com/cilium/cilium/pkg/node/address_other.go deleted file mode 100644 index af2ba9fae..000000000 --- a/vendor/github.com/cilium/cilium/pkg/node/address_other.go +++ /dev/null @@ -1,34 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -//go:build !linux - -package node - -import "net" - -func firstGlobalAddr(intf string, preferredIP net.IP, family int, preferPublic bool) (net.IP, error) { - return net.IP{}, nil -} - -func firstGlobalV4Addr(intf string, preferredIP net.IP, preferPublic bool) (net.IP, error) { - return net.IP{}, nil -} - -func firstGlobalV6Addr(intf string, preferredIP net.IP, preferPublic bool) (net.IP, error) { - return net.IP{}, nil -} - -func initMasqueradeV4Addrs(masqAddrs map[string]net.IP, masqIPFromDevice string, devices []string, logfield string) error { - return nil -} - -func initMasqueradeV6Addrs(masqAddrs map[string]net.IP, masqIPFromDevice string, devices []string, logfield string) error { - return nil -} - -// getCiliumHostIPsFromNetDev returns the first IPv4 link local and returns -// it -func getCiliumHostIPsFromNetDev(devName string) (ipv4GW, ipv6Router net.IP) { - return net.IP{}, net.IP{} -} diff --git a/vendor/github.com/cilium/cilium/pkg/node/addressing/addresstype.go b/vendor/github.com/cilium/cilium/pkg/node/addressing/addresstype.go deleted file mode 100644 index 345786de3..000000000 --- a/vendor/github.com/cilium/cilium/pkg/node/addressing/addresstype.go +++ /dev/null @@ -1,65 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package addressing - -import ( - "net" -) - -// AddressType represents a type of IP address for a node. They are copied -// from k8s.io/api/core/v1/types.go to avoid pulling in a lot of Kubernetes -// imports into this package. -type AddressType string - -const ( - NodeHostName AddressType = "Hostname" - NodeExternalIP AddressType = "ExternalIP" - NodeInternalIP AddressType = "InternalIP" - NodeExternalDNS AddressType = "ExternalDNS" - NodeInternalDNS AddressType = "InternalDNS" - NodeCiliumInternalIP AddressType = "CiliumInternalIP" -) - -type Address interface { - AddrType() AddressType - ToString() string -} - -// ExtractNodeIP returns one of the provided IP addresses available with the following priority: -// - NodeInternalIP -// - NodeExternalIP -// - other IP address type -// An error is returned if ExtractNodeIP fails to get an IP based on the provided address family. -func ExtractNodeIP[T Address](addrs []T, ipv6 bool) net.IP { - var backupIP net.IP - for _, addr := range addrs { - parsed := net.ParseIP(addr.ToString()) - if parsed == nil { - continue - } - if (ipv6 && parsed.To4() != nil) || - (!ipv6 && parsed.To4() == nil) { - continue - } - switch addr.AddrType() { - // Ignore CiliumInternalIPs - case NodeCiliumInternalIP: - continue - // Always prefer a cluster internal IP - case NodeInternalIP: - return parsed - case NodeExternalIP: - // Fall back to external Node IP - // if no internal IP could be found - backupIP = parsed - default: - // As a last resort, if no internal or external - // IP was found, use any node address available - if backupIP == nil { - backupIP = parsed - } - } - } - return backupIP -} diff --git a/vendor/github.com/cilium/cilium/pkg/node/bootid.go b/vendor/github.com/cilium/cilium/pkg/node/bootid.go deleted file mode 100644 index 734574999..000000000 --- a/vendor/github.com/cilium/cilium/pkg/node/bootid.go +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package node - -import "sync" - -var ( - localBootID string - logOnce sync.Once -) - -func GetBootID() string { - logOnce.Do(func() { - log.Infof("Local boot ID is %q", localBootID) - }) - return localBootID -} diff --git a/vendor/github.com/cilium/cilium/pkg/node/bootid_linux.go b/vendor/github.com/cilium/cilium/pkg/node/bootid_linux.go deleted file mode 100644 index c3ba1b5d6..000000000 --- a/vendor/github.com/cilium/cilium/pkg/node/bootid_linux.go +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package node - -import ( - "io/ioutil" - "strings" -) - -var bootIDFilePath = "/proc/sys/kernel/random/boot_id" - -func init() { - bootID, err := ioutil.ReadFile(bootIDFilePath) - if err != nil { - log.WithError(err).Warnf("Could not read boot id from %s", bootIDFilePath) - return - } - localBootID = strings.TrimSpace(string(bootID)) -} diff --git a/vendor/github.com/cilium/cilium/pkg/node/doc.go b/vendor/github.com/cilium/cilium/pkg/node/doc.go deleted file mode 100644 index 076044279..000000000 --- a/vendor/github.com/cilium/cilium/pkg/node/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Package node provides functionality related to the local and remote node -// addresses -package node diff --git a/vendor/github.com/cilium/cilium/pkg/node/host_endpoint.go b/vendor/github.com/cilium/cilium/pkg/node/host_endpoint.go deleted file mode 100644 index 4296484fe..000000000 --- a/vendor/github.com/cilium/cilium/pkg/node/host_endpoint.go +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package node - -const ( - templateHostEndpointID = uint64(0xffff) -) - -var ( - endpointID = templateHostEndpointID -) - -// GetEndpointID returns the ID of the host endpoint for this node. -func GetEndpointID() uint64 { - return endpointID -} - -// SetEndpointID sets the ID of the host endpoint this node. -func SetEndpointID(id uint64) { - endpointID = id -} diff --git a/vendor/github.com/cilium/cilium/pkg/node/ip.go b/vendor/github.com/cilium/cilium/pkg/node/ip.go deleted file mode 100644 index fe3a76e6e..000000000 --- a/vendor/github.com/cilium/cilium/pkg/node/ip.go +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package node - -import "net" - -var excludedIPs []net.IP - -// GetExcludedIPs returns a list of IPs from netdevices that Cilium -// needs to exclude to operate -func GetExcludedIPs() []net.IP { - return excludedIPs -} diff --git a/vendor/github.com/cilium/cilium/pkg/node/ip_linux.go b/vendor/github.com/cilium/cilium/pkg/node/ip_linux.go deleted file mode 100644 index 21a7176fc..000000000 --- a/vendor/github.com/cilium/cilium/pkg/node/ip_linux.go +++ /dev/null @@ -1,52 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package node - -import ( - "strings" - - "github.com/vishvananda/netlink" -) - -func init() { - initExcludedIPs() -} - -func initExcludedIPs() { - // We exclude below bad device prefixes from address selection ... - prefixes := []string{ - "docker", - } - links, err := netlink.LinkList() - if err != nil { - return - } - for _, l := range links { - // ... also all down devices since they won't be reachable. - // - // We need to check for both "up" and "unknown" state, as some - // drivers may not implement operstate handling, and just report - // their state as unknown even though they are operational. - if l.Attrs().OperState == netlink.OperUp || - l.Attrs().OperState == netlink.OperUnknown { - skip := true - for _, p := range prefixes { - if strings.HasPrefix(l.Attrs().Name, p) { - skip = false - break - } - } - if skip { - continue - } - } - addr, err := netlink.AddrList(l, netlink.FAMILY_ALL) - if err != nil { - continue - } - for _, a := range addr { - excludedIPs = append(excludedIPs, a.IP) - } - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/node/local_node_store.go b/vendor/github.com/cilium/cilium/pkg/node/local_node_store.go deleted file mode 100644 index 8c81bdb25..000000000 --- a/vendor/github.com/cilium/cilium/pkg/node/local_node_store.go +++ /dev/null @@ -1,207 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package node - -import ( - "context" - "io" - "sync" - - "github.com/cilium/hive/cell" - "github.com/cilium/stream" - k8stypes "k8s.io/apimachinery/pkg/types" - - "github.com/cilium/cilium/pkg/cidr" - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/node/types" -) - -type LocalNode struct { - types.Node - // OptOutNodeEncryption will make the local node opt-out of node-to-node - // encryption - OptOutNodeEncryption bool - // Unique identifier of the Kubernetes node, used to construct the - // corresponding owner reference. - UID k8stypes.UID - // ID of the node assigned by the cloud provider. - ProviderID string - // v4 CIDR in which pod IPs are routable - IPv4NativeRoutingCIDR *cidr.CIDR - // v6 CIDR in which pod IPs are routable - IPv6NativeRoutingCIDR *cidr.CIDR -} - -// LocalNodeSynchronizer specifies how to build, and keep synchronized the local -// node object. -type LocalNodeSynchronizer interface { - InitLocalNode(context.Context, *LocalNode) error - SyncLocalNode(context.Context, *LocalNodeStore) -} - -// LocalNodeStoreCell provides the LocalNodeStore instance. -// The LocalNodeStore is the canonical owner of `types.Node` for the local node and -// provides a reactive API for observing and updating it. -var LocalNodeStoreCell = cell.Module( - "local-node-store", - "Provides LocalNodeStore for observing and updating local node info", - - cell.Provide(NewLocalNodeStore), -) - -// LocalNodeStoreParams are the inputs needed for constructing LocalNodeStore. -type LocalNodeStoreParams struct { - cell.In - - Lifecycle cell.Lifecycle - Sync LocalNodeSynchronizer `optional:"true"` -} - -// LocalNodeStore is the canonical owner for the local node object and provides -// a reactive API for observing and updating the state. -type LocalNodeStore struct { - // Changes to the local node are observable. - stream.Observable[LocalNode] - - // mu is the main LocalNodeStore mutex, which protects the access to the - // different fields during all operations. getMu, instead, is a separate - // mutex which is used to guard updates of the value field, as well as its - // access by the Get() method. The reason for using two separate mutexes - // being that we don't want Get() to be blocked while calling emit, as - // that synchronously calls into all subscribers, which is a potentially - // expensive operation, and a possible source of deadlocks (e.g., one of - // the subscribers needs to acquire another mutex, which is held by a - // separate goroutine trying to call LocalNodeStore.Get()). In addition, - // getMu also guards the complete field, as it is used by Get() to - // determine that the LocalNodeStore was stopped. When both mu and getMu - // are to be acquired together, mu shall be always acquired first. - mu lock.Mutex - getMu lock.RWMutex - - value LocalNode - hasValue <-chan struct{} - emit func(LocalNode) - complete func(error) -} - -func NewTestLocalNodeStore(mockNode LocalNode) *LocalNodeStore { - src, emit, complete := stream.Multicast[LocalNode](stream.EmitLatest) - emit(mockNode) - return &LocalNodeStore{ - Observable: src, - emit: emit, - complete: complete, - value: mockNode, - hasValue: func() <-chan struct{} { - ch := make(chan struct{}) - close(ch) - return ch - }(), - } -} - -func NewLocalNodeStore(params LocalNodeStoreParams) (*LocalNodeStore, error) { - src, emit, complete := stream.Multicast[LocalNode](stream.EmitLatest) - hasValue := make(chan struct{}) - - s := &LocalNodeStore{ - Observable: src, - value: LocalNode{Node: types.Node{ - // Explicitly initialize the labels and annotations maps, so that - // we don't need to always check for nil values. - Labels: make(map[string]string), - Annotations: make(map[string]string), - }}, - hasValue: hasValue, - } - - bctx, cancel := context.WithCancel(context.Background()) - var wg sync.WaitGroup - - params.Lifecycle.Append(cell.Hook{ - OnStart: func(ctx cell.HookContext) error { - s.mu.Lock() - defer s.mu.Unlock() - if params.Sync != nil { - if err := params.Sync.InitLocalNode(ctx, &s.value); err != nil { - return err - } - - // Start the synchronization process in background - wg.Add(1) - go func() { - params.Sync.SyncLocalNode(bctx, s) - wg.Done() - }() - } - - // Set the global variable still used by getters - // and setters in address.go. We're setting it in Start - // to catch uses of it before it's initialized. - localNode = s - - s.emit = emit - s.complete = complete - emit(s.value) - close(hasValue) - return nil - }, - OnStop: func(cell.HookContext) error { - // Stop the synchronization process (no-op if it had not been started) - cancel() - wg.Wait() - - s.mu.Lock() - s.complete(nil) - s.getMu.Lock() - s.complete = nil - s.emit = nil - s.getMu.Unlock() - s.mu.Unlock() - - localNode = nil - return nil - }, - }) - - return s, nil -} - -// Get retrieves the current local node. Use Get() only for inspecting the state, -// e.g. in API handlers. Do not assume the value does not change over time. -// Blocks until the store has been initialized. -func (s *LocalNodeStore) Get(ctx context.Context) (LocalNode, error) { - select { - case <-s.hasValue: - s.getMu.RLock() - defer s.getMu.RUnlock() - - if s.complete == nil { - // Return EOF when the LocalNodeStore is stopped, to preserve the - // same behavior of stream.First[LocalNode]. - return LocalNode{}, io.EOF - } - - return s.value, nil - - case <-ctx.Done(): - return LocalNode{}, ctx.Err() - } -} - -// Update modifies the local node with a mutator. The updated value -// is passed to observers. Calling LocalNodeStore.Get() from the -// mutation function is forbidden, and would result in a deadlock. -func (s *LocalNodeStore) Update(update func(*LocalNode)) { - s.mu.Lock() - defer s.mu.Unlock() - - s.getMu.Lock() - update(&s.value) - s.getMu.Unlock() - - if s.emit != nil { - s.emit(s.value) - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/node/logfields.go b/vendor/github.com/cilium/cilium/pkg/node/logfields.go deleted file mode 100644 index 5b12bc9f1..000000000 --- a/vendor/github.com/cilium/cilium/pkg/node/logfields.go +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package node - -import ( - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" -) - -var log = logging.DefaultLogger.WithField(logfields.LogSubsys, "node") diff --git a/vendor/github.com/cilium/cilium/pkg/node/types/logfields.go b/vendor/github.com/cilium/cilium/pkg/node/types/logfields.go deleted file mode 100644 index f992f9136..000000000 --- a/vendor/github.com/cilium/cilium/pkg/node/types/logfields.go +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package types - -import ( - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" -) - -var log = logging.DefaultLogger.WithField(logfields.LogSubsys, "node") diff --git a/vendor/github.com/cilium/cilium/pkg/node/types/node.go b/vendor/github.com/cilium/cilium/pkg/node/types/node.go deleted file mode 100644 index 42ce0e3b3..000000000 --- a/vendor/github.com/cilium/cilium/pkg/node/types/node.go +++ /dev/null @@ -1,664 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package types - -import ( - "encoding/json" - "fmt" - "net" - "path" - "slices" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - "github.com/cilium/cilium/api/v1/models" - "github.com/cilium/cilium/pkg/annotation" - "github.com/cilium/cilium/pkg/cidr" - cmtypes "github.com/cilium/cilium/pkg/clustermesh/types" - "github.com/cilium/cilium/pkg/defaults" - ipamTypes "github.com/cilium/cilium/pkg/ipam/types" - ciliumv2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2" - "github.com/cilium/cilium/pkg/kvstore/store" - "github.com/cilium/cilium/pkg/node/addressing" - "github.com/cilium/cilium/pkg/option" - "github.com/cilium/cilium/pkg/source" -) - -// Identity represents the node identity of a node. -type Identity struct { - Name string - Cluster string -} - -// String returns the string representation on NodeIdentity. -func (nn Identity) String() string { - return path.Join(nn.Cluster, nn.Name) -} - -// appendAllocCDIR sets or appends the given podCIDR to the node. -// If the IPv4/IPv6AllocCIDR is already set, we add the podCIDR as a secondary -// alloc CIDR. -func (n *Node) appendAllocCDIR(podCIDR *cidr.CIDR) { - if podCIDR.IP.To4() != nil { - if n.IPv4AllocCIDR == nil { - n.IPv4AllocCIDR = podCIDR - } else { - n.IPv4SecondaryAllocCIDRs = append(n.IPv4SecondaryAllocCIDRs, podCIDR) - } - } else { - if n.IPv6AllocCIDR == nil { - n.IPv6AllocCIDR = podCIDR - } else { - n.IPv6SecondaryAllocCIDRs = append(n.IPv6SecondaryAllocCIDRs, podCIDR) - } - } -} - -// ParseCiliumNode parses a CiliumNode custom resource and returns a Node -// instance. Invalid IP and CIDRs are silently ignored -func ParseCiliumNode(n *ciliumv2.CiliumNode) (node Node) { - wireguardPubKey, _ := annotation.Get(n, annotation.WireguardPubKey, annotation.WireguardPubKeyAlias) - node = Node{ - Name: n.Name, - EncryptionKey: uint8(n.Spec.Encryption.Key), - Cluster: option.Config.ClusterName, - ClusterID: option.Config.ClusterID, - Source: source.CustomResource, - Labels: n.ObjectMeta.Labels, - Annotations: n.ObjectMeta.Annotations, - NodeIdentity: uint32(n.Spec.NodeIdentity), - WireguardPubKey: wireguardPubKey, - BootID: n.Spec.BootID, - } - - for _, cidrString := range n.Spec.IPAM.PodCIDRs { - ipnet, err := cidr.ParseCIDR(cidrString) - if err == nil { - node.appendAllocCDIR(ipnet) - } - } - - for _, pool := range n.Spec.IPAM.Pools.Allocated { - for _, podCIDR := range pool.CIDRs { - ipnet, err := cidr.ParseCIDR(string(podCIDR)) - if err == nil { - node.appendAllocCDIR(ipnet) - } - } - } - - node.IPv4HealthIP = net.ParseIP(n.Spec.HealthAddressing.IPv4) - node.IPv6HealthIP = net.ParseIP(n.Spec.HealthAddressing.IPv6) - - node.IPv4IngressIP = net.ParseIP(n.Spec.IngressAddressing.IPV4) - node.IPv6IngressIP = net.ParseIP(n.Spec.IngressAddressing.IPV6) - - for _, address := range n.Spec.Addresses { - if ip := net.ParseIP(address.IP); ip != nil { - node.IPAddresses = append(node.IPAddresses, Address{Type: address.Type, IP: ip}) - } - } - - return -} - -// ToCiliumNode converts the node to a CiliumNode -func (n *Node) ToCiliumNode() *ciliumv2.CiliumNode { - var ( - podCIDRs []string - ipAddrs []ciliumv2.NodeAddress - healthIPv4, healthIPv6 string - ingressIPv4, ingressIPv6 string - ) - - if n.IPv4AllocCIDR != nil { - podCIDRs = append(podCIDRs, n.IPv4AllocCIDR.String()) - } - if n.IPv6AllocCIDR != nil { - podCIDRs = append(podCIDRs, n.IPv6AllocCIDR.String()) - } - for _, ipv4AllocCIDR := range n.IPv4SecondaryAllocCIDRs { - podCIDRs = append(podCIDRs, ipv4AllocCIDR.String()) - } - for _, ipv6AllocCIDR := range n.IPv6SecondaryAllocCIDRs { - podCIDRs = append(podCIDRs, ipv6AllocCIDR.String()) - } - if n.IPv4HealthIP != nil { - healthIPv4 = n.IPv4HealthIP.String() - } - if n.IPv6HealthIP != nil { - healthIPv6 = n.IPv6HealthIP.String() - } - if n.IPv4IngressIP != nil { - ingressIPv4 = n.IPv4IngressIP.String() - } - if n.IPv6IngressIP != nil { - ingressIPv6 = n.IPv6IngressIP.String() - } - - for _, address := range n.IPAddresses { - ipAddrs = append(ipAddrs, ciliumv2.NodeAddress{ - Type: address.Type, - IP: address.IP.String(), - }) - } - - return &ciliumv2.CiliumNode{ - ObjectMeta: v1.ObjectMeta{ - Name: n.Name, - Labels: n.Labels, - Annotations: n.Annotations, - }, - Spec: ciliumv2.NodeSpec{ - Addresses: ipAddrs, - HealthAddressing: ciliumv2.HealthAddressingSpec{ - IPv4: healthIPv4, - IPv6: healthIPv6, - }, - IngressAddressing: ciliumv2.AddressPair{ - IPV4: ingressIPv4, - IPV6: ingressIPv6, - }, - Encryption: ciliumv2.EncryptionSpec{ - Key: int(n.EncryptionKey), - }, - IPAM: ipamTypes.IPAMSpec{ - PodCIDRs: podCIDRs, - }, - NodeIdentity: uint64(n.NodeIdentity), - BootID: n.BootID, - }, - } -} - -// RegisterNode overloads GetKeyName to ignore the cluster name, as cluster name may not be stable during node registration. -// -// +k8s:deepcopy-gen=true -type RegisterNode struct { - Node -} - -// GetKeyName Overloaded key name w/o cluster name -func (n *RegisterNode) GetKeyName() string { - return n.Name -} - -// DeepKeyCopy creates a deep copy of the LocalKey -func (n *RegisterNode) DeepKeyCopy() store.LocalKey { - return n.DeepCopy() -} - -func (n *RegisterNode) Unmarshal(_ string, data []byte) error { - newNode := Node{} - if err := json.Unmarshal(data, &newNode); err != nil { - return err - } - - n.Node = newNode - return nil -} - -// Node contains the nodes name, the list of addresses to this address -// -// +k8s:deepcopy-gen=true -type Node struct { - // Name is the name of the node. This is typically the hostname of the node. - Name string - - // Cluster is the name of the cluster the node is associated with - Cluster string - - IPAddresses []Address - - // IPv4AllocCIDR if set, is the IPv4 address pool out of which the node - // allocates IPs for local endpoints from - IPv4AllocCIDR *cidr.CIDR - - // IPv4SecondaryAllocCIDRs contains additional IPv4 CIDRs from which this - //node allocates IPs for its local endpoints from - IPv4SecondaryAllocCIDRs []*cidr.CIDR - - // IPv6AllocCIDR if set, is the IPv6 address pool out of which the node - // allocates IPs for local endpoints from - IPv6AllocCIDR *cidr.CIDR - - // IPv6SecondaryAllocCIDRs contains additional IPv6 CIDRs from which this - // node allocates IPs for its local endpoints from - IPv6SecondaryAllocCIDRs []*cidr.CIDR - - // IPv4HealthIP if not nil, this is the IPv4 address of the - // cilium-health endpoint located on the node. - IPv4HealthIP net.IP - - // IPv6HealthIP if not nil, this is the IPv6 address of the - // cilium-health endpoint located on the node. - IPv6HealthIP net.IP - - // IPv4IngressIP if not nil, this is the IPv4 address of the - // Ingress listener on the node. - IPv4IngressIP net.IP - - // IPv6IngressIP if not nil, this is the IPv6 address of the - // Ingress listener located on the node. - IPv6IngressIP net.IP - - // ClusterID is the unique identifier of the cluster - ClusterID uint32 - - // Source is the source where the node configuration was generated / created. - Source source.Source - - // Key index used for transparent encryption or 0 for no encryption - EncryptionKey uint8 - - // Node labels - Labels map[string]string - - // Node annotations - Annotations map[string]string - - // NodeIdentity is the numeric identity allocated for the node - NodeIdentity uint32 - - // WireguardPubKey is the WireGuard public key of this node - WireguardPubKey string - - // BootID is a unique node identifier generated on boot - BootID string -} - -// Fullname returns the node's full name including the cluster name if a -// cluster name value other than the default value has been specified -func (n *Node) Fullname() string { - if n.Cluster != defaults.ClusterName { - return path.Join(n.Cluster, n.Name) - } - - return n.Name -} - -// Address is a node address which contains an IP and the address type. -// -// +k8s:deepcopy-gen=true -type Address struct { - Type addressing.AddressType - IP net.IP -} - -func (a Address) ToString() string { - return a.IP.String() -} - -func (a Address) AddrType() addressing.AddressType { - return a.Type -} - -// GetNodeIP returns one of the node's IP addresses available with the -// following priority: -// - NodeInternalIP -// - NodeExternalIP -// - other IP address type -// Nil is returned if GetNodeIP fails to extract an IP from the Node based -// on the provided address family. -func (n *Node) GetNodeIP(ipv6 bool) net.IP { - return addressing.ExtractNodeIP[Address](n.IPAddresses, ipv6) -} - -// GetExternalIP returns ExternalIP of k8s Node. If not present, then it -// returns nil; -func (n *Node) GetExternalIP(ipv6 bool) net.IP { - for _, addr := range n.IPAddresses { - if (ipv6 && addr.IP.To4() != nil) || (!ipv6 && addr.IP.To4() == nil) { - continue - } - if addr.Type == addressing.NodeExternalIP { - return addr.IP - } - } - - return nil -} - -// GetK8sNodeIPs returns k8s Node IP (either InternalIP or ExternalIP or nil; -// the former is preferred). -func (n *Node) GetK8sNodeIP() net.IP { - var externalIP net.IP - - for _, addr := range n.IPAddresses { - if addr.Type == addressing.NodeInternalIP { - return addr.IP - } else if addr.Type == addressing.NodeExternalIP { - externalIP = addr.IP - } - } - - return externalIP -} - -// GetNodeInternalIP returns the Internal IPv4 of node or nil. -func (n *Node) GetNodeInternalIPv4() net.IP { - for _, addr := range n.IPAddresses { - if addr.IP.To4() == nil { - continue - } - if addr.Type == addressing.NodeInternalIP { - return addr.IP - } - } - - return nil -} - -// GetNodeInternalIP returns the Internal IPv6 of node or nil. -func (n *Node) GetNodeInternalIPv6() net.IP { - for _, addr := range n.IPAddresses { - if addr.IP.To4() != nil { - continue - } - if addr.Type == addressing.NodeInternalIP { - return addr.IP - } - } - - return nil -} - -// GetCiliumInternalIP returns the CiliumInternalIP e.g. the IP associated -// with cilium_host on the node. -func (n *Node) GetCiliumInternalIP(ipv6 bool) net.IP { - for _, addr := range n.IPAddresses { - if (ipv6 && addr.IP.To4() != nil) || - (!ipv6 && addr.IP.To4() == nil) { - continue - } - if addr.Type == addressing.NodeCiliumInternalIP { - return addr.IP - } - } - return nil -} - -// SetCiliumInternalIP sets the CiliumInternalIP e.g. the IP associated -// with cilium_host on the node. -func (n *Node) SetCiliumInternalIP(newAddr net.IP) { - n.setAddress(addressing.NodeCiliumInternalIP, newAddr) -} - -// SetNodeExternalIP sets the NodeExternalIP. -func (n *Node) SetNodeExternalIP(newAddr net.IP) { - n.setAddress(addressing.NodeExternalIP, newAddr) -} - -// SetNodeInternalIP sets the NodeInternalIP. -func (n *Node) SetNodeInternalIP(newAddr net.IP) { - n.setAddress(addressing.NodeInternalIP, newAddr) -} - -func (n *Node) RemoveAddresses(typ addressing.AddressType) { - newAddresses := []Address{} - for _, addr := range n.IPAddresses { - if addr.Type != typ { - newAddresses = append(newAddresses, addr) - } - } - n.IPAddresses = newAddresses -} - -func (n *Node) setAddress(typ addressing.AddressType, newIP net.IP) { - newAddr := Address{Type: typ, IP: newIP} - - if newIP == nil { - n.RemoveAddresses(typ) - return - } - - // Create a copy of the slice, so that we don't modify the - // current one, which may be captured by any of the observers. - n.IPAddresses = slices.Clone(n.IPAddresses) - - ipv6 := newIP.To4() == nil - // Try first to replace an existing address with same type - for i, addr := range n.IPAddresses { - if addr.Type != typ { - continue - } - if ipv6 != (addr.IP.To4() == nil) { - // Don't replace if address family is different. - continue - } - n.IPAddresses[i] = newAddr - return - } - n.IPAddresses = append(n.IPAddresses, newAddr) - -} - -func (n *Node) GetIPByType(addrType addressing.AddressType, ipv6 bool) net.IP { - for _, addr := range n.IPAddresses { - if addr.Type != addrType { - continue - } - if is4 := addr.IP.To4() != nil; (!ipv6 && is4) || (ipv6 && !is4) { - return addr.IP - } - } - return nil -} - -func (n *Node) getPrimaryAddress() *models.NodeAddressing { - v4 := n.GetNodeIP(false) - v6 := n.GetNodeIP(true) - - var ipv4AllocStr, ipv6AllocStr string - if n.IPv4AllocCIDR != nil { - ipv4AllocStr = n.IPv4AllocCIDR.String() - } - if n.IPv6AllocCIDR != nil { - ipv6AllocStr = n.IPv6AllocCIDR.String() - } - - var v4Str, v6Str string - if v4 != nil { - v4Str = v4.String() - } - if v6 != nil { - v6Str = v6.String() - } - - return &models.NodeAddressing{ - IPV4: &models.NodeAddressingElement{ - Enabled: option.Config.EnableIPv4, - IP: v4Str, - AllocRange: ipv4AllocStr, - }, - IPV6: &models.NodeAddressingElement{ - Enabled: option.Config.EnableIPv6, - IP: v6Str, - AllocRange: ipv6AllocStr, - }, - } -} - -func (n *Node) isPrimaryAddress(addr Address, ipv4 bool) bool { - return addr.IP.String() == n.GetNodeIP(!ipv4).String() -} - -func (n *Node) getSecondaryAddresses() []*models.NodeAddressingElement { - result := []*models.NodeAddressingElement{} - - for _, addr := range n.IPAddresses { - ipv4 := false - if addr.IP.To4() != nil { - ipv4 = true - } - if !n.isPrimaryAddress(addr, ipv4) { - result = append(result, &models.NodeAddressingElement{ - IP: addr.IP.String(), - }) - } - } - - return result -} - -func (n *Node) getHealthAddresses() *models.NodeAddressing { - if n.IPv4HealthIP == nil && n.IPv6HealthIP == nil { - return nil - } - - var v4Str, v6Str string - if n.IPv4HealthIP != nil { - v4Str = n.IPv4HealthIP.String() - } - if n.IPv6HealthIP != nil { - v6Str = n.IPv6HealthIP.String() - } - - return &models.NodeAddressing{ - IPV4: &models.NodeAddressingElement{ - Enabled: option.Config.EnableIPv4, - IP: v4Str, - }, - IPV6: &models.NodeAddressingElement{ - Enabled: option.Config.EnableIPv6, - IP: v6Str, - }, - } -} - -func (n *Node) getIngressAddresses() *models.NodeAddressing { - if n.IPv4IngressIP == nil && n.IPv6IngressIP == nil { - return nil - } - - var v4Str, v6Str string - if n.IPv4IngressIP != nil { - v4Str = n.IPv4IngressIP.String() - } - if n.IPv6IngressIP != nil { - v6Str = n.IPv6IngressIP.String() - } - - return &models.NodeAddressing{ - IPV4: &models.NodeAddressingElement{ - Enabled: option.Config.EnableIPv4, - IP: v4Str, - }, - IPV6: &models.NodeAddressingElement{ - Enabled: option.Config.EnableIPv6, - IP: v6Str, - }, - } -} - -// GetModel returns the API model representation of a node. -func (n *Node) GetModel() *models.NodeElement { - return &models.NodeElement{ - Name: n.Fullname(), - PrimaryAddress: n.getPrimaryAddress(), - SecondaryAddresses: n.getSecondaryAddresses(), - HealthEndpointAddress: n.getHealthAddresses(), - IngressAddress: n.getIngressAddresses(), - Source: string(n.Source), - } -} - -// Identity returns the identity of the node -func (n *Node) Identity() Identity { - return Identity{ - Name: n.Name, - Cluster: n.Cluster, - } -} - -func getCluster() string { - return option.Config.ClusterName -} - -// IsLocal returns true if this is the node on which the agent itself is -// running on -func (n *Node) IsLocal() bool { - return n != nil && n.Name == GetName() && n.Cluster == getCluster() -} - -func (n *Node) GetIPv4AllocCIDRs() []*cidr.CIDR { - result := make([]*cidr.CIDR, 0, len(n.IPv4SecondaryAllocCIDRs)+1) - if n.IPv4AllocCIDR != nil { - result = append(result, n.IPv4AllocCIDR) - } - if len(n.IPv4SecondaryAllocCIDRs) > 0 { - result = append(result, n.IPv4SecondaryAllocCIDRs...) - } - return result -} - -func (n *Node) GetIPv6AllocCIDRs() []*cidr.CIDR { - result := make([]*cidr.CIDR, 0, len(n.IPv6SecondaryAllocCIDRs)+1) - if n.IPv6AllocCIDR != nil { - result = append(result, n.IPv6AllocCIDR) - } - if len(n.IPv6SecondaryAllocCIDRs) > 0 { - result = append(result, n.IPv6SecondaryAllocCIDRs...) - } - return result -} - -// GetKeyNodeName constructs the API name for the given cluster and node name. -func GetKeyNodeName(cluster, node string) string { - // WARNING - STABLE API: Changing the structure of the key may break - // backwards compatibility - return path.Join(cluster, node) -} - -// GetKeyName returns the kvstore key to be used for the node -func (n *Node) GetKeyName() string { - return GetKeyNodeName(n.Cluster, n.Name) -} - -// DeepKeyCopy creates a deep copy of the LocalKey -func (n *Node) DeepKeyCopy() store.LocalKey { - return n.DeepCopy() -} - -// Marshal returns the node object as JSON byte slice -func (n *Node) Marshal() ([]byte, error) { - return json.Marshal(n) -} - -// Unmarshal parses the JSON byte slice and updates the node receiver -func (n *Node) Unmarshal(_ string, data []byte) error { - newNode := Node{} - if err := json.Unmarshal(data, &newNode); err != nil { - return err - } - - if err := newNode.validate(); err != nil { - return err - } - - *n = newNode - - return nil -} - -// LogRepr returns a representation of the node to be used for logging -func (n *Node) LogRepr() string { - b, err := n.Marshal() - if err != nil { - return fmt.Sprintf("%#v", n) - } - return string(b) -} - -func (n *Node) validate() error { - // Skip the ClusterID check if it matches the local one, as we assume that - // it has already been validated, and to allow it to be zero. - if n.ClusterID != option.Config.ClusterID { - if err := cmtypes.ValidateClusterID(n.ClusterID); err != nil { - return err - } - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/node/types/nodename.go b/vendor/github.com/cilium/cilium/pkg/node/types/nodename.go deleted file mode 100644 index 8faa30c3e..000000000 --- a/vendor/github.com/cilium/cilium/pkg/node/types/nodename.go +++ /dev/null @@ -1,68 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package types - -import ( - "os" - - "github.com/cilium/cilium/pkg/defaults" - k8sConsts "github.com/cilium/cilium/pkg/k8s/constants" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/option" -) - -var ( - nodeName = "localhost" -) - -// SetName sets the name of the local node. This will overwrite the value that -// is automatically retrieved with `os.Hostname()`. -// -// Note: This function is currently designed to only be called during the -// bootstrapping procedure of the agent where no parallelism exists. If you -// want to use this function in later stages, a mutex must be added first. -func SetName(name string) { - nodeName = name -} - -// GetName returns the name of the local node. The value returned was either -// previously set with SetName(), retrieved via `os.Hostname()`, or as a last -// resort is hardcoded to "localhost". -func GetName() string { - return nodeName -} - -// GetAbsoluteNodeName returns the absolute node name combined of both -// (prefixed)cluster name and the local node name in case of -// clustered environments otherwise returns the name of the local node. -func GetAbsoluteNodeName() string { - if clusterName := GetClusterName(); clusterName != "" { - return clusterName + "/" + nodeName - } else { - return nodeName - } -} - -func GetClusterName() string { - if option.Config.ClusterName != "" && - option.Config.ClusterName != defaults.ClusterName { - return option.Config.ClusterName - } else { - return "" - } -} - -func init() { - // Give priority to the environment variable available in the Cilium agent - if name := os.Getenv(k8sConsts.EnvNodeNameSpec); name != "" { - nodeName = name - return - } - if h, err := os.Hostname(); err != nil { - log.WithError(err).Warn("Unable to retrieve local hostname") - } else { - log.WithField(logfields.NodeName, h).Debug("os.Hostname() returned") - nodeName = h - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/node/types/zz_generated.deepcopy.go b/vendor/github.com/cilium/cilium/pkg/node/types/zz_generated.deepcopy.go deleted file mode 100644 index 6f78dd8c5..000000000 --- a/vendor/github.com/cilium/cilium/pkg/node/types/zz_generated.deepcopy.go +++ /dev/null @@ -1,138 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package types - -import ( - net "net" - - cidr "github.com/cilium/cilium/pkg/cidr" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Address) DeepCopyInto(out *Address) { - *out = *in - if in.IP != nil { - in, out := &in.IP, &out.IP - *out = make(net.IP, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Address. -func (in *Address) DeepCopy() *Address { - if in == nil { - return nil - } - out := new(Address) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Node) DeepCopyInto(out *Node) { - *out = *in - if in.IPAddresses != nil { - in, out := &in.IPAddresses, &out.IPAddresses - *out = make([]Address, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.IPv4AllocCIDR != nil { - in, out := &in.IPv4AllocCIDR, &out.IPv4AllocCIDR - *out = (*in).DeepCopy() - } - if in.IPv4SecondaryAllocCIDRs != nil { - in, out := &in.IPv4SecondaryAllocCIDRs, &out.IPv4SecondaryAllocCIDRs - *out = make([]*cidr.CIDR, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = (*in).DeepCopy() - } - } - } - if in.IPv6AllocCIDR != nil { - in, out := &in.IPv6AllocCIDR, &out.IPv6AllocCIDR - *out = (*in).DeepCopy() - } - if in.IPv6SecondaryAllocCIDRs != nil { - in, out := &in.IPv6SecondaryAllocCIDRs, &out.IPv6SecondaryAllocCIDRs - *out = make([]*cidr.CIDR, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = (*in).DeepCopy() - } - } - } - if in.IPv4HealthIP != nil { - in, out := &in.IPv4HealthIP, &out.IPv4HealthIP - *out = make(net.IP, len(*in)) - copy(*out, *in) - } - if in.IPv6HealthIP != nil { - in, out := &in.IPv6HealthIP, &out.IPv6HealthIP - *out = make(net.IP, len(*in)) - copy(*out, *in) - } - if in.IPv4IngressIP != nil { - in, out := &in.IPv4IngressIP, &out.IPv4IngressIP - *out = make(net.IP, len(*in)) - copy(*out, *in) - } - if in.IPv6IngressIP != nil { - in, out := &in.IPv6IngressIP, &out.IPv6IngressIP - *out = make(net.IP, len(*in)) - copy(*out, *in) - } - if in.Labels != nil { - in, out := &in.Labels, &out.Labels - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.Annotations != nil { - in, out := &in.Annotations, &out.Annotations - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Node. -func (in *Node) DeepCopy() *Node { - if in == nil { - return nil - } - out := new(Node) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RegisterNode) DeepCopyInto(out *RegisterNode) { - *out = *in - in.Node.DeepCopyInto(&out.Node) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegisterNode. -func (in *RegisterNode) DeepCopy() *RegisterNode { - if in == nil { - return nil - } - out := new(RegisterNode) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/github.com/cilium/cilium/pkg/option/config.go b/vendor/github.com/cilium/cilium/pkg/option/config.go index cf611d61d..b34442ae7 100644 --- a/vendor/github.com/cilium/cilium/pkg/option/config.go +++ b/vendor/github.com/cilium/cilium/pkg/option/config.go @@ -158,6 +158,11 @@ const ( // which allows to use reserved label for fixed identities FixedIdentityMapping = "fixed-identity-mapping" + // FixedZoneMapping is the key-value for the fixed zone mapping which + // is used to map zone value (string) from EndpointSlice to ID (uint8) + // in lb{4,6}_backend in BPF map. + FixedZoneMapping = "fixed-zone-mapping" + // IPv4Range is the per-node IPv4 endpoint prefix, e.g. 10.16.0.0/16 IPv4Range = "ipv4-range" @@ -348,12 +353,6 @@ const ( // EnableIPv4EgressGateway enables the IPv4 egress gateway EnableIPv4EgressGateway = "enable-ipv4-egress-gateway" - // EnableIngressController enables Ingress Controller - EnableIngressController = "enable-ingress-controller" - - // EnableGatewayAPI enables Gateway API support - EnableGatewayAPI = "enable-gateway-api" - // EnableEnvoyConfig enables processing of CiliumClusterwideEnvoyConfig and CiliumEnvoyConfig CRDs EnableEnvoyConfig = "enable-envoy-config" @@ -367,6 +366,10 @@ const ( // to skip netfilter connection tracking on all pod traffic. InstallNoConntrackIptRules = "install-no-conntrack-iptables-rules" + // ContainerIPLocalReservedPorts instructs the Cilium CNI plugin to reserve + // the provided comma-separated list of ports in the container network namespace + ContainerIPLocalReservedPorts = "container-ip-local-reserved-ports" + // IPv6NodeAddr is the IPv6 address of node IPv6NodeAddr = "ipv6-node" @@ -711,6 +714,10 @@ const ( // be necessary on key rotations. EnableIPsecKeyWatcher = "enable-ipsec-key-watcher" + // Enable caching for XfrmState for IPSec. Significantly reduces CPU usage + // in large clusters. + EnableIPSecXfrmStateCaching = "enable-ipsec-xfrm-state-caching" + // IPSecKeyFileName is the name of the option for ipsec key file IPSecKeyFileName = "ipsec-key-file" @@ -1587,6 +1594,9 @@ type DaemonConfig struct { // be necessary on key rotations. EnableIPsecKeyWatcher bool + // EnableIPSecXfrmStateCaching enables IPSec XfrmState caching. + EnableIPSecXfrmStateCaching bool + // EnableIPSecEncryptedOverlay enables IPSec encryption for overlay traffic. EnableIPSecEncryptedOverlay bool @@ -1650,6 +1660,9 @@ type DaemonConfig struct { EnableUnreachableRoutes bool FixedIdentityMapping map[string]string FixedIdentityMappingValidator func(val string) (string, error) `json:"-"` + FixedZoneMapping map[string]uint8 + ReverseFixedZoneMapping map[uint8]string + FixedZoneMappingValidator func(val string) (string, error) `json:"-"` IPv4Range string IPv6Range string IPv4ServiceRange string @@ -1678,8 +1691,6 @@ type DaemonConfig struct { EnableBPFClockProbe bool EnableIPv4EgressGateway bool EnableEnvoyConfig bool - EnableIngressController bool - EnableGatewayAPI bool InstallIptRules bool MonitorAggregation string PreAllocateMaps bool @@ -1799,7 +1810,7 @@ type DaemonConfig struct { // KVstoreMaxConsecutiveQuorumErrors is the maximum number of acceptable // kvstore consecutive quorum errors before the agent assumes permanent failure - KVstoreMaxConsecutiveQuorumErrors int + KVstoreMaxConsecutiveQuorumErrors uint // KVstorePeriodicSync is the time interval in which periodic // synchronization with the kvstore occurs @@ -1820,6 +1831,8 @@ type DaemonConfig struct { // unused after this time, they will be removed from the IP cache. Any of the restored // identities that are used in network policies will remain in the IP cache until all such // policies are removed. + // + // The default is 30 seconds for k8s clusters, and 10 minutes for kvstore clusters IdentityRestoreGracePeriod time.Duration // PolicyQueueSize is the size of the queues for the policy repository. @@ -2238,6 +2251,10 @@ type DaemonConfig struct { // InstallNoConntrackIptRules instructs Cilium to install Iptables rules to skip netfilter connection tracking on all pod traffic. InstallNoConntrackIptRules bool + // ContainerIPLocalReservedPorts instructs the Cilium CNI plugin to reserve + // the provided comma-separated list of ports in the container network namespace + ContainerIPLocalReservedPorts string + // EnableCustomCalls enables tail call hooks for user-defined custom // eBPF programs, typically used to collect custom per-endpoint // metrics. @@ -2388,7 +2405,7 @@ var ( KVstorePeriodicSync: defaults.KVstorePeriodicSync, KVstoreConnectivityTimeout: defaults.KVstoreConnectivityTimeout, IdentityChangeGracePeriod: defaults.IdentityChangeGracePeriod, - IdentityRestoreGracePeriod: defaults.IdentityRestoreGracePeriod, + IdentityRestoreGracePeriod: defaults.IdentityRestoreGracePeriodK8s, FixedIdentityMapping: make(map[string]string), KVStoreOpt: make(map[string]string), LogOpt: make(map[string]string), @@ -2416,6 +2433,7 @@ var ( BPFEventsDropEnabled: defaults.BPFEventsDropEnabled, BPFEventsPolicyVerdictEnabled: defaults.BPFEventsPolicyVerdictEnabled, BPFEventsTraceEnabled: defaults.BPFEventsTraceEnabled, + EnableEnvoyConfig: defaults.EnableEnvoyConfig, } ) @@ -2620,16 +2638,6 @@ func (c *DaemonConfig) K8sNetworkPolicyEnabled() bool { return c.EnableK8sNetworkPolicy } -// K8sIngressControllerEnabled returns true if ingress controller feature is enabled in Cilium -func (c *DaemonConfig) K8sIngressControllerEnabled() bool { - return c.EnableIngressController -} - -// K8sGatewayAPIEnabled returns true if Gateway API feature is enabled in Cilium -func (c *DaemonConfig) K8sGatewayAPIEnabled() bool { - return c.EnableGatewayAPI -} - func (c *DaemonConfig) PolicyCIDRMatchesNodes() bool { for _, mode := range c.PolicyCIDRMatchMode { if mode == "nodes" { @@ -2713,6 +2721,18 @@ func (c *DaemonConfig) validateHubbleRedact() error { return nil } +func (c *DaemonConfig) validateContainerIPLocalReservedPorts() error { + if c.ContainerIPLocalReservedPorts == "" || c.ContainerIPLocalReservedPorts == defaults.ContainerIPLocalReservedPortsAuto { + return nil + } + + if regexp.MustCompile(`^(\d+(-\d+)?)(,\d+(-\d+)?)*$`).MatchString(c.ContainerIPLocalReservedPorts) { + return nil + } + + return fmt.Errorf("Invalid comma separated list of of ranges for %s option", ContainerIPLocalReservedPorts) +} + // Validate validates the daemon configuration func (c *DaemonConfig) Validate(vp *viper.Viper) error { if err := c.validateIPv6ClusterAllocCIDR(); err != nil { @@ -2803,6 +2823,10 @@ func (c *DaemonConfig) Validate(vp *viper.Viper) error { return err } + if err := c.validateContainerIPLocalReservedPorts(); err != nil { + return err + } + return nil } @@ -2997,7 +3021,7 @@ func (c *DaemonConfig) Populate(vp *viper.Viper) { c.KVstoreKeepAliveInterval = c.KVstoreLeaseTTL / defaults.KVstoreKeepAliveIntervalFactor c.KVstorePeriodicSync = vp.GetDuration(KVstorePeriodicSync) c.KVstoreConnectivityTimeout = vp.GetDuration(KVstoreConnectivityTimeout) - c.KVstoreMaxConsecutiveQuorumErrors = vp.GetInt(KVstoreMaxConsecutiveQuorumErrorsName) + c.KVstoreMaxConsecutiveQuorumErrors = vp.GetUint(KVstoreMaxConsecutiveQuorumErrorsName) c.LabelPrefixFile = vp.GetString(LabelPrefixFile) c.Labels = vp.GetStringSlice(Labels) c.LibDir = vp.GetString(LibDir) @@ -3011,13 +3035,12 @@ func (c *DaemonConfig) Populate(vp *viper.Viper) { c.EnableIPMasqAgent = vp.GetBool(EnableIPMasqAgent) c.EnableIPv4EgressGateway = vp.GetBool(EnableIPv4EgressGateway) c.EnableEnvoyConfig = vp.GetBool(EnableEnvoyConfig) - c.EnableIngressController = vp.GetBool(EnableIngressController) - c.EnableGatewayAPI = vp.GetBool(EnableGatewayAPI) c.IPMasqAgentConfigPath = vp.GetString(IPMasqAgentConfigPath) c.InstallIptRules = vp.GetBool(InstallIptRules) c.IPSecKeyFile = vp.GetString(IPSecKeyFileName) c.IPsecKeyRotationDuration = vp.GetDuration(IPsecKeyRotationDuration) c.EnableIPsecKeyWatcher = vp.GetBool(EnableIPsecKeyWatcher) + c.EnableIPSecXfrmStateCaching = vp.GetBool(EnableIPSecXfrmStateCaching) c.MonitorAggregation = vp.GetString(MonitorAggregationName) c.MonitorAggregationInterval = vp.GetDuration(MonitorAggregationInterval) c.MTU = vp.GetInt(MTUName) @@ -3048,6 +3071,7 @@ func (c *DaemonConfig) Populate(vp *viper.Viper) { c.LoadBalancerRSSv4CIDR = vp.GetString(LoadBalancerRSSv4CIDR) c.LoadBalancerRSSv6CIDR = vp.GetString(LoadBalancerRSSv6CIDR) c.InstallNoConntrackIptRules = vp.GetBool(InstallNoConntrackIptRules) + c.ContainerIPLocalReservedPorts = vp.GetString(ContainerIPLocalReservedPorts) c.EnableCustomCalls = vp.GetBool(EnableCustomCallsName) c.BGPAnnounceLBIP = vp.GetBool(BGPAnnounceLBIP) c.BGPAnnouncePodCIDR = vp.GetBool(BGPAnnouncePodCIDR) @@ -3255,6 +3279,27 @@ func (c *DaemonConfig) Populate(vp *viper.Viper) { c.FixedIdentityMapping = m } + if m := command.GetStringMapString(vp, FixedZoneMapping); err != nil { + log.Fatalf("unable to parse %s: %s", FixedZoneMapping, err) + } else if len(m) != 0 { + forward := make(map[string]uint8, len(m)) + reverse := make(map[uint8]string, len(m)) + for k, v := range m { + bigN, _ := strconv.Atoi(v) + n := uint8(bigN) + if oldKey, ok := reverse[n]; ok && oldKey != k { + log.Fatalf("duplicate numeric ID entry for %s: %q and %q map to the same value %d", FixedZoneMapping, oldKey, k, n) + } + if oldN, ok := forward[k]; ok && oldN != n { + log.Fatalf("duplicate zone name entry for %s: %d and %d map to different values %s", FixedZoneMapping, oldN, n, k) + } + forward[k] = n + reverse[n] = k + } + c.FixedZoneMapping = forward + c.ReverseFixedZoneMapping = reverse + } + c.ConntrackGCInterval = vp.GetDuration(ConntrackGCInterval) c.ConntrackGCMaxInterval = vp.GetDuration(ConntrackGCMaxInterval) @@ -3450,6 +3495,10 @@ func (c *DaemonConfig) Populate(vp *viper.Viper) { } c.ExcludeNodeLabelPatterns = append(c.ExcludeNodeLabelPatterns, r) } + + if c.KVStore != "" { + c.IdentityRestoreGracePeriod = defaults.IdentityRestoreGracePeriodKvstore + } } func (c *DaemonConfig) populateLoadBalancerSettings(vp *viper.Viper) { @@ -3665,12 +3714,9 @@ func (c *DaemonConfig) checkIPAMDelegatedPlugin() error { if c.EnableEndpointHealthChecking { return fmt.Errorf("--%s must be disabled with --%s=%s", EnableEndpointHealthChecking, IPAM, ipamOption.IPAMDelegatedPlugin) } - // Ingress controller and envoy config require cilium-agent to create an IP address - // specifically for differentiating ingress and envoy traffic, which is not possible + // envoy config (Ingress, Gateway API, ...) require cilium-agent to create an IP address + // specifically for differentiating envoy traffic, which is not possible // with delegated IPAM. - if c.EnableIngressController { - return fmt.Errorf("--%s must be disabled with --%s=%s", EnableIngressController, IPAM, ipamOption.IPAMDelegatedPlugin) - } if c.EnableEnvoyConfig { return fmt.Errorf("--%s must be disabled with --%s=%s", EnableEnvoyConfig, IPAM, ipamOption.IPAMDelegatedPlugin) } @@ -4185,3 +4231,11 @@ func (d *DaemonConfig) EnforceLXCFibLookup() bool { // have auto-device detection on by default. return d.EnableEndpointRoutes } + +func (d *DaemonConfig) GetZone(id uint8) string { + return d.ReverseFixedZoneMapping[id] +} + +func (d *DaemonConfig) GetZoneID(zone string) uint8 { + return d.FixedZoneMapping[zone] +} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/api/cidr.go b/vendor/github.com/cilium/cilium/pkg/policy/api/cidr.go deleted file mode 100644 index 80a9ae7b1..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/api/cidr.go +++ /dev/null @@ -1,201 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package api - -import ( - "net" - "net/netip" - "strings" - - "github.com/cilium/cilium/pkg/ip" - "github.com/cilium/cilium/pkg/labels" - "github.com/cilium/cilium/pkg/option" -) - -// +kubebuilder:validation:Pattern=`^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/([0-9]|[1-2][0-9]|3[0-2])$|^s*((([0-9A-Fa-f]{1,4}:){7}(:|([0-9A-Fa-f]{1,4})))|(([0-9A-Fa-f]{1,4}:){6}:([0-9A-Fa-f]{1,4})?)|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){0,1}):([0-9A-Fa-f]{1,4})?))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){0,2}):([0-9A-Fa-f]{1,4})?))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){0,3}):([0-9A-Fa-f]{1,4})?))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){0,4}):([0-9A-Fa-f]{1,4})?))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){0,5}):([0-9A-Fa-f]{1,4})?))|(:(:|((:[0-9A-Fa-f]{1,4}){1,7}))))(%.+)?s*/([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8])$` - -// CIDR specifies a block of IP addresses. -// Example: 192.0.2.1/32 -type CIDR string - -var ( - ipv4All = CIDR("0.0.0.0/0") - ipv6All = CIDR("::/0") -) - -// CIDRRule is a rule that specifies a CIDR prefix to/from which outside -// communication is allowed, along with an optional list of subnets within that -// CIDR prefix to/from which outside communication is not allowed. -type CIDRRule struct { - // CIDR is a CIDR prefix / IP Block. - // - // +kubebuilder:validation:OneOf - Cidr CIDR `json:"cidr,omitempty"` - - // CIDRGroupRef is a reference to a CiliumCIDRGroup object. - // A CiliumCIDRGroup contains a list of CIDRs that the endpoint, subject to - // the rule, can (Ingress/Egress) or cannot (IngressDeny/EgressDeny) receive - // connections from. - // - // +kubebuilder:validation:OneOf - CIDRGroupRef CIDRGroupRef `json:"cidrGroupRef,omitempty"` - - // ExceptCIDRs is a list of IP blocks which the endpoint subject to the rule - // is not allowed to initiate connections to. These CIDR prefixes should be - // contained within Cidr, using ExceptCIDRs together with CIDRGroupRef is not - // supported yet. - // These exceptions are only applied to the Cidr in this CIDRRule, and do not - // apply to any other CIDR prefixes in any other CIDRRules. - // - // +kubebuilder:validation:Optional - ExceptCIDRs []CIDR `json:"except,omitempty"` - - // Generated indicates whether the rule was generated based on other rules - // or provided by user - Generated bool `json:"-"` -} - -// String converts the CIDRRule into a human-readable string. -func (r CIDRRule) String() string { - exceptCIDRs := "" - if len(r.ExceptCIDRs) > 0 { - exceptCIDRs = "-" + CIDRSlice(r.ExceptCIDRs).String() - } - return string(r.Cidr) + exceptCIDRs -} - -// CIDRSlice is a slice of CIDRs. It allows receiver methods to be defined for -// transforming the slice into other convenient forms such as -// EndpointSelectorSlice. -type CIDRSlice []CIDR - -// GetAsEndpointSelectors returns the provided CIDR slice as a slice of -// endpoint selectors -func (s CIDRSlice) GetAsEndpointSelectors() EndpointSelectorSlice { - // If multiple CIDRs representing reserved:world are in this CIDRSlice, - // we only have to add the EndpointSelector representing reserved:world - // once. - var hasIPv4AllBeenAdded, hasIPv6AllBeenAdded bool - slice := EndpointSelectorSlice{} - for _, cidr := range s { - if cidr == ipv4All { - hasIPv4AllBeenAdded = true - } - if cidr == ipv6All { - hasIPv6AllBeenAdded = true - } - lbl, err := labels.IPStringToLabel(string(cidr)) - if err == nil { - slice = append(slice, NewESFromLabels(lbl)) - } - // TODO: Log the error? - } - - if option.Config.IsDualStack() { - // If Cilium is in dual-stack mode then world-ipv4 and - // world-ipv6 need to be distinguished from one another. - if hasIPv4AllBeenAdded && hasIPv6AllBeenAdded { - slice = append(slice, ReservedEndpointSelectors[labels.IDNameWorld]) - } - if hasIPv4AllBeenAdded { - slice = append(slice, ReservedEndpointSelectors[labels.IDNameWorldIPv4]) - } - if hasIPv6AllBeenAdded { - slice = append(slice, ReservedEndpointSelectors[labels.IDNameWorldIPv6]) - } - } else if option.Config.EnableIPv4 && hasIPv4AllBeenAdded { - slice = append(slice, ReservedEndpointSelectors[labels.IDNameWorld]) - } else if option.Config.EnableIPv6 && hasIPv6AllBeenAdded { - slice = append(slice, ReservedEndpointSelectors[labels.IDNameWorld]) - } - return slice -} - -// StringSlice returns the CIDR slice as a slice of strings. -func (s CIDRSlice) StringSlice() []string { - result := make([]string, 0, len(s)) - for _, c := range s { - result = append(result, string(c)) - } - return result -} - -// String converts the CIDRSlice into a human-readable string. -func (s CIDRSlice) String() string { - if len(s) == 0 { - return "" - } - return "[" + strings.Join(s.StringSlice(), ",") + "]" -} - -// CIDRRuleSlice is a slice of CIDRRules. It allows receiver methods to be -// defined for transforming the slice into other convenient forms such as -// EndpointSelectorSlice. -type CIDRRuleSlice []CIDRRule - -// GetAsEndpointSelectors returns the provided CIDRRule slice as a slice of -// endpoint selectors -func (s CIDRRuleSlice) GetAsEndpointSelectors() EndpointSelectorSlice { - cidrs := ComputeResultantCIDRSet(s) - return cidrs.GetAsEndpointSelectors() -} - -// StringSlice returns the CIDRRuleSlice as a slice of strings. -func (s CIDRRuleSlice) StringSlice() []string { - result := make([]string, 0, len(s)) - for _, c := range s { - result = append(result, c.String()) - } - return result -} - -// ComputeResultantCIDRSet converts a slice of CIDRRules into a slice of -// individual CIDRs. This expands the cidr defined by each CIDRRule, applies -// the CIDR exceptions defined in "ExceptCIDRs", and forms a minimal set of -// CIDRs that cover all of the CIDRRules. -// -// Assumes no error checking is necessary as CIDRRule.Sanitize already does this. -func ComputeResultantCIDRSet(cidrs CIDRRuleSlice) CIDRSlice { - var allResultantAllowedCIDRs CIDRSlice - for _, s := range cidrs { - _, allowNet, _ := net.ParseCIDR(string(s.Cidr)) - - var removeSubnets []*net.IPNet - for _, t := range s.ExceptCIDRs { - _, removeSubnet, _ := net.ParseCIDR(string(t)) - removeSubnets = append(removeSubnets, removeSubnet) - } - resultantAllowedCIDRs := ip.RemoveCIDRs([]*net.IPNet{allowNet}, removeSubnets) - - for _, u := range resultantAllowedCIDRs { - allResultantAllowedCIDRs = append(allResultantAllowedCIDRs, CIDR(u.String())) - } - } - return allResultantAllowedCIDRs -} - -// addrsToCIDRRules generates CIDRRules for the IPs passed in. -// This function will mark the rule to Generated true by default. -func addrsToCIDRRules(addrs []netip.Addr) []CIDRRule { - cidrRules := make([]CIDRRule, 0, len(addrs)) - for _, addr := range addrs { - rule := CIDRRule{ExceptCIDRs: make([]CIDR, 0)} - rule.Generated = true - if addr.Is4() { - rule.Cidr = CIDR(addr.String() + "/32") - } else { - rule.Cidr = CIDR(addr.String() + "/128") - } - cidrRules = append(cidrRules, rule) - } - return cidrRules -} - -// +kubebuilder:validation:MaxLength=253 -// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` -// -// CIDRGroupRef is a reference to a CIDR Group. -// A CIDR Group is a list of CIDRs whose IP addresses should be considered as a -// same entity when applying fromCIDRGroupRefs policies on incoming network traffic. -type CIDRGroupRef string diff --git a/vendor/github.com/cilium/cilium/pkg/policy/api/decision.go b/vendor/github.com/cilium/cilium/pkg/policy/api/decision.go deleted file mode 100644 index 3a05b3ada..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/api/decision.go +++ /dev/null @@ -1,68 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package api - -import ( - "fmt" -) - -// Decision is a reachability policy decision -type Decision byte - -const ( - // Undecided means that we have not come to a decision yet - Undecided Decision = iota - // Allowed means that reachability is allowed - Allowed - // Denied means that reachability is denied - Denied -) - -var ( - decisionToString = map[Decision]string{ - Undecided: "undecided", - Allowed: "allowed", - Denied: "denied", - } - stringToDecision = map[string]Decision{ - "undecided": Undecided, - "allowed": Allowed, - "denied": Denied, - } -) - -// String returns the decision in human readable format -func (d Decision) String() string { - if v, exists := decisionToString[d]; exists { - return v - } - return "" -} - -// UnmarshalJSON parses a JSON formatted buffer and returns a decision -func (d *Decision) UnmarshalJSON(b []byte) error { - if d == nil { - d = new(Decision) - } - if len(b) <= len(`""`) { - return fmt.Errorf("invalid decision '%s'", string(b)) - } - if v, exists := stringToDecision[string(b[1:len(b)-1])]; exists { - *d = v - return nil - } - - return fmt.Errorf("unknown '%s' decision", string(b)) -} - -// MarshalJSON returns the decision as JSON formatted buffer -func (d Decision) MarshalJSON() ([]byte, error) { - s := d.String() - // length of decision string plus two `"` - b := make([]byte, len(s)+2) - b[0] = '"' - copy(b[1:], s) - b[len(b)-1] = '"' - return b, nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/api/doc.go b/vendor/github.com/cilium/cilium/pkg/policy/api/doc.go deleted file mode 100644 index ef8723992..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/api/doc.go +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// +k8s:deepcopy-gen=package -// +k8s:openapi-gen=true -// +deepequal-gen=package - -// Package api defines the API of the Cilium network policy interface -// +groupName=policy -package api diff --git a/vendor/github.com/cilium/cilium/pkg/policy/api/egress.go b/vendor/github.com/cilium/cilium/pkg/policy/api/egress.go deleted file mode 100644 index 69d7e0eb1..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/api/egress.go +++ /dev/null @@ -1,380 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package api - -import ( - "context" - - slim_metav1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" -) - -// EgressCommonRule is a rule that shares some of its fields across the -// EgressRule and EgressDenyRule. It's publicly exported so the code generators -// can generate code for this structure. -type EgressCommonRule struct { - // ToEndpoints is a list of endpoints identified by an EndpointSelector to - // which the endpoints subject to the rule are allowed to communicate. - // - // Example: - // Any endpoint with the label "role=frontend" can communicate with any - // endpoint carrying the label "role=backend". - // - // +kubebuilder:validation:Optional - ToEndpoints []EndpointSelector `json:"toEndpoints,omitempty"` - - // ToRequires is a list of additional constraints which must be met - // in order for the selected endpoints to be able to connect to other - // endpoints. These additional constraints do no by itself grant access - // privileges and must always be accompanied with at least one matching - // ToEndpoints. - // - // Example: - // Any Endpoint with the label "team=A" requires any endpoint to which it - // communicates to also carry the label "team=A". - // - // +kubebuilder:validation:Optional - ToRequires []EndpointSelector `json:"toRequires,omitempty"` - - // ToCIDR is a list of IP blocks which the endpoint subject to the rule - // is allowed to initiate connections. Only connections destined for - // outside of the cluster and not targeting the host will be subject - // to CIDR rules. This will match on the destination IP address of - // outgoing connections. Adding a prefix into ToCIDR or into ToCIDRSet - // with no ExcludeCIDRs is equivalent. Overlaps are allowed between - // ToCIDR and ToCIDRSet. - // - // Example: - // Any endpoint with the label "app=database-proxy" is allowed to - // initiate connections to 10.2.3.0/24 - // - // +kubebuilder:validation:Optional - ToCIDR CIDRSlice `json:"toCIDR,omitempty"` - - // ToCIDRSet is a list of IP blocks which the endpoint subject to the rule - // is allowed to initiate connections to in addition to connections - // which are allowed via ToEndpoints, along with a list of subnets contained - // within their corresponding IP block to which traffic should not be - // allowed. This will match on the destination IP address of outgoing - // connections. Adding a prefix into ToCIDR or into ToCIDRSet with no - // ExcludeCIDRs is equivalent. Overlaps are allowed between ToCIDR and - // ToCIDRSet. - // - // Example: - // Any endpoint with the label "app=database-proxy" is allowed to - // initiate connections to 10.2.3.0/24 except from IPs in subnet 10.2.3.0/28. - // - // +kubebuilder:validation:Optional - ToCIDRSet CIDRRuleSlice `json:"toCIDRSet,omitempty"` - - // ToEntities is a list of special entities to which the endpoint subject - // to the rule is allowed to initiate connections. Supported entities are - // `world`, `cluster`,`host`,`remote-node`,`kube-apiserver`, `init`, - // `health`,`unmanaged` and `all`. - // - // +kubebuilder:validation:Optional - ToEntities EntitySlice `json:"toEntities,omitempty"` - - // ToServices is a list of services to which the endpoint subject - // to the rule is allowed to initiate connections. - // Currently Cilium only supports toServices for K8s services without - // selectors. - // - // Example: - // Any endpoint with the label "app=backend-app" is allowed to - // initiate connections to all cidrs backing the "external-service" service - // - // +kubebuilder:validation:Optional - ToServices []Service `json:"toServices,omitempty"` - - // ToGroups is a directive that allows the integration with multiple outside - // providers. Currently, only AWS is supported, and the rule can select by - // multiple sub directives: - // - // Example: - // toGroups: - // - aws: - // securityGroupsIds: - // - 'sg-XXXXXXXXXXXXX' - // - // +kubebuilder:validation:Optional - ToGroups []Groups `json:"toGroups,omitempty"` - - // ToNodes is a list of nodes identified by an - // EndpointSelector to which endpoints subject to the rule is allowed to communicate. - // - // +kubebuilder:validation:Optional - ToNodes []EndpointSelector `json:"toNodes,omitempty"` - - // TODO: Move this to the policy package - // (https://github.com/cilium/cilium/issues/8353) - aggregatedSelectors EndpointSelectorSlice `json:"-"` -} - -// EgressRule contains all rule types which can be applied at egress, i.e. -// network traffic that originates inside the endpoint and exits the endpoint -// selected by the endpointSelector. -// -// - All members of this structure are optional. If omitted or empty, the -// member will have no effect on the rule. -// -// - If multiple members of the structure are specified, then all members -// must match in order for the rule to take effect. The exception to this -// rule is the ToRequires member; the effects of any Requires field in any -// rule will apply to all other rules as well. -// -// - ToEndpoints, ToCIDR, ToCIDRSet, ToEntities, ToServices and ToGroups are -// mutually exclusive. Only one of these members may be present within an -// individual rule. -type EgressRule struct { - EgressCommonRule `json:",inline"` - - // ToPorts is a list of destination ports identified by port number and - // protocol which the endpoint subject to the rule is allowed to - // connect to. - // - // Example: - // Any endpoint with the label "role=frontend" is allowed to initiate - // connections to destination port 8080/tcp - // - // +kubebuilder:validation:Optional - ToPorts PortRules `json:"toPorts,omitempty"` - - // ToFQDN allows whitelisting DNS names in place of IPs. The IPs that result - // from DNS resolution of `ToFQDN.MatchName`s are added to the same - // EgressRule object as ToCIDRSet entries, and behave accordingly. Any L4 and - // L7 rules within this EgressRule will also apply to these IPs. - // The DNS -> IP mapping is re-resolved periodically from within the - // cilium-agent, and the IPs in the DNS response are effected in the policy - // for selected pods as-is (i.e. the list of IPs is not modified in any way). - // Note: An explicit rule to allow for DNS traffic is needed for the pods, as - // ToFQDN counts as an egress rule and will enforce egress policy when - // PolicyEnforcment=default. - // Note: If the resolved IPs are IPs within the kubernetes cluster, the - // ToFQDN rule will not apply to that IP. - // Note: ToFQDN cannot occur in the same policy as other To* rules. - // - // +kubebuilder:validation:Optional - ToFQDNs FQDNSelectorSlice `json:"toFQDNs,omitempty"` - - // ICMPs is a list of ICMP rule identified by type number - // which the endpoint subject to the rule is allowed to connect to. - // - // Example: - // Any endpoint with the label "app=httpd" is allowed to initiate - // type 8 ICMP connections. - // - // +kubebuilder:validation:Optional - ICMPs ICMPRules `json:"icmps,omitempty"` - - // Authentication is the required authentication type for the allowed traffic, if any. - // - // +kubebuilder:validation:Optional - Authentication *Authentication `json:"authentication,omitempty"` -} - -// EgressDenyRule contains all rule types which can be applied at egress, i.e. -// network traffic that originates inside the endpoint and exits the endpoint -// selected by the endpointSelector. -// -// - All members of this structure are optional. If omitted or empty, the -// member will have no effect on the rule. -// -// - If multiple members of the structure are specified, then all members -// must match in order for the rule to take effect. The exception to this -// rule is the ToRequires member; the effects of any Requires field in any -// rule will apply to all other rules as well. -// -// - ToEndpoints, ToCIDR, ToCIDRSet, ToEntities, ToServices and ToGroups are -// mutually exclusive. Only one of these members may be present within an -// individual rule. -type EgressDenyRule struct { - EgressCommonRule `json:",inline"` - - // ToPorts is a list of destination ports identified by port number and - // protocol which the endpoint subject to the rule is not allowed to connect - // to. - // - // Example: - // Any endpoint with the label "role=frontend" is not allowed to initiate - // connections to destination port 8080/tcp - // - // +kubebuilder:validation:Optional - ToPorts PortDenyRules `json:"toPorts,omitempty"` - - // ICMPs is a list of ICMP rule identified by type number - // which the endpoint subject to the rule is not allowed to connect to. - // - // Example: - // Any endpoint with the label "app=httpd" is not allowed to initiate - // type 8 ICMP connections. - // - // +kubebuilder:validation:Optional - ICMPs ICMPRules `json:"icmps,omitempty"` -} - -// SetAggregatedSelectors creates a single slice containing all of the following -// fields within the EgressCommonRule, converted to EndpointSelector, to be -// stored by the caller of the EgressCommonRule for easy lookup while performing -// policy evaluation for the rule: -// * ToEntities -// * ToCIDR -// * ToCIDRSet -// * ToFQDNs -// -// ToEndpoints is not aggregated due to requirement folding in -// GetDestinationEndpointSelectorsWithRequirements() -func (e *EgressCommonRule) getAggregatedSelectors() EndpointSelectorSlice { - // explicitly check for empty non-nil slices, it should not result in any identity being selected. - if (e.ToEntities != nil && len(e.ToEntities) == 0) || - (e.ToCIDR != nil && len(e.ToCIDR) == 0) || - (e.ToCIDRSet != nil && len(e.ToCIDRSet) == 0) { - return nil - } - - res := make(EndpointSelectorSlice, 0, len(e.ToEntities)+len(e.ToCIDR)+len(e.ToCIDRSet)) - res = append(res, e.ToEntities.GetAsEndpointSelectors()...) - res = append(res, e.ToCIDR.GetAsEndpointSelectors()...) - res = append(res, e.ToCIDRSet.GetAsEndpointSelectors()...) - return res -} - -// SetAggregatedSelectors creates a single slice containing all of the following -// fields within the EgressRule, converted to EndpointSelector, to be stored -// within the EgressRule for easy lookup while performing policy evaluation -// for the rule: -// * ToEntities -// * ToCIDR -// * ToCIDRSet -// * ToFQDNs -// -// ToEndpoints is not aggregated due to requirement folding in -// GetDestinationEndpointSelectorsWithRequirements() -func (e *EgressRule) SetAggregatedSelectors() { - ess := e.getAggregatedSelectors() - ess = append(ess, e.ToFQDNs.GetAsEndpointSelectors()...) - e.aggregatedSelectors = ess -} - -// SetAggregatedSelectors creates a single slice containing all of the following -// fields within the EgressRule, converted to EndpointSelector, to be stored -// within the EgressRule for easy lookup while performing policy evaluation -// for the rule: -// * ToEntities -// * ToCIDR -// * ToCIDRSet -// * ToFQDNs -// -// ToEndpoints is not aggregated due to requirement folding in -// GetDestinationEndpointSelectorsWithRequirements() -func (e *EgressCommonRule) SetAggregatedSelectors() { - e.aggregatedSelectors = e.getAggregatedSelectors() -} - -// GetDestinationEndpointSelectorsWithRequirements returns a slice of endpoints selectors covering -// all L3 dst selectors of the egress rule -func (e *EgressRule) GetDestinationEndpointSelectorsWithRequirements(requirements []slim_metav1.LabelSelectorRequirement) EndpointSelectorSlice { - if e.aggregatedSelectors == nil { - e.SetAggregatedSelectors() - } - return e.EgressCommonRule.getDestinationEndpointSelectorsWithRequirements(requirements) -} - -// GetDestinationEndpointSelectorsWithRequirements returns a slice of endpoints selectors covering -// all L3 source selectors of the ingress rule -func (e *EgressDenyRule) GetDestinationEndpointSelectorsWithRequirements(requirements []slim_metav1.LabelSelectorRequirement) EndpointSelectorSlice { - if e.aggregatedSelectors == nil { - e.SetAggregatedSelectors() - } - return e.EgressCommonRule.getDestinationEndpointSelectorsWithRequirements(requirements) -} - -// GetDestinationEndpointSelectorsWithRequirements returns a slice of endpoints selectors covering -// all L3 source selectors of the ingress rule -func (e *EgressCommonRule) getDestinationEndpointSelectorsWithRequirements( - requirements []slim_metav1.LabelSelectorRequirement, -) EndpointSelectorSlice { - - // explicitly check for empty non-nil slices, it should not result in any identity being selected. - if e.aggregatedSelectors == nil || (e.ToEndpoints != nil && len(e.ToEndpoints) == 0) || - (e.ToNodes != nil && len(e.ToNodes) == 0) { - return nil - } - - res := make(EndpointSelectorSlice, 0, len(e.ToEndpoints)+len(e.aggregatedSelectors)+len(e.ToNodes)) - - if len(requirements) > 0 && len(e.ToEndpoints) > 0 { - for idx := range e.ToEndpoints { - sel := *e.ToEndpoints[idx].DeepCopy() - sel.MatchExpressions = append(sel.MatchExpressions, requirements...) - sel.SyncRequirementsWithLabelSelector() - // Even though this string is deep copied, we need to override it - // because we are updating the contents of the MatchExpressions. - sel.cachedLabelSelectorString = sel.LabelSelector.String() - res = append(res, sel) - } - } else { - res = append(res, e.ToEndpoints...) - res = append(res, e.ToNodes...) - } - return append(res, e.aggregatedSelectors...) -} - -// AllowsWildcarding returns true if wildcarding should be performed upon -// policy evaluation for the given rule. -func (e *EgressRule) AllowsWildcarding() bool { - return e.EgressCommonRule.AllowsWildcarding() && len(e.ToFQDNs) == 0 -} - -// AllowsWildcarding returns true if wildcarding should be performed upon -// policy evaluation for the given rule. -func (e *EgressCommonRule) AllowsWildcarding() bool { - return len(e.ToRequires)+len(e.ToServices) == 0 -} - -// RequiresDerivative returns true when the EgressCommonRule contains sections -// that need a derivative policy created in order to be enforced -// (e.g. ToGroups). -func (e *EgressCommonRule) RequiresDerivative() bool { - return len(e.ToGroups) > 0 -} - -// CreateDerivative will return a new rule based on the data gathered by the -// rules that creates a new derivative policy. -// In the case of ToGroups will call outside using the groups callback and this -// function can take a bit of time. -func (e *EgressRule) CreateDerivative(ctx context.Context) (*EgressRule, error) { - newRule := e.DeepCopy() - if !e.RequiresDerivative() { - return newRule, nil - } - newRule.ToCIDRSet = make(CIDRRuleSlice, 0, len(e.ToGroups)) - cidrSet, err := ExtractCidrSet(ctx, e.ToGroups) - if err != nil { - return &EgressRule{}, err - } - newRule.ToCIDRSet = append(e.ToCIDRSet, cidrSet...) - newRule.ToGroups = nil - e.SetAggregatedSelectors() - return newRule, nil -} - -// CreateDerivative will return a new rule based on the data gathered by the -// rules that creates a new derivative policy. -// In the case of ToGroups will call outside using the groups callback and this -// function can take a bit of time. -func (e *EgressDenyRule) CreateDerivative(ctx context.Context) (*EgressDenyRule, error) { - newRule := e.DeepCopy() - if !e.RequiresDerivative() { - return newRule, nil - } - newRule.ToCIDRSet = make(CIDRRuleSlice, 0, len(e.ToGroups)) - cidrSet, err := ExtractCidrSet(ctx, e.ToGroups) - if err != nil { - return &EgressDenyRule{}, err - } - newRule.ToCIDRSet = append(e.ToCIDRSet, cidrSet...) - newRule.ToGroups = nil - e.SetAggregatedSelectors() - return newRule, nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/api/entity.go b/vendor/github.com/cilium/cilium/pkg/policy/api/entity.go deleted file mode 100644 index f4bed2a19..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/api/entity.go +++ /dev/null @@ -1,144 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package api - -import ( - k8sapi "github.com/cilium/cilium/pkg/k8s/apis/cilium.io" - "github.com/cilium/cilium/pkg/labels" -) - -// Entity specifies the class of receiver/sender endpoints that do not have -// individual identities. Entities are used to describe "outside of cluster", -// "host", etc. -// -// +kubebuilder:validation:Enum=all;world;cluster;host;init;ingress;unmanaged;remote-node;health;none;kube-apiserver -type Entity string - -const ( - // EntityAll is an entity that represents all traffic - EntityAll Entity = "all" - - // EntityWorld is an entity that represents traffic external to - // endpoint's cluster - EntityWorld Entity = "world" - - // EntityWorldIPv4 is an entity that represents traffic external to - // endpoint's cluster, specifically an IPv4 endpoint, to distinguish - // it from IPv6 in dual-stack mode. - EntityWorldIPv4 Entity = "world-ipv4" - - // EntityWorldIPv6 is an entity that represents traffic external to - // endpoint's cluster, specifically an IPv6 endpoint, to distinguish - // it from IPv4 in dual-stack mode. - EntityWorldIPv6 Entity = "world-ipv6" - - // EntityCluster is an entity that represents traffic within the - // endpoint's cluster, to endpoints not managed by cilium - EntityCluster Entity = "cluster" - - // EntityHost is an entity that represents traffic within endpoint host - EntityHost Entity = "host" - - // EntityInit is an entity that represents an initializing endpoint - EntityInit Entity = "init" - - // EntityIngress is an entity that represents envoy proxy - EntityIngress Entity = "ingress" - - // EntityUnmanaged is an entity that represents unamanaged endpoints. - EntityUnmanaged Entity = "unmanaged" - - // EntityRemoteNode is an entity that represents all remote nodes - EntityRemoteNode Entity = "remote-node" - - // EntityHealth is an entity that represents all health endpoints. - EntityHealth Entity = "health" - - // EntityNone is an entity that can be selected but never exist - EntityNone Entity = "none" - - // EntityNone is an entity that represents the kube-apiserver. - EntityKubeAPIServer Entity = "kube-apiserver" -) - -var ( - endpointSelectorWorld = NewESFromLabels(labels.NewLabel(labels.IDNameWorld, "", labels.LabelSourceReserved)) - - endpointSelectorWorldIPv4 = NewESFromLabels(labels.NewLabel(labels.IDNameWorldIPv4, "", labels.LabelSourceReserved)) - - endpointSelectorWorldIPv6 = NewESFromLabels(labels.NewLabel(labels.IDNameWorldIPv6, "", labels.LabelSourceReserved)) - - endpointSelectorHost = NewESFromLabels(labels.NewLabel(labels.IDNameHost, "", labels.LabelSourceReserved)) - - endpointSelectorInit = NewESFromLabels(labels.NewLabel(labels.IDNameInit, "", labels.LabelSourceReserved)) - - endpointSelectorIngress = NewESFromLabels(labels.NewLabel(labels.IDNameIngress, "", labels.LabelSourceReserved)) - - endpointSelectorRemoteNode = NewESFromLabels(labels.NewLabel(labels.IDNameRemoteNode, "", labels.LabelSourceReserved)) - - endpointSelectorHealth = NewESFromLabels(labels.NewLabel(labels.IDNameHealth, "", labels.LabelSourceReserved)) - - EndpointSelectorNone = NewESFromLabels(labels.NewLabel(labels.IDNameNone, "", labels.LabelSourceReserved)) - - endpointSelectorUnmanaged = NewESFromLabels(labels.NewLabel(labels.IDNameUnmanaged, "", labels.LabelSourceReserved)) - - endpointSelectorKubeAPIServer = NewESFromLabels(labels.LabelKubeAPIServer[labels.IDNameKubeAPIServer]) - - // EntitySelectorMapping maps special entity names that come in - // policies to selectors - EntitySelectorMapping = map[Entity]EndpointSelectorSlice{ - EntityAll: {WildcardEndpointSelector}, - EntityWorld: {endpointSelectorWorld, endpointSelectorWorldIPv4, endpointSelectorWorldIPv6}, - EntityWorldIPv4: {endpointSelectorWorldIPv4}, - EntityWorldIPv6: {endpointSelectorWorldIPv6}, - EntityHost: {endpointSelectorHost}, - EntityInit: {endpointSelectorInit}, - EntityIngress: {endpointSelectorIngress}, - EntityRemoteNode: {endpointSelectorRemoteNode}, - EntityHealth: {endpointSelectorHealth}, - EntityUnmanaged: {endpointSelectorUnmanaged}, - EntityNone: {EndpointSelectorNone}, - EntityKubeAPIServer: {endpointSelectorKubeAPIServer}, - - // EntityCluster is populated with an empty entry to allow the - // cilium client importing this package to perform basic rule - // validation. The basic rule validation only enforces - // awareness of individual entity names and does not require - // understanding of the individual endpoint selectors. The - // endpoint selector for the cluster entity can only be - // initialized at runtime as it depends on user configuration - // such as the cluster name. See InitEntities() below. - EntityCluster: {}, - } -) - -// EntitySlice is a slice of entities -type EntitySlice []Entity - -// GetAsEndpointSelectors returns the provided entity slice as a slice of -// endpoint selectors -func (s EntitySlice) GetAsEndpointSelectors() EndpointSelectorSlice { - slice := EndpointSelectorSlice{} - for _, e := range s { - if selector, ok := EntitySelectorMapping[e]; ok { - slice = append(slice, selector...) - } - } - - return slice -} - -// InitEntities is called to initialize the policy API layer -func InitEntities(clusterName string) { - EntitySelectorMapping[EntityCluster] = EndpointSelectorSlice{ - endpointSelectorHost, - endpointSelectorRemoteNode, - endpointSelectorInit, - endpointSelectorIngress, - endpointSelectorHealth, - endpointSelectorUnmanaged, - endpointSelectorKubeAPIServer, - NewESFromLabels(labels.NewLabel(k8sapi.PolicyLabelCluster, clusterName, labels.LabelSourceK8s)), - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/api/fqdn.go b/vendor/github.com/cilium/cilium/pkg/policy/api/fqdn.go deleted file mode 100644 index 1d015975f..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/api/fqdn.go +++ /dev/null @@ -1,147 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package api - -import ( - "fmt" - "regexp" - "strings" - - "github.com/cilium/cilium/pkg/fqdn/dns" - "github.com/cilium/cilium/pkg/fqdn/matchpattern" -) - -var ( - // allowedMatchNameChars tests that MatchName contains only valid DNS characters - allowedMatchNameChars = regexp.MustCompile("^[-a-zA-Z0-9_.]+$") - - // allowedPatternChars tests that the MatchPattern field contains only the - // characters we want in our wilcard scheme. - allowedPatternChars = regexp.MustCompile("^[-a-zA-Z0-9_.*]+$") // the * inside the [] is a literal * - - // FQDNMatchNameRegexString is a regex string which matches what's expected - // in the MatchName field in the FQDNSelector. This should be kept in-sync - // with the marker comment for validation. There's no way to use a Golang - // variable in the marker comment, so it's left up to the developer. - FQDNMatchNameRegexString = `^([-a-zA-Z0-9_]+[.]?)+$` - - // FQDNMatchPatternRegexString is a regex string which matches what's expected - // in the MatchPattern field in the FQDNSelector. This should be kept in-sync - // with the marker comment for validation. There's no way to use a Golang - // variable in the marker comment, so it's left up to the developer. - FQDNMatchPatternRegexString = `^([-a-zA-Z0-9_*]+[.]?)+$` -) - -type FQDNSelector struct { - // MatchName matches literal DNS names. A trailing "." is automatically added - // when missing. - // - // +kubebuilder:validation:Pattern=`^([-a-zA-Z0-9_]+[.]?)+$` - MatchName string `json:"matchName,omitempty"` - - // MatchPattern allows using wildcards to match DNS names. All wildcards are - // case insensitive. The wildcards are: - // - "*" matches 0 or more DNS valid characters, and may occur anywhere in - // the pattern. As a special case a "*" as the leftmost character, without a - // following "." matches all subdomains as well as the name to the right. - // A trailing "." is automatically added when missing. - // - // Examples: - // `*.cilium.io` matches subomains of cilium at that level - // www.cilium.io and blog.cilium.io match, cilium.io and google.com do not - // `*cilium.io` matches cilium.io and all subdomains ends with "cilium.io" - // except those containing "." separator, subcilium.io and sub-cilium.io match, - // www.cilium.io and blog.cilium.io does not - // sub*.cilium.io matches subdomains of cilium where the subdomain component - // begins with "sub" - // sub.cilium.io and subdomain.cilium.io match, www.cilium.io, - // blog.cilium.io, cilium.io and google.com do not - // - // +kubebuilder:validation:Pattern=`^([-a-zA-Z0-9_*]+[.]?)+$` - MatchPattern string `json:"matchPattern,omitempty"` -} - -func (s *FQDNSelector) String() string { - const m = "MatchName: " - const mm = ", MatchPattern: " - var str strings.Builder - str.Grow(len(m) + len(mm) + len(s.MatchName) + len(s.MatchPattern)) - str.WriteString(m) - str.WriteString(s.MatchName) - str.WriteString(mm) - str.WriteString(s.MatchPattern) - return str.String() -} - -// sanitize for FQDNSelector is a little wonky. While we do more processing -// when using MatchName the basic requirement is that is a valid regexp. We -// test that it can compile here. -func (s *FQDNSelector) sanitize() error { - if len(s.MatchName) > 0 && len(s.MatchPattern) > 0 { - return fmt.Errorf("only one of MatchName or MatchPattern is allowed in an FQDNSelector") - } - if len(s.MatchName) > 0 && !allowedMatchNameChars.MatchString(s.MatchName) { - return fmt.Errorf("Invalid characters in MatchName: \"%s\". Only 0-9, a-z, A-Z and . and - characters are allowed", s.MatchName) - } - - if len(s.MatchPattern) > 0 && !allowedPatternChars.MatchString(s.MatchPattern) { - return fmt.Errorf("Invalid characters in MatchPattern: \"%s\". Only 0-9, a-z, A-Z and ., - and * characters are allowed", s.MatchPattern) - } - _, err := matchpattern.Validate(s.MatchPattern) - return err -} - -// ToRegex converts the given FQDNSelector to its corresponding regular -// expression. If the MatchName field is set in the selector, it performs all -// needed formatting to ensure that the field is a valid regular expression. -func (s *FQDNSelector) ToRegex() (*regexp.Regexp, error) { - var preparedMatch string - if s.MatchName != "" { - preparedMatch = dns.FQDN(s.MatchName) - } else { - preparedMatch = matchpattern.Sanitize(s.MatchPattern) - } - - regex, err := matchpattern.Validate(preparedMatch) - return regex, err -} - -// PortRuleDNS is a list of allowed DNS lookups. -type PortRuleDNS FQDNSelector - -// Sanitize checks that the matchName in the portRule can be compiled as a -// regex. It does not check that a DNS name is a valid DNS name. -func (r *PortRuleDNS) Sanitize() error { - if len(r.MatchName) > 0 && !allowedMatchNameChars.MatchString(r.MatchName) { - return fmt.Errorf("Invalid characters in MatchName: \"%s\". Only 0-9, a-z, A-Z and . and - characters are allowed", r.MatchName) - } - - if len(r.MatchPattern) > 0 && !allowedPatternChars.MatchString(r.MatchPattern) { - return fmt.Errorf("Invalid characters in MatchPattern: \"%s\". Only 0-9, a-z, A-Z and ., - and * characters are allowed", r.MatchPattern) - } - _, err := matchpattern.Validate(r.MatchPattern) - return err -} - -// GetAsEndpointSelectors returns a FQDNSelector as a single EntityNone -// EndpointSelector slice. -// Note that toFQDNs behaves differently than most other rules. The presence of -// any toFQDNs rules means the endpoint must enforce policy, but the IPs are later -// added as toCIDRSet entries and processed as such. -func (s *FQDNSelector) GetAsEndpointSelectors() EndpointSelectorSlice { - return []EndpointSelector{EndpointSelectorNone} -} - -// FQDNSelectorSlice is a wrapper type for []FQDNSelector to make is simpler to -// bind methods. -type FQDNSelectorSlice []FQDNSelector - -// GetAsEndpointSelectors will return a single EntityNone if any -// toFQDNs rules exist, and a nil slice otherwise. -func (s FQDNSelectorSlice) GetAsEndpointSelectors() EndpointSelectorSlice { - for _, rule := range s { - return rule.GetAsEndpointSelectors() - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/api/groups.go b/vendor/github.com/cilium/cilium/pkg/policy/api/groups.go deleted file mode 100644 index 9dd95a50d..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/api/groups.go +++ /dev/null @@ -1,68 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package api - -import ( - "context" - "fmt" - "net/netip" - - "github.com/cilium/cilium/pkg/ip" - "github.com/cilium/cilium/pkg/lock" -) - -const ( - AWSProvider = "AWS" // AWS provider key -) - -var ( - providers lock.Map[string, GroupProviderFunc] // map with the list of providers to callback to retrieve info from. -) - -// GroupProviderFunc is a func that need to be register to be able to -// register a new provider in the platform. -type GroupProviderFunc func(context.Context, *Groups) ([]netip.Addr, error) - -// Groups structure to store all kinds of new integrations that needs a new -// derivative policy. -type Groups struct { - AWS *AWSGroup `json:"aws,omitempty"` -} - -// AWSGroup is an structure that can be used to whitelisting information from AWS integration -type AWSGroup struct { - Labels map[string]string `json:"labels,omitempty"` - SecurityGroupsIds []string `json:"securityGroupsIds,omitempty"` - SecurityGroupsNames []string `json:"securityGroupsNames,omitempty"` - Region string `json:"region,omitempty"` -} - -// RegisterToGroupsProvider it will register a new callback that will be used -// when a new ToGroups rule is added. -func RegisterToGroupsProvider(providerName string, callback GroupProviderFunc) { - providers.Store(providerName, callback) -} - -// GetCidrSet will return the CIDRRule for the rule using the callbacks that -// are register in the platform. -func (group *Groups) GetCidrSet(ctx context.Context) ([]CIDRRule, error) { - var addrs []netip.Addr - // Get per provider CIDRSet - if group.AWS != nil { - callback, ok := providers.Load(AWSProvider) - if !ok { - return nil, fmt.Errorf("Provider %s is not registered", AWSProvider) - } - awsAddrs, err := callback(ctx, group) - if err != nil { - return nil, fmt.Errorf( - "Cannot retrieve data from %s provider: %w", - AWSProvider, err) - } - addrs = append(addrs, awsAddrs...) - } - - resultAddrs := ip.KeepUniqueAddrs(addrs) - return addrsToCIDRRules(resultAddrs), nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/api/http.go b/vendor/github.com/cilium/cilium/pkg/policy/api/http.go deleted file mode 100644 index fa7ee9173..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/api/http.go +++ /dev/null @@ -1,144 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package api - -import ( - "fmt" - "regexp" -) - -// MismatchAction specifies what to do when there is no header match -// Empty string is the default for making the rule to fail the match. -// Otherwise the rule is still considered as matching, but the mismatches -// are logged in the access log. -type MismatchAction string - -const ( - MismatchActionLog MismatchAction = "LOG" // Keep checking other matches - MismatchActionAdd MismatchAction = "ADD" // Add the missing value to a possibly multi-valued header - MismatchActionDelete MismatchAction = "DELETE" // Remove the whole mismatching header - MismatchActionReplace MismatchAction = "REPLACE" // Replace (of add if missing) the header -) - -// HeaderMatch extends the HeaderValue for matching requirement of a -// named header field against an immediate string, a secret value, or -// a regex. If none of the optional fields is present, then the -// header value is not matched, only presence of the header is enough. -type HeaderMatch struct { - // Mismatch identifies what to do in case there is no match. The default is - // to drop the request. Otherwise the overall rule is still considered as - // matching, but the mismatches are logged in the access log. - // - // +kubebuilder:validation:Enum=LOG;ADD;DELETE;REPLACE - // +kubebuilder:validation:Optional - Mismatch MismatchAction `json:"mismatch,omitempty"` - - // Name identifies the header. - Name string `json:"name"` - - // Secret refers to a secret that contains the value to be matched against. - // The secret must only contain one entry. If the referred secret does not - // exist, and there is no "Value" specified, the match will fail. - // - // +kubebuilder:validation:Optional - Secret *Secret `json:"secret,omitempty"` - - // Value matches the exact value of the header. Can be specified either - // alone or together with "Secret"; will be used as the header value if the - // secret can not be found in the latter case. - // - // +kubebuilder:validation:Optional - Value string `json:"value,omitempty"` -} - -// PortRuleHTTP is a list of HTTP protocol constraints. All fields are -// optional, if all fields are empty or missing, the rule does not have any -// effect. -// -// All fields of this type are extended POSIX regex as defined by IEEE Std -// 1003.1, (i.e this follows the egrep/unix syntax, not the perl syntax) -// matched against the path of an incoming request. Currently it can contain -// characters disallowed from the conventional "path" part of a URL as defined -// by RFC 3986. -type PortRuleHTTP struct { - // Path is an extended POSIX regex matched against the path of a - // request. Currently it can contain characters disallowed from the - // conventional "path" part of a URL as defined by RFC 3986. - // - // If omitted or empty, all paths are all allowed. - // - // +kubebuilder:validation:Optional - Path string `json:"path,omitempty"` - - // Method is an extended POSIX regex matched against the method of a - // request, e.g. "GET", "POST", "PUT", "PATCH", "DELETE", ... - // - // If omitted or empty, all methods are allowed. - // - // +kubebuilder:validation:Optional - Method string `json:"method,omitempty"` - - // Host is an extended POSIX regex matched against the host header of a - // request, e.g. "foo.com" - // - // If omitted or empty, the value of the host header is ignored. - // - // +kubebuilder:validation:Format=idn-hostname - // +kubebuilder:validation:Optional - Host string `json:"host,omitempty"` - - // Headers is a list of HTTP headers which must be present in the - // request. If omitted or empty, requests are allowed regardless of - // headers present. - // - // +kubebuilder:validation:Optional - Headers []string `json:"headers,omitempty"` - - // HeaderMatches is a list of HTTP headers which must be - // present and match against the given values. Mismatch field can be used - // to specify what to do when there is no match. - // - // +kubebuilder:validation:Optional - HeaderMatches []*HeaderMatch `json:"headerMatches,omitempty"` -} - -// Sanitize sanitizes HTTP rules. It ensures that the path and method fields -// are valid regular expressions. Note that the proxy may support a wider-range -// of regular expressions (e.g. that specified by ECMAScript), so this function -// may return some false positives. If the rule is invalid, returns an error. -func (h *PortRuleHTTP) Sanitize() error { - - if h.Path != "" { - _, err := regexp.Compile(h.Path) - if err != nil { - return err - } - } - - if h.Method != "" { - _, err := regexp.Compile(h.Method) - if err != nil { - return err - } - } - - // Headers are not sanitized. - - // But HeaderMatches are - for _, m := range h.HeaderMatches { - if m.Name == "" { - return fmt.Errorf("Header name missing") - } - if m.Mismatch != "" && - m.Mismatch != MismatchActionLog && m.Mismatch != MismatchActionAdd && - m.Mismatch != MismatchActionDelete && m.Mismatch != MismatchActionReplace { - return fmt.Errorf("Invalid header action: %s", m.Mismatch) - } - if m.Secret != nil && m.Secret.Name == "" { - return fmt.Errorf("Secret name missing") - } - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/api/icmp.go b/vendor/github.com/cilium/cilium/pkg/policy/api/icmp.go deleted file mode 100644 index 318c7d02a..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/api/icmp.go +++ /dev/null @@ -1,218 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package api - -import ( - "encoding/json" - "fmt" - - "k8s.io/apimachinery/pkg/util/intstr" -) - -const ( - IPv4Family = "IPv4" - IPv6Family = "IPv6" -) - -var icmpIpv4TypeNameToCode = map[string]string{ - "EchoReply": "0", - "DestinationUnreachable": "3", - "Redirect": "5", - "Echo": "8", - "EchoRequest": "8", - "RouterAdvertisement": "9", - "RouterSelection": "10", - "TimeExceeded": "11", - "ParameterProblem": "12", - "Timestamp": "13", - "TimestampReply": "14", - "Photuris": "40", - "ExtendedEchoRequest": "42", - "ExtendedEchoReply": "43", -} - -var icmpIpv6TypeNameToCode = map[string]string{ - "DestinationUnreachable": "1", - "PacketTooBig": "2", - "TimeExceeded": "3", - "ParameterProblem": "4", - "EchoRequest": "128", - "EchoReply": "129", - "MulticastListenerQuery": "130", - "MulticastListenerReport": "131", - "MulticastListenerDone": "132", - "RouterSolicitation": "133", - "RouterAdvertisement": "134", - "NeighborSolicitation": "135", - "NeighborAdvertisement": "136", - "RedirectMessage": "137", - "RouterRenumbering": "138", - "ICMPNodeInformationQuery": "139", - "ICMPNodeInformationResponse": "140", - "InverseNeighborDiscoverySolicitation": "141", - "InverseNeighborDiscoveryAdvertisement": "142", - "HomeAgentAddressDiscoveryRequest": "144", - "HomeAgentAddressDiscoveryReply": "145", - "MobilePrefixSolicitation": "146", - "MobilePrefixAdvertisement": "147", - "DuplicateAddressRequestCodeSuffix": "157", - "DuplicateAddressConfirmationCodeSuffix": "158", - "ExtendedEchoRequest": "160", - "ExtendedEchoReply": "161", -} - -type ICMPRules []ICMPRule - -// ICMPRule is a list of ICMP fields. -type ICMPRule struct { - // Fields is a list of ICMP fields. - // - // +kubebuilder:validation:Optional - Fields []ICMPField `json:"fields,omitempty"` -} - -// ICMPField is a ICMP field. -// -// +deepequal-gen=true -// +deepequal-gen:private-method=true -type ICMPField struct { - // Family is a IP address version. - // Currently, we support `IPv4` and `IPv6`. - // `IPv4` is set as default. - // - // +kubebuilder:default=IPv4 - // +kubebuilder:validation:Optional - // +kubebuilder:validation:Enum=IPv4;IPv6 - Family string `json:"family,omitempty"` - - // Type is a ICMP-type. - // It should be an 8bit code (0-255), or it's CamelCase name (for example, "EchoReply"). - // Allowed ICMP types are: - // Ipv4: EchoReply | DestinationUnreachable | Redirect | Echo | EchoRequest | - // RouterAdvertisement | RouterSelection | TimeExceeded | ParameterProblem | - // Timestamp | TimestampReply | Photuris | ExtendedEcho Request | ExtendedEcho Reply - // Ipv6: DestinationUnreachable | PacketTooBig | TimeExceeded | ParameterProblem | - // EchoRequest | EchoReply | MulticastListenerQuery| MulticastListenerReport | - // MulticastListenerDone | RouterSolicitation | RouterAdvertisement | NeighborSolicitation | - // NeighborAdvertisement | RedirectMessage | RouterRenumbering | ICMPNodeInformationQuery | - // ICMPNodeInformationResponse | InverseNeighborDiscoverySolicitation | InverseNeighborDiscoveryAdvertisement | - // HomeAgentAddressDiscoveryRequest | HomeAgentAddressDiscoveryReply | MobilePrefixSolicitation | - // MobilePrefixAdvertisement | DuplicateAddressRequestCodeSuffix | DuplicateAddressConfirmationCodeSuffix | - // ExtendedEchoRequest | ExtendedEchoReply - // - // +deepequal-gen=false - // +kubebuilder:validation:XIntOrString - // +kubebuilder:validation:Pattern="^([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]|EchoReply|DestinationUnreachable|Redirect|Echo|RouterAdvertisement|RouterSelection|TimeExceeded|ParameterProblem|Timestamp|TimestampReply|Photuris|ExtendedEchoRequest|ExtendedEcho Reply|PacketTooBig|ParameterProblem|EchoRequest|MulticastListenerQuery|MulticastListenerReport|MulticastListenerDone|RouterSolicitation|RouterAdvertisement|NeighborSolicitation|NeighborAdvertisement|RedirectMessage|RouterRenumbering|ICMPNodeInformationQuery|ICMPNodeInformationResponse|InverseNeighborDiscoverySolicitation|InverseNeighborDiscoveryAdvertisement|HomeAgentAddressDiscoveryRequest|HomeAgentAddressDiscoveryReply|MobilePrefixSolicitation|MobilePrefixAdvertisement|DuplicateAddressRequestCodeSuffix|DuplicateAddressConfirmationCodeSuffix)$" - Type *intstr.IntOrString `json:"type"` -} - -func (i *ICMPField) DeepEqual(o *ICMPField) bool { - if i == nil { - return o == nil - } - - if i.Type.String() != o.Type.String() { - return false - } - - return i.deepEqual(o) -} - -// UnmarshalJSON unmarshals the ICMPField from the byte array and check if the Type matches with IP version. -func (i *ICMPField) UnmarshalJSON(value []byte) error { - var t struct { - Family string `json:"family,omitempty"` - Type *intstr.IntOrString `json:"type"` - } - - if err := json.Unmarshal(value, &t); err != nil { - return err - } - - // If i.Type is ICMP type name, the value should be checked if it belongs to the map for the given family. - if t.Type.String() != "0" && t.Type.IntValue() == 0 { - name := t.Type.String() - var nameToCode map[string]string - switch t.Family { - case IPv6Family: - nameToCode = icmpIpv6TypeNameToCode - default: - nameToCode = icmpIpv4TypeNameToCode - } - - if _, ok := nameToCode[name]; !ok { - return fmt.Errorf("ICMP type %s not found in %s", name, t.Family) - } - } - - i.Family = t.Family - i.Type = t.Type - - return nil -} - -// Iterate iterates over all elements of ICMPRules. -func (ir ICMPRules) Iterate(f func(pr Ports) error) error { - for i := range ir { - if err := f(&ir[i]); err != nil { - return err - } - } - return nil -} - -// Len returns the length of the elements of ICMPRules. -func (ir ICMPRules) Len() int { - return len(ir) -} - -// GetPortProtocols generates PortProtocol slice from ICMPRule and returns it. -func (ir ICMPRule) GetPortProtocols() []PortProtocol { - var pps []PortProtocol - for _, t := range ir.Fields { - pp := t.PortProtocol() - pps = append(pps, *pp) - } - return pps -} - -// GetPortRule generates PortRule from ICMPRule and returns it. -func (ir ICMPRule) GetPortRule() *PortRule { - var pps []PortProtocol - for _, t := range ir.Fields { - pp := t.PortProtocol() - pps = append(pps, *pp) - } - pr := PortRule{ - Ports: pps, - } - return &pr -} - -// PortProtocol translates ICMPType to PortProtocol. -func (i ICMPField) PortProtocol() *PortProtocol { - var proto L4Proto - var nameToCode map[string]string - - switch i.Family { - case IPv6Family: - proto = ProtoICMPv6 - nameToCode = icmpIpv6TypeNameToCode - - default: - proto = ProtoICMP - nameToCode = icmpIpv4TypeNameToCode - } - - port := i.Type.String() - if name, ok := nameToCode[port]; ok { - port = name - } - - pr := PortProtocol{ - Port: port, - Protocol: proto, - } - return &pr -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/api/ingress.go b/vendor/github.com/cilium/cilium/pkg/policy/api/ingress.go deleted file mode 100644 index b9ecc355d..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/api/ingress.go +++ /dev/null @@ -1,301 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package api - -import ( - "context" - - slim_metav1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" -) - -// IngressCommonRule is a rule that shares some of its fields across the -// IngressRule and IngressDenyRule. It's publicly exported so the code -// generators can generate code for this structure. -type IngressCommonRule struct { - // FromEndpoints is a list of endpoints identified by an - // EndpointSelector which are allowed to communicate with the endpoint - // subject to the rule. - // - // Example: - // Any endpoint with the label "role=backend" can be consumed by any - // endpoint carrying the label "role=frontend". - // - // +kubebuilder:validation:Optional - FromEndpoints []EndpointSelector `json:"fromEndpoints,omitempty"` - - // FromRequires is a list of additional constraints which must be met - // in order for the selected endpoints to be reachable. These - // additional constraints do no by itself grant access privileges and - // must always be accompanied with at least one matching FromEndpoints. - // - // Example: - // Any Endpoint with the label "team=A" requires consuming endpoint - // to also carry the label "team=A". - // - // +kubebuilder:validation:Optional - FromRequires []EndpointSelector `json:"fromRequires,omitempty"` - - // FromCIDR is a list of IP blocks which the endpoint subject to the - // rule is allowed to receive connections from. Only connections which - // do *not* originate from the cluster or from the local host are subject - // to CIDR rules. In order to allow in-cluster connectivity, use the - // FromEndpoints field. This will match on the source IP address of - // incoming connections. Adding a prefix into FromCIDR or into - // FromCIDRSet with no ExcludeCIDRs is equivalent. Overlaps are - // allowed between FromCIDR and FromCIDRSet. - // - // Example: - // Any endpoint with the label "app=my-legacy-pet" is allowed to receive - // connections from 10.3.9.1 - // - // +kubebuilder:validation:Optional - FromCIDR CIDRSlice `json:"fromCIDR,omitempty"` - - // FromCIDRSet is a list of IP blocks which the endpoint subject to the - // rule is allowed to receive connections from in addition to FromEndpoints, - // along with a list of subnets contained within their corresponding IP block - // from which traffic should not be allowed. - // This will match on the source IP address of incoming connections. Adding - // a prefix into FromCIDR or into FromCIDRSet with no ExcludeCIDRs is - // equivalent. Overlaps are allowed between FromCIDR and FromCIDRSet. - // - // Example: - // Any endpoint with the label "app=my-legacy-pet" is allowed to receive - // connections from 10.0.0.0/8 except from IPs in subnet 10.96.0.0/12. - // - // +kubebuilder:validation:Optional - FromCIDRSet CIDRRuleSlice `json:"fromCIDRSet,omitempty"` - - // FromEntities is a list of special entities which the endpoint subject - // to the rule is allowed to receive connections from. Supported entities are - // `world`, `cluster` and `host` - // - // +kubebuilder:validation:Optional - FromEntities EntitySlice `json:"fromEntities,omitempty"` - - // FromGroups is a directive that allows the integration with multiple outside - // providers. Currently, only AWS is supported, and the rule can select by - // multiple sub directives: - // - // Example: - // FromGroups: - // - aws: - // securityGroupsIds: - // - 'sg-XXXXXXXXXXXXX' - // - // +kubebuilder:validation:Optional - FromGroups []Groups `json:"fromGroups,omitempty"` - - // FromNodes is a list of nodes identified by an - // EndpointSelector which are allowed to communicate with the endpoint - // subject to the rule. - // - // +kubebuilder:validation:Optional - FromNodes []EndpointSelector `json:"fromNodes,omitempty"` - - // TODO: Move this to the policy package - // (https://github.com/cilium/cilium/issues/8353) - aggregatedSelectors EndpointSelectorSlice `json:"-"` -} - -// IngressRule contains all rule types which can be applied at ingress, -// i.e. network traffic that originates outside of the endpoint and -// is entering the endpoint selected by the endpointSelector. -// -// - All members of this structure are optional. If omitted or empty, the -// member will have no effect on the rule. -// -// - If multiple members are set, all of them need to match in order for -// the rule to take effect. The exception to this rule is FromRequires field; -// the effects of any Requires field in any rule will apply to all other -// rules as well. -// -// - FromEndpoints, FromCIDR, FromCIDRSet and FromEntities are mutually -// exclusive. Only one of these members may be present within an individual -// rule. -type IngressRule struct { - IngressCommonRule `json:",inline"` - - // ToPorts is a list of destination ports identified by port number and - // protocol which the endpoint subject to the rule is allowed to - // receive connections on. - // - // Example: - // Any endpoint with the label "app=httpd" can only accept incoming - // connections on port 80/tcp. - // - // +kubebuilder:validation:Optional - ToPorts PortRules `json:"toPorts,omitempty"` - - // ICMPs is a list of ICMP rule identified by type number - // which the endpoint subject to the rule is allowed to - // receive connections on. - // - // Example: - // Any endpoint with the label "app=httpd" can only accept incoming - // type 8 ICMP connections. - // - // +kubebuilder:validation:Optional - ICMPs ICMPRules `json:"icmps,omitempty"` - - // Authentication is the required authentication type for the allowed traffic, if any. - // - // +kubebuilder:validation:Optional - Authentication *Authentication `json:"authentication,omitempty"` -} - -// IngressDenyRule contains all rule types which can be applied at ingress, -// i.e. network traffic that originates outside of the endpoint and -// is entering the endpoint selected by the endpointSelector. -// -// - All members of this structure are optional. If omitted or empty, the -// member will have no effect on the rule. -// -// - If multiple members are set, all of them need to match in order for -// the rule to take effect. The exception to this rule is FromRequires field; -// the effects of any Requires field in any rule will apply to all other -// rules as well. -// -// - FromEndpoints, FromCIDR, FromCIDRSet, FromGroups and FromEntities are mutually -// exclusive. Only one of these members may be present within an individual -// rule. -type IngressDenyRule struct { - IngressCommonRule `json:",inline"` - - // ToPorts is a list of destination ports identified by port number and - // protocol which the endpoint subject to the rule is not allowed to - // receive connections on. - // - // Example: - // Any endpoint with the label "app=httpd" can not accept incoming - // connections on port 80/tcp. - // - // +kubebuilder:validation:Optional - ToPorts PortDenyRules `json:"toPorts,omitempty"` - - // ICMPs is a list of ICMP rule identified by type number - // which the endpoint subject to the rule is not allowed to - // receive connections on. - // - // Example: - // Any endpoint with the label "app=httpd" can not accept incoming - // type 8 ICMP connections. - // - // +kubebuilder:validation:Optional - ICMPs ICMPRules `json:"icmps,omitempty"` -} - -// SetAggregatedSelectors creates a single slice containing all of the following -// fields within the IngressRule, converted to EndpointSelector, to be stored -// within the IngressRule for easy lookup while performing policy evaluation -// for the rule: -// * FromEntities -// * FromCIDR -// * FromCIDRSet -// -// FromEndpoints is not aggregated due to requirement folding in -// GetSourceEndpointSelectorsWithRequirements() -func (i *IngressCommonRule) SetAggregatedSelectors() { - // Goroutines can race setting i.aggregatedSelectors, but they will all compute the same result, so it does not matter. - - // explicitly check for empty non-nil slices, it should not result in any identity being selected. - if (i.FromCIDR != nil && len(i.FromCIDR) == 0) || - (i.FromCIDRSet != nil && len(i.FromCIDRSet) == 0) || - (i.FromEntities != nil && len(i.FromEntities) == 0) { - i.aggregatedSelectors = nil - return - } - - res := make(EndpointSelectorSlice, 0, len(i.FromEntities)+len(i.FromCIDR)+len(i.FromCIDRSet)) - res = append(res, i.FromEntities.GetAsEndpointSelectors()...) - res = append(res, i.FromCIDR.GetAsEndpointSelectors()...) - res = append(res, i.FromCIDRSet.GetAsEndpointSelectors()...) - - i.aggregatedSelectors = res -} - -// GetSourceEndpointSelectorsWithRequirements returns a slice of endpoints selectors covering -// all L3 source selectors of the ingress rule -func (i *IngressCommonRule) GetSourceEndpointSelectorsWithRequirements(requirements []slim_metav1.LabelSelectorRequirement) EndpointSelectorSlice { - if i.aggregatedSelectors == nil { - i.SetAggregatedSelectors() - } - - // explicitly check for empty non-nil slices, it should not result in any identity being selected. - if i.aggregatedSelectors == nil || (i.FromEndpoints != nil && len(i.FromEndpoints) == 0) || - (i.FromNodes != nil && len(i.FromNodes) == 0) { - return nil - } - - res := make(EndpointSelectorSlice, 0, len(i.FromEndpoints)+len(i.aggregatedSelectors)+len(i.FromNodes)) - if len(requirements) > 0 && len(i.FromEndpoints) > 0 { - for idx := range i.FromEndpoints { - sel := *i.FromEndpoints[idx].DeepCopy() - sel.MatchExpressions = append(sel.MatchExpressions, requirements...) - sel.SyncRequirementsWithLabelSelector() - // Even though this string is deep copied, we need to override it - // because we are updating the contents of the MatchExpressions. - sel.cachedLabelSelectorString = sel.LabelSelector.String() - res = append(res, sel) - } - } else { - res = append(res, i.FromEndpoints...) - res = append(res, i.FromNodes...) - } - - return append(res, i.aggregatedSelectors...) -} - -// AllowsWildcarding returns true if wildcarding should be performed upon -// policy evaluation for the given rule. -func (i *IngressCommonRule) AllowsWildcarding() bool { - return len(i.FromRequires) == 0 -} - -// RequiresDerivative returns true when the EgressCommonRule contains sections -// that need a derivative policy created in order to be enforced -// (e.g. FromGroups). -func (e *IngressCommonRule) RequiresDerivative() bool { - return len(e.FromGroups) > 0 -} - -// CreateDerivative will return a new rule based on the data gathered by the -// rules that creates a new derivative policy. -// In the case of FromGroups will call outside using the groups callback and this -// function can take a bit of time. -func (e *IngressRule) CreateDerivative(ctx context.Context) (*IngressRule, error) { - newRule := e.DeepCopy() - if !e.RequiresDerivative() { - return newRule, nil - } - newRule.FromCIDRSet = make(CIDRRuleSlice, 0, len(e.FromGroups)) - cidrSet, err := ExtractCidrSet(ctx, e.FromGroups) - if err != nil { - return &IngressRule{}, err - } - newRule.FromCIDRSet = append(e.FromCIDRSet, cidrSet...) - newRule.FromGroups = nil - e.SetAggregatedSelectors() - return newRule, nil -} - -// CreateDerivative will return a new rule based on the data gathered by the -// rules that creates a new derivative policy. -// In the case of FromGroups will call outside using the groups callback and this -// function can take a bit of time. -func (e *IngressDenyRule) CreateDerivative(ctx context.Context) (*IngressDenyRule, error) { - newRule := e.DeepCopy() - if !e.RequiresDerivative() { - return newRule, nil - } - newRule.FromCIDRSet = make(CIDRRuleSlice, 0, len(e.FromGroups)) - cidrSet, err := ExtractCidrSet(ctx, e.FromGroups) - if err != nil { - return &IngressDenyRule{}, err - } - newRule.FromCIDRSet = append(e.FromCIDRSet, cidrSet...) - newRule.FromGroups = nil - e.SetAggregatedSelectors() - return newRule, nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/api/l4.go b/vendor/github.com/cilium/cilium/pkg/policy/api/l4.go deleted file mode 100644 index a33700f2c..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/api/l4.go +++ /dev/null @@ -1,339 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package api - -import ( - "github.com/cilium/proxy/pkg/policy/api/kafka" -) - -// L4Proto is a layer 4 protocol name -type L4Proto string - -const ( - // Keep pkg/u8proto up-to-date with any additions here - - ProtoTCP L4Proto = "TCP" - ProtoUDP L4Proto = "UDP" - ProtoSCTP L4Proto = "SCTP" - ProtoICMP L4Proto = "ICMP" - ProtoICMPv6 L4Proto = "ICMPV6" - ProtoAny L4Proto = "ANY" - - PortProtocolAny = "0/ANY" -) - -// IsAny returns true if an L4Proto represents ANY protocol -func (l4 L4Proto) IsAny() bool { - return l4 == ProtoAny || string(l4) == "" -} - -// PortProtocol specifies an L4 port with an optional transport protocol -type PortProtocol struct { - // Port is an L4 port number. For now the string will be strictly - // parsed as a single uint16. In the future, this field may support - // ranges in the form "1024-2048 - // Port can also be a port name, which must contain at least one [a-z], - // and may also contain [0-9] and '-' anywhere except adjacent to another - // '-' or in the beginning or the end. - // - // +kubebuilder:validation:Pattern=`^(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[1-5][0-9]{4}|[0-9]{1,4})|([a-zA-Z0-9]-?)*[a-zA-Z](-?[a-zA-Z0-9])*$` - Port string `json:"port"` - - // Protocol is the L4 protocol. If omitted or empty, any protocol - // matches. Accepted values: "TCP", "UDP", "SCTP", "ANY" - // - // Matching on ICMP is not supported. - // - // Named port specified for a container may narrow this down, but may not - // contradict this. - // - // +kubebuilder:validation:Enum=TCP;UDP;SCTP;ANY - // +kubebuilder:validation:Optional - Protocol L4Proto `json:"protocol,omitempty"` -} - -// Covers returns true if the ports and protocol specified in the received -// PortProtocol are equal to or a superset of the ports and protocol in 'other'. -// Named ports only cover other named ports with exactly the same name. -func (p PortProtocol) Covers(other PortProtocol) bool { - if p.Port != other.Port { - return false - } - if p.Protocol != other.Protocol { - return p.Protocol.IsAny() - } - return true -} - -// Secret is a reference to a secret, backed by k8s or local file system. -type Secret struct { - // Namespace is the namespace in which the secret exists. Context of use - // determines the default value if left out (e.g., "default"). - // - // +kubebuilder:validation:Optional - Namespace string `json:"namespace,omitempty"` - - // Name is the name of the secret. - // - // +kubebuilder:validation:Required - Name string `json:"name"` -} - -// TLSContext provides TLS configuration via reference to either k8s secrets -// or via filepath. If both are set, directory is given priority over -// k8sSecrets. -type TLSContext struct { - // Secret is the secret that contains the certificates and private key for - // the TLS context. - // By default, Cilium will search in this secret for the following items: - // - 'ca.crt' - Which represents the trusted CA to verify remote source. - // - 'tls.crt' - Which represents the public key certificate. - // - 'tls.key' - Which represents the private key matching the public key - // certificate. - // - // +kubebuilder:validation:Required - Secret *Secret `json:"secret"` - - // TrustedCA is the file name or k8s secret item name for the trusted CA. - // If omitted, 'ca.crt' is assumed, if it exists. If given, the item must - // exist. - // - // +kubebuilder:validation:Optional - TrustedCA string `json:"trustedCA,omitempty"` - - // Certificate is the file name or k8s secret item name for the certificate - // chain. If omitted, 'tls.crt' is assumed, if it exists. If given, the - // item must exist. - // - // +kubebuilder:validation:Optional - Certificate string `json:"certificate,omitempty"` - - // PrivateKey is the file name or k8s secret item name for the private key - // matching the certificate chain. If omitted, 'tls.key' is assumed, if it - // exists. If given, the item must exist. - // - // +kubebuilder:validation:Optional - PrivateKey string `json:"privateKey,omitempty"` -} - -// EnvoyConfig defines a reference to a CiliumEnvoyConfig or CiliumClusterwideEnvoyConfig -type EnvoyConfig struct { - // Kind is the resource type being referred to. Defaults to CiliumEnvoyConfig or - // CiliumClusterwideEnvoyConfig for CiliumNetworkPolicy and CiliumClusterwideNetworkPolicy, - // respectively. The only case this is currently explicitly needed is when referring to a - // CiliumClusterwideEnvoyConfig from CiliumNetworkPolicy, as using a namespaced listener - // from a cluster scoped policy is not allowed. - // - // +kubebuilder:validation:Enum=CiliumEnvoyConfig;CiliumClusterwideEnvoyConfig - // +kubebuilder:validation:Optional - Kind string `json:"kind"` - - // Name is the resource name of the CiliumEnvoyConfig or CiliumClusterwideEnvoyConfig where - // the listener is defined in. - // - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:Required - Name string `json:"name"` -} - -// Listener defines a reference to an Envoy listener specified in a CEC or CCEC resource. -type Listener struct { - // EnvoyConfig is a reference to the CEC or CCEC resource in which - // the listener is defined. - // - // +kubebuilder:validation:Required - EnvoyConfig *EnvoyConfig `json:"envoyConfig"` - - // Name is the name of the listener. - // - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:Required - Name string `json:"name"` - - // Priority for this Listener that is used when multiple rules would apply different - // listeners to a policy map entry. Behavior of this is implementation dependent. - // - // +kubebuilder:validation:Minimum=1 - // +kubebuilder:validation:Maximum=100 - // +kubebuilder:validation:Optional - Priority uint16 `json:"priority"` -} - -// PortRule is a list of ports/protocol combinations with optional Layer 7 -// rules which must be met. -type PortRule struct { - // Ports is a list of L4 port/protocol - // - // +kubebuilder:validation:Optional - Ports []PortProtocol `json:"ports,omitempty"` - - // TerminatingTLS is the TLS context for the connection terminated by - // the L7 proxy. For egress policy this specifies the server-side TLS - // parameters to be applied on the connections originated from the local - // endpoint and terminated by the L7 proxy. For ingress policy this specifies - // the server-side TLS parameters to be applied on the connections - // originated from a remote source and terminated by the L7 proxy. - // - // +kubebuilder:validation:Optional - TerminatingTLS *TLSContext `json:"terminatingTLS,omitempty"` - - // OriginatingTLS is the TLS context for the connections originated by - // the L7 proxy. For egress policy this specifies the client-side TLS - // parameters for the upstream connection originating from the L7 proxy - // to the remote destination. For ingress policy this specifies the - // client-side TLS parameters for the connection from the L7 proxy to - // the local endpoint. - // - // +kubebuilder:validation:Optional - OriginatingTLS *TLSContext `json:"originatingTLS,omitempty"` - - // ServerNames is a list of allowed TLS SNI values. If not empty, then - // TLS must be present and one of the provided SNIs must be indicated in the - // TLS handshake. - // - // +kubebuilder:validation:Optional - ServerNames []string `json:"serverNames,omitempty"` - - // listener specifies the name of a custom Envoy listener to which this traffic should be - // redirected to. - // - // +kubebuilder:validation:Optional - Listener *Listener `json:"listener,omitempty"` - - // Rules is a list of additional port level rules which must be met in - // order for the PortRule to allow the traffic. If omitted or empty, - // no layer 7 rules are enforced. - // - // +kubebuilder:validation:Optional - Rules *L7Rules `json:"rules,omitempty"` -} - -// GetPortProtocols returns the Ports field of the PortRule. -func (pd PortRule) GetPortProtocols() []PortProtocol { - return pd.Ports -} - -// GetPortRule returns the PortRule. -func (pd *PortRule) GetPortRule() *PortRule { - return pd -} - -// PortDenyRule is a list of ports/protocol that should be used for deny -// policies. This structure lacks the L7Rules since it's not supported in deny -// policies. -type PortDenyRule struct { - // Ports is a list of L4 port/protocol - // - // +kubebuilder:validation:Optional - Ports []PortProtocol `json:"ports,omitempty"` -} - -// GetPortProtocols returns the Ports field of the PortDenyRule. -func (pd PortDenyRule) GetPortProtocols() []PortProtocol { - return pd.Ports -} - -// GetPortRule returns nil has it is not a PortRule. -func (pd *PortDenyRule) GetPortRule() *PortRule { - return nil -} - -// L7Rules is a union of port level rule types. Mixing of different port -// level rule types is disallowed, so exactly one of the following must be set. -// If none are specified, then no additional port level rules are applied. -type L7Rules struct { - // HTTP specific rules. - // - // +kubebuilder:validation:Optional - HTTP []PortRuleHTTP `json:"http,omitempty"` - - // Kafka-specific rules. - // - // +kubebuilder:validation:Optional - Kafka []kafka.PortRule `json:"kafka,omitempty"` - - // DNS-specific rules. - // - // +kubebuilder:validation:Optional - DNS []PortRuleDNS `json:"dns,omitempty"` - - // Name of the L7 protocol for which the Key-value pair rules apply. - // - // +kubebuilder:validation:Optional - L7Proto string `json:"l7proto,omitempty"` - - // Key-value pair rules. - // - // +kubebuilder:validation:Optional - L7 []PortRuleL7 `json:"l7,omitempty"` -} - -// Len returns the total number of rules inside `L7Rules`. -// Returns 0 if nil. -func (rules *L7Rules) Len() int { - if rules == nil { - return 0 - } - return len(rules.HTTP) + len(rules.Kafka) + len(rules.DNS) + len(rules.L7) -} - -// IsEmpty returns whether the `L7Rules` is nil or contains no rules. -func (rules *L7Rules) IsEmpty() bool { - return rules.Len() == 0 -} - -// PortRules is a slice of PortRule. -type PortRules []PortRule - -// Iterate iterates over all elements of PortRules. -func (pr PortRules) Iterate(f func(pr Ports) error) error { - for i := range pr { - err := f(&pr[i]) - if err != nil { - return err - } - } - return nil -} - -// Len returns the length of the elements of PortRules. -func (pr PortRules) Len() int { - return len(pr) -} - -// PortDenyRules is a slice of PortDenyRule. -type PortDenyRules []PortDenyRule - -// Iterate iterates over all elements of PortDenyRules. -func (pr PortDenyRules) Iterate(f func(pr Ports) error) error { - for i := range pr { - err := f(&pr[i]) - if err != nil { - return err - } - } - return nil -} - -// Len returns the length of the elements of PortDenyRules. -func (pr PortDenyRules) Len() int { - return len(pr) -} - -// Ports is an interface that should be used by all implementations of the -// PortProtocols. -type Ports interface { - // GetPortProtocols returns the slice PortProtocol - GetPortProtocols() []PortProtocol - // GetPortRule returns a PortRule, if the implementation does not support - // it, then returns nil. - GetPortRule() *PortRule -} - -// PortsIterator is an interface that should be implemented by structures that -// can iterate over a list of Ports interfaces. -type PortsIterator interface { - Iterate(f func(pr Ports) error) error - Len() int -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/api/l7.go b/vendor/github.com/cilium/cilium/pkg/policy/api/l7.go deleted file mode 100644 index ba1e924f0..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/api/l7.go +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package api - -import ( - "fmt" -) - -// PortRuleL7 is a list of key-value pairs interpreted by a L7 protocol as -// protocol constraints. All fields are optional, if all fields are empty or -// missing, the rule does not have any effect. -type PortRuleL7 map[string]string - -// Sanitize sanitizes key-value pair rules. It makes sure keys are present. -func (rule *PortRuleL7) Sanitize() error { - for k := range *rule { - if k == "" { - return fmt.Errorf("Empty key not allowed") - } - } - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/api/rule.go b/vendor/github.com/cilium/cilium/pkg/policy/api/rule.go deleted file mode 100644 index 2d6243ead..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/api/rule.go +++ /dev/null @@ -1,297 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package api - -import ( - "context" - "encoding/json" - - "github.com/cilium/cilium/pkg/labels" -) - -// AuthenticationMode is a string identifying a supported authentication type -type AuthenticationMode string - -const ( - AuthenticationModeDisabled AuthenticationMode = "disabled" // Always succeeds - AuthenticationModeRequired AuthenticationMode = "required" // Mutual TLS with SPIFFE as certificate provider by default - AuthenticationModeAlwaysFail AuthenticationMode = "test-always-fail" -) - -// Authentication specifies the kind of cryptographic authentication required for the traffic to -// be allowed. -type Authentication struct { - // Mode is the required authentication mode for the allowed traffic, if any. - // - // +kubebuilder:validation:Enum=disabled;required;test-always-fail - // +kubebuilder:validation:Required - Mode AuthenticationMode `json:"mode"` -} - -// DefaultDenyConfig expresses a policy's desired default mode for the subject -// endpoints. -type DefaultDenyConfig struct { - // Whether or not the endpoint should have a default-deny rule applied - // to ingress traffic. - // - // +kubebuilder:validation:Optional - Ingress *bool `json:"ingress,omitempty"` - - // Whether or not the endpoint should have a default-deny rule applied - // to egress traffic. - // - // +kubebuilder:validation:Optional - Egress *bool `json:"egress,omitempty"` -} - -// Rule is a policy rule which must be applied to all endpoints which match the -// labels contained in the endpointSelector -// -// Each rule is split into an ingress section which contains all rules -// applicable at ingress, and an egress section applicable at egress. For rule -// types such as `L4Rule` and `CIDR` which can be applied at both ingress and -// egress, both ingress and egress side have to either specifically allow the -// connection or one side has to be omitted. -// -// Either ingress, egress, or both can be provided. If both ingress and egress -// are omitted, the rule has no effect. -// -// +deepequal-gen:private-method=true -type Rule struct { - // EndpointSelector selects all endpoints which should be subject to - // this rule. EndpointSelector and NodeSelector cannot be both empty and - // are mutually exclusive. - // - // +kubebuilder:validation:OneOf - EndpointSelector EndpointSelector `json:"endpointSelector,omitempty"` - - // NodeSelector selects all nodes which should be subject to this rule. - // EndpointSelector and NodeSelector cannot be both empty and are mutually - // exclusive. Can only be used in CiliumClusterwideNetworkPolicies. - // - // +kubebuilder:validation:OneOf - NodeSelector EndpointSelector `json:"nodeSelector,omitempty"` - - // Ingress is a list of IngressRule which are enforced at ingress. - // If omitted or empty, this rule does not apply at ingress. - // - // +kubebuilder:validation:Optional - Ingress []IngressRule `json:"ingress,omitempty"` - - // IngressDeny is a list of IngressDenyRule which are enforced at ingress. - // Any rule inserted here will be denied regardless of the allowed ingress - // rules in the 'ingress' field. - // If omitted or empty, this rule does not apply at ingress. - // - // +kubebuilder:validation:Optional - IngressDeny []IngressDenyRule `json:"ingressDeny,omitempty"` - - // Egress is a list of EgressRule which are enforced at egress. - // If omitted or empty, this rule does not apply at egress. - // - // +kubebuilder:validation:Optional - Egress []EgressRule `json:"egress,omitempty"` - - // EgressDeny is a list of EgressDenyRule which are enforced at egress. - // Any rule inserted here will be denied regardless of the allowed egress - // rules in the 'egress' field. - // If omitted or empty, this rule does not apply at egress. - // - // +kubebuilder:validation:Optional - EgressDeny []EgressDenyRule `json:"egressDeny,omitempty"` - - // Labels is a list of optional strings which can be used to - // re-identify the rule or to store metadata. It is possible to lookup - // or delete strings based on labels. Labels are not required to be - // unique, multiple rules can have overlapping or identical labels. - // - // +kubebuilder:validation:Optional - Labels labels.LabelArray `json:"labels,omitempty"` - - // EnableDefaultDeny determines whether this policy configures the - // subject endpoint(s) to have a default deny mode. If enabled, - // this causes all traffic not explicitly allowed by a network policy - // to be dropped. - // - // If not specified, the default is true for each traffic direction - // that has rules, and false otherwise. For example, if a policy - // only has Ingress or IngressDeny rules, then the default for - // ingress is true and egress is false. - // - // If multiple policies apply to an endpoint, that endpoint's default deny - // will be enabled if any policy requests it. - // - // This is useful for creating broad-based network policies that will not - // cause endpoints to enter default-deny mode. - // - // +kubebuilder:validation:Optional - EnableDefaultDeny DefaultDenyConfig `json:"enableDefaultDeny,omitempty"` - - // Description is a free form string, it can be used by the creator of - // the rule to store human readable explanation of the purpose of this - // rule. Rules cannot be identified by comment. - // - // +kubebuilder:validation:Optional - Description string `json:"description,omitempty"` -} - -// MarshalJSON returns the JSON encoding of Rule r. We need to overwrite it to -// enforce omitempty on the EndpointSelector nested structures. -func (r *Rule) MarshalJSON() ([]byte, error) { - type common struct { - Ingress []IngressRule `json:"ingress,omitempty"` - IngressDeny []IngressDenyRule `json:"ingressDeny,omitempty"` - Egress []EgressRule `json:"egress,omitempty"` - EgressDeny []EgressDenyRule `json:"egressDeny,omitempty"` - Labels labels.LabelArray `json:"labels,omitempty"` - EnableDefaultDeny DefaultDenyConfig `json:"enableDefaultDeny,omitempty"` - Description string `json:"description,omitempty"` - } - - var a interface{} - ruleCommon := common{ - Ingress: r.Ingress, - IngressDeny: r.IngressDeny, - Egress: r.Egress, - EgressDeny: r.EgressDeny, - Labels: r.Labels, - EnableDefaultDeny: r.EnableDefaultDeny, - Description: r.Description, - } - - // Only one of endpointSelector or nodeSelector is permitted. - switch { - case r.EndpointSelector.LabelSelector != nil: - a = struct { - EndpointSelector EndpointSelector `json:"endpointSelector,omitempty"` - common - }{ - EndpointSelector: r.EndpointSelector, - common: ruleCommon, - } - case r.NodeSelector.LabelSelector != nil: - a = struct { - NodeSelector EndpointSelector `json:"nodeSelector,omitempty"` - common - }{ - NodeSelector: r.NodeSelector, - common: ruleCommon, - } - } - - return json.Marshal(a) -} - -func (r *Rule) DeepEqual(o *Rule) bool { - switch { - case (r == nil) != (o == nil): - return false - case (r == nil) && (o == nil): - return true - } - return r.deepEqual(o) -} - -// NewRule builds a new rule with no selector and no policy. -func NewRule() *Rule { - return &Rule{} -} - -// WithEndpointSelector configures the Rule with the specified selector. -func (r *Rule) WithEndpointSelector(es EndpointSelector) *Rule { - r.EndpointSelector = es - return r -} - -// WithIngressRules configures the Rule with the specified rules. -func (r *Rule) WithIngressRules(rules []IngressRule) *Rule { - r.Ingress = rules - return r -} - -// WithIngressDenyRules configures the Rule with the specified rules. -func (r *Rule) WithIngressDenyRules(rules []IngressDenyRule) *Rule { - r.IngressDeny = rules - return r -} - -// WithEgressRules configures the Rule with the specified rules. -func (r *Rule) WithEgressRules(rules []EgressRule) *Rule { - r.Egress = rules - return r -} - -// WithEgressDenyRules configures the Rule with the specified rules. -func (r *Rule) WithEgressDenyRules(rules []EgressDenyRule) *Rule { - r.EgressDeny = rules - return r -} - -// WithLabels configures the Rule with the specified labels metadata. -func (r *Rule) WithLabels(labels labels.LabelArray) *Rule { - r.Labels = labels - return r -} - -// WithDescription configures the Rule with the specified description metadata. -func (r *Rule) WithDescription(desc string) *Rule { - r.Description = desc - return r -} - -// RequiresDerivative it return true if the rule has a derivative rule. -func (r *Rule) RequiresDerivative() bool { - for _, rule := range r.Egress { - if rule.RequiresDerivative() { - return true - } - } - for _, rule := range r.EgressDeny { - if rule.RequiresDerivative() { - return true - } - } - return false -} - -// CreateDerivative will return a new Rule with the new data based gather -// by the rules that autogenerated new Rule -func (r *Rule) CreateDerivative(ctx context.Context) (*Rule, error) { - newRule := r.DeepCopy() - newRule.Egress = []EgressRule{} - newRule.EgressDeny = []EgressDenyRule{} - - for _, egressRule := range r.Egress { - derivativeEgressRule, err := egressRule.CreateDerivative(ctx) - if err != nil { - return newRule, err - } - newRule.Egress = append(newRule.Egress, *derivativeEgressRule) - } - - for _, egressDenyRule := range r.EgressDeny { - derivativeEgressDenyRule, err := egressDenyRule.CreateDerivative(ctx) - if err != nil { - return newRule, err - } - newRule.EgressDeny = append(newRule.EgressDeny, *derivativeEgressDenyRule) - } - - for _, ingressRule := range r.Ingress { - derivativeIngressRule, err := ingressRule.CreateDerivative(ctx) - if err != nil { - return newRule, err - } - newRule.Ingress = append(newRule.Ingress, *derivativeIngressRule) - } - - for _, ingressDenyRule := range r.IngressDeny { - derivativeDenyIngressRule, err := ingressDenyRule.CreateDerivative(ctx) - if err != nil { - return newRule, err - } - newRule.IngressDeny = append(newRule.IngressDeny, *derivativeDenyIngressRule) - } - return newRule, nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/api/rule_validation.go b/vendor/github.com/cilium/cilium/pkg/policy/api/rule_validation.go deleted file mode 100644 index 082ad37e0..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/api/rule_validation.go +++ /dev/null @@ -1,548 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package api - -import ( - "errors" - "fmt" - "net/netip" - "strconv" - "strings" - - "github.com/cilium/cilium/pkg/iana" - "github.com/cilium/cilium/pkg/option" -) - -const ( - maxPorts = 40 - maxICMPFields = 40 -) - -// Sanitize validates and sanitizes a policy rule. Minor edits such as -// capitalization of the protocol name are automatically fixed up. More -// fundamental violations will cause an error to be returned. -func (r *Rule) Sanitize() error { - // Fill in the default traffic posture of this Rule. - // Default posture is per-direction (ingress or egress), - // if there is a peer selector for that direction, the - // default is deny, else allow. - if r.EnableDefaultDeny.Egress == nil { - x := len(r.Egress) > 0 || len(r.EgressDeny) > 0 - r.EnableDefaultDeny.Egress = &x - } - if r.EnableDefaultDeny.Ingress == nil { - x := len(r.Ingress) > 0 || len(r.IngressDeny) > 0 - r.EnableDefaultDeny.Ingress = &x - } - - if r.EndpointSelector.LabelSelector == nil && r.NodeSelector.LabelSelector == nil { - return fmt.Errorf("rule must have one of EndpointSelector or NodeSelector") - } - if r.EndpointSelector.LabelSelector != nil && r.NodeSelector.LabelSelector != nil { - return fmt.Errorf("rule cannot have both EndpointSelector and NodeSelector") - } - - if r.EndpointSelector.LabelSelector != nil { - if err := r.EndpointSelector.sanitize(); err != nil { - return err - } - } - - var hostPolicy bool - if r.NodeSelector.LabelSelector != nil { - if err := r.NodeSelector.sanitize(); err != nil { - return err - } - hostPolicy = true - } - - for i := range r.Ingress { - if err := r.Ingress[i].sanitize(); err != nil { - return err - } - if hostPolicy { - if len(countL7Rules(r.Ingress[i].ToPorts)) > 0 { - return fmt.Errorf("host policies do not support L7 rules yet") - } - } - } - - for i := range r.Egress { - if err := r.Egress[i].sanitize(); err != nil { - return err - } - if hostPolicy { - if len(countL7Rules(r.Egress[i].ToPorts)) > 0 { - return fmt.Errorf("host policies do not support L7 rules yet") - } - } - } - - return nil -} - -func countL7Rules(ports []PortRule) map[string]int { - result := make(map[string]int) - for _, port := range ports { - if !port.Rules.IsEmpty() { - result["DNS"] += len(port.Rules.DNS) - result["HTTP"] += len(port.Rules.HTTP) - result["Kafka"] += len(port.Rules.Kafka) - } - } - return result -} - -func (i *IngressRule) sanitize() error { - l3Members := map[string]int{ - "FromEndpoints": len(i.FromEndpoints), - "FromCIDR": len(i.FromCIDR), - "FromCIDRSet": len(i.FromCIDRSet), - "FromEntities": len(i.FromEntities), - "FromNodes": len(i.FromNodes), - } - l7Members := countL7Rules(i.ToPorts) - l7IngressSupport := map[string]bool{ - "DNS": false, - "Kafka": true, - "HTTP": true, - } - - for m1 := range l3Members { - for m2 := range l3Members { - if m2 != m1 && l3Members[m1] > 0 && l3Members[m2] > 0 { - return fmt.Errorf("Combining %s and %s is not supported yet", m1, m2) - } - } - } - - if len(l7Members) > 0 && !option.Config.EnableL7Proxy { - return errors.New("L7 policy is not supported since L7 proxy is not enabled") - } - for member := range l7Members { - if l7Members[member] > 0 && !l7IngressSupport[member] { - return fmt.Errorf("L7 protocol %s is not supported on ingress yet", member) - } - } - - if len(i.ICMPs) > 0 && !option.Config.EnableICMPRules { - return fmt.Errorf("ICMP rules can only be applied when the %q flag is set", option.EnableICMPRules) - } - - if len(i.ICMPs) > 0 && len(i.ToPorts) > 0 { - return fmt.Errorf("The ICMPs block may only be present without ToPorts. Define a separate rule to use ToPorts.") - } - - if len(i.FromNodes) > 0 && !option.Config.EnableNodeSelectorLabels { - return fmt.Errorf("FromNodes rules can only be applied when the %q flag is set", option.EnableNodeSelectorLabels) - } - - for _, es := range i.FromEndpoints { - if err := es.sanitize(); err != nil { - return err - } - } - - for _, es := range i.FromRequires { - if err := es.sanitize(); err != nil { - return err - } - } - - for n := range i.ToPorts { - if err := i.ToPorts[n].sanitize(true); err != nil { - return err - } - } - - for n := range i.ICMPs { - if err := i.ICMPs[n].verify(); err != nil { - return err - } - } - - for _, ns := range i.FromNodes { - if err := ns.sanitize(); err != nil { - return err - } - } - - for n := range i.FromCIDR { - if err := i.FromCIDR[n].sanitize(); err != nil { - return err - } - } - - for n := range i.FromCIDRSet { - if err := i.FromCIDRSet[n].sanitize(); err != nil { - return err - } - } - - for _, fromEntity := range i.FromEntities { - _, ok := EntitySelectorMapping[fromEntity] - if !ok { - return fmt.Errorf("unsupported entity: %s", fromEntity) - } - } - - i.SetAggregatedSelectors() - - return nil -} - -// countNonGeneratedRules counts the number of CIDRRule items which are not -// `Generated`, i.e. were directly provided by the user. -// The `Generated` field is currently only set by the `ToServices` -// implementation, which extracts service endpoints and translates them as -// ToCIDRSet rules before the CNP is passed to the policy repository. -// Therefore, we want to allow the combination of ToCIDRSet and ToServices -// rules, if (and only if) the ToCIDRSet only contains `Generated` entries. -func countNonGeneratedCIDRRules(s CIDRRuleSlice) int { - n := 0 - for _, c := range s { - if !c.Generated { - n++ - } - } - return n -} - -func (e *EgressRule) sanitize() error { - l3Members := map[string]int{ - "ToCIDR": len(e.ToCIDR), - "ToCIDRSet": countNonGeneratedCIDRRules(e.ToCIDRSet), - "ToEndpoints": len(e.ToEndpoints), - "ToEntities": len(e.ToEntities), - "ToServices": len(e.ToServices), - "ToFQDNs": len(e.ToFQDNs), - "ToGroups": len(e.ToGroups), - "ToNodes": len(e.ToNodes), - } - l3DependentL4Support := map[interface{}]bool{ - "ToCIDR": true, - "ToCIDRSet": true, - "ToEndpoints": true, - "ToEntities": true, - "ToServices": false, // see https://github.com/cilium/cilium/issues/20067 - "ToFQDNs": true, - "ToGroups": true, - "ToNodes": true, - } - l7Members := countL7Rules(e.ToPorts) - l7EgressSupport := map[string]bool{ - "DNS": true, - "Kafka": true, - "HTTP": true, - } - - for m1 := range l3Members { - for m2 := range l3Members { - if m2 != m1 && l3Members[m1] > 0 && l3Members[m2] > 0 { - return fmt.Errorf("Combining %s and %s is not supported yet", m1, m2) - } - } - } - for member := range l3Members { - if l3Members[member] > 0 && len(e.ToPorts) > 0 && !l3DependentL4Support[member] { - return fmt.Errorf("Combining %s and ToPorts is not supported yet", member) - } - } - - if len(l7Members) > 0 && !option.Config.EnableL7Proxy { - return errors.New("L7 policy is not supported since L7 proxy is not enabled") - } - for member := range l7Members { - if l7Members[member] > 0 && !l7EgressSupport[member] { - return fmt.Errorf("L7 protocol %s is not supported on egress yet", member) - } - } - - if len(e.ICMPs) > 0 && !option.Config.EnableICMPRules { - return fmt.Errorf("ICMP rules can only be applied when the %q flag is set", option.EnableICMPRules) - } - - if len(e.ICMPs) > 0 && len(e.ToPorts) > 0 { - return fmt.Errorf("The ICMPs block may only be present without ToPorts. Define a separate rule to use ToPorts.") - } - - if len(e.ToNodes) > 0 && !option.Config.EnableNodeSelectorLabels { - return fmt.Errorf("ToNodes rules can only be applied when the %q flag is set", option.EnableNodeSelectorLabels) - } - - for _, es := range e.ToEndpoints { - if err := es.sanitize(); err != nil { - return err - } - } - - for _, es := range e.ToRequires { - if err := es.sanitize(); err != nil { - return err - } - } - - for i := range e.ToPorts { - if err := e.ToPorts[i].sanitize(false); err != nil { - return err - } - } - - for n := range e.ICMPs { - if err := e.ICMPs[n].verify(); err != nil { - return err - } - } - - for _, ns := range e.ToNodes { - if err := ns.sanitize(); err != nil { - return err - } - } - - for i := range e.ToCIDR { - if err := e.ToCIDR[i].sanitize(); err != nil { - return err - } - } - for i := range e.ToCIDRSet { - if err := e.ToCIDRSet[i].sanitize(); err != nil { - return err - } - } - - for _, toEntity := range e.ToEntities { - _, ok := EntitySelectorMapping[toEntity] - if !ok { - return fmt.Errorf("unsupported entity: %s", toEntity) - } - } - - for i := range e.ToFQDNs { - err := e.ToFQDNs[i].sanitize() - if err != nil { - return err - } - } - - e.SetAggregatedSelectors() - - return nil -} - -func (pr *L7Rules) sanitize(ports []PortProtocol) error { - nTypes := 0 - - if pr.HTTP != nil { - nTypes++ - for i := range pr.HTTP { - if err := pr.HTTP[i].Sanitize(); err != nil { - return err - } - } - } - - if pr.Kafka != nil { - nTypes++ - for i := range pr.Kafka { - if err := pr.Kafka[i].Sanitize(); err != nil { - return err - } - } - } - - if pr.DNS != nil { - // Forthcoming TPROXY redirection restricts DNS proxy to the standard DNS port (53). - // Require the port 53 be explicitly configured, and disallow other port numbers. - if len(ports) == 0 { - return fmt.Errorf("Port 53 must be specified for DNS rules") - } - - nTypes++ - for i := range pr.DNS { - if err := pr.DNS[i].Sanitize(); err != nil { - return err - } - } - } - - if pr.L7 != nil && pr.L7Proto == "" { - return fmt.Errorf("'l7' may only be specified when a 'l7proto' is also specified") - } - if pr.L7Proto != "" { - nTypes++ - for i := range pr.L7 { - if err := pr.L7[i].Sanitize(); err != nil { - return err - } - } - } - - if nTypes > 1 { - return fmt.Errorf("multiple L7 protocol rule types specified in single rule") - } - return nil -} - -func (pr *PortRule) sanitize(ingress bool) error { - hasDNSRules := pr.Rules != nil && len(pr.Rules.DNS) > 0 - if ingress && hasDNSRules { - return fmt.Errorf("DNS rules are not allowed on ingress") - } - - if len(pr.ServerNames) > 0 && !pr.Rules.IsEmpty() && pr.TerminatingTLS == nil { - return fmt.Errorf("ServerNames are not allowed with L7 rules without TLS termination") - } - for _, sn := range pr.ServerNames { - if sn == "" { - return fmt.Errorf("Empty server name is not allowed") - } - } - - if len(pr.Ports) > maxPorts { - return fmt.Errorf("too many ports, the max is %d", maxPorts) - } - haveZeroPort := false - for i := range pr.Ports { - var isZero bool - var err error - if isZero, err = pr.Ports[i].sanitize(); err != nil { - return err - } - if isZero { - haveZeroPort = true - } - // DNS L7 rules can be TCP, UDP or ANY, all others are TCP only. - switch { - case pr.Rules.IsEmpty(), hasDNSRules: - // nothing to do if no rules OR they are DNS rules (note the comma above) - case pr.Ports[i].Protocol != ProtoTCP: - return fmt.Errorf("L7 rules can only apply to TCP (not %s) except for DNS rules", pr.Ports[i].Protocol) - } - } - - listener := pr.Listener - if listener != nil { - // For now we have only tested custom listener support on the egress path. TODO - // (jrajahalme): Lift this limitation in follow-up work once proper testing has been - // done on the ingress path. - if ingress { - return fmt.Errorf("Listener is not allowed on ingress (%s)", listener.Name) - } - // There is no quarantee that Listener will support Cilium policy enforcement. Even - // now proxylib-based enforcement (e.g, Kafka) may work, but has not been tested. - // TODO (jrajahalme): Lift this limitation in follow-up work for proxylib based - // parsers if needed and when tested. - if !pr.Rules.IsEmpty() { - return fmt.Errorf("Listener is not allowed with L7 rules (%s)", listener.Name) - } - } - - // Sanitize L7 rules - if !pr.Rules.IsEmpty() { - if haveZeroPort { - return fmt.Errorf("L7 rules can not be used when a port is 0") - } - - if err := pr.Rules.sanitize(pr.Ports); err != nil { - return err - } - } - return nil -} - -func (pp *PortProtocol) sanitize() (isZero bool, err error) { - if pp.Port == "" { - return isZero, fmt.Errorf("Port must be specified") - } - - // Port names are formatted as IANA Service Names. This means that - // some legal numeric literals are no longer considered numbers, e.g, - // 0x10 is now considered a name rather than number 16. - if iana.IsSvcName(pp.Port) { - pp.Port = strings.ToLower(pp.Port) // Normalize for case insensitive comparison - } else { - p, err := strconv.ParseUint(pp.Port, 0, 16) - if err != nil { - return isZero, fmt.Errorf("Unable to parse port: %w", err) - } - isZero = p == 0 - } - - pp.Protocol, err = ParseL4Proto(string(pp.Protocol)) - return isZero, err -} - -func (ir *ICMPRule) verify() error { - if len(ir.Fields) > maxICMPFields { - return fmt.Errorf("too many types, the max is %d", maxICMPFields) - } - - for _, f := range ir.Fields { - if f.Family != IPv4Family && f.Family != IPv6Family && f.Family != "" { - return fmt.Errorf("wrong family: %s", f.Family) - } - } - - return nil -} - -// sanitize the given CIDR. -func (c CIDR) sanitize() error { - strCIDR := string(c) - if strCIDR == "" { - return fmt.Errorf("IP must be specified") - } - - prefix, err := netip.ParsePrefix(strCIDR) - if err != nil { - _, err := netip.ParseAddr(strCIDR) - if err != nil { - return fmt.Errorf("unable to parse CIDR: %w", err) - } - return nil - } - prefixLength := prefix.Bits() - if prefixLength < 0 { - return fmt.Errorf("CIDR cannot specify non-contiguous mask %s", prefix) - } - - return nil -} - -// sanitize validates a CIDRRule by checking that the CIDR prefix itself is -// valid, and ensuring that all of the exception CIDR prefixes are contained -// within the allowed CIDR prefix. -func (c *CIDRRule) sanitize() error { - // Only allow notation /. Note that this differs from - // the logic in api.CIDR.Sanitize(). - prefix, err := netip.ParsePrefix(string(c.Cidr)) - if err != nil { - return fmt.Errorf("Unable to parse CIDRRule %q: %w", c.Cidr, err) - } - - prefixLength := prefix.Bits() - if prefixLength < 0 { - return fmt.Errorf("CIDR cannot specify non-contiguous mask %s", prefix) - } - - // Ensure that each provided exception CIDR prefix is formatted correctly, - // and is contained within the CIDR prefix to/from which we want to allow - // traffic. - for _, p := range c.ExceptCIDRs { - except, err := netip.ParsePrefix(string(p)) - if err != nil { - return err - } - - // Note: this also checks that the allow CIDR prefix and the exception - // CIDR prefixes are part of the same address family. - if !prefix.Contains(except.Addr()) { - return fmt.Errorf("allow CIDR prefix %s does not contain "+ - "exclude CIDR prefix %s", c.Cidr, p) - } - } - - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/api/rules.go b/vendor/github.com/cilium/cilium/pkg/policy/api/rules.go deleted file mode 100644 index aa69904ea..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/api/rules.go +++ /dev/null @@ -1,39 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package api - -import ( - "fmt" - "strings" -) - -// Rules is a collection of api.Rule. -// -// All rules must be evaluated in order to come to a conclusion. While -// it is sufficient to have a single fromEndpoints rule match, none of -// the fromRequires may be violated at the same time. -// +deepequal-gen:private-method=true -type Rules []*Rule - -func (rs Rules) String() string { - strRules := make([]string, 0, len(rs)) - - for _, r := range rs { - strRules = append(strRules, fmt.Sprintf("%+v", r)) - } - - return "[" + strings.Join(strRules, ",\n") + "]" -} - -// DeepEqual is a deepequal function, deeply comparing the -// receiver with other. the receiver must be non-nil. -func (rs *Rules) DeepEqual(other *Rules) bool { - switch { - case (rs == nil) != (other == nil): - return false - case (rs == nil) && (other == nil): - return true - } - return rs.deepEqual(other) -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/api/selector.go b/vendor/github.com/cilium/cilium/pkg/policy/api/selector.go deleted file mode 100644 index c23aa0d9c..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/api/selector.go +++ /dev/null @@ -1,388 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package api - -import ( - "encoding/json" - "fmt" - "strings" - - k8sLbls "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/labels" - slim_metav1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" - validation "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1/validation" - "github.com/cilium/cilium/pkg/labels" - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/metrics" -) - -var log = logging.DefaultLogger.WithField(logfields.LogSubsys, "policy-api") - -// EndpointSelector is a wrapper for k8s LabelSelector. -type EndpointSelector struct { - *slim_metav1.LabelSelector `json:",inline"` - - // requirements provides a cache for a k8s-friendly format of the - // LabelSelector, which allows more efficient matching in Matches(). - // - // Kept as a pointer to allow EndpointSelector to be used as a map key. - requirements *k8sLbls.Requirements `json:"-"` - - // cachedLabelSelectorString is the cached representation of the - // LabelSelector for this EndpointSelector. It is populated when - // EndpointSelectors are created via `NewESFromMatchRequirements`. It is - // immutable after its creation. - cachedLabelSelectorString string `json:"-"` -} - -// LabelSelectorString returns a user-friendly string representation of -// EndpointSelector. -func (n *EndpointSelector) LabelSelectorString() string { - if n != nil && n.LabelSelector == nil { - return "" - } - return slim_metav1.FormatLabelSelector(n.LabelSelector) -} - -// String returns a string representation of EndpointSelector. -func (n EndpointSelector) String() string { - j, _ := n.MarshalJSON() - return string(j) -} - -// CachedString returns the cached string representation of the LabelSelector -// for this EndpointSelector. -func (n EndpointSelector) CachedString() string { - return n.cachedLabelSelectorString -} - -// UnmarshalJSON unmarshals the endpoint selector from the byte array. -func (n *EndpointSelector) UnmarshalJSON(b []byte) error { - n.LabelSelector = &slim_metav1.LabelSelector{} - err := json.Unmarshal(b, n.LabelSelector) - if err != nil { - return err - } - if n.MatchLabels != nil { - ml := map[string]string{} - for k, v := range n.MatchLabels { - ml[labels.GetExtendedKeyFrom(k)] = v - } - n.MatchLabels = ml - } - if n.MatchExpressions != nil { - newMatchExpr := make([]slim_metav1.LabelSelectorRequirement, len(n.MatchExpressions)) - for i, v := range n.MatchExpressions { - v.Key = labels.GetExtendedKeyFrom(v.Key) - newMatchExpr[i] = v - } - n.MatchExpressions = newMatchExpr - } - n.requirements = labelSelectorToRequirements(n.LabelSelector) - n.cachedLabelSelectorString = n.LabelSelector.String() - return nil -} - -// MarshalJSON returns a JSON representation of the byte array. -func (n EndpointSelector) MarshalJSON() ([]byte, error) { - ls := slim_metav1.LabelSelector{} - - if n.LabelSelector == nil { - return json.Marshal(ls) - } - - if n.MatchLabels != nil { - newLabels := map[string]string{} - for k, v := range n.MatchLabels { - newLabels[labels.GetCiliumKeyFrom(k)] = v - } - ls.MatchLabels = newLabels - } - if n.MatchExpressions != nil { - newMatchExpr := make([]slim_metav1.LabelSelectorRequirement, len(n.MatchExpressions)) - for i, v := range n.MatchExpressions { - v.Key = labels.GetCiliumKeyFrom(v.Key) - newMatchExpr[i] = v - } - ls.MatchExpressions = newMatchExpr - } - return json.Marshal(ls) -} - -// HasKeyPrefix checks if the endpoint selector contains the given key prefix in -// its MatchLabels map and MatchExpressions slice. -func (n EndpointSelector) HasKeyPrefix(prefix string) bool { - for k := range n.MatchLabels { - if strings.HasPrefix(k, prefix) { - return true - } - } - for _, v := range n.MatchExpressions { - if strings.HasPrefix(v.Key, prefix) { - return true - } - } - return false -} - -// HasKey checks if the endpoint selector contains the given key in -// its MatchLabels map or in its MatchExpressions slice. -func (n EndpointSelector) HasKey(key string) bool { - if _, ok := n.MatchLabels[key]; ok { - return true - } - for _, v := range n.MatchExpressions { - if v.Key == key { - return true - } - } - return false -} - -// GetMatch checks for a match on the specified key, and returns the value that -// the key must match, and true. If a match cannot be found, returns nil, false. -func (n EndpointSelector) GetMatch(key string) ([]string, bool) { - if value, ok := n.MatchLabels[key]; ok { - return []string{value}, true - } - for _, v := range n.MatchExpressions { - if v.Key == key && v.Operator == slim_metav1.LabelSelectorOpIn { - return v.Values, true - } - } - return nil, false -} - -// labelSelectorToRequirements turns a kubernetes Selector into a slice of -// requirements equivalent to the selector. These are cached internally in the -// EndpointSelector to speed up Matches(). -// -// This validates the labels, which can be expensive (and may fail..) -// If there's an error, the selector will be nil and the Matches() -// implementation will refuse to match any labels. -func labelSelectorToRequirements(labelSelector *slim_metav1.LabelSelector) *k8sLbls.Requirements { - selector, err := slim_metav1.LabelSelectorAsSelector(labelSelector) - if err != nil { - metrics.PolicyChangeTotal.WithLabelValues(metrics.LabelValueOutcomeFail).Inc() - log.WithError(err).WithField(logfields.EndpointLabelSelector, - logfields.Repr(labelSelector)).Error("unable to construct selector in label selector") - return nil - } - metrics.PolicyChangeTotal.WithLabelValues(metrics.LabelValueOutcomeSuccess).Inc() - - requirements, selectable := selector.Requirements() - if !selectable { - return nil - } - return &requirements -} - -// NewESFromLabels creates a new endpoint selector from the given labels. -func NewESFromLabels(lbls ...labels.Label) EndpointSelector { - ml := map[string]string{} - for _, lbl := range lbls { - ml[lbl.GetExtendedKey()] = lbl.Value - } - - return NewESFromMatchRequirements(ml, nil) -} - -// NewESFromMatchRequirements creates a new endpoint selector from the given -// match specifications: An optional set of labels that must match, and -// an optional slice of LabelSelectorRequirements. -// -// If the caller intends to reuse 'matchLabels' or 'reqs' after creating the -// EndpointSelector, they must make a copy of the parameter. -func NewESFromMatchRequirements(matchLabels map[string]string, reqs []slim_metav1.LabelSelectorRequirement) EndpointSelector { - labelSelector := &slim_metav1.LabelSelector{ - MatchLabels: matchLabels, - MatchExpressions: reqs, - } - return EndpointSelector{ - LabelSelector: labelSelector, - requirements: labelSelectorToRequirements(labelSelector), - cachedLabelSelectorString: labelSelector.String(), - } -} - -// SyncRequirementsWithLabelSelector ensures that the requirements within the -// specified EndpointSelector are in sync with the LabelSelector. This is -// because the LabelSelector has publicly accessible fields, which can be -// updated without concurrently updating the requirements, so the two fields can -// become out of sync. -func (n *EndpointSelector) SyncRequirementsWithLabelSelector() { - n.requirements = labelSelectorToRequirements(n.LabelSelector) -} - -// newReservedEndpointSelector returns a selector that matches on all -// endpoints with the specified reserved label. -func newReservedEndpointSelector(ID string) EndpointSelector { - reservedLabels := labels.NewLabel(ID, "", labels.LabelSourceReserved) - return NewESFromLabels(reservedLabels) -} - -var ( - // WildcardEndpointSelector is a wildcard endpoint selector matching - // all endpoints that can be described with labels. - WildcardEndpointSelector = NewESFromLabels() - - // ReservedEndpointSelectors map reserved labels to EndpointSelectors - // that will match those endpoints. - ReservedEndpointSelectors = map[string]EndpointSelector{ - labels.IDNameHost: newReservedEndpointSelector(labels.IDNameHost), - labels.IDNameRemoteNode: newReservedEndpointSelector(labels.IDNameRemoteNode), - labels.IDNameWorld: newReservedEndpointSelector(labels.IDNameWorld), - labels.IDNameWorldIPv4: newReservedEndpointSelector(labels.IDNameWorldIPv4), - labels.IDNameWorldIPv6: newReservedEndpointSelector(labels.IDNameWorldIPv6), - } -) - -// NewESFromK8sLabelSelector returns a new endpoint selector from the label -// where it the given srcPrefix will be encoded in the label's keys. -func NewESFromK8sLabelSelector(srcPrefix string, lss ...*slim_metav1.LabelSelector) EndpointSelector { - var ( - matchLabels map[string]string - matchExpressions []slim_metav1.LabelSelectorRequirement - ) - for _, ls := range lss { - if ls == nil { - continue - } - if ls.MatchLabels != nil { - if matchLabels == nil { - matchLabels = map[string]string{} - } - for k, v := range ls.MatchLabels { - matchLabels[srcPrefix+k] = v - } - } - if ls.MatchExpressions != nil { - if matchExpressions == nil { - matchExpressions = make([]slim_metav1.LabelSelectorRequirement, 0, len(ls.MatchExpressions)) - } - for _, v := range ls.MatchExpressions { - v.Key = srcPrefix + v.Key - matchExpressions = append(matchExpressions, v) - } - } - } - return NewESFromMatchRequirements(matchLabels, matchExpressions) -} - -// AddMatch adds a match for 'key' == 'value' to the endpoint selector. -func (n *EndpointSelector) AddMatch(key, value string) { - if n.MatchLabels == nil { - n.MatchLabels = map[string]string{} - } - n.MatchLabels[key] = value - n.requirements = labelSelectorToRequirements(n.LabelSelector) - n.cachedLabelSelectorString = n.LabelSelector.String() -} - -// AddMatchExpression adds a match expression to label selector of the endpoint selector. -func (n *EndpointSelector) AddMatchExpression(key string, op slim_metav1.LabelSelectorOperator, values []string) { - n.MatchExpressions = append(n.MatchExpressions, slim_metav1.LabelSelectorRequirement{ - Key: key, - Operator: op, - Values: values, - }) - - // Update cache of the EndopintSelector from the embedded label selector. - // This is to make sure we have updates caches containing the required selectors. - n.requirements = labelSelectorToRequirements(n.LabelSelector) - n.cachedLabelSelectorString = n.LabelSelector.String() -} - -// Matches returns true if the endpoint selector Matches the `lblsToMatch`. -// Returns always true if the endpoint selector contains the reserved label for -// "all". -func (n *EndpointSelector) Matches(lblsToMatch k8sLbls.Labels) bool { - // Try to update cached requirements for this EndpointSelector if possible. - if n.requirements == nil { - n.requirements = labelSelectorToRequirements(n.LabelSelector) - // Nil indicates that requirements failed validation in some way, - // so we cannot parse the labels for matching purposes; thus, we cannot - // match if labels cannot be parsed, so return false. - if n.requirements == nil { - return false - } - } - for _, req := range *n.requirements { - if !req.Matches(lblsToMatch) { - return false - } - } - return true -} - -// IsWildcard returns true if the endpoint selector selects all endpoints. -func (n *EndpointSelector) IsWildcard() bool { - return n.LabelSelector != nil && - len(n.LabelSelector.MatchLabels)+len(n.LabelSelector.MatchExpressions) == 0 -} - -// ConvertToLabelSelectorRequirementSlice converts the MatchLabels and -// MatchExpressions within the specified EndpointSelector into a list of -// LabelSelectorRequirements. -func (n *EndpointSelector) ConvertToLabelSelectorRequirementSlice() []slim_metav1.LabelSelectorRequirement { - requirements := make([]slim_metav1.LabelSelectorRequirement, 0, len(n.MatchExpressions)+len(n.MatchLabels)) - // Append already existing match expressions. - requirements = append(requirements, n.MatchExpressions...) - // Convert each MatchLables to LabelSelectorRequirement. - for key, value := range n.MatchLabels { - requirementFromMatchLabels := slim_metav1.LabelSelectorRequirement{ - Key: key, - Operator: slim_metav1.LabelSelectorOpIn, - Values: []string{value}, - } - requirements = append(requirements, requirementFromMatchLabels) - } - return requirements -} - -// sanitize returns an error if the EndpointSelector's LabelSelector is invalid. -func (n *EndpointSelector) sanitize() error { - errList := validation.ValidateLabelSelector(n.LabelSelector, validation.LabelSelectorValidationOptions{AllowInvalidLabelValueInSelector: false}, nil) - if len(errList) > 0 { - return fmt.Errorf("invalid label selector: %w", errList.ToAggregate()) - } - return nil -} - -// EndpointSelectorSlice is a slice of EndpointSelectors that can be sorted. -type EndpointSelectorSlice []EndpointSelector - -func (s EndpointSelectorSlice) Len() int { return len(s) } -func (s EndpointSelectorSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } - -func (s EndpointSelectorSlice) Less(i, j int) bool { - strI := s[i].LabelSelectorString() - strJ := s[j].LabelSelectorString() - - return strings.Compare(strI, strJ) < 0 -} - -// Matches returns true if any of the EndpointSelectors in the slice match the -// provided labels -func (s EndpointSelectorSlice) Matches(ctx labels.LabelArray) bool { - for _, selector := range s { - if selector.Matches(ctx) { - return true - } - } - - return false -} - -// SelectsAllEndpoints returns whether the EndpointSelectorSlice selects all -// endpoints, which is true if the wildcard endpoint selector is present in the -// slice. -func (s EndpointSelectorSlice) SelectsAllEndpoints() bool { - for _, selector := range s { - if selector.IsWildcard() { - return true - } - } - return false -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/api/service.go b/vendor/github.com/cilium/cilium/pkg/policy/api/service.go deleted file mode 100644 index 57868a367..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/api/service.go +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package api - -// ServiceSelector is a label selector for k8s services -type ServiceSelector EndpointSelector - -// Service wraps around selectors for services -type Service struct { - // K8sServiceSelector selects services by k8s labels and namespace - K8sServiceSelector *K8sServiceSelectorNamespace `json:"k8sServiceSelector,omitempty"` - // K8sService selects service by name and namespace pair - K8sService *K8sServiceNamespace `json:"k8sService,omitempty"` -} - -// K8sServiceNamespace is an abstraction for the k8s service + namespace types. -type K8sServiceNamespace struct { - ServiceName string `json:"serviceName,omitempty"` - Namespace string `json:"namespace,omitempty"` -} - -// K8sServiceSelectorNamespace wraps service selector with namespace -type K8sServiceSelectorNamespace struct { - // +kubebuilder:validation:Required - Selector ServiceSelector `json:"selector"` - Namespace string `json:"namespace,omitempty"` -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/api/utils.go b/vendor/github.com/cilium/cilium/pkg/policy/api/utils.go deleted file mode 100644 index d4d053147..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/api/utils.go +++ /dev/null @@ -1,188 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package api - -import ( - "context" - "fmt" - "strings" -) - -// Exists returns true if the HTTP rule already exists in the list of rules -func (h *PortRuleHTTP) Exists(rules L7Rules) bool { - for _, existingRule := range rules.HTTP { - if h.Equal(existingRule) { - return true - } - } - - return false -} - -// Equal returns true if both HTTP rules are equal -func (h *PortRuleHTTP) Equal(o PortRuleHTTP) bool { - if h.Path != o.Path || - h.Method != o.Method || - h.Host != o.Host || - len(h.Headers) != len(o.Headers) || - len(h.HeaderMatches) != len(o.HeaderMatches) { - return false - } - - for i, value := range h.Headers { - if o.Headers[i] != value { - return false - } - } - - for i, value := range h.HeaderMatches { - if !o.HeaderMatches[i].Equal(value) { - return false - } - } - return true -} - -// Equal returns true if both Secrets are equal -func (a *Secret) Equal(b *Secret) bool { - return a == nil && b == nil || a != nil && b != nil && *a == *b -} - -// Equal returns true if both HeaderMatches are equal -func (h *HeaderMatch) Equal(o *HeaderMatch) bool { - if h.Mismatch != o.Mismatch || - h.Name != o.Name || - h.Value != o.Value || - !h.Secret.Equal(o.Secret) { - return false - } - return true -} - -// Exists returns true if the DNS rule already exists in the list of rules -func (d *PortRuleDNS) Exists(rules L7Rules) bool { - for _, existingRule := range rules.DNS { - if d.Equal(existingRule) { - return true - } - } - - return false -} - -// Exists returns true if the L7 rule already exists in the list of rules -func (h *PortRuleL7) Exists(rules L7Rules) bool { - for _, existingRule := range rules.L7 { - if h.Equal(existingRule) { - return true - } - } - - return false -} - -// Equal returns true if both rules are equal -func (d *PortRuleDNS) Equal(o PortRuleDNS) bool { - return d != nil && d.MatchName == o.MatchName && d.MatchPattern == o.MatchPattern -} - -// Equal returns true if both L7 rules are equal -func (h *PortRuleL7) Equal(o PortRuleL7) bool { - if len(*h) != len(o) { - return false - } - for k, v := range *h { - if v2, ok := o[k]; !ok || v2 != v { - return false - } - } - return true -} - -// Validate returns an error if the layer 4 protocol is not valid -func (l4 L4Proto) Validate() error { - switch l4 { - case ProtoAny, ProtoTCP, ProtoUDP, ProtoSCTP: - default: - return fmt.Errorf("invalid protocol %q, must be { tcp | udp | sctp | any }", l4) - } - - return nil -} - -// ParseL4Proto parses a string as layer 4 protocol -func ParseL4Proto(proto string) (L4Proto, error) { - if proto == "" { - return ProtoAny, nil - } - - p := L4Proto(strings.ToUpper(proto)) - return p, p.Validate() -} - -// ResourceQualifiedName returns the qualified name of an Envoy resource, -// prepending CEC namespace and CEC name to the resource name and using -// '/' as a separator. -// -// If resourceName already has a slash, it must be of the form 'namespace/name', where namespace -// usually is equal to 'namespace'. This also applies for clusterwide resources for which -// 'namespace' is empty. -// -// If 'resourceName' has no slash, it will be prepended with 'namespace/cecName' so that the -// full name passed to Envoy is 'namespace/cecName/resourceName'. This makes non-qualified resource -// names and resource name references local to the given namespace and CiliumEnvoyConfig CRD. -// -// if 'forceNamespace' is 'true' then resourceName is always prepended with "namespace/cecName/", -// even it it already has backslashes, unless the first component of the name is equal to -// 'namespace'. -// -// As a special case pass through an empty resourceName without qualification so that unnamed -// resources do not become named. This is important to not transform an invalid Envoy configuration -// to a valid one with a fake name. - -type Option int - -const ( - ForceNamespace Option = iota -) - -func ResourceQualifiedName(namespace, cecName, resourceName string, options ...Option) (name string, updated bool) { - forceNamespace := false - for _, option := range options { - switch option { - case ForceNamespace: - forceNamespace = true - } - } - - idx := strings.IndexRune(resourceName, '/') - if resourceName == "" || idx >= 0 && (!forceNamespace || (idx == len(namespace) && strings.HasPrefix(resourceName, namespace))) { - return resourceName, false - } - - var sb strings.Builder - - sb.WriteString(namespace) - sb.WriteRune('/') - sb.WriteString(cecName) - sb.WriteRune('/') - sb.WriteString(resourceName) - - return sb.String(), true -} - -// ExtractCidrSet abstracts away some of the logic from the CreateDerivative methods -func ExtractCidrSet(ctx context.Context, groups []Groups) ([]CIDRRule, error) { - var cidrSet []CIDRRule - for _, group := range groups { - c, err := group.GetCidrSet(ctx) - if err != nil { - return cidrSet, err - } - if len(c) > 0 { - cidrSet = append(cidrSet, c...) - } - } - return cidrSet, nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/api/zz_generated.deepcopy.go b/vendor/github.com/cilium/cilium/pkg/policy/api/zz_generated.deepcopy.go deleted file mode 100644 index c4fd467bf..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/api/zz_generated.deepcopy.go +++ /dev/null @@ -1,1136 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package api - -import ( - labels "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/labels" - v1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" - kafka "github.com/cilium/proxy/pkg/policy/api/kafka" - intstr "k8s.io/apimachinery/pkg/util/intstr" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AWSGroup) DeepCopyInto(out *AWSGroup) { - *out = *in - if in.Labels != nil { - in, out := &in.Labels, &out.Labels - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.SecurityGroupsIds != nil { - in, out := &in.SecurityGroupsIds, &out.SecurityGroupsIds - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.SecurityGroupsNames != nil { - in, out := &in.SecurityGroupsNames, &out.SecurityGroupsNames - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSGroup. -func (in *AWSGroup) DeepCopy() *AWSGroup { - if in == nil { - return nil - } - out := new(AWSGroup) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Authentication) DeepCopyInto(out *Authentication) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Authentication. -func (in *Authentication) DeepCopy() *Authentication { - if in == nil { - return nil - } - out := new(Authentication) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CIDRRule) DeepCopyInto(out *CIDRRule) { - *out = *in - if in.ExceptCIDRs != nil { - in, out := &in.ExceptCIDRs, &out.ExceptCIDRs - *out = make([]CIDR, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CIDRRule. -func (in *CIDRRule) DeepCopy() *CIDRRule { - if in == nil { - return nil - } - out := new(CIDRRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in CIDRRuleSlice) DeepCopyInto(out *CIDRRuleSlice) { - { - in := &in - *out = make(CIDRRuleSlice, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CIDRRuleSlice. -func (in CIDRRuleSlice) DeepCopy() CIDRRuleSlice { - if in == nil { - return nil - } - out := new(CIDRRuleSlice) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in CIDRSlice) DeepCopyInto(out *CIDRSlice) { - { - in := &in - *out = make(CIDRSlice, len(*in)) - copy(*out, *in) - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CIDRSlice. -func (in CIDRSlice) DeepCopy() CIDRSlice { - if in == nil { - return nil - } - out := new(CIDRSlice) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DefaultDenyConfig) DeepCopyInto(out *DefaultDenyConfig) { - *out = *in - if in.Ingress != nil { - in, out := &in.Ingress, &out.Ingress - *out = new(bool) - **out = **in - } - if in.Egress != nil { - in, out := &in.Egress, &out.Egress - *out = new(bool) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DefaultDenyConfig. -func (in *DefaultDenyConfig) DeepCopy() *DefaultDenyConfig { - if in == nil { - return nil - } - out := new(DefaultDenyConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EgressCommonRule) DeepCopyInto(out *EgressCommonRule) { - *out = *in - if in.ToEndpoints != nil { - in, out := &in.ToEndpoints, &out.ToEndpoints - *out = make([]EndpointSelector, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.ToRequires != nil { - in, out := &in.ToRequires, &out.ToRequires - *out = make([]EndpointSelector, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.ToCIDR != nil { - in, out := &in.ToCIDR, &out.ToCIDR - *out = make(CIDRSlice, len(*in)) - copy(*out, *in) - } - if in.ToCIDRSet != nil { - in, out := &in.ToCIDRSet, &out.ToCIDRSet - *out = make(CIDRRuleSlice, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.ToEntities != nil { - in, out := &in.ToEntities, &out.ToEntities - *out = make(EntitySlice, len(*in)) - copy(*out, *in) - } - if in.ToServices != nil { - in, out := &in.ToServices, &out.ToServices - *out = make([]Service, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.ToGroups != nil { - in, out := &in.ToGroups, &out.ToGroups - *out = make([]Groups, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.ToNodes != nil { - in, out := &in.ToNodes, &out.ToNodes - *out = make([]EndpointSelector, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.aggregatedSelectors != nil { - in, out := &in.aggregatedSelectors, &out.aggregatedSelectors - *out = make(EndpointSelectorSlice, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EgressCommonRule. -func (in *EgressCommonRule) DeepCopy() *EgressCommonRule { - if in == nil { - return nil - } - out := new(EgressCommonRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EgressDenyRule) DeepCopyInto(out *EgressDenyRule) { - *out = *in - in.EgressCommonRule.DeepCopyInto(&out.EgressCommonRule) - if in.ToPorts != nil { - in, out := &in.ToPorts, &out.ToPorts - *out = make(PortDenyRules, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.ICMPs != nil { - in, out := &in.ICMPs, &out.ICMPs - *out = make(ICMPRules, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EgressDenyRule. -func (in *EgressDenyRule) DeepCopy() *EgressDenyRule { - if in == nil { - return nil - } - out := new(EgressDenyRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EgressRule) DeepCopyInto(out *EgressRule) { - *out = *in - in.EgressCommonRule.DeepCopyInto(&out.EgressCommonRule) - if in.ToPorts != nil { - in, out := &in.ToPorts, &out.ToPorts - *out = make(PortRules, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.ToFQDNs != nil { - in, out := &in.ToFQDNs, &out.ToFQDNs - *out = make(FQDNSelectorSlice, len(*in)) - copy(*out, *in) - } - if in.ICMPs != nil { - in, out := &in.ICMPs, &out.ICMPs - *out = make(ICMPRules, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Authentication != nil { - in, out := &in.Authentication, &out.Authentication - *out = new(Authentication) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EgressRule. -func (in *EgressRule) DeepCopy() *EgressRule { - if in == nil { - return nil - } - out := new(EgressRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointSelector) DeepCopyInto(out *EndpointSelector) { - *out = *in - if in.LabelSelector != nil { - in, out := &in.LabelSelector, &out.LabelSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - if in.requirements != nil { - in, out := &in.requirements, &out.requirements - *out = new(labels.Requirements) - if **in != nil { - in, out := *in, *out - *out = make([]labels.Requirement, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSelector. -func (in *EndpointSelector) DeepCopy() *EndpointSelector { - if in == nil { - return nil - } - out := new(EndpointSelector) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in EndpointSelectorSlice) DeepCopyInto(out *EndpointSelectorSlice) { - { - in := &in - *out = make(EndpointSelectorSlice, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSelectorSlice. -func (in EndpointSelectorSlice) DeepCopy() EndpointSelectorSlice { - if in == nil { - return nil - } - out := new(EndpointSelectorSlice) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in EntitySlice) DeepCopyInto(out *EntitySlice) { - { - in := &in - *out = make(EntitySlice, len(*in)) - copy(*out, *in) - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EntitySlice. -func (in EntitySlice) DeepCopy() EntitySlice { - if in == nil { - return nil - } - out := new(EntitySlice) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EnvoyConfig) DeepCopyInto(out *EnvoyConfig) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvoyConfig. -func (in *EnvoyConfig) DeepCopy() *EnvoyConfig { - if in == nil { - return nil - } - out := new(EnvoyConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FQDNSelector) DeepCopyInto(out *FQDNSelector) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FQDNSelector. -func (in *FQDNSelector) DeepCopy() *FQDNSelector { - if in == nil { - return nil - } - out := new(FQDNSelector) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in FQDNSelectorSlice) DeepCopyInto(out *FQDNSelectorSlice) { - { - in := &in - *out = make(FQDNSelectorSlice, len(*in)) - copy(*out, *in) - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FQDNSelectorSlice. -func (in FQDNSelectorSlice) DeepCopy() FQDNSelectorSlice { - if in == nil { - return nil - } - out := new(FQDNSelectorSlice) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Groups) DeepCopyInto(out *Groups) { - *out = *in - if in.AWS != nil { - in, out := &in.AWS, &out.AWS - *out = new(AWSGroup) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Groups. -func (in *Groups) DeepCopy() *Groups { - if in == nil { - return nil - } - out := new(Groups) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HeaderMatch) DeepCopyInto(out *HeaderMatch) { - *out = *in - if in.Secret != nil { - in, out := &in.Secret, &out.Secret - *out = new(Secret) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HeaderMatch. -func (in *HeaderMatch) DeepCopy() *HeaderMatch { - if in == nil { - return nil - } - out := new(HeaderMatch) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ICMPField) DeepCopyInto(out *ICMPField) { - *out = *in - if in.Type != nil { - in, out := &in.Type, &out.Type - *out = new(intstr.IntOrString) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ICMPField. -func (in *ICMPField) DeepCopy() *ICMPField { - if in == nil { - return nil - } - out := new(ICMPField) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ICMPRule) DeepCopyInto(out *ICMPRule) { - *out = *in - if in.Fields != nil { - in, out := &in.Fields, &out.Fields - *out = make([]ICMPField, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ICMPRule. -func (in *ICMPRule) DeepCopy() *ICMPRule { - if in == nil { - return nil - } - out := new(ICMPRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in ICMPRules) DeepCopyInto(out *ICMPRules) { - { - in := &in - *out = make(ICMPRules, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ICMPRules. -func (in ICMPRules) DeepCopy() ICMPRules { - if in == nil { - return nil - } - out := new(ICMPRules) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IngressCommonRule) DeepCopyInto(out *IngressCommonRule) { - *out = *in - if in.FromEndpoints != nil { - in, out := &in.FromEndpoints, &out.FromEndpoints - *out = make([]EndpointSelector, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.FromRequires != nil { - in, out := &in.FromRequires, &out.FromRequires - *out = make([]EndpointSelector, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.FromCIDR != nil { - in, out := &in.FromCIDR, &out.FromCIDR - *out = make(CIDRSlice, len(*in)) - copy(*out, *in) - } - if in.FromCIDRSet != nil { - in, out := &in.FromCIDRSet, &out.FromCIDRSet - *out = make(CIDRRuleSlice, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.FromEntities != nil { - in, out := &in.FromEntities, &out.FromEntities - *out = make(EntitySlice, len(*in)) - copy(*out, *in) - } - if in.FromGroups != nil { - in, out := &in.FromGroups, &out.FromGroups - *out = make([]Groups, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.FromNodes != nil { - in, out := &in.FromNodes, &out.FromNodes - *out = make([]EndpointSelector, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.aggregatedSelectors != nil { - in, out := &in.aggregatedSelectors, &out.aggregatedSelectors - *out = make(EndpointSelectorSlice, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressCommonRule. -func (in *IngressCommonRule) DeepCopy() *IngressCommonRule { - if in == nil { - return nil - } - out := new(IngressCommonRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IngressDenyRule) DeepCopyInto(out *IngressDenyRule) { - *out = *in - in.IngressCommonRule.DeepCopyInto(&out.IngressCommonRule) - if in.ToPorts != nil { - in, out := &in.ToPorts, &out.ToPorts - *out = make(PortDenyRules, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.ICMPs != nil { - in, out := &in.ICMPs, &out.ICMPs - *out = make(ICMPRules, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressDenyRule. -func (in *IngressDenyRule) DeepCopy() *IngressDenyRule { - if in == nil { - return nil - } - out := new(IngressDenyRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IngressRule) DeepCopyInto(out *IngressRule) { - *out = *in - in.IngressCommonRule.DeepCopyInto(&out.IngressCommonRule) - if in.ToPorts != nil { - in, out := &in.ToPorts, &out.ToPorts - *out = make(PortRules, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.ICMPs != nil { - in, out := &in.ICMPs, &out.ICMPs - *out = make(ICMPRules, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Authentication != nil { - in, out := &in.Authentication, &out.Authentication - *out = new(Authentication) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressRule. -func (in *IngressRule) DeepCopy() *IngressRule { - if in == nil { - return nil - } - out := new(IngressRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *K8sServiceNamespace) DeepCopyInto(out *K8sServiceNamespace) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new K8sServiceNamespace. -func (in *K8sServiceNamespace) DeepCopy() *K8sServiceNamespace { - if in == nil { - return nil - } - out := new(K8sServiceNamespace) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *K8sServiceSelectorNamespace) DeepCopyInto(out *K8sServiceSelectorNamespace) { - *out = *in - in.Selector.DeepCopyInto(&out.Selector) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new K8sServiceSelectorNamespace. -func (in *K8sServiceSelectorNamespace) DeepCopy() *K8sServiceSelectorNamespace { - if in == nil { - return nil - } - out := new(K8sServiceSelectorNamespace) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *L7Rules) DeepCopyInto(out *L7Rules) { - *out = *in - if in.HTTP != nil { - in, out := &in.HTTP, &out.HTTP - *out = make([]PortRuleHTTP, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Kafka != nil { - in, out := &in.Kafka, &out.Kafka - *out = make([]kafka.PortRule, len(*in)) - copy(*out, *in) - } - if in.DNS != nil { - in, out := &in.DNS, &out.DNS - *out = make([]PortRuleDNS, len(*in)) - copy(*out, *in) - } - if in.L7 != nil { - in, out := &in.L7, &out.L7 - *out = make([]PortRuleL7, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = make(PortRuleL7, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new L7Rules. -func (in *L7Rules) DeepCopy() *L7Rules { - if in == nil { - return nil - } - out := new(L7Rules) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Listener) DeepCopyInto(out *Listener) { - *out = *in - if in.EnvoyConfig != nil { - in, out := &in.EnvoyConfig, &out.EnvoyConfig - *out = new(EnvoyConfig) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Listener. -func (in *Listener) DeepCopy() *Listener { - if in == nil { - return nil - } - out := new(Listener) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PortDenyRule) DeepCopyInto(out *PortDenyRule) { - *out = *in - if in.Ports != nil { - in, out := &in.Ports, &out.Ports - *out = make([]PortProtocol, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortDenyRule. -func (in *PortDenyRule) DeepCopy() *PortDenyRule { - if in == nil { - return nil - } - out := new(PortDenyRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in PortDenyRules) DeepCopyInto(out *PortDenyRules) { - { - in := &in - *out = make(PortDenyRules, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortDenyRules. -func (in PortDenyRules) DeepCopy() PortDenyRules { - if in == nil { - return nil - } - out := new(PortDenyRules) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PortProtocol) DeepCopyInto(out *PortProtocol) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortProtocol. -func (in *PortProtocol) DeepCopy() *PortProtocol { - if in == nil { - return nil - } - out := new(PortProtocol) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PortRule) DeepCopyInto(out *PortRule) { - *out = *in - if in.Ports != nil { - in, out := &in.Ports, &out.Ports - *out = make([]PortProtocol, len(*in)) - copy(*out, *in) - } - if in.TerminatingTLS != nil { - in, out := &in.TerminatingTLS, &out.TerminatingTLS - *out = new(TLSContext) - (*in).DeepCopyInto(*out) - } - if in.OriginatingTLS != nil { - in, out := &in.OriginatingTLS, &out.OriginatingTLS - *out = new(TLSContext) - (*in).DeepCopyInto(*out) - } - if in.ServerNames != nil { - in, out := &in.ServerNames, &out.ServerNames - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Listener != nil { - in, out := &in.Listener, &out.Listener - *out = new(Listener) - (*in).DeepCopyInto(*out) - } - if in.Rules != nil { - in, out := &in.Rules, &out.Rules - *out = new(L7Rules) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortRule. -func (in *PortRule) DeepCopy() *PortRule { - if in == nil { - return nil - } - out := new(PortRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PortRuleDNS) DeepCopyInto(out *PortRuleDNS) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortRuleDNS. -func (in *PortRuleDNS) DeepCopy() *PortRuleDNS { - if in == nil { - return nil - } - out := new(PortRuleDNS) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PortRuleHTTP) DeepCopyInto(out *PortRuleHTTP) { - *out = *in - if in.Headers != nil { - in, out := &in.Headers, &out.Headers - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.HeaderMatches != nil { - in, out := &in.HeaderMatches, &out.HeaderMatches - *out = make([]*HeaderMatch, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(HeaderMatch) - (*in).DeepCopyInto(*out) - } - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortRuleHTTP. -func (in *PortRuleHTTP) DeepCopy() *PortRuleHTTP { - if in == nil { - return nil - } - out := new(PortRuleHTTP) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in PortRuleL7) DeepCopyInto(out *PortRuleL7) { - { - in := &in - *out = make(PortRuleL7, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortRuleL7. -func (in PortRuleL7) DeepCopy() PortRuleL7 { - if in == nil { - return nil - } - out := new(PortRuleL7) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in PortRules) DeepCopyInto(out *PortRules) { - { - in := &in - *out = make(PortRules, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortRules. -func (in PortRules) DeepCopy() PortRules { - if in == nil { - return nil - } - out := new(PortRules) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Rule) DeepCopyInto(out *Rule) { - *out = *in - in.EndpointSelector.DeepCopyInto(&out.EndpointSelector) - in.NodeSelector.DeepCopyInto(&out.NodeSelector) - if in.Ingress != nil { - in, out := &in.Ingress, &out.Ingress - *out = make([]IngressRule, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.IngressDeny != nil { - in, out := &in.IngressDeny, &out.IngressDeny - *out = make([]IngressDenyRule, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Egress != nil { - in, out := &in.Egress, &out.Egress - *out = make([]EgressRule, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.EgressDeny != nil { - in, out := &in.EgressDeny, &out.EgressDeny - *out = make([]EgressDenyRule, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - out.Labels = in.Labels.DeepCopy() - in.EnableDefaultDeny.DeepCopyInto(&out.EnableDefaultDeny) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Rule. -func (in *Rule) DeepCopy() *Rule { - if in == nil { - return nil - } - out := new(Rule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in Rules) DeepCopyInto(out *Rules) { - { - in := &in - *out = make(Rules, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(Rule) - (*in).DeepCopyInto(*out) - } - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Rules. -func (in Rules) DeepCopy() Rules { - if in == nil { - return nil - } - out := new(Rules) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Secret) DeepCopyInto(out *Secret) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Secret. -func (in *Secret) DeepCopy() *Secret { - if in == nil { - return nil - } - out := new(Secret) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Service) DeepCopyInto(out *Service) { - *out = *in - if in.K8sServiceSelector != nil { - in, out := &in.K8sServiceSelector, &out.K8sServiceSelector - *out = new(K8sServiceSelectorNamespace) - (*in).DeepCopyInto(*out) - } - if in.K8sService != nil { - in, out := &in.K8sService, &out.K8sService - *out = new(K8sServiceNamespace) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Service. -func (in *Service) DeepCopy() *Service { - if in == nil { - return nil - } - out := new(Service) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ServiceSelector) DeepCopyInto(out *ServiceSelector) { - *out = *in - if in.LabelSelector != nil { - in, out := &in.LabelSelector, &out.LabelSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - if in.requirements != nil { - in, out := &in.requirements, &out.requirements - *out = new(labels.Requirements) - if **in != nil { - in, out := *in, *out - *out = make([]labels.Requirement, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceSelector. -func (in *ServiceSelector) DeepCopy() *ServiceSelector { - if in == nil { - return nil - } - out := new(ServiceSelector) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TLSContext) DeepCopyInto(out *TLSContext) { - *out = *in - if in.Secret != nil { - in, out := &in.Secret, &out.Secret - *out = new(Secret) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSContext. -func (in *TLSContext) DeepCopy() *TLSContext { - if in == nil { - return nil - } - out := new(TLSContext) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/api/zz_generated.deepequal.go b/vendor/github.com/cilium/cilium/pkg/policy/api/zz_generated.deepequal.go deleted file mode 100644 index 517426f34..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/api/zz_generated.deepequal.go +++ /dev/null @@ -1,1407 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepequal-gen. DO NOT EDIT. - -package api - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *AWSGroup) DeepEqual(other *AWSGroup) bool { - if other == nil { - return false - } - - if ((in.Labels != nil) && (other.Labels != nil)) || ((in.Labels == nil) != (other.Labels == nil)) { - in, other := &in.Labels, &other.Labels - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if inValue != otherValue { - return false - } - } - } - } - } - - if ((in.SecurityGroupsIds != nil) && (other.SecurityGroupsIds != nil)) || ((in.SecurityGroupsIds == nil) != (other.SecurityGroupsIds == nil)) { - in, other := &in.SecurityGroupsIds, &other.SecurityGroupsIds - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if ((in.SecurityGroupsNames != nil) && (other.SecurityGroupsNames != nil)) || ((in.SecurityGroupsNames == nil) != (other.SecurityGroupsNames == nil)) { - in, other := &in.SecurityGroupsNames, &other.SecurityGroupsNames - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if in.Region != other.Region { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Authentication) DeepEqual(other *Authentication) bool { - if other == nil { - return false - } - - if in.Mode != other.Mode { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CIDRRule) DeepEqual(other *CIDRRule) bool { - if other == nil { - return false - } - - if in.Cidr != other.Cidr { - return false - } - if in.CIDRGroupRef != other.CIDRGroupRef { - return false - } - if ((in.ExceptCIDRs != nil) && (other.ExceptCIDRs != nil)) || ((in.ExceptCIDRs == nil) != (other.ExceptCIDRs == nil)) { - in, other := &in.ExceptCIDRs, &other.ExceptCIDRs - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if in.Generated != other.Generated { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CIDRRuleSlice) DeepEqual(other *CIDRRuleSlice) bool { - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *CIDRSlice) DeepEqual(other *CIDRSlice) bool { - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *DefaultDenyConfig) DeepEqual(other *DefaultDenyConfig) bool { - if other == nil { - return false - } - - if (in.Ingress == nil) != (other.Ingress == nil) { - return false - } else if in.Ingress != nil { - if *in.Ingress != *other.Ingress { - return false - } - } - - if (in.Egress == nil) != (other.Egress == nil) { - return false - } else if in.Egress != nil { - if *in.Egress != *other.Egress { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EgressCommonRule) DeepEqual(other *EgressCommonRule) bool { - if other == nil { - return false - } - - if ((in.ToEndpoints != nil) && (other.ToEndpoints != nil)) || ((in.ToEndpoints == nil) != (other.ToEndpoints == nil)) { - in, other := &in.ToEndpoints, &other.ToEndpoints - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.ToRequires != nil) && (other.ToRequires != nil)) || ((in.ToRequires == nil) != (other.ToRequires == nil)) { - in, other := &in.ToRequires, &other.ToRequires - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.ToCIDR != nil) && (other.ToCIDR != nil)) || ((in.ToCIDR == nil) != (other.ToCIDR == nil)) { - in, other := &in.ToCIDR, &other.ToCIDR - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if ((in.ToCIDRSet != nil) && (other.ToCIDRSet != nil)) || ((in.ToCIDRSet == nil) != (other.ToCIDRSet == nil)) { - in, other := &in.ToCIDRSet, &other.ToCIDRSet - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if ((in.ToEntities != nil) && (other.ToEntities != nil)) || ((in.ToEntities == nil) != (other.ToEntities == nil)) { - in, other := &in.ToEntities, &other.ToEntities - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if ((in.ToServices != nil) && (other.ToServices != nil)) || ((in.ToServices == nil) != (other.ToServices == nil)) { - in, other := &in.ToServices, &other.ToServices - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.ToGroups != nil) && (other.ToGroups != nil)) || ((in.ToGroups == nil) != (other.ToGroups == nil)) { - in, other := &in.ToGroups, &other.ToGroups - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.ToNodes != nil) && (other.ToNodes != nil)) || ((in.ToNodes == nil) != (other.ToNodes == nil)) { - in, other := &in.ToNodes, &other.ToNodes - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.aggregatedSelectors != nil) && (other.aggregatedSelectors != nil)) || ((in.aggregatedSelectors == nil) != (other.aggregatedSelectors == nil)) { - in, other := &in.aggregatedSelectors, &other.aggregatedSelectors - if other == nil || !in.DeepEqual(other) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EgressDenyRule) DeepEqual(other *EgressDenyRule) bool { - if other == nil { - return false - } - - if !in.EgressCommonRule.DeepEqual(&other.EgressCommonRule) { - return false - } - - if ((in.ToPorts != nil) && (other.ToPorts != nil)) || ((in.ToPorts == nil) != (other.ToPorts == nil)) { - in, other := &in.ToPorts, &other.ToPorts - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if ((in.ICMPs != nil) && (other.ICMPs != nil)) || ((in.ICMPs == nil) != (other.ICMPs == nil)) { - in, other := &in.ICMPs, &other.ICMPs - if other == nil || !in.DeepEqual(other) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EgressRule) DeepEqual(other *EgressRule) bool { - if other == nil { - return false - } - - if !in.EgressCommonRule.DeepEqual(&other.EgressCommonRule) { - return false - } - - if ((in.ToPorts != nil) && (other.ToPorts != nil)) || ((in.ToPorts == nil) != (other.ToPorts == nil)) { - in, other := &in.ToPorts, &other.ToPorts - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if ((in.ToFQDNs != nil) && (other.ToFQDNs != nil)) || ((in.ToFQDNs == nil) != (other.ToFQDNs == nil)) { - in, other := &in.ToFQDNs, &other.ToFQDNs - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if ((in.ICMPs != nil) && (other.ICMPs != nil)) || ((in.ICMPs == nil) != (other.ICMPs == nil)) { - in, other := &in.ICMPs, &other.ICMPs - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if (in.Authentication == nil) != (other.Authentication == nil) { - return false - } else if in.Authentication != nil { - if !in.Authentication.DeepEqual(other.Authentication) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EndpointSelector) DeepEqual(other *EndpointSelector) bool { - if other == nil { - return false - } - - if (in.LabelSelector == nil) != (other.LabelSelector == nil) { - return false - } else if in.LabelSelector != nil { - if !in.LabelSelector.DeepEqual(other.LabelSelector) { - return false - } - } - - if (in.requirements == nil) != (other.requirements == nil) { - return false - } else if in.requirements != nil { - if !in.requirements.DeepEqual(other.requirements) { - return false - } - } - - if in.cachedLabelSelectorString != other.cachedLabelSelectorString { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EndpointSelectorSlice) DeepEqual(other *EndpointSelectorSlice) bool { - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EntitySlice) DeepEqual(other *EntitySlice) bool { - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *EnvoyConfig) DeepEqual(other *EnvoyConfig) bool { - if other == nil { - return false - } - - if in.Kind != other.Kind { - return false - } - if in.Name != other.Name { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *FQDNSelector) DeepEqual(other *FQDNSelector) bool { - if other == nil { - return false - } - - if in.MatchName != other.MatchName { - return false - } - if in.MatchPattern != other.MatchPattern { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *FQDNSelectorSlice) DeepEqual(other *FQDNSelectorSlice) bool { - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Groups) DeepEqual(other *Groups) bool { - if other == nil { - return false - } - - if (in.AWS == nil) != (other.AWS == nil) { - return false - } else if in.AWS != nil { - if !in.AWS.DeepEqual(other.AWS) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *HeaderMatch) DeepEqual(other *HeaderMatch) bool { - if other == nil { - return false - } - - if in.Mismatch != other.Mismatch { - return false - } - if in.Name != other.Name { - return false - } - if (in.Secret == nil) != (other.Secret == nil) { - return false - } else if in.Secret != nil { - if !in.Secret.DeepEqual(other.Secret) { - return false - } - } - - if in.Value != other.Value { - return false - } - - return true -} - -// deepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ICMPField) deepEqual(other *ICMPField) bool { - if other == nil { - return false - } - - if in.Family != other.Family { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ICMPRule) DeepEqual(other *ICMPRule) bool { - if other == nil { - return false - } - - if ((in.Fields != nil) && (other.Fields != nil)) || ((in.Fields == nil) != (other.Fields == nil)) { - in, other := &in.Fields, &other.Fields - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ICMPRules) DeepEqual(other *ICMPRules) bool { - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *IngressCommonRule) DeepEqual(other *IngressCommonRule) bool { - if other == nil { - return false - } - - if ((in.FromEndpoints != nil) && (other.FromEndpoints != nil)) || ((in.FromEndpoints == nil) != (other.FromEndpoints == nil)) { - in, other := &in.FromEndpoints, &other.FromEndpoints - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.FromRequires != nil) && (other.FromRequires != nil)) || ((in.FromRequires == nil) != (other.FromRequires == nil)) { - in, other := &in.FromRequires, &other.FromRequires - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.FromCIDR != nil) && (other.FromCIDR != nil)) || ((in.FromCIDR == nil) != (other.FromCIDR == nil)) { - in, other := &in.FromCIDR, &other.FromCIDR - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if ((in.FromCIDRSet != nil) && (other.FromCIDRSet != nil)) || ((in.FromCIDRSet == nil) != (other.FromCIDRSet == nil)) { - in, other := &in.FromCIDRSet, &other.FromCIDRSet - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if ((in.FromEntities != nil) && (other.FromEntities != nil)) || ((in.FromEntities == nil) != (other.FromEntities == nil)) { - in, other := &in.FromEntities, &other.FromEntities - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if ((in.FromGroups != nil) && (other.FromGroups != nil)) || ((in.FromGroups == nil) != (other.FromGroups == nil)) { - in, other := &in.FromGroups, &other.FromGroups - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.FromNodes != nil) && (other.FromNodes != nil)) || ((in.FromNodes == nil) != (other.FromNodes == nil)) { - in, other := &in.FromNodes, &other.FromNodes - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.aggregatedSelectors != nil) && (other.aggregatedSelectors != nil)) || ((in.aggregatedSelectors == nil) != (other.aggregatedSelectors == nil)) { - in, other := &in.aggregatedSelectors, &other.aggregatedSelectors - if other == nil || !in.DeepEqual(other) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *IngressDenyRule) DeepEqual(other *IngressDenyRule) bool { - if other == nil { - return false - } - - if !in.IngressCommonRule.DeepEqual(&other.IngressCommonRule) { - return false - } - - if ((in.ToPorts != nil) && (other.ToPorts != nil)) || ((in.ToPorts == nil) != (other.ToPorts == nil)) { - in, other := &in.ToPorts, &other.ToPorts - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if ((in.ICMPs != nil) && (other.ICMPs != nil)) || ((in.ICMPs == nil) != (other.ICMPs == nil)) { - in, other := &in.ICMPs, &other.ICMPs - if other == nil || !in.DeepEqual(other) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *IngressRule) DeepEqual(other *IngressRule) bool { - if other == nil { - return false - } - - if !in.IngressCommonRule.DeepEqual(&other.IngressCommonRule) { - return false - } - - if ((in.ToPorts != nil) && (other.ToPorts != nil)) || ((in.ToPorts == nil) != (other.ToPorts == nil)) { - in, other := &in.ToPorts, &other.ToPorts - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if ((in.ICMPs != nil) && (other.ICMPs != nil)) || ((in.ICMPs == nil) != (other.ICMPs == nil)) { - in, other := &in.ICMPs, &other.ICMPs - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if (in.Authentication == nil) != (other.Authentication == nil) { - return false - } else if in.Authentication != nil { - if !in.Authentication.DeepEqual(other.Authentication) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *K8sServiceNamespace) DeepEqual(other *K8sServiceNamespace) bool { - if other == nil { - return false - } - - if in.ServiceName != other.ServiceName { - return false - } - if in.Namespace != other.Namespace { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *K8sServiceSelectorNamespace) DeepEqual(other *K8sServiceSelectorNamespace) bool { - if other == nil { - return false - } - - if !in.Selector.DeepEqual(&other.Selector) { - return false - } - - if in.Namespace != other.Namespace { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *L7Rules) DeepEqual(other *L7Rules) bool { - if other == nil { - return false - } - - if ((in.HTTP != nil) && (other.HTTP != nil)) || ((in.HTTP == nil) != (other.HTTP == nil)) { - in, other := &in.HTTP, &other.HTTP - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.Kafka != nil) && (other.Kafka != nil)) || ((in.Kafka == nil) != (other.Kafka == nil)) { - in, other := &in.Kafka, &other.Kafka - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.DNS != nil) && (other.DNS != nil)) || ((in.DNS == nil) != (other.DNS == nil)) { - in, other := &in.DNS, &other.DNS - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if in.L7Proto != other.L7Proto { - return false - } - if ((in.L7 != nil) && (other.L7 != nil)) || ((in.L7 == nil) != (other.L7 == nil)) { - in, other := &in.L7, &other.L7 - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Listener) DeepEqual(other *Listener) bool { - if other == nil { - return false - } - - if (in.EnvoyConfig == nil) != (other.EnvoyConfig == nil) { - return false - } else if in.EnvoyConfig != nil { - if !in.EnvoyConfig.DeepEqual(other.EnvoyConfig) { - return false - } - } - - if in.Name != other.Name { - return false - } - if in.Priority != other.Priority { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PortDenyRule) DeepEqual(other *PortDenyRule) bool { - if other == nil { - return false - } - - if ((in.Ports != nil) && (other.Ports != nil)) || ((in.Ports == nil) != (other.Ports == nil)) { - in, other := &in.Ports, &other.Ports - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PortDenyRules) DeepEqual(other *PortDenyRules) bool { - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PortProtocol) DeepEqual(other *PortProtocol) bool { - if other == nil { - return false - } - - if in.Port != other.Port { - return false - } - if in.Protocol != other.Protocol { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PortRule) DeepEqual(other *PortRule) bool { - if other == nil { - return false - } - - if ((in.Ports != nil) && (other.Ports != nil)) || ((in.Ports == nil) != (other.Ports == nil)) { - in, other := &in.Ports, &other.Ports - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if (in.TerminatingTLS == nil) != (other.TerminatingTLS == nil) { - return false - } else if in.TerminatingTLS != nil { - if !in.TerminatingTLS.DeepEqual(other.TerminatingTLS) { - return false - } - } - - if (in.OriginatingTLS == nil) != (other.OriginatingTLS == nil) { - return false - } else if in.OriginatingTLS != nil { - if !in.OriginatingTLS.DeepEqual(other.OriginatingTLS) { - return false - } - } - - if ((in.ServerNames != nil) && (other.ServerNames != nil)) || ((in.ServerNames == nil) != (other.ServerNames == nil)) { - in, other := &in.ServerNames, &other.ServerNames - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if (in.Listener == nil) != (other.Listener == nil) { - return false - } else if in.Listener != nil { - if !in.Listener.DeepEqual(other.Listener) { - return false - } - } - - if (in.Rules == nil) != (other.Rules == nil) { - return false - } else if in.Rules != nil { - if !in.Rules.DeepEqual(other.Rules) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PortRuleDNS) DeepEqual(other *PortRuleDNS) bool { - if other == nil { - return false - } - - if in.MatchName != other.MatchName { - return false - } - if in.MatchPattern != other.MatchPattern { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PortRuleHTTP) DeepEqual(other *PortRuleHTTP) bool { - if other == nil { - return false - } - - if in.Path != other.Path { - return false - } - if in.Method != other.Method { - return false - } - if in.Host != other.Host { - return false - } - if ((in.Headers != nil) && (other.Headers != nil)) || ((in.Headers == nil) != (other.Headers == nil)) { - in, other := &in.Headers, &other.Headers - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if inElement != (*other)[i] { - return false - } - } - } - } - - if ((in.HeaderMatches != nil) && (other.HeaderMatches != nil)) || ((in.HeaderMatches == nil) != (other.HeaderMatches == nil)) { - in, other := &in.HeaderMatches, &other.HeaderMatches - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual((*other)[i]) { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PortRuleL7) DeepEqual(other *PortRuleL7) bool { - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for key, inValue := range *in { - if otherValue, present := (*other)[key]; !present { - return false - } else { - if inValue != otherValue { - return false - } - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PortRules) DeepEqual(other *PortRules) bool { - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - - return true -} - -// deepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Rule) deepEqual(other *Rule) bool { - if other == nil { - return false - } - - if !in.EndpointSelector.DeepEqual(&other.EndpointSelector) { - return false - } - - if !in.NodeSelector.DeepEqual(&other.NodeSelector) { - return false - } - - if ((in.Ingress != nil) && (other.Ingress != nil)) || ((in.Ingress == nil) != (other.Ingress == nil)) { - in, other := &in.Ingress, &other.Ingress - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.IngressDeny != nil) && (other.IngressDeny != nil)) || ((in.IngressDeny == nil) != (other.IngressDeny == nil)) { - in, other := &in.IngressDeny, &other.IngressDeny - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.Egress != nil) && (other.Egress != nil)) || ((in.Egress == nil) != (other.Egress == nil)) { - in, other := &in.Egress, &other.Egress - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.EgressDeny != nil) && (other.EgressDeny != nil)) || ((in.EgressDeny == nil) != (other.EgressDeny == nil)) { - in, other := &in.EgressDeny, &other.EgressDeny - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual(&(*other)[i]) { - return false - } - } - } - } - - if ((in.Labels != nil) && (other.Labels != nil)) || ((in.Labels == nil) != (other.Labels == nil)) { - in, other := &in.Labels, &other.Labels - if other == nil || !in.DeepEqual(other) { - return false - } - } - - if !in.EnableDefaultDeny.DeepEqual(&other.EnableDefaultDeny) { - return false - } - - if in.Description != other.Description { - return false - } - - return true -} - -// deepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Rules) deepEqual(other *Rules) bool { - if other == nil { - return false - } - - if len(*in) != len(*other) { - return false - } else { - for i, inElement := range *in { - if !inElement.DeepEqual((*other)[i]) { - return false - } - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Secret) DeepEqual(other *Secret) bool { - if other == nil { - return false - } - - if in.Namespace != other.Namespace { - return false - } - if in.Name != other.Name { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *Service) DeepEqual(other *Service) bool { - if other == nil { - return false - } - - if (in.K8sServiceSelector == nil) != (other.K8sServiceSelector == nil) { - return false - } else if in.K8sServiceSelector != nil { - if !in.K8sServiceSelector.DeepEqual(other.K8sServiceSelector) { - return false - } - } - - if (in.K8sService == nil) != (other.K8sService == nil) { - return false - } else if in.K8sService != nil { - if !in.K8sService.DeepEqual(other.K8sService) { - return false - } - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *ServiceSelector) DeepEqual(other *ServiceSelector) bool { - if other == nil { - return false - } - - if (in.LabelSelector == nil) != (other.LabelSelector == nil) { - return false - } else if in.LabelSelector != nil { - if !in.LabelSelector.DeepEqual(other.LabelSelector) { - return false - } - } - - if (in.requirements == nil) != (other.requirements == nil) { - return false - } else if in.requirements != nil { - if !in.requirements.DeepEqual(other.requirements) { - return false - } - } - - if in.cachedLabelSelectorString != other.cachedLabelSelectorString { - return false - } - - return true -} - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *TLSContext) DeepEqual(other *TLSContext) bool { - if other == nil { - return false - } - - if (in.Secret == nil) != (other.Secret == nil) { - return false - } else if in.Secret != nil { - if !in.Secret.DeepEqual(other.Secret) { - return false - } - } - - if in.TrustedCA != other.TrustedCA { - return false - } - if in.Certificate != other.Certificate { - return false - } - if in.PrivateKey != other.PrivateKey { - return false - } - - return true -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/cidr.go b/vendor/github.com/cilium/cilium/pkg/policy/cidr.go deleted file mode 100644 index 33f14a9cd..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/cidr.go +++ /dev/null @@ -1,75 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package policy - -import ( - "net/netip" - - "github.com/cilium/cilium/pkg/ip" - "github.com/cilium/cilium/pkg/policy/api" -) - -// getPrefixesFromCIDR fetches all CIDRs referred to by the specified slice -// and returns them as regular golang CIDR objects. -func getPrefixesFromCIDR(cidrs api.CIDRSlice) []netip.Prefix { - result, _, _ := ip.ParsePrefixes(cidrs.StringSlice()) - return result -} - -// GetPrefixesFromCIDRSet fetches all CIDRs referred to by the specified slice -// and returns them as regular golang CIDR objects. -// -// Assumes that validation already occurred on 'rules'. -func GetPrefixesFromCIDRSet(rules api.CIDRRuleSlice) []netip.Prefix { - cidrs := api.ComputeResultantCIDRSet(rules) - return getPrefixesFromCIDR(cidrs) -} - -// GetCIDRPrefixes runs through the specified 'rules' to find every reference -// to a CIDR in the rules, and returns a slice containing all of these CIDRs. -// Multiple rules referring to the same CIDR will result in multiple copies of -// the CIDR in the returned slice. -// -// Assumes that validation already occurred on 'rules'. -func GetCIDRPrefixes(rules api.Rules) []netip.Prefix { - if len(rules) == 0 { - return nil - } - res := make([]netip.Prefix, 0, 32) - for _, r := range rules { - for _, ir := range r.Ingress { - if len(ir.FromCIDR) > 0 { - res = append(res, getPrefixesFromCIDR(ir.FromCIDR)...) - } - if len(ir.FromCIDRSet) > 0 { - res = append(res, GetPrefixesFromCIDRSet(ir.FromCIDRSet)...) - } - } - for _, ir := range r.IngressDeny { - if len(ir.FromCIDR) > 0 { - res = append(res, getPrefixesFromCIDR(ir.FromCIDR)...) - } - if len(ir.FromCIDRSet) > 0 { - res = append(res, GetPrefixesFromCIDRSet(ir.FromCIDRSet)...) - } - } - for _, er := range r.Egress { - if len(er.ToCIDR) > 0 { - res = append(res, getPrefixesFromCIDR(er.ToCIDR)...) - } - if len(er.ToCIDRSet) > 0 { - res = append(res, GetPrefixesFromCIDRSet(er.ToCIDRSet)...) - } - } - for _, er := range r.EgressDeny { - if len(er.ToCIDR) > 0 { - res = append(res, getPrefixesFromCIDR(er.ToCIDR)...) - } - if len(er.ToCIDRSet) > 0 { - res = append(res, GetPrefixesFromCIDRSet(er.ToCIDRSet)...) - } - } - } - return res -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/config.go b/vendor/github.com/cilium/cilium/pkg/policy/config.go deleted file mode 100644 index ed63c4747..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/config.go +++ /dev/null @@ -1,71 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package policy - -import ( - ipcacheTypes "github.com/cilium/cilium/pkg/ipcache/types" - "github.com/cilium/cilium/pkg/labels" - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/source" - "github.com/cilium/cilium/pkg/time" -) - -var ( - log = logging.DefaultLogger.WithField(logfields.LogSubsys, "policy") - mutex lock.RWMutex // Protects enablePolicy - enablePolicy string // Whether policy enforcement is enabled. -) - -// SetPolicyEnabled sets the policy enablement configuration. Valid values are: -// - endpoint.AlwaysEnforce -// - endpoint.NeverEnforce -// - endpoint.DefaultEnforcement -func SetPolicyEnabled(val string) { - mutex.Lock() - enablePolicy = val - mutex.Unlock() -} - -// GetPolicyEnabled returns the policy enablement configuration -func GetPolicyEnabled() string { - mutex.RLock() - val := enablePolicy - mutex.RUnlock() - return val -} - -// AddOptions are options which can be passed to PolicyAdd -type AddOptions struct { - // Replace if true indicates that existing rules with identical labels should be replaced - Replace bool - // ReplaceWithLabels if present indicates that existing rules with the - // given LabelArray should be deleted. - ReplaceWithLabels labels.LabelArray - // Generated should be set as true to signalize a the policy being inserted - // was generated by cilium-agent, e.g. dns poller. - Generated bool - - // The source of this policy, one of api, fqdn or k8s - Source source.Source - - // The time the policy initially began to be processed in Cilium, such as when the - // policy was received from the API server. - ProcessingStartTime time.Time - - // Resource provides the object ID for the underlying object that backs - // this information from 'source'. - Resource ipcacheTypes.ResourceID -} - -// DeleteOptions are options which can be passed to PolicyDelete -type DeleteOptions struct { - // The source of this policy, one of api, fqdn or k8s - Source source.Source - - // Resource provides the object ID for the underlying object that backs - // this information from 'source'. - Resource ipcacheTypes.ResourceID -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/distillery.go b/vendor/github.com/cilium/cilium/pkg/policy/distillery.go deleted file mode 100644 index 2889ebfc1..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/distillery.go +++ /dev/null @@ -1,241 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package policy - -import ( - "fmt" - "sync/atomic" - - identityPkg "github.com/cilium/cilium/pkg/identity" - "github.com/cilium/cilium/pkg/identity/identitymanager" - "github.com/cilium/cilium/pkg/lock" -) - -// SelectorPolicy represents a cached selectorPolicy, previously resolved from -// the policy repository and ready to be distilled against a set of identities -// to compute datapath-level policy configuration. -type SelectorPolicy interface { - // Consume returns the policy in terms of connectivity to peer - // Identities. - Consume(owner PolicyOwner) *EndpointPolicy -} - -// PolicyCache represents a cache of resolved policies for identities. -type PolicyCache struct { - lock.Mutex - - // repo is a circular reference back to the Repository, but as - // we create only one Repository and one PolicyCache for each - // Cilium Agent process, these will never need to be garbage - // collected. - repo *Repository - policies map[identityPkg.NumericIdentity]*cachedSelectorPolicy -} - -// NewPolicyCache creates a new cache of SelectorPolicy. -func NewPolicyCache(repo *Repository, subscribe bool) *PolicyCache { - cache := &PolicyCache{ - repo: repo, - policies: make(map[identityPkg.NumericIdentity]*cachedSelectorPolicy), - } - if subscribe { - identitymanager.Subscribe(cache) - } - return cache -} - -func (cache *PolicyCache) GetSelectorCache() *SelectorCache { - return cache.repo.GetSelectorCache() -} - -// lookupOrCreate adds the specified Identity to the policy cache, with a reference -// from the specified Endpoint, then returns the threadsafe copy of the policy. -func (cache *PolicyCache) lookupOrCreate(identity *identityPkg.Identity, create bool) SelectorPolicy { - cache.Lock() - defer cache.Unlock() - cip, ok := cache.policies[identity.ID] - if !ok { - if !create { - return nil - } - cip = newCachedSelectorPolicy(identity, cache.repo.GetSelectorCache()) - cache.policies[identity.ID] = cip - } - return cip -} - -// insert adds the specified Identity to the policy cache, with a reference -// from the specified Endpoint, then returns the threadsafe copy of the policy. -func (cache *PolicyCache) insert(identity *identityPkg.Identity) SelectorPolicy { - return cache.lookupOrCreate(identity, true) -} - -// delete forgets about any cached SelectorPolicy that this endpoint uses. -// -// Returns true if the SelectorPolicy was removed from the cache. -func (cache *PolicyCache) delete(identity *identityPkg.Identity) bool { - cache.Lock() - defer cache.Unlock() - cip, ok := cache.policies[identity.ID] - if ok { - delete(cache.policies, identity.ID) - cip.getPolicy().Detach() - } - return ok -} - -// updateSelectorPolicy resolves the policy for the security identity of the -// specified endpoint and stores it internally. It will skip policy resolution -// if the cached policy is already at the revision specified in the repo. -// -// Returns whether the cache was updated, or an error. -// -// Must be called with repo.Mutex held for reading. -func (cache *PolicyCache) updateSelectorPolicy(identity *identityPkg.Identity) (bool, error) { - cache.Lock() - cip, ok := cache.policies[identity.ID] - cache.Unlock() - if !ok { - return false, fmt.Errorf("SelectorPolicy not found in cache for ID %d", identity.ID) - } - - // As long as UpdatePolicy() is triggered from endpoint - // regeneration, it's possible for two endpoints with the - // *same* identity to race to update the policy here. Such - // racing would lead to first of the endpoints using a - // selectorPolicy that is already detached from the selector - // cache, and thus not getting any incremental updates. - // - // Lock the 'cip' for the duration of the revision check and - // the possible policy update. - cip.Lock() - defer cip.Unlock() - - // Don't resolve policy if it was already done for this or later revision. - if cip.getPolicy().Revision >= cache.repo.GetRevision() { - return false, nil - } - - // Resolve the policies, which could fail - selPolicy, err := cache.repo.resolvePolicyLocked(identity) - if err != nil { - return false, err - } - - cip.setPolicy(selPolicy) - - return true, nil -} - -// LocalEndpointIdentityAdded creates a SelectorPolicy cache entry for the -// specified Identity, without calculating any policy for it. -func (cache *PolicyCache) LocalEndpointIdentityAdded(identity *identityPkg.Identity) { - cache.insert(identity) -} - -// LocalEndpointIdentityRemoved deletes the cached SelectorPolicy for the -// specified Identity. -func (cache *PolicyCache) LocalEndpointIdentityRemoved(identity *identityPkg.Identity) { - cache.delete(identity) -} - -// Lookup attempts to locate the SelectorPolicy corresponding to the specified -// identity. If policy is not cached for the identity, it returns nil. -func (cache *PolicyCache) Lookup(identity *identityPkg.Identity) SelectorPolicy { - return cache.lookupOrCreate(identity, false) -} - -// UpdatePolicy resolves the policy for the security identity of the specified -// endpoint and caches it for future use. -// -// The caller must provide threadsafety for iteration over the policy -// repository. -func (cache *PolicyCache) UpdatePolicy(identity *identityPkg.Identity) error { - _, err := cache.updateSelectorPolicy(identity) - return err -} - -// GetAuthTypes returns the AuthTypes required by the policy between the localID and remoteID, if -// any, otherwise returns nil. -func (cache *PolicyCache) GetAuthTypes(localID, remoteID identityPkg.NumericIdentity) AuthTypes { - cache.Lock() - cip, ok := cache.policies[localID] - cache.Unlock() - if !ok { - return nil // No policy for localID (no endpoint with localID) - } - - // SelectorPolicy is const after it has been created, so no locking needed to access it - selPolicy := cip.getPolicy() - - var resTypes AuthTypes - for cs, authTypes := range selPolicy.L4Policy.AuthMap { - missing := false - for authType := range authTypes { - if _, exists := resTypes[authType]; !exists { - missing = true - break - } - } - // Only check if 'cs' selects 'remoteID' if one of the authTypes is still missing - // from the result - if missing && cs.Selects(remoteID) { - if resTypes == nil { - resTypes = make(AuthTypes, 1) - } - for authType := range authTypes { - resTypes[authType] = struct{}{} - } - } - } - return resTypes -} - -// cachedSelectorPolicy is a wrapper around a selectorPolicy (stored in the -// 'policy' field). It is always nested directly in the owning policyCache, -// and is protected against concurrent writes via the policyCache mutex. -type cachedSelectorPolicy struct { - lock.Mutex // lock is needed to synchronize parallel policy updates - - identity *identityPkg.Identity - policy atomic.Pointer[selectorPolicy] -} - -func newCachedSelectorPolicy(identity *identityPkg.Identity, selectorCache *SelectorCache) *cachedSelectorPolicy { - cip := &cachedSelectorPolicy{ - identity: identity, - } - cip.setPolicy(newSelectorPolicy(selectorCache)) - return cip -} - -// getPolicy returns a reference to the selectorPolicy that is cached. -// -// Users should treat the result as immutable state that MUST NOT be modified. -func (cip *cachedSelectorPolicy) getPolicy() *selectorPolicy { - return cip.policy.Load() -} - -// setPolicy updates the reference to the SelectorPolicy that is cached. -// Calls Detach() on the old policy, if any. -func (cip *cachedSelectorPolicy) setPolicy(policy *selectorPolicy) { - oldPolicy := cip.policy.Swap(policy) - if oldPolicy != nil { - // Release the references the previous policy holds on the selector cache. - oldPolicy.Detach() - } -} - -// Consume returns the EndpointPolicy that defines connectivity policy to -// Identities in the specified cache. -// -// This denotes that a particular endpoint is 'consuming' the policy from the -// selector policy cache. -func (cip *cachedSelectorPolicy) Consume(owner PolicyOwner) *EndpointPolicy { - // TODO: This currently computes the EndpointPolicy from SelectorPolicy - // on-demand, however in future the cip is intended to cache the - // EndpointPolicy for this Identity and emit datapath deltas instead. - isHost := cip.identity.ID == identityPkg.ReservedIdentityHost - return cip.getPolicy().DistillPolicy(owner, isHost) -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/identifier.go b/vendor/github.com/cilium/cilium/pkg/policy/identifier.go deleted file mode 100644 index 6479c34b3..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/identifier.go +++ /dev/null @@ -1,86 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package policy - -import ( - "sync" - - "github.com/cilium/cilium/pkg/identity" - "github.com/cilium/cilium/pkg/lock" -) - -// Endpoint refers to any structure which has the following properties: -// * a node-local ID stored as a uint16 -// * a security identity -// * a means of incrementing its policy revision -// * a means of checking if it represents a node or a pod. -// * a set of labels -// * a kubernetes namespace -type Endpoint interface { - GetID16() uint16 - GetSecurityIdentity() (*identity.Identity, error) - PolicyRevisionBumpEvent(rev uint64) - IsHost() bool - GetOpLabels() []string - GetK8sNamespace() string -} - -// EndpointSet is used to be able to group together a given set of Endpoints -// that need to have a specific operation performed upon them (e.g., policy -// revision updates). -type EndpointSet struct { - mutex lock.RWMutex - endpoints map[Endpoint]struct{} -} - -// NewEndpointSet returns an EndpointSet with the given Endpoints map -func NewEndpointSet(m map[Endpoint]struct{}) *EndpointSet { - if m != nil { - return &EndpointSet{ - endpoints: m, - } - } - return &EndpointSet{ - endpoints: map[Endpoint]struct{}{}, - } -} - -// ForEachGo runs epFunc asynchronously inside a goroutine for each endpoint in -// the EndpointSet. It signals to the provided WaitGroup when epFunc has been -// executed for each endpoint. -func (e *EndpointSet) ForEachGo(wg *sync.WaitGroup, epFunc func(epp Endpoint)) { - e.mutex.RLock() - defer e.mutex.RUnlock() - - wg.Add(len(e.endpoints)) - - for ep := range e.endpoints { - go func(eppp Endpoint) { - epFunc(eppp) - wg.Done() - }(ep) - } -} - -// Delete removes ep from the EndpointSet. -func (e *EndpointSet) Delete(ep Endpoint) { - e.mutex.Lock() - delete(e.endpoints, ep) - e.mutex.Unlock() -} - -// Insert adds ep to the EndpointSet. -func (e *EndpointSet) Insert(ep Endpoint) { - e.mutex.Lock() - e.endpoints[ep] = struct{}{} - e.mutex.Unlock() -} - -// Len returns the number of elements in the EndpointSet. -func (e *EndpointSet) Len() (nElem int) { - e.mutex.RLock() - nElem = len(e.endpoints) - e.mutex.RUnlock() - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/l4.go b/vendor/github.com/cilium/cilium/pkg/policy/l4.go deleted file mode 100644 index d013d2ce5..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/l4.go +++ /dev/null @@ -1,1464 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package policy - -import ( - "bytes" - "encoding/json" - "fmt" - "sort" - "strconv" - "sync/atomic" - - cilium "github.com/cilium/proxy/go/cilium/api" - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/api/v1/models" - "github.com/cilium/cilium/pkg/iana" - "github.com/cilium/cilium/pkg/identity" - "github.com/cilium/cilium/pkg/labels" - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/option" - "github.com/cilium/cilium/pkg/policy/api" - "github.com/cilium/cilium/pkg/policy/trafficdirection" - "github.com/cilium/cilium/pkg/u8proto" -) - -// covers returns true if 'l4rule' has the effect needed for the 'l3l4rule', when 'l4rule' is added -// to the datapath, due to the l4-only rule matching if l3l4-rule is not present. This determination -// can be done here only when both rules have the same port number (or both have a wildcarded port). -func (l4rule *PerSelectorPolicy) covers(l3l4rule *PerSelectorPolicy) bool { - // Deny takes highest precedence so it is dealt with first - if l4rule != nil && l4rule.IsDeny { - // l4-only deny takes precedence - return true - } else if l3l4rule != nil && l3l4rule.IsDeny { - // Must not skip if l3l4 rule is deny while l4-only rule is not - return false - } - - // Can not skip if currentRule has an explicit auth type and wildcardRule does not or if - // both have different auth types. In all other cases the auth type from the wildcardRule - // can be used also for the current rule. - // Note that the caller must deal with inheriting redirect from wildcardRule to currentRule, - // if any. - cHasAuth, cAuthType := l3l4rule.GetAuthType() - wHasAuth, wAuthType := l4rule.GetAuthType() - if cHasAuth && !wHasAuth || cHasAuth && wHasAuth && cAuthType != wAuthType { - return false - } - - l3l4IsRedirect := l3l4rule.IsRedirect() - l4OnlyIsRedirect := l4rule.IsRedirect() - if l3l4IsRedirect && !l4OnlyIsRedirect { - // Can not skip if l3l4-rule is redirect while l4-only is not - return false - } else if l3l4IsRedirect && l4OnlyIsRedirect && l3l4rule.Listener != l4rule.Listener { - // L3l4 rule has a different listener, it can not be skipped - return false - } - - // else can skip - return true -} - -// TLS context holds the secret values resolved from an 'api.TLSContext' -type TLSContext struct { - TrustedCA string `json:"trustedCA,omitempty"` - CertificateChain string `json:"certificateChain,omitempty"` - PrivateKey string `json:"privateKey,omitempty"` -} - -// Equal returns true if 'a' and 'b' have the same contents. -func (a *TLSContext) Equal(b *TLSContext) bool { - return a == nil && b == nil || a != nil && b != nil && *a == *b -} - -// MarshalJSON marsahls a redacted version of the TLSContext. We want -// to see which fields are present, but not reveal their values in any -// logs, etc. -func (t *TLSContext) MarshalJSON() ([]byte, error) { - type tlsContext TLSContext - var redacted tlsContext - if t.TrustedCA != "" { - redacted.TrustedCA = "[redacted]" - } - if t.CertificateChain != "" { - redacted.CertificateChain = "[redacted]" - } - if t.PrivateKey != "" { - redacted.PrivateKey = "[redacted]" - } - return json.Marshal(&redacted) -} - -type StringSet map[string]struct{} - -func (a StringSet) Equal(b StringSet) bool { - if len(a) != len(b) { - return false - } - for k := range a { - if _, exists := b[k]; !exists { - return false - } - } - return true -} - -// NewStringSet returns a StringSet initialized from slice of strings. -// Returns nil for an empty slice -func NewStringSet(from []string) StringSet { - if len(from) == 0 { - return nil - } - set := make(StringSet, len(from)) - for _, s := range from { - set[s] = struct{}{} - } - return set -} - -// Merge returns StringSet with strings from both a and b. -// Returns a or b, possibly with modifications. -func (a StringSet) Merge(b StringSet) StringSet { - if len(a) == 0 { - return b - } - for s := range b { - a[s] = struct{}{} - } - return a -} - -// PerSelectorPolicy contains policy rules for a CachedSelector, i.e. for a -// selection of numerical identities. -type PerSelectorPolicy struct { - // TerminatingTLS is the TLS context for the connection terminated by - // the L7 proxy. For egress policy this specifies the server-side TLS - // parameters to be applied on the connections originated from the local - // POD and terminated by the L7 proxy. For ingress policy this specifies - // the server-side TLS parameters to be applied on the connections - // originated from a remote source and terminated by the L7 proxy. - TerminatingTLS *TLSContext `json:"terminatingTLS,omitempty"` - - // OriginatingTLS is the TLS context for the connections originated by - // the L7 proxy. For egress policy this specifies the client-side TLS - // parameters for the upstream connection originating from the L7 proxy - // to the remote destination. For ingress policy this specifies the - // client-side TLS parameters for the connection from the L7 proxy to - // the local POD. - OriginatingTLS *TLSContext `json:"originatingTLS,omitempty"` - - // ServerNames is a list of allowed TLS SNI values. If not empty, then - // TLS must be present and one of the provided SNIs must be indicated in the - // TLS handshake. - ServerNames StringSet `json:"serverNames,omitempty"` - - // isRedirect is 'true' when traffic must be redirected - isRedirect bool `json:"-"` - - // Listener is an optional fully qualified name of a Envoy Listner defined in a CiliumEnvoyConfig CRD that should be - // used for this traffic instead of the default listener - Listener string `json:"listener,omitempty"` - - // Priority of the listener used when multiple listeners would apply to the same - // MapStateEntry. - // Lower numbers indicate higher priority. If left out, the proxy - // port number (10000-20000) is used as priority, so that traffic will be consistently - // redirected to the same listener. If higher priority desired, a low unique number like 1, - // 2, or 3 should be explicitly specified here. If a lower than default priority is needed, - // then a unique number higher than 20000 should be explicitly specified. Numbers on the - // default range (10000-20000) are not allowed. - Priority uint16 `json:"priority,omitempty"` - - // Pre-computed HTTP rules, computed after rule merging is complete - EnvoyHTTPRules *cilium.HttpNetworkPolicyRules `json:"-"` - - // CanShortCircuit is true if all 'EnvoyHTTPRules' may be - // short-circuited by other matches. - CanShortCircuit bool `json:"-"` - - api.L7Rules - - // Authentication is the kind of cryptographic authentication required for the traffic to be allowed - // at L3, if any. - Authentication *api.Authentication `json:"auth,omitempty"` - - // IsDeny is set if this L4Filter contains should be denied - IsDeny bool `json:",omitempty"` -} - -// Equal returns true if 'a' and 'b' represent the same L7 Rules -func (a *PerSelectorPolicy) Equal(b *PerSelectorPolicy) bool { - return a == nil && b == nil || a != nil && b != nil && - a.TerminatingTLS.Equal(b.TerminatingTLS) && - a.OriginatingTLS.Equal(b.OriginatingTLS) && - a.ServerNames.Equal(b.ServerNames) && - a.isRedirect == b.isRedirect && - a.Listener == b.Listener && - a.Priority == b.Priority && - (a.Authentication == nil && b.Authentication == nil || a.Authentication != nil && a.Authentication.DeepEqual(b.Authentication)) && - a.IsDeny == b.IsDeny && - a.L7Rules.DeepEqual(&b.L7Rules) -} - -// GetListener returns the listener of the PerSelectorPolicy. -func (a *PerSelectorPolicy) GetListener() string { - if a == nil { - return "" - } - return a.Listener -} - -// GetPriority returns the pritority of the listener of the PerSelectorPolicy. -func (a *PerSelectorPolicy) GetPriority() uint16 { - if a == nil { - return 0 - } - return a.Priority -} - -// AuthType enumerates the supported authentication types in api. -// Numerically higher type takes precedence in case of conflicting auth types. -type AuthType uint8 - -// AuthTypes is a set of AuthTypes, usually nil if empty -type AuthTypes map[AuthType]struct{} - -// Authmap maps remote selectors to their needed AuthTypes, if any -type AuthMap map[CachedSelector]AuthTypes - -const ( - // AuthTypeDisabled means no authentication required - AuthTypeDisabled AuthType = iota - // AuthTypeSpire is a mutual auth type that uses SPIFFE identities with a SPIRE server - AuthTypeSpire - // AuthTypeAlwaysFail is a simple auth type that always denies the request - AuthTypeAlwaysFail -) - -type HasAuthType bool - -const ( - DefaultAuthType HasAuthType = false - ExplicitAuthType HasAuthType = true -) - -// GetAuthType returns the AuthType of the L4Filter. -func (a *PerSelectorPolicy) GetAuthType() (HasAuthType, AuthType) { - if a == nil { - return DefaultAuthType, AuthTypeDisabled - } - return GetAuthType(a.Authentication) -} - -// GetAuthType returns boolean HasAuthType and AuthType for the api.Authentication -// If there is no explicit auth type, (DefaultAuthType, AuthTypeDisabled) is returned -func GetAuthType(auth *api.Authentication) (HasAuthType, AuthType) { - if auth == nil { - return DefaultAuthType, AuthTypeDisabled - } - switch auth.Mode { - case api.AuthenticationModeDisabled: - return ExplicitAuthType, AuthTypeDisabled - case api.AuthenticationModeRequired: - return ExplicitAuthType, AuthTypeSpire - case api.AuthenticationModeAlwaysFail: - return ExplicitAuthType, AuthTypeAlwaysFail - default: - return DefaultAuthType, AuthTypeDisabled - } -} - -// Uint8 returns AuthType as a uint8 -func (a AuthType) Uint8() uint8 { - return uint8(a) -} - -// String returns AuthType as a string -// This must return the strings accepted for api.AuthType -func (a AuthType) String() string { - switch a { - case AuthTypeDisabled: - return "disabled" - case AuthTypeSpire: - return "spire" - case AuthTypeAlwaysFail: - return "test-always-fail" - } - return "Unknown-auth-type-" + strconv.FormatUint(uint64(a.Uint8()), 10) -} - -// IsRedirect returns true if the L7Rules are a redirect. -func (a *PerSelectorPolicy) IsRedirect() bool { - return a != nil && a.isRedirect -} - -// HasL7Rules returns whether the `L7Rules` contains any L7 rules. -func (a *PerSelectorPolicy) HasL7Rules() bool { - return !a.L7Rules.IsEmpty() -} - -// L7DataMap contains a map of L7 rules per endpoint where key is a CachedSelector -type L7DataMap map[CachedSelector]*PerSelectorPolicy - -func (l7 L7DataMap) MarshalJSON() ([]byte, error) { - if len(l7) == 0 { - return []byte("[]"), nil - } - - /* First, create a sorted slice of the selectors so we can get - * consistent JSON output */ - selectors := make(CachedSelectorSlice, 0, len(l7)) - for cs := range l7 { - selectors = append(selectors, cs) - } - sort.Sort(selectors) - - /* Now we can iterate the slice and generate JSON entries. */ - var err error - buffer := bytes.NewBufferString("[") - for _, cs := range selectors { - buffer.WriteString("{\"") - buffer.WriteString(cs.String()) - buffer.WriteString("\":") - b, err := json.Marshal(l7[cs]) - if err == nil { - buffer.Write(b) - } else { - buffer.WriteString("\"L7DataMap error: ") - buffer.WriteString(err.Error()) - buffer.WriteString("\"") - } - buffer.WriteString("},") - } - buffer.Truncate(buffer.Len() - 1) // Drop the final "," - buffer.WriteString("]") - - return buffer.Bytes(), err -} - -// ShallowCopy returns a shallow copy of the L7DataMap. -func (l7 L7DataMap) ShallowCopy() L7DataMap { - m := make(L7DataMap, len(l7)) - for k, v := range l7 { - m[k] = v - } - return m -} - -// L7ParserType is the type used to indicate what L7 parser to use. -// Consts are defined for all well known L7 parsers. -// Unknown string values are created for key-value pair policies, which -// are then transparently used in redirect configuration. -type L7ParserType string - -func (l7 L7ParserType) String() string { - return (string)(l7) -} - -const ( - // ParserTypeNone represents the case where no parser type is provided. - ParserTypeNone L7ParserType = "" - // ParserTypeTLS is used for TLS origination, termination, or SNI filtering without any L7 - // parsing. If TLS policies are used with HTTP rules, ParserTypeHTTP is used instead. - ParserTypeTLS L7ParserType = "tls" - // ParserTypeCRD is used with a custom CiliumEnvoyConfig redirection. Incompatible with any - // parser type with L7 enforcement (HTTP, Kafka, proxylib), as the custom Listener generally - // does not support them. - ParserTypeCRD L7ParserType = "crd" - // ParserTypeHTTP specifies a HTTP parser type - ParserTypeHTTP L7ParserType = "http" - // ParserTypeKafka specifies a Kafka parser type - ParserTypeKafka L7ParserType = "kafka" - // ParserTypeDNS specifies a DNS parser type - ParserTypeDNS L7ParserType = "dns" -) - -// redirectTypes is a bitmask of redirection types of multiple filters -type redirectTypes uint16 - -const ( - // redirectTypeDNS bit is set when policy contains a redirection to DNS proxy - redirectTypeDNS redirectTypes = 1 << iota - // redirectTypeEnvoy bit is set when policy contains a redirection to Envoy - redirectTypeEnvoy - // redirectTypeProxylib bits are set when policy contains a redirection to Proxylib (via - // Envoy) - redirectTypeProxylib redirectTypes = 1< 0 || !rules.IsEmpty()) - for epsel := range l7 { - l7policy := &PerSelectorPolicy{ - TerminatingTLS: terminatingTLS, - OriginatingTLS: originatingTLS, - Authentication: auth, - IsDeny: deny, - ServerNames: NewStringSet(sni), - isRedirect: isRedirect, - Listener: listener, - Priority: priority, - } - if rules != nil { - l7policy.L7Rules = *rules - } - l7[epsel] = l7policy - } -} - -type TLSDirection string - -const ( - TerminatingTLS TLSDirection = "terminating" - OriginatingTLS TLSDirection = "originating" -) - -func (l4 *L4Filter) getCerts(policyCtx PolicyContext, tls *api.TLSContext, direction TLSDirection) (*TLSContext, error) { - if tls == nil { - return nil, nil - } - ca, public, private, err := policyCtx.GetTLSContext(tls) - if err != nil { - log.WithError(err).Warningf("policy: Error getting %s TLS Context.", direction) - return nil, err - } - switch direction { - case TerminatingTLS: - if public == "" || private == "" { - return nil, fmt.Errorf("Terminating TLS context is missing certs.") - } - case OriginatingTLS: - if ca == "" { - return nil, fmt.Errorf("Originating TLS context is missing CA certs.") - } - default: - return nil, fmt.Errorf("invalid TLS direction: %s", direction) - } - - return &TLSContext{ - TrustedCA: ca, - CertificateChain: public, - PrivateKey: private, - }, nil -} - -// createL4Filter creates a filter for L4 policy that applies to the specified -// endpoints and port/protocol, with reference to the original rules that the -// filter is derived from. This filter may be associated with a series of L7 -// rules via the `rule` parameter. -// Not called with an empty peerEndpoints. -func createL4Filter(policyCtx PolicyContext, peerEndpoints api.EndpointSelectorSlice, auth *api.Authentication, rule api.Ports, port api.PortProtocol, - protocol api.L4Proto, ruleLabels labels.LabelArray, ingress bool, fqdns api.FQDNSelectorSlice) (*L4Filter, error) { - selectorCache := policyCtx.GetSelectorCache() - - portName := "" - p := uint64(0) - if iana.IsSvcName(port.Port) { - portName = port.Port - } else { - // already validated via PortRule.Validate() - p, _ = strconv.ParseUint(port.Port, 0, 16) - } - - // already validated via L4Proto.Validate(), never "ANY" - u8p, _ := u8proto.ParseProtocol(string(protocol)) - - l4 := &L4Filter{ - Port: int(p), // 0 for L3-only rules and named ports - PortName: portName, // non-"" for named ports - Protocol: protocol, - U8Proto: u8p, - PerSelectorPolicies: make(L7DataMap), - RuleOrigin: make(map[CachedSelector]labels.LabelArrayList), // Filled in below. - Ingress: ingress, - } - - if peerEndpoints.SelectsAllEndpoints() { - l4.wildcard = l4.cacheIdentitySelector(api.WildcardEndpointSelector, ruleLabels, selectorCache) - } else { - l4.cacheIdentitySelectors(peerEndpoints, ruleLabels, selectorCache) - l4.cacheFQDNSelectors(fqdns, ruleLabels, selectorCache) - } - - var terminatingTLS *TLSContext - var originatingTLS *TLSContext - var rules *api.L7Rules - var sni []string - listener := "" - var priority uint16 - - pr := rule.GetPortRule() - if pr != nil { - rules = pr.Rules - sni = pr.ServerNames - - // Get TLS contexts, if any - var err error - terminatingTLS, err = l4.getCerts(policyCtx, pr.TerminatingTLS, TerminatingTLS) - if err != nil { - return nil, err - } - originatingTLS, err = l4.getCerts(policyCtx, pr.OriginatingTLS, OriginatingTLS) - if err != nil { - return nil, err - } - - // Set parser type to TLS, if TLS. This will be overridden by L7 below, if rules - // exists. - if terminatingTLS != nil || originatingTLS != nil || len(pr.ServerNames) > 0 { - l4.L7Parser = ParserTypeTLS - } - - // Determine L7ParserType from rules present. Earlier validation ensures rules - // for multiple protocols are not present here. - if rules != nil { - // we need this to redirect DNS UDP (or ANY, which is more useful) - if len(rules.DNS) > 0 { - l4.L7Parser = ParserTypeDNS - } else if protocol == api.ProtoTCP { // Other than DNS only support TCP - switch { - case len(rules.HTTP) > 0: - l4.L7Parser = ParserTypeHTTP - case len(rules.Kafka) > 0: - l4.L7Parser = ParserTypeKafka - case rules.L7Proto != "": - l4.L7Parser = (L7ParserType)(rules.L7Proto) - } - } - } - - // Override the parser type to CRD is applicable. - if pr.Listener != nil { - l4.L7Parser = ParserTypeCRD - ns := policyCtx.GetNamespace() - resource := pr.Listener.EnvoyConfig - switch resource.Kind { - case "CiliumEnvoyConfig": - if ns == "" { - // Cluster-scoped CCNP tries to use namespaced - // CiliumEnvoyConfig - // - // TODO: Catch this in rule validation once we have a - // validation context in there so that we can differentiate - // between CNP and CCNP at validation time. - return nil, fmt.Errorf("Listener %q in CCNP can not use Kind CiliumEnvoyConfig", pr.Listener.Name) - } - case "CiliumClusterwideEnvoyConfig": - // CNP refers to a cluster-scoped listener - ns = "" - default: - } - listener, _ = api.ResourceQualifiedName(ns, resource.Name, pr.Listener.Name, api.ForceNamespace) - priority = pr.Listener.Priority - } - } - - if l4.L7Parser != ParserTypeNone || auth != nil || policyCtx.IsDeny() { - l4.PerSelectorPolicies.addPolicyForSelector(rules, terminatingTLS, originatingTLS, auth, policyCtx.IsDeny(), sni, listener, priority) - } - - for cs := range l4.PerSelectorPolicies { - l4.RuleOrigin[cs] = labels.LabelArrayList{ruleLabels} - } - - return l4, nil -} - -func (l4 *L4Filter) removeSelectors(selectorCache *SelectorCache) { - selectors := make(CachedSelectorSlice, 0, len(l4.PerSelectorPolicies)) - for cs := range l4.PerSelectorPolicies { - selectors = append(selectors, cs) - } - selectorCache.RemoveSelectors(selectors, l4) -} - -// detach releases the references held in the L4Filter and must be called before -// the filter is left to be garbage collected. -// L4Filter may still be accessed concurrently after it has been detached. -func (l4 *L4Filter) detach(selectorCache *SelectorCache) { - l4.removeSelectors(selectorCache) - l4.policy.Store(nil) -} - -// attach signifies that the L4Filter is ready and reacheable for updates -// from SelectorCache. L4Filter (and L4Policy) is read-only after this is called, -// multiple goroutines will be reading the fields from that point on. -func (l4 *L4Filter) attach(ctx PolicyContext, l4Policy *L4Policy) policyFeatures { - // All rules have been added to the L4Filter at this point. - // Sort the rules label array list for more efficient equality comparison. - for _, labels := range l4.RuleOrigin { - labels.Sort() - } - - var features policyFeatures - for cs, cp := range l4.PerSelectorPolicies { - if cp != nil { - if cp.IsDeny { - features.setFeature(denyRules) - } - - hasAuth, authType := GetAuthType(cp.Authentication) - if hasAuth { - features.setFeature(authRules) - - if authType != AuthTypeDisabled { - if l4Policy.AuthMap == nil { - l4Policy.AuthMap = make(AuthMap, 1) - } - authTypes := l4Policy.AuthMap[cs] - if authTypes == nil { - authTypes = make(AuthTypes, 1) - } - authTypes[authType] = struct{}{} - l4Policy.AuthMap[cs] = authTypes - } - } - - // Compute Envoy policies when a policy is ready to be used - if len(cp.L7Rules.HTTP) > 0 { - cp.EnvoyHTTPRules, cp.CanShortCircuit = ctx.GetEnvoyHTTPRules(&cp.L7Rules) - } - } - } - - l4.policy.Store(l4Policy) - return features -} - -// createL4IngressFilter creates a filter for L4 policy that applies to the -// specified endpoints and port/protocol for ingress traffic, with reference -// to the original rules that the filter is derived from. This filter may be -// associated with a series of L7 rules via the `rule` parameter. -// -// hostWildcardL7 determines if L7 traffic from Host should be -// wildcarded (in the relevant daemon mode). -func createL4IngressFilter(policyCtx PolicyContext, fromEndpoints api.EndpointSelectorSlice, auth *api.Authentication, hostWildcardL7 []string, rule api.Ports, port api.PortProtocol, - protocol api.L4Proto, ruleLabels labels.LabelArray) (*L4Filter, error) { - - filter, err := createL4Filter(policyCtx, fromEndpoints, auth, rule, port, protocol, ruleLabels, true, nil) - if err != nil { - return nil, err - } - - // If the filter would apply proxy redirection for the Host, when we should accept - // everything from host, then wildcard Host at L7. - if len(hostWildcardL7) > 0 { - for cs, l7 := range filter.PerSelectorPolicies { - if l7.IsRedirect() && cs.Selects(identity.ReservedIdentityHost) { - for _, name := range hostWildcardL7 { - selector := api.ReservedEndpointSelectors[name] - filter.cacheIdentitySelector(selector, ruleLabels, policyCtx.GetSelectorCache()) - } - } - } - } - - return filter, nil -} - -// createL4EgressFilter creates a filter for L4 policy that applies to the -// specified endpoints and port/protocol for egress traffic, with reference -// to the original rules that the filter is derived from. This filter may be -// associated with a series of L7 rules via the `rule` parameter. -func createL4EgressFilter(policyCtx PolicyContext, toEndpoints api.EndpointSelectorSlice, auth *api.Authentication, rule api.Ports, port api.PortProtocol, - protocol api.L4Proto, ruleLabels labels.LabelArray, fqdns api.FQDNSelectorSlice) (*L4Filter, error) { - - return createL4Filter(policyCtx, toEndpoints, auth, rule, port, protocol, ruleLabels, false, fqdns) -} - -// redirectType returns the redirectType for this filter -func (l4 *L4Filter) redirectType() redirectTypes { - switch l4.L7Parser { - case ParserTypeNone: - return redirectTypeNone - case ParserTypeDNS: - return redirectTypeDNS - case ParserTypeHTTP, ParserTypeTLS, ParserTypeCRD: - return redirectTypeEnvoy - default: - // all other (non-empty) values are used for proxylib redirects - return redirectTypeProxylib - } -} - -// IsRedirect returns true if the L4 filter contains a port redirection -func (l4 *L4Filter) IsRedirect() bool { - return l4.L7Parser != ParserTypeNone -} - -// Marshal returns the `L4Filter` in a JSON string. -func (l4 *L4Filter) Marshal() string { - b, err := json.Marshal(l4) - if err != nil { - b = []byte("\"L4Filter error: " + err.Error() + "\"") - } - return string(b) -} - -// String returns the `L4Filter` in a human-readable string. -func (l4 *L4Filter) String() string { - b, err := json.Marshal(l4) - if err != nil { - return err.Error() - } - return string(b) -} - -// Note: Only used for policy tracing -func (l4 *L4Filter) matchesLabels(labels labels.LabelArray) (bool, bool) { - if l4.wildcard != nil { - perSelectorPolicy := l4.PerSelectorPolicies[l4.wildcard] - isDeny := perSelectorPolicy != nil && perSelectorPolicy.IsDeny - return true, isDeny - } else if len(labels) == 0 { - return false, false - } - - var selected bool - for sel, rule := range l4.PerSelectorPolicies { - // slow, but OK for tracing - idSel := sel.(*identitySelector) - if lis, ok := idSel.source.(*labelIdentitySelector); ok && lis.xxxMatches(labels) { - isDeny := rule != nil && rule.IsDeny - selected = true - if isDeny { - return true, isDeny - } - } - } - return selected, false -} - -// addL4Filter adds 'filterToMerge' into the 'resMap'. Returns an error if it -// the 'filterToMerge' can't be merged with an existing filter for the same -// port and proto. -func addL4Filter(policyCtx PolicyContext, - ctx *SearchContext, resMap L4PolicyMap, - p api.PortProtocol, proto api.L4Proto, - filterToMerge *L4Filter, - ruleLabels labels.LabelArray) error { - - key := p.Port + "/" + string(proto) - existingFilter, ok := resMap[key] - if !ok { - resMap[key] = filterToMerge - return nil - } - - selectorCache := policyCtx.GetSelectorCache() - if err := mergePortProto(ctx, existingFilter, filterToMerge, selectorCache); err != nil { - filterToMerge.detach(selectorCache) - return err - } - - // To keep the rule origin tracking correct, merge the rule label arrays for each CachedSelector - // we know about. New CachedSelectors are added. - for cs, newLabels := range filterToMerge.RuleOrigin { - if existingLabels, ok := existingFilter.RuleOrigin[cs]; ok { - existingFilter.RuleOrigin[cs] = existingLabels.MergeSorted(newLabels) - } else { - existingFilter.RuleOrigin[cs] = newLabels - } - } - - resMap[key] = existingFilter - return nil -} - -// L4PolicyMap is a list of L4 filters indexable by protocol/port -// key format: "port/proto" -type L4PolicyMap map[string]*L4Filter - -type policyFeatures uint8 - -const ( - denyRules policyFeatures = 1 << iota - authRules - - allFeatures policyFeatures = ^policyFeatures(0) -) - -func (pf *policyFeatures) setFeature(feature policyFeatures) { - *pf |= feature -} - -func (pf policyFeatures) contains(feature policyFeatures) bool { - return pf&feature != 0 -} - -type L4DirectionPolicy struct { - PortRules L4PolicyMap - - // features tracks properties of PortRules to skip code when features are not used - features policyFeatures -} - -func newL4DirectionPolicy() L4DirectionPolicy { - return L4DirectionPolicy{ - PortRules: L4PolicyMap{}, - } -} - -// Detach removes the cached selectors held by L4PolicyMap from the -// selectorCache, allowing the map to be garbage collected when there -// are no more references to it. -func (l4 L4DirectionPolicy) Detach(selectorCache *SelectorCache) { - l4.PortRules.Detach(selectorCache) -} - -// detach is used directly from tracing and testing functions -func (l4 L4PolicyMap) Detach(selectorCache *SelectorCache) { - for _, f := range l4 { - f.detach(selectorCache) - } -} - -// Attach makes all the L4Filters to point back to the L4Policy that contains them. -// This is done before the L4PolicyMap is exposed to concurrent access. -// Returns the bitmask of all redirect types for this policymap. -func (l4 *L4DirectionPolicy) attach(ctx PolicyContext, l4Policy *L4Policy) redirectTypes { - var redirectTypes redirectTypes - var features policyFeatures - for _, f := range l4.PortRules { - features |= f.attach(ctx, l4Policy) - redirectTypes |= f.redirectType() - } - l4.features = features - return redirectTypes -} - -// containsAllL3L4 checks if the L4PolicyMap contains all L4 ports in `ports`. -// For L4Filters that specify ToEndpoints or FromEndpoints, uses `labels` to -// determine whether the policy allows L4 communication between the corresponding -// endpoints. -// Returns api.Denied in the following conditions: -// - If a single port is not present in the `L4PolicyMap` and is not allowed -// by the distilled L3 policy -// - If a port is present in the `L4PolicyMap`, but it applies ToEndpoints or -// FromEndpoints constraints that require labels not present in `labels`. -// -// Otherwise, returns api.Allowed. -// -// Note: Only used for policy tracing -func (l4 L4PolicyMap) containsAllL3L4(labels labels.LabelArray, ports []*models.Port) api.Decision { - if len(l4) == 0 { - return api.Allowed - } - - // Check L3-only filters first. - filter, match := l4[api.PortProtocolAny] - if match { - - matches, isDeny := filter.matchesLabels(labels) - switch { - case matches && isDeny: - return api.Denied - case matches: - return api.Allowed - } - } - - for _, l4Ctx := range ports { - portStr := l4Ctx.Name - if !iana.IsSvcName(portStr) { - portStr = strconv.FormatUint(uint64(l4Ctx.Port), 10) - } - lwrProtocol := l4Ctx.Protocol - var isUDPDeny, isTCPDeny, isSCTPDeny bool - switch lwrProtocol { - case "", models.PortProtocolANY: - tcpPort := portStr + "/TCP" - tcpFilter, tcpmatch := l4[tcpPort] - if tcpmatch { - tcpmatch, isTCPDeny = tcpFilter.matchesLabels(labels) - } - - udpPort := portStr + "/UDP" - udpFilter, udpmatch := l4[udpPort] - if udpmatch { - udpmatch, isUDPDeny = udpFilter.matchesLabels(labels) - } - - sctpPort := portStr + "/SCTP" - sctpFilter, sctpmatch := l4[sctpPort] - if sctpmatch { - sctpmatch, isSCTPDeny = sctpFilter.matchesLabels(labels) - } - - if (!tcpmatch && !udpmatch && !sctpmatch) || (isTCPDeny && isUDPDeny && isSCTPDeny) { - return api.Denied - } - default: - port := portStr + "/" + lwrProtocol - filter, match := l4[port] - if !match { - return api.Denied - } - matches, isDeny := filter.matchesLabels(labels) - if !matches || isDeny { - return api.Denied - } - } - } - return api.Allowed -} - -type L4Policy struct { - Ingress L4DirectionPolicy - Egress L4DirectionPolicy - - AuthMap AuthMap - - // Revision is the repository revision used to generate this policy. - Revision uint64 - - // redirectTypes is a bitmap containing the types of redirect contained by this policy. It - // is computed after the policy maps to avoid scanning them repeatedly when using the - // L4Policy - redirectTypes redirectTypes - - // Endpoint policies using this L4Policy - // These are circular references, cleaned up in Detach() - // This mutex is taken while Endpoint mutex is held, so Endpoint lock - // MUST always be taken before this mutex. - mutex lock.RWMutex - users map[*EndpointPolicy]struct{} -} - -// NewL4Policy creates a new L4Policy -func NewL4Policy(revision uint64) L4Policy { - return L4Policy{ - Ingress: newL4DirectionPolicy(), - Egress: newL4DirectionPolicy(), - Revision: revision, - users: make(map[*EndpointPolicy]struct{}), - } -} - -// insertUser adds a user to the L4Policy so that incremental -// updates of the L4Policy may be forwarded to the users of it. -func (l4 *L4Policy) insertUser(user *EndpointPolicy) { - l4.mutex.Lock() - - // 'users' is set to nil when the policy is detached. This - // happens to the old policy when it is being replaced with a - // new one, or when the last endpoint using this policy is - // removed. - // In the case of an policy update it is possible that an - // endpoint has started regeneration before the policy was - // updated, and that the policy was updated before the said - // endpoint reached this point. In this case the endpoint's - // policy is going to be recomputed soon after and we do - // nothing here. - if l4.users != nil { - l4.users[user] = struct{}{} - } - - l4.mutex.Unlock() -} - -// removeUser removes a user that no longer needs incremental updates -// from the L4Policy. -func (l4 *L4Policy) removeUser(user *EndpointPolicy) { - // 'users' is set to nil when the policy is detached. This - // happens to the old policy when it is being replaced with a - // new one, or when the last endpoint using this policy is - // removed. - l4.mutex.Lock() - if l4.users != nil { - delete(l4.users, user) - } - l4.mutex.Unlock() -} - -// AccumulateMapChanges distributes the given changes to the registered users. -// -// The caller is responsible for making sure the same identity is not -// present in both 'adds' and 'deletes'. -func (l4Policy *L4Policy) AccumulateMapChanges(l4 *L4Filter, cs CachedSelector, adds, deletes []identity.NumericIdentity) { - port := uint16(l4.Port) - proto := uint8(l4.U8Proto) - derivedFrom := l4.RuleOrigin[cs] - - direction := trafficdirection.Egress - if l4.Ingress { - direction = trafficdirection.Ingress - } - perSelectorPolicy := l4.PerSelectorPolicies[cs] - redirect := perSelectorPolicy.IsRedirect() - listener := perSelectorPolicy.GetListener() - priority := perSelectorPolicy.GetPriority() - hasAuth, authType := perSelectorPolicy.GetAuthType() - isDeny := perSelectorPolicy != nil && perSelectorPolicy.IsDeny - - // Must take a copy of 'users' as GetNamedPort() will lock the Endpoint below and - // the Endpoint lock may not be taken while 'l4.mutex' is held. - l4Policy.mutex.RLock() - users := make(map[*EndpointPolicy]struct{}, len(l4Policy.users)) - for user := range l4Policy.users { - users[user] = struct{}{} - } - l4Policy.mutex.RUnlock() - - for epPolicy := range users { - // Skip if endpoint has no policy maps - if !epPolicy.PolicyOwner.HasBPFPolicyMap() { - continue - } - // resolve named port - if port == 0 && l4.PortName != "" { - port = epPolicy.PolicyOwner.GetNamedPort(l4.Ingress, l4.PortName, proto) - if port == 0 { - continue - } - } - var proxyPort uint16 - if redirect { - var err error - proxyPort, err = epPolicy.PolicyOwner.LookupRedirectPort(l4.Ingress, string(l4.Protocol), port, listener) - if err != nil { - // This happens for new redirects that have not been realized - // yet. The accumulated changes should only be consumed after new - // redirects have been realized. ConsumeMapChanges then maps this - // invalid valut to the real redirect port before the entry is - // visible to the endpoint package. - proxyPort = unrealizedRedirectPort - } - } - key := Key{DestPort: port, Nexthdr: proto, TrafficDirection: direction.Uint8()} - value := NewMapStateEntry(cs, derivedFrom, proxyPort, listener, priority, isDeny, hasAuth, authType) - - if option.Config.Debug { - authString := "default" - if hasAuth { - authString = authType.String() - } - log.WithFields(logrus.Fields{ - logfields.EndpointSelector: cs, - logfields.AddedPolicyID: adds, - logfields.DeletedPolicyID: deletes, - logfields.Port: port, - logfields.Protocol: proto, - logfields.TrafficDirection: direction, - logfields.IsRedirect: redirect, - logfields.AuthType: authString, - logfields.Listener: listener, - logfields.ListenerPriority: priority, - }).Debug("AccumulateMapChanges") - } - epPolicy.policyMapChanges.AccumulateMapChanges(cs, adds, deletes, key, value) - } -} - -// Detach makes the L4Policy ready for garbage collection, removing -// circular pointer references. -// Note that the L4Policy itself is not modified in any way, so that it may still -// be used concurrently. -func (l4 *L4Policy) Detach(selectorCache *SelectorCache) { - l4.Ingress.Detach(selectorCache) - l4.Egress.Detach(selectorCache) - - l4.mutex.Lock() - l4.users = nil - l4.mutex.Unlock() -} - -// Attach makes all the L4Filters to point back to the L4Policy that contains them. -// This is done before the L4Policy is exposed to concurrent access. -func (l4 *L4Policy) Attach(ctx PolicyContext) { - ingressRedirects := l4.Ingress.attach(ctx, l4) - egressRedirects := l4.Egress.attach(ctx, l4) - l4.redirectTypes = ingressRedirects | egressRedirects -} - -// IngressCoversContext checks if the receiver's ingress L4Policy contains -// all `dPorts` and `labels`. -// -// Note: Only used for policy tracing -func (l4 *L4PolicyMap) IngressCoversContext(ctx *SearchContext) api.Decision { - return l4.containsAllL3L4(ctx.From, ctx.DPorts) -} - -// EgressCoversContext checks if the receiver's egress L4Policy contains -// all `dPorts` and `labels`. -// -// Note: Only used for policy tracing -func (l4 *L4PolicyMap) EgressCoversContext(ctx *SearchContext) api.Decision { - return l4.containsAllL3L4(ctx.To, ctx.DPorts) -} - -// HasRedirect returns true if the L4 policy contains at least one port redirection -func (l4 *L4Policy) HasRedirect() bool { - return l4 != nil && l4.redirectTypes != redirectTypeNone -} - -// HasEnvoyRedirect returns true if the L4 policy contains at least one port redirection to Envoy -func (l4 *L4Policy) HasEnvoyRedirect() bool { - return l4 != nil && l4.redirectTypes&redirectTypeEnvoy == redirectTypeEnvoy -} - -// HasProxylibRedirect returns true if the L4 policy contains at least one port redirection to Proxylib -func (l4 *L4Policy) HasProxylibRedirect() bool { - return l4 != nil && l4.redirectTypes&redirectTypeProxylib == redirectTypeProxylib -} - -func (l4 *L4Policy) GetModel() *models.L4Policy { - if l4 == nil { - return nil - } - - ingress := []*models.PolicyRule{} - for _, v := range l4.Ingress.PortRules { - rulesBySelector := map[string][][]string{} - derivedFrom := labels.LabelArrayList{} - for sel, rules := range v.RuleOrigin { - derivedFrom.MergeSorted(rules) - rulesBySelector[sel.String()] = rules.GetModel() - } - ingress = append(ingress, &models.PolicyRule{ - Rule: v.Marshal(), - DerivedFromRules: derivedFrom.GetModel(), - RulesBySelector: rulesBySelector, - }) - } - - egress := []*models.PolicyRule{} - for _, v := range l4.Egress.PortRules { - derivedFrom := labels.LabelArrayList{} - for _, rules := range v.RuleOrigin { - derivedFrom.MergeSorted(rules) - } - egress = append(egress, &models.PolicyRule{ - Rule: v.Marshal(), - DerivedFromRules: derivedFrom.GetModel(), - }) - } - - return &models.L4Policy{ - Ingress: ingress, - Egress: egress, - } -} - -// ProxyPolicy is any type which encodes state needed to redirect to an L7 -// proxy. -type ProxyPolicy interface { - CopyL7RulesPerEndpoint() L7DataMap - GetL7Parser() L7ParserType - GetIngress() bool - GetPort() uint16 - GetProtocol() uint8 - GetListener() string -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/mapstate.go b/vendor/github.com/cilium/cilium/pkg/policy/mapstate.go deleted file mode 100644 index 29574f1ee..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/mapstate.go +++ /dev/null @@ -1,1490 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package policy - -import ( - "fmt" - "net" - "slices" - "strconv" - "testing" - - "github.com/sirupsen/logrus" - "golang.org/x/exp/maps" - - "github.com/cilium/cilium/pkg/identity" - "github.com/cilium/cilium/pkg/ip" - "github.com/cilium/cilium/pkg/labels" - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/option" - "github.com/cilium/cilium/pkg/policy/trafficdirection" -) - -var ( - // localHostKey represents an ingress L3 allow from the local host. - localHostKey = Key{ - Identity: identity.ReservedIdentityHost.Uint32(), - TrafficDirection: trafficdirection.Ingress.Uint8(), - } - // allKey represents a key for unknown traffic, i.e., all traffic. - allKey = Key{ - Identity: identity.IdentityUnknown.Uint32(), - } -) - -const ( - LabelKeyPolicyDerivedFrom = "io.cilium.policy.derived-from" - LabelAllowLocalHostIngress = "allow-localhost-ingress" - LabelAllowAnyIngress = "allow-any-ingress" - LabelAllowAnyEgress = "allow-any-egress" - LabelVisibilityAnnotation = "visibility-annotation" - - // Using largest possible port value since it has the lowest priority - unrealizedRedirectPort = uint16(65535) -) - -// MapState is a map interface for policy maps -type MapState interface { - Get(Key) (MapStateEntry, bool) - Insert(Key, MapStateEntry) - Delete(Key) - // ForEach allows iteration over the MapStateEntries. It returns true iff - // the iteration was not stopped early by the callback. - ForEach(func(Key, MapStateEntry) (cont bool)) (complete bool) - // ForEachAllow behaves like ForEach, but only iterates MapStateEntries which are not denies. - ForEachAllow(func(Key, MapStateEntry) (cont bool)) (complete bool) - // ForEachDeny behaves like ForEach, but only iterates MapStateEntries which are denies. - ForEachDeny(func(Key, MapStateEntry) (cont bool)) (complete bool) - GetIdentities(*logrus.Logger) ([]int64, []int64) - GetDenyIdentities(*logrus.Logger) ([]int64, []int64) - RevertChanges(ChangeState) - AddVisibilityKeys(PolicyOwner, uint16, *VisibilityMetadata, ChangeState) - Len() int - Equals(MapState) bool - Diff(t *testing.T, expected MapState) string - - allowAllIdentities(ingress, egress bool) - determineAllowLocalhostIngress() - deniesL4(policyOwner PolicyOwner, l4 *L4Filter) bool - denyPreferredInsertWithChanges(newKey Key, newEntry MapStateEntry, identities Identities, features policyFeatures, changes ChangeState) - deleteKeyWithChanges(key Key, owner MapStateOwner, changes ChangeState) -} - -// mapState is a state of a policy map. -type mapState struct { - allows mapStateMap - denies mapStateMap -} - -// mapStateMap is a convience type representing the actual structure mapping -// policymap keys to policymap entries. -type mapStateMap map[Key]MapStateEntry - -func (m mapStateMap) insert(k Key, e MapStateEntry) { - if m == nil { - n := make(mapStateMap) - m = n - } - m[k] = e -} - -type Identities interface { - GetNetsLocked(identity.NumericIdentity) []*net.IPNet -} - -// Key is the userspace representation of a policy key in BPF. It is -// intentionally duplicated from pkg/maps/policymap to avoid pulling in the -// BPF dependency to this package. -type Key struct { - // Identity is the numeric identity to / from which traffic is allowed. - Identity uint32 - // DestPort is the port at L4 to / from which traffic is allowed, in - // host-byte order. - DestPort uint16 - // NextHdr is the protocol which is allowed. - Nexthdr uint8 - // TrafficDirection indicates in which direction Identity is allowed - // communication (egress or ingress). - TrafficDirection uint8 -} - -// String returns a string representation of the Key -func (k Key) String() string { - return "Identity=" + strconv.FormatUint(uint64(k.Identity), 10) + - ",DestPort=" + strconv.FormatUint(uint64(k.DestPort), 10) + - ",Nexthdr=" + strconv.FormatUint(uint64(k.Nexthdr), 10) + - ",TrafficDirection=" + strconv.FormatUint(uint64(k.TrafficDirection), 10) -} - -// IsIngress returns true if the key refers to an ingress policy key -func (k Key) IsIngress() bool { - return k.TrafficDirection == trafficdirection.Ingress.Uint8() -} - -// IsEgress returns true if the key refers to an egress policy key -func (k Key) IsEgress() bool { - return k.TrafficDirection == trafficdirection.Egress.Uint8() -} - -// PortProtoIsBroader returns true if the receiver Key has broader -// port-protocol than the argument Key. That is a port-protocol -// that covers the argument Key's port-protocol and is larger. -// An equal port-protocol will return false. -func (k Key) PortProtoIsBroader(c Key) bool { - return k.DestPort == 0 && c.DestPort != 0 || - k.Nexthdr == 0 && c.Nexthdr != 0 -} - -// PortProtoIsEqual returns true if the port-protocols of the -// two keys are exactly equal. -func (k Key) PortProtoIsEqual(c Key) bool { - return k.DestPort == c.DestPort && k.Nexthdr == c.Nexthdr -} - -type Keys map[Key]struct{} - -type MapStateOwner interface{} - -// MapStateEntry is the configuration associated with a Key in a -// MapState. This is a minimized version of policymap.PolicyEntry. -type MapStateEntry struct { - // The proxy port, in host byte order. - // If 0 (default), there is no proxy redirection for the corresponding - // Key. Any other value signifies proxy redirection. - ProxyPort uint16 - - // priority is used to select the Listener if multiple rules would apply different listeners - // to a policy map entry. Lower numbers indicate higher priority. If left out, the proxy - // port number (10000-20000) is used. - priority uint16 - - // Listener name for proxy redirection, if any - Listener string - - // IsDeny is true when the policy should be denied. - IsDeny bool - - // hasAuthType is 'DefaultAuthType' when policy has no explicit AuthType set. In this case the - // value of AuthType is derived from more generic entries covering this entry. - hasAuthType HasAuthType - - // AuthType is non-zero when authentication is required for the traffic to be allowed. - AuthType AuthType - - // DerivedFromRules tracks the policy rules this entry derives from - // In sorted order. - DerivedFromRules labels.LabelArrayList - - // Owners collects the keys in the map and selectors in the policy that require this key to be present. - // TODO: keep track which selector needed the entry to be deny, redirect, or just allow. - owners map[MapStateOwner]struct{} - - // dependents contains the keys for entries create based on this entry. These entries - // will be deleted once all of the owners are deleted. - dependents Keys -} - -// NewMapStateEntry creates a map state entry. If redirect is true, the -// caller is expected to replace the ProxyPort field before it is added to -// the actual BPF map. -// 'cs' is used to keep track of which policy selectors need this entry. If it is 'nil' this entry -// will become sticky and cannot be completely removed via incremental updates. Even in this case -// the entry may be overridden or removed by a deny entry. -func NewMapStateEntry(cs MapStateOwner, derivedFrom labels.LabelArrayList, proxyPort uint16, listener string, priority uint16, deny bool, hasAuth HasAuthType, authType AuthType) MapStateEntry { - if proxyPort == 0 { - listener = "" - priority = 0 - } else if priority == 0 { - priority = proxyPort // default for tie-breaking - } - return MapStateEntry{ - ProxyPort: proxyPort, - Listener: listener, - priority: priority, - DerivedFromRules: derivedFrom, - IsDeny: deny, - hasAuthType: hasAuth, - AuthType: authType, - owners: map[MapStateOwner]struct{}{cs: {}}, - } -} - -// AddDependent adds 'key' to the set of dependent keys. -func (e *MapStateEntry) AddDependent(key Key) { - if e.dependents == nil { - e.dependents = make(Keys, 1) - } - e.dependents[key] = struct{}{} -} - -// RemoveDependent removes 'key' from the set of dependent keys. -func (e *MapStateEntry) RemoveDependent(key Key) { - delete(e.dependents, key) - // Nil the map when empty. This is mainly to make unit testing easier. - if len(e.dependents) == 0 { - e.dependents = nil - } -} - -// HasDependent returns true if the 'key' is contained -// within the set of dependent keys -func (e *MapStateEntry) HasDependent(key Key) bool { - if e.dependents == nil { - return false - } - _, ok := e.dependents[key] - return ok -} - -var worldNets = map[identity.NumericIdentity][]*net.IPNet{ - identity.ReservedIdentityWorld: { - {IP: net.IPv4zero, Mask: net.CIDRMask(0, net.IPv4len*8)}, - {IP: net.IPv6zero, Mask: net.CIDRMask(0, net.IPv6len*8)}, - }, - identity.ReservedIdentityWorldIPv4: { - {IP: net.IPv4zero, Mask: net.CIDRMask(0, net.IPv4len*8)}, - }, - identity.ReservedIdentityWorldIPv6: { - {IP: net.IPv6zero, Mask: net.CIDRMask(0, net.IPv6len*8)}, - }, -} - -// getNets returns the most specific CIDR for an identity. For the "World" identity -// it returns both IPv4 and IPv6. -func getNets(identities Identities, ident uint32) []*net.IPNet { - // World identities are handled explicitly for two reasons: - // 1. 'identities' may be nil, but world identities are still expected to be considered - // 2. SelectorCache is not be informed of reserved/world identities in all test cases - id := identity.NumericIdentity(ident) - if id <= identity.ReservedIdentityWorldIPv6 { - return worldNets[id] - } - // CIDR identities have a local scope, so we can skip the rest if id is not of local scope. - if !id.HasLocalScope() || identities == nil { - return nil - } - return identities.GetNetsLocked(id) -} - -// NewMapState creates a new MapState interface -func NewMapState(initMap map[Key]MapStateEntry) MapState { - return newMapState(initMap) -} - -func newMapState(initMap map[Key]MapStateEntry) *mapState { - m := &mapState{ - allows: make(map[Key]MapStateEntry), - denies: make(map[Key]MapStateEntry), - } - for k, v := range initMap { - m.Insert(k, v) - } - return m -} - -// Get the MapStateEntry that matches the Key. -func (ms *mapState) Get(k Key) (MapStateEntry, bool) { - v, ok := ms.denies[k] - if ok { - return v, ok - } - v, ok = ms.allows[k] - return v, ok -} - -// Insert the Key and matcthing MapStateEntry into the -// MapState -func (ms *mapState) Insert(k Key, v MapStateEntry) { - if v.IsDeny { - delete(ms.allows, k) - ms.denies.insert(k, v) - } else { - delete(ms.denies, k) - ms.allows.insert(k, v) - } -} - -// Delete removes the Key an related MapStateEntry. -func (ms *mapState) Delete(k Key) { - delete(ms.allows, k) - delete(ms.denies, k) -} - -// ForEach iterates over every Key MapStateEntry and stops when the function -// argument returns false. It returns false iff the iteration was cut short. -func (ms *mapState) ForEach(f func(Key, MapStateEntry) (cont bool)) (complete bool) { - if complete := ms.ForEachAllow(f); !complete { - return complete - } - - return ms.ForEachDeny(f) -} - -// ForEachAllow iterates over every Key MapStateEntry that isn't a deny and -// stops when the function argument returns false -func (ms *mapState) ForEachAllow(f func(Key, MapStateEntry) (cont bool)) (complete bool) { - for k, v := range ms.allows { - if !f(k, v) { - return false - } - } - return true -} - -// ForEachDeny iterates over every Key MapStateEntry that is a deny and -// stops when the function argument returns false -func (ms *mapState) ForEachDeny(f func(Key, MapStateEntry) (cont bool)) (complete bool) { - for k, v := range ms.denies { - if !f(k, v) { - return false - } - } - return true -} - -// Len returns the length of the map -func (ms *mapState) Len() int { - return len(ms.allows) + len(ms.denies) -} - -// Equals determines if this MapState is equal to the -// argument MapState -func (msA *mapState) Equals(msB MapState) bool { - if msA.Len() != msB.Len() { - return false - } - - return msA.ForEach(func(kA Key, vA MapStateEntry) bool { - if vB, ok := msB.Get(kA); ok { - return (&vB).DatapathEqual(&vA) - } - return false - }) -} - -// Diff returns the string of differences between 'obtained' and 'expected' prefixed with -// '+ ' or '- ' for obtaining something unexpected, or not obtaining the expected, respectively. -// For use in debugging. -func (obtained *mapState) Diff(_ *testing.T, expected MapState) (res string) { - expected.ForEach(func(kE Key, vE MapStateEntry) bool { - if vO, ok := obtained.Get(kE); ok { - if !(&vO).DatapathEqual(&vE) { - res += "- " + kE.String() + ": " + vE.String() + "\n" - res += "+ " + kE.String() + ": " + vO.String() + "\n" - } - } else { - res += "- " + kE.String() + ": " + vE.String() + "\n" - } - return true - }) - obtained.ForEach(func(kE Key, vE MapStateEntry) bool { - if vO, ok := expected.Get(kE); !ok { - res += "+ " + kE.String() + ": " + vO.String() + "\n" - } - return true - }) - return res -} - -// AddDependent adds 'key' to the set of dependent keys. -func (ms *mapState) AddDependent(owner Key, dependent Key, changes ChangeState) { - if e, exists := ms.allows[owner]; exists { - ms.addDependentOnEntry(owner, e, dependent, changes) - } else if e, exists := ms.denies[owner]; exists { - ms.addDependentOnEntry(owner, e, dependent, changes) - } -} - -// addDependentOnEntry adds 'dependent' to the set of dependent keys of 'e'. -func (ms *mapState) addDependentOnEntry(owner Key, e MapStateEntry, dependent Key, changes ChangeState) { - if _, exists := e.dependents[dependent]; !exists { - if changes.Old != nil { - changes.Old[owner] = e - } - e.AddDependent(dependent) - ms.Insert(owner, e) - } -} - -// RemoveDependent removes 'key' from the list of dependent keys. -// This is called when a dependent entry is being deleted. -// If 'old' is not nil, then old value is added there before any modifications. -func (ms *mapState) RemoveDependent(owner Key, dependent Key, changes ChangeState) { - if e, exists := ms.allows[owner]; exists { - changes.insertOldIfNotExists(owner, e) - e.RemoveDependent(dependent) - delete(ms.denies, owner) - ms.allows.insert(owner, e) - return - } - - if e, exists := ms.denies[owner]; exists { - changes.insertOldIfNotExists(owner, e) - e.RemoveDependent(dependent) - delete(ms.allows, owner) - ms.denies.insert(owner, e) - } -} - -// Merge adds owners, dependents, and DerivedFromRules from a new 'entry' to an existing -// entry 'e'. 'entry' is not modified. -// IsDeny, ProxyPort, and AuthType are merged by giving precedence to deny over non-deny, proxy -// redirection over no proxy redirection, and explicit auth type over default auth type. -func (e *MapStateEntry) Merge(entry *MapStateEntry) { - // Deny is sticky - if !e.IsDeny { - e.IsDeny = entry.IsDeny - } - - // Deny entries have no proxy redirection nor auth requirement - if e.IsDeny { - e.ProxyPort = 0 - e.Listener = "" - e.priority = 0 - e.hasAuthType = DefaultAuthType - e.AuthType = AuthTypeDisabled - } else { - // Proxy port takes precedence, but may be updated due to priority - if entry.IsRedirectEntry() { - // Lower number has higher priority, but non-redirects have 0 priority - // value. - // Proxy port value is the tie-breaker when priorities have the same value. - if !e.IsRedirectEntry() || entry.priority < e.priority || entry.priority == e.priority && entry.ProxyPort < e.ProxyPort { - e.ProxyPort = entry.ProxyPort - e.Listener = entry.Listener - e.priority = entry.priority - } - } - - // Explicit auth takes precedence over defaulted one. - if entry.hasAuthType == ExplicitAuthType { - if e.hasAuthType == ExplicitAuthType { - // Numerically higher AuthType takes precedence when both are explicitly defined - if entry.AuthType > e.AuthType { - e.AuthType = entry.AuthType - } - } else { - e.hasAuthType = ExplicitAuthType - e.AuthType = entry.AuthType - } - } else if e.hasAuthType == DefaultAuthType { - e.AuthType = entry.AuthType // new default takes precedence - } - } - - if e.owners == nil && len(entry.owners) > 0 { - e.owners = make(map[MapStateOwner]struct{}, len(entry.owners)) - } - for k, v := range entry.owners { - e.owners[k] = v - } - - // merge dependents - for k := range entry.dependents { - e.AddDependent(k) - } - - // merge DerivedFromRules - if len(entry.DerivedFromRules) > 0 { - e.DerivedFromRules.MergeSorted(entry.DerivedFromRules) - } -} - -// IsRedirectEntry returns true if the entry redirects to a proxy port -func (e *MapStateEntry) IsRedirectEntry() bool { - return e.ProxyPort != 0 -} - -// DatapathEqual returns true of two entries are equal in the datapath's PoV, -// i.e., IsDeny, ProxyPort and AuthType are the same for both entries. -func (e *MapStateEntry) DatapathEqual(o *MapStateEntry) bool { - if e == nil || o == nil { - return e == o - } - - return e.IsDeny == o.IsDeny && e.ProxyPort == o.ProxyPort && e.AuthType == o.AuthType -} - -// DeepEqual is a manually generated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -// Defined manually due to deepequal-gen not supporting interface types. -// 'cachedNets' member is ignored in comparison, as it is a cached value and -// makes no functional difference. -func (e *MapStateEntry) DeepEqual(o *MapStateEntry) bool { - if !e.DatapathEqual(o) { - return false - } - - if e.Listener != o.Listener || e.priority != o.priority { - return false - } - - if !e.DerivedFromRules.DeepEqual(&o.DerivedFromRules) { - return false - } - - if len(e.owners) != len(o.owners) { - return false - } - for k := range o.owners { - if _, exists := e.owners[k]; !exists { - return false - } - } - - if len(e.dependents) != len(o.dependents) { - return false - } - for k := range o.dependents { - if _, exists := e.dependents[k]; !exists { - return false - } - } - - // ignoring cachedNets - - return true -} - -// String returns a string representation of the MapStateEntry -func (e MapStateEntry) String() string { - return "ProxyPort=" + strconv.FormatUint(uint64(e.ProxyPort), 10) + - ",Listener=" + e.Listener + - ",IsDeny=" + strconv.FormatBool(e.IsDeny) + - ",AuthType=" + e.AuthType.String() + - ",DerivedFromRules=" + fmt.Sprintf("%v", e.DerivedFromRules) -} - -// denyPreferredInsert inserts a key and entry into the map by given preference -// to deny entries, and L3-only deny entries over L3-L4 allows. -// This form may be used when a full policy is computed and we are not yet interested -// in accumulating incremental changes. -// Caller may insert the same MapStateEntry multiple times for different Keys, but all from the same -// owner. -func (ms *mapState) denyPreferredInsert(newKey Key, newEntry MapStateEntry, identities Identities, features policyFeatures) { - // Enforce nil values from NewMapStateEntry - newEntry.dependents = nil - - ms.denyPreferredInsertWithChanges(newKey, newEntry, identities, features, ChangeState{}) -} - -// addKeyWithChanges adds a 'key' with value 'entry' to 'keys' keeping track of incremental changes in 'adds' and 'deletes', and any changed or removed old values in 'old', if not nil. -func (ms *mapState) addKeyWithChanges(key Key, entry MapStateEntry, changes ChangeState) { - // Keep all owners that need this entry so that it is deleted only if all the owners delete their contribution - var datapathEqual bool - oldEntry, exists := ms.Get(key) - if exists { - // Deny entry can only be overridden by another deny entry - if oldEntry.IsDeny && !entry.IsDeny { - return - } - - // Do nothing if entries are equal - if entry.DeepEqual(&oldEntry) { - return // nothing to do - } - - // Save old value before any changes, if desired - if changes.Old != nil { - changes.insertOldIfNotExists(key, oldEntry) - } - - // Compare for datapath equalness before merging, as the old entry is updated in - // place! - datapathEqual = oldEntry.DatapathEqual(&entry) - oldEntry.Merge(&entry) - ms.Insert(key, oldEntry) - } else { - // Newly inserted entries must have their own containers, so that they - // remain separate when new owners/dependents are added to existing entries - entry.DerivedFromRules = slices.Clone(entry.DerivedFromRules) - entry.owners = maps.Clone(entry.owners) - entry.dependents = maps.Clone(entry.dependents) - ms.Insert(key, entry) - } - - // Record an incremental Add if desired and entry is new or changed - if changes.Adds != nil && (!exists || !datapathEqual) { - changes.Adds[key] = struct{}{} - // Key add overrides any previous delete of the same key - if changes.Deletes != nil { - delete(changes.Deletes, key) - } - } -} - -// deleteKeyWithChanges deletes a 'key' from 'keys' keeping track of incremental changes in 'adds' and 'deletes'. -// The key is unconditionally deleted if 'cs' is nil, otherwise only the contribution of this 'cs' is removed. -func (ms *mapState) deleteKeyWithChanges(key Key, owner MapStateOwner, changes ChangeState) { - if entry, exists := ms.Get(key); exists { - // Save old value before any changes, if desired - oldAdded := changes.insertOldIfNotExists(key, entry) - if owner != nil { - // remove the contribution of the given selector only - if _, exists = entry.owners[owner]; exists { - // Remove the contribution of this selector from the entry - delete(entry.owners, owner) - if ownerKey, ok := owner.(Key); ok { - ms.RemoveDependent(ownerKey, key, changes) - } - // key is not deleted if other owners still need it - if len(entry.owners) > 0 { - return - } - } else { - // 'owner' was not found, do not change anything - if oldAdded { - delete(changes.Old, key) - } - return - } - } - - // Remove this key from all owners' dependents maps if no owner was given. - // Owner is nil when deleting more specific entries (e.g., L3/L4) when - // adding deny entries that cover them (e.g., L3-deny). - if owner == nil { - for owner := range entry.owners { - if owner != nil { - if ownerKey, ok := owner.(Key); ok { - ms.RemoveDependent(ownerKey, key, changes) - } - } - } - } - - // Check if dependent entries need to be deleted as well - for k := range entry.dependents { - ms.deleteKeyWithChanges(k, key, changes) - } - if changes.Deletes != nil { - changes.Deletes[key] = struct{}{} - // Remove a potential previously added key - if changes.Adds != nil { - delete(changes.Adds, key) - } - } - - delete(ms.allows, key) - delete(ms.denies, key) - } -} - -// identityIsSupersetOf compares two entries and keys to see if the primary identity contains -// the compared identity. This means that either that primary identity is 0 (i.e. it is a superset -// of every other identity), or one of the subnets of the primary identity fully contains or is -// equal to one of the subnets in the compared identity (note:this covers cases like "reserved:world"). -func identityIsSupersetOf(primaryIdentity, compareIdentity uint32, identities Identities) bool { - // If the identities are equal then neither is a superset (for the purposes of our business logic). - if primaryIdentity == compareIdentity { - return false - } - - // Consider an identity that selects a broader CIDR as a superset of - // an identity that selects a narrower CIDR. For instance, an identity - // corresponding to 192.0.0.0/16 is a superset of the identity that - // corresponds to 192.0.2.3/32. - // - // The reasons we need to do this are surprisingly complex, taking into - // consideration design decisions around the handling of ToFQDNs policy - // and how L4PolicyMap/L4Filter structures cache the policies with - // respect to specific CIDRs. More specifically: - // - At the time of initial L4Filter creation, it is not known which - // specific CIDRs (or corresponding identities) are selected by a - // toFQDNs rule in the policy engine. - // - It is possible to have a CIDR deny rule that should deny peers - // that are allowed by a ToFQDNs statement. The precedence rules in - // the API for such policy conflicts define that the deny should take - // precedence. - // - Consider a case where there is a deny rule for 192.0.0.0/16 with - // an allow rule for cilium.io, and one of the IP addresses for - // cilium.io is 192.0.2.3. - // - If the IP for cilium.io was known at initial policy computation - // time, then we would calculate the MapState from the L4Filters and - // immediately determine that there is a conflict between the - // L4Filter that denies 192.0.0.0/16 vs. the allow for 192.0.2.3. - // From this we could immediately discard the "allow to 192.0.2.3" - // policymap entry during policy calculation. This would satisfy the - // API constraint that deny rules take precedence over allow rules. - // However, this is not the case for ToFQDNs -- the IPs are not known - // until DNS resolution time by the selected application / endpoint. - // - In order to make ToFQDNs policy implementation efficient, it uses - // a shorter incremental policy computation path that attempts to - // directly implement the ToFQDNs allow into a MapState entry without - // reaching back up to the L4Filter layer to iterate all selectors - // to determine traffic reachability for this newly learned IP. - // - As such, when the new ToFQDNs allow for the 192.0.2.3 IP address - // is implemented, we must iterate back through all existing MapState - // entries to determine whether any of the other map entries already - // denies this traffic by virtue of the IP prefix being a superset of - // this new allow. This allows us to ensure that the broader CIDR - // deny semantics are correctly applied when there is a combination - // of CIDR deny rules and ToFQDNs allow rules. - // - // An alternative to this approach might be to change the ToFQDNs - // policy calculation layer to reference back to the L4Filter layer, - // and perhaps introduce additional CIDR caching somewhere there so - // that this policy computation can be efficient while handling DNS - // responses. As of the writing of this message, such there is no - // active proposal to implement this proposal. As a result, any time - // there is an incremental policy update for a new map entry, we must - // iterate through all entries in the map and re-evaluate superset - // relationships for deny entries to ensure that policy precedence is - // correctly implemented between the new and old entries, taking into - // account whether the identities may represent CIDRs that have a - // superset relationship. - return primaryIdentity == 0 && compareIdentity != 0 || - ip.NetsContainsAny(getNets(identities, primaryIdentity), - getNets(identities, compareIdentity)) -} - -// protocolsMatch checks to see if two given keys match on protocol. -// This means that either one of them covers all protocols or they -// are equal. -func protocolsMatch(a, b Key) bool { - return a.Nexthdr == 0 || b.Nexthdr == 0 || a.Nexthdr == b.Nexthdr -} - -// RevertChanges undoes changes to 'keys' as indicated by 'changes.adds' and 'changes.old' collected via -// denyPreferredInsertWithChanges(). -func (ms *mapState) RevertChanges(changes ChangeState) { - for k := range changes.Adds { - delete(ms.allows, k) - delete(ms.denies, k) - } - // 'old' contains all the original values of both modified and deleted entries - for k, v := range changes.Old { - ms.Insert(k, v) - } -} - -// denyPreferredInsertWithChanges contains the most important business logic for policy insertions. It inserts -// a key and entry into the map by giving preference to deny entries, and L3-only deny entries over L3-L4 allows. -// Incremental changes performed are recorded in 'adds' and 'deletes', if not nil. -// See https://docs.google.com/spreadsheets/d/1WANIoZGB48nryylQjjOw6lKjI80eVgPShrdMTMalLEw#gid=2109052536 for details -func (ms *mapState) denyPreferredInsertWithChanges(newKey Key, newEntry MapStateEntry, identities Identities, features policyFeatures, changes ChangeState) { - // Skip deny rules processing if the policy in this direction has no deny rules - if !features.contains(denyRules) { - ms.authPreferredInsert(newKey, newEntry, features, changes) - return - } - - allCpy := allKey - allCpy.TrafficDirection = newKey.TrafficDirection - // If we have a deny "all" we don't accept any kind of map entry. - if _, ok := ms.denies[allCpy]; ok { - return - } - if newEntry.IsDeny { - ms.ForEachAllow(func(k Key, v MapStateEntry) bool { - // Protocols and traffic directions that don't match ensure that the policies - // do not interact in anyway. - if newKey.TrafficDirection != k.TrafficDirection || !protocolsMatch(newKey, k) { - return true - } - - if identityIsSupersetOf(k.Identity, newKey.Identity, identities) { - if newKey.PortProtoIsBroader(k) { - // If this iterated-allow-entry is a superset of the new-entry - // and it has a more specific port-protocol than the new-entry - // then an additional copy of the new-entry with the more - // specific port-protocol of the iterated-allow-entry must be inserted. - newKeyCpy := newKey - newKeyCpy.DestPort = k.DestPort - newKeyCpy.Nexthdr = k.Nexthdr - l3l4DenyEntry := NewMapStateEntry(newKey, newEntry.DerivedFromRules, 0, "", 0, true, DefaultAuthType, AuthTypeDisabled) - ms.addKeyWithChanges(newKeyCpy, l3l4DenyEntry, changes) - // L3-only entries can be deleted incrementally so we need to track their - // effects on other entries so that those effects can be reverted when the - // identity is removed. - newEntry.AddDependent(newKeyCpy) - } - } else if (newKey.Identity == k.Identity || - identityIsSupersetOf(newKey.Identity, k.Identity, identities)) && - (newKey.PortProtoIsBroader(k) || newKey.PortProtoIsEqual(k)) { - // If the new-entry is a superset (or equal) of the iterated-allow-entry and - // the new-entry has a broader (or equal) port-protocol then we - // should delete the iterated-allow-entry - ms.deleteKeyWithChanges(k, nil, changes) - } - return true - }) - - bailed := false - ms.ForEachDeny(func(k Key, v MapStateEntry) bool { - // Protocols and traffic directions that don't match ensure that the policies - // do not interact in anyway. - if newKey.TrafficDirection != k.TrafficDirection || !protocolsMatch(newKey, k) { - return true - } - - if (newKey.Identity == k.Identity || - identityIsSupersetOf(k.Identity, newKey.Identity, identities)) && - k.DestPort == 0 && k.Nexthdr == 0 && - !v.HasDependent(newKey) { - // If this iterated-deny-entry is a supserset (or equal) of the new-entry and - // the iterated-deny-entry is an L3-only policy then we - // should not insert the new entry (as long as it is not one - // of the special L4-only denies we created to cover the special - // case of a superset-allow with a more specific port-protocol). - // - // NOTE: This condition could be broader to reject more deny entries, - // but there *may* be performance tradeoffs. - bailed = true - return false - } else if (newKey.Identity == k.Identity || - identityIsSupersetOf(newKey.Identity, k.Identity, identities)) && - newKey.DestPort == 0 && newKey.Nexthdr == 0 && - !newEntry.HasDependent(k) { - // If this iterated-deny-entry is a subset (or equal) of the new-entry and - // the new-entry is an L3-only policy then we - // should delete the iterated-deny-entry (as long as it is not one - // of the special L4-only denies we created to cover the special - // case of a superset-allow with a more specific port-protocol). - // - // NOTE: This condition could be broader to reject more deny entries, - // but there *may* be performance tradeoffs. - ms.deleteKeyWithChanges(k, nil, changes) - } - return true - }) - - if !bailed { - ms.addKeyWithChanges(newKey, newEntry, changes) - } - } else { - // NOTE: We do not delete redundant allow entries. - bailed := false - ms.ForEachDeny(func(k Key, v MapStateEntry) bool { - // Protocols and traffic directions that don't match ensure that the policies - // do not interact in anyway. - if newKey.TrafficDirection != k.TrafficDirection || !protocolsMatch(newKey, k) { - return true - } - if identityIsSupersetOf(newKey.Identity, k.Identity, identities) { - if k.PortProtoIsBroader(newKey) { - // If the new-entry is *only* superset of the iterated-deny-entry - // and the new-entry has a more specific port-protocol than the - // iterated-deny-entry then an additional copy of the iterated-deny-entry - // with the more specific port-porotocol of the new-entry must - // be added. - denyKeyCpy := k - denyKeyCpy.DestPort = newKey.DestPort - denyKeyCpy.Nexthdr = newKey.Nexthdr - l3l4DenyEntry := NewMapStateEntry(k, v.DerivedFromRules, 0, "", 0, true, DefaultAuthType, AuthTypeDisabled) - ms.addKeyWithChanges(denyKeyCpy, l3l4DenyEntry, changes) - // L3-only entries can be deleted incrementally so we need to track their - // effects on other entries so that those effects can be reverted when the - // identity is removed. - ms.addDependentOnEntry(k, v, denyKeyCpy, changes) - } - } else if (k.Identity == newKey.Identity || - identityIsSupersetOf(k.Identity, newKey.Identity, identities)) && - (k.PortProtoIsBroader(newKey) || k.PortProtoIsEqual(newKey)) && - !v.HasDependent(newKey) { - // If the iterated-deny-entry is a superset (or equal) of the new-entry and has a - // broader (or equal) port-protocol than the new-entry then the new - // entry should not be inserted. - bailed = true - return false - } - - return true - }) - - if !bailed { - ms.authPreferredInsert(newKey, newEntry, features, changes) - } - } -} - -// IsSuperSetOf checks if the receiver Key is a superset of the argument Key, and returns a -// specificity score of the receiver key (higher score is more specific), if so. Being a superset -// means that the receiver key would match all the traffic of the argument key without being the -// same key. Hence, a L3-only key is not a superset of a L4-only key, as the L3-only key would match -// the traffic for the given L3 only, while the L4-only key matches traffic on the given port for -// all the L3's. -// Returns 0 if the receiver key is not a superset of the argument key. -// -// Specificity score for all possible superset wildcard patterns. Datapath requires proto to be specified if port is specified. -// x. L3/proto/port -// 1. */*/* -// 2. */proto/* -// 3. */proto/port -// 4. ID/*/* -// 5. ID/proto/* -// ( ID/proto/port can not be superset of anything ) -func (k Key) IsSuperSetOf(other Key) int { - if k.TrafficDirection != other.TrafficDirection { - return 0 // TrafficDirection must match for 'k' to be a superset of 'other' - } - if k.Identity == 0 { - if other.Identity == 0 { - if k.Nexthdr == 0 { // k.DestPort == 0 is implied - if other.Nexthdr != 0 { - return 1 // */*/* is a superset of */proto/x - } // else both are */*/* - } else if k.Nexthdr == other.Nexthdr { - if k.DestPort == 0 && other.DestPort != 0 { - return 2 // */proto/* is a superset of */proto/port - } // else more specific or different ports - } // else more specific or different protocol - } else { - // Wildcard L3 is a superset of a specific L3 only if wildcard L3 is also wildcard L4, or the L4's match between the keys - if k.Nexthdr == 0 { // k.DestPort == 0 is implied - return 1 // */*/* is a superset of ID/x/x - } else if k.Nexthdr == other.Nexthdr { - if k.DestPort == 0 { - return 2 // */proto/* is a superset of ID/proto/x - } else if k.DestPort == other.DestPort { - return 3 // */proto/port is a superset of ID/proto/port - } // else more specific or different ports - } // else more specific or different protocol - } - } else if k.Identity == other.Identity { - if k.Nexthdr == 0 { - if other.Nexthdr != 0 { - return 4 // ID/*/* is a superset of ID/proto/x - } // else both are ID/*/* - } else if k.Nexthdr == other.Nexthdr { - if k.DestPort == 0 && other.DestPort != 0 { - return 5 // ID/proto/* is a superset of ID/proto/port - } // else more specific or different ports - } // else more specific or different protocol - } // else more specific or different identity - return 0 -} - -// authPreferredInsert applies AuthType of a more generic entry to more specific entries, if not -// explicitly specified. -// -// This function is expected to be called for a map insertion after deny -// entry evaluation. If there is a map entry that is a superset of 'newKey' -// which denies traffic matching 'newKey', then this function should not be called. -func (ms *mapState) authPreferredInsert(newKey Key, newEntry MapStateEntry, features policyFeatures, changes ChangeState) { - if features.contains(authRules) { - if newEntry.hasAuthType == DefaultAuthType { - // New entry has a default auth type. - // Fill in the AuthType from more generic entries with an explicit auth type - maxSpecificity := 0 - l3l4State := newMapState(nil) - - ms.ForEachAllow(func(k Key, v MapStateEntry) bool { - // Only consider the same Traffic direction - if newKey.TrafficDirection != k.TrafficDirection { - return true - } - - // Nothing to be done if entry has default AuthType - if v.hasAuthType == DefaultAuthType { - return true - } - - // Find out if 'k' is an identity-port-proto superset of 'newKey' - if specificity := k.IsSuperSetOf(newKey); specificity > 0 { - if specificity > maxSpecificity { - // AuthType from the most specific superset is - // applied to 'newEntry' - newEntry.AuthType = v.AuthType - maxSpecificity = specificity - } - } else { - // Check if a new L3L4 entry must be created due to L3-only - // 'k' specifying an explicit AuthType and an L4-only 'newKey' not - // having an explicit AuthType. In this case AuthType should - // only override the AuthType for the L3 & L4 combination, - // not L4 in general. - // - // These need to be collected and only added if there is a - // superset key of newKey with an explicit auth type. In - // this case AuthType of the new L4-only entry was - // overridden by a more generic entry and 'max_specificity > - // 0' after the loop. - if k.Identity != 0 && k.Nexthdr == 0 && newKey.Identity == 0 && newKey.Nexthdr != 0 { - newKeyCpy := k - newKeyCpy.DestPort = newKey.DestPort - newKeyCpy.Nexthdr = newKey.Nexthdr - l3l4AuthEntry := NewMapStateEntry(k, v.DerivedFromRules, 0, newEntry.Listener, newEntry.priority, false, DefaultAuthType, v.AuthType) - l3l4AuthEntry.DerivedFromRules.MergeSorted(newEntry.DerivedFromRules) - l3l4State.allows[newKeyCpy] = l3l4AuthEntry - } - } - return true - }) - // Add collected L3/L4 entries if the auth type of the new entry was not - // overridden by a more generic entry. If it was overridden, the new L3L4 - // entries are not needed as the L4-only entry with an overridden AuthType - // will be matched before the L3-only entries in the datapath. - if maxSpecificity == 0 { - l3l4State.ForEach(func(k Key, v MapStateEntry) bool { - ms.addKeyWithChanges(k, v, changes) - // L3-only entries can be deleted incrementally so we need to track their - // effects on other entries so that those effects can be reverted when the - // identity is removed. - newEntry.AddDependent(k) - return true - }) - } - } else { - // New entry has an explicit auth type. - // Check if the new entry is the most specific superset of any other entry - // with the default auth type, and propagate the auth type from the new - // entry to such entries. - explicitSubsetKeys := make(Keys) - defaultSubsetKeys := make(map[Key]int) - - ms.ForEachAllow(func(k Key, v MapStateEntry) bool { - // Only consider the same Traffic direction - if newKey.TrafficDirection != k.TrafficDirection { - return true - } - - // Find out if 'newKey' is a superset of 'k' - if specificity := newKey.IsSuperSetOf(k); specificity > 0 { - if v.hasAuthType == ExplicitAuthType { - // store for later comparison - explicitSubsetKeys[k] = struct{}{} - } else { - defaultSubsetKeys[k] = specificity - } - } else if v.hasAuthType == DefaultAuthType { - // Check if a new L3L4 entry must be created due to L3-only - // 'newKey' with an explicit AuthType and an L4-only 'k' not - // having an explicit AuthType. In this case AuthType should - // only override the AuthType for the L3 & L4 combination, - // not L4 in general. - if newKey.Identity != 0 && newKey.Nexthdr == 0 && k.Identity == 0 && k.Nexthdr != 0 { - newKeyCpy := newKey - newKeyCpy.DestPort = k.DestPort - newKeyCpy.Nexthdr = k.Nexthdr - l3l4AuthEntry := NewMapStateEntry(newKey, newEntry.DerivedFromRules, 0, v.Listener, v.priority, false, DefaultAuthType, newEntry.AuthType) - l3l4AuthEntry.DerivedFromRules.MergeSorted(v.DerivedFromRules) - ms.addKeyWithChanges(newKeyCpy, l3l4AuthEntry, changes) - // L3-only entries can be deleted incrementally so we need to track their - // effects on other entries so that those effects can be reverted when the - // identity is removed. - newEntry.AddDependent(newKeyCpy) - } - } - - return true - }) - // Find out if this newKey is the most specific superset for all the subset keys with default auth type - Next: - for k, specificity := range defaultSubsetKeys { - for l := range explicitSubsetKeys { - if s := l.IsSuperSetOf(k); s > specificity { - // k has a more specific superset key than the newKey, skip - continue Next - } - } - // newKey is the most specific superset with an explicit auth type, - // propagate auth type from newEntry to the entry of k - v, _ := ms.Get(k) - v.AuthType = newEntry.AuthType - ms.addKeyWithChanges(k, v, changes) // Update the map value - } - } - } - ms.addKeyWithChanges(newKey, newEntry, changes) -} - -var visibilityDerivedFromLabels = labels.LabelArray{ - labels.NewLabel(LabelKeyPolicyDerivedFrom, LabelVisibilityAnnotation, labels.LabelSourceReserved), -} - -var visibilityDerivedFrom = labels.LabelArrayList{visibilityDerivedFromLabels} - -// insertIfNotExists only inserts `key=value` if `key` does not exist in keys already -// returns 'true' if 'key=entry' was added to 'keys' -func (changes *ChangeState) insertOldIfNotExists(key Key, entry MapStateEntry) bool { - if changes == nil || changes.Old == nil { - return false - } - if _, exists := changes.Old[key]; !exists { - // Only insert the old entry if the entry was not first added on this round of - // changes. - if _, added := changes.Adds[key]; !added { - // new containers to keep this entry separate from the one that may remain in 'keys' - entry.DerivedFromRules = slices.Clone(entry.DerivedFromRules) - entry.owners = maps.Clone(entry.owners) - entry.dependents = maps.Clone(entry.dependents) - - changes.Old[key] = entry - return true - } - } - return false -} - -// AddVisibilityKeys adjusts and expands PolicyMapState keys -// and values to redirect for visibility on the port of the visibility -// annotation while still denying traffic on this port for identities -// for which the traffic is denied. -// -// Datapath lookup order is, from highest to lowest precedence: -// 1. L3/L4 -// 2. L4-only (wildcard L3) -// 3. L3-only (wildcard L4) -// 4. Allow-all -// -// This means that the L4-only allow visibility key can only be added if there is an -// allow-all key, and all L3-only deny keys are expanded to L3/L4 keys. If no -// L4-only key is added then also the L3-only allow keys need to be expanded to -// L3/L4 keys for visibility redirection. In addition the existing L3/L4 and L4-only -// allow keys need to be redirected to the proxy port, if not already redirected. -// -// The above can be accomplished by: -// -// 1. Change existing L4-only ALLOW key on matching port that does not already -// redirect to redirect. -// - e.g., 0:80=allow,0 -> 0:80=allow, -// 2. If allow-all policy exists, add L4-only visibility redirect key if the L4-only -// key does not already exist. -// - e.g., 0:0=allow,0 -> add 0:80=allow, if 0:80 does not exist -// - this allows all traffic on port 80, but see step 5 below. -// 3. Change all L3/L4 ALLOW keys on matching port that do not already redirect to -// redirect. -// - e.g, :80=allow,0 -> :80=allow, -// 4. For each L3-only ALLOW key add the corresponding L3/L4 ALLOW redirect if no -// L3/L4 key already exists and no L4-only key already exists and one is not added. -// - e.g., :0=allow,0 -> add :80=allow, if :80 -// and 0:80 do not exist -// 5. If a new L4-only key was added: For each L3-only DENY key add the -// corresponding L3/L4 DENY key if no L3/L4 key already exists. -// - e.g., :0=deny,0 -> add :80=deny,0 if :80 does not exist -// -// With the above we only change/expand existing allow keys to redirect, and -// expand existing drop keys to also drop on the port of interest, if a new -// L4-only key allowing the port is added. -// -// 'adds' and 'oldValues' are updated with the changes made. 'adds' contains both the added and -// changed keys. 'oldValues' contains the old values for changed keys. This function does not -// delete any keys. -func (ms *mapState) AddVisibilityKeys(e PolicyOwner, redirectPort uint16, visMeta *VisibilityMetadata, changes ChangeState) { - direction := trafficdirection.Egress - if visMeta.Ingress { - direction = trafficdirection.Ingress - } - - allowAllKey := Key{ - TrafficDirection: direction.Uint8(), - } - key := Key{ - DestPort: visMeta.Port, - Nexthdr: uint8(visMeta.Proto), - TrafficDirection: direction.Uint8(), - } - - entry := NewMapStateEntry(nil, visibilityDerivedFrom, redirectPort, "", 0, false, DefaultAuthType, AuthTypeDisabled) - - _, haveAllowAllKey := ms.Get(allowAllKey) - l4Only, haveL4OnlyKey := ms.Get(key) - addL4OnlyKey := false - if haveL4OnlyKey && !l4Only.IsDeny && l4Only.ProxyPort == 0 { - // 1. Change existing L4-only ALLOW key on matching port that does not already - // redirect to redirect. - e.PolicyDebug(logrus.Fields{ - logfields.BPFMapKey: key, - logfields.BPFMapValue: entry, - }, "AddVisibilityKeys: Changing L4-only ALLOW key for visibility redirect") - ms.addKeyWithChanges(key, entry, changes) - } - if haveAllowAllKey && !haveL4OnlyKey { - // 2. If allow-all policy exists, add L4-only visibility redirect key if the L4-only - // key does not already exist. - e.PolicyDebug(logrus.Fields{ - logfields.BPFMapKey: key, - logfields.BPFMapValue: entry, - }, "AddVisibilityKeys: Adding L4-only ALLOW key for visibility redirect") - addL4OnlyKey = true - ms.addKeyWithChanges(key, entry, changes) - } - // - // Loop through all L3 keys in the traffic direction of the new key - // - ms.ForEach(func(k Key, v MapStateEntry) bool { - if k.TrafficDirection != key.TrafficDirection || k.Identity == 0 { - return true - } - if k.DestPort == key.DestPort && k.Nexthdr == key.Nexthdr { - // - // Same L4 - // - if !v.IsDeny && v.ProxyPort == 0 { - // 3. Change all L3/L4 ALLOW keys on matching port that do not - // already redirect to redirect. - v.ProxyPort = redirectPort - // redirect port is used as the default priority for tie-breaking - // purposes when two different selectors have conflicting - // redirects. Explicit listener references in the policy can specify - // a priority, but only the default is used for visibility policy, - // as visibility will be achieved by any of the redirects. - v.priority = redirectPort - v.Listener = "" - v.DerivedFromRules = visibilityDerivedFrom - e.PolicyDebug(logrus.Fields{ - logfields.BPFMapKey: k, - logfields.BPFMapValue: v, - }, "AddVisibilityKeys: Changing L3/L4 ALLOW key for visibility redirect") - ms.addKeyWithChanges(k, v, changes) - } - } else if k.DestPort == 0 && k.Nexthdr == 0 { - // - // Wildcarded L4, i.e., L3-only - // - k2 := k - k2.DestPort = key.DestPort - k2.Nexthdr = key.Nexthdr - if !v.IsDeny && !haveL4OnlyKey && !addL4OnlyKey { - // 4. For each L3-only ALLOW key add the corresponding L3/L4 - // ALLOW redirect if no L3/L4 key already exists and no - // L4-only key already exists and one is not added. - if _, ok := ms.Get(k2); !ok { - d2 := labels.LabelArrayList{visibilityDerivedFromLabels} - d2.MergeSorted(v.DerivedFromRules) - v2 := NewMapStateEntry(k, d2, redirectPort, "", 0, false, v.hasAuthType, v.AuthType) - e.PolicyDebug(logrus.Fields{ - logfields.BPFMapKey: k2, - logfields.BPFMapValue: v2, - }, "AddVisibilityKeys: Extending L3-only ALLOW key to L3/L4 key for visibility redirect") - ms.addKeyWithChanges(k2, v2, changes) - - // Mark the new entry as a dependent of 'v' - ms.addDependentOnEntry(k, v, k2, changes) - } - } else if addL4OnlyKey && v.IsDeny { - // 5. If a new L4-only key was added: For each L3-only DENY - // key add the corresponding L3/L4 DENY key if no L3/L4 - // key already exists. - if _, ok := ms.Get(k2); !ok { - v2 := NewMapStateEntry(k, v.DerivedFromRules, 0, "", 0, true, DefaultAuthType, AuthTypeDisabled) - e.PolicyDebug(logrus.Fields{ - logfields.BPFMapKey: k2, - logfields.BPFMapValue: v2, - }, "AddVisibilityKeys: Extending L3-only DENY key to L3/L4 key to deny a port with visibility annotation") - ms.addKeyWithChanges(k2, v2, changes) - - // Mark the new entry as a dependent of 'v' - ms.addDependentOnEntry(k, v, k2, changes) - } - } - } - - return true - }) -} - -// determineAllowLocalhostIngress determines whether communication should be allowed -// from the localhost. It inserts the Key corresponding to the localhost in -// the desiredPolicyKeys if the localhost is allowed to communicate with the -// endpoint. Authentication for localhost traffic is not required. -func (ms *mapState) determineAllowLocalhostIngress() { - if option.Config.AlwaysAllowLocalhost() { - derivedFrom := labels.LabelArrayList{ - labels.LabelArray{ - labels.NewLabel(LabelKeyPolicyDerivedFrom, LabelAllowLocalHostIngress, labels.LabelSourceReserved), - }, - } - es := NewMapStateEntry(nil, derivedFrom, 0, "", 0, false, ExplicitAuthType, AuthTypeDisabled) // Authentication never required for local host ingress - ms.denyPreferredInsert(localHostKey, es, nil, allFeatures) - } -} - -// allowAllIdentities translates all identities in selectorCache to their -// corresponding Keys in the specified direction (ingress, egress) which allows -// all at L3. -// Note that this is used when policy is not enforced, so authentication is explicitly not required. -func (ms *mapState) allowAllIdentities(ingress, egress bool) { - if ingress { - keyToAdd := Key{ - Identity: 0, - DestPort: 0, - Nexthdr: 0, - TrafficDirection: trafficdirection.Ingress.Uint8(), - } - derivedFrom := labels.LabelArrayList{ - labels.LabelArray{ - labels.NewLabel(LabelKeyPolicyDerivedFrom, LabelAllowAnyIngress, labels.LabelSourceReserved), - }, - } - ms.allows[keyToAdd] = NewMapStateEntry(nil, derivedFrom, 0, "", 0, false, ExplicitAuthType, AuthTypeDisabled) - } - if egress { - keyToAdd := Key{ - Identity: 0, - DestPort: 0, - Nexthdr: 0, - TrafficDirection: trafficdirection.Egress.Uint8(), - } - derivedFrom := labels.LabelArrayList{ - labels.LabelArray{ - labels.NewLabel(LabelKeyPolicyDerivedFrom, LabelAllowAnyEgress, labels.LabelSourceReserved), - }, - } - ms.allows[keyToAdd] = NewMapStateEntry(nil, derivedFrom, 0, "", 0, false, ExplicitAuthType, AuthTypeDisabled) - } -} - -func (ms *mapState) deniesL4(policyOwner PolicyOwner, l4 *L4Filter) bool { - port := uint16(l4.Port) - proto := uint8(l4.U8Proto) - - // resolve named port - if port == 0 && l4.PortName != "" { - port = policyOwner.GetNamedPort(l4.Ingress, l4.PortName, proto) - if port == 0 { - return true - } - } - - var dir uint8 - if l4.Ingress { - dir = trafficdirection.Ingress.Uint8() - } else { - dir = trafficdirection.Egress.Uint8() - } - anyKey := Key{ - Identity: 0, - DestPort: 0, - Nexthdr: 0, - TrafficDirection: dir, - } - // Are we explicitly denying all traffic? - v, ok := ms.Get(anyKey) - if ok && v.IsDeny { - return true - } - - // Are we explicitly denying this L4-only traffic? - anyKey.DestPort = port - anyKey.Nexthdr = proto - v, ok = ms.Get(anyKey) - if ok && v.IsDeny { - return true - } - - // The given L4 is not categorically denied. - // Traffic to/from a specific L3 on any of the selectors can still be denied. - return false -} - -func (ms *mapState) GetIdentities(log *logrus.Logger) (ingIdentities, egIdentities []int64) { - return ms.getIdentities(log, false) -} - -func (ms *mapState) GetDenyIdentities(log *logrus.Logger) (ingIdentities, egIdentities []int64) { - return ms.getIdentities(log, true) -} - -// GetIdentities returns the ingress and egress identities stored in the -// MapState. -func (ms *mapState) getIdentities(log *logrus.Logger, denied bool) (ingIdentities, egIdentities []int64) { - ms.ForEach(func(policyMapKey Key, policyMapValue MapStateEntry) bool { - if denied != policyMapValue.IsDeny { - return true - } - if policyMapKey.DestPort != 0 { - // If the port is non-zero, then the Key no longer only applies - // at L3. AllowedIngressIdentities and AllowedEgressIdentities - // contain sets of which identities (i.e., label-based L3 only) - // are allowed, so anything which contains L4-related policy should - // not be added to these sets. - return true - } - switch trafficdirection.TrafficDirection(policyMapKey.TrafficDirection) { - case trafficdirection.Ingress: - ingIdentities = append(ingIdentities, int64(policyMapKey.Identity)) - case trafficdirection.Egress: - egIdentities = append(egIdentities, int64(policyMapKey.Identity)) - default: - td := trafficdirection.TrafficDirection(policyMapKey.TrafficDirection) - log.WithField(logfields.TrafficDirection, td). - Errorf("Unexpected traffic direction present in policy map state for endpoint") - } - return true - }) - return ingIdentities, egIdentities -} - -// MapChanges collects updates to the endpoint policy on the -// granularity of individual mapstate key-value pairs for both adds -// and deletes. 'mutex' must be held for any access. -type MapChanges struct { - mutex lock.Mutex - changes []MapChange -} - -type MapChange struct { - Add bool // false deletes - Key Key - Value MapStateEntry -} - -// AccumulateMapChanges accumulates the given changes to the -// MapChanges. -// -// The caller is responsible for making sure the same identity is not -// present in both 'adds' and 'deletes'. -func (mc *MapChanges) AccumulateMapChanges(cs CachedSelector, adds, deletes []identity.NumericIdentity, key Key, value MapStateEntry) { - mc.mutex.Lock() - for _, id := range adds { - key.Identity = id.Uint32() - mc.changes = append(mc.changes, MapChange{Add: true, Key: key, Value: value}) - } - for _, id := range deletes { - key.Identity = id.Uint32() - mc.changes = append(mc.changes, MapChange{Add: false, Key: key, Value: value}) - } - mc.mutex.Unlock() -} - -// consumeMapChanges transfers the incremental changes from MapChanges to the caller, -// while applying the changes to PolicyMapState. -func (mc *MapChanges) consumeMapChanges(policyOwner PolicyOwner, policyMapState MapState, features policyFeatures, identities Identities) (adds, deletes Keys) { - mc.mutex.Lock() - changes := ChangeState{ - Adds: make(Keys, len(mc.changes)), - Deletes: make(Keys, len(mc.changes)), - } - var redirects map[string]uint16 - if policyOwner != nil { - redirects = policyOwner.GetRealizedRedirects() - } - - for i := range mc.changes { - if mc.changes[i].Add { - // Redirect entries for unrealized redirects come in with an invalid - // redirect port (65535), replace it with the actual proxy port number. - key := mc.changes[i].Key - entry := mc.changes[i].Value - if entry.ProxyPort == unrealizedRedirectPort { - var exists bool - proxyID := ProxyIDFromKey(uint16(policyOwner.GetID()), key, entry.Listener) - entry.ProxyPort, exists = redirects[proxyID] - if !exists { - log.WithFields(logrus.Fields{ - logfields.PolicyKey: key, - logfields.PolicyEntry: entry, - }).Warn("consumeMapChanges: Skipping entry for unrealized redirect") - continue - } - } - - // insert but do not allow non-redirect entries to overwrite a redirect entry, - // nor allow non-deny entries to overwrite deny entries. - // Collect the incremental changes to the overall state in 'mc.adds' and 'mc.deletes'. - policyMapState.denyPreferredInsertWithChanges(key, entry, identities, features, changes) - } else { - // Delete the contribution of this cs to the key and collect incremental changes - for cs := range mc.changes[i].Value.owners { // get the sole selector - policyMapState.deleteKeyWithChanges(mc.changes[i].Key, cs, changes) - } - } - } - mc.changes = nil - mc.mutex.Unlock() - return changes.Adds, changes.Deletes -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/policy.go b/vendor/github.com/cilium/cilium/pkg/policy/policy.go deleted file mode 100644 index b4ae208e4..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/policy.go +++ /dev/null @@ -1,112 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package policy - -import ( - "io" - stdlog "log" - "strconv" - "strings" - - "github.com/cilium/cilium/api/v1/models" - "github.com/cilium/cilium/pkg/labels" -) - -type Tracing int - -const ( - TRACE_DISABLED Tracing = iota - TRACE_ENABLED - TRACE_VERBOSE -) - -// TraceEnabled returns true if the SearchContext requests tracing. -func (s *SearchContext) TraceEnabled() bool { - return s.Trace != TRACE_DISABLED -} - -// PolicyTrace logs the given message into the SearchContext logger only if -// TRACE_ENABLED or TRACE_VERBOSE is enabled in the receiver's SearchContext. -func (s *SearchContext) PolicyTrace(format string, a ...interface{}) { - if s.TraceEnabled() { - log.Debugf(format, a...) - if s.Logging != nil { - format = "%-" + s.CallDepth() + "s" + format - a = append([]interface{}{""}, a...) - s.Logging.Printf(format, a...) - } - } -} - -// PolicyTraceVerbose logs the given message into the SearchContext logger only -// if TRACE_VERBOSE is enabled in the receiver's SearchContext. -func (s *SearchContext) PolicyTraceVerbose(format string, a ...interface{}) { - switch s.Trace { - case TRACE_VERBOSE: - log.Debugf(format, a...) - if s.Logging != nil { - s.Logging.Printf(format, a...) - } - } -} - -// SearchContext defines the context while evaluating policy -type SearchContext struct { - Trace Tracing - Depth int - Logging *stdlog.Logger - From labels.LabelArray - To labels.LabelArray - DPorts []*models.Port - // rulesSelect specifies whether or not to check whether a rule which is - // being analyzed using this SearchContext matches either From or To. - // This is used to avoid using EndpointSelector.Matches() if possible, - // since it is costly in terms of performance. - rulesSelect bool -} - -func (s *SearchContext) String() string { - from := make([]string, 0, len(s.From)) - to := make([]string, 0, len(s.To)) - dports := make([]string, 0, len(s.DPorts)) - for _, fromLabel := range s.From { - from = append(from, fromLabel.String()) - } - for _, toLabel := range s.To { - to = append(to, toLabel.String()) - } - // We should avoid to use `fmt.Sprintf()` since - // it is well-known for not being opimal in terms of - // CPU and memory allocations. - // See https://github.com/cilium/cilium/issues/19571 - for _, dport := range s.DPorts { - dportStr := dport.Name - if dportStr == "" { - dportStr = strconv.FormatUint(uint64(dport.Port), 10) - } - dports = append(dports, dportStr+"/"+dport.Protocol) - } - fromStr := strings.Join(from, ", ") - toStr := strings.Join(to, ", ") - if len(dports) != 0 { - dportStr := strings.Join(dports, ", ") - return "From: [" + fromStr + "] => To: [" + toStr + "] Ports: [" + dportStr + "]" - } - return "From: [" + fromStr + "] => To: [" + toStr + "]" -} - -func (s *SearchContext) CallDepth() string { - return strconv.Itoa(s.Depth * 2) -} - -// WithLogger returns a shallow copy of the received SearchContext with the -// logging set to write to 'log'. -func (s *SearchContext) WithLogger(log io.Writer) *SearchContext { - result := *s - result.Logging = stdlog.New(log, "", 0) - if result.Trace == TRACE_DISABLED { - result.Trace = TRACE_ENABLED - } - return &result -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/proxyid.go b/vendor/github.com/cilium/cilium/pkg/policy/proxyid.go deleted file mode 100644 index f6a347dc1..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/proxyid.go +++ /dev/null @@ -1,88 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package policy - -import ( - "fmt" - "strconv" - "strings" - - "github.com/cilium/cilium/pkg/policy/trafficdirection" - "github.com/cilium/cilium/pkg/u8proto" -) - -// ProxyStatsKey returns a key for endpoint's proxy stats, which may aggregate stats from multiple -// proxy redirects on the same port. -func ProxyStatsKey(ingress bool, protocol string, port, proxyPort uint16) string { - direction := "egress" - if ingress { - direction = "ingress" - } - portStr := strconv.FormatUint(uint64(port), 10) - proxyPortStr := strconv.FormatUint(uint64(proxyPort), 10) - - var str strings.Builder - str.Grow(len(direction) + 1 + len(protocol) + 1 + len(portStr) + 1 + len(proxyPortStr)) - str.WriteString(direction) - str.WriteRune(':') - str.WriteString(protocol) - str.WriteRune(':') - str.WriteString(portStr) - str.WriteRune(':') - str.WriteString(proxyPortStr) - - return str.String() -} - -// ProxyID returns a unique string to identify a proxy mapping. -func ProxyID(endpointID uint16, ingress bool, protocol string, port uint16, listener string) string { - direction := "egress" - if ingress { - direction = "ingress" - } - epStr := strconv.FormatUint(uint64(endpointID), 10) - portStr := strconv.FormatUint(uint64(port), 10) - - var str strings.Builder - str.Grow(len(epStr) + 1 + len(direction) + 1 + len(protocol) + 1 + len(portStr) + 1 + len(listener)) - str.WriteString(epStr) - str.WriteRune(':') - str.WriteString(direction) - str.WriteRune(':') - str.WriteString(protocol) - str.WriteRune(':') - str.WriteString(portStr) - str.WriteRune(':') - str.WriteString(listener) - - return str.String() -} - -// ProxyIDFromKey returns a unique string to identify a proxy mapping. -func ProxyIDFromKey(endpointID uint16, key Key, listener string) string { - return ProxyID(endpointID, key.TrafficDirection == trafficdirection.Ingress.Uint8(), u8proto.U8proto(key.Nexthdr).String(), key.DestPort, listener) -} - -// ParseProxyID parses a proxy ID returned by ProxyID and returns its components. -func ParseProxyID(proxyID string) (endpointID uint16, ingress bool, protocol string, port uint16, listener string, err error) { - comps := strings.Split(proxyID, ":") - if len(comps) != 5 { - err = fmt.Errorf("invalid proxy ID structure: %s", proxyID) - return - } - epID, err := strconv.ParseUint(comps[0], 10, 16) - if err != nil { - return - } - endpointID = uint16(epID) - ingress = comps[1] == "ingress" - protocol = comps[2] - l4port, err := strconv.ParseUint(comps[3], 10, 16) - if err != nil { - return - } - port = uint16(l4port) - listener = comps[4] - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/repository.go b/vendor/github.com/cilium/cilium/pkg/policy/repository.go deleted file mode 100644 index 5b901c0ff..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/repository.go +++ /dev/null @@ -1,844 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package policy - -import ( - "context" - "encoding/json" - "fmt" - "sync" - "sync/atomic" - - cilium "github.com/cilium/proxy/go/cilium/api" - - "github.com/cilium/cilium/api/v1/models" - "github.com/cilium/cilium/pkg/crypto/certificatemanager" - "github.com/cilium/cilium/pkg/eventqueue" - "github.com/cilium/cilium/pkg/identity" - "github.com/cilium/cilium/pkg/identity/cache" - k8sConst "github.com/cilium/cilium/pkg/k8s/apis/cilium.io" - "github.com/cilium/cilium/pkg/labels" - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/metrics" - "github.com/cilium/cilium/pkg/option" - "github.com/cilium/cilium/pkg/policy/api" -) - -// PolicyContext is an interface policy resolution functions use to access the Repository. -// This way testing code can run without mocking a full Repository. -type PolicyContext interface { - // return the namespace in which the policy rule is being resolved - GetNamespace() string - - // return the SelectorCache - GetSelectorCache() *SelectorCache - - // GetTLSContext resolves the given 'api.TLSContext' into CA - // certs and the public and private keys, using secrets from - // k8s or from the local file system. - GetTLSContext(tls *api.TLSContext) (ca, public, private string, err error) - - // GetEnvoyHTTPRules translates the given 'api.L7Rules' into - // the protobuf representation the Envoy can consume. The bool - // return parameter tells whether the rule enforcement can - // be short-circuited upon the first allowing rule. This is - // false if any of the rules has side-effects, requiring all - // such rules being evaluated. - GetEnvoyHTTPRules(l7Rules *api.L7Rules) (*cilium.HttpNetworkPolicyRules, bool) - - // IsDeny returns true if the policy computation should be done for the - // policy deny case. This function returns different values depending on the - // code path as it can be changed during the policy calculation. - IsDeny() bool - - // SetDeny sets the Deny field of the PolicyContext and returns the old - // value stored. - SetDeny(newValue bool) (oldValue bool) -} - -type policyContext struct { - repo *Repository - ns string - // isDeny this field is set to true if the given policy computation should - // be done for the policy deny. - isDeny bool -} - -// GetNamespace() returns the namespace for the policy rule being resolved -func (p *policyContext) GetNamespace() string { - return p.ns -} - -// GetSelectorCache() returns the selector cache used by the Repository -func (p *policyContext) GetSelectorCache() *SelectorCache { - return p.repo.GetSelectorCache() -} - -// GetTLSContext() returns data for TLS Context via a CertificateManager -func (p *policyContext) GetTLSContext(tls *api.TLSContext) (ca, public, private string, err error) { - if p.repo.certManager == nil { - return "", "", "", fmt.Errorf("No Certificate Manager set on Policy Repository") - } - return p.repo.certManager.GetTLSContext(context.TODO(), tls, p.ns) -} - -func (p *policyContext) GetEnvoyHTTPRules(l7Rules *api.L7Rules) (*cilium.HttpNetworkPolicyRules, bool) { - return p.repo.GetEnvoyHTTPRules(l7Rules, p.ns) -} - -// IsDeny returns true if the policy computation should be done for the -// policy deny case. This function return different values depending on the -// code path as it can be changed during the policy calculation. -func (p *policyContext) IsDeny() bool { - return p.isDeny -} - -// SetDeny sets the Deny field of the PolicyContext and returns the old -// value stored. -func (p *policyContext) SetDeny(deny bool) bool { - oldDeny := p.isDeny - p.isDeny = deny - return oldDeny -} - -// Repository is a list of policy rules which in combination form the security -// policy. A policy repository can be -type Repository struct { - // Mutex protects the whole policy tree - Mutex lock.RWMutex - rules ruleSlice - - // rulesIndexByK8sUID indexes the rules by k8s UID. - rulesIndexByK8sUID map[string]*rule - - // revision is the revision of the policy repository. It will be - // incremented whenever the policy repository is changed. - // Always positive (>0). - revision atomic.Uint64 - - // RepositoryChangeQueue is a queue which serializes changes to the policy - // repository. - RepositoryChangeQueue *eventqueue.EventQueue - - // RuleReactionQueue is a queue which serializes the resultant events that - // need to occur after updating the state of the policy repository. This - // can include queueing endpoint regenerations, policy revision increments - // for endpoints, etc. - RuleReactionQueue *eventqueue.EventQueue - - // SelectorCache tracks the selectors used in the policies - // resolved from the repository. - selectorCache *SelectorCache - - // PolicyCache tracks the selector policies created from this repo - policyCache *PolicyCache - - certManager certificatemanager.CertificateManager - secretManager certificatemanager.SecretManager - - getEnvoyHTTPRules func(certificatemanager.SecretManager, *api.L7Rules, string) (*cilium.HttpNetworkPolicyRules, bool) -} - -// GetSelectorCache() returns the selector cache used by the Repository -func (p *Repository) GetSelectorCache() *SelectorCache { - return p.selectorCache -} - -// GetAuthTypes returns the AuthTypes required by the policy between the localID and remoteID -func (p *Repository) GetAuthTypes(localID, remoteID identity.NumericIdentity) AuthTypes { - return p.policyCache.GetAuthTypes(localID, remoteID) -} - -func (p *Repository) SetEnvoyRulesFunc(f func(certificatemanager.SecretManager, *api.L7Rules, string) (*cilium.HttpNetworkPolicyRules, bool)) { - p.getEnvoyHTTPRules = f -} - -func (p *Repository) GetEnvoyHTTPRules(l7Rules *api.L7Rules, ns string) (*cilium.HttpNetworkPolicyRules, bool) { - if p.getEnvoyHTTPRules == nil { - return nil, true - } - return p.getEnvoyHTTPRules(p.secretManager, l7Rules, ns) -} - -// GetPolicyCache() returns the policy cache used by the Repository -func (p *Repository) GetPolicyCache() *PolicyCache { - return p.policyCache -} - -// NewPolicyRepository creates a new policy repository. -func NewPolicyRepository( - idAllocator cache.IdentityAllocator, - idCache cache.IdentityCache, - certManager certificatemanager.CertificateManager, - secretManager certificatemanager.SecretManager, -) *Repository { - repo := NewStoppedPolicyRepository(idAllocator, idCache, certManager, secretManager) - repo.Start() - return repo -} - -// NewStoppedPolicyRepository creates a new policy repository without starting -// queues. -// -// Qeues must be allocated via [Repository.Start]. The function serves to -// satisfy hive invariants. -func NewStoppedPolicyRepository( - idAllocator cache.IdentityAllocator, - idCache cache.IdentityCache, - certManager certificatemanager.CertificateManager, - secretManager certificatemanager.SecretManager, -) *Repository { - selectorCache := NewSelectorCache(idAllocator, idCache) - repo := &Repository{ - rulesIndexByK8sUID: map[string]*rule{}, - selectorCache: selectorCache, - certManager: certManager, - secretManager: secretManager, - } - repo.revision.Store(1) - repo.policyCache = NewPolicyCache(repo, true) - return repo -} - -// traceState is an internal structure used to collect information -// while determining policy decision -type traceState struct { - // selectedRules is the number of rules with matching EndpointSelector - selectedRules int - - // matchedRules is the number of rules that have allowed traffic - matchedRules int - - // matchedDenyRules is the number of rules that have denied traffic - matchedDenyRules int - - // constrainedRules counts how many "FromRequires" constraints are - // unsatisfied - constrainedRules int - - // ruleID is the rule ID currently being evaluated - ruleID int -} - -func (state *traceState) trace(rules int, ctx *SearchContext) { - ctx.PolicyTrace("%d/%d rules selected\n", state.selectedRules, rules) - if state.constrainedRules > 0 { - ctx.PolicyTrace("Found unsatisfied FromRequires constraint\n") - } else { - if state.matchedRules > 0 { - ctx.PolicyTrace("Found allow rule\n") - } else { - ctx.PolicyTrace("Found no allow rule\n") - } - if state.matchedDenyRules > 0 { - ctx.PolicyTrace("Found deny rule\n") - } else { - ctx.PolicyTrace("Found no deny rule\n") - } - } -} - -// Start allocates and starts various queues used by the Repository. -// -// Must only be called if using [NewStoppedPolicyRepository] -func (p *Repository) Start() { - p.RepositoryChangeQueue = eventqueue.NewEventQueueBuffered("repository-change-queue", option.Config.PolicyQueueSize) - p.RuleReactionQueue = eventqueue.NewEventQueueBuffered("repository-reaction-queue", option.Config.PolicyQueueSize) - p.RepositoryChangeQueue.Run() - p.RuleReactionQueue.Run() -} - -// ResolveL4IngressPolicy resolves the L4 ingress policy for a set of endpoints -// by searching the policy repository for `PortRule` rules that are attached to -// a `Rule` where the EndpointSelector matches `ctx.To`. `ctx.From` takes no effect and -// is ignored in the search. If multiple `PortRule` rules are found, all rules -// are merged together. If rules contains overlapping port definitions, the first -// rule found in the repository takes precedence. -// -// TODO: Coalesce l7 rules? -// -// Caller must release resources by calling Detach() on the returned map! -// -// NOTE: This is only called from unit tests, but from multiple packages. -func (p *Repository) ResolveL4IngressPolicy(ctx *SearchContext) (L4PolicyMap, error) { - policyCtx := policyContext{ - repo: p, - ns: ctx.To.Get(labels.LabelSourceK8sKeyPrefix + k8sConst.PodNamespaceLabel), - } - result, err := p.rules.resolveL4IngressPolicy(&policyCtx, ctx) - if err != nil { - return nil, err - } - - return result, nil -} - -// ResolveL4EgressPolicy resolves the L4 egress policy for a set of endpoints -// by searching the policy repository for `PortRule` rules that are attached to -// a `Rule` where the EndpointSelector matches `ctx.From`. `ctx.To` takes no effect and -// is ignored in the search. If multiple `PortRule` rules are found, all rules -// are merged together. If rules contains overlapping port definitions, the first -// rule found in the repository takes precedence. -// -// Caller must release resources by calling Detach() on the returned map! -// -// NOTE: This is only called from unit tests, but from multiple packages. -func (p *Repository) ResolveL4EgressPolicy(ctx *SearchContext) (L4PolicyMap, error) { - policyCtx := policyContext{ - repo: p, - ns: ctx.From.Get(labels.LabelSourceK8sKeyPrefix + k8sConst.PodNamespaceLabel), - } - result, err := p.rules.resolveL4EgressPolicy(&policyCtx, ctx) - - if err != nil { - return nil, err - } - - return result, nil -} - -// AllowsIngressRLocked evaluates the policy repository for the provided search -// context and returns the verdict for ingress. If no matching policy allows for -// the connection, the request will be denied. The policy repository mutex must -// be held. -// -// NOTE: This is only called from unit tests, but from multiple packages. -func (p *Repository) AllowsIngressRLocked(ctx *SearchContext) api.Decision { - // Lack of DPorts in the SearchContext means L3-only search - if len(ctx.DPorts) == 0 { - newCtx := *ctx - newCtx.DPorts = []*models.Port{{ - Port: 0, - Protocol: models.PortProtocolANY, - }} - ctx = &newCtx - } - - ctx.PolicyTrace("Tracing %s", ctx.String()) - ingressPolicy, err := p.ResolveL4IngressPolicy(ctx) - if err != nil { - log.WithError(err).Warn("Evaluation error while resolving L4 ingress policy") - } - - verdict := api.Denied - if err == nil && len(ingressPolicy) > 0 { - verdict = ingressPolicy.IngressCoversContext(ctx) - } - - ctx.PolicyTrace("Ingress verdict: %s", verdict.String()) - ingressPolicy.Detach(p.GetSelectorCache()) - - return verdict -} - -// AllowsEgressRLocked evaluates the policy repository for the provided search -// context and returns the verdict. If no matching policy allows for the -// connection, the request will be denied. The policy repository mutex must be -// held. -// -// NOTE: This is only called from unit tests, but from multiple packages. -func (p *Repository) AllowsEgressRLocked(ctx *SearchContext) api.Decision { - // Lack of DPorts in the SearchContext means L3-only search - if len(ctx.DPorts) == 0 { - newCtx := *ctx - newCtx.DPorts = []*models.Port{{ - Port: 0, - Protocol: models.PortProtocolANY, - }} - ctx = &newCtx - } - - ctx.PolicyTrace("Tracing %s\n", ctx.String()) - egressPolicy, err := p.ResolveL4EgressPolicy(ctx) - if err != nil { - log.WithError(err).Warn("Evaluation error while resolving L4 egress policy") - } - verdict := api.Denied - if err == nil && len(egressPolicy) > 0 { - verdict = egressPolicy.EgressCoversContext(ctx) - } - - ctx.PolicyTrace("Egress verdict: %s", verdict.String()) - egressPolicy.Detach(p.GetSelectorCache()) - return verdict -} - -// SearchRLocked searches the policy repository for rules which match the -// specified labels and will return an array of all rules which matched. -func (p *Repository) SearchRLocked(lbls labels.LabelArray) api.Rules { - result := api.Rules{} - - if uid := lbls.Get(labels.LabelSourceK8sKeyPrefix + k8sConst.PolicyLabelUID); uid != "" { - r, ok := p.rulesIndexByK8sUID[uid] - if ok { - result = append(result, &r.Rule) - } - return result - } - for _, r := range p.rules { - if r.Labels.Contains(lbls) { - result = append(result, &r.Rule) - } - } - - return result -} - -// Add inserts a rule into the policy repository -// This is just a helper function for unit testing. -// TODO: this should be in a test_helpers.go file or something similar -// so we can clearly delineate what helpers are for testing. -// NOTE: This is only called from unit tests, but from multiple packages. -func (p *Repository) Add(r api.Rule) (uint64, map[uint16]struct{}, error) { - p.Mutex.Lock() - defer p.Mutex.Unlock() - - if err := r.Sanitize(); err != nil { - return p.GetRevision(), nil, err - } - - newList := make([]*api.Rule, 1) - newList[0] = &r - _, rev := p.AddListLocked(newList) - return rev, map[uint16]struct{}{}, nil -} - -// AddListLocked inserts a rule into the policy repository with the repository already locked -// Expects that the entire rule list has already been sanitized. -func (p *Repository) AddListLocked(rules api.Rules) (ruleSlice, uint64) { - - newList := make(ruleSlice, len(rules)) - for i := range rules { - newRule := &rule{ - Rule: *rules[i], - metadata: newRuleMetadata(), - } - newList[i] = newRule - if uid := rules[i].Labels.Get(labels.LabelSourceK8sKeyPrefix + k8sConst.PolicyLabelUID); uid != "" { - p.rulesIndexByK8sUID[uid] = newRule - } - } - - p.rules = append(p.rules, newList...) - p.BumpRevision() - metrics.Policy.Add(float64(len(newList))) - return newList, p.GetRevision() -} - -// removeIdentityFromRuleCaches removes the identity from the selector cache -// in each rule in the repository. -// -// Returns a sync.WaitGroup that blocks until the policy operation is complete. -// The repository read lock must be held until the waitgroup is complete. -func (p *Repository) removeIdentityFromRuleCaches(identity *identity.Identity) *sync.WaitGroup { - var wg sync.WaitGroup - wg.Add(len(p.rules)) - for _, r := range p.rules { - go func(rr *rule, wgg *sync.WaitGroup) { - rr.metadata.delete(identity) - wgg.Done() - }(r, &wg) - } - return &wg -} - -// LocalEndpointIdentityAdded handles local identity add events. -func (p *Repository) LocalEndpointIdentityAdded(*identity.Identity) { - // no-op for now. -} - -// LocalEndpointIdentityRemoved handles local identity removal events to -// remove references from rules in the repository to the specified identity. -func (p *Repository) LocalEndpointIdentityRemoved(identity *identity.Identity) { - go func() { - scopedLog := log.WithField(logfields.Identity, identity) - scopedLog.Debug("Removing identity references from policy cache") - p.Mutex.RLock() - wg := p.removeIdentityFromRuleCaches(identity) - wg.Wait() - p.Mutex.RUnlock() - scopedLog.Debug("Finished cleaning policy cache") - }() -} - -// AddList inserts a rule into the policy repository. It is used for -// unit-testing purposes only. -func (p *Repository) AddList(rules api.Rules) (ruleSlice, uint64) { - for i := range rules { - // FIXME(GH-31162): Many unit tests provide invalid rules - _ = rules[i].Sanitize() - } - p.Mutex.Lock() - defer p.Mutex.Unlock() - return p.AddListLocked(rules) -} - -// Iterate iterates the policy repository, calling f for each rule. It is safe -// to execute Iterate concurrently. -func (p *Repository) Iterate(f func(rule *api.Rule)) { - p.Mutex.RWMutex.Lock() - defer p.Mutex.RWMutex.Unlock() - for _, r := range p.rules { - f(&r.Rule) - } -} - -// UpdateRulesEndpointsCaches updates the caches within each rule in r that -// specify whether the rule selects the endpoints in eps. If any rule matches -// the endpoints, it is added to the provided IDSet, and removed from the -// provided EndpointSet. The provided WaitGroup is signaled for a given endpoint -// when it is finished being processed. -func (r ruleSlice) UpdateRulesEndpointsCaches(endpointsToBumpRevision, endpointsToRegenerate *EndpointSet, policySelectionWG *sync.WaitGroup) { - endpointsToBumpRevision.ForEachGo(policySelectionWG, func(epp Endpoint) { - endpointSelected, err := r.updateEndpointsCaches(epp) - if endpointSelected { - endpointsToRegenerate.Insert(epp) - } - // If we could not evaluate the rules against the current endpoint, or - // the endpoint is selected by the rules, remove it from the set of - // endpoints to bump the revision. If the error is non-nil, the - // endpoint is no longer in either set (endpointsToBumpRevision or - // endpointsToRegenerate, as we could not determine what to do for the - // endpoint). This is usually the case when the endpoint is no longer - // alive (i.e., it has been marked to be deleted). - if endpointSelected || err != nil { - if err != nil { - log.WithError(err).Debug("could not determine whether endpoint was selected by rule") - } - endpointsToBumpRevision.Delete(epp) - } - }) -} - -// DeleteByLabelsLocked deletes all rules in the policy repository which -// contain the specified labels. Returns the revision of the policy repository -// after deleting the rules, as well as now many rules were deleted. -func (p *Repository) DeleteByLabelsLocked(lbls labels.LabelArray) (ruleSlice, uint64, int) { - - deleted := 0 - new := p.rules[:0] - deletedRules := ruleSlice{} - - for _, r := range p.rules { - if !r.Labels.Contains(lbls) { - new = append(new, r) - } else { - deletedRules = append(deletedRules, r) - deleted++ - } - } - - if deleted > 0 { - p.BumpRevision() - p.rules = new - if uid := lbls.Get(labels.LabelSourceK8sKeyPrefix + k8sConst.PolicyLabelUID); uid != "" { - delete(p.rulesIndexByK8sUID, uid) - } - metrics.Policy.Sub(float64(deleted)) - } - - return deletedRules, p.GetRevision(), deleted -} - -// DeleteByLabels deletes all rules in the policy repository which contain the -// specified labels -func (p *Repository) DeleteByLabels(lbls labels.LabelArray) (uint64, int) { - p.Mutex.Lock() - defer p.Mutex.Unlock() - _, rev, numDeleted := p.DeleteByLabelsLocked(lbls) - return rev, numDeleted -} - -// JSONMarshalRules returns a slice of policy rules as string in JSON -// representation -func JSONMarshalRules(rules api.Rules) string { - b, err := json.MarshalIndent(rules, "", " ") - if err != nil { - return err.Error() - } - return string(b) -} - -// GetJSON returns all rules of the policy repository as string in JSON -// representation -func (p *Repository) GetJSON() string { - p.Mutex.RLock() - defer p.Mutex.RUnlock() - - result := api.Rules{} - for _, r := range p.rules { - result = append(result, &r.Rule) - } - - return JSONMarshalRules(result) -} - -// GetRulesMatching returns whether any of the rules in a repository contain a -// rule with labels matching the labels in the provided LabelArray. -// -// Must be called with p.Mutex held -func (p *Repository) GetRulesMatching(lbls labels.LabelArray) (ingressMatch bool, egressMatch bool) { - ingressMatch = false - egressMatch = false - for _, r := range p.rules { - rulesMatch := r.getSelector().Matches(lbls) - if rulesMatch { - if len(r.Ingress) > 0 { - ingressMatch = true - } - if len(r.IngressDeny) > 0 { - ingressMatch = true - } - if len(r.Egress) > 0 { - egressMatch = true - } - if len(r.EgressDeny) > 0 { - egressMatch = true - } - } - - if ingressMatch && egressMatch { - return - } - } - return -} - -// NumRules returns the amount of rules in the policy repository. -// -// Must be called with p.Mutex held -func (p *Repository) NumRules() int { - return len(p.rules) -} - -// GetRevision returns the revision of the policy repository -func (p *Repository) GetRevision() uint64 { - return p.revision.Load() -} - -// Empty returns 'true' if repository has no rules, 'false' otherwise. -// -// Must be called without p.Mutex held -func (p *Repository) Empty() bool { - p.Mutex.Lock() - defer p.Mutex.Unlock() - return p.NumRules() == 0 -} - -// BumpRevision allows forcing policy regeneration -func (p *Repository) BumpRevision() { - metrics.PolicyRevision.Inc() - p.revision.Add(1) -} - -// GetRulesList returns the current policy -func (p *Repository) GetRulesList() *models.Policy { - p.Mutex.RLock() - defer p.Mutex.RUnlock() - - lbls := labels.ParseSelectLabelArrayFromArray([]string{}) - ruleList := p.SearchRLocked(lbls) - - return &models.Policy{ - Revision: int64(p.GetRevision()), - Policy: JSONMarshalRules(ruleList), - } -} - -// resolvePolicyLocked returns the selectorPolicy for the provided -// identity from the set of rules in the repository. If the policy -// cannot be generated due to conflicts at L4 or L7, returns an error. -// -// Must be performed while holding the Repository lock. -func (p *Repository) resolvePolicyLocked(securityIdentity *identity.Identity) (*selectorPolicy, error) { - // First obtain whether policy applies in both traffic directions, as well - // as list of rules which actually select this endpoint. This allows us - // to not have to iterate through the entire rule list multiple times and - // perform the matching decision again when computing policy for each - // protocol layer, which is quite costly in terms of performance. - ingressEnabled, egressEnabled, - matchingRules := - p.computePolicyEnforcementAndRules(securityIdentity) - - calculatedPolicy := &selectorPolicy{ - Revision: p.GetRevision(), - SelectorCache: p.GetSelectorCache(), - L4Policy: NewL4Policy(p.GetRevision()), - IngressPolicyEnabled: ingressEnabled, - EgressPolicyEnabled: egressEnabled, - } - - lbls := securityIdentity.LabelArray - ingressCtx := SearchContext{ - To: lbls, - rulesSelect: true, - } - - egressCtx := SearchContext{ - From: lbls, - rulesSelect: true, - } - - if option.Config.TracingEnabled() { - ingressCtx.Trace = TRACE_ENABLED - egressCtx.Trace = TRACE_ENABLED - } - - policyCtx := policyContext{ - repo: p, - ns: lbls.Get(labels.LabelSourceK8sKeyPrefix + k8sConst.PodNamespaceLabel), - } - - if ingressEnabled { - newL4IngressPolicy, err := matchingRules.resolveL4IngressPolicy(&policyCtx, &ingressCtx) - if err != nil { - return nil, err - } - calculatedPolicy.L4Policy.Ingress.PortRules = newL4IngressPolicy - } - - if egressEnabled { - newL4EgressPolicy, err := matchingRules.resolveL4EgressPolicy(&policyCtx, &egressCtx) - if err != nil { - return nil, err - } - calculatedPolicy.L4Policy.Egress.PortRules = newL4EgressPolicy - } - - // Make the calculated policy ready for incremental updates - calculatedPolicy.Attach(&policyCtx) - - return calculatedPolicy, nil -} - -// computePolicyEnforcementAndRules returns whether policy applies at ingress or ingress -// for the given security identity, as well as a list of any rules which select -// the set of labels of the given security identity. -// -// Must be called with repo mutex held for reading. -func (p *Repository) computePolicyEnforcementAndRules(securityIdentity *identity.Identity) ( - ingress, egress bool, - matchingRules ruleSlice, -) { - lbls := securityIdentity.LabelArray - - // Check if policy enforcement should be enabled at the daemon level. - if lbls.Has(labels.IDNameHost) && !option.Config.EnableHostFirewall { - return false, false, nil - } - - policyMode := GetPolicyEnabled() - // If policy enforcement isn't enabled, we do not enable policy - // enforcement for the endpoint. We don't care about returning any - // rules that match. - if policyMode == option.NeverEnforce { - return false, false, nil - } - - matchingRules = []*rule{} - for _, r := range p.rules { - if r.matches(securityIdentity) { - matchingRules = append(matchingRules, r) - } - } - - // If policy enforcement is enabled for the daemon, then it has to be - // enabled for the endpoint. - // If the endpoint has the reserved:init label, i.e. if it has not yet - // received any labels, always enforce policy (default deny). - if policyMode == option.AlwaysEnforce || lbls.Has(labels.IDNameInit) { - return true, true, matchingRules - } - - // Determine the default policy for each direction. - // - // By default, endpoints have no policy and all traffic is allowed. - // If any rules select the endpoint, then the endpoint switches to a - // default-deny mode (same as traffic being enabled), per-direction. - // - // Rules, however, can optionally be configure to not enable default deny mode. - // If no rules enable default-deny, then all traffic is allowed except that explicitly - // denied by a Deny rule. - // - // There are three possible cases _per direction_: - // 1: No rules are present, - // 2: At least one default-deny rule is present. Then, policy is enabled - // 3: Only non-default-deny rules are present. Then, policy is enabled, but we must insert - // an additional allow-all rule. We must do this, even if all traffic is allowed, because - // rules may have additional effects such as enabling L7 proxy. - hasIngressDefaultDeny := false - hasEgressDefaultDeny := false - for _, r := range matchingRules { - if !ingress || !hasIngressDefaultDeny { // short-circuit len() - if len(r.Ingress) > 0 || len(r.IngressDeny) > 0 { - ingress = true - if *r.EnableDefaultDeny.Ingress { - hasIngressDefaultDeny = true - } - } - } - - if !egress || !hasEgressDefaultDeny { // short-circuit len() - if len(r.Egress) > 0 || len(r.EgressDeny) > 0 { - egress = true - if *r.EnableDefaultDeny.Egress { - hasEgressDefaultDeny = true - } - } - } - if ingress && egress && hasIngressDefaultDeny && hasEgressDefaultDeny { - break - } - } - - // If there only ingress default-allow rules, then insert a wildcard rule - if !hasIngressDefaultDeny && ingress { - log.WithField(logfields.Identity, securityIdentity).Info("Only default-allow policies, synthesizing ingress wildcard-allow rule") - matchingRules = append(matchingRules, wildcardRule(securityIdentity.LabelArray, true /*ingress*/)) - } - - // Same for egress -- synthesize a wildcard rule - if !hasEgressDefaultDeny && egress { - log.WithField(logfields.Identity, securityIdentity).Info("Only default-allow policies, synthesizing egress wildcard-allow rule") - matchingRules = append(matchingRules, wildcardRule(securityIdentity.LabelArray, false /*egress*/)) - } - - return -} - -// wildcardRule generates a wildcard rule that only selects the given identity. -func wildcardRule(lbls labels.LabelArray, ingress bool) *rule { - r := &rule{ - metadata: newRuleMetadata(), - } - - if ingress { - r.Ingress = []api.IngressRule{ - { - IngressCommonRule: api.IngressCommonRule{ - FromEntities: []api.Entity{api.EntityAll}, - }, - }, - } - } else { - r.Egress = []api.EgressRule{ - { - EgressCommonRule: api.EgressCommonRule{ - ToEntities: []api.Entity{api.EntityAll}, - }, - }, - } - } - - es := api.NewESFromLabels(lbls...) - if lbls.Has(labels.IDNameHost) { - r.NodeSelector = es - } else { - r.EndpointSelector = es - } - _ = r.Sanitize() - - return r -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/resolve.go b/vendor/github.com/cilium/cilium/pkg/policy/resolve.go deleted file mode 100644 index a939a652e..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/resolve.go +++ /dev/null @@ -1,278 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package policy - -import ( - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/pkg/identity" - "github.com/cilium/cilium/pkg/policy/trafficdirection" -) - -// selectorPolicy is a structure which contains the resolved policy for a -// particular Identity across all layers (L3, L4, and L7), with the policy -// still determined in terms of EndpointSelectors. -type selectorPolicy struct { - // Revision is the revision of the policy repository used to generate - // this selectorPolicy. - Revision uint64 - - // SelectorCache managing selectors in L4Policy - SelectorCache *SelectorCache - - // L4Policy contains the computed L4 and L7 policy. - L4Policy L4Policy - - // IngressPolicyEnabled specifies whether this policy contains any policy - // at ingress. - IngressPolicyEnabled bool - - // EgressPolicyEnabled specifies whether this policy contains any policy - // at egress. - EgressPolicyEnabled bool -} - -func (p *selectorPolicy) Attach(ctx PolicyContext) { - p.L4Policy.Attach(ctx) -} - -// EndpointPolicy is a structure which contains the resolved policy across all -// layers (L3, L4, and L7), distilled against a set of identities. -type EndpointPolicy struct { - // Note that all Endpoints sharing the same identity will be - // referring to a shared selectorPolicy! - *selectorPolicy - - // policyMapState contains the state of this policy as it relates to the - // datapath. In the future, this will be factored out of this object to - // decouple the policy as it relates to the datapath vs. its userspace - // representation. - // It maps each Key to the proxy port if proxy redirection is needed. - // Proxy port 0 indicates no proxy redirection. - // All fields within the Key and the proxy port must be in host byte-order. - // Must only be accessed with PolicyOwner (aka Endpoint) lock taken. - policyMapState MapState - - // policyMapChanges collects pending changes to the PolicyMapState - policyMapChanges MapChanges - - // PolicyOwner describes any type which consumes this EndpointPolicy object. - PolicyOwner PolicyOwner -} - -// PolicyOwner is anything which consumes a EndpointPolicy. -type PolicyOwner interface { - GetID() uint64 - LookupRedirectPort(ingress bool, protocol string, port uint16, listener string) (uint16, error) - GetRealizedRedirects() map[string]uint16 - HasBPFPolicyMap() bool - GetNamedPort(ingress bool, name string, proto uint8) uint16 - PolicyDebug(fields logrus.Fields, msg string) -} - -// newSelectorPolicy returns an empty selectorPolicy stub. -func newSelectorPolicy(selectorCache *SelectorCache) *selectorPolicy { - return &selectorPolicy{ - Revision: 0, - SelectorCache: selectorCache, - L4Policy: NewL4Policy(0), - } -} - -// insertUser adds a user to the L4Policy so that incremental -// updates of the L4Policy may be fowarded. -func (p *selectorPolicy) insertUser(user *EndpointPolicy) { - p.L4Policy.insertUser(user) -} - -// removeUser removes a user from the L4Policy so the EndpointPolicy -// can be freed when not needed any more -func (p *selectorPolicy) removeUser(user *EndpointPolicy) { - p.L4Policy.removeUser(user) -} - -// Detach releases resources held by a selectorPolicy to enable -// successful eventual GC. Note that the selectorPolicy itself if not -// modified in any way, so that it can be used concurrently. -func (p *selectorPolicy) Detach() { - p.L4Policy.Detach(p.SelectorCache) -} - -// DistillPolicy filters down the specified selectorPolicy (which acts -// upon selectors) into a set of concrete map entries based on the -// SelectorCache. These can subsequently be plumbed into the datapath. -// -// Called without holding the Selector cache or Repository locks. -// PolicyOwner (aka Endpoint) is also unlocked during this call, -// but the Endpoint's build mutex is held. -func (p *selectorPolicy) DistillPolicy(policyOwner PolicyOwner, isHost bool) *EndpointPolicy { - calculatedPolicy := &EndpointPolicy{ - selectorPolicy: p, - policyMapState: NewMapState(nil), - PolicyOwner: policyOwner, - } - - if !p.IngressPolicyEnabled || !p.EgressPolicyEnabled { - calculatedPolicy.policyMapState.allowAllIdentities( - !p.IngressPolicyEnabled, !p.EgressPolicyEnabled) - } - - // Register the new EndpointPolicy as a receiver of delta - // updates. Any updates happening after this, but before - // computeDesiredL4PolicyMapEntries() call finishes may - // already be applied to the PolicyMapState, specifically: - // - // - policyMapChanges may contain an addition of an entry that - // is already added to the PolicyMapState - // - // - policyMapChanges may contain a deletion of an entry that - // has already been deleted from PolicyMapState - p.insertUser(calculatedPolicy) - - // Must come after the 'insertUser()' above to guarantee - // PolicyMapChanges will contain all changes that are applied - // after the computation of PolicyMapState has started. - p.SelectorCache.mutex.RLock() - calculatedPolicy.toMapState() - if !isHost { - calculatedPolicy.policyMapState.determineAllowLocalhostIngress() - } - p.SelectorCache.mutex.RUnlock() - - return calculatedPolicy -} - -// GetPolicyMap gets the policy map state as the interface -// MapState -func (p *EndpointPolicy) GetPolicyMap() MapState { - return p.policyMapState -} - -// SetPolicyMap sets the policy map state as the interface -// MapState. If the main argument is nil, then this method -// will initialize a new MapState object for the caller. -func (p *EndpointPolicy) SetPolicyMap(ms MapState) { - if ms == nil { - p.policyMapState = NewMapState(nil) - return - } - p.policyMapState = ms -} - -// Detach removes EndpointPolicy references from selectorPolicy -// to allow the EndpointPolicy to be GC'd. -// PolicyOwner (aka Endpoint) is also locked during this call. -func (p *EndpointPolicy) Detach() { - p.selectorPolicy.removeUser(p) -} - -// toMapState transforms the EndpointPolicy.L4Policy into -// the datapath-friendly format inside EndpointPolicy.PolicyMapState. -// Called with selectorcache locked for reading. -// Called without holding the Repository lock. -// PolicyOwner (aka Endpoint) is also unlocked during this call, -// but the Endpoint's build mutex is held. -func (p *EndpointPolicy) toMapState() { - p.L4Policy.Ingress.toMapState(p) - p.L4Policy.Egress.toMapState(p) -} - -// toMapState transforms the L4DirectionPolicy into -// the datapath-friendly format inside EndpointPolicy.PolicyMapState. -// Called with selectorcache locked for reading. -// Called without holding the Repository lock. -// PolicyOwner (aka Endpoint) is also unlocked during this call, -// but the Endpoint's build mutex is held. -func (l4policy L4DirectionPolicy) toMapState(p *EndpointPolicy) { - for _, l4 := range l4policy.PortRules { - l4.toMapState(p, l4policy.features, p.PolicyOwner.GetRealizedRedirects(), ChangeState{}) - } -} - -// createRedirectsFunc returns 'nil' if map changes should not be applied immemdiately, -// otherwise the returned map is to be used to find redirect ports for map updates. -type createRedirectsFunc func(*L4Filter) map[string]uint16 - -// UpdateRedirects updates redirects in the EndpointPolicy's PolicyMapState by using the provided -// function to create redirects. Changes to 'p.PolicyMapState' are collected in -// 'adds' and 'updated' so that they can be reverted when needed. -func (p *EndpointPolicy) UpdateRedirects(ingress bool, createRedirects createRedirectsFunc, changes ChangeState) { - l4policy := &p.L4Policy.Ingress - if ingress { - l4policy = &p.L4Policy.Egress - } - - l4policy.updateRedirects(p, createRedirects, changes) -} - -func (l4policy L4DirectionPolicy) updateRedirects(p *EndpointPolicy, createRedirects createRedirectsFunc, changes ChangeState) { - // Selectorcache needs to be locked for toMapState (GetLabels()) call - p.SelectorCache.mutex.RLock() - defer p.SelectorCache.mutex.RUnlock() - - for _, l4 := range l4policy.PortRules { - if l4.IsRedirect() { - // Check if we are denying this specific L4 first regardless the L3, if there are any deny policies - if l4policy.features.contains(denyRules) && p.policyMapState.deniesL4(p.PolicyOwner, l4) { - continue - } - - redirects := createRedirects(l4) - if redirects != nil { - // Set the proxy port in the policy map. - l4.toMapState(p, l4policy.features, redirects, changes) - } - } - } -} - -// ConsumeMapChanges transfers the changes from MapChanges to the caller, -// locking the selector cache to make sure concurrent identity updates -// have completed. -// PolicyOwner (aka Endpoint) is also locked during this call. -func (p *EndpointPolicy) ConsumeMapChanges() (adds, deletes Keys) { - p.selectorPolicy.SelectorCache.mutex.Lock() - defer p.selectorPolicy.SelectorCache.mutex.Unlock() - features := p.selectorPolicy.L4Policy.Ingress.features | p.selectorPolicy.L4Policy.Egress.features - return p.policyMapChanges.consumeMapChanges(p.PolicyOwner, p.policyMapState, features, p.SelectorCache) -} - -// AllowsIdentity returns whether the specified policy allows -// ingress and egress traffic for the specified numeric security identity. -// If the 'secID' is zero, it will check if all traffic is allowed. -// -// Returning true for either return value indicates all traffic is allowed. -func (p *EndpointPolicy) AllowsIdentity(identity identity.NumericIdentity) (ingress, egress bool) { - key := Key{ - Identity: uint32(identity), - } - - if !p.IngressPolicyEnabled { - ingress = true - } else { - key.TrafficDirection = trafficdirection.Ingress.Uint8() - if v, exists := p.policyMapState.Get(key); exists && !v.IsDeny { - ingress = true - } - } - - if !p.EgressPolicyEnabled { - egress = true - } else { - key.TrafficDirection = trafficdirection.Egress.Uint8() - if v, exists := p.policyMapState.Get(key); exists && !v.IsDeny { - egress = true - } - } - - return ingress, egress -} - -// NewEndpointPolicy returns an empty EndpointPolicy stub. -func NewEndpointPolicy(repo *Repository) *EndpointPolicy { - return &EndpointPolicy{ - selectorPolicy: newSelectorPolicy(repo.GetSelectorCache()), - policyMapState: NewMapState(nil), - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/rule.go b/vendor/github.com/cilium/cilium/pkg/policy/rule.go deleted file mode 100644 index cf03437b9..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/rule.go +++ /dev/null @@ -1,841 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package policy - -import ( - "fmt" - "strconv" - "strings" - - "github.com/cilium/proxy/pkg/policy/api/kafka" - - "github.com/cilium/cilium/pkg/identity" - slim_metav1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" - "github.com/cilium/cilium/pkg/labels" - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/option" - "github.com/cilium/cilium/pkg/policy/api" -) - -type rule struct { - api.Rule - - metadata *ruleMetadata -} - -type ruleMetadata struct { - // mutex protects all fields in this type. - Mutex lock.Mutex - - // IdentitySelected is a cache that maps from an identity to whether - // this rule selects that identity. - IdentitySelected map[identity.NumericIdentity]bool -} - -func newRuleMetadata() *ruleMetadata { - return &ruleMetadata{ - IdentitySelected: make(map[identity.NumericIdentity]bool), - } -} - -func (m *ruleMetadata) delete(identity *identity.Identity) { - m.Mutex.Lock() - defer m.Mutex.Unlock() - delete(m.IdentitySelected, identity.ID) -} - -func (r *rule) String() string { - return r.EndpointSelector.String() -} - -func (r *rule) getSelector() *api.EndpointSelector { - if r.NodeSelector.LabelSelector != nil { - return &r.NodeSelector - } - return &r.EndpointSelector -} - -func (epd *PerSelectorPolicy) appendL7WildcardRule(ctx *SearchContext) api.L7Rules { - // Wildcard rule only needs to be appended if some rules already exist - switch { - case len(epd.L7Rules.HTTP) > 0: - rule := api.PortRuleHTTP{} - if !rule.Exists(epd.L7Rules) { - ctx.PolicyTrace(" Merging HTTP wildcard rule: %+v\n", rule) - epd.L7Rules.HTTP = append(epd.L7Rules.HTTP, rule) - } else { - ctx.PolicyTrace(" Merging HTTP wildcard rule, equal rule already exists: %+v\n", rule) - } - case len(epd.L7Rules.Kafka) > 0: - rule := kafka.PortRule{} - rule.Sanitize() - if !rule.Exists(epd.L7Rules.Kafka) { - ctx.PolicyTrace(" Merging Kafka wildcard rule: %+v\n", rule) - epd.L7Rules.Kafka = append(epd.L7Rules.Kafka, rule) - } else { - ctx.PolicyTrace(" Merging Kafka wildcard rule, equal rule already exists: %+v\n", rule) - } - case len(epd.L7Rules.DNS) > 0: - // Wildcarding at L7 for DNS is specified via allowing all via - // MatchPattern! - rule := api.PortRuleDNS{MatchPattern: "*"} - rule.Sanitize() - if !rule.Exists(epd.L7Rules) { - ctx.PolicyTrace(" Merging DNS wildcard rule: %+v\n", rule) - epd.L7Rules.DNS = append(epd.L7Rules.DNS, rule) - } else { - ctx.PolicyTrace(" Merging DNS wildcard rule, equal rule already exists: %+v\n", rule) - } - case epd.L7Rules.L7Proto != "" && len(epd.L7Rules.L7) > 0: - rule := api.PortRuleL7{} - if !rule.Exists(epd.L7Rules) { - ctx.PolicyTrace(" Merging L7 wildcard rule: %+v\n", rule) - epd.L7Rules.L7 = append(epd.L7Rules.L7, rule) - } else { - ctx.PolicyTrace(" Merging L7 wildcard rule, equal rule already exists: %+v\n", rule) - } - } - return epd.L7Rules -} - -// takesListenerPrecedenceOver returns true if the listener reference in 'l7Rules' takes precedence -// over the listener reference in 'other'. -func (l7Rules *PerSelectorPolicy) takesListenerPrecedenceOver(other *PerSelectorPolicy) bool { - var priority, otherPriority uint16 - - // decrement by one to wrap the undefined value (0) to be the highest numerical - // value of the uint16, which is the lowest possible priority - priority = l7Rules.Priority - 1 - otherPriority = other.Priority - 1 - - return priority < otherPriority -} - -// mergeListenerReference merges listener reference from 'newL7Rules' to 'l7Rules', giving -// precedence to listener with the lowest priority, if any. -func (l7Rules *PerSelectorPolicy) mergeListenerReference(newL7Rules *PerSelectorPolicy) error { - // Nothing to do if 'newL7Rules' has no listener reference - if newL7Rules.Listener == "" { - return nil - } - - // Nothing to do if the listeners are already the same and have the same priority - if newL7Rules.Listener == l7Rules.Listener && l7Rules.Priority == newL7Rules.Priority { - return nil - } - - // Nothing to do if 'l7Rules' takes precedence - if l7Rules.takesListenerPrecedenceOver(newL7Rules) { - return nil - } - - // override if 'l7Rules' has no listener or 'newL7Rules' takes precedence - if l7Rules.Listener == "" || newL7Rules.takesListenerPrecedenceOver(l7Rules) { - l7Rules.Listener = newL7Rules.Listener - l7Rules.Priority = newL7Rules.Priority - return nil - } - - // otherwise error on conflict - return fmt.Errorf("cannot merge conflicting CiliumEnvoyConfig Listeners (%v/%v) with the same priority (%d)", newL7Rules.Listener, l7Rules.Listener, l7Rules.Priority) -} - -func mergePortProto(ctx *SearchContext, existingFilter, filterToMerge *L4Filter, selectorCache *SelectorCache) (err error) { - // Merge the L7-related data from the filter to merge - // with the L7-related data already in the existing filter. - existingFilter.L7Parser, err = existingFilter.L7Parser.Merge(filterToMerge.L7Parser) - if err != nil { - ctx.PolicyTrace(" Merge conflict: mismatching parsers %s/%s\n", filterToMerge.L7Parser, existingFilter.L7Parser) - return err - } - - for cs, newL7Rules := range filterToMerge.PerSelectorPolicies { - // 'cs' will be merged or moved (see below), either way it needs - // to be removed from the map it is in now. - delete(filterToMerge.PerSelectorPolicies, cs) - - if l7Rules, ok := existingFilter.PerSelectorPolicies[cs]; ok { - // existing filter already has 'cs', release and merge L7 rules - selectorCache.RemoveSelector(cs, filterToMerge) - - // skip merging for reserved:none, as it is never - // selected, and toFQDN rules currently translate to - // reserved:none as an endpoint selector, causing a - // merge conflict for different toFQDN destinations - // with different TLS contexts. - if cs.IsNone() { - continue - } - - if l7Rules.Equal(newL7Rules) { - continue // identical rules need no merging - } - - // Merge two non-identical sets of non-nil rules - if l7Rules != nil && l7Rules.IsDeny { - // If existing rule is deny then it's a no-op - // Denies takes priority over any rule. - continue - } else if newL7Rules != nil && newL7Rules.IsDeny { - // Overwrite existing filter if the new rule is a deny case - // Denies takes priority over any rule. - existingFilter.PerSelectorPolicies[cs] = newL7Rules - continue - } - - // One of the rules may be a nil rule, expand it to an empty non-nil rule - if l7Rules == nil { - l7Rules = &PerSelectorPolicy{} - } - if newL7Rules == nil { - newL7Rules = &PerSelectorPolicy{} - } - - // Merge isRedirect flag - l7Rules.isRedirect = l7Rules.isRedirect || newL7Rules.isRedirect - - // Merge listener reference - if err := l7Rules.mergeListenerReference(newL7Rules); err != nil { - ctx.PolicyTrace(" Merge conflict: %s\n", err.Error()) - return err - } - - if l7Rules.Authentication == nil || newL7Rules.Authentication == nil { - if newL7Rules.Authentication != nil { - l7Rules.Authentication = newL7Rules.Authentication - } - } else if !newL7Rules.Authentication.DeepEqual(l7Rules.Authentication) { - ctx.PolicyTrace(" Merge conflict: mismatching auth types %s/%s\n", newL7Rules.Authentication.Mode, l7Rules.Authentication.Mode) - return fmt.Errorf("cannot merge conflicting authentication types (%s/%s)", newL7Rules.Authentication.Mode, l7Rules.Authentication.Mode) - } - - if l7Rules.TerminatingTLS == nil || newL7Rules.TerminatingTLS == nil { - if newL7Rules.TerminatingTLS != nil { - l7Rules.TerminatingTLS = newL7Rules.TerminatingTLS - } - } else if !newL7Rules.TerminatingTLS.Equal(l7Rules.TerminatingTLS) { - ctx.PolicyTrace(" Merge conflict: mismatching terminating TLS contexts %v/%v\n", newL7Rules.TerminatingTLS, l7Rules.TerminatingTLS) - return fmt.Errorf("cannot merge conflicting terminating TLS contexts for cached selector %s: (%v/%v)", cs.String(), newL7Rules.TerminatingTLS, l7Rules.TerminatingTLS) - } - if l7Rules.OriginatingTLS == nil || newL7Rules.OriginatingTLS == nil { - if newL7Rules.OriginatingTLS != nil { - l7Rules.OriginatingTLS = newL7Rules.OriginatingTLS - } - } else if !newL7Rules.OriginatingTLS.Equal(l7Rules.OriginatingTLS) { - ctx.PolicyTrace(" Merge conflict: mismatching originating TLS contexts %v/%v\n", newL7Rules.OriginatingTLS, l7Rules.OriginatingTLS) - return fmt.Errorf("cannot merge conflicting originating TLS contexts for cached selector %s: (%v/%v)", cs.String(), newL7Rules.OriginatingTLS, l7Rules.OriginatingTLS) - } - - // For now we simply merge the set of allowed SNIs from different rules - // to/from the *same remote*, port, and protocol. This means that if any - // rule requires SNI, then all traffic to that remote/port requires TLS, - // even if other merged rules would be fine without TLS. Any SNI from all - // applicable rules is allowed. - // - // Preferably we could allow different rules for each SNI, but for now the - // combination of all L7 rules is allowed for all the SNIs. For example, if - // SNI and TLS termination are used together so that L7 filtering is - // possible, in this example: - // - // - existing: SNI: public.example.com - // - new: SNI: private.example.com HTTP: path="/public" - // - // Separately, these rule allow access to all paths at SNI - // public.example.com and path private.example.com/public, but currently we - // allow all paths also at private.example.com. This may be clamped down if - // there is sufficient demand for SNI and TLS termination together. - // - // Note however that SNI rules are typically used with `toFQDNs`, each of - // which defines a separate destination, so that SNIs for different - // `toFQDNs` will not be merged together. - l7Rules.ServerNames = l7Rules.ServerNames.Merge(newL7Rules.ServerNames) - - // L7 rules can be applied with SNI filtering only if the TLS is also - // terminated - if len(l7Rules.ServerNames) > 0 && !l7Rules.L7Rules.IsEmpty() && l7Rules.TerminatingTLS == nil { - ctx.PolicyTrace(" Merge conflict: cannot use SNI filtering with L7 rules without TLS termination: %v\n", l7Rules.ServerNames) - return fmt.Errorf("cannot merge L7 rules for cached selector %s with SNI filtering without TLS termination: %v", cs.String(), l7Rules.ServerNames) - } - - // empty L7 rules effectively wildcard L7. When merging with a non-empty - // rule, the empty must be expanded to an actual wildcard rule for the - // specific L7 - if !l7Rules.HasL7Rules() && newL7Rules.HasL7Rules() { - l7Rules.L7Rules = newL7Rules.appendL7WildcardRule(ctx) - existingFilter.PerSelectorPolicies[cs] = l7Rules - continue - } - if l7Rules.HasL7Rules() && !newL7Rules.HasL7Rules() { - l7Rules.appendL7WildcardRule(ctx) - existingFilter.PerSelectorPolicies[cs] = l7Rules - continue - } - - // We already know from the L7Parser.Merge() above that there are no - // conflicting parser types, and rule validation only allows one type of L7 - // rules in a rule, so we can just merge the rules here. - for _, newRule := range newL7Rules.HTTP { - if !newRule.Exists(l7Rules.L7Rules) { - l7Rules.HTTP = append(l7Rules.HTTP, newRule) - } - } - for _, newRule := range newL7Rules.Kafka { - if !newRule.Exists(l7Rules.L7Rules.Kafka) { - l7Rules.Kafka = append(l7Rules.Kafka, newRule) - } - } - if l7Rules.L7Proto == "" && newL7Rules.L7Proto != "" { - l7Rules.L7Proto = newL7Rules.L7Proto - } - for _, newRule := range newL7Rules.L7 { - if !newRule.Exists(l7Rules.L7Rules) { - l7Rules.L7 = append(l7Rules.L7, newRule) - } - } - for _, newRule := range newL7Rules.DNS { - if !newRule.Exists(l7Rules.L7Rules) { - l7Rules.DNS = append(l7Rules.DNS, newRule) - } - } - // Update the pointer in the map in case it was newly allocated - existingFilter.PerSelectorPolicies[cs] = l7Rules - } else { // 'cs' is not in the existing filter yet - // Update selector owner to the existing filter - selectorCache.ChangeUser(cs, filterToMerge, existingFilter) - - // Move L7 rules over. - existingFilter.PerSelectorPolicies[cs] = newL7Rules - - if cs.IsWildcard() { - existingFilter.wildcard = cs - } - } - } - - return nil -} - -// mergeIngressPortProto merges all rules which share the same port & protocol that -// select a given set of endpoints. It updates the L4Filter mapped to by the specified -// port and protocol with the contents of the provided PortRule. If the rule -// being merged has conflicting L7 rules with those already in the provided -// L4PolicyMap for the specified port-protocol tuple, it returns an error. -// -// If any rules contain L7 rules that select Host or Remote Node and we should -// accept all traffic from host, the L7 rules will be translated into L7 -// wildcards via 'hostWildcardL7'. That is to say, traffic will be -// forwarded to the proxy for endpoints matching those labels, but the proxy -// will allow all such traffic. -func mergeIngressPortProto(policyCtx PolicyContext, ctx *SearchContext, endpoints api.EndpointSelectorSlice, auth *api.Authentication, hostWildcardL7 []string, - r api.Ports, p api.PortProtocol, proto api.L4Proto, ruleLabels labels.LabelArray, resMap L4PolicyMap) (int, error) { - // Create a new L4Filter - filterToMerge, err := createL4IngressFilter(policyCtx, endpoints, auth, hostWildcardL7, r, p, proto, ruleLabels) - if err != nil { - return 0, err - } - - err = addL4Filter(policyCtx, ctx, resMap, p, proto, filterToMerge, ruleLabels) - if err != nil { - return 0, err - } - return 1, err -} - -func traceL3(ctx *SearchContext, peerEndpoints api.EndpointSelectorSlice, direction string, isDeny bool) { - var result strings.Builder - - // Requirements will be cloned into every selector, only trace them once. - if len(peerEndpoints[0].MatchExpressions) > 0 { - sel := peerEndpoints[0] - result.WriteString(" Enforcing requirements ") - result.WriteString(fmt.Sprintf("%+v", sel.MatchExpressions)) - result.WriteString("\n") - } - // EndpointSelector - for _, sel := range peerEndpoints { - if len(sel.MatchLabels) > 0 { - if !isDeny { - result.WriteString(" Allows ") - } else { - result.WriteString(" Denies ") - } - result.WriteString(direction) - result.WriteString(" labels ") - result.WriteString(sel.String()) - result.WriteString("\n") - } - } - ctx.PolicyTrace(result.String()) -} - -// portRulesCoverContext determines whether L4 portions of rules cover the -// specified port models. -// -// Returns true if the list of ports is 0, or the rules match the ports. -func rulePortsCoverSearchContext(ports []api.PortProtocol, ctx *SearchContext) bool { - if len(ctx.DPorts) == 0 { - return true - } - for _, p := range ports { - for _, dp := range ctx.DPorts { - tracePort := api.PortProtocol{ - Protocol: api.L4Proto(dp.Protocol), - } - if dp.Name != "" { - tracePort.Port = dp.Name - } else { - tracePort.Port = strconv.FormatUint(uint64(dp.Port), 10) - } - if p.Covers(tracePort) { - return true - } - } - } - return false -} - -func mergeIngress(policyCtx PolicyContext, ctx *SearchContext, fromEndpoints api.EndpointSelectorSlice, auth *api.Authentication, toPorts, icmp api.PortsIterator, ruleLabels labels.LabelArray, resMap L4PolicyMap) (int, error) { - found := 0 - - // short-circuit if no endpoint is selected - if fromEndpoints == nil { - return found, nil - } - - if ctx.From != nil && len(fromEndpoints) > 0 { - if ctx.TraceEnabled() { - traceL3(ctx, fromEndpoints, "from", policyCtx.IsDeny()) - } - if !fromEndpoints.Matches(ctx.From) { - ctx.PolicyTrace(" No label match for %s", ctx.From) - return 0, nil - } - ctx.PolicyTrace(" Found all required labels") - } - - // Daemon options may induce L3 allows for host/world. In this case, if - // we find any L7 rules matching host/world then we need to turn any L7 - // restrictions on these endpoints into L7 allow-all so that the - // traffic is always allowed, but is also always redirected through the - // proxy - hostWildcardL7 := make([]string, 0, 2) - if option.Config.AlwaysAllowLocalhost() { - hostWildcardL7 = append(hostWildcardL7, labels.IDNameHost) - } - - var ( - cnt int - err error - ) - - // L3-only rule (with requirements folded into fromEndpoints). - if toPorts.Len() == 0 && icmp.Len() == 0 && len(fromEndpoints) > 0 { - cnt, err = mergeIngressPortProto(policyCtx, ctx, fromEndpoints, auth, hostWildcardL7, &api.PortRule{}, api.PortProtocol{Port: "0", Protocol: api.ProtoAny}, api.ProtoAny, ruleLabels, resMap) - if err != nil { - return found, err - } - } - - found += cnt - - err = toPorts.Iterate(func(r api.Ports) error { - // For L4 Policy, an empty slice of EndpointSelector indicates that the - // rule allows all at L3 - explicitly specify this by creating a slice - // with the WildcardEndpointSelector. - if len(fromEndpoints) == 0 { - fromEndpoints = api.EndpointSelectorSlice{api.WildcardEndpointSelector} - } - if !policyCtx.IsDeny() { - ctx.PolicyTrace(" Allows port %v\n", r.GetPortProtocols()) - } else { - ctx.PolicyTrace(" Denies port %v\n", r.GetPortProtocols()) - } - if !rulePortsCoverSearchContext(r.GetPortProtocols(), ctx) { - ctx.PolicyTrace(" No port match found\n") - return nil - } - pr := r.GetPortRule() - if pr != nil { - if pr.Rules != nil && pr.Rules.L7Proto != "" { - ctx.PolicyTrace(" l7proto: \"%s\"\n", pr.Rules.L7Proto) - } - if !pr.Rules.IsEmpty() { - for _, l7 := range pr.Rules.HTTP { - ctx.PolicyTrace(" %+v\n", l7) - } - for _, l7 := range pr.Rules.Kafka { - ctx.PolicyTrace(" %+v\n", l7) - } - for _, l7 := range pr.Rules.L7 { - ctx.PolicyTrace(" %+v\n", l7) - } - } - } - - for _, p := range r.GetPortProtocols() { - if p.Protocol.IsAny() { - cnt, err := mergeIngressPortProto(policyCtx, ctx, fromEndpoints, auth, hostWildcardL7, r, p, api.ProtoTCP, ruleLabels, resMap) - if err != nil { - return err - } - found += cnt - - cnt, err = mergeIngressPortProto(policyCtx, ctx, fromEndpoints, auth, hostWildcardL7, r, p, api.ProtoUDP, ruleLabels, resMap) - if err != nil { - return err - } - found += cnt - - cnt, err = mergeIngressPortProto(policyCtx, ctx, fromEndpoints, auth, hostWildcardL7, r, p, api.ProtoSCTP, ruleLabels, resMap) - if err != nil { - return err - } - found += cnt - } else { - cnt, err := mergeIngressPortProto(policyCtx, ctx, fromEndpoints, auth, hostWildcardL7, r, p, p.Protocol, ruleLabels, resMap) - if err != nil { - return err - } - found += cnt - } - } - return nil - }) - if err != nil { - return found, err - } - - err = icmp.Iterate(func(r api.Ports) error { - if len(fromEndpoints) == 0 { - fromEndpoints = api.EndpointSelectorSlice{api.WildcardEndpointSelector} - } - - if !policyCtx.IsDeny() { - ctx.PolicyTrace(" Allows ICMP type %v\n", r.GetPortProtocols()) - } else { - ctx.PolicyTrace(" Denies ICMP type %v\n", r.GetPortProtocols()) - } - if !rulePortsCoverSearchContext(r.GetPortProtocols(), ctx) { - ctx.PolicyTrace(" No ICMP type match found\n") - return nil - } - - for _, p := range r.GetPortProtocols() { - cnt, err := mergeIngressPortProto(policyCtx, ctx, fromEndpoints, auth, hostWildcardL7, r, p, p.Protocol, ruleLabels, resMap) - if err != nil { - return err - } - found += cnt - } - return nil - }) - - return found, err -} - -func (state *traceState) selectRule(ctx *SearchContext, r *rule) { - ctx.PolicyTrace("* Rule %s: selected\n", r) - state.selectedRules++ -} - -func (state *traceState) unSelectRule(ctx *SearchContext, labels labels.LabelArray, r *rule) { - ctx.PolicyTraceVerbose(" Rule %s: did not select %+v\n", r, labels) -} - -// resolveIngressPolicy analyzes the rule against the given SearchContext, and -// merges it with any prior-generated policy within the provided L4Policy. -// Requirements based off of all Ingress requirements (set in FromRequires) in -// other rules are stored in the specified slice of LabelSelectorRequirement. -// These requirements are dynamically inserted into a copy of the receiver rule, -// as requirements form conjunctions across all rules. -func (r *rule) resolveIngressPolicy( - policyCtx PolicyContext, - ctx *SearchContext, - state *traceState, - result L4PolicyMap, - requirements, requirementsDeny []slim_metav1.LabelSelectorRequirement, -) ( - L4PolicyMap, error, -) { - if !ctx.rulesSelect { - if !r.getSelector().Matches(ctx.To) { - state.unSelectRule(ctx, ctx.To, r) - return nil, nil - } - } - - state.selectRule(ctx, r) - found, foundDeny := 0, 0 - - if len(r.Ingress) == 0 && len(r.IngressDeny) == 0 { - ctx.PolicyTrace(" No ingress rules\n") - } - for _, ingressRule := range r.Ingress { - fromEndpoints := ingressRule.GetSourceEndpointSelectorsWithRequirements(requirements) - cnt, err := mergeIngress(policyCtx, ctx, fromEndpoints, ingressRule.Authentication, ingressRule.ToPorts, ingressRule.ICMPs, r.Rule.Labels.DeepCopy(), result) - if err != nil { - return nil, err - } - if cnt > 0 { - found += cnt - } - } - - oldDeny := policyCtx.SetDeny(true) - defer func() { - policyCtx.SetDeny(oldDeny) - }() - for _, ingressRule := range r.IngressDeny { - fromEndpoints := ingressRule.GetSourceEndpointSelectorsWithRequirements(requirementsDeny) - cnt, err := mergeIngress(policyCtx, ctx, fromEndpoints, nil, ingressRule.ToPorts, ingressRule.ICMPs, r.Rule.Labels.DeepCopy(), result) - if err != nil { - return nil, err - } - if cnt > 0 { - foundDeny += cnt - } - } - - if found+foundDeny > 0 { - if found != 0 { - state.matchedRules++ - } - if foundDeny != 0 { - state.matchedDenyRules++ - } - return result, nil - } - - return nil, nil -} - -func (r *rule) matches(securityIdentity *identity.Identity) bool { - r.metadata.Mutex.Lock() - defer r.metadata.Mutex.Unlock() - isNode := securityIdentity.ID == identity.ReservedIdentityHost - - if ruleMatches, cached := r.metadata.IdentitySelected[securityIdentity.ID]; cached { - return ruleMatches - } - - // Short-circuit if the rule's selector type (node vs. endpoint) does not match the - // identity's type - if (r.NodeSelector.LabelSelector != nil) != isNode { - r.metadata.IdentitySelected[securityIdentity.ID] = false - return false - } - - // Fall back to costly matching. - ruleMatches := r.getSelector().Matches(securityIdentity.LabelArray) - - // Update cache so we don't have to do costly matching again. - // the local Host identity has mutable labels, so we cannot use the cache - if !isNode { - r.metadata.IdentitySelected[securityIdentity.ID] = ruleMatches - } - - return ruleMatches -} - -// ****************** EGRESS POLICY ****************** - -func mergeEgress(policyCtx PolicyContext, ctx *SearchContext, toEndpoints api.EndpointSelectorSlice, auth *api.Authentication, toPorts, icmp api.PortsIterator, ruleLabels labels.LabelArray, resMap L4PolicyMap, fqdns api.FQDNSelectorSlice) (int, error) { - found := 0 - - // short-circuit if no endpoint is selected - if toEndpoints == nil { - return found, nil - } - - if ctx.To != nil && len(toEndpoints) > 0 { - if ctx.TraceEnabled() { - traceL3(ctx, toEndpoints, "to", policyCtx.IsDeny()) - } - if !toEndpoints.Matches(ctx.To) { - ctx.PolicyTrace(" No label match for %s", ctx.To) - return 0, nil - } - ctx.PolicyTrace(" Found all required labels") - } - - var ( - cnt int - err error - ) - - // L3-only rule (with requirements folded into toEndpoints). - if toPorts.Len() == 0 && icmp.Len() == 0 && len(toEndpoints) > 0 { - cnt, err = mergeEgressPortProto(policyCtx, ctx, toEndpoints, auth, &api.PortRule{}, api.PortProtocol{Port: "0", Protocol: api.ProtoAny}, api.ProtoAny, ruleLabels, resMap, fqdns) - if err != nil { - return found, err - } - } - - found += cnt - - err = toPorts.Iterate(func(r api.Ports) error { - // For L4 Policy, an empty slice of EndpointSelector indicates that the - // rule allows all at L3 - explicitly specify this by creating a slice - // with the WildcardEndpointSelector. - if len(toEndpoints) == 0 { - toEndpoints = api.EndpointSelectorSlice{api.WildcardEndpointSelector} - } - if !policyCtx.IsDeny() { - ctx.PolicyTrace(" Allows port %v\n", r.GetPortProtocols()) - } else { - ctx.PolicyTrace(" Denies port %v\n", r.GetPortProtocols()) - } - - pr := r.GetPortRule() - if pr != nil { - if !pr.Rules.IsEmpty() { - for _, l7 := range pr.Rules.HTTP { - ctx.PolicyTrace(" %+v\n", l7) - } - for _, l7 := range pr.Rules.Kafka { - ctx.PolicyTrace(" %+v\n", l7) - } - for _, l7 := range pr.Rules.L7 { - ctx.PolicyTrace(" %+v\n", l7) - } - } - } - - for _, p := range r.GetPortProtocols() { - if p.Protocol.IsAny() { - cnt, err := mergeEgressPortProto(policyCtx, ctx, toEndpoints, auth, r, p, api.ProtoTCP, ruleLabels, resMap, fqdns) - if err != nil { - return err - } - found += cnt - - cnt, err = mergeEgressPortProto(policyCtx, ctx, toEndpoints, auth, r, p, api.ProtoUDP, ruleLabels, resMap, fqdns) - if err != nil { - return err - } - found += cnt - - cnt, err = mergeEgressPortProto(policyCtx, ctx, toEndpoints, auth, r, p, api.ProtoSCTP, ruleLabels, resMap, fqdns) - if err != nil { - return err - } - found += cnt - } else { - cnt, err := mergeEgressPortProto(policyCtx, ctx, toEndpoints, auth, r, p, p.Protocol, ruleLabels, resMap, fqdns) - if err != nil { - return err - } - found += cnt - } - } - return nil - }, - ) - if err != nil { - return found, err - } - - err = icmp.Iterate(func(r api.Ports) error { - if len(toEndpoints) == 0 { - toEndpoints = api.EndpointSelectorSlice{api.WildcardEndpointSelector} - } - if !policyCtx.IsDeny() { - ctx.PolicyTrace(" Allows ICMP type %v\n", r.GetPortProtocols()) - } else { - ctx.PolicyTrace(" Denies ICMP type %v\n", r.GetPortProtocols()) - } - - for _, p := range r.GetPortProtocols() { - cnt, err := mergeEgressPortProto(policyCtx, ctx, toEndpoints, auth, r, p, p.Protocol, ruleLabels, resMap, fqdns) - if err != nil { - return err - } - found += cnt - } - return nil - }) - - return found, err -} - -// mergeEgressPortProto merges all rules which share the same port & protocol that -// select a given set of endpoints. It updates the L4Filter mapped to by the specified -// port and protocol with the contents of the provided PortRule. If the rule -// being merged has conflicting L7 rules with those already in the provided -// L4PolicyMap for the specified port-protocol tuple, it returns an error. -func mergeEgressPortProto(policyCtx PolicyContext, ctx *SearchContext, endpoints api.EndpointSelectorSlice, auth *api.Authentication, r api.Ports, p api.PortProtocol, - proto api.L4Proto, ruleLabels labels.LabelArray, resMap L4PolicyMap, fqdns api.FQDNSelectorSlice) (int, error) { - // Create a new L4Filter - filterToMerge, err := createL4EgressFilter(policyCtx, endpoints, auth, r, p, proto, ruleLabels, fqdns) - if err != nil { - return 0, err - } - - err = addL4Filter(policyCtx, ctx, resMap, p, proto, filterToMerge, ruleLabels) - if err != nil { - return 0, err - } - return 1, err -} - -func (r *rule) resolveEgressPolicy( - policyCtx PolicyContext, - ctx *SearchContext, - state *traceState, - result L4PolicyMap, - requirements, requirementsDeny []slim_metav1.LabelSelectorRequirement, -) ( - L4PolicyMap, error, -) { - if !ctx.rulesSelect { - if !r.getSelector().Matches(ctx.From) { - state.unSelectRule(ctx, ctx.From, r) - return nil, nil - } - } - - state.selectRule(ctx, r) - found, foundDeny := 0, 0 - - if len(r.Egress) == 0 && len(r.EgressDeny) == 0 { - ctx.PolicyTrace(" No egress rules\n") - } - for _, egressRule := range r.Egress { - toEndpoints := egressRule.GetDestinationEndpointSelectorsWithRequirements(requirements) - cnt, err := mergeEgress(policyCtx, ctx, toEndpoints, egressRule.Authentication, egressRule.ToPorts, egressRule.ICMPs, r.Rule.Labels.DeepCopy(), result, egressRule.ToFQDNs) - if err != nil { - return nil, err - } - if cnt > 0 { - found += cnt - } - } - - oldDeny := policyCtx.SetDeny(true) - defer func() { - policyCtx.SetDeny(oldDeny) - }() - for _, egressRule := range r.EgressDeny { - toEndpoints := egressRule.GetDestinationEndpointSelectorsWithRequirements(requirementsDeny) - cnt, err := mergeEgress(policyCtx, ctx, toEndpoints, nil, egressRule.ToPorts, egressRule.ICMPs, r.Rule.Labels.DeepCopy(), result, nil) - if err != nil { - return nil, err - } - if cnt > 0 { - foundDeny += cnt - } - } - - if found+foundDeny > 0 { - if found != 0 { - state.matchedRules++ - } - if foundDeny != 0 { - state.matchedDenyRules++ - } - return result, nil - } - - return nil, nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/rules.go b/vendor/github.com/cilium/cilium/pkg/policy/rules.go deleted file mode 100644 index 9caa9e88d..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/rules.go +++ /dev/null @@ -1,160 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package policy - -import ( - "fmt" - - slim_metav1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1" - policyapi "github.com/cilium/cilium/pkg/policy/api" -) - -// ruleSlice is a wrapper around a slice of *rule, which allows for functions -// to be written with []*rule as a receiver. -type ruleSlice []*rule - -func (rules ruleSlice) resolveL4IngressPolicy(policyCtx PolicyContext, ctx *SearchContext) (L4PolicyMap, error) { - result := L4PolicyMap{} - - ctx.PolicyTrace("\n") - ctx.PolicyTrace("Resolving ingress policy for %+v\n", ctx.To) - - state := traceState{} - var matchedRules ruleSlice - var requirements, requirementsDeny []slim_metav1.LabelSelectorRequirement - - // Iterate over all FromRequires which select ctx.To. These requirements - // will be appended to each EndpointSelector's MatchExpressions in - // each FromEndpoints for all ingress rules. This ensures that FromRequires - // is taken into account when evaluating policy at L4. - for _, r := range rules { - if ctx.rulesSelect || r.getSelector().Matches(ctx.To) { - matchedRules = append(matchedRules, r) - for _, ingressRule := range r.Ingress { - for _, requirement := range ingressRule.FromRequires { - requirements = append(requirements, requirement.ConvertToLabelSelectorRequirementSlice()...) - } - } - for _, ingressRule := range r.IngressDeny { - for _, requirement := range ingressRule.FromRequires { - requirementsDeny = append(requirementsDeny, requirement.ConvertToLabelSelectorRequirementSlice()...) - } - } - } - } - - // Only dealing with matching rules from now on. Mark it in the ctx - oldRulesSelect := ctx.rulesSelect - ctx.rulesSelect = true - - for _, r := range matchedRules { - _, err := r.resolveIngressPolicy(policyCtx, ctx, &state, result, requirements, requirementsDeny) - if err != nil { - return nil, err - } - state.ruleID++ - } - - state.trace(len(rules), ctx) - - // Restore ctx in case caller uses it again. - ctx.rulesSelect = oldRulesSelect - - return result, nil -} - -func (rules ruleSlice) resolveL4EgressPolicy(policyCtx PolicyContext, ctx *SearchContext) (L4PolicyMap, error) { - result := L4PolicyMap{} - - ctx.PolicyTrace("\n") - ctx.PolicyTrace("Resolving egress policy for %+v\n", ctx.From) - - state := traceState{} - var matchedRules ruleSlice - var requirements, requirementsDeny []slim_metav1.LabelSelectorRequirement - - // Iterate over all ToRequires which select ctx.To. These requirements will - // be appended to each EndpointSelector's MatchExpressions in each - // ToEndpoints for all egress rules. This ensures that ToRequires is - // taken into account when evaluating policy at L4. - for _, r := range rules { - if ctx.rulesSelect || r.getSelector().Matches(ctx.From) { - matchedRules = append(matchedRules, r) - for _, egressRule := range r.Egress { - for _, requirement := range egressRule.ToRequires { - requirements = append(requirements, requirement.ConvertToLabelSelectorRequirementSlice()...) - } - } - for _, egressRule := range r.EgressDeny { - for _, requirement := range egressRule.ToRequires { - requirementsDeny = append(requirementsDeny, requirement.ConvertToLabelSelectorRequirementSlice()...) - } - } - } - } - - // Only dealing with matching rules from now on. Mark it in the ctx - oldRulesSelect := ctx.rulesSelect - ctx.rulesSelect = true - - for i, r := range matchedRules { - state.ruleID = i - _, err := r.resolveEgressPolicy(policyCtx, ctx, &state, result, requirements, requirementsDeny) - if err != nil { - return nil, err - } - state.ruleID++ - } - - state.trace(len(rules), ctx) - - // Restore ctx in case caller uses it again. - ctx.rulesSelect = oldRulesSelect - - return result, nil -} - -// updateEndpointsCaches iterates over a given list of rules to update the cache -// within the rule which determines whether or not the given identity is -// selected by that rule. If a rule in the list does select said identity, it is -// added to epSet. Note that epSet can be shared across goroutines! -// Returns whether the endpoint was selected by one of the rules, or if the -// endpoint is nil. -func (rules ruleSlice) updateEndpointsCaches(ep Endpoint) (bool, error) { - if ep == nil { - return false, fmt.Errorf("cannot update caches in rules because endpoint is nil") - } - id := ep.GetID16() - securityIdentity, err := ep.GetSecurityIdentity() - if err != nil { - return false, fmt.Errorf("cannot update caches in rules for endpoint %d because it is being deleted: %w", id, err) - } - - if securityIdentity == nil { - return false, fmt.Errorf("cannot update caches in rules for endpoint %d because it has a nil identity", id) - } - endpointSelected := false - for _, r := range rules { - // NodeSelector can only match nodes, EndpointSelector only pods. - if (r.NodeSelector.LabelSelector != nil) != ep.IsHost() { - continue - } - // Update the matches cache of each rule, and note if - // the ep is selected by any of them. - if ruleMatches := r.matches(securityIdentity); ruleMatches { - endpointSelected = true - } - } - - return endpointSelected, nil -} - -// AsPolicyRules return the internal policyapi.Rule objects as a policyapi.Rules object -func (rules ruleSlice) AsPolicyRules() policyapi.Rules { - policyRules := make(policyapi.Rules, 0, len(rules)) - for _, r := range rules { - policyRules = append(policyRules, &r.Rule) - } - return policyRules -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/selectorcache.go b/vendor/github.com/cilium/cilium/pkg/policy/selectorcache.go deleted file mode 100644 index 95da78cd0..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/selectorcache.go +++ /dev/null @@ -1,629 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package policy - -import ( - "net" - "net/netip" - "sync" - - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/api/v1/models" - "github.com/cilium/cilium/pkg/identity" - "github.com/cilium/cilium/pkg/identity/cache" - k8sConst "github.com/cilium/cilium/pkg/k8s/apis/cilium.io" - "github.com/cilium/cilium/pkg/labels" - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/policy/api" -) - -// scIdentity is the information we need about a an identity that rules can select -type scIdentity struct { - NID identity.NumericIdentity - lbls labels.LabelArray - nets []*net.IPNet // Most specific CIDR for the identity, if any. - computed bool // nets has been computed - namespace string // value of the namespace label, or "" -} - -// scIdentityCache is a cache of Identities keyed by the numeric identity -type scIdentityCache map[identity.NumericIdentity]scIdentity - -func newIdentity(nid identity.NumericIdentity, lbls labels.LabelArray) scIdentity { - return scIdentity{ - NID: nid, - lbls: lbls, - nets: getLocalScopeNets(nid, lbls), - namespace: lbls.Get(labels.LabelSourceK8sKeyPrefix + k8sConst.PodNamespaceLabel), - computed: true, - } -} - -// getLocalScopeNets returns the most specific CIDR for a local scope identity. -func getLocalScopeNets(id identity.NumericIdentity, lbls labels.LabelArray) []*net.IPNet { - if id.HasLocalScope() { - var ( - maskSize int - mostSpecificCidr *net.IPNet - ) - for _, lbl := range lbls { - if lbl.Source == labels.LabelSourceCIDR { - _, netIP, err := net.ParseCIDR(lbl.Key) - if err == nil { - if ms, _ := netIP.Mask.Size(); ms > maskSize { - mostSpecificCidr = netIP - maskSize = ms - } - } - } - } - if mostSpecificCidr != nil { - return []*net.IPNet{mostSpecificCidr} - } - } - return nil -} - -func getIdentityCache(ids cache.IdentityCache) scIdentityCache { - idCache := make(map[identity.NumericIdentity]scIdentity, len(ids)) - for nid, lbls := range ids { - idCache[nid] = newIdentity(nid, lbls) - } - return idCache -} - -// userNotification stores the information needed to call -// IdentitySelectionUpdated callbacks to notify users of selector's -// identity changes. These are queued to be able to call the callbacks -// in FIFO order while not holding any locks. -type userNotification struct { - user CachedSelectionUser - selector CachedSelector - added []identity.NumericIdentity - deleted []identity.NumericIdentity - wg *sync.WaitGroup -} - -// SelectorCache caches identities, identity selectors, and the -// subsets of identities each selector selects. -type SelectorCache struct { - mutex lock.RWMutex - - // idAllocator is used to allocate and release identities. It is used - // by the NameManager to manage identities corresponding to FQDNs. - idAllocator cache.IdentityAllocator - - // idCache contains all known identities as informed by the - // kv-store and the local identity facility via our - // UpdateIdentities() function. - idCache scIdentityCache - - // map key is the string representation of the selector being cached. - selectors map[string]*identitySelector - - localIdentityNotifier identityNotifier - - // userCond is a condition variable for receiving signals - // about addition of new elements in userNotes - userCond *sync.Cond - // userMutex protects userNotes and is linked to userCond - userMutex lock.Mutex - // userNotes holds a FIFO list of user notifications to be made - userNotes []userNotification - - // used to lazily start the handler for user notifications. - startNotificationsHandlerOnce sync.Once -} - -// GetModel returns the API model of the SelectorCache. -func (sc *SelectorCache) GetModel() models.SelectorCache { - sc.mutex.RLock() - defer sc.mutex.RUnlock() - - selCacheMdl := make(models.SelectorCache, 0, len(sc.selectors)) - - for selector, idSel := range sc.selectors { - selections := idSel.GetSelections() - ids := make([]int64, 0, len(selections)) - for i := range selections { - ids = append(ids, int64(selections[i])) - } - selMdl := &models.SelectorIdentityMapping{ - Selector: selector, - Identities: ids, - Users: int64(idSel.numUsers()), - Labels: labelArrayToModel(idSel.GetMetadataLabels()), - } - selCacheMdl = append(selCacheMdl, selMdl) - } - - return selCacheMdl -} - -func labelArrayToModel(arr labels.LabelArray) models.LabelArray { - lbls := make(models.LabelArray, 0, len(arr)) - for _, l := range arr { - lbls = append(lbls, &models.Label{ - Key: l.Key, - Value: l.Value, - Source: l.Source, - }) - } - return lbls -} - -func (sc *SelectorCache) handleUserNotifications() { - for { - sc.userMutex.Lock() - for len(sc.userNotes) == 0 { - sc.userCond.Wait() - } - // get the current batch of notifications and release the lock so that SelectorCache - // can't block on userMutex while we call IdentitySelectionUpdated callbacks below. - notifications := sc.userNotes - sc.userNotes = nil - sc.userMutex.Unlock() - - for _, n := range notifications { - n.user.IdentitySelectionUpdated(n.selector, n.added, n.deleted) - n.wg.Done() - } - } -} - -func (sc *SelectorCache) queueUserNotification(user CachedSelectionUser, selector CachedSelector, added, deleted []identity.NumericIdentity, wg *sync.WaitGroup) { - sc.startNotificationsHandlerOnce.Do(func() { - go sc.handleUserNotifications() - }) - wg.Add(1) - sc.userMutex.Lock() - sc.userNotes = append(sc.userNotes, userNotification{ - user: user, - selector: selector, - added: added, - deleted: deleted, - wg: wg, - }) - sc.userMutex.Unlock() - sc.userCond.Signal() -} - -// NewSelectorCache creates a new SelectorCache with the given identities. -func NewSelectorCache(allocator cache.IdentityAllocator, ids cache.IdentityCache) *SelectorCache { - sc := &SelectorCache{ - idAllocator: allocator, - idCache: getIdentityCache(ids), - selectors: make(map[string]*identitySelector), - } - sc.userCond = sync.NewCond(&sc.userMutex) - return sc -} - -// SetLocalIdentityNotifier injects the provided identityNotifier into the -// SelectorCache. Currently, this is used to inject the FQDN subsystem into -// the SelectorCache so the SelectorCache can notify the FQDN subsystem when -// it should be aware of a given FQDNSelector for which CIDR identities need -// to be provided upon DNS lookups which corespond to said FQDNSelector. -func (sc *SelectorCache) SetLocalIdentityNotifier(pop identityNotifier) { - sc.localIdentityNotifier = pop -} - -var ( - // Empty slice of numeric identities used for all selectors that select nothing - emptySelection identity.NumericIdentitySlice - // wildcardSelectorKey is used to compare if a key is for a wildcard - wildcardSelectorKey = api.WildcardEndpointSelector.LabelSelector.String() - // noneSelectorKey is used to compare if a key is for "reserved:none" - noneSelectorKey = api.EndpointSelectorNone.LabelSelector.String() -) - -// identityNotifier provides a means for other subsystems to be made aware of a -// given FQDNSelector (currently pkg/fqdn) so that said subsystems can notify -// the SelectorCache about new IPs (via CIDR Identities) which correspond to -// said FQDNSelector. This is necessary since there is nothing intrinsic to a -// CIDR Identity that says that it corresponds to a given FQDNSelector; this -// relationship is contained only via DNS responses, which are handled -// externally. -type identityNotifier interface { - // Lock must be held during any calls to *Locked functions below. - Lock() - - // Unlock must be called after calls to *Locked functions below. - Unlock() - - // RegisterForIPUpdatesLocked exposes this FQDNSelector so that identities - // for IPs contained in a DNS response that matches said selector can - // be propagated back to the SelectorCache via `UpdateFQDNSelector`. - // - // This function should only be called when the SelectorCache has been - // made aware of the FQDNSelector for the first time; subsequent - // updates to the selectors should be made via `UpdateFQDNSelector`. - // - // This function returns the set of IPs for which this selector already applies. - RegisterForIPUpdatesLocked(selector api.FQDNSelector) []netip.Addr - - // UnregisterForIPUpdatesLocked removes this FQDNSelector from the set of - // FQDNSelectors which are being tracked by the identityNotifier. The result - // of this is that no more updates for IPs which correspond to said selector - // are propagated back to the SelectorCache via `UpdateFQDNSelector`. - // This occurs when there are no more users of a given FQDNSelector for the - // SelectorCache. - UnregisterForIPUpdatesLocked(selector api.FQDNSelector) -} - -// -// CachedSelector implementation (== Public API) -// -// No locking needed. -// - -// UpdateResult is a bitfield that indicates what parts of the policy engines -// need to update in order to implement a policy -type UpdateResult uint32 - -const ( - // UpdateResultUpdatePolicyMaps indicates the caller should call EndpointManager.UpdatePolicyMaps() - UpdateResultUpdatePolicyMaps = UpdateResult(1) << iota - - // UpdateResultIdentitiesNeeded indicates the caller should wait for a complete ipcache label injection, - // as the selector is missing identities - UpdateResultIdentitiesNeeded - - UpdateResultUnchanged = UpdateResult(0) -) - -// UpdateFQDNSelector updates the mapping of fqdnKey (the FQDNSelector from a -// policy rule as a string) to to the provided list of IPs. -// -// If the supplied IPs are already known to the SelectorCache (i.e. they already) -// have identities allocated for them), the selector's cachedSelections changes, and -// users are notified asynchronously. Caller must then call Wait() on the supplied -// sync.WaitGroup before triggering any policy updates via UpdatePolicyMaps(). -// Policy updates may need Endpoint locks, so this Wait() can deadlock if the caller -// is holding any endpoint locks. When this is the case, the returned UpdateResult has -// the UpdateResultUpdatePolicyMaps bit set. -// -// In the case where identities are not found for all supplied IPs, the returned -// result has the IdentitiesNeeded bit set to signify that an ipcache update is needed. -// -// The caller must always ensure that all selected IP addresses are known to the ipcache. -// -// Returns an UpdateResult that indicates if the caller should call UpdatePolicyMaps() and/or -// wait for ipcache UpsertMetadata() to finish. -func (sc *SelectorCache) UpdateFQDNSelector(fqdnSelec api.FQDNSelector, ips []netip.Addr, wg *sync.WaitGroup) UpdateResult { - sc.mutex.Lock() - defer sc.mutex.Unlock() - return sc.updateFQDNSelector(fqdnSelec, ips, wg) -} - -func (sc *SelectorCache) updateFQDNSelector(fqdnSelec api.FQDNSelector, ips []netip.Addr, wg *sync.WaitGroup) UpdateResult { - key := fqdnSelec.String() - - idSelector, exists := sc.selectors[key] - if !exists || idSelector == nil { - log.WithField(logfields.Selector, fqdnSelec.String()).Error("UpdateFQDNSelector of selector not registered in SelectorCache!") - } - - fqdnSelect, ok := idSelector.source.(*fqdnSelector) - if !ok { - log.Error("UpdateFQDNSelector for non-FQDN selector!") - return UpdateResultUnchanged - } - - // update wantLabels, then determine set of added and removed identities - fqdnSelect.setSelectorIPs(ips) // this updates wantLabels - - // Note that 'added' and 'deleted' are guaranteed to be - // disjoint, as one of them is left as nil, or an identity - // being in 'identities' is a precondition for an - // identity to be appended to 'added', while the inverse is - // true for 'deleted'. - var added, deleted []identity.NumericIdentity - - // Delete any non-matching entries from cachedSelections - for nid := range idSelector.cachedSelections { - identity := sc.idCache[nid] - if !idSelector.source.matches(identity) { - deleted = append(deleted, nid) - delete(idSelector.cachedSelections, nid) - } - } - - // Scan the cached set of IDs to determine any new matchers - for nid, identity := range sc.idCache { - if idSelector.source.matches(identity) { - if _, exists := idSelector.cachedSelections[nid]; !exists { - added = append(added, nid) - idSelector.cachedSelections[nid] = struct{}{} - } - } - } - - // Result indicates whether or not the caller should call UpdatePolicyMaps - // and / or wait for ipcache to finish. - result := UpdateResultUnchanged - - // If we're missing identities, then the caller also needs to wait for ipcache to do a - // allocation + injection round - // - // This assumes we should have a 1:1 mapping from label to IPs, which is currently the case. - // If this changes, this conditional will be wrong. - if len(idSelector.cachedSelections) != len(fqdnSelect.wantLabels) { - result |= UpdateResultIdentitiesNeeded - } - - idSelector.updateSelections() - - // If the set of selections has changed, then we need to push out an - // incremental update. This will add an incremental change to all users, - // and tell the caller that a call to UpdatePolicyMaps is required. - if len(added)+len(deleted) > 0 { - result |= UpdateResultUpdatePolicyMaps - idSelector.notifyUsers(sc, added, deleted, wg) // disjoint sets, see the comment above - } - - return result -} - -// AddFQDNSelector adds the given api.FQDNSelector in to the selector cache. If -// an identical EndpointSelector has already been cached, the corresponding -// CachedSelector is returned, otherwise one is created and added to the cache. -func (sc *SelectorCache) AddFQDNSelector(user CachedSelectionUser, lbls labels.LabelArray, fqdnSelec api.FQDNSelector) (cachedSelector CachedSelector, added bool) { - key := fqdnSelec.String() - - // Lock NameManager before the SelectorCache. Always. - // This is because SelectorCache and NameManager have interleaving locks, - // so we must always acquire the NameManager lock first - sc.localIdentityNotifier.Lock() - defer sc.localIdentityNotifier.Unlock() - sc.mutex.Lock() - defer sc.mutex.Unlock() - - // If the selector already exists, use it. - idSel, exists := sc.selectors[key] - if exists { - return idSel, idSel.addUser(user) - } - - source := &fqdnSelector{ - selector: fqdnSelec, - } - - // Make the FQDN subsystem aware of this selector and fetch ips - // that the FQDN subsystem is aware of. - currentIPs := sc.localIdentityNotifier.RegisterForIPUpdatesLocked(source.selector) - source.setSelectorIPs(currentIPs) - - return sc.addSelector(user, lbls, key, source) -} - -func (sc *SelectorCache) addSelector(user CachedSelectionUser, lbls labels.LabelArray, key string, source selectorSource) (CachedSelector, bool) { - idSel := &identitySelector{ - key: key, - users: make(map[CachedSelectionUser]struct{}), - cachedSelections: make(map[identity.NumericIdentity]struct{}), - source: source, - metadataLbls: lbls, - } - sc.selectors[key] = idSel - - // Scan the cached set of IDs to determine any new matchers - for nid, identity := range sc.idCache { - if idSel.source.matches(identity) { - idSel.cachedSelections[nid] = struct{}{} - } - } - - // Note: No notifications are sent for the existing - // identities. Caller must use GetSelections() to get the - // current selections after adding a selector. This way the - // behavior is the same between the two cases here (selector - // is already cached, or is a new one). - - // Create the immutable slice representation of the selected - // numeric identities - idSel.updateSelections() - - return idSel, idSel.addUser(user) - -} - -// FindCachedIdentitySelector finds the given api.EndpointSelector in the -// selector cache, returning nil if one can not be found. -func (sc *SelectorCache) FindCachedIdentitySelector(selector api.EndpointSelector) CachedSelector { - key := selector.CachedString() - sc.mutex.Lock() - idSel := sc.selectors[key] - sc.mutex.Unlock() - return idSel -} - -// AddIdentitySelector adds the given api.EndpointSelector in to the -// selector cache. If an identical EndpointSelector has already been -// cached, the corresponding CachedSelector is returned, otherwise one -// is created and added to the cache. -func (sc *SelectorCache) AddIdentitySelector(user CachedSelectionUser, lbls labels.LabelArray, selector api.EndpointSelector) (cachedSelector CachedSelector, added bool) { - // The key returned here may be different for equivalent - // labelselectors, if the selector's requirements are stored - // in different orders. When this happens we'll be tracking - // essentially two copies of the same selector. - key := selector.CachedString() - sc.mutex.Lock() - defer sc.mutex.Unlock() - idSel, exists := sc.selectors[key] - if exists { - return idSel, idSel.addUser(user) - } - - // Selectors are never modified once a rule is placed in the policy repository, - // so no need to deep copy. - source := &labelIdentitySelector{ - selector: selector, - } - // check is selector has a namespace match or requirement - if namespaces, ok := selector.GetMatch(labels.LabelSourceK8sKeyPrefix + k8sConst.PodNamespaceLabel); ok { - source.namespaces = namespaces - } - - return sc.addSelector(user, lbls, key, source) -} - -// lock must be held -func (sc *SelectorCache) removeSelectorLocked(selector CachedSelector, user CachedSelectionUser) { - key := selector.String() - sel, exists := sc.selectors[key] - if exists { - if sel.removeUser(user) { - sel.source.remove(sc.localIdentityNotifier) - delete(sc.selectors, key) - } - } -} - -// RemoveSelector removes CachedSelector for the user. -func (sc *SelectorCache) RemoveSelector(selector CachedSelector, user CachedSelectionUser) { - sc.localIdentityNotifier.Lock() - sc.mutex.Lock() - sc.removeSelectorLocked(selector, user) - sc.mutex.Unlock() - sc.localIdentityNotifier.Unlock() - -} - -// RemoveSelectors removes CachedSelectorSlice for the user. -func (sc *SelectorCache) RemoveSelectors(selectors CachedSelectorSlice, user CachedSelectionUser) { - sc.localIdentityNotifier.Lock() - sc.mutex.Lock() - for _, selector := range selectors { - sc.removeSelectorLocked(selector, user) - } - sc.mutex.Unlock() - sc.localIdentityNotifier.Unlock() -} - -// ChangeUser changes the CachedSelectionUser that gets updates on the -// updates on the cached selector. -func (sc *SelectorCache) ChangeUser(selector CachedSelector, from, to CachedSelectionUser) { - key := selector.String() - sc.mutex.Lock() - idSel, exists := sc.selectors[key] - if exists { - // Add before remove so that the count does not dip to zero in between, - // as this causes FQDN unregistration (if applicable). - idSel.addUser(to) - // ignoring the return value as we have just added a user above - idSel.removeUser(from) - } - sc.mutex.Unlock() -} - -// UpdateIdentities propagates identity updates to selectors -// -// The caller is responsible for making sure the same identity is not -// present in both 'added' and 'deleted'. -// -// Caller should Wait() on the returned sync.WaitGroup before triggering any -// policy updates. Policy updates may need Endpoint locks, so this Wait() can -// deadlock if the caller is holding any endpoint locks. -func (sc *SelectorCache) UpdateIdentities(added, deleted cache.IdentityCache, wg *sync.WaitGroup) { - sc.mutex.Lock() - defer sc.mutex.Unlock() - - // Update idCache so that newly added selectors get - // prepopulated with all matching numeric identities. - for numericID := range deleted { - if old, exists := sc.idCache[numericID]; exists { - log.WithFields(logrus.Fields{ - logfields.Identity: numericID, - logfields.Labels: old.lbls, - }).Debug("UpdateIdentities: Deleting identity") - delete(sc.idCache, numericID) - } else { - log.WithFields(logrus.Fields{ - logfields.Identity: numericID, - }).Warning("UpdateIdentities: Skipping Delete of a non-existing identity") - delete(deleted, numericID) - } - } - for numericID, lbls := range added { - if old, exists := sc.idCache[numericID]; exists { - // Skip if no change. Not skipping if label - // order is different, but identity labels are - // sorted for the kv-store, so there should - // not be too many false negatives. - if lbls.Equals(old.lbls) { - log.WithFields(logrus.Fields{ - logfields.Identity: numericID, - }).Debug("UpdateIdentities: Skipping add of an existing identical identity") - delete(added, numericID) - continue - } - scopedLog := log.WithFields(logrus.Fields{ - logfields.Identity: numericID, - logfields.Labels: old.lbls, - logfields.Labels + "(new)": lbls}, - ) - msg := "UpdateIdentities: Updating an existing identity" - // Warn if any other ID has their labels change, besides local - // host. The local host can have its labels change at runtime if - // the kube-apiserver is running on the local host, see - // ipcache.TriggerLabelInjection(). - if numericID == identity.ReservedIdentityHost { - scopedLog.Debug(msg) - } else { - scopedLog.Warning(msg) - } - } else { - log.WithFields(logrus.Fields{ - logfields.Identity: numericID, - logfields.Labels: lbls, - }).Debug("UpdateIdentities: Adding a new identity") - } - sc.idCache[numericID] = newIdentity(numericID, lbls) - } - - if len(deleted)+len(added) > 0 { - // Iterate through all locally used identity selectors and - // update the cached numeric identities as required. - for _, idSel := range sc.selectors { - var adds, dels []identity.NumericIdentity - for numericID := range deleted { - if _, exists := idSel.cachedSelections[numericID]; exists { - dels = append(dels, numericID) - delete(idSel.cachedSelections, numericID) - } - } - for numericID := range added { - if _, exists := idSel.cachedSelections[numericID]; !exists { - if idSel.source.matches(sc.idCache[numericID]) { - adds = append(adds, numericID) - idSel.cachedSelections[numericID] = struct{}{} - } - } - } - if len(dels)+len(adds) > 0 { - idSel.updateSelections() - idSel.notifyUsers(sc, adds, dels, wg) - } - } - } -} - -// GetNetsLocked returns the most specific CIDR for an identity. For the "World" identity -// it returns both IPv4 and IPv6. -func (sc *SelectorCache) GetNetsLocked(id identity.NumericIdentity) []*net.IPNet { - ident, ok := sc.idCache[id] - if !ok { - return nil - } - if !ident.computed { - log.WithFields(logrus.Fields{ - logfields.Identity: id, - logfields.Labels: ident.lbls, - }).Warning("GetNetsLocked: Identity with missing nets!") - } - return ident.nets -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/selectorcache_selector.go b/vendor/github.com/cilium/cilium/pkg/policy/selectorcache_selector.go deleted file mode 100644 index f98fb6228..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/selectorcache_selector.go +++ /dev/null @@ -1,339 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package policy - -import ( - "bytes" - "encoding/json" - "net/netip" - "sort" - "strings" - "sync" - "sync/atomic" - - "github.com/cilium/cilium/pkg/identity" - "github.com/cilium/cilium/pkg/labels" - "github.com/cilium/cilium/pkg/policy/api" -) - -// CachedSelector represents an identity selector owned by the selector cache -type CachedSelector interface { - // GetSelections returns the cached set of numeric identities - // selected by the CachedSelector. The retuned slice must NOT - // be modified, as it is shared among multiple users. - GetSelections() identity.NumericIdentitySlice - - // GetMetadataLabels returns metadata labels for additional context - // surrounding the selector. These are typically the labels associated with - // Cilium rules. - GetMetadataLabels() labels.LabelArray - - // Selects return 'true' if the CachedSelector selects the given - // numeric identity. - Selects(nid identity.NumericIdentity) bool - - // IsWildcard returns true if the endpoint selector selects - // all endpoints. - IsWildcard() bool - - // IsNone returns true if the selector never selects anything - IsNone() bool - - // String returns the string representation of this selector. - // Used as a map key. - String() string -} - -// CachedSelectorSlice is a slice of CachedSelectors that can be sorted. -type CachedSelectorSlice []CachedSelector - -// MarshalJSON returns the CachedSelectors as JSON formatted buffer -func (s CachedSelectorSlice) MarshalJSON() ([]byte, error) { - buffer := bytes.NewBufferString("[") - for i, selector := range s { - buf, err := json.Marshal(selector.String()) - if err != nil { - return nil, err - } - - buffer.Write(buf) - if i < len(s)-1 { - buffer.WriteString(",") - } - } - buffer.WriteString("]") - return buffer.Bytes(), nil -} - -func (s CachedSelectorSlice) Len() int { return len(s) } -func (s CachedSelectorSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } - -func (s CachedSelectorSlice) Less(i, j int) bool { - return strings.Compare(s[i].String(), s[j].String()) < 0 -} - -// SelectsAllEndpoints returns whether the CachedSelectorSlice selects all -// endpoints, which is true if the wildcard endpoint selector is present in the -// slice. -func (s CachedSelectorSlice) SelectsAllEndpoints() bool { - for _, selector := range s { - if selector.IsWildcard() { - return true - } - } - return false -} - -// CachedSelectionUser inserts selectors into the cache and gets update -// callbacks whenever the set of selected numeric identities change for -// the CachedSelectors pushed by it. -type CachedSelectionUser interface { - // IdentitySelectionUpdated implementations MUST NOT call back - // to the name manager or the selector cache while executing this function! - // - // The caller is responsible for making sure the same identity is not - // present in both 'added' and 'deleted'. - IdentitySelectionUpdated(selector CachedSelector, added, deleted []identity.NumericIdentity) -} - -// identitySelector is the internal type for all selectors in the -// selector cache. -// -// identitySelector represents the mapping of an EndpointSelector -// to a slice of identities. These mappings are updated via two -// different processes: -// -// 1. When policy rules are changed these are added and/or deleted -// depending on what selectors the rules contain. Cached selections of -// new identitySelectors are pre-populated from the set of currently -// known identities. -// -// 2. When reachable identities appear or disappear, either via local -// allocation (CIDRs), or via the KV-store (remote endpoints). In this -// case all existing identitySelectors are walked through and their -// cached selections are updated as necessary. -// -// In both of the above cases the set of existing identitySelectors is -// write locked. -// -// To minimize the upkeep the identity selectors are shared across -// all IdentityPolicies, so that only one copy exists for each -// identitySelector. Users of the SelectorCache take care of creating -// identitySelectors as needed by identity policies. The set of -// identitySelectors is read locked during an IdentityPolicy update so -// that the policy is always updated using a coherent set of -// cached selections. -// -// identitySelector is used as a map key, so it must not be implemented by a -// map, slice, or a func, or a runtime panic will be triggered. In all -// cases below identitySelector is being implemented by structs. -// -// identitySelector is used in the policy engine as a map key, -// so it must always be given to the user as a pointer to the actual type. -// (The public methods only expose the CachedSelector interface.) -type identitySelector struct { - source selectorSource - key string - selections atomic.Pointer[identity.NumericIdentitySlice] - users map[CachedSelectionUser]struct{} - cachedSelections map[identity.NumericIdentity]struct{} - metadataLbls labels.LabelArray -} - -// identitySelector implements CachedSelector -var _ CachedSelector = (*identitySelector)(nil) - -type selectorSource interface { - matches(scIdentity) bool - - remove(identityNotifier) -} - -// fqdnSelector is implemented as an updatable bag-of-labels. Any identity that matches -// any of the labels in wantLabels is selected. Unlike the identitySelector, this selector -// is "mutable" in that the FQDN subsystem may update the set of matched labels arbitrarily. -type fqdnSelector struct { - selector api.FQDNSelector - wantLabels labels.LabelArray // MUST be sorted -} - -func (f *fqdnSelector) remove(dnsProxy identityNotifier) { - dnsProxy.UnregisterForIPUpdatesLocked(f.selector) -} - -// setSelectorIPs updates the set of desired labels associated with this selector. -// lock must be held -func (f *fqdnSelector) setSelectorIPs(ips []netip.Addr) { - lbls := make(labels.LabelArray, 0, len(ips)) - for _, ip := range ips { - l, err := labels.IPStringToLabel(ip.String()) - if err != nil { - // not possible - continue - } - lbls = append(lbls, l) - } - lbls.Sort() - f.wantLabels = lbls -} - -// matches returns true if the identity contains at least one label -// that is in wantLabels. -func (f *fqdnSelector) matches(identity scIdentity) bool { - return identity.lbls.Intersects(f.wantLabels) -} - -type labelIdentitySelector struct { - selector api.EndpointSelector - namespaces []string // allowed namespaces, or "" -} - -// xxxMatches returns true if the CachedSelector matches given labels. -// This is slow, but only used for policy tracing, so it's OK. -func (l *labelIdentitySelector) xxxMatches(labels labels.LabelArray) bool { - return l.selector.Matches(labels) -} - -func (l *labelIdentitySelector) matchesNamespace(ns string) bool { - if len(l.namespaces) > 0 { - if ns != "" { - for i := range l.namespaces { - if ns == l.namespaces[i] { - return true - } - } - } - // namespace required, but no match - return false - } - // no namespace required, match - return true -} - -func (l *labelIdentitySelector) matches(identity scIdentity) bool { - return l.matchesNamespace(identity.namespace) && l.selector.Matches(identity.lbls) -} - -func (l *labelIdentitySelector) remove(_ identityNotifier) { - // only useful for fqdn selectors -} - -// lock must be held -// -// The caller is responsible for making sure the same identity is not -// present in both 'added' and 'deleted'. -func (i *identitySelector) notifyUsers(sc *SelectorCache, added, deleted []identity.NumericIdentity, wg *sync.WaitGroup) { - for user := range i.users { - // pass 'f' to the user as '*fqdnSelector' - sc.queueUserNotification(user, i, added, deleted, wg) - } -} - -// Equal is used by checker.Equals, and only considers the identity of the selector, -// ignoring the internal state! -func (i *identitySelector) Equal(b *identitySelector) bool { - return i.key == b.key -} - -// -// CachedSelector implementation (== Public API) -// -// No locking needed. -// - -// GetSelections returns the set of numeric identities currently -// selected. The cached selections can be concurrently updated. In -// that case GetSelections() will return either the old or new version -// of the selections. If the old version is returned, the user is -// guaranteed to receive a notification including the update. -func (i *identitySelector) GetSelections() identity.NumericIdentitySlice { - selections := i.selections.Load() - if selections == nil { - return emptySelection - } - return *selections -} - -func (i *identitySelector) GetMetadataLabels() labels.LabelArray { - return i.metadataLbls -} - -// Selects return 'true' if the CachedSelector selects the given -// numeric identity. -func (i *identitySelector) Selects(nid identity.NumericIdentity) bool { - if i.IsWildcard() { - return true - } - nids := i.GetSelections() - idx := sort.Search(len(nids), func(i int) bool { return nids[i] >= nid }) - return idx < len(nids) && nids[idx] == nid -} - -// IsWildcard returns true if the endpoint selector selects all -// endpoints. -func (i *identitySelector) IsWildcard() bool { - return i.key == wildcardSelectorKey -} - -// IsNone returns true if the endpoint selector never selects anything. -func (i *identitySelector) IsNone() bool { - return i.key == noneSelectorKey -} - -// String returns the map key for this selector -func (i *identitySelector) String() string { - return i.key -} - -// -// identitySelector implementation (== internal API) -// - -// lock must be held -func (i *identitySelector) addUser(user CachedSelectionUser) (added bool) { - if _, exists := i.users[user]; exists { - return false - } - i.users[user] = struct{}{} - return true -} - -// locks must be held for the dnsProxy and the SelectorCache (if the selector is a FQDN selector) -func (i *identitySelector) removeUser(user CachedSelectionUser) (last bool) { - delete(i.users, user) - return len(i.users) == 0 -} - -// lock must be held -func (i *identitySelector) numUsers() int { - return len(i.users) -} - -// updateSelections updates the immutable slice representation of the -// cached selections after the cached selections have been changed. -// -// lock must be held -func (i *identitySelector) updateSelections() { - selections := make(identity.NumericIdentitySlice, len(i.cachedSelections)) - idx := 0 - for nid := range i.cachedSelections { - selections[idx] = nid - idx++ - } - // Sort the numeric identities so that the map iteration order - // does not matter. This makes testing easier, but may help - // identifying changes easier also otherwise. - sort.Slice(selections, func(i, j int) bool { - return selections[i] < selections[j] - }) - i.setSelections(&selections) -} - -func (i *identitySelector) setSelections(selections *identity.NumericIdentitySlice) { - if len(*selections) > 0 { - i.selections.Store(selections) - } else { - i.selections.Store(&emptySelection) - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/trafficdirection/doc.go b/vendor/github.com/cilium/cilium/pkg/policy/trafficdirection/doc.go deleted file mode 100644 index 825578188..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/trafficdirection/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// package trafficdirection specifies the directionality of policy in a -// numeric representation. -package trafficdirection diff --git a/vendor/github.com/cilium/cilium/pkg/policy/trafficdirection/trafficdirection.go b/vendor/github.com/cilium/cilium/pkg/policy/trafficdirection/trafficdirection.go deleted file mode 100644 index 9b530cfc5..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/trafficdirection/trafficdirection.go +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package trafficdirection - -// TrafficDirection specifies the directionality of policy (ingress or egress). -type TrafficDirection uint8 - -const ( - // Invalid represents an invalid traffic direction. - Invalid TrafficDirection = 2 - - // Egress represents egress traffic. - Egress TrafficDirection = 1 - - // Ingress represents ingress traffic. - Ingress TrafficDirection = 0 -) - -// Uint8 normalizes the TrafficDirection for insertion into BPF maps. -func (td TrafficDirection) Uint8() uint8 { - return uint8(td) -} - -func (td TrafficDirection) String() string { - if td == Egress { - return "Egress" - } else if td == Ingress { - return "Ingress" - } - - return "Unknown" -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/trigger.go b/vendor/github.com/cilium/cilium/pkg/policy/trigger.go deleted file mode 100644 index bec4139b4..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/trigger.go +++ /dev/null @@ -1,90 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package policy - -import ( - "strings" - "sync" - - "github.com/cilium/cilium/pkg/endpoint/regeneration" - "github.com/cilium/cilium/pkg/metrics" - "github.com/cilium/cilium/pkg/option" - "github.com/cilium/cilium/pkg/time" - "github.com/cilium/cilium/pkg/trigger" -) - -// TriggerPolicyUpdates triggers the policy update trigger. -// -// To follow what the trigger does, see NewUpdater. -func (u *Updater) TriggerPolicyUpdates(force bool, reason string) { - if force { - log.Debugf("Artificially increasing policy revision to enforce policy recalculation") - u.repo.BumpRevision() - } - - u.TriggerWithReason(reason) -} - -// NewUpdater returns a new Updater instance to handle triggering policy -// updates ready for use. -func NewUpdater(r *Repository, regen regenerator) (*Updater, error) { - t, err := trigger.NewTrigger(trigger.Parameters{ - Name: "policy_update", - MetricsObserver: &TriggerMetrics{}, - MinInterval: option.Config.PolicyTriggerInterval, - // Triggers policy updates for every local endpoint. - // This may be called in a variety of situations: after policy changes, - // changes in agent configuration, changes in endpoint labels, and - // change of security identities. - TriggerFunc: func(reasons []string) { - log.Debug("Regenerating all endpoints") - reason := strings.Join(reasons, ", ") - - regenerationMetadata := ®eneration.ExternalRegenerationMetadata{ - Reason: reason, - RegenerationLevel: regeneration.RegenerateWithoutDatapath, - } - regen.RegenerateAllEndpoints(regenerationMetadata) - }, - }) - if err != nil { - return nil, err - } - return &Updater{ - Trigger: t, - repo: r, - }, nil -} - -// Updater is responsible for triggering policy updates, in order to perform -// policy recalculation. -type Updater struct { - *trigger.Trigger - - repo *Repository -} - -type regenerator interface { - // RegenerateAllEndpoints should trigger a regeneration of all endpoints. - RegenerateAllEndpoints(*regeneration.ExternalRegenerationMetadata) *sync.WaitGroup -} - -// TriggerMetrics handles the metrics for trigger policy recalculations. -type TriggerMetrics struct{} - -func (p *TriggerMetrics) QueueEvent(reason string) { - if metrics.TriggerPolicyUpdateTotal.IsEnabled() { - metrics.TriggerPolicyUpdateTotal.WithLabelValues(reason).Inc() - } -} - -func (p *TriggerMetrics) PostRun(duration, latency time.Duration, folds int) { - if metrics.TriggerPolicyUpdateCallDuration.IsEnabled() { - metrics.TriggerPolicyUpdateCallDuration.WithLabelValues("duration").Observe(duration.Seconds()) - metrics.TriggerPolicyUpdateCallDuration.WithLabelValues("latency").Observe(latency.Seconds()) - } - if metrics.TriggerPolicyUpdateFolds.IsEnabled() { - metrics.TriggerPolicyUpdateFolds.Set(float64(folds)) - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/utils.go b/vendor/github.com/cilium/cilium/pkg/policy/utils.go deleted file mode 100644 index fa3c48590..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/utils.go +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package policy - -import "github.com/cilium/cilium/pkg/labels" - -// JoinPath returns a joined path from a and b. -func JoinPath(a, b string) string { - return a + labels.PathDelimiter + b -} diff --git a/vendor/github.com/cilium/cilium/pkg/policy/visibility.go b/vendor/github.com/cilium/cilium/pkg/policy/visibility.go deleted file mode 100644 index 2994bf1f7..000000000 --- a/vendor/github.com/cilium/cilium/pkg/policy/visibility.go +++ /dev/null @@ -1,235 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package policy - -import ( - "fmt" - "regexp" - "strconv" - "strings" - - ciliumio "github.com/cilium/cilium/pkg/k8s/apis/cilium.io" - "github.com/cilium/cilium/pkg/labels" - "github.com/cilium/cilium/pkg/policy/api" - "github.com/cilium/cilium/pkg/u8proto" -) - -var ( - singleAnnotationRegex = "<(Ingress|Egress)/([1-9][0-9]{1,5})/(TCP|UDP|SCTP|ANY)/([A-Za-z]{3,32})>" - annotationRegex = regexp.MustCompile(fmt.Sprintf(`^((%s)(,(%s))*)$`, singleAnnotationRegex, singleAnnotationRegex)) -) - -func validateL7ProtocolWithDirection(dir string, proto L7ParserType) error { - switch proto { - case ParserTypeHTTP: - return nil - case ParserTypeDNS: - if dir == "Egress" { - return nil - } - case ParserTypeKafka: - return nil - default: - return fmt.Errorf("unsupported parser type %s", proto) - - } - return fmt.Errorf("%s not allowed with direction %s", proto, dir) -} - -// NewVisibilityPolicy generates the VisibilityPolicy that is encoded in the -// annotation parameter. -// Returns an error: -// - if the annotation does not correspond to the expected -// format for a visibility annotation. -// - if there is a conflict between the state encoded in the annotation (e.g., -// different L7 protocols for the same L4 port / protocol / traffic direction. -func NewVisibilityPolicy(anno, namespace, pod string) (*VisibilityPolicy, error) { - if !annotationRegex.MatchString(anno) { - return nil, fmt.Errorf("annotation for proxy visibility did not match expected format %s", annotationRegex.String()) - } - - nvp := &VisibilityPolicy{ - Ingress: make(DirectionalVisibilityPolicy), - Egress: make(DirectionalVisibilityPolicy), - } - - // TODO: look into using regex groups. - anSplit := strings.Split(anno, ",") - for i := range anSplit { - proxyAnnoSplit := strings.Split(anSplit[i], "/") - if len(proxyAnnoSplit) != 4 { - err := fmt.Errorf("invalid number of fields (%d) in annotation", len(proxyAnnoSplit)) - return nil, err - } - // Ingress|Egress - // Don't need to validate the content itself, regex already did that. - direction := proxyAnnoSplit[0][1:] - port := proxyAnnoSplit[1] - - portInt, err := strconv.ParseUint(port, 10, 16) - if err != nil { - return nil, fmt.Errorf("unable to parse port: %w", err) - } - - // Don't need to validate, regex already did that. - l4Proto := proxyAnnoSplit[2] - u8Prot, err := u8proto.ParseProtocol(l4Proto) - if err != nil { - return nil, fmt.Errorf("invalid L4 protocol %s", l4Proto) - } - - // ANY equates to TCP and UDP in the datapath; the datapath itself does - // not support 'Any' protocol paired with a port at L4. - var protos []u8proto.U8proto - if u8Prot == u8proto.ANY { - protos = append(protos, u8proto.TCP) - protos = append(protos, u8proto.UDP) - protos = append(protos, u8proto.SCTP) - } else { - protos = append(protos, u8Prot) - } - // Remove trailing '>'. - l7Protocol := L7ParserType(strings.ToLower(proxyAnnoSplit[3][:len(proxyAnnoSplit[3])-1])) - - if err := validateL7ProtocolWithDirection(direction, l7Protocol); err != nil { - return nil, err - } - - var dvp DirectionalVisibilityPolicy - var ingress bool - if direction == "Ingress" { - dvp = nvp.Ingress - ingress = true - } else { - dvp = nvp.Egress - ingress = false - } - - for _, prot := range protos { - pp := strconv.FormatUint(portInt, 10) + "/" + prot.String() - if res, ok := dvp[pp]; ok { - if res.Parser != l7Protocol { - return nil, fmt.Errorf("duplicate annotations with different L7 protocols %s and %s for %s", res.Parser, l7Protocol, pp) - } - } - - l7Meta := generateL7AllowAllRules(l7Protocol, namespace, pod) - - dvp[pp] = &VisibilityMetadata{ - Parser: l7Protocol, - Port: uint16(portInt), - Proto: prot, - Ingress: ingress, - L7Metadata: l7Meta, - } - } - } - - return nvp, nil -} - -func generateL7AllowAllRules(parser L7ParserType, namespace, pod string) L7DataMap { - var m L7DataMap - switch parser { - case ParserTypeDNS: - m = L7DataMap{} - // Create an entry to explicitly allow all at L7 for DNS. - emptyL3Selector := &identitySelector{source: &labelIdentitySelector{selector: api.WildcardEndpointSelector}, key: wildcardSelectorKey} - emptyL3Selector.metadataLbls = labels.LabelArray{ - labels.NewLabel(ciliumio.PolicyLabelDerivedFrom, "PodVisibilityAnnotation", labels.LabelSourceK8s), - } - if namespace != "" { - emptyL3Selector.metadataLbls = append(emptyL3Selector.metadataLbls, labels.NewLabel(ciliumio.PodNamespaceLabel, namespace, labels.LabelSourceK8s)) - } - if pod != "" { - emptyL3Selector.metadataLbls = append(emptyL3Selector.metadataLbls, labels.NewLabel(ciliumio.PodNameLabel, pod, labels.LabelSourceK8s)) - } - - m[emptyL3Selector] = &PerSelectorPolicy{ - L7Rules: api.L7Rules{ - DNS: []api.PortRuleDNS{ - { - MatchPattern: "*", - }, - }, - }, - } - } - return m -} - -// VisibilityMetadata encodes state about what type of traffic should be -// redirected to an L7Proxy. Implements the ProxyPolicy interface. -// TODO: an L4Filter could be composed of this type. -type VisibilityMetadata struct { - // Parser represents the proxy to which traffic should be redirected. - Parser L7ParserType - - // Port, in tandem with Proto, signifies which L4 port for which traffic - // should be redirected. - Port uint16 - - // Proto, in tandem with port, signifies which L4 protocol for which traffic - // should be redirected. - Proto u8proto.U8proto - - // Ingress specifies whether ingress traffic at the given L4 port / protocol - // should be redirected to the proxy. - Ingress bool - - // L7Metadata encodes optional information what is allowed at L7 for - // visibility. Some specific protocol parsers do not need this set for - // allowing of traffic (e.g., HTTP), but some do (e.g., DNS). - L7Metadata L7DataMap -} - -// DirectionalVisibilityPolicy is a mapping of VisibilityMetadata keyed by -// L4 Port / L4 Protocol (e.g., 80/TCP) for a given traffic direction (e.g., -// ingress or egress). This encodes at which L4 Port / L4 Protocol traffic -// should be redirected to a given L7 proxy. An empty instance of this type -// indicates that no traffic should be redirected. -type DirectionalVisibilityPolicy map[string]*VisibilityMetadata - -// VisibilityPolicy represents for both ingress and egress which types of -// traffic should be redirected to a given L7 proxy. -type VisibilityPolicy struct { - Ingress DirectionalVisibilityPolicy - Egress DirectionalVisibilityPolicy - Error error -} - -// CopyL7RulesPerEndpoint returns a shallow copy of the L7Metadata of the -// L4Filter. -func (v *VisibilityMetadata) CopyL7RulesPerEndpoint() L7DataMap { - if v.L7Metadata != nil { - return v.L7Metadata.ShallowCopy() - } - return nil -} - -// GetL7Parser returns the L7ParserType for this VisibilityMetadata. -func (v *VisibilityMetadata) GetL7Parser() L7ParserType { - return v.Parser -} - -// GetIngress returns whether the VisibilityMetadata applies at ingress or -// egress. -func (v *VisibilityMetadata) GetIngress() bool { - return v.Ingress -} - -// GetPort returns at which port the VisibilityMetadata applies. -func (v *VisibilityMetadata) GetPort() uint16 { - return v.Port -} - -// GetProtocol returns the protocol where the VisibilityMetadata applies. -func (v *VisibilityMetadata) GetProtocol() uint8 { - return uint8(v.Proto) -} - -// GetListener returns the optional listener name. -func (l4 *VisibilityMetadata) GetListener() string { - return "" -} diff --git a/vendor/github.com/cilium/cilium/pkg/promise/promise.go b/vendor/github.com/cilium/cilium/pkg/promise/promise.go deleted file mode 100644 index 1ca251eb0..000000000 --- a/vendor/github.com/cilium/cilium/pkg/promise/promise.go +++ /dev/null @@ -1,143 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package promise - -import ( - "context" - "sync" - - "github.com/cilium/cilium/pkg/lock" -) - -// A promise for a future value. -type Promise[T any] interface { - // Await blocks until the value is resolved or rejected. - Await(context.Context) (T, error) -} - -// Resolver can resolve or reject a promise. -// These methods are separate from 'Promise' to make it clear where the promise is resolved -// from. -type Resolver[T any] interface { - // Resolve a promise. Unblocks all Await()s. Future calls of Await() - // return the resolved value immediately. - // - // Only the first call to resolve (or reject) has an effect and - // further calls are ignored. - Resolve(T) - - // Reject a promise with an error. - Reject(error) -} - -// New creates a new promise for value T. -// Returns a resolver and the promise. -func New[T any]() (Resolver[T], Promise[T]) { - promise := &promise[T]{} - promise.cond = sync.NewCond(promise) - return promise, promise -} - -const ( - promiseUnresolved = iota - promiseResolved - promiseRejected -) - -type promise[T any] struct { - lock.Mutex - cond *sync.Cond - state int - value T - err error -} - -// Resolve informs all other codepaths who are Await()ing on the received -// promise that T is now successfully initialized and available for usage. -// -// Initialization logic for T should either call Resolve() or Reject(), and -// must not call these functions more than once. -func (p *promise[T]) Resolve(value T) { - p.Lock() - defer p.Unlock() - if p.state != promiseUnresolved { - return - } - p.state = promiseResolved - p.value = value - p.cond.Broadcast() -} - -// Reject informs all other codepaths who are Await()ing on the received -// promise that T could not be initialized and cannot be used to due the -// specified error reason. -// -// Initialization logic for T should either call Resolve() or Reject(), and -// must not call these functions more than once. -func (p *promise[T]) Reject(err error) { - p.Lock() - defer p.Unlock() - if p.state != promiseUnresolved { - return - } - p.state = promiseRejected - p.err = err - p.cond.Broadcast() -} - -// Await blocks until the promise has been resolved, rejected or context cancelled. -func (p *promise[T]) Await(ctx context.Context) (value T, err error) { - // Fork off a goroutine to wait for cancellation and wake up. - ctx, cancel := context.WithCancel(ctx) - defer cancel() - go func() { - <-ctx.Done() - p.cond.Broadcast() - }() - - p.Lock() - defer p.Unlock() - - // Wait until the promise is resolved or context cancelled. - for p.state == promiseUnresolved && (ctx == nil || ctx.Err() == nil) { - p.cond.Wait() - } - - if ctx.Err() != nil { - err = ctx.Err() - } else if p.state == promiseResolved { - value = p.value - } else { - err = p.err - } - return -} - -type wrappedPromise[T any] func(context.Context) (T, error) - -func (await wrappedPromise[T]) Await(ctx context.Context) (T, error) { - return await(ctx) -} - -// Map transforms the value of a promise with the provided function. -func Map[A, B any](p Promise[A], transform func(A) B) Promise[B] { - return wrappedPromise[B](func(ctx context.Context) (out B, err error) { - v, err := p.Await(ctx) - if err != nil { - return out, err - } - return transform(v), nil - }) -} - -// MapError transforms the error of a rejected promise with the provided function. -func MapError[A any](p Promise[A], transform func(error) error) Promise[A] { - return wrappedPromise[A](func(ctx context.Context) (out A, err error) { - v, err := p.Await(ctx) - if err != nil { - err = transform(err) - } - return v, err - }) -} diff --git a/vendor/github.com/cilium/cilium/pkg/rand/safe_rand.go b/vendor/github.com/cilium/cilium/pkg/rand/safe_rand.go deleted file mode 100644 index 9829484a1..000000000 --- a/vendor/github.com/cilium/cilium/pkg/rand/safe_rand.go +++ /dev/null @@ -1,87 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package rand - -import ( - "math/rand" - - "github.com/cilium/cilium/pkg/lock" -) - -// SafeRand is a concurrency-safe source of pseudo-random numbers. The Go -// stdlib's math/rand.Source is not concurrency-safe. The global source in -// math/rand would be concurrency safe (due to its internal use of -// lockedSource), but it is prone to inter-package interference with the PRNG -// state. -// Also see https://github.com/cilium/cilium/issues/10988 -type SafeRand struct { - mu lock.Mutex - r *rand.Rand -} - -func NewSafeRand(seed int64) *SafeRand { - return &SafeRand{r: rand.New(rand.NewSource(seed))} -} - -func (sr *SafeRand) Seed(seed int64) { - sr.mu.Lock() - sr.r.Seed(seed) - sr.mu.Unlock() -} - -func (sr *SafeRand) Int63() int64 { - sr.mu.Lock() - v := sr.r.Int63() - sr.mu.Unlock() - return v -} - -func (sr *SafeRand) Int63n(n int64) int64 { - sr.mu.Lock() - v := sr.r.Int63n(n) - sr.mu.Unlock() - return v -} - -func (sr *SafeRand) Uint32() uint32 { - sr.mu.Lock() - v := sr.r.Uint32() - sr.mu.Unlock() - return v -} - -func (sr *SafeRand) Uint64() uint64 { - sr.mu.Lock() - v := sr.r.Uint64() - sr.mu.Unlock() - return v -} - -func (sr *SafeRand) Intn(n int) int { - sr.mu.Lock() - v := sr.r.Intn(n) - sr.mu.Unlock() - return v -} - -func (sr *SafeRand) Float64() float64 { - sr.mu.Lock() - v := sr.r.Float64() - sr.mu.Unlock() - return v -} - -func (sr *SafeRand) Perm(n int) []int { - sr.mu.Lock() - v := sr.r.Perm(n) - sr.mu.Unlock() - return v - -} - -func (sr *SafeRand) Shuffle(n int, swap func(i, j int)) { - sr.mu.Lock() - sr.r.Shuffle(n, swap) - sr.mu.Unlock() -} diff --git a/vendor/github.com/cilium/cilium/pkg/rate/api_limiter.go b/vendor/github.com/cilium/cilium/pkg/rate/api_limiter.go deleted file mode 100644 index e89091b4e..000000000 --- a/vendor/github.com/cilium/cilium/pkg/rate/api_limiter.go +++ /dev/null @@ -1,929 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package rate - -import ( - "context" - "errors" - "fmt" - "math" - "strconv" - "strings" - - "github.com/google/uuid" - "github.com/sirupsen/logrus" - "golang.org/x/sync/semaphore" - "golang.org/x/time/rate" - - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/time" -) - -var ( - log = logging.DefaultLogger.WithField(logfields.LogSubsys, "rate") - ErrWaitCancelled = errors.New("request cancelled while waiting for rate limiting slot") -) - -const ( - defaultMeanOver = 10 - defaultDelayedAdjustmentFactor = 0.50 - defaultMaxAdjustmentFactor = 100.0 - - // waitSemaphoreWeight is the maximum resolution of the wait semaphore, - // the higher this value, the more accurate the ParallelRequests - // requirement is implemented - waitSemaphoreResolution = 10000000 - - // logUUID is the UUID of the request. - logUUID = "uuid" - // logAPICallName is the name of the underlying API call, such as - // "endpoint-create". - logAPICallName = "name" - // logProcessingDuration is the time taken to perform the actual underlying - // API call such as creating an endpoint or deleting an endpoint. This is - // the time between when the request has finished waiting (or being - // delayed), to when the underlying action has finished. - logProcessingDuration = "processingDuration" - // logParallelRequests is the number of allowed parallel requests. See - // APILimiter.parallelRequests. - logParallelRequests = "parallelRequests" - // logMinWaitDuration represents APILimiterParameters.MinWaitDuration. - logMinWaitDuration = "minWaitDuration" - // logMaxWaitDuration represents APILimiterParameters.MaxWaitDuration. - logMaxWaitDuration = "maxWaitDuration" - // logMaxWaitDurationLimiter is the actual / calculated maximum threshold - // for a request to wait. Any request exceeding this threshold will not be - // processed. - logMaxWaitDurationLimiter = "maxWaitDurationLimiter" - // logWaitDurationLimit is the actual / calculated amount of time - // determined by the underlying rate-limiting library that this request - // must wait before the rate limiter releases it, so that it can take the - // underlying action. See golang.org/x/time/rate.(*Reservation).Delay(). - logWaitDurationLimit = "waitDurationLimiter" - // logWaitDurationTotal is the actual total amount of time that this - // request spent waiting to be released by the rate limiter. - logWaitDurationTotal = "waitDurationTotal" - // logLimit is the rate limit. See APILimiterParameters.RateLimit. - logLimit = "limit" - // logLimit is the burst rate. See APILimiterParameters.RateBurst. - logBurst = "burst" - // logTotalDuration is the total time between when the request was first - // scheduled (entered the rate limiter) to when it completed processing of - // the underlying action. This is the absolute total time of the request - // from beginning to end. - logTotalDuration = "totalDuration" - // logSkipped represents whether the rate limiter will skip rate-limiting - // this request. See APILimiterParameters.SkipInitial. - logSkipped = "rateLimiterSkipped" -) - -type outcome string - -const ( - outcomeParallelMaxWait outcome = "fail-parallel-wait" - outcomeLimitMaxWait outcome = "fail-limit-wait" - outcomeReqCancelled outcome = "request-cancelled" - outcomeErrorCode int = 429 - outcomeSuccessCode int = 200 -) - -// APILimiter is an extension to x/time/rate.Limiter specifically for Cilium -// API calls. It allows to automatically adjust the rate, burst and maximum -// parallel API calls to stay as close as possible to an estimated processing -// time. -type APILimiter struct { - // name is the name of the API call. This field is immutable after - // NewAPILimiter() - name string - - // params is the parameters of the limiter. This field is immutable - // after NewAPILimiter() - params APILimiterParameters - - // metrics points to the metrics implementation provided by the caller - // of the APILimiter. This field is immutable after NewAPILimiter() - metrics MetricsObserver - - // mutex protects all fields below this line - mutex lock.RWMutex - - // meanProcessingDuration is the latest mean processing duration, - // calculated based on processingDurations - meanProcessingDuration float64 - - // processingDurations is the last params.MeanOver processing durations - processingDurations []time.Duration - - // meanWaitDuration is the latest mean wait duration, calculated based - // on waitDurations - meanWaitDuration float64 - - // waitDurations is the last params.MeanOver wait durations - waitDurations []time.Duration - - // parallelRequests is the currently allowed maximum parallel - // requests. This defaults to params.MaxParallel requests and is then - // adjusted automatically if params.AutoAdjust is enabled. - parallelRequests int - - // adjustmentFactor is the latest adjustment factor. It is the ratio - // between params.EstimatedProcessingDuration and - // meanProcessingDuration. - adjustmentFactor float64 - - // limiter is the rate limiter based on params.RateLimit and - // params.RateBurst. - limiter *rate.Limiter - - // currentRequestsInFlight is the number of parallel API requests - // currently in flight - currentRequestsInFlight int - - // requestsProcessed is the total number of processed requests - requestsProcessed int64 - - // requestsScheduled is the total number of scheduled requests - requestsScheduled int64 - - // parallelWaitSemaphore is the semaphore used to implement - // params.MaxParallel. It is initialized with a capacity of - // waitSemaphoreResolution and each API request will acquire - // waitSemaphoreResolution/params.MaxParallel tokens. - parallelWaitSemaphore *semaphore.Weighted -} - -// APILimiterParameters is the configuration of an APILimiter. The structure -// may not be mutated after it has been passed into NewAPILimiter(). -type APILimiterParameters struct { - // EstimatedProcessingDuration is the estimated duration an API call - // will take. This value is used if AutoAdjust is enabled to - // automatically adjust rate limits to stay as close as possible to the - // estimated processing duration. - EstimatedProcessingDuration time.Duration - - // AutoAdjust enables automatic adjustment of the values - // ParallelRequests, RateLimit, and RateBurst in order to keep the - // mean processing duration close to EstimatedProcessingDuration - AutoAdjust bool - - // MeanOver is the number of entries to keep in order to calculate the - // mean processing and wait duration - MeanOver int - - // ParallelRequests is the parallel requests allowed. If AutoAdjust is - // enabled, the value will adjust automatically. - ParallelRequests int - - // MaxParallelRequests is the maximum parallel requests allowed. If - // AutoAdjust is enabled, then the ParalelRequests will never grow - // above MaxParallelRequests. - MaxParallelRequests int - - // MinParallelRequests is the minimum parallel requests allowed. If - // AutoAdjust is enabled, then the ParallelRequests will never fall - // below MinParallelRequests. - MinParallelRequests int - - // RateLimit is the initial number of API requests allowed per second. - // If AutoAdjust is enabled, the value will adjust automatically. - RateLimit rate.Limit - - // RateBurst is the initial allowed burst of API requests allowed. If - // AutoAdjust is enabled, the value will adjust automatically. - RateBurst int - - // MinWaitDuration is the minimum time an API request always has to - // wait before the Wait() function returns an error. - MinWaitDuration time.Duration - - // MaxWaitDuration is the maximum time an API request is allowed to - // wait before the Wait() function returns an error. - MaxWaitDuration time.Duration - - // Log enables info logging of processed API requests. This should only - // be used for low frequency API calls. - Log bool - - // DelayedAdjustmentFactor is percentage of the AdjustmentFactor to be - // applied to RateBurst and MaxWaitDuration defined as a value between - // 0.0..1.0. This is used to steer a slower reaction of the RateBurst - // and ParallelRequests compared to RateLimit. - DelayedAdjustmentFactor float64 - - // SkipInitial is the number of initial API calls for which to not - // apply any rate limiting. This is useful to define a learning phase - // in the beginning to allow for auto adjustment before imposing wait - // durations and rate limiting on API calls. - SkipInitial int - - // MaxAdjustmentFactor is the maximum adjustment factor when AutoAdjust - // is enabled. Base values will not adjust more than by this factor. - MaxAdjustmentFactor float64 -} - -// MergeUserConfig merges the provided user configuration into the existing -// parameters and returns a new copy. -func (p APILimiterParameters) MergeUserConfig(config string) (APILimiterParameters, error) { - if err := (&p).mergeUserConfig(config); err != nil { - return APILimiterParameters{}, err - } - - return p, nil -} - -// NewAPILimiter returns a new APILimiter based on the parameters and metrics implementation -func NewAPILimiter(name string, p APILimiterParameters, metrics MetricsObserver) *APILimiter { - if p.MeanOver == 0 { - p.MeanOver = defaultMeanOver - } - - if p.MinParallelRequests == 0 { - p.MinParallelRequests = 1 - } - - if p.RateBurst == 0 { - p.RateBurst = 1 - } - - if p.DelayedAdjustmentFactor == 0.0 { - p.DelayedAdjustmentFactor = defaultDelayedAdjustmentFactor - } - - if p.MaxAdjustmentFactor == 0.0 { - p.MaxAdjustmentFactor = defaultMaxAdjustmentFactor - } - - l := &APILimiter{ - name: name, - params: p, - parallelRequests: p.ParallelRequests, - parallelWaitSemaphore: semaphore.NewWeighted(waitSemaphoreResolution), - metrics: metrics, - } - - if p.RateLimit != 0 { - l.limiter = rate.NewLimiter(p.RateLimit, p.RateBurst) - } - - return l -} - -// NewAPILimiterFromConfig returns a new APILimiter based on user configuration -func NewAPILimiterFromConfig(name, config string, metrics MetricsObserver) (*APILimiter, error) { - p := &APILimiterParameters{} - - if err := p.mergeUserConfig(config); err != nil { - return nil, err - } - - return NewAPILimiter(name, *p, metrics), nil -} - -func (p *APILimiterParameters) mergeUserConfigKeyValue(key, value string) error { - switch strings.ToLower(key) { - case "rate-limit": - limit, err := parseRate(value) - if err != nil { - return fmt.Errorf("unable to parse rate %q: %w", value, err) - } - p.RateLimit = limit - case "rate-burst": - burst, err := parsePositiveInt(value) - if err != nil { - return err - } - p.RateBurst = burst - case "min-wait-duration": - minWaitDuration, err := time.ParseDuration(value) - if err != nil { - return fmt.Errorf("unable to parse duration %q: %w", value, err) - } - p.MinWaitDuration = minWaitDuration - case "max-wait-duration": - maxWaitDuration, err := time.ParseDuration(value) - if err != nil { - return fmt.Errorf("unable to parse duration %q: %w", value, err) - } - p.MaxWaitDuration = maxWaitDuration - case "estimated-processing-duration": - estProcessingDuration, err := time.ParseDuration(value) - if err != nil { - return fmt.Errorf("unable to parse duration %q: %w", value, err) - } - p.EstimatedProcessingDuration = estProcessingDuration - case "auto-adjust": - v, err := strconv.ParseBool(value) - if err != nil { - return fmt.Errorf("unable to parse bool %q: %w", value, err) - } - p.AutoAdjust = v - case "parallel-requests": - parallel, err := parsePositiveInt(value) - if err != nil { - return err - } - p.ParallelRequests = parallel - case "min-parallel-requests": - minParallel, err := parsePositiveInt(value) - if err != nil { - return err - } - p.MinParallelRequests = minParallel - case "max-parallel-requests": - maxParallel, err := parsePositiveInt(value) - if err != nil { - return err - } - p.MaxParallelRequests = int(maxParallel) - case "mean-over": - meanOver, err := parsePositiveInt(value) - if err != nil { - return err - } - p.MeanOver = meanOver - case "log": - v, err := strconv.ParseBool(value) - if err != nil { - return fmt.Errorf("unable to parse bool %q: %w", value, err) - } - p.Log = v - case "delayed-adjustment-factor": - delayedAdjustmentFactor, err := strconv.ParseFloat(value, 64) - if err != nil { - return fmt.Errorf("unable to parse float %q: %w", value, err) - } - p.DelayedAdjustmentFactor = delayedAdjustmentFactor - case "max-adjustment-factor": - maxAdjustmentFactor, err := strconv.ParseFloat(value, 64) - if err != nil { - return fmt.Errorf("unable to parse float %q: %w", value, err) - } - p.MaxAdjustmentFactor = maxAdjustmentFactor - case "skip-initial": - skipInitial, err := parsePositiveInt(value) - if err != nil { - return err - } - p.SkipInitial = skipInitial - default: - return fmt.Errorf("unknown rate limiting option %q", key) - } - - return nil -} - -func (p *APILimiterParameters) mergeUserConfig(config string) error { - tokens := strings.Split(config, ",") - for _, token := range tokens { - if token == "" { - continue - } - - t := strings.SplitN(token, ":", 2) - if len(t) != 2 { - return fmt.Errorf("unable to parse rate limit option %q, must in the form name=option:value[,option:value]", token) - } - - if err := p.mergeUserConfigKeyValue(t[0], t[1]); err != nil { - return fmt.Errorf("unable to parse rate limit option %q with value %q: %w", t[0], t[1], err) - } - } - - return nil -} - -func (l *APILimiter) Parameters() APILimiterParameters { - return l.params -} - -// SetRateLimit sets the rate limit of the limiter. If limiter is unset, a new -// Limiter is created using the rate burst set in the parameters. -func (l *APILimiter) SetRateLimit(limit rate.Limit) { - l.mutex.Lock() - defer l.mutex.Unlock() - if l.limiter != nil { - l.limiter.SetLimit(limit) - } else { - l.limiter = rate.NewLimiter(limit, l.params.RateBurst) - } -} - -// SetRateBurst sets the rate burst of the limiter. If limiter is unset, a new -// Limiter is created using the rate limit set in the parameters. -func (l *APILimiter) SetRateBurst(burst int) { - l.mutex.Lock() - defer l.mutex.Unlock() - if l.limiter != nil { - l.limiter.SetBurst(burst) - } else { - l.limiter = rate.NewLimiter(l.params.RateLimit, burst) - } -} - -func (l *APILimiter) delayedAdjustment(current, min, max float64) (n float64) { - n = current * l.adjustmentFactor - n = current + ((n - current) * l.params.DelayedAdjustmentFactor) - if min > 0.0 && n < min { - n = min - } - if max > 0.0 && n > max { - n = max - } - return -} - -func (l *APILimiter) calculateAdjustmentFactor() float64 { - f := l.params.EstimatedProcessingDuration.Seconds() / l.meanProcessingDuration - if f > l.params.MaxAdjustmentFactor { - f = l.params.MaxAdjustmentFactor - } - if f < 1.0/l.params.MaxAdjustmentFactor { - f = 1.0 / l.params.MaxAdjustmentFactor - } - return f -} - -func (l *APILimiter) adjustmentLimit(newValue, initialValue float64) float64 { - return math.Max(initialValue/l.params.MaxAdjustmentFactor, math.Min(initialValue*l.params.MaxAdjustmentFactor, newValue)) -} - -func (l *APILimiter) adjustedBurst() int { - newBurst := l.delayedAdjustment(float64(l.params.RateBurst), float64(l.params.MinParallelRequests), 0.0) - return int(math.Round(l.adjustmentLimit(newBurst, float64(l.params.RateBurst)))) -} - -func (l *APILimiter) adjustedLimit() rate.Limit { - newLimit := rate.Limit(float64(l.params.RateLimit) * l.adjustmentFactor) - return rate.Limit(l.adjustmentLimit(float64(newLimit), float64(l.params.RateLimit))) -} - -func (l *APILimiter) adjustedParallelRequests() int { - newParallelRequests := l.delayedAdjustment(float64(l.params.ParallelRequests), - float64(l.params.MinParallelRequests), float64(l.params.MaxParallelRequests)) - return int(l.adjustmentLimit(newParallelRequests, float64(l.params.ParallelRequests))) -} - -func (l *APILimiter) requestFinished(r *limitedRequest, err error, code int) { - if r.finished { - return - } - - r.finished = true - - var processingDuration time.Duration - if !r.startTime.IsZero() { - processingDuration = time.Since(r.startTime) - } - - totalDuration := time.Since(r.scheduleTime) - - scopedLog := log.WithFields(logrus.Fields{ - logAPICallName: l.name, - logUUID: r.uuid, - logProcessingDuration: processingDuration, - logTotalDuration: totalDuration, - logWaitDurationTotal: r.waitDuration, - }) - - if err != nil { - scopedLog = scopedLog.WithError(err) - } - - if l.params.Log { - scopedLog.Info("API call has been processed") - } else { - scopedLog.Debug("API call has been processed") - } - - if r.waitSemaphoreWeight != 0 { - l.parallelWaitSemaphore.Release(r.waitSemaphoreWeight) - } - - l.mutex.Lock() - - if !r.startTime.IsZero() { - l.requestsProcessed++ - l.currentRequestsInFlight-- - } - - // Only auto-adjust ratelimiter using metrics from successful API requests - if err == nil { - l.processingDurations = append(l.processingDurations, processingDuration) - if exceed := len(l.processingDurations) - l.params.MeanOver; exceed > 0 { - l.processingDurations = l.processingDurations[exceed:] - } - l.meanProcessingDuration = calcMeanDuration(l.processingDurations) - - l.waitDurations = append(l.waitDurations, r.waitDuration) - if exceed := len(l.waitDurations) - l.params.MeanOver; exceed > 0 { - l.waitDurations = l.waitDurations[exceed:] - } - l.meanWaitDuration = calcMeanDuration(l.waitDurations) - - if l.params.AutoAdjust && l.params.EstimatedProcessingDuration != 0 { - l.adjustmentFactor = l.calculateAdjustmentFactor() - l.parallelRequests = l.adjustedParallelRequests() - - if l.limiter != nil { - l.limiter.SetLimit(l.adjustedLimit()) - - newBurst := l.adjustedBurst() - l.limiter.SetBurst(newBurst) - } - } - } - - values := MetricsValues{ - EstimatedProcessingDuration: l.params.EstimatedProcessingDuration.Seconds(), - WaitDuration: r.waitDuration, - MaxWaitDuration: l.params.MaxWaitDuration, - MinWaitDuration: l.params.MinWaitDuration, - MeanProcessingDuration: l.meanProcessingDuration, - MeanWaitDuration: l.meanWaitDuration, - ParallelRequests: l.parallelRequests, - CurrentRequestsInFlight: l.currentRequestsInFlight, - AdjustmentFactor: l.adjustmentFactor, - Error: err, - Outcome: string(r.outcome), - ReturnCode: code, - } - - if l.limiter != nil { - values.Limit = l.limiter.Limit() - values.Burst = l.limiter.Burst() - } - l.mutex.Unlock() - - if l.metrics != nil { - l.metrics.ProcessedRequest(l.name, values) - } -} - -// calcMeanDuration returns the mean duration in seconds -func calcMeanDuration(durations []time.Duration) float64 { - total := 0.0 - for _, t := range durations { - total += t.Seconds() - } - return total / float64(len(durations)) -} - -// LimitedRequest represents a request that is being limited. It is returned -// by Wait() and the caller of Wait() is responsible to call Done() or Error() -// when the API call has been processed or resulted in an error. It is safe to -// call Error() and then Done(). It is not safe to call Done(), Error(), or -// WaitDuration() concurrently. -type LimitedRequest interface { - Done() - Error(err error, code int) - WaitDuration() time.Duration -} - -type limitedRequest struct { - limiter *APILimiter - startTime time.Time - scheduleTime time.Time - waitDuration time.Duration - waitSemaphoreWeight int64 - uuid string - finished bool - outcome outcome -} - -// WaitDuration returns the duration the request had to wait -func (l *limitedRequest) WaitDuration() time.Duration { - return l.waitDuration -} - -// Done must be called when the API request has been successfully processed -func (l *limitedRequest) Done() { - l.limiter.requestFinished(l, nil, outcomeSuccessCode) -} - -// Error must be called when the API request resulted in an error -func (l *limitedRequest) Error(err error, code int) { - l.limiter.requestFinished(l, err, code) -} - -// Wait blocks until the next API call is allowed to be processed. If the -// configured MaxWaitDuration is exceeded, an error is returned. On success, a -// LimitedRequest is returned on which Done() must be called when the API call -// has completed or Error() if an error occurred. -func (l *APILimiter) Wait(ctx context.Context) (LimitedRequest, error) { - req, err := l.wait(ctx) - if err != nil { - l.requestFinished(req, err, outcomeErrorCode) - return nil, err - } - return req, nil -} - -// wait implements the API rate limiting delaying functionality. Every error -// message and corresponding log message are documented in -// Documentation/configuration/api-rate-limiting.rst. If any changes related to -// errors or log messages are made to this function, please update the -// aforementioned page as well. -func (l *APILimiter) wait(ctx context.Context) (req *limitedRequest, err error) { - var ( - limitWaitDuration time.Duration - r *rate.Reservation - ) - - req = &limitedRequest{ - limiter: l, - scheduleTime: time.Now(), - uuid: uuid.New().String(), - } - - l.mutex.Lock() - - l.requestsScheduled++ - - scopedLog := log.WithFields(logrus.Fields{ - logAPICallName: l.name, - logUUID: req.uuid, - logParallelRequests: l.parallelRequests, - }) - - if l.params.MaxWaitDuration > 0 { - scopedLog = scopedLog.WithField(logMaxWaitDuration, l.params.MaxWaitDuration) - } - - if l.params.MinWaitDuration > 0 { - scopedLog = scopedLog.WithField(logMinWaitDuration, l.params.MinWaitDuration) - } - - select { - case <-ctx.Done(): - if l.params.Log { - scopedLog.Warning("Not processing API request due to cancelled context") - } - l.mutex.Unlock() - req.outcome = outcomeReqCancelled - err = fmt.Errorf("%w: %w", ErrWaitCancelled, ctx.Err()) - return - default: - } - - skip := l.params.SkipInitial > 0 && l.requestsScheduled <= int64(l.params.SkipInitial) - if skip { - scopedLog = scopedLog.WithField(logSkipped, skip) - } - - parallelRequests := l.parallelRequests - meanProcessingDuration := l.meanProcessingDuration - l.mutex.Unlock() - - if l.params.Log { - scopedLog.Info("Processing API request with rate limiter") - } else { - scopedLog.Debug("Processing API request with rate limiter") - } - - if skip { - goto skipRateLimiter - } - - if parallelRequests > 0 { - waitCtx := ctx - if l.params.MaxWaitDuration > 0 { - ctx2, cancel := context.WithTimeout(ctx, l.params.MaxWaitDuration) - defer cancel() - waitCtx = ctx2 - } - w := int64(waitSemaphoreResolution / parallelRequests) - err2 := l.parallelWaitSemaphore.Acquire(waitCtx, w) - if err2 != nil { - if l.params.Log { - scopedLog.WithError(err2).Warning("Not processing API request. Wait duration for maximum parallel requests exceeds maximum") - } - req.outcome = outcomeParallelMaxWait - err = fmt.Errorf("timed out while waiting to be served with %d parallel requests: %w", parallelRequests, err2) - return - } - req.waitSemaphoreWeight = w - } - req.waitDuration = time.Since(req.scheduleTime) - - l.mutex.Lock() - if l.limiter != nil { - r = l.limiter.Reserve() - limitWaitDuration = r.Delay() - - scopedLog = scopedLog.WithFields(logrus.Fields{ - logLimit: fmt.Sprintf("%.2f/s", l.limiter.Limit()), - logBurst: l.limiter.Burst(), - logWaitDurationLimit: limitWaitDuration, - logMaxWaitDurationLimiter: l.params.MaxWaitDuration - req.waitDuration, - }) - } - l.mutex.Unlock() - - if l.params.MinWaitDuration > 0 && limitWaitDuration < l.params.MinWaitDuration { - limitWaitDuration = l.params.MinWaitDuration - } - - if (l.params.MaxWaitDuration > 0 && (limitWaitDuration+req.waitDuration) > l.params.MaxWaitDuration) || limitWaitDuration == rate.InfDuration { - if l.params.Log { - scopedLog.Warning("Not processing API request. Wait duration exceeds maximum") - } - - // The rate limiter should only consider a reservation valid if - // the request is actually processed. Cancellation of the - // reservation should happen before we sleep below. - if r != nil { - r.Cancel() - } - - // Instead of returning immediately, pace the caller by - // sleeping for the mean processing duration. This helps - // against callers who disrespect 429 error codes and retry - // immediately. - if meanProcessingDuration > 0.0 { - time.Sleep(time.Duration(meanProcessingDuration * float64(time.Second))) - } - - req.outcome = outcomeLimitMaxWait - err = fmt.Errorf("request would have to wait %v to be served (maximum wait duration: %v)", - limitWaitDuration, l.params.MaxWaitDuration-req.waitDuration) - return - } - - if limitWaitDuration != 0 { - select { - case <-time.After(limitWaitDuration): - case <-ctx.Done(): - if l.params.Log { - scopedLog.Warning("Not processing API request due to cancelled context while waiting") - } - // The rate limiter should only consider a reservation - // valid if the request is actually processed. - if r != nil { - r.Cancel() - } - - req.outcome = outcomeReqCancelled - err = fmt.Errorf("%w: %w", ErrWaitCancelled, ctx.Err()) - return - } - } - - req.waitDuration = time.Since(req.scheduleTime) - -skipRateLimiter: - - l.mutex.Lock() - l.currentRequestsInFlight++ - l.mutex.Unlock() - - scopedLog = scopedLog.WithField(logWaitDurationTotal, req.waitDuration) - - if l.params.Log { - scopedLog.Info("API request released by rate limiter") - } else { - scopedLog.Debug("API request released by rate limiter") - } - - req.startTime = time.Now() - return req, nil - -} - -func parseRate(r string) (rate.Limit, error) { - tokens := strings.SplitN(r, "/", 2) - if len(tokens) != 2 { - return 0, fmt.Errorf("not in the form number/interval") - } - - f, err := strconv.ParseFloat(tokens[0], 64) - if err != nil { - return 0, fmt.Errorf("unable to parse float %q: %w", tokens[0], err) - } - - // Reject rates such as 1/1 or 10/10 as it will default to nanoseconds - // which is likely unexpected to the user. Require an explicit suffix. - if _, err := strconv.ParseInt(string(tokens[1]), 10, 64); err == nil { - return 0, fmt.Errorf("interval %q must contain duration suffix", tokens[1]) - } - - // If duration is provided as "m" or "s", convert it into "1m" or "1s" - if _, err := strconv.ParseInt(string(tokens[1][0]), 10, 64); err != nil { - tokens[1] = "1" + tokens[1] - } - - d, err := time.ParseDuration(tokens[1]) - if err != nil { - return 0, fmt.Errorf("unable to parse duration %q: %w", tokens[1], err) - } - - return rate.Limit(f / d.Seconds()), nil -} - -// APILimiterSet is a set of APILimiter indexed by name -type APILimiterSet struct { - limiters map[string]*APILimiter - metrics MetricsObserver -} - -// MetricsValues is the snapshot of relevant values to feed into the -// MetricsObserver -type MetricsValues struct { - WaitDuration time.Duration - MinWaitDuration time.Duration - MaxWaitDuration time.Duration - Outcome string - MeanProcessingDuration float64 - MeanWaitDuration float64 - EstimatedProcessingDuration float64 - ParallelRequests int - Limit rate.Limit - Burst int - CurrentRequestsInFlight int - AdjustmentFactor float64 - Error error - ReturnCode int -} - -// MetricsObserver is the interface that must be implemented to extract metrics -type MetricsObserver interface { - // ProcessedRequest is invoked after invocation of an API call - ProcessedRequest(name string, values MetricsValues) -} - -// NewAPILimiterSet creates a new APILimiterSet based on a set of rate limiting -// configurations and the default configuration. Any rate limiter that is -// configured in the config OR the defaults will be configured and made -// available via the Limiter(name) and Wait() function. -func NewAPILimiterSet(config map[string]string, defaults map[string]APILimiterParameters, metrics MetricsObserver) (*APILimiterSet, error) { - limiters := map[string]*APILimiter{} - - for name, p := range defaults { - // Merge user config into defaults when provided - if userConfig, ok := config[name]; ok { - combinedParams, err := p.MergeUserConfig(userConfig) - if err != nil { - return nil, err - } - p = combinedParams - } - - limiters[name] = NewAPILimiter(name, p, metrics) - } - - for name, c := range config { - if _, ok := defaults[name]; !ok { - l, err := NewAPILimiterFromConfig(name, c, metrics) - if err != nil { - return nil, fmt.Errorf("unable to parse rate limiting configuration %s=%s: %w", name, c, err) - } - - limiters[name] = l - } - } - - return &APILimiterSet{ - limiters: limiters, - metrics: metrics, - }, nil -} - -// Limiter returns the APILimiter with a given name -func (s *APILimiterSet) Limiter(name string) *APILimiter { - return s.limiters[name] -} - -type dummyRequest struct{} - -func (d dummyRequest) WaitDuration() time.Duration { return 0 } -func (d dummyRequest) Done() {} -func (d dummyRequest) Error(err error, code int) {} - -// Wait invokes Wait() on the APILimiter with the given name. If the limiter -// does not exist, a dummy limiter is used which will not impose any -// restrictions. -func (s *APILimiterSet) Wait(ctx context.Context, name string) (LimitedRequest, error) { - l, ok := s.limiters[name] - if !ok { - return dummyRequest{}, nil - } - - return l.Wait(ctx) -} - -// parsePositiveInt parses value as an int. It returns an error if value cannot -// be parsed or is negative. -func parsePositiveInt(value string) (int, error) { - switch i64, err := strconv.ParseInt(value, 10, 64); { - case err != nil: - return 0, fmt.Errorf("unable to parse positive integer %q: %w", value, err) - case i64 < 0: - return 0, fmt.Errorf("unable to parse positive integer %q: negative value", value) - case i64 > math.MaxInt: - return 0, fmt.Errorf("unable to parse positive integer %q: overflow", value) - default: - return int(i64), nil - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/rate/doc.go b/vendor/github.com/cilium/cilium/pkg/rate/doc.go deleted file mode 100644 index b031503aa..000000000 --- a/vendor/github.com/cilium/cilium/pkg/rate/doc.go +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Package rate provides a rate limiter to rate limit requests that can be -// burstable but they should only allowed N per a period defined. -// This package differs from the "golang.org/x/time/rate" package as it does not -// implement the token bucket algorithm. -package rate diff --git a/vendor/github.com/cilium/cilium/pkg/rate/limiter.go b/vendor/github.com/cilium/cilium/pkg/rate/limiter.go deleted file mode 100644 index abb7be05e..000000000 --- a/vendor/github.com/cilium/cilium/pkg/rate/limiter.go +++ /dev/null @@ -1,110 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package rate - -import ( - "context" - "fmt" - "sync/atomic" - "time" - - "golang.org/x/sync/semaphore" -) - -// Limiter is used to limit the number of operations done. -type Limiter struct { - semaphore *semaphore.Weighted - burst int64 - currWeights atomic.Int64 - ticker *time.Ticker - cancelFunc context.CancelFunc - ctx context.Context -} - -// NewLimiter returns a new Limiter that allows events up to b tokens during -// the given interval. -// This Limiter has a different implementation from the 'x/time/rate's Limiter -// implementation. 'x/time/rate.Limiter' sends a constant stream of updates -// (at a rate of few dozen events per second) over the period of a N minutes -// which is the behavior of the token bucket algorithm. It is designed to -// flatten bursts in a signal to a fixed output rate. -// This rate.Limiter does the opposite of 'x/time/rate.Limiter'. It takes a -// somewhat fixed-rate stream of updates and turns it into a stream of -// controlled small bursts every N minutes. -func NewLimiter(interval time.Duration, b int64) *Limiter { - ticker := time.NewTicker(interval) - ctx, cancel := context.WithCancel(context.Background()) - l := &Limiter{ - semaphore: semaphore.NewWeighted(b), - burst: b, - ticker: ticker, - ctx: ctx, - cancelFunc: cancel, - } - go func() { - for { - select { - case <-ticker.C: - case <-l.ctx.Done(): - return - } - currWeights := l.currWeights.Swap(0) - l.semaphore.Release(currWeights) - } - }() - return l -} - -// Stop stops the internal components used for the rate limiter logic. -func (lim *Limiter) Stop() { - lim.cancelFunc() - lim.ticker.Stop() -} - -func (lim *Limiter) assertAlive() { - select { - case <-lim.ctx.Done(): - panic("limiter misuse: Allow / Wait / WaitN called concurrently after Stop") - default: - } -} - -// Allow is shorthand for AllowN(1). -func (lim *Limiter) Allow() bool { - return lim.AllowN(1) -} - -// AllowN returns true if it's possible to allow n tokens. -func (lim *Limiter) AllowN(n int64) bool { - lim.assertAlive() - acq := lim.semaphore.TryAcquire(n) - if acq { - lim.currWeights.Add(n) - return true - } - return false -} - -// Wait is shorthand for WaitN(ctx, 1). -func (lim *Limiter) Wait(ctx context.Context) error { - return lim.WaitN(ctx, 1) -} - -// WaitN acquires n tokens, blocking until resources are available or ctx is -// done. On success, returns nil. On failure, returns ctx.Err() and leaves the -// limiter unchanged. -// -// If ctx is already done, WaitN may still succeed without blocking. -func (lim *Limiter) WaitN(ctx context.Context, n int64) error { - lim.assertAlive() - if n > lim.burst { - return fmt.Errorf("rate: Wait(n=%d) exceeds limiter's burst %d", n, lim.burst) - } - err := lim.semaphore.Acquire(ctx, n) - if err != nil { - return err - } - lim.currWeights.Add(n) - return nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/rate/metrics/metrics.go b/vendor/github.com/cilium/cilium/pkg/rate/metrics/metrics.go deleted file mode 100644 index a3df70b20..000000000 --- a/vendor/github.com/cilium/cilium/pkg/rate/metrics/metrics.go +++ /dev/null @@ -1,41 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package metrics - -import ( - "strconv" - - "github.com/cilium/cilium/pkg/metrics" - "github.com/cilium/cilium/pkg/rate" -) - -func APILimiterObserver() rate.MetricsObserver { - return &apiRateLimitingMetrics{} -} - -type apiRateLimitingMetrics struct{} - -func (a *apiRateLimitingMetrics) ProcessedRequest(name string, v rate.MetricsValues) { - metrics.APILimiterProcessingDuration.WithLabelValues(name, "mean").Set(v.MeanProcessingDuration) - metrics.APILimiterProcessingDuration.WithLabelValues(name, "estimated").Set(v.EstimatedProcessingDuration) - metrics.APILimiterWaitDuration.WithLabelValues(name, "mean").Set(v.MeanWaitDuration) - metrics.APILimiterWaitDuration.WithLabelValues(name, "max").Set(v.MaxWaitDuration.Seconds()) - metrics.APILimiterWaitDuration.WithLabelValues(name, "min").Set(v.MinWaitDuration.Seconds()) - metrics.APILimiterRequestsInFlight.WithLabelValues(name, "in-flight").Set(float64(v.CurrentRequestsInFlight)) - metrics.APILimiterRequestsInFlight.WithLabelValues(name, "limit").Set(float64(v.ParallelRequests)) - metrics.APILimiterRateLimit.WithLabelValues(name, "limit").Set(float64(v.Limit)) - metrics.APILimiterRateLimit.WithLabelValues(name, "burst").Set(float64(v.Burst)) - metrics.APILimiterAdjustmentFactor.WithLabelValues(name).Set(v.AdjustmentFactor) - - if v.Outcome == "" { - metrics.APILimiterWaitHistoryDuration.WithLabelValues(name).Observe(v.WaitDuration.Seconds()) - v.Outcome = metrics.Error2Outcome(v.Error) - } - - if v.ReturnCode == -1 { - v.ReturnCode = metrics.LabelOutcome2Code(v.Outcome) - } - - metrics.APILimiterProcessedRequests.WithLabelValues(name, v.Outcome, strconv.Itoa(v.ReturnCode)).Inc() -} diff --git a/vendor/github.com/cilium/cilium/pkg/safeio/safeio.go b/vendor/github.com/cilium/cilium/pkg/safeio/safeio.go deleted file mode 100644 index 4eddccc41..000000000 --- a/vendor/github.com/cilium/cilium/pkg/safeio/safeio.go +++ /dev/null @@ -1,77 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package safeio - -import ( - "fmt" - "io" -) - -// ErrLimitReached indicates that ReadAllLimit has -// reached its limit before completing a full read -// of the io.Reader. -var ErrLimitReached = fmt.Errorf("read limit reached") - -// ByteSize expresses the size of bytes -type ByteSize float64 - -const ( - _ = iota // ignore first value by assigning to blank identifier - // KB is a Kilobyte - KB ByteSize = 1 << (10 * iota) - // MB is a Megabyte - MB - // GB is a Gigabyte - GB - // TB is a Terabyte - TB - // PB is a Petabyte - PB - // EB is an Exabyte - EB - // ZB is a Zettabyte - ZB - // YB is a Yottabyte - YB -) - -// String converts a ByteSize to a string -func (b ByteSize) String() string { - switch { - case b >= YB: - return fmt.Sprintf("%.1fYB", b/YB) - case b >= ZB: - return fmt.Sprintf("%.1fZB", b/ZB) - case b >= EB: - return fmt.Sprintf("%.1fEB", b/EB) - case b >= PB: - return fmt.Sprintf("%.1fPB", b/PB) - case b >= TB: - return fmt.Sprintf("%.1fTB", b/TB) - case b >= GB: - return fmt.Sprintf("%.1fGB", b/GB) - case b >= MB: - return fmt.Sprintf("%.1fMB", b/MB) - case b >= KB: - return fmt.Sprintf("%.1fKB", b/KB) - } - return fmt.Sprintf("%.1fB", b) -} - -// ReadAllLimit reads from r until an error, EOF, or after n bytes and returns -// the data it read. A successful call returns err == nil, not err == EOF. -// Because ReadAllLimit is defined to read from src until EOF it does not -// treat an EOF from Read as an error to be reported. If the limit is reached -// ReadAllLimit will return ErrLimitReached as an error. -func ReadAllLimit(r io.Reader, n ByteSize) ([]byte, error) { - limit := int(n + 1) - buf, err := io.ReadAll(io.LimitReader(r, int64(limit))) - if err != nil { - return buf, err - } - if len(buf) >= limit { - return buf[:limit-1], ErrLimitReached - } - return buf, nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/safetime/doc.go b/vendor/github.com/cilium/cilium/pkg/safetime/doc.go deleted file mode 100644 index 11ecf3c5f..000000000 --- a/vendor/github.com/cilium/cilium/pkg/safetime/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Package safetime contains a wrapper function for time.Since to deal with -// negative durations. -package safetime diff --git a/vendor/github.com/cilium/cilium/pkg/safetime/safetime.go b/vendor/github.com/cilium/cilium/pkg/safetime/safetime.go deleted file mode 100644 index cc00c25ac..000000000 --- a/vendor/github.com/cilium/cilium/pkg/safetime/safetime.go +++ /dev/null @@ -1,42 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package safetime - -import ( - "runtime" - - "github.com/sirupsen/logrus" - - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/time" -) - -// TimeSinceSafe returns the duration since t. If the duration is negative, -// returns false to indicate the fact. -// -// Used to workaround a malfunctioning monotonic clock. -func TimeSinceSafe(t time.Time, logger *logrus.Entry) (time.Duration, bool) { - n := time.Now() - d := n.Sub(t) - - if d < 0 { - logger = logger.WithFields(logrus.Fields{ - logfields.StartTime: t, - logfields.EndTime: n, - logfields.Duration: d, - }) - _, file, line, ok := runtime.Caller(1) - if ok { - logger = logger.WithFields(logrus.Fields{ - logfields.Path: file, - logfields.Line: line, - }) - } - logger.Warn("BUG: negative duration") - - return time.Duration(0), false - } - - return d, true -} diff --git a/vendor/github.com/cilium/cilium/pkg/source/source.go b/vendor/github.com/cilium/cilium/pkg/source/source.go deleted file mode 100644 index 4156105ab..000000000 --- a/vendor/github.com/cilium/cilium/pkg/source/source.go +++ /dev/null @@ -1,100 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package source - -// Source describes the source of a definition -type Source string - -const ( - // Unspec is used when the source is unspecified - Unspec Source = "unspec" - - // KubeAPIServer is the source used for state which represents the - // kube-apiserver, such as the IPs associated with it. This is not to be - // confused with the Kubernetes source. - // KubeAPIServer state has the strongest ownership and can only be - // overwritten by itself. - KubeAPIServer Source = "kube-apiserver" - - // Local is the source used for state derived from local agent state. - // Local state has the second strongest ownership, behind KubeAPIServer. - Local Source = "local" - - // KVStore is the source used for state derived from a key value store. - // State in the key value stored takes precedence over orchestration - // system state such as Kubernetes. - KVStore Source = "kvstore" - - // CustomResource is the source used for state derived from Kubernetes - // custom resources - CustomResource Source = "custom-resource" - - // Kubernetes is the source used for state derived from Kubernetes - Kubernetes Source = "k8s" - - // LocalAPI is the source used for state derived from the API served - // locally on the node. - LocalAPI Source = "api" - - // Generated is the source used for generated state which can be - // overwritten by all other sources, except for restored (and unspec). - Generated Source = "generated" - - // Restored is the source used for restored state from data left behind - // by the previous agent instance. Can be overwritten by all other - // sources (except for unspec). - Restored Source = "restored" -) - -// AllowOverwrite returns true if new state from a particular source is allowed -// to overwrite existing state from another source -func AllowOverwrite(existing, new Source) bool { - switch existing { - - // KubeAPIServer state can only be overwritten by other kube-apiserver - // state. - case KubeAPIServer: - return new == KubeAPIServer - - // Local state can only be overwritten by other local state or - // kube-apiserver state. - case Local: - return new == Local || new == KubeAPIServer - - // KVStore can be overwritten by other kvstore, local state, or - // kube-apiserver state. - case KVStore: - return new == KVStore || new == Local || new == KubeAPIServer - - // Custom-resource state can be overwritten by other CRD, kvstore, - // local or kube-apiserver state. - case CustomResource: - return new == CustomResource || new == KVStore || new == Local || new == KubeAPIServer - - // Kubernetes state can be overwritten by everything except local API, - // generated, restored and unspecified state. - case Kubernetes: - return new != LocalAPI && new != Generated && new != Restored && new != Unspec - - // Local API state can be overwritten by everything except restored, - // generated and unspecified state - case LocalAPI: - return new != Generated && new != Restored && new != Unspec - - // Generated can be overwritten by everything except by Restored and - // Unspecified - case Generated: - return new != Restored && new != Unspec - - // Restored can be overwritten by everything except by Unspecified - case Restored: - return new != Unspec - - // Unspecified state can be overwritten by everything - case Unspec: - return true - } - - return true -} diff --git a/vendor/github.com/cilium/cilium/pkg/spanstat/doc.go b/vendor/github.com/cilium/cilium/pkg/spanstat/doc.go deleted file mode 100644 index 61b9dc812..000000000 --- a/vendor/github.com/cilium/cilium/pkg/spanstat/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Package spanstat provides a mechanism to measure duration of multiple spans -// and add them up to a total duration -package spanstat diff --git a/vendor/github.com/cilium/cilium/pkg/spanstat/spanstat.go b/vendor/github.com/cilium/cilium/pkg/spanstat/spanstat.go deleted file mode 100644 index 255723353..000000000 --- a/vendor/github.com/cilium/cilium/pkg/spanstat/spanstat.go +++ /dev/null @@ -1,113 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package spanstat - -import ( - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/logging" - "github.com/cilium/cilium/pkg/logging/logfields" - "github.com/cilium/cilium/pkg/safetime" - "github.com/cilium/cilium/pkg/time" -) - -var ( - subSystem = "spanstat" - log = logging.DefaultLogger.WithField(logfields.LogSubsys, subSystem) -) - -// SpanStat measures the total duration of all time spent in between Start() -// and Stop() calls. -type SpanStat struct { - mutex lock.RWMutex - spanStart time.Time - successDuration time.Duration - failureDuration time.Duration -} - -// Start creates a new SpanStat and starts it -func Start() *SpanStat { - s := &SpanStat{} - return s.Start() -} - -// Start starts a new span -func (s *SpanStat) Start() *SpanStat { - s.mutex.Lock() - defer s.mutex.Unlock() - s.spanStart = time.Now() - return s -} - -// EndError calls End() based on the value of err -func (s *SpanStat) EndError(err error) *SpanStat { - s.mutex.Lock() - defer s.mutex.Unlock() - return s.end(err == nil) -} - -// End ends the current span and adds the measured duration to the total -// cumulated duration, and to the success or failure cumulated duration -// depending on the given success flag -func (s *SpanStat) End(success bool) *SpanStat { - s.mutex.Lock() - defer s.mutex.Unlock() - return s.end(success) -} - -// must be called with Lock() held -func (s *SpanStat) end(success bool) *SpanStat { - if !s.spanStart.IsZero() { - d, _ := safetime.TimeSinceSafe(s.spanStart, log) - if success { - s.successDuration += d - } else { - s.failureDuration += d - } - } - s.spanStart = time.Time{} - return s -} - -// Total returns the total duration of all spans measured, including both -// successes and failures -func (s *SpanStat) Total() time.Duration { - s.mutex.RLock() - defer s.mutex.RUnlock() - return s.successDuration + s.failureDuration -} - -// SuccessTotal returns the total duration of all successful spans measured -func (s *SpanStat) SuccessTotal() time.Duration { - s.mutex.RLock() - defer s.mutex.RUnlock() - return s.successDuration -} - -// FailureTotal returns the total duration of all unsuccessful spans measured -func (s *SpanStat) FailureTotal() time.Duration { - s.mutex.RLock() - defer s.mutex.RUnlock() - return s.failureDuration -} - -// Reset rests the duration measurements -func (s *SpanStat) Reset() { - s.mutex.Lock() - defer s.mutex.Unlock() - s.successDuration = 0 - s.failureDuration = 0 -} - -// Seconds returns the number of seconds represents by the spanstat. If a span -// is still open, it is closed first. -func (s *SpanStat) Seconds() float64 { - s.mutex.Lock() - defer s.mutex.Unlock() - if !s.spanStart.IsZero() { - s.end(true) - } - - total := s.successDuration + s.failureDuration - return total.Seconds() -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/api_client.go b/vendor/github.com/cilium/cilium/pkg/statedb/api_client.go deleted file mode 100644 index 23c69ddef..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/api_client.go +++ /dev/null @@ -1,99 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package statedb - -import ( - "context" - "encoding/base64" - "encoding/gob" - "os" - - "github.com/cilium/cilium/api/v1/client/statedb" - "github.com/cilium/cilium/pkg/client" -) - -// NewRemoteTable creates a new handle for querying a remote StateDB table over the REST API. -// Example usage: -// -// var client *client.Client -// -// devices := statedb.NewRemoteTable[*tables.Device](client, "devices") -// -// // Get all devices ordered by name. -// iter, errs := devices.LowerBound(ctx, tables.DeviceByName("")) -// for device, revision, ok := iter.Next(); ok; device, revision, ok = iter.Next() { ... } -// -// // Get device by name. -// iter, errs := devices.Get(ctx, tables.DeviceByName("eth0")) -// if dev, revision, ok := iter.Next(); ok { ... } -// -// // Get devices in revision order, e.g. oldest changed devices first. -// iter, errs = devices.LowerBound(ctx, statedb.ByRevision(0)) -func NewRemoteTable[Obj any](client *client.Client, table TableName) *RemoteTable[Obj] { - return &RemoteTable[Obj]{tableName: table, client: client} -} - -type RemoteTable[Obj any] struct { - tableName TableName - client *client.Client -} - -func (t *RemoteTable[Obj]) query(ctx context.Context, lowerBound bool, q Query[Obj]) (Iterator[Obj], <-chan error) { - // Unconventionally using a channel for errors since we will run the actual request in the - // background to feed the iterator. - errChan := make(chan error, 1) - - r, w, err := os.Pipe() - if err != nil { - errChan <- err - close(errChan) - return nil, errChan - } - - // Fork a goroutine to feed the pipe from which the gob-encoded stream of objects - // is decoded from. - go func() { - defer close(errChan) - defer w.Close() - key := base64.StdEncoding.EncodeToString(q.key) - _, err := t.client.Statedb.GetStatedbQueryTable( - &statedb.GetStatedbQueryTableParams{ - Index: q.index, - Key: key, - Lowerbound: lowerBound, - Table: t.tableName, - - Context: ctx, - }, - w, - ) - errChan <- err - }() - - return &remoteGetIterator[Obj]{gob.NewDecoder(r)}, errChan -} -func (t *RemoteTable[Obj]) Get(ctx context.Context, q Query[Obj]) (Iterator[Obj], <-chan error) { - return t.query(ctx, false, q) -} - -func (t *RemoteTable[Obj]) LowerBound(ctx context.Context, q Query[Obj]) (Iterator[Obj], <-chan error) { - return t.query(ctx, true, q) -} - -type remoteGetIterator[Obj any] struct { - decoder *gob.Decoder -} - -func (it *remoteGetIterator[Obj]) Next() (obj Obj, revision Revision, ok bool) { - err := it.decoder.Decode(&revision) - if err != nil { - return - } - err = it.decoder.Decode(&obj) - if err != nil { - return - } - ok = true - return -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/api_handler.go b/vendor/github.com/cilium/cilium/pkg/statedb/api_handler.go deleted file mode 100644 index 66d4521b8..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/api_handler.go +++ /dev/null @@ -1,98 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package statedb - -import ( - "encoding/base64" - "encoding/gob" - "fmt" - "net/http" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - - restapi "github.com/cilium/cilium/api/v1/server/restapi/statedb" - "github.com/cilium/cilium/pkg/api" -) - -func newDumpHandler(db *DB) restapi.GetStatedbDumpHandler { - return &dumpHandler{db} -} - -// REST API handler for the '/statedb/dump' to dump the contents of the database -// as JSON. Available through `cilium statedb dump` and included in sysdumps. -type dumpHandler struct { - db *DB -} - -func (h *dumpHandler) Handle(params restapi.GetStatedbDumpParams) middleware.Responder { - return middleware.ResponderFunc(func(w http.ResponseWriter, _ runtime.Producer) { - h.db.ReadTxn().WriteJSON(w) - }) -} - -// REST API handler for '/statedb/query' to perform remote Get() and LowerBound() -// queries against the database from 'cilium-dbg'. -func newQueryHandler(db *DB) restapi.GetStatedbQueryTableHandler { - return &queryHandler{db} -} - -type queryHandler struct { - db *DB -} - -// /statedb/query -func (h *queryHandler) Handle(params restapi.GetStatedbQueryTableParams) middleware.Responder { - queryKey, err := base64.StdEncoding.DecodeString(params.Key) - if err != nil { - return api.Error(restapi.GetStatedbQueryTableBadRequestCode, fmt.Errorf("Invalid key: %w", err)) - } - - txn := h.db.ReadTxn() - indexTxn, err := txn.getTxn().indexReadTxn(params.Table, params.Index) - if err != nil { - return api.Error(restapi.GetStatedbQueryTableNotFoundCode, err) - } - - return middleware.ResponderFunc(func(w http.ResponseWriter, _ runtime.Producer) { - w.WriteHeader(restapi.GetStatedbDumpOKCode) - enc := gob.NewEncoder(w) - onObject := func(obj object) error { - if err := enc.Encode(obj.revision); err != nil { - return err - } - return enc.Encode(obj.data) - } - runQuery(indexTxn, params.Lowerbound, queryKey, onObject) - }) -} - -func runQuery(indexTxn indexTxn, lowerbound bool, queryKey []byte, onObject func(object) error) { - iter := indexTxn.Root().Iterator() - if lowerbound { - iter.SeekLowerBound(queryKey) - } else { - iter.SeekPrefixWatch(queryKey) - } - var match func([]byte) bool - switch { - case lowerbound: - match = func([]byte) bool { return true } - case indexTxn.entry.unique: - match = func(k []byte) bool { return len(k) == len(queryKey) } - default: - match = func(k []byte) bool { - _, secondary := decodeNonUniqueKey(k) - return len(secondary) == len(queryKey) - } - } - for key, obj, ok := iter.Next(); ok; _, obj, ok = iter.Next() { - if !match(key) { - continue - } - if err := onObject(obj); err != nil { - return - } - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/cell.go b/vendor/github.com/cilium/cilium/pkg/statedb/cell.go deleted file mode 100644 index 8d3a49a40..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/cell.go +++ /dev/null @@ -1,38 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package statedb - -import ( - "github.com/cilium/hive/cell" -) - -// This module provides an in-memory database built on top of immutable radix trees -// As the database is based on an immutable data structure, the objects inserted into -// the database MUST NOT be mutated, but rather copied first! -// -// For example use see pkg/statedb/example. -var Cell = cell.Module( - "statedb", - "In-memory transactional database", - - cell.Provide( - newHiveDB, - newDumpHandler, - newQueryHandler, - NewMetrics, - ), - // NOTE: StateDB metrics are disabled until cilium/cilium has moved to using - // cilium/statedb. This is needed as pkg/hive now includes statedb.Cell by default - // and we need to drop this to fix the cycle. - //metrics.Metric(NewMetrics), -) - -func newHiveDB(lc cell.Lifecycle, metrics Metrics) (*DB, error) { - db, err := NewDB(nil, metrics) - if err != nil { - return nil, err - } - lc.Append(db) - return db, nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/db.go b/vendor/github.com/cilium/cilium/pkg/statedb/db.go deleted file mode 100644 index 21b2068aa..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/db.go +++ /dev/null @@ -1,291 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package statedb - -import ( - "context" - "errors" - "net/http" - "reflect" - "runtime" - "strings" - "sync/atomic" - - "github.com/cilium/hive/cell" - iradix "github.com/hashicorp/go-immutable-radix/v2" - "github.com/prometheus/client_golang/prometheus" - - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/time" -) - -// DB provides an in-memory transaction database built on top of immutable radix -// trees. The database supports multiple tables, each with one or more user-defined -// indexes. Readers can access the data locklessly with a simple atomic pointer read -// to obtain a snapshot. On writes to the database table-level locks are acquired -// on target tables and on write transaction commit a root lock is taken to swap -// in the new root with the modified tables. -// -// As data is stored in immutable data structures any objects inserted into -// it MUST NOT be mutated afterwards. -// -// DB holds the "root" tree of tables with each table holding a tree of indexes: -// -// root -// / \ -// ba T(foo) -// / \ -// T(bar) T(baz) -// -// T(bar).indexes -// / \ -// i I(byRevision) -// / \ -// I(id) I(ip) -// -// I(ip) -// / \ -// 192 172 -// / ... -// bar(192.168.1.1) -// -// T = tableEntry -// I = indexTree -// -// To lookup: -// 1. Create a read (or write) transaction -// 2. Find the table from the root tree -// 3. Find the index from the table's index tree -// 4. Find the object from the index -// -// To insert: -// 1. Create write transaction against the target table -// 2. Find the table from the root tree -// 3. Create/reuse write transaction on primary index -// 4. Insert/replace the object into primary index -// 5. Create/reuse write transaction on revision index -// 6. If old object existed, remove from revision index -// 7. If old object existed, remove from graveyard -// 8. Update each secondary index -// 9. Commit transaction by committing each index to -// the table and then committing table to the root. -// Swap the root atomic pointer to new root and -// notify by closing channels of all modified nodes. -// -// To observe deletions: -// 1. Create write transaction against the target table -// 2. Create new delete tracker and add it to the table -// 3. Commit the write transaction to update the table -// with the new delete tracker -// 4. Query the graveyard by revision, starting from the -// revision of the write transaction at which it was -// created. -// 5. For each successfully processed deletion, mark the -// revision to set low watermark for garbage collection. -// 6. Periodically garbage collect the graveyard by finding -// the lowest revision of all delete trackers. -type DB struct { - mu lock.Mutex // protects 'tables' and sequences modifications to the root tree - tables map[TableName]TableMeta - ctx context.Context - cancel context.CancelFunc - root atomic.Pointer[iradix.Tree[tableEntry]] - gcTrigger chan struct{} // trigger for graveyard garbage collection - gcExited chan struct{} - gcRateLimitInterval time.Duration - metrics Metrics -} - -func NewDB(tables []TableMeta, metrics Metrics) (*DB, error) { - txn := iradix.New[tableEntry]().Txn() - db := &DB{ - tables: make(map[TableName]TableMeta), - metrics: metrics, - gcRateLimitInterval: defaultGCRateLimitInterval, - } - for _, t := range tables { - if err := db.registerTable(t, txn); err != nil { - return nil, err - } - } - db.root.Store(txn.CommitOnly()) - - return db, nil -} - -// RegisterTable registers a table to the database: -// -// func NewMyTable() statedb.RWTable[MyTable] { ... } -// cell.Provide(NewMyTable), -// cell.Invoke(statedb.RegisterTable[MyTable]), -func RegisterTable[Obj any](db *DB, table RWTable[Obj]) error { - return db.RegisterTable(table) -} - -// RegisterTable registers a table to the database. -func (db *DB) RegisterTable(table TableMeta, tables ...TableMeta) error { - db.mu.Lock() - defer db.mu.Unlock() - - txn := db.root.Load().Txn() - if err := db.registerTable(table, txn); err != nil { - return err - } - for _, t := range tables { - if err := db.registerTable(t, txn); err != nil { - return err - } - } - db.root.Store(txn.CommitOnly()) - return nil -} - -func (db *DB) registerTable(table TableMeta, txn *iradix.Txn[tableEntry]) error { - name := table.Name() - if _, ok := db.tables[name]; ok { - return tableError(name, ErrDuplicateTable) - } - db.tables[name] = table - var entry tableEntry - entry.meta = table - entry.deleteTrackers = iradix.New[deleteTracker]() - indexTxn := iradix.New[indexEntry]().Txn() - indexTxn.Insert([]byte(table.primary().name), indexEntry{iradix.New[object](), true}) - indexTxn.Insert([]byte(RevisionIndex), indexEntry{iradix.New[object](), true}) - indexTxn.Insert([]byte(GraveyardIndex), indexEntry{iradix.New[object](), true}) - indexTxn.Insert([]byte(GraveyardRevisionIndex), indexEntry{iradix.New[object](), true}) - for index, indexer := range table.secondary() { - indexTxn.Insert([]byte(index), indexEntry{iradix.New[object](), indexer.unique}) - } - entry.indexes = indexTxn.CommitOnly() - txn.Insert(table.tableKey(), entry) - return nil -} - -// ReadTxn constructs a new read transaction for performing reads against -// a snapshot of the database. -// -// ReadTxn is not thread-safe! -func (db *DB) ReadTxn() ReadTxn { - return &txn{ - db: db, - rootReadTxn: db.root.Load().Txn(), - } -} - -// WriteTxn constructs a new write transaction against the given set of tables. -// Each table is locked, which may block until the table locks are acquired. -// The modifications performed in the write transaction are not visible outside -// it until Commit() is called. To discard the changes call Abort(). -// -// WriteTxn is not thread-safe! -func (db *DB) WriteTxn(table TableMeta, tables ...TableMeta) WriteTxn { - callerPkg := callerPackage() - - allTables := append(tables, table) - smus := lock.SortableMutexes{} - for _, table := range allTables { - smus = append(smus, table.sortableMutex()) - } - lockAt := time.Now() - smus.Lock() - acquiredAt := time.Now() - - rootReadTxn := db.root.Load().Txn() - tableEntries := make(map[TableName]*tableEntry, len(tables)) - var tableNames []string - for _, table := range allTables { - tableEntry, ok := rootReadTxn.Get(table.tableKey()) - if !ok { - panic("BUG: Table '" + table.Name() + "' not found") - } - tableEntries[table.Name()] = &tableEntry - tableNames = append(tableNames, table.Name()) - - db.metrics.TableContention.With(prometheus.Labels{ - "table": table.Name(), - }).Set(table.sortableMutex().AcquireDuration().Seconds()) - } - - db.metrics.WriteTxnAcquisition.With(prometheus.Labels{ - "package": callerPkg, - "tables": strings.Join(tableNames, "+"), - }).Observe(acquiredAt.Sub(lockAt).Seconds()) - - return &txn{ - db: db, - rootReadTxn: rootReadTxn, - modifiedTables: tableEntries, - writeTxns: make(map[tableIndex]indexTxn), - smus: smus, - acquiredAt: acquiredAt, - tableNames: strings.Join(tableNames, "+"), - packageName: callerPkg, - } -} - -func (db *DB) Start(cell.HookContext) error { - db.gcTrigger = make(chan struct{}, 1) - db.gcExited = make(chan struct{}) - db.ctx, db.cancel = context.WithCancel(context.Background()) - go graveyardWorker(db, db.ctx, db.gcRateLimitInterval) - return nil -} - -func (db *DB) Stop(stopCtx cell.HookContext) error { - db.cancel() - select { - case <-stopCtx.Done(): - return errors.New("timed out waiting for graveyard worker to exit") - case <-db.gcExited: - } - return nil -} - -// ServeHTTP is an HTTP handler for dumping StateDB as JSON. -// -// Example usage: -// -// var db *statedb.DB -// -// http.Handle("/db", db) -// http.ListenAndServe(":8080", nil) -func (db *DB) ServeHTTP(w http.ResponseWriter, r *http.Request) { - w.Header().Add("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - db.ReadTxn().WriteJSON(w) -} - -// setGCRateLimitInterval can set the graveyard GC interval before DB is started. -// Used by tests. -func (db *DB) setGCRateLimitInterval(interval time.Duration) { - db.gcRateLimitInterval = interval -} - -var ciliumPackagePrefix = func() string { - sentinel := func() {} - name := runtime.FuncForPC(reflect.ValueOf(sentinel).Pointer()).Name() - if idx := strings.Index(name, "pkg/"); idx >= 0 { - return name[:idx] - } - return "" -}() - -func callerPackage() string { - var callerPkg string - pc, _, _, ok := runtime.Caller(2) - if ok { - f := runtime.FuncForPC(pc) - if f != nil { - callerPkg = f.Name() - callerPkg, _ = strings.CutPrefix(callerPkg, ciliumPackagePrefix) - callerPkg = strings.SplitN(callerPkg, ".", 2)[0] - } else { - callerPkg = "unknown" - } - } else { - callerPkg = "unknown" - } - return callerPkg -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/deletetracker.go b/vendor/github.com/cilium/cilium/pkg/statedb/deletetracker.go deleted file mode 100644 index 5f15a4e06..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/deletetracker.go +++ /dev/null @@ -1,137 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package statedb - -import ( - "sync/atomic" - - "github.com/prometheus/client_golang/prometheus" - - "github.com/cilium/cilium/pkg/statedb/index" -) - -type DeleteTracker[Obj any] struct { - db *DB - trackerName string - table Table[Obj] - - // revision is the last observed revision. Starts out at zero - // in which case the garbage collector will not care about this - // tracker when considering which objects to delete. - revision atomic.Uint64 -} - -// setRevision is called to set the starting low watermark when -// this deletion tracker is inserted into the table. -func (dt *DeleteTracker[Obj]) setRevision(rev uint64) { - dt.revision.Store(rev) -} - -// getRevision is called by the graveyard garbage collector to -// compute the global low watermark. -func (dt *DeleteTracker[Obj]) getRevision() uint64 { - return dt.revision.Load() -} - -// Deleted returns an iterator for deleted objects in this table starting from -// 'minRevision'. The deleted objects are not garbage-collected unless 'Mark' is -// called! -func (dt *DeleteTracker[Obj]) Deleted(txn ReadTxn, minRevision Revision) Iterator[Obj] { - indexTxn := txn.getTxn().mustIndexReadTxn(dt.table.Name(), GraveyardRevisionIndex) - iter := indexTxn.Root().Iterator() - iter.SeekLowerBound(index.Uint64(minRevision)) - return &iterator[Obj]{iter} -} - -// Mark the revision up to which deleted objects have been processed. This sets -// the low watermark for deleted object garbage collection. -func (dt *DeleteTracker[Obj]) Mark(upTo Revision) { - // Store the new low watermark and trigger a round of garbage collection. - dt.revision.Store(upTo) - select { - case dt.db.gcTrigger <- struct{}{}: - default: - } -} - -func (dt *DeleteTracker[Obj]) Close() { - // Remove the delete tracker from the table. - txn := dt.db.WriteTxn(dt.table).getTxn() - db := txn.db - table := txn.modifiedTables[dt.table.Name()] - if table == nil { - panic("BUG: Table missing from write transaction") - } - table.deleteTrackers, _, _ = table.deleteTrackers.Delete([]byte(dt.trackerName)) - txn.Commit() - - db.metrics.TableDeleteTrackerCount.With(prometheus.Labels{ - "table": dt.table.Name(), - }).Dec() - - // Trigger garbage collection without this delete tracker to garbage - // collect any deleted objects that may not have been consumed. - select { - case db.gcTrigger <- struct{}{}: - default: - } - -} - -// IterateWithError iterates updates and deletes to a table in revision order. -// -// The 'processFn' is called for each updated or deleted object in order. If an error -// is returned by the function the iteration is stopped and the error is returned. -// On further calls the processing continues from the next unprocessed (or error'd) revision. -func (dt *DeleteTracker[Obj]) IterateWithError(txn ReadTxn, processFn func(obj Obj, deleted bool, rev Revision) error) (<-chan struct{}, error) { - upTo := dt.table.Revision(txn) - lastRevision := dt.revision.Load() - - // Get all new and updated objects with revision number equal or - // higher than 'minRevision'. - // The returned watch channel watches the whole table and thus - // is closed when either insert or delete happens. - updatedIter, watch := dt.table.LowerBound(txn, ByRevision[Obj](lastRevision+1)) - - // Get deleted objects with revision equal or higher than 'minRevision'. - deletedIter := dt.Deleted(txn.getTxn(), lastRevision+1) - - // Combine the iterators into one. This can be done as insert and delete - // both assign the object a new fresh monotonically increasing revision - // number. - iter := NewDualIterator[Obj](deletedIter, updatedIter) - - for obj, rev, isDeleted, ok := iter.Next(); ok; obj, rev, isDeleted, ok = iter.Next() { - err := processFn(obj, isDeleted, rev) - if err != nil { - // Mark deleted objects processed up to previous revision since we may - // not have processed all objects with this revision fully yet. - dt.Mark(rev - 1) - - // Processing failed, stop here and try again from this same revision. - return closedWatchChannel, err - } - - } - - // Fully processed up to latest table revision. GC deleted objects - // and return the next revision. - dt.Mark(upTo) - return watch, nil -} - -// Iterate over updated and deleted objects in revision order. -func (dt *DeleteTracker[Obj]) Iterate(txn ReadTxn, iterateFn func(obj Obj, deleted bool, rev Revision)) <-chan struct{} { - watch, _ := dt.IterateWithError(txn, func(obj Obj, deleted bool, rev Revision) error { - iterateFn(obj, deleted, rev) - return nil - }) - return watch -} - -var closedWatchChannel = func() <-chan struct{} { - ch := make(chan struct{}) - close(ch) - return ch -}() diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/derive.go b/vendor/github.com/cilium/cilium/pkg/statedb/derive.go deleted file mode 100644 index cf34df309..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/derive.go +++ /dev/null @@ -1,116 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package statedb - -import ( - "context" - - "github.com/cilium/hive/cell" - "github.com/cilium/hive/job" -) - -type DeriveResult int - -const ( - DeriveInsert DeriveResult = 0 // Insert the object - DeriveUpdate DeriveResult = 1 // Update the object (if it exists) - DeriveDelete DeriveResult = 2 // Delete the object - DeriveSkip DeriveResult = 3 // Skip -) - -type DeriveParams[In, Out any] struct { - cell.In - - Lifecycle cell.Lifecycle - Jobs job.Registry - Health cell.Health - DB *DB - InTable Table[In] - OutTable RWTable[Out] -} - -// Derive constructs and registers a job to transform objects from the input table to the -// output table, e.g. derive the output table from the input table. Useful when constructing -// a reconciler that has its desired state solely derived from a single table. For example -// the bandwidth manager's desired state is directly derived from the devices table. -// -// Derive is parametrized with the transform function that transforms the input object -// into the output object. If the transform function returns false, then the object -// is skipped. -// -// Example use: -// -// cell.Invoke( -// statedb.Derive[*tables.Device, *Foo]( -// func(d *Device, deleted bool) (*Foo, DeriveResult) { -// if deleted { -// return &Foo{Index: d.Index}, DeriveDelete -// } -// return &Foo{Index: d.Index}, DeriveInsert -// }), -// ) -func Derive[In, Out any](jobName string, transform func(obj In, deleted bool) (Out, DeriveResult)) func(DeriveParams[In, Out]) { - return func(p DeriveParams[In, Out]) { - g := p.Jobs.NewGroup(p.Health) - g.Add(job.OneShot( - jobName, - derive[In, Out]{p, jobName, transform}.loop), - ) - p.Lifecycle.Append(g) - } - -} - -type derive[In, Out any] struct { - DeriveParams[In, Out] - jobName string - transform func(obj In, deleted bool) (Out, DeriveResult) -} - -func (d derive[In, Out]) loop(ctx context.Context, health cell.Health) error { - out := d.OutTable - wtxn := d.DB.WriteTxn(d.InTable) - tracker, err := d.InTable.DeleteTracker(wtxn, d.jobName) - if err != nil { - wtxn.Abort() - return err - } - wtxn.Commit() - defer tracker.Close() - for { - wtxn := d.DB.WriteTxn(out) - - var watch <-chan struct{} - watch, err = tracker.IterateWithError( - wtxn, - func(obj In, deleted bool, rev Revision) (err error) { - outObj, result := d.transform(obj, deleted) - switch result { - case DeriveInsert: - _, _, err = out.Insert(wtxn, outObj) - case DeriveUpdate: - _, _, found := out.First(wtxn, out.PrimaryIndexer().QueryFromObject(outObj)) - if found { - _, _, err = out.Insert(wtxn, outObj) - } - case DeriveDelete: - _, _, err = out.Delete(wtxn, outObj) - case DeriveSkip: - } - return err - }, - ) - wtxn.Commit() - - if err != nil { - return err - } - - select { - case <-watch: - case <-ctx.Done(): - return nil - } - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/doc.go b/vendor/github.com/cilium/cilium/pkg/statedb/doc.go deleted file mode 100644 index 7ac5b1712..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/doc.go +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// The statedb package provides a transactional in-memory database with per-table locking -// built on top of the go-immutable-radix library. -// -// As this is built around an immutable data structure and objects may have lockless readers -// the stored objects MUST NOT be mutated, but instead a copy must be made prior to mutation -// and insertion. -// -// See pkg/statedb/example for an example how to construct an application that uses this library. -package statedb diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/errors.go b/vendor/github.com/cilium/cilium/pkg/statedb/errors.go deleted file mode 100644 index e78dc1357..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/errors.go +++ /dev/null @@ -1,49 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package statedb - -import ( - "errors" - "fmt" -) - -var ( - // ErrDuplicateTable indicates that StateDB has been provided with two or more table definitions - // that share the same table name. - ErrDuplicateTable = errors.New("table already exists") - - // ErrPrimaryIndexNotUnique indicates that the primary index for the table is not marked unique. - ErrPrimaryIndexNotUnique = errors.New("primary index not unique") - - // ErrDuplicateIndex indicates that the table has two or more indexers that share the same name. - ErrDuplicateIndex = errors.New("index name already in use") - - // ErrReservedPrefix indicates that the index name is using the reserved prefix and should - // be renamed. - ErrReservedPrefix = errors.New("index name uses reserved prefix '" + reservedIndexPrefix + "'") - - // ErrTransactionClosed indicates that a write operation is performed using a transaction - // that has already been committed or aborted. - ErrTransactionClosed = errors.New("transaction is closed") - - // ErrTableNotLockedForWriting indicates that a write operation is performed against a - // table that was not locked for writing, e.g. target table not given as argument to - // WriteTxn(). - ErrTableNotLockedForWriting = errors.New("not locked for writing") - - // ErrRevisionNotEqual indicates that the CompareAndSwap or CompareAndDelete failed due to - // the object having a mismatching revision, e.g. it had been changed since the object - // was last read. - ErrRevisionNotEqual = errors.New("revision not equal") - - // ErrObjectNotFound indicates that the object was not found when the operation required - // it to exists. This error is not returned by Insert or Delete, but may be returned by - // CompareAndSwap or CompareAndDelete. - ErrObjectNotFound = errors.New("object not found") -) - -// tableError wraps an error with the table name. -func tableError(tableName string, err error) error { - return fmt.Errorf("table %q: %w", tableName, err) -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/graveyard.go b/vendor/github.com/cilium/cilium/pkg/statedb/graveyard.go deleted file mode 100644 index 8752d5cd6..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/graveyard.go +++ /dev/null @@ -1,145 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package statedb - -import ( - "context" - - "github.com/prometheus/client_golang/prometheus" - "golang.org/x/exp/maps" - - "github.com/cilium/cilium/pkg/rate" - "github.com/cilium/cilium/pkg/spanstat" - "github.com/cilium/cilium/pkg/time" -) - -const ( - // defaultGCRateLimitInterval is the default minimum interval between garbage collections. - defaultGCRateLimitInterval = time.Second -) - -func graveyardWorker(db *DB, ctx context.Context, gcRateLimitInterval time.Duration) { - limiter := rate.NewLimiter(gcRateLimitInterval, 1) - defer limiter.Stop() - defer close(db.gcExited) - - for { - select { - case <-ctx.Done(): - return - case <-db.gcTrigger: - } - - // Throttle garbage collection. - if err := limiter.Wait(ctx); err != nil { - return - } - - cleaningTimes := make(map[string]*spanstat.SpanStat) - - type deadObjectRevisionKey = []byte - toBeDeleted := map[TableMeta][]deadObjectRevisionKey{} - - // Do a lockless read transaction to find potential dead objects. - txn := db.ReadTxn().getTxn() - tableIter := txn.rootReadTxn.Root().Iterator() - for nameKey, table, ok := tableIter.Next(); ok; nameKey, table, ok = tableIter.Next() { - tableName := string(nameKey) - cleaningTimes[tableName] = spanstat.Start() - - // Find the low watermark - lowWatermark := table.revision - dtIter := table.deleteTrackers.Root().Iterator() - for _, dt, ok := dtIter.Next(); ok; _, dt, ok = dtIter.Next() { - rev := dt.getRevision() - // If the revision is higher than zero than the tracker has been observed - // at least once. If it is zero, then no objects have been seen and thus - // we don't need to hold onto deleted objects for it. - if rev > 0 && rev < lowWatermark { - lowWatermark = rev - } - } - - db.metrics.TableGraveyardLowWatermark.With(prometheus.Labels{ - "table": tableName, - }).Set(float64(lowWatermark)) - - // Find objects to be deleted by iterating over the graveyard revision index up - // to the low watermark. - indexTree := txn.mustIndexReadTxn(tableName, GraveyardRevisionIndex) - - objIter := indexTree.Root().Iterator() - for key, obj, ok := objIter.Next(); ok; key, obj, ok = objIter.Next() { - if obj.revision > lowWatermark { - break - } - toBeDeleted[table.meta] = append(toBeDeleted[table.meta], key) - } - cleaningTimes[tableName].End(true) - } - - if len(toBeDeleted) == 0 { - for tableName, stat := range cleaningTimes { - db.metrics.TableGraveyardCleaningDuration.With(prometheus.Labels{ - "table": tableName, - }).Observe(stat.Total().Seconds()) - } - continue - } - - // Dead objects found, do a write transaction against all tables with dead objects in them. - tablesToModify := maps.Keys(toBeDeleted) - txn = db.WriteTxn(tablesToModify[0], tablesToModify[1:]...).getTxn() - for meta, deadObjs := range toBeDeleted { - tableName := meta.Name() - cleaningTimes[tableName].Start() - for _, key := range deadObjs { - oldObj, existed := txn.mustIndexWriteTxn(tableName, GraveyardRevisionIndex).Delete(key) - if existed { - // The dead object still existed (and wasn't replaced by a create->delete), - // delete it from the primary index. - key = meta.primary().fromObject(oldObj).First() - txn.mustIndexWriteTxn(tableName, GraveyardIndex).Delete(key) - } - } - cleaningTimes[tableName].End(true) - } - txn.Commit() - - for tableName, stat := range cleaningTimes { - db.metrics.TableGraveyardCleaningDuration.With(prometheus.Labels{ - "table": tableName, - }).Observe(stat.Total().Seconds()) - } - - // Update object count metrics. - txn = db.ReadTxn().getTxn() - tableIter = txn.rootReadTxn.Root().Iterator() - for name, table, ok := tableIter.Next(); ok; name, table, ok = tableIter.Next() { - db.metrics.TableGraveyardObjectCount.With( - prometheus.Labels{"table": string(name)}, - ).Set(float64(table.numDeletedObjects())) - db.metrics.TableObjectCount.With( - prometheus.Labels{"table": string(name)}, - ).Set(float64(table.numObjects())) - } - } -} - -// graveyardIsEmpty returns true if no objects exist in the graveyard of any table. -// Used in tests. -func (db *DB) graveyardIsEmpty() bool { - txn := db.ReadTxn().getTxn() - tableIter := txn.rootReadTxn.Root().Iterator() - for _, table, ok := tableIter.Next(); ok; _, table, ok = tableIter.Next() { - indexEntry, ok := table.indexes.Get([]byte(GraveyardIndex)) - if !ok { - panic("BUG: GraveyardIndex not found from table") - } - if indexEntry.tree.Len() != 0 { - return false - } - } - return true -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/index/bool.go b/vendor/github.com/cilium/cilium/pkg/statedb/index/bool.go deleted file mode 100644 index c60f7b9e6..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/index/bool.go +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package index - -var ( - trueKey = []byte{'T'} - falseKey = []byte{'F'} -) - -func Bool(b bool) Key { - if b { - return trueKey - } - return falseKey -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/index/int.go b/vendor/github.com/cilium/cilium/pkg/statedb/index/int.go deleted file mode 100644 index d1a40b8df..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/index/int.go +++ /dev/null @@ -1,32 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package index - -import ( - "encoding/binary" -) - -// The indexing functions on integers should use big-endian encoding. -// This allows prefix searching on integers as the most significant -// byte is first. -// For example to find 16-bit key larger than 260 (0x0104) from 3 (0x0003) -// and 270 (0x0109) -// 00 (3) < 01 (260) => skip, -// 01 (270) >= 01 (260) => 09 > 04 => found! - -func Int(n int) Key { - return Uint64(uint64(n)) -} - -func Uint64(n uint64) Key { - return binary.BigEndian.AppendUint64(nil, n) -} - -func Uint32(n uint32) Key { - return binary.BigEndian.AppendUint32(nil, n) -} - -func Uint16(n uint16) Key { - return binary.BigEndian.AppendUint16(nil, n) -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/index/keyset.go b/vendor/github.com/cilium/cilium/pkg/statedb/index/keyset.go deleted file mode 100644 index 6ebdecd90..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/index/keyset.go +++ /dev/null @@ -1,60 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package index - -import ( - "bytes" -) - -// Key is a byte slice describing a key used in an index by statedb. -// If a key is variable-sized, then it must be either terminated with -// e.g. zero byte or it must be length-encoded. If it is not, then -// a Get() may return results that don't match the query (e.g. objects -// indexed with a key that has the same prefix but are longer). -// The reason is that Get() is implemented as a prefix seek to avoid -// full key comparison on iteration and also to support the -// non-unique indexes which key on "secondary + primary" keys. -type Key []byte - -func (k Key) Equal(k2 Key) bool { - return bytes.Equal(k, k2) -} - -type KeySet struct { - head Key - tail []Key -} - -func (ks KeySet) First() Key { - return ks.head -} - -func (ks KeySet) Foreach(fn func(Key)) { - if ks.head == nil { - return - } - fn(ks.head) - for _, k := range ks.tail { - fn(k) - } -} - -func (ks KeySet) Exists(k Key) bool { - if ks.head.Equal(k) { - return true - } - for _, k2 := range ks.tail { - if k2.Equal(k) { - return true - } - } - return false -} - -func NewKeySet(keys ...Key) KeySet { - if len(keys) == 0 { - return KeySet{} - } - return KeySet{keys[0], keys[1:]} -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/index/map.go b/vendor/github.com/cilium/cilium/pkg/statedb/index/map.go deleted file mode 100644 index 8ea6548ae..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/index/map.go +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package index - -func StringMap[V any](m map[string]V) KeySet { - keys := make([]Key, 0, len(m)) - for k := range m { - keys = append(keys, String(k)) - } - return NewKeySet(keys...) -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/index/netip.go b/vendor/github.com/cilium/cilium/pkg/statedb/index/netip.go deleted file mode 100644 index b8223d055..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/index/netip.go +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package index - -import ( - "bytes" - "net" - "net/netip" -) - -func NetIP(ip net.IP) Key { - // Use the 16-byte form to have a constant-size key. - return bytes.Clone(ip.To16()) -} - -func NetIPAddr(addr netip.Addr) Key { - // Use the 16-byte form to have a constant-size key. - buf := addr.As16() - return buf[:] -} - -func NetIPPrefix(prefix netip.Prefix) Key { - // Use the 16-byte form plus bits to have a constant-size key. - addrBytes := prefix.Addr().As16() - return append(addrBytes[:], uint8(prefix.Bits())) -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/index/string.go b/vendor/github.com/cilium/cilium/pkg/statedb/index/string.go deleted file mode 100644 index 3aad92698..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/index/string.go +++ /dev/null @@ -1,30 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package index - -import "fmt" - -func String(s string) Key { - return append([]byte(s), 0 /* termination */) -} - -func Stringer[T fmt.Stringer](s T) Key { - return String(s.String()) -} - -func StringSlice(ss []string) KeySet { - keys := make([]Key, 0, len(ss)) - for _, s := range ss { - keys = append(keys, String(s)) - } - return NewKeySet(keys...) -} - -func StringerSlice[T fmt.Stringer](ss []T) KeySet { - keys := make([]Key, 0, len(ss)) - for _, s := range ss { - keys = append(keys, Stringer(s)) - } - return NewKeySet(keys...) -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/iterator.go b/vendor/github.com/cilium/cilium/pkg/statedb/iterator.go deleted file mode 100644 index 2494256fa..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/iterator.go +++ /dev/null @@ -1,220 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package statedb - -import ( - "bytes" - "fmt" - - "k8s.io/apimachinery/pkg/util/sets" -) - -// Collect creates a slice of objects out of the iterator. -// The iterator is consumed in the process. -func Collect[Obj any](iter Iterator[Obj]) []Obj { - objs := []Obj{} - for obj, _, ok := iter.Next(); ok; obj, _, ok = iter.Next() { - objs = append(objs, obj) - } - return objs -} - -// CollectSet creates a set of objects out of the iterator. -// The iterator is consumed in the process. -func CollectSet[Obj comparable](iter Iterator[Obj]) sets.Set[Obj] { - objs := sets.New[Obj]() - for obj, _, ok := iter.Next(); ok; obj, _, ok = iter.Next() { - objs.Insert(obj) - } - return objs -} - -// ProcessEach invokes the given function for each object provided by the iterator. -func ProcessEach[Obj any, It Iterator[Obj]](iter It, fn func(Obj, Revision) error) (err error) { - for obj, rev, ok := iter.Next(); ok; obj, rev, ok = iter.Next() { - err = fn(obj, rev) - if err != nil { - return - } - } - return -} - -// iterator adapts the "any" object iterator to a typed object. -type iterator[Obj any] struct { - iter interface{ Next() ([]byte, object, bool) } -} - -func (it *iterator[Obj]) Next() (obj Obj, revision uint64, ok bool) { - _, iobj, ok := it.iter.Next() - if ok { - obj = iobj.data.(Obj) - revision = iobj.revision - } - return -} - -// Map applies a function to transform every object returned by the iterator -func Map[In, Out any, It Iterator[In]](iter It, transform func(In) Out) Iterator[Out] { - return &mapIterator[In, Out]{ - iter: iter, - transform: transform, - } -} - -type mapIterator[In, Out any] struct { - iter Iterator[In] - transform func(In) Out -} - -func (it *mapIterator[In, Out]) Next() (out Out, revision Revision, ok bool) { - obj, rev, ok := it.iter.Next() - if ok { - return it.transform(obj), rev, true - } - return -} - -// Filter skips objects for which the supplied predicate returns true -func Filter[Obj any, It Iterator[Obj]](iter It, pred func(Obj) bool) Iterator[Obj] { - return &filterIterator[Obj]{ - iter: iter, - pred: pred, - } -} - -type filterIterator[Obj any] struct { - iter Iterator[Obj] - pred func(Obj) bool -} - -func (it *filterIterator[Obj]) Next() (out Obj, revision Revision, ok bool) { - for { - out, revision, ok = it.iter.Next() - if !ok { - break - } - if it.pred(out) { - return out, revision, true - } - } - return -} - -// uniqueIterator iterates over objects in a unique index. Since -// we find the node by prefix search, we may see a key that shares -// the search prefix but is longer. We skip those objects. -type uniqueIterator[Obj any] struct { - iter interface{ Next() ([]byte, object, bool) } - key []byte -} - -func (it *uniqueIterator[Obj]) Next() (obj Obj, revision uint64, ok bool) { - var iobj object - for { - var key []byte - key, iobj, ok = it.iter.Next() - if !ok || bytes.Equal(key, it.key) { - break - } - } - if ok { - obj = iobj.data.(Obj) - revision = iobj.revision - } - return -} - -// nonUniqueIterator iterates over a non-unique index. Since we seek by prefix and don't -// require that indexers terminate the keys, the iterator checks that the prefix -// has the right length. -type nonUniqueIterator[Obj any] struct { - iter interface{ Next() ([]byte, object, bool) } - key []byte -} - -func (it *nonUniqueIterator[Obj]) Next() (obj Obj, revision uint64, ok bool) { - var iobj object - for { - var key []byte - key, iobj, ok = it.iter.Next() - if !ok { - return - } - _, secondary := decodeNonUniqueKey(key) - - // Equal length implies equal key since we got here via - // prefix search and all child nodes share the same prefix. - if len(secondary) == len(it.key) { - break - } - - // This node has a longer secondary key that shares our search - // prefix, skip it. - } - if ok { - obj = iobj.data.(Obj) - revision = iobj.revision - } - return -} - -func NewDualIterator[Obj any](left, right Iterator[Obj]) *DualIterator[Obj] { - return &DualIterator[Obj]{ - left: iterState[Obj]{iter: left}, - right: iterState[Obj]{iter: right}, - } -} - -type iterState[Obj any] struct { - iter Iterator[Obj] - obj Obj - rev Revision - ok bool -} - -// DualIterator allows iterating over two iterators in revision order. -// Meant to be used for combined iteration of LowerBound(ByRevision) -// and Deleted(). -type DualIterator[Obj any] struct { - left iterState[Obj] - right iterState[Obj] -} - -func (it *DualIterator[Obj]) Next() (obj Obj, revision uint64, fromLeft, ok bool) { - // Advance the iterators - if !it.left.ok && it.left.iter != nil { - it.left.obj, it.left.rev, it.left.ok = it.left.iter.Next() - if !it.left.ok { - it.left.iter = nil - } - } - if !it.right.ok && it.right.iter != nil { - it.right.obj, it.right.rev, it.right.ok = it.right.iter.Next() - if !it.right.ok { - it.right.iter = nil - } - } - - // Find the lowest revision object - switch { - case !it.left.ok && !it.right.ok: - ok = false - return - case it.left.ok && !it.right.ok: - it.left.ok = false - return it.left.obj, it.left.rev, true, true - case it.right.ok && !it.left.ok: - it.right.ok = false - return it.right.obj, it.right.rev, false, true - case it.left.rev <= it.right.rev: - it.left.ok = false - return it.left.obj, it.left.rev, true, true - case it.right.rev <= it.left.rev: - it.right.ok = false - return it.right.obj, it.right.rev, false, true - default: - panic(fmt.Sprintf("BUG: Unhandled case: %+v", it)) - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/metrics.go b/vendor/github.com/cilium/cilium/pkg/statedb/metrics.go deleted file mode 100644 index 3ae49525f..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/metrics.go +++ /dev/null @@ -1,98 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package statedb - -import ( - "github.com/cilium/cilium/pkg/metrics" - "github.com/cilium/cilium/pkg/metrics/metric" -) - -type Metrics struct { - // How long a read transaction was held. - WriteTxnDuration metric.Vec[metric.Observer] - // How long it took to acquire a write transaction for all tables. - WriteTxnAcquisition metric.Vec[metric.Observer] - // How long writers were blocked while waiting to acquire a write transaction for a specific table. - TableContention metric.Vec[metric.Gauge] - // The amount of objects in a given table. - TableObjectCount metric.Vec[metric.Gauge] - // The current revision of a given table. - TableRevision metric.Vec[metric.Gauge] - // The amount of delete trackers for a given table. - TableDeleteTrackerCount metric.Vec[metric.Gauge] - // The amount of objects in the graveyard for a given table. - TableGraveyardObjectCount metric.Vec[metric.Gauge] - // The lowest revision of a given table that has been processed by the graveyard garbage collector. - TableGraveyardLowWatermark metric.Vec[metric.Gauge] - // The time it took to clean the graveyard for a given table. - TableGraveyardCleaningDuration metric.Vec[metric.Observer] -} - -func NewMetrics() Metrics { - return Metrics{ - WriteTxnDuration: metric.NewHistogramVec(metric.HistogramOpts{ - Namespace: metrics.CiliumAgentNamespace, - Subsystem: "statedb", - Name: "write_txn_duration_seconds", - Help: "How long a write transaction was held.", - Disabled: true, - }, []string{"tables", "package"}), - WriteTxnAcquisition: metric.NewHistogramVec(metric.HistogramOpts{ - Namespace: metrics.CiliumAgentNamespace, - Subsystem: "statedb", - Name: "write_txn_acquisition_seconds", - Help: "How long it took to acquire a write transaction for all tables.", - Disabled: true, - }, []string{"tables", "package"}), - TableContention: metric.NewGaugeVec(metric.GaugeOpts{ - Namespace: metrics.CiliumAgentNamespace, - Subsystem: "statedb", - Name: "table_contention_seconds", - Help: "How long writers were blocked while waiting to acquire a write transaction for a specific table.", - Disabled: true, - }, []string{"table"}), - TableObjectCount: metric.NewGaugeVec(metric.GaugeOpts{ - Namespace: metrics.CiliumAgentNamespace, - Subsystem: "statedb", - Name: "table_objects", - Help: "The amount of objects in a given table.", - Disabled: true, - }, []string{"table"}), - TableRevision: metric.NewGaugeVec(metric.GaugeOpts{ - Namespace: metrics.CiliumAgentNamespace, - Subsystem: "statedb", - Name: "table_revision", - Help: "The current revision of a given table.", - Disabled: true, - }, []string{"table"}), - TableDeleteTrackerCount: metric.NewGaugeVec(metric.GaugeOpts{ - Namespace: metrics.CiliumAgentNamespace, - Subsystem: "statedb", - Name: "table_delete_trackers", - Help: "The amount of delete trackers for a given table.", - Disabled: true, - }, []string{"table"}), - TableGraveyardObjectCount: metric.NewGaugeVec(metric.GaugeOpts{ - Namespace: metrics.CiliumAgentNamespace, - Subsystem: "statedb", - Name: "table_graveyard_objects", - Help: "The amount of objects in the graveyard for a given table.", - Disabled: true, - }, []string{"table"}), - TableGraveyardLowWatermark: metric.NewGaugeVec(metric.GaugeOpts{ - Namespace: metrics.CiliumAgentNamespace, - Subsystem: "statedb", - Name: "table_graveyard_low_watermark", - Help: "The lowest revision of a given table that has been processed by the graveyard garbage collector.", - Disabled: true, - }, []string{"table"}), - TableGraveyardCleaningDuration: metric.NewHistogramVec(metric.HistogramOpts{ - Namespace: metrics.CiliumAgentNamespace, - Subsystem: "statedb", - Name: "table_graveyard_cleaning_duration_seconds", - Help: "The time it took to clean the graveyard for a given table.", - Disabled: true, - }, []string{"table"}), - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/observable.go b/vendor/github.com/cilium/cilium/pkg/statedb/observable.go deleted file mode 100644 index 4246a50e2..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/observable.go +++ /dev/null @@ -1,61 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package statedb - -import ( - "context" - - "github.com/cilium/stream" -) - -type Event[Obj any] struct { - Object Obj - Revision Revision - Deleted bool -} - -// Observable creates an observable from the given table for observing the changes -// to the table as a stream of events. -// -// For high-churn tables it's advisable to apply rate-limiting to the stream to -// decrease overhead (stream.Throttle). -func Observable[Obj any](db *DB, table Table[Obj]) stream.Observable[Event[Obj]] { - return &observable[Obj]{db, table} -} - -type observable[Obj any] struct { - db *DB - table Table[Obj] -} - -func (to *observable[Obj]) Observe(ctx context.Context, next func(Event[Obj]), complete func(error)) { - go func() { - wtxn := to.db.WriteTxn(to.table) - dt, err := to.table.DeleteTracker(wtxn, "Observe") - wtxn.Commit() - if err != nil { - complete(err) - return - } - defer dt.Close() - defer complete(nil) - - for { - watch := dt.Iterate(to.db.ReadTxn(), - func(obj Obj, deleted bool, rev uint64) { - next(Event[Obj]{ - Object: obj, - Revision: rev, - Deleted: deleted, - }) - }) - - select { - case <-ctx.Done(): - return - case <-watch: - } - } - }() -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/cell.go b/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/cell.go deleted file mode 100644 index 3109056ae..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/cell.go +++ /dev/null @@ -1,19 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package reconciler - -import ( - "github.com/cilium/hive/cell" - - "github.com/cilium/cilium/pkg/metrics" -) - -// Cell provides shared objects used by all reconciler instances. -// Currently it provides only the Metrics object. -var Cell = cell.Module( - "reconciler", - "Shared metrics for the reconcilers", - - metrics.Metric(newMetrics), -) diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/full.go b/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/full.go deleted file mode 100644 index e6523520e..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/full.go +++ /dev/null @@ -1,92 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package reconciler - -import ( - "context" - "fmt" - - "golang.org/x/exp/maps" - - "github.com/cilium/cilium/pkg/statedb" - "github.com/cilium/cilium/pkg/time" -) - -// full performs full reconciliation of all objects. First the Prune() operations is performed to clean up and then -// Update() is called for each object. Full reconciliation is used to recover from unexpected outside modifications. -func (r *reconciler[Obj]) full(ctx context.Context, txn statedb.ReadTxn, lastRev statedb.Revision) (statedb.Revision, error) { - defer r.Metrics.FullReconciliationCount.With(r.labels).Add(1) - - var errs []error - outOfSync := false - ops := r.Config.Operations - - // First perform pruning to make room in the target. - iter, _ := r.Table.All(txn) - start := time.Now() - if err := ops.Prune(ctx, txn, iter); err != nil { - outOfSync = true - errs = append(errs, fmt.Errorf("pruning failed: %w", err)) - } - labels := maps.Clone(r.labels) - labels[LabelOperation] = OpPrune - r.Metrics.FullReconciliationDuration.With(labels).Observe( - float64(time.Since(start)) / float64(time.Second), - ) - - // Call Update() for each desired object to validate that it is up-to-date. - updateResults := make(map[Obj]opResult) - iter, _ = r.Table.All(txn) // Grab a new iterator as Prune() may have consumed it. - for obj, rev, ok := iter.Next(); ok; obj, rev, ok = iter.Next() { - start := time.Now() - var changed bool - err := ops.Update(ctx, txn, obj, &changed) - - labels := maps.Clone(r.labels) - labels[LabelOperation] = OpUpdate - r.Metrics.FullReconciliationDuration.With(labels).Observe( - float64(time.Since(start)) / float64(time.Second), - ) - - outOfSync = outOfSync || changed - if err == nil { - updateResults[obj] = opResult{rev: rev, status: StatusDone()} - r.retries.Clear(obj) - } else { - updateResults[obj] = opResult{rev: rev, status: StatusError(false, err)} - errs = append(errs, err) - } - } - - // Increment the out-of-sync counter if full reconciliation catched any out-of-sync - // objects. - if outOfSync { - r.Metrics.FullReconciliationOutOfSyncCount.With(r.labels).Add(1) - } - - // Commit the new desired object status. This is performed separately in order - // to not lock the table when performing long-running target operations. - // If the desired object has been updated in the meanwhile the status update is dropped. - if len(updateResults) > 0 { - wtxn := r.DB.WriteTxn(r.Table) - for obj, result := range updateResults { - obj = r.Config.WithObjectStatus(obj, result.status) - _, _, err := r.Table.CompareAndSwap(wtxn, result.rev, obj) - if err == nil && result.status.Kind != StatusKindDone { - // Object had not changed in the meantime, queue the retry. - r.retries.Add(obj) - } - } - wtxn.Commit() - } - - if len(errs) > 0 { - r.Metrics.FullReconciliationTotalErrors.With(r.labels).Add(1) - return r.Table.Revision(txn), fmt.Errorf("full: %w", joinErrors(errs)) - } - - // Sync succeeded up to latest revision. Continue incremental reconciliation from - // this revision. - return r.Table.Revision(txn), nil -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/helpers.go b/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/helpers.go deleted file mode 100644 index 2b7a6ef63..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/helpers.go +++ /dev/null @@ -1,35 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package reconciler - -import ( - "errors" - "fmt" - - "golang.org/x/exp/slices" -) - -var closedWatchChannel = func() <-chan struct{} { - ch := make(chan struct{}) - close(ch) - return ch -}() - -const ( - // maxJoinedErrors limits the number of errors to join and return from - // failed reconciliation. This avoids constructing a massive error for - // health status when many operations fail at once. - maxJoinedErrors = 10 -) - -func omittedError(n int) error { - return fmt.Errorf("%d further errors omitted", n) -} - -func joinErrors(errs []error) error { - if len(errs) > maxJoinedErrors { - errs = append(slices.Clone(errs)[:maxJoinedErrors], omittedError(len(errs))) - } - return errors.Join(errs...) -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/incremental.go b/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/incremental.go deleted file mode 100644 index e4df6aa47..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/incremental.go +++ /dev/null @@ -1,306 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package reconciler - -import ( - "context" - "fmt" - - "github.com/prometheus/client_golang/prometheus" - "golang.org/x/exp/maps" - - "github.com/cilium/cilium/pkg/statedb" - "github.com/cilium/cilium/pkg/time" -) - -// incrementalRound is the shared context for incremental reconciliation and retries. -type incrementalRound[Obj comparable] struct { - metrics *Metrics - config *Config[Obj] - retries *retries - primaryIndexer statedb.Indexer[Obj] - db *statedb.DB - ctx context.Context - txn statedb.ReadTxn - table statedb.RWTable[Obj] - oldRevision statedb.Revision - - // numReconciled counts the number of objects that have been reconciled in this - // round, both for new & changed objects and for retried objects. If - // Config.IncrementalBatchSize is reached the round is stopped. - // This allows for timely reporting of status when lot of objects have changed and - // reconciliation per object is slow. - numReconciled int - - // results collects the results of update and delete operations. - // The results are committed in a separate write transaction in order to - // not lock the table while reconciling. If an object has changed in the meanwhile - // the stale reconciliation result for that object is dropped. - results map[Obj]opResult - - errs []error -} - -func (r *reconciler[Obj]) incremental(ctx context.Context, txn statedb.ReadTxn, rev statedb.Revision) (statedb.Revision, <-chan struct{}, error) { - round := incrementalRound[Obj]{ - metrics: r.Metrics, - config: &r.Config, - retries: r.retries, - primaryIndexer: r.primaryIndexer, - db: r.DB, - oldRevision: rev, - ctx: ctx, - txn: txn, - table: r.Table, - results: make(map[Obj]opResult), - } - - // Reconcile new and changed objects using either Operations - // or BatchOperations. - var newRevision statedb.Revision - if r.Config.BatchOperations != nil { - newRevision = round.batch(maps.Clone(r.labels)) - } else { - newRevision = round.single(maps.Clone(r.labels)) - } - - // Process objects that need to be retried that were not cleared. - round.processRetries(maps.Clone(r.labels)) - - // Finally commit the status updates. - watch := round.commitStatus() - - if round.numReconciled >= r.Config.IncrementalRoundSize { - // Round size limit was hit, use a closed watch channel to retrigger - // incremental reconciliation immediately. - watch = closedWatchChannel - } - - r.Metrics.IncrementalReconciliationTotalErrors.With(r.labels).Add(float64(len(round.errs))) - r.Metrics.IncrementalReconciliationCurrentErrors.With(r.labels).Set(float64(len(round.errs))) - r.Metrics.IncrementalReconciliationCount.With(r.labels).Add(1) - - if len(round.errs) > 0 { - return newRevision, watch, fmt.Errorf("incremental: %w", joinErrors(round.errs)) - } - return newRevision, watch, nil -} - -func (round *incrementalRound[Obj]) single(labels prometheus.Labels) statedb.Revision { - // Iterate in revision order through new and changed objects. - newRevision := round.oldRevision - iter, _ := round.table.LowerBound(round.txn, statedb.ByRevision[Obj](round.oldRevision+1)) - for obj, rev, ok := iter.Next(); ok; obj, rev, ok = iter.Next() { - newRevision = rev - - status := round.config.GetObjectStatus(obj) - if status.Kind != StatusKindPending { - // Only process objects that are pending reconciliation, e.g. - // changed from outside. - // Failures (e.g. StatusKindError) are processed via the retry queue. - continue - } - - // Clear retries as the object has changed. - round.retries.Clear(obj) - - err := round.processSingle(obj, rev, status, labels) - if err != nil { - round.errs = append(round.errs, err) - } - - round.numReconciled++ - if round.numReconciled >= round.config.IncrementalRoundSize { - break - } - } - return newRevision -} - -func (round *incrementalRound[Obj]) batch(labels prometheus.Labels) statedb.Revision { - ops := round.config.BatchOperations - updateBatch := []BatchEntry[Obj]{} - deleteBatch := []BatchEntry[Obj]{} - - // Iterate in revision order through new and changed objects. - newRevision := round.oldRevision - iter, _ := round.table.LowerBound(round.txn, statedb.ByRevision[Obj](round.oldRevision+1)) - for obj, rev, ok := iter.Next(); ok; obj, rev, ok = iter.Next() { - newRevision = rev - - status := round.config.GetObjectStatus(obj) - if status.Kind != StatusKindPending { - // Only process objects that are pending reconciliation, e.g. - // changed from outside. - // Failures (e.g. StatusKindError) are processed via the retry queue. - continue - } - - // Clear an existing retry as the object has changed. - round.retries.Clear(obj) - - if status.Delete { - deleteBatch = append(deleteBatch, BatchEntry[Obj]{Object: obj, Revision: rev}) - } else { - updateBatch = append(updateBatch, BatchEntry[Obj]{Object: obj, Revision: rev}) - } - - round.numReconciled++ - if round.numReconciled >= round.config.IncrementalRoundSize { - break - } - } - - // Process the delete batch first to make room. - if len(deleteBatch) > 0 { - start := time.Now() - ops.DeleteBatch(round.ctx, round.txn, deleteBatch) - labels[LabelOperation] = OpDelete - round.metrics.IncrementalReconciliationDuration.With(labels).Observe( - float64(time.Since(start)) / float64(time.Second), - ) - for _, entry := range deleteBatch { - if entry.Result == nil { - // Reconciling succeeded, so clear the retries. - round.retries.Clear(entry.Object) - round.results[entry.Object] = opResult{rev: entry.Revision, delete: true} - } else { - round.errs = append(round.errs, entry.Result) - round.results[entry.Object] = opResult{rev: entry.Revision, status: StatusError(true, entry.Result)} - } - } - } - - // And then the update batch. - if len(updateBatch) > 0 { - start := time.Now() - ops.UpdateBatch(round.ctx, round.txn, updateBatch) - labels[LabelOperation] = OpUpdate - round.metrics.IncrementalReconciliationDuration.With(labels).Observe( - float64(time.Since(start)) / float64(time.Second), - ) - - for _, entry := range updateBatch { - if entry.Result == nil { - // Reconciling succeeded, so clear the retries. - round.retries.Clear(entry.Object) - round.results[entry.Object] = opResult{rev: entry.Revision, status: StatusDone()} - } else { - round.errs = append(round.errs, entry.Result) - round.results[entry.Object] = opResult{rev: entry.Revision, status: StatusError(false, entry.Result)} - } - } - } - return newRevision -} - -func (round *incrementalRound[Obj]) processRetries(labels prometheus.Labels) { - now := time.Now() - for round.numReconciled < round.config.IncrementalRoundSize { - robj, retryAt, ok := round.retries.Top() - if !ok || retryAt.After(now) { - break - } - round.retries.Pop() - - obj, rev, ok := round.table.First(round.txn, round.primaryIndexer.QueryFromObject(robj.(Obj))) - if !ok { - // Object has been deleted unexpectedly (e.g. from outside - // the reconciler). Assume that it can be forgotten about. - round.retries.Clear(robj) - continue - } - - status := round.config.GetObjectStatus(obj) - if status.Kind != StatusKindError { - continue - } - - err := round.processSingle(obj, rev, status, labels) - if err != nil { - round.errs = append(round.errs, err) - } - - round.numReconciled++ - } -} - -func (round *incrementalRound[Obj]) processSingle(obj Obj, rev statedb.Revision, status Status, labels prometheus.Labels) error { - start := time.Now() - - var err error - if status.Delete { - labels[LabelOperation] = OpDelete - err = round.config.Operations.Delete(round.ctx, round.txn, obj) - if err == nil { - round.results[obj] = opResult{rev: rev, delete: true} - } else { - round.results[obj] = opResult{rev: rev, status: StatusError(true, err)} - } - } else { - labels[LabelOperation] = OpUpdate - err = round.config.Operations.Update(round.ctx, round.txn, obj, nil /* changed */) - if err == nil { - round.results[obj] = opResult{rev: rev, status: StatusDone()} - } else { - round.results[obj] = opResult{rev: rev, status: StatusError(false, err)} - } - } - round.metrics.IncrementalReconciliationDuration.With(labels).Observe( - float64(time.Since(start)) / float64(time.Second), - ) - - if err == nil { - // Reconciling succeeded, so clear the object. - round.retries.Clear(obj) - } - - return err - -} - -func (round *incrementalRound[Obj]) commitStatus() <-chan struct{} { - if len(round.results) == 0 { - // Nothing to commit. - _, watch := round.table.All(round.txn) - return watch - } - - wtxn := round.db.WriteTxn(round.table) - defer wtxn.Commit() - - // The revision before committing the status updates. - revBeforeWrite := round.table.Revision(wtxn) - - // Commit status for updated objects. - for obj, result := range round.results { - if result.delete { - round.table.CompareAndDelete(wtxn, result.rev, obj) - continue - } - - // Update the object if it is unchanged. It may happen that the object has - // been updated in the meanwhile, in which case we ignore the status as the - // update will be picked up by next reconciliation round. - round.table.CompareAndSwap(wtxn, result.rev, round.config.WithObjectStatus(obj, result.status)) - - if result.status.Kind == StatusKindError { - // Reconciling the object failed, so add it to be retried now that it's - // status is updated. - round.retries.Add(obj) - } - } - - watch := closedWatchChannel - if round.oldRevision == revBeforeWrite { - // No changes happened between the ReadTxn and this WriteTxn. Grab a new - // watch channel of the root to only watch for new changes after - // this write. - // - // If changes did happen, we'll return a closed watch channel and - // immediately reconcile again. - _, watch = round.table.All(wtxn) - } - return watch -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/index.go b/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/index.go deleted file mode 100644 index 5b8cbe89e..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/index.go +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package reconciler - -import ( - "github.com/cilium/cilium/pkg/statedb" - "github.com/cilium/cilium/pkg/statedb/index" -) - -// NewStatusIndex creates a status index for a table of reconcilable objects. -func NewStatusIndex[Obj any](getObjectStatus func(Obj) Status) statedb.Index[Obj, StatusKind] { - return statedb.Index[Obj, StatusKind]{ - Name: "status", - FromObject: func(obj Obj) index.KeySet { - return index.NewKeySet(getObjectStatus(obj).Kind.Key()) - }, - FromKey: StatusKind.Key, - Unique: false, - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/metrics.go b/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/metrics.go deleted file mode 100644 index beacbfd69..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/metrics.go +++ /dev/null @@ -1,106 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package reconciler - -import ( - "github.com/cilium/cilium/pkg/metrics" - "github.com/cilium/cilium/pkg/metrics/metric" -) - -type Metrics struct { - IncrementalReconciliationCount metric.Vec[metric.Counter] - IncrementalReconciliationDuration metric.Vec[metric.Observer] - IncrementalReconciliationTotalErrors metric.Vec[metric.Counter] - IncrementalReconciliationCurrentErrors metric.Vec[metric.Gauge] - - FullReconciliationCount metric.Vec[metric.Counter] - FullReconciliationOutOfSyncCount metric.Vec[metric.Counter] - FullReconciliationTotalErrors metric.Vec[metric.Counter] - FullReconciliationDuration metric.Vec[metric.Observer] -} - -const ( - LabelModuleId = "module_id" - LabelOperation = "op" - - OpUpdate = "update" - OpDelete = "delete" - OpPrune = "prune" -) - -func newMetrics() *Metrics { - return &Metrics{ - IncrementalReconciliationCount: metric.NewCounterVec(metric.CounterOpts{ - ConfigName: metrics.Namespace + "_reconciler_incremental_total", - Disabled: true, - Namespace: metrics.Namespace, - Subsystem: "reconciler", - Name: "incremental_total", - Help: "Number of incremental reconciliations performed", - }, []string{LabelModuleId}), - - IncrementalReconciliationDuration: metric.NewHistogramVec(metric.HistogramOpts{ - ConfigName: metrics.Namespace + "_reconciler_incremental_duration_seconds", - Disabled: true, - Namespace: metrics.Namespace, - Subsystem: "reconciler", - Name: "incremental_duration_seconds", - Help: "Histogram of per-operation duration during incremental reconciliation", - }, []string{LabelModuleId, LabelOperation}), - - IncrementalReconciliationTotalErrors: metric.NewCounterVec(metric.CounterOpts{ - ConfigName: metrics.Namespace + "_reconciler_incremental_errors_total", - Disabled: true, - Namespace: metrics.Namespace, - Subsystem: "reconciler", - Name: "incremental_errors_total", - Help: "Total number of errors encountered during incremental reconciliation", - }, []string{LabelModuleId}), - - IncrementalReconciliationCurrentErrors: metric.NewGaugeVec(metric.GaugeOpts{ - ConfigName: metrics.Namespace + "_reconciler_incremental_errors_current", - Disabled: true, - Namespace: metrics.Namespace, - Subsystem: "reconciler", - Name: "incremental_errors_current", - Help: "The number of objects currently failing to be reconciled", - }, []string{LabelModuleId}), - - FullReconciliationCount: metric.NewCounterVec(metric.CounterOpts{ - ConfigName: metrics.Namespace + "_reconciler_full_total", - Disabled: true, - Namespace: metrics.Namespace, - Subsystem: "reconciler", - Name: "full_total", - Help: "Number of full reconciliations performed", - }, []string{LabelModuleId}), - - FullReconciliationOutOfSyncCount: metric.NewCounterVec(metric.CounterOpts{ - ConfigName: metrics.Namespace + "_reconciler_full_out_of_sync_total", - Disabled: true, - Namespace: metrics.Namespace, - Subsystem: "reconciler", - Name: "full_out_of_sync_total", - Help: "Number of times full reconciliation found objects to reconcile", - }, []string{LabelModuleId}), - - FullReconciliationTotalErrors: metric.NewCounterVec(metric.CounterOpts{ - ConfigName: metrics.Namespace + "_reconciler_full_errors_total", - Disabled: true, - Namespace: metrics.Namespace, - Subsystem: "reconciler", - Name: "full_errors_total", - Help: "Total number of errors encountered during full reconciliation", - }, []string{LabelModuleId}), - - FullReconciliationDuration: metric.NewHistogramVec(metric.HistogramOpts{ - ConfigName: metrics.Namespace + "_reconciler_full_duration_seconds", - Disabled: true, - Namespace: metrics.Namespace, - Subsystem: "reconciler", - Name: "full_duration_seconds", - Help: "Histogram of per-operation duration during full reconciliation", - }, []string{LabelModuleId, LabelOperation}), - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/reconciler.go b/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/reconciler.go deleted file mode 100644 index f52848d7c..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/reconciler.go +++ /dev/null @@ -1,181 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package reconciler - -import ( - "context" - "errors" - "fmt" - - "github.com/cilium/hive/cell" - "github.com/cilium/hive/job" - "github.com/prometheus/client_golang/prometheus" - - "github.com/cilium/cilium/pkg/statedb" - "github.com/cilium/cilium/pkg/statedb/index" - "github.com/cilium/cilium/pkg/time" -) - -// Register creates a new reconciler and registers to the application -// lifecycle. To be used with cell.Invoke when the API of the reconciler -// is not needed. -func Register[Obj comparable](p Params[Obj]) error { - _, err := New(p) - return err -} - -// New creates and registers a new reconciler. -func New[Obj comparable](p Params[Obj]) (Reconciler[Obj], error) { - if err := p.Config.validate(); err != nil { - return nil, err - } - - idx := p.Table.PrimaryIndexer() - objectToKey := func(o any) index.Key { - return idx.ObjectToKey(o.(Obj)) - } - r := &reconciler[Obj]{ - Params: p, - retries: newRetries(p.Config.RetryBackoffMinDuration, p.Config.RetryBackoffMaxDuration, objectToKey), - externalFullTrigger: make(chan struct{}, 1), - labels: prometheus.Labels{ - LabelModuleId: string(p.ModuleId), - }, - primaryIndexer: idx, - } - - g := p.Jobs.NewGroup(p.Health) - - g.Add(job.OneShot("reconciler-loop", r.loop)) - p.Lifecycle.Append(g) - - return r, nil -} - -type Params[Obj comparable] struct { - cell.In - - Config Config[Obj] - Lifecycle cell.Lifecycle - DB *statedb.DB - Table statedb.RWTable[Obj] - Jobs job.Registry - Metrics *Metrics - ModuleId cell.ModuleID - Health cell.Health -} - -type reconciler[Obj comparable] struct { - Params[Obj] - retries *retries - externalFullTrigger chan struct{} - primaryIndexer statedb.Indexer[Obj] - labels prometheus.Labels -} - -func (r *reconciler[Obj]) TriggerFullReconciliation() { - select { - case r.externalFullTrigger <- struct{}{}: - default: - } -} - -// WaitForReconciliation blocks until all objects have been reconciled or the context -// has cancelled. -func WaitForReconciliation[Obj any](ctx context.Context, db *statedb.DB, table statedb.Table[Obj], statusIndex statedb.Index[Obj, StatusKind]) error { - for { - txn := db.ReadTxn() - - // See if there are any pending or error'd objects. - _, _, watchPending, okPending := table.FirstWatch(txn, statusIndex.Query(StatusKindPending)) - _, _, watchError, okError := table.FirstWatch(txn, statusIndex.Query(StatusKindError)) - if !okPending && !okError { - return nil - } - - // Wait for updates before checking again. - select { - case <-ctx.Done(): - return ctx.Err() - case <-watchPending: - case <-watchError: - } - } -} - -func (r *reconciler[Obj]) loop(ctx context.Context, health cell.Health) error { - var fullReconTickerChan <-chan time.Time - if r.Config.FullReconcilationInterval > 0 { - fullReconTicker := time.NewTicker(r.Config.FullReconcilationInterval) - defer fullReconTicker.Stop() - fullReconTickerChan = fullReconTicker.C - } - if r.Config.RateLimiter != nil { - defer r.Config.RateLimiter.Stop() - } - - tableWatchChan := closedWatchChannel - revision := statedb.Revision(0) - fullReconciliation := false - - for { - if r.Config.RateLimiter != nil { - r.Config.RateLimiter.Wait(ctx) - } - - // Wait for trigger - select { - case <-ctx.Done(): - return ctx.Err() - - case <-fullReconTickerChan: - fullReconciliation = true - case <-r.externalFullTrigger: - fullReconciliation = true - - case <-r.retries.Wait(): - // Object(s) are ready to be retried - - case <-tableWatchChan: - // Table has changed - } - - var ( - err error - errs []error - txn = r.DB.ReadTxn() - ) - - // Perform incremental reconciliation and retries of previously failed - // objects. - revision, tableWatchChan, err = r.incremental(ctx, txn, revision) - if err != nil { - errs = append(errs, err) - } - - if fullReconciliation { - // Time to perform a full reconciliation. An incremental reconciliation - // has been performed prior to this, so the assumption is that everything - // is up to date (provided incremental reconciliation did not fail). We - // report full reconciliation disparencies as they're indicative of something - // interfering with Cilium operations. - - // Clear full reconciliation even if there's errors. Individual objects - // will be retried via the retry queue. - fullReconciliation = false - - var err error - revision, err = r.full(ctx, txn, revision) - if err != nil { - errs = append(errs, err) - } - } - - if len(errs) == 0 { - health.OK(fmt.Sprintf("OK, %d objects", r.Table.NumObjects(txn))) - } else { - health.Degraded("Reconciliation failed", errors.Join(errs...)) - } - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/retries.go b/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/retries.go deleted file mode 100644 index b5d708e8e..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/retries.go +++ /dev/null @@ -1,136 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package reconciler - -import ( - "container/heap" - - "github.com/cilium/cilium/pkg/backoff" - "github.com/cilium/cilium/pkg/statedb/index" - "github.com/cilium/cilium/pkg/time" -) - -func newRetries(minDuration, maxDuration time.Duration, objectToKey func(any) index.Key) *retries { - return &retries{ - backoff: backoff.Exponential{ - Min: minDuration, - Max: maxDuration, - }, - queue: nil, - items: make(map[string]*retryItem), - objectToKey: objectToKey, - } -} - -// retries holds the items that failed to be reconciled in -// a priority queue ordered by retry time. Methods of 'retries' -// are not safe to access concurrently. -type retries struct { - backoff backoff.Exponential - queue retryPrioQueue - items map[string]*retryItem - objectToKey func(any) index.Key -} - -type retryItem struct { - object any // the object that is being retried. 'any' to avoid specializing this internal code. - index int // item's index in the priority queue - retryAt time.Time // time at which to retry - numRetries int // number of retries attempted (for calculating backoff) -} - -// Wait returns a channel that is closed when there is an item to retry. -// Returns nil channel if no items are queued. -func (rq *retries) Wait() <-chan struct{} { - if _, retryAt, ok := rq.Top(); ok { - now := time.Now() - ch := make(chan struct{}, 1) - if now.After(retryAt) { - // Already expired. - close(ch) - } else { - time.AfterFunc(retryAt.Sub(now), func() { close(ch) }) - } - return ch - } - return nil -} - -func (rq *retries) Top() (object any, retryAt time.Time, ok bool) { - if rq.queue.Len() == 0 { - return - } - item := rq.queue[0] - return item.object, item.retryAt, true -} - -func (rq *retries) Pop() { - // Pop the object from the queue, but leave it into the map until - // the object is cleared or re-added. - heap.Pop(&rq.queue) -} - -func (rq *retries) Add(obj any) { - var ( - item *retryItem - ok bool - ) - key := rq.objectToKey(obj) - if item, ok = rq.items[string(key)]; !ok { - item = &retryItem{ - numRetries: 0, - } - rq.items[string(key)] = item - } - item.object = obj - item.numRetries += 1 - item.retryAt = time.Now().Add(rq.backoff.Duration(item.numRetries)) - heap.Push(&rq.queue, item) -} - -func (rq *retries) Clear(obj any) { - key := rq.objectToKey(obj) - if item, ok := rq.items[string(key)]; ok { - // Remove the object from the queue if it is still there. - if item.index >= 0 && item.index < len(rq.queue) && - key.Equal(rq.objectToKey(rq.queue[item.index].object)) { - heap.Remove(&rq.queue, item.index) - } - // Completely forget the object and its retry count. - delete(rq.items, string(key)) - } -} - -// retryPrioQueue is a slice-backed priority heap with the next -// expiring 'retryItem' at top. Implementation is adapted from the -// 'container/heap' PriorityQueue example. -type retryPrioQueue []*retryItem - -func (pq retryPrioQueue) Len() int { return len(pq) } - -func (pq retryPrioQueue) Less(i, j int) bool { - return pq[i].retryAt.Before(pq[j].retryAt) -} - -func (pq retryPrioQueue) Swap(i, j int) { - pq[i], pq[j] = pq[j], pq[i] - pq[i].index = i - pq[j].index = j -} - -func (pq *retryPrioQueue) Push(x any) { - retryObj := x.(*retryItem) - retryObj.index = len(*pq) - *pq = append(*pq, retryObj) -} - -func (pq *retryPrioQueue) Pop() any { - old := *pq - n := len(old) - item := old[n-1] - old[n-1] = nil // avoid memory leak - item.index = -1 // for safety - *pq = old[0 : n-1] - return item -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/types.go b/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/types.go deleted file mode 100644 index 75de3f4fc..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/reconciler/types.go +++ /dev/null @@ -1,246 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package reconciler - -import ( - "context" - "fmt" - - "github.com/cilium/cilium/pkg/rate" - "github.com/cilium/cilium/pkg/statedb" - "github.com/cilium/cilium/pkg/statedb/index" - "github.com/cilium/cilium/pkg/time" -) - -type Reconciler[Obj any] interface { - // TriggerFullReconciliation triggers an immediate full reconciliation, - // e.g. Prune() of unknown objects and Update() of all objects. - // Implemented as a select+send to a channel of size 1, so N concurrent - // calls of this method may result in less than N full reconciliations. - // - // Primarily useful in tests, but may be of use when there's knowledge - // that something has gone wrong in the reconciliation target and full - // reconciliation is needed to recover. - TriggerFullReconciliation() -} - -type Config[Obj any] struct { - // FullReconcilationInterval is the amount of time to wait between full - // reconciliation rounds. A full reconciliation is Prune() of unexpected - // objects and Update() of all objects. With full reconciliation we're - // resilient towards outside changes. If FullReconcilationInterval is - // 0 then full reconciliation is disabled. - FullReconcilationInterval time.Duration - - // RetryBackoffMinDuration is the minimum amount of time to wait before - // retrying a failed Update() or Delete() operation on an object. - // The retry wait time for an object will increase exponentially on - // subsequent failures until RetryBackoffMaxDuration is reached. - RetryBackoffMinDuration time.Duration - - // RetryBackoffMaxDuration is the maximum amount of time to wait before - // retrying. - RetryBackoffMaxDuration time.Duration - - // IncrementalRoundSize is the maximum number objects to reconcile during - // incremental reconciliation before updating status and refreshing the - // statedb snapshot. This should be tuned based on the cost of each operation - // and the rate of expected changes so that health and per-object status - // updates are not delayed too much. If in doubt, use a value between 100-1000. - IncrementalRoundSize int - - // GetObjectStatus returns the reconciliation status for the object. - GetObjectStatus func(Obj) Status - - // WithObjectStatus returns a COPY of the object with the status set to - // the given value. - WithObjectStatus func(Obj, Status) Obj - - // RateLimiter is optional and if set will use the limiter to wait between - // reconciliation rounds. This allows trading latency with throughput by - // waiting longer to collect a batch of objects to reconcile. - RateLimiter *rate.Limiter - - // Operations defines how an object is reconciled. - Operations Operations[Obj] - - // BatchOperations is optional and if provided these are used instead of normal operations. - BatchOperations BatchOperations[Obj] -} - -func (cfg Config[Obj]) validate() error { - if cfg.GetObjectStatus == nil { - return fmt.Errorf("%T.GetObjectStatus cannot be nil", cfg) - } - if cfg.WithObjectStatus == nil { - return fmt.Errorf("%T.WithObjectStatus cannot be nil", cfg) - } - if cfg.IncrementalRoundSize <= 0 { - return fmt.Errorf("%T.IncrementalBatchSize needs to be >0", cfg) - } - if cfg.FullReconcilationInterval < 0 { - return fmt.Errorf("%T.FullReconcilationInterval must be >=0", cfg) - } - if cfg.RetryBackoffMaxDuration <= 0 { - return fmt.Errorf("%T.RetryBackoffMaxDuration must be >0", cfg) - } - if cfg.RetryBackoffMinDuration <= 0 { - return fmt.Errorf("%T.RetryBackoffMinDuration must be >0", cfg) - } - if cfg.Operations == nil { - return fmt.Errorf("%T.Operations must be defined", cfg) - } - return nil -} - -// Operations defines how to reconcile an object. -// -// Each operation is given a context that limits the lifetime of the operation -// and a ReadTxn to allow for the option of looking up realized state from another -// statedb table as an optimization (main use-case is reconciling routes against -// Table[Route] to avoid a syscall per route). -type Operations[Obj any] interface { - // Update the object in the target. If the operation is long-running it should - // abort if context is cancelled. Should return an error if the operation fails. - // The reconciler will retry the operation again at a later time, potentially - // with a new version of the object. The operation should thus be idempotent. - // - // Update is used both for incremental and full reconciliation. Incremental - // reconciliation is performed when the desired state is updated. A full - // reconciliation is done periodically by calling 'Update' on all objects. - // - // If 'changed' is non-nil then the Update must compare the realized state - // with the desired state and set it to true if they differ, e.g. whether - // the operation resulted in a change to the realized state. This is used - // during full reconciliation to catch cases where the realized state has - // gone out of sync due to outside influence. This is tracked in the - // "full_out_of_sync_total" metric. - Update(ctx context.Context, txn statedb.ReadTxn, obj Obj, changed *bool) error - - // Delete the object in the target. Same semantics as with Update. - // Deleting a non-existing object is not an error and returns nil. - Delete(context.Context, statedb.ReadTxn, Obj) error - - // Prune undesired state. It is given an iterator for the full set of - // desired objects. The implementation should diff the desired state against - // the realized state to find things to prune. - // Invoked during full reconciliation before the individual objects are Update()'d. - // - // Unlike failed Update()'s a failed Prune() operation is not retried until - // the next full reconciliation round. - Prune(context.Context, statedb.ReadTxn, statedb.Iterator[Obj]) error -} - -type BatchEntry[Obj any] struct { - Object Obj - Revision statedb.Revision - Result error -} - -type BatchOperations[Obj any] interface { - UpdateBatch(ctx context.Context, txn statedb.ReadTxn, batch []BatchEntry[Obj]) - DeleteBatch(context.Context, statedb.ReadTxn, []BatchEntry[Obj]) -} - -type StatusKind string - -const ( - StatusKindPending StatusKind = "pending" - StatusKindDone StatusKind = "done" - StatusKindError StatusKind = "error" -) - -// Key implements an optimized construction of index.Key for StatusKind -// to avoid copying and allocation. -func (s StatusKind) Key() index.Key { - switch s { - case StatusKindPending: - return index.Key("P") - case StatusKindDone: - return index.Key("D") - case StatusKindError: - return index.Key("E") - } - panic("BUG: unmatched StatusKind") -} - -// Status is embedded into the reconcilable object. It allows -// inspecting per-object reconciliation status and waiting for -// the reconciler. -type Status struct { - Kind StatusKind - - // Delete is true if the object should be deleted by the reconciler. - // If an object is deleted outside the reconciler it will not be - // processed by the incremental reconciliation. - // We use soft deletes in order to observe and wait for deletions. - Delete bool - - UpdatedAt time.Time - Error string -} - -func (s Status) String() string { - if s.Kind == StatusKindError { - return fmt.Sprintf("%s (delete: %v, updated: %s ago, error: %s)", s.Kind, s.Delete, time.Now().Sub(s.UpdatedAt), s.Error) - } - return fmt.Sprintf("%s (delete: %v, updated: %s ago)", s.Kind, s.Delete, time.Now().Sub(s.UpdatedAt)) -} - -// StatusPending constructs the status for marking the object as -// requiring reconciliation. The reconciler will perform the -// Update operation and on success transition to Done status, or -// on failure to Error status. -func StatusPending() Status { - return Status{ - Kind: StatusKindPending, - UpdatedAt: time.Now(), - Delete: false, - Error: "", - } -} - -// StatusPendingDelete constructs the status for marking the -// object to be deleted. -// -// The reconciler uses soft-deletes in order to be able to -// retry and to report failed deletions of objects. -// When the delete operation is successfully performed -// the reconciler will delete the object from the table. -func StatusPendingDelete() Status { - return Status{ - Kind: StatusKindPending, - UpdatedAt: time.Now(), - Delete: true, - Error: "", - } -} - -// StatusDone constructs the status that marks the object as -// reconciled. -func StatusDone() Status { - return Status{ - Kind: StatusKindDone, - UpdatedAt: time.Now(), - Error: "", - } -} - -// StatusError constructs the status that marks the object -// as failed to be reconciled. -func StatusError(delete bool, err error) Status { - return Status{ - Kind: StatusKindError, - UpdatedAt: time.Now(), - Delete: delete, - Error: err.Error(), - } -} - -// opResult is the outcome from reconciling a single object -type opResult struct { - rev statedb.Revision // revision of the object - status Status // the status to commit - delete bool // if true delete object from the table -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/table.go b/vendor/github.com/cilium/cilium/pkg/statedb/table.go deleted file mode 100644 index 9d4c34729..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/table.go +++ /dev/null @@ -1,304 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package statedb - -import ( - "fmt" - "strings" - - "k8s.io/apimachinery/pkg/util/sets" - - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/statedb/index" -) - -// NewTable creates a new table with given name and indexes. -// Can fail if the indexes are malformed. -// -// To provide access to the table via Hive: -// -// cell.Provide( -// // Provide statedb.RWTable[*MyObject]. Often only provided to the module with ProvidePrivate. -// statedb.NewTable[*MyObject]("my-objects", MyObjectIDIndex, MyObjectNameIndex), -// // Provide the read-only statedb.Table[*MyObject]. -// statedb.RWTable[*MyObject].ToTable, -// ) -func NewTable[Obj any]( - tableName TableName, - primaryIndexer Indexer[Obj], - secondaryIndexers ...Indexer[Obj], -) (RWTable[Obj], error) { - toAnyIndexer := func(idx Indexer[Obj]) anyIndexer { - return anyIndexer{ - name: idx.indexName(), - fromObject: func(iobj object) index.KeySet { - return idx.fromObject(iobj.data.(Obj)) - }, - unique: idx.isUnique(), - } - } - - table := &genTable[Obj]{ - table: tableName, - smu: lock.NewSortableMutex(), - primaryAnyIndexer: toAnyIndexer(primaryIndexer), - primaryIndexer: primaryIndexer, - secondaryAnyIndexers: make(map[string]anyIndexer, len(secondaryIndexers)), - } - - for _, indexer := range secondaryIndexers { - table.secondaryAnyIndexers[indexer.indexName()] = toAnyIndexer(indexer) - } - - // Primary index must always be unique - if !primaryIndexer.isUnique() { - return nil, tableError(tableName, ErrPrimaryIndexNotUnique) - } - - // Validate that indexes have unique ids. - indexNames := sets.New[string]() - indexNames.Insert(primaryIndexer.indexName()) - for _, indexer := range secondaryIndexers { - if indexNames.Has(indexer.indexName()) { - return nil, tableError(tableName, fmt.Errorf("index %q: %w", indexer.indexName(), ErrDuplicateIndex)) - } - indexNames.Insert(indexer.indexName()) - } - for name := range indexNames { - if strings.HasPrefix(name, reservedIndexPrefix) { - return nil, tableError(tableName, fmt.Errorf("index %q: %w", name, ErrReservedPrefix)) - } - } - return table, nil -} - -// MustNewTable creates a new table with given name and indexes. -// Panics if indexes are malformed. -func MustNewTable[Obj any]( - tableName TableName, - primaryIndexer Indexer[Obj], - secondaryIndexers ...Indexer[Obj]) RWTable[Obj] { - t, err := NewTable[Obj](tableName, primaryIndexer, secondaryIndexers...) - if err != nil { - panic(err) - } - return t -} - -type genTable[Obj any] struct { - table TableName - smu lock.SortableMutex - primaryIndexer Indexer[Obj] - primaryAnyIndexer anyIndexer - secondaryAnyIndexers map[string]anyIndexer -} - -func (t *genTable[Obj]) tableKey() []byte { - return []byte(t.table) -} - -func (t *genTable[Obj]) PrimaryIndexer() Indexer[Obj] { - return t.primaryIndexer -} - -func (t *genTable[Obj]) primary() anyIndexer { - return t.primaryAnyIndexer -} - -func (t *genTable[Obj]) secondary() map[string]anyIndexer { - return t.secondaryAnyIndexers -} - -func (t *genTable[Obj]) Name() string { - return t.table -} - -func (t *genTable[Obj]) ToTable() Table[Obj] { - return t -} - -func (t *genTable[Obj]) Revision(txn ReadTxn) Revision { - return txn.getTxn().GetRevision(t.table) -} - -func (t *genTable[Obj]) NumObjects(txn ReadTxn) int { - indexTxn := txn.getTxn().mustIndexReadTxn(t.table, t.primaryAnyIndexer.name) - return indexTxn.entry.tree.Len() -} - -func (t *genTable[Obj]) First(txn ReadTxn, q Query[Obj]) (obj Obj, revision uint64, ok bool) { - obj, revision, _, ok = t.FirstWatch(txn, q) - return -} - -func (t *genTable[Obj]) FirstWatch(txn ReadTxn, q Query[Obj]) (obj Obj, revision uint64, watch <-chan struct{}, ok bool) { - indexTxn := txn.getTxn().mustIndexReadTxn(t.table, q.index) - iter := indexTxn.Root().Iterator() - watch = iter.SeekPrefixWatch(q.key) - - var iobj object - for { - var key []byte - key, iobj, ok = iter.Next() - if !ok { - break - } - - // Check that we have a full match on the key - var match bool - if indexTxn.entry.unique { - match = len(key) == len(q.key) - } else { - _, secondary := decodeNonUniqueKey(key) - match = len(secondary) == len(q.key) - } - if match { - break - } - } - - if ok { - obj = iobj.data.(Obj) - revision = iobj.revision - } - return -} - -func (t *genTable[Obj]) Last(txn ReadTxn, q Query[Obj]) (obj Obj, revision uint64, ok bool) { - obj, revision, _, ok = t.LastWatch(txn, q) - return -} - -func (t *genTable[Obj]) LastWatch(txn ReadTxn, q Query[Obj]) (obj Obj, revision uint64, watch <-chan struct{}, ok bool) { - indexTxn := txn.getTxn().mustIndexReadTxn(t.table, q.index) - iter := indexTxn.Root().ReverseIterator() - watch = iter.SeekPrefixWatch(q.key) - - var iobj object - for { - var key []byte - key, iobj, ok = iter.Previous() - if !ok { - break - } - - // Check that we have a full match on the key - var match bool - if indexTxn.entry.unique { - match = len(key) == len(q.key) - } else { - _, secondary := decodeNonUniqueKey(key) - match = len(secondary) == len(q.key) - } - if match { - break - } - } - - if ok { - obj = iobj.data.(Obj) - revision = iobj.revision - } - return -} - -func (t *genTable[Obj]) LowerBound(txn ReadTxn, q Query[Obj]) (Iterator[Obj], <-chan struct{}) { - indexTxn := txn.getTxn().mustIndexReadTxn(t.table, q.index) - root := indexTxn.Root() - - // Since LowerBound query may be invalidated by changes in another branch - // of the tree, we cannot just simply watch the node we seeked to. Instead - // we watch the whole table for changes. - watch, _, _ := root.GetWatch(nil) - iter := root.Iterator() - iter.SeekLowerBound(q.key) - return &iterator[Obj]{iter}, watch -} - -func (t *genTable[Obj]) All(txn ReadTxn) (Iterator[Obj], <-chan struct{}) { - indexTxn := txn.getTxn().mustIndexReadTxn(t.table, t.primaryAnyIndexer.name) - root := indexTxn.Root() - // Grab the watch channel for the root node - watchCh, _, _ := root.GetWatch(nil) - return &iterator[Obj]{root.Iterator()}, watchCh -} - -func (t *genTable[Obj]) Get(txn ReadTxn, q Query[Obj]) (Iterator[Obj], <-chan struct{}) { - indexTxn := txn.getTxn().mustIndexReadTxn(t.table, q.index) - iter := indexTxn.Root().Iterator() - watchCh := iter.SeekPrefixWatch(q.key) - - if indexTxn.entry.unique { - return &uniqueIterator[Obj]{iter, q.key}, watchCh - } - return &nonUniqueIterator[Obj]{iter, q.key}, watchCh -} - -func (t *genTable[Obj]) Insert(txn WriteTxn, obj Obj) (oldObj Obj, hadOld bool, err error) { - var data any - data, hadOld, err = txn.getTxn().Insert(t, Revision(0), obj) - if err == nil && hadOld { - oldObj = data.(Obj) - } - return -} - -func (t *genTable[Obj]) CompareAndSwap(txn WriteTxn, rev Revision, obj Obj) (oldObj Obj, hadOld bool, err error) { - var data any - data, hadOld, err = txn.getTxn().Insert(t, rev, obj) - if err == nil && hadOld { - oldObj = data.(Obj) - } - return -} - -func (t *genTable[Obj]) Delete(txn WriteTxn, obj Obj) (oldObj Obj, hadOld bool, err error) { - var data any - data, hadOld, err = txn.getTxn().Delete(t, Revision(0), obj) - if err == nil && hadOld { - oldObj = data.(Obj) - } - return -} - -func (t *genTable[Obj]) CompareAndDelete(txn WriteTxn, rev Revision, obj Obj) (oldObj Obj, hadOld bool, err error) { - var data any - data, hadOld, err = txn.getTxn().Delete(t, rev, obj) - if err == nil && hadOld { - oldObj = data.(Obj) - } - return -} - -func (t *genTable[Obj]) DeleteAll(txn WriteTxn) error { - iter, _ := t.All(txn) - itxn := txn.getTxn() - for obj, _, ok := iter.Next(); ok; obj, _, ok = iter.Next() { - _, _, err := itxn.Delete(t, Revision(0), obj) - if err != nil { - return err - } - } - return nil -} - -func (t *genTable[Obj]) DeleteTracker(txn WriteTxn, trackerName string) (*DeleteTracker[Obj], error) { - dt := &DeleteTracker[Obj]{ - db: txn.getTxn().db, - trackerName: trackerName, - table: t, - } - err := txn.getTxn().addDeleteTracker(t, trackerName, dt) - if err != nil { - return nil, err - } - return dt, nil -} - -func (t *genTable[Obj]) sortableMutex() lock.SortableMutex { - return t.smu -} - -var _ Table[bool] = &genTable[bool]{} -var _ RWTable[bool] = &genTable[bool]{} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/txn.go b/vendor/github.com/cilium/cilium/pkg/statedb/txn.go deleted file mode 100644 index fb795faea..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/txn.go +++ /dev/null @@ -1,503 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package statedb - -import ( - "bufio" - "encoding/binary" - "encoding/json" - "fmt" - "io" - - iradix "github.com/hashicorp/go-immutable-radix/v2" - "github.com/prometheus/client_golang/prometheus" - - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/statedb/index" - "github.com/cilium/cilium/pkg/time" -) - -type txn struct { - db *DB - rootReadTxn *iradix.Txn[tableEntry] // read transaction onto the tree of tables - writeTxns map[tableIndex]indexTxn // opened per-index write transactions - modifiedTables map[TableName]*tableEntry // table entries being modified - smus lock.SortableMutexes // the (sorted) table locks - acquiredAt time.Time // the time at which the transaction acquired the locks - tableNames string // plus-separated list of table names - packageName string // name of the package that created the transaction -} - -type tableIndex struct { - table TableName - index IndexName -} - -type indexTxn struct { - *iradix.Txn[object] - entry indexEntry -} - -func (i indexTxn) Clone() indexTxn { - return indexTxn{i.Txn.Clone(), i.entry} -} - -var zeroTxn = txn{} - -// txn fulfills the ReadTxn/WriteTxn interface. -func (txn *txn) getTxn() *txn { - return txn -} - -func (txn *txn) GetRevision(name TableName) Revision { - if table, ok := txn.modifiedTables[name]; ok { - // This is a write transaction preparing to modify the table with a - // new revision. - return table.revision - } - - // This is either a read transaction, or a write transaction to tables - // other than this table. Look up the revision from the index. - table, ok := txn.rootReadTxn.Get([]byte(name)) - if !ok { - panic("BUG: Table " + name + " not found") - } - return table.revision -} - -// indexReadTxn returns a transaction to read from the specific index. -// If the table or index is not found this returns nil & error. -func (txn *txn) indexReadTxn(name TableName, index IndexName) (indexTxn, error) { - if txn.writeTxns != nil { - if _, ok := txn.modifiedTables[name]; ok { - itxn, err := txn.indexWriteTxn(name, index) - if err == nil { - return itxn.Clone(), nil - } - return indexTxn{}, err - } - } - - table, ok := txn.rootReadTxn.Get([]byte(name)) - if !ok { - return indexTxn{}, fmt.Errorf("table %q not found", name) - } - indexEntry, ok := table.indexes.Get([]byte(index)) - if !ok { - return indexTxn{}, fmt.Errorf("index %q not found from table %q", index, name) - } - - return indexTxn{ - indexEntry.tree.Txn(), - indexEntry}, nil -} - -// indexWriteTxn returns a transaction to read/write to a specific index. -// The created transaction is memoized and used for subsequent reads and/or writes. -func (txn *txn) indexWriteTxn(name TableName, index IndexName) (indexTxn, error) { - if indexTreeTxn, ok := txn.writeTxns[tableIndex{name, index}]; ok { - return indexTreeTxn, nil - } - table, ok := txn.modifiedTables[name] - if !ok { - return indexTxn{}, fmt.Errorf("table %q not found", name) - } - indexEntry, ok := table.indexes.Get([]byte(index)) - if !ok { - return indexTxn{}, fmt.Errorf("index %q not found from table %q", index, name) - } - itxn := indexEntry.tree.Txn() - itxn.TrackMutate(true) - indexWriteTxn := indexTxn{itxn, indexEntry} - txn.writeTxns[tableIndex{name, index}] = indexWriteTxn - return indexWriteTxn, nil -} - -// mustIndexReadTxn returns a transaction to read from the specific index. -// Panics if table or index are not found. -func (txn *txn) mustIndexReadTxn(name TableName, index IndexName) indexTxn { - indexTxn, err := txn.indexReadTxn(name, index) - if err != nil { - panic(err) - } - return indexTxn -} - -// mustIndexReadTxn returns a transaction to read or write from the specific index. -// Panics if table or index not found. -func (txn *txn) mustIndexWriteTxn(name TableName, index IndexName) indexTxn { - indexTxn, err := txn.indexWriteTxn(name, index) - if err != nil { - panic(err) - } - return indexTxn -} - -func (txn *txn) Insert(meta TableMeta, guardRevision Revision, data any) (any, bool, error) { - if txn.rootReadTxn == nil { - return nil, false, ErrTransactionClosed - } - - // Look up table and allocate a new revision. - tableName := meta.Name() - table, ok := txn.modifiedTables[tableName] - if !ok { - return nil, false, tableError(tableName, ErrTableNotLockedForWriting) - } - oldRevision := table.revision - table.revision++ - revision := table.revision - - obj := object{ - revision: revision, - data: data, - } - - // Update the primary index first - idKey := meta.primary().fromObject(obj).First() - idIndexTxn := txn.mustIndexWriteTxn(tableName, meta.primary().name) - oldObj, oldExists := idIndexTxn.Insert(idKey, obj) - - // For CompareAndSwap() validate against the given guard revision - if guardRevision > 0 { - if !oldExists { - // CompareAndSwap requires the object to exist. Revert - // the insert. - idIndexTxn.Delete(idKey) - table.revision = oldRevision - return nil, false, ErrObjectNotFound - } - if oldObj.revision != guardRevision { - // Revert the change. We're assuming here that it's rarer for CompareAndSwap() to - // fail and thus we're optimizing to have only one lookup in the common case - // (versus doing a Get() and then Insert()). - idIndexTxn.Insert(idKey, oldObj) - table.revision = oldRevision - return oldObj, true, ErrRevisionNotEqual - } - } - - // Update revision index - revIndexTxn := txn.mustIndexWriteTxn(tableName, RevisionIndex) - if oldExists { - _, ok := revIndexTxn.Delete([]byte(index.Uint64(oldObj.revision))) - if !ok { - panic("BUG: Old revision index entry not found") - } - - } - revIndexTxn.Insert([]byte(index.Uint64(revision)), obj) - - // If it's new, possibly remove an older deleted object with the same - // primary key from the graveyard. - if !oldExists && txn.hasDeleteTrackers(tableName) { - if old, existed := txn.mustIndexWriteTxn(tableName, GraveyardIndex).Delete(idKey); existed { - txn.mustIndexWriteTxn(tableName, GraveyardRevisionIndex).Delete([]byte(index.Uint64(old.revision))) - } - } - - // Then update secondary indexes - for idx, indexer := range meta.secondary() { - indexTxn := txn.mustIndexWriteTxn(tableName, idx) - newKeys := indexer.fromObject(obj) - - if oldExists { - // If the object already existed it might've invalidated the - // non-primary indexes. Compute the old key for this index and - // if the new key is different delete the old entry. - indexer.fromObject(oldObj).Foreach(func(oldKey index.Key) { - if !indexer.unique { - oldKey = encodeNonUniqueKey(idKey, oldKey) - } - if !newKeys.Exists(oldKey) { - indexTxn.Delete(oldKey) - } - }) - } - newKeys.Foreach(func(newKey index.Key) { - // Non-unique secondary indexes are formed by concatenating them - // with the primary key. - if !indexer.unique { - newKey = encodeNonUniqueKey(idKey, newKey) - } - indexTxn.Insert(newKey, obj) - }) - } - - return oldObj.data, oldExists, nil -} - -func (txn *txn) hasDeleteTrackers(name TableName) bool { - // Table is being modified, return the entry we're mutating, - // so we can read the latest changes. - table, ok := txn.modifiedTables[name] - if !ok { - // Table is not being modified, look it up from the root. - if t, ok := txn.rootReadTxn.Get([]byte(name)); ok { - table = &t - } else { - panic(fmt.Sprintf("BUG: table %q not found", name)) - } - } - return table.deleteTrackers.Len() > 0 -} - -func (txn *txn) addDeleteTracker(meta TableMeta, trackerName string, dt deleteTracker) error { - if txn.rootReadTxn == nil { - return ErrTransactionClosed - } - table, ok := txn.modifiedTables[meta.Name()] - if !ok { - return tableError(meta.Name(), ErrTableNotLockedForWriting) - } - table.deleteTrackers, _, _ = table.deleteTrackers.Insert([]byte(trackerName), dt) - txn.db.metrics.TableDeleteTrackerCount.With(prometheus.Labels{ - "table": meta.Name(), - }).Inc() - return nil - -} - -func (txn *txn) Delete(meta TableMeta, guardRevision Revision, data any) (any, bool, error) { - if txn.rootReadTxn == nil { - return nil, false, ErrTransactionClosed - } - - // Look up table and allocate a new revision. - tableName := meta.Name() - table, ok := txn.modifiedTables[tableName] - if !ok { - return nil, false, tableError(tableName, ErrTableNotLockedForWriting) - } - oldRevision := table.revision - table.revision++ - revision := table.revision - - // Delete from the primary index first to grab the object. - // We assume that "data" has only enough defined fields to - // compute the primary key. - idKey := meta.primary().fromObject(object{data: data}).First() - idIndexTree := txn.mustIndexWriteTxn(tableName, meta.primary().name) - obj, existed := idIndexTree.Delete(idKey) - if !existed { - return nil, false, nil - } - - // For CompareAndDelete() validate against guard revision and if there's a mismatch, - // revert the change. - if guardRevision > 0 { - if obj.revision != guardRevision { - idIndexTree.Insert(idKey, obj) - table.revision = oldRevision - return obj, true, ErrRevisionNotEqual - } - } - - // Update revision index. - indexTree := txn.mustIndexWriteTxn(tableName, RevisionIndex) - if _, ok := indexTree.Delete(index.Uint64(obj.revision)); !ok { - panic("BUG: Object to be deleted not found from revision index") - } - - // Then update secondary indexes. - for idx, indexer := range meta.secondary() { - indexer.fromObject(obj).Foreach(func(key index.Key) { - if !indexer.unique { - key = encodeNonUniqueKey(idKey, key) - } - txn.mustIndexWriteTxn(tableName, idx).Delete(key) - }) - } - - // And finally insert the object into the graveyard. - if txn.hasDeleteTrackers(tableName) { - graveyardIndex := txn.mustIndexWriteTxn(tableName, GraveyardIndex) - obj.revision = revision - if _, existed := graveyardIndex.Insert(idKey, obj); existed { - panic("BUG: Double deletion! Deleted object already existed in graveyard") - } - txn.mustIndexWriteTxn(tableName, GraveyardRevisionIndex).Insert(index.Uint64(revision), obj) - } - - return obj.data, true, nil -} - -// encodeNonUniqueKey constructs the internal key to use with non-unique indexes. -// It concatenates the secondary key with the primary key and the length of the secondary key. -// The length is stored as unsigned 16-bit big endian. -// This allows looking up from the non-unique index with the secondary key by doing a prefix -// search. The length is used to safe-guard against indexers that don't terminate the key -// properly (e.g. if secondary key is "foo", then we don't want "foobar" to match). -func encodeNonUniqueKey(primary, secondary index.Key) []byte { - key := make([]byte, 0, len(secondary)+len(primary)+2) - key = append(key, secondary...) - key = append(key, primary...) - // KeySet limits size of key to 16 bits. - return binary.BigEndian.AppendUint16(key, uint16(len(secondary))) -} - -func decodeNonUniqueKey(key []byte) (primary []byte, secondary []byte) { - // Multi-index key is [, , ] - if len(key) < 2 { - return nil, nil - } - secondaryLength := int(binary.BigEndian.Uint16(key[len(key)-2:])) - if len(key) < secondaryLength { - return nil, nil - } - return key[secondaryLength : len(key)-2], key[:secondaryLength] -} - -func (txn *txn) Abort() { - // If writeTxns is nil, this transaction has already been committed or aborted, and - // thus there is nothing to do. We allow this without failure to allow for defer - // pattern: - // - // txn := db.WriteTxn(...) - // defer txn.Abort() - // - // ... - // if err != nil { - // // Transaction now aborted. - // return err - // } - // - // txn.Commit() - // - if txn.writeTxns == nil { - return - } - - txn.smus.Unlock() - txn.db.metrics.WriteTxnDuration.With(prometheus.Labels{ - "tables": txn.tableNames, - "package": txn.packageName, - }).Observe(time.Since(txn.acquiredAt).Seconds()) - *txn = zeroTxn -} - -func (txn *txn) Commit() { - // We operate here under the following properties: - // - // - Each table that we're modifying has its SortableMutex locked and held by - // the caller (via WriteTxn()). Concurrent updates to other tables are - // allowed (but not to the root pointer), and thus there may be multiple parallel - // Commit()'s in progress, but each of those will only process work for tables - // they have locked, until root is to be updated. - // - // - Modifications to the root pointer (db.root) are made with the db.mu acquired, - // and thus changes to it are always performed sequentially. The root pointer is - // updated atomically, and thus readers see either an old root or a new root. - // Both the old root and new root are immutable after they're made available via - // the root pointer. - // - // - As the root is atomically swapped to a new immutable tree of tables of indexes, - // a reader can acquire an immutable snapshot of all data in the database with a - // simpler atomic pointer load. - - // If writeTxns is nil, this transaction has already been committed or aborted, and - // thus there is nothing to do. - if txn.writeTxns == nil { - return - } - - db := txn.db - - // Commit each individual changed index to each table. - // We don't notify yet (CommitOnly) as the root needs to be updated - // first as otherwise readers would wake up too early. - for tableIndex, subTxn := range txn.writeTxns { - table, ok := txn.modifiedTables[tableIndex.table] - if !ok { - panic("BUG: Table " + tableIndex.table + " in writeTxns, but not in modifiedTables") - } - subTxn.entry.tree = subTxn.CommitOnly() - table.indexes, _, _ = - table.indexes.Insert([]byte(tableIndex.index), subTxn.entry) - - // Update metrics - db.metrics.TableGraveyardObjectCount.With( - prometheus.Labels{"table": tableIndex.table}, - ).Set(float64(table.numDeletedObjects())) - db.metrics.TableObjectCount.With( - prometheus.Labels{"table": tableIndex.table}, - ).Set(float64(table.numObjects())) - db.metrics.TableRevision.With( - prometheus.Labels{"table": tableIndex.table}, - ).Set(float64(table.revision)) - } - - // Acquire the lock on the root tree to sequence the updates to it. We can acquire - // it after we've built up the new table entries above, since changes to those were - // protected by each table lock (that we're holding here). - db.mu.Lock() - - // Since the root may have changed since the pointer was last read in WriteTxn(), - // load it again and modify the latest version that we now have immobilised by - // the root lock. - rootTxn := db.root.Load().Txn() - - // Insert the modified tables into the root tree of tables. - for name, table := range txn.modifiedTables { - rootTxn.Insert([]byte(name), *table) - } - - // Commit the transaction to build the new root tree and then - // atomically store it. - newRoot := rootTxn.CommitOnly() - db.root.Store(newRoot) - db.mu.Unlock() - - // With the root pointer updated, we can now release the tables for the next write transaction. - txn.smus.Unlock() - - // Now that new root is committed, we can notify readers by closing the watch channels of - // mutated radix tree nodes in all changed indexes and on the root itself. - for _, subTxn := range txn.writeTxns { - subTxn.Notify() - } - rootTxn.Notify() - - // Zero out the transaction to make it inert. - *txn = zeroTxn -} - -// WriteJSON marshals out the whole database as JSON into the given writer. -func (txn *txn) WriteJSON(w io.Writer) error { - buf := bufio.NewWriter(w) - buf.WriteString("{\n") - first := true - for _, table := range txn.db.tables { - if !first { - buf.WriteString(",\n") - } else { - first = false - } - - indexTxn := txn.getTxn().mustIndexReadTxn(table.Name(), table.primary().name) - root := indexTxn.Root() - iter := root.Iterator() - - buf.WriteString(" \"" + table.Name() + "\": [\n") - - _, obj, ok := iter.Next() - for ok { - buf.WriteString(" ") - bs, err := json.Marshal(obj.data) - if err != nil { - return err - } - buf.Write(bs) - _, obj, ok = iter.Next() - if ok { - buf.WriteString(",\n") - } else { - buf.WriteByte('\n') - } - } - buf.WriteString(" ]") - } - buf.WriteString("\n}\n") - return buf.Flush() -} diff --git a/vendor/github.com/cilium/cilium/pkg/statedb/types.go b/vendor/github.com/cilium/cilium/pkg/statedb/types.go deleted file mode 100644 index 5b9ec9462..000000000 --- a/vendor/github.com/cilium/cilium/pkg/statedb/types.go +++ /dev/null @@ -1,339 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package statedb - -import ( - "io" - - iradix "github.com/hashicorp/go-immutable-radix/v2" - - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/statedb/index" -) - -type ( - TableName = string - IndexName = string - Revision = uint64 -) - -// Table provides methods for querying the contents of a table. -type Table[Obj any] interface { - // TableMeta for querying table metadata that is independent of - // 'Obj' type. - TableMeta - - // PrimaryIndexer returns the primary indexer for the table. - // Useful for generic utilities that need access to the primary key. - PrimaryIndexer() Indexer[Obj] - - // NumObjects returns the number of objects stored in the table. - NumObjects(ReadTxn) int - - // Revision of the table. Constant for a read transaction, but - // increments in a write transaction on each Insert and Delete. - Revision(ReadTxn) Revision - - // All returns an iterator for all objects in the table and a watch - // channel that is closed when the table changes. - All(ReadTxn) (Iterator[Obj], <-chan struct{}) - - // Get returns an iterator for all objects matching the given query - // and a watch channel that is closed if the query results are - // invalidated by a write to the table. - Get(ReadTxn, Query[Obj]) (Iterator[Obj], <-chan struct{}) - - // First returns the first matching object for the query. - First(ReadTxn, Query[Obj]) (obj Obj, rev Revision, found bool) - - // FirstWatch return the first matching object and a watch channel - // that is closed if the query is invalidated. - FirstWatch(ReadTxn, Query[Obj]) (obj Obj, rev Revision, watch <-chan struct{}, found bool) - - // Last returns the last matching object. - Last(ReadTxn, Query[Obj]) (obj Obj, rev Revision, found bool) - - // LastWatch returns the last matching object and a watch channel - // that is closed if the query is invalidated. - LastWatch(ReadTxn, Query[Obj]) (obj Obj, rev Revision, watch <-chan struct{}, found bool) - - // LowerBound returns an iterator for objects that have a key - // greater or equal to the query. The returned watch channel is closed - // when anything in the table changes as more fine-grained notifications - // are not possible with a lower bound search. - LowerBound(ReadTxn, Query[Obj]) (iter Iterator[Obj], watch <-chan struct{}) - - // DeleteTracker creates a new delete tracker for the table. - // - // It starts tracking deletions performed against the table from the - // current revision. A WriteTxn against the target table is required to - // add the tracker to the table. - DeleteTracker(txn WriteTxn, trackerName string) (*DeleteTracker[Obj], error) -} - -// RWTable provides methods for modifying the table under a write transaction -// that targets this table. -type RWTable[Obj any] interface { - // RWTable[Obj] is a superset of Table[Obj]. Queries made with a - // write transaction return the fresh uncommitted modifications if any. - Table[Obj] - - // ToTable returns the Table[Obj] interface. Useful with cell.Provide - // to avoid the anonymous function: - // - // cell.ProvidePrivate(NewMyTable), // RWTable - // cell.Invoke(statedb.Register[statedb.RWTable[Foo]) - // - // // with anononymous function: - // cell.Provide(func(t statedb.RWTable[Foo]) statedb.Table[Foo] { return t }) - // - // // with ToTable: - // cell.Provide(statedb.RWTable[Foo].ToTable), - ToTable() Table[Obj] - - // Insert an object into the table. Returns the object that was - // replaced if there was one. - // - // Possible errors: - // - ErrTableNotLockedForWriting: table was not locked for writing - // - ErrTransactionClosed: the write transaction already committed or aborted - // - // Each inserted or updated object will be assigned a new unique - // revision. - Insert(WriteTxn, Obj) (oldObj Obj, hadOld bool, err error) - - // CompareAndSwap compares the existing object's revision against the - // given revision and if equal it replaces the object. - // - // Possible errors: - // - ErrRevisionNotEqual: the object has mismatching revision - // - ErrObjectNotFound: object not found from the table - // - ErrTableNotLockedForWriting: table was not locked for writing - // - ErrTransactionClosed: the write transaction already committed or aborted - CompareAndSwap(WriteTxn, Revision, Obj) (oldObj Obj, hadOld bool, err error) - - // Delete an object from the table. Returns the object that was - // deleted if there was one. - // - // If the table is being tracked for deletions via DeleteTracker() - // the deleted object is inserted into a graveyard index and garbage - // collected when all delete trackers have consumed it. Each deleted - // object in the graveyard has unique revision allowing interleaved - // iteration of updates and deletions (see (*DeleteTracker[Obj]).Process). - // - // Possible errors: - // - ErrTableNotLockedForWriting: table was not locked for writing - // - ErrTransactionClosed: the write transaction already committed or aborted - Delete(WriteTxn, Obj) (oldObj Obj, hadOld bool, err error) - - // DeleteAll removes all objects in the table. Semantically the same as - // All() + Delete(). See Delete() for more information. - // - // Possible errors: - // - ErrTableNotLockedForWriting: table was not locked for writing - // - ErrTransactionClosed: the write transaction already committed or aborted - DeleteAll(WriteTxn) error - - // CompareAndDelete compares the existing object's revision against the - // given revision and if equal it deletes the object. If object is not - // found 'hadOld' will be false and 'err' nil. - // - // Possible errors: - // - ErrRevisionNotEqual: the object has mismatching revision - // - ErrTableNotLockedForWriting: table was not locked for writing - // - ErrTransactionClosed: the write transaction already committed or aborted - CompareAndDelete(WriteTxn, Revision, Obj) (oldObj Obj, hadOld bool, err error) -} - -// TableMeta provides information about the table that is independent of -// the object type (the 'Obj' constraint). -type TableMeta interface { - Name() TableName // The name of the table - tableKey() []byte // The radix key for the table in the root tree - primary() anyIndexer // The untyped primary indexer for the table - secondary() map[string]anyIndexer // Secondary indexers (if any) - sortableMutex() lock.SortableMutex // The sortable mutex for locking the table for writing -} - -// Iterator for iterating objects returned from queries. -type Iterator[Obj any] interface { - // Next returns the next object and its revision if ok is true, otherwise - // zero values to mean that the iteration has finished. - Next() (obj Obj, rev Revision, ok bool) -} - -type ReadTxn interface { - getTxn() *txn - - // WriteJSON writes the contents of the database as JSON. - WriteJSON(io.Writer) error -} - -type WriteTxn interface { - // WriteTxn is always also a ReadTxn - ReadTxn - - // Abort the current transaction. All changes are disgarded. - // It is safe to call Abort() after calling Commit(), e.g. - // the following pattern is strongly encouraged to make sure - // write transactions are always completed: - // - // txn := db.WriteTxn(...) - // defer txn.Abort() - // ... - // txn.Commit() - Abort() - - // Commit the changes in the current transaction to the target tables. - // This is a no-op if Abort() or Commit() has already been called. - Commit() -} - -type Query[Obj any] struct { - index IndexName - key index.Key -} - -// ByRevision constructs a revision query. Applicable to any table. -func ByRevision[Obj any](rev uint64) Query[Obj] { - return Query[Obj]{ - index: RevisionIndex, - key: index.Uint64(rev), - } -} - -// Index implements the indexing of objects (FromObjects) and querying of objects from the index (FromKey) -type Index[Obj any, Key any] struct { - Name string - FromObject func(obj Obj) index.KeySet - FromKey func(key Key) index.Key - Unique bool -} - -var _ Indexer[struct{}] = &Index[struct{}, bool]{} - -// The nolint:unused below are needed due to linter not seeing -// the use-sites due to generics. - -//nolint:unused -func (i Index[Key, Obj]) indexName() string { - return i.Name -} - -//nolint:unused -func (i Index[Obj, Key]) fromObject(obj Obj) index.KeySet { - return i.FromObject(obj) -} - -//nolint:unused -func (i Index[Obj, Key]) isUnique() bool { - return i.Unique -} - -// Query constructs a query against this index from a key. -func (i Index[Obj, Key]) Query(key Key) Query[Obj] { - return Query[Obj]{ - index: i.Name, - key: i.FromKey(key), - } -} - -func (i Index[Obj, Key]) QueryFromObject(obj Obj) Query[Obj] { - return Query[Obj]{ - index: i.Name, - key: i.FromObject(obj).First(), - } -} - -func (i Index[Obj, Key]) ObjectToKey(obj Obj) index.Key { - return i.FromObject(obj).First() -} - -// Indexer is the "FromObject" subset of Index[Obj, Key] -// without the 'Key' constraint. -type Indexer[Obj any] interface { - indexName() string - isUnique() bool - fromObject(Obj) index.KeySet - - ObjectToKey(Obj) index.Key - QueryFromObject(Obj) Query[Obj] -} - -// TableWritable is a constraint for objects that implement tabular -// pretty-printing. Used in "cilium-dbg statedb" sub-commands. -type TableWritable interface { - // TableHeader returns the header columns that are independent of the - // object. - TableHeader() []string - - // TableRow returns the row columns for this object. - TableRow() []string -} - -// -// Internal types and constants. -// - -const ( - reservedIndexPrefix = "__" - RevisionIndex = "__revision__" - GraveyardIndex = "__graveyard__" - GraveyardRevisionIndex = "__graveyard_revision__" -) - -// object is the format in which data is stored in the tables. -type object struct { - revision uint64 - data any -} - -// anyIndexer is an untyped indexer. The user-defined 'Index[Obj,Key]' -// is converted to this form. -type anyIndexer struct { - // name is the indexer name. - name string - - // fromObject returns the key (or keys for multi-index) to index the - // object with. - fromObject func(object) index.KeySet - - // unique if true will index the object solely on the - // values returned by fromObject. If false the primary - // key of the object will be appended to the key. - unique bool -} - -type deleteTracker interface { - setRevision(uint64) - getRevision() uint64 -} - -type indexEntry struct { - tree *iradix.Tree[object] - unique bool -} - -type tableEntry struct { - meta TableMeta - indexes *iradix.Tree[indexEntry] - deleteTrackers *iradix.Tree[deleteTracker] - revision uint64 -} - -func (t *tableEntry) numObjects() int { - indexEntry, ok := t.indexes.Get([]byte(RevisionIndex)) - if ok { - return indexEntry.tree.Len() - } - return 0 -} - -func (t *tableEntry) numDeletedObjects() int { - indexEntry, ok := t.indexes.Get([]byte(GraveyardIndex)) - if ok { - return indexEntry.tree.Len() - } - return 0 -} diff --git a/vendor/github.com/cilium/cilium/pkg/trigger/doc.go b/vendor/github.com/cilium/cilium/pkg/trigger/doc.go deleted file mode 100644 index 7ca449cd3..000000000 --- a/vendor/github.com/cilium/cilium/pkg/trigger/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Package trigger provides a mechanism to trigger actions that require to be -// serialized while providing a non-blocking notification mechanism -package trigger diff --git a/vendor/github.com/cilium/cilium/pkg/trigger/trigger.go b/vendor/github.com/cilium/cilium/pkg/trigger/trigger.go deleted file mode 100644 index 7afae2587..000000000 --- a/vendor/github.com/cilium/cilium/pkg/trigger/trigger.go +++ /dev/null @@ -1,221 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package trigger - -import ( - "fmt" - - "github.com/cilium/cilium/pkg/inctimer" - "github.com/cilium/cilium/pkg/lock" - "github.com/cilium/cilium/pkg/time" -) - -// MetricsObserver is the interface a metrics collector has to implement in -// order to collect trigger metrics -type MetricsObserver interface { - // PostRun is called after a trigger run with the call duration, the - // latency between 1st queue request and the call run and the number of - // queued events folded into the last run - PostRun(callDuration, latency time.Duration, folds int) - - // QueueEvent is called when Trigger() is called to schedule a trigger - // run - QueueEvent(reason string) -} - -// Parameters are the user specified parameters -type Parameters struct { - // MinInterval is the minimum required interval between invocations of - // TriggerFunc - MinInterval time.Duration - - // TriggerFunc is the function to be called when Trigger() is called - // while respecting MinInterval and serialization - TriggerFunc func(reasons []string) - - // ShutdownFunc is called when the trigger is shut down - ShutdownFunc func() - - MetricsObserver MetricsObserver - - // Name is the unique name of the trigger. It must be provided in a - // format compatible to be used as prometheus name string. - Name string - - // sleepInterval controls the waiter sleep duration. This parameter is - // only exposed to tests - sleepInterval time.Duration -} - -type reasonStack map[string]struct{} - -func newReasonStack() reasonStack { - return map[string]struct{}{} -} - -func (r reasonStack) add(reason string) { - r[reason] = struct{}{} -} - -func (r reasonStack) slice() []string { - result := make([]string, len(r)) - i := 0 - for reason := range r { - result[i] = reason - i++ - } - return result -} - -// Trigger represents an active trigger logic. Use NewTrigger() to create a -// trigger -type Trigger struct { - // protect mutual access of 'trigger' between Trigger() and waiter() - mutex lock.Mutex - trigger bool - - // params are the user specified parameters - params Parameters - - // lastTrigger is the timestamp of the last invoked trigger - lastTrigger time.Time - - // wakeupCan is used to wake up the background trigger routine - wakeupChan chan struct{} - - // closeChan is used to stop the background trigger routine - closeChan chan struct{} - - // numFolds is the current count of folds that happened into the - // currently scheduled trigger - numFolds int - - // foldedReasons is the sum of all unique reasons folded together. - foldedReasons reasonStack - - waitStart time.Time -} - -// NewTrigger returns a new trigger based on the provided parameters -func NewTrigger(p Parameters) (*Trigger, error) { - if p.sleepInterval == 0 { - p.sleepInterval = time.Second - } - - if p.TriggerFunc == nil { - return nil, fmt.Errorf("trigger function is nil") - } - - t := &Trigger{ - params: p, - wakeupChan: make(chan struct{}, 1), - closeChan: make(chan struct{}, 1), - foldedReasons: newReasonStack(), - } - - // Guarantee that initial trigger has no delay - if p.MinInterval > time.Duration(0) { - t.lastTrigger = time.Now().Add(-1 * p.MinInterval) - } - - go t.waiter() - - return t, nil -} - -// needsDelay returns whether and how long of a delay is required to fullfil -// MinInterval -func (t *Trigger) needsDelay() (bool, time.Duration) { - if t.params.MinInterval == time.Duration(0) { - return false, 0 - } - - sleepTime := time.Since(t.lastTrigger.Add(t.params.MinInterval)) - return sleepTime < 0, sleepTime * -1 -} - -// Trigger triggers the call to TriggerFunc as specified in the parameters -// provided to NewTrigger(). It respects MinInterval and ensures that calls to -// TriggerFunc are serialized. This function is non-blocking and will return -// immediately before TriggerFunc is potentially triggered and has completed. -func (t *Trigger) TriggerWithReason(reason string) { - t.mutex.Lock() - t.trigger = true - if t.numFolds == 0 { - t.waitStart = time.Now() - } - t.numFolds++ - t.foldedReasons.add(reason) - t.mutex.Unlock() - - if t.params.MetricsObserver != nil { - t.params.MetricsObserver.QueueEvent(reason) - } - - select { - case t.wakeupChan <- struct{}{}: - default: - } -} - -// Trigger triggers the call to TriggerFunc as specified in the parameters -// provided to NewTrigger(). It respects MinInterval and ensures that calls to -// TriggerFunc are serialized. This function is non-blocking and will return -// immediately before TriggerFunc is potentially triggered and has completed. -func (t *Trigger) Trigger() { - t.TriggerWithReason("") -} - -// Shutdown stops the trigger mechanism -func (t *Trigger) Shutdown() { - close(t.closeChan) -} - -func (t *Trigger) waiter() { - sleepTimer, sleepTimerDone := inctimer.New() - defer sleepTimerDone() - for { - // keep critical section as small as possible - t.mutex.Lock() - triggerEnabled := t.trigger - t.trigger = false - t.mutex.Unlock() - - // run the trigger function - if triggerEnabled { - if delayNeeded, delay := t.needsDelay(); delayNeeded { - time.Sleep(delay) - } - - t.mutex.Lock() - t.lastTrigger = time.Now() - numFolds := t.numFolds - t.numFolds = 0 - reasons := t.foldedReasons.slice() - t.foldedReasons = newReasonStack() - callLatency := time.Since(t.waitStart) - t.mutex.Unlock() - - beforeTrigger := time.Now() - t.params.TriggerFunc(reasons) - - if t.params.MetricsObserver != nil { - callDuration := time.Since(beforeTrigger) - t.params.MetricsObserver.PostRun(callDuration, callLatency, numFolds) - } - } - - select { - case <-t.wakeupChan: - case <-sleepTimer.After(t.params.sleepInterval): - - case <-t.closeChan: - shutdownFunc := t.params.ShutdownFunc - if shutdownFunc != nil { - shutdownFunc() - } - return - } - } -} diff --git a/vendor/github.com/cilium/cilium/pkg/u8proto/u8proto.go b/vendor/github.com/cilium/cilium/pkg/u8proto/u8proto.go deleted file mode 100644 index 2df035a04..000000000 --- a/vendor/github.com/cilium/cilium/pkg/u8proto/u8proto.go +++ /dev/null @@ -1,58 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package u8proto - -import ( - "fmt" - "strconv" - "strings" -) - -// These definitions must contain and be compatible with the string -// values defined for pkg/pollicy/api/L4Proto - -const ( - // ANY represents all protocols. - ANY U8proto = 0 - ICMP U8proto = 1 - TCP U8proto = 6 - UDP U8proto = 17 - ICMPv6 U8proto = 58 - SCTP U8proto = 132 -) - -var protoNames = map[U8proto]string{ - 0: "ANY", - 1: "ICMP", - 6: "TCP", - 17: "UDP", - 58: "ICMPv6", - 132: "SCTP", -} - -var ProtoIDs = map[string]U8proto{ - "all": 0, - "any": 0, - "icmp": 1, - "tcp": 6, - "udp": 17, - "icmpv6": 58, - "sctp": 132, -} - -type U8proto uint8 - -func (p U8proto) String() string { - if _, ok := protoNames[p]; ok { - return protoNames[p] - } - return strconv.Itoa(int(p)) -} - -func ParseProtocol(proto string) (U8proto, error) { - if u, ok := ProtoIDs[strings.ToLower(proto)]; ok { - return u, nil - } - return 0, fmt.Errorf("unknown protocol '%s'", proto) -} diff --git a/vendor/github.com/cilium/cilium/pkg/wireguard/types/types.go b/vendor/github.com/cilium/cilium/pkg/wireguard/types/types.go deleted file mode 100644 index a6fb64615..000000000 --- a/vendor/github.com/cilium/cilium/pkg/wireguard/types/types.go +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Common WireGuard types and constants -package types - -const ( - // IfaceName is the name of the WireGuard tunnel device - IfaceName = "cilium_wg0" - // PrivKeyFilename is the name of the WireGuard private key file - PrivKeyFilename = "cilium_wg0.key" - // StaticEncryptKey is used in the IPCache to mark entries for which we - // want to enable WireGuard encryption - StaticEncryptKey = uint8(0xFF) -) diff --git a/vendor/github.com/cilium/ebpf/.clang-format b/vendor/github.com/cilium/ebpf/.clang-format deleted file mode 100644 index 0ff425760..000000000 --- a/vendor/github.com/cilium/ebpf/.clang-format +++ /dev/null @@ -1,25 +0,0 @@ ---- -Language: Cpp -BasedOnStyle: LLVM -AlignAfterOpenBracket: DontAlign -AlignConsecutiveAssignments: true -AlignEscapedNewlines: DontAlign -# mkdocs annotations in source code are written as trailing comments -# and alignment pushes these really far away from the content. -AlignTrailingComments: false -AlwaysBreakBeforeMultilineStrings: true -AlwaysBreakTemplateDeclarations: false -AllowAllParametersOfDeclarationOnNextLine: false -AllowShortFunctionsOnASingleLine: false -BreakBeforeBraces: Attach -IndentWidth: 4 -KeepEmptyLinesAtTheStartOfBlocks: false -TabWidth: 4 -UseTab: ForContinuationAndIndentation -ColumnLimit: 1000 -# Go compiler comments need to stay unindented. -CommentPragmas: '^go:.*' -# linux/bpf.h needs to be included before bpf/bpf_helpers.h for types like __u64 -# and sorting makes this impossible. -SortIncludes: false -... diff --git a/vendor/github.com/cilium/ebpf/.gitattributes b/vendor/github.com/cilium/ebpf/.gitattributes deleted file mode 100644 index 113f97b98..000000000 --- a/vendor/github.com/cilium/ebpf/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -internal/sys/types.go linguist-generated=false diff --git a/vendor/github.com/cilium/ebpf/.gitignore b/vendor/github.com/cilium/ebpf/.gitignore deleted file mode 100644 index b46162b8e..000000000 --- a/vendor/github.com/cilium/ebpf/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib -*.o -!*_bpf*.o - -# Test binary, build with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out diff --git a/vendor/github.com/cilium/ebpf/.golangci.yaml b/vendor/github.com/cilium/ebpf/.golangci.yaml deleted file mode 100644 index 65f91b910..000000000 --- a/vendor/github.com/cilium/ebpf/.golangci.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -linters: - disable-all: true - enable: - - goimports - - gosimple - - govet - - ineffassign - - misspell - - staticcheck - - typecheck - - unused - - gofmt diff --git a/vendor/github.com/cilium/ebpf/CODEOWNERS b/vendor/github.com/cilium/ebpf/CODEOWNERS deleted file mode 100644 index ad13437ea..000000000 --- a/vendor/github.com/cilium/ebpf/CODEOWNERS +++ /dev/null @@ -1,9 +0,0 @@ -* @cilium/ebpf-lib-maintainers - -features/ @rgo3 -link/ @mmat11 - -perf/ @florianl -ringbuf/ @florianl - -btf/ @dylandreimerink diff --git a/vendor/github.com/cilium/ebpf/CODE_OF_CONDUCT.md b/vendor/github.com/cilium/ebpf/CODE_OF_CONDUCT.md deleted file mode 100644 index 8e42838c5..000000000 --- a/vendor/github.com/cilium/ebpf/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,46 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at nathanjsweet at gmail dot com or i at lmb dot io. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] - -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/cilium/ebpf/CONTRIBUTING.md b/vendor/github.com/cilium/ebpf/CONTRIBUTING.md deleted file mode 100644 index 673a9ac29..000000000 --- a/vendor/github.com/cilium/ebpf/CONTRIBUTING.md +++ /dev/null @@ -1,5 +0,0 @@ -# Contributing to ebpf-go - -Want to contribute to ebpf-go? There are a few things you need to know. - -We wrote a [contribution guide](https://ebpf-go.dev/contributing/) to help you get started. diff --git a/vendor/github.com/cilium/ebpf/LICENSE b/vendor/github.com/cilium/ebpf/LICENSE deleted file mode 100644 index c637ae99c..000000000 --- a/vendor/github.com/cilium/ebpf/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -MIT License - -Copyright (c) 2017 Nathan Sweet -Copyright (c) 2018, 2019 Cloudflare -Copyright (c) 2019 Authors of Cilium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/cilium/ebpf/MAINTAINERS.md b/vendor/github.com/cilium/ebpf/MAINTAINERS.md deleted file mode 100644 index a56a03e39..000000000 --- a/vendor/github.com/cilium/ebpf/MAINTAINERS.md +++ /dev/null @@ -1,3 +0,0 @@ -# Maintainers - -Maintainers can be found in the [Cilium Maintainers file](https://github.com/cilium/community/blob/main/roles/Maintainers.md) diff --git a/vendor/github.com/cilium/ebpf/Makefile b/vendor/github.com/cilium/ebpf/Makefile deleted file mode 100644 index c55a93d9c..000000000 --- a/vendor/github.com/cilium/ebpf/Makefile +++ /dev/null @@ -1,112 +0,0 @@ -# The development version of clang is distributed as the 'clang' binary, -# while stable/released versions have a version number attached. -# Pin the default clang to a stable version. -CLANG ?= clang-17 -STRIP ?= llvm-strip-17 -OBJCOPY ?= llvm-objcopy-17 -CFLAGS := -O2 -g -Wall -Werror $(CFLAGS) - -CI_KERNEL_URL ?= https://github.com/cilium/ci-kernels/raw/master/ - -# Obtain an absolute path to the directory of the Makefile. -# Assume the Makefile is in the root of the repository. -REPODIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) -UIDGID := $(shell stat -c '%u:%g' ${REPODIR}) - -# Prefer podman if installed, otherwise use docker. -# Note: Setting the var at runtime will always override. -CONTAINER_ENGINE ?= $(if $(shell command -v podman), podman, docker) -CONTAINER_RUN_ARGS ?= $(if $(filter ${CONTAINER_ENGINE}, podman), --log-driver=none, --user "${UIDGID}") - -IMAGE := $(shell cat ${REPODIR}/testdata/docker/IMAGE) -VERSION := $(shell cat ${REPODIR}/testdata/docker/VERSION) - -TARGETS := \ - testdata/loader-clang-11 \ - testdata/loader-clang-14 \ - testdata/loader-$(CLANG) \ - testdata/manyprogs \ - testdata/btf_map_init \ - testdata/invalid_map \ - testdata/raw_tracepoint \ - testdata/invalid_map_static \ - testdata/invalid_btf_map_init \ - testdata/strings \ - testdata/freplace \ - testdata/fentry_fexit \ - testdata/iproute2_map_compat \ - testdata/map_spin_lock \ - testdata/subprog_reloc \ - testdata/fwd_decl \ - testdata/kconfig \ - testdata/kconfig_config \ - testdata/kfunc \ - testdata/invalid-kfunc \ - testdata/kfunc-kmod \ - testdata/constants \ - testdata/errors \ - btf/testdata/relocs \ - btf/testdata/relocs_read \ - btf/testdata/relocs_read_tgt \ - btf/testdata/relocs_enum \ - cmd/bpf2go/testdata/minimal - -.PHONY: all clean container-all container-shell generate - -.DEFAULT_TARGET = container-all - -# Build all ELF binaries using a containerized LLVM toolchain. -container-all: - +${CONTAINER_ENGINE} run --rm -t ${CONTAINER_RUN_ARGS} \ - -v "${REPODIR}":/ebpf -w /ebpf --env MAKEFLAGS \ - --env HOME="/tmp" \ - --env BPF2GO_CC="$(CLANG)" \ - --env BPF2GO_FLAGS="-fdebug-prefix-map=/ebpf=. $(CFLAGS)" \ - "${IMAGE}:${VERSION}" \ - make all - -# (debug) Drop the user into a shell inside the container as root. -# Set BPF2GO_ envs to make 'make generate' just work. -container-shell: - ${CONTAINER_ENGINE} run --rm -ti \ - -v "${REPODIR}":/ebpf -w /ebpf \ - --env BPF2GO_CC="$(CLANG)" \ - --env BPF2GO_FLAGS="-fdebug-prefix-map=/ebpf=. $(CFLAGS)" \ - "${IMAGE}:${VERSION}" - -clean: - find "$(CURDIR)" -name "*.elf" -delete - find "$(CURDIR)" -name "*.o" -delete - -format: - find . -type f -name "*.c" | xargs clang-format -i - -all: format $(addsuffix -el.elf,$(TARGETS)) $(addsuffix -eb.elf,$(TARGETS)) generate - ln -srf testdata/loader-$(CLANG)-el.elf testdata/loader-el.elf - ln -srf testdata/loader-$(CLANG)-eb.elf testdata/loader-eb.elf - -generate: - go generate -run "internal/cmd/gentypes" ./... - go generate -skip "internal/cmd/gentypes" ./... - -testdata/loader-%-el.elf: testdata/loader.c - $* $(CFLAGS) -target bpfel -c $< -o $@ - $(STRIP) -g $@ - -testdata/loader-%-eb.elf: testdata/loader.c - $* $(CFLAGS) -target bpfeb -c $< -o $@ - $(STRIP) -g $@ - -%-el.elf: %.c - $(CLANG) $(CFLAGS) -target bpfel -c $< -o $@ - $(STRIP) -g $@ - -%-eb.elf : %.c - $(CLANG) $(CFLAGS) -target bpfeb -c $< -o $@ - $(STRIP) -g $@ - -.PHONY: update-kernel-deps -update-kernel-deps: export KERNEL_VERSION?=6.7 -update-kernel-deps: - ./testdata/sh/update-kernel-deps.sh - $(MAKE) container-all diff --git a/vendor/github.com/cilium/ebpf/README.md b/vendor/github.com/cilium/ebpf/README.md deleted file mode 100644 index 85871db1a..000000000 --- a/vendor/github.com/cilium/ebpf/README.md +++ /dev/null @@ -1,72 +0,0 @@ -# eBPF - -[![PkgGoDev](https://pkg.go.dev/badge/github.com/cilium/ebpf)](https://pkg.go.dev/github.com/cilium/ebpf) - -![HoneyGopher](docs/ebpf/ebpf-go.png) - -ebpf-go is a pure Go library that provides utilities for loading, compiling, and -debugging eBPF programs. It has minimal external dependencies and is intended to -be used in long running processes. - -See [ebpf.io](https://ebpf.io) for complementary projects from the wider eBPF -ecosystem. - -## Getting Started - -Please take a look at our [Getting Started] guide. - -[Contributions](https://ebpf-go.dev/contributing) are highly encouraged, as they highlight certain use cases of -eBPF and the library, and help shape the future of the project. - -## Getting Help - -The community actively monitors our [GitHub Discussions](https://github.com/cilium/ebpf/discussions) page. -Please search for existing threads before starting a new one. Refrain from -opening issues on the bug tracker if you're just starting out or if you're not -sure if something is a bug in the library code. - -Alternatively, [join](https://ebpf.io/slack) the -[#ebpf-go](https://cilium.slack.com/messages/ebpf-go) channel on Slack if you -have other questions regarding the project. Note that this channel is ephemeral -and has its history erased past a certain point, which is less helpful for -others running into the same problem later. - -## Packages - -This library includes the following packages: - -* [asm](https://pkg.go.dev/github.com/cilium/ebpf/asm) contains a basic - assembler, allowing you to write eBPF assembly instructions directly - within your Go code. (You don't need to use this if you prefer to write your eBPF program in C.) -* [cmd/bpf2go](https://pkg.go.dev/github.com/cilium/ebpf/cmd/bpf2go) allows - compiling and embedding eBPF programs written in C within Go code. As well as - compiling the C code, it auto-generates Go code for loading and manipulating - the eBPF program and map objects. -* [link](https://pkg.go.dev/github.com/cilium/ebpf/link) allows attaching eBPF - to various hooks -* [perf](https://pkg.go.dev/github.com/cilium/ebpf/perf) allows reading from a - `PERF_EVENT_ARRAY` -* [ringbuf](https://pkg.go.dev/github.com/cilium/ebpf/ringbuf) allows reading from a - `BPF_MAP_TYPE_RINGBUF` map -* [features](https://pkg.go.dev/github.com/cilium/ebpf/features) implements the equivalent - of `bpftool feature probe` for discovering BPF-related kernel features using native Go. -* [rlimit](https://pkg.go.dev/github.com/cilium/ebpf/rlimit) provides a convenient API to lift - the `RLIMIT_MEMLOCK` constraint on kernels before 5.11. -* [btf](https://pkg.go.dev/github.com/cilium/ebpf/btf) allows reading the BPF Type Format. - -## Requirements - -* A version of Go that is [supported by - upstream](https://golang.org/doc/devel/release.html#policy) -* CI is run against kernel.org LTS releases. >= 4.4 should work but EOL'ed versions - are not supported. - -## License - -MIT - -### eBPF Gopher - -The eBPF honeygopher is based on the Go gopher designed by Renee French. - -[Getting Started]: https://ebpf-go.dev/guides/getting-started/ diff --git a/vendor/github.com/cilium/ebpf/asm/alu.go b/vendor/github.com/cilium/ebpf/asm/alu.go deleted file mode 100644 index 282233d32..000000000 --- a/vendor/github.com/cilium/ebpf/asm/alu.go +++ /dev/null @@ -1,180 +0,0 @@ -package asm - -//go:generate go run golang.org/x/tools/cmd/stringer@latest -output alu_string.go -type=Source,Endianness,ALUOp - -// Source of ALU / ALU64 / Branch operations -// -// msb lsb -// +------------+-+---+ -// | op |S|cls| -// +------------+-+---+ -type Source uint16 - -const sourceMask OpCode = 0x0008 - -// Source bitmask -const ( - // InvalidSource is returned by getters when invoked - // on non ALU / branch OpCodes. - InvalidSource Source = 0xffff - // ImmSource src is from constant - ImmSource Source = 0x0000 - // RegSource src is from register - RegSource Source = 0x0008 -) - -// The Endianness of a byte swap instruction. -type Endianness uint8 - -const endianMask = sourceMask - -// Endian flags -const ( - InvalidEndian Endianness = 0xff - // Convert to little endian - LE Endianness = 0x00 - // Convert to big endian - BE Endianness = 0x08 -) - -// ALUOp are ALU / ALU64 operations -// -// msb lsb -// +-------+----+-+---+ -// | EXT | OP |s|cls| -// +-------+----+-+---+ -type ALUOp uint16 - -const aluMask OpCode = 0x3ff0 - -const ( - // InvalidALUOp is returned by getters when invoked - // on non ALU OpCodes - InvalidALUOp ALUOp = 0xffff - // Add - addition - Add ALUOp = 0x0000 - // Sub - subtraction - Sub ALUOp = 0x0010 - // Mul - multiplication - Mul ALUOp = 0x0020 - // Div - division - Div ALUOp = 0x0030 - // SDiv - signed division - SDiv ALUOp = Div + 0x0100 - // Or - bitwise or - Or ALUOp = 0x0040 - // And - bitwise and - And ALUOp = 0x0050 - // LSh - bitwise shift left - LSh ALUOp = 0x0060 - // RSh - bitwise shift right - RSh ALUOp = 0x0070 - // Neg - sign/unsign signing bit - Neg ALUOp = 0x0080 - // Mod - modulo - Mod ALUOp = 0x0090 - // SMod - signed modulo - SMod ALUOp = Mod + 0x0100 - // Xor - bitwise xor - Xor ALUOp = 0x00a0 - // Mov - move value from one place to another - Mov ALUOp = 0x00b0 - // MovSX8 - move lower 8 bits, sign extended upper bits of target - MovSX8 ALUOp = Mov + 0x0100 - // MovSX16 - move lower 16 bits, sign extended upper bits of target - MovSX16 ALUOp = Mov + 0x0200 - // MovSX32 - move lower 32 bits, sign extended upper bits of target - MovSX32 ALUOp = Mov + 0x0300 - // ArSh - arithmetic shift - ArSh ALUOp = 0x00c0 - // Swap - endian conversions - Swap ALUOp = 0x00d0 -) - -// HostTo converts from host to another endianness. -func HostTo(endian Endianness, dst Register, size Size) Instruction { - var imm int64 - switch size { - case Half: - imm = 16 - case Word: - imm = 32 - case DWord: - imm = 64 - default: - return Instruction{OpCode: InvalidOpCode} - } - - return Instruction{ - OpCode: OpCode(ALUClass).SetALUOp(Swap).SetSource(Source(endian)), - Dst: dst, - Constant: imm, - } -} - -// BSwap unconditionally reverses the order of bytes in a register. -func BSwap(dst Register, size Size) Instruction { - var imm int64 - switch size { - case Half: - imm = 16 - case Word: - imm = 32 - case DWord: - imm = 64 - default: - return Instruction{OpCode: InvalidOpCode} - } - - return Instruction{ - OpCode: OpCode(ALU64Class).SetALUOp(Swap), - Dst: dst, - Constant: imm, - } -} - -// Op returns the OpCode for an ALU operation with a given source. -func (op ALUOp) Op(source Source) OpCode { - return OpCode(ALU64Class).SetALUOp(op).SetSource(source) -} - -// Reg emits `dst (op) src`. -func (op ALUOp) Reg(dst, src Register) Instruction { - return Instruction{ - OpCode: op.Op(RegSource), - Dst: dst, - Src: src, - } -} - -// Imm emits `dst (op) value`. -func (op ALUOp) Imm(dst Register, value int32) Instruction { - return Instruction{ - OpCode: op.Op(ImmSource), - Dst: dst, - Constant: int64(value), - } -} - -// Op32 returns the OpCode for a 32-bit ALU operation with a given source. -func (op ALUOp) Op32(source Source) OpCode { - return OpCode(ALUClass).SetALUOp(op).SetSource(source) -} - -// Reg32 emits `dst (op) src`, zeroing the upper 32 bit of dst. -func (op ALUOp) Reg32(dst, src Register) Instruction { - return Instruction{ - OpCode: op.Op32(RegSource), - Dst: dst, - Src: src, - } -} - -// Imm32 emits `dst (op) value`, zeroing the upper 32 bit of dst. -func (op ALUOp) Imm32(dst Register, value int32) Instruction { - return Instruction{ - OpCode: op.Op32(ImmSource), - Dst: dst, - Constant: int64(value), - } -} diff --git a/vendor/github.com/cilium/ebpf/asm/alu_string.go b/vendor/github.com/cilium/ebpf/asm/alu_string.go deleted file mode 100644 index 35b406bf3..000000000 --- a/vendor/github.com/cilium/ebpf/asm/alu_string.go +++ /dev/null @@ -1,117 +0,0 @@ -// Code generated by "stringer -output alu_string.go -type=Source,Endianness,ALUOp"; DO NOT EDIT. - -package asm - -import "strconv" - -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[InvalidSource-65535] - _ = x[ImmSource-0] - _ = x[RegSource-8] -} - -const ( - _Source_name_0 = "ImmSource" - _Source_name_1 = "RegSource" - _Source_name_2 = "InvalidSource" -) - -func (i Source) String() string { - switch { - case i == 0: - return _Source_name_0 - case i == 8: - return _Source_name_1 - case i == 65535: - return _Source_name_2 - default: - return "Source(" + strconv.FormatInt(int64(i), 10) + ")" - } -} -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[InvalidEndian-255] - _ = x[LE-0] - _ = x[BE-8] -} - -const ( - _Endianness_name_0 = "LE" - _Endianness_name_1 = "BE" - _Endianness_name_2 = "InvalidEndian" -) - -func (i Endianness) String() string { - switch { - case i == 0: - return _Endianness_name_0 - case i == 8: - return _Endianness_name_1 - case i == 255: - return _Endianness_name_2 - default: - return "Endianness(" + strconv.FormatInt(int64(i), 10) + ")" - } -} -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[InvalidALUOp-65535] - _ = x[Add-0] - _ = x[Sub-16] - _ = x[Mul-32] - _ = x[Div-48] - _ = x[SDiv-304] - _ = x[Or-64] - _ = x[And-80] - _ = x[LSh-96] - _ = x[RSh-112] - _ = x[Neg-128] - _ = x[Mod-144] - _ = x[SMod-400] - _ = x[Xor-160] - _ = x[Mov-176] - _ = x[MovSX8-432] - _ = x[MovSX16-688] - _ = x[MovSX32-944] - _ = x[ArSh-192] - _ = x[Swap-208] -} - -const _ALUOp_name = "AddSubMulDivOrAndLShRShNegModXorMovArShSwapSDivSModMovSX8MovSX16MovSX32InvalidALUOp" - -var _ALUOp_map = map[ALUOp]string{ - 0: _ALUOp_name[0:3], - 16: _ALUOp_name[3:6], - 32: _ALUOp_name[6:9], - 48: _ALUOp_name[9:12], - 64: _ALUOp_name[12:14], - 80: _ALUOp_name[14:17], - 96: _ALUOp_name[17:20], - 112: _ALUOp_name[20:23], - 128: _ALUOp_name[23:26], - 144: _ALUOp_name[26:29], - 160: _ALUOp_name[29:32], - 176: _ALUOp_name[32:35], - 192: _ALUOp_name[35:39], - 208: _ALUOp_name[39:43], - 304: _ALUOp_name[43:47], - 400: _ALUOp_name[47:51], - 432: _ALUOp_name[51:57], - 688: _ALUOp_name[57:64], - 944: _ALUOp_name[64:71], - 65535: _ALUOp_name[71:83], -} - -func (i ALUOp) String() string { - if str, ok := _ALUOp_map[i]; ok { - return str - } - return "ALUOp(" + strconv.FormatInt(int64(i), 10) + ")" -} diff --git a/vendor/github.com/cilium/ebpf/asm/doc.go b/vendor/github.com/cilium/ebpf/asm/doc.go deleted file mode 100644 index 7031bdc27..000000000 --- a/vendor/github.com/cilium/ebpf/asm/doc.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package asm is an assembler for eBPF bytecode. -package asm diff --git a/vendor/github.com/cilium/ebpf/asm/func.go b/vendor/github.com/cilium/ebpf/asm/func.go deleted file mode 100644 index 84a40b227..000000000 --- a/vendor/github.com/cilium/ebpf/asm/func.go +++ /dev/null @@ -1,250 +0,0 @@ -package asm - -//go:generate go run golang.org/x/tools/cmd/stringer@latest -output func_string.go -type=BuiltinFunc - -// BuiltinFunc is a built-in eBPF function. -type BuiltinFunc int32 - -func (_ BuiltinFunc) Max() BuiltinFunc { - return maxBuiltinFunc - 1 -} - -// eBPF built-in functions -// -// You can regenerate this list using the following gawk script: -// -// /FN\(.+\),/ { -// match($1, /\(([a-z_0-9]+),/, r) -// split(r[1], p, "_") -// printf "Fn" -// for (i in p) { -// printf "%s%s", toupper(substr(p[i], 1, 1)), substr(p[i], 2) -// } -// print "" -// } -// -// The script expects include/uapi/linux/bpf.h as it's input. -const ( - FnUnspec BuiltinFunc = iota - FnMapLookupElem - FnMapUpdateElem - FnMapDeleteElem - FnProbeRead - FnKtimeGetNs - FnTracePrintk - FnGetPrandomU32 - FnGetSmpProcessorId - FnSkbStoreBytes - FnL3CsumReplace - FnL4CsumReplace - FnTailCall - FnCloneRedirect - FnGetCurrentPidTgid - FnGetCurrentUidGid - FnGetCurrentComm - FnGetCgroupClassid - FnSkbVlanPush - FnSkbVlanPop - FnSkbGetTunnelKey - FnSkbSetTunnelKey - FnPerfEventRead - FnRedirect - FnGetRouteRealm - FnPerfEventOutput - FnSkbLoadBytes - FnGetStackid - FnCsumDiff - FnSkbGetTunnelOpt - FnSkbSetTunnelOpt - FnSkbChangeProto - FnSkbChangeType - FnSkbUnderCgroup - FnGetHashRecalc - FnGetCurrentTask - FnProbeWriteUser - FnCurrentTaskUnderCgroup - FnSkbChangeTail - FnSkbPullData - FnCsumUpdate - FnSetHashInvalid - FnGetNumaNodeId - FnSkbChangeHead - FnXdpAdjustHead - FnProbeReadStr - FnGetSocketCookie - FnGetSocketUid - FnSetHash - FnSetsockopt - FnSkbAdjustRoom - FnRedirectMap - FnSkRedirectMap - FnSockMapUpdate - FnXdpAdjustMeta - FnPerfEventReadValue - FnPerfProgReadValue - FnGetsockopt - FnOverrideReturn - FnSockOpsCbFlagsSet - FnMsgRedirectMap - FnMsgApplyBytes - FnMsgCorkBytes - FnMsgPullData - FnBind - FnXdpAdjustTail - FnSkbGetXfrmState - FnGetStack - FnSkbLoadBytesRelative - FnFibLookup - FnSockHashUpdate - FnMsgRedirectHash - FnSkRedirectHash - FnLwtPushEncap - FnLwtSeg6StoreBytes - FnLwtSeg6AdjustSrh - FnLwtSeg6Action - FnRcRepeat - FnRcKeydown - FnSkbCgroupId - FnGetCurrentCgroupId - FnGetLocalStorage - FnSkSelectReuseport - FnSkbAncestorCgroupId - FnSkLookupTcp - FnSkLookupUdp - FnSkRelease - FnMapPushElem - FnMapPopElem - FnMapPeekElem - FnMsgPushData - FnMsgPopData - FnRcPointerRel - FnSpinLock - FnSpinUnlock - FnSkFullsock - FnTcpSock - FnSkbEcnSetCe - FnGetListenerSock - FnSkcLookupTcp - FnTcpCheckSyncookie - FnSysctlGetName - FnSysctlGetCurrentValue - FnSysctlGetNewValue - FnSysctlSetNewValue - FnStrtol - FnStrtoul - FnSkStorageGet - FnSkStorageDelete - FnSendSignal - FnTcpGenSyncookie - FnSkbOutput - FnProbeReadUser - FnProbeReadKernel - FnProbeReadUserStr - FnProbeReadKernelStr - FnTcpSendAck - FnSendSignalThread - FnJiffies64 - FnReadBranchRecords - FnGetNsCurrentPidTgid - FnXdpOutput - FnGetNetnsCookie - FnGetCurrentAncestorCgroupId - FnSkAssign - FnKtimeGetBootNs - FnSeqPrintf - FnSeqWrite - FnSkCgroupId - FnSkAncestorCgroupId - FnRingbufOutput - FnRingbufReserve - FnRingbufSubmit - FnRingbufDiscard - FnRingbufQuery - FnCsumLevel - FnSkcToTcp6Sock - FnSkcToTcpSock - FnSkcToTcpTimewaitSock - FnSkcToTcpRequestSock - FnSkcToUdp6Sock - FnGetTaskStack - FnLoadHdrOpt - FnStoreHdrOpt - FnReserveHdrOpt - FnInodeStorageGet - FnInodeStorageDelete - FnDPath - FnCopyFromUser - FnSnprintfBtf - FnSeqPrintfBtf - FnSkbCgroupClassid - FnRedirectNeigh - FnPerCpuPtr - FnThisCpuPtr - FnRedirectPeer - FnTaskStorageGet - FnTaskStorageDelete - FnGetCurrentTaskBtf - FnBprmOptsSet - FnKtimeGetCoarseNs - FnImaInodeHash - FnSockFromFile - FnCheckMtu - FnForEachMapElem - FnSnprintf - FnSysBpf - FnBtfFindByNameKind - FnSysClose - FnTimerInit - FnTimerSetCallback - FnTimerStart - FnTimerCancel - FnGetFuncIp - FnGetAttachCookie - FnTaskPtRegs - FnGetBranchSnapshot - FnTraceVprintk - FnSkcToUnixSock - FnKallsymsLookupName - FnFindVma - FnLoop - FnStrncmp - FnGetFuncArg - FnGetFuncRet - FnGetFuncArgCnt - FnGetRetval - FnSetRetval - FnXdpGetBuffLen - FnXdpLoadBytes - FnXdpStoreBytes - FnCopyFromUserTask - FnSkbSetTstamp - FnImaFileHash - FnKptrXchg - FnMapLookupPercpuElem - FnSkcToMptcpSock - FnDynptrFromMem - FnRingbufReserveDynptr - FnRingbufSubmitDynptr - FnRingbufDiscardDynptr - FnDynptrRead - FnDynptrWrite - FnDynptrData - FnTcpRawGenSyncookieIpv4 - FnTcpRawGenSyncookieIpv6 - FnTcpRawCheckSyncookieIpv4 - FnTcpRawCheckSyncookieIpv6 - FnKtimeGetTaiNs - FnUserRingbufDrain - FnCgrpStorageGet - FnCgrpStorageDelete - - maxBuiltinFunc -) - -// Call emits a function call. -func (fn BuiltinFunc) Call() Instruction { - return Instruction{ - OpCode: OpCode(JumpClass).SetJumpOp(Call), - Constant: int64(fn), - } -} diff --git a/vendor/github.com/cilium/ebpf/asm/func_string.go b/vendor/github.com/cilium/ebpf/asm/func_string.go deleted file mode 100644 index 47150bc4f..000000000 --- a/vendor/github.com/cilium/ebpf/asm/func_string.go +++ /dev/null @@ -1,235 +0,0 @@ -// Code generated by "stringer -output func_string.go -type=BuiltinFunc"; DO NOT EDIT. - -package asm - -import "strconv" - -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[FnUnspec-0] - _ = x[FnMapLookupElem-1] - _ = x[FnMapUpdateElem-2] - _ = x[FnMapDeleteElem-3] - _ = x[FnProbeRead-4] - _ = x[FnKtimeGetNs-5] - _ = x[FnTracePrintk-6] - _ = x[FnGetPrandomU32-7] - _ = x[FnGetSmpProcessorId-8] - _ = x[FnSkbStoreBytes-9] - _ = x[FnL3CsumReplace-10] - _ = x[FnL4CsumReplace-11] - _ = x[FnTailCall-12] - _ = x[FnCloneRedirect-13] - _ = x[FnGetCurrentPidTgid-14] - _ = x[FnGetCurrentUidGid-15] - _ = x[FnGetCurrentComm-16] - _ = x[FnGetCgroupClassid-17] - _ = x[FnSkbVlanPush-18] - _ = x[FnSkbVlanPop-19] - _ = x[FnSkbGetTunnelKey-20] - _ = x[FnSkbSetTunnelKey-21] - _ = x[FnPerfEventRead-22] - _ = x[FnRedirect-23] - _ = x[FnGetRouteRealm-24] - _ = x[FnPerfEventOutput-25] - _ = x[FnSkbLoadBytes-26] - _ = x[FnGetStackid-27] - _ = x[FnCsumDiff-28] - _ = x[FnSkbGetTunnelOpt-29] - _ = x[FnSkbSetTunnelOpt-30] - _ = x[FnSkbChangeProto-31] - _ = x[FnSkbChangeType-32] - _ = x[FnSkbUnderCgroup-33] - _ = x[FnGetHashRecalc-34] - _ = x[FnGetCurrentTask-35] - _ = x[FnProbeWriteUser-36] - _ = x[FnCurrentTaskUnderCgroup-37] - _ = x[FnSkbChangeTail-38] - _ = x[FnSkbPullData-39] - _ = x[FnCsumUpdate-40] - _ = x[FnSetHashInvalid-41] - _ = x[FnGetNumaNodeId-42] - _ = x[FnSkbChangeHead-43] - _ = x[FnXdpAdjustHead-44] - _ = x[FnProbeReadStr-45] - _ = x[FnGetSocketCookie-46] - _ = x[FnGetSocketUid-47] - _ = x[FnSetHash-48] - _ = x[FnSetsockopt-49] - _ = x[FnSkbAdjustRoom-50] - _ = x[FnRedirectMap-51] - _ = x[FnSkRedirectMap-52] - _ = x[FnSockMapUpdate-53] - _ = x[FnXdpAdjustMeta-54] - _ = x[FnPerfEventReadValue-55] - _ = x[FnPerfProgReadValue-56] - _ = x[FnGetsockopt-57] - _ = x[FnOverrideReturn-58] - _ = x[FnSockOpsCbFlagsSet-59] - _ = x[FnMsgRedirectMap-60] - _ = x[FnMsgApplyBytes-61] - _ = x[FnMsgCorkBytes-62] - _ = x[FnMsgPullData-63] - _ = x[FnBind-64] - _ = x[FnXdpAdjustTail-65] - _ = x[FnSkbGetXfrmState-66] - _ = x[FnGetStack-67] - _ = x[FnSkbLoadBytesRelative-68] - _ = x[FnFibLookup-69] - _ = x[FnSockHashUpdate-70] - _ = x[FnMsgRedirectHash-71] - _ = x[FnSkRedirectHash-72] - _ = x[FnLwtPushEncap-73] - _ = x[FnLwtSeg6StoreBytes-74] - _ = x[FnLwtSeg6AdjustSrh-75] - _ = x[FnLwtSeg6Action-76] - _ = x[FnRcRepeat-77] - _ = x[FnRcKeydown-78] - _ = x[FnSkbCgroupId-79] - _ = x[FnGetCurrentCgroupId-80] - _ = x[FnGetLocalStorage-81] - _ = x[FnSkSelectReuseport-82] - _ = x[FnSkbAncestorCgroupId-83] - _ = x[FnSkLookupTcp-84] - _ = x[FnSkLookupUdp-85] - _ = x[FnSkRelease-86] - _ = x[FnMapPushElem-87] - _ = x[FnMapPopElem-88] - _ = x[FnMapPeekElem-89] - _ = x[FnMsgPushData-90] - _ = x[FnMsgPopData-91] - _ = x[FnRcPointerRel-92] - _ = x[FnSpinLock-93] - _ = x[FnSpinUnlock-94] - _ = x[FnSkFullsock-95] - _ = x[FnTcpSock-96] - _ = x[FnSkbEcnSetCe-97] - _ = x[FnGetListenerSock-98] - _ = x[FnSkcLookupTcp-99] - _ = x[FnTcpCheckSyncookie-100] - _ = x[FnSysctlGetName-101] - _ = x[FnSysctlGetCurrentValue-102] - _ = x[FnSysctlGetNewValue-103] - _ = x[FnSysctlSetNewValue-104] - _ = x[FnStrtol-105] - _ = x[FnStrtoul-106] - _ = x[FnSkStorageGet-107] - _ = x[FnSkStorageDelete-108] - _ = x[FnSendSignal-109] - _ = x[FnTcpGenSyncookie-110] - _ = x[FnSkbOutput-111] - _ = x[FnProbeReadUser-112] - _ = x[FnProbeReadKernel-113] - _ = x[FnProbeReadUserStr-114] - _ = x[FnProbeReadKernelStr-115] - _ = x[FnTcpSendAck-116] - _ = x[FnSendSignalThread-117] - _ = x[FnJiffies64-118] - _ = x[FnReadBranchRecords-119] - _ = x[FnGetNsCurrentPidTgid-120] - _ = x[FnXdpOutput-121] - _ = x[FnGetNetnsCookie-122] - _ = x[FnGetCurrentAncestorCgroupId-123] - _ = x[FnSkAssign-124] - _ = x[FnKtimeGetBootNs-125] - _ = x[FnSeqPrintf-126] - _ = x[FnSeqWrite-127] - _ = x[FnSkCgroupId-128] - _ = x[FnSkAncestorCgroupId-129] - _ = x[FnRingbufOutput-130] - _ = x[FnRingbufReserve-131] - _ = x[FnRingbufSubmit-132] - _ = x[FnRingbufDiscard-133] - _ = x[FnRingbufQuery-134] - _ = x[FnCsumLevel-135] - _ = x[FnSkcToTcp6Sock-136] - _ = x[FnSkcToTcpSock-137] - _ = x[FnSkcToTcpTimewaitSock-138] - _ = x[FnSkcToTcpRequestSock-139] - _ = x[FnSkcToUdp6Sock-140] - _ = x[FnGetTaskStack-141] - _ = x[FnLoadHdrOpt-142] - _ = x[FnStoreHdrOpt-143] - _ = x[FnReserveHdrOpt-144] - _ = x[FnInodeStorageGet-145] - _ = x[FnInodeStorageDelete-146] - _ = x[FnDPath-147] - _ = x[FnCopyFromUser-148] - _ = x[FnSnprintfBtf-149] - _ = x[FnSeqPrintfBtf-150] - _ = x[FnSkbCgroupClassid-151] - _ = x[FnRedirectNeigh-152] - _ = x[FnPerCpuPtr-153] - _ = x[FnThisCpuPtr-154] - _ = x[FnRedirectPeer-155] - _ = x[FnTaskStorageGet-156] - _ = x[FnTaskStorageDelete-157] - _ = x[FnGetCurrentTaskBtf-158] - _ = x[FnBprmOptsSet-159] - _ = x[FnKtimeGetCoarseNs-160] - _ = x[FnImaInodeHash-161] - _ = x[FnSockFromFile-162] - _ = x[FnCheckMtu-163] - _ = x[FnForEachMapElem-164] - _ = x[FnSnprintf-165] - _ = x[FnSysBpf-166] - _ = x[FnBtfFindByNameKind-167] - _ = x[FnSysClose-168] - _ = x[FnTimerInit-169] - _ = x[FnTimerSetCallback-170] - _ = x[FnTimerStart-171] - _ = x[FnTimerCancel-172] - _ = x[FnGetFuncIp-173] - _ = x[FnGetAttachCookie-174] - _ = x[FnTaskPtRegs-175] - _ = x[FnGetBranchSnapshot-176] - _ = x[FnTraceVprintk-177] - _ = x[FnSkcToUnixSock-178] - _ = x[FnKallsymsLookupName-179] - _ = x[FnFindVma-180] - _ = x[FnLoop-181] - _ = x[FnStrncmp-182] - _ = x[FnGetFuncArg-183] - _ = x[FnGetFuncRet-184] - _ = x[FnGetFuncArgCnt-185] - _ = x[FnGetRetval-186] - _ = x[FnSetRetval-187] - _ = x[FnXdpGetBuffLen-188] - _ = x[FnXdpLoadBytes-189] - _ = x[FnXdpStoreBytes-190] - _ = x[FnCopyFromUserTask-191] - _ = x[FnSkbSetTstamp-192] - _ = x[FnImaFileHash-193] - _ = x[FnKptrXchg-194] - _ = x[FnMapLookupPercpuElem-195] - _ = x[FnSkcToMptcpSock-196] - _ = x[FnDynptrFromMem-197] - _ = x[FnRingbufReserveDynptr-198] - _ = x[FnRingbufSubmitDynptr-199] - _ = x[FnRingbufDiscardDynptr-200] - _ = x[FnDynptrRead-201] - _ = x[FnDynptrWrite-202] - _ = x[FnDynptrData-203] - _ = x[FnTcpRawGenSyncookieIpv4-204] - _ = x[FnTcpRawGenSyncookieIpv6-205] - _ = x[FnTcpRawCheckSyncookieIpv4-206] - _ = x[FnTcpRawCheckSyncookieIpv6-207] - _ = x[FnKtimeGetTaiNs-208] - _ = x[FnUserRingbufDrain-209] - _ = x[FnCgrpStorageGet-210] - _ = x[FnCgrpStorageDelete-211] - _ = x[maxBuiltinFunc-212] -} - -const _BuiltinFunc_name = "FnUnspecFnMapLookupElemFnMapUpdateElemFnMapDeleteElemFnProbeReadFnKtimeGetNsFnTracePrintkFnGetPrandomU32FnGetSmpProcessorIdFnSkbStoreBytesFnL3CsumReplaceFnL4CsumReplaceFnTailCallFnCloneRedirectFnGetCurrentPidTgidFnGetCurrentUidGidFnGetCurrentCommFnGetCgroupClassidFnSkbVlanPushFnSkbVlanPopFnSkbGetTunnelKeyFnSkbSetTunnelKeyFnPerfEventReadFnRedirectFnGetRouteRealmFnPerfEventOutputFnSkbLoadBytesFnGetStackidFnCsumDiffFnSkbGetTunnelOptFnSkbSetTunnelOptFnSkbChangeProtoFnSkbChangeTypeFnSkbUnderCgroupFnGetHashRecalcFnGetCurrentTaskFnProbeWriteUserFnCurrentTaskUnderCgroupFnSkbChangeTailFnSkbPullDataFnCsumUpdateFnSetHashInvalidFnGetNumaNodeIdFnSkbChangeHeadFnXdpAdjustHeadFnProbeReadStrFnGetSocketCookieFnGetSocketUidFnSetHashFnSetsockoptFnSkbAdjustRoomFnRedirectMapFnSkRedirectMapFnSockMapUpdateFnXdpAdjustMetaFnPerfEventReadValueFnPerfProgReadValueFnGetsockoptFnOverrideReturnFnSockOpsCbFlagsSetFnMsgRedirectMapFnMsgApplyBytesFnMsgCorkBytesFnMsgPullDataFnBindFnXdpAdjustTailFnSkbGetXfrmStateFnGetStackFnSkbLoadBytesRelativeFnFibLookupFnSockHashUpdateFnMsgRedirectHashFnSkRedirectHashFnLwtPushEncapFnLwtSeg6StoreBytesFnLwtSeg6AdjustSrhFnLwtSeg6ActionFnRcRepeatFnRcKeydownFnSkbCgroupIdFnGetCurrentCgroupIdFnGetLocalStorageFnSkSelectReuseportFnSkbAncestorCgroupIdFnSkLookupTcpFnSkLookupUdpFnSkReleaseFnMapPushElemFnMapPopElemFnMapPeekElemFnMsgPushDataFnMsgPopDataFnRcPointerRelFnSpinLockFnSpinUnlockFnSkFullsockFnTcpSockFnSkbEcnSetCeFnGetListenerSockFnSkcLookupTcpFnTcpCheckSyncookieFnSysctlGetNameFnSysctlGetCurrentValueFnSysctlGetNewValueFnSysctlSetNewValueFnStrtolFnStrtoulFnSkStorageGetFnSkStorageDeleteFnSendSignalFnTcpGenSyncookieFnSkbOutputFnProbeReadUserFnProbeReadKernelFnProbeReadUserStrFnProbeReadKernelStrFnTcpSendAckFnSendSignalThreadFnJiffies64FnReadBranchRecordsFnGetNsCurrentPidTgidFnXdpOutputFnGetNetnsCookieFnGetCurrentAncestorCgroupIdFnSkAssignFnKtimeGetBootNsFnSeqPrintfFnSeqWriteFnSkCgroupIdFnSkAncestorCgroupIdFnRingbufOutputFnRingbufReserveFnRingbufSubmitFnRingbufDiscardFnRingbufQueryFnCsumLevelFnSkcToTcp6SockFnSkcToTcpSockFnSkcToTcpTimewaitSockFnSkcToTcpRequestSockFnSkcToUdp6SockFnGetTaskStackFnLoadHdrOptFnStoreHdrOptFnReserveHdrOptFnInodeStorageGetFnInodeStorageDeleteFnDPathFnCopyFromUserFnSnprintfBtfFnSeqPrintfBtfFnSkbCgroupClassidFnRedirectNeighFnPerCpuPtrFnThisCpuPtrFnRedirectPeerFnTaskStorageGetFnTaskStorageDeleteFnGetCurrentTaskBtfFnBprmOptsSetFnKtimeGetCoarseNsFnImaInodeHashFnSockFromFileFnCheckMtuFnForEachMapElemFnSnprintfFnSysBpfFnBtfFindByNameKindFnSysCloseFnTimerInitFnTimerSetCallbackFnTimerStartFnTimerCancelFnGetFuncIpFnGetAttachCookieFnTaskPtRegsFnGetBranchSnapshotFnTraceVprintkFnSkcToUnixSockFnKallsymsLookupNameFnFindVmaFnLoopFnStrncmpFnGetFuncArgFnGetFuncRetFnGetFuncArgCntFnGetRetvalFnSetRetvalFnXdpGetBuffLenFnXdpLoadBytesFnXdpStoreBytesFnCopyFromUserTaskFnSkbSetTstampFnImaFileHashFnKptrXchgFnMapLookupPercpuElemFnSkcToMptcpSockFnDynptrFromMemFnRingbufReserveDynptrFnRingbufSubmitDynptrFnRingbufDiscardDynptrFnDynptrReadFnDynptrWriteFnDynptrDataFnTcpRawGenSyncookieIpv4FnTcpRawGenSyncookieIpv6FnTcpRawCheckSyncookieIpv4FnTcpRawCheckSyncookieIpv6FnKtimeGetTaiNsFnUserRingbufDrainFnCgrpStorageGetFnCgrpStorageDeletemaxBuiltinFunc" - -var _BuiltinFunc_index = [...]uint16{0, 8, 23, 38, 53, 64, 76, 89, 104, 123, 138, 153, 168, 178, 193, 212, 230, 246, 264, 277, 289, 306, 323, 338, 348, 363, 380, 394, 406, 416, 433, 450, 466, 481, 497, 512, 528, 544, 568, 583, 596, 608, 624, 639, 654, 669, 683, 700, 714, 723, 735, 750, 763, 778, 793, 808, 828, 847, 859, 875, 894, 910, 925, 939, 952, 958, 973, 990, 1000, 1022, 1033, 1049, 1066, 1082, 1096, 1115, 1133, 1148, 1158, 1169, 1182, 1202, 1219, 1238, 1259, 1272, 1285, 1296, 1309, 1321, 1334, 1347, 1359, 1373, 1383, 1395, 1407, 1416, 1429, 1446, 1460, 1479, 1494, 1517, 1536, 1555, 1563, 1572, 1586, 1603, 1615, 1632, 1643, 1658, 1675, 1693, 1713, 1725, 1743, 1754, 1773, 1794, 1805, 1821, 1849, 1859, 1875, 1886, 1896, 1908, 1928, 1943, 1959, 1974, 1990, 2004, 2015, 2030, 2044, 2066, 2087, 2102, 2116, 2128, 2141, 2156, 2173, 2193, 2200, 2214, 2227, 2241, 2259, 2274, 2285, 2297, 2311, 2327, 2346, 2365, 2378, 2396, 2410, 2424, 2434, 2450, 2460, 2468, 2487, 2497, 2508, 2526, 2538, 2551, 2562, 2579, 2591, 2610, 2624, 2639, 2659, 2668, 2674, 2683, 2695, 2707, 2722, 2733, 2744, 2759, 2773, 2788, 2806, 2820, 2833, 2843, 2864, 2880, 2895, 2917, 2938, 2960, 2972, 2985, 2997, 3021, 3045, 3071, 3097, 3112, 3130, 3146, 3165, 3179} - -func (i BuiltinFunc) String() string { - if i < 0 || i >= BuiltinFunc(len(_BuiltinFunc_index)-1) { - return "BuiltinFunc(" + strconv.FormatInt(int64(i), 10) + ")" - } - return _BuiltinFunc_name[_BuiltinFunc_index[i]:_BuiltinFunc_index[i+1]] -} diff --git a/vendor/github.com/cilium/ebpf/asm/instruction.go b/vendor/github.com/cilium/ebpf/asm/instruction.go deleted file mode 100644 index 67cd39d6f..000000000 --- a/vendor/github.com/cilium/ebpf/asm/instruction.go +++ /dev/null @@ -1,954 +0,0 @@ -package asm - -import ( - "crypto/sha1" - "encoding/binary" - "encoding/hex" - "errors" - "fmt" - "io" - "math" - "sort" - "strings" - - "github.com/cilium/ebpf/internal/sys" - "github.com/cilium/ebpf/internal/unix" -) - -// InstructionSize is the size of a BPF instruction in bytes -const InstructionSize = 8 - -// RawInstructionOffset is an offset in units of raw BPF instructions. -type RawInstructionOffset uint64 - -var ErrUnreferencedSymbol = errors.New("unreferenced symbol") -var ErrUnsatisfiedMapReference = errors.New("unsatisfied map reference") -var ErrUnsatisfiedProgramReference = errors.New("unsatisfied program reference") - -// Bytes returns the offset of an instruction in bytes. -func (rio RawInstructionOffset) Bytes() uint64 { - return uint64(rio) * InstructionSize -} - -// Instruction is a single eBPF instruction. -type Instruction struct { - OpCode OpCode - Dst Register - Src Register - Offset int16 - Constant int64 - - // Metadata contains optional metadata about this instruction. - Metadata Metadata -} - -// Unmarshal decodes a BPF instruction. -func (ins *Instruction) Unmarshal(r io.Reader, bo binary.ByteOrder) (uint64, error) { - data := make([]byte, InstructionSize) - if _, err := io.ReadFull(r, data); err != nil { - return 0, err - } - - ins.OpCode = OpCode(data[0]) - - regs := data[1] - switch bo { - case binary.LittleEndian: - ins.Dst, ins.Src = Register(regs&0xF), Register(regs>>4) - case binary.BigEndian: - ins.Dst, ins.Src = Register(regs>>4), Register(regs&0xf) - } - - ins.Offset = int16(bo.Uint16(data[2:4])) - - if ins.OpCode.Class().IsALU() { - switch ins.OpCode.ALUOp() { - case Div: - if ins.Offset == 1 { - ins.OpCode = ins.OpCode.SetALUOp(SDiv) - ins.Offset = 0 - } - case Mod: - if ins.Offset == 1 { - ins.OpCode = ins.OpCode.SetALUOp(SMod) - ins.Offset = 0 - } - case Mov: - switch ins.Offset { - case 8: - ins.OpCode = ins.OpCode.SetALUOp(MovSX8) - ins.Offset = 0 - case 16: - ins.OpCode = ins.OpCode.SetALUOp(MovSX16) - ins.Offset = 0 - case 32: - ins.OpCode = ins.OpCode.SetALUOp(MovSX32) - ins.Offset = 0 - } - } - } - - // Convert to int32 before widening to int64 - // to ensure the signed bit is carried over. - ins.Constant = int64(int32(bo.Uint32(data[4:8]))) - - if !ins.OpCode.IsDWordLoad() { - return InstructionSize, nil - } - - // Pull another instruction from the stream to retrieve the second - // half of the 64-bit immediate value. - if _, err := io.ReadFull(r, data); err != nil { - // No Wrap, to avoid io.EOF clash - return 0, errors.New("64bit immediate is missing second half") - } - - // Require that all fields other than the value are zero. - if bo.Uint32(data[0:4]) != 0 { - return 0, errors.New("64bit immediate has non-zero fields") - } - - cons1 := uint32(ins.Constant) - cons2 := int32(bo.Uint32(data[4:8])) - ins.Constant = int64(cons2)<<32 | int64(cons1) - - return 2 * InstructionSize, nil -} - -// Marshal encodes a BPF instruction. -func (ins Instruction) Marshal(w io.Writer, bo binary.ByteOrder) (uint64, error) { - if ins.OpCode == InvalidOpCode { - return 0, errors.New("invalid opcode") - } - - isDWordLoad := ins.OpCode.IsDWordLoad() - - cons := int32(ins.Constant) - if isDWordLoad { - // Encode least significant 32bit first for 64bit operations. - cons = int32(uint32(ins.Constant)) - } - - regs, err := newBPFRegisters(ins.Dst, ins.Src, bo) - if err != nil { - return 0, fmt.Errorf("can't marshal registers: %s", err) - } - - if ins.OpCode.Class().IsALU() { - newOffset := int16(0) - switch ins.OpCode.ALUOp() { - case SDiv: - ins.OpCode = ins.OpCode.SetALUOp(Div) - newOffset = 1 - case SMod: - ins.OpCode = ins.OpCode.SetALUOp(Mod) - newOffset = 1 - case MovSX8: - ins.OpCode = ins.OpCode.SetALUOp(Mov) - newOffset = 8 - case MovSX16: - ins.OpCode = ins.OpCode.SetALUOp(Mov) - newOffset = 16 - case MovSX32: - ins.OpCode = ins.OpCode.SetALUOp(Mov) - newOffset = 32 - } - if newOffset != 0 && ins.Offset != 0 { - return 0, fmt.Errorf("extended ALU opcodes should have an .Offset of 0: %s", ins) - } - ins.Offset = newOffset - } - - op, err := ins.OpCode.bpfOpCode() - if err != nil { - return 0, err - } - - data := make([]byte, InstructionSize) - data[0] = op - data[1] = byte(regs) - bo.PutUint16(data[2:4], uint16(ins.Offset)) - bo.PutUint32(data[4:8], uint32(cons)) - if _, err := w.Write(data); err != nil { - return 0, err - } - - if !isDWordLoad { - return InstructionSize, nil - } - - // The first half of the second part of a double-wide instruction - // must be zero. The second half carries the value. - bo.PutUint32(data[0:4], 0) - bo.PutUint32(data[4:8], uint32(ins.Constant>>32)) - if _, err := w.Write(data); err != nil { - return 0, err - } - - return 2 * InstructionSize, nil -} - -// AssociateMap associates a Map with this Instruction. -// -// Implicitly clears the Instruction's Reference field. -// -// Returns an error if the Instruction is not a map load. -func (ins *Instruction) AssociateMap(m FDer) error { - if !ins.IsLoadFromMap() { - return errors.New("not a load from a map") - } - - ins.Metadata.Set(referenceMeta{}, nil) - ins.Metadata.Set(mapMeta{}, m) - - return nil -} - -// RewriteMapPtr changes an instruction to use a new map fd. -// -// Returns an error if the instruction doesn't load a map. -// -// Deprecated: use AssociateMap instead. If you cannot provide a Map, -// wrap an fd in a type implementing FDer. -func (ins *Instruction) RewriteMapPtr(fd int) error { - if !ins.IsLoadFromMap() { - return errors.New("not a load from a map") - } - - ins.encodeMapFD(fd) - - return nil -} - -func (ins *Instruction) encodeMapFD(fd int) { - // Preserve the offset value for direct map loads. - offset := uint64(ins.Constant) & (math.MaxUint32 << 32) - rawFd := uint64(uint32(fd)) - ins.Constant = int64(offset | rawFd) -} - -// MapPtr returns the map fd for this instruction. -// -// The result is undefined if the instruction is not a load from a map, -// see IsLoadFromMap. -// -// Deprecated: use Map() instead. -func (ins *Instruction) MapPtr() int { - // If there is a map associated with the instruction, return its FD. - if fd := ins.Metadata.Get(mapMeta{}); fd != nil { - return fd.(FDer).FD() - } - - // Fall back to the fd stored in the Constant field - return ins.mapFd() -} - -// mapFd returns the map file descriptor stored in the 32 least significant -// bits of ins' Constant field. -func (ins *Instruction) mapFd() int { - return int(int32(ins.Constant)) -} - -// RewriteMapOffset changes the offset of a direct load from a map. -// -// Returns an error if the instruction is not a direct load. -func (ins *Instruction) RewriteMapOffset(offset uint32) error { - if !ins.OpCode.IsDWordLoad() { - return fmt.Errorf("%s is not a 64 bit load", ins.OpCode) - } - - if ins.Src != PseudoMapValue { - return errors.New("not a direct load from a map") - } - - fd := uint64(ins.Constant) & math.MaxUint32 - ins.Constant = int64(uint64(offset)<<32 | fd) - return nil -} - -func (ins *Instruction) mapOffset() uint32 { - return uint32(uint64(ins.Constant) >> 32) -} - -// IsLoadFromMap returns true if the instruction loads from a map. -// -// This covers both loading the map pointer and direct map value loads. -func (ins *Instruction) IsLoadFromMap() bool { - return ins.OpCode == LoadImmOp(DWord) && (ins.Src == PseudoMapFD || ins.Src == PseudoMapValue) -} - -// IsFunctionCall returns true if the instruction calls another BPF function. -// -// This is not the same thing as a BPF helper call. -func (ins *Instruction) IsFunctionCall() bool { - return ins.OpCode.JumpOp() == Call && ins.Src == PseudoCall -} - -// IsKfuncCall returns true if the instruction calls a kfunc. -// -// This is not the same thing as a BPF helper call. -func (ins *Instruction) IsKfuncCall() bool { - return ins.OpCode.JumpOp() == Call && ins.Src == PseudoKfuncCall -} - -// IsLoadOfFunctionPointer returns true if the instruction loads a function pointer. -func (ins *Instruction) IsLoadOfFunctionPointer() bool { - return ins.OpCode.IsDWordLoad() && ins.Src == PseudoFunc -} - -// IsFunctionReference returns true if the instruction references another BPF -// function, either by invoking a Call jump operation or by loading a function -// pointer. -func (ins *Instruction) IsFunctionReference() bool { - return ins.IsFunctionCall() || ins.IsLoadOfFunctionPointer() -} - -// IsBuiltinCall returns true if the instruction is a built-in call, i.e. BPF helper call. -func (ins *Instruction) IsBuiltinCall() bool { - return ins.OpCode.JumpOp() == Call && ins.Src == R0 && ins.Dst == R0 -} - -// IsConstantLoad returns true if the instruction loads a constant of the -// given size. -func (ins *Instruction) IsConstantLoad(size Size) bool { - return ins.OpCode == LoadImmOp(size) && ins.Src == R0 && ins.Offset == 0 -} - -// Format implements fmt.Formatter. -func (ins Instruction) Format(f fmt.State, c rune) { - if c != 'v' { - fmt.Fprintf(f, "{UNRECOGNIZED: %c}", c) - return - } - - op := ins.OpCode - - if op == InvalidOpCode { - fmt.Fprint(f, "INVALID") - return - } - - // Omit trailing space for Exit - if op.JumpOp() == Exit { - fmt.Fprint(f, op) - return - } - - if ins.IsLoadFromMap() { - fd := ins.mapFd() - m := ins.Map() - switch ins.Src { - case PseudoMapFD: - if m != nil { - fmt.Fprintf(f, "LoadMapPtr dst: %s map: %s", ins.Dst, m) - } else { - fmt.Fprintf(f, "LoadMapPtr dst: %s fd: %d", ins.Dst, fd) - } - - case PseudoMapValue: - if m != nil { - fmt.Fprintf(f, "LoadMapValue dst: %s, map: %s off: %d", ins.Dst, m, ins.mapOffset()) - } else { - fmt.Fprintf(f, "LoadMapValue dst: %s, fd: %d off: %d", ins.Dst, fd, ins.mapOffset()) - } - } - - goto ref - } - - switch cls := op.Class(); { - case cls.isLoadOrStore(): - fmt.Fprintf(f, "%v ", op) - switch op.Mode() { - case ImmMode: - fmt.Fprintf(f, "dst: %s imm: %d", ins.Dst, ins.Constant) - case AbsMode: - fmt.Fprintf(f, "imm: %d", ins.Constant) - case IndMode: - fmt.Fprintf(f, "dst: %s src: %s imm: %d", ins.Dst, ins.Src, ins.Constant) - case MemMode, MemSXMode: - fmt.Fprintf(f, "dst: %s src: %s off: %d imm: %d", ins.Dst, ins.Src, ins.Offset, ins.Constant) - case XAddMode: - fmt.Fprintf(f, "dst: %s src: %s", ins.Dst, ins.Src) - } - - case cls.IsALU(): - fmt.Fprintf(f, "%v", op) - if op == Swap.Op(ImmSource) { - fmt.Fprintf(f, "%d", ins.Constant) - } - - fmt.Fprintf(f, " dst: %s ", ins.Dst) - switch { - case op.ALUOp() == Swap: - break - case op.Source() == ImmSource: - fmt.Fprintf(f, "imm: %d", ins.Constant) - default: - fmt.Fprintf(f, "src: %s", ins.Src) - } - - case cls.IsJump(): - fmt.Fprintf(f, "%v ", op) - switch jop := op.JumpOp(); jop { - case Call: - switch ins.Src { - case PseudoCall: - // bpf-to-bpf call - fmt.Fprint(f, ins.Constant) - case PseudoKfuncCall: - // kfunc call - fmt.Fprintf(f, "Kfunc(%d)", ins.Constant) - default: - fmt.Fprint(f, BuiltinFunc(ins.Constant)) - } - - case Ja: - if ins.OpCode.Class() == Jump32Class { - fmt.Fprintf(f, "imm: %d", ins.Constant) - } else { - fmt.Fprintf(f, "off: %d", ins.Offset) - } - - default: - fmt.Fprintf(f, "dst: %s off: %d ", ins.Dst, ins.Offset) - if op.Source() == ImmSource { - fmt.Fprintf(f, "imm: %d", ins.Constant) - } else { - fmt.Fprintf(f, "src: %s", ins.Src) - } - } - default: - fmt.Fprintf(f, "%v ", op) - } - -ref: - if ins.Reference() != "" { - fmt.Fprintf(f, " <%s>", ins.Reference()) - } -} - -func (ins Instruction) equal(other Instruction) bool { - return ins.OpCode == other.OpCode && - ins.Dst == other.Dst && - ins.Src == other.Src && - ins.Offset == other.Offset && - ins.Constant == other.Constant -} - -// Size returns the amount of bytes ins would occupy in binary form. -func (ins Instruction) Size() uint64 { - return uint64(InstructionSize * ins.OpCode.rawInstructions()) -} - -// WithMetadata sets the given Metadata on the Instruction. e.g. to copy -// Metadata from another Instruction when replacing it. -func (ins Instruction) WithMetadata(meta Metadata) Instruction { - ins.Metadata = meta - return ins -} - -type symbolMeta struct{} - -// WithSymbol marks the Instruction as a Symbol, which other Instructions -// can point to using corresponding calls to WithReference. -func (ins Instruction) WithSymbol(name string) Instruction { - ins.Metadata.Set(symbolMeta{}, name) - return ins -} - -// Sym creates a symbol. -// -// Deprecated: use WithSymbol instead. -func (ins Instruction) Sym(name string) Instruction { - return ins.WithSymbol(name) -} - -// Symbol returns the value ins has been marked with using WithSymbol, -// otherwise returns an empty string. A symbol is often an Instruction -// at the start of a function body. -func (ins Instruction) Symbol() string { - sym, _ := ins.Metadata.Get(symbolMeta{}).(string) - return sym -} - -type referenceMeta struct{} - -// WithReference makes ins reference another Symbol or map by name. -func (ins Instruction) WithReference(ref string) Instruction { - ins.Metadata.Set(referenceMeta{}, ref) - return ins -} - -// Reference returns the Symbol or map name referenced by ins, if any. -func (ins Instruction) Reference() string { - ref, _ := ins.Metadata.Get(referenceMeta{}).(string) - return ref -} - -type mapMeta struct{} - -// Map returns the Map referenced by ins, if any. -// An Instruction will contain a Map if e.g. it references an existing, -// pinned map that was opened during ELF loading. -func (ins Instruction) Map() FDer { - fd, _ := ins.Metadata.Get(mapMeta{}).(FDer) - return fd -} - -type sourceMeta struct{} - -// WithSource adds source information about the Instruction. -func (ins Instruction) WithSource(src fmt.Stringer) Instruction { - ins.Metadata.Set(sourceMeta{}, src) - return ins -} - -// Source returns source information about the Instruction. The field is -// present when the compiler emits BTF line info about the Instruction and -// usually contains the line of source code responsible for it. -func (ins Instruction) Source() fmt.Stringer { - str, _ := ins.Metadata.Get(sourceMeta{}).(fmt.Stringer) - return str -} - -// A Comment can be passed to Instruction.WithSource to add a comment -// to an instruction. -type Comment string - -func (s Comment) String() string { - return string(s) -} - -// FDer represents a resource tied to an underlying file descriptor. -// Used as a stand-in for e.g. ebpf.Map since that type cannot be -// imported here and FD() is the only method we rely on. -type FDer interface { - FD() int -} - -// Instructions is an eBPF program. -type Instructions []Instruction - -// Unmarshal unmarshals an Instructions from a binary instruction stream. -// All instructions in insns are replaced by instructions decoded from r. -func (insns *Instructions) Unmarshal(r io.Reader, bo binary.ByteOrder) error { - if len(*insns) > 0 { - *insns = nil - } - - var offset uint64 - for { - var ins Instruction - n, err := ins.Unmarshal(r, bo) - if errors.Is(err, io.EOF) { - break - } - if err != nil { - return fmt.Errorf("offset %d: %w", offset, err) - } - - *insns = append(*insns, ins) - offset += n - } - - return nil -} - -// Name returns the name of the function insns belongs to, if any. -func (insns Instructions) Name() string { - if len(insns) == 0 { - return "" - } - return insns[0].Symbol() -} - -func (insns Instructions) String() string { - return fmt.Sprint(insns) -} - -// Size returns the amount of bytes insns would occupy in binary form. -func (insns Instructions) Size() uint64 { - var sum uint64 - for _, ins := range insns { - sum += ins.Size() - } - return sum -} - -// AssociateMap updates all Instructions that Reference the given symbol -// to point to an existing Map m instead. -// -// Returns ErrUnreferencedSymbol error if no references to symbol are found -// in insns. If symbol is anything else than the symbol name of map (e.g. -// a bpf2bpf subprogram), an error is returned. -func (insns Instructions) AssociateMap(symbol string, m FDer) error { - if symbol == "" { - return errors.New("empty symbol") - } - - var found bool - for i := range insns { - ins := &insns[i] - if ins.Reference() != symbol { - continue - } - - if err := ins.AssociateMap(m); err != nil { - return err - } - - found = true - } - - if !found { - return fmt.Errorf("symbol %s: %w", symbol, ErrUnreferencedSymbol) - } - - return nil -} - -// RewriteMapPtr rewrites all loads of a specific map pointer to a new fd. -// -// Returns ErrUnreferencedSymbol if the symbol isn't used. -// -// Deprecated: use AssociateMap instead. -func (insns Instructions) RewriteMapPtr(symbol string, fd int) error { - if symbol == "" { - return errors.New("empty symbol") - } - - var found bool - for i := range insns { - ins := &insns[i] - if ins.Reference() != symbol { - continue - } - - if !ins.IsLoadFromMap() { - return errors.New("not a load from a map") - } - - ins.encodeMapFD(fd) - - found = true - } - - if !found { - return fmt.Errorf("symbol %s: %w", symbol, ErrUnreferencedSymbol) - } - - return nil -} - -// SymbolOffsets returns the set of symbols and their offset in -// the instructions. -func (insns Instructions) SymbolOffsets() (map[string]int, error) { - offsets := make(map[string]int) - - for i, ins := range insns { - if ins.Symbol() == "" { - continue - } - - if _, ok := offsets[ins.Symbol()]; ok { - return nil, fmt.Errorf("duplicate symbol %s", ins.Symbol()) - } - - offsets[ins.Symbol()] = i - } - - return offsets, nil -} - -// FunctionReferences returns a set of symbol names these Instructions make -// bpf-to-bpf calls to. -func (insns Instructions) FunctionReferences() []string { - calls := make(map[string]struct{}) - for _, ins := range insns { - if ins.Constant != -1 { - // BPF-to-BPF calls have -1 constants. - continue - } - - if ins.Reference() == "" { - continue - } - - if !ins.IsFunctionReference() { - continue - } - - calls[ins.Reference()] = struct{}{} - } - - result := make([]string, 0, len(calls)) - for call := range calls { - result = append(result, call) - } - - sort.Strings(result) - return result -} - -// ReferenceOffsets returns the set of references and their offset in -// the instructions. -func (insns Instructions) ReferenceOffsets() map[string][]int { - offsets := make(map[string][]int) - - for i, ins := range insns { - if ins.Reference() == "" { - continue - } - - offsets[ins.Reference()] = append(offsets[ins.Reference()], i) - } - - return offsets -} - -// Format implements fmt.Formatter. -// -// You can control indentation of symbols by -// specifying a width. Setting a precision controls the indentation of -// instructions. -// The default character is a tab, which can be overridden by specifying -// the ' ' space flag. -func (insns Instructions) Format(f fmt.State, c rune) { - if c != 's' && c != 'v' { - fmt.Fprintf(f, "{UNKNOWN FORMAT '%c'}", c) - return - } - - // Precision is better in this case, because it allows - // specifying 0 padding easily. - padding, ok := f.Precision() - if !ok { - padding = 1 - } - - indent := strings.Repeat("\t", padding) - if f.Flag(' ') { - indent = strings.Repeat(" ", padding) - } - - symPadding, ok := f.Width() - if !ok { - symPadding = padding - 1 - } - if symPadding < 0 { - symPadding = 0 - } - - symIndent := strings.Repeat("\t", symPadding) - if f.Flag(' ') { - symIndent = strings.Repeat(" ", symPadding) - } - - // Guess how many digits we need at most, by assuming that all instructions - // are double wide. - highestOffset := len(insns) * 2 - offsetWidth := int(math.Ceil(math.Log10(float64(highestOffset)))) - - iter := insns.Iterate() - for iter.Next() { - if iter.Ins.Symbol() != "" { - fmt.Fprintf(f, "%s%s:\n", symIndent, iter.Ins.Symbol()) - } - if src := iter.Ins.Source(); src != nil { - line := strings.TrimSpace(src.String()) - if line != "" { - fmt.Fprintf(f, "%s%*s; %s\n", indent, offsetWidth, " ", line) - } - } - fmt.Fprintf(f, "%s%*d: %v\n", indent, offsetWidth, iter.Offset, iter.Ins) - } -} - -// Marshal encodes a BPF program into the kernel format. -// -// insns may be modified if there are unresolved jumps or bpf2bpf calls. -// -// Returns ErrUnsatisfiedProgramReference if there is a Reference Instruction -// without a matching Symbol Instruction within insns. -func (insns Instructions) Marshal(w io.Writer, bo binary.ByteOrder) error { - if err := insns.encodeFunctionReferences(); err != nil { - return err - } - - if err := insns.encodeMapPointers(); err != nil { - return err - } - - for i, ins := range insns { - if _, err := ins.Marshal(w, bo); err != nil { - return fmt.Errorf("instruction %d: %w", i, err) - } - } - return nil -} - -// Tag calculates the kernel tag for a series of instructions. -// -// It mirrors bpf_prog_calc_tag in the kernel and so can be compared -// to ProgramInfo.Tag to figure out whether a loaded program matches -// certain instructions. -func (insns Instructions) Tag(bo binary.ByteOrder) (string, error) { - h := sha1.New() - for i, ins := range insns { - if ins.IsLoadFromMap() { - ins.Constant = 0 - } - _, err := ins.Marshal(h, bo) - if err != nil { - return "", fmt.Errorf("instruction %d: %w", i, err) - } - } - return hex.EncodeToString(h.Sum(nil)[:unix.BPF_TAG_SIZE]), nil -} - -// encodeFunctionReferences populates the Offset (or Constant, depending on -// the instruction type) field of instructions with a Reference field to point -// to the offset of the corresponding instruction with a matching Symbol field. -// -// Only Reference Instructions that are either jumps or BPF function references -// (calls or function pointer loads) are populated. -// -// Returns ErrUnsatisfiedProgramReference if there is a Reference Instruction -// without at least one corresponding Symbol Instruction within insns. -func (insns Instructions) encodeFunctionReferences() error { - // Index the offsets of instructions tagged as a symbol. - symbolOffsets := make(map[string]RawInstructionOffset) - iter := insns.Iterate() - for iter.Next() { - ins := iter.Ins - - if ins.Symbol() == "" { - continue - } - - if _, ok := symbolOffsets[ins.Symbol()]; ok { - return fmt.Errorf("duplicate symbol %s", ins.Symbol()) - } - - symbolOffsets[ins.Symbol()] = iter.Offset - } - - // Find all instructions tagged as references to other symbols. - // Depending on the instruction type, populate their constant or offset - // fields to point to the symbol they refer to within the insn stream. - iter = insns.Iterate() - for iter.Next() { - i := iter.Index - offset := iter.Offset - ins := iter.Ins - - if ins.Reference() == "" { - continue - } - - switch { - case ins.IsFunctionReference() && ins.Constant == -1, - ins.OpCode == Ja.opCode(Jump32Class, ImmSource) && ins.Constant == -1: - symOffset, ok := symbolOffsets[ins.Reference()] - if !ok { - return fmt.Errorf("%s at insn %d: symbol %q: %w", ins.OpCode, i, ins.Reference(), ErrUnsatisfiedProgramReference) - } - - ins.Constant = int64(symOffset - offset - 1) - - case ins.OpCode.Class().IsJump() && ins.Offset == -1: - symOffset, ok := symbolOffsets[ins.Reference()] - if !ok { - return fmt.Errorf("%s at insn %d: symbol %q: %w", ins.OpCode, i, ins.Reference(), ErrUnsatisfiedProgramReference) - } - - ins.Offset = int16(symOffset - offset - 1) - } - } - - return nil -} - -// encodeMapPointers finds all Map Instructions and encodes their FDs -// into their Constant fields. -func (insns Instructions) encodeMapPointers() error { - iter := insns.Iterate() - for iter.Next() { - ins := iter.Ins - - if !ins.IsLoadFromMap() { - continue - } - - m := ins.Map() - if m == nil { - continue - } - - fd := m.FD() - if fd < 0 { - return fmt.Errorf("map %s: %w", m, sys.ErrClosedFd) - } - - ins.encodeMapFD(m.FD()) - } - - return nil -} - -// Iterate allows iterating a BPF program while keeping track of -// various offsets. -// -// Modifying the instruction slice will lead to undefined behaviour. -func (insns Instructions) Iterate() *InstructionIterator { - return &InstructionIterator{insns: insns} -} - -// InstructionIterator iterates over a BPF program. -type InstructionIterator struct { - insns Instructions - // The instruction in question. - Ins *Instruction - // The index of the instruction in the original instruction slice. - Index int - // The offset of the instruction in raw BPF instructions. This accounts - // for double-wide instructions. - Offset RawInstructionOffset -} - -// Next returns true as long as there are any instructions remaining. -func (iter *InstructionIterator) Next() bool { - if len(iter.insns) == 0 { - return false - } - - if iter.Ins != nil { - iter.Index++ - iter.Offset += RawInstructionOffset(iter.Ins.OpCode.rawInstructions()) - } - iter.Ins = &iter.insns[0] - iter.insns = iter.insns[1:] - return true -} - -type bpfRegisters uint8 - -func newBPFRegisters(dst, src Register, bo binary.ByteOrder) (bpfRegisters, error) { - switch bo { - case binary.LittleEndian: - return bpfRegisters((src << 4) | (dst & 0xF)), nil - case binary.BigEndian: - return bpfRegisters((dst << 4) | (src & 0xF)), nil - default: - return 0, fmt.Errorf("unrecognized ByteOrder %T", bo) - } -} - -// IsUnreferencedSymbol returns true if err was caused by -// an unreferenced symbol. -// -// Deprecated: use errors.Is(err, asm.ErrUnreferencedSymbol). -func IsUnreferencedSymbol(err error) bool { - return errors.Is(err, ErrUnreferencedSymbol) -} diff --git a/vendor/github.com/cilium/ebpf/asm/jump.go b/vendor/github.com/cilium/ebpf/asm/jump.go deleted file mode 100644 index 2738d736b..000000000 --- a/vendor/github.com/cilium/ebpf/asm/jump.go +++ /dev/null @@ -1,135 +0,0 @@ -package asm - -//go:generate go run golang.org/x/tools/cmd/stringer@latest -output jump_string.go -type=JumpOp - -// JumpOp affect control flow. -// -// msb lsb -// +----+-+---+ -// |OP |s|cls| -// +----+-+---+ -type JumpOp uint8 - -const jumpMask OpCode = 0xf0 - -const ( - // InvalidJumpOp is returned by getters when invoked - // on non branch OpCodes - InvalidJumpOp JumpOp = 0xff - // Ja jumps by offset unconditionally - Ja JumpOp = 0x00 - // JEq jumps by offset if r == imm - JEq JumpOp = 0x10 - // JGT jumps by offset if r > imm - JGT JumpOp = 0x20 - // JGE jumps by offset if r >= imm - JGE JumpOp = 0x30 - // JSet jumps by offset if r & imm - JSet JumpOp = 0x40 - // JNE jumps by offset if r != imm - JNE JumpOp = 0x50 - // JSGT jumps by offset if signed r > signed imm - JSGT JumpOp = 0x60 - // JSGE jumps by offset if signed r >= signed imm - JSGE JumpOp = 0x70 - // Call builtin or user defined function from imm - Call JumpOp = 0x80 - // Exit ends execution, with value in r0 - Exit JumpOp = 0x90 - // JLT jumps by offset if r < imm - JLT JumpOp = 0xa0 - // JLE jumps by offset if r <= imm - JLE JumpOp = 0xb0 - // JSLT jumps by offset if signed r < signed imm - JSLT JumpOp = 0xc0 - // JSLE jumps by offset if signed r <= signed imm - JSLE JumpOp = 0xd0 -) - -// Return emits an exit instruction. -// -// Requires a return value in R0. -func Return() Instruction { - return Instruction{ - OpCode: OpCode(JumpClass).SetJumpOp(Exit), - } -} - -// Op returns the OpCode for a given jump source. -func (op JumpOp) Op(source Source) OpCode { - return OpCode(JumpClass).SetJumpOp(op).SetSource(source) -} - -// Imm compares 64 bit dst to 64 bit value (sign extended), and adjusts PC by offset if the condition is fulfilled. -func (op JumpOp) Imm(dst Register, value int32, label string) Instruction { - return Instruction{ - OpCode: op.opCode(JumpClass, ImmSource), - Dst: dst, - Offset: -1, - Constant: int64(value), - }.WithReference(label) -} - -// Imm32 compares 32 bit dst to 32 bit value, and adjusts PC by offset if the condition is fulfilled. -// Requires kernel 5.1. -func (op JumpOp) Imm32(dst Register, value int32, label string) Instruction { - return Instruction{ - OpCode: op.opCode(Jump32Class, ImmSource), - Dst: dst, - Offset: -1, - Constant: int64(value), - }.WithReference(label) -} - -// Reg compares 64 bit dst to 64 bit src, and adjusts PC by offset if the condition is fulfilled. -func (op JumpOp) Reg(dst, src Register, label string) Instruction { - return Instruction{ - OpCode: op.opCode(JumpClass, RegSource), - Dst: dst, - Src: src, - Offset: -1, - }.WithReference(label) -} - -// Reg32 compares 32 bit dst to 32 bit src, and adjusts PC by offset if the condition is fulfilled. -// Requires kernel 5.1. -func (op JumpOp) Reg32(dst, src Register, label string) Instruction { - return Instruction{ - OpCode: op.opCode(Jump32Class, RegSource), - Dst: dst, - Src: src, - Offset: -1, - }.WithReference(label) -} - -func (op JumpOp) opCode(class Class, source Source) OpCode { - if op == Exit || op == Call { - return InvalidOpCode - } - - return OpCode(class).SetJumpOp(op).SetSource(source) -} - -// LongJump returns a jump always instruction with a range of [-2^31, 2^31 - 1]. -func LongJump(label string) Instruction { - return Instruction{ - OpCode: Ja.opCode(Jump32Class, ImmSource), - Constant: -1, - }.WithReference(label) -} - -// Label adjusts PC to the address of the label. -func (op JumpOp) Label(label string) Instruction { - if op == Call { - return Instruction{ - OpCode: OpCode(JumpClass).SetJumpOp(Call), - Src: PseudoCall, - Constant: -1, - }.WithReference(label) - } - - return Instruction{ - OpCode: OpCode(JumpClass).SetJumpOp(op), - Offset: -1, - }.WithReference(label) -} diff --git a/vendor/github.com/cilium/ebpf/asm/jump_string.go b/vendor/github.com/cilium/ebpf/asm/jump_string.go deleted file mode 100644 index 85a4aaffa..000000000 --- a/vendor/github.com/cilium/ebpf/asm/jump_string.go +++ /dev/null @@ -1,53 +0,0 @@ -// Code generated by "stringer -output jump_string.go -type=JumpOp"; DO NOT EDIT. - -package asm - -import "strconv" - -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[InvalidJumpOp-255] - _ = x[Ja-0] - _ = x[JEq-16] - _ = x[JGT-32] - _ = x[JGE-48] - _ = x[JSet-64] - _ = x[JNE-80] - _ = x[JSGT-96] - _ = x[JSGE-112] - _ = x[Call-128] - _ = x[Exit-144] - _ = x[JLT-160] - _ = x[JLE-176] - _ = x[JSLT-192] - _ = x[JSLE-208] -} - -const _JumpOp_name = "JaJEqJGTJGEJSetJNEJSGTJSGECallExitJLTJLEJSLTJSLEInvalidJumpOp" - -var _JumpOp_map = map[JumpOp]string{ - 0: _JumpOp_name[0:2], - 16: _JumpOp_name[2:5], - 32: _JumpOp_name[5:8], - 48: _JumpOp_name[8:11], - 64: _JumpOp_name[11:15], - 80: _JumpOp_name[15:18], - 96: _JumpOp_name[18:22], - 112: _JumpOp_name[22:26], - 128: _JumpOp_name[26:30], - 144: _JumpOp_name[30:34], - 160: _JumpOp_name[34:37], - 176: _JumpOp_name[37:40], - 192: _JumpOp_name[40:44], - 208: _JumpOp_name[44:48], - 255: _JumpOp_name[48:61], -} - -func (i JumpOp) String() string { - if str, ok := _JumpOp_map[i]; ok { - return str - } - return "JumpOp(" + strconv.FormatInt(int64(i), 10) + ")" -} diff --git a/vendor/github.com/cilium/ebpf/asm/load_store.go b/vendor/github.com/cilium/ebpf/asm/load_store.go deleted file mode 100644 index cdb5c5cfa..000000000 --- a/vendor/github.com/cilium/ebpf/asm/load_store.go +++ /dev/null @@ -1,225 +0,0 @@ -package asm - -//go:generate go run golang.org/x/tools/cmd/stringer@latest -output load_store_string.go -type=Mode,Size - -// Mode for load and store operations -// -// msb lsb -// +---+--+---+ -// |MDE|sz|cls| -// +---+--+---+ -type Mode uint8 - -const modeMask OpCode = 0xe0 - -const ( - // InvalidMode is returned by getters when invoked - // on non load / store OpCodes - InvalidMode Mode = 0xff - // ImmMode - immediate value - ImmMode Mode = 0x00 - // AbsMode - immediate value + offset - AbsMode Mode = 0x20 - // IndMode - indirect (imm+src) - IndMode Mode = 0x40 - // MemMode - load from memory - MemMode Mode = 0x60 - // MemSXMode - load from memory, sign extension - MemSXMode Mode = 0x80 - // XAddMode - add atomically across processors. - XAddMode Mode = 0xc0 -) - -// Size of load and store operations -// -// msb lsb -// +---+--+---+ -// |mde|SZ|cls| -// +---+--+---+ -type Size uint8 - -const sizeMask OpCode = 0x18 - -const ( - // InvalidSize is returned by getters when invoked - // on non load / store OpCodes - InvalidSize Size = 0xff - // DWord - double word; 64 bits - DWord Size = 0x18 - // Word - word; 32 bits - Word Size = 0x00 - // Half - half-word; 16 bits - Half Size = 0x08 - // Byte - byte; 8 bits - Byte Size = 0x10 -) - -// Sizeof returns the size in bytes. -func (s Size) Sizeof() int { - switch s { - case DWord: - return 8 - case Word: - return 4 - case Half: - return 2 - case Byte: - return 1 - default: - return -1 - } -} - -// LoadMemOp returns the OpCode to load a value of given size from memory. -func LoadMemOp(size Size) OpCode { - return OpCode(LdXClass).SetMode(MemMode).SetSize(size) -} - -// LoadMemSXOp returns the OpCode to load a value of given size from memory sign extended. -func LoadMemSXOp(size Size) OpCode { - return OpCode(LdXClass).SetMode(MemSXMode).SetSize(size) -} - -// LoadMem emits `dst = *(size *)(src + offset)`. -func LoadMem(dst, src Register, offset int16, size Size) Instruction { - return Instruction{ - OpCode: LoadMemOp(size), - Dst: dst, - Src: src, - Offset: offset, - } -} - -// LoadMemSX emits `dst = *(size *)(src + offset)` but sign extends dst. -func LoadMemSX(dst, src Register, offset int16, size Size) Instruction { - if size == DWord { - return Instruction{OpCode: InvalidOpCode} - } - - return Instruction{ - OpCode: LoadMemSXOp(size), - Dst: dst, - Src: src, - Offset: offset, - } -} - -// LoadImmOp returns the OpCode to load an immediate of given size. -// -// As of kernel 4.20, only DWord size is accepted. -func LoadImmOp(size Size) OpCode { - return OpCode(LdClass).SetMode(ImmMode).SetSize(size) -} - -// LoadImm emits `dst = (size)value`. -// -// As of kernel 4.20, only DWord size is accepted. -func LoadImm(dst Register, value int64, size Size) Instruction { - return Instruction{ - OpCode: LoadImmOp(size), - Dst: dst, - Constant: value, - } -} - -// LoadMapPtr stores a pointer to a map in dst. -func LoadMapPtr(dst Register, fd int) Instruction { - if fd < 0 { - return Instruction{OpCode: InvalidOpCode} - } - - return Instruction{ - OpCode: LoadImmOp(DWord), - Dst: dst, - Src: PseudoMapFD, - Constant: int64(uint32(fd)), - } -} - -// LoadMapValue stores a pointer to the value at a certain offset of a map. -func LoadMapValue(dst Register, fd int, offset uint32) Instruction { - if fd < 0 { - return Instruction{OpCode: InvalidOpCode} - } - - fdAndOffset := (uint64(offset) << 32) | uint64(uint32(fd)) - return Instruction{ - OpCode: LoadImmOp(DWord), - Dst: dst, - Src: PseudoMapValue, - Constant: int64(fdAndOffset), - } -} - -// LoadIndOp returns the OpCode for loading a value of given size from an sk_buff. -func LoadIndOp(size Size) OpCode { - return OpCode(LdClass).SetMode(IndMode).SetSize(size) -} - -// LoadInd emits `dst = ntoh(*(size *)(((sk_buff *)R6)->data + src + offset))`. -func LoadInd(dst, src Register, offset int32, size Size) Instruction { - return Instruction{ - OpCode: LoadIndOp(size), - Dst: dst, - Src: src, - Constant: int64(offset), - } -} - -// LoadAbsOp returns the OpCode for loading a value of given size from an sk_buff. -func LoadAbsOp(size Size) OpCode { - return OpCode(LdClass).SetMode(AbsMode).SetSize(size) -} - -// LoadAbs emits `r0 = ntoh(*(size *)(((sk_buff *)R6)->data + offset))`. -func LoadAbs(offset int32, size Size) Instruction { - return Instruction{ - OpCode: LoadAbsOp(size), - Dst: R0, - Constant: int64(offset), - } -} - -// StoreMemOp returns the OpCode for storing a register of given size in memory. -func StoreMemOp(size Size) OpCode { - return OpCode(StXClass).SetMode(MemMode).SetSize(size) -} - -// StoreMem emits `*(size *)(dst + offset) = src` -func StoreMem(dst Register, offset int16, src Register, size Size) Instruction { - return Instruction{ - OpCode: StoreMemOp(size), - Dst: dst, - Src: src, - Offset: offset, - } -} - -// StoreImmOp returns the OpCode for storing an immediate of given size in memory. -func StoreImmOp(size Size) OpCode { - return OpCode(StClass).SetMode(MemMode).SetSize(size) -} - -// StoreImm emits `*(size *)(dst + offset) = value`. -func StoreImm(dst Register, offset int16, value int64, size Size) Instruction { - return Instruction{ - OpCode: StoreImmOp(size), - Dst: dst, - Offset: offset, - Constant: value, - } -} - -// StoreXAddOp returns the OpCode to atomically add a register to a value in memory. -func StoreXAddOp(size Size) OpCode { - return OpCode(StXClass).SetMode(XAddMode).SetSize(size) -} - -// StoreXAdd atomically adds src to *dst. -func StoreXAdd(dst, src Register, size Size) Instruction { - return Instruction{ - OpCode: StoreXAddOp(size), - Dst: dst, - Src: src, - } -} diff --git a/vendor/github.com/cilium/ebpf/asm/load_store_string.go b/vendor/github.com/cilium/ebpf/asm/load_store_string.go deleted file mode 100644 index c48080327..000000000 --- a/vendor/github.com/cilium/ebpf/asm/load_store_string.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by "stringer -output load_store_string.go -type=Mode,Size"; DO NOT EDIT. - -package asm - -import "strconv" - -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[InvalidMode-255] - _ = x[ImmMode-0] - _ = x[AbsMode-32] - _ = x[IndMode-64] - _ = x[MemMode-96] - _ = x[MemSXMode-128] - _ = x[XAddMode-192] -} - -const ( - _Mode_name_0 = "ImmMode" - _Mode_name_1 = "AbsMode" - _Mode_name_2 = "IndMode" - _Mode_name_3 = "MemMode" - _Mode_name_4 = "MemSXMode" - _Mode_name_5 = "XAddMode" - _Mode_name_6 = "InvalidMode" -) - -func (i Mode) String() string { - switch { - case i == 0: - return _Mode_name_0 - case i == 32: - return _Mode_name_1 - case i == 64: - return _Mode_name_2 - case i == 96: - return _Mode_name_3 - case i == 128: - return _Mode_name_4 - case i == 192: - return _Mode_name_5 - case i == 255: - return _Mode_name_6 - default: - return "Mode(" + strconv.FormatInt(int64(i), 10) + ")" - } -} -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[InvalidSize-255] - _ = x[DWord-24] - _ = x[Word-0] - _ = x[Half-8] - _ = x[Byte-16] -} - -const ( - _Size_name_0 = "Word" - _Size_name_1 = "Half" - _Size_name_2 = "Byte" - _Size_name_3 = "DWord" - _Size_name_4 = "InvalidSize" -) - -func (i Size) String() string { - switch { - case i == 0: - return _Size_name_0 - case i == 8: - return _Size_name_1 - case i == 16: - return _Size_name_2 - case i == 24: - return _Size_name_3 - case i == 255: - return _Size_name_4 - default: - return "Size(" + strconv.FormatInt(int64(i), 10) + ")" - } -} diff --git a/vendor/github.com/cilium/ebpf/asm/metadata.go b/vendor/github.com/cilium/ebpf/asm/metadata.go deleted file mode 100644 index dd368a936..000000000 --- a/vendor/github.com/cilium/ebpf/asm/metadata.go +++ /dev/null @@ -1,80 +0,0 @@ -package asm - -// Metadata contains metadata about an instruction. -type Metadata struct { - head *metaElement -} - -type metaElement struct { - next *metaElement - key, value interface{} -} - -// Find the element containing key. -// -// Returns nil if there is no such element. -func (m *Metadata) find(key interface{}) *metaElement { - for e := m.head; e != nil; e = e.next { - if e.key == key { - return e - } - } - return nil -} - -// Remove an element from the linked list. -// -// Copies as many elements of the list as necessary to remove r, but doesn't -// perform a full copy. -func (m *Metadata) remove(r *metaElement) { - current := &m.head - for e := m.head; e != nil; e = e.next { - if e == r { - // We've found the element we want to remove. - *current = e.next - - // No need to copy the tail. - return - } - - // There is another element in front of the one we want to remove. - // We have to copy it to be able to change metaElement.next. - cpy := &metaElement{key: e.key, value: e.value} - *current = cpy - current = &cpy.next - } -} - -// Set a key to a value. -// -// If value is nil, the key is removed. Avoids modifying old metadata by -// copying if necessary. -func (m *Metadata) Set(key, value interface{}) { - if e := m.find(key); e != nil { - if e.value == value { - // Key is present and the value is the same. Nothing to do. - return - } - - // Key is present with a different value. Create a copy of the list - // which doesn't have the element in it. - m.remove(e) - } - - // m.head is now a linked list that doesn't contain key. - if value == nil { - return - } - - m.head = &metaElement{key: key, value: value, next: m.head} -} - -// Get the value of a key. -// -// Returns nil if no value with the given key is present. -func (m *Metadata) Get(key interface{}) interface{} { - if e := m.find(key); e != nil { - return e.value - } - return nil -} diff --git a/vendor/github.com/cilium/ebpf/asm/opcode.go b/vendor/github.com/cilium/ebpf/asm/opcode.go deleted file mode 100644 index 1dfd0b171..000000000 --- a/vendor/github.com/cilium/ebpf/asm/opcode.go +++ /dev/null @@ -1,303 +0,0 @@ -package asm - -import ( - "fmt" - "strings" -) - -//go:generate go run golang.org/x/tools/cmd/stringer@latest -output opcode_string.go -type=Class - -// Class of operations -// -// msb lsb -// +---+--+---+ -// | ?? |CLS| -// +---+--+---+ -type Class uint8 - -const classMask OpCode = 0x07 - -const ( - // LdClass loads immediate values into registers. - // Also used for non-standard load operations from cBPF. - LdClass Class = 0x00 - // LdXClass loads memory into registers. - LdXClass Class = 0x01 - // StClass stores immediate values to memory. - StClass Class = 0x02 - // StXClass stores registers to memory. - StXClass Class = 0x03 - // ALUClass describes arithmetic operators. - ALUClass Class = 0x04 - // JumpClass describes jump operators. - JumpClass Class = 0x05 - // Jump32Class describes jump operators with 32-bit comparisons. - // Requires kernel 5.1. - Jump32Class Class = 0x06 - // ALU64Class describes arithmetic operators in 64-bit mode. - ALU64Class Class = 0x07 -) - -// IsLoad checks if this is either LdClass or LdXClass. -func (cls Class) IsLoad() bool { - return cls == LdClass || cls == LdXClass -} - -// IsStore checks if this is either StClass or StXClass. -func (cls Class) IsStore() bool { - return cls == StClass || cls == StXClass -} - -func (cls Class) isLoadOrStore() bool { - return cls.IsLoad() || cls.IsStore() -} - -// IsALU checks if this is either ALUClass or ALU64Class. -func (cls Class) IsALU() bool { - return cls == ALUClass || cls == ALU64Class -} - -// IsJump checks if this is either JumpClass or Jump32Class. -func (cls Class) IsJump() bool { - return cls == JumpClass || cls == Jump32Class -} - -func (cls Class) isJumpOrALU() bool { - return cls.IsJump() || cls.IsALU() -} - -// OpCode represents a single operation. -// It is not a 1:1 mapping to real eBPF opcodes. -// -// The encoding varies based on a 3-bit Class: -// -// 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 -// ??? | CLS -// -// For ALUClass and ALUCLass32: -// -// 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 -// OPC |S| CLS -// -// For LdClass, LdXclass, StClass and StXClass: -// -// 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 -// 0 | MDE |SIZ| CLS -// -// For JumpClass, Jump32Class: -// -// 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 -// 0 | OPC |S| CLS -type OpCode uint16 - -// InvalidOpCode is returned by setters on OpCode -const InvalidOpCode OpCode = 0xffff - -// bpfOpCode returns the actual BPF opcode. -func (op OpCode) bpfOpCode() (byte, error) { - const opCodeMask = 0xff - - if !valid(op, opCodeMask) { - return 0, fmt.Errorf("invalid opcode %x", op) - } - - return byte(op & opCodeMask), nil -} - -// rawInstructions returns the number of BPF instructions required -// to encode this opcode. -func (op OpCode) rawInstructions() int { - if op.IsDWordLoad() { - return 2 - } - return 1 -} - -func (op OpCode) IsDWordLoad() bool { - return op == LoadImmOp(DWord) -} - -// Class returns the class of operation. -func (op OpCode) Class() Class { - return Class(op & classMask) -} - -// Mode returns the mode for load and store operations. -func (op OpCode) Mode() Mode { - if !op.Class().isLoadOrStore() { - return InvalidMode - } - return Mode(op & modeMask) -} - -// Size returns the size for load and store operations. -func (op OpCode) Size() Size { - if !op.Class().isLoadOrStore() { - return InvalidSize - } - return Size(op & sizeMask) -} - -// Source returns the source for branch and ALU operations. -func (op OpCode) Source() Source { - if !op.Class().isJumpOrALU() || op.ALUOp() == Swap { - return InvalidSource - } - return Source(op & sourceMask) -} - -// ALUOp returns the ALUOp. -func (op OpCode) ALUOp() ALUOp { - if !op.Class().IsALU() { - return InvalidALUOp - } - return ALUOp(op & aluMask) -} - -// Endianness returns the Endianness for a byte swap instruction. -func (op OpCode) Endianness() Endianness { - if op.ALUOp() != Swap { - return InvalidEndian - } - return Endianness(op & endianMask) -} - -// JumpOp returns the JumpOp. -// Returns InvalidJumpOp if it doesn't encode a jump. -func (op OpCode) JumpOp() JumpOp { - if !op.Class().IsJump() { - return InvalidJumpOp - } - - jumpOp := JumpOp(op & jumpMask) - - // Some JumpOps are only supported by JumpClass, not Jump32Class. - if op.Class() == Jump32Class && (jumpOp == Exit || jumpOp == Call) { - return InvalidJumpOp - } - - return jumpOp -} - -// SetMode sets the mode on load and store operations. -// -// Returns InvalidOpCode if op is of the wrong class. -func (op OpCode) SetMode(mode Mode) OpCode { - if !op.Class().isLoadOrStore() || !valid(OpCode(mode), modeMask) { - return InvalidOpCode - } - return (op & ^modeMask) | OpCode(mode) -} - -// SetSize sets the size on load and store operations. -// -// Returns InvalidOpCode if op is of the wrong class. -func (op OpCode) SetSize(size Size) OpCode { - if !op.Class().isLoadOrStore() || !valid(OpCode(size), sizeMask) { - return InvalidOpCode - } - return (op & ^sizeMask) | OpCode(size) -} - -// SetSource sets the source on jump and ALU operations. -// -// Returns InvalidOpCode if op is of the wrong class. -func (op OpCode) SetSource(source Source) OpCode { - if !op.Class().isJumpOrALU() || !valid(OpCode(source), sourceMask) { - return InvalidOpCode - } - return (op & ^sourceMask) | OpCode(source) -} - -// SetALUOp sets the ALUOp on ALU operations. -// -// Returns InvalidOpCode if op is of the wrong class. -func (op OpCode) SetALUOp(alu ALUOp) OpCode { - if !op.Class().IsALU() || !valid(OpCode(alu), aluMask) { - return InvalidOpCode - } - return (op & ^aluMask) | OpCode(alu) -} - -// SetJumpOp sets the JumpOp on jump operations. -// -// Returns InvalidOpCode if op is of the wrong class. -func (op OpCode) SetJumpOp(jump JumpOp) OpCode { - if !op.Class().IsJump() || !valid(OpCode(jump), jumpMask) { - return InvalidOpCode - } - - newOp := (op & ^jumpMask) | OpCode(jump) - - // Check newOp is legal. - if newOp.JumpOp() == InvalidJumpOp { - return InvalidOpCode - } - - return newOp -} - -func (op OpCode) String() string { - var f strings.Builder - - switch class := op.Class(); { - case class.isLoadOrStore(): - f.WriteString(strings.TrimSuffix(class.String(), "Class")) - - mode := op.Mode() - f.WriteString(strings.TrimSuffix(mode.String(), "Mode")) - - switch op.Size() { - case DWord: - f.WriteString("DW") - case Word: - f.WriteString("W") - case Half: - f.WriteString("H") - case Byte: - f.WriteString("B") - } - - case class.IsALU(): - if op.ALUOp() == Swap && op.Class() == ALU64Class { - // B to make BSwap, uncontitional byte swap - f.WriteString("B") - } - - f.WriteString(op.ALUOp().String()) - - if op.ALUOp() == Swap { - if op.Class() == ALUClass { - // Width for Endian is controlled by Constant - f.WriteString(op.Endianness().String()) - } - } else { - f.WriteString(strings.TrimSuffix(op.Source().String(), "Source")) - - if class == ALUClass { - f.WriteString("32") - } - } - - case class.IsJump(): - f.WriteString(op.JumpOp().String()) - - if class == Jump32Class { - f.WriteString("32") - } - - if jop := op.JumpOp(); jop != Exit && jop != Call && jop != Ja { - f.WriteString(strings.TrimSuffix(op.Source().String(), "Source")) - } - - default: - fmt.Fprintf(&f, "OpCode(%#x)", uint8(op)) - } - - return f.String() -} - -// valid returns true if all bits in value are covered by mask. -func valid(value, mask OpCode) bool { - return value & ^mask == 0 -} diff --git a/vendor/github.com/cilium/ebpf/asm/opcode_string.go b/vendor/github.com/cilium/ebpf/asm/opcode_string.go deleted file mode 100644 index 58bc3e7e7..000000000 --- a/vendor/github.com/cilium/ebpf/asm/opcode_string.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by "stringer -output opcode_string.go -type=Class"; DO NOT EDIT. - -package asm - -import "strconv" - -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[LdClass-0] - _ = x[LdXClass-1] - _ = x[StClass-2] - _ = x[StXClass-3] - _ = x[ALUClass-4] - _ = x[JumpClass-5] - _ = x[Jump32Class-6] - _ = x[ALU64Class-7] -} - -const _Class_name = "LdClassLdXClassStClassStXClassALUClassJumpClassJump32ClassALU64Class" - -var _Class_index = [...]uint8{0, 7, 15, 22, 30, 38, 47, 58, 68} - -func (i Class) String() string { - if i >= Class(len(_Class_index)-1) { - return "Class(" + strconv.FormatInt(int64(i), 10) + ")" - } - return _Class_name[_Class_index[i]:_Class_index[i+1]] -} diff --git a/vendor/github.com/cilium/ebpf/asm/register.go b/vendor/github.com/cilium/ebpf/asm/register.go deleted file mode 100644 index 457a3b8a8..000000000 --- a/vendor/github.com/cilium/ebpf/asm/register.go +++ /dev/null @@ -1,51 +0,0 @@ -package asm - -import ( - "fmt" -) - -// Register is the source or destination of most operations. -type Register uint8 - -// R0 contains return values. -const R0 Register = 0 - -// Registers for function arguments. -const ( - R1 Register = R0 + 1 + iota - R2 - R3 - R4 - R5 -) - -// Callee saved registers preserved by function calls. -const ( - R6 Register = R5 + 1 + iota - R7 - R8 - R9 -) - -// Read-only frame pointer to access stack. -const ( - R10 Register = R9 + 1 - RFP = R10 -) - -// Pseudo registers used by 64bit loads and jumps -const ( - PseudoMapFD = R1 // BPF_PSEUDO_MAP_FD - PseudoMapValue = R2 // BPF_PSEUDO_MAP_VALUE - PseudoCall = R1 // BPF_PSEUDO_CALL - PseudoFunc = R4 // BPF_PSEUDO_FUNC - PseudoKfuncCall = R2 // BPF_PSEUDO_KFUNC_CALL -) - -func (r Register) String() string { - v := uint8(r) - if v == 10 { - return "rfp" - } - return fmt.Sprintf("r%d", v) -} diff --git a/vendor/github.com/cilium/ebpf/attachtype_string.go b/vendor/github.com/cilium/ebpf/attachtype_string.go deleted file mode 100644 index bece896bb..000000000 --- a/vendor/github.com/cilium/ebpf/attachtype_string.go +++ /dev/null @@ -1,79 +0,0 @@ -// Code generated by "stringer -type AttachType -trimprefix Attach"; DO NOT EDIT. - -package ebpf - -import "strconv" - -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[AttachNone-0] - _ = x[AttachCGroupInetIngress-0] - _ = x[AttachCGroupInetEgress-1] - _ = x[AttachCGroupInetSockCreate-2] - _ = x[AttachCGroupSockOps-3] - _ = x[AttachSkSKBStreamParser-4] - _ = x[AttachSkSKBStreamVerdict-5] - _ = x[AttachCGroupDevice-6] - _ = x[AttachSkMsgVerdict-7] - _ = x[AttachCGroupInet4Bind-8] - _ = x[AttachCGroupInet6Bind-9] - _ = x[AttachCGroupInet4Connect-10] - _ = x[AttachCGroupInet6Connect-11] - _ = x[AttachCGroupInet4PostBind-12] - _ = x[AttachCGroupInet6PostBind-13] - _ = x[AttachCGroupUDP4Sendmsg-14] - _ = x[AttachCGroupUDP6Sendmsg-15] - _ = x[AttachLircMode2-16] - _ = x[AttachFlowDissector-17] - _ = x[AttachCGroupSysctl-18] - _ = x[AttachCGroupUDP4Recvmsg-19] - _ = x[AttachCGroupUDP6Recvmsg-20] - _ = x[AttachCGroupGetsockopt-21] - _ = x[AttachCGroupSetsockopt-22] - _ = x[AttachTraceRawTp-23] - _ = x[AttachTraceFEntry-24] - _ = x[AttachTraceFExit-25] - _ = x[AttachModifyReturn-26] - _ = x[AttachLSMMac-27] - _ = x[AttachTraceIter-28] - _ = x[AttachCgroupInet4GetPeername-29] - _ = x[AttachCgroupInet6GetPeername-30] - _ = x[AttachCgroupInet4GetSockname-31] - _ = x[AttachCgroupInet6GetSockname-32] - _ = x[AttachXDPDevMap-33] - _ = x[AttachCgroupInetSockRelease-34] - _ = x[AttachXDPCPUMap-35] - _ = x[AttachSkLookup-36] - _ = x[AttachXDP-37] - _ = x[AttachSkSKBVerdict-38] - _ = x[AttachSkReuseportSelect-39] - _ = x[AttachSkReuseportSelectOrMigrate-40] - _ = x[AttachPerfEvent-41] - _ = x[AttachTraceKprobeMulti-42] - _ = x[AttachLSMCgroup-43] - _ = x[AttachStructOps-44] - _ = x[AttachNetfilter-45] - _ = x[AttachTCXIngress-46] - _ = x[AttachTCXEgress-47] - _ = x[AttachTraceUprobeMulti-48] - _ = x[AttachCgroupUnixConnect-49] - _ = x[AttachCgroupUnixSendmsg-50] - _ = x[AttachCgroupUnixRecvmsg-51] - _ = x[AttachCgroupUnixGetpeername-52] - _ = x[AttachCgroupUnixGetsockname-53] - _ = x[AttachNetkitPrimary-54] - _ = x[AttachNetkitPeer-55] -} - -const _AttachType_name = "NoneCGroupInetEgressCGroupInetSockCreateCGroupSockOpsSkSKBStreamParserSkSKBStreamVerdictCGroupDeviceSkMsgVerdictCGroupInet4BindCGroupInet6BindCGroupInet4ConnectCGroupInet6ConnectCGroupInet4PostBindCGroupInet6PostBindCGroupUDP4SendmsgCGroupUDP6SendmsgLircMode2FlowDissectorCGroupSysctlCGroupUDP4RecvmsgCGroupUDP6RecvmsgCGroupGetsockoptCGroupSetsockoptTraceRawTpTraceFEntryTraceFExitModifyReturnLSMMacTraceIterCgroupInet4GetPeernameCgroupInet6GetPeernameCgroupInet4GetSocknameCgroupInet6GetSocknameXDPDevMapCgroupInetSockReleaseXDPCPUMapSkLookupXDPSkSKBVerdictSkReuseportSelectSkReuseportSelectOrMigratePerfEventTraceKprobeMultiLSMCgroupStructOpsNetfilterTCXIngressTCXEgressTraceUprobeMultiCgroupUnixConnectCgroupUnixSendmsgCgroupUnixRecvmsgCgroupUnixGetpeernameCgroupUnixGetsocknameNetkitPrimaryNetkitPeer" - -var _AttachType_index = [...]uint16{0, 4, 20, 40, 53, 70, 88, 100, 112, 127, 142, 160, 178, 197, 216, 233, 250, 259, 272, 284, 301, 318, 334, 350, 360, 371, 381, 393, 399, 408, 430, 452, 474, 496, 505, 526, 535, 543, 546, 558, 575, 601, 610, 626, 635, 644, 653, 663, 672, 688, 705, 722, 739, 760, 781, 794, 804} - -func (i AttachType) String() string { - if i >= AttachType(len(_AttachType_index)-1) { - return "AttachType(" + strconv.FormatInt(int64(i), 10) + ")" - } - return _AttachType_name[_AttachType_index[i]:_AttachType_index[i+1]] -} diff --git a/vendor/github.com/cilium/ebpf/btf/btf.go b/vendor/github.com/cilium/ebpf/btf/btf.go deleted file mode 100644 index 204757dbf..000000000 --- a/vendor/github.com/cilium/ebpf/btf/btf.go +++ /dev/null @@ -1,691 +0,0 @@ -package btf - -import ( - "bufio" - "debug/elf" - "encoding/binary" - "errors" - "fmt" - "io" - "math" - "os" - "reflect" - "sync" - - "github.com/cilium/ebpf/internal" - "github.com/cilium/ebpf/internal/sys" -) - -const btfMagic = 0xeB9F - -// Errors returned by BTF functions. -var ( - ErrNotSupported = internal.ErrNotSupported - ErrNotFound = errors.New("not found") - ErrNoExtendedInfo = errors.New("no extended info") - ErrMultipleMatches = errors.New("multiple matching types") -) - -// ID represents the unique ID of a BTF object. -type ID = sys.BTFID - -// immutableTypes is a set of types which musn't be changed. -type immutableTypes struct { - // All types contained by the spec, not including types from the base in - // case the spec was parsed from split BTF. - types []Type - - // Type IDs indexed by type. - typeIDs map[Type]TypeID - - // The ID of the first type in types. - firstTypeID TypeID - - // Types indexed by essential name. - // Includes all struct flavors and types with the same name. - namedTypes map[essentialName][]TypeID - - // Byte order of the types. This affects things like struct member order - // when using bitfields. - byteOrder binary.ByteOrder -} - -func (s *immutableTypes) typeByID(id TypeID) (Type, bool) { - if id < s.firstTypeID { - return nil, false - } - - index := int(id - s.firstTypeID) - if index >= len(s.types) { - return nil, false - } - - return s.types[index], true -} - -// mutableTypes is a set of types which may be changed. -type mutableTypes struct { - imm immutableTypes - mu *sync.RWMutex // protects copies below - copies map[Type]Type // map[orig]copy - copiedTypeIDs map[Type]TypeID // map[copy]origID -} - -// add a type to the set of mutable types. -// -// Copies type and all of its children once. Repeated calls with the same type -// do not copy again. -func (mt *mutableTypes) add(typ Type, typeIDs map[Type]TypeID) Type { - mt.mu.RLock() - cpy, ok := mt.copies[typ] - mt.mu.RUnlock() - - if ok { - // Fast path: the type has been copied before. - return cpy - } - - // modifyGraphPreorder copies the type graph node by node, so we can't drop - // the lock in between. - mt.mu.Lock() - defer mt.mu.Unlock() - - return copyType(typ, typeIDs, mt.copies, mt.copiedTypeIDs) -} - -// copy a set of mutable types. -func (mt *mutableTypes) copy() mutableTypes { - mtCopy := mutableTypes{ - mt.imm, - &sync.RWMutex{}, - make(map[Type]Type, len(mt.copies)), - make(map[Type]TypeID, len(mt.copiedTypeIDs)), - } - - // Prevent concurrent modification of mt.copiedTypeIDs. - mt.mu.RLock() - defer mt.mu.RUnlock() - - copiesOfCopies := make(map[Type]Type, len(mt.copies)) - for orig, copy := range mt.copies { - // NB: We make a copy of copy, not orig, so that changes to mutable types - // are preserved. - copyOfCopy := copyType(copy, mt.copiedTypeIDs, copiesOfCopies, mtCopy.copiedTypeIDs) - mtCopy.copies[orig] = copyOfCopy - } - - return mtCopy -} - -func (mt *mutableTypes) typeID(typ Type) (TypeID, error) { - if _, ok := typ.(*Void); ok { - // Equality is weird for void, since it is a zero sized type. - return 0, nil - } - - mt.mu.RLock() - defer mt.mu.RUnlock() - - id, ok := mt.copiedTypeIDs[typ] - if !ok { - return 0, fmt.Errorf("no ID for type %s: %w", typ, ErrNotFound) - } - - return id, nil -} - -func (mt *mutableTypes) typeByID(id TypeID) (Type, bool) { - immT, ok := mt.imm.typeByID(id) - if !ok { - return nil, false - } - - return mt.add(immT, mt.imm.typeIDs), true -} - -func (mt *mutableTypes) anyTypesByName(name string) ([]Type, error) { - immTypes := mt.imm.namedTypes[newEssentialName(name)] - if len(immTypes) == 0 { - return nil, fmt.Errorf("type name %s: %w", name, ErrNotFound) - } - - // Return a copy to prevent changes to namedTypes. - result := make([]Type, 0, len(immTypes)) - for _, id := range immTypes { - immT, ok := mt.imm.typeByID(id) - if !ok { - return nil, fmt.Errorf("no type with ID %d", id) - } - - // Match against the full name, not just the essential one - // in case the type being looked up is a struct flavor. - if immT.TypeName() == name { - result = append(result, mt.add(immT, mt.imm.typeIDs)) - } - } - return result, nil -} - -// Spec allows querying a set of Types and loading the set into the -// kernel. -type Spec struct { - mutableTypes - - // String table from ELF. - strings *stringTable -} - -// LoadSpec opens file and calls LoadSpecFromReader on it. -func LoadSpec(file string) (*Spec, error) { - fh, err := os.Open(file) - if err != nil { - return nil, err - } - defer fh.Close() - - return LoadSpecFromReader(fh) -} - -// LoadSpecFromReader reads from an ELF or a raw BTF blob. -// -// Returns ErrNotFound if reading from an ELF which contains no BTF. ExtInfos -// may be nil. -func LoadSpecFromReader(rd io.ReaderAt) (*Spec, error) { - file, err := internal.NewSafeELFFile(rd) - if err != nil { - if bo := guessRawBTFByteOrder(rd); bo != nil { - return loadRawSpec(io.NewSectionReader(rd, 0, math.MaxInt64), bo, nil) - } - - return nil, err - } - - return loadSpecFromELF(file) -} - -// LoadSpecAndExtInfosFromReader reads from an ELF. -// -// ExtInfos may be nil if the ELF doesn't contain section metadata. -// Returns ErrNotFound if the ELF contains no BTF. -func LoadSpecAndExtInfosFromReader(rd io.ReaderAt) (*Spec, *ExtInfos, error) { - file, err := internal.NewSafeELFFile(rd) - if err != nil { - return nil, nil, err - } - - spec, err := loadSpecFromELF(file) - if err != nil { - return nil, nil, err - } - - extInfos, err := loadExtInfosFromELF(file, spec) - if err != nil && !errors.Is(err, ErrNotFound) { - return nil, nil, err - } - - return spec, extInfos, nil -} - -// symbolOffsets extracts all symbols offsets from an ELF and indexes them by -// section and variable name. -// -// References to variables in BTF data sections carry unsigned 32-bit offsets. -// Some ELF symbols (e.g. in vmlinux) may point to virtual memory that is well -// beyond this range. Since these symbols cannot be described by BTF info, -// ignore them here. -func symbolOffsets(file *internal.SafeELFFile) (map[symbol]uint32, error) { - symbols, err := file.Symbols() - if err != nil { - return nil, fmt.Errorf("can't read symbols: %v", err) - } - - offsets := make(map[symbol]uint32) - for _, sym := range symbols { - if idx := sym.Section; idx >= elf.SHN_LORESERVE && idx <= elf.SHN_HIRESERVE { - // Ignore things like SHN_ABS - continue - } - - if sym.Value > math.MaxUint32 { - // VarSecinfo offset is u32, cannot reference symbols in higher regions. - continue - } - - if int(sym.Section) >= len(file.Sections) { - return nil, fmt.Errorf("symbol %s: invalid section %d", sym.Name, sym.Section) - } - - secName := file.Sections[sym.Section].Name - offsets[symbol{secName, sym.Name}] = uint32(sym.Value) - } - - return offsets, nil -} - -func loadSpecFromELF(file *internal.SafeELFFile) (*Spec, error) { - var ( - btfSection *elf.Section - sectionSizes = make(map[string]uint32) - ) - - for _, sec := range file.Sections { - switch sec.Name { - case ".BTF": - btfSection = sec - default: - if sec.Type != elf.SHT_PROGBITS && sec.Type != elf.SHT_NOBITS { - break - } - - if sec.Size > math.MaxUint32 { - return nil, fmt.Errorf("section %s exceeds maximum size", sec.Name) - } - - sectionSizes[sec.Name] = uint32(sec.Size) - } - } - - if btfSection == nil { - return nil, fmt.Errorf("btf: %w", ErrNotFound) - } - - offsets, err := symbolOffsets(file) - if err != nil { - return nil, err - } - - if btfSection.ReaderAt == nil { - return nil, fmt.Errorf("compressed BTF is not supported") - } - - spec, err := loadRawSpec(btfSection.ReaderAt, file.ByteOrder, nil) - if err != nil { - return nil, err - } - - err = fixupDatasec(spec.imm.types, sectionSizes, offsets) - if err != nil { - return nil, err - } - - return spec, nil -} - -func loadRawSpec(btf io.ReaderAt, bo binary.ByteOrder, base *Spec) (*Spec, error) { - var ( - baseStrings *stringTable - firstTypeID TypeID - err error - ) - - if base != nil { - if base.imm.firstTypeID != 0 { - return nil, fmt.Errorf("can't use split BTF as base") - } - - baseStrings = base.strings - - firstTypeID, err = base.nextTypeID() - if err != nil { - return nil, err - } - } - - types, rawStrings, err := parseBTF(btf, bo, baseStrings, base) - if err != nil { - return nil, err - } - - typeIDs, typesByName := indexTypes(types, firstTypeID) - - return &Spec{ - mutableTypes{ - immutableTypes{ - types, - typeIDs, - firstTypeID, - typesByName, - bo, - }, - &sync.RWMutex{}, - make(map[Type]Type), - make(map[Type]TypeID), - }, - rawStrings, - }, nil -} - -func indexTypes(types []Type, firstTypeID TypeID) (map[Type]TypeID, map[essentialName][]TypeID) { - namedTypes := 0 - for _, typ := range types { - if typ.TypeName() != "" { - // Do a pre-pass to figure out how big types by name has to be. - // Most types have unique names, so it's OK to ignore essentialName - // here. - namedTypes++ - } - } - - typeIDs := make(map[Type]TypeID, len(types)) - typesByName := make(map[essentialName][]TypeID, namedTypes) - - for i, typ := range types { - id := firstTypeID + TypeID(i) - typeIDs[typ] = id - - if name := newEssentialName(typ.TypeName()); name != "" { - typesByName[name] = append(typesByName[name], id) - } - } - - return typeIDs, typesByName -} - -func guessRawBTFByteOrder(r io.ReaderAt) binary.ByteOrder { - buf := new(bufio.Reader) - for _, bo := range []binary.ByteOrder{ - binary.LittleEndian, - binary.BigEndian, - } { - buf.Reset(io.NewSectionReader(r, 0, math.MaxInt64)) - if _, err := parseBTFHeader(buf, bo); err == nil { - return bo - } - } - - return nil -} - -// parseBTF reads a .BTF section into memory and parses it into a list of -// raw types and a string table. -func parseBTF(btf io.ReaderAt, bo binary.ByteOrder, baseStrings *stringTable, base *Spec) ([]Type, *stringTable, error) { - buf := internal.NewBufferedSectionReader(btf, 0, math.MaxInt64) - header, err := parseBTFHeader(buf, bo) - if err != nil { - return nil, nil, fmt.Errorf("parsing .BTF header: %v", err) - } - - rawStrings, err := readStringTable(io.NewSectionReader(btf, header.stringStart(), int64(header.StringLen)), - baseStrings) - if err != nil { - return nil, nil, fmt.Errorf("can't read type names: %w", err) - } - - buf.Reset(io.NewSectionReader(btf, header.typeStart(), int64(header.TypeLen))) - types, err := readAndInflateTypes(buf, bo, header.TypeLen, rawStrings, base) - if err != nil { - return nil, nil, err - } - - return types, rawStrings, nil -} - -type symbol struct { - section string - name string -} - -// fixupDatasec attempts to patch up missing info in Datasecs and its members by -// supplementing them with information from the ELF headers and symbol table. -func fixupDatasec(types []Type, sectionSizes map[string]uint32, offsets map[symbol]uint32) error { - for _, typ := range types { - ds, ok := typ.(*Datasec) - if !ok { - continue - } - - name := ds.Name - - // Some Datasecs are virtual and don't have corresponding ELF sections. - switch name { - case ".ksyms": - // .ksyms describes forward declarations of kfunc signatures. - // Nothing to fix up, all sizes and offsets are 0. - for _, vsi := range ds.Vars { - _, ok := vsi.Type.(*Func) - if !ok { - // Only Funcs are supported in the .ksyms Datasec. - return fmt.Errorf("data section %s: expected *btf.Func, not %T: %w", name, vsi.Type, ErrNotSupported) - } - } - - continue - case ".kconfig": - // .kconfig has a size of 0 and has all members' offsets set to 0. - // Fix up all offsets and set the Datasec's size. - if err := fixupDatasecLayout(ds); err != nil { - return err - } - - // Fix up extern to global linkage to avoid a BTF verifier error. - for _, vsi := range ds.Vars { - vsi.Type.(*Var).Linkage = GlobalVar - } - - continue - } - - if ds.Size != 0 { - continue - } - - ds.Size, ok = sectionSizes[name] - if !ok { - return fmt.Errorf("data section %s: missing size", name) - } - - for i := range ds.Vars { - symName := ds.Vars[i].Type.TypeName() - ds.Vars[i].Offset, ok = offsets[symbol{name, symName}] - if !ok { - return fmt.Errorf("data section %s: missing offset for symbol %s", name, symName) - } - } - } - - return nil -} - -// fixupDatasecLayout populates ds.Vars[].Offset according to var sizes and -// alignment. Calculate and set ds.Size. -func fixupDatasecLayout(ds *Datasec) error { - var off uint32 - - for i, vsi := range ds.Vars { - v, ok := vsi.Type.(*Var) - if !ok { - return fmt.Errorf("member %d: unsupported type %T", i, vsi.Type) - } - - size, err := Sizeof(v.Type) - if err != nil { - return fmt.Errorf("variable %s: getting size: %w", v.Name, err) - } - align, err := alignof(v.Type) - if err != nil { - return fmt.Errorf("variable %s: getting alignment: %w", v.Name, err) - } - - // Align the current member based on the offset of the end of the previous - // member and the alignment of the current member. - off = internal.Align(off, uint32(align)) - - ds.Vars[i].Offset = off - - off += uint32(size) - } - - ds.Size = off - - return nil -} - -// Copy creates a copy of Spec. -func (s *Spec) Copy() *Spec { - return &Spec{ - s.mutableTypes.copy(), - s.strings, - } -} - -type sliceWriter []byte - -func (sw sliceWriter) Write(p []byte) (int, error) { - if len(p) != len(sw) { - return 0, errors.New("size doesn't match") - } - - return copy(sw, p), nil -} - -// nextTypeID returns the next unallocated type ID or an error if there are no -// more type IDs. -func (s *Spec) nextTypeID() (TypeID, error) { - id := s.imm.firstTypeID + TypeID(len(s.imm.types)) - if id < s.imm.firstTypeID { - return 0, fmt.Errorf("no more type IDs") - } - return id, nil -} - -// TypeByID returns the BTF Type with the given type ID. -// -// Returns an error wrapping ErrNotFound if a Type with the given ID -// does not exist in the Spec. -func (s *Spec) TypeByID(id TypeID) (Type, error) { - typ, ok := s.typeByID(id) - if !ok { - return nil, fmt.Errorf("look up type with ID %d (first ID is %d): %w", id, s.imm.firstTypeID, ErrNotFound) - } - - return typ, nil -} - -// TypeID returns the ID for a given Type. -// -// Returns an error wrapping [ErrNotFound] if the type isn't part of the Spec. -func (s *Spec) TypeID(typ Type) (TypeID, error) { - return s.mutableTypes.typeID(typ) -} - -// AnyTypesByName returns a list of BTF Types with the given name. -// -// If the BTF blob describes multiple compilation units like vmlinux, multiple -// Types with the same name and kind can exist, but might not describe the same -// data structure. -// -// Returns an error wrapping ErrNotFound if no matching Type exists in the Spec. -func (s *Spec) AnyTypesByName(name string) ([]Type, error) { - return s.mutableTypes.anyTypesByName(name) -} - -// AnyTypeByName returns a Type with the given name. -// -// Returns an error if multiple types of that name exist. -func (s *Spec) AnyTypeByName(name string) (Type, error) { - types, err := s.AnyTypesByName(name) - if err != nil { - return nil, err - } - - if len(types) > 1 { - return nil, fmt.Errorf("found multiple types: %v", types) - } - - return types[0], nil -} - -// TypeByName searches for a Type with a specific name. Since multiple Types -// with the same name can exist, the parameter typ is taken to narrow down the -// search in case of a clash. -// -// typ must be a non-nil pointer to an implementation of a Type. On success, the -// address of the found Type will be copied to typ. -// -// Returns an error wrapping ErrNotFound if no matching Type exists in the Spec. -// Returns an error wrapping ErrMultipleTypes if multiple candidates are found. -func (s *Spec) TypeByName(name string, typ interface{}) error { - typeInterface := reflect.TypeOf((*Type)(nil)).Elem() - - // typ may be **T or *Type - typValue := reflect.ValueOf(typ) - if typValue.Kind() != reflect.Ptr { - return fmt.Errorf("%T is not a pointer", typ) - } - - typPtr := typValue.Elem() - if !typPtr.CanSet() { - return fmt.Errorf("%T cannot be set", typ) - } - - wanted := typPtr.Type() - if wanted == typeInterface { - // This is *Type. Unwrap the value's type. - wanted = typPtr.Elem().Type() - } - - if !wanted.AssignableTo(typeInterface) { - return fmt.Errorf("%T does not satisfy Type interface", typ) - } - - types, err := s.AnyTypesByName(name) - if err != nil { - return err - } - - var candidate Type - for _, typ := range types { - if reflect.TypeOf(typ) != wanted { - continue - } - - if candidate != nil { - return fmt.Errorf("type %s(%T): %w", name, typ, ErrMultipleMatches) - } - - candidate = typ - } - - if candidate == nil { - return fmt.Errorf("%s %s: %w", wanted, name, ErrNotFound) - } - - typPtr.Set(reflect.ValueOf(candidate)) - - return nil -} - -// LoadSplitSpecFromReader loads split BTF from a reader. -// -// Types from base are used to resolve references in the split BTF. -// The returned Spec only contains types from the split BTF, not from the base. -func LoadSplitSpecFromReader(r io.ReaderAt, base *Spec) (*Spec, error) { - return loadRawSpec(r, internal.NativeEndian, base) -} - -// TypesIterator iterates over types of a given spec. -type TypesIterator struct { - spec *Spec - id TypeID - done bool - // The last visited type in the spec. - Type Type -} - -// Iterate returns the types iterator. -func (s *Spec) Iterate() *TypesIterator { - return &TypesIterator{spec: s, id: s.imm.firstTypeID} -} - -// Next returns true as long as there are any remaining types. -func (iter *TypesIterator) Next() bool { - if iter.done { - return false - } - - var ok bool - iter.Type, ok = iter.spec.typeByID(iter.id) - iter.id++ - iter.done = !ok - return !iter.done -} diff --git a/vendor/github.com/cilium/ebpf/btf/btf_types.go b/vendor/github.com/cilium/ebpf/btf/btf_types.go deleted file mode 100644 index f0e327abc..000000000 --- a/vendor/github.com/cilium/ebpf/btf/btf_types.go +++ /dev/null @@ -1,519 +0,0 @@ -package btf - -import ( - "encoding/binary" - "errors" - "fmt" - "io" - "unsafe" - - "github.com/cilium/ebpf/internal" -) - -//go:generate go run golang.org/x/tools/cmd/stringer@latest -linecomment -output=btf_types_string.go -type=FuncLinkage,VarLinkage,btfKind - -// btfKind describes a Type. -type btfKind uint8 - -// Equivalents of the BTF_KIND_* constants. -const ( - kindUnknown btfKind = iota // Unknown - kindInt // Int - kindPointer // Pointer - kindArray // Array - kindStruct // Struct - kindUnion // Union - kindEnum // Enum - kindForward // Forward - kindTypedef // Typedef - kindVolatile // Volatile - kindConst // Const - kindRestrict // Restrict - // Added ~4.20 - kindFunc // Func - kindFuncProto // FuncProto - // Added ~5.1 - kindVar // Var - kindDatasec // Datasec - // Added ~5.13 - kindFloat // Float - // Added 5.16 - kindDeclTag // DeclTag - kindTypeTag // TypeTag - // Added 6.0 - kindEnum64 // Enum64 -) - -// FuncLinkage describes BTF function linkage metadata. -type FuncLinkage int - -// Equivalent of enum btf_func_linkage. -const ( - StaticFunc FuncLinkage = iota // static - GlobalFunc // global - ExternFunc // extern -) - -// VarLinkage describes BTF variable linkage metadata. -type VarLinkage int - -const ( - StaticVar VarLinkage = iota // static - GlobalVar // global - ExternVar // extern -) - -const ( - btfTypeKindShift = 24 - btfTypeKindLen = 5 - btfTypeVlenShift = 0 - btfTypeVlenMask = 16 - btfTypeKindFlagShift = 31 - btfTypeKindFlagMask = 1 -) - -var btfHeaderLen = binary.Size(&btfHeader{}) - -type btfHeader struct { - Magic uint16 - Version uint8 - Flags uint8 - HdrLen uint32 - - TypeOff uint32 - TypeLen uint32 - StringOff uint32 - StringLen uint32 -} - -// typeStart returns the offset from the beginning of the .BTF section -// to the start of its type entries. -func (h *btfHeader) typeStart() int64 { - return int64(h.HdrLen + h.TypeOff) -} - -// stringStart returns the offset from the beginning of the .BTF section -// to the start of its string table. -func (h *btfHeader) stringStart() int64 { - return int64(h.HdrLen + h.StringOff) -} - -// parseBTFHeader parses the header of the .BTF section. -func parseBTFHeader(r io.Reader, bo binary.ByteOrder) (*btfHeader, error) { - var header btfHeader - if err := binary.Read(r, bo, &header); err != nil { - return nil, fmt.Errorf("can't read header: %v", err) - } - - if header.Magic != btfMagic { - return nil, fmt.Errorf("incorrect magic value %v", header.Magic) - } - - if header.Version != 1 { - return nil, fmt.Errorf("unexpected version %v", header.Version) - } - - if header.Flags != 0 { - return nil, fmt.Errorf("unsupported flags %v", header.Flags) - } - - remainder := int64(header.HdrLen) - int64(binary.Size(&header)) - if remainder < 0 { - return nil, errors.New("header length shorter than btfHeader size") - } - - if _, err := io.CopyN(internal.DiscardZeroes{}, r, remainder); err != nil { - return nil, fmt.Errorf("header padding: %v", err) - } - - return &header, nil -} - -var btfTypeLen = binary.Size(btfType{}) - -// btfType is equivalent to struct btf_type in Documentation/bpf/btf.rst. -type btfType struct { - NameOff uint32 - /* "info" bits arrangement - * bits 0-15: vlen (e.g. # of struct's members), linkage - * bits 16-23: unused - * bits 24-28: kind (e.g. int, ptr, array...etc) - * bits 29-30: unused - * bit 31: kind_flag, currently used by - * struct, union and fwd - */ - Info uint32 - /* "size" is used by INT, ENUM, STRUCT and UNION. - * "size" tells the size of the type it is describing. - * - * "type" is used by PTR, TYPEDEF, VOLATILE, CONST, RESTRICT, - * FUNC and FUNC_PROTO. - * "type" is a type_id referring to another type. - */ - SizeType uint32 -} - -var btfTypeSize = int(unsafe.Sizeof(btfType{})) - -func unmarshalBtfType(bt *btfType, b []byte, bo binary.ByteOrder) (int, error) { - if len(b) < btfTypeSize { - return 0, fmt.Errorf("not enough bytes to unmarshal btfType") - } - - bt.NameOff = bo.Uint32(b[0:]) - bt.Info = bo.Uint32(b[4:]) - bt.SizeType = bo.Uint32(b[8:]) - return btfTypeSize, nil -} - -func mask(len uint32) uint32 { - return (1 << len) - 1 -} - -func readBits(value, len, shift uint32) uint32 { - return (value >> shift) & mask(len) -} - -func writeBits(value, len, shift, new uint32) uint32 { - value &^= mask(len) << shift - value |= (new & mask(len)) << shift - return value -} - -func (bt *btfType) info(len, shift uint32) uint32 { - return readBits(bt.Info, len, shift) -} - -func (bt *btfType) setInfo(value, len, shift uint32) { - bt.Info = writeBits(bt.Info, len, shift, value) -} - -func (bt *btfType) Kind() btfKind { - return btfKind(bt.info(btfTypeKindLen, btfTypeKindShift)) -} - -func (bt *btfType) SetKind(kind btfKind) { - bt.setInfo(uint32(kind), btfTypeKindLen, btfTypeKindShift) -} - -func (bt *btfType) Vlen() int { - return int(bt.info(btfTypeVlenMask, btfTypeVlenShift)) -} - -func (bt *btfType) SetVlen(vlen int) { - bt.setInfo(uint32(vlen), btfTypeVlenMask, btfTypeVlenShift) -} - -func (bt *btfType) kindFlagBool() bool { - return bt.info(btfTypeKindFlagMask, btfTypeKindFlagShift) == 1 -} - -func (bt *btfType) setKindFlagBool(set bool) { - var value uint32 - if set { - value = 1 - } - bt.setInfo(value, btfTypeKindFlagMask, btfTypeKindFlagShift) -} - -// Bitfield returns true if the struct or union contain a bitfield. -func (bt *btfType) Bitfield() bool { - return bt.kindFlagBool() -} - -func (bt *btfType) SetBitfield(isBitfield bool) { - bt.setKindFlagBool(isBitfield) -} - -func (bt *btfType) FwdKind() FwdKind { - return FwdKind(bt.info(btfTypeKindFlagMask, btfTypeKindFlagShift)) -} - -func (bt *btfType) SetFwdKind(kind FwdKind) { - bt.setInfo(uint32(kind), btfTypeKindFlagMask, btfTypeKindFlagShift) -} - -func (bt *btfType) Signed() bool { - return bt.kindFlagBool() -} - -func (bt *btfType) SetSigned(signed bool) { - bt.setKindFlagBool(signed) -} - -func (bt *btfType) Linkage() FuncLinkage { - return FuncLinkage(bt.info(btfTypeVlenMask, btfTypeVlenShift)) -} - -func (bt *btfType) SetLinkage(linkage FuncLinkage) { - bt.setInfo(uint32(linkage), btfTypeVlenMask, btfTypeVlenShift) -} - -func (bt *btfType) Type() TypeID { - // TODO: Panic here if wrong kind? - return TypeID(bt.SizeType) -} - -func (bt *btfType) SetType(id TypeID) { - bt.SizeType = uint32(id) -} - -func (bt *btfType) Size() uint32 { - // TODO: Panic here if wrong kind? - return bt.SizeType -} - -func (bt *btfType) SetSize(size uint32) { - bt.SizeType = size -} - -func (bt *btfType) Marshal(w io.Writer, bo binary.ByteOrder) error { - buf := make([]byte, unsafe.Sizeof(*bt)) - bo.PutUint32(buf[0:], bt.NameOff) - bo.PutUint32(buf[4:], bt.Info) - bo.PutUint32(buf[8:], bt.SizeType) - _, err := w.Write(buf) - return err -} - -type rawType struct { - btfType - data interface{} -} - -func (rt *rawType) Marshal(w io.Writer, bo binary.ByteOrder) error { - if err := rt.btfType.Marshal(w, bo); err != nil { - return err - } - - if rt.data == nil { - return nil - } - - return binary.Write(w, bo, rt.data) -} - -// btfInt encodes additional data for integers. -// -// ? ? ? ? e e e e o o o o o o o o ? ? ? ? ? ? ? ? b b b b b b b b -// ? = undefined -// e = encoding -// o = offset (bitfields?) -// b = bits (bitfields) -type btfInt struct { - Raw uint32 -} - -const ( - btfIntEncodingLen = 4 - btfIntEncodingShift = 24 - btfIntOffsetLen = 8 - btfIntOffsetShift = 16 - btfIntBitsLen = 8 - btfIntBitsShift = 0 -) - -var btfIntLen = int(unsafe.Sizeof(btfInt{})) - -func unmarshalBtfInt(bi *btfInt, b []byte, bo binary.ByteOrder) (int, error) { - if len(b) < btfIntLen { - return 0, fmt.Errorf("not enough bytes to unmarshal btfInt") - } - - bi.Raw = bo.Uint32(b[0:]) - return btfIntLen, nil -} - -func (bi btfInt) Encoding() IntEncoding { - return IntEncoding(readBits(bi.Raw, btfIntEncodingLen, btfIntEncodingShift)) -} - -func (bi *btfInt) SetEncoding(e IntEncoding) { - bi.Raw = writeBits(uint32(bi.Raw), btfIntEncodingLen, btfIntEncodingShift, uint32(e)) -} - -func (bi btfInt) Offset() Bits { - return Bits(readBits(bi.Raw, btfIntOffsetLen, btfIntOffsetShift)) -} - -func (bi *btfInt) SetOffset(offset uint32) { - bi.Raw = writeBits(bi.Raw, btfIntOffsetLen, btfIntOffsetShift, offset) -} - -func (bi btfInt) Bits() Bits { - return Bits(readBits(bi.Raw, btfIntBitsLen, btfIntBitsShift)) -} - -func (bi *btfInt) SetBits(bits byte) { - bi.Raw = writeBits(bi.Raw, btfIntBitsLen, btfIntBitsShift, uint32(bits)) -} - -type btfArray struct { - Type TypeID - IndexType TypeID - Nelems uint32 -} - -var btfArrayLen = int(unsafe.Sizeof(btfArray{})) - -func unmarshalBtfArray(ba *btfArray, b []byte, bo binary.ByteOrder) (int, error) { - if len(b) < btfArrayLen { - return 0, fmt.Errorf("not enough bytes to unmarshal btfArray") - } - - ba.Type = TypeID(bo.Uint32(b[0:])) - ba.IndexType = TypeID(bo.Uint32(b[4:])) - ba.Nelems = bo.Uint32(b[8:]) - return btfArrayLen, nil -} - -type btfMember struct { - NameOff uint32 - Type TypeID - Offset uint32 -} - -var btfMemberLen = int(unsafe.Sizeof(btfMember{})) - -func unmarshalBtfMembers(members []btfMember, b []byte, bo binary.ByteOrder) (int, error) { - off := 0 - for i := range members { - if off+btfMemberLen > len(b) { - return 0, fmt.Errorf("not enough bytes to unmarshal btfMember %d", i) - } - - members[i].NameOff = bo.Uint32(b[off+0:]) - members[i].Type = TypeID(bo.Uint32(b[off+4:])) - members[i].Offset = bo.Uint32(b[off+8:]) - - off += btfMemberLen - } - - return off, nil -} - -type btfVarSecinfo struct { - Type TypeID - Offset uint32 - Size uint32 -} - -var btfVarSecinfoLen = int(unsafe.Sizeof(btfVarSecinfo{})) - -func unmarshalBtfVarSecInfos(secinfos []btfVarSecinfo, b []byte, bo binary.ByteOrder) (int, error) { - off := 0 - for i := range secinfos { - if off+btfVarSecinfoLen > len(b) { - return 0, fmt.Errorf("not enough bytes to unmarshal btfVarSecinfo %d", i) - } - - secinfos[i].Type = TypeID(bo.Uint32(b[off+0:])) - secinfos[i].Offset = bo.Uint32(b[off+4:]) - secinfos[i].Size = bo.Uint32(b[off+8:]) - - off += btfVarSecinfoLen - } - - return off, nil -} - -type btfVariable struct { - Linkage uint32 -} - -var btfVariableLen = int(unsafe.Sizeof(btfVariable{})) - -func unmarshalBtfVariable(bv *btfVariable, b []byte, bo binary.ByteOrder) (int, error) { - if len(b) < btfVariableLen { - return 0, fmt.Errorf("not enough bytes to unmarshal btfVariable") - } - - bv.Linkage = bo.Uint32(b[0:]) - return btfVariableLen, nil -} - -type btfEnum struct { - NameOff uint32 - Val uint32 -} - -var btfEnumLen = int(unsafe.Sizeof(btfEnum{})) - -func unmarshalBtfEnums(enums []btfEnum, b []byte, bo binary.ByteOrder) (int, error) { - off := 0 - for i := range enums { - if off+btfEnumLen > len(b) { - return 0, fmt.Errorf("not enough bytes to unmarshal btfEnum %d", i) - } - - enums[i].NameOff = bo.Uint32(b[off+0:]) - enums[i].Val = bo.Uint32(b[off+4:]) - - off += btfEnumLen - } - - return off, nil -} - -type btfEnum64 struct { - NameOff uint32 - ValLo32 uint32 - ValHi32 uint32 -} - -var btfEnum64Len = int(unsafe.Sizeof(btfEnum64{})) - -func unmarshalBtfEnums64(enums []btfEnum64, b []byte, bo binary.ByteOrder) (int, error) { - off := 0 - for i := range enums { - if off+btfEnum64Len > len(b) { - return 0, fmt.Errorf("not enough bytes to unmarshal btfEnum64 %d", i) - } - - enums[i].NameOff = bo.Uint32(b[off+0:]) - enums[i].ValLo32 = bo.Uint32(b[off+4:]) - enums[i].ValHi32 = bo.Uint32(b[off+8:]) - - off += btfEnum64Len - } - - return off, nil -} - -type btfParam struct { - NameOff uint32 - Type TypeID -} - -var btfParamLen = int(unsafe.Sizeof(btfParam{})) - -func unmarshalBtfParams(params []btfParam, b []byte, bo binary.ByteOrder) (int, error) { - off := 0 - for i := range params { - if off+btfParamLen > len(b) { - return 0, fmt.Errorf("not enough bytes to unmarshal btfParam %d", i) - } - - params[i].NameOff = bo.Uint32(b[off+0:]) - params[i].Type = TypeID(bo.Uint32(b[off+4:])) - - off += btfParamLen - } - - return off, nil -} - -type btfDeclTag struct { - ComponentIdx uint32 -} - -var btfDeclTagLen = int(unsafe.Sizeof(btfDeclTag{})) - -func unmarshalBtfDeclTag(bdt *btfDeclTag, b []byte, bo binary.ByteOrder) (int, error) { - if len(b) < btfDeclTagLen { - return 0, fmt.Errorf("not enough bytes to unmarshal btfDeclTag") - } - - bdt.ComponentIdx = bo.Uint32(b[0:]) - return btfDeclTagLen, nil -} diff --git a/vendor/github.com/cilium/ebpf/btf/btf_types_string.go b/vendor/github.com/cilium/ebpf/btf/btf_types_string.go deleted file mode 100644 index b7a1b80d1..000000000 --- a/vendor/github.com/cilium/ebpf/btf/btf_types_string.go +++ /dev/null @@ -1,80 +0,0 @@ -// Code generated by "stringer -linecomment -output=btf_types_string.go -type=FuncLinkage,VarLinkage,btfKind"; DO NOT EDIT. - -package btf - -import "strconv" - -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[StaticFunc-0] - _ = x[GlobalFunc-1] - _ = x[ExternFunc-2] -} - -const _FuncLinkage_name = "staticglobalextern" - -var _FuncLinkage_index = [...]uint8{0, 6, 12, 18} - -func (i FuncLinkage) String() string { - if i < 0 || i >= FuncLinkage(len(_FuncLinkage_index)-1) { - return "FuncLinkage(" + strconv.FormatInt(int64(i), 10) + ")" - } - return _FuncLinkage_name[_FuncLinkage_index[i]:_FuncLinkage_index[i+1]] -} -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[StaticVar-0] - _ = x[GlobalVar-1] - _ = x[ExternVar-2] -} - -const _VarLinkage_name = "staticglobalextern" - -var _VarLinkage_index = [...]uint8{0, 6, 12, 18} - -func (i VarLinkage) String() string { - if i < 0 || i >= VarLinkage(len(_VarLinkage_index)-1) { - return "VarLinkage(" + strconv.FormatInt(int64(i), 10) + ")" - } - return _VarLinkage_name[_VarLinkage_index[i]:_VarLinkage_index[i+1]] -} -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[kindUnknown-0] - _ = x[kindInt-1] - _ = x[kindPointer-2] - _ = x[kindArray-3] - _ = x[kindStruct-4] - _ = x[kindUnion-5] - _ = x[kindEnum-6] - _ = x[kindForward-7] - _ = x[kindTypedef-8] - _ = x[kindVolatile-9] - _ = x[kindConst-10] - _ = x[kindRestrict-11] - _ = x[kindFunc-12] - _ = x[kindFuncProto-13] - _ = x[kindVar-14] - _ = x[kindDatasec-15] - _ = x[kindFloat-16] - _ = x[kindDeclTag-17] - _ = x[kindTypeTag-18] - _ = x[kindEnum64-19] -} - -const _btfKind_name = "UnknownIntPointerArrayStructUnionEnumForwardTypedefVolatileConstRestrictFuncFuncProtoVarDatasecFloatDeclTagTypeTagEnum64" - -var _btfKind_index = [...]uint8{0, 7, 10, 17, 22, 28, 33, 37, 44, 51, 59, 64, 72, 76, 85, 88, 95, 100, 107, 114, 120} - -func (i btfKind) String() string { - if i >= btfKind(len(_btfKind_index)-1) { - return "btfKind(" + strconv.FormatInt(int64(i), 10) + ")" - } - return _btfKind_name[_btfKind_index[i]:_btfKind_index[i+1]] -} diff --git a/vendor/github.com/cilium/ebpf/btf/core.go b/vendor/github.com/cilium/ebpf/btf/core.go deleted file mode 100644 index ee89f9833..000000000 --- a/vendor/github.com/cilium/ebpf/btf/core.go +++ /dev/null @@ -1,1261 +0,0 @@ -package btf - -import ( - "encoding/binary" - "errors" - "fmt" - "math" - "reflect" - "slices" - "strconv" - "strings" - - "github.com/cilium/ebpf/asm" -) - -// Code in this file is derived from libbpf, which is available under a BSD -// 2-Clause license. - -// A constant used when CO-RE relocation has to remove instructions. -// -// Taken from libbpf. -const COREBadRelocationSentinel = 0xbad2310 - -// COREFixup is the result of computing a CO-RE relocation for a target. -type COREFixup struct { - kind coreKind - local uint64 - target uint64 - // True if there is no valid fixup. The instruction is replaced with an - // invalid dummy. - poison bool - // True if the validation of the local value should be skipped. Used by - // some kinds of bitfield relocations. - skipLocalValidation bool -} - -func (f *COREFixup) equal(other COREFixup) bool { - return f.local == other.local && f.target == other.target -} - -func (f *COREFixup) String() string { - if f.poison { - return fmt.Sprintf("%s=poison", f.kind) - } - return fmt.Sprintf("%s=%d->%d", f.kind, f.local, f.target) -} - -func (f *COREFixup) Apply(ins *asm.Instruction) error { - if f.poison { - // Relocation is poisoned, replace the instruction with an invalid one. - if ins.OpCode.IsDWordLoad() { - // Replace a dword load with a invalid dword load to preserve instruction size. - *ins = asm.LoadImm(asm.R10, COREBadRelocationSentinel, asm.DWord) - } else { - // Replace all single size instruction with a invalid call instruction. - *ins = asm.BuiltinFunc(COREBadRelocationSentinel).Call() - } - - // Add context to the kernel verifier output. - if source := ins.Source(); source != nil { - *ins = ins.WithSource(asm.Comment(fmt.Sprintf("instruction poisoned by CO-RE: %s", source))) - } else { - *ins = ins.WithSource(asm.Comment("instruction poisoned by CO-RE")) - } - - return nil - } - - switch class := ins.OpCode.Class(); class { - case asm.LdXClass, asm.StClass, asm.StXClass: - if want := int16(f.local); !f.skipLocalValidation && want != ins.Offset { - return fmt.Errorf("invalid offset %d, expected %d", ins.Offset, f.local) - } - - if f.target > math.MaxInt16 { - return fmt.Errorf("offset %d exceeds MaxInt16", f.target) - } - - ins.Offset = int16(f.target) - - case asm.LdClass: - if !ins.IsConstantLoad(asm.DWord) { - return fmt.Errorf("not a dword-sized immediate load") - } - - if want := int64(f.local); !f.skipLocalValidation && want != ins.Constant { - return fmt.Errorf("invalid immediate %d, expected %d (fixup: %v)", ins.Constant, want, f) - } - - ins.Constant = int64(f.target) - - case asm.ALUClass: - if ins.OpCode.ALUOp() == asm.Swap { - return fmt.Errorf("relocation against swap") - } - - fallthrough - - case asm.ALU64Class: - if src := ins.OpCode.Source(); src != asm.ImmSource { - return fmt.Errorf("invalid source %s", src) - } - - if want := int64(f.local); !f.skipLocalValidation && want != ins.Constant { - return fmt.Errorf("invalid immediate %d, expected %d (fixup: %v, kind: %v, ins: %v)", ins.Constant, want, f, f.kind, ins) - } - - if f.target > math.MaxInt32 { - return fmt.Errorf("immediate %d exceeds MaxInt32", f.target) - } - - ins.Constant = int64(f.target) - - default: - return fmt.Errorf("invalid class %s", class) - } - - return nil -} - -func (f COREFixup) isNonExistant() bool { - return f.kind.checksForExistence() && f.target == 0 -} - -// coreKind is the type of CO-RE relocation as specified in BPF source code. -type coreKind uint32 - -const ( - reloFieldByteOffset coreKind = iota /* field byte offset */ - reloFieldByteSize /* field size in bytes */ - reloFieldExists /* field existence in target kernel */ - reloFieldSigned /* field signedness (0 - unsigned, 1 - signed) */ - reloFieldLShiftU64 /* bitfield-specific left bitshift */ - reloFieldRShiftU64 /* bitfield-specific right bitshift */ - reloTypeIDLocal /* type ID in local BPF object */ - reloTypeIDTarget /* type ID in target kernel */ - reloTypeExists /* type existence in target kernel */ - reloTypeSize /* type size in bytes */ - reloEnumvalExists /* enum value existence in target kernel */ - reloEnumvalValue /* enum value integer value */ - reloTypeMatches /* type matches kernel type */ -) - -func (k coreKind) checksForExistence() bool { - return k == reloEnumvalExists || k == reloTypeExists || k == reloFieldExists || k == reloTypeMatches -} - -func (k coreKind) String() string { - switch k { - case reloFieldByteOffset: - return "byte_off" - case reloFieldByteSize: - return "byte_sz" - case reloFieldExists: - return "field_exists" - case reloFieldSigned: - return "signed" - case reloFieldLShiftU64: - return "lshift_u64" - case reloFieldRShiftU64: - return "rshift_u64" - case reloTypeIDLocal: - return "local_type_id" - case reloTypeIDTarget: - return "target_type_id" - case reloTypeExists: - return "type_exists" - case reloTypeSize: - return "type_size" - case reloEnumvalExists: - return "enumval_exists" - case reloEnumvalValue: - return "enumval_value" - case reloTypeMatches: - return "type_matches" - default: - return fmt.Sprintf("unknown (%d)", k) - } -} - -// CORERelocate calculates changes needed to adjust eBPF instructions for differences -// in types. -// -// targets forms the set of types to relocate against. The first element has to be -// BTF for vmlinux, the following must be types for kernel modules. -// -// resolveLocalTypeID is called for each local type which requires a stable TypeID. -// Calling the function with the same type multiple times must produce the same -// result. It is the callers responsibility to ensure that the relocated instructions -// are loaded with matching BTF. -// -// Returns a list of fixups which can be applied to instructions to make them -// match the target type(s). -// -// Fixups are returned in the order of relos, e.g. fixup[i] is the solution -// for relos[i]. -func CORERelocate(relos []*CORERelocation, targets []*Spec, bo binary.ByteOrder, resolveLocalTypeID func(Type) (TypeID, error)) ([]COREFixup, error) { - if len(targets) == 0 { - // Explicitly check for nil here since the argument used to be optional. - return nil, fmt.Errorf("targets must be provided") - } - - // We can't encode type IDs that aren't for vmlinux into instructions at the - // moment. - resolveTargetTypeID := targets[0].TypeID - - for _, target := range targets { - if bo != target.imm.byteOrder { - return nil, fmt.Errorf("can't relocate %s against %s", bo, target.imm.byteOrder) - } - } - - type reloGroup struct { - relos []*CORERelocation - // Position of each relocation in relos. - indices []int - } - - // Split relocations into per Type lists. - relosByType := make(map[Type]*reloGroup) - result := make([]COREFixup, len(relos)) - for i, relo := range relos { - if relo.kind == reloTypeIDLocal { - // Filtering out reloTypeIDLocal here makes our lives a lot easier - // down the line, since it doesn't have a target at all. - if len(relo.accessor) > 1 || relo.accessor[0] != 0 { - return nil, fmt.Errorf("%s: unexpected accessor %v", relo.kind, relo.accessor) - } - - id, err := resolveLocalTypeID(relo.typ) - if err != nil { - return nil, fmt.Errorf("%s: get type id: %w", relo.kind, err) - } - - result[i] = COREFixup{ - kind: relo.kind, - local: uint64(relo.id), - target: uint64(id), - } - continue - } - - group, ok := relosByType[relo.typ] - if !ok { - group = &reloGroup{} - relosByType[relo.typ] = group - } - group.relos = append(group.relos, relo) - group.indices = append(group.indices, i) - } - - for localType, group := range relosByType { - localTypeName := localType.TypeName() - if localTypeName == "" { - return nil, fmt.Errorf("relocate unnamed or anonymous type %s: %w", localType, ErrNotSupported) - } - - essentialName := newEssentialName(localTypeName) - - var targetTypes []Type - for _, target := range targets { - namedTypeIDs := target.imm.namedTypes[essentialName] - targetTypes = slices.Grow(targetTypes, len(namedTypeIDs)) - for _, id := range namedTypeIDs { - typ, err := target.TypeByID(id) - if err != nil { - return nil, err - } - - targetTypes = append(targetTypes, typ) - } - } - - fixups, err := coreCalculateFixups(group.relos, targetTypes, bo, resolveTargetTypeID) - if err != nil { - return nil, fmt.Errorf("relocate %s: %w", localType, err) - } - - for j, index := range group.indices { - result[index] = fixups[j] - } - } - - return result, nil -} - -var errAmbiguousRelocation = errors.New("ambiguous relocation") -var errImpossibleRelocation = errors.New("impossible relocation") -var errIncompatibleTypes = errors.New("incompatible types") - -// coreCalculateFixups finds the target type that best matches all relocations. -// -// All relos must target the same type. -// -// The best target is determined by scoring: the less poisoning we have to do -// the better the target is. -func coreCalculateFixups(relos []*CORERelocation, targets []Type, bo binary.ByteOrder, resolveTargetTypeID func(Type) (TypeID, error)) ([]COREFixup, error) { - bestScore := len(relos) - var bestFixups []COREFixup - for _, target := range targets { - score := 0 // lower is better - fixups := make([]COREFixup, 0, len(relos)) - for _, relo := range relos { - fixup, err := coreCalculateFixup(relo, target, bo, resolveTargetTypeID) - if err != nil { - return nil, fmt.Errorf("target %s: %s: %w", target, relo.kind, err) - } - if fixup.poison || fixup.isNonExistant() { - score++ - } - fixups = append(fixups, fixup) - } - - if score > bestScore { - // We have a better target already, ignore this one. - continue - } - - if score < bestScore { - // This is the best target yet, use it. - bestScore = score - bestFixups = fixups - continue - } - - // Some other target has the same score as the current one. Make sure - // the fixups agree with each other. - for i, fixup := range bestFixups { - if !fixup.equal(fixups[i]) { - return nil, fmt.Errorf("%s: multiple types match: %w", fixup.kind, errAmbiguousRelocation) - } - } - } - - if bestFixups == nil { - // Nothing at all matched, probably because there are no suitable - // targets at all. - // - // Poison everything except checksForExistence. - bestFixups = make([]COREFixup, len(relos)) - for i, relo := range relos { - if relo.kind.checksForExistence() { - bestFixups[i] = COREFixup{kind: relo.kind, local: 1, target: 0} - } else { - bestFixups[i] = COREFixup{kind: relo.kind, poison: true} - } - } - } - - return bestFixups, nil -} - -var errNoSignedness = errors.New("no signedness") - -// coreCalculateFixup calculates the fixup given a relocation and a target type. -func coreCalculateFixup(relo *CORERelocation, target Type, bo binary.ByteOrder, resolveTargetTypeID func(Type) (TypeID, error)) (COREFixup, error) { - fixup := func(local, target uint64) (COREFixup, error) { - return COREFixup{kind: relo.kind, local: local, target: target}, nil - } - fixupWithoutValidation := func(local, target uint64) (COREFixup, error) { - return COREFixup{kind: relo.kind, local: local, target: target, skipLocalValidation: true}, nil - } - poison := func() (COREFixup, error) { - if relo.kind.checksForExistence() { - return fixup(1, 0) - } - return COREFixup{kind: relo.kind, poison: true}, nil - } - zero := COREFixup{} - - local := relo.typ - - switch relo.kind { - case reloTypeMatches: - if len(relo.accessor) > 1 || relo.accessor[0] != 0 { - return zero, fmt.Errorf("unexpected accessor %v", relo.accessor) - } - - err := coreTypesMatch(local, target, nil) - if errors.Is(err, errIncompatibleTypes) { - return poison() - } - if err != nil { - return zero, err - } - - return fixup(1, 1) - - case reloTypeIDTarget, reloTypeSize, reloTypeExists: - if len(relo.accessor) > 1 || relo.accessor[0] != 0 { - return zero, fmt.Errorf("unexpected accessor %v", relo.accessor) - } - - err := CheckTypeCompatibility(local, target) - if errors.Is(err, errIncompatibleTypes) { - return poison() - } - if err != nil { - return zero, err - } - - switch relo.kind { - case reloTypeExists: - return fixup(1, 1) - - case reloTypeIDTarget: - targetID, err := resolveTargetTypeID(target) - if errors.Is(err, ErrNotFound) { - // Probably a relocation trying to get the ID - // of a type from a kmod. - return poison() - } - if err != nil { - return zero, err - } - return fixup(uint64(relo.id), uint64(targetID)) - - case reloTypeSize: - localSize, err := Sizeof(local) - if err != nil { - return zero, err - } - - targetSize, err := Sizeof(target) - if err != nil { - return zero, err - } - - return fixup(uint64(localSize), uint64(targetSize)) - } - - case reloEnumvalValue, reloEnumvalExists: - localValue, targetValue, err := coreFindEnumValue(local, relo.accessor, target) - if errors.Is(err, errImpossibleRelocation) { - return poison() - } - if err != nil { - return zero, err - } - - switch relo.kind { - case reloEnumvalExists: - return fixup(1, 1) - - case reloEnumvalValue: - return fixup(localValue.Value, targetValue.Value) - } - - case reloFieldByteOffset, reloFieldByteSize, reloFieldExists, reloFieldLShiftU64, reloFieldRShiftU64, reloFieldSigned: - if _, ok := As[*Fwd](target); ok { - // We can't relocate fields using a forward declaration, so - // skip it. If a non-forward declaration is present in the BTF - // we'll find it in one of the other iterations. - return poison() - } - - localField, targetField, err := coreFindField(local, relo.accessor, target) - if errors.Is(err, errImpossibleRelocation) { - return poison() - } - if err != nil { - return zero, err - } - - maybeSkipValidation := func(f COREFixup, err error) (COREFixup, error) { - f.skipLocalValidation = localField.bitfieldSize > 0 - return f, err - } - - switch relo.kind { - case reloFieldExists: - return fixup(1, 1) - - case reloFieldByteOffset: - return maybeSkipValidation(fixup(uint64(localField.offset), uint64(targetField.offset))) - - case reloFieldByteSize: - localSize, err := Sizeof(localField.Type) - if err != nil { - return zero, err - } - - targetSize, err := Sizeof(targetField.Type) - if err != nil { - return zero, err - } - return maybeSkipValidation(fixup(uint64(localSize), uint64(targetSize))) - - case reloFieldLShiftU64: - var target uint64 - if bo == binary.LittleEndian { - targetSize, err := targetField.sizeBits() - if err != nil { - return zero, err - } - - target = uint64(64 - targetField.bitfieldOffset - targetSize) - } else { - loadWidth, err := Sizeof(targetField.Type) - if err != nil { - return zero, err - } - - target = uint64(64 - Bits(loadWidth*8) + targetField.bitfieldOffset) - } - return fixupWithoutValidation(0, target) - - case reloFieldRShiftU64: - targetSize, err := targetField.sizeBits() - if err != nil { - return zero, err - } - - return fixupWithoutValidation(0, uint64(64-targetSize)) - - case reloFieldSigned: - switch local := UnderlyingType(localField.Type).(type) { - case *Enum: - target, ok := As[*Enum](targetField.Type) - if !ok { - return zero, fmt.Errorf("target isn't *Enum but %T", targetField.Type) - } - - return fixup(boolToUint64(local.Signed), boolToUint64(target.Signed)) - case *Int: - target, ok := As[*Int](targetField.Type) - if !ok { - return zero, fmt.Errorf("target isn't *Int but %T", targetField.Type) - } - - return fixup( - uint64(local.Encoding&Signed), - uint64(target.Encoding&Signed), - ) - default: - return zero, fmt.Errorf("type %T: %w", local, errNoSignedness) - } - } - } - - return zero, ErrNotSupported -} - -func boolToUint64(val bool) uint64 { - if val { - return 1 - } - return 0 -} - -/* coreAccessor contains a path through a struct. It contains at least one index. - * - * The interpretation depends on the kind of the relocation. The following is - * taken from struct bpf_core_relo in libbpf_internal.h: - * - * - for field-based relocations, string encodes an accessed field using - * a sequence of field and array indices, separated by colon (:). It's - * conceptually very close to LLVM's getelementptr ([0]) instruction's - * arguments for identifying offset to a field. - * - for type-based relocations, strings is expected to be just "0"; - * - for enum value-based relocations, string contains an index of enum - * value within its enum type; - * - * Example to provide a better feel. - * - * struct sample { - * int a; - * struct { - * int b[10]; - * }; - * }; - * - * struct sample s = ...; - * int x = &s->a; // encoded as "0:0" (a is field #0) - * int y = &s->b[5]; // encoded as "0:1:0:5" (anon struct is field #1, - * // b is field #0 inside anon struct, accessing elem #5) - * int z = &s[10]->b; // encoded as "10:1" (ptr is used as an array) - */ -type coreAccessor []int - -func parseCOREAccessor(accessor string) (coreAccessor, error) { - if accessor == "" { - return nil, fmt.Errorf("empty accessor") - } - - parts := strings.Split(accessor, ":") - result := make(coreAccessor, 0, len(parts)) - for _, part := range parts { - // 31 bits to avoid overflowing int on 32 bit platforms. - index, err := strconv.ParseUint(part, 10, 31) - if err != nil { - return nil, fmt.Errorf("accessor index %q: %s", part, err) - } - - result = append(result, int(index)) - } - - return result, nil -} - -func (ca coreAccessor) String() string { - strs := make([]string, 0, len(ca)) - for _, i := range ca { - strs = append(strs, strconv.Itoa(i)) - } - return strings.Join(strs, ":") -} - -func (ca coreAccessor) enumValue(t Type) (*EnumValue, error) { - e, ok := As[*Enum](t) - if !ok { - return nil, fmt.Errorf("not an enum: %s", t) - } - - if len(ca) > 1 { - return nil, fmt.Errorf("invalid accessor %s for enum", ca) - } - - i := ca[0] - if i >= len(e.Values) { - return nil, fmt.Errorf("invalid index %d for %s", i, e) - } - - return &e.Values[i], nil -} - -// coreField represents the position of a "child" of a composite type from the -// start of that type. -// -// /- start of composite -// | offset * 8 | bitfieldOffset | bitfieldSize | ... | -// \- start of field end of field -/ -type coreField struct { - Type Type - - // The position of the field from the start of the composite type in bytes. - offset uint32 - - // The offset of the bitfield in bits from the start of the field. - bitfieldOffset Bits - - // The size of the bitfield in bits. - // - // Zero if the field is not a bitfield. - bitfieldSize Bits -} - -func (cf *coreField) adjustOffsetToNthElement(n int) error { - if n == 0 { - return nil - } - - size, err := Sizeof(cf.Type) - if err != nil { - return err - } - - cf.offset += uint32(n) * uint32(size) - return nil -} - -func (cf *coreField) adjustOffsetBits(offset Bits) error { - align, err := alignof(cf.Type) - if err != nil { - return err - } - - // We can compute the load offset by: - // 1) converting the bit offset to bytes with a flooring division. - // 2) dividing and multiplying that offset by the alignment, yielding the - // load size aligned offset. - offsetBytes := uint32(offset/8) / uint32(align) * uint32(align) - - // The number of bits remaining is the bit offset less the number of bits - // we can "skip" with the aligned offset. - cf.bitfieldOffset = offset - Bits(offsetBytes*8) - - // We know that cf.offset is aligned at to at least align since we get it - // from the compiler via BTF. Adding an aligned offsetBytes preserves the - // alignment. - cf.offset += offsetBytes - return nil -} - -func (cf *coreField) sizeBits() (Bits, error) { - if cf.bitfieldSize > 0 { - return cf.bitfieldSize, nil - } - - // Someone is trying to access a non-bitfield via a bit shift relocation. - // This happens when a field changes from a bitfield to a regular field - // between kernel versions. Synthesise the size to make the shifts work. - size, err := Sizeof(cf.Type) - if err != nil { - return 0, err - } - return Bits(size * 8), nil -} - -// coreFindField descends into the local type using the accessor and tries to -// find an equivalent field in target at each step. -// -// Returns the field and the offset of the field from the start of -// target in bits. -func coreFindField(localT Type, localAcc coreAccessor, targetT Type) (coreField, coreField, error) { - local := coreField{Type: localT} - target := coreField{Type: targetT} - - if err := coreAreMembersCompatible(local.Type, target.Type); err != nil { - return coreField{}, coreField{}, fmt.Errorf("fields: %w", err) - } - - // The first index is used to offset a pointer of the base type like - // when accessing an array. - if err := local.adjustOffsetToNthElement(localAcc[0]); err != nil { - return coreField{}, coreField{}, err - } - - if err := target.adjustOffsetToNthElement(localAcc[0]); err != nil { - return coreField{}, coreField{}, err - } - - var localMaybeFlex, targetMaybeFlex bool - for i, acc := range localAcc[1:] { - switch localType := UnderlyingType(local.Type).(type) { - case composite: - // For composite types acc is used to find the field in the local type, - // and then we try to find a field in target with the same name. - localMembers := localType.members() - if acc >= len(localMembers) { - return coreField{}, coreField{}, fmt.Errorf("invalid accessor %d for %s", acc, localType) - } - - localMember := localMembers[acc] - if localMember.Name == "" { - localMemberType, ok := As[composite](localMember.Type) - if !ok { - return coreField{}, coreField{}, fmt.Errorf("unnamed field with type %s: %s", localMember.Type, ErrNotSupported) - } - - // This is an anonymous struct or union, ignore it. - local = coreField{ - Type: localMemberType, - offset: local.offset + localMember.Offset.Bytes(), - } - localMaybeFlex = false - continue - } - - targetType, ok := As[composite](target.Type) - if !ok { - return coreField{}, coreField{}, fmt.Errorf("target not composite: %w", errImpossibleRelocation) - } - - targetMember, last, err := coreFindMember(targetType, localMember.Name) - if err != nil { - return coreField{}, coreField{}, err - } - - local = coreField{ - Type: localMember.Type, - offset: local.offset, - bitfieldSize: localMember.BitfieldSize, - } - localMaybeFlex = acc == len(localMembers)-1 - - target = coreField{ - Type: targetMember.Type, - offset: target.offset, - bitfieldSize: targetMember.BitfieldSize, - } - targetMaybeFlex = last - - if local.bitfieldSize == 0 && target.bitfieldSize == 0 { - local.offset += localMember.Offset.Bytes() - target.offset += targetMember.Offset.Bytes() - break - } - - // Either of the members is a bitfield. Make sure we're at the - // end of the accessor. - if next := i + 1; next < len(localAcc[1:]) { - return coreField{}, coreField{}, fmt.Errorf("can't descend into bitfield") - } - - if err := local.adjustOffsetBits(localMember.Offset); err != nil { - return coreField{}, coreField{}, err - } - - if err := target.adjustOffsetBits(targetMember.Offset); err != nil { - return coreField{}, coreField{}, err - } - - case *Array: - // For arrays, acc is the index in the target. - targetType, ok := As[*Array](target.Type) - if !ok { - return coreField{}, coreField{}, fmt.Errorf("target not array: %w", errImpossibleRelocation) - } - - if localType.Nelems == 0 && !localMaybeFlex { - return coreField{}, coreField{}, fmt.Errorf("local type has invalid flexible array") - } - if targetType.Nelems == 0 && !targetMaybeFlex { - return coreField{}, coreField{}, fmt.Errorf("target type has invalid flexible array") - } - - if localType.Nelems > 0 && acc >= int(localType.Nelems) { - return coreField{}, coreField{}, fmt.Errorf("invalid access of %s at index %d", localType, acc) - } - if targetType.Nelems > 0 && acc >= int(targetType.Nelems) { - return coreField{}, coreField{}, fmt.Errorf("out of bounds access of target: %w", errImpossibleRelocation) - } - - local = coreField{ - Type: localType.Type, - offset: local.offset, - } - localMaybeFlex = false - - if err := local.adjustOffsetToNthElement(acc); err != nil { - return coreField{}, coreField{}, err - } - - target = coreField{ - Type: targetType.Type, - offset: target.offset, - } - targetMaybeFlex = false - - if err := target.adjustOffsetToNthElement(acc); err != nil { - return coreField{}, coreField{}, err - } - - default: - return coreField{}, coreField{}, fmt.Errorf("relocate field of %T: %w", localType, ErrNotSupported) - } - - if err := coreAreMembersCompatible(local.Type, target.Type); err != nil { - return coreField{}, coreField{}, err - } - } - - return local, target, nil -} - -// coreFindMember finds a member in a composite type while handling anonymous -// structs and unions. -func coreFindMember(typ composite, name string) (Member, bool, error) { - if name == "" { - return Member{}, false, errors.New("can't search for anonymous member") - } - - type offsetTarget struct { - composite - offset Bits - } - - targets := []offsetTarget{{typ, 0}} - visited := make(map[composite]bool) - - for i := 0; i < len(targets); i++ { - target := targets[i] - - // Only visit targets once to prevent infinite recursion. - if visited[target] { - continue - } - if len(visited) >= maxResolveDepth { - // This check is different than libbpf, which restricts the entire - // path to BPF_CORE_SPEC_MAX_LEN items. - return Member{}, false, fmt.Errorf("type is nested too deep") - } - visited[target] = true - - members := target.members() - for j, member := range members { - if member.Name == name { - // NB: This is safe because member is a copy. - member.Offset += target.offset - return member, j == len(members)-1, nil - } - - // The names don't match, but this member could be an anonymous struct - // or union. - if member.Name != "" { - continue - } - - comp, ok := As[composite](member.Type) - if !ok { - return Member{}, false, fmt.Errorf("anonymous non-composite type %T not allowed", member.Type) - } - - targets = append(targets, offsetTarget{comp, target.offset + member.Offset}) - } - } - - return Member{}, false, fmt.Errorf("no matching member: %w", errImpossibleRelocation) -} - -// coreFindEnumValue follows localAcc to find the equivalent enum value in target. -func coreFindEnumValue(local Type, localAcc coreAccessor, target Type) (localValue, targetValue *EnumValue, _ error) { - localValue, err := localAcc.enumValue(local) - if err != nil { - return nil, nil, err - } - - targetEnum, ok := As[*Enum](target) - if !ok { - return nil, nil, errImpossibleRelocation - } - - localName := newEssentialName(localValue.Name) - for i, targetValue := range targetEnum.Values { - if newEssentialName(targetValue.Name) != localName { - continue - } - - return localValue, &targetEnum.Values[i], nil - } - - return nil, nil, errImpossibleRelocation -} - -// CheckTypeCompatibility checks local and target types for Compatibility according to CO-RE rules. -// -// Only layout compatibility is checked, ignoring names of the root type. -func CheckTypeCompatibility(localType Type, targetType Type) error { - return coreAreTypesCompatible(localType, targetType, nil) -} - -type pair struct { - A, B Type -} - -/* The comment below is from bpf_core_types_are_compat in libbpf.c: - * - * Check local and target types for compatibility. This check is used for - * type-based CO-RE relocations and follow slightly different rules than - * field-based relocations. This function assumes that root types were already - * checked for name match. Beyond that initial root-level name check, names - * are completely ignored. Compatibility rules are as follows: - * - any two STRUCTs/UNIONs/FWDs/ENUMs/INTs are considered compatible, but - * kind should match for local and target types (i.e., STRUCT is not - * compatible with UNION); - * - for ENUMs, the size is ignored; - * - for INT, size and signedness are ignored; - * - for ARRAY, dimensionality is ignored, element types are checked for - * compatibility recursively; - * - CONST/VOLATILE/RESTRICT modifiers are ignored; - * - TYPEDEFs/PTRs are compatible if types they pointing to are compatible; - * - FUNC_PROTOs are compatible if they have compatible signature: same - * number of input args and compatible return and argument types. - * These rules are not set in stone and probably will be adjusted as we get - * more experience with using BPF CO-RE relocations. - * - * Returns errIncompatibleTypes if types are not compatible. - */ -func coreAreTypesCompatible(localType Type, targetType Type, visited map[pair]struct{}) error { - localType = UnderlyingType(localType) - targetType = UnderlyingType(targetType) - - if reflect.TypeOf(localType) != reflect.TypeOf(targetType) { - return fmt.Errorf("type mismatch between %v and %v: %w", localType, targetType, errIncompatibleTypes) - } - - if _, ok := visited[pair{localType, targetType}]; ok { - return nil - } - if visited == nil { - visited = make(map[pair]struct{}) - } - visited[pair{localType, targetType}] = struct{}{} - - switch lv := localType.(type) { - case *Void, *Struct, *Union, *Enum, *Fwd, *Int: - return nil - - case *Pointer: - tv := targetType.(*Pointer) - return coreAreTypesCompatible(lv.Target, tv.Target, visited) - - case *Array: - tv := targetType.(*Array) - if err := coreAreTypesCompatible(lv.Index, tv.Index, visited); err != nil { - return err - } - - return coreAreTypesCompatible(lv.Type, tv.Type, visited) - - case *FuncProto: - tv := targetType.(*FuncProto) - if err := coreAreTypesCompatible(lv.Return, tv.Return, visited); err != nil { - return err - } - - if len(lv.Params) != len(tv.Params) { - return fmt.Errorf("function param mismatch: %w", errIncompatibleTypes) - } - - for i, localParam := range lv.Params { - targetParam := tv.Params[i] - if err := coreAreTypesCompatible(localParam.Type, targetParam.Type, visited); err != nil { - return err - } - } - - return nil - - default: - return fmt.Errorf("unsupported type %T", localType) - } -} - -/* coreAreMembersCompatible checks two types for field-based relocation compatibility. - * - * The comment below is from bpf_core_fields_are_compat in libbpf.c: - * - * Check two types for compatibility for the purpose of field access - * relocation. const/volatile/restrict and typedefs are skipped to ensure we - * are relocating semantically compatible entities: - * - any two STRUCTs/UNIONs are compatible and can be mixed; - * - any two FWDs are compatible, if their names match (modulo flavor suffix); - * - any two PTRs are always compatible; - * - for ENUMs, names should be the same (ignoring flavor suffix) or at - * least one of enums should be anonymous; - * - for ENUMs, check sizes, names are ignored; - * - for INT, size and signedness are ignored; - * - any two FLOATs are always compatible; - * - for ARRAY, dimensionality is ignored, element types are checked for - * compatibility recursively; - * [ NB: coreAreMembersCompatible doesn't recurse, this check is done - * by coreFindField. ] - * - everything else shouldn't be ever a target of relocation. - * These rules are not set in stone and probably will be adjusted as we get - * more experience with using BPF CO-RE relocations. - * - * Returns errImpossibleRelocation if the members are not compatible. - */ -func coreAreMembersCompatible(localType Type, targetType Type) error { - localType = UnderlyingType(localType) - targetType = UnderlyingType(targetType) - - _, lok := localType.(composite) - _, tok := targetType.(composite) - if lok && tok { - return nil - } - - if reflect.TypeOf(localType) != reflect.TypeOf(targetType) { - return fmt.Errorf("type mismatch: %w", errImpossibleRelocation) - } - - switch lv := localType.(type) { - case *Array, *Pointer, *Float, *Int: - return nil - - case *Enum: - tv := targetType.(*Enum) - if !coreEssentialNamesMatch(lv.Name, tv.Name) { - return fmt.Errorf("names %q and %q don't match: %w", lv.Name, tv.Name, errImpossibleRelocation) - } - - return nil - - case *Fwd: - tv := targetType.(*Fwd) - if !coreEssentialNamesMatch(lv.Name, tv.Name) { - return fmt.Errorf("names %q and %q don't match: %w", lv.Name, tv.Name, errImpossibleRelocation) - } - - return nil - - default: - return fmt.Errorf("type %s: %w", localType, ErrNotSupported) - } -} - -// coreEssentialNamesMatch compares two names while ignoring their flavour suffix. -// -// This should only be used on names which are in the global scope, like struct -// names, typedefs or enum values. -func coreEssentialNamesMatch(a, b string) bool { - if a == "" || b == "" { - // allow anonymous and named type to match - return true - } - - return newEssentialName(a) == newEssentialName(b) -} - -/* The comment below is from __bpf_core_types_match in relo_core.c: - * - * Check that two types "match". This function assumes that root types were - * already checked for name match. - * - * The matching relation is defined as follows: - * - modifiers and typedefs are stripped (and, hence, effectively ignored) - * - generally speaking types need to be of same kind (struct vs. struct, union - * vs. union, etc.) - * - exceptions are struct/union behind a pointer which could also match a - * forward declaration of a struct or union, respectively, and enum vs. - * enum64 (see below) - * Then, depending on type: - * - integers: - * - match if size and signedness match - * - arrays & pointers: - * - target types are recursively matched - * - structs & unions: - * - local members need to exist in target with the same name - * - for each member we recursively check match unless it is already behind a - * pointer, in which case we only check matching names and compatible kind - * - enums: - * - local variants have to have a match in target by symbolic name (but not - * numeric value) - * - size has to match (but enum may match enum64 and vice versa) - * - function pointers: - * - number and position of arguments in local type has to match target - * - for each argument and the return value we recursively check match - */ -func coreTypesMatch(localType Type, targetType Type, visited map[pair]struct{}) error { - localType = UnderlyingType(localType) - targetType = UnderlyingType(targetType) - - if !coreEssentialNamesMatch(localType.TypeName(), targetType.TypeName()) { - return fmt.Errorf("type name %q don't match %q: %w", localType.TypeName(), targetType.TypeName(), errIncompatibleTypes) - } - - if reflect.TypeOf(localType) != reflect.TypeOf(targetType) { - return fmt.Errorf("type mismatch between %v and %v: %w", localType, targetType, errIncompatibleTypes) - } - - if _, ok := visited[pair{localType, targetType}]; ok { - return nil - } - if visited == nil { - visited = make(map[pair]struct{}) - } - visited[pair{localType, targetType}] = struct{}{} - - switch lv := (localType).(type) { - case *Void: - - case *Fwd: - if targetType.(*Fwd).Kind != lv.Kind { - return fmt.Errorf("fwd kind mismatch between %v and %v: %w", localType, targetType, errIncompatibleTypes) - } - - case *Enum: - return coreEnumsMatch(lv, targetType.(*Enum)) - - case composite: - tv := targetType.(composite) - - if len(lv.members()) > len(tv.members()) { - return errIncompatibleTypes - } - - localMembers := lv.members() - targetMembers := map[string]Member{} - for _, member := range tv.members() { - targetMembers[member.Name] = member - } - - for _, localMember := range localMembers { - targetMember, found := targetMembers[localMember.Name] - if !found { - return fmt.Errorf("no field %q in %v: %w", localMember.Name, targetType, errIncompatibleTypes) - } - - err := coreTypesMatch(localMember.Type, targetMember.Type, visited) - if err != nil { - return err - } - } - - case *Int: - if !coreEncodingMatches(lv, targetType.(*Int)) { - return fmt.Errorf("int mismatch between %v and %v: %w", localType, targetType, errIncompatibleTypes) - } - - case *Pointer: - tv := targetType.(*Pointer) - - // Allow a pointer to a forward declaration to match a struct - // or union. - if fwd, ok := As[*Fwd](lv.Target); ok && fwd.matches(tv.Target) { - return nil - } - - if fwd, ok := As[*Fwd](tv.Target); ok && fwd.matches(lv.Target) { - return nil - } - - return coreTypesMatch(lv.Target, tv.Target, visited) - - case *Array: - tv := targetType.(*Array) - - if lv.Nelems != tv.Nelems { - return fmt.Errorf("array mismatch between %v and %v: %w", localType, targetType, errIncompatibleTypes) - } - - return coreTypesMatch(lv.Type, tv.Type, visited) - - case *FuncProto: - tv := targetType.(*FuncProto) - - if len(lv.Params) != len(tv.Params) { - return fmt.Errorf("function param mismatch: %w", errIncompatibleTypes) - } - - for i, lparam := range lv.Params { - if err := coreTypesMatch(lparam.Type, tv.Params[i].Type, visited); err != nil { - return err - } - } - - return coreTypesMatch(lv.Return, tv.Return, visited) - - default: - return fmt.Errorf("unsupported type %T", localType) - } - - return nil -} - -// coreEncodingMatches returns true if both ints have the same size and signedness. -// All encodings other than `Signed` are considered unsigned. -func coreEncodingMatches(local, target *Int) bool { - return local.Size == target.Size && (local.Encoding == Signed) == (target.Encoding == Signed) -} - -// coreEnumsMatch checks two enums match, which is considered to be the case if the following is true: -// - size has to match (but enum may match enum64 and vice versa) -// - local variants have to have a match in target by symbolic name (but not numeric value) -func coreEnumsMatch(local *Enum, target *Enum) error { - if local.Size != target.Size { - return fmt.Errorf("size mismatch between %v and %v: %w", local, target, errIncompatibleTypes) - } - - // If there are more values in the local than the target, there must be at least one value in the local - // that isn't in the target, and therefor the types are incompatible. - if len(local.Values) > len(target.Values) { - return fmt.Errorf("local has more values than target: %w", errIncompatibleTypes) - } - -outer: - for _, lv := range local.Values { - for _, rv := range target.Values { - if coreEssentialNamesMatch(lv.Name, rv.Name) { - continue outer - } - } - - return fmt.Errorf("no match for %v in %v: %w", lv, target, errIncompatibleTypes) - } - - return nil -} diff --git a/vendor/github.com/cilium/ebpf/btf/doc.go b/vendor/github.com/cilium/ebpf/btf/doc.go deleted file mode 100644 index b1f4b1fc3..000000000 --- a/vendor/github.com/cilium/ebpf/btf/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Package btf handles data encoded according to the BPF Type Format. -// -// The canonical documentation lives in the Linux kernel repository and is -// available at https://www.kernel.org/doc/html/latest/bpf/btf.html -package btf diff --git a/vendor/github.com/cilium/ebpf/btf/ext_info.go b/vendor/github.com/cilium/ebpf/btf/ext_info.go deleted file mode 100644 index eb9044bad..000000000 --- a/vendor/github.com/cilium/ebpf/btf/ext_info.go +++ /dev/null @@ -1,835 +0,0 @@ -package btf - -import ( - "bytes" - "encoding/binary" - "errors" - "fmt" - "io" - "math" - "sort" - - "github.com/cilium/ebpf/asm" - "github.com/cilium/ebpf/internal" -) - -// ExtInfos contains ELF section metadata. -type ExtInfos struct { - // The slices are sorted by offset in ascending order. - funcInfos map[string]FuncInfos - lineInfos map[string]LineInfos - relocationInfos map[string]CORERelocationInfos -} - -// loadExtInfosFromELF parses ext infos from the .BTF.ext section in an ELF. -// -// Returns an error wrapping ErrNotFound if no ext infos are present. -func loadExtInfosFromELF(file *internal.SafeELFFile, spec *Spec) (*ExtInfos, error) { - section := file.Section(".BTF.ext") - if section == nil { - return nil, fmt.Errorf("btf ext infos: %w", ErrNotFound) - } - - if section.ReaderAt == nil { - return nil, fmt.Errorf("compressed ext_info is not supported") - } - - return loadExtInfos(section.ReaderAt, file.ByteOrder, spec) -} - -// loadExtInfos parses bare ext infos. -func loadExtInfos(r io.ReaderAt, bo binary.ByteOrder, spec *Spec) (*ExtInfos, error) { - // Open unbuffered section reader. binary.Read() calls io.ReadFull on - // the header structs, resulting in one syscall per header. - headerRd := io.NewSectionReader(r, 0, math.MaxInt64) - extHeader, err := parseBTFExtHeader(headerRd, bo) - if err != nil { - return nil, fmt.Errorf("parsing BTF extension header: %w", err) - } - - coreHeader, err := parseBTFExtCOREHeader(headerRd, bo, extHeader) - if err != nil { - return nil, fmt.Errorf("parsing BTF CO-RE header: %w", err) - } - - buf := internal.NewBufferedSectionReader(r, extHeader.funcInfoStart(), int64(extHeader.FuncInfoLen)) - btfFuncInfos, err := parseFuncInfos(buf, bo, spec.strings) - if err != nil { - return nil, fmt.Errorf("parsing BTF function info: %w", err) - } - - funcInfos := make(map[string]FuncInfos, len(btfFuncInfos)) - for section, bfis := range btfFuncInfos { - funcInfos[section], err = newFuncInfos(bfis, spec) - if err != nil { - return nil, fmt.Errorf("section %s: func infos: %w", section, err) - } - } - - buf = internal.NewBufferedSectionReader(r, extHeader.lineInfoStart(), int64(extHeader.LineInfoLen)) - btfLineInfos, err := parseLineInfos(buf, bo, spec.strings) - if err != nil { - return nil, fmt.Errorf("parsing BTF line info: %w", err) - } - - lineInfos := make(map[string]LineInfos, len(btfLineInfos)) - for section, blis := range btfLineInfos { - lineInfos[section], err = newLineInfos(blis, spec.strings) - if err != nil { - return nil, fmt.Errorf("section %s: line infos: %w", section, err) - } - } - - if coreHeader == nil || coreHeader.COREReloLen == 0 { - return &ExtInfos{funcInfos, lineInfos, nil}, nil - } - - var btfCORERelos map[string][]bpfCORERelo - buf = internal.NewBufferedSectionReader(r, extHeader.coreReloStart(coreHeader), int64(coreHeader.COREReloLen)) - btfCORERelos, err = parseCORERelos(buf, bo, spec.strings) - if err != nil { - return nil, fmt.Errorf("parsing CO-RE relocation info: %w", err) - } - - coreRelos := make(map[string]CORERelocationInfos, len(btfCORERelos)) - for section, brs := range btfCORERelos { - coreRelos[section], err = newRelocationInfos(brs, spec, spec.strings) - if err != nil { - return nil, fmt.Errorf("section %s: CO-RE relocations: %w", section, err) - } - } - - return &ExtInfos{funcInfos, lineInfos, coreRelos}, nil -} - -type funcInfoMeta struct{} -type coreRelocationMeta struct{} - -// Assign per-section metadata from BTF to a section's instructions. -func (ei *ExtInfos) Assign(insns asm.Instructions, section string) { - funcInfos := ei.funcInfos[section] - lineInfos := ei.lineInfos[section] - reloInfos := ei.relocationInfos[section] - - AssignMetadataToInstructions(insns, funcInfos, lineInfos, reloInfos) -} - -// Assign per-instruction metadata to the instructions in insns. -func AssignMetadataToInstructions( - insns asm.Instructions, - funcInfos FuncInfos, - lineInfos LineInfos, - reloInfos CORERelocationInfos, -) { - iter := insns.Iterate() - for iter.Next() { - if len(funcInfos.infos) > 0 && funcInfos.infos[0].offset == iter.Offset { - *iter.Ins = WithFuncMetadata(*iter.Ins, funcInfos.infos[0].fn) - funcInfos.infos = funcInfos.infos[1:] - } - - if len(lineInfos.infos) > 0 && lineInfos.infos[0].offset == iter.Offset { - *iter.Ins = iter.Ins.WithSource(lineInfos.infos[0].line) - lineInfos.infos = lineInfos.infos[1:] - } - - if len(reloInfos.infos) > 0 && reloInfos.infos[0].offset == iter.Offset { - iter.Ins.Metadata.Set(coreRelocationMeta{}, reloInfos.infos[0].relo) - reloInfos.infos = reloInfos.infos[1:] - } - } -} - -// MarshalExtInfos encodes function and line info embedded in insns into kernel -// wire format. -// -// If an instruction has an [asm.Comment], it will be synthesized into a mostly -// empty line info. -func MarshalExtInfos(insns asm.Instructions, b *Builder) (funcInfos, lineInfos []byte, _ error) { - iter := insns.Iterate() - for iter.Next() { - if iter.Ins.Source() != nil || FuncMetadata(iter.Ins) != nil { - goto marshal - } - } - - return nil, nil, nil - -marshal: - var fiBuf, liBuf bytes.Buffer - for { - if fn := FuncMetadata(iter.Ins); fn != nil { - fi := &funcInfo{ - fn: fn, - offset: iter.Offset, - } - if err := fi.marshal(&fiBuf, b); err != nil { - return nil, nil, fmt.Errorf("write func info: %w", err) - } - } - - if source := iter.Ins.Source(); source != nil { - var line *Line - if l, ok := source.(*Line); ok { - line = l - } else { - line = &Line{ - line: source.String(), - } - } - - li := &lineInfo{ - line: line, - offset: iter.Offset, - } - if err := li.marshal(&liBuf, b); err != nil { - return nil, nil, fmt.Errorf("write line info: %w", err) - } - } - - if !iter.Next() { - break - } - } - - return fiBuf.Bytes(), liBuf.Bytes(), nil -} - -// btfExtHeader is found at the start of the .BTF.ext section. -type btfExtHeader struct { - Magic uint16 - Version uint8 - Flags uint8 - - // HdrLen is larger than the size of struct btfExtHeader when it is - // immediately followed by a btfExtCOREHeader. - HdrLen uint32 - - FuncInfoOff uint32 - FuncInfoLen uint32 - LineInfoOff uint32 - LineInfoLen uint32 -} - -// parseBTFExtHeader parses the header of the .BTF.ext section. -func parseBTFExtHeader(r io.Reader, bo binary.ByteOrder) (*btfExtHeader, error) { - var header btfExtHeader - if err := binary.Read(r, bo, &header); err != nil { - return nil, fmt.Errorf("can't read header: %v", err) - } - - if header.Magic != btfMagic { - return nil, fmt.Errorf("incorrect magic value %v", header.Magic) - } - - if header.Version != 1 { - return nil, fmt.Errorf("unexpected version %v", header.Version) - } - - if header.Flags != 0 { - return nil, fmt.Errorf("unsupported flags %v", header.Flags) - } - - if int64(header.HdrLen) < int64(binary.Size(&header)) { - return nil, fmt.Errorf("header length shorter than btfExtHeader size") - } - - return &header, nil -} - -// funcInfoStart returns the offset from the beginning of the .BTF.ext section -// to the start of its func_info entries. -func (h *btfExtHeader) funcInfoStart() int64 { - return int64(h.HdrLen + h.FuncInfoOff) -} - -// lineInfoStart returns the offset from the beginning of the .BTF.ext section -// to the start of its line_info entries. -func (h *btfExtHeader) lineInfoStart() int64 { - return int64(h.HdrLen + h.LineInfoOff) -} - -// coreReloStart returns the offset from the beginning of the .BTF.ext section -// to the start of its CO-RE relocation entries. -func (h *btfExtHeader) coreReloStart(ch *btfExtCOREHeader) int64 { - return int64(h.HdrLen + ch.COREReloOff) -} - -// btfExtCOREHeader is found right after the btfExtHeader when its HdrLen -// field is larger than its size. -type btfExtCOREHeader struct { - COREReloOff uint32 - COREReloLen uint32 -} - -// parseBTFExtCOREHeader parses the tail of the .BTF.ext header. If additional -// header bytes are present, extHeader.HdrLen will be larger than the struct, -// indicating the presence of a CO-RE extension header. -func parseBTFExtCOREHeader(r io.Reader, bo binary.ByteOrder, extHeader *btfExtHeader) (*btfExtCOREHeader, error) { - extHdrSize := int64(binary.Size(&extHeader)) - remainder := int64(extHeader.HdrLen) - extHdrSize - - if remainder == 0 { - return nil, nil - } - - var coreHeader btfExtCOREHeader - if err := binary.Read(r, bo, &coreHeader); err != nil { - return nil, fmt.Errorf("can't read header: %v", err) - } - - return &coreHeader, nil -} - -type btfExtInfoSec struct { - SecNameOff uint32 - NumInfo uint32 -} - -// parseExtInfoSec parses a btf_ext_info_sec header within .BTF.ext, -// appearing within func_info and line_info sub-sections. -// These headers appear once for each program section in the ELF and are -// followed by one or more func/line_info records for the section. -func parseExtInfoSec(r io.Reader, bo binary.ByteOrder, strings *stringTable) (string, *btfExtInfoSec, error) { - var infoHeader btfExtInfoSec - if err := binary.Read(r, bo, &infoHeader); err != nil { - return "", nil, fmt.Errorf("read ext info header: %w", err) - } - - secName, err := strings.Lookup(infoHeader.SecNameOff) - if err != nil { - return "", nil, fmt.Errorf("get section name: %w", err) - } - if secName == "" { - return "", nil, fmt.Errorf("extinfo header refers to empty section name") - } - - if infoHeader.NumInfo == 0 { - return "", nil, fmt.Errorf("section %s has zero records", secName) - } - - return secName, &infoHeader, nil -} - -// parseExtInfoRecordSize parses the uint32 at the beginning of a func_infos -// or line_infos segment that describes the length of all extInfoRecords in -// that segment. -func parseExtInfoRecordSize(r io.Reader, bo binary.ByteOrder) (uint32, error) { - const maxRecordSize = 256 - - var recordSize uint32 - if err := binary.Read(r, bo, &recordSize); err != nil { - return 0, fmt.Errorf("can't read record size: %v", err) - } - - if recordSize < 4 { - // Need at least InsnOff worth of bytes per record. - return 0, errors.New("record size too short") - } - if recordSize > maxRecordSize { - return 0, fmt.Errorf("record size %v exceeds %v", recordSize, maxRecordSize) - } - - return recordSize, nil -} - -// FuncInfos contains a sorted list of func infos. -type FuncInfos struct { - infos []funcInfo -} - -// The size of a FuncInfo in BTF wire format. -var FuncInfoSize = uint32(binary.Size(bpfFuncInfo{})) - -type funcInfo struct { - fn *Func - offset asm.RawInstructionOffset -} - -type bpfFuncInfo struct { - // Instruction offset of the function within an ELF section. - InsnOff uint32 - TypeID TypeID -} - -func newFuncInfo(fi bpfFuncInfo, spec *Spec) (*funcInfo, error) { - typ, err := spec.TypeByID(fi.TypeID) - if err != nil { - return nil, err - } - - fn, ok := typ.(*Func) - if !ok { - return nil, fmt.Errorf("type ID %d is a %T, but expected a Func", fi.TypeID, typ) - } - - // C doesn't have anonymous functions, but check just in case. - if fn.Name == "" { - return nil, fmt.Errorf("func with type ID %d doesn't have a name", fi.TypeID) - } - - return &funcInfo{ - fn, - asm.RawInstructionOffset(fi.InsnOff), - }, nil -} - -func newFuncInfos(bfis []bpfFuncInfo, spec *Spec) (FuncInfos, error) { - fis := FuncInfos{ - infos: make([]funcInfo, 0, len(bfis)), - } - for _, bfi := range bfis { - fi, err := newFuncInfo(bfi, spec) - if err != nil { - return FuncInfos{}, fmt.Errorf("offset %d: %w", bfi.InsnOff, err) - } - fis.infos = append(fis.infos, *fi) - } - sort.Slice(fis.infos, func(i, j int) bool { - return fis.infos[i].offset <= fis.infos[j].offset - }) - return fis, nil -} - -// LoadFuncInfos parses BTF func info in kernel wire format. -func LoadFuncInfos(reader io.Reader, bo binary.ByteOrder, recordNum uint32, spec *Spec) (FuncInfos, error) { - fis, err := parseFuncInfoRecords( - reader, - bo, - FuncInfoSize, - recordNum, - false, - ) - if err != nil { - return FuncInfos{}, fmt.Errorf("parsing BTF func info: %w", err) - } - - return newFuncInfos(fis, spec) -} - -// marshal into the BTF wire format. -func (fi *funcInfo) marshal(w *bytes.Buffer, b *Builder) error { - id, err := b.Add(fi.fn) - if err != nil { - return err - } - bfi := bpfFuncInfo{ - InsnOff: uint32(fi.offset), - TypeID: id, - } - buf := make([]byte, FuncInfoSize) - internal.NativeEndian.PutUint32(buf, bfi.InsnOff) - internal.NativeEndian.PutUint32(buf[4:], uint32(bfi.TypeID)) - _, err = w.Write(buf) - return err -} - -// parseFuncInfos parses a func_info sub-section within .BTF.ext ito a map of -// func infos indexed by section name. -func parseFuncInfos(r io.Reader, bo binary.ByteOrder, strings *stringTable) (map[string][]bpfFuncInfo, error) { - recordSize, err := parseExtInfoRecordSize(r, bo) - if err != nil { - return nil, err - } - - result := make(map[string][]bpfFuncInfo) - for { - secName, infoHeader, err := parseExtInfoSec(r, bo, strings) - if errors.Is(err, io.EOF) { - return result, nil - } - if err != nil { - return nil, err - } - - records, err := parseFuncInfoRecords(r, bo, recordSize, infoHeader.NumInfo, true) - if err != nil { - return nil, fmt.Errorf("section %v: %w", secName, err) - } - - result[secName] = records - } -} - -// parseFuncInfoRecords parses a stream of func_infos into a funcInfos. -// These records appear after a btf_ext_info_sec header in the func_info -// sub-section of .BTF.ext. -func parseFuncInfoRecords(r io.Reader, bo binary.ByteOrder, recordSize uint32, recordNum uint32, offsetInBytes bool) ([]bpfFuncInfo, error) { - var out []bpfFuncInfo - var fi bpfFuncInfo - - if exp, got := FuncInfoSize, recordSize; exp != got { - // BTF blob's record size is longer than we know how to parse. - return nil, fmt.Errorf("expected FuncInfo record size %d, but BTF blob contains %d", exp, got) - } - - for i := uint32(0); i < recordNum; i++ { - if err := binary.Read(r, bo, &fi); err != nil { - return nil, fmt.Errorf("can't read function info: %v", err) - } - - if offsetInBytes { - if fi.InsnOff%asm.InstructionSize != 0 { - return nil, fmt.Errorf("offset %v is not aligned with instruction size", fi.InsnOff) - } - - // ELF tracks offset in bytes, the kernel expects raw BPF instructions. - // Convert as early as possible. - fi.InsnOff /= asm.InstructionSize - } - - out = append(out, fi) - } - - return out, nil -} - -var LineInfoSize = uint32(binary.Size(bpfLineInfo{})) - -// Line represents the location and contents of a single line of source -// code a BPF ELF was compiled from. -type Line struct { - fileName string - line string - lineNumber uint32 - lineColumn uint32 -} - -func (li *Line) FileName() string { - return li.fileName -} - -func (li *Line) Line() string { - return li.line -} - -func (li *Line) LineNumber() uint32 { - return li.lineNumber -} - -func (li *Line) LineColumn() uint32 { - return li.lineColumn -} - -func (li *Line) String() string { - return li.line -} - -// LineInfos contains a sorted list of line infos. -type LineInfos struct { - infos []lineInfo -} - -type lineInfo struct { - line *Line - offset asm.RawInstructionOffset -} - -// Constants for the format of bpfLineInfo.LineCol. -const ( - bpfLineShift = 10 - bpfLineMax = (1 << (32 - bpfLineShift)) - 1 - bpfColumnMax = (1 << bpfLineShift) - 1 -) - -type bpfLineInfo struct { - // Instruction offset of the line within the whole instruction stream, in instructions. - InsnOff uint32 - FileNameOff uint32 - LineOff uint32 - LineCol uint32 -} - -// LoadLineInfos parses BTF line info in kernel wire format. -func LoadLineInfos(reader io.Reader, bo binary.ByteOrder, recordNum uint32, spec *Spec) (LineInfos, error) { - lis, err := parseLineInfoRecords( - reader, - bo, - LineInfoSize, - recordNum, - false, - ) - if err != nil { - return LineInfos{}, fmt.Errorf("parsing BTF line info: %w", err) - } - - return newLineInfos(lis, spec.strings) -} - -func newLineInfo(li bpfLineInfo, strings *stringTable) (lineInfo, error) { - line, err := strings.Lookup(li.LineOff) - if err != nil { - return lineInfo{}, fmt.Errorf("lookup of line: %w", err) - } - - fileName, err := strings.Lookup(li.FileNameOff) - if err != nil { - return lineInfo{}, fmt.Errorf("lookup of filename: %w", err) - } - - lineNumber := li.LineCol >> bpfLineShift - lineColumn := li.LineCol & bpfColumnMax - - return lineInfo{ - &Line{ - fileName, - line, - lineNumber, - lineColumn, - }, - asm.RawInstructionOffset(li.InsnOff), - }, nil -} - -func newLineInfos(blis []bpfLineInfo, strings *stringTable) (LineInfos, error) { - lis := LineInfos{ - infos: make([]lineInfo, 0, len(blis)), - } - for _, bli := range blis { - li, err := newLineInfo(bli, strings) - if err != nil { - return LineInfos{}, fmt.Errorf("offset %d: %w", bli.InsnOff, err) - } - lis.infos = append(lis.infos, li) - } - sort.Slice(lis.infos, func(i, j int) bool { - return lis.infos[i].offset <= lis.infos[j].offset - }) - return lis, nil -} - -// marshal writes the binary representation of the LineInfo to w. -func (li *lineInfo) marshal(w *bytes.Buffer, b *Builder) error { - line := li.line - if line.lineNumber > bpfLineMax { - return fmt.Errorf("line %d exceeds %d", line.lineNumber, bpfLineMax) - } - - if line.lineColumn > bpfColumnMax { - return fmt.Errorf("column %d exceeds %d", line.lineColumn, bpfColumnMax) - } - - fileNameOff, err := b.addString(line.fileName) - if err != nil { - return fmt.Errorf("file name %q: %w", line.fileName, err) - } - - lineOff, err := b.addString(line.line) - if err != nil { - return fmt.Errorf("line %q: %w", line.line, err) - } - - bli := bpfLineInfo{ - uint32(li.offset), - fileNameOff, - lineOff, - (line.lineNumber << bpfLineShift) | line.lineColumn, - } - - buf := make([]byte, LineInfoSize) - internal.NativeEndian.PutUint32(buf, bli.InsnOff) - internal.NativeEndian.PutUint32(buf[4:], bli.FileNameOff) - internal.NativeEndian.PutUint32(buf[8:], bli.LineOff) - internal.NativeEndian.PutUint32(buf[12:], bli.LineCol) - _, err = w.Write(buf) - return err -} - -// parseLineInfos parses a line_info sub-section within .BTF.ext ito a map of -// line infos indexed by section name. -func parseLineInfos(r io.Reader, bo binary.ByteOrder, strings *stringTable) (map[string][]bpfLineInfo, error) { - recordSize, err := parseExtInfoRecordSize(r, bo) - if err != nil { - return nil, err - } - - result := make(map[string][]bpfLineInfo) - for { - secName, infoHeader, err := parseExtInfoSec(r, bo, strings) - if errors.Is(err, io.EOF) { - return result, nil - } - if err != nil { - return nil, err - } - - records, err := parseLineInfoRecords(r, bo, recordSize, infoHeader.NumInfo, true) - if err != nil { - return nil, fmt.Errorf("section %v: %w", secName, err) - } - - result[secName] = records - } -} - -// parseLineInfoRecords parses a stream of line_infos into a lineInfos. -// These records appear after a btf_ext_info_sec header in the line_info -// sub-section of .BTF.ext. -func parseLineInfoRecords(r io.Reader, bo binary.ByteOrder, recordSize uint32, recordNum uint32, offsetInBytes bool) ([]bpfLineInfo, error) { - var li bpfLineInfo - - if exp, got := uint32(binary.Size(li)), recordSize; exp != got { - // BTF blob's record size is longer than we know how to parse. - return nil, fmt.Errorf("expected LineInfo record size %d, but BTF blob contains %d", exp, got) - } - - out := make([]bpfLineInfo, 0, recordNum) - for i := uint32(0); i < recordNum; i++ { - if err := binary.Read(r, bo, &li); err != nil { - return nil, fmt.Errorf("can't read line info: %v", err) - } - - if offsetInBytes { - if li.InsnOff%asm.InstructionSize != 0 { - return nil, fmt.Errorf("offset %v is not aligned with instruction size", li.InsnOff) - } - - // ELF tracks offset in bytes, the kernel expects raw BPF instructions. - // Convert as early as possible. - li.InsnOff /= asm.InstructionSize - } - - out = append(out, li) - } - - return out, nil -} - -// bpfCORERelo matches the kernel's struct bpf_core_relo. -type bpfCORERelo struct { - InsnOff uint32 - TypeID TypeID - AccessStrOff uint32 - Kind coreKind -} - -type CORERelocation struct { - // The local type of the relocation, stripped of typedefs and qualifiers. - typ Type - accessor coreAccessor - kind coreKind - // The ID of the local type in the source BTF. - id TypeID -} - -func (cr *CORERelocation) String() string { - return fmt.Sprintf("CORERelocation(%s, %s[%s], local_id=%d)", cr.kind, cr.typ, cr.accessor, cr.id) -} - -func CORERelocationMetadata(ins *asm.Instruction) *CORERelocation { - relo, _ := ins.Metadata.Get(coreRelocationMeta{}).(*CORERelocation) - return relo -} - -// CORERelocationInfos contains a sorted list of co:re relocation infos. -type CORERelocationInfos struct { - infos []coreRelocationInfo -} - -type coreRelocationInfo struct { - relo *CORERelocation - offset asm.RawInstructionOffset -} - -func newRelocationInfo(relo bpfCORERelo, spec *Spec, strings *stringTable) (*coreRelocationInfo, error) { - typ, err := spec.TypeByID(relo.TypeID) - if err != nil { - return nil, err - } - - accessorStr, err := strings.Lookup(relo.AccessStrOff) - if err != nil { - return nil, err - } - - accessor, err := parseCOREAccessor(accessorStr) - if err != nil { - return nil, fmt.Errorf("accessor %q: %s", accessorStr, err) - } - - return &coreRelocationInfo{ - &CORERelocation{ - typ, - accessor, - relo.Kind, - relo.TypeID, - }, - asm.RawInstructionOffset(relo.InsnOff), - }, nil -} - -func newRelocationInfos(brs []bpfCORERelo, spec *Spec, strings *stringTable) (CORERelocationInfos, error) { - rs := CORERelocationInfos{ - infos: make([]coreRelocationInfo, 0, len(brs)), - } - for _, br := range brs { - relo, err := newRelocationInfo(br, spec, strings) - if err != nil { - return CORERelocationInfos{}, fmt.Errorf("offset %d: %w", br.InsnOff, err) - } - rs.infos = append(rs.infos, *relo) - } - sort.Slice(rs.infos, func(i, j int) bool { - return rs.infos[i].offset < rs.infos[j].offset - }) - return rs, nil -} - -var extInfoReloSize = binary.Size(bpfCORERelo{}) - -// parseCORERelos parses a core_relos sub-section within .BTF.ext ito a map of -// CO-RE relocations indexed by section name. -func parseCORERelos(r io.Reader, bo binary.ByteOrder, strings *stringTable) (map[string][]bpfCORERelo, error) { - recordSize, err := parseExtInfoRecordSize(r, bo) - if err != nil { - return nil, err - } - - if recordSize != uint32(extInfoReloSize) { - return nil, fmt.Errorf("expected record size %d, got %d", extInfoReloSize, recordSize) - } - - result := make(map[string][]bpfCORERelo) - for { - secName, infoHeader, err := parseExtInfoSec(r, bo, strings) - if errors.Is(err, io.EOF) { - return result, nil - } - if err != nil { - return nil, err - } - - records, err := parseCOREReloRecords(r, bo, recordSize, infoHeader.NumInfo) - if err != nil { - return nil, fmt.Errorf("section %v: %w", secName, err) - } - - result[secName] = records - } -} - -// parseCOREReloRecords parses a stream of CO-RE relocation entries into a -// coreRelos. These records appear after a btf_ext_info_sec header in the -// core_relos sub-section of .BTF.ext. -func parseCOREReloRecords(r io.Reader, bo binary.ByteOrder, recordSize uint32, recordNum uint32) ([]bpfCORERelo, error) { - var out []bpfCORERelo - - var relo bpfCORERelo - for i := uint32(0); i < recordNum; i++ { - if err := binary.Read(r, bo, &relo); err != nil { - return nil, fmt.Errorf("can't read CO-RE relocation: %v", err) - } - - if relo.InsnOff%asm.InstructionSize != 0 { - return nil, fmt.Errorf("offset %v is not aligned with instruction size", relo.InsnOff) - } - - // ELF tracks offset in bytes, the kernel expects raw BPF instructions. - // Convert as early as possible. - relo.InsnOff /= asm.InstructionSize - - out = append(out, relo) - } - - return out, nil -} diff --git a/vendor/github.com/cilium/ebpf/btf/feature.go b/vendor/github.com/cilium/ebpf/btf/feature.go deleted file mode 100644 index 6feb08dfb..000000000 --- a/vendor/github.com/cilium/ebpf/btf/feature.go +++ /dev/null @@ -1,123 +0,0 @@ -package btf - -import ( - "errors" - "math" - - "github.com/cilium/ebpf/internal" - "github.com/cilium/ebpf/internal/sys" - "github.com/cilium/ebpf/internal/unix" -) - -// haveBTF attempts to load a BTF blob containing an Int. It should pass on any -// kernel that supports BPF_BTF_LOAD. -var haveBTF = internal.NewFeatureTest("BTF", "4.18", func() error { - // 0-length anonymous integer - err := probeBTF(&Int{}) - if errors.Is(err, unix.EINVAL) || errors.Is(err, unix.EPERM) { - return internal.ErrNotSupported - } - return err -}) - -// haveMapBTF attempts to load a minimal BTF blob containing a Var. It is -// used as a proxy for .bss, .data and .rodata map support, which generally -// come with a Var and Datasec. These were introduced in Linux 5.2. -var haveMapBTF = internal.NewFeatureTest("Map BTF (Var/Datasec)", "5.2", func() error { - if err := haveBTF(); err != nil { - return err - } - - v := &Var{ - Name: "a", - Type: &Pointer{(*Void)(nil)}, - } - - err := probeBTF(v) - if errors.Is(err, unix.EINVAL) || errors.Is(err, unix.EPERM) { - // Treat both EINVAL and EPERM as not supported: creating the map may still - // succeed without Btf* attrs. - return internal.ErrNotSupported - } - return err -}) - -// haveProgBTF attempts to load a BTF blob containing a Func and FuncProto. It -// is used as a proxy for ext_info (func_info) support, which depends on -// Func(Proto) by definition. -var haveProgBTF = internal.NewFeatureTest("Program BTF (func/line_info)", "5.0", func() error { - if err := haveBTF(); err != nil { - return err - } - - fn := &Func{ - Name: "a", - Type: &FuncProto{Return: (*Void)(nil)}, - } - - err := probeBTF(fn) - if errors.Is(err, unix.EINVAL) || errors.Is(err, unix.EPERM) { - return internal.ErrNotSupported - } - return err -}) - -var haveFuncLinkage = internal.NewFeatureTest("BTF func linkage", "5.6", func() error { - if err := haveProgBTF(); err != nil { - return err - } - - fn := &Func{ - Name: "a", - Type: &FuncProto{Return: (*Void)(nil)}, - Linkage: GlobalFunc, - } - - err := probeBTF(fn) - if errors.Is(err, unix.EINVAL) { - return internal.ErrNotSupported - } - return err -}) - -var haveEnum64 = internal.NewFeatureTest("ENUM64", "6.0", func() error { - if err := haveBTF(); err != nil { - return err - } - - enum := &Enum{ - Size: 8, - Values: []EnumValue{ - {"TEST", math.MaxUint32 + 1}, - }, - } - - err := probeBTF(enum) - if errors.Is(err, unix.EINVAL) { - return internal.ErrNotSupported - } - return err -}) - -func probeBTF(typ Type) error { - b, err := NewBuilder([]Type{typ}) - if err != nil { - return err - } - - buf, err := b.Marshal(nil, nil) - if err != nil { - return err - } - - fd, err := sys.BtfLoad(&sys.BtfLoadAttr{ - Btf: sys.NewSlicePointer(buf), - BtfSize: uint32(len(buf)), - }) - - if err == nil { - fd.Close() - } - - return err -} diff --git a/vendor/github.com/cilium/ebpf/btf/format.go b/vendor/github.com/cilium/ebpf/btf/format.go deleted file mode 100644 index 5e581b4a8..000000000 --- a/vendor/github.com/cilium/ebpf/btf/format.go +++ /dev/null @@ -1,350 +0,0 @@ -package btf - -import ( - "errors" - "fmt" - "strings" -) - -var errNestedTooDeep = errors.New("nested too deep") - -// GoFormatter converts a Type to Go syntax. -// -// A zero GoFormatter is valid to use. -type GoFormatter struct { - w strings.Builder - - // Types present in this map are referred to using the given name if they - // are encountered when outputting another type. - Names map[Type]string - - // Identifier is called for each field of struct-like types. By default the - // field name is used as is. - Identifier func(string) string - - // EnumIdentifier is called for each element of an enum. By default the - // name of the enum type is concatenated with Identifier(element). - EnumIdentifier func(name, element string) string -} - -// TypeDeclaration generates a Go type declaration for a BTF type. -func (gf *GoFormatter) TypeDeclaration(name string, typ Type) (string, error) { - gf.w.Reset() - if err := gf.writeTypeDecl(name, typ); err != nil { - return "", err - } - return gf.w.String(), nil -} - -func (gf *GoFormatter) identifier(s string) string { - if gf.Identifier != nil { - return gf.Identifier(s) - } - - return s -} - -func (gf *GoFormatter) enumIdentifier(name, element string) string { - if gf.EnumIdentifier != nil { - return gf.EnumIdentifier(name, element) - } - - return name + gf.identifier(element) -} - -// writeTypeDecl outputs a declaration of the given type. -// -// It encodes https://golang.org/ref/spec#Type_declarations: -// -// type foo struct { bar uint32; } -// type bar int32 -func (gf *GoFormatter) writeTypeDecl(name string, typ Type) error { - if name == "" { - return fmt.Errorf("need a name for type %s", typ) - } - - typ = skipQualifiers(typ) - fmt.Fprintf(&gf.w, "type %s ", name) - if err := gf.writeTypeLit(typ, 0); err != nil { - return err - } - - e, ok := typ.(*Enum) - if !ok || len(e.Values) == 0 { - return nil - } - - gf.w.WriteString("; const ( ") - for _, ev := range e.Values { - id := gf.enumIdentifier(name, ev.Name) - var value any - if e.Signed { - value = int64(ev.Value) - } else { - value = ev.Value - } - fmt.Fprintf(&gf.w, "%s %s = %d; ", id, name, value) - } - gf.w.WriteString(")") - - return nil -} - -// writeType outputs the name of a named type or a literal describing the type. -// -// It encodes https://golang.org/ref/spec#Types. -// -// foo (if foo is a named type) -// uint32 -func (gf *GoFormatter) writeType(typ Type, depth int) error { - typ = skipQualifiers(typ) - - name := gf.Names[typ] - if name != "" { - gf.w.WriteString(name) - return nil - } - - return gf.writeTypeLit(typ, depth) -} - -// writeTypeLit outputs a literal describing the type. -// -// The function ignores named types. -// -// It encodes https://golang.org/ref/spec#TypeLit. -// -// struct { bar uint32; } -// uint32 -func (gf *GoFormatter) writeTypeLit(typ Type, depth int) error { - depth++ - if depth > maxResolveDepth { - return errNestedTooDeep - } - - var err error - switch v := skipQualifiers(typ).(type) { - case *Int: - err = gf.writeIntLit(v) - - case *Enum: - if !v.Signed { - gf.w.WriteRune('u') - } - switch v.Size { - case 1: - gf.w.WriteString("int8") - case 2: - gf.w.WriteString("int16") - case 4: - gf.w.WriteString("int32") - case 8: - gf.w.WriteString("int64") - default: - err = fmt.Errorf("invalid enum size %d", v.Size) - } - - case *Typedef: - err = gf.writeType(v.Type, depth) - - case *Array: - fmt.Fprintf(&gf.w, "[%d]", v.Nelems) - err = gf.writeType(v.Type, depth) - - case *Struct: - err = gf.writeStructLit(v.Size, v.Members, depth) - - case *Union: - // Always choose the first member to represent the union in Go. - err = gf.writeStructLit(v.Size, v.Members[:1], depth) - - case *Datasec: - err = gf.writeDatasecLit(v, depth) - - default: - return fmt.Errorf("type %T: %w", v, ErrNotSupported) - } - - if err != nil { - return fmt.Errorf("%s: %w", typ, err) - } - - return nil -} - -func (gf *GoFormatter) writeIntLit(i *Int) error { - bits := i.Size * 8 - switch i.Encoding { - case Bool: - if i.Size != 1 { - return fmt.Errorf("bool with size %d", i.Size) - } - gf.w.WriteString("bool") - case Char: - if i.Size != 1 { - return fmt.Errorf("char with size %d", i.Size) - } - // BTF doesn't have a way to specify the signedness of a char. Assume - // we are dealing with unsigned, since this works nicely with []byte - // in Go code. - fallthrough - case Unsigned, Signed: - stem := "uint" - if i.Encoding == Signed { - stem = "int" - } - if i.Size > 8 { - fmt.Fprintf(&gf.w, "[%d]byte /* %s%d */", i.Size, stem, i.Size*8) - } else { - fmt.Fprintf(&gf.w, "%s%d", stem, bits) - } - default: - return fmt.Errorf("can't encode %s", i.Encoding) - } - return nil -} - -func (gf *GoFormatter) writeStructLit(size uint32, members []Member, depth int) error { - gf.w.WriteString("struct { ") - - prevOffset := uint32(0) - skippedBitfield := false - for i, m := range members { - if m.BitfieldSize > 0 { - skippedBitfield = true - continue - } - - offset := m.Offset.Bytes() - if n := offset - prevOffset; skippedBitfield && n > 0 { - fmt.Fprintf(&gf.w, "_ [%d]byte /* unsupported bitfield */; ", n) - } else { - gf.writePadding(n) - } - - fieldSize, err := Sizeof(m.Type) - if err != nil { - return fmt.Errorf("field %d: %w", i, err) - } - - prevOffset = offset + uint32(fieldSize) - if prevOffset > size { - return fmt.Errorf("field %d of size %d exceeds type size %d", i, fieldSize, size) - } - - if err := gf.writeStructField(m, depth); err != nil { - return fmt.Errorf("field %d: %w", i, err) - } - } - - gf.writePadding(size - prevOffset) - gf.w.WriteString("}") - return nil -} - -func (gf *GoFormatter) writeStructField(m Member, depth int) error { - if m.BitfieldSize > 0 { - return fmt.Errorf("bitfields are not supported") - } - if m.Offset%8 != 0 { - return fmt.Errorf("unsupported offset %d", m.Offset) - } - - if m.Name == "" { - // Special case a nested anonymous union like - // struct foo { union { int bar; int baz }; } - // by replacing the whole union with its first member. - union, ok := m.Type.(*Union) - if !ok { - return fmt.Errorf("anonymous fields are not supported") - - } - - if len(union.Members) == 0 { - return errors.New("empty anonymous union") - } - - depth++ - if depth > maxResolveDepth { - return errNestedTooDeep - } - - m := union.Members[0] - size, err := Sizeof(m.Type) - if err != nil { - return err - } - - if err := gf.writeStructField(m, depth); err != nil { - return err - } - - gf.writePadding(union.Size - uint32(size)) - return nil - - } - - fmt.Fprintf(&gf.w, "%s ", gf.identifier(m.Name)) - - if err := gf.writeType(m.Type, depth); err != nil { - return err - } - - gf.w.WriteString("; ") - return nil -} - -func (gf *GoFormatter) writeDatasecLit(ds *Datasec, depth int) error { - gf.w.WriteString("struct { ") - - prevOffset := uint32(0) - for i, vsi := range ds.Vars { - v, ok := vsi.Type.(*Var) - if !ok { - return fmt.Errorf("can't format %s as part of data section", vsi.Type) - } - - if v.Linkage != GlobalVar { - // Ignore static, extern, etc. for now. - continue - } - - if v.Name == "" { - return fmt.Errorf("variable %d: empty name", i) - } - - gf.writePadding(vsi.Offset - prevOffset) - prevOffset = vsi.Offset + vsi.Size - - fmt.Fprintf(&gf.w, "%s ", gf.identifier(v.Name)) - - if err := gf.writeType(v.Type, depth); err != nil { - return fmt.Errorf("variable %d: %w", i, err) - } - - gf.w.WriteString("; ") - } - - gf.writePadding(ds.Size - prevOffset) - gf.w.WriteString("}") - return nil -} - -func (gf *GoFormatter) writePadding(bytes uint32) { - if bytes > 0 { - fmt.Fprintf(&gf.w, "_ [%d]byte; ", bytes) - } -} - -func skipQualifiers(typ Type) Type { - result := typ - for depth := 0; depth <= maxResolveDepth; depth++ { - switch v := (result).(type) { - case qualifier: - result = v.qualify() - default: - return result - } - } - return &cycle{typ} -} diff --git a/vendor/github.com/cilium/ebpf/btf/handle.go b/vendor/github.com/cilium/ebpf/btf/handle.go deleted file mode 100644 index b6b3e87f5..000000000 --- a/vendor/github.com/cilium/ebpf/btf/handle.go +++ /dev/null @@ -1,287 +0,0 @@ -package btf - -import ( - "bytes" - "errors" - "fmt" - "math" - "os" - - "github.com/cilium/ebpf/internal" - "github.com/cilium/ebpf/internal/sys" - "github.com/cilium/ebpf/internal/unix" -) - -// Handle is a reference to BTF loaded into the kernel. -type Handle struct { - fd *sys.FD - - // Size of the raw BTF in bytes. - size uint32 - - needsKernelBase bool -} - -// NewHandle loads the contents of a [Builder] into the kernel. -// -// Returns an error wrapping ErrNotSupported if the kernel doesn't support BTF. -func NewHandle(b *Builder) (*Handle, error) { - small := getByteSlice() - defer putByteSlice(small) - - buf, err := b.Marshal(*small, KernelMarshalOptions()) - if err != nil { - return nil, fmt.Errorf("marshal BTF: %w", err) - } - - return NewHandleFromRawBTF(buf) -} - -// NewHandleFromRawBTF loads raw BTF into the kernel. -// -// Returns an error wrapping ErrNotSupported if the kernel doesn't support BTF. -func NewHandleFromRawBTF(btf []byte) (*Handle, error) { - if uint64(len(btf)) > math.MaxUint32 { - return nil, errors.New("BTF exceeds the maximum size") - } - - attr := &sys.BtfLoadAttr{ - Btf: sys.NewSlicePointer(btf), - BtfSize: uint32(len(btf)), - } - - fd, err := sys.BtfLoad(attr) - if err == nil { - return &Handle{fd, attr.BtfSize, false}, nil - } - - if err := haveBTF(); err != nil { - return nil, err - } - - logBuf := make([]byte, 64*1024) - attr.BtfLogBuf = sys.NewSlicePointer(logBuf) - attr.BtfLogSize = uint32(len(logBuf)) - attr.BtfLogLevel = 1 - - // Up until at least kernel 6.0, the BTF verifier does not return ENOSPC - // if there are other verification errors. ENOSPC is only returned when - // the BTF blob is correct, a log was requested, and the provided buffer - // is too small. - _, ve := sys.BtfLoad(attr) - return nil, internal.ErrorWithLog("load btf", err, logBuf, errors.Is(ve, unix.ENOSPC)) -} - -// NewHandleFromID returns the BTF handle for a given id. -// -// Prefer calling [ebpf.Program.Handle] or [ebpf.Map.Handle] if possible. -// -// Returns ErrNotExist, if there is no BTF with the given id. -// -// Requires CAP_SYS_ADMIN. -func NewHandleFromID(id ID) (*Handle, error) { - fd, err := sys.BtfGetFdById(&sys.BtfGetFdByIdAttr{ - Id: uint32(id), - }) - if err != nil { - return nil, fmt.Errorf("get FD for ID %d: %w", id, err) - } - - info, err := newHandleInfoFromFD(fd) - if err != nil { - _ = fd.Close() - return nil, err - } - - return &Handle{fd, info.size, info.IsModule()}, nil -} - -// Spec parses the kernel BTF into Go types. -// -// base must contain type information for vmlinux if the handle is for -// a kernel module. It may be nil otherwise. -func (h *Handle) Spec(base *Spec) (*Spec, error) { - var btfInfo sys.BtfInfo - btfBuffer := make([]byte, h.size) - btfInfo.Btf, btfInfo.BtfSize = sys.NewSlicePointerLen(btfBuffer) - - if err := sys.ObjInfo(h.fd, &btfInfo); err != nil { - return nil, err - } - - if h.needsKernelBase && base == nil { - return nil, fmt.Errorf("missing base types") - } - - return loadRawSpec(bytes.NewReader(btfBuffer), internal.NativeEndian, base) -} - -// Close destroys the handle. -// -// Subsequent calls to FD will return an invalid value. -func (h *Handle) Close() error { - if h == nil { - return nil - } - - return h.fd.Close() -} - -// FD returns the file descriptor for the handle. -func (h *Handle) FD() int { - return h.fd.Int() -} - -// Info returns metadata about the handle. -func (h *Handle) Info() (*HandleInfo, error) { - return newHandleInfoFromFD(h.fd) -} - -// HandleInfo describes a Handle. -type HandleInfo struct { - // ID of this handle in the kernel. The ID is only valid as long as the - // associated handle is kept alive. - ID ID - - // Name is an identifying name for the BTF, currently only used by the - // kernel. - Name string - - // IsKernel is true if the BTF originated with the kernel and not - // userspace. - IsKernel bool - - // Size of the raw BTF in bytes. - size uint32 -} - -func newHandleInfoFromFD(fd *sys.FD) (*HandleInfo, error) { - // We invoke the syscall once with a empty BTF and name buffers to get size - // information to allocate buffers. Then we invoke it a second time with - // buffers to receive the data. - var btfInfo sys.BtfInfo - if err := sys.ObjInfo(fd, &btfInfo); err != nil { - return nil, fmt.Errorf("get BTF info for fd %s: %w", fd, err) - } - - if btfInfo.NameLen > 0 { - // NameLen doesn't account for the terminating NUL. - btfInfo.NameLen++ - } - - // Don't pull raw BTF by default, since it may be quite large. - btfSize := btfInfo.BtfSize - btfInfo.BtfSize = 0 - - nameBuffer := make([]byte, btfInfo.NameLen) - btfInfo.Name, btfInfo.NameLen = sys.NewSlicePointerLen(nameBuffer) - if err := sys.ObjInfo(fd, &btfInfo); err != nil { - return nil, err - } - - return &HandleInfo{ - ID: ID(btfInfo.Id), - Name: unix.ByteSliceToString(nameBuffer), - IsKernel: btfInfo.KernelBtf != 0, - size: btfSize, - }, nil -} - -// IsVmlinux returns true if the BTF is for the kernel itself. -func (i *HandleInfo) IsVmlinux() bool { - return i.IsKernel && i.Name == "vmlinux" -} - -// IsModule returns true if the BTF is for a kernel module. -func (i *HandleInfo) IsModule() bool { - return i.IsKernel && i.Name != "vmlinux" -} - -// HandleIterator allows enumerating BTF blobs loaded into the kernel. -type HandleIterator struct { - // The ID of the current handle. Only valid after a call to Next. - ID ID - // The current Handle. Only valid until a call to Next. - // See Take if you want to retain the handle. - Handle *Handle - err error -} - -// Next retrieves a handle for the next BTF object. -// -// Returns true if another BTF object was found. Call [HandleIterator.Err] after -// the function returns false. -func (it *HandleIterator) Next() bool { - id := it.ID - for { - attr := &sys.BtfGetNextIdAttr{Id: id} - err := sys.BtfGetNextId(attr) - if errors.Is(err, os.ErrNotExist) { - // There are no more BTF objects. - break - } else if err != nil { - it.err = fmt.Errorf("get next BTF ID: %w", err) - break - } - - id = attr.NextId - handle, err := NewHandleFromID(id) - if errors.Is(err, os.ErrNotExist) { - // Try again with the next ID. - continue - } else if err != nil { - it.err = fmt.Errorf("retrieve handle for ID %d: %w", id, err) - break - } - - it.Handle.Close() - it.ID, it.Handle = id, handle - return true - } - - // No more handles or we encountered an error. - it.Handle.Close() - it.Handle = nil - return false -} - -// Take the ownership of the current handle. -// -// It's the callers responsibility to close the handle. -func (it *HandleIterator) Take() *Handle { - handle := it.Handle - it.Handle = nil - return handle -} - -// Err returns an error if iteration failed for some reason. -func (it *HandleIterator) Err() error { - return it.err -} - -// FindHandle returns the first handle for which predicate returns true. -// -// Requires CAP_SYS_ADMIN. -// -// Returns an error wrapping ErrNotFound if predicate never returns true or if -// there is no BTF loaded into the kernel. -func FindHandle(predicate func(info *HandleInfo) bool) (*Handle, error) { - it := new(HandleIterator) - defer it.Handle.Close() - - for it.Next() { - info, err := it.Handle.Info() - if err != nil { - return nil, fmt.Errorf("info for ID %d: %w", it.ID, err) - } - - if predicate(info) { - return it.Take(), nil - } - } - if err := it.Err(); err != nil { - return nil, fmt.Errorf("iterate handles: %w", err) - } - - return nil, fmt.Errorf("find handle: %w", ErrNotFound) -} diff --git a/vendor/github.com/cilium/ebpf/btf/kernel.go b/vendor/github.com/cilium/ebpf/btf/kernel.go deleted file mode 100644 index 8584ebcb9..000000000 --- a/vendor/github.com/cilium/ebpf/btf/kernel.go +++ /dev/null @@ -1,159 +0,0 @@ -package btf - -import ( - "errors" - "fmt" - "os" - "path/filepath" - "sync" - - "github.com/cilium/ebpf/internal" - "github.com/cilium/ebpf/internal/kallsyms" -) - -var kernelBTF = struct { - sync.RWMutex - kernel *Spec - modules map[string]*Spec -}{ - modules: make(map[string]*Spec), -} - -// FlushKernelSpec removes any cached kernel type information. -func FlushKernelSpec() { - kallsyms.FlushKernelModuleCache() - - kernelBTF.Lock() - defer kernelBTF.Unlock() - - kernelBTF.kernel = nil - kernelBTF.modules = make(map[string]*Spec) -} - -// LoadKernelSpec returns the current kernel's BTF information. -// -// Defaults to /sys/kernel/btf/vmlinux and falls back to scanning the file system -// for vmlinux ELFs. Returns an error wrapping ErrNotSupported if BTF is not enabled. -func LoadKernelSpec() (*Spec, error) { - kernelBTF.RLock() - spec := kernelBTF.kernel - kernelBTF.RUnlock() - - if spec == nil { - kernelBTF.Lock() - defer kernelBTF.Unlock() - - spec = kernelBTF.kernel - } - - if spec != nil { - return spec.Copy(), nil - } - - spec, _, err := loadKernelSpec() - if err != nil { - return nil, err - } - - kernelBTF.kernel = spec - return spec.Copy(), nil -} - -// LoadKernelModuleSpec returns the BTF information for the named kernel module. -// -// Defaults to /sys/kernel/btf/. -// Returns an error wrapping ErrNotSupported if BTF is not enabled. -// Returns an error wrapping fs.ErrNotExist if BTF for the specific module doesn't exist. -func LoadKernelModuleSpec(module string) (*Spec, error) { - kernelBTF.RLock() - spec := kernelBTF.modules[module] - kernelBTF.RUnlock() - - if spec != nil { - return spec.Copy(), nil - } - - base, err := LoadKernelSpec() - if err != nil { - return nil, fmt.Errorf("load kernel spec: %w", err) - } - - kernelBTF.Lock() - defer kernelBTF.Unlock() - - if spec = kernelBTF.modules[module]; spec != nil { - return spec.Copy(), nil - } - - spec, err = loadKernelModuleSpec(module, base) - if err != nil { - return nil, err - } - - kernelBTF.modules[module] = spec - return spec.Copy(), nil -} - -func loadKernelSpec() (_ *Spec, fallback bool, _ error) { - fh, err := os.Open("/sys/kernel/btf/vmlinux") - if err == nil { - defer fh.Close() - - spec, err := loadRawSpec(fh, internal.NativeEndian, nil) - return spec, false, err - } - - file, err := findVMLinux() - if err != nil { - return nil, false, err - } - defer file.Close() - - spec, err := LoadSpecFromReader(file) - return spec, true, err -} - -func loadKernelModuleSpec(module string, base *Spec) (*Spec, error) { - dir, file := filepath.Split(module) - if dir != "" || filepath.Ext(file) != "" { - return nil, fmt.Errorf("invalid module name %q", module) - } - - fh, err := os.Open(filepath.Join("/sys/kernel/btf", module)) - if err != nil { - return nil, err - } - defer fh.Close() - - return loadRawSpec(fh, internal.NativeEndian, base) -} - -// findVMLinux scans multiple well-known paths for vmlinux kernel images. -func findVMLinux() (*os.File, error) { - release, err := internal.KernelRelease() - if err != nil { - return nil, err - } - - // use same list of locations as libbpf - // https://github.com/libbpf/libbpf/blob/9a3a42608dbe3731256a5682a125ac1e23bced8f/src/btf.c#L3114-L3122 - locations := []string{ - "/boot/vmlinux-%s", - "/lib/modules/%s/vmlinux-%[1]s", - "/lib/modules/%s/build/vmlinux", - "/usr/lib/modules/%s/kernel/vmlinux", - "/usr/lib/debug/boot/vmlinux-%s", - "/usr/lib/debug/boot/vmlinux-%s.debug", - "/usr/lib/debug/lib/modules/%s/vmlinux", - } - - for _, loc := range locations { - file, err := os.Open(fmt.Sprintf(loc, release)) - if errors.Is(err, os.ErrNotExist) { - continue - } - return file, err - } - - return nil, fmt.Errorf("no BTF found for kernel version %s: %w", release, internal.ErrNotSupported) -} diff --git a/vendor/github.com/cilium/ebpf/btf/marshal.go b/vendor/github.com/cilium/ebpf/btf/marshal.go deleted file mode 100644 index f14cfa6e9..000000000 --- a/vendor/github.com/cilium/ebpf/btf/marshal.go +++ /dev/null @@ -1,611 +0,0 @@ -package btf - -import ( - "bytes" - "encoding/binary" - "errors" - "fmt" - "maps" - "math" - "slices" - "sync" - - "github.com/cilium/ebpf/internal" -) - -type MarshalOptions struct { - // Target byte order. Defaults to the system's native endianness. - Order binary.ByteOrder - // Remove function linkage information for compatibility with <5.6 kernels. - StripFuncLinkage bool - // Replace Enum64 with a placeholder for compatibility with <6.0 kernels. - ReplaceEnum64 bool - // Prevent the "No type found" error when loading BTF without any types. - PreventNoTypeFound bool -} - -// KernelMarshalOptions will generate BTF suitable for the current kernel. -func KernelMarshalOptions() *MarshalOptions { - return &MarshalOptions{ - Order: internal.NativeEndian, - StripFuncLinkage: haveFuncLinkage() != nil, - ReplaceEnum64: haveEnum64() != nil, - PreventNoTypeFound: true, // All current kernels require this. - } -} - -// encoder turns Types into raw BTF. -type encoder struct { - MarshalOptions - - pending internal.Deque[Type] - buf *bytes.Buffer - strings *stringTableBuilder - ids map[Type]TypeID - visited map[Type]struct{} - lastID TypeID -} - -var bufferPool = sync.Pool{ - New: func() any { - buf := make([]byte, btfHeaderLen+128) - return &buf - }, -} - -func getByteSlice() *[]byte { - return bufferPool.Get().(*[]byte) -} - -func putByteSlice(buf *[]byte) { - *buf = (*buf)[:0] - bufferPool.Put(buf) -} - -// Builder turns Types into raw BTF. -// -// The default value may be used and represents an empty BTF blob. Void is -// added implicitly if necessary. -type Builder struct { - // Explicitly added types. - types []Type - // IDs for all added types which the user knows about. - stableIDs map[Type]TypeID - // Explicitly added strings. - strings *stringTableBuilder -} - -// NewBuilder creates a Builder from a list of types. -// -// It is more efficient than calling [Add] individually. -// -// Returns an error if adding any of the types fails. -func NewBuilder(types []Type) (*Builder, error) { - b := &Builder{ - make([]Type, 0, len(types)), - make(map[Type]TypeID, len(types)), - nil, - } - - for _, typ := range types { - _, err := b.Add(typ) - if err != nil { - return nil, fmt.Errorf("add %s: %w", typ, err) - } - } - - return b, nil -} - -// Empty returns true if neither types nor strings have been added. -func (b *Builder) Empty() bool { - return len(b.types) == 0 && (b.strings == nil || b.strings.Length() == 0) -} - -// Add a Type and allocate a stable ID for it. -// -// Adding the identical Type multiple times is valid and will return the same ID. -// -// See [Type] for details on identity. -func (b *Builder) Add(typ Type) (TypeID, error) { - if b.stableIDs == nil { - b.stableIDs = make(map[Type]TypeID) - } - - if _, ok := typ.(*Void); ok { - // Equality is weird for void, since it is a zero sized type. - return 0, nil - } - - if ds, ok := typ.(*Datasec); ok { - if err := datasecResolveWorkaround(b, ds); err != nil { - return 0, err - } - } - - id, ok := b.stableIDs[typ] - if ok { - return id, nil - } - - b.types = append(b.types, typ) - - id = TypeID(len(b.types)) - if int(id) != len(b.types) { - return 0, fmt.Errorf("no more type IDs") - } - - b.stableIDs[typ] = id - return id, nil -} - -// Marshal encodes all types in the Marshaler into BTF wire format. -// -// opts may be nil. -func (b *Builder) Marshal(buf []byte, opts *MarshalOptions) ([]byte, error) { - stb := b.strings - if stb == nil { - // Assume that most types are named. This makes encoding large BTF like - // vmlinux a lot cheaper. - stb = newStringTableBuilder(len(b.types)) - } else { - // Avoid modifying the Builder's string table. - stb = b.strings.Copy() - } - - if opts == nil { - opts = &MarshalOptions{Order: internal.NativeEndian} - } - - // Reserve space for the BTF header. - buf = slices.Grow(buf, btfHeaderLen)[:btfHeaderLen] - - w := internal.NewBuffer(buf) - defer internal.PutBuffer(w) - - e := encoder{ - MarshalOptions: *opts, - buf: w, - strings: stb, - lastID: TypeID(len(b.types)), - visited: make(map[Type]struct{}, len(b.types)), - ids: maps.Clone(b.stableIDs), - } - - if e.ids == nil { - e.ids = make(map[Type]TypeID) - } - - types := b.types - if len(types) == 0 && stb.Length() > 0 && opts.PreventNoTypeFound { - // We have strings that need to be written out, - // but no types (besides the implicit Void). - // Kernels as recent as v6.7 refuse to load such BTF - // with a "No type found" error in the log. - // Fix this by adding a dummy type. - types = []Type{&Int{Size: 0}} - } - - // Ensure that types are marshaled in the exact order they were Add()ed. - // Otherwise the ID returned from Add() won't match. - e.pending.Grow(len(types)) - for _, typ := range types { - e.pending.Push(typ) - } - - if err := e.deflatePending(); err != nil { - return nil, err - } - - length := e.buf.Len() - typeLen := uint32(length - btfHeaderLen) - - stringLen := e.strings.Length() - buf = e.strings.AppendEncoded(e.buf.Bytes()) - - // Fill out the header, and write it out. - header := &btfHeader{ - Magic: btfMagic, - Version: 1, - Flags: 0, - HdrLen: uint32(btfHeaderLen), - TypeOff: 0, - TypeLen: typeLen, - StringOff: typeLen, - StringLen: uint32(stringLen), - } - - err := binary.Write(sliceWriter(buf[:btfHeaderLen]), e.Order, header) - if err != nil { - return nil, fmt.Errorf("write header: %v", err) - } - - return buf, nil -} - -// addString adds a string to the resulting BTF. -// -// Adding the same string multiple times will return the same result. -// -// Returns an identifier into the string table or an error if the string -// contains invalid characters. -func (b *Builder) addString(str string) (uint32, error) { - if b.strings == nil { - b.strings = newStringTableBuilder(0) - } - - return b.strings.Add(str) -} - -func (e *encoder) allocateIDs(root Type) (err error) { - visitInPostorder(root, e.visited, func(typ Type) bool { - if _, ok := typ.(*Void); ok { - return true - } - - if _, ok := e.ids[typ]; ok { - return true - } - - id := e.lastID + 1 - if id < e.lastID { - err = errors.New("type ID overflow") - return false - } - - e.pending.Push(typ) - e.ids[typ] = id - e.lastID = id - return true - }) - return -} - -// id returns the ID for the given type or panics with an error. -func (e *encoder) id(typ Type) TypeID { - if _, ok := typ.(*Void); ok { - return 0 - } - - id, ok := e.ids[typ] - if !ok { - panic(fmt.Errorf("no ID for type %v", typ)) - } - - return id -} - -func (e *encoder) deflatePending() error { - // Declare root outside of the loop to avoid repeated heap allocations. - var root Type - - for !e.pending.Empty() { - root = e.pending.Shift() - - // Allocate IDs for all children of typ, including transitive dependencies. - if err := e.allocateIDs(root); err != nil { - return err - } - - if err := e.deflateType(root); err != nil { - id := e.ids[root] - return fmt.Errorf("deflate %v with ID %d: %w", root, id, err) - } - } - - return nil -} - -func (e *encoder) deflateType(typ Type) (err error) { - defer func() { - if r := recover(); r != nil { - var ok bool - err, ok = r.(error) - if !ok { - panic(r) - } - } - }() - - var raw rawType - raw.NameOff, err = e.strings.Add(typ.TypeName()) - if err != nil { - return err - } - - switch v := typ.(type) { - case *Void: - return errors.New("Void is implicit in BTF wire format") - - case *Int: - raw.SetKind(kindInt) - raw.SetSize(v.Size) - - var bi btfInt - bi.SetEncoding(v.Encoding) - // We need to set bits in addition to size, since btf_type_int_is_regular - // otherwise flags this as a bitfield. - bi.SetBits(byte(v.Size) * 8) - raw.data = bi - - case *Pointer: - raw.SetKind(kindPointer) - raw.SetType(e.id(v.Target)) - - case *Array: - raw.SetKind(kindArray) - raw.data = &btfArray{ - e.id(v.Type), - e.id(v.Index), - v.Nelems, - } - - case *Struct: - raw.SetKind(kindStruct) - raw.SetSize(v.Size) - raw.data, err = e.convertMembers(&raw.btfType, v.Members) - - case *Union: - err = e.deflateUnion(&raw, v) - - case *Enum: - if v.Size == 8 { - err = e.deflateEnum64(&raw, v) - } else { - err = e.deflateEnum(&raw, v) - } - - case *Fwd: - raw.SetKind(kindForward) - raw.SetFwdKind(v.Kind) - - case *Typedef: - raw.SetKind(kindTypedef) - raw.SetType(e.id(v.Type)) - - case *Volatile: - raw.SetKind(kindVolatile) - raw.SetType(e.id(v.Type)) - - case *Const: - raw.SetKind(kindConst) - raw.SetType(e.id(v.Type)) - - case *Restrict: - raw.SetKind(kindRestrict) - raw.SetType(e.id(v.Type)) - - case *Func: - raw.SetKind(kindFunc) - raw.SetType(e.id(v.Type)) - if !e.StripFuncLinkage { - raw.SetLinkage(v.Linkage) - } - - case *FuncProto: - raw.SetKind(kindFuncProto) - raw.SetType(e.id(v.Return)) - raw.SetVlen(len(v.Params)) - raw.data, err = e.deflateFuncParams(v.Params) - - case *Var: - raw.SetKind(kindVar) - raw.SetType(e.id(v.Type)) - raw.data = btfVariable{uint32(v.Linkage)} - - case *Datasec: - raw.SetKind(kindDatasec) - raw.SetSize(v.Size) - raw.SetVlen(len(v.Vars)) - raw.data = e.deflateVarSecinfos(v.Vars) - - case *Float: - raw.SetKind(kindFloat) - raw.SetSize(v.Size) - - case *declTag: - raw.SetKind(kindDeclTag) - raw.SetType(e.id(v.Type)) - raw.data = &btfDeclTag{uint32(v.Index)} - raw.NameOff, err = e.strings.Add(v.Value) - - case *typeTag: - raw.SetKind(kindTypeTag) - raw.SetType(e.id(v.Type)) - raw.NameOff, err = e.strings.Add(v.Value) - - default: - return fmt.Errorf("don't know how to deflate %T", v) - } - - if err != nil { - return err - } - - return raw.Marshal(e.buf, e.Order) -} - -func (e *encoder) deflateUnion(raw *rawType, union *Union) (err error) { - raw.SetKind(kindUnion) - raw.SetSize(union.Size) - raw.data, err = e.convertMembers(&raw.btfType, union.Members) - return -} - -func (e *encoder) convertMembers(header *btfType, members []Member) ([]btfMember, error) { - bms := make([]btfMember, 0, len(members)) - isBitfield := false - for _, member := range members { - isBitfield = isBitfield || member.BitfieldSize > 0 - - offset := member.Offset - if isBitfield { - offset = member.BitfieldSize<<24 | (member.Offset & 0xffffff) - } - - nameOff, err := e.strings.Add(member.Name) - if err != nil { - return nil, err - } - - bms = append(bms, btfMember{ - nameOff, - e.id(member.Type), - uint32(offset), - }) - } - - header.SetVlen(len(members)) - header.SetBitfield(isBitfield) - return bms, nil -} - -func (e *encoder) deflateEnum(raw *rawType, enum *Enum) (err error) { - raw.SetKind(kindEnum) - raw.SetSize(enum.Size) - raw.SetVlen(len(enum.Values)) - // Signedness appeared together with ENUM64 support. - raw.SetSigned(enum.Signed && !e.ReplaceEnum64) - raw.data, err = e.deflateEnumValues(enum) - return -} - -func (e *encoder) deflateEnumValues(enum *Enum) ([]btfEnum, error) { - bes := make([]btfEnum, 0, len(enum.Values)) - for _, value := range enum.Values { - nameOff, err := e.strings.Add(value.Name) - if err != nil { - return nil, err - } - - if enum.Signed { - if signedValue := int64(value.Value); signedValue < math.MinInt32 || signedValue > math.MaxInt32 { - return nil, fmt.Errorf("value %d of enum %q exceeds 32 bits", signedValue, value.Name) - } - } else { - if value.Value > math.MaxUint32 { - return nil, fmt.Errorf("value %d of enum %q exceeds 32 bits", value.Value, value.Name) - } - } - - bes = append(bes, btfEnum{ - nameOff, - uint32(value.Value), - }) - } - - return bes, nil -} - -func (e *encoder) deflateEnum64(raw *rawType, enum *Enum) (err error) { - if e.ReplaceEnum64 { - // Replace the ENUM64 with a union of fields with the correct size. - // This matches libbpf behaviour on purpose. - placeholder := &Int{ - "enum64_placeholder", - enum.Size, - Unsigned, - } - if enum.Signed { - placeholder.Encoding = Signed - } - if err := e.allocateIDs(placeholder); err != nil { - return fmt.Errorf("add enum64 placeholder: %w", err) - } - - members := make([]Member, 0, len(enum.Values)) - for _, v := range enum.Values { - members = append(members, Member{ - Name: v.Name, - Type: placeholder, - }) - } - - return e.deflateUnion(raw, &Union{enum.Name, enum.Size, members}) - } - - raw.SetKind(kindEnum64) - raw.SetSize(enum.Size) - raw.SetVlen(len(enum.Values)) - raw.SetSigned(enum.Signed) - raw.data, err = e.deflateEnum64Values(enum.Values) - return -} - -func (e *encoder) deflateEnum64Values(values []EnumValue) ([]btfEnum64, error) { - bes := make([]btfEnum64, 0, len(values)) - for _, value := range values { - nameOff, err := e.strings.Add(value.Name) - if err != nil { - return nil, err - } - - bes = append(bes, btfEnum64{ - nameOff, - uint32(value.Value), - uint32(value.Value >> 32), - }) - } - - return bes, nil -} - -func (e *encoder) deflateFuncParams(params []FuncParam) ([]btfParam, error) { - bps := make([]btfParam, 0, len(params)) - for _, param := range params { - nameOff, err := e.strings.Add(param.Name) - if err != nil { - return nil, err - } - - bps = append(bps, btfParam{ - nameOff, - e.id(param.Type), - }) - } - return bps, nil -} - -func (e *encoder) deflateVarSecinfos(vars []VarSecinfo) []btfVarSecinfo { - vsis := make([]btfVarSecinfo, 0, len(vars)) - for _, v := range vars { - vsis = append(vsis, btfVarSecinfo{ - e.id(v.Type), - v.Offset, - v.Size, - }) - } - return vsis -} - -// MarshalMapKV creates a BTF object containing a map key and value. -// -// The function is intended for the use of the ebpf package and may be removed -// at any point in time. -func MarshalMapKV(key, value Type) (_ *Handle, keyID, valueID TypeID, err error) { - var b Builder - - if key != nil { - keyID, err = b.Add(key) - if err != nil { - return nil, 0, 0, fmt.Errorf("add key type: %w", err) - } - } - - if value != nil { - valueID, err = b.Add(value) - if err != nil { - return nil, 0, 0, fmt.Errorf("add value type: %w", err) - } - } - - handle, err := NewHandle(&b) - if err != nil { - // Check for 'full' map BTF support, since kernels between 4.18 and 5.2 - // already support BTF blobs for maps without Var or Datasec just fine. - if err := haveMapBTF(); err != nil { - return nil, 0, 0, err - } - } - return handle, keyID, valueID, err -} diff --git a/vendor/github.com/cilium/ebpf/btf/strings.go b/vendor/github.com/cilium/ebpf/btf/strings.go deleted file mode 100644 index 7c31461c3..000000000 --- a/vendor/github.com/cilium/ebpf/btf/strings.go +++ /dev/null @@ -1,198 +0,0 @@ -package btf - -import ( - "bufio" - "bytes" - "errors" - "fmt" - "io" - "maps" - "slices" - "strings" -) - -type stringTable struct { - base *stringTable - offsets []uint32 - prevIdx int - strings []string -} - -// sizedReader is implemented by bytes.Reader, io.SectionReader, strings.Reader, etc. -type sizedReader interface { - io.Reader - Size() int64 -} - -func readStringTable(r sizedReader, base *stringTable) (*stringTable, error) { - // When parsing split BTF's string table, the first entry offset is derived - // from the last entry offset of the base BTF. - firstStringOffset := uint32(0) - if base != nil { - idx := len(base.offsets) - 1 - firstStringOffset = base.offsets[idx] + uint32(len(base.strings[idx])) + 1 - } - - // Derived from vmlinux BTF. - const averageStringLength = 16 - - n := int(r.Size() / averageStringLength) - offsets := make([]uint32, 0, n) - strings := make([]string, 0, n) - - offset := firstStringOffset - scanner := bufio.NewScanner(r) - scanner.Split(splitNull) - for scanner.Scan() { - str := scanner.Text() - offsets = append(offsets, offset) - strings = append(strings, str) - offset += uint32(len(str)) + 1 - } - if err := scanner.Err(); err != nil { - return nil, err - } - - if len(strings) == 0 { - return nil, errors.New("string table is empty") - } - - if firstStringOffset == 0 && strings[0] != "" { - return nil, errors.New("first item in string table is non-empty") - } - - return &stringTable{base, offsets, 0, strings}, nil -} - -func splitNull(data []byte, atEOF bool) (advance int, token []byte, err error) { - i := bytes.IndexByte(data, 0) - if i == -1 { - if atEOF && len(data) > 0 { - return 0, nil, errors.New("string table isn't null terminated") - } - return 0, nil, nil - } - - return i + 1, data[:i], nil -} - -func (st *stringTable) Lookup(offset uint32) (string, error) { - if st.base != nil && offset <= st.base.offsets[len(st.base.offsets)-1] { - return st.base.lookup(offset) - } - return st.lookup(offset) -} - -func (st *stringTable) lookup(offset uint32) (string, error) { - // Fast path: zero offset is the empty string, looked up frequently. - if offset == 0 && st.base == nil { - return "", nil - } - - // Accesses tend to be globally increasing, so check if the next string is - // the one we want. This skips the binary search in about 50% of cases. - if st.prevIdx+1 < len(st.offsets) && st.offsets[st.prevIdx+1] == offset { - st.prevIdx++ - return st.strings[st.prevIdx], nil - } - - i, found := slices.BinarySearch(st.offsets, offset) - if !found { - return "", fmt.Errorf("offset %d isn't start of a string", offset) - } - - // Set the new increment index, but only if its greater than the current. - if i > st.prevIdx+1 { - st.prevIdx = i - } - - return st.strings[i], nil -} - -// Num returns the number of strings in the table. -func (st *stringTable) Num() int { - return len(st.strings) -} - -// stringTableBuilder builds BTF string tables. -type stringTableBuilder struct { - length uint32 - strings map[string]uint32 -} - -// newStringTableBuilder creates a builder with the given capacity. -// -// capacity may be zero. -func newStringTableBuilder(capacity int) *stringTableBuilder { - var stb stringTableBuilder - - if capacity == 0 { - // Use the runtime's small default size. - stb.strings = make(map[string]uint32) - } else { - stb.strings = make(map[string]uint32, capacity) - } - - // Ensure that the empty string is at index 0. - stb.append("") - return &stb -} - -// Add a string to the table. -// -// Adding the same string multiple times will only store it once. -func (stb *stringTableBuilder) Add(str string) (uint32, error) { - if strings.IndexByte(str, 0) != -1 { - return 0, fmt.Errorf("string contains null: %q", str) - } - - offset, ok := stb.strings[str] - if ok { - return offset, nil - } - - return stb.append(str), nil -} - -func (stb *stringTableBuilder) append(str string) uint32 { - offset := stb.length - stb.length += uint32(len(str)) + 1 - stb.strings[str] = offset - return offset -} - -// Lookup finds the offset of a string in the table. -// -// Returns an error if str hasn't been added yet. -func (stb *stringTableBuilder) Lookup(str string) (uint32, error) { - offset, ok := stb.strings[str] - if !ok { - return 0, fmt.Errorf("string %q is not in table", str) - } - - return offset, nil -} - -// Length returns the length in bytes. -func (stb *stringTableBuilder) Length() int { - return int(stb.length) -} - -// AppendEncoded appends the string table to the end of the provided buffer. -func (stb *stringTableBuilder) AppendEncoded(buf []byte) []byte { - n := len(buf) - buf = append(buf, make([]byte, stb.Length())...) - strings := buf[n:] - for str, offset := range stb.strings { - copy(strings[offset:], str) - } - return buf -} - -// Copy the string table builder. -func (stb *stringTableBuilder) Copy() *stringTableBuilder { - return &stringTableBuilder{ - stb.length, - maps.Clone(stb.strings), - } -} diff --git a/vendor/github.com/cilium/ebpf/btf/traversal.go b/vendor/github.com/cilium/ebpf/btf/traversal.go deleted file mode 100644 index c39dc66e4..000000000 --- a/vendor/github.com/cilium/ebpf/btf/traversal.go +++ /dev/null @@ -1,123 +0,0 @@ -package btf - -import ( - "fmt" -) - -// Functions to traverse a cyclic graph of types. The below was very useful: -// https://eli.thegreenplace.net/2015/directed-graph-traversal-orderings-and-applications-to-data-flow-analysis/#post-order-and-reverse-post-order - -// Visit all types reachable from root in postorder. -// -// Traversal stops if yield returns false. -// -// Returns false if traversal was aborted. -func visitInPostorder(root Type, visited map[Type]struct{}, yield func(typ Type) bool) bool { - if _, ok := visited[root]; ok { - return true - } - if visited == nil { - visited = make(map[Type]struct{}) - } - visited[root] = struct{}{} - - cont := children(root, func(child *Type) bool { - return visitInPostorder(*child, visited, yield) - }) - if !cont { - return false - } - - return yield(root) -} - -// children calls yield on each child of typ. -// -// Traversal stops if yield returns false. -// -// Returns false if traversal was aborted. -func children(typ Type, yield func(child *Type) bool) bool { - // Explicitly type switch on the most common types to allow the inliner to - // do its work. This avoids allocating intermediate slices from walk() on - // the heap. - switch v := typ.(type) { - case *Void, *Int, *Enum, *Fwd, *Float: - // No children to traverse. - case *Pointer: - if !yield(&v.Target) { - return false - } - case *Array: - if !yield(&v.Index) { - return false - } - if !yield(&v.Type) { - return false - } - case *Struct: - for i := range v.Members { - if !yield(&v.Members[i].Type) { - return false - } - } - case *Union: - for i := range v.Members { - if !yield(&v.Members[i].Type) { - return false - } - } - case *Typedef: - if !yield(&v.Type) { - return false - } - case *Volatile: - if !yield(&v.Type) { - return false - } - case *Const: - if !yield(&v.Type) { - return false - } - case *Restrict: - if !yield(&v.Type) { - return false - } - case *Func: - if !yield(&v.Type) { - return false - } - case *FuncProto: - if !yield(&v.Return) { - return false - } - for i := range v.Params { - if !yield(&v.Params[i].Type) { - return false - } - } - case *Var: - if !yield(&v.Type) { - return false - } - case *Datasec: - for i := range v.Vars { - if !yield(&v.Vars[i].Type) { - return false - } - } - case *declTag: - if !yield(&v.Type) { - return false - } - case *typeTag: - if !yield(&v.Type) { - return false - } - case *cycle: - // cycle has children, but we ignore them deliberately. - default: - panic(fmt.Sprintf("don't know how to walk Type %T", v)) - } - - return true -} diff --git a/vendor/github.com/cilium/ebpf/btf/types.go b/vendor/github.com/cilium/ebpf/btf/types.go deleted file mode 100644 index 3cb9184f0..000000000 --- a/vendor/github.com/cilium/ebpf/btf/types.go +++ /dev/null @@ -1,1315 +0,0 @@ -package btf - -import ( - "encoding/binary" - "errors" - "fmt" - "io" - "math" - "slices" - "strings" - - "github.com/cilium/ebpf/asm" - "github.com/cilium/ebpf/internal" - "github.com/cilium/ebpf/internal/sys" -) - -// Mirrors MAX_RESOLVE_DEPTH in libbpf. -// https://github.com/libbpf/libbpf/blob/e26b84dc330c9644c07428c271ab491b0f01f4e1/src/btf.c#L761 -const maxResolveDepth = 32 - -// TypeID identifies a type in a BTF section. -type TypeID = sys.TypeID - -// Type represents a type described by BTF. -// -// Identity of Type follows the [Go specification]: two Types are considered -// equal if they have the same concrete type and the same dynamic value, aka -// they point at the same location in memory. This means that the following -// Types are considered distinct even though they have the same "shape". -// -// a := &Int{Size: 1} -// b := &Int{Size: 1} -// a != b -// -// [Go specification]: https://go.dev/ref/spec#Comparison_operators -type Type interface { - // Type can be formatted using the %s and %v verbs. %s outputs only the - // identity of the type, without any detail. %v outputs additional detail. - // - // Use the '+' flag to include the address of the type. - // - // Use the width to specify how many levels of detail to output, for example - // %1v will output detail for the root type and a short description of its - // children. %2v would output details of the root type and its children - // as well as a short description of the grandchildren. - fmt.Formatter - - // Name of the type, empty for anonymous types and types that cannot - // carry a name, like Void and Pointer. - TypeName() string - - // Make a copy of the type, without copying Type members. - copy() Type - - // New implementations must update walkType. -} - -var ( - _ Type = (*Int)(nil) - _ Type = (*Struct)(nil) - _ Type = (*Union)(nil) - _ Type = (*Enum)(nil) - _ Type = (*Fwd)(nil) - _ Type = (*Func)(nil) - _ Type = (*Typedef)(nil) - _ Type = (*Var)(nil) - _ Type = (*Datasec)(nil) - _ Type = (*Float)(nil) - _ Type = (*declTag)(nil) - _ Type = (*typeTag)(nil) - _ Type = (*cycle)(nil) -) - -// Void is the unit type of BTF. -type Void struct{} - -func (v *Void) Format(fs fmt.State, verb rune) { formatType(fs, verb, v) } -func (v *Void) TypeName() string { return "" } -func (v *Void) size() uint32 { return 0 } -func (v *Void) copy() Type { return (*Void)(nil) } - -type IntEncoding byte - -// Valid IntEncodings. -// -// These may look like they are flags, but they aren't. -const ( - Unsigned IntEncoding = 0 - Signed IntEncoding = 1 - Char IntEncoding = 2 - Bool IntEncoding = 4 -) - -func (ie IntEncoding) String() string { - switch ie { - case Char: - // NB: There is no way to determine signedness for char. - return "char" - case Bool: - return "bool" - case Signed: - return "signed" - case Unsigned: - return "unsigned" - default: - return fmt.Sprintf("IntEncoding(%d)", byte(ie)) - } -} - -// Int is an integer of a given length. -// -// See https://www.kernel.org/doc/html/latest/bpf/btf.html#btf-kind-int -type Int struct { - Name string - - // The size of the integer in bytes. - Size uint32 - Encoding IntEncoding -} - -func (i *Int) Format(fs fmt.State, verb rune) { - formatType(fs, verb, i, i.Encoding, "size=", i.Size) -} - -func (i *Int) TypeName() string { return i.Name } -func (i *Int) size() uint32 { return i.Size } -func (i *Int) copy() Type { - cpy := *i - return &cpy -} - -// Pointer is a pointer to another type. -type Pointer struct { - Target Type -} - -func (p *Pointer) Format(fs fmt.State, verb rune) { - formatType(fs, verb, p, "target=", p.Target) -} - -func (p *Pointer) TypeName() string { return "" } -func (p *Pointer) size() uint32 { return 8 } -func (p *Pointer) copy() Type { - cpy := *p - return &cpy -} - -// Array is an array with a fixed number of elements. -type Array struct { - Index Type - Type Type - Nelems uint32 -} - -func (arr *Array) Format(fs fmt.State, verb rune) { - formatType(fs, verb, arr, "index=", arr.Index, "type=", arr.Type, "n=", arr.Nelems) -} - -func (arr *Array) TypeName() string { return "" } - -func (arr *Array) copy() Type { - cpy := *arr - return &cpy -} - -// Struct is a compound type of consecutive members. -type Struct struct { - Name string - // The size of the struct including padding, in bytes - Size uint32 - Members []Member -} - -func (s *Struct) Format(fs fmt.State, verb rune) { - formatType(fs, verb, s, "fields=", len(s.Members)) -} - -func (s *Struct) TypeName() string { return s.Name } - -func (s *Struct) size() uint32 { return s.Size } - -func (s *Struct) copy() Type { - cpy := *s - cpy.Members = copyMembers(s.Members) - return &cpy -} - -func (s *Struct) members() []Member { - return s.Members -} - -// Union is a compound type where members occupy the same memory. -type Union struct { - Name string - // The size of the union including padding, in bytes. - Size uint32 - Members []Member -} - -func (u *Union) Format(fs fmt.State, verb rune) { - formatType(fs, verb, u, "fields=", len(u.Members)) -} - -func (u *Union) TypeName() string { return u.Name } - -func (u *Union) size() uint32 { return u.Size } - -func (u *Union) copy() Type { - cpy := *u - cpy.Members = copyMembers(u.Members) - return &cpy -} - -func (u *Union) members() []Member { - return u.Members -} - -func copyMembers(orig []Member) []Member { - cpy := make([]Member, len(orig)) - copy(cpy, orig) - return cpy -} - -type composite interface { - Type - members() []Member -} - -var ( - _ composite = (*Struct)(nil) - _ composite = (*Union)(nil) -) - -// A value in bits. -type Bits uint32 - -// Bytes converts a bit value into bytes. -func (b Bits) Bytes() uint32 { - return uint32(b / 8) -} - -// Member is part of a Struct or Union. -// -// It is not a valid Type. -type Member struct { - Name string - Type Type - Offset Bits - BitfieldSize Bits -} - -// Enum lists possible values. -type Enum struct { - Name string - // Size of the enum value in bytes. - Size uint32 - // True if the values should be interpreted as signed integers. - Signed bool - Values []EnumValue -} - -func (e *Enum) Format(fs fmt.State, verb rune) { - formatType(fs, verb, e, "size=", e.Size, "values=", len(e.Values)) -} - -func (e *Enum) TypeName() string { return e.Name } - -// EnumValue is part of an Enum -// -// Is is not a valid Type -type EnumValue struct { - Name string - Value uint64 -} - -func (e *Enum) size() uint32 { return e.Size } -func (e *Enum) copy() Type { - cpy := *e - cpy.Values = make([]EnumValue, len(e.Values)) - copy(cpy.Values, e.Values) - return &cpy -} - -// FwdKind is the type of forward declaration. -type FwdKind int - -// Valid types of forward declaration. -const ( - FwdStruct FwdKind = iota - FwdUnion -) - -func (fk FwdKind) String() string { - switch fk { - case FwdStruct: - return "struct" - case FwdUnion: - return "union" - default: - return fmt.Sprintf("%T(%d)", fk, int(fk)) - } -} - -// Fwd is a forward declaration of a Type. -type Fwd struct { - Name string - Kind FwdKind -} - -func (f *Fwd) Format(fs fmt.State, verb rune) { - formatType(fs, verb, f, f.Kind) -} - -func (f *Fwd) TypeName() string { return f.Name } - -func (f *Fwd) copy() Type { - cpy := *f - return &cpy -} - -func (f *Fwd) matches(typ Type) bool { - if _, ok := As[*Struct](typ); ok && f.Kind == FwdStruct { - return true - } - - if _, ok := As[*Union](typ); ok && f.Kind == FwdUnion { - return true - } - - return false -} - -// Typedef is an alias of a Type. -type Typedef struct { - Name string - Type Type -} - -func (td *Typedef) Format(fs fmt.State, verb rune) { - formatType(fs, verb, td, td.Type) -} - -func (td *Typedef) TypeName() string { return td.Name } - -func (td *Typedef) copy() Type { - cpy := *td - return &cpy -} - -// Volatile is a qualifier. -type Volatile struct { - Type Type -} - -func (v *Volatile) Format(fs fmt.State, verb rune) { - formatType(fs, verb, v, v.Type) -} - -func (v *Volatile) TypeName() string { return "" } - -func (v *Volatile) qualify() Type { return v.Type } -func (v *Volatile) copy() Type { - cpy := *v - return &cpy -} - -// Const is a qualifier. -type Const struct { - Type Type -} - -func (c *Const) Format(fs fmt.State, verb rune) { - formatType(fs, verb, c, c.Type) -} - -func (c *Const) TypeName() string { return "" } - -func (c *Const) qualify() Type { return c.Type } -func (c *Const) copy() Type { - cpy := *c - return &cpy -} - -// Restrict is a qualifier. -type Restrict struct { - Type Type -} - -func (r *Restrict) Format(fs fmt.State, verb rune) { - formatType(fs, verb, r, r.Type) -} - -func (r *Restrict) TypeName() string { return "" } - -func (r *Restrict) qualify() Type { return r.Type } -func (r *Restrict) copy() Type { - cpy := *r - return &cpy -} - -// Func is a function definition. -type Func struct { - Name string - Type Type - Linkage FuncLinkage -} - -func FuncMetadata(ins *asm.Instruction) *Func { - fn, _ := ins.Metadata.Get(funcInfoMeta{}).(*Func) - return fn -} - -// WithFuncMetadata adds a btf.Func to the Metadata of asm.Instruction. -func WithFuncMetadata(ins asm.Instruction, fn *Func) asm.Instruction { - ins.Metadata.Set(funcInfoMeta{}, fn) - return ins -} - -func (f *Func) Format(fs fmt.State, verb rune) { - formatType(fs, verb, f, f.Linkage, "proto=", f.Type) -} - -func (f *Func) TypeName() string { return f.Name } - -func (f *Func) copy() Type { - cpy := *f - return &cpy -} - -// FuncProto is a function declaration. -type FuncProto struct { - Return Type - Params []FuncParam -} - -func (fp *FuncProto) Format(fs fmt.State, verb rune) { - formatType(fs, verb, fp, "args=", len(fp.Params), "return=", fp.Return) -} - -func (fp *FuncProto) TypeName() string { return "" } - -func (fp *FuncProto) copy() Type { - cpy := *fp - cpy.Params = make([]FuncParam, len(fp.Params)) - copy(cpy.Params, fp.Params) - return &cpy -} - -type FuncParam struct { - Name string - Type Type -} - -// Var is a global variable. -type Var struct { - Name string - Type Type - Linkage VarLinkage -} - -func (v *Var) Format(fs fmt.State, verb rune) { - formatType(fs, verb, v, v.Linkage) -} - -func (v *Var) TypeName() string { return v.Name } - -func (v *Var) copy() Type { - cpy := *v - return &cpy -} - -// Datasec is a global program section containing data. -type Datasec struct { - Name string - Size uint32 - Vars []VarSecinfo -} - -func (ds *Datasec) Format(fs fmt.State, verb rune) { - formatType(fs, verb, ds) -} - -func (ds *Datasec) TypeName() string { return ds.Name } - -func (ds *Datasec) size() uint32 { return ds.Size } - -func (ds *Datasec) copy() Type { - cpy := *ds - cpy.Vars = make([]VarSecinfo, len(ds.Vars)) - copy(cpy.Vars, ds.Vars) - return &cpy -} - -// VarSecinfo describes variable in a Datasec. -// -// It is not a valid Type. -type VarSecinfo struct { - // Var or Func. - Type Type - Offset uint32 - Size uint32 -} - -// Float is a float of a given length. -type Float struct { - Name string - - // The size of the float in bytes. - Size uint32 -} - -func (f *Float) Format(fs fmt.State, verb rune) { - formatType(fs, verb, f, "size=", f.Size*8) -} - -func (f *Float) TypeName() string { return f.Name } -func (f *Float) size() uint32 { return f.Size } -func (f *Float) copy() Type { - cpy := *f - return &cpy -} - -// declTag associates metadata with a declaration. -type declTag struct { - Type Type - Value string - // The index this tag refers to in the target type. For composite types, - // a value of -1 indicates that the tag refers to the whole type. Otherwise - // it indicates which member or argument the tag applies to. - Index int -} - -func (dt *declTag) Format(fs fmt.State, verb rune) { - formatType(fs, verb, dt, "type=", dt.Type, "value=", dt.Value, "index=", dt.Index) -} - -func (dt *declTag) TypeName() string { return "" } -func (dt *declTag) copy() Type { - cpy := *dt - return &cpy -} - -// typeTag associates metadata with a type. -type typeTag struct { - Type Type - Value string -} - -func (tt *typeTag) Format(fs fmt.State, verb rune) { - formatType(fs, verb, tt, "type=", tt.Type, "value=", tt.Value) -} - -func (tt *typeTag) TypeName() string { return "" } -func (tt *typeTag) qualify() Type { return tt.Type } -func (tt *typeTag) copy() Type { - cpy := *tt - return &cpy -} - -// cycle is a type which had to be elided since it exceeded maxTypeDepth. -type cycle struct { - root Type -} - -func (c *cycle) ID() TypeID { return math.MaxUint32 } -func (c *cycle) Format(fs fmt.State, verb rune) { formatType(fs, verb, c, "root=", c.root) } -func (c *cycle) TypeName() string { return "" } -func (c *cycle) copy() Type { - cpy := *c - return &cpy -} - -type sizer interface { - size() uint32 -} - -var ( - _ sizer = (*Int)(nil) - _ sizer = (*Pointer)(nil) - _ sizer = (*Struct)(nil) - _ sizer = (*Union)(nil) - _ sizer = (*Enum)(nil) - _ sizer = (*Datasec)(nil) -) - -type qualifier interface { - qualify() Type -} - -var ( - _ qualifier = (*Const)(nil) - _ qualifier = (*Restrict)(nil) - _ qualifier = (*Volatile)(nil) - _ qualifier = (*typeTag)(nil) -) - -var errUnsizedType = errors.New("type is unsized") - -// Sizeof returns the size of a type in bytes. -// -// Returns an error if the size can't be computed. -func Sizeof(typ Type) (int, error) { - var ( - n = int64(1) - elem int64 - ) - - for i := 0; i < maxResolveDepth; i++ { - switch v := typ.(type) { - case *Array: - if n > 0 && int64(v.Nelems) > math.MaxInt64/n { - return 0, fmt.Errorf("type %s: overflow", typ) - } - - // Arrays may be of zero length, which allows - // n to be zero as well. - n *= int64(v.Nelems) - typ = v.Type - continue - - case sizer: - elem = int64(v.size()) - - case *Typedef: - typ = v.Type - continue - - case qualifier: - typ = v.qualify() - continue - - default: - return 0, fmt.Errorf("type %T: %w", typ, errUnsizedType) - } - - if n > 0 && elem > math.MaxInt64/n { - return 0, fmt.Errorf("type %s: overflow", typ) - } - - size := n * elem - if int64(int(size)) != size { - return 0, fmt.Errorf("type %s: overflow", typ) - } - - return int(size), nil - } - - return 0, fmt.Errorf("type %s: exceeded type depth", typ) -} - -// alignof returns the alignment of a type. -// -// Returns an error if the Type can't be aligned, like an integer with an uneven -// size. Currently only supports the subset of types necessary for bitfield -// relocations. -func alignof(typ Type) (int, error) { - var n int - - switch t := UnderlyingType(typ).(type) { - case *Enum: - n = int(t.size()) - case *Int: - n = int(t.Size) - case *Array: - return alignof(t.Type) - default: - return 0, fmt.Errorf("can't calculate alignment of %T", t) - } - - if !internal.IsPow(n) { - return 0, fmt.Errorf("alignment value %d is not a power of two", n) - } - - return n, nil -} - -// Copy a Type recursively. -// -// typ may form a cycle. -func Copy(typ Type) Type { - return copyType(typ, nil, make(map[Type]Type), nil) -} - -func copyType(typ Type, ids map[Type]TypeID, copies map[Type]Type, copiedIDs map[Type]TypeID) Type { - cpy, ok := copies[typ] - if ok { - // This has been copied previously, no need to continue. - return cpy - } - - cpy = typ.copy() - copies[typ] = cpy - - if id, ok := ids[typ]; ok { - copiedIDs[cpy] = id - } - - children(cpy, func(child *Type) bool { - *child = copyType(*child, ids, copies, copiedIDs) - return true - }) - - return cpy -} - -type typeDeque = internal.Deque[*Type] - -// readAndInflateTypes reads the raw btf type info and turns it into a graph -// of Types connected via pointers. -// -// If base is provided, then the types are considered to be of a split BTF -// (e.g., a kernel module). -// -// Returns a slice of types indexed by TypeID. Since BTF ignores compilation -// units, multiple types may share the same name. A Type may form a cyclic graph -// by pointing at itself. -func readAndInflateTypes(r io.Reader, bo binary.ByteOrder, typeLen uint32, rawStrings *stringTable, base *Spec) ([]Type, error) { - // because of the interleaving between types and struct members it is difficult to - // precompute the numbers of raw types this will parse - // this "guess" is a good first estimation - sizeOfbtfType := uintptr(btfTypeLen) - tyMaxCount := uintptr(typeLen) / sizeOfbtfType / 2 - types := make([]Type, 0, tyMaxCount) - - // Void is defined to always be type ID 0, and is thus omitted from BTF. - types = append(types, (*Void)(nil)) - - firstTypeID := TypeID(0) - if base != nil { - var err error - firstTypeID, err = base.nextTypeID() - if err != nil { - return nil, err - } - - // Split BTF doesn't contain Void. - types = types[:0] - } - - type fixupDef struct { - id TypeID - typ *Type - } - - var fixups []fixupDef - fixup := func(id TypeID, typ *Type) { - if id < firstTypeID { - if baseType, err := base.TypeByID(id); err == nil { - *typ = baseType - return - } - } - - idx := int(id - firstTypeID) - if idx < len(types) { - // We've already inflated this type, fix it up immediately. - *typ = types[idx] - return - } - - fixups = append(fixups, fixupDef{id, typ}) - } - - type bitfieldFixupDef struct { - id TypeID - m *Member - } - - var ( - legacyBitfields = make(map[TypeID][2]Bits) // offset, size - bitfieldFixups []bitfieldFixupDef - ) - convertMembers := func(raw []btfMember, kindFlag bool) ([]Member, error) { - // NB: The fixup below relies on pre-allocating this array to - // work, since otherwise append might re-allocate members. - members := make([]Member, 0, len(raw)) - for i, btfMember := range raw { - name, err := rawStrings.Lookup(btfMember.NameOff) - if err != nil { - return nil, fmt.Errorf("can't get name for member %d: %w", i, err) - } - - members = append(members, Member{ - Name: name, - Offset: Bits(btfMember.Offset), - }) - - m := &members[i] - fixup(raw[i].Type, &m.Type) - - if kindFlag { - m.BitfieldSize = Bits(btfMember.Offset >> 24) - m.Offset &= 0xffffff - // We ignore legacy bitfield definitions if the current composite - // is a new-style bitfield. This is kind of safe since offset and - // size on the type of the member must be zero if kindFlat is set - // according to spec. - continue - } - - // This may be a legacy bitfield, try to fix it up. - data, ok := legacyBitfields[raw[i].Type] - if ok { - // Bingo! - m.Offset += data[0] - m.BitfieldSize = data[1] - continue - } - - if m.Type != nil { - // We couldn't find a legacy bitfield, but we know that the member's - // type has already been inflated. Hence we know that it can't be - // a legacy bitfield and there is nothing left to do. - continue - } - - // We don't have fixup data, and the type we're pointing - // at hasn't been inflated yet. No choice but to defer - // the fixup. - bitfieldFixups = append(bitfieldFixups, bitfieldFixupDef{ - raw[i].Type, - m, - }) - } - return members, nil - } - - var ( - buf = make([]byte, 1024) - header btfType - bInt btfInt - bArr btfArray - bMembers []btfMember - bEnums []btfEnum - bParams []btfParam - bVariable btfVariable - bSecInfos []btfVarSecinfo - bDeclTag btfDeclTag - bEnums64 []btfEnum64 - ) - - var declTags []*declTag - for { - var ( - id = firstTypeID + TypeID(len(types)) - typ Type - ) - - if _, err := io.ReadFull(r, buf[:btfTypeLen]); err == io.EOF { - break - } else if err != nil { - return nil, fmt.Errorf("can't read type info for id %v: %v", id, err) - } - - if _, err := unmarshalBtfType(&header, buf[:btfTypeLen], bo); err != nil { - return nil, fmt.Errorf("can't unmarshal type info for id %v: %v", id, err) - } - - if id < firstTypeID { - return nil, fmt.Errorf("no more type IDs") - } - - name, err := rawStrings.Lookup(header.NameOff) - if err != nil { - return nil, fmt.Errorf("get name for type id %d: %w", id, err) - } - - switch header.Kind() { - case kindInt: - size := header.Size() - buf = buf[:btfIntLen] - if _, err := io.ReadFull(r, buf); err != nil { - return nil, fmt.Errorf("can't read btfInt, id: %d: %w", id, err) - } - if _, err := unmarshalBtfInt(&bInt, buf, bo); err != nil { - return nil, fmt.Errorf("can't unmarshal btfInt, id: %d: %w", id, err) - } - if bInt.Offset() > 0 || bInt.Bits().Bytes() != size { - legacyBitfields[id] = [2]Bits{bInt.Offset(), bInt.Bits()} - } - typ = &Int{name, header.Size(), bInt.Encoding()} - - case kindPointer: - ptr := &Pointer{nil} - fixup(header.Type(), &ptr.Target) - typ = ptr - - case kindArray: - buf = buf[:btfArrayLen] - if _, err := io.ReadFull(r, buf); err != nil { - return nil, fmt.Errorf("can't read btfArray, id: %d: %w", id, err) - } - if _, err := unmarshalBtfArray(&bArr, buf, bo); err != nil { - return nil, fmt.Errorf("can't unmarshal btfArray, id: %d: %w", id, err) - } - - arr := &Array{nil, nil, bArr.Nelems} - fixup(bArr.IndexType, &arr.Index) - fixup(bArr.Type, &arr.Type) - typ = arr - - case kindStruct: - vlen := header.Vlen() - bMembers = slices.Grow(bMembers[:0], vlen)[:vlen] - buf = slices.Grow(buf[:0], vlen*btfMemberLen)[:vlen*btfMemberLen] - if _, err := io.ReadFull(r, buf); err != nil { - return nil, fmt.Errorf("can't read btfMembers, id: %d: %w", id, err) - } - if _, err := unmarshalBtfMembers(bMembers, buf, bo); err != nil { - return nil, fmt.Errorf("can't unmarshal btfMembers, id: %d: %w", id, err) - } - - members, err := convertMembers(bMembers, header.Bitfield()) - if err != nil { - return nil, fmt.Errorf("struct %s (id %d): %w", name, id, err) - } - typ = &Struct{name, header.Size(), members} - - case kindUnion: - vlen := header.Vlen() - bMembers = slices.Grow(bMembers[:0], vlen)[:vlen] - buf = slices.Grow(buf[:0], vlen*btfMemberLen)[:vlen*btfMemberLen] - if _, err := io.ReadFull(r, buf); err != nil { - return nil, fmt.Errorf("can't read btfMembers, id: %d: %w", id, err) - } - if _, err := unmarshalBtfMembers(bMembers, buf, bo); err != nil { - return nil, fmt.Errorf("can't unmarshal btfMembers, id: %d: %w", id, err) - } - - members, err := convertMembers(bMembers, header.Bitfield()) - if err != nil { - return nil, fmt.Errorf("union %s (id %d): %w", name, id, err) - } - typ = &Union{name, header.Size(), members} - - case kindEnum: - vlen := header.Vlen() - bEnums = slices.Grow(bEnums[:0], vlen)[:vlen] - buf = slices.Grow(buf[:0], vlen*btfEnumLen)[:vlen*btfEnumLen] - if _, err := io.ReadFull(r, buf); err != nil { - return nil, fmt.Errorf("can't read btfEnums, id: %d: %w", id, err) - } - if _, err := unmarshalBtfEnums(bEnums, buf, bo); err != nil { - return nil, fmt.Errorf("can't unmarshal btfEnums, id: %d: %w", id, err) - } - - vals := make([]EnumValue, 0, vlen) - signed := header.Signed() - for i, btfVal := range bEnums { - name, err := rawStrings.Lookup(btfVal.NameOff) - if err != nil { - return nil, fmt.Errorf("get name for enum value %d: %s", i, err) - } - value := uint64(btfVal.Val) - if signed { - // Sign extend values to 64 bit. - value = uint64(int32(btfVal.Val)) - } - vals = append(vals, EnumValue{name, value}) - } - typ = &Enum{name, header.Size(), signed, vals} - - case kindForward: - typ = &Fwd{name, header.FwdKind()} - - case kindTypedef: - typedef := &Typedef{name, nil} - fixup(header.Type(), &typedef.Type) - typ = typedef - - case kindVolatile: - volatile := &Volatile{nil} - fixup(header.Type(), &volatile.Type) - typ = volatile - - case kindConst: - cnst := &Const{nil} - fixup(header.Type(), &cnst.Type) - typ = cnst - - case kindRestrict: - restrict := &Restrict{nil} - fixup(header.Type(), &restrict.Type) - typ = restrict - - case kindFunc: - fn := &Func{name, nil, header.Linkage()} - fixup(header.Type(), &fn.Type) - typ = fn - - case kindFuncProto: - vlen := header.Vlen() - bParams = slices.Grow(bParams[:0], vlen)[:vlen] - buf = slices.Grow(buf[:0], vlen*btfParamLen)[:vlen*btfParamLen] - if _, err := io.ReadFull(r, buf); err != nil { - return nil, fmt.Errorf("can't read btfParams, id: %d: %w", id, err) - } - if _, err := unmarshalBtfParams(bParams, buf, bo); err != nil { - return nil, fmt.Errorf("can't unmarshal btfParams, id: %d: %w", id, err) - } - - params := make([]FuncParam, 0, vlen) - for i, param := range bParams { - name, err := rawStrings.Lookup(param.NameOff) - if err != nil { - return nil, fmt.Errorf("get name for func proto parameter %d: %s", i, err) - } - params = append(params, FuncParam{ - Name: name, - }) - } - for i := range params { - fixup(bParams[i].Type, ¶ms[i].Type) - } - - fp := &FuncProto{nil, params} - fixup(header.Type(), &fp.Return) - typ = fp - - case kindVar: - buf = buf[:btfVariableLen] - if _, err := io.ReadFull(r, buf); err != nil { - return nil, fmt.Errorf("can't read btfVariable, id: %d: %w", id, err) - } - if _, err := unmarshalBtfVariable(&bVariable, buf, bo); err != nil { - return nil, fmt.Errorf("can't read btfVariable, id: %d: %w", id, err) - } - - v := &Var{name, nil, VarLinkage(bVariable.Linkage)} - fixup(header.Type(), &v.Type) - typ = v - - case kindDatasec: - vlen := header.Vlen() - bSecInfos = slices.Grow(bSecInfos[:0], vlen)[:vlen] - buf = slices.Grow(buf[:0], vlen*btfVarSecinfoLen)[:vlen*btfVarSecinfoLen] - if _, err := io.ReadFull(r, buf); err != nil { - return nil, fmt.Errorf("can't read btfVarSecInfos, id: %d: %w", id, err) - } - if _, err := unmarshalBtfVarSecInfos(bSecInfos, buf, bo); err != nil { - return nil, fmt.Errorf("can't unmarshal btfVarSecInfos, id: %d: %w", id, err) - } - - vars := make([]VarSecinfo, 0, vlen) - for _, btfVar := range bSecInfos { - vars = append(vars, VarSecinfo{ - Offset: btfVar.Offset, - Size: btfVar.Size, - }) - } - for i := range vars { - fixup(bSecInfos[i].Type, &vars[i].Type) - } - typ = &Datasec{name, header.Size(), vars} - - case kindFloat: - typ = &Float{name, header.Size()} - - case kindDeclTag: - buf = buf[:btfDeclTagLen] - if _, err := io.ReadFull(r, buf); err != nil { - return nil, fmt.Errorf("can't read btfDeclTag, id: %d: %w", id, err) - } - if _, err := unmarshalBtfDeclTag(&bDeclTag, buf, bo); err != nil { - return nil, fmt.Errorf("can't read btfDeclTag, id: %d: %w", id, err) - } - - btfIndex := bDeclTag.ComponentIdx - if uint64(btfIndex) > math.MaxInt { - return nil, fmt.Errorf("type id %d: index exceeds int", id) - } - - dt := &declTag{nil, name, int(int32(btfIndex))} - fixup(header.Type(), &dt.Type) - typ = dt - - declTags = append(declTags, dt) - - case kindTypeTag: - tt := &typeTag{nil, name} - fixup(header.Type(), &tt.Type) - typ = tt - - case kindEnum64: - vlen := header.Vlen() - bEnums64 = slices.Grow(bEnums64[:0], vlen)[:vlen] - buf = slices.Grow(buf[:0], vlen*btfEnum64Len)[:vlen*btfEnum64Len] - if _, err := io.ReadFull(r, buf); err != nil { - return nil, fmt.Errorf("can't read btfEnum64s, id: %d: %w", id, err) - } - if _, err := unmarshalBtfEnums64(bEnums64, buf, bo); err != nil { - return nil, fmt.Errorf("can't unmarshal btfEnum64s, id: %d: %w", id, err) - } - - vals := make([]EnumValue, 0, vlen) - for i, btfVal := range bEnums64 { - name, err := rawStrings.Lookup(btfVal.NameOff) - if err != nil { - return nil, fmt.Errorf("get name for enum64 value %d: %s", i, err) - } - value := (uint64(btfVal.ValHi32) << 32) | uint64(btfVal.ValLo32) - vals = append(vals, EnumValue{name, value}) - } - typ = &Enum{name, header.Size(), header.Signed(), vals} - - default: - return nil, fmt.Errorf("type id %d: unknown kind: %v", id, header.Kind()) - } - - types = append(types, typ) - } - - for _, fixup := range fixups { - if fixup.id < firstTypeID { - return nil, fmt.Errorf("fixup for base type id %d is not expected", fixup.id) - } - - idx := int(fixup.id - firstTypeID) - if idx >= len(types) { - return nil, fmt.Errorf("reference to invalid type id: %d", fixup.id) - } - - *fixup.typ = types[idx] - } - - for _, bitfieldFixup := range bitfieldFixups { - if bitfieldFixup.id < firstTypeID { - return nil, fmt.Errorf("bitfield fixup from split to base types is not expected") - } - - data, ok := legacyBitfields[bitfieldFixup.id] - if ok { - // This is indeed a legacy bitfield, fix it up. - bitfieldFixup.m.Offset += data[0] - bitfieldFixup.m.BitfieldSize = data[1] - } - } - - for _, dt := range declTags { - switch t := dt.Type.(type) { - case *Var, *Typedef: - if dt.Index != -1 { - return nil, fmt.Errorf("type %s: index %d is not -1", dt, dt.Index) - } - - case composite: - if dt.Index >= len(t.members()) { - return nil, fmt.Errorf("type %s: index %d exceeds members of %s", dt, dt.Index, t) - } - - case *Func: - fp, ok := t.Type.(*FuncProto) - if !ok { - return nil, fmt.Errorf("type %s: %s is not a FuncProto", dt, t.Type) - } - - if dt.Index >= len(fp.Params) { - return nil, fmt.Errorf("type %s: index %d exceeds params of %s", dt, dt.Index, t) - } - - default: - return nil, fmt.Errorf("type %s: decl tag for type %s is not supported", dt, t) - } - } - - return types, nil -} - -// essentialName represents the name of a BTF type stripped of any flavor -// suffixes after a ___ delimiter. -type essentialName string - -// newEssentialName returns name without a ___ suffix. -// -// CO-RE has the concept of 'struct flavors', which are used to deal with -// changes in kernel data structures. Anything after three underscores -// in a type name is ignored for the purpose of finding a candidate type -// in the kernel's BTF. -func newEssentialName(name string) essentialName { - if name == "" { - return "" - } - lastIdx := strings.LastIndex(name, "___") - if lastIdx > 0 { - return essentialName(name[:lastIdx]) - } - return essentialName(name) -} - -// UnderlyingType skips qualifiers and Typedefs. -func UnderlyingType(typ Type) Type { - result := typ - for depth := 0; depth <= maxResolveDepth; depth++ { - switch v := (result).(type) { - case qualifier: - result = v.qualify() - case *Typedef: - result = v.Type - default: - return result - } - } - return &cycle{typ} -} - -// As returns typ if is of type T. Otherwise it peels qualifiers and Typedefs -// until it finds a T. -// -// Returns the zero value and false if there is no T or if the type is nested -// too deeply. -func As[T Type](typ Type) (T, bool) { - // NB: We can't make this function return (*T) since then - // we can't assert that a type matches an interface which - // embeds Type: as[composite](T). - for depth := 0; depth <= maxResolveDepth; depth++ { - switch v := (typ).(type) { - case T: - return v, true - case qualifier: - typ = v.qualify() - case *Typedef: - typ = v.Type - default: - goto notFound - } - } -notFound: - var zero T - return zero, false -} - -type formatState struct { - fmt.State - depth int -} - -// formattableType is a subset of Type, to ease unit testing of formatType. -type formattableType interface { - fmt.Formatter - TypeName() string -} - -// formatType formats a type in a canonical form. -// -// Handles cyclical types by only printing cycles up to a certain depth. Elements -// in extra are separated by spaces unless the preceding element is a string -// ending in '='. -func formatType(f fmt.State, verb rune, t formattableType, extra ...interface{}) { - if verb != 'v' && verb != 's' { - fmt.Fprintf(f, "{UNRECOGNIZED: %c}", verb) - return - } - - _, _ = io.WriteString(f, internal.GoTypeName(t)) - - if name := t.TypeName(); name != "" { - // Output BTF type name if present. - fmt.Fprintf(f, ":%q", name) - } - - if f.Flag('+') { - // Output address if requested. - fmt.Fprintf(f, ":%#p", t) - } - - if verb == 's' { - // %s omits details. - return - } - - var depth int - if ps, ok := f.(*formatState); ok { - depth = ps.depth - f = ps.State - } - - maxDepth, ok := f.Width() - if !ok { - maxDepth = 0 - } - - if depth > maxDepth { - // We've reached the maximum depth. This avoids infinite recursion even - // for cyclical types. - return - } - - if len(extra) == 0 { - return - } - - wantSpace := false - _, _ = io.WriteString(f, "[") - for _, arg := range extra { - if wantSpace { - _, _ = io.WriteString(f, " ") - } - - switch v := arg.(type) { - case string: - _, _ = io.WriteString(f, v) - wantSpace = len(v) > 0 && v[len(v)-1] != '=' - continue - - case formattableType: - v.Format(&formatState{f, depth + 1}, verb) - - default: - fmt.Fprint(f, arg) - } - - wantSpace = true - } - _, _ = io.WriteString(f, "]") -} diff --git a/vendor/github.com/cilium/ebpf/btf/workarounds.go b/vendor/github.com/cilium/ebpf/btf/workarounds.go deleted file mode 100644 index 12a89b87e..000000000 --- a/vendor/github.com/cilium/ebpf/btf/workarounds.go +++ /dev/null @@ -1,26 +0,0 @@ -package btf - -// datasecResolveWorkaround ensures that certain vars in a Datasec are added -// to a Spec before the Datasec. This avoids a bug in kernel BTF validation. -// -// See https://lore.kernel.org/bpf/20230302123440.1193507-1-lmb@isovalent.com/ -func datasecResolveWorkaround(b *Builder, ds *Datasec) error { - for _, vsi := range ds.Vars { - v, ok := vsi.Type.(*Var) - if !ok { - continue - } - - switch v.Type.(type) { - case *Typedef, *Volatile, *Const, *Restrict, *typeTag: - // NB: We must never call Add on a Datasec, otherwise we risk - // infinite recursion. - _, err := b.Add(v.Type) - if err != nil { - return err - } - } - } - - return nil -} diff --git a/vendor/github.com/cilium/ebpf/collection.go b/vendor/github.com/cilium/ebpf/collection.go deleted file mode 100644 index a5532220f..000000000 --- a/vendor/github.com/cilium/ebpf/collection.go +++ /dev/null @@ -1,925 +0,0 @@ -package ebpf - -import ( - "encoding/binary" - "errors" - "fmt" - "reflect" - "strings" - - "github.com/cilium/ebpf/asm" - "github.com/cilium/ebpf/btf" - "github.com/cilium/ebpf/internal" - "github.com/cilium/ebpf/internal/kconfig" - "github.com/cilium/ebpf/internal/sysenc" -) - -// CollectionOptions control loading a collection into the kernel. -// -// Maps and Programs are passed to NewMapWithOptions and NewProgramsWithOptions. -type CollectionOptions struct { - Maps MapOptions - Programs ProgramOptions - - // MapReplacements takes a set of Maps that will be used instead of - // creating new ones when loading the CollectionSpec. - // - // For each given Map, there must be a corresponding MapSpec in - // CollectionSpec.Maps, and its type, key/value size, max entries and flags - // must match the values of the MapSpec. - // - // The given Maps are Clone()d before being used in the Collection, so the - // caller can Close() them freely when they are no longer needed. - MapReplacements map[string]*Map -} - -// CollectionSpec describes a collection. -type CollectionSpec struct { - Maps map[string]*MapSpec - Programs map[string]*ProgramSpec - - // Types holds type information about Maps and Programs. - // Modifications to Types are currently undefined behaviour. - Types *btf.Spec - - // ByteOrder specifies whether the ELF was compiled for - // big-endian or little-endian architectures. - ByteOrder binary.ByteOrder -} - -// Copy returns a recursive copy of the spec. -func (cs *CollectionSpec) Copy() *CollectionSpec { - if cs == nil { - return nil - } - - cpy := CollectionSpec{ - Maps: make(map[string]*MapSpec, len(cs.Maps)), - Programs: make(map[string]*ProgramSpec, len(cs.Programs)), - ByteOrder: cs.ByteOrder, - Types: cs.Types, - } - - for name, spec := range cs.Maps { - cpy.Maps[name] = spec.Copy() - } - - for name, spec := range cs.Programs { - cpy.Programs[name] = spec.Copy() - } - - return &cpy -} - -// RewriteMaps replaces all references to specific maps. -// -// Use this function to use pre-existing maps instead of creating new ones -// when calling NewCollection. Any named maps are removed from CollectionSpec.Maps. -// -// Returns an error if a named map isn't used in at least one program. -// -// Deprecated: Pass CollectionOptions.MapReplacements when loading the Collection -// instead. -func (cs *CollectionSpec) RewriteMaps(maps map[string]*Map) error { - for symbol, m := range maps { - // have we seen a program that uses this symbol / map - seen := false - for progName, progSpec := range cs.Programs { - err := progSpec.Instructions.AssociateMap(symbol, m) - - switch { - case err == nil: - seen = true - - case errors.Is(err, asm.ErrUnreferencedSymbol): - // Not all programs need to use the map - - default: - return fmt.Errorf("program %s: %w", progName, err) - } - } - - if !seen { - return fmt.Errorf("map %s not referenced by any programs", symbol) - } - - // Prevent NewCollection from creating rewritten maps - delete(cs.Maps, symbol) - } - - return nil -} - -// MissingConstantsError is returned by [CollectionSpec.RewriteConstants]. -type MissingConstantsError struct { - // The constants missing from .rodata. - Constants []string -} - -func (m *MissingConstantsError) Error() string { - return fmt.Sprintf("some constants are missing from .rodata: %s", strings.Join(m.Constants, ", ")) -} - -// RewriteConstants replaces the value of multiple constants. -// -// The constant must be defined like so in the C program: -// -// volatile const type foobar; -// volatile const type foobar = default; -// -// Replacement values must be of the same length as the C sizeof(type). -// If necessary, they are marshalled according to the same rules as -// map values. -// -// From Linux 5.5 the verifier will use constants to eliminate dead code. -// -// Returns an error wrapping [MissingConstantsError] if a constant doesn't exist. -func (cs *CollectionSpec) RewriteConstants(consts map[string]interface{}) error { - replaced := make(map[string]bool) - - for name, spec := range cs.Maps { - if !strings.HasPrefix(name, ".rodata") { - continue - } - - b, ds, err := spec.dataSection() - if errors.Is(err, errMapNoBTFValue) { - // Data sections without a BTF Datasec are valid, but don't support - // constant replacements. - continue - } - if err != nil { - return fmt.Errorf("map %s: %w", name, err) - } - - // MapSpec.Copy() performs a shallow copy. Fully copy the byte slice - // to avoid any changes affecting other copies of the MapSpec. - cpy := make([]byte, len(b)) - copy(cpy, b) - - for _, v := range ds.Vars { - vname := v.Type.TypeName() - replacement, ok := consts[vname] - if !ok { - continue - } - - if _, ok := v.Type.(*btf.Var); !ok { - return fmt.Errorf("section %s: unexpected type %T for variable %s", name, v.Type, vname) - } - - if replaced[vname] { - return fmt.Errorf("section %s: duplicate variable %s", name, vname) - } - - if int(v.Offset+v.Size) > len(cpy) { - return fmt.Errorf("section %s: offset %d(+%d) for variable %s is out of bounds", name, v.Offset, v.Size, vname) - } - - b, err := sysenc.Marshal(replacement, int(v.Size)) - if err != nil { - return fmt.Errorf("marshaling constant replacement %s: %w", vname, err) - } - - b.CopyTo(cpy[v.Offset : v.Offset+v.Size]) - - replaced[vname] = true - } - - spec.Contents[0] = MapKV{Key: uint32(0), Value: cpy} - } - - var missing []string - for c := range consts { - if !replaced[c] { - missing = append(missing, c) - } - } - - if len(missing) != 0 { - return fmt.Errorf("rewrite constants: %w", &MissingConstantsError{Constants: missing}) - } - - return nil -} - -// Assign the contents of a CollectionSpec to a struct. -// -// This function is a shortcut to manually checking the presence -// of maps and programs in a CollectionSpec. Consider using bpf2go -// if this sounds useful. -// -// 'to' must be a pointer to a struct. A field of the -// struct is updated with values from Programs or Maps if it -// has an `ebpf` tag and its type is *ProgramSpec or *MapSpec. -// The tag's value specifies the name of the program or map as -// found in the CollectionSpec. -// -// struct { -// Foo *ebpf.ProgramSpec `ebpf:"xdp_foo"` -// Bar *ebpf.MapSpec `ebpf:"bar_map"` -// Ignored int -// } -// -// Returns an error if any of the eBPF objects can't be found, or -// if the same MapSpec or ProgramSpec is assigned multiple times. -func (cs *CollectionSpec) Assign(to interface{}) error { - // Assign() only supports assigning ProgramSpecs and MapSpecs, - // so doesn't load any resources into the kernel. - getValue := func(typ reflect.Type, name string) (interface{}, error) { - switch typ { - - case reflect.TypeOf((*ProgramSpec)(nil)): - if p := cs.Programs[name]; p != nil { - return p, nil - } - return nil, fmt.Errorf("missing program %q", name) - - case reflect.TypeOf((*MapSpec)(nil)): - if m := cs.Maps[name]; m != nil { - return m, nil - } - return nil, fmt.Errorf("missing map %q", name) - - default: - return nil, fmt.Errorf("unsupported type %s", typ) - } - } - - return assignValues(to, getValue) -} - -// LoadAndAssign loads Maps and Programs into the kernel and assigns them -// to a struct. -// -// Omitting Map/Program.Close() during application shutdown is an error. -// See the package documentation for details around Map and Program lifecycle. -// -// This function is a shortcut to manually checking the presence -// of maps and programs in a CollectionSpec. Consider using bpf2go -// if this sounds useful. -// -// 'to' must be a pointer to a struct. A field of the struct is updated with -// a Program or Map if it has an `ebpf` tag and its type is *Program or *Map. -// The tag's value specifies the name of the program or map as found in the -// CollectionSpec. Before updating the struct, the requested objects and their -// dependent resources are loaded into the kernel and populated with values if -// specified. -// -// struct { -// Foo *ebpf.Program `ebpf:"xdp_foo"` -// Bar *ebpf.Map `ebpf:"bar_map"` -// Ignored int -// } -// -// opts may be nil. -// -// Returns an error if any of the fields can't be found, or -// if the same Map or Program is assigned multiple times. -func (cs *CollectionSpec) LoadAndAssign(to interface{}, opts *CollectionOptions) error { - loader, err := newCollectionLoader(cs, opts) - if err != nil { - return err - } - defer loader.close() - - // Support assigning Programs and Maps, lazy-loading the required objects. - assignedMaps := make(map[string]bool) - assignedProgs := make(map[string]bool) - - getValue := func(typ reflect.Type, name string) (interface{}, error) { - switch typ { - - case reflect.TypeOf((*Program)(nil)): - assignedProgs[name] = true - return loader.loadProgram(name) - - case reflect.TypeOf((*Map)(nil)): - assignedMaps[name] = true - return loader.loadMap(name) - - default: - return nil, fmt.Errorf("unsupported type %s", typ) - } - } - - // Load the Maps and Programs requested by the annotated struct. - if err := assignValues(to, getValue); err != nil { - return err - } - - // Populate the requested maps. Has a chance of lazy-loading other dependent maps. - if err := loader.populateDeferredMaps(); err != nil { - return err - } - - // Evaluate the loader's objects after all (lazy)loading has taken place. - for n, m := range loader.maps { - switch m.typ { - case ProgramArray: - // Require all lazy-loaded ProgramArrays to be assigned to the given object. - // The kernel empties a ProgramArray once the last user space reference - // to it closes, which leads to failed tail calls. Combined with the library - // closing map fds via GC finalizers this can lead to surprising behaviour. - // Only allow unassigned ProgramArrays when the library hasn't pre-populated - // any entries from static value declarations. At this point, we know the map - // is empty and there's no way for the caller to interact with the map going - // forward. - if !assignedMaps[n] && len(cs.Maps[n].Contents) > 0 { - return fmt.Errorf("ProgramArray %s must be assigned to prevent missed tail calls", n) - } - } - } - - // Prevent loader.cleanup() from closing assigned Maps and Programs. - for m := range assignedMaps { - delete(loader.maps, m) - } - for p := range assignedProgs { - delete(loader.programs, p) - } - - return nil -} - -// Collection is a collection of Programs and Maps associated -// with their symbols -type Collection struct { - Programs map[string]*Program - Maps map[string]*Map -} - -// NewCollection creates a Collection from the given spec, creating and -// loading its declared resources into the kernel. -// -// Omitting Collection.Close() during application shutdown is an error. -// See the package documentation for details around Map and Program lifecycle. -func NewCollection(spec *CollectionSpec) (*Collection, error) { - return NewCollectionWithOptions(spec, CollectionOptions{}) -} - -// NewCollectionWithOptions creates a Collection from the given spec using -// options, creating and loading its declared resources into the kernel. -// -// Omitting Collection.Close() during application shutdown is an error. -// See the package documentation for details around Map and Program lifecycle. -func NewCollectionWithOptions(spec *CollectionSpec, opts CollectionOptions) (*Collection, error) { - loader, err := newCollectionLoader(spec, &opts) - if err != nil { - return nil, err - } - defer loader.close() - - // Create maps first, as their fds need to be linked into programs. - for mapName := range spec.Maps { - if _, err := loader.loadMap(mapName); err != nil { - return nil, err - } - } - - for progName, prog := range spec.Programs { - if prog.Type == UnspecifiedProgram { - continue - } - - if _, err := loader.loadProgram(progName); err != nil { - return nil, err - } - } - - // Maps can contain Program and Map stubs, so populate them after - // all Maps and Programs have been successfully loaded. - if err := loader.populateDeferredMaps(); err != nil { - return nil, err - } - - // Prevent loader.cleanup from closing maps and programs. - maps, progs := loader.maps, loader.programs - loader.maps, loader.programs = nil, nil - - return &Collection{ - progs, - maps, - }, nil -} - -type collectionLoader struct { - coll *CollectionSpec - opts *CollectionOptions - maps map[string]*Map - programs map[string]*Program -} - -func newCollectionLoader(coll *CollectionSpec, opts *CollectionOptions) (*collectionLoader, error) { - if opts == nil { - opts = &CollectionOptions{} - } - - // Check for existing MapSpecs in the CollectionSpec for all provided replacement maps. - for name, m := range opts.MapReplacements { - spec, ok := coll.Maps[name] - if !ok { - return nil, fmt.Errorf("replacement map %s not found in CollectionSpec", name) - } - - if err := spec.Compatible(m); err != nil { - return nil, fmt.Errorf("using replacement map %s: %w", spec.Name, err) - } - } - - return &collectionLoader{ - coll, - opts, - make(map[string]*Map), - make(map[string]*Program), - }, nil -} - -// close all resources left over in the collectionLoader. -func (cl *collectionLoader) close() { - for _, m := range cl.maps { - m.Close() - } - for _, p := range cl.programs { - p.Close() - } -} - -func (cl *collectionLoader) loadMap(mapName string) (*Map, error) { - if m := cl.maps[mapName]; m != nil { - return m, nil - } - - mapSpec := cl.coll.Maps[mapName] - if mapSpec == nil { - return nil, fmt.Errorf("missing map %s", mapName) - } - - if replaceMap, ok := cl.opts.MapReplacements[mapName]; ok { - // Clone the map to avoid closing user's map later on. - m, err := replaceMap.Clone() - if err != nil { - return nil, err - } - - cl.maps[mapName] = m - return m, nil - } - - m, err := newMapWithOptions(mapSpec, cl.opts.Maps) - if err != nil { - return nil, fmt.Errorf("map %s: %w", mapName, err) - } - - // Finalize 'scalar' maps that don't refer to any other eBPF resources - // potentially pending creation. This is needed for frozen maps like .rodata - // that need to be finalized before invoking the verifier. - if !mapSpec.Type.canStoreMapOrProgram() { - if err := m.finalize(mapSpec); err != nil { - return nil, fmt.Errorf("finalizing map %s: %w", mapName, err) - } - } - - cl.maps[mapName] = m - return m, nil -} - -func (cl *collectionLoader) loadProgram(progName string) (*Program, error) { - if prog := cl.programs[progName]; prog != nil { - return prog, nil - } - - progSpec := cl.coll.Programs[progName] - if progSpec == nil { - return nil, fmt.Errorf("unknown program %s", progName) - } - - // Bail out early if we know the kernel is going to reject the program. - // This skips loading map dependencies, saving some cleanup work later. - if progSpec.Type == UnspecifiedProgram { - return nil, fmt.Errorf("cannot load program %s: program type is unspecified", progName) - } - - progSpec = progSpec.Copy() - - // Rewrite any reference to a valid map in the program's instructions, - // which includes all of its dependencies. - for i := range progSpec.Instructions { - ins := &progSpec.Instructions[i] - - if !ins.IsLoadFromMap() || ins.Reference() == "" { - continue - } - - // Don't overwrite map loads containing non-zero map fd's, - // they can be manually included by the caller. - // Map FDs/IDs are placed in the lower 32 bits of Constant. - if int32(ins.Constant) > 0 { - continue - } - - m, err := cl.loadMap(ins.Reference()) - if err != nil { - return nil, fmt.Errorf("program %s: %w", progName, err) - } - - if err := ins.AssociateMap(m); err != nil { - return nil, fmt.Errorf("program %s: map %s: %w", progName, ins.Reference(), err) - } - } - - prog, err := newProgramWithOptions(progSpec, cl.opts.Programs) - if err != nil { - return nil, fmt.Errorf("program %s: %w", progName, err) - } - - cl.programs[progName] = prog - return prog, nil -} - -// populateDeferredMaps iterates maps holding programs or other maps and loads -// any dependencies. Populates all maps in cl and freezes them if specified. -func (cl *collectionLoader) populateDeferredMaps() error { - for mapName, m := range cl.maps { - mapSpec, ok := cl.coll.Maps[mapName] - if !ok { - return fmt.Errorf("missing map spec %s", mapName) - } - - // Scalar maps without Map or Program references are finalized during - // creation. Don't finalize them again. - if !mapSpec.Type.canStoreMapOrProgram() { - continue - } - - mapSpec = mapSpec.Copy() - - // MapSpecs that refer to inner maps or programs within the same - // CollectionSpec do so using strings. These strings are used as the key - // to look up the respective object in the Maps or Programs fields. - // Resolve those references to actual Map or Program resources that - // have been loaded into the kernel. - for i, kv := range mapSpec.Contents { - objName, ok := kv.Value.(string) - if !ok { - continue - } - - switch t := mapSpec.Type; { - case t.canStoreProgram(): - // loadProgram is idempotent and could return an existing Program. - prog, err := cl.loadProgram(objName) - if err != nil { - return fmt.Errorf("loading program %s, for map %s: %w", objName, mapName, err) - } - mapSpec.Contents[i] = MapKV{kv.Key, prog} - - case t.canStoreMap(): - // loadMap is idempotent and could return an existing Map. - innerMap, err := cl.loadMap(objName) - if err != nil { - return fmt.Errorf("loading inner map %s, for map %s: %w", objName, mapName, err) - } - mapSpec.Contents[i] = MapKV{kv.Key, innerMap} - } - } - - // Populate and freeze the map if specified. - if err := m.finalize(mapSpec); err != nil { - return fmt.Errorf("populating map %s: %w", mapName, err) - } - } - - return nil -} - -// resolveKconfig resolves all variables declared in .kconfig and populates -// m.Contents. Does nothing if the given m.Contents is non-empty. -func resolveKconfig(m *MapSpec) error { - ds, ok := m.Value.(*btf.Datasec) - if !ok { - return errors.New("map value is not a Datasec") - } - - type configInfo struct { - offset uint32 - typ btf.Type - } - - configs := make(map[string]configInfo) - - data := make([]byte, ds.Size) - for _, vsi := range ds.Vars { - v := vsi.Type.(*btf.Var) - n := v.TypeName() - - switch n { - case "LINUX_KERNEL_VERSION": - if integer, ok := v.Type.(*btf.Int); !ok || integer.Size != 4 { - return fmt.Errorf("variable %s must be a 32 bits integer, got %s", n, v.Type) - } - - kv, err := internal.KernelVersion() - if err != nil { - return fmt.Errorf("getting kernel version: %w", err) - } - internal.NativeEndian.PutUint32(data[vsi.Offset:], kv.Kernel()) - - case "LINUX_HAS_SYSCALL_WRAPPER": - integer, ok := v.Type.(*btf.Int) - if !ok { - return fmt.Errorf("variable %s must be an integer, got %s", n, v.Type) - } - var value uint64 = 1 - if err := haveSyscallWrapper(); errors.Is(err, ErrNotSupported) { - value = 0 - } else if err != nil { - return fmt.Errorf("unable to derive a value for LINUX_HAS_SYSCALL_WRAPPER: %w", err) - } - - if err := kconfig.PutInteger(data[vsi.Offset:], integer, value); err != nil { - return fmt.Errorf("set LINUX_HAS_SYSCALL_WRAPPER: %w", err) - } - - default: // Catch CONFIG_*. - configs[n] = configInfo{ - offset: vsi.Offset, - typ: v.Type, - } - } - } - - // We only parse kconfig file if a CONFIG_* variable was found. - if len(configs) > 0 { - f, err := kconfig.Find() - if err != nil { - return fmt.Errorf("cannot find a kconfig file: %w", err) - } - defer f.Close() - - filter := make(map[string]struct{}, len(configs)) - for config := range configs { - filter[config] = struct{}{} - } - - kernelConfig, err := kconfig.Parse(f, filter) - if err != nil { - return fmt.Errorf("cannot parse kconfig file: %w", err) - } - - for n, info := range configs { - value, ok := kernelConfig[n] - if !ok { - return fmt.Errorf("config option %q does not exists for this kernel", n) - } - - err := kconfig.PutValue(data[info.offset:], info.typ, value) - if err != nil { - return fmt.Errorf("problem adding value for %s: %w", n, err) - } - } - } - - m.Contents = []MapKV{{uint32(0), data}} - - return nil -} - -// LoadCollection reads an object file and creates and loads its declared -// resources into the kernel. -// -// Omitting Collection.Close() during application shutdown is an error. -// See the package documentation for details around Map and Program lifecycle. -func LoadCollection(file string) (*Collection, error) { - spec, err := LoadCollectionSpec(file) - if err != nil { - return nil, err - } - return NewCollection(spec) -} - -// Assign the contents of a Collection to a struct. -// -// This function bridges functionality between bpf2go generated -// code and any functionality better implemented in Collection. -// -// 'to' must be a pointer to a struct. A field of the -// struct is updated with values from Programs or Maps if it -// has an `ebpf` tag and its type is *Program or *Map. -// The tag's value specifies the name of the program or map as -// found in the CollectionSpec. -// -// struct { -// Foo *ebpf.Program `ebpf:"xdp_foo"` -// Bar *ebpf.Map `ebpf:"bar_map"` -// Ignored int -// } -// -// Returns an error if any of the eBPF objects can't be found, or -// if the same Map or Program is assigned multiple times. -// -// Ownership and Close()ing responsibility is transferred to `to` -// for any successful assigns. On error `to` is left in an undefined state. -func (coll *Collection) Assign(to interface{}) error { - assignedMaps := make(map[string]bool) - assignedProgs := make(map[string]bool) - - // Assign() only transfers already-loaded Maps and Programs. No extra - // loading is done. - getValue := func(typ reflect.Type, name string) (interface{}, error) { - switch typ { - - case reflect.TypeOf((*Program)(nil)): - if p := coll.Programs[name]; p != nil { - assignedProgs[name] = true - return p, nil - } - return nil, fmt.Errorf("missing program %q", name) - - case reflect.TypeOf((*Map)(nil)): - if m := coll.Maps[name]; m != nil { - assignedMaps[name] = true - return m, nil - } - return nil, fmt.Errorf("missing map %q", name) - - default: - return nil, fmt.Errorf("unsupported type %s", typ) - } - } - - if err := assignValues(to, getValue); err != nil { - return err - } - - // Finalize ownership transfer - for p := range assignedProgs { - delete(coll.Programs, p) - } - for m := range assignedMaps { - delete(coll.Maps, m) - } - - return nil -} - -// Close frees all maps and programs associated with the collection. -// -// The collection mustn't be used afterwards. -func (coll *Collection) Close() { - for _, prog := range coll.Programs { - prog.Close() - } - for _, m := range coll.Maps { - m.Close() - } -} - -// DetachMap removes the named map from the Collection. -// -// This means that a later call to Close() will not affect this map. -// -// Returns nil if no map of that name exists. -func (coll *Collection) DetachMap(name string) *Map { - m := coll.Maps[name] - delete(coll.Maps, name) - return m -} - -// DetachProgram removes the named program from the Collection. -// -// This means that a later call to Close() will not affect this program. -// -// Returns nil if no program of that name exists. -func (coll *Collection) DetachProgram(name string) *Program { - p := coll.Programs[name] - delete(coll.Programs, name) - return p -} - -// structField represents a struct field containing the ebpf struct tag. -type structField struct { - reflect.StructField - value reflect.Value -} - -// ebpfFields extracts field names tagged with 'ebpf' from a struct type. -// Keep track of visited types to avoid infinite recursion. -func ebpfFields(structVal reflect.Value, visited map[reflect.Type]bool) ([]structField, error) { - if visited == nil { - visited = make(map[reflect.Type]bool) - } - - structType := structVal.Type() - if structType.Kind() != reflect.Struct { - return nil, fmt.Errorf("%s is not a struct", structType) - } - - if visited[structType] { - return nil, fmt.Errorf("recursion on type %s", structType) - } - - fields := make([]structField, 0, structType.NumField()) - for i := 0; i < structType.NumField(); i++ { - field := structField{structType.Field(i), structVal.Field(i)} - - // If the field is tagged, gather it and move on. - name := field.Tag.Get("ebpf") - if name != "" { - fields = append(fields, field) - continue - } - - // If the field does not have an ebpf tag, but is a struct or a pointer - // to a struct, attempt to gather its fields as well. - var v reflect.Value - switch field.Type.Kind() { - case reflect.Ptr: - if field.Type.Elem().Kind() != reflect.Struct { - continue - } - - if field.value.IsNil() { - return nil, fmt.Errorf("nil pointer to %s", structType) - } - - // Obtain the destination type of the pointer. - v = field.value.Elem() - - case reflect.Struct: - // Reference the value's type directly. - v = field.value - - default: - continue - } - - inner, err := ebpfFields(v, visited) - if err != nil { - return nil, fmt.Errorf("field %s: %w", field.Name, err) - } - - fields = append(fields, inner...) - } - - return fields, nil -} - -// assignValues attempts to populate all fields of 'to' tagged with 'ebpf'. -// -// getValue is called for every tagged field of 'to' and must return the value -// to be assigned to the field with the given typ and name. -func assignValues(to interface{}, - getValue func(typ reflect.Type, name string) (interface{}, error)) error { - - toValue := reflect.ValueOf(to) - if toValue.Type().Kind() != reflect.Ptr { - return fmt.Errorf("%T is not a pointer to struct", to) - } - - if toValue.IsNil() { - return fmt.Errorf("nil pointer to %T", to) - } - - fields, err := ebpfFields(toValue.Elem(), nil) - if err != nil { - return err - } - - type elem struct { - // Either *Map or *Program - typ reflect.Type - name string - } - - assigned := make(map[elem]string) - for _, field := range fields { - // Get string value the field is tagged with. - tag := field.Tag.Get("ebpf") - if strings.Contains(tag, ",") { - return fmt.Errorf("field %s: ebpf tag contains a comma", field.Name) - } - - // Check if the eBPF object with the requested - // type and tag was already assigned elsewhere. - e := elem{field.Type, tag} - if af := assigned[e]; af != "" { - return fmt.Errorf("field %s: object %q was already assigned to %s", field.Name, tag, af) - } - - // Get the eBPF object referred to by the tag. - value, err := getValue(field.Type, tag) - if err != nil { - return fmt.Errorf("field %s: %w", field.Name, err) - } - - if !field.value.CanSet() { - return fmt.Errorf("field %s: can't set value", field.Name) - } - field.value.Set(reflect.ValueOf(value)) - - assigned[e] = field.Name - } - - return nil -} diff --git a/vendor/github.com/cilium/ebpf/cpu.go b/vendor/github.com/cilium/ebpf/cpu.go deleted file mode 100644 index 07e959efd..000000000 --- a/vendor/github.com/cilium/ebpf/cpu.go +++ /dev/null @@ -1,66 +0,0 @@ -package ebpf - -import ( - "fmt" - "os" - "strings" - "sync" -) - -var possibleCPU = sync.OnceValues(func() (int, error) { - return parseCPUsFromFile("/sys/devices/system/cpu/possible") -}) - -// PossibleCPU returns the max number of CPUs a system may possibly have -// Logical CPU numbers must be of the form 0-n -func PossibleCPU() (int, error) { - return possibleCPU() -} - -// MustPossibleCPU is a helper that wraps a call to PossibleCPU and panics if -// the error is non-nil. -func MustPossibleCPU() int { - cpus, err := PossibleCPU() - if err != nil { - panic(err) - } - return cpus -} - -func parseCPUsFromFile(path string) (int, error) { - spec, err := os.ReadFile(path) - if err != nil { - return 0, err - } - - n, err := parseCPUs(string(spec)) - if err != nil { - return 0, fmt.Errorf("can't parse %s: %v", path, err) - } - - return n, nil -} - -// parseCPUs parses the number of cpus from a string produced -// by bitmap_list_string() in the Linux kernel. -// Multiple ranges are rejected, since they can't be unified -// into a single number. -// This is the format of /sys/devices/system/cpu/possible, it -// is not suitable for /sys/devices/system/cpu/online, etc. -func parseCPUs(spec string) (int, error) { - if strings.Trim(spec, "\n") == "0" { - return 1, nil - } - - var low, high int - n, err := fmt.Sscanf(spec, "%d-%d\n", &low, &high) - if n != 2 || err != nil { - return 0, fmt.Errorf("invalid format: %s", spec) - } - if low != 0 { - return 0, fmt.Errorf("CPU spec doesn't start at zero: %s", spec) - } - - // cpus is 0 indexed - return high + 1, nil -} diff --git a/vendor/github.com/cilium/ebpf/doc.go b/vendor/github.com/cilium/ebpf/doc.go deleted file mode 100644 index 396b3394d..000000000 --- a/vendor/github.com/cilium/ebpf/doc.go +++ /dev/null @@ -1,25 +0,0 @@ -// Package ebpf is a toolkit for working with eBPF programs. -// -// eBPF programs are small snippets of code which are executed directly -// in a VM in the Linux kernel, which makes them very fast and flexible. -// Many Linux subsystems now accept eBPF programs. This makes it possible -// to implement highly application specific logic inside the kernel, -// without having to modify the actual kernel itself. -// -// This package is designed for long-running processes which -// want to use eBPF to implement part of their application logic. It has no -// run-time dependencies outside of the library and the Linux kernel itself. -// eBPF code should be compiled ahead of time using clang, and shipped with -// your application as any other resource. -// -// Use the link subpackage to attach a loaded program to a hook in the kernel. -// -// Note that losing all references to Map and Program resources will cause -// their underlying file descriptors to be closed, potentially removing those -// objects from the kernel. Always retain a reference by e.g. deferring a -// Close() of a Collection or LoadAndAssign object until application exit. -// -// Special care needs to be taken when handling maps of type ProgramArray, -// as the kernel erases its contents when the last userspace or bpffs -// reference disappears, regardless of the map being in active use. -package ebpf diff --git a/vendor/github.com/cilium/ebpf/elf_reader.go b/vendor/github.com/cilium/ebpf/elf_reader.go deleted file mode 100644 index d55ab8892..000000000 --- a/vendor/github.com/cilium/ebpf/elf_reader.go +++ /dev/null @@ -1,1334 +0,0 @@ -package ebpf - -import ( - "bufio" - "bytes" - "debug/elf" - "encoding/binary" - "errors" - "fmt" - "io" - "math" - "os" - "strings" - - "github.com/cilium/ebpf/asm" - "github.com/cilium/ebpf/btf" - "github.com/cilium/ebpf/internal" - "github.com/cilium/ebpf/internal/sys" - "github.com/cilium/ebpf/internal/unix" -) - -type kconfigMetaKey struct{} - -type kconfigMeta struct { - Map *MapSpec - Offset uint32 -} - -type kfuncMetaKey struct{} - -type kfuncMeta struct { - Binding elf.SymBind - Func *btf.Func -} - -// elfCode is a convenience to reduce the amount of arguments that have to -// be passed around explicitly. You should treat its contents as immutable. -type elfCode struct { - *internal.SafeELFFile - sections map[elf.SectionIndex]*elfSection - license string - version uint32 - btf *btf.Spec - extInfo *btf.ExtInfos - maps map[string]*MapSpec - kfuncs map[string]*btf.Func - kconfig *MapSpec -} - -// LoadCollectionSpec parses an ELF file into a CollectionSpec. -func LoadCollectionSpec(file string) (*CollectionSpec, error) { - f, err := os.Open(file) - if err != nil { - return nil, err - } - defer f.Close() - - spec, err := LoadCollectionSpecFromReader(f) - if err != nil { - return nil, fmt.Errorf("file %s: %w", file, err) - } - return spec, nil -} - -// LoadCollectionSpecFromReader parses an ELF file into a CollectionSpec. -func LoadCollectionSpecFromReader(rd io.ReaderAt) (*CollectionSpec, error) { - f, err := internal.NewSafeELFFile(rd) - if err != nil { - return nil, err - } - - // Checks if the ELF file is for BPF data. - // Old LLVM versions set e_machine to EM_NONE. - if f.File.Machine != unix.EM_NONE && f.File.Machine != elf.EM_BPF { - return nil, fmt.Errorf("unexpected machine type for BPF ELF: %s", f.File.Machine) - } - - var ( - licenseSection *elf.Section - versionSection *elf.Section - sections = make(map[elf.SectionIndex]*elfSection) - relSections = make(map[elf.SectionIndex]*elf.Section) - ) - - // This is the target of relocations generated by inline assembly. - sections[elf.SHN_UNDEF] = newElfSection(new(elf.Section), undefSection) - - // Collect all the sections we're interested in. This includes relocations - // which we parse later. - // - // Keep the documentation at docs/ebpf/loading/elf-sections.md up-to-date. - for i, sec := range f.Sections { - idx := elf.SectionIndex(i) - - switch { - case strings.HasPrefix(sec.Name, "license"): - licenseSection = sec - case strings.HasPrefix(sec.Name, "version"): - versionSection = sec - case strings.HasPrefix(sec.Name, "maps"): - sections[idx] = newElfSection(sec, mapSection) - case sec.Name == ".maps": - sections[idx] = newElfSection(sec, btfMapSection) - case sec.Name == ".bss" || sec.Name == ".data" || strings.HasPrefix(sec.Name, ".rodata"): - sections[idx] = newElfSection(sec, dataSection) - case sec.Type == elf.SHT_REL: - // Store relocations under the section index of the target - relSections[elf.SectionIndex(sec.Info)] = sec - case sec.Type == elf.SHT_PROGBITS && (sec.Flags&elf.SHF_EXECINSTR) != 0 && sec.Size > 0: - sections[idx] = newElfSection(sec, programSection) - } - } - - license, err := loadLicense(licenseSection) - if err != nil { - return nil, fmt.Errorf("load license: %w", err) - } - - version, err := loadVersion(versionSection, f.ByteOrder) - if err != nil { - return nil, fmt.Errorf("load version: %w", err) - } - - btfSpec, btfExtInfo, err := btf.LoadSpecAndExtInfosFromReader(rd) - if err != nil && !errors.Is(err, btf.ErrNotFound) { - return nil, fmt.Errorf("load BTF: %w", err) - } - - ec := &elfCode{ - SafeELFFile: f, - sections: sections, - license: license, - version: version, - btf: btfSpec, - extInfo: btfExtInfo, - maps: make(map[string]*MapSpec), - kfuncs: make(map[string]*btf.Func), - } - - symbols, err := f.Symbols() - if err != nil { - return nil, fmt.Errorf("load symbols: %v", err) - } - - ec.assignSymbols(symbols) - - if err := ec.loadRelocations(relSections, symbols); err != nil { - return nil, fmt.Errorf("load relocations: %w", err) - } - - if err := ec.loadMaps(); err != nil { - return nil, fmt.Errorf("load maps: %w", err) - } - - if err := ec.loadBTFMaps(); err != nil { - return nil, fmt.Errorf("load BTF maps: %w", err) - } - - if err := ec.loadDataSections(); err != nil { - return nil, fmt.Errorf("load data sections: %w", err) - } - - if err := ec.loadKconfigSection(); err != nil { - return nil, fmt.Errorf("load virtual .kconfig section: %w", err) - } - - if err := ec.loadKsymsSection(); err != nil { - return nil, fmt.Errorf("load virtual .ksyms section: %w", err) - } - - // Finally, collect programs and link them. - progs, err := ec.loadProgramSections() - if err != nil { - return nil, fmt.Errorf("load programs: %w", err) - } - - return &CollectionSpec{ec.maps, progs, btfSpec, ec.ByteOrder}, nil -} - -func loadLicense(sec *elf.Section) (string, error) { - if sec == nil { - return "", nil - } - - data, err := sec.Data() - if err != nil { - return "", fmt.Errorf("section %s: %v", sec.Name, err) - } - return string(bytes.TrimRight(data, "\000")), nil -} - -func loadVersion(sec *elf.Section, bo binary.ByteOrder) (uint32, error) { - if sec == nil { - return 0, nil - } - - var version uint32 - if err := binary.Read(sec.Open(), bo, &version); err != nil { - return 0, fmt.Errorf("section %s: %v", sec.Name, err) - } - return version, nil -} - -type elfSectionKind int - -const ( - undefSection elfSectionKind = iota - mapSection - btfMapSection - programSection - dataSection -) - -type elfSection struct { - *elf.Section - kind elfSectionKind - // Offset from the start of the section to a symbol - symbols map[uint64]elf.Symbol - // Offset from the start of the section to a relocation, which points at - // a symbol in another section. - relocations map[uint64]elf.Symbol - // The number of relocations pointing at this section. - references int -} - -func newElfSection(section *elf.Section, kind elfSectionKind) *elfSection { - return &elfSection{ - section, - kind, - make(map[uint64]elf.Symbol), - make(map[uint64]elf.Symbol), - 0, - } -} - -// assignSymbols takes a list of symbols and assigns them to their -// respective sections, indexed by name. -func (ec *elfCode) assignSymbols(symbols []elf.Symbol) { - for _, symbol := range symbols { - symType := elf.ST_TYPE(symbol.Info) - symSection := ec.sections[symbol.Section] - if symSection == nil { - continue - } - - // Anonymous symbols only occur in debug sections which we don't process - // relocations for. Anonymous symbols are not referenced from other sections. - if symbol.Name == "" { - continue - } - - // Older versions of LLVM don't tag symbols correctly, so keep - // all NOTYPE ones. - switch symSection.kind { - case mapSection, btfMapSection, dataSection: - if symType != elf.STT_NOTYPE && symType != elf.STT_OBJECT { - continue - } - case programSection: - if symType != elf.STT_NOTYPE && symType != elf.STT_FUNC { - continue - } - // LLVM emits LBB_ (Local Basic Block) symbols that seem to be jump - // targets within sections, but BPF has no use for them. - if symType == elf.STT_NOTYPE && elf.ST_BIND(symbol.Info) == elf.STB_LOCAL && - strings.HasPrefix(symbol.Name, "LBB") { - continue - } - // Only collect symbols that occur in program/maps/data sections. - default: - continue - } - - symSection.symbols[symbol.Value] = symbol - } -} - -// loadRelocations iterates .rel* sections and extracts relocation entries for -// sections of interest. Makes sure relocations point at valid sections. -func (ec *elfCode) loadRelocations(relSections map[elf.SectionIndex]*elf.Section, symbols []elf.Symbol) error { - for idx, relSection := range relSections { - section := ec.sections[idx] - if section == nil { - continue - } - - rels, err := ec.loadSectionRelocations(relSection, symbols) - if err != nil { - return fmt.Errorf("relocation for section %q: %w", section.Name, err) - } - - for _, rel := range rels { - target := ec.sections[rel.Section] - if target == nil { - return fmt.Errorf("section %q: reference to %q in section %s: %w", section.Name, rel.Name, rel.Section, ErrNotSupported) - } - - target.references++ - } - - section.relocations = rels - } - - return nil -} - -// loadProgramSections iterates ec's sections and emits a ProgramSpec -// for each function it finds. -// -// The resulting map is indexed by function name. -func (ec *elfCode) loadProgramSections() (map[string]*ProgramSpec, error) { - - progs := make(map[string]*ProgramSpec) - - // Generate a ProgramSpec for each function found in each program section. - var export []string - for _, sec := range ec.sections { - if sec.kind != programSection { - continue - } - - if len(sec.symbols) == 0 { - return nil, fmt.Errorf("section %v: missing symbols", sec.Name) - } - - funcs, err := ec.loadFunctions(sec) - if err != nil { - return nil, fmt.Errorf("section %v: %w", sec.Name, err) - } - - progType, attachType, progFlags, attachTo := getProgType(sec.Name) - - for name, insns := range funcs { - spec := &ProgramSpec{ - Name: name, - Type: progType, - Flags: progFlags, - AttachType: attachType, - AttachTo: attachTo, - SectionName: sec.Name, - License: ec.license, - KernelVersion: ec.version, - Instructions: insns, - ByteOrder: ec.ByteOrder, - } - - // Function names must be unique within a single ELF blob. - if progs[name] != nil { - return nil, fmt.Errorf("duplicate program name %s", name) - } - progs[name] = spec - - if spec.SectionName != ".text" { - export = append(export, name) - } - } - } - - flattenPrograms(progs, export) - - // Hide programs (e.g. library functions) that were not explicitly emitted - // to an ELF section. These could be exposed in a separate CollectionSpec - // field later to allow them to be modified. - for n, p := range progs { - if p.SectionName == ".text" { - delete(progs, n) - } - } - - return progs, nil -} - -// loadFunctions extracts instruction streams from the given program section -// starting at each symbol in the section. The section's symbols must already -// be narrowed down to STT_NOTYPE (emitted by clang <8) or STT_FUNC. -// -// The resulting map is indexed by function name. -func (ec *elfCode) loadFunctions(section *elfSection) (map[string]asm.Instructions, error) { - r := bufio.NewReader(section.Open()) - - // Decode the section's instruction stream. - insns := make(asm.Instructions, 0, section.Size/asm.InstructionSize) - if err := insns.Unmarshal(r, ec.ByteOrder); err != nil { - return nil, fmt.Errorf("decoding instructions for section %s: %w", section.Name, err) - } - if len(insns) == 0 { - return nil, fmt.Errorf("no instructions found in section %s", section.Name) - } - - iter := insns.Iterate() - for iter.Next() { - ins := iter.Ins - offset := iter.Offset.Bytes() - - // Tag Symbol Instructions. - if sym, ok := section.symbols[offset]; ok { - *ins = ins.WithSymbol(sym.Name) - } - - // Apply any relocations for the current instruction. - // If no relocation is present, resolve any section-relative function calls. - if rel, ok := section.relocations[offset]; ok { - if err := ec.relocateInstruction(ins, rel); err != nil { - return nil, fmt.Errorf("offset %d: relocating instruction: %w", offset, err) - } - } else { - if err := referenceRelativeJump(ins, offset, section.symbols); err != nil { - return nil, fmt.Errorf("offset %d: resolving relative jump: %w", offset, err) - } - } - } - - if ec.extInfo != nil { - ec.extInfo.Assign(insns, section.Name) - } - - return splitSymbols(insns) -} - -// referenceRelativeJump turns a relative jump to another bpf subprogram within -// the same ELF section into a Reference Instruction. -// -// Up to LLVM 9, calls to subprograms within the same ELF section are sometimes -// encoded using relative jumps instead of relocation entries. These jumps go -// out of bounds of the current program, so their targets must be memoized -// before the section's instruction stream is split. -// -// The relative jump Constant is blinded to -1 and the target Symbol is set as -// the Instruction's Reference so it can be resolved by the linker. -func referenceRelativeJump(ins *asm.Instruction, offset uint64, symbols map[uint64]elf.Symbol) error { - if !ins.IsFunctionReference() || ins.Constant == -1 { - return nil - } - - tgt := jumpTarget(offset, *ins) - sym := symbols[tgt].Name - if sym == "" { - return fmt.Errorf("no jump target found at offset %d", tgt) - } - - *ins = ins.WithReference(sym) - ins.Constant = -1 - - return nil -} - -// jumpTarget takes ins' offset within an instruction stream (in bytes) -// and returns its absolute jump destination (in bytes) within the -// instruction stream. -func jumpTarget(offset uint64, ins asm.Instruction) uint64 { - // A relative jump instruction describes the amount of raw BPF instructions - // to jump, convert the offset into bytes. - dest := ins.Constant * asm.InstructionSize - - // The starting point of the jump is the end of the current instruction. - dest += int64(offset + asm.InstructionSize) - - if dest < 0 { - return 0 - } - - return uint64(dest) -} - -var errUnsupportedBinding = errors.New("unsupported binding") - -func (ec *elfCode) relocateInstruction(ins *asm.Instruction, rel elf.Symbol) error { - var ( - typ = elf.ST_TYPE(rel.Info) - bind = elf.ST_BIND(rel.Info) - name = rel.Name - ) - - target := ec.sections[rel.Section] - - switch target.kind { - case mapSection, btfMapSection: - if bind == elf.STB_LOCAL { - return fmt.Errorf("possible erroneous static qualifier on map definition: found reference to %q", name) - } - - if bind != elf.STB_GLOBAL { - return fmt.Errorf("map %q: %w: %s", name, errUnsupportedBinding, bind) - } - - if typ != elf.STT_OBJECT && typ != elf.STT_NOTYPE { - // STT_NOTYPE is generated on clang < 8 which doesn't tag - // relocations appropriately. - return fmt.Errorf("map load: incorrect relocation type %v", typ) - } - - ins.Src = asm.PseudoMapFD - - case dataSection: - var offset uint32 - switch typ { - case elf.STT_SECTION: - if bind != elf.STB_LOCAL { - return fmt.Errorf("direct load: %s: %w: %s", name, errUnsupportedBinding, bind) - } - - // This is really a reference to a static symbol, which clang doesn't - // emit a symbol table entry for. Instead it encodes the offset in - // the instruction itself. - offset = uint32(uint64(ins.Constant)) - - case elf.STT_OBJECT: - // LLVM 9 emits OBJECT-LOCAL symbols for anonymous constants. - if bind != elf.STB_GLOBAL && bind != elf.STB_LOCAL { - return fmt.Errorf("direct load: %s: %w: %s", name, errUnsupportedBinding, bind) - } - - offset = uint32(rel.Value) - - case elf.STT_NOTYPE: - // LLVM 7 emits NOTYPE-LOCAL symbols for anonymous constants. - if bind != elf.STB_LOCAL { - return fmt.Errorf("direct load: %s: %w: %s", name, errUnsupportedBinding, bind) - } - - offset = uint32(rel.Value) - - default: - return fmt.Errorf("incorrect relocation type %v for direct map load", typ) - } - - // We rely on using the name of the data section as the reference. It - // would be nicer to keep the real name in case of an STT_OBJECT, but - // it's not clear how to encode that into Instruction. - name = target.Name - - // The kernel expects the offset in the second basic BPF instruction. - ins.Constant = int64(uint64(offset) << 32) - ins.Src = asm.PseudoMapValue - - case programSection: - switch opCode := ins.OpCode; { - case opCode.JumpOp() == asm.Call: - if ins.Src != asm.PseudoCall { - return fmt.Errorf("call: %s: incorrect source register", name) - } - - switch typ { - case elf.STT_NOTYPE, elf.STT_FUNC: - if bind != elf.STB_GLOBAL { - return fmt.Errorf("call: %s: %w: %s", name, errUnsupportedBinding, bind) - } - - case elf.STT_SECTION: - if bind != elf.STB_LOCAL { - return fmt.Errorf("call: %s: %w: %s", name, errUnsupportedBinding, bind) - } - - // The function we want to call is in the indicated section, - // at the offset encoded in the instruction itself. Reverse - // the calculation to find the real function we're looking for. - // A value of -1 references the first instruction in the section. - offset := int64(int32(ins.Constant)+1) * asm.InstructionSize - sym, ok := target.symbols[uint64(offset)] - if !ok { - return fmt.Errorf("call: no symbol at offset %d", offset) - } - - name = sym.Name - ins.Constant = -1 - - default: - return fmt.Errorf("call: %s: invalid symbol type %s", name, typ) - } - case opCode.IsDWordLoad(): - switch typ { - case elf.STT_FUNC: - if bind != elf.STB_GLOBAL { - return fmt.Errorf("load: %s: %w: %s", name, errUnsupportedBinding, bind) - } - - case elf.STT_SECTION: - if bind != elf.STB_LOCAL { - return fmt.Errorf("load: %s: %w: %s", name, errUnsupportedBinding, bind) - } - - // ins.Constant already contains the offset in bytes from the - // start of the section. This is different than a call to a - // static function. - - default: - return fmt.Errorf("load: %s: invalid symbol type %s", name, typ) - } - - sym, ok := target.symbols[uint64(ins.Constant)] - if !ok { - return fmt.Errorf("load: no symbol at offset %d", ins.Constant) - } - - name = sym.Name - ins.Constant = -1 - ins.Src = asm.PseudoFunc - - default: - return fmt.Errorf("neither a call nor a load instruction: %v", ins) - } - - // The Undefined section is used for 'virtual' symbols that aren't backed by - // an ELF section. This includes symbol references from inline asm, forward - // function declarations, as well as extern kfunc declarations using __ksym - // and extern kconfig variables declared using __kconfig. - case undefSection: - if bind != elf.STB_GLOBAL && bind != elf.STB_WEAK { - return fmt.Errorf("asm relocation: %s: %w: %s", name, errUnsupportedBinding, bind) - } - - if typ != elf.STT_NOTYPE { - return fmt.Errorf("asm relocation: %s: unsupported type %s", name, typ) - } - - kf := ec.kfuncs[name] - switch { - // If a Call / DWordLoad instruction is found and the datasec has a btf.Func with a Name - // that matches the symbol name we mark the instruction as a referencing a kfunc. - case kf != nil && ins.OpCode.JumpOp() == asm.Call: - ins.Metadata.Set(kfuncMetaKey{}, &kfuncMeta{ - Func: kf, - Binding: bind, - }) - - ins.Src = asm.PseudoKfuncCall - ins.Constant = -1 - - case kf != nil && ins.OpCode.IsDWordLoad(): - ins.Metadata.Set(kfuncMetaKey{}, &kfuncMeta{ - Func: kf, - Binding: bind, - }) - - ins.Constant = 0 - - // If no kconfig map is found, this must be a symbol reference from inline - // asm (see testdata/loader.c:asm_relocation()) or a call to a forward - // function declaration (see testdata/fwd_decl.c). Don't interfere, These - // remain standard symbol references. - // extern __kconfig reads are represented as dword loads that need to be - // rewritten to pseudo map loads from .kconfig. If the map is present, - // require it to contain the symbol to disambiguate between inline asm - // relos and kconfigs. - case ec.kconfig != nil && ins.OpCode.IsDWordLoad(): - if bind != elf.STB_GLOBAL { - return fmt.Errorf("asm relocation: %s: %w: %s", name, errUnsupportedBinding, bind) - } - - for _, vsi := range ec.kconfig.Value.(*btf.Datasec).Vars { - if vsi.Type.(*btf.Var).Name != rel.Name { - continue - } - - ins.Src = asm.PseudoMapValue - ins.Metadata.Set(kconfigMetaKey{}, &kconfigMeta{ec.kconfig, vsi.Offset}) - return nil - } - - return fmt.Errorf("kconfig %s not found in .kconfig", rel.Name) - } - - default: - return fmt.Errorf("relocation to %q: %w", target.Name, ErrNotSupported) - } - - *ins = ins.WithReference(name) - return nil -} - -func (ec *elfCode) loadMaps() error { - for _, sec := range ec.sections { - if sec.kind != mapSection { - continue - } - - nSym := len(sec.symbols) - if nSym == 0 { - return fmt.Errorf("section %v: no symbols", sec.Name) - } - - if sec.Size%uint64(nSym) != 0 { - return fmt.Errorf("section %v: map descriptors are not of equal size", sec.Name) - } - - var ( - r = bufio.NewReader(sec.Open()) - size = sec.Size / uint64(nSym) - ) - for i, offset := 0, uint64(0); i < nSym; i, offset = i+1, offset+size { - mapSym, ok := sec.symbols[offset] - if !ok { - return fmt.Errorf("section %s: missing symbol for map at offset %d", sec.Name, offset) - } - - mapName := mapSym.Name - if ec.maps[mapName] != nil { - return fmt.Errorf("section %v: map %v already exists", sec.Name, mapSym) - } - - lr := io.LimitReader(r, int64(size)) - - spec := MapSpec{ - Name: SanitizeName(mapName, -1), - } - switch { - case binary.Read(lr, ec.ByteOrder, &spec.Type) != nil: - return fmt.Errorf("map %s: missing type", mapName) - case binary.Read(lr, ec.ByteOrder, &spec.KeySize) != nil: - return fmt.Errorf("map %s: missing key size", mapName) - case binary.Read(lr, ec.ByteOrder, &spec.ValueSize) != nil: - return fmt.Errorf("map %s: missing value size", mapName) - case binary.Read(lr, ec.ByteOrder, &spec.MaxEntries) != nil: - return fmt.Errorf("map %s: missing max entries", mapName) - case binary.Read(lr, ec.ByteOrder, &spec.Flags) != nil: - return fmt.Errorf("map %s: missing flags", mapName) - } - - extra, err := io.ReadAll(lr) - if err != nil { - return fmt.Errorf("map %s: reading map tail: %w", mapName, err) - } - if len(extra) > 0 { - spec.Extra = bytes.NewReader(extra) - } - - ec.maps[mapName] = &spec - } - } - - return nil -} - -// loadBTFMaps iterates over all ELF sections marked as BTF map sections -// (like .maps) and parses them into MapSpecs. Dump the .maps section and -// any relocations with `readelf -x .maps -r `. -func (ec *elfCode) loadBTFMaps() error { - for _, sec := range ec.sections { - if sec.kind != btfMapSection { - continue - } - - if ec.btf == nil { - return fmt.Errorf("missing BTF") - } - - // Each section must appear as a DataSec in the ELF's BTF blob. - var ds *btf.Datasec - if err := ec.btf.TypeByName(sec.Name, &ds); err != nil { - return fmt.Errorf("cannot find section '%s' in BTF: %w", sec.Name, err) - } - - // Open a Reader to the ELF's raw section bytes so we can assert that all - // of them are zero on a per-map (per-Var) basis. For now, the section's - // sole purpose is to receive relocations, so all must be zero. - rs := sec.Open() - - for _, vs := range ds.Vars { - // BPF maps are declared as and assigned to global variables, - // so iterate over each Var in the DataSec and validate their types. - v, ok := vs.Type.(*btf.Var) - if !ok { - return fmt.Errorf("section %v: unexpected type %s", sec.Name, vs.Type) - } - name := string(v.Name) - - // The BTF metadata for each Var contains the full length of the map - // declaration, so read the corresponding amount of bytes from the ELF. - // This way, we can pinpoint which map declaration contains unexpected - // (and therefore unsupported) data. - _, err := io.Copy(internal.DiscardZeroes{}, io.LimitReader(rs, int64(vs.Size))) - if err != nil { - return fmt.Errorf("section %v: map %s: initializing BTF map definitions: %w", sec.Name, name, internal.ErrNotSupported) - } - - if ec.maps[name] != nil { - return fmt.Errorf("section %v: map %s already exists", sec.Name, name) - } - - // Each Var representing a BTF map definition contains a Struct. - mapStruct, ok := btf.UnderlyingType(v.Type).(*btf.Struct) - if !ok { - return fmt.Errorf("expected struct, got %s", v.Type) - } - - mapSpec, err := mapSpecFromBTF(sec, &vs, mapStruct, ec.btf, name, false) - if err != nil { - return fmt.Errorf("map %v: %w", name, err) - } - - ec.maps[name] = mapSpec - } - - // Drain the ELF section reader to make sure all bytes are accounted for - // with BTF metadata. - i, err := io.Copy(io.Discard, rs) - if err != nil { - return fmt.Errorf("section %v: unexpected error reading remainder of ELF section: %w", sec.Name, err) - } - if i > 0 { - return fmt.Errorf("section %v: %d unexpected remaining bytes in ELF section, invalid BTF?", sec.Name, i) - } - } - - return nil -} - -// mapSpecFromBTF produces a MapSpec based on a btf.Struct def representing -// a BTF map definition. The name and spec arguments will be copied to the -// resulting MapSpec, and inner must be true on any recursive invocations. -func mapSpecFromBTF(es *elfSection, vs *btf.VarSecinfo, def *btf.Struct, spec *btf.Spec, name string, inner bool) (*MapSpec, error) { - var ( - key, value btf.Type - keySize, valueSize uint32 - mapType MapType - flags, maxEntries uint32 - pinType PinType - innerMapSpec *MapSpec - contents []MapKV - err error - ) - - for i, member := range def.Members { - switch member.Name { - case "type": - mt, err := uintFromBTF(member.Type) - if err != nil { - return nil, fmt.Errorf("can't get type: %w", err) - } - mapType = MapType(mt) - - case "map_flags": - flags, err = uintFromBTF(member.Type) - if err != nil { - return nil, fmt.Errorf("can't get BTF map flags: %w", err) - } - - case "max_entries": - maxEntries, err = uintFromBTF(member.Type) - if err != nil { - return nil, fmt.Errorf("can't get BTF map max entries: %w", err) - } - - case "key": - if keySize != 0 { - return nil, errors.New("both key and key_size given") - } - - pk, ok := member.Type.(*btf.Pointer) - if !ok { - return nil, fmt.Errorf("key type is not a pointer: %T", member.Type) - } - - key = pk.Target - - size, err := btf.Sizeof(pk.Target) - if err != nil { - return nil, fmt.Errorf("can't get size of BTF key: %w", err) - } - - keySize = uint32(size) - - case "value": - if valueSize != 0 { - return nil, errors.New("both value and value_size given") - } - - vk, ok := member.Type.(*btf.Pointer) - if !ok { - return nil, fmt.Errorf("value type is not a pointer: %T", member.Type) - } - - value = vk.Target - - size, err := btf.Sizeof(vk.Target) - if err != nil { - return nil, fmt.Errorf("can't get size of BTF value: %w", err) - } - - valueSize = uint32(size) - - case "key_size": - // Key needs to be nil and keySize needs to be 0 for key_size to be - // considered a valid member. - if key != nil || keySize != 0 { - return nil, errors.New("both key and key_size given") - } - - keySize, err = uintFromBTF(member.Type) - if err != nil { - return nil, fmt.Errorf("can't get BTF key size: %w", err) - } - - case "value_size": - // Value needs to be nil and valueSize needs to be 0 for value_size to be - // considered a valid member. - if value != nil || valueSize != 0 { - return nil, errors.New("both value and value_size given") - } - - valueSize, err = uintFromBTF(member.Type) - if err != nil { - return nil, fmt.Errorf("can't get BTF value size: %w", err) - } - - case "pinning": - if inner { - return nil, errors.New("inner maps can't be pinned") - } - - pinning, err := uintFromBTF(member.Type) - if err != nil { - return nil, fmt.Errorf("can't get pinning: %w", err) - } - - pinType = PinType(pinning) - - case "values": - // The 'values' field in BTF map definitions is used for declaring map - // value types that are references to other BPF objects, like other maps - // or programs. It is always expected to be an array of pointers. - if i != len(def.Members)-1 { - return nil, errors.New("'values' must be the last member in a BTF map definition") - } - - if valueSize != 0 && valueSize != 4 { - return nil, errors.New("value_size must be 0 or 4") - } - valueSize = 4 - - valueType, err := resolveBTFArrayMacro(member.Type) - if err != nil { - return nil, fmt.Errorf("can't resolve type of member 'values': %w", err) - } - - switch t := valueType.(type) { - case *btf.Struct: - // The values member pointing to an array of structs means we're expecting - // a map-in-map declaration. - if mapType != ArrayOfMaps && mapType != HashOfMaps { - return nil, errors.New("outer map needs to be an array or a hash of maps") - } - if inner { - return nil, fmt.Errorf("nested inner maps are not supported") - } - - // This inner map spec is used as a map template, but it needs to be - // created as a traditional map before it can be used to do so. - // libbpf names the inner map template '.inner', but we - // opted for _inner to simplify validation logic. (dots only supported - // on kernels 5.2 and up) - // Pass the BTF spec from the parent object, since both parent and - // child must be created from the same BTF blob (on kernels that support BTF). - innerMapSpec, err = mapSpecFromBTF(es, vs, t, spec, name+"_inner", true) - if err != nil { - return nil, fmt.Errorf("can't parse BTF map definition of inner map: %w", err) - } - - case *btf.FuncProto: - // The values member contains an array of function pointers, meaning an - // autopopulated PROG_ARRAY. - if mapType != ProgramArray { - return nil, errors.New("map needs to be a program array") - } - - default: - return nil, fmt.Errorf("unsupported value type %q in 'values' field", t) - } - - contents, err = resolveBTFValuesContents(es, vs, member) - if err != nil { - return nil, fmt.Errorf("resolving values contents: %w", err) - } - - default: - return nil, fmt.Errorf("unrecognized field %s in BTF map definition", member.Name) - } - } - - return &MapSpec{ - Name: SanitizeName(name, -1), - Type: MapType(mapType), - KeySize: keySize, - ValueSize: valueSize, - MaxEntries: maxEntries, - Flags: flags, - Key: key, - Value: value, - Pinning: pinType, - InnerMap: innerMapSpec, - Contents: contents, - }, nil -} - -// uintFromBTF resolves the __uint macro, which is a pointer to a sized -// array, e.g. for int (*foo)[10], this function will return 10. -func uintFromBTF(typ btf.Type) (uint32, error) { - ptr, ok := typ.(*btf.Pointer) - if !ok { - return 0, fmt.Errorf("not a pointer: %v", typ) - } - - arr, ok := ptr.Target.(*btf.Array) - if !ok { - return 0, fmt.Errorf("not a pointer to array: %v", typ) - } - - return arr.Nelems, nil -} - -// resolveBTFArrayMacro resolves the __array macro, which declares an array -// of pointers to a given type. This function returns the target Type of -// the pointers in the array. -func resolveBTFArrayMacro(typ btf.Type) (btf.Type, error) { - arr, ok := typ.(*btf.Array) - if !ok { - return nil, fmt.Errorf("not an array: %v", typ) - } - - ptr, ok := arr.Type.(*btf.Pointer) - if !ok { - return nil, fmt.Errorf("not an array of pointers: %v", typ) - } - - return ptr.Target, nil -} - -// resolveBTFValuesContents resolves relocations into ELF sections belonging -// to btf.VarSecinfo's. This can be used on the 'values' member in BTF map -// definitions to extract static declarations of map contents. -func resolveBTFValuesContents(es *elfSection, vs *btf.VarSecinfo, member btf.Member) ([]MapKV, error) { - // The elements of a .values pointer array are not encoded in BTF. - // Instead, relocations are generated into each array index. - // However, it's possible to leave certain array indices empty, so all - // indices' offsets need to be checked for emitted relocations. - - // The offset of the 'values' member within the _struct_ (in bits) - // is the starting point of the array. Convert to bytes. Add VarSecinfo - // offset to get the absolute position in the ELF blob. - start := member.Offset.Bytes() + vs.Offset - // 'values' is encoded in BTF as a zero (variable) length struct - // member, and its contents run until the end of the VarSecinfo. - // Add VarSecinfo offset to get the absolute position in the ELF blob. - end := vs.Size + vs.Offset - // The size of an address in this section. This determines the width of - // an index in the array. - align := uint32(es.SectionHeader.Addralign) - - // Check if variable-length section is aligned. - if (end-start)%align != 0 { - return nil, errors.New("unaligned static values section") - } - elems := (end - start) / align - - if elems == 0 { - return nil, nil - } - - contents := make([]MapKV, 0, elems) - - // k is the array index, off is its corresponding ELF section offset. - for k, off := uint32(0), start; k < elems; k, off = k+1, off+align { - r, ok := es.relocations[uint64(off)] - if !ok { - continue - } - - // Relocation exists for the current offset in the ELF section. - // Emit a value stub based on the type of relocation to be replaced by - // a real fd later in the pipeline before populating the map. - // Map keys are encoded in MapKV entries, so empty array indices are - // skipped here. - switch t := elf.ST_TYPE(r.Info); t { - case elf.STT_FUNC: - contents = append(contents, MapKV{uint32(k), r.Name}) - case elf.STT_OBJECT: - contents = append(contents, MapKV{uint32(k), r.Name}) - default: - return nil, fmt.Errorf("unknown relocation type %v for symbol %s", t, r.Name) - } - } - - return contents, nil -} - -func (ec *elfCode) loadDataSections() error { - for _, sec := range ec.sections { - if sec.kind != dataSection { - continue - } - - if sec.references == 0 { - // Prune data sections which are not referenced by any - // instructions. - continue - } - - mapSpec := &MapSpec{ - Name: SanitizeName(sec.Name, -1), - Type: Array, - KeySize: 4, - ValueSize: uint32(sec.Size), - MaxEntries: 1, - } - - switch sec.Type { - // Only open the section if we know there's actual data to be read. - case elf.SHT_PROGBITS: - data, err := sec.Data() - if err != nil { - return fmt.Errorf("data section %s: can't get contents: %w", sec.Name, err) - } - - if uint64(len(data)) > math.MaxUint32 { - return fmt.Errorf("data section %s: contents exceed maximum size", sec.Name) - } - mapSpec.Contents = []MapKV{{uint32(0), data}} - - case elf.SHT_NOBITS: - // NOBITS sections like .bss contain only zeroes, and since data sections - // are Arrays, the kernel already preallocates them. Skip reading zeroes - // from the ELF. - default: - return fmt.Errorf("data section %s: unknown section type %s", sec.Name, sec.Type) - } - - // It is possible for a data section to exist without a corresponding BTF Datasec - // if it only contains anonymous values like macro-defined arrays. - if ec.btf != nil { - var ds *btf.Datasec - if ec.btf.TypeByName(sec.Name, &ds) == nil { - // Assign the spec's key and BTF only if the Datasec lookup was successful. - mapSpec.Key = &btf.Void{} - mapSpec.Value = ds - } - } - - if strings.HasPrefix(sec.Name, ".rodata") { - mapSpec.Flags = unix.BPF_F_RDONLY_PROG - mapSpec.Freeze = true - } - - ec.maps[sec.Name] = mapSpec - } - - return nil -} - -// loadKconfigSection handles the 'virtual' Datasec .kconfig that doesn't -// have a corresponding ELF section and exist purely in BTF. -func (ec *elfCode) loadKconfigSection() error { - if ec.btf == nil { - return nil - } - - var ds *btf.Datasec - err := ec.btf.TypeByName(".kconfig", &ds) - if errors.Is(err, btf.ErrNotFound) { - return nil - } - if err != nil { - return err - } - - if ds.Size == 0 { - return errors.New("zero-length .kconfig") - } - - ec.kconfig = &MapSpec{ - Name: ".kconfig", - Type: Array, - KeySize: uint32(4), - ValueSize: ds.Size, - MaxEntries: 1, - Flags: unix.BPF_F_RDONLY_PROG, - Freeze: true, - Key: &btf.Int{Size: 4}, - Value: ds, - } - - return nil -} - -// loadKsymsSection handles the 'virtual' Datasec .ksyms that doesn't -// have a corresponding ELF section and exist purely in BTF. -func (ec *elfCode) loadKsymsSection() error { - if ec.btf == nil { - return nil - } - - var ds *btf.Datasec - err := ec.btf.TypeByName(".ksyms", &ds) - if errors.Is(err, btf.ErrNotFound) { - return nil - } - if err != nil { - return err - } - - for _, v := range ds.Vars { - // we have already checked the .ksyms Datasec to only contain Func Vars. - ec.kfuncs[v.Type.TypeName()] = v.Type.(*btf.Func) - } - - return nil -} - -type libbpfElfSectionDef struct { - pattern string - programType sys.ProgType - attachType sys.AttachType - flags libbpfElfSectionFlag -} - -type libbpfElfSectionFlag uint32 - -// The values correspond to enum sec_def_flags in libbpf. -const ( - _SEC_NONE libbpfElfSectionFlag = 0 - - _SEC_EXP_ATTACH_OPT libbpfElfSectionFlag = 1 << (iota - 1) - _SEC_ATTACHABLE - _SEC_ATTACH_BTF - _SEC_SLEEPABLE - _SEC_XDP_FRAGS - _SEC_USDT - - // Ignore any present extra in order to preserve backwards compatibility - // with earlier versions of the library. - ignoreExtra - - _SEC_ATTACHABLE_OPT = _SEC_ATTACHABLE | _SEC_EXP_ATTACH_OPT -) - -func init() { - // Compatibility with older versions of the library. - // We prepend libbpf definitions since they contain a prefix match - // for "xdp". - elfSectionDefs = append([]libbpfElfSectionDef{ - {"xdp.frags/", sys.BPF_PROG_TYPE_XDP, sys.BPF_XDP, _SEC_XDP_FRAGS | ignoreExtra}, - {"xdp.frags_devmap/", sys.BPF_PROG_TYPE_XDP, sys.BPF_XDP_DEVMAP, _SEC_XDP_FRAGS}, - {"xdp_devmap/", sys.BPF_PROG_TYPE_XDP, sys.BPF_XDP_DEVMAP, 0}, - {"xdp.frags_cpumap/", sys.BPF_PROG_TYPE_XDP, sys.BPF_XDP_CPUMAP, _SEC_XDP_FRAGS}, - {"xdp_cpumap/", sys.BPF_PROG_TYPE_XDP, sys.BPF_XDP_CPUMAP, 0}, - // This has been in the library since the beginning of time. Not sure - // where it came from. - {"seccomp", sys.BPF_PROG_TYPE_SOCKET_FILTER, 0, _SEC_NONE}, - }, elfSectionDefs...) -} - -func getProgType(sectionName string) (ProgramType, AttachType, uint32, string) { - // Skip optional program marking for now. - sectionName = strings.TrimPrefix(sectionName, "?") - - for _, t := range elfSectionDefs { - extra, ok := matchSectionName(sectionName, t.pattern) - if !ok { - continue - } - - programType := ProgramType(t.programType) - attachType := AttachType(t.attachType) - - var flags uint32 - if t.flags&_SEC_SLEEPABLE > 0 { - flags |= unix.BPF_F_SLEEPABLE - } - if t.flags&_SEC_XDP_FRAGS > 0 { - flags |= unix.BPF_F_XDP_HAS_FRAGS - } - if t.flags&_SEC_EXP_ATTACH_OPT > 0 { - if programType == XDP { - // The library doesn't yet have code to fallback to not specifying - // attach type. Only do this for XDP since we've enforced correct - // attach type for all other program types. - attachType = AttachNone - } - } - if t.flags&ignoreExtra > 0 { - extra = "" - } - - return programType, attachType, flags, extra - } - - return UnspecifiedProgram, AttachNone, 0, "" -} - -// matchSectionName checks a section name against a pattern. -// -// It's behaviour mirrors that of libbpf's sec_def_matches. -func matchSectionName(sectionName, pattern string) (extra string, found bool) { - have, extra, found := strings.Cut(sectionName, "/") - want := strings.TrimRight(pattern, "+/") - - if strings.HasSuffix(pattern, "/") { - // Section name must have a slash and extra may be empty. - return extra, have == want && found - } else if strings.HasSuffix(pattern, "+") { - // Section name may have a slash and extra may be empty. - return extra, have == want - } - - // Section name must have a prefix. extra is ignored. - return "", strings.HasPrefix(sectionName, pattern) -} - -func (ec *elfCode) loadSectionRelocations(sec *elf.Section, symbols []elf.Symbol) (map[uint64]elf.Symbol, error) { - rels := make(map[uint64]elf.Symbol) - - if sec.Entsize < 16 { - return nil, fmt.Errorf("section %s: relocations are less than 16 bytes", sec.Name) - } - - r := bufio.NewReader(sec.Open()) - for off := uint64(0); off < sec.Size; off += sec.Entsize { - ent := io.LimitReader(r, int64(sec.Entsize)) - - var rel elf.Rel64 - if binary.Read(ent, ec.ByteOrder, &rel) != nil { - return nil, fmt.Errorf("can't parse relocation at offset %v", off) - } - - symNo := int(elf.R_SYM64(rel.Info) - 1) - if symNo >= len(symbols) { - return nil, fmt.Errorf("offset %d: symbol %d doesn't exist", off, symNo) - } - - symbol := symbols[symNo] - rels[rel.Off] = symbol - } - - return rels, nil -} diff --git a/vendor/github.com/cilium/ebpf/elf_sections.go b/vendor/github.com/cilium/ebpf/elf_sections.go deleted file mode 100644 index 4b58251d9..000000000 --- a/vendor/github.com/cilium/ebpf/elf_sections.go +++ /dev/null @@ -1,109 +0,0 @@ -// Code generated by internal/cmd/gensections.awk; DO NOT EDIT. - -package ebpf - -// Code in this file is derived from libbpf, available under BSD-2-Clause. - -import "github.com/cilium/ebpf/internal/sys" - -var elfSectionDefs = []libbpfElfSectionDef{ - {"socket", sys.BPF_PROG_TYPE_SOCKET_FILTER, 0, _SEC_NONE}, - {"sk_reuseport/migrate", sys.BPF_PROG_TYPE_SK_REUSEPORT, sys.BPF_SK_REUSEPORT_SELECT_OR_MIGRATE, _SEC_ATTACHABLE}, - {"sk_reuseport", sys.BPF_PROG_TYPE_SK_REUSEPORT, sys.BPF_SK_REUSEPORT_SELECT, _SEC_ATTACHABLE}, - {"kprobe+", sys.BPF_PROG_TYPE_KPROBE, 0, _SEC_NONE}, - {"uprobe+", sys.BPF_PROG_TYPE_KPROBE, 0, _SEC_NONE}, - {"uprobe.s+", sys.BPF_PROG_TYPE_KPROBE, 0, _SEC_SLEEPABLE}, - {"kretprobe+", sys.BPF_PROG_TYPE_KPROBE, 0, _SEC_NONE}, - {"uretprobe+", sys.BPF_PROG_TYPE_KPROBE, 0, _SEC_NONE}, - {"uretprobe.s+", sys.BPF_PROG_TYPE_KPROBE, 0, _SEC_SLEEPABLE}, - {"kprobe.multi+", sys.BPF_PROG_TYPE_KPROBE, sys.BPF_TRACE_KPROBE_MULTI, _SEC_NONE}, - {"kretprobe.multi+", sys.BPF_PROG_TYPE_KPROBE, sys.BPF_TRACE_KPROBE_MULTI, _SEC_NONE}, - {"uprobe.multi+", sys.BPF_PROG_TYPE_KPROBE, sys.BPF_TRACE_UPROBE_MULTI, _SEC_NONE}, - {"uretprobe.multi+", sys.BPF_PROG_TYPE_KPROBE, sys.BPF_TRACE_UPROBE_MULTI, _SEC_NONE}, - {"uprobe.multi.s+", sys.BPF_PROG_TYPE_KPROBE, sys.BPF_TRACE_UPROBE_MULTI, _SEC_SLEEPABLE}, - {"uretprobe.multi.s+", sys.BPF_PROG_TYPE_KPROBE, sys.BPF_TRACE_UPROBE_MULTI, _SEC_SLEEPABLE}, - {"ksyscall+", sys.BPF_PROG_TYPE_KPROBE, 0, _SEC_NONE}, - {"kretsyscall+", sys.BPF_PROG_TYPE_KPROBE, 0, _SEC_NONE}, - {"usdt+", sys.BPF_PROG_TYPE_KPROBE, 0, _SEC_USDT}, - {"usdt.s+", sys.BPF_PROG_TYPE_KPROBE, 0, _SEC_USDT | _SEC_SLEEPABLE}, - {"tc/ingress", sys.BPF_PROG_TYPE_SCHED_CLS, sys.BPF_TCX_INGRESS, _SEC_NONE}, - {"tc/egress", sys.BPF_PROG_TYPE_SCHED_CLS, sys.BPF_TCX_EGRESS, _SEC_NONE}, - {"tcx/ingress", sys.BPF_PROG_TYPE_SCHED_CLS, sys.BPF_TCX_INGRESS, _SEC_NONE}, - {"tcx/egress", sys.BPF_PROG_TYPE_SCHED_CLS, sys.BPF_TCX_EGRESS, _SEC_NONE}, - {"tc", sys.BPF_PROG_TYPE_SCHED_CLS, 0, _SEC_NONE}, - {"classifier", sys.BPF_PROG_TYPE_SCHED_CLS, 0, _SEC_NONE}, - {"action", sys.BPF_PROG_TYPE_SCHED_ACT, 0, _SEC_NONE}, - {"netkit/primary", sys.BPF_PROG_TYPE_SCHED_CLS, sys.BPF_NETKIT_PRIMARY, _SEC_NONE}, - {"netkit/peer", sys.BPF_PROG_TYPE_SCHED_CLS, sys.BPF_NETKIT_PEER, _SEC_NONE}, - {"tracepoint+", sys.BPF_PROG_TYPE_TRACEPOINT, 0, _SEC_NONE}, - {"tp+", sys.BPF_PROG_TYPE_TRACEPOINT, 0, _SEC_NONE}, - {"raw_tracepoint+", sys.BPF_PROG_TYPE_RAW_TRACEPOINT, 0, _SEC_NONE}, - {"raw_tp+", sys.BPF_PROG_TYPE_RAW_TRACEPOINT, 0, _SEC_NONE}, - {"raw_tracepoint.w+", sys.BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, 0, _SEC_NONE}, - {"raw_tp.w+", sys.BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, 0, _SEC_NONE}, - {"tp_btf+", sys.BPF_PROG_TYPE_TRACING, sys.BPF_TRACE_RAW_TP, _SEC_ATTACH_BTF}, - {"fentry+", sys.BPF_PROG_TYPE_TRACING, sys.BPF_TRACE_FENTRY, _SEC_ATTACH_BTF}, - {"fmod_ret+", sys.BPF_PROG_TYPE_TRACING, sys.BPF_MODIFY_RETURN, _SEC_ATTACH_BTF}, - {"fexit+", sys.BPF_PROG_TYPE_TRACING, sys.BPF_TRACE_FEXIT, _SEC_ATTACH_BTF}, - {"fentry.s+", sys.BPF_PROG_TYPE_TRACING, sys.BPF_TRACE_FENTRY, _SEC_ATTACH_BTF | _SEC_SLEEPABLE}, - {"fmod_ret.s+", sys.BPF_PROG_TYPE_TRACING, sys.BPF_MODIFY_RETURN, _SEC_ATTACH_BTF | _SEC_SLEEPABLE}, - {"fexit.s+", sys.BPF_PROG_TYPE_TRACING, sys.BPF_TRACE_FEXIT, _SEC_ATTACH_BTF | _SEC_SLEEPABLE}, - {"freplace+", sys.BPF_PROG_TYPE_EXT, 0, _SEC_ATTACH_BTF}, - {"lsm+", sys.BPF_PROG_TYPE_LSM, sys.BPF_LSM_MAC, _SEC_ATTACH_BTF}, - {"lsm.s+", sys.BPF_PROG_TYPE_LSM, sys.BPF_LSM_MAC, _SEC_ATTACH_BTF | _SEC_SLEEPABLE}, - {"lsm_cgroup+", sys.BPF_PROG_TYPE_LSM, sys.BPF_LSM_CGROUP, _SEC_ATTACH_BTF}, - {"iter+", sys.BPF_PROG_TYPE_TRACING, sys.BPF_TRACE_ITER, _SEC_ATTACH_BTF}, - {"iter.s+", sys.BPF_PROG_TYPE_TRACING, sys.BPF_TRACE_ITER, _SEC_ATTACH_BTF | _SEC_SLEEPABLE}, - {"syscall", sys.BPF_PROG_TYPE_SYSCALL, 0, _SEC_SLEEPABLE}, - {"xdp.frags/devmap", sys.BPF_PROG_TYPE_XDP, sys.BPF_XDP_DEVMAP, _SEC_XDP_FRAGS}, - {"xdp/devmap", sys.BPF_PROG_TYPE_XDP, sys.BPF_XDP_DEVMAP, _SEC_ATTACHABLE}, - {"xdp.frags/cpumap", sys.BPF_PROG_TYPE_XDP, sys.BPF_XDP_CPUMAP, _SEC_XDP_FRAGS}, - {"xdp/cpumap", sys.BPF_PROG_TYPE_XDP, sys.BPF_XDP_CPUMAP, _SEC_ATTACHABLE}, - {"xdp.frags", sys.BPF_PROG_TYPE_XDP, sys.BPF_XDP, _SEC_XDP_FRAGS}, - {"xdp", sys.BPF_PROG_TYPE_XDP, sys.BPF_XDP, _SEC_ATTACHABLE_OPT}, - {"perf_event", sys.BPF_PROG_TYPE_PERF_EVENT, 0, _SEC_NONE}, - {"lwt_in", sys.BPF_PROG_TYPE_LWT_IN, 0, _SEC_NONE}, - {"lwt_out", sys.BPF_PROG_TYPE_LWT_OUT, 0, _SEC_NONE}, - {"lwt_xmit", sys.BPF_PROG_TYPE_LWT_XMIT, 0, _SEC_NONE}, - {"lwt_seg6local", sys.BPF_PROG_TYPE_LWT_SEG6LOCAL, 0, _SEC_NONE}, - {"sockops", sys.BPF_PROG_TYPE_SOCK_OPS, sys.BPF_CGROUP_SOCK_OPS, _SEC_ATTACHABLE_OPT}, - {"sk_skb/stream_parser", sys.BPF_PROG_TYPE_SK_SKB, sys.BPF_SK_SKB_STREAM_PARSER, _SEC_ATTACHABLE_OPT}, - {"sk_skb/stream_verdict", sys.BPF_PROG_TYPE_SK_SKB, sys.BPF_SK_SKB_STREAM_VERDICT, _SEC_ATTACHABLE_OPT}, - {"sk_skb", sys.BPF_PROG_TYPE_SK_SKB, 0, _SEC_NONE}, - {"sk_msg", sys.BPF_PROG_TYPE_SK_MSG, sys.BPF_SK_MSG_VERDICT, _SEC_ATTACHABLE_OPT}, - {"lirc_mode2", sys.BPF_PROG_TYPE_LIRC_MODE2, sys.BPF_LIRC_MODE2, _SEC_ATTACHABLE_OPT}, - {"flow_dissector", sys.BPF_PROG_TYPE_FLOW_DISSECTOR, sys.BPF_FLOW_DISSECTOR, _SEC_ATTACHABLE_OPT}, - {"cgroup_skb/ingress", sys.BPF_PROG_TYPE_CGROUP_SKB, sys.BPF_CGROUP_INET_INGRESS, _SEC_ATTACHABLE_OPT}, - {"cgroup_skb/egress", sys.BPF_PROG_TYPE_CGROUP_SKB, sys.BPF_CGROUP_INET_EGRESS, _SEC_ATTACHABLE_OPT}, - {"cgroup/skb", sys.BPF_PROG_TYPE_CGROUP_SKB, 0, _SEC_NONE}, - {"cgroup/sock_create", sys.BPF_PROG_TYPE_CGROUP_SOCK, sys.BPF_CGROUP_INET_SOCK_CREATE, _SEC_ATTACHABLE}, - {"cgroup/sock_release", sys.BPF_PROG_TYPE_CGROUP_SOCK, sys.BPF_CGROUP_INET_SOCK_RELEASE, _SEC_ATTACHABLE}, - {"cgroup/sock", sys.BPF_PROG_TYPE_CGROUP_SOCK, sys.BPF_CGROUP_INET_SOCK_CREATE, _SEC_ATTACHABLE_OPT}, - {"cgroup/post_bind4", sys.BPF_PROG_TYPE_CGROUP_SOCK, sys.BPF_CGROUP_INET4_POST_BIND, _SEC_ATTACHABLE}, - {"cgroup/post_bind6", sys.BPF_PROG_TYPE_CGROUP_SOCK, sys.BPF_CGROUP_INET6_POST_BIND, _SEC_ATTACHABLE}, - {"cgroup/bind4", sys.BPF_PROG_TYPE_CGROUP_SOCK_ADDR, sys.BPF_CGROUP_INET4_BIND, _SEC_ATTACHABLE}, - {"cgroup/bind6", sys.BPF_PROG_TYPE_CGROUP_SOCK_ADDR, sys.BPF_CGROUP_INET6_BIND, _SEC_ATTACHABLE}, - {"cgroup/connect4", sys.BPF_PROG_TYPE_CGROUP_SOCK_ADDR, sys.BPF_CGROUP_INET4_CONNECT, _SEC_ATTACHABLE}, - {"cgroup/connect6", sys.BPF_PROG_TYPE_CGROUP_SOCK_ADDR, sys.BPF_CGROUP_INET6_CONNECT, _SEC_ATTACHABLE}, - {"cgroup/connect_unix", sys.BPF_PROG_TYPE_CGROUP_SOCK_ADDR, sys.BPF_CGROUP_UNIX_CONNECT, _SEC_ATTACHABLE}, - {"cgroup/sendmsg4", sys.BPF_PROG_TYPE_CGROUP_SOCK_ADDR, sys.BPF_CGROUP_UDP4_SENDMSG, _SEC_ATTACHABLE}, - {"cgroup/sendmsg6", sys.BPF_PROG_TYPE_CGROUP_SOCK_ADDR, sys.BPF_CGROUP_UDP6_SENDMSG, _SEC_ATTACHABLE}, - {"cgroup/sendmsg_unix", sys.BPF_PROG_TYPE_CGROUP_SOCK_ADDR, sys.BPF_CGROUP_UNIX_SENDMSG, _SEC_ATTACHABLE}, - {"cgroup/recvmsg4", sys.BPF_PROG_TYPE_CGROUP_SOCK_ADDR, sys.BPF_CGROUP_UDP4_RECVMSG, _SEC_ATTACHABLE}, - {"cgroup/recvmsg6", sys.BPF_PROG_TYPE_CGROUP_SOCK_ADDR, sys.BPF_CGROUP_UDP6_RECVMSG, _SEC_ATTACHABLE}, - {"cgroup/recvmsg_unix", sys.BPF_PROG_TYPE_CGROUP_SOCK_ADDR, sys.BPF_CGROUP_UNIX_RECVMSG, _SEC_ATTACHABLE}, - {"cgroup/getpeername4", sys.BPF_PROG_TYPE_CGROUP_SOCK_ADDR, sys.BPF_CGROUP_INET4_GETPEERNAME, _SEC_ATTACHABLE}, - {"cgroup/getpeername6", sys.BPF_PROG_TYPE_CGROUP_SOCK_ADDR, sys.BPF_CGROUP_INET6_GETPEERNAME, _SEC_ATTACHABLE}, - {"cgroup/getpeername_unix", sys.BPF_PROG_TYPE_CGROUP_SOCK_ADDR, sys.BPF_CGROUP_UNIX_GETPEERNAME, _SEC_ATTACHABLE}, - {"cgroup/getsockname4", sys.BPF_PROG_TYPE_CGROUP_SOCK_ADDR, sys.BPF_CGROUP_INET4_GETSOCKNAME, _SEC_ATTACHABLE}, - {"cgroup/getsockname6", sys.BPF_PROG_TYPE_CGROUP_SOCK_ADDR, sys.BPF_CGROUP_INET6_GETSOCKNAME, _SEC_ATTACHABLE}, - {"cgroup/getsockname_unix", sys.BPF_PROG_TYPE_CGROUP_SOCK_ADDR, sys.BPF_CGROUP_UNIX_GETSOCKNAME, _SEC_ATTACHABLE}, - {"cgroup/sysctl", sys.BPF_PROG_TYPE_CGROUP_SYSCTL, sys.BPF_CGROUP_SYSCTL, _SEC_ATTACHABLE}, - {"cgroup/getsockopt", sys.BPF_PROG_TYPE_CGROUP_SOCKOPT, sys.BPF_CGROUP_GETSOCKOPT, _SEC_ATTACHABLE}, - {"cgroup/setsockopt", sys.BPF_PROG_TYPE_CGROUP_SOCKOPT, sys.BPF_CGROUP_SETSOCKOPT, _SEC_ATTACHABLE}, - {"cgroup/dev", sys.BPF_PROG_TYPE_CGROUP_DEVICE, sys.BPF_CGROUP_DEVICE, _SEC_ATTACHABLE_OPT}, - {"struct_ops+", sys.BPF_PROG_TYPE_STRUCT_OPS, 0, _SEC_NONE}, - {"struct_ops.s+", sys.BPF_PROG_TYPE_STRUCT_OPS, 0, _SEC_SLEEPABLE}, - {"sk_lookup", sys.BPF_PROG_TYPE_SK_LOOKUP, sys.BPF_SK_LOOKUP, _SEC_ATTACHABLE}, - {"netfilter", sys.BPF_PROG_TYPE_NETFILTER, sys.BPF_NETFILTER, _SEC_NONE}, -} diff --git a/vendor/github.com/cilium/ebpf/features/doc.go b/vendor/github.com/cilium/ebpf/features/doc.go deleted file mode 100644 index acc57e3b1..000000000 --- a/vendor/github.com/cilium/ebpf/features/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -// Package features allows probing for BPF features available to the calling process. -// -// In general, the error return values from feature probes in this package -// all have the following semantics unless otherwise specified: -// -// err == nil: The feature is available. -// errors.Is(err, ebpf.ErrNotSupported): The feature is not available. -// err != nil: Any errors encountered during probe execution, wrapped. -// -// Note that the latter case may include false negatives, and that resource -// creation may succeed despite an error being returned. For example, some -// map and program types cannot reliably be probed and will return an -// inconclusive error. -// -// As a rule, only `nil` and `ebpf.ErrNotSupported` are conclusive. -// -// Probe results are cached by the library and persist throughout any changes -// to the process' environment, like capability changes. -package features diff --git a/vendor/github.com/cilium/ebpf/features/map.go b/vendor/github.com/cilium/ebpf/features/map.go deleted file mode 100644 index 8923e736a..000000000 --- a/vendor/github.com/cilium/ebpf/features/map.go +++ /dev/null @@ -1,321 +0,0 @@ -package features - -import ( - "errors" - "fmt" - "os" - "unsafe" - - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/internal" - "github.com/cilium/ebpf/internal/sys" - "github.com/cilium/ebpf/internal/unix" -) - -// HaveMapType probes the running kernel for the availability of the specified map type. -// -// See the package documentation for the meaning of the error return value. -func HaveMapType(mt ebpf.MapType) error { - return haveMapTypeMatrix.Result(mt) -} - -func probeCgroupStorageMap(mt sys.MapType) error { - // keySize needs to be sizeof(struct{u32 + u64}) = 12 (+ padding = 16) - // by using unsafe.Sizeof(int) we are making sure that this works on 32bit and 64bit archs - return createMap(&sys.MapCreateAttr{ - MapType: mt, - ValueSize: 4, - KeySize: uint32(8 + unsafe.Sizeof(int(0))), - MaxEntries: 0, - }) -} - -func probeStorageMap(mt sys.MapType) error { - // maxEntries needs to be 0 - // BPF_F_NO_PREALLOC needs to be set - // btf* fields need to be set - // see alloc_check for local_storage map types - err := createMap(&sys.MapCreateAttr{ - MapType: mt, - KeySize: 4, - ValueSize: 4, - MaxEntries: 0, - MapFlags: unix.BPF_F_NO_PREALLOC, - BtfKeyTypeId: 1, - BtfValueTypeId: 1, - BtfFd: ^uint32(0), - }) - if errors.Is(err, unix.EBADF) { - // Triggered by BtfFd. - return nil - } - return err -} - -func probeNestedMap(mt sys.MapType) error { - // assign invalid innerMapFd to pass validation check - // will return EBADF - err := probeMap(&sys.MapCreateAttr{ - MapType: mt, - InnerMapFd: ^uint32(0), - }) - if errors.Is(err, unix.EBADF) { - return nil - } - return err -} - -func probeMap(attr *sys.MapCreateAttr) error { - if attr.KeySize == 0 { - attr.KeySize = 4 - } - if attr.ValueSize == 0 { - attr.ValueSize = 4 - } - attr.MaxEntries = 1 - return createMap(attr) -} - -func createMap(attr *sys.MapCreateAttr) error { - fd, err := sys.MapCreate(attr) - if err == nil { - fd.Close() - return nil - } - - switch { - // EINVAL occurs when attempting to create a map with an unknown type. - // E2BIG occurs when MapCreateAttr contains non-zero bytes past the end - // of the struct known by the running kernel, meaning the kernel is too old - // to support the given map type. - case errors.Is(err, unix.EINVAL), errors.Is(err, unix.E2BIG): - return ebpf.ErrNotSupported - } - - return err -} - -var haveMapTypeMatrix = internal.FeatureMatrix[ebpf.MapType]{ - ebpf.Hash: {Version: "3.19"}, - ebpf.Array: {Version: "3.19"}, - ebpf.ProgramArray: {Version: "4.2"}, - ebpf.PerfEventArray: {Version: "4.3"}, - ebpf.PerCPUHash: {Version: "4.6"}, - ebpf.PerCPUArray: {Version: "4.6"}, - ebpf.StackTrace: { - Version: "4.6", - Fn: func() error { - return probeMap(&sys.MapCreateAttr{ - MapType: sys.BPF_MAP_TYPE_STACK_TRACE, - ValueSize: 8, // sizeof(uint64) - }) - }, - }, - ebpf.CGroupArray: {Version: "4.8"}, - ebpf.LRUHash: {Version: "4.10"}, - ebpf.LRUCPUHash: {Version: "4.10"}, - ebpf.LPMTrie: { - Version: "4.11", - Fn: func() error { - // keySize and valueSize need to be sizeof(struct{u32 + u8}) + 1 + padding = 8 - // BPF_F_NO_PREALLOC needs to be set - return probeMap(&sys.MapCreateAttr{ - MapType: sys.BPF_MAP_TYPE_LPM_TRIE, - KeySize: 8, - ValueSize: 8, - MapFlags: unix.BPF_F_NO_PREALLOC, - }) - }, - }, - ebpf.ArrayOfMaps: { - Version: "4.12", - Fn: func() error { return probeNestedMap(sys.BPF_MAP_TYPE_ARRAY_OF_MAPS) }, - }, - ebpf.HashOfMaps: { - Version: "4.12", - Fn: func() error { return probeNestedMap(sys.BPF_MAP_TYPE_HASH_OF_MAPS) }, - }, - ebpf.DevMap: {Version: "4.14"}, - ebpf.SockMap: {Version: "4.14"}, - ebpf.CPUMap: {Version: "4.15"}, - ebpf.XSKMap: {Version: "4.18"}, - ebpf.SockHash: {Version: "4.18"}, - ebpf.CGroupStorage: { - Version: "4.19", - Fn: func() error { return probeCgroupStorageMap(sys.BPF_MAP_TYPE_CGROUP_STORAGE) }, - }, - ebpf.ReusePortSockArray: {Version: "4.19"}, - ebpf.PerCPUCGroupStorage: { - Version: "4.20", - Fn: func() error { return probeCgroupStorageMap(sys.BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE) }, - }, - ebpf.Queue: { - Version: "4.20", - Fn: func() error { - return createMap(&sys.MapCreateAttr{ - MapType: sys.BPF_MAP_TYPE_QUEUE, - KeySize: 0, - ValueSize: 4, - MaxEntries: 1, - }) - }, - }, - ebpf.Stack: { - Version: "4.20", - Fn: func() error { - return createMap(&sys.MapCreateAttr{ - MapType: sys.BPF_MAP_TYPE_STACK, - KeySize: 0, - ValueSize: 4, - MaxEntries: 1, - }) - }, - }, - ebpf.SkStorage: { - Version: "5.2", - Fn: func() error { return probeStorageMap(sys.BPF_MAP_TYPE_SK_STORAGE) }, - }, - ebpf.DevMapHash: {Version: "5.4"}, - ebpf.StructOpsMap: { - Version: "5.6", - Fn: func() error { - // StructOps requires setting a vmlinux type id, but id 1 will always - // resolve to some type of integer. This will cause ENOTSUPP. - err := probeMap(&sys.MapCreateAttr{ - MapType: sys.BPF_MAP_TYPE_STRUCT_OPS, - BtfVmlinuxValueTypeId: 1, - }) - if errors.Is(err, sys.ENOTSUPP) { - // ENOTSUPP means the map type is at least known to the kernel. - return nil - } - return err - }, - }, - ebpf.RingBuf: { - Version: "5.8", - Fn: func() error { - // keySize and valueSize need to be 0 - // maxEntries needs to be power of 2 and PAGE_ALIGNED - return createMap(&sys.MapCreateAttr{ - MapType: sys.BPF_MAP_TYPE_RINGBUF, - KeySize: 0, - ValueSize: 0, - MaxEntries: uint32(os.Getpagesize()), - }) - }, - }, - ebpf.InodeStorage: { - Version: "5.10", - Fn: func() error { return probeStorageMap(sys.BPF_MAP_TYPE_INODE_STORAGE) }, - }, - ebpf.TaskStorage: { - Version: "5.11", - Fn: func() error { return probeStorageMap(sys.BPF_MAP_TYPE_TASK_STORAGE) }, - }, -} - -func init() { - for mt, ft := range haveMapTypeMatrix { - ft.Name = mt.String() - if ft.Fn == nil { - // Avoid referring to the loop variable in the closure. - mt := sys.MapType(mt) - ft.Fn = func() error { return probeMap(&sys.MapCreateAttr{MapType: mt}) } - } - } -} - -// MapFlags document which flags may be feature probed. -type MapFlags = sys.MapFlags - -// Flags which may be feature probed. -const ( - BPF_F_NO_PREALLOC = sys.BPF_F_NO_PREALLOC - BPF_F_RDONLY_PROG = sys.BPF_F_RDONLY_PROG - BPF_F_WRONLY_PROG = sys.BPF_F_WRONLY_PROG - BPF_F_MMAPABLE = sys.BPF_F_MMAPABLE - BPF_F_INNER_MAP = sys.BPF_F_INNER_MAP -) - -// HaveMapFlag probes the running kernel for the availability of the specified map flag. -// -// Returns an error if flag is not one of the flags declared in this package. -// See the package documentation for the meaning of the error return value. -func HaveMapFlag(flag MapFlags) (err error) { - return haveMapFlagsMatrix.Result(flag) -} - -func probeMapFlag(attr *sys.MapCreateAttr) error { - // For now, we do not check if the map type is supported because we only support - // probing for flags defined on arrays and hashes that are always supported. - // In the future, if we allow probing on flags defined on newer types, checking for map type - // support will be required. - if attr.MapType == sys.BPF_MAP_TYPE_UNSPEC { - attr.MapType = sys.BPF_MAP_TYPE_ARRAY - } - - attr.KeySize = 4 - attr.ValueSize = 4 - attr.MaxEntries = 1 - - fd, err := sys.MapCreate(attr) - if err == nil { - fd.Close() - } else if errors.Is(err, unix.EINVAL) { - // EINVAL occurs when attempting to create a map with an unknown type or an unknown flag. - err = ebpf.ErrNotSupported - } - - return err -} - -var haveMapFlagsMatrix = internal.FeatureMatrix[MapFlags]{ - BPF_F_NO_PREALLOC: { - Version: "4.6", - Fn: func() error { - return probeMapFlag(&sys.MapCreateAttr{ - MapType: sys.BPF_MAP_TYPE_HASH, - MapFlags: BPF_F_NO_PREALLOC, - }) - }, - }, - BPF_F_RDONLY_PROG: { - Version: "5.2", - Fn: func() error { - return probeMapFlag(&sys.MapCreateAttr{ - MapFlags: BPF_F_RDONLY_PROG, - }) - }, - }, - BPF_F_WRONLY_PROG: { - Version: "5.2", - Fn: func() error { - return probeMapFlag(&sys.MapCreateAttr{ - MapFlags: BPF_F_WRONLY_PROG, - }) - }, - }, - BPF_F_MMAPABLE: { - Version: "5.5", - Fn: func() error { - return probeMapFlag(&sys.MapCreateAttr{ - MapFlags: BPF_F_MMAPABLE, - }) - }, - }, - BPF_F_INNER_MAP: { - Version: "5.10", - Fn: func() error { - return probeMapFlag(&sys.MapCreateAttr{ - MapFlags: BPF_F_INNER_MAP, - }) - }, - }, -} - -func init() { - for mf, ft := range haveMapFlagsMatrix { - ft.Name = fmt.Sprint(mf) - } -} diff --git a/vendor/github.com/cilium/ebpf/features/misc.go b/vendor/github.com/cilium/ebpf/features/misc.go deleted file mode 100644 index 6bd8df933..000000000 --- a/vendor/github.com/cilium/ebpf/features/misc.go +++ /dev/null @@ -1,95 +0,0 @@ -package features - -import ( - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/asm" - "github.com/cilium/ebpf/internal" -) - -// HaveLargeInstructions probes the running kernel if more than 4096 instructions -// per program are supported. -// -// Upstream commit c04c0d2b968a ("bpf: increase complexity limit and maximum program size"). -// -// See the package documentation for the meaning of the error return value. -func HaveLargeInstructions() error { - return haveLargeInstructions() -} - -var haveLargeInstructions = internal.NewFeatureTest(">4096 instructions", "5.2", func() error { - const maxInsns = 4096 - - insns := make(asm.Instructions, maxInsns, maxInsns+1) - for i := range insns { - insns[i] = asm.Mov.Imm(asm.R0, 1) - } - insns = append(insns, asm.Return()) - - return probeProgram(&ebpf.ProgramSpec{ - Type: ebpf.SocketFilter, - Instructions: insns, - }) -}) - -// HaveBoundedLoops probes the running kernel if bounded loops are supported. -// -// Upstream commit 2589726d12a1 ("bpf: introduce bounded loops"). -// -// See the package documentation for the meaning of the error return value. -func HaveBoundedLoops() error { - return haveBoundedLoops() -} - -var haveBoundedLoops = internal.NewFeatureTest("bounded loops", "5.3", func() error { - return probeProgram(&ebpf.ProgramSpec{ - Type: ebpf.SocketFilter, - Instructions: asm.Instructions{ - asm.Mov.Imm(asm.R0, 10), - asm.Sub.Imm(asm.R0, 1).WithSymbol("loop"), - asm.JNE.Imm(asm.R0, 0, "loop"), - asm.Return(), - }, - }) -}) - -// HaveV2ISA probes the running kernel if instructions of the v2 ISA are supported. -// -// Upstream commit 92b31a9af73b ("bpf: add BPF_J{LT,LE,SLT,SLE} instructions"). -// -// See the package documentation for the meaning of the error return value. -func HaveV2ISA() error { - return haveV2ISA() -} - -var haveV2ISA = internal.NewFeatureTest("v2 ISA", "4.14", func() error { - return probeProgram(&ebpf.ProgramSpec{ - Type: ebpf.SocketFilter, - Instructions: asm.Instructions{ - asm.Mov.Imm(asm.R0, 0), - asm.JLT.Imm(asm.R0, 0, "exit"), - asm.Mov.Imm(asm.R0, 1), - asm.Return().WithSymbol("exit"), - }, - }) -}) - -// HaveV3ISA probes the running kernel if instructions of the v3 ISA are supported. -// -// Upstream commit 092ed0968bb6 ("bpf: verifier support JMP32"). -// -// See the package documentation for the meaning of the error return value. -func HaveV3ISA() error { - return haveV3ISA() -} - -var haveV3ISA = internal.NewFeatureTest("v3 ISA", "5.1", func() error { - return probeProgram(&ebpf.ProgramSpec{ - Type: ebpf.SocketFilter, - Instructions: asm.Instructions{ - asm.Mov.Imm(asm.R0, 0), - asm.JLT.Imm32(asm.R0, 0, "exit"), - asm.Mov.Imm(asm.R0, 1), - asm.Return().WithSymbol("exit"), - }, - }) -}) diff --git a/vendor/github.com/cilium/ebpf/features/prog.go b/vendor/github.com/cilium/ebpf/features/prog.go deleted file mode 100644 index a11363796..000000000 --- a/vendor/github.com/cilium/ebpf/features/prog.go +++ /dev/null @@ -1,297 +0,0 @@ -package features - -import ( - "errors" - "fmt" - "os" - - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/asm" - "github.com/cilium/ebpf/btf" - "github.com/cilium/ebpf/internal" - "github.com/cilium/ebpf/internal/sys" - "github.com/cilium/ebpf/internal/unix" -) - -// HaveProgType probes the running kernel for the availability of the specified program type. -// -// Deprecated: use HaveProgramType() instead. -var HaveProgType = HaveProgramType - -// HaveProgramType probes the running kernel for the availability of the specified program type. -// -// See the package documentation for the meaning of the error return value. -func HaveProgramType(pt ebpf.ProgramType) (err error) { - return haveProgramTypeMatrix.Result(pt) -} - -func probeProgram(spec *ebpf.ProgramSpec) error { - if spec.Instructions == nil { - spec.Instructions = asm.Instructions{ - asm.LoadImm(asm.R0, 0, asm.DWord), - asm.Return(), - } - } - prog, err := ebpf.NewProgramWithOptions(spec, ebpf.ProgramOptions{ - LogDisabled: true, - }) - if err == nil { - prog.Close() - } - - switch { - // EINVAL occurs when attempting to create a program with an unknown type. - // E2BIG occurs when ProgLoadAttr contains non-zero bytes past the end - // of the struct known by the running kernel, meaning the kernel is too old - // to support the given prog type. - case errors.Is(err, unix.EINVAL), errors.Is(err, unix.E2BIG): - err = ebpf.ErrNotSupported - } - - return err -} - -var haveProgramTypeMatrix = internal.FeatureMatrix[ebpf.ProgramType]{ - ebpf.SocketFilter: {Version: "3.19"}, - ebpf.Kprobe: {Version: "4.1"}, - ebpf.SchedCLS: {Version: "4.1"}, - ebpf.SchedACT: {Version: "4.1"}, - ebpf.TracePoint: {Version: "4.7"}, - ebpf.XDP: {Version: "4.8"}, - ebpf.PerfEvent: {Version: "4.9"}, - ebpf.CGroupSKB: {Version: "4.10"}, - ebpf.CGroupSock: {Version: "4.10"}, - ebpf.LWTIn: {Version: "4.10"}, - ebpf.LWTOut: {Version: "4.10"}, - ebpf.LWTXmit: {Version: "4.10"}, - ebpf.SockOps: {Version: "4.13"}, - ebpf.SkSKB: {Version: "4.14"}, - ebpf.CGroupDevice: {Version: "4.15"}, - ebpf.SkMsg: {Version: "4.17"}, - ebpf.RawTracepoint: {Version: "4.17"}, - ebpf.CGroupSockAddr: { - Version: "4.17", - Fn: func() error { - return probeProgram(&ebpf.ProgramSpec{ - Type: ebpf.CGroupSockAddr, - AttachType: ebpf.AttachCGroupInet4Connect, - }) - }, - }, - ebpf.LWTSeg6Local: {Version: "4.18"}, - ebpf.LircMode2: {Version: "4.18"}, - ebpf.SkReuseport: {Version: "4.19"}, - ebpf.FlowDissector: {Version: "4.20"}, - ebpf.CGroupSysctl: {Version: "5.2"}, - ebpf.RawTracepointWritable: {Version: "5.2"}, - ebpf.CGroupSockopt: { - Version: "5.3", - Fn: func() error { - return probeProgram(&ebpf.ProgramSpec{ - Type: ebpf.CGroupSockopt, - AttachType: ebpf.AttachCGroupGetsockopt, - }) - }, - }, - ebpf.Tracing: { - Version: "5.5", - Fn: func() error { - return probeProgram(&ebpf.ProgramSpec{ - Type: ebpf.Tracing, - AttachType: ebpf.AttachTraceFEntry, - AttachTo: "bpf_init", - }) - }, - }, - ebpf.StructOps: { - Version: "5.6", - Fn: func() error { - err := probeProgram(&ebpf.ProgramSpec{ - Type: ebpf.StructOps, - License: "GPL", - }) - if errors.Is(err, sys.ENOTSUPP) { - // ENOTSUPP means the program type is at least known to the kernel. - return nil - } - return err - }, - }, - ebpf.Extension: { - Version: "5.6", - Fn: func() error { - // create btf.Func to add to first ins of target and extension so both progs are btf powered - btfFn := btf.Func{ - Name: "a", - Type: &btf.FuncProto{ - Return: &btf.Int{}, - }, - Linkage: btf.GlobalFunc, - } - insns := asm.Instructions{ - btf.WithFuncMetadata(asm.Mov.Imm(asm.R0, 0), &btfFn), - asm.Return(), - } - - // create target prog - prog, err := ebpf.NewProgramWithOptions( - &ebpf.ProgramSpec{ - Type: ebpf.XDP, - Instructions: insns, - }, - ebpf.ProgramOptions{ - LogDisabled: true, - }, - ) - if err != nil { - return err - } - defer prog.Close() - - // probe for Extension prog with target - return probeProgram(&ebpf.ProgramSpec{ - Type: ebpf.Extension, - Instructions: insns, - AttachTarget: prog, - AttachTo: btfFn.Name, - }) - }, - }, - ebpf.LSM: { - Version: "5.7", - Fn: func() error { - return probeProgram(&ebpf.ProgramSpec{ - Type: ebpf.LSM, - AttachType: ebpf.AttachLSMMac, - AttachTo: "file_mprotect", - License: "GPL", - }) - }, - }, - ebpf.SkLookup: { - Version: "5.9", - Fn: func() error { - return probeProgram(&ebpf.ProgramSpec{ - Type: ebpf.SkLookup, - AttachType: ebpf.AttachSkLookup, - }) - }, - }, - ebpf.Syscall: { - Version: "5.14", - Fn: func() error { - return probeProgram(&ebpf.ProgramSpec{ - Type: ebpf.Syscall, - Flags: unix.BPF_F_SLEEPABLE, - }) - }, - }, -} - -func init() { - for key, ft := range haveProgramTypeMatrix { - ft.Name = key.String() - if ft.Fn == nil { - key := key // avoid the dreaded loop variable problem - ft.Fn = func() error { return probeProgram(&ebpf.ProgramSpec{Type: key}) } - } - } -} - -type helperKey struct { - typ ebpf.ProgramType - helper asm.BuiltinFunc -} - -var helperCache = internal.NewFeatureCache(func(key helperKey) *internal.FeatureTest { - return &internal.FeatureTest{ - Name: fmt.Sprintf("%s for program type %s", key.helper, key.typ), - Fn: func() error { - return haveProgramHelper(key.typ, key.helper) - }, - } -}) - -// HaveProgramHelper probes the running kernel for the availability of the specified helper -// function to a specified program type. -// Return values have the following semantics: -// -// err == nil: The feature is available. -// errors.Is(err, ebpf.ErrNotSupported): The feature is not available. -// err != nil: Any errors encountered during probe execution, wrapped. -// -// Note that the latter case may include false negatives, and that program creation may -// succeed despite an error being returned. -// Only `nil` and `ebpf.ErrNotSupported` are conclusive. -// -// Probe results are cached and persist throughout any process capability changes. -func HaveProgramHelper(pt ebpf.ProgramType, helper asm.BuiltinFunc) error { - if helper > helper.Max() { - return os.ErrInvalid - } - - return helperCache.Result(helperKey{pt, helper}) -} - -func haveProgramHelper(pt ebpf.ProgramType, helper asm.BuiltinFunc) error { - if ok := helperProbeNotImplemented(pt); ok { - return fmt.Errorf("no feature probe for %v/%v", pt, helper) - } - - if err := HaveProgramType(pt); err != nil { - return err - } - - spec := &ebpf.ProgramSpec{ - Type: pt, - Instructions: asm.Instructions{ - helper.Call(), - asm.LoadImm(asm.R0, 0, asm.DWord), - asm.Return(), - }, - License: "GPL", - } - - switch pt { - case ebpf.CGroupSockAddr: - spec.AttachType = ebpf.AttachCGroupInet4Connect - case ebpf.CGroupSockopt: - spec.AttachType = ebpf.AttachCGroupGetsockopt - case ebpf.SkLookup: - spec.AttachType = ebpf.AttachSkLookup - case ebpf.Syscall: - spec.Flags = unix.BPF_F_SLEEPABLE - } - - prog, err := ebpf.NewProgramWithOptions(spec, ebpf.ProgramOptions{ - LogDisabled: true, - }) - if err == nil { - prog.Close() - } - - switch { - // EACCES occurs when attempting to create a program probe with a helper - // while the register args when calling this helper aren't set up properly. - // We interpret this as the helper being available, because the verifier - // returns EINVAL if the helper is not supported by the running kernel. - case errors.Is(err, unix.EACCES): - // TODO: possibly we need to check verifier output here to be sure - err = nil - - // EINVAL occurs when attempting to create a program with an unknown helper. - case errors.Is(err, unix.EINVAL): - // TODO: possibly we need to check verifier output here to be sure - err = ebpf.ErrNotSupported - } - - return err -} - -func helperProbeNotImplemented(pt ebpf.ProgramType) bool { - switch pt { - case ebpf.Extension, ebpf.LSM, ebpf.StructOps, ebpf.Tracing: - return true - } - return false -} diff --git a/vendor/github.com/cilium/ebpf/features/version.go b/vendor/github.com/cilium/ebpf/features/version.go deleted file mode 100644 index 69e1c39c1..000000000 --- a/vendor/github.com/cilium/ebpf/features/version.go +++ /dev/null @@ -1,18 +0,0 @@ -package features - -import "github.com/cilium/ebpf/internal" - -// LinuxVersionCode returns the version of the currently running kernel -// as defined in the LINUX_VERSION_CODE compile-time macro. It is represented -// in the format described by the KERNEL_VERSION macro from linux/version.h. -// -// Do not use the version to make assumptions about the presence of certain -// kernel features, always prefer feature probes in this package. Some -// distributions backport or disable eBPF features. -func LinuxVersionCode() (uint32, error) { - v, err := internal.KernelVersion() - if err != nil { - return 0, err - } - return v.Kernel(), nil -} diff --git a/vendor/github.com/cilium/ebpf/info.go b/vendor/github.com/cilium/ebpf/info.go deleted file mode 100644 index 79b11c951..000000000 --- a/vendor/github.com/cilium/ebpf/info.go +++ /dev/null @@ -1,453 +0,0 @@ -package ebpf - -import ( - "bufio" - "bytes" - "encoding/hex" - "errors" - "fmt" - "io" - "os" - "strings" - "syscall" - "time" - "unsafe" - - "github.com/cilium/ebpf/asm" - "github.com/cilium/ebpf/btf" - "github.com/cilium/ebpf/internal" - "github.com/cilium/ebpf/internal/sys" - "github.com/cilium/ebpf/internal/unix" -) - -// MapInfo describes a map. -type MapInfo struct { - Type MapType - id MapID - KeySize uint32 - ValueSize uint32 - MaxEntries uint32 - Flags uint32 - // Name as supplied by user space at load time. Available from 4.15. - Name string -} - -func newMapInfoFromFd(fd *sys.FD) (*MapInfo, error) { - var info sys.MapInfo - err := sys.ObjInfo(fd, &info) - if errors.Is(err, syscall.EINVAL) { - return newMapInfoFromProc(fd) - } - if err != nil { - return nil, err - } - - return &MapInfo{ - MapType(info.Type), - MapID(info.Id), - info.KeySize, - info.ValueSize, - info.MaxEntries, - uint32(info.MapFlags), - unix.ByteSliceToString(info.Name[:]), - }, nil -} - -func newMapInfoFromProc(fd *sys.FD) (*MapInfo, error) { - var mi MapInfo - err := scanFdInfo(fd, map[string]interface{}{ - "map_type": &mi.Type, - "key_size": &mi.KeySize, - "value_size": &mi.ValueSize, - "max_entries": &mi.MaxEntries, - "map_flags": &mi.Flags, - }) - if err != nil { - return nil, err - } - return &mi, nil -} - -// ID returns the map ID. -// -// Available from 4.13. -// -// The bool return value indicates whether this optional field is available. -func (mi *MapInfo) ID() (MapID, bool) { - return mi.id, mi.id > 0 -} - -// programStats holds statistics of a program. -type programStats struct { - // Total accumulated runtime of the program ins ns. - runtime time.Duration - // Total number of times the program was called. - runCount uint64 -} - -// ProgramInfo describes a program. -type ProgramInfo struct { - Type ProgramType - id ProgramID - // Truncated hash of the BPF bytecode. Available from 4.13. - Tag string - // Name as supplied by user space at load time. Available from 4.15. - Name string - - createdByUID uint32 - haveCreatedByUID bool - btf btf.ID - stats *programStats - - maps []MapID - insns []byte - - lineInfos []byte - numLineInfos uint32 - funcInfos []byte - numFuncInfos uint32 -} - -func newProgramInfoFromFd(fd *sys.FD) (*ProgramInfo, error) { - var info sys.ProgInfo - err := sys.ObjInfo(fd, &info) - if errors.Is(err, syscall.EINVAL) { - return newProgramInfoFromProc(fd) - } - if err != nil { - return nil, err - } - - pi := ProgramInfo{ - Type: ProgramType(info.Type), - id: ProgramID(info.Id), - Tag: hex.EncodeToString(info.Tag[:]), - Name: unix.ByteSliceToString(info.Name[:]), - btf: btf.ID(info.BtfId), - stats: &programStats{ - runtime: time.Duration(info.RunTimeNs), - runCount: info.RunCnt, - }, - } - - // Start with a clean struct for the second call, otherwise we may get EFAULT. - var info2 sys.ProgInfo - - makeSecondCall := false - - if info.NrMapIds > 0 { - pi.maps = make([]MapID, info.NrMapIds) - info2.NrMapIds = info.NrMapIds - info2.MapIds = sys.NewPointer(unsafe.Pointer(&pi.maps[0])) - makeSecondCall = true - } else if haveProgramInfoMapIDs() == nil { - // This program really has no associated maps. - pi.maps = make([]MapID, 0) - } else { - // The kernel doesn't report associated maps. - pi.maps = nil - } - - // createdByUID and NrMapIds were introduced in the same kernel version. - if pi.maps != nil { - pi.createdByUID = info.CreatedByUid - pi.haveCreatedByUID = true - } - - if info.XlatedProgLen > 0 { - pi.insns = make([]byte, info.XlatedProgLen) - info2.XlatedProgLen = info.XlatedProgLen - info2.XlatedProgInsns = sys.NewSlicePointer(pi.insns) - makeSecondCall = true - } - - if info.NrLineInfo > 0 { - pi.lineInfos = make([]byte, btf.LineInfoSize*info.NrLineInfo) - info2.LineInfo = sys.NewSlicePointer(pi.lineInfos) - info2.LineInfoRecSize = btf.LineInfoSize - info2.NrLineInfo = info.NrLineInfo - pi.numLineInfos = info.NrLineInfo - makeSecondCall = true - } - - if info.NrFuncInfo > 0 { - pi.funcInfos = make([]byte, btf.FuncInfoSize*info.NrFuncInfo) - info2.FuncInfo = sys.NewSlicePointer(pi.funcInfos) - info2.FuncInfoRecSize = btf.FuncInfoSize - info2.NrFuncInfo = info.NrFuncInfo - pi.numFuncInfos = info.NrFuncInfo - makeSecondCall = true - } - - if makeSecondCall { - if err := sys.ObjInfo(fd, &info2); err != nil { - return nil, err - } - } - - return &pi, nil -} - -func newProgramInfoFromProc(fd *sys.FD) (*ProgramInfo, error) { - var info ProgramInfo - err := scanFdInfo(fd, map[string]interface{}{ - "prog_type": &info.Type, - "prog_tag": &info.Tag, - }) - if errors.Is(err, errMissingFields) { - return nil, &internal.UnsupportedFeatureError{ - Name: "reading program info from /proc/self/fdinfo", - MinimumVersion: internal.Version{4, 10, 0}, - } - } - if err != nil { - return nil, err - } - - return &info, nil -} - -// ID returns the program ID. -// -// Available from 4.13. -// -// The bool return value indicates whether this optional field is available. -func (pi *ProgramInfo) ID() (ProgramID, bool) { - return pi.id, pi.id > 0 -} - -// CreatedByUID returns the Uid that created the program. -// -// Available from 4.15. -// -// The bool return value indicates whether this optional field is available. -func (pi *ProgramInfo) CreatedByUID() (uint32, bool) { - return pi.createdByUID, pi.haveCreatedByUID -} - -// BTFID returns the BTF ID associated with the program. -// -// The ID is only valid as long as the associated program is kept alive. -// Available from 5.0. -// -// The bool return value indicates whether this optional field is available and -// populated. (The field may be available but not populated if the kernel -// supports the field but the program was loaded without BTF information.) -func (pi *ProgramInfo) BTFID() (btf.ID, bool) { - return pi.btf, pi.btf > 0 -} - -// RunCount returns the total number of times the program was called. -// -// Can return 0 if the collection of statistics is not enabled. See EnableStats(). -// The bool return value indicates whether this optional field is available. -func (pi *ProgramInfo) RunCount() (uint64, bool) { - if pi.stats != nil { - return pi.stats.runCount, true - } - return 0, false -} - -// Runtime returns the total accumulated runtime of the program. -// -// Can return 0 if the collection of statistics is not enabled. See EnableStats(). -// The bool return value indicates whether this optional field is available. -func (pi *ProgramInfo) Runtime() (time.Duration, bool) { - if pi.stats != nil { - return pi.stats.runtime, true - } - return time.Duration(0), false -} - -// Instructions returns the 'xlated' instruction stream of the program -// after it has been verified and rewritten by the kernel. These instructions -// cannot be loaded back into the kernel as-is, this is mainly used for -// inspecting loaded programs for troubleshooting, dumping, etc. -// -// For example, map accesses are made to reference their kernel map IDs, -// not the FDs they had when the program was inserted. Note that before -// the introduction of bpf_insn_prepare_dump in kernel 4.16, xlated -// instructions were not sanitized, making the output even less reusable -// and less likely to round-trip or evaluate to the same program Tag. -// -// The first instruction is marked as a symbol using the Program's name. -// -// If available, the instructions will be annotated with metadata from the -// BTF. This includes line information and function information. Reading -// this metadata requires CAP_SYS_ADMIN or equivalent. If capability is -// unavailable, the instructions will be returned without metadata. -// -// Available from 4.13. Requires CAP_BPF or equivalent for plain instructions. -// Requires CAP_SYS_ADMIN for instructions with metadata. -func (pi *ProgramInfo) Instructions() (asm.Instructions, error) { - // If the calling process is not BPF-capable or if the kernel doesn't - // support getting xlated instructions, the field will be zero. - if len(pi.insns) == 0 { - return nil, fmt.Errorf("insufficient permissions or unsupported kernel: %w", ErrNotSupported) - } - - r := bytes.NewReader(pi.insns) - var insns asm.Instructions - if err := insns.Unmarshal(r, internal.NativeEndian); err != nil { - return nil, fmt.Errorf("unmarshaling instructions: %w", err) - } - - if pi.btf != 0 { - btfh, err := btf.NewHandleFromID(pi.btf) - if err != nil { - // Getting a BTF handle requires CAP_SYS_ADMIN, if not available we get an -EPERM. - // Ignore it and fall back to instructions without metadata. - if !errors.Is(err, unix.EPERM) { - return nil, fmt.Errorf("unable to get BTF handle: %w", err) - } - } - - // If we have a BTF handle, we can use it to assign metadata to the instructions. - if btfh != nil { - defer btfh.Close() - - spec, err := btfh.Spec(nil) - if err != nil { - return nil, fmt.Errorf("unable to get BTF spec: %w", err) - } - - lineInfos, err := btf.LoadLineInfos( - bytes.NewReader(pi.lineInfos), - internal.NativeEndian, - pi.numLineInfos, - spec, - ) - if err != nil { - return nil, fmt.Errorf("parse line info: %w", err) - } - - funcInfos, err := btf.LoadFuncInfos( - bytes.NewReader(pi.funcInfos), - internal.NativeEndian, - pi.numFuncInfos, - spec, - ) - if err != nil { - return nil, fmt.Errorf("parse func info: %w", err) - } - - btf.AssignMetadataToInstructions(insns, funcInfos, lineInfos, btf.CORERelocationInfos{}) - } - } - - fn := btf.FuncMetadata(&insns[0]) - name := pi.Name - if fn != nil { - name = fn.Name - } - insns[0] = insns[0].WithSymbol(name) - - return insns, nil -} - -// MapIDs returns the maps related to the program. -// -// Available from 4.15. -// -// The bool return value indicates whether this optional field is available. -func (pi *ProgramInfo) MapIDs() ([]MapID, bool) { - return pi.maps, pi.maps != nil -} - -func scanFdInfo(fd *sys.FD, fields map[string]interface{}) error { - fh, err := os.Open(fmt.Sprintf("/proc/self/fdinfo/%d", fd.Int())) - if err != nil { - return err - } - defer fh.Close() - - if err := scanFdInfoReader(fh, fields); err != nil { - return fmt.Errorf("%s: %w", fh.Name(), err) - } - return nil -} - -var errMissingFields = errors.New("missing fields") - -func scanFdInfoReader(r io.Reader, fields map[string]interface{}) error { - var ( - scanner = bufio.NewScanner(r) - scanned int - ) - - for scanner.Scan() { - parts := strings.SplitN(scanner.Text(), "\t", 2) - if len(parts) != 2 { - continue - } - - name := strings.TrimSuffix(parts[0], ":") - field, ok := fields[string(name)] - if !ok { - continue - } - - if n, err := fmt.Sscanln(parts[1], field); err != nil || n != 1 { - return fmt.Errorf("can't parse field %s: %v", name, err) - } - - scanned++ - } - - if err := scanner.Err(); err != nil { - return err - } - - if len(fields) > 0 && scanned == 0 { - return ErrNotSupported - } - - if scanned != len(fields) { - return errMissingFields - } - - return nil -} - -// EnableStats starts the measuring of the runtime -// and run counts of eBPF programs. -// -// Collecting statistics can have an impact on the performance. -// -// Requires at least 5.8. -func EnableStats(which uint32) (io.Closer, error) { - fd, err := sys.EnableStats(&sys.EnableStatsAttr{ - Type: which, - }) - if err != nil { - return nil, err - } - return fd, nil -} - -var haveProgramInfoMapIDs = internal.NewFeatureTest("map IDs in program info", "4.15", func() error { - prog, err := progLoad(asm.Instructions{ - asm.LoadImm(asm.R0, 0, asm.DWord), - asm.Return(), - }, SocketFilter, "MIT") - if err != nil { - return err - } - defer prog.Close() - - err = sys.ObjInfo(prog, &sys.ProgInfo{ - // NB: Don't need to allocate MapIds since the program isn't using - // any maps. - NrMapIds: 1, - }) - if errors.Is(err, unix.EINVAL) { - // Most likely the syscall doesn't exist. - return internal.ErrNotSupported - } - if errors.Is(err, unix.E2BIG) { - // We've hit check_uarg_tail_zero on older kernels. - return internal.ErrNotSupported - } - - return err -}) diff --git a/vendor/github.com/cilium/ebpf/internal/auxv.go b/vendor/github.com/cilium/ebpf/internal/auxv.go deleted file mode 100644 index 45fd0d37f..000000000 --- a/vendor/github.com/cilium/ebpf/internal/auxv.go +++ /dev/null @@ -1,60 +0,0 @@ -package internal - -import ( - "errors" - "io" - _ "unsafe" -) - -type auxvPairReader interface { - Close() error - ReadAuxvPair() (uint64, uint64, error) -} - -// See https://elixir.bootlin.com/linux/v6.5.5/source/include/uapi/linux/auxvec.h -const ( - _AT_NULL = 0 // End of vector - _AT_SYSINFO_EHDR = 33 // Offset to vDSO blob in process image -) - -//go:linkname runtime_getAuxv runtime.getAuxv -func runtime_getAuxv() []uintptr - -type auxvRuntimeReader struct { - data []uintptr - index int -} - -func (r *auxvRuntimeReader) Close() error { - return nil -} - -func (r *auxvRuntimeReader) ReadAuxvPair() (uint64, uint64, error) { - if r.index >= len(r.data)+2 { - return 0, 0, io.EOF - } - - // we manually add the (_AT_NULL, _AT_NULL) pair at the end - // that is not provided by the go runtime - var tag, value uintptr - if r.index+1 < len(r.data) { - tag, value = r.data[r.index], r.data[r.index+1] - } else { - tag, value = _AT_NULL, _AT_NULL - } - r.index += 2 - return uint64(tag), uint64(value), nil -} - -func newAuxvRuntimeReader() (auxvPairReader, error) { - data := runtime_getAuxv() - - if len(data)%2 != 0 { - return nil, errors.New("malformed auxv passed from runtime") - } - - return &auxvRuntimeReader{ - data: data, - index: 0, - }, nil -} diff --git a/vendor/github.com/cilium/ebpf/internal/buffer.go b/vendor/github.com/cilium/ebpf/internal/buffer.go deleted file mode 100644 index 81c654433..000000000 --- a/vendor/github.com/cilium/ebpf/internal/buffer.go +++ /dev/null @@ -1,31 +0,0 @@ -package internal - -import ( - "bytes" - "sync" -) - -var bytesBufferPool = sync.Pool{ - New: func() interface{} { - return new(bytes.Buffer) - }, -} - -// NewBuffer retrieves a [bytes.Buffer] from a pool an re-initialises it. -// -// The returned buffer should be passed to [PutBuffer]. -func NewBuffer(buf []byte) *bytes.Buffer { - wr := bytesBufferPool.Get().(*bytes.Buffer) - // Reinitialize the Buffer with a new backing slice since it is returned to - // the caller by wr.Bytes() below. Pooling is faster despite calling - // NewBuffer. The pooled alloc is still reused, it only needs to be zeroed. - *wr = *bytes.NewBuffer(buf) - return wr -} - -// PutBuffer releases a buffer to the pool. -func PutBuffer(buf *bytes.Buffer) { - // Release reference to the backing buffer. - *buf = *bytes.NewBuffer(nil) - bytesBufferPool.Put(buf) -} diff --git a/vendor/github.com/cilium/ebpf/internal/deque.go b/vendor/github.com/cilium/ebpf/internal/deque.go deleted file mode 100644 index e3a305021..000000000 --- a/vendor/github.com/cilium/ebpf/internal/deque.go +++ /dev/null @@ -1,91 +0,0 @@ -package internal - -import "math/bits" - -// Deque implements a double ended queue. -type Deque[T any] struct { - elems []T - read, write uint64 - mask uint64 -} - -// Reset clears the contents of the deque while retaining the backing buffer. -func (dq *Deque[T]) Reset() { - var zero T - - for i := dq.read; i < dq.write; i++ { - dq.elems[i&dq.mask] = zero - } - - dq.read, dq.write = 0, 0 -} - -func (dq *Deque[T]) Empty() bool { - return dq.read == dq.write -} - -// Push adds an element to the end. -func (dq *Deque[T]) Push(e T) { - dq.Grow(1) - dq.elems[dq.write&dq.mask] = e - dq.write++ -} - -// Shift returns the first element or the zero value. -func (dq *Deque[T]) Shift() T { - var zero T - - if dq.Empty() { - return zero - } - - index := dq.read & dq.mask - t := dq.elems[index] - dq.elems[index] = zero - dq.read++ - return t -} - -// Pop returns the last element or the zero value. -func (dq *Deque[T]) Pop() T { - var zero T - - if dq.Empty() { - return zero - } - - dq.write-- - index := dq.write & dq.mask - t := dq.elems[index] - dq.elems[index] = zero - return t -} - -// Grow the deque's capacity, if necessary, to guarantee space for another n -// elements. -func (dq *Deque[T]) Grow(n int) { - have := dq.write - dq.read - need := have + uint64(n) - if need < have { - panic("overflow") - } - if uint64(len(dq.elems)) >= need { - return - } - - // Round up to the new power of two which is at least 8. - // See https://jameshfisher.com/2018/03/30/round-up-power-2/ - capacity := 1 << (64 - bits.LeadingZeros64(need-1)) - if capacity < 8 { - capacity = 8 - } - - elems := make([]T, have, capacity) - pivot := dq.read & dq.mask - copied := copy(elems, dq.elems[pivot:]) - copy(elems[copied:], dq.elems[:pivot]) - - dq.elems = elems[:capacity] - dq.mask = uint64(capacity) - 1 - dq.read, dq.write = 0, have -} diff --git a/vendor/github.com/cilium/ebpf/internal/elf.go b/vendor/github.com/cilium/ebpf/internal/elf.go deleted file mode 100644 index 011581938..000000000 --- a/vendor/github.com/cilium/ebpf/internal/elf.go +++ /dev/null @@ -1,102 +0,0 @@ -package internal - -import ( - "debug/elf" - "fmt" - "io" -) - -type SafeELFFile struct { - *elf.File -} - -// NewSafeELFFile reads an ELF safely. -// -// Any panic during parsing is turned into an error. This is necessary since -// there are a bunch of unfixed bugs in debug/elf. -// -// https://github.com/golang/go/issues?q=is%3Aissue+is%3Aopen+debug%2Felf+in%3Atitle -func NewSafeELFFile(r io.ReaderAt) (safe *SafeELFFile, err error) { - defer func() { - r := recover() - if r == nil { - return - } - - safe = nil - err = fmt.Errorf("reading ELF file panicked: %s", r) - }() - - file, err := elf.NewFile(r) - if err != nil { - return nil, err - } - - return &SafeELFFile{file}, nil -} - -// OpenSafeELFFile reads an ELF from a file. -// -// It works like NewSafeELFFile, with the exception that safe.Close will -// close the underlying file. -func OpenSafeELFFile(path string) (safe *SafeELFFile, err error) { - defer func() { - r := recover() - if r == nil { - return - } - - safe = nil - err = fmt.Errorf("reading ELF file panicked: %s", r) - }() - - file, err := elf.Open(path) - if err != nil { - return nil, err - } - - return &SafeELFFile{file}, nil -} - -// Symbols is the safe version of elf.File.Symbols. -func (se *SafeELFFile) Symbols() (syms []elf.Symbol, err error) { - defer func() { - r := recover() - if r == nil { - return - } - - syms = nil - err = fmt.Errorf("reading ELF symbols panicked: %s", r) - }() - - syms, err = se.File.Symbols() - return -} - -// DynamicSymbols is the safe version of elf.File.DynamicSymbols. -func (se *SafeELFFile) DynamicSymbols() (syms []elf.Symbol, err error) { - defer func() { - r := recover() - if r == nil { - return - } - - syms = nil - err = fmt.Errorf("reading ELF dynamic symbols panicked: %s", r) - }() - - syms, err = se.File.DynamicSymbols() - return -} - -// SectionsByType returns all sections in the file with the specified section type. -func (se *SafeELFFile) SectionsByType(typ elf.SectionType) []*elf.Section { - sections := make([]*elf.Section, 0, 1) - for _, section := range se.Sections { - if section.Type == typ { - sections = append(sections, section) - } - } - return sections -} diff --git a/vendor/github.com/cilium/ebpf/internal/endian_be.go b/vendor/github.com/cilium/ebpf/internal/endian_be.go deleted file mode 100644 index a37777f21..000000000 --- a/vendor/github.com/cilium/ebpf/internal/endian_be.go +++ /dev/null @@ -1,9 +0,0 @@ -//go:build armbe || arm64be || mips || mips64 || mips64p32 || ppc64 || s390 || s390x || sparc || sparc64 - -package internal - -import "encoding/binary" - -// NativeEndian is set to either binary.BigEndian or binary.LittleEndian, -// depending on the host's endianness. -var NativeEndian = binary.BigEndian diff --git a/vendor/github.com/cilium/ebpf/internal/endian_le.go b/vendor/github.com/cilium/ebpf/internal/endian_le.go deleted file mode 100644 index 6dcd916d5..000000000 --- a/vendor/github.com/cilium/ebpf/internal/endian_le.go +++ /dev/null @@ -1,9 +0,0 @@ -//go:build 386 || amd64 || amd64p32 || arm || arm64 || loong64 || mipsle || mips64le || mips64p32le || ppc64le || riscv64 - -package internal - -import "encoding/binary" - -// NativeEndian is set to either binary.BigEndian or binary.LittleEndian, -// depending on the host's endianness. -var NativeEndian = binary.LittleEndian diff --git a/vendor/github.com/cilium/ebpf/internal/errors.go b/vendor/github.com/cilium/ebpf/internal/errors.go deleted file mode 100644 index bda01e2fd..000000000 --- a/vendor/github.com/cilium/ebpf/internal/errors.go +++ /dev/null @@ -1,198 +0,0 @@ -package internal - -import ( - "bytes" - "fmt" - "io" - "strings" -) - -// ErrorWithLog wraps err in a VerifierError that includes the parsed verifier -// log buffer. -// -// The default error output is a summary of the full log. The latter can be -// accessed via VerifierError.Log or by formatting the error, see Format. -func ErrorWithLog(source string, err error, log []byte, truncated bool) *VerifierError { - const whitespace = "\t\r\v\n " - - // Convert verifier log C string by truncating it on the first 0 byte - // and trimming trailing whitespace before interpreting as a Go string. - if i := bytes.IndexByte(log, 0); i != -1 { - log = log[:i] - } - - log = bytes.Trim(log, whitespace) - if len(log) == 0 { - return &VerifierError{source, err, nil, truncated} - } - - logLines := bytes.Split(log, []byte{'\n'}) - lines := make([]string, 0, len(logLines)) - for _, line := range logLines { - // Don't remove leading white space on individual lines. We rely on it - // when outputting logs. - lines = append(lines, string(bytes.TrimRight(line, whitespace))) - } - - return &VerifierError{source, err, lines, truncated} -} - -// VerifierError includes information from the eBPF verifier. -// -// It summarises the log output, see Format if you want to output the full contents. -type VerifierError struct { - source string - // The error which caused this error. - Cause error - // The verifier output split into lines. - Log []string - // Whether the log output is truncated, based on several heuristics. - Truncated bool -} - -func (le *VerifierError) Unwrap() error { - return le.Cause -} - -func (le *VerifierError) Error() string { - log := le.Log - if n := len(log); n > 0 && strings.HasPrefix(log[n-1], "processed ") { - // Get rid of "processed 39 insns (limit 1000000) ..." from summary. - log = log[:n-1] - } - - var b strings.Builder - fmt.Fprintf(&b, "%s: %s", le.source, le.Cause.Error()) - - n := len(log) - if n == 0 { - return b.String() - } - - lines := log[n-1:] - if n >= 2 && (includePreviousLine(log[n-1]) || le.Truncated) { - // Add one more line of context if it aids understanding the error. - lines = log[n-2:] - } - - for _, line := range lines { - b.WriteString(": ") - b.WriteString(strings.TrimSpace(line)) - } - - omitted := len(le.Log) - len(lines) - if omitted == 0 && !le.Truncated { - return b.String() - } - - b.WriteString(" (") - if le.Truncated { - b.WriteString("truncated") - } - - if omitted > 0 { - if le.Truncated { - b.WriteString(", ") - } - fmt.Fprintf(&b, "%d line(s) omitted", omitted) - } - b.WriteString(")") - - return b.String() -} - -// includePreviousLine returns true if the given line likely is better -// understood with additional context from the preceding line. -func includePreviousLine(line string) bool { - // We need to find a good trade off between understandable error messages - // and too much complexity here. Checking the string prefix is ok, requiring - // regular expressions to do it is probably overkill. - - if strings.HasPrefix(line, "\t") { - // [13] STRUCT drm_rect size=16 vlen=4 - // \tx1 type_id=2 - return true - } - - if len(line) >= 2 && line[0] == 'R' && line[1] >= '0' && line[1] <= '9' { - // 0: (95) exit - // R0 !read_ok - return true - } - - if strings.HasPrefix(line, "invalid bpf_context access") { - // 0: (79) r6 = *(u64 *)(r1 +0) - // func '__x64_sys_recvfrom' arg0 type FWD is not a struct - // invalid bpf_context access off=0 size=8 - return true - } - - return false -} - -// Format the error. -// -// Understood verbs are %s and %v, which are equivalent to calling Error(). %v -// allows outputting additional information using the following flags: -// -// %+v: Output the first lines, or all lines if no width is given. -// %-v: Output the last lines, or all lines if no width is given. -// -// Use width to specify how many lines to output. Use the '-' flag to output -// lines from the end of the log instead of the beginning. -func (le *VerifierError) Format(f fmt.State, verb rune) { - switch verb { - case 's': - _, _ = io.WriteString(f, le.Error()) - - case 'v': - n, haveWidth := f.Width() - if !haveWidth || n > len(le.Log) { - n = len(le.Log) - } - - if !f.Flag('+') && !f.Flag('-') { - if haveWidth { - _, _ = io.WriteString(f, "%!v(BADWIDTH)") - return - } - - _, _ = io.WriteString(f, le.Error()) - return - } - - if f.Flag('+') && f.Flag('-') { - _, _ = io.WriteString(f, "%!v(BADFLAG)") - return - } - - fmt.Fprintf(f, "%s: %s:", le.source, le.Cause.Error()) - - omitted := len(le.Log) - n - lines := le.Log[:n] - if f.Flag('-') { - // Print last instead of first lines. - lines = le.Log[len(le.Log)-n:] - if omitted > 0 { - fmt.Fprintf(f, "\n\t(%d line(s) omitted)", omitted) - } - } - - for _, line := range lines { - fmt.Fprintf(f, "\n\t%s", line) - } - - if !f.Flag('-') { - if omitted > 0 { - fmt.Fprintf(f, "\n\t(%d line(s) omitted)", omitted) - } - } - - if le.Truncated { - fmt.Fprintf(f, "\n\t(truncated)") - } - - default: - fmt.Fprintf(f, "%%!%c(BADVERB)", verb) - } -} diff --git a/vendor/github.com/cilium/ebpf/internal/feature.go b/vendor/github.com/cilium/ebpf/internal/feature.go deleted file mode 100644 index 2b856c735..000000000 --- a/vendor/github.com/cilium/ebpf/internal/feature.go +++ /dev/null @@ -1,184 +0,0 @@ -package internal - -import ( - "errors" - "fmt" - "sync" -) - -// ErrNotSupported indicates that a feature is not supported by the current kernel. -var ErrNotSupported = errors.New("not supported") - -// UnsupportedFeatureError is returned by FeatureTest() functions. -type UnsupportedFeatureError struct { - // The minimum Linux mainline version required for this feature. - // Used for the error string, and for sanity checking during testing. - MinimumVersion Version - - // The name of the feature that isn't supported. - Name string -} - -func (ufe *UnsupportedFeatureError) Error() string { - if ufe.MinimumVersion.Unspecified() { - return fmt.Sprintf("%s not supported", ufe.Name) - } - return fmt.Sprintf("%s not supported (requires >= %s)", ufe.Name, ufe.MinimumVersion) -} - -// Is indicates that UnsupportedFeatureError is ErrNotSupported. -func (ufe *UnsupportedFeatureError) Is(target error) bool { - return target == ErrNotSupported -} - -// FeatureTest caches the result of a [FeatureTestFn]. -// -// Fields should not be modified after creation. -type FeatureTest struct { - // The name of the feature being detected. - Name string - // Version in the form Major.Minor[.Patch]. - Version string - // The feature test itself. - Fn FeatureTestFn - - mu sync.RWMutex - done bool - result error -} - -// FeatureTestFn is used to determine whether the kernel supports -// a certain feature. -// -// The return values have the following semantics: -// -// err == ErrNotSupported: the feature is not available -// err == nil: the feature is available -// err != nil: the test couldn't be executed -type FeatureTestFn func() error - -// NewFeatureTest is a convenient way to create a single [FeatureTest]. -func NewFeatureTest(name, version string, fn FeatureTestFn) func() error { - ft := &FeatureTest{ - Name: name, - Version: version, - Fn: fn, - } - - return ft.execute -} - -// execute the feature test. -// -// The result is cached if the test is conclusive. -// -// See [FeatureTestFn] for the meaning of the returned error. -func (ft *FeatureTest) execute() error { - ft.mu.RLock() - result, done := ft.result, ft.done - ft.mu.RUnlock() - - if done { - return result - } - - ft.mu.Lock() - defer ft.mu.Unlock() - - // The test may have been executed by another caller while we were - // waiting to acquire ft.mu. - if ft.done { - return ft.result - } - - err := ft.Fn() - if err == nil { - ft.done = true - return nil - } - - if errors.Is(err, ErrNotSupported) { - var v Version - if ft.Version != "" { - v, err = NewVersion(ft.Version) - if err != nil { - return fmt.Errorf("feature %s: %w", ft.Name, err) - } - } - - ft.done = true - ft.result = &UnsupportedFeatureError{ - MinimumVersion: v, - Name: ft.Name, - } - - return ft.result - } - - // We couldn't execute the feature test to a point - // where it could make a determination. - // Don't cache the result, just return it. - return fmt.Errorf("detect support for %s: %w", ft.Name, err) -} - -// FeatureMatrix groups multiple related feature tests into a map. -// -// Useful when there is a small number of discrete features which are known -// at compile time. -// -// It must not be modified concurrently with calling [FeatureMatrix.Result]. -type FeatureMatrix[K comparable] map[K]*FeatureTest - -// Result returns the outcome of the feature test for the given key. -// -// It's safe to call this function concurrently. -func (fm FeatureMatrix[K]) Result(key K) error { - ft, ok := fm[key] - if !ok { - return fmt.Errorf("no feature probe for %v", key) - } - - return ft.execute() -} - -// FeatureCache caches a potentially unlimited number of feature probes. -// -// Useful when there is a high cardinality for a feature test. -type FeatureCache[K comparable] struct { - mu sync.RWMutex - newTest func(K) *FeatureTest - features map[K]*FeatureTest -} - -func NewFeatureCache[K comparable](newTest func(K) *FeatureTest) *FeatureCache[K] { - return &FeatureCache[K]{ - newTest: newTest, - features: make(map[K]*FeatureTest), - } -} - -func (fc *FeatureCache[K]) Result(key K) error { - // NB: Executing the feature test happens without fc.mu taken. - return fc.retrieve(key).execute() -} - -func (fc *FeatureCache[K]) retrieve(key K) *FeatureTest { - fc.mu.RLock() - ft := fc.features[key] - fc.mu.RUnlock() - - if ft != nil { - return ft - } - - fc.mu.Lock() - defer fc.mu.Unlock() - - if ft := fc.features[key]; ft != nil { - return ft - } - - ft = fc.newTest(key) - fc.features[key] = ft - return ft -} diff --git a/vendor/github.com/cilium/ebpf/internal/io.go b/vendor/github.com/cilium/ebpf/internal/io.go deleted file mode 100644 index 1eaf4775a..000000000 --- a/vendor/github.com/cilium/ebpf/internal/io.go +++ /dev/null @@ -1,128 +0,0 @@ -package internal - -import ( - "bufio" - "bytes" - "compress/gzip" - "errors" - "fmt" - "io" - "os" - "path/filepath" - "sync" -) - -// NewBufferedSectionReader wraps an io.ReaderAt in an appropriately-sized -// buffered reader. It is a convenience function for reading subsections of -// ELF sections while minimizing the amount of read() syscalls made. -// -// Syscall overhead is non-negligible in continuous integration context -// where ELFs might be accessed over virtual filesystems with poor random -// access performance. Buffering reads makes sense because (sub)sections -// end up being read completely anyway. -// -// Use instead of the r.Seek() + io.LimitReader() pattern. -func NewBufferedSectionReader(ra io.ReaderAt, off, n int64) *bufio.Reader { - // Clamp the size of the buffer to one page to avoid slurping large parts - // of a file into memory. bufio.NewReader uses a hardcoded default buffer - // of 4096. Allow arches with larger pages to allocate more, but don't - // allocate a fixed 4k buffer if we only need to read a small segment. - buf := n - if ps := int64(os.Getpagesize()); n > ps { - buf = ps - } - - return bufio.NewReaderSize(io.NewSectionReader(ra, off, n), int(buf)) -} - -// DiscardZeroes makes sure that all written bytes are zero -// before discarding them. -type DiscardZeroes struct{} - -func (DiscardZeroes) Write(p []byte) (int, error) { - for _, b := range p { - if b != 0 { - return 0, errors.New("encountered non-zero byte") - } - } - return len(p), nil -} - -// ReadAllCompressed decompresses a gzipped file into memory. -func ReadAllCompressed(file string) ([]byte, error) { - fh, err := os.Open(file) - if err != nil { - return nil, err - } - defer fh.Close() - - gz, err := gzip.NewReader(fh) - if err != nil { - return nil, err - } - defer gz.Close() - - return io.ReadAll(gz) -} - -// ReadUint64FromFile reads a uint64 from a file. -// -// format specifies the contents of the file in fmt.Scanf syntax. -func ReadUint64FromFile(format string, path ...string) (uint64, error) { - filename := filepath.Join(path...) - data, err := os.ReadFile(filename) - if err != nil { - return 0, fmt.Errorf("reading file %q: %w", filename, err) - } - - var value uint64 - n, err := fmt.Fscanf(bytes.NewReader(data), format, &value) - if err != nil { - return 0, fmt.Errorf("parsing file %q: %w", filename, err) - } - if n != 1 { - return 0, fmt.Errorf("parsing file %q: expected 1 item, got %d", filename, n) - } - - return value, nil -} - -type uint64FromFileKey struct { - format, path string -} - -var uint64FromFileCache = struct { - sync.RWMutex - values map[uint64FromFileKey]uint64 -}{ - values: map[uint64FromFileKey]uint64{}, -} - -// ReadUint64FromFileOnce is like readUint64FromFile but memoizes the result. -func ReadUint64FromFileOnce(format string, path ...string) (uint64, error) { - filename := filepath.Join(path...) - key := uint64FromFileKey{format, filename} - - uint64FromFileCache.RLock() - if value, ok := uint64FromFileCache.values[key]; ok { - uint64FromFileCache.RUnlock() - return value, nil - } - uint64FromFileCache.RUnlock() - - value, err := ReadUint64FromFile(format, filename) - if err != nil { - return 0, err - } - - uint64FromFileCache.Lock() - defer uint64FromFileCache.Unlock() - - if value, ok := uint64FromFileCache.values[key]; ok { - // Someone else got here before us, use what is cached. - return value, nil - } - - uint64FromFileCache.values[key] = value - return value, nil -} diff --git a/vendor/github.com/cilium/ebpf/internal/kallsyms/kallsyms.go b/vendor/github.com/cilium/ebpf/internal/kallsyms/kallsyms.go deleted file mode 100644 index 776c7a10a..000000000 --- a/vendor/github.com/cilium/ebpf/internal/kallsyms/kallsyms.go +++ /dev/null @@ -1,74 +0,0 @@ -package kallsyms - -import ( - "bufio" - "bytes" - "io" - "os" - "sync" -) - -var kernelModules struct { - sync.RWMutex - // function to kernel module mapping - kmods map[string]string -} - -// KernelModule returns the kernel module, if any, a probe-able function is contained in. -func KernelModule(fn string) (string, error) { - kernelModules.RLock() - kmods := kernelModules.kmods - kernelModules.RUnlock() - - if kmods == nil { - kernelModules.Lock() - defer kernelModules.Unlock() - kmods = kernelModules.kmods - } - - if kmods != nil { - return kmods[fn], nil - } - - f, err := os.Open("/proc/kallsyms") - if err != nil { - return "", err - } - defer f.Close() - kmods, err = loadKernelModuleMapping(f) - if err != nil { - return "", err - } - - kernelModules.kmods = kmods - return kmods[fn], nil -} - -// FlushKernelModuleCache removes any cached information about function to kernel module mapping. -func FlushKernelModuleCache() { - kernelModules.Lock() - defer kernelModules.Unlock() - - kernelModules.kmods = nil -} - -func loadKernelModuleMapping(f io.Reader) (map[string]string, error) { - mods := make(map[string]string) - scanner := bufio.NewScanner(f) - for scanner.Scan() { - fields := bytes.Fields(scanner.Bytes()) - if len(fields) < 4 { - continue - } - switch string(fields[1]) { - case "t", "T": - mods[string(fields[2])] = string(bytes.Trim(fields[3], "[]")) - default: - continue - } - } - if scanner.Err() != nil { - return nil, scanner.Err() - } - return mods, nil -} diff --git a/vendor/github.com/cilium/ebpf/internal/kconfig/kconfig.go b/vendor/github.com/cilium/ebpf/internal/kconfig/kconfig.go deleted file mode 100644 index 1921e4f15..000000000 --- a/vendor/github.com/cilium/ebpf/internal/kconfig/kconfig.go +++ /dev/null @@ -1,293 +0,0 @@ -package kconfig - -import ( - "bufio" - "bytes" - "compress/gzip" - "fmt" - "io" - "math" - "os" - "strconv" - "strings" - - "github.com/cilium/ebpf/btf" - "github.com/cilium/ebpf/internal" -) - -// Find find a kconfig file on the host. -// It first reads from /boot/config- of the current running kernel and tries -// /proc/config.gz if nothing was found in /boot. -// If none of the file provide a kconfig, it returns an error. -func Find() (*os.File, error) { - kernelRelease, err := internal.KernelRelease() - if err != nil { - return nil, fmt.Errorf("cannot get kernel release: %w", err) - } - - path := "/boot/config-" + kernelRelease - f, err := os.Open(path) - if err == nil { - return f, nil - } - - f, err = os.Open("/proc/config.gz") - if err == nil { - return f, nil - } - - return nil, fmt.Errorf("neither %s nor /proc/config.gz provide a kconfig", path) -} - -// Parse parses the kconfig file for which a reader is given. -// All the CONFIG_* which are in filter and which are set set will be -// put in the returned map as key with their corresponding value as map value. -// If filter is nil, no filtering will occur. -// If the kconfig file is not valid, error will be returned. -func Parse(source io.ReaderAt, filter map[string]struct{}) (map[string]string, error) { - var r io.Reader - zr, err := gzip.NewReader(io.NewSectionReader(source, 0, math.MaxInt64)) - if err != nil { - r = io.NewSectionReader(source, 0, math.MaxInt64) - } else { - // Source is gzip compressed, transparently decompress. - r = zr - } - - ret := make(map[string]string, len(filter)) - - s := bufio.NewScanner(r) - - for s.Scan() { - line := s.Bytes() - err = processKconfigLine(line, ret, filter) - if err != nil { - return nil, fmt.Errorf("cannot parse line: %w", err) - } - - if filter != nil && len(ret) == len(filter) { - break - } - } - - if err := s.Err(); err != nil { - return nil, fmt.Errorf("cannot parse: %w", err) - } - - if zr != nil { - return ret, zr.Close() - } - - return ret, nil -} - -// Golang translation of libbpf bpf_object__process_kconfig_line(): -// https://github.com/libbpf/libbpf/blob/fbd60dbff51c870f5e80a17c4f2fd639eb80af90/src/libbpf.c#L1874 -// It does the same checks but does not put the data inside the BPF map. -func processKconfigLine(line []byte, m map[string]string, filter map[string]struct{}) error { - // Ignore empty lines and "# CONFIG_* is not set". - if !bytes.HasPrefix(line, []byte("CONFIG_")) { - return nil - } - - key, value, found := bytes.Cut(line, []byte{'='}) - if !found { - return fmt.Errorf("line %q does not contain separator '='", line) - } - - if len(value) == 0 { - return fmt.Errorf("line %q has no value", line) - } - - if filter != nil { - // NB: map[string(key)] gets special optimisation help from the compiler - // and doesn't allocate. Don't turn this into a variable. - _, ok := filter[string(key)] - if !ok { - return nil - } - } - - // This can seem odd, but libbpf only sets the value the first time the key is - // met: - // https://github.com/torvalds/linux/blob/0d85b27b0cc6/tools/lib/bpf/libbpf.c#L1906-L1908 - _, ok := m[string(key)] - if !ok { - m[string(key)] = string(value) - } - - return nil -} - -// PutValue translates the value given as parameter depending on the BTF -// type, the translated value is then written to the byte array. -func PutValue(data []byte, typ btf.Type, value string) error { - typ = btf.UnderlyingType(typ) - - switch value { - case "y", "n", "m": - return putValueTri(data, typ, value) - default: - if strings.HasPrefix(value, `"`) { - return putValueString(data, typ, value) - } - return putValueNumber(data, typ, value) - } -} - -// Golang translation of libbpf_tristate enum: -// https://github.com/libbpf/libbpf/blob/fbd60dbff51c870f5e80a17c4f2fd639eb80af90/src/bpf_helpers.h#L169 -type triState int - -const ( - TriNo triState = 0 - TriYes triState = 1 - TriModule triState = 2 -) - -func putValueTri(data []byte, typ btf.Type, value string) error { - switch v := typ.(type) { - case *btf.Int: - if v.Encoding != btf.Bool { - return fmt.Errorf("cannot add tri value, expected btf.Bool, got: %v", v.Encoding) - } - - if v.Size != 1 { - return fmt.Errorf("cannot add tri value, expected size of 1 byte, got: %d", v.Size) - } - - switch value { - case "y": - data[0] = 1 - case "n": - data[0] = 0 - default: - return fmt.Errorf("cannot use %q for btf.Bool", value) - } - case *btf.Enum: - if v.Name != "libbpf_tristate" { - return fmt.Errorf("cannot use enum %q, only libbpf_tristate is supported", v.Name) - } - - var tri triState - switch value { - case "y": - tri = TriYes - case "m": - tri = TriModule - case "n": - tri = TriNo - default: - return fmt.Errorf("value %q is not support for libbpf_tristate", value) - } - - internal.NativeEndian.PutUint64(data, uint64(tri)) - default: - return fmt.Errorf("cannot add number value, expected btf.Int or btf.Enum, got: %T", v) - } - - return nil -} - -func putValueString(data []byte, typ btf.Type, value string) error { - array, ok := typ.(*btf.Array) - if !ok { - return fmt.Errorf("cannot add string value, expected btf.Array, got %T", array) - } - - contentType, ok := btf.UnderlyingType(array.Type).(*btf.Int) - if !ok { - return fmt.Errorf("cannot add string value, expected array of btf.Int, got %T", contentType) - } - - // Any Int, which is not bool, of one byte could be used to store char: - // https://github.com/torvalds/linux/blob/1a5304fecee5/tools/lib/bpf/libbpf.c#L3637-L3638 - if contentType.Size != 1 && contentType.Encoding != btf.Bool { - return fmt.Errorf("cannot add string value, expected array of btf.Int of size 1, got array of btf.Int of size: %v", contentType.Size) - } - - if !strings.HasPrefix(value, `"`) || !strings.HasSuffix(value, `"`) { - return fmt.Errorf(`value %q must start and finish with '"'`, value) - } - - str := strings.Trim(value, `"`) - - // We need to trim string if the bpf array is smaller. - if uint32(len(str)) >= array.Nelems { - str = str[:array.Nelems] - } - - // Write the string content to .kconfig. - copy(data, str) - - return nil -} - -func putValueNumber(data []byte, typ btf.Type, value string) error { - integer, ok := typ.(*btf.Int) - if !ok { - return fmt.Errorf("cannot add number value, expected *btf.Int, got: %T", integer) - } - - size := integer.Size - sizeInBits := size * 8 - - var n uint64 - var err error - if integer.Encoding == btf.Signed { - parsed, e := strconv.ParseInt(value, 0, int(sizeInBits)) - - n = uint64(parsed) - err = e - } else { - parsed, e := strconv.ParseUint(value, 0, int(sizeInBits)) - - n = uint64(parsed) - err = e - } - - if err != nil { - return fmt.Errorf("cannot parse value: %w", err) - } - - return PutInteger(data, integer, n) -} - -// PutInteger writes n into data. -// -// integer determines how much is written into data and what the valid values -// are. -func PutInteger(data []byte, integer *btf.Int, n uint64) error { - // This function should match set_kcfg_value_num in libbpf. - if integer.Encoding == btf.Bool && n > 1 { - return fmt.Errorf("invalid boolean value: %d", n) - } - - if len(data) < int(integer.Size) { - return fmt.Errorf("can't fit an integer of size %d into a byte slice of length %d", integer.Size, len(data)) - } - - switch integer.Size { - case 1: - if integer.Encoding == btf.Signed && (int64(n) > math.MaxInt8 || int64(n) < math.MinInt8) { - return fmt.Errorf("can't represent %d as a signed integer of size %d", int64(n), integer.Size) - } - data[0] = byte(n) - case 2: - if integer.Encoding == btf.Signed && (int64(n) > math.MaxInt16 || int64(n) < math.MinInt16) { - return fmt.Errorf("can't represent %d as a signed integer of size %d", int64(n), integer.Size) - } - internal.NativeEndian.PutUint16(data, uint16(n)) - case 4: - if integer.Encoding == btf.Signed && (int64(n) > math.MaxInt32 || int64(n) < math.MinInt32) { - return fmt.Errorf("can't represent %d as a signed integer of size %d", int64(n), integer.Size) - } - internal.NativeEndian.PutUint32(data, uint32(n)) - case 8: - internal.NativeEndian.PutUint64(data, uint64(n)) - default: - return fmt.Errorf("size (%d) is not valid, expected: 1, 2, 4 or 8", integer.Size) - } - - return nil -} diff --git a/vendor/github.com/cilium/ebpf/internal/math.go b/vendor/github.com/cilium/ebpf/internal/math.go deleted file mode 100644 index e95c8efde..000000000 --- a/vendor/github.com/cilium/ebpf/internal/math.go +++ /dev/null @@ -1,13 +0,0 @@ -package internal - -import "golang.org/x/exp/constraints" - -// Align returns 'n' updated to 'alignment' boundary. -func Align[I constraints.Integer](n, alignment I) I { - return (n + alignment - 1) / alignment * alignment -} - -// IsPow returns true if n is a power of two. -func IsPow[I constraints.Integer](n I) bool { - return n != 0 && (n&(n-1)) == 0 -} diff --git a/vendor/github.com/cilium/ebpf/internal/output.go b/vendor/github.com/cilium/ebpf/internal/output.go deleted file mode 100644 index dd6e6cbaf..000000000 --- a/vendor/github.com/cilium/ebpf/internal/output.go +++ /dev/null @@ -1,97 +0,0 @@ -package internal - -import ( - "bytes" - "errors" - "go/format" - "go/scanner" - "io" - "reflect" - "strings" - "unicode" -) - -// Identifier turns a C style type or field name into an exportable Go equivalent. -func Identifier(str string) string { - prev := rune(-1) - return strings.Map(func(r rune) rune { - // See https://golang.org/ref/spec#Identifiers - switch { - case unicode.IsLetter(r): - if prev == -1 { - r = unicode.ToUpper(r) - } - - case r == '_': - switch { - // The previous rune was deleted, or we are at the - // beginning of the string. - case prev == -1: - fallthrough - - // The previous rune is a lower case letter or a digit. - case unicode.IsDigit(prev) || (unicode.IsLetter(prev) && unicode.IsLower(prev)): - // delete the current rune, and force the - // next character to be uppercased. - r = -1 - } - - case unicode.IsDigit(r): - - default: - // Delete the current rune. prev is unchanged. - return -1 - } - - prev = r - return r - }, str) -} - -// WriteFormatted outputs a formatted src into out. -// -// If formatting fails it returns an informative error message. -func WriteFormatted(src []byte, out io.Writer) error { - formatted, err := format.Source(src) - if err == nil { - _, err = out.Write(formatted) - return err - } - - var el scanner.ErrorList - if !errors.As(err, &el) { - return err - } - - var nel scanner.ErrorList - for _, err := range el { - if !err.Pos.IsValid() { - nel = append(nel, err) - continue - } - - buf := src[err.Pos.Offset:] - nl := bytes.IndexRune(buf, '\n') - if nl == -1 { - nel = append(nel, err) - continue - } - - err.Msg += ": " + string(buf[:nl]) - nel = append(nel, err) - } - - return nel -} - -// GoTypeName is like %T, but elides the package name. -// -// Pointers to a type are peeled off. -func GoTypeName(t any) string { - rT := reflect.TypeOf(t) - for rT.Kind() == reflect.Pointer { - rT = rT.Elem() - } - // Doesn't return the correct Name for generic types due to https://github.com/golang/go/issues/55924 - return rT.Name() -} diff --git a/vendor/github.com/cilium/ebpf/internal/pinning.go b/vendor/github.com/cilium/ebpf/internal/pinning.go deleted file mode 100644 index 01d892f93..000000000 --- a/vendor/github.com/cilium/ebpf/internal/pinning.go +++ /dev/null @@ -1,65 +0,0 @@ -package internal - -import ( - "errors" - "fmt" - "os" - "path/filepath" - "runtime" - - "github.com/cilium/ebpf/internal/sys" - "github.com/cilium/ebpf/internal/unix" -) - -func Pin(currentPath, newPath string, fd *sys.FD) error { - if newPath == "" { - return errors.New("given pinning path cannot be empty") - } - if currentPath == newPath { - return nil - } - - fsType, err := FSType(filepath.Dir(newPath)) - if err != nil { - return err - } - if fsType != unix.BPF_FS_MAGIC { - return fmt.Errorf("%s is not on a bpf filesystem", newPath) - } - - defer runtime.KeepAlive(fd) - - if currentPath == "" { - return sys.ObjPin(&sys.ObjPinAttr{ - Pathname: sys.NewStringPointer(newPath), - BpfFd: fd.Uint(), - }) - } - - // Renameat2 is used instead of os.Rename to disallow the new path replacing - // an existing path. - err = unix.Renameat2(unix.AT_FDCWD, currentPath, unix.AT_FDCWD, newPath, unix.RENAME_NOREPLACE) - if err == nil { - // Object is now moved to the new pinning path. - return nil - } - if !os.IsNotExist(err) { - return fmt.Errorf("unable to move pinned object to new path %v: %w", newPath, err) - } - // Internal state not in sync with the file system so let's fix it. - return sys.ObjPin(&sys.ObjPinAttr{ - Pathname: sys.NewStringPointer(newPath), - BpfFd: fd.Uint(), - }) -} - -func Unpin(pinnedPath string) error { - if pinnedPath == "" { - return nil - } - err := os.Remove(pinnedPath) - if err == nil || os.IsNotExist(err) { - return nil - } - return err -} diff --git a/vendor/github.com/cilium/ebpf/internal/platform.go b/vendor/github.com/cilium/ebpf/internal/platform.go deleted file mode 100644 index 6e90f2ef7..000000000 --- a/vendor/github.com/cilium/ebpf/internal/platform.go +++ /dev/null @@ -1,43 +0,0 @@ -package internal - -import ( - "runtime" -) - -// PlatformPrefix returns the platform-dependent syscall wrapper prefix used by -// the linux kernel. -// -// Based on https://github.com/golang/go/blob/master/src/go/build/syslist.go -// and https://github.com/libbpf/libbpf/blob/master/src/libbpf.c#L10047 -func PlatformPrefix() string { - switch runtime.GOARCH { - case "386": - return "__ia32_" - case "amd64", "amd64p32": - return "__x64_" - - case "arm", "armbe": - return "__arm_" - case "arm64", "arm64be": - return "__arm64_" - - case "mips", "mipsle", "mips64", "mips64le", "mips64p32", "mips64p32le": - return "__mips_" - - case "s390": - return "__s390_" - case "s390x": - return "__s390x_" - - case "riscv", "riscv64": - return "__riscv_" - - case "ppc": - return "__powerpc_" - case "ppc64", "ppc64le": - return "__powerpc64_" - - default: - return "" - } -} diff --git a/vendor/github.com/cilium/ebpf/internal/prog.go b/vendor/github.com/cilium/ebpf/internal/prog.go deleted file mode 100644 index d629145b6..000000000 --- a/vendor/github.com/cilium/ebpf/internal/prog.go +++ /dev/null @@ -1,11 +0,0 @@ -package internal - -// EmptyBPFContext is the smallest-possible BPF input context to be used for -// invoking `Program.{Run,Benchmark,Test}`. -// -// Programs require a context input buffer of at least 15 bytes. Looking in -// net/bpf/test_run.c, bpf_test_init() requires that the input is at least -// ETH_HLEN (14) bytes. As of Linux commit fd18942 ("bpf: Don't redirect packets -// with invalid pkt_len"), it also requires the skb to be non-empty after -// removing the Layer 2 header. -var EmptyBPFContext = make([]byte, 15) diff --git a/vendor/github.com/cilium/ebpf/internal/statfs.go b/vendor/github.com/cilium/ebpf/internal/statfs.go deleted file mode 100644 index 44c02d676..000000000 --- a/vendor/github.com/cilium/ebpf/internal/statfs.go +++ /dev/null @@ -1,23 +0,0 @@ -package internal - -import ( - "unsafe" - - "github.com/cilium/ebpf/internal/unix" -) - -func FSType(path string) (int64, error) { - var statfs unix.Statfs_t - if err := unix.Statfs(path, &statfs); err != nil { - return 0, err - } - - fsType := int64(statfs.Type) - if unsafe.Sizeof(statfs.Type) == 4 { - // We're on a 32 bit arch, where statfs.Type is int32. bpfFSType is a - // negative number when interpreted as int32 so we need to cast via - // uint32 to avoid sign extension. - fsType = int64(uint32(statfs.Type)) - } - return fsType, nil -} diff --git a/vendor/github.com/cilium/ebpf/internal/sys/doc.go b/vendor/github.com/cilium/ebpf/internal/sys/doc.go deleted file mode 100644 index dfe174448..000000000 --- a/vendor/github.com/cilium/ebpf/internal/sys/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Package sys contains bindings for the BPF syscall. -package sys - -// Regenerate types.go by invoking go generate in the current directory. - -//go:generate go run github.com/cilium/ebpf/internal/cmd/gentypes ../../btf/testdata/vmlinux.btf.gz diff --git a/vendor/github.com/cilium/ebpf/internal/sys/fd.go b/vendor/github.com/cilium/ebpf/internal/sys/fd.go deleted file mode 100644 index 941a56fb9..000000000 --- a/vendor/github.com/cilium/ebpf/internal/sys/fd.go +++ /dev/null @@ -1,133 +0,0 @@ -package sys - -import ( - "fmt" - "math" - "os" - "runtime" - "strconv" - - "github.com/cilium/ebpf/internal/unix" -) - -var ErrClosedFd = unix.EBADF - -type FD struct { - raw int -} - -func newFD(value int) *FD { - if onLeakFD != nil { - // Attempt to store the caller's stack for the given fd value. - // Panic if fds contains an existing stack for the fd. - old, exist := fds.LoadOrStore(value, callersFrames()) - if exist { - f := old.(*runtime.Frames) - panic(fmt.Sprintf("found existing stack for fd %d:\n%s", value, FormatFrames(f))) - } - } - - fd := &FD{value} - runtime.SetFinalizer(fd, (*FD).finalize) - return fd -} - -// finalize is set as the FD's runtime finalizer and -// sends a leak trace before calling FD.Close(). -func (fd *FD) finalize() { - if fd.raw < 0 { - return - } - - // Invoke the fd leak callback. Calls LoadAndDelete to guarantee the callback - // is invoked at most once for one sys.FD allocation, runtime.Frames can only - // be unwound once. - f, ok := fds.LoadAndDelete(fd.Int()) - if ok && onLeakFD != nil { - onLeakFD(f.(*runtime.Frames)) - } - - _ = fd.Close() -} - -// NewFD wraps a raw fd with a finalizer. -// -// You must not use the raw fd after calling this function, since the underlying -// file descriptor number may change. This is because the BPF UAPI assumes that -// zero is not a valid fd value. -func NewFD(value int) (*FD, error) { - if value < 0 { - return nil, fmt.Errorf("invalid fd %d", value) - } - - fd := newFD(value) - if value != 0 { - return fd, nil - } - - dup, err := fd.Dup() - _ = fd.Close() - return dup, err -} - -func (fd *FD) String() string { - return strconv.FormatInt(int64(fd.raw), 10) -} - -func (fd *FD) Int() int { - return fd.raw -} - -func (fd *FD) Uint() uint32 { - if fd.raw < 0 || int64(fd.raw) > math.MaxUint32 { - // Best effort: this is the number most likely to be an invalid file - // descriptor. It is equal to -1 (on two's complement arches). - return math.MaxUint32 - } - return uint32(fd.raw) -} - -func (fd *FD) Close() error { - if fd.raw < 0 { - return nil - } - - return unix.Close(fd.disown()) -} - -func (fd *FD) disown() int { - value := int(fd.raw) - fds.Delete(int(value)) - fd.raw = -1 - - runtime.SetFinalizer(fd, nil) - return value -} - -func (fd *FD) Dup() (*FD, error) { - if fd.raw < 0 { - return nil, ErrClosedFd - } - - // Always require the fd to be larger than zero: the BPF API treats the value - // as "no argument provided". - dup, err := unix.FcntlInt(uintptr(fd.raw), unix.F_DUPFD_CLOEXEC, 1) - if err != nil { - return nil, fmt.Errorf("can't dup fd: %v", err) - } - - return newFD(dup), nil -} - -// File takes ownership of FD and turns it into an [*os.File]. -// -// You must not use the FD after the call returns. -// -// Returns nil if the FD is not valid. -func (fd *FD) File(name string) *os.File { - if fd.raw < 0 { - return nil - } - - return os.NewFile(uintptr(fd.disown()), name) -} diff --git a/vendor/github.com/cilium/ebpf/internal/sys/fd_trace.go b/vendor/github.com/cilium/ebpf/internal/sys/fd_trace.go deleted file mode 100644 index cd50dd1f6..000000000 --- a/vendor/github.com/cilium/ebpf/internal/sys/fd_trace.go +++ /dev/null @@ -1,93 +0,0 @@ -package sys - -import ( - "bytes" - "fmt" - "runtime" - "sync" -) - -// OnLeakFD controls tracing [FD] lifetime to detect resources that are not -// closed by Close(). -// -// If fn is not nil, tracing is enabled for all FDs created going forward. fn is -// invoked for all FDs that are closed by the garbage collector instead of an -// explicit Close() by a caller. Calling OnLeakFD twice with a non-nil fn -// (without disabling tracing in the meantime) will cause a panic. -// -// If fn is nil, tracing will be disabled. Any FDs that have not been closed are -// considered to be leaked, fn will be invoked for them, and the process will be -// terminated. -// -// fn will be invoked at most once for every unique sys.FD allocation since a -// runtime.Frames can only be unwound once. -func OnLeakFD(fn func(*runtime.Frames)) { - // Enable leak tracing if new fn is provided. - if fn != nil { - if onLeakFD != nil { - panic("OnLeakFD called twice with non-nil fn") - } - - onLeakFD = fn - return - } - - // fn is nil past this point. - - if onLeakFD == nil { - return - } - - // Call onLeakFD for all open fds. - if fs := flushFrames(); len(fs) != 0 { - for _, f := range fs { - onLeakFD(f) - } - } - - onLeakFD = nil -} - -var onLeakFD func(*runtime.Frames) - -// fds is a registry of all file descriptors wrapped into sys.fds that were -// created while an fd tracer was active. -var fds sync.Map // map[int]*runtime.Frames - -// flushFrames removes all elements from fds and returns them as a slice. This -// deals with the fact that a runtime.Frames can only be unwound once using -// Next(). -func flushFrames() []*runtime.Frames { - var frames []*runtime.Frames - fds.Range(func(key, value any) bool { - frames = append(frames, value.(*runtime.Frames)) - fds.Delete(key) - return true - }) - return frames -} - -func callersFrames() *runtime.Frames { - c := make([]uintptr, 32) - - // Skip runtime.Callers and this function. - i := runtime.Callers(2, c) - if i == 0 { - return nil - } - - return runtime.CallersFrames(c) -} - -// FormatFrames formats a runtime.Frames as a human-readable string. -func FormatFrames(fs *runtime.Frames) string { - var b bytes.Buffer - for { - f, more := fs.Next() - b.WriteString(fmt.Sprintf("\t%s+%#x\n\t\t%s:%d\n", f.Function, f.PC-f.Entry, f.File, f.Line)) - if !more { - break - } - } - return b.String() -} diff --git a/vendor/github.com/cilium/ebpf/internal/sys/mapflags_string.go b/vendor/github.com/cilium/ebpf/internal/sys/mapflags_string.go deleted file mode 100644 index d9fe21722..000000000 --- a/vendor/github.com/cilium/ebpf/internal/sys/mapflags_string.go +++ /dev/null @@ -1,53 +0,0 @@ -// Code generated by "stringer -type MapFlags"; DO NOT EDIT. - -package sys - -import "strconv" - -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[BPF_F_NO_PREALLOC-1] - _ = x[BPF_F_NO_COMMON_LRU-2] - _ = x[BPF_F_NUMA_NODE-4] - _ = x[BPF_F_RDONLY-8] - _ = x[BPF_F_WRONLY-16] - _ = x[BPF_F_STACK_BUILD_ID-32] - _ = x[BPF_F_ZERO_SEED-64] - _ = x[BPF_F_RDONLY_PROG-128] - _ = x[BPF_F_WRONLY_PROG-256] - _ = x[BPF_F_CLONE-512] - _ = x[BPF_F_MMAPABLE-1024] - _ = x[BPF_F_PRESERVE_ELEMS-2048] - _ = x[BPF_F_INNER_MAP-4096] - _ = x[BPF_F_LINK-8192] - _ = x[BPF_F_PATH_FD-16384] -} - -const _MapFlags_name = "BPF_F_NO_PREALLOCBPF_F_NO_COMMON_LRUBPF_F_NUMA_NODEBPF_F_RDONLYBPF_F_WRONLYBPF_F_STACK_BUILD_IDBPF_F_ZERO_SEEDBPF_F_RDONLY_PROGBPF_F_WRONLY_PROGBPF_F_CLONEBPF_F_MMAPABLEBPF_F_PRESERVE_ELEMSBPF_F_INNER_MAPBPF_F_LINKBPF_F_PATH_FD" - -var _MapFlags_map = map[MapFlags]string{ - 1: _MapFlags_name[0:17], - 2: _MapFlags_name[17:36], - 4: _MapFlags_name[36:51], - 8: _MapFlags_name[51:63], - 16: _MapFlags_name[63:75], - 32: _MapFlags_name[75:95], - 64: _MapFlags_name[95:110], - 128: _MapFlags_name[110:127], - 256: _MapFlags_name[127:144], - 512: _MapFlags_name[144:155], - 1024: _MapFlags_name[155:169], - 2048: _MapFlags_name[169:189], - 4096: _MapFlags_name[189:204], - 8192: _MapFlags_name[204:214], - 16384: _MapFlags_name[214:227], -} - -func (i MapFlags) String() string { - if str, ok := _MapFlags_map[i]; ok { - return str - } - return "MapFlags(" + strconv.FormatInt(int64(i), 10) + ")" -} diff --git a/vendor/github.com/cilium/ebpf/internal/sys/ptr.go b/vendor/github.com/cilium/ebpf/internal/sys/ptr.go deleted file mode 100644 index e9bb59059..000000000 --- a/vendor/github.com/cilium/ebpf/internal/sys/ptr.go +++ /dev/null @@ -1,52 +0,0 @@ -package sys - -import ( - "unsafe" - - "github.com/cilium/ebpf/internal/unix" -) - -// NewPointer creates a 64-bit pointer from an unsafe Pointer. -func NewPointer(ptr unsafe.Pointer) Pointer { - return Pointer{ptr: ptr} -} - -// NewSlicePointer creates a 64-bit pointer from a byte slice. -func NewSlicePointer(buf []byte) Pointer { - if len(buf) == 0 { - return Pointer{} - } - - return Pointer{ptr: unsafe.Pointer(&buf[0])} -} - -// NewSlicePointerLen creates a 64-bit pointer from a byte slice. -// -// Useful to assign both the pointer and the length in one go. -func NewSlicePointerLen(buf []byte) (Pointer, uint32) { - return NewSlicePointer(buf), uint32(len(buf)) -} - -// NewStringPointer creates a 64-bit pointer from a string. -func NewStringPointer(str string) Pointer { - p, err := unix.BytePtrFromString(str) - if err != nil { - return Pointer{} - } - - return Pointer{ptr: unsafe.Pointer(p)} -} - -// NewStringSlicePointer allocates an array of Pointers to each string in the -// given slice of strings and returns a 64-bit pointer to the start of the -// resulting array. -// -// Use this function to pass arrays of strings as syscall arguments. -func NewStringSlicePointer(strings []string) Pointer { - sp := make([]Pointer, 0, len(strings)) - for _, s := range strings { - sp = append(sp, NewStringPointer(s)) - } - - return Pointer{ptr: unsafe.Pointer(&sp[0])} -} diff --git a/vendor/github.com/cilium/ebpf/internal/sys/ptr_32_be.go b/vendor/github.com/cilium/ebpf/internal/sys/ptr_32_be.go deleted file mode 100644 index 6278c79c9..000000000 --- a/vendor/github.com/cilium/ebpf/internal/sys/ptr_32_be.go +++ /dev/null @@ -1,14 +0,0 @@ -//go:build armbe || mips || mips64p32 - -package sys - -import ( - "unsafe" -) - -// Pointer wraps an unsafe.Pointer to be 64bit to -// conform to the syscall specification. -type Pointer struct { - pad uint32 - ptr unsafe.Pointer -} diff --git a/vendor/github.com/cilium/ebpf/internal/sys/ptr_32_le.go b/vendor/github.com/cilium/ebpf/internal/sys/ptr_32_le.go deleted file mode 100644 index c27b537e8..000000000 --- a/vendor/github.com/cilium/ebpf/internal/sys/ptr_32_le.go +++ /dev/null @@ -1,14 +0,0 @@ -//go:build 386 || amd64p32 || arm || mipsle || mips64p32le - -package sys - -import ( - "unsafe" -) - -// Pointer wraps an unsafe.Pointer to be 64bit to -// conform to the syscall specification. -type Pointer struct { - ptr unsafe.Pointer - pad uint32 -} diff --git a/vendor/github.com/cilium/ebpf/internal/sys/ptr_64.go b/vendor/github.com/cilium/ebpf/internal/sys/ptr_64.go deleted file mode 100644 index 2d7828230..000000000 --- a/vendor/github.com/cilium/ebpf/internal/sys/ptr_64.go +++ /dev/null @@ -1,13 +0,0 @@ -//go:build !386 && !amd64p32 && !arm && !mipsle && !mips64p32le && !armbe && !mips && !mips64p32 - -package sys - -import ( - "unsafe" -) - -// Pointer wraps an unsafe.Pointer to be 64bit to -// conform to the syscall specification. -type Pointer struct { - ptr unsafe.Pointer -} diff --git a/vendor/github.com/cilium/ebpf/internal/sys/signals.go b/vendor/github.com/cilium/ebpf/internal/sys/signals.go deleted file mode 100644 index e5337191d..000000000 --- a/vendor/github.com/cilium/ebpf/internal/sys/signals.go +++ /dev/null @@ -1,83 +0,0 @@ -package sys - -import ( - "fmt" - "runtime" - "unsafe" - - "github.com/cilium/ebpf/internal/unix" -) - -// A sigset containing only SIGPROF. -var profSet unix.Sigset_t - -func init() { - // See sigsetAdd for details on the implementation. Open coded here so - // that the compiler will check the constant calculations for us. - profSet.Val[sigprofBit/wordBits] |= 1 << (sigprofBit % wordBits) -} - -// maskProfilerSignal locks the calling goroutine to its underlying OS thread -// and adds SIGPROF to the thread's signal mask. This prevents pprof from -// interrupting expensive syscalls like e.g. BPF_PROG_LOAD. -// -// The caller must defer unmaskProfilerSignal() to reverse the operation. -func maskProfilerSignal() { - runtime.LockOSThread() - - if err := unix.PthreadSigmask(unix.SIG_BLOCK, &profSet, nil); err != nil { - runtime.UnlockOSThread() - panic(fmt.Errorf("masking profiler signal: %w", err)) - } -} - -// unmaskProfilerSignal removes SIGPROF from the underlying thread's signal -// mask, allowing it to be interrupted for profiling once again. -// -// It also unlocks the current goroutine from its underlying OS thread. -func unmaskProfilerSignal() { - defer runtime.UnlockOSThread() - - if err := unix.PthreadSigmask(unix.SIG_UNBLOCK, &profSet, nil); err != nil { - panic(fmt.Errorf("unmasking profiler signal: %w", err)) - } -} - -const ( - // Signal is the nth bit in the bitfield. - sigprofBit = int(unix.SIGPROF - 1) - // The number of bits in one Sigset_t word. - wordBits = int(unsafe.Sizeof(unix.Sigset_t{}.Val[0])) * 8 -) - -// sigsetAdd adds signal to set. -// -// Note: Sigset_t.Val's value type is uint32 or uint64 depending on the arch. -// This function must be able to deal with both and so must avoid any direct -// references to u32 or u64 types. -func sigsetAdd(set *unix.Sigset_t, signal unix.Signal) error { - if signal < 1 { - return fmt.Errorf("signal %d must be larger than 0", signal) - } - - // For amd64, runtime.sigaddset() performs the following operation: - // set[(signal-1)/32] |= 1 << ((uint32(signal) - 1) & 31) - // - // This trick depends on sigset being two u32's, causing a signal in the - // bottom 31 bits to be written to the low word if bit 32 is low, or the high - // word if bit 32 is high. - - // Signal is the nth bit in the bitfield. - bit := int(signal - 1) - // Word within the sigset the bit needs to be written to. - word := bit / wordBits - - if word >= len(set.Val) { - return fmt.Errorf("signal %d does not fit within unix.Sigset_t", signal) - } - - // Write the signal bit into its corresponding word at the corrected offset. - set.Val[word] |= 1 << (bit % wordBits) - - return nil -} diff --git a/vendor/github.com/cilium/ebpf/internal/sys/syscall.go b/vendor/github.com/cilium/ebpf/internal/sys/syscall.go deleted file mode 100644 index f6b6e9345..000000000 --- a/vendor/github.com/cilium/ebpf/internal/sys/syscall.go +++ /dev/null @@ -1,229 +0,0 @@ -package sys - -import ( - "runtime" - "syscall" - "unsafe" - - "github.com/cilium/ebpf/internal/unix" -) - -// ENOTSUPP is a Linux internal error code that has leaked into UAPI. -// -// It is not the same as ENOTSUP or EOPNOTSUPP. -const ENOTSUPP = syscall.Errno(524) - -// BPF wraps SYS_BPF. -// -// Any pointers contained in attr must use the Pointer type from this package. -func BPF(cmd Cmd, attr unsafe.Pointer, size uintptr) (uintptr, error) { - // Prevent the Go profiler from repeatedly interrupting the verifier, - // which could otherwise lead to a livelock due to receiving EAGAIN. - if cmd == BPF_PROG_LOAD || cmd == BPF_PROG_RUN { - maskProfilerSignal() - defer unmaskProfilerSignal() - } - - for { - r1, _, errNo := unix.Syscall(unix.SYS_BPF, uintptr(cmd), uintptr(attr), size) - runtime.KeepAlive(attr) - - // As of ~4.20 the verifier can be interrupted by a signal, - // and returns EAGAIN in that case. - if errNo == unix.EAGAIN && cmd == BPF_PROG_LOAD { - continue - } - - var err error - if errNo != 0 { - err = wrappedErrno{errNo} - } - - return r1, err - } -} - -// Info is implemented by all structs that can be passed to the ObjInfo syscall. -// -// MapInfo -// ProgInfo -// LinkInfo -// BtfInfo -type Info interface { - info() (unsafe.Pointer, uint32) -} - -var _ Info = (*MapInfo)(nil) - -func (i *MapInfo) info() (unsafe.Pointer, uint32) { - return unsafe.Pointer(i), uint32(unsafe.Sizeof(*i)) -} - -var _ Info = (*ProgInfo)(nil) - -func (i *ProgInfo) info() (unsafe.Pointer, uint32) { - return unsafe.Pointer(i), uint32(unsafe.Sizeof(*i)) -} - -var _ Info = (*LinkInfo)(nil) - -func (i *LinkInfo) info() (unsafe.Pointer, uint32) { - return unsafe.Pointer(i), uint32(unsafe.Sizeof(*i)) -} - -func (i *TracingLinkInfo) info() (unsafe.Pointer, uint32) { - return unsafe.Pointer(i), uint32(unsafe.Sizeof(*i)) -} - -func (i *CgroupLinkInfo) info() (unsafe.Pointer, uint32) { - return unsafe.Pointer(i), uint32(unsafe.Sizeof(*i)) -} - -func (i *NetNsLinkInfo) info() (unsafe.Pointer, uint32) { - return unsafe.Pointer(i), uint32(unsafe.Sizeof(*i)) -} - -func (i *XDPLinkInfo) info() (unsafe.Pointer, uint32) { - return unsafe.Pointer(i), uint32(unsafe.Sizeof(*i)) -} - -func (i *TcxLinkInfo) info() (unsafe.Pointer, uint32) { - return unsafe.Pointer(i), uint32(unsafe.Sizeof(*i)) -} - -func (i *NetfilterLinkInfo) info() (unsafe.Pointer, uint32) { - return unsafe.Pointer(i), uint32(unsafe.Sizeof(*i)) -} - -func (i *NetkitLinkInfo) info() (unsafe.Pointer, uint32) { - return unsafe.Pointer(i), uint32(unsafe.Sizeof(*i)) -} - -func (i *KprobeMultiLinkInfo) info() (unsafe.Pointer, uint32) { - return unsafe.Pointer(i), uint32(unsafe.Sizeof(*i)) -} - -func (i *KprobeLinkInfo) info() (unsafe.Pointer, uint32) { - return unsafe.Pointer(i), uint32(unsafe.Sizeof(*i)) -} - -var _ Info = (*BtfInfo)(nil) - -func (i *BtfInfo) info() (unsafe.Pointer, uint32) { - return unsafe.Pointer(i), uint32(unsafe.Sizeof(*i)) -} - -func (i *PerfEventLinkInfo) info() (unsafe.Pointer, uint32) { - return unsafe.Pointer(i), uint32(unsafe.Sizeof(*i)) -} - -// ObjInfo retrieves information about a BPF Fd. -// -// info may be one of MapInfo, ProgInfo, LinkInfo and BtfInfo. -func ObjInfo(fd *FD, info Info) error { - ptr, len := info.info() - err := ObjGetInfoByFd(&ObjGetInfoByFdAttr{ - BpfFd: fd.Uint(), - InfoLen: len, - Info: NewPointer(ptr), - }) - runtime.KeepAlive(fd) - return err -} - -// BPFObjName is a null-terminated string made up of -// 'A-Za-z0-9_' characters. -type ObjName [unix.BPF_OBJ_NAME_LEN]byte - -// NewObjName truncates the result if it is too long. -func NewObjName(name string) ObjName { - var result ObjName - copy(result[:unix.BPF_OBJ_NAME_LEN-1], name) - return result -} - -// LogLevel controls the verbosity of the kernel's eBPF program verifier. -type LogLevel uint32 - -const ( - BPF_LOG_LEVEL1 LogLevel = 1 << iota - BPF_LOG_LEVEL2 - BPF_LOG_STATS -) - -// LinkID uniquely identifies a bpf_link. -type LinkID uint32 - -// BTFID uniquely identifies a BTF blob loaded into the kernel. -type BTFID uint32 - -// TypeID identifies a type in a BTF blob. -type TypeID uint32 - -// MapFlags control map behaviour. -type MapFlags uint32 - -//go:generate go run golang.org/x/tools/cmd/stringer@latest -type MapFlags - -const ( - BPF_F_NO_PREALLOC MapFlags = 1 << iota - BPF_F_NO_COMMON_LRU - BPF_F_NUMA_NODE - BPF_F_RDONLY - BPF_F_WRONLY - BPF_F_STACK_BUILD_ID - BPF_F_ZERO_SEED - BPF_F_RDONLY_PROG - BPF_F_WRONLY_PROG - BPF_F_CLONE - BPF_F_MMAPABLE - BPF_F_PRESERVE_ELEMS - BPF_F_INNER_MAP - BPF_F_LINK - BPF_F_PATH_FD -) - -// Flags used by bpf_mprog. -const ( - BPF_F_REPLACE = 1 << (iota + 2) - BPF_F_BEFORE - BPF_F_AFTER - BPF_F_ID - BPF_F_LINK_MPROG = 1 << 13 // aka BPF_F_LINK -) - -// wrappedErrno wraps syscall.Errno to prevent direct comparisons with -// syscall.E* or unix.E* constants. -// -// You should never export an error of this type. -type wrappedErrno struct { - syscall.Errno -} - -func (we wrappedErrno) Unwrap() error { - return we.Errno -} - -func (we wrappedErrno) Error() string { - if we.Errno == ENOTSUPP { - return "operation not supported" - } - return we.Errno.Error() -} - -type syscallError struct { - error - errno syscall.Errno -} - -func Error(err error, errno syscall.Errno) error { - return &syscallError{err, errno} -} - -func (se *syscallError) Is(target error) bool { - return target == se.error -} - -func (se *syscallError) Unwrap() error { - return se.errno -} diff --git a/vendor/github.com/cilium/ebpf/internal/sys/types.go b/vendor/github.com/cilium/ebpf/internal/sys/types.go deleted file mode 100644 index d2ae94266..000000000 --- a/vendor/github.com/cilium/ebpf/internal/sys/types.go +++ /dev/null @@ -1,1382 +0,0 @@ -// Code generated by internal/cmd/gentypes; DO NOT EDIT. - -package sys - -import ( - "unsafe" -) - -type AdjRoomMode uint32 - -const ( - BPF_ADJ_ROOM_NET AdjRoomMode = 0 - BPF_ADJ_ROOM_MAC AdjRoomMode = 1 -) - -type AttachType uint32 - -const ( - BPF_CGROUP_INET_INGRESS AttachType = 0 - BPF_CGROUP_INET_EGRESS AttachType = 1 - BPF_CGROUP_INET_SOCK_CREATE AttachType = 2 - BPF_CGROUP_SOCK_OPS AttachType = 3 - BPF_SK_SKB_STREAM_PARSER AttachType = 4 - BPF_SK_SKB_STREAM_VERDICT AttachType = 5 - BPF_CGROUP_DEVICE AttachType = 6 - BPF_SK_MSG_VERDICT AttachType = 7 - BPF_CGROUP_INET4_BIND AttachType = 8 - BPF_CGROUP_INET6_BIND AttachType = 9 - BPF_CGROUP_INET4_CONNECT AttachType = 10 - BPF_CGROUP_INET6_CONNECT AttachType = 11 - BPF_CGROUP_INET4_POST_BIND AttachType = 12 - BPF_CGROUP_INET6_POST_BIND AttachType = 13 - BPF_CGROUP_UDP4_SENDMSG AttachType = 14 - BPF_CGROUP_UDP6_SENDMSG AttachType = 15 - BPF_LIRC_MODE2 AttachType = 16 - BPF_FLOW_DISSECTOR AttachType = 17 - BPF_CGROUP_SYSCTL AttachType = 18 - BPF_CGROUP_UDP4_RECVMSG AttachType = 19 - BPF_CGROUP_UDP6_RECVMSG AttachType = 20 - BPF_CGROUP_GETSOCKOPT AttachType = 21 - BPF_CGROUP_SETSOCKOPT AttachType = 22 - BPF_TRACE_RAW_TP AttachType = 23 - BPF_TRACE_FENTRY AttachType = 24 - BPF_TRACE_FEXIT AttachType = 25 - BPF_MODIFY_RETURN AttachType = 26 - BPF_LSM_MAC AttachType = 27 - BPF_TRACE_ITER AttachType = 28 - BPF_CGROUP_INET4_GETPEERNAME AttachType = 29 - BPF_CGROUP_INET6_GETPEERNAME AttachType = 30 - BPF_CGROUP_INET4_GETSOCKNAME AttachType = 31 - BPF_CGROUP_INET6_GETSOCKNAME AttachType = 32 - BPF_XDP_DEVMAP AttachType = 33 - BPF_CGROUP_INET_SOCK_RELEASE AttachType = 34 - BPF_XDP_CPUMAP AttachType = 35 - BPF_SK_LOOKUP AttachType = 36 - BPF_XDP AttachType = 37 - BPF_SK_SKB_VERDICT AttachType = 38 - BPF_SK_REUSEPORT_SELECT AttachType = 39 - BPF_SK_REUSEPORT_SELECT_OR_MIGRATE AttachType = 40 - BPF_PERF_EVENT AttachType = 41 - BPF_TRACE_KPROBE_MULTI AttachType = 42 - BPF_LSM_CGROUP AttachType = 43 - BPF_STRUCT_OPS AttachType = 44 - BPF_NETFILTER AttachType = 45 - BPF_TCX_INGRESS AttachType = 46 - BPF_TCX_EGRESS AttachType = 47 - BPF_TRACE_UPROBE_MULTI AttachType = 48 - BPF_CGROUP_UNIX_CONNECT AttachType = 49 - BPF_CGROUP_UNIX_SENDMSG AttachType = 50 - BPF_CGROUP_UNIX_RECVMSG AttachType = 51 - BPF_CGROUP_UNIX_GETPEERNAME AttachType = 52 - BPF_CGROUP_UNIX_GETSOCKNAME AttachType = 53 - BPF_NETKIT_PRIMARY AttachType = 54 - BPF_NETKIT_PEER AttachType = 55 - __MAX_BPF_ATTACH_TYPE AttachType = 56 -) - -type Cmd uint32 - -const ( - BPF_MAP_CREATE Cmd = 0 - BPF_MAP_LOOKUP_ELEM Cmd = 1 - BPF_MAP_UPDATE_ELEM Cmd = 2 - BPF_MAP_DELETE_ELEM Cmd = 3 - BPF_MAP_GET_NEXT_KEY Cmd = 4 - BPF_PROG_LOAD Cmd = 5 - BPF_OBJ_PIN Cmd = 6 - BPF_OBJ_GET Cmd = 7 - BPF_PROG_ATTACH Cmd = 8 - BPF_PROG_DETACH Cmd = 9 - BPF_PROG_TEST_RUN Cmd = 10 - BPF_PROG_RUN Cmd = 10 - BPF_PROG_GET_NEXT_ID Cmd = 11 - BPF_MAP_GET_NEXT_ID Cmd = 12 - BPF_PROG_GET_FD_BY_ID Cmd = 13 - BPF_MAP_GET_FD_BY_ID Cmd = 14 - BPF_OBJ_GET_INFO_BY_FD Cmd = 15 - BPF_PROG_QUERY Cmd = 16 - BPF_RAW_TRACEPOINT_OPEN Cmd = 17 - BPF_BTF_LOAD Cmd = 18 - BPF_BTF_GET_FD_BY_ID Cmd = 19 - BPF_TASK_FD_QUERY Cmd = 20 - BPF_MAP_LOOKUP_AND_DELETE_ELEM Cmd = 21 - BPF_MAP_FREEZE Cmd = 22 - BPF_BTF_GET_NEXT_ID Cmd = 23 - BPF_MAP_LOOKUP_BATCH Cmd = 24 - BPF_MAP_LOOKUP_AND_DELETE_BATCH Cmd = 25 - BPF_MAP_UPDATE_BATCH Cmd = 26 - BPF_MAP_DELETE_BATCH Cmd = 27 - BPF_LINK_CREATE Cmd = 28 - BPF_LINK_UPDATE Cmd = 29 - BPF_LINK_GET_FD_BY_ID Cmd = 30 - BPF_LINK_GET_NEXT_ID Cmd = 31 - BPF_ENABLE_STATS Cmd = 32 - BPF_ITER_CREATE Cmd = 33 - BPF_LINK_DETACH Cmd = 34 - BPF_PROG_BIND_MAP Cmd = 35 -) - -type FunctionId uint32 - -const ( - BPF_FUNC_unspec FunctionId = 0 - BPF_FUNC_map_lookup_elem FunctionId = 1 - BPF_FUNC_map_update_elem FunctionId = 2 - BPF_FUNC_map_delete_elem FunctionId = 3 - BPF_FUNC_probe_read FunctionId = 4 - BPF_FUNC_ktime_get_ns FunctionId = 5 - BPF_FUNC_trace_printk FunctionId = 6 - BPF_FUNC_get_prandom_u32 FunctionId = 7 - BPF_FUNC_get_smp_processor_id FunctionId = 8 - BPF_FUNC_skb_store_bytes FunctionId = 9 - BPF_FUNC_l3_csum_replace FunctionId = 10 - BPF_FUNC_l4_csum_replace FunctionId = 11 - BPF_FUNC_tail_call FunctionId = 12 - BPF_FUNC_clone_redirect FunctionId = 13 - BPF_FUNC_get_current_pid_tgid FunctionId = 14 - BPF_FUNC_get_current_uid_gid FunctionId = 15 - BPF_FUNC_get_current_comm FunctionId = 16 - BPF_FUNC_get_cgroup_classid FunctionId = 17 - BPF_FUNC_skb_vlan_push FunctionId = 18 - BPF_FUNC_skb_vlan_pop FunctionId = 19 - BPF_FUNC_skb_get_tunnel_key FunctionId = 20 - BPF_FUNC_skb_set_tunnel_key FunctionId = 21 - BPF_FUNC_perf_event_read FunctionId = 22 - BPF_FUNC_redirect FunctionId = 23 - BPF_FUNC_get_route_realm FunctionId = 24 - BPF_FUNC_perf_event_output FunctionId = 25 - BPF_FUNC_skb_load_bytes FunctionId = 26 - BPF_FUNC_get_stackid FunctionId = 27 - BPF_FUNC_csum_diff FunctionId = 28 - BPF_FUNC_skb_get_tunnel_opt FunctionId = 29 - BPF_FUNC_skb_set_tunnel_opt FunctionId = 30 - BPF_FUNC_skb_change_proto FunctionId = 31 - BPF_FUNC_skb_change_type FunctionId = 32 - BPF_FUNC_skb_under_cgroup FunctionId = 33 - BPF_FUNC_get_hash_recalc FunctionId = 34 - BPF_FUNC_get_current_task FunctionId = 35 - BPF_FUNC_probe_write_user FunctionId = 36 - BPF_FUNC_current_task_under_cgroup FunctionId = 37 - BPF_FUNC_skb_change_tail FunctionId = 38 - BPF_FUNC_skb_pull_data FunctionId = 39 - BPF_FUNC_csum_update FunctionId = 40 - BPF_FUNC_set_hash_invalid FunctionId = 41 - BPF_FUNC_get_numa_node_id FunctionId = 42 - BPF_FUNC_skb_change_head FunctionId = 43 - BPF_FUNC_xdp_adjust_head FunctionId = 44 - BPF_FUNC_probe_read_str FunctionId = 45 - BPF_FUNC_get_socket_cookie FunctionId = 46 - BPF_FUNC_get_socket_uid FunctionId = 47 - BPF_FUNC_set_hash FunctionId = 48 - BPF_FUNC_setsockopt FunctionId = 49 - BPF_FUNC_skb_adjust_room FunctionId = 50 - BPF_FUNC_redirect_map FunctionId = 51 - BPF_FUNC_sk_redirect_map FunctionId = 52 - BPF_FUNC_sock_map_update FunctionId = 53 - BPF_FUNC_xdp_adjust_meta FunctionId = 54 - BPF_FUNC_perf_event_read_value FunctionId = 55 - BPF_FUNC_perf_prog_read_value FunctionId = 56 - BPF_FUNC_getsockopt FunctionId = 57 - BPF_FUNC_override_return FunctionId = 58 - BPF_FUNC_sock_ops_cb_flags_set FunctionId = 59 - BPF_FUNC_msg_redirect_map FunctionId = 60 - BPF_FUNC_msg_apply_bytes FunctionId = 61 - BPF_FUNC_msg_cork_bytes FunctionId = 62 - BPF_FUNC_msg_pull_data FunctionId = 63 - BPF_FUNC_bind FunctionId = 64 - BPF_FUNC_xdp_adjust_tail FunctionId = 65 - BPF_FUNC_skb_get_xfrm_state FunctionId = 66 - BPF_FUNC_get_stack FunctionId = 67 - BPF_FUNC_skb_load_bytes_relative FunctionId = 68 - BPF_FUNC_fib_lookup FunctionId = 69 - BPF_FUNC_sock_hash_update FunctionId = 70 - BPF_FUNC_msg_redirect_hash FunctionId = 71 - BPF_FUNC_sk_redirect_hash FunctionId = 72 - BPF_FUNC_lwt_push_encap FunctionId = 73 - BPF_FUNC_lwt_seg6_store_bytes FunctionId = 74 - BPF_FUNC_lwt_seg6_adjust_srh FunctionId = 75 - BPF_FUNC_lwt_seg6_action FunctionId = 76 - BPF_FUNC_rc_repeat FunctionId = 77 - BPF_FUNC_rc_keydown FunctionId = 78 - BPF_FUNC_skb_cgroup_id FunctionId = 79 - BPF_FUNC_get_current_cgroup_id FunctionId = 80 - BPF_FUNC_get_local_storage FunctionId = 81 - BPF_FUNC_sk_select_reuseport FunctionId = 82 - BPF_FUNC_skb_ancestor_cgroup_id FunctionId = 83 - BPF_FUNC_sk_lookup_tcp FunctionId = 84 - BPF_FUNC_sk_lookup_udp FunctionId = 85 - BPF_FUNC_sk_release FunctionId = 86 - BPF_FUNC_map_push_elem FunctionId = 87 - BPF_FUNC_map_pop_elem FunctionId = 88 - BPF_FUNC_map_peek_elem FunctionId = 89 - BPF_FUNC_msg_push_data FunctionId = 90 - BPF_FUNC_msg_pop_data FunctionId = 91 - BPF_FUNC_rc_pointer_rel FunctionId = 92 - BPF_FUNC_spin_lock FunctionId = 93 - BPF_FUNC_spin_unlock FunctionId = 94 - BPF_FUNC_sk_fullsock FunctionId = 95 - BPF_FUNC_tcp_sock FunctionId = 96 - BPF_FUNC_skb_ecn_set_ce FunctionId = 97 - BPF_FUNC_get_listener_sock FunctionId = 98 - BPF_FUNC_skc_lookup_tcp FunctionId = 99 - BPF_FUNC_tcp_check_syncookie FunctionId = 100 - BPF_FUNC_sysctl_get_name FunctionId = 101 - BPF_FUNC_sysctl_get_current_value FunctionId = 102 - BPF_FUNC_sysctl_get_new_value FunctionId = 103 - BPF_FUNC_sysctl_set_new_value FunctionId = 104 - BPF_FUNC_strtol FunctionId = 105 - BPF_FUNC_strtoul FunctionId = 106 - BPF_FUNC_sk_storage_get FunctionId = 107 - BPF_FUNC_sk_storage_delete FunctionId = 108 - BPF_FUNC_send_signal FunctionId = 109 - BPF_FUNC_tcp_gen_syncookie FunctionId = 110 - BPF_FUNC_skb_output FunctionId = 111 - BPF_FUNC_probe_read_user FunctionId = 112 - BPF_FUNC_probe_read_kernel FunctionId = 113 - BPF_FUNC_probe_read_user_str FunctionId = 114 - BPF_FUNC_probe_read_kernel_str FunctionId = 115 - BPF_FUNC_tcp_send_ack FunctionId = 116 - BPF_FUNC_send_signal_thread FunctionId = 117 - BPF_FUNC_jiffies64 FunctionId = 118 - BPF_FUNC_read_branch_records FunctionId = 119 - BPF_FUNC_get_ns_current_pid_tgid FunctionId = 120 - BPF_FUNC_xdp_output FunctionId = 121 - BPF_FUNC_get_netns_cookie FunctionId = 122 - BPF_FUNC_get_current_ancestor_cgroup_id FunctionId = 123 - BPF_FUNC_sk_assign FunctionId = 124 - BPF_FUNC_ktime_get_boot_ns FunctionId = 125 - BPF_FUNC_seq_printf FunctionId = 126 - BPF_FUNC_seq_write FunctionId = 127 - BPF_FUNC_sk_cgroup_id FunctionId = 128 - BPF_FUNC_sk_ancestor_cgroup_id FunctionId = 129 - BPF_FUNC_ringbuf_output FunctionId = 130 - BPF_FUNC_ringbuf_reserve FunctionId = 131 - BPF_FUNC_ringbuf_submit FunctionId = 132 - BPF_FUNC_ringbuf_discard FunctionId = 133 - BPF_FUNC_ringbuf_query FunctionId = 134 - BPF_FUNC_csum_level FunctionId = 135 - BPF_FUNC_skc_to_tcp6_sock FunctionId = 136 - BPF_FUNC_skc_to_tcp_sock FunctionId = 137 - BPF_FUNC_skc_to_tcp_timewait_sock FunctionId = 138 - BPF_FUNC_skc_to_tcp_request_sock FunctionId = 139 - BPF_FUNC_skc_to_udp6_sock FunctionId = 140 - BPF_FUNC_get_task_stack FunctionId = 141 - BPF_FUNC_load_hdr_opt FunctionId = 142 - BPF_FUNC_store_hdr_opt FunctionId = 143 - BPF_FUNC_reserve_hdr_opt FunctionId = 144 - BPF_FUNC_inode_storage_get FunctionId = 145 - BPF_FUNC_inode_storage_delete FunctionId = 146 - BPF_FUNC_d_path FunctionId = 147 - BPF_FUNC_copy_from_user FunctionId = 148 - BPF_FUNC_snprintf_btf FunctionId = 149 - BPF_FUNC_seq_printf_btf FunctionId = 150 - BPF_FUNC_skb_cgroup_classid FunctionId = 151 - BPF_FUNC_redirect_neigh FunctionId = 152 - BPF_FUNC_per_cpu_ptr FunctionId = 153 - BPF_FUNC_this_cpu_ptr FunctionId = 154 - BPF_FUNC_redirect_peer FunctionId = 155 - BPF_FUNC_task_storage_get FunctionId = 156 - BPF_FUNC_task_storage_delete FunctionId = 157 - BPF_FUNC_get_current_task_btf FunctionId = 158 - BPF_FUNC_bprm_opts_set FunctionId = 159 - BPF_FUNC_ktime_get_coarse_ns FunctionId = 160 - BPF_FUNC_ima_inode_hash FunctionId = 161 - BPF_FUNC_sock_from_file FunctionId = 162 - BPF_FUNC_check_mtu FunctionId = 163 - BPF_FUNC_for_each_map_elem FunctionId = 164 - BPF_FUNC_snprintf FunctionId = 165 - BPF_FUNC_sys_bpf FunctionId = 166 - BPF_FUNC_btf_find_by_name_kind FunctionId = 167 - BPF_FUNC_sys_close FunctionId = 168 - BPF_FUNC_timer_init FunctionId = 169 - BPF_FUNC_timer_set_callback FunctionId = 170 - BPF_FUNC_timer_start FunctionId = 171 - BPF_FUNC_timer_cancel FunctionId = 172 - BPF_FUNC_get_func_ip FunctionId = 173 - BPF_FUNC_get_attach_cookie FunctionId = 174 - BPF_FUNC_task_pt_regs FunctionId = 175 - BPF_FUNC_get_branch_snapshot FunctionId = 176 - BPF_FUNC_trace_vprintk FunctionId = 177 - BPF_FUNC_skc_to_unix_sock FunctionId = 178 - BPF_FUNC_kallsyms_lookup_name FunctionId = 179 - BPF_FUNC_find_vma FunctionId = 180 - BPF_FUNC_loop FunctionId = 181 - BPF_FUNC_strncmp FunctionId = 182 - BPF_FUNC_get_func_arg FunctionId = 183 - BPF_FUNC_get_func_ret FunctionId = 184 - BPF_FUNC_get_func_arg_cnt FunctionId = 185 - BPF_FUNC_get_retval FunctionId = 186 - BPF_FUNC_set_retval FunctionId = 187 - BPF_FUNC_xdp_get_buff_len FunctionId = 188 - BPF_FUNC_xdp_load_bytes FunctionId = 189 - BPF_FUNC_xdp_store_bytes FunctionId = 190 - BPF_FUNC_copy_from_user_task FunctionId = 191 - BPF_FUNC_skb_set_tstamp FunctionId = 192 - BPF_FUNC_ima_file_hash FunctionId = 193 - BPF_FUNC_kptr_xchg FunctionId = 194 - BPF_FUNC_map_lookup_percpu_elem FunctionId = 195 - BPF_FUNC_skc_to_mptcp_sock FunctionId = 196 - BPF_FUNC_dynptr_from_mem FunctionId = 197 - BPF_FUNC_ringbuf_reserve_dynptr FunctionId = 198 - BPF_FUNC_ringbuf_submit_dynptr FunctionId = 199 - BPF_FUNC_ringbuf_discard_dynptr FunctionId = 200 - BPF_FUNC_dynptr_read FunctionId = 201 - BPF_FUNC_dynptr_write FunctionId = 202 - BPF_FUNC_dynptr_data FunctionId = 203 - BPF_FUNC_tcp_raw_gen_syncookie_ipv4 FunctionId = 204 - BPF_FUNC_tcp_raw_gen_syncookie_ipv6 FunctionId = 205 - BPF_FUNC_tcp_raw_check_syncookie_ipv4 FunctionId = 206 - BPF_FUNC_tcp_raw_check_syncookie_ipv6 FunctionId = 207 - BPF_FUNC_ktime_get_tai_ns FunctionId = 208 - BPF_FUNC_user_ringbuf_drain FunctionId = 209 - BPF_FUNC_cgrp_storage_get FunctionId = 210 - BPF_FUNC_cgrp_storage_delete FunctionId = 211 - __BPF_FUNC_MAX_ID FunctionId = 212 -) - -type HdrStartOff uint32 - -const ( - BPF_HDR_START_MAC HdrStartOff = 0 - BPF_HDR_START_NET HdrStartOff = 1 -) - -type LinkType uint32 - -const ( - BPF_LINK_TYPE_UNSPEC LinkType = 0 - BPF_LINK_TYPE_RAW_TRACEPOINT LinkType = 1 - BPF_LINK_TYPE_TRACING LinkType = 2 - BPF_LINK_TYPE_CGROUP LinkType = 3 - BPF_LINK_TYPE_ITER LinkType = 4 - BPF_LINK_TYPE_NETNS LinkType = 5 - BPF_LINK_TYPE_XDP LinkType = 6 - BPF_LINK_TYPE_PERF_EVENT LinkType = 7 - BPF_LINK_TYPE_KPROBE_MULTI LinkType = 8 - BPF_LINK_TYPE_STRUCT_OPS LinkType = 9 - BPF_LINK_TYPE_NETFILTER LinkType = 10 - BPF_LINK_TYPE_TCX LinkType = 11 - BPF_LINK_TYPE_UPROBE_MULTI LinkType = 12 - BPF_LINK_TYPE_NETKIT LinkType = 13 - MAX_BPF_LINK_TYPE LinkType = 14 -) - -type MapType uint32 - -const ( - BPF_MAP_TYPE_UNSPEC MapType = 0 - BPF_MAP_TYPE_HASH MapType = 1 - BPF_MAP_TYPE_ARRAY MapType = 2 - BPF_MAP_TYPE_PROG_ARRAY MapType = 3 - BPF_MAP_TYPE_PERF_EVENT_ARRAY MapType = 4 - BPF_MAP_TYPE_PERCPU_HASH MapType = 5 - BPF_MAP_TYPE_PERCPU_ARRAY MapType = 6 - BPF_MAP_TYPE_STACK_TRACE MapType = 7 - BPF_MAP_TYPE_CGROUP_ARRAY MapType = 8 - BPF_MAP_TYPE_LRU_HASH MapType = 9 - BPF_MAP_TYPE_LRU_PERCPU_HASH MapType = 10 - BPF_MAP_TYPE_LPM_TRIE MapType = 11 - BPF_MAP_TYPE_ARRAY_OF_MAPS MapType = 12 - BPF_MAP_TYPE_HASH_OF_MAPS MapType = 13 - BPF_MAP_TYPE_DEVMAP MapType = 14 - BPF_MAP_TYPE_SOCKMAP MapType = 15 - BPF_MAP_TYPE_CPUMAP MapType = 16 - BPF_MAP_TYPE_XSKMAP MapType = 17 - BPF_MAP_TYPE_SOCKHASH MapType = 18 - BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED MapType = 19 - BPF_MAP_TYPE_CGROUP_STORAGE MapType = 19 - BPF_MAP_TYPE_REUSEPORT_SOCKARRAY MapType = 20 - BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE_DEPRECATED MapType = 21 - BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE MapType = 21 - BPF_MAP_TYPE_QUEUE MapType = 22 - BPF_MAP_TYPE_STACK MapType = 23 - BPF_MAP_TYPE_SK_STORAGE MapType = 24 - BPF_MAP_TYPE_DEVMAP_HASH MapType = 25 - BPF_MAP_TYPE_STRUCT_OPS MapType = 26 - BPF_MAP_TYPE_RINGBUF MapType = 27 - BPF_MAP_TYPE_INODE_STORAGE MapType = 28 - BPF_MAP_TYPE_TASK_STORAGE MapType = 29 - BPF_MAP_TYPE_BLOOM_FILTER MapType = 30 - BPF_MAP_TYPE_USER_RINGBUF MapType = 31 - BPF_MAP_TYPE_CGRP_STORAGE MapType = 32 -) - -type PerfEventType uint32 - -const ( - BPF_PERF_EVENT_UNSPEC PerfEventType = 0 - BPF_PERF_EVENT_UPROBE PerfEventType = 1 - BPF_PERF_EVENT_URETPROBE PerfEventType = 2 - BPF_PERF_EVENT_KPROBE PerfEventType = 3 - BPF_PERF_EVENT_KRETPROBE PerfEventType = 4 - BPF_PERF_EVENT_TRACEPOINT PerfEventType = 5 - BPF_PERF_EVENT_EVENT PerfEventType = 6 -) - -type ProgType uint32 - -const ( - BPF_PROG_TYPE_UNSPEC ProgType = 0 - BPF_PROG_TYPE_SOCKET_FILTER ProgType = 1 - BPF_PROG_TYPE_KPROBE ProgType = 2 - BPF_PROG_TYPE_SCHED_CLS ProgType = 3 - BPF_PROG_TYPE_SCHED_ACT ProgType = 4 - BPF_PROG_TYPE_TRACEPOINT ProgType = 5 - BPF_PROG_TYPE_XDP ProgType = 6 - BPF_PROG_TYPE_PERF_EVENT ProgType = 7 - BPF_PROG_TYPE_CGROUP_SKB ProgType = 8 - BPF_PROG_TYPE_CGROUP_SOCK ProgType = 9 - BPF_PROG_TYPE_LWT_IN ProgType = 10 - BPF_PROG_TYPE_LWT_OUT ProgType = 11 - BPF_PROG_TYPE_LWT_XMIT ProgType = 12 - BPF_PROG_TYPE_SOCK_OPS ProgType = 13 - BPF_PROG_TYPE_SK_SKB ProgType = 14 - BPF_PROG_TYPE_CGROUP_DEVICE ProgType = 15 - BPF_PROG_TYPE_SK_MSG ProgType = 16 - BPF_PROG_TYPE_RAW_TRACEPOINT ProgType = 17 - BPF_PROG_TYPE_CGROUP_SOCK_ADDR ProgType = 18 - BPF_PROG_TYPE_LWT_SEG6LOCAL ProgType = 19 - BPF_PROG_TYPE_LIRC_MODE2 ProgType = 20 - BPF_PROG_TYPE_SK_REUSEPORT ProgType = 21 - BPF_PROG_TYPE_FLOW_DISSECTOR ProgType = 22 - BPF_PROG_TYPE_CGROUP_SYSCTL ProgType = 23 - BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE ProgType = 24 - BPF_PROG_TYPE_CGROUP_SOCKOPT ProgType = 25 - BPF_PROG_TYPE_TRACING ProgType = 26 - BPF_PROG_TYPE_STRUCT_OPS ProgType = 27 - BPF_PROG_TYPE_EXT ProgType = 28 - BPF_PROG_TYPE_LSM ProgType = 29 - BPF_PROG_TYPE_SK_LOOKUP ProgType = 30 - BPF_PROG_TYPE_SYSCALL ProgType = 31 - BPF_PROG_TYPE_NETFILTER ProgType = 32 -) - -type RetCode uint32 - -const ( - BPF_OK RetCode = 0 - BPF_DROP RetCode = 2 - BPF_REDIRECT RetCode = 7 - BPF_LWT_REROUTE RetCode = 128 - BPF_FLOW_DISSECTOR_CONTINUE RetCode = 129 -) - -type SkAction uint32 - -const ( - SK_DROP SkAction = 0 - SK_PASS SkAction = 1 -) - -type StackBuildIdStatus uint32 - -const ( - BPF_STACK_BUILD_ID_EMPTY StackBuildIdStatus = 0 - BPF_STACK_BUILD_ID_VALID StackBuildIdStatus = 1 - BPF_STACK_BUILD_ID_IP StackBuildIdStatus = 2 -) - -type StatsType uint32 - -const ( - BPF_STATS_RUN_TIME StatsType = 0 -) - -type TcxActionBase int32 - -const ( - TCX_NEXT TcxActionBase = -1 - TCX_PASS TcxActionBase = 0 - TCX_DROP TcxActionBase = 2 - TCX_REDIRECT TcxActionBase = 7 -) - -type XdpAction uint32 - -const ( - XDP_ABORTED XdpAction = 0 - XDP_DROP XdpAction = 1 - XDP_PASS XdpAction = 2 - XDP_TX XdpAction = 3 - XDP_REDIRECT XdpAction = 4 -) - -type BtfInfo struct { - Btf Pointer - BtfSize uint32 - Id BTFID - Name Pointer - NameLen uint32 - KernelBtf uint32 -} - -type FuncInfo struct { - InsnOff uint32 - TypeId uint32 -} - -type LineInfo struct { - InsnOff uint32 - FileNameOff uint32 - LineOff uint32 - LineCol uint32 -} - -type LinkInfo struct { - Type LinkType - Id LinkID - ProgId uint32 - _ [4]byte - Extra [40]uint8 -} - -type MapInfo struct { - Type uint32 - Id uint32 - KeySize uint32 - ValueSize uint32 - MaxEntries uint32 - MapFlags MapFlags - Name ObjName - Ifindex uint32 - BtfVmlinuxValueTypeId TypeID - NetnsDev uint64 - NetnsIno uint64 - BtfId uint32 - BtfKeyTypeId TypeID - BtfValueTypeId TypeID - _ [4]byte - MapExtra uint64 -} - -type ProgInfo struct { - Type uint32 - Id uint32 - Tag [8]uint8 - JitedProgLen uint32 - XlatedProgLen uint32 - JitedProgInsns uint64 - XlatedProgInsns Pointer - LoadTime uint64 - CreatedByUid uint32 - NrMapIds uint32 - MapIds Pointer - Name ObjName - Ifindex uint32 - _ [4]byte /* unsupported bitfield */ - NetnsDev uint64 - NetnsIno uint64 - NrJitedKsyms uint32 - NrJitedFuncLens uint32 - JitedKsyms uint64 - JitedFuncLens uint64 - BtfId BTFID - FuncInfoRecSize uint32 - FuncInfo Pointer - NrFuncInfo uint32 - NrLineInfo uint32 - LineInfo Pointer - JitedLineInfo uint64 - NrJitedLineInfo uint32 - LineInfoRecSize uint32 - JitedLineInfoRecSize uint32 - NrProgTags uint32 - ProgTags uint64 - RunTimeNs uint64 - RunCnt uint64 - RecursionMisses uint64 - VerifiedInsns uint32 - AttachBtfObjId BTFID - AttachBtfId TypeID - _ [4]byte -} - -type SkLookup struct { - Cookie uint64 - Family uint32 - Protocol uint32 - RemoteIp4 [4]uint8 - RemoteIp6 [16]uint8 - RemotePort uint16 - _ [2]byte - LocalIp4 [4]uint8 - LocalIp6 [16]uint8 - LocalPort uint32 - IngressIfindex uint32 - _ [4]byte -} - -type XdpMd struct { - Data uint32 - DataEnd uint32 - DataMeta uint32 - IngressIfindex uint32 - RxQueueIndex uint32 - EgressIfindex uint32 -} - -type BtfGetFdByIdAttr struct{ Id uint32 } - -func BtfGetFdById(attr *BtfGetFdByIdAttr) (*FD, error) { - fd, err := BPF(BPF_BTF_GET_FD_BY_ID, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - if err != nil { - return nil, err - } - return NewFD(int(fd)) -} - -type BtfGetNextIdAttr struct { - Id BTFID - NextId BTFID -} - -func BtfGetNextId(attr *BtfGetNextIdAttr) error { - _, err := BPF(BPF_BTF_GET_NEXT_ID, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - return err -} - -type BtfLoadAttr struct { - Btf Pointer - BtfLogBuf Pointer - BtfSize uint32 - BtfLogSize uint32 - BtfLogLevel uint32 - BtfLogTrueSize uint32 -} - -func BtfLoad(attr *BtfLoadAttr) (*FD, error) { - fd, err := BPF(BPF_BTF_LOAD, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - if err != nil { - return nil, err - } - return NewFD(int(fd)) -} - -type EnableStatsAttr struct{ Type uint32 } - -func EnableStats(attr *EnableStatsAttr) (*FD, error) { - fd, err := BPF(BPF_ENABLE_STATS, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - if err != nil { - return nil, err - } - return NewFD(int(fd)) -} - -type IterCreateAttr struct { - LinkFd uint32 - Flags uint32 -} - -func IterCreate(attr *IterCreateAttr) (*FD, error) { - fd, err := BPF(BPF_ITER_CREATE, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - if err != nil { - return nil, err - } - return NewFD(int(fd)) -} - -type LinkCreateAttr struct { - ProgFd uint32 - TargetFd uint32 - AttachType AttachType - Flags uint32 - TargetBtfId TypeID - _ [44]byte -} - -func LinkCreate(attr *LinkCreateAttr) (*FD, error) { - fd, err := BPF(BPF_LINK_CREATE, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - if err != nil { - return nil, err - } - return NewFD(int(fd)) -} - -type LinkCreateIterAttr struct { - ProgFd uint32 - TargetFd uint32 - AttachType AttachType - Flags uint32 - IterInfo Pointer - IterInfoLen uint32 - _ [36]byte -} - -func LinkCreateIter(attr *LinkCreateIterAttr) (*FD, error) { - fd, err := BPF(BPF_LINK_CREATE, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - if err != nil { - return nil, err - } - return NewFD(int(fd)) -} - -type LinkCreateKprobeMultiAttr struct { - ProgFd uint32 - TargetFd uint32 - AttachType AttachType - Flags uint32 - KprobeMultiFlags uint32 - Count uint32 - Syms Pointer - Addrs Pointer - Cookies Pointer - _ [16]byte -} - -func LinkCreateKprobeMulti(attr *LinkCreateKprobeMultiAttr) (*FD, error) { - fd, err := BPF(BPF_LINK_CREATE, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - if err != nil { - return nil, err - } - return NewFD(int(fd)) -} - -type LinkCreateNetfilterAttr struct { - ProgFd uint32 - TargetFd uint32 - AttachType AttachType - Flags uint32 - Pf uint32 - Hooknum uint32 - Priority int32 - NetfilterFlags uint32 - _ [32]byte -} - -func LinkCreateNetfilter(attr *LinkCreateNetfilterAttr) (*FD, error) { - fd, err := BPF(BPF_LINK_CREATE, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - if err != nil { - return nil, err - } - return NewFD(int(fd)) -} - -type LinkCreateNetkitAttr struct { - ProgFd uint32 - TargetIfindex uint32 - AttachType AttachType - Flags uint32 - RelativeFdOrId uint32 - _ [4]byte - ExpectedRevision uint64 - _ [32]byte -} - -func LinkCreateNetkit(attr *LinkCreateNetkitAttr) (*FD, error) { - fd, err := BPF(BPF_LINK_CREATE, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - if err != nil { - return nil, err - } - return NewFD(int(fd)) -} - -type LinkCreatePerfEventAttr struct { - ProgFd uint32 - TargetFd uint32 - AttachType AttachType - Flags uint32 - BpfCookie uint64 - _ [40]byte -} - -func LinkCreatePerfEvent(attr *LinkCreatePerfEventAttr) (*FD, error) { - fd, err := BPF(BPF_LINK_CREATE, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - if err != nil { - return nil, err - } - return NewFD(int(fd)) -} - -type LinkCreateTcxAttr struct { - ProgFd uint32 - TargetIfindex uint32 - AttachType AttachType - Flags uint32 - RelativeFdOrId uint32 - _ [4]byte - ExpectedRevision uint64 - _ [32]byte -} - -func LinkCreateTcx(attr *LinkCreateTcxAttr) (*FD, error) { - fd, err := BPF(BPF_LINK_CREATE, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - if err != nil { - return nil, err - } - return NewFD(int(fd)) -} - -type LinkCreateTracingAttr struct { - ProgFd uint32 - TargetFd uint32 - AttachType AttachType - Flags uint32 - TargetBtfId BTFID - _ [4]byte - Cookie uint64 - _ [32]byte -} - -func LinkCreateTracing(attr *LinkCreateTracingAttr) (*FD, error) { - fd, err := BPF(BPF_LINK_CREATE, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - if err != nil { - return nil, err - } - return NewFD(int(fd)) -} - -type LinkCreateUprobeMultiAttr struct { - ProgFd uint32 - TargetFd uint32 - AttachType AttachType - Flags uint32 - Path Pointer - Offsets Pointer - RefCtrOffsets Pointer - Cookies Pointer - Count uint32 - UprobeMultiFlags uint32 - Pid uint32 - _ [4]byte -} - -func LinkCreateUprobeMulti(attr *LinkCreateUprobeMultiAttr) (*FD, error) { - fd, err := BPF(BPF_LINK_CREATE, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - if err != nil { - return nil, err - } - return NewFD(int(fd)) -} - -type LinkGetFdByIdAttr struct{ Id LinkID } - -func LinkGetFdById(attr *LinkGetFdByIdAttr) (*FD, error) { - fd, err := BPF(BPF_LINK_GET_FD_BY_ID, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - if err != nil { - return nil, err - } - return NewFD(int(fd)) -} - -type LinkGetNextIdAttr struct { - Id LinkID - NextId LinkID -} - -func LinkGetNextId(attr *LinkGetNextIdAttr) error { - _, err := BPF(BPF_LINK_GET_NEXT_ID, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - return err -} - -type LinkUpdateAttr struct { - LinkFd uint32 - NewProgFd uint32 - Flags uint32 - OldProgFd uint32 -} - -func LinkUpdate(attr *LinkUpdateAttr) error { - _, err := BPF(BPF_LINK_UPDATE, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - return err -} - -type MapCreateAttr struct { - MapType MapType - KeySize uint32 - ValueSize uint32 - MaxEntries uint32 - MapFlags MapFlags - InnerMapFd uint32 - NumaNode uint32 - MapName ObjName - MapIfindex uint32 - BtfFd uint32 - BtfKeyTypeId TypeID - BtfValueTypeId TypeID - BtfVmlinuxValueTypeId TypeID - MapExtra uint64 -} - -func MapCreate(attr *MapCreateAttr) (*FD, error) { - fd, err := BPF(BPF_MAP_CREATE, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - if err != nil { - return nil, err - } - return NewFD(int(fd)) -} - -type MapDeleteBatchAttr struct { - InBatch Pointer - OutBatch Pointer - Keys Pointer - Values Pointer - Count uint32 - MapFd uint32 - ElemFlags uint64 - Flags uint64 -} - -func MapDeleteBatch(attr *MapDeleteBatchAttr) error { - _, err := BPF(BPF_MAP_DELETE_BATCH, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - return err -} - -type MapDeleteElemAttr struct { - MapFd uint32 - _ [4]byte - Key Pointer - Value Pointer - Flags uint64 -} - -func MapDeleteElem(attr *MapDeleteElemAttr) error { - _, err := BPF(BPF_MAP_DELETE_ELEM, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - return err -} - -type MapFreezeAttr struct{ MapFd uint32 } - -func MapFreeze(attr *MapFreezeAttr) error { - _, err := BPF(BPF_MAP_FREEZE, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - return err -} - -type MapGetFdByIdAttr struct{ Id uint32 } - -func MapGetFdById(attr *MapGetFdByIdAttr) (*FD, error) { - fd, err := BPF(BPF_MAP_GET_FD_BY_ID, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - if err != nil { - return nil, err - } - return NewFD(int(fd)) -} - -type MapGetNextIdAttr struct { - Id uint32 - NextId uint32 -} - -func MapGetNextId(attr *MapGetNextIdAttr) error { - _, err := BPF(BPF_MAP_GET_NEXT_ID, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - return err -} - -type MapGetNextKeyAttr struct { - MapFd uint32 - _ [4]byte - Key Pointer - NextKey Pointer -} - -func MapGetNextKey(attr *MapGetNextKeyAttr) error { - _, err := BPF(BPF_MAP_GET_NEXT_KEY, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - return err -} - -type MapLookupAndDeleteBatchAttr struct { - InBatch Pointer - OutBatch Pointer - Keys Pointer - Values Pointer - Count uint32 - MapFd uint32 - ElemFlags uint64 - Flags uint64 -} - -func MapLookupAndDeleteBatch(attr *MapLookupAndDeleteBatchAttr) error { - _, err := BPF(BPF_MAP_LOOKUP_AND_DELETE_BATCH, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - return err -} - -type MapLookupAndDeleteElemAttr struct { - MapFd uint32 - _ [4]byte - Key Pointer - Value Pointer - Flags uint64 -} - -func MapLookupAndDeleteElem(attr *MapLookupAndDeleteElemAttr) error { - _, err := BPF(BPF_MAP_LOOKUP_AND_DELETE_ELEM, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - return err -} - -type MapLookupBatchAttr struct { - InBatch Pointer - OutBatch Pointer - Keys Pointer - Values Pointer - Count uint32 - MapFd uint32 - ElemFlags uint64 - Flags uint64 -} - -func MapLookupBatch(attr *MapLookupBatchAttr) error { - _, err := BPF(BPF_MAP_LOOKUP_BATCH, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - return err -} - -type MapLookupElemAttr struct { - MapFd uint32 - _ [4]byte - Key Pointer - Value Pointer - Flags uint64 -} - -func MapLookupElem(attr *MapLookupElemAttr) error { - _, err := BPF(BPF_MAP_LOOKUP_ELEM, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - return err -} - -type MapUpdateBatchAttr struct { - InBatch Pointer - OutBatch Pointer - Keys Pointer - Values Pointer - Count uint32 - MapFd uint32 - ElemFlags uint64 - Flags uint64 -} - -func MapUpdateBatch(attr *MapUpdateBatchAttr) error { - _, err := BPF(BPF_MAP_UPDATE_BATCH, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - return err -} - -type MapUpdateElemAttr struct { - MapFd uint32 - _ [4]byte - Key Pointer - Value Pointer - Flags uint64 -} - -func MapUpdateElem(attr *MapUpdateElemAttr) error { - _, err := BPF(BPF_MAP_UPDATE_ELEM, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - return err -} - -type ObjGetAttr struct { - Pathname Pointer - BpfFd uint32 - FileFlags uint32 - PathFd int32 - _ [4]byte -} - -func ObjGet(attr *ObjGetAttr) (*FD, error) { - fd, err := BPF(BPF_OBJ_GET, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - if err != nil { - return nil, err - } - return NewFD(int(fd)) -} - -type ObjGetInfoByFdAttr struct { - BpfFd uint32 - InfoLen uint32 - Info Pointer -} - -func ObjGetInfoByFd(attr *ObjGetInfoByFdAttr) error { - _, err := BPF(BPF_OBJ_GET_INFO_BY_FD, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - return err -} - -type ObjPinAttr struct { - Pathname Pointer - BpfFd uint32 - FileFlags uint32 - PathFd int32 - _ [4]byte -} - -func ObjPin(attr *ObjPinAttr) error { - _, err := BPF(BPF_OBJ_PIN, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - return err -} - -type ProgAttachAttr struct { - TargetFdOrIfindex uint32 - AttachBpfFd uint32 - AttachType uint32 - AttachFlags uint32 - ReplaceBpfFd uint32 - RelativeFdOrId uint32 - ExpectedRevision uint64 -} - -func ProgAttach(attr *ProgAttachAttr) error { - _, err := BPF(BPF_PROG_ATTACH, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - return err -} - -type ProgBindMapAttr struct { - ProgFd uint32 - MapFd uint32 - Flags uint32 -} - -func ProgBindMap(attr *ProgBindMapAttr) error { - _, err := BPF(BPF_PROG_BIND_MAP, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - return err -} - -type ProgDetachAttr struct { - TargetFdOrIfindex uint32 - AttachBpfFd uint32 - AttachType uint32 - AttachFlags uint32 - _ [4]byte - RelativeFdOrId uint32 - ExpectedRevision uint64 -} - -func ProgDetach(attr *ProgDetachAttr) error { - _, err := BPF(BPF_PROG_DETACH, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - return err -} - -type ProgGetFdByIdAttr struct{ Id uint32 } - -func ProgGetFdById(attr *ProgGetFdByIdAttr) (*FD, error) { - fd, err := BPF(BPF_PROG_GET_FD_BY_ID, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - if err != nil { - return nil, err - } - return NewFD(int(fd)) -} - -type ProgGetNextIdAttr struct { - Id uint32 - NextId uint32 -} - -func ProgGetNextId(attr *ProgGetNextIdAttr) error { - _, err := BPF(BPF_PROG_GET_NEXT_ID, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - return err -} - -type ProgLoadAttr struct { - ProgType ProgType - InsnCnt uint32 - Insns Pointer - License Pointer - LogLevel LogLevel - LogSize uint32 - LogBuf Pointer - KernVersion uint32 - ProgFlags uint32 - ProgName ObjName - ProgIfindex uint32 - ExpectedAttachType AttachType - ProgBtfFd uint32 - FuncInfoRecSize uint32 - FuncInfo Pointer - FuncInfoCnt uint32 - LineInfoRecSize uint32 - LineInfo Pointer - LineInfoCnt uint32 - AttachBtfId TypeID - AttachBtfObjFd uint32 - CoreReloCnt uint32 - FdArray Pointer - CoreRelos Pointer - CoreReloRecSize uint32 - LogTrueSize uint32 -} - -func ProgLoad(attr *ProgLoadAttr) (*FD, error) { - fd, err := BPF(BPF_PROG_LOAD, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - if err != nil { - return nil, err - } - return NewFD(int(fd)) -} - -type ProgQueryAttr struct { - TargetFdOrIfindex uint32 - AttachType AttachType - QueryFlags uint32 - AttachFlags uint32 - ProgIds Pointer - Count uint32 - _ [4]byte - ProgAttachFlags Pointer - LinkIds Pointer - LinkAttachFlags Pointer - Revision uint64 -} - -func ProgQuery(attr *ProgQueryAttr) error { - _, err := BPF(BPF_PROG_QUERY, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - return err -} - -type ProgRunAttr struct { - ProgFd uint32 - Retval uint32 - DataSizeIn uint32 - DataSizeOut uint32 - DataIn Pointer - DataOut Pointer - Repeat uint32 - Duration uint32 - CtxSizeIn uint32 - CtxSizeOut uint32 - CtxIn Pointer - CtxOut Pointer - Flags uint32 - Cpu uint32 - BatchSize uint32 - _ [4]byte -} - -func ProgRun(attr *ProgRunAttr) error { - _, err := BPF(BPF_PROG_TEST_RUN, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - return err -} - -type RawTracepointOpenAttr struct { - Name Pointer - ProgFd uint32 - _ [4]byte -} - -func RawTracepointOpen(attr *RawTracepointOpenAttr) (*FD, error) { - fd, err := BPF(BPF_RAW_TRACEPOINT_OPEN, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) - if err != nil { - return nil, err - } - return NewFD(int(fd)) -} - -type CgroupLinkInfo struct { - Type LinkType - Id LinkID - ProgId uint32 - _ [4]byte - CgroupId uint64 - AttachType AttachType - _ [28]byte -} - -type IterLinkInfo struct { - Type LinkType - Id LinkID - ProgId uint32 - _ [4]byte - TargetName Pointer - TargetNameLen uint32 -} - -type KprobeLinkInfo struct { - Type LinkType - Id LinkID - ProgId uint32 - _ [4]byte - PerfEventType PerfEventType - _ [4]byte - FuncName Pointer - NameLen uint32 - Offset uint32 - Addr uint64 - Missed uint64 -} - -type KprobeMultiLinkInfo struct { - Type LinkType - Id LinkID - ProgId uint32 - _ [4]byte - Addrs Pointer - Count uint32 - Flags uint32 - Missed uint64 - _ [16]byte -} - -type NetNsLinkInfo struct { - Type LinkType - Id LinkID - ProgId uint32 - _ [4]byte - NetnsIno uint32 - AttachType AttachType - _ [32]byte -} - -type NetfilterLinkInfo struct { - Type LinkType - Id LinkID - ProgId uint32 - _ [4]byte - Pf uint32 - Hooknum uint32 - Priority int32 - Flags uint32 - _ [24]byte -} - -type NetkitLinkInfo struct { - Type LinkType - Id LinkID - ProgId uint32 - _ [4]byte - Ifindex uint32 - AttachType AttachType - _ [32]byte -} - -type PerfEventLinkInfo struct { - Type LinkType - Id LinkID - ProgId uint32 - _ [4]byte - PerfEventType PerfEventType -} - -type RawTracepointLinkInfo struct { - Type LinkType - Id LinkID - ProgId uint32 - _ [4]byte - TpName Pointer - TpNameLen uint32 - _ [28]byte -} - -type TcxLinkInfo struct { - Type LinkType - Id LinkID - ProgId uint32 - _ [4]byte - Ifindex uint32 - AttachType AttachType - _ [32]byte -} - -type TracingLinkInfo struct { - Type LinkType - Id LinkID - ProgId uint32 - _ [4]byte - AttachType AttachType - TargetObjId uint32 - TargetBtfId TypeID - _ [28]byte -} - -type XDPLinkInfo struct { - Type LinkType - Id LinkID - ProgId uint32 - _ [4]byte - Ifindex uint32 - _ [36]byte -} diff --git a/vendor/github.com/cilium/ebpf/internal/sysenc/buffer.go b/vendor/github.com/cilium/ebpf/internal/sysenc/buffer.go deleted file mode 100644 index d184ea196..000000000 --- a/vendor/github.com/cilium/ebpf/internal/sysenc/buffer.go +++ /dev/null @@ -1,83 +0,0 @@ -package sysenc - -import ( - "unsafe" - - "github.com/cilium/ebpf/internal/sys" -) - -type Buffer struct { - ptr unsafe.Pointer - // Size of the buffer. syscallPointerOnly if created from UnsafeBuffer or when using - // zero-copy unmarshaling. - size int -} - -const syscallPointerOnly = -1 - -func newBuffer(buf []byte) Buffer { - if len(buf) == 0 { - return Buffer{} - } - return Buffer{unsafe.Pointer(&buf[0]), len(buf)} -} - -// UnsafeBuffer constructs a Buffer for zero-copy unmarshaling. -// -// [Pointer] is the only valid method to call on such a Buffer. -// Use [SyscallBuffer] instead if possible. -func UnsafeBuffer(ptr unsafe.Pointer) Buffer { - return Buffer{ptr, syscallPointerOnly} -} - -// SyscallOutput prepares a Buffer for a syscall to write into. -// -// size is the length of the desired buffer in bytes. -// The buffer may point at the underlying memory of dst, in which case [Unmarshal] -// becomes a no-op. -// -// The contents of the buffer are undefined and may be non-zero. -func SyscallOutput(dst any, size int) Buffer { - if dstBuf := unsafeBackingMemory(dst); len(dstBuf) == size { - buf := newBuffer(dstBuf) - buf.size = syscallPointerOnly - return buf - } - - return newBuffer(make([]byte, size)) -} - -// CopyTo copies the buffer into dst. -// -// Returns the number of copied bytes. -func (b Buffer) CopyTo(dst []byte) int { - return copy(dst, b.unsafeBytes()) -} - -// AppendTo appends the buffer onto dst. -func (b Buffer) AppendTo(dst []byte) []byte { - return append(dst, b.unsafeBytes()...) -} - -// Pointer returns the location where a syscall should write. -func (b Buffer) Pointer() sys.Pointer { - // NB: This deliberately ignores b.length to support zero-copy - // marshaling / unmarshaling using unsafe.Pointer. - return sys.NewPointer(b.ptr) -} - -// Unmarshal the buffer into the provided value. -func (b Buffer) Unmarshal(data any) error { - if b.size == syscallPointerOnly { - return nil - } - - return Unmarshal(data, b.unsafeBytes()) -} - -func (b Buffer) unsafeBytes() []byte { - if b.size == syscallPointerOnly { - return nil - } - return unsafe.Slice((*byte)(b.ptr), b.size) -} diff --git a/vendor/github.com/cilium/ebpf/internal/sysenc/doc.go b/vendor/github.com/cilium/ebpf/internal/sysenc/doc.go deleted file mode 100644 index 676ad98ba..000000000 --- a/vendor/github.com/cilium/ebpf/internal/sysenc/doc.go +++ /dev/null @@ -1,3 +0,0 @@ -// Package sysenc provides efficient conversion of Go values to system -// call interfaces. -package sysenc diff --git a/vendor/github.com/cilium/ebpf/internal/sysenc/layout.go b/vendor/github.com/cilium/ebpf/internal/sysenc/layout.go deleted file mode 100644 index 52d111e7a..000000000 --- a/vendor/github.com/cilium/ebpf/internal/sysenc/layout.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found at https://go.dev/LICENSE. - -package sysenc - -import ( - "reflect" - "sync" -) - -var hasUnexportedFieldsCache sync.Map // map[reflect.Type]bool - -func hasUnexportedFields(typ reflect.Type) bool { - switch typ.Kind() { - case reflect.Slice, reflect.Array, reflect.Pointer: - return hasUnexportedFields(typ.Elem()) - - case reflect.Struct: - if unexported, ok := hasUnexportedFieldsCache.Load(typ); ok { - return unexported.(bool) - } - - unexported := false - for i, n := 0, typ.NumField(); i < n; i++ { - field := typ.Field(i) - // Package binary allows _ fields but always writes zeroes into them. - if (!field.IsExported() && field.Name != "_") || hasUnexportedFields(field.Type) { - unexported = true - break - } - } - - hasUnexportedFieldsCache.Store(typ, unexported) - return unexported - - default: - // NB: It's not clear what this means for Chan and so on. - return false - } -} diff --git a/vendor/github.com/cilium/ebpf/internal/sysenc/marshal.go b/vendor/github.com/cilium/ebpf/internal/sysenc/marshal.go deleted file mode 100644 index 0026af8f2..000000000 --- a/vendor/github.com/cilium/ebpf/internal/sysenc/marshal.go +++ /dev/null @@ -1,177 +0,0 @@ -package sysenc - -import ( - "bytes" - "encoding" - "encoding/binary" - "errors" - "fmt" - "reflect" - "slices" - "sync" - "unsafe" - - "github.com/cilium/ebpf/internal" -) - -// Marshal turns data into a byte slice using the system's native endianness. -// -// If possible, avoids allocations by directly using the backing memory -// of data. This means that the variable must not be modified for the lifetime -// of the returned [Buffer]. -// -// Returns an error if the data can't be turned into a byte slice according to -// the behaviour of [binary.Write]. -func Marshal(data any, size int) (Buffer, error) { - if data == nil { - return Buffer{}, errors.New("can't marshal a nil value") - } - - var buf []byte - var err error - switch value := data.(type) { - case encoding.BinaryMarshaler: - buf, err = value.MarshalBinary() - case string: - buf = unsafe.Slice(unsafe.StringData(value), len(value)) - case []byte: - buf = value - case int16: - buf = internal.NativeEndian.AppendUint16(make([]byte, 0, 2), uint16(value)) - case uint16: - buf = internal.NativeEndian.AppendUint16(make([]byte, 0, 2), value) - case int32: - buf = internal.NativeEndian.AppendUint32(make([]byte, 0, 4), uint32(value)) - case uint32: - buf = internal.NativeEndian.AppendUint32(make([]byte, 0, 4), value) - case int64: - buf = internal.NativeEndian.AppendUint64(make([]byte, 0, 8), uint64(value)) - case uint64: - buf = internal.NativeEndian.AppendUint64(make([]byte, 0, 8), value) - default: - if buf := unsafeBackingMemory(data); len(buf) == size { - return newBuffer(buf), nil - } - - wr := internal.NewBuffer(make([]byte, 0, size)) - defer internal.PutBuffer(wr) - - err = binary.Write(wr, internal.NativeEndian, value) - buf = wr.Bytes() - } - if err != nil { - return Buffer{}, err - } - - if len(buf) != size { - return Buffer{}, fmt.Errorf("%T doesn't marshal to %d bytes", data, size) - } - - return newBuffer(buf), nil -} - -var bytesReaderPool = sync.Pool{ - New: func() interface{} { - return new(bytes.Reader) - }, -} - -// Unmarshal a byte slice in the system's native endianness into data. -// -// Returns an error if buf can't be unmarshalled according to the behaviour -// of [binary.Read]. -func Unmarshal(data interface{}, buf []byte) error { - switch value := data.(type) { - case encoding.BinaryUnmarshaler: - return value.UnmarshalBinary(buf) - - case *string: - *value = string(buf) - return nil - - case *[]byte: - // Backwards compat: unmarshaling into a slice replaces the whole slice. - *value = slices.Clone(buf) - return nil - - default: - if dataBuf := unsafeBackingMemory(data); len(dataBuf) == len(buf) { - copy(dataBuf, buf) - return nil - } - - rd := bytesReaderPool.Get().(*bytes.Reader) - defer bytesReaderPool.Put(rd) - - rd.Reset(buf) - - if err := binary.Read(rd, internal.NativeEndian, value); err != nil { - return err - } - - if rd.Len() != 0 { - return fmt.Errorf("unmarshaling %T doesn't consume all data", data) - } - - return nil - } -} - -// unsafeBackingMemory returns the backing memory of data if it can be used -// instead of calling into package binary. -// -// Returns nil if the value is not a pointer or a slice, or if it contains -// padding or unexported fields. -func unsafeBackingMemory(data any) []byte { - if data == nil { - return nil - } - - value := reflect.ValueOf(data) - var valueSize int - switch value.Kind() { - case reflect.Pointer: - if value.IsNil() { - return nil - } - - if elemType := value.Type().Elem(); elemType.Kind() != reflect.Slice { - valueSize = int(elemType.Size()) - break - } - - // We're dealing with a pointer to a slice. Dereference and - // handle it like a regular slice. - value = value.Elem() - fallthrough - - case reflect.Slice: - valueSize = int(value.Type().Elem().Size()) * value.Len() - - default: - // Prevent Value.UnsafePointer from panicking. - return nil - } - - // Some nil pointer types currently crash binary.Size. Call it after our own - // code so that the panic isn't reachable. - // See https://github.com/golang/go/issues/60892 - if size := binary.Size(data); size == -1 || size != valueSize { - // The type contains padding or unsupported types. - return nil - } - - if hasUnexportedFields(reflect.TypeOf(data)) { - return nil - } - - // Reinterpret the pointer as a byte slice. This violates the unsafe.Pointer - // rules because it's very unlikely that the source data has "an equivalent - // memory layout". However, we can make it safe-ish because of the - // following reasons: - // - There is no alignment mismatch since we cast to a type with an - // alignment of 1. - // - There are no pointers in the source type so we don't upset the GC. - // - The length is verified at runtime. - return unsafe.Slice((*byte)(value.UnsafePointer()), valueSize) -} diff --git a/vendor/github.com/cilium/ebpf/internal/tracefs/kprobe.go b/vendor/github.com/cilium/ebpf/internal/tracefs/kprobe.go deleted file mode 100644 index 897740fec..000000000 --- a/vendor/github.com/cilium/ebpf/internal/tracefs/kprobe.go +++ /dev/null @@ -1,360 +0,0 @@ -package tracefs - -import ( - "crypto/rand" - "errors" - "fmt" - "os" - "path/filepath" - "runtime" - "strings" - "sync" - "syscall" - - "github.com/cilium/ebpf/internal" - "github.com/cilium/ebpf/internal/unix" -) - -var ( - ErrInvalidInput = errors.New("invalid input") - - ErrInvalidMaxActive = errors.New("can only set maxactive on kretprobes") -) - -//go:generate go run golang.org/x/tools/cmd/stringer@latest -type=ProbeType -linecomment - -type ProbeType uint8 - -const ( - Kprobe ProbeType = iota // kprobe - Uprobe // uprobe -) - -func (pt ProbeType) eventsFile() (*os.File, error) { - path, err := sanitizeTracefsPath(fmt.Sprintf("%s_events", pt.String())) - if err != nil { - return nil, err - } - - return os.OpenFile(path, os.O_APPEND|os.O_WRONLY, 0666) -} - -type ProbeArgs struct { - Type ProbeType - Symbol, Group, Path string - Offset, RefCtrOffset, Cookie uint64 - Pid, RetprobeMaxActive int - Ret bool -} - -// RandomGroup generates a pseudorandom string for use as a tracefs group name. -// Returns an error when the output string would exceed 63 characters (kernel -// limitation), when rand.Read() fails or when prefix contains characters not -// allowed by IsValidTraceID. -func RandomGroup(prefix string) (string, error) { - if !validIdentifier(prefix) { - return "", fmt.Errorf("prefix '%s' must be alphanumeric or underscore: %w", prefix, ErrInvalidInput) - } - - b := make([]byte, 8) - if _, err := rand.Read(b); err != nil { - return "", fmt.Errorf("reading random bytes: %w", err) - } - - group := fmt.Sprintf("%s_%x", prefix, b) - if len(group) > 63 { - return "", fmt.Errorf("group name '%s' cannot be longer than 63 characters: %w", group, ErrInvalidInput) - } - - return group, nil -} - -// validIdentifier implements the equivalent of a regex match -// against "^[a-zA-Z_][0-9a-zA-Z_]*$". -// -// Trace event groups, names and kernel symbols must adhere to this set -// of characters. Non-empty, first character must not be a number, all -// characters must be alphanumeric or underscore. -func validIdentifier(s string) bool { - if len(s) < 1 { - return false - } - for i, c := range []byte(s) { - switch { - case c >= 'a' && c <= 'z': - case c >= 'A' && c <= 'Z': - case c == '_': - case i > 0 && c >= '0' && c <= '9': - - default: - return false - } - } - - return true -} - -func sanitizeTracefsPath(path ...string) (string, error) { - base, err := getTracefsPath() - if err != nil { - return "", err - } - l := filepath.Join(path...) - p := filepath.Join(base, l) - if !strings.HasPrefix(p, base) { - return "", fmt.Errorf("path '%s' attempts to escape base path '%s': %w", l, base, ErrInvalidInput) - } - return p, nil -} - -// getTracefsPath will return a correct path to the tracefs mount point. -// Since kernel 4.1 tracefs should be mounted by default at /sys/kernel/tracing, -// but may be also be available at /sys/kernel/debug/tracing if debugfs is mounted. -// The available tracefs paths will depends on distribution choices. -var getTracefsPath = sync.OnceValues(func() (string, error) { - for _, p := range []struct { - path string - fsType int64 - }{ - {"/sys/kernel/tracing", unix.TRACEFS_MAGIC}, - {"/sys/kernel/debug/tracing", unix.TRACEFS_MAGIC}, - // RHEL/CentOS - {"/sys/kernel/debug/tracing", unix.DEBUGFS_MAGIC}, - } { - if fsType, err := internal.FSType(p.path); err == nil && fsType == p.fsType { - return p.path, nil - } - } - - return "", errors.New("neither debugfs nor tracefs are mounted") -}) - -// sanitizeIdentifier replaces every invalid character for the tracefs api with an underscore. -// -// It is equivalent to calling regexp.MustCompile("[^a-zA-Z0-9]+").ReplaceAllString("_"). -func sanitizeIdentifier(s string) string { - var skip bool - return strings.Map(func(c rune) rune { - switch { - case c >= 'a' && c <= 'z', - c >= 'A' && c <= 'Z', - c >= '0' && c <= '9': - skip = false - return c - - case skip: - return -1 - - default: - skip = true - return '_' - } - }, s) -} - -// EventID reads a trace event's ID from tracefs given its group and name. -// The kernel requires group and name to be alphanumeric or underscore. -func EventID(group, name string) (uint64, error) { - if !validIdentifier(group) { - return 0, fmt.Errorf("invalid tracefs group: %q", group) - } - - if !validIdentifier(name) { - return 0, fmt.Errorf("invalid tracefs name: %q", name) - } - - path, err := sanitizeTracefsPath("events", group, name, "id") - if err != nil { - return 0, err - } - tid, err := internal.ReadUint64FromFile("%d\n", path) - if errors.Is(err, os.ErrNotExist) { - return 0, err - } - if err != nil { - return 0, fmt.Errorf("reading trace event ID of %s/%s: %w", group, name, err) - } - - return tid, nil -} - -func probePrefix(ret bool, maxActive int) string { - if ret { - if maxActive > 0 { - return fmt.Sprintf("r%d", maxActive) - } - return "r" - } - return "p" -} - -// Event represents an entry in a tracefs probe events file. -type Event struct { - typ ProbeType - group, name string - // event id allocated by the kernel. 0 if the event has already been removed. - id uint64 -} - -// NewEvent creates a new ephemeral trace event. -// -// Returns os.ErrNotExist if symbol is not a valid -// kernel symbol, or if it is not traceable with kprobes. Returns os.ErrExist -// if a probe with the same group and symbol already exists. Returns an error if -// args.RetprobeMaxActive is used on non kprobe types. Returns ErrNotSupported if -// the kernel is too old to support kretprobe maxactive. -func NewEvent(args ProbeArgs) (*Event, error) { - // Before attempting to create a trace event through tracefs, - // check if an event with the same group and name already exists. - // Kernels 4.x and earlier don't return os.ErrExist on writing a duplicate - // entry, so we need to rely on reads for detecting uniqueness. - eventName := sanitizeIdentifier(args.Symbol) - _, err := EventID(args.Group, eventName) - if err == nil { - return nil, fmt.Errorf("trace event %s/%s: %w", args.Group, eventName, os.ErrExist) - } - if err != nil && !errors.Is(err, os.ErrNotExist) { - return nil, fmt.Errorf("checking trace event %s/%s: %w", args.Group, eventName, err) - } - - // Open the kprobe_events file in tracefs. - f, err := args.Type.eventsFile() - if err != nil { - return nil, err - } - defer f.Close() - - var pe, token string - switch args.Type { - case Kprobe: - // The kprobe_events syntax is as follows (see Documentation/trace/kprobetrace.txt): - // p[:[GRP/]EVENT] [MOD:]SYM[+offs]|MEMADDR [FETCHARGS] : Set a probe - // r[MAXACTIVE][:[GRP/]EVENT] [MOD:]SYM[+0] [FETCHARGS] : Set a return probe - // -:[GRP/]EVENT : Clear a probe - // - // Some examples: - // r:ebpf_1234/r_my_kretprobe nf_conntrack_destroy - // p:ebpf_5678/p_my_kprobe __x64_sys_execve - // - // Leaving the kretprobe's MAXACTIVE set to 0 (or absent) will make the - // kernel default to NR_CPUS. This is desired in most eBPF cases since - // subsampling or rate limiting logic can be more accurately implemented in - // the eBPF program itself. - // See Documentation/kprobes.txt for more details. - if args.RetprobeMaxActive != 0 && !args.Ret { - return nil, ErrInvalidMaxActive - } - token = KprobeToken(args) - pe = fmt.Sprintf("%s:%s/%s %s", probePrefix(args.Ret, args.RetprobeMaxActive), args.Group, eventName, token) - case Uprobe: - // The uprobe_events syntax is as follows: - // p[:[GRP/]EVENT] PATH:OFFSET [FETCHARGS] : Set a probe - // r[:[GRP/]EVENT] PATH:OFFSET [FETCHARGS] : Set a return probe - // -:[GRP/]EVENT : Clear a probe - // - // Some examples: - // r:ebpf_1234/readline /bin/bash:0x12345 - // p:ebpf_5678/main_mySymbol /bin/mybin:0x12345(0x123) - // - // See Documentation/trace/uprobetracer.txt for more details. - if args.RetprobeMaxActive != 0 { - return nil, ErrInvalidMaxActive - } - token = UprobeToken(args) - pe = fmt.Sprintf("%s:%s/%s %s", probePrefix(args.Ret, 0), args.Group, eventName, token) - } - _, err = f.WriteString(pe) - - // Since commit 97c753e62e6c, ENOENT is correctly returned instead of EINVAL - // when trying to create a retprobe for a missing symbol. - if errors.Is(err, os.ErrNotExist) { - return nil, fmt.Errorf("token %s: not found: %w", token, err) - } - // Since commit ab105a4fb894, EILSEQ is returned when a kprobe sym+offset is resolved - // to an invalid insn boundary. The exact conditions that trigger this error are - // arch specific however. - if errors.Is(err, syscall.EILSEQ) { - return nil, fmt.Errorf("token %s: bad insn boundary: %w", token, os.ErrNotExist) - } - // ERANGE is returned when the `SYM[+offs]` token is too big and cannot - // be resolved. - if errors.Is(err, syscall.ERANGE) { - return nil, fmt.Errorf("token %s: offset too big: %w", token, os.ErrNotExist) - } - - if err != nil { - return nil, fmt.Errorf("token %s: writing '%s': %w", token, pe, err) - } - - // Get the newly-created trace event's id. - tid, err := EventID(args.Group, eventName) - if args.RetprobeMaxActive != 0 && errors.Is(err, os.ErrNotExist) { - // Kernels < 4.12 don't support maxactive and therefore auto generate - // group and event names from the symbol and offset. The symbol is used - // without any sanitization. - // See https://elixir.bootlin.com/linux/v4.10/source/kernel/trace/trace_kprobe.c#L712 - event := fmt.Sprintf("kprobes/r_%s_%d", args.Symbol, args.Offset) - if err := removeEvent(args.Type, event); err != nil { - return nil, fmt.Errorf("failed to remove spurious maxactive event: %s", err) - } - return nil, fmt.Errorf("create trace event with non-default maxactive: %w", internal.ErrNotSupported) - } - if err != nil { - return nil, fmt.Errorf("get trace event id: %w", err) - } - - evt := &Event{args.Type, args.Group, eventName, tid} - runtime.SetFinalizer(evt, (*Event).Close) - return evt, nil -} - -// Close removes the event from tracefs. -// -// Returns os.ErrClosed if the event has already been closed before. -func (evt *Event) Close() error { - if evt.id == 0 { - return os.ErrClosed - } - - evt.id = 0 - runtime.SetFinalizer(evt, nil) - pe := fmt.Sprintf("%s/%s", evt.group, evt.name) - return removeEvent(evt.typ, pe) -} - -func removeEvent(typ ProbeType, pe string) error { - f, err := typ.eventsFile() - if err != nil { - return err - } - defer f.Close() - - // See [k,u]probe_events syntax above. The probe type does not need to be specified - // for removals. - if _, err = f.WriteString("-:" + pe); err != nil { - return fmt.Errorf("remove event %q from %s: %w", pe, f.Name(), err) - } - - return nil -} - -// ID returns the tracefs ID associated with the event. -func (evt *Event) ID() uint64 { - return evt.id -} - -// Group returns the tracefs group used by the event. -func (evt *Event) Group() string { - return evt.group -} - -// KprobeToken creates the SYM[+offs] token for the tracefs api. -func KprobeToken(args ProbeArgs) string { - po := args.Symbol - - if args.Offset != 0 { - po += fmt.Sprintf("+%#x", args.Offset) - } - - return po -} diff --git a/vendor/github.com/cilium/ebpf/internal/tracefs/probetype_string.go b/vendor/github.com/cilium/ebpf/internal/tracefs/probetype_string.go deleted file mode 100644 index 87cb0a059..000000000 --- a/vendor/github.com/cilium/ebpf/internal/tracefs/probetype_string.go +++ /dev/null @@ -1,24 +0,0 @@ -// Code generated by "stringer -type=ProbeType -linecomment"; DO NOT EDIT. - -package tracefs - -import "strconv" - -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[Kprobe-0] - _ = x[Uprobe-1] -} - -const _ProbeType_name = "kprobeuprobe" - -var _ProbeType_index = [...]uint8{0, 6, 12} - -func (i ProbeType) String() string { - if i >= ProbeType(len(_ProbeType_index)-1) { - return "ProbeType(" + strconv.FormatInt(int64(i), 10) + ")" - } - return _ProbeType_name[_ProbeType_index[i]:_ProbeType_index[i+1]] -} diff --git a/vendor/github.com/cilium/ebpf/internal/tracefs/uprobe.go b/vendor/github.com/cilium/ebpf/internal/tracefs/uprobe.go deleted file mode 100644 index 994f31260..000000000 --- a/vendor/github.com/cilium/ebpf/internal/tracefs/uprobe.go +++ /dev/null @@ -1,16 +0,0 @@ -package tracefs - -import "fmt" - -// UprobeToken creates the PATH:OFFSET(REF_CTR_OFFSET) token for the tracefs api. -func UprobeToken(args ProbeArgs) string { - po := fmt.Sprintf("%s:%#x", args.Path, args.Offset) - - if args.RefCtrOffset != 0 { - // This is not documented in Documentation/trace/uprobetracer.txt. - // elixir.bootlin.com/linux/v5.15-rc7/source/kernel/trace/trace.c#L5564 - po += fmt.Sprintf("(%#x)", args.RefCtrOffset) - } - - return po -} diff --git a/vendor/github.com/cilium/ebpf/internal/unix/doc.go b/vendor/github.com/cilium/ebpf/internal/unix/doc.go deleted file mode 100644 index d168d36f1..000000000 --- a/vendor/github.com/cilium/ebpf/internal/unix/doc.go +++ /dev/null @@ -1,11 +0,0 @@ -// Package unix re-exports Linux specific parts of golang.org/x/sys/unix. -// -// It avoids breaking compilation on other OS by providing stubs as follows: -// - Invoking a function always returns an error. -// - Errnos have distinct, non-zero values. -// - Constants have distinct but meaningless values. -// - Types use the same names for members, but may or may not follow the -// Linux layout. -package unix - -// Note: please don't add any custom API to this package. Use internal/sys instead. diff --git a/vendor/github.com/cilium/ebpf/internal/unix/types_linux.go b/vendor/github.com/cilium/ebpf/internal/unix/types_linux.go deleted file mode 100644 index d725cfaa3..000000000 --- a/vendor/github.com/cilium/ebpf/internal/unix/types_linux.go +++ /dev/null @@ -1,216 +0,0 @@ -//go:build linux - -package unix - -import ( - "syscall" - - linux "golang.org/x/sys/unix" -) - -const ( - ENOENT = linux.ENOENT - EEXIST = linux.EEXIST - EAGAIN = linux.EAGAIN - ENOSPC = linux.ENOSPC - EINVAL = linux.EINVAL - EPOLLIN = linux.EPOLLIN - EINTR = linux.EINTR - EPERM = linux.EPERM - ESRCH = linux.ESRCH - ENODEV = linux.ENODEV - EBADF = linux.EBADF - E2BIG = linux.E2BIG - EFAULT = linux.EFAULT - EACCES = linux.EACCES - EILSEQ = linux.EILSEQ - EOPNOTSUPP = linux.EOPNOTSUPP - ESTALE = linux.ESTALE -) - -const ( - BPF_F_NO_PREALLOC = linux.BPF_F_NO_PREALLOC - BPF_F_NUMA_NODE = linux.BPF_F_NUMA_NODE - BPF_F_RDONLY = linux.BPF_F_RDONLY - BPF_F_WRONLY = linux.BPF_F_WRONLY - BPF_F_RDONLY_PROG = linux.BPF_F_RDONLY_PROG - BPF_F_WRONLY_PROG = linux.BPF_F_WRONLY_PROG - BPF_F_SLEEPABLE = linux.BPF_F_SLEEPABLE - BPF_F_XDP_HAS_FRAGS = linux.BPF_F_XDP_HAS_FRAGS - BPF_F_MMAPABLE = linux.BPF_F_MMAPABLE - BPF_F_INNER_MAP = linux.BPF_F_INNER_MAP - BPF_F_KPROBE_MULTI_RETURN = linux.BPF_F_KPROBE_MULTI_RETURN - BPF_F_UPROBE_MULTI_RETURN = linux.BPF_F_UPROBE_MULTI_RETURN - BPF_F_LOCK = linux.BPF_F_LOCK - BPF_OBJ_NAME_LEN = linux.BPF_OBJ_NAME_LEN - BPF_TAG_SIZE = linux.BPF_TAG_SIZE - BPF_RINGBUF_BUSY_BIT = linux.BPF_RINGBUF_BUSY_BIT - BPF_RINGBUF_DISCARD_BIT = linux.BPF_RINGBUF_DISCARD_BIT - BPF_RINGBUF_HDR_SZ = linux.BPF_RINGBUF_HDR_SZ - SYS_BPF = linux.SYS_BPF - F_DUPFD_CLOEXEC = linux.F_DUPFD_CLOEXEC - EPOLL_CTL_ADD = linux.EPOLL_CTL_ADD - EPOLL_CLOEXEC = linux.EPOLL_CLOEXEC - O_CLOEXEC = linux.O_CLOEXEC - O_NONBLOCK = linux.O_NONBLOCK - PROT_NONE = linux.PROT_NONE - PROT_READ = linux.PROT_READ - PROT_WRITE = linux.PROT_WRITE - MAP_ANON = linux.MAP_ANON - MAP_SHARED = linux.MAP_SHARED - MAP_PRIVATE = linux.MAP_PRIVATE - PERF_ATTR_SIZE_VER1 = linux.PERF_ATTR_SIZE_VER1 - PERF_TYPE_SOFTWARE = linux.PERF_TYPE_SOFTWARE - PERF_TYPE_TRACEPOINT = linux.PERF_TYPE_TRACEPOINT - PERF_COUNT_SW_BPF_OUTPUT = linux.PERF_COUNT_SW_BPF_OUTPUT - PERF_EVENT_IOC_DISABLE = linux.PERF_EVENT_IOC_DISABLE - PERF_EVENT_IOC_ENABLE = linux.PERF_EVENT_IOC_ENABLE - PERF_EVENT_IOC_SET_BPF = linux.PERF_EVENT_IOC_SET_BPF - PerfBitWatermark = linux.PerfBitWatermark - PerfBitWriteBackward = linux.PerfBitWriteBackward - PERF_SAMPLE_RAW = linux.PERF_SAMPLE_RAW - PERF_FLAG_FD_CLOEXEC = linux.PERF_FLAG_FD_CLOEXEC - RLIM_INFINITY = linux.RLIM_INFINITY - RLIMIT_MEMLOCK = linux.RLIMIT_MEMLOCK - BPF_STATS_RUN_TIME = linux.BPF_STATS_RUN_TIME - PERF_RECORD_LOST = linux.PERF_RECORD_LOST - PERF_RECORD_SAMPLE = linux.PERF_RECORD_SAMPLE - AT_FDCWD = linux.AT_FDCWD - RENAME_NOREPLACE = linux.RENAME_NOREPLACE - SO_ATTACH_BPF = linux.SO_ATTACH_BPF - SO_DETACH_BPF = linux.SO_DETACH_BPF - SOL_SOCKET = linux.SOL_SOCKET - SIGPROF = linux.SIGPROF - SIG_BLOCK = linux.SIG_BLOCK - SIG_UNBLOCK = linux.SIG_UNBLOCK - EM_NONE = linux.EM_NONE - EM_BPF = linux.EM_BPF - BPF_FS_MAGIC = linux.BPF_FS_MAGIC - TRACEFS_MAGIC = linux.TRACEFS_MAGIC - DEBUGFS_MAGIC = linux.DEBUGFS_MAGIC - BPF_RB_NO_WAKEUP = linux.BPF_RB_NO_WAKEUP - BPF_RB_FORCE_WAKEUP = linux.BPF_RB_FORCE_WAKEUP -) - -type Statfs_t = linux.Statfs_t -type Stat_t = linux.Stat_t -type Rlimit = linux.Rlimit -type Signal = linux.Signal -type Sigset_t = linux.Sigset_t -type PerfEventMmapPage = linux.PerfEventMmapPage -type EpollEvent = linux.EpollEvent -type PerfEventAttr = linux.PerfEventAttr -type Utsname = linux.Utsname -type CPUSet = linux.CPUSet - -func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { - return linux.Syscall(trap, a1, a2, a3) -} - -func PthreadSigmask(how int, set, oldset *Sigset_t) error { - return linux.PthreadSigmask(how, set, oldset) -} - -func FcntlInt(fd uintptr, cmd, arg int) (int, error) { - return linux.FcntlInt(fd, cmd, arg) -} - -func IoctlSetInt(fd int, req uint, value int) error { - return linux.IoctlSetInt(fd, req, value) -} - -func Statfs(path string, buf *Statfs_t) (err error) { - return linux.Statfs(path, buf) -} - -func Close(fd int) (err error) { - return linux.Close(fd) -} - -func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { - return linux.EpollWait(epfd, events, msec) -} - -func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) { - return linux.EpollCtl(epfd, op, fd, event) -} - -func Eventfd(initval uint, flags int) (fd int, err error) { - return linux.Eventfd(initval, flags) -} - -func Write(fd int, p []byte) (n int, err error) { - return linux.Write(fd, p) -} - -func EpollCreate1(flag int) (fd int, err error) { - return linux.EpollCreate1(flag) -} - -func SetNonblock(fd int, nonblocking bool) (err error) { - return linux.SetNonblock(fd, nonblocking) -} - -func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) { - return linux.Mmap(fd, offset, length, prot, flags) -} - -func Munmap(b []byte) (err error) { - return linux.Munmap(b) -} - -func PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error) { - return linux.PerfEventOpen(attr, pid, cpu, groupFd, flags) -} - -func Uname(buf *Utsname) (err error) { - return linux.Uname(buf) -} - -func Getpid() int { - return linux.Getpid() -} - -func Gettid() int { - return linux.Gettid() -} - -func Tgkill(tgid int, tid int, sig syscall.Signal) (err error) { - return linux.Tgkill(tgid, tid, sig) -} - -func BytePtrFromString(s string) (*byte, error) { - return linux.BytePtrFromString(s) -} - -func ByteSliceToString(s []byte) string { - return linux.ByteSliceToString(s) -} - -func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) error { - return linux.Renameat2(olddirfd, oldpath, newdirfd, newpath, flags) -} - -func Prlimit(pid, resource int, new, old *Rlimit) error { - return linux.Prlimit(pid, resource, new, old) -} - -func Open(path string, mode int, perm uint32) (int, error) { - return linux.Open(path, mode, perm) -} - -func Fstat(fd int, stat *Stat_t) error { - return linux.Fstat(fd, stat) -} - -func SetsockoptInt(fd, level, opt, value int) error { - return linux.SetsockoptInt(fd, level, opt, value) -} - -func SchedSetaffinity(pid int, set *CPUSet) error { - return linux.SchedSetaffinity(pid, set) -} - -func SchedGetaffinity(pid int, set *CPUSet) error { - return linux.SchedGetaffinity(pid, set) -} diff --git a/vendor/github.com/cilium/ebpf/internal/unix/types_other.go b/vendor/github.com/cilium/ebpf/internal/unix/types_other.go deleted file mode 100644 index 3ff896271..000000000 --- a/vendor/github.com/cilium/ebpf/internal/unix/types_other.go +++ /dev/null @@ -1,311 +0,0 @@ -//go:build !linux - -package unix - -import ( - "fmt" - "runtime" - "syscall" -) - -var errNonLinux = fmt.Errorf("unsupported platform %s/%s", runtime.GOOS, runtime.GOARCH) - -// Errnos are distinct and non-zero. -const ( - ENOENT syscall.Errno = iota + 1 - EEXIST - EAGAIN - ENOSPC - EINVAL - EINTR - EPERM - ESRCH - ENODEV - EBADF - E2BIG - EFAULT - EACCES - EILSEQ - EOPNOTSUPP - ESTALE -) - -// Constants are distinct to avoid breaking switch statements. -const ( - BPF_F_NO_PREALLOC = iota - BPF_F_NUMA_NODE - BPF_F_RDONLY - BPF_F_WRONLY - BPF_F_RDONLY_PROG - BPF_F_WRONLY_PROG - BPF_F_SLEEPABLE - BPF_F_MMAPABLE - BPF_F_INNER_MAP - BPF_F_KPROBE_MULTI_RETURN - BPF_F_UPROBE_MULTI_RETURN - BPF_F_XDP_HAS_FRAGS - BPF_OBJ_NAME_LEN - BPF_TAG_SIZE - BPF_RINGBUF_BUSY_BIT - BPF_RINGBUF_DISCARD_BIT - BPF_RINGBUF_HDR_SZ - SYS_BPF - F_DUPFD_CLOEXEC - EPOLLIN - EPOLL_CTL_ADD - EPOLL_CLOEXEC - O_CLOEXEC - O_NONBLOCK - PROT_NONE - PROT_READ - PROT_WRITE - MAP_ANON - MAP_SHARED - MAP_PRIVATE - PERF_ATTR_SIZE_VER1 - PERF_TYPE_SOFTWARE - PERF_TYPE_TRACEPOINT - PERF_COUNT_SW_BPF_OUTPUT - PERF_EVENT_IOC_DISABLE - PERF_EVENT_IOC_ENABLE - PERF_EVENT_IOC_SET_BPF - PerfBitWatermark - PerfBitWriteBackward - PERF_SAMPLE_RAW - PERF_FLAG_FD_CLOEXEC - RLIM_INFINITY - RLIMIT_MEMLOCK - BPF_STATS_RUN_TIME - PERF_RECORD_LOST - PERF_RECORD_SAMPLE - AT_FDCWD - RENAME_NOREPLACE - SO_ATTACH_BPF - SO_DETACH_BPF - SOL_SOCKET - SIGPROF - SIG_BLOCK - SIG_UNBLOCK - EM_NONE - EM_BPF - BPF_FS_MAGIC - TRACEFS_MAGIC - DEBUGFS_MAGIC - BPF_RB_NO_WAKEUP - BPF_RB_FORCE_WAKEUP - BPF_F_LOCK -) - -type Statfs_t struct { - Type int64 - Bsize int64 - Blocks uint64 - Bfree uint64 - Bavail uint64 - Files uint64 - Ffree uint64 - Fsid [2]int32 - Namelen int64 - Frsize int64 - Flags int64 - Spare [4]int64 -} - -type Stat_t struct { - Dev uint64 - Ino uint64 - Nlink uint64 - Mode uint32 - Uid uint32 - Gid uint32 - _ int32 - Rdev uint64 - Size int64 - Blksize int64 - Blocks int64 -} - -type Rlimit struct { - Cur uint64 - Max uint64 -} - -type Signal int - -type Sigset_t struct { - Val [4]uint64 -} - -func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { - return 0, 0, syscall.ENOTSUP -} - -func PthreadSigmask(how int, set, oldset *Sigset_t) error { - return errNonLinux -} - -func FcntlInt(fd uintptr, cmd, arg int) (int, error) { - return -1, errNonLinux -} - -func IoctlSetInt(fd int, req uint, value int) error { - return errNonLinux -} - -func Statfs(path string, buf *Statfs_t) error { - return errNonLinux -} - -func Close(fd int) (err error) { - return errNonLinux -} - -type EpollEvent struct { - Events uint32 - Fd int32 - Pad int32 -} - -func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { - return 0, errNonLinux -} - -func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) { - return errNonLinux -} - -func Eventfd(initval uint, flags int) (fd int, err error) { - return 0, errNonLinux -} - -func Write(fd int, p []byte) (n int, err error) { - return 0, errNonLinux -} - -func EpollCreate1(flag int) (fd int, err error) { - return 0, errNonLinux -} - -type PerfEventMmapPage struct { - Version uint32 - Compat_version uint32 - Lock uint32 - Index uint32 - Offset int64 - Time_enabled uint64 - Time_running uint64 - Capabilities uint64 - Pmc_width uint16 - Time_shift uint16 - Time_mult uint32 - Time_offset uint64 - Time_zero uint64 - Size uint32 - - Data_head uint64 - Data_tail uint64 - Data_offset uint64 - Data_size uint64 - Aux_head uint64 - Aux_tail uint64 - Aux_offset uint64 - Aux_size uint64 -} - -func SetNonblock(fd int, nonblocking bool) (err error) { - return errNonLinux -} - -func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) { - return []byte{}, errNonLinux -} - -func Munmap(b []byte) (err error) { - return errNonLinux -} - -type PerfEventAttr struct { - Type uint32 - Size uint32 - Config uint64 - Sample uint64 - Sample_type uint64 - Read_format uint64 - Bits uint64 - Wakeup uint32 - Bp_type uint32 - Ext1 uint64 - Ext2 uint64 - Branch_sample_type uint64 - Sample_regs_user uint64 - Sample_stack_user uint32 - Clockid int32 - Sample_regs_intr uint64 - Aux_watermark uint32 - Sample_max_stack uint16 -} - -func PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error) { - return 0, errNonLinux -} - -type Utsname struct { - Release [65]byte - Version [65]byte -} - -func Uname(buf *Utsname) (err error) { - return errNonLinux -} - -func Getpid() int { - return -1 -} - -func Gettid() int { - return -1 -} - -func Tgkill(tgid int, tid int, sig syscall.Signal) (err error) { - return errNonLinux -} - -func BytePtrFromString(s string) (*byte, error) { - return nil, errNonLinux -} - -func ByteSliceToString(s []byte) string { - return "" -} - -func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) error { - return errNonLinux -} - -func Prlimit(pid, resource int, new, old *Rlimit) error { - return errNonLinux -} - -func Open(path string, mode int, perm uint32) (int, error) { - return -1, errNonLinux -} - -func Fstat(fd int, stat *Stat_t) error { - return errNonLinux -} - -func SetsockoptInt(fd, level, opt, value int) error { - return errNonLinux -} - -type CPUSet struct{} - -func (*CPUSet) Set(int) {} - -func SchedSetaffinity(pid int, set *CPUSet) error { - return errNonLinux -} - -func SchedGetaffinity(pid int, set *CPUSet) error { - return errNonLinux -} diff --git a/vendor/github.com/cilium/ebpf/internal/vdso.go b/vendor/github.com/cilium/ebpf/internal/vdso.go deleted file mode 100644 index 104927855..000000000 --- a/vendor/github.com/cilium/ebpf/internal/vdso.go +++ /dev/null @@ -1,143 +0,0 @@ -package internal - -import ( - "debug/elf" - "encoding/binary" - "errors" - "fmt" - "io" - "math" - "os" - - "github.com/cilium/ebpf/internal/unix" -) - -var ( - errAuxvNoVDSO = errors.New("no vdso address found in auxv") -) - -// vdsoVersion returns the LINUX_VERSION_CODE embedded in the vDSO library -// linked into the current process image. -func vdsoVersion() (uint32, error) { - av, err := newAuxvRuntimeReader() - if err != nil { - return 0, err - } - - defer av.Close() - - vdsoAddr, err := vdsoMemoryAddress(av) - if err != nil { - return 0, fmt.Errorf("finding vDSO memory address: %w", err) - } - - // Use /proc/self/mem rather than unsafe.Pointer tricks. - mem, err := os.Open("/proc/self/mem") - if err != nil { - return 0, fmt.Errorf("opening mem: %w", err) - } - defer mem.Close() - - // Open ELF at provided memory address, as offset into /proc/self/mem. - c, err := vdsoLinuxVersionCode(io.NewSectionReader(mem, int64(vdsoAddr), math.MaxInt64)) - if err != nil { - return 0, fmt.Errorf("reading linux version code: %w", err) - } - - return c, nil -} - -// vdsoMemoryAddress returns the memory address of the vDSO library -// linked into the current process image. r is an io.Reader into an auxv blob. -func vdsoMemoryAddress(r auxvPairReader) (uintptr, error) { - // Loop through all tag/value pairs in auxv until we find `AT_SYSINFO_EHDR`, - // the address of a page containing the virtual Dynamic Shared Object (vDSO). - for { - tag, value, err := r.ReadAuxvPair() - if err != nil { - return 0, err - } - - switch tag { - case _AT_SYSINFO_EHDR: - if value != 0 { - return uintptr(value), nil - } - return 0, fmt.Errorf("invalid vDSO address in auxv") - // _AT_NULL is always the last tag/val pair in the aux vector - // and can be treated like EOF. - case _AT_NULL: - return 0, errAuxvNoVDSO - } - } -} - -// format described at https://www.man7.org/linux/man-pages/man5/elf.5.html in section 'Notes (Nhdr)' -type elfNoteHeader struct { - NameSize int32 - DescSize int32 - Type int32 -} - -// vdsoLinuxVersionCode returns the LINUX_VERSION_CODE embedded in -// the ELF notes section of the binary provided by the reader. -func vdsoLinuxVersionCode(r io.ReaderAt) (uint32, error) { - hdr, err := NewSafeELFFile(r) - if err != nil { - return 0, fmt.Errorf("reading vDSO ELF: %w", err) - } - - sections := hdr.SectionsByType(elf.SHT_NOTE) - if len(sections) == 0 { - return 0, fmt.Errorf("no note section found in vDSO ELF") - } - - for _, sec := range sections { - sr := sec.Open() - var n elfNoteHeader - - // Read notes until we find one named 'Linux'. - for { - if err := binary.Read(sr, hdr.ByteOrder, &n); err != nil { - if errors.Is(err, io.EOF) { - // We looked at all the notes in this section - break - } - return 0, fmt.Errorf("reading note header: %w", err) - } - - // If a note name is defined, it follows the note header. - var name string - if n.NameSize > 0 { - // Read the note name, aligned to 4 bytes. - buf := make([]byte, Align(n.NameSize, 4)) - if err := binary.Read(sr, hdr.ByteOrder, &buf); err != nil { - return 0, fmt.Errorf("reading note name: %w", err) - } - - // Read nul-terminated string. - name = unix.ByteSliceToString(buf[:n.NameSize]) - } - - // If a note descriptor is defined, it follows the name. - // It is possible for a note to have a descriptor but not a name. - if n.DescSize > 0 { - // LINUX_VERSION_CODE is a uint32 value. - if name == "Linux" && n.DescSize == 4 && n.Type == 0 { - var version uint32 - if err := binary.Read(sr, hdr.ByteOrder, &version); err != nil { - return 0, fmt.Errorf("reading note descriptor: %w", err) - } - return version, nil - } - - // Discard the note descriptor if it exists but we're not interested in it. - if _, err := io.CopyN(io.Discard, sr, int64(Align(n.DescSize, 4))); err != nil { - return 0, err - } - } - } - } - - return 0, fmt.Errorf("no Linux note in ELF") -} diff --git a/vendor/github.com/cilium/ebpf/internal/version.go b/vendor/github.com/cilium/ebpf/internal/version.go deleted file mode 100644 index acd4650af..000000000 --- a/vendor/github.com/cilium/ebpf/internal/version.go +++ /dev/null @@ -1,107 +0,0 @@ -package internal - -import ( - "fmt" - "sync" - - "github.com/cilium/ebpf/internal/unix" -) - -const ( - // Version constant used in ELF binaries indicating that the loader needs to - // substitute the eBPF program's version with the value of the kernel's - // KERNEL_VERSION compile-time macro. Used for compatibility with BCC, gobpf - // and RedSift. - MagicKernelVersion = 0xFFFFFFFE -) - -// A Version in the form Major.Minor.Patch. -type Version [3]uint16 - -// NewVersion creates a version from a string like "Major.Minor.Patch". -// -// Patch is optional. -func NewVersion(ver string) (Version, error) { - var major, minor, patch uint16 - n, _ := fmt.Sscanf(ver, "%d.%d.%d", &major, &minor, &patch) - if n < 2 { - return Version{}, fmt.Errorf("invalid version: %s", ver) - } - return Version{major, minor, patch}, nil -} - -// NewVersionFromCode creates a version from a LINUX_VERSION_CODE. -func NewVersionFromCode(code uint32) Version { - return Version{ - uint16(uint8(code >> 16)), - uint16(uint8(code >> 8)), - uint16(uint8(code)), - } -} - -func (v Version) String() string { - if v[2] == 0 { - return fmt.Sprintf("v%d.%d", v[0], v[1]) - } - return fmt.Sprintf("v%d.%d.%d", v[0], v[1], v[2]) -} - -// Less returns true if the version is less than another version. -func (v Version) Less(other Version) bool { - for i, a := range v { - if a == other[i] { - continue - } - return a < other[i] - } - return false -} - -// Unspecified returns true if the version is all zero. -func (v Version) Unspecified() bool { - return v[0] == 0 && v[1] == 0 && v[2] == 0 -} - -// Kernel implements the kernel's KERNEL_VERSION macro from linux/version.h. -// It represents the kernel version and patch level as a single value. -func (v Version) Kernel() uint32 { - - // Kernels 4.4 and 4.9 have their SUBLEVEL clamped to 255 to avoid - // overflowing into PATCHLEVEL. - // See kernel commit 9b82f13e7ef3 ("kbuild: clamp SUBLEVEL to 255"). - s := v[2] - if s > 255 { - s = 255 - } - - // Truncate members to uint8 to prevent them from spilling over into - // each other when overflowing 8 bits. - return uint32(uint8(v[0]))<<16 | uint32(uint8(v[1]))<<8 | uint32(uint8(s)) -} - -// KernelVersion returns the version of the currently running kernel. -var KernelVersion = sync.OnceValues(func() (Version, error) { - return detectKernelVersion() -}) - -// detectKernelVersion returns the version of the running kernel. -func detectKernelVersion() (Version, error) { - vc, err := vdsoVersion() - if err != nil { - return Version{}, err - } - return NewVersionFromCode(vc), nil -} - -// KernelRelease returns the release string of the running kernel. -// Its format depends on the Linux distribution and corresponds to directory -// names in /lib/modules by convention. Some examples are 5.15.17-1-lts and -// 4.19.0-16-amd64. -func KernelRelease() (string, error) { - var uname unix.Utsname - if err := unix.Uname(&uname); err != nil { - return "", fmt.Errorf("uname failed: %w", err) - } - - return unix.ByteSliceToString(uname.Release[:]), nil -} diff --git a/vendor/github.com/cilium/ebpf/link/anchor.go b/vendor/github.com/cilium/ebpf/link/anchor.go deleted file mode 100644 index 1a3b5f768..000000000 --- a/vendor/github.com/cilium/ebpf/link/anchor.go +++ /dev/null @@ -1,137 +0,0 @@ -package link - -import ( - "fmt" - - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/internal/sys" -) - -const anchorFlags = sys.BPF_F_REPLACE | - sys.BPF_F_BEFORE | - sys.BPF_F_AFTER | - sys.BPF_F_ID | - sys.BPF_F_LINK_MPROG - -// Anchor is a reference to a link or program. -// -// It is used to describe where an attachment or detachment should take place -// for link types which support multiple attachment. -type Anchor interface { - // anchor returns an fd or ID and a set of flags. - // - // By default fdOrID is taken to reference a program, but BPF_F_LINK_MPROG - // changes this to refer to a link instead. - // - // BPF_F_BEFORE, BPF_F_AFTER, BPF_F_REPLACE modify where a link or program - // is attached. The default behaviour if none of these flags is specified - // matches BPF_F_AFTER. - anchor() (fdOrID, flags uint32, _ error) -} - -type firstAnchor struct{} - -func (firstAnchor) anchor() (fdOrID, flags uint32, _ error) { - return 0, sys.BPF_F_BEFORE, nil -} - -// Head is the position before all other programs or links. -func Head() Anchor { - return firstAnchor{} -} - -type lastAnchor struct{} - -func (lastAnchor) anchor() (fdOrID, flags uint32, _ error) { - return 0, sys.BPF_F_AFTER, nil -} - -// Tail is the position after all other programs or links. -func Tail() Anchor { - return lastAnchor{} -} - -// Before is the position just in front of target. -func BeforeLink(target Link) Anchor { - return anchor{target, sys.BPF_F_BEFORE} -} - -// After is the position just after target. -func AfterLink(target Link) Anchor { - return anchor{target, sys.BPF_F_AFTER} -} - -// Before is the position just in front of target. -func BeforeLinkByID(target ID) Anchor { - return anchor{target, sys.BPF_F_BEFORE} -} - -// After is the position just after target. -func AfterLinkByID(target ID) Anchor { - return anchor{target, sys.BPF_F_AFTER} -} - -// Before is the position just in front of target. -func BeforeProgram(target *ebpf.Program) Anchor { - return anchor{target, sys.BPF_F_BEFORE} -} - -// After is the position just after target. -func AfterProgram(target *ebpf.Program) Anchor { - return anchor{target, sys.BPF_F_AFTER} -} - -// Replace the target itself. -func ReplaceProgram(target *ebpf.Program) Anchor { - return anchor{target, sys.BPF_F_REPLACE} -} - -// Before is the position just in front of target. -func BeforeProgramByID(target ebpf.ProgramID) Anchor { - return anchor{target, sys.BPF_F_BEFORE} -} - -// After is the position just after target. -func AfterProgramByID(target ebpf.ProgramID) Anchor { - return anchor{target, sys.BPF_F_AFTER} -} - -// Replace the target itself. -func ReplaceProgramByID(target ebpf.ProgramID) Anchor { - return anchor{target, sys.BPF_F_REPLACE} -} - -type anchor struct { - target any - position uint32 -} - -func (ap anchor) anchor() (fdOrID, flags uint32, _ error) { - var typeFlag uint32 - switch target := ap.target.(type) { - case *ebpf.Program: - fd := target.FD() - if fd < 0 { - return 0, 0, sys.ErrClosedFd - } - fdOrID = uint32(fd) - typeFlag = 0 - case ebpf.ProgramID: - fdOrID = uint32(target) - typeFlag = sys.BPF_F_ID - case interface{ FD() int }: - fd := target.FD() - if fd < 0 { - return 0, 0, sys.ErrClosedFd - } - fdOrID = uint32(fd) - typeFlag = sys.BPF_F_LINK_MPROG - case ID: - fdOrID = uint32(target) - typeFlag = sys.BPF_F_LINK_MPROG | sys.BPF_F_ID - default: - return 0, 0, fmt.Errorf("invalid target %T", ap.target) - } - - return fdOrID, ap.position | typeFlag, nil -} diff --git a/vendor/github.com/cilium/ebpf/link/cgroup.go b/vendor/github.com/cilium/ebpf/link/cgroup.go deleted file mode 100644 index 79f3d2b7f..000000000 --- a/vendor/github.com/cilium/ebpf/link/cgroup.go +++ /dev/null @@ -1,189 +0,0 @@ -package link - -import ( - "errors" - "fmt" - "os" - - "github.com/cilium/ebpf" -) - -type cgroupAttachFlags uint32 - -const ( - // Allow programs attached to sub-cgroups to override the verdict of this - // program. - flagAllowOverride cgroupAttachFlags = 1 << iota - // Allow attaching multiple programs to the cgroup. Only works if the cgroup - // has zero or more programs attached using the Multi flag. Implies override. - flagAllowMulti - // Set automatically by progAttachCgroup.Update(). Used for updating a - // specific given program attached in multi-mode. - flagReplace -) - -type CgroupOptions struct { - // Path to a cgroupv2 folder. - Path string - // One of the AttachCgroup* constants - Attach ebpf.AttachType - // Program must be of type CGroup*, and the attach type must match Attach. - Program *ebpf.Program -} - -// AttachCgroup links a BPF program to a cgroup. -// -// If the running kernel doesn't support bpf_link, attempts to emulate its -// semantics using the legacy PROG_ATTACH mechanism. If bpf_link is not -// available, the returned [Link] will not support pinning to bpffs. -// -// If you need more control over attachment flags or the attachment mechanism -// used, look at [RawAttachProgram] and [AttachRawLink] instead. -func AttachCgroup(opts CgroupOptions) (cg Link, err error) { - cgroup, err := os.Open(opts.Path) - if err != nil { - return nil, fmt.Errorf("can't open cgroup: %s", err) - } - defer func() { - if _, ok := cg.(*progAttachCgroup); ok { - // Skip closing the cgroup handle if we return a valid progAttachCgroup, - // where the handle is retained to implement Update(). - return - } - cgroup.Close() - }() - - cg, err = newLinkCgroup(cgroup, opts.Attach, opts.Program) - if err == nil { - return cg, nil - } - - if errors.Is(err, ErrNotSupported) { - cg, err = newProgAttachCgroup(cgroup, opts.Attach, opts.Program, flagAllowMulti) - } - if errors.Is(err, ErrNotSupported) { - cg, err = newProgAttachCgroup(cgroup, opts.Attach, opts.Program, flagAllowOverride) - } - if err != nil { - return nil, err - } - - return cg, nil -} - -type progAttachCgroup struct { - cgroup *os.File - current *ebpf.Program - attachType ebpf.AttachType - flags cgroupAttachFlags -} - -var _ Link = (*progAttachCgroup)(nil) - -func (cg *progAttachCgroup) isLink() {} - -// newProgAttachCgroup attaches prog to cgroup using BPF_PROG_ATTACH. -// cgroup and prog are retained by [progAttachCgroup]. -func newProgAttachCgroup(cgroup *os.File, attach ebpf.AttachType, prog *ebpf.Program, flags cgroupAttachFlags) (*progAttachCgroup, error) { - if flags&flagAllowMulti > 0 { - if err := haveProgAttachReplace(); err != nil { - return nil, fmt.Errorf("can't support multiple programs: %w", err) - } - } - - // Use a program handle that cannot be closed by the caller. - clone, err := prog.Clone() - if err != nil { - return nil, err - } - - err = RawAttachProgram(RawAttachProgramOptions{ - Target: int(cgroup.Fd()), - Program: clone, - Flags: uint32(flags), - Attach: attach, - }) - if err != nil { - clone.Close() - return nil, fmt.Errorf("cgroup: %w", err) - } - - return &progAttachCgroup{cgroup, clone, attach, flags}, nil -} - -func (cg *progAttachCgroup) Close() error { - defer cg.cgroup.Close() - defer cg.current.Close() - - err := RawDetachProgram(RawDetachProgramOptions{ - Target: int(cg.cgroup.Fd()), - Program: cg.current, - Attach: cg.attachType, - }) - if err != nil { - return fmt.Errorf("close cgroup: %s", err) - } - return nil -} - -func (cg *progAttachCgroup) Update(prog *ebpf.Program) error { - new, err := prog.Clone() - if err != nil { - return err - } - - args := RawAttachProgramOptions{ - Target: int(cg.cgroup.Fd()), - Program: prog, - Attach: cg.attachType, - Flags: uint32(cg.flags), - } - - if cg.flags&flagAllowMulti > 0 { - // Atomically replacing multiple programs requires at least - // 5.5 (commit 7dd68b3279f17921 "bpf: Support replacing cgroup-bpf - // program in MULTI mode") - args.Anchor = ReplaceProgram(cg.current) - } - - if err := RawAttachProgram(args); err != nil { - new.Close() - return fmt.Errorf("can't update cgroup: %s", err) - } - - cg.current.Close() - cg.current = new - return nil -} - -func (cg *progAttachCgroup) Pin(string) error { - return fmt.Errorf("can't pin cgroup: %w", ErrNotSupported) -} - -func (cg *progAttachCgroup) Unpin() error { - return fmt.Errorf("can't unpin cgroup: %w", ErrNotSupported) -} - -func (cg *progAttachCgroup) Info() (*Info, error) { - return nil, fmt.Errorf("can't get cgroup info: %w", ErrNotSupported) -} - -type linkCgroup struct { - RawLink -} - -var _ Link = (*linkCgroup)(nil) - -// newLinkCgroup attaches prog to cgroup using BPF_LINK_CREATE. -func newLinkCgroup(cgroup *os.File, attach ebpf.AttachType, prog *ebpf.Program) (*linkCgroup, error) { - link, err := AttachRawLink(RawLinkOptions{ - Target: int(cgroup.Fd()), - Program: prog, - Attach: attach, - }) - if err != nil { - return nil, err - } - - return &linkCgroup{*link}, err -} diff --git a/vendor/github.com/cilium/ebpf/link/doc.go b/vendor/github.com/cilium/ebpf/link/doc.go deleted file mode 100644 index 2bde35ed7..000000000 --- a/vendor/github.com/cilium/ebpf/link/doc.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package link allows attaching eBPF programs to various kernel hooks. -package link diff --git a/vendor/github.com/cilium/ebpf/link/iter.go b/vendor/github.com/cilium/ebpf/link/iter.go deleted file mode 100644 index 0a39faef8..000000000 --- a/vendor/github.com/cilium/ebpf/link/iter.go +++ /dev/null @@ -1,84 +0,0 @@ -package link - -import ( - "fmt" - "io" - "unsafe" - - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/internal/sys" -) - -type IterOptions struct { - // Program must be of type Tracing with attach type - // AttachTraceIter. The kind of iterator to attach to is - // determined at load time via the AttachTo field. - // - // AttachTo requires the kernel to include BTF of itself, - // and it to be compiled with a recent pahole (>= 1.16). - Program *ebpf.Program - - // Map specifies the target map for bpf_map_elem and sockmap iterators. - // It may be nil. - Map *ebpf.Map -} - -// AttachIter attaches a BPF seq_file iterator. -func AttachIter(opts IterOptions) (*Iter, error) { - progFd := opts.Program.FD() - if progFd < 0 { - return nil, fmt.Errorf("invalid program: %s", sys.ErrClosedFd) - } - - var info bpfIterLinkInfoMap - if opts.Map != nil { - mapFd := opts.Map.FD() - if mapFd < 0 { - return nil, fmt.Errorf("invalid map: %w", sys.ErrClosedFd) - } - info.map_fd = uint32(mapFd) - } - - attr := sys.LinkCreateIterAttr{ - ProgFd: uint32(progFd), - AttachType: sys.AttachType(ebpf.AttachTraceIter), - IterInfo: sys.NewPointer(unsafe.Pointer(&info)), - IterInfoLen: uint32(unsafe.Sizeof(info)), - } - - fd, err := sys.LinkCreateIter(&attr) - if err != nil { - if haveFeatErr := haveBPFLink(); haveFeatErr != nil { - return nil, haveFeatErr - } - return nil, fmt.Errorf("can't link iterator: %w", err) - } - - return &Iter{RawLink{fd, ""}}, err -} - -// Iter represents an attached bpf_iter. -type Iter struct { - RawLink -} - -// Open creates a new instance of the iterator. -// -// Reading from the returned reader triggers the BPF program. -func (it *Iter) Open() (io.ReadCloser, error) { - attr := &sys.IterCreateAttr{ - LinkFd: it.fd.Uint(), - } - - fd, err := sys.IterCreate(attr) - if err != nil { - return nil, fmt.Errorf("can't create iterator: %w", err) - } - - return fd.File("bpf_iter"), nil -} - -// union bpf_iter_link_info.map -type bpfIterLinkInfoMap struct { - map_fd uint32 -} diff --git a/vendor/github.com/cilium/ebpf/link/kprobe.go b/vendor/github.com/cilium/ebpf/link/kprobe.go deleted file mode 100644 index b54ca9085..000000000 --- a/vendor/github.com/cilium/ebpf/link/kprobe.go +++ /dev/null @@ -1,357 +0,0 @@ -package link - -import ( - "errors" - "fmt" - "os" - "runtime" - "strings" - "unsafe" - - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/internal" - "github.com/cilium/ebpf/internal/sys" - "github.com/cilium/ebpf/internal/tracefs" - "github.com/cilium/ebpf/internal/unix" -) - -// KprobeOptions defines additional parameters that will be used -// when loading Kprobes. -type KprobeOptions struct { - // Arbitrary value that can be fetched from an eBPF program - // via `bpf_get_attach_cookie()`. - // - // Needs kernel 5.15+. - Cookie uint64 - // Offset of the kprobe relative to the traced symbol. - // Can be used to insert kprobes at arbitrary offsets in kernel functions, - // e.g. in places where functions have been inlined. - Offset uint64 - // Increase the maximum number of concurrent invocations of a kretprobe. - // Required when tracing some long running functions in the kernel. - // - // Deprecated: this setting forces the use of an outdated kernel API and is not portable - // across kernel versions. - RetprobeMaxActive int - // Prefix used for the event name if the kprobe must be attached using tracefs. - // The group name will be formatted as `_`. - // The default empty string is equivalent to "ebpf" as the prefix. - TraceFSPrefix string -} - -func (ko *KprobeOptions) cookie() uint64 { - if ko == nil { - return 0 - } - return ko.Cookie -} - -// Kprobe attaches the given eBPF program to a perf event that fires when the -// given kernel symbol starts executing. See /proc/kallsyms for available -// symbols. For example, printk(): -// -// kp, err := Kprobe("printk", prog, nil) -// -// Losing the reference to the resulting Link (kp) will close the Kprobe -// and prevent further execution of prog. The Link must be Closed during -// program shutdown to avoid leaking system resources. -// -// If attaching to symbol fails, automatically retries with the running -// platform's syscall prefix (e.g. __x64_) to support attaching to syscalls -// in a portable fashion. -func Kprobe(symbol string, prog *ebpf.Program, opts *KprobeOptions) (Link, error) { - k, err := kprobe(symbol, prog, opts, false) - if err != nil { - return nil, err - } - - lnk, err := attachPerfEvent(k, prog, opts.cookie()) - if err != nil { - k.Close() - return nil, err - } - - return lnk, nil -} - -// Kretprobe attaches the given eBPF program to a perf event that fires right -// before the given kernel symbol exits, with the function stack left intact. -// See /proc/kallsyms for available symbols. For example, printk(): -// -// kp, err := Kretprobe("printk", prog, nil) -// -// Losing the reference to the resulting Link (kp) will close the Kretprobe -// and prevent further execution of prog. The Link must be Closed during -// program shutdown to avoid leaking system resources. -// -// If attaching to symbol fails, automatically retries with the running -// platform's syscall prefix (e.g. __x64_) to support attaching to syscalls -// in a portable fashion. -// -// On kernels 5.10 and earlier, setting a kretprobe on a nonexistent symbol -// incorrectly returns unix.EINVAL instead of os.ErrNotExist. -func Kretprobe(symbol string, prog *ebpf.Program, opts *KprobeOptions) (Link, error) { - k, err := kprobe(symbol, prog, opts, true) - if err != nil { - return nil, err - } - - lnk, err := attachPerfEvent(k, prog, opts.cookie()) - if err != nil { - k.Close() - return nil, err - } - - return lnk, nil -} - -// isValidKprobeSymbol implements the equivalent of a regex match -// against "^[a-zA-Z_][0-9a-zA-Z_.]*$". -func isValidKprobeSymbol(s string) bool { - if len(s) < 1 { - return false - } - - for i, c := range []byte(s) { - switch { - case c >= 'a' && c <= 'z': - case c >= 'A' && c <= 'Z': - case c == '_': - case i > 0 && c >= '0' && c <= '9': - - // Allow `.` in symbol name. GCC-compiled kernel may change symbol name - // to have a `.isra.$n` suffix, like `udp_send_skb.isra.52`. - // See: https://gcc.gnu.org/gcc-10/changes.html - case i > 0 && c == '.': - - default: - return false - } - } - - return true -} - -// kprobe opens a perf event on the given symbol and attaches prog to it. -// If ret is true, create a kretprobe. -func kprobe(symbol string, prog *ebpf.Program, opts *KprobeOptions, ret bool) (*perfEvent, error) { - if symbol == "" { - return nil, fmt.Errorf("symbol name cannot be empty: %w", errInvalidInput) - } - if prog == nil { - return nil, fmt.Errorf("prog cannot be nil: %w", errInvalidInput) - } - if !isValidKprobeSymbol(symbol) { - return nil, fmt.Errorf("symbol '%s' must be a valid symbol in /proc/kallsyms: %w", symbol, errInvalidInput) - } - if prog.Type() != ebpf.Kprobe { - return nil, fmt.Errorf("eBPF program type %s is not a Kprobe: %w", prog.Type(), errInvalidInput) - } - - args := tracefs.ProbeArgs{ - Type: tracefs.Kprobe, - Pid: perfAllThreads, - Symbol: symbol, - Ret: ret, - } - - if opts != nil { - args.RetprobeMaxActive = opts.RetprobeMaxActive - args.Cookie = opts.Cookie - args.Offset = opts.Offset - args.Group = opts.TraceFSPrefix - } - - // Use kprobe PMU if the kernel has it available. - tp, err := pmuProbe(args) - if errors.Is(err, os.ErrNotExist) || errors.Is(err, unix.EINVAL) { - if prefix := internal.PlatformPrefix(); prefix != "" { - args.Symbol = prefix + symbol - tp, err = pmuProbe(args) - } - } - if err == nil { - return tp, nil - } - if err != nil && !errors.Is(err, ErrNotSupported) { - return nil, fmt.Errorf("creating perf_kprobe PMU (arch-specific fallback for %q): %w", symbol, err) - } - - // Use tracefs if kprobe PMU is missing. - args.Symbol = symbol - tp, err = tracefsProbe(args) - if errors.Is(err, os.ErrNotExist) || errors.Is(err, unix.EINVAL) { - if prefix := internal.PlatformPrefix(); prefix != "" { - args.Symbol = prefix + symbol - tp, err = tracefsProbe(args) - } - } - if err != nil { - return nil, fmt.Errorf("creating tracefs event (arch-specific fallback for %q): %w", symbol, err) - } - - return tp, nil -} - -// pmuProbe opens a perf event based on a Performance Monitoring Unit. -// -// Requires at least a 4.17 kernel. -// e12f03d7031a "perf/core: Implement the 'perf_kprobe' PMU" -// 33ea4b24277b "perf/core: Implement the 'perf_uprobe' PMU" -// -// Returns ErrNotSupported if the kernel doesn't support perf_[k,u]probe PMU -func pmuProbe(args tracefs.ProbeArgs) (*perfEvent, error) { - // Getting the PMU type will fail if the kernel doesn't support - // the perf_[k,u]probe PMU. - eventType, err := internal.ReadUint64FromFileOnce("%d\n", "/sys/bus/event_source/devices", args.Type.String(), "type") - if errors.Is(err, os.ErrNotExist) { - return nil, fmt.Errorf("%s: %w", args.Type, ErrNotSupported) - } - if err != nil { - return nil, err - } - - // Use tracefs if we want to set kretprobe's retprobeMaxActive. - if args.RetprobeMaxActive != 0 { - return nil, fmt.Errorf("pmu probe: non-zero retprobeMaxActive: %w", ErrNotSupported) - } - - var config uint64 - if args.Ret { - bit, err := internal.ReadUint64FromFileOnce("config:%d\n", "/sys/bus/event_source/devices", args.Type.String(), "/format/retprobe") - if err != nil { - return nil, err - } - config |= 1 << bit - } - - var ( - attr unix.PerfEventAttr - sp unsafe.Pointer - token string - ) - switch args.Type { - case tracefs.Kprobe: - // Create a pointer to a NUL-terminated string for the kernel. - sp, err = unsafeStringPtr(args.Symbol) - if err != nil { - return nil, err - } - - token = tracefs.KprobeToken(args) - - attr = unix.PerfEventAttr{ - // The minimum size required for PMU kprobes is PERF_ATTR_SIZE_VER1, - // since it added the config2 (Ext2) field. Use Ext2 as probe_offset. - Size: unix.PERF_ATTR_SIZE_VER1, - Type: uint32(eventType), // PMU event type read from sysfs - Ext1: uint64(uintptr(sp)), // Kernel symbol to trace - Ext2: args.Offset, // Kernel symbol offset - Config: config, // Retprobe flag - } - case tracefs.Uprobe: - sp, err = unsafeStringPtr(args.Path) - if err != nil { - return nil, err - } - - if args.RefCtrOffset != 0 { - config |= args.RefCtrOffset << uprobeRefCtrOffsetShift - } - - token = tracefs.UprobeToken(args) - - attr = unix.PerfEventAttr{ - // The minimum size required for PMU uprobes is PERF_ATTR_SIZE_VER1, - // since it added the config2 (Ext2) field. The Size field controls the - // size of the internal buffer the kernel allocates for reading the - // perf_event_attr argument from userspace. - Size: unix.PERF_ATTR_SIZE_VER1, - Type: uint32(eventType), // PMU event type read from sysfs - Ext1: uint64(uintptr(sp)), // Uprobe path - Ext2: args.Offset, // Uprobe offset - Config: config, // RefCtrOffset, Retprobe flag - } - } - - rawFd, err := unix.PerfEventOpen(&attr, args.Pid, 0, -1, unix.PERF_FLAG_FD_CLOEXEC) - - // On some old kernels, kprobe PMU doesn't allow `.` in symbol names and - // return -EINVAL. Return ErrNotSupported to allow falling back to tracefs. - // https://github.com/torvalds/linux/blob/94710cac0ef4/kernel/trace/trace_kprobe.c#L340-L343 - if errors.Is(err, unix.EINVAL) && strings.Contains(args.Symbol, ".") { - return nil, fmt.Errorf("token %s: older kernels don't accept dots: %w", token, ErrNotSupported) - } - // Since commit 97c753e62e6c, ENOENT is correctly returned instead of EINVAL - // when trying to create a retprobe for a missing symbol. - if errors.Is(err, os.ErrNotExist) { - return nil, fmt.Errorf("token %s: not found: %w", token, err) - } - // Since commit ab105a4fb894, EILSEQ is returned when a kprobe sym+offset is resolved - // to an invalid insn boundary. The exact conditions that trigger this error are - // arch specific however. - if errors.Is(err, unix.EILSEQ) { - return nil, fmt.Errorf("token %s: bad insn boundary: %w", token, os.ErrNotExist) - } - // Since at least commit cb9a19fe4aa51, ENOTSUPP is returned - // when attempting to set a uprobe on a trap instruction. - if errors.Is(err, sys.ENOTSUPP) { - return nil, fmt.Errorf("token %s: failed setting uprobe on offset %#x (possible trap insn): %w", token, args.Offset, err) - } - - if err != nil { - return nil, fmt.Errorf("token %s: opening perf event: %w", token, err) - } - - // Ensure the string pointer is not collected before PerfEventOpen returns. - runtime.KeepAlive(sp) - - fd, err := sys.NewFD(rawFd) - if err != nil { - return nil, err - } - - // Kernel has perf_[k,u]probe PMU available, initialize perf event. - return newPerfEvent(fd, nil), nil -} - -// tracefsProbe creates a trace event by writing an entry to /[k,u]probe_events. -// A new trace event group name is generated on every call to support creating -// multiple trace events for the same kernel or userspace symbol. -// Path and offset are only set in the case of uprobe(s) and are used to set -// the executable/library path on the filesystem and the offset where the probe is inserted. -// A perf event is then opened on the newly-created trace event and returned to the caller. -func tracefsProbe(args tracefs.ProbeArgs) (*perfEvent, error) { - groupPrefix := "ebpf" - if args.Group != "" { - groupPrefix = args.Group - } - - // Generate a random string for each trace event we attempt to create. - // This value is used as the 'group' token in tracefs to allow creating - // multiple kprobe trace events with the same name. - group, err := tracefs.RandomGroup(groupPrefix) - if err != nil { - return nil, fmt.Errorf("randomizing group name: %w", err) - } - args.Group = group - - // Create the [k,u]probe trace event using tracefs. - evt, err := tracefs.NewEvent(args) - if err != nil { - return nil, fmt.Errorf("creating probe entry on tracefs: %w", err) - } - - // Kprobes are ephemeral tracepoints and share the same perf event type. - fd, err := openTracepointPerfEvent(evt.ID(), args.Pid) - if err != nil { - // Make sure we clean up the created tracefs event when we return error. - // If a livepatch handler is already active on the symbol, the write to - // tracefs will succeed, a trace event will show up, but creating the - // perf event will fail with EBUSY. - _ = evt.Close() - return nil, err - } - - return newPerfEvent(fd, evt), nil -} diff --git a/vendor/github.com/cilium/ebpf/link/kprobe_multi.go b/vendor/github.com/cilium/ebpf/link/kprobe_multi.go deleted file mode 100644 index 4d364d80e..000000000 --- a/vendor/github.com/cilium/ebpf/link/kprobe_multi.go +++ /dev/null @@ -1,180 +0,0 @@ -package link - -import ( - "errors" - "fmt" - "os" - "unsafe" - - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/asm" - "github.com/cilium/ebpf/internal" - "github.com/cilium/ebpf/internal/sys" - "github.com/cilium/ebpf/internal/unix" -) - -// KprobeMultiOptions defines additional parameters that will be used -// when opening a KprobeMulti Link. -type KprobeMultiOptions struct { - // Symbols takes a list of kernel symbol names to attach an ebpf program to. - // - // Mutually exclusive with Addresses. - Symbols []string - - // Addresses takes a list of kernel symbol addresses in case they can not - // be referred to by name. - // - // Note that only start addresses can be specified, since the fprobe API - // limits the attach point to the function entry or return. - // - // Mutually exclusive with Symbols. - Addresses []uintptr - - // Cookies specifies arbitrary values that can be fetched from an eBPF - // program via `bpf_get_attach_cookie()`. - // - // If set, its length should be equal to the length of Symbols or Addresses. - // Each Cookie is assigned to the Symbol or Address specified at the - // corresponding slice index. - Cookies []uint64 -} - -// KprobeMulti attaches the given eBPF program to the entry point of a given set -// of kernel symbols. -// -// The difference with Kprobe() is that multi-kprobe accomplishes this in a -// single system call, making it significantly faster than attaching many -// probes one at a time. -// -// Requires at least Linux 5.18. -func KprobeMulti(prog *ebpf.Program, opts KprobeMultiOptions) (Link, error) { - return kprobeMulti(prog, opts, 0) -} - -// KretprobeMulti attaches the given eBPF program to the return point of a given -// set of kernel symbols. -// -// The difference with Kretprobe() is that multi-kprobe accomplishes this in a -// single system call, making it significantly faster than attaching many -// probes one at a time. -// -// Requires at least Linux 5.18. -func KretprobeMulti(prog *ebpf.Program, opts KprobeMultiOptions) (Link, error) { - return kprobeMulti(prog, opts, unix.BPF_F_KPROBE_MULTI_RETURN) -} - -func kprobeMulti(prog *ebpf.Program, opts KprobeMultiOptions, flags uint32) (Link, error) { - if prog == nil { - return nil, errors.New("cannot attach a nil program") - } - - syms := uint32(len(opts.Symbols)) - addrs := uint32(len(opts.Addresses)) - cookies := uint32(len(opts.Cookies)) - - if syms == 0 && addrs == 0 { - return nil, fmt.Errorf("one of Symbols or Addresses is required: %w", errInvalidInput) - } - if syms != 0 && addrs != 0 { - return nil, fmt.Errorf("Symbols and Addresses are mutually exclusive: %w", errInvalidInput) - } - if cookies > 0 && cookies != syms && cookies != addrs { - return nil, fmt.Errorf("Cookies must be exactly Symbols or Addresses in length: %w", errInvalidInput) - } - - attr := &sys.LinkCreateKprobeMultiAttr{ - ProgFd: uint32(prog.FD()), - AttachType: sys.BPF_TRACE_KPROBE_MULTI, - KprobeMultiFlags: flags, - } - - switch { - case syms != 0: - attr.Count = syms - attr.Syms = sys.NewStringSlicePointer(opts.Symbols) - - case addrs != 0: - attr.Count = addrs - attr.Addrs = sys.NewPointer(unsafe.Pointer(&opts.Addresses[0])) - } - - if cookies != 0 { - attr.Cookies = sys.NewPointer(unsafe.Pointer(&opts.Cookies[0])) - } - - fd, err := sys.LinkCreateKprobeMulti(attr) - if errors.Is(err, unix.ESRCH) { - return nil, fmt.Errorf("couldn't find one or more symbols: %w", os.ErrNotExist) - } - if errors.Is(err, unix.EINVAL) { - return nil, fmt.Errorf("%w (missing kernel symbol or prog's AttachType not AttachTraceKprobeMulti?)", err) - } - - if err != nil { - if haveFeatErr := haveBPFLinkKprobeMulti(); haveFeatErr != nil { - return nil, haveFeatErr - } - return nil, err - } - - return &kprobeMultiLink{RawLink{fd, ""}}, nil -} - -type kprobeMultiLink struct { - RawLink -} - -var _ Link = (*kprobeMultiLink)(nil) - -func (kml *kprobeMultiLink) Update(prog *ebpf.Program) error { - return fmt.Errorf("update kprobe_multi: %w", ErrNotSupported) -} - -func (kml *kprobeMultiLink) Pin(string) error { - return fmt.Errorf("pin kprobe_multi: %w", ErrNotSupported) -} - -func (kml *kprobeMultiLink) Unpin() error { - return fmt.Errorf("unpin kprobe_multi: %w", ErrNotSupported) -} - -var haveBPFLinkKprobeMulti = internal.NewFeatureTest("bpf_link_kprobe_multi", "5.18", func() error { - prog, err := ebpf.NewProgram(&ebpf.ProgramSpec{ - Name: "probe_kpm_link", - Type: ebpf.Kprobe, - Instructions: asm.Instructions{ - asm.Mov.Imm(asm.R0, 0), - asm.Return(), - }, - AttachType: ebpf.AttachTraceKprobeMulti, - License: "MIT", - }) - if errors.Is(err, unix.E2BIG) { - // Kernel doesn't support AttachType field. - return internal.ErrNotSupported - } - if err != nil { - return err - } - defer prog.Close() - - fd, err := sys.LinkCreateKprobeMulti(&sys.LinkCreateKprobeMultiAttr{ - ProgFd: uint32(prog.FD()), - AttachType: sys.BPF_TRACE_KPROBE_MULTI, - Count: 1, - Syms: sys.NewStringSlicePointer([]string{"vprintk"}), - }) - switch { - case errors.Is(err, unix.EINVAL): - return internal.ErrNotSupported - // If CONFIG_FPROBE isn't set. - case errors.Is(err, unix.EOPNOTSUPP): - return internal.ErrNotSupported - case err != nil: - return err - } - - fd.Close() - - return nil -}) diff --git a/vendor/github.com/cilium/ebpf/link/link.go b/vendor/github.com/cilium/ebpf/link/link.go deleted file mode 100644 index 81428568f..000000000 --- a/vendor/github.com/cilium/ebpf/link/link.go +++ /dev/null @@ -1,631 +0,0 @@ -package link - -import ( - "errors" - "fmt" - "os" - - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/btf" - "github.com/cilium/ebpf/internal" - "github.com/cilium/ebpf/internal/sys" -) - -var ErrNotSupported = internal.ErrNotSupported - -// Link represents a Program attached to a BPF hook. -type Link interface { - // Replace the current program with a new program. - // - // Passing a nil program is an error. May return an error wrapping ErrNotSupported. - Update(*ebpf.Program) error - - // Persist a link by pinning it into a bpffs. - // - // May return an error wrapping ErrNotSupported. - Pin(string) error - - // Undo a previous call to Pin. - // - // May return an error wrapping ErrNotSupported. - Unpin() error - - // Close frees resources. - // - // The link will be broken unless it has been successfully pinned. - // A link may continue past the lifetime of the process if Close is - // not called. - Close() error - - // Info returns metadata on a link. - // - // May return an error wrapping ErrNotSupported. - Info() (*Info, error) - - // Prevent external users from implementing this interface. - isLink() -} - -// NewLinkFromFD creates a link from a raw fd. -// -// Deprecated: use [NewFromFD] instead. -func NewLinkFromFD(fd int) (Link, error) { - return NewFromFD(fd) -} - -// NewFromFD creates a link from a raw fd. -// -// You should not use fd after calling this function. -func NewFromFD(fd int) (Link, error) { - sysFD, err := sys.NewFD(fd) - if err != nil { - return nil, err - } - - return wrapRawLink(&RawLink{fd: sysFD}) -} - -// NewFromID returns the link associated with the given id. -// -// Returns ErrNotExist if there is no link with the given id. -func NewFromID(id ID) (Link, error) { - getFdAttr := &sys.LinkGetFdByIdAttr{Id: id} - fd, err := sys.LinkGetFdById(getFdAttr) - if err != nil { - return nil, fmt.Errorf("get link fd from ID %d: %w", id, err) - } - - return wrapRawLink(&RawLink{fd, ""}) -} - -// LoadPinnedLink loads a link that was persisted into a bpffs. -func LoadPinnedLink(fileName string, opts *ebpf.LoadPinOptions) (Link, error) { - raw, err := loadPinnedRawLink(fileName, opts) - if err != nil { - return nil, err - } - - return wrapRawLink(raw) -} - -// wrap a RawLink in a more specific type if possible. -// -// The function takes ownership of raw and closes it on error. -func wrapRawLink(raw *RawLink) (_ Link, err error) { - defer func() { - if err != nil { - raw.Close() - } - }() - - info, err := raw.Info() - if err != nil { - return nil, err - } - - switch info.Type { - case RawTracepointType: - return &rawTracepoint{*raw}, nil - case TracingType: - return &tracing{*raw}, nil - case CgroupType: - return &linkCgroup{*raw}, nil - case IterType: - return &Iter{*raw}, nil - case NetNsType: - return &NetNsLink{*raw}, nil - case KprobeMultiType: - return &kprobeMultiLink{*raw}, nil - case UprobeMultiType: - return &uprobeMultiLink{*raw}, nil - case PerfEventType: - return nil, fmt.Errorf("recovering perf event fd: %w", ErrNotSupported) - case TCXType: - return &tcxLink{*raw}, nil - case NetfilterType: - return &netfilterLink{*raw}, nil - case NetkitType: - return &netkitLink{*raw}, nil - default: - return raw, nil - } -} - -// ID uniquely identifies a BPF link. -type ID = sys.LinkID - -// RawLinkOptions control the creation of a raw link. -type RawLinkOptions struct { - // File descriptor to attach to. This differs for each attach type. - Target int - // Program to attach. - Program *ebpf.Program - // Attach must match the attach type of Program. - Attach ebpf.AttachType - // BTF is the BTF of the attachment target. - BTF btf.TypeID - // Flags control the attach behaviour. - Flags uint32 -} - -// Info contains metadata on a link. -type Info struct { - Type Type - ID ID - Program ebpf.ProgramID - extra interface{} -} - -type TracingInfo struct { - AttachType sys.AttachType - TargetObjId uint32 - TargetBtfId sys.TypeID -} - -type CgroupInfo struct { - CgroupId uint64 - AttachType sys.AttachType - _ [4]byte -} - -type NetNsInfo struct { - NetnsIno uint32 - AttachType sys.AttachType -} - -type TCXInfo struct { - Ifindex uint32 - AttachType sys.AttachType -} - -type XDPInfo struct { - Ifindex uint32 -} - -type NetfilterInfo struct { - Pf uint32 - Hooknum uint32 - Priority int32 - Flags uint32 -} - -type NetkitInfo struct { - Ifindex uint32 - AttachType sys.AttachType -} - -type KprobeMultiInfo struct { - count uint32 - flags uint32 - missed uint64 -} - -// AddressCount is the number of addresses hooked by the kprobe. -func (kpm *KprobeMultiInfo) AddressCount() (uint32, bool) { - return kpm.count, kpm.count > 0 -} - -func (kpm *KprobeMultiInfo) Flags() (uint32, bool) { - return kpm.flags, kpm.count > 0 -} - -func (kpm *KprobeMultiInfo) Missed() (uint64, bool) { - return kpm.missed, kpm.count > 0 -} - -type PerfEventInfo struct { - Type sys.PerfEventType - extra interface{} -} - -func (r *PerfEventInfo) Kprobe() *KprobeInfo { - e, _ := r.extra.(*KprobeInfo) - return e -} - -type KprobeInfo struct { - address uint64 - missed uint64 -} - -func (kp *KprobeInfo) Address() (uint64, bool) { - return kp.address, kp.address > 0 -} - -func (kp *KprobeInfo) Missed() (uint64, bool) { - return kp.missed, kp.address > 0 -} - -// Tracing returns tracing type-specific link info. -// -// Returns nil if the type-specific link info isn't available. -func (r Info) Tracing() *TracingInfo { - e, _ := r.extra.(*TracingInfo) - return e -} - -// Cgroup returns cgroup type-specific link info. -// -// Returns nil if the type-specific link info isn't available. -func (r Info) Cgroup() *CgroupInfo { - e, _ := r.extra.(*CgroupInfo) - return e -} - -// NetNs returns netns type-specific link info. -// -// Returns nil if the type-specific link info isn't available. -func (r Info) NetNs() *NetNsInfo { - e, _ := r.extra.(*NetNsInfo) - return e -} - -// XDP returns XDP type-specific link info. -// -// Returns nil if the type-specific link info isn't available. -func (r Info) XDP() *XDPInfo { - e, _ := r.extra.(*XDPInfo) - return e -} - -// TCX returns TCX type-specific link info. -// -// Returns nil if the type-specific link info isn't available. -func (r Info) TCX() *TCXInfo { - e, _ := r.extra.(*TCXInfo) - return e -} - -// Netfilter returns netfilter type-specific link info. -// -// Returns nil if the type-specific link info isn't available. -func (r Info) Netfilter() *NetfilterInfo { - e, _ := r.extra.(*NetfilterInfo) - return e -} - -// Netkit returns netkit type-specific link info. -// -// Returns nil if the type-specific link info isn't available. -func (r Info) Netkit() *NetkitInfo { - e, _ := r.extra.(*NetkitInfo) - return e -} - -// KprobeMulti returns kprobe-multi type-specific link info. -// -// Returns nil if the type-specific link info isn't available. -func (r Info) KprobeMulti() *KprobeMultiInfo { - e, _ := r.extra.(*KprobeMultiInfo) - return e -} - -// PerfEvent returns perf-event type-specific link info. -// -// Returns nil if the type-specific link info isn't available. -func (r Info) PerfEvent() *PerfEventInfo { - e, _ := r.extra.(*PerfEventInfo) - return e -} - -// RawLink is the low-level API to bpf_link. -// -// You should consider using the higher level interfaces in this -// package instead. -type RawLink struct { - fd *sys.FD - pinnedPath string -} - -// AttachRawLink creates a raw link. -func AttachRawLink(opts RawLinkOptions) (*RawLink, error) { - if err := haveBPFLink(); err != nil { - return nil, err - } - - if opts.Target < 0 { - return nil, fmt.Errorf("invalid target: %s", sys.ErrClosedFd) - } - - progFd := opts.Program.FD() - if progFd < 0 { - return nil, fmt.Errorf("invalid program: %s", sys.ErrClosedFd) - } - - attr := sys.LinkCreateAttr{ - TargetFd: uint32(opts.Target), - ProgFd: uint32(progFd), - AttachType: sys.AttachType(opts.Attach), - TargetBtfId: opts.BTF, - Flags: opts.Flags, - } - fd, err := sys.LinkCreate(&attr) - if err != nil { - return nil, fmt.Errorf("create link: %w", err) - } - - return &RawLink{fd, ""}, nil -} - -func loadPinnedRawLink(fileName string, opts *ebpf.LoadPinOptions) (*RawLink, error) { - fd, err := sys.ObjGet(&sys.ObjGetAttr{ - Pathname: sys.NewStringPointer(fileName), - FileFlags: opts.Marshal(), - }) - if err != nil { - return nil, fmt.Errorf("load pinned link: %w", err) - } - - return &RawLink{fd, fileName}, nil -} - -func (l *RawLink) isLink() {} - -// FD returns the raw file descriptor. -func (l *RawLink) FD() int { - return l.fd.Int() -} - -// Close breaks the link. -// -// Use Pin if you want to make the link persistent. -func (l *RawLink) Close() error { - return l.fd.Close() -} - -// Pin persists a link past the lifetime of the process. -// -// Calling Close on a pinned Link will not break the link -// until the pin is removed. -func (l *RawLink) Pin(fileName string) error { - if err := internal.Pin(l.pinnedPath, fileName, l.fd); err != nil { - return err - } - l.pinnedPath = fileName - return nil -} - -// Unpin implements the Link interface. -func (l *RawLink) Unpin() error { - if err := internal.Unpin(l.pinnedPath); err != nil { - return err - } - l.pinnedPath = "" - return nil -} - -// IsPinned returns true if the Link has a non-empty pinned path. -func (l *RawLink) IsPinned() bool { - return l.pinnedPath != "" -} - -// Update implements the Link interface. -func (l *RawLink) Update(new *ebpf.Program) error { - return l.UpdateArgs(RawLinkUpdateOptions{ - New: new, - }) -} - -// RawLinkUpdateOptions control the behaviour of RawLink.UpdateArgs. -type RawLinkUpdateOptions struct { - New *ebpf.Program - Old *ebpf.Program - Flags uint32 -} - -// UpdateArgs updates a link based on args. -func (l *RawLink) UpdateArgs(opts RawLinkUpdateOptions) error { - newFd := opts.New.FD() - if newFd < 0 { - return fmt.Errorf("invalid program: %s", sys.ErrClosedFd) - } - - var oldFd int - if opts.Old != nil { - oldFd = opts.Old.FD() - if oldFd < 0 { - return fmt.Errorf("invalid replacement program: %s", sys.ErrClosedFd) - } - } - - attr := sys.LinkUpdateAttr{ - LinkFd: l.fd.Uint(), - NewProgFd: uint32(newFd), - OldProgFd: uint32(oldFd), - Flags: opts.Flags, - } - return sys.LinkUpdate(&attr) -} - -// Info returns metadata about the link. -func (l *RawLink) Info() (*Info, error) { - var info sys.LinkInfo - - if err := sys.ObjInfo(l.fd, &info); err != nil { - return nil, fmt.Errorf("link info: %s", err) - } - - var extra interface{} - switch info.Type { - case CgroupType: - var cgroupInfo sys.CgroupLinkInfo - if err := sys.ObjInfo(l.fd, &cgroupInfo); err != nil { - return nil, fmt.Errorf("cgroup link info: %s", err) - } - extra = &CgroupInfo{ - CgroupId: cgroupInfo.CgroupId, - AttachType: cgroupInfo.AttachType, - } - case NetNsType: - var netnsInfo sys.NetNsLinkInfo - if err := sys.ObjInfo(l.fd, &netnsInfo); err != nil { - return nil, fmt.Errorf("netns link info: %s", err) - } - extra = &NetNsInfo{ - NetnsIno: netnsInfo.NetnsIno, - AttachType: netnsInfo.AttachType, - } - case TracingType: - var tracingInfo sys.TracingLinkInfo - if err := sys.ObjInfo(l.fd, &tracingInfo); err != nil { - return nil, fmt.Errorf("tracing link info: %s", err) - } - extra = &TracingInfo{ - TargetObjId: tracingInfo.TargetObjId, - TargetBtfId: tracingInfo.TargetBtfId, - AttachType: tracingInfo.AttachType, - } - case XDPType: - var xdpInfo sys.XDPLinkInfo - if err := sys.ObjInfo(l.fd, &xdpInfo); err != nil { - return nil, fmt.Errorf("xdp link info: %s", err) - } - extra = &XDPInfo{ - Ifindex: xdpInfo.Ifindex, - } - case RawTracepointType, IterType, UprobeMultiType: - // Extra metadata not supported. - case TCXType: - var tcxInfo sys.TcxLinkInfo - if err := sys.ObjInfo(l.fd, &tcxInfo); err != nil { - return nil, fmt.Errorf("tcx link info: %s", err) - } - extra = &TCXInfo{ - Ifindex: tcxInfo.Ifindex, - AttachType: tcxInfo.AttachType, - } - case NetfilterType: - var netfilterInfo sys.NetfilterLinkInfo - if err := sys.ObjInfo(l.fd, &netfilterInfo); err != nil { - return nil, fmt.Errorf("netfilter link info: %s", err) - } - extra = &NetfilterInfo{ - Pf: netfilterInfo.Pf, - Hooknum: netfilterInfo.Hooknum, - Priority: netfilterInfo.Priority, - Flags: netfilterInfo.Flags, - } - case NetkitType: - var netkitInfo sys.NetkitLinkInfo - if err := sys.ObjInfo(l.fd, &netkitInfo); err != nil { - return nil, fmt.Errorf("tcx link info: %s", err) - } - extra = &NetkitInfo{ - Ifindex: netkitInfo.Ifindex, - AttachType: netkitInfo.AttachType, - } - case KprobeMultiType: - var kprobeMultiInfo sys.KprobeMultiLinkInfo - if err := sys.ObjInfo(l.fd, &kprobeMultiInfo); err != nil { - return nil, fmt.Errorf("kprobe multi link info: %s", err) - } - extra = &KprobeMultiInfo{ - count: kprobeMultiInfo.Count, - flags: kprobeMultiInfo.Flags, - missed: kprobeMultiInfo.Missed, - } - case PerfEventType: - var perfEventInfo sys.PerfEventLinkInfo - if err := sys.ObjInfo(l.fd, &perfEventInfo); err != nil { - return nil, fmt.Errorf("perf event link info: %s", err) - } - - var extra2 interface{} - switch perfEventInfo.PerfEventType { - case sys.BPF_PERF_EVENT_KPROBE, sys.BPF_PERF_EVENT_KRETPROBE: - var kprobeInfo sys.KprobeLinkInfo - if err := sys.ObjInfo(l.fd, &kprobeInfo); err != nil { - return nil, fmt.Errorf("kprobe multi link info: %s", err) - } - extra2 = &KprobeInfo{ - address: kprobeInfo.Addr, - missed: kprobeInfo.Missed, - } - } - - extra = &PerfEventInfo{ - Type: perfEventInfo.PerfEventType, - extra: extra2, - } - default: - return nil, fmt.Errorf("unknown link info type: %d", info.Type) - } - - return &Info{ - info.Type, - info.Id, - ebpf.ProgramID(info.ProgId), - extra, - }, nil -} - -// Iterator allows iterating over links attached into the kernel. -type Iterator struct { - // The ID of the current link. Only valid after a call to Next - ID ID - // The current link. Only valid until a call to Next. - // See Take if you want to retain the link. - Link Link - err error -} - -// Next retrieves the next link. -// -// Returns true if another link was found. Call [Iterator.Err] after the function returns false. -func (it *Iterator) Next() bool { - id := it.ID - for { - getIdAttr := &sys.LinkGetNextIdAttr{Id: id} - err := sys.LinkGetNextId(getIdAttr) - if errors.Is(err, os.ErrNotExist) { - // There are no more links. - break - } else if err != nil { - it.err = fmt.Errorf("get next link ID: %w", err) - break - } - - id = getIdAttr.NextId - l, err := NewFromID(id) - if errors.Is(err, os.ErrNotExist) { - // Couldn't load the link fast enough. Try next ID. - continue - } else if err != nil { - it.err = fmt.Errorf("get link for ID %d: %w", id, err) - break - } - - if it.Link != nil { - it.Link.Close() - } - it.ID, it.Link = id, l - return true - } - - // No more links or we encountered an error. - if it.Link != nil { - it.Link.Close() - } - it.Link = nil - return false -} - -// Take the ownership of the current link. -// -// It's the callers responsibility to close the link. -func (it *Iterator) Take() Link { - l := it.Link - it.Link = nil - return l -} - -// Err returns an error if iteration failed for some reason. -func (it *Iterator) Err() error { - return it.err -} - -func (it *Iterator) Close() { - if it.Link != nil { - it.Link.Close() - } -} diff --git a/vendor/github.com/cilium/ebpf/link/netfilter.go b/vendor/github.com/cilium/ebpf/link/netfilter.go deleted file mode 100644 index 250c87677..000000000 --- a/vendor/github.com/cilium/ebpf/link/netfilter.go +++ /dev/null @@ -1,70 +0,0 @@ -package link - -import ( - "fmt" - - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/internal/sys" -) - -const NetfilterIPDefrag NetfilterAttachFlags = 0 // Enable IP packet defragmentation - -type NetfilterAttachFlags uint32 - -type NetfilterOptions struct { - // Program must be a netfilter BPF program. - Program *ebpf.Program - // The protocol family. - ProtocolFamily uint32 - // The number of the hook you are interested in. - HookNumber uint32 - // Priority within hook - Priority int32 - // Extra link flags - Flags uint32 - // Netfilter flags - NetfilterFlags NetfilterAttachFlags -} - -type netfilterLink struct { - RawLink -} - -// AttachNetfilter links a netfilter BPF program to a netfilter hook. -func AttachNetfilter(opts NetfilterOptions) (Link, error) { - if opts.Program == nil { - return nil, fmt.Errorf("netfilter program is nil") - } - - if t := opts.Program.Type(); t != ebpf.Netfilter { - return nil, fmt.Errorf("invalid program type %s, expected netfilter", t) - } - - progFd := opts.Program.FD() - if progFd < 0 { - return nil, fmt.Errorf("invalid program: %s", sys.ErrClosedFd) - } - - attr := sys.LinkCreateNetfilterAttr{ - ProgFd: uint32(opts.Program.FD()), - AttachType: sys.BPF_NETFILTER, - Flags: opts.Flags, - Pf: uint32(opts.ProtocolFamily), - Hooknum: uint32(opts.HookNumber), - Priority: opts.Priority, - NetfilterFlags: uint32(opts.NetfilterFlags), - } - - fd, err := sys.LinkCreateNetfilter(&attr) - if err != nil { - return nil, fmt.Errorf("attach netfilter link: %w", err) - } - - return &netfilterLink{RawLink{fd, ""}}, nil -} - -func (*netfilterLink) Update(new *ebpf.Program) error { - return fmt.Errorf("netfilter update: %w", ErrNotSupported) -} - -var _ Link = (*netfilterLink)(nil) diff --git a/vendor/github.com/cilium/ebpf/link/netkit.go b/vendor/github.com/cilium/ebpf/link/netkit.go deleted file mode 100644 index 36ed72a48..000000000 --- a/vendor/github.com/cilium/ebpf/link/netkit.go +++ /dev/null @@ -1,71 +0,0 @@ -package link - -import ( - "fmt" - "runtime" - - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/internal/sys" -) - -type NetkitOptions struct { - // Index of the interface to attach to. - Interface int - // Program to attach. - Program *ebpf.Program - // One of the AttachNetkit* constants. - Attach ebpf.AttachType - // Attach relative to an anchor. Optional. - Anchor Anchor - // Only attach if the expected revision matches. - ExpectedRevision uint64 - // Flags control the attach behaviour. Specify an Anchor instead of - // F_LINK, F_ID, F_BEFORE, F_AFTER and R_REPLACE. Optional. - Flags uint32 -} - -func AttachNetkit(opts NetkitOptions) (Link, error) { - if opts.Interface < 0 { - return nil, fmt.Errorf("interface %d is out of bounds", opts.Interface) - } - - if opts.Flags&anchorFlags != 0 { - return nil, fmt.Errorf("disallowed flags: use Anchor to specify attach target") - } - - attr := sys.LinkCreateNetkitAttr{ - ProgFd: uint32(opts.Program.FD()), - AttachType: sys.AttachType(opts.Attach), - TargetIfindex: uint32(opts.Interface), - ExpectedRevision: opts.ExpectedRevision, - Flags: opts.Flags, - } - - if opts.Anchor != nil { - fdOrID, flags, err := opts.Anchor.anchor() - if err != nil { - return nil, fmt.Errorf("attach netkit link: %w", err) - } - - attr.RelativeFdOrId = fdOrID - attr.Flags |= flags - } - - fd, err := sys.LinkCreateNetkit(&attr) - runtime.KeepAlive(opts.Program) - runtime.KeepAlive(opts.Anchor) - if err != nil { - if haveFeatErr := haveNetkit(); haveFeatErr != nil { - return nil, haveFeatErr - } - return nil, fmt.Errorf("attach netkit link: %w", err) - } - - return &netkitLink{RawLink{fd, ""}}, nil -} - -type netkitLink struct { - RawLink -} - -var _ Link = (*netkitLink)(nil) diff --git a/vendor/github.com/cilium/ebpf/link/netns.go b/vendor/github.com/cilium/ebpf/link/netns.go deleted file mode 100644 index 344ecced6..000000000 --- a/vendor/github.com/cilium/ebpf/link/netns.go +++ /dev/null @@ -1,36 +0,0 @@ -package link - -import ( - "fmt" - - "github.com/cilium/ebpf" -) - -// NetNsLink is a program attached to a network namespace. -type NetNsLink struct { - RawLink -} - -// AttachNetNs attaches a program to a network namespace. -func AttachNetNs(ns int, prog *ebpf.Program) (*NetNsLink, error) { - var attach ebpf.AttachType - switch t := prog.Type(); t { - case ebpf.FlowDissector: - attach = ebpf.AttachFlowDissector - case ebpf.SkLookup: - attach = ebpf.AttachSkLookup - default: - return nil, fmt.Errorf("can't attach %v to network namespace", t) - } - - link, err := AttachRawLink(RawLinkOptions{ - Target: ns, - Program: prog, - Attach: attach, - }) - if err != nil { - return nil, err - } - - return &NetNsLink{*link}, nil -} diff --git a/vendor/github.com/cilium/ebpf/link/perf_event.go b/vendor/github.com/cilium/ebpf/link/perf_event.go deleted file mode 100644 index 5f7a628b3..000000000 --- a/vendor/github.com/cilium/ebpf/link/perf_event.go +++ /dev/null @@ -1,270 +0,0 @@ -package link - -import ( - "errors" - "fmt" - "runtime" - "unsafe" - - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/asm" - "github.com/cilium/ebpf/internal" - "github.com/cilium/ebpf/internal/sys" - "github.com/cilium/ebpf/internal/tracefs" - "github.com/cilium/ebpf/internal/unix" -) - -// Getting the terminology right is usually the hardest part. For posterity and -// for staying sane during implementation: -// -// - trace event: Representation of a kernel runtime hook. Filesystem entries -// under /events. Can be tracepoints (static), kprobes or uprobes. -// Can be instantiated into perf events (see below). -// - tracepoint: A predetermined hook point in the kernel. Exposed as trace -// events in (sub)directories under /events. Cannot be closed or -// removed, they are static. -// - k(ret)probe: Ephemeral trace events based on entry or exit points of -// exported kernel symbols. kprobe-based (tracefs) trace events can be -// created system-wide by writing to the /kprobe_events file, or -// they can be scoped to the current process by creating PMU perf events. -// - u(ret)probe: Ephemeral trace events based on user provides ELF binaries -// and offsets. uprobe-based (tracefs) trace events can be -// created system-wide by writing to the /uprobe_events file, or -// they can be scoped to the current process by creating PMU perf events. -// - perf event: An object instantiated based on an existing trace event or -// kernel symbol. Referred to by fd in userspace. -// Exactly one eBPF program can be attached to a perf event. Multiple perf -// events can be created from a single trace event. Closing a perf event -// stops any further invocations of the attached eBPF program. - -var ( - errInvalidInput = tracefs.ErrInvalidInput -) - -const ( - perfAllThreads = -1 -) - -// A perfEvent represents a perf event kernel object. Exactly one eBPF program -// can be attached to it. It is created based on a tracefs trace event or a -// Performance Monitoring Unit (PMU). -type perfEvent struct { - // Trace event backing this perfEvent. May be nil. - tracefsEvent *tracefs.Event - - // This is the perf event FD. - fd *sys.FD -} - -func newPerfEvent(fd *sys.FD, event *tracefs.Event) *perfEvent { - pe := &perfEvent{event, fd} - // Both event and fd have their own finalizer, but we want to - // guarantee that they are closed in a certain order. - runtime.SetFinalizer(pe, (*perfEvent).Close) - return pe -} - -func (pe *perfEvent) Close() error { - runtime.SetFinalizer(pe, nil) - - if err := pe.fd.Close(); err != nil { - return fmt.Errorf("closing perf event fd: %w", err) - } - - if pe.tracefsEvent != nil { - return pe.tracefsEvent.Close() - } - - return nil -} - -// perfEventLink represents a bpf perf link. -type perfEventLink struct { - RawLink - pe *perfEvent -} - -func (pl *perfEventLink) isLink() {} - -// Pinning requires the underlying perf event FD to stay open. -// -// | PerfEvent FD | BpfLink FD | Works | -// |--------------|------------|-------| -// | Open | Open | Yes | -// | Closed | Open | No | -// | Open | Closed | No (Pin() -> EINVAL) | -// | Closed | Closed | No (Pin() -> EINVAL) | -// -// There is currently no pretty way to recover the perf event FD -// when loading a pinned link, so leave as not supported for now. -func (pl *perfEventLink) Pin(string) error { - return fmt.Errorf("perf event link pin: %w", ErrNotSupported) -} - -func (pl *perfEventLink) Unpin() error { - return fmt.Errorf("perf event link unpin: %w", ErrNotSupported) -} - -func (pl *perfEventLink) Close() error { - if err := pl.fd.Close(); err != nil { - return fmt.Errorf("perf link close: %w", err) - } - - if err := pl.pe.Close(); err != nil { - return fmt.Errorf("perf event close: %w", err) - } - return nil -} - -func (pl *perfEventLink) Update(prog *ebpf.Program) error { - return fmt.Errorf("perf event link update: %w", ErrNotSupported) -} - -// perfEventIoctl implements Link and handles the perf event lifecycle -// via ioctl(). -type perfEventIoctl struct { - *perfEvent -} - -func (pi *perfEventIoctl) isLink() {} - -// Since 4.15 (e87c6bc3852b "bpf: permit multiple bpf attachments for a single perf event"), -// calling PERF_EVENT_IOC_SET_BPF appends the given program to a prog_array -// owned by the perf event, which means multiple programs can be attached -// simultaneously. -// -// Before 4.15, calling PERF_EVENT_IOC_SET_BPF more than once on a perf event -// returns EEXIST. -// -// Detaching a program from a perf event is currently not possible, so a -// program replacement mechanism cannot be implemented for perf events. -func (pi *perfEventIoctl) Update(prog *ebpf.Program) error { - return fmt.Errorf("perf event ioctl update: %w", ErrNotSupported) -} - -func (pi *perfEventIoctl) Pin(string) error { - return fmt.Errorf("perf event ioctl pin: %w", ErrNotSupported) -} - -func (pi *perfEventIoctl) Unpin() error { - return fmt.Errorf("perf event ioctl unpin: %w", ErrNotSupported) -} - -func (pi *perfEventIoctl) Info() (*Info, error) { - return nil, fmt.Errorf("perf event ioctl info: %w", ErrNotSupported) -} - -// attach the given eBPF prog to the perf event stored in pe. -// pe must contain a valid perf event fd. -// prog's type must match the program type stored in pe. -func attachPerfEvent(pe *perfEvent, prog *ebpf.Program, cookie uint64) (Link, error) { - if prog == nil { - return nil, errors.New("cannot attach a nil program") - } - if prog.FD() < 0 { - return nil, fmt.Errorf("invalid program: %w", sys.ErrClosedFd) - } - - if err := haveBPFLinkPerfEvent(); err == nil { - return attachPerfEventLink(pe, prog, cookie) - } - - if cookie != 0 { - return nil, fmt.Errorf("cookies are not supported: %w", ErrNotSupported) - } - - return attachPerfEventIoctl(pe, prog) -} - -func attachPerfEventIoctl(pe *perfEvent, prog *ebpf.Program) (*perfEventIoctl, error) { - // Assign the eBPF program to the perf event. - err := unix.IoctlSetInt(pe.fd.Int(), unix.PERF_EVENT_IOC_SET_BPF, prog.FD()) - if err != nil { - return nil, fmt.Errorf("setting perf event bpf program: %w", err) - } - - // PERF_EVENT_IOC_ENABLE and _DISABLE ignore their given values. - if err := unix.IoctlSetInt(pe.fd.Int(), unix.PERF_EVENT_IOC_ENABLE, 0); err != nil { - return nil, fmt.Errorf("enable perf event: %s", err) - } - - return &perfEventIoctl{pe}, nil -} - -// Use the bpf api to attach the perf event (BPF_LINK_TYPE_PERF_EVENT, 5.15+). -// -// https://github.com/torvalds/linux/commit/b89fbfbb854c9afc3047e8273cc3a694650b802e -func attachPerfEventLink(pe *perfEvent, prog *ebpf.Program, cookie uint64) (*perfEventLink, error) { - fd, err := sys.LinkCreatePerfEvent(&sys.LinkCreatePerfEventAttr{ - ProgFd: uint32(prog.FD()), - TargetFd: pe.fd.Uint(), - AttachType: sys.BPF_PERF_EVENT, - BpfCookie: cookie, - }) - if err != nil { - return nil, fmt.Errorf("cannot create bpf perf link: %v", err) - } - - return &perfEventLink{RawLink{fd: fd}, pe}, nil -} - -// unsafeStringPtr returns an unsafe.Pointer to a NUL-terminated copy of str. -func unsafeStringPtr(str string) (unsafe.Pointer, error) { - p, err := unix.BytePtrFromString(str) - if err != nil { - return nil, err - } - return unsafe.Pointer(p), nil -} - -// openTracepointPerfEvent opens a tracepoint-type perf event. System-wide -// [k,u]probes created by writing to /[k,u]probe_events are tracepoints -// behind the scenes, and can be attached to using these perf events. -func openTracepointPerfEvent(tid uint64, pid int) (*sys.FD, error) { - attr := unix.PerfEventAttr{ - Type: unix.PERF_TYPE_TRACEPOINT, - Config: tid, - Sample_type: unix.PERF_SAMPLE_RAW, - Sample: 1, - Wakeup: 1, - } - - fd, err := unix.PerfEventOpen(&attr, pid, 0, -1, unix.PERF_FLAG_FD_CLOEXEC) - if err != nil { - return nil, fmt.Errorf("opening tracepoint perf event: %w", err) - } - - return sys.NewFD(fd) -} - -// Probe BPF perf link. -// -// https://elixir.bootlin.com/linux/v5.16.8/source/kernel/bpf/syscall.c#L4307 -// https://github.com/torvalds/linux/commit/b89fbfbb854c9afc3047e8273cc3a694650b802e -var haveBPFLinkPerfEvent = internal.NewFeatureTest("bpf_link_perf_event", "5.15", func() error { - prog, err := ebpf.NewProgram(&ebpf.ProgramSpec{ - Name: "probe_bpf_perf_link", - Type: ebpf.Kprobe, - Instructions: asm.Instructions{ - asm.Mov.Imm(asm.R0, 0), - asm.Return(), - }, - License: "MIT", - }) - if err != nil { - return err - } - defer prog.Close() - - _, err = sys.LinkCreatePerfEvent(&sys.LinkCreatePerfEventAttr{ - ProgFd: uint32(prog.FD()), - AttachType: sys.BPF_PERF_EVENT, - }) - if errors.Is(err, unix.EINVAL) { - return internal.ErrNotSupported - } - if errors.Is(err, unix.EBADF) { - return nil - } - return err -}) diff --git a/vendor/github.com/cilium/ebpf/link/program.go b/vendor/github.com/cilium/ebpf/link/program.go deleted file mode 100644 index d8a2a15f9..000000000 --- a/vendor/github.com/cilium/ebpf/link/program.go +++ /dev/null @@ -1,107 +0,0 @@ -package link - -import ( - "fmt" - "runtime" - - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/internal/sys" -) - -type RawAttachProgramOptions struct { - // Target to query. This is usually a file descriptor but may refer to - // something else based on the attach type. - Target int - // Program to attach. - Program *ebpf.Program - // Attach must match the attach type of Program. - Attach ebpf.AttachType - // Attach relative to an anchor. Optional. - Anchor Anchor - // Flags control the attach behaviour. Specify an Anchor instead of - // F_LINK, F_ID, F_BEFORE, F_AFTER and F_REPLACE. Optional. - Flags uint32 - // Only attach if the internal revision matches the given value. - ExpectedRevision uint64 -} - -// RawAttachProgram is a low level wrapper around BPF_PROG_ATTACH. -// -// You should use one of the higher level abstractions available in this -// package if possible. -func RawAttachProgram(opts RawAttachProgramOptions) error { - if opts.Flags&anchorFlags != 0 { - return fmt.Errorf("disallowed flags: use Anchor to specify attach target") - } - - attr := sys.ProgAttachAttr{ - TargetFdOrIfindex: uint32(opts.Target), - AttachBpfFd: uint32(opts.Program.FD()), - AttachType: uint32(opts.Attach), - AttachFlags: uint32(opts.Flags), - ExpectedRevision: opts.ExpectedRevision, - } - - if opts.Anchor != nil { - fdOrID, flags, err := opts.Anchor.anchor() - if err != nil { - return fmt.Errorf("attach program: %w", err) - } - - if flags == sys.BPF_F_REPLACE { - // Ensure that replacing a program works on old kernels. - attr.ReplaceBpfFd = fdOrID - } else { - attr.RelativeFdOrId = fdOrID - attr.AttachFlags |= flags - } - } - - if err := sys.ProgAttach(&attr); err != nil { - if haveFeatErr := haveProgAttach(); haveFeatErr != nil { - return haveFeatErr - } - return fmt.Errorf("attach program: %w", err) - } - runtime.KeepAlive(opts.Program) - - return nil -} - -type RawDetachProgramOptions RawAttachProgramOptions - -// RawDetachProgram is a low level wrapper around BPF_PROG_DETACH. -// -// You should use one of the higher level abstractions available in this -// package if possible. -func RawDetachProgram(opts RawDetachProgramOptions) error { - if opts.Flags&anchorFlags != 0 { - return fmt.Errorf("disallowed flags: use Anchor to specify attach target") - } - - attr := sys.ProgDetachAttr{ - TargetFdOrIfindex: uint32(opts.Target), - AttachBpfFd: uint32(opts.Program.FD()), - AttachType: uint32(opts.Attach), - ExpectedRevision: opts.ExpectedRevision, - } - - if opts.Anchor != nil { - fdOrID, flags, err := opts.Anchor.anchor() - if err != nil { - return fmt.Errorf("detach program: %w", err) - } - - attr.RelativeFdOrId = fdOrID - attr.AttachFlags |= flags - } - - if err := sys.ProgDetach(&attr); err != nil { - if haveFeatErr := haveProgAttach(); haveFeatErr != nil { - return haveFeatErr - } - return fmt.Errorf("can't detach program: %w", err) - } - - return nil -} diff --git a/vendor/github.com/cilium/ebpf/link/query.go b/vendor/github.com/cilium/ebpf/link/query.go deleted file mode 100644 index fe534f8ef..000000000 --- a/vendor/github.com/cilium/ebpf/link/query.go +++ /dev/null @@ -1,111 +0,0 @@ -package link - -import ( - "fmt" - "unsafe" - - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/internal/sys" -) - -// QueryOptions defines additional parameters when querying for programs. -type QueryOptions struct { - // Target to query. This is usually a file descriptor but may refer to - // something else based on the attach type. - Target int - // Attach specifies the AttachType of the programs queried for - Attach ebpf.AttachType - // QueryFlags are flags for BPF_PROG_QUERY, e.g. BPF_F_QUERY_EFFECTIVE - QueryFlags uint32 -} - -// QueryResult describes which programs and links are active. -type QueryResult struct { - // List of attached programs. - Programs []AttachedProgram - - // Incremented by one every time the set of attached programs changes. - // May be zero if not supported by the [ebpf.AttachType]. - Revision uint64 -} - -// HaveLinkInfo returns true if the kernel supports querying link information -// for a particular [ebpf.AttachType]. -func (qr *QueryResult) HaveLinkInfo() bool { - return qr.Revision > 0 -} - -type AttachedProgram struct { - ID ebpf.ProgramID - linkID ID -} - -// LinkID returns the ID associated with the program. -// -// Returns 0, false if the kernel doesn't support retrieving the ID or if the -// program wasn't attached via a link. See [QueryResult.HaveLinkInfo] if you -// need to tell the two apart. -func (ap *AttachedProgram) LinkID() (ID, bool) { - return ap.linkID, ap.linkID != 0 -} - -// QueryPrograms retrieves a list of programs for the given AttachType. -// -// Returns a slice of attached programs, which may be empty. -// revision counts how many times the set of attached programs has changed and -// may be zero if not supported by the [ebpf.AttachType]. -// Returns ErrNotSupportd on a kernel without BPF_PROG_QUERY -func QueryPrograms(opts QueryOptions) (*QueryResult, error) { - // query the number of programs to allocate correct slice size - attr := sys.ProgQueryAttr{ - TargetFdOrIfindex: uint32(opts.Target), - AttachType: sys.AttachType(opts.Attach), - QueryFlags: opts.QueryFlags, - } - err := sys.ProgQuery(&attr) - if err != nil { - if haveFeatErr := haveProgQuery(); haveFeatErr != nil { - return nil, fmt.Errorf("query programs: %w", haveFeatErr) - } - return nil, fmt.Errorf("query programs: %w", err) - } - if attr.Count == 0 { - return &QueryResult{Revision: attr.Revision}, nil - } - - // The minimum bpf_mprog revision is 1, so we can use the field to detect - // whether the attach type supports link ids. - haveLinkIDs := attr.Revision != 0 - - count := attr.Count - progIds := make([]ebpf.ProgramID, count) - attr = sys.ProgQueryAttr{ - TargetFdOrIfindex: uint32(opts.Target), - AttachType: sys.AttachType(opts.Attach), - QueryFlags: opts.QueryFlags, - Count: count, - ProgIds: sys.NewPointer(unsafe.Pointer(&progIds[0])), - } - - var linkIds []ID - if haveLinkIDs { - linkIds = make([]ID, count) - attr.LinkIds = sys.NewPointer(unsafe.Pointer(&linkIds[0])) - } - - if err := sys.ProgQuery(&attr); err != nil { - return nil, fmt.Errorf("query programs: %w", err) - } - - // NB: attr.Count might have changed between the two syscalls. - var programs []AttachedProgram - for i, id := range progIds[:attr.Count] { - ap := AttachedProgram{ID: id} - if haveLinkIDs { - ap.linkID = linkIds[i] - } - programs = append(programs, ap) - } - - return &QueryResult{programs, attr.Revision}, nil -} diff --git a/vendor/github.com/cilium/ebpf/link/raw_tracepoint.go b/vendor/github.com/cilium/ebpf/link/raw_tracepoint.go deleted file mode 100644 index 925e621cb..000000000 --- a/vendor/github.com/cilium/ebpf/link/raw_tracepoint.go +++ /dev/null @@ -1,87 +0,0 @@ -package link - -import ( - "errors" - "fmt" - - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/internal/sys" -) - -type RawTracepointOptions struct { - // Tracepoint name. - Name string - // Program must be of type RawTracepoint* - Program *ebpf.Program -} - -// AttachRawTracepoint links a BPF program to a raw_tracepoint. -// -// Requires at least Linux 4.17. -func AttachRawTracepoint(opts RawTracepointOptions) (Link, error) { - if t := opts.Program.Type(); t != ebpf.RawTracepoint && t != ebpf.RawTracepointWritable { - return nil, fmt.Errorf("invalid program type %s, expected RawTracepoint(Writable)", t) - } - if opts.Program.FD() < 0 { - return nil, fmt.Errorf("invalid program: %w", sys.ErrClosedFd) - } - - fd, err := sys.RawTracepointOpen(&sys.RawTracepointOpenAttr{ - Name: sys.NewStringPointer(opts.Name), - ProgFd: uint32(opts.Program.FD()), - }) - if err != nil { - return nil, err - } - - err = haveBPFLink() - if errors.Is(err, ErrNotSupported) { - // Prior to commit 70ed506c3bbc ("bpf: Introduce pinnable bpf_link abstraction") - // raw_tracepoints are just a plain fd. - return &simpleRawTracepoint{fd}, nil - } - - if err != nil { - return nil, err - } - - return &rawTracepoint{RawLink{fd: fd}}, nil -} - -type simpleRawTracepoint struct { - fd *sys.FD -} - -var _ Link = (*simpleRawTracepoint)(nil) - -func (frt *simpleRawTracepoint) isLink() {} - -func (frt *simpleRawTracepoint) Close() error { - return frt.fd.Close() -} - -func (frt *simpleRawTracepoint) Update(_ *ebpf.Program) error { - return fmt.Errorf("update raw_tracepoint: %w", ErrNotSupported) -} - -func (frt *simpleRawTracepoint) Pin(string) error { - return fmt.Errorf("pin raw_tracepoint: %w", ErrNotSupported) -} - -func (frt *simpleRawTracepoint) Unpin() error { - return fmt.Errorf("unpin raw_tracepoint: %w", ErrNotSupported) -} - -func (frt *simpleRawTracepoint) Info() (*Info, error) { - return nil, fmt.Errorf("can't get raw_tracepoint info: %w", ErrNotSupported) -} - -type rawTracepoint struct { - RawLink -} - -var _ Link = (*rawTracepoint)(nil) - -func (rt *rawTracepoint) Update(_ *ebpf.Program) error { - return fmt.Errorf("update raw_tracepoint: %w", ErrNotSupported) -} diff --git a/vendor/github.com/cilium/ebpf/link/socket_filter.go b/vendor/github.com/cilium/ebpf/link/socket_filter.go deleted file mode 100644 index 84f0b656f..000000000 --- a/vendor/github.com/cilium/ebpf/link/socket_filter.go +++ /dev/null @@ -1,40 +0,0 @@ -package link - -import ( - "syscall" - - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/internal/unix" -) - -// AttachSocketFilter attaches a SocketFilter BPF program to a socket. -func AttachSocketFilter(conn syscall.Conn, program *ebpf.Program) error { - rawConn, err := conn.SyscallConn() - if err != nil { - return err - } - var ssoErr error - err = rawConn.Control(func(fd uintptr) { - ssoErr = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_ATTACH_BPF, program.FD()) - }) - if ssoErr != nil { - return ssoErr - } - return err -} - -// DetachSocketFilter detaches a SocketFilter BPF program from a socket. -func DetachSocketFilter(conn syscall.Conn) error { - rawConn, err := conn.SyscallConn() - if err != nil { - return err - } - var ssoErr error - err = rawConn.Control(func(fd uintptr) { - ssoErr = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_DETACH_BPF, 0) - }) - if ssoErr != nil { - return ssoErr - } - return err -} diff --git a/vendor/github.com/cilium/ebpf/link/syscalls.go b/vendor/github.com/cilium/ebpf/link/syscalls.go deleted file mode 100644 index d09b5acb0..000000000 --- a/vendor/github.com/cilium/ebpf/link/syscalls.go +++ /dev/null @@ -1,200 +0,0 @@ -package link - -import ( - "errors" - - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/asm" - "github.com/cilium/ebpf/internal" - "github.com/cilium/ebpf/internal/sys" - "github.com/cilium/ebpf/internal/unix" -) - -// Type is the kind of link. -type Type = sys.LinkType - -// Valid link types. -const ( - UnspecifiedType = sys.BPF_LINK_TYPE_UNSPEC - RawTracepointType = sys.BPF_LINK_TYPE_RAW_TRACEPOINT - TracingType = sys.BPF_LINK_TYPE_TRACING - CgroupType = sys.BPF_LINK_TYPE_CGROUP - IterType = sys.BPF_LINK_TYPE_ITER - NetNsType = sys.BPF_LINK_TYPE_NETNS - XDPType = sys.BPF_LINK_TYPE_XDP - PerfEventType = sys.BPF_LINK_TYPE_PERF_EVENT - KprobeMultiType = sys.BPF_LINK_TYPE_KPROBE_MULTI - TCXType = sys.BPF_LINK_TYPE_TCX - UprobeMultiType = sys.BPF_LINK_TYPE_UPROBE_MULTI - NetfilterType = sys.BPF_LINK_TYPE_NETFILTER - NetkitType = sys.BPF_LINK_TYPE_NETKIT -) - -var haveProgAttach = internal.NewFeatureTest("BPF_PROG_ATTACH", "4.10", func() error { - prog, err := ebpf.NewProgram(&ebpf.ProgramSpec{ - Type: ebpf.CGroupSKB, - License: "MIT", - Instructions: asm.Instructions{ - asm.Mov.Imm(asm.R0, 0), - asm.Return(), - }, - }) - if err != nil { - return internal.ErrNotSupported - } - - // BPF_PROG_ATTACH was introduced at the same time as CGgroupSKB, - // so being able to load the program is enough to infer that we - // have the syscall. - prog.Close() - return nil -}) - -var haveProgAttachReplace = internal.NewFeatureTest("BPF_PROG_ATTACH atomic replacement of MULTI progs", "5.5", func() error { - if err := haveProgAttach(); err != nil { - return err - } - - prog, err := ebpf.NewProgram(&ebpf.ProgramSpec{ - Type: ebpf.CGroupSKB, - AttachType: ebpf.AttachCGroupInetIngress, - License: "MIT", - Instructions: asm.Instructions{ - asm.Mov.Imm(asm.R0, 0), - asm.Return(), - }, - }) - - if err != nil { - return internal.ErrNotSupported - } - - defer prog.Close() - - // We know that we have BPF_PROG_ATTACH since we can load CGroupSKB programs. - // If passing BPF_F_REPLACE gives us EINVAL we know that the feature isn't - // present. - attr := sys.ProgAttachAttr{ - // We rely on this being checked after attachFlags. - TargetFdOrIfindex: ^uint32(0), - AttachBpfFd: uint32(prog.FD()), - AttachType: uint32(ebpf.AttachCGroupInetIngress), - AttachFlags: uint32(flagReplace), - } - - err = sys.ProgAttach(&attr) - if errors.Is(err, unix.EINVAL) { - return internal.ErrNotSupported - } - if errors.Is(err, unix.EBADF) { - return nil - } - return err -}) - -var haveBPFLink = internal.NewFeatureTest("bpf_link", "5.7", func() error { - attr := sys.LinkCreateAttr{ - // This is a hopefully invalid file descriptor, which triggers EBADF. - TargetFd: ^uint32(0), - ProgFd: ^uint32(0), - AttachType: sys.AttachType(ebpf.AttachCGroupInetIngress), - } - _, err := sys.LinkCreate(&attr) - if errors.Is(err, unix.EINVAL) { - return internal.ErrNotSupported - } - if errors.Is(err, unix.EBADF) { - return nil - } - return err -}) - -var haveProgQuery = internal.NewFeatureTest("BPF_PROG_QUERY", "4.15", func() error { - attr := sys.ProgQueryAttr{ - // We rely on this being checked during the syscall. - // With an otherwise correct payload we expect EBADF here - // as an indication that the feature is present. - TargetFdOrIfindex: ^uint32(0), - AttachType: sys.AttachType(ebpf.AttachCGroupInetIngress), - } - - err := sys.ProgQuery(&attr) - - if errors.Is(err, unix.EBADF) { - return nil - } - if err != nil { - return ErrNotSupported - } - return errors.New("syscall succeeded unexpectedly") -}) - -var haveTCX = internal.NewFeatureTest("tcx", "6.6", func() error { - prog, err := ebpf.NewProgram(&ebpf.ProgramSpec{ - Type: ebpf.SchedCLS, - License: "MIT", - Instructions: asm.Instructions{ - asm.Mov.Imm(asm.R0, 0), - asm.Return(), - }, - }) - - if err != nil { - return internal.ErrNotSupported - } - - defer prog.Close() - attr := sys.LinkCreateTcxAttr{ - // We rely on this being checked during the syscall. - // With an otherwise correct payload we expect ENODEV here - // as an indication that the feature is present. - TargetIfindex: ^uint32(0), - ProgFd: uint32(prog.FD()), - AttachType: sys.AttachType(ebpf.AttachTCXIngress), - } - - _, err = sys.LinkCreateTcx(&attr) - - if errors.Is(err, unix.ENODEV) { - return nil - } - if err != nil { - return ErrNotSupported - } - return errors.New("syscall succeeded unexpectedly") -}) - -var haveNetkit = internal.NewFeatureTest("netkit", "6.7", func() error { - prog, err := ebpf.NewProgram(&ebpf.ProgramSpec{ - Type: ebpf.SchedCLS, - License: "MIT", - Instructions: asm.Instructions{ - asm.Mov.Imm(asm.R0, 0), - asm.Return(), - }, - }) - - if err != nil { - return internal.ErrNotSupported - } - - defer prog.Close() - attr := sys.LinkCreateNetkitAttr{ - // We rely on this being checked during the syscall. - // With an otherwise correct payload we expect ENODEV here - // as an indication that the feature is present. - TargetIfindex: ^uint32(0), - ProgFd: uint32(prog.FD()), - AttachType: sys.AttachType(ebpf.AttachNetkitPrimary), - } - - _, err = sys.LinkCreateNetkit(&attr) - - if errors.Is(err, unix.ENODEV) { - return nil - } - if err != nil { - return ErrNotSupported - } - return errors.New("syscall succeeded unexpectedly") -}) diff --git a/vendor/github.com/cilium/ebpf/link/tcx.go b/vendor/github.com/cilium/ebpf/link/tcx.go deleted file mode 100644 index 88f2237d2..000000000 --- a/vendor/github.com/cilium/ebpf/link/tcx.go +++ /dev/null @@ -1,71 +0,0 @@ -package link - -import ( - "fmt" - "runtime" - - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/internal/sys" -) - -type TCXOptions struct { - // Index of the interface to attach to. - Interface int - // Program to attach. - Program *ebpf.Program - // One of the AttachTCX* constants. - Attach ebpf.AttachType - // Attach relative to an anchor. Optional. - Anchor Anchor - // Only attach if the expected revision matches. - ExpectedRevision uint64 - // Flags control the attach behaviour. Specify an Anchor instead of - // F_LINK, F_ID, F_BEFORE, F_AFTER and R_REPLACE. Optional. - Flags uint32 -} - -func AttachTCX(opts TCXOptions) (Link, error) { - if opts.Interface < 0 { - return nil, fmt.Errorf("interface %d is out of bounds", opts.Interface) - } - - if opts.Flags&anchorFlags != 0 { - return nil, fmt.Errorf("disallowed flags: use Anchor to specify attach target") - } - - attr := sys.LinkCreateTcxAttr{ - ProgFd: uint32(opts.Program.FD()), - AttachType: sys.AttachType(opts.Attach), - TargetIfindex: uint32(opts.Interface), - ExpectedRevision: opts.ExpectedRevision, - Flags: opts.Flags, - } - - if opts.Anchor != nil { - fdOrID, flags, err := opts.Anchor.anchor() - if err != nil { - return nil, fmt.Errorf("attach tcx link: %w", err) - } - - attr.RelativeFdOrId = fdOrID - attr.Flags |= flags - } - - fd, err := sys.LinkCreateTcx(&attr) - runtime.KeepAlive(opts.Program) - runtime.KeepAlive(opts.Anchor) - if err != nil { - if haveFeatErr := haveTCX(); haveFeatErr != nil { - return nil, haveFeatErr - } - return nil, fmt.Errorf("attach tcx link: %w", err) - } - - return &tcxLink{RawLink{fd, ""}}, nil -} - -type tcxLink struct { - RawLink -} - -var _ Link = (*tcxLink)(nil) diff --git a/vendor/github.com/cilium/ebpf/link/tracepoint.go b/vendor/github.com/cilium/ebpf/link/tracepoint.go deleted file mode 100644 index 95f5fae3b..000000000 --- a/vendor/github.com/cilium/ebpf/link/tracepoint.go +++ /dev/null @@ -1,68 +0,0 @@ -package link - -import ( - "fmt" - - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/internal/tracefs" -) - -// TracepointOptions defines additional parameters that will be used -// when loading Tracepoints. -type TracepointOptions struct { - // Arbitrary value that can be fetched from an eBPF program - // via `bpf_get_attach_cookie()`. - // - // Needs kernel 5.15+. - Cookie uint64 -} - -// Tracepoint attaches the given eBPF program to the tracepoint with the given -// group and name. See /sys/kernel/tracing/events to find available -// tracepoints. The top-level directory is the group, the event's subdirectory -// is the name. Example: -// -// tp, err := Tracepoint("syscalls", "sys_enter_fork", prog, nil) -// -// Losing the reference to the resulting Link (tp) will close the Tracepoint -// and prevent further execution of prog. The Link must be Closed during -// program shutdown to avoid leaking system resources. -// -// Note that attaching eBPF programs to syscalls (sys_enter_*/sys_exit_*) is -// only possible as of kernel 4.14 (commit cf5f5ce). -func Tracepoint(group, name string, prog *ebpf.Program, opts *TracepointOptions) (Link, error) { - if group == "" || name == "" { - return nil, fmt.Errorf("group and name cannot be empty: %w", errInvalidInput) - } - if prog == nil { - return nil, fmt.Errorf("prog cannot be nil: %w", errInvalidInput) - } - if prog.Type() != ebpf.TracePoint { - return nil, fmt.Errorf("eBPF program type %s is not a Tracepoint: %w", prog.Type(), errInvalidInput) - } - - tid, err := tracefs.EventID(group, name) - if err != nil { - return nil, err - } - - fd, err := openTracepointPerfEvent(tid, perfAllThreads) - if err != nil { - return nil, err - } - - var cookie uint64 - if opts != nil { - cookie = opts.Cookie - } - - pe := newPerfEvent(fd, nil) - - lnk, err := attachPerfEvent(pe, prog, cookie) - if err != nil { - pe.Close() - return nil, err - } - - return lnk, nil -} diff --git a/vendor/github.com/cilium/ebpf/link/tracing.go b/vendor/github.com/cilium/ebpf/link/tracing.go deleted file mode 100644 index 1e1a7834d..000000000 --- a/vendor/github.com/cilium/ebpf/link/tracing.go +++ /dev/null @@ -1,199 +0,0 @@ -package link - -import ( - "errors" - "fmt" - - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/btf" - "github.com/cilium/ebpf/internal/sys" - "github.com/cilium/ebpf/internal/unix" -) - -type tracing struct { - RawLink -} - -func (f *tracing) Update(new *ebpf.Program) error { - return fmt.Errorf("tracing update: %w", ErrNotSupported) -} - -// AttachFreplace attaches the given eBPF program to the function it replaces. -// -// The program and name can either be provided at link time, or can be provided -// at program load time. If they were provided at load time, they should be nil -// and empty respectively here, as they will be ignored by the kernel. -// Examples: -// -// AttachFreplace(dispatcher, "function", replacement) -// AttachFreplace(nil, "", replacement) -func AttachFreplace(targetProg *ebpf.Program, name string, prog *ebpf.Program) (Link, error) { - if (name == "") != (targetProg == nil) { - return nil, fmt.Errorf("must provide both or neither of name and targetProg: %w", errInvalidInput) - } - if prog == nil { - return nil, fmt.Errorf("prog cannot be nil: %w", errInvalidInput) - } - if prog.Type() != ebpf.Extension { - return nil, fmt.Errorf("eBPF program type %s is not an Extension: %w", prog.Type(), errInvalidInput) - } - - var ( - target int - typeID btf.TypeID - ) - if targetProg != nil { - btfHandle, err := targetProg.Handle() - if err != nil { - return nil, err - } - defer btfHandle.Close() - - spec, err := btfHandle.Spec(nil) - if err != nil { - return nil, err - } - - var function *btf.Func - if err := spec.TypeByName(name, &function); err != nil { - return nil, err - } - - target = targetProg.FD() - typeID, err = spec.TypeID(function) - if err != nil { - return nil, err - } - } - - link, err := AttachRawLink(RawLinkOptions{ - Target: target, - Program: prog, - Attach: ebpf.AttachNone, - BTF: typeID, - }) - if errors.Is(err, sys.ENOTSUPP) { - // This may be returned by bpf_tracing_prog_attach via bpf_arch_text_poke. - return nil, fmt.Errorf("create raw tracepoint: %w", ErrNotSupported) - } - if err != nil { - return nil, err - } - - return &tracing{*link}, nil -} - -type TracingOptions struct { - // Program must be of type Tracing with attach type - // AttachTraceFEntry/AttachTraceFExit/AttachModifyReturn or - // AttachTraceRawTp. - Program *ebpf.Program - // Program attach type. Can be one of: - // - AttachTraceFEntry - // - AttachTraceFExit - // - AttachModifyReturn - // - AttachTraceRawTp - // This field is optional. - AttachType ebpf.AttachType - // Arbitrary value that can be fetched from an eBPF program - // via `bpf_get_attach_cookie()`. - Cookie uint64 -} - -type LSMOptions struct { - // Program must be of type LSM with attach type - // AttachLSMMac. - Program *ebpf.Program - // Arbitrary value that can be fetched from an eBPF program - // via `bpf_get_attach_cookie()`. - Cookie uint64 -} - -// attachBTFID links all BPF program types (Tracing/LSM) that they attach to a btf_id. -func attachBTFID(program *ebpf.Program, at ebpf.AttachType, cookie uint64) (Link, error) { - if program.FD() < 0 { - return nil, fmt.Errorf("invalid program %w", sys.ErrClosedFd) - } - - var ( - fd *sys.FD - err error - ) - switch at { - case ebpf.AttachTraceFEntry, ebpf.AttachTraceFExit, ebpf.AttachTraceRawTp, - ebpf.AttachModifyReturn, ebpf.AttachLSMMac: - // Attach via BPF link - fd, err = sys.LinkCreateTracing(&sys.LinkCreateTracingAttr{ - ProgFd: uint32(program.FD()), - AttachType: sys.AttachType(at), - Cookie: cookie, - }) - if err == nil { - break - } - if !errors.Is(err, unix.EINVAL) && !errors.Is(err, sys.ENOTSUPP) { - return nil, fmt.Errorf("create tracing link: %w", err) - } - fallthrough - case ebpf.AttachNone: - // Attach via RawTracepointOpen - if cookie > 0 { - return nil, fmt.Errorf("create raw tracepoint with cookie: %w", ErrNotSupported) - } - - fd, err = sys.RawTracepointOpen(&sys.RawTracepointOpenAttr{ - ProgFd: uint32(program.FD()), - }) - if errors.Is(err, sys.ENOTSUPP) { - // This may be returned by bpf_tracing_prog_attach via bpf_arch_text_poke. - return nil, fmt.Errorf("create raw tracepoint: %w", ErrNotSupported) - } - if err != nil { - return nil, fmt.Errorf("create raw tracepoint: %w", err) - } - default: - return nil, fmt.Errorf("invalid attach type: %s", at.String()) - } - - raw := RawLink{fd: fd} - info, err := raw.Info() - if err != nil { - raw.Close() - return nil, err - } - - if info.Type == RawTracepointType { - // Sadness upon sadness: a Tracing program with AttachRawTp returns - // a raw_tracepoint link. Other types return a tracing link. - return &rawTracepoint{raw}, nil - } - return &tracing{raw}, nil -} - -// AttachTracing links a tracing (fentry/fexit/fmod_ret) BPF program or -// a BTF-powered raw tracepoint (tp_btf) BPF Program to a BPF hook defined -// in kernel modules. -func AttachTracing(opts TracingOptions) (Link, error) { - if t := opts.Program.Type(); t != ebpf.Tracing { - return nil, fmt.Errorf("invalid program type %s, expected Tracing", t) - } - - switch opts.AttachType { - case ebpf.AttachTraceFEntry, ebpf.AttachTraceFExit, ebpf.AttachModifyReturn, - ebpf.AttachTraceRawTp, ebpf.AttachNone: - default: - return nil, fmt.Errorf("invalid attach type: %s", opts.AttachType.String()) - } - - return attachBTFID(opts.Program, opts.AttachType, opts.Cookie) -} - -// AttachLSM links a Linux security module (LSM) BPF Program to a BPF -// hook defined in kernel modules. -func AttachLSM(opts LSMOptions) (Link, error) { - if t := opts.Program.Type(); t != ebpf.LSM { - return nil, fmt.Errorf("invalid program type %s, expected LSM", t) - } - - return attachBTFID(opts.Program, ebpf.AttachLSMMac, opts.Cookie) -} diff --git a/vendor/github.com/cilium/ebpf/link/uprobe.go b/vendor/github.com/cilium/ebpf/link/uprobe.go deleted file mode 100644 index ad85024e3..000000000 --- a/vendor/github.com/cilium/ebpf/link/uprobe.go +++ /dev/null @@ -1,331 +0,0 @@ -package link - -import ( - "debug/elf" - "errors" - "fmt" - "os" - "sync" - - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/internal" - "github.com/cilium/ebpf/internal/tracefs" -) - -var ( - uprobeRefCtrOffsetPMUPath = "/sys/bus/event_source/devices/uprobe/format/ref_ctr_offset" - // elixir.bootlin.com/linux/v5.15-rc7/source/kernel/events/core.c#L9799 - uprobeRefCtrOffsetShift = 32 - haveRefCtrOffsetPMU = internal.NewFeatureTest("RefCtrOffsetPMU", "4.20", func() error { - _, err := os.Stat(uprobeRefCtrOffsetPMUPath) - if errors.Is(err, os.ErrNotExist) { - return internal.ErrNotSupported - } - if err != nil { - return err - } - return nil - }) - - // ErrNoSymbol indicates that the given symbol was not found - // in the ELF symbols table. - ErrNoSymbol = errors.New("not found") -) - -// Executable defines an executable program on the filesystem. -type Executable struct { - // Path of the executable on the filesystem. - path string - // Parsed ELF and dynamic symbols' cachedAddresses. - cachedAddresses map[string]uint64 - // Keep track of symbol table lazy load. - cacheAddressesOnce sync.Once -} - -// UprobeOptions defines additional parameters that will be used -// when loading Uprobes. -type UprobeOptions struct { - // Symbol address. Must be provided in case of external symbols (shared libs). - // If set, overrides the address eventually parsed from the executable. - Address uint64 - // The offset relative to given symbol. Useful when tracing an arbitrary point - // inside the frame of given symbol. - // - // Note: this field changed from being an absolute offset to being relative - // to Address. - Offset uint64 - // Only set the uprobe on the given process ID. Useful when tracing - // shared library calls or programs that have many running instances. - PID int - // Automatically manage SDT reference counts (semaphores). - // - // If this field is set, the Kernel will increment/decrement the - // semaphore located in the process memory at the provided address on - // probe attach/detach. - // - // See also: - // sourceware.org/systemtap/wiki/UserSpaceProbeImplementation (Semaphore Handling) - // github.com/torvalds/linux/commit/1cc33161a83d - // github.com/torvalds/linux/commit/a6ca88b241d5 - RefCtrOffset uint64 - // Arbitrary value that can be fetched from an eBPF program - // via `bpf_get_attach_cookie()`. - // - // Needs kernel 5.15+. - Cookie uint64 - // Prefix used for the event name if the uprobe must be attached using tracefs. - // The group name will be formatted as `_`. - // The default empty string is equivalent to "ebpf" as the prefix. - TraceFSPrefix string -} - -func (uo *UprobeOptions) cookie() uint64 { - if uo == nil { - return 0 - } - return uo.Cookie -} - -// To open a new Executable, use: -// -// OpenExecutable("/bin/bash") -// -// The returned value can then be used to open Uprobe(s). -func OpenExecutable(path string) (*Executable, error) { - if path == "" { - return nil, fmt.Errorf("path cannot be empty") - } - - f, err := internal.OpenSafeELFFile(path) - if err != nil { - return nil, fmt.Errorf("parse ELF file: %w", err) - } - defer f.Close() - - if f.Type != elf.ET_EXEC && f.Type != elf.ET_DYN { - // ELF is not an executable or a shared object. - return nil, errors.New("the given file is not an executable or a shared object") - } - - return &Executable{ - path: path, - cachedAddresses: make(map[string]uint64), - }, nil -} - -func (ex *Executable) load(f *internal.SafeELFFile) error { - syms, err := f.Symbols() - if err != nil && !errors.Is(err, elf.ErrNoSymbols) { - return err - } - - dynsyms, err := f.DynamicSymbols() - if err != nil && !errors.Is(err, elf.ErrNoSymbols) { - return err - } - - syms = append(syms, dynsyms...) - - for _, s := range syms { - if elf.ST_TYPE(s.Info) != elf.STT_FUNC { - // Symbol not associated with a function or other executable code. - continue - } - - address := s.Value - - // Loop over ELF segments. - for _, prog := range f.Progs { - // Skip uninteresting segments. - if prog.Type != elf.PT_LOAD || (prog.Flags&elf.PF_X) == 0 { - continue - } - - if prog.Vaddr <= s.Value && s.Value < (prog.Vaddr+prog.Memsz) { - // If the symbol value is contained in the segment, calculate - // the symbol offset. - // - // fn symbol offset = fn symbol VA - .text VA + .text offset - // - // stackoverflow.com/a/40249502 - address = s.Value - prog.Vaddr + prog.Off - break - } - } - - ex.cachedAddresses[s.Name] = address - } - - return nil -} - -// address calculates the address of a symbol in the executable. -// -// opts must not be nil. -func (ex *Executable) address(symbol string, address, offset uint64) (uint64, error) { - if address > 0 { - return address + offset, nil - } - - var err error - ex.cacheAddressesOnce.Do(func() { - var f *internal.SafeELFFile - f, err = internal.OpenSafeELFFile(ex.path) - if err != nil { - err = fmt.Errorf("parse ELF file: %w", err) - return - } - defer f.Close() - - err = ex.load(f) - }) - if err != nil { - return 0, fmt.Errorf("lazy load symbols: %w", err) - } - - address, ok := ex.cachedAddresses[symbol] - if !ok { - return 0, fmt.Errorf("symbol %s: %w", symbol, ErrNoSymbol) - } - - // Symbols with location 0 from section undef are shared library calls and - // are relocated before the binary is executed. Dynamic linking is not - // implemented by the library, so mark this as unsupported for now. - // - // Since only offset values are stored and not elf.Symbol, if the value is 0, - // assume it's an external symbol. - if address == 0 { - return 0, fmt.Errorf("cannot resolve %s library call '%s': %w "+ - "(consider providing UprobeOptions.Address)", ex.path, symbol, ErrNotSupported) - } - - return address + offset, nil -} - -// Uprobe attaches the given eBPF program to a perf event that fires when the -// given symbol starts executing in the given Executable. -// For example, /bin/bash::main(): -// -// ex, _ = OpenExecutable("/bin/bash") -// ex.Uprobe("main", prog, nil) -// -// When using symbols which belongs to shared libraries, -// an offset must be provided via options: -// -// up, err := ex.Uprobe("main", prog, &UprobeOptions{Offset: 0x123}) -// -// Note: Setting the Offset field in the options supersedes the symbol's offset. -// -// Losing the reference to the resulting Link (up) will close the Uprobe -// and prevent further execution of prog. The Link must be Closed during -// program shutdown to avoid leaking system resources. -// -// Functions provided by shared libraries can currently not be traced and -// will result in an ErrNotSupported. -func (ex *Executable) Uprobe(symbol string, prog *ebpf.Program, opts *UprobeOptions) (Link, error) { - u, err := ex.uprobe(symbol, prog, opts, false) - if err != nil { - return nil, err - } - - lnk, err := attachPerfEvent(u, prog, opts.cookie()) - if err != nil { - u.Close() - return nil, err - } - - return lnk, nil -} - -// Uretprobe attaches the given eBPF program to a perf event that fires right -// before the given symbol exits. For example, /bin/bash::main(): -// -// ex, _ = OpenExecutable("/bin/bash") -// ex.Uretprobe("main", prog, nil) -// -// When using symbols which belongs to shared libraries, -// an offset must be provided via options: -// -// up, err := ex.Uretprobe("main", prog, &UprobeOptions{Offset: 0x123}) -// -// Note: Setting the Offset field in the options supersedes the symbol's offset. -// -// Losing the reference to the resulting Link (up) will close the Uprobe -// and prevent further execution of prog. The Link must be Closed during -// program shutdown to avoid leaking system resources. -// -// Functions provided by shared libraries can currently not be traced and -// will result in an ErrNotSupported. -func (ex *Executable) Uretprobe(symbol string, prog *ebpf.Program, opts *UprobeOptions) (Link, error) { - u, err := ex.uprobe(symbol, prog, opts, true) - if err != nil { - return nil, err - } - - lnk, err := attachPerfEvent(u, prog, opts.cookie()) - if err != nil { - u.Close() - return nil, err - } - - return lnk, nil -} - -// uprobe opens a perf event for the given binary/symbol and attaches prog to it. -// If ret is true, create a uretprobe. -func (ex *Executable) uprobe(symbol string, prog *ebpf.Program, opts *UprobeOptions, ret bool) (*perfEvent, error) { - if prog == nil { - return nil, fmt.Errorf("prog cannot be nil: %w", errInvalidInput) - } - if prog.Type() != ebpf.Kprobe { - return nil, fmt.Errorf("eBPF program type %s is not Kprobe: %w", prog.Type(), errInvalidInput) - } - if opts == nil { - opts = &UprobeOptions{} - } - - offset, err := ex.address(symbol, opts.Address, opts.Offset) - if err != nil { - return nil, err - } - - pid := opts.PID - if pid == 0 { - pid = perfAllThreads - } - - if opts.RefCtrOffset != 0 { - if err := haveRefCtrOffsetPMU(); err != nil { - return nil, fmt.Errorf("uprobe ref_ctr_offset: %w", err) - } - } - - args := tracefs.ProbeArgs{ - Type: tracefs.Uprobe, - Symbol: symbol, - Path: ex.path, - Offset: offset, - Pid: pid, - RefCtrOffset: opts.RefCtrOffset, - Ret: ret, - Cookie: opts.Cookie, - Group: opts.TraceFSPrefix, - } - - // Use uprobe PMU if the kernel has it available. - tp, err := pmuProbe(args) - if err == nil { - return tp, nil - } - if err != nil && !errors.Is(err, ErrNotSupported) { - return nil, fmt.Errorf("creating perf_uprobe PMU: %w", err) - } - - // Use tracefs if uprobe PMU is missing. - tp, err = tracefsProbe(args) - if err != nil { - return nil, fmt.Errorf("creating trace event '%s:%s' in tracefs: %w", ex.path, symbol, err) - } - - return tp, nil -} diff --git a/vendor/github.com/cilium/ebpf/link/uprobe_multi.go b/vendor/github.com/cilium/ebpf/link/uprobe_multi.go deleted file mode 100644 index 9a8d329c8..000000000 --- a/vendor/github.com/cilium/ebpf/link/uprobe_multi.go +++ /dev/null @@ -1,224 +0,0 @@ -package link - -import ( - "errors" - "fmt" - "os" - "unsafe" - - "github.com/cilium/ebpf" - "github.com/cilium/ebpf/asm" - "github.com/cilium/ebpf/internal" - "github.com/cilium/ebpf/internal/sys" - "github.com/cilium/ebpf/internal/unix" -) - -// UprobeMultiOptions defines additional parameters that will be used -// when opening a UprobeMulti Link. -type UprobeMultiOptions struct { - // Symbol addresses. If set, overrides the addresses eventually parsed from - // the executable. Mutually exclusive with UprobeMulti's symbols argument. - Addresses []uint64 - - // Offsets into functions provided by UprobeMulti's symbols argument. - // For example: to set uprobes to main+5 and _start+10, call UprobeMulti - // with: - // symbols: "main", "_start" - // opt.Offsets: 5, 10 - Offsets []uint64 - - // Optional list of associated ref counter offsets. - RefCtrOffsets []uint64 - - // Optional list of associated BPF cookies. - Cookies []uint64 - - // Only set the uprobe_multi link on the given process ID, zero PID means - // system-wide. - PID uint32 -} - -func (ex *Executable) UprobeMulti(symbols []string, prog *ebpf.Program, opts *UprobeMultiOptions) (Link, error) { - return ex.uprobeMulti(symbols, prog, opts, 0) -} - -func (ex *Executable) UretprobeMulti(symbols []string, prog *ebpf.Program, opts *UprobeMultiOptions) (Link, error) { - - // The return probe is not limited for symbols entry, so there's no special - // setup for return uprobes (other than the extra flag). The symbols, opts.Offsets - // and opts.Addresses arrays follow the same logic as for entry uprobes. - return ex.uprobeMulti(symbols, prog, opts, unix.BPF_F_UPROBE_MULTI_RETURN) -} - -func (ex *Executable) uprobeMulti(symbols []string, prog *ebpf.Program, opts *UprobeMultiOptions, flags uint32) (Link, error) { - if prog == nil { - return nil, errors.New("cannot attach a nil program") - } - - if opts == nil { - opts = &UprobeMultiOptions{} - } - - addresses, err := ex.addresses(symbols, opts.Addresses, opts.Offsets) - if err != nil { - return nil, err - } - - addrs := len(addresses) - cookies := len(opts.Cookies) - refCtrOffsets := len(opts.RefCtrOffsets) - - if addrs == 0 { - return nil, fmt.Errorf("Addresses are required: %w", errInvalidInput) - } - if refCtrOffsets > 0 && refCtrOffsets != addrs { - return nil, fmt.Errorf("RefCtrOffsets must be exactly Addresses in length: %w", errInvalidInput) - } - if cookies > 0 && cookies != addrs { - return nil, fmt.Errorf("Cookies must be exactly Addresses in length: %w", errInvalidInput) - } - - attr := &sys.LinkCreateUprobeMultiAttr{ - Path: sys.NewStringPointer(ex.path), - ProgFd: uint32(prog.FD()), - AttachType: sys.BPF_TRACE_UPROBE_MULTI, - UprobeMultiFlags: flags, - Count: uint32(addrs), - Offsets: sys.NewPointer(unsafe.Pointer(&addresses[0])), - Pid: opts.PID, - } - - if refCtrOffsets != 0 { - attr.RefCtrOffsets = sys.NewPointer(unsafe.Pointer(&opts.RefCtrOffsets[0])) - } - if cookies != 0 { - attr.Cookies = sys.NewPointer(unsafe.Pointer(&opts.Cookies[0])) - } - - fd, err := sys.LinkCreateUprobeMulti(attr) - if errors.Is(err, unix.ESRCH) { - return nil, fmt.Errorf("%w (specified pid not found?)", os.ErrNotExist) - } - if errors.Is(err, unix.EINVAL) { - return nil, fmt.Errorf("%w (missing symbol or prog's AttachType not AttachTraceUprobeMulti?)", err) - } - - if err != nil { - if haveFeatErr := haveBPFLinkUprobeMulti(); haveFeatErr != nil { - return nil, haveFeatErr - } - return nil, err - } - - return &uprobeMultiLink{RawLink{fd, ""}}, nil -} - -func (ex *Executable) addresses(symbols []string, addresses, offsets []uint64) ([]uint64, error) { - n := len(symbols) - if n == 0 { - n = len(addresses) - } - - if n == 0 { - return nil, fmt.Errorf("%w: neither symbols nor addresses given", errInvalidInput) - } - - if symbols != nil && len(symbols) != n { - return nil, fmt.Errorf("%w: have %d symbols but want %d", errInvalidInput, len(symbols), n) - } - - if addresses != nil && len(addresses) != n { - return nil, fmt.Errorf("%w: have %d addresses but want %d", errInvalidInput, len(addresses), n) - } - - if offsets != nil && len(offsets) != n { - return nil, fmt.Errorf("%w: have %d offsets but want %d", errInvalidInput, len(offsets), n) - } - - results := make([]uint64, 0, n) - for i := 0; i < n; i++ { - var sym string - if symbols != nil { - sym = symbols[i] - } - - var addr, off uint64 - if addresses != nil { - addr = addresses[i] - } - - if offsets != nil { - off = offsets[i] - } - - result, err := ex.address(sym, addr, off) - if err != nil { - return nil, err - } - - results = append(results, result) - } - - return results, nil -} - -type uprobeMultiLink struct { - RawLink -} - -var _ Link = (*uprobeMultiLink)(nil) - -func (kml *uprobeMultiLink) Update(prog *ebpf.Program) error { - return fmt.Errorf("update uprobe_multi: %w", ErrNotSupported) -} - -func (kml *uprobeMultiLink) Pin(string) error { - return fmt.Errorf("pin uprobe_multi: %w", ErrNotSupported) -} - -func (kml *uprobeMultiLink) Unpin() error { - return fmt.Errorf("unpin uprobe_multi: %w", ErrNotSupported) -} - -var haveBPFLinkUprobeMulti = internal.NewFeatureTest("bpf_link_uprobe_multi", "6.6", func() error { - prog, err := ebpf.NewProgram(&ebpf.ProgramSpec{ - Name: "probe_upm_link", - Type: ebpf.Kprobe, - Instructions: asm.Instructions{ - asm.Mov.Imm(asm.R0, 0), - asm.Return(), - }, - AttachType: ebpf.AttachTraceUprobeMulti, - License: "MIT", - }) - if errors.Is(err, unix.E2BIG) { - // Kernel doesn't support AttachType field. - return internal.ErrNotSupported - } - if err != nil { - return err - } - defer prog.Close() - - // We try to create uprobe multi link on '/' path which results in - // error with -EBADF in case uprobe multi link is supported. - fd, err := sys.LinkCreateUprobeMulti(&sys.LinkCreateUprobeMultiAttr{ - ProgFd: uint32(prog.FD()), - AttachType: sys.BPF_TRACE_UPROBE_MULTI, - Path: sys.NewStringPointer("/"), - Offsets: sys.NewPointer(unsafe.Pointer(&[]uint64{0})), - Count: 1, - }) - switch { - case errors.Is(err, unix.EBADF): - return nil - case errors.Is(err, unix.EINVAL): - return internal.ErrNotSupported - case err != nil: - return err - } - - // should not happen - fd.Close() - return errors.New("successfully attached uprobe_multi to /, kernel bug?") -}) diff --git a/vendor/github.com/cilium/ebpf/link/xdp.go b/vendor/github.com/cilium/ebpf/link/xdp.go deleted file mode 100644 index aa8dd3a4c..000000000 --- a/vendor/github.com/cilium/ebpf/link/xdp.go +++ /dev/null @@ -1,54 +0,0 @@ -package link - -import ( - "fmt" - - "github.com/cilium/ebpf" -) - -// XDPAttachFlags represents how XDP program will be attached to interface. -type XDPAttachFlags uint32 - -const ( - // XDPGenericMode (SKB) links XDP BPF program for drivers which do - // not yet support native XDP. - XDPGenericMode XDPAttachFlags = 1 << (iota + 1) - // XDPDriverMode links XDP BPF program into the driver’s receive path. - XDPDriverMode - // XDPOffloadMode offloads the entire XDP BPF program into hardware. - XDPOffloadMode -) - -type XDPOptions struct { - // Program must be an XDP BPF program. - Program *ebpf.Program - - // Interface is the interface index to attach program to. - Interface int - - // Flags is one of XDPAttachFlags (optional). - // - // Only one XDP mode should be set, without flag defaults - // to driver/generic mode (best effort). - Flags XDPAttachFlags -} - -// AttachXDP links an XDP BPF program to an XDP hook. -func AttachXDP(opts XDPOptions) (Link, error) { - if t := opts.Program.Type(); t != ebpf.XDP { - return nil, fmt.Errorf("invalid program type %s, expected XDP", t) - } - - if opts.Interface < 1 { - return nil, fmt.Errorf("invalid interface index: %d", opts.Interface) - } - - rawLink, err := AttachRawLink(RawLinkOptions{ - Program: opts.Program, - Attach: ebpf.AttachXDP, - Target: opts.Interface, - Flags: uint32(opts.Flags), - }) - - return rawLink, err -} diff --git a/vendor/github.com/cilium/ebpf/linker.go b/vendor/github.com/cilium/ebpf/linker.go deleted file mode 100644 index 788f21b7b..000000000 --- a/vendor/github.com/cilium/ebpf/linker.go +++ /dev/null @@ -1,459 +0,0 @@ -package ebpf - -import ( - "debug/elf" - "encoding/binary" - "errors" - "fmt" - "io" - "io/fs" - "math" - "slices" - - "github.com/cilium/ebpf/asm" - "github.com/cilium/ebpf/btf" - "github.com/cilium/ebpf/internal" -) - -// handles stores handle objects to avoid gc cleanup -type handles []*btf.Handle - -func (hs *handles) add(h *btf.Handle) (int, error) { - if h == nil { - return 0, nil - } - - if len(*hs) == math.MaxInt16 { - return 0, fmt.Errorf("can't add more than %d module FDs to fdArray", math.MaxInt16) - } - - *hs = append(*hs, h) - - // return length of slice so that indexes start at 1 - return len(*hs), nil -} - -func (hs handles) fdArray() []int32 { - // first element of fda is reserved as no module can be indexed with 0 - fda := []int32{0} - for _, h := range hs { - fda = append(fda, int32(h.FD())) - } - - return fda -} - -func (hs *handles) Close() error { - var errs []error - for _, h := range *hs { - errs = append(errs, h.Close()) - } - return errors.Join(errs...) -} - -// splitSymbols splits insns into subsections delimited by Symbol Instructions. -// insns cannot be empty and must start with a Symbol Instruction. -// -// The resulting map is indexed by Symbol name. -func splitSymbols(insns asm.Instructions) (map[string]asm.Instructions, error) { - if len(insns) == 0 { - return nil, errors.New("insns is empty") - } - - currentSym := insns[0].Symbol() - if currentSym == "" { - return nil, errors.New("insns must start with a Symbol") - } - - start := 0 - progs := make(map[string]asm.Instructions) - for i, ins := range insns[1:] { - i := i + 1 - - sym := ins.Symbol() - if sym == "" { - continue - } - - // New symbol, flush the old one out. - progs[currentSym] = slices.Clone(insns[start:i]) - - if progs[sym] != nil { - return nil, fmt.Errorf("insns contains duplicate Symbol %s", sym) - } - currentSym = sym - start = i - } - - if tail := insns[start:]; len(tail) > 0 { - progs[currentSym] = slices.Clone(tail) - } - - return progs, nil -} - -// The linker is responsible for resolving bpf-to-bpf calls between programs -// within an ELF. Each BPF program must be a self-contained binary blob, -// so when an instruction in one ELF program section wants to jump to -// a function in another, the linker needs to pull in the bytecode -// (and BTF info) of the target function and concatenate the instruction -// streams. -// -// Later on in the pipeline, all call sites are fixed up with relative jumps -// within this newly-created instruction stream to then finally hand off to -// the kernel with BPF_PROG_LOAD. -// -// Each function is denoted by an ELF symbol and the compiler takes care of -// register setup before each jump instruction. - -// hasFunctionReferences returns true if insns contains one or more bpf2bpf -// function references. -func hasFunctionReferences(insns asm.Instructions) bool { - for _, i := range insns { - if i.IsFunctionReference() { - return true - } - } - return false -} - -// applyRelocations collects and applies any CO-RE relocations in insns. -// -// Passing a nil target will relocate against the running kernel. insns are -// modified in place. -func applyRelocations(insns asm.Instructions, targets []*btf.Spec, kmodName string, bo binary.ByteOrder, b *btf.Builder) error { - var relos []*btf.CORERelocation - var reloInsns []*asm.Instruction - iter := insns.Iterate() - for iter.Next() { - if relo := btf.CORERelocationMetadata(iter.Ins); relo != nil { - relos = append(relos, relo) - reloInsns = append(reloInsns, iter.Ins) - } - } - - if len(relos) == 0 { - return nil - } - - if bo == nil { - bo = internal.NativeEndian - } - - if len(targets) == 0 { - kernelTarget, err := btf.LoadKernelSpec() - if err != nil { - return fmt.Errorf("load kernel spec: %w", err) - } - targets = append(targets, kernelTarget) - - if kmodName != "" { - kmodTarget, err := btf.LoadKernelModuleSpec(kmodName) - // Ignore ErrNotExists to cater to kernels which have CONFIG_DEBUG_INFO_BTF_MODULES disabled. - if err != nil && !errors.Is(err, fs.ErrNotExist) { - return fmt.Errorf("load kernel module spec: %w", err) - } - if err == nil { - targets = append(targets, kmodTarget) - } - } - } - - fixups, err := btf.CORERelocate(relos, targets, bo, b.Add) - if err != nil { - return err - } - - for i, fixup := range fixups { - if err := fixup.Apply(reloInsns[i]); err != nil { - return fmt.Errorf("fixup for %s: %w", relos[i], err) - } - } - - return nil -} - -// flattenPrograms resolves bpf-to-bpf calls for a set of programs. -// -// Links all programs in names by modifying their ProgramSpec in progs. -func flattenPrograms(progs map[string]*ProgramSpec, names []string) { - // Pre-calculate all function references. - refs := make(map[*ProgramSpec][]string) - for _, prog := range progs { - refs[prog] = prog.Instructions.FunctionReferences() - } - - // Create a flattened instruction stream, but don't modify progs yet to - // avoid linking multiple times. - flattened := make([]asm.Instructions, 0, len(names)) - for _, name := range names { - flattened = append(flattened, flattenInstructions(name, progs, refs)) - } - - // Finally, assign the flattened instructions. - for i, name := range names { - progs[name].Instructions = flattened[i] - } -} - -// flattenInstructions resolves bpf-to-bpf calls for a single program. -// -// Flattens the instructions of prog by concatenating the instructions of all -// direct and indirect dependencies. -// -// progs contains all referenceable programs, while refs contain the direct -// dependencies of each program. -func flattenInstructions(name string, progs map[string]*ProgramSpec, refs map[*ProgramSpec][]string) asm.Instructions { - prog := progs[name] - - insns := make(asm.Instructions, len(prog.Instructions)) - copy(insns, prog.Instructions) - - // Add all direct references of prog to the list of to be linked programs. - pending := make([]string, len(refs[prog])) - copy(pending, refs[prog]) - - // All references for which we've appended instructions. - linked := make(map[string]bool) - - // Iterate all pending references. We can't use a range since pending is - // modified in the body below. - for len(pending) > 0 { - var ref string - ref, pending = pending[0], pending[1:] - - if linked[ref] { - // We've already linked this ref, don't append instructions again. - continue - } - - progRef := progs[ref] - if progRef == nil { - // We don't have instructions that go with this reference. This - // happens when calling extern functions. - continue - } - - insns = append(insns, progRef.Instructions...) - linked[ref] = true - - // Make sure we link indirect references. - pending = append(pending, refs[progRef]...) - } - - return insns -} - -// fixupAndValidate is called by the ELF reader right before marshaling the -// instruction stream. It performs last-minute adjustments to the program and -// runs some sanity checks before sending it off to the kernel. -func fixupAndValidate(insns asm.Instructions) error { - iter := insns.Iterate() - for iter.Next() { - ins := iter.Ins - - // Map load was tagged with a Reference, but does not contain a Map pointer. - needsMap := ins.Reference() != "" || ins.Metadata.Get(kconfigMetaKey{}) != nil - if ins.IsLoadFromMap() && needsMap && ins.Map() == nil { - return fmt.Errorf("instruction %d: %w", iter.Index, asm.ErrUnsatisfiedMapReference) - } - - fixupProbeReadKernel(ins) - } - - return nil -} - -// POISON_CALL_KFUNC_BASE in libbpf. -// https://github.com/libbpf/libbpf/blob/2778cbce609aa1e2747a69349f7f46a2f94f0522/src/libbpf.c#L5767 -const kfuncCallPoisonBase = 2002000000 - -// fixupKfuncs loops over all instructions in search for kfunc calls. -// If at least one is found, the current kernels BTF and module BTFis are searched to set Instruction.Constant -// and Instruction.Offset to the correct values. -func fixupKfuncs(insns asm.Instructions) (_ handles, err error) { - closeOnError := func(c io.Closer) { - if err != nil { - c.Close() - } - } - - iter := insns.Iterate() - for iter.Next() { - ins := iter.Ins - if metadata := ins.Metadata.Get(kfuncMetaKey{}); metadata != nil { - goto fixups - } - } - - return nil, nil - -fixups: - // only load the kernel spec if we found at least one kfunc call - kernelSpec, err := btf.LoadKernelSpec() - if err != nil { - return nil, err - } - - fdArray := make(handles, 0) - defer closeOnError(&fdArray) - - for { - ins := iter.Ins - - metadata := ins.Metadata.Get(kfuncMetaKey{}) - if metadata == nil { - if !iter.Next() { - // break loop if this was the last instruction in the stream. - break - } - continue - } - - // check meta, if no meta return err - kfm, _ := metadata.(*kfuncMeta) - if kfm == nil { - return nil, fmt.Errorf("kfuncMetaKey doesn't contain kfuncMeta") - } - - target := btf.Type((*btf.Func)(nil)) - spec, module, err := findTargetInKernel(kernelSpec, kfm.Func.Name, &target) - if kfm.Binding == elf.STB_WEAK && errors.Is(err, btf.ErrNotFound) { - if ins.IsKfuncCall() { - // If the kfunc call is weak and not found, poison the call. Use a recognizable constant - // to make it easier to debug. And set src to zero so the verifier doesn't complain - // about the invalid imm/offset values before dead-code elimination. - ins.Constant = kfuncCallPoisonBase - ins.Src = 0 - } else if ins.OpCode.IsDWordLoad() { - // If the kfunc DWordLoad is weak and not found, set its address to 0. - ins.Constant = 0 - ins.Src = 0 - } else { - return nil, fmt.Errorf("only kfunc calls and dword loads may have kfunc metadata") - } - - iter.Next() - continue - } - // Error on non-weak kfunc not found. - if errors.Is(err, btf.ErrNotFound) { - return nil, fmt.Errorf("kfunc %q: %w", kfm.Func.Name, ErrNotSupported) - } - if err != nil { - return nil, err - } - - idx, err := fdArray.add(module) - if err != nil { - return nil, err - } - - if err := btf.CheckTypeCompatibility(kfm.Func.Type, target.(*btf.Func).Type); err != nil { - return nil, &incompatibleKfuncError{kfm.Func.Name, err} - } - - id, err := spec.TypeID(target) - if err != nil { - return nil, err - } - - ins.Constant = int64(id) - ins.Offset = int16(idx) - - if !iter.Next() { - break - } - } - - return fdArray, nil -} - -type incompatibleKfuncError struct { - name string - err error -} - -func (ike *incompatibleKfuncError) Error() string { - return fmt.Sprintf("kfunc %q: %s", ike.name, ike.err) -} - -// fixupProbeReadKernel replaces calls to bpf_probe_read_{kernel,user}(_str) -// with bpf_probe_read(_str) on kernels that don't support it yet. -func fixupProbeReadKernel(ins *asm.Instruction) { - if !ins.IsBuiltinCall() { - return - } - - // Kernel supports bpf_probe_read_kernel, nothing to do. - if haveProbeReadKernel() == nil { - return - } - - switch asm.BuiltinFunc(ins.Constant) { - case asm.FnProbeReadKernel, asm.FnProbeReadUser: - ins.Constant = int64(asm.FnProbeRead) - case asm.FnProbeReadKernelStr, asm.FnProbeReadUserStr: - ins.Constant = int64(asm.FnProbeReadStr) - } -} - -// resolveKconfigReferences creates and populates a .kconfig map if necessary. -// -// Returns a nil Map and no error if no references exist. -func resolveKconfigReferences(insns asm.Instructions) (_ *Map, err error) { - closeOnError := func(c io.Closer) { - if err != nil { - c.Close() - } - } - - var spec *MapSpec - iter := insns.Iterate() - for iter.Next() { - meta, _ := iter.Ins.Metadata.Get(kconfigMetaKey{}).(*kconfigMeta) - if meta != nil { - spec = meta.Map - break - } - } - - if spec == nil { - return nil, nil - } - - cpy := spec.Copy() - if err := resolveKconfig(cpy); err != nil { - return nil, err - } - - kconfig, err := NewMap(cpy) - if err != nil { - return nil, err - } - defer closeOnError(kconfig) - - // Resolve all instructions which load from .kconfig map with actual map - // and offset inside it. - iter = insns.Iterate() - for iter.Next() { - meta, _ := iter.Ins.Metadata.Get(kconfigMetaKey{}).(*kconfigMeta) - if meta == nil { - continue - } - - if meta.Map != spec { - return nil, fmt.Errorf("instruction %d: reference to multiple .kconfig maps is not allowed", iter.Index) - } - - if err := iter.Ins.AssociateMap(kconfig); err != nil { - return nil, fmt.Errorf("instruction %d: %w", iter.Index, err) - } - - // Encode a map read at the offset of the var in the datasec. - iter.Ins.Constant = int64(uint64(meta.Offset) << 32) - iter.Ins.Metadata.Set(kconfigMetaKey{}, nil) - } - - return kconfig, nil -} diff --git a/vendor/github.com/cilium/ebpf/map.go b/vendor/github.com/cilium/ebpf/map.go deleted file mode 100644 index e46fa3f12..000000000 --- a/vendor/github.com/cilium/ebpf/map.go +++ /dev/null @@ -1,1625 +0,0 @@ -package ebpf - -import ( - "bytes" - "errors" - "fmt" - "io" - "math/rand" - "os" - "path/filepath" - "reflect" - "strings" - "sync" - "time" - "unsafe" - - "github.com/cilium/ebpf/btf" - "github.com/cilium/ebpf/internal" - "github.com/cilium/ebpf/internal/sys" - "github.com/cilium/ebpf/internal/sysenc" - "github.com/cilium/ebpf/internal/unix" -) - -// Errors returned by Map and MapIterator methods. -var ( - ErrKeyNotExist = errors.New("key does not exist") - ErrKeyExist = errors.New("key already exists") - ErrIterationAborted = errors.New("iteration aborted") - ErrMapIncompatible = errors.New("map spec is incompatible with existing map") - errMapNoBTFValue = errors.New("map spec does not contain a BTF Value") -) - -// MapOptions control loading a map into the kernel. -type MapOptions struct { - // The base path to pin maps in if requested via PinByName. - // Existing maps will be re-used if they are compatible, otherwise an - // error is returned. - PinPath string - LoadPinOptions LoadPinOptions -} - -// MapID represents the unique ID of an eBPF map -type MapID uint32 - -// MapSpec defines a Map. -type MapSpec struct { - // Name is passed to the kernel as a debug aid. Must only contain - // alpha numeric and '_' characters. - Name string - Type MapType - KeySize uint32 - ValueSize uint32 - MaxEntries uint32 - - // Flags is passed to the kernel and specifies additional map - // creation attributes. - Flags uint32 - - // Automatically pin and load a map from MapOptions.PinPath. - // Generates an error if an existing pinned map is incompatible with the MapSpec. - Pinning PinType - - // Specify numa node during map creation - // (effective only if unix.BPF_F_NUMA_NODE flag is set, - // which can be imported from golang.org/x/sys/unix) - NumaNode uint32 - - // The initial contents of the map. May be nil. - Contents []MapKV - - // Whether to freeze a map after setting its initial contents. - Freeze bool - - // InnerMap is used as a template for ArrayOfMaps and HashOfMaps - InnerMap *MapSpec - - // Extra trailing bytes found in the ELF map definition when using structs - // larger than libbpf's bpf_map_def. nil if no trailing bytes were present. - // Must be nil or empty before instantiating the MapSpec into a Map. - Extra *bytes.Reader - - // The key and value type of this map. May be nil. - Key, Value btf.Type -} - -func (ms *MapSpec) String() string { - return fmt.Sprintf("%s(keySize=%d, valueSize=%d, maxEntries=%d, flags=%d)", ms.Type, ms.KeySize, ms.ValueSize, ms.MaxEntries, ms.Flags) -} - -// Copy returns a copy of the spec. -// -// MapSpec.Contents is a shallow copy. -func (ms *MapSpec) Copy() *MapSpec { - if ms == nil { - return nil - } - - cpy := *ms - - cpy.Contents = make([]MapKV, len(ms.Contents)) - copy(cpy.Contents, ms.Contents) - - cpy.InnerMap = ms.InnerMap.Copy() - - return &cpy -} - -// fixupMagicFields fills fields of MapSpec which are usually -// left empty in ELF or which depend on runtime information. -// -// The method doesn't modify Spec, instead returning a copy. -// The copy is only performed if fixups are necessary, so callers mustn't mutate -// the returned spec. -func (spec *MapSpec) fixupMagicFields() (*MapSpec, error) { - switch spec.Type { - case ArrayOfMaps, HashOfMaps: - if spec.ValueSize != 0 && spec.ValueSize != 4 { - return nil, errors.New("ValueSize must be zero or four for map of map") - } - - spec = spec.Copy() - spec.ValueSize = 4 - - case PerfEventArray: - if spec.KeySize != 0 && spec.KeySize != 4 { - return nil, errors.New("KeySize must be zero or four for perf event array") - } - - if spec.ValueSize != 0 && spec.ValueSize != 4 { - return nil, errors.New("ValueSize must be zero or four for perf event array") - } - - spec = spec.Copy() - spec.KeySize = 4 - spec.ValueSize = 4 - - n, err := PossibleCPU() - if err != nil { - return nil, fmt.Errorf("fixup perf event array: %w", err) - } - - if n := uint32(n); spec.MaxEntries == 0 || spec.MaxEntries > n { - // MaxEntries should be zero most of the time, but there is code - // out there which hardcodes large constants. Clamp the number - // of entries to the number of CPUs at most. Allow creating maps with - // less than n items since some kernel selftests relied on this - // behaviour in the past. - spec.MaxEntries = n - } - } - - return spec, nil -} - -// dataSection returns the contents and BTF Datasec descriptor of the spec. -func (ms *MapSpec) dataSection() ([]byte, *btf.Datasec, error) { - if ms.Value == nil { - return nil, nil, errMapNoBTFValue - } - - ds, ok := ms.Value.(*btf.Datasec) - if !ok { - return nil, nil, fmt.Errorf("map value BTF is a %T, not a *btf.Datasec", ms.Value) - } - - if n := len(ms.Contents); n != 1 { - return nil, nil, fmt.Errorf("expected one key, found %d", n) - } - - kv := ms.Contents[0] - value, ok := kv.Value.([]byte) - if !ok { - return nil, nil, fmt.Errorf("value at first map key is %T, not []byte", kv.Value) - } - - return value, ds, nil -} - -// MapKV is used to initialize the contents of a Map. -type MapKV struct { - Key interface{} - Value interface{} -} - -// Compatible returns nil if an existing map may be used instead of creating -// one from the spec. -// -// Returns an error wrapping [ErrMapIncompatible] otherwise. -func (ms *MapSpec) Compatible(m *Map) error { - ms, err := ms.fixupMagicFields() - if err != nil { - return err - } - - diffs := []string{} - if m.typ != ms.Type { - diffs = append(diffs, fmt.Sprintf("Type: %s changed to %s", m.typ, ms.Type)) - } - if m.keySize != ms.KeySize { - diffs = append(diffs, fmt.Sprintf("KeySize: %d changed to %d", m.keySize, ms.KeySize)) - } - if m.valueSize != ms.ValueSize { - diffs = append(diffs, fmt.Sprintf("ValueSize: %d changed to %d", m.valueSize, ms.ValueSize)) - } - if m.maxEntries != ms.MaxEntries { - diffs = append(diffs, fmt.Sprintf("MaxEntries: %d changed to %d", m.maxEntries, ms.MaxEntries)) - } - - // BPF_F_RDONLY_PROG is set unconditionally for devmaps. Explicitly allow this - // mismatch. - if !((ms.Type == DevMap || ms.Type == DevMapHash) && m.flags^ms.Flags == unix.BPF_F_RDONLY_PROG) && - m.flags != ms.Flags { - diffs = append(diffs, fmt.Sprintf("Flags: %d changed to %d", m.flags, ms.Flags)) - } - - if len(diffs) == 0 { - return nil - } - - return fmt.Errorf("%s: %w", strings.Join(diffs, ", "), ErrMapIncompatible) -} - -// Map represents a Map file descriptor. -// -// It is not safe to close a map which is used by other goroutines. -// -// Methods which take interface{} arguments by default encode -// them using binary.Read/Write in the machine's native endianness. -// -// Implement encoding.BinaryMarshaler or encoding.BinaryUnmarshaler -// if you require custom encoding. -type Map struct { - name string - fd *sys.FD - typ MapType - keySize uint32 - valueSize uint32 - maxEntries uint32 - flags uint32 - pinnedPath string - // Per CPU maps return values larger than the size in the spec - fullValueSize int -} - -// NewMapFromFD creates a map from a raw fd. -// -// You should not use fd after calling this function. -func NewMapFromFD(fd int) (*Map, error) { - f, err := sys.NewFD(fd) - if err != nil { - return nil, err - } - - return newMapFromFD(f) -} - -func newMapFromFD(fd *sys.FD) (*Map, error) { - info, err := newMapInfoFromFd(fd) - if err != nil { - fd.Close() - return nil, fmt.Errorf("get map info: %w", err) - } - - return newMap(fd, info.Name, info.Type, info.KeySize, info.ValueSize, info.MaxEntries, info.Flags) -} - -// NewMap creates a new Map. -// -// It's equivalent to calling NewMapWithOptions with default options. -func NewMap(spec *MapSpec) (*Map, error) { - return NewMapWithOptions(spec, MapOptions{}) -} - -// NewMapWithOptions creates a new Map. -// -// Creating a map for the first time will perform feature detection -// by creating small, temporary maps. -// -// The caller is responsible for ensuring the process' rlimit is set -// sufficiently high for locking memory during map creation. This can be done -// by calling rlimit.RemoveMemlock() prior to calling NewMapWithOptions. -// -// May return an error wrapping ErrMapIncompatible. -func NewMapWithOptions(spec *MapSpec, opts MapOptions) (*Map, error) { - m, err := newMapWithOptions(spec, opts) - if err != nil { - return nil, fmt.Errorf("creating map: %w", err) - } - - if err := m.finalize(spec); err != nil { - m.Close() - return nil, fmt.Errorf("populating map: %w", err) - } - - return m, nil -} - -func newMapWithOptions(spec *MapSpec, opts MapOptions) (_ *Map, err error) { - closeOnError := func(c io.Closer) { - if err != nil { - c.Close() - } - } - - switch spec.Pinning { - case PinByName: - if spec.Name == "" { - return nil, fmt.Errorf("pin by name: missing Name") - } - - if opts.PinPath == "" { - return nil, fmt.Errorf("pin by name: missing MapOptions.PinPath") - } - - path := filepath.Join(opts.PinPath, spec.Name) - m, err := LoadPinnedMap(path, &opts.LoadPinOptions) - if errors.Is(err, unix.ENOENT) { - break - } - if err != nil { - return nil, fmt.Errorf("load pinned map: %w", err) - } - defer closeOnError(m) - - if err := spec.Compatible(m); err != nil { - return nil, fmt.Errorf("use pinned map %s: %w", spec.Name, err) - } - - return m, nil - - case PinNone: - // Nothing to do here - - default: - return nil, fmt.Errorf("pin type %d: %w", int(spec.Pinning), ErrNotSupported) - } - - var innerFd *sys.FD - if spec.Type == ArrayOfMaps || spec.Type == HashOfMaps { - if spec.InnerMap == nil { - return nil, fmt.Errorf("%s requires InnerMap", spec.Type) - } - - if spec.InnerMap.Pinning != PinNone { - return nil, errors.New("inner maps cannot be pinned") - } - - template, err := spec.InnerMap.createMap(nil, opts) - if err != nil { - return nil, fmt.Errorf("inner map: %w", err) - } - defer template.Close() - - // Intentionally skip populating and freezing (finalizing) - // the inner map template since it will be removed shortly. - - innerFd = template.fd - } - - m, err := spec.createMap(innerFd, opts) - if err != nil { - return nil, err - } - defer closeOnError(m) - - if spec.Pinning == PinByName { - path := filepath.Join(opts.PinPath, spec.Name) - if err := m.Pin(path); err != nil { - return nil, fmt.Errorf("pin map to %s: %w", path, err) - } - } - - return m, nil -} - -// createMap validates the spec's properties and creates the map in the kernel -// using the given opts. It does not populate or freeze the map. -func (spec *MapSpec) createMap(inner *sys.FD, opts MapOptions) (_ *Map, err error) { - closeOnError := func(closer io.Closer) { - if err != nil { - closer.Close() - } - } - - // Kernels 4.13 through 5.4 used a struct bpf_map_def that contained - // additional 'inner_map_idx' and later 'numa_node' fields. - // In order to support loading these definitions, tolerate the presence of - // extra bytes, but require them to be zeroes. - if spec.Extra != nil { - if _, err := io.Copy(internal.DiscardZeroes{}, spec.Extra); err != nil { - return nil, errors.New("extra contains unhandled non-zero bytes, drain before creating map") - } - } - - spec, err = spec.fixupMagicFields() - if err != nil { - return nil, err - } - - attr := sys.MapCreateAttr{ - MapType: sys.MapType(spec.Type), - KeySize: spec.KeySize, - ValueSize: spec.ValueSize, - MaxEntries: spec.MaxEntries, - MapFlags: sys.MapFlags(spec.Flags), - NumaNode: spec.NumaNode, - } - - if inner != nil { - attr.InnerMapFd = inner.Uint() - } - - if haveObjName() == nil { - attr.MapName = sys.NewObjName(spec.Name) - } - - if spec.Key != nil || spec.Value != nil { - handle, keyTypeID, valueTypeID, err := btf.MarshalMapKV(spec.Key, spec.Value) - if err != nil && !errors.Is(err, btf.ErrNotSupported) { - return nil, fmt.Errorf("load BTF: %w", err) - } - - if handle != nil { - defer handle.Close() - - // Use BTF k/v during map creation. - attr.BtfFd = uint32(handle.FD()) - attr.BtfKeyTypeId = keyTypeID - attr.BtfValueTypeId = valueTypeID - } - } - - fd, err := sys.MapCreate(&attr) - - // Some map types don't support BTF k/v in earlier kernel versions. - // Remove BTF metadata and retry map creation. - if (errors.Is(err, sys.ENOTSUPP) || errors.Is(err, unix.EINVAL)) && attr.BtfFd != 0 { - attr.BtfFd, attr.BtfKeyTypeId, attr.BtfValueTypeId = 0, 0, 0 - fd, err = sys.MapCreate(&attr) - } - if err != nil { - return nil, handleMapCreateError(attr, spec, err) - } - - defer closeOnError(fd) - m, err := newMap(fd, spec.Name, spec.Type, spec.KeySize, spec.ValueSize, spec.MaxEntries, spec.Flags) - if err != nil { - return nil, fmt.Errorf("map create: %w", err) - } - return m, nil -} - -func handleMapCreateError(attr sys.MapCreateAttr, spec *MapSpec, err error) error { - if errors.Is(err, unix.EPERM) { - return fmt.Errorf("map create: %w (MEMLOCK may be too low, consider rlimit.RemoveMemlock)", err) - } - if errors.Is(err, unix.EINVAL) && spec.MaxEntries == 0 { - return fmt.Errorf("map create: %w (MaxEntries may be incorrectly set to zero)", err) - } - if errors.Is(err, unix.EINVAL) && spec.Type == UnspecifiedMap { - return fmt.Errorf("map create: cannot use type %s", UnspecifiedMap) - } - if errors.Is(err, unix.EINVAL) && spec.Flags&unix.BPF_F_NO_PREALLOC > 0 { - return fmt.Errorf("map create: %w (noPrealloc flag may be incompatible with map type %s)", err, spec.Type) - } - - switch spec.Type { - case ArrayOfMaps, HashOfMaps: - if haveFeatErr := haveNestedMaps(); haveFeatErr != nil { - return fmt.Errorf("map create: %w", haveFeatErr) - } - } - if spec.Flags&(unix.BPF_F_RDONLY_PROG|unix.BPF_F_WRONLY_PROG) > 0 || spec.Freeze { - if haveFeatErr := haveMapMutabilityModifiers(); haveFeatErr != nil { - return fmt.Errorf("map create: %w", haveFeatErr) - } - } - if spec.Flags&unix.BPF_F_MMAPABLE > 0 { - if haveFeatErr := haveMmapableMaps(); haveFeatErr != nil { - return fmt.Errorf("map create: %w", haveFeatErr) - } - } - if spec.Flags&unix.BPF_F_INNER_MAP > 0 { - if haveFeatErr := haveInnerMaps(); haveFeatErr != nil { - return fmt.Errorf("map create: %w", haveFeatErr) - } - } - if spec.Flags&unix.BPF_F_NO_PREALLOC > 0 { - if haveFeatErr := haveNoPreallocMaps(); haveFeatErr != nil { - return fmt.Errorf("map create: %w", haveFeatErr) - } - } - // BPF_MAP_TYPE_RINGBUF's max_entries must be a power-of-2 multiple of kernel's page size. - if errors.Is(err, unix.EINVAL) && - (attr.MapType == sys.BPF_MAP_TYPE_RINGBUF || attr.MapType == sys.BPF_MAP_TYPE_USER_RINGBUF) { - pageSize := uint32(os.Getpagesize()) - maxEntries := attr.MaxEntries - if maxEntries%pageSize != 0 || !internal.IsPow(maxEntries) { - return fmt.Errorf("map create: %w (ring map size %d not a multiple of page size %d)", err, maxEntries, pageSize) - } - } - if attr.BtfFd == 0 { - return fmt.Errorf("map create: %w (without BTF k/v)", err) - } - - return fmt.Errorf("map create: %w", err) -} - -// newMap allocates and returns a new Map structure. -// Sets the fullValueSize on per-CPU maps. -func newMap(fd *sys.FD, name string, typ MapType, keySize, valueSize, maxEntries, flags uint32) (*Map, error) { - m := &Map{ - name, - fd, - typ, - keySize, - valueSize, - maxEntries, - flags, - "", - int(valueSize), - } - - if !typ.hasPerCPUValue() { - return m, nil - } - - possibleCPUs, err := PossibleCPU() - if err != nil { - return nil, err - } - - m.fullValueSize = int(internal.Align(valueSize, 8)) * possibleCPUs - return m, nil -} - -func (m *Map) String() string { - if m.name != "" { - return fmt.Sprintf("%s(%s)#%v", m.typ, m.name, m.fd) - } - return fmt.Sprintf("%s#%v", m.typ, m.fd) -} - -// Type returns the underlying type of the map. -func (m *Map) Type() MapType { - return m.typ -} - -// KeySize returns the size of the map key in bytes. -func (m *Map) KeySize() uint32 { - return m.keySize -} - -// ValueSize returns the size of the map value in bytes. -func (m *Map) ValueSize() uint32 { - return m.valueSize -} - -// MaxEntries returns the maximum number of elements the map can hold. -func (m *Map) MaxEntries() uint32 { - return m.maxEntries -} - -// Flags returns the flags of the map. -func (m *Map) Flags() uint32 { - return m.flags -} - -// Info returns metadata about the map. -func (m *Map) Info() (*MapInfo, error) { - return newMapInfoFromFd(m.fd) -} - -// MapLookupFlags controls the behaviour of the map lookup calls. -type MapLookupFlags uint64 - -// LookupLock look up the value of a spin-locked map. -const LookupLock MapLookupFlags = unix.BPF_F_LOCK - -// Lookup retrieves a value from a Map. -// -// Calls Close() on valueOut if it is of type **Map or **Program, -// and *valueOut is not nil. -// -// Returns an error if the key doesn't exist, see ErrKeyNotExist. -func (m *Map) Lookup(key, valueOut interface{}) error { - return m.LookupWithFlags(key, valueOut, 0) -} - -// LookupWithFlags retrieves a value from a Map with flags. -// -// Passing LookupLock flag will look up the value of a spin-locked -// map without returning the lock. This must be specified if the -// elements contain a spinlock. -// -// Calls Close() on valueOut if it is of type **Map or **Program, -// and *valueOut is not nil. -// -// Returns an error if the key doesn't exist, see ErrKeyNotExist. -func (m *Map) LookupWithFlags(key, valueOut interface{}, flags MapLookupFlags) error { - if m.typ.hasPerCPUValue() { - return m.lookupPerCPU(key, valueOut, flags) - } - - valueBytes := makeMapSyscallOutput(valueOut, m.fullValueSize) - if err := m.lookup(key, valueBytes.Pointer(), flags); err != nil { - return err - } - - return m.unmarshalValue(valueOut, valueBytes) -} - -// LookupAndDelete retrieves and deletes a value from a Map. -// -// Returns ErrKeyNotExist if the key doesn't exist. -func (m *Map) LookupAndDelete(key, valueOut interface{}) error { - return m.LookupAndDeleteWithFlags(key, valueOut, 0) -} - -// LookupAndDeleteWithFlags retrieves and deletes a value from a Map. -// -// Passing LookupLock flag will look up and delete the value of a spin-locked -// map without returning the lock. This must be specified if the elements -// contain a spinlock. -// -// Returns ErrKeyNotExist if the key doesn't exist. -func (m *Map) LookupAndDeleteWithFlags(key, valueOut interface{}, flags MapLookupFlags) error { - if m.typ.hasPerCPUValue() { - return m.lookupAndDeletePerCPU(key, valueOut, flags) - } - - valueBytes := makeMapSyscallOutput(valueOut, m.fullValueSize) - if err := m.lookupAndDelete(key, valueBytes.Pointer(), flags); err != nil { - return err - } - return m.unmarshalValue(valueOut, valueBytes) -} - -// LookupBytes gets a value from Map. -// -// Returns a nil value if a key doesn't exist. -func (m *Map) LookupBytes(key interface{}) ([]byte, error) { - valueBytes := make([]byte, m.fullValueSize) - valuePtr := sys.NewSlicePointer(valueBytes) - - err := m.lookup(key, valuePtr, 0) - if errors.Is(err, ErrKeyNotExist) { - return nil, nil - } - - return valueBytes, err -} - -func (m *Map) lookupPerCPU(key, valueOut any, flags MapLookupFlags) error { - slice, err := ensurePerCPUSlice(valueOut, int(m.valueSize)) - if err != nil { - return err - } - valueBytes := make([]byte, m.fullValueSize) - if err := m.lookup(key, sys.NewSlicePointer(valueBytes), flags); err != nil { - return err - } - return unmarshalPerCPUValue(slice, int(m.valueSize), valueBytes) -} - -func (m *Map) lookup(key interface{}, valueOut sys.Pointer, flags MapLookupFlags) error { - keyPtr, err := m.marshalKey(key) - if err != nil { - return fmt.Errorf("can't marshal key: %w", err) - } - - attr := sys.MapLookupElemAttr{ - MapFd: m.fd.Uint(), - Key: keyPtr, - Value: valueOut, - Flags: uint64(flags), - } - - if err = sys.MapLookupElem(&attr); err != nil { - return fmt.Errorf("lookup: %w", wrapMapError(err)) - } - return nil -} - -func (m *Map) lookupAndDeletePerCPU(key, valueOut any, flags MapLookupFlags) error { - slice, err := ensurePerCPUSlice(valueOut, int(m.valueSize)) - if err != nil { - return err - } - valueBytes := make([]byte, m.fullValueSize) - if err := m.lookupAndDelete(key, sys.NewSlicePointer(valueBytes), flags); err != nil { - return err - } - return unmarshalPerCPUValue(slice, int(m.valueSize), valueBytes) -} - -// ensurePerCPUSlice allocates a slice for a per-CPU value if necessary. -func ensurePerCPUSlice(sliceOrPtr any, elemLength int) (any, error) { - sliceOrPtrType := reflect.TypeOf(sliceOrPtr) - if sliceOrPtrType.Kind() == reflect.Slice { - // The target is a slice, the caller is responsible for ensuring that - // size is correct. - return sliceOrPtr, nil - } - - slicePtrType := sliceOrPtrType - if slicePtrType.Kind() != reflect.Ptr || slicePtrType.Elem().Kind() != reflect.Slice { - return nil, fmt.Errorf("per-cpu value requires a slice or a pointer to slice") - } - - possibleCPUs, err := PossibleCPU() - if err != nil { - return nil, err - } - - sliceType := slicePtrType.Elem() - slice := reflect.MakeSlice(sliceType, possibleCPUs, possibleCPUs) - - sliceElemType := sliceType.Elem() - sliceElemIsPointer := sliceElemType.Kind() == reflect.Ptr - reflect.ValueOf(sliceOrPtr).Elem().Set(slice) - if !sliceElemIsPointer { - return slice.Interface(), nil - } - sliceElemType = sliceElemType.Elem() - - for i := 0; i < possibleCPUs; i++ { - newElem := reflect.New(sliceElemType) - slice.Index(i).Set(newElem) - } - - return slice.Interface(), nil -} - -func (m *Map) lookupAndDelete(key any, valuePtr sys.Pointer, flags MapLookupFlags) error { - keyPtr, err := m.marshalKey(key) - if err != nil { - return fmt.Errorf("can't marshal key: %w", err) - } - - attr := sys.MapLookupAndDeleteElemAttr{ - MapFd: m.fd.Uint(), - Key: keyPtr, - Value: valuePtr, - Flags: uint64(flags), - } - - if err := sys.MapLookupAndDeleteElem(&attr); err != nil { - return fmt.Errorf("lookup and delete: %w", wrapMapError(err)) - } - - return nil -} - -// MapUpdateFlags controls the behaviour of the Map.Update call. -// -// The exact semantics depend on the specific MapType. -type MapUpdateFlags uint64 - -const ( - // UpdateAny creates a new element or update an existing one. - UpdateAny MapUpdateFlags = iota - // UpdateNoExist creates a new element. - UpdateNoExist MapUpdateFlags = 1 << (iota - 1) - // UpdateExist updates an existing element. - UpdateExist - // UpdateLock updates elements under bpf_spin_lock. - UpdateLock -) - -// Put replaces or creates a value in map. -// -// It is equivalent to calling Update with UpdateAny. -func (m *Map) Put(key, value interface{}) error { - return m.Update(key, value, UpdateAny) -} - -// Update changes the value of a key. -func (m *Map) Update(key, value any, flags MapUpdateFlags) error { - if m.typ.hasPerCPUValue() { - return m.updatePerCPU(key, value, flags) - } - - valuePtr, err := m.marshalValue(value) - if err != nil { - return fmt.Errorf("marshal value: %w", err) - } - - return m.update(key, valuePtr, flags) -} - -func (m *Map) updatePerCPU(key, value any, flags MapUpdateFlags) error { - valuePtr, err := marshalPerCPUValue(value, int(m.valueSize)) - if err != nil { - return fmt.Errorf("marshal value: %w", err) - } - - return m.update(key, valuePtr, flags) -} - -func (m *Map) update(key any, valuePtr sys.Pointer, flags MapUpdateFlags) error { - keyPtr, err := m.marshalKey(key) - if err != nil { - return fmt.Errorf("marshal key: %w", err) - } - - attr := sys.MapUpdateElemAttr{ - MapFd: m.fd.Uint(), - Key: keyPtr, - Value: valuePtr, - Flags: uint64(flags), - } - - if err = sys.MapUpdateElem(&attr); err != nil { - return fmt.Errorf("update: %w", wrapMapError(err)) - } - - return nil -} - -// Delete removes a value. -// -// Returns ErrKeyNotExist if the key does not exist. -func (m *Map) Delete(key interface{}) error { - keyPtr, err := m.marshalKey(key) - if err != nil { - return fmt.Errorf("can't marshal key: %w", err) - } - - attr := sys.MapDeleteElemAttr{ - MapFd: m.fd.Uint(), - Key: keyPtr, - } - - if err = sys.MapDeleteElem(&attr); err != nil { - return fmt.Errorf("delete: %w", wrapMapError(err)) - } - return nil -} - -// NextKey finds the key following an initial key. -// -// See NextKeyBytes for details. -// -// Returns ErrKeyNotExist if there is no next key. -func (m *Map) NextKey(key, nextKeyOut interface{}) error { - nextKeyBytes := makeMapSyscallOutput(nextKeyOut, int(m.keySize)) - - if err := m.nextKey(key, nextKeyBytes.Pointer()); err != nil { - return err - } - - if err := nextKeyBytes.Unmarshal(nextKeyOut); err != nil { - return fmt.Errorf("can't unmarshal next key: %w", err) - } - return nil -} - -// NextKeyBytes returns the key following an initial key as a byte slice. -// -// Passing nil will return the first key. -// -// Use Iterate if you want to traverse all entries in the map. -// -// Returns nil if there are no more keys. -func (m *Map) NextKeyBytes(key interface{}) ([]byte, error) { - nextKey := make([]byte, m.keySize) - nextKeyPtr := sys.NewSlicePointer(nextKey) - - err := m.nextKey(key, nextKeyPtr) - if errors.Is(err, ErrKeyNotExist) { - return nil, nil - } - - return nextKey, err -} - -func (m *Map) nextKey(key interface{}, nextKeyOut sys.Pointer) error { - var ( - keyPtr sys.Pointer - err error - ) - - if key != nil { - keyPtr, err = m.marshalKey(key) - if err != nil { - return fmt.Errorf("can't marshal key: %w", err) - } - } - - attr := sys.MapGetNextKeyAttr{ - MapFd: m.fd.Uint(), - Key: keyPtr, - NextKey: nextKeyOut, - } - - if err = sys.MapGetNextKey(&attr); err != nil { - // Kernels 4.4.131 and earlier return EFAULT instead of a pointer to the - // first map element when a nil key pointer is specified. - if key == nil && errors.Is(err, unix.EFAULT) { - var guessKey []byte - guessKey, err = m.guessNonExistentKey() - if err != nil { - return err - } - - // Retry the syscall with a valid non-existing key. - attr.Key = sys.NewSlicePointer(guessKey) - if err = sys.MapGetNextKey(&attr); err == nil { - return nil - } - } - - return fmt.Errorf("next key: %w", wrapMapError(err)) - } - - return nil -} - -var mmapProtectedPage = sync.OnceValues(func() ([]byte, error) { - return unix.Mmap(-1, 0, os.Getpagesize(), unix.PROT_NONE, unix.MAP_ANON|unix.MAP_SHARED) -}) - -// guessNonExistentKey attempts to perform a map lookup that returns ENOENT. -// This is necessary on kernels before 4.4.132, since those don't support -// iterating maps from the start by providing an invalid key pointer. -func (m *Map) guessNonExistentKey() ([]byte, error) { - // Map a protected page and use that as the value pointer. This saves some - // work copying out the value, which we're not interested in. - page, err := mmapProtectedPage() - if err != nil { - return nil, err - } - valuePtr := sys.NewSlicePointer(page) - - randKey := make([]byte, int(m.keySize)) - - for i := 0; i < 4; i++ { - switch i { - // For hash maps, the 0 key is less likely to be occupied. They're often - // used for storing data related to pointers, and their access pattern is - // generally scattered across the keyspace. - case 0: - // An all-0xff key is guaranteed to be out of bounds of any array, since - // those have a fixed key size of 4 bytes. The only corner case being - // arrays with 2^32 max entries, but those are prohibitively expensive - // in many environments. - case 1: - for r := range randKey { - randKey[r] = 0xff - } - // Inspired by BCC, 0x55 is an alternating binary pattern (0101), so - // is unlikely to be taken. - case 2: - for r := range randKey { - randKey[r] = 0x55 - } - // Last ditch effort, generate a random key. - case 3: - rand.New(rand.NewSource(time.Now().UnixNano())).Read(randKey) - } - - err := m.lookup(randKey, valuePtr, 0) - if errors.Is(err, ErrKeyNotExist) { - return randKey, nil - } - } - - return nil, errors.New("couldn't find non-existing key") -} - -// BatchLookup looks up many elements in a map at once. -// -// "keysOut" and "valuesOut" must be of type slice, a pointer -// to a slice or buffer will not work. -// "cursor" is an pointer to an opaque handle. It must be non-nil. Pass -// "cursor" to subsequent calls of this function to continue the batching -// operation in the case of chunking. -// -// Warning: This API is not very safe to use as the kernel implementation for -// batching relies on the user to be aware of subtle details with regarding to -// different map type implementations. -// -// ErrKeyNotExist is returned when the batch lookup has reached -// the end of all possible results, even when partial results -// are returned. It should be used to evaluate when lookup is "done". -func (m *Map) BatchLookup(cursor *MapBatchCursor, keysOut, valuesOut interface{}, opts *BatchOptions) (int, error) { - return m.batchLookup(sys.BPF_MAP_LOOKUP_BATCH, cursor, keysOut, valuesOut, opts) -} - -// BatchLookupAndDelete looks up many elements in a map at once, -// -// It then deletes all those elements. -// "keysOut" and "valuesOut" must be of type slice, a pointer -// to a slice or buffer will not work. -// "cursor" is an pointer to an opaque handle. It must be non-nil. Pass -// "cursor" to subsequent calls of this function to continue the batching -// operation in the case of chunking. -// -// Warning: This API is not very safe to use as the kernel implementation for -// batching relies on the user to be aware of subtle details with regarding to -// different map type implementations. -// -// ErrKeyNotExist is returned when the batch lookup has reached -// the end of all possible results, even when partial results -// are returned. It should be used to evaluate when lookup is "done". -func (m *Map) BatchLookupAndDelete(cursor *MapBatchCursor, keysOut, valuesOut interface{}, opts *BatchOptions) (int, error) { - return m.batchLookup(sys.BPF_MAP_LOOKUP_AND_DELETE_BATCH, cursor, keysOut, valuesOut, opts) -} - -// MapBatchCursor represents a starting point for a batch operation. -type MapBatchCursor struct { - m *Map - opaque []byte -} - -func (m *Map) batchLookup(cmd sys.Cmd, cursor *MapBatchCursor, keysOut, valuesOut interface{}, opts *BatchOptions) (int, error) { - if m.typ.hasPerCPUValue() { - return m.batchLookupPerCPU(cmd, cursor, keysOut, valuesOut, opts) - } - - count, err := batchCount(keysOut, valuesOut) - if err != nil { - return 0, err - } - - valueBuf := sysenc.SyscallOutput(valuesOut, count*int(m.fullValueSize)) - - n, err := m.batchLookupCmd(cmd, cursor, count, keysOut, valueBuf.Pointer(), opts) - if err != nil { - return n, err - } - - err = valueBuf.Unmarshal(valuesOut) - if err != nil { - return 0, err - } - - return n, nil -} - -func (m *Map) batchLookupPerCPU(cmd sys.Cmd, cursor *MapBatchCursor, keysOut, valuesOut interface{}, opts *BatchOptions) (int, error) { - count, err := sliceLen(keysOut) - if err != nil { - return 0, fmt.Errorf("keys: %w", err) - } - - valueBuf := make([]byte, count*int(m.fullValueSize)) - valuePtr := sys.NewSlicePointer(valueBuf) - - n, sysErr := m.batchLookupCmd(cmd, cursor, count, keysOut, valuePtr, opts) - if sysErr != nil && !errors.Is(sysErr, unix.ENOENT) { - return 0, err - } - - err = unmarshalBatchPerCPUValue(valuesOut, count, int(m.valueSize), valueBuf) - if err != nil { - return 0, err - } - - return n, sysErr -} - -func (m *Map) batchLookupCmd(cmd sys.Cmd, cursor *MapBatchCursor, count int, keysOut any, valuePtr sys.Pointer, opts *BatchOptions) (int, error) { - cursorLen := int(m.keySize) - if cursorLen < 4 { - // * generic_map_lookup_batch requires that batch_out is key_size bytes. - // This is used by array and LPM maps. - // - // * __htab_map_lookup_and_delete_batch requires u32. This is used by the - // various hash maps. - // - // Use a minimum of 4 bytes to avoid having to distinguish between the two. - cursorLen = 4 - } - - inBatch := cursor.opaque - if inBatch == nil { - // This is the first lookup, allocate a buffer to hold the cursor. - cursor.opaque = make([]byte, cursorLen) - cursor.m = m - } else if cursor.m != m { - // Prevent reuse of a cursor across maps. First, it's unlikely to work. - // Second, the maps may require different cursorLen and cursor.opaque - // may therefore be too short. This could lead to the kernel clobbering - // user space memory. - return 0, errors.New("a cursor may not be reused across maps") - } - - if err := haveBatchAPI(); err != nil { - return 0, err - } - - keyBuf := sysenc.SyscallOutput(keysOut, count*int(m.keySize)) - - attr := sys.MapLookupBatchAttr{ - MapFd: m.fd.Uint(), - Keys: keyBuf.Pointer(), - Values: valuePtr, - Count: uint32(count), - InBatch: sys.NewSlicePointer(inBatch), - OutBatch: sys.NewSlicePointer(cursor.opaque), - } - - if opts != nil { - attr.ElemFlags = opts.ElemFlags - attr.Flags = opts.Flags - } - - _, sysErr := sys.BPF(cmd, unsafe.Pointer(&attr), unsafe.Sizeof(attr)) - sysErr = wrapMapError(sysErr) - if sysErr != nil && !errors.Is(sysErr, unix.ENOENT) { - return 0, sysErr - } - - if err := keyBuf.Unmarshal(keysOut); err != nil { - return 0, err - } - - return int(attr.Count), sysErr -} - -// BatchUpdate updates the map with multiple keys and values -// simultaneously. -// "keys" and "values" must be of type slice, a pointer -// to a slice or buffer will not work. -func (m *Map) BatchUpdate(keys, values interface{}, opts *BatchOptions) (int, error) { - if m.typ.hasPerCPUValue() { - return m.batchUpdatePerCPU(keys, values, opts) - } - - count, err := batchCount(keys, values) - if err != nil { - return 0, err - } - - valuePtr, err := marshalMapSyscallInput(values, count*int(m.valueSize)) - if err != nil { - return 0, err - } - - return m.batchUpdate(count, keys, valuePtr, opts) -} - -func (m *Map) batchUpdate(count int, keys any, valuePtr sys.Pointer, opts *BatchOptions) (int, error) { - keyPtr, err := marshalMapSyscallInput(keys, count*int(m.keySize)) - if err != nil { - return 0, err - } - - attr := sys.MapUpdateBatchAttr{ - MapFd: m.fd.Uint(), - Keys: keyPtr, - Values: valuePtr, - Count: uint32(count), - } - if opts != nil { - attr.ElemFlags = opts.ElemFlags - attr.Flags = opts.Flags - } - - err = sys.MapUpdateBatch(&attr) - if err != nil { - if haveFeatErr := haveBatchAPI(); haveFeatErr != nil { - return 0, haveFeatErr - } - return int(attr.Count), fmt.Errorf("batch update: %w", wrapMapError(err)) - } - - return int(attr.Count), nil -} - -func (m *Map) batchUpdatePerCPU(keys, values any, opts *BatchOptions) (int, error) { - count, err := sliceLen(keys) - if err != nil { - return 0, fmt.Errorf("keys: %w", err) - } - - valueBuf, err := marshalBatchPerCPUValue(values, count, int(m.valueSize)) - if err != nil { - return 0, err - } - - return m.batchUpdate(count, keys, sys.NewSlicePointer(valueBuf), opts) -} - -// BatchDelete batch deletes entries in the map by keys. -// "keys" must be of type slice, a pointer to a slice or buffer will not work. -func (m *Map) BatchDelete(keys interface{}, opts *BatchOptions) (int, error) { - count, err := sliceLen(keys) - if err != nil { - return 0, fmt.Errorf("keys: %w", err) - } - - keyPtr, err := marshalMapSyscallInput(keys, count*int(m.keySize)) - if err != nil { - return 0, fmt.Errorf("cannot marshal keys: %v", err) - } - - attr := sys.MapDeleteBatchAttr{ - MapFd: m.fd.Uint(), - Keys: keyPtr, - Count: uint32(count), - } - - if opts != nil { - attr.ElemFlags = opts.ElemFlags - attr.Flags = opts.Flags - } - - if err = sys.MapDeleteBatch(&attr); err != nil { - if haveFeatErr := haveBatchAPI(); haveFeatErr != nil { - return 0, haveFeatErr - } - return int(attr.Count), fmt.Errorf("batch delete: %w", wrapMapError(err)) - } - - return int(attr.Count), nil -} - -func batchCount(keys, values any) (int, error) { - keysLen, err := sliceLen(keys) - if err != nil { - return 0, fmt.Errorf("keys: %w", err) - } - - valuesLen, err := sliceLen(values) - if err != nil { - return 0, fmt.Errorf("values: %w", err) - } - - if keysLen != valuesLen { - return 0, fmt.Errorf("keys and values must have the same length") - } - - return keysLen, nil -} - -// Iterate traverses a map. -// -// It's safe to create multiple iterators at the same time. -// -// It's not possible to guarantee that all keys in a map will be -// returned if there are concurrent modifications to the map. -func (m *Map) Iterate() *MapIterator { - return newMapIterator(m) -} - -// Close the Map's underlying file descriptor, which could unload the -// Map from the kernel if it is not pinned or in use by a loaded Program. -func (m *Map) Close() error { - if m == nil { - // This makes it easier to clean up when iterating maps - // of maps / programs. - return nil - } - - return m.fd.Close() -} - -// FD gets the file descriptor of the Map. -// -// Calling this function is invalid after Close has been called. -func (m *Map) FD() int { - return m.fd.Int() -} - -// Clone creates a duplicate of the Map. -// -// Closing the duplicate does not affect the original, and vice versa. -// Changes made to the map are reflected by both instances however. -// If the original map was pinned, the cloned map will not be pinned by default. -// -// Cloning a nil Map returns nil. -func (m *Map) Clone() (*Map, error) { - if m == nil { - return nil, nil - } - - dup, err := m.fd.Dup() - if err != nil { - return nil, fmt.Errorf("can't clone map: %w", err) - } - - return &Map{ - m.name, - dup, - m.typ, - m.keySize, - m.valueSize, - m.maxEntries, - m.flags, - "", - m.fullValueSize, - }, nil -} - -// Pin persists the map on the BPF virtual file system past the lifetime of -// the process that created it . -// -// Calling Pin on a previously pinned map will overwrite the path, except when -// the new path already exists. Re-pinning across filesystems is not supported. -// You can Clone a map to pin it to a different path. -// -// This requires bpffs to be mounted above fileName. -// See https://docs.cilium.io/en/stable/network/kubernetes/configuration/#mounting-bpffs-with-systemd -func (m *Map) Pin(fileName string) error { - if err := internal.Pin(m.pinnedPath, fileName, m.fd); err != nil { - return err - } - m.pinnedPath = fileName - return nil -} - -// Unpin removes the persisted state for the map from the BPF virtual filesystem. -// -// Failed calls to Unpin will not alter the state returned by IsPinned. -// -// Unpinning an unpinned Map returns nil. -func (m *Map) Unpin() error { - if err := internal.Unpin(m.pinnedPath); err != nil { - return err - } - m.pinnedPath = "" - return nil -} - -// IsPinned returns true if the map has a non-empty pinned path. -func (m *Map) IsPinned() bool { - return m.pinnedPath != "" -} - -// Freeze prevents a map to be modified from user space. -// -// It makes no changes to kernel-side restrictions. -func (m *Map) Freeze() error { - attr := sys.MapFreezeAttr{ - MapFd: m.fd.Uint(), - } - - if err := sys.MapFreeze(&attr); err != nil { - if haveFeatErr := haveMapMutabilityModifiers(); haveFeatErr != nil { - return fmt.Errorf("can't freeze map: %w", haveFeatErr) - } - return fmt.Errorf("can't freeze map: %w", err) - } - return nil -} - -// finalize populates the Map according to the Contents specified -// in spec and freezes the Map if requested by spec. -func (m *Map) finalize(spec *MapSpec) error { - for _, kv := range spec.Contents { - if err := m.Put(kv.Key, kv.Value); err != nil { - return fmt.Errorf("putting value: key %v: %w", kv.Key, err) - } - } - - if spec.Freeze { - if err := m.Freeze(); err != nil { - return fmt.Errorf("freezing map: %w", err) - } - } - - return nil -} - -func (m *Map) marshalKey(data interface{}) (sys.Pointer, error) { - if data == nil { - if m.keySize == 0 { - // Queues have a key length of zero, so passing nil here is valid. - return sys.NewPointer(nil), nil - } - return sys.Pointer{}, errors.New("can't use nil as key of map") - } - - return marshalMapSyscallInput(data, int(m.keySize)) -} - -func (m *Map) marshalValue(data interface{}) (sys.Pointer, error) { - var ( - buf []byte - err error - ) - - switch value := data.(type) { - case *Map: - if !m.typ.canStoreMap() { - return sys.Pointer{}, fmt.Errorf("can't store map in %s", m.typ) - } - buf, err = marshalMap(value, int(m.valueSize)) - - case *Program: - if !m.typ.canStoreProgram() { - return sys.Pointer{}, fmt.Errorf("can't store program in %s", m.typ) - } - buf, err = marshalProgram(value, int(m.valueSize)) - - default: - return marshalMapSyscallInput(data, int(m.valueSize)) - } - - if err != nil { - return sys.Pointer{}, err - } - - return sys.NewSlicePointer(buf), nil -} - -func (m *Map) unmarshalValue(value any, buf sysenc.Buffer) error { - switch value := value.(type) { - case **Map: - if !m.typ.canStoreMap() { - return fmt.Errorf("can't read a map from %s", m.typ) - } - - other, err := unmarshalMap(buf) - if err != nil { - return err - } - - // The caller might close the map externally, so ignore errors. - _ = (*value).Close() - - *value = other - return nil - - case *Map: - if !m.typ.canStoreMap() { - return fmt.Errorf("can't read a map from %s", m.typ) - } - return errors.New("require pointer to *Map") - - case **Program: - if !m.typ.canStoreProgram() { - return fmt.Errorf("can't read a program from %s", m.typ) - } - - other, err := unmarshalProgram(buf) - if err != nil { - return err - } - - // The caller might close the program externally, so ignore errors. - _ = (*value).Close() - - *value = other - return nil - - case *Program: - if !m.typ.canStoreProgram() { - return fmt.Errorf("can't read a program from %s", m.typ) - } - return errors.New("require pointer to *Program") - } - - return buf.Unmarshal(value) -} - -// LoadPinnedMap loads a Map from a BPF file. -func LoadPinnedMap(fileName string, opts *LoadPinOptions) (*Map, error) { - fd, err := sys.ObjGet(&sys.ObjGetAttr{ - Pathname: sys.NewStringPointer(fileName), - FileFlags: opts.Marshal(), - }) - if err != nil { - return nil, err - } - - m, err := newMapFromFD(fd) - if err == nil { - m.pinnedPath = fileName - } - - return m, err -} - -// unmarshalMap creates a map from a map ID encoded in host endianness. -func unmarshalMap(buf sysenc.Buffer) (*Map, error) { - var id uint32 - if err := buf.Unmarshal(&id); err != nil { - return nil, err - } - return NewMapFromID(MapID(id)) -} - -// marshalMap marshals the fd of a map into a buffer in host endianness. -func marshalMap(m *Map, length int) ([]byte, error) { - if length != 4 { - return nil, fmt.Errorf("can't marshal map to %d bytes", length) - } - - buf := make([]byte, 4) - internal.NativeEndian.PutUint32(buf, m.fd.Uint()) - return buf, nil -} - -// MapIterator iterates a Map. -// -// See Map.Iterate. -type MapIterator struct { - target *Map - // Temporary storage to avoid allocations in Next(). This is any instead - // of []byte to avoid allocations. - cursor any - count, maxEntries uint32 - done bool - err error -} - -func newMapIterator(target *Map) *MapIterator { - return &MapIterator{ - target: target, - maxEntries: target.maxEntries, - } -} - -// Next decodes the next key and value. -// -// Iterating a hash map from which keys are being deleted is not -// safe. You may see the same key multiple times. Iteration may -// also abort with an error, see IsIterationAborted. -// -// Returns false if there are no more entries. You must check -// the result of Err afterwards. -// -// See Map.Get for further caveats around valueOut. -func (mi *MapIterator) Next(keyOut, valueOut interface{}) bool { - if mi.err != nil || mi.done { - return false - } - - // For array-like maps NextKey returns nil only after maxEntries - // iterations. - for mi.count <= mi.maxEntries { - if mi.cursor == nil { - // Pass nil interface to NextKey to make sure the Map's first key - // is returned. If we pass an uninitialized []byte instead, it'll see a - // non-nil interface and try to marshal it. - mi.cursor = make([]byte, mi.target.keySize) - mi.err = mi.target.NextKey(nil, mi.cursor) - } else { - mi.err = mi.target.NextKey(mi.cursor, mi.cursor) - } - - if errors.Is(mi.err, ErrKeyNotExist) { - mi.done = true - mi.err = nil - return false - } else if mi.err != nil { - mi.err = fmt.Errorf("get next key: %w", mi.err) - return false - } - - mi.count++ - mi.err = mi.target.Lookup(mi.cursor, valueOut) - if errors.Is(mi.err, ErrKeyNotExist) { - // Even though the key should be valid, we couldn't look up - // its value. If we're iterating a hash map this is probably - // because a concurrent delete removed the value before we - // could get it. This means that the next call to NextKeyBytes - // is very likely to restart iteration. - // If we're iterating one of the fd maps like - // ProgramArray it means that a given slot doesn't have - // a valid fd associated. It's OK to continue to the next slot. - continue - } - if mi.err != nil { - mi.err = fmt.Errorf("look up next key: %w", mi.err) - return false - } - - buf := mi.cursor.([]byte) - if ptr, ok := keyOut.(unsafe.Pointer); ok { - copy(unsafe.Slice((*byte)(ptr), len(buf)), buf) - } else { - mi.err = sysenc.Unmarshal(keyOut, buf) - } - - return mi.err == nil - } - - mi.err = fmt.Errorf("%w", ErrIterationAborted) - return false -} - -// Err returns any encountered error. -// -// The method must be called after Next returns nil. -// -// Returns ErrIterationAborted if it wasn't possible to do a full iteration. -func (mi *MapIterator) Err() error { - return mi.err -} - -// MapGetNextID returns the ID of the next eBPF map. -// -// Returns ErrNotExist, if there is no next eBPF map. -func MapGetNextID(startID MapID) (MapID, error) { - attr := &sys.MapGetNextIdAttr{Id: uint32(startID)} - return MapID(attr.NextId), sys.MapGetNextId(attr) -} - -// NewMapFromID returns the map for a given id. -// -// Returns ErrNotExist, if there is no eBPF map with the given id. -func NewMapFromID(id MapID) (*Map, error) { - fd, err := sys.MapGetFdById(&sys.MapGetFdByIdAttr{ - Id: uint32(id), - }) - if err != nil { - return nil, err - } - - return newMapFromFD(fd) -} - -// sliceLen returns the length if the value is a slice or an error otherwise. -func sliceLen(slice any) (int, error) { - sliceValue := reflect.ValueOf(slice) - if sliceValue.Kind() != reflect.Slice { - return 0, fmt.Errorf("%T is not a slice", slice) - } - return sliceValue.Len(), nil -} diff --git a/vendor/github.com/cilium/ebpf/marshalers.go b/vendor/github.com/cilium/ebpf/marshalers.go deleted file mode 100644 index 57a0a8e88..000000000 --- a/vendor/github.com/cilium/ebpf/marshalers.go +++ /dev/null @@ -1,210 +0,0 @@ -package ebpf - -import ( - "encoding" - "errors" - "fmt" - "reflect" - "slices" - "unsafe" - - "github.com/cilium/ebpf/internal" - "github.com/cilium/ebpf/internal/sys" - "github.com/cilium/ebpf/internal/sysenc" -) - -// marshalMapSyscallInput converts an arbitrary value into a pointer suitable -// to be passed to the kernel. -// -// As an optimization, it returns the original value if it is an -// unsafe.Pointer. -func marshalMapSyscallInput(data any, length int) (sys.Pointer, error) { - if ptr, ok := data.(unsafe.Pointer); ok { - return sys.NewPointer(ptr), nil - } - - buf, err := sysenc.Marshal(data, length) - if err != nil { - return sys.Pointer{}, err - } - - return buf.Pointer(), nil -} - -func makeMapSyscallOutput(dst any, length int) sysenc.Buffer { - if ptr, ok := dst.(unsafe.Pointer); ok { - return sysenc.UnsafeBuffer(ptr) - } - - _, ok := dst.(encoding.BinaryUnmarshaler) - if ok { - return sysenc.SyscallOutput(nil, length) - } - - return sysenc.SyscallOutput(dst, length) -} - -// appendPerCPUSlice encodes a slice containing one value per -// possible CPU into a buffer of bytes. -// -// Values are initialized to zero if the slice has less elements than CPUs. -func appendPerCPUSlice(buf []byte, slice any, possibleCPUs, elemLength, alignedElemLength int) ([]byte, error) { - sliceType := reflect.TypeOf(slice) - if sliceType.Kind() != reflect.Slice { - return nil, errors.New("per-CPU value requires slice") - } - - sliceValue := reflect.ValueOf(slice) - sliceLen := sliceValue.Len() - if sliceLen > possibleCPUs { - return nil, fmt.Errorf("per-CPU value greater than number of CPUs") - } - - // Grow increases the slice's capacity, _if_necessary_ - buf = slices.Grow(buf, alignedElemLength*possibleCPUs) - for i := 0; i < sliceLen; i++ { - elem := sliceValue.Index(i).Interface() - elemBytes, err := sysenc.Marshal(elem, elemLength) - if err != nil { - return nil, err - } - - buf = elemBytes.AppendTo(buf) - buf = append(buf, make([]byte, alignedElemLength-elemLength)...) - } - - // Ensure buf is zero-padded full size. - buf = append(buf, make([]byte, (possibleCPUs-sliceLen)*alignedElemLength)...) - - return buf, nil -} - -// marshalPerCPUValue encodes a slice containing one value per -// possible CPU into a buffer of bytes. -// -// Values are initialized to zero if the slice has less elements than CPUs. -func marshalPerCPUValue(slice any, elemLength int) (sys.Pointer, error) { - possibleCPUs, err := PossibleCPU() - if err != nil { - return sys.Pointer{}, err - } - - alignedElemLength := internal.Align(elemLength, 8) - buf := make([]byte, 0, alignedElemLength*possibleCPUs) - buf, err = appendPerCPUSlice(buf, slice, possibleCPUs, elemLength, alignedElemLength) - if err != nil { - return sys.Pointer{}, err - } - - return sys.NewSlicePointer(buf), nil -} - -// marshalBatchPerCPUValue encodes a batch-sized slice of slices containing -// one value per possible CPU into a buffer of bytes. -func marshalBatchPerCPUValue(slice any, batchLen, elemLength int) ([]byte, error) { - sliceType := reflect.TypeOf(slice) - if sliceType.Kind() != reflect.Slice { - return nil, fmt.Errorf("batch value requires a slice") - } - sliceValue := reflect.ValueOf(slice) - - possibleCPUs, err := PossibleCPU() - if err != nil { - return nil, err - } - if sliceValue.Len() != batchLen*possibleCPUs { - return nil, fmt.Errorf("per-CPU slice has incorrect length, expected %d, got %d", - batchLen*possibleCPUs, sliceValue.Len()) - } - alignedElemLength := internal.Align(elemLength, 8) - buf := make([]byte, 0, batchLen*alignedElemLength*possibleCPUs) - for i := 0; i < batchLen; i++ { - batch := sliceValue.Slice(i*possibleCPUs, (i+1)*possibleCPUs).Interface() - buf, err = appendPerCPUSlice(buf, batch, possibleCPUs, elemLength, alignedElemLength) - if err != nil { - return nil, fmt.Errorf("batch %d: %w", i, err) - } - } - return buf, nil -} - -// unmarshalPerCPUValue decodes a buffer into a slice containing one value per -// possible CPU. -// -// slice must be a literal slice and not a pointer. -func unmarshalPerCPUValue(slice any, elemLength int, buf []byte) error { - sliceType := reflect.TypeOf(slice) - if sliceType.Kind() != reflect.Slice { - return fmt.Errorf("per-CPU value requires a slice") - } - - possibleCPUs, err := PossibleCPU() - if err != nil { - return err - } - - sliceValue := reflect.ValueOf(slice) - if sliceValue.Len() != possibleCPUs { - return fmt.Errorf("per-CPU slice has incorrect length, expected %d, got %d", - possibleCPUs, sliceValue.Len()) - } - - sliceElemType := sliceType.Elem() - sliceElemIsPointer := sliceElemType.Kind() == reflect.Ptr - stride := internal.Align(elemLength, 8) - for i := 0; i < possibleCPUs; i++ { - var elem any - v := sliceValue.Index(i) - if sliceElemIsPointer { - if !v.Elem().CanAddr() { - return fmt.Errorf("per-CPU slice elements cannot be nil") - } - elem = v.Elem().Addr().Interface() - } else { - elem = v.Addr().Interface() - } - err := sysenc.Unmarshal(elem, buf[:elemLength]) - if err != nil { - return fmt.Errorf("cpu %d: %w", i, err) - } - - buf = buf[stride:] - } - return nil -} - -// unmarshalBatchPerCPUValue decodes a buffer into a batch-sized slice -// containing one value per possible CPU. -// -// slice must have length batchLen * PossibleCPUs(). -func unmarshalBatchPerCPUValue(slice any, batchLen, elemLength int, buf []byte) error { - sliceType := reflect.TypeOf(slice) - if sliceType.Kind() != reflect.Slice { - return fmt.Errorf("batch requires a slice") - } - - sliceValue := reflect.ValueOf(slice) - possibleCPUs, err := PossibleCPU() - if err != nil { - return err - } - if sliceValue.Len() != batchLen*possibleCPUs { - return fmt.Errorf("per-CPU slice has incorrect length, expected %d, got %d", - sliceValue.Len(), batchLen*possibleCPUs) - } - - fullValueSize := possibleCPUs * internal.Align(elemLength, 8) - if len(buf) != batchLen*fullValueSize { - return fmt.Errorf("input buffer has incorrect length, expected %d, got %d", - len(buf), batchLen*fullValueSize) - } - - for i := 0; i < batchLen; i++ { - elem := sliceValue.Slice(i*possibleCPUs, (i+1)*possibleCPUs).Interface() - if err := unmarshalPerCPUValue(elem, elemLength, buf[:fullValueSize]); err != nil { - return fmt.Errorf("batch %d: %w", i, err) - } - buf = buf[fullValueSize:] - } - return nil -} diff --git a/vendor/github.com/cilium/ebpf/netlify.toml b/vendor/github.com/cilium/ebpf/netlify.toml deleted file mode 100644 index 67c83f3b3..000000000 --- a/vendor/github.com/cilium/ebpf/netlify.toml +++ /dev/null @@ -1,4 +0,0 @@ -[build] - base = "docs/" - publish = "site/" - command = "mkdocs build" diff --git a/vendor/github.com/cilium/ebpf/prog.go b/vendor/github.com/cilium/ebpf/prog.go deleted file mode 100644 index f4f3af7c3..000000000 --- a/vendor/github.com/cilium/ebpf/prog.go +++ /dev/null @@ -1,1135 +0,0 @@ -package ebpf - -import ( - "bytes" - "encoding/binary" - "errors" - "fmt" - "math" - "path/filepath" - "runtime" - "strings" - "time" - "unsafe" - - "github.com/cilium/ebpf/asm" - "github.com/cilium/ebpf/btf" - "github.com/cilium/ebpf/internal" - "github.com/cilium/ebpf/internal/kallsyms" - "github.com/cilium/ebpf/internal/sys" - "github.com/cilium/ebpf/internal/sysenc" - "github.com/cilium/ebpf/internal/unix" -) - -// ErrNotSupported is returned whenever the kernel doesn't support a feature. -var ErrNotSupported = internal.ErrNotSupported - -// errBadRelocation is returned when the verifier rejects a program due to a -// bad CO-RE relocation. -// -// This error is detected based on heuristics and therefore may not be reliable. -var errBadRelocation = errors.New("bad CO-RE relocation") - -// errUnknownKfunc is returned when the verifier rejects a program due to an -// unknown kfunc. -// -// This error is detected based on heuristics and therefore may not be reliable. -var errUnknownKfunc = errors.New("unknown kfunc") - -// ProgramID represents the unique ID of an eBPF program. -type ProgramID uint32 - -const ( - // Number of bytes to pad the output buffer for BPF_PROG_TEST_RUN. - // This is currently the maximum of spare space allocated for SKB - // and XDP programs, and equal to XDP_PACKET_HEADROOM + NET_IP_ALIGN. - outputPad = 256 + 2 -) - -// DefaultVerifierLogSize is the default number of bytes allocated for the -// verifier log. -const DefaultVerifierLogSize = 64 * 1024 - -// maxVerifierLogSize is the maximum size of verifier log buffer the kernel -// will accept before returning EINVAL. -const maxVerifierLogSize = math.MaxUint32 >> 2 - -// ProgramOptions control loading a program into the kernel. -type ProgramOptions struct { - // Bitmap controlling the detail emitted by the kernel's eBPF verifier log. - // LogLevel-type values can be ORed together to request specific kinds of - // verifier output. See the documentation on [ebpf.LogLevel] for details. - // - // opts.LogLevel = (ebpf.LogLevelBranch | ebpf.LogLevelStats) - // - // If left to its default value, the program will first be loaded without - // verifier output enabled. Upon error, the program load will be repeated - // with LogLevelBranch and the given (or default) LogSize value. - // - // Unless LogDisabled is set, setting this to a non-zero value will enable the verifier - // log, populating the [ebpf.Program.VerifierLog] field on successful loads - // and including detailed verifier errors if the program is rejected. This - // will always allocate an output buffer, but will result in only a single - // attempt at loading the program. - LogLevel LogLevel - - // Controls the output buffer size for the verifier log, in bytes. See the - // documentation on ProgramOptions.LogLevel for details about how this value - // is used. - // - // If this value is set too low to fit the verifier log, the resulting - // [ebpf.VerifierError]'s Truncated flag will be true, and the error string - // will also contain a hint to that effect. - // - // Defaults to DefaultVerifierLogSize. - LogSize int - - // Disables the verifier log completely, regardless of other options. - LogDisabled bool - - // Type information used for CO-RE relocations. - // - // This is useful in environments where the kernel BTF is not available - // (containers) or where it is in a non-standard location. Defaults to - // use the kernel BTF from a well-known location if nil. - KernelTypes *btf.Spec - - // Type information used for CO-RE relocations of kernel modules, - // indexed by module name. - // - // This is useful in environments where the kernel BTF is not available - // (containers) or where it is in a non-standard location. Defaults to - // use the kernel module BTF from a well-known location if nil. - KernelModuleTypes map[string]*btf.Spec -} - -// ProgramSpec defines a Program. -type ProgramSpec struct { - // Name is passed to the kernel as a debug aid. Must only contain - // alpha numeric and '_' characters. - Name string - - // Type determines at which hook in the kernel a program will run. - Type ProgramType - - // AttachType of the program, needed to differentiate allowed context - // accesses in some newer program types like CGroupSockAddr. - // - // Available on kernels 4.17 and later. - AttachType AttachType - - // Name of a kernel data structure or function to attach to. Its - // interpretation depends on Type and AttachType. - AttachTo string - - // The program to attach to. Must be provided manually. - AttachTarget *Program - - // The name of the ELF section this program originated from. - SectionName string - - Instructions asm.Instructions - - // Flags is passed to the kernel and specifies additional program - // load attributes. - Flags uint32 - - // License of the program. Some helpers are only available if - // the license is deemed compatible with the GPL. - // - // See https://www.kernel.org/doc/html/latest/process/license-rules.html#id1 - License string - - // Version used by Kprobe programs. - // - // Deprecated on kernels 5.0 and later. Leave empty to let the library - // detect this value automatically. - KernelVersion uint32 - - // The byte order this program was compiled for, may be nil. - ByteOrder binary.ByteOrder -} - -// Copy returns a copy of the spec. -func (ps *ProgramSpec) Copy() *ProgramSpec { - if ps == nil { - return nil - } - - cpy := *ps - cpy.Instructions = make(asm.Instructions, len(ps.Instructions)) - copy(cpy.Instructions, ps.Instructions) - return &cpy -} - -// Tag calculates the kernel tag for a series of instructions. -// -// Use asm.Instructions.Tag if you need to calculate for non-native endianness. -func (ps *ProgramSpec) Tag() (string, error) { - return ps.Instructions.Tag(internal.NativeEndian) -} - -// KernelModule returns the kernel module, if any, the AttachTo function is contained in. -func (ps *ProgramSpec) KernelModule() (string, error) { - if ps.AttachTo == "" { - return "", nil - } - - switch ps.Type { - default: - return "", nil - case Tracing: - switch ps.AttachType { - default: - return "", nil - case AttachTraceFEntry: - case AttachTraceFExit: - } - fallthrough - case Kprobe: - return kallsyms.KernelModule(ps.AttachTo) - } -} - -// VerifierError is returned by [NewProgram] and [NewProgramWithOptions] if a -// program is rejected by the verifier. -// -// Use [errors.As] to access the error. -type VerifierError = internal.VerifierError - -// Program represents BPF program loaded into the kernel. -// -// It is not safe to close a Program which is used by other goroutines. -type Program struct { - // Contains the output of the kernel verifier if enabled, - // otherwise it is empty. - VerifierLog string - - fd *sys.FD - name string - pinnedPath string - typ ProgramType -} - -// NewProgram creates a new Program. -// -// See [NewProgramWithOptions] for details. -// -// Returns a [VerifierError] containing the full verifier log if the program is -// rejected by the kernel. -func NewProgram(spec *ProgramSpec) (*Program, error) { - return NewProgramWithOptions(spec, ProgramOptions{}) -} - -// NewProgramWithOptions creates a new Program. -// -// Loading a program for the first time will perform -// feature detection by loading small, temporary programs. -// -// Returns a [VerifierError] containing the full verifier log if the program is -// rejected by the kernel. -func NewProgramWithOptions(spec *ProgramSpec, opts ProgramOptions) (*Program, error) { - if spec == nil { - return nil, errors.New("can't load a program from a nil spec") - } - - prog, err := newProgramWithOptions(spec, opts) - if errors.Is(err, asm.ErrUnsatisfiedMapReference) { - return nil, fmt.Errorf("cannot load program without loading its whole collection: %w", err) - } - return prog, err -} - -var ( - coreBadLoad = []byte(fmt.Sprintf("(18) r10 = 0x%x\n", btf.COREBadRelocationSentinel)) - // This log message was introduced by ebb676daa1a3 ("bpf: Print function name in - // addition to function id") which first appeared in v4.10 and has remained - // unchanged since. - coreBadCall = []byte(fmt.Sprintf("invalid func unknown#%d\n", btf.COREBadRelocationSentinel)) - kfuncBadCall = []byte(fmt.Sprintf("invalid func unknown#%d\n", kfuncCallPoisonBase)) -) - -func newProgramWithOptions(spec *ProgramSpec, opts ProgramOptions) (*Program, error) { - if len(spec.Instructions) == 0 { - return nil, errors.New("instructions cannot be empty") - } - - if spec.Type == UnspecifiedProgram { - return nil, errors.New("can't load program of unspecified type") - } - - if spec.ByteOrder != nil && spec.ByteOrder != internal.NativeEndian { - return nil, fmt.Errorf("can't load %s program on %s", spec.ByteOrder, internal.NativeEndian) - } - - if opts.LogSize < 0 { - return nil, errors.New("ProgramOptions.LogSize must be a positive value; disable verifier logs using ProgramOptions.LogDisabled") - } - - // Kernels before 5.0 (6c4fc209fcf9 "bpf: remove useless version check for prog load") - // require the version field to be set to the value of the KERNEL_VERSION - // macro for kprobe-type programs. - // Overwrite Kprobe program version if set to zero or the magic version constant. - kv := spec.KernelVersion - if spec.Type == Kprobe && (kv == 0 || kv == internal.MagicKernelVersion) { - v, err := internal.KernelVersion() - if err != nil { - return nil, fmt.Errorf("detecting kernel version: %w", err) - } - kv = v.Kernel() - } - - attr := &sys.ProgLoadAttr{ - ProgType: sys.ProgType(spec.Type), - ProgFlags: spec.Flags, - ExpectedAttachType: sys.AttachType(spec.AttachType), - License: sys.NewStringPointer(spec.License), - KernVersion: kv, - } - - if haveObjName() == nil { - attr.ProgName = sys.NewObjName(spec.Name) - } - - insns := make(asm.Instructions, len(spec.Instructions)) - copy(insns, spec.Instructions) - - kmodName, err := spec.KernelModule() - if err != nil { - return nil, fmt.Errorf("kernel module search: %w", err) - } - - var targets []*btf.Spec - if opts.KernelTypes != nil { - targets = append(targets, opts.KernelTypes) - } - if kmodName != "" && opts.KernelModuleTypes != nil { - if modBTF, ok := opts.KernelModuleTypes[kmodName]; ok { - targets = append(targets, modBTF) - } - } - - var b btf.Builder - if err := applyRelocations(insns, targets, kmodName, spec.ByteOrder, &b); err != nil { - return nil, fmt.Errorf("apply CO-RE relocations: %w", err) - } - - errExtInfos := haveProgramExtInfos() - if !b.Empty() && errors.Is(errExtInfos, ErrNotSupported) { - // There is at least one CO-RE relocation which relies on a stable local - // type ID. - // Return ErrNotSupported instead of E2BIG if there is no BTF support. - return nil, errExtInfos - } - - if errExtInfos == nil { - // Only add func and line info if the kernel supports it. This allows - // BPF compiled with modern toolchains to work on old kernels. - fib, lib, err := btf.MarshalExtInfos(insns, &b) - if err != nil { - return nil, fmt.Errorf("marshal ext_infos: %w", err) - } - - attr.FuncInfoRecSize = btf.FuncInfoSize - attr.FuncInfoCnt = uint32(len(fib)) / btf.FuncInfoSize - attr.FuncInfo = sys.NewSlicePointer(fib) - - attr.LineInfoRecSize = btf.LineInfoSize - attr.LineInfoCnt = uint32(len(lib)) / btf.LineInfoSize - attr.LineInfo = sys.NewSlicePointer(lib) - } - - if !b.Empty() { - handle, err := btf.NewHandle(&b) - if err != nil { - return nil, fmt.Errorf("load BTF: %w", err) - } - defer handle.Close() - - attr.ProgBtfFd = uint32(handle.FD()) - } - - kconfig, err := resolveKconfigReferences(insns) - if err != nil { - return nil, fmt.Errorf("resolve .kconfig: %w", err) - } - defer kconfig.Close() - - if err := fixupAndValidate(insns); err != nil { - return nil, err - } - - handles, err := fixupKfuncs(insns) - if err != nil { - return nil, fmt.Errorf("fixing up kfuncs: %w", err) - } - defer handles.Close() - - if len(handles) > 0 { - fdArray := handles.fdArray() - attr.FdArray = sys.NewPointer(unsafe.Pointer(&fdArray[0])) - } - - buf := bytes.NewBuffer(make([]byte, 0, insns.Size())) - err = insns.Marshal(buf, internal.NativeEndian) - if err != nil { - return nil, err - } - - bytecode := buf.Bytes() - attr.Insns = sys.NewSlicePointer(bytecode) - attr.InsnCnt = uint32(len(bytecode) / asm.InstructionSize) - - if spec.AttachTarget != nil { - targetID, err := findTargetInProgram(spec.AttachTarget, spec.AttachTo, spec.Type, spec.AttachType) - if err != nil { - return nil, fmt.Errorf("attach %s/%s: %w", spec.Type, spec.AttachType, err) - } - - attr.AttachBtfId = targetID - attr.AttachBtfObjFd = uint32(spec.AttachTarget.FD()) - defer runtime.KeepAlive(spec.AttachTarget) - } else if spec.AttachTo != "" { - module, targetID, err := findProgramTargetInKernel(spec.AttachTo, spec.Type, spec.AttachType) - if err != nil && !errors.Is(err, errUnrecognizedAttachType) { - // We ignore errUnrecognizedAttachType since AttachTo may be non-empty - // for programs that don't attach anywhere. - return nil, fmt.Errorf("attach %s/%s: %w", spec.Type, spec.AttachType, err) - } - - attr.AttachBtfId = targetID - if module != nil { - attr.AttachBtfObjFd = uint32(module.FD()) - defer module.Close() - } - } - - if opts.LogSize == 0 { - opts.LogSize = DefaultVerifierLogSize - } - - // The caller requested a specific verifier log level. Set up the log buffer. - var logBuf []byte - if !opts.LogDisabled && opts.LogLevel != 0 { - logBuf = make([]byte, opts.LogSize) - attr.LogLevel = opts.LogLevel - attr.LogSize = uint32(len(logBuf)) - attr.LogBuf = sys.NewSlicePointer(logBuf) - } - - fd, err := sys.ProgLoad(attr) - if err == nil { - return &Program{unix.ByteSliceToString(logBuf), fd, spec.Name, "", spec.Type}, nil - } - - // An error occurred loading the program, but the caller did not explicitly - // enable the verifier log. Re-run with branch-level verifier logs enabled to - // obtain more info. Preserve the original error to return it to the caller. - // An undersized log buffer will result in ENOSPC regardless of the underlying - // cause. - var err2 error - if !opts.LogDisabled && opts.LogLevel == 0 { - logBuf = make([]byte, opts.LogSize) - attr.LogLevel = LogLevelBranch - attr.LogSize = uint32(len(logBuf)) - attr.LogBuf = sys.NewSlicePointer(logBuf) - - _, err2 = sys.ProgLoad(attr) - } - - end := bytes.IndexByte(logBuf, 0) - if end < 0 { - end = len(logBuf) - } - - tail := logBuf[max(end-256, 0):end] - switch { - case errors.Is(err, unix.EPERM): - if len(logBuf) > 0 && logBuf[0] == 0 { - // EPERM due to RLIMIT_MEMLOCK happens before the verifier, so we can - // check that the log is empty to reduce false positives. - return nil, fmt.Errorf("load program: %w (MEMLOCK may be too low, consider rlimit.RemoveMemlock)", err) - } - - case errors.Is(err, unix.EINVAL): - if opts.LogSize > maxVerifierLogSize { - return nil, fmt.Errorf("load program: %w (ProgramOptions.LogSize exceeds maximum value of %d)", err, maxVerifierLogSize) - } - - if bytes.Contains(tail, coreBadCall) { - err = errBadRelocation - break - } else if bytes.Contains(tail, kfuncBadCall) { - err = errUnknownKfunc - break - } - - case errors.Is(err, unix.EACCES): - if bytes.Contains(tail, coreBadLoad) { - err = errBadRelocation - break - } - } - - // hasFunctionReferences may be expensive, so check it last. - if (errors.Is(err, unix.EINVAL) || errors.Is(err, unix.EPERM)) && - hasFunctionReferences(spec.Instructions) { - if err := haveBPFToBPFCalls(); err != nil { - return nil, fmt.Errorf("load program: %w", err) - } - } - - truncated := errors.Is(err, unix.ENOSPC) || errors.Is(err2, unix.ENOSPC) - return nil, internal.ErrorWithLog("load program", err, logBuf, truncated) -} - -// NewProgramFromFD creates a program from a raw fd. -// -// You should not use fd after calling this function. -// -// Requires at least Linux 4.10. -func NewProgramFromFD(fd int) (*Program, error) { - f, err := sys.NewFD(fd) - if err != nil { - return nil, err - } - - return newProgramFromFD(f) -} - -// NewProgramFromID returns the program for a given id. -// -// Returns ErrNotExist, if there is no eBPF program with the given id. -func NewProgramFromID(id ProgramID) (*Program, error) { - fd, err := sys.ProgGetFdById(&sys.ProgGetFdByIdAttr{ - Id: uint32(id), - }) - if err != nil { - return nil, fmt.Errorf("get program by id: %w", err) - } - - return newProgramFromFD(fd) -} - -func newProgramFromFD(fd *sys.FD) (*Program, error) { - info, err := newProgramInfoFromFd(fd) - if err != nil { - fd.Close() - return nil, fmt.Errorf("discover program type: %w", err) - } - - return &Program{"", fd, info.Name, "", info.Type}, nil -} - -func (p *Program) String() string { - if p.name != "" { - return fmt.Sprintf("%s(%s)#%v", p.typ, p.name, p.fd) - } - return fmt.Sprintf("%s(%v)", p.typ, p.fd) -} - -// Type returns the underlying type of the program. -func (p *Program) Type() ProgramType { - return p.typ -} - -// Info returns metadata about the program. -// -// Requires at least 4.10. -func (p *Program) Info() (*ProgramInfo, error) { - return newProgramInfoFromFd(p.fd) -} - -// Handle returns a reference to the program's type information in the kernel. -// -// Returns ErrNotSupported if the kernel has no BTF support, or if there is no -// BTF associated with the program. -func (p *Program) Handle() (*btf.Handle, error) { - info, err := p.Info() - if err != nil { - return nil, err - } - - id, ok := info.BTFID() - if !ok { - return nil, fmt.Errorf("program %s: retrieve BTF ID: %w", p, ErrNotSupported) - } - - return btf.NewHandleFromID(id) -} - -// FD gets the file descriptor of the Program. -// -// It is invalid to call this function after Close has been called. -func (p *Program) FD() int { - return p.fd.Int() -} - -// Clone creates a duplicate of the Program. -// -// Closing the duplicate does not affect the original, and vice versa. -// -// Cloning a nil Program returns nil. -func (p *Program) Clone() (*Program, error) { - if p == nil { - return nil, nil - } - - dup, err := p.fd.Dup() - if err != nil { - return nil, fmt.Errorf("can't clone program: %w", err) - } - - return &Program{p.VerifierLog, dup, p.name, "", p.typ}, nil -} - -// Pin persists the Program on the BPF virtual file system past the lifetime of -// the process that created it -// -// Calling Pin on a previously pinned program will overwrite the path, except when -// the new path already exists. Re-pinning across filesystems is not supported. -// -// This requires bpffs to be mounted above fileName. -// See https://docs.cilium.io/en/stable/network/kubernetes/configuration/#mounting-bpffs-with-systemd -func (p *Program) Pin(fileName string) error { - if err := internal.Pin(p.pinnedPath, fileName, p.fd); err != nil { - return err - } - p.pinnedPath = fileName - return nil -} - -// Unpin removes the persisted state for the Program from the BPF virtual filesystem. -// -// Failed calls to Unpin will not alter the state returned by IsPinned. -// -// Unpinning an unpinned Program returns nil. -func (p *Program) Unpin() error { - if err := internal.Unpin(p.pinnedPath); err != nil { - return err - } - p.pinnedPath = "" - return nil -} - -// IsPinned returns true if the Program has a non-empty pinned path. -func (p *Program) IsPinned() bool { - return p.pinnedPath != "" -} - -// Close the Program's underlying file descriptor, which could unload -// the program from the kernel if it is not pinned or attached to a -// kernel hook. -func (p *Program) Close() error { - if p == nil { - return nil - } - - return p.fd.Close() -} - -// Various options for Run'ing a Program -type RunOptions struct { - // Program's data input. Required field. - // - // The kernel expects at least 14 bytes input for an ethernet header for - // XDP and SKB programs. - Data []byte - // Program's data after Program has run. Caller must allocate. Optional field. - DataOut []byte - // Program's context input. Optional field. - Context interface{} - // Program's context after Program has run. Must be a pointer or slice. Optional field. - ContextOut interface{} - // Minimum number of times to run Program. Optional field. Defaults to 1. - // - // The program may be executed more often than this due to interruptions, e.g. - // when runtime.AllThreadsSyscall is invoked. - Repeat uint32 - // Optional flags. - Flags uint32 - // CPU to run Program on. Optional field. - // Note not all program types support this field. - CPU uint32 - // Called whenever the syscall is interrupted, and should be set to testing.B.ResetTimer - // or similar. Typically used during benchmarking. Optional field. - // - // Deprecated: use [testing.B.ReportMetric] with unit "ns/op" instead. - Reset func() -} - -// Test runs the Program in the kernel with the given input and returns the -// value returned by the eBPF program. -// -// Note: the kernel expects at least 14 bytes input for an ethernet header for -// XDP and SKB programs. -// -// This function requires at least Linux 4.12. -func (p *Program) Test(in []byte) (uint32, []byte, error) { - // Older kernels ignore the dataSizeOut argument when copying to user space. - // Combined with things like bpf_xdp_adjust_head() we don't really know what the final - // size will be. Hence we allocate an output buffer which we hope will always be large - // enough, and panic if the kernel wrote past the end of the allocation. - // See https://patchwork.ozlabs.org/cover/1006822/ - var out []byte - if len(in) > 0 { - out = make([]byte, len(in)+outputPad) - } - - opts := RunOptions{ - Data: in, - DataOut: out, - Repeat: 1, - } - - ret, _, err := p.run(&opts) - if err != nil { - return ret, nil, fmt.Errorf("test program: %w", err) - } - return ret, opts.DataOut, nil -} - -// Run runs the Program in kernel with given RunOptions. -// -// Note: the same restrictions from Test apply. -func (p *Program) Run(opts *RunOptions) (uint32, error) { - ret, _, err := p.run(opts) - if err != nil { - return ret, fmt.Errorf("run program: %w", err) - } - return ret, nil -} - -// Benchmark runs the Program with the given input for a number of times -// and returns the time taken per iteration. -// -// Returns the result of the last execution of the program and the time per -// run or an error. reset is called whenever the benchmark syscall is -// interrupted, and should be set to testing.B.ResetTimer or similar. -// -// This function requires at least Linux 4.12. -func (p *Program) Benchmark(in []byte, repeat int, reset func()) (uint32, time.Duration, error) { - if uint(repeat) > math.MaxUint32 { - return 0, 0, fmt.Errorf("repeat is too high") - } - - opts := RunOptions{ - Data: in, - Repeat: uint32(repeat), - Reset: reset, - } - - ret, total, err := p.run(&opts) - if err != nil { - return ret, total, fmt.Errorf("benchmark program: %w", err) - } - return ret, total, nil -} - -var haveProgRun = internal.NewFeatureTest("BPF_PROG_RUN", "4.12", func() error { - prog, err := NewProgram(&ProgramSpec{ - // SocketFilter does not require privileges on newer kernels. - Type: SocketFilter, - Instructions: asm.Instructions{ - asm.LoadImm(asm.R0, 0, asm.DWord), - asm.Return(), - }, - License: "MIT", - }) - if err != nil { - // This may be because we lack sufficient permissions, etc. - return err - } - defer prog.Close() - - in := internal.EmptyBPFContext - attr := sys.ProgRunAttr{ - ProgFd: uint32(prog.FD()), - DataSizeIn: uint32(len(in)), - DataIn: sys.NewSlicePointer(in), - } - - err = sys.ProgRun(&attr) - switch { - case errors.Is(err, unix.EINVAL): - // Check for EINVAL specifically, rather than err != nil since we - // otherwise misdetect due to insufficient permissions. - return internal.ErrNotSupported - - case errors.Is(err, unix.EINTR): - // We know that PROG_TEST_RUN is supported if we get EINTR. - return nil - - case errors.Is(err, sys.ENOTSUPP): - // The first PROG_TEST_RUN patches shipped in 4.12 didn't include - // a test runner for SocketFilter. ENOTSUPP means PROG_TEST_RUN is - // supported, but not for the program type used in the probe. - return nil - } - - return err -}) - -func (p *Program) run(opts *RunOptions) (uint32, time.Duration, error) { - if uint(len(opts.Data)) > math.MaxUint32 { - return 0, 0, fmt.Errorf("input is too long") - } - - if err := haveProgRun(); err != nil { - return 0, 0, err - } - - var ctxBytes []byte - if opts.Context != nil { - ctx := new(bytes.Buffer) - if err := binary.Write(ctx, internal.NativeEndian, opts.Context); err != nil { - return 0, 0, fmt.Errorf("cannot serialize context: %v", err) - } - ctxBytes = ctx.Bytes() - } - - var ctxOut []byte - if opts.ContextOut != nil { - ctxOut = make([]byte, binary.Size(opts.ContextOut)) - } - - attr := sys.ProgRunAttr{ - ProgFd: p.fd.Uint(), - DataSizeIn: uint32(len(opts.Data)), - DataSizeOut: uint32(len(opts.DataOut)), - DataIn: sys.NewSlicePointer(opts.Data), - DataOut: sys.NewSlicePointer(opts.DataOut), - Repeat: uint32(opts.Repeat), - CtxSizeIn: uint32(len(ctxBytes)), - CtxSizeOut: uint32(len(ctxOut)), - CtxIn: sys.NewSlicePointer(ctxBytes), - CtxOut: sys.NewSlicePointer(ctxOut), - Flags: opts.Flags, - Cpu: opts.CPU, - } - -retry: - for { - err := sys.ProgRun(&attr) - if err == nil { - break retry - } - - if errors.Is(err, unix.EINTR) { - if attr.Repeat <= 1 { - // Older kernels check whether enough repetitions have been - // executed only after checking for pending signals. - // - // run signal? done? run ... - // - // As a result we can get EINTR for repeat==1 even though - // the program was run exactly once. Treat this as a - // successful run instead. - // - // Since commit 607b9cc92bd7 ("bpf: Consolidate shared test timing code") - // the conditions are reversed: - // run done? signal? ... - break retry - } - - if opts.Reset != nil { - opts.Reset() - } - continue retry - } - - if errors.Is(err, sys.ENOTSUPP) { - return 0, 0, fmt.Errorf("kernel doesn't support running %s: %w", p.Type(), ErrNotSupported) - } - - return 0, 0, err - } - - if opts.DataOut != nil { - if int(attr.DataSizeOut) > cap(opts.DataOut) { - // Houston, we have a problem. The program created more data than we allocated, - // and the kernel wrote past the end of our buffer. - panic("kernel wrote past end of output buffer") - } - opts.DataOut = opts.DataOut[:int(attr.DataSizeOut)] - } - - if len(ctxOut) != 0 { - b := bytes.NewReader(ctxOut) - if err := binary.Read(b, internal.NativeEndian, opts.ContextOut); err != nil { - return 0, 0, fmt.Errorf("failed to decode ContextOut: %v", err) - } - } - - total := time.Duration(attr.Duration) * time.Nanosecond - return attr.Retval, total, nil -} - -func unmarshalProgram(buf sysenc.Buffer) (*Program, error) { - var id uint32 - if err := buf.Unmarshal(&id); err != nil { - return nil, err - } - - // Looking up an entry in a nested map or prog array returns an id, - // not an fd. - return NewProgramFromID(ProgramID(id)) -} - -func marshalProgram(p *Program, length int) ([]byte, error) { - if length != 4 { - return nil, fmt.Errorf("can't marshal program to %d bytes", length) - } - - buf := make([]byte, 4) - internal.NativeEndian.PutUint32(buf, p.fd.Uint()) - return buf, nil -} - -// LoadPinnedProgram loads a Program from a BPF file. -// -// Requires at least Linux 4.11. -func LoadPinnedProgram(fileName string, opts *LoadPinOptions) (*Program, error) { - fd, err := sys.ObjGet(&sys.ObjGetAttr{ - Pathname: sys.NewStringPointer(fileName), - FileFlags: opts.Marshal(), - }) - if err != nil { - return nil, err - } - - info, err := newProgramInfoFromFd(fd) - if err != nil { - _ = fd.Close() - return nil, fmt.Errorf("info for %s: %w", fileName, err) - } - - var progName string - if haveObjName() == nil { - progName = info.Name - } else { - progName = filepath.Base(fileName) - } - - return &Program{"", fd, progName, fileName, info.Type}, nil -} - -// SanitizeName replaces all invalid characters in name with replacement. -// Passing a negative value for replacement will delete characters instead -// of replacing them. Use this to automatically generate valid names for maps -// and programs at runtime. -// -// The set of allowed characters depends on the running kernel version. -// Dots are only allowed as of kernel 5.2. -func SanitizeName(name string, replacement rune) string { - return strings.Map(func(char rune) rune { - if invalidBPFObjNameChar(char) { - return replacement - } - return char - }, name) -} - -// ProgramGetNextID returns the ID of the next eBPF program. -// -// Returns ErrNotExist, if there is no next eBPF program. -func ProgramGetNextID(startID ProgramID) (ProgramID, error) { - attr := &sys.ProgGetNextIdAttr{Id: uint32(startID)} - return ProgramID(attr.NextId), sys.ProgGetNextId(attr) -} - -// BindMap binds map to the program and is only released once program is released. -// -// This may be used in cases where metadata should be associated with the program -// which otherwise does not contain any references to the map. -func (p *Program) BindMap(m *Map) error { - attr := &sys.ProgBindMapAttr{ - ProgFd: uint32(p.FD()), - MapFd: uint32(m.FD()), - } - - return sys.ProgBindMap(attr) -} - -var errUnrecognizedAttachType = errors.New("unrecognized attach type") - -// find an attach target type in the kernel. -// -// name, progType and attachType determine which type we need to attach to. -// -// The attach target may be in a loaded kernel module. -// In that case the returned handle will be non-nil. -// The caller is responsible for closing the handle. -// -// Returns errUnrecognizedAttachType if the combination of progType and attachType -// is not recognised. -func findProgramTargetInKernel(name string, progType ProgramType, attachType AttachType) (*btf.Handle, btf.TypeID, error) { - type match struct { - p ProgramType - a AttachType - } - - var ( - typeName, featureName string - target btf.Type - ) - - switch (match{progType, attachType}) { - case match{LSM, AttachLSMMac}: - typeName = "bpf_lsm_" + name - featureName = name + " LSM hook" - target = (*btf.Func)(nil) - case match{Tracing, AttachTraceIter}: - typeName = "bpf_iter_" + name - featureName = name + " iterator" - target = (*btf.Func)(nil) - case match{Tracing, AttachTraceFEntry}: - typeName = name - featureName = fmt.Sprintf("fentry %s", name) - target = (*btf.Func)(nil) - case match{Tracing, AttachTraceFExit}: - typeName = name - featureName = fmt.Sprintf("fexit %s", name) - target = (*btf.Func)(nil) - case match{Tracing, AttachModifyReturn}: - typeName = name - featureName = fmt.Sprintf("fmod_ret %s", name) - target = (*btf.Func)(nil) - case match{Tracing, AttachTraceRawTp}: - typeName = fmt.Sprintf("btf_trace_%s", name) - featureName = fmt.Sprintf("raw_tp %s", name) - target = (*btf.Typedef)(nil) - default: - return nil, 0, errUnrecognizedAttachType - } - - spec, err := btf.LoadKernelSpec() - if err != nil { - return nil, 0, fmt.Errorf("load kernel spec: %w", err) - } - - spec, module, err := findTargetInKernel(spec, typeName, &target) - if errors.Is(err, btf.ErrNotFound) { - return nil, 0, &internal.UnsupportedFeatureError{Name: featureName} - } - // See cilium/ebpf#894. Until we can disambiguate between equally-named kernel - // symbols, we should explicitly refuse program loads. They will not reliably - // do what the caller intended. - if errors.Is(err, btf.ErrMultipleMatches) { - return nil, 0, fmt.Errorf("attaching to ambiguous kernel symbol is not supported: %w", err) - } - if err != nil { - return nil, 0, fmt.Errorf("find target for %s: %w", featureName, err) - } - - id, err := spec.TypeID(target) - if err != nil { - module.Close() - return nil, 0, err - } - - return module, id, nil -} - -// findTargetInKernel attempts to find a named type in the current kernel. -// -// target will point at the found type after a successful call. Searches both -// vmlinux and any loaded modules. -// -// Returns a non-nil handle if the type was found in a module, or btf.ErrNotFound -// if the type wasn't found at all. -func findTargetInKernel(kernelSpec *btf.Spec, typeName string, target *btf.Type) (*btf.Spec, *btf.Handle, error) { - err := kernelSpec.TypeByName(typeName, target) - if errors.Is(err, btf.ErrNotFound) { - spec, module, err := findTargetInModule(kernelSpec, typeName, target) - if err != nil { - return nil, nil, fmt.Errorf("find target in modules: %w", err) - } - return spec, module, nil - } - if err != nil { - return nil, nil, fmt.Errorf("find target in vmlinux: %w", err) - } - return kernelSpec, nil, err -} - -// findTargetInModule attempts to find a named type in any loaded module. -// -// base must contain the kernel's types and is used to parse kmod BTF. Modules -// are searched in the order they were loaded. -// -// Returns btf.ErrNotFound if the target can't be found in any module. -func findTargetInModule(base *btf.Spec, typeName string, target *btf.Type) (*btf.Spec, *btf.Handle, error) { - it := new(btf.HandleIterator) - defer it.Handle.Close() - - for it.Next() { - info, err := it.Handle.Info() - if err != nil { - return nil, nil, fmt.Errorf("get info for BTF ID %d: %w", it.ID, err) - } - - if !info.IsModule() { - continue - } - - spec, err := it.Handle.Spec(base) - if err != nil { - return nil, nil, fmt.Errorf("parse types for module %s: %w", info.Name, err) - } - - err = spec.TypeByName(typeName, target) - if errors.Is(err, btf.ErrNotFound) { - continue - } - if err != nil { - return nil, nil, fmt.Errorf("lookup type in module %s: %w", info.Name, err) - } - - return spec, it.Take(), nil - } - if err := it.Err(); err != nil { - return nil, nil, fmt.Errorf("iterate modules: %w", err) - } - - return nil, nil, btf.ErrNotFound -} - -// find an attach target type in a program. -// -// Returns errUnrecognizedAttachType. -func findTargetInProgram(prog *Program, name string, progType ProgramType, attachType AttachType) (btf.TypeID, error) { - type match struct { - p ProgramType - a AttachType - } - - var typeName string - switch (match{progType, attachType}) { - case match{Extension, AttachNone}, - match{Tracing, AttachTraceFEntry}, - match{Tracing, AttachTraceFExit}: - typeName = name - default: - return 0, errUnrecognizedAttachType - } - - btfHandle, err := prog.Handle() - if err != nil { - return 0, fmt.Errorf("load target BTF: %w", err) - } - defer btfHandle.Close() - - spec, err := btfHandle.Spec(nil) - if err != nil { - return 0, err - } - - var targetFunc *btf.Func - err = spec.TypeByName(typeName, &targetFunc) - if err != nil { - return 0, fmt.Errorf("find target %s: %w", typeName, err) - } - - return spec.TypeID(targetFunc) -} diff --git a/vendor/github.com/cilium/ebpf/run-tests.sh b/vendor/github.com/cilium/ebpf/run-tests.sh deleted file mode 100644 index c7ff7ea33..000000000 --- a/vendor/github.com/cilium/ebpf/run-tests.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env bash -# Test the current package under a different kernel. -# Requires virtme and qemu to be installed. -# Examples: -# Run all tests on a 5.4 kernel -# $ ./run-tests.sh 5.4 -# Run a subset of tests: -# $ ./run-tests.sh 5.4 ./link -# Run using a local kernel image -# $ ./run-tests.sh /path/to/bzImage - -set -euo pipefail - -script="$(realpath "$0")" -readonly script - -source "$(dirname "$script")/testdata/sh/lib.sh" - -quote_env() { - for var in "$@"; do - if [ -v "$var" ]; then - printf "%s=%q " "$var" "${!var}" - fi - done -} - -declare -a preserved_env=( - PATH - CI_MAX_KERNEL_VERSION - TEST_SEED - KERNEL_VERSION -) - -# This script is a bit like a Matryoshka doll since it keeps re-executing itself -# in various different contexts: -# -# 1. invoked by the user like run-tests.sh 5.4 -# 2. invoked by go test like run-tests.sh --exec-vm -# 3. invoked by init in the vm like run-tests.sh --exec-test -# -# This allows us to use all available CPU on the host machine to compile our -# code, and then only use the VM to execute the test. This is because the VM -# is usually slower at compiling than the host. -if [[ "${1:-}" = "--exec-vm" ]]; then - shift - - input="$1" - shift - - # Use sudo if /dev/kvm isn't accessible by the current user. - sudo="" - if [[ ! -r /dev/kvm || ! -w /dev/kvm ]]; then - sudo="sudo" - fi - readonly sudo - - testdir="$(dirname "$1")" - output="$(mktemp -d)" - printf -v cmd "%q " "$@" - - if [[ "$(stat -c '%t:%T' -L /proc/$$/fd/0)" == "1:3" ]]; then - # stdin is /dev/null, which doesn't play well with qemu. Use a fifo as a - # blocking substitute. - mkfifo "${output}/fake-stdin" - # Open for reading and writing to avoid blocking. - exec 0<> "${output}/fake-stdin" - rm "${output}/fake-stdin" - fi - - if ! $sudo virtme-run --kimg "${input}/boot/vmlinuz" --cpus 2 --memory 1G --pwd \ - --rwdir="${testdir}=${testdir}" \ - --rodir=/run/input="${input}" \ - --rwdir=/run/output="${output}" \ - --script-sh "$(quote_env "${preserved_env[@]}") \"$script\" \ - --exec-test $cmd"; then - exit 23 - fi - - if ! [[ -e "${output}/status" ]]; then - exit 42 - fi - - rc=$(<"${output}/status") - $sudo rm -r "$output" - exit "$rc" -elif [[ "${1:-}" = "--exec-test" ]]; then - shift - - mount -t bpf bpf /sys/fs/bpf - mount -t tracefs tracefs /sys/kernel/debug/tracing - - if [[ -d "/run/input/usr/src/linux/tools/testing/selftests/bpf" ]]; then - export KERNEL_SELFTESTS="/run/input/usr/src/linux/tools/testing/selftests/bpf" - fi - - if [[ -d "/run/input/lib/modules" ]]; then - find /run/input/lib/modules -type f -name bpf_testmod.ko -exec insmod {} \; - fi - - dmesg --clear - rc=0 - "$@" || rc=$? - dmesg - echo $rc > "/run/output/status" - exit $rc # this return code is "swallowed" by qemu -fi - -if [[ -z "${1:-}" ]]; then - echo "Expecting kernel version or path as first argument" - exit 1 -fi - -input="$(mktemp -d)" -readonly input - -if [[ -f "${1}" ]]; then - # First argument is a local file. - readonly kernel="${1}" - cp "${1}" "${input}/boot/vmlinuz" -else - readonly kernel="${1}" - - # LINUX_VERSION_CODE test compares this to discovered value. - export KERNEL_VERSION="${1}" - - if ! extract_oci_image "ghcr.io/cilium/ci-kernels:${kernel}-selftests" "${input}"; then - extract_oci_image "ghcr.io/cilium/ci-kernels:${kernel}" "${input}" - fi -fi -shift - -args=(-short -coverpkg=./... -coverprofile=coverage.out -count 1 ./...) -if (( $# > 0 )); then - args=("$@") -fi - -export GOFLAGS=-mod=readonly -export CGO_ENABLED=0 - -echo Testing on "${kernel}" -go test -exec "$script --exec-vm $input" "${args[@]}" -echo "Test successful on ${kernel}" - -rm -r "${input}" diff --git a/vendor/github.com/cilium/ebpf/syscalls.go b/vendor/github.com/cilium/ebpf/syscalls.go deleted file mode 100644 index 4aef7faeb..000000000 --- a/vendor/github.com/cilium/ebpf/syscalls.go +++ /dev/null @@ -1,337 +0,0 @@ -package ebpf - -import ( - "bytes" - "errors" - "fmt" - "math" - "os" - "runtime" - - "github.com/cilium/ebpf/asm" - "github.com/cilium/ebpf/internal" - "github.com/cilium/ebpf/internal/sys" - "github.com/cilium/ebpf/internal/tracefs" - "github.com/cilium/ebpf/internal/unix" -) - -var ( - // pre-allocating these here since they may - // get called in hot code paths and cause - // unnecessary memory allocations - sysErrKeyNotExist = sys.Error(ErrKeyNotExist, unix.ENOENT) - sysErrKeyExist = sys.Error(ErrKeyExist, unix.EEXIST) - sysErrNotSupported = sys.Error(ErrNotSupported, sys.ENOTSUPP) -) - -// invalidBPFObjNameChar returns true if char may not appear in -// a BPF object name. -func invalidBPFObjNameChar(char rune) bool { - dotAllowed := objNameAllowsDot() == nil - - switch { - case char >= 'A' && char <= 'Z': - return false - case char >= 'a' && char <= 'z': - return false - case char >= '0' && char <= '9': - return false - case dotAllowed && char == '.': - return false - case char == '_': - return false - default: - return true - } -} - -func progLoad(insns asm.Instructions, typ ProgramType, license string) (*sys.FD, error) { - buf := bytes.NewBuffer(make([]byte, 0, insns.Size())) - if err := insns.Marshal(buf, internal.NativeEndian); err != nil { - return nil, err - } - bytecode := buf.Bytes() - - return sys.ProgLoad(&sys.ProgLoadAttr{ - ProgType: sys.ProgType(typ), - License: sys.NewStringPointer(license), - Insns: sys.NewSlicePointer(bytecode), - InsnCnt: uint32(len(bytecode) / asm.InstructionSize), - }) -} - -var haveNestedMaps = internal.NewFeatureTest("nested maps", "4.12", func() error { - _, err := sys.MapCreate(&sys.MapCreateAttr{ - MapType: sys.MapType(ArrayOfMaps), - KeySize: 4, - ValueSize: 4, - MaxEntries: 1, - // Invalid file descriptor. - InnerMapFd: ^uint32(0), - }) - if errors.Is(err, unix.EINVAL) { - return internal.ErrNotSupported - } - if errors.Is(err, unix.EBADF) { - return nil - } - return err -}) - -var haveMapMutabilityModifiers = internal.NewFeatureTest("read- and write-only maps", "5.2", func() error { - // This checks BPF_F_RDONLY_PROG and BPF_F_WRONLY_PROG. Since - // BPF_MAP_FREEZE appeared in 5.2 as well we don't do a separate check. - m, err := sys.MapCreate(&sys.MapCreateAttr{ - MapType: sys.MapType(Array), - KeySize: 4, - ValueSize: 4, - MaxEntries: 1, - MapFlags: unix.BPF_F_RDONLY_PROG, - }) - if err != nil { - return internal.ErrNotSupported - } - _ = m.Close() - return nil -}) - -var haveMmapableMaps = internal.NewFeatureTest("mmapable maps", "5.5", func() error { - // This checks BPF_F_MMAPABLE, which appeared in 5.5 for array maps. - m, err := sys.MapCreate(&sys.MapCreateAttr{ - MapType: sys.MapType(Array), - KeySize: 4, - ValueSize: 4, - MaxEntries: 1, - MapFlags: unix.BPF_F_MMAPABLE, - }) - if err != nil { - return internal.ErrNotSupported - } - _ = m.Close() - return nil -}) - -var haveInnerMaps = internal.NewFeatureTest("inner maps", "5.10", func() error { - // This checks BPF_F_INNER_MAP, which appeared in 5.10. - m, err := sys.MapCreate(&sys.MapCreateAttr{ - MapType: sys.MapType(Array), - KeySize: 4, - ValueSize: 4, - MaxEntries: 1, - MapFlags: unix.BPF_F_INNER_MAP, - }) - - if err != nil { - return internal.ErrNotSupported - } - _ = m.Close() - return nil -}) - -var haveNoPreallocMaps = internal.NewFeatureTest("prealloc maps", "4.6", func() error { - // This checks BPF_F_NO_PREALLOC, which appeared in 4.6. - m, err := sys.MapCreate(&sys.MapCreateAttr{ - MapType: sys.MapType(Hash), - KeySize: 4, - ValueSize: 4, - MaxEntries: 1, - MapFlags: unix.BPF_F_NO_PREALLOC, - }) - - if err != nil { - return internal.ErrNotSupported - } - _ = m.Close() - return nil -}) - -func wrapMapError(err error) error { - if err == nil { - return nil - } - - if errors.Is(err, unix.ENOENT) { - return sysErrKeyNotExist - } - - if errors.Is(err, unix.EEXIST) { - return sysErrKeyExist - } - - if errors.Is(err, sys.ENOTSUPP) { - return sysErrNotSupported - } - - if errors.Is(err, unix.E2BIG) { - return fmt.Errorf("key too big for map: %w", err) - } - - return err -} - -var haveObjName = internal.NewFeatureTest("object names", "4.15", func() error { - attr := sys.MapCreateAttr{ - MapType: sys.MapType(Array), - KeySize: 4, - ValueSize: 4, - MaxEntries: 1, - MapName: sys.NewObjName("feature_test"), - } - - fd, err := sys.MapCreate(&attr) - if err != nil { - return internal.ErrNotSupported - } - - _ = fd.Close() - return nil -}) - -var objNameAllowsDot = internal.NewFeatureTest("dot in object names", "5.2", func() error { - if err := haveObjName(); err != nil { - return err - } - - attr := sys.MapCreateAttr{ - MapType: sys.MapType(Array), - KeySize: 4, - ValueSize: 4, - MaxEntries: 1, - MapName: sys.NewObjName(".test"), - } - - fd, err := sys.MapCreate(&attr) - if err != nil { - return internal.ErrNotSupported - } - - _ = fd.Close() - return nil -}) - -var haveBatchAPI = internal.NewFeatureTest("map batch api", "5.6", func() error { - var maxEntries uint32 = 2 - attr := sys.MapCreateAttr{ - MapType: sys.MapType(Hash), - KeySize: 4, - ValueSize: 4, - MaxEntries: maxEntries, - } - - fd, err := sys.MapCreate(&attr) - if err != nil { - return internal.ErrNotSupported - } - defer fd.Close() - - keys := []uint32{1, 2} - values := []uint32{3, 4} - kp, _ := marshalMapSyscallInput(keys, 8) - vp, _ := marshalMapSyscallInput(values, 8) - - err = sys.MapUpdateBatch(&sys.MapUpdateBatchAttr{ - MapFd: fd.Uint(), - Keys: kp, - Values: vp, - Count: maxEntries, - }) - if err != nil { - return internal.ErrNotSupported - } - return nil -}) - -var haveProbeReadKernel = internal.NewFeatureTest("bpf_probe_read_kernel", "5.5", func() error { - insns := asm.Instructions{ - asm.Mov.Reg(asm.R1, asm.R10), - asm.Add.Imm(asm.R1, -8), - asm.Mov.Imm(asm.R2, 8), - asm.Mov.Imm(asm.R3, 0), - asm.FnProbeReadKernel.Call(), - asm.Return(), - } - - fd, err := progLoad(insns, Kprobe, "GPL") - if err != nil { - return internal.ErrNotSupported - } - _ = fd.Close() - return nil -}) - -var haveBPFToBPFCalls = internal.NewFeatureTest("bpf2bpf calls", "4.16", func() error { - insns := asm.Instructions{ - asm.Call.Label("prog2").WithSymbol("prog1"), - asm.Return(), - asm.Mov.Imm(asm.R0, 0).WithSymbol("prog2"), - asm.Return(), - } - - fd, err := progLoad(insns, SocketFilter, "MIT") - if err != nil { - return internal.ErrNotSupported - } - _ = fd.Close() - return nil -}) - -var haveSyscallWrapper = internal.NewFeatureTest("syscall wrapper", "4.17", func() error { - prefix := internal.PlatformPrefix() - if prefix == "" { - return fmt.Errorf("unable to find the platform prefix for (%s)", runtime.GOARCH) - } - - args := tracefs.ProbeArgs{ - Type: tracefs.Kprobe, - Symbol: prefix + "sys_bpf", - Pid: -1, - } - - var err error - args.Group, err = tracefs.RandomGroup("ebpf_probe") - if err != nil { - return err - } - - evt, err := tracefs.NewEvent(args) - if errors.Is(err, os.ErrNotExist) { - return internal.ErrNotSupported - } - if err != nil { - return err - } - - return evt.Close() -}) - -var haveProgramExtInfos = internal.NewFeatureTest("program ext_infos", "5.0", func() error { - insns := asm.Instructions{ - asm.Mov.Imm(asm.R0, 0), - asm.Return(), - } - - buf := bytes.NewBuffer(make([]byte, 0, insns.Size())) - if err := insns.Marshal(buf, internal.NativeEndian); err != nil { - return err - } - bytecode := buf.Bytes() - - _, err := sys.ProgLoad(&sys.ProgLoadAttr{ - ProgType: sys.ProgType(SocketFilter), - License: sys.NewStringPointer("MIT"), - Insns: sys.NewSlicePointer(bytecode), - InsnCnt: uint32(len(bytecode) / asm.InstructionSize), - FuncInfoCnt: 1, - ProgBtfFd: math.MaxUint32, - }) - - if errors.Is(err, unix.EBADF) { - return nil - } - - if errors.Is(err, unix.E2BIG) { - return ErrNotSupported - } - - return err -}) diff --git a/vendor/github.com/cilium/ebpf/types.go b/vendor/github.com/cilium/ebpf/types.go deleted file mode 100644 index 542c2397c..000000000 --- a/vendor/github.com/cilium/ebpf/types.go +++ /dev/null @@ -1,299 +0,0 @@ -package ebpf - -import ( - "github.com/cilium/ebpf/internal/sys" - "github.com/cilium/ebpf/internal/unix" -) - -//go:generate go run golang.org/x/tools/cmd/stringer@latest -output types_string.go -type=MapType,ProgramType,PinType - -// MapType indicates the type map structure -// that will be initialized in the kernel. -type MapType uint32 - -// All the various map types that can be created -const ( - UnspecifiedMap MapType = iota - // Hash is a hash map - Hash - // Array is an array map - Array - // ProgramArray - A program array map is a special kind of array map whose map - // values contain only file descriptors referring to other eBPF - // programs. Thus, both the key_size and value_size must be - // exactly four bytes. This map is used in conjunction with the - // TailCall helper. - ProgramArray - // PerfEventArray - A perf event array is used in conjunction with PerfEventRead - // and PerfEventOutput calls, to read the raw bpf_perf_data from the registers. - PerfEventArray - // PerCPUHash - This data structure is useful for people who have high performance - // network needs and can reconcile adds at the end of some cycle, so that - // hashes can be lock free without the use of XAdd, which can be costly. - PerCPUHash - // PerCPUArray - This data structure is useful for people who have high performance - // network needs and can reconcile adds at the end of some cycle, so that - // hashes can be lock free without the use of XAdd, which can be costly. - // Each CPU gets a copy of this hash, the contents of all of which can be reconciled - // later. - PerCPUArray - // StackTrace - This holds whole user and kernel stack traces, it can be retrieved with - // GetStackID - StackTrace - // CGroupArray - This is a very niche structure used to help SKBInCGroup determine - // if an skb is from a socket belonging to a specific cgroup - CGroupArray - // LRUHash - This allows you to create a small hash structure that will purge the - // least recently used items rather than throw an error when you run out of memory - LRUHash - // LRUCPUHash - This is NOT like PerCPUHash, this structure is shared among the CPUs, - // it has more to do with including the CPU id with the LRU calculation so that if a - // particular CPU is using a value over-and-over again, then it will be saved, but if - // a value is being retrieved a lot but sparsely across CPUs it is not as important, basically - // giving weight to CPU locality over overall usage. - LRUCPUHash - // LPMTrie - This is an implementation of Longest-Prefix-Match Trie structure. It is useful, - // for storing things like IP addresses which can be bit masked allowing for keys of differing - // values to refer to the same reference based on their masks. See wikipedia for more details. - LPMTrie - // ArrayOfMaps - Each item in the array is another map. The inner map mustn't be a map of maps - // itself. - ArrayOfMaps - // HashOfMaps - Each item in the hash map is another map. The inner map mustn't be a map of maps - // itself. - HashOfMaps - // DevMap - Specialized map to store references to network devices. - DevMap - // SockMap - Specialized map to store references to sockets. - SockMap - // CPUMap - Specialized map to store references to CPUs. - CPUMap - // XSKMap - Specialized map for XDP programs to store references to open sockets. - XSKMap - // SockHash - Specialized hash to store references to sockets. - SockHash - // CGroupStorage - Special map for CGroups. - CGroupStorage - // ReusePortSockArray - Specialized map to store references to sockets that can be reused. - ReusePortSockArray - // PerCPUCGroupStorage - Special per CPU map for CGroups. - PerCPUCGroupStorage - // Queue - FIFO storage for BPF programs. - Queue - // Stack - LIFO storage for BPF programs. - Stack - // SkStorage - Specialized map for local storage at SK for BPF programs. - SkStorage - // DevMapHash - Hash-based indexing scheme for references to network devices. - DevMapHash - // StructOpsMap - This map holds a kernel struct with its function pointer implemented in a BPF - // program. - StructOpsMap - // RingBuf - Similar to PerfEventArray, but shared across all CPUs. - RingBuf - // InodeStorage - Specialized local storage map for inodes. - InodeStorage - // TaskStorage - Specialized local storage map for task_struct. - TaskStorage -) - -// hasPerCPUValue returns true if the Map stores a value per CPU. -func (mt MapType) hasPerCPUValue() bool { - return mt == PerCPUHash || mt == PerCPUArray || mt == LRUCPUHash || mt == PerCPUCGroupStorage -} - -// canStoreMapOrProgram returns true if the Map stores references to another Map -// or Program. -func (mt MapType) canStoreMapOrProgram() bool { - return mt.canStoreMap() || mt.canStoreProgram() -} - -// canStoreMap returns true if the map type accepts a map fd -// for update and returns a map id for lookup. -func (mt MapType) canStoreMap() bool { - return mt == ArrayOfMaps || mt == HashOfMaps -} - -// canStoreProgram returns true if the map type accepts a program fd -// for update and returns a program id for lookup. -func (mt MapType) canStoreProgram() bool { - return mt == ProgramArray -} - -// ProgramType of the eBPF program -type ProgramType uint32 - -// eBPF program types -const ( - UnspecifiedProgram = ProgramType(sys.BPF_PROG_TYPE_UNSPEC) - SocketFilter = ProgramType(sys.BPF_PROG_TYPE_SOCKET_FILTER) - Kprobe = ProgramType(sys.BPF_PROG_TYPE_KPROBE) - SchedCLS = ProgramType(sys.BPF_PROG_TYPE_SCHED_CLS) - SchedACT = ProgramType(sys.BPF_PROG_TYPE_SCHED_ACT) - TracePoint = ProgramType(sys.BPF_PROG_TYPE_TRACEPOINT) - XDP = ProgramType(sys.BPF_PROG_TYPE_XDP) - PerfEvent = ProgramType(sys.BPF_PROG_TYPE_PERF_EVENT) - CGroupSKB = ProgramType(sys.BPF_PROG_TYPE_CGROUP_SKB) - CGroupSock = ProgramType(sys.BPF_PROG_TYPE_CGROUP_SOCK) - LWTIn = ProgramType(sys.BPF_PROG_TYPE_LWT_IN) - LWTOut = ProgramType(sys.BPF_PROG_TYPE_LWT_OUT) - LWTXmit = ProgramType(sys.BPF_PROG_TYPE_LWT_XMIT) - SockOps = ProgramType(sys.BPF_PROG_TYPE_SOCK_OPS) - SkSKB = ProgramType(sys.BPF_PROG_TYPE_SK_SKB) - CGroupDevice = ProgramType(sys.BPF_PROG_TYPE_CGROUP_DEVICE) - SkMsg = ProgramType(sys.BPF_PROG_TYPE_SK_MSG) - RawTracepoint = ProgramType(sys.BPF_PROG_TYPE_RAW_TRACEPOINT) - CGroupSockAddr = ProgramType(sys.BPF_PROG_TYPE_CGROUP_SOCK_ADDR) - LWTSeg6Local = ProgramType(sys.BPF_PROG_TYPE_LWT_SEG6LOCAL) - LircMode2 = ProgramType(sys.BPF_PROG_TYPE_LIRC_MODE2) - SkReuseport = ProgramType(sys.BPF_PROG_TYPE_SK_REUSEPORT) - FlowDissector = ProgramType(sys.BPF_PROG_TYPE_FLOW_DISSECTOR) - CGroupSysctl = ProgramType(sys.BPF_PROG_TYPE_CGROUP_SYSCTL) - RawTracepointWritable = ProgramType(sys.BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE) - CGroupSockopt = ProgramType(sys.BPF_PROG_TYPE_CGROUP_SOCKOPT) - Tracing = ProgramType(sys.BPF_PROG_TYPE_TRACING) - StructOps = ProgramType(sys.BPF_PROG_TYPE_STRUCT_OPS) - Extension = ProgramType(sys.BPF_PROG_TYPE_EXT) - LSM = ProgramType(sys.BPF_PROG_TYPE_LSM) - SkLookup = ProgramType(sys.BPF_PROG_TYPE_SK_LOOKUP) - Syscall = ProgramType(sys.BPF_PROG_TYPE_SYSCALL) - Netfilter = ProgramType(sys.BPF_PROG_TYPE_NETFILTER) -) - -// AttachType of the eBPF program, needed to differentiate allowed context accesses in -// some newer program types like CGroupSockAddr. Should be set to AttachNone if not required. -// Will cause invalid argument (EINVAL) at program load time if set incorrectly. -type AttachType uint32 - -//go:generate go run golang.org/x/tools/cmd/stringer@latest -type AttachType -trimprefix Attach - -// AttachNone is an alias for AttachCGroupInetIngress for readability reasons. -const AttachNone AttachType = 0 - -const ( - AttachCGroupInetIngress = AttachType(sys.BPF_CGROUP_INET_INGRESS) - AttachCGroupInetEgress = AttachType(sys.BPF_CGROUP_INET_EGRESS) - AttachCGroupInetSockCreate = AttachType(sys.BPF_CGROUP_INET_SOCK_CREATE) - AttachCGroupSockOps = AttachType(sys.BPF_CGROUP_SOCK_OPS) - AttachSkSKBStreamParser = AttachType(sys.BPF_SK_SKB_STREAM_PARSER) - AttachSkSKBStreamVerdict = AttachType(sys.BPF_SK_SKB_STREAM_VERDICT) - AttachCGroupDevice = AttachType(sys.BPF_CGROUP_DEVICE) - AttachSkMsgVerdict = AttachType(sys.BPF_SK_MSG_VERDICT) - AttachCGroupInet4Bind = AttachType(sys.BPF_CGROUP_INET4_BIND) - AttachCGroupInet6Bind = AttachType(sys.BPF_CGROUP_INET6_BIND) - AttachCGroupInet4Connect = AttachType(sys.BPF_CGROUP_INET4_CONNECT) - AttachCGroupInet6Connect = AttachType(sys.BPF_CGROUP_INET6_CONNECT) - AttachCGroupInet4PostBind = AttachType(sys.BPF_CGROUP_INET4_POST_BIND) - AttachCGroupInet6PostBind = AttachType(sys.BPF_CGROUP_INET6_POST_BIND) - AttachCGroupUDP4Sendmsg = AttachType(sys.BPF_CGROUP_UDP4_SENDMSG) - AttachCGroupUDP6Sendmsg = AttachType(sys.BPF_CGROUP_UDP6_SENDMSG) - AttachLircMode2 = AttachType(sys.BPF_LIRC_MODE2) - AttachFlowDissector = AttachType(sys.BPF_FLOW_DISSECTOR) - AttachCGroupSysctl = AttachType(sys.BPF_CGROUP_SYSCTL) - AttachCGroupUDP4Recvmsg = AttachType(sys.BPF_CGROUP_UDP4_RECVMSG) - AttachCGroupUDP6Recvmsg = AttachType(sys.BPF_CGROUP_UDP6_RECVMSG) - AttachCGroupGetsockopt = AttachType(sys.BPF_CGROUP_GETSOCKOPT) - AttachCGroupSetsockopt = AttachType(sys.BPF_CGROUP_SETSOCKOPT) - AttachTraceRawTp = AttachType(sys.BPF_TRACE_RAW_TP) - AttachTraceFEntry = AttachType(sys.BPF_TRACE_FENTRY) - AttachTraceFExit = AttachType(sys.BPF_TRACE_FEXIT) - AttachModifyReturn = AttachType(sys.BPF_MODIFY_RETURN) - AttachLSMMac = AttachType(sys.BPF_LSM_MAC) - AttachTraceIter = AttachType(sys.BPF_TRACE_ITER) - AttachCgroupInet4GetPeername = AttachType(sys.BPF_CGROUP_INET4_GETPEERNAME) - AttachCgroupInet6GetPeername = AttachType(sys.BPF_CGROUP_INET6_GETPEERNAME) - AttachCgroupInet4GetSockname = AttachType(sys.BPF_CGROUP_INET4_GETSOCKNAME) - AttachCgroupInet6GetSockname = AttachType(sys.BPF_CGROUP_INET6_GETSOCKNAME) - AttachXDPDevMap = AttachType(sys.BPF_XDP_DEVMAP) - AttachCgroupInetSockRelease = AttachType(sys.BPF_CGROUP_INET_SOCK_RELEASE) - AttachXDPCPUMap = AttachType(sys.BPF_XDP_CPUMAP) - AttachSkLookup = AttachType(sys.BPF_SK_LOOKUP) - AttachXDP = AttachType(sys.BPF_XDP) - AttachSkSKBVerdict = AttachType(sys.BPF_SK_SKB_VERDICT) - AttachSkReuseportSelect = AttachType(sys.BPF_SK_REUSEPORT_SELECT) - AttachSkReuseportSelectOrMigrate = AttachType(sys.BPF_SK_REUSEPORT_SELECT_OR_MIGRATE) - AttachPerfEvent = AttachType(sys.BPF_PERF_EVENT) - AttachTraceKprobeMulti = AttachType(sys.BPF_TRACE_KPROBE_MULTI) - AttachLSMCgroup = AttachType(sys.BPF_LSM_CGROUP) - AttachStructOps = AttachType(sys.BPF_STRUCT_OPS) - AttachNetfilter = AttachType(sys.BPF_NETFILTER) - AttachTCXIngress = AttachType(sys.BPF_TCX_INGRESS) - AttachTCXEgress = AttachType(sys.BPF_TCX_EGRESS) - AttachTraceUprobeMulti = AttachType(sys.BPF_TRACE_UPROBE_MULTI) - AttachCgroupUnixConnect = AttachType(sys.BPF_CGROUP_UNIX_CONNECT) - AttachCgroupUnixSendmsg = AttachType(sys.BPF_CGROUP_UNIX_SENDMSG) - AttachCgroupUnixRecvmsg = AttachType(sys.BPF_CGROUP_UNIX_RECVMSG) - AttachCgroupUnixGetpeername = AttachType(sys.BPF_CGROUP_UNIX_GETPEERNAME) - AttachCgroupUnixGetsockname = AttachType(sys.BPF_CGROUP_UNIX_GETSOCKNAME) - AttachNetkitPrimary = AttachType(sys.BPF_NETKIT_PRIMARY) - AttachNetkitPeer = AttachType(sys.BPF_NETKIT_PEER) -) - -// AttachFlags of the eBPF program used in BPF_PROG_ATTACH command -type AttachFlags uint32 - -// PinType determines whether a map is pinned into a BPFFS. -type PinType uint32 - -// Valid pin types. -// -// Mirrors enum libbpf_pin_type. -const ( - PinNone PinType = iota - // Pin an object by using its name as the filename. - PinByName -) - -// LoadPinOptions control how a pinned object is loaded. -type LoadPinOptions struct { - // Request a read-only or write-only object. The default is a read-write - // object. Only one of the flags may be set. - ReadOnly bool - WriteOnly bool - - // Raw flags for the syscall. Other fields of this struct take precedence. - Flags uint32 -} - -// Marshal returns a value suitable for BPF_OBJ_GET syscall file_flags parameter. -func (lpo *LoadPinOptions) Marshal() uint32 { - if lpo == nil { - return 0 - } - - flags := lpo.Flags - if lpo.ReadOnly { - flags |= unix.BPF_F_RDONLY - } - if lpo.WriteOnly { - flags |= unix.BPF_F_WRONLY - } - return flags -} - -// BatchOptions batch map operations options -// -// Mirrors libbpf struct bpf_map_batch_opts -// Currently BPF_F_FLAG is the only supported -// flag (for ElemFlags). -type BatchOptions struct { - ElemFlags uint64 - Flags uint64 -} - -// LogLevel controls the verbosity of the kernel's eBPF program verifier. -// These constants can be used for the ProgramOptions.LogLevel field. -type LogLevel = sys.LogLevel - -const ( - // Print verifier state at branch points. - LogLevelBranch = sys.BPF_LOG_LEVEL1 - - // Print verifier state for every instruction. - // Available since Linux v5.2. - LogLevelInstruction = sys.BPF_LOG_LEVEL2 - - // Print verifier errors and stats at the end of the verification process. - // Available since Linux v5.2. - LogLevelStats = sys.BPF_LOG_STATS -) diff --git a/vendor/github.com/cilium/ebpf/types_string.go b/vendor/github.com/cilium/ebpf/types_string.go deleted file mode 100644 index ee60b5be5..000000000 --- a/vendor/github.com/cilium/ebpf/types_string.go +++ /dev/null @@ -1,119 +0,0 @@ -// Code generated by "stringer -output types_string.go -type=MapType,ProgramType,PinType"; DO NOT EDIT. - -package ebpf - -import "strconv" - -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[UnspecifiedMap-0] - _ = x[Hash-1] - _ = x[Array-2] - _ = x[ProgramArray-3] - _ = x[PerfEventArray-4] - _ = x[PerCPUHash-5] - _ = x[PerCPUArray-6] - _ = x[StackTrace-7] - _ = x[CGroupArray-8] - _ = x[LRUHash-9] - _ = x[LRUCPUHash-10] - _ = x[LPMTrie-11] - _ = x[ArrayOfMaps-12] - _ = x[HashOfMaps-13] - _ = x[DevMap-14] - _ = x[SockMap-15] - _ = x[CPUMap-16] - _ = x[XSKMap-17] - _ = x[SockHash-18] - _ = x[CGroupStorage-19] - _ = x[ReusePortSockArray-20] - _ = x[PerCPUCGroupStorage-21] - _ = x[Queue-22] - _ = x[Stack-23] - _ = x[SkStorage-24] - _ = x[DevMapHash-25] - _ = x[StructOpsMap-26] - _ = x[RingBuf-27] - _ = x[InodeStorage-28] - _ = x[TaskStorage-29] -} - -const _MapType_name = "UnspecifiedMapHashArrayProgramArrayPerfEventArrayPerCPUHashPerCPUArrayStackTraceCGroupArrayLRUHashLRUCPUHashLPMTrieArrayOfMapsHashOfMapsDevMapSockMapCPUMapXSKMapSockHashCGroupStorageReusePortSockArrayPerCPUCGroupStorageQueueStackSkStorageDevMapHashStructOpsMapRingBufInodeStorageTaskStorage" - -var _MapType_index = [...]uint16{0, 14, 18, 23, 35, 49, 59, 70, 80, 91, 98, 108, 115, 126, 136, 142, 149, 155, 161, 169, 182, 200, 219, 224, 229, 238, 248, 260, 267, 279, 290} - -func (i MapType) String() string { - if i >= MapType(len(_MapType_index)-1) { - return "MapType(" + strconv.FormatInt(int64(i), 10) + ")" - } - return _MapType_name[_MapType_index[i]:_MapType_index[i+1]] -} -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[UnspecifiedProgram-0] - _ = x[SocketFilter-1] - _ = x[Kprobe-2] - _ = x[SchedCLS-3] - _ = x[SchedACT-4] - _ = x[TracePoint-5] - _ = x[XDP-6] - _ = x[PerfEvent-7] - _ = x[CGroupSKB-8] - _ = x[CGroupSock-9] - _ = x[LWTIn-10] - _ = x[LWTOut-11] - _ = x[LWTXmit-12] - _ = x[SockOps-13] - _ = x[SkSKB-14] - _ = x[CGroupDevice-15] - _ = x[SkMsg-16] - _ = x[RawTracepoint-17] - _ = x[CGroupSockAddr-18] - _ = x[LWTSeg6Local-19] - _ = x[LircMode2-20] - _ = x[SkReuseport-21] - _ = x[FlowDissector-22] - _ = x[CGroupSysctl-23] - _ = x[RawTracepointWritable-24] - _ = x[CGroupSockopt-25] - _ = x[Tracing-26] - _ = x[StructOps-27] - _ = x[Extension-28] - _ = x[LSM-29] - _ = x[SkLookup-30] - _ = x[Syscall-31] - _ = x[Netfilter-32] -} - -const _ProgramType_name = "UnspecifiedProgramSocketFilterKprobeSchedCLSSchedACTTracePointXDPPerfEventCGroupSKBCGroupSockLWTInLWTOutLWTXmitSockOpsSkSKBCGroupDeviceSkMsgRawTracepointCGroupSockAddrLWTSeg6LocalLircMode2SkReuseportFlowDissectorCGroupSysctlRawTracepointWritableCGroupSockoptTracingStructOpsExtensionLSMSkLookupSyscallNetfilter" - -var _ProgramType_index = [...]uint16{0, 18, 30, 36, 44, 52, 62, 65, 74, 83, 93, 98, 104, 111, 118, 123, 135, 140, 153, 167, 179, 188, 199, 212, 224, 245, 258, 265, 274, 283, 286, 294, 301, 310} - -func (i ProgramType) String() string { - if i >= ProgramType(len(_ProgramType_index)-1) { - return "ProgramType(" + strconv.FormatInt(int64(i), 10) + ")" - } - return _ProgramType_name[_ProgramType_index[i]:_ProgramType_index[i+1]] -} -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[PinNone-0] - _ = x[PinByName-1] -} - -const _PinType_name = "PinNonePinByName" - -var _PinType_index = [...]uint8{0, 7, 16} - -func (i PinType) String() string { - if i >= PinType(len(_PinType_index)-1) { - return "PinType(" + strconv.FormatInt(int64(i), 10) + ")" - } - return _PinType_name[_PinType_index[i]:_PinType_index[i+1]] -} diff --git a/vendor/github.com/cilium/hive/LICENSE b/vendor/github.com/cilium/hive/LICENSE deleted file mode 100644 index a2e486a80..000000000 --- a/vendor/github.com/cilium/hive/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - 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} Authors of Cilium - - 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. - diff --git a/vendor/github.com/cilium/hive/Makefile b/vendor/github.com/cilium/hive/Makefile deleted file mode 100644 index 3e17ea11f..000000000 --- a/vendor/github.com/cilium/hive/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -.PHONY: all build test test-race bench - -all: build test test-race bench - -build: - go build ./... - -test: - go test ./... -cover -test.count 1 - -test-race: - go test -race ./... -test.count 1 - -bench: - go test ./... -bench . -test.run xxx diff --git a/vendor/github.com/cilium/hive/README.md b/vendor/github.com/cilium/hive/README.md deleted file mode 100644 index 60701fabd..000000000 --- a/vendor/github.com/cilium/hive/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# :bee: Hive [![GoDoc](https://pkg.go.dev/badge/github.com/cilium/hive)](https://pkg.go.dev/github.com/cilium/hive) - -Hive is a dependency injection framework for Go. To build an application -in Hive you tell it your object constructors and then ask it to invoke -functions that make use of those constructors. Hive figures out what constructors -to call and in what order. - -Hive is built on top of `uber/dig` and is similar to `uber/fx`. -The main difference to `uber/fx` is opinionated way to provide configuration -and command-line inspection tooling (`go run ./example hive`). Hive was built -for the needs of the Cilium project to improve modularity of the Cilium codebase. - -To get started, see the [documentation](https://pkg.go.dev/github.com/cilium/hive) -and explore the [example](example). diff --git a/vendor/github.com/cilium/hive/cell/cell.go b/vendor/github.com/cilium/hive/cell/cell.go deleted file mode 100644 index cf6be3aaf..000000000 --- a/vendor/github.com/cilium/hive/cell/cell.go +++ /dev/null @@ -1,51 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package cell - -import ( - "go.uber.org/dig" -) - -// Cell is the modular building block of the hive. -// -// A cell can be constructed with: -// -// - Module(): Create a named set of cells. -// - Provide(): Provide object constructors. -// - Invoke(): Invoke a function to instantiate objects. -// - Decorate(): Decorate a set of cells to augment an object. -// - Config(): Cell providing a configuration struct. -type Cell interface { - // Info provides a structural summary of the cell for printing purposes. - Info(container) Info - - // Apply the cell to the dependency graph container. - Apply(container) error -} - -// In when embedded into a struct used as constructor parameter makes the exported -// values of that struct become dependency injected values. In other words, it allows -// moving a long list of constructor parameters into a struct. -// -// Struct fields can be annotated with `optional:"true"` to make the dependency optional. -// If the type is not found in the dependency graph, the value is set to the zero value. -// -// See https://pkg.go.dev/go.uber.org/dig#In for more information. -type In = dig.In - -// Out when embedded into a struct that is returned by a constructor will make the -// values in the struct become objects in the dependency graph instead of the struct -// itself. -// -// See https://pkg.go.dev/go.uber.org/dig#Out for more information. -type Out = dig.Out - -// container is the common interface between dig.Container and dig.Scope. -// Used in Apply(). -type container interface { - Provide(ctor any, opts ...dig.ProvideOption) error - Invoke(fn any, opts ...dig.InvokeOption) error - Decorate(fn any, opts ...dig.DecorateOption) error - Scope(name string, opts ...dig.ScopeOption) *dig.Scope -} diff --git a/vendor/github.com/cilium/hive/cell/config.go b/vendor/github.com/cilium/hive/cell/config.go deleted file mode 100644 index 68f1a0f42..000000000 --- a/vendor/github.com/cilium/hive/cell/config.go +++ /dev/null @@ -1,199 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package cell - -import ( - "fmt" - "reflect" - "strings" - - "github.com/cilium/hive/internal" - "github.com/mitchellh/mapstructure" - "github.com/spf13/pflag" - "go.uber.org/dig" -) - -// Config constructs a new config cell. -// -// The configuration struct `T` needs to implement the Flags method that -// registers the flags. The structure is populated and provided via dependency -// injection by Hive.Run(). The underlying mechanism for populating the struct -// is viper's Unmarshal(). -func Config[Cfg Flagger](def Cfg) Cell { - return &config[Cfg]{defaultConfig: def} -} - -// Flagger is implemented by configuration structs to provide configuration -// for a cell. -type Flagger interface { - // Flags registers the configuration options as command-line flags. - // - // By convention a flag name matches the field name - // if they're the same under case-insensitive comparison when dashes are - // removed. E.g. "my-config-flag" matches field "MyConfigFlag". The - // correspondence to the flag can be also specified with the mapstructure - // tag: MyConfigFlag `mapstructure:"my-config-flag"`. - // - // Exported fields that are not found from the viper settings will cause - // hive.Run() to fail. Unexported fields are ignored. - // - // See https://pkg.go.dev/github.com/mitchellh/mapstructure for more info. - Flags(*pflag.FlagSet) -} - -// config is a cell for configuration. It registers the config's command-line -// flags and provides the parsed config to the hive. -type config[Cfg Flagger] struct { - defaultConfig Cfg -} - -type AllSettings map[string]any - -type DecodeHooks []mapstructure.DecodeHookFunc - -type configParams[Cfg Flagger] struct { - dig.In - AllSettings AllSettings - DecodeHooks DecodeHooks `optional:"true"` - Override func(*Cfg) `optional:"true"` -} - -func provideConfig[Cfg Flagger](defaultConfig Cfg, flags *pflag.FlagSet) func(p configParams[Cfg]) (Cfg, error) { - return func(p configParams[Cfg]) (Cfg, error) { - settings := p.AllSettings - target := defaultConfig - decoder, err := mapstructure.NewDecoder(decoderConfig(&target, p.DecodeHooks)) - if err != nil { - return target, fmt.Errorf("failed to create config decoder: %w", err) - } - - // As input, only consider the declared flags. - input := make(map[string]any) - - flags.VisitAll(func(f *pflag.Flag) { - if v, ok := settings[f.Name]; ok { - input[f.Name] = v - } else { - err = fmt.Errorf("internal error: %s not found from settings", f.Name) - } - }) - if err != nil { - return target, err - } - if err := decoder.Decode(input); err != nil { - return target, fmt.Errorf("failed to unmarshal config struct %T: %w.\n"+ - "Hint: field 'FooBar' matches flag 'foo-bar', or use tag `mapstructure:\"flag-name\"` to match field with flag", - target, err) - } - - // See if the configuration was overridden with ConfigOverride. We check the override - // after the decode to validate that the config struct is properly formed and all - // flags are registered. - if p.Override != nil { - p.Override(&target) - } - - return target, nil - } -} - -func decoderConfig(target any, extraHooks DecodeHooks) *mapstructure.DecoderConfig { - decodeHooks := []mapstructure.DecodeHookFunc{ - // To unify the splitting of fields of a []string field across the input coming - // from environment, configmap and pflag (command-line), we first split a string - // (env/configmap) by comma, and then for all input methods we split a single - // value []string by whitespace. Thus the following all result in the same slice: - // - // --string-slice=foo,bar,baz - // --string-slice="foo bar baz" - // CILIUM_STRING_SLICE="foo,bar,baz" - // CILIUM_STRING_SLICE="foo bar baz" - // /.../configmap/string_slice: "foo bar baz" - // /.../configmap/string_slice: "foo,bar,baz" - // - // If both commas and whitespaces are present the commas take precedence: - // "foo,bar baz" => []string{"foo", "bar baz"} - mapstructure.StringToSliceHookFunc(","), // string->[]string is split by comma - fixupStringSliceHookFunc, // []string of length 1 is split again by whitespace - - mapstructure.StringToTimeDurationHookFunc(), - stringToMapHookFunc, - } - decodeHooks = append(decodeHooks, extraHooks...) - - return &mapstructure.DecoderConfig{ - Metadata: nil, - Result: target, - WeaklyTypedInput: true, - DecodeHook: mapstructure.ComposeDecodeHookFunc(decodeHooks...), - ZeroFields: true, - // Error out if the config struct has fields that are - // not found from input. - ErrorUnset: true, - // Error out also if settings from input are not used. - ErrorUnused: true, - // Match field FooBarBaz with "foo-bar-baz" by removing - // the dashes from the flag. - MatchName: func(mapKey, fieldName string) bool { - return strings.EqualFold( - strings.ReplaceAll(mapKey, "-", ""), - fieldName) - }, - } -} - -func (c *config[Cfg]) Apply(cont container) error { - flags := pflag.NewFlagSet("", pflag.ContinueOnError) - c.defaultConfig.Flags(flags) - - // Register the flags to the global set of all flags. - err := cont.Invoke( - func(allFlags *pflag.FlagSet) { - allFlags.AddFlagSet(flags) - }) - if err != nil { - return err - } - // And provide the constructor for the config. - return cont.Provide( - provideConfig(c.defaultConfig, flags), - dig.Export(true), - ) -} - -func (c *config[Cfg]) Info(cont container) (info Info) { - cont.Invoke(func(cfg Cfg) { - info = &InfoStruct{cfg} - }) - return -} - -// stringToMapHookFunc is a DecodeHookFunc that converts string -// to map[string]string supporting both json and KV formats. -func stringToMapHookFunc(from reflect.Kind, to reflect.Kind, data interface{}) (interface{}, error) { - if from != reflect.String || to != reflect.Map { - return data, nil - } - return internal.ToStringMapStringE(data.(string)) -} - -// fixupStringSliceHookFunc takes a []string and if it's a single element splits it again -// by whitespace. This unifies the flag parsing behavior with StringSlice -// values coming from environment or configmap where both spaces or commas can be used to split. -func fixupStringSliceHookFunc(from reflect.Type, to reflect.Type, data interface{}) (interface{}, error) { - if from.Kind() != reflect.Slice || to.Kind() != reflect.Slice { - return data, nil - } - if from.Elem().Kind() != reflect.String || to.Elem().Kind() != reflect.String { - return data, nil - } - - raw := data.([]string) - if len(raw) == 1 { - // Flag was already split by commas (the default behavior), so split it - // now by spaces. - return strings.Fields(raw[0]), nil - } - return raw, nil -} diff --git a/vendor/github.com/cilium/hive/cell/decorator.go b/vendor/github.com/cilium/hive/cell/decorator.go deleted file mode 100644 index d42f43228..000000000 --- a/vendor/github.com/cilium/hive/cell/decorator.go +++ /dev/null @@ -1,62 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package cell - -import ( - "fmt" - - "github.com/cilium/hive/internal" -) - -// Decorate takes a decorator function and a set of cells and returns -// a decorator cell. -// -// A decorator function is a function that takes as arguments objects -// in the hive and returns one or more augmented objects. The cells wrapped -// with a decorator will be provided the returned augmented objects. -// -// Example: -// -// cell.Decorate( -// func(e Example) Example { -// return e.WithMoreMagic() -// }, -// cell.Invoke(func(e Example) { -// // e now has more magic -// }, -// ) -func Decorate(dtor any, cells ...Cell) Cell { - return &decorator{ - decorator: dtor, - cells: cells, - } -} - -type decorator struct { - decorator any - cells []Cell -} - -func (d *decorator) Apply(c container) error { - scope := c.Scope(fmt.Sprintf("(decorate %s)", internal.PrettyType(d.decorator))) - if err := scope.Decorate(d.decorator); err != nil { - return err - } - - for _, cell := range d.cells { - if err := cell.Apply(scope); err != nil { - return err - } - } - - return nil -} - -func (d *decorator) Info(c container) Info { - n := NewInfoNode(fmt.Sprintf("🔀 %s: %s", internal.FuncNameAndLocation(d.decorator), internal.PrettyType(d.decorator))) - for _, cell := range d.cells { - n.Add(cell.Info(c)) - } - return n -} diff --git a/vendor/github.com/cilium/hive/cell/group.go b/vendor/github.com/cilium/hive/cell/group.go deleted file mode 100644 index f2e60b12c..000000000 --- a/vendor/github.com/cilium/hive/cell/group.go +++ /dev/null @@ -1,29 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package cell - -type group []Cell - -// Group a set of cells. Unlike Module(), Group() does not create a new -// scope. -func Group(cells ...Cell) Cell { - return group(cells) -} - -func (g group) Apply(c container) error { - for _, cell := range g { - if err := cell.Apply(c); err != nil { - return err - } - } - return nil -} - -func (g group) Info(c container) Info { - n := NewInfoNode("") - for _, cell := range g { - n.Add(cell.Info(c)) - } - return n -} diff --git a/vendor/github.com/cilium/hive/cell/health.go b/vendor/github.com/cilium/hive/cell/health.go deleted file mode 100644 index aace1e897..000000000 --- a/vendor/github.com/cilium/hive/cell/health.go +++ /dev/null @@ -1,58 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package cell - -// Level denotes what kind an update is. -type Level string - -const ( - // StatusUnknown is the default status of a Module, prior to it reporting - // any status. - // All created - StatusUnknown Level = "Unknown" - - // StatusStopped is the status of a Module that has completed, further updates - // will not be processed. - StatusStopped Level = "Stopped" - - // StatusDegraded is the status of a Module that has entered a degraded state. - StatusDegraded Level = "Degraded" - - // StatusOK is the status of a Module that has achieved a desired state. - StatusOK Level = "OK" -) - -// Health provides a method of declaring a Modules health status. -// -// The interface is meant to be used with "ModuleDecorator" to inject it into -// the scope of modules. -// -// Implementation for health reporting is not included with the Hive library. -type Health interface { - // OK declares that a Module has achieved a desired state and has not entered - // any unexpected or incorrect states. - // Modules should only declare themselves as 'OK' once they have stabilized, - // rather than during their initial state. This should be left to be reported - // as the default "unknown" to denote that the module has not reached a "ready" - // health state. - OK(status string) - - // Stopped reports that a module has completed, and will no longer report any - // health status. - // Implementations should differentiate that a stopped module may also be OK or Degraded. - // Stopping a reporting should only affect future updates. - Stopped(reason string) - - // Degraded declares that a module has entered a degraded state. - // This means that it may have failed to provide it's intended services, or - // to perform it's desired task. - Degraded(reason string, err error) - - // NewScope constructs a new scoped health reporter. - NewScope(name string) Health - - // Close closes this health scope and removes it. This is distinct from - // 'Stopped' in that after closing the health status will disappear completely. - Close() -} diff --git a/vendor/github.com/cilium/hive/cell/info.go b/vendor/github.com/cilium/hive/cell/info.go deleted file mode 100644 index 7c2075328..000000000 --- a/vendor/github.com/cilium/hive/cell/info.go +++ /dev/null @@ -1,124 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package cell - -import ( - "bufio" - "fmt" - "io" - "os" - "strings" - - "github.com/davecgh/go-spew/spew" - "golang.org/x/term" -) - -const ( - // indentBy is the number of spaces nested elements should be indented by - indentBy = 4 -) - -type InfoPrinter struct { - io.Writer - width int -} - -func NewInfoPrinter() *InfoPrinter { - width, _, err := term.GetSize(int(os.Stdout.Fd())) - if err != nil { - width = 120 - } - return &InfoPrinter{ - Writer: os.Stdout, - width: width, - } -} - -// Info provides a simple way of printing cells hierarchically in -// textual form. -type Info interface { - Print(indent int, w *InfoPrinter) -} - -type InfoLeaf string - -func (l InfoLeaf) Print(indent int, w *InfoPrinter) { - buf := bufio.NewWriter(w) - indentString := strings.Repeat(" ", indent) - buf.WriteString(indentString) - currentLineLength := len(indentString) - wrapped := false - for _, f := range strings.Fields(string(l)) { - newLineLength := currentLineLength + len(f) + 1 - if newLineLength >= w.width { - buf.WriteByte('\n') - if !wrapped { - // Increase the indent for the wrapped lines so it's clear we - // wrapped. - wrapped = true - indent += 2 - indentString = strings.Repeat(" ", indent) - } - buf.WriteString(indentString) - currentLineLength = indent + len(f) + 1 - } else { - currentLineLength = newLineLength - } - buf.WriteString(f) - buf.WriteByte(' ') - } - buf.WriteByte('\n') - buf.Flush() -} - -type InfoNode struct { - // Header line. If missing, no header printed and children - // not indented. - header string - condensed bool - - children []Info -} - -func NewInfoNode(header string) *InfoNode { - return &InfoNode{header: header} -} - -func (n *InfoNode) Add(child Info) { - n.children = append(n.children, child) -} - -func (n *InfoNode) AddLeaf(format string, args ...any) { - n.Add(InfoLeaf(fmt.Sprintf(format, args...))) -} - -func (n *InfoNode) Print(indent int, w *InfoPrinter) { - if n.header != "" { - fmt.Fprintf(w, "%s%s:\n", strings.Repeat(" ", indent), n.header) - indent += indentBy - } - - for i, child := range n.children { - child.Print(indent, w) - if !n.condensed && i != len(n.children)-1 { - w.Write([]byte{'\n'}) - } - } -} - -type InfoStruct struct { - value any -} - -func (n *InfoStruct) Print(indent int, w *InfoPrinter) { - scs := spew.ConfigState{Indent: strings.Repeat(" ", indentBy), SortKeys: true} - indentString := strings.Repeat(" ", indent) - for i, line := range strings.Split(scs.Sdump(n.value), "\n") { - if i == 0 { - fmt.Fprintf(w, "%s⚙️ %s\n", indentString, line) - } else { - fmt.Fprintf(w, "%s%s\n", indentString, line) - } - } -} diff --git a/vendor/github.com/cilium/hive/cell/invoke.go b/vendor/github.com/cilium/hive/cell/invoke.go deleted file mode 100644 index b1fff226f..000000000 --- a/vendor/github.com/cilium/hive/cell/invoke.go +++ /dev/null @@ -1,111 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package cell - -import ( - "fmt" - "log/slog" - "sort" - "strings" - "sync" - "time" - - "go.uber.org/dig" - - "github.com/cilium/hive/internal" -) - -type invoker struct { - funcs []namedFunc -} - -type namedFunc struct { - name string - fn any - - infoMu sync.Mutex - info *dig.InvokeInfo -} - -type InvokerList interface { - AppendInvoke(func(*slog.Logger, time.Duration) error) -} - -func (inv *invoker) invoke(log *slog.Logger, cont container, logThreshold time.Duration) error { - for i := range inv.funcs { - nf := &inv.funcs[i] - log.Debug("Invoking", "function", nf.name) - t0 := time.Now() - - var opts []dig.InvokeOption - nf.infoMu.Lock() - if nf.info == nil { - nf.info = &dig.InvokeInfo{} - opts = []dig.InvokeOption{ - dig.FillInvokeInfo(nf.info), - } - } - defer inv.funcs[i].infoMu.Unlock() - - if err := cont.Invoke(nf.fn, opts...); err != nil { - log.Error("Invoke failed", "error", err, "function", nf.name) - return err - } - d := time.Since(t0) - if d > logThreshold { - log.Info("Invoked", "duration", d, "function", nf.name) - } else { - log.Debug("Invoked", "duration", d, "function", nf.name) - } - } - return nil -} - -func (inv *invoker) Apply(c container) error { - // Remember the scope in which we need to invoke. - invoker := func(log *slog.Logger, logThreshold time.Duration) error { return inv.invoke(log, c, logThreshold) } - - // Append the invoker to the list of invoke functions. These are invoked - // prior to start to build up the objects. They are not invoked directly - // here as first the configuration flags need to be registered. This allows - // using hives in a command-line application with many commands and where - // we don't yet know which command to run, but we still need to register - // all the flags. - return c.Invoke(func(l InvokerList) { - l.AppendInvoke(invoker) - }) -} - -func (inv *invoker) Info(container) Info { - n := NewInfoNode("") - for i := range inv.funcs { - namedFunc := &inv.funcs[i] - namedFunc.infoMu.Lock() - defer namedFunc.infoMu.Unlock() - - invNode := NewInfoNode(fmt.Sprintf("🛠️ %s", namedFunc.name)) - invNode.condensed = true - - var ins []string - for _, input := range namedFunc.info.Inputs { - ins = append(ins, input.String()) - } - sort.Strings(ins) - invNode.AddLeaf("⇨ %s", strings.Join(ins, ", ")) - n.Add(invNode) - } - return n -} - -// Invoke constructs a cell for invoke functions. The invoke functions are executed -// when the hive is started to instantiate all objects via the constructors. -func Invoke(funcs ...any) Cell { - namedFuncs := []namedFunc{} - for _, fn := range funcs { - namedFuncs = append( - namedFuncs, - namedFunc{name: internal.FuncNameAndLocation(fn), fn: fn}) - } - return &invoker{funcs: namedFuncs} -} diff --git a/vendor/github.com/cilium/hive/cell/lifecycle.go b/vendor/github.com/cilium/hive/cell/lifecycle.go deleted file mode 100644 index cbe41eebd..000000000 --- a/vendor/github.com/cilium/hive/cell/lifecycle.go +++ /dev/null @@ -1,236 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package cell - -import ( - "context" - "errors" - "fmt" - "log/slog" - "sync" - "time" - - "github.com/cilium/hive/internal" -) - -// HookContext is a context passed to a lifecycle hook that is cancelled -// in case of timeout. Hooks that perform long blocking operations directly -// in the start or stop function (e.g. connecting to external services to -// initialize) must abort any such operation if this context is cancelled. -type HookContext context.Context - -// HookInterface wraps the Start and Stop methods that can be appended -// to an application lifecycle. -type HookInterface interface { - Start(HookContext) error - Stop(HookContext) error -} - -// Hook is a pair of start and stop callbacks. Both are optional. -// They're paired up to make sure that on failed start all corresponding -// stop hooks are executed. -type Hook struct { - OnStart func(HookContext) error - OnStop func(HookContext) error -} - -func (h Hook) Start(ctx HookContext) error { - if h.OnStart == nil { - return nil - } - return h.OnStart(ctx) -} - -func (h Hook) Stop(ctx HookContext) error { - if h.OnStop == nil { - return nil - } - return h.OnStop(ctx) -} - -// Lifecycle enables cells to register start and stop hooks, either -// from a constructor or an invoke function. -type Lifecycle interface { - Append(HookInterface) - - Start(*slog.Logger, context.Context) error - Stop(*slog.Logger, context.Context) error - PrintHooks() -} - -// DefaultLifecycle lifecycle implements a simple lifecycle management that conforms -// to Lifecycle. It is exported for use in applications that have nested lifecycles -// (e.g. operator). -type DefaultLifecycle struct { - mu sync.Mutex - hooks []augmentedHook - numStarted int - - LogThreshold time.Duration -} - -type augmentedHook struct { - HookInterface - moduleID FullModuleID -} - -func (lc *DefaultLifecycle) Append(hook HookInterface) { - lc.mu.Lock() - defer lc.mu.Unlock() - - lc.hooks = append(lc.hooks, augmentedHook{hook, nil}) -} - -func (lc *DefaultLifecycle) Start(log *slog.Logger, ctx context.Context) error { - lc.mu.Lock() - defer lc.mu.Unlock() - - // Wrap the context to make sure it gets cancelled after - // start hooks have completed in order to discourage using - // the context for unintended purposes. - ctx, cancel := context.WithCancel(ctx) - defer cancel() - - for _, hook := range lc.hooks { - fnName, exists := getHookFuncName(hook, true) - - if !exists { - // Count as started as there might be a stop hook. - lc.numStarted++ - continue - } - - l := log.With("function", fnName) - l.Debug("Executing start hook") - t0 := time.Now() - if err := hook.Start(ctx); err != nil { - l.Error("Start hook failed", "error", err) - return err - } - d := time.Since(t0) - if d > lc.LogThreshold { - l.Info("Start hook executed", "duration", d) - } else { - l.Debug("Start hook executed", "duration", d) - } - lc.numStarted++ - } - return nil -} - -func (lc *DefaultLifecycle) Stop(log *slog.Logger, ctx context.Context) error { - lc.mu.Lock() - defer lc.mu.Unlock() - - // Wrap the context to make sure it gets cancelled after - // stop hooks have completed in order to discourage using - // the context for unintended purposes. - ctx, cancel := context.WithCancel(ctx) - defer cancel() - - var errs error - for ; lc.numStarted > 0; lc.numStarted-- { - if ctx.Err() != nil { - return ctx.Err() - } - hook := lc.hooks[lc.numStarted-1] - - fnName, exists := getHookFuncName(hook, false) - if !exists { - continue - } - l := log.With("function", fnName) - l.Debug("Executing stop hook") - t0 := time.Now() - if err := hook.Stop(ctx); err != nil { - l.Error("Stop hook failed", "error", err) - errs = errors.Join(errs, err) - } else { - d := time.Since(t0) - if d > lc.LogThreshold { - l.Info("Stop hook executed", "duration", d) - } else { - l.Debug("Stop hook executed", "duration", d) - } - } - } - return errs -} - -func (lc *DefaultLifecycle) PrintHooks() { - lc.mu.Lock() - defer lc.mu.Unlock() - - fmt.Printf("Start hooks:\n\n") - for _, hook := range lc.hooks { - fnName, exists := getHookFuncName(hook.HookInterface, true) - if !exists { - continue - } - fmt.Printf(" • %s (%s)\n", fnName, hook.moduleID) - } - - fmt.Printf("\nStop hooks:\n\n") - for i := len(lc.hooks) - 1; i >= 0; i-- { - hook := lc.hooks[i] - fnName, exists := getHookFuncName(hook.HookInterface, false) - if !exists { - continue - } - fmt.Printf(" • %s (%s)\n", fnName, hook.moduleID) - } -} - -type augmentedLifecycle struct { - *DefaultLifecycle - moduleID FullModuleID -} - -func (lc augmentedLifecycle) Append(hook HookInterface) { - lc.mu.Lock() - defer lc.mu.Unlock() - - lc.hooks = append(lc.hooks, augmentedHook{hook, lc.moduleID}) -} - -func getHookFuncName(hook HookInterface, start bool) (name string, hasHook bool) { - // Ok, we need to get a bit fancy here as runtime.FuncForPC does - // not return what we want: we get "cell.Hook.Stop()" when we want - // "*foo.Stop(). We do know the concrete type, and we do know - // the method name, so we check here whether we're dealing with - // "Hook" the struct, or an object implementing HookInterface. - // - // We could use reflection + FuncForPC to get around this, but it - // still wouldn't work for generic types (file would be "") - // and the type params would be missing, so instead we'll just use the - // type name + method name. - switch hook := hook.(type) { - case augmentedHook: - name, hasHook = getHookFuncName(hook.HookInterface, start) - if hasHook && len(hook.moduleID) > 0 { - name = name + " (" + hook.moduleID.String() + ")" - } - return - case Hook: - if start { - if hook.OnStart == nil { - return "", false - } - return internal.FuncNameAndLocation(hook.OnStart), true - } - if hook.OnStop == nil { - return "", false - } - return internal.FuncNameAndLocation(hook.OnStop), true - - default: - if start { - return internal.PrettyType(hook) + ".Start", true - } - return internal.PrettyType(hook) + ".Stop", true - - } -} - -var _ Lifecycle = &DefaultLifecycle{} diff --git a/vendor/github.com/cilium/hive/cell/module.go b/vendor/github.com/cilium/hive/cell/module.go deleted file mode 100644 index cbd29df4b..000000000 --- a/vendor/github.com/cilium/hive/cell/module.go +++ /dev/null @@ -1,206 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package cell - -import ( - "fmt" - "log/slog" - "regexp" - "slices" - "strings" - - "go.uber.org/dig" -) - -// Module creates a scoped set of cells with a given identifier. -// -// The id and description will be included in the object dump (hive.PrintObjects). -// The id must be lower-case, at most 30 characters and only contain [a-z0-9-_]. -// The description can contain [a-zA-Z0-9_- ] and must be shorter than 80 characters. -// -// As the description will be shown alongside the id, it should not repeat the id, but -// rather expand on it, for example; -// -// endpoint-manager: Manages and provides access to endpoints -// ^- id ^- description -// -// Private constructors with a module (ProvidePrivate) are only accessible -// within this module and its sub-modules. -func Module(id, description string, cells ...Cell) Cell { - validateIDAndDescription(id, description) - return &module{id, description, cells} -} - -// ModuleID is the module identifier. Provided in the module's scope. -type ModuleID string - -// FullModuleID is the fully qualified module identifier, e.g. the -// concat of nested module ids, e.g. "agent.controlplane.endpoint-manager". -// Provided in the module's scope. -type FullModuleID []string - -func (f FullModuleID) String() string { - return strings.Join(f, ".") -} - -func (f FullModuleID) append(m ModuleID) FullModuleID { - return append(slices.Clone(f), string(m)) -} - -// RootLogger is the unscoped logger without any attrs added to it. -type RootLogger *slog.Logger - -// ModuleDecorator is the optional decorator function used for each module -// to provide or replace objects in each module's scope. -// Supplied with [hive.Options] field 'ModuleDecorators'. -// -// This can be used to provide module-specific instances of objects application -// wide, similar to how *slog.Logger is provided by default. -type ModuleDecorator any - -type ModuleDecorators []ModuleDecorator - -// ModulePrivateProvider is the optional private provide function used for each module -// to provide objects in each module's scope. -// Supplied with [hive.Options] field 'ModulePrivateProviders'. -// -// This is different from a [ModuleDecorator] in that this can be used to provide objects -// that do not yet exist in the object graph, whereas [ModuleDecorator] requires that the -// objects that are being decorated already exist. - -type ModulePrivateProvider any - -type ModulePrivateProviders []ModulePrivateProvider - -var ( - idRegex = regexp.MustCompile(`^[a-z][a-z0-9_\-]{1,30}$`) - descriptionRegex = regexp.MustCompile(`^[a-zA-Z0-9_\- ]{1,80}$`) -) - -func validateIDAndDescription(id, description string) { - if !idRegex.MatchString(id) { - panic(fmt.Sprintf("Invalid hive.Module id: %q, expected to id match %s", id, idRegex)) - } - if !descriptionRegex.MatchString(description) { - panic(fmt.Sprintf("Invalid hive.Module description: %q, expected to match regex %q", description, descriptionRegex)) - } -} - -type module struct { - // id is the module identity. It is shown in object output and is used to derive - // the scoped logger. - id string - - // description is a human-readable short description for the module. Shown in object output - // alongside the identifier. - description string - - cells []Cell -} - -func (m *module) logger(moduleID FullModuleID, rootLog RootLogger) *slog.Logger { - return (*slog.Logger)(rootLog).With("module", moduleID.String()) -} - -func (m *module) moduleID() ModuleID { - return ModuleID(m.id) -} - -func (m *module) fullModuleID(parent FullModuleID) FullModuleID { - return parent.append(m.moduleID()) -} - -func (m *module) lifecycle(lc Lifecycle, fullID FullModuleID) Lifecycle { - switch lc := lc.(type) { - case *DefaultLifecycle: - return &augmentedLifecycle{ - lc, - fullID, - } - case *augmentedLifecycle: - return &augmentedLifecycle{ - lc.DefaultLifecycle, - fullID, - } - default: - return lc - } -} - -type moduleDecoratorParams struct { - In - ModuleDecorators ModuleDecorators -} - -func (m *module) moduleDecorators(scope *dig.Scope) error { - provide := func(p moduleDecoratorParams) error { - for _, d := range p.ModuleDecorators { - if err := scope.Decorate(d); err != nil { - return err - } - } - return nil - } - return scope.Invoke(provide) -} - -type modulePrivateProviderParams struct { - In - ModulePrivateProviders ModulePrivateProviders -} - -func (m *module) modulePrivateProviders(scope *dig.Scope) error { - provide := func(p modulePrivateProviderParams) error { - for _, d := range p.ModulePrivateProviders { - if err := scope.Provide(d); err != nil { - return err - } - } - return nil - } - return scope.Invoke(provide) -} - -func (m *module) Apply(c container) error { - scope := c.Scope(m.id) - - // Provide ModuleID and FullModuleID in the module's scope. - if err := scope.Provide(m.moduleID); err != nil { - return err - } - if err := scope.Decorate(m.fullModuleID); err != nil { - return err - } - - if err := scope.Decorate(m.lifecycle); err != nil { - return err - } - - if err := scope.Decorate(m.logger); err != nil { - return err - } - - if err := m.moduleDecorators(scope); err != nil { - return err - } - - if err := m.modulePrivateProviders(scope); err != nil { - return err - } - - for _, cell := range m.cells { - if err := cell.Apply(scope); err != nil { - return err - } - } - return nil -} - -func (m *module) Info(c container) Info { - n := NewInfoNode("Ⓜ️ " + m.id + " (" + m.description + ")") - for _, cell := range m.cells { - n.Add(cell.Info(c)) - } - return n -} diff --git a/vendor/github.com/cilium/hive/cell/provide.go b/vendor/github.com/cilium/hive/cell/provide.go deleted file mode 100644 index ea3d58e19..000000000 --- a/vendor/github.com/cilium/hive/cell/provide.go +++ /dev/null @@ -1,118 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package cell - -import ( - "fmt" - "sort" - "strings" - "sync" - - "go.uber.org/dig" - - "github.com/cilium/hive/internal" -) - -// provider is a set of constructors -type provider struct { - ctors []any - infosMu sync.Mutex - infos []dig.ProvideInfo - export bool -} - -func (p *provider) Apply(c container) error { - // Since the same Provide cell may be used multiple times - // in different hives we use a mutex to protect it and we - // fill the provide info only the first time. - p.infosMu.Lock() - defer p.infosMu.Unlock() - - fillInfo := false - if p.infos == nil { - p.infos = make([]dig.ProvideInfo, len(p.ctors)) - fillInfo = true - } - - for i, ctor := range p.ctors { - opts := []dig.ProvideOption{dig.Export(p.export)} - if fillInfo { - opts = append(opts, dig.FillProvideInfo(&p.infos[i])) - } - if err := c.Provide(ctor, opts...); err != nil { - return err - } - } - return nil -} - -func (p *provider) Info(container) Info { - p.infosMu.Lock() - defer p.infosMu.Unlock() - - n := &InfoNode{} - for i, ctor := range p.ctors { - info := p.infos[i] - privateSymbol := "" - if !p.export { - privateSymbol = "🔒️" - } - - ctorNode := NewInfoNode(fmt.Sprintf("🚧%s %s", privateSymbol, internal.FuncNameAndLocation(ctor))) - ctorNode.condensed = true - - var ins, outs []string - for _, input := range info.Inputs { - ins = append(ins, input.String()) - } - sort.Strings(ins) - for _, output := range info.Outputs { - outs = append(outs, output.String()) - } - sort.Strings(outs) - if len(ins) > 0 { - ctorNode.AddLeaf("⇨ %s", strings.Join(ins, ", ")) - } - ctorNode.AddLeaf("⇦ %s", strings.Join(outs, ", ")) - n.Add(ctorNode) - } - return n -} - -// Provide constructs a new cell with the given constructors. -// Constructor is any function that takes zero or more parameters and returns -// one or more values and optionally an error. For example, the following forms -// are accepted: -// -// func() A -// func(A, B, C) (D, error). -// -// If the constructor depends on a type that is not provided by any constructor -// the hive will fail to run with an error pointing at the missing type. -// -// A constructor can also take as parameter a structure of parameters annotated -// with `cell.In`, or return a struct annotated with `cell.Out`: -// -// type params struct { -// cell.In -// Flower *Flower -// Sun *Sun -// } -// -// type out struct { -// cell.Out -// Honey *Honey -// Nectar *Nectar -// } -// -// func newBee(params) (out, error) -func Provide(ctors ...any) Cell { - return &provider{ctors: ctors, export: true} -} - -// ProvidePrivate is like Provide, but the constructed objects are only -// available within the module it is defined and nested modules. -func ProvidePrivate(ctors ...any) Cell { - return &provider{ctors: ctors, export: false} -} diff --git a/vendor/github.com/cilium/hive/cell/simple_health.go b/vendor/github.com/cilium/hive/cell/simple_health.go deleted file mode 100644 index 49806c154..000000000 --- a/vendor/github.com/cilium/hive/cell/simple_health.go +++ /dev/null @@ -1,92 +0,0 @@ -package cell - -import ( - "sync" -) - -type simpleHealthRoot struct { - sync.Mutex - all map[string]*SimpleHealth -} - -type SimpleHealth struct { - *simpleHealthRoot - - Scope string - Level Level - Status string - Error error -} - -// NewScope implements cell.Health. -func (h *SimpleHealth) NewScope(name string) Health { - h.Lock() - defer h.Unlock() - - h2 := &SimpleHealth{ - simpleHealthRoot: h.simpleHealthRoot, - Scope: h.Scope + "." + name, - } - h.all[name] = h2 - return h2 -} - -func (h *SimpleHealth) GetChild(fullName string) *SimpleHealth { - h.Lock() - defer h.Unlock() - - if child, ok := h.all[fullName]; ok { - return child - } - return nil -} - -// Degraded implements cell.Health. -func (h *SimpleHealth) Degraded(reason string, err error) { - h.Lock() - defer h.Unlock() - - h.Level = StatusDegraded - h.Status = reason - h.Error = err -} - -// OK implements cell.Health. -func (h *SimpleHealth) OK(status string) { - h.Lock() - defer h.Unlock() - - h.Level = StatusOK - h.Status = status - h.Error = nil -} - -// Stopped implements cell.Health. -func (h *SimpleHealth) Stopped(reason string) { - h.Lock() - defer h.Unlock() - - h.Level = StatusStopped - h.Status = reason - h.Error = nil -} - -func (h *SimpleHealth) Close() { - h.Lock() - defer h.Unlock() - - delete(h.all, h.Scope) -} - -func NewSimpleHealth() (Health, *SimpleHealth) { - h := &SimpleHealth{ - simpleHealthRoot: &simpleHealthRoot{ - all: make(map[string]*SimpleHealth), - }, - } - return h, h -} - -var _ Health = &SimpleHealth{} - -var SimpleHealthCell = Provide(NewSimpleHealth) diff --git a/vendor/github.com/cilium/hive/command.go b/vendor/github.com/cilium/hive/command.go deleted file mode 100644 index 62ec26724..000000000 --- a/vendor/github.com/cilium/hive/command.go +++ /dev/null @@ -1,34 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package hive - -import ( - "github.com/spf13/cobra" -) - -// Command constructs the cobra command for hive. The hive -// command can be used to inspect the dependency graph. -func (h *Hive) Command() *cobra.Command { - cmd := &cobra.Command{ - Use: "hive", - Short: "Inspect the hive", - Run: func(cmd *cobra.Command, args []string) { - h.PrintObjects() - }, - TraverseChildren: false, - } - h.RegisterFlags(cmd.PersistentFlags()) - - cmd.AddCommand( - &cobra.Command{ - Use: "dot-graph", - Short: "Output the dependencies graph in graphviz dot format", - Run: func(cmd *cobra.Command, args []string) { - h.PrintDotGraph() - }, - TraverseChildren: false, - }) - - return cmd -} diff --git a/vendor/github.com/cilium/hive/doc.go b/vendor/github.com/cilium/hive/doc.go deleted file mode 100644 index c10f95e7c..000000000 --- a/vendor/github.com/cilium/hive/doc.go +++ /dev/null @@ -1,31 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -/* -Package hive provides the infrastructure for building Cilium applications from modular components (cells). - -Hive is implemented using the uber/dig library, which provides the dependency injection for -objects in the hive. It is similar to uber/fx, but adds an opinionated approach to configuration. - -The configuration for cells is extracted from Viper. By default the field names are assumed to correspond -to flag names, e.g. field 'MyOption' corresponds to '--my-option' flag. - -The hive constructor, New(), takes the viper instance and the pflag FlagSet as parameters and registers -the flags from all cells and binds them to viper variables. Once the FlagSet and viper configuration has been -parsed one can call Populate() to pull the values from viper and construct the application. The hive can -then be Run(). - -# Example - -For a runnable example see pkg/hive/example. - -Try running: - - example$ go run . - (ctrl-c stops) - - example$ go run . --dot-graph | dot -Tx11 - -Try also commenting out cell.Provide lines and seeing what the dependency errors look like. -*/ -package hive diff --git a/vendor/github.com/cilium/hive/hive.go b/vendor/github.com/cilium/hive/hive.go deleted file mode 100644 index 2cf6dddd0..000000000 --- a/vendor/github.com/cilium/hive/hive.go +++ /dev/null @@ -1,423 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package hive - -import ( - "context" - "errors" - "fmt" - "log/slog" - "os" - "os/signal" - "reflect" - "strings" - "syscall" - "time" - - "github.com/spf13/pflag" - "github.com/spf13/viper" - "go.uber.org/dig" - - "github.com/cilium/hive/cell" -) - -type Options struct { - // EnvPrefix is the prefix to use for environment variables, e.g. - // with prefix "CILIUM" the flag "foo" can be set with environment - // variable "CILIUM_FOO". - EnvPrefix string - - // ModuleDecorator is an optional set of decorator functions to use for each - // module. This can be used to provide module-scoped overrides to objects. - // For example: - // - // opts.ModuleDecorators = cell.ModuleDecorators{ - // func(foo Foo, id cell.ModuleID) Foo { - // return foo.With("moduleID", id) - // }, - // } - // - // The above would give each cell within a module an augmented version of 'Foo'. - // The object that is being decorated (the return value) must already exist in - // the object graph. - ModuleDecorators cell.ModuleDecorators - - // ModulePrivateProvider is an optional set of private provide functions to - // use for each module. This can be used to provide module-scoped objects. - // For example: - // - // opts.ModulePrivateProviders = cell.ModulePrivateProviders{ - // func(id cell.ModuleID) Foo { - // return foo.New(id) - // }, - // } - // - ModulePrivateProviders cell.ModulePrivateProviders - - // DecodeHooks are optional additional decode hooks to use with cell.Config - // to decode a configuration flag into a config field. See existing hooks - // in [cell/config.go] for examples. - DecodeHooks cell.DecodeHooks - - StartTimeout time.Duration - StopTimeout time.Duration - - // LogThreshold is an optional threshold to reduce logging verbosity. - // When an Invoke or Lifecycle Start/Stop hook takes longer than this - // threshold, it will be logged at Info level. Otherwise it is logged - // at Debug level. - LogThreshold time.Duration -} - -func DefaultOptions() Options { - return Options{ - EnvPrefix: "", - ModuleDecorators: nil, - StartTimeout: defaultStartTimeout, - StopTimeout: defaultStopTimeout, - LogThreshold: defaultLogThreshold, - } -} - -const ( - // defaultStartTimeout is the amount of time allotted for start hooks. After - // this duration the context passed to the start hooks is cancelled. - defaultStartTimeout = 5 * time.Minute - - // defaultStopTimeout is the amount of time allotted for stop hooks. - defaultStopTimeout = time.Minute - - defaultLogThreshold = time.Duration(0) -) - -// Hive is a framework building modular applications. -// -// It implements dependency injection using the dig library. -// -// See pkg/hive/example for a runnable example application. -type Hive struct { - opts Options - container *dig.Container - cells []cell.Cell - shutdown chan error - flags *pflag.FlagSet - viper *viper.Viper - lifecycle cell.Lifecycle - populated bool - invokes []func(*slog.Logger, time.Duration) error - configOverrides []any -} - -// New returns a new hive that can be run, or inspected. -// The command-line flags from the cells are registered as part of this. -// -// The object graph is not constructed until methods of the hive are -// invoked. -// -// Applications should call RegisterFlags() to register the hive's command-line -// flags. Likewise if configuration settings come from configuration files, then -// the Viper() method can be used to populate the hive's viper instance. -func New(cells ...cell.Cell) *Hive { - return NewWithOptions(DefaultOptions(), cells...) -} - -func NewWithOptions(opts Options, cells ...cell.Cell) *Hive { - h := &Hive{ - opts: opts, - container: dig.New(), - cells: cells, - viper: viper.New(), - flags: pflag.NewFlagSet("", pflag.ContinueOnError), - lifecycle: &cell.DefaultLifecycle{ - LogThreshold: opts.LogThreshold, - }, - shutdown: make(chan error, 1), - configOverrides: nil, - } - - if err := h.provideDefaults(); err != nil { - panic(fmt.Sprintf("Failed to provide defaults: %s", err)) - } - - // Apply all cells to the container. This registers all constructors - // and adds all config flags. Invokes are delayed until Start() is - // called. - for _, cell := range cells { - if err := cell.Apply(h.container); err != nil { - panic(fmt.Sprintf("Failed to apply cell: %s", err)) - } - } - - // Bind the newly registered flags to viper. - h.flags.VisitAll(func(f *pflag.Flag) { - if err := h.viper.BindPFlag(f.Name, f); err != nil { - panic(fmt.Sprintf("BindPFlag: %s", err)) - } - if err := h.viper.BindEnv(f.Name, h.getEnvName(f.Name)); err != nil { - panic(fmt.Sprintf("BindEnv: %s", err)) - } - }) - - return h -} - -// RegisterFlags adds all flags in the hive to the given flag set. -// Fatals if a flag already exists in the given flag set. -// Use with e.g. cobra.Command: -// -// cmd := &cobra.Command{...} -// h.RegisterFlags(cmd.Flags()) -func (h *Hive) RegisterFlags(flags *pflag.FlagSet) { - h.flags.VisitAll(func(f *pflag.Flag) { - if flags.Lookup(f.Name) != nil { - panic(fmt.Sprintf("Error registering flag: '%s' already registered", f.Name)) - } - flags.AddFlag(f) - }) -} - -// Viper returns the hive's viper instance. -func (h *Hive) Viper() *viper.Viper { - return h.viper -} - -type defaults struct { - dig.Out - - Flags *pflag.FlagSet - Lifecycle cell.Lifecycle - Shutdowner Shutdowner - InvokerList cell.InvokerList - EmptyFullModuleID cell.FullModuleID - DecodeHooks cell.DecodeHooks - ModuleDecorators cell.ModuleDecorators - ModulePrivateProviders cell.ModulePrivateProviders -} - -func (h *Hive) provideDefaults() error { - - return h.container.Provide(func() defaults { - return defaults{ - Flags: h.flags, - Lifecycle: h.lifecycle, - Shutdowner: h, - InvokerList: h, - EmptyFullModuleID: nil, - DecodeHooks: h.opts.DecodeHooks, - ModuleDecorators: h.opts.ModuleDecorators, - ModulePrivateProviders: h.opts.ModulePrivateProviders, - } - }) -} - -// AddConfigOverride appends a config override function to modify -// a configuration after it has been parsed. -// -// This method is only meant to be used in tests. -func AddConfigOverride[Cfg cell.Flagger](h *Hive, override func(*Cfg)) { - h.configOverrides = append(h.configOverrides, override) -} - -// Run populates the cell configurations and runs the hive cells. -// Interrupt signal or call to Shutdowner.Shutdown() will cause the hive to stop. -func (h *Hive) Run(log *slog.Logger) error { - startCtx, cancel := context.WithTimeout(context.Background(), h.opts.StartTimeout) - defer cancel() - - var errs error - if err := h.Start(log, startCtx); err != nil { - errs = errors.Join(errs, fmt.Errorf("failed to start: %w", err)) - } - - // If start was successful, wait for Shutdown() or interrupt. - if errs == nil { - errs = errors.Join(errs, h.waitForSignalOrShutdown(log)) - } - - stopCtx, cancel := context.WithTimeout(context.Background(), h.opts.StopTimeout) - defer cancel() - - if err := h.Stop(log, stopCtx); err != nil { - errs = errors.Join(errs, fmt.Errorf("failed to stop: %w", err)) - } - return errs -} - -func (h *Hive) waitForSignalOrShutdown(log *slog.Logger) error { - signals := make(chan os.Signal, 1) - defer signal.Stop(signals) - signal.Notify(signals, os.Interrupt, syscall.SIGTERM) - select { - case sig := <-signals: - log.Info("Signal received", "signal", sig) - return nil - case err := <-h.shutdown: - return err - } -} - -// Populate instantiates the hive. Use for testing that the hive can -// be instantiated. -func (h *Hive) Populate(log *slog.Logger) error { - if h.populated { - return nil - } - h.populated = true - - // Provide all the parsed settings to the config cells. - err := h.container.Provide( - func() cell.AllSettings { - return cell.AllSettings(h.viper.AllSettings()) - }) - if err != nil { - return err - } - // Provide the user-provide logging infrastructure. This happens here so - // that the hive can be created prior to having to lock down the logging - // configuration. - err = h.container.Provide( - func() (*slog.Logger, cell.RootLogger) { - return log, cell.RootLogger(log) - }) - if err != nil { - return err - } - - // Provide config overriders if any - for _, o := range h.configOverrides { - v := reflect.ValueOf(o) - // Check that the config override is of type func(*cfg) and - // 'cfg' implements Flagger. - t := v.Type() - if t.Kind() != reflect.Func || t.NumIn() != 1 { - return fmt.Errorf("config override has invalid type %T, expected func(*T)", o) - } - flaggerType := reflect.TypeOf((*cell.Flagger)(nil)).Elem() - if !t.In(0).Implements(flaggerType) { - return fmt.Errorf("config override function parameter (%T) does not implement Flagger", o) - } - - // Construct the provider function: 'func() func(*cfg)'. This is - // picked up by the config cell and called to mutate the config - // after it has been parsed. - providerFunc := func(in []reflect.Value) []reflect.Value { - return []reflect.Value{v} - } - providerFuncType := reflect.FuncOf(nil, []reflect.Type{t}, false) - pfv := reflect.MakeFunc(providerFuncType, providerFunc) - if err := h.container.Provide(pfv.Interface()); err != nil { - return fmt.Errorf("providing config override failed: %w", err) - } - } - - // Execute the invoke functions to construct the objects. - for _, invoke := range h.invokes { - if err := invoke(log, h.opts.LogThreshold); err != nil { - return err - } - } - return nil -} - -func (h *Hive) AppendInvoke(invoke func(*slog.Logger, time.Duration) error) { - h.invokes = append(h.invokes, invoke) -} - -// Start starts the hive. The context allows cancelling the start. -// If context is cancelled and the start hooks do not respect the cancellation -// then after 5 more seconds the process will be terminated forcefully. -func (h *Hive) Start(log *slog.Logger, ctx context.Context) error { - if err := h.Populate(log); err != nil { - return err - } - - defer close(h.fatalOnTimeout(ctx)) - - log.Info("Starting") - start := time.Now() - err := h.lifecycle.Start(log, ctx) - if err == nil { - log.Info("Started", "duration", time.Since(start)) - } else { - log.Error("Start failed", "error", err, "duration", time.Since(start)) - } - return err -} - -// Stop stops the hive. The context allows cancelling the stop. -// If context is cancelled and the stop hooks do not respect the cancellation -// then after 5 more seconds the process will be terminated forcefully. -func (h *Hive) Stop(log *slog.Logger, ctx context.Context) error { - defer close(h.fatalOnTimeout(ctx)) - log.Info("Stopping") - return h.lifecycle.Stop(log, ctx) -} - -func (h *Hive) fatalOnTimeout(ctx context.Context) chan struct{} { - terminated := make(chan struct{}, 1) - go func() { - select { - case <-terminated: - // Start/stop terminated in time, nothing to do. - return - - case <-ctx.Done(): - } - - // Context was cancelled. Give 5 more seconds and then - // go fatal. - select { - case <-terminated: - case <-time.After(5 * time.Second): - panic("Start or stop failed to finish on time, aborting forcefully.") - } - }() - return terminated -} - -// Shutdown implements the Shutdowner interface and is provided -// for the cells to use for triggering a early shutdown. -func (h *Hive) Shutdown(opts ...ShutdownOption) { - var o shutdownOptions - for _, opt := range opts { - opt.apply(&o) - } - - // If there already is an error in the channel, no-op - select { - case h.shutdown <- o.err: - default: - } -} - -func (h *Hive) PrintObjects() { - if err := h.Populate(slog.Default()); err != nil { - panic(fmt.Sprintf("Failed to populate object graph: %s", err)) - } - - fmt.Printf("Cells:\n\n") - ip := cell.NewInfoPrinter() - for _, c := range h.cells { - c.Info(h.container).Print(2, ip) - fmt.Println() - } - h.lifecycle.PrintHooks() -} - -func (h *Hive) PrintDotGraph() { - if err := h.Populate(slog.Default()); err != nil { - panic(fmt.Sprintf("Failed to populate object graph: %s", err)) - } - - if err := dig.Visualize(h.container, os.Stdout); err != nil { - panic(fmt.Sprintf("Failed to dig.Visualize(): %s", err)) - } -} - -// getEnvName returns the environment variable to be used for the given option name. -func (h *Hive) getEnvName(option string) string { - under := strings.Replace(option, "-", "_", -1) - upper := strings.ToUpper(under) - return h.opts.EnvPrefix + upper -} diff --git a/vendor/github.com/cilium/hive/internal/map_string.go b/vendor/github.com/cilium/hive/internal/map_string.go deleted file mode 100644 index b2fefa11e..000000000 --- a/vendor/github.com/cilium/hive/internal/map_string.go +++ /dev/null @@ -1,138 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package internal - -import ( - "encoding/json" - "errors" - "fmt" - "regexp" - "strings" - "unicode" - - "github.com/spf13/cast" - "github.com/spf13/viper" -) - -const ( - comma = ',' - equal = '=' -) - -var keyValueRegex = regexp.MustCompile(`([\w-:;./@]+=([\w-:;,./@][\w-:;,./@ ]*[\w-:;,./@])?[\w-:;,./@]*,)*([\w-:;./@]+=([\w-:;,./@][\w-:;,./@ ]*)?[\w-:;./@]+)$`) - -// GetStringMapString contains one enhancement to support k1=v2,k2=v2 compared to original -// implementation of GetStringMapString function -// Related upstream issue https://github.com/spf13/viper/issues/911 -func GetStringMapString(vp *viper.Viper, key string) map[string]string { - v, _ := GetStringMapStringE(vp, key) - return v -} - -// GetStringMapStringE is same as GetStringMapString, but with error -func GetStringMapStringE(vp *viper.Viper, key string) (map[string]string, error) { - return ToStringMapStringE(vp.Get(key)) -} - -// ToStringMapStringE casts an interface to a map[string]string type. The underlying -// interface type might be a map or string. In the latter case, it is attempted to be -// json decoded, falling back to the k1=v2,k2=v2 format in case it doesn't look like json. -func ToStringMapStringE(data interface{}) (map[string]string, error) { - if data == nil { - return map[string]string{}, nil - } - - v, err := cast.ToStringMapStringE(data) - if err != nil { - var syntaxErr *json.SyntaxError - if !errors.As(err, &syntaxErr) { - return v, err - } - - switch s := data.(type) { - case string: - if len(s) == 0 { - return map[string]string{}, nil - } - - // if the input is starting with either '{' or '[', just preserve original json parsing error. - firstIndex := strings.IndexFunc(s, func(r rune) bool { - return !unicode.IsSpace(r) - }) - if firstIndex != -1 && (s[firstIndex] == '{' || s[firstIndex] == '[') { - return v, err - } - - if !isValidKeyValuePair(s) { - return map[string]string{}, fmt.Errorf("'%s' is not formatted as key=value,key1=value1", s) - } - - var v = map[string]string{} - kvs := splitKeyValue(s, comma, equal) - for _, kv := range kvs { - temp := strings.Split(kv, string(equal)) - if len(temp) != 2 { - return map[string]string{}, fmt.Errorf("'%s' in '%s' is not formatted as key=value,key1=value1", kv, s) - } - v[temp[0]] = temp[1] - } - return v, nil - } - } - return v, nil -} - -// isValidKeyValuePair returns true if the input is following key1=value1,key2=value2,...,keyN=valueN format. -func isValidKeyValuePair(str string) bool { - if len(str) == 0 { - return true - } - return len(keyValueRegex.ReplaceAllString(str, "")) == 0 -} - -// splitKeyValue is similar to strings.Split, but looks ahead to make sure -// that sep character is allowed in value component of key-value pair. -// -// Example: with the input "c6a.2xlarge=4,15,15,m4.xlarge=2,4,8", -// - strings.Split function will return []string{"c6a.2xlarge=4", "15", "15", "m4.xlarge=2", "4", "8"}. -// - splitKeyValue function will return []string{"c6a.2xlarge=4,15,15", "m4.xlarge=2,4,8"} instead. -func splitKeyValue(str string, sep rune, keyValueSep rune) []string { - var sepIndexes, kvValueSepIndexes []int - // find all indexes of separator character - for i := 0; i < len(str); i++ { - switch int32(str[i]) { - case sep: - sepIndexes = append(sepIndexes, i) - case keyValueSep: - kvValueSepIndexes = append(kvValueSepIndexes, i) - } - } - - // there's only a single key-value if there are no separators ("key=value") - // or a single key-value separator ("key=option1:value1,option2:value2") - if len(sepIndexes) == 0 || len(kvValueSepIndexes) == 1 { - return []string{str} - } - - if len(sepIndexes) == 1 { - index := sepIndexes[0] - return []string{str[:index], str[index+1:]} - } - - var res []string - var start = 0 - for i := 0; i < len(sepIndexes); i++ { - last := len(str) - if i < len(sepIndexes)-1 { - last = sepIndexes[i+1] - } - if strings.ContainsRune(str[sepIndexes[i]:last], keyValueSep) { - res = append(res, str[start:sepIndexes[i]]) - start = sepIndexes[i] + 1 - } - } - // append the remaining for last sep index - res = append(res, str[start:]) - return res -} diff --git a/vendor/github.com/cilium/hive/internal/reflect.go b/vendor/github.com/cilium/hive/internal/reflect.go deleted file mode 100644 index 867810da5..000000000 --- a/vendor/github.com/cilium/hive/internal/reflect.go +++ /dev/null @@ -1,58 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package internal - -import ( - "fmt" - "os" - "path/filepath" - "reflect" - "runtime" - "strings" -) - -func PrettyType(x any) string { - return fmt.Sprintf("%T", x) -} - -func FuncNameAndLocation(fn any) string { - f := runtime.FuncForPC(reflect.ValueOf(fn).Pointer()) - file, line := f.FileLine(f.Entry()) - name := f.Name() - name = strings.TrimSuffix(name, "-fm") - // Truncate the path in name as it'll be repeated in file path - if idx := strings.LastIndex(name, "/"); idx > 0 { - name = name[idx+1:] - } - if file != "" { - return fmt.Sprintf("%s (%s:%d)", name, usefulPathSegment(file), line) - } - return name -} - -// Purely a heuristic. -var commonRoots = map[string]struct{}{ - "pkg": {}, - "cmd": {}, -} - -func usefulPathSegment(file string) string { - p := filepath.Clean(file) - segs := strings.Split(p, string(os.PathSeparator)) - - for i := len(segs) - 1; i > 0; i-- { - if _, ok := commonRoots[segs[i]]; ok { - segs = segs[i:] - break - } - } - - // Truncate to at most 3 segments - if len(segs) > 3 { - segs = segs[len(segs)-4:] - segs[0] = "..." - } - - return filepath.Join(segs...) -} diff --git a/vendor/github.com/cilium/hive/job/job.go b/vendor/github.com/cilium/hive/job/job.go deleted file mode 100644 index 2f146053a..000000000 --- a/vendor/github.com/cilium/hive/job/job.go +++ /dev/null @@ -1,231 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package job - -import ( - "context" - "log/slog" - "runtime/pprof" - "sync" - - "github.com/cilium/hive" - "github.com/cilium/hive/cell" -) - -// Cell provides job.Registry which constructs job.Group's. Job groups automate a lot of the logic involved with -// lifecycle management of goroutines within a Hive Cell. Providing a context that is canceled on shutdown and making -// sure multiple goroutines properly shutdown takes a lot of boilerplate. Job groups make it easy to queue, spawn, and -// collect jobs with minimal boilerplate. The registry maintains references to all groups which will allow us to add -// automatic metrics collection and/or status reporting in the future. -var Cell = cell.Module( - "jobs", - "Managed background goroutines and timers", - cell.Provide( - newRegistry, - ), -) - -// A Registry creates Groups, it maintains references to these groups for the purposes of collecting information -// centralized like metrics. -type Registry interface { - // NewGroup creates a new group of jobs which can be started and stopped together as part of the cells lifecycle. - // The provided scope is used to report health status of the jobs. A `cell.Scope` can be obtained via injection - // an object with the correct scope is provided by the closest `cell.Module`. - NewGroup(health cell.Health, opts ...groupOpt) Group -} - -type registry struct { - logger *slog.Logger - shutdowner hive.Shutdowner - - mu sync.Mutex - groups []Group -} - -func newRegistry( - logger *slog.Logger, - shutdowner hive.Shutdowner, -) Registry { - return ®istry{ - logger: logger, - shutdowner: shutdowner, - } -} - -// NewGroup creates a new Group with the given `opts` options, which allows you to customize the behavior for the -// group as a whole. For example by allowing you to add pprof labels to the group or by customizing the logger. -func (c *registry) NewGroup(health cell.Health, opts ...groupOpt) Group { - c.mu.Lock() - defer c.mu.Unlock() - - var options options - options.logger = c.logger - options.shutdowner = c.shutdowner - - for _, opt := range opts { - opt(&options) - } - - g := &group{ - options: options, - wg: &sync.WaitGroup{}, - health: health, - } - - c.groups = append(c.groups, g) - - return g -} - -// Group aims to streamline the management of work within a cell. Group implements cell.HookInterface and takes care -// of proper start and stop behavior as expected by hive. A group allows you to add multiple types of jobs which -// different kinds of logic. No matter the job type, the function provided to is always called with a context which -// is bound to the lifecycle of the cell. -type Group interface { - // Add append the job. If the group has not yet been started the job is queued, otherwise it is started - // immediately. - Add(...Job) - - // Scoped creates a scoped group, jobs added to this scoped group will appear as a sub-scope in the health reporter - Scoped(name string) ScopedGroup - - // HookInterface is implemented to Start and Stop the jobs in the group. - cell.HookInterface -} - -// Job in an interface that describes a unit of work which can be added to a Group. This interface contains unexported -// methods and thus can only be implemented by functions in this package such as OneShot, Timer, or Observer. -type Job interface { - start(ctx context.Context, wg *sync.WaitGroup, health cell.Health, options options) -} - -type group struct { - options options - - wg *sync.WaitGroup - - mu sync.Mutex - ctx context.Context - cancel context.CancelFunc - queuedJobs []Job - - health cell.Health -} - -type options struct { - pprofLabels pprof.LabelSet - logger *slog.Logger - shutdowner hive.Shutdowner - metrics Metrics -} - -type groupOpt func(o *options) - -// WithLogger replaces the default logger with the given logger, useful if you want to add certain fields to the logs -// created by the group/jobs. -func WithLogger(logger *slog.Logger) groupOpt { - return func(o *options) { - o.logger = logger - } -} - -// WithPprofLabels adds pprof labels which will be added to the goroutines spawned for the jobs and thus included in -// the pprof profiles. -func WithPprofLabels(pprofLabels pprof.LabelSet) groupOpt { - return func(o *options) { - o.pprofLabels = pprofLabels - } -} - -func WithMetrics(metrics Metrics) groupOpt { - return func(o *options) { - o.metrics = metrics - } -} - -var _ cell.HookInterface = (*group)(nil) - -// Start implements the cell.HookInterface interface -func (jg *group) Start(_ cell.HookContext) error { - jg.mu.Lock() - defer jg.mu.Unlock() - - jg.ctx, jg.cancel = context.WithCancel(context.Background()) - - jg.wg.Add(len(jg.queuedJobs)) - for _, job := range jg.queuedJobs { - pprof.Do(jg.ctx, jg.options.pprofLabels, func(ctx context.Context) { - go job.start(ctx, jg.wg, jg.health, jg.options) - }) - } - // Nil the queue once we start so it can be GC'ed - jg.queuedJobs = nil - - return nil -} - -// Stop implements the cell.HookInterface interface -func (jg *group) Stop(stopCtx cell.HookContext) error { - jg.mu.Lock() - defer jg.mu.Unlock() - - done := make(chan struct{}) - go func() { - jg.wg.Wait() - close(done) - }() - - jg.cancel() - - select { - case <-stopCtx.Done(): - jg.options.logger.Error("Stop hook context expired before job group was done") - case <-done: - } - - return nil -} - -func (jg *group) Add(jobs ...Job) { - jg.add(jg.health, jobs...) -} - -func (jg *group) add(health cell.Health, jobs ...Job) { - jg.mu.Lock() - defer jg.mu.Unlock() - - // The context is only set once the group has been started. If we have not yet started, queue the jobs. - if jg.ctx == nil { - jg.queuedJobs = append(jg.queuedJobs, jobs...) - return - } - - for _, j := range jobs { - jg.wg.Add(1) - pprof.Do(jg.ctx, jg.options.pprofLabels, func(ctx context.Context) { - go j.start(ctx, jg.wg, health, jg.options) - }) - } -} - -// Scoped creates a scoped group, jobs added to this scoped group will appear as a sub-scope in the health reporter -func (jg *group) Scoped(name string) ScopedGroup { - return &scopedGroup{ - group: jg, - health: jg.health.NewScope(name), - } -} - -type ScopedGroup interface { - Add(jobs ...Job) -} - -type scopedGroup struct { - group *group - health cell.Health -} - -func (sg *scopedGroup) Add(jobs ...Job) { - sg.group.add(sg.health, jobs...) -} diff --git a/vendor/github.com/cilium/hive/job/metrics.go b/vendor/github.com/cilium/hive/job/metrics.go deleted file mode 100644 index ebd3fe68f..000000000 --- a/vendor/github.com/cilium/hive/job/metrics.go +++ /dev/null @@ -1,30 +0,0 @@ -package job - -import "time" - -type Metrics interface { - JobError(name string, err error) - OneShotRunDuration(name string, duration time.Duration) - TimerRunDuration(name string, duration time.Duration) - ObserverRunDuration(name string, duration time.Duration) -} - -type NopMetrics struct{} - -// JobError implements Metrics. -func (NopMetrics) JobError(name string, err error) { -} - -// ObserverRunDuration implements Metrics. -func (NopMetrics) ObserverRunDuration(name string, duration time.Duration) { -} - -// OneShotRunDuration implements Metrics. -func (NopMetrics) OneShotRunDuration(name string, duration time.Duration) { -} - -// TimerRunDuration implements Metrics. -func (NopMetrics) TimerRunDuration(name string, duration time.Duration) { -} - -var _ Metrics = NopMetrics{} diff --git a/vendor/github.com/cilium/hive/job/observer.go b/vendor/github.com/cilium/hive/job/observer.go deleted file mode 100644 index ada2679c3..000000000 --- a/vendor/github.com/cilium/hive/job/observer.go +++ /dev/null @@ -1,129 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package job - -import ( - "context" - "errors" - "strconv" - "sync" - "time" - - "github.com/cilium/hive" - "github.com/cilium/hive/cell" - "github.com/cilium/hive/internal" - "github.com/cilium/stream" -) - -// AddObserver adds an observer job to the group. Observer jobs invoke the given `fn` for each item observed on -// `observable`. If the `observable` completes, the job stops. The context given to the observable is also canceled -// once the group stops. -func Observer[T any](name string, fn ObserverFunc[T], observable stream.Observable[T], opts ...observerOpt[T]) Job { - if fn == nil { - panic("`fn` must not be nil") - } - - job := &jobObserver[T]{ - name: name, - fn: fn, - observable: observable, - opts: opts, - } - - return job -} - -// ObserverFunc is the func type invoked by observer jobs. -// A ObserverFunc is expected to return as soon as ctx is canceled. -type ObserverFunc[T any] func(ctx context.Context, event T) error - -type observerOpt[T any] func(*jobObserver[T]) - -type jobObserver[T any] struct { - name string - fn ObserverFunc[T] - opts []observerOpt[T] - - health cell.Health - - observable stream.Observable[T] - - // If not nil, call the shutdowner on error - shutdown hive.Shutdowner -} - -func (jo *jobObserver[T]) start(ctx context.Context, wg *sync.WaitGroup, health cell.Health, options options) { - defer wg.Done() - - for _, opt := range jo.opts { - opt(jo) - } - - jo.health = health.NewScope("observer-job-" + jo.name) - reportTicker := time.NewTicker(10 * time.Second) - defer reportTicker.Stop() - - l := options.logger.With( - "name", jo.name, - "func", internal.FuncNameAndLocation(jo.fn)) - - l.Debug("Observer job started") - jo.health.OK("Primed") - var msgCount uint64 - - done := make(chan struct{}) - - var ( - err error - ) - jo.observable.Observe(ctx, func(t T) { - start := time.Now() - err := jo.fn(ctx, t) - duration := time.Since(start) - - if options.metrics != nil { - options.metrics.ObserverRunDuration(jo.name, duration) - } - - if err != nil { - if errors.Is(err, context.Canceled) { - return - } - - jo.health.Degraded("observer job errored", err) - l.Error("Observer job errored", "error", err) - - if options.metrics != nil { - options.metrics.JobError(jo.name, err) - } - if jo.shutdown != nil { - jo.shutdown.Shutdown(hive.ShutdownWithError( - err, - )) - } - return - } - - msgCount++ - - // Don't report health for every event, only when we have not done so for a bit - select { - case <-reportTicker.C: - jo.health.OK("OK (" + duration.String() + ") [" + strconv.FormatUint(msgCount, 10) + "]") - default: - } - }, func(e error) { - err = e - close(done) - }) - - <-done - - jo.health.Stopped("observer job done") - if err != nil { - l.Error("Observer job stopped with an error", "error", err) - } else { - l.Debug("Observer job stopped") - } -} diff --git a/vendor/github.com/cilium/hive/job/oneshot.go b/vendor/github.com/cilium/hive/job/oneshot.go deleted file mode 100644 index fdc2099c3..000000000 --- a/vendor/github.com/cilium/hive/job/oneshot.go +++ /dev/null @@ -1,157 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package job - -import ( - "context" - "errors" - "sync" - "time" - - "github.com/cilium/hive" - "github.com/cilium/hive/cell" - "github.com/cilium/hive/internal" -) - -// OneShot creates a "one shot" job which can be added to a Group. The function passed to a one shot job is invoked -// once at startup. It can live for the entire lifetime of the group or exit early depending on its task. -// If it returns an error, it can optionally be retried if the WithRetry option. If retries are not configured or -// all retries failed as well, a shutdown of the hive can be triggered by specifying the WithShutdown option. -// -// The given function is expected to exit as soon as the context given to it expires, this is especially important for -// blocking or long running jobs. -func OneShot(name string, fn OneShotFunc, opts ...jobOneShotOpt) Job { - if fn == nil { - panic("`fn` must not be nil") - } - - job := &jobOneShot{ - name: name, - fn: fn, - opts: opts, - } - - return job -} - -type jobOneShotOpt func(*jobOneShot) - -type RetryBackoff interface { - Wait() time.Duration -} - -type ConstantBackoff time.Duration - -func (d ConstantBackoff) Wait() time.Duration { - return time.Duration(d) -} - -type ExponentialBackoff struct { - Min time.Duration - Max time.Duration - current time.Duration -} - -func (e *ExponentialBackoff) Wait() time.Duration { - if e.current == 0 { - e.current = e.Min - } else { - e.current *= 2 - if e.current > e.Max { - e.current = e.Max - } - } - return e.current -} - -// WithRetry option configures a one shot job to retry `times` amount of times. On each retry attempt the -// rate limiter is waited upon before making another attempt. -// If `times` is <0, then the job is retried forever. -func WithRetry(times int, backoff RetryBackoff) jobOneShotOpt { - return func(jos *jobOneShot) { - jos.retry = times - jos.backoff = backoff - } -} - -// WithShutdown option configures a one shot job to shutdown the whole hive if the job returns an error. If the -// WithRetry option is also configured, all retries must be exhausted before we trigger the shutdown. -func WithShutdown() jobOneShotOpt { - return func(jos *jobOneShot) { - jos.shutdownOnError = true - } -} - -// OneShotFunc is the function type which is invoked by a one shot job. The given function is expected to exit as soon -// as the context given to it expires, this is especially important for blocking or long running jobs. -type OneShotFunc func(ctx context.Context, health cell.Health) error - -type jobOneShot struct { - name string - fn OneShotFunc - opts []jobOneShotOpt - - health cell.Health - - // If retry > 0, retry on error x times. - retry int - backoff RetryBackoff - shutdownOnError bool -} - -func (jos *jobOneShot) start(ctx context.Context, wg *sync.WaitGroup, health cell.Health, options options) { - defer wg.Done() - - for _, opt := range jos.opts { - opt(jos) - } - - jos.health = health.NewScope("job-" + jos.name) - defer jos.health.Stopped("one-shot job done") - - l := options.logger.With( - "name", jos.name, - "func", internal.FuncNameAndLocation(jos.fn)) - - var err error - for i := 0; jos.retry < 0 || i <= jos.retry; i++ { - if i != 0 { - timeout := jos.backoff.Wait() - options.logger.Debug("Delaying retry attempt", - "backoff", timeout, - "retry-count", i, - ) - select { - case <-ctx.Done(): - return - case <-time.After(timeout): - } - } - - l.Debug("Starting one-shot job") - - jos.health.OK("Running") - start := time.Now() - err = jos.fn(ctx, jos.health) - - if options.metrics != nil { - duration := time.Since(start) - options.metrics.OneShotRunDuration(jos.name, duration) - } - - if err == nil { - return - } else if !errors.Is(err, context.Canceled) { - jos.health.Degraded("one-shot job errored", err) - l.Error("one-shot job errored", "error", err) - if options.metrics != nil { - options.metrics.JobError(jos.name, err) - } - } - } - - if options.shutdowner != nil && jos.shutdownOnError { - options.shutdowner.Shutdown(hive.ShutdownWithError(err)) - } -} diff --git a/vendor/github.com/cilium/hive/job/timer.go b/vendor/github.com/cilium/hive/job/timer.go deleted file mode 100644 index cebed6c73..000000000 --- a/vendor/github.com/cilium/hive/job/timer.go +++ /dev/null @@ -1,159 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package job - -import ( - "context" - "errors" - "sync" - "time" - - "github.com/cilium/hive" - "github.com/cilium/hive/cell" - "github.com/cilium/hive/internal" -) - -// Timer creates a timer job which can be added to a Group. Timer jobs invoke the given function at the specified -// interval. Timer jobs are particularly useful to implement periodic syncs and cleanup actions. -// Timer jobs can optionally be triggered by an external Trigger with the WithTrigger option. -// This trigger can for example be passed between cells or between jobs in the same cell to allow for an additional -// invocation of the function. -// -// The interval between invocations is counted from the start of the last invocation. If the `fn` takes longer than the -// interval, its next invocation is not delayed. The `fn` is expected to stop as soon as the context passed to it -// expires. This is especially important for long running functions. The signal created by a Trigger is coalesced so -// multiple calls to trigger before the invocation takes place can result in just a single invocation. -func Timer(name string, fn TimerFunc, interval time.Duration, opts ...timerOpt) Job { - if fn == nil { - panic("`fn` must not be nil") - } - - job := &jobTimer{ - name: name, - fn: fn, - interval: interval, - opts: opts, - } - - return job -} - -// TimerFunc is the func type invoked by a timer job. A TimerFunc is expected to return as soon as the ctx expires. -type TimerFunc func(ctx context.Context) error - -type timerOpt func(*jobTimer) - -// Trigger which can be used to trigger a timer job, trigger events are coalesced. -type Trigger interface { - _trigger() - Trigger() -} - -// NewTrigger creates a new trigger, which can be used to trigger a timer job. -func NewTrigger() *trigger { - return &trigger{ - c: make(chan struct{}, 1), - } -} - -type trigger struct { - c chan struct{} -} - -func (t *trigger) _trigger() {} - -func (t *trigger) Trigger() { - select { - case t.c <- struct{}{}: - default: - } -} - -// WithTrigger option allows a user to specify a trigger, which if triggered will invoke the function of a timer -// before the configured interval has expired. -func WithTrigger(trig Trigger) timerOpt { - return func(jt *jobTimer) { - jt.trigger = trig.(*trigger) - } -} - -type jobTimer struct { - name string - fn TimerFunc - opts []timerOpt - - health cell.Health - - interval time.Duration - trigger *trigger - - // If not nil, call the shutdowner on error - shutdown hive.Shutdowner -} - -func (jt *jobTimer) start(ctx context.Context, wg *sync.WaitGroup, health cell.Health, options options) { - defer wg.Done() - - for _, opt := range jt.opts { - opt(jt) - } - - jt.health = health.NewScope("timer-job-" + jt.name) - - l := options.logger.With( - "name", jt.name, - "func", internal.FuncNameAndLocation(jt.fn)) - - timer := time.NewTicker(jt.interval) - defer timer.Stop() - - var triggerChan chan struct{} - if jt.trigger != nil { - triggerChan = jt.trigger.c - } - - l.Debug("Starting timer job") - jt.health.OK("Primed") - - for { - select { - case <-ctx.Done(): - jt.health.Stopped("timer job context done") - return - case <-timer.C: - case <-triggerChan: - } - - l.Debug("Timer job triggered") - - start := time.Now() - err := jt.fn(ctx) - duration := time.Since(start) - - if options.metrics != nil { - options.metrics.TimerRunDuration(jt.name, duration) - } - - if err == nil { - jt.health.OK("OK (" + duration.String() + ")") - l.Debug("Timer job finished") - } else if !errors.Is(err, context.Canceled) { - jt.health.Degraded("timer job errored", err) - l.Error("Timer job errored", "error", err) - - if options.metrics != nil { - options.metrics.JobError(jt.name, err) - } - if jt.shutdown != nil { - jt.shutdown.Shutdown(hive.ShutdownWithError(err)) - } - } - - // If we exited due to the ctx closing we do not guaranteed return. - // The select can pick the timer or trigger signals over ctx.Done due to fair scheduling, so this guarantees it. - if ctx.Err() != nil { - return - } - } -} diff --git a/vendor/github.com/cilium/hive/shutdowner.go b/vendor/github.com/cilium/hive/shutdowner.go deleted file mode 100644 index d53ddaf28..000000000 --- a/vendor/github.com/cilium/hive/shutdowner.go +++ /dev/null @@ -1,31 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package hive - -// Shutdowner provides Shutdown(), which is a way to trigger stop for hive. -// -// To shut down with an error, call Shutdown with ShutdownWithError(err). -// This error will be returned from Run(). -type Shutdowner interface { - Shutdown(...ShutdownOption) -} - -type ShutdownOption interface { - apply(*shutdownOptions) -} - -// ShutdownWithError shuts down with an error. -func ShutdownWithError(err error) ShutdownOption { - return optionFunc(func(opts *shutdownOptions) { - opts.err = err - }) -} - -type optionFunc func(*shutdownOptions) - -func (fn optionFunc) apply(opts *shutdownOptions) { fn(opts) } - -type shutdownOptions struct { - err error -} diff --git a/vendor/github.com/cilium/proxy/LICENSE b/vendor/github.com/cilium/proxy/LICENSE deleted file mode 100644 index a2e486a80..000000000 --- a/vendor/github.com/cilium/proxy/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - 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} Authors of Cilium - - 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. - diff --git a/vendor/github.com/cilium/proxy/go/cilium/api/accesslog.go b/vendor/github.com/cilium/proxy/go/cilium/api/accesslog.go deleted file mode 100644 index 89d60eec2..000000000 --- a/vendor/github.com/cilium/proxy/go/cilium/api/accesslog.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2020 Authors of Cilium -// -// 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 cilium - -// Add an exported type alias for L7 log entry oneof, so that the Go code does -// not need to know all the individual types -type IsLogEntry_L7 = isLogEntry_L7 diff --git a/vendor/github.com/cilium/proxy/go/cilium/api/accesslog.pb.go b/vendor/github.com/cilium/proxy/go/cilium/api/accesslog.pb.go deleted file mode 100644 index 54bbcdbba..000000000 --- a/vendor/github.com/cilium/proxy/go/cilium/api/accesslog.pb.go +++ /dev/null @@ -1,860 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: cilium/api/accesslog.proto - -package cilium - -import ( - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -type HttpProtocol int32 - -const ( - HttpProtocol_HTTP10 HttpProtocol = 0 - HttpProtocol_HTTP11 HttpProtocol = 1 - HttpProtocol_HTTP2 HttpProtocol = 2 -) - -// Enum value maps for HttpProtocol. -var ( - HttpProtocol_name = map[int32]string{ - 0: "HTTP10", - 1: "HTTP11", - 2: "HTTP2", - } - HttpProtocol_value = map[string]int32{ - "HTTP10": 0, - "HTTP11": 1, - "HTTP2": 2, - } -) - -func (x HttpProtocol) Enum() *HttpProtocol { - p := new(HttpProtocol) - *p = x - return p -} - -func (x HttpProtocol) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (HttpProtocol) Descriptor() protoreflect.EnumDescriptor { - return file_cilium_api_accesslog_proto_enumTypes[0].Descriptor() -} - -func (HttpProtocol) Type() protoreflect.EnumType { - return &file_cilium_api_accesslog_proto_enumTypes[0] -} - -func (x HttpProtocol) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use HttpProtocol.Descriptor instead. -func (HttpProtocol) EnumDescriptor() ([]byte, []int) { - return file_cilium_api_accesslog_proto_rawDescGZIP(), []int{0} -} - -type EntryType int32 - -const ( - EntryType_Request EntryType = 0 - EntryType_Response EntryType = 1 - EntryType_Denied EntryType = 2 -) - -// Enum value maps for EntryType. -var ( - EntryType_name = map[int32]string{ - 0: "Request", - 1: "Response", - 2: "Denied", - } - EntryType_value = map[string]int32{ - "Request": 0, - "Response": 1, - "Denied": 2, - } -) - -func (x EntryType) Enum() *EntryType { - p := new(EntryType) - *p = x - return p -} - -func (x EntryType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (EntryType) Descriptor() protoreflect.EnumDescriptor { - return file_cilium_api_accesslog_proto_enumTypes[1].Descriptor() -} - -func (EntryType) Type() protoreflect.EnumType { - return &file_cilium_api_accesslog_proto_enumTypes[1] -} - -func (x EntryType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use EntryType.Descriptor instead. -func (EntryType) EnumDescriptor() ([]byte, []int) { - return file_cilium_api_accesslog_proto_rawDescGZIP(), []int{1} -} - -type KeyValue struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *KeyValue) Reset() { - *x = KeyValue{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_accesslog_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *KeyValue) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*KeyValue) ProtoMessage() {} - -func (x *KeyValue) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_accesslog_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use KeyValue.ProtoReflect.Descriptor instead. -func (*KeyValue) Descriptor() ([]byte, []int) { - return file_cilium_api_accesslog_proto_rawDescGZIP(), []int{0} -} - -func (x *KeyValue) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *KeyValue) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -type HttpLogEntry struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - HttpProtocol HttpProtocol `protobuf:"varint,1,opt,name=http_protocol,json=httpProtocol,proto3,enum=cilium.HttpProtocol" json:"http_protocol,omitempty"` - // Request info that is also retained for the response - Scheme string `protobuf:"bytes,2,opt,name=scheme,proto3" json:"scheme,omitempty"` // Envoy "x-forwarded-proto", e.g., "http", "https" - Host string `protobuf:"bytes,3,opt,name=host,proto3" json:"host,omitempty"` // Envoy ":authority" header - Path string `protobuf:"bytes,4,opt,name=path,proto3" json:"path,omitempty"` // Envoy ":path" header - Method string `protobuf:"bytes,5,opt,name=method,proto3" json:"method,omitempty"` // Envoy ":method" header - // Request or response headers not included above - Headers []*KeyValue `protobuf:"bytes,6,rep,name=headers,proto3" json:"headers,omitempty"` - // Response info - Status uint32 `protobuf:"varint,7,opt,name=status,proto3" json:"status,omitempty"` // Envoy ":status" header, zero for request - // missing_headers includes both headers that were added to the - // request, and headers that were merely logged as missing - MissingHeaders []*KeyValue `protobuf:"bytes,8,rep,name=missing_headers,json=missingHeaders,proto3" json:"missing_headers,omitempty"` - // rejected_headers includes headers that were flagged as unallowed, - // which may have been removed, or merely logged and the request still - // allowed, or the request may have been dropped due to them. - RejectedHeaders []*KeyValue `protobuf:"bytes,9,rep,name=rejected_headers,json=rejectedHeaders,proto3" json:"rejected_headers,omitempty"` -} - -func (x *HttpLogEntry) Reset() { - *x = HttpLogEntry{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_accesslog_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HttpLogEntry) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HttpLogEntry) ProtoMessage() {} - -func (x *HttpLogEntry) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_accesslog_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HttpLogEntry.ProtoReflect.Descriptor instead. -func (*HttpLogEntry) Descriptor() ([]byte, []int) { - return file_cilium_api_accesslog_proto_rawDescGZIP(), []int{1} -} - -func (x *HttpLogEntry) GetHttpProtocol() HttpProtocol { - if x != nil { - return x.HttpProtocol - } - return HttpProtocol_HTTP10 -} - -func (x *HttpLogEntry) GetScheme() string { - if x != nil { - return x.Scheme - } - return "" -} - -func (x *HttpLogEntry) GetHost() string { - if x != nil { - return x.Host - } - return "" -} - -func (x *HttpLogEntry) GetPath() string { - if x != nil { - return x.Path - } - return "" -} - -func (x *HttpLogEntry) GetMethod() string { - if x != nil { - return x.Method - } - return "" -} - -func (x *HttpLogEntry) GetHeaders() []*KeyValue { - if x != nil { - return x.Headers - } - return nil -} - -func (x *HttpLogEntry) GetStatus() uint32 { - if x != nil { - return x.Status - } - return 0 -} - -func (x *HttpLogEntry) GetMissingHeaders() []*KeyValue { - if x != nil { - return x.MissingHeaders - } - return nil -} - -func (x *HttpLogEntry) GetRejectedHeaders() []*KeyValue { - if x != nil { - return x.RejectedHeaders - } - return nil -} - -type KafkaLogEntry struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // correlation_id is a user-supplied integer value that will be passed - // back with the response - CorrelationId int32 `protobuf:"varint,1,opt,name=correlation_id,json=correlationId,proto3" json:"correlation_id,omitempty"` - // error_code is the Kafka error code being returned - // Ref. https://kafka.apache.org/protocol#protocol_error_codes - ErrorCode int32 `protobuf:"varint,2,opt,name=error_code,json=errorCode,proto3" json:"error_code,omitempty"` - // api_version of the Kafka api used - // Ref. https://kafka.apache.org/protocol#protocol_compatibility - ApiVersion int32 `protobuf:"varint,3,opt,name=api_version,json=apiVersion,proto3" json:"api_version,omitempty"` - // api_key for Kafka message - // Reference: https://kafka.apache.org/protocol#protocol_api_keys - ApiKey int32 `protobuf:"varint,4,opt,name=api_key,json=apiKey,proto3" json:"api_key,omitempty"` - // Topics of the request - // Optional, as not all messages have topics (ex. LeaveGroup, Heartbeat) - Topics []string `protobuf:"bytes,5,rep,name=topics,proto3" json:"topics,omitempty"` -} - -func (x *KafkaLogEntry) Reset() { - *x = KafkaLogEntry{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_accesslog_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *KafkaLogEntry) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*KafkaLogEntry) ProtoMessage() {} - -func (x *KafkaLogEntry) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_accesslog_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use KafkaLogEntry.ProtoReflect.Descriptor instead. -func (*KafkaLogEntry) Descriptor() ([]byte, []int) { - return file_cilium_api_accesslog_proto_rawDescGZIP(), []int{2} -} - -func (x *KafkaLogEntry) GetCorrelationId() int32 { - if x != nil { - return x.CorrelationId - } - return 0 -} - -func (x *KafkaLogEntry) GetErrorCode() int32 { - if x != nil { - return x.ErrorCode - } - return 0 -} - -func (x *KafkaLogEntry) GetApiVersion() int32 { - if x != nil { - return x.ApiVersion - } - return 0 -} - -func (x *KafkaLogEntry) GetApiKey() int32 { - if x != nil { - return x.ApiKey - } - return 0 -} - -func (x *KafkaLogEntry) GetTopics() []string { - if x != nil { - return x.Topics - } - return nil -} - -type L7LogEntry struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Proto string `protobuf:"bytes,1,opt,name=proto,proto3" json:"proto,omitempty"` - Fields map[string]string `protobuf:"bytes,2,rep,name=fields,proto3" json:"fields,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *L7LogEntry) Reset() { - *x = L7LogEntry{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_accesslog_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *L7LogEntry) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*L7LogEntry) ProtoMessage() {} - -func (x *L7LogEntry) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_accesslog_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use L7LogEntry.ProtoReflect.Descriptor instead. -func (*L7LogEntry) Descriptor() ([]byte, []int) { - return file_cilium_api_accesslog_proto_rawDescGZIP(), []int{3} -} - -func (x *L7LogEntry) GetProto() string { - if x != nil { - return x.Proto - } - return "" -} - -func (x *L7LogEntry) GetFields() map[string]string { - if x != nil { - return x.Fields - } - return nil -} - -type LogEntry struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The time that Cilium filter captured this log entry, - // in, nanoseconds since 1/1/1970. - Timestamp uint64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - // 'true' if the request was received by an ingress listener, - // 'false' if received by an egress listener - IsIngress bool `protobuf:"varint,15,opt,name=is_ingress,json=isIngress,proto3" json:"is_ingress,omitempty"` - EntryType EntryType `protobuf:"varint,3,opt,name=entry_type,json=entryType,proto3,enum=cilium.EntryType" json:"entry_type,omitempty"` - // Cilium network policy resource name - PolicyName string `protobuf:"bytes,4,opt,name=policy_name,json=policyName,proto3" json:"policy_name,omitempty"` - // proxy_id identifies the listener this message relates to, - // as configured via the bpf_metadata listener filter - ProxyId uint32 `protobuf:"varint,17,opt,name=proxy_id,json=proxyId,proto3" json:"proxy_id,omitempty"` - // Cilium rule reference - CiliumRuleRef string `protobuf:"bytes,5,opt,name=cilium_rule_ref,json=ciliumRuleRef,proto3" json:"cilium_rule_ref,omitempty"` - // Cilium security ID of the source and destination - SourceSecurityId uint32 `protobuf:"varint,6,opt,name=source_security_id,json=sourceSecurityId,proto3" json:"source_security_id,omitempty"` - DestinationSecurityId uint32 `protobuf:"varint,16,opt,name=destination_security_id,json=destinationSecurityId,proto3" json:"destination_security_id,omitempty"` - // These fields record the original source and destination addresses, - // stored in ipv4:port or [ipv6]:port format. - SourceAddress string `protobuf:"bytes,7,opt,name=source_address,json=sourceAddress,proto3" json:"source_address,omitempty"` - DestinationAddress string `protobuf:"bytes,8,opt,name=destination_address,json=destinationAddress,proto3" json:"destination_address,omitempty"` - // Types that are assignable to L7: - // - // *LogEntry_Http - // *LogEntry_Kafka - // *LogEntry_GenericL7 - L7 isLogEntry_L7 `protobuf_oneof:"l7"` -} - -func (x *LogEntry) Reset() { - *x = LogEntry{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_accesslog_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LogEntry) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LogEntry) ProtoMessage() {} - -func (x *LogEntry) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_accesslog_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LogEntry.ProtoReflect.Descriptor instead. -func (*LogEntry) Descriptor() ([]byte, []int) { - return file_cilium_api_accesslog_proto_rawDescGZIP(), []int{4} -} - -func (x *LogEntry) GetTimestamp() uint64 { - if x != nil { - return x.Timestamp - } - return 0 -} - -func (x *LogEntry) GetIsIngress() bool { - if x != nil { - return x.IsIngress - } - return false -} - -func (x *LogEntry) GetEntryType() EntryType { - if x != nil { - return x.EntryType - } - return EntryType_Request -} - -func (x *LogEntry) GetPolicyName() string { - if x != nil { - return x.PolicyName - } - return "" -} - -func (x *LogEntry) GetProxyId() uint32 { - if x != nil { - return x.ProxyId - } - return 0 -} - -func (x *LogEntry) GetCiliumRuleRef() string { - if x != nil { - return x.CiliumRuleRef - } - return "" -} - -func (x *LogEntry) GetSourceSecurityId() uint32 { - if x != nil { - return x.SourceSecurityId - } - return 0 -} - -func (x *LogEntry) GetDestinationSecurityId() uint32 { - if x != nil { - return x.DestinationSecurityId - } - return 0 -} - -func (x *LogEntry) GetSourceAddress() string { - if x != nil { - return x.SourceAddress - } - return "" -} - -func (x *LogEntry) GetDestinationAddress() string { - if x != nil { - return x.DestinationAddress - } - return "" -} - -func (m *LogEntry) GetL7() isLogEntry_L7 { - if m != nil { - return m.L7 - } - return nil -} - -func (x *LogEntry) GetHttp() *HttpLogEntry { - if x, ok := x.GetL7().(*LogEntry_Http); ok { - return x.Http - } - return nil -} - -func (x *LogEntry) GetKafka() *KafkaLogEntry { - if x, ok := x.GetL7().(*LogEntry_Kafka); ok { - return x.Kafka - } - return nil -} - -func (x *LogEntry) GetGenericL7() *L7LogEntry { - if x, ok := x.GetL7().(*LogEntry_GenericL7); ok { - return x.GenericL7 - } - return nil -} - -type isLogEntry_L7 interface { - isLogEntry_L7() -} - -type LogEntry_Http struct { - Http *HttpLogEntry `protobuf:"bytes,100,opt,name=http,proto3,oneof"` -} - -type LogEntry_Kafka struct { - Kafka *KafkaLogEntry `protobuf:"bytes,101,opt,name=kafka,proto3,oneof"` -} - -type LogEntry_GenericL7 struct { - GenericL7 *L7LogEntry `protobuf:"bytes,102,opt,name=generic_l7,json=genericL7,proto3,oneof"` -} - -func (*LogEntry_Http) isLogEntry_L7() {} - -func (*LogEntry_Kafka) isLogEntry_L7() {} - -func (*LogEntry_GenericL7) isLogEntry_L7() {} - -var File_cilium_api_accesslog_proto protoreflect.FileDescriptor - -var file_cilium_api_accesslog_proto_rawDesc = []byte{ - 0x0a, 0x1a, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x6c, 0x6f, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x63, 0x69, - 0x6c, 0x69, 0x75, 0x6d, 0x22, 0x32, 0x0a, 0x08, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, - 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xdd, 0x02, 0x0a, 0x0c, 0x48, 0x74, 0x74, - 0x70, 0x4c, 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x39, 0x0a, 0x0d, 0x68, 0x74, 0x74, - 0x70, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x14, 0x2e, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x52, 0x0c, 0x68, 0x74, 0x74, 0x70, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, - 0x68, 0x6f, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, - 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x70, 0x61, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x2a, 0x0a, 0x07, - 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, - 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, - 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x12, 0x39, 0x0a, 0x0f, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x5f, 0x68, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x69, 0x6c, 0x69, - 0x75, 0x6d, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0e, 0x6d, 0x69, 0x73, - 0x73, 0x69, 0x6e, 0x67, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x3b, 0x0a, 0x10, 0x72, - 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, - 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2e, 0x4b, - 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0f, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, - 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x22, 0xa7, 0x01, 0x0a, 0x0d, 0x4b, 0x61, 0x66, - 0x6b, 0x61, 0x4c, 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, - 0x72, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x0d, 0x63, 0x6f, 0x72, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, - 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, - 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x61, 0x70, 0x69, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x06, 0x61, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x6f, - 0x70, 0x69, 0x63, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x74, 0x6f, 0x70, 0x69, - 0x63, 0x73, 0x22, 0x95, 0x01, 0x0a, 0x0a, 0x4c, 0x37, 0x4c, 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x36, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, - 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, - 0x2e, 0x4c, 0x37, 0x4c, 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x2e, 0x46, 0x69, 0x65, 0x6c, - 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x1a, - 0x39, 0x0a, 0x0b, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xb1, 0x04, 0x0a, 0x08, 0x4c, - 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x69, 0x6e, 0x67, 0x72, - 0x65, 0x73, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x49, 0x6e, 0x67, - 0x72, 0x65, 0x73, 0x73, 0x12, 0x30, 0x0a, 0x0a, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x5f, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x63, 0x69, 0x6c, 0x69, 0x75, - 0x6d, 0x2e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x65, 0x6e, 0x74, - 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x78, 0x79, - 0x5f, 0x69, 0x64, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x78, 0x79, - 0x49, 0x64, 0x12, 0x26, 0x0a, 0x0f, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x5f, 0x72, 0x75, 0x6c, - 0x65, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x69, 0x6c, - 0x69, 0x75, 0x6d, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x12, 0x2c, 0x0a, 0x12, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x69, 0x64, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x10, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x53, 0x65, - 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x49, 0x64, 0x12, 0x36, 0x0a, 0x17, 0x64, 0x65, 0x73, 0x74, - 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, - 0x5f, 0x69, 0x64, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x15, 0x64, 0x65, 0x73, 0x74, 0x69, - 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x49, 0x64, - 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2f, 0x0a, 0x13, 0x64, 0x65, 0x73, 0x74, 0x69, - 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2a, 0x0a, 0x04, 0x68, 0x74, 0x74, 0x70, - 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2e, - 0x48, 0x74, 0x74, 0x70, 0x4c, 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x48, 0x00, 0x52, 0x04, - 0x68, 0x74, 0x74, 0x70, 0x12, 0x2d, 0x0a, 0x05, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x18, 0x65, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2e, 0x4b, 0x61, 0x66, - 0x6b, 0x61, 0x4c, 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x48, 0x00, 0x52, 0x05, 0x6b, 0x61, - 0x66, 0x6b, 0x61, 0x12, 0x33, 0x0a, 0x0a, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x6c, - 0x37, 0x18, 0x66, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, - 0x2e, 0x4c, 0x37, 0x4c, 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x48, 0x00, 0x52, 0x09, 0x67, - 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x4c, 0x37, 0x42, 0x04, 0x0a, 0x02, 0x6c, 0x37, 0x2a, 0x31, - 0x0a, 0x0c, 0x48, 0x74, 0x74, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x0a, - 0x0a, 0x06, 0x48, 0x54, 0x54, 0x50, 0x31, 0x30, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x48, 0x54, - 0x54, 0x50, 0x31, 0x31, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x48, 0x54, 0x54, 0x50, 0x32, 0x10, - 0x02, 0x2a, 0x32, 0x0a, 0x09, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, - 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x65, 0x6e, - 0x69, 0x65, 0x64, 0x10, 0x02, 0x42, 0x2e, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, - 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x3b, 0x63, - 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_cilium_api_accesslog_proto_rawDescOnce sync.Once - file_cilium_api_accesslog_proto_rawDescData = file_cilium_api_accesslog_proto_rawDesc -) - -func file_cilium_api_accesslog_proto_rawDescGZIP() []byte { - file_cilium_api_accesslog_proto_rawDescOnce.Do(func() { - file_cilium_api_accesslog_proto_rawDescData = protoimpl.X.CompressGZIP(file_cilium_api_accesslog_proto_rawDescData) - }) - return file_cilium_api_accesslog_proto_rawDescData -} - -var file_cilium_api_accesslog_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_cilium_api_accesslog_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_cilium_api_accesslog_proto_goTypes = []interface{}{ - (HttpProtocol)(0), // 0: cilium.HttpProtocol - (EntryType)(0), // 1: cilium.EntryType - (*KeyValue)(nil), // 2: cilium.KeyValue - (*HttpLogEntry)(nil), // 3: cilium.HttpLogEntry - (*KafkaLogEntry)(nil), // 4: cilium.KafkaLogEntry - (*L7LogEntry)(nil), // 5: cilium.L7LogEntry - (*LogEntry)(nil), // 6: cilium.LogEntry - nil, // 7: cilium.L7LogEntry.FieldsEntry -} -var file_cilium_api_accesslog_proto_depIdxs = []int32{ - 0, // 0: cilium.HttpLogEntry.http_protocol:type_name -> cilium.HttpProtocol - 2, // 1: cilium.HttpLogEntry.headers:type_name -> cilium.KeyValue - 2, // 2: cilium.HttpLogEntry.missing_headers:type_name -> cilium.KeyValue - 2, // 3: cilium.HttpLogEntry.rejected_headers:type_name -> cilium.KeyValue - 7, // 4: cilium.L7LogEntry.fields:type_name -> cilium.L7LogEntry.FieldsEntry - 1, // 5: cilium.LogEntry.entry_type:type_name -> cilium.EntryType - 3, // 6: cilium.LogEntry.http:type_name -> cilium.HttpLogEntry - 4, // 7: cilium.LogEntry.kafka:type_name -> cilium.KafkaLogEntry - 5, // 8: cilium.LogEntry.generic_l7:type_name -> cilium.L7LogEntry - 9, // [9:9] is the sub-list for method output_type - 9, // [9:9] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name -} - -func init() { file_cilium_api_accesslog_proto_init() } -func file_cilium_api_accesslog_proto_init() { - if File_cilium_api_accesslog_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_cilium_api_accesslog_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*KeyValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cilium_api_accesslog_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HttpLogEntry); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cilium_api_accesslog_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*KafkaLogEntry); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cilium_api_accesslog_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*L7LogEntry); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cilium_api_accesslog_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LogEntry); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_cilium_api_accesslog_proto_msgTypes[4].OneofWrappers = []interface{}{ - (*LogEntry_Http)(nil), - (*LogEntry_Kafka)(nil), - (*LogEntry_GenericL7)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cilium_api_accesslog_proto_rawDesc, - NumEnums: 2, - NumMessages: 6, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_cilium_api_accesslog_proto_goTypes, - DependencyIndexes: file_cilium_api_accesslog_proto_depIdxs, - EnumInfos: file_cilium_api_accesslog_proto_enumTypes, - MessageInfos: file_cilium_api_accesslog_proto_msgTypes, - }.Build() - File_cilium_api_accesslog_proto = out.File - file_cilium_api_accesslog_proto_rawDesc = nil - file_cilium_api_accesslog_proto_goTypes = nil - file_cilium_api_accesslog_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/cilium/api/accesslog.pb.validate.go b/vendor/github.com/cilium/proxy/go/cilium/api/accesslog.pb.validate.go deleted file mode 100644 index 3a9c5b417..000000000 --- a/vendor/github.com/cilium/proxy/go/cilium/api/accesslog.pb.validate.go +++ /dev/null @@ -1,810 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: cilium/api/accesslog.proto - -package cilium - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on KeyValue with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *KeyValue) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on KeyValue with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in KeyValueMultiError, or nil -// if none found. -func (m *KeyValue) ValidateAll() error { - return m.validate(true) -} - -func (m *KeyValue) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Key - - // no validation rules for Value - - if len(errors) > 0 { - return KeyValueMultiError(errors) - } - - return nil -} - -// KeyValueMultiError is an error wrapping multiple validation errors returned -// by KeyValue.ValidateAll() if the designated constraints aren't met. -type KeyValueMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m KeyValueMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m KeyValueMultiError) AllErrors() []error { return m } - -// KeyValueValidationError is the validation error returned by -// KeyValue.Validate if the designated constraints aren't met. -type KeyValueValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e KeyValueValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e KeyValueValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e KeyValueValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e KeyValueValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e KeyValueValidationError) ErrorName() string { return "KeyValueValidationError" } - -// Error satisfies the builtin error interface -func (e KeyValueValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sKeyValue.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = KeyValueValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = KeyValueValidationError{} - -// Validate checks the field values on HttpLogEntry with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *HttpLogEntry) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HttpLogEntry with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in HttpLogEntryMultiError, or -// nil if none found. -func (m *HttpLogEntry) ValidateAll() error { - return m.validate(true) -} - -func (m *HttpLogEntry) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for HttpProtocol - - // no validation rules for Scheme - - // no validation rules for Host - - // no validation rules for Path - - // no validation rules for Method - - for idx, item := range m.GetHeaders() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpLogEntryValidationError{ - field: fmt.Sprintf("Headers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpLogEntryValidationError{ - field: fmt.Sprintf("Headers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpLogEntryValidationError{ - field: fmt.Sprintf("Headers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - // no validation rules for Status - - for idx, item := range m.GetMissingHeaders() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpLogEntryValidationError{ - field: fmt.Sprintf("MissingHeaders[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpLogEntryValidationError{ - field: fmt.Sprintf("MissingHeaders[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpLogEntryValidationError{ - field: fmt.Sprintf("MissingHeaders[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetRejectedHeaders() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpLogEntryValidationError{ - field: fmt.Sprintf("RejectedHeaders[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpLogEntryValidationError{ - field: fmt.Sprintf("RejectedHeaders[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpLogEntryValidationError{ - field: fmt.Sprintf("RejectedHeaders[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return HttpLogEntryMultiError(errors) - } - - return nil -} - -// HttpLogEntryMultiError is an error wrapping multiple validation errors -// returned by HttpLogEntry.ValidateAll() if the designated constraints aren't met. -type HttpLogEntryMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HttpLogEntryMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HttpLogEntryMultiError) AllErrors() []error { return m } - -// HttpLogEntryValidationError is the validation error returned by -// HttpLogEntry.Validate if the designated constraints aren't met. -type HttpLogEntryValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HttpLogEntryValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HttpLogEntryValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HttpLogEntryValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HttpLogEntryValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HttpLogEntryValidationError) ErrorName() string { return "HttpLogEntryValidationError" } - -// Error satisfies the builtin error interface -func (e HttpLogEntryValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttpLogEntry.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HttpLogEntryValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HttpLogEntryValidationError{} - -// Validate checks the field values on KafkaLogEntry with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *KafkaLogEntry) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on KafkaLogEntry with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in KafkaLogEntryMultiError, or -// nil if none found. -func (m *KafkaLogEntry) ValidateAll() error { - return m.validate(true) -} - -func (m *KafkaLogEntry) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for CorrelationId - - // no validation rules for ErrorCode - - // no validation rules for ApiVersion - - // no validation rules for ApiKey - - if len(errors) > 0 { - return KafkaLogEntryMultiError(errors) - } - - return nil -} - -// KafkaLogEntryMultiError is an error wrapping multiple validation errors -// returned by KafkaLogEntry.ValidateAll() if the designated constraints -// aren't met. -type KafkaLogEntryMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m KafkaLogEntryMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m KafkaLogEntryMultiError) AllErrors() []error { return m } - -// KafkaLogEntryValidationError is the validation error returned by -// KafkaLogEntry.Validate if the designated constraints aren't met. -type KafkaLogEntryValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e KafkaLogEntryValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e KafkaLogEntryValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e KafkaLogEntryValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e KafkaLogEntryValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e KafkaLogEntryValidationError) ErrorName() string { return "KafkaLogEntryValidationError" } - -// Error satisfies the builtin error interface -func (e KafkaLogEntryValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sKafkaLogEntry.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = KafkaLogEntryValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = KafkaLogEntryValidationError{} - -// Validate checks the field values on L7LogEntry with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *L7LogEntry) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on L7LogEntry with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in L7LogEntryMultiError, or -// nil if none found. -func (m *L7LogEntry) ValidateAll() error { - return m.validate(true) -} - -func (m *L7LogEntry) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Proto - - // no validation rules for Fields - - if len(errors) > 0 { - return L7LogEntryMultiError(errors) - } - - return nil -} - -// L7LogEntryMultiError is an error wrapping multiple validation errors -// returned by L7LogEntry.ValidateAll() if the designated constraints aren't met. -type L7LogEntryMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m L7LogEntryMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m L7LogEntryMultiError) AllErrors() []error { return m } - -// L7LogEntryValidationError is the validation error returned by -// L7LogEntry.Validate if the designated constraints aren't met. -type L7LogEntryValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e L7LogEntryValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e L7LogEntryValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e L7LogEntryValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e L7LogEntryValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e L7LogEntryValidationError) ErrorName() string { return "L7LogEntryValidationError" } - -// Error satisfies the builtin error interface -func (e L7LogEntryValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sL7LogEntry.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = L7LogEntryValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = L7LogEntryValidationError{} - -// Validate checks the field values on LogEntry with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *LogEntry) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on LogEntry with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in LogEntryMultiError, or nil -// if none found. -func (m *LogEntry) ValidateAll() error { - return m.validate(true) -} - -func (m *LogEntry) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Timestamp - - // no validation rules for IsIngress - - // no validation rules for EntryType - - // no validation rules for PolicyName - - // no validation rules for ProxyId - - // no validation rules for CiliumRuleRef - - // no validation rules for SourceSecurityId - - // no validation rules for DestinationSecurityId - - // no validation rules for SourceAddress - - // no validation rules for DestinationAddress - - switch v := m.L7.(type) { - case *LogEntry_Http: - if v == nil { - err := LogEntryValidationError{ - field: "L7", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetHttp()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, LogEntryValidationError{ - field: "Http", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, LogEntryValidationError{ - field: "Http", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHttp()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return LogEntryValidationError{ - field: "Http", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *LogEntry_Kafka: - if v == nil { - err := LogEntryValidationError{ - field: "L7", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetKafka()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, LogEntryValidationError{ - field: "Kafka", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, LogEntryValidationError{ - field: "Kafka", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetKafka()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return LogEntryValidationError{ - field: "Kafka", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *LogEntry_GenericL7: - if v == nil { - err := LogEntryValidationError{ - field: "L7", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetGenericL7()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, LogEntryValidationError{ - field: "GenericL7", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, LogEntryValidationError{ - field: "GenericL7", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetGenericL7()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return LogEntryValidationError{ - field: "GenericL7", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return LogEntryMultiError(errors) - } - - return nil -} - -// LogEntryMultiError is an error wrapping multiple validation errors returned -// by LogEntry.ValidateAll() if the designated constraints aren't met. -type LogEntryMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m LogEntryMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m LogEntryMultiError) AllErrors() []error { return m } - -// LogEntryValidationError is the validation error returned by -// LogEntry.Validate if the designated constraints aren't met. -type LogEntryValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e LogEntryValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e LogEntryValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e LogEntryValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e LogEntryValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e LogEntryValidationError) ErrorName() string { return "LogEntryValidationError" } - -// Error satisfies the builtin error interface -func (e LogEntryValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sLogEntry.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = LogEntryValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = LogEntryValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/cilium/api/bpf_metadata.pb.go b/vendor/github.com/cilium/proxy/go/cilium/api/bpf_metadata.pb.go deleted file mode 100644 index d550d8131..000000000 --- a/vendor/github.com/cilium/proxy/go/cilium/api/bpf_metadata.pb.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: cilium/api/bpf_metadata.proto - -package cilium - -import ( - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -type BpfMetadata struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // File system root for bpf. Defaults to "/sys/fs/bpf" if left empty. - BpfRoot string `protobuf:"bytes,1,opt,name=bpf_root,json=bpfRoot,proto3" json:"bpf_root,omitempty"` - // 'true' if the filter is on ingress listener, 'false' for egress listener. - IsIngress bool `protobuf:"varint,2,opt,name=is_ingress,json=isIngress,proto3" json:"is_ingress,omitempty"` - // Use of the original source address requires kernel datapath support which - // may or may not be available. 'true' if original source address - // should be used. Original source address use may still be - // skipped in scenarios where it is knows to not work. - UseOriginalSourceAddress bool `protobuf:"varint,3,opt,name=use_original_source_address,json=useOriginalSourceAddress,proto3" json:"use_original_source_address,omitempty"` - // True if the listener is used for an L7 LB. In this case policy enforcement is done on the - // destination selected by the listener rather than on the original destination address. For - // local sources the source endpoint ID is set in socket mark instead of source security ID if - // 'use_original_source_address' is also true, so that the local source's egress policy is - // enforced on the bpf datapath. - // Only valid for egress. - IsL7Lb bool `protobuf:"varint,4,opt,name=is_l7lb,json=isL7lb,proto3" json:"is_l7lb,omitempty"` - // Source address to be used whenever the original source address is not used. - // Either ipv4_source_address or ipv6_source_address depending on the address - // family of the destination address. If left empty, and no Envoy Cluster Bind - // Config is provided, the source address will be picked by the local IP stack. - Ipv4SourceAddress string `protobuf:"bytes,5,opt,name=ipv4_source_address,json=ipv4SourceAddress,proto3" json:"ipv4_source_address,omitempty"` - Ipv6SourceAddress string `protobuf:"bytes,6,opt,name=ipv6_source_address,json=ipv6SourceAddress,proto3" json:"ipv6_source_address,omitempty"` - // True if policy should be enforced on l7 LB used. The policy bound to the configured - // ipv[46]_source_addresses, which must be explicitly set, applies. Ingress policy is - // enforced on the security identity of the original (e.g., external) source. Egress - // policy is enforced on the security identity of the backend selected by the load balancer. - // - // Deprecation note: This option will be forced 'true' and deprecated when Cilium 1.15 is - // the oldest supported release. - EnforcePolicyOnL7Lb bool `protobuf:"varint,7,opt,name=enforce_policy_on_l7lb,json=enforcePolicyOnL7lb,proto3" json:"enforce_policy_on_l7lb,omitempty"` - // proxy_id is passed to access log messages and allows relating access log messages to - // listeners. - ProxyId uint32 `protobuf:"varint,8,opt,name=proxy_id,json=proxyId,proto3" json:"proxy_id,omitempty"` -} - -func (x *BpfMetadata) Reset() { - *x = BpfMetadata{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_bpf_metadata_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BpfMetadata) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BpfMetadata) ProtoMessage() {} - -func (x *BpfMetadata) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_bpf_metadata_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BpfMetadata.ProtoReflect.Descriptor instead. -func (*BpfMetadata) Descriptor() ([]byte, []int) { - return file_cilium_api_bpf_metadata_proto_rawDescGZIP(), []int{0} -} - -func (x *BpfMetadata) GetBpfRoot() string { - if x != nil { - return x.BpfRoot - } - return "" -} - -func (x *BpfMetadata) GetIsIngress() bool { - if x != nil { - return x.IsIngress - } - return false -} - -func (x *BpfMetadata) GetUseOriginalSourceAddress() bool { - if x != nil { - return x.UseOriginalSourceAddress - } - return false -} - -func (x *BpfMetadata) GetIsL7Lb() bool { - if x != nil { - return x.IsL7Lb - } - return false -} - -func (x *BpfMetadata) GetIpv4SourceAddress() string { - if x != nil { - return x.Ipv4SourceAddress - } - return "" -} - -func (x *BpfMetadata) GetIpv6SourceAddress() string { - if x != nil { - return x.Ipv6SourceAddress - } - return "" -} - -func (x *BpfMetadata) GetEnforcePolicyOnL7Lb() bool { - if x != nil { - return x.EnforcePolicyOnL7Lb - } - return false -} - -func (x *BpfMetadata) GetProxyId() uint32 { - if x != nil { - return x.ProxyId - } - return 0 -} - -var File_cilium_api_bpf_metadata_proto protoreflect.FileDescriptor - -var file_cilium_api_bpf_metadata_proto_rawDesc = []byte{ - 0x0a, 0x1d, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x62, 0x70, 0x66, - 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x06, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x22, 0xcf, 0x02, 0x0a, 0x0b, 0x42, 0x70, 0x66, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x70, 0x66, 0x5f, 0x72, - 0x6f, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x70, 0x66, 0x52, 0x6f, - 0x6f, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x69, 0x6e, 0x67, 0x72, 0x65, 0x73, 0x73, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x49, 0x6e, 0x67, 0x72, 0x65, 0x73, - 0x73, 0x12, 0x3d, 0x0a, 0x1b, 0x75, 0x73, 0x65, 0x5f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, - 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x18, 0x75, 0x73, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, - 0x6e, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x12, 0x17, 0x0a, 0x07, 0x69, 0x73, 0x5f, 0x6c, 0x37, 0x6c, 0x62, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x06, 0x69, 0x73, 0x4c, 0x37, 0x6c, 0x62, 0x12, 0x2e, 0x0a, 0x13, 0x69, 0x70, 0x76, - 0x34, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x69, 0x70, 0x76, 0x34, 0x53, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x69, 0x70, 0x76, - 0x36, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x69, 0x70, 0x76, 0x36, 0x53, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x33, 0x0a, 0x16, 0x65, 0x6e, 0x66, - 0x6f, 0x72, 0x63, 0x65, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x6f, 0x6e, 0x5f, 0x6c, - 0x37, 0x6c, 0x62, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, 0x6e, 0x66, 0x6f, 0x72, - 0x63, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4f, 0x6e, 0x4c, 0x37, 0x6c, 0x62, 0x12, 0x19, - 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x07, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x49, 0x64, 0x42, 0x2e, 0x5a, 0x2c, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x70, - 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x61, - 0x70, 0x69, 0x3b, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} - -var ( - file_cilium_api_bpf_metadata_proto_rawDescOnce sync.Once - file_cilium_api_bpf_metadata_proto_rawDescData = file_cilium_api_bpf_metadata_proto_rawDesc -) - -func file_cilium_api_bpf_metadata_proto_rawDescGZIP() []byte { - file_cilium_api_bpf_metadata_proto_rawDescOnce.Do(func() { - file_cilium_api_bpf_metadata_proto_rawDescData = protoimpl.X.CompressGZIP(file_cilium_api_bpf_metadata_proto_rawDescData) - }) - return file_cilium_api_bpf_metadata_proto_rawDescData -} - -var file_cilium_api_bpf_metadata_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_cilium_api_bpf_metadata_proto_goTypes = []interface{}{ - (*BpfMetadata)(nil), // 0: cilium.BpfMetadata -} -var file_cilium_api_bpf_metadata_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_cilium_api_bpf_metadata_proto_init() } -func file_cilium_api_bpf_metadata_proto_init() { - if File_cilium_api_bpf_metadata_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_cilium_api_bpf_metadata_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BpfMetadata); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cilium_api_bpf_metadata_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_cilium_api_bpf_metadata_proto_goTypes, - DependencyIndexes: file_cilium_api_bpf_metadata_proto_depIdxs, - MessageInfos: file_cilium_api_bpf_metadata_proto_msgTypes, - }.Build() - File_cilium_api_bpf_metadata_proto = out.File - file_cilium_api_bpf_metadata_proto_rawDesc = nil - file_cilium_api_bpf_metadata_proto_goTypes = nil - file_cilium_api_bpf_metadata_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/cilium/api/bpf_metadata.pb.validate.go b/vendor/github.com/cilium/proxy/go/cilium/api/bpf_metadata.pb.validate.go deleted file mode 100644 index 2c3fff7c3..000000000 --- a/vendor/github.com/cilium/proxy/go/cilium/api/bpf_metadata.pb.validate.go +++ /dev/null @@ -1,151 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: cilium/api/bpf_metadata.proto - -package cilium - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on BpfMetadata with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *BpfMetadata) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on BpfMetadata with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in BpfMetadataMultiError, or -// nil if none found. -func (m *BpfMetadata) ValidateAll() error { - return m.validate(true) -} - -func (m *BpfMetadata) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for BpfRoot - - // no validation rules for IsIngress - - // no validation rules for UseOriginalSourceAddress - - // no validation rules for IsL7Lb - - // no validation rules for Ipv4SourceAddress - - // no validation rules for Ipv6SourceAddress - - // no validation rules for EnforcePolicyOnL7Lb - - // no validation rules for ProxyId - - if len(errors) > 0 { - return BpfMetadataMultiError(errors) - } - - return nil -} - -// BpfMetadataMultiError is an error wrapping multiple validation errors -// returned by BpfMetadata.ValidateAll() if the designated constraints aren't met. -type BpfMetadataMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m BpfMetadataMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m BpfMetadataMultiError) AllErrors() []error { return m } - -// BpfMetadataValidationError is the validation error returned by -// BpfMetadata.Validate if the designated constraints aren't met. -type BpfMetadataValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e BpfMetadataValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e BpfMetadataValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e BpfMetadataValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e BpfMetadataValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e BpfMetadataValidationError) ErrorName() string { return "BpfMetadataValidationError" } - -// Error satisfies the builtin error interface -func (e BpfMetadataValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sBpfMetadata.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = BpfMetadataValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = BpfMetadataValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/cilium/api/health_check_sink.pb.go b/vendor/github.com/cilium/proxy/go/cilium/api/health_check_sink.pb.go deleted file mode 100644 index 5d5957a4b..000000000 --- a/vendor/github.com/cilium/proxy/go/cilium/api/health_check_sink.pb.go +++ /dev/null @@ -1,157 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: cilium/api/health_check_sink.proto - -package cilium - -import ( - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Health check event pipe sink. -// The health check event will be streamed as binary protobufs. -type HealthCheckEventPipeSink struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Unix domain socket path where to connect to send health check events to. - Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` -} - -func (x *HealthCheckEventPipeSink) Reset() { - *x = HealthCheckEventPipeSink{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_health_check_sink_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HealthCheckEventPipeSink) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HealthCheckEventPipeSink) ProtoMessage() {} - -func (x *HealthCheckEventPipeSink) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_health_check_sink_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HealthCheckEventPipeSink.ProtoReflect.Descriptor instead. -func (*HealthCheckEventPipeSink) Descriptor() ([]byte, []int) { - return file_cilium_api_health_check_sink_proto_rawDescGZIP(), []int{0} -} - -func (x *HealthCheckEventPipeSink) GetPath() string { - if x != nil { - return x.Path - } - return "" -} - -var File_cilium_api_health_check_sink_proto protoreflect.FileDescriptor - -var file_cilium_api_health_check_sink_proto_rawDesc = []byte{ - 0x0a, 0x22, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x68, 0x65, 0x61, - 0x6c, 0x74, 0x68, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x73, 0x69, 0x6e, 0x6b, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x1a, 0x17, 0x76, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x37, 0x0a, 0x18, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, - 0x68, 0x65, 0x63, 0x6b, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x69, 0x70, 0x65, 0x53, 0x69, 0x6e, - 0x6b, 0x12, 0x1b, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x42, 0x2e, - 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x69, 0x6c, - 0x69, 0x75, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x69, 0x6c, - 0x69, 0x75, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x3b, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_cilium_api_health_check_sink_proto_rawDescOnce sync.Once - file_cilium_api_health_check_sink_proto_rawDescData = file_cilium_api_health_check_sink_proto_rawDesc -) - -func file_cilium_api_health_check_sink_proto_rawDescGZIP() []byte { - file_cilium_api_health_check_sink_proto_rawDescOnce.Do(func() { - file_cilium_api_health_check_sink_proto_rawDescData = protoimpl.X.CompressGZIP(file_cilium_api_health_check_sink_proto_rawDescData) - }) - return file_cilium_api_health_check_sink_proto_rawDescData -} - -var file_cilium_api_health_check_sink_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_cilium_api_health_check_sink_proto_goTypes = []interface{}{ - (*HealthCheckEventPipeSink)(nil), // 0: cilium.HealthCheckEventPipeSink -} -var file_cilium_api_health_check_sink_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_cilium_api_health_check_sink_proto_init() } -func file_cilium_api_health_check_sink_proto_init() { - if File_cilium_api_health_check_sink_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_cilium_api_health_check_sink_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HealthCheckEventPipeSink); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cilium_api_health_check_sink_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_cilium_api_health_check_sink_proto_goTypes, - DependencyIndexes: file_cilium_api_health_check_sink_proto_depIdxs, - MessageInfos: file_cilium_api_health_check_sink_proto_msgTypes, - }.Build() - File_cilium_api_health_check_sink_proto = out.File - file_cilium_api_health_check_sink_proto_rawDesc = nil - file_cilium_api_health_check_sink_proto_goTypes = nil - file_cilium_api_health_check_sink_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/cilium/api/health_check_sink.pb.validate.go b/vendor/github.com/cilium/proxy/go/cilium/api/health_check_sink.pb.validate.go deleted file mode 100644 index 5931df1ba..000000000 --- a/vendor/github.com/cilium/proxy/go/cilium/api/health_check_sink.pb.validate.go +++ /dev/null @@ -1,149 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: cilium/api/health_check_sink.proto - -package cilium - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on HealthCheckEventPipeSink with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *HealthCheckEventPipeSink) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HealthCheckEventPipeSink with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// HealthCheckEventPipeSinkMultiError, or nil if none found. -func (m *HealthCheckEventPipeSink) ValidateAll() error { - return m.validate(true) -} - -func (m *HealthCheckEventPipeSink) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetPath()) < 1 { - err := HealthCheckEventPipeSinkValidationError{ - field: "Path", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return HealthCheckEventPipeSinkMultiError(errors) - } - - return nil -} - -// HealthCheckEventPipeSinkMultiError is an error wrapping multiple validation -// errors returned by HealthCheckEventPipeSink.ValidateAll() if the designated -// constraints aren't met. -type HealthCheckEventPipeSinkMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HealthCheckEventPipeSinkMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HealthCheckEventPipeSinkMultiError) AllErrors() []error { return m } - -// HealthCheckEventPipeSinkValidationError is the validation error returned by -// HealthCheckEventPipeSink.Validate if the designated constraints aren't met. -type HealthCheckEventPipeSinkValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HealthCheckEventPipeSinkValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HealthCheckEventPipeSinkValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HealthCheckEventPipeSinkValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HealthCheckEventPipeSinkValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HealthCheckEventPipeSinkValidationError) ErrorName() string { - return "HealthCheckEventPipeSinkValidationError" -} - -// Error satisfies the builtin error interface -func (e HealthCheckEventPipeSinkValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHealthCheckEventPipeSink.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HealthCheckEventPipeSinkValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HealthCheckEventPipeSinkValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/cilium/api/l7policy.pb.go b/vendor/github.com/cilium/proxy/go/cilium/api/l7policy.pb.go deleted file mode 100644 index fd0c72c0f..000000000 --- a/vendor/github.com/cilium/proxy/go/cilium/api/l7policy.pb.go +++ /dev/null @@ -1,167 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: cilium/api/l7policy.proto - -package cilium - -import ( - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - _ "google.golang.org/protobuf/types/known/wrapperspb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -type L7Policy struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Path to the unix domain socket for the cilium access log. - AccessLogPath string `protobuf:"bytes,1,opt,name=access_log_path,json=accessLogPath,proto3" json:"access_log_path,omitempty"` - // HTTP response body message for 403 status code. - // If empty, "Access denied" will be used. - Denied_403Body string `protobuf:"bytes,3,opt,name=denied_403_body,json=denied403Body,proto3" json:"denied_403_body,omitempty"` -} - -func (x *L7Policy) Reset() { - *x = L7Policy{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_l7policy_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *L7Policy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*L7Policy) ProtoMessage() {} - -func (x *L7Policy) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_l7policy_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use L7Policy.ProtoReflect.Descriptor instead. -func (*L7Policy) Descriptor() ([]byte, []int) { - return file_cilium_api_l7policy_proto_rawDescGZIP(), []int{0} -} - -func (x *L7Policy) GetAccessLogPath() string { - if x != nil { - return x.AccessLogPath - } - return "" -} - -func (x *L7Policy) GetDenied_403Body() string { - if x != nil { - return x.Denied_403Body - } - return "" -} - -var File_cilium_api_l7policy_proto protoreflect.FileDescriptor - -var file_cilium_api_l7policy_proto_rawDesc = []byte{ - 0x0a, 0x19, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x37, 0x70, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x63, 0x69, 0x6c, - 0x69, 0x75, 0x6d, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x5a, 0x0a, 0x08, 0x4c, 0x37, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, - 0x26, 0x0a, 0x0f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x70, 0x61, - 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x4c, 0x6f, 0x67, 0x50, 0x61, 0x74, 0x68, 0x12, 0x26, 0x0a, 0x0f, 0x64, 0x65, 0x6e, 0x69, 0x65, - 0x64, 0x5f, 0x34, 0x30, 0x33, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0d, 0x64, 0x65, 0x6e, 0x69, 0x65, 0x64, 0x34, 0x30, 0x33, 0x42, 0x6f, 0x64, 0x79, 0x42, - 0x2e, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x69, - 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x69, - 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x3b, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_cilium_api_l7policy_proto_rawDescOnce sync.Once - file_cilium_api_l7policy_proto_rawDescData = file_cilium_api_l7policy_proto_rawDesc -) - -func file_cilium_api_l7policy_proto_rawDescGZIP() []byte { - file_cilium_api_l7policy_proto_rawDescOnce.Do(func() { - file_cilium_api_l7policy_proto_rawDescData = protoimpl.X.CompressGZIP(file_cilium_api_l7policy_proto_rawDescData) - }) - return file_cilium_api_l7policy_proto_rawDescData -} - -var file_cilium_api_l7policy_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_cilium_api_l7policy_proto_goTypes = []interface{}{ - (*L7Policy)(nil), // 0: cilium.L7Policy -} -var file_cilium_api_l7policy_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_cilium_api_l7policy_proto_init() } -func file_cilium_api_l7policy_proto_init() { - if File_cilium_api_l7policy_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_cilium_api_l7policy_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*L7Policy); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cilium_api_l7policy_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_cilium_api_l7policy_proto_goTypes, - DependencyIndexes: file_cilium_api_l7policy_proto_depIdxs, - MessageInfos: file_cilium_api_l7policy_proto_msgTypes, - }.Build() - File_cilium_api_l7policy_proto = out.File - file_cilium_api_l7policy_proto_rawDesc = nil - file_cilium_api_l7policy_proto_goTypes = nil - file_cilium_api_l7policy_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/cilium/api/l7policy.pb.validate.go b/vendor/github.com/cilium/proxy/go/cilium/api/l7policy.pb.validate.go deleted file mode 100644 index a9b1cc932..000000000 --- a/vendor/github.com/cilium/proxy/go/cilium/api/l7policy.pb.validate.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: cilium/api/l7policy.proto - -package cilium - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on L7Policy with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *L7Policy) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on L7Policy with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in L7PolicyMultiError, or nil -// if none found. -func (m *L7Policy) ValidateAll() error { - return m.validate(true) -} - -func (m *L7Policy) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for AccessLogPath - - // no validation rules for Denied_403Body - - if len(errors) > 0 { - return L7PolicyMultiError(errors) - } - - return nil -} - -// L7PolicyMultiError is an error wrapping multiple validation errors returned -// by L7Policy.ValidateAll() if the designated constraints aren't met. -type L7PolicyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m L7PolicyMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m L7PolicyMultiError) AllErrors() []error { return m } - -// L7PolicyValidationError is the validation error returned by -// L7Policy.Validate if the designated constraints aren't met. -type L7PolicyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e L7PolicyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e L7PolicyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e L7PolicyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e L7PolicyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e L7PolicyValidationError) ErrorName() string { return "L7PolicyValidationError" } - -// Error satisfies the builtin error interface -func (e L7PolicyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sL7Policy.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = L7PolicyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = L7PolicyValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/cilium/api/network_filter.pb.go b/vendor/github.com/cilium/proxy/go/cilium/api/network_filter.pb.go deleted file mode 100644 index c1a785192..000000000 --- a/vendor/github.com/cilium/proxy/go/cilium/api/network_filter.pb.go +++ /dev/null @@ -1,183 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: cilium/api/network_filter.proto - -package cilium - -import ( - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -type NetworkFilter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Path to the proxylib to be opened - Proxylib string `protobuf:"bytes,1,opt,name=proxylib,proto3" json:"proxylib,omitempty"` - // Transparent set of parameters provided for proxylib initialization - ProxylibParams map[string]string `protobuf:"bytes,2,rep,name=proxylib_params,json=proxylibParams,proto3" json:"proxylib_params,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // Path to the unix domain socket for the cilium access log. - AccessLogPath string `protobuf:"bytes,5,opt,name=access_log_path,json=accessLogPath,proto3" json:"access_log_path,omitempty"` -} - -func (x *NetworkFilter) Reset() { - *x = NetworkFilter{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_network_filter_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NetworkFilter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NetworkFilter) ProtoMessage() {} - -func (x *NetworkFilter) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_network_filter_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NetworkFilter.ProtoReflect.Descriptor instead. -func (*NetworkFilter) Descriptor() ([]byte, []int) { - return file_cilium_api_network_filter_proto_rawDescGZIP(), []int{0} -} - -func (x *NetworkFilter) GetProxylib() string { - if x != nil { - return x.Proxylib - } - return "" -} - -func (x *NetworkFilter) GetProxylibParams() map[string]string { - if x != nil { - return x.ProxylibParams - } - return nil -} - -func (x *NetworkFilter) GetAccessLogPath() string { - if x != nil { - return x.AccessLogPath - } - return "" -} - -var File_cilium_api_network_filter_proto protoreflect.FileDescriptor - -var file_cilium_api_network_filter_proto_rawDesc = []byte{ - 0x0a, 0x1f, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x65, 0x74, - 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x06, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x22, 0xea, 0x01, 0x0a, 0x0d, 0x4e, 0x65, - 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x70, - 0x72, 0x6f, 0x78, 0x79, 0x6c, 0x69, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, - 0x72, 0x6f, 0x78, 0x79, 0x6c, 0x69, 0x62, 0x12, 0x52, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x78, 0x79, - 0x6c, 0x69, 0x62, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x29, 0x2e, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, - 0x6b, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x6c, 0x69, 0x62, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0e, 0x70, 0x72, 0x6f, - 0x78, 0x79, 0x6c, 0x69, 0x62, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x61, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4c, 0x6f, 0x67, 0x50, - 0x61, 0x74, 0x68, 0x1a, 0x41, 0x0a, 0x13, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x6c, 0x69, 0x62, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x2e, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x78, - 0x79, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x3b, - 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_cilium_api_network_filter_proto_rawDescOnce sync.Once - file_cilium_api_network_filter_proto_rawDescData = file_cilium_api_network_filter_proto_rawDesc -) - -func file_cilium_api_network_filter_proto_rawDescGZIP() []byte { - file_cilium_api_network_filter_proto_rawDescOnce.Do(func() { - file_cilium_api_network_filter_proto_rawDescData = protoimpl.X.CompressGZIP(file_cilium_api_network_filter_proto_rawDescData) - }) - return file_cilium_api_network_filter_proto_rawDescData -} - -var file_cilium_api_network_filter_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_cilium_api_network_filter_proto_goTypes = []interface{}{ - (*NetworkFilter)(nil), // 0: cilium.NetworkFilter - nil, // 1: cilium.NetworkFilter.ProxylibParamsEntry -} -var file_cilium_api_network_filter_proto_depIdxs = []int32{ - 1, // 0: cilium.NetworkFilter.proxylib_params:type_name -> cilium.NetworkFilter.ProxylibParamsEntry - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_cilium_api_network_filter_proto_init() } -func file_cilium_api_network_filter_proto_init() { - if File_cilium_api_network_filter_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_cilium_api_network_filter_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NetworkFilter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cilium_api_network_filter_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_cilium_api_network_filter_proto_goTypes, - DependencyIndexes: file_cilium_api_network_filter_proto_depIdxs, - MessageInfos: file_cilium_api_network_filter_proto_msgTypes, - }.Build() - File_cilium_api_network_filter_proto = out.File - file_cilium_api_network_filter_proto_rawDesc = nil - file_cilium_api_network_filter_proto_goTypes = nil - file_cilium_api_network_filter_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/cilium/api/network_filter.pb.validate.go b/vendor/github.com/cilium/proxy/go/cilium/api/network_filter.pb.validate.go deleted file mode 100644 index fec4b8b71..000000000 --- a/vendor/github.com/cilium/proxy/go/cilium/api/network_filter.pb.validate.go +++ /dev/null @@ -1,142 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: cilium/api/network_filter.proto - -package cilium - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on NetworkFilter with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *NetworkFilter) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on NetworkFilter with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in NetworkFilterMultiError, or -// nil if none found. -func (m *NetworkFilter) ValidateAll() error { - return m.validate(true) -} - -func (m *NetworkFilter) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Proxylib - - // no validation rules for ProxylibParams - - // no validation rules for AccessLogPath - - if len(errors) > 0 { - return NetworkFilterMultiError(errors) - } - - return nil -} - -// NetworkFilterMultiError is an error wrapping multiple validation errors -// returned by NetworkFilter.ValidateAll() if the designated constraints -// aren't met. -type NetworkFilterMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m NetworkFilterMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m NetworkFilterMultiError) AllErrors() []error { return m } - -// NetworkFilterValidationError is the validation error returned by -// NetworkFilter.Validate if the designated constraints aren't met. -type NetworkFilterValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e NetworkFilterValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e NetworkFilterValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e NetworkFilterValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e NetworkFilterValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e NetworkFilterValidationError) ErrorName() string { return "NetworkFilterValidationError" } - -// Error satisfies the builtin error interface -func (e NetworkFilterValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sNetworkFilter.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = NetworkFilterValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = NetworkFilterValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/cilium/api/npds.pb.go b/vendor/github.com/cilium/proxy/go/cilium/api/npds.pb.go deleted file mode 100644 index 875c26ed8..000000000 --- a/vendor/github.com/cilium/proxy/go/cilium/api/npds.pb.go +++ /dev/null @@ -1,1772 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: cilium/api/npds.proto - -package cilium - -import ( - context "context" - _ "github.com/cilium/proxy/go/envoy/annotations" - v3 "github.com/cilium/proxy/go/envoy/config/core/v3" - v31 "github.com/cilium/proxy/go/envoy/config/route/v3" - v33 "github.com/cilium/proxy/go/envoy/service/discovery/v3" - v32 "github.com/cilium/proxy/go/envoy/type/matcher/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Action specifies what to do when the header matches. -type HeaderMatch_MatchAction int32 - -const ( - HeaderMatch_CONTINUE_ON_MATCH HeaderMatch_MatchAction = 0 // Keep checking other matches (default) - HeaderMatch_FAIL_ON_MATCH HeaderMatch_MatchAction = 1 // Drop the request if no other rule matches - HeaderMatch_DELETE_ON_MATCH HeaderMatch_MatchAction = 2 // Remove the whole matching header -) - -// Enum value maps for HeaderMatch_MatchAction. -var ( - HeaderMatch_MatchAction_name = map[int32]string{ - 0: "CONTINUE_ON_MATCH", - 1: "FAIL_ON_MATCH", - 2: "DELETE_ON_MATCH", - } - HeaderMatch_MatchAction_value = map[string]int32{ - "CONTINUE_ON_MATCH": 0, - "FAIL_ON_MATCH": 1, - "DELETE_ON_MATCH": 2, - } -) - -func (x HeaderMatch_MatchAction) Enum() *HeaderMatch_MatchAction { - p := new(HeaderMatch_MatchAction) - *p = x - return p -} - -func (x HeaderMatch_MatchAction) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (HeaderMatch_MatchAction) Descriptor() protoreflect.EnumDescriptor { - return file_cilium_api_npds_proto_enumTypes[0].Descriptor() -} - -func (HeaderMatch_MatchAction) Type() protoreflect.EnumType { - return &file_cilium_api_npds_proto_enumTypes[0] -} - -func (x HeaderMatch_MatchAction) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use HeaderMatch_MatchAction.Descriptor instead. -func (HeaderMatch_MatchAction) EnumDescriptor() ([]byte, []int) { - return file_cilium_api_npds_proto_rawDescGZIP(), []int{5, 0} -} - -type HeaderMatch_MismatchAction int32 - -const ( - HeaderMatch_FAIL_ON_MISMATCH HeaderMatch_MismatchAction = 0 // Drop the request if no other rule matches (default) - HeaderMatch_CONTINUE_ON_MISMATCH HeaderMatch_MismatchAction = 1 // Keep checking other matches, log the mismatch - HeaderMatch_ADD_ON_MISMATCH HeaderMatch_MismatchAction = 2 // Add 'value' to the multivalued header - HeaderMatch_DELETE_ON_MISMATCH HeaderMatch_MismatchAction = 3 // Remove the whole mismatching header - HeaderMatch_REPLACE_ON_MISMATCH HeaderMatch_MismatchAction = 4 // Replace the whole mismatching header with 'value' -) - -// Enum value maps for HeaderMatch_MismatchAction. -var ( - HeaderMatch_MismatchAction_name = map[int32]string{ - 0: "FAIL_ON_MISMATCH", - 1: "CONTINUE_ON_MISMATCH", - 2: "ADD_ON_MISMATCH", - 3: "DELETE_ON_MISMATCH", - 4: "REPLACE_ON_MISMATCH", - } - HeaderMatch_MismatchAction_value = map[string]int32{ - "FAIL_ON_MISMATCH": 0, - "CONTINUE_ON_MISMATCH": 1, - "ADD_ON_MISMATCH": 2, - "DELETE_ON_MISMATCH": 3, - "REPLACE_ON_MISMATCH": 4, - } -) - -func (x HeaderMatch_MismatchAction) Enum() *HeaderMatch_MismatchAction { - p := new(HeaderMatch_MismatchAction) - *p = x - return p -} - -func (x HeaderMatch_MismatchAction) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (HeaderMatch_MismatchAction) Descriptor() protoreflect.EnumDescriptor { - return file_cilium_api_npds_proto_enumTypes[1].Descriptor() -} - -func (HeaderMatch_MismatchAction) Type() protoreflect.EnumType { - return &file_cilium_api_npds_proto_enumTypes[1] -} - -func (x HeaderMatch_MismatchAction) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use HeaderMatch_MismatchAction.Descriptor instead. -func (HeaderMatch_MismatchAction) EnumDescriptor() ([]byte, []int) { - return file_cilium_api_npds_proto_rawDescGZIP(), []int{5, 1} -} - -// A network policy that is enforced by a filter on the network flows to/from -// associated hosts. -type NetworkPolicy struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // IPs of the endpoint to which this policy applies. - // Required. - EndpointIps []string `protobuf:"bytes,1,rep,name=endpoint_ips,json=endpointIps,proto3" json:"endpoint_ips,omitempty"` - // The endpoint identifier associated with the network policy. - // Required. - EndpointId uint64 `protobuf:"varint,2,opt,name=endpoint_id,json=endpointId,proto3" json:"endpoint_id,omitempty"` - // The part of the policy to be enforced at ingress by the filter, as a set - // of per-port network policies, one per destination L4 port. - // Every PortNetworkPolicy element in this set has a unique port / protocol - // combination. - // Optional. If empty, all flows in this direction are denied. - IngressPerPortPolicies []*PortNetworkPolicy `protobuf:"bytes,3,rep,name=ingress_per_port_policies,json=ingressPerPortPolicies,proto3" json:"ingress_per_port_policies,omitempty"` - // The part of the policy to be enforced at egress by the filter, as a set - // of per-port network policies, one per destination L4 port. - // Every PortNetworkPolicy element in this set has a unique port / protocol - // combination. - // Optional. If empty, all flows in this direction are denied. - EgressPerPortPolicies []*PortNetworkPolicy `protobuf:"bytes,4,rep,name=egress_per_port_policies,json=egressPerPortPolicies,proto3" json:"egress_per_port_policies,omitempty"` - // Name of the conntrack map to use with this policy. - // The paths to various Cilium conntrack maps are derived using this name. - // Optional. If empty, ipcache or hostmap lookup is used instead of conntrack - // map. - ConntrackMapName string `protobuf:"bytes,5,opt,name=conntrack_map_name,json=conntrackMapName,proto3" json:"conntrack_map_name,omitempty"` -} - -func (x *NetworkPolicy) Reset() { - *x = NetworkPolicy{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_npds_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NetworkPolicy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NetworkPolicy) ProtoMessage() {} - -func (x *NetworkPolicy) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_npds_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NetworkPolicy.ProtoReflect.Descriptor instead. -func (*NetworkPolicy) Descriptor() ([]byte, []int) { - return file_cilium_api_npds_proto_rawDescGZIP(), []int{0} -} - -func (x *NetworkPolicy) GetEndpointIps() []string { - if x != nil { - return x.EndpointIps - } - return nil -} - -func (x *NetworkPolicy) GetEndpointId() uint64 { - if x != nil { - return x.EndpointId - } - return 0 -} - -func (x *NetworkPolicy) GetIngressPerPortPolicies() []*PortNetworkPolicy { - if x != nil { - return x.IngressPerPortPolicies - } - return nil -} - -func (x *NetworkPolicy) GetEgressPerPortPolicies() []*PortNetworkPolicy { - if x != nil { - return x.EgressPerPortPolicies - } - return nil -} - -func (x *NetworkPolicy) GetConntrackMapName() string { - if x != nil { - return x.ConntrackMapName - } - return "" -} - -// A network policy to whitelist flows to a specific destination L4 port, -// as a conjunction of predicates on L3/L4/L7 flows. -// If all the predicates of a policy match a flow, the flow is whitelisted. -type PortNetworkPolicy struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The flows' destination L4 port number, as an unsigned 16-bit integer. - // If 0, all destination L4 port numbers are matched by this predicate. - Port uint32 `protobuf:"varint,1,opt,name=port,proto3" json:"port,omitempty"` - // The end of the destination port range, if non-zero. - EndPort uint32 `protobuf:"varint,4,opt,name=end_port,json=endPort,proto3" json:"end_port,omitempty"` - // The flows' L4 transport protocol. - // Required. - Protocol v3.SocketAddress_Protocol `protobuf:"varint,2,opt,name=protocol,proto3,enum=envoy.config.core.v3.SocketAddress_Protocol" json:"protocol,omitempty"` - // The network policy rules to be enforced on the flows to the port. - // Optional. A flow is matched by this predicate if either the set of - // rules is empty or any of the rules matches it. - Rules []*PortNetworkPolicyRule `protobuf:"bytes,3,rep,name=rules,proto3" json:"rules,omitempty"` -} - -func (x *PortNetworkPolicy) Reset() { - *x = PortNetworkPolicy{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_npds_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PortNetworkPolicy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PortNetworkPolicy) ProtoMessage() {} - -func (x *PortNetworkPolicy) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_npds_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PortNetworkPolicy.ProtoReflect.Descriptor instead. -func (*PortNetworkPolicy) Descriptor() ([]byte, []int) { - return file_cilium_api_npds_proto_rawDescGZIP(), []int{1} -} - -func (x *PortNetworkPolicy) GetPort() uint32 { - if x != nil { - return x.Port - } - return 0 -} - -func (x *PortNetworkPolicy) GetEndPort() uint32 { - if x != nil { - return x.EndPort - } - return 0 -} - -func (x *PortNetworkPolicy) GetProtocol() v3.SocketAddress_Protocol { - if x != nil { - return x.Protocol - } - return v3.SocketAddress_TCP -} - -func (x *PortNetworkPolicy) GetRules() []*PortNetworkPolicyRule { - if x != nil { - return x.Rules - } - return nil -} - -type TLSContext struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // CA certificates. If present, the counterparty must provide a valid - // certificate. - // Deprecated, use 'validation_context_sds_secret' instead. - TrustedCa string `protobuf:"bytes,1,opt,name=trusted_ca,json=trustedCa,proto3" json:"trusted_ca,omitempty"` - // Certificate chain. - // Deprecated, use 'tls_sds_secret' instead. - CertificateChain string `protobuf:"bytes,2,opt,name=certificate_chain,json=certificateChain,proto3" json:"certificate_chain,omitempty"` - // Private key - // Deprecated, use 'tls_sds_secret' instead. - PrivateKey string `protobuf:"bytes,3,opt,name=private_key,json=privateKey,proto3" json:"private_key,omitempty"` - // Server Name Indicator. For downstream this helps choose the certificate to - // present to the client. For upstream this will be used as the SNI on the - // client connection. - ServerNames []string `protobuf:"bytes,4,rep,name=server_names,json=serverNames,proto3" json:"server_names,omitempty"` - // Name of an SDS secret for CA certificates. Secret is fetched from the same gRPC source as - // this Network Policy. If present, the counterparty must provide a valid certificate. - // May not be used at the same time with 'trusted_ca'. - ValidationContextSdsSecret string `protobuf:"bytes,5,opt,name=validation_context_sds_secret,json=validationContextSdsSecret,proto3" json:"validation_context_sds_secret,omitempty"` - // Name of an SDS secret for both TLS private key and certificate chain. Secret is fetched - // from the same gRPC source as this Network Policy. - // May not be used at the same time with 'certificate_chain' or 'private_key'. - TlsSdsSecret string `protobuf:"bytes,6,opt,name=tls_sds_secret,json=tlsSdsSecret,proto3" json:"tls_sds_secret,omitempty"` -} - -func (x *TLSContext) Reset() { - *x = TLSContext{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_npds_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TLSContext) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TLSContext) ProtoMessage() {} - -func (x *TLSContext) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_npds_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TLSContext.ProtoReflect.Descriptor instead. -func (*TLSContext) Descriptor() ([]byte, []int) { - return file_cilium_api_npds_proto_rawDescGZIP(), []int{2} -} - -func (x *TLSContext) GetTrustedCa() string { - if x != nil { - return x.TrustedCa - } - return "" -} - -func (x *TLSContext) GetCertificateChain() string { - if x != nil { - return x.CertificateChain - } - return "" -} - -func (x *TLSContext) GetPrivateKey() string { - if x != nil { - return x.PrivateKey - } - return "" -} - -func (x *TLSContext) GetServerNames() []string { - if x != nil { - return x.ServerNames - } - return nil -} - -func (x *TLSContext) GetValidationContextSdsSecret() string { - if x != nil { - return x.ValidationContextSdsSecret - } - return "" -} - -func (x *TLSContext) GetTlsSdsSecret() string { - if x != nil { - return x.TlsSdsSecret - } - return "" -} - -// A network policy rule, as a conjunction of predicates on L3/L7 flows. -// If all the predicates of a rule match a flow, the flow is matched by the -// rule. -type PortNetworkPolicyRule struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Traffic on this port is denied for all `remote_policies` if true - Deny bool `protobuf:"varint,8,opt,name=deny,proto3" json:"deny,omitempty"` - // Optional name for the rule, can be used in logging and error messages. - Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"` - // The set of numeric remote security IDs explicitly allowed or denied. - // A flow is matched by this predicate if the identifier of the policy - // applied on the flow's remote host is contained in this set. - // Optional. If not specified, any remote host is matched by this predicate. - // This field is deprecated, use remote_policies instead. - // TODO: Remove when Cilium 1.14 no longer supported. - DeprecatedRemotePolicies_64 []uint64 `protobuf:"varint,1,rep,packed,name=deprecated_remote_policies_64,json=deprecatedRemotePolicies64,proto3" json:"deprecated_remote_policies_64,omitempty"` - RemotePolicies []uint32 `protobuf:"varint,7,rep,packed,name=remote_policies,json=remotePolicies,proto3" json:"remote_policies,omitempty"` - // Optional downstream TLS context. If present, the incoming connection must - // be a TLS connection. - DownstreamTlsContext *TLSContext `protobuf:"bytes,3,opt,name=downstream_tls_context,json=downstreamTlsContext,proto3" json:"downstream_tls_context,omitempty"` - // Optional upstream TLS context. If present, the outgoing connection will use - // TLS. - UpstreamTlsContext *TLSContext `protobuf:"bytes,4,opt,name=upstream_tls_context,json=upstreamTlsContext,proto3" json:"upstream_tls_context,omitempty"` - // Optional allowed SNIs in TLS handshake. - ServerNames []string `protobuf:"bytes,6,rep,name=server_names,json=serverNames,proto3" json:"server_names,omitempty"` - // Optional L7 protocol parser name. This is only used if the parser is not - // one of the well knows ones. If specified, the l7 parser having this name - // needs to be built in to libcilium.so. - L7Proto string `protobuf:"bytes,2,opt,name=l7_proto,json=l7Proto,proto3" json:"l7_proto,omitempty"` - // Optional. If not specified, any L7 request is matched by this predicate. - // All rules on any given port must have the same type of L7 rules! - // - // Types that are assignable to L7: - // - // *PortNetworkPolicyRule_HttpRules - // *PortNetworkPolicyRule_KafkaRules - // *PortNetworkPolicyRule_L7Rules - L7 isPortNetworkPolicyRule_L7 `protobuf_oneof:"l7"` -} - -func (x *PortNetworkPolicyRule) Reset() { - *x = PortNetworkPolicyRule{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_npds_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PortNetworkPolicyRule) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PortNetworkPolicyRule) ProtoMessage() {} - -func (x *PortNetworkPolicyRule) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_npds_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PortNetworkPolicyRule.ProtoReflect.Descriptor instead. -func (*PortNetworkPolicyRule) Descriptor() ([]byte, []int) { - return file_cilium_api_npds_proto_rawDescGZIP(), []int{3} -} - -func (x *PortNetworkPolicyRule) GetDeny() bool { - if x != nil { - return x.Deny - } - return false -} - -func (x *PortNetworkPolicyRule) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *PortNetworkPolicyRule) GetDeprecatedRemotePolicies_64() []uint64 { - if x != nil { - return x.DeprecatedRemotePolicies_64 - } - return nil -} - -func (x *PortNetworkPolicyRule) GetRemotePolicies() []uint32 { - if x != nil { - return x.RemotePolicies - } - return nil -} - -func (x *PortNetworkPolicyRule) GetDownstreamTlsContext() *TLSContext { - if x != nil { - return x.DownstreamTlsContext - } - return nil -} - -func (x *PortNetworkPolicyRule) GetUpstreamTlsContext() *TLSContext { - if x != nil { - return x.UpstreamTlsContext - } - return nil -} - -func (x *PortNetworkPolicyRule) GetServerNames() []string { - if x != nil { - return x.ServerNames - } - return nil -} - -func (x *PortNetworkPolicyRule) GetL7Proto() string { - if x != nil { - return x.L7Proto - } - return "" -} - -func (m *PortNetworkPolicyRule) GetL7() isPortNetworkPolicyRule_L7 { - if m != nil { - return m.L7 - } - return nil -} - -func (x *PortNetworkPolicyRule) GetHttpRules() *HttpNetworkPolicyRules { - if x, ok := x.GetL7().(*PortNetworkPolicyRule_HttpRules); ok { - return x.HttpRules - } - return nil -} - -func (x *PortNetworkPolicyRule) GetKafkaRules() *KafkaNetworkPolicyRules { - if x, ok := x.GetL7().(*PortNetworkPolicyRule_KafkaRules); ok { - return x.KafkaRules - } - return nil -} - -func (x *PortNetworkPolicyRule) GetL7Rules() *L7NetworkPolicyRules { - if x, ok := x.GetL7().(*PortNetworkPolicyRule_L7Rules); ok { - return x.L7Rules - } - return nil -} - -type isPortNetworkPolicyRule_L7 interface { - isPortNetworkPolicyRule_L7() -} - -type PortNetworkPolicyRule_HttpRules struct { - // The set of HTTP network policy rules. - // An HTTP request is matched by this predicate if any of its rules matches - // the request. - HttpRules *HttpNetworkPolicyRules `protobuf:"bytes,100,opt,name=http_rules,json=httpRules,proto3,oneof"` -} - -type PortNetworkPolicyRule_KafkaRules struct { - // The set of Kafka network policy rules. - // A Kafka request is matched by this predicate if any of its rules matches - // the request. - KafkaRules *KafkaNetworkPolicyRules `protobuf:"bytes,101,opt,name=kafka_rules,json=kafkaRules,proto3,oneof"` -} - -type PortNetworkPolicyRule_L7Rules struct { - // Set of Generic policy rules used when 'l7_proto' is defined. - // Only to be used for l7 protocols for which a specific oneof - // is not defined - L7Rules *L7NetworkPolicyRules `protobuf:"bytes,102,opt,name=l7_rules,json=l7Rules,proto3,oneof"` -} - -func (*PortNetworkPolicyRule_HttpRules) isPortNetworkPolicyRule_L7() {} - -func (*PortNetworkPolicyRule_KafkaRules) isPortNetworkPolicyRule_L7() {} - -func (*PortNetworkPolicyRule_L7Rules) isPortNetworkPolicyRule_L7() {} - -// A set of network policy rules that match HTTP requests. -type HttpNetworkPolicyRules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The set of HTTP network policy rules. - // An HTTP request is matched if any of its rules matches the request. - // Required and may not be empty. - HttpRules []*HttpNetworkPolicyRule `protobuf:"bytes,1,rep,name=http_rules,json=httpRules,proto3" json:"http_rules,omitempty"` -} - -func (x *HttpNetworkPolicyRules) Reset() { - *x = HttpNetworkPolicyRules{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_npds_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HttpNetworkPolicyRules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HttpNetworkPolicyRules) ProtoMessage() {} - -func (x *HttpNetworkPolicyRules) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_npds_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HttpNetworkPolicyRules.ProtoReflect.Descriptor instead. -func (*HttpNetworkPolicyRules) Descriptor() ([]byte, []int) { - return file_cilium_api_npds_proto_rawDescGZIP(), []int{4} -} - -func (x *HttpNetworkPolicyRules) GetHttpRules() []*HttpNetworkPolicyRule { - if x != nil { - return x.HttpRules - } - return nil -} - -type HeaderMatch struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` // empty for presence match. For secret data use 'value_sds_secret' instead. - MatchAction HeaderMatch_MatchAction `protobuf:"varint,3,opt,name=match_action,json=matchAction,proto3,enum=cilium.HeaderMatch_MatchAction" json:"match_action,omitempty"` - MismatchAction HeaderMatch_MismatchAction `protobuf:"varint,4,opt,name=mismatch_action,json=mismatchAction,proto3,enum=cilium.HeaderMatch_MismatchAction" json:"mismatch_action,omitempty"` - // Generic secret name for fetching value via SDS. Secret is fetched from the same gRPC source as - // this Network Policy. - ValueSdsSecret string `protobuf:"bytes,5,opt,name=value_sds_secret,json=valueSdsSecret,proto3" json:"value_sds_secret,omitempty"` -} - -func (x *HeaderMatch) Reset() { - *x = HeaderMatch{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_npds_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HeaderMatch) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HeaderMatch) ProtoMessage() {} - -func (x *HeaderMatch) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_npds_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HeaderMatch.ProtoReflect.Descriptor instead. -func (*HeaderMatch) Descriptor() ([]byte, []int) { - return file_cilium_api_npds_proto_rawDescGZIP(), []int{5} -} - -func (x *HeaderMatch) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *HeaderMatch) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -func (x *HeaderMatch) GetMatchAction() HeaderMatch_MatchAction { - if x != nil { - return x.MatchAction - } - return HeaderMatch_CONTINUE_ON_MATCH -} - -func (x *HeaderMatch) GetMismatchAction() HeaderMatch_MismatchAction { - if x != nil { - return x.MismatchAction - } - return HeaderMatch_FAIL_ON_MISMATCH -} - -func (x *HeaderMatch) GetValueSdsSecret() string { - if x != nil { - return x.ValueSdsSecret - } - return "" -} - -// An HTTP network policy rule, as a conjunction of predicates on HTTP requests. -// If all the predicates of a rule match an HTTP request, the request is -// allowed. Otherwise, it is denied. -type HttpNetworkPolicyRule struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // A set of matchers on the HTTP request's headers' names and values. - // If all the matchers in this set match an HTTP request, the request is - // allowed by this rule. Otherwise, it is denied. - // - // Some special header names are: - // - // * *:uri*: The HTTP request's URI. - // * *:method*: The HTTP request's method. - // * *:authority*: Also maps to the HTTP 1.1 *Host* header. - // - // Optional. If empty, matches any HTTP request. - Headers []*v31.HeaderMatcher `protobuf:"bytes,1,rep,name=headers,proto3" json:"headers,omitempty"` - // header_matches is a set of HTTP header name and value pairs that - // will be matched against the request headers, if all the other match - // requirements in 'headers' are met. Each HeaderAction determines what to do - // when there is a match or mismatch. - // - // Optional. - HeaderMatches []*HeaderMatch `protobuf:"bytes,2,rep,name=header_matches,json=headerMatches,proto3" json:"header_matches,omitempty"` -} - -func (x *HttpNetworkPolicyRule) Reset() { - *x = HttpNetworkPolicyRule{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_npds_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HttpNetworkPolicyRule) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HttpNetworkPolicyRule) ProtoMessage() {} - -func (x *HttpNetworkPolicyRule) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_npds_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HttpNetworkPolicyRule.ProtoReflect.Descriptor instead. -func (*HttpNetworkPolicyRule) Descriptor() ([]byte, []int) { - return file_cilium_api_npds_proto_rawDescGZIP(), []int{6} -} - -func (x *HttpNetworkPolicyRule) GetHeaders() []*v31.HeaderMatcher { - if x != nil { - return x.Headers - } - return nil -} - -func (x *HttpNetworkPolicyRule) GetHeaderMatches() []*HeaderMatch { - if x != nil { - return x.HeaderMatches - } - return nil -} - -// A set of network policy rules that match Kafka requests. -type KafkaNetworkPolicyRules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The set of Kafka network policy rules. - // A Kafka request is matched if any of its rules matches the request. - // Required and may not be empty. - KafkaRules []*KafkaNetworkPolicyRule `protobuf:"bytes,1,rep,name=kafka_rules,json=kafkaRules,proto3" json:"kafka_rules,omitempty"` -} - -func (x *KafkaNetworkPolicyRules) Reset() { - *x = KafkaNetworkPolicyRules{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_npds_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *KafkaNetworkPolicyRules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*KafkaNetworkPolicyRules) ProtoMessage() {} - -func (x *KafkaNetworkPolicyRules) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_npds_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use KafkaNetworkPolicyRules.ProtoReflect.Descriptor instead. -func (*KafkaNetworkPolicyRules) Descriptor() ([]byte, []int) { - return file_cilium_api_npds_proto_rawDescGZIP(), []int{7} -} - -func (x *KafkaNetworkPolicyRules) GetKafkaRules() []*KafkaNetworkPolicyRule { - if x != nil { - return x.KafkaRules - } - return nil -} - -// A Kafka network policy rule, as a conjunction of predicates on Kafka -// requests. If all the predicates of a rule match a Kafka request, the request -// is allowed. Otherwise, it is denied. -type KafkaNetworkPolicyRule struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The Kafka request's API version. - // If < 0, all Kafka requests are matched by this predicate. - ApiVersion int32 `protobuf:"varint,1,opt,name=api_version,json=apiVersion,proto3" json:"api_version,omitempty"` - // Set of allowed API keys in the Kafka request. - // If none, all Kafka requests are matched by this predicate. - ApiKeys []int32 `protobuf:"varint,2,rep,packed,name=api_keys,json=apiKeys,proto3" json:"api_keys,omitempty"` - // The Kafka request's client ID. - // Optional. If not specified, all Kafka requests are matched by this - // predicate. If specified, this predicates only matches requests that contain - // this client ID, and never matches requests that don't contain any client - // ID. - ClientId string `protobuf:"bytes,3,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` - // The Kafka request's topic. - // Optional. If not specified, this rule will not consider the Kafka request's - // topics. If specified, this predicates only matches requests that contain - // this topic, and never matches requests that don't contain any topic. - // However, messages that can not contain a topic will also me matched. - Topic string `protobuf:"bytes,4,opt,name=topic,proto3" json:"topic,omitempty"` -} - -func (x *KafkaNetworkPolicyRule) Reset() { - *x = KafkaNetworkPolicyRule{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_npds_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *KafkaNetworkPolicyRule) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*KafkaNetworkPolicyRule) ProtoMessage() {} - -func (x *KafkaNetworkPolicyRule) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_npds_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use KafkaNetworkPolicyRule.ProtoReflect.Descriptor instead. -func (*KafkaNetworkPolicyRule) Descriptor() ([]byte, []int) { - return file_cilium_api_npds_proto_rawDescGZIP(), []int{8} -} - -func (x *KafkaNetworkPolicyRule) GetApiVersion() int32 { - if x != nil { - return x.ApiVersion - } - return 0 -} - -func (x *KafkaNetworkPolicyRule) GetApiKeys() []int32 { - if x != nil { - return x.ApiKeys - } - return nil -} - -func (x *KafkaNetworkPolicyRule) GetClientId() string { - if x != nil { - return x.ClientId - } - return "" -} - -func (x *KafkaNetworkPolicyRule) GetTopic() string { - if x != nil { - return x.Topic - } - return "" -} - -// A set of network policy rules that match generic L7 requests. -type L7NetworkPolicyRules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The set of allowing l7 policy rules. - // A request is allowed if any of these rules matches the request, - // and the request does not match any of the deny rules. - // Optional. If missing or empty then all requests are allowed, unless - // denied by a deny rule. - L7AllowRules []*L7NetworkPolicyRule `protobuf:"bytes,1,rep,name=l7_allow_rules,json=l7AllowRules,proto3" json:"l7_allow_rules,omitempty"` - // The set of denying l7 policy rules. - // A request is denied if any of these rules matches the request. - // A request that is not denied may be allowed by 'l7_allow_rules'. - // Optional. - L7DenyRules []*L7NetworkPolicyRule `protobuf:"bytes,2,rep,name=l7_deny_rules,json=l7DenyRules,proto3" json:"l7_deny_rules,omitempty"` -} - -func (x *L7NetworkPolicyRules) Reset() { - *x = L7NetworkPolicyRules{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_npds_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *L7NetworkPolicyRules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*L7NetworkPolicyRules) ProtoMessage() {} - -func (x *L7NetworkPolicyRules) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_npds_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use L7NetworkPolicyRules.ProtoReflect.Descriptor instead. -func (*L7NetworkPolicyRules) Descriptor() ([]byte, []int) { - return file_cilium_api_npds_proto_rawDescGZIP(), []int{9} -} - -func (x *L7NetworkPolicyRules) GetL7AllowRules() []*L7NetworkPolicyRule { - if x != nil { - return x.L7AllowRules - } - return nil -} - -func (x *L7NetworkPolicyRules) GetL7DenyRules() []*L7NetworkPolicyRule { - if x != nil { - return x.L7DenyRules - } - return nil -} - -// A generic L7 policy rule, as a conjunction of predicates on l7 requests. -// If all the predicates of a rule match a request, the request is allowed. -// Otherwise, it is denied. -type L7NetworkPolicyRule struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Optional rule name, can be used in logging and error messages. - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - // Generic rule for Go extensions. - // Optional. If empty, matches any request. Not allowed if 'metadata_rule' is - // present. - Rule map[string]string `protobuf:"bytes,1,rep,name=rule,proto3" json:"rule,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // Generic rule for Envoy metadata enforcement. All matchers must match for - // the rule to allow the request/connection. Optional. If empty, matches any - // request. Not allowed if 'rule' is present. - MetadataRule []*v32.MetadataMatcher `protobuf:"bytes,2,rep,name=metadata_rule,json=metadataRule,proto3" json:"metadata_rule,omitempty"` -} - -func (x *L7NetworkPolicyRule) Reset() { - *x = L7NetworkPolicyRule{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_npds_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *L7NetworkPolicyRule) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*L7NetworkPolicyRule) ProtoMessage() {} - -func (x *L7NetworkPolicyRule) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_npds_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use L7NetworkPolicyRule.ProtoReflect.Descriptor instead. -func (*L7NetworkPolicyRule) Descriptor() ([]byte, []int) { - return file_cilium_api_npds_proto_rawDescGZIP(), []int{10} -} - -func (x *L7NetworkPolicyRule) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *L7NetworkPolicyRule) GetRule() map[string]string { - if x != nil { - return x.Rule - } - return nil -} - -func (x *L7NetworkPolicyRule) GetMetadataRule() []*v32.MetadataMatcher { - if x != nil { - return x.MetadataRule - } - return nil -} - -// Cilium's network policy manager fills this message with all currently known network policies. -type NetworkPoliciesConfigDump struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The loaded networkpolicy configs. - Networkpolicies []*NetworkPolicy `protobuf:"bytes,1,rep,name=networkpolicies,proto3" json:"networkpolicies,omitempty"` -} - -func (x *NetworkPoliciesConfigDump) Reset() { - *x = NetworkPoliciesConfigDump{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_npds_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NetworkPoliciesConfigDump) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NetworkPoliciesConfigDump) ProtoMessage() {} - -func (x *NetworkPoliciesConfigDump) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_npds_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NetworkPoliciesConfigDump.ProtoReflect.Descriptor instead. -func (*NetworkPoliciesConfigDump) Descriptor() ([]byte, []int) { - return file_cilium_api_npds_proto_rawDescGZIP(), []int{11} -} - -func (x *NetworkPoliciesConfigDump) GetNetworkpolicies() []*NetworkPolicy { - if x != nil { - return x.Networkpolicies - } - return nil -} - -var File_cilium_api_npds_proto protoreflect.FileDescriptor - -var file_cilium_api_npds_proto_rawDesc = []byte{ - 0x0a, 0x15, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x70, 0x64, - 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x1a, - 0x22, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, - 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x2c, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, - 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x2a, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x33, 0x2f, 0x64, 0x69, - 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x24, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x20, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbd, 0x02, 0x0a, - 0x0d, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x33, - 0x0a, 0x0c, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x69, 0x70, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x09, 0x42, 0x10, 0xfa, 0x42, 0x0d, 0x92, 0x01, 0x0a, 0x08, 0x01, 0x10, 0x02, - 0x22, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0b, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, - 0x49, 0x70, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, - 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, - 0x6e, 0x74, 0x49, 0x64, 0x12, 0x54, 0x0a, 0x19, 0x69, 0x6e, 0x67, 0x72, 0x65, 0x73, 0x73, 0x5f, - 0x70, 0x65, 0x72, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, - 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, - 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x52, 0x16, 0x69, 0x6e, 0x67, 0x72, 0x65, 0x73, 0x73, 0x50, 0x65, 0x72, 0x50, 0x6f, - 0x72, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, 0x52, 0x0a, 0x18, 0x65, 0x67, - 0x72, 0x65, 0x73, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, - 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, - 0x6b, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x15, 0x65, 0x67, 0x72, 0x65, 0x73, 0x73, 0x50, - 0x65, 0x72, 0x50, 0x6f, 0x72, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, 0x2c, - 0x0a, 0x12, 0x63, 0x6f, 0x6e, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x5f, 0x6d, 0x61, 0x70, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6e, 0x6e, - 0x74, 0x72, 0x61, 0x63, 0x6b, 0x4d, 0x61, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xd7, 0x01, 0x0a, - 0x11, 0x50, 0x6f, 0x72, 0x74, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x12, 0x1d, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, - 0x42, 0x09, 0xfa, 0x42, 0x06, 0x2a, 0x04, 0x18, 0xff, 0xff, 0x03, 0x52, 0x04, 0x70, 0x6f, 0x72, - 0x74, 0x12, 0x24, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0d, 0x42, 0x09, 0xfa, 0x42, 0x06, 0x2a, 0x04, 0x18, 0xff, 0xff, 0x03, 0x52, 0x07, - 0x65, 0x6e, 0x64, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x48, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x63, 0x6f, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, - 0x2e, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, - 0x6c, 0x12, 0x33, 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x1d, 0x2e, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x4e, 0x65, - 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x52, - 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x22, 0x85, 0x02, 0x0a, 0x0a, 0x54, 0x4c, 0x53, 0x43, 0x6f, - 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, 0x64, - 0x5f, 0x63, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x72, 0x75, 0x73, 0x74, - 0x65, 0x64, 0x43, 0x61, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, - 0x61, 0x74, 0x65, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x10, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x69, - 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x5f, 0x6b, 0x65, 0x79, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, - 0x65, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, - 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x41, 0x0a, 0x1d, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x5f, 0x73, 0x64, 0x73, 0x5f, - 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x1a, 0x76, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x53, - 0x64, 0x73, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x24, 0x0a, 0x0e, 0x74, 0x6c, 0x73, 0x5f, - 0x73, 0x64, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0c, 0x74, 0x6c, 0x73, 0x53, 0x64, 0x73, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x22, 0xbf, - 0x04, 0x0a, 0x15, 0x50, 0x6f, 0x72, 0x74, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x65, 0x6e, 0x79, - 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x64, 0x65, 0x6e, 0x79, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x41, 0x0a, 0x1d, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x72, - 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x5f, 0x36, - 0x34, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04, 0x52, 0x1a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, - 0x74, 0x65, 0x64, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, - 0x73, 0x36, 0x34, 0x12, 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x0e, 0x72, 0x65, - 0x6d, 0x6f, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, 0x48, 0x0a, 0x16, - 0x64, 0x6f, 0x77, 0x6e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x74, 0x6c, 0x73, 0x5f, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, - 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2e, 0x54, 0x4c, 0x53, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, - 0x52, 0x14, 0x64, 0x6f, 0x77, 0x6e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x54, 0x6c, 0x73, 0x43, - 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x44, 0x0a, 0x14, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x5f, 0x74, 0x6c, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2e, 0x54, 0x4c, - 0x53, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, 0x12, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x54, 0x6c, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x21, 0x0a, 0x0c, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, - 0x19, 0x0a, 0x08, 0x6c, 0x37, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x6c, 0x37, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x3f, 0x0a, 0x0a, 0x68, 0x74, - 0x74, 0x70, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, - 0x2e, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x4e, 0x65, 0x74, 0x77, - 0x6f, 0x72, 0x6b, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, - 0x52, 0x09, 0x68, 0x74, 0x74, 0x70, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x42, 0x0a, 0x0b, 0x6b, - 0x61, 0x66, 0x6b, 0x61, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1f, 0x2e, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2e, 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x4e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x75, 0x6c, 0x65, - 0x73, 0x48, 0x00, 0x52, 0x0a, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, - 0x39, 0x0a, 0x08, 0x6c, 0x37, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x66, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2e, 0x4c, 0x37, 0x4e, 0x65, 0x74, - 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, - 0x00, 0x52, 0x07, 0x6c, 0x37, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x42, 0x04, 0x0a, 0x02, 0x6c, 0x37, - 0x22, 0x60, 0x0a, 0x16, 0x48, 0x74, 0x74, 0x70, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x46, 0x0a, 0x0a, 0x68, 0x74, - 0x74, 0x70, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, - 0x2e, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x4e, 0x65, 0x74, 0x77, - 0x6f, 0x72, 0x6b, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x42, 0x08, 0xfa, - 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x09, 0x68, 0x74, 0x74, 0x70, 0x52, 0x75, 0x6c, - 0x65, 0x73, 0x22, 0xd2, 0x03, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x42, 0x0a, 0x0c, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x63, 0x69, - 0x6c, 0x69, 0x75, 0x6d, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, - 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x6d, 0x61, - 0x74, 0x63, 0x68, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4b, 0x0a, 0x0f, 0x6d, 0x69, 0x73, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x22, 0x2e, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2e, 0x48, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x2e, 0x4d, 0x69, 0x73, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x6d, 0x69, 0x73, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x10, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, - 0x73, 0x64, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0e, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x64, 0x73, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, - 0x22, 0x4c, 0x0a, 0x0b, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x15, 0x0a, 0x11, 0x43, 0x4f, 0x4e, 0x54, 0x49, 0x4e, 0x55, 0x45, 0x5f, 0x4f, 0x4e, 0x5f, 0x4d, - 0x41, 0x54, 0x43, 0x48, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x46, 0x41, 0x49, 0x4c, 0x5f, 0x4f, - 0x4e, 0x5f, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, 0x44, 0x45, 0x4c, - 0x45, 0x54, 0x45, 0x5f, 0x4f, 0x4e, 0x5f, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x10, 0x02, 0x22, 0x86, - 0x01, 0x0a, 0x0e, 0x4d, 0x69, 0x73, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x41, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x14, 0x0a, 0x10, 0x46, 0x41, 0x49, 0x4c, 0x5f, 0x4f, 0x4e, 0x5f, 0x4d, 0x49, 0x53, - 0x4d, 0x41, 0x54, 0x43, 0x48, 0x10, 0x00, 0x12, 0x18, 0x0a, 0x14, 0x43, 0x4f, 0x4e, 0x54, 0x49, - 0x4e, 0x55, 0x45, 0x5f, 0x4f, 0x4e, 0x5f, 0x4d, 0x49, 0x53, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x10, - 0x01, 0x12, 0x13, 0x0a, 0x0f, 0x41, 0x44, 0x44, 0x5f, 0x4f, 0x4e, 0x5f, 0x4d, 0x49, 0x53, 0x4d, - 0x41, 0x54, 0x43, 0x48, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, - 0x5f, 0x4f, 0x4e, 0x5f, 0x4d, 0x49, 0x53, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x10, 0x03, 0x12, 0x17, - 0x0a, 0x13, 0x52, 0x45, 0x50, 0x4c, 0x41, 0x43, 0x45, 0x5f, 0x4f, 0x4e, 0x5f, 0x4d, 0x49, 0x53, - 0x4d, 0x41, 0x54, 0x43, 0x48, 0x10, 0x04, 0x22, 0x93, 0x01, 0x0a, 0x15, 0x48, 0x74, 0x74, 0x70, - 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x75, 0x6c, - 0x65, 0x12, 0x3e, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x73, 0x12, 0x3a, 0x0a, 0x0e, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x74, 0x63, - 0x68, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x69, 0x6c, 0x69, - 0x75, 0x6d, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x52, 0x0d, - 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x22, 0x64, 0x0a, - 0x17, 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x49, 0x0a, 0x0b, 0x6b, 0x61, 0x66, 0x6b, - 0x61, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, - 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2e, 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x4e, 0x65, 0x74, 0x77, - 0x6f, 0x72, 0x6b, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x42, 0x08, 0xfa, - 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x0a, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x52, 0x75, - 0x6c, 0x65, 0x73, 0x22, 0xbe, 0x01, 0x0a, 0x16, 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x4e, 0x65, 0x74, - 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x1f, - 0x0a, 0x0b, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x19, 0x0a, 0x08, 0x61, 0x70, 0x69, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x05, 0x52, 0x07, 0x61, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x35, 0x0a, 0x09, 0x63, 0x6c, - 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xfa, - 0x42, 0x15, 0x72, 0x13, 0x32, 0x11, 0x5e, 0x5b, 0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0x30, 0x2d, - 0x39, 0x2e, 0x5f, 0x2d, 0x5d, 0x2a, 0x24, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, - 0x64, 0x12, 0x31, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x1b, 0xfa, 0x42, 0x18, 0x72, 0x16, 0x18, 0xff, 0x01, 0x32, 0x11, 0x5e, 0x5b, 0x61, 0x2d, - 0x7a, 0x41, 0x2d, 0x5a, 0x30, 0x2d, 0x39, 0x2e, 0x5f, 0x2d, 0x5d, 0x2a, 0x24, 0x52, 0x05, 0x74, - 0x6f, 0x70, 0x69, 0x63, 0x22, 0x9a, 0x01, 0x0a, 0x14, 0x4c, 0x37, 0x4e, 0x65, 0x74, 0x77, 0x6f, - 0x72, 0x6b, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x41, 0x0a, - 0x0e, 0x6c, 0x37, 0x5f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2e, 0x4c, - 0x37, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x75, - 0x6c, 0x65, 0x52, 0x0c, 0x6c, 0x37, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x52, 0x75, 0x6c, 0x65, 0x73, - 0x12, 0x3f, 0x0a, 0x0d, 0x6c, 0x37, 0x5f, 0x64, 0x65, 0x6e, 0x79, 0x5f, 0x72, 0x75, 0x6c, 0x65, - 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, - 0x2e, 0x4c, 0x37, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x52, 0x75, 0x6c, 0x65, 0x52, 0x0b, 0x6c, 0x37, 0x44, 0x65, 0x6e, 0x79, 0x52, 0x75, 0x6c, 0x65, - 0x73, 0x22, 0xea, 0x01, 0x0a, 0x13, 0x4c, 0x37, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x39, 0x0a, - 0x04, 0x72, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x63, 0x69, - 0x6c, 0x69, 0x75, 0x6d, 0x2e, 0x4c, 0x37, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x2e, 0x52, 0x75, 0x6c, 0x65, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x52, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x12, 0x4b, 0x0a, 0x0d, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x26, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x52, 0x0c, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x52, 0x75, 0x6c, 0x65, 0x1a, 0x37, 0x0a, 0x09, 0x52, 0x75, 0x6c, 0x65, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x5c, - 0x0a, 0x19, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, - 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x75, 0x6d, 0x70, 0x12, 0x3f, 0x0a, 0x0f, 0x6e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2e, 0x4e, 0x65, - 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x0f, 0x6e, 0x65, 0x74, - 0x77, 0x6f, 0x72, 0x6b, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x32, 0xda, 0x02, 0x0a, - 0x1d, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x44, 0x69, - 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7a, - 0x0a, 0x15, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, - 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, 0x2c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, - 0x79, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, - 0x76, 0x33, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x9e, 0x01, 0x0a, 0x14, 0x46, - 0x65, 0x74, 0x63, 0x68, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x6f, 0x6c, 0x69, 0x63, - 0x69, 0x65, 0x73, 0x12, 0x2c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x33, - 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x2d, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x33, 0x2e, 0x44, - 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x29, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x22, 0x1e, 0x2f, 0x76, 0x33, 0x2f, 0x64, 0x69, - 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x3a, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, - 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x3a, 0x01, 0x2a, 0x1a, 0x1c, 0x8a, 0xa4, 0x96, - 0xf3, 0x07, 0x16, 0x0a, 0x14, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2e, 0x4e, 0x65, 0x74, 0x77, - 0x6f, 0x72, 0x6b, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x42, 0x2e, 0x5a, 0x2c, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x70, - 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x61, - 0x70, 0x69, 0x3b, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} - -var ( - file_cilium_api_npds_proto_rawDescOnce sync.Once - file_cilium_api_npds_proto_rawDescData = file_cilium_api_npds_proto_rawDesc -) - -func file_cilium_api_npds_proto_rawDescGZIP() []byte { - file_cilium_api_npds_proto_rawDescOnce.Do(func() { - file_cilium_api_npds_proto_rawDescData = protoimpl.X.CompressGZIP(file_cilium_api_npds_proto_rawDescData) - }) - return file_cilium_api_npds_proto_rawDescData -} - -var file_cilium_api_npds_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_cilium_api_npds_proto_msgTypes = make([]protoimpl.MessageInfo, 13) -var file_cilium_api_npds_proto_goTypes = []interface{}{ - (HeaderMatch_MatchAction)(0), // 0: cilium.HeaderMatch.MatchAction - (HeaderMatch_MismatchAction)(0), // 1: cilium.HeaderMatch.MismatchAction - (*NetworkPolicy)(nil), // 2: cilium.NetworkPolicy - (*PortNetworkPolicy)(nil), // 3: cilium.PortNetworkPolicy - (*TLSContext)(nil), // 4: cilium.TLSContext - (*PortNetworkPolicyRule)(nil), // 5: cilium.PortNetworkPolicyRule - (*HttpNetworkPolicyRules)(nil), // 6: cilium.HttpNetworkPolicyRules - (*HeaderMatch)(nil), // 7: cilium.HeaderMatch - (*HttpNetworkPolicyRule)(nil), // 8: cilium.HttpNetworkPolicyRule - (*KafkaNetworkPolicyRules)(nil), // 9: cilium.KafkaNetworkPolicyRules - (*KafkaNetworkPolicyRule)(nil), // 10: cilium.KafkaNetworkPolicyRule - (*L7NetworkPolicyRules)(nil), // 11: cilium.L7NetworkPolicyRules - (*L7NetworkPolicyRule)(nil), // 12: cilium.L7NetworkPolicyRule - (*NetworkPoliciesConfigDump)(nil), // 13: cilium.NetworkPoliciesConfigDump - nil, // 14: cilium.L7NetworkPolicyRule.RuleEntry - (v3.SocketAddress_Protocol)(0), // 15: envoy.config.core.v3.SocketAddress.Protocol - (*v31.HeaderMatcher)(nil), // 16: envoy.config.route.v3.HeaderMatcher - (*v32.MetadataMatcher)(nil), // 17: envoy.type.matcher.v3.MetadataMatcher - (*v33.DiscoveryRequest)(nil), // 18: envoy.service.discovery.v3.DiscoveryRequest - (*v33.DiscoveryResponse)(nil), // 19: envoy.service.discovery.v3.DiscoveryResponse -} -var file_cilium_api_npds_proto_depIdxs = []int32{ - 3, // 0: cilium.NetworkPolicy.ingress_per_port_policies:type_name -> cilium.PortNetworkPolicy - 3, // 1: cilium.NetworkPolicy.egress_per_port_policies:type_name -> cilium.PortNetworkPolicy - 15, // 2: cilium.PortNetworkPolicy.protocol:type_name -> envoy.config.core.v3.SocketAddress.Protocol - 5, // 3: cilium.PortNetworkPolicy.rules:type_name -> cilium.PortNetworkPolicyRule - 4, // 4: cilium.PortNetworkPolicyRule.downstream_tls_context:type_name -> cilium.TLSContext - 4, // 5: cilium.PortNetworkPolicyRule.upstream_tls_context:type_name -> cilium.TLSContext - 6, // 6: cilium.PortNetworkPolicyRule.http_rules:type_name -> cilium.HttpNetworkPolicyRules - 9, // 7: cilium.PortNetworkPolicyRule.kafka_rules:type_name -> cilium.KafkaNetworkPolicyRules - 11, // 8: cilium.PortNetworkPolicyRule.l7_rules:type_name -> cilium.L7NetworkPolicyRules - 8, // 9: cilium.HttpNetworkPolicyRules.http_rules:type_name -> cilium.HttpNetworkPolicyRule - 0, // 10: cilium.HeaderMatch.match_action:type_name -> cilium.HeaderMatch.MatchAction - 1, // 11: cilium.HeaderMatch.mismatch_action:type_name -> cilium.HeaderMatch.MismatchAction - 16, // 12: cilium.HttpNetworkPolicyRule.headers:type_name -> envoy.config.route.v3.HeaderMatcher - 7, // 13: cilium.HttpNetworkPolicyRule.header_matches:type_name -> cilium.HeaderMatch - 10, // 14: cilium.KafkaNetworkPolicyRules.kafka_rules:type_name -> cilium.KafkaNetworkPolicyRule - 12, // 15: cilium.L7NetworkPolicyRules.l7_allow_rules:type_name -> cilium.L7NetworkPolicyRule - 12, // 16: cilium.L7NetworkPolicyRules.l7_deny_rules:type_name -> cilium.L7NetworkPolicyRule - 14, // 17: cilium.L7NetworkPolicyRule.rule:type_name -> cilium.L7NetworkPolicyRule.RuleEntry - 17, // 18: cilium.L7NetworkPolicyRule.metadata_rule:type_name -> envoy.type.matcher.v3.MetadataMatcher - 2, // 19: cilium.NetworkPoliciesConfigDump.networkpolicies:type_name -> cilium.NetworkPolicy - 18, // 20: cilium.NetworkPolicyDiscoveryService.StreamNetworkPolicies:input_type -> envoy.service.discovery.v3.DiscoveryRequest - 18, // 21: cilium.NetworkPolicyDiscoveryService.FetchNetworkPolicies:input_type -> envoy.service.discovery.v3.DiscoveryRequest - 19, // 22: cilium.NetworkPolicyDiscoveryService.StreamNetworkPolicies:output_type -> envoy.service.discovery.v3.DiscoveryResponse - 19, // 23: cilium.NetworkPolicyDiscoveryService.FetchNetworkPolicies:output_type -> envoy.service.discovery.v3.DiscoveryResponse - 22, // [22:24] is the sub-list for method output_type - 20, // [20:22] is the sub-list for method input_type - 20, // [20:20] is the sub-list for extension type_name - 20, // [20:20] is the sub-list for extension extendee - 0, // [0:20] is the sub-list for field type_name -} - -func init() { file_cilium_api_npds_proto_init() } -func file_cilium_api_npds_proto_init() { - if File_cilium_api_npds_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_cilium_api_npds_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NetworkPolicy); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cilium_api_npds_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PortNetworkPolicy); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cilium_api_npds_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TLSContext); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cilium_api_npds_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PortNetworkPolicyRule); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cilium_api_npds_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HttpNetworkPolicyRules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cilium_api_npds_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HeaderMatch); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cilium_api_npds_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HttpNetworkPolicyRule); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cilium_api_npds_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*KafkaNetworkPolicyRules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cilium_api_npds_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*KafkaNetworkPolicyRule); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cilium_api_npds_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*L7NetworkPolicyRules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cilium_api_npds_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*L7NetworkPolicyRule); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cilium_api_npds_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NetworkPoliciesConfigDump); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_cilium_api_npds_proto_msgTypes[3].OneofWrappers = []interface{}{ - (*PortNetworkPolicyRule_HttpRules)(nil), - (*PortNetworkPolicyRule_KafkaRules)(nil), - (*PortNetworkPolicyRule_L7Rules)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cilium_api_npds_proto_rawDesc, - NumEnums: 2, - NumMessages: 13, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_cilium_api_npds_proto_goTypes, - DependencyIndexes: file_cilium_api_npds_proto_depIdxs, - EnumInfos: file_cilium_api_npds_proto_enumTypes, - MessageInfos: file_cilium_api_npds_proto_msgTypes, - }.Build() - File_cilium_api_npds_proto = out.File - file_cilium_api_npds_proto_rawDesc = nil - file_cilium_api_npds_proto_goTypes = nil - file_cilium_api_npds_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// 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.SupportPackageIsVersion6 - -// NetworkPolicyDiscoveryServiceClient is the client API for NetworkPolicyDiscoveryService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type NetworkPolicyDiscoveryServiceClient interface { - StreamNetworkPolicies(ctx context.Context, opts ...grpc.CallOption) (NetworkPolicyDiscoveryService_StreamNetworkPoliciesClient, error) - FetchNetworkPolicies(ctx context.Context, in *v33.DiscoveryRequest, opts ...grpc.CallOption) (*v33.DiscoveryResponse, error) -} - -type networkPolicyDiscoveryServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewNetworkPolicyDiscoveryServiceClient(cc grpc.ClientConnInterface) NetworkPolicyDiscoveryServiceClient { - return &networkPolicyDiscoveryServiceClient{cc} -} - -func (c *networkPolicyDiscoveryServiceClient) StreamNetworkPolicies(ctx context.Context, opts ...grpc.CallOption) (NetworkPolicyDiscoveryService_StreamNetworkPoliciesClient, error) { - stream, err := c.cc.NewStream(ctx, &_NetworkPolicyDiscoveryService_serviceDesc.Streams[0], "/cilium.NetworkPolicyDiscoveryService/StreamNetworkPolicies", opts...) - if err != nil { - return nil, err - } - x := &networkPolicyDiscoveryServiceStreamNetworkPoliciesClient{stream} - return x, nil -} - -type NetworkPolicyDiscoveryService_StreamNetworkPoliciesClient interface { - Send(*v33.DiscoveryRequest) error - Recv() (*v33.DiscoveryResponse, error) - grpc.ClientStream -} - -type networkPolicyDiscoveryServiceStreamNetworkPoliciesClient struct { - grpc.ClientStream -} - -func (x *networkPolicyDiscoveryServiceStreamNetworkPoliciesClient) Send(m *v33.DiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *networkPolicyDiscoveryServiceStreamNetworkPoliciesClient) Recv() (*v33.DiscoveryResponse, error) { - m := new(v33.DiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *networkPolicyDiscoveryServiceClient) FetchNetworkPolicies(ctx context.Context, in *v33.DiscoveryRequest, opts ...grpc.CallOption) (*v33.DiscoveryResponse, error) { - out := new(v33.DiscoveryResponse) - err := c.cc.Invoke(ctx, "/cilium.NetworkPolicyDiscoveryService/FetchNetworkPolicies", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// NetworkPolicyDiscoveryServiceServer is the server API for NetworkPolicyDiscoveryService service. -type NetworkPolicyDiscoveryServiceServer interface { - StreamNetworkPolicies(NetworkPolicyDiscoveryService_StreamNetworkPoliciesServer) error - FetchNetworkPolicies(context.Context, *v33.DiscoveryRequest) (*v33.DiscoveryResponse, error) -} - -// UnimplementedNetworkPolicyDiscoveryServiceServer can be embedded to have forward compatible implementations. -type UnimplementedNetworkPolicyDiscoveryServiceServer struct { -} - -func (*UnimplementedNetworkPolicyDiscoveryServiceServer) StreamNetworkPolicies(NetworkPolicyDiscoveryService_StreamNetworkPoliciesServer) error { - return status.Errorf(codes.Unimplemented, "method StreamNetworkPolicies not implemented") -} -func (*UnimplementedNetworkPolicyDiscoveryServiceServer) FetchNetworkPolicies(context.Context, *v33.DiscoveryRequest) (*v33.DiscoveryResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FetchNetworkPolicies not implemented") -} - -func RegisterNetworkPolicyDiscoveryServiceServer(s *grpc.Server, srv NetworkPolicyDiscoveryServiceServer) { - s.RegisterService(&_NetworkPolicyDiscoveryService_serviceDesc, srv) -} - -func _NetworkPolicyDiscoveryService_StreamNetworkPolicies_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(NetworkPolicyDiscoveryServiceServer).StreamNetworkPolicies(&networkPolicyDiscoveryServiceStreamNetworkPoliciesServer{stream}) -} - -type NetworkPolicyDiscoveryService_StreamNetworkPoliciesServer interface { - Send(*v33.DiscoveryResponse) error - Recv() (*v33.DiscoveryRequest, error) - grpc.ServerStream -} - -type networkPolicyDiscoveryServiceStreamNetworkPoliciesServer struct { - grpc.ServerStream -} - -func (x *networkPolicyDiscoveryServiceStreamNetworkPoliciesServer) Send(m *v33.DiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *networkPolicyDiscoveryServiceStreamNetworkPoliciesServer) Recv() (*v33.DiscoveryRequest, error) { - m := new(v33.DiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _NetworkPolicyDiscoveryService_FetchNetworkPolicies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(v33.DiscoveryRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(NetworkPolicyDiscoveryServiceServer).FetchNetworkPolicies(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cilium.NetworkPolicyDiscoveryService/FetchNetworkPolicies", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(NetworkPolicyDiscoveryServiceServer).FetchNetworkPolicies(ctx, req.(*v33.DiscoveryRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _NetworkPolicyDiscoveryService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cilium.NetworkPolicyDiscoveryService", - HandlerType: (*NetworkPolicyDiscoveryServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "FetchNetworkPolicies", - Handler: _NetworkPolicyDiscoveryService_FetchNetworkPolicies_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "StreamNetworkPolicies", - Handler: _NetworkPolicyDiscoveryService_StreamNetworkPolicies_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "cilium/api/npds.proto", -} diff --git a/vendor/github.com/cilium/proxy/go/cilium/api/npds.pb.validate.go b/vendor/github.com/cilium/proxy/go/cilium/api/npds.pb.validate.go deleted file mode 100644 index 70118cedc..000000000 --- a/vendor/github.com/cilium/proxy/go/cilium/api/npds.pb.validate.go +++ /dev/null @@ -1,1971 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: cilium/api/npds.proto - -package cilium - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" - - v3 "github.com/cilium/proxy/go/envoy/config/core/v3" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort - - _ = v3.SocketAddress_Protocol(0) -) - -// Validate checks the field values on NetworkPolicy with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *NetworkPolicy) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on NetworkPolicy with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in NetworkPolicyMultiError, or -// nil if none found. -func (m *NetworkPolicy) ValidateAll() error { - return m.validate(true) -} - -func (m *NetworkPolicy) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if l := len(m.GetEndpointIps()); l < 1 || l > 2 { - err := NetworkPolicyValidationError{ - field: "EndpointIps", - reason: "value must contain between 1 and 2 items, inclusive", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetEndpointIps() { - _, _ = idx, item - - if utf8.RuneCountInString(item) < 1 { - err := NetworkPolicyValidationError{ - field: fmt.Sprintf("EndpointIps[%v]", idx), - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - // no validation rules for EndpointId - - for idx, item := range m.GetIngressPerPortPolicies() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, NetworkPolicyValidationError{ - field: fmt.Sprintf("IngressPerPortPolicies[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, NetworkPolicyValidationError{ - field: fmt.Sprintf("IngressPerPortPolicies[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return NetworkPolicyValidationError{ - field: fmt.Sprintf("IngressPerPortPolicies[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetEgressPerPortPolicies() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, NetworkPolicyValidationError{ - field: fmt.Sprintf("EgressPerPortPolicies[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, NetworkPolicyValidationError{ - field: fmt.Sprintf("EgressPerPortPolicies[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return NetworkPolicyValidationError{ - field: fmt.Sprintf("EgressPerPortPolicies[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - // no validation rules for ConntrackMapName - - if len(errors) > 0 { - return NetworkPolicyMultiError(errors) - } - - return nil -} - -// NetworkPolicyMultiError is an error wrapping multiple validation errors -// returned by NetworkPolicy.ValidateAll() if the designated constraints -// aren't met. -type NetworkPolicyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m NetworkPolicyMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m NetworkPolicyMultiError) AllErrors() []error { return m } - -// NetworkPolicyValidationError is the validation error returned by -// NetworkPolicy.Validate if the designated constraints aren't met. -type NetworkPolicyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e NetworkPolicyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e NetworkPolicyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e NetworkPolicyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e NetworkPolicyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e NetworkPolicyValidationError) ErrorName() string { return "NetworkPolicyValidationError" } - -// Error satisfies the builtin error interface -func (e NetworkPolicyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sNetworkPolicy.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = NetworkPolicyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = NetworkPolicyValidationError{} - -// Validate checks the field values on PortNetworkPolicy with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *PortNetworkPolicy) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on PortNetworkPolicy with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// PortNetworkPolicyMultiError, or nil if none found. -func (m *PortNetworkPolicy) ValidateAll() error { - return m.validate(true) -} - -func (m *PortNetworkPolicy) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetPort() > 65535 { - err := PortNetworkPolicyValidationError{ - field: "Port", - reason: "value must be less than or equal to 65535", - } - if !all { - return err - } - errors = append(errors, err) - } - - if m.GetEndPort() > 65535 { - err := PortNetworkPolicyValidationError{ - field: "EndPort", - reason: "value must be less than or equal to 65535", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for Protocol - - for idx, item := range m.GetRules() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PortNetworkPolicyValidationError{ - field: fmt.Sprintf("Rules[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PortNetworkPolicyValidationError{ - field: fmt.Sprintf("Rules[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return PortNetworkPolicyValidationError{ - field: fmt.Sprintf("Rules[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return PortNetworkPolicyMultiError(errors) - } - - return nil -} - -// PortNetworkPolicyMultiError is an error wrapping multiple validation errors -// returned by PortNetworkPolicy.ValidateAll() if the designated constraints -// aren't met. -type PortNetworkPolicyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PortNetworkPolicyMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m PortNetworkPolicyMultiError) AllErrors() []error { return m } - -// PortNetworkPolicyValidationError is the validation error returned by -// PortNetworkPolicy.Validate if the designated constraints aren't met. -type PortNetworkPolicyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e PortNetworkPolicyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e PortNetworkPolicyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e PortNetworkPolicyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e PortNetworkPolicyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e PortNetworkPolicyValidationError) ErrorName() string { - return "PortNetworkPolicyValidationError" -} - -// Error satisfies the builtin error interface -func (e PortNetworkPolicyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sPortNetworkPolicy.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = PortNetworkPolicyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = PortNetworkPolicyValidationError{} - -// Validate checks the field values on TLSContext with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *TLSContext) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on TLSContext with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in TLSContextMultiError, or -// nil if none found. -func (m *TLSContext) ValidateAll() error { - return m.validate(true) -} - -func (m *TLSContext) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for TrustedCa - - // no validation rules for CertificateChain - - // no validation rules for PrivateKey - - // no validation rules for ValidationContextSdsSecret - - // no validation rules for TlsSdsSecret - - if len(errors) > 0 { - return TLSContextMultiError(errors) - } - - return nil -} - -// TLSContextMultiError is an error wrapping multiple validation errors -// returned by TLSContext.ValidateAll() if the designated constraints aren't met. -type TLSContextMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m TLSContextMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m TLSContextMultiError) AllErrors() []error { return m } - -// TLSContextValidationError is the validation error returned by -// TLSContext.Validate if the designated constraints aren't met. -type TLSContextValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TLSContextValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TLSContextValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TLSContextValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TLSContextValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TLSContextValidationError) ErrorName() string { return "TLSContextValidationError" } - -// Error satisfies the builtin error interface -func (e TLSContextValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTLSContext.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TLSContextValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TLSContextValidationError{} - -// Validate checks the field values on PortNetworkPolicyRule with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *PortNetworkPolicyRule) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on PortNetworkPolicyRule with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// PortNetworkPolicyRuleMultiError, or nil if none found. -func (m *PortNetworkPolicyRule) ValidateAll() error { - return m.validate(true) -} - -func (m *PortNetworkPolicyRule) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Deny - - // no validation rules for Name - - if all { - switch v := interface{}(m.GetDownstreamTlsContext()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PortNetworkPolicyRuleValidationError{ - field: "DownstreamTlsContext", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PortNetworkPolicyRuleValidationError{ - field: "DownstreamTlsContext", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDownstreamTlsContext()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return PortNetworkPolicyRuleValidationError{ - field: "DownstreamTlsContext", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetUpstreamTlsContext()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PortNetworkPolicyRuleValidationError{ - field: "UpstreamTlsContext", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PortNetworkPolicyRuleValidationError{ - field: "UpstreamTlsContext", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetUpstreamTlsContext()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return PortNetworkPolicyRuleValidationError{ - field: "UpstreamTlsContext", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for L7Proto - - switch v := m.L7.(type) { - case *PortNetworkPolicyRule_HttpRules: - if v == nil { - err := PortNetworkPolicyRuleValidationError{ - field: "L7", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetHttpRules()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PortNetworkPolicyRuleValidationError{ - field: "HttpRules", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PortNetworkPolicyRuleValidationError{ - field: "HttpRules", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHttpRules()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return PortNetworkPolicyRuleValidationError{ - field: "HttpRules", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *PortNetworkPolicyRule_KafkaRules: - if v == nil { - err := PortNetworkPolicyRuleValidationError{ - field: "L7", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetKafkaRules()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PortNetworkPolicyRuleValidationError{ - field: "KafkaRules", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PortNetworkPolicyRuleValidationError{ - field: "KafkaRules", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetKafkaRules()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return PortNetworkPolicyRuleValidationError{ - field: "KafkaRules", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *PortNetworkPolicyRule_L7Rules: - if v == nil { - err := PortNetworkPolicyRuleValidationError{ - field: "L7", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetL7Rules()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PortNetworkPolicyRuleValidationError{ - field: "L7Rules", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PortNetworkPolicyRuleValidationError{ - field: "L7Rules", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetL7Rules()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return PortNetworkPolicyRuleValidationError{ - field: "L7Rules", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return PortNetworkPolicyRuleMultiError(errors) - } - - return nil -} - -// PortNetworkPolicyRuleMultiError is an error wrapping multiple validation -// errors returned by PortNetworkPolicyRule.ValidateAll() if the designated -// constraints aren't met. -type PortNetworkPolicyRuleMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PortNetworkPolicyRuleMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m PortNetworkPolicyRuleMultiError) AllErrors() []error { return m } - -// PortNetworkPolicyRuleValidationError is the validation error returned by -// PortNetworkPolicyRule.Validate if the designated constraints aren't met. -type PortNetworkPolicyRuleValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e PortNetworkPolicyRuleValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e PortNetworkPolicyRuleValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e PortNetworkPolicyRuleValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e PortNetworkPolicyRuleValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e PortNetworkPolicyRuleValidationError) ErrorName() string { - return "PortNetworkPolicyRuleValidationError" -} - -// Error satisfies the builtin error interface -func (e PortNetworkPolicyRuleValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sPortNetworkPolicyRule.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = PortNetworkPolicyRuleValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = PortNetworkPolicyRuleValidationError{} - -// Validate checks the field values on HttpNetworkPolicyRules with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *HttpNetworkPolicyRules) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HttpNetworkPolicyRules with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// HttpNetworkPolicyRulesMultiError, or nil if none found. -func (m *HttpNetworkPolicyRules) ValidateAll() error { - return m.validate(true) -} - -func (m *HttpNetworkPolicyRules) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(m.GetHttpRules()) < 1 { - err := HttpNetworkPolicyRulesValidationError{ - field: "HttpRules", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetHttpRules() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpNetworkPolicyRulesValidationError{ - field: fmt.Sprintf("HttpRules[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpNetworkPolicyRulesValidationError{ - field: fmt.Sprintf("HttpRules[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpNetworkPolicyRulesValidationError{ - field: fmt.Sprintf("HttpRules[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return HttpNetworkPolicyRulesMultiError(errors) - } - - return nil -} - -// HttpNetworkPolicyRulesMultiError is an error wrapping multiple validation -// errors returned by HttpNetworkPolicyRules.ValidateAll() if the designated -// constraints aren't met. -type HttpNetworkPolicyRulesMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HttpNetworkPolicyRulesMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HttpNetworkPolicyRulesMultiError) AllErrors() []error { return m } - -// HttpNetworkPolicyRulesValidationError is the validation error returned by -// HttpNetworkPolicyRules.Validate if the designated constraints aren't met. -type HttpNetworkPolicyRulesValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HttpNetworkPolicyRulesValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HttpNetworkPolicyRulesValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HttpNetworkPolicyRulesValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HttpNetworkPolicyRulesValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HttpNetworkPolicyRulesValidationError) ErrorName() string { - return "HttpNetworkPolicyRulesValidationError" -} - -// Error satisfies the builtin error interface -func (e HttpNetworkPolicyRulesValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttpNetworkPolicyRules.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HttpNetworkPolicyRulesValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HttpNetworkPolicyRulesValidationError{} - -// Validate checks the field values on HeaderMatch with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *HeaderMatch) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HeaderMatch with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in HeaderMatchMultiError, or -// nil if none found. -func (m *HeaderMatch) ValidateAll() error { - return m.validate(true) -} - -func (m *HeaderMatch) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := HeaderMatchValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for Value - - // no validation rules for MatchAction - - // no validation rules for MismatchAction - - // no validation rules for ValueSdsSecret - - if len(errors) > 0 { - return HeaderMatchMultiError(errors) - } - - return nil -} - -// HeaderMatchMultiError is an error wrapping multiple validation errors -// returned by HeaderMatch.ValidateAll() if the designated constraints aren't met. -type HeaderMatchMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HeaderMatchMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HeaderMatchMultiError) AllErrors() []error { return m } - -// HeaderMatchValidationError is the validation error returned by -// HeaderMatch.Validate if the designated constraints aren't met. -type HeaderMatchValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HeaderMatchValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HeaderMatchValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HeaderMatchValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HeaderMatchValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HeaderMatchValidationError) ErrorName() string { return "HeaderMatchValidationError" } - -// Error satisfies the builtin error interface -func (e HeaderMatchValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHeaderMatch.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HeaderMatchValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HeaderMatchValidationError{} - -// Validate checks the field values on HttpNetworkPolicyRule with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *HttpNetworkPolicyRule) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HttpNetworkPolicyRule with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// HttpNetworkPolicyRuleMultiError, or nil if none found. -func (m *HttpNetworkPolicyRule) ValidateAll() error { - return m.validate(true) -} - -func (m *HttpNetworkPolicyRule) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetHeaders() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpNetworkPolicyRuleValidationError{ - field: fmt.Sprintf("Headers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpNetworkPolicyRuleValidationError{ - field: fmt.Sprintf("Headers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpNetworkPolicyRuleValidationError{ - field: fmt.Sprintf("Headers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetHeaderMatches() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpNetworkPolicyRuleValidationError{ - field: fmt.Sprintf("HeaderMatches[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpNetworkPolicyRuleValidationError{ - field: fmt.Sprintf("HeaderMatches[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpNetworkPolicyRuleValidationError{ - field: fmt.Sprintf("HeaderMatches[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return HttpNetworkPolicyRuleMultiError(errors) - } - - return nil -} - -// HttpNetworkPolicyRuleMultiError is an error wrapping multiple validation -// errors returned by HttpNetworkPolicyRule.ValidateAll() if the designated -// constraints aren't met. -type HttpNetworkPolicyRuleMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HttpNetworkPolicyRuleMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HttpNetworkPolicyRuleMultiError) AllErrors() []error { return m } - -// HttpNetworkPolicyRuleValidationError is the validation error returned by -// HttpNetworkPolicyRule.Validate if the designated constraints aren't met. -type HttpNetworkPolicyRuleValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HttpNetworkPolicyRuleValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HttpNetworkPolicyRuleValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HttpNetworkPolicyRuleValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HttpNetworkPolicyRuleValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HttpNetworkPolicyRuleValidationError) ErrorName() string { - return "HttpNetworkPolicyRuleValidationError" -} - -// Error satisfies the builtin error interface -func (e HttpNetworkPolicyRuleValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttpNetworkPolicyRule.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HttpNetworkPolicyRuleValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HttpNetworkPolicyRuleValidationError{} - -// Validate checks the field values on KafkaNetworkPolicyRules with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *KafkaNetworkPolicyRules) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on KafkaNetworkPolicyRules with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// KafkaNetworkPolicyRulesMultiError, or nil if none found. -func (m *KafkaNetworkPolicyRules) ValidateAll() error { - return m.validate(true) -} - -func (m *KafkaNetworkPolicyRules) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(m.GetKafkaRules()) < 1 { - err := KafkaNetworkPolicyRulesValidationError{ - field: "KafkaRules", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetKafkaRules() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, KafkaNetworkPolicyRulesValidationError{ - field: fmt.Sprintf("KafkaRules[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, KafkaNetworkPolicyRulesValidationError{ - field: fmt.Sprintf("KafkaRules[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return KafkaNetworkPolicyRulesValidationError{ - field: fmt.Sprintf("KafkaRules[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return KafkaNetworkPolicyRulesMultiError(errors) - } - - return nil -} - -// KafkaNetworkPolicyRulesMultiError is an error wrapping multiple validation -// errors returned by KafkaNetworkPolicyRules.ValidateAll() if the designated -// constraints aren't met. -type KafkaNetworkPolicyRulesMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m KafkaNetworkPolicyRulesMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m KafkaNetworkPolicyRulesMultiError) AllErrors() []error { return m } - -// KafkaNetworkPolicyRulesValidationError is the validation error returned by -// KafkaNetworkPolicyRules.Validate if the designated constraints aren't met. -type KafkaNetworkPolicyRulesValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e KafkaNetworkPolicyRulesValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e KafkaNetworkPolicyRulesValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e KafkaNetworkPolicyRulesValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e KafkaNetworkPolicyRulesValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e KafkaNetworkPolicyRulesValidationError) ErrorName() string { - return "KafkaNetworkPolicyRulesValidationError" -} - -// Error satisfies the builtin error interface -func (e KafkaNetworkPolicyRulesValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sKafkaNetworkPolicyRules.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = KafkaNetworkPolicyRulesValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = KafkaNetworkPolicyRulesValidationError{} - -// Validate checks the field values on KafkaNetworkPolicyRule with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *KafkaNetworkPolicyRule) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on KafkaNetworkPolicyRule with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// KafkaNetworkPolicyRuleMultiError, or nil if none found. -func (m *KafkaNetworkPolicyRule) ValidateAll() error { - return m.validate(true) -} - -func (m *KafkaNetworkPolicyRule) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ApiVersion - - if !_KafkaNetworkPolicyRule_ClientId_Pattern.MatchString(m.GetClientId()) { - err := KafkaNetworkPolicyRuleValidationError{ - field: "ClientId", - reason: "value does not match regex pattern \"^[a-zA-Z0-9._-]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - if utf8.RuneCountInString(m.GetTopic()) > 255 { - err := KafkaNetworkPolicyRuleValidationError{ - field: "Topic", - reason: "value length must be at most 255 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_KafkaNetworkPolicyRule_Topic_Pattern.MatchString(m.GetTopic()) { - err := KafkaNetworkPolicyRuleValidationError{ - field: "Topic", - reason: "value does not match regex pattern \"^[a-zA-Z0-9._-]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return KafkaNetworkPolicyRuleMultiError(errors) - } - - return nil -} - -// KafkaNetworkPolicyRuleMultiError is an error wrapping multiple validation -// errors returned by KafkaNetworkPolicyRule.ValidateAll() if the designated -// constraints aren't met. -type KafkaNetworkPolicyRuleMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m KafkaNetworkPolicyRuleMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m KafkaNetworkPolicyRuleMultiError) AllErrors() []error { return m } - -// KafkaNetworkPolicyRuleValidationError is the validation error returned by -// KafkaNetworkPolicyRule.Validate if the designated constraints aren't met. -type KafkaNetworkPolicyRuleValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e KafkaNetworkPolicyRuleValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e KafkaNetworkPolicyRuleValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e KafkaNetworkPolicyRuleValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e KafkaNetworkPolicyRuleValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e KafkaNetworkPolicyRuleValidationError) ErrorName() string { - return "KafkaNetworkPolicyRuleValidationError" -} - -// Error satisfies the builtin error interface -func (e KafkaNetworkPolicyRuleValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sKafkaNetworkPolicyRule.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = KafkaNetworkPolicyRuleValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = KafkaNetworkPolicyRuleValidationError{} - -var _KafkaNetworkPolicyRule_ClientId_Pattern = regexp.MustCompile("^[a-zA-Z0-9._-]*$") - -var _KafkaNetworkPolicyRule_Topic_Pattern = regexp.MustCompile("^[a-zA-Z0-9._-]*$") - -// Validate checks the field values on L7NetworkPolicyRules with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *L7NetworkPolicyRules) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on L7NetworkPolicyRules with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// L7NetworkPolicyRulesMultiError, or nil if none found. -func (m *L7NetworkPolicyRules) ValidateAll() error { - return m.validate(true) -} - -func (m *L7NetworkPolicyRules) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetL7AllowRules() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, L7NetworkPolicyRulesValidationError{ - field: fmt.Sprintf("L7AllowRules[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, L7NetworkPolicyRulesValidationError{ - field: fmt.Sprintf("L7AllowRules[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return L7NetworkPolicyRulesValidationError{ - field: fmt.Sprintf("L7AllowRules[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetL7DenyRules() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, L7NetworkPolicyRulesValidationError{ - field: fmt.Sprintf("L7DenyRules[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, L7NetworkPolicyRulesValidationError{ - field: fmt.Sprintf("L7DenyRules[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return L7NetworkPolicyRulesValidationError{ - field: fmt.Sprintf("L7DenyRules[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return L7NetworkPolicyRulesMultiError(errors) - } - - return nil -} - -// L7NetworkPolicyRulesMultiError is an error wrapping multiple validation -// errors returned by L7NetworkPolicyRules.ValidateAll() if the designated -// constraints aren't met. -type L7NetworkPolicyRulesMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m L7NetworkPolicyRulesMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m L7NetworkPolicyRulesMultiError) AllErrors() []error { return m } - -// L7NetworkPolicyRulesValidationError is the validation error returned by -// L7NetworkPolicyRules.Validate if the designated constraints aren't met. -type L7NetworkPolicyRulesValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e L7NetworkPolicyRulesValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e L7NetworkPolicyRulesValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e L7NetworkPolicyRulesValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e L7NetworkPolicyRulesValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e L7NetworkPolicyRulesValidationError) ErrorName() string { - return "L7NetworkPolicyRulesValidationError" -} - -// Error satisfies the builtin error interface -func (e L7NetworkPolicyRulesValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sL7NetworkPolicyRules.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = L7NetworkPolicyRulesValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = L7NetworkPolicyRulesValidationError{} - -// Validate checks the field values on L7NetworkPolicyRule with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *L7NetworkPolicyRule) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on L7NetworkPolicyRule with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// L7NetworkPolicyRuleMultiError, or nil if none found. -func (m *L7NetworkPolicyRule) ValidateAll() error { - return m.validate(true) -} - -func (m *L7NetworkPolicyRule) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Name - - // no validation rules for Rule - - for idx, item := range m.GetMetadataRule() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, L7NetworkPolicyRuleValidationError{ - field: fmt.Sprintf("MetadataRule[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, L7NetworkPolicyRuleValidationError{ - field: fmt.Sprintf("MetadataRule[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return L7NetworkPolicyRuleValidationError{ - field: fmt.Sprintf("MetadataRule[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return L7NetworkPolicyRuleMultiError(errors) - } - - return nil -} - -// L7NetworkPolicyRuleMultiError is an error wrapping multiple validation -// errors returned by L7NetworkPolicyRule.ValidateAll() if the designated -// constraints aren't met. -type L7NetworkPolicyRuleMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m L7NetworkPolicyRuleMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m L7NetworkPolicyRuleMultiError) AllErrors() []error { return m } - -// L7NetworkPolicyRuleValidationError is the validation error returned by -// L7NetworkPolicyRule.Validate if the designated constraints aren't met. -type L7NetworkPolicyRuleValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e L7NetworkPolicyRuleValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e L7NetworkPolicyRuleValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e L7NetworkPolicyRuleValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e L7NetworkPolicyRuleValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e L7NetworkPolicyRuleValidationError) ErrorName() string { - return "L7NetworkPolicyRuleValidationError" -} - -// Error satisfies the builtin error interface -func (e L7NetworkPolicyRuleValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sL7NetworkPolicyRule.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = L7NetworkPolicyRuleValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = L7NetworkPolicyRuleValidationError{} - -// Validate checks the field values on NetworkPoliciesConfigDump with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *NetworkPoliciesConfigDump) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on NetworkPoliciesConfigDump with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// NetworkPoliciesConfigDumpMultiError, or nil if none found. -func (m *NetworkPoliciesConfigDump) ValidateAll() error { - return m.validate(true) -} - -func (m *NetworkPoliciesConfigDump) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetNetworkpolicies() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, NetworkPoliciesConfigDumpValidationError{ - field: fmt.Sprintf("Networkpolicies[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, NetworkPoliciesConfigDumpValidationError{ - field: fmt.Sprintf("Networkpolicies[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return NetworkPoliciesConfigDumpValidationError{ - field: fmt.Sprintf("Networkpolicies[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return NetworkPoliciesConfigDumpMultiError(errors) - } - - return nil -} - -// NetworkPoliciesConfigDumpMultiError is an error wrapping multiple validation -// errors returned by NetworkPoliciesConfigDump.ValidateAll() if the -// designated constraints aren't met. -type NetworkPoliciesConfigDumpMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m NetworkPoliciesConfigDumpMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m NetworkPoliciesConfigDumpMultiError) AllErrors() []error { return m } - -// NetworkPoliciesConfigDumpValidationError is the validation error returned by -// NetworkPoliciesConfigDump.Validate if the designated constraints aren't met. -type NetworkPoliciesConfigDumpValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e NetworkPoliciesConfigDumpValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e NetworkPoliciesConfigDumpValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e NetworkPoliciesConfigDumpValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e NetworkPoliciesConfigDumpValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e NetworkPoliciesConfigDumpValidationError) ErrorName() string { - return "NetworkPoliciesConfigDumpValidationError" -} - -// Error satisfies the builtin error interface -func (e NetworkPoliciesConfigDumpValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sNetworkPoliciesConfigDump.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = NetworkPoliciesConfigDumpValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = NetworkPoliciesConfigDumpValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/cilium/api/nphds.pb.go b/vendor/github.com/cilium/proxy/go/cilium/api/nphds.pb.go deleted file mode 100644 index e33dd21b9..000000000 --- a/vendor/github.com/cilium/proxy/go/cilium/api/nphds.pb.go +++ /dev/null @@ -1,362 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: cilium/api/nphds.proto - -package cilium - -import ( - context "context" - _ "github.com/cilium/proxy/go/envoy/annotations" - v3 "github.com/cilium/proxy/go/envoy/service/discovery/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// The mapping of a network policy identifier to the IP addresses of all the -// hosts on which the network policy is enforced. -// A host may be associated only with one network policy. -type NetworkPolicyHosts struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The unique identifier of the network policy enforced on the hosts. - Policy uint64 `protobuf:"varint,1,opt,name=policy,proto3" json:"policy,omitempty"` - // The set of IP addresses of the hosts on which the network policy is - // enforced. Optional. May be empty. - HostAddresses []string `protobuf:"bytes,2,rep,name=host_addresses,json=hostAddresses,proto3" json:"host_addresses,omitempty"` -} - -func (x *NetworkPolicyHosts) Reset() { - *x = NetworkPolicyHosts{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_nphds_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NetworkPolicyHosts) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NetworkPolicyHosts) ProtoMessage() {} - -func (x *NetworkPolicyHosts) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_nphds_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NetworkPolicyHosts.ProtoReflect.Descriptor instead. -func (*NetworkPolicyHosts) Descriptor() ([]byte, []int) { - return file_cilium_api_nphds_proto_rawDescGZIP(), []int{0} -} - -func (x *NetworkPolicyHosts) GetPolicy() uint64 { - if x != nil { - return x.Policy - } - return 0 -} - -func (x *NetworkPolicyHosts) GetHostAddresses() []string { - if x != nil { - return x.HostAddresses - } - return nil -} - -var File_cilium_api_nphds_proto protoreflect.FileDescriptor - -var file_cilium_api_nphds_proto_rawDesc = []byte{ - 0x0a, 0x16, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x70, 0x68, - 0x64, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, - 0x1a, 0x2a, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, - 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x33, 0x2f, 0x64, 0x69, 0x73, - 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x72, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x69, 0x0a, 0x12, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, - 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x70, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x70, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x12, 0x3b, 0x0a, 0x0e, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x42, 0x14, 0xfa, 0x42, 0x05, - 0x92, 0x01, 0x02, 0x18, 0x01, 0xfa, 0x42, 0x09, 0x92, 0x01, 0x06, 0x22, 0x04, 0x72, 0x02, 0x10, - 0x01, 0x52, 0x0d, 0x68, 0x6f, 0x73, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, - 0x32, 0xee, 0x02, 0x0a, 0x22, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7d, 0x0a, 0x18, 0x53, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x6f, - 0x73, 0x74, 0x73, 0x12, 0x2c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x33, - 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x2d, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x33, 0x2e, 0x44, - 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0xa5, 0x01, 0x0a, 0x17, 0x46, 0x65, 0x74, 0x63, 0x68, - 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x6f, 0x73, - 0x74, 0x73, 0x12, 0x2c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x33, 0x2e, - 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x2d, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x69, - 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x22, 0x22, 0x2f, 0x76, 0x32, 0x2f, 0x64, 0x69, 0x73, - 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x3a, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x70, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x3a, 0x01, 0x2a, 0x1a, 0x21, - 0x8a, 0xa4, 0x96, 0xf3, 0x07, 0x1b, 0x0a, 0x19, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2e, 0x4e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x6f, 0x73, 0x74, - 0x73, 0x42, 0x2e, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2f, - 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x3b, 0x63, 0x69, 0x6c, 0x69, 0x75, - 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_cilium_api_nphds_proto_rawDescOnce sync.Once - file_cilium_api_nphds_proto_rawDescData = file_cilium_api_nphds_proto_rawDesc -) - -func file_cilium_api_nphds_proto_rawDescGZIP() []byte { - file_cilium_api_nphds_proto_rawDescOnce.Do(func() { - file_cilium_api_nphds_proto_rawDescData = protoimpl.X.CompressGZIP(file_cilium_api_nphds_proto_rawDescData) - }) - return file_cilium_api_nphds_proto_rawDescData -} - -var file_cilium_api_nphds_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_cilium_api_nphds_proto_goTypes = []interface{}{ - (*NetworkPolicyHosts)(nil), // 0: cilium.NetworkPolicyHosts - (*v3.DiscoveryRequest)(nil), // 1: envoy.service.discovery.v3.DiscoveryRequest - (*v3.DiscoveryResponse)(nil), // 2: envoy.service.discovery.v3.DiscoveryResponse -} -var file_cilium_api_nphds_proto_depIdxs = []int32{ - 1, // 0: cilium.NetworkPolicyHostsDiscoveryService.StreamNetworkPolicyHosts:input_type -> envoy.service.discovery.v3.DiscoveryRequest - 1, // 1: cilium.NetworkPolicyHostsDiscoveryService.FetchNetworkPolicyHosts:input_type -> envoy.service.discovery.v3.DiscoveryRequest - 2, // 2: cilium.NetworkPolicyHostsDiscoveryService.StreamNetworkPolicyHosts:output_type -> envoy.service.discovery.v3.DiscoveryResponse - 2, // 3: cilium.NetworkPolicyHostsDiscoveryService.FetchNetworkPolicyHosts:output_type -> envoy.service.discovery.v3.DiscoveryResponse - 2, // [2:4] is the sub-list for method output_type - 0, // [0:2] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_cilium_api_nphds_proto_init() } -func file_cilium_api_nphds_proto_init() { - if File_cilium_api_nphds_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_cilium_api_nphds_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NetworkPolicyHosts); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cilium_api_nphds_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_cilium_api_nphds_proto_goTypes, - DependencyIndexes: file_cilium_api_nphds_proto_depIdxs, - MessageInfos: file_cilium_api_nphds_proto_msgTypes, - }.Build() - File_cilium_api_nphds_proto = out.File - file_cilium_api_nphds_proto_rawDesc = nil - file_cilium_api_nphds_proto_goTypes = nil - file_cilium_api_nphds_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// 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.SupportPackageIsVersion6 - -// NetworkPolicyHostsDiscoveryServiceClient is the client API for NetworkPolicyHostsDiscoveryService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type NetworkPolicyHostsDiscoveryServiceClient interface { - StreamNetworkPolicyHosts(ctx context.Context, opts ...grpc.CallOption) (NetworkPolicyHostsDiscoveryService_StreamNetworkPolicyHostsClient, error) - FetchNetworkPolicyHosts(ctx context.Context, in *v3.DiscoveryRequest, opts ...grpc.CallOption) (*v3.DiscoveryResponse, error) -} - -type networkPolicyHostsDiscoveryServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewNetworkPolicyHostsDiscoveryServiceClient(cc grpc.ClientConnInterface) NetworkPolicyHostsDiscoveryServiceClient { - return &networkPolicyHostsDiscoveryServiceClient{cc} -} - -func (c *networkPolicyHostsDiscoveryServiceClient) StreamNetworkPolicyHosts(ctx context.Context, opts ...grpc.CallOption) (NetworkPolicyHostsDiscoveryService_StreamNetworkPolicyHostsClient, error) { - stream, err := c.cc.NewStream(ctx, &_NetworkPolicyHostsDiscoveryService_serviceDesc.Streams[0], "/cilium.NetworkPolicyHostsDiscoveryService/StreamNetworkPolicyHosts", opts...) - if err != nil { - return nil, err - } - x := &networkPolicyHostsDiscoveryServiceStreamNetworkPolicyHostsClient{stream} - return x, nil -} - -type NetworkPolicyHostsDiscoveryService_StreamNetworkPolicyHostsClient interface { - Send(*v3.DiscoveryRequest) error - Recv() (*v3.DiscoveryResponse, error) - grpc.ClientStream -} - -type networkPolicyHostsDiscoveryServiceStreamNetworkPolicyHostsClient struct { - grpc.ClientStream -} - -func (x *networkPolicyHostsDiscoveryServiceStreamNetworkPolicyHostsClient) Send(m *v3.DiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *networkPolicyHostsDiscoveryServiceStreamNetworkPolicyHostsClient) Recv() (*v3.DiscoveryResponse, error) { - m := new(v3.DiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *networkPolicyHostsDiscoveryServiceClient) FetchNetworkPolicyHosts(ctx context.Context, in *v3.DiscoveryRequest, opts ...grpc.CallOption) (*v3.DiscoveryResponse, error) { - out := new(v3.DiscoveryResponse) - err := c.cc.Invoke(ctx, "/cilium.NetworkPolicyHostsDiscoveryService/FetchNetworkPolicyHosts", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// NetworkPolicyHostsDiscoveryServiceServer is the server API for NetworkPolicyHostsDiscoveryService service. -type NetworkPolicyHostsDiscoveryServiceServer interface { - StreamNetworkPolicyHosts(NetworkPolicyHostsDiscoveryService_StreamNetworkPolicyHostsServer) error - FetchNetworkPolicyHosts(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) -} - -// UnimplementedNetworkPolicyHostsDiscoveryServiceServer can be embedded to have forward compatible implementations. -type UnimplementedNetworkPolicyHostsDiscoveryServiceServer struct { -} - -func (*UnimplementedNetworkPolicyHostsDiscoveryServiceServer) StreamNetworkPolicyHosts(NetworkPolicyHostsDiscoveryService_StreamNetworkPolicyHostsServer) error { - return status.Errorf(codes.Unimplemented, "method StreamNetworkPolicyHosts not implemented") -} -func (*UnimplementedNetworkPolicyHostsDiscoveryServiceServer) FetchNetworkPolicyHosts(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FetchNetworkPolicyHosts not implemented") -} - -func RegisterNetworkPolicyHostsDiscoveryServiceServer(s *grpc.Server, srv NetworkPolicyHostsDiscoveryServiceServer) { - s.RegisterService(&_NetworkPolicyHostsDiscoveryService_serviceDesc, srv) -} - -func _NetworkPolicyHostsDiscoveryService_StreamNetworkPolicyHosts_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(NetworkPolicyHostsDiscoveryServiceServer).StreamNetworkPolicyHosts(&networkPolicyHostsDiscoveryServiceStreamNetworkPolicyHostsServer{stream}) -} - -type NetworkPolicyHostsDiscoveryService_StreamNetworkPolicyHostsServer interface { - Send(*v3.DiscoveryResponse) error - Recv() (*v3.DiscoveryRequest, error) - grpc.ServerStream -} - -type networkPolicyHostsDiscoveryServiceStreamNetworkPolicyHostsServer struct { - grpc.ServerStream -} - -func (x *networkPolicyHostsDiscoveryServiceStreamNetworkPolicyHostsServer) Send(m *v3.DiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *networkPolicyHostsDiscoveryServiceStreamNetworkPolicyHostsServer) Recv() (*v3.DiscoveryRequest, error) { - m := new(v3.DiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _NetworkPolicyHostsDiscoveryService_FetchNetworkPolicyHosts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(v3.DiscoveryRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(NetworkPolicyHostsDiscoveryServiceServer).FetchNetworkPolicyHosts(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cilium.NetworkPolicyHostsDiscoveryService/FetchNetworkPolicyHosts", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(NetworkPolicyHostsDiscoveryServiceServer).FetchNetworkPolicyHosts(ctx, req.(*v3.DiscoveryRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _NetworkPolicyHostsDiscoveryService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cilium.NetworkPolicyHostsDiscoveryService", - HandlerType: (*NetworkPolicyHostsDiscoveryServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "FetchNetworkPolicyHosts", - Handler: _NetworkPolicyHostsDiscoveryService_FetchNetworkPolicyHosts_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "StreamNetworkPolicyHosts", - Handler: _NetworkPolicyHostsDiscoveryService_StreamNetworkPolicyHosts_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "cilium/api/nphds.proto", -} diff --git a/vendor/github.com/cilium/proxy/go/cilium/api/nphds.pb.validate.go b/vendor/github.com/cilium/proxy/go/cilium/api/nphds.pb.validate.go deleted file mode 100644 index 6ea201221..000000000 --- a/vendor/github.com/cilium/proxy/go/cilium/api/nphds.pb.validate.go +++ /dev/null @@ -1,171 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: cilium/api/nphds.proto - -package cilium - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on NetworkPolicyHosts with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *NetworkPolicyHosts) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on NetworkPolicyHosts with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// NetworkPolicyHostsMultiError, or nil if none found. -func (m *NetworkPolicyHosts) ValidateAll() error { - return m.validate(true) -} - -func (m *NetworkPolicyHosts) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Policy - - _NetworkPolicyHosts_HostAddresses_Unique := make(map[string]struct{}, len(m.GetHostAddresses())) - - for idx, item := range m.GetHostAddresses() { - _, _ = idx, item - - if _, exists := _NetworkPolicyHosts_HostAddresses_Unique[item]; exists { - err := NetworkPolicyHostsValidationError{ - field: fmt.Sprintf("HostAddresses[%v]", idx), - reason: "repeated value must contain unique items", - } - if !all { - return err - } - errors = append(errors, err) - } else { - _NetworkPolicyHosts_HostAddresses_Unique[item] = struct{}{} - } - - if utf8.RuneCountInString(item) < 1 { - err := NetworkPolicyHostsValidationError{ - field: fmt.Sprintf("HostAddresses[%v]", idx), - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if len(errors) > 0 { - return NetworkPolicyHostsMultiError(errors) - } - - return nil -} - -// NetworkPolicyHostsMultiError is an error wrapping multiple validation errors -// returned by NetworkPolicyHosts.ValidateAll() if the designated constraints -// aren't met. -type NetworkPolicyHostsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m NetworkPolicyHostsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m NetworkPolicyHostsMultiError) AllErrors() []error { return m } - -// NetworkPolicyHostsValidationError is the validation error returned by -// NetworkPolicyHosts.Validate if the designated constraints aren't met. -type NetworkPolicyHostsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e NetworkPolicyHostsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e NetworkPolicyHostsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e NetworkPolicyHostsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e NetworkPolicyHostsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e NetworkPolicyHostsValidationError) ErrorName() string { - return "NetworkPolicyHostsValidationError" -} - -// Error satisfies the builtin error interface -func (e NetworkPolicyHostsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sNetworkPolicyHosts.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = NetworkPolicyHostsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = NetworkPolicyHostsValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/cilium/api/tls_wrapper.pb.go b/vendor/github.com/cilium/proxy/go/cilium/api/tls_wrapper.pb.go deleted file mode 100644 index 540f3a548..000000000 --- a/vendor/github.com/cilium/proxy/go/cilium/api/tls_wrapper.pb.go +++ /dev/null @@ -1,194 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: cilium/api/tls_wrapper.proto - -package cilium - -import ( - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Empty configuration messages for Cilium TLS wrapper to make Envoy happy -type UpstreamTlsWrapperContext struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *UpstreamTlsWrapperContext) Reset() { - *x = UpstreamTlsWrapperContext{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_tls_wrapper_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpstreamTlsWrapperContext) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpstreamTlsWrapperContext) ProtoMessage() {} - -func (x *UpstreamTlsWrapperContext) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_tls_wrapper_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpstreamTlsWrapperContext.ProtoReflect.Descriptor instead. -func (*UpstreamTlsWrapperContext) Descriptor() ([]byte, []int) { - return file_cilium_api_tls_wrapper_proto_rawDescGZIP(), []int{0} -} - -type DownstreamTlsWrapperContext struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *DownstreamTlsWrapperContext) Reset() { - *x = DownstreamTlsWrapperContext{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_tls_wrapper_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DownstreamTlsWrapperContext) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DownstreamTlsWrapperContext) ProtoMessage() {} - -func (x *DownstreamTlsWrapperContext) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_tls_wrapper_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DownstreamTlsWrapperContext.ProtoReflect.Descriptor instead. -func (*DownstreamTlsWrapperContext) Descriptor() ([]byte, []int) { - return file_cilium_api_tls_wrapper_proto_rawDescGZIP(), []int{1} -} - -var File_cilium_api_tls_wrapper_proto protoreflect.FileDescriptor - -var file_cilium_api_tls_wrapper_proto_rawDesc = []byte{ - 0x0a, 0x1c, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x74, 0x6c, 0x73, - 0x5f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, - 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x22, 0x1b, 0x0a, 0x19, 0x55, 0x70, 0x73, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x54, 0x6c, 0x73, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, - 0x65, 0x78, 0x74, 0x22, 0x1d, 0x0a, 0x1b, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x54, 0x6c, 0x73, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x65, - 0x78, 0x74, 0x42, 0x2e, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, - 0x2f, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x3b, 0x63, 0x69, 0x6c, 0x69, - 0x75, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_cilium_api_tls_wrapper_proto_rawDescOnce sync.Once - file_cilium_api_tls_wrapper_proto_rawDescData = file_cilium_api_tls_wrapper_proto_rawDesc -) - -func file_cilium_api_tls_wrapper_proto_rawDescGZIP() []byte { - file_cilium_api_tls_wrapper_proto_rawDescOnce.Do(func() { - file_cilium_api_tls_wrapper_proto_rawDescData = protoimpl.X.CompressGZIP(file_cilium_api_tls_wrapper_proto_rawDescData) - }) - return file_cilium_api_tls_wrapper_proto_rawDescData -} - -var file_cilium_api_tls_wrapper_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_cilium_api_tls_wrapper_proto_goTypes = []interface{}{ - (*UpstreamTlsWrapperContext)(nil), // 0: cilium.UpstreamTlsWrapperContext - (*DownstreamTlsWrapperContext)(nil), // 1: cilium.DownstreamTlsWrapperContext -} -var file_cilium_api_tls_wrapper_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_cilium_api_tls_wrapper_proto_init() } -func file_cilium_api_tls_wrapper_proto_init() { - if File_cilium_api_tls_wrapper_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_cilium_api_tls_wrapper_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpstreamTlsWrapperContext); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cilium_api_tls_wrapper_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DownstreamTlsWrapperContext); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cilium_api_tls_wrapper_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_cilium_api_tls_wrapper_proto_goTypes, - DependencyIndexes: file_cilium_api_tls_wrapper_proto_depIdxs, - MessageInfos: file_cilium_api_tls_wrapper_proto_msgTypes, - }.Build() - File_cilium_api_tls_wrapper_proto = out.File - file_cilium_api_tls_wrapper_proto_rawDesc = nil - file_cilium_api_tls_wrapper_proto_goTypes = nil - file_cilium_api_tls_wrapper_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/cilium/api/tls_wrapper.pb.validate.go b/vendor/github.com/cilium/proxy/go/cilium/api/tls_wrapper.pb.validate.go deleted file mode 100644 index b5da26f8b..000000000 --- a/vendor/github.com/cilium/proxy/go/cilium/api/tls_wrapper.pb.validate.go +++ /dev/null @@ -1,241 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: cilium/api/tls_wrapper.proto - -package cilium - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on UpstreamTlsWrapperContext with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *UpstreamTlsWrapperContext) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UpstreamTlsWrapperContext with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// UpstreamTlsWrapperContextMultiError, or nil if none found. -func (m *UpstreamTlsWrapperContext) ValidateAll() error { - return m.validate(true) -} - -func (m *UpstreamTlsWrapperContext) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return UpstreamTlsWrapperContextMultiError(errors) - } - - return nil -} - -// UpstreamTlsWrapperContextMultiError is an error wrapping multiple validation -// errors returned by UpstreamTlsWrapperContext.ValidateAll() if the -// designated constraints aren't met. -type UpstreamTlsWrapperContextMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UpstreamTlsWrapperContextMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m UpstreamTlsWrapperContextMultiError) AllErrors() []error { return m } - -// UpstreamTlsWrapperContextValidationError is the validation error returned by -// UpstreamTlsWrapperContext.Validate if the designated constraints aren't met. -type UpstreamTlsWrapperContextValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UpstreamTlsWrapperContextValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UpstreamTlsWrapperContextValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UpstreamTlsWrapperContextValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UpstreamTlsWrapperContextValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UpstreamTlsWrapperContextValidationError) ErrorName() string { - return "UpstreamTlsWrapperContextValidationError" -} - -// Error satisfies the builtin error interface -func (e UpstreamTlsWrapperContextValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sUpstreamTlsWrapperContext.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UpstreamTlsWrapperContextValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UpstreamTlsWrapperContextValidationError{} - -// Validate checks the field values on DownstreamTlsWrapperContext with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *DownstreamTlsWrapperContext) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DownstreamTlsWrapperContext with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// DownstreamTlsWrapperContextMultiError, or nil if none found. -func (m *DownstreamTlsWrapperContext) ValidateAll() error { - return m.validate(true) -} - -func (m *DownstreamTlsWrapperContext) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return DownstreamTlsWrapperContextMultiError(errors) - } - - return nil -} - -// DownstreamTlsWrapperContextMultiError is an error wrapping multiple -// validation errors returned by DownstreamTlsWrapperContext.ValidateAll() if -// the designated constraints aren't met. -type DownstreamTlsWrapperContextMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DownstreamTlsWrapperContextMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DownstreamTlsWrapperContextMultiError) AllErrors() []error { return m } - -// DownstreamTlsWrapperContextValidationError is the validation error returned -// by DownstreamTlsWrapperContext.Validate if the designated constraints -// aren't met. -type DownstreamTlsWrapperContextValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DownstreamTlsWrapperContextValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DownstreamTlsWrapperContextValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DownstreamTlsWrapperContextValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DownstreamTlsWrapperContextValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DownstreamTlsWrapperContextValidationError) ErrorName() string { - return "DownstreamTlsWrapperContextValidationError" -} - -// Error satisfies the builtin error interface -func (e DownstreamTlsWrapperContextValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDownstreamTlsWrapperContext.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DownstreamTlsWrapperContextValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DownstreamTlsWrapperContextValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/cilium/api/websocket.pb.go b/vendor/github.com/cilium/proxy/go/cilium/api/websocket.pb.go deleted file mode 100644 index fad0d6c0b..000000000 --- a/vendor/github.com/cilium/proxy/go/cilium/api/websocket.pb.go +++ /dev/null @@ -1,411 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: cilium/api/websocket.proto - -package cilium - -import ( - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - durationpb "google.golang.org/protobuf/types/known/durationpb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -type WebSocketClient struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Path to the unix domain socket for the cilium access log, if any. - AccessLogPath string `protobuf:"bytes,1,opt,name=access_log_path,json=accessLogPath,proto3" json:"access_log_path,omitempty"` - // Host header value, required. - Host string `protobuf:"bytes,2,opt,name=host,proto3" json:"host,omitempty"` - // Path value. Defaults to "/". - Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"` - // sec-websocket-key value to use, defaults to a random key. - Key string `protobuf:"bytes,4,opt,name=key,proto3" json:"key,omitempty"` - // Websocket version, defaults to "13". - Version string `protobuf:"bytes,5,opt,name=version,proto3" json:"version,omitempty"` - // Origin header, if any. - Origin string `protobuf:"bytes,6,opt,name=origin,proto3" json:"origin,omitempty"` - // Websocket handshake timeout, default is 5 seconds. - HandshakeTimeout *durationpb.Duration `protobuf:"bytes,7,opt,name=handshake_timeout,json=handshakeTimeout,proto3" json:"handshake_timeout,omitempty"` - // ping interval, default is 0 (disabled). - // Connection is assumed dead if response is not received before the next ping is to be sent. - PingInterval *durationpb.Duration `protobuf:"bytes,8,opt,name=ping_interval,json=pingInterval,proto3" json:"ping_interval,omitempty"` - // ping only on when idle on both directions. - // ping_interval must be non-zero when this is true. - PingWhenIdle bool `protobuf:"varint,9,opt,name=ping_when_idle,json=pingWhenIdle,proto3" json:"ping_when_idle,omitempty"` -} - -func (x *WebSocketClient) Reset() { - *x = WebSocketClient{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_websocket_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WebSocketClient) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WebSocketClient) ProtoMessage() {} - -func (x *WebSocketClient) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_websocket_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WebSocketClient.ProtoReflect.Descriptor instead. -func (*WebSocketClient) Descriptor() ([]byte, []int) { - return file_cilium_api_websocket_proto_rawDescGZIP(), []int{0} -} - -func (x *WebSocketClient) GetAccessLogPath() string { - if x != nil { - return x.AccessLogPath - } - return "" -} - -func (x *WebSocketClient) GetHost() string { - if x != nil { - return x.Host - } - return "" -} - -func (x *WebSocketClient) GetPath() string { - if x != nil { - return x.Path - } - return "" -} - -func (x *WebSocketClient) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *WebSocketClient) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *WebSocketClient) GetOrigin() string { - if x != nil { - return x.Origin - } - return "" -} - -func (x *WebSocketClient) GetHandshakeTimeout() *durationpb.Duration { - if x != nil { - return x.HandshakeTimeout - } - return nil -} - -func (x *WebSocketClient) GetPingInterval() *durationpb.Duration { - if x != nil { - return x.PingInterval - } - return nil -} - -func (x *WebSocketClient) GetPingWhenIdle() bool { - if x != nil { - return x.PingWhenIdle - } - return false -} - -type WebSocketServer struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Path to the unix domain socket for the cilium access log, if any. - AccessLogPath string `protobuf:"bytes,1,opt,name=access_log_path,json=accessLogPath,proto3" json:"access_log_path,omitempty"` - // Expected host header value, if any. - Host string `protobuf:"bytes,2,opt,name=host,proto3" json:"host,omitempty"` - // Expected path value, if any. - Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"` - // sec-websocket-key value to expect, if any. - Key string `protobuf:"bytes,4,opt,name=key,proto3" json:"key,omitempty"` - // Websocket version, ignored if omitted. - Version string `protobuf:"bytes,5,opt,name=version,proto3" json:"version,omitempty"` - // Origin header, if any. Origin header is not allowed if omitted. - Origin string `protobuf:"bytes,6,opt,name=origin,proto3" json:"origin,omitempty"` - // Websocket handshake timeout, default is 5 seconds. - HandshakeTimeout *durationpb.Duration `protobuf:"bytes,7,opt,name=handshake_timeout,json=handshakeTimeout,proto3" json:"handshake_timeout,omitempty"` - // ping interval, default is 0 (disabled). - // Connection is assumed dead if response is not received before the next ping is to be sent. - PingInterval *durationpb.Duration `protobuf:"bytes,8,opt,name=ping_interval,json=pingInterval,proto3" json:"ping_interval,omitempty"` - // ping only on when idle on both directions. - // ping_interval must be non-zero when this is true. - PingWhenIdle bool `protobuf:"varint,9,opt,name=ping_when_idle,json=pingWhenIdle,proto3" json:"ping_when_idle,omitempty"` -} - -func (x *WebSocketServer) Reset() { - *x = WebSocketServer{} - if protoimpl.UnsafeEnabled { - mi := &file_cilium_api_websocket_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WebSocketServer) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WebSocketServer) ProtoMessage() {} - -func (x *WebSocketServer) ProtoReflect() protoreflect.Message { - mi := &file_cilium_api_websocket_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WebSocketServer.ProtoReflect.Descriptor instead. -func (*WebSocketServer) Descriptor() ([]byte, []int) { - return file_cilium_api_websocket_proto_rawDescGZIP(), []int{1} -} - -func (x *WebSocketServer) GetAccessLogPath() string { - if x != nil { - return x.AccessLogPath - } - return "" -} - -func (x *WebSocketServer) GetHost() string { - if x != nil { - return x.Host - } - return "" -} - -func (x *WebSocketServer) GetPath() string { - if x != nil { - return x.Path - } - return "" -} - -func (x *WebSocketServer) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *WebSocketServer) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *WebSocketServer) GetOrigin() string { - if x != nil { - return x.Origin - } - return "" -} - -func (x *WebSocketServer) GetHandshakeTimeout() *durationpb.Duration { - if x != nil { - return x.HandshakeTimeout - } - return nil -} - -func (x *WebSocketServer) GetPingInterval() *durationpb.Duration { - if x != nil { - return x.PingInterval - } - return nil -} - -func (x *WebSocketServer) GetPingWhenIdle() bool { - if x != nil { - return x.PingWhenIdle - } - return false -} - -var File_cilium_api_websocket_proto protoreflect.FileDescriptor - -var file_cilium_api_websocket_proto_rawDesc = []byte{ - 0x0a, 0x1a, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x77, 0x65, 0x62, - 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x63, 0x69, - 0x6c, 0x69, 0x75, 0x6d, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xdc, 0x02, - 0x0a, 0x0f, 0x57, 0x65, 0x62, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x12, 0x26, 0x0a, 0x0f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, - 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x61, 0x63, 0x63, 0x65, - 0x73, 0x73, 0x4c, 0x6f, 0x67, 0x50, 0x61, 0x74, 0x68, 0x12, 0x1b, 0x0a, 0x04, 0x68, 0x6f, 0x73, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x02, - 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x07, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x46, - 0x0a, 0x11, 0x68, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61, 0x6b, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, - 0x6f, 0x75, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x10, 0x68, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61, 0x6b, 0x65, 0x54, - 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x3e, 0x0a, 0x0d, 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x69, - 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x70, 0x69, 0x6e, 0x67, 0x49, 0x6e, - 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x24, 0x0a, 0x0e, 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x77, - 0x68, 0x65, 0x6e, 0x5f, 0x69, 0x64, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, - 0x70, 0x69, 0x6e, 0x67, 0x57, 0x68, 0x65, 0x6e, 0x49, 0x64, 0x6c, 0x65, 0x22, 0xd3, 0x02, 0x0a, - 0x0f, 0x57, 0x65, 0x62, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x12, 0x26, 0x0a, 0x0f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x70, - 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, - 0x73, 0x4c, 0x6f, 0x67, 0x50, 0x61, 0x74, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, - 0x70, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, - 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, - 0x65, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, - 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x72, - 0x69, 0x67, 0x69, 0x6e, 0x12, 0x46, 0x0a, 0x11, 0x68, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61, 0x6b, - 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x10, 0x68, 0x61, 0x6e, 0x64, - 0x73, 0x68, 0x61, 0x6b, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x3e, 0x0a, 0x0d, - 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x08, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, - 0x70, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x24, 0x0a, 0x0e, - 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x77, 0x68, 0x65, 0x6e, 0x5f, 0x69, 0x64, 0x6c, 0x65, 0x18, 0x09, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x70, 0x69, 0x6e, 0x67, 0x57, 0x68, 0x65, 0x6e, 0x49, 0x64, - 0x6c, 0x65, 0x42, 0x2e, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, - 0x2f, 0x63, 0x69, 0x6c, 0x69, 0x75, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x3b, 0x63, 0x69, 0x6c, 0x69, - 0x75, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_cilium_api_websocket_proto_rawDescOnce sync.Once - file_cilium_api_websocket_proto_rawDescData = file_cilium_api_websocket_proto_rawDesc -) - -func file_cilium_api_websocket_proto_rawDescGZIP() []byte { - file_cilium_api_websocket_proto_rawDescOnce.Do(func() { - file_cilium_api_websocket_proto_rawDescData = protoimpl.X.CompressGZIP(file_cilium_api_websocket_proto_rawDescData) - }) - return file_cilium_api_websocket_proto_rawDescData -} - -var file_cilium_api_websocket_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_cilium_api_websocket_proto_goTypes = []interface{}{ - (*WebSocketClient)(nil), // 0: cilium.WebSocketClient - (*WebSocketServer)(nil), // 1: cilium.WebSocketServer - (*durationpb.Duration)(nil), // 2: google.protobuf.Duration -} -var file_cilium_api_websocket_proto_depIdxs = []int32{ - 2, // 0: cilium.WebSocketClient.handshake_timeout:type_name -> google.protobuf.Duration - 2, // 1: cilium.WebSocketClient.ping_interval:type_name -> google.protobuf.Duration - 2, // 2: cilium.WebSocketServer.handshake_timeout:type_name -> google.protobuf.Duration - 2, // 3: cilium.WebSocketServer.ping_interval:type_name -> google.protobuf.Duration - 4, // [4:4] is the sub-list for method output_type - 4, // [4:4] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name -} - -func init() { file_cilium_api_websocket_proto_init() } -func file_cilium_api_websocket_proto_init() { - if File_cilium_api_websocket_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_cilium_api_websocket_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WebSocketClient); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cilium_api_websocket_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WebSocketServer); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cilium_api_websocket_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_cilium_api_websocket_proto_goTypes, - DependencyIndexes: file_cilium_api_websocket_proto_depIdxs, - MessageInfos: file_cilium_api_websocket_proto_msgTypes, - }.Build() - File_cilium_api_websocket_proto = out.File - file_cilium_api_websocket_proto_rawDesc = nil - file_cilium_api_websocket_proto_goTypes = nil - file_cilium_api_websocket_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/cilium/api/websocket.pb.validate.go b/vendor/github.com/cilium/proxy/go/cilium/api/websocket.pb.validate.go deleted file mode 100644 index 9f7a8b25c..000000000 --- a/vendor/github.com/cilium/proxy/go/cilium/api/websocket.pb.validate.go +++ /dev/null @@ -1,389 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: cilium/api/websocket.proto - -package cilium - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on WebSocketClient with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *WebSocketClient) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on WebSocketClient with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// WebSocketClientMultiError, or nil if none found. -func (m *WebSocketClient) ValidateAll() error { - return m.validate(true) -} - -func (m *WebSocketClient) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for AccessLogPath - - if utf8.RuneCountInString(m.GetHost()) < 2 { - err := WebSocketClientValidationError{ - field: "Host", - reason: "value length must be at least 2 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for Path - - // no validation rules for Key - - // no validation rules for Version - - // no validation rules for Origin - - if all { - switch v := interface{}(m.GetHandshakeTimeout()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, WebSocketClientValidationError{ - field: "HandshakeTimeout", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, WebSocketClientValidationError{ - field: "HandshakeTimeout", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHandshakeTimeout()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return WebSocketClientValidationError{ - field: "HandshakeTimeout", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetPingInterval()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, WebSocketClientValidationError{ - field: "PingInterval", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, WebSocketClientValidationError{ - field: "PingInterval", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPingInterval()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return WebSocketClientValidationError{ - field: "PingInterval", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for PingWhenIdle - - if len(errors) > 0 { - return WebSocketClientMultiError(errors) - } - - return nil -} - -// WebSocketClientMultiError is an error wrapping multiple validation errors -// returned by WebSocketClient.ValidateAll() if the designated constraints -// aren't met. -type WebSocketClientMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m WebSocketClientMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m WebSocketClientMultiError) AllErrors() []error { return m } - -// WebSocketClientValidationError is the validation error returned by -// WebSocketClient.Validate if the designated constraints aren't met. -type WebSocketClientValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e WebSocketClientValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e WebSocketClientValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e WebSocketClientValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e WebSocketClientValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e WebSocketClientValidationError) ErrorName() string { return "WebSocketClientValidationError" } - -// Error satisfies the builtin error interface -func (e WebSocketClientValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sWebSocketClient.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = WebSocketClientValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = WebSocketClientValidationError{} - -// Validate checks the field values on WebSocketServer with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *WebSocketServer) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on WebSocketServer with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// WebSocketServerMultiError, or nil if none found. -func (m *WebSocketServer) ValidateAll() error { - return m.validate(true) -} - -func (m *WebSocketServer) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for AccessLogPath - - // no validation rules for Host - - // no validation rules for Path - - // no validation rules for Key - - // no validation rules for Version - - // no validation rules for Origin - - if all { - switch v := interface{}(m.GetHandshakeTimeout()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, WebSocketServerValidationError{ - field: "HandshakeTimeout", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, WebSocketServerValidationError{ - field: "HandshakeTimeout", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHandshakeTimeout()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return WebSocketServerValidationError{ - field: "HandshakeTimeout", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetPingInterval()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, WebSocketServerValidationError{ - field: "PingInterval", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, WebSocketServerValidationError{ - field: "PingInterval", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPingInterval()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return WebSocketServerValidationError{ - field: "PingInterval", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for PingWhenIdle - - if len(errors) > 0 { - return WebSocketServerMultiError(errors) - } - - return nil -} - -// WebSocketServerMultiError is an error wrapping multiple validation errors -// returned by WebSocketServer.ValidateAll() if the designated constraints -// aren't met. -type WebSocketServerMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m WebSocketServerMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m WebSocketServerMultiError) AllErrors() []error { return m } - -// WebSocketServerValidationError is the validation error returned by -// WebSocketServer.Validate if the designated constraints aren't met. -type WebSocketServerValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e WebSocketServerValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e WebSocketServerValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e WebSocketServerValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e WebSocketServerValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e WebSocketServerValidationError) ErrorName() string { return "WebSocketServerValidationError" } - -// Error satisfies the builtin error interface -func (e WebSocketServerValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sWebSocketServer.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = WebSocketServerValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = WebSocketServerValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/annotations/deprecation.pb.go b/vendor/github.com/cilium/proxy/go/envoy/annotations/deprecation.pb.go deleted file mode 100644 index e05bc71ce..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/annotations/deprecation.pb.go +++ /dev/null @@ -1,164 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/annotations/deprecation.proto - -package annotations - -import ( - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - descriptorpb "google.golang.org/protobuf/types/descriptorpb" - reflect "reflect" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -var file_envoy_annotations_deprecation_proto_extTypes = []protoimpl.ExtensionInfo{ - { - ExtendedType: (*descriptorpb.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 189503207, - Name: "envoy.annotations.disallowed_by_default", - Tag: "varint,189503207,opt,name=disallowed_by_default", - Filename: "envoy/annotations/deprecation.proto", - }, - { - ExtendedType: (*descriptorpb.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 157299826, - Name: "envoy.annotations.deprecated_at_minor_version", - Tag: "bytes,157299826,opt,name=deprecated_at_minor_version", - Filename: "envoy/annotations/deprecation.proto", - }, - { - ExtendedType: (*descriptorpb.EnumValueOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 70100853, - Name: "envoy.annotations.disallowed_by_default_enum", - Tag: "varint,70100853,opt,name=disallowed_by_default_enum", - Filename: "envoy/annotations/deprecation.proto", - }, - { - ExtendedType: (*descriptorpb.EnumValueOptions)(nil), - ExtensionType: (*string)(nil), - Field: 181198657, - Name: "envoy.annotations.deprecated_at_minor_version_enum", - Tag: "bytes,181198657,opt,name=deprecated_at_minor_version_enum", - Filename: "envoy/annotations/deprecation.proto", - }, -} - -// Extension fields to descriptorpb.FieldOptions. -var ( - // optional bool disallowed_by_default = 189503207; - E_DisallowedByDefault = &file_envoy_annotations_deprecation_proto_extTypes[0] - // The API major and minor version on which the field was deprecated - // (e.g., "3.5" for major version 3 and minor version 5). - // - // optional string deprecated_at_minor_version = 157299826; - E_DeprecatedAtMinorVersion = &file_envoy_annotations_deprecation_proto_extTypes[1] -) - -// Extension fields to descriptorpb.EnumValueOptions. -var ( - // optional bool disallowed_by_default_enum = 70100853; - E_DisallowedByDefaultEnum = &file_envoy_annotations_deprecation_proto_extTypes[2] - // The API major and minor version on which the enum value was deprecated - // (e.g., "3.5" for major version 3 and minor version 5). - // - // optional string deprecated_at_minor_version_enum = 181198657; - E_DeprecatedAtMinorVersionEnum = &file_envoy_annotations_deprecation_proto_extTypes[3] -) - -var File_envoy_annotations_deprecation_proto protoreflect.FileDescriptor - -var file_envoy_annotations_deprecation_proto_rawDesc = []byte{ - 0x0a, 0x23, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2f, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x11, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x6e, 0x6e, - 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3a, 0x54, 0x0a, 0x15, 0x64, 0x69, - 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x5f, 0x62, 0x79, 0x5f, 0x64, 0x65, 0x66, 0x61, - 0x75, 0x6c, 0x74, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x18, 0xe7, 0xad, 0xae, 0x5a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x64, 0x69, 0x73, - 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x42, 0x79, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, - 0x3a, 0x5f, 0x0a, 0x1b, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, - 0x74, 0x5f, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xf2, - 0xe8, 0x80, 0x4b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x18, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, - 0x74, 0x65, 0x64, 0x41, 0x74, 0x4d, 0x69, 0x6e, 0x6f, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x3a, 0x61, 0x0a, 0x1a, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x5f, - 0x62, 0x79, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x12, - 0x21, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x18, 0xf5, 0xce, 0xb6, 0x21, 0x20, 0x01, 0x28, 0x08, 0x52, 0x17, 0x64, 0x69, 0x73, - 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x42, 0x79, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, - 0x45, 0x6e, 0x75, 0x6d, 0x3a, 0x6c, 0x0a, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, - 0x65, 0x64, 0x5f, 0x61, 0x74, 0x5f, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x21, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xc1, 0xbe, 0xb3, 0x56, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x1c, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, - 0x41, 0x74, 0x4d, 0x69, 0x6e, 0x6f, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x6e, - 0x75, 0x6d, 0x42, 0x3a, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, - 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var file_envoy_annotations_deprecation_proto_goTypes = []interface{}{ - (*descriptorpb.FieldOptions)(nil), // 0: google.protobuf.FieldOptions - (*descriptorpb.EnumValueOptions)(nil), // 1: google.protobuf.EnumValueOptions -} -var file_envoy_annotations_deprecation_proto_depIdxs = []int32{ - 0, // 0: envoy.annotations.disallowed_by_default:extendee -> google.protobuf.FieldOptions - 0, // 1: envoy.annotations.deprecated_at_minor_version:extendee -> google.protobuf.FieldOptions - 1, // 2: envoy.annotations.disallowed_by_default_enum:extendee -> google.protobuf.EnumValueOptions - 1, // 3: envoy.annotations.deprecated_at_minor_version_enum:extendee -> google.protobuf.EnumValueOptions - 4, // [4:4] is the sub-list for method output_type - 4, // [4:4] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 0, // [0:4] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_envoy_annotations_deprecation_proto_init() } -func file_envoy_annotations_deprecation_proto_init() { - if File_envoy_annotations_deprecation_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_annotations_deprecation_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 4, - NumServices: 0, - }, - GoTypes: file_envoy_annotations_deprecation_proto_goTypes, - DependencyIndexes: file_envoy_annotations_deprecation_proto_depIdxs, - ExtensionInfos: file_envoy_annotations_deprecation_proto_extTypes, - }.Build() - File_envoy_annotations_deprecation_proto = out.File - file_envoy_annotations_deprecation_proto_rawDesc = nil - file_envoy_annotations_deprecation_proto_goTypes = nil - file_envoy_annotations_deprecation_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/annotations/deprecation.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/annotations/deprecation.pb.validate.go deleted file mode 100644 index 2452fcdd6..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/annotations/deprecation.pb.validate.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/annotations/deprecation.proto - -package annotations - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) diff --git a/vendor/github.com/cilium/proxy/go/envoy/annotations/resource.pb.go b/vendor/github.com/cilium/proxy/go/envoy/annotations/resource.pb.go deleted file mode 100644 index 9ec8cf0dd..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/annotations/resource.pb.go +++ /dev/null @@ -1,184 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/annotations/resource.proto - -package annotations - -import ( - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - descriptorpb "google.golang.org/protobuf/types/descriptorpb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -type ResourceAnnotation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Annotation for xDS services that indicates the fully-qualified Protobuf type for the resource - // type. - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` -} - -func (x *ResourceAnnotation) Reset() { - *x = ResourceAnnotation{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_annotations_resource_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ResourceAnnotation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ResourceAnnotation) ProtoMessage() {} - -func (x *ResourceAnnotation) ProtoReflect() protoreflect.Message { - mi := &file_envoy_annotations_resource_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ResourceAnnotation.ProtoReflect.Descriptor instead. -func (*ResourceAnnotation) Descriptor() ([]byte, []int) { - return file_envoy_annotations_resource_proto_rawDescGZIP(), []int{0} -} - -func (x *ResourceAnnotation) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -var file_envoy_annotations_resource_proto_extTypes = []protoimpl.ExtensionInfo{ - { - ExtendedType: (*descriptorpb.ServiceOptions)(nil), - ExtensionType: (*ResourceAnnotation)(nil), - Field: 265073217, - Name: "envoy.annotations.resource", - Tag: "bytes,265073217,opt,name=resource", - Filename: "envoy/annotations/resource.proto", - }, -} - -// Extension fields to descriptorpb.ServiceOptions. -var ( - // optional envoy.annotations.ResourceAnnotation resource = 265073217; - E_Resource = &file_envoy_annotations_resource_proto_extTypes[0] -) - -var File_envoy_annotations_resource_proto protoreflect.FileDescriptor - -var file_envoy_annotations_resource_proto_rawDesc = []byte{ - 0x0a, 0x20, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x11, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, - 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x28, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x3a, 0x65, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1f, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xc1, - 0xe4, 0xb2, 0x7e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, - 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x3a, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, - 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, - 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_annotations_resource_proto_rawDescOnce sync.Once - file_envoy_annotations_resource_proto_rawDescData = file_envoy_annotations_resource_proto_rawDesc -) - -func file_envoy_annotations_resource_proto_rawDescGZIP() []byte { - file_envoy_annotations_resource_proto_rawDescOnce.Do(func() { - file_envoy_annotations_resource_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_annotations_resource_proto_rawDescData) - }) - return file_envoy_annotations_resource_proto_rawDescData -} - -var file_envoy_annotations_resource_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_annotations_resource_proto_goTypes = []interface{}{ - (*ResourceAnnotation)(nil), // 0: envoy.annotations.ResourceAnnotation - (*descriptorpb.ServiceOptions)(nil), // 1: google.protobuf.ServiceOptions -} -var file_envoy_annotations_resource_proto_depIdxs = []int32{ - 1, // 0: envoy.annotations.resource:extendee -> google.protobuf.ServiceOptions - 0, // 1: envoy.annotations.resource:type_name -> envoy.annotations.ResourceAnnotation - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 1, // [1:2] is the sub-list for extension type_name - 0, // [0:1] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_envoy_annotations_resource_proto_init() } -func file_envoy_annotations_resource_proto_init() { - if File_envoy_annotations_resource_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_envoy_annotations_resource_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResourceAnnotation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_annotations_resource_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 1, - NumServices: 0, - }, - GoTypes: file_envoy_annotations_resource_proto_goTypes, - DependencyIndexes: file_envoy_annotations_resource_proto_depIdxs, - MessageInfos: file_envoy_annotations_resource_proto_msgTypes, - ExtensionInfos: file_envoy_annotations_resource_proto_extTypes, - }.Build() - File_envoy_annotations_resource_proto = out.File - file_envoy_annotations_resource_proto_rawDesc = nil - file_envoy_annotations_resource_proto_goTypes = nil - file_envoy_annotations_resource_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/annotations/resource.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/annotations/resource.pb.validate.go deleted file mode 100644 index 05dc78968..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/annotations/resource.pb.validate.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/annotations/resource.proto - -package annotations - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on ResourceAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ResourceAnnotation) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ResourceAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ResourceAnnotationMultiError, or nil if none found. -func (m *ResourceAnnotation) ValidateAll() error { - return m.validate(true) -} - -func (m *ResourceAnnotation) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Type - - if len(errors) > 0 { - return ResourceAnnotationMultiError(errors) - } - - return nil -} - -// ResourceAnnotationMultiError is an error wrapping multiple validation errors -// returned by ResourceAnnotation.ValidateAll() if the designated constraints -// aren't met. -type ResourceAnnotationMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ResourceAnnotationMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ResourceAnnotationMultiError) AllErrors() []error { return m } - -// ResourceAnnotationValidationError is the validation error returned by -// ResourceAnnotation.Validate if the designated constraints aren't met. -type ResourceAnnotationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ResourceAnnotationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ResourceAnnotationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ResourceAnnotationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ResourceAnnotationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ResourceAnnotationValidationError) ErrorName() string { - return "ResourceAnnotationValidationError" -} - -// Error satisfies the builtin error interface -func (e ResourceAnnotationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sResourceAnnotation.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ResourceAnnotationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ResourceAnnotationValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/address.pb.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/address.pb.go deleted file mode 100644 index 499b83fb2..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/address.pb.go +++ /dev/null @@ -1,1115 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/config/core/v3/address.proto - -package corev3 - -import ( - _ "github.com/cilium/proxy/go/envoy/annotations" - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -type SocketAddress_Protocol int32 - -const ( - SocketAddress_TCP SocketAddress_Protocol = 0 - SocketAddress_UDP SocketAddress_Protocol = 1 -) - -// Enum value maps for SocketAddress_Protocol. -var ( - SocketAddress_Protocol_name = map[int32]string{ - 0: "TCP", - 1: "UDP", - } - SocketAddress_Protocol_value = map[string]int32{ - "TCP": 0, - "UDP": 1, - } -) - -func (x SocketAddress_Protocol) Enum() *SocketAddress_Protocol { - p := new(SocketAddress_Protocol) - *p = x - return p -} - -func (x SocketAddress_Protocol) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (SocketAddress_Protocol) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_config_core_v3_address_proto_enumTypes[0].Descriptor() -} - -func (SocketAddress_Protocol) Type() protoreflect.EnumType { - return &file_envoy_config_core_v3_address_proto_enumTypes[0] -} - -func (x SocketAddress_Protocol) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use SocketAddress_Protocol.Descriptor instead. -func (SocketAddress_Protocol) EnumDescriptor() ([]byte, []int) { - return file_envoy_config_core_v3_address_proto_rawDescGZIP(), []int{2, 0} -} - -type Pipe struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Unix Domain Socket path. On Linux, paths starting with '@' will use the - // abstract namespace. The starting '@' is replaced by a null byte by Envoy. - // Paths starting with '@' will result in an error in environments other than - // Linux. - Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` - // The mode for the Pipe. Not applicable for abstract sockets. - Mode uint32 `protobuf:"varint,2,opt,name=mode,proto3" json:"mode,omitempty"` -} - -func (x *Pipe) Reset() { - *x = Pipe{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_address_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Pipe) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Pipe) ProtoMessage() {} - -func (x *Pipe) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_address_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Pipe.ProtoReflect.Descriptor instead. -func (*Pipe) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_address_proto_rawDescGZIP(), []int{0} -} - -func (x *Pipe) GetPath() string { - if x != nil { - return x.Path - } - return "" -} - -func (x *Pipe) GetMode() uint32 { - if x != nil { - return x.Mode - } - return 0 -} - -// The address represents an envoy internal listener. -// [#comment: TODO(asraa): When address available, remove workaround from test/server/server_fuzz_test.cc:30.] -type EnvoyInternalAddress struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to AddressNameSpecifier: - // - // *EnvoyInternalAddress_ServerListenerName - AddressNameSpecifier isEnvoyInternalAddress_AddressNameSpecifier `protobuf_oneof:"address_name_specifier"` - // Specifies an endpoint identifier to distinguish between multiple endpoints for the same internal listener in a - // single upstream pool. Only used in the upstream addresses for tracking changes to individual endpoints. This, for - // example, may be set to the final destination IP for the target internal listener. - EndpointId string `protobuf:"bytes,2,opt,name=endpoint_id,json=endpointId,proto3" json:"endpoint_id,omitempty"` -} - -func (x *EnvoyInternalAddress) Reset() { - *x = EnvoyInternalAddress{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_address_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EnvoyInternalAddress) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EnvoyInternalAddress) ProtoMessage() {} - -func (x *EnvoyInternalAddress) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_address_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EnvoyInternalAddress.ProtoReflect.Descriptor instead. -func (*EnvoyInternalAddress) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_address_proto_rawDescGZIP(), []int{1} -} - -func (m *EnvoyInternalAddress) GetAddressNameSpecifier() isEnvoyInternalAddress_AddressNameSpecifier { - if m != nil { - return m.AddressNameSpecifier - } - return nil -} - -func (x *EnvoyInternalAddress) GetServerListenerName() string { - if x, ok := x.GetAddressNameSpecifier().(*EnvoyInternalAddress_ServerListenerName); ok { - return x.ServerListenerName - } - return "" -} - -func (x *EnvoyInternalAddress) GetEndpointId() string { - if x != nil { - return x.EndpointId - } - return "" -} - -type isEnvoyInternalAddress_AddressNameSpecifier interface { - isEnvoyInternalAddress_AddressNameSpecifier() -} - -type EnvoyInternalAddress_ServerListenerName struct { - // Specifies the :ref:`name ` of the - // internal listener. - ServerListenerName string `protobuf:"bytes,1,opt,name=server_listener_name,json=serverListenerName,proto3,oneof"` -} - -func (*EnvoyInternalAddress_ServerListenerName) isEnvoyInternalAddress_AddressNameSpecifier() {} - -// [#next-free-field: 7] -type SocketAddress struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Protocol SocketAddress_Protocol `protobuf:"varint,1,opt,name=protocol,proto3,enum=envoy.config.core.v3.SocketAddress_Protocol" json:"protocol,omitempty"` - // The address for this socket. :ref:`Listeners ` will bind - // to the address. An empty address is not allowed. Specify “0.0.0.0“ or “::“ - // to bind to any address. [#comment:TODO(zuercher) reinstate when implemented: - // It is possible to distinguish a Listener address via the prefix/suffix matching - // in :ref:`FilterChainMatch `.] When used - // within an upstream :ref:`BindConfig `, the address - // controls the source address of outbound connections. For :ref:`clusters - // `, the cluster type determines whether the - // address must be an IP (“STATIC“ or “EDS“ clusters) or a hostname resolved by DNS - // (“STRICT_DNS“ or “LOGICAL_DNS“ clusters). Address resolution can be customized - // via :ref:`resolver_name `. - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` - // Types that are assignable to PortSpecifier: - // - // *SocketAddress_PortValue - // *SocketAddress_NamedPort - PortSpecifier isSocketAddress_PortSpecifier `protobuf_oneof:"port_specifier"` - // The name of the custom resolver. This must have been registered with Envoy. If - // this is empty, a context dependent default applies. If the address is a concrete - // IP address, no resolution will occur. If address is a hostname this - // should be set for resolution other than DNS. Specifying a custom resolver with - // “STRICT_DNS“ or “LOGICAL_DNS“ will generate an error at runtime. - ResolverName string `protobuf:"bytes,5,opt,name=resolver_name,json=resolverName,proto3" json:"resolver_name,omitempty"` - // When binding to an IPv6 address above, this enables `IPv4 compatibility - // `_. Binding to “::“ will - // allow both IPv4 and IPv6 connections, with peer IPv4 addresses mapped into - // IPv6 space as “::FFFF:“. - Ipv4Compat bool `protobuf:"varint,6,opt,name=ipv4_compat,json=ipv4Compat,proto3" json:"ipv4_compat,omitempty"` -} - -func (x *SocketAddress) Reset() { - *x = SocketAddress{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_address_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SocketAddress) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SocketAddress) ProtoMessage() {} - -func (x *SocketAddress) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_address_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SocketAddress.ProtoReflect.Descriptor instead. -func (*SocketAddress) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_address_proto_rawDescGZIP(), []int{2} -} - -func (x *SocketAddress) GetProtocol() SocketAddress_Protocol { - if x != nil { - return x.Protocol - } - return SocketAddress_TCP -} - -func (x *SocketAddress) GetAddress() string { - if x != nil { - return x.Address - } - return "" -} - -func (m *SocketAddress) GetPortSpecifier() isSocketAddress_PortSpecifier { - if m != nil { - return m.PortSpecifier - } - return nil -} - -func (x *SocketAddress) GetPortValue() uint32 { - if x, ok := x.GetPortSpecifier().(*SocketAddress_PortValue); ok { - return x.PortValue - } - return 0 -} - -func (x *SocketAddress) GetNamedPort() string { - if x, ok := x.GetPortSpecifier().(*SocketAddress_NamedPort); ok { - return x.NamedPort - } - return "" -} - -func (x *SocketAddress) GetResolverName() string { - if x != nil { - return x.ResolverName - } - return "" -} - -func (x *SocketAddress) GetIpv4Compat() bool { - if x != nil { - return x.Ipv4Compat - } - return false -} - -type isSocketAddress_PortSpecifier interface { - isSocketAddress_PortSpecifier() -} - -type SocketAddress_PortValue struct { - PortValue uint32 `protobuf:"varint,3,opt,name=port_value,json=portValue,proto3,oneof"` -} - -type SocketAddress_NamedPort struct { - // This is only valid if :ref:`resolver_name - // ` is specified below and the - // named resolver is capable of named port resolution. - NamedPort string `protobuf:"bytes,4,opt,name=named_port,json=namedPort,proto3,oneof"` -} - -func (*SocketAddress_PortValue) isSocketAddress_PortSpecifier() {} - -func (*SocketAddress_NamedPort) isSocketAddress_PortSpecifier() {} - -type TcpKeepalive struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Maximum number of keepalive probes to send without response before deciding - // the connection is dead. Default is to use the OS level configuration (unless - // overridden, Linux defaults to 9.) - KeepaliveProbes *wrapperspb.UInt32Value `protobuf:"bytes,1,opt,name=keepalive_probes,json=keepaliveProbes,proto3" json:"keepalive_probes,omitempty"` - // The number of seconds a connection needs to be idle before keep-alive probes - // start being sent. Default is to use the OS level configuration (unless - // overridden, Linux defaults to 7200s (i.e., 2 hours.) - KeepaliveTime *wrapperspb.UInt32Value `protobuf:"bytes,2,opt,name=keepalive_time,json=keepaliveTime,proto3" json:"keepalive_time,omitempty"` - // The number of seconds between keep-alive probes. Default is to use the OS - // level configuration (unless overridden, Linux defaults to 75s.) - KeepaliveInterval *wrapperspb.UInt32Value `protobuf:"bytes,3,opt,name=keepalive_interval,json=keepaliveInterval,proto3" json:"keepalive_interval,omitempty"` -} - -func (x *TcpKeepalive) Reset() { - *x = TcpKeepalive{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_address_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TcpKeepalive) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TcpKeepalive) ProtoMessage() {} - -func (x *TcpKeepalive) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_address_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TcpKeepalive.ProtoReflect.Descriptor instead. -func (*TcpKeepalive) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_address_proto_rawDescGZIP(), []int{3} -} - -func (x *TcpKeepalive) GetKeepaliveProbes() *wrapperspb.UInt32Value { - if x != nil { - return x.KeepaliveProbes - } - return nil -} - -func (x *TcpKeepalive) GetKeepaliveTime() *wrapperspb.UInt32Value { - if x != nil { - return x.KeepaliveTime - } - return nil -} - -func (x *TcpKeepalive) GetKeepaliveInterval() *wrapperspb.UInt32Value { - if x != nil { - return x.KeepaliveInterval - } - return nil -} - -type ExtraSourceAddress struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The additional address to bind. - Address *SocketAddress `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // Additional socket options that may not be present in Envoy source code or - // precompiled binaries. If specified, this will override the - // :ref:`socket_options ` - // in the BindConfig. If specified with no - // :ref:`socket_options ` - // or an empty list of :ref:`socket_options `, - // it means no socket option will apply. - SocketOptions *SocketOptionsOverride `protobuf:"bytes,2,opt,name=socket_options,json=socketOptions,proto3" json:"socket_options,omitempty"` -} - -func (x *ExtraSourceAddress) Reset() { - *x = ExtraSourceAddress{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_address_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ExtraSourceAddress) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExtraSourceAddress) ProtoMessage() {} - -func (x *ExtraSourceAddress) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_address_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExtraSourceAddress.ProtoReflect.Descriptor instead. -func (*ExtraSourceAddress) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_address_proto_rawDescGZIP(), []int{4} -} - -func (x *ExtraSourceAddress) GetAddress() *SocketAddress { - if x != nil { - return x.Address - } - return nil -} - -func (x *ExtraSourceAddress) GetSocketOptions() *SocketOptionsOverride { - if x != nil { - return x.SocketOptions - } - return nil -} - -// [#next-free-field: 7] -type BindConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The address to bind to when creating a socket. - SourceAddress *SocketAddress `protobuf:"bytes,1,opt,name=source_address,json=sourceAddress,proto3" json:"source_address,omitempty"` - // Whether to set the “IP_FREEBIND“ option when creating the socket. When this - // flag is set to true, allows the :ref:`source_address - // ` to be an IP address - // that is not configured on the system running Envoy. When this flag is set - // to false, the option “IP_FREEBIND“ is disabled on the socket. When this - // flag is not set (default), the socket is not modified, i.e. the option is - // neither enabled nor disabled. - Freebind *wrapperspb.BoolValue `protobuf:"bytes,2,opt,name=freebind,proto3" json:"freebind,omitempty"` - // Additional socket options that may not be present in Envoy source code or - // precompiled binaries. - SocketOptions []*SocketOption `protobuf:"bytes,3,rep,name=socket_options,json=socketOptions,proto3" json:"socket_options,omitempty"` - // Extra source addresses appended to the address specified in the “source_address“ - // field. This enables to specify multiple source addresses. - // The source address selection is determined by :ref:`local_address_selector - // `. - ExtraSourceAddresses []*ExtraSourceAddress `protobuf:"bytes,5,rep,name=extra_source_addresses,json=extraSourceAddresses,proto3" json:"extra_source_addresses,omitempty"` - // Deprecated by - // :ref:`extra_source_addresses ` - // - // Deprecated: Do not use. - AdditionalSourceAddresses []*SocketAddress `protobuf:"bytes,4,rep,name=additional_source_addresses,json=additionalSourceAddresses,proto3" json:"additional_source_addresses,omitempty"` - // Custom local address selector to override the default (i.e. - // :ref:`DefaultLocalAddressSelector - // `). - // [#extension-category: envoy.upstream.local_address_selector] - LocalAddressSelector *TypedExtensionConfig `protobuf:"bytes,6,opt,name=local_address_selector,json=localAddressSelector,proto3" json:"local_address_selector,omitempty"` -} - -func (x *BindConfig) Reset() { - *x = BindConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_address_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BindConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BindConfig) ProtoMessage() {} - -func (x *BindConfig) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_address_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BindConfig.ProtoReflect.Descriptor instead. -func (*BindConfig) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_address_proto_rawDescGZIP(), []int{5} -} - -func (x *BindConfig) GetSourceAddress() *SocketAddress { - if x != nil { - return x.SourceAddress - } - return nil -} - -func (x *BindConfig) GetFreebind() *wrapperspb.BoolValue { - if x != nil { - return x.Freebind - } - return nil -} - -func (x *BindConfig) GetSocketOptions() []*SocketOption { - if x != nil { - return x.SocketOptions - } - return nil -} - -func (x *BindConfig) GetExtraSourceAddresses() []*ExtraSourceAddress { - if x != nil { - return x.ExtraSourceAddresses - } - return nil -} - -// Deprecated: Do not use. -func (x *BindConfig) GetAdditionalSourceAddresses() []*SocketAddress { - if x != nil { - return x.AdditionalSourceAddresses - } - return nil -} - -func (x *BindConfig) GetLocalAddressSelector() *TypedExtensionConfig { - if x != nil { - return x.LocalAddressSelector - } - return nil -} - -// Addresses specify either a logical or physical address and port, which are -// used to tell Envoy where to bind/listen, connect to upstream and find -// management servers. -type Address struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Address: - // - // *Address_SocketAddress - // *Address_Pipe - // *Address_EnvoyInternalAddress - Address isAddress_Address `protobuf_oneof:"address"` -} - -func (x *Address) Reset() { - *x = Address{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_address_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Address) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Address) ProtoMessage() {} - -func (x *Address) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_address_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Address.ProtoReflect.Descriptor instead. -func (*Address) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_address_proto_rawDescGZIP(), []int{6} -} - -func (m *Address) GetAddress() isAddress_Address { - if m != nil { - return m.Address - } - return nil -} - -func (x *Address) GetSocketAddress() *SocketAddress { - if x, ok := x.GetAddress().(*Address_SocketAddress); ok { - return x.SocketAddress - } - return nil -} - -func (x *Address) GetPipe() *Pipe { - if x, ok := x.GetAddress().(*Address_Pipe); ok { - return x.Pipe - } - return nil -} - -func (x *Address) GetEnvoyInternalAddress() *EnvoyInternalAddress { - if x, ok := x.GetAddress().(*Address_EnvoyInternalAddress); ok { - return x.EnvoyInternalAddress - } - return nil -} - -type isAddress_Address interface { - isAddress_Address() -} - -type Address_SocketAddress struct { - SocketAddress *SocketAddress `protobuf:"bytes,1,opt,name=socket_address,json=socketAddress,proto3,oneof"` -} - -type Address_Pipe struct { - Pipe *Pipe `protobuf:"bytes,2,opt,name=pipe,proto3,oneof"` -} - -type Address_EnvoyInternalAddress struct { - // Specifies a user-space address handled by :ref:`internal listeners - // `. - EnvoyInternalAddress *EnvoyInternalAddress `protobuf:"bytes,3,opt,name=envoy_internal_address,json=envoyInternalAddress,proto3,oneof"` -} - -func (*Address_SocketAddress) isAddress_Address() {} - -func (*Address_Pipe) isAddress_Address() {} - -func (*Address_EnvoyInternalAddress) isAddress_Address() {} - -// CidrRange specifies an IP Address and a prefix length to construct -// the subnet mask for a `CIDR `_ range. -type CidrRange struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // IPv4 or IPv6 address, e.g. “192.0.0.0“ or “2001:db8::“. - AddressPrefix string `protobuf:"bytes,1,opt,name=address_prefix,json=addressPrefix,proto3" json:"address_prefix,omitempty"` - // Length of prefix, e.g. 0, 32. Defaults to 0 when unset. - PrefixLen *wrapperspb.UInt32Value `protobuf:"bytes,2,opt,name=prefix_len,json=prefixLen,proto3" json:"prefix_len,omitempty"` -} - -func (x *CidrRange) Reset() { - *x = CidrRange{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_address_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CidrRange) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CidrRange) ProtoMessage() {} - -func (x *CidrRange) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_address_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CidrRange.ProtoReflect.Descriptor instead. -func (*CidrRange) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_address_proto_rawDescGZIP(), []int{7} -} - -func (x *CidrRange) GetAddressPrefix() string { - if x != nil { - return x.AddressPrefix - } - return "" -} - -func (x *CidrRange) GetPrefixLen() *wrapperspb.UInt32Value { - if x != nil { - return x.PrefixLen - } - return nil -} - -var File_envoy_config_core_v3_address_proto protoreflect.FileDescriptor - -var file_envoy_config_core_v3_address_proto_rawDesc = []byte{ - 0x0a, 0x22, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x1a, 0x24, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, - 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x28, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x6f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, - 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x64, 0x65, - 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, - 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x60, 0x0a, 0x04, 0x50, 0x69, - 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, - 0x1c, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x08, 0xfa, - 0x42, 0x05, 0x2a, 0x03, 0x18, 0xff, 0x03, 0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x3a, 0x1d, 0x9a, - 0xc5, 0x88, 0x1e, 0x18, 0x0a, 0x16, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x69, 0x70, 0x65, 0x22, 0x8a, 0x01, 0x0a, - 0x14, 0x45, 0x6e, 0x76, 0x6f, 0x79, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x32, 0x0a, 0x14, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, - 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x12, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, 0x69, 0x73, - 0x74, 0x65, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x65, 0x6e, 0x64, - 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, - 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x49, 0x64, 0x42, 0x1d, 0x0a, 0x16, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x65, 0x72, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0xf6, 0x02, 0x0a, 0x0d, 0x53, 0x6f, - 0x63, 0x6b, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x52, 0x0a, 0x08, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x42, 0x08, 0xfa, 0x42, 0x05, - 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, - 0x21, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x2a, 0x0a, 0x0a, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x09, 0xfa, 0x42, 0x06, 0x2a, 0x04, 0x18, 0xff, 0xff, - 0x03, 0x48, 0x00, 0x52, 0x09, 0x70, 0x6f, 0x72, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, - 0x0a, 0x0a, 0x6e, 0x61, 0x6d, 0x65, 0x64, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x6f, 0x72, 0x74, 0x12, - 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x72, - 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x70, 0x76, 0x34, 0x5f, 0x63, 0x6f, 0x6d, - 0x70, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x70, 0x76, 0x34, 0x43, - 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x22, 0x1c, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, - 0x6c, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x43, 0x50, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x55, 0x44, - 0x50, 0x10, 0x01, 0x3a, 0x26, 0x9a, 0xc5, 0x88, 0x1e, 0x21, 0x0a, 0x1f, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x6f, - 0x63, 0x6b, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x42, 0x15, 0x0a, 0x0e, 0x70, - 0x6f, 0x72, 0x74, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x03, 0xf8, - 0x42, 0x01, 0x22, 0x90, 0x02, 0x0a, 0x0c, 0x54, 0x63, 0x70, 0x4b, 0x65, 0x65, 0x70, 0x61, 0x6c, - 0x69, 0x76, 0x65, 0x12, 0x47, 0x0a, 0x10, 0x6b, 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, - 0x5f, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0f, 0x6b, 0x65, 0x65, - 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x73, 0x12, 0x43, 0x0a, 0x0e, - 0x6b, 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x52, 0x0d, 0x6b, 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x54, 0x69, 0x6d, - 0x65, 0x12, 0x4b, 0x0a, 0x12, 0x6b, 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x5f, 0x69, - 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x11, 0x6b, 0x65, 0x65, - 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x3a, 0x25, - 0x9a, 0xc5, 0x88, 0x1e, 0x20, 0x0a, 0x1e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x54, 0x63, 0x70, 0x4b, 0x65, 0x65, 0x70, - 0x61, 0x6c, 0x69, 0x76, 0x65, 0x22, 0xb1, 0x01, 0x0a, 0x12, 0x45, 0x78, 0x74, 0x72, 0x61, 0x53, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x47, 0x0a, 0x07, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x07, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x52, 0x0a, 0x0e, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x5f, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x52, 0x0d, 0x73, 0x6f, 0x63, 0x6b, - 0x65, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xb4, 0x04, 0x0a, 0x0a, 0x42, 0x69, - 0x6e, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x4a, 0x0a, 0x0e, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x23, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, - 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x0d, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x12, 0x36, 0x0a, 0x08, 0x66, 0x72, 0x65, 0x65, 0x62, 0x69, 0x6e, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x52, 0x08, 0x66, 0x72, 0x65, 0x65, 0x62, 0x69, 0x6e, 0x64, 0x12, 0x49, 0x0a, 0x0e, - 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x6f, 0x63, 0x6b, - 0x65, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, - 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x5e, 0x0a, 0x16, 0x65, 0x78, 0x74, 0x72, 0x61, - 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, - 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x45, - 0x78, 0x74, 0x72, 0x61, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x52, 0x14, 0x65, 0x78, 0x74, 0x72, 0x61, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x70, 0x0a, 0x1b, 0x61, 0x64, 0x64, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x61, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, - 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x42, 0x0b, 0x18, 0x01, 0x92, 0xc7, 0x86, 0xd8, 0x04, 0x03, 0x33, 0x2e, 0x30, 0x52, 0x19, - 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x60, 0x0a, 0x16, 0x6c, 0x6f, 0x63, - 0x61, 0x6c, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, - 0x74, 0x6f, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, - 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x14, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x3a, 0x23, 0x9a, 0xc5, 0x88, - 0x1e, 0x1e, 0x0a, 0x1c, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x42, 0x69, 0x6e, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x22, 0x9f, 0x02, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x4c, 0x0a, 0x0e, - 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x6f, 0x63, 0x6b, - 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x48, 0x00, 0x52, 0x0d, 0x73, 0x6f, 0x63, - 0x6b, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x30, 0x0a, 0x04, 0x70, 0x69, - 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, - 0x50, 0x69, 0x70, 0x65, 0x48, 0x00, 0x52, 0x04, 0x70, 0x69, 0x70, 0x65, 0x12, 0x62, 0x0a, 0x16, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, - 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x6e, 0x76, 0x6f, 0x79, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, - 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x48, 0x00, 0x52, 0x14, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x3a, 0x20, 0x9a, 0xc5, 0x88, 0x1e, 0x1b, 0x0a, 0x19, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x42, 0x0e, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x03, 0xf8, - 0x42, 0x01, 0x22, 0xa6, 0x01, 0x0a, 0x09, 0x43, 0x69, 0x64, 0x72, 0x52, 0x61, 0x6e, 0x67, 0x65, - 0x12, 0x2e, 0x0a, 0x0e, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, - 0x69, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, - 0x01, 0x52, 0x0d, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, - 0x12, 0x45, 0x0a, 0x0a, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x2a, 0x03, 0x18, 0x80, 0x01, 0x52, 0x09, 0x70, 0x72, - 0x65, 0x66, 0x69, 0x78, 0x4c, 0x65, 0x6e, 0x3a, 0x22, 0x9a, 0xc5, 0x88, 0x1e, 0x1d, 0x0a, 0x1b, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x43, 0x69, 0x64, 0x72, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x42, 0x80, 0x01, 0x0a, 0x22, - 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, - 0x76, 0x33, 0x42, 0x0c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x3b, - 0x63, 0x6f, 0x72, 0x65, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_config_core_v3_address_proto_rawDescOnce sync.Once - file_envoy_config_core_v3_address_proto_rawDescData = file_envoy_config_core_v3_address_proto_rawDesc -) - -func file_envoy_config_core_v3_address_proto_rawDescGZIP() []byte { - file_envoy_config_core_v3_address_proto_rawDescOnce.Do(func() { - file_envoy_config_core_v3_address_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_config_core_v3_address_proto_rawDescData) - }) - return file_envoy_config_core_v3_address_proto_rawDescData -} - -var file_envoy_config_core_v3_address_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_envoy_config_core_v3_address_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_envoy_config_core_v3_address_proto_goTypes = []interface{}{ - (SocketAddress_Protocol)(0), // 0: envoy.config.core.v3.SocketAddress.Protocol - (*Pipe)(nil), // 1: envoy.config.core.v3.Pipe - (*EnvoyInternalAddress)(nil), // 2: envoy.config.core.v3.EnvoyInternalAddress - (*SocketAddress)(nil), // 3: envoy.config.core.v3.SocketAddress - (*TcpKeepalive)(nil), // 4: envoy.config.core.v3.TcpKeepalive - (*ExtraSourceAddress)(nil), // 5: envoy.config.core.v3.ExtraSourceAddress - (*BindConfig)(nil), // 6: envoy.config.core.v3.BindConfig - (*Address)(nil), // 7: envoy.config.core.v3.Address - (*CidrRange)(nil), // 8: envoy.config.core.v3.CidrRange - (*wrapperspb.UInt32Value)(nil), // 9: google.protobuf.UInt32Value - (*SocketOptionsOverride)(nil), // 10: envoy.config.core.v3.SocketOptionsOverride - (*wrapperspb.BoolValue)(nil), // 11: google.protobuf.BoolValue - (*SocketOption)(nil), // 12: envoy.config.core.v3.SocketOption - (*TypedExtensionConfig)(nil), // 13: envoy.config.core.v3.TypedExtensionConfig -} -var file_envoy_config_core_v3_address_proto_depIdxs = []int32{ - 0, // 0: envoy.config.core.v3.SocketAddress.protocol:type_name -> envoy.config.core.v3.SocketAddress.Protocol - 9, // 1: envoy.config.core.v3.TcpKeepalive.keepalive_probes:type_name -> google.protobuf.UInt32Value - 9, // 2: envoy.config.core.v3.TcpKeepalive.keepalive_time:type_name -> google.protobuf.UInt32Value - 9, // 3: envoy.config.core.v3.TcpKeepalive.keepalive_interval:type_name -> google.protobuf.UInt32Value - 3, // 4: envoy.config.core.v3.ExtraSourceAddress.address:type_name -> envoy.config.core.v3.SocketAddress - 10, // 5: envoy.config.core.v3.ExtraSourceAddress.socket_options:type_name -> envoy.config.core.v3.SocketOptionsOverride - 3, // 6: envoy.config.core.v3.BindConfig.source_address:type_name -> envoy.config.core.v3.SocketAddress - 11, // 7: envoy.config.core.v3.BindConfig.freebind:type_name -> google.protobuf.BoolValue - 12, // 8: envoy.config.core.v3.BindConfig.socket_options:type_name -> envoy.config.core.v3.SocketOption - 5, // 9: envoy.config.core.v3.BindConfig.extra_source_addresses:type_name -> envoy.config.core.v3.ExtraSourceAddress - 3, // 10: envoy.config.core.v3.BindConfig.additional_source_addresses:type_name -> envoy.config.core.v3.SocketAddress - 13, // 11: envoy.config.core.v3.BindConfig.local_address_selector:type_name -> envoy.config.core.v3.TypedExtensionConfig - 3, // 12: envoy.config.core.v3.Address.socket_address:type_name -> envoy.config.core.v3.SocketAddress - 1, // 13: envoy.config.core.v3.Address.pipe:type_name -> envoy.config.core.v3.Pipe - 2, // 14: envoy.config.core.v3.Address.envoy_internal_address:type_name -> envoy.config.core.v3.EnvoyInternalAddress - 9, // 15: envoy.config.core.v3.CidrRange.prefix_len:type_name -> google.protobuf.UInt32Value - 16, // [16:16] is the sub-list for method output_type - 16, // [16:16] is the sub-list for method input_type - 16, // [16:16] is the sub-list for extension type_name - 16, // [16:16] is the sub-list for extension extendee - 0, // [0:16] is the sub-list for field type_name -} - -func init() { file_envoy_config_core_v3_address_proto_init() } -func file_envoy_config_core_v3_address_proto_init() { - if File_envoy_config_core_v3_address_proto != nil { - return - } - file_envoy_config_core_v3_extension_proto_init() - file_envoy_config_core_v3_socket_option_proto_init() - if !protoimpl.UnsafeEnabled { - file_envoy_config_core_v3_address_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Pipe); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_address_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EnvoyInternalAddress); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_address_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SocketAddress); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_address_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TcpKeepalive); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_address_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExtraSourceAddress); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_address_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BindConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_address_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Address); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_address_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CidrRange); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_config_core_v3_address_proto_msgTypes[1].OneofWrappers = []interface{}{ - (*EnvoyInternalAddress_ServerListenerName)(nil), - } - file_envoy_config_core_v3_address_proto_msgTypes[2].OneofWrappers = []interface{}{ - (*SocketAddress_PortValue)(nil), - (*SocketAddress_NamedPort)(nil), - } - file_envoy_config_core_v3_address_proto_msgTypes[6].OneofWrappers = []interface{}{ - (*Address_SocketAddress)(nil), - (*Address_Pipe)(nil), - (*Address_EnvoyInternalAddress)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_config_core_v3_address_proto_rawDesc, - NumEnums: 1, - NumMessages: 8, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_config_core_v3_address_proto_goTypes, - DependencyIndexes: file_envoy_config_core_v3_address_proto_depIdxs, - EnumInfos: file_envoy_config_core_v3_address_proto_enumTypes, - MessageInfos: file_envoy_config_core_v3_address_proto_msgTypes, - }.Build() - File_envoy_config_core_v3_address_proto = out.File - file_envoy_config_core_v3_address_proto_rawDesc = nil - file_envoy_config_core_v3_address_proto_goTypes = nil - file_envoy_config_core_v3_address_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/address.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/address.pb.validate.go deleted file mode 100644 index 1bf3f9958..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/address.pb.validate.go +++ /dev/null @@ -1,1478 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/config/core/v3/address.proto - -package corev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on Pipe with the rules defined in the proto -// definition for this message. If any rules are violated, the first error -// encountered is returned, or nil if there are no violations. -func (m *Pipe) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Pipe with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in PipeMultiError, or nil if none found. -func (m *Pipe) ValidateAll() error { - return m.validate(true) -} - -func (m *Pipe) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetPath()) < 1 { - err := PipeValidationError{ - field: "Path", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if m.GetMode() > 511 { - err := PipeValidationError{ - field: "Mode", - reason: "value must be less than or equal to 511", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return PipeMultiError(errors) - } - - return nil -} - -// PipeMultiError is an error wrapping multiple validation errors returned by -// Pipe.ValidateAll() if the designated constraints aren't met. -type PipeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PipeMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m PipeMultiError) AllErrors() []error { return m } - -// PipeValidationError is the validation error returned by Pipe.Validate if the -// designated constraints aren't met. -type PipeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e PipeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e PipeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e PipeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e PipeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e PipeValidationError) ErrorName() string { return "PipeValidationError" } - -// Error satisfies the builtin error interface -func (e PipeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sPipe.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = PipeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = PipeValidationError{} - -// Validate checks the field values on EnvoyInternalAddress with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *EnvoyInternalAddress) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on EnvoyInternalAddress with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// EnvoyInternalAddressMultiError, or nil if none found. -func (m *EnvoyInternalAddress) ValidateAll() error { - return m.validate(true) -} - -func (m *EnvoyInternalAddress) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for EndpointId - - oneofAddressNameSpecifierPresent := false - switch v := m.AddressNameSpecifier.(type) { - case *EnvoyInternalAddress_ServerListenerName: - if v == nil { - err := EnvoyInternalAddressValidationError{ - field: "AddressNameSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofAddressNameSpecifierPresent = true - // no validation rules for ServerListenerName - default: - _ = v // ensures v is used - } - if !oneofAddressNameSpecifierPresent { - err := EnvoyInternalAddressValidationError{ - field: "AddressNameSpecifier", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return EnvoyInternalAddressMultiError(errors) - } - - return nil -} - -// EnvoyInternalAddressMultiError is an error wrapping multiple validation -// errors returned by EnvoyInternalAddress.ValidateAll() if the designated -// constraints aren't met. -type EnvoyInternalAddressMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m EnvoyInternalAddressMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m EnvoyInternalAddressMultiError) AllErrors() []error { return m } - -// EnvoyInternalAddressValidationError is the validation error returned by -// EnvoyInternalAddress.Validate if the designated constraints aren't met. -type EnvoyInternalAddressValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e EnvoyInternalAddressValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e EnvoyInternalAddressValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e EnvoyInternalAddressValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e EnvoyInternalAddressValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e EnvoyInternalAddressValidationError) ErrorName() string { - return "EnvoyInternalAddressValidationError" -} - -// Error satisfies the builtin error interface -func (e EnvoyInternalAddressValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sEnvoyInternalAddress.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = EnvoyInternalAddressValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = EnvoyInternalAddressValidationError{} - -// Validate checks the field values on SocketAddress with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *SocketAddress) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SocketAddress with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in SocketAddressMultiError, or -// nil if none found. -func (m *SocketAddress) ValidateAll() error { - return m.validate(true) -} - -func (m *SocketAddress) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if _, ok := SocketAddress_Protocol_name[int32(m.GetProtocol())]; !ok { - err := SocketAddressValidationError{ - field: "Protocol", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - if utf8.RuneCountInString(m.GetAddress()) < 1 { - err := SocketAddressValidationError{ - field: "Address", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for ResolverName - - // no validation rules for Ipv4Compat - - oneofPortSpecifierPresent := false - switch v := m.PortSpecifier.(type) { - case *SocketAddress_PortValue: - if v == nil { - err := SocketAddressValidationError{ - field: "PortSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofPortSpecifierPresent = true - - if m.GetPortValue() > 65535 { - err := SocketAddressValidationError{ - field: "PortValue", - reason: "value must be less than or equal to 65535", - } - if !all { - return err - } - errors = append(errors, err) - } - - case *SocketAddress_NamedPort: - if v == nil { - err := SocketAddressValidationError{ - field: "PortSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofPortSpecifierPresent = true - // no validation rules for NamedPort - default: - _ = v // ensures v is used - } - if !oneofPortSpecifierPresent { - err := SocketAddressValidationError{ - field: "PortSpecifier", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return SocketAddressMultiError(errors) - } - - return nil -} - -// SocketAddressMultiError is an error wrapping multiple validation errors -// returned by SocketAddress.ValidateAll() if the designated constraints -// aren't met. -type SocketAddressMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SocketAddressMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m SocketAddressMultiError) AllErrors() []error { return m } - -// SocketAddressValidationError is the validation error returned by -// SocketAddress.Validate if the designated constraints aren't met. -type SocketAddressValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SocketAddressValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SocketAddressValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SocketAddressValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SocketAddressValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SocketAddressValidationError) ErrorName() string { return "SocketAddressValidationError" } - -// Error satisfies the builtin error interface -func (e SocketAddressValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSocketAddress.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SocketAddressValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SocketAddressValidationError{} - -// Validate checks the field values on TcpKeepalive with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *TcpKeepalive) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on TcpKeepalive with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in TcpKeepaliveMultiError, or -// nil if none found. -func (m *TcpKeepalive) ValidateAll() error { - return m.validate(true) -} - -func (m *TcpKeepalive) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetKeepaliveProbes()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, TcpKeepaliveValidationError{ - field: "KeepaliveProbes", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, TcpKeepaliveValidationError{ - field: "KeepaliveProbes", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetKeepaliveProbes()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return TcpKeepaliveValidationError{ - field: "KeepaliveProbes", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetKeepaliveTime()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, TcpKeepaliveValidationError{ - field: "KeepaliveTime", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, TcpKeepaliveValidationError{ - field: "KeepaliveTime", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetKeepaliveTime()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return TcpKeepaliveValidationError{ - field: "KeepaliveTime", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetKeepaliveInterval()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, TcpKeepaliveValidationError{ - field: "KeepaliveInterval", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, TcpKeepaliveValidationError{ - field: "KeepaliveInterval", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetKeepaliveInterval()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return TcpKeepaliveValidationError{ - field: "KeepaliveInterval", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return TcpKeepaliveMultiError(errors) - } - - return nil -} - -// TcpKeepaliveMultiError is an error wrapping multiple validation errors -// returned by TcpKeepalive.ValidateAll() if the designated constraints aren't met. -type TcpKeepaliveMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m TcpKeepaliveMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m TcpKeepaliveMultiError) AllErrors() []error { return m } - -// TcpKeepaliveValidationError is the validation error returned by -// TcpKeepalive.Validate if the designated constraints aren't met. -type TcpKeepaliveValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TcpKeepaliveValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TcpKeepaliveValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TcpKeepaliveValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TcpKeepaliveValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TcpKeepaliveValidationError) ErrorName() string { return "TcpKeepaliveValidationError" } - -// Error satisfies the builtin error interface -func (e TcpKeepaliveValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTcpKeepalive.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TcpKeepaliveValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TcpKeepaliveValidationError{} - -// Validate checks the field values on ExtraSourceAddress with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ExtraSourceAddress) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ExtraSourceAddress with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ExtraSourceAddressMultiError, or nil if none found. -func (m *ExtraSourceAddress) ValidateAll() error { - return m.validate(true) -} - -func (m *ExtraSourceAddress) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetAddress() == nil { - err := ExtraSourceAddressValidationError{ - field: "Address", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetAddress()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExtraSourceAddressValidationError{ - field: "Address", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExtraSourceAddressValidationError{ - field: "Address", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExtraSourceAddressValidationError{ - field: "Address", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetSocketOptions()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExtraSourceAddressValidationError{ - field: "SocketOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExtraSourceAddressValidationError{ - field: "SocketOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSocketOptions()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExtraSourceAddressValidationError{ - field: "SocketOptions", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return ExtraSourceAddressMultiError(errors) - } - - return nil -} - -// ExtraSourceAddressMultiError is an error wrapping multiple validation errors -// returned by ExtraSourceAddress.ValidateAll() if the designated constraints -// aren't met. -type ExtraSourceAddressMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ExtraSourceAddressMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ExtraSourceAddressMultiError) AllErrors() []error { return m } - -// ExtraSourceAddressValidationError is the validation error returned by -// ExtraSourceAddress.Validate if the designated constraints aren't met. -type ExtraSourceAddressValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ExtraSourceAddressValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ExtraSourceAddressValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ExtraSourceAddressValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ExtraSourceAddressValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ExtraSourceAddressValidationError) ErrorName() string { - return "ExtraSourceAddressValidationError" -} - -// Error satisfies the builtin error interface -func (e ExtraSourceAddressValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sExtraSourceAddress.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ExtraSourceAddressValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ExtraSourceAddressValidationError{} - -// Validate checks the field values on BindConfig with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *BindConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on BindConfig with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in BindConfigMultiError, or -// nil if none found. -func (m *BindConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *BindConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetSourceAddress()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, BindConfigValidationError{ - field: "SourceAddress", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, BindConfigValidationError{ - field: "SourceAddress", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSourceAddress()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return BindConfigValidationError{ - field: "SourceAddress", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetFreebind()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, BindConfigValidationError{ - field: "Freebind", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, BindConfigValidationError{ - field: "Freebind", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetFreebind()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return BindConfigValidationError{ - field: "Freebind", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetSocketOptions() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, BindConfigValidationError{ - field: fmt.Sprintf("SocketOptions[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, BindConfigValidationError{ - field: fmt.Sprintf("SocketOptions[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return BindConfigValidationError{ - field: fmt.Sprintf("SocketOptions[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetExtraSourceAddresses() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, BindConfigValidationError{ - field: fmt.Sprintf("ExtraSourceAddresses[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, BindConfigValidationError{ - field: fmt.Sprintf("ExtraSourceAddresses[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return BindConfigValidationError{ - field: fmt.Sprintf("ExtraSourceAddresses[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetAdditionalSourceAddresses() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, BindConfigValidationError{ - field: fmt.Sprintf("AdditionalSourceAddresses[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, BindConfigValidationError{ - field: fmt.Sprintf("AdditionalSourceAddresses[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return BindConfigValidationError{ - field: fmt.Sprintf("AdditionalSourceAddresses[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetLocalAddressSelector()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, BindConfigValidationError{ - field: "LocalAddressSelector", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, BindConfigValidationError{ - field: "LocalAddressSelector", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetLocalAddressSelector()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return BindConfigValidationError{ - field: "LocalAddressSelector", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return BindConfigMultiError(errors) - } - - return nil -} - -// BindConfigMultiError is an error wrapping multiple validation errors -// returned by BindConfig.ValidateAll() if the designated constraints aren't met. -type BindConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m BindConfigMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m BindConfigMultiError) AllErrors() []error { return m } - -// BindConfigValidationError is the validation error returned by -// BindConfig.Validate if the designated constraints aren't met. -type BindConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e BindConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e BindConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e BindConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e BindConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e BindConfigValidationError) ErrorName() string { return "BindConfigValidationError" } - -// Error satisfies the builtin error interface -func (e BindConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sBindConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = BindConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = BindConfigValidationError{} - -// Validate checks the field values on Address with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Address) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Address with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in AddressMultiError, or nil if none found. -func (m *Address) ValidateAll() error { - return m.validate(true) -} - -func (m *Address) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofAddressPresent := false - switch v := m.Address.(type) { - case *Address_SocketAddress: - if v == nil { - err := AddressValidationError{ - field: "Address", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofAddressPresent = true - - if all { - switch v := interface{}(m.GetSocketAddress()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, AddressValidationError{ - field: "SocketAddress", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, AddressValidationError{ - field: "SocketAddress", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSocketAddress()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return AddressValidationError{ - field: "SocketAddress", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Address_Pipe: - if v == nil { - err := AddressValidationError{ - field: "Address", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofAddressPresent = true - - if all { - switch v := interface{}(m.GetPipe()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, AddressValidationError{ - field: "Pipe", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, AddressValidationError{ - field: "Pipe", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPipe()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return AddressValidationError{ - field: "Pipe", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Address_EnvoyInternalAddress: - if v == nil { - err := AddressValidationError{ - field: "Address", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofAddressPresent = true - - if all { - switch v := interface{}(m.GetEnvoyInternalAddress()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, AddressValidationError{ - field: "EnvoyInternalAddress", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, AddressValidationError{ - field: "EnvoyInternalAddress", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetEnvoyInternalAddress()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return AddressValidationError{ - field: "EnvoyInternalAddress", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofAddressPresent { - err := AddressValidationError{ - field: "Address", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return AddressMultiError(errors) - } - - return nil -} - -// AddressMultiError is an error wrapping multiple validation errors returned -// by Address.ValidateAll() if the designated constraints aren't met. -type AddressMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AddressMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AddressMultiError) AllErrors() []error { return m } - -// AddressValidationError is the validation error returned by Address.Validate -// if the designated constraints aren't met. -type AddressValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AddressValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AddressValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AddressValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AddressValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AddressValidationError) ErrorName() string { return "AddressValidationError" } - -// Error satisfies the builtin error interface -func (e AddressValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAddress.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AddressValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AddressValidationError{} - -// Validate checks the field values on CidrRange with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *CidrRange) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CidrRange with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in CidrRangeMultiError, or nil -// if none found. -func (m *CidrRange) ValidateAll() error { - return m.validate(true) -} - -func (m *CidrRange) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetAddressPrefix()) < 1 { - err := CidrRangeValidationError{ - field: "AddressPrefix", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if wrapper := m.GetPrefixLen(); wrapper != nil { - - if wrapper.GetValue() > 128 { - err := CidrRangeValidationError{ - field: "PrefixLen", - reason: "value must be less than or equal to 128", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if len(errors) > 0 { - return CidrRangeMultiError(errors) - } - - return nil -} - -// CidrRangeMultiError is an error wrapping multiple validation errors returned -// by CidrRange.ValidateAll() if the designated constraints aren't met. -type CidrRangeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CidrRangeMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CidrRangeMultiError) AllErrors() []error { return m } - -// CidrRangeValidationError is the validation error returned by -// CidrRange.Validate if the designated constraints aren't met. -type CidrRangeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CidrRangeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CidrRangeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CidrRangeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CidrRangeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CidrRangeValidationError) ErrorName() string { return "CidrRangeValidationError" } - -// Error satisfies the builtin error interface -func (e CidrRangeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCidrRange.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CidrRangeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CidrRangeValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/backoff.pb.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/backoff.pb.go deleted file mode 100644 index d7b66d56d..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/backoff.pb.go +++ /dev/null @@ -1,198 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/config/core/v3/backoff.proto - -package corev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - durationpb "google.golang.org/protobuf/types/known/durationpb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Configuration defining a jittered exponential back off strategy. -type BackoffStrategy struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The base interval to be used for the next back off computation. It should - // be greater than zero and less than or equal to :ref:`max_interval - // `. - BaseInterval *durationpb.Duration `protobuf:"bytes,1,opt,name=base_interval,json=baseInterval,proto3" json:"base_interval,omitempty"` - // Specifies the maximum interval between retries. This parameter is optional, - // but must be greater than or equal to the :ref:`base_interval - // ` if set. The default - // is 10 times the :ref:`base_interval - // `. - MaxInterval *durationpb.Duration `protobuf:"bytes,2,opt,name=max_interval,json=maxInterval,proto3" json:"max_interval,omitempty"` -} - -func (x *BackoffStrategy) Reset() { - *x = BackoffStrategy{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_backoff_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BackoffStrategy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BackoffStrategy) ProtoMessage() {} - -func (x *BackoffStrategy) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_backoff_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BackoffStrategy.ProtoReflect.Descriptor instead. -func (*BackoffStrategy) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_backoff_proto_rawDescGZIP(), []int{0} -} - -func (x *BackoffStrategy) GetBaseInterval() *durationpb.Duration { - if x != nil { - return x.BaseInterval - } - return nil -} - -func (x *BackoffStrategy) GetMaxInterval() *durationpb.Duration { - if x != nil { - return x.MaxInterval - } - return nil -} - -var File_envoy_config_core_v3_backoff_proto protoreflect.FileDescriptor - -var file_envoy_config_core_v3_backoff_proto_rawDesc = []byte{ - 0x0a, 0x22, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, - 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x75, 0x64, 0x70, 0x61, 0x2f, - 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd3, 0x01, 0x0a, 0x0f, 0x42, 0x61, 0x63, 0x6b, 0x6f, 0x66, - 0x66, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x4e, 0x0a, 0x0d, 0x62, 0x61, 0x73, - 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0e, 0xfa, 0x42, 0x0b, - 0xaa, 0x01, 0x08, 0x08, 0x01, 0x32, 0x04, 0x10, 0xc0, 0x84, 0x3d, 0x52, 0x0c, 0x62, 0x61, 0x73, - 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x46, 0x0a, 0x0c, 0x6d, 0x61, 0x78, - 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0xaa, - 0x01, 0x02, 0x2a, 0x00, 0x52, 0x0b, 0x6d, 0x61, 0x78, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, - 0x6c, 0x3a, 0x28, 0x9a, 0xc5, 0x88, 0x1e, 0x23, 0x0a, 0x21, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x42, 0x61, 0x63, 0x6b, - 0x6f, 0x66, 0x66, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x42, 0x80, 0x01, 0x0a, 0x22, - 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, - 0x76, 0x33, 0x42, 0x0c, 0x42, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x3b, - 0x63, 0x6f, 0x72, 0x65, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_config_core_v3_backoff_proto_rawDescOnce sync.Once - file_envoy_config_core_v3_backoff_proto_rawDescData = file_envoy_config_core_v3_backoff_proto_rawDesc -) - -func file_envoy_config_core_v3_backoff_proto_rawDescGZIP() []byte { - file_envoy_config_core_v3_backoff_proto_rawDescOnce.Do(func() { - file_envoy_config_core_v3_backoff_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_config_core_v3_backoff_proto_rawDescData) - }) - return file_envoy_config_core_v3_backoff_proto_rawDescData -} - -var file_envoy_config_core_v3_backoff_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_config_core_v3_backoff_proto_goTypes = []interface{}{ - (*BackoffStrategy)(nil), // 0: envoy.config.core.v3.BackoffStrategy - (*durationpb.Duration)(nil), // 1: google.protobuf.Duration -} -var file_envoy_config_core_v3_backoff_proto_depIdxs = []int32{ - 1, // 0: envoy.config.core.v3.BackoffStrategy.base_interval:type_name -> google.protobuf.Duration - 1, // 1: envoy.config.core.v3.BackoffStrategy.max_interval:type_name -> google.protobuf.Duration - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_envoy_config_core_v3_backoff_proto_init() } -func file_envoy_config_core_v3_backoff_proto_init() { - if File_envoy_config_core_v3_backoff_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_envoy_config_core_v3_backoff_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BackoffStrategy); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_config_core_v3_backoff_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_config_core_v3_backoff_proto_goTypes, - DependencyIndexes: file_envoy_config_core_v3_backoff_proto_depIdxs, - MessageInfos: file_envoy_config_core_v3_backoff_proto_msgTypes, - }.Build() - File_envoy_config_core_v3_backoff_proto = out.File - file_envoy_config_core_v3_backoff_proto_rawDesc = nil - file_envoy_config_core_v3_backoff_proto_goTypes = nil - file_envoy_config_core_v3_backoff_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/backoff.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/backoff.pb.validate.go deleted file mode 100644 index c9b6590cc..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/backoff.pb.validate.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/config/core/v3/backoff.proto - -package corev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on BackoffStrategy with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *BackoffStrategy) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on BackoffStrategy with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// BackoffStrategyMultiError, or nil if none found. -func (m *BackoffStrategy) ValidateAll() error { - return m.validate(true) -} - -func (m *BackoffStrategy) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetBaseInterval() == nil { - err := BackoffStrategyValidationError{ - field: "BaseInterval", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if d := m.GetBaseInterval(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = BackoffStrategyValidationError{ - field: "BaseInterval", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - gte := time.Duration(0*time.Second + 1000000*time.Nanosecond) - - if dur < gte { - err := BackoffStrategyValidationError{ - field: "BaseInterval", - reason: "value must be greater than or equal to 1ms", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if d := m.GetMaxInterval(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = BackoffStrategyValidationError{ - field: "MaxInterval", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - gt := time.Duration(0*time.Second + 0*time.Nanosecond) - - if dur <= gt { - err := BackoffStrategyValidationError{ - field: "MaxInterval", - reason: "value must be greater than 0s", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if len(errors) > 0 { - return BackoffStrategyMultiError(errors) - } - - return nil -} - -// BackoffStrategyMultiError is an error wrapping multiple validation errors -// returned by BackoffStrategy.ValidateAll() if the designated constraints -// aren't met. -type BackoffStrategyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m BackoffStrategyMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m BackoffStrategyMultiError) AllErrors() []error { return m } - -// BackoffStrategyValidationError is the validation error returned by -// BackoffStrategy.Validate if the designated constraints aren't met. -type BackoffStrategyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e BackoffStrategyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e BackoffStrategyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e BackoffStrategyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e BackoffStrategyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e BackoffStrategyValidationError) ErrorName() string { return "BackoffStrategyValidationError" } - -// Error satisfies the builtin error interface -func (e BackoffStrategyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sBackoffStrategy.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = BackoffStrategyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = BackoffStrategyValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/base.pb.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/base.pb.go deleted file mode 100644 index 6b9364868..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/base.pb.go +++ /dev/null @@ -1,2639 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/config/core/v3/base.proto - -package corev3 - -import ( - _ "github.com/cilium/proxy/go/envoy/annotations" - v3 "github.com/cilium/proxy/go/envoy/type/v3" - _ "github.com/cncf/xds/go/udpa/annotations" - v31 "github.com/cncf/xds/go/xds/core/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - structpb "google.golang.org/protobuf/types/known/structpb" - wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Envoy supports :ref:`upstream priority routing -// ` both at the route and the virtual -// cluster level. The current priority implementation uses different connection -// pool and circuit breaking settings for each priority level. This means that -// even for HTTP/2 requests, two physical connections will be used to an -// upstream host. In the future Envoy will likely support true HTTP/2 priority -// over a single upstream connection. -type RoutingPriority int32 - -const ( - RoutingPriority_DEFAULT RoutingPriority = 0 - RoutingPriority_HIGH RoutingPriority = 1 -) - -// Enum value maps for RoutingPriority. -var ( - RoutingPriority_name = map[int32]string{ - 0: "DEFAULT", - 1: "HIGH", - } - RoutingPriority_value = map[string]int32{ - "DEFAULT": 0, - "HIGH": 1, - } -) - -func (x RoutingPriority) Enum() *RoutingPriority { - p := new(RoutingPriority) - *p = x - return p -} - -func (x RoutingPriority) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (RoutingPriority) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_config_core_v3_base_proto_enumTypes[0].Descriptor() -} - -func (RoutingPriority) Type() protoreflect.EnumType { - return &file_envoy_config_core_v3_base_proto_enumTypes[0] -} - -func (x RoutingPriority) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use RoutingPriority.Descriptor instead. -func (RoutingPriority) EnumDescriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{0} -} - -// HTTP request method. -type RequestMethod int32 - -const ( - RequestMethod_METHOD_UNSPECIFIED RequestMethod = 0 - RequestMethod_GET RequestMethod = 1 - RequestMethod_HEAD RequestMethod = 2 - RequestMethod_POST RequestMethod = 3 - RequestMethod_PUT RequestMethod = 4 - RequestMethod_DELETE RequestMethod = 5 - RequestMethod_CONNECT RequestMethod = 6 - RequestMethod_OPTIONS RequestMethod = 7 - RequestMethod_TRACE RequestMethod = 8 - RequestMethod_PATCH RequestMethod = 9 -) - -// Enum value maps for RequestMethod. -var ( - RequestMethod_name = map[int32]string{ - 0: "METHOD_UNSPECIFIED", - 1: "GET", - 2: "HEAD", - 3: "POST", - 4: "PUT", - 5: "DELETE", - 6: "CONNECT", - 7: "OPTIONS", - 8: "TRACE", - 9: "PATCH", - } - RequestMethod_value = map[string]int32{ - "METHOD_UNSPECIFIED": 0, - "GET": 1, - "HEAD": 2, - "POST": 3, - "PUT": 4, - "DELETE": 5, - "CONNECT": 6, - "OPTIONS": 7, - "TRACE": 8, - "PATCH": 9, - } -) - -func (x RequestMethod) Enum() *RequestMethod { - p := new(RequestMethod) - *p = x - return p -} - -func (x RequestMethod) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (RequestMethod) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_config_core_v3_base_proto_enumTypes[1].Descriptor() -} - -func (RequestMethod) Type() protoreflect.EnumType { - return &file_envoy_config_core_v3_base_proto_enumTypes[1] -} - -func (x RequestMethod) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use RequestMethod.Descriptor instead. -func (RequestMethod) EnumDescriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{1} -} - -// Identifies the direction of the traffic relative to the local Envoy. -type TrafficDirection int32 - -const ( - // Default option is unspecified. - TrafficDirection_UNSPECIFIED TrafficDirection = 0 - // The transport is used for incoming traffic. - TrafficDirection_INBOUND TrafficDirection = 1 - // The transport is used for outgoing traffic. - TrafficDirection_OUTBOUND TrafficDirection = 2 -) - -// Enum value maps for TrafficDirection. -var ( - TrafficDirection_name = map[int32]string{ - 0: "UNSPECIFIED", - 1: "INBOUND", - 2: "OUTBOUND", - } - TrafficDirection_value = map[string]int32{ - "UNSPECIFIED": 0, - "INBOUND": 1, - "OUTBOUND": 2, - } -) - -func (x TrafficDirection) Enum() *TrafficDirection { - p := new(TrafficDirection) - *p = x - return p -} - -func (x TrafficDirection) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (TrafficDirection) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_config_core_v3_base_proto_enumTypes[2].Descriptor() -} - -func (TrafficDirection) Type() protoreflect.EnumType { - return &file_envoy_config_core_v3_base_proto_enumTypes[2] -} - -func (x TrafficDirection) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use TrafficDirection.Descriptor instead. -func (TrafficDirection) EnumDescriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{2} -} - -// Describes the supported actions types for header append action. -type HeaderValueOption_HeaderAppendAction int32 - -const ( - // If the header already exists, this action will result in: - // - // - Comma-concatenated for predefined inline headers. - // - Duplicate header added in the “HeaderMap“ for other headers. - // - // If the header doesn't exist then this will add new header with specified key and value. - HeaderValueOption_APPEND_IF_EXISTS_OR_ADD HeaderValueOption_HeaderAppendAction = 0 - // This action will add the header if it doesn't already exist. If the header - // already exists then this will be a no-op. - HeaderValueOption_ADD_IF_ABSENT HeaderValueOption_HeaderAppendAction = 1 - // This action will overwrite the specified value by discarding any existing values if - // the header already exists. If the header doesn't exist then this will add the header - // with specified key and value. - HeaderValueOption_OVERWRITE_IF_EXISTS_OR_ADD HeaderValueOption_HeaderAppendAction = 2 - // This action will overwrite the specified value by discarding any existing values if - // the header already exists. If the header doesn't exist then this will be no-op. - HeaderValueOption_OVERWRITE_IF_EXISTS HeaderValueOption_HeaderAppendAction = 3 -) - -// Enum value maps for HeaderValueOption_HeaderAppendAction. -var ( - HeaderValueOption_HeaderAppendAction_name = map[int32]string{ - 0: "APPEND_IF_EXISTS_OR_ADD", - 1: "ADD_IF_ABSENT", - 2: "OVERWRITE_IF_EXISTS_OR_ADD", - 3: "OVERWRITE_IF_EXISTS", - } - HeaderValueOption_HeaderAppendAction_value = map[string]int32{ - "APPEND_IF_EXISTS_OR_ADD": 0, - "ADD_IF_ABSENT": 1, - "OVERWRITE_IF_EXISTS_OR_ADD": 2, - "OVERWRITE_IF_EXISTS": 3, - } -) - -func (x HeaderValueOption_HeaderAppendAction) Enum() *HeaderValueOption_HeaderAppendAction { - p := new(HeaderValueOption_HeaderAppendAction) - *p = x - return p -} - -func (x HeaderValueOption_HeaderAppendAction) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (HeaderValueOption_HeaderAppendAction) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_config_core_v3_base_proto_enumTypes[3].Descriptor() -} - -func (HeaderValueOption_HeaderAppendAction) Type() protoreflect.EnumType { - return &file_envoy_config_core_v3_base_proto_enumTypes[3] -} - -func (x HeaderValueOption_HeaderAppendAction) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use HeaderValueOption_HeaderAppendAction.Descriptor instead. -func (HeaderValueOption_HeaderAppendAction) EnumDescriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{11, 0} -} - -// Identifies location of where either Envoy runs or where upstream hosts run. -type Locality struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Region this :ref:`zone ` belongs to. - Region string `protobuf:"bytes,1,opt,name=region,proto3" json:"region,omitempty"` - // Defines the local service zone where Envoy is running. Though optional, it - // should be set if discovery service routing is used and the discovery - // service exposes :ref:`zone data `, - // either in this message or via :option:`--service-zone`. The meaning of zone - // is context dependent, e.g. `Availability Zone (AZ) - // `_ - // on AWS, `Zone `_ on - // GCP, etc. - Zone string `protobuf:"bytes,2,opt,name=zone,proto3" json:"zone,omitempty"` - // When used for locality of upstream hosts, this field further splits zone - // into smaller chunks of sub-zones so they can be load balanced - // independently. - SubZone string `protobuf:"bytes,3,opt,name=sub_zone,json=subZone,proto3" json:"sub_zone,omitempty"` -} - -func (x *Locality) Reset() { - *x = Locality{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Locality) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Locality) ProtoMessage() {} - -func (x *Locality) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Locality.ProtoReflect.Descriptor instead. -func (*Locality) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{0} -} - -func (x *Locality) GetRegion() string { - if x != nil { - return x.Region - } - return "" -} - -func (x *Locality) GetZone() string { - if x != nil { - return x.Zone - } - return "" -} - -func (x *Locality) GetSubZone() string { - if x != nil { - return x.SubZone - } - return "" -} - -// BuildVersion combines SemVer version of extension with free-form build information -// (i.e. 'alpha', 'private-build') as a set of strings. -type BuildVersion struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // SemVer version of extension. - Version *v3.SemanticVersion `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - // Free-form build information. - // Envoy defines several well known keys in the source/common/version/version.h file - Metadata *structpb.Struct `protobuf:"bytes,2,opt,name=metadata,proto3" json:"metadata,omitempty"` -} - -func (x *BuildVersion) Reset() { - *x = BuildVersion{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BuildVersion) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BuildVersion) ProtoMessage() {} - -func (x *BuildVersion) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BuildVersion.ProtoReflect.Descriptor instead. -func (*BuildVersion) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{1} -} - -func (x *BuildVersion) GetVersion() *v3.SemanticVersion { - if x != nil { - return x.Version - } - return nil -} - -func (x *BuildVersion) GetMetadata() *structpb.Struct { - if x != nil { - return x.Metadata - } - return nil -} - -// Version and identification for an Envoy extension. -// [#next-free-field: 7] -type Extension struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // This is the name of the Envoy filter as specified in the Envoy - // configuration, e.g. envoy.filters.http.router, com.acme.widget. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Category of the extension. - // Extension category names use reverse DNS notation. For instance "envoy.filters.listener" - // for Envoy's built-in listener filters or "com.acme.filters.http" for HTTP filters from - // acme.com vendor. - // [#comment:TODO(yanavlasov): Link to the doc with existing envoy category names.] - Category string `protobuf:"bytes,2,opt,name=category,proto3" json:"category,omitempty"` - // [#not-implemented-hide:] Type descriptor of extension configuration proto. - // [#comment:TODO(yanavlasov): Link to the doc with existing configuration protos.] - // [#comment:TODO(yanavlasov): Add tests when PR #9391 lands.] - // - // Deprecated: Do not use. - TypeDescriptor string `protobuf:"bytes,3,opt,name=type_descriptor,json=typeDescriptor,proto3" json:"type_descriptor,omitempty"` - // The version is a property of the extension and maintained independently - // of other extensions and the Envoy API. - // This field is not set when extension did not provide version information. - Version *BuildVersion `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"` - // Indicates that the extension is present but was disabled via dynamic configuration. - Disabled bool `protobuf:"varint,5,opt,name=disabled,proto3" json:"disabled,omitempty"` - // Type URLs of extension configuration protos. - TypeUrls []string `protobuf:"bytes,6,rep,name=type_urls,json=typeUrls,proto3" json:"type_urls,omitempty"` -} - -func (x *Extension) Reset() { - *x = Extension{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Extension) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Extension) ProtoMessage() {} - -func (x *Extension) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Extension.ProtoReflect.Descriptor instead. -func (*Extension) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{2} -} - -func (x *Extension) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Extension) GetCategory() string { - if x != nil { - return x.Category - } - return "" -} - -// Deprecated: Do not use. -func (x *Extension) GetTypeDescriptor() string { - if x != nil { - return x.TypeDescriptor - } - return "" -} - -func (x *Extension) GetVersion() *BuildVersion { - if x != nil { - return x.Version - } - return nil -} - -func (x *Extension) GetDisabled() bool { - if x != nil { - return x.Disabled - } - return false -} - -func (x *Extension) GetTypeUrls() []string { - if x != nil { - return x.TypeUrls - } - return nil -} - -// Identifies a specific Envoy instance. The node identifier is presented to the -// management server, which may use this identifier to distinguish per Envoy -// configuration for serving. -// [#next-free-field: 13] -type Node struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // An opaque node identifier for the Envoy node. This also provides the local - // service node name. It should be set if any of the following features are - // used: :ref:`statsd `, :ref:`CDS - // `, and :ref:`HTTP tracing - // `, either in this message or via - // :option:`--service-node`. - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - // Defines the local service cluster name where Envoy is running. Though - // optional, it should be set if any of the following features are used: - // :ref:`statsd `, :ref:`health check cluster - // verification - // `, - // :ref:`runtime override directory `, - // :ref:`user agent addition - // `, - // :ref:`HTTP global rate limiting `, - // :ref:`CDS `, and :ref:`HTTP tracing - // `, either in this message or via - // :option:`--service-cluster`. - Cluster string `protobuf:"bytes,2,opt,name=cluster,proto3" json:"cluster,omitempty"` - // Opaque metadata extending the node identifier. Envoy will pass this - // directly to the management server. - Metadata *structpb.Struct `protobuf:"bytes,3,opt,name=metadata,proto3" json:"metadata,omitempty"` - // Map from xDS resource type URL to dynamic context parameters. These may vary at runtime (unlike - // other fields in this message). For example, the xDS client may have a shard identifier that - // changes during the lifetime of the xDS client. In Envoy, this would be achieved by updating the - // dynamic context on the Server::Instance's LocalInfo context provider. The shard ID dynamic - // parameter then appears in this field during future discovery requests. - DynamicParameters map[string]*v31.ContextParams `protobuf:"bytes,12,rep,name=dynamic_parameters,json=dynamicParameters,proto3" json:"dynamic_parameters,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // Locality specifying where the Envoy instance is running. - Locality *Locality `protobuf:"bytes,4,opt,name=locality,proto3" json:"locality,omitempty"` - // Free-form string that identifies the entity requesting config. - // E.g. "envoy" or "grpc" - UserAgentName string `protobuf:"bytes,6,opt,name=user_agent_name,json=userAgentName,proto3" json:"user_agent_name,omitempty"` - // Types that are assignable to UserAgentVersionType: - // - // *Node_UserAgentVersion - // *Node_UserAgentBuildVersion - UserAgentVersionType isNode_UserAgentVersionType `protobuf_oneof:"user_agent_version_type"` - // List of extensions and their versions supported by the node. - Extensions []*Extension `protobuf:"bytes,9,rep,name=extensions,proto3" json:"extensions,omitempty"` - // Client feature support list. These are well known features described - // in the Envoy API repository for a given major version of an API. Client features - // use reverse DNS naming scheme, for example “com.acme.feature“. - // See :ref:`the list of features ` that xDS client may - // support. - ClientFeatures []string `protobuf:"bytes,10,rep,name=client_features,json=clientFeatures,proto3" json:"client_features,omitempty"` - // Known listening ports on the node as a generic hint to the management server - // for filtering :ref:`listeners ` to be returned. For example, - // if there is a listener bound to port 80, the list can optionally contain the - // SocketAddress “(0.0.0.0,80)“. The field is optional and just a hint. - // - // Deprecated: Do not use. - ListeningAddresses []*Address `protobuf:"bytes,11,rep,name=listening_addresses,json=listeningAddresses,proto3" json:"listening_addresses,omitempty"` -} - -func (x *Node) Reset() { - *x = Node{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Node) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Node) ProtoMessage() {} - -func (x *Node) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Node.ProtoReflect.Descriptor instead. -func (*Node) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{3} -} - -func (x *Node) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *Node) GetCluster() string { - if x != nil { - return x.Cluster - } - return "" -} - -func (x *Node) GetMetadata() *structpb.Struct { - if x != nil { - return x.Metadata - } - return nil -} - -func (x *Node) GetDynamicParameters() map[string]*v31.ContextParams { - if x != nil { - return x.DynamicParameters - } - return nil -} - -func (x *Node) GetLocality() *Locality { - if x != nil { - return x.Locality - } - return nil -} - -func (x *Node) GetUserAgentName() string { - if x != nil { - return x.UserAgentName - } - return "" -} - -func (m *Node) GetUserAgentVersionType() isNode_UserAgentVersionType { - if m != nil { - return m.UserAgentVersionType - } - return nil -} - -func (x *Node) GetUserAgentVersion() string { - if x, ok := x.GetUserAgentVersionType().(*Node_UserAgentVersion); ok { - return x.UserAgentVersion - } - return "" -} - -func (x *Node) GetUserAgentBuildVersion() *BuildVersion { - if x, ok := x.GetUserAgentVersionType().(*Node_UserAgentBuildVersion); ok { - return x.UserAgentBuildVersion - } - return nil -} - -func (x *Node) GetExtensions() []*Extension { - if x != nil { - return x.Extensions - } - return nil -} - -func (x *Node) GetClientFeatures() []string { - if x != nil { - return x.ClientFeatures - } - return nil -} - -// Deprecated: Do not use. -func (x *Node) GetListeningAddresses() []*Address { - if x != nil { - return x.ListeningAddresses - } - return nil -} - -type isNode_UserAgentVersionType interface { - isNode_UserAgentVersionType() -} - -type Node_UserAgentVersion struct { - // Free-form string that identifies the version of the entity requesting config. - // E.g. "1.12.2" or "abcd1234", or "SpecialEnvoyBuild" - UserAgentVersion string `protobuf:"bytes,7,opt,name=user_agent_version,json=userAgentVersion,proto3,oneof"` -} - -type Node_UserAgentBuildVersion struct { - // Structured version of the entity requesting config. - UserAgentBuildVersion *BuildVersion `protobuf:"bytes,8,opt,name=user_agent_build_version,json=userAgentBuildVersion,proto3,oneof"` -} - -func (*Node_UserAgentVersion) isNode_UserAgentVersionType() {} - -func (*Node_UserAgentBuildVersion) isNode_UserAgentVersionType() {} - -// Metadata provides additional inputs to filters based on matched listeners, -// filter chains, routes and endpoints. It is structured as a map, usually from -// filter name (in reverse DNS format) to metadata specific to the filter. Metadata -// key-values for a filter are merged as connection and request handling occurs, -// with later values for the same key overriding earlier values. -// -// An example use of metadata is providing additional values to -// http_connection_manager in the envoy.http_connection_manager.access_log -// namespace. -// -// Another example use of metadata is to per service config info in cluster metadata, which may get -// consumed by multiple filters. -// -// For load balancing, Metadata provides a means to subset cluster endpoints. -// Endpoints have a Metadata object associated and routes contain a Metadata -// object to match against. There are some well defined metadata used today for -// this purpose: -// -// - “{"envoy.lb": {"canary": }}“ This indicates the canary status of an -// endpoint and is also used during header processing -// (x-envoy-upstream-canary) and for stats purposes. -// -// [#next-major-version: move to type/metadata/v2] -type Metadata struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Key is the reverse DNS filter name, e.g. com.acme.widget. The “envoy.*“ - // namespace is reserved for Envoy's built-in filters. - // If both “filter_metadata“ and - // :ref:`typed_filter_metadata ` - // fields are present in the metadata with same keys, - // only “typed_filter_metadata“ field will be parsed. - FilterMetadata map[string]*structpb.Struct `protobuf:"bytes,1,rep,name=filter_metadata,json=filterMetadata,proto3" json:"filter_metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // Key is the reverse DNS filter name, e.g. com.acme.widget. The “envoy.*“ - // namespace is reserved for Envoy's built-in filters. - // The value is encoded as google.protobuf.Any. - // If both :ref:`filter_metadata ` - // and “typed_filter_metadata“ fields are present in the metadata with same keys, - // only “typed_filter_metadata“ field will be parsed. - TypedFilterMetadata map[string]*anypb.Any `protobuf:"bytes,2,rep,name=typed_filter_metadata,json=typedFilterMetadata,proto3" json:"typed_filter_metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *Metadata) Reset() { - *x = Metadata{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Metadata) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Metadata) ProtoMessage() {} - -func (x *Metadata) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Metadata.ProtoReflect.Descriptor instead. -func (*Metadata) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{4} -} - -func (x *Metadata) GetFilterMetadata() map[string]*structpb.Struct { - if x != nil { - return x.FilterMetadata - } - return nil -} - -func (x *Metadata) GetTypedFilterMetadata() map[string]*anypb.Any { - if x != nil { - return x.TypedFilterMetadata - } - return nil -} - -// Runtime derived uint32 with a default when not specified. -type RuntimeUInt32 struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Default value if runtime value is not available. - DefaultValue uint32 `protobuf:"varint,2,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` - // Runtime key to get value for comparison. This value is used if defined. - RuntimeKey string `protobuf:"bytes,3,opt,name=runtime_key,json=runtimeKey,proto3" json:"runtime_key,omitempty"` -} - -func (x *RuntimeUInt32) Reset() { - *x = RuntimeUInt32{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RuntimeUInt32) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RuntimeUInt32) ProtoMessage() {} - -func (x *RuntimeUInt32) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RuntimeUInt32.ProtoReflect.Descriptor instead. -func (*RuntimeUInt32) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{5} -} - -func (x *RuntimeUInt32) GetDefaultValue() uint32 { - if x != nil { - return x.DefaultValue - } - return 0 -} - -func (x *RuntimeUInt32) GetRuntimeKey() string { - if x != nil { - return x.RuntimeKey - } - return "" -} - -// Runtime derived percentage with a default when not specified. -type RuntimePercent struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Default value if runtime value is not available. - DefaultValue *v3.Percent `protobuf:"bytes,1,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` - // Runtime key to get value for comparison. This value is used if defined. - RuntimeKey string `protobuf:"bytes,2,opt,name=runtime_key,json=runtimeKey,proto3" json:"runtime_key,omitempty"` -} - -func (x *RuntimePercent) Reset() { - *x = RuntimePercent{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RuntimePercent) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RuntimePercent) ProtoMessage() {} - -func (x *RuntimePercent) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RuntimePercent.ProtoReflect.Descriptor instead. -func (*RuntimePercent) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{6} -} - -func (x *RuntimePercent) GetDefaultValue() *v3.Percent { - if x != nil { - return x.DefaultValue - } - return nil -} - -func (x *RuntimePercent) GetRuntimeKey() string { - if x != nil { - return x.RuntimeKey - } - return "" -} - -// Runtime derived double with a default when not specified. -type RuntimeDouble struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Default value if runtime value is not available. - DefaultValue float64 `protobuf:"fixed64,1,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` - // Runtime key to get value for comparison. This value is used if defined. - RuntimeKey string `protobuf:"bytes,2,opt,name=runtime_key,json=runtimeKey,proto3" json:"runtime_key,omitempty"` -} - -func (x *RuntimeDouble) Reset() { - *x = RuntimeDouble{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RuntimeDouble) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RuntimeDouble) ProtoMessage() {} - -func (x *RuntimeDouble) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RuntimeDouble.ProtoReflect.Descriptor instead. -func (*RuntimeDouble) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{7} -} - -func (x *RuntimeDouble) GetDefaultValue() float64 { - if x != nil { - return x.DefaultValue - } - return 0 -} - -func (x *RuntimeDouble) GetRuntimeKey() string { - if x != nil { - return x.RuntimeKey - } - return "" -} - -// Runtime derived bool with a default when not specified. -type RuntimeFeatureFlag struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Default value if runtime value is not available. - DefaultValue *wrapperspb.BoolValue `protobuf:"bytes,1,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` - // Runtime key to get value for comparison. This value is used if defined. The boolean value must - // be represented via its - // `canonical JSON encoding `_. - RuntimeKey string `protobuf:"bytes,2,opt,name=runtime_key,json=runtimeKey,proto3" json:"runtime_key,omitempty"` -} - -func (x *RuntimeFeatureFlag) Reset() { - *x = RuntimeFeatureFlag{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RuntimeFeatureFlag) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RuntimeFeatureFlag) ProtoMessage() {} - -func (x *RuntimeFeatureFlag) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RuntimeFeatureFlag.ProtoReflect.Descriptor instead. -func (*RuntimeFeatureFlag) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{8} -} - -func (x *RuntimeFeatureFlag) GetDefaultValue() *wrapperspb.BoolValue { - if x != nil { - return x.DefaultValue - } - return nil -} - -func (x *RuntimeFeatureFlag) GetRuntimeKey() string { - if x != nil { - return x.RuntimeKey - } - return "" -} - -// Query parameter name/value pair. -type QueryParameter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The key of the query parameter. Case sensitive. - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // The value of the query parameter. - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *QueryParameter) Reset() { - *x = QueryParameter{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryParameter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryParameter) ProtoMessage() {} - -func (x *QueryParameter) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use QueryParameter.ProtoReflect.Descriptor instead. -func (*QueryParameter) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{9} -} - -func (x *QueryParameter) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *QueryParameter) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -// Header name/value pair. -type HeaderValue struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Header name. - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // Header value. - // - // The same :ref:`format specifier ` as used for - // :ref:`HTTP access logging ` applies here, however - // unknown header values are replaced with the empty string instead of “-“. - // Header value is encoded as string. This does not work for non-utf8 characters. - // Only one of “value“ or “raw_value“ can be set. - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - // Header value is encoded as bytes which can support non-utf8 characters. - // Only one of “value“ or “raw_value“ can be set. - RawValue []byte `protobuf:"bytes,3,opt,name=raw_value,json=rawValue,proto3" json:"raw_value,omitempty"` -} - -func (x *HeaderValue) Reset() { - *x = HeaderValue{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HeaderValue) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HeaderValue) ProtoMessage() {} - -func (x *HeaderValue) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HeaderValue.ProtoReflect.Descriptor instead. -func (*HeaderValue) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{10} -} - -func (x *HeaderValue) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *HeaderValue) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -func (x *HeaderValue) GetRawValue() []byte { - if x != nil { - return x.RawValue - } - return nil -} - -// Header name/value pair plus option to control append behavior. -type HeaderValueOption struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Header name/value pair that this option applies to. - Header *HeaderValue `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - // Should the value be appended? If true (default), the value is appended to - // existing values. Otherwise it replaces any existing values. - // This field is deprecated and please use - // :ref:`append_action ` as replacement. - // - // .. note:: - // - // The :ref:`external authorization service ` and - // :ref:`external processor service ` have - // default value (``false``) for this field. - // - // Deprecated: Do not use. - Append *wrapperspb.BoolValue `protobuf:"bytes,2,opt,name=append,proto3" json:"append,omitempty"` - // Describes the action taken to append/overwrite the given value for an existing header - // or to only add this header if it's absent. - // Value defaults to :ref:`APPEND_IF_EXISTS_OR_ADD - // `. - AppendAction HeaderValueOption_HeaderAppendAction `protobuf:"varint,3,opt,name=append_action,json=appendAction,proto3,enum=envoy.config.core.v3.HeaderValueOption_HeaderAppendAction" json:"append_action,omitempty"` - // Is the header value allowed to be empty? If false (default), custom headers with empty values are dropped, - // otherwise they are added. - KeepEmptyValue bool `protobuf:"varint,4,opt,name=keep_empty_value,json=keepEmptyValue,proto3" json:"keep_empty_value,omitempty"` -} - -func (x *HeaderValueOption) Reset() { - *x = HeaderValueOption{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HeaderValueOption) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HeaderValueOption) ProtoMessage() {} - -func (x *HeaderValueOption) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HeaderValueOption.ProtoReflect.Descriptor instead. -func (*HeaderValueOption) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{11} -} - -func (x *HeaderValueOption) GetHeader() *HeaderValue { - if x != nil { - return x.Header - } - return nil -} - -// Deprecated: Do not use. -func (x *HeaderValueOption) GetAppend() *wrapperspb.BoolValue { - if x != nil { - return x.Append - } - return nil -} - -func (x *HeaderValueOption) GetAppendAction() HeaderValueOption_HeaderAppendAction { - if x != nil { - return x.AppendAction - } - return HeaderValueOption_APPEND_IF_EXISTS_OR_ADD -} - -func (x *HeaderValueOption) GetKeepEmptyValue() bool { - if x != nil { - return x.KeepEmptyValue - } - return false -} - -// Wrapper for a set of headers. -type HeaderMap struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Headers []*HeaderValue `protobuf:"bytes,1,rep,name=headers,proto3" json:"headers,omitempty"` -} - -func (x *HeaderMap) Reset() { - *x = HeaderMap{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HeaderMap) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HeaderMap) ProtoMessage() {} - -func (x *HeaderMap) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HeaderMap.ProtoReflect.Descriptor instead. -func (*HeaderMap) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{12} -} - -func (x *HeaderMap) GetHeaders() []*HeaderValue { - if x != nil { - return x.Headers - } - return nil -} - -// A directory that is watched for changes, e.g. by inotify on Linux. Move/rename -// events inside this directory trigger the watch. -type WatchedDirectory struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Directory path to watch. - Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` -} - -func (x *WatchedDirectory) Reset() { - *x = WatchedDirectory{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WatchedDirectory) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WatchedDirectory) ProtoMessage() {} - -func (x *WatchedDirectory) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WatchedDirectory.ProtoReflect.Descriptor instead. -func (*WatchedDirectory) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{13} -} - -func (x *WatchedDirectory) GetPath() string { - if x != nil { - return x.Path - } - return "" -} - -// Data source consisting of a file, an inline value, or an environment variable. -type DataSource struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Specifier: - // - // *DataSource_Filename - // *DataSource_InlineBytes - // *DataSource_InlineString - // *DataSource_EnvironmentVariable - Specifier isDataSource_Specifier `protobuf_oneof:"specifier"` -} - -func (x *DataSource) Reset() { - *x = DataSource{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DataSource) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DataSource) ProtoMessage() {} - -func (x *DataSource) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DataSource.ProtoReflect.Descriptor instead. -func (*DataSource) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{14} -} - -func (m *DataSource) GetSpecifier() isDataSource_Specifier { - if m != nil { - return m.Specifier - } - return nil -} - -func (x *DataSource) GetFilename() string { - if x, ok := x.GetSpecifier().(*DataSource_Filename); ok { - return x.Filename - } - return "" -} - -func (x *DataSource) GetInlineBytes() []byte { - if x, ok := x.GetSpecifier().(*DataSource_InlineBytes); ok { - return x.InlineBytes - } - return nil -} - -func (x *DataSource) GetInlineString() string { - if x, ok := x.GetSpecifier().(*DataSource_InlineString); ok { - return x.InlineString - } - return "" -} - -func (x *DataSource) GetEnvironmentVariable() string { - if x, ok := x.GetSpecifier().(*DataSource_EnvironmentVariable); ok { - return x.EnvironmentVariable - } - return "" -} - -type isDataSource_Specifier interface { - isDataSource_Specifier() -} - -type DataSource_Filename struct { - // Local filesystem data source. - Filename string `protobuf:"bytes,1,opt,name=filename,proto3,oneof"` -} - -type DataSource_InlineBytes struct { - // Bytes inlined in the configuration. - InlineBytes []byte `protobuf:"bytes,2,opt,name=inline_bytes,json=inlineBytes,proto3,oneof"` -} - -type DataSource_InlineString struct { - // String inlined in the configuration. - InlineString string `protobuf:"bytes,3,opt,name=inline_string,json=inlineString,proto3,oneof"` -} - -type DataSource_EnvironmentVariable struct { - // Environment variable data source. - EnvironmentVariable string `protobuf:"bytes,4,opt,name=environment_variable,json=environmentVariable,proto3,oneof"` -} - -func (*DataSource_Filename) isDataSource_Specifier() {} - -func (*DataSource_InlineBytes) isDataSource_Specifier() {} - -func (*DataSource_InlineString) isDataSource_Specifier() {} - -func (*DataSource_EnvironmentVariable) isDataSource_Specifier() {} - -// The message specifies the retry policy of remote data source when fetching fails. -type RetryPolicy struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Specifies parameters that control :ref:`retry backoff strategy `. - // This parameter is optional, in which case the default base interval is 1000 milliseconds. The - // default maximum interval is 10 times the base interval. - RetryBackOff *BackoffStrategy `protobuf:"bytes,1,opt,name=retry_back_off,json=retryBackOff,proto3" json:"retry_back_off,omitempty"` - // Specifies the allowed number of retries. This parameter is optional and - // defaults to 1. - NumRetries *wrapperspb.UInt32Value `protobuf:"bytes,2,opt,name=num_retries,json=numRetries,proto3" json:"num_retries,omitempty"` -} - -func (x *RetryPolicy) Reset() { - *x = RetryPolicy{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RetryPolicy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RetryPolicy) ProtoMessage() {} - -func (x *RetryPolicy) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RetryPolicy.ProtoReflect.Descriptor instead. -func (*RetryPolicy) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{15} -} - -func (x *RetryPolicy) GetRetryBackOff() *BackoffStrategy { - if x != nil { - return x.RetryBackOff - } - return nil -} - -func (x *RetryPolicy) GetNumRetries() *wrapperspb.UInt32Value { - if x != nil { - return x.NumRetries - } - return nil -} - -// The message specifies how to fetch data from remote and how to verify it. -type RemoteDataSource struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The HTTP URI to fetch the remote data. - HttpUri *HttpUri `protobuf:"bytes,1,opt,name=http_uri,json=httpUri,proto3" json:"http_uri,omitempty"` - // SHA256 string for verifying data. - Sha256 string `protobuf:"bytes,2,opt,name=sha256,proto3" json:"sha256,omitempty"` - // Retry policy for fetching remote data. - RetryPolicy *RetryPolicy `protobuf:"bytes,3,opt,name=retry_policy,json=retryPolicy,proto3" json:"retry_policy,omitempty"` -} - -func (x *RemoteDataSource) Reset() { - *x = RemoteDataSource{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RemoteDataSource) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RemoteDataSource) ProtoMessage() {} - -func (x *RemoteDataSource) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RemoteDataSource.ProtoReflect.Descriptor instead. -func (*RemoteDataSource) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{16} -} - -func (x *RemoteDataSource) GetHttpUri() *HttpUri { - if x != nil { - return x.HttpUri - } - return nil -} - -func (x *RemoteDataSource) GetSha256() string { - if x != nil { - return x.Sha256 - } - return "" -} - -func (x *RemoteDataSource) GetRetryPolicy() *RetryPolicy { - if x != nil { - return x.RetryPolicy - } - return nil -} - -// Async data source which support async data fetch. -type AsyncDataSource struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Specifier: - // - // *AsyncDataSource_Local - // *AsyncDataSource_Remote - Specifier isAsyncDataSource_Specifier `protobuf_oneof:"specifier"` -} - -func (x *AsyncDataSource) Reset() { - *x = AsyncDataSource{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AsyncDataSource) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AsyncDataSource) ProtoMessage() {} - -func (x *AsyncDataSource) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AsyncDataSource.ProtoReflect.Descriptor instead. -func (*AsyncDataSource) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{17} -} - -func (m *AsyncDataSource) GetSpecifier() isAsyncDataSource_Specifier { - if m != nil { - return m.Specifier - } - return nil -} - -func (x *AsyncDataSource) GetLocal() *DataSource { - if x, ok := x.GetSpecifier().(*AsyncDataSource_Local); ok { - return x.Local - } - return nil -} - -func (x *AsyncDataSource) GetRemote() *RemoteDataSource { - if x, ok := x.GetSpecifier().(*AsyncDataSource_Remote); ok { - return x.Remote - } - return nil -} - -type isAsyncDataSource_Specifier interface { - isAsyncDataSource_Specifier() -} - -type AsyncDataSource_Local struct { - // Local async data source. - Local *DataSource `protobuf:"bytes,1,opt,name=local,proto3,oneof"` -} - -type AsyncDataSource_Remote struct { - // Remote async data source. - Remote *RemoteDataSource `protobuf:"bytes,2,opt,name=remote,proto3,oneof"` -} - -func (*AsyncDataSource_Local) isAsyncDataSource_Specifier() {} - -func (*AsyncDataSource_Remote) isAsyncDataSource_Specifier() {} - -// Configuration for transport socket in :ref:`listeners ` and -// :ref:`clusters `. If the configuration is -// empty, a default transport socket implementation and configuration will be -// chosen based on the platform and existence of tls_context. -type TransportSocket struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of the transport socket to instantiate. The name must match a supported transport - // socket implementation. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Implementation specific configuration which depends on the implementation being instantiated. - // See the supported transport socket implementations for further documentation. - // - // Types that are assignable to ConfigType: - // - // *TransportSocket_TypedConfig - ConfigType isTransportSocket_ConfigType `protobuf_oneof:"config_type"` -} - -func (x *TransportSocket) Reset() { - *x = TransportSocket{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TransportSocket) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TransportSocket) ProtoMessage() {} - -func (x *TransportSocket) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TransportSocket.ProtoReflect.Descriptor instead. -func (*TransportSocket) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{18} -} - -func (x *TransportSocket) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (m *TransportSocket) GetConfigType() isTransportSocket_ConfigType { - if m != nil { - return m.ConfigType - } - return nil -} - -func (x *TransportSocket) GetTypedConfig() *anypb.Any { - if x, ok := x.GetConfigType().(*TransportSocket_TypedConfig); ok { - return x.TypedConfig - } - return nil -} - -type isTransportSocket_ConfigType interface { - isTransportSocket_ConfigType() -} - -type TransportSocket_TypedConfig struct { - TypedConfig *anypb.Any `protobuf:"bytes,3,opt,name=typed_config,json=typedConfig,proto3,oneof"` -} - -func (*TransportSocket_TypedConfig) isTransportSocket_ConfigType() {} - -// Runtime derived FractionalPercent with defaults for when the numerator or denominator is not -// specified via a runtime key. -// -// .. note:: -// -// Parsing of the runtime key's data is implemented such that it may be represented as a -// :ref:`FractionalPercent ` proto represented as JSON/YAML -// and may also be represented as an integer with the assumption that the value is an integral -// percentage out of 100. For instance, a runtime key lookup returning the value "42" would parse -// as a ``FractionalPercent`` whose numerator is 42 and denominator is HUNDRED. -type RuntimeFractionalPercent struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Default value if the runtime value's for the numerator/denominator keys are not available. - DefaultValue *v3.FractionalPercent `protobuf:"bytes,1,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` - // Runtime key for a YAML representation of a FractionalPercent. - RuntimeKey string `protobuf:"bytes,2,opt,name=runtime_key,json=runtimeKey,proto3" json:"runtime_key,omitempty"` -} - -func (x *RuntimeFractionalPercent) Reset() { - *x = RuntimeFractionalPercent{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RuntimeFractionalPercent) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RuntimeFractionalPercent) ProtoMessage() {} - -func (x *RuntimeFractionalPercent) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RuntimeFractionalPercent.ProtoReflect.Descriptor instead. -func (*RuntimeFractionalPercent) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{19} -} - -func (x *RuntimeFractionalPercent) GetDefaultValue() *v3.FractionalPercent { - if x != nil { - return x.DefaultValue - } - return nil -} - -func (x *RuntimeFractionalPercent) GetRuntimeKey() string { - if x != nil { - return x.RuntimeKey - } - return "" -} - -// Identifies a specific ControlPlane instance that Envoy is connected to. -type ControlPlane struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // An opaque control plane identifier that uniquely identifies an instance - // of control plane. This can be used to identify which control plane instance, - // the Envoy is connected to. - Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"` -} - -func (x *ControlPlane) Reset() { - *x = ControlPlane{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ControlPlane) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ControlPlane) ProtoMessage() {} - -func (x *ControlPlane) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_base_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ControlPlane.ProtoReflect.Descriptor instead. -func (*ControlPlane) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{20} -} - -func (x *ControlPlane) GetIdentifier() string { - if x != nil { - return x.Identifier - } - return "" -} - -var File_envoy_config_core_v3_base_proto protoreflect.FileDescriptor - -var file_envoy_config_core_v3_base_proto_rawDesc = []byte{ - 0x0a, 0x1f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x14, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, - 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x1a, 0x22, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x22, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, - 0x33, 0x2f, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x23, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, - 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x75, 0x72, 0x69, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, - 0x2f, 0x76, 0x33, 0x2f, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x24, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, - 0x2f, 0x73, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x20, 0x78, 0x64, 0x73, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x23, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, - 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, - 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, - 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x74, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x16, - 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x7a, 0x6f, 0x6e, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x75, - 0x62, 0x5f, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, - 0x62, 0x5a, 0x6f, 0x6e, 0x65, 0x3a, 0x21, 0x9a, 0xc5, 0x88, 0x1e, 0x1c, 0x0a, 0x1a, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, - 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x22, 0xa4, 0x01, 0x0a, 0x0c, 0x42, 0x75, 0x69, - 0x6c, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x38, 0x0a, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x65, 0x6d, 0x61, 0x6e, - 0x74, 0x69, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x08, - 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x3a, 0x25, 0x9a, 0xc5, 0x88, 0x1e, 0x20, 0x0a, - 0x1e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, - 0x8c, 0x02, 0x0a, 0x09, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x34, 0x0a, - 0x0f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, 0x18, 0x01, 0x92, 0xc7, 0x86, 0xd8, 0x04, 0x03, - 0x33, 0x2e, 0x30, 0x52, 0x0e, 0x74, 0x79, 0x70, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x6f, 0x72, 0x12, 0x3c, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x42, 0x75, 0x69, 0x6c, - 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x1b, 0x0a, - 0x09, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x08, 0x74, 0x79, 0x70, 0x65, 0x55, 0x72, 0x6c, 0x73, 0x3a, 0x22, 0x9a, 0xc5, 0x88, 0x1e, - 0x1d, 0x0a, 0x1b, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xb2, - 0x06, 0x0a, 0x04, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, - 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, - 0x72, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x08, 0x6d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x60, 0x0a, 0x12, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, - 0x63, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x0c, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x2e, 0x44, - 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x11, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x3a, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, - 0x6c, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, - 0x33, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, - 0x6c, 0x69, 0x74, 0x79, 0x12, 0x26, 0x0a, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x61, 0x67, 0x65, - 0x6e, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x75, - 0x73, 0x65, 0x72, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2e, 0x0a, 0x12, - 0x75, 0x73, 0x65, 0x72, 0x5f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x10, 0x75, 0x73, 0x65, 0x72, - 0x41, 0x67, 0x65, 0x6e, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x5d, 0x0a, 0x18, - 0x75, 0x73, 0x65, 0x72, 0x5f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, - 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, - 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x15, 0x75, 0x73, 0x65, 0x72, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x42, - 0x75, 0x69, 0x6c, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x0a, 0x65, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x1f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, - 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x27, 0x0a, 0x0f, - 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, - 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x46, 0x65, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x5b, 0x0a, 0x13, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x69, - 0x6e, 0x67, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x0b, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x42, 0x0b, 0x18, 0x01, 0x92, 0xc7, 0x86, 0xd8, 0x04, 0x03, 0x33, 0x2e, 0x30, 0x52, 0x12, - 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x65, 0x73, 0x1a, 0x60, 0x0a, 0x16, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x30, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, - 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x6f, 0x6e, 0x74, - 0x65, 0x78, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x3a, 0x1d, 0x9a, 0xc5, 0x88, 0x1e, 0x18, 0x0a, 0x16, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4e, - 0x6f, 0x64, 0x65, 0x42, 0x19, 0x0a, 0x17, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x61, 0x67, 0x65, 0x6e, - 0x74, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x4a, 0x04, - 0x08, 0x05, 0x10, 0x06, 0x52, 0x0d, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x22, 0xb1, 0x03, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x12, 0x5b, 0x0a, 0x0f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, - 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0e, 0x66, - 0x69, 0x6c, 0x74, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x6b, 0x0a, - 0x15, 0x74, 0x79, 0x70, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x5f, 0x6d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, - 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x54, 0x79, 0x70, - 0x65, 0x64, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x13, 0x74, 0x79, 0x70, 0x65, 0x64, 0x46, 0x69, 0x6c, 0x74, - 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x5a, 0x0a, 0x13, 0x46, 0x69, - 0x6c, 0x74, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x5c, 0x0a, 0x18, 0x54, 0x79, 0x70, 0x65, 0x64, 0x46, - 0x69, 0x6c, 0x74, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x3a, 0x21, 0x9a, 0xc5, 0x88, 0x1e, 0x1c, 0x0a, 0x1a, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x86, 0x01, 0x0a, 0x0d, 0x52, 0x75, 0x6e, 0x74, - 0x69, 0x6d, 0x65, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x28, - 0x0a, 0x0b, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0a, 0x72, 0x75, - 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x4b, 0x65, 0x79, 0x3a, 0x26, 0x9a, 0xc5, 0x88, 0x1e, 0x21, 0x0a, - 0x1f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, - 0x22, 0x77, 0x0a, 0x0e, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x50, 0x65, 0x72, 0x63, 0x65, - 0x6e, 0x74, 0x12, 0x3b, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, - 0x74, 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, - 0x28, 0x0a, 0x0b, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0a, 0x72, - 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x4b, 0x65, 0x79, 0x22, 0x86, 0x01, 0x0a, 0x0d, 0x52, 0x75, - 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x64, - 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x01, 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x12, 0x28, 0x0a, 0x0b, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0a, - 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x4b, 0x65, 0x79, 0x3a, 0x26, 0x9a, 0xc5, 0x88, 0x1e, - 0x21, 0x0a, 0x1f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x44, 0x6f, 0x75, 0x62, - 0x6c, 0x65, 0x22, 0xb6, 0x01, 0x0a, 0x12, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x46, 0x65, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x46, 0x6c, 0x61, 0x67, 0x12, 0x49, 0x0a, 0x0d, 0x64, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x08, 0xfa, 0x42, - 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x12, 0x28, 0x0a, 0x0b, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x5f, - 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, - 0x10, 0x01, 0x52, 0x0a, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x4b, 0x65, 0x79, 0x3a, 0x2b, - 0x9a, 0xc5, 0x88, 0x1e, 0x26, 0x0a, 0x24, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, - 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x46, 0x6c, 0x61, 0x67, 0x22, 0x41, 0x0a, 0x0e, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, - 0x02, 0x10, 0x01, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xcd, - 0x01, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x11, 0xfa, 0x42, 0x0e, - 0x72, 0x0c, 0x10, 0x01, 0x28, 0x80, 0x80, 0x01, 0xc0, 0x01, 0x01, 0xc8, 0x01, 0x00, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x12, 0x37, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x21, 0xfa, 0x42, 0x0c, 0x72, 0x0a, 0x28, 0x80, 0x80, 0x01, 0xc0, 0x01, 0x02, - 0xc8, 0x01, 0x00, 0xf2, 0x98, 0xfe, 0x8f, 0x05, 0x0c, 0x12, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x5f, 0x74, 0x79, 0x70, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3a, 0x0a, 0x09, - 0x72, 0x61, 0x77, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x42, - 0x1d, 0xfa, 0x42, 0x08, 0x7a, 0x06, 0x10, 0x00, 0x18, 0x80, 0x80, 0x01, 0xf2, 0x98, 0xfe, 0x8f, - 0x05, 0x0c, 0x12, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x52, 0x08, - 0x72, 0x61, 0x77, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x24, 0x9a, 0xc5, 0x88, 0x1e, 0x1f, 0x0a, - 0x1d, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xd9, - 0x03, 0x0a, 0x11, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x43, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, - 0x01, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x3f, 0x0a, 0x06, 0x61, 0x70, 0x70, - 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x0b, 0x18, 0x01, 0x92, 0xc7, 0x86, 0xd8, 0x04, 0x03, 0x33, - 0x2e, 0x30, 0x52, 0x06, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x12, 0x69, 0x0a, 0x0d, 0x61, 0x70, - 0x70, 0x65, 0x6e, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x3a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, - 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x0c, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x41, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x10, 0x6b, 0x65, 0x65, 0x70, 0x5f, 0x65, 0x6d, - 0x70, 0x74, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x0e, 0x6b, 0x65, 0x65, 0x70, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0x7d, 0x0a, 0x12, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x41, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x17, 0x41, 0x50, 0x50, 0x45, 0x4e, 0x44, 0x5f, - 0x49, 0x46, 0x5f, 0x45, 0x58, 0x49, 0x53, 0x54, 0x53, 0x5f, 0x4f, 0x52, 0x5f, 0x41, 0x44, 0x44, - 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x41, 0x44, 0x44, 0x5f, 0x49, 0x46, 0x5f, 0x41, 0x42, 0x53, - 0x45, 0x4e, 0x54, 0x10, 0x01, 0x12, 0x1e, 0x0a, 0x1a, 0x4f, 0x56, 0x45, 0x52, 0x57, 0x52, 0x49, - 0x54, 0x45, 0x5f, 0x49, 0x46, 0x5f, 0x45, 0x58, 0x49, 0x53, 0x54, 0x53, 0x5f, 0x4f, 0x52, 0x5f, - 0x41, 0x44, 0x44, 0x10, 0x02, 0x12, 0x17, 0x0a, 0x13, 0x4f, 0x56, 0x45, 0x52, 0x57, 0x52, 0x49, - 0x54, 0x45, 0x5f, 0x49, 0x46, 0x5f, 0x45, 0x58, 0x49, 0x53, 0x54, 0x53, 0x10, 0x03, 0x3a, 0x2a, - 0x9a, 0xc5, 0x88, 0x1e, 0x25, 0x0a, 0x23, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x6c, 0x0a, 0x09, 0x48, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x4d, 0x61, 0x70, 0x12, 0x3b, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, - 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x07, 0x68, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x73, 0x3a, 0x22, 0x9a, 0xc5, 0x88, 0x1e, 0x1d, 0x0a, 0x1b, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x48, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x61, 0x70, 0x22, 0x2f, 0x0a, 0x10, 0x57, 0x61, 0x74, 0x63, - 0x68, 0x65, 0x64, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1b, 0x0a, 0x04, - 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, - 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0xf4, 0x01, 0x0a, 0x0a, 0x44, 0x61, - 0x74, 0x61, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x25, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, - 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x23, 0x0a, 0x0c, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x0b, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x42, - 0x79, 0x74, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0d, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x73, - 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0c, 0x69, - 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x3c, 0x0a, 0x14, 0x65, - 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x72, 0x69, 0x61, - 0x62, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, - 0x10, 0x01, 0x48, 0x00, 0x52, 0x13, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, - 0x74, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x3a, 0x23, 0x9a, 0xc5, 0x88, 0x1e, 0x1e, - 0x0a, 0x1c, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, - 0x6f, 0x72, 0x65, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x10, - 0x0a, 0x09, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x03, 0xf8, 0x42, 0x01, - 0x22, 0xd4, 0x01, 0x0a, 0x0b, 0x52, 0x65, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x12, 0x4b, 0x0a, 0x0e, 0x72, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x5f, 0x6f, - 0x66, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, - 0x42, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x52, - 0x0c, 0x72, 0x65, 0x74, 0x72, 0x79, 0x42, 0x61, 0x63, 0x6b, 0x4f, 0x66, 0x66, 0x12, 0x52, 0x0a, - 0x0b, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x42, 0x13, 0xf2, 0x98, 0xfe, 0x8f, 0x05, 0x0d, 0x0a, 0x0b, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x65, - 0x74, 0x72, 0x69, 0x65, 0x73, 0x52, 0x0a, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x74, 0x72, 0x69, 0x65, - 0x73, 0x3a, 0x24, 0x9a, 0xc5, 0x88, 0x1e, 0x1f, 0x0a, 0x1d, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x52, 0x65, 0x74, 0x72, - 0x79, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0xe8, 0x01, 0x0a, 0x10, 0x52, 0x65, 0x6d, 0x6f, - 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x42, 0x0a, 0x08, - 0x68, 0x74, 0x74, 0x70, 0x5f, 0x75, 0x72, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, - 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x55, 0x72, 0x69, 0x42, 0x08, 0xfa, - 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x07, 0x68, 0x74, 0x74, 0x70, 0x55, 0x72, 0x69, - 0x12, 0x1f, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, - 0x36, 0x12, 0x44, 0x0a, 0x0c, 0x72, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, - 0x65, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x0b, 0x72, 0x65, 0x74, 0x72, - 0x79, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x3a, 0x29, 0x9a, 0xc5, 0x88, 0x1e, 0x24, 0x0a, 0x22, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x53, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x22, 0xc9, 0x01, 0x0a, 0x0f, 0x41, 0x73, 0x79, 0x6e, 0x63, 0x44, 0x61, 0x74, 0x61, - 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x38, 0x0a, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x61, 0x74, - 0x61, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x00, 0x52, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, - 0x12, 0x40, 0x0a, 0x06, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x26, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, - 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x44, 0x61, - 0x74, 0x61, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x00, 0x52, 0x06, 0x72, 0x65, 0x6d, 0x6f, - 0x74, 0x65, 0x3a, 0x28, 0x9a, 0xc5, 0x88, 0x1e, 0x23, 0x0a, 0x21, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x41, 0x73, 0x79, - 0x6e, 0x63, 0x44, 0x61, 0x74, 0x61, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x10, 0x0a, 0x09, - 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0xb0, - 0x01, 0x0a, 0x0f, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x6f, 0x63, 0x6b, - 0x65, 0x74, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x39, 0x0a, 0x0c, 0x74, 0x79, 0x70, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x48, 0x00, 0x52, 0x0b, 0x74, - 0x79, 0x70, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x3a, 0x28, 0x9a, 0xc5, 0x88, 0x1e, - 0x23, 0x0a, 0x21, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x6f, - 0x63, 0x6b, 0x65, 0x74, 0x42, 0x0d, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x4a, 0x04, 0x08, 0x02, 0x10, 0x03, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x22, 0xbf, 0x01, 0x0a, 0x18, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x46, 0x72, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x12, 0x4f, - 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x46, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, - 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, - 0x01, 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, - 0x1f, 0x0a, 0x0b, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x4b, 0x65, 0x79, - 0x3a, 0x31, 0x9a, 0xc5, 0x88, 0x1e, 0x2c, 0x0a, 0x2a, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x52, 0x75, 0x6e, 0x74, 0x69, - 0x6d, 0x65, 0x46, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x63, - 0x65, 0x6e, 0x74, 0x22, 0x55, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x50, 0x6c, - 0x61, 0x6e, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, - 0x69, 0x65, 0x72, 0x3a, 0x25, 0x9a, 0xc5, 0x88, 0x1e, 0x20, 0x0a, 0x1e, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6f, - 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x50, 0x6c, 0x61, 0x6e, 0x65, 0x2a, 0x28, 0x0a, 0x0f, 0x52, 0x6f, - 0x75, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x0b, 0x0a, - 0x07, 0x44, 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x49, - 0x47, 0x48, 0x10, 0x01, 0x2a, 0x89, 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x16, 0x0a, 0x12, 0x4d, 0x45, 0x54, 0x48, 0x4f, 0x44, - 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, - 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, - 0x02, 0x12, 0x08, 0x0a, 0x04, 0x50, 0x4f, 0x53, 0x54, 0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x50, - 0x55, 0x54, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x05, - 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x10, 0x06, 0x12, 0x0b, 0x0a, - 0x07, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x10, 0x07, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x52, - 0x41, 0x43, 0x45, 0x10, 0x08, 0x12, 0x09, 0x0a, 0x05, 0x50, 0x41, 0x54, 0x43, 0x48, 0x10, 0x09, - 0x2a, 0x3e, 0x0a, 0x10, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x44, 0x69, 0x72, 0x65, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, - 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x42, 0x4f, 0x55, 0x4e, 0x44, - 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x4f, 0x55, 0x54, 0x42, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x02, - 0x42, 0x7d, 0x0a, 0x22, 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, - 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, - 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x42, 0x09, 0x42, 0x61, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, - 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, - 0x3b, 0x63, 0x6f, 0x72, 0x65, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_config_core_v3_base_proto_rawDescOnce sync.Once - file_envoy_config_core_v3_base_proto_rawDescData = file_envoy_config_core_v3_base_proto_rawDesc -) - -func file_envoy_config_core_v3_base_proto_rawDescGZIP() []byte { - file_envoy_config_core_v3_base_proto_rawDescOnce.Do(func() { - file_envoy_config_core_v3_base_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_config_core_v3_base_proto_rawDescData) - }) - return file_envoy_config_core_v3_base_proto_rawDescData -} - -var file_envoy_config_core_v3_base_proto_enumTypes = make([]protoimpl.EnumInfo, 4) -var file_envoy_config_core_v3_base_proto_msgTypes = make([]protoimpl.MessageInfo, 24) -var file_envoy_config_core_v3_base_proto_goTypes = []interface{}{ - (RoutingPriority)(0), // 0: envoy.config.core.v3.RoutingPriority - (RequestMethod)(0), // 1: envoy.config.core.v3.RequestMethod - (TrafficDirection)(0), // 2: envoy.config.core.v3.TrafficDirection - (HeaderValueOption_HeaderAppendAction)(0), // 3: envoy.config.core.v3.HeaderValueOption.HeaderAppendAction - (*Locality)(nil), // 4: envoy.config.core.v3.Locality - (*BuildVersion)(nil), // 5: envoy.config.core.v3.BuildVersion - (*Extension)(nil), // 6: envoy.config.core.v3.Extension - (*Node)(nil), // 7: envoy.config.core.v3.Node - (*Metadata)(nil), // 8: envoy.config.core.v3.Metadata - (*RuntimeUInt32)(nil), // 9: envoy.config.core.v3.RuntimeUInt32 - (*RuntimePercent)(nil), // 10: envoy.config.core.v3.RuntimePercent - (*RuntimeDouble)(nil), // 11: envoy.config.core.v3.RuntimeDouble - (*RuntimeFeatureFlag)(nil), // 12: envoy.config.core.v3.RuntimeFeatureFlag - (*QueryParameter)(nil), // 13: envoy.config.core.v3.QueryParameter - (*HeaderValue)(nil), // 14: envoy.config.core.v3.HeaderValue - (*HeaderValueOption)(nil), // 15: envoy.config.core.v3.HeaderValueOption - (*HeaderMap)(nil), // 16: envoy.config.core.v3.HeaderMap - (*WatchedDirectory)(nil), // 17: envoy.config.core.v3.WatchedDirectory - (*DataSource)(nil), // 18: envoy.config.core.v3.DataSource - (*RetryPolicy)(nil), // 19: envoy.config.core.v3.RetryPolicy - (*RemoteDataSource)(nil), // 20: envoy.config.core.v3.RemoteDataSource - (*AsyncDataSource)(nil), // 21: envoy.config.core.v3.AsyncDataSource - (*TransportSocket)(nil), // 22: envoy.config.core.v3.TransportSocket - (*RuntimeFractionalPercent)(nil), // 23: envoy.config.core.v3.RuntimeFractionalPercent - (*ControlPlane)(nil), // 24: envoy.config.core.v3.ControlPlane - nil, // 25: envoy.config.core.v3.Node.DynamicParametersEntry - nil, // 26: envoy.config.core.v3.Metadata.FilterMetadataEntry - nil, // 27: envoy.config.core.v3.Metadata.TypedFilterMetadataEntry - (*v3.SemanticVersion)(nil), // 28: envoy.type.v3.SemanticVersion - (*structpb.Struct)(nil), // 29: google.protobuf.Struct - (*Address)(nil), // 30: envoy.config.core.v3.Address - (*v3.Percent)(nil), // 31: envoy.type.v3.Percent - (*wrapperspb.BoolValue)(nil), // 32: google.protobuf.BoolValue - (*BackoffStrategy)(nil), // 33: envoy.config.core.v3.BackoffStrategy - (*wrapperspb.UInt32Value)(nil), // 34: google.protobuf.UInt32Value - (*HttpUri)(nil), // 35: envoy.config.core.v3.HttpUri - (*anypb.Any)(nil), // 36: google.protobuf.Any - (*v3.FractionalPercent)(nil), // 37: envoy.type.v3.FractionalPercent - (*v31.ContextParams)(nil), // 38: xds.core.v3.ContextParams -} -var file_envoy_config_core_v3_base_proto_depIdxs = []int32{ - 28, // 0: envoy.config.core.v3.BuildVersion.version:type_name -> envoy.type.v3.SemanticVersion - 29, // 1: envoy.config.core.v3.BuildVersion.metadata:type_name -> google.protobuf.Struct - 5, // 2: envoy.config.core.v3.Extension.version:type_name -> envoy.config.core.v3.BuildVersion - 29, // 3: envoy.config.core.v3.Node.metadata:type_name -> google.protobuf.Struct - 25, // 4: envoy.config.core.v3.Node.dynamic_parameters:type_name -> envoy.config.core.v3.Node.DynamicParametersEntry - 4, // 5: envoy.config.core.v3.Node.locality:type_name -> envoy.config.core.v3.Locality - 5, // 6: envoy.config.core.v3.Node.user_agent_build_version:type_name -> envoy.config.core.v3.BuildVersion - 6, // 7: envoy.config.core.v3.Node.extensions:type_name -> envoy.config.core.v3.Extension - 30, // 8: envoy.config.core.v3.Node.listening_addresses:type_name -> envoy.config.core.v3.Address - 26, // 9: envoy.config.core.v3.Metadata.filter_metadata:type_name -> envoy.config.core.v3.Metadata.FilterMetadataEntry - 27, // 10: envoy.config.core.v3.Metadata.typed_filter_metadata:type_name -> envoy.config.core.v3.Metadata.TypedFilterMetadataEntry - 31, // 11: envoy.config.core.v3.RuntimePercent.default_value:type_name -> envoy.type.v3.Percent - 32, // 12: envoy.config.core.v3.RuntimeFeatureFlag.default_value:type_name -> google.protobuf.BoolValue - 14, // 13: envoy.config.core.v3.HeaderValueOption.header:type_name -> envoy.config.core.v3.HeaderValue - 32, // 14: envoy.config.core.v3.HeaderValueOption.append:type_name -> google.protobuf.BoolValue - 3, // 15: envoy.config.core.v3.HeaderValueOption.append_action:type_name -> envoy.config.core.v3.HeaderValueOption.HeaderAppendAction - 14, // 16: envoy.config.core.v3.HeaderMap.headers:type_name -> envoy.config.core.v3.HeaderValue - 33, // 17: envoy.config.core.v3.RetryPolicy.retry_back_off:type_name -> envoy.config.core.v3.BackoffStrategy - 34, // 18: envoy.config.core.v3.RetryPolicy.num_retries:type_name -> google.protobuf.UInt32Value - 35, // 19: envoy.config.core.v3.RemoteDataSource.http_uri:type_name -> envoy.config.core.v3.HttpUri - 19, // 20: envoy.config.core.v3.RemoteDataSource.retry_policy:type_name -> envoy.config.core.v3.RetryPolicy - 18, // 21: envoy.config.core.v3.AsyncDataSource.local:type_name -> envoy.config.core.v3.DataSource - 20, // 22: envoy.config.core.v3.AsyncDataSource.remote:type_name -> envoy.config.core.v3.RemoteDataSource - 36, // 23: envoy.config.core.v3.TransportSocket.typed_config:type_name -> google.protobuf.Any - 37, // 24: envoy.config.core.v3.RuntimeFractionalPercent.default_value:type_name -> envoy.type.v3.FractionalPercent - 38, // 25: envoy.config.core.v3.Node.DynamicParametersEntry.value:type_name -> xds.core.v3.ContextParams - 29, // 26: envoy.config.core.v3.Metadata.FilterMetadataEntry.value:type_name -> google.protobuf.Struct - 36, // 27: envoy.config.core.v3.Metadata.TypedFilterMetadataEntry.value:type_name -> google.protobuf.Any - 28, // [28:28] is the sub-list for method output_type - 28, // [28:28] is the sub-list for method input_type - 28, // [28:28] is the sub-list for extension type_name - 28, // [28:28] is the sub-list for extension extendee - 0, // [0:28] is the sub-list for field type_name -} - -func init() { file_envoy_config_core_v3_base_proto_init() } -func file_envoy_config_core_v3_base_proto_init() { - if File_envoy_config_core_v3_base_proto != nil { - return - } - file_envoy_config_core_v3_address_proto_init() - file_envoy_config_core_v3_backoff_proto_init() - file_envoy_config_core_v3_http_uri_proto_init() - if !protoimpl.UnsafeEnabled { - file_envoy_config_core_v3_base_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Locality); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_base_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BuildVersion); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_base_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Extension); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_base_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Node); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_base_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Metadata); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_base_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RuntimeUInt32); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_base_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RuntimePercent); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_base_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RuntimeDouble); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_base_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RuntimeFeatureFlag); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_base_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryParameter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_base_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HeaderValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_base_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HeaderValueOption); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_base_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HeaderMap); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_base_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WatchedDirectory); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_base_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DataSource); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_base_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RetryPolicy); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_base_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RemoteDataSource); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_base_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AsyncDataSource); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_base_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TransportSocket); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_base_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RuntimeFractionalPercent); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_base_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ControlPlane); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_config_core_v3_base_proto_msgTypes[3].OneofWrappers = []interface{}{ - (*Node_UserAgentVersion)(nil), - (*Node_UserAgentBuildVersion)(nil), - } - file_envoy_config_core_v3_base_proto_msgTypes[14].OneofWrappers = []interface{}{ - (*DataSource_Filename)(nil), - (*DataSource_InlineBytes)(nil), - (*DataSource_InlineString)(nil), - (*DataSource_EnvironmentVariable)(nil), - } - file_envoy_config_core_v3_base_proto_msgTypes[17].OneofWrappers = []interface{}{ - (*AsyncDataSource_Local)(nil), - (*AsyncDataSource_Remote)(nil), - } - file_envoy_config_core_v3_base_proto_msgTypes[18].OneofWrappers = []interface{}{ - (*TransportSocket_TypedConfig)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_config_core_v3_base_proto_rawDesc, - NumEnums: 4, - NumMessages: 24, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_config_core_v3_base_proto_goTypes, - DependencyIndexes: file_envoy_config_core_v3_base_proto_depIdxs, - EnumInfos: file_envoy_config_core_v3_base_proto_enumTypes, - MessageInfos: file_envoy_config_core_v3_base_proto_msgTypes, - }.Build() - File_envoy_config_core_v3_base_proto = out.File - file_envoy_config_core_v3_base_proto_rawDesc = nil - file_envoy_config_core_v3_base_proto_goTypes = nil - file_envoy_config_core_v3_base_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/base.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/base.pb.validate.go deleted file mode 100644 index 7e2dd5390..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/base.pb.validate.go +++ /dev/null @@ -1,3316 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/config/core/v3/base.proto - -package corev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on Locality with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Locality) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Locality with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in LocalityMultiError, or nil -// if none found. -func (m *Locality) ValidateAll() error { - return m.validate(true) -} - -func (m *Locality) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Region - - // no validation rules for Zone - - // no validation rules for SubZone - - if len(errors) > 0 { - return LocalityMultiError(errors) - } - - return nil -} - -// LocalityMultiError is an error wrapping multiple validation errors returned -// by Locality.ValidateAll() if the designated constraints aren't met. -type LocalityMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m LocalityMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m LocalityMultiError) AllErrors() []error { return m } - -// LocalityValidationError is the validation error returned by -// Locality.Validate if the designated constraints aren't met. -type LocalityValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e LocalityValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e LocalityValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e LocalityValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e LocalityValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e LocalityValidationError) ErrorName() string { return "LocalityValidationError" } - -// Error satisfies the builtin error interface -func (e LocalityValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sLocality.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = LocalityValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = LocalityValidationError{} - -// Validate checks the field values on BuildVersion with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *BuildVersion) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on BuildVersion with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in BuildVersionMultiError, or -// nil if none found. -func (m *BuildVersion) ValidateAll() error { - return m.validate(true) -} - -func (m *BuildVersion) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetVersion()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, BuildVersionValidationError{ - field: "Version", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, BuildVersionValidationError{ - field: "Version", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetVersion()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return BuildVersionValidationError{ - field: "Version", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetMetadata()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, BuildVersionValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, BuildVersionValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return BuildVersionValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return BuildVersionMultiError(errors) - } - - return nil -} - -// BuildVersionMultiError is an error wrapping multiple validation errors -// returned by BuildVersion.ValidateAll() if the designated constraints aren't met. -type BuildVersionMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m BuildVersionMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m BuildVersionMultiError) AllErrors() []error { return m } - -// BuildVersionValidationError is the validation error returned by -// BuildVersion.Validate if the designated constraints aren't met. -type BuildVersionValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e BuildVersionValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e BuildVersionValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e BuildVersionValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e BuildVersionValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e BuildVersionValidationError) ErrorName() string { return "BuildVersionValidationError" } - -// Error satisfies the builtin error interface -func (e BuildVersionValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sBuildVersion.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = BuildVersionValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = BuildVersionValidationError{} - -// Validate checks the field values on Extension with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Extension) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Extension with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in ExtensionMultiError, or nil -// if none found. -func (m *Extension) ValidateAll() error { - return m.validate(true) -} - -func (m *Extension) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Name - - // no validation rules for Category - - // no validation rules for TypeDescriptor - - if all { - switch v := interface{}(m.GetVersion()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExtensionValidationError{ - field: "Version", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExtensionValidationError{ - field: "Version", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetVersion()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExtensionValidationError{ - field: "Version", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for Disabled - - if len(errors) > 0 { - return ExtensionMultiError(errors) - } - - return nil -} - -// ExtensionMultiError is an error wrapping multiple validation errors returned -// by Extension.ValidateAll() if the designated constraints aren't met. -type ExtensionMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ExtensionMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ExtensionMultiError) AllErrors() []error { return m } - -// ExtensionValidationError is the validation error returned by -// Extension.Validate if the designated constraints aren't met. -type ExtensionValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ExtensionValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ExtensionValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ExtensionValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ExtensionValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ExtensionValidationError) ErrorName() string { return "ExtensionValidationError" } - -// Error satisfies the builtin error interface -func (e ExtensionValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sExtension.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ExtensionValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ExtensionValidationError{} - -// Validate checks the field values on Node with the rules defined in the proto -// definition for this message. If any rules are violated, the first error -// encountered is returned, or nil if there are no violations. -func (m *Node) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Node with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in NodeMultiError, or nil if none found. -func (m *Node) ValidateAll() error { - return m.validate(true) -} - -func (m *Node) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Id - - // no validation rules for Cluster - - if all { - switch v := interface{}(m.GetMetadata()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, NodeValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, NodeValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return NodeValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - } - } - } - - { - sorted_keys := make([]string, len(m.GetDynamicParameters())) - i := 0 - for key := range m.GetDynamicParameters() { - sorted_keys[i] = key - i++ - } - sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] }) - for _, key := range sorted_keys { - val := m.GetDynamicParameters()[key] - _ = val - - // no validation rules for DynamicParameters[key] - - if all { - switch v := interface{}(val).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, NodeValidationError{ - field: fmt.Sprintf("DynamicParameters[%v]", key), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, NodeValidationError{ - field: fmt.Sprintf("DynamicParameters[%v]", key), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(val).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return NodeValidationError{ - field: fmt.Sprintf("DynamicParameters[%v]", key), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - } - - if all { - switch v := interface{}(m.GetLocality()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, NodeValidationError{ - field: "Locality", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, NodeValidationError{ - field: "Locality", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetLocality()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return NodeValidationError{ - field: "Locality", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for UserAgentName - - for idx, item := range m.GetExtensions() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, NodeValidationError{ - field: fmt.Sprintf("Extensions[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, NodeValidationError{ - field: fmt.Sprintf("Extensions[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return NodeValidationError{ - field: fmt.Sprintf("Extensions[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetListeningAddresses() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, NodeValidationError{ - field: fmt.Sprintf("ListeningAddresses[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, NodeValidationError{ - field: fmt.Sprintf("ListeningAddresses[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return NodeValidationError{ - field: fmt.Sprintf("ListeningAddresses[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - switch v := m.UserAgentVersionType.(type) { - case *Node_UserAgentVersion: - if v == nil { - err := NodeValidationError{ - field: "UserAgentVersionType", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - // no validation rules for UserAgentVersion - case *Node_UserAgentBuildVersion: - if v == nil { - err := NodeValidationError{ - field: "UserAgentVersionType", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetUserAgentBuildVersion()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, NodeValidationError{ - field: "UserAgentBuildVersion", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, NodeValidationError{ - field: "UserAgentBuildVersion", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetUserAgentBuildVersion()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return NodeValidationError{ - field: "UserAgentBuildVersion", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return NodeMultiError(errors) - } - - return nil -} - -// NodeMultiError is an error wrapping multiple validation errors returned by -// Node.ValidateAll() if the designated constraints aren't met. -type NodeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m NodeMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m NodeMultiError) AllErrors() []error { return m } - -// NodeValidationError is the validation error returned by Node.Validate if the -// designated constraints aren't met. -type NodeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e NodeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e NodeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e NodeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e NodeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e NodeValidationError) ErrorName() string { return "NodeValidationError" } - -// Error satisfies the builtin error interface -func (e NodeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sNode.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = NodeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = NodeValidationError{} - -// Validate checks the field values on Metadata with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Metadata) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Metadata with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in MetadataMultiError, or nil -// if none found. -func (m *Metadata) ValidateAll() error { - return m.validate(true) -} - -func (m *Metadata) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - { - sorted_keys := make([]string, len(m.GetFilterMetadata())) - i := 0 - for key := range m.GetFilterMetadata() { - sorted_keys[i] = key - i++ - } - sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] }) - for _, key := range sorted_keys { - val := m.GetFilterMetadata()[key] - _ = val - - // no validation rules for FilterMetadata[key] - - if all { - switch v := interface{}(val).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, MetadataValidationError{ - field: fmt.Sprintf("FilterMetadata[%v]", key), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, MetadataValidationError{ - field: fmt.Sprintf("FilterMetadata[%v]", key), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(val).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return MetadataValidationError{ - field: fmt.Sprintf("FilterMetadata[%v]", key), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - } - - { - sorted_keys := make([]string, len(m.GetTypedFilterMetadata())) - i := 0 - for key := range m.GetTypedFilterMetadata() { - sorted_keys[i] = key - i++ - } - sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] }) - for _, key := range sorted_keys { - val := m.GetTypedFilterMetadata()[key] - _ = val - - // no validation rules for TypedFilterMetadata[key] - - if all { - switch v := interface{}(val).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, MetadataValidationError{ - field: fmt.Sprintf("TypedFilterMetadata[%v]", key), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, MetadataValidationError{ - field: fmt.Sprintf("TypedFilterMetadata[%v]", key), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(val).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return MetadataValidationError{ - field: fmt.Sprintf("TypedFilterMetadata[%v]", key), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - } - - if len(errors) > 0 { - return MetadataMultiError(errors) - } - - return nil -} - -// MetadataMultiError is an error wrapping multiple validation errors returned -// by Metadata.ValidateAll() if the designated constraints aren't met. -type MetadataMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m MetadataMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m MetadataMultiError) AllErrors() []error { return m } - -// MetadataValidationError is the validation error returned by -// Metadata.Validate if the designated constraints aren't met. -type MetadataValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e MetadataValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e MetadataValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e MetadataValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e MetadataValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e MetadataValidationError) ErrorName() string { return "MetadataValidationError" } - -// Error satisfies the builtin error interface -func (e MetadataValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMetadata.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = MetadataValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = MetadataValidationError{} - -// Validate checks the field values on RuntimeUInt32 with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *RuntimeUInt32) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RuntimeUInt32 with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in RuntimeUInt32MultiError, or -// nil if none found. -func (m *RuntimeUInt32) ValidateAll() error { - return m.validate(true) -} - -func (m *RuntimeUInt32) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for DefaultValue - - if utf8.RuneCountInString(m.GetRuntimeKey()) < 1 { - err := RuntimeUInt32ValidationError{ - field: "RuntimeKey", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return RuntimeUInt32MultiError(errors) - } - - return nil -} - -// RuntimeUInt32MultiError is an error wrapping multiple validation errors -// returned by RuntimeUInt32.ValidateAll() if the designated constraints -// aren't met. -type RuntimeUInt32MultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RuntimeUInt32MultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RuntimeUInt32MultiError) AllErrors() []error { return m } - -// RuntimeUInt32ValidationError is the validation error returned by -// RuntimeUInt32.Validate if the designated constraints aren't met. -type RuntimeUInt32ValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RuntimeUInt32ValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RuntimeUInt32ValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RuntimeUInt32ValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RuntimeUInt32ValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RuntimeUInt32ValidationError) ErrorName() string { return "RuntimeUInt32ValidationError" } - -// Error satisfies the builtin error interface -func (e RuntimeUInt32ValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRuntimeUInt32.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RuntimeUInt32ValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RuntimeUInt32ValidationError{} - -// Validate checks the field values on RuntimePercent with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *RuntimePercent) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RuntimePercent with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in RuntimePercentMultiError, -// or nil if none found. -func (m *RuntimePercent) ValidateAll() error { - return m.validate(true) -} - -func (m *RuntimePercent) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetDefaultValue()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RuntimePercentValidationError{ - field: "DefaultValue", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RuntimePercentValidationError{ - field: "DefaultValue", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDefaultValue()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RuntimePercentValidationError{ - field: "DefaultValue", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if utf8.RuneCountInString(m.GetRuntimeKey()) < 1 { - err := RuntimePercentValidationError{ - field: "RuntimeKey", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return RuntimePercentMultiError(errors) - } - - return nil -} - -// RuntimePercentMultiError is an error wrapping multiple validation errors -// returned by RuntimePercent.ValidateAll() if the designated constraints -// aren't met. -type RuntimePercentMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RuntimePercentMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RuntimePercentMultiError) AllErrors() []error { return m } - -// RuntimePercentValidationError is the validation error returned by -// RuntimePercent.Validate if the designated constraints aren't met. -type RuntimePercentValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RuntimePercentValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RuntimePercentValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RuntimePercentValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RuntimePercentValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RuntimePercentValidationError) ErrorName() string { return "RuntimePercentValidationError" } - -// Error satisfies the builtin error interface -func (e RuntimePercentValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRuntimePercent.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RuntimePercentValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RuntimePercentValidationError{} - -// Validate checks the field values on RuntimeDouble with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *RuntimeDouble) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RuntimeDouble with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in RuntimeDoubleMultiError, or -// nil if none found. -func (m *RuntimeDouble) ValidateAll() error { - return m.validate(true) -} - -func (m *RuntimeDouble) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for DefaultValue - - if utf8.RuneCountInString(m.GetRuntimeKey()) < 1 { - err := RuntimeDoubleValidationError{ - field: "RuntimeKey", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return RuntimeDoubleMultiError(errors) - } - - return nil -} - -// RuntimeDoubleMultiError is an error wrapping multiple validation errors -// returned by RuntimeDouble.ValidateAll() if the designated constraints -// aren't met. -type RuntimeDoubleMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RuntimeDoubleMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RuntimeDoubleMultiError) AllErrors() []error { return m } - -// RuntimeDoubleValidationError is the validation error returned by -// RuntimeDouble.Validate if the designated constraints aren't met. -type RuntimeDoubleValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RuntimeDoubleValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RuntimeDoubleValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RuntimeDoubleValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RuntimeDoubleValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RuntimeDoubleValidationError) ErrorName() string { return "RuntimeDoubleValidationError" } - -// Error satisfies the builtin error interface -func (e RuntimeDoubleValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRuntimeDouble.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RuntimeDoubleValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RuntimeDoubleValidationError{} - -// Validate checks the field values on RuntimeFeatureFlag with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RuntimeFeatureFlag) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RuntimeFeatureFlag with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RuntimeFeatureFlagMultiError, or nil if none found. -func (m *RuntimeFeatureFlag) ValidateAll() error { - return m.validate(true) -} - -func (m *RuntimeFeatureFlag) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetDefaultValue() == nil { - err := RuntimeFeatureFlagValidationError{ - field: "DefaultValue", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetDefaultValue()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RuntimeFeatureFlagValidationError{ - field: "DefaultValue", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RuntimeFeatureFlagValidationError{ - field: "DefaultValue", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDefaultValue()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RuntimeFeatureFlagValidationError{ - field: "DefaultValue", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if utf8.RuneCountInString(m.GetRuntimeKey()) < 1 { - err := RuntimeFeatureFlagValidationError{ - field: "RuntimeKey", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return RuntimeFeatureFlagMultiError(errors) - } - - return nil -} - -// RuntimeFeatureFlagMultiError is an error wrapping multiple validation errors -// returned by RuntimeFeatureFlag.ValidateAll() if the designated constraints -// aren't met. -type RuntimeFeatureFlagMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RuntimeFeatureFlagMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RuntimeFeatureFlagMultiError) AllErrors() []error { return m } - -// RuntimeFeatureFlagValidationError is the validation error returned by -// RuntimeFeatureFlag.Validate if the designated constraints aren't met. -type RuntimeFeatureFlagValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RuntimeFeatureFlagValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RuntimeFeatureFlagValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RuntimeFeatureFlagValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RuntimeFeatureFlagValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RuntimeFeatureFlagValidationError) ErrorName() string { - return "RuntimeFeatureFlagValidationError" -} - -// Error satisfies the builtin error interface -func (e RuntimeFeatureFlagValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRuntimeFeatureFlag.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RuntimeFeatureFlagValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RuntimeFeatureFlagValidationError{} - -// Validate checks the field values on QueryParameter with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *QueryParameter) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on QueryParameter with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in QueryParameterMultiError, -// or nil if none found. -func (m *QueryParameter) ValidateAll() error { - return m.validate(true) -} - -func (m *QueryParameter) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetKey()) < 1 { - err := QueryParameterValidationError{ - field: "Key", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for Value - - if len(errors) > 0 { - return QueryParameterMultiError(errors) - } - - return nil -} - -// QueryParameterMultiError is an error wrapping multiple validation errors -// returned by QueryParameter.ValidateAll() if the designated constraints -// aren't met. -type QueryParameterMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m QueryParameterMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m QueryParameterMultiError) AllErrors() []error { return m } - -// QueryParameterValidationError is the validation error returned by -// QueryParameter.Validate if the designated constraints aren't met. -type QueryParameterValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e QueryParameterValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e QueryParameterValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e QueryParameterValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e QueryParameterValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e QueryParameterValidationError) ErrorName() string { return "QueryParameterValidationError" } - -// Error satisfies the builtin error interface -func (e QueryParameterValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sQueryParameter.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = QueryParameterValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = QueryParameterValidationError{} - -// Validate checks the field values on HeaderValue with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *HeaderValue) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HeaderValue with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in HeaderValueMultiError, or -// nil if none found. -func (m *HeaderValue) ValidateAll() error { - return m.validate(true) -} - -func (m *HeaderValue) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetKey()) < 1 { - err := HeaderValueValidationError{ - field: "Key", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(m.GetKey()) > 16384 { - err := HeaderValueValidationError{ - field: "Key", - reason: "value length must be at most 16384 bytes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_HeaderValue_Key_Pattern.MatchString(m.GetKey()) { - err := HeaderValueValidationError{ - field: "Key", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(m.GetValue()) > 16384 { - err := HeaderValueValidationError{ - field: "Value", - reason: "value length must be at most 16384 bytes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_HeaderValue_Value_Pattern.MatchString(m.GetValue()) { - err := HeaderValueValidationError{ - field: "Value", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - if l := len(m.GetRawValue()); l < 0 || l > 16384 { - err := HeaderValueValidationError{ - field: "RawValue", - reason: "value length must be between 0 and 16384 bytes, inclusive", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return HeaderValueMultiError(errors) - } - - return nil -} - -// HeaderValueMultiError is an error wrapping multiple validation errors -// returned by HeaderValue.ValidateAll() if the designated constraints aren't met. -type HeaderValueMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HeaderValueMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HeaderValueMultiError) AllErrors() []error { return m } - -// HeaderValueValidationError is the validation error returned by -// HeaderValue.Validate if the designated constraints aren't met. -type HeaderValueValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HeaderValueValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HeaderValueValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HeaderValueValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HeaderValueValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HeaderValueValidationError) ErrorName() string { return "HeaderValueValidationError" } - -// Error satisfies the builtin error interface -func (e HeaderValueValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHeaderValue.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HeaderValueValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HeaderValueValidationError{} - -var _HeaderValue_Key_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -var _HeaderValue_Value_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -// Validate checks the field values on HeaderValueOption with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *HeaderValueOption) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HeaderValueOption with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// HeaderValueOptionMultiError, or nil if none found. -func (m *HeaderValueOption) ValidateAll() error { - return m.validate(true) -} - -func (m *HeaderValueOption) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetHeader() == nil { - err := HeaderValueOptionValidationError{ - field: "Header", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetHeader()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HeaderValueOptionValidationError{ - field: "Header", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HeaderValueOptionValidationError{ - field: "Header", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HeaderValueOptionValidationError{ - field: "Header", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetAppend()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HeaderValueOptionValidationError{ - field: "Append", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HeaderValueOptionValidationError{ - field: "Append", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetAppend()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HeaderValueOptionValidationError{ - field: "Append", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if _, ok := HeaderValueOption_HeaderAppendAction_name[int32(m.GetAppendAction())]; !ok { - err := HeaderValueOptionValidationError{ - field: "AppendAction", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for KeepEmptyValue - - if len(errors) > 0 { - return HeaderValueOptionMultiError(errors) - } - - return nil -} - -// HeaderValueOptionMultiError is an error wrapping multiple validation errors -// returned by HeaderValueOption.ValidateAll() if the designated constraints -// aren't met. -type HeaderValueOptionMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HeaderValueOptionMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HeaderValueOptionMultiError) AllErrors() []error { return m } - -// HeaderValueOptionValidationError is the validation error returned by -// HeaderValueOption.Validate if the designated constraints aren't met. -type HeaderValueOptionValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HeaderValueOptionValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HeaderValueOptionValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HeaderValueOptionValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HeaderValueOptionValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HeaderValueOptionValidationError) ErrorName() string { - return "HeaderValueOptionValidationError" -} - -// Error satisfies the builtin error interface -func (e HeaderValueOptionValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHeaderValueOption.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HeaderValueOptionValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HeaderValueOptionValidationError{} - -// Validate checks the field values on HeaderMap with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *HeaderMap) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HeaderMap with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in HeaderMapMultiError, or nil -// if none found. -func (m *HeaderMap) ValidateAll() error { - return m.validate(true) -} - -func (m *HeaderMap) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetHeaders() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HeaderMapValidationError{ - field: fmt.Sprintf("Headers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HeaderMapValidationError{ - field: fmt.Sprintf("Headers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HeaderMapValidationError{ - field: fmt.Sprintf("Headers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return HeaderMapMultiError(errors) - } - - return nil -} - -// HeaderMapMultiError is an error wrapping multiple validation errors returned -// by HeaderMap.ValidateAll() if the designated constraints aren't met. -type HeaderMapMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HeaderMapMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HeaderMapMultiError) AllErrors() []error { return m } - -// HeaderMapValidationError is the validation error returned by -// HeaderMap.Validate if the designated constraints aren't met. -type HeaderMapValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HeaderMapValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HeaderMapValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HeaderMapValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HeaderMapValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HeaderMapValidationError) ErrorName() string { return "HeaderMapValidationError" } - -// Error satisfies the builtin error interface -func (e HeaderMapValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHeaderMap.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HeaderMapValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HeaderMapValidationError{} - -// Validate checks the field values on WatchedDirectory with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *WatchedDirectory) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on WatchedDirectory with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// WatchedDirectoryMultiError, or nil if none found. -func (m *WatchedDirectory) ValidateAll() error { - return m.validate(true) -} - -func (m *WatchedDirectory) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetPath()) < 1 { - err := WatchedDirectoryValidationError{ - field: "Path", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return WatchedDirectoryMultiError(errors) - } - - return nil -} - -// WatchedDirectoryMultiError is an error wrapping multiple validation errors -// returned by WatchedDirectory.ValidateAll() if the designated constraints -// aren't met. -type WatchedDirectoryMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m WatchedDirectoryMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m WatchedDirectoryMultiError) AllErrors() []error { return m } - -// WatchedDirectoryValidationError is the validation error returned by -// WatchedDirectory.Validate if the designated constraints aren't met. -type WatchedDirectoryValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e WatchedDirectoryValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e WatchedDirectoryValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e WatchedDirectoryValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e WatchedDirectoryValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e WatchedDirectoryValidationError) ErrorName() string { return "WatchedDirectoryValidationError" } - -// Error satisfies the builtin error interface -func (e WatchedDirectoryValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sWatchedDirectory.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = WatchedDirectoryValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = WatchedDirectoryValidationError{} - -// Validate checks the field values on DataSource with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *DataSource) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DataSource with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in DataSourceMultiError, or -// nil if none found. -func (m *DataSource) ValidateAll() error { - return m.validate(true) -} - -func (m *DataSource) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofSpecifierPresent := false - switch v := m.Specifier.(type) { - case *DataSource_Filename: - if v == nil { - err := DataSourceValidationError{ - field: "Specifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofSpecifierPresent = true - - if utf8.RuneCountInString(m.GetFilename()) < 1 { - err := DataSourceValidationError{ - field: "Filename", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - case *DataSource_InlineBytes: - if v == nil { - err := DataSourceValidationError{ - field: "Specifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofSpecifierPresent = true - // no validation rules for InlineBytes - case *DataSource_InlineString: - if v == nil { - err := DataSourceValidationError{ - field: "Specifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofSpecifierPresent = true - // no validation rules for InlineString - case *DataSource_EnvironmentVariable: - if v == nil { - err := DataSourceValidationError{ - field: "Specifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofSpecifierPresent = true - - if utf8.RuneCountInString(m.GetEnvironmentVariable()) < 1 { - err := DataSourceValidationError{ - field: "EnvironmentVariable", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - default: - _ = v // ensures v is used - } - if !oneofSpecifierPresent { - err := DataSourceValidationError{ - field: "Specifier", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return DataSourceMultiError(errors) - } - - return nil -} - -// DataSourceMultiError is an error wrapping multiple validation errors -// returned by DataSource.ValidateAll() if the designated constraints aren't met. -type DataSourceMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DataSourceMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DataSourceMultiError) AllErrors() []error { return m } - -// DataSourceValidationError is the validation error returned by -// DataSource.Validate if the designated constraints aren't met. -type DataSourceValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DataSourceValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DataSourceValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DataSourceValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DataSourceValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DataSourceValidationError) ErrorName() string { return "DataSourceValidationError" } - -// Error satisfies the builtin error interface -func (e DataSourceValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDataSource.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DataSourceValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DataSourceValidationError{} - -// Validate checks the field values on RetryPolicy with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *RetryPolicy) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RetryPolicy with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in RetryPolicyMultiError, or -// nil if none found. -func (m *RetryPolicy) ValidateAll() error { - return m.validate(true) -} - -func (m *RetryPolicy) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetRetryBackOff()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RetryPolicyValidationError{ - field: "RetryBackOff", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RetryPolicyValidationError{ - field: "RetryBackOff", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRetryBackOff()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RetryPolicyValidationError{ - field: "RetryBackOff", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetNumRetries()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RetryPolicyValidationError{ - field: "NumRetries", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RetryPolicyValidationError{ - field: "NumRetries", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetNumRetries()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RetryPolicyValidationError{ - field: "NumRetries", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return RetryPolicyMultiError(errors) - } - - return nil -} - -// RetryPolicyMultiError is an error wrapping multiple validation errors -// returned by RetryPolicy.ValidateAll() if the designated constraints aren't met. -type RetryPolicyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RetryPolicyMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RetryPolicyMultiError) AllErrors() []error { return m } - -// RetryPolicyValidationError is the validation error returned by -// RetryPolicy.Validate if the designated constraints aren't met. -type RetryPolicyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RetryPolicyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RetryPolicyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RetryPolicyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RetryPolicyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RetryPolicyValidationError) ErrorName() string { return "RetryPolicyValidationError" } - -// Error satisfies the builtin error interface -func (e RetryPolicyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRetryPolicy.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RetryPolicyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RetryPolicyValidationError{} - -// Validate checks the field values on RemoteDataSource with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *RemoteDataSource) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RemoteDataSource with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RemoteDataSourceMultiError, or nil if none found. -func (m *RemoteDataSource) ValidateAll() error { - return m.validate(true) -} - -func (m *RemoteDataSource) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetHttpUri() == nil { - err := RemoteDataSourceValidationError{ - field: "HttpUri", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetHttpUri()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RemoteDataSourceValidationError{ - field: "HttpUri", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RemoteDataSourceValidationError{ - field: "HttpUri", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHttpUri()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RemoteDataSourceValidationError{ - field: "HttpUri", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if utf8.RuneCountInString(m.GetSha256()) < 1 { - err := RemoteDataSourceValidationError{ - field: "Sha256", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetRetryPolicy()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RemoteDataSourceValidationError{ - field: "RetryPolicy", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RemoteDataSourceValidationError{ - field: "RetryPolicy", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRetryPolicy()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RemoteDataSourceValidationError{ - field: "RetryPolicy", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return RemoteDataSourceMultiError(errors) - } - - return nil -} - -// RemoteDataSourceMultiError is an error wrapping multiple validation errors -// returned by RemoteDataSource.ValidateAll() if the designated constraints -// aren't met. -type RemoteDataSourceMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RemoteDataSourceMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RemoteDataSourceMultiError) AllErrors() []error { return m } - -// RemoteDataSourceValidationError is the validation error returned by -// RemoteDataSource.Validate if the designated constraints aren't met. -type RemoteDataSourceValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RemoteDataSourceValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RemoteDataSourceValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RemoteDataSourceValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RemoteDataSourceValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RemoteDataSourceValidationError) ErrorName() string { return "RemoteDataSourceValidationError" } - -// Error satisfies the builtin error interface -func (e RemoteDataSourceValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRemoteDataSource.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RemoteDataSourceValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RemoteDataSourceValidationError{} - -// Validate checks the field values on AsyncDataSource with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *AsyncDataSource) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on AsyncDataSource with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// AsyncDataSourceMultiError, or nil if none found. -func (m *AsyncDataSource) ValidateAll() error { - return m.validate(true) -} - -func (m *AsyncDataSource) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofSpecifierPresent := false - switch v := m.Specifier.(type) { - case *AsyncDataSource_Local: - if v == nil { - err := AsyncDataSourceValidationError{ - field: "Specifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofSpecifierPresent = true - - if all { - switch v := interface{}(m.GetLocal()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, AsyncDataSourceValidationError{ - field: "Local", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, AsyncDataSourceValidationError{ - field: "Local", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetLocal()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return AsyncDataSourceValidationError{ - field: "Local", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *AsyncDataSource_Remote: - if v == nil { - err := AsyncDataSourceValidationError{ - field: "Specifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofSpecifierPresent = true - - if all { - switch v := interface{}(m.GetRemote()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, AsyncDataSourceValidationError{ - field: "Remote", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, AsyncDataSourceValidationError{ - field: "Remote", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRemote()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return AsyncDataSourceValidationError{ - field: "Remote", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofSpecifierPresent { - err := AsyncDataSourceValidationError{ - field: "Specifier", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return AsyncDataSourceMultiError(errors) - } - - return nil -} - -// AsyncDataSourceMultiError is an error wrapping multiple validation errors -// returned by AsyncDataSource.ValidateAll() if the designated constraints -// aren't met. -type AsyncDataSourceMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AsyncDataSourceMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AsyncDataSourceMultiError) AllErrors() []error { return m } - -// AsyncDataSourceValidationError is the validation error returned by -// AsyncDataSource.Validate if the designated constraints aren't met. -type AsyncDataSourceValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AsyncDataSourceValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AsyncDataSourceValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AsyncDataSourceValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AsyncDataSourceValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AsyncDataSourceValidationError) ErrorName() string { return "AsyncDataSourceValidationError" } - -// Error satisfies the builtin error interface -func (e AsyncDataSourceValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAsyncDataSource.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AsyncDataSourceValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AsyncDataSourceValidationError{} - -// Validate checks the field values on TransportSocket with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *TransportSocket) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on TransportSocket with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// TransportSocketMultiError, or nil if none found. -func (m *TransportSocket) ValidateAll() error { - return m.validate(true) -} - -func (m *TransportSocket) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := TransportSocketValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - switch v := m.ConfigType.(type) { - case *TransportSocket_TypedConfig: - if v == nil { - err := TransportSocketValidationError{ - field: "ConfigType", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetTypedConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, TransportSocketValidationError{ - field: "TypedConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, TransportSocketValidationError{ - field: "TypedConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return TransportSocketValidationError{ - field: "TypedConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return TransportSocketMultiError(errors) - } - - return nil -} - -// TransportSocketMultiError is an error wrapping multiple validation errors -// returned by TransportSocket.ValidateAll() if the designated constraints -// aren't met. -type TransportSocketMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m TransportSocketMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m TransportSocketMultiError) AllErrors() []error { return m } - -// TransportSocketValidationError is the validation error returned by -// TransportSocket.Validate if the designated constraints aren't met. -type TransportSocketValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TransportSocketValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TransportSocketValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TransportSocketValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TransportSocketValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TransportSocketValidationError) ErrorName() string { return "TransportSocketValidationError" } - -// Error satisfies the builtin error interface -func (e TransportSocketValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTransportSocket.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TransportSocketValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TransportSocketValidationError{} - -// Validate checks the field values on RuntimeFractionalPercent with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RuntimeFractionalPercent) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RuntimeFractionalPercent with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RuntimeFractionalPercentMultiError, or nil if none found. -func (m *RuntimeFractionalPercent) ValidateAll() error { - return m.validate(true) -} - -func (m *RuntimeFractionalPercent) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetDefaultValue() == nil { - err := RuntimeFractionalPercentValidationError{ - field: "DefaultValue", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetDefaultValue()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RuntimeFractionalPercentValidationError{ - field: "DefaultValue", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RuntimeFractionalPercentValidationError{ - field: "DefaultValue", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDefaultValue()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RuntimeFractionalPercentValidationError{ - field: "DefaultValue", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for RuntimeKey - - if len(errors) > 0 { - return RuntimeFractionalPercentMultiError(errors) - } - - return nil -} - -// RuntimeFractionalPercentMultiError is an error wrapping multiple validation -// errors returned by RuntimeFractionalPercent.ValidateAll() if the designated -// constraints aren't met. -type RuntimeFractionalPercentMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RuntimeFractionalPercentMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RuntimeFractionalPercentMultiError) AllErrors() []error { return m } - -// RuntimeFractionalPercentValidationError is the validation error returned by -// RuntimeFractionalPercent.Validate if the designated constraints aren't met. -type RuntimeFractionalPercentValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RuntimeFractionalPercentValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RuntimeFractionalPercentValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RuntimeFractionalPercentValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RuntimeFractionalPercentValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RuntimeFractionalPercentValidationError) ErrorName() string { - return "RuntimeFractionalPercentValidationError" -} - -// Error satisfies the builtin error interface -func (e RuntimeFractionalPercentValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRuntimeFractionalPercent.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RuntimeFractionalPercentValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RuntimeFractionalPercentValidationError{} - -// Validate checks the field values on ControlPlane with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *ControlPlane) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ControlPlane with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in ControlPlaneMultiError, or -// nil if none found. -func (m *ControlPlane) ValidateAll() error { - return m.validate(true) -} - -func (m *ControlPlane) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Identifier - - if len(errors) > 0 { - return ControlPlaneMultiError(errors) - } - - return nil -} - -// ControlPlaneMultiError is an error wrapping multiple validation errors -// returned by ControlPlane.ValidateAll() if the designated constraints aren't met. -type ControlPlaneMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ControlPlaneMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ControlPlaneMultiError) AllErrors() []error { return m } - -// ControlPlaneValidationError is the validation error returned by -// ControlPlane.Validate if the designated constraints aren't met. -type ControlPlaneValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ControlPlaneValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ControlPlaneValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ControlPlaneValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ControlPlaneValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ControlPlaneValidationError) ErrorName() string { return "ControlPlaneValidationError" } - -// Error satisfies the builtin error interface -func (e ControlPlaneValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sControlPlane.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ControlPlaneValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ControlPlaneValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/config_source.pb.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/config_source.pb.go deleted file mode 100644 index a489177ca..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/config_source.pb.go +++ /dev/null @@ -1,1204 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/config/core/v3/config_source.proto - -package corev3 - -import ( - _ "github.com/cilium/proxy/go/envoy/annotations" - _ "github.com/cncf/xds/go/udpa/annotations" - v3 "github.com/cncf/xds/go/xds/core/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - durationpb "google.golang.org/protobuf/types/known/durationpb" - wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// xDS API and non-xDS services version. This is used to describe both resource and transport -// protocol versions (in distinct configuration fields). -type ApiVersion int32 - -const ( - // When not specified, we assume v2, to ease migration to Envoy's stable API - // versioning. If a client does not support v2 (e.g. due to deprecation), this - // is an invalid value. - // - // Deprecated: Do not use. - ApiVersion_AUTO ApiVersion = 0 - // Use xDS v2 API. - // - // Deprecated: Do not use. - ApiVersion_V2 ApiVersion = 1 - // Use xDS v3 API. - ApiVersion_V3 ApiVersion = 2 -) - -// Enum value maps for ApiVersion. -var ( - ApiVersion_name = map[int32]string{ - 0: "AUTO", - 1: "V2", - 2: "V3", - } - ApiVersion_value = map[string]int32{ - "AUTO": 0, - "V2": 1, - "V3": 2, - } -) - -func (x ApiVersion) Enum() *ApiVersion { - p := new(ApiVersion) - *p = x - return p -} - -func (x ApiVersion) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ApiVersion) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_config_core_v3_config_source_proto_enumTypes[0].Descriptor() -} - -func (ApiVersion) Type() protoreflect.EnumType { - return &file_envoy_config_core_v3_config_source_proto_enumTypes[0] -} - -func (x ApiVersion) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ApiVersion.Descriptor instead. -func (ApiVersion) EnumDescriptor() ([]byte, []int) { - return file_envoy_config_core_v3_config_source_proto_rawDescGZIP(), []int{0} -} - -// APIs may be fetched via either REST or gRPC. -type ApiConfigSource_ApiType int32 - -const ( - // Ideally this would be 'reserved 0' but one can't reserve the default - // value. Instead we throw an exception if this is ever used. - // - // Deprecated: Do not use. - ApiConfigSource_DEPRECATED_AND_UNAVAILABLE_DO_NOT_USE ApiConfigSource_ApiType = 0 - // REST-JSON v2 API. The `canonical JSON encoding - // `_ for - // the v2 protos is used. - ApiConfigSource_REST ApiConfigSource_ApiType = 1 - // SotW gRPC service. - ApiConfigSource_GRPC ApiConfigSource_ApiType = 2 - // Using the delta xDS gRPC service, i.e. DeltaDiscovery{Request,Response} - // rather than Discovery{Request,Response}. Rather than sending Envoy the entire state - // with every update, the xDS server only sends what has changed since the last update. - ApiConfigSource_DELTA_GRPC ApiConfigSource_ApiType = 3 - // SotW xDS gRPC with ADS. All resources which resolve to this configuration source will be - // multiplexed on a single connection to an ADS endpoint. - // [#not-implemented-hide:] - ApiConfigSource_AGGREGATED_GRPC ApiConfigSource_ApiType = 5 - // Delta xDS gRPC with ADS. All resources which resolve to this configuration source will be - // multiplexed on a single connection to an ADS endpoint. - // [#not-implemented-hide:] - ApiConfigSource_AGGREGATED_DELTA_GRPC ApiConfigSource_ApiType = 6 -) - -// Enum value maps for ApiConfigSource_ApiType. -var ( - ApiConfigSource_ApiType_name = map[int32]string{ - 0: "DEPRECATED_AND_UNAVAILABLE_DO_NOT_USE", - 1: "REST", - 2: "GRPC", - 3: "DELTA_GRPC", - 5: "AGGREGATED_GRPC", - 6: "AGGREGATED_DELTA_GRPC", - } - ApiConfigSource_ApiType_value = map[string]int32{ - "DEPRECATED_AND_UNAVAILABLE_DO_NOT_USE": 0, - "REST": 1, - "GRPC": 2, - "DELTA_GRPC": 3, - "AGGREGATED_GRPC": 5, - "AGGREGATED_DELTA_GRPC": 6, - } -) - -func (x ApiConfigSource_ApiType) Enum() *ApiConfigSource_ApiType { - p := new(ApiConfigSource_ApiType) - *p = x - return p -} - -func (x ApiConfigSource_ApiType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ApiConfigSource_ApiType) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_config_core_v3_config_source_proto_enumTypes[1].Descriptor() -} - -func (ApiConfigSource_ApiType) Type() protoreflect.EnumType { - return &file_envoy_config_core_v3_config_source_proto_enumTypes[1] -} - -func (x ApiConfigSource_ApiType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ApiConfigSource_ApiType.Descriptor instead. -func (ApiConfigSource_ApiType) EnumDescriptor() ([]byte, []int) { - return file_envoy_config_core_v3_config_source_proto_rawDescGZIP(), []int{0, 0} -} - -// API configuration source. This identifies the API type and cluster that Envoy -// will use to fetch an xDS API. -// [#next-free-field: 10] -type ApiConfigSource struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // API type (gRPC, REST, delta gRPC) - ApiType ApiConfigSource_ApiType `protobuf:"varint,1,opt,name=api_type,json=apiType,proto3,enum=envoy.config.core.v3.ApiConfigSource_ApiType" json:"api_type,omitempty"` - // API version for xDS transport protocol. This describes the xDS gRPC/REST - // endpoint and version of [Delta]DiscoveryRequest/Response used on the wire. - TransportApiVersion ApiVersion `protobuf:"varint,8,opt,name=transport_api_version,json=transportApiVersion,proto3,enum=envoy.config.core.v3.ApiVersion" json:"transport_api_version,omitempty"` - // Cluster names should be used only with REST. If > 1 - // cluster is defined, clusters will be cycled through if any kind of failure - // occurs. - // - // .. note:: - // - // The cluster with name ``cluster_name`` must be statically defined and its - // type must not be ``EDS``. - ClusterNames []string `protobuf:"bytes,2,rep,name=cluster_names,json=clusterNames,proto3" json:"cluster_names,omitempty"` - // Multiple gRPC services be provided for GRPC. If > 1 cluster is defined, - // services will be cycled through if any kind of failure occurs. - GrpcServices []*GrpcService `protobuf:"bytes,4,rep,name=grpc_services,json=grpcServices,proto3" json:"grpc_services,omitempty"` - // For REST APIs, the delay between successive polls. - RefreshDelay *durationpb.Duration `protobuf:"bytes,3,opt,name=refresh_delay,json=refreshDelay,proto3" json:"refresh_delay,omitempty"` - // For REST APIs, the request timeout. If not set, a default value of 1s will be used. - RequestTimeout *durationpb.Duration `protobuf:"bytes,5,opt,name=request_timeout,json=requestTimeout,proto3" json:"request_timeout,omitempty"` - // For GRPC APIs, the rate limit settings. If present, discovery requests made by Envoy will be - // rate limited. - RateLimitSettings *RateLimitSettings `protobuf:"bytes,6,opt,name=rate_limit_settings,json=rateLimitSettings,proto3" json:"rate_limit_settings,omitempty"` - // Skip the node identifier in subsequent discovery requests for streaming gRPC config types. - SetNodeOnFirstMessageOnly bool `protobuf:"varint,7,opt,name=set_node_on_first_message_only,json=setNodeOnFirstMessageOnly,proto3" json:"set_node_on_first_message_only,omitempty"` - // A list of config validators that will be executed when a new update is - // received from the ApiConfigSource. Note that each validator handles a - // specific xDS service type, and only the validators corresponding to the - // type url (in “:ref: DiscoveryResponse“ or “:ref: DeltaDiscoveryResponse“) - // will be invoked. - // If the validator returns false or throws an exception, the config will be rejected by - // the client, and a NACK will be sent. - // [#extension-category: envoy.config.validators] - ConfigValidators []*TypedExtensionConfig `protobuf:"bytes,9,rep,name=config_validators,json=configValidators,proto3" json:"config_validators,omitempty"` -} - -func (x *ApiConfigSource) Reset() { - *x = ApiConfigSource{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_config_source_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ApiConfigSource) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ApiConfigSource) ProtoMessage() {} - -func (x *ApiConfigSource) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_config_source_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ApiConfigSource.ProtoReflect.Descriptor instead. -func (*ApiConfigSource) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_config_source_proto_rawDescGZIP(), []int{0} -} - -func (x *ApiConfigSource) GetApiType() ApiConfigSource_ApiType { - if x != nil { - return x.ApiType - } - return ApiConfigSource_DEPRECATED_AND_UNAVAILABLE_DO_NOT_USE -} - -func (x *ApiConfigSource) GetTransportApiVersion() ApiVersion { - if x != nil { - return x.TransportApiVersion - } - return ApiVersion_AUTO -} - -func (x *ApiConfigSource) GetClusterNames() []string { - if x != nil { - return x.ClusterNames - } - return nil -} - -func (x *ApiConfigSource) GetGrpcServices() []*GrpcService { - if x != nil { - return x.GrpcServices - } - return nil -} - -func (x *ApiConfigSource) GetRefreshDelay() *durationpb.Duration { - if x != nil { - return x.RefreshDelay - } - return nil -} - -func (x *ApiConfigSource) GetRequestTimeout() *durationpb.Duration { - if x != nil { - return x.RequestTimeout - } - return nil -} - -func (x *ApiConfigSource) GetRateLimitSettings() *RateLimitSettings { - if x != nil { - return x.RateLimitSettings - } - return nil -} - -func (x *ApiConfigSource) GetSetNodeOnFirstMessageOnly() bool { - if x != nil { - return x.SetNodeOnFirstMessageOnly - } - return false -} - -func (x *ApiConfigSource) GetConfigValidators() []*TypedExtensionConfig { - if x != nil { - return x.ConfigValidators - } - return nil -} - -// Aggregated Discovery Service (ADS) options. This is currently empty, but when -// set in :ref:`ConfigSource ` can be used to -// specify that ADS is to be used. -type AggregatedConfigSource struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *AggregatedConfigSource) Reset() { - *x = AggregatedConfigSource{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_config_source_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AggregatedConfigSource) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AggregatedConfigSource) ProtoMessage() {} - -func (x *AggregatedConfigSource) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_config_source_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AggregatedConfigSource.ProtoReflect.Descriptor instead. -func (*AggregatedConfigSource) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_config_source_proto_rawDescGZIP(), []int{1} -} - -// [#not-implemented-hide:] -// Self-referencing config source options. This is currently empty, but when -// set in :ref:`ConfigSource ` can be used to -// specify that other data can be obtained from the same server. -type SelfConfigSource struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // API version for xDS transport protocol. This describes the xDS gRPC/REST - // endpoint and version of [Delta]DiscoveryRequest/Response used on the wire. - TransportApiVersion ApiVersion `protobuf:"varint,1,opt,name=transport_api_version,json=transportApiVersion,proto3,enum=envoy.config.core.v3.ApiVersion" json:"transport_api_version,omitempty"` -} - -func (x *SelfConfigSource) Reset() { - *x = SelfConfigSource{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_config_source_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SelfConfigSource) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SelfConfigSource) ProtoMessage() {} - -func (x *SelfConfigSource) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_config_source_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SelfConfigSource.ProtoReflect.Descriptor instead. -func (*SelfConfigSource) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_config_source_proto_rawDescGZIP(), []int{2} -} - -func (x *SelfConfigSource) GetTransportApiVersion() ApiVersion { - if x != nil { - return x.TransportApiVersion - } - return ApiVersion_AUTO -} - -// Rate Limit settings to be applied for discovery requests made by Envoy. -type RateLimitSettings struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Maximum number of tokens to be used for rate limiting discovery request calls. If not set, a - // default value of 100 will be used. - MaxTokens *wrapperspb.UInt32Value `protobuf:"bytes,1,opt,name=max_tokens,json=maxTokens,proto3" json:"max_tokens,omitempty"` - // Rate at which tokens will be filled per second. If not set, a default fill rate of 10 tokens - // per second will be used. The minimal fill rate is once per year. Lower - // fill rates will be set to once per year. - FillRate *wrapperspb.DoubleValue `protobuf:"bytes,2,opt,name=fill_rate,json=fillRate,proto3" json:"fill_rate,omitempty"` -} - -func (x *RateLimitSettings) Reset() { - *x = RateLimitSettings{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_config_source_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RateLimitSettings) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RateLimitSettings) ProtoMessage() {} - -func (x *RateLimitSettings) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_config_source_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RateLimitSettings.ProtoReflect.Descriptor instead. -func (*RateLimitSettings) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_config_source_proto_rawDescGZIP(), []int{3} -} - -func (x *RateLimitSettings) GetMaxTokens() *wrapperspb.UInt32Value { - if x != nil { - return x.MaxTokens - } - return nil -} - -func (x *RateLimitSettings) GetFillRate() *wrapperspb.DoubleValue { - if x != nil { - return x.FillRate - } - return nil -} - -// Local filesystem path configuration source. -type PathConfigSource struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Path on the filesystem to source and watch for configuration updates. - // When sourcing configuration for a :ref:`secret `, - // the certificate and key files are also watched for updates. - // - // .. note:: - // - // The path to the source must exist at config load time. - // - // .. note:: - // - // If ``watched_directory`` is *not* configured, Envoy will watch the file path for *moves*. - // This is because in general only moves are atomic. The same method of swapping files as is - // demonstrated in the :ref:`runtime documentation ` can be - // used here also. If ``watched_directory`` is configured, no watch will be placed directly on - // this path. Instead, the configured ``watched_directory`` will be used to trigger reloads of - // this path. This is required in certain deployment scenarios. See below for more information. - Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` - // If configured, this directory will be watched for *moves*. When an entry in this directory is - // moved to, the “path“ will be reloaded. This is required in certain deployment scenarios. - // - // Specifically, if trying to load an xDS resource using a - // `Kubernetes ConfigMap `_, the - // following configuration might be used: - // 1. Store xds.yaml inside a ConfigMap. - // 2. Mount the ConfigMap to “/config_map/xds“ - // 3. Configure path “/config_map/xds/xds.yaml“ - // 4. Configure watched directory “/config_map/xds“ - // - // The above configuration will ensure that Envoy watches the owning directory for moves which is - // required due to how Kubernetes manages ConfigMap symbolic links during atomic updates. - WatchedDirectory *WatchedDirectory `protobuf:"bytes,2,opt,name=watched_directory,json=watchedDirectory,proto3" json:"watched_directory,omitempty"` -} - -func (x *PathConfigSource) Reset() { - *x = PathConfigSource{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_config_source_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PathConfigSource) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PathConfigSource) ProtoMessage() {} - -func (x *PathConfigSource) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_config_source_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PathConfigSource.ProtoReflect.Descriptor instead. -func (*PathConfigSource) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_config_source_proto_rawDescGZIP(), []int{4} -} - -func (x *PathConfigSource) GetPath() string { - if x != nil { - return x.Path - } - return "" -} - -func (x *PathConfigSource) GetWatchedDirectory() *WatchedDirectory { - if x != nil { - return x.WatchedDirectory - } - return nil -} - -// Configuration for :ref:`listeners `, :ref:`clusters -// `, :ref:`routes -// `, :ref:`endpoints -// ` etc. may either be sourced from the -// filesystem or from an xDS API source. Filesystem configs are watched with -// inotify for updates. -// [#next-free-field: 9] -type ConfigSource struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Authorities that this config source may be used for. An authority specified in a xdstp:// URL - // is resolved to a “ConfigSource“ prior to configuration fetch. This field provides the - // association between authority name and configuration source. - // [#not-implemented-hide:] - Authorities []*v3.Authority `protobuf:"bytes,7,rep,name=authorities,proto3" json:"authorities,omitempty"` - // Types that are assignable to ConfigSourceSpecifier: - // - // *ConfigSource_Path - // *ConfigSource_PathConfigSource - // *ConfigSource_ApiConfigSource - // *ConfigSource_Ads - // *ConfigSource_Self - ConfigSourceSpecifier isConfigSource_ConfigSourceSpecifier `protobuf_oneof:"config_source_specifier"` - // When this timeout is specified, Envoy will wait no longer than the specified time for first - // config response on this xDS subscription during the :ref:`initialization process - // `. After reaching the timeout, Envoy will move to the next - // initialization phase, even if the first config is not delivered yet. The timer is activated - // when the xDS API subscription starts, and is disarmed on first config update or on error. 0 - // means no timeout - Envoy will wait indefinitely for the first xDS config (unless another - // timeout applies). The default is 15s. - InitialFetchTimeout *durationpb.Duration `protobuf:"bytes,4,opt,name=initial_fetch_timeout,json=initialFetchTimeout,proto3" json:"initial_fetch_timeout,omitempty"` - // API version for xDS resources. This implies the type URLs that the client - // will request for resources and the resource type that the client will in - // turn expect to be delivered. - ResourceApiVersion ApiVersion `protobuf:"varint,6,opt,name=resource_api_version,json=resourceApiVersion,proto3,enum=envoy.config.core.v3.ApiVersion" json:"resource_api_version,omitempty"` -} - -func (x *ConfigSource) Reset() { - *x = ConfigSource{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_config_source_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ConfigSource) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ConfigSource) ProtoMessage() {} - -func (x *ConfigSource) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_config_source_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ConfigSource.ProtoReflect.Descriptor instead. -func (*ConfigSource) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_config_source_proto_rawDescGZIP(), []int{5} -} - -func (x *ConfigSource) GetAuthorities() []*v3.Authority { - if x != nil { - return x.Authorities - } - return nil -} - -func (m *ConfigSource) GetConfigSourceSpecifier() isConfigSource_ConfigSourceSpecifier { - if m != nil { - return m.ConfigSourceSpecifier - } - return nil -} - -// Deprecated: Do not use. -func (x *ConfigSource) GetPath() string { - if x, ok := x.GetConfigSourceSpecifier().(*ConfigSource_Path); ok { - return x.Path - } - return "" -} - -func (x *ConfigSource) GetPathConfigSource() *PathConfigSource { - if x, ok := x.GetConfigSourceSpecifier().(*ConfigSource_PathConfigSource); ok { - return x.PathConfigSource - } - return nil -} - -func (x *ConfigSource) GetApiConfigSource() *ApiConfigSource { - if x, ok := x.GetConfigSourceSpecifier().(*ConfigSource_ApiConfigSource); ok { - return x.ApiConfigSource - } - return nil -} - -func (x *ConfigSource) GetAds() *AggregatedConfigSource { - if x, ok := x.GetConfigSourceSpecifier().(*ConfigSource_Ads); ok { - return x.Ads - } - return nil -} - -func (x *ConfigSource) GetSelf() *SelfConfigSource { - if x, ok := x.GetConfigSourceSpecifier().(*ConfigSource_Self); ok { - return x.Self - } - return nil -} - -func (x *ConfigSource) GetInitialFetchTimeout() *durationpb.Duration { - if x != nil { - return x.InitialFetchTimeout - } - return nil -} - -func (x *ConfigSource) GetResourceApiVersion() ApiVersion { - if x != nil { - return x.ResourceApiVersion - } - return ApiVersion_AUTO -} - -type isConfigSource_ConfigSourceSpecifier interface { - isConfigSource_ConfigSourceSpecifier() -} - -type ConfigSource_Path struct { - // Deprecated in favor of “path_config_source“. Use that field instead. - // - // Deprecated: Do not use. - Path string `protobuf:"bytes,1,opt,name=path,proto3,oneof"` -} - -type ConfigSource_PathConfigSource struct { - // Local filesystem path configuration source. - PathConfigSource *PathConfigSource `protobuf:"bytes,8,opt,name=path_config_source,json=pathConfigSource,proto3,oneof"` -} - -type ConfigSource_ApiConfigSource struct { - // API configuration source. - ApiConfigSource *ApiConfigSource `protobuf:"bytes,2,opt,name=api_config_source,json=apiConfigSource,proto3,oneof"` -} - -type ConfigSource_Ads struct { - // When set, ADS will be used to fetch resources. The ADS API configuration - // source in the bootstrap configuration is used. - Ads *AggregatedConfigSource `protobuf:"bytes,3,opt,name=ads,proto3,oneof"` -} - -type ConfigSource_Self struct { - // [#not-implemented-hide:] - // When set, the client will access the resources from the same server it got the - // ConfigSource from, although not necessarily from the same stream. This is similar to the - // :ref:`ads` field, except that the client may use a - // different stream to the same server. As a result, this field can be used for things - // like LRS that cannot be sent on an ADS stream. It can also be used to link from (e.g.) - // LDS to RDS on the same server without requiring the management server to know its name - // or required credentials. - // [#next-major-version: In xDS v3, consider replacing the ads field with this one, since - // this field can implicitly mean to use the same stream in the case where the ConfigSource - // is provided via ADS and the specified data can also be obtained via ADS.] - Self *SelfConfigSource `protobuf:"bytes,5,opt,name=self,proto3,oneof"` -} - -func (*ConfigSource_Path) isConfigSource_ConfigSourceSpecifier() {} - -func (*ConfigSource_PathConfigSource) isConfigSource_ConfigSourceSpecifier() {} - -func (*ConfigSource_ApiConfigSource) isConfigSource_ConfigSourceSpecifier() {} - -func (*ConfigSource_Ads) isConfigSource_ConfigSourceSpecifier() {} - -func (*ConfigSource_Self) isConfigSource_ConfigSourceSpecifier() {} - -// Configuration source specifier for a late-bound extension configuration. The -// parent resource is warmed until all the initial extension configurations are -// received, unless the flag to apply the default configuration is set. -// Subsequent extension updates are atomic on a per-worker basis. Once an -// extension configuration is applied to a request or a connection, it remains -// constant for the duration of processing. If the initial delivery of the -// extension configuration fails, due to a timeout for example, the optional -// default configuration is applied. Without a default configuration, the -// extension is disabled, until an extension configuration is received. The -// behavior of a disabled extension depends on the context. For example, a -// filter chain with a disabled extension filter rejects all incoming streams. -type ExtensionConfigSource struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ConfigSource *ConfigSource `protobuf:"bytes,1,opt,name=config_source,json=configSource,proto3" json:"config_source,omitempty"` - // Optional default configuration to use as the initial configuration if - // there is a failure to receive the initial extension configuration or if - // “apply_default_config_without_warming“ flag is set. - DefaultConfig *anypb.Any `protobuf:"bytes,2,opt,name=default_config,json=defaultConfig,proto3" json:"default_config,omitempty"` - // Use the default config as the initial configuration without warming and - // waiting for the first discovery response. Requires the default configuration - // to be supplied. - ApplyDefaultConfigWithoutWarming bool `protobuf:"varint,3,opt,name=apply_default_config_without_warming,json=applyDefaultConfigWithoutWarming,proto3" json:"apply_default_config_without_warming,omitempty"` - // A set of permitted extension type URLs. Extension configuration updates are rejected - // if they do not match any type URL in the set. - TypeUrls []string `protobuf:"bytes,4,rep,name=type_urls,json=typeUrls,proto3" json:"type_urls,omitempty"` -} - -func (x *ExtensionConfigSource) Reset() { - *x = ExtensionConfigSource{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_config_source_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ExtensionConfigSource) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExtensionConfigSource) ProtoMessage() {} - -func (x *ExtensionConfigSource) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_config_source_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExtensionConfigSource.ProtoReflect.Descriptor instead. -func (*ExtensionConfigSource) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_config_source_proto_rawDescGZIP(), []int{6} -} - -func (x *ExtensionConfigSource) GetConfigSource() *ConfigSource { - if x != nil { - return x.ConfigSource - } - return nil -} - -func (x *ExtensionConfigSource) GetDefaultConfig() *anypb.Any { - if x != nil { - return x.DefaultConfig - } - return nil -} - -func (x *ExtensionConfigSource) GetApplyDefaultConfigWithoutWarming() bool { - if x != nil { - return x.ApplyDefaultConfigWithoutWarming - } - return false -} - -func (x *ExtensionConfigSource) GetTypeUrls() []string { - if x != nil { - return x.TypeUrls - } - return nil -} - -var File_envoy_config_core_v3_config_source_proto protoreflect.FileDescriptor - -var file_envoy_config_core_v3_config_source_proto_rawDesc = []byte{ - 0x0a, 0x28, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, - 0x1a, 0x1f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x24, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, - 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x27, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x67, 0x72, - 0x70, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, - 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x78, 0x64, 0x73, - 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, - 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, - 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x64, 0x65, 0x70, 0x72, - 0x65, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x75, - 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x75, 0x64, - 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf4, 0x06, 0x0a, 0x0f, 0x41, 0x70, 0x69, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x52, 0x0a, 0x08, - 0x61, 0x70, 0x69, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, - 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x70, 0x69, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x41, 0x70, 0x69, 0x54, 0x79, 0x70, 0x65, 0x42, 0x08, 0xfa, - 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x07, 0x61, 0x70, 0x69, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x5e, 0x0a, 0x15, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x61, 0x70, - 0x69, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x20, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, - 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x13, 0x74, 0x72, 0x61, - 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x41, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, - 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x46, 0x0a, 0x0d, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, - 0x2e, 0x76, 0x33, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, - 0x0c, 0x67, 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x3e, 0x0a, - 0x0d, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x5f, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x0c, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x4c, 0x0a, - 0x0f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0xaa, 0x01, 0x02, 0x2a, 0x00, 0x52, 0x0e, 0x72, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x57, 0x0a, 0x13, 0x72, - 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, - 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, - 0x73, 0x52, 0x11, 0x72, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x53, 0x65, 0x74, 0x74, - 0x69, 0x6e, 0x67, 0x73, 0x12, 0x41, 0x0a, 0x1e, 0x73, 0x65, 0x74, 0x5f, 0x6e, 0x6f, 0x64, 0x65, - 0x5f, 0x6f, 0x6e, 0x5f, 0x66, 0x69, 0x72, 0x73, 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x19, 0x73, 0x65, - 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x4f, 0x6e, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x57, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x09, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x45, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x10, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x73, - 0x22, 0x92, 0x01, 0x0a, 0x07, 0x41, 0x70, 0x69, 0x54, 0x79, 0x70, 0x65, 0x12, 0x33, 0x0a, 0x25, - 0x44, 0x45, 0x50, 0x52, 0x45, 0x43, 0x41, 0x54, 0x45, 0x44, 0x5f, 0x41, 0x4e, 0x44, 0x5f, 0x55, - 0x4e, 0x41, 0x56, 0x41, 0x49, 0x4c, 0x41, 0x42, 0x4c, 0x45, 0x5f, 0x44, 0x4f, 0x5f, 0x4e, 0x4f, - 0x54, 0x5f, 0x55, 0x53, 0x45, 0x10, 0x00, 0x1a, 0x08, 0x08, 0x01, 0xa8, 0xf7, 0xb4, 0x8b, 0x02, - 0x01, 0x12, 0x08, 0x0a, 0x04, 0x52, 0x45, 0x53, 0x54, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x47, - 0x52, 0x50, 0x43, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x44, 0x45, 0x4c, 0x54, 0x41, 0x5f, 0x47, - 0x52, 0x50, 0x43, 0x10, 0x03, 0x12, 0x13, 0x0a, 0x0f, 0x41, 0x47, 0x47, 0x52, 0x45, 0x47, 0x41, - 0x54, 0x45, 0x44, 0x5f, 0x47, 0x52, 0x50, 0x43, 0x10, 0x05, 0x12, 0x19, 0x0a, 0x15, 0x41, 0x47, - 0x47, 0x52, 0x45, 0x47, 0x41, 0x54, 0x45, 0x44, 0x5f, 0x44, 0x45, 0x4c, 0x54, 0x41, 0x5f, 0x47, - 0x52, 0x50, 0x43, 0x10, 0x06, 0x3a, 0x28, 0x9a, 0xc5, 0x88, 0x1e, 0x23, 0x0a, 0x21, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, - 0x41, 0x70, 0x69, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, - 0x49, 0x0a, 0x16, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3a, 0x2f, 0x9a, 0xc5, 0x88, 0x1e, 0x2a, - 0x0a, 0x28, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, - 0x6f, 0x72, 0x65, 0x2e, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x9d, 0x01, 0x0a, 0x10, 0x53, - 0x65, 0x6c, 0x66, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, - 0x5e, 0x0a, 0x15, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x61, 0x70, 0x69, - 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, - 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x13, 0x74, 0x72, 0x61, 0x6e, - 0x73, 0x70, 0x6f, 0x72, 0x74, 0x41, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3a, - 0x29, 0x9a, 0xc5, 0x88, 0x1e, 0x24, 0x0a, 0x22, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x6c, 0x66, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0xc7, 0x01, 0x0a, 0x11, 0x52, - 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, - 0x12, 0x3b, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x49, 0x0a, - 0x09, 0x66, 0x69, 0x6c, 0x6c, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x0e, - 0xfa, 0x42, 0x0b, 0x12, 0x09, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x08, - 0x66, 0x69, 0x6c, 0x6c, 0x52, 0x61, 0x74, 0x65, 0x3a, 0x2a, 0x9a, 0xc5, 0x88, 0x1e, 0x25, 0x0a, - 0x23, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x53, 0x65, 0x74, 0x74, - 0x69, 0x6e, 0x67, 0x73, 0x22, 0x84, 0x01, 0x0a, 0x10, 0x50, 0x61, 0x74, 0x68, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x04, 0x70, 0x61, 0x74, - 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, - 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x53, 0x0a, 0x11, 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x64, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x26, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x57, 0x61, 0x74, 0x63, 0x68, 0x65, 0x64, - 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x10, 0x77, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x64, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x22, 0x8c, 0x05, 0x0a, 0x0c, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x38, 0x0a, 0x0b, - 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x16, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, - 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x52, 0x0b, 0x61, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x21, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, 0x18, 0x01, 0x92, 0xc7, 0x86, 0xd8, 0x04, 0x03, 0x33, 0x2e, - 0x30, 0x48, 0x00, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x56, 0x0a, 0x12, 0x70, 0x61, 0x74, - 0x68, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x61, 0x74, - 0x68, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x00, 0x52, - 0x10, 0x70, 0x61, 0x74, 0x68, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x12, 0x53, 0x0a, 0x11, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, - 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x70, 0x69, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x48, 0x00, 0x52, 0x0f, 0x61, 0x70, 0x69, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x40, 0x0a, 0x03, 0x61, 0x64, 0x73, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x67, 0x67, 0x72, 0x65, - 0x67, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x48, 0x00, 0x52, 0x03, 0x61, 0x64, 0x73, 0x12, 0x3c, 0x0a, 0x04, 0x73, 0x65, 0x6c, 0x66, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x65, - 0x6c, 0x66, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x00, - 0x52, 0x04, 0x73, 0x65, 0x6c, 0x66, 0x12, 0x4d, 0x0a, 0x15, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, - 0x6c, 0x5f, 0x66, 0x65, 0x74, 0x63, 0x68, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x13, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x46, 0x65, 0x74, 0x63, 0x68, 0x54, 0x69, - 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x5c, 0x0a, 0x14, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x5f, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x70, 0x69, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, - 0x12, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x3a, 0x25, 0x9a, 0xc5, 0x88, 0x1e, 0x20, 0x0a, 0x1e, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x1e, 0x0a, 0x17, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x73, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0x9e, 0x02, 0x0a, 0x15, 0x45, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x12, 0x51, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, - 0x76, 0x33, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, - 0x08, 0xfa, 0x42, 0x05, 0xa2, 0x01, 0x02, 0x08, 0x01, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x3b, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, - 0x6c, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x12, 0x4e, 0x0a, 0x24, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x5f, 0x64, 0x65, - 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x77, 0x69, 0x74, - 0x68, 0x6f, 0x75, 0x74, 0x5f, 0x77, 0x61, 0x72, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x57, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x57, 0x61, 0x72, - 0x6d, 0x69, 0x6e, 0x67, 0x12, 0x25, 0x0a, 0x09, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x75, 0x72, 0x6c, - 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, - 0x01, 0x52, 0x08, 0x74, 0x79, 0x70, 0x65, 0x55, 0x72, 0x6c, 0x73, 0x2a, 0x40, 0x0a, 0x0a, 0x41, - 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x15, 0x0a, 0x04, 0x41, 0x55, 0x54, - 0x4f, 0x10, 0x00, 0x1a, 0x0b, 0x08, 0x01, 0x8a, 0xf4, 0x9b, 0xb3, 0x05, 0x03, 0x33, 0x2e, 0x30, - 0x12, 0x13, 0x0a, 0x02, 0x56, 0x32, 0x10, 0x01, 0x1a, 0x0b, 0x08, 0x01, 0x8a, 0xf4, 0x9b, 0xb3, - 0x05, 0x03, 0x33, 0x2e, 0x30, 0x12, 0x06, 0x0a, 0x02, 0x56, 0x33, 0x10, 0x02, 0x42, 0x85, 0x01, - 0x0a, 0x22, 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x76, 0x33, 0x42, 0x11, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, - 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, - 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x3b, 0x63, 0x6f, 0x72, 0x65, 0x76, 0x33, 0xba, 0x80, 0xc8, - 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_config_core_v3_config_source_proto_rawDescOnce sync.Once - file_envoy_config_core_v3_config_source_proto_rawDescData = file_envoy_config_core_v3_config_source_proto_rawDesc -) - -func file_envoy_config_core_v3_config_source_proto_rawDescGZIP() []byte { - file_envoy_config_core_v3_config_source_proto_rawDescOnce.Do(func() { - file_envoy_config_core_v3_config_source_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_config_core_v3_config_source_proto_rawDescData) - }) - return file_envoy_config_core_v3_config_source_proto_rawDescData -} - -var file_envoy_config_core_v3_config_source_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_envoy_config_core_v3_config_source_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_envoy_config_core_v3_config_source_proto_goTypes = []interface{}{ - (ApiVersion)(0), // 0: envoy.config.core.v3.ApiVersion - (ApiConfigSource_ApiType)(0), // 1: envoy.config.core.v3.ApiConfigSource.ApiType - (*ApiConfigSource)(nil), // 2: envoy.config.core.v3.ApiConfigSource - (*AggregatedConfigSource)(nil), // 3: envoy.config.core.v3.AggregatedConfigSource - (*SelfConfigSource)(nil), // 4: envoy.config.core.v3.SelfConfigSource - (*RateLimitSettings)(nil), // 5: envoy.config.core.v3.RateLimitSettings - (*PathConfigSource)(nil), // 6: envoy.config.core.v3.PathConfigSource - (*ConfigSource)(nil), // 7: envoy.config.core.v3.ConfigSource - (*ExtensionConfigSource)(nil), // 8: envoy.config.core.v3.ExtensionConfigSource - (*GrpcService)(nil), // 9: envoy.config.core.v3.GrpcService - (*durationpb.Duration)(nil), // 10: google.protobuf.Duration - (*TypedExtensionConfig)(nil), // 11: envoy.config.core.v3.TypedExtensionConfig - (*wrapperspb.UInt32Value)(nil), // 12: google.protobuf.UInt32Value - (*wrapperspb.DoubleValue)(nil), // 13: google.protobuf.DoubleValue - (*WatchedDirectory)(nil), // 14: envoy.config.core.v3.WatchedDirectory - (*v3.Authority)(nil), // 15: xds.core.v3.Authority - (*anypb.Any)(nil), // 16: google.protobuf.Any -} -var file_envoy_config_core_v3_config_source_proto_depIdxs = []int32{ - 1, // 0: envoy.config.core.v3.ApiConfigSource.api_type:type_name -> envoy.config.core.v3.ApiConfigSource.ApiType - 0, // 1: envoy.config.core.v3.ApiConfigSource.transport_api_version:type_name -> envoy.config.core.v3.ApiVersion - 9, // 2: envoy.config.core.v3.ApiConfigSource.grpc_services:type_name -> envoy.config.core.v3.GrpcService - 10, // 3: envoy.config.core.v3.ApiConfigSource.refresh_delay:type_name -> google.protobuf.Duration - 10, // 4: envoy.config.core.v3.ApiConfigSource.request_timeout:type_name -> google.protobuf.Duration - 5, // 5: envoy.config.core.v3.ApiConfigSource.rate_limit_settings:type_name -> envoy.config.core.v3.RateLimitSettings - 11, // 6: envoy.config.core.v3.ApiConfigSource.config_validators:type_name -> envoy.config.core.v3.TypedExtensionConfig - 0, // 7: envoy.config.core.v3.SelfConfigSource.transport_api_version:type_name -> envoy.config.core.v3.ApiVersion - 12, // 8: envoy.config.core.v3.RateLimitSettings.max_tokens:type_name -> google.protobuf.UInt32Value - 13, // 9: envoy.config.core.v3.RateLimitSettings.fill_rate:type_name -> google.protobuf.DoubleValue - 14, // 10: envoy.config.core.v3.PathConfigSource.watched_directory:type_name -> envoy.config.core.v3.WatchedDirectory - 15, // 11: envoy.config.core.v3.ConfigSource.authorities:type_name -> xds.core.v3.Authority - 6, // 12: envoy.config.core.v3.ConfigSource.path_config_source:type_name -> envoy.config.core.v3.PathConfigSource - 2, // 13: envoy.config.core.v3.ConfigSource.api_config_source:type_name -> envoy.config.core.v3.ApiConfigSource - 3, // 14: envoy.config.core.v3.ConfigSource.ads:type_name -> envoy.config.core.v3.AggregatedConfigSource - 4, // 15: envoy.config.core.v3.ConfigSource.self:type_name -> envoy.config.core.v3.SelfConfigSource - 10, // 16: envoy.config.core.v3.ConfigSource.initial_fetch_timeout:type_name -> google.protobuf.Duration - 0, // 17: envoy.config.core.v3.ConfigSource.resource_api_version:type_name -> envoy.config.core.v3.ApiVersion - 7, // 18: envoy.config.core.v3.ExtensionConfigSource.config_source:type_name -> envoy.config.core.v3.ConfigSource - 16, // 19: envoy.config.core.v3.ExtensionConfigSource.default_config:type_name -> google.protobuf.Any - 20, // [20:20] is the sub-list for method output_type - 20, // [20:20] is the sub-list for method input_type - 20, // [20:20] is the sub-list for extension type_name - 20, // [20:20] is the sub-list for extension extendee - 0, // [0:20] is the sub-list for field type_name -} - -func init() { file_envoy_config_core_v3_config_source_proto_init() } -func file_envoy_config_core_v3_config_source_proto_init() { - if File_envoy_config_core_v3_config_source_proto != nil { - return - } - file_envoy_config_core_v3_base_proto_init() - file_envoy_config_core_v3_extension_proto_init() - file_envoy_config_core_v3_grpc_service_proto_init() - if !protoimpl.UnsafeEnabled { - file_envoy_config_core_v3_config_source_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ApiConfigSource); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_config_source_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AggregatedConfigSource); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_config_source_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SelfConfigSource); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_config_source_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RateLimitSettings); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_config_source_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PathConfigSource); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_config_source_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ConfigSource); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_config_source_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExtensionConfigSource); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_config_core_v3_config_source_proto_msgTypes[5].OneofWrappers = []interface{}{ - (*ConfigSource_Path)(nil), - (*ConfigSource_PathConfigSource)(nil), - (*ConfigSource_ApiConfigSource)(nil), - (*ConfigSource_Ads)(nil), - (*ConfigSource_Self)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_config_core_v3_config_source_proto_rawDesc, - NumEnums: 2, - NumMessages: 7, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_config_core_v3_config_source_proto_goTypes, - DependencyIndexes: file_envoy_config_core_v3_config_source_proto_depIdxs, - EnumInfos: file_envoy_config_core_v3_config_source_proto_enumTypes, - MessageInfos: file_envoy_config_core_v3_config_source_proto_msgTypes, - }.Build() - File_envoy_config_core_v3_config_source_proto = out.File - file_envoy_config_core_v3_config_source_proto_rawDesc = nil - file_envoy_config_core_v3_config_source_proto_goTypes = nil - file_envoy_config_core_v3_config_source_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/config_source.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/config_source.pb.validate.go deleted file mode 100644 index edab15135..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/config_source.pb.validate.go +++ /dev/null @@ -1,1344 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/config/core/v3/config_source.proto - -package corev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on ApiConfigSource with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *ApiConfigSource) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ApiConfigSource with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ApiConfigSourceMultiError, or nil if none found. -func (m *ApiConfigSource) ValidateAll() error { - return m.validate(true) -} - -func (m *ApiConfigSource) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if _, ok := ApiConfigSource_ApiType_name[int32(m.GetApiType())]; !ok { - err := ApiConfigSourceValidationError{ - field: "ApiType", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - if _, ok := ApiVersion_name[int32(m.GetTransportApiVersion())]; !ok { - err := ApiConfigSourceValidationError{ - field: "TransportApiVersion", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetGrpcServices() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ApiConfigSourceValidationError{ - field: fmt.Sprintf("GrpcServices[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ApiConfigSourceValidationError{ - field: fmt.Sprintf("GrpcServices[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ApiConfigSourceValidationError{ - field: fmt.Sprintf("GrpcServices[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetRefreshDelay()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ApiConfigSourceValidationError{ - field: "RefreshDelay", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ApiConfigSourceValidationError{ - field: "RefreshDelay", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRefreshDelay()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ApiConfigSourceValidationError{ - field: "RefreshDelay", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if d := m.GetRequestTimeout(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = ApiConfigSourceValidationError{ - field: "RequestTimeout", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - gt := time.Duration(0*time.Second + 0*time.Nanosecond) - - if dur <= gt { - err := ApiConfigSourceValidationError{ - field: "RequestTimeout", - reason: "value must be greater than 0s", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if all { - switch v := interface{}(m.GetRateLimitSettings()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ApiConfigSourceValidationError{ - field: "RateLimitSettings", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ApiConfigSourceValidationError{ - field: "RateLimitSettings", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRateLimitSettings()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ApiConfigSourceValidationError{ - field: "RateLimitSettings", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for SetNodeOnFirstMessageOnly - - for idx, item := range m.GetConfigValidators() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ApiConfigSourceValidationError{ - field: fmt.Sprintf("ConfigValidators[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ApiConfigSourceValidationError{ - field: fmt.Sprintf("ConfigValidators[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ApiConfigSourceValidationError{ - field: fmt.Sprintf("ConfigValidators[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return ApiConfigSourceMultiError(errors) - } - - return nil -} - -// ApiConfigSourceMultiError is an error wrapping multiple validation errors -// returned by ApiConfigSource.ValidateAll() if the designated constraints -// aren't met. -type ApiConfigSourceMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ApiConfigSourceMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ApiConfigSourceMultiError) AllErrors() []error { return m } - -// ApiConfigSourceValidationError is the validation error returned by -// ApiConfigSource.Validate if the designated constraints aren't met. -type ApiConfigSourceValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ApiConfigSourceValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ApiConfigSourceValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ApiConfigSourceValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ApiConfigSourceValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ApiConfigSourceValidationError) ErrorName() string { return "ApiConfigSourceValidationError" } - -// Error satisfies the builtin error interface -func (e ApiConfigSourceValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sApiConfigSource.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ApiConfigSourceValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ApiConfigSourceValidationError{} - -// Validate checks the field values on AggregatedConfigSource with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *AggregatedConfigSource) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on AggregatedConfigSource with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// AggregatedConfigSourceMultiError, or nil if none found. -func (m *AggregatedConfigSource) ValidateAll() error { - return m.validate(true) -} - -func (m *AggregatedConfigSource) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return AggregatedConfigSourceMultiError(errors) - } - - return nil -} - -// AggregatedConfigSourceMultiError is an error wrapping multiple validation -// errors returned by AggregatedConfigSource.ValidateAll() if the designated -// constraints aren't met. -type AggregatedConfigSourceMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AggregatedConfigSourceMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AggregatedConfigSourceMultiError) AllErrors() []error { return m } - -// AggregatedConfigSourceValidationError is the validation error returned by -// AggregatedConfigSource.Validate if the designated constraints aren't met. -type AggregatedConfigSourceValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AggregatedConfigSourceValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AggregatedConfigSourceValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AggregatedConfigSourceValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AggregatedConfigSourceValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AggregatedConfigSourceValidationError) ErrorName() string { - return "AggregatedConfigSourceValidationError" -} - -// Error satisfies the builtin error interface -func (e AggregatedConfigSourceValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAggregatedConfigSource.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AggregatedConfigSourceValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AggregatedConfigSourceValidationError{} - -// Validate checks the field values on SelfConfigSource with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *SelfConfigSource) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SelfConfigSource with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// SelfConfigSourceMultiError, or nil if none found. -func (m *SelfConfigSource) ValidateAll() error { - return m.validate(true) -} - -func (m *SelfConfigSource) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if _, ok := ApiVersion_name[int32(m.GetTransportApiVersion())]; !ok { - err := SelfConfigSourceValidationError{ - field: "TransportApiVersion", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return SelfConfigSourceMultiError(errors) - } - - return nil -} - -// SelfConfigSourceMultiError is an error wrapping multiple validation errors -// returned by SelfConfigSource.ValidateAll() if the designated constraints -// aren't met. -type SelfConfigSourceMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SelfConfigSourceMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m SelfConfigSourceMultiError) AllErrors() []error { return m } - -// SelfConfigSourceValidationError is the validation error returned by -// SelfConfigSource.Validate if the designated constraints aren't met. -type SelfConfigSourceValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SelfConfigSourceValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SelfConfigSourceValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SelfConfigSourceValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SelfConfigSourceValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SelfConfigSourceValidationError) ErrorName() string { return "SelfConfigSourceValidationError" } - -// Error satisfies the builtin error interface -func (e SelfConfigSourceValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSelfConfigSource.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SelfConfigSourceValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SelfConfigSourceValidationError{} - -// Validate checks the field values on RateLimitSettings with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *RateLimitSettings) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RateLimitSettings with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RateLimitSettingsMultiError, or nil if none found. -func (m *RateLimitSettings) ValidateAll() error { - return m.validate(true) -} - -func (m *RateLimitSettings) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetMaxTokens()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RateLimitSettingsValidationError{ - field: "MaxTokens", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RateLimitSettingsValidationError{ - field: "MaxTokens", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMaxTokens()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RateLimitSettingsValidationError{ - field: "MaxTokens", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if wrapper := m.GetFillRate(); wrapper != nil { - - if wrapper.GetValue() <= 0 { - err := RateLimitSettingsValidationError{ - field: "FillRate", - reason: "value must be greater than 0", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if len(errors) > 0 { - return RateLimitSettingsMultiError(errors) - } - - return nil -} - -// RateLimitSettingsMultiError is an error wrapping multiple validation errors -// returned by RateLimitSettings.ValidateAll() if the designated constraints -// aren't met. -type RateLimitSettingsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RateLimitSettingsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RateLimitSettingsMultiError) AllErrors() []error { return m } - -// RateLimitSettingsValidationError is the validation error returned by -// RateLimitSettings.Validate if the designated constraints aren't met. -type RateLimitSettingsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RateLimitSettingsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RateLimitSettingsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RateLimitSettingsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RateLimitSettingsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RateLimitSettingsValidationError) ErrorName() string { - return "RateLimitSettingsValidationError" -} - -// Error satisfies the builtin error interface -func (e RateLimitSettingsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRateLimitSettings.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RateLimitSettingsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RateLimitSettingsValidationError{} - -// Validate checks the field values on PathConfigSource with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *PathConfigSource) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on PathConfigSource with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// PathConfigSourceMultiError, or nil if none found. -func (m *PathConfigSource) ValidateAll() error { - return m.validate(true) -} - -func (m *PathConfigSource) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetPath()) < 1 { - err := PathConfigSourceValidationError{ - field: "Path", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetWatchedDirectory()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PathConfigSourceValidationError{ - field: "WatchedDirectory", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PathConfigSourceValidationError{ - field: "WatchedDirectory", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetWatchedDirectory()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return PathConfigSourceValidationError{ - field: "WatchedDirectory", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return PathConfigSourceMultiError(errors) - } - - return nil -} - -// PathConfigSourceMultiError is an error wrapping multiple validation errors -// returned by PathConfigSource.ValidateAll() if the designated constraints -// aren't met. -type PathConfigSourceMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PathConfigSourceMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m PathConfigSourceMultiError) AllErrors() []error { return m } - -// PathConfigSourceValidationError is the validation error returned by -// PathConfigSource.Validate if the designated constraints aren't met. -type PathConfigSourceValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e PathConfigSourceValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e PathConfigSourceValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e PathConfigSourceValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e PathConfigSourceValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e PathConfigSourceValidationError) ErrorName() string { return "PathConfigSourceValidationError" } - -// Error satisfies the builtin error interface -func (e PathConfigSourceValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sPathConfigSource.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = PathConfigSourceValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = PathConfigSourceValidationError{} - -// Validate checks the field values on ConfigSource with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *ConfigSource) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ConfigSource with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in ConfigSourceMultiError, or -// nil if none found. -func (m *ConfigSource) ValidateAll() error { - return m.validate(true) -} - -func (m *ConfigSource) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetAuthorities() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ConfigSourceValidationError{ - field: fmt.Sprintf("Authorities[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ConfigSourceValidationError{ - field: fmt.Sprintf("Authorities[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ConfigSourceValidationError{ - field: fmt.Sprintf("Authorities[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetInitialFetchTimeout()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ConfigSourceValidationError{ - field: "InitialFetchTimeout", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ConfigSourceValidationError{ - field: "InitialFetchTimeout", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetInitialFetchTimeout()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ConfigSourceValidationError{ - field: "InitialFetchTimeout", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if _, ok := ApiVersion_name[int32(m.GetResourceApiVersion())]; !ok { - err := ConfigSourceValidationError{ - field: "ResourceApiVersion", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - oneofConfigSourceSpecifierPresent := false - switch v := m.ConfigSourceSpecifier.(type) { - case *ConfigSource_Path: - if v == nil { - err := ConfigSourceValidationError{ - field: "ConfigSourceSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofConfigSourceSpecifierPresent = true - // no validation rules for Path - case *ConfigSource_PathConfigSource: - if v == nil { - err := ConfigSourceValidationError{ - field: "ConfigSourceSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofConfigSourceSpecifierPresent = true - - if all { - switch v := interface{}(m.GetPathConfigSource()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ConfigSourceValidationError{ - field: "PathConfigSource", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ConfigSourceValidationError{ - field: "PathConfigSource", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPathConfigSource()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ConfigSourceValidationError{ - field: "PathConfigSource", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ConfigSource_ApiConfigSource: - if v == nil { - err := ConfigSourceValidationError{ - field: "ConfigSourceSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofConfigSourceSpecifierPresent = true - - if all { - switch v := interface{}(m.GetApiConfigSource()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ConfigSourceValidationError{ - field: "ApiConfigSource", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ConfigSourceValidationError{ - field: "ApiConfigSource", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetApiConfigSource()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ConfigSourceValidationError{ - field: "ApiConfigSource", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ConfigSource_Ads: - if v == nil { - err := ConfigSourceValidationError{ - field: "ConfigSourceSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofConfigSourceSpecifierPresent = true - - if all { - switch v := interface{}(m.GetAds()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ConfigSourceValidationError{ - field: "Ads", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ConfigSourceValidationError{ - field: "Ads", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetAds()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ConfigSourceValidationError{ - field: "Ads", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ConfigSource_Self: - if v == nil { - err := ConfigSourceValidationError{ - field: "ConfigSourceSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofConfigSourceSpecifierPresent = true - - if all { - switch v := interface{}(m.GetSelf()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ConfigSourceValidationError{ - field: "Self", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ConfigSourceValidationError{ - field: "Self", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSelf()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ConfigSourceValidationError{ - field: "Self", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofConfigSourceSpecifierPresent { - err := ConfigSourceValidationError{ - field: "ConfigSourceSpecifier", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return ConfigSourceMultiError(errors) - } - - return nil -} - -// ConfigSourceMultiError is an error wrapping multiple validation errors -// returned by ConfigSource.ValidateAll() if the designated constraints aren't met. -type ConfigSourceMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ConfigSourceMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ConfigSourceMultiError) AllErrors() []error { return m } - -// ConfigSourceValidationError is the validation error returned by -// ConfigSource.Validate if the designated constraints aren't met. -type ConfigSourceValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ConfigSourceValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ConfigSourceValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ConfigSourceValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ConfigSourceValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ConfigSourceValidationError) ErrorName() string { return "ConfigSourceValidationError" } - -// Error satisfies the builtin error interface -func (e ConfigSourceValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sConfigSource.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ConfigSourceValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ConfigSourceValidationError{} - -// Validate checks the field values on ExtensionConfigSource with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ExtensionConfigSource) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ExtensionConfigSource with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ExtensionConfigSourceMultiError, or nil if none found. -func (m *ExtensionConfigSource) ValidateAll() error { - return m.validate(true) -} - -func (m *ExtensionConfigSource) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetConfigSource() == nil { - err := ExtensionConfigSourceValidationError{ - field: "ConfigSource", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if a := m.GetConfigSource(); a != nil { - - } - - if all { - switch v := interface{}(m.GetDefaultConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExtensionConfigSourceValidationError{ - field: "DefaultConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExtensionConfigSourceValidationError{ - field: "DefaultConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDefaultConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExtensionConfigSourceValidationError{ - field: "DefaultConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for ApplyDefaultConfigWithoutWarming - - if len(m.GetTypeUrls()) < 1 { - err := ExtensionConfigSourceValidationError{ - field: "TypeUrls", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return ExtensionConfigSourceMultiError(errors) - } - - return nil -} - -// ExtensionConfigSourceMultiError is an error wrapping multiple validation -// errors returned by ExtensionConfigSource.ValidateAll() if the designated -// constraints aren't met. -type ExtensionConfigSourceMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ExtensionConfigSourceMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ExtensionConfigSourceMultiError) AllErrors() []error { return m } - -// ExtensionConfigSourceValidationError is the validation error returned by -// ExtensionConfigSource.Validate if the designated constraints aren't met. -type ExtensionConfigSourceValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ExtensionConfigSourceValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ExtensionConfigSourceValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ExtensionConfigSourceValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ExtensionConfigSourceValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ExtensionConfigSourceValidationError) ErrorName() string { - return "ExtensionConfigSourceValidationError" -} - -// Error satisfies the builtin error interface -func (e ExtensionConfigSourceValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sExtensionConfigSource.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ExtensionConfigSourceValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ExtensionConfigSourceValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/event_service_config.pb.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/event_service_config.pb.go deleted file mode 100644 index 5f3d340e5..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/event_service_config.pb.go +++ /dev/null @@ -1,205 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/config/core/v3/event_service_config.proto - -package corev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// [#not-implemented-hide:] -// Configuration of the event reporting service endpoint. -type EventServiceConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to ConfigSourceSpecifier: - // - // *EventServiceConfig_GrpcService - ConfigSourceSpecifier isEventServiceConfig_ConfigSourceSpecifier `protobuf_oneof:"config_source_specifier"` -} - -func (x *EventServiceConfig) Reset() { - *x = EventServiceConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_event_service_config_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EventServiceConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EventServiceConfig) ProtoMessage() {} - -func (x *EventServiceConfig) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_event_service_config_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EventServiceConfig.ProtoReflect.Descriptor instead. -func (*EventServiceConfig) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_event_service_config_proto_rawDescGZIP(), []int{0} -} - -func (m *EventServiceConfig) GetConfigSourceSpecifier() isEventServiceConfig_ConfigSourceSpecifier { - if m != nil { - return m.ConfigSourceSpecifier - } - return nil -} - -func (x *EventServiceConfig) GetGrpcService() *GrpcService { - if x, ok := x.GetConfigSourceSpecifier().(*EventServiceConfig_GrpcService); ok { - return x.GrpcService - } - return nil -} - -type isEventServiceConfig_ConfigSourceSpecifier interface { - isEventServiceConfig_ConfigSourceSpecifier() -} - -type EventServiceConfig_GrpcService struct { - // Specifies the gRPC service that hosts the event reporting service. - GrpcService *GrpcService `protobuf:"bytes,1,opt,name=grpc_service,json=grpcService,proto3,oneof"` -} - -func (*EventServiceConfig_GrpcService) isEventServiceConfig_ConfigSourceSpecifier() {} - -var File_envoy_config_core_v3_event_service_config_proto protoreflect.FileDescriptor - -var file_envoy_config_core_v3_event_service_config_proto_rawDesc = []byte{ - 0x0a, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x14, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, - 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x1a, 0x27, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x67, 0x72, - 0x70, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x21, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa9, 0x01, 0x0a, 0x12, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x12, 0x46, 0x0a, 0x0c, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, - 0x47, 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x48, 0x00, 0x52, 0x0b, 0x67, - 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x3a, 0x2b, 0x9a, 0xc5, 0x88, 0x1e, - 0x26, 0x0a, 0x24, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x1e, 0x0a, 0x17, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x65, 0x72, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x42, 0x8b, 0x01, 0x0a, 0x22, 0x69, 0x6f, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x42, 0x17, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, - 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, - 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x3b, 0x63, 0x6f, 0x72, 0x65, 0x76, 0x33, 0xba, 0x80, 0xc8, - 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_config_core_v3_event_service_config_proto_rawDescOnce sync.Once - file_envoy_config_core_v3_event_service_config_proto_rawDescData = file_envoy_config_core_v3_event_service_config_proto_rawDesc -) - -func file_envoy_config_core_v3_event_service_config_proto_rawDescGZIP() []byte { - file_envoy_config_core_v3_event_service_config_proto_rawDescOnce.Do(func() { - file_envoy_config_core_v3_event_service_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_config_core_v3_event_service_config_proto_rawDescData) - }) - return file_envoy_config_core_v3_event_service_config_proto_rawDescData -} - -var file_envoy_config_core_v3_event_service_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_config_core_v3_event_service_config_proto_goTypes = []interface{}{ - (*EventServiceConfig)(nil), // 0: envoy.config.core.v3.EventServiceConfig - (*GrpcService)(nil), // 1: envoy.config.core.v3.GrpcService -} -var file_envoy_config_core_v3_event_service_config_proto_depIdxs = []int32{ - 1, // 0: envoy.config.core.v3.EventServiceConfig.grpc_service:type_name -> envoy.config.core.v3.GrpcService - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_envoy_config_core_v3_event_service_config_proto_init() } -func file_envoy_config_core_v3_event_service_config_proto_init() { - if File_envoy_config_core_v3_event_service_config_proto != nil { - return - } - file_envoy_config_core_v3_grpc_service_proto_init() - if !protoimpl.UnsafeEnabled { - file_envoy_config_core_v3_event_service_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EventServiceConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_config_core_v3_event_service_config_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*EventServiceConfig_GrpcService)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_config_core_v3_event_service_config_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_config_core_v3_event_service_config_proto_goTypes, - DependencyIndexes: file_envoy_config_core_v3_event_service_config_proto_depIdxs, - MessageInfos: file_envoy_config_core_v3_event_service_config_proto_msgTypes, - }.Build() - File_envoy_config_core_v3_event_service_config_proto = out.File - file_envoy_config_core_v3_event_service_config_proto_rawDesc = nil - file_envoy_config_core_v3_event_service_config_proto_goTypes = nil - file_envoy_config_core_v3_event_service_config_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/event_service_config.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/event_service_config.pb.validate.go deleted file mode 100644 index a55672c27..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/event_service_config.pb.validate.go +++ /dev/null @@ -1,196 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/config/core/v3/event_service_config.proto - -package corev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on EventServiceConfig with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *EventServiceConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on EventServiceConfig with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// EventServiceConfigMultiError, or nil if none found. -func (m *EventServiceConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *EventServiceConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofConfigSourceSpecifierPresent := false - switch v := m.ConfigSourceSpecifier.(type) { - case *EventServiceConfig_GrpcService: - if v == nil { - err := EventServiceConfigValidationError{ - field: "ConfigSourceSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofConfigSourceSpecifierPresent = true - - if all { - switch v := interface{}(m.GetGrpcService()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, EventServiceConfigValidationError{ - field: "GrpcService", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, EventServiceConfigValidationError{ - field: "GrpcService", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetGrpcService()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return EventServiceConfigValidationError{ - field: "GrpcService", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofConfigSourceSpecifierPresent { - err := EventServiceConfigValidationError{ - field: "ConfigSourceSpecifier", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return EventServiceConfigMultiError(errors) - } - - return nil -} - -// EventServiceConfigMultiError is an error wrapping multiple validation errors -// returned by EventServiceConfig.ValidateAll() if the designated constraints -// aren't met. -type EventServiceConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m EventServiceConfigMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m EventServiceConfigMultiError) AllErrors() []error { return m } - -// EventServiceConfigValidationError is the validation error returned by -// EventServiceConfig.Validate if the designated constraints aren't met. -type EventServiceConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e EventServiceConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e EventServiceConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e EventServiceConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e EventServiceConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e EventServiceConfigValidationError) ErrorName() string { - return "EventServiceConfigValidationError" -} - -// Error satisfies the builtin error interface -func (e EventServiceConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sEventServiceConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = EventServiceConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = EventServiceConfigValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/extension.pb.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/extension.pb.go deleted file mode 100644 index 39d2565fd..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/extension.pb.go +++ /dev/null @@ -1,190 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/config/core/v3/extension.proto - -package corev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Message type for extension configuration. -// [#next-major-version: revisit all existing typed_config that doesn't use this wrapper.]. -type TypedExtensionConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of an extension. This is not used to select the extension, instead - // it serves the role of an opaque identifier. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The typed config for the extension. The type URL will be used to identify - // the extension. In the case that the type URL is “xds.type.v3.TypedStruct“ - // (or, for historical reasons, “udpa.type.v1.TypedStruct“), the inner type - // URL of “TypedStruct“ will be utilized. See the - // :ref:`extension configuration overview - // ` for further details. - TypedConfig *anypb.Any `protobuf:"bytes,2,opt,name=typed_config,json=typedConfig,proto3" json:"typed_config,omitempty"` -} - -func (x *TypedExtensionConfig) Reset() { - *x = TypedExtensionConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_extension_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TypedExtensionConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TypedExtensionConfig) ProtoMessage() {} - -func (x *TypedExtensionConfig) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_extension_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TypedExtensionConfig.ProtoReflect.Descriptor instead. -func (*TypedExtensionConfig) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_extension_proto_rawDescGZIP(), []int{0} -} - -func (x *TypedExtensionConfig) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *TypedExtensionConfig) GetTypedConfig() *anypb.Any { - if x != nil { - return x.TypedConfig - } - return nil -} - -var File_envoy_config_core_v3_extension_proto protoreflect.FileDescriptor - -var file_envoy_config_core_v3_extension_proto_rawDesc = []byte{ - 0x0a, 0x24, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x1a, 0x19, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, - 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, - 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0x76, 0x0a, 0x14, 0x54, 0x79, 0x70, 0x65, 0x64, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x41, 0x0a, 0x0c, 0x74, 0x79, 0x70, 0x65, 0x64, 0x5f, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, - 0x42, 0x08, 0xfa, 0x42, 0x05, 0xa2, 0x01, 0x02, 0x08, 0x01, 0x52, 0x0b, 0x74, 0x79, 0x70, 0x65, - 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x82, 0x01, 0x0a, 0x22, 0x69, 0x6f, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x42, 0x0e, - 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x3b, 0x63, 0x6f, - 0x72, 0x65, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_config_core_v3_extension_proto_rawDescOnce sync.Once - file_envoy_config_core_v3_extension_proto_rawDescData = file_envoy_config_core_v3_extension_proto_rawDesc -) - -func file_envoy_config_core_v3_extension_proto_rawDescGZIP() []byte { - file_envoy_config_core_v3_extension_proto_rawDescOnce.Do(func() { - file_envoy_config_core_v3_extension_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_config_core_v3_extension_proto_rawDescData) - }) - return file_envoy_config_core_v3_extension_proto_rawDescData -} - -var file_envoy_config_core_v3_extension_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_config_core_v3_extension_proto_goTypes = []interface{}{ - (*TypedExtensionConfig)(nil), // 0: envoy.config.core.v3.TypedExtensionConfig - (*anypb.Any)(nil), // 1: google.protobuf.Any -} -var file_envoy_config_core_v3_extension_proto_depIdxs = []int32{ - 1, // 0: envoy.config.core.v3.TypedExtensionConfig.typed_config:type_name -> google.protobuf.Any - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_envoy_config_core_v3_extension_proto_init() } -func file_envoy_config_core_v3_extension_proto_init() { - if File_envoy_config_core_v3_extension_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_envoy_config_core_v3_extension_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TypedExtensionConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_config_core_v3_extension_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_config_core_v3_extension_proto_goTypes, - DependencyIndexes: file_envoy_config_core_v3_extension_proto_depIdxs, - MessageInfos: file_envoy_config_core_v3_extension_proto_msgTypes, - }.Build() - File_envoy_config_core_v3_extension_proto = out.File - file_envoy_config_core_v3_extension_proto_rawDesc = nil - file_envoy_config_core_v3_extension_proto_goTypes = nil - file_envoy_config_core_v3_extension_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/extension.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/extension.pb.validate.go deleted file mode 100644 index 9c915d383..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/extension.pb.validate.go +++ /dev/null @@ -1,164 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/config/core/v3/extension.proto - -package corev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on TypedExtensionConfig with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *TypedExtensionConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on TypedExtensionConfig with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// TypedExtensionConfigMultiError, or nil if none found. -func (m *TypedExtensionConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *TypedExtensionConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := TypedExtensionConfigValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if m.GetTypedConfig() == nil { - err := TypedExtensionConfigValidationError{ - field: "TypedConfig", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if a := m.GetTypedConfig(); a != nil { - - } - - if len(errors) > 0 { - return TypedExtensionConfigMultiError(errors) - } - - return nil -} - -// TypedExtensionConfigMultiError is an error wrapping multiple validation -// errors returned by TypedExtensionConfig.ValidateAll() if the designated -// constraints aren't met. -type TypedExtensionConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m TypedExtensionConfigMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m TypedExtensionConfigMultiError) AllErrors() []error { return m } - -// TypedExtensionConfigValidationError is the validation error returned by -// TypedExtensionConfig.Validate if the designated constraints aren't met. -type TypedExtensionConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TypedExtensionConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TypedExtensionConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TypedExtensionConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TypedExtensionConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TypedExtensionConfigValidationError) ErrorName() string { - return "TypedExtensionConfigValidationError" -} - -// Error satisfies the builtin error interface -func (e TypedExtensionConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTypedExtensionConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TypedExtensionConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TypedExtensionConfigValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/grpc_method_list.pb.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/grpc_method_list.pb.go deleted file mode 100644 index 0b5273933..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/grpc_method_list.pb.go +++ /dev/null @@ -1,251 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/config/core/v3/grpc_method_list.proto - -package corev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// A list of gRPC methods which can be used as an allowlist, for example. -type GrpcMethodList struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Services []*GrpcMethodList_Service `protobuf:"bytes,1,rep,name=services,proto3" json:"services,omitempty"` -} - -func (x *GrpcMethodList) Reset() { - *x = GrpcMethodList{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_grpc_method_list_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GrpcMethodList) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GrpcMethodList) ProtoMessage() {} - -func (x *GrpcMethodList) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_grpc_method_list_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GrpcMethodList.ProtoReflect.Descriptor instead. -func (*GrpcMethodList) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_grpc_method_list_proto_rawDescGZIP(), []int{0} -} - -func (x *GrpcMethodList) GetServices() []*GrpcMethodList_Service { - if x != nil { - return x.Services - } - return nil -} - -type GrpcMethodList_Service struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of the gRPC service. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The names of the gRPC methods in this service. - MethodNames []string `protobuf:"bytes,2,rep,name=method_names,json=methodNames,proto3" json:"method_names,omitempty"` -} - -func (x *GrpcMethodList_Service) Reset() { - *x = GrpcMethodList_Service{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_grpc_method_list_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GrpcMethodList_Service) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GrpcMethodList_Service) ProtoMessage() {} - -func (x *GrpcMethodList_Service) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_grpc_method_list_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GrpcMethodList_Service.ProtoReflect.Descriptor instead. -func (*GrpcMethodList_Service) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_grpc_method_list_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *GrpcMethodList_Service) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *GrpcMethodList_Service) GetMethodNames() []string { - if x != nil { - return x.MethodNames - } - return nil -} - -var File_envoy_config_core_v3_grpc_method_list_proto protoreflect.FileDescriptor - -var file_envoy_config_core_v3_grpc_method_list_proto_rawDesc = []byte{ - 0x0a, 0x2b, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x6d, 0x65, 0x74, 0x68, - 0x6f, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, - 0x2e, 0x76, 0x33, 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x21, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, - 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8a, - 0x02, 0x0a, 0x0e, 0x47, 0x72, 0x70, 0x63, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4c, 0x69, 0x73, - 0x74, 0x12, 0x48, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x4d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x1a, 0x84, 0x01, 0x0a, 0x07, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2b, 0x0a, 0x0c, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x6e, - 0x61, 0x6d, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, - 0x01, 0x02, 0x08, 0x01, 0x52, 0x0b, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, - 0x73, 0x3a, 0x2f, 0x9a, 0xc5, 0x88, 0x1e, 0x2a, 0x0a, 0x28, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x72, 0x70, 0x63, - 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x3a, 0x27, 0x9a, 0xc5, 0x88, 0x1e, 0x22, 0x0a, 0x20, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x72, 0x70, - 0x63, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x87, 0x01, 0x0a, 0x22, - 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, - 0x76, 0x33, 0x42, 0x13, 0x47, 0x72, 0x70, 0x63, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4c, 0x69, - 0x73, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, - 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, - 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x3b, 0x63, 0x6f, 0x72, 0x65, 0x76, 0x33, 0xba, 0x80, 0xc8, - 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_config_core_v3_grpc_method_list_proto_rawDescOnce sync.Once - file_envoy_config_core_v3_grpc_method_list_proto_rawDescData = file_envoy_config_core_v3_grpc_method_list_proto_rawDesc -) - -func file_envoy_config_core_v3_grpc_method_list_proto_rawDescGZIP() []byte { - file_envoy_config_core_v3_grpc_method_list_proto_rawDescOnce.Do(func() { - file_envoy_config_core_v3_grpc_method_list_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_config_core_v3_grpc_method_list_proto_rawDescData) - }) - return file_envoy_config_core_v3_grpc_method_list_proto_rawDescData -} - -var file_envoy_config_core_v3_grpc_method_list_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_envoy_config_core_v3_grpc_method_list_proto_goTypes = []interface{}{ - (*GrpcMethodList)(nil), // 0: envoy.config.core.v3.GrpcMethodList - (*GrpcMethodList_Service)(nil), // 1: envoy.config.core.v3.GrpcMethodList.Service -} -var file_envoy_config_core_v3_grpc_method_list_proto_depIdxs = []int32{ - 1, // 0: envoy.config.core.v3.GrpcMethodList.services:type_name -> envoy.config.core.v3.GrpcMethodList.Service - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_envoy_config_core_v3_grpc_method_list_proto_init() } -func file_envoy_config_core_v3_grpc_method_list_proto_init() { - if File_envoy_config_core_v3_grpc_method_list_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_envoy_config_core_v3_grpc_method_list_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GrpcMethodList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_grpc_method_list_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GrpcMethodList_Service); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_config_core_v3_grpc_method_list_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_config_core_v3_grpc_method_list_proto_goTypes, - DependencyIndexes: file_envoy_config_core_v3_grpc_method_list_proto_depIdxs, - MessageInfos: file_envoy_config_core_v3_grpc_method_list_proto_msgTypes, - }.Build() - File_envoy_config_core_v3_grpc_method_list_proto = out.File - file_envoy_config_core_v3_grpc_method_list_proto_rawDesc = nil - file_envoy_config_core_v3_grpc_method_list_proto_goTypes = nil - file_envoy_config_core_v3_grpc_method_list_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/grpc_method_list.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/grpc_method_list.pb.validate.go deleted file mode 100644 index 4fc134e94..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/grpc_method_list.pb.validate.go +++ /dev/null @@ -1,294 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/config/core/v3/grpc_method_list.proto - -package corev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on GrpcMethodList with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *GrpcMethodList) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GrpcMethodList with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in GrpcMethodListMultiError, -// or nil if none found. -func (m *GrpcMethodList) ValidateAll() error { - return m.validate(true) -} - -func (m *GrpcMethodList) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetServices() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcMethodListValidationError{ - field: fmt.Sprintf("Services[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcMethodListValidationError{ - field: fmt.Sprintf("Services[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcMethodListValidationError{ - field: fmt.Sprintf("Services[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return GrpcMethodListMultiError(errors) - } - - return nil -} - -// GrpcMethodListMultiError is an error wrapping multiple validation errors -// returned by GrpcMethodList.ValidateAll() if the designated constraints -// aren't met. -type GrpcMethodListMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GrpcMethodListMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GrpcMethodListMultiError) AllErrors() []error { return m } - -// GrpcMethodListValidationError is the validation error returned by -// GrpcMethodList.Validate if the designated constraints aren't met. -type GrpcMethodListValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GrpcMethodListValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GrpcMethodListValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GrpcMethodListValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GrpcMethodListValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GrpcMethodListValidationError) ErrorName() string { return "GrpcMethodListValidationError" } - -// Error satisfies the builtin error interface -func (e GrpcMethodListValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGrpcMethodList.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GrpcMethodListValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GrpcMethodListValidationError{} - -// Validate checks the field values on GrpcMethodList_Service with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *GrpcMethodList_Service) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GrpcMethodList_Service with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GrpcMethodList_ServiceMultiError, or nil if none found. -func (m *GrpcMethodList_Service) ValidateAll() error { - return m.validate(true) -} - -func (m *GrpcMethodList_Service) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := GrpcMethodList_ServiceValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(m.GetMethodNames()) < 1 { - err := GrpcMethodList_ServiceValidationError{ - field: "MethodNames", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return GrpcMethodList_ServiceMultiError(errors) - } - - return nil -} - -// GrpcMethodList_ServiceMultiError is an error wrapping multiple validation -// errors returned by GrpcMethodList_Service.ValidateAll() if the designated -// constraints aren't met. -type GrpcMethodList_ServiceMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GrpcMethodList_ServiceMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GrpcMethodList_ServiceMultiError) AllErrors() []error { return m } - -// GrpcMethodList_ServiceValidationError is the validation error returned by -// GrpcMethodList_Service.Validate if the designated constraints aren't met. -type GrpcMethodList_ServiceValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GrpcMethodList_ServiceValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GrpcMethodList_ServiceValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GrpcMethodList_ServiceValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GrpcMethodList_ServiceValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GrpcMethodList_ServiceValidationError) ErrorName() string { - return "GrpcMethodList_ServiceValidationError" -} - -// Error satisfies the builtin error interface -func (e GrpcMethodList_ServiceValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGrpcMethodList_Service.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GrpcMethodList_ServiceValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GrpcMethodList_ServiceValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/grpc_service.pb.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/grpc_service.pb.go deleted file mode 100644 index f008a1697..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/grpc_service.pb.go +++ /dev/null @@ -1,1769 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/config/core/v3/grpc_service.proto - -package corev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - durationpb "google.golang.org/protobuf/types/known/durationpb" - emptypb "google.golang.org/protobuf/types/known/emptypb" - structpb "google.golang.org/protobuf/types/known/structpb" - wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// gRPC service configuration. This is used by :ref:`ApiConfigSource -// ` and filter configurations. -// [#next-free-field: 6] -type GrpcService struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to TargetSpecifier: - // - // *GrpcService_EnvoyGrpc_ - // *GrpcService_GoogleGrpc_ - TargetSpecifier isGrpcService_TargetSpecifier `protobuf_oneof:"target_specifier"` - // The timeout for the gRPC request. This is the timeout for a specific - // request. - Timeout *durationpb.Duration `protobuf:"bytes,3,opt,name=timeout,proto3" json:"timeout,omitempty"` - // Additional metadata to include in streams initiated to the GrpcService. This can be used for - // scenarios in which additional ad hoc authorization headers (e.g. “x-foo-bar: baz-key“) are to - // be injected. For more information, including details on header value syntax, see the - // documentation on :ref:`custom request headers - // `. - InitialMetadata []*HeaderValue `protobuf:"bytes,5,rep,name=initial_metadata,json=initialMetadata,proto3" json:"initial_metadata,omitempty"` -} - -func (x *GrpcService) Reset() { - *x = GrpcService{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GrpcService) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GrpcService) ProtoMessage() {} - -func (x *GrpcService) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GrpcService.ProtoReflect.Descriptor instead. -func (*GrpcService) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_grpc_service_proto_rawDescGZIP(), []int{0} -} - -func (m *GrpcService) GetTargetSpecifier() isGrpcService_TargetSpecifier { - if m != nil { - return m.TargetSpecifier - } - return nil -} - -func (x *GrpcService) GetEnvoyGrpc() *GrpcService_EnvoyGrpc { - if x, ok := x.GetTargetSpecifier().(*GrpcService_EnvoyGrpc_); ok { - return x.EnvoyGrpc - } - return nil -} - -func (x *GrpcService) GetGoogleGrpc() *GrpcService_GoogleGrpc { - if x, ok := x.GetTargetSpecifier().(*GrpcService_GoogleGrpc_); ok { - return x.GoogleGrpc - } - return nil -} - -func (x *GrpcService) GetTimeout() *durationpb.Duration { - if x != nil { - return x.Timeout - } - return nil -} - -func (x *GrpcService) GetInitialMetadata() []*HeaderValue { - if x != nil { - return x.InitialMetadata - } - return nil -} - -type isGrpcService_TargetSpecifier interface { - isGrpcService_TargetSpecifier() -} - -type GrpcService_EnvoyGrpc_ struct { - // Envoy's in-built gRPC client. - // See the :ref:`gRPC services overview ` - // documentation for discussion on gRPC client selection. - EnvoyGrpc *GrpcService_EnvoyGrpc `protobuf:"bytes,1,opt,name=envoy_grpc,json=envoyGrpc,proto3,oneof"` -} - -type GrpcService_GoogleGrpc_ struct { - // `Google C++ gRPC client `_ - // See the :ref:`gRPC services overview ` - // documentation for discussion on gRPC client selection. - GoogleGrpc *GrpcService_GoogleGrpc `protobuf:"bytes,2,opt,name=google_grpc,json=googleGrpc,proto3,oneof"` -} - -func (*GrpcService_EnvoyGrpc_) isGrpcService_TargetSpecifier() {} - -func (*GrpcService_GoogleGrpc_) isGrpcService_TargetSpecifier() {} - -type GrpcService_EnvoyGrpc struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of the upstream gRPC cluster. SSL credentials will be supplied - // in the :ref:`Cluster ` :ref:`transport_socket - // `. - ClusterName string `protobuf:"bytes,1,opt,name=cluster_name,json=clusterName,proto3" json:"cluster_name,omitempty"` - // The “:authority“ header in the grpc request. If this field is not set, the authority header value will be “cluster_name“. - // Note that this authority does not override the SNI. The SNI is provided by the transport socket of the cluster. - Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"` - // Indicates the retry policy for re-establishing the gRPC stream - // This field is optional. If max interval is not provided, it will be set to ten times the provided base interval. - // Currently only supported for xDS gRPC streams. - // If not set, xDS gRPC streams default base interval:500ms, maximum interval:30s will be applied. - RetryPolicy *RetryPolicy `protobuf:"bytes,3,opt,name=retry_policy,json=retryPolicy,proto3" json:"retry_policy,omitempty"` -} - -func (x *GrpcService_EnvoyGrpc) Reset() { - *x = GrpcService_EnvoyGrpc{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GrpcService_EnvoyGrpc) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GrpcService_EnvoyGrpc) ProtoMessage() {} - -func (x *GrpcService_EnvoyGrpc) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GrpcService_EnvoyGrpc.ProtoReflect.Descriptor instead. -func (*GrpcService_EnvoyGrpc) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_grpc_service_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *GrpcService_EnvoyGrpc) GetClusterName() string { - if x != nil { - return x.ClusterName - } - return "" -} - -func (x *GrpcService_EnvoyGrpc) GetAuthority() string { - if x != nil { - return x.Authority - } - return "" -} - -func (x *GrpcService_EnvoyGrpc) GetRetryPolicy() *RetryPolicy { - if x != nil { - return x.RetryPolicy - } - return nil -} - -// [#next-free-field: 9] -type GrpcService_GoogleGrpc struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The target URI when using the `Google C++ gRPC client - // `_. SSL credentials will be supplied in - // :ref:`channel_credentials `. - TargetUri string `protobuf:"bytes,1,opt,name=target_uri,json=targetUri,proto3" json:"target_uri,omitempty"` - ChannelCredentials *GrpcService_GoogleGrpc_ChannelCredentials `protobuf:"bytes,2,opt,name=channel_credentials,json=channelCredentials,proto3" json:"channel_credentials,omitempty"` - // A set of call credentials that can be composed with `channel credentials - // `_. - CallCredentials []*GrpcService_GoogleGrpc_CallCredentials `protobuf:"bytes,3,rep,name=call_credentials,json=callCredentials,proto3" json:"call_credentials,omitempty"` - // The human readable prefix to use when emitting statistics for the gRPC - // service. - // - // .. csv-table:: - // - // :header: Name, Type, Description - // :widths: 1, 1, 2 - // - // streams_total, Counter, Total number of streams opened - // streams_closed_, Counter, Total streams closed with - StatPrefix string `protobuf:"bytes,4,opt,name=stat_prefix,json=statPrefix,proto3" json:"stat_prefix,omitempty"` - // The name of the Google gRPC credentials factory to use. This must have been registered with - // Envoy. If this is empty, a default credentials factory will be used that sets up channel - // credentials based on other configuration parameters. - CredentialsFactoryName string `protobuf:"bytes,5,opt,name=credentials_factory_name,json=credentialsFactoryName,proto3" json:"credentials_factory_name,omitempty"` - // Additional configuration for site-specific customizations of the Google - // gRPC library. - Config *structpb.Struct `protobuf:"bytes,6,opt,name=config,proto3" json:"config,omitempty"` - // How many bytes each stream can buffer internally. - // If not set an implementation defined default is applied (1MiB). - PerStreamBufferLimitBytes *wrapperspb.UInt32Value `protobuf:"bytes,7,opt,name=per_stream_buffer_limit_bytes,json=perStreamBufferLimitBytes,proto3" json:"per_stream_buffer_limit_bytes,omitempty"` - // Custom channels args. - ChannelArgs *GrpcService_GoogleGrpc_ChannelArgs `protobuf:"bytes,8,opt,name=channel_args,json=channelArgs,proto3" json:"channel_args,omitempty"` -} - -func (x *GrpcService_GoogleGrpc) Reset() { - *x = GrpcService_GoogleGrpc{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GrpcService_GoogleGrpc) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GrpcService_GoogleGrpc) ProtoMessage() {} - -func (x *GrpcService_GoogleGrpc) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GrpcService_GoogleGrpc.ProtoReflect.Descriptor instead. -func (*GrpcService_GoogleGrpc) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_grpc_service_proto_rawDescGZIP(), []int{0, 1} -} - -func (x *GrpcService_GoogleGrpc) GetTargetUri() string { - if x != nil { - return x.TargetUri - } - return "" -} - -func (x *GrpcService_GoogleGrpc) GetChannelCredentials() *GrpcService_GoogleGrpc_ChannelCredentials { - if x != nil { - return x.ChannelCredentials - } - return nil -} - -func (x *GrpcService_GoogleGrpc) GetCallCredentials() []*GrpcService_GoogleGrpc_CallCredentials { - if x != nil { - return x.CallCredentials - } - return nil -} - -func (x *GrpcService_GoogleGrpc) GetStatPrefix() string { - if x != nil { - return x.StatPrefix - } - return "" -} - -func (x *GrpcService_GoogleGrpc) GetCredentialsFactoryName() string { - if x != nil { - return x.CredentialsFactoryName - } - return "" -} - -func (x *GrpcService_GoogleGrpc) GetConfig() *structpb.Struct { - if x != nil { - return x.Config - } - return nil -} - -func (x *GrpcService_GoogleGrpc) GetPerStreamBufferLimitBytes() *wrapperspb.UInt32Value { - if x != nil { - return x.PerStreamBufferLimitBytes - } - return nil -} - -func (x *GrpcService_GoogleGrpc) GetChannelArgs() *GrpcService_GoogleGrpc_ChannelArgs { - if x != nil { - return x.ChannelArgs - } - return nil -} - -// See https://grpc.io/grpc/cpp/structgrpc_1_1_ssl_credentials_options.html. -type GrpcService_GoogleGrpc_SslCredentials struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // PEM encoded server root certificates. - RootCerts *DataSource `protobuf:"bytes,1,opt,name=root_certs,json=rootCerts,proto3" json:"root_certs,omitempty"` - // PEM encoded client private key. - PrivateKey *DataSource `protobuf:"bytes,2,opt,name=private_key,json=privateKey,proto3" json:"private_key,omitempty"` - // PEM encoded client certificate chain. - CertChain *DataSource `protobuf:"bytes,3,opt,name=cert_chain,json=certChain,proto3" json:"cert_chain,omitempty"` -} - -func (x *GrpcService_GoogleGrpc_SslCredentials) Reset() { - *x = GrpcService_GoogleGrpc_SslCredentials{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GrpcService_GoogleGrpc_SslCredentials) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GrpcService_GoogleGrpc_SslCredentials) ProtoMessage() {} - -func (x *GrpcService_GoogleGrpc_SslCredentials) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GrpcService_GoogleGrpc_SslCredentials.ProtoReflect.Descriptor instead. -func (*GrpcService_GoogleGrpc_SslCredentials) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_grpc_service_proto_rawDescGZIP(), []int{0, 1, 0} -} - -func (x *GrpcService_GoogleGrpc_SslCredentials) GetRootCerts() *DataSource { - if x != nil { - return x.RootCerts - } - return nil -} - -func (x *GrpcService_GoogleGrpc_SslCredentials) GetPrivateKey() *DataSource { - if x != nil { - return x.PrivateKey - } - return nil -} - -func (x *GrpcService_GoogleGrpc_SslCredentials) GetCertChain() *DataSource { - if x != nil { - return x.CertChain - } - return nil -} - -// Local channel credentials. Only UDS is supported for now. -// See https://github.com/grpc/grpc/pull/15909. -type GrpcService_GoogleGrpc_GoogleLocalCredentials struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *GrpcService_GoogleGrpc_GoogleLocalCredentials) Reset() { - *x = GrpcService_GoogleGrpc_GoogleLocalCredentials{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GrpcService_GoogleGrpc_GoogleLocalCredentials) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GrpcService_GoogleGrpc_GoogleLocalCredentials) ProtoMessage() {} - -func (x *GrpcService_GoogleGrpc_GoogleLocalCredentials) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GrpcService_GoogleGrpc_GoogleLocalCredentials.ProtoReflect.Descriptor instead. -func (*GrpcService_GoogleGrpc_GoogleLocalCredentials) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_grpc_service_proto_rawDescGZIP(), []int{0, 1, 1} -} - -// See https://grpc.io/docs/guides/auth.html#credential-types to understand Channel and Call -// credential types. -type GrpcService_GoogleGrpc_ChannelCredentials struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to CredentialSpecifier: - // - // *GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials - // *GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault - // *GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials - CredentialSpecifier isGrpcService_GoogleGrpc_ChannelCredentials_CredentialSpecifier `protobuf_oneof:"credential_specifier"` -} - -func (x *GrpcService_GoogleGrpc_ChannelCredentials) Reset() { - *x = GrpcService_GoogleGrpc_ChannelCredentials{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GrpcService_GoogleGrpc_ChannelCredentials) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GrpcService_GoogleGrpc_ChannelCredentials) ProtoMessage() {} - -func (x *GrpcService_GoogleGrpc_ChannelCredentials) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GrpcService_GoogleGrpc_ChannelCredentials.ProtoReflect.Descriptor instead. -func (*GrpcService_GoogleGrpc_ChannelCredentials) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_grpc_service_proto_rawDescGZIP(), []int{0, 1, 2} -} - -func (m *GrpcService_GoogleGrpc_ChannelCredentials) GetCredentialSpecifier() isGrpcService_GoogleGrpc_ChannelCredentials_CredentialSpecifier { - if m != nil { - return m.CredentialSpecifier - } - return nil -} - -func (x *GrpcService_GoogleGrpc_ChannelCredentials) GetSslCredentials() *GrpcService_GoogleGrpc_SslCredentials { - if x, ok := x.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials); ok { - return x.SslCredentials - } - return nil -} - -func (x *GrpcService_GoogleGrpc_ChannelCredentials) GetGoogleDefault() *emptypb.Empty { - if x, ok := x.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault); ok { - return x.GoogleDefault - } - return nil -} - -func (x *GrpcService_GoogleGrpc_ChannelCredentials) GetLocalCredentials() *GrpcService_GoogleGrpc_GoogleLocalCredentials { - if x, ok := x.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials); ok { - return x.LocalCredentials - } - return nil -} - -type isGrpcService_GoogleGrpc_ChannelCredentials_CredentialSpecifier interface { - isGrpcService_GoogleGrpc_ChannelCredentials_CredentialSpecifier() -} - -type GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials struct { - SslCredentials *GrpcService_GoogleGrpc_SslCredentials `protobuf:"bytes,1,opt,name=ssl_credentials,json=sslCredentials,proto3,oneof"` -} - -type GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault struct { - // https://grpc.io/grpc/cpp/namespacegrpc.html#a6beb3ac70ff94bd2ebbd89b8f21d1f61 - GoogleDefault *emptypb.Empty `protobuf:"bytes,2,opt,name=google_default,json=googleDefault,proto3,oneof"` -} - -type GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials struct { - LocalCredentials *GrpcService_GoogleGrpc_GoogleLocalCredentials `protobuf:"bytes,3,opt,name=local_credentials,json=localCredentials,proto3,oneof"` -} - -func (*GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials) isGrpcService_GoogleGrpc_ChannelCredentials_CredentialSpecifier() { -} - -func (*GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault) isGrpcService_GoogleGrpc_ChannelCredentials_CredentialSpecifier() { -} - -func (*GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials) isGrpcService_GoogleGrpc_ChannelCredentials_CredentialSpecifier() { -} - -// [#next-free-field: 8] -type GrpcService_GoogleGrpc_CallCredentials struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to CredentialSpecifier: - // - // *GrpcService_GoogleGrpc_CallCredentials_AccessToken - // *GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine - // *GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken - // *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess - // *GrpcService_GoogleGrpc_CallCredentials_GoogleIam - // *GrpcService_GoogleGrpc_CallCredentials_FromPlugin - // *GrpcService_GoogleGrpc_CallCredentials_StsService_ - CredentialSpecifier isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier `protobuf_oneof:"credential_specifier"` -} - -func (x *GrpcService_GoogleGrpc_CallCredentials) Reset() { - *x = GrpcService_GoogleGrpc_CallCredentials{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GrpcService_GoogleGrpc_CallCredentials) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GrpcService_GoogleGrpc_CallCredentials) ProtoMessage() {} - -func (x *GrpcService_GoogleGrpc_CallCredentials) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GrpcService_GoogleGrpc_CallCredentials.ProtoReflect.Descriptor instead. -func (*GrpcService_GoogleGrpc_CallCredentials) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_grpc_service_proto_rawDescGZIP(), []int{0, 1, 3} -} - -func (m *GrpcService_GoogleGrpc_CallCredentials) GetCredentialSpecifier() isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier { - if m != nil { - return m.CredentialSpecifier - } - return nil -} - -func (x *GrpcService_GoogleGrpc_CallCredentials) GetAccessToken() string { - if x, ok := x.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_CallCredentials_AccessToken); ok { - return x.AccessToken - } - return "" -} - -func (x *GrpcService_GoogleGrpc_CallCredentials) GetGoogleComputeEngine() *emptypb.Empty { - if x, ok := x.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine); ok { - return x.GoogleComputeEngine - } - return nil -} - -func (x *GrpcService_GoogleGrpc_CallCredentials) GetGoogleRefreshToken() string { - if x, ok := x.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken); ok { - return x.GoogleRefreshToken - } - return "" -} - -func (x *GrpcService_GoogleGrpc_CallCredentials) GetServiceAccountJwtAccess() *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials { - if x, ok := x.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess); ok { - return x.ServiceAccountJwtAccess - } - return nil -} - -func (x *GrpcService_GoogleGrpc_CallCredentials) GetGoogleIam() *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials { - if x, ok := x.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_CallCredentials_GoogleIam); ok { - return x.GoogleIam - } - return nil -} - -func (x *GrpcService_GoogleGrpc_CallCredentials) GetFromPlugin() *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin { - if x, ok := x.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_CallCredentials_FromPlugin); ok { - return x.FromPlugin - } - return nil -} - -func (x *GrpcService_GoogleGrpc_CallCredentials) GetStsService() *GrpcService_GoogleGrpc_CallCredentials_StsService { - if x, ok := x.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_CallCredentials_StsService_); ok { - return x.StsService - } - return nil -} - -type isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier interface { - isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier() -} - -type GrpcService_GoogleGrpc_CallCredentials_AccessToken struct { - // Access token credentials. - // https://grpc.io/grpc/cpp/namespacegrpc.html#ad3a80da696ffdaea943f0f858d7a360d. - AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3,oneof"` -} - -type GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine struct { - // Google Compute Engine credentials. - // https://grpc.io/grpc/cpp/namespacegrpc.html#a6beb3ac70ff94bd2ebbd89b8f21d1f61 - GoogleComputeEngine *emptypb.Empty `protobuf:"bytes,2,opt,name=google_compute_engine,json=googleComputeEngine,proto3,oneof"` -} - -type GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken struct { - // Google refresh token credentials. - // https://grpc.io/grpc/cpp/namespacegrpc.html#a96901c997b91bc6513b08491e0dca37c. - GoogleRefreshToken string `protobuf:"bytes,3,opt,name=google_refresh_token,json=googleRefreshToken,proto3,oneof"` -} - -type GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess struct { - // Service Account JWT Access credentials. - // https://grpc.io/grpc/cpp/namespacegrpc.html#a92a9f959d6102461f66ee973d8e9d3aa. - ServiceAccountJwtAccess *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials `protobuf:"bytes,4,opt,name=service_account_jwt_access,json=serviceAccountJwtAccess,proto3,oneof"` -} - -type GrpcService_GoogleGrpc_CallCredentials_GoogleIam struct { - // Google IAM credentials. - // https://grpc.io/grpc/cpp/namespacegrpc.html#a9fc1fc101b41e680d47028166e76f9d0. - GoogleIam *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials `protobuf:"bytes,5,opt,name=google_iam,json=googleIam,proto3,oneof"` -} - -type GrpcService_GoogleGrpc_CallCredentials_FromPlugin struct { - // Custom authenticator credentials. - // https://grpc.io/grpc/cpp/namespacegrpc.html#a823c6a4b19ffc71fb33e90154ee2ad07. - // https://grpc.io/docs/guides/auth.html#extending-grpc-to-support-other-authentication-mechanisms. - FromPlugin *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin `protobuf:"bytes,6,opt,name=from_plugin,json=fromPlugin,proto3,oneof"` -} - -type GrpcService_GoogleGrpc_CallCredentials_StsService_ struct { - // Custom security token service which implements OAuth 2.0 token exchange. - // https://tools.ietf.org/html/draft-ietf-oauth-token-exchange-16 - // See https://github.com/grpc/grpc/pull/19587. - StsService *GrpcService_GoogleGrpc_CallCredentials_StsService `protobuf:"bytes,7,opt,name=sts_service,json=stsService,proto3,oneof"` -} - -func (*GrpcService_GoogleGrpc_CallCredentials_AccessToken) isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier() { -} - -func (*GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine) isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier() { -} - -func (*GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken) isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier() { -} - -func (*GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess) isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier() { -} - -func (*GrpcService_GoogleGrpc_CallCredentials_GoogleIam) isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier() { -} - -func (*GrpcService_GoogleGrpc_CallCredentials_FromPlugin) isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier() { -} - -func (*GrpcService_GoogleGrpc_CallCredentials_StsService_) isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier() { -} - -// Channel arguments. -type GrpcService_GoogleGrpc_ChannelArgs struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // See grpc_types.h GRPC_ARG #defines for keys that work here. - Args map[string]*GrpcService_GoogleGrpc_ChannelArgs_Value `protobuf:"bytes,1,rep,name=args,proto3" json:"args,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *GrpcService_GoogleGrpc_ChannelArgs) Reset() { - *x = GrpcService_GoogleGrpc_ChannelArgs{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GrpcService_GoogleGrpc_ChannelArgs) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GrpcService_GoogleGrpc_ChannelArgs) ProtoMessage() {} - -func (x *GrpcService_GoogleGrpc_ChannelArgs) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GrpcService_GoogleGrpc_ChannelArgs.ProtoReflect.Descriptor instead. -func (*GrpcService_GoogleGrpc_ChannelArgs) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_grpc_service_proto_rawDescGZIP(), []int{0, 1, 4} -} - -func (x *GrpcService_GoogleGrpc_ChannelArgs) GetArgs() map[string]*GrpcService_GoogleGrpc_ChannelArgs_Value { - if x != nil { - return x.Args - } - return nil -} - -type GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - JsonKey string `protobuf:"bytes,1,opt,name=json_key,json=jsonKey,proto3" json:"json_key,omitempty"` - TokenLifetimeSeconds uint64 `protobuf:"varint,2,opt,name=token_lifetime_seconds,json=tokenLifetimeSeconds,proto3" json:"token_lifetime_seconds,omitempty"` -} - -func (x *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) Reset() { - *x = GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) ProtoMessage() {} - -func (x *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials.ProtoReflect.Descriptor instead. -func (*GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_grpc_service_proto_rawDescGZIP(), []int{0, 1, 3, 0} -} - -func (x *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) GetJsonKey() string { - if x != nil { - return x.JsonKey - } - return "" -} - -func (x *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) GetTokenLifetimeSeconds() uint64 { - if x != nil { - return x.TokenLifetimeSeconds - } - return 0 -} - -type GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AuthorizationToken string `protobuf:"bytes,1,opt,name=authorization_token,json=authorizationToken,proto3" json:"authorization_token,omitempty"` - AuthoritySelector string `protobuf:"bytes,2,opt,name=authority_selector,json=authoritySelector,proto3" json:"authority_selector,omitempty"` -} - -func (x *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) Reset() { - *x = GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) ProtoMessage() {} - -func (x *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials.ProtoReflect.Descriptor instead. -func (*GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_grpc_service_proto_rawDescGZIP(), []int{0, 1, 3, 1} -} - -func (x *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) GetAuthorizationToken() string { - if x != nil { - return x.AuthorizationToken - } - return "" -} - -func (x *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) GetAuthoritySelector() string { - if x != nil { - return x.AuthoritySelector - } - return "" -} - -type GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // [#extension-category: envoy.grpc_credentials] - // - // Types that are assignable to ConfigType: - // - // *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_TypedConfig - ConfigType isGrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_ConfigType `protobuf_oneof:"config_type"` -} - -func (x *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) Reset() { - *x = GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) ProtoMessage() {} - -func (x *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin.ProtoReflect.Descriptor instead. -func (*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_grpc_service_proto_rawDescGZIP(), []int{0, 1, 3, 2} -} - -func (x *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) GetConfigType() isGrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_ConfigType { - if m != nil { - return m.ConfigType - } - return nil -} - -func (x *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) GetTypedConfig() *anypb.Any { - if x, ok := x.GetConfigType().(*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_TypedConfig); ok { - return x.TypedConfig - } - return nil -} - -type isGrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_ConfigType interface { - isGrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_ConfigType() -} - -type GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_TypedConfig struct { - TypedConfig *anypb.Any `protobuf:"bytes,3,opt,name=typed_config,json=typedConfig,proto3,oneof"` -} - -func (*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_TypedConfig) isGrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_ConfigType() { -} - -// Security token service configuration that allows Google gRPC to -// fetch security token from an OAuth 2.0 authorization server. -// See https://tools.ietf.org/html/draft-ietf-oauth-token-exchange-16 and -// https://github.com/grpc/grpc/pull/19587. -// [#next-free-field: 10] -type GrpcService_GoogleGrpc_CallCredentials_StsService struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // URI of the token exchange service that handles token exchange requests. - // [#comment:TODO(asraa): Add URI validation when implemented. Tracked by - // https://github.com/bufbuild/protoc-gen-validate/issues/303] - TokenExchangeServiceUri string `protobuf:"bytes,1,opt,name=token_exchange_service_uri,json=tokenExchangeServiceUri,proto3" json:"token_exchange_service_uri,omitempty"` - // Location of the target service or resource where the client - // intends to use the requested security token. - Resource string `protobuf:"bytes,2,opt,name=resource,proto3" json:"resource,omitempty"` - // Logical name of the target service where the client intends to - // use the requested security token. - Audience string `protobuf:"bytes,3,opt,name=audience,proto3" json:"audience,omitempty"` - // The desired scope of the requested security token in the - // context of the service or resource where the token will be used. - Scope string `protobuf:"bytes,4,opt,name=scope,proto3" json:"scope,omitempty"` - // Type of the requested security token. - RequestedTokenType string `protobuf:"bytes,5,opt,name=requested_token_type,json=requestedTokenType,proto3" json:"requested_token_type,omitempty"` - // The path of subject token, a security token that represents the - // identity of the party on behalf of whom the request is being made. - SubjectTokenPath string `protobuf:"bytes,6,opt,name=subject_token_path,json=subjectTokenPath,proto3" json:"subject_token_path,omitempty"` - // Type of the subject token. - SubjectTokenType string `protobuf:"bytes,7,opt,name=subject_token_type,json=subjectTokenType,proto3" json:"subject_token_type,omitempty"` - // The path of actor token, a security token that represents the identity - // of the acting party. The acting party is authorized to use the - // requested security token and act on behalf of the subject. - ActorTokenPath string `protobuf:"bytes,8,opt,name=actor_token_path,json=actorTokenPath,proto3" json:"actor_token_path,omitempty"` - // Type of the actor token. - ActorTokenType string `protobuf:"bytes,9,opt,name=actor_token_type,json=actorTokenType,proto3" json:"actor_token_type,omitempty"` -} - -func (x *GrpcService_GoogleGrpc_CallCredentials_StsService) Reset() { - *x = GrpcService_GoogleGrpc_CallCredentials_StsService{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GrpcService_GoogleGrpc_CallCredentials_StsService) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GrpcService_GoogleGrpc_CallCredentials_StsService) ProtoMessage() {} - -func (x *GrpcService_GoogleGrpc_CallCredentials_StsService) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GrpcService_GoogleGrpc_CallCredentials_StsService.ProtoReflect.Descriptor instead. -func (*GrpcService_GoogleGrpc_CallCredentials_StsService) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_grpc_service_proto_rawDescGZIP(), []int{0, 1, 3, 3} -} - -func (x *GrpcService_GoogleGrpc_CallCredentials_StsService) GetTokenExchangeServiceUri() string { - if x != nil { - return x.TokenExchangeServiceUri - } - return "" -} - -func (x *GrpcService_GoogleGrpc_CallCredentials_StsService) GetResource() string { - if x != nil { - return x.Resource - } - return "" -} - -func (x *GrpcService_GoogleGrpc_CallCredentials_StsService) GetAudience() string { - if x != nil { - return x.Audience - } - return "" -} - -func (x *GrpcService_GoogleGrpc_CallCredentials_StsService) GetScope() string { - if x != nil { - return x.Scope - } - return "" -} - -func (x *GrpcService_GoogleGrpc_CallCredentials_StsService) GetRequestedTokenType() string { - if x != nil { - return x.RequestedTokenType - } - return "" -} - -func (x *GrpcService_GoogleGrpc_CallCredentials_StsService) GetSubjectTokenPath() string { - if x != nil { - return x.SubjectTokenPath - } - return "" -} - -func (x *GrpcService_GoogleGrpc_CallCredentials_StsService) GetSubjectTokenType() string { - if x != nil { - return x.SubjectTokenType - } - return "" -} - -func (x *GrpcService_GoogleGrpc_CallCredentials_StsService) GetActorTokenPath() string { - if x != nil { - return x.ActorTokenPath - } - return "" -} - -func (x *GrpcService_GoogleGrpc_CallCredentials_StsService) GetActorTokenType() string { - if x != nil { - return x.ActorTokenType - } - return "" -} - -type GrpcService_GoogleGrpc_ChannelArgs_Value struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Pointer values are not supported, since they don't make any sense when - // delivered via the API. - // - // Types that are assignable to ValueSpecifier: - // - // *GrpcService_GoogleGrpc_ChannelArgs_Value_StringValue - // *GrpcService_GoogleGrpc_ChannelArgs_Value_IntValue - ValueSpecifier isGrpcService_GoogleGrpc_ChannelArgs_Value_ValueSpecifier `protobuf_oneof:"value_specifier"` -} - -func (x *GrpcService_GoogleGrpc_ChannelArgs_Value) Reset() { - *x = GrpcService_GoogleGrpc_ChannelArgs_Value{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GrpcService_GoogleGrpc_ChannelArgs_Value) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GrpcService_GoogleGrpc_ChannelArgs_Value) ProtoMessage() {} - -func (x *GrpcService_GoogleGrpc_ChannelArgs_Value) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_grpc_service_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GrpcService_GoogleGrpc_ChannelArgs_Value.ProtoReflect.Descriptor instead. -func (*GrpcService_GoogleGrpc_ChannelArgs_Value) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_grpc_service_proto_rawDescGZIP(), []int{0, 1, 4, 0} -} - -func (m *GrpcService_GoogleGrpc_ChannelArgs_Value) GetValueSpecifier() isGrpcService_GoogleGrpc_ChannelArgs_Value_ValueSpecifier { - if m != nil { - return m.ValueSpecifier - } - return nil -} - -func (x *GrpcService_GoogleGrpc_ChannelArgs_Value) GetStringValue() string { - if x, ok := x.GetValueSpecifier().(*GrpcService_GoogleGrpc_ChannelArgs_Value_StringValue); ok { - return x.StringValue - } - return "" -} - -func (x *GrpcService_GoogleGrpc_ChannelArgs_Value) GetIntValue() int64 { - if x, ok := x.GetValueSpecifier().(*GrpcService_GoogleGrpc_ChannelArgs_Value_IntValue); ok { - return x.IntValue - } - return 0 -} - -type isGrpcService_GoogleGrpc_ChannelArgs_Value_ValueSpecifier interface { - isGrpcService_GoogleGrpc_ChannelArgs_Value_ValueSpecifier() -} - -type GrpcService_GoogleGrpc_ChannelArgs_Value_StringValue struct { - StringValue string `protobuf:"bytes,1,opt,name=string_value,json=stringValue,proto3,oneof"` -} - -type GrpcService_GoogleGrpc_ChannelArgs_Value_IntValue struct { - IntValue int64 `protobuf:"varint,2,opt,name=int_value,json=intValue,proto3,oneof"` -} - -func (*GrpcService_GoogleGrpc_ChannelArgs_Value_StringValue) isGrpcService_GoogleGrpc_ChannelArgs_Value_ValueSpecifier() { -} - -func (*GrpcService_GoogleGrpc_ChannelArgs_Value_IntValue) isGrpcService_GoogleGrpc_ChannelArgs_Value_ValueSpecifier() { -} - -var File_envoy_config_core_v3_grpc_service_proto protoreflect.FileDescriptor - -var file_envoy_config_core_v3_grpc_service_proto_rawDesc = []byte{ - 0x0a, 0x27, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x1a, - 0x1f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, - 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, - 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, - 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, - 0x76, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, - 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, - 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0xd2, 0x21, 0x0a, 0x0b, 0x47, 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x12, 0x4c, 0x0a, 0x0a, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x5f, 0x67, 0x72, 0x70, - 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x47, - 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x76, 0x6f, 0x79, - 0x47, 0x72, 0x70, 0x63, 0x48, 0x00, 0x52, 0x09, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x47, 0x72, 0x70, - 0x63, 0x12, 0x4f, 0x0a, 0x0b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x5f, 0x67, 0x72, 0x70, 0x63, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x47, 0x72, - 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x47, 0x72, 0x70, 0x63, 0x48, 0x00, 0x52, 0x0a, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x47, 0x72, - 0x70, 0x63, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, - 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x4c, 0x0a, 0x10, 0x69, 0x6e, 0x69, 0x74, 0x69, - 0x61, 0x6c, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x21, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0f, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0xde, 0x01, 0x0a, 0x09, 0x45, 0x6e, 0x76, 0x6f, 0x79, 0x47, - 0x72, 0x70, 0x63, 0x12, 0x2a, 0x0a, 0x0c, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, - 0x10, 0x01, 0x52, 0x0b, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, - 0x2f, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x11, 0xfa, 0x42, 0x0e, 0x72, 0x0c, 0x10, 0x00, 0x28, 0x80, 0x80, 0x01, 0xc0, - 0x01, 0x02, 0xc8, 0x01, 0x00, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, - 0x12, 0x44, 0x0a, 0x0c, 0x72, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, - 0x74, 0x72, 0x79, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x0b, 0x72, 0x65, 0x74, 0x72, 0x79, - 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x3a, 0x2e, 0x9a, 0xc5, 0x88, 0x1e, 0x29, 0x0a, 0x27, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, - 0x2e, 0x47, 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x76, - 0x6f, 0x79, 0x47, 0x72, 0x70, 0x63, 0x1a, 0xfa, 0x1c, 0x0a, 0x0a, 0x47, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x47, 0x72, 0x70, 0x63, 0x12, 0x26, 0x0a, 0x0a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, - 0x75, 0x72, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, - 0x10, 0x01, 0x52, 0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x55, 0x72, 0x69, 0x12, 0x70, 0x0a, - 0x13, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x61, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, - 0x33, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x47, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, - 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x52, 0x12, 0x63, 0x68, 0x61, - 0x6e, 0x6e, 0x65, 0x6c, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x12, - 0x67, 0x0a, 0x10, 0x63, 0x61, 0x6c, 0x6c, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x61, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, - 0x2e, 0x47, 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x47, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x43, 0x72, 0x65, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x52, 0x0f, 0x63, 0x61, 0x6c, 0x6c, 0x43, 0x72, 0x65, - 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x12, 0x28, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x74, - 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, - 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x50, 0x72, 0x65, 0x66, - 0x69, 0x78, 0x12, 0x38, 0x0a, 0x18, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, - 0x73, 0x5f, 0x66, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, - 0x73, 0x46, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2f, 0x0a, 0x06, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, - 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x5e, 0x0a, - 0x1d, 0x70, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x62, 0x75, 0x66, 0x66, - 0x65, 0x72, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x52, 0x19, 0x70, 0x65, 0x72, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x42, 0x75, 0x66, - 0x66, 0x65, 0x72, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x5b, 0x0a, - 0x0c, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x18, 0x08, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x47, 0x72, 0x70, - 0x63, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x41, 0x72, 0x67, 0x73, 0x52, 0x0b, 0x63, - 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x9d, 0x02, 0x0a, 0x0e, 0x53, - 0x73, 0x6c, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x12, 0x3f, 0x0a, - 0x0a, 0x72, 0x6f, 0x6f, 0x74, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x20, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x53, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x52, 0x09, 0x72, 0x6f, 0x6f, 0x74, 0x43, 0x65, 0x72, 0x74, 0x73, 0x12, 0x49, - 0x0a, 0x0b, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x53, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x06, 0xb8, 0xb7, 0x8b, 0xa4, 0x02, 0x01, 0x52, 0x0a, 0x70, - 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x3f, 0x0a, 0x0a, 0x63, 0x65, 0x72, - 0x74, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, - 0x09, 0x63, 0x65, 0x72, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x3a, 0x3e, 0x9a, 0xc5, 0x88, 0x1e, - 0x39, 0x0a, 0x37, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x47, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x73, 0x6c, 0x43, - 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x1a, 0x60, 0x0a, 0x16, 0x47, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x61, 0x6c, 0x73, 0x3a, 0x46, 0x9a, 0xc5, 0x88, 0x1e, 0x41, 0x0a, 0x3f, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, - 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x47, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x4c, 0x6f, 0x63, 0x61, - 0x6c, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x1a, 0x92, 0x03, 0x0a, - 0x12, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x61, 0x6c, 0x73, 0x12, 0x66, 0x0a, 0x0f, 0x73, 0x73, 0x6c, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, - 0x2e, 0x76, 0x33, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, - 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x47, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x73, 0x6c, 0x43, 0x72, - 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x48, 0x00, 0x52, 0x0e, 0x73, 0x73, 0x6c, - 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x12, 0x3f, 0x0a, 0x0e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x48, 0x00, 0x52, 0x0d, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x72, 0x0a, 0x11, - 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, - 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x43, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x47, - 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x47, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x4c, 0x6f, 0x63, 0x61, - 0x6c, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x48, 0x00, 0x52, 0x10, - 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, - 0x3a, 0x42, 0x9a, 0xc5, 0x88, 0x1e, 0x3d, 0x0a, 0x3b, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x47, 0x72, 0x70, - 0x63, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x61, 0x6c, 0x73, 0x42, 0x1b, 0x0a, 0x14, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x61, 0x6c, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x03, 0xf8, 0x42, - 0x01, 0x1a, 0x88, 0x0f, 0x0a, 0x0f, 0x43, 0x61, 0x6c, 0x6c, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x73, 0x12, 0x23, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x61, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x4c, 0x0a, 0x15, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x65, 0x6e, 0x67, - 0x69, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x48, 0x00, 0x52, 0x13, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x75, - 0x74, 0x65, 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x12, 0x32, 0x0a, 0x14, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x5f, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x12, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x9e, 0x01, 0x0a, - 0x1a, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x5f, 0x6a, 0x77, 0x74, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x5f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x47, 0x72, 0x70, 0x63, 0x2e, - 0x43, 0x61, 0x6c, 0x6c, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4a, 0x57, - 0x54, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, - 0x6c, 0x73, 0x48, 0x00, 0x52, 0x17, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x41, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x4a, 0x77, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x72, 0x0a, - 0x0a, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x5f, 0x69, 0x61, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x51, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x47, 0x72, 0x70, 0x63, 0x2e, - 0x43, 0x61, 0x6c, 0x6c, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, - 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x49, 0x41, 0x4d, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x61, 0x6c, 0x73, 0x48, 0x00, 0x52, 0x09, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x49, 0x61, - 0x6d, 0x12, 0x7d, 0x0a, 0x0b, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x5a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x47, 0x72, - 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x47, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x43, 0x72, 0x65, - 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x46, 0x72, 0x6f, 0x6d, 0x50, 0x6c, 0x75, 0x67, - 0x69, 0x6e, 0x48, 0x00, 0x52, 0x0a, 0x66, 0x72, 0x6f, 0x6d, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, - 0x12, 0x6a, 0x0a, 0x0b, 0x73, 0x74, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x47, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x47, 0x72, 0x70, - 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x47, - 0x72, 0x70, 0x63, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x61, 0x6c, 0x73, 0x2e, 0x53, 0x74, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x48, 0x00, - 0x52, 0x0a, 0x73, 0x74, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x1a, 0xd9, 0x01, 0x0a, - 0x22, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4a, - 0x57, 0x54, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x61, 0x6c, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6a, 0x73, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x34, - 0x0a, 0x16, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, - 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x14, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x53, 0x65, 0x63, - 0x6f, 0x6e, 0x64, 0x73, 0x3a, 0x62, 0x9a, 0xc5, 0x88, 0x1e, 0x5d, 0x0a, 0x5b, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, - 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x47, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x41, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x4a, 0x57, 0x54, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x72, 0x65, - 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x1a, 0xcc, 0x01, 0x0a, 0x14, 0x47, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x49, 0x41, 0x4d, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, - 0x73, 0x12, 0x2f, 0x0a, 0x13, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, - 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x12, 0x2d, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x5f, - 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, - 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, - 0x72, 0x3a, 0x54, 0x9a, 0xc5, 0x88, 0x1e, 0x4f, 0x0a, 0x4d, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x72, 0x70, 0x63, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x47, 0x72, - 0x70, 0x63, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, - 0x6c, 0x73, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x49, 0x41, 0x4d, 0x43, 0x72, 0x65, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x1a, 0xea, 0x01, 0x0a, 0x1d, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x46, - 0x72, 0x6f, 0x6d, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x39, 0x0a, - 0x0c, 0x74, 0x79, 0x70, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x48, 0x00, 0x52, 0x0b, 0x74, 0x79, 0x70, - 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x3a, 0x5d, 0x9a, 0xc5, 0x88, 0x1e, 0x58, 0x0a, - 0x56, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x47, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x43, 0x72, - 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x46, 0x72, 0x6f, - 0x6d, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x42, 0x0d, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x4a, 0x04, 0x08, 0x02, 0x10, 0x03, 0x52, 0x06, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x1a, 0xd7, 0x03, 0x0a, 0x0a, 0x53, 0x74, 0x73, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x12, 0x3b, 0x0a, 0x1a, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x65, 0x78, 0x63, - 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x75, 0x72, - 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x17, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x45, 0x78, - 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x72, 0x69, - 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, - 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, - 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x30, - 0x0a, 0x14, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x6f, 0x6b, 0x65, - 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x72, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x35, 0x0a, 0x12, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x6f, 0x6b, 0x65, - 0x6e, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, - 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x10, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x6f, - 0x6b, 0x65, 0x6e, 0x50, 0x61, 0x74, 0x68, 0x12, 0x35, 0x0a, 0x12, 0x73, 0x75, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x10, 0x73, 0x75, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x28, - 0x0a, 0x10, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x70, 0x61, - 0x74, 0x68, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x50, 0x61, 0x74, 0x68, 0x12, 0x28, 0x0a, 0x10, 0x61, 0x63, 0x74, 0x6f, - 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0e, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x54, 0x79, - 0x70, 0x65, 0x3a, 0x4a, 0x9a, 0xc5, 0x88, 0x1e, 0x45, 0x0a, 0x43, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x72, 0x70, - 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x47, - 0x72, 0x70, 0x63, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x61, 0x6c, 0x73, 0x2e, 0x53, 0x74, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x3a, 0x3f, - 0x9a, 0xc5, 0x88, 0x1e, 0x3a, 0x0a, 0x38, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x47, 0x72, 0x70, 0x63, 0x2e, - 0x43, 0x61, 0x6c, 0x6c, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x42, - 0x1b, 0x0a, 0x14, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, 0xc3, 0x02, 0x0a, - 0x0b, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x41, 0x72, 0x67, 0x73, 0x12, 0x56, 0x0a, 0x04, - 0x61, 0x72, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x42, 0x2e, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, - 0x33, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x47, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, - 0x41, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x72, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, - 0x61, 0x72, 0x67, 0x73, 0x1a, 0x63, 0x0a, 0x05, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, - 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x12, 0x1d, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x42, 0x16, 0x0a, 0x0f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x65, 0x72, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, 0x77, 0x0a, 0x09, 0x41, 0x72, 0x67, - 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x54, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x47, - 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x47, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x41, 0x72, 0x67, - 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x3a, 0x2f, 0x9a, 0xc5, 0x88, 0x1e, 0x2a, 0x0a, 0x28, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x72, 0x70, - 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x47, - 0x72, 0x70, 0x63, 0x3a, 0x24, 0x9a, 0xc5, 0x88, 0x1e, 0x1f, 0x0a, 0x1d, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x72, - 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x17, 0x0a, 0x10, 0x74, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x03, 0xf8, - 0x42, 0x01, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x42, 0x84, 0x01, 0x0a, 0x22, 0x69, 0x6f, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x42, - 0x10, 0x47, 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, - 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, - 0x3b, 0x63, 0x6f, 0x72, 0x65, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_config_core_v3_grpc_service_proto_rawDescOnce sync.Once - file_envoy_config_core_v3_grpc_service_proto_rawDescData = file_envoy_config_core_v3_grpc_service_proto_rawDesc -) - -func file_envoy_config_core_v3_grpc_service_proto_rawDescGZIP() []byte { - file_envoy_config_core_v3_grpc_service_proto_rawDescOnce.Do(func() { - file_envoy_config_core_v3_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_config_core_v3_grpc_service_proto_rawDescData) - }) - return file_envoy_config_core_v3_grpc_service_proto_rawDescData -} - -var file_envoy_config_core_v3_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 14) -var file_envoy_config_core_v3_grpc_service_proto_goTypes = []interface{}{ - (*GrpcService)(nil), // 0: envoy.config.core.v3.GrpcService - (*GrpcService_EnvoyGrpc)(nil), // 1: envoy.config.core.v3.GrpcService.EnvoyGrpc - (*GrpcService_GoogleGrpc)(nil), // 2: envoy.config.core.v3.GrpcService.GoogleGrpc - (*GrpcService_GoogleGrpc_SslCredentials)(nil), // 3: envoy.config.core.v3.GrpcService.GoogleGrpc.SslCredentials - (*GrpcService_GoogleGrpc_GoogleLocalCredentials)(nil), // 4: envoy.config.core.v3.GrpcService.GoogleGrpc.GoogleLocalCredentials - (*GrpcService_GoogleGrpc_ChannelCredentials)(nil), // 5: envoy.config.core.v3.GrpcService.GoogleGrpc.ChannelCredentials - (*GrpcService_GoogleGrpc_CallCredentials)(nil), // 6: envoy.config.core.v3.GrpcService.GoogleGrpc.CallCredentials - (*GrpcService_GoogleGrpc_ChannelArgs)(nil), // 7: envoy.config.core.v3.GrpcService.GoogleGrpc.ChannelArgs - (*GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials)(nil), // 8: envoy.config.core.v3.GrpcService.GoogleGrpc.CallCredentials.ServiceAccountJWTAccessCredentials - (*GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials)(nil), // 9: envoy.config.core.v3.GrpcService.GoogleGrpc.CallCredentials.GoogleIAMCredentials - (*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin)(nil), // 10: envoy.config.core.v3.GrpcService.GoogleGrpc.CallCredentials.MetadataCredentialsFromPlugin - (*GrpcService_GoogleGrpc_CallCredentials_StsService)(nil), // 11: envoy.config.core.v3.GrpcService.GoogleGrpc.CallCredentials.StsService - (*GrpcService_GoogleGrpc_ChannelArgs_Value)(nil), // 12: envoy.config.core.v3.GrpcService.GoogleGrpc.ChannelArgs.Value - nil, // 13: envoy.config.core.v3.GrpcService.GoogleGrpc.ChannelArgs.ArgsEntry - (*durationpb.Duration)(nil), // 14: google.protobuf.Duration - (*HeaderValue)(nil), // 15: envoy.config.core.v3.HeaderValue - (*RetryPolicy)(nil), // 16: envoy.config.core.v3.RetryPolicy - (*structpb.Struct)(nil), // 17: google.protobuf.Struct - (*wrapperspb.UInt32Value)(nil), // 18: google.protobuf.UInt32Value - (*DataSource)(nil), // 19: envoy.config.core.v3.DataSource - (*emptypb.Empty)(nil), // 20: google.protobuf.Empty - (*anypb.Any)(nil), // 21: google.protobuf.Any -} -var file_envoy_config_core_v3_grpc_service_proto_depIdxs = []int32{ - 1, // 0: envoy.config.core.v3.GrpcService.envoy_grpc:type_name -> envoy.config.core.v3.GrpcService.EnvoyGrpc - 2, // 1: envoy.config.core.v3.GrpcService.google_grpc:type_name -> envoy.config.core.v3.GrpcService.GoogleGrpc - 14, // 2: envoy.config.core.v3.GrpcService.timeout:type_name -> google.protobuf.Duration - 15, // 3: envoy.config.core.v3.GrpcService.initial_metadata:type_name -> envoy.config.core.v3.HeaderValue - 16, // 4: envoy.config.core.v3.GrpcService.EnvoyGrpc.retry_policy:type_name -> envoy.config.core.v3.RetryPolicy - 5, // 5: envoy.config.core.v3.GrpcService.GoogleGrpc.channel_credentials:type_name -> envoy.config.core.v3.GrpcService.GoogleGrpc.ChannelCredentials - 6, // 6: envoy.config.core.v3.GrpcService.GoogleGrpc.call_credentials:type_name -> envoy.config.core.v3.GrpcService.GoogleGrpc.CallCredentials - 17, // 7: envoy.config.core.v3.GrpcService.GoogleGrpc.config:type_name -> google.protobuf.Struct - 18, // 8: envoy.config.core.v3.GrpcService.GoogleGrpc.per_stream_buffer_limit_bytes:type_name -> google.protobuf.UInt32Value - 7, // 9: envoy.config.core.v3.GrpcService.GoogleGrpc.channel_args:type_name -> envoy.config.core.v3.GrpcService.GoogleGrpc.ChannelArgs - 19, // 10: envoy.config.core.v3.GrpcService.GoogleGrpc.SslCredentials.root_certs:type_name -> envoy.config.core.v3.DataSource - 19, // 11: envoy.config.core.v3.GrpcService.GoogleGrpc.SslCredentials.private_key:type_name -> envoy.config.core.v3.DataSource - 19, // 12: envoy.config.core.v3.GrpcService.GoogleGrpc.SslCredentials.cert_chain:type_name -> envoy.config.core.v3.DataSource - 3, // 13: envoy.config.core.v3.GrpcService.GoogleGrpc.ChannelCredentials.ssl_credentials:type_name -> envoy.config.core.v3.GrpcService.GoogleGrpc.SslCredentials - 20, // 14: envoy.config.core.v3.GrpcService.GoogleGrpc.ChannelCredentials.google_default:type_name -> google.protobuf.Empty - 4, // 15: envoy.config.core.v3.GrpcService.GoogleGrpc.ChannelCredentials.local_credentials:type_name -> envoy.config.core.v3.GrpcService.GoogleGrpc.GoogleLocalCredentials - 20, // 16: envoy.config.core.v3.GrpcService.GoogleGrpc.CallCredentials.google_compute_engine:type_name -> google.protobuf.Empty - 8, // 17: envoy.config.core.v3.GrpcService.GoogleGrpc.CallCredentials.service_account_jwt_access:type_name -> envoy.config.core.v3.GrpcService.GoogleGrpc.CallCredentials.ServiceAccountJWTAccessCredentials - 9, // 18: envoy.config.core.v3.GrpcService.GoogleGrpc.CallCredentials.google_iam:type_name -> envoy.config.core.v3.GrpcService.GoogleGrpc.CallCredentials.GoogleIAMCredentials - 10, // 19: envoy.config.core.v3.GrpcService.GoogleGrpc.CallCredentials.from_plugin:type_name -> envoy.config.core.v3.GrpcService.GoogleGrpc.CallCredentials.MetadataCredentialsFromPlugin - 11, // 20: envoy.config.core.v3.GrpcService.GoogleGrpc.CallCredentials.sts_service:type_name -> envoy.config.core.v3.GrpcService.GoogleGrpc.CallCredentials.StsService - 13, // 21: envoy.config.core.v3.GrpcService.GoogleGrpc.ChannelArgs.args:type_name -> envoy.config.core.v3.GrpcService.GoogleGrpc.ChannelArgs.ArgsEntry - 21, // 22: envoy.config.core.v3.GrpcService.GoogleGrpc.CallCredentials.MetadataCredentialsFromPlugin.typed_config:type_name -> google.protobuf.Any - 12, // 23: envoy.config.core.v3.GrpcService.GoogleGrpc.ChannelArgs.ArgsEntry.value:type_name -> envoy.config.core.v3.GrpcService.GoogleGrpc.ChannelArgs.Value - 24, // [24:24] is the sub-list for method output_type - 24, // [24:24] is the sub-list for method input_type - 24, // [24:24] is the sub-list for extension type_name - 24, // [24:24] is the sub-list for extension extendee - 0, // [0:24] is the sub-list for field type_name -} - -func init() { file_envoy_config_core_v3_grpc_service_proto_init() } -func file_envoy_config_core_v3_grpc_service_proto_init() { - if File_envoy_config_core_v3_grpc_service_proto != nil { - return - } - file_envoy_config_core_v3_base_proto_init() - if !protoimpl.UnsafeEnabled { - file_envoy_config_core_v3_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GrpcService); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GrpcService_EnvoyGrpc); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GrpcService_GoogleGrpc); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GrpcService_GoogleGrpc_SslCredentials); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_grpc_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GrpcService_GoogleGrpc_GoogleLocalCredentials); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_grpc_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GrpcService_GoogleGrpc_ChannelCredentials); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_grpc_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GrpcService_GoogleGrpc_CallCredentials); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_grpc_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GrpcService_GoogleGrpc_ChannelArgs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_grpc_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_grpc_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_grpc_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_grpc_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GrpcService_GoogleGrpc_CallCredentials_StsService); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_grpc_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GrpcService_GoogleGrpc_ChannelArgs_Value); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_config_core_v3_grpc_service_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*GrpcService_EnvoyGrpc_)(nil), - (*GrpcService_GoogleGrpc_)(nil), - } - file_envoy_config_core_v3_grpc_service_proto_msgTypes[5].OneofWrappers = []interface{}{ - (*GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials)(nil), - (*GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault)(nil), - (*GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials)(nil), - } - file_envoy_config_core_v3_grpc_service_proto_msgTypes[6].OneofWrappers = []interface{}{ - (*GrpcService_GoogleGrpc_CallCredentials_AccessToken)(nil), - (*GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine)(nil), - (*GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken)(nil), - (*GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess)(nil), - (*GrpcService_GoogleGrpc_CallCredentials_GoogleIam)(nil), - (*GrpcService_GoogleGrpc_CallCredentials_FromPlugin)(nil), - (*GrpcService_GoogleGrpc_CallCredentials_StsService_)(nil), - } - file_envoy_config_core_v3_grpc_service_proto_msgTypes[10].OneofWrappers = []interface{}{ - (*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_TypedConfig)(nil), - } - file_envoy_config_core_v3_grpc_service_proto_msgTypes[12].OneofWrappers = []interface{}{ - (*GrpcService_GoogleGrpc_ChannelArgs_Value_StringValue)(nil), - (*GrpcService_GoogleGrpc_ChannelArgs_Value_IntValue)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_config_core_v3_grpc_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 14, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_config_core_v3_grpc_service_proto_goTypes, - DependencyIndexes: file_envoy_config_core_v3_grpc_service_proto_depIdxs, - MessageInfos: file_envoy_config_core_v3_grpc_service_proto_msgTypes, - }.Build() - File_envoy_config_core_v3_grpc_service_proto = out.File - file_envoy_config_core_v3_grpc_service_proto_rawDesc = nil - file_envoy_config_core_v3_grpc_service_proto_goTypes = nil - file_envoy_config_core_v3_grpc_service_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/grpc_service.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/grpc_service.pb.validate.go deleted file mode 100644 index 8fd252375..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/grpc_service.pb.validate.go +++ /dev/null @@ -1,2518 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/config/core/v3/grpc_service.proto - -package corev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on GrpcService with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *GrpcService) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GrpcService with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in GrpcServiceMultiError, or -// nil if none found. -func (m *GrpcService) ValidateAll() error { - return m.validate(true) -} - -func (m *GrpcService) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetTimeout()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcServiceValidationError{ - field: "Timeout", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcServiceValidationError{ - field: "Timeout", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTimeout()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcServiceValidationError{ - field: "Timeout", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetInitialMetadata() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcServiceValidationError{ - field: fmt.Sprintf("InitialMetadata[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcServiceValidationError{ - field: fmt.Sprintf("InitialMetadata[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcServiceValidationError{ - field: fmt.Sprintf("InitialMetadata[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - oneofTargetSpecifierPresent := false - switch v := m.TargetSpecifier.(type) { - case *GrpcService_EnvoyGrpc_: - if v == nil { - err := GrpcServiceValidationError{ - field: "TargetSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofTargetSpecifierPresent = true - - if all { - switch v := interface{}(m.GetEnvoyGrpc()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcServiceValidationError{ - field: "EnvoyGrpc", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcServiceValidationError{ - field: "EnvoyGrpc", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetEnvoyGrpc()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcServiceValidationError{ - field: "EnvoyGrpc", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *GrpcService_GoogleGrpc_: - if v == nil { - err := GrpcServiceValidationError{ - field: "TargetSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofTargetSpecifierPresent = true - - if all { - switch v := interface{}(m.GetGoogleGrpc()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcServiceValidationError{ - field: "GoogleGrpc", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcServiceValidationError{ - field: "GoogleGrpc", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetGoogleGrpc()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcServiceValidationError{ - field: "GoogleGrpc", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofTargetSpecifierPresent { - err := GrpcServiceValidationError{ - field: "TargetSpecifier", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return GrpcServiceMultiError(errors) - } - - return nil -} - -// GrpcServiceMultiError is an error wrapping multiple validation errors -// returned by GrpcService.ValidateAll() if the designated constraints aren't met. -type GrpcServiceMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GrpcServiceMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GrpcServiceMultiError) AllErrors() []error { return m } - -// GrpcServiceValidationError is the validation error returned by -// GrpcService.Validate if the designated constraints aren't met. -type GrpcServiceValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GrpcServiceValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GrpcServiceValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GrpcServiceValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GrpcServiceValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GrpcServiceValidationError) ErrorName() string { return "GrpcServiceValidationError" } - -// Error satisfies the builtin error interface -func (e GrpcServiceValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGrpcService.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GrpcServiceValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GrpcServiceValidationError{} - -// Validate checks the field values on GrpcService_EnvoyGrpc with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *GrpcService_EnvoyGrpc) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GrpcService_EnvoyGrpc with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GrpcService_EnvoyGrpcMultiError, or nil if none found. -func (m *GrpcService_EnvoyGrpc) ValidateAll() error { - return m.validate(true) -} - -func (m *GrpcService_EnvoyGrpc) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetClusterName()) < 1 { - err := GrpcService_EnvoyGrpcValidationError{ - field: "ClusterName", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if utf8.RuneCountInString(m.GetAuthority()) < 0 { - err := GrpcService_EnvoyGrpcValidationError{ - field: "Authority", - reason: "value length must be at least 0 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(m.GetAuthority()) > 16384 { - err := GrpcService_EnvoyGrpcValidationError{ - field: "Authority", - reason: "value length must be at most 16384 bytes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_GrpcService_EnvoyGrpc_Authority_Pattern.MatchString(m.GetAuthority()) { - err := GrpcService_EnvoyGrpcValidationError{ - field: "Authority", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetRetryPolicy()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcService_EnvoyGrpcValidationError{ - field: "RetryPolicy", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcService_EnvoyGrpcValidationError{ - field: "RetryPolicy", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRetryPolicy()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcService_EnvoyGrpcValidationError{ - field: "RetryPolicy", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return GrpcService_EnvoyGrpcMultiError(errors) - } - - return nil -} - -// GrpcService_EnvoyGrpcMultiError is an error wrapping multiple validation -// errors returned by GrpcService_EnvoyGrpc.ValidateAll() if the designated -// constraints aren't met. -type GrpcService_EnvoyGrpcMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GrpcService_EnvoyGrpcMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GrpcService_EnvoyGrpcMultiError) AllErrors() []error { return m } - -// GrpcService_EnvoyGrpcValidationError is the validation error returned by -// GrpcService_EnvoyGrpc.Validate if the designated constraints aren't met. -type GrpcService_EnvoyGrpcValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GrpcService_EnvoyGrpcValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GrpcService_EnvoyGrpcValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GrpcService_EnvoyGrpcValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GrpcService_EnvoyGrpcValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GrpcService_EnvoyGrpcValidationError) ErrorName() string { - return "GrpcService_EnvoyGrpcValidationError" -} - -// Error satisfies the builtin error interface -func (e GrpcService_EnvoyGrpcValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGrpcService_EnvoyGrpc.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GrpcService_EnvoyGrpcValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GrpcService_EnvoyGrpcValidationError{} - -var _GrpcService_EnvoyGrpc_Authority_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -// Validate checks the field values on GrpcService_GoogleGrpc with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *GrpcService_GoogleGrpc) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GrpcService_GoogleGrpc with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GrpcService_GoogleGrpcMultiError, or nil if none found. -func (m *GrpcService_GoogleGrpc) ValidateAll() error { - return m.validate(true) -} - -func (m *GrpcService_GoogleGrpc) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetTargetUri()) < 1 { - err := GrpcService_GoogleGrpcValidationError{ - field: "TargetUri", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetChannelCredentials()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcService_GoogleGrpcValidationError{ - field: "ChannelCredentials", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcService_GoogleGrpcValidationError{ - field: "ChannelCredentials", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetChannelCredentials()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcService_GoogleGrpcValidationError{ - field: "ChannelCredentials", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetCallCredentials() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcService_GoogleGrpcValidationError{ - field: fmt.Sprintf("CallCredentials[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcService_GoogleGrpcValidationError{ - field: fmt.Sprintf("CallCredentials[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcService_GoogleGrpcValidationError{ - field: fmt.Sprintf("CallCredentials[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if utf8.RuneCountInString(m.GetStatPrefix()) < 1 { - err := GrpcService_GoogleGrpcValidationError{ - field: "StatPrefix", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for CredentialsFactoryName - - if all { - switch v := interface{}(m.GetConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcService_GoogleGrpcValidationError{ - field: "Config", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcService_GoogleGrpcValidationError{ - field: "Config", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcService_GoogleGrpcValidationError{ - field: "Config", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetPerStreamBufferLimitBytes()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcService_GoogleGrpcValidationError{ - field: "PerStreamBufferLimitBytes", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcService_GoogleGrpcValidationError{ - field: "PerStreamBufferLimitBytes", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPerStreamBufferLimitBytes()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcService_GoogleGrpcValidationError{ - field: "PerStreamBufferLimitBytes", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetChannelArgs()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcService_GoogleGrpcValidationError{ - field: "ChannelArgs", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcService_GoogleGrpcValidationError{ - field: "ChannelArgs", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetChannelArgs()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcService_GoogleGrpcValidationError{ - field: "ChannelArgs", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return GrpcService_GoogleGrpcMultiError(errors) - } - - return nil -} - -// GrpcService_GoogleGrpcMultiError is an error wrapping multiple validation -// errors returned by GrpcService_GoogleGrpc.ValidateAll() if the designated -// constraints aren't met. -type GrpcService_GoogleGrpcMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GrpcService_GoogleGrpcMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GrpcService_GoogleGrpcMultiError) AllErrors() []error { return m } - -// GrpcService_GoogleGrpcValidationError is the validation error returned by -// GrpcService_GoogleGrpc.Validate if the designated constraints aren't met. -type GrpcService_GoogleGrpcValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GrpcService_GoogleGrpcValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GrpcService_GoogleGrpcValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GrpcService_GoogleGrpcValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GrpcService_GoogleGrpcValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GrpcService_GoogleGrpcValidationError) ErrorName() string { - return "GrpcService_GoogleGrpcValidationError" -} - -// Error satisfies the builtin error interface -func (e GrpcService_GoogleGrpcValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGrpcService_GoogleGrpc.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GrpcService_GoogleGrpcValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GrpcService_GoogleGrpcValidationError{} - -// Validate checks the field values on GrpcService_GoogleGrpc_SslCredentials -// with the rules defined in the proto definition for this message. If any -// rules are violated, the first error encountered is returned, or nil if -// there are no violations. -func (m *GrpcService_GoogleGrpc_SslCredentials) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GrpcService_GoogleGrpc_SslCredentials -// with the rules defined in the proto definition for this message. If any -// rules are violated, the result is a list of violation errors wrapped in -// GrpcService_GoogleGrpc_SslCredentialsMultiError, or nil if none found. -func (m *GrpcService_GoogleGrpc_SslCredentials) ValidateAll() error { - return m.validate(true) -} - -func (m *GrpcService_GoogleGrpc_SslCredentials) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetRootCerts()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_SslCredentialsValidationError{ - field: "RootCerts", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_SslCredentialsValidationError{ - field: "RootCerts", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRootCerts()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcService_GoogleGrpc_SslCredentialsValidationError{ - field: "RootCerts", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetPrivateKey()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_SslCredentialsValidationError{ - field: "PrivateKey", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_SslCredentialsValidationError{ - field: "PrivateKey", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPrivateKey()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcService_GoogleGrpc_SslCredentialsValidationError{ - field: "PrivateKey", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetCertChain()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_SslCredentialsValidationError{ - field: "CertChain", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_SslCredentialsValidationError{ - field: "CertChain", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCertChain()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcService_GoogleGrpc_SslCredentialsValidationError{ - field: "CertChain", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return GrpcService_GoogleGrpc_SslCredentialsMultiError(errors) - } - - return nil -} - -// GrpcService_GoogleGrpc_SslCredentialsMultiError is an error wrapping -// multiple validation errors returned by -// GrpcService_GoogleGrpc_SslCredentials.ValidateAll() if the designated -// constraints aren't met. -type GrpcService_GoogleGrpc_SslCredentialsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GrpcService_GoogleGrpc_SslCredentialsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GrpcService_GoogleGrpc_SslCredentialsMultiError) AllErrors() []error { return m } - -// GrpcService_GoogleGrpc_SslCredentialsValidationError is the validation error -// returned by GrpcService_GoogleGrpc_SslCredentials.Validate if the -// designated constraints aren't met. -type GrpcService_GoogleGrpc_SslCredentialsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GrpcService_GoogleGrpc_SslCredentialsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GrpcService_GoogleGrpc_SslCredentialsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GrpcService_GoogleGrpc_SslCredentialsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GrpcService_GoogleGrpc_SslCredentialsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GrpcService_GoogleGrpc_SslCredentialsValidationError) ErrorName() string { - return "GrpcService_GoogleGrpc_SslCredentialsValidationError" -} - -// Error satisfies the builtin error interface -func (e GrpcService_GoogleGrpc_SslCredentialsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGrpcService_GoogleGrpc_SslCredentials.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GrpcService_GoogleGrpc_SslCredentialsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GrpcService_GoogleGrpc_SslCredentialsValidationError{} - -// Validate checks the field values on -// GrpcService_GoogleGrpc_GoogleLocalCredentials with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *GrpcService_GoogleGrpc_GoogleLocalCredentials) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on -// GrpcService_GoogleGrpc_GoogleLocalCredentials with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in -// GrpcService_GoogleGrpc_GoogleLocalCredentialsMultiError, or nil if none found. -func (m *GrpcService_GoogleGrpc_GoogleLocalCredentials) ValidateAll() error { - return m.validate(true) -} - -func (m *GrpcService_GoogleGrpc_GoogleLocalCredentials) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return GrpcService_GoogleGrpc_GoogleLocalCredentialsMultiError(errors) - } - - return nil -} - -// GrpcService_GoogleGrpc_GoogleLocalCredentialsMultiError is an error wrapping -// multiple validation errors returned by -// GrpcService_GoogleGrpc_GoogleLocalCredentials.ValidateAll() if the -// designated constraints aren't met. -type GrpcService_GoogleGrpc_GoogleLocalCredentialsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GrpcService_GoogleGrpc_GoogleLocalCredentialsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GrpcService_GoogleGrpc_GoogleLocalCredentialsMultiError) AllErrors() []error { return m } - -// GrpcService_GoogleGrpc_GoogleLocalCredentialsValidationError is the -// validation error returned by -// GrpcService_GoogleGrpc_GoogleLocalCredentials.Validate if the designated -// constraints aren't met. -type GrpcService_GoogleGrpc_GoogleLocalCredentialsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GrpcService_GoogleGrpc_GoogleLocalCredentialsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GrpcService_GoogleGrpc_GoogleLocalCredentialsValidationError) Reason() string { - return e.reason -} - -// Cause function returns cause value. -func (e GrpcService_GoogleGrpc_GoogleLocalCredentialsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GrpcService_GoogleGrpc_GoogleLocalCredentialsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GrpcService_GoogleGrpc_GoogleLocalCredentialsValidationError) ErrorName() string { - return "GrpcService_GoogleGrpc_GoogleLocalCredentialsValidationError" -} - -// Error satisfies the builtin error interface -func (e GrpcService_GoogleGrpc_GoogleLocalCredentialsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGrpcService_GoogleGrpc_GoogleLocalCredentials.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GrpcService_GoogleGrpc_GoogleLocalCredentialsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GrpcService_GoogleGrpc_GoogleLocalCredentialsValidationError{} - -// Validate checks the field values on -// GrpcService_GoogleGrpc_ChannelCredentials with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *GrpcService_GoogleGrpc_ChannelCredentials) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on -// GrpcService_GoogleGrpc_ChannelCredentials with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in -// GrpcService_GoogleGrpc_ChannelCredentialsMultiError, or nil if none found. -func (m *GrpcService_GoogleGrpc_ChannelCredentials) ValidateAll() error { - return m.validate(true) -} - -func (m *GrpcService_GoogleGrpc_ChannelCredentials) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofCredentialSpecifierPresent := false - switch v := m.CredentialSpecifier.(type) { - case *GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials: - if v == nil { - err := GrpcService_GoogleGrpc_ChannelCredentialsValidationError{ - field: "CredentialSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofCredentialSpecifierPresent = true - - if all { - switch v := interface{}(m.GetSslCredentials()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_ChannelCredentialsValidationError{ - field: "SslCredentials", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_ChannelCredentialsValidationError{ - field: "SslCredentials", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSslCredentials()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcService_GoogleGrpc_ChannelCredentialsValidationError{ - field: "SslCredentials", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault: - if v == nil { - err := GrpcService_GoogleGrpc_ChannelCredentialsValidationError{ - field: "CredentialSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofCredentialSpecifierPresent = true - - if all { - switch v := interface{}(m.GetGoogleDefault()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_ChannelCredentialsValidationError{ - field: "GoogleDefault", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_ChannelCredentialsValidationError{ - field: "GoogleDefault", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetGoogleDefault()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcService_GoogleGrpc_ChannelCredentialsValidationError{ - field: "GoogleDefault", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials: - if v == nil { - err := GrpcService_GoogleGrpc_ChannelCredentialsValidationError{ - field: "CredentialSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofCredentialSpecifierPresent = true - - if all { - switch v := interface{}(m.GetLocalCredentials()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_ChannelCredentialsValidationError{ - field: "LocalCredentials", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_ChannelCredentialsValidationError{ - field: "LocalCredentials", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetLocalCredentials()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcService_GoogleGrpc_ChannelCredentialsValidationError{ - field: "LocalCredentials", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofCredentialSpecifierPresent { - err := GrpcService_GoogleGrpc_ChannelCredentialsValidationError{ - field: "CredentialSpecifier", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return GrpcService_GoogleGrpc_ChannelCredentialsMultiError(errors) - } - - return nil -} - -// GrpcService_GoogleGrpc_ChannelCredentialsMultiError is an error wrapping -// multiple validation errors returned by -// GrpcService_GoogleGrpc_ChannelCredentials.ValidateAll() if the designated -// constraints aren't met. -type GrpcService_GoogleGrpc_ChannelCredentialsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GrpcService_GoogleGrpc_ChannelCredentialsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GrpcService_GoogleGrpc_ChannelCredentialsMultiError) AllErrors() []error { return m } - -// GrpcService_GoogleGrpc_ChannelCredentialsValidationError is the validation -// error returned by GrpcService_GoogleGrpc_ChannelCredentials.Validate if the -// designated constraints aren't met. -type GrpcService_GoogleGrpc_ChannelCredentialsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GrpcService_GoogleGrpc_ChannelCredentialsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GrpcService_GoogleGrpc_ChannelCredentialsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GrpcService_GoogleGrpc_ChannelCredentialsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GrpcService_GoogleGrpc_ChannelCredentialsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GrpcService_GoogleGrpc_ChannelCredentialsValidationError) ErrorName() string { - return "GrpcService_GoogleGrpc_ChannelCredentialsValidationError" -} - -// Error satisfies the builtin error interface -func (e GrpcService_GoogleGrpc_ChannelCredentialsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGrpcService_GoogleGrpc_ChannelCredentials.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GrpcService_GoogleGrpc_ChannelCredentialsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GrpcService_GoogleGrpc_ChannelCredentialsValidationError{} - -// Validate checks the field values on GrpcService_GoogleGrpc_CallCredentials -// with the rules defined in the proto definition for this message. If any -// rules are violated, the first error encountered is returned, or nil if -// there are no violations. -func (m *GrpcService_GoogleGrpc_CallCredentials) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on -// GrpcService_GoogleGrpc_CallCredentials with the rules defined in the proto -// definition for this message. If any rules are violated, the result is a -// list of violation errors wrapped in -// GrpcService_GoogleGrpc_CallCredentialsMultiError, or nil if none found. -func (m *GrpcService_GoogleGrpc_CallCredentials) ValidateAll() error { - return m.validate(true) -} - -func (m *GrpcService_GoogleGrpc_CallCredentials) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofCredentialSpecifierPresent := false - switch v := m.CredentialSpecifier.(type) { - case *GrpcService_GoogleGrpc_CallCredentials_AccessToken: - if v == nil { - err := GrpcService_GoogleGrpc_CallCredentialsValidationError{ - field: "CredentialSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofCredentialSpecifierPresent = true - // no validation rules for AccessToken - case *GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine: - if v == nil { - err := GrpcService_GoogleGrpc_CallCredentialsValidationError{ - field: "CredentialSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofCredentialSpecifierPresent = true - - if all { - switch v := interface{}(m.GetGoogleComputeEngine()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_CallCredentialsValidationError{ - field: "GoogleComputeEngine", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_CallCredentialsValidationError{ - field: "GoogleComputeEngine", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetGoogleComputeEngine()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcService_GoogleGrpc_CallCredentialsValidationError{ - field: "GoogleComputeEngine", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken: - if v == nil { - err := GrpcService_GoogleGrpc_CallCredentialsValidationError{ - field: "CredentialSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofCredentialSpecifierPresent = true - // no validation rules for GoogleRefreshToken - case *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess: - if v == nil { - err := GrpcService_GoogleGrpc_CallCredentialsValidationError{ - field: "CredentialSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofCredentialSpecifierPresent = true - - if all { - switch v := interface{}(m.GetServiceAccountJwtAccess()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_CallCredentialsValidationError{ - field: "ServiceAccountJwtAccess", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_CallCredentialsValidationError{ - field: "ServiceAccountJwtAccess", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetServiceAccountJwtAccess()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcService_GoogleGrpc_CallCredentialsValidationError{ - field: "ServiceAccountJwtAccess", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *GrpcService_GoogleGrpc_CallCredentials_GoogleIam: - if v == nil { - err := GrpcService_GoogleGrpc_CallCredentialsValidationError{ - field: "CredentialSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofCredentialSpecifierPresent = true - - if all { - switch v := interface{}(m.GetGoogleIam()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_CallCredentialsValidationError{ - field: "GoogleIam", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_CallCredentialsValidationError{ - field: "GoogleIam", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetGoogleIam()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcService_GoogleGrpc_CallCredentialsValidationError{ - field: "GoogleIam", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *GrpcService_GoogleGrpc_CallCredentials_FromPlugin: - if v == nil { - err := GrpcService_GoogleGrpc_CallCredentialsValidationError{ - field: "CredentialSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofCredentialSpecifierPresent = true - - if all { - switch v := interface{}(m.GetFromPlugin()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_CallCredentialsValidationError{ - field: "FromPlugin", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_CallCredentialsValidationError{ - field: "FromPlugin", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetFromPlugin()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcService_GoogleGrpc_CallCredentialsValidationError{ - field: "FromPlugin", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *GrpcService_GoogleGrpc_CallCredentials_StsService_: - if v == nil { - err := GrpcService_GoogleGrpc_CallCredentialsValidationError{ - field: "CredentialSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofCredentialSpecifierPresent = true - - if all { - switch v := interface{}(m.GetStsService()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_CallCredentialsValidationError{ - field: "StsService", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_CallCredentialsValidationError{ - field: "StsService", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetStsService()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcService_GoogleGrpc_CallCredentialsValidationError{ - field: "StsService", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofCredentialSpecifierPresent { - err := GrpcService_GoogleGrpc_CallCredentialsValidationError{ - field: "CredentialSpecifier", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return GrpcService_GoogleGrpc_CallCredentialsMultiError(errors) - } - - return nil -} - -// GrpcService_GoogleGrpc_CallCredentialsMultiError is an error wrapping -// multiple validation errors returned by -// GrpcService_GoogleGrpc_CallCredentials.ValidateAll() if the designated -// constraints aren't met. -type GrpcService_GoogleGrpc_CallCredentialsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GrpcService_GoogleGrpc_CallCredentialsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GrpcService_GoogleGrpc_CallCredentialsMultiError) AllErrors() []error { return m } - -// GrpcService_GoogleGrpc_CallCredentialsValidationError is the validation -// error returned by GrpcService_GoogleGrpc_CallCredentials.Validate if the -// designated constraints aren't met. -type GrpcService_GoogleGrpc_CallCredentialsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GrpcService_GoogleGrpc_CallCredentialsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GrpcService_GoogleGrpc_CallCredentialsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GrpcService_GoogleGrpc_CallCredentialsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GrpcService_GoogleGrpc_CallCredentialsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GrpcService_GoogleGrpc_CallCredentialsValidationError) ErrorName() string { - return "GrpcService_GoogleGrpc_CallCredentialsValidationError" -} - -// Error satisfies the builtin error interface -func (e GrpcService_GoogleGrpc_CallCredentialsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGrpcService_GoogleGrpc_CallCredentials.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GrpcService_GoogleGrpc_CallCredentialsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GrpcService_GoogleGrpc_CallCredentialsValidationError{} - -// Validate checks the field values on GrpcService_GoogleGrpc_ChannelArgs with -// the rules defined in the proto definition for this message. If any rules -// are violated, the first error encountered is returned, or nil if there are -// no violations. -func (m *GrpcService_GoogleGrpc_ChannelArgs) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GrpcService_GoogleGrpc_ChannelArgs -// with the rules defined in the proto definition for this message. If any -// rules are violated, the result is a list of violation errors wrapped in -// GrpcService_GoogleGrpc_ChannelArgsMultiError, or nil if none found. -func (m *GrpcService_GoogleGrpc_ChannelArgs) ValidateAll() error { - return m.validate(true) -} - -func (m *GrpcService_GoogleGrpc_ChannelArgs) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - { - sorted_keys := make([]string, len(m.GetArgs())) - i := 0 - for key := range m.GetArgs() { - sorted_keys[i] = key - i++ - } - sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] }) - for _, key := range sorted_keys { - val := m.GetArgs()[key] - _ = val - - // no validation rules for Args[key] - - if all { - switch v := interface{}(val).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_ChannelArgsValidationError{ - field: fmt.Sprintf("Args[%v]", key), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_ChannelArgsValidationError{ - field: fmt.Sprintf("Args[%v]", key), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(val).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcService_GoogleGrpc_ChannelArgsValidationError{ - field: fmt.Sprintf("Args[%v]", key), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - } - - if len(errors) > 0 { - return GrpcService_GoogleGrpc_ChannelArgsMultiError(errors) - } - - return nil -} - -// GrpcService_GoogleGrpc_ChannelArgsMultiError is an error wrapping multiple -// validation errors returned by -// GrpcService_GoogleGrpc_ChannelArgs.ValidateAll() if the designated -// constraints aren't met. -type GrpcService_GoogleGrpc_ChannelArgsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GrpcService_GoogleGrpc_ChannelArgsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GrpcService_GoogleGrpc_ChannelArgsMultiError) AllErrors() []error { return m } - -// GrpcService_GoogleGrpc_ChannelArgsValidationError is the validation error -// returned by GrpcService_GoogleGrpc_ChannelArgs.Validate if the designated -// constraints aren't met. -type GrpcService_GoogleGrpc_ChannelArgsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GrpcService_GoogleGrpc_ChannelArgsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GrpcService_GoogleGrpc_ChannelArgsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GrpcService_GoogleGrpc_ChannelArgsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GrpcService_GoogleGrpc_ChannelArgsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GrpcService_GoogleGrpc_ChannelArgsValidationError) ErrorName() string { - return "GrpcService_GoogleGrpc_ChannelArgsValidationError" -} - -// Error satisfies the builtin error interface -func (e GrpcService_GoogleGrpc_ChannelArgsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGrpcService_GoogleGrpc_ChannelArgs.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GrpcService_GoogleGrpc_ChannelArgsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GrpcService_GoogleGrpc_ChannelArgsValidationError{} - -// Validate checks the field values on -// GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials -// with the rules defined in the proto definition for this message. If any -// rules are violated, the first error encountered is returned, or nil if -// there are no violations. -func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on -// GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials -// with the rules defined in the proto definition for this message. If any -// rules are violated, the result is a list of violation errors wrapped in -// GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentialsMultiError, -// or nil if none found. -func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) ValidateAll() error { - return m.validate(true) -} - -func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for JsonKey - - // no validation rules for TokenLifetimeSeconds - - if len(errors) > 0 { - return GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentialsMultiError(errors) - } - - return nil -} - -// GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentialsMultiError -// is an error wrapping multiple validation errors returned by -// GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials.ValidateAll() -// if the designated constraints aren't met. -type GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentialsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentialsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentialsMultiError) AllErrors() []error { - return m -} - -// GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentialsValidationError -// is the validation error returned by -// GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials.Validate -// if the designated constraints aren't met. -type GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentialsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentialsValidationError) Field() string { - return e.field -} - -// Reason function returns reason value. -func (e GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentialsValidationError) Reason() string { - return e.reason -} - -// Cause function returns cause value. -func (e GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentialsValidationError) Cause() error { - return e.cause -} - -// Key function returns key value. -func (e GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentialsValidationError) Key() bool { - return e.key -} - -// ErrorName returns error name. -func (e GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentialsValidationError) ErrorName() string { - return "GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentialsValidationError" -} - -// Error satisfies the builtin error interface -func (e GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentialsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentialsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentialsValidationError{} - -// Validate checks the field values on -// GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on -// GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentialsMultiError, or -// nil if none found. -func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) ValidateAll() error { - return m.validate(true) -} - -func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for AuthorizationToken - - // no validation rules for AuthoritySelector - - if len(errors) > 0 { - return GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentialsMultiError(errors) - } - - return nil -} - -// GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentialsMultiError is an -// error wrapping multiple validation errors returned by -// GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials.ValidateAll() -// if the designated constraints aren't met. -type GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentialsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentialsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentialsMultiError) AllErrors() []error { - return m -} - -// GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentialsValidationError -// is the validation error returned by -// GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials.Validate if the -// designated constraints aren't met. -type GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentialsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentialsValidationError) Field() string { - return e.field -} - -// Reason function returns reason value. -func (e GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentialsValidationError) Reason() string { - return e.reason -} - -// Cause function returns cause value. -func (e GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentialsValidationError) Cause() error { - return e.cause -} - -// Key function returns key value. -func (e GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentialsValidationError) Key() bool { - return e.key -} - -// ErrorName returns error name. -func (e GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentialsValidationError) ErrorName() string { - return "GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentialsValidationError" -} - -// Error satisfies the builtin error interface -func (e GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentialsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentialsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentialsValidationError{} - -// Validate checks the field values on -// GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin with -// the rules defined in the proto definition for this message. If any rules -// are violated, the first error encountered is returned, or nil if there are -// no violations. -func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on -// GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginMultiError, -// or nil if none found. -func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) ValidateAll() error { - return m.validate(true) -} - -func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Name - - switch v := m.ConfigType.(type) { - case *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_TypedConfig: - if v == nil { - err := GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginValidationError{ - field: "ConfigType", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetTypedConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginValidationError{ - field: "TypedConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginValidationError{ - field: "TypedConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginValidationError{ - field: "TypedConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginMultiError(errors) - } - - return nil -} - -// GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginMultiError -// is an error wrapping multiple validation errors returned by -// GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin.ValidateAll() -// if the designated constraints aren't met. -type GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginMultiError) AllErrors() []error { - return m -} - -// GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginValidationError -// is the validation error returned by -// GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin.Validate -// if the designated constraints aren't met. -type GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginValidationError) Field() string { - return e.field -} - -// Reason function returns reason value. -func (e GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginValidationError) Reason() string { - return e.reason -} - -// Cause function returns cause value. -func (e GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginValidationError) Cause() error { - return e.cause -} - -// Key function returns key value. -func (e GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginValidationError) Key() bool { - return e.key -} - -// ErrorName returns error name. -func (e GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginValidationError) ErrorName() string { - return "GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginValidationError" -} - -// Error satisfies the builtin error interface -func (e GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPluginValidationError{} - -// Validate checks the field values on -// GrpcService_GoogleGrpc_CallCredentials_StsService with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *GrpcService_GoogleGrpc_CallCredentials_StsService) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on -// GrpcService_GoogleGrpc_CallCredentials_StsService with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in -// GrpcService_GoogleGrpc_CallCredentials_StsServiceMultiError, or nil if none found. -func (m *GrpcService_GoogleGrpc_CallCredentials_StsService) ValidateAll() error { - return m.validate(true) -} - -func (m *GrpcService_GoogleGrpc_CallCredentials_StsService) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for TokenExchangeServiceUri - - // no validation rules for Resource - - // no validation rules for Audience - - // no validation rules for Scope - - // no validation rules for RequestedTokenType - - if utf8.RuneCountInString(m.GetSubjectTokenPath()) < 1 { - err := GrpcService_GoogleGrpc_CallCredentials_StsServiceValidationError{ - field: "SubjectTokenPath", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if utf8.RuneCountInString(m.GetSubjectTokenType()) < 1 { - err := GrpcService_GoogleGrpc_CallCredentials_StsServiceValidationError{ - field: "SubjectTokenType", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for ActorTokenPath - - // no validation rules for ActorTokenType - - if len(errors) > 0 { - return GrpcService_GoogleGrpc_CallCredentials_StsServiceMultiError(errors) - } - - return nil -} - -// GrpcService_GoogleGrpc_CallCredentials_StsServiceMultiError is an error -// wrapping multiple validation errors returned by -// GrpcService_GoogleGrpc_CallCredentials_StsService.ValidateAll() if the -// designated constraints aren't met. -type GrpcService_GoogleGrpc_CallCredentials_StsServiceMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GrpcService_GoogleGrpc_CallCredentials_StsServiceMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GrpcService_GoogleGrpc_CallCredentials_StsServiceMultiError) AllErrors() []error { return m } - -// GrpcService_GoogleGrpc_CallCredentials_StsServiceValidationError is the -// validation error returned by -// GrpcService_GoogleGrpc_CallCredentials_StsService.Validate if the -// designated constraints aren't met. -type GrpcService_GoogleGrpc_CallCredentials_StsServiceValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GrpcService_GoogleGrpc_CallCredentials_StsServiceValidationError) Field() string { - return e.field -} - -// Reason function returns reason value. -func (e GrpcService_GoogleGrpc_CallCredentials_StsServiceValidationError) Reason() string { - return e.reason -} - -// Cause function returns cause value. -func (e GrpcService_GoogleGrpc_CallCredentials_StsServiceValidationError) Cause() error { - return e.cause -} - -// Key function returns key value. -func (e GrpcService_GoogleGrpc_CallCredentials_StsServiceValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GrpcService_GoogleGrpc_CallCredentials_StsServiceValidationError) ErrorName() string { - return "GrpcService_GoogleGrpc_CallCredentials_StsServiceValidationError" -} - -// Error satisfies the builtin error interface -func (e GrpcService_GoogleGrpc_CallCredentials_StsServiceValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGrpcService_GoogleGrpc_CallCredentials_StsService.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GrpcService_GoogleGrpc_CallCredentials_StsServiceValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GrpcService_GoogleGrpc_CallCredentials_StsServiceValidationError{} - -// Validate checks the field values on GrpcService_GoogleGrpc_ChannelArgs_Value -// with the rules defined in the proto definition for this message. If any -// rules are violated, the first error encountered is returned, or nil if -// there are no violations. -func (m *GrpcService_GoogleGrpc_ChannelArgs_Value) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on -// GrpcService_GoogleGrpc_ChannelArgs_Value with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in -// GrpcService_GoogleGrpc_ChannelArgs_ValueMultiError, or nil if none found. -func (m *GrpcService_GoogleGrpc_ChannelArgs_Value) ValidateAll() error { - return m.validate(true) -} - -func (m *GrpcService_GoogleGrpc_ChannelArgs_Value) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofValueSpecifierPresent := false - switch v := m.ValueSpecifier.(type) { - case *GrpcService_GoogleGrpc_ChannelArgs_Value_StringValue: - if v == nil { - err := GrpcService_GoogleGrpc_ChannelArgs_ValueValidationError{ - field: "ValueSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofValueSpecifierPresent = true - // no validation rules for StringValue - case *GrpcService_GoogleGrpc_ChannelArgs_Value_IntValue: - if v == nil { - err := GrpcService_GoogleGrpc_ChannelArgs_ValueValidationError{ - field: "ValueSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofValueSpecifierPresent = true - // no validation rules for IntValue - default: - _ = v // ensures v is used - } - if !oneofValueSpecifierPresent { - err := GrpcService_GoogleGrpc_ChannelArgs_ValueValidationError{ - field: "ValueSpecifier", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return GrpcService_GoogleGrpc_ChannelArgs_ValueMultiError(errors) - } - - return nil -} - -// GrpcService_GoogleGrpc_ChannelArgs_ValueMultiError is an error wrapping -// multiple validation errors returned by -// GrpcService_GoogleGrpc_ChannelArgs_Value.ValidateAll() if the designated -// constraints aren't met. -type GrpcService_GoogleGrpc_ChannelArgs_ValueMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GrpcService_GoogleGrpc_ChannelArgs_ValueMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GrpcService_GoogleGrpc_ChannelArgs_ValueMultiError) AllErrors() []error { return m } - -// GrpcService_GoogleGrpc_ChannelArgs_ValueValidationError is the validation -// error returned by GrpcService_GoogleGrpc_ChannelArgs_Value.Validate if the -// designated constraints aren't met. -type GrpcService_GoogleGrpc_ChannelArgs_ValueValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GrpcService_GoogleGrpc_ChannelArgs_ValueValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GrpcService_GoogleGrpc_ChannelArgs_ValueValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GrpcService_GoogleGrpc_ChannelArgs_ValueValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GrpcService_GoogleGrpc_ChannelArgs_ValueValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GrpcService_GoogleGrpc_ChannelArgs_ValueValidationError) ErrorName() string { - return "GrpcService_GoogleGrpc_ChannelArgs_ValueValidationError" -} - -// Error satisfies the builtin error interface -func (e GrpcService_GoogleGrpc_ChannelArgs_ValueValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGrpcService_GoogleGrpc_ChannelArgs_Value.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GrpcService_GoogleGrpc_ChannelArgs_ValueValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GrpcService_GoogleGrpc_ChannelArgs_ValueValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/health_check.pb.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/health_check.pb.go deleted file mode 100644 index 0d0247815..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/health_check.pb.go +++ /dev/null @@ -1,1670 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/config/core/v3/health_check.proto - -package corev3 - -import ( - _ "github.com/cilium/proxy/go/envoy/annotations" - v31 "github.com/cilium/proxy/go/envoy/type/matcher/v3" - v3 "github.com/cilium/proxy/go/envoy/type/v3" - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - durationpb "google.golang.org/protobuf/types/known/durationpb" - structpb "google.golang.org/protobuf/types/known/structpb" - wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Endpoint health status. -type HealthStatus int32 - -const ( - // The health status is not known. This is interpreted by Envoy as “HEALTHY“. - HealthStatus_UNKNOWN HealthStatus = 0 - // Healthy. - HealthStatus_HEALTHY HealthStatus = 1 - // Unhealthy. - HealthStatus_UNHEALTHY HealthStatus = 2 - // Connection draining in progress. E.g., - // ``_ - // or - // ``_. - // This is interpreted by Envoy as “UNHEALTHY“. - HealthStatus_DRAINING HealthStatus = 3 - // Health check timed out. This is part of HDS and is interpreted by Envoy as - // “UNHEALTHY“. - HealthStatus_TIMEOUT HealthStatus = 4 - // Degraded. - HealthStatus_DEGRADED HealthStatus = 5 -) - -// Enum value maps for HealthStatus. -var ( - HealthStatus_name = map[int32]string{ - 0: "UNKNOWN", - 1: "HEALTHY", - 2: "UNHEALTHY", - 3: "DRAINING", - 4: "TIMEOUT", - 5: "DEGRADED", - } - HealthStatus_value = map[string]int32{ - "UNKNOWN": 0, - "HEALTHY": 1, - "UNHEALTHY": 2, - "DRAINING": 3, - "TIMEOUT": 4, - "DEGRADED": 5, - } -) - -func (x HealthStatus) Enum() *HealthStatus { - p := new(HealthStatus) - *p = x - return p -} - -func (x HealthStatus) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (HealthStatus) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_config_core_v3_health_check_proto_enumTypes[0].Descriptor() -} - -func (HealthStatus) Type() protoreflect.EnumType { - return &file_envoy_config_core_v3_health_check_proto_enumTypes[0] -} - -func (x HealthStatus) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use HealthStatus.Descriptor instead. -func (HealthStatus) EnumDescriptor() ([]byte, []int) { - return file_envoy_config_core_v3_health_check_proto_rawDescGZIP(), []int{0} -} - -type HealthStatusSet struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // An order-independent set of health status. - Statuses []HealthStatus `protobuf:"varint,1,rep,packed,name=statuses,proto3,enum=envoy.config.core.v3.HealthStatus" json:"statuses,omitempty"` -} - -func (x *HealthStatusSet) Reset() { - *x = HealthStatusSet{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_health_check_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HealthStatusSet) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HealthStatusSet) ProtoMessage() {} - -func (x *HealthStatusSet) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_health_check_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HealthStatusSet.ProtoReflect.Descriptor instead. -func (*HealthStatusSet) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_health_check_proto_rawDescGZIP(), []int{0} -} - -func (x *HealthStatusSet) GetStatuses() []HealthStatus { - if x != nil { - return x.Statuses - } - return nil -} - -// [#next-free-field: 26] -type HealthCheck struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The time to wait for a health check response. If the timeout is reached the - // health check attempt will be considered a failure. - Timeout *durationpb.Duration `protobuf:"bytes,1,opt,name=timeout,proto3" json:"timeout,omitempty"` - // The interval between health checks. - Interval *durationpb.Duration `protobuf:"bytes,2,opt,name=interval,proto3" json:"interval,omitempty"` - // An optional jitter amount in milliseconds. If specified, Envoy will start health - // checking after for a random time in ms between 0 and initial_jitter. This only - // applies to the first health check. - InitialJitter *durationpb.Duration `protobuf:"bytes,20,opt,name=initial_jitter,json=initialJitter,proto3" json:"initial_jitter,omitempty"` - // An optional jitter amount in milliseconds. If specified, during every - // interval Envoy will add interval_jitter to the wait time. - IntervalJitter *durationpb.Duration `protobuf:"bytes,3,opt,name=interval_jitter,json=intervalJitter,proto3" json:"interval_jitter,omitempty"` - // An optional jitter amount as a percentage of interval_ms. If specified, - // during every interval Envoy will add “interval_ms“ * - // “interval_jitter_percent“ / 100 to the wait time. - // - // If interval_jitter_ms and interval_jitter_percent are both set, both of - // them will be used to increase the wait time. - IntervalJitterPercent uint32 `protobuf:"varint,18,opt,name=interval_jitter_percent,json=intervalJitterPercent,proto3" json:"interval_jitter_percent,omitempty"` - // The number of unhealthy health checks required before a host is marked - // unhealthy. Note that for “http“ health checking if a host responds with a code not in - // :ref:`expected_statuses ` - // or :ref:`retriable_statuses `, - // this threshold is ignored and the host is considered immediately unhealthy. - UnhealthyThreshold *wrapperspb.UInt32Value `protobuf:"bytes,4,opt,name=unhealthy_threshold,json=unhealthyThreshold,proto3" json:"unhealthy_threshold,omitempty"` - // The number of healthy health checks required before a host is marked - // healthy. Note that during startup, only a single successful health check is - // required to mark a host healthy. - HealthyThreshold *wrapperspb.UInt32Value `protobuf:"bytes,5,opt,name=healthy_threshold,json=healthyThreshold,proto3" json:"healthy_threshold,omitempty"` - // [#not-implemented-hide:] Non-serving port for health checking. - AltPort *wrapperspb.UInt32Value `protobuf:"bytes,6,opt,name=alt_port,json=altPort,proto3" json:"alt_port,omitempty"` - // Reuse health check connection between health checks. Default is true. - ReuseConnection *wrapperspb.BoolValue `protobuf:"bytes,7,opt,name=reuse_connection,json=reuseConnection,proto3" json:"reuse_connection,omitempty"` - // Types that are assignable to HealthChecker: - // - // *HealthCheck_HttpHealthCheck_ - // *HealthCheck_TcpHealthCheck_ - // *HealthCheck_GrpcHealthCheck_ - // *HealthCheck_CustomHealthCheck_ - HealthChecker isHealthCheck_HealthChecker `protobuf_oneof:"health_checker"` - // The "no traffic interval" is a special health check interval that is used when a cluster has - // never had traffic routed to it. This lower interval allows cluster information to be kept up to - // date, without sending a potentially large amount of active health checking traffic for no - // reason. Once a cluster has been used for traffic routing, Envoy will shift back to using the - // standard health check interval that is defined. Note that this interval takes precedence over - // any other. - // - // The default value for "no traffic interval" is 60 seconds. - NoTrafficInterval *durationpb.Duration `protobuf:"bytes,12,opt,name=no_traffic_interval,json=noTrafficInterval,proto3" json:"no_traffic_interval,omitempty"` - // The "no traffic healthy interval" is a special health check interval that - // is used for hosts that are currently passing active health checking - // (including new hosts) when the cluster has received no traffic. - // - // This is useful for when we want to send frequent health checks with - // “no_traffic_interval“ but then revert to lower frequency “no_traffic_healthy_interval“ once - // a host in the cluster is marked as healthy. - // - // Once a cluster has been used for traffic routing, Envoy will shift back to using the - // standard health check interval that is defined. - // - // If no_traffic_healthy_interval is not set, it will default to the - // no traffic interval and send that interval regardless of health state. - NoTrafficHealthyInterval *durationpb.Duration `protobuf:"bytes,24,opt,name=no_traffic_healthy_interval,json=noTrafficHealthyInterval,proto3" json:"no_traffic_healthy_interval,omitempty"` - // The "unhealthy interval" is a health check interval that is used for hosts that are marked as - // unhealthy. As soon as the host is marked as healthy, Envoy will shift back to using the - // standard health check interval that is defined. - // - // The default value for "unhealthy interval" is the same as "interval". - UnhealthyInterval *durationpb.Duration `protobuf:"bytes,14,opt,name=unhealthy_interval,json=unhealthyInterval,proto3" json:"unhealthy_interval,omitempty"` - // The "unhealthy edge interval" is a special health check interval that is used for the first - // health check right after a host is marked as unhealthy. For subsequent health checks - // Envoy will shift back to using either "unhealthy interval" if present or the standard health - // check interval that is defined. - // - // The default value for "unhealthy edge interval" is the same as "unhealthy interval". - UnhealthyEdgeInterval *durationpb.Duration `protobuf:"bytes,15,opt,name=unhealthy_edge_interval,json=unhealthyEdgeInterval,proto3" json:"unhealthy_edge_interval,omitempty"` - // The "healthy edge interval" is a special health check interval that is used for the first - // health check right after a host is marked as healthy. For subsequent health checks - // Envoy will shift back to using the standard health check interval that is defined. - // - // The default value for "healthy edge interval" is the same as the default interval. - HealthyEdgeInterval *durationpb.Duration `protobuf:"bytes,16,opt,name=healthy_edge_interval,json=healthyEdgeInterval,proto3" json:"healthy_edge_interval,omitempty"` - // .. attention:: - // This field is deprecated in favor of the extension - // :ref:`event_logger ` and - // :ref:`event_log_path ` - // in the file sink extension. - // - // Specifies the path to the :ref:`health check event log `. - // - // Deprecated: Do not use. - EventLogPath string `protobuf:"bytes,17,opt,name=event_log_path,json=eventLogPath,proto3" json:"event_log_path,omitempty"` - // A list of event log sinks to process the health check event. - // [#extension-category: envoy.health_check.event_sinks] - EventLogger []*TypedExtensionConfig `protobuf:"bytes,25,rep,name=event_logger,json=eventLogger,proto3" json:"event_logger,omitempty"` - // [#not-implemented-hide:] - // The gRPC service for the health check event service. - // If empty, health check events won't be sent to a remote endpoint. - EventService *EventServiceConfig `protobuf:"bytes,22,opt,name=event_service,json=eventService,proto3" json:"event_service,omitempty"` - // If set to true, health check failure events will always be logged. If set to false, only the - // initial health check failure event will be logged. - // The default value is false. - AlwaysLogHealthCheckFailures bool `protobuf:"varint,19,opt,name=always_log_health_check_failures,json=alwaysLogHealthCheckFailures,proto3" json:"always_log_health_check_failures,omitempty"` - // This allows overriding the cluster TLS settings, just for health check connections. - TlsOptions *HealthCheck_TlsOptions `protobuf:"bytes,21,opt,name=tls_options,json=tlsOptions,proto3" json:"tls_options,omitempty"` - // Optional key/value pairs that will be used to match a transport socket from those specified in the cluster's - // :ref:`tranport socket matches `. - // For example, the following match criteria - // - // .. code-block:: yaml - // - // transport_socket_match_criteria: - // useMTLS: true - // - // Will match the following :ref:`cluster socket match ` - // - // .. code-block:: yaml - // - // transport_socket_matches: - // - name: "useMTLS" - // match: - // useMTLS: true - // transport_socket: - // name: envoy.transport_sockets.tls - // config: { ... } # tls socket configuration - // - // If this field is set, then for health checks it will supersede an entry of “envoy.transport_socket“ in the - // :ref:`LbEndpoint.Metadata `. - // This allows using different transport socket capabilities for health checking versus proxying to the - // endpoint. - // - // If the key/values pairs specified do not match any - // :ref:`transport socket matches `, - // the cluster's :ref:`transport socket ` - // will be used for health check socket configuration. - TransportSocketMatchCriteria *structpb.Struct `protobuf:"bytes,23,opt,name=transport_socket_match_criteria,json=transportSocketMatchCriteria,proto3" json:"transport_socket_match_criteria,omitempty"` -} - -func (x *HealthCheck) Reset() { - *x = HealthCheck{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_health_check_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HealthCheck) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HealthCheck) ProtoMessage() {} - -func (x *HealthCheck) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_health_check_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HealthCheck.ProtoReflect.Descriptor instead. -func (*HealthCheck) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_health_check_proto_rawDescGZIP(), []int{1} -} - -func (x *HealthCheck) GetTimeout() *durationpb.Duration { - if x != nil { - return x.Timeout - } - return nil -} - -func (x *HealthCheck) GetInterval() *durationpb.Duration { - if x != nil { - return x.Interval - } - return nil -} - -func (x *HealthCheck) GetInitialJitter() *durationpb.Duration { - if x != nil { - return x.InitialJitter - } - return nil -} - -func (x *HealthCheck) GetIntervalJitter() *durationpb.Duration { - if x != nil { - return x.IntervalJitter - } - return nil -} - -func (x *HealthCheck) GetIntervalJitterPercent() uint32 { - if x != nil { - return x.IntervalJitterPercent - } - return 0 -} - -func (x *HealthCheck) GetUnhealthyThreshold() *wrapperspb.UInt32Value { - if x != nil { - return x.UnhealthyThreshold - } - return nil -} - -func (x *HealthCheck) GetHealthyThreshold() *wrapperspb.UInt32Value { - if x != nil { - return x.HealthyThreshold - } - return nil -} - -func (x *HealthCheck) GetAltPort() *wrapperspb.UInt32Value { - if x != nil { - return x.AltPort - } - return nil -} - -func (x *HealthCheck) GetReuseConnection() *wrapperspb.BoolValue { - if x != nil { - return x.ReuseConnection - } - return nil -} - -func (m *HealthCheck) GetHealthChecker() isHealthCheck_HealthChecker { - if m != nil { - return m.HealthChecker - } - return nil -} - -func (x *HealthCheck) GetHttpHealthCheck() *HealthCheck_HttpHealthCheck { - if x, ok := x.GetHealthChecker().(*HealthCheck_HttpHealthCheck_); ok { - return x.HttpHealthCheck - } - return nil -} - -func (x *HealthCheck) GetTcpHealthCheck() *HealthCheck_TcpHealthCheck { - if x, ok := x.GetHealthChecker().(*HealthCheck_TcpHealthCheck_); ok { - return x.TcpHealthCheck - } - return nil -} - -func (x *HealthCheck) GetGrpcHealthCheck() *HealthCheck_GrpcHealthCheck { - if x, ok := x.GetHealthChecker().(*HealthCheck_GrpcHealthCheck_); ok { - return x.GrpcHealthCheck - } - return nil -} - -func (x *HealthCheck) GetCustomHealthCheck() *HealthCheck_CustomHealthCheck { - if x, ok := x.GetHealthChecker().(*HealthCheck_CustomHealthCheck_); ok { - return x.CustomHealthCheck - } - return nil -} - -func (x *HealthCheck) GetNoTrafficInterval() *durationpb.Duration { - if x != nil { - return x.NoTrafficInterval - } - return nil -} - -func (x *HealthCheck) GetNoTrafficHealthyInterval() *durationpb.Duration { - if x != nil { - return x.NoTrafficHealthyInterval - } - return nil -} - -func (x *HealthCheck) GetUnhealthyInterval() *durationpb.Duration { - if x != nil { - return x.UnhealthyInterval - } - return nil -} - -func (x *HealthCheck) GetUnhealthyEdgeInterval() *durationpb.Duration { - if x != nil { - return x.UnhealthyEdgeInterval - } - return nil -} - -func (x *HealthCheck) GetHealthyEdgeInterval() *durationpb.Duration { - if x != nil { - return x.HealthyEdgeInterval - } - return nil -} - -// Deprecated: Do not use. -func (x *HealthCheck) GetEventLogPath() string { - if x != nil { - return x.EventLogPath - } - return "" -} - -func (x *HealthCheck) GetEventLogger() []*TypedExtensionConfig { - if x != nil { - return x.EventLogger - } - return nil -} - -func (x *HealthCheck) GetEventService() *EventServiceConfig { - if x != nil { - return x.EventService - } - return nil -} - -func (x *HealthCheck) GetAlwaysLogHealthCheckFailures() bool { - if x != nil { - return x.AlwaysLogHealthCheckFailures - } - return false -} - -func (x *HealthCheck) GetTlsOptions() *HealthCheck_TlsOptions { - if x != nil { - return x.TlsOptions - } - return nil -} - -func (x *HealthCheck) GetTransportSocketMatchCriteria() *structpb.Struct { - if x != nil { - return x.TransportSocketMatchCriteria - } - return nil -} - -type isHealthCheck_HealthChecker interface { - isHealthCheck_HealthChecker() -} - -type HealthCheck_HttpHealthCheck_ struct { - // HTTP health check. - HttpHealthCheck *HealthCheck_HttpHealthCheck `protobuf:"bytes,8,opt,name=http_health_check,json=httpHealthCheck,proto3,oneof"` -} - -type HealthCheck_TcpHealthCheck_ struct { - // TCP health check. - TcpHealthCheck *HealthCheck_TcpHealthCheck `protobuf:"bytes,9,opt,name=tcp_health_check,json=tcpHealthCheck,proto3,oneof"` -} - -type HealthCheck_GrpcHealthCheck_ struct { - // gRPC health check. - GrpcHealthCheck *HealthCheck_GrpcHealthCheck `protobuf:"bytes,11,opt,name=grpc_health_check,json=grpcHealthCheck,proto3,oneof"` -} - -type HealthCheck_CustomHealthCheck_ struct { - // Custom health check. - CustomHealthCheck *HealthCheck_CustomHealthCheck `protobuf:"bytes,13,opt,name=custom_health_check,json=customHealthCheck,proto3,oneof"` -} - -func (*HealthCheck_HttpHealthCheck_) isHealthCheck_HealthChecker() {} - -func (*HealthCheck_TcpHealthCheck_) isHealthCheck_HealthChecker() {} - -func (*HealthCheck_GrpcHealthCheck_) isHealthCheck_HealthChecker() {} - -func (*HealthCheck_CustomHealthCheck_) isHealthCheck_HealthChecker() {} - -// Describes the encoding of the payload bytes in the payload. -type HealthCheck_Payload struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Payload: - // - // *HealthCheck_Payload_Text - // *HealthCheck_Payload_Binary - Payload isHealthCheck_Payload_Payload `protobuf_oneof:"payload"` -} - -func (x *HealthCheck_Payload) Reset() { - *x = HealthCheck_Payload{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_health_check_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HealthCheck_Payload) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HealthCheck_Payload) ProtoMessage() {} - -func (x *HealthCheck_Payload) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_health_check_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HealthCheck_Payload.ProtoReflect.Descriptor instead. -func (*HealthCheck_Payload) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_health_check_proto_rawDescGZIP(), []int{1, 0} -} - -func (m *HealthCheck_Payload) GetPayload() isHealthCheck_Payload_Payload { - if m != nil { - return m.Payload - } - return nil -} - -func (x *HealthCheck_Payload) GetText() string { - if x, ok := x.GetPayload().(*HealthCheck_Payload_Text); ok { - return x.Text - } - return "" -} - -func (x *HealthCheck_Payload) GetBinary() []byte { - if x, ok := x.GetPayload().(*HealthCheck_Payload_Binary); ok { - return x.Binary - } - return nil -} - -type isHealthCheck_Payload_Payload interface { - isHealthCheck_Payload_Payload() -} - -type HealthCheck_Payload_Text struct { - // Hex encoded payload. E.g., "000000FF". - Text string `protobuf:"bytes,1,opt,name=text,proto3,oneof"` -} - -type HealthCheck_Payload_Binary struct { - // Binary payload. - Binary []byte `protobuf:"bytes,2,opt,name=binary,proto3,oneof"` -} - -func (*HealthCheck_Payload_Text) isHealthCheck_Payload_Payload() {} - -func (*HealthCheck_Payload_Binary) isHealthCheck_Payload_Payload() {} - -// [#next-free-field: 15] -type HealthCheck_HttpHealthCheck struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The value of the host header in the HTTP health check request. If - // left empty (default value), the name of the cluster this health check is associated - // with will be used. The host header can be customized for a specific endpoint by setting the - // :ref:`hostname ` field. - Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` - // Specifies the HTTP path that will be requested during health checking. For example - // “/healthcheck“. - Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` - // [#not-implemented-hide:] HTTP specific payload. - Send *HealthCheck_Payload `protobuf:"bytes,3,opt,name=send,proto3" json:"send,omitempty"` - // Specifies a list of HTTP expected responses to match in the first “response_buffer_size“ bytes of the response body. - // If it is set, both the expected response check and status code determine the health check. - // When checking the response, “fuzzy” matching is performed such that each payload block must be found, - // and in the order specified, but not necessarily contiguous. - // - // .. note:: - // - // It is recommended to set ``response_buffer_size`` based on the total Payload size for efficiency. - // The default buffer size is 1024 bytes when it is not set. - Receive []*HealthCheck_Payload `protobuf:"bytes,4,rep,name=receive,proto3" json:"receive,omitempty"` - // Specifies the size of response buffer in bytes that is used to Payload match. - // The default value is 1024. Setting to 0 implies that the Payload will be matched against the entire response. - ResponseBufferSize *wrapperspb.UInt64Value `protobuf:"bytes,14,opt,name=response_buffer_size,json=responseBufferSize,proto3" json:"response_buffer_size,omitempty"` - // Specifies a list of HTTP headers that should be added to each request that is sent to the - // health checked cluster. For more information, including details on header value syntax, see - // the documentation on :ref:`custom request headers - // `. - RequestHeadersToAdd []*HeaderValueOption `protobuf:"bytes,6,rep,name=request_headers_to_add,json=requestHeadersToAdd,proto3" json:"request_headers_to_add,omitempty"` - // Specifies a list of HTTP headers that should be removed from each request that is sent to the - // health checked cluster. - RequestHeadersToRemove []string `protobuf:"bytes,8,rep,name=request_headers_to_remove,json=requestHeadersToRemove,proto3" json:"request_headers_to_remove,omitempty"` - // Specifies a list of HTTP response statuses considered healthy. If provided, replaces default - // 200-only policy - 200 must be included explicitly as needed. Ranges follow half-open - // semantics of :ref:`Int64Range `. The start and end of each - // range are required. Only statuses in the range [100, 600) are allowed. - ExpectedStatuses []*v3.Int64Range `protobuf:"bytes,9,rep,name=expected_statuses,json=expectedStatuses,proto3" json:"expected_statuses,omitempty"` - // Specifies a list of HTTP response statuses considered retriable. If provided, responses in this range - // will count towards the configured :ref:`unhealthy_threshold `, - // but will not result in the host being considered immediately unhealthy. Ranges follow half-open semantics of - // :ref:`Int64Range `. The start and end of each range are required. - // Only statuses in the range [100, 600) are allowed. The :ref:`expected_statuses ` - // field takes precedence for any range overlaps with this field i.e. if status code 200 is both retriable and expected, a 200 response will - // be considered a successful health check. By default all responses not in - // :ref:`expected_statuses ` will result in - // the host being considered immediately unhealthy i.e. if status code 200 is expected and there are no configured retriable statuses, any - // non-200 response will result in the host being marked unhealthy. - RetriableStatuses []*v3.Int64Range `protobuf:"bytes,12,rep,name=retriable_statuses,json=retriableStatuses,proto3" json:"retriable_statuses,omitempty"` - // Use specified application protocol for health checks. - CodecClientType v3.CodecClientType `protobuf:"varint,10,opt,name=codec_client_type,json=codecClientType,proto3,enum=envoy.type.v3.CodecClientType" json:"codec_client_type,omitempty"` - // An optional service name parameter which is used to validate the identity of - // the health checked cluster using a :ref:`StringMatcher - // `. See the :ref:`architecture overview - // ` for more information. - ServiceNameMatcher *v31.StringMatcher `protobuf:"bytes,11,opt,name=service_name_matcher,json=serviceNameMatcher,proto3" json:"service_name_matcher,omitempty"` - // HTTP Method that will be used for health checking, default is "GET". - // GET, HEAD, POST, PUT, DELETE, OPTIONS, TRACE, PATCH methods are supported, but making request body is not supported. - // CONNECT method is disallowed because it is not appropriate for health check request. - // If a non-200 response is expected by the method, it needs to be set in :ref:`expected_statuses `. - Method RequestMethod `protobuf:"varint,13,opt,name=method,proto3,enum=envoy.config.core.v3.RequestMethod" json:"method,omitempty"` -} - -func (x *HealthCheck_HttpHealthCheck) Reset() { - *x = HealthCheck_HttpHealthCheck{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_health_check_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HealthCheck_HttpHealthCheck) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HealthCheck_HttpHealthCheck) ProtoMessage() {} - -func (x *HealthCheck_HttpHealthCheck) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_health_check_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HealthCheck_HttpHealthCheck.ProtoReflect.Descriptor instead. -func (*HealthCheck_HttpHealthCheck) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_health_check_proto_rawDescGZIP(), []int{1, 1} -} - -func (x *HealthCheck_HttpHealthCheck) GetHost() string { - if x != nil { - return x.Host - } - return "" -} - -func (x *HealthCheck_HttpHealthCheck) GetPath() string { - if x != nil { - return x.Path - } - return "" -} - -func (x *HealthCheck_HttpHealthCheck) GetSend() *HealthCheck_Payload { - if x != nil { - return x.Send - } - return nil -} - -func (x *HealthCheck_HttpHealthCheck) GetReceive() []*HealthCheck_Payload { - if x != nil { - return x.Receive - } - return nil -} - -func (x *HealthCheck_HttpHealthCheck) GetResponseBufferSize() *wrapperspb.UInt64Value { - if x != nil { - return x.ResponseBufferSize - } - return nil -} - -func (x *HealthCheck_HttpHealthCheck) GetRequestHeadersToAdd() []*HeaderValueOption { - if x != nil { - return x.RequestHeadersToAdd - } - return nil -} - -func (x *HealthCheck_HttpHealthCheck) GetRequestHeadersToRemove() []string { - if x != nil { - return x.RequestHeadersToRemove - } - return nil -} - -func (x *HealthCheck_HttpHealthCheck) GetExpectedStatuses() []*v3.Int64Range { - if x != nil { - return x.ExpectedStatuses - } - return nil -} - -func (x *HealthCheck_HttpHealthCheck) GetRetriableStatuses() []*v3.Int64Range { - if x != nil { - return x.RetriableStatuses - } - return nil -} - -func (x *HealthCheck_HttpHealthCheck) GetCodecClientType() v3.CodecClientType { - if x != nil { - return x.CodecClientType - } - return v3.CodecClientType_HTTP1 -} - -func (x *HealthCheck_HttpHealthCheck) GetServiceNameMatcher() *v31.StringMatcher { - if x != nil { - return x.ServiceNameMatcher - } - return nil -} - -func (x *HealthCheck_HttpHealthCheck) GetMethod() RequestMethod { - if x != nil { - return x.Method - } - return RequestMethod_METHOD_UNSPECIFIED -} - -type HealthCheck_TcpHealthCheck struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Empty payloads imply a connect-only health check. - Send *HealthCheck_Payload `protobuf:"bytes,1,opt,name=send,proto3" json:"send,omitempty"` - // When checking the response, “fuzzy” matching is performed such that each - // payload block must be found, and in the order specified, but not - // necessarily contiguous. - Receive []*HealthCheck_Payload `protobuf:"bytes,2,rep,name=receive,proto3" json:"receive,omitempty"` -} - -func (x *HealthCheck_TcpHealthCheck) Reset() { - *x = HealthCheck_TcpHealthCheck{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_health_check_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HealthCheck_TcpHealthCheck) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HealthCheck_TcpHealthCheck) ProtoMessage() {} - -func (x *HealthCheck_TcpHealthCheck) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_health_check_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HealthCheck_TcpHealthCheck.ProtoReflect.Descriptor instead. -func (*HealthCheck_TcpHealthCheck) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_health_check_proto_rawDescGZIP(), []int{1, 2} -} - -func (x *HealthCheck_TcpHealthCheck) GetSend() *HealthCheck_Payload { - if x != nil { - return x.Send - } - return nil -} - -func (x *HealthCheck_TcpHealthCheck) GetReceive() []*HealthCheck_Payload { - if x != nil { - return x.Receive - } - return nil -} - -type HealthCheck_RedisHealthCheck struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // If set, optionally perform “EXISTS “ instead of “PING“. A return value - // from Redis of 0 (does not exist) is considered a passing healthcheck. A return value other - // than 0 is considered a failure. This allows the user to mark a Redis instance for maintenance - // by setting the specified key to any value and waiting for traffic to drain. - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` -} - -func (x *HealthCheck_RedisHealthCheck) Reset() { - *x = HealthCheck_RedisHealthCheck{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_health_check_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HealthCheck_RedisHealthCheck) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HealthCheck_RedisHealthCheck) ProtoMessage() {} - -func (x *HealthCheck_RedisHealthCheck) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_health_check_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HealthCheck_RedisHealthCheck.ProtoReflect.Descriptor instead. -func (*HealthCheck_RedisHealthCheck) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_health_check_proto_rawDescGZIP(), []int{1, 3} -} - -func (x *HealthCheck_RedisHealthCheck) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -// `grpc.health.v1.Health -// `_-based -// healthcheck. See `gRPC doc `_ -// for details. -type HealthCheck_GrpcHealthCheck struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // An optional service name parameter which will be sent to gRPC service in - // `grpc.health.v1.HealthCheckRequest - // `_. - // message. See `gRPC health-checking overview - // `_ for more information. - ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` - // The value of the :authority header in the gRPC health check request. If - // left empty (default value), the name of the cluster this health check is associated - // with will be used. The authority header can be customized for a specific endpoint by setting - // the :ref:`hostname ` field. - Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"` - // Specifies a list of key-value pairs that should be added to the metadata of each GRPC call - // that is sent to the health checked cluster. For more information, including details on header value syntax, - // see the documentation on :ref:`custom request headers - // `. - InitialMetadata []*HeaderValueOption `protobuf:"bytes,3,rep,name=initial_metadata,json=initialMetadata,proto3" json:"initial_metadata,omitempty"` -} - -func (x *HealthCheck_GrpcHealthCheck) Reset() { - *x = HealthCheck_GrpcHealthCheck{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_health_check_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HealthCheck_GrpcHealthCheck) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HealthCheck_GrpcHealthCheck) ProtoMessage() {} - -func (x *HealthCheck_GrpcHealthCheck) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_health_check_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HealthCheck_GrpcHealthCheck.ProtoReflect.Descriptor instead. -func (*HealthCheck_GrpcHealthCheck) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_health_check_proto_rawDescGZIP(), []int{1, 4} -} - -func (x *HealthCheck_GrpcHealthCheck) GetServiceName() string { - if x != nil { - return x.ServiceName - } - return "" -} - -func (x *HealthCheck_GrpcHealthCheck) GetAuthority() string { - if x != nil { - return x.Authority - } - return "" -} - -func (x *HealthCheck_GrpcHealthCheck) GetInitialMetadata() []*HeaderValueOption { - if x != nil { - return x.InitialMetadata - } - return nil -} - -// Custom health check. -type HealthCheck_CustomHealthCheck struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The registered name of the custom health checker. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // A custom health checker specific configuration which depends on the custom health checker - // being instantiated. See :api:`envoy/config/health_checker` for reference. - // [#extension-category: envoy.health_checkers] - // - // Types that are assignable to ConfigType: - // - // *HealthCheck_CustomHealthCheck_TypedConfig - ConfigType isHealthCheck_CustomHealthCheck_ConfigType `protobuf_oneof:"config_type"` -} - -func (x *HealthCheck_CustomHealthCheck) Reset() { - *x = HealthCheck_CustomHealthCheck{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_health_check_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HealthCheck_CustomHealthCheck) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HealthCheck_CustomHealthCheck) ProtoMessage() {} - -func (x *HealthCheck_CustomHealthCheck) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_health_check_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HealthCheck_CustomHealthCheck.ProtoReflect.Descriptor instead. -func (*HealthCheck_CustomHealthCheck) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_health_check_proto_rawDescGZIP(), []int{1, 5} -} - -func (x *HealthCheck_CustomHealthCheck) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (m *HealthCheck_CustomHealthCheck) GetConfigType() isHealthCheck_CustomHealthCheck_ConfigType { - if m != nil { - return m.ConfigType - } - return nil -} - -func (x *HealthCheck_CustomHealthCheck) GetTypedConfig() *anypb.Any { - if x, ok := x.GetConfigType().(*HealthCheck_CustomHealthCheck_TypedConfig); ok { - return x.TypedConfig - } - return nil -} - -type isHealthCheck_CustomHealthCheck_ConfigType interface { - isHealthCheck_CustomHealthCheck_ConfigType() -} - -type HealthCheck_CustomHealthCheck_TypedConfig struct { - TypedConfig *anypb.Any `protobuf:"bytes,3,opt,name=typed_config,json=typedConfig,proto3,oneof"` -} - -func (*HealthCheck_CustomHealthCheck_TypedConfig) isHealthCheck_CustomHealthCheck_ConfigType() {} - -// Health checks occur over the transport socket specified for the cluster. This implies that if a -// cluster is using a TLS-enabled transport socket, the health check will also occur over TLS. -// -// This allows overriding the cluster TLS settings, just for health check connections. -type HealthCheck_TlsOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Specifies the ALPN protocols for health check connections. This is useful if the - // corresponding upstream is using ALPN-based :ref:`FilterChainMatch - // ` along with different protocols for health checks - // versus data connections. If empty, no ALPN protocols will be set on health check connections. - AlpnProtocols []string `protobuf:"bytes,1,rep,name=alpn_protocols,json=alpnProtocols,proto3" json:"alpn_protocols,omitempty"` -} - -func (x *HealthCheck_TlsOptions) Reset() { - *x = HealthCheck_TlsOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_health_check_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HealthCheck_TlsOptions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HealthCheck_TlsOptions) ProtoMessage() {} - -func (x *HealthCheck_TlsOptions) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_health_check_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HealthCheck_TlsOptions.ProtoReflect.Descriptor instead. -func (*HealthCheck_TlsOptions) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_health_check_proto_rawDescGZIP(), []int{1, 6} -} - -func (x *HealthCheck_TlsOptions) GetAlpnProtocols() []string { - if x != nil { - return x.AlpnProtocols - } - return nil -} - -var File_envoy_config_core_v3_health_check_proto protoreflect.FileDescriptor - -var file_envoy_config_core_v3_health_check_proto_rawDesc = []byte{ - 0x0a, 0x27, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x5f, 0x63, 0x68, - 0x65, 0x63, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x1a, - 0x1f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, - 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x24, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, - 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x22, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, - 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x73, - 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x68, 0x74, 0x74, 0x70, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, - 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, - 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, - 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x64, 0x65, 0x70, - 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, - 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x75, - 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x60, 0x0a, 0x0f, 0x48, 0x65, 0x61, - 0x6c, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x53, 0x65, 0x74, 0x12, 0x4d, 0x0a, 0x08, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x22, - 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x42, 0x0d, 0xfa, 0x42, 0x0a, 0x92, 0x01, 0x07, 0x22, 0x05, 0x82, 0x01, 0x02, 0x10, - 0x01, 0x52, 0x08, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x22, 0xed, 0x1e, 0x0a, 0x0b, - 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x3f, 0x0a, 0x07, 0x74, - 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, - 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0a, 0xfa, 0x42, 0x07, 0xaa, 0x01, 0x04, 0x08, - 0x01, 0x2a, 0x00, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x41, 0x0a, 0x08, - 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0a, 0xfa, 0x42, 0x07, 0xaa, 0x01, - 0x04, 0x08, 0x01, 0x2a, 0x00, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, - 0x40, 0x0a, 0x0e, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x6a, 0x69, 0x74, 0x74, 0x65, - 0x72, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x0d, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x4a, 0x69, 0x74, 0x74, 0x65, - 0x72, 0x12, 0x42, 0x0a, 0x0f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x5f, 0x6a, 0x69, - 0x74, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x4a, - 0x69, 0x74, 0x74, 0x65, 0x72, 0x12, 0x36, 0x0a, 0x17, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, - 0x6c, 0x5f, 0x6a, 0x69, 0x74, 0x74, 0x65, 0x72, 0x5f, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, - 0x18, 0x12, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x15, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, - 0x4a, 0x69, 0x74, 0x74, 0x65, 0x72, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x12, 0x57, 0x0a, - 0x13, 0x75, 0x6e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x73, - 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, - 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, - 0x10, 0x01, 0x52, 0x12, 0x75, 0x6e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x54, 0x68, 0x72, - 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x12, 0x53, 0x0a, 0x11, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, - 0x79, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, - 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x10, 0x68, 0x65, 0x61, 0x6c, 0x74, - 0x68, 0x79, 0x54, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x12, 0x37, 0x0a, 0x08, 0x61, - 0x6c, 0x74, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x07, 0x61, 0x6c, 0x74, - 0x50, 0x6f, 0x72, 0x74, 0x12, 0x45, 0x0a, 0x10, 0x72, 0x65, 0x75, 0x73, 0x65, 0x5f, 0x63, 0x6f, - 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0f, 0x72, 0x65, 0x75, 0x73, - 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x5f, 0x0a, 0x11, 0x68, - 0x74, 0x74, 0x70, 0x5f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, - 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, - 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x48, 0x65, - 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x48, 0x00, 0x52, 0x0f, 0x68, 0x74, 0x74, - 0x70, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x5c, 0x0a, 0x10, - 0x74, 0x63, 0x70, 0x5f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, - 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, - 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x2e, 0x54, 0x63, 0x70, 0x48, 0x65, 0x61, - 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x48, 0x00, 0x52, 0x0e, 0x74, 0x63, 0x70, 0x48, - 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x5f, 0x0a, 0x11, 0x67, 0x72, - 0x70, 0x63, 0x5f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x18, - 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, - 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x48, 0x65, 0x61, - 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x48, 0x00, 0x52, 0x0f, 0x67, 0x72, 0x70, 0x63, - 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x65, 0x0a, 0x13, 0x63, - 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x5f, 0x63, 0x68, 0x65, - 0x63, 0x6b, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, - 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x2e, 0x43, 0x75, 0x73, 0x74, - 0x6f, 0x6d, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x48, 0x00, 0x52, - 0x11, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, - 0x63, 0x6b, 0x12, 0x53, 0x0a, 0x13, 0x6e, 0x6f, 0x5f, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, - 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0xaa, - 0x01, 0x02, 0x2a, 0x00, 0x52, 0x11, 0x6e, 0x6f, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x49, - 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x62, 0x0a, 0x1b, 0x6e, 0x6f, 0x5f, 0x74, 0x72, - 0x61, 0x66, 0x66, 0x69, 0x63, 0x5f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x5f, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x18, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, - 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0xaa, 0x01, 0x02, 0x2a, - 0x00, 0x52, 0x18, 0x6e, 0x6f, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x48, 0x65, 0x61, 0x6c, - 0x74, 0x68, 0x79, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x52, 0x0a, 0x12, 0x75, - 0x6e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, - 0x6c, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0xaa, 0x01, 0x02, 0x2a, 0x00, 0x52, 0x11, 0x75, 0x6e, - 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, - 0x5b, 0x0a, 0x17, 0x75, 0x6e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x5f, 0x65, 0x64, 0x67, - 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, - 0xaa, 0x01, 0x02, 0x2a, 0x00, 0x52, 0x15, 0x75, 0x6e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, - 0x45, 0x64, 0x67, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x57, 0x0a, 0x15, - 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x5f, 0x65, 0x64, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0xaa, 0x01, 0x02, 0x2a, 0x00, - 0x52, 0x13, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x45, 0x64, 0x67, 0x65, 0x49, 0x6e, 0x74, - 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x31, 0x0a, 0x0e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x6c, - 0x6f, 0x67, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, 0x18, - 0x01, 0x92, 0xc7, 0x86, 0xd8, 0x04, 0x03, 0x33, 0x2e, 0x30, 0x52, 0x0c, 0x65, 0x76, 0x65, 0x6e, - 0x74, 0x4c, 0x6f, 0x67, 0x50, 0x61, 0x74, 0x68, 0x12, 0x4d, 0x0a, 0x0c, 0x65, 0x76, 0x65, 0x6e, - 0x74, 0x5f, 0x6c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x18, 0x19, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, - 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0b, 0x65, 0x76, 0x65, 0x6e, - 0x74, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x12, 0x4d, 0x0a, 0x0d, 0x65, 0x76, 0x65, 0x6e, 0x74, - 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, - 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x46, 0x0a, 0x20, 0x61, 0x6c, 0x77, 0x61, 0x79, 0x73, - 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x5f, 0x63, 0x68, 0x65, 0x63, - 0x6b, 0x5f, 0x66, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x1c, 0x61, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x4c, 0x6f, 0x67, 0x48, 0x65, 0x61, 0x6c, 0x74, - 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x73, 0x12, 0x4d, - 0x0a, 0x0b, 0x74, 0x6c, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x15, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, - 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x2e, 0x54, 0x6c, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x52, 0x0a, 0x74, 0x6c, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x5e, 0x0a, - 0x1f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x73, 0x6f, 0x63, 0x6b, 0x65, - 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x63, 0x72, 0x69, 0x74, 0x65, 0x72, 0x69, 0x61, - 0x18, 0x17, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, - 0x1c, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, - 0x4d, 0x61, 0x74, 0x63, 0x68, 0x43, 0x72, 0x69, 0x74, 0x65, 0x72, 0x69, 0x61, 0x1a, 0x80, 0x01, - 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1d, 0x0a, 0x04, 0x74, 0x65, 0x78, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, - 0x48, 0x00, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x18, 0x0a, 0x06, 0x62, 0x69, 0x6e, 0x61, - 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x06, 0x62, 0x69, 0x6e, 0x61, - 0x72, 0x79, 0x3a, 0x2c, 0x9a, 0xc5, 0x88, 0x1e, 0x27, 0x0a, 0x25, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x48, 0x65, 0x61, - 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, - 0x42, 0x0e, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x03, 0xf8, 0x42, 0x01, - 0x1a, 0xcc, 0x07, 0x0a, 0x0f, 0x48, 0x74, 0x74, 0x70, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, - 0x68, 0x65, 0x63, 0x6b, 0x12, 0x1f, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x0b, 0xfa, 0x42, 0x08, 0x72, 0x06, 0xc0, 0x01, 0x02, 0xc8, 0x01, 0x00, 0x52, - 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x0d, 0xfa, 0x42, 0x0a, 0x72, 0x08, 0x10, 0x01, 0xc0, 0x01, 0x02, 0xc8, - 0x01, 0x00, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x3d, 0x0a, 0x04, 0x73, 0x65, 0x6e, 0x64, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, - 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, - 0x64, 0x52, 0x04, 0x73, 0x65, 0x6e, 0x64, 0x12, 0x43, 0x0a, 0x07, 0x72, 0x65, 0x63, 0x65, 0x69, - 0x76, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, - 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x2e, 0x50, 0x61, 0x79, 0x6c, - 0x6f, 0x61, 0x64, 0x52, 0x07, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x12, 0x57, 0x0a, 0x14, - 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x5f, - 0x73, 0x69, 0x7a, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, - 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x28, - 0x00, 0x52, 0x12, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x75, 0x66, 0x66, 0x65, - 0x72, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x67, 0x0a, 0x16, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x18, - 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x09, - 0xfa, 0x42, 0x06, 0x92, 0x01, 0x03, 0x10, 0xe8, 0x07, 0x52, 0x13, 0x72, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x54, 0x6f, 0x41, 0x64, 0x64, 0x12, 0x4b, - 0x0a, 0x19, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x18, 0x08, 0x20, 0x03, 0x28, - 0x09, 0x42, 0x10, 0xfa, 0x42, 0x0d, 0x92, 0x01, 0x0a, 0x22, 0x08, 0x72, 0x06, 0xc0, 0x01, 0x01, - 0xc8, 0x01, 0x00, 0x52, 0x16, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x73, 0x54, 0x6f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x12, 0x46, 0x0a, 0x11, 0x65, - 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, - 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x61, 0x6e, 0x67, - 0x65, 0x52, 0x10, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x65, 0x73, 0x12, 0x48, 0x0a, 0x12, 0x72, 0x65, 0x74, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, - 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x2e, - 0x49, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x11, 0x72, 0x65, 0x74, 0x72, - 0x69, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x12, 0x54, 0x0a, - 0x11, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x63, 0x43, 0x6c, - 0x69, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, - 0x10, 0x01, 0x52, 0x0f, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x56, 0x0a, 0x14, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, - 0x61, 0x6d, 0x65, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, - 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x52, 0x12, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x4e, 0x61, 0x6d, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x47, 0x0a, 0x06, 0x6d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, - 0x76, 0x33, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, - 0x42, 0x0a, 0xfa, 0x42, 0x07, 0x82, 0x01, 0x04, 0x10, 0x01, 0x20, 0x06, 0x52, 0x06, 0x6d, 0x65, - 0x74, 0x68, 0x6f, 0x64, 0x3a, 0x34, 0x9a, 0xc5, 0x88, 0x1e, 0x2f, 0x0a, 0x2d, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x48, - 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x48, - 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, - 0x4a, 0x04, 0x08, 0x07, 0x10, 0x08, 0x52, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x09, 0x75, 0x73, 0x65, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x32, 0x1a, - 0xc9, 0x01, 0x0a, 0x0e, 0x54, 0x63, 0x70, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, - 0x63, 0x6b, 0x12, 0x3d, 0x0a, 0x04, 0x73, 0x65, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x29, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, - 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, - 0x65, 0x63, 0x6b, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x04, 0x73, 0x65, 0x6e, - 0x64, 0x12, 0x43, 0x0a, 0x07, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x07, 0x72, - 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x3a, 0x33, 0x9a, 0xc5, 0x88, 0x1e, 0x2e, 0x0a, 0x2c, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, - 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x2e, 0x54, 0x63, 0x70, - 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x1a, 0x5b, 0x0a, 0x10, 0x52, - 0x65, 0x64, 0x69, 0x73, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, - 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, - 0x79, 0x3a, 0x35, 0x9a, 0xc5, 0x88, 0x1e, 0x30, 0x0a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, - 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x73, 0x48, 0x65, 0x61, - 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x1a, 0xf4, 0x01, 0x0a, 0x0f, 0x47, 0x72, 0x70, - 0x63, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x21, 0x0a, 0x0c, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, - 0x29, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x0b, 0xfa, 0x42, 0x08, 0x72, 0x06, 0xc0, 0x01, 0x02, 0xc8, 0x01, 0x00, 0x52, - 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x5d, 0x0a, 0x10, 0x69, 0x6e, - 0x69, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x09, 0xfa, - 0x42, 0x06, 0x92, 0x01, 0x03, 0x10, 0xe8, 0x07, 0x52, 0x0f, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, - 0x6c, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x3a, 0x34, 0x9a, 0xc5, 0x88, 0x1e, 0x2f, - 0x0a, 0x2d, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, - 0x6f, 0x72, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x2e, - 0x47, 0x72, 0x70, 0x63, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x1a, - 0xc0, 0x01, 0x0a, 0x11, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x39, 0x0a, 0x0c, 0x74, 0x79, 0x70, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x48, 0x00, - 0x52, 0x0b, 0x74, 0x79, 0x70, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x3a, 0x36, 0x9a, - 0xc5, 0x88, 0x1e, 0x31, 0x0a, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, - 0x65, 0x63, 0x6b, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x42, 0x0d, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, - 0x74, 0x79, 0x70, 0x65, 0x4a, 0x04, 0x08, 0x02, 0x10, 0x03, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x1a, 0x64, 0x0a, 0x0a, 0x54, 0x6c, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x6c, 0x70, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, - 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x61, 0x6c, 0x70, 0x6e, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x3a, 0x2f, 0x9a, 0xc5, 0x88, 0x1e, 0x2a, 0x0a, 0x28, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x2e, 0x54, 0x6c, - 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3a, 0x24, 0x9a, 0xc5, 0x88, 0x1e, 0x1f, 0x0a, - 0x1d, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x42, 0x15, - 0x0a, 0x0e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x72, - 0x12, 0x03, 0xf8, 0x42, 0x01, 0x4a, 0x04, 0x08, 0x0a, 0x10, 0x0b, 0x2a, 0x60, 0x0a, 0x0c, 0x48, - 0x65, 0x61, 0x6c, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x55, - 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x48, 0x45, 0x41, 0x4c, - 0x54, 0x48, 0x59, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x48, 0x45, 0x41, 0x4c, 0x54, - 0x48, 0x59, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x52, 0x41, 0x49, 0x4e, 0x49, 0x4e, 0x47, - 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x10, 0x04, 0x12, - 0x0c, 0x0a, 0x08, 0x44, 0x45, 0x47, 0x52, 0x41, 0x44, 0x45, 0x44, 0x10, 0x05, 0x42, 0x84, 0x01, - 0x0a, 0x22, 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x76, 0x33, 0x42, 0x10, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, - 0x6b, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, - 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, - 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, - 0x72, 0x65, 0x2f, 0x76, 0x33, 0x3b, 0x63, 0x6f, 0x72, 0x65, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, - 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_config_core_v3_health_check_proto_rawDescOnce sync.Once - file_envoy_config_core_v3_health_check_proto_rawDescData = file_envoy_config_core_v3_health_check_proto_rawDesc -) - -func file_envoy_config_core_v3_health_check_proto_rawDescGZIP() []byte { - file_envoy_config_core_v3_health_check_proto_rawDescOnce.Do(func() { - file_envoy_config_core_v3_health_check_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_config_core_v3_health_check_proto_rawDescData) - }) - return file_envoy_config_core_v3_health_check_proto_rawDescData -} - -var file_envoy_config_core_v3_health_check_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_envoy_config_core_v3_health_check_proto_msgTypes = make([]protoimpl.MessageInfo, 9) -var file_envoy_config_core_v3_health_check_proto_goTypes = []interface{}{ - (HealthStatus)(0), // 0: envoy.config.core.v3.HealthStatus - (*HealthStatusSet)(nil), // 1: envoy.config.core.v3.HealthStatusSet - (*HealthCheck)(nil), // 2: envoy.config.core.v3.HealthCheck - (*HealthCheck_Payload)(nil), // 3: envoy.config.core.v3.HealthCheck.Payload - (*HealthCheck_HttpHealthCheck)(nil), // 4: envoy.config.core.v3.HealthCheck.HttpHealthCheck - (*HealthCheck_TcpHealthCheck)(nil), // 5: envoy.config.core.v3.HealthCheck.TcpHealthCheck - (*HealthCheck_RedisHealthCheck)(nil), // 6: envoy.config.core.v3.HealthCheck.RedisHealthCheck - (*HealthCheck_GrpcHealthCheck)(nil), // 7: envoy.config.core.v3.HealthCheck.GrpcHealthCheck - (*HealthCheck_CustomHealthCheck)(nil), // 8: envoy.config.core.v3.HealthCheck.CustomHealthCheck - (*HealthCheck_TlsOptions)(nil), // 9: envoy.config.core.v3.HealthCheck.TlsOptions - (*durationpb.Duration)(nil), // 10: google.protobuf.Duration - (*wrapperspb.UInt32Value)(nil), // 11: google.protobuf.UInt32Value - (*wrapperspb.BoolValue)(nil), // 12: google.protobuf.BoolValue - (*TypedExtensionConfig)(nil), // 13: envoy.config.core.v3.TypedExtensionConfig - (*EventServiceConfig)(nil), // 14: envoy.config.core.v3.EventServiceConfig - (*structpb.Struct)(nil), // 15: google.protobuf.Struct - (*wrapperspb.UInt64Value)(nil), // 16: google.protobuf.UInt64Value - (*HeaderValueOption)(nil), // 17: envoy.config.core.v3.HeaderValueOption - (*v3.Int64Range)(nil), // 18: envoy.type.v3.Int64Range - (v3.CodecClientType)(0), // 19: envoy.type.v3.CodecClientType - (*v31.StringMatcher)(nil), // 20: envoy.type.matcher.v3.StringMatcher - (RequestMethod)(0), // 21: envoy.config.core.v3.RequestMethod - (*anypb.Any)(nil), // 22: google.protobuf.Any -} -var file_envoy_config_core_v3_health_check_proto_depIdxs = []int32{ - 0, // 0: envoy.config.core.v3.HealthStatusSet.statuses:type_name -> envoy.config.core.v3.HealthStatus - 10, // 1: envoy.config.core.v3.HealthCheck.timeout:type_name -> google.protobuf.Duration - 10, // 2: envoy.config.core.v3.HealthCheck.interval:type_name -> google.protobuf.Duration - 10, // 3: envoy.config.core.v3.HealthCheck.initial_jitter:type_name -> google.protobuf.Duration - 10, // 4: envoy.config.core.v3.HealthCheck.interval_jitter:type_name -> google.protobuf.Duration - 11, // 5: envoy.config.core.v3.HealthCheck.unhealthy_threshold:type_name -> google.protobuf.UInt32Value - 11, // 6: envoy.config.core.v3.HealthCheck.healthy_threshold:type_name -> google.protobuf.UInt32Value - 11, // 7: envoy.config.core.v3.HealthCheck.alt_port:type_name -> google.protobuf.UInt32Value - 12, // 8: envoy.config.core.v3.HealthCheck.reuse_connection:type_name -> google.protobuf.BoolValue - 4, // 9: envoy.config.core.v3.HealthCheck.http_health_check:type_name -> envoy.config.core.v3.HealthCheck.HttpHealthCheck - 5, // 10: envoy.config.core.v3.HealthCheck.tcp_health_check:type_name -> envoy.config.core.v3.HealthCheck.TcpHealthCheck - 7, // 11: envoy.config.core.v3.HealthCheck.grpc_health_check:type_name -> envoy.config.core.v3.HealthCheck.GrpcHealthCheck - 8, // 12: envoy.config.core.v3.HealthCheck.custom_health_check:type_name -> envoy.config.core.v3.HealthCheck.CustomHealthCheck - 10, // 13: envoy.config.core.v3.HealthCheck.no_traffic_interval:type_name -> google.protobuf.Duration - 10, // 14: envoy.config.core.v3.HealthCheck.no_traffic_healthy_interval:type_name -> google.protobuf.Duration - 10, // 15: envoy.config.core.v3.HealthCheck.unhealthy_interval:type_name -> google.protobuf.Duration - 10, // 16: envoy.config.core.v3.HealthCheck.unhealthy_edge_interval:type_name -> google.protobuf.Duration - 10, // 17: envoy.config.core.v3.HealthCheck.healthy_edge_interval:type_name -> google.protobuf.Duration - 13, // 18: envoy.config.core.v3.HealthCheck.event_logger:type_name -> envoy.config.core.v3.TypedExtensionConfig - 14, // 19: envoy.config.core.v3.HealthCheck.event_service:type_name -> envoy.config.core.v3.EventServiceConfig - 9, // 20: envoy.config.core.v3.HealthCheck.tls_options:type_name -> envoy.config.core.v3.HealthCheck.TlsOptions - 15, // 21: envoy.config.core.v3.HealthCheck.transport_socket_match_criteria:type_name -> google.protobuf.Struct - 3, // 22: envoy.config.core.v3.HealthCheck.HttpHealthCheck.send:type_name -> envoy.config.core.v3.HealthCheck.Payload - 3, // 23: envoy.config.core.v3.HealthCheck.HttpHealthCheck.receive:type_name -> envoy.config.core.v3.HealthCheck.Payload - 16, // 24: envoy.config.core.v3.HealthCheck.HttpHealthCheck.response_buffer_size:type_name -> google.protobuf.UInt64Value - 17, // 25: envoy.config.core.v3.HealthCheck.HttpHealthCheck.request_headers_to_add:type_name -> envoy.config.core.v3.HeaderValueOption - 18, // 26: envoy.config.core.v3.HealthCheck.HttpHealthCheck.expected_statuses:type_name -> envoy.type.v3.Int64Range - 18, // 27: envoy.config.core.v3.HealthCheck.HttpHealthCheck.retriable_statuses:type_name -> envoy.type.v3.Int64Range - 19, // 28: envoy.config.core.v3.HealthCheck.HttpHealthCheck.codec_client_type:type_name -> envoy.type.v3.CodecClientType - 20, // 29: envoy.config.core.v3.HealthCheck.HttpHealthCheck.service_name_matcher:type_name -> envoy.type.matcher.v3.StringMatcher - 21, // 30: envoy.config.core.v3.HealthCheck.HttpHealthCheck.method:type_name -> envoy.config.core.v3.RequestMethod - 3, // 31: envoy.config.core.v3.HealthCheck.TcpHealthCheck.send:type_name -> envoy.config.core.v3.HealthCheck.Payload - 3, // 32: envoy.config.core.v3.HealthCheck.TcpHealthCheck.receive:type_name -> envoy.config.core.v3.HealthCheck.Payload - 17, // 33: envoy.config.core.v3.HealthCheck.GrpcHealthCheck.initial_metadata:type_name -> envoy.config.core.v3.HeaderValueOption - 22, // 34: envoy.config.core.v3.HealthCheck.CustomHealthCheck.typed_config:type_name -> google.protobuf.Any - 35, // [35:35] is the sub-list for method output_type - 35, // [35:35] is the sub-list for method input_type - 35, // [35:35] is the sub-list for extension type_name - 35, // [35:35] is the sub-list for extension extendee - 0, // [0:35] is the sub-list for field type_name -} - -func init() { file_envoy_config_core_v3_health_check_proto_init() } -func file_envoy_config_core_v3_health_check_proto_init() { - if File_envoy_config_core_v3_health_check_proto != nil { - return - } - file_envoy_config_core_v3_base_proto_init() - file_envoy_config_core_v3_event_service_config_proto_init() - file_envoy_config_core_v3_extension_proto_init() - if !protoimpl.UnsafeEnabled { - file_envoy_config_core_v3_health_check_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HealthStatusSet); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_health_check_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HealthCheck); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_health_check_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HealthCheck_Payload); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_health_check_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HealthCheck_HttpHealthCheck); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_health_check_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HealthCheck_TcpHealthCheck); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_health_check_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HealthCheck_RedisHealthCheck); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_health_check_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HealthCheck_GrpcHealthCheck); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_health_check_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HealthCheck_CustomHealthCheck); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_health_check_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HealthCheck_TlsOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_config_core_v3_health_check_proto_msgTypes[1].OneofWrappers = []interface{}{ - (*HealthCheck_HttpHealthCheck_)(nil), - (*HealthCheck_TcpHealthCheck_)(nil), - (*HealthCheck_GrpcHealthCheck_)(nil), - (*HealthCheck_CustomHealthCheck_)(nil), - } - file_envoy_config_core_v3_health_check_proto_msgTypes[2].OneofWrappers = []interface{}{ - (*HealthCheck_Payload_Text)(nil), - (*HealthCheck_Payload_Binary)(nil), - } - file_envoy_config_core_v3_health_check_proto_msgTypes[7].OneofWrappers = []interface{}{ - (*HealthCheck_CustomHealthCheck_TypedConfig)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_config_core_v3_health_check_proto_rawDesc, - NumEnums: 1, - NumMessages: 9, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_config_core_v3_health_check_proto_goTypes, - DependencyIndexes: file_envoy_config_core_v3_health_check_proto_depIdxs, - EnumInfos: file_envoy_config_core_v3_health_check_proto_enumTypes, - MessageInfos: file_envoy_config_core_v3_health_check_proto_msgTypes, - }.Build() - File_envoy_config_core_v3_health_check_proto = out.File - file_envoy_config_core_v3_health_check_proto_rawDesc = nil - file_envoy_config_core_v3_health_check_proto_goTypes = nil - file_envoy_config_core_v3_health_check_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/health_check.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/health_check.pb.validate.go deleted file mode 100644 index d496267b7..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/health_check.pb.validate.go +++ /dev/null @@ -1,2259 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/config/core/v3/health_check.proto - -package corev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" - - v3 "github.com/cilium/proxy/go/envoy/type/v3" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort - - _ = v3.CodecClientType(0) -) - -// Validate checks the field values on HealthStatusSet with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *HealthStatusSet) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HealthStatusSet with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// HealthStatusSetMultiError, or nil if none found. -func (m *HealthStatusSet) ValidateAll() error { - return m.validate(true) -} - -func (m *HealthStatusSet) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetStatuses() { - _, _ = idx, item - - if _, ok := HealthStatus_name[int32(item)]; !ok { - err := HealthStatusSetValidationError{ - field: fmt.Sprintf("Statuses[%v]", idx), - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if len(errors) > 0 { - return HealthStatusSetMultiError(errors) - } - - return nil -} - -// HealthStatusSetMultiError is an error wrapping multiple validation errors -// returned by HealthStatusSet.ValidateAll() if the designated constraints -// aren't met. -type HealthStatusSetMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HealthStatusSetMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HealthStatusSetMultiError) AllErrors() []error { return m } - -// HealthStatusSetValidationError is the validation error returned by -// HealthStatusSet.Validate if the designated constraints aren't met. -type HealthStatusSetValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HealthStatusSetValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HealthStatusSetValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HealthStatusSetValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HealthStatusSetValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HealthStatusSetValidationError) ErrorName() string { return "HealthStatusSetValidationError" } - -// Error satisfies the builtin error interface -func (e HealthStatusSetValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHealthStatusSet.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HealthStatusSetValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HealthStatusSetValidationError{} - -// Validate checks the field values on HealthCheck with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *HealthCheck) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HealthCheck with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in HealthCheckMultiError, or -// nil if none found. -func (m *HealthCheck) ValidateAll() error { - return m.validate(true) -} - -func (m *HealthCheck) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetTimeout() == nil { - err := HealthCheckValidationError{ - field: "Timeout", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if d := m.GetTimeout(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = HealthCheckValidationError{ - field: "Timeout", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - gt := time.Duration(0*time.Second + 0*time.Nanosecond) - - if dur <= gt { - err := HealthCheckValidationError{ - field: "Timeout", - reason: "value must be greater than 0s", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if m.GetInterval() == nil { - err := HealthCheckValidationError{ - field: "Interval", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if d := m.GetInterval(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = HealthCheckValidationError{ - field: "Interval", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - gt := time.Duration(0*time.Second + 0*time.Nanosecond) - - if dur <= gt { - err := HealthCheckValidationError{ - field: "Interval", - reason: "value must be greater than 0s", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if all { - switch v := interface{}(m.GetInitialJitter()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "InitialJitter", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "InitialJitter", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetInitialJitter()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HealthCheckValidationError{ - field: "InitialJitter", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetIntervalJitter()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "IntervalJitter", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "IntervalJitter", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetIntervalJitter()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HealthCheckValidationError{ - field: "IntervalJitter", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for IntervalJitterPercent - - if m.GetUnhealthyThreshold() == nil { - err := HealthCheckValidationError{ - field: "UnhealthyThreshold", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetUnhealthyThreshold()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "UnhealthyThreshold", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "UnhealthyThreshold", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetUnhealthyThreshold()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HealthCheckValidationError{ - field: "UnhealthyThreshold", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if m.GetHealthyThreshold() == nil { - err := HealthCheckValidationError{ - field: "HealthyThreshold", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetHealthyThreshold()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "HealthyThreshold", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "HealthyThreshold", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHealthyThreshold()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HealthCheckValidationError{ - field: "HealthyThreshold", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetAltPort()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "AltPort", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "AltPort", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetAltPort()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HealthCheckValidationError{ - field: "AltPort", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetReuseConnection()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "ReuseConnection", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "ReuseConnection", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetReuseConnection()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HealthCheckValidationError{ - field: "ReuseConnection", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if d := m.GetNoTrafficInterval(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = HealthCheckValidationError{ - field: "NoTrafficInterval", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - gt := time.Duration(0*time.Second + 0*time.Nanosecond) - - if dur <= gt { - err := HealthCheckValidationError{ - field: "NoTrafficInterval", - reason: "value must be greater than 0s", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if d := m.GetNoTrafficHealthyInterval(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = HealthCheckValidationError{ - field: "NoTrafficHealthyInterval", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - gt := time.Duration(0*time.Second + 0*time.Nanosecond) - - if dur <= gt { - err := HealthCheckValidationError{ - field: "NoTrafficHealthyInterval", - reason: "value must be greater than 0s", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if d := m.GetUnhealthyInterval(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = HealthCheckValidationError{ - field: "UnhealthyInterval", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - gt := time.Duration(0*time.Second + 0*time.Nanosecond) - - if dur <= gt { - err := HealthCheckValidationError{ - field: "UnhealthyInterval", - reason: "value must be greater than 0s", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if d := m.GetUnhealthyEdgeInterval(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = HealthCheckValidationError{ - field: "UnhealthyEdgeInterval", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - gt := time.Duration(0*time.Second + 0*time.Nanosecond) - - if dur <= gt { - err := HealthCheckValidationError{ - field: "UnhealthyEdgeInterval", - reason: "value must be greater than 0s", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if d := m.GetHealthyEdgeInterval(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = HealthCheckValidationError{ - field: "HealthyEdgeInterval", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - gt := time.Duration(0*time.Second + 0*time.Nanosecond) - - if dur <= gt { - err := HealthCheckValidationError{ - field: "HealthyEdgeInterval", - reason: "value must be greater than 0s", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - // no validation rules for EventLogPath - - for idx, item := range m.GetEventLogger() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: fmt.Sprintf("EventLogger[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: fmt.Sprintf("EventLogger[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HealthCheckValidationError{ - field: fmt.Sprintf("EventLogger[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetEventService()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "EventService", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "EventService", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetEventService()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HealthCheckValidationError{ - field: "EventService", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for AlwaysLogHealthCheckFailures - - if all { - switch v := interface{}(m.GetTlsOptions()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "TlsOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "TlsOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTlsOptions()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HealthCheckValidationError{ - field: "TlsOptions", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetTransportSocketMatchCriteria()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "TransportSocketMatchCriteria", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "TransportSocketMatchCriteria", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTransportSocketMatchCriteria()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HealthCheckValidationError{ - field: "TransportSocketMatchCriteria", - reason: "embedded message failed validation", - cause: err, - } - } - } - - oneofHealthCheckerPresent := false - switch v := m.HealthChecker.(type) { - case *HealthCheck_HttpHealthCheck_: - if v == nil { - err := HealthCheckValidationError{ - field: "HealthChecker", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofHealthCheckerPresent = true - - if all { - switch v := interface{}(m.GetHttpHealthCheck()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "HttpHealthCheck", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "HttpHealthCheck", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHttpHealthCheck()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HealthCheckValidationError{ - field: "HttpHealthCheck", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *HealthCheck_TcpHealthCheck_: - if v == nil { - err := HealthCheckValidationError{ - field: "HealthChecker", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofHealthCheckerPresent = true - - if all { - switch v := interface{}(m.GetTcpHealthCheck()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "TcpHealthCheck", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "TcpHealthCheck", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTcpHealthCheck()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HealthCheckValidationError{ - field: "TcpHealthCheck", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *HealthCheck_GrpcHealthCheck_: - if v == nil { - err := HealthCheckValidationError{ - field: "HealthChecker", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofHealthCheckerPresent = true - - if all { - switch v := interface{}(m.GetGrpcHealthCheck()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "GrpcHealthCheck", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "GrpcHealthCheck", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetGrpcHealthCheck()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HealthCheckValidationError{ - field: "GrpcHealthCheck", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *HealthCheck_CustomHealthCheck_: - if v == nil { - err := HealthCheckValidationError{ - field: "HealthChecker", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofHealthCheckerPresent = true - - if all { - switch v := interface{}(m.GetCustomHealthCheck()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "CustomHealthCheck", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HealthCheckValidationError{ - field: "CustomHealthCheck", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCustomHealthCheck()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HealthCheckValidationError{ - field: "CustomHealthCheck", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofHealthCheckerPresent { - err := HealthCheckValidationError{ - field: "HealthChecker", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return HealthCheckMultiError(errors) - } - - return nil -} - -// HealthCheckMultiError is an error wrapping multiple validation errors -// returned by HealthCheck.ValidateAll() if the designated constraints aren't met. -type HealthCheckMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HealthCheckMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HealthCheckMultiError) AllErrors() []error { return m } - -// HealthCheckValidationError is the validation error returned by -// HealthCheck.Validate if the designated constraints aren't met. -type HealthCheckValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HealthCheckValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HealthCheckValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HealthCheckValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HealthCheckValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HealthCheckValidationError) ErrorName() string { return "HealthCheckValidationError" } - -// Error satisfies the builtin error interface -func (e HealthCheckValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHealthCheck.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HealthCheckValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HealthCheckValidationError{} - -// Validate checks the field values on HealthCheck_Payload with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *HealthCheck_Payload) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HealthCheck_Payload with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// HealthCheck_PayloadMultiError, or nil if none found. -func (m *HealthCheck_Payload) ValidateAll() error { - return m.validate(true) -} - -func (m *HealthCheck_Payload) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofPayloadPresent := false - switch v := m.Payload.(type) { - case *HealthCheck_Payload_Text: - if v == nil { - err := HealthCheck_PayloadValidationError{ - field: "Payload", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofPayloadPresent = true - - if utf8.RuneCountInString(m.GetText()) < 1 { - err := HealthCheck_PayloadValidationError{ - field: "Text", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - case *HealthCheck_Payload_Binary: - if v == nil { - err := HealthCheck_PayloadValidationError{ - field: "Payload", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofPayloadPresent = true - // no validation rules for Binary - default: - _ = v // ensures v is used - } - if !oneofPayloadPresent { - err := HealthCheck_PayloadValidationError{ - field: "Payload", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return HealthCheck_PayloadMultiError(errors) - } - - return nil -} - -// HealthCheck_PayloadMultiError is an error wrapping multiple validation -// errors returned by HealthCheck_Payload.ValidateAll() if the designated -// constraints aren't met. -type HealthCheck_PayloadMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HealthCheck_PayloadMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HealthCheck_PayloadMultiError) AllErrors() []error { return m } - -// HealthCheck_PayloadValidationError is the validation error returned by -// HealthCheck_Payload.Validate if the designated constraints aren't met. -type HealthCheck_PayloadValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HealthCheck_PayloadValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HealthCheck_PayloadValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HealthCheck_PayloadValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HealthCheck_PayloadValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HealthCheck_PayloadValidationError) ErrorName() string { - return "HealthCheck_PayloadValidationError" -} - -// Error satisfies the builtin error interface -func (e HealthCheck_PayloadValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHealthCheck_Payload.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HealthCheck_PayloadValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HealthCheck_PayloadValidationError{} - -// Validate checks the field values on HealthCheck_HttpHealthCheck with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *HealthCheck_HttpHealthCheck) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HealthCheck_HttpHealthCheck with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// HealthCheck_HttpHealthCheckMultiError, or nil if none found. -func (m *HealthCheck_HttpHealthCheck) ValidateAll() error { - return m.validate(true) -} - -func (m *HealthCheck_HttpHealthCheck) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if !_HealthCheck_HttpHealthCheck_Host_Pattern.MatchString(m.GetHost()) { - err := HealthCheck_HttpHealthCheckValidationError{ - field: "Host", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - if utf8.RuneCountInString(m.GetPath()) < 1 { - err := HealthCheck_HttpHealthCheckValidationError{ - field: "Path", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_HealthCheck_HttpHealthCheck_Path_Pattern.MatchString(m.GetPath()) { - err := HealthCheck_HttpHealthCheckValidationError{ - field: "Path", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetSend()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HealthCheck_HttpHealthCheckValidationError{ - field: "Send", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HealthCheck_HttpHealthCheckValidationError{ - field: "Send", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSend()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HealthCheck_HttpHealthCheckValidationError{ - field: "Send", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetReceive() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HealthCheck_HttpHealthCheckValidationError{ - field: fmt.Sprintf("Receive[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HealthCheck_HttpHealthCheckValidationError{ - field: fmt.Sprintf("Receive[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HealthCheck_HttpHealthCheckValidationError{ - field: fmt.Sprintf("Receive[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if wrapper := m.GetResponseBufferSize(); wrapper != nil { - - if wrapper.GetValue() < 0 { - err := HealthCheck_HttpHealthCheckValidationError{ - field: "ResponseBufferSize", - reason: "value must be greater than or equal to 0", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if len(m.GetRequestHeadersToAdd()) > 1000 { - err := HealthCheck_HttpHealthCheckValidationError{ - field: "RequestHeadersToAdd", - reason: "value must contain no more than 1000 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetRequestHeadersToAdd() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HealthCheck_HttpHealthCheckValidationError{ - field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HealthCheck_HttpHealthCheckValidationError{ - field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HealthCheck_HttpHealthCheckValidationError{ - field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetRequestHeadersToRemove() { - _, _ = idx, item - - if !_HealthCheck_HttpHealthCheck_RequestHeadersToRemove_Pattern.MatchString(item) { - err := HealthCheck_HttpHealthCheckValidationError{ - field: fmt.Sprintf("RequestHeadersToRemove[%v]", idx), - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - for idx, item := range m.GetExpectedStatuses() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HealthCheck_HttpHealthCheckValidationError{ - field: fmt.Sprintf("ExpectedStatuses[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HealthCheck_HttpHealthCheckValidationError{ - field: fmt.Sprintf("ExpectedStatuses[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HealthCheck_HttpHealthCheckValidationError{ - field: fmt.Sprintf("ExpectedStatuses[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetRetriableStatuses() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HealthCheck_HttpHealthCheckValidationError{ - field: fmt.Sprintf("RetriableStatuses[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HealthCheck_HttpHealthCheckValidationError{ - field: fmt.Sprintf("RetriableStatuses[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HealthCheck_HttpHealthCheckValidationError{ - field: fmt.Sprintf("RetriableStatuses[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if _, ok := v3.CodecClientType_name[int32(m.GetCodecClientType())]; !ok { - err := HealthCheck_HttpHealthCheckValidationError{ - field: "CodecClientType", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetServiceNameMatcher()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HealthCheck_HttpHealthCheckValidationError{ - field: "ServiceNameMatcher", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HealthCheck_HttpHealthCheckValidationError{ - field: "ServiceNameMatcher", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetServiceNameMatcher()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HealthCheck_HttpHealthCheckValidationError{ - field: "ServiceNameMatcher", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if _, ok := _HealthCheck_HttpHealthCheck_Method_NotInLookup[m.GetMethod()]; ok { - err := HealthCheck_HttpHealthCheckValidationError{ - field: "Method", - reason: "value must not be in list [CONNECT]", - } - if !all { - return err - } - errors = append(errors, err) - } - - if _, ok := RequestMethod_name[int32(m.GetMethod())]; !ok { - err := HealthCheck_HttpHealthCheckValidationError{ - field: "Method", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return HealthCheck_HttpHealthCheckMultiError(errors) - } - - return nil -} - -// HealthCheck_HttpHealthCheckMultiError is an error wrapping multiple -// validation errors returned by HealthCheck_HttpHealthCheck.ValidateAll() if -// the designated constraints aren't met. -type HealthCheck_HttpHealthCheckMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HealthCheck_HttpHealthCheckMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HealthCheck_HttpHealthCheckMultiError) AllErrors() []error { return m } - -// HealthCheck_HttpHealthCheckValidationError is the validation error returned -// by HealthCheck_HttpHealthCheck.Validate if the designated constraints -// aren't met. -type HealthCheck_HttpHealthCheckValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HealthCheck_HttpHealthCheckValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HealthCheck_HttpHealthCheckValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HealthCheck_HttpHealthCheckValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HealthCheck_HttpHealthCheckValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HealthCheck_HttpHealthCheckValidationError) ErrorName() string { - return "HealthCheck_HttpHealthCheckValidationError" -} - -// Error satisfies the builtin error interface -func (e HealthCheck_HttpHealthCheckValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHealthCheck_HttpHealthCheck.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HealthCheck_HttpHealthCheckValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HealthCheck_HttpHealthCheckValidationError{} - -var _HealthCheck_HttpHealthCheck_Host_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -var _HealthCheck_HttpHealthCheck_Path_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -var _HealthCheck_HttpHealthCheck_RequestHeadersToRemove_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -var _HealthCheck_HttpHealthCheck_Method_NotInLookup = map[RequestMethod]struct{}{ - 6: {}, -} - -// Validate checks the field values on HealthCheck_TcpHealthCheck with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *HealthCheck_TcpHealthCheck) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HealthCheck_TcpHealthCheck with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// HealthCheck_TcpHealthCheckMultiError, or nil if none found. -func (m *HealthCheck_TcpHealthCheck) ValidateAll() error { - return m.validate(true) -} - -func (m *HealthCheck_TcpHealthCheck) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetSend()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HealthCheck_TcpHealthCheckValidationError{ - field: "Send", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HealthCheck_TcpHealthCheckValidationError{ - field: "Send", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSend()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HealthCheck_TcpHealthCheckValidationError{ - field: "Send", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetReceive() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HealthCheck_TcpHealthCheckValidationError{ - field: fmt.Sprintf("Receive[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HealthCheck_TcpHealthCheckValidationError{ - field: fmt.Sprintf("Receive[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HealthCheck_TcpHealthCheckValidationError{ - field: fmt.Sprintf("Receive[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return HealthCheck_TcpHealthCheckMultiError(errors) - } - - return nil -} - -// HealthCheck_TcpHealthCheckMultiError is an error wrapping multiple -// validation errors returned by HealthCheck_TcpHealthCheck.ValidateAll() if -// the designated constraints aren't met. -type HealthCheck_TcpHealthCheckMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HealthCheck_TcpHealthCheckMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HealthCheck_TcpHealthCheckMultiError) AllErrors() []error { return m } - -// HealthCheck_TcpHealthCheckValidationError is the validation error returned -// by HealthCheck_TcpHealthCheck.Validate if the designated constraints aren't met. -type HealthCheck_TcpHealthCheckValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HealthCheck_TcpHealthCheckValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HealthCheck_TcpHealthCheckValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HealthCheck_TcpHealthCheckValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HealthCheck_TcpHealthCheckValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HealthCheck_TcpHealthCheckValidationError) ErrorName() string { - return "HealthCheck_TcpHealthCheckValidationError" -} - -// Error satisfies the builtin error interface -func (e HealthCheck_TcpHealthCheckValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHealthCheck_TcpHealthCheck.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HealthCheck_TcpHealthCheckValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HealthCheck_TcpHealthCheckValidationError{} - -// Validate checks the field values on HealthCheck_RedisHealthCheck with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *HealthCheck_RedisHealthCheck) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HealthCheck_RedisHealthCheck with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// HealthCheck_RedisHealthCheckMultiError, or nil if none found. -func (m *HealthCheck_RedisHealthCheck) ValidateAll() error { - return m.validate(true) -} - -func (m *HealthCheck_RedisHealthCheck) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Key - - if len(errors) > 0 { - return HealthCheck_RedisHealthCheckMultiError(errors) - } - - return nil -} - -// HealthCheck_RedisHealthCheckMultiError is an error wrapping multiple -// validation errors returned by HealthCheck_RedisHealthCheck.ValidateAll() if -// the designated constraints aren't met. -type HealthCheck_RedisHealthCheckMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HealthCheck_RedisHealthCheckMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HealthCheck_RedisHealthCheckMultiError) AllErrors() []error { return m } - -// HealthCheck_RedisHealthCheckValidationError is the validation error returned -// by HealthCheck_RedisHealthCheck.Validate if the designated constraints -// aren't met. -type HealthCheck_RedisHealthCheckValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HealthCheck_RedisHealthCheckValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HealthCheck_RedisHealthCheckValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HealthCheck_RedisHealthCheckValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HealthCheck_RedisHealthCheckValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HealthCheck_RedisHealthCheckValidationError) ErrorName() string { - return "HealthCheck_RedisHealthCheckValidationError" -} - -// Error satisfies the builtin error interface -func (e HealthCheck_RedisHealthCheckValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHealthCheck_RedisHealthCheck.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HealthCheck_RedisHealthCheckValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HealthCheck_RedisHealthCheckValidationError{} - -// Validate checks the field values on HealthCheck_GrpcHealthCheck with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *HealthCheck_GrpcHealthCheck) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HealthCheck_GrpcHealthCheck with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// HealthCheck_GrpcHealthCheckMultiError, or nil if none found. -func (m *HealthCheck_GrpcHealthCheck) ValidateAll() error { - return m.validate(true) -} - -func (m *HealthCheck_GrpcHealthCheck) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ServiceName - - if !_HealthCheck_GrpcHealthCheck_Authority_Pattern.MatchString(m.GetAuthority()) { - err := HealthCheck_GrpcHealthCheckValidationError{ - field: "Authority", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(m.GetInitialMetadata()) > 1000 { - err := HealthCheck_GrpcHealthCheckValidationError{ - field: "InitialMetadata", - reason: "value must contain no more than 1000 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetInitialMetadata() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HealthCheck_GrpcHealthCheckValidationError{ - field: fmt.Sprintf("InitialMetadata[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HealthCheck_GrpcHealthCheckValidationError{ - field: fmt.Sprintf("InitialMetadata[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HealthCheck_GrpcHealthCheckValidationError{ - field: fmt.Sprintf("InitialMetadata[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return HealthCheck_GrpcHealthCheckMultiError(errors) - } - - return nil -} - -// HealthCheck_GrpcHealthCheckMultiError is an error wrapping multiple -// validation errors returned by HealthCheck_GrpcHealthCheck.ValidateAll() if -// the designated constraints aren't met. -type HealthCheck_GrpcHealthCheckMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HealthCheck_GrpcHealthCheckMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HealthCheck_GrpcHealthCheckMultiError) AllErrors() []error { return m } - -// HealthCheck_GrpcHealthCheckValidationError is the validation error returned -// by HealthCheck_GrpcHealthCheck.Validate if the designated constraints -// aren't met. -type HealthCheck_GrpcHealthCheckValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HealthCheck_GrpcHealthCheckValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HealthCheck_GrpcHealthCheckValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HealthCheck_GrpcHealthCheckValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HealthCheck_GrpcHealthCheckValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HealthCheck_GrpcHealthCheckValidationError) ErrorName() string { - return "HealthCheck_GrpcHealthCheckValidationError" -} - -// Error satisfies the builtin error interface -func (e HealthCheck_GrpcHealthCheckValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHealthCheck_GrpcHealthCheck.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HealthCheck_GrpcHealthCheckValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HealthCheck_GrpcHealthCheckValidationError{} - -var _HealthCheck_GrpcHealthCheck_Authority_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -// Validate checks the field values on HealthCheck_CustomHealthCheck with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *HealthCheck_CustomHealthCheck) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HealthCheck_CustomHealthCheck with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// HealthCheck_CustomHealthCheckMultiError, or nil if none found. -func (m *HealthCheck_CustomHealthCheck) ValidateAll() error { - return m.validate(true) -} - -func (m *HealthCheck_CustomHealthCheck) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := HealthCheck_CustomHealthCheckValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - switch v := m.ConfigType.(type) { - case *HealthCheck_CustomHealthCheck_TypedConfig: - if v == nil { - err := HealthCheck_CustomHealthCheckValidationError{ - field: "ConfigType", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetTypedConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HealthCheck_CustomHealthCheckValidationError{ - field: "TypedConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HealthCheck_CustomHealthCheckValidationError{ - field: "TypedConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HealthCheck_CustomHealthCheckValidationError{ - field: "TypedConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return HealthCheck_CustomHealthCheckMultiError(errors) - } - - return nil -} - -// HealthCheck_CustomHealthCheckMultiError is an error wrapping multiple -// validation errors returned by HealthCheck_CustomHealthCheck.ValidateAll() -// if the designated constraints aren't met. -type HealthCheck_CustomHealthCheckMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HealthCheck_CustomHealthCheckMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HealthCheck_CustomHealthCheckMultiError) AllErrors() []error { return m } - -// HealthCheck_CustomHealthCheckValidationError is the validation error -// returned by HealthCheck_CustomHealthCheck.Validate if the designated -// constraints aren't met. -type HealthCheck_CustomHealthCheckValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HealthCheck_CustomHealthCheckValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HealthCheck_CustomHealthCheckValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HealthCheck_CustomHealthCheckValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HealthCheck_CustomHealthCheckValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HealthCheck_CustomHealthCheckValidationError) ErrorName() string { - return "HealthCheck_CustomHealthCheckValidationError" -} - -// Error satisfies the builtin error interface -func (e HealthCheck_CustomHealthCheckValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHealthCheck_CustomHealthCheck.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HealthCheck_CustomHealthCheckValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HealthCheck_CustomHealthCheckValidationError{} - -// Validate checks the field values on HealthCheck_TlsOptions with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *HealthCheck_TlsOptions) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HealthCheck_TlsOptions with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// HealthCheck_TlsOptionsMultiError, or nil if none found. -func (m *HealthCheck_TlsOptions) ValidateAll() error { - return m.validate(true) -} - -func (m *HealthCheck_TlsOptions) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return HealthCheck_TlsOptionsMultiError(errors) - } - - return nil -} - -// HealthCheck_TlsOptionsMultiError is an error wrapping multiple validation -// errors returned by HealthCheck_TlsOptions.ValidateAll() if the designated -// constraints aren't met. -type HealthCheck_TlsOptionsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HealthCheck_TlsOptionsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HealthCheck_TlsOptionsMultiError) AllErrors() []error { return m } - -// HealthCheck_TlsOptionsValidationError is the validation error returned by -// HealthCheck_TlsOptions.Validate if the designated constraints aren't met. -type HealthCheck_TlsOptionsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HealthCheck_TlsOptionsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HealthCheck_TlsOptionsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HealthCheck_TlsOptionsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HealthCheck_TlsOptionsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HealthCheck_TlsOptionsValidationError) ErrorName() string { - return "HealthCheck_TlsOptionsValidationError" -} - -// Error satisfies the builtin error interface -func (e HealthCheck_TlsOptionsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHealthCheck_TlsOptions.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HealthCheck_TlsOptionsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HealthCheck_TlsOptionsValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/http_service.pb.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/http_service.pb.go deleted file mode 100644 index 500d46880..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/http_service.pb.go +++ /dev/null @@ -1,199 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/config/core/v3/http_service.proto - -package corev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// HTTP service configuration. -type HttpService struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The service's HTTP URI. For example: - // - // .. code-block:: yaml - // - // http_uri: - // uri: https://www.myserviceapi.com/v1/data - // cluster: www.myserviceapi.com|443 - HttpUri *HttpUri `protobuf:"bytes,1,opt,name=http_uri,json=httpUri,proto3" json:"http_uri,omitempty"` - // Specifies a list of HTTP headers that should be added to each request - // handled by this virtual host. - RequestHeadersToAdd []*HeaderValueOption `protobuf:"bytes,2,rep,name=request_headers_to_add,json=requestHeadersToAdd,proto3" json:"request_headers_to_add,omitempty"` -} - -func (x *HttpService) Reset() { - *x = HttpService{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_http_service_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HttpService) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HttpService) ProtoMessage() {} - -func (x *HttpService) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_http_service_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HttpService.ProtoReflect.Descriptor instead. -func (*HttpService) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_http_service_proto_rawDescGZIP(), []int{0} -} - -func (x *HttpService) GetHttpUri() *HttpUri { - if x != nil { - return x.HttpUri - } - return nil -} - -func (x *HttpService) GetRequestHeadersToAdd() []*HeaderValueOption { - if x != nil { - return x.RequestHeadersToAdd - } - return nil -} - -var File_envoy_config_core_v3_http_service_proto protoreflect.FileDescriptor - -var file_envoy_config_core_v3_http_service_proto_rawDesc = []byte{ - 0x0a, 0x27, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x1a, - 0x1f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, - 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x23, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x75, 0x72, 0x69, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb0, 0x01, - 0x0a, 0x0b, 0x48, 0x74, 0x74, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x38, 0x0a, - 0x08, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x75, 0x72, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1d, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, - 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x55, 0x72, 0x69, 0x52, 0x07, - 0x68, 0x74, 0x74, 0x70, 0x55, 0x72, 0x69, 0x12, 0x67, 0x0a, 0x16, 0x72, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x61, 0x64, - 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x42, 0x09, 0xfa, 0x42, 0x06, 0x92, 0x01, 0x03, 0x10, 0xe8, 0x07, 0x52, 0x13, 0x72, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x54, 0x6f, 0x41, 0x64, 0x64, - 0x42, 0x84, 0x01, 0x0a, 0x22, 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, - 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, - 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x42, 0x10, 0x48, 0x74, 0x74, 0x70, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x42, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, - 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, - 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x3b, 0x63, 0x6f, 0x72, 0x65, 0x76, 0x33, 0xba, - 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_config_core_v3_http_service_proto_rawDescOnce sync.Once - file_envoy_config_core_v3_http_service_proto_rawDescData = file_envoy_config_core_v3_http_service_proto_rawDesc -) - -func file_envoy_config_core_v3_http_service_proto_rawDescGZIP() []byte { - file_envoy_config_core_v3_http_service_proto_rawDescOnce.Do(func() { - file_envoy_config_core_v3_http_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_config_core_v3_http_service_proto_rawDescData) - }) - return file_envoy_config_core_v3_http_service_proto_rawDescData -} - -var file_envoy_config_core_v3_http_service_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_config_core_v3_http_service_proto_goTypes = []interface{}{ - (*HttpService)(nil), // 0: envoy.config.core.v3.HttpService - (*HttpUri)(nil), // 1: envoy.config.core.v3.HttpUri - (*HeaderValueOption)(nil), // 2: envoy.config.core.v3.HeaderValueOption -} -var file_envoy_config_core_v3_http_service_proto_depIdxs = []int32{ - 1, // 0: envoy.config.core.v3.HttpService.http_uri:type_name -> envoy.config.core.v3.HttpUri - 2, // 1: envoy.config.core.v3.HttpService.request_headers_to_add:type_name -> envoy.config.core.v3.HeaderValueOption - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_envoy_config_core_v3_http_service_proto_init() } -func file_envoy_config_core_v3_http_service_proto_init() { - if File_envoy_config_core_v3_http_service_proto != nil { - return - } - file_envoy_config_core_v3_base_proto_init() - file_envoy_config_core_v3_http_uri_proto_init() - if !protoimpl.UnsafeEnabled { - file_envoy_config_core_v3_http_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HttpService); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_config_core_v3_http_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_config_core_v3_http_service_proto_goTypes, - DependencyIndexes: file_envoy_config_core_v3_http_service_proto_depIdxs, - MessageInfos: file_envoy_config_core_v3_http_service_proto_msgTypes, - }.Build() - File_envoy_config_core_v3_http_service_proto = out.File - file_envoy_config_core_v3_http_service_proto_rawDesc = nil - file_envoy_config_core_v3_http_service_proto_goTypes = nil - file_envoy_config_core_v3_http_service_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/http_service.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/http_service.pb.validate.go deleted file mode 100644 index 2d9590507..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/http_service.pb.validate.go +++ /dev/null @@ -1,209 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/config/core/v3/http_service.proto - -package corev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on HttpService with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *HttpService) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HttpService with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in HttpServiceMultiError, or -// nil if none found. -func (m *HttpService) ValidateAll() error { - return m.validate(true) -} - -func (m *HttpService) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetHttpUri()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpServiceValidationError{ - field: "HttpUri", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpServiceValidationError{ - field: "HttpUri", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHttpUri()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpServiceValidationError{ - field: "HttpUri", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(m.GetRequestHeadersToAdd()) > 1000 { - err := HttpServiceValidationError{ - field: "RequestHeadersToAdd", - reason: "value must contain no more than 1000 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetRequestHeadersToAdd() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpServiceValidationError{ - field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpServiceValidationError{ - field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpServiceValidationError{ - field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return HttpServiceMultiError(errors) - } - - return nil -} - -// HttpServiceMultiError is an error wrapping multiple validation errors -// returned by HttpService.ValidateAll() if the designated constraints aren't met. -type HttpServiceMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HttpServiceMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HttpServiceMultiError) AllErrors() []error { return m } - -// HttpServiceValidationError is the validation error returned by -// HttpService.Validate if the designated constraints aren't met. -type HttpServiceValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HttpServiceValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HttpServiceValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HttpServiceValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HttpServiceValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HttpServiceValidationError) ErrorName() string { return "HttpServiceValidationError" } - -// Error satisfies the builtin error interface -func (e HttpServiceValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttpService.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HttpServiceValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HttpServiceValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/http_uri.pb.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/http_uri.pb.go deleted file mode 100644 index e95c1ff8a..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/http_uri.pb.go +++ /dev/null @@ -1,241 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/config/core/v3/http_uri.proto - -package corev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - durationpb "google.golang.org/protobuf/types/known/durationpb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Envoy external URI descriptor -type HttpUri struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The HTTP server URI. It should be a full FQDN with protocol, host and path. - // - // Example: - // - // .. code-block:: yaml - // - // uri: https://www.googleapis.com/oauth2/v1/certs - Uri string `protobuf:"bytes,1,opt,name=uri,proto3" json:"uri,omitempty"` - // Specify how “uri“ is to be fetched. Today, this requires an explicit - // cluster, but in the future we may support dynamic cluster creation or - // inline DNS resolution. See `issue - // `_. - // - // Types that are assignable to HttpUpstreamType: - // - // *HttpUri_Cluster - HttpUpstreamType isHttpUri_HttpUpstreamType `protobuf_oneof:"http_upstream_type"` - // Sets the maximum duration in milliseconds that a response can take to arrive upon request. - Timeout *durationpb.Duration `protobuf:"bytes,3,opt,name=timeout,proto3" json:"timeout,omitempty"` -} - -func (x *HttpUri) Reset() { - *x = HttpUri{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_http_uri_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HttpUri) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HttpUri) ProtoMessage() {} - -func (x *HttpUri) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_http_uri_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HttpUri.ProtoReflect.Descriptor instead. -func (*HttpUri) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_http_uri_proto_rawDescGZIP(), []int{0} -} - -func (x *HttpUri) GetUri() string { - if x != nil { - return x.Uri - } - return "" -} - -func (m *HttpUri) GetHttpUpstreamType() isHttpUri_HttpUpstreamType { - if m != nil { - return m.HttpUpstreamType - } - return nil -} - -func (x *HttpUri) GetCluster() string { - if x, ok := x.GetHttpUpstreamType().(*HttpUri_Cluster); ok { - return x.Cluster - } - return "" -} - -func (x *HttpUri) GetTimeout() *durationpb.Duration { - if x != nil { - return x.Timeout - } - return nil -} - -type isHttpUri_HttpUpstreamType interface { - isHttpUri_HttpUpstreamType() -} - -type HttpUri_Cluster struct { - // A cluster is created in the Envoy "cluster_manager" config - // section. This field specifies the cluster name. - // - // Example: - // - // .. code-block:: yaml - // - // cluster: jwks_cluster - Cluster string `protobuf:"bytes,2,opt,name=cluster,proto3,oneof"` -} - -func (*HttpUri_Cluster) isHttpUri_HttpUpstreamType() {} - -var File_envoy_config_core_v3_http_uri_proto protoreflect.FileDescriptor - -var file_envoy_config_core_v3_http_uri_proto_rawDesc = []byte{ - 0x0a, 0x23, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x75, 0x72, 0x69, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x75, 0x64, 0x70, - 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x75, 0x64, 0x70, 0x61, - 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcf, 0x01, 0x0a, 0x07, 0x48, 0x74, 0x74, 0x70, 0x55, - 0x72, 0x69, 0x12, 0x19, 0x0a, 0x03, 0x75, 0x72, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x75, 0x72, 0x69, 0x12, 0x23, 0x0a, - 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, - 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, - 0x65, 0x72, 0x12, 0x47, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x12, - 0xfa, 0x42, 0x0f, 0xaa, 0x01, 0x0c, 0x08, 0x01, 0x1a, 0x06, 0x08, 0x80, 0x80, 0x80, 0x80, 0x10, - 0x32, 0x00, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x3a, 0x20, 0x9a, 0xc5, 0x88, - 0x1e, 0x1b, 0x0a, 0x19, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x55, 0x72, 0x69, 0x42, 0x19, 0x0a, - 0x12, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x42, 0x80, 0x01, 0x0a, 0x22, 0x69, 0x6f, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x42, - 0x0c, 0x48, 0x74, 0x74, 0x70, 0x55, 0x72, 0x69, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, - 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x3b, 0x63, 0x6f, 0x72, - 0x65, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_config_core_v3_http_uri_proto_rawDescOnce sync.Once - file_envoy_config_core_v3_http_uri_proto_rawDescData = file_envoy_config_core_v3_http_uri_proto_rawDesc -) - -func file_envoy_config_core_v3_http_uri_proto_rawDescGZIP() []byte { - file_envoy_config_core_v3_http_uri_proto_rawDescOnce.Do(func() { - file_envoy_config_core_v3_http_uri_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_config_core_v3_http_uri_proto_rawDescData) - }) - return file_envoy_config_core_v3_http_uri_proto_rawDescData -} - -var file_envoy_config_core_v3_http_uri_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_config_core_v3_http_uri_proto_goTypes = []interface{}{ - (*HttpUri)(nil), // 0: envoy.config.core.v3.HttpUri - (*durationpb.Duration)(nil), // 1: google.protobuf.Duration -} -var file_envoy_config_core_v3_http_uri_proto_depIdxs = []int32{ - 1, // 0: envoy.config.core.v3.HttpUri.timeout:type_name -> google.protobuf.Duration - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_envoy_config_core_v3_http_uri_proto_init() } -func file_envoy_config_core_v3_http_uri_proto_init() { - if File_envoy_config_core_v3_http_uri_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_envoy_config_core_v3_http_uri_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HttpUri); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_config_core_v3_http_uri_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*HttpUri_Cluster)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_config_core_v3_http_uri_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_config_core_v3_http_uri_proto_goTypes, - DependencyIndexes: file_envoy_config_core_v3_http_uri_proto_depIdxs, - MessageInfos: file_envoy_config_core_v3_http_uri_proto_msgTypes, - }.Build() - File_envoy_config_core_v3_http_uri_proto = out.File - file_envoy_config_core_v3_http_uri_proto_rawDesc = nil - file_envoy_config_core_v3_http_uri_proto_goTypes = nil - file_envoy_config_core_v3_http_uri_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/http_uri.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/http_uri.pb.validate.go deleted file mode 100644 index 2c0a69c41..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/http_uri.pb.validate.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/config/core/v3/http_uri.proto - -package corev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on HttpUri with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *HttpUri) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HttpUri with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in HttpUriMultiError, or nil if none found. -func (m *HttpUri) ValidateAll() error { - return m.validate(true) -} - -func (m *HttpUri) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetUri()) < 1 { - err := HttpUriValidationError{ - field: "Uri", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if m.GetTimeout() == nil { - err := HttpUriValidationError{ - field: "Timeout", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if d := m.GetTimeout(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = HttpUriValidationError{ - field: "Timeout", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - lt := time.Duration(4294967296*time.Second + 0*time.Nanosecond) - gte := time.Duration(0*time.Second + 0*time.Nanosecond) - - if dur < gte || dur >= lt { - err := HttpUriValidationError{ - field: "Timeout", - reason: "value must be inside range [0s, 1193046h28m16s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - oneofHttpUpstreamTypePresent := false - switch v := m.HttpUpstreamType.(type) { - case *HttpUri_Cluster: - if v == nil { - err := HttpUriValidationError{ - field: "HttpUpstreamType", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofHttpUpstreamTypePresent = true - - if utf8.RuneCountInString(m.GetCluster()) < 1 { - err := HttpUriValidationError{ - field: "Cluster", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - default: - _ = v // ensures v is used - } - if !oneofHttpUpstreamTypePresent { - err := HttpUriValidationError{ - field: "HttpUpstreamType", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return HttpUriMultiError(errors) - } - - return nil -} - -// HttpUriMultiError is an error wrapping multiple validation errors returned -// by HttpUri.ValidateAll() if the designated constraints aren't met. -type HttpUriMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HttpUriMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HttpUriMultiError) AllErrors() []error { return m } - -// HttpUriValidationError is the validation error returned by HttpUri.Validate -// if the designated constraints aren't met. -type HttpUriValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HttpUriValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HttpUriValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HttpUriValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HttpUriValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HttpUriValidationError) ErrorName() string { return "HttpUriValidationError" } - -// Error satisfies the builtin error interface -func (e HttpUriValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttpUri.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HttpUriValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HttpUriValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/protocol.pb.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/protocol.pb.go deleted file mode 100644 index 84429e557..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/protocol.pb.go +++ /dev/null @@ -1,2409 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/config/core/v3/protocol.proto - -package corev3 - -import ( - _ "github.com/cilium/proxy/go/envoy/annotations" - v3 "github.com/cilium/proxy/go/envoy/type/v3" - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/cncf/xds/go/xds/annotations/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - durationpb "google.golang.org/protobuf/types/known/durationpb" - wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Action to take when Envoy receives client request with header names containing underscore -// characters. -// Underscore character is allowed in header names by the RFC-7230 and this behavior is implemented -// as a security measure due to systems that treat '_' and '-' as interchangeable. Envoy by default allows client request headers with underscore -// characters. -type HttpProtocolOptions_HeadersWithUnderscoresAction int32 - -const ( - // Allow headers with underscores. This is the default behavior. - HttpProtocolOptions_ALLOW HttpProtocolOptions_HeadersWithUnderscoresAction = 0 - // Reject client request. HTTP/1 requests are rejected with the 400 status. HTTP/2 requests - // end with the stream reset. The "httpN.requests_rejected_with_underscores_in_headers" counter - // is incremented for each rejected request. - HttpProtocolOptions_REJECT_REQUEST HttpProtocolOptions_HeadersWithUnderscoresAction = 1 - // Drop the client header with name containing underscores. The header is dropped before the filter chain is - // invoked and as such filters will not see dropped headers. The - // "httpN.dropped_headers_with_underscores" is incremented for each dropped header. - HttpProtocolOptions_DROP_HEADER HttpProtocolOptions_HeadersWithUnderscoresAction = 2 -) - -// Enum value maps for HttpProtocolOptions_HeadersWithUnderscoresAction. -var ( - HttpProtocolOptions_HeadersWithUnderscoresAction_name = map[int32]string{ - 0: "ALLOW", - 1: "REJECT_REQUEST", - 2: "DROP_HEADER", - } - HttpProtocolOptions_HeadersWithUnderscoresAction_value = map[string]int32{ - "ALLOW": 0, - "REJECT_REQUEST": 1, - "DROP_HEADER": 2, - } -) - -func (x HttpProtocolOptions_HeadersWithUnderscoresAction) Enum() *HttpProtocolOptions_HeadersWithUnderscoresAction { - p := new(HttpProtocolOptions_HeadersWithUnderscoresAction) - *p = x - return p -} - -func (x HttpProtocolOptions_HeadersWithUnderscoresAction) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (HttpProtocolOptions_HeadersWithUnderscoresAction) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_config_core_v3_protocol_proto_enumTypes[0].Descriptor() -} - -func (HttpProtocolOptions_HeadersWithUnderscoresAction) Type() protoreflect.EnumType { - return &file_envoy_config_core_v3_protocol_proto_enumTypes[0] -} - -func (x HttpProtocolOptions_HeadersWithUnderscoresAction) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use HttpProtocolOptions_HeadersWithUnderscoresAction.Descriptor instead. -func (HttpProtocolOptions_HeadersWithUnderscoresAction) EnumDescriptor() ([]byte, []int) { - return file_envoy_config_core_v3_protocol_proto_rawDescGZIP(), []int{5, 0} -} - -// [#not-implemented-hide:] -type TcpProtocolOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *TcpProtocolOptions) Reset() { - *x = TcpProtocolOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TcpProtocolOptions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TcpProtocolOptions) ProtoMessage() {} - -func (x *TcpProtocolOptions) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TcpProtocolOptions.ProtoReflect.Descriptor instead. -func (*TcpProtocolOptions) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_protocol_proto_rawDescGZIP(), []int{0} -} - -// Config for keepalive probes in a QUIC connection. -// Note that QUIC keep-alive probing packets work differently from HTTP/2 keep-alive PINGs in a sense that the probing packet -// itself doesn't timeout waiting for a probing response. Quic has a shorter idle timeout than TCP, so it doesn't rely on such probing to discover dead connections. If the peer fails to respond, the connection will idle timeout eventually. Thus, they are configured differently from :ref:`connection_keepalive `. -type QuicKeepAliveSettings struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The max interval for a connection to send keep-alive probing packets (with PING or PATH_RESPONSE). The value should be smaller than :ref:`connection idle_timeout ` to prevent idle timeout while not less than 1s to avoid throttling the connection or flooding the peer with probes. - // - // If :ref:`initial_interval ` is absent or zero, a client connection will use this value to start probing. - // - // If zero, disable keepalive probing. - // If absent, use the QUICHE default interval to probe. - MaxInterval *durationpb.Duration `protobuf:"bytes,1,opt,name=max_interval,json=maxInterval,proto3" json:"max_interval,omitempty"` - // The interval to send the first few keep-alive probing packets to prevent connection from hitting the idle timeout. Subsequent probes will be sent, each one with an interval exponentially longer than previous one, till it reaches :ref:`max_interval `. And the probes afterwards will always use :ref:`max_interval `. - // - // The value should be smaller than :ref:`connection idle_timeout ` to prevent idle timeout and smaller than max_interval to take effect. - // - // If absent or zero, disable keepalive probing for a server connection. For a client connection, if :ref:`max_interval ` is also zero, do not keepalive, otherwise use max_interval or QUICHE default to probe all the time. - InitialInterval *durationpb.Duration `protobuf:"bytes,2,opt,name=initial_interval,json=initialInterval,proto3" json:"initial_interval,omitempty"` -} - -func (x *QuicKeepAliveSettings) Reset() { - *x = QuicKeepAliveSettings{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QuicKeepAliveSettings) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QuicKeepAliveSettings) ProtoMessage() {} - -func (x *QuicKeepAliveSettings) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use QuicKeepAliveSettings.ProtoReflect.Descriptor instead. -func (*QuicKeepAliveSettings) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_protocol_proto_rawDescGZIP(), []int{1} -} - -func (x *QuicKeepAliveSettings) GetMaxInterval() *durationpb.Duration { - if x != nil { - return x.MaxInterval - } - return nil -} - -func (x *QuicKeepAliveSettings) GetInitialInterval() *durationpb.Duration { - if x != nil { - return x.InitialInterval - } - return nil -} - -// QUIC protocol options which apply to both downstream and upstream connections. -// [#next-free-field: 8] -type QuicProtocolOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Maximum number of streams that the client can negotiate per connection. 100 - // if not specified. - MaxConcurrentStreams *wrapperspb.UInt32Value `protobuf:"bytes,1,opt,name=max_concurrent_streams,json=maxConcurrentStreams,proto3" json:"max_concurrent_streams,omitempty"` - // `Initial stream-level flow-control receive window - // `_ size. Valid values range from - // 1 to 16777216 (2^24, maximum supported by QUICHE) and defaults to 65536 (2^16). - // - // NOTE: 16384 (2^14) is the minimum window size supported in Google QUIC. If configured smaller than it, we will use 16384 instead. - // QUICHE IETF Quic implementation supports 1 bytes window. We only support increasing the default window size now, so it's also the minimum. - // - // This field also acts as a soft limit on the number of bytes Envoy will buffer per-stream in the - // QUIC stream send and receive buffers. Once the buffer reaches this pointer, watermark callbacks will fire to - // stop the flow of data to the stream buffers. - InitialStreamWindowSize *wrapperspb.UInt32Value `protobuf:"bytes,2,opt,name=initial_stream_window_size,json=initialStreamWindowSize,proto3" json:"initial_stream_window_size,omitempty"` - // Similar to “initial_stream_window_size“, but for connection-level - // flow-control. Valid values rage from 1 to 25165824 (24MB, maximum supported by QUICHE) and defaults to 65536 (2^16). - // window. Currently, this has the same minimum/default as “initial_stream_window_size“. - // - // NOTE: 16384 (2^14) is the minimum window size supported in Google QUIC. We only support increasing the default - // window size now, so it's also the minimum. - InitialConnectionWindowSize *wrapperspb.UInt32Value `protobuf:"bytes,3,opt,name=initial_connection_window_size,json=initialConnectionWindowSize,proto3" json:"initial_connection_window_size,omitempty"` - // The number of timeouts that can occur before port migration is triggered for QUIC clients. - // This defaults to 4. If set to 0, port migration will not occur on path degrading. - // Timeout here refers to QUIC internal path degrading timeout mechanism, such as PTO. - // This has no effect on server sessions. - NumTimeoutsToTriggerPortMigration *wrapperspb.UInt32Value `protobuf:"bytes,4,opt,name=num_timeouts_to_trigger_port_migration,json=numTimeoutsToTriggerPortMigration,proto3" json:"num_timeouts_to_trigger_port_migration,omitempty"` - // Probes the peer at the configured interval to solicit traffic, i.e. ACK or PATH_RESPONSE, from the peer to push back connection idle timeout. - // If absent, use the default keepalive behavior of which a client connection sends PINGs every 15s, and a server connection doesn't do anything. - ConnectionKeepalive *QuicKeepAliveSettings `protobuf:"bytes,5,opt,name=connection_keepalive,json=connectionKeepalive,proto3" json:"connection_keepalive,omitempty"` - // A comma-separated list of strings representing QUIC connection options defined in - // `QUICHE `_ and to be sent by upstream connections. - ConnectionOptions string `protobuf:"bytes,6,opt,name=connection_options,json=connectionOptions,proto3" json:"connection_options,omitempty"` - // A comma-separated list of strings representing QUIC client connection options defined in - // `QUICHE `_ and to be sent by upstream connections. - ClientConnectionOptions string `protobuf:"bytes,7,opt,name=client_connection_options,json=clientConnectionOptions,proto3" json:"client_connection_options,omitempty"` -} - -func (x *QuicProtocolOptions) Reset() { - *x = QuicProtocolOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QuicProtocolOptions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QuicProtocolOptions) ProtoMessage() {} - -func (x *QuicProtocolOptions) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use QuicProtocolOptions.ProtoReflect.Descriptor instead. -func (*QuicProtocolOptions) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_protocol_proto_rawDescGZIP(), []int{2} -} - -func (x *QuicProtocolOptions) GetMaxConcurrentStreams() *wrapperspb.UInt32Value { - if x != nil { - return x.MaxConcurrentStreams - } - return nil -} - -func (x *QuicProtocolOptions) GetInitialStreamWindowSize() *wrapperspb.UInt32Value { - if x != nil { - return x.InitialStreamWindowSize - } - return nil -} - -func (x *QuicProtocolOptions) GetInitialConnectionWindowSize() *wrapperspb.UInt32Value { - if x != nil { - return x.InitialConnectionWindowSize - } - return nil -} - -func (x *QuicProtocolOptions) GetNumTimeoutsToTriggerPortMigration() *wrapperspb.UInt32Value { - if x != nil { - return x.NumTimeoutsToTriggerPortMigration - } - return nil -} - -func (x *QuicProtocolOptions) GetConnectionKeepalive() *QuicKeepAliveSettings { - if x != nil { - return x.ConnectionKeepalive - } - return nil -} - -func (x *QuicProtocolOptions) GetConnectionOptions() string { - if x != nil { - return x.ConnectionOptions - } - return "" -} - -func (x *QuicProtocolOptions) GetClientConnectionOptions() string { - if x != nil { - return x.ClientConnectionOptions - } - return "" -} - -type UpstreamHttpProtocolOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Set transport socket `SNI `_ for new - // upstream connections based on the downstream HTTP host/authority header or any other arbitrary - // header when :ref:`override_auto_sni_header ` - // is set, as seen by the :ref:`router filter `. - // Does nothing if a filter before the http router filter sets the corresponding metadata. - AutoSni bool `protobuf:"varint,1,opt,name=auto_sni,json=autoSni,proto3" json:"auto_sni,omitempty"` - // Automatic validate upstream presented certificate for new upstream connections based on the - // downstream HTTP host/authority header or any other arbitrary header when :ref:`override_auto_sni_header ` - // is set, as seen by the :ref:`router filter `. - // This field is intended to be set with “auto_sni“ field. - // Does nothing if a filter before the http router filter sets the corresponding metadata. - AutoSanValidation bool `protobuf:"varint,2,opt,name=auto_san_validation,json=autoSanValidation,proto3" json:"auto_san_validation,omitempty"` - // An optional alternative to the host/authority header to be used for setting the SNI value. - // It should be a valid downstream HTTP header, as seen by the - // :ref:`router filter `. - // If unset, host/authority header will be used for populating the SNI. If the specified header - // is not found or the value is empty, host/authority header will be used instead. - // This field is intended to be set with “auto_sni“ and/or “auto_san_validation“ fields. - // If none of these fields are set then setting this would be a no-op. - // Does nothing if a filter before the http router filter sets the corresponding metadata. - OverrideAutoSniHeader string `protobuf:"bytes,3,opt,name=override_auto_sni_header,json=overrideAutoSniHeader,proto3" json:"override_auto_sni_header,omitempty"` -} - -func (x *UpstreamHttpProtocolOptions) Reset() { - *x = UpstreamHttpProtocolOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpstreamHttpProtocolOptions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpstreamHttpProtocolOptions) ProtoMessage() {} - -func (x *UpstreamHttpProtocolOptions) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpstreamHttpProtocolOptions.ProtoReflect.Descriptor instead. -func (*UpstreamHttpProtocolOptions) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_protocol_proto_rawDescGZIP(), []int{3} -} - -func (x *UpstreamHttpProtocolOptions) GetAutoSni() bool { - if x != nil { - return x.AutoSni - } - return false -} - -func (x *UpstreamHttpProtocolOptions) GetAutoSanValidation() bool { - if x != nil { - return x.AutoSanValidation - } - return false -} - -func (x *UpstreamHttpProtocolOptions) GetOverrideAutoSniHeader() string { - if x != nil { - return x.OverrideAutoSniHeader - } - return "" -} - -// Configures the alternate protocols cache which tracks alternate protocols that can be used to -// make an HTTP connection to an origin server. See https://tools.ietf.org/html/rfc7838 for -// HTTP Alternative Services and https://datatracker.ietf.org/doc/html/draft-ietf-dnsop-svcb-https-04 -// for the "HTTPS" DNS resource record. -// [#next-free-field: 6] -type AlternateProtocolsCacheOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of the cache. Multiple named caches allow independent alternate protocols cache - // configurations to operate within a single Envoy process using different configurations. All - // alternate protocols cache options with the same name *must* be equal in all fields when - // referenced from different configuration components. Configuration will fail to load if this is - // not the case. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The maximum number of entries that the cache will hold. If not specified defaults to 1024. - // - // .. note: - // - // The implementation is approximate and enforced independently on each worker thread, thus - // it is possible for the maximum entries in the cache to go slightly above the configured - // value depending on timing. This is similar to how other circuit breakers work. - MaxEntries *wrapperspb.UInt32Value `protobuf:"bytes,2,opt,name=max_entries,json=maxEntries,proto3" json:"max_entries,omitempty"` - // Allows configuring a persistent - // :ref:`key value store ` to flush - // alternate protocols entries to disk. - // This function is currently only supported if concurrency is 1 - // Cached entries will take precedence over pre-populated entries below. - KeyValueStoreConfig *TypedExtensionConfig `protobuf:"bytes,3,opt,name=key_value_store_config,json=keyValueStoreConfig,proto3" json:"key_value_store_config,omitempty"` - // Allows pre-populating the cache with entries, as described above. - PrepopulatedEntries []*AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry `protobuf:"bytes,4,rep,name=prepopulated_entries,json=prepopulatedEntries,proto3" json:"prepopulated_entries,omitempty"` - // Optional list of hostnames suffixes for which Alt-Svc entries can be shared. For example, if - // this list contained the value “.c.example.com“, then an Alt-Svc entry for “foo.c.example.com“ - // could be shared with “bar.c.example.com“ but would not be shared with “baz.example.com“. On - // the other hand, if the list contained the value “.example.com“ then all three hosts could share - // Alt-Svc entries. Each entry must start with “.“. If a hostname matches multiple suffixes, the - // first listed suffix will be used. - // - // Since lookup in this list is O(n), it is recommended that the number of suffixes be limited. - // [#not-implemented-hide:] - CanonicalSuffixes []string `protobuf:"bytes,5,rep,name=canonical_suffixes,json=canonicalSuffixes,proto3" json:"canonical_suffixes,omitempty"` -} - -func (x *AlternateProtocolsCacheOptions) Reset() { - *x = AlternateProtocolsCacheOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AlternateProtocolsCacheOptions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AlternateProtocolsCacheOptions) ProtoMessage() {} - -func (x *AlternateProtocolsCacheOptions) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AlternateProtocolsCacheOptions.ProtoReflect.Descriptor instead. -func (*AlternateProtocolsCacheOptions) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_protocol_proto_rawDescGZIP(), []int{4} -} - -func (x *AlternateProtocolsCacheOptions) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *AlternateProtocolsCacheOptions) GetMaxEntries() *wrapperspb.UInt32Value { - if x != nil { - return x.MaxEntries - } - return nil -} - -func (x *AlternateProtocolsCacheOptions) GetKeyValueStoreConfig() *TypedExtensionConfig { - if x != nil { - return x.KeyValueStoreConfig - } - return nil -} - -func (x *AlternateProtocolsCacheOptions) GetPrepopulatedEntries() []*AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry { - if x != nil { - return x.PrepopulatedEntries - } - return nil -} - -func (x *AlternateProtocolsCacheOptions) GetCanonicalSuffixes() []string { - if x != nil { - return x.CanonicalSuffixes - } - return nil -} - -// [#next-free-field: 7] -type HttpProtocolOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The idle timeout for connections. The idle timeout is defined as the - // period in which there are no active requests. When the - // idle timeout is reached the connection will be closed. If the connection is an HTTP/2 - // downstream connection a drain sequence will occur prior to closing the connection, see - // :ref:`drain_timeout - // `. - // Note that request based timeouts mean that HTTP/2 PINGs will not keep the connection alive. - // If not specified, this defaults to 1 hour. To disable idle timeouts explicitly set this to 0. - // - // .. warning:: - // - // Disabling this timeout has a highly likelihood of yielding connection leaks due to lost TCP - // FIN packets, etc. - // - // If the :ref:`overload action ` "envoy.overload_actions.reduce_timeouts" - // is configured, this timeout is scaled for downstream connections according to the value for - // :ref:`HTTP_DOWNSTREAM_CONNECTION_IDLE `. - IdleTimeout *durationpb.Duration `protobuf:"bytes,1,opt,name=idle_timeout,json=idleTimeout,proto3" json:"idle_timeout,omitempty"` - // The maximum duration of a connection. The duration is defined as a period since a connection - // was established. If not set, there is no max duration. When max_connection_duration is reached - // and if there are no active streams, the connection will be closed. If the connection is a - // downstream connection and there are any active streams, the drain sequence will kick-in, - // and the connection will be force-closed after the drain period. See :ref:`drain_timeout - // `. - MaxConnectionDuration *durationpb.Duration `protobuf:"bytes,3,opt,name=max_connection_duration,json=maxConnectionDuration,proto3" json:"max_connection_duration,omitempty"` - // The maximum number of headers. If unconfigured, the default - // maximum number of request headers allowed is 100. Requests that exceed this limit will receive - // a 431 response for HTTP/1.x and cause a stream reset for HTTP/2. - MaxHeadersCount *wrapperspb.UInt32Value `protobuf:"bytes,2,opt,name=max_headers_count,json=maxHeadersCount,proto3" json:"max_headers_count,omitempty"` - // Total duration to keep alive an HTTP request/response stream. If the time limit is reached the stream will be - // reset independent of any other timeouts. If not specified, this value is not set. - MaxStreamDuration *durationpb.Duration `protobuf:"bytes,4,opt,name=max_stream_duration,json=maxStreamDuration,proto3" json:"max_stream_duration,omitempty"` - // Action to take when a client request with a header name containing underscore characters is received. - // If this setting is not specified, the value defaults to ALLOW. - // Note: upstream responses are not affected by this setting. - // Note: this only affects client headers. It does not affect headers added - // by Envoy filters and does not have any impact if added to cluster config. - HeadersWithUnderscoresAction HttpProtocolOptions_HeadersWithUnderscoresAction `protobuf:"varint,5,opt,name=headers_with_underscores_action,json=headersWithUnderscoresAction,proto3,enum=envoy.config.core.v3.HttpProtocolOptions_HeadersWithUnderscoresAction" json:"headers_with_underscores_action,omitempty"` - // Optional maximum requests for both upstream and downstream connections. - // If not specified, there is no limit. - // Setting this parameter to 1 will effectively disable keep alive. - // For HTTP/2 and HTTP/3, due to concurrent stream processing, the limit is approximate. - MaxRequestsPerConnection *wrapperspb.UInt32Value `protobuf:"bytes,6,opt,name=max_requests_per_connection,json=maxRequestsPerConnection,proto3" json:"max_requests_per_connection,omitempty"` -} - -func (x *HttpProtocolOptions) Reset() { - *x = HttpProtocolOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HttpProtocolOptions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HttpProtocolOptions) ProtoMessage() {} - -func (x *HttpProtocolOptions) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HttpProtocolOptions.ProtoReflect.Descriptor instead. -func (*HttpProtocolOptions) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_protocol_proto_rawDescGZIP(), []int{5} -} - -func (x *HttpProtocolOptions) GetIdleTimeout() *durationpb.Duration { - if x != nil { - return x.IdleTimeout - } - return nil -} - -func (x *HttpProtocolOptions) GetMaxConnectionDuration() *durationpb.Duration { - if x != nil { - return x.MaxConnectionDuration - } - return nil -} - -func (x *HttpProtocolOptions) GetMaxHeadersCount() *wrapperspb.UInt32Value { - if x != nil { - return x.MaxHeadersCount - } - return nil -} - -func (x *HttpProtocolOptions) GetMaxStreamDuration() *durationpb.Duration { - if x != nil { - return x.MaxStreamDuration - } - return nil -} - -func (x *HttpProtocolOptions) GetHeadersWithUnderscoresAction() HttpProtocolOptions_HeadersWithUnderscoresAction { - if x != nil { - return x.HeadersWithUnderscoresAction - } - return HttpProtocolOptions_ALLOW -} - -func (x *HttpProtocolOptions) GetMaxRequestsPerConnection() *wrapperspb.UInt32Value { - if x != nil { - return x.MaxRequestsPerConnection - } - return nil -} - -// [#next-free-field: 11] -type Http1ProtocolOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Handle HTTP requests with absolute URLs in the requests. These requests - // are generally sent by clients to forward/explicit proxies. This allows clients to configure - // envoy as their HTTP proxy. In Unix, for example, this is typically done by setting the - // “http_proxy“ environment variable. - AllowAbsoluteUrl *wrapperspb.BoolValue `protobuf:"bytes,1,opt,name=allow_absolute_url,json=allowAbsoluteUrl,proto3" json:"allow_absolute_url,omitempty"` - // Handle incoming HTTP/1.0 and HTTP 0.9 requests. - // This is off by default, and not fully standards compliant. There is support for pre-HTTP/1.1 - // style connect logic, dechunking, and handling lack of client host iff - // “default_host_for_http_10“ is configured. - AcceptHttp_10 bool `protobuf:"varint,2,opt,name=accept_http_10,json=acceptHttp10,proto3" json:"accept_http_10,omitempty"` - // A default host for HTTP/1.0 requests. This is highly suggested if “accept_http_10“ is true as - // Envoy does not otherwise support HTTP/1.0 without a Host header. - // This is a no-op if “accept_http_10“ is not true. - DefaultHostForHttp_10 string `protobuf:"bytes,3,opt,name=default_host_for_http_10,json=defaultHostForHttp10,proto3" json:"default_host_for_http_10,omitempty"` - // Describes how the keys for response headers should be formatted. By default, all header keys - // are lower cased. - HeaderKeyFormat *Http1ProtocolOptions_HeaderKeyFormat `protobuf:"bytes,4,opt,name=header_key_format,json=headerKeyFormat,proto3" json:"header_key_format,omitempty"` - // Enables trailers for HTTP/1. By default the HTTP/1 codec drops proxied trailers. - // - // .. attention:: - // - // Note that this only happens when Envoy is chunk encoding which occurs when: - // - The request is HTTP/1.1. - // - Is neither a HEAD only request nor a HTTP Upgrade. - // - Not a response to a HEAD request. - // - The content length header is not present. - EnableTrailers bool `protobuf:"varint,5,opt,name=enable_trailers,json=enableTrailers,proto3" json:"enable_trailers,omitempty"` - // Allows Envoy to process requests/responses with both “Content-Length“ and “Transfer-Encoding“ - // headers set. By default such messages are rejected, but if option is enabled - Envoy will - // remove Content-Length header and process message. - // See `RFC7230, sec. 3.3.3 `_ for details. - // - // .. attention:: - // - // Enabling this option might lead to request smuggling vulnerability, especially if traffic - // is proxied via multiple layers of proxies. - // - // [#comment:TODO: This field is ignored when the - // :ref:`header validation configuration ` - // is present.] - AllowChunkedLength bool `protobuf:"varint,6,opt,name=allow_chunked_length,json=allowChunkedLength,proto3" json:"allow_chunked_length,omitempty"` - // Allows invalid HTTP messaging. When this option is false, then Envoy will terminate - // HTTP/1.1 connections upon receiving an invalid HTTP message. However, - // when this option is true, then Envoy will leave the HTTP/1.1 connection - // open where possible. - // If set, this overrides any HCM :ref:`stream_error_on_invalid_http_messaging - // `. - OverrideStreamErrorOnInvalidHttpMessage *wrapperspb.BoolValue `protobuf:"bytes,7,opt,name=override_stream_error_on_invalid_http_message,json=overrideStreamErrorOnInvalidHttpMessage,proto3" json:"override_stream_error_on_invalid_http_message,omitempty"` - // Allows sending fully qualified URLs when proxying the first line of the - // response. By default, Envoy will only send the path components in the first line. - // If this is true, Envoy will create a fully qualified URI composing scheme - // (inferred if not present), host (from the host/:authority header) and path - // (from first line or :path header). - SendFullyQualifiedUrl bool `protobuf:"varint,8,opt,name=send_fully_qualified_url,json=sendFullyQualifiedUrl,proto3" json:"send_fully_qualified_url,omitempty"` - // [#not-implemented-hide:] Hiding so that field can be removed after BalsaParser is rolled out. - // If set, force HTTP/1 parser: BalsaParser if true, http-parser if false. - // If unset, HTTP/1 parser is selected based on - // envoy.reloadable_features.http1_use_balsa_parser. - // See issue #21245. - UseBalsaParser *wrapperspb.BoolValue `protobuf:"bytes,9,opt,name=use_balsa_parser,json=useBalsaParser,proto3" json:"use_balsa_parser,omitempty"` - // [#not-implemented-hide:] Hiding so that field can be removed. - // If true, and BalsaParser is used (either `use_balsa_parser` above is true, - // or `envoy.reloadable_features.http1_use_balsa_parser` is true and - // `use_balsa_parser` is unset), then every non-empty method with only valid - // characters is accepted. Otherwise, methods not on the hard-coded list are - // rejected. - // Once UHV is enabled, this field should be removed, and BalsaParser should - // allow any method. UHV validates the method, rejecting empty string or - // invalid characters, and provides :ref:`restrict_http_methods - // ` - // to reject custom methods. - AllowCustomMethods bool `protobuf:"varint,10,opt,name=allow_custom_methods,json=allowCustomMethods,proto3" json:"allow_custom_methods,omitempty"` -} - -func (x *Http1ProtocolOptions) Reset() { - *x = Http1ProtocolOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Http1ProtocolOptions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Http1ProtocolOptions) ProtoMessage() {} - -func (x *Http1ProtocolOptions) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Http1ProtocolOptions.ProtoReflect.Descriptor instead. -func (*Http1ProtocolOptions) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_protocol_proto_rawDescGZIP(), []int{6} -} - -func (x *Http1ProtocolOptions) GetAllowAbsoluteUrl() *wrapperspb.BoolValue { - if x != nil { - return x.AllowAbsoluteUrl - } - return nil -} - -func (x *Http1ProtocolOptions) GetAcceptHttp_10() bool { - if x != nil { - return x.AcceptHttp_10 - } - return false -} - -func (x *Http1ProtocolOptions) GetDefaultHostForHttp_10() string { - if x != nil { - return x.DefaultHostForHttp_10 - } - return "" -} - -func (x *Http1ProtocolOptions) GetHeaderKeyFormat() *Http1ProtocolOptions_HeaderKeyFormat { - if x != nil { - return x.HeaderKeyFormat - } - return nil -} - -func (x *Http1ProtocolOptions) GetEnableTrailers() bool { - if x != nil { - return x.EnableTrailers - } - return false -} - -func (x *Http1ProtocolOptions) GetAllowChunkedLength() bool { - if x != nil { - return x.AllowChunkedLength - } - return false -} - -func (x *Http1ProtocolOptions) GetOverrideStreamErrorOnInvalidHttpMessage() *wrapperspb.BoolValue { - if x != nil { - return x.OverrideStreamErrorOnInvalidHttpMessage - } - return nil -} - -func (x *Http1ProtocolOptions) GetSendFullyQualifiedUrl() bool { - if x != nil { - return x.SendFullyQualifiedUrl - } - return false -} - -func (x *Http1ProtocolOptions) GetUseBalsaParser() *wrapperspb.BoolValue { - if x != nil { - return x.UseBalsaParser - } - return nil -} - -func (x *Http1ProtocolOptions) GetAllowCustomMethods() bool { - if x != nil { - return x.AllowCustomMethods - } - return false -} - -type KeepaliveSettings struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Send HTTP/2 PING frames at this period, in order to test that the connection is still alive. - // If this is zero, interval PINGs will not be sent. - Interval *durationpb.Duration `protobuf:"bytes,1,opt,name=interval,proto3" json:"interval,omitempty"` - // How long to wait for a response to a keepalive PING. If a response is not received within this - // time period, the connection will be aborted. Note that in order to prevent the influence of - // Head-of-line (HOL) blocking the timeout period is extended when *any* frame is received on - // the connection, under the assumption that if a frame is received the connection is healthy. - Timeout *durationpb.Duration `protobuf:"bytes,2,opt,name=timeout,proto3" json:"timeout,omitempty"` - // A random jitter amount as a percentage of interval that will be added to each interval. - // A value of zero means there will be no jitter. - // The default value is 15%. - IntervalJitter *v3.Percent `protobuf:"bytes,3,opt,name=interval_jitter,json=intervalJitter,proto3" json:"interval_jitter,omitempty"` - // If the connection has been idle for this duration, send a HTTP/2 ping ahead - // of new stream creation, to quickly detect dead connections. - // If this is zero, this type of PING will not be sent. - // If an interval ping is outstanding, a second ping will not be sent as the - // interval ping will determine if the connection is dead. - // - // The same feature for HTTP/3 is given by inheritance from QUICHE which uses :ref:`connection idle_timeout ` and the current PTO of the connection to decide whether to probe before sending a new request. - ConnectionIdleInterval *durationpb.Duration `protobuf:"bytes,4,opt,name=connection_idle_interval,json=connectionIdleInterval,proto3" json:"connection_idle_interval,omitempty"` -} - -func (x *KeepaliveSettings) Reset() { - *x = KeepaliveSettings{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *KeepaliveSettings) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*KeepaliveSettings) ProtoMessage() {} - -func (x *KeepaliveSettings) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use KeepaliveSettings.ProtoReflect.Descriptor instead. -func (*KeepaliveSettings) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_protocol_proto_rawDescGZIP(), []int{7} -} - -func (x *KeepaliveSettings) GetInterval() *durationpb.Duration { - if x != nil { - return x.Interval - } - return nil -} - -func (x *KeepaliveSettings) GetTimeout() *durationpb.Duration { - if x != nil { - return x.Timeout - } - return nil -} - -func (x *KeepaliveSettings) GetIntervalJitter() *v3.Percent { - if x != nil { - return x.IntervalJitter - } - return nil -} - -func (x *KeepaliveSettings) GetConnectionIdleInterval() *durationpb.Duration { - if x != nil { - return x.ConnectionIdleInterval - } - return nil -} - -// [#next-free-field: 17] -type Http2ProtocolOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // `Maximum table size `_ - // (in octets) that the encoder is permitted to use for the dynamic HPACK table. Valid values - // range from 0 to 4294967295 (2^32 - 1) and defaults to 4096. 0 effectively disables header - // compression. - HpackTableSize *wrapperspb.UInt32Value `protobuf:"bytes,1,opt,name=hpack_table_size,json=hpackTableSize,proto3" json:"hpack_table_size,omitempty"` - // `Maximum concurrent streams `_ - // allowed for peer on one HTTP/2 connection. Valid values range from 1 to 2147483647 (2^31 - 1) - // and defaults to 2147483647. - // - // For upstream connections, this also limits how many streams Envoy will initiate concurrently - // on a single connection. If the limit is reached, Envoy may queue requests or establish - // additional connections (as allowed per circuit breaker limits). - // - // This acts as an upper bound: Envoy will lower the max concurrent streams allowed on a given - // connection based on upstream settings. Config dumps will reflect the configured upper bound, - // not the per-connection negotiated limits. - MaxConcurrentStreams *wrapperspb.UInt32Value `protobuf:"bytes,2,opt,name=max_concurrent_streams,json=maxConcurrentStreams,proto3" json:"max_concurrent_streams,omitempty"` - // `Initial stream-level flow-control window - // `_ size. Valid values range from 65535 - // (2^16 - 1, HTTP/2 default) to 2147483647 (2^31 - 1, HTTP/2 maximum) and defaults to 268435456 - // (256 * 1024 * 1024). - // - // NOTE: 65535 is the initial window size from HTTP/2 spec. We only support increasing the default - // window size now, so it's also the minimum. - // - // This field also acts as a soft limit on the number of bytes Envoy will buffer per-stream in the - // HTTP/2 codec buffers. Once the buffer reaches this pointer, watermark callbacks will fire to - // stop the flow of data to the codec buffers. - InitialStreamWindowSize *wrapperspb.UInt32Value `protobuf:"bytes,3,opt,name=initial_stream_window_size,json=initialStreamWindowSize,proto3" json:"initial_stream_window_size,omitempty"` - // Similar to “initial_stream_window_size“, but for connection-level flow-control - // window. Currently, this has the same minimum/maximum/default as “initial_stream_window_size“. - InitialConnectionWindowSize *wrapperspb.UInt32Value `protobuf:"bytes,4,opt,name=initial_connection_window_size,json=initialConnectionWindowSize,proto3" json:"initial_connection_window_size,omitempty"` - // Allows proxying Websocket and other upgrades over H2 connect. - AllowConnect bool `protobuf:"varint,5,opt,name=allow_connect,json=allowConnect,proto3" json:"allow_connect,omitempty"` - // [#not-implemented-hide:] Hiding until envoy has full metadata support. - // Still under implementation. DO NOT USE. - // - // Allows metadata. See [metadata - // docs](https://github.com/envoyproxy/envoy/blob/main/source/docs/h2_metadata.md) for more - // information. - AllowMetadata bool `protobuf:"varint,6,opt,name=allow_metadata,json=allowMetadata,proto3" json:"allow_metadata,omitempty"` - // Limit the number of pending outbound downstream frames of all types (frames that are waiting to - // be written into the socket). Exceeding this limit triggers flood mitigation and connection is - // terminated. The “http2.outbound_flood“ stat tracks the number of terminated connections due - // to flood mitigation. The default limit is 10000. - MaxOutboundFrames *wrapperspb.UInt32Value `protobuf:"bytes,7,opt,name=max_outbound_frames,json=maxOutboundFrames,proto3" json:"max_outbound_frames,omitempty"` - // Limit the number of pending outbound downstream frames of types PING, SETTINGS and RST_STREAM, - // preventing high memory utilization when receiving continuous stream of these frames. Exceeding - // this limit triggers flood mitigation and connection is terminated. The - // “http2.outbound_control_flood“ stat tracks the number of terminated connections due to flood - // mitigation. The default limit is 1000. - MaxOutboundControlFrames *wrapperspb.UInt32Value `protobuf:"bytes,8,opt,name=max_outbound_control_frames,json=maxOutboundControlFrames,proto3" json:"max_outbound_control_frames,omitempty"` - // Limit the number of consecutive inbound frames of types HEADERS, CONTINUATION and DATA with an - // empty payload and no end stream flag. Those frames have no legitimate use and are abusive, but - // might be a result of a broken HTTP/2 implementation. The `http2.inbound_empty_frames_flood“ - // stat tracks the number of connections terminated due to flood mitigation. - // Setting this to 0 will terminate connection upon receiving first frame with an empty payload - // and no end stream flag. The default limit is 1. - MaxConsecutiveInboundFramesWithEmptyPayload *wrapperspb.UInt32Value `protobuf:"bytes,9,opt,name=max_consecutive_inbound_frames_with_empty_payload,json=maxConsecutiveInboundFramesWithEmptyPayload,proto3" json:"max_consecutive_inbound_frames_with_empty_payload,omitempty"` - // Limit the number of inbound PRIORITY frames allowed per each opened stream. If the number - // of PRIORITY frames received over the lifetime of connection exceeds the value calculated - // using this formula:: - // - // ``max_inbound_priority_frames_per_stream`` * (1 + ``opened_streams``) - // - // the connection is terminated. For downstream connections the “opened_streams“ is incremented when - // Envoy receives complete response headers from the upstream server. For upstream connection the - // “opened_streams“ is incremented when Envoy send the HEADERS frame for a new stream. The - // “http2.inbound_priority_frames_flood“ stat tracks - // the number of connections terminated due to flood mitigation. The default limit is 100. - MaxInboundPriorityFramesPerStream *wrapperspb.UInt32Value `protobuf:"bytes,10,opt,name=max_inbound_priority_frames_per_stream,json=maxInboundPriorityFramesPerStream,proto3" json:"max_inbound_priority_frames_per_stream,omitempty"` - // Limit the number of inbound WINDOW_UPDATE frames allowed per DATA frame sent. If the number - // of WINDOW_UPDATE frames received over the lifetime of connection exceeds the value calculated - // using this formula:: - // - // 5 + 2 * (``opened_streams`` + - // ``max_inbound_window_update_frames_per_data_frame_sent`` * ``outbound_data_frames``) - // - // the connection is terminated. For downstream connections the “opened_streams“ is incremented when - // Envoy receives complete response headers from the upstream server. For upstream connections the - // “opened_streams“ is incremented when Envoy sends the HEADERS frame for a new stream. The - // “http2.inbound_priority_frames_flood“ stat tracks the number of connections terminated due to - // flood mitigation. The default max_inbound_window_update_frames_per_data_frame_sent value is 10. - // Setting this to 1 should be enough to support HTTP/2 implementations with basic flow control, - // but more complex implementations that try to estimate available bandwidth require at least 2. - MaxInboundWindowUpdateFramesPerDataFrameSent *wrapperspb.UInt32Value `protobuf:"bytes,11,opt,name=max_inbound_window_update_frames_per_data_frame_sent,json=maxInboundWindowUpdateFramesPerDataFrameSent,proto3" json:"max_inbound_window_update_frames_per_data_frame_sent,omitempty"` - // Allows invalid HTTP messaging and headers. When this option is disabled (default), then - // the whole HTTP/2 connection is terminated upon receiving invalid HEADERS frame. However, - // when this option is enabled, only the offending stream is terminated. - // - // This is overridden by HCM :ref:`stream_error_on_invalid_http_messaging - // ` - // iff present. - // - // This is deprecated in favor of :ref:`override_stream_error_on_invalid_http_message - // ` - // - // See `RFC7540, sec. 8.1 `_ for details. - // - // Deprecated: Do not use. - StreamErrorOnInvalidHttpMessaging bool `protobuf:"varint,12,opt,name=stream_error_on_invalid_http_messaging,json=streamErrorOnInvalidHttpMessaging,proto3" json:"stream_error_on_invalid_http_messaging,omitempty"` - // Allows invalid HTTP messaging and headers. When this option is disabled (default), then - // the whole HTTP/2 connection is terminated upon receiving invalid HEADERS frame. However, - // when this option is enabled, only the offending stream is terminated. - // - // This overrides any HCM :ref:`stream_error_on_invalid_http_messaging - // ` - // - // See `RFC7540, sec. 8.1 `_ for details. - OverrideStreamErrorOnInvalidHttpMessage *wrapperspb.BoolValue `protobuf:"bytes,14,opt,name=override_stream_error_on_invalid_http_message,json=overrideStreamErrorOnInvalidHttpMessage,proto3" json:"override_stream_error_on_invalid_http_message,omitempty"` - // [#not-implemented-hide:] - // Specifies SETTINGS frame parameters to be sent to the peer, with two exceptions: - // - // 1. SETTINGS_ENABLE_PUSH (0x2) is not configurable as HTTP/2 server push is not supported by - // Envoy. - // - // 2. SETTINGS_ENABLE_CONNECT_PROTOCOL (0x8) is only configurable through the named field - // 'allow_connect'. - // - // Note that custom parameters specified through this field can not also be set in the - // corresponding named parameters: - // - // .. code-block:: text - // - // ID Field Name - // ---------------- - // 0x1 hpack_table_size - // 0x3 max_concurrent_streams - // 0x4 initial_stream_window_size - // - // Collisions will trigger config validation failure on load/update. Likewise, inconsistencies - // between custom parameters with the same identifier will trigger a failure. - // - // See `IANA HTTP/2 Settings - // `_ for - // standardized identifiers. - CustomSettingsParameters []*Http2ProtocolOptions_SettingsParameter `protobuf:"bytes,13,rep,name=custom_settings_parameters,json=customSettingsParameters,proto3" json:"custom_settings_parameters,omitempty"` - // Send HTTP/2 PING frames to verify that the connection is still healthy. If the remote peer - // does not respond within the configured timeout, the connection will be aborted. - ConnectionKeepalive *KeepaliveSettings `protobuf:"bytes,15,opt,name=connection_keepalive,json=connectionKeepalive,proto3" json:"connection_keepalive,omitempty"` - // [#not-implemented-hide:] Hiding so that the field can be removed after oghttp2 is rolled out. - // If set, force use of a particular HTTP/2 codec: oghttp2 if true, nghttp2 if false. - // If unset, HTTP/2 codec is selected based on envoy.reloadable_features.http2_use_oghttp2. - UseOghttp2Codec *wrapperspb.BoolValue `protobuf:"bytes,16,opt,name=use_oghttp2_codec,json=useOghttp2Codec,proto3" json:"use_oghttp2_codec,omitempty"` -} - -func (x *Http2ProtocolOptions) Reset() { - *x = Http2ProtocolOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Http2ProtocolOptions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Http2ProtocolOptions) ProtoMessage() {} - -func (x *Http2ProtocolOptions) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Http2ProtocolOptions.ProtoReflect.Descriptor instead. -func (*Http2ProtocolOptions) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_protocol_proto_rawDescGZIP(), []int{8} -} - -func (x *Http2ProtocolOptions) GetHpackTableSize() *wrapperspb.UInt32Value { - if x != nil { - return x.HpackTableSize - } - return nil -} - -func (x *Http2ProtocolOptions) GetMaxConcurrentStreams() *wrapperspb.UInt32Value { - if x != nil { - return x.MaxConcurrentStreams - } - return nil -} - -func (x *Http2ProtocolOptions) GetInitialStreamWindowSize() *wrapperspb.UInt32Value { - if x != nil { - return x.InitialStreamWindowSize - } - return nil -} - -func (x *Http2ProtocolOptions) GetInitialConnectionWindowSize() *wrapperspb.UInt32Value { - if x != nil { - return x.InitialConnectionWindowSize - } - return nil -} - -func (x *Http2ProtocolOptions) GetAllowConnect() bool { - if x != nil { - return x.AllowConnect - } - return false -} - -func (x *Http2ProtocolOptions) GetAllowMetadata() bool { - if x != nil { - return x.AllowMetadata - } - return false -} - -func (x *Http2ProtocolOptions) GetMaxOutboundFrames() *wrapperspb.UInt32Value { - if x != nil { - return x.MaxOutboundFrames - } - return nil -} - -func (x *Http2ProtocolOptions) GetMaxOutboundControlFrames() *wrapperspb.UInt32Value { - if x != nil { - return x.MaxOutboundControlFrames - } - return nil -} - -func (x *Http2ProtocolOptions) GetMaxConsecutiveInboundFramesWithEmptyPayload() *wrapperspb.UInt32Value { - if x != nil { - return x.MaxConsecutiveInboundFramesWithEmptyPayload - } - return nil -} - -func (x *Http2ProtocolOptions) GetMaxInboundPriorityFramesPerStream() *wrapperspb.UInt32Value { - if x != nil { - return x.MaxInboundPriorityFramesPerStream - } - return nil -} - -func (x *Http2ProtocolOptions) GetMaxInboundWindowUpdateFramesPerDataFrameSent() *wrapperspb.UInt32Value { - if x != nil { - return x.MaxInboundWindowUpdateFramesPerDataFrameSent - } - return nil -} - -// Deprecated: Do not use. -func (x *Http2ProtocolOptions) GetStreamErrorOnInvalidHttpMessaging() bool { - if x != nil { - return x.StreamErrorOnInvalidHttpMessaging - } - return false -} - -func (x *Http2ProtocolOptions) GetOverrideStreamErrorOnInvalidHttpMessage() *wrapperspb.BoolValue { - if x != nil { - return x.OverrideStreamErrorOnInvalidHttpMessage - } - return nil -} - -func (x *Http2ProtocolOptions) GetCustomSettingsParameters() []*Http2ProtocolOptions_SettingsParameter { - if x != nil { - return x.CustomSettingsParameters - } - return nil -} - -func (x *Http2ProtocolOptions) GetConnectionKeepalive() *KeepaliveSettings { - if x != nil { - return x.ConnectionKeepalive - } - return nil -} - -func (x *Http2ProtocolOptions) GetUseOghttp2Codec() *wrapperspb.BoolValue { - if x != nil { - return x.UseOghttp2Codec - } - return nil -} - -// [#not-implemented-hide:] -type GrpcProtocolOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Http2ProtocolOptions *Http2ProtocolOptions `protobuf:"bytes,1,opt,name=http2_protocol_options,json=http2ProtocolOptions,proto3" json:"http2_protocol_options,omitempty"` -} - -func (x *GrpcProtocolOptions) Reset() { - *x = GrpcProtocolOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GrpcProtocolOptions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GrpcProtocolOptions) ProtoMessage() {} - -func (x *GrpcProtocolOptions) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GrpcProtocolOptions.ProtoReflect.Descriptor instead. -func (*GrpcProtocolOptions) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_protocol_proto_rawDescGZIP(), []int{9} -} - -func (x *GrpcProtocolOptions) GetHttp2ProtocolOptions() *Http2ProtocolOptions { - if x != nil { - return x.Http2ProtocolOptions - } - return nil -} - -// A message which allows using HTTP/3. -// [#next-free-field: 6] -type Http3ProtocolOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - QuicProtocolOptions *QuicProtocolOptions `protobuf:"bytes,1,opt,name=quic_protocol_options,json=quicProtocolOptions,proto3" json:"quic_protocol_options,omitempty"` - // Allows invalid HTTP messaging and headers. When this option is disabled (default), then - // the whole HTTP/3 connection is terminated upon receiving invalid HEADERS frame. However, - // when this option is enabled, only the offending stream is terminated. - // - // If set, this overrides any HCM :ref:`stream_error_on_invalid_http_messaging - // `. - OverrideStreamErrorOnInvalidHttpMessage *wrapperspb.BoolValue `protobuf:"bytes,2,opt,name=override_stream_error_on_invalid_http_message,json=overrideStreamErrorOnInvalidHttpMessage,proto3" json:"override_stream_error_on_invalid_http_message,omitempty"` - // Allows proxying Websocket and other upgrades over HTTP/3 CONNECT using - // the header mechanisms from the `HTTP/2 extended connect RFC - // `_ - // and settings `proposed for HTTP/3 - // `_ - // Note that HTTP/3 CONNECT is not yet an RFC. - AllowExtendedConnect bool `protobuf:"varint,5,opt,name=allow_extended_connect,json=allowExtendedConnect,proto3" json:"allow_extended_connect,omitempty"` -} - -func (x *Http3ProtocolOptions) Reset() { - *x = Http3ProtocolOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Http3ProtocolOptions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Http3ProtocolOptions) ProtoMessage() {} - -func (x *Http3ProtocolOptions) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Http3ProtocolOptions.ProtoReflect.Descriptor instead. -func (*Http3ProtocolOptions) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_protocol_proto_rawDescGZIP(), []int{10} -} - -func (x *Http3ProtocolOptions) GetQuicProtocolOptions() *QuicProtocolOptions { - if x != nil { - return x.QuicProtocolOptions - } - return nil -} - -func (x *Http3ProtocolOptions) GetOverrideStreamErrorOnInvalidHttpMessage() *wrapperspb.BoolValue { - if x != nil { - return x.OverrideStreamErrorOnInvalidHttpMessage - } - return nil -} - -func (x *Http3ProtocolOptions) GetAllowExtendedConnect() bool { - if x != nil { - return x.AllowExtendedConnect - } - return false -} - -// A message to control transformations to the :scheme header -type SchemeHeaderTransformation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Transformation: - // - // *SchemeHeaderTransformation_SchemeToOverwrite - Transformation isSchemeHeaderTransformation_Transformation `protobuf_oneof:"transformation"` -} - -func (x *SchemeHeaderTransformation) Reset() { - *x = SchemeHeaderTransformation{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SchemeHeaderTransformation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SchemeHeaderTransformation) ProtoMessage() {} - -func (x *SchemeHeaderTransformation) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SchemeHeaderTransformation.ProtoReflect.Descriptor instead. -func (*SchemeHeaderTransformation) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_protocol_proto_rawDescGZIP(), []int{11} -} - -func (m *SchemeHeaderTransformation) GetTransformation() isSchemeHeaderTransformation_Transformation { - if m != nil { - return m.Transformation - } - return nil -} - -func (x *SchemeHeaderTransformation) GetSchemeToOverwrite() string { - if x, ok := x.GetTransformation().(*SchemeHeaderTransformation_SchemeToOverwrite); ok { - return x.SchemeToOverwrite - } - return "" -} - -type isSchemeHeaderTransformation_Transformation interface { - isSchemeHeaderTransformation_Transformation() -} - -type SchemeHeaderTransformation_SchemeToOverwrite struct { - // Overwrite any Scheme header with the contents of this string. - SchemeToOverwrite string `protobuf:"bytes,1,opt,name=scheme_to_overwrite,json=schemeToOverwrite,proto3,oneof"` -} - -func (*SchemeHeaderTransformation_SchemeToOverwrite) isSchemeHeaderTransformation_Transformation() {} - -// Allows pre-populating the cache with HTTP/3 alternate protocols entries with a 7 day lifetime. -// This will cause Envoy to attempt HTTP/3 to those upstreams, even if the upstreams have not -// advertised HTTP/3 support. These entries will be overwritten by alt-svc -// response headers or cached values. -// As with regular cached entries, if the origin response would result in clearing an existing -// alternate protocol cache entry, pre-populated entries will also be cleared. -// Adding a cache entry with hostname=foo.com port=123 is the equivalent of getting -// response headers -// alt-svc: h3=:"123"; ma=86400" in a response to a request to foo.com:123 -type AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The host name for the alternate protocol entry. - Hostname string `protobuf:"bytes,1,opt,name=hostname,proto3" json:"hostname,omitempty"` - // The port for the alternate protocol entry. - Port uint32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"` -} - -func (x *AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry) Reset() { - *x = AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry) ProtoMessage() {} - -func (x *AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry.ProtoReflect.Descriptor instead. -func (*AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_protocol_proto_rawDescGZIP(), []int{4, 0} -} - -func (x *AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry) GetHostname() string { - if x != nil { - return x.Hostname - } - return "" -} - -func (x *AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry) GetPort() uint32 { - if x != nil { - return x.Port - } - return 0 -} - -// [#next-free-field: 9] -type Http1ProtocolOptions_HeaderKeyFormat struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to HeaderFormat: - // - // *Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords_ - // *Http1ProtocolOptions_HeaderKeyFormat_StatefulFormatter - HeaderFormat isHttp1ProtocolOptions_HeaderKeyFormat_HeaderFormat `protobuf_oneof:"header_format"` -} - -func (x *Http1ProtocolOptions_HeaderKeyFormat) Reset() { - *x = Http1ProtocolOptions_HeaderKeyFormat{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Http1ProtocolOptions_HeaderKeyFormat) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Http1ProtocolOptions_HeaderKeyFormat) ProtoMessage() {} - -func (x *Http1ProtocolOptions_HeaderKeyFormat) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Http1ProtocolOptions_HeaderKeyFormat.ProtoReflect.Descriptor instead. -func (*Http1ProtocolOptions_HeaderKeyFormat) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_protocol_proto_rawDescGZIP(), []int{6, 0} -} - -func (m *Http1ProtocolOptions_HeaderKeyFormat) GetHeaderFormat() isHttp1ProtocolOptions_HeaderKeyFormat_HeaderFormat { - if m != nil { - return m.HeaderFormat - } - return nil -} - -func (x *Http1ProtocolOptions_HeaderKeyFormat) GetProperCaseWords() *Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords { - if x, ok := x.GetHeaderFormat().(*Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords_); ok { - return x.ProperCaseWords - } - return nil -} - -func (x *Http1ProtocolOptions_HeaderKeyFormat) GetStatefulFormatter() *TypedExtensionConfig { - if x, ok := x.GetHeaderFormat().(*Http1ProtocolOptions_HeaderKeyFormat_StatefulFormatter); ok { - return x.StatefulFormatter - } - return nil -} - -type isHttp1ProtocolOptions_HeaderKeyFormat_HeaderFormat interface { - isHttp1ProtocolOptions_HeaderKeyFormat_HeaderFormat() -} - -type Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords_ struct { - // Formats the header by proper casing words: the first character and any character following - // a special character will be capitalized if it's an alpha character. For example, - // "content-type" becomes "Content-Type", and "foo$b#$are" becomes "Foo$B#$Are". - // Note that while this results in most headers following conventional casing, certain headers - // are not covered. For example, the "TE" header will be formatted as "Te". - ProperCaseWords *Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords `protobuf:"bytes,1,opt,name=proper_case_words,json=properCaseWords,proto3,oneof"` -} - -type Http1ProtocolOptions_HeaderKeyFormat_StatefulFormatter struct { - // Configuration for stateful formatter extensions that allow using received headers to - // affect the output of encoding headers. E.g., preserving case during proxying. - // [#extension-category: envoy.http.stateful_header_formatters] - StatefulFormatter *TypedExtensionConfig `protobuf:"bytes,8,opt,name=stateful_formatter,json=statefulFormatter,proto3,oneof"` -} - -func (*Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords_) isHttp1ProtocolOptions_HeaderKeyFormat_HeaderFormat() { -} - -func (*Http1ProtocolOptions_HeaderKeyFormat_StatefulFormatter) isHttp1ProtocolOptions_HeaderKeyFormat_HeaderFormat() { -} - -type Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords) Reset() { - *x = Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords) ProtoMessage() {} - -func (x *Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords.ProtoReflect.Descriptor instead. -func (*Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_protocol_proto_rawDescGZIP(), []int{6, 0, 0} -} - -// Defines a parameter to be sent in the SETTINGS frame. -// See `RFC7540, sec. 6.5.1 `_ for details. -type Http2ProtocolOptions_SettingsParameter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The 16 bit parameter identifier. - Identifier *wrapperspb.UInt32Value `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"` - // The 32 bit parameter value. - Value *wrapperspb.UInt32Value `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *Http2ProtocolOptions_SettingsParameter) Reset() { - *x = Http2ProtocolOptions_SettingsParameter{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Http2ProtocolOptions_SettingsParameter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Http2ProtocolOptions_SettingsParameter) ProtoMessage() {} - -func (x *Http2ProtocolOptions_SettingsParameter) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_protocol_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Http2ProtocolOptions_SettingsParameter.ProtoReflect.Descriptor instead. -func (*Http2ProtocolOptions_SettingsParameter) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_protocol_proto_rawDescGZIP(), []int{8, 0} -} - -func (x *Http2ProtocolOptions_SettingsParameter) GetIdentifier() *wrapperspb.UInt32Value { - if x != nil { - return x.Identifier - } - return nil -} - -func (x *Http2ProtocolOptions_SettingsParameter) GetValue() *wrapperspb.UInt32Value { - if x != nil { - return x.Value - } - return nil -} - -var File_envoy_config_core_v3_protocol_proto protoreflect.FileDescriptor - -var file_envoy_config_core_v3_protocol_proto_rawDesc = []byte{ - 0x0a, 0x23, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x1a, 0x24, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, - 0x33, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x1b, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, - 0x2f, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, - 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, - 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, - 0x78, 0x64, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, - 0x76, 0x33, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x23, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2f, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0x41, 0x0a, 0x12, 0x54, 0x63, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3a, 0x2b, 0x9a, 0xc5, 0x88, 0x1e, 0x26, 0x0a, 0x24, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, - 0x54, 0x63, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x22, 0xb7, 0x01, 0x0a, 0x15, 0x51, 0x75, 0x69, 0x63, 0x4b, 0x65, 0x65, 0x70, 0x41, - 0x6c, 0x69, 0x76, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x4a, 0x0a, 0x0c, - 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0c, 0xfa, - 0x42, 0x09, 0xaa, 0x01, 0x06, 0x22, 0x00, 0x32, 0x02, 0x08, 0x01, 0x52, 0x0b, 0x6d, 0x61, 0x78, - 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x52, 0x0a, 0x10, 0x69, 0x6e, 0x69, 0x74, - 0x69, 0x61, 0x6c, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0c, 0xfa, - 0x42, 0x09, 0xaa, 0x01, 0x06, 0x22, 0x00, 0x32, 0x02, 0x08, 0x01, 0x52, 0x0f, 0x69, 0x6e, 0x69, - 0x74, 0x69, 0x61, 0x6c, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x22, 0x93, 0x05, 0x0a, - 0x13, 0x51, 0x75, 0x69, 0x63, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x5b, 0x0a, 0x16, 0x6d, 0x61, 0x78, 0x5f, 0x63, 0x6f, 0x6e, 0x63, - 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x28, 0x01, 0x52, 0x14, 0x6d, 0x61, 0x78, - 0x43, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x73, 0x12, 0x67, 0x0a, 0x1a, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x72, - 0x65, 0x61, 0x6d, 0x5f, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x42, 0x0c, 0xfa, 0x42, 0x09, 0x2a, 0x07, 0x18, 0x80, 0x80, 0x80, 0x08, 0x28, - 0x01, 0x52, 0x17, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x6f, 0x0a, 0x1e, 0x69, 0x6e, - 0x69, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x42, 0x0c, 0xfa, 0x42, 0x09, 0x2a, 0x07, 0x18, 0x80, 0x80, 0x80, 0x0c, 0x28, 0x01, 0x52, 0x1b, - 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x7a, 0x0a, 0x26, 0x6e, - 0x75, 0x6d, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x74, - 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x6d, 0x69, 0x67, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, - 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x09, 0xfa, 0x42, 0x06, 0x2a, 0x04, - 0x18, 0x05, 0x28, 0x00, 0x52, 0x21, 0x6e, 0x75, 0x6d, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, - 0x73, 0x54, 0x6f, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x50, 0x6f, 0x72, 0x74, 0x4d, 0x69, - 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x5e, 0x0a, 0x14, 0x63, 0x6f, 0x6e, 0x6e, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x51, 0x75, 0x69, - 0x63, 0x4b, 0x65, 0x65, 0x70, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x73, 0x52, 0x13, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, - 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x12, 0x2d, 0x0a, 0x12, 0x63, 0x6f, 0x6e, 0x6e, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x11, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3a, 0x0a, 0x19, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x17, 0x63, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x22, 0xe4, 0x01, 0x0a, 0x1b, 0x55, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x48, - 0x74, 0x74, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x75, 0x74, 0x6f, 0x5f, 0x73, 0x6e, 0x69, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x61, 0x75, 0x74, 0x6f, 0x53, 0x6e, 0x69, 0x12, 0x2e, 0x0a, - 0x13, 0x61, 0x75, 0x74, 0x6f, 0x5f, 0x73, 0x61, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x61, 0x75, 0x74, 0x6f, - 0x53, 0x61, 0x6e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x44, 0x0a, - 0x18, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x5f, 0x61, 0x75, 0x74, 0x6f, 0x5f, 0x73, - 0x6e, 0x69, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x0b, 0xfa, 0x42, 0x08, 0x72, 0x06, 0xc0, 0x01, 0x01, 0xd0, 0x01, 0x01, 0x52, 0x15, 0x6f, 0x76, - 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x41, 0x75, 0x74, 0x6f, 0x53, 0x6e, 0x69, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x3a, 0x34, 0x9a, 0xc5, 0x88, 0x1e, 0x2f, 0x0a, 0x2d, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x55, 0x70, - 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x48, 0x74, 0x74, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, - 0x6f, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x86, 0x04, 0x0a, 0x1e, 0x41, 0x6c, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, - 0x43, 0x61, 0x63, 0x68, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1b, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, - 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x61, 0x78, - 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x07, 0xfa, 0x42, - 0x04, 0x2a, 0x02, 0x20, 0x00, 0x52, 0x0a, 0x6d, 0x61, 0x78, 0x45, 0x6e, 0x74, 0x72, 0x69, 0x65, - 0x73, 0x12, 0x5f, 0x0a, 0x16, 0x6b, 0x65, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x73, - 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x2a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x45, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x13, 0x6b, - 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x12, 0x84, 0x01, 0x0a, 0x14, 0x70, 0x72, 0x65, 0x70, 0x6f, 0x70, 0x75, 0x6c, 0x61, - 0x74, 0x65, 0x64, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x51, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6c, 0x74, 0x65, 0x72, 0x6e, 0x61, - 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x43, 0x61, 0x63, 0x68, 0x65, - 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x41, 0x6c, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74, - 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x43, 0x61, 0x63, 0x68, 0x65, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x52, 0x13, 0x70, 0x72, 0x65, 0x70, 0x6f, 0x70, 0x75, 0x6c, 0x61, 0x74, - 0x65, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x12, 0x2d, 0x0a, 0x12, 0x63, 0x61, 0x6e, - 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x65, 0x73, 0x18, - 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c, - 0x53, 0x75, 0x66, 0x66, 0x69, 0x78, 0x65, 0x73, 0x1a, 0x68, 0x0a, 0x1c, 0x41, 0x6c, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x43, 0x61, - 0x63, 0x68, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x27, 0x0a, 0x08, 0x68, 0x6f, 0x73, 0x74, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, 0xfa, 0x42, 0x08, 0x72, - 0x06, 0xc0, 0x01, 0x01, 0xd0, 0x01, 0x01, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x1f, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x42, - 0x0b, 0xfa, 0x42, 0x08, 0x2a, 0x06, 0x10, 0xff, 0xff, 0x03, 0x20, 0x00, 0x52, 0x04, 0x70, 0x6f, - 0x72, 0x74, 0x22, 0xaf, 0x05, 0x0a, 0x13, 0x48, 0x74, 0x74, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x63, 0x6f, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3c, 0x0a, 0x0c, 0x69, 0x64, - 0x6c, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x69, 0x64, 0x6c, - 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x51, 0x0a, 0x17, 0x6d, 0x61, 0x78, 0x5f, - 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x15, 0x6d, 0x61, 0x78, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x51, 0x0a, 0x11, 0x6d, - 0x61, 0x78, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x28, 0x01, 0x52, 0x0f, 0x6d, - 0x61, 0x78, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x49, - 0x0a, 0x13, 0x6d, 0x61, 0x78, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x64, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x6d, 0x61, 0x78, 0x53, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x8d, 0x01, 0x0a, 0x1f, 0x68, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x75, 0x6e, 0x64, 0x65, 0x72, - 0x73, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x46, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x48, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x57, 0x69, 0x74, 0x68, 0x55, 0x6e, 0x64, 0x65, 0x72, 0x73, - 0x63, 0x6f, 0x72, 0x65, 0x73, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x1c, 0x68, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x73, 0x57, 0x69, 0x74, 0x68, 0x55, 0x6e, 0x64, 0x65, 0x72, 0x73, 0x63, 0x6f, - 0x72, 0x65, 0x73, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x5b, 0x0a, 0x1b, 0x6d, 0x61, 0x78, - 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x63, 0x6f, - 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x18, 0x6d, 0x61, - 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x50, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x6e, - 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4e, 0x0a, 0x1c, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x73, 0x57, 0x69, 0x74, 0x68, 0x55, 0x6e, 0x64, 0x65, 0x72, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x73, - 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x10, - 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x52, 0x45, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x52, 0x45, 0x51, 0x55, - 0x45, 0x53, 0x54, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x44, 0x52, 0x4f, 0x50, 0x5f, 0x48, 0x45, - 0x41, 0x44, 0x45, 0x52, 0x10, 0x02, 0x3a, 0x2c, 0x9a, 0xc5, 0x88, 0x1e, 0x27, 0x0a, 0x25, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, - 0x2e, 0x48, 0x74, 0x74, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x93, 0x09, 0x0a, 0x14, 0x48, 0x74, 0x74, 0x70, 0x31, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x48, 0x0a, - 0x12, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x61, 0x62, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x65, 0x5f, - 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x10, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x41, 0x62, 0x73, 0x6f, - 0x6c, 0x75, 0x74, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x24, 0x0a, 0x0e, 0x61, 0x63, 0x63, 0x65, 0x70, - 0x74, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x31, 0x30, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x0c, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x48, 0x74, 0x74, 0x70, 0x31, 0x30, 0x12, 0x36, 0x0a, - 0x18, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x66, 0x6f, - 0x72, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x31, 0x30, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x14, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x46, 0x6f, 0x72, 0x48, - 0x74, 0x74, 0x70, 0x31, 0x30, 0x12, 0x66, 0x0a, 0x11, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, - 0x6b, 0x65, 0x79, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x3a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, - 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x31, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x52, 0x0f, 0x68, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x27, 0x0a, - 0x0f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x65, 0x72, 0x73, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x72, - 0x61, 0x69, 0x6c, 0x65, 0x72, 0x73, 0x12, 0x30, 0x0a, 0x14, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, - 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x65, 0x64, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x43, 0x68, 0x75, 0x6e, 0x6b, - 0x65, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x7a, 0x0a, 0x2d, 0x6f, 0x76, 0x65, 0x72, - 0x72, 0x69, 0x64, 0x65, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x65, 0x72, 0x72, 0x6f, - 0x72, 0x5f, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x5f, 0x68, 0x74, 0x74, - 0x70, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x27, 0x6f, 0x76, 0x65, - 0x72, 0x72, 0x69, 0x64, 0x65, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, - 0x4f, 0x6e, 0x49, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x48, 0x74, 0x74, 0x70, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x12, 0x37, 0x0a, 0x18, 0x73, 0x65, 0x6e, 0x64, 0x5f, 0x66, 0x75, 0x6c, - 0x6c, 0x79, 0x5f, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, 0x75, 0x72, 0x6c, - 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x73, 0x65, 0x6e, 0x64, 0x46, 0x75, 0x6c, 0x6c, - 0x79, 0x51, 0x75, 0x61, 0x6c, 0x69, 0x66, 0x69, 0x65, 0x64, 0x55, 0x72, 0x6c, 0x12, 0x4e, 0x0a, - 0x10, 0x75, 0x73, 0x65, 0x5f, 0x62, 0x61, 0x6c, 0x73, 0x61, 0x5f, 0x70, 0x61, 0x72, 0x73, 0x65, - 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x42, 0x08, 0xd2, 0xc6, 0xa4, 0xe1, 0x06, 0x02, 0x08, 0x01, 0x52, 0x0e, 0x75, - 0x73, 0x65, 0x42, 0x61, 0x6c, 0x73, 0x61, 0x50, 0x61, 0x72, 0x73, 0x65, 0x72, 0x12, 0x3a, 0x0a, - 0x14, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x6d, 0x65, - 0x74, 0x68, 0x6f, 0x64, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x42, 0x08, 0xd2, 0xc6, 0xa4, - 0xe1, 0x06, 0x02, 0x08, 0x01, 0x52, 0x12, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x43, 0x75, 0x73, 0x74, - 0x6f, 0x6d, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x1a, 0x9f, 0x03, 0x0a, 0x0f, 0x48, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x78, 0x0a, - 0x11, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x5f, 0x63, 0x61, 0x73, 0x65, 0x5f, 0x77, 0x6f, 0x72, - 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x4a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, - 0x48, 0x74, 0x74, 0x70, 0x31, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x46, 0x6f, - 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x43, 0x61, 0x73, 0x65, 0x57, - 0x6f, 0x72, 0x64, 0x73, 0x48, 0x00, 0x52, 0x0f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x43, 0x61, - 0x73, 0x65, 0x57, 0x6f, 0x72, 0x64, 0x73, 0x12, 0x5b, 0x0a, 0x12, 0x73, 0x74, 0x61, 0x74, 0x65, - 0x66, 0x75, 0x6c, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x18, 0x08, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, - 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, - 0x00, 0x52, 0x11, 0x73, 0x74, 0x61, 0x74, 0x65, 0x66, 0x75, 0x6c, 0x46, 0x6f, 0x72, 0x6d, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x1a, 0x60, 0x0a, 0x0f, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x43, 0x61, - 0x73, 0x65, 0x57, 0x6f, 0x72, 0x64, 0x73, 0x3a, 0x4d, 0x9a, 0xc5, 0x88, 0x1e, 0x48, 0x0a, 0x46, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x31, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, - 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x43, 0x61, 0x73, - 0x65, 0x57, 0x6f, 0x72, 0x64, 0x73, 0x3a, 0x3d, 0x9a, 0xc5, 0x88, 0x1e, 0x38, 0x0a, 0x36, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, - 0x2e, 0x48, 0x74, 0x74, 0x70, 0x31, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x46, - 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x42, 0x14, 0x0a, 0x0d, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, - 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x3a, 0x2d, 0x9a, 0xc5, 0x88, - 0x1e, 0x28, 0x0a, 0x26, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x31, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x63, 0x6f, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xc1, 0x02, 0x0a, 0x11, 0x4b, - 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, - 0x12, 0x43, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0c, 0xfa, - 0x42, 0x09, 0xaa, 0x01, 0x06, 0x32, 0x04, 0x10, 0xc0, 0x84, 0x3d, 0x52, 0x08, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x43, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x42, 0x0e, 0xfa, 0x42, 0x0b, 0xaa, 0x01, 0x08, 0x08, 0x01, 0x32, 0x04, 0x10, 0xc0, 0x84, - 0x3d, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x3f, 0x0a, 0x0f, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x5f, 0x6a, 0x69, 0x74, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x52, 0x0e, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x76, 0x61, 0x6c, 0x4a, 0x69, 0x74, 0x74, 0x65, 0x72, 0x12, 0x61, 0x0a, 0x18, 0x63, - 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x6c, 0x65, 0x5f, 0x69, - 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0c, 0xfa, 0x42, 0x09, 0xaa, 0x01, 0x06, - 0x32, 0x04, 0x10, 0xc0, 0x84, 0x3d, 0x52, 0x16, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x49, 0x64, 0x6c, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x22, 0xd3, - 0x0e, 0x0a, 0x14, 0x48, 0x74, 0x74, 0x70, 0x32, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, - 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x46, 0x0a, 0x10, 0x68, 0x70, 0x61, 0x63, 0x6b, - 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, - 0x0e, 0x68, 0x70, 0x61, 0x63, 0x6b, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, - 0x61, 0x0a, 0x16, 0x6d, 0x61, 0x78, 0x5f, 0x63, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, - 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x0d, 0xfa, - 0x42, 0x0a, 0x2a, 0x08, 0x18, 0xff, 0xff, 0xff, 0xff, 0x07, 0x28, 0x01, 0x52, 0x14, 0x6d, 0x61, - 0x78, 0x43, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x73, 0x12, 0x6a, 0x0a, 0x1a, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x74, - 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x5f, 0x73, 0x69, 0x7a, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x42, 0x0f, 0xfa, 0x42, 0x0c, 0x2a, 0x0a, 0x18, 0xff, 0xff, 0xff, 0xff, - 0x07, 0x28, 0xff, 0xff, 0x03, 0x52, 0x17, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, - 0x72, 0x65, 0x61, 0x6d, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x72, - 0x0a, 0x1e, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x5f, 0x73, 0x69, 0x7a, 0x65, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x42, 0x0f, 0xfa, 0x42, 0x0c, 0x2a, 0x0a, 0x18, 0xff, 0xff, 0xff, 0xff, - 0x07, 0x28, 0xff, 0xff, 0x03, 0x52, 0x1b, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x43, 0x6f, - 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x53, 0x69, - 0x7a, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, - 0x65, 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x61, 0x6c, 0x6c, 0x6f, 0x77, - 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x6c, 0x6c, 0x6f, 0x77, - 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x0d, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x55, - 0x0a, 0x13, 0x6d, 0x61, 0x78, 0x5f, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x66, - 0x72, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, - 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, - 0x28, 0x01, 0x52, 0x11, 0x6d, 0x61, 0x78, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x46, - 0x72, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x64, 0x0a, 0x1b, 0x6d, 0x61, 0x78, 0x5f, 0x6f, 0x75, 0x74, - 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x66, 0x72, - 0x61, 0x6d, 0x65, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, - 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x28, - 0x01, 0x52, 0x18, 0x6d, 0x61, 0x78, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x43, 0x6f, - 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x84, 0x01, 0x0a, 0x31, - 0x6d, 0x61, 0x78, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x74, 0x69, 0x76, 0x65, 0x5f, - 0x69, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x5f, 0x77, - 0x69, 0x74, 0x68, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, - 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x2b, 0x6d, 0x61, 0x78, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x63, - 0x75, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x46, 0x72, 0x61, 0x6d, - 0x65, 0x73, 0x57, 0x69, 0x74, 0x68, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x61, 0x79, 0x6c, 0x6f, - 0x61, 0x64, 0x12, 0x6f, 0x0a, 0x26, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6e, 0x62, 0x6f, 0x75, 0x6e, - 0x64, 0x5f, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x66, 0x72, 0x61, 0x6d, 0x65, - 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x18, 0x0a, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x52, 0x21, 0x6d, 0x61, 0x78, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x50, 0x72, 0x69, 0x6f, - 0x72, 0x69, 0x74, 0x79, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x50, 0x65, 0x72, 0x53, 0x74, 0x72, - 0x65, 0x61, 0x6d, 0x12, 0x91, 0x01, 0x0a, 0x34, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6e, 0x62, 0x6f, - 0x75, 0x6e, 0x64, 0x5f, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x5f, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x64, 0x61, 0x74, - 0x61, 0x5f, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f, 0x73, 0x65, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x28, 0x01, 0x52, 0x2c, 0x6d, 0x61, 0x78, 0x49, 0x6e, - 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x50, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x46, 0x72, - 0x61, 0x6d, 0x65, 0x53, 0x65, 0x6e, 0x74, 0x12, 0x5e, 0x0a, 0x26, 0x73, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x76, 0x61, 0x6c, - 0x69, 0x64, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x69, 0x6e, - 0x67, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x42, 0x0b, 0x18, 0x01, 0x92, 0xc7, 0x86, 0xd8, 0x04, - 0x03, 0x33, 0x2e, 0x30, 0x52, 0x21, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x45, 0x72, 0x72, 0x6f, - 0x72, 0x4f, 0x6e, 0x49, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x48, 0x74, 0x74, 0x70, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x12, 0x7a, 0x0a, 0x2d, 0x6f, 0x76, 0x65, 0x72, 0x72, - 0x69, 0x64, 0x65, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, - 0x5f, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x5f, 0x68, 0x74, 0x74, 0x70, - 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x27, 0x6f, 0x76, 0x65, 0x72, - 0x72, 0x69, 0x64, 0x65, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x4f, - 0x6e, 0x49, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x48, 0x74, 0x74, 0x70, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x12, 0x7a, 0x0a, 0x1a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x73, 0x65, - 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, - 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, - 0x74, 0x74, 0x70, 0x32, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x18, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x53, 0x65, 0x74, - 0x74, 0x69, 0x6e, 0x67, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, - 0x5a, 0x0a, 0x14, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, - 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x4b, 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x53, 0x65, - 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x13, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x4b, 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x12, 0x50, 0x0a, 0x11, 0x75, - 0x73, 0x65, 0x5f, 0x6f, 0x67, 0x68, 0x74, 0x74, 0x70, 0x32, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x63, - 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x42, 0x08, 0xd2, 0xc6, 0xa4, 0xe1, 0x06, 0x02, 0x08, 0x01, 0x52, 0x0f, 0x75, 0x73, - 0x65, 0x4f, 0x67, 0x68, 0x74, 0x74, 0x70, 0x32, 0x43, 0x6f, 0x64, 0x65, 0x63, 0x1a, 0xe5, 0x01, - 0x0a, 0x11, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, - 0x74, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x13, 0xfa, 0x42, 0x08, 0x2a, 0x06, 0x18, 0xff, 0xff, 0x03, - 0x28, 0x00, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x0a, 0x69, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x3c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x3f, 0x9a, 0xc5, 0x88, 0x1e, 0x3a, 0x0a, 0x38, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x48, - 0x74, 0x74, 0x70, 0x32, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x65, 0x74, 0x65, 0x72, 0x3a, 0x2d, 0x9a, 0xc5, 0x88, 0x1e, 0x28, 0x0a, 0x26, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, - 0x48, 0x74, 0x74, 0x70, 0x32, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xa5, 0x01, 0x0a, 0x13, 0x47, 0x72, 0x70, 0x63, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x60, 0x0a, 0x16, - 0x68, 0x74, 0x74, 0x70, 0x32, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x5f, 0x6f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, - 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x32, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, - 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x14, 0x68, 0x74, 0x74, 0x70, 0x32, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3a, 0x2c, - 0x9a, 0xc5, 0x88, 0x1e, 0x27, 0x0a, 0x25, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xb1, 0x02, 0x0a, - 0x14, 0x48, 0x74, 0x74, 0x70, 0x33, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x5d, 0x0a, 0x15, 0x71, 0x75, 0x69, 0x63, 0x5f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x51, 0x75, 0x69, 0x63, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, - 0x13, 0x71, 0x75, 0x69, 0x63, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x7a, 0x0a, 0x2d, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, - 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6f, 0x6e, - 0x5f, 0x69, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, - 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x27, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, - 0x65, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x4f, 0x6e, 0x49, 0x6e, - 0x76, 0x61, 0x6c, 0x69, 0x64, 0x48, 0x74, 0x74, 0x70, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x12, 0x3e, 0x0a, 0x16, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, - 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, - 0x42, 0x08, 0xd2, 0xc6, 0xa4, 0xe1, 0x06, 0x02, 0x08, 0x01, 0x52, 0x14, 0x61, 0x6c, 0x6c, 0x6f, - 0x77, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x22, 0x74, 0x0a, 0x1a, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x44, - 0x0a, 0x13, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x5f, 0x74, 0x6f, 0x5f, 0x6f, 0x76, 0x65, 0x72, - 0x77, 0x72, 0x69, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x12, 0xfa, 0x42, 0x0f, - 0x72, 0x0d, 0x52, 0x04, 0x68, 0x74, 0x74, 0x70, 0x52, 0x05, 0x68, 0x74, 0x74, 0x70, 0x73, 0x48, - 0x00, 0x52, 0x11, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x54, 0x6f, 0x4f, 0x76, 0x65, 0x72, 0x77, - 0x72, 0x69, 0x74, 0x65, 0x42, 0x10, 0x0a, 0x0e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, - 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x81, 0x01, 0x0a, 0x22, 0x69, 0x6f, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x42, 0x0d, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x42, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, - 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x3b, 0x63, 0x6f, 0x72, 0x65, - 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_envoy_config_core_v3_protocol_proto_rawDescOnce sync.Once - file_envoy_config_core_v3_protocol_proto_rawDescData = file_envoy_config_core_v3_protocol_proto_rawDesc -) - -func file_envoy_config_core_v3_protocol_proto_rawDescGZIP() []byte { - file_envoy_config_core_v3_protocol_proto_rawDescOnce.Do(func() { - file_envoy_config_core_v3_protocol_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_config_core_v3_protocol_proto_rawDescData) - }) - return file_envoy_config_core_v3_protocol_proto_rawDescData -} - -var file_envoy_config_core_v3_protocol_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_envoy_config_core_v3_protocol_proto_msgTypes = make([]protoimpl.MessageInfo, 16) -var file_envoy_config_core_v3_protocol_proto_goTypes = []interface{}{ - (HttpProtocolOptions_HeadersWithUnderscoresAction)(0), // 0: envoy.config.core.v3.HttpProtocolOptions.HeadersWithUnderscoresAction - (*TcpProtocolOptions)(nil), // 1: envoy.config.core.v3.TcpProtocolOptions - (*QuicKeepAliveSettings)(nil), // 2: envoy.config.core.v3.QuicKeepAliveSettings - (*QuicProtocolOptions)(nil), // 3: envoy.config.core.v3.QuicProtocolOptions - (*UpstreamHttpProtocolOptions)(nil), // 4: envoy.config.core.v3.UpstreamHttpProtocolOptions - (*AlternateProtocolsCacheOptions)(nil), // 5: envoy.config.core.v3.AlternateProtocolsCacheOptions - (*HttpProtocolOptions)(nil), // 6: envoy.config.core.v3.HttpProtocolOptions - (*Http1ProtocolOptions)(nil), // 7: envoy.config.core.v3.Http1ProtocolOptions - (*KeepaliveSettings)(nil), // 8: envoy.config.core.v3.KeepaliveSettings - (*Http2ProtocolOptions)(nil), // 9: envoy.config.core.v3.Http2ProtocolOptions - (*GrpcProtocolOptions)(nil), // 10: envoy.config.core.v3.GrpcProtocolOptions - (*Http3ProtocolOptions)(nil), // 11: envoy.config.core.v3.Http3ProtocolOptions - (*SchemeHeaderTransformation)(nil), // 12: envoy.config.core.v3.SchemeHeaderTransformation - (*AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry)(nil), // 13: envoy.config.core.v3.AlternateProtocolsCacheOptions.AlternateProtocolsCacheEntry - (*Http1ProtocolOptions_HeaderKeyFormat)(nil), // 14: envoy.config.core.v3.Http1ProtocolOptions.HeaderKeyFormat - (*Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords)(nil), // 15: envoy.config.core.v3.Http1ProtocolOptions.HeaderKeyFormat.ProperCaseWords - (*Http2ProtocolOptions_SettingsParameter)(nil), // 16: envoy.config.core.v3.Http2ProtocolOptions.SettingsParameter - (*durationpb.Duration)(nil), // 17: google.protobuf.Duration - (*wrapperspb.UInt32Value)(nil), // 18: google.protobuf.UInt32Value - (*TypedExtensionConfig)(nil), // 19: envoy.config.core.v3.TypedExtensionConfig - (*wrapperspb.BoolValue)(nil), // 20: google.protobuf.BoolValue - (*v3.Percent)(nil), // 21: envoy.type.v3.Percent -} -var file_envoy_config_core_v3_protocol_proto_depIdxs = []int32{ - 17, // 0: envoy.config.core.v3.QuicKeepAliveSettings.max_interval:type_name -> google.protobuf.Duration - 17, // 1: envoy.config.core.v3.QuicKeepAliveSettings.initial_interval:type_name -> google.protobuf.Duration - 18, // 2: envoy.config.core.v3.QuicProtocolOptions.max_concurrent_streams:type_name -> google.protobuf.UInt32Value - 18, // 3: envoy.config.core.v3.QuicProtocolOptions.initial_stream_window_size:type_name -> google.protobuf.UInt32Value - 18, // 4: envoy.config.core.v3.QuicProtocolOptions.initial_connection_window_size:type_name -> google.protobuf.UInt32Value - 18, // 5: envoy.config.core.v3.QuicProtocolOptions.num_timeouts_to_trigger_port_migration:type_name -> google.protobuf.UInt32Value - 2, // 6: envoy.config.core.v3.QuicProtocolOptions.connection_keepalive:type_name -> envoy.config.core.v3.QuicKeepAliveSettings - 18, // 7: envoy.config.core.v3.AlternateProtocolsCacheOptions.max_entries:type_name -> google.protobuf.UInt32Value - 19, // 8: envoy.config.core.v3.AlternateProtocolsCacheOptions.key_value_store_config:type_name -> envoy.config.core.v3.TypedExtensionConfig - 13, // 9: envoy.config.core.v3.AlternateProtocolsCacheOptions.prepopulated_entries:type_name -> envoy.config.core.v3.AlternateProtocolsCacheOptions.AlternateProtocolsCacheEntry - 17, // 10: envoy.config.core.v3.HttpProtocolOptions.idle_timeout:type_name -> google.protobuf.Duration - 17, // 11: envoy.config.core.v3.HttpProtocolOptions.max_connection_duration:type_name -> google.protobuf.Duration - 18, // 12: envoy.config.core.v3.HttpProtocolOptions.max_headers_count:type_name -> google.protobuf.UInt32Value - 17, // 13: envoy.config.core.v3.HttpProtocolOptions.max_stream_duration:type_name -> google.protobuf.Duration - 0, // 14: envoy.config.core.v3.HttpProtocolOptions.headers_with_underscores_action:type_name -> envoy.config.core.v3.HttpProtocolOptions.HeadersWithUnderscoresAction - 18, // 15: envoy.config.core.v3.HttpProtocolOptions.max_requests_per_connection:type_name -> google.protobuf.UInt32Value - 20, // 16: envoy.config.core.v3.Http1ProtocolOptions.allow_absolute_url:type_name -> google.protobuf.BoolValue - 14, // 17: envoy.config.core.v3.Http1ProtocolOptions.header_key_format:type_name -> envoy.config.core.v3.Http1ProtocolOptions.HeaderKeyFormat - 20, // 18: envoy.config.core.v3.Http1ProtocolOptions.override_stream_error_on_invalid_http_message:type_name -> google.protobuf.BoolValue - 20, // 19: envoy.config.core.v3.Http1ProtocolOptions.use_balsa_parser:type_name -> google.protobuf.BoolValue - 17, // 20: envoy.config.core.v3.KeepaliveSettings.interval:type_name -> google.protobuf.Duration - 17, // 21: envoy.config.core.v3.KeepaliveSettings.timeout:type_name -> google.protobuf.Duration - 21, // 22: envoy.config.core.v3.KeepaliveSettings.interval_jitter:type_name -> envoy.type.v3.Percent - 17, // 23: envoy.config.core.v3.KeepaliveSettings.connection_idle_interval:type_name -> google.protobuf.Duration - 18, // 24: envoy.config.core.v3.Http2ProtocolOptions.hpack_table_size:type_name -> google.protobuf.UInt32Value - 18, // 25: envoy.config.core.v3.Http2ProtocolOptions.max_concurrent_streams:type_name -> google.protobuf.UInt32Value - 18, // 26: envoy.config.core.v3.Http2ProtocolOptions.initial_stream_window_size:type_name -> google.protobuf.UInt32Value - 18, // 27: envoy.config.core.v3.Http2ProtocolOptions.initial_connection_window_size:type_name -> google.protobuf.UInt32Value - 18, // 28: envoy.config.core.v3.Http2ProtocolOptions.max_outbound_frames:type_name -> google.protobuf.UInt32Value - 18, // 29: envoy.config.core.v3.Http2ProtocolOptions.max_outbound_control_frames:type_name -> google.protobuf.UInt32Value - 18, // 30: envoy.config.core.v3.Http2ProtocolOptions.max_consecutive_inbound_frames_with_empty_payload:type_name -> google.protobuf.UInt32Value - 18, // 31: envoy.config.core.v3.Http2ProtocolOptions.max_inbound_priority_frames_per_stream:type_name -> google.protobuf.UInt32Value - 18, // 32: envoy.config.core.v3.Http2ProtocolOptions.max_inbound_window_update_frames_per_data_frame_sent:type_name -> google.protobuf.UInt32Value - 20, // 33: envoy.config.core.v3.Http2ProtocolOptions.override_stream_error_on_invalid_http_message:type_name -> google.protobuf.BoolValue - 16, // 34: envoy.config.core.v3.Http2ProtocolOptions.custom_settings_parameters:type_name -> envoy.config.core.v3.Http2ProtocolOptions.SettingsParameter - 8, // 35: envoy.config.core.v3.Http2ProtocolOptions.connection_keepalive:type_name -> envoy.config.core.v3.KeepaliveSettings - 20, // 36: envoy.config.core.v3.Http2ProtocolOptions.use_oghttp2_codec:type_name -> google.protobuf.BoolValue - 9, // 37: envoy.config.core.v3.GrpcProtocolOptions.http2_protocol_options:type_name -> envoy.config.core.v3.Http2ProtocolOptions - 3, // 38: envoy.config.core.v3.Http3ProtocolOptions.quic_protocol_options:type_name -> envoy.config.core.v3.QuicProtocolOptions - 20, // 39: envoy.config.core.v3.Http3ProtocolOptions.override_stream_error_on_invalid_http_message:type_name -> google.protobuf.BoolValue - 15, // 40: envoy.config.core.v3.Http1ProtocolOptions.HeaderKeyFormat.proper_case_words:type_name -> envoy.config.core.v3.Http1ProtocolOptions.HeaderKeyFormat.ProperCaseWords - 19, // 41: envoy.config.core.v3.Http1ProtocolOptions.HeaderKeyFormat.stateful_formatter:type_name -> envoy.config.core.v3.TypedExtensionConfig - 18, // 42: envoy.config.core.v3.Http2ProtocolOptions.SettingsParameter.identifier:type_name -> google.protobuf.UInt32Value - 18, // 43: envoy.config.core.v3.Http2ProtocolOptions.SettingsParameter.value:type_name -> google.protobuf.UInt32Value - 44, // [44:44] is the sub-list for method output_type - 44, // [44:44] is the sub-list for method input_type - 44, // [44:44] is the sub-list for extension type_name - 44, // [44:44] is the sub-list for extension extendee - 0, // [0:44] is the sub-list for field type_name -} - -func init() { file_envoy_config_core_v3_protocol_proto_init() } -func file_envoy_config_core_v3_protocol_proto_init() { - if File_envoy_config_core_v3_protocol_proto != nil { - return - } - file_envoy_config_core_v3_extension_proto_init() - if !protoimpl.UnsafeEnabled { - file_envoy_config_core_v3_protocol_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TcpProtocolOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_protocol_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QuicKeepAliveSettings); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_protocol_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QuicProtocolOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_protocol_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpstreamHttpProtocolOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_protocol_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AlternateProtocolsCacheOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_protocol_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HttpProtocolOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_protocol_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Http1ProtocolOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_protocol_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*KeepaliveSettings); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_protocol_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Http2ProtocolOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_protocol_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GrpcProtocolOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_protocol_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Http3ProtocolOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_protocol_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SchemeHeaderTransformation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_protocol_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_protocol_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Http1ProtocolOptions_HeaderKeyFormat); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_protocol_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_protocol_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Http2ProtocolOptions_SettingsParameter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_config_core_v3_protocol_proto_msgTypes[11].OneofWrappers = []interface{}{ - (*SchemeHeaderTransformation_SchemeToOverwrite)(nil), - } - file_envoy_config_core_v3_protocol_proto_msgTypes[13].OneofWrappers = []interface{}{ - (*Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords_)(nil), - (*Http1ProtocolOptions_HeaderKeyFormat_StatefulFormatter)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_config_core_v3_protocol_proto_rawDesc, - NumEnums: 1, - NumMessages: 16, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_config_core_v3_protocol_proto_goTypes, - DependencyIndexes: file_envoy_config_core_v3_protocol_proto_depIdxs, - EnumInfos: file_envoy_config_core_v3_protocol_proto_enumTypes, - MessageInfos: file_envoy_config_core_v3_protocol_proto_msgTypes, - }.Build() - File_envoy_config_core_v3_protocol_proto = out.File - file_envoy_config_core_v3_protocol_proto_rawDesc = nil - file_envoy_config_core_v3_protocol_proto_goTypes = nil - file_envoy_config_core_v3_protocol_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/protocol.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/protocol.pb.validate.go deleted file mode 100644 index feb1489c2..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/protocol.pb.validate.go +++ /dev/null @@ -1,2979 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/config/core/v3/protocol.proto - -package corev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on TcpProtocolOptions with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *TcpProtocolOptions) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on TcpProtocolOptions with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// TcpProtocolOptionsMultiError, or nil if none found. -func (m *TcpProtocolOptions) ValidateAll() error { - return m.validate(true) -} - -func (m *TcpProtocolOptions) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return TcpProtocolOptionsMultiError(errors) - } - - return nil -} - -// TcpProtocolOptionsMultiError is an error wrapping multiple validation errors -// returned by TcpProtocolOptions.ValidateAll() if the designated constraints -// aren't met. -type TcpProtocolOptionsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m TcpProtocolOptionsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m TcpProtocolOptionsMultiError) AllErrors() []error { return m } - -// TcpProtocolOptionsValidationError is the validation error returned by -// TcpProtocolOptions.Validate if the designated constraints aren't met. -type TcpProtocolOptionsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TcpProtocolOptionsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TcpProtocolOptionsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TcpProtocolOptionsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TcpProtocolOptionsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TcpProtocolOptionsValidationError) ErrorName() string { - return "TcpProtocolOptionsValidationError" -} - -// Error satisfies the builtin error interface -func (e TcpProtocolOptionsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTcpProtocolOptions.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TcpProtocolOptionsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TcpProtocolOptionsValidationError{} - -// Validate checks the field values on QuicKeepAliveSettings with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *QuicKeepAliveSettings) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on QuicKeepAliveSettings with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// QuicKeepAliveSettingsMultiError, or nil if none found. -func (m *QuicKeepAliveSettings) ValidateAll() error { - return m.validate(true) -} - -func (m *QuicKeepAliveSettings) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if d := m.GetMaxInterval(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = QuicKeepAliveSettingsValidationError{ - field: "MaxInterval", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - lte := time.Duration(0*time.Second + 0*time.Nanosecond) - gte := time.Duration(1*time.Second + 0*time.Nanosecond) - - if dur > lte && dur < gte { - err := QuicKeepAliveSettingsValidationError{ - field: "MaxInterval", - reason: "value must be outside range (0s, 1s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if d := m.GetInitialInterval(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = QuicKeepAliveSettingsValidationError{ - field: "InitialInterval", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - lte := time.Duration(0*time.Second + 0*time.Nanosecond) - gte := time.Duration(1*time.Second + 0*time.Nanosecond) - - if dur > lte && dur < gte { - err := QuicKeepAliveSettingsValidationError{ - field: "InitialInterval", - reason: "value must be outside range (0s, 1s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if len(errors) > 0 { - return QuicKeepAliveSettingsMultiError(errors) - } - - return nil -} - -// QuicKeepAliveSettingsMultiError is an error wrapping multiple validation -// errors returned by QuicKeepAliveSettings.ValidateAll() if the designated -// constraints aren't met. -type QuicKeepAliveSettingsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m QuicKeepAliveSettingsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m QuicKeepAliveSettingsMultiError) AllErrors() []error { return m } - -// QuicKeepAliveSettingsValidationError is the validation error returned by -// QuicKeepAliveSettings.Validate if the designated constraints aren't met. -type QuicKeepAliveSettingsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e QuicKeepAliveSettingsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e QuicKeepAliveSettingsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e QuicKeepAliveSettingsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e QuicKeepAliveSettingsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e QuicKeepAliveSettingsValidationError) ErrorName() string { - return "QuicKeepAliveSettingsValidationError" -} - -// Error satisfies the builtin error interface -func (e QuicKeepAliveSettingsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sQuicKeepAliveSettings.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = QuicKeepAliveSettingsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = QuicKeepAliveSettingsValidationError{} - -// Validate checks the field values on QuicProtocolOptions with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *QuicProtocolOptions) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on QuicProtocolOptions with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// QuicProtocolOptionsMultiError, or nil if none found. -func (m *QuicProtocolOptions) ValidateAll() error { - return m.validate(true) -} - -func (m *QuicProtocolOptions) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if wrapper := m.GetMaxConcurrentStreams(); wrapper != nil { - - if wrapper.GetValue() < 1 { - err := QuicProtocolOptionsValidationError{ - field: "MaxConcurrentStreams", - reason: "value must be greater than or equal to 1", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if wrapper := m.GetInitialStreamWindowSize(); wrapper != nil { - - if val := wrapper.GetValue(); val < 1 || val > 16777216 { - err := QuicProtocolOptionsValidationError{ - field: "InitialStreamWindowSize", - reason: "value must be inside range [1, 16777216]", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if wrapper := m.GetInitialConnectionWindowSize(); wrapper != nil { - - if val := wrapper.GetValue(); val < 1 || val > 25165824 { - err := QuicProtocolOptionsValidationError{ - field: "InitialConnectionWindowSize", - reason: "value must be inside range [1, 25165824]", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if wrapper := m.GetNumTimeoutsToTriggerPortMigration(); wrapper != nil { - - if val := wrapper.GetValue(); val < 0 || val > 5 { - err := QuicProtocolOptionsValidationError{ - field: "NumTimeoutsToTriggerPortMigration", - reason: "value must be inside range [0, 5]", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if all { - switch v := interface{}(m.GetConnectionKeepalive()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, QuicProtocolOptionsValidationError{ - field: "ConnectionKeepalive", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, QuicProtocolOptionsValidationError{ - field: "ConnectionKeepalive", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetConnectionKeepalive()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return QuicProtocolOptionsValidationError{ - field: "ConnectionKeepalive", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for ConnectionOptions - - // no validation rules for ClientConnectionOptions - - if len(errors) > 0 { - return QuicProtocolOptionsMultiError(errors) - } - - return nil -} - -// QuicProtocolOptionsMultiError is an error wrapping multiple validation -// errors returned by QuicProtocolOptions.ValidateAll() if the designated -// constraints aren't met. -type QuicProtocolOptionsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m QuicProtocolOptionsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m QuicProtocolOptionsMultiError) AllErrors() []error { return m } - -// QuicProtocolOptionsValidationError is the validation error returned by -// QuicProtocolOptions.Validate if the designated constraints aren't met. -type QuicProtocolOptionsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e QuicProtocolOptionsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e QuicProtocolOptionsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e QuicProtocolOptionsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e QuicProtocolOptionsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e QuicProtocolOptionsValidationError) ErrorName() string { - return "QuicProtocolOptionsValidationError" -} - -// Error satisfies the builtin error interface -func (e QuicProtocolOptionsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sQuicProtocolOptions.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = QuicProtocolOptionsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = QuicProtocolOptionsValidationError{} - -// Validate checks the field values on UpstreamHttpProtocolOptions with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *UpstreamHttpProtocolOptions) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UpstreamHttpProtocolOptions with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// UpstreamHttpProtocolOptionsMultiError, or nil if none found. -func (m *UpstreamHttpProtocolOptions) ValidateAll() error { - return m.validate(true) -} - -func (m *UpstreamHttpProtocolOptions) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for AutoSni - - // no validation rules for AutoSanValidation - - if m.GetOverrideAutoSniHeader() != "" { - - if !_UpstreamHttpProtocolOptions_OverrideAutoSniHeader_Pattern.MatchString(m.GetOverrideAutoSniHeader()) { - err := UpstreamHttpProtocolOptionsValidationError{ - field: "OverrideAutoSniHeader", - reason: "value does not match regex pattern \"^:?[0-9a-zA-Z!#$%&'*+-.^_|~`]+$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if len(errors) > 0 { - return UpstreamHttpProtocolOptionsMultiError(errors) - } - - return nil -} - -// UpstreamHttpProtocolOptionsMultiError is an error wrapping multiple -// validation errors returned by UpstreamHttpProtocolOptions.ValidateAll() if -// the designated constraints aren't met. -type UpstreamHttpProtocolOptionsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UpstreamHttpProtocolOptionsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m UpstreamHttpProtocolOptionsMultiError) AllErrors() []error { return m } - -// UpstreamHttpProtocolOptionsValidationError is the validation error returned -// by UpstreamHttpProtocolOptions.Validate if the designated constraints -// aren't met. -type UpstreamHttpProtocolOptionsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UpstreamHttpProtocolOptionsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UpstreamHttpProtocolOptionsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UpstreamHttpProtocolOptionsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UpstreamHttpProtocolOptionsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UpstreamHttpProtocolOptionsValidationError) ErrorName() string { - return "UpstreamHttpProtocolOptionsValidationError" -} - -// Error satisfies the builtin error interface -func (e UpstreamHttpProtocolOptionsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sUpstreamHttpProtocolOptions.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UpstreamHttpProtocolOptionsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UpstreamHttpProtocolOptionsValidationError{} - -var _UpstreamHttpProtocolOptions_OverrideAutoSniHeader_Pattern = regexp.MustCompile("^:?[0-9a-zA-Z!#$%&'*+-.^_|~`]+$") - -// Validate checks the field values on AlternateProtocolsCacheOptions with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *AlternateProtocolsCacheOptions) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on AlternateProtocolsCacheOptions with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// AlternateProtocolsCacheOptionsMultiError, or nil if none found. -func (m *AlternateProtocolsCacheOptions) ValidateAll() error { - return m.validate(true) -} - -func (m *AlternateProtocolsCacheOptions) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := AlternateProtocolsCacheOptionsValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if wrapper := m.GetMaxEntries(); wrapper != nil { - - if wrapper.GetValue() <= 0 { - err := AlternateProtocolsCacheOptionsValidationError{ - field: "MaxEntries", - reason: "value must be greater than 0", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if all { - switch v := interface{}(m.GetKeyValueStoreConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, AlternateProtocolsCacheOptionsValidationError{ - field: "KeyValueStoreConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, AlternateProtocolsCacheOptionsValidationError{ - field: "KeyValueStoreConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetKeyValueStoreConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return AlternateProtocolsCacheOptionsValidationError{ - field: "KeyValueStoreConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetPrepopulatedEntries() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, AlternateProtocolsCacheOptionsValidationError{ - field: fmt.Sprintf("PrepopulatedEntries[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, AlternateProtocolsCacheOptionsValidationError{ - field: fmt.Sprintf("PrepopulatedEntries[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return AlternateProtocolsCacheOptionsValidationError{ - field: fmt.Sprintf("PrepopulatedEntries[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return AlternateProtocolsCacheOptionsMultiError(errors) - } - - return nil -} - -// AlternateProtocolsCacheOptionsMultiError is an error wrapping multiple -// validation errors returned by AlternateProtocolsCacheOptions.ValidateAll() -// if the designated constraints aren't met. -type AlternateProtocolsCacheOptionsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AlternateProtocolsCacheOptionsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AlternateProtocolsCacheOptionsMultiError) AllErrors() []error { return m } - -// AlternateProtocolsCacheOptionsValidationError is the validation error -// returned by AlternateProtocolsCacheOptions.Validate if the designated -// constraints aren't met. -type AlternateProtocolsCacheOptionsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AlternateProtocolsCacheOptionsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AlternateProtocolsCacheOptionsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AlternateProtocolsCacheOptionsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AlternateProtocolsCacheOptionsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AlternateProtocolsCacheOptionsValidationError) ErrorName() string { - return "AlternateProtocolsCacheOptionsValidationError" -} - -// Error satisfies the builtin error interface -func (e AlternateProtocolsCacheOptionsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAlternateProtocolsCacheOptions.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AlternateProtocolsCacheOptionsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AlternateProtocolsCacheOptionsValidationError{} - -// Validate checks the field values on HttpProtocolOptions with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *HttpProtocolOptions) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HttpProtocolOptions with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// HttpProtocolOptionsMultiError, or nil if none found. -func (m *HttpProtocolOptions) ValidateAll() error { - return m.validate(true) -} - -func (m *HttpProtocolOptions) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetIdleTimeout()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: "IdleTimeout", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: "IdleTimeout", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetIdleTimeout()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptionsValidationError{ - field: "IdleTimeout", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetMaxConnectionDuration()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: "MaxConnectionDuration", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: "MaxConnectionDuration", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMaxConnectionDuration()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptionsValidationError{ - field: "MaxConnectionDuration", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if wrapper := m.GetMaxHeadersCount(); wrapper != nil { - - if wrapper.GetValue() < 1 { - err := HttpProtocolOptionsValidationError{ - field: "MaxHeadersCount", - reason: "value must be greater than or equal to 1", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if all { - switch v := interface{}(m.GetMaxStreamDuration()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: "MaxStreamDuration", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: "MaxStreamDuration", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMaxStreamDuration()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptionsValidationError{ - field: "MaxStreamDuration", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for HeadersWithUnderscoresAction - - if all { - switch v := interface{}(m.GetMaxRequestsPerConnection()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: "MaxRequestsPerConnection", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: "MaxRequestsPerConnection", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMaxRequestsPerConnection()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptionsValidationError{ - field: "MaxRequestsPerConnection", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return HttpProtocolOptionsMultiError(errors) - } - - return nil -} - -// HttpProtocolOptionsMultiError is an error wrapping multiple validation -// errors returned by HttpProtocolOptions.ValidateAll() if the designated -// constraints aren't met. -type HttpProtocolOptionsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HttpProtocolOptionsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HttpProtocolOptionsMultiError) AllErrors() []error { return m } - -// HttpProtocolOptionsValidationError is the validation error returned by -// HttpProtocolOptions.Validate if the designated constraints aren't met. -type HttpProtocolOptionsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HttpProtocolOptionsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HttpProtocolOptionsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HttpProtocolOptionsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HttpProtocolOptionsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HttpProtocolOptionsValidationError) ErrorName() string { - return "HttpProtocolOptionsValidationError" -} - -// Error satisfies the builtin error interface -func (e HttpProtocolOptionsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttpProtocolOptions.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HttpProtocolOptionsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HttpProtocolOptionsValidationError{} - -// Validate checks the field values on Http1ProtocolOptions with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *Http1ProtocolOptions) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Http1ProtocolOptions with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// Http1ProtocolOptionsMultiError, or nil if none found. -func (m *Http1ProtocolOptions) ValidateAll() error { - return m.validate(true) -} - -func (m *Http1ProtocolOptions) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetAllowAbsoluteUrl()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Http1ProtocolOptionsValidationError{ - field: "AllowAbsoluteUrl", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Http1ProtocolOptionsValidationError{ - field: "AllowAbsoluteUrl", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetAllowAbsoluteUrl()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Http1ProtocolOptionsValidationError{ - field: "AllowAbsoluteUrl", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for AcceptHttp_10 - - // no validation rules for DefaultHostForHttp_10 - - if all { - switch v := interface{}(m.GetHeaderKeyFormat()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Http1ProtocolOptionsValidationError{ - field: "HeaderKeyFormat", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Http1ProtocolOptionsValidationError{ - field: "HeaderKeyFormat", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHeaderKeyFormat()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Http1ProtocolOptionsValidationError{ - field: "HeaderKeyFormat", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for EnableTrailers - - // no validation rules for AllowChunkedLength - - if all { - switch v := interface{}(m.GetOverrideStreamErrorOnInvalidHttpMessage()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Http1ProtocolOptionsValidationError{ - field: "OverrideStreamErrorOnInvalidHttpMessage", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Http1ProtocolOptionsValidationError{ - field: "OverrideStreamErrorOnInvalidHttpMessage", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetOverrideStreamErrorOnInvalidHttpMessage()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Http1ProtocolOptionsValidationError{ - field: "OverrideStreamErrorOnInvalidHttpMessage", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for SendFullyQualifiedUrl - - if all { - switch v := interface{}(m.GetUseBalsaParser()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Http1ProtocolOptionsValidationError{ - field: "UseBalsaParser", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Http1ProtocolOptionsValidationError{ - field: "UseBalsaParser", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetUseBalsaParser()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Http1ProtocolOptionsValidationError{ - field: "UseBalsaParser", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for AllowCustomMethods - - if len(errors) > 0 { - return Http1ProtocolOptionsMultiError(errors) - } - - return nil -} - -// Http1ProtocolOptionsMultiError is an error wrapping multiple validation -// errors returned by Http1ProtocolOptions.ValidateAll() if the designated -// constraints aren't met. -type Http1ProtocolOptionsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m Http1ProtocolOptionsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m Http1ProtocolOptionsMultiError) AllErrors() []error { return m } - -// Http1ProtocolOptionsValidationError is the validation error returned by -// Http1ProtocolOptions.Validate if the designated constraints aren't met. -type Http1ProtocolOptionsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e Http1ProtocolOptionsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e Http1ProtocolOptionsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e Http1ProtocolOptionsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e Http1ProtocolOptionsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e Http1ProtocolOptionsValidationError) ErrorName() string { - return "Http1ProtocolOptionsValidationError" -} - -// Error satisfies the builtin error interface -func (e Http1ProtocolOptionsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttp1ProtocolOptions.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = Http1ProtocolOptionsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = Http1ProtocolOptionsValidationError{} - -// Validate checks the field values on KeepaliveSettings with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *KeepaliveSettings) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on KeepaliveSettings with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// KeepaliveSettingsMultiError, or nil if none found. -func (m *KeepaliveSettings) ValidateAll() error { - return m.validate(true) -} - -func (m *KeepaliveSettings) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if d := m.GetInterval(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = KeepaliveSettingsValidationError{ - field: "Interval", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - gte := time.Duration(0*time.Second + 1000000*time.Nanosecond) - - if dur < gte { - err := KeepaliveSettingsValidationError{ - field: "Interval", - reason: "value must be greater than or equal to 1ms", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if m.GetTimeout() == nil { - err := KeepaliveSettingsValidationError{ - field: "Timeout", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if d := m.GetTimeout(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = KeepaliveSettingsValidationError{ - field: "Timeout", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - gte := time.Duration(0*time.Second + 1000000*time.Nanosecond) - - if dur < gte { - err := KeepaliveSettingsValidationError{ - field: "Timeout", - reason: "value must be greater than or equal to 1ms", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if all { - switch v := interface{}(m.GetIntervalJitter()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, KeepaliveSettingsValidationError{ - field: "IntervalJitter", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, KeepaliveSettingsValidationError{ - field: "IntervalJitter", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetIntervalJitter()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return KeepaliveSettingsValidationError{ - field: "IntervalJitter", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if d := m.GetConnectionIdleInterval(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = KeepaliveSettingsValidationError{ - field: "ConnectionIdleInterval", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - gte := time.Duration(0*time.Second + 1000000*time.Nanosecond) - - if dur < gte { - err := KeepaliveSettingsValidationError{ - field: "ConnectionIdleInterval", - reason: "value must be greater than or equal to 1ms", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if len(errors) > 0 { - return KeepaliveSettingsMultiError(errors) - } - - return nil -} - -// KeepaliveSettingsMultiError is an error wrapping multiple validation errors -// returned by KeepaliveSettings.ValidateAll() if the designated constraints -// aren't met. -type KeepaliveSettingsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m KeepaliveSettingsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m KeepaliveSettingsMultiError) AllErrors() []error { return m } - -// KeepaliveSettingsValidationError is the validation error returned by -// KeepaliveSettings.Validate if the designated constraints aren't met. -type KeepaliveSettingsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e KeepaliveSettingsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e KeepaliveSettingsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e KeepaliveSettingsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e KeepaliveSettingsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e KeepaliveSettingsValidationError) ErrorName() string { - return "KeepaliveSettingsValidationError" -} - -// Error satisfies the builtin error interface -func (e KeepaliveSettingsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sKeepaliveSettings.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = KeepaliveSettingsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = KeepaliveSettingsValidationError{} - -// Validate checks the field values on Http2ProtocolOptions with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *Http2ProtocolOptions) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Http2ProtocolOptions with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// Http2ProtocolOptionsMultiError, or nil if none found. -func (m *Http2ProtocolOptions) ValidateAll() error { - return m.validate(true) -} - -func (m *Http2ProtocolOptions) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetHpackTableSize()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Http2ProtocolOptionsValidationError{ - field: "HpackTableSize", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Http2ProtocolOptionsValidationError{ - field: "HpackTableSize", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHpackTableSize()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Http2ProtocolOptionsValidationError{ - field: "HpackTableSize", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if wrapper := m.GetMaxConcurrentStreams(); wrapper != nil { - - if val := wrapper.GetValue(); val < 1 || val > 2147483647 { - err := Http2ProtocolOptionsValidationError{ - field: "MaxConcurrentStreams", - reason: "value must be inside range [1, 2147483647]", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if wrapper := m.GetInitialStreamWindowSize(); wrapper != nil { - - if val := wrapper.GetValue(); val < 65535 || val > 2147483647 { - err := Http2ProtocolOptionsValidationError{ - field: "InitialStreamWindowSize", - reason: "value must be inside range [65535, 2147483647]", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if wrapper := m.GetInitialConnectionWindowSize(); wrapper != nil { - - if val := wrapper.GetValue(); val < 65535 || val > 2147483647 { - err := Http2ProtocolOptionsValidationError{ - field: "InitialConnectionWindowSize", - reason: "value must be inside range [65535, 2147483647]", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - // no validation rules for AllowConnect - - // no validation rules for AllowMetadata - - if wrapper := m.GetMaxOutboundFrames(); wrapper != nil { - - if wrapper.GetValue() < 1 { - err := Http2ProtocolOptionsValidationError{ - field: "MaxOutboundFrames", - reason: "value must be greater than or equal to 1", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if wrapper := m.GetMaxOutboundControlFrames(); wrapper != nil { - - if wrapper.GetValue() < 1 { - err := Http2ProtocolOptionsValidationError{ - field: "MaxOutboundControlFrames", - reason: "value must be greater than or equal to 1", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if all { - switch v := interface{}(m.GetMaxConsecutiveInboundFramesWithEmptyPayload()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Http2ProtocolOptionsValidationError{ - field: "MaxConsecutiveInboundFramesWithEmptyPayload", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Http2ProtocolOptionsValidationError{ - field: "MaxConsecutiveInboundFramesWithEmptyPayload", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMaxConsecutiveInboundFramesWithEmptyPayload()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Http2ProtocolOptionsValidationError{ - field: "MaxConsecutiveInboundFramesWithEmptyPayload", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetMaxInboundPriorityFramesPerStream()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Http2ProtocolOptionsValidationError{ - field: "MaxInboundPriorityFramesPerStream", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Http2ProtocolOptionsValidationError{ - field: "MaxInboundPriorityFramesPerStream", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMaxInboundPriorityFramesPerStream()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Http2ProtocolOptionsValidationError{ - field: "MaxInboundPriorityFramesPerStream", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if wrapper := m.GetMaxInboundWindowUpdateFramesPerDataFrameSent(); wrapper != nil { - - if wrapper.GetValue() < 1 { - err := Http2ProtocolOptionsValidationError{ - field: "MaxInboundWindowUpdateFramesPerDataFrameSent", - reason: "value must be greater than or equal to 1", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - // no validation rules for StreamErrorOnInvalidHttpMessaging - - if all { - switch v := interface{}(m.GetOverrideStreamErrorOnInvalidHttpMessage()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Http2ProtocolOptionsValidationError{ - field: "OverrideStreamErrorOnInvalidHttpMessage", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Http2ProtocolOptionsValidationError{ - field: "OverrideStreamErrorOnInvalidHttpMessage", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetOverrideStreamErrorOnInvalidHttpMessage()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Http2ProtocolOptionsValidationError{ - field: "OverrideStreamErrorOnInvalidHttpMessage", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetCustomSettingsParameters() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Http2ProtocolOptionsValidationError{ - field: fmt.Sprintf("CustomSettingsParameters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Http2ProtocolOptionsValidationError{ - field: fmt.Sprintf("CustomSettingsParameters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Http2ProtocolOptionsValidationError{ - field: fmt.Sprintf("CustomSettingsParameters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetConnectionKeepalive()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Http2ProtocolOptionsValidationError{ - field: "ConnectionKeepalive", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Http2ProtocolOptionsValidationError{ - field: "ConnectionKeepalive", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetConnectionKeepalive()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Http2ProtocolOptionsValidationError{ - field: "ConnectionKeepalive", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetUseOghttp2Codec()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Http2ProtocolOptionsValidationError{ - field: "UseOghttp2Codec", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Http2ProtocolOptionsValidationError{ - field: "UseOghttp2Codec", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetUseOghttp2Codec()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Http2ProtocolOptionsValidationError{ - field: "UseOghttp2Codec", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return Http2ProtocolOptionsMultiError(errors) - } - - return nil -} - -// Http2ProtocolOptionsMultiError is an error wrapping multiple validation -// errors returned by Http2ProtocolOptions.ValidateAll() if the designated -// constraints aren't met. -type Http2ProtocolOptionsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m Http2ProtocolOptionsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m Http2ProtocolOptionsMultiError) AllErrors() []error { return m } - -// Http2ProtocolOptionsValidationError is the validation error returned by -// Http2ProtocolOptions.Validate if the designated constraints aren't met. -type Http2ProtocolOptionsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e Http2ProtocolOptionsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e Http2ProtocolOptionsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e Http2ProtocolOptionsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e Http2ProtocolOptionsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e Http2ProtocolOptionsValidationError) ErrorName() string { - return "Http2ProtocolOptionsValidationError" -} - -// Error satisfies the builtin error interface -func (e Http2ProtocolOptionsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttp2ProtocolOptions.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = Http2ProtocolOptionsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = Http2ProtocolOptionsValidationError{} - -// Validate checks the field values on GrpcProtocolOptions with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *GrpcProtocolOptions) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GrpcProtocolOptions with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GrpcProtocolOptionsMultiError, or nil if none found. -func (m *GrpcProtocolOptions) ValidateAll() error { - return m.validate(true) -} - -func (m *GrpcProtocolOptions) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetHttp2ProtocolOptions()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GrpcProtocolOptionsValidationError{ - field: "Http2ProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GrpcProtocolOptionsValidationError{ - field: "Http2ProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHttp2ProtocolOptions()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GrpcProtocolOptionsValidationError{ - field: "Http2ProtocolOptions", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return GrpcProtocolOptionsMultiError(errors) - } - - return nil -} - -// GrpcProtocolOptionsMultiError is an error wrapping multiple validation -// errors returned by GrpcProtocolOptions.ValidateAll() if the designated -// constraints aren't met. -type GrpcProtocolOptionsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GrpcProtocolOptionsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GrpcProtocolOptionsMultiError) AllErrors() []error { return m } - -// GrpcProtocolOptionsValidationError is the validation error returned by -// GrpcProtocolOptions.Validate if the designated constraints aren't met. -type GrpcProtocolOptionsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GrpcProtocolOptionsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GrpcProtocolOptionsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GrpcProtocolOptionsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GrpcProtocolOptionsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GrpcProtocolOptionsValidationError) ErrorName() string { - return "GrpcProtocolOptionsValidationError" -} - -// Error satisfies the builtin error interface -func (e GrpcProtocolOptionsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGrpcProtocolOptions.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GrpcProtocolOptionsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GrpcProtocolOptionsValidationError{} - -// Validate checks the field values on Http3ProtocolOptions with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *Http3ProtocolOptions) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Http3ProtocolOptions with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// Http3ProtocolOptionsMultiError, or nil if none found. -func (m *Http3ProtocolOptions) ValidateAll() error { - return m.validate(true) -} - -func (m *Http3ProtocolOptions) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetQuicProtocolOptions()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Http3ProtocolOptionsValidationError{ - field: "QuicProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Http3ProtocolOptionsValidationError{ - field: "QuicProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetQuicProtocolOptions()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Http3ProtocolOptionsValidationError{ - field: "QuicProtocolOptions", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetOverrideStreamErrorOnInvalidHttpMessage()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Http3ProtocolOptionsValidationError{ - field: "OverrideStreamErrorOnInvalidHttpMessage", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Http3ProtocolOptionsValidationError{ - field: "OverrideStreamErrorOnInvalidHttpMessage", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetOverrideStreamErrorOnInvalidHttpMessage()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Http3ProtocolOptionsValidationError{ - field: "OverrideStreamErrorOnInvalidHttpMessage", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for AllowExtendedConnect - - if len(errors) > 0 { - return Http3ProtocolOptionsMultiError(errors) - } - - return nil -} - -// Http3ProtocolOptionsMultiError is an error wrapping multiple validation -// errors returned by Http3ProtocolOptions.ValidateAll() if the designated -// constraints aren't met. -type Http3ProtocolOptionsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m Http3ProtocolOptionsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m Http3ProtocolOptionsMultiError) AllErrors() []error { return m } - -// Http3ProtocolOptionsValidationError is the validation error returned by -// Http3ProtocolOptions.Validate if the designated constraints aren't met. -type Http3ProtocolOptionsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e Http3ProtocolOptionsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e Http3ProtocolOptionsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e Http3ProtocolOptionsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e Http3ProtocolOptionsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e Http3ProtocolOptionsValidationError) ErrorName() string { - return "Http3ProtocolOptionsValidationError" -} - -// Error satisfies the builtin error interface -func (e Http3ProtocolOptionsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttp3ProtocolOptions.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = Http3ProtocolOptionsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = Http3ProtocolOptionsValidationError{} - -// Validate checks the field values on SchemeHeaderTransformation with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *SchemeHeaderTransformation) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SchemeHeaderTransformation with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// SchemeHeaderTransformationMultiError, or nil if none found. -func (m *SchemeHeaderTransformation) ValidateAll() error { - return m.validate(true) -} - -func (m *SchemeHeaderTransformation) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - switch v := m.Transformation.(type) { - case *SchemeHeaderTransformation_SchemeToOverwrite: - if v == nil { - err := SchemeHeaderTransformationValidationError{ - field: "Transformation", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if _, ok := _SchemeHeaderTransformation_SchemeToOverwrite_InLookup[m.GetSchemeToOverwrite()]; !ok { - err := SchemeHeaderTransformationValidationError{ - field: "SchemeToOverwrite", - reason: "value must be in list [http https]", - } - if !all { - return err - } - errors = append(errors, err) - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return SchemeHeaderTransformationMultiError(errors) - } - - return nil -} - -// SchemeHeaderTransformationMultiError is an error wrapping multiple -// validation errors returned by SchemeHeaderTransformation.ValidateAll() if -// the designated constraints aren't met. -type SchemeHeaderTransformationMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SchemeHeaderTransformationMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m SchemeHeaderTransformationMultiError) AllErrors() []error { return m } - -// SchemeHeaderTransformationValidationError is the validation error returned -// by SchemeHeaderTransformation.Validate if the designated constraints aren't met. -type SchemeHeaderTransformationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SchemeHeaderTransformationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SchemeHeaderTransformationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SchemeHeaderTransformationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SchemeHeaderTransformationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SchemeHeaderTransformationValidationError) ErrorName() string { - return "SchemeHeaderTransformationValidationError" -} - -// Error satisfies the builtin error interface -func (e SchemeHeaderTransformationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSchemeHeaderTransformation.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SchemeHeaderTransformationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SchemeHeaderTransformationValidationError{} - -var _SchemeHeaderTransformation_SchemeToOverwrite_InLookup = map[string]struct{}{ - "http": {}, - "https": {}, -} - -// Validate checks the field values on -// AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on -// AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryMultiError, or -// nil if none found. -func (m *AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry) ValidateAll() error { - return m.validate(true) -} - -func (m *AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetHostname() != "" { - - if !_AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry_Hostname_Pattern.MatchString(m.GetHostname()) { - err := AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError{ - field: "Hostname", - reason: "value does not match regex pattern \"^:?[0-9a-zA-Z!#$%&'*+-.^_|~`]+$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if val := m.GetPort(); val <= 0 || val >= 65535 { - err := AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError{ - field: "Port", - reason: "value must be inside range (0, 65535)", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryMultiError(errors) - } - - return nil -} - -// AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryMultiError is an -// error wrapping multiple validation errors returned by -// AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry.ValidateAll() -// if the designated constraints aren't met. -type AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryMultiError) AllErrors() []error { - return m -} - -// AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError -// is the validation error returned by -// AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry.Validate if the -// designated constraints aren't met. -type AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError) Field() string { - return e.field -} - -// Reason function returns reason value. -func (e AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError) Reason() string { - return e.reason -} - -// Cause function returns cause value. -func (e AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError) Cause() error { - return e.cause -} - -// Key function returns key value. -func (e AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError) Key() bool { - return e.key -} - -// ErrorName returns error name. -func (e AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError) ErrorName() string { - return "AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError" -} - -// Error satisfies the builtin error interface -func (e AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntryValidationError{} - -var _AlternateProtocolsCacheOptions_AlternateProtocolsCacheEntry_Hostname_Pattern = regexp.MustCompile("^:?[0-9a-zA-Z!#$%&'*+-.^_|~`]+$") - -// Validate checks the field values on Http1ProtocolOptions_HeaderKeyFormat -// with the rules defined in the proto definition for this message. If any -// rules are violated, the first error encountered is returned, or nil if -// there are no violations. -func (m *Http1ProtocolOptions_HeaderKeyFormat) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Http1ProtocolOptions_HeaderKeyFormat -// with the rules defined in the proto definition for this message. If any -// rules are violated, the result is a list of violation errors wrapped in -// Http1ProtocolOptions_HeaderKeyFormatMultiError, or nil if none found. -func (m *Http1ProtocolOptions_HeaderKeyFormat) ValidateAll() error { - return m.validate(true) -} - -func (m *Http1ProtocolOptions_HeaderKeyFormat) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofHeaderFormatPresent := false - switch v := m.HeaderFormat.(type) { - case *Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords_: - if v == nil { - err := Http1ProtocolOptions_HeaderKeyFormatValidationError{ - field: "HeaderFormat", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofHeaderFormatPresent = true - - if all { - switch v := interface{}(m.GetProperCaseWords()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Http1ProtocolOptions_HeaderKeyFormatValidationError{ - field: "ProperCaseWords", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Http1ProtocolOptions_HeaderKeyFormatValidationError{ - field: "ProperCaseWords", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetProperCaseWords()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Http1ProtocolOptions_HeaderKeyFormatValidationError{ - field: "ProperCaseWords", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Http1ProtocolOptions_HeaderKeyFormat_StatefulFormatter: - if v == nil { - err := Http1ProtocolOptions_HeaderKeyFormatValidationError{ - field: "HeaderFormat", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofHeaderFormatPresent = true - - if all { - switch v := interface{}(m.GetStatefulFormatter()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Http1ProtocolOptions_HeaderKeyFormatValidationError{ - field: "StatefulFormatter", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Http1ProtocolOptions_HeaderKeyFormatValidationError{ - field: "StatefulFormatter", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetStatefulFormatter()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Http1ProtocolOptions_HeaderKeyFormatValidationError{ - field: "StatefulFormatter", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofHeaderFormatPresent { - err := Http1ProtocolOptions_HeaderKeyFormatValidationError{ - field: "HeaderFormat", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return Http1ProtocolOptions_HeaderKeyFormatMultiError(errors) - } - - return nil -} - -// Http1ProtocolOptions_HeaderKeyFormatMultiError is an error wrapping multiple -// validation errors returned by -// Http1ProtocolOptions_HeaderKeyFormat.ValidateAll() if the designated -// constraints aren't met. -type Http1ProtocolOptions_HeaderKeyFormatMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m Http1ProtocolOptions_HeaderKeyFormatMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m Http1ProtocolOptions_HeaderKeyFormatMultiError) AllErrors() []error { return m } - -// Http1ProtocolOptions_HeaderKeyFormatValidationError is the validation error -// returned by Http1ProtocolOptions_HeaderKeyFormat.Validate if the designated -// constraints aren't met. -type Http1ProtocolOptions_HeaderKeyFormatValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e Http1ProtocolOptions_HeaderKeyFormatValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e Http1ProtocolOptions_HeaderKeyFormatValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e Http1ProtocolOptions_HeaderKeyFormatValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e Http1ProtocolOptions_HeaderKeyFormatValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e Http1ProtocolOptions_HeaderKeyFormatValidationError) ErrorName() string { - return "Http1ProtocolOptions_HeaderKeyFormatValidationError" -} - -// Error satisfies the builtin error interface -func (e Http1ProtocolOptions_HeaderKeyFormatValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttp1ProtocolOptions_HeaderKeyFormat.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = Http1ProtocolOptions_HeaderKeyFormatValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = Http1ProtocolOptions_HeaderKeyFormatValidationError{} - -// Validate checks the field values on -// Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on -// Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in -// Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsMultiError, or nil if -// none found. -func (m *Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords) ValidateAll() error { - return m.validate(true) -} - -func (m *Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsMultiError(errors) - } - - return nil -} - -// Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsMultiError is an error -// wrapping multiple validation errors returned by -// Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords.ValidateAll() if the -// designated constraints aren't met. -type Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsMultiError) AllErrors() []error { return m } - -// Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsValidationError is the -// validation error returned by -// Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWords.Validate if the -// designated constraints aren't met. -type Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsValidationError) Field() string { - return e.field -} - -// Reason function returns reason value. -func (e Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsValidationError) Reason() string { - return e.reason -} - -// Cause function returns cause value. -func (e Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsValidationError) Cause() error { - return e.cause -} - -// Key function returns key value. -func (e Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsValidationError) ErrorName() string { - return "Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsValidationError" -} - -// Error satisfies the builtin error interface -func (e Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttp1ProtocolOptions_HeaderKeyFormat_ProperCaseWords.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = Http1ProtocolOptions_HeaderKeyFormat_ProperCaseWordsValidationError{} - -// Validate checks the field values on Http2ProtocolOptions_SettingsParameter -// with the rules defined in the proto definition for this message. If any -// rules are violated, the first error encountered is returned, or nil if -// there are no violations. -func (m *Http2ProtocolOptions_SettingsParameter) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on -// Http2ProtocolOptions_SettingsParameter with the rules defined in the proto -// definition for this message. If any rules are violated, the result is a -// list of violation errors wrapped in -// Http2ProtocolOptions_SettingsParameterMultiError, or nil if none found. -func (m *Http2ProtocolOptions_SettingsParameter) ValidateAll() error { - return m.validate(true) -} - -func (m *Http2ProtocolOptions_SettingsParameter) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if wrapper := m.GetIdentifier(); wrapper != nil { - - if val := wrapper.GetValue(); val < 0 || val > 65535 { - err := Http2ProtocolOptions_SettingsParameterValidationError{ - field: "Identifier", - reason: "value must be inside range [0, 65535]", - } - if !all { - return err - } - errors = append(errors, err) - } - - } else { - err := Http2ProtocolOptions_SettingsParameterValidationError{ - field: "Identifier", - reason: "value is required and must not be nil.", - } - if !all { - return err - } - errors = append(errors, err) - } - - if m.GetValue() == nil { - err := Http2ProtocolOptions_SettingsParameterValidationError{ - field: "Value", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetValue()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Http2ProtocolOptions_SettingsParameterValidationError{ - field: "Value", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Http2ProtocolOptions_SettingsParameterValidationError{ - field: "Value", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetValue()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Http2ProtocolOptions_SettingsParameterValidationError{ - field: "Value", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return Http2ProtocolOptions_SettingsParameterMultiError(errors) - } - - return nil -} - -// Http2ProtocolOptions_SettingsParameterMultiError is an error wrapping -// multiple validation errors returned by -// Http2ProtocolOptions_SettingsParameter.ValidateAll() if the designated -// constraints aren't met. -type Http2ProtocolOptions_SettingsParameterMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m Http2ProtocolOptions_SettingsParameterMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m Http2ProtocolOptions_SettingsParameterMultiError) AllErrors() []error { return m } - -// Http2ProtocolOptions_SettingsParameterValidationError is the validation -// error returned by Http2ProtocolOptions_SettingsParameter.Validate if the -// designated constraints aren't met. -type Http2ProtocolOptions_SettingsParameterValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e Http2ProtocolOptions_SettingsParameterValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e Http2ProtocolOptions_SettingsParameterValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e Http2ProtocolOptions_SettingsParameterValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e Http2ProtocolOptions_SettingsParameterValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e Http2ProtocolOptions_SettingsParameterValidationError) ErrorName() string { - return "Http2ProtocolOptions_SettingsParameterValidationError" -} - -// Error satisfies the builtin error interface -func (e Http2ProtocolOptions_SettingsParameterValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttp2ProtocolOptions_SettingsParameter.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = Http2ProtocolOptions_SettingsParameterValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = Http2ProtocolOptions_SettingsParameterValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/proxy_protocol.pb.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/proxy_protocol.pb.go deleted file mode 100644 index 95e85552f..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/proxy_protocol.pb.go +++ /dev/null @@ -1,375 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/config/core/v3/proxy_protocol.proto - -package corev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -type ProxyProtocolPassThroughTLVs_PassTLVsMatchType int32 - -const ( - // Pass all TLVs. - ProxyProtocolPassThroughTLVs_INCLUDE_ALL ProxyProtocolPassThroughTLVs_PassTLVsMatchType = 0 - // Pass specific TLVs defined in tlv_type. - ProxyProtocolPassThroughTLVs_INCLUDE ProxyProtocolPassThroughTLVs_PassTLVsMatchType = 1 -) - -// Enum value maps for ProxyProtocolPassThroughTLVs_PassTLVsMatchType. -var ( - ProxyProtocolPassThroughTLVs_PassTLVsMatchType_name = map[int32]string{ - 0: "INCLUDE_ALL", - 1: "INCLUDE", - } - ProxyProtocolPassThroughTLVs_PassTLVsMatchType_value = map[string]int32{ - "INCLUDE_ALL": 0, - "INCLUDE": 1, - } -) - -func (x ProxyProtocolPassThroughTLVs_PassTLVsMatchType) Enum() *ProxyProtocolPassThroughTLVs_PassTLVsMatchType { - p := new(ProxyProtocolPassThroughTLVs_PassTLVsMatchType) - *p = x - return p -} - -func (x ProxyProtocolPassThroughTLVs_PassTLVsMatchType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ProxyProtocolPassThroughTLVs_PassTLVsMatchType) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_config_core_v3_proxy_protocol_proto_enumTypes[0].Descriptor() -} - -func (ProxyProtocolPassThroughTLVs_PassTLVsMatchType) Type() protoreflect.EnumType { - return &file_envoy_config_core_v3_proxy_protocol_proto_enumTypes[0] -} - -func (x ProxyProtocolPassThroughTLVs_PassTLVsMatchType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ProxyProtocolPassThroughTLVs_PassTLVsMatchType.Descriptor instead. -func (ProxyProtocolPassThroughTLVs_PassTLVsMatchType) EnumDescriptor() ([]byte, []int) { - return file_envoy_config_core_v3_proxy_protocol_proto_rawDescGZIP(), []int{0, 0} -} - -type ProxyProtocolConfig_Version int32 - -const ( - // PROXY protocol version 1. Human readable format. - ProxyProtocolConfig_V1 ProxyProtocolConfig_Version = 0 - // PROXY protocol version 2. Binary format. - ProxyProtocolConfig_V2 ProxyProtocolConfig_Version = 1 -) - -// Enum value maps for ProxyProtocolConfig_Version. -var ( - ProxyProtocolConfig_Version_name = map[int32]string{ - 0: "V1", - 1: "V2", - } - ProxyProtocolConfig_Version_value = map[string]int32{ - "V1": 0, - "V2": 1, - } -) - -func (x ProxyProtocolConfig_Version) Enum() *ProxyProtocolConfig_Version { - p := new(ProxyProtocolConfig_Version) - *p = x - return p -} - -func (x ProxyProtocolConfig_Version) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ProxyProtocolConfig_Version) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_config_core_v3_proxy_protocol_proto_enumTypes[1].Descriptor() -} - -func (ProxyProtocolConfig_Version) Type() protoreflect.EnumType { - return &file_envoy_config_core_v3_proxy_protocol_proto_enumTypes[1] -} - -func (x ProxyProtocolConfig_Version) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ProxyProtocolConfig_Version.Descriptor instead. -func (ProxyProtocolConfig_Version) EnumDescriptor() ([]byte, []int) { - return file_envoy_config_core_v3_proxy_protocol_proto_rawDescGZIP(), []int{1, 0} -} - -type ProxyProtocolPassThroughTLVs struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The strategy to pass through TLVs. Default is INCLUDE_ALL. - // If INCLUDE_ALL is set, all TLVs will be passed through no matter the tlv_type field. - MatchType ProxyProtocolPassThroughTLVs_PassTLVsMatchType `protobuf:"varint,1,opt,name=match_type,json=matchType,proto3,enum=envoy.config.core.v3.ProxyProtocolPassThroughTLVs_PassTLVsMatchType" json:"match_type,omitempty"` - // The TLV types that are applied based on match_type. - // TLV type is defined as uint8_t in proxy protocol. See `the spec - // `_ for details. - TlvType []uint32 `protobuf:"varint,2,rep,packed,name=tlv_type,json=tlvType,proto3" json:"tlv_type,omitempty"` -} - -func (x *ProxyProtocolPassThroughTLVs) Reset() { - *x = ProxyProtocolPassThroughTLVs{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_proxy_protocol_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ProxyProtocolPassThroughTLVs) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ProxyProtocolPassThroughTLVs) ProtoMessage() {} - -func (x *ProxyProtocolPassThroughTLVs) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_proxy_protocol_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ProxyProtocolPassThroughTLVs.ProtoReflect.Descriptor instead. -func (*ProxyProtocolPassThroughTLVs) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_proxy_protocol_proto_rawDescGZIP(), []int{0} -} - -func (x *ProxyProtocolPassThroughTLVs) GetMatchType() ProxyProtocolPassThroughTLVs_PassTLVsMatchType { - if x != nil { - return x.MatchType - } - return ProxyProtocolPassThroughTLVs_INCLUDE_ALL -} - -func (x *ProxyProtocolPassThroughTLVs) GetTlvType() []uint32 { - if x != nil { - return x.TlvType - } - return nil -} - -type ProxyProtocolConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The PROXY protocol version to use. See https://www.haproxy.org/download/2.1/doc/proxy-protocol.txt for details - Version ProxyProtocolConfig_Version `protobuf:"varint,1,opt,name=version,proto3,enum=envoy.config.core.v3.ProxyProtocolConfig_Version" json:"version,omitempty"` - // This config controls which TLVs can be passed to upstream if it is Proxy Protocol - // V2 header. If there is no setting for this field, no TLVs will be passed through. - PassThroughTlvs *ProxyProtocolPassThroughTLVs `protobuf:"bytes,2,opt,name=pass_through_tlvs,json=passThroughTlvs,proto3" json:"pass_through_tlvs,omitempty"` -} - -func (x *ProxyProtocolConfig) Reset() { - *x = ProxyProtocolConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_proxy_protocol_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ProxyProtocolConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ProxyProtocolConfig) ProtoMessage() {} - -func (x *ProxyProtocolConfig) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_proxy_protocol_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ProxyProtocolConfig.ProtoReflect.Descriptor instead. -func (*ProxyProtocolConfig) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_proxy_protocol_proto_rawDescGZIP(), []int{1} -} - -func (x *ProxyProtocolConfig) GetVersion() ProxyProtocolConfig_Version { - if x != nil { - return x.Version - } - return ProxyProtocolConfig_V1 -} - -func (x *ProxyProtocolConfig) GetPassThroughTlvs() *ProxyProtocolPassThroughTLVs { - if x != nil { - return x.PassThroughTlvs - } - return nil -} - -var File_envoy_config_core_v3_proxy_protocol_proto protoreflect.FileDescriptor - -var file_envoy_config_core_v3_proxy_protocol_proto_rawDesc = []byte{ - 0x0a, 0x29, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, - 0x33, 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe0, 0x01, 0x0a, 0x1c, 0x50, 0x72, - 0x6f, 0x78, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x50, 0x61, 0x73, 0x73, 0x54, - 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x54, 0x4c, 0x56, 0x73, 0x12, 0x63, 0x0a, 0x0a, 0x6d, 0x61, - 0x74, 0x63, 0x68, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x44, - 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x63, 0x6f, 0x6c, 0x50, 0x61, 0x73, 0x73, 0x54, 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x54, 0x4c, - 0x56, 0x73, 0x2e, 0x50, 0x61, 0x73, 0x73, 0x54, 0x4c, 0x56, 0x73, 0x4d, 0x61, 0x74, 0x63, 0x68, - 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x28, 0x0a, 0x08, 0x74, 0x6c, 0x76, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x0d, 0x42, 0x0d, 0xfa, 0x42, 0x0a, 0x92, 0x01, 0x07, 0x22, 0x05, 0x2a, 0x03, 0x10, 0x80, 0x02, - 0x52, 0x07, 0x74, 0x6c, 0x76, 0x54, 0x79, 0x70, 0x65, 0x22, 0x31, 0x0a, 0x11, 0x50, 0x61, 0x73, - 0x73, 0x54, 0x4c, 0x56, 0x73, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, - 0x0a, 0x0b, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x45, 0x5f, 0x41, 0x4c, 0x4c, 0x10, 0x00, 0x12, - 0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x45, 0x10, 0x01, 0x22, 0xdd, 0x01, 0x0a, - 0x13, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x12, 0x4b, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x72, 0x6f, - 0x78, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x5e, 0x0a, 0x11, 0x70, 0x61, 0x73, 0x73, 0x5f, 0x74, 0x68, 0x72, 0x6f, 0x75, 0x67, - 0x68, 0x5f, 0x74, 0x6c, 0x76, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, - 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, - 0x6c, 0x50, 0x61, 0x73, 0x73, 0x54, 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x54, 0x4c, 0x56, 0x73, - 0x52, 0x0f, 0x70, 0x61, 0x73, 0x73, 0x54, 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x54, 0x6c, 0x76, - 0x73, 0x22, 0x19, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x06, 0x0a, 0x02, - 0x56, 0x31, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x56, 0x32, 0x10, 0x01, 0x42, 0x86, 0x01, 0x0a, - 0x22, 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, - 0x2e, 0x76, 0x33, 0x42, 0x12, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, - 0x6f, 0x6c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, - 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, - 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x3b, 0x63, 0x6f, 0x72, 0x65, 0x76, 0x33, 0xba, 0x80, 0xc8, - 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_config_core_v3_proxy_protocol_proto_rawDescOnce sync.Once - file_envoy_config_core_v3_proxy_protocol_proto_rawDescData = file_envoy_config_core_v3_proxy_protocol_proto_rawDesc -) - -func file_envoy_config_core_v3_proxy_protocol_proto_rawDescGZIP() []byte { - file_envoy_config_core_v3_proxy_protocol_proto_rawDescOnce.Do(func() { - file_envoy_config_core_v3_proxy_protocol_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_config_core_v3_proxy_protocol_proto_rawDescData) - }) - return file_envoy_config_core_v3_proxy_protocol_proto_rawDescData -} - -var file_envoy_config_core_v3_proxy_protocol_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_envoy_config_core_v3_proxy_protocol_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_envoy_config_core_v3_proxy_protocol_proto_goTypes = []interface{}{ - (ProxyProtocolPassThroughTLVs_PassTLVsMatchType)(0), // 0: envoy.config.core.v3.ProxyProtocolPassThroughTLVs.PassTLVsMatchType - (ProxyProtocolConfig_Version)(0), // 1: envoy.config.core.v3.ProxyProtocolConfig.Version - (*ProxyProtocolPassThroughTLVs)(nil), // 2: envoy.config.core.v3.ProxyProtocolPassThroughTLVs - (*ProxyProtocolConfig)(nil), // 3: envoy.config.core.v3.ProxyProtocolConfig -} -var file_envoy_config_core_v3_proxy_protocol_proto_depIdxs = []int32{ - 0, // 0: envoy.config.core.v3.ProxyProtocolPassThroughTLVs.match_type:type_name -> envoy.config.core.v3.ProxyProtocolPassThroughTLVs.PassTLVsMatchType - 1, // 1: envoy.config.core.v3.ProxyProtocolConfig.version:type_name -> envoy.config.core.v3.ProxyProtocolConfig.Version - 2, // 2: envoy.config.core.v3.ProxyProtocolConfig.pass_through_tlvs:type_name -> envoy.config.core.v3.ProxyProtocolPassThroughTLVs - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_envoy_config_core_v3_proxy_protocol_proto_init() } -func file_envoy_config_core_v3_proxy_protocol_proto_init() { - if File_envoy_config_core_v3_proxy_protocol_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_envoy_config_core_v3_proxy_protocol_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ProxyProtocolPassThroughTLVs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_proxy_protocol_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ProxyProtocolConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_config_core_v3_proxy_protocol_proto_rawDesc, - NumEnums: 2, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_config_core_v3_proxy_protocol_proto_goTypes, - DependencyIndexes: file_envoy_config_core_v3_proxy_protocol_proto_depIdxs, - EnumInfos: file_envoy_config_core_v3_proxy_protocol_proto_enumTypes, - MessageInfos: file_envoy_config_core_v3_proxy_protocol_proto_msgTypes, - }.Build() - File_envoy_config_core_v3_proxy_protocol_proto = out.File - file_envoy_config_core_v3_proxy_protocol_proto_rawDesc = nil - file_envoy_config_core_v3_proxy_protocol_proto_goTypes = nil - file_envoy_config_core_v3_proxy_protocol_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/proxy_protocol.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/proxy_protocol.pb.validate.go deleted file mode 100644 index 2edd9b116..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/proxy_protocol.pb.validate.go +++ /dev/null @@ -1,290 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/config/core/v3/proxy_protocol.proto - -package corev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on ProxyProtocolPassThroughTLVs with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ProxyProtocolPassThroughTLVs) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ProxyProtocolPassThroughTLVs with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ProxyProtocolPassThroughTLVsMultiError, or nil if none found. -func (m *ProxyProtocolPassThroughTLVs) ValidateAll() error { - return m.validate(true) -} - -func (m *ProxyProtocolPassThroughTLVs) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for MatchType - - for idx, item := range m.GetTlvType() { - _, _ = idx, item - - if item >= 256 { - err := ProxyProtocolPassThroughTLVsValidationError{ - field: fmt.Sprintf("TlvType[%v]", idx), - reason: "value must be less than 256", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if len(errors) > 0 { - return ProxyProtocolPassThroughTLVsMultiError(errors) - } - - return nil -} - -// ProxyProtocolPassThroughTLVsMultiError is an error wrapping multiple -// validation errors returned by ProxyProtocolPassThroughTLVs.ValidateAll() if -// the designated constraints aren't met. -type ProxyProtocolPassThroughTLVsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ProxyProtocolPassThroughTLVsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ProxyProtocolPassThroughTLVsMultiError) AllErrors() []error { return m } - -// ProxyProtocolPassThroughTLVsValidationError is the validation error returned -// by ProxyProtocolPassThroughTLVs.Validate if the designated constraints -// aren't met. -type ProxyProtocolPassThroughTLVsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ProxyProtocolPassThroughTLVsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ProxyProtocolPassThroughTLVsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ProxyProtocolPassThroughTLVsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ProxyProtocolPassThroughTLVsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ProxyProtocolPassThroughTLVsValidationError) ErrorName() string { - return "ProxyProtocolPassThroughTLVsValidationError" -} - -// Error satisfies the builtin error interface -func (e ProxyProtocolPassThroughTLVsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sProxyProtocolPassThroughTLVs.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ProxyProtocolPassThroughTLVsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ProxyProtocolPassThroughTLVsValidationError{} - -// Validate checks the field values on ProxyProtocolConfig with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ProxyProtocolConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ProxyProtocolConfig with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ProxyProtocolConfigMultiError, or nil if none found. -func (m *ProxyProtocolConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *ProxyProtocolConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Version - - if all { - switch v := interface{}(m.GetPassThroughTlvs()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ProxyProtocolConfigValidationError{ - field: "PassThroughTlvs", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ProxyProtocolConfigValidationError{ - field: "PassThroughTlvs", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPassThroughTlvs()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ProxyProtocolConfigValidationError{ - field: "PassThroughTlvs", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return ProxyProtocolConfigMultiError(errors) - } - - return nil -} - -// ProxyProtocolConfigMultiError is an error wrapping multiple validation -// errors returned by ProxyProtocolConfig.ValidateAll() if the designated -// constraints aren't met. -type ProxyProtocolConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ProxyProtocolConfigMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ProxyProtocolConfigMultiError) AllErrors() []error { return m } - -// ProxyProtocolConfigValidationError is the validation error returned by -// ProxyProtocolConfig.Validate if the designated constraints aren't met. -type ProxyProtocolConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ProxyProtocolConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ProxyProtocolConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ProxyProtocolConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ProxyProtocolConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ProxyProtocolConfigValidationError) ErrorName() string { - return "ProxyProtocolConfigValidationError" -} - -// Error satisfies the builtin error interface -func (e ProxyProtocolConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sProxyProtocolConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ProxyProtocolConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ProxyProtocolConfigValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/resolver.pb.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/resolver.pb.go deleted file mode 100644 index e198399ec..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/resolver.pb.go +++ /dev/null @@ -1,270 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/config/core/v3/resolver.proto - -package corev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Configuration of DNS resolver option flags which control the behavior of the DNS resolver. -type DnsResolverOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Use TCP for all DNS queries instead of the default protocol UDP. - UseTcpForDnsLookups bool `protobuf:"varint,1,opt,name=use_tcp_for_dns_lookups,json=useTcpForDnsLookups,proto3" json:"use_tcp_for_dns_lookups,omitempty"` - // Do not use the default search domains; only query hostnames as-is or as aliases. - NoDefaultSearchDomain bool `protobuf:"varint,2,opt,name=no_default_search_domain,json=noDefaultSearchDomain,proto3" json:"no_default_search_domain,omitempty"` -} - -func (x *DnsResolverOptions) Reset() { - *x = DnsResolverOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_resolver_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DnsResolverOptions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DnsResolverOptions) ProtoMessage() {} - -func (x *DnsResolverOptions) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_resolver_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DnsResolverOptions.ProtoReflect.Descriptor instead. -func (*DnsResolverOptions) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_resolver_proto_rawDescGZIP(), []int{0} -} - -func (x *DnsResolverOptions) GetUseTcpForDnsLookups() bool { - if x != nil { - return x.UseTcpForDnsLookups - } - return false -} - -func (x *DnsResolverOptions) GetNoDefaultSearchDomain() bool { - if x != nil { - return x.NoDefaultSearchDomain - } - return false -} - -// DNS resolution configuration which includes the underlying dns resolver addresses and options. -type DnsResolutionConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // A list of dns resolver addresses. If specified, the DNS client library will perform resolution - // via the underlying DNS resolvers. Otherwise, the default system resolvers - // (e.g., /etc/resolv.conf) will be used. - Resolvers []*Address `protobuf:"bytes,1,rep,name=resolvers,proto3" json:"resolvers,omitempty"` - // Configuration of DNS resolver option flags which control the behavior of the DNS resolver. - DnsResolverOptions *DnsResolverOptions `protobuf:"bytes,2,opt,name=dns_resolver_options,json=dnsResolverOptions,proto3" json:"dns_resolver_options,omitempty"` -} - -func (x *DnsResolutionConfig) Reset() { - *x = DnsResolutionConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_resolver_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DnsResolutionConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DnsResolutionConfig) ProtoMessage() {} - -func (x *DnsResolutionConfig) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_resolver_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DnsResolutionConfig.ProtoReflect.Descriptor instead. -func (*DnsResolutionConfig) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_resolver_proto_rawDescGZIP(), []int{1} -} - -func (x *DnsResolutionConfig) GetResolvers() []*Address { - if x != nil { - return x.Resolvers - } - return nil -} - -func (x *DnsResolutionConfig) GetDnsResolverOptions() *DnsResolverOptions { - if x != nil { - return x.DnsResolverOptions - } - return nil -} - -var File_envoy_config_core_v3_resolver_proto protoreflect.FileDescriptor - -var file_envoy_config_core_v3_resolver_proto_rawDesc = []byte{ - 0x0a, 0x23, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x72, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x1a, 0x22, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, - 0x33, 0x2f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, - 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x83, 0x01, 0x0a, 0x12, 0x44, 0x6e, 0x73, 0x52, - 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x34, - 0x0a, 0x17, 0x75, 0x73, 0x65, 0x5f, 0x74, 0x63, 0x70, 0x5f, 0x66, 0x6f, 0x72, 0x5f, 0x64, 0x6e, - 0x73, 0x5f, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x13, 0x75, 0x73, 0x65, 0x54, 0x63, 0x70, 0x46, 0x6f, 0x72, 0x44, 0x6e, 0x73, 0x4c, 0x6f, 0x6f, - 0x6b, 0x75, 0x70, 0x73, 0x12, 0x37, 0x0a, 0x18, 0x6e, 0x6f, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, - 0x6c, 0x74, 0x5f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x5f, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x6e, 0x6f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, - 0x74, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x22, 0xb8, 0x01, - 0x0a, 0x13, 0x44, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x45, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, - 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, - 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, - 0x01, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x72, 0x73, 0x12, 0x5a, 0x0a, 0x14, - 0x64, 0x6e, 0x73, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x72, 0x5f, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, - 0x33, 0x2e, 0x44, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x72, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x12, 0x64, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, - 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x81, 0x01, 0x0a, 0x22, 0x69, 0x6f, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x42, - 0x0d, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x3b, 0x63, 0x6f, - 0x72, 0x65, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_config_core_v3_resolver_proto_rawDescOnce sync.Once - file_envoy_config_core_v3_resolver_proto_rawDescData = file_envoy_config_core_v3_resolver_proto_rawDesc -) - -func file_envoy_config_core_v3_resolver_proto_rawDescGZIP() []byte { - file_envoy_config_core_v3_resolver_proto_rawDescOnce.Do(func() { - file_envoy_config_core_v3_resolver_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_config_core_v3_resolver_proto_rawDescData) - }) - return file_envoy_config_core_v3_resolver_proto_rawDescData -} - -var file_envoy_config_core_v3_resolver_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_envoy_config_core_v3_resolver_proto_goTypes = []interface{}{ - (*DnsResolverOptions)(nil), // 0: envoy.config.core.v3.DnsResolverOptions - (*DnsResolutionConfig)(nil), // 1: envoy.config.core.v3.DnsResolutionConfig - (*Address)(nil), // 2: envoy.config.core.v3.Address -} -var file_envoy_config_core_v3_resolver_proto_depIdxs = []int32{ - 2, // 0: envoy.config.core.v3.DnsResolutionConfig.resolvers:type_name -> envoy.config.core.v3.Address - 0, // 1: envoy.config.core.v3.DnsResolutionConfig.dns_resolver_options:type_name -> envoy.config.core.v3.DnsResolverOptions - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_envoy_config_core_v3_resolver_proto_init() } -func file_envoy_config_core_v3_resolver_proto_init() { - if File_envoy_config_core_v3_resolver_proto != nil { - return - } - file_envoy_config_core_v3_address_proto_init() - if !protoimpl.UnsafeEnabled { - file_envoy_config_core_v3_resolver_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DnsResolverOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_resolver_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DnsResolutionConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_config_core_v3_resolver_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_config_core_v3_resolver_proto_goTypes, - DependencyIndexes: file_envoy_config_core_v3_resolver_proto_depIdxs, - MessageInfos: file_envoy_config_core_v3_resolver_proto_msgTypes, - }.Build() - File_envoy_config_core_v3_resolver_proto = out.File - file_envoy_config_core_v3_resolver_proto_rawDesc = nil - file_envoy_config_core_v3_resolver_proto_goTypes = nil - file_envoy_config_core_v3_resolver_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/resolver.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/resolver.pb.validate.go deleted file mode 100644 index 30de106fe..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/resolver.pb.validate.go +++ /dev/null @@ -1,318 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/config/core/v3/resolver.proto - -package corev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on DnsResolverOptions with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *DnsResolverOptions) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DnsResolverOptions with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// DnsResolverOptionsMultiError, or nil if none found. -func (m *DnsResolverOptions) ValidateAll() error { - return m.validate(true) -} - -func (m *DnsResolverOptions) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for UseTcpForDnsLookups - - // no validation rules for NoDefaultSearchDomain - - if len(errors) > 0 { - return DnsResolverOptionsMultiError(errors) - } - - return nil -} - -// DnsResolverOptionsMultiError is an error wrapping multiple validation errors -// returned by DnsResolverOptions.ValidateAll() if the designated constraints -// aren't met. -type DnsResolverOptionsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DnsResolverOptionsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DnsResolverOptionsMultiError) AllErrors() []error { return m } - -// DnsResolverOptionsValidationError is the validation error returned by -// DnsResolverOptions.Validate if the designated constraints aren't met. -type DnsResolverOptionsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DnsResolverOptionsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DnsResolverOptionsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DnsResolverOptionsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DnsResolverOptionsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DnsResolverOptionsValidationError) ErrorName() string { - return "DnsResolverOptionsValidationError" -} - -// Error satisfies the builtin error interface -func (e DnsResolverOptionsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDnsResolverOptions.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DnsResolverOptionsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DnsResolverOptionsValidationError{} - -// Validate checks the field values on DnsResolutionConfig with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *DnsResolutionConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DnsResolutionConfig with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// DnsResolutionConfigMultiError, or nil if none found. -func (m *DnsResolutionConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *DnsResolutionConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(m.GetResolvers()) < 1 { - err := DnsResolutionConfigValidationError{ - field: "Resolvers", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetResolvers() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DnsResolutionConfigValidationError{ - field: fmt.Sprintf("Resolvers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DnsResolutionConfigValidationError{ - field: fmt.Sprintf("Resolvers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DnsResolutionConfigValidationError{ - field: fmt.Sprintf("Resolvers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetDnsResolverOptions()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DnsResolutionConfigValidationError{ - field: "DnsResolverOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DnsResolutionConfigValidationError{ - field: "DnsResolverOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDnsResolverOptions()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DnsResolutionConfigValidationError{ - field: "DnsResolverOptions", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return DnsResolutionConfigMultiError(errors) - } - - return nil -} - -// DnsResolutionConfigMultiError is an error wrapping multiple validation -// errors returned by DnsResolutionConfig.ValidateAll() if the designated -// constraints aren't met. -type DnsResolutionConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DnsResolutionConfigMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DnsResolutionConfigMultiError) AllErrors() []error { return m } - -// DnsResolutionConfigValidationError is the validation error returned by -// DnsResolutionConfig.Validate if the designated constraints aren't met. -type DnsResolutionConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DnsResolutionConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DnsResolutionConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DnsResolutionConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DnsResolutionConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DnsResolutionConfigValidationError) ErrorName() string { - return "DnsResolutionConfigValidationError" -} - -// Error satisfies the builtin error interface -func (e DnsResolutionConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDnsResolutionConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DnsResolutionConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DnsResolutionConfigValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/socket_option.pb.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/socket_option.pb.go deleted file mode 100644 index 2551950c6..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/socket_option.pb.go +++ /dev/null @@ -1,409 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/config/core/v3/socket_option.proto - -package corev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -type SocketOption_SocketState int32 - -const ( - // Socket options are applied after socket creation but before binding the socket to a port - SocketOption_STATE_PREBIND SocketOption_SocketState = 0 - // Socket options are applied after binding the socket to a port but before calling listen() - SocketOption_STATE_BOUND SocketOption_SocketState = 1 - // Socket options are applied after calling listen() - SocketOption_STATE_LISTENING SocketOption_SocketState = 2 -) - -// Enum value maps for SocketOption_SocketState. -var ( - SocketOption_SocketState_name = map[int32]string{ - 0: "STATE_PREBIND", - 1: "STATE_BOUND", - 2: "STATE_LISTENING", - } - SocketOption_SocketState_value = map[string]int32{ - "STATE_PREBIND": 0, - "STATE_BOUND": 1, - "STATE_LISTENING": 2, - } -) - -func (x SocketOption_SocketState) Enum() *SocketOption_SocketState { - p := new(SocketOption_SocketState) - *p = x - return p -} - -func (x SocketOption_SocketState) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (SocketOption_SocketState) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_config_core_v3_socket_option_proto_enumTypes[0].Descriptor() -} - -func (SocketOption_SocketState) Type() protoreflect.EnumType { - return &file_envoy_config_core_v3_socket_option_proto_enumTypes[0] -} - -func (x SocketOption_SocketState) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use SocketOption_SocketState.Descriptor instead. -func (SocketOption_SocketState) EnumDescriptor() ([]byte, []int) { - return file_envoy_config_core_v3_socket_option_proto_rawDescGZIP(), []int{0, 0} -} - -// Generic socket option message. This would be used to set socket options that -// might not exist in upstream kernels or precompiled Envoy binaries. -// -// For example: -// -// .. code-block:: json -// -// { -// "description": "support tcp keep alive", -// "state": 0, -// "level": 1, -// "name": 9, -// "int_value": 1, -// } -// -// 1 means SOL_SOCKET and 9 means SO_KEEPALIVE on Linux. -// With the above configuration, `TCP Keep-Alives `_ -// can be enabled in socket with Linux, which can be used in -// :ref:`listener's` or -// :ref:`admin's ` socket_options etc. -// -// It should be noted that the name or level may have different values on different platforms. -// [#next-free-field: 7] -type SocketOption struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // An optional name to give this socket option for debugging, etc. - // Uniqueness is not required and no special meaning is assumed. - Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` - // Corresponding to the level value passed to setsockopt, such as IPPROTO_TCP - Level int64 `protobuf:"varint,2,opt,name=level,proto3" json:"level,omitempty"` - // The numeric name as passed to setsockopt - Name int64 `protobuf:"varint,3,opt,name=name,proto3" json:"name,omitempty"` - // Types that are assignable to Value: - // - // *SocketOption_IntValue - // *SocketOption_BufValue - Value isSocketOption_Value `protobuf_oneof:"value"` - // The state in which the option will be applied. When used in BindConfig - // STATE_PREBIND is currently the only valid value. - State SocketOption_SocketState `protobuf:"varint,6,opt,name=state,proto3,enum=envoy.config.core.v3.SocketOption_SocketState" json:"state,omitempty"` -} - -func (x *SocketOption) Reset() { - *x = SocketOption{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_socket_option_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SocketOption) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SocketOption) ProtoMessage() {} - -func (x *SocketOption) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_socket_option_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SocketOption.ProtoReflect.Descriptor instead. -func (*SocketOption) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_socket_option_proto_rawDescGZIP(), []int{0} -} - -func (x *SocketOption) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *SocketOption) GetLevel() int64 { - if x != nil { - return x.Level - } - return 0 -} - -func (x *SocketOption) GetName() int64 { - if x != nil { - return x.Name - } - return 0 -} - -func (m *SocketOption) GetValue() isSocketOption_Value { - if m != nil { - return m.Value - } - return nil -} - -func (x *SocketOption) GetIntValue() int64 { - if x, ok := x.GetValue().(*SocketOption_IntValue); ok { - return x.IntValue - } - return 0 -} - -func (x *SocketOption) GetBufValue() []byte { - if x, ok := x.GetValue().(*SocketOption_BufValue); ok { - return x.BufValue - } - return nil -} - -func (x *SocketOption) GetState() SocketOption_SocketState { - if x != nil { - return x.State - } - return SocketOption_STATE_PREBIND -} - -type isSocketOption_Value interface { - isSocketOption_Value() -} - -type SocketOption_IntValue struct { - // Because many sockopts take an int value. - IntValue int64 `protobuf:"varint,4,opt,name=int_value,json=intValue,proto3,oneof"` -} - -type SocketOption_BufValue struct { - // Otherwise it's a byte buffer. - BufValue []byte `protobuf:"bytes,5,opt,name=buf_value,json=bufValue,proto3,oneof"` -} - -func (*SocketOption_IntValue) isSocketOption_Value() {} - -func (*SocketOption_BufValue) isSocketOption_Value() {} - -type SocketOptionsOverride struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SocketOptions []*SocketOption `protobuf:"bytes,1,rep,name=socket_options,json=socketOptions,proto3" json:"socket_options,omitempty"` -} - -func (x *SocketOptionsOverride) Reset() { - *x = SocketOptionsOverride{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_socket_option_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SocketOptionsOverride) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SocketOptionsOverride) ProtoMessage() {} - -func (x *SocketOptionsOverride) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_socket_option_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SocketOptionsOverride.ProtoReflect.Descriptor instead. -func (*SocketOptionsOverride) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_socket_option_proto_rawDescGZIP(), []int{1} -} - -func (x *SocketOptionsOverride) GetSocketOptions() []*SocketOption { - if x != nil { - return x.SocketOptions - } - return nil -} - -var File_envoy_config_core_v3_socket_option_proto protoreflect.FileDescriptor - -var file_envoy_config_core_v3_socket_option_proto_rawDesc = []byte{ - 0x0a, 0x28, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x6f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, - 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x21, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe5, 0x02, 0x0a, 0x0c, - 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, - 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6c, - 0x65, 0x76, 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x5f, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x08, 0x69, - 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1d, 0x0a, 0x09, 0x62, 0x75, 0x66, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x08, 0x62, 0x75, - 0x66, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x4e, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x6f, 0x63, - 0x6b, 0x65, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, - 0x53, 0x74, 0x61, 0x74, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, - 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x46, 0x0a, 0x0b, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, - 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x50, - 0x52, 0x45, 0x42, 0x49, 0x4e, 0x44, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x53, 0x54, 0x41, 0x54, - 0x45, 0x5f, 0x42, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x54, 0x41, - 0x54, 0x45, 0x5f, 0x4c, 0x49, 0x53, 0x54, 0x45, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x3a, 0x25, - 0x9a, 0xc5, 0x88, 0x1e, 0x20, 0x0a, 0x1e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x03, - 0xf8, 0x42, 0x01, 0x22, 0x62, 0x0a, 0x15, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x12, 0x49, 0x0a, 0x0e, - 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x6f, 0x63, 0x6b, - 0x65, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, - 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x85, 0x01, 0x0a, 0x22, 0x69, 0x6f, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x42, 0x11, - 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, - 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, - 0x3b, 0x63, 0x6f, 0x72, 0x65, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_config_core_v3_socket_option_proto_rawDescOnce sync.Once - file_envoy_config_core_v3_socket_option_proto_rawDescData = file_envoy_config_core_v3_socket_option_proto_rawDesc -) - -func file_envoy_config_core_v3_socket_option_proto_rawDescGZIP() []byte { - file_envoy_config_core_v3_socket_option_proto_rawDescOnce.Do(func() { - file_envoy_config_core_v3_socket_option_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_config_core_v3_socket_option_proto_rawDescData) - }) - return file_envoy_config_core_v3_socket_option_proto_rawDescData -} - -var file_envoy_config_core_v3_socket_option_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_envoy_config_core_v3_socket_option_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_envoy_config_core_v3_socket_option_proto_goTypes = []interface{}{ - (SocketOption_SocketState)(0), // 0: envoy.config.core.v3.SocketOption.SocketState - (*SocketOption)(nil), // 1: envoy.config.core.v3.SocketOption - (*SocketOptionsOverride)(nil), // 2: envoy.config.core.v3.SocketOptionsOverride -} -var file_envoy_config_core_v3_socket_option_proto_depIdxs = []int32{ - 0, // 0: envoy.config.core.v3.SocketOption.state:type_name -> envoy.config.core.v3.SocketOption.SocketState - 1, // 1: envoy.config.core.v3.SocketOptionsOverride.socket_options:type_name -> envoy.config.core.v3.SocketOption - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_envoy_config_core_v3_socket_option_proto_init() } -func file_envoy_config_core_v3_socket_option_proto_init() { - if File_envoy_config_core_v3_socket_option_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_envoy_config_core_v3_socket_option_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SocketOption); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_socket_option_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SocketOptionsOverride); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_config_core_v3_socket_option_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*SocketOption_IntValue)(nil), - (*SocketOption_BufValue)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_config_core_v3_socket_option_proto_rawDesc, - NumEnums: 1, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_config_core_v3_socket_option_proto_goTypes, - DependencyIndexes: file_envoy_config_core_v3_socket_option_proto_depIdxs, - EnumInfos: file_envoy_config_core_v3_socket_option_proto_enumTypes, - MessageInfos: file_envoy_config_core_v3_socket_option_proto_msgTypes, - }.Build() - File_envoy_config_core_v3_socket_option_proto = out.File - file_envoy_config_core_v3_socket_option_proto_rawDesc = nil - file_envoy_config_core_v3_socket_option_proto_goTypes = nil - file_envoy_config_core_v3_socket_option_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/socket_option.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/socket_option.pb.validate.go deleted file mode 100644 index dc0b53f55..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/socket_option.pb.validate.go +++ /dev/null @@ -1,330 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/config/core/v3/socket_option.proto - -package corev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on SocketOption with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *SocketOption) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SocketOption with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in SocketOptionMultiError, or -// nil if none found. -func (m *SocketOption) ValidateAll() error { - return m.validate(true) -} - -func (m *SocketOption) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Description - - // no validation rules for Level - - // no validation rules for Name - - if _, ok := SocketOption_SocketState_name[int32(m.GetState())]; !ok { - err := SocketOptionValidationError{ - field: "State", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - oneofValuePresent := false - switch v := m.Value.(type) { - case *SocketOption_IntValue: - if v == nil { - err := SocketOptionValidationError{ - field: "Value", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofValuePresent = true - // no validation rules for IntValue - case *SocketOption_BufValue: - if v == nil { - err := SocketOptionValidationError{ - field: "Value", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofValuePresent = true - // no validation rules for BufValue - default: - _ = v // ensures v is used - } - if !oneofValuePresent { - err := SocketOptionValidationError{ - field: "Value", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return SocketOptionMultiError(errors) - } - - return nil -} - -// SocketOptionMultiError is an error wrapping multiple validation errors -// returned by SocketOption.ValidateAll() if the designated constraints aren't met. -type SocketOptionMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SocketOptionMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m SocketOptionMultiError) AllErrors() []error { return m } - -// SocketOptionValidationError is the validation error returned by -// SocketOption.Validate if the designated constraints aren't met. -type SocketOptionValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SocketOptionValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SocketOptionValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SocketOptionValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SocketOptionValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SocketOptionValidationError) ErrorName() string { return "SocketOptionValidationError" } - -// Error satisfies the builtin error interface -func (e SocketOptionValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSocketOption.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SocketOptionValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SocketOptionValidationError{} - -// Validate checks the field values on SocketOptionsOverride with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *SocketOptionsOverride) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SocketOptionsOverride with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// SocketOptionsOverrideMultiError, or nil if none found. -func (m *SocketOptionsOverride) ValidateAll() error { - return m.validate(true) -} - -func (m *SocketOptionsOverride) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetSocketOptions() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, SocketOptionsOverrideValidationError{ - field: fmt.Sprintf("SocketOptions[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, SocketOptionsOverrideValidationError{ - field: fmt.Sprintf("SocketOptions[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return SocketOptionsOverrideValidationError{ - field: fmt.Sprintf("SocketOptions[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return SocketOptionsOverrideMultiError(errors) - } - - return nil -} - -// SocketOptionsOverrideMultiError is an error wrapping multiple validation -// errors returned by SocketOptionsOverride.ValidateAll() if the designated -// constraints aren't met. -type SocketOptionsOverrideMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SocketOptionsOverrideMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m SocketOptionsOverrideMultiError) AllErrors() []error { return m } - -// SocketOptionsOverrideValidationError is the validation error returned by -// SocketOptionsOverride.Validate if the designated constraints aren't met. -type SocketOptionsOverrideValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SocketOptionsOverrideValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SocketOptionsOverrideValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SocketOptionsOverrideValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SocketOptionsOverrideValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SocketOptionsOverrideValidationError) ErrorName() string { - return "SocketOptionsOverrideValidationError" -} - -// Error satisfies the builtin error interface -func (e SocketOptionsOverrideValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSocketOptionsOverride.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SocketOptionsOverrideValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SocketOptionsOverrideValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/substitution_format_string.pb.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/substitution_format_string.pb.go deleted file mode 100644 index f1e128571..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/substitution_format_string.pb.go +++ /dev/null @@ -1,444 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/config/core/v3/substitution_format_string.proto - -package corev3 - -import ( - _ "github.com/cilium/proxy/go/envoy/annotations" - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - structpb "google.golang.org/protobuf/types/known/structpb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Optional configuration options to be used with json_format. -type JsonFormatOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The output JSON string properties will be sorted. - SortProperties bool `protobuf:"varint,1,opt,name=sort_properties,json=sortProperties,proto3" json:"sort_properties,omitempty"` -} - -func (x *JsonFormatOptions) Reset() { - *x = JsonFormatOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_substitution_format_string_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *JsonFormatOptions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*JsonFormatOptions) ProtoMessage() {} - -func (x *JsonFormatOptions) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_substitution_format_string_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use JsonFormatOptions.ProtoReflect.Descriptor instead. -func (*JsonFormatOptions) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_substitution_format_string_proto_rawDescGZIP(), []int{0} -} - -func (x *JsonFormatOptions) GetSortProperties() bool { - if x != nil { - return x.SortProperties - } - return false -} - -// Configuration to use multiple :ref:`command operators ` -// to generate a new string in either plain text or JSON format. -// [#next-free-field: 8] -type SubstitutionFormatString struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Format: - // - // *SubstitutionFormatString_TextFormat - // *SubstitutionFormatString_JsonFormat - // *SubstitutionFormatString_TextFormatSource - Format isSubstitutionFormatString_Format `protobuf_oneof:"format"` - // If set to true, when command operators are evaluated to null, - // - // - for “text_format“, the output of the empty operator is changed from “-“ to an - // empty string, so that empty values are omitted entirely. - // - for “json_format“ the keys with null values are omitted in the output structure. - OmitEmptyValues bool `protobuf:"varint,3,opt,name=omit_empty_values,json=omitEmptyValues,proto3" json:"omit_empty_values,omitempty"` - // Specify a “content_type“ field. - // If this field is not set then “text/plain“ is used for “text_format“ and - // “application/json“ is used for “json_format“. - // - // .. validated-code-block:: yaml - // - // :type-name: envoy.config.core.v3.SubstitutionFormatString - // - // content_type: "text/html; charset=UTF-8" - ContentType string `protobuf:"bytes,4,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` - // Specifies a collection of Formatter plugins that can be called from the access log configuration. - // See the formatters extensions documentation for details. - // [#extension-category: envoy.formatter] - Formatters []*TypedExtensionConfig `protobuf:"bytes,6,rep,name=formatters,proto3" json:"formatters,omitempty"` - // If json_format is used, the options will be applied to the output JSON string. - JsonFormatOptions *JsonFormatOptions `protobuf:"bytes,7,opt,name=json_format_options,json=jsonFormatOptions,proto3" json:"json_format_options,omitempty"` -} - -func (x *SubstitutionFormatString) Reset() { - *x = SubstitutionFormatString{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_substitution_format_string_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SubstitutionFormatString) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SubstitutionFormatString) ProtoMessage() {} - -func (x *SubstitutionFormatString) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_substitution_format_string_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SubstitutionFormatString.ProtoReflect.Descriptor instead. -func (*SubstitutionFormatString) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_substitution_format_string_proto_rawDescGZIP(), []int{1} -} - -func (m *SubstitutionFormatString) GetFormat() isSubstitutionFormatString_Format { - if m != nil { - return m.Format - } - return nil -} - -// Deprecated: Do not use. -func (x *SubstitutionFormatString) GetTextFormat() string { - if x, ok := x.GetFormat().(*SubstitutionFormatString_TextFormat); ok { - return x.TextFormat - } - return "" -} - -func (x *SubstitutionFormatString) GetJsonFormat() *structpb.Struct { - if x, ok := x.GetFormat().(*SubstitutionFormatString_JsonFormat); ok { - return x.JsonFormat - } - return nil -} - -func (x *SubstitutionFormatString) GetTextFormatSource() *DataSource { - if x, ok := x.GetFormat().(*SubstitutionFormatString_TextFormatSource); ok { - return x.TextFormatSource - } - return nil -} - -func (x *SubstitutionFormatString) GetOmitEmptyValues() bool { - if x != nil { - return x.OmitEmptyValues - } - return false -} - -func (x *SubstitutionFormatString) GetContentType() string { - if x != nil { - return x.ContentType - } - return "" -} - -func (x *SubstitutionFormatString) GetFormatters() []*TypedExtensionConfig { - if x != nil { - return x.Formatters - } - return nil -} - -func (x *SubstitutionFormatString) GetJsonFormatOptions() *JsonFormatOptions { - if x != nil { - return x.JsonFormatOptions - } - return nil -} - -type isSubstitutionFormatString_Format interface { - isSubstitutionFormatString_Format() -} - -type SubstitutionFormatString_TextFormat struct { - // Specify a format with command operators to form a text string. - // Its details is described in :ref:`format string`. - // - // For example, setting “text_format“ like below, - // - // .. validated-code-block:: yaml - // - // :type-name: envoy.config.core.v3.SubstitutionFormatString - // - // text_format: "%LOCAL_REPLY_BODY%:%RESPONSE_CODE%:path=%REQ(:path)%\n" - // - // generates plain text similar to: - // - // .. code-block:: text - // - // upstream connect error:503:path=/foo - // - // Deprecated in favor of :ref:`text_format_source `. To migrate text format strings, use the :ref:`inline_string ` field. - // - // Deprecated: Do not use. - TextFormat string `protobuf:"bytes,1,opt,name=text_format,json=textFormat,proto3,oneof"` -} - -type SubstitutionFormatString_JsonFormat struct { - // Specify a format with command operators to form a JSON string. - // Its details is described in :ref:`format dictionary`. - // Values are rendered as strings, numbers, or boolean values as appropriate. - // Nested JSON objects may be produced by some command operators (e.g. FILTER_STATE or DYNAMIC_METADATA). - // See the documentation for a specific command operator for details. - // - // .. validated-code-block:: yaml - // - // :type-name: envoy.config.core.v3.SubstitutionFormatString - // - // json_format: - // status: "%RESPONSE_CODE%" - // message: "%LOCAL_REPLY_BODY%" - // - // The following JSON object would be created: - // - // .. code-block:: json - // - // { - // "status": 500, - // "message": "My error message" - // } - JsonFormat *structpb.Struct `protobuf:"bytes,2,opt,name=json_format,json=jsonFormat,proto3,oneof"` -} - -type SubstitutionFormatString_TextFormatSource struct { - // Specify a format with command operators to form a text string. - // Its details is described in :ref:`format string`. - // - // For example, setting “text_format“ like below, - // - // .. validated-code-block:: yaml - // - // :type-name: envoy.config.core.v3.SubstitutionFormatString - // - // text_format_source: - // inline_string: "%LOCAL_REPLY_BODY%:%RESPONSE_CODE%:path=%REQ(:path)%\n" - // - // generates plain text similar to: - // - // .. code-block:: text - // - // upstream connect error:503:path=/foo - TextFormatSource *DataSource `protobuf:"bytes,5,opt,name=text_format_source,json=textFormatSource,proto3,oneof"` -} - -func (*SubstitutionFormatString_TextFormat) isSubstitutionFormatString_Format() {} - -func (*SubstitutionFormatString_JsonFormat) isSubstitutionFormatString_Format() {} - -func (*SubstitutionFormatString_TextFormatSource) isSubstitutionFormatString_Format() {} - -var File_envoy_config_core_v3_substitution_format_string_proto protoreflect.FileDescriptor - -var file_envoy_config_core_v3_substitution_format_string_proto_rawDesc = []byte{ - 0x0a, 0x35, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x75, 0x62, 0x73, 0x74, 0x69, 0x74, 0x75, 0x74, - 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x1a, 0x1f, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, - 0x2f, 0x76, 0x33, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x24, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, - 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x23, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, - 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0x3c, 0x0a, 0x11, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x72, 0x6f, - 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x73, - 0x6f, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xf2, 0x03, - 0x0a, 0x18, 0x53, 0x75, 0x62, 0x73, 0x74, 0x69, 0x74, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, - 0x72, 0x6d, 0x61, 0x74, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x2e, 0x0a, 0x0b, 0x74, 0x65, - 0x78, 0x74, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x0b, 0x18, 0x01, 0x92, 0xc7, 0x86, 0xd8, 0x04, 0x03, 0x33, 0x2e, 0x30, 0x48, 0x00, 0x52, 0x0a, - 0x74, 0x65, 0x78, 0x74, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x44, 0x0a, 0x0b, 0x6a, 0x73, - 0x6f, 0x6e, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, - 0x10, 0x01, 0x48, 0x00, 0x52, 0x0a, 0x6a, 0x73, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, - 0x12, 0x50, 0x0a, 0x12, 0x74, 0x65, 0x78, 0x74, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x5f, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, - 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x00, - 0x52, 0x10, 0x74, 0x65, 0x78, 0x74, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x53, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x6f, 0x6d, 0x69, 0x74, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x6f, - 0x6d, 0x69, 0x74, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x2e, - 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, 0xfa, 0x42, 0x08, 0x72, 0x06, 0xc0, 0x01, 0x02, 0xc8, 0x01, - 0x00, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x4a, - 0x0a, 0x0a, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x73, 0x18, 0x06, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x45, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0a, - 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x73, 0x12, 0x57, 0x0a, 0x13, 0x6a, 0x73, - 0x6f, 0x6e, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x4a, - 0x73, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x52, 0x11, 0x6a, 0x73, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x42, 0x0d, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x03, 0xf8, - 0x42, 0x01, 0x42, 0x91, 0x01, 0x0a, 0x22, 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, - 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x42, 0x1d, 0x53, 0x75, 0x62, 0x73, 0x74, - 0x69, 0x74, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x53, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, - 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, - 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, - 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x3b, 0x63, 0x6f, 0x72, 0x65, 0x76, 0x33, 0xba, 0x80, - 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_config_core_v3_substitution_format_string_proto_rawDescOnce sync.Once - file_envoy_config_core_v3_substitution_format_string_proto_rawDescData = file_envoy_config_core_v3_substitution_format_string_proto_rawDesc -) - -func file_envoy_config_core_v3_substitution_format_string_proto_rawDescGZIP() []byte { - file_envoy_config_core_v3_substitution_format_string_proto_rawDescOnce.Do(func() { - file_envoy_config_core_v3_substitution_format_string_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_config_core_v3_substitution_format_string_proto_rawDescData) - }) - return file_envoy_config_core_v3_substitution_format_string_proto_rawDescData -} - -var file_envoy_config_core_v3_substitution_format_string_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_envoy_config_core_v3_substitution_format_string_proto_goTypes = []interface{}{ - (*JsonFormatOptions)(nil), // 0: envoy.config.core.v3.JsonFormatOptions - (*SubstitutionFormatString)(nil), // 1: envoy.config.core.v3.SubstitutionFormatString - (*structpb.Struct)(nil), // 2: google.protobuf.Struct - (*DataSource)(nil), // 3: envoy.config.core.v3.DataSource - (*TypedExtensionConfig)(nil), // 4: envoy.config.core.v3.TypedExtensionConfig -} -var file_envoy_config_core_v3_substitution_format_string_proto_depIdxs = []int32{ - 2, // 0: envoy.config.core.v3.SubstitutionFormatString.json_format:type_name -> google.protobuf.Struct - 3, // 1: envoy.config.core.v3.SubstitutionFormatString.text_format_source:type_name -> envoy.config.core.v3.DataSource - 4, // 2: envoy.config.core.v3.SubstitutionFormatString.formatters:type_name -> envoy.config.core.v3.TypedExtensionConfig - 0, // 3: envoy.config.core.v3.SubstitutionFormatString.json_format_options:type_name -> envoy.config.core.v3.JsonFormatOptions - 4, // [4:4] is the sub-list for method output_type - 4, // [4:4] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name -} - -func init() { file_envoy_config_core_v3_substitution_format_string_proto_init() } -func file_envoy_config_core_v3_substitution_format_string_proto_init() { - if File_envoy_config_core_v3_substitution_format_string_proto != nil { - return - } - file_envoy_config_core_v3_base_proto_init() - file_envoy_config_core_v3_extension_proto_init() - if !protoimpl.UnsafeEnabled { - file_envoy_config_core_v3_substitution_format_string_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*JsonFormatOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_core_v3_substitution_format_string_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SubstitutionFormatString); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_config_core_v3_substitution_format_string_proto_msgTypes[1].OneofWrappers = []interface{}{ - (*SubstitutionFormatString_TextFormat)(nil), - (*SubstitutionFormatString_JsonFormat)(nil), - (*SubstitutionFormatString_TextFormatSource)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_config_core_v3_substitution_format_string_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_config_core_v3_substitution_format_string_proto_goTypes, - DependencyIndexes: file_envoy_config_core_v3_substitution_format_string_proto_depIdxs, - MessageInfos: file_envoy_config_core_v3_substitution_format_string_proto_msgTypes, - }.Build() - File_envoy_config_core_v3_substitution_format_string_proto = out.File - file_envoy_config_core_v3_substitution_format_string_proto_rawDesc = nil - file_envoy_config_core_v3_substitution_format_string_proto_goTypes = nil - file_envoy_config_core_v3_substitution_format_string_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/substitution_format_string.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/substitution_format_string.pb.validate.go deleted file mode 100644 index c805d8286..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/substitution_format_string.pb.validate.go +++ /dev/null @@ -1,444 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/config/core/v3/substitution_format_string.proto - -package corev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on JsonFormatOptions with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *JsonFormatOptions) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on JsonFormatOptions with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// JsonFormatOptionsMultiError, or nil if none found. -func (m *JsonFormatOptions) ValidateAll() error { - return m.validate(true) -} - -func (m *JsonFormatOptions) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for SortProperties - - if len(errors) > 0 { - return JsonFormatOptionsMultiError(errors) - } - - return nil -} - -// JsonFormatOptionsMultiError is an error wrapping multiple validation errors -// returned by JsonFormatOptions.ValidateAll() if the designated constraints -// aren't met. -type JsonFormatOptionsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m JsonFormatOptionsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m JsonFormatOptionsMultiError) AllErrors() []error { return m } - -// JsonFormatOptionsValidationError is the validation error returned by -// JsonFormatOptions.Validate if the designated constraints aren't met. -type JsonFormatOptionsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e JsonFormatOptionsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e JsonFormatOptionsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e JsonFormatOptionsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e JsonFormatOptionsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e JsonFormatOptionsValidationError) ErrorName() string { - return "JsonFormatOptionsValidationError" -} - -// Error satisfies the builtin error interface -func (e JsonFormatOptionsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sJsonFormatOptions.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = JsonFormatOptionsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = JsonFormatOptionsValidationError{} - -// Validate checks the field values on SubstitutionFormatString with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *SubstitutionFormatString) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SubstitutionFormatString with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// SubstitutionFormatStringMultiError, or nil if none found. -func (m *SubstitutionFormatString) ValidateAll() error { - return m.validate(true) -} - -func (m *SubstitutionFormatString) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for OmitEmptyValues - - if !_SubstitutionFormatString_ContentType_Pattern.MatchString(m.GetContentType()) { - err := SubstitutionFormatStringValidationError{ - field: "ContentType", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetFormatters() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, SubstitutionFormatStringValidationError{ - field: fmt.Sprintf("Formatters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, SubstitutionFormatStringValidationError{ - field: fmt.Sprintf("Formatters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return SubstitutionFormatStringValidationError{ - field: fmt.Sprintf("Formatters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetJsonFormatOptions()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, SubstitutionFormatStringValidationError{ - field: "JsonFormatOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, SubstitutionFormatStringValidationError{ - field: "JsonFormatOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetJsonFormatOptions()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return SubstitutionFormatStringValidationError{ - field: "JsonFormatOptions", - reason: "embedded message failed validation", - cause: err, - } - } - } - - oneofFormatPresent := false - switch v := m.Format.(type) { - case *SubstitutionFormatString_TextFormat: - if v == nil { - err := SubstitutionFormatStringValidationError{ - field: "Format", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofFormatPresent = true - // no validation rules for TextFormat - case *SubstitutionFormatString_JsonFormat: - if v == nil { - err := SubstitutionFormatStringValidationError{ - field: "Format", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofFormatPresent = true - - if m.GetJsonFormat() == nil { - err := SubstitutionFormatStringValidationError{ - field: "JsonFormat", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetJsonFormat()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, SubstitutionFormatStringValidationError{ - field: "JsonFormat", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, SubstitutionFormatStringValidationError{ - field: "JsonFormat", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetJsonFormat()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return SubstitutionFormatStringValidationError{ - field: "JsonFormat", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *SubstitutionFormatString_TextFormatSource: - if v == nil { - err := SubstitutionFormatStringValidationError{ - field: "Format", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofFormatPresent = true - - if all { - switch v := interface{}(m.GetTextFormatSource()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, SubstitutionFormatStringValidationError{ - field: "TextFormatSource", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, SubstitutionFormatStringValidationError{ - field: "TextFormatSource", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTextFormatSource()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return SubstitutionFormatStringValidationError{ - field: "TextFormatSource", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofFormatPresent { - err := SubstitutionFormatStringValidationError{ - field: "Format", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return SubstitutionFormatStringMultiError(errors) - } - - return nil -} - -// SubstitutionFormatStringMultiError is an error wrapping multiple validation -// errors returned by SubstitutionFormatString.ValidateAll() if the designated -// constraints aren't met. -type SubstitutionFormatStringMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SubstitutionFormatStringMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m SubstitutionFormatStringMultiError) AllErrors() []error { return m } - -// SubstitutionFormatStringValidationError is the validation error returned by -// SubstitutionFormatString.Validate if the designated constraints aren't met. -type SubstitutionFormatStringValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SubstitutionFormatStringValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SubstitutionFormatStringValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SubstitutionFormatStringValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SubstitutionFormatStringValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SubstitutionFormatStringValidationError) ErrorName() string { - return "SubstitutionFormatStringValidationError" -} - -// Error satisfies the builtin error interface -func (e SubstitutionFormatStringValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSubstitutionFormatString.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SubstitutionFormatStringValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SubstitutionFormatStringValidationError{} - -var _SubstitutionFormatString_ContentType_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/udp_socket_config.pb.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/udp_socket_config.pb.go deleted file mode 100644 index c3308382a..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/udp_socket_config.pb.go +++ /dev/null @@ -1,195 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/config/core/v3/udp_socket_config.proto - -package corev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Generic UDP socket configuration. -type UdpSocketConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The maximum size of received UDP datagrams. Using a larger size will cause Envoy to allocate - // more memory per socket. Received datagrams above this size will be dropped. If not set - // defaults to 1500 bytes. - MaxRxDatagramSize *wrapperspb.UInt64Value `protobuf:"bytes,1,opt,name=max_rx_datagram_size,json=maxRxDatagramSize,proto3" json:"max_rx_datagram_size,omitempty"` - // Configures whether Generic Receive Offload (GRO) - // _ is preferred when reading from the - // UDP socket. The default is context dependent and is documented where UdpSocketConfig is used. - // This option affects performance but not functionality. If GRO is not supported by the operating - // system, non-GRO receive will be used. - PreferGro *wrapperspb.BoolValue `protobuf:"bytes,2,opt,name=prefer_gro,json=preferGro,proto3" json:"prefer_gro,omitempty"` -} - -func (x *UdpSocketConfig) Reset() { - *x = UdpSocketConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_core_v3_udp_socket_config_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UdpSocketConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UdpSocketConfig) ProtoMessage() {} - -func (x *UdpSocketConfig) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_core_v3_udp_socket_config_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UdpSocketConfig.ProtoReflect.Descriptor instead. -func (*UdpSocketConfig) Descriptor() ([]byte, []int) { - return file_envoy_config_core_v3_udp_socket_config_proto_rawDescGZIP(), []int{0} -} - -func (x *UdpSocketConfig) GetMaxRxDatagramSize() *wrapperspb.UInt64Value { - if x != nil { - return x.MaxRxDatagramSize - } - return nil -} - -func (x *UdpSocketConfig) GetPreferGro() *wrapperspb.BoolValue { - if x != nil { - return x.PreferGro - } - return nil -} - -var File_envoy_config_core_v3_udp_socket_config_proto protoreflect.FileDescriptor - -var file_envoy_config_core_v3_udp_socket_config_proto_rawDesc = []byte{ - 0x0a, 0x2c, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x75, 0x64, 0x70, 0x5f, 0x73, 0x6f, 0x63, 0x6b, 0x65, - 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x76, 0x33, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa8, 0x01, 0x0a, - 0x0f, 0x55, 0x64, 0x70, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x12, 0x5a, 0x0a, 0x14, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x78, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x67, - 0x72, 0x61, 0x6d, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x0b, 0xfa, 0x42, - 0x08, 0x32, 0x06, 0x10, 0x80, 0x80, 0x04, 0x20, 0x00, 0x52, 0x11, 0x6d, 0x61, 0x78, 0x52, 0x78, - 0x44, 0x61, 0x74, 0x61, 0x67, 0x72, 0x61, 0x6d, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x39, 0x0a, 0x0a, - 0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x5f, 0x67, 0x72, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x09, 0x70, 0x72, - 0x65, 0x66, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x42, 0x88, 0x01, 0x0a, 0x22, 0x69, 0x6f, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x42, 0x14, - 0x55, 0x64, 0x70, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, - 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, - 0x2f, 0x76, 0x33, 0x3b, 0x63, 0x6f, 0x72, 0x65, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, - 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_config_core_v3_udp_socket_config_proto_rawDescOnce sync.Once - file_envoy_config_core_v3_udp_socket_config_proto_rawDescData = file_envoy_config_core_v3_udp_socket_config_proto_rawDesc -) - -func file_envoy_config_core_v3_udp_socket_config_proto_rawDescGZIP() []byte { - file_envoy_config_core_v3_udp_socket_config_proto_rawDescOnce.Do(func() { - file_envoy_config_core_v3_udp_socket_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_config_core_v3_udp_socket_config_proto_rawDescData) - }) - return file_envoy_config_core_v3_udp_socket_config_proto_rawDescData -} - -var file_envoy_config_core_v3_udp_socket_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_config_core_v3_udp_socket_config_proto_goTypes = []interface{}{ - (*UdpSocketConfig)(nil), // 0: envoy.config.core.v3.UdpSocketConfig - (*wrapperspb.UInt64Value)(nil), // 1: google.protobuf.UInt64Value - (*wrapperspb.BoolValue)(nil), // 2: google.protobuf.BoolValue -} -var file_envoy_config_core_v3_udp_socket_config_proto_depIdxs = []int32{ - 1, // 0: envoy.config.core.v3.UdpSocketConfig.max_rx_datagram_size:type_name -> google.protobuf.UInt64Value - 2, // 1: envoy.config.core.v3.UdpSocketConfig.prefer_gro:type_name -> google.protobuf.BoolValue - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_envoy_config_core_v3_udp_socket_config_proto_init() } -func file_envoy_config_core_v3_udp_socket_config_proto_init() { - if File_envoy_config_core_v3_udp_socket_config_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_envoy_config_core_v3_udp_socket_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UdpSocketConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_config_core_v3_udp_socket_config_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_config_core_v3_udp_socket_config_proto_goTypes, - DependencyIndexes: file_envoy_config_core_v3_udp_socket_config_proto_depIdxs, - MessageInfos: file_envoy_config_core_v3_udp_socket_config_proto_msgTypes, - }.Build() - File_envoy_config_core_v3_udp_socket_config_proto = out.File - file_envoy_config_core_v3_udp_socket_config_proto_rawDesc = nil - file_envoy_config_core_v3_udp_socket_config_proto_goTypes = nil - file_envoy_config_core_v3_udp_socket_config_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/udp_socket_config.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/udp_socket_config.pb.validate.go deleted file mode 100644 index f0c17960d..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/core/v3/udp_socket_config.pb.validate.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/config/core/v3/udp_socket_config.proto - -package corev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on UdpSocketConfig with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *UdpSocketConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UdpSocketConfig with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// UdpSocketConfigMultiError, or nil if none found. -func (m *UdpSocketConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *UdpSocketConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if wrapper := m.GetMaxRxDatagramSize(); wrapper != nil { - - if val := wrapper.GetValue(); val <= 0 || val >= 65536 { - err := UdpSocketConfigValidationError{ - field: "MaxRxDatagramSize", - reason: "value must be inside range (0, 65536)", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if all { - switch v := interface{}(m.GetPreferGro()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, UdpSocketConfigValidationError{ - field: "PreferGro", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, UdpSocketConfigValidationError{ - field: "PreferGro", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPreferGro()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return UdpSocketConfigValidationError{ - field: "PreferGro", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return UdpSocketConfigMultiError(errors) - } - - return nil -} - -// UdpSocketConfigMultiError is an error wrapping multiple validation errors -// returned by UdpSocketConfig.ValidateAll() if the designated constraints -// aren't met. -type UdpSocketConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UdpSocketConfigMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m UdpSocketConfigMultiError) AllErrors() []error { return m } - -// UdpSocketConfigValidationError is the validation error returned by -// UdpSocketConfig.Validate if the designated constraints aren't met. -type UdpSocketConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UdpSocketConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UdpSocketConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UdpSocketConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UdpSocketConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UdpSocketConfigValidationError) ErrorName() string { return "UdpSocketConfigValidationError" } - -// Error satisfies the builtin error interface -func (e UdpSocketConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sUdpSocketConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UdpSocketConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UdpSocketConfigValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/route/v3/route.pb.go b/vendor/github.com/cilium/proxy/go/envoy/config/route/v3/route.pb.go deleted file mode 100644 index 89dca0ca0..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/route/v3/route.pb.go +++ /dev/null @@ -1,578 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/config/route/v3/route.proto - -package routev3 - -import ( - v3 "github.com/cilium/proxy/go/envoy/config/core/v3" - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// [#next-free-field: 18] -type RouteConfiguration struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of the route configuration. For example, it might match - // :ref:`route_config_name - // ` in - // :ref:`envoy_v3_api_msg_extensions.filters.network.http_connection_manager.v3.Rds`. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // An array of virtual hosts that make up the route table. - VirtualHosts []*VirtualHost `protobuf:"bytes,2,rep,name=virtual_hosts,json=virtualHosts,proto3" json:"virtual_hosts,omitempty"` - // An array of virtual hosts will be dynamically loaded via the VHDS API. - // Both “virtual_hosts“ and “vhds“ fields will be used when present. “virtual_hosts“ can be used - // for a base routing table or for infrequently changing virtual hosts. “vhds“ is used for - // on-demand discovery of virtual hosts. The contents of these two fields will be merged to - // generate a routing table for a given RouteConfiguration, with “vhds“ derived configuration - // taking precedence. - Vhds *Vhds `protobuf:"bytes,9,opt,name=vhds,proto3" json:"vhds,omitempty"` - // Optionally specifies a list of HTTP headers that the connection manager - // will consider to be internal only. If they are found on external requests they will be cleaned - // prior to filter invocation. See :ref:`config_http_conn_man_headers_x-envoy-internal` for more - // information. - InternalOnlyHeaders []string `protobuf:"bytes,3,rep,name=internal_only_headers,json=internalOnlyHeaders,proto3" json:"internal_only_headers,omitempty"` - // Specifies a list of HTTP headers that should be added to each response that - // the connection manager encodes. Headers specified at this level are applied - // after headers from any enclosed :ref:`envoy_v3_api_msg_config.route.v3.VirtualHost` or - // :ref:`envoy_v3_api_msg_config.route.v3.RouteAction`. For more information, including details on - // header value syntax, see the documentation on :ref:`custom request headers - // `. - ResponseHeadersToAdd []*v3.HeaderValueOption `protobuf:"bytes,4,rep,name=response_headers_to_add,json=responseHeadersToAdd,proto3" json:"response_headers_to_add,omitempty"` - // Specifies a list of HTTP headers that should be removed from each response - // that the connection manager encodes. - ResponseHeadersToRemove []string `protobuf:"bytes,5,rep,name=response_headers_to_remove,json=responseHeadersToRemove,proto3" json:"response_headers_to_remove,omitempty"` - // Specifies a list of HTTP headers that should be added to each request - // routed by the HTTP connection manager. Headers specified at this level are - // applied after headers from any enclosed :ref:`envoy_v3_api_msg_config.route.v3.VirtualHost` or - // :ref:`envoy_v3_api_msg_config.route.v3.RouteAction`. For more information, including details on - // header value syntax, see the documentation on :ref:`custom request headers - // `. - RequestHeadersToAdd []*v3.HeaderValueOption `protobuf:"bytes,6,rep,name=request_headers_to_add,json=requestHeadersToAdd,proto3" json:"request_headers_to_add,omitempty"` - // Specifies a list of HTTP headers that should be removed from each request - // routed by the HTTP connection manager. - RequestHeadersToRemove []string `protobuf:"bytes,8,rep,name=request_headers_to_remove,json=requestHeadersToRemove,proto3" json:"request_headers_to_remove,omitempty"` - // Headers mutations at all levels are evaluated, if specified. By default, the order is from most - // specific (i.e. route entry level) to least specific (i.e. route configuration level). Later header - // mutations may override earlier mutations. - // This order can be reversed by setting this field to true. In other words, most specific level mutation - // is evaluated last. - MostSpecificHeaderMutationsWins bool `protobuf:"varint,10,opt,name=most_specific_header_mutations_wins,json=mostSpecificHeaderMutationsWins,proto3" json:"most_specific_header_mutations_wins,omitempty"` - // An optional boolean that specifies whether the clusters that the route - // table refers to will be validated by the cluster manager. If set to true - // and a route refers to a non-existent cluster, the route table will not - // load. If set to false and a route refers to a non-existent cluster, the - // route table will load and the router filter will return a 404 if the route - // is selected at runtime. This setting defaults to true if the route table - // is statically defined via the :ref:`route_config - // ` - // option. This setting default to false if the route table is loaded dynamically via the - // :ref:`rds - // ` - // option. Users may wish to override the default behavior in certain cases (for example when - // using CDS with a static route table). - ValidateClusters *wrapperspb.BoolValue `protobuf:"bytes,7,opt,name=validate_clusters,json=validateClusters,proto3" json:"validate_clusters,omitempty"` - // The maximum bytes of the response :ref:`direct response body - // ` size. If not specified the default - // is 4096. - // - // .. warning:: - // - // Envoy currently holds the content of :ref:`direct response body - // ` in memory. Be careful setting - // this to be larger than the default 4KB, since the allocated memory for direct response body - // is not subject to data plane buffering controls. - MaxDirectResponseBodySizeBytes *wrapperspb.UInt32Value `protobuf:"bytes,11,opt,name=max_direct_response_body_size_bytes,json=maxDirectResponseBodySizeBytes,proto3" json:"max_direct_response_body_size_bytes,omitempty"` - // A list of plugins and their configurations which may be used by a - // :ref:`cluster specifier plugin name ` - // within the route. All “extension.name“ fields in this list must be unique. - ClusterSpecifierPlugins []*ClusterSpecifierPlugin `protobuf:"bytes,12,rep,name=cluster_specifier_plugins,json=clusterSpecifierPlugins,proto3" json:"cluster_specifier_plugins,omitempty"` - // Specify a set of default request mirroring policies which apply to all routes under its virtual hosts. - // Note that policies are not merged, the most specific non-empty one becomes the mirror policies. - RequestMirrorPolicies []*RouteAction_RequestMirrorPolicy `protobuf:"bytes,13,rep,name=request_mirror_policies,json=requestMirrorPolicies,proto3" json:"request_mirror_policies,omitempty"` - // By default, port in :authority header (if any) is used in host matching. - // With this option enabled, Envoy will ignore the port number in the :authority header (if any) when picking VirtualHost. - // NOTE: this option will not strip the port number (if any) contained in route config - // :ref:`envoy_v3_api_msg_config.route.v3.VirtualHost`.domains field. - IgnorePortInHostMatching bool `protobuf:"varint,14,opt,name=ignore_port_in_host_matching,json=ignorePortInHostMatching,proto3" json:"ignore_port_in_host_matching,omitempty"` - // Ignore path-parameters in path-matching. - // Before RFC3986, URI were like(RFC1808): :///;?# - // Envoy by default takes ":path" as ";". - // For users who want to only match path on the "" portion, this option should be true. - IgnorePathParametersInPathMatching bool `protobuf:"varint,15,opt,name=ignore_path_parameters_in_path_matching,json=ignorePathParametersInPathMatching,proto3" json:"ignore_path_parameters_in_path_matching,omitempty"` - // This field can be used to provide RouteConfiguration level per filter config. The key should match the - // :ref:`filter config name - // `. - // See :ref:`Http filter route specific config ` - // for details. - // [#comment: An entry's value may be wrapped in a - // :ref:`FilterConfig` - // message to specify additional options.] - TypedPerFilterConfig map[string]*anypb.Any `protobuf:"bytes,16,rep,name=typed_per_filter_config,json=typedPerFilterConfig,proto3" json:"typed_per_filter_config,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // The metadata field can be used to provide additional information - // about the route configuration. It can be used for configuration, stats, and logging. - // The metadata should go under the filter namespace that will need it. - // For instance, if the metadata is intended for the Router filter, - // the filter name should be specified as “envoy.filters.http.router“. - Metadata *v3.Metadata `protobuf:"bytes,17,opt,name=metadata,proto3" json:"metadata,omitempty"` -} - -func (x *RouteConfiguration) Reset() { - *x = RouteConfiguration{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RouteConfiguration) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RouteConfiguration) ProtoMessage() {} - -func (x *RouteConfiguration) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RouteConfiguration.ProtoReflect.Descriptor instead. -func (*RouteConfiguration) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_proto_rawDescGZIP(), []int{0} -} - -func (x *RouteConfiguration) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *RouteConfiguration) GetVirtualHosts() []*VirtualHost { - if x != nil { - return x.VirtualHosts - } - return nil -} - -func (x *RouteConfiguration) GetVhds() *Vhds { - if x != nil { - return x.Vhds - } - return nil -} - -func (x *RouteConfiguration) GetInternalOnlyHeaders() []string { - if x != nil { - return x.InternalOnlyHeaders - } - return nil -} - -func (x *RouteConfiguration) GetResponseHeadersToAdd() []*v3.HeaderValueOption { - if x != nil { - return x.ResponseHeadersToAdd - } - return nil -} - -func (x *RouteConfiguration) GetResponseHeadersToRemove() []string { - if x != nil { - return x.ResponseHeadersToRemove - } - return nil -} - -func (x *RouteConfiguration) GetRequestHeadersToAdd() []*v3.HeaderValueOption { - if x != nil { - return x.RequestHeadersToAdd - } - return nil -} - -func (x *RouteConfiguration) GetRequestHeadersToRemove() []string { - if x != nil { - return x.RequestHeadersToRemove - } - return nil -} - -func (x *RouteConfiguration) GetMostSpecificHeaderMutationsWins() bool { - if x != nil { - return x.MostSpecificHeaderMutationsWins - } - return false -} - -func (x *RouteConfiguration) GetValidateClusters() *wrapperspb.BoolValue { - if x != nil { - return x.ValidateClusters - } - return nil -} - -func (x *RouteConfiguration) GetMaxDirectResponseBodySizeBytes() *wrapperspb.UInt32Value { - if x != nil { - return x.MaxDirectResponseBodySizeBytes - } - return nil -} - -func (x *RouteConfiguration) GetClusterSpecifierPlugins() []*ClusterSpecifierPlugin { - if x != nil { - return x.ClusterSpecifierPlugins - } - return nil -} - -func (x *RouteConfiguration) GetRequestMirrorPolicies() []*RouteAction_RequestMirrorPolicy { - if x != nil { - return x.RequestMirrorPolicies - } - return nil -} - -func (x *RouteConfiguration) GetIgnorePortInHostMatching() bool { - if x != nil { - return x.IgnorePortInHostMatching - } - return false -} - -func (x *RouteConfiguration) GetIgnorePathParametersInPathMatching() bool { - if x != nil { - return x.IgnorePathParametersInPathMatching - } - return false -} - -func (x *RouteConfiguration) GetTypedPerFilterConfig() map[string]*anypb.Any { - if x != nil { - return x.TypedPerFilterConfig - } - return nil -} - -func (x *RouteConfiguration) GetMetadata() *v3.Metadata { - if x != nil { - return x.Metadata - } - return nil -} - -type Vhds struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Configuration source specifier for VHDS. - ConfigSource *v3.ConfigSource `protobuf:"bytes,1,opt,name=config_source,json=configSource,proto3" json:"config_source,omitempty"` -} - -func (x *Vhds) Reset() { - *x = Vhds{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Vhds) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Vhds) ProtoMessage() {} - -func (x *Vhds) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Vhds.ProtoReflect.Descriptor instead. -func (*Vhds) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_proto_rawDescGZIP(), []int{1} -} - -func (x *Vhds) GetConfigSource() *v3.ConfigSource { - if x != nil { - return x.ConfigSource - } - return nil -} - -var File_envoy_config_route_v3_route_proto protoreflect.FileDescriptor - -var file_envoy_config_route_v3_route_proto_rawDesc = []byte{ - 0x0a, 0x21, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x72, - 0x6f, 0x75, 0x74, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x1a, 0x1f, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, - 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x28, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, - 0x33, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2c, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x72, 0x6f, 0x75, - 0x74, 0x65, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, - 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, - 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x75, - 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x89, 0x0c, 0x0a, 0x12, 0x52, 0x6f, - 0x75, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x47, 0x0a, 0x0d, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x5f, - 0x68, 0x6f, 0x73, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, - 0x2e, 0x76, 0x33, 0x2e, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x48, 0x6f, 0x73, 0x74, 0x52, - 0x0c, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x12, 0x2f, 0x0a, - 0x04, 0x76, 0x68, 0x64, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, - 0x2e, 0x76, 0x33, 0x2e, 0x56, 0x68, 0x64, 0x73, 0x52, 0x04, 0x76, 0x68, 0x64, 0x73, 0x12, 0x44, - 0x0a, 0x15, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x5f, - 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x42, 0x10, 0xfa, - 0x42, 0x0d, 0x92, 0x01, 0x0a, 0x22, 0x08, 0x72, 0x06, 0xc0, 0x01, 0x01, 0xc8, 0x01, 0x00, 0x52, - 0x13, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4f, 0x6e, 0x6c, 0x79, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x73, 0x12, 0x69, 0x0a, 0x17, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x18, - 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x09, - 0xfa, 0x42, 0x06, 0x92, 0x01, 0x03, 0x10, 0xe8, 0x07, 0x52, 0x14, 0x72, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x54, 0x6f, 0x41, 0x64, 0x64, 0x12, - 0x4d, 0x0a, 0x1a, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x68, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x18, 0x05, 0x20, - 0x03, 0x28, 0x09, 0x42, 0x10, 0xfa, 0x42, 0x0d, 0x92, 0x01, 0x0a, 0x22, 0x08, 0x72, 0x06, 0xc0, - 0x01, 0x01, 0xc8, 0x01, 0x00, 0x52, 0x17, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x54, 0x6f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x12, 0x67, - 0x0a, 0x16, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, - 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x09, 0xfa, 0x42, 0x06, 0x92, 0x01, 0x03, 0x10, - 0xe8, 0x07, 0x52, 0x13, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x73, 0x54, 0x6f, 0x41, 0x64, 0x64, 0x12, 0x4b, 0x0a, 0x19, 0x72, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x72, 0x65, - 0x6d, 0x6f, 0x76, 0x65, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09, 0x42, 0x10, 0xfa, 0x42, 0x0d, 0x92, - 0x01, 0x0a, 0x22, 0x08, 0x72, 0x06, 0xc0, 0x01, 0x01, 0xc8, 0x01, 0x00, 0x52, 0x16, 0x72, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x54, 0x6f, 0x52, 0x65, - 0x6d, 0x6f, 0x76, 0x65, 0x12, 0x4c, 0x0a, 0x23, 0x6d, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x70, 0x65, - 0x63, 0x69, 0x66, 0x69, 0x63, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x6d, 0x75, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5f, 0x77, 0x69, 0x6e, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x1f, 0x6d, 0x6f, 0x73, 0x74, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x48, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x57, 0x69, - 0x6e, 0x73, 0x12, 0x47, 0x0a, 0x11, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x63, - 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x12, 0x69, 0x0a, 0x23, 0x6d, - 0x61, 0x78, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x62, 0x79, 0x74, - 0x65, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, - 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x1e, 0x6d, 0x61, 0x78, 0x44, 0x69, 0x72, 0x65, 0x63, - 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x53, 0x69, 0x7a, - 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x69, 0x0a, 0x19, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, - 0x72, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f, 0x70, 0x6c, 0x75, 0x67, - 0x69, 0x6e, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, - 0x33, 0x2e, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x65, 0x72, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x17, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, - 0x72, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, - 0x73, 0x12, 0x6e, 0x0a, 0x17, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x6d, 0x69, 0x72, - 0x72, 0x6f, 0x72, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, 0x0d, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, - 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x69, - 0x72, 0x72, 0x6f, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x15, 0x72, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x4d, 0x69, 0x72, 0x72, 0x6f, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, - 0x73, 0x12, 0x3e, 0x0a, 0x1c, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x70, 0x6f, 0x72, 0x74, - 0x5f, 0x69, 0x6e, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x69, 0x6e, - 0x67, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x18, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x50, - 0x6f, 0x72, 0x74, 0x49, 0x6e, 0x48, 0x6f, 0x73, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x69, 0x6e, - 0x67, 0x12, 0x53, 0x0a, 0x27, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, - 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x5f, 0x69, 0x6e, 0x5f, 0x70, - 0x61, 0x74, 0x68, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x18, 0x0f, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x22, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x50, 0x61, 0x74, 0x68, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x49, 0x6e, 0x50, 0x61, 0x74, 0x68, 0x4d, 0x61, - 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x12, 0x7a, 0x0a, 0x17, 0x74, 0x79, 0x70, 0x65, 0x64, 0x5f, - 0x70, 0x65, 0x72, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x43, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, - 0x52, 0x6f, 0x75, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x50, 0x65, 0x72, 0x46, 0x69, 0x6c, 0x74, 0x65, - 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x14, 0x74, 0x79, - 0x70, 0x65, 0x64, 0x50, 0x65, 0x72, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x12, 0x3a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x11, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x5d, - 0x0a, 0x19, 0x54, 0x79, 0x70, 0x65, 0x64, 0x50, 0x65, 0x72, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2a, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, - 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x3a, 0x26, 0x9a, - 0xc5, 0x88, 0x1e, 0x21, 0x0a, 0x1f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x73, 0x0a, 0x04, 0x56, 0x68, 0x64, 0x73, 0x12, 0x51, 0x0a, - 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, - 0x10, 0x01, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x3a, 0x18, 0x9a, 0xc5, 0x88, 0x1e, 0x13, 0x0a, 0x11, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x56, 0x68, 0x64, 0x73, 0x42, 0x81, 0x01, 0x0a, 0x23, 0x69, - 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, - 0x76, 0x33, 0x42, 0x0a, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2f, 0x76, 0x33, 0x3b, 0x72, - 0x6f, 0x75, 0x74, 0x65, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_config_route_v3_route_proto_rawDescOnce sync.Once - file_envoy_config_route_v3_route_proto_rawDescData = file_envoy_config_route_v3_route_proto_rawDesc -) - -func file_envoy_config_route_v3_route_proto_rawDescGZIP() []byte { - file_envoy_config_route_v3_route_proto_rawDescOnce.Do(func() { - file_envoy_config_route_v3_route_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_config_route_v3_route_proto_rawDescData) - }) - return file_envoy_config_route_v3_route_proto_rawDescData -} - -var file_envoy_config_route_v3_route_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_envoy_config_route_v3_route_proto_goTypes = []interface{}{ - (*RouteConfiguration)(nil), // 0: envoy.config.route.v3.RouteConfiguration - (*Vhds)(nil), // 1: envoy.config.route.v3.Vhds - nil, // 2: envoy.config.route.v3.RouteConfiguration.TypedPerFilterConfigEntry - (*VirtualHost)(nil), // 3: envoy.config.route.v3.VirtualHost - (*v3.HeaderValueOption)(nil), // 4: envoy.config.core.v3.HeaderValueOption - (*wrapperspb.BoolValue)(nil), // 5: google.protobuf.BoolValue - (*wrapperspb.UInt32Value)(nil), // 6: google.protobuf.UInt32Value - (*ClusterSpecifierPlugin)(nil), // 7: envoy.config.route.v3.ClusterSpecifierPlugin - (*RouteAction_RequestMirrorPolicy)(nil), // 8: envoy.config.route.v3.RouteAction.RequestMirrorPolicy - (*v3.Metadata)(nil), // 9: envoy.config.core.v3.Metadata - (*v3.ConfigSource)(nil), // 10: envoy.config.core.v3.ConfigSource - (*anypb.Any)(nil), // 11: google.protobuf.Any -} -var file_envoy_config_route_v3_route_proto_depIdxs = []int32{ - 3, // 0: envoy.config.route.v3.RouteConfiguration.virtual_hosts:type_name -> envoy.config.route.v3.VirtualHost - 1, // 1: envoy.config.route.v3.RouteConfiguration.vhds:type_name -> envoy.config.route.v3.Vhds - 4, // 2: envoy.config.route.v3.RouteConfiguration.response_headers_to_add:type_name -> envoy.config.core.v3.HeaderValueOption - 4, // 3: envoy.config.route.v3.RouteConfiguration.request_headers_to_add:type_name -> envoy.config.core.v3.HeaderValueOption - 5, // 4: envoy.config.route.v3.RouteConfiguration.validate_clusters:type_name -> google.protobuf.BoolValue - 6, // 5: envoy.config.route.v3.RouteConfiguration.max_direct_response_body_size_bytes:type_name -> google.protobuf.UInt32Value - 7, // 6: envoy.config.route.v3.RouteConfiguration.cluster_specifier_plugins:type_name -> envoy.config.route.v3.ClusterSpecifierPlugin - 8, // 7: envoy.config.route.v3.RouteConfiguration.request_mirror_policies:type_name -> envoy.config.route.v3.RouteAction.RequestMirrorPolicy - 2, // 8: envoy.config.route.v3.RouteConfiguration.typed_per_filter_config:type_name -> envoy.config.route.v3.RouteConfiguration.TypedPerFilterConfigEntry - 9, // 9: envoy.config.route.v3.RouteConfiguration.metadata:type_name -> envoy.config.core.v3.Metadata - 10, // 10: envoy.config.route.v3.Vhds.config_source:type_name -> envoy.config.core.v3.ConfigSource - 11, // 11: envoy.config.route.v3.RouteConfiguration.TypedPerFilterConfigEntry.value:type_name -> google.protobuf.Any - 12, // [12:12] is the sub-list for method output_type - 12, // [12:12] is the sub-list for method input_type - 12, // [12:12] is the sub-list for extension type_name - 12, // [12:12] is the sub-list for extension extendee - 0, // [0:12] is the sub-list for field type_name -} - -func init() { file_envoy_config_route_v3_route_proto_init() } -func file_envoy_config_route_v3_route_proto_init() { - if File_envoy_config_route_v3_route_proto != nil { - return - } - file_envoy_config_route_v3_route_components_proto_init() - if !protoimpl.UnsafeEnabled { - file_envoy_config_route_v3_route_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RouteConfiguration); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Vhds); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_config_route_v3_route_proto_rawDesc, - NumEnums: 0, - NumMessages: 3, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_config_route_v3_route_proto_goTypes, - DependencyIndexes: file_envoy_config_route_v3_route_proto_depIdxs, - MessageInfos: file_envoy_config_route_v3_route_proto_msgTypes, - }.Build() - File_envoy_config_route_v3_route_proto = out.File - file_envoy_config_route_v3_route_proto_rawDesc = nil - file_envoy_config_route_v3_route_proto_goTypes = nil - file_envoy_config_route_v3_route_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/route/v3/route.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/config/route/v3/route.pb.validate.go deleted file mode 100644 index 78991464d..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/route/v3/route.pb.validate.go +++ /dev/null @@ -1,692 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/config/route/v3/route.proto - -package routev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on RouteConfiguration with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RouteConfiguration) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RouteConfiguration with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RouteConfigurationMultiError, or nil if none found. -func (m *RouteConfiguration) ValidateAll() error { - return m.validate(true) -} - -func (m *RouteConfiguration) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Name - - for idx, item := range m.GetVirtualHosts() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteConfigurationValidationError{ - field: fmt.Sprintf("VirtualHosts[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteConfigurationValidationError{ - field: fmt.Sprintf("VirtualHosts[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteConfigurationValidationError{ - field: fmt.Sprintf("VirtualHosts[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetVhds()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteConfigurationValidationError{ - field: "Vhds", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteConfigurationValidationError{ - field: "Vhds", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetVhds()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteConfigurationValidationError{ - field: "Vhds", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetInternalOnlyHeaders() { - _, _ = idx, item - - if !_RouteConfiguration_InternalOnlyHeaders_Pattern.MatchString(item) { - err := RouteConfigurationValidationError{ - field: fmt.Sprintf("InternalOnlyHeaders[%v]", idx), - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if len(m.GetResponseHeadersToAdd()) > 1000 { - err := RouteConfigurationValidationError{ - field: "ResponseHeadersToAdd", - reason: "value must contain no more than 1000 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetResponseHeadersToAdd() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteConfigurationValidationError{ - field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteConfigurationValidationError{ - field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteConfigurationValidationError{ - field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetResponseHeadersToRemove() { - _, _ = idx, item - - if !_RouteConfiguration_ResponseHeadersToRemove_Pattern.MatchString(item) { - err := RouteConfigurationValidationError{ - field: fmt.Sprintf("ResponseHeadersToRemove[%v]", idx), - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if len(m.GetRequestHeadersToAdd()) > 1000 { - err := RouteConfigurationValidationError{ - field: "RequestHeadersToAdd", - reason: "value must contain no more than 1000 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetRequestHeadersToAdd() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteConfigurationValidationError{ - field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteConfigurationValidationError{ - field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteConfigurationValidationError{ - field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetRequestHeadersToRemove() { - _, _ = idx, item - - if !_RouteConfiguration_RequestHeadersToRemove_Pattern.MatchString(item) { - err := RouteConfigurationValidationError{ - field: fmt.Sprintf("RequestHeadersToRemove[%v]", idx), - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - // no validation rules for MostSpecificHeaderMutationsWins - - if all { - switch v := interface{}(m.GetValidateClusters()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteConfigurationValidationError{ - field: "ValidateClusters", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteConfigurationValidationError{ - field: "ValidateClusters", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetValidateClusters()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteConfigurationValidationError{ - field: "ValidateClusters", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetMaxDirectResponseBodySizeBytes()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteConfigurationValidationError{ - field: "MaxDirectResponseBodySizeBytes", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteConfigurationValidationError{ - field: "MaxDirectResponseBodySizeBytes", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMaxDirectResponseBodySizeBytes()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteConfigurationValidationError{ - field: "MaxDirectResponseBodySizeBytes", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetClusterSpecifierPlugins() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteConfigurationValidationError{ - field: fmt.Sprintf("ClusterSpecifierPlugins[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteConfigurationValidationError{ - field: fmt.Sprintf("ClusterSpecifierPlugins[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteConfigurationValidationError{ - field: fmt.Sprintf("ClusterSpecifierPlugins[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetRequestMirrorPolicies() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteConfigurationValidationError{ - field: fmt.Sprintf("RequestMirrorPolicies[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteConfigurationValidationError{ - field: fmt.Sprintf("RequestMirrorPolicies[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteConfigurationValidationError{ - field: fmt.Sprintf("RequestMirrorPolicies[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - // no validation rules for IgnorePortInHostMatching - - // no validation rules for IgnorePathParametersInPathMatching - - { - sorted_keys := make([]string, len(m.GetTypedPerFilterConfig())) - i := 0 - for key := range m.GetTypedPerFilterConfig() { - sorted_keys[i] = key - i++ - } - sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] }) - for _, key := range sorted_keys { - val := m.GetTypedPerFilterConfig()[key] - _ = val - - // no validation rules for TypedPerFilterConfig[key] - - if all { - switch v := interface{}(val).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteConfigurationValidationError{ - field: fmt.Sprintf("TypedPerFilterConfig[%v]", key), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteConfigurationValidationError{ - field: fmt.Sprintf("TypedPerFilterConfig[%v]", key), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(val).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteConfigurationValidationError{ - field: fmt.Sprintf("TypedPerFilterConfig[%v]", key), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - } - - if all { - switch v := interface{}(m.GetMetadata()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteConfigurationValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteConfigurationValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteConfigurationValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return RouteConfigurationMultiError(errors) - } - - return nil -} - -// RouteConfigurationMultiError is an error wrapping multiple validation errors -// returned by RouteConfiguration.ValidateAll() if the designated constraints -// aren't met. -type RouteConfigurationMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RouteConfigurationMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RouteConfigurationMultiError) AllErrors() []error { return m } - -// RouteConfigurationValidationError is the validation error returned by -// RouteConfiguration.Validate if the designated constraints aren't met. -type RouteConfigurationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RouteConfigurationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RouteConfigurationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RouteConfigurationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RouteConfigurationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RouteConfigurationValidationError) ErrorName() string { - return "RouteConfigurationValidationError" -} - -// Error satisfies the builtin error interface -func (e RouteConfigurationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRouteConfiguration.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RouteConfigurationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RouteConfigurationValidationError{} - -var _RouteConfiguration_InternalOnlyHeaders_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -var _RouteConfiguration_ResponseHeadersToRemove_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -var _RouteConfiguration_RequestHeadersToRemove_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -// Validate checks the field values on Vhds with the rules defined in the proto -// definition for this message. If any rules are violated, the first error -// encountered is returned, or nil if there are no violations. -func (m *Vhds) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Vhds with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in VhdsMultiError, or nil if none found. -func (m *Vhds) ValidateAll() error { - return m.validate(true) -} - -func (m *Vhds) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetConfigSource() == nil { - err := VhdsValidationError{ - field: "ConfigSource", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetConfigSource()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, VhdsValidationError{ - field: "ConfigSource", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, VhdsValidationError{ - field: "ConfigSource", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetConfigSource()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return VhdsValidationError{ - field: "ConfigSource", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return VhdsMultiError(errors) - } - - return nil -} - -// VhdsMultiError is an error wrapping multiple validation errors returned by -// Vhds.ValidateAll() if the designated constraints aren't met. -type VhdsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m VhdsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m VhdsMultiError) AllErrors() []error { return m } - -// VhdsValidationError is the validation error returned by Vhds.Validate if the -// designated constraints aren't met. -type VhdsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e VhdsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e VhdsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e VhdsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e VhdsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e VhdsValidationError) ErrorName() string { return "VhdsValidationError" } - -// Error satisfies the builtin error interface -func (e VhdsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sVhds.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = VhdsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = VhdsValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/route/v3/route_components.pb.go b/vendor/github.com/cilium/proxy/go/envoy/config/route/v3/route_components.pb.go deleted file mode 100644 index 9f485094a..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/route/v3/route_components.pb.go +++ /dev/null @@ -1,9052 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/config/route/v3/route_components.proto - -package routev3 - -import ( - _ "github.com/cilium/proxy/go/envoy/annotations" - v31 "github.com/cilium/proxy/go/envoy/config/core/v3" - v32 "github.com/cilium/proxy/go/envoy/type/matcher/v3" - v35 "github.com/cilium/proxy/go/envoy/type/metadata/v3" - v34 "github.com/cilium/proxy/go/envoy/type/tracing/v3" - v33 "github.com/cilium/proxy/go/envoy/type/v3" - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/cncf/xds/go/xds/annotations/v3" - v3 "github.com/cncf/xds/go/xds/type/matcher/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - durationpb "google.golang.org/protobuf/types/known/durationpb" - wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -type VirtualHost_TlsRequirementType int32 - -const ( - // No TLS requirement for the virtual host. - VirtualHost_NONE VirtualHost_TlsRequirementType = 0 - // External requests must use TLS. If a request is external and it is not - // using TLS, a 301 redirect will be sent telling the client to use HTTPS. - VirtualHost_EXTERNAL_ONLY VirtualHost_TlsRequirementType = 1 - // All requests must use TLS. If a request is not using TLS, a 301 redirect - // will be sent telling the client to use HTTPS. - VirtualHost_ALL VirtualHost_TlsRequirementType = 2 -) - -// Enum value maps for VirtualHost_TlsRequirementType. -var ( - VirtualHost_TlsRequirementType_name = map[int32]string{ - 0: "NONE", - 1: "EXTERNAL_ONLY", - 2: "ALL", - } - VirtualHost_TlsRequirementType_value = map[string]int32{ - "NONE": 0, - "EXTERNAL_ONLY": 1, - "ALL": 2, - } -) - -func (x VirtualHost_TlsRequirementType) Enum() *VirtualHost_TlsRequirementType { - p := new(VirtualHost_TlsRequirementType) - *p = x - return p -} - -func (x VirtualHost_TlsRequirementType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (VirtualHost_TlsRequirementType) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_config_route_v3_route_components_proto_enumTypes[0].Descriptor() -} - -func (VirtualHost_TlsRequirementType) Type() protoreflect.EnumType { - return &file_envoy_config_route_v3_route_components_proto_enumTypes[0] -} - -func (x VirtualHost_TlsRequirementType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use VirtualHost_TlsRequirementType.Descriptor instead. -func (VirtualHost_TlsRequirementType) EnumDescriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{0, 0} -} - -type RouteAction_ClusterNotFoundResponseCode int32 - -const ( - // HTTP status code - 503 Service Unavailable. - RouteAction_SERVICE_UNAVAILABLE RouteAction_ClusterNotFoundResponseCode = 0 - // HTTP status code - 404 Not Found. - RouteAction_NOT_FOUND RouteAction_ClusterNotFoundResponseCode = 1 - // HTTP status code - 500 Internal Server Error. - RouteAction_INTERNAL_SERVER_ERROR RouteAction_ClusterNotFoundResponseCode = 2 -) - -// Enum value maps for RouteAction_ClusterNotFoundResponseCode. -var ( - RouteAction_ClusterNotFoundResponseCode_name = map[int32]string{ - 0: "SERVICE_UNAVAILABLE", - 1: "NOT_FOUND", - 2: "INTERNAL_SERVER_ERROR", - } - RouteAction_ClusterNotFoundResponseCode_value = map[string]int32{ - "SERVICE_UNAVAILABLE": 0, - "NOT_FOUND": 1, - "INTERNAL_SERVER_ERROR": 2, - } -) - -func (x RouteAction_ClusterNotFoundResponseCode) Enum() *RouteAction_ClusterNotFoundResponseCode { - p := new(RouteAction_ClusterNotFoundResponseCode) - *p = x - return p -} - -func (x RouteAction_ClusterNotFoundResponseCode) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (RouteAction_ClusterNotFoundResponseCode) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_config_route_v3_route_components_proto_enumTypes[1].Descriptor() -} - -func (RouteAction_ClusterNotFoundResponseCode) Type() protoreflect.EnumType { - return &file_envoy_config_route_v3_route_components_proto_enumTypes[1] -} - -func (x RouteAction_ClusterNotFoundResponseCode) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use RouteAction_ClusterNotFoundResponseCode.Descriptor instead. -func (RouteAction_ClusterNotFoundResponseCode) EnumDescriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{8, 0} -} - -// Configures :ref:`internal redirect ` behavior. -// [#next-major-version: remove this definition - it's defined in the InternalRedirectPolicy message.] -// -// Deprecated: Do not use. -type RouteAction_InternalRedirectAction int32 - -const ( - RouteAction_PASS_THROUGH_INTERNAL_REDIRECT RouteAction_InternalRedirectAction = 0 - RouteAction_HANDLE_INTERNAL_REDIRECT RouteAction_InternalRedirectAction = 1 -) - -// Enum value maps for RouteAction_InternalRedirectAction. -var ( - RouteAction_InternalRedirectAction_name = map[int32]string{ - 0: "PASS_THROUGH_INTERNAL_REDIRECT", - 1: "HANDLE_INTERNAL_REDIRECT", - } - RouteAction_InternalRedirectAction_value = map[string]int32{ - "PASS_THROUGH_INTERNAL_REDIRECT": 0, - "HANDLE_INTERNAL_REDIRECT": 1, - } -) - -func (x RouteAction_InternalRedirectAction) Enum() *RouteAction_InternalRedirectAction { - p := new(RouteAction_InternalRedirectAction) - *p = x - return p -} - -func (x RouteAction_InternalRedirectAction) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (RouteAction_InternalRedirectAction) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_config_route_v3_route_components_proto_enumTypes[2].Descriptor() -} - -func (RouteAction_InternalRedirectAction) Type() protoreflect.EnumType { - return &file_envoy_config_route_v3_route_components_proto_enumTypes[2] -} - -func (x RouteAction_InternalRedirectAction) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use RouteAction_InternalRedirectAction.Descriptor instead. -func (RouteAction_InternalRedirectAction) EnumDescriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{8, 1} -} - -type RetryPolicy_ResetHeaderFormat int32 - -const ( - RetryPolicy_SECONDS RetryPolicy_ResetHeaderFormat = 0 - RetryPolicy_UNIX_TIMESTAMP RetryPolicy_ResetHeaderFormat = 1 -) - -// Enum value maps for RetryPolicy_ResetHeaderFormat. -var ( - RetryPolicy_ResetHeaderFormat_name = map[int32]string{ - 0: "SECONDS", - 1: "UNIX_TIMESTAMP", - } - RetryPolicy_ResetHeaderFormat_value = map[string]int32{ - "SECONDS": 0, - "UNIX_TIMESTAMP": 1, - } -) - -func (x RetryPolicy_ResetHeaderFormat) Enum() *RetryPolicy_ResetHeaderFormat { - p := new(RetryPolicy_ResetHeaderFormat) - *p = x - return p -} - -func (x RetryPolicy_ResetHeaderFormat) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (RetryPolicy_ResetHeaderFormat) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_config_route_v3_route_components_proto_enumTypes[3].Descriptor() -} - -func (RetryPolicy_ResetHeaderFormat) Type() protoreflect.EnumType { - return &file_envoy_config_route_v3_route_components_proto_enumTypes[3] -} - -func (x RetryPolicy_ResetHeaderFormat) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use RetryPolicy_ResetHeaderFormat.Descriptor instead. -func (RetryPolicy_ResetHeaderFormat) EnumDescriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{9, 0} -} - -type RedirectAction_RedirectResponseCode int32 - -const ( - // Moved Permanently HTTP Status Code - 301. - RedirectAction_MOVED_PERMANENTLY RedirectAction_RedirectResponseCode = 0 - // Found HTTP Status Code - 302. - RedirectAction_FOUND RedirectAction_RedirectResponseCode = 1 - // See Other HTTP Status Code - 303. - RedirectAction_SEE_OTHER RedirectAction_RedirectResponseCode = 2 - // Temporary Redirect HTTP Status Code - 307. - RedirectAction_TEMPORARY_REDIRECT RedirectAction_RedirectResponseCode = 3 - // Permanent Redirect HTTP Status Code - 308. - RedirectAction_PERMANENT_REDIRECT RedirectAction_RedirectResponseCode = 4 -) - -// Enum value maps for RedirectAction_RedirectResponseCode. -var ( - RedirectAction_RedirectResponseCode_name = map[int32]string{ - 0: "MOVED_PERMANENTLY", - 1: "FOUND", - 2: "SEE_OTHER", - 3: "TEMPORARY_REDIRECT", - 4: "PERMANENT_REDIRECT", - } - RedirectAction_RedirectResponseCode_value = map[string]int32{ - "MOVED_PERMANENTLY": 0, - "FOUND": 1, - "SEE_OTHER": 2, - "TEMPORARY_REDIRECT": 3, - "PERMANENT_REDIRECT": 4, - } -) - -func (x RedirectAction_RedirectResponseCode) Enum() *RedirectAction_RedirectResponseCode { - p := new(RedirectAction_RedirectResponseCode) - *p = x - return p -} - -func (x RedirectAction_RedirectResponseCode) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (RedirectAction_RedirectResponseCode) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_config_route_v3_route_components_proto_enumTypes[4].Descriptor() -} - -func (RedirectAction_RedirectResponseCode) Type() protoreflect.EnumType { - return &file_envoy_config_route_v3_route_components_proto_enumTypes[4] -} - -func (x RedirectAction_RedirectResponseCode) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use RedirectAction_RedirectResponseCode.Descriptor instead. -func (RedirectAction_RedirectResponseCode) EnumDescriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{11, 0} -} - -type RateLimit_Action_MetaData_Source int32 - -const ( - // Query :ref:`dynamic metadata ` - RateLimit_Action_MetaData_DYNAMIC RateLimit_Action_MetaData_Source = 0 - // Query :ref:`route entry metadata ` - RateLimit_Action_MetaData_ROUTE_ENTRY RateLimit_Action_MetaData_Source = 1 -) - -// Enum value maps for RateLimit_Action_MetaData_Source. -var ( - RateLimit_Action_MetaData_Source_name = map[int32]string{ - 0: "DYNAMIC", - 1: "ROUTE_ENTRY", - } - RateLimit_Action_MetaData_Source_value = map[string]int32{ - "DYNAMIC": 0, - "ROUTE_ENTRY": 1, - } -) - -func (x RateLimit_Action_MetaData_Source) Enum() *RateLimit_Action_MetaData_Source { - p := new(RateLimit_Action_MetaData_Source) - *p = x - return p -} - -func (x RateLimit_Action_MetaData_Source) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (RateLimit_Action_MetaData_Source) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_config_route_v3_route_components_proto_enumTypes[5].Descriptor() -} - -func (RateLimit_Action_MetaData_Source) Type() protoreflect.EnumType { - return &file_envoy_config_route_v3_route_components_proto_enumTypes[5] -} - -func (x RateLimit_Action_MetaData_Source) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use RateLimit_Action_MetaData_Source.Descriptor instead. -func (RateLimit_Action_MetaData_Source) EnumDescriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{17, 0, 8, 0} -} - -// The top level element in the routing configuration is a virtual host. Each virtual host has -// a logical name as well as a set of domains that get routed to it based on the incoming request's -// host header. This allows a single listener to service multiple top level domain path trees. Once -// a virtual host is selected based on the domain, the routes are processed in order to see which -// upstream cluster to route to or whether to perform a redirect. -// [#next-free-field: 25] -type VirtualHost struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The logical name of the virtual host. This is used when emitting certain - // statistics but is not relevant for routing. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // A list of domains (host/authority header) that will be matched to this - // virtual host. Wildcard hosts are supported in the suffix or prefix form. - // - // Domain search order: - // 1. Exact domain names: “www.foo.com“. - // 2. Suffix domain wildcards: “*.foo.com“ or “*-bar.foo.com“. - // 3. Prefix domain wildcards: “foo.*“ or “foo-*“. - // 4. Special wildcard “*“ matching any domain. - // - // .. note:: - // - // The wildcard will not match the empty string. - // e.g. ``*-bar.foo.com`` will match ``baz-bar.foo.com`` but not ``-bar.foo.com``. - // The longest wildcards match first. - // Only a single virtual host in the entire route configuration can match on ``*``. A domain - // must be unique across all virtual hosts or the config will fail to load. - // - // Domains cannot contain control characters. This is validated by the well_known_regex HTTP_HEADER_VALUE. - Domains []string `protobuf:"bytes,2,rep,name=domains,proto3" json:"domains,omitempty"` - // The list of routes that will be matched, in order, for incoming requests. - // The first route that matches will be used. - // Only one of this and “matcher“ can be specified. - Routes []*Route `protobuf:"bytes,3,rep,name=routes,proto3" json:"routes,omitempty"` - // [#next-major-version: This should be included in a oneof with routes wrapped in a message.] - // The match tree to use when resolving route actions for incoming requests. Only one of this and “routes“ - // can be specified. - Matcher *v3.Matcher `protobuf:"bytes,21,opt,name=matcher,proto3" json:"matcher,omitempty"` - // Specifies the type of TLS enforcement the virtual host expects. If this option is not - // specified, there is no TLS requirement for the virtual host. - RequireTls VirtualHost_TlsRequirementType `protobuf:"varint,4,opt,name=require_tls,json=requireTls,proto3,enum=envoy.config.route.v3.VirtualHost_TlsRequirementType" json:"require_tls,omitempty"` - // A list of virtual clusters defined for this virtual host. Virtual clusters - // are used for additional statistics gathering. - VirtualClusters []*VirtualCluster `protobuf:"bytes,5,rep,name=virtual_clusters,json=virtualClusters,proto3" json:"virtual_clusters,omitempty"` - // Specifies a set of rate limit configurations that will be applied to the - // virtual host. - RateLimits []*RateLimit `protobuf:"bytes,6,rep,name=rate_limits,json=rateLimits,proto3" json:"rate_limits,omitempty"` - // Specifies a list of HTTP headers that should be added to each request - // handled by this virtual host. Headers specified at this level are applied - // after headers from enclosed :ref:`envoy_v3_api_msg_config.route.v3.Route` and before headers from the - // enclosing :ref:`envoy_v3_api_msg_config.route.v3.RouteConfiguration`. For more information, including - // details on header value syntax, see the documentation on :ref:`custom request headers - // `. - RequestHeadersToAdd []*v31.HeaderValueOption `protobuf:"bytes,7,rep,name=request_headers_to_add,json=requestHeadersToAdd,proto3" json:"request_headers_to_add,omitempty"` - // Specifies a list of HTTP headers that should be removed from each request - // handled by this virtual host. - RequestHeadersToRemove []string `protobuf:"bytes,13,rep,name=request_headers_to_remove,json=requestHeadersToRemove,proto3" json:"request_headers_to_remove,omitempty"` - // Specifies a list of HTTP headers that should be added to each response - // handled by this virtual host. Headers specified at this level are applied - // after headers from enclosed :ref:`envoy_v3_api_msg_config.route.v3.Route` and before headers from the - // enclosing :ref:`envoy_v3_api_msg_config.route.v3.RouteConfiguration`. For more information, including - // details on header value syntax, see the documentation on :ref:`custom request headers - // `. - ResponseHeadersToAdd []*v31.HeaderValueOption `protobuf:"bytes,10,rep,name=response_headers_to_add,json=responseHeadersToAdd,proto3" json:"response_headers_to_add,omitempty"` - // Specifies a list of HTTP headers that should be removed from each response - // handled by this virtual host. - ResponseHeadersToRemove []string `protobuf:"bytes,11,rep,name=response_headers_to_remove,json=responseHeadersToRemove,proto3" json:"response_headers_to_remove,omitempty"` - // Indicates that the virtual host has a CORS policy. This field is ignored if related cors policy is - // found in the - // :ref:`VirtualHost.typed_per_filter_config`. - // - // .. attention:: - // - // This option has been deprecated. Please use - // :ref:`VirtualHost.typed_per_filter_config` - // to configure the CORS HTTP filter. - // - // Deprecated: Do not use. - Cors *CorsPolicy `protobuf:"bytes,8,opt,name=cors,proto3" json:"cors,omitempty"` - // This field can be used to provide virtual host level per filter config. The key should match the - // :ref:`filter config name - // `. - // See :ref:`Http filter route specific config ` - // for details. - // [#comment: An entry's value may be wrapped in a - // :ref:`FilterConfig` - // message to specify additional options.] - TypedPerFilterConfig map[string]*anypb.Any `protobuf:"bytes,15,rep,name=typed_per_filter_config,json=typedPerFilterConfig,proto3" json:"typed_per_filter_config,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // Decides whether the :ref:`x-envoy-attempt-count - // ` header should be included - // in the upstream request. Setting this option will cause it to override any existing header - // value, so in the case of two Envoys on the request path with this option enabled, the upstream - // will see the attempt count as perceived by the second Envoy. Defaults to false. - // This header is unaffected by the - // :ref:`suppress_envoy_headers - // ` flag. - // - // [#next-major-version: rename to include_attempt_count_in_request.] - IncludeRequestAttemptCount bool `protobuf:"varint,14,opt,name=include_request_attempt_count,json=includeRequestAttemptCount,proto3" json:"include_request_attempt_count,omitempty"` - // Decides whether the :ref:`x-envoy-attempt-count - // ` header should be included - // in the downstream response. Setting this option will cause the router to override any existing header - // value, so in the case of two Envoys on the request path with this option enabled, the downstream - // will see the attempt count as perceived by the Envoy closest upstream from itself. Defaults to false. - // This header is unaffected by the - // :ref:`suppress_envoy_headers - // ` flag. - IncludeAttemptCountInResponse bool `protobuf:"varint,19,opt,name=include_attempt_count_in_response,json=includeAttemptCountInResponse,proto3" json:"include_attempt_count_in_response,omitempty"` - // Indicates the retry policy for all routes in this virtual host. Note that setting a - // route level entry will take precedence over this config and it'll be treated - // independently (e.g.: values are not inherited). - RetryPolicy *RetryPolicy `protobuf:"bytes,16,opt,name=retry_policy,json=retryPolicy,proto3" json:"retry_policy,omitempty"` - // [#not-implemented-hide:] - // Specifies the configuration for retry policy extension. Note that setting a route level entry - // will take precedence over this config and it'll be treated independently (e.g.: values are not - // inherited). :ref:`Retry policy ` should not be - // set if this field is used. - RetryPolicyTypedConfig *anypb.Any `protobuf:"bytes,20,opt,name=retry_policy_typed_config,json=retryPolicyTypedConfig,proto3" json:"retry_policy_typed_config,omitempty"` - // Indicates the hedge policy for all routes in this virtual host. Note that setting a - // route level entry will take precedence over this config and it'll be treated - // independently (e.g.: values are not inherited). - HedgePolicy *HedgePolicy `protobuf:"bytes,17,opt,name=hedge_policy,json=hedgePolicy,proto3" json:"hedge_policy,omitempty"` - // Decides whether to include the :ref:`x-envoy-is-timeout-retry ` - // request header in retries initiated by per try timeouts. - IncludeIsTimeoutRetryHeader bool `protobuf:"varint,23,opt,name=include_is_timeout_retry_header,json=includeIsTimeoutRetryHeader,proto3" json:"include_is_timeout_retry_header,omitempty"` - // The maximum bytes which will be buffered for retries and shadowing. - // If set and a route-specific limit is not set, the bytes actually buffered will be the minimum - // value of this and the listener per_connection_buffer_limit_bytes. - PerRequestBufferLimitBytes *wrapperspb.UInt32Value `protobuf:"bytes,18,opt,name=per_request_buffer_limit_bytes,json=perRequestBufferLimitBytes,proto3" json:"per_request_buffer_limit_bytes,omitempty"` - // Specify a set of default request mirroring policies for every route under this virtual host. - // It takes precedence over the route config mirror policy entirely. - // That is, policies are not merged, the most specific non-empty one becomes the mirror policies. - RequestMirrorPolicies []*RouteAction_RequestMirrorPolicy `protobuf:"bytes,22,rep,name=request_mirror_policies,json=requestMirrorPolicies,proto3" json:"request_mirror_policies,omitempty"` - // The metadata field can be used to provide additional information - // about the virtual host. It can be used for configuration, stats, and logging. - // The metadata should go under the filter namespace that will need it. - // For instance, if the metadata is intended for the Router filter, - // the filter name should be specified as “envoy.filters.http.router“. - Metadata *v31.Metadata `protobuf:"bytes,24,opt,name=metadata,proto3" json:"metadata,omitempty"` -} - -func (x *VirtualHost) Reset() { - *x = VirtualHost{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *VirtualHost) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*VirtualHost) ProtoMessage() {} - -func (x *VirtualHost) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use VirtualHost.ProtoReflect.Descriptor instead. -func (*VirtualHost) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{0} -} - -func (x *VirtualHost) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *VirtualHost) GetDomains() []string { - if x != nil { - return x.Domains - } - return nil -} - -func (x *VirtualHost) GetRoutes() []*Route { - if x != nil { - return x.Routes - } - return nil -} - -func (x *VirtualHost) GetMatcher() *v3.Matcher { - if x != nil { - return x.Matcher - } - return nil -} - -func (x *VirtualHost) GetRequireTls() VirtualHost_TlsRequirementType { - if x != nil { - return x.RequireTls - } - return VirtualHost_NONE -} - -func (x *VirtualHost) GetVirtualClusters() []*VirtualCluster { - if x != nil { - return x.VirtualClusters - } - return nil -} - -func (x *VirtualHost) GetRateLimits() []*RateLimit { - if x != nil { - return x.RateLimits - } - return nil -} - -func (x *VirtualHost) GetRequestHeadersToAdd() []*v31.HeaderValueOption { - if x != nil { - return x.RequestHeadersToAdd - } - return nil -} - -func (x *VirtualHost) GetRequestHeadersToRemove() []string { - if x != nil { - return x.RequestHeadersToRemove - } - return nil -} - -func (x *VirtualHost) GetResponseHeadersToAdd() []*v31.HeaderValueOption { - if x != nil { - return x.ResponseHeadersToAdd - } - return nil -} - -func (x *VirtualHost) GetResponseHeadersToRemove() []string { - if x != nil { - return x.ResponseHeadersToRemove - } - return nil -} - -// Deprecated: Do not use. -func (x *VirtualHost) GetCors() *CorsPolicy { - if x != nil { - return x.Cors - } - return nil -} - -func (x *VirtualHost) GetTypedPerFilterConfig() map[string]*anypb.Any { - if x != nil { - return x.TypedPerFilterConfig - } - return nil -} - -func (x *VirtualHost) GetIncludeRequestAttemptCount() bool { - if x != nil { - return x.IncludeRequestAttemptCount - } - return false -} - -func (x *VirtualHost) GetIncludeAttemptCountInResponse() bool { - if x != nil { - return x.IncludeAttemptCountInResponse - } - return false -} - -func (x *VirtualHost) GetRetryPolicy() *RetryPolicy { - if x != nil { - return x.RetryPolicy - } - return nil -} - -func (x *VirtualHost) GetRetryPolicyTypedConfig() *anypb.Any { - if x != nil { - return x.RetryPolicyTypedConfig - } - return nil -} - -func (x *VirtualHost) GetHedgePolicy() *HedgePolicy { - if x != nil { - return x.HedgePolicy - } - return nil -} - -func (x *VirtualHost) GetIncludeIsTimeoutRetryHeader() bool { - if x != nil { - return x.IncludeIsTimeoutRetryHeader - } - return false -} - -func (x *VirtualHost) GetPerRequestBufferLimitBytes() *wrapperspb.UInt32Value { - if x != nil { - return x.PerRequestBufferLimitBytes - } - return nil -} - -func (x *VirtualHost) GetRequestMirrorPolicies() []*RouteAction_RequestMirrorPolicy { - if x != nil { - return x.RequestMirrorPolicies - } - return nil -} - -func (x *VirtualHost) GetMetadata() *v31.Metadata { - if x != nil { - return x.Metadata - } - return nil -} - -// A filter-defined action type. -type FilterAction struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Action *anypb.Any `protobuf:"bytes,1,opt,name=action,proto3" json:"action,omitempty"` -} - -func (x *FilterAction) Reset() { - *x = FilterAction{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FilterAction) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FilterAction) ProtoMessage() {} - -func (x *FilterAction) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FilterAction.ProtoReflect.Descriptor instead. -func (*FilterAction) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{1} -} - -func (x *FilterAction) GetAction() *anypb.Any { - if x != nil { - return x.Action - } - return nil -} - -// This can be used in route matcher :ref:`VirtualHost.matcher `. -// When the matcher matches, routes will be matched and run. -type RouteList struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The list of routes that will be matched and run, in order. The first route that matches will be used. - Routes []*Route `protobuf:"bytes,1,rep,name=routes,proto3" json:"routes,omitempty"` -} - -func (x *RouteList) Reset() { - *x = RouteList{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RouteList) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RouteList) ProtoMessage() {} - -func (x *RouteList) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RouteList.ProtoReflect.Descriptor instead. -func (*RouteList) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{2} -} - -func (x *RouteList) GetRoutes() []*Route { - if x != nil { - return x.Routes - } - return nil -} - -// A route is both a specification of how to match a request as well as an indication of what to do -// next (e.g., redirect, forward, rewrite, etc.). -// -// .. attention:: -// -// Envoy supports routing on HTTP method via :ref:`header matching -// `. -// -// [#next-free-field: 20] -type Route struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Name for the route. - Name string `protobuf:"bytes,14,opt,name=name,proto3" json:"name,omitempty"` - // Route matching parameters. - Match *RouteMatch `protobuf:"bytes,1,opt,name=match,proto3" json:"match,omitempty"` - // Types that are assignable to Action: - // - // *Route_Route - // *Route_Redirect - // *Route_DirectResponse - // *Route_FilterAction - // *Route_NonForwardingAction - Action isRoute_Action `protobuf_oneof:"action"` - // The Metadata field can be used to provide additional information - // about the route. It can be used for configuration, stats, and logging. - // The metadata should go under the filter namespace that will need it. - // For instance, if the metadata is intended for the Router filter, - // the filter name should be specified as “envoy.filters.http.router“. - Metadata *v31.Metadata `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"` - // Decorator for the matched route. - Decorator *Decorator `protobuf:"bytes,5,opt,name=decorator,proto3" json:"decorator,omitempty"` - // This field can be used to provide route specific per filter config. The key should match the - // :ref:`filter config name - // `. - // See :ref:`Http filter route specific config ` - // for details. - // [#comment: An entry's value may be wrapped in a - // :ref:`FilterConfig` - // message to specify additional options.] - TypedPerFilterConfig map[string]*anypb.Any `protobuf:"bytes,13,rep,name=typed_per_filter_config,json=typedPerFilterConfig,proto3" json:"typed_per_filter_config,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // Specifies a set of headers that will be added to requests matching this - // route. Headers specified at this level are applied before headers from the - // enclosing :ref:`envoy_v3_api_msg_config.route.v3.VirtualHost` and - // :ref:`envoy_v3_api_msg_config.route.v3.RouteConfiguration`. For more information, including details on - // header value syntax, see the documentation on :ref:`custom request headers - // `. - RequestHeadersToAdd []*v31.HeaderValueOption `protobuf:"bytes,9,rep,name=request_headers_to_add,json=requestHeadersToAdd,proto3" json:"request_headers_to_add,omitempty"` - // Specifies a list of HTTP headers that should be removed from each request - // matching this route. - RequestHeadersToRemove []string `protobuf:"bytes,12,rep,name=request_headers_to_remove,json=requestHeadersToRemove,proto3" json:"request_headers_to_remove,omitempty"` - // Specifies a set of headers that will be added to responses to requests - // matching this route. Headers specified at this level are applied before - // headers from the enclosing :ref:`envoy_v3_api_msg_config.route.v3.VirtualHost` and - // :ref:`envoy_v3_api_msg_config.route.v3.RouteConfiguration`. For more information, including - // details on header value syntax, see the documentation on - // :ref:`custom request headers `. - ResponseHeadersToAdd []*v31.HeaderValueOption `protobuf:"bytes,10,rep,name=response_headers_to_add,json=responseHeadersToAdd,proto3" json:"response_headers_to_add,omitempty"` - // Specifies a list of HTTP headers that should be removed from each response - // to requests matching this route. - ResponseHeadersToRemove []string `protobuf:"bytes,11,rep,name=response_headers_to_remove,json=responseHeadersToRemove,proto3" json:"response_headers_to_remove,omitempty"` - // Presence of the object defines whether the connection manager's tracing configuration - // is overridden by this route specific instance. - Tracing *Tracing `protobuf:"bytes,15,opt,name=tracing,proto3" json:"tracing,omitempty"` - // The maximum bytes which will be buffered for retries and shadowing. - // If set, the bytes actually buffered will be the minimum value of this and the - // listener per_connection_buffer_limit_bytes. - PerRequestBufferLimitBytes *wrapperspb.UInt32Value `protobuf:"bytes,16,opt,name=per_request_buffer_limit_bytes,json=perRequestBufferLimitBytes,proto3" json:"per_request_buffer_limit_bytes,omitempty"` - // The human readable prefix to use when emitting statistics for this endpoint. - // The statistics are rooted at vhost..route.. - // This should be set for highly critical - // endpoints that one wishes to get “per-route” statistics on. - // If not set, endpoint statistics are not generated. - // - // The emitted statistics are the same as those documented for :ref:`virtual clusters `. - // - // .. warning:: - // - // We do not recommend setting up a stat prefix for - // every application endpoint. This is both not easily maintainable and - // statistics use a non-trivial amount of memory(approximately 1KiB per route). - StatPrefix string `protobuf:"bytes,19,opt,name=stat_prefix,json=statPrefix,proto3" json:"stat_prefix,omitempty"` -} - -func (x *Route) Reset() { - *x = Route{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Route) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Route) ProtoMessage() {} - -func (x *Route) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Route.ProtoReflect.Descriptor instead. -func (*Route) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{3} -} - -func (x *Route) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Route) GetMatch() *RouteMatch { - if x != nil { - return x.Match - } - return nil -} - -func (m *Route) GetAction() isRoute_Action { - if m != nil { - return m.Action - } - return nil -} - -func (x *Route) GetRoute() *RouteAction { - if x, ok := x.GetAction().(*Route_Route); ok { - return x.Route - } - return nil -} - -func (x *Route) GetRedirect() *RedirectAction { - if x, ok := x.GetAction().(*Route_Redirect); ok { - return x.Redirect - } - return nil -} - -func (x *Route) GetDirectResponse() *DirectResponseAction { - if x, ok := x.GetAction().(*Route_DirectResponse); ok { - return x.DirectResponse - } - return nil -} - -func (x *Route) GetFilterAction() *FilterAction { - if x, ok := x.GetAction().(*Route_FilterAction); ok { - return x.FilterAction - } - return nil -} - -func (x *Route) GetNonForwardingAction() *NonForwardingAction { - if x, ok := x.GetAction().(*Route_NonForwardingAction); ok { - return x.NonForwardingAction - } - return nil -} - -func (x *Route) GetMetadata() *v31.Metadata { - if x != nil { - return x.Metadata - } - return nil -} - -func (x *Route) GetDecorator() *Decorator { - if x != nil { - return x.Decorator - } - return nil -} - -func (x *Route) GetTypedPerFilterConfig() map[string]*anypb.Any { - if x != nil { - return x.TypedPerFilterConfig - } - return nil -} - -func (x *Route) GetRequestHeadersToAdd() []*v31.HeaderValueOption { - if x != nil { - return x.RequestHeadersToAdd - } - return nil -} - -func (x *Route) GetRequestHeadersToRemove() []string { - if x != nil { - return x.RequestHeadersToRemove - } - return nil -} - -func (x *Route) GetResponseHeadersToAdd() []*v31.HeaderValueOption { - if x != nil { - return x.ResponseHeadersToAdd - } - return nil -} - -func (x *Route) GetResponseHeadersToRemove() []string { - if x != nil { - return x.ResponseHeadersToRemove - } - return nil -} - -func (x *Route) GetTracing() *Tracing { - if x != nil { - return x.Tracing - } - return nil -} - -func (x *Route) GetPerRequestBufferLimitBytes() *wrapperspb.UInt32Value { - if x != nil { - return x.PerRequestBufferLimitBytes - } - return nil -} - -func (x *Route) GetStatPrefix() string { - if x != nil { - return x.StatPrefix - } - return "" -} - -type isRoute_Action interface { - isRoute_Action() -} - -type Route_Route struct { - // Route request to some upstream cluster. - Route *RouteAction `protobuf:"bytes,2,opt,name=route,proto3,oneof"` -} - -type Route_Redirect struct { - // Return a redirect. - Redirect *RedirectAction `protobuf:"bytes,3,opt,name=redirect,proto3,oneof"` -} - -type Route_DirectResponse struct { - // Return an arbitrary HTTP response directly, without proxying. - DirectResponse *DirectResponseAction `protobuf:"bytes,7,opt,name=direct_response,json=directResponse,proto3,oneof"` -} - -type Route_FilterAction struct { - // [#not-implemented-hide:] - // A filter-defined action (e.g., it could dynamically generate the RouteAction). - // [#comment: TODO(samflattery): Remove cleanup in route_fuzz_test.cc when - // implemented] - FilterAction *FilterAction `protobuf:"bytes,17,opt,name=filter_action,json=filterAction,proto3,oneof"` -} - -type Route_NonForwardingAction struct { - // [#not-implemented-hide:] - // An action used when the route will generate a response directly, - // without forwarding to an upstream host. This will be used in non-proxy - // xDS clients like the gRPC server. It could also be used in the future - // in Envoy for a filter that directly generates responses for requests. - NonForwardingAction *NonForwardingAction `protobuf:"bytes,18,opt,name=non_forwarding_action,json=nonForwardingAction,proto3,oneof"` -} - -func (*Route_Route) isRoute_Action() {} - -func (*Route_Redirect) isRoute_Action() {} - -func (*Route_DirectResponse) isRoute_Action() {} - -func (*Route_FilterAction) isRoute_Action() {} - -func (*Route_NonForwardingAction) isRoute_Action() {} - -// Compared to the :ref:`cluster ` field that specifies a -// single upstream cluster as the target of a request, the :ref:`weighted_clusters -// ` option allows for specification of -// multiple upstream clusters along with weights that indicate the percentage of -// traffic to be forwarded to each cluster. The router selects an upstream cluster based on the -// weights. -type WeightedCluster struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Specifies one or more upstream clusters associated with the route. - Clusters []*WeightedCluster_ClusterWeight `protobuf:"bytes,1,rep,name=clusters,proto3" json:"clusters,omitempty"` - // Specifies the total weight across all clusters. The sum of all cluster weights must equal this - // value, if this is greater than 0. - // This field is now deprecated, and the client will use the sum of all - // cluster weights. It is up to the management server to supply the correct weights. - // - // Deprecated: Do not use. - TotalWeight *wrapperspb.UInt32Value `protobuf:"bytes,3,opt,name=total_weight,json=totalWeight,proto3" json:"total_weight,omitempty"` - // Specifies the runtime key prefix that should be used to construct the - // runtime keys associated with each cluster. When the “runtime_key_prefix“ is - // specified, the router will look for weights associated with each upstream - // cluster under the key “runtime_key_prefix“ + “.“ + “cluster[i].name“ where - // “cluster[i]“ denotes an entry in the clusters array field. If the runtime - // key for the cluster does not exist, the value specified in the - // configuration file will be used as the default weight. See the :ref:`runtime documentation - // ` for how key names map to the underlying implementation. - RuntimeKeyPrefix string `protobuf:"bytes,2,opt,name=runtime_key_prefix,json=runtimeKeyPrefix,proto3" json:"runtime_key_prefix,omitempty"` - // Types that are assignable to RandomValueSpecifier: - // - // *WeightedCluster_HeaderName - RandomValueSpecifier isWeightedCluster_RandomValueSpecifier `protobuf_oneof:"random_value_specifier"` -} - -func (x *WeightedCluster) Reset() { - *x = WeightedCluster{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WeightedCluster) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WeightedCluster) ProtoMessage() {} - -func (x *WeightedCluster) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WeightedCluster.ProtoReflect.Descriptor instead. -func (*WeightedCluster) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{4} -} - -func (x *WeightedCluster) GetClusters() []*WeightedCluster_ClusterWeight { - if x != nil { - return x.Clusters - } - return nil -} - -// Deprecated: Do not use. -func (x *WeightedCluster) GetTotalWeight() *wrapperspb.UInt32Value { - if x != nil { - return x.TotalWeight - } - return nil -} - -func (x *WeightedCluster) GetRuntimeKeyPrefix() string { - if x != nil { - return x.RuntimeKeyPrefix - } - return "" -} - -func (m *WeightedCluster) GetRandomValueSpecifier() isWeightedCluster_RandomValueSpecifier { - if m != nil { - return m.RandomValueSpecifier - } - return nil -} - -func (x *WeightedCluster) GetHeaderName() string { - if x, ok := x.GetRandomValueSpecifier().(*WeightedCluster_HeaderName); ok { - return x.HeaderName - } - return "" -} - -type isWeightedCluster_RandomValueSpecifier interface { - isWeightedCluster_RandomValueSpecifier() -} - -type WeightedCluster_HeaderName struct { - // Specifies the header name that is used to look up the random value passed in the request header. - // This is used to ensure consistent cluster picking across multiple proxy levels for weighted traffic. - // If header is not present or invalid, Envoy will fall back to use the internally generated random value. - // This header is expected to be single-valued header as we only want to have one selected value throughout - // the process for the consistency. And the value is a unsigned number between 0 and UINT64_MAX. - HeaderName string `protobuf:"bytes,4,opt,name=header_name,json=headerName,proto3,oneof"` -} - -func (*WeightedCluster_HeaderName) isWeightedCluster_RandomValueSpecifier() {} - -// Configuration for a cluster specifier plugin. -type ClusterSpecifierPlugin struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of the plugin and its opaque configuration. - Extension *v31.TypedExtensionConfig `protobuf:"bytes,1,opt,name=extension,proto3" json:"extension,omitempty"` - // If is_optional is not set or is set to false and the plugin defined by this message is not a - // supported type, the containing resource is NACKed. If is_optional is set to true, the resource - // would not be NACKed for this reason. In this case, routes referencing this plugin's name would - // not be treated as an illegal configuration, but would result in a failure if the route is - // selected. - IsOptional bool `protobuf:"varint,2,opt,name=is_optional,json=isOptional,proto3" json:"is_optional,omitempty"` -} - -func (x *ClusterSpecifierPlugin) Reset() { - *x = ClusterSpecifierPlugin{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClusterSpecifierPlugin) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClusterSpecifierPlugin) ProtoMessage() {} - -func (x *ClusterSpecifierPlugin) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClusterSpecifierPlugin.ProtoReflect.Descriptor instead. -func (*ClusterSpecifierPlugin) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{5} -} - -func (x *ClusterSpecifierPlugin) GetExtension() *v31.TypedExtensionConfig { - if x != nil { - return x.Extension - } - return nil -} - -func (x *ClusterSpecifierPlugin) GetIsOptional() bool { - if x != nil { - return x.IsOptional - } - return false -} - -// [#next-free-field: 16] -type RouteMatch struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to PathSpecifier: - // - // *RouteMatch_Prefix - // *RouteMatch_Path - // *RouteMatch_SafeRegex - // *RouteMatch_ConnectMatcher_ - // *RouteMatch_PathSeparatedPrefix - // *RouteMatch_PathMatchPolicy - PathSpecifier isRouteMatch_PathSpecifier `protobuf_oneof:"path_specifier"` - // Indicates that prefix/path matching should be case sensitive. The default - // is true. Ignored for safe_regex matching. - CaseSensitive *wrapperspb.BoolValue `protobuf:"bytes,4,opt,name=case_sensitive,json=caseSensitive,proto3" json:"case_sensitive,omitempty"` - // Indicates that the route should additionally match on a runtime key. Every time the route - // is considered for a match, it must also fall under the percentage of matches indicated by - // this field. For some fraction N/D, a random number in the range [0,D) is selected. If the - // number is <= the value of the numerator N, or if the key is not present, the default - // value, the router continues to evaluate the remaining match criteria. A runtime_fraction - // route configuration can be used to roll out route changes in a gradual manner without full - // code/config deploys. Refer to the :ref:`traffic shifting - // ` docs for additional documentation. - // - // .. note:: - // - // Parsing this field is implemented such that the runtime key's data may be represented - // as a FractionalPercent proto represented as JSON/YAML and may also be represented as an - // integer with the assumption that the value is an integral percentage out of 100. For - // instance, a runtime key lookup returning the value "42" would parse as a FractionalPercent - // whose numerator is 42 and denominator is HUNDRED. This preserves legacy semantics. - RuntimeFraction *v31.RuntimeFractionalPercent `protobuf:"bytes,9,opt,name=runtime_fraction,json=runtimeFraction,proto3" json:"runtime_fraction,omitempty"` - // Specifies a set of headers that the route should match on. The router will - // check the request’s headers against all the specified headers in the route - // config. A match will happen if all the headers in the route are present in - // the request with the same values (or based on presence if the value field - // is not in the config). - Headers []*HeaderMatcher `protobuf:"bytes,6,rep,name=headers,proto3" json:"headers,omitempty"` - // Specifies a set of URL query parameters on which the route should - // match. The router will check the query string from the “path“ header - // against all the specified query parameters. If the number of specified - // query parameters is nonzero, they all must match the “path“ header's - // query string for a match to occur. In the event query parameters are - // repeated, only the first value for each key will be considered. - // - // .. note:: - // - // If query parameters are used to pass request message fields when - // `grpc_json_transcoder `_ - // is used, the transcoded message fields maybe different. The query parameters are - // url encoded, but the message fields are not. For example, if a query - // parameter is "foo%20bar", the message field will be "foo bar". - QueryParameters []*QueryParameterMatcher `protobuf:"bytes,7,rep,name=query_parameters,json=queryParameters,proto3" json:"query_parameters,omitempty"` - // If specified, only gRPC requests will be matched. The router will check - // that the content-type header has a application/grpc or one of the various - // application/grpc+ values. - Grpc *RouteMatch_GrpcRouteMatchOptions `protobuf:"bytes,8,opt,name=grpc,proto3" json:"grpc,omitempty"` - // If specified, the client tls context will be matched against the defined - // match options. - // - // [#next-major-version: unify with RBAC] - TlsContext *RouteMatch_TlsContextMatchOptions `protobuf:"bytes,11,opt,name=tls_context,json=tlsContext,proto3" json:"tls_context,omitempty"` - // Specifies a set of dynamic metadata matchers on which the route should match. - // The router will check the dynamic metadata against all the specified dynamic metadata matchers. - // If the number of specified dynamic metadata matchers is nonzero, they all must match the - // dynamic metadata for a match to occur. - DynamicMetadata []*v32.MetadataMatcher `protobuf:"bytes,13,rep,name=dynamic_metadata,json=dynamicMetadata,proto3" json:"dynamic_metadata,omitempty"` -} - -func (x *RouteMatch) Reset() { - *x = RouteMatch{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RouteMatch) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RouteMatch) ProtoMessage() {} - -func (x *RouteMatch) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RouteMatch.ProtoReflect.Descriptor instead. -func (*RouteMatch) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{6} -} - -func (m *RouteMatch) GetPathSpecifier() isRouteMatch_PathSpecifier { - if m != nil { - return m.PathSpecifier - } - return nil -} - -func (x *RouteMatch) GetPrefix() string { - if x, ok := x.GetPathSpecifier().(*RouteMatch_Prefix); ok { - return x.Prefix - } - return "" -} - -func (x *RouteMatch) GetPath() string { - if x, ok := x.GetPathSpecifier().(*RouteMatch_Path); ok { - return x.Path - } - return "" -} - -func (x *RouteMatch) GetSafeRegex() *v32.RegexMatcher { - if x, ok := x.GetPathSpecifier().(*RouteMatch_SafeRegex); ok { - return x.SafeRegex - } - return nil -} - -func (x *RouteMatch) GetConnectMatcher() *RouteMatch_ConnectMatcher { - if x, ok := x.GetPathSpecifier().(*RouteMatch_ConnectMatcher_); ok { - return x.ConnectMatcher - } - return nil -} - -func (x *RouteMatch) GetPathSeparatedPrefix() string { - if x, ok := x.GetPathSpecifier().(*RouteMatch_PathSeparatedPrefix); ok { - return x.PathSeparatedPrefix - } - return "" -} - -func (x *RouteMatch) GetPathMatchPolicy() *v31.TypedExtensionConfig { - if x, ok := x.GetPathSpecifier().(*RouteMatch_PathMatchPolicy); ok { - return x.PathMatchPolicy - } - return nil -} - -func (x *RouteMatch) GetCaseSensitive() *wrapperspb.BoolValue { - if x != nil { - return x.CaseSensitive - } - return nil -} - -func (x *RouteMatch) GetRuntimeFraction() *v31.RuntimeFractionalPercent { - if x != nil { - return x.RuntimeFraction - } - return nil -} - -func (x *RouteMatch) GetHeaders() []*HeaderMatcher { - if x != nil { - return x.Headers - } - return nil -} - -func (x *RouteMatch) GetQueryParameters() []*QueryParameterMatcher { - if x != nil { - return x.QueryParameters - } - return nil -} - -func (x *RouteMatch) GetGrpc() *RouteMatch_GrpcRouteMatchOptions { - if x != nil { - return x.Grpc - } - return nil -} - -func (x *RouteMatch) GetTlsContext() *RouteMatch_TlsContextMatchOptions { - if x != nil { - return x.TlsContext - } - return nil -} - -func (x *RouteMatch) GetDynamicMetadata() []*v32.MetadataMatcher { - if x != nil { - return x.DynamicMetadata - } - return nil -} - -type isRouteMatch_PathSpecifier interface { - isRouteMatch_PathSpecifier() -} - -type RouteMatch_Prefix struct { - // If specified, the route is a prefix rule meaning that the prefix must - // match the beginning of the “:path“ header. - Prefix string `protobuf:"bytes,1,opt,name=prefix,proto3,oneof"` -} - -type RouteMatch_Path struct { - // If specified, the route is an exact path rule meaning that the path must - // exactly match the “:path“ header once the query string is removed. - Path string `protobuf:"bytes,2,opt,name=path,proto3,oneof"` -} - -type RouteMatch_SafeRegex struct { - // If specified, the route is a regular expression rule meaning that the - // regex must match the “:path“ header once the query string is removed. The entire path - // (without the query string) must match the regex. The rule will not match if only a - // subsequence of the “:path“ header matches the regex. - // - // [#next-major-version: In the v3 API we should redo how path specification works such - // that we utilize StringMatcher, and additionally have consistent options around whether we - // strip query strings, do a case sensitive match, etc. In the interim it will be too disruptive - // to deprecate the existing options. We should even consider whether we want to do away with - // path_specifier entirely and just rely on a set of header matchers which can already match - // on :path, etc. The issue with that is it is unclear how to generically deal with query string - // stripping. This needs more thought.] - SafeRegex *v32.RegexMatcher `protobuf:"bytes,10,opt,name=safe_regex,json=safeRegex,proto3,oneof"` -} - -type RouteMatch_ConnectMatcher_ struct { - // If this is used as the matcher, the matcher will only match CONNECT or CONNECT-UDP requests. - // Note that this will not match other Extended CONNECT requests (WebSocket and the like) as - // they are normalized in Envoy as HTTP/1.1 style upgrades. - // This is the only way to match CONNECT requests for HTTP/1.1. For HTTP/2 and HTTP/3, - // where Extended CONNECT requests may have a path, the path matchers will work if - // there is a path present. - // Note that CONNECT support is currently considered alpha in Envoy. - // [#comment: TODO(htuch): Replace the above comment with an alpha tag.] - ConnectMatcher *RouteMatch_ConnectMatcher `protobuf:"bytes,12,opt,name=connect_matcher,json=connectMatcher,proto3,oneof"` -} - -type RouteMatch_PathSeparatedPrefix struct { - // If specified, the route is a path-separated prefix rule meaning that the - // “:path“ header (without the query string) must either exactly match the - // “path_separated_prefix“ or have it as a prefix, followed by “/“ - // - // For example, “/api/dev“ would match - // “/api/dev“, “/api/dev/“, “/api/dev/v1“, and “/api/dev?param=true“ - // but would not match “/api/developer“ - // - // Expect the value to not contain “?“ or “#“ and not to end in “/“ - PathSeparatedPrefix string `protobuf:"bytes,14,opt,name=path_separated_prefix,json=pathSeparatedPrefix,proto3,oneof"` -} - -type RouteMatch_PathMatchPolicy struct { - // [#extension-category: envoy.path.match] - PathMatchPolicy *v31.TypedExtensionConfig `protobuf:"bytes,15,opt,name=path_match_policy,json=pathMatchPolicy,proto3,oneof"` -} - -func (*RouteMatch_Prefix) isRouteMatch_PathSpecifier() {} - -func (*RouteMatch_Path) isRouteMatch_PathSpecifier() {} - -func (*RouteMatch_SafeRegex) isRouteMatch_PathSpecifier() {} - -func (*RouteMatch_ConnectMatcher_) isRouteMatch_PathSpecifier() {} - -func (*RouteMatch_PathSeparatedPrefix) isRouteMatch_PathSpecifier() {} - -func (*RouteMatch_PathMatchPolicy) isRouteMatch_PathSpecifier() {} - -// Cors policy configuration. -// -// .. attention:: -// -// This message has been deprecated. Please use -// :ref:`CorsPolicy in filter extension ` -// as as alternative. -// -// [#next-free-field: 13] -type CorsPolicy struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Specifies string patterns that match allowed origins. An origin is allowed if any of the - // string matchers match. - AllowOriginStringMatch []*v32.StringMatcher `protobuf:"bytes,11,rep,name=allow_origin_string_match,json=allowOriginStringMatch,proto3" json:"allow_origin_string_match,omitempty"` - // Specifies the content for the “access-control-allow-methods“ header. - AllowMethods string `protobuf:"bytes,2,opt,name=allow_methods,json=allowMethods,proto3" json:"allow_methods,omitempty"` - // Specifies the content for the “access-control-allow-headers“ header. - AllowHeaders string `protobuf:"bytes,3,opt,name=allow_headers,json=allowHeaders,proto3" json:"allow_headers,omitempty"` - // Specifies the content for the “access-control-expose-headers“ header. - ExposeHeaders string `protobuf:"bytes,4,opt,name=expose_headers,json=exposeHeaders,proto3" json:"expose_headers,omitempty"` - // Specifies the content for the “access-control-max-age“ header. - MaxAge string `protobuf:"bytes,5,opt,name=max_age,json=maxAge,proto3" json:"max_age,omitempty"` - // Specifies whether the resource allows credentials. - AllowCredentials *wrapperspb.BoolValue `protobuf:"bytes,6,opt,name=allow_credentials,json=allowCredentials,proto3" json:"allow_credentials,omitempty"` - // Types that are assignable to EnabledSpecifier: - // - // *CorsPolicy_FilterEnabled - EnabledSpecifier isCorsPolicy_EnabledSpecifier `protobuf_oneof:"enabled_specifier"` - // Specifies the % of requests for which the CORS policies will be evaluated and tracked, but not - // enforced. - // - // This field is intended to be used when “filter_enabled“ and “enabled“ are off. One of those - // fields have to explicitly disable the filter in order for this setting to take effect. - // - // If :ref:`runtime_key ` is specified, - // Envoy will lookup the runtime key to get the percentage of requests for which it will evaluate - // and track the request's “Origin“ to determine if it's valid but will not enforce any policies. - ShadowEnabled *v31.RuntimeFractionalPercent `protobuf:"bytes,10,opt,name=shadow_enabled,json=shadowEnabled,proto3" json:"shadow_enabled,omitempty"` - // Specify whether allow requests whose target server's IP address is more private than that from - // which the request initiator was fetched. - // - // More details refer to https://developer.chrome.com/blog/private-network-access-preflight. - AllowPrivateNetworkAccess *wrapperspb.BoolValue `protobuf:"bytes,12,opt,name=allow_private_network_access,json=allowPrivateNetworkAccess,proto3" json:"allow_private_network_access,omitempty"` -} - -func (x *CorsPolicy) Reset() { - *x = CorsPolicy{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CorsPolicy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CorsPolicy) ProtoMessage() {} - -func (x *CorsPolicy) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CorsPolicy.ProtoReflect.Descriptor instead. -func (*CorsPolicy) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{7} -} - -func (x *CorsPolicy) GetAllowOriginStringMatch() []*v32.StringMatcher { - if x != nil { - return x.AllowOriginStringMatch - } - return nil -} - -func (x *CorsPolicy) GetAllowMethods() string { - if x != nil { - return x.AllowMethods - } - return "" -} - -func (x *CorsPolicy) GetAllowHeaders() string { - if x != nil { - return x.AllowHeaders - } - return "" -} - -func (x *CorsPolicy) GetExposeHeaders() string { - if x != nil { - return x.ExposeHeaders - } - return "" -} - -func (x *CorsPolicy) GetMaxAge() string { - if x != nil { - return x.MaxAge - } - return "" -} - -func (x *CorsPolicy) GetAllowCredentials() *wrapperspb.BoolValue { - if x != nil { - return x.AllowCredentials - } - return nil -} - -func (m *CorsPolicy) GetEnabledSpecifier() isCorsPolicy_EnabledSpecifier { - if m != nil { - return m.EnabledSpecifier - } - return nil -} - -func (x *CorsPolicy) GetFilterEnabled() *v31.RuntimeFractionalPercent { - if x, ok := x.GetEnabledSpecifier().(*CorsPolicy_FilterEnabled); ok { - return x.FilterEnabled - } - return nil -} - -func (x *CorsPolicy) GetShadowEnabled() *v31.RuntimeFractionalPercent { - if x != nil { - return x.ShadowEnabled - } - return nil -} - -func (x *CorsPolicy) GetAllowPrivateNetworkAccess() *wrapperspb.BoolValue { - if x != nil { - return x.AllowPrivateNetworkAccess - } - return nil -} - -type isCorsPolicy_EnabledSpecifier interface { - isCorsPolicy_EnabledSpecifier() -} - -type CorsPolicy_FilterEnabled struct { - // Specifies the % of requests for which the CORS filter is enabled. - // - // If neither “enabled“, “filter_enabled“, nor “shadow_enabled“ are specified, the CORS - // filter will be enabled for 100% of the requests. - // - // If :ref:`runtime_key ` is - // specified, Envoy will lookup the runtime key to get the percentage of requests to filter. - FilterEnabled *v31.RuntimeFractionalPercent `protobuf:"bytes,9,opt,name=filter_enabled,json=filterEnabled,proto3,oneof"` -} - -func (*CorsPolicy_FilterEnabled) isCorsPolicy_EnabledSpecifier() {} - -// [#next-free-field: 42] -type RouteAction struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to ClusterSpecifier: - // - // *RouteAction_Cluster - // *RouteAction_ClusterHeader - // *RouteAction_WeightedClusters - // *RouteAction_ClusterSpecifierPlugin - // *RouteAction_InlineClusterSpecifierPlugin - ClusterSpecifier isRouteAction_ClusterSpecifier `protobuf_oneof:"cluster_specifier"` - // The HTTP status code to use when configured cluster is not found. - // The default response code is 503 Service Unavailable. - ClusterNotFoundResponseCode RouteAction_ClusterNotFoundResponseCode `protobuf:"varint,20,opt,name=cluster_not_found_response_code,json=clusterNotFoundResponseCode,proto3,enum=envoy.config.route.v3.RouteAction_ClusterNotFoundResponseCode" json:"cluster_not_found_response_code,omitempty"` - // Optional endpoint metadata match criteria used by the subset load balancer. Only endpoints - // in the upstream cluster with metadata matching what's set in this field will be considered - // for load balancing. If using :ref:`weighted_clusters - // `, metadata will be merged, with values - // provided there taking precedence. The filter name should be specified as “envoy.lb“. - MetadataMatch *v31.Metadata `protobuf:"bytes,4,opt,name=metadata_match,json=metadataMatch,proto3" json:"metadata_match,omitempty"` - // Indicates that during forwarding, the matched prefix (or path) should be - // swapped with this value. This option allows application URLs to be rooted - // at a different path from those exposed at the reverse proxy layer. The router filter will - // place the original path before rewrite into the :ref:`x-envoy-original-path - // ` header. - // - // Only one of :ref:`regex_rewrite ` - // :ref:`path_rewrite_policy `, - // or :ref:`prefix_rewrite ` may be specified. - // - // .. attention:: - // - // Pay careful attention to the use of trailing slashes in the - // :ref:`route's match ` prefix value. - // Stripping a prefix from a path requires multiple Routes to handle all cases. For example, - // rewriting ``/prefix`` to ``/`` and ``/prefix/etc`` to ``/etc`` cannot be done in a single - // :ref:`Route `, as shown by the below config entries: - // - // .. code-block:: yaml - // - // - match: - // prefix: "/prefix/" - // route: - // prefix_rewrite: "/" - // - match: - // prefix: "/prefix" - // route: - // prefix_rewrite: "/" - // - // Having above entries in the config, requests to ``/prefix`` will be stripped to ``/``, while - // requests to ``/prefix/etc`` will be stripped to ``/etc``. - PrefixRewrite string `protobuf:"bytes,5,opt,name=prefix_rewrite,json=prefixRewrite,proto3" json:"prefix_rewrite,omitempty"` - // Indicates that during forwarding, portions of the path that match the - // pattern should be rewritten, even allowing the substitution of capture - // groups from the pattern into the new path as specified by the rewrite - // substitution string. This is useful to allow application paths to be - // rewritten in a way that is aware of segments with variable content like - // identifiers. The router filter will place the original path as it was - // before the rewrite into the :ref:`x-envoy-original-path - // ` header. - // - // Only one of :ref:`regex_rewrite `, - // :ref:`prefix_rewrite `, or - // :ref:`path_rewrite_policy `] - // may be specified. - // - // Examples using Google's `RE2 `_ engine: - // - // - The path pattern “^/service/([^/]+)(/.*)$“ paired with a substitution - // string of “\2/instance/\1“ would transform “/service/foo/v1/api“ - // into “/v1/api/instance/foo“. - // - // - The pattern “one“ paired with a substitution string of “two“ would - // transform “/xxx/one/yyy/one/zzz“ into “/xxx/two/yyy/two/zzz“. - // - // - The pattern “^(.*?)one(.*)$“ paired with a substitution string of - // “\1two\2“ would replace only the first occurrence of “one“, - // transforming path “/xxx/one/yyy/one/zzz“ into “/xxx/two/yyy/one/zzz“. - // - // - The pattern “(?i)/xxx/“ paired with a substitution string of “/yyy/“ - // would do a case-insensitive match and transform path “/aaa/XxX/bbb“ to - // “/aaa/yyy/bbb“. - RegexRewrite *v32.RegexMatchAndSubstitute `protobuf:"bytes,32,opt,name=regex_rewrite,json=regexRewrite,proto3" json:"regex_rewrite,omitempty"` - // [#extension-category: envoy.path.rewrite] - PathRewritePolicy *v31.TypedExtensionConfig `protobuf:"bytes,41,opt,name=path_rewrite_policy,json=pathRewritePolicy,proto3" json:"path_rewrite_policy,omitempty"` - // Types that are assignable to HostRewriteSpecifier: - // - // *RouteAction_HostRewriteLiteral - // *RouteAction_AutoHostRewrite - // *RouteAction_HostRewriteHeader - // *RouteAction_HostRewritePathRegex - HostRewriteSpecifier isRouteAction_HostRewriteSpecifier `protobuf_oneof:"host_rewrite_specifier"` - // If set, then a host rewrite action (one of - // :ref:`host_rewrite_literal `, - // :ref:`auto_host_rewrite `, - // :ref:`host_rewrite_header `, or - // :ref:`host_rewrite_path_regex `) - // causes the original value of the host header, if any, to be appended to the - // :ref:`config_http_conn_man_headers_x-forwarded-host` HTTP header if it is different to the last value appended. - // This can be disabled by setting the runtime guard “envoy_reloadable_features_append_xfh_idempotent“ to false. - AppendXForwardedHost bool `protobuf:"varint,38,opt,name=append_x_forwarded_host,json=appendXForwardedHost,proto3" json:"append_x_forwarded_host,omitempty"` - // Specifies the upstream timeout for the route. If not specified, the default is 15s. This - // spans between the point at which the entire downstream request (i.e. end-of-stream) has been - // processed and when the upstream response has been completely processed. A value of 0 will - // disable the route's timeout. - // - // .. note:: - // - // This timeout includes all retries. See also - // :ref:`config_http_filters_router_x-envoy-upstream-rq-timeout-ms`, - // :ref:`config_http_filters_router_x-envoy-upstream-rq-per-try-timeout-ms`, and the - // :ref:`retry overview `. - Timeout *durationpb.Duration `protobuf:"bytes,8,opt,name=timeout,proto3" json:"timeout,omitempty"` - // Specifies the idle timeout for the route. If not specified, there is no per-route idle timeout, - // although the connection manager wide :ref:`stream_idle_timeout - // ` - // will still apply. A value of 0 will completely disable the route's idle timeout, even if a - // connection manager stream idle timeout is configured. - // - // The idle timeout is distinct to :ref:`timeout - // `, which provides an upper bound - // on the upstream response time; :ref:`idle_timeout - // ` instead bounds the amount - // of time the request's stream may be idle. - // - // After header decoding, the idle timeout will apply on downstream and - // upstream request events. Each time an encode/decode event for headers or - // data is processed for the stream, the timer will be reset. If the timeout - // fires, the stream is terminated with a 408 Request Timeout error code if no - // upstream response header has been received, otherwise a stream reset - // occurs. - // - // If the :ref:`overload action ` "envoy.overload_actions.reduce_timeouts" - // is configured, this timeout is scaled according to the value for - // :ref:`HTTP_DOWNSTREAM_STREAM_IDLE `. - IdleTimeout *durationpb.Duration `protobuf:"bytes,24,opt,name=idle_timeout,json=idleTimeout,proto3" json:"idle_timeout,omitempty"` - // Specifies how to send request over TLS early data. - // If absent, allows `safe HTTP requests `_ to be sent on early data. - // [#extension-category: envoy.route.early_data_policy] - EarlyDataPolicy *v31.TypedExtensionConfig `protobuf:"bytes,40,opt,name=early_data_policy,json=earlyDataPolicy,proto3" json:"early_data_policy,omitempty"` - // Indicates that the route has a retry policy. Note that if this is set, - // it'll take precedence over the virtual host level retry policy entirely - // (e.g.: policies are not merged, most internal one becomes the enforced policy). - RetryPolicy *RetryPolicy `protobuf:"bytes,9,opt,name=retry_policy,json=retryPolicy,proto3" json:"retry_policy,omitempty"` - // [#not-implemented-hide:] - // Specifies the configuration for retry policy extension. Note that if this is set, it'll take - // precedence over the virtual host level retry policy entirely (e.g.: policies are not merged, - // most internal one becomes the enforced policy). :ref:`Retry policy ` - // should not be set if this field is used. - RetryPolicyTypedConfig *anypb.Any `protobuf:"bytes,33,opt,name=retry_policy_typed_config,json=retryPolicyTypedConfig,proto3" json:"retry_policy_typed_config,omitempty"` - // Specify a set of route request mirroring policies. - // It takes precedence over the virtual host and route config mirror policy entirely. - // That is, policies are not merged, the most specific non-empty one becomes the mirror policies. - RequestMirrorPolicies []*RouteAction_RequestMirrorPolicy `protobuf:"bytes,30,rep,name=request_mirror_policies,json=requestMirrorPolicies,proto3" json:"request_mirror_policies,omitempty"` - // Optionally specifies the :ref:`routing priority `. - Priority v31.RoutingPriority `protobuf:"varint,11,opt,name=priority,proto3,enum=envoy.config.core.v3.RoutingPriority" json:"priority,omitempty"` - // Specifies a set of rate limit configurations that could be applied to the - // route. - RateLimits []*RateLimit `protobuf:"bytes,13,rep,name=rate_limits,json=rateLimits,proto3" json:"rate_limits,omitempty"` - // Specifies if the rate limit filter should include the virtual host rate - // limits. By default, if the route configured rate limits, the virtual host - // :ref:`rate_limits ` are not applied to the - // request. - // - // This field is deprecated. Please use :ref:`vh_rate_limits ` - // - // Deprecated: Do not use. - IncludeVhRateLimits *wrapperspb.BoolValue `protobuf:"bytes,14,opt,name=include_vh_rate_limits,json=includeVhRateLimits,proto3" json:"include_vh_rate_limits,omitempty"` - // Specifies a list of hash policies to use for ring hash load balancing. Each - // hash policy is evaluated individually and the combined result is used to - // route the request. The method of combination is deterministic such that - // identical lists of hash policies will produce the same hash. Since a hash - // policy examines specific parts of a request, it can fail to produce a hash - // (i.e. if the hashed header is not present). If (and only if) all configured - // hash policies fail to generate a hash, no hash will be produced for - // the route. In this case, the behavior is the same as if no hash policies - // were specified (i.e. the ring hash load balancer will choose a random - // backend). If a hash policy has the "terminal" attribute set to true, and - // there is already a hash generated, the hash is returned immediately, - // ignoring the rest of the hash policy list. - HashPolicy []*RouteAction_HashPolicy `protobuf:"bytes,15,rep,name=hash_policy,json=hashPolicy,proto3" json:"hash_policy,omitempty"` - // Indicates that the route has a CORS policy. This field is ignored if related cors policy is - // found in the :ref:`Route.typed_per_filter_config` or - // :ref:`WeightedCluster.ClusterWeight.typed_per_filter_config`. - // - // .. attention:: - // - // This option has been deprecated. Please use - // :ref:`Route.typed_per_filter_config` or - // :ref:`WeightedCluster.ClusterWeight.typed_per_filter_config` - // to configure the CORS HTTP filter. - // - // Deprecated: Do not use. - Cors *CorsPolicy `protobuf:"bytes,17,opt,name=cors,proto3" json:"cors,omitempty"` - // Deprecated by :ref:`grpc_timeout_header_max ` - // If present, and the request is a gRPC request, use the - // `grpc-timeout header `_, - // or its default value (infinity) instead of - // :ref:`timeout `, but limit the applied timeout - // to the maximum value specified here. If configured as 0, the maximum allowed timeout for - // gRPC requests is infinity. If not configured at all, the “grpc-timeout“ header is not used - // and gRPC requests time out like any other requests using - // :ref:`timeout ` or its default. - // This can be used to prevent unexpected upstream request timeouts due to potentially long - // time gaps between gRPC request and response in gRPC streaming mode. - // - // .. note:: - // - // If a timeout is specified using :ref:`config_http_filters_router_x-envoy-upstream-rq-timeout-ms`, it takes - // precedence over `grpc-timeout header `_, when - // both are present. See also - // :ref:`config_http_filters_router_x-envoy-upstream-rq-timeout-ms`, - // :ref:`config_http_filters_router_x-envoy-upstream-rq-per-try-timeout-ms`, and the - // :ref:`retry overview `. - // - // Deprecated: Do not use. - MaxGrpcTimeout *durationpb.Duration `protobuf:"bytes,23,opt,name=max_grpc_timeout,json=maxGrpcTimeout,proto3" json:"max_grpc_timeout,omitempty"` - // Deprecated by :ref:`grpc_timeout_header_offset `. - // If present, Envoy will adjust the timeout provided by the “grpc-timeout“ header by subtracting - // the provided duration from the header. This is useful in allowing Envoy to set its global - // timeout to be less than that of the deadline imposed by the calling client, which makes it more - // likely that Envoy will handle the timeout instead of having the call canceled by the client. - // The offset will only be applied if the provided grpc_timeout is greater than the offset. This - // ensures that the offset will only ever decrease the timeout and never set it to 0 (meaning - // infinity). - // - // Deprecated: Do not use. - GrpcTimeoutOffset *durationpb.Duration `protobuf:"bytes,28,opt,name=grpc_timeout_offset,json=grpcTimeoutOffset,proto3" json:"grpc_timeout_offset,omitempty"` - UpgradeConfigs []*RouteAction_UpgradeConfig `protobuf:"bytes,25,rep,name=upgrade_configs,json=upgradeConfigs,proto3" json:"upgrade_configs,omitempty"` - // If present, Envoy will try to follow an upstream redirect response instead of proxying the - // response back to the downstream. An upstream redirect response is defined - // by :ref:`redirect_response_codes - // `. - InternalRedirectPolicy *InternalRedirectPolicy `protobuf:"bytes,34,opt,name=internal_redirect_policy,json=internalRedirectPolicy,proto3" json:"internal_redirect_policy,omitempty"` - // Deprecated: Do not use. - InternalRedirectAction RouteAction_InternalRedirectAction `protobuf:"varint,26,opt,name=internal_redirect_action,json=internalRedirectAction,proto3,enum=envoy.config.route.v3.RouteAction_InternalRedirectAction" json:"internal_redirect_action,omitempty"` - // An internal redirect is handled, iff the number of previous internal redirects that a - // downstream request has encountered is lower than this value, and - // :ref:`internal_redirect_action ` - // is set to :ref:`HANDLE_INTERNAL_REDIRECT - // ` - // In the case where a downstream request is bounced among multiple routes by internal redirect, - // the first route that hits this threshold, or has - // :ref:`internal_redirect_action ` - // set to - // :ref:`PASS_THROUGH_INTERNAL_REDIRECT - // ` - // will pass the redirect back to downstream. - // - // If not specified, at most one redirect will be followed. - // - // Deprecated: Do not use. - MaxInternalRedirects *wrapperspb.UInt32Value `protobuf:"bytes,31,opt,name=max_internal_redirects,json=maxInternalRedirects,proto3" json:"max_internal_redirects,omitempty"` - // Indicates that the route has a hedge policy. Note that if this is set, - // it'll take precedence over the virtual host level hedge policy entirely - // (e.g.: policies are not merged, most internal one becomes the enforced policy). - HedgePolicy *HedgePolicy `protobuf:"bytes,27,opt,name=hedge_policy,json=hedgePolicy,proto3" json:"hedge_policy,omitempty"` - // Specifies the maximum stream duration for this route. - MaxStreamDuration *RouteAction_MaxStreamDuration `protobuf:"bytes,36,opt,name=max_stream_duration,json=maxStreamDuration,proto3" json:"max_stream_duration,omitempty"` -} - -func (x *RouteAction) Reset() { - *x = RouteAction{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RouteAction) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RouteAction) ProtoMessage() {} - -func (x *RouteAction) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RouteAction.ProtoReflect.Descriptor instead. -func (*RouteAction) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{8} -} - -func (m *RouteAction) GetClusterSpecifier() isRouteAction_ClusterSpecifier { - if m != nil { - return m.ClusterSpecifier - } - return nil -} - -func (x *RouteAction) GetCluster() string { - if x, ok := x.GetClusterSpecifier().(*RouteAction_Cluster); ok { - return x.Cluster - } - return "" -} - -func (x *RouteAction) GetClusterHeader() string { - if x, ok := x.GetClusterSpecifier().(*RouteAction_ClusterHeader); ok { - return x.ClusterHeader - } - return "" -} - -func (x *RouteAction) GetWeightedClusters() *WeightedCluster { - if x, ok := x.GetClusterSpecifier().(*RouteAction_WeightedClusters); ok { - return x.WeightedClusters - } - return nil -} - -func (x *RouteAction) GetClusterSpecifierPlugin() string { - if x, ok := x.GetClusterSpecifier().(*RouteAction_ClusterSpecifierPlugin); ok { - return x.ClusterSpecifierPlugin - } - return "" -} - -func (x *RouteAction) GetInlineClusterSpecifierPlugin() *ClusterSpecifierPlugin { - if x, ok := x.GetClusterSpecifier().(*RouteAction_InlineClusterSpecifierPlugin); ok { - return x.InlineClusterSpecifierPlugin - } - return nil -} - -func (x *RouteAction) GetClusterNotFoundResponseCode() RouteAction_ClusterNotFoundResponseCode { - if x != nil { - return x.ClusterNotFoundResponseCode - } - return RouteAction_SERVICE_UNAVAILABLE -} - -func (x *RouteAction) GetMetadataMatch() *v31.Metadata { - if x != nil { - return x.MetadataMatch - } - return nil -} - -func (x *RouteAction) GetPrefixRewrite() string { - if x != nil { - return x.PrefixRewrite - } - return "" -} - -func (x *RouteAction) GetRegexRewrite() *v32.RegexMatchAndSubstitute { - if x != nil { - return x.RegexRewrite - } - return nil -} - -func (x *RouteAction) GetPathRewritePolicy() *v31.TypedExtensionConfig { - if x != nil { - return x.PathRewritePolicy - } - return nil -} - -func (m *RouteAction) GetHostRewriteSpecifier() isRouteAction_HostRewriteSpecifier { - if m != nil { - return m.HostRewriteSpecifier - } - return nil -} - -func (x *RouteAction) GetHostRewriteLiteral() string { - if x, ok := x.GetHostRewriteSpecifier().(*RouteAction_HostRewriteLiteral); ok { - return x.HostRewriteLiteral - } - return "" -} - -func (x *RouteAction) GetAutoHostRewrite() *wrapperspb.BoolValue { - if x, ok := x.GetHostRewriteSpecifier().(*RouteAction_AutoHostRewrite); ok { - return x.AutoHostRewrite - } - return nil -} - -func (x *RouteAction) GetHostRewriteHeader() string { - if x, ok := x.GetHostRewriteSpecifier().(*RouteAction_HostRewriteHeader); ok { - return x.HostRewriteHeader - } - return "" -} - -func (x *RouteAction) GetHostRewritePathRegex() *v32.RegexMatchAndSubstitute { - if x, ok := x.GetHostRewriteSpecifier().(*RouteAction_HostRewritePathRegex); ok { - return x.HostRewritePathRegex - } - return nil -} - -func (x *RouteAction) GetAppendXForwardedHost() bool { - if x != nil { - return x.AppendXForwardedHost - } - return false -} - -func (x *RouteAction) GetTimeout() *durationpb.Duration { - if x != nil { - return x.Timeout - } - return nil -} - -func (x *RouteAction) GetIdleTimeout() *durationpb.Duration { - if x != nil { - return x.IdleTimeout - } - return nil -} - -func (x *RouteAction) GetEarlyDataPolicy() *v31.TypedExtensionConfig { - if x != nil { - return x.EarlyDataPolicy - } - return nil -} - -func (x *RouteAction) GetRetryPolicy() *RetryPolicy { - if x != nil { - return x.RetryPolicy - } - return nil -} - -func (x *RouteAction) GetRetryPolicyTypedConfig() *anypb.Any { - if x != nil { - return x.RetryPolicyTypedConfig - } - return nil -} - -func (x *RouteAction) GetRequestMirrorPolicies() []*RouteAction_RequestMirrorPolicy { - if x != nil { - return x.RequestMirrorPolicies - } - return nil -} - -func (x *RouteAction) GetPriority() v31.RoutingPriority { - if x != nil { - return x.Priority - } - return v31.RoutingPriority_DEFAULT -} - -func (x *RouteAction) GetRateLimits() []*RateLimit { - if x != nil { - return x.RateLimits - } - return nil -} - -// Deprecated: Do not use. -func (x *RouteAction) GetIncludeVhRateLimits() *wrapperspb.BoolValue { - if x != nil { - return x.IncludeVhRateLimits - } - return nil -} - -func (x *RouteAction) GetHashPolicy() []*RouteAction_HashPolicy { - if x != nil { - return x.HashPolicy - } - return nil -} - -// Deprecated: Do not use. -func (x *RouteAction) GetCors() *CorsPolicy { - if x != nil { - return x.Cors - } - return nil -} - -// Deprecated: Do not use. -func (x *RouteAction) GetMaxGrpcTimeout() *durationpb.Duration { - if x != nil { - return x.MaxGrpcTimeout - } - return nil -} - -// Deprecated: Do not use. -func (x *RouteAction) GetGrpcTimeoutOffset() *durationpb.Duration { - if x != nil { - return x.GrpcTimeoutOffset - } - return nil -} - -func (x *RouteAction) GetUpgradeConfigs() []*RouteAction_UpgradeConfig { - if x != nil { - return x.UpgradeConfigs - } - return nil -} - -func (x *RouteAction) GetInternalRedirectPolicy() *InternalRedirectPolicy { - if x != nil { - return x.InternalRedirectPolicy - } - return nil -} - -// Deprecated: Do not use. -func (x *RouteAction) GetInternalRedirectAction() RouteAction_InternalRedirectAction { - if x != nil { - return x.InternalRedirectAction - } - return RouteAction_PASS_THROUGH_INTERNAL_REDIRECT -} - -// Deprecated: Do not use. -func (x *RouteAction) GetMaxInternalRedirects() *wrapperspb.UInt32Value { - if x != nil { - return x.MaxInternalRedirects - } - return nil -} - -func (x *RouteAction) GetHedgePolicy() *HedgePolicy { - if x != nil { - return x.HedgePolicy - } - return nil -} - -func (x *RouteAction) GetMaxStreamDuration() *RouteAction_MaxStreamDuration { - if x != nil { - return x.MaxStreamDuration - } - return nil -} - -type isRouteAction_ClusterSpecifier interface { - isRouteAction_ClusterSpecifier() -} - -type RouteAction_Cluster struct { - // Indicates the upstream cluster to which the request should be routed - // to. - Cluster string `protobuf:"bytes,1,opt,name=cluster,proto3,oneof"` -} - -type RouteAction_ClusterHeader struct { - // Envoy will determine the cluster to route to by reading the value of the - // HTTP header named by cluster_header from the request headers. If the - // header is not found or the referenced cluster does not exist, Envoy will - // return a 404 response. - // - // .. attention:: - // - // Internally, Envoy always uses the HTTP/2 ``:authority`` header to represent the HTTP/1 - // ``Host`` header. Thus, if attempting to match on ``Host``, match on ``:authority`` instead. - // - // .. note:: - // - // If the header appears multiple times only the first value is used. - ClusterHeader string `protobuf:"bytes,2,opt,name=cluster_header,json=clusterHeader,proto3,oneof"` -} - -type RouteAction_WeightedClusters struct { - // Multiple upstream clusters can be specified for a given route. The - // request is routed to one of the upstream clusters based on weights - // assigned to each cluster. See - // :ref:`traffic splitting ` - // for additional documentation. - WeightedClusters *WeightedCluster `protobuf:"bytes,3,opt,name=weighted_clusters,json=weightedClusters,proto3,oneof"` -} - -type RouteAction_ClusterSpecifierPlugin struct { - // Name of the cluster specifier plugin to use to determine the cluster for requests on this route. - // The cluster specifier plugin name must be defined in the associated - // :ref:`cluster specifier plugins ` - // in the :ref:`name ` field. - ClusterSpecifierPlugin string `protobuf:"bytes,37,opt,name=cluster_specifier_plugin,json=clusterSpecifierPlugin,proto3,oneof"` -} - -type RouteAction_InlineClusterSpecifierPlugin struct { - // Custom cluster specifier plugin configuration to use to determine the cluster for requests - // on this route. - InlineClusterSpecifierPlugin *ClusterSpecifierPlugin `protobuf:"bytes,39,opt,name=inline_cluster_specifier_plugin,json=inlineClusterSpecifierPlugin,proto3,oneof"` -} - -func (*RouteAction_Cluster) isRouteAction_ClusterSpecifier() {} - -func (*RouteAction_ClusterHeader) isRouteAction_ClusterSpecifier() {} - -func (*RouteAction_WeightedClusters) isRouteAction_ClusterSpecifier() {} - -func (*RouteAction_ClusterSpecifierPlugin) isRouteAction_ClusterSpecifier() {} - -func (*RouteAction_InlineClusterSpecifierPlugin) isRouteAction_ClusterSpecifier() {} - -type isRouteAction_HostRewriteSpecifier interface { - isRouteAction_HostRewriteSpecifier() -} - -type RouteAction_HostRewriteLiteral struct { - // Indicates that during forwarding, the host header will be swapped with - // this value. Using this option will append the - // :ref:`config_http_conn_man_headers_x-forwarded-host` header if - // :ref:`append_x_forwarded_host ` - // is set. - HostRewriteLiteral string `protobuf:"bytes,6,opt,name=host_rewrite_literal,json=hostRewriteLiteral,proto3,oneof"` -} - -type RouteAction_AutoHostRewrite struct { - // Indicates that during forwarding, the host header will be swapped with - // the hostname of the upstream host chosen by the cluster manager. This - // option is applicable only when the destination cluster for a route is of - // type “strict_dns“ or “logical_dns“, - // or when :ref:`hostname ` - // field is not empty. Setting this to true with other cluster types - // has no effect. Using this option will append the - // :ref:`config_http_conn_man_headers_x-forwarded-host` header if - // :ref:`append_x_forwarded_host ` - // is set. - AutoHostRewrite *wrapperspb.BoolValue `protobuf:"bytes,7,opt,name=auto_host_rewrite,json=autoHostRewrite,proto3,oneof"` -} - -type RouteAction_HostRewriteHeader struct { - // Indicates that during forwarding, the host header will be swapped with the content of given - // downstream or :ref:`custom ` header. - // If header value is empty, host header is left intact. Using this option will append the - // :ref:`config_http_conn_man_headers_x-forwarded-host` header if - // :ref:`append_x_forwarded_host ` - // is set. - // - // .. attention:: - // - // Pay attention to the potential security implications of using this option. Provided header - // must come from trusted source. - // - // .. note:: - // - // If the header appears multiple times only the first value is used. - HostRewriteHeader string `protobuf:"bytes,29,opt,name=host_rewrite_header,json=hostRewriteHeader,proto3,oneof"` -} - -type RouteAction_HostRewritePathRegex struct { - // Indicates that during forwarding, the host header will be swapped with - // the result of the regex substitution executed on path value with query and fragment removed. - // This is useful for transitioning variable content between path segment and subdomain. - // Using this option will append the - // :ref:`config_http_conn_man_headers_x-forwarded-host` header if - // :ref:`append_x_forwarded_host ` - // is set. - // - // For example with the following config: - // - // .. code-block:: yaml - // - // host_rewrite_path_regex: - // pattern: - // google_re2: {} - // regex: "^/(.+)/.+$" - // substitution: \1 - // - // Would rewrite the host header to “envoyproxy.io“ given the path “/envoyproxy.io/some/path“. - HostRewritePathRegex *v32.RegexMatchAndSubstitute `protobuf:"bytes,35,opt,name=host_rewrite_path_regex,json=hostRewritePathRegex,proto3,oneof"` -} - -func (*RouteAction_HostRewriteLiteral) isRouteAction_HostRewriteSpecifier() {} - -func (*RouteAction_AutoHostRewrite) isRouteAction_HostRewriteSpecifier() {} - -func (*RouteAction_HostRewriteHeader) isRouteAction_HostRewriteSpecifier() {} - -func (*RouteAction_HostRewritePathRegex) isRouteAction_HostRewriteSpecifier() {} - -// HTTP retry :ref:`architecture overview `. -// [#next-free-field: 14] -type RetryPolicy struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Specifies the conditions under which retry takes place. These are the same - // conditions documented for :ref:`config_http_filters_router_x-envoy-retry-on` and - // :ref:`config_http_filters_router_x-envoy-retry-grpc-on`. - RetryOn string `protobuf:"bytes,1,opt,name=retry_on,json=retryOn,proto3" json:"retry_on,omitempty"` - // Specifies the allowed number of retries. This parameter is optional and - // defaults to 1. These are the same conditions documented for - // :ref:`config_http_filters_router_x-envoy-max-retries`. - NumRetries *wrapperspb.UInt32Value `protobuf:"bytes,2,opt,name=num_retries,json=numRetries,proto3" json:"num_retries,omitempty"` - // Specifies a non-zero upstream timeout per retry attempt (including the initial attempt). This - // parameter is optional. The same conditions documented for - // :ref:`config_http_filters_router_x-envoy-upstream-rq-per-try-timeout-ms` apply. - // - // .. note:: - // - // If left unspecified, Envoy will use the global - // :ref:`route timeout ` for the request. - // Consequently, when using a :ref:`5xx ` based - // retry policy, a request that times out will not be retried as the total timeout budget - // would have been exhausted. - PerTryTimeout *durationpb.Duration `protobuf:"bytes,3,opt,name=per_try_timeout,json=perTryTimeout,proto3" json:"per_try_timeout,omitempty"` - // Specifies an upstream idle timeout per retry attempt (including the initial attempt). This - // parameter is optional and if absent there is no per try idle timeout. The semantics of the per - // try idle timeout are similar to the - // :ref:`route idle timeout ` and - // :ref:`stream idle timeout - // ` - // both enforced by the HTTP connection manager. The difference is that this idle timeout - // is enforced by the router for each individual attempt and thus after all previous filters have - // run, as opposed to *before* all previous filters run for the other idle timeouts. This timeout - // is useful in cases in which total request timeout is bounded by a number of retries and a - // :ref:`per_try_timeout `, but - // there is a desire to ensure each try is making incremental progress. Note also that similar - // to :ref:`per_try_timeout `, - // this idle timeout does not start until after both the entire request has been received by the - // router *and* a connection pool connection has been obtained. Unlike - // :ref:`per_try_timeout `, - // the idle timer continues once the response starts streaming back to the downstream client. - // This ensures that response data continues to make progress without using one of the HTTP - // connection manager idle timeouts. - PerTryIdleTimeout *durationpb.Duration `protobuf:"bytes,13,opt,name=per_try_idle_timeout,json=perTryIdleTimeout,proto3" json:"per_try_idle_timeout,omitempty"` - // Specifies an implementation of a RetryPriority which is used to determine the - // distribution of load across priorities used for retries. Refer to - // :ref:`retry plugin configuration ` for more details. - RetryPriority *RetryPolicy_RetryPriority `protobuf:"bytes,4,opt,name=retry_priority,json=retryPriority,proto3" json:"retry_priority,omitempty"` - // Specifies a collection of RetryHostPredicates that will be consulted when selecting a host - // for retries. If any of the predicates reject the host, host selection will be reattempted. - // Refer to :ref:`retry plugin configuration ` for more - // details. - RetryHostPredicate []*RetryPolicy_RetryHostPredicate `protobuf:"bytes,5,rep,name=retry_host_predicate,json=retryHostPredicate,proto3" json:"retry_host_predicate,omitempty"` - // Retry options predicates that will be applied prior to retrying a request. These predicates - // allow customizing request behavior between retries. - // [#comment: add [#extension-category: envoy.retry_options_predicates] when there are built-in extensions] - RetryOptionsPredicates []*v31.TypedExtensionConfig `protobuf:"bytes,12,rep,name=retry_options_predicates,json=retryOptionsPredicates,proto3" json:"retry_options_predicates,omitempty"` - // The maximum number of times host selection will be reattempted before giving up, at which - // point the host that was last selected will be routed to. If unspecified, this will default to - // retrying once. - HostSelectionRetryMaxAttempts int64 `protobuf:"varint,6,opt,name=host_selection_retry_max_attempts,json=hostSelectionRetryMaxAttempts,proto3" json:"host_selection_retry_max_attempts,omitempty"` - // HTTP status codes that should trigger a retry in addition to those specified by retry_on. - RetriableStatusCodes []uint32 `protobuf:"varint,7,rep,packed,name=retriable_status_codes,json=retriableStatusCodes,proto3" json:"retriable_status_codes,omitempty"` - // Specifies parameters that control exponential retry back off. This parameter is optional, in which case the - // default base interval is 25 milliseconds or, if set, the current value of the - // “upstream.base_retry_backoff_ms“ runtime parameter. The default maximum interval is 10 times - // the base interval. The documentation for :ref:`config_http_filters_router_x-envoy-max-retries` - // describes Envoy's back-off algorithm. - RetryBackOff *RetryPolicy_RetryBackOff `protobuf:"bytes,8,opt,name=retry_back_off,json=retryBackOff,proto3" json:"retry_back_off,omitempty"` - // Specifies parameters that control a retry back-off strategy that is used - // when the request is rate limited by the upstream server. The server may - // return a response header like “Retry-After“ or “X-RateLimit-Reset“ to - // provide feedback to the client on how long to wait before retrying. If - // configured, this back-off strategy will be used instead of the - // default exponential back off strategy (configured using “retry_back_off“) - // whenever a response includes the matching headers. - RateLimitedRetryBackOff *RetryPolicy_RateLimitedRetryBackOff `protobuf:"bytes,11,opt,name=rate_limited_retry_back_off,json=rateLimitedRetryBackOff,proto3" json:"rate_limited_retry_back_off,omitempty"` - // HTTP response headers that trigger a retry if present in the response. A retry will be - // triggered if any of the header matches match the upstream response headers. - // The field is only consulted if 'retriable-headers' retry policy is active. - RetriableHeaders []*HeaderMatcher `protobuf:"bytes,9,rep,name=retriable_headers,json=retriableHeaders,proto3" json:"retriable_headers,omitempty"` - // HTTP headers which must be present in the request for retries to be attempted. - RetriableRequestHeaders []*HeaderMatcher `protobuf:"bytes,10,rep,name=retriable_request_headers,json=retriableRequestHeaders,proto3" json:"retriable_request_headers,omitempty"` -} - -func (x *RetryPolicy) Reset() { - *x = RetryPolicy{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RetryPolicy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RetryPolicy) ProtoMessage() {} - -func (x *RetryPolicy) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RetryPolicy.ProtoReflect.Descriptor instead. -func (*RetryPolicy) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{9} -} - -func (x *RetryPolicy) GetRetryOn() string { - if x != nil { - return x.RetryOn - } - return "" -} - -func (x *RetryPolicy) GetNumRetries() *wrapperspb.UInt32Value { - if x != nil { - return x.NumRetries - } - return nil -} - -func (x *RetryPolicy) GetPerTryTimeout() *durationpb.Duration { - if x != nil { - return x.PerTryTimeout - } - return nil -} - -func (x *RetryPolicy) GetPerTryIdleTimeout() *durationpb.Duration { - if x != nil { - return x.PerTryIdleTimeout - } - return nil -} - -func (x *RetryPolicy) GetRetryPriority() *RetryPolicy_RetryPriority { - if x != nil { - return x.RetryPriority - } - return nil -} - -func (x *RetryPolicy) GetRetryHostPredicate() []*RetryPolicy_RetryHostPredicate { - if x != nil { - return x.RetryHostPredicate - } - return nil -} - -func (x *RetryPolicy) GetRetryOptionsPredicates() []*v31.TypedExtensionConfig { - if x != nil { - return x.RetryOptionsPredicates - } - return nil -} - -func (x *RetryPolicy) GetHostSelectionRetryMaxAttempts() int64 { - if x != nil { - return x.HostSelectionRetryMaxAttempts - } - return 0 -} - -func (x *RetryPolicy) GetRetriableStatusCodes() []uint32 { - if x != nil { - return x.RetriableStatusCodes - } - return nil -} - -func (x *RetryPolicy) GetRetryBackOff() *RetryPolicy_RetryBackOff { - if x != nil { - return x.RetryBackOff - } - return nil -} - -func (x *RetryPolicy) GetRateLimitedRetryBackOff() *RetryPolicy_RateLimitedRetryBackOff { - if x != nil { - return x.RateLimitedRetryBackOff - } - return nil -} - -func (x *RetryPolicy) GetRetriableHeaders() []*HeaderMatcher { - if x != nil { - return x.RetriableHeaders - } - return nil -} - -func (x *RetryPolicy) GetRetriableRequestHeaders() []*HeaderMatcher { - if x != nil { - return x.RetriableRequestHeaders - } - return nil -} - -// HTTP request hedging :ref:`architecture overview `. -type HedgePolicy struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Specifies the number of initial requests that should be sent upstream. - // Must be at least 1. - // Defaults to 1. - // [#not-implemented-hide:] - InitialRequests *wrapperspb.UInt32Value `protobuf:"bytes,1,opt,name=initial_requests,json=initialRequests,proto3" json:"initial_requests,omitempty"` - // Specifies a probability that an additional upstream request should be sent - // on top of what is specified by initial_requests. - // Defaults to 0. - // [#not-implemented-hide:] - AdditionalRequestChance *v33.FractionalPercent `protobuf:"bytes,2,opt,name=additional_request_chance,json=additionalRequestChance,proto3" json:"additional_request_chance,omitempty"` - // Indicates that a hedged request should be sent when the per-try timeout is hit. - // This means that a retry will be issued without resetting the original request, leaving multiple upstream requests in flight. - // The first request to complete successfully will be the one returned to the caller. - // - // - At any time, a successful response (i.e. not triggering any of the retry-on conditions) would be returned to the client. - // - Before per-try timeout, an error response (per retry-on conditions) would be retried immediately or returned ot the client - // if there are no more retries left. - // - After per-try timeout, an error response would be discarded, as a retry in the form of a hedged request is already in progress. - // - // Note: For this to have effect, you must have a :ref:`RetryPolicy ` that retries at least - // one error code and specifies a maximum number of retries. - // - // Defaults to false. - HedgeOnPerTryTimeout bool `protobuf:"varint,3,opt,name=hedge_on_per_try_timeout,json=hedgeOnPerTryTimeout,proto3" json:"hedge_on_per_try_timeout,omitempty"` -} - -func (x *HedgePolicy) Reset() { - *x = HedgePolicy{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HedgePolicy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HedgePolicy) ProtoMessage() {} - -func (x *HedgePolicy) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HedgePolicy.ProtoReflect.Descriptor instead. -func (*HedgePolicy) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{10} -} - -func (x *HedgePolicy) GetInitialRequests() *wrapperspb.UInt32Value { - if x != nil { - return x.InitialRequests - } - return nil -} - -func (x *HedgePolicy) GetAdditionalRequestChance() *v33.FractionalPercent { - if x != nil { - return x.AdditionalRequestChance - } - return nil -} - -func (x *HedgePolicy) GetHedgeOnPerTryTimeout() bool { - if x != nil { - return x.HedgeOnPerTryTimeout - } - return false -} - -// [#next-free-field: 10] -type RedirectAction struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // When the scheme redirection take place, the following rules apply: - // 1. If the source URI scheme is “http“ and the port is explicitly - // set to “:80“, the port will be removed after the redirection - // 2. If the source URI scheme is “https“ and the port is explicitly - // set to “:443“, the port will be removed after the redirection - // - // Types that are assignable to SchemeRewriteSpecifier: - // - // *RedirectAction_HttpsRedirect - // *RedirectAction_SchemeRedirect - SchemeRewriteSpecifier isRedirectAction_SchemeRewriteSpecifier `protobuf_oneof:"scheme_rewrite_specifier"` - // The host portion of the URL will be swapped with this value. - HostRedirect string `protobuf:"bytes,1,opt,name=host_redirect,json=hostRedirect,proto3" json:"host_redirect,omitempty"` - // The port value of the URL will be swapped with this value. - PortRedirect uint32 `protobuf:"varint,8,opt,name=port_redirect,json=portRedirect,proto3" json:"port_redirect,omitempty"` - // Types that are assignable to PathRewriteSpecifier: - // - // *RedirectAction_PathRedirect - // *RedirectAction_PrefixRewrite - // *RedirectAction_RegexRewrite - PathRewriteSpecifier isRedirectAction_PathRewriteSpecifier `protobuf_oneof:"path_rewrite_specifier"` - // The HTTP status code to use in the redirect response. The default response - // code is MOVED_PERMANENTLY (301). - ResponseCode RedirectAction_RedirectResponseCode `protobuf:"varint,3,opt,name=response_code,json=responseCode,proto3,enum=envoy.config.route.v3.RedirectAction_RedirectResponseCode" json:"response_code,omitempty"` - // Indicates that during redirection, the query portion of the URL will - // be removed. Default value is false. - StripQuery bool `protobuf:"varint,6,opt,name=strip_query,json=stripQuery,proto3" json:"strip_query,omitempty"` -} - -func (x *RedirectAction) Reset() { - *x = RedirectAction{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RedirectAction) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RedirectAction) ProtoMessage() {} - -func (x *RedirectAction) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RedirectAction.ProtoReflect.Descriptor instead. -func (*RedirectAction) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{11} -} - -func (m *RedirectAction) GetSchemeRewriteSpecifier() isRedirectAction_SchemeRewriteSpecifier { - if m != nil { - return m.SchemeRewriteSpecifier - } - return nil -} - -func (x *RedirectAction) GetHttpsRedirect() bool { - if x, ok := x.GetSchemeRewriteSpecifier().(*RedirectAction_HttpsRedirect); ok { - return x.HttpsRedirect - } - return false -} - -func (x *RedirectAction) GetSchemeRedirect() string { - if x, ok := x.GetSchemeRewriteSpecifier().(*RedirectAction_SchemeRedirect); ok { - return x.SchemeRedirect - } - return "" -} - -func (x *RedirectAction) GetHostRedirect() string { - if x != nil { - return x.HostRedirect - } - return "" -} - -func (x *RedirectAction) GetPortRedirect() uint32 { - if x != nil { - return x.PortRedirect - } - return 0 -} - -func (m *RedirectAction) GetPathRewriteSpecifier() isRedirectAction_PathRewriteSpecifier { - if m != nil { - return m.PathRewriteSpecifier - } - return nil -} - -func (x *RedirectAction) GetPathRedirect() string { - if x, ok := x.GetPathRewriteSpecifier().(*RedirectAction_PathRedirect); ok { - return x.PathRedirect - } - return "" -} - -func (x *RedirectAction) GetPrefixRewrite() string { - if x, ok := x.GetPathRewriteSpecifier().(*RedirectAction_PrefixRewrite); ok { - return x.PrefixRewrite - } - return "" -} - -func (x *RedirectAction) GetRegexRewrite() *v32.RegexMatchAndSubstitute { - if x, ok := x.GetPathRewriteSpecifier().(*RedirectAction_RegexRewrite); ok { - return x.RegexRewrite - } - return nil -} - -func (x *RedirectAction) GetResponseCode() RedirectAction_RedirectResponseCode { - if x != nil { - return x.ResponseCode - } - return RedirectAction_MOVED_PERMANENTLY -} - -func (x *RedirectAction) GetStripQuery() bool { - if x != nil { - return x.StripQuery - } - return false -} - -type isRedirectAction_SchemeRewriteSpecifier interface { - isRedirectAction_SchemeRewriteSpecifier() -} - -type RedirectAction_HttpsRedirect struct { - // The scheme portion of the URL will be swapped with "https". - HttpsRedirect bool `protobuf:"varint,4,opt,name=https_redirect,json=httpsRedirect,proto3,oneof"` -} - -type RedirectAction_SchemeRedirect struct { - // The scheme portion of the URL will be swapped with this value. - SchemeRedirect string `protobuf:"bytes,7,opt,name=scheme_redirect,json=schemeRedirect,proto3,oneof"` -} - -func (*RedirectAction_HttpsRedirect) isRedirectAction_SchemeRewriteSpecifier() {} - -func (*RedirectAction_SchemeRedirect) isRedirectAction_SchemeRewriteSpecifier() {} - -type isRedirectAction_PathRewriteSpecifier interface { - isRedirectAction_PathRewriteSpecifier() -} - -type RedirectAction_PathRedirect struct { - // The path portion of the URL will be swapped with this value. - // Please note that query string in path_redirect will override the - // request's query string and will not be stripped. - // - // For example, let's say we have the following routes: - // - // - match: { path: "/old-path-1" } - // redirect: { path_redirect: "/new-path-1" } - // - match: { path: "/old-path-2" } - // redirect: { path_redirect: "/new-path-2", strip-query: "true" } - // - match: { path: "/old-path-3" } - // redirect: { path_redirect: "/new-path-3?foo=1", strip_query: "true" } - // - // 1. if request uri is "/old-path-1?bar=1", users will be redirected to "/new-path-1?bar=1" - // 2. if request uri is "/old-path-2?bar=1", users will be redirected to "/new-path-2" - // 3. if request uri is "/old-path-3?bar=1", users will be redirected to "/new-path-3?foo=1" - PathRedirect string `protobuf:"bytes,2,opt,name=path_redirect,json=pathRedirect,proto3,oneof"` -} - -type RedirectAction_PrefixRewrite struct { - // Indicates that during redirection, the matched prefix (or path) - // should be swapped with this value. This option allows redirect URLs be dynamically created - // based on the request. - // - // .. attention:: - // - // Pay attention to the use of trailing slashes as mentioned in - // :ref:`RouteAction's prefix_rewrite `. - PrefixRewrite string `protobuf:"bytes,5,opt,name=prefix_rewrite,json=prefixRewrite,proto3,oneof"` -} - -type RedirectAction_RegexRewrite struct { - // Indicates that during redirect, portions of the path that match the - // pattern should be rewritten, even allowing the substitution of capture - // groups from the pattern into the new path as specified by the rewrite - // substitution string. This is useful to allow application paths to be - // rewritten in a way that is aware of segments with variable content like - // identifiers. - // - // Examples using Google's `RE2 `_ engine: - // - // - The path pattern “^/service/([^/]+)(/.*)$“ paired with a substitution - // string of “\2/instance/\1“ would transform “/service/foo/v1/api“ - // into “/v1/api/instance/foo“. - // - // - The pattern “one“ paired with a substitution string of “two“ would - // transform “/xxx/one/yyy/one/zzz“ into “/xxx/two/yyy/two/zzz“. - // - // - The pattern “^(.*?)one(.*)$“ paired with a substitution string of - // “\1two\2“ would replace only the first occurrence of “one“, - // transforming path “/xxx/one/yyy/one/zzz“ into “/xxx/two/yyy/one/zzz“. - // - // - The pattern “(?i)/xxx/“ paired with a substitution string of “/yyy/“ - // would do a case-insensitive match and transform path “/aaa/XxX/bbb“ to - // “/aaa/yyy/bbb“. - RegexRewrite *v32.RegexMatchAndSubstitute `protobuf:"bytes,9,opt,name=regex_rewrite,json=regexRewrite,proto3,oneof"` -} - -func (*RedirectAction_PathRedirect) isRedirectAction_PathRewriteSpecifier() {} - -func (*RedirectAction_PrefixRewrite) isRedirectAction_PathRewriteSpecifier() {} - -func (*RedirectAction_RegexRewrite) isRedirectAction_PathRewriteSpecifier() {} - -type DirectResponseAction struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Specifies the HTTP response status to be returned. - Status uint32 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"` - // Specifies the content of the response body. If this setting is omitted, - // no body is included in the generated response. - // - // .. note:: - // - // Headers can be specified using ``response_headers_to_add`` in the enclosing - // :ref:`envoy_v3_api_msg_config.route.v3.Route`, :ref:`envoy_v3_api_msg_config.route.v3.RouteConfiguration` or - // :ref:`envoy_v3_api_msg_config.route.v3.VirtualHost`. - Body *v31.DataSource `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` -} - -func (x *DirectResponseAction) Reset() { - *x = DirectResponseAction{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DirectResponseAction) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DirectResponseAction) ProtoMessage() {} - -func (x *DirectResponseAction) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DirectResponseAction.ProtoReflect.Descriptor instead. -func (*DirectResponseAction) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{12} -} - -func (x *DirectResponseAction) GetStatus() uint32 { - if x != nil { - return x.Status - } - return 0 -} - -func (x *DirectResponseAction) GetBody() *v31.DataSource { - if x != nil { - return x.Body - } - return nil -} - -// [#not-implemented-hide:] -type NonForwardingAction struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *NonForwardingAction) Reset() { - *x = NonForwardingAction{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NonForwardingAction) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NonForwardingAction) ProtoMessage() {} - -func (x *NonForwardingAction) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NonForwardingAction.ProtoReflect.Descriptor instead. -func (*NonForwardingAction) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{13} -} - -type Decorator struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The operation name associated with the request matched to this route. If tracing is - // enabled, this information will be used as the span name reported for this request. - // - // .. note:: - // - // For ingress (inbound) requests, or egress (outbound) responses, this value may be overridden - // by the :ref:`x-envoy-decorator-operation - // ` header. - Operation string `protobuf:"bytes,1,opt,name=operation,proto3" json:"operation,omitempty"` - // Whether the decorated details should be propagated to the other party. The default is true. - Propagate *wrapperspb.BoolValue `protobuf:"bytes,2,opt,name=propagate,proto3" json:"propagate,omitempty"` -} - -func (x *Decorator) Reset() { - *x = Decorator{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Decorator) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Decorator) ProtoMessage() {} - -func (x *Decorator) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Decorator.ProtoReflect.Descriptor instead. -func (*Decorator) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{14} -} - -func (x *Decorator) GetOperation() string { - if x != nil { - return x.Operation - } - return "" -} - -func (x *Decorator) GetPropagate() *wrapperspb.BoolValue { - if x != nil { - return x.Propagate - } - return nil -} - -type Tracing struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Target percentage of requests managed by this HTTP connection manager that will be force - // traced if the :ref:`x-client-trace-id ` - // header is set. This field is a direct analog for the runtime variable - // 'tracing.client_enabled' in the :ref:`HTTP Connection Manager - // `. - // Default: 100% - ClientSampling *v33.FractionalPercent `protobuf:"bytes,1,opt,name=client_sampling,json=clientSampling,proto3" json:"client_sampling,omitempty"` - // Target percentage of requests managed by this HTTP connection manager that will be randomly - // selected for trace generation, if not requested by the client or not forced. This field is - // a direct analog for the runtime variable 'tracing.random_sampling' in the - // :ref:`HTTP Connection Manager `. - // Default: 100% - RandomSampling *v33.FractionalPercent `protobuf:"bytes,2,opt,name=random_sampling,json=randomSampling,proto3" json:"random_sampling,omitempty"` - // Target percentage of requests managed by this HTTP connection manager that will be traced - // after all other sampling checks have been applied (client-directed, force tracing, random - // sampling). This field functions as an upper limit on the total configured sampling rate. For - // instance, setting client_sampling to 100% but overall_sampling to 1% will result in only 1% - // of client requests with the appropriate headers to be force traced. This field is a direct - // analog for the runtime variable 'tracing.global_enabled' in the - // :ref:`HTTP Connection Manager `. - // Default: 100% - OverallSampling *v33.FractionalPercent `protobuf:"bytes,3,opt,name=overall_sampling,json=overallSampling,proto3" json:"overall_sampling,omitempty"` - // A list of custom tags with unique tag name to create tags for the active span. - // It will take effect after merging with the :ref:`corresponding configuration - // ` - // configured in the HTTP connection manager. If two tags with the same name are configured - // each in the HTTP connection manager and the route level, the one configured here takes - // priority. - CustomTags []*v34.CustomTag `protobuf:"bytes,4,rep,name=custom_tags,json=customTags,proto3" json:"custom_tags,omitempty"` -} - -func (x *Tracing) Reset() { - *x = Tracing{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Tracing) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Tracing) ProtoMessage() {} - -func (x *Tracing) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Tracing.ProtoReflect.Descriptor instead. -func (*Tracing) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{15} -} - -func (x *Tracing) GetClientSampling() *v33.FractionalPercent { - if x != nil { - return x.ClientSampling - } - return nil -} - -func (x *Tracing) GetRandomSampling() *v33.FractionalPercent { - if x != nil { - return x.RandomSampling - } - return nil -} - -func (x *Tracing) GetOverallSampling() *v33.FractionalPercent { - if x != nil { - return x.OverallSampling - } - return nil -} - -func (x *Tracing) GetCustomTags() []*v34.CustomTag { - if x != nil { - return x.CustomTags - } - return nil -} - -// A virtual cluster is a way of specifying a regex matching rule against -// certain important endpoints such that statistics are generated explicitly for -// the matched requests. The reason this is useful is that when doing -// prefix/path matching Envoy does not always know what the application -// considers to be an endpoint. Thus, it’s impossible for Envoy to generically -// emit per endpoint statistics. However, often systems have highly critical -// endpoints that they wish to get “perfect” statistics on. Virtual cluster -// statistics are perfect in the sense that they are emitted on the downstream -// side such that they include network level failures. -// -// Documentation for :ref:`virtual cluster statistics `. -// -// .. note:: -// -// Virtual clusters are a useful tool, but we do not recommend setting up a virtual cluster for -// every application endpoint. This is both not easily maintainable and as well the matching and -// statistics output are not free. -type VirtualCluster struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Specifies a list of header matchers to use for matching requests. Each specified header must - // match. The pseudo-headers “:path“ and “:method“ can be used to match the request path and - // method, respectively. - Headers []*HeaderMatcher `protobuf:"bytes,4,rep,name=headers,proto3" json:"headers,omitempty"` - // Specifies the name of the virtual cluster. The virtual cluster name as well - // as the virtual host name are used when emitting statistics. The statistics are emitted by the - // router filter and are documented :ref:`here `. - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` -} - -func (x *VirtualCluster) Reset() { - *x = VirtualCluster{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *VirtualCluster) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*VirtualCluster) ProtoMessage() {} - -func (x *VirtualCluster) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use VirtualCluster.ProtoReflect.Descriptor instead. -func (*VirtualCluster) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{16} -} - -func (x *VirtualCluster) GetHeaders() []*HeaderMatcher { - if x != nil { - return x.Headers - } - return nil -} - -func (x *VirtualCluster) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -// Global rate limiting :ref:`architecture overview `. -// Also applies to Local rate limiting :ref:`using descriptors `. -type RateLimit struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Refers to the stage set in the filter. The rate limit configuration only - // applies to filters with the same stage number. The default stage number is - // 0. - // - // .. note:: - // - // The filter supports a range of 0 - 10 inclusively for stage numbers. - Stage *wrapperspb.UInt32Value `protobuf:"bytes,1,opt,name=stage,proto3" json:"stage,omitempty"` - // The key to be set in runtime to disable this rate limit configuration. - DisableKey string `protobuf:"bytes,2,opt,name=disable_key,json=disableKey,proto3" json:"disable_key,omitempty"` - // A list of actions that are to be applied for this rate limit configuration. - // Order matters as the actions are processed sequentially and the descriptor - // is composed by appending descriptor entries in that sequence. If an action - // cannot append a descriptor entry, no descriptor is generated for the - // configuration. See :ref:`composing actions - // ` for additional documentation. - Actions []*RateLimit_Action `protobuf:"bytes,3,rep,name=actions,proto3" json:"actions,omitempty"` - // An optional limit override to be appended to the descriptor produced by this - // rate limit configuration. If the override value is invalid or cannot be resolved - // from metadata, no override is provided. See :ref:`rate limit override - // ` for more information. - Limit *RateLimit_Override `protobuf:"bytes,4,opt,name=limit,proto3" json:"limit,omitempty"` -} - -func (x *RateLimit) Reset() { - *x = RateLimit{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RateLimit) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RateLimit) ProtoMessage() {} - -func (x *RateLimit) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RateLimit.ProtoReflect.Descriptor instead. -func (*RateLimit) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{17} -} - -func (x *RateLimit) GetStage() *wrapperspb.UInt32Value { - if x != nil { - return x.Stage - } - return nil -} - -func (x *RateLimit) GetDisableKey() string { - if x != nil { - return x.DisableKey - } - return "" -} - -func (x *RateLimit) GetActions() []*RateLimit_Action { - if x != nil { - return x.Actions - } - return nil -} - -func (x *RateLimit) GetLimit() *RateLimit_Override { - if x != nil { - return x.Limit - } - return nil -} - -// .. attention:: -// -// Internally, Envoy always uses the HTTP/2 ``:authority`` header to represent the HTTP/1 ``Host`` -// header. Thus, if attempting to match on ``Host``, match on ``:authority`` instead. -// -// .. attention:: -// -// To route on HTTP method, use the special HTTP/2 ``:method`` header. This works for both -// HTTP/1 and HTTP/2 as Envoy normalizes headers. E.g., -// -// .. code-block:: json -// -// { -// "name": ":method", -// "string_match": { -// "exact": "POST" -// } -// } -// -// .. attention:: -// -// In the absence of any header match specifier, match will default to :ref:`present_match -// `. i.e, a request that has the :ref:`name -// ` header will match, regardless of the header's -// value. -// -// [#next-major-version: HeaderMatcher should be refactored to use StringMatcher.] -// -// [#next-free-field: 15] -type HeaderMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Specifies the name of the header in the request. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Specifies how the header match will be performed to route the request. - // - // Types that are assignable to HeaderMatchSpecifier: - // - // *HeaderMatcher_ExactMatch - // *HeaderMatcher_SafeRegexMatch - // *HeaderMatcher_RangeMatch - // *HeaderMatcher_PresentMatch - // *HeaderMatcher_PrefixMatch - // *HeaderMatcher_SuffixMatch - // *HeaderMatcher_ContainsMatch - // *HeaderMatcher_StringMatch - HeaderMatchSpecifier isHeaderMatcher_HeaderMatchSpecifier `protobuf_oneof:"header_match_specifier"` - // If specified, the match result will be inverted before checking. Defaults to false. - // - // Examples: - // - // * The regex “\d{3}“ does not match the value “1234“, so it will match when inverted. - // * The range [-10,0) will match the value -1, so it will not match when inverted. - InvertMatch bool `protobuf:"varint,8,opt,name=invert_match,json=invertMatch,proto3" json:"invert_match,omitempty"` - // If specified, for any header match rule, if the header match rule specified header - // does not exist, this header value will be treated as empty. Defaults to false. - // - // Examples: - // - // - The header match rule specified header "header1" to range match of [0, 10], - // :ref:`invert_match ` - // is set to true and :ref:`treat_missing_header_as_empty ` - // is set to true; The "header1" header is not present. The match rule will - // treat the "header1" as an empty header. The empty header does not match the range, - // so it will match when inverted. - // - The header match rule specified header "header2" to range match of [0, 10], - // :ref:`invert_match ` - // is set to true and :ref:`treat_missing_header_as_empty ` - // is set to false; The "header2" header is not present and the header - // matcher rule for "header2" will be ignored so it will not match. - // - The header match rule specified header "header3" to a string regex match - // “^$“ which means an empty string, and - // :ref:`treat_missing_header_as_empty ` - // is set to true; The "header3" header is not present. - // The match rule will treat the "header3" header as an empty header so it will match. - // - The header match rule specified header "header4" to a string regex match - // “^$“ which means an empty string, and - // :ref:`treat_missing_header_as_empty ` - // is set to false; The "header4" header is not present. - // The match rule for "header4" will be ignored so it will not match. - TreatMissingHeaderAsEmpty bool `protobuf:"varint,14,opt,name=treat_missing_header_as_empty,json=treatMissingHeaderAsEmpty,proto3" json:"treat_missing_header_as_empty,omitempty"` -} - -func (x *HeaderMatcher) Reset() { - *x = HeaderMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HeaderMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HeaderMatcher) ProtoMessage() {} - -func (x *HeaderMatcher) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HeaderMatcher.ProtoReflect.Descriptor instead. -func (*HeaderMatcher) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{18} -} - -func (x *HeaderMatcher) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (m *HeaderMatcher) GetHeaderMatchSpecifier() isHeaderMatcher_HeaderMatchSpecifier { - if m != nil { - return m.HeaderMatchSpecifier - } - return nil -} - -// Deprecated: Do not use. -func (x *HeaderMatcher) GetExactMatch() string { - if x, ok := x.GetHeaderMatchSpecifier().(*HeaderMatcher_ExactMatch); ok { - return x.ExactMatch - } - return "" -} - -// Deprecated: Do not use. -func (x *HeaderMatcher) GetSafeRegexMatch() *v32.RegexMatcher { - if x, ok := x.GetHeaderMatchSpecifier().(*HeaderMatcher_SafeRegexMatch); ok { - return x.SafeRegexMatch - } - return nil -} - -func (x *HeaderMatcher) GetRangeMatch() *v33.Int64Range { - if x, ok := x.GetHeaderMatchSpecifier().(*HeaderMatcher_RangeMatch); ok { - return x.RangeMatch - } - return nil -} - -func (x *HeaderMatcher) GetPresentMatch() bool { - if x, ok := x.GetHeaderMatchSpecifier().(*HeaderMatcher_PresentMatch); ok { - return x.PresentMatch - } - return false -} - -// Deprecated: Do not use. -func (x *HeaderMatcher) GetPrefixMatch() string { - if x, ok := x.GetHeaderMatchSpecifier().(*HeaderMatcher_PrefixMatch); ok { - return x.PrefixMatch - } - return "" -} - -// Deprecated: Do not use. -func (x *HeaderMatcher) GetSuffixMatch() string { - if x, ok := x.GetHeaderMatchSpecifier().(*HeaderMatcher_SuffixMatch); ok { - return x.SuffixMatch - } - return "" -} - -// Deprecated: Do not use. -func (x *HeaderMatcher) GetContainsMatch() string { - if x, ok := x.GetHeaderMatchSpecifier().(*HeaderMatcher_ContainsMatch); ok { - return x.ContainsMatch - } - return "" -} - -func (x *HeaderMatcher) GetStringMatch() *v32.StringMatcher { - if x, ok := x.GetHeaderMatchSpecifier().(*HeaderMatcher_StringMatch); ok { - return x.StringMatch - } - return nil -} - -func (x *HeaderMatcher) GetInvertMatch() bool { - if x != nil { - return x.InvertMatch - } - return false -} - -func (x *HeaderMatcher) GetTreatMissingHeaderAsEmpty() bool { - if x != nil { - return x.TreatMissingHeaderAsEmpty - } - return false -} - -type isHeaderMatcher_HeaderMatchSpecifier interface { - isHeaderMatcher_HeaderMatchSpecifier() -} - -type HeaderMatcher_ExactMatch struct { - // If specified, header match will be performed based on the value of the header. - // This field is deprecated. Please use :ref:`string_match `. - // - // Deprecated: Do not use. - ExactMatch string `protobuf:"bytes,4,opt,name=exact_match,json=exactMatch,proto3,oneof"` -} - -type HeaderMatcher_SafeRegexMatch struct { - // If specified, this regex string is a regular expression rule which implies the entire request - // header value must match the regex. The rule will not match if only a subsequence of the - // request header value matches the regex. - // This field is deprecated. Please use :ref:`string_match `. - // - // Deprecated: Do not use. - SafeRegexMatch *v32.RegexMatcher `protobuf:"bytes,11,opt,name=safe_regex_match,json=safeRegexMatch,proto3,oneof"` -} - -type HeaderMatcher_RangeMatch struct { - // If specified, header match will be performed based on range. - // The rule will match if the request header value is within this range. - // The entire request header value must represent an integer in base 10 notation: consisting of - // an optional plus or minus sign followed by a sequence of digits. The rule will not match if - // the header value does not represent an integer. Match will fail for empty values, floating - // point numbers or if only a subsequence of the header value is an integer. - // - // Examples: - // - // - For range [-10,0), route will match for header value -1, but not for 0, “somestring“, 10.9, - // “-1somestring“ - RangeMatch *v33.Int64Range `protobuf:"bytes,6,opt,name=range_match,json=rangeMatch,proto3,oneof"` -} - -type HeaderMatcher_PresentMatch struct { - // If specified as true, header match will be performed based on whether the header is in the - // request. If specified as false, header match will be performed based on whether the header is absent. - PresentMatch bool `protobuf:"varint,7,opt,name=present_match,json=presentMatch,proto3,oneof"` -} - -type HeaderMatcher_PrefixMatch struct { - // If specified, header match will be performed based on the prefix of the header value. - // Note: empty prefix is not allowed, please use present_match instead. - // This field is deprecated. Please use :ref:`string_match `. - // - // Examples: - // - // * The prefix “abcd“ matches the value “abcdxyz“, but not for “abcxyz“. - // - // Deprecated: Do not use. - PrefixMatch string `protobuf:"bytes,9,opt,name=prefix_match,json=prefixMatch,proto3,oneof"` -} - -type HeaderMatcher_SuffixMatch struct { - // If specified, header match will be performed based on the suffix of the header value. - // Note: empty suffix is not allowed, please use present_match instead. - // This field is deprecated. Please use :ref:`string_match `. - // - // Examples: - // - // * The suffix “abcd“ matches the value “xyzabcd“, but not for “xyzbcd“. - // - // Deprecated: Do not use. - SuffixMatch string `protobuf:"bytes,10,opt,name=suffix_match,json=suffixMatch,proto3,oneof"` -} - -type HeaderMatcher_ContainsMatch struct { - // If specified, header match will be performed based on whether the header value contains - // the given value or not. - // Note: empty contains match is not allowed, please use present_match instead. - // This field is deprecated. Please use :ref:`string_match `. - // - // Examples: - // - // * The value “abcd“ matches the value “xyzabcdpqr“, but not for “xyzbcdpqr“. - // - // Deprecated: Do not use. - ContainsMatch string `protobuf:"bytes,12,opt,name=contains_match,json=containsMatch,proto3,oneof"` -} - -type HeaderMatcher_StringMatch struct { - // If specified, header match will be performed based on the string match of the header value. - StringMatch *v32.StringMatcher `protobuf:"bytes,13,opt,name=string_match,json=stringMatch,proto3,oneof"` -} - -func (*HeaderMatcher_ExactMatch) isHeaderMatcher_HeaderMatchSpecifier() {} - -func (*HeaderMatcher_SafeRegexMatch) isHeaderMatcher_HeaderMatchSpecifier() {} - -func (*HeaderMatcher_RangeMatch) isHeaderMatcher_HeaderMatchSpecifier() {} - -func (*HeaderMatcher_PresentMatch) isHeaderMatcher_HeaderMatchSpecifier() {} - -func (*HeaderMatcher_PrefixMatch) isHeaderMatcher_HeaderMatchSpecifier() {} - -func (*HeaderMatcher_SuffixMatch) isHeaderMatcher_HeaderMatchSpecifier() {} - -func (*HeaderMatcher_ContainsMatch) isHeaderMatcher_HeaderMatchSpecifier() {} - -func (*HeaderMatcher_StringMatch) isHeaderMatcher_HeaderMatchSpecifier() {} - -// Query parameter matching treats the query string of a request's :path header -// as an ampersand-separated list of keys and/or key=value elements. -// [#next-free-field: 7] -type QueryParameterMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Specifies the name of a key that must be present in the requested - // “path“'s query string. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Types that are assignable to QueryParameterMatchSpecifier: - // - // *QueryParameterMatcher_StringMatch - // *QueryParameterMatcher_PresentMatch - QueryParameterMatchSpecifier isQueryParameterMatcher_QueryParameterMatchSpecifier `protobuf_oneof:"query_parameter_match_specifier"` -} - -func (x *QueryParameterMatcher) Reset() { - *x = QueryParameterMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryParameterMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryParameterMatcher) ProtoMessage() {} - -func (x *QueryParameterMatcher) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use QueryParameterMatcher.ProtoReflect.Descriptor instead. -func (*QueryParameterMatcher) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{19} -} - -func (x *QueryParameterMatcher) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (m *QueryParameterMatcher) GetQueryParameterMatchSpecifier() isQueryParameterMatcher_QueryParameterMatchSpecifier { - if m != nil { - return m.QueryParameterMatchSpecifier - } - return nil -} - -func (x *QueryParameterMatcher) GetStringMatch() *v32.StringMatcher { - if x, ok := x.GetQueryParameterMatchSpecifier().(*QueryParameterMatcher_StringMatch); ok { - return x.StringMatch - } - return nil -} - -func (x *QueryParameterMatcher) GetPresentMatch() bool { - if x, ok := x.GetQueryParameterMatchSpecifier().(*QueryParameterMatcher_PresentMatch); ok { - return x.PresentMatch - } - return false -} - -type isQueryParameterMatcher_QueryParameterMatchSpecifier interface { - isQueryParameterMatcher_QueryParameterMatchSpecifier() -} - -type QueryParameterMatcher_StringMatch struct { - // Specifies whether a query parameter value should match against a string. - StringMatch *v32.StringMatcher `protobuf:"bytes,5,opt,name=string_match,json=stringMatch,proto3,oneof"` -} - -type QueryParameterMatcher_PresentMatch struct { - // Specifies whether a query parameter should be present. - PresentMatch bool `protobuf:"varint,6,opt,name=present_match,json=presentMatch,proto3,oneof"` -} - -func (*QueryParameterMatcher_StringMatch) isQueryParameterMatcher_QueryParameterMatchSpecifier() {} - -func (*QueryParameterMatcher_PresentMatch) isQueryParameterMatcher_QueryParameterMatchSpecifier() {} - -// HTTP Internal Redirect :ref:`architecture overview `. -// [#next-free-field: 6] -type InternalRedirectPolicy struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // An internal redirect is not handled, unless the number of previous internal redirects that a - // downstream request has encountered is lower than this value. - // In the case where a downstream request is bounced among multiple routes by internal redirect, - // the first route that hits this threshold, or does not set :ref:`internal_redirect_policy - // ` - // will pass the redirect back to downstream. - // - // If not specified, at most one redirect will be followed. - MaxInternalRedirects *wrapperspb.UInt32Value `protobuf:"bytes,1,opt,name=max_internal_redirects,json=maxInternalRedirects,proto3" json:"max_internal_redirects,omitempty"` - // Defines what upstream response codes are allowed to trigger internal redirect. If unspecified, - // only 302 will be treated as internal redirect. - // Only 301, 302, 303, 307 and 308 are valid values. Any other codes will be ignored. - RedirectResponseCodes []uint32 `protobuf:"varint,2,rep,packed,name=redirect_response_codes,json=redirectResponseCodes,proto3" json:"redirect_response_codes,omitempty"` - // Specifies a list of predicates that are queried when an upstream response is deemed - // to trigger an internal redirect by all other criteria. Any predicate in the list can reject - // the redirect, causing the response to be proxied to downstream. - // [#extension-category: envoy.internal_redirect_predicates] - Predicates []*v31.TypedExtensionConfig `protobuf:"bytes,3,rep,name=predicates,proto3" json:"predicates,omitempty"` - // Allow internal redirect to follow a target URI with a different scheme than the value of - // x-forwarded-proto. The default is false. - AllowCrossSchemeRedirect bool `protobuf:"varint,4,opt,name=allow_cross_scheme_redirect,json=allowCrossSchemeRedirect,proto3" json:"allow_cross_scheme_redirect,omitempty"` - // Specifies a list of headers, by name, to copy from the internal redirect into the subsequent - // request. If a header is specified here but not present in the redirect, it will be cleared in - // the subsequent request. - ResponseHeadersToCopy []string `protobuf:"bytes,5,rep,name=response_headers_to_copy,json=responseHeadersToCopy,proto3" json:"response_headers_to_copy,omitempty"` -} - -func (x *InternalRedirectPolicy) Reset() { - *x = InternalRedirectPolicy{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InternalRedirectPolicy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InternalRedirectPolicy) ProtoMessage() {} - -func (x *InternalRedirectPolicy) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InternalRedirectPolicy.ProtoReflect.Descriptor instead. -func (*InternalRedirectPolicy) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{20} -} - -func (x *InternalRedirectPolicy) GetMaxInternalRedirects() *wrapperspb.UInt32Value { - if x != nil { - return x.MaxInternalRedirects - } - return nil -} - -func (x *InternalRedirectPolicy) GetRedirectResponseCodes() []uint32 { - if x != nil { - return x.RedirectResponseCodes - } - return nil -} - -func (x *InternalRedirectPolicy) GetPredicates() []*v31.TypedExtensionConfig { - if x != nil { - return x.Predicates - } - return nil -} - -func (x *InternalRedirectPolicy) GetAllowCrossSchemeRedirect() bool { - if x != nil { - return x.AllowCrossSchemeRedirect - } - return false -} - -func (x *InternalRedirectPolicy) GetResponseHeadersToCopy() []string { - if x != nil { - return x.ResponseHeadersToCopy - } - return nil -} - -// A simple wrapper for an HTTP filter config. This is intended to be used as a wrapper for the -// map value in -// :ref:`VirtualHost.typed_per_filter_config`, -// :ref:`Route.typed_per_filter_config`, -// or :ref:`WeightedCluster.ClusterWeight.typed_per_filter_config` -// to add additional flags to the filter. -type FilterConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The filter config. - Config *anypb.Any `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"` - // If true, the filter is optional, meaning that if the client does - // not support the specified filter, it may ignore the map entry rather - // than rejecting the config. - IsOptional bool `protobuf:"varint,2,opt,name=is_optional,json=isOptional,proto3" json:"is_optional,omitempty"` - // If true, the filter is disabled in the route or virtual host and the “config“ field is ignored. - // See :ref:`route based filter chain ` - // for more details. - // - // .. note:: - // - // This field will take effect when the request arrive and filter chain is created for the request. - // If initial route is selected for the request and a filter is disabled in the initial route, then - // the filter will not be added to the filter chain. - // And if the request is mutated later and re-match to another route, the disabled filter by the - // initial route will not be added back to the filter chain because the filter chain is already - // created and it is too late to change the chain. - // - // This field only make sense for the downstream HTTP filters for now. - Disabled bool `protobuf:"varint,3,opt,name=disabled,proto3" json:"disabled,omitempty"` -} - -func (x *FilterConfig) Reset() { - *x = FilterConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FilterConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FilterConfig) ProtoMessage() {} - -func (x *FilterConfig) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FilterConfig.ProtoReflect.Descriptor instead. -func (*FilterConfig) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{21} -} - -func (x *FilterConfig) GetConfig() *anypb.Any { - if x != nil { - return x.Config - } - return nil -} - -func (x *FilterConfig) GetIsOptional() bool { - if x != nil { - return x.IsOptional - } - return false -} - -func (x *FilterConfig) GetDisabled() bool { - if x != nil { - return x.Disabled - } - return false -} - -// [#next-free-field: 13] -type WeightedCluster_ClusterWeight struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Only one of “name“ and “cluster_header“ may be specified. - // [#next-major-version: Need to add back the validation rule: (validate.rules).string = {min_len: 1}] - // Name of the upstream cluster. The cluster must exist in the - // :ref:`cluster manager configuration `. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Only one of “name“ and “cluster_header“ may be specified. - // [#next-major-version: Need to add back the validation rule: (validate.rules).string = {min_len: 1 }] - // Envoy will determine the cluster to route to by reading the value of the - // HTTP header named by cluster_header from the request headers. If the - // header is not found or the referenced cluster does not exist, Envoy will - // return a 404 response. - // - // .. attention:: - // - // Internally, Envoy always uses the HTTP/2 ``:authority`` header to represent the HTTP/1 - // ``Host`` header. Thus, if attempting to match on ``Host``, match on ``:authority`` instead. - // - // .. note:: - // - // If the header appears multiple times only the first value is used. - ClusterHeader string `protobuf:"bytes,12,opt,name=cluster_header,json=clusterHeader,proto3" json:"cluster_header,omitempty"` - // The weight of the cluster. This value is relative to the other clusters' - // weights. When a request matches the route, the choice of an upstream cluster - // is determined by its weight. The sum of weights across all - // entries in the clusters array must be greater than 0, and must not exceed - // uint32_t maximal value (4294967295). - Weight *wrapperspb.UInt32Value `protobuf:"bytes,2,opt,name=weight,proto3" json:"weight,omitempty"` - // Optional endpoint metadata match criteria used by the subset load balancer. Only endpoints in - // the upstream cluster with metadata matching what is set in this field will be considered for - // load balancing. Note that this will be merged with what's provided in - // :ref:`RouteAction.metadata_match `, with - // values here taking precedence. The filter name should be specified as “envoy.lb“. - MetadataMatch *v31.Metadata `protobuf:"bytes,3,opt,name=metadata_match,json=metadataMatch,proto3" json:"metadata_match,omitempty"` - // Specifies a list of headers to be added to requests when this cluster is selected - // through the enclosing :ref:`envoy_v3_api_msg_config.route.v3.RouteAction`. - // Headers specified at this level are applied before headers from the enclosing - // :ref:`envoy_v3_api_msg_config.route.v3.Route`, :ref:`envoy_v3_api_msg_config.route.v3.VirtualHost`, and - // :ref:`envoy_v3_api_msg_config.route.v3.RouteConfiguration`. For more information, including details on - // header value syntax, see the documentation on :ref:`custom request headers - // `. - RequestHeadersToAdd []*v31.HeaderValueOption `protobuf:"bytes,4,rep,name=request_headers_to_add,json=requestHeadersToAdd,proto3" json:"request_headers_to_add,omitempty"` - // Specifies a list of HTTP headers that should be removed from each request when - // this cluster is selected through the enclosing :ref:`envoy_v3_api_msg_config.route.v3.RouteAction`. - RequestHeadersToRemove []string `protobuf:"bytes,9,rep,name=request_headers_to_remove,json=requestHeadersToRemove,proto3" json:"request_headers_to_remove,omitempty"` - // Specifies a list of headers to be added to responses when this cluster is selected - // through the enclosing :ref:`envoy_v3_api_msg_config.route.v3.RouteAction`. - // Headers specified at this level are applied before headers from the enclosing - // :ref:`envoy_v3_api_msg_config.route.v3.Route`, :ref:`envoy_v3_api_msg_config.route.v3.VirtualHost`, and - // :ref:`envoy_v3_api_msg_config.route.v3.RouteConfiguration`. For more information, including details on - // header value syntax, see the documentation on :ref:`custom request headers - // `. - ResponseHeadersToAdd []*v31.HeaderValueOption `protobuf:"bytes,5,rep,name=response_headers_to_add,json=responseHeadersToAdd,proto3" json:"response_headers_to_add,omitempty"` - // Specifies a list of headers to be removed from responses when this cluster is selected - // through the enclosing :ref:`envoy_v3_api_msg_config.route.v3.RouteAction`. - ResponseHeadersToRemove []string `protobuf:"bytes,6,rep,name=response_headers_to_remove,json=responseHeadersToRemove,proto3" json:"response_headers_to_remove,omitempty"` - // This field can be used to provide weighted cluster specific per filter config. The key should match the - // :ref:`filter config name - // `. - // See :ref:`Http filter route specific config ` - // for details. - // [#comment: An entry's value may be wrapped in a - // :ref:`FilterConfig` - // message to specify additional options.] - TypedPerFilterConfig map[string]*anypb.Any `protobuf:"bytes,10,rep,name=typed_per_filter_config,json=typedPerFilterConfig,proto3" json:"typed_per_filter_config,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // Types that are assignable to HostRewriteSpecifier: - // - // *WeightedCluster_ClusterWeight_HostRewriteLiteral - HostRewriteSpecifier isWeightedCluster_ClusterWeight_HostRewriteSpecifier `protobuf_oneof:"host_rewrite_specifier"` -} - -func (x *WeightedCluster_ClusterWeight) Reset() { - *x = WeightedCluster_ClusterWeight{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WeightedCluster_ClusterWeight) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WeightedCluster_ClusterWeight) ProtoMessage() {} - -func (x *WeightedCluster_ClusterWeight) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WeightedCluster_ClusterWeight.ProtoReflect.Descriptor instead. -func (*WeightedCluster_ClusterWeight) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{4, 0} -} - -func (x *WeightedCluster_ClusterWeight) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *WeightedCluster_ClusterWeight) GetClusterHeader() string { - if x != nil { - return x.ClusterHeader - } - return "" -} - -func (x *WeightedCluster_ClusterWeight) GetWeight() *wrapperspb.UInt32Value { - if x != nil { - return x.Weight - } - return nil -} - -func (x *WeightedCluster_ClusterWeight) GetMetadataMatch() *v31.Metadata { - if x != nil { - return x.MetadataMatch - } - return nil -} - -func (x *WeightedCluster_ClusterWeight) GetRequestHeadersToAdd() []*v31.HeaderValueOption { - if x != nil { - return x.RequestHeadersToAdd - } - return nil -} - -func (x *WeightedCluster_ClusterWeight) GetRequestHeadersToRemove() []string { - if x != nil { - return x.RequestHeadersToRemove - } - return nil -} - -func (x *WeightedCluster_ClusterWeight) GetResponseHeadersToAdd() []*v31.HeaderValueOption { - if x != nil { - return x.ResponseHeadersToAdd - } - return nil -} - -func (x *WeightedCluster_ClusterWeight) GetResponseHeadersToRemove() []string { - if x != nil { - return x.ResponseHeadersToRemove - } - return nil -} - -func (x *WeightedCluster_ClusterWeight) GetTypedPerFilterConfig() map[string]*anypb.Any { - if x != nil { - return x.TypedPerFilterConfig - } - return nil -} - -func (m *WeightedCluster_ClusterWeight) GetHostRewriteSpecifier() isWeightedCluster_ClusterWeight_HostRewriteSpecifier { - if m != nil { - return m.HostRewriteSpecifier - } - return nil -} - -func (x *WeightedCluster_ClusterWeight) GetHostRewriteLiteral() string { - if x, ok := x.GetHostRewriteSpecifier().(*WeightedCluster_ClusterWeight_HostRewriteLiteral); ok { - return x.HostRewriteLiteral - } - return "" -} - -type isWeightedCluster_ClusterWeight_HostRewriteSpecifier interface { - isWeightedCluster_ClusterWeight_HostRewriteSpecifier() -} - -type WeightedCluster_ClusterWeight_HostRewriteLiteral struct { - // Indicates that during forwarding, the host header will be swapped with - // this value. - HostRewriteLiteral string `protobuf:"bytes,11,opt,name=host_rewrite_literal,json=hostRewriteLiteral,proto3,oneof"` -} - -func (*WeightedCluster_ClusterWeight_HostRewriteLiteral) isWeightedCluster_ClusterWeight_HostRewriteSpecifier() { -} - -type RouteMatch_GrpcRouteMatchOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *RouteMatch_GrpcRouteMatchOptions) Reset() { - *x = RouteMatch_GrpcRouteMatchOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RouteMatch_GrpcRouteMatchOptions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RouteMatch_GrpcRouteMatchOptions) ProtoMessage() {} - -func (x *RouteMatch_GrpcRouteMatchOptions) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[26] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RouteMatch_GrpcRouteMatchOptions.ProtoReflect.Descriptor instead. -func (*RouteMatch_GrpcRouteMatchOptions) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{6, 0} -} - -type RouteMatch_TlsContextMatchOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // If specified, the route will match against whether or not a certificate is presented. - // If not specified, certificate presentation status (true or false) will not be considered when route matching. - Presented *wrapperspb.BoolValue `protobuf:"bytes,1,opt,name=presented,proto3" json:"presented,omitempty"` - // If specified, the route will match against whether or not a certificate is validated. - // If not specified, certificate validation status (true or false) will not be considered when route matching. - // - // .. warning:: - // - // Client certificate validation is not currently performed upon TLS session resumption. For - // a resumed TLS session the route will match only when ``validated`` is false, regardless of - // whether the client TLS certificate is valid. - // - // The only known workaround for this issue is to disable TLS session resumption entirely, by - // setting both :ref:`disable_stateless_session_resumption ` - // and :ref:`disable_stateful_session_resumption ` on the DownstreamTlsContext. - Validated *wrapperspb.BoolValue `protobuf:"bytes,2,opt,name=validated,proto3" json:"validated,omitempty"` -} - -func (x *RouteMatch_TlsContextMatchOptions) Reset() { - *x = RouteMatch_TlsContextMatchOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RouteMatch_TlsContextMatchOptions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RouteMatch_TlsContextMatchOptions) ProtoMessage() {} - -func (x *RouteMatch_TlsContextMatchOptions) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[27] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RouteMatch_TlsContextMatchOptions.ProtoReflect.Descriptor instead. -func (*RouteMatch_TlsContextMatchOptions) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{6, 1} -} - -func (x *RouteMatch_TlsContextMatchOptions) GetPresented() *wrapperspb.BoolValue { - if x != nil { - return x.Presented - } - return nil -} - -func (x *RouteMatch_TlsContextMatchOptions) GetValidated() *wrapperspb.BoolValue { - if x != nil { - return x.Validated - } - return nil -} - -// An extensible message for matching CONNECT or CONNECT-UDP requests. -type RouteMatch_ConnectMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *RouteMatch_ConnectMatcher) Reset() { - *x = RouteMatch_ConnectMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RouteMatch_ConnectMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RouteMatch_ConnectMatcher) ProtoMessage() {} - -func (x *RouteMatch_ConnectMatcher) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RouteMatch_ConnectMatcher.ProtoReflect.Descriptor instead. -func (*RouteMatch_ConnectMatcher) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{6, 2} -} - -// The router is capable of shadowing traffic from one cluster to another. The current -// implementation is "fire and forget," meaning Envoy will not wait for the shadow cluster to -// respond before returning the response from the primary cluster. All normal statistics are -// collected for the shadow cluster making this feature useful for testing. -// -// During shadowing, the host/authority header is altered such that “-shadow“ is appended. This is -// useful for logging. For example, “cluster1“ becomes “cluster1-shadow“. -// -// .. note:: -// -// Shadowing will not be triggered if the primary cluster does not exist. -// -// .. note:: -// -// Shadowing doesn't support Http CONNECT and upgrades. -// -// [#next-free-field: 6] -type RouteAction_RequestMirrorPolicy struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Only one of “cluster“ and “cluster_header“ can be specified. - // [#next-major-version: Need to add back the validation rule: (validate.rules).string = {min_len: 1}] - // Specifies the cluster that requests will be mirrored to. The cluster must - // exist in the cluster manager configuration. - Cluster string `protobuf:"bytes,1,opt,name=cluster,proto3" json:"cluster,omitempty"` - // Only one of “cluster“ and “cluster_header“ can be specified. - // Envoy will determine the cluster to route to by reading the value of the - // HTTP header named by cluster_header from the request headers. Only the first value in header is used, - // and no shadow request will happen if the value is not found in headers. Envoy will not wait for - // the shadow cluster to respond before returning the response from the primary cluster. - // - // .. attention:: - // - // Internally, Envoy always uses the HTTP/2 ``:authority`` header to represent the HTTP/1 - // ``Host`` header. Thus, if attempting to match on ``Host``, match on ``:authority`` instead. - // - // .. note:: - // - // If the header appears multiple times only the first value is used. - ClusterHeader string `protobuf:"bytes,5,opt,name=cluster_header,json=clusterHeader,proto3" json:"cluster_header,omitempty"` - // If not specified, all requests to the target cluster will be mirrored. - // - // If specified, this field takes precedence over the “runtime_key“ field and requests must also - // fall under the percentage of matches indicated by this field. - // - // For some fraction N/D, a random number in the range [0,D) is selected. If the - // number is <= the value of the numerator N, or if the key is not present, the default - // value, the request will be mirrored. - RuntimeFraction *v31.RuntimeFractionalPercent `protobuf:"bytes,3,opt,name=runtime_fraction,json=runtimeFraction,proto3" json:"runtime_fraction,omitempty"` - // Determines if the trace span should be sampled. Defaults to true. - TraceSampled *wrapperspb.BoolValue `protobuf:"bytes,4,opt,name=trace_sampled,json=traceSampled,proto3" json:"trace_sampled,omitempty"` -} - -func (x *RouteAction_RequestMirrorPolicy) Reset() { - *x = RouteAction_RequestMirrorPolicy{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RouteAction_RequestMirrorPolicy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RouteAction_RequestMirrorPolicy) ProtoMessage() {} - -func (x *RouteAction_RequestMirrorPolicy) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[29] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RouteAction_RequestMirrorPolicy.ProtoReflect.Descriptor instead. -func (*RouteAction_RequestMirrorPolicy) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{8, 0} -} - -func (x *RouteAction_RequestMirrorPolicy) GetCluster() string { - if x != nil { - return x.Cluster - } - return "" -} - -func (x *RouteAction_RequestMirrorPolicy) GetClusterHeader() string { - if x != nil { - return x.ClusterHeader - } - return "" -} - -func (x *RouteAction_RequestMirrorPolicy) GetRuntimeFraction() *v31.RuntimeFractionalPercent { - if x != nil { - return x.RuntimeFraction - } - return nil -} - -func (x *RouteAction_RequestMirrorPolicy) GetTraceSampled() *wrapperspb.BoolValue { - if x != nil { - return x.TraceSampled - } - return nil -} - -// Specifies the route's hashing policy if the upstream cluster uses a hashing :ref:`load balancer -// `. -// [#next-free-field: 7] -type RouteAction_HashPolicy struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to PolicySpecifier: - // - // *RouteAction_HashPolicy_Header_ - // *RouteAction_HashPolicy_Cookie_ - // *RouteAction_HashPolicy_ConnectionProperties_ - // *RouteAction_HashPolicy_QueryParameter_ - // *RouteAction_HashPolicy_FilterState_ - PolicySpecifier isRouteAction_HashPolicy_PolicySpecifier `protobuf_oneof:"policy_specifier"` - // The flag that short-circuits the hash computing. This field provides a - // 'fallback' style of configuration: "if a terminal policy doesn't work, - // fallback to rest of the policy list", it saves time when the terminal - // policy works. - // - // If true, and there is already a hash computed, ignore rest of the - // list of hash polices. - // For example, if the following hash methods are configured: - // - // ========= ======== - // specifier terminal - // ========= ======== - // Header A true - // Header B false - // Header C false - // ========= ======== - // - // The generateHash process ends if policy "header A" generates a hash, as - // it's a terminal policy. - Terminal bool `protobuf:"varint,4,opt,name=terminal,proto3" json:"terminal,omitempty"` -} - -func (x *RouteAction_HashPolicy) Reset() { - *x = RouteAction_HashPolicy{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RouteAction_HashPolicy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RouteAction_HashPolicy) ProtoMessage() {} - -func (x *RouteAction_HashPolicy) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[30] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RouteAction_HashPolicy.ProtoReflect.Descriptor instead. -func (*RouteAction_HashPolicy) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{8, 1} -} - -func (m *RouteAction_HashPolicy) GetPolicySpecifier() isRouteAction_HashPolicy_PolicySpecifier { - if m != nil { - return m.PolicySpecifier - } - return nil -} - -func (x *RouteAction_HashPolicy) GetHeader() *RouteAction_HashPolicy_Header { - if x, ok := x.GetPolicySpecifier().(*RouteAction_HashPolicy_Header_); ok { - return x.Header - } - return nil -} - -func (x *RouteAction_HashPolicy) GetCookie() *RouteAction_HashPolicy_Cookie { - if x, ok := x.GetPolicySpecifier().(*RouteAction_HashPolicy_Cookie_); ok { - return x.Cookie - } - return nil -} - -func (x *RouteAction_HashPolicy) GetConnectionProperties() *RouteAction_HashPolicy_ConnectionProperties { - if x, ok := x.GetPolicySpecifier().(*RouteAction_HashPolicy_ConnectionProperties_); ok { - return x.ConnectionProperties - } - return nil -} - -func (x *RouteAction_HashPolicy) GetQueryParameter() *RouteAction_HashPolicy_QueryParameter { - if x, ok := x.GetPolicySpecifier().(*RouteAction_HashPolicy_QueryParameter_); ok { - return x.QueryParameter - } - return nil -} - -func (x *RouteAction_HashPolicy) GetFilterState() *RouteAction_HashPolicy_FilterState { - if x, ok := x.GetPolicySpecifier().(*RouteAction_HashPolicy_FilterState_); ok { - return x.FilterState - } - return nil -} - -func (x *RouteAction_HashPolicy) GetTerminal() bool { - if x != nil { - return x.Terminal - } - return false -} - -type isRouteAction_HashPolicy_PolicySpecifier interface { - isRouteAction_HashPolicy_PolicySpecifier() -} - -type RouteAction_HashPolicy_Header_ struct { - // Header hash policy. - Header *RouteAction_HashPolicy_Header `protobuf:"bytes,1,opt,name=header,proto3,oneof"` -} - -type RouteAction_HashPolicy_Cookie_ struct { - // Cookie hash policy. - Cookie *RouteAction_HashPolicy_Cookie `protobuf:"bytes,2,opt,name=cookie,proto3,oneof"` -} - -type RouteAction_HashPolicy_ConnectionProperties_ struct { - // Connection properties hash policy. - ConnectionProperties *RouteAction_HashPolicy_ConnectionProperties `protobuf:"bytes,3,opt,name=connection_properties,json=connectionProperties,proto3,oneof"` -} - -type RouteAction_HashPolicy_QueryParameter_ struct { - // Query parameter hash policy. - QueryParameter *RouteAction_HashPolicy_QueryParameter `protobuf:"bytes,5,opt,name=query_parameter,json=queryParameter,proto3,oneof"` -} - -type RouteAction_HashPolicy_FilterState_ struct { - // Filter state hash policy. - FilterState *RouteAction_HashPolicy_FilterState `protobuf:"bytes,6,opt,name=filter_state,json=filterState,proto3,oneof"` -} - -func (*RouteAction_HashPolicy_Header_) isRouteAction_HashPolicy_PolicySpecifier() {} - -func (*RouteAction_HashPolicy_Cookie_) isRouteAction_HashPolicy_PolicySpecifier() {} - -func (*RouteAction_HashPolicy_ConnectionProperties_) isRouteAction_HashPolicy_PolicySpecifier() {} - -func (*RouteAction_HashPolicy_QueryParameter_) isRouteAction_HashPolicy_PolicySpecifier() {} - -func (*RouteAction_HashPolicy_FilterState_) isRouteAction_HashPolicy_PolicySpecifier() {} - -// Allows enabling and disabling upgrades on a per-route basis. -// This overrides any enabled/disabled upgrade filter chain specified in the -// HttpConnectionManager -// :ref:`upgrade_configs -// ` -// but does not affect any custom filter chain specified there. -type RouteAction_UpgradeConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The case-insensitive name of this upgrade, e.g. "websocket". - // For each upgrade type present in upgrade_configs, requests with - // Upgrade: [upgrade_type] will be proxied upstream. - UpgradeType string `protobuf:"bytes,1,opt,name=upgrade_type,json=upgradeType,proto3" json:"upgrade_type,omitempty"` - // Determines if upgrades are available on this route. Defaults to true. - Enabled *wrapperspb.BoolValue `protobuf:"bytes,2,opt,name=enabled,proto3" json:"enabled,omitempty"` - // Configuration for sending data upstream as a raw data payload. This is used for - // CONNECT requests, when forwarding CONNECT payload as raw TCP. - // Note that CONNECT support is currently considered alpha in Envoy. - // [#comment: TODO(htuch): Replace the above comment with an alpha tag.] - ConnectConfig *RouteAction_UpgradeConfig_ConnectConfig `protobuf:"bytes,3,opt,name=connect_config,json=connectConfig,proto3" json:"connect_config,omitempty"` -} - -func (x *RouteAction_UpgradeConfig) Reset() { - *x = RouteAction_UpgradeConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[31] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RouteAction_UpgradeConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RouteAction_UpgradeConfig) ProtoMessage() {} - -func (x *RouteAction_UpgradeConfig) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[31] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RouteAction_UpgradeConfig.ProtoReflect.Descriptor instead. -func (*RouteAction_UpgradeConfig) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{8, 2} -} - -func (x *RouteAction_UpgradeConfig) GetUpgradeType() string { - if x != nil { - return x.UpgradeType - } - return "" -} - -func (x *RouteAction_UpgradeConfig) GetEnabled() *wrapperspb.BoolValue { - if x != nil { - return x.Enabled - } - return nil -} - -func (x *RouteAction_UpgradeConfig) GetConnectConfig() *RouteAction_UpgradeConfig_ConnectConfig { - if x != nil { - return x.ConnectConfig - } - return nil -} - -type RouteAction_MaxStreamDuration struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Specifies the maximum duration allowed for streams on the route. If not specified, the value - // from the :ref:`max_stream_duration - // ` field in - // :ref:`HttpConnectionManager.common_http_protocol_options - // ` - // is used. If this field is set explicitly to zero, any - // HttpConnectionManager max_stream_duration timeout will be disabled for - // this route. - MaxStreamDuration *durationpb.Duration `protobuf:"bytes,1,opt,name=max_stream_duration,json=maxStreamDuration,proto3" json:"max_stream_duration,omitempty"` - // If present, and the request contains a `grpc-timeout header - // `_, use that value as the - // “max_stream_duration“, but limit the applied timeout to the maximum value specified here. - // If set to 0, the “grpc-timeout“ header is used without modification. - GrpcTimeoutHeaderMax *durationpb.Duration `protobuf:"bytes,2,opt,name=grpc_timeout_header_max,json=grpcTimeoutHeaderMax,proto3" json:"grpc_timeout_header_max,omitempty"` - // If present, Envoy will adjust the timeout provided by the “grpc-timeout“ header by - // subtracting the provided duration from the header. This is useful for allowing Envoy to set - // its global timeout to be less than that of the deadline imposed by the calling client, which - // makes it more likely that Envoy will handle the timeout instead of having the call canceled - // by the client. If, after applying the offset, the resulting timeout is zero or negative, - // the stream will timeout immediately. - GrpcTimeoutHeaderOffset *durationpb.Duration `protobuf:"bytes,3,opt,name=grpc_timeout_header_offset,json=grpcTimeoutHeaderOffset,proto3" json:"grpc_timeout_header_offset,omitempty"` -} - -func (x *RouteAction_MaxStreamDuration) Reset() { - *x = RouteAction_MaxStreamDuration{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[32] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RouteAction_MaxStreamDuration) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RouteAction_MaxStreamDuration) ProtoMessage() {} - -func (x *RouteAction_MaxStreamDuration) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[32] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RouteAction_MaxStreamDuration.ProtoReflect.Descriptor instead. -func (*RouteAction_MaxStreamDuration) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{8, 3} -} - -func (x *RouteAction_MaxStreamDuration) GetMaxStreamDuration() *durationpb.Duration { - if x != nil { - return x.MaxStreamDuration - } - return nil -} - -func (x *RouteAction_MaxStreamDuration) GetGrpcTimeoutHeaderMax() *durationpb.Duration { - if x != nil { - return x.GrpcTimeoutHeaderMax - } - return nil -} - -func (x *RouteAction_MaxStreamDuration) GetGrpcTimeoutHeaderOffset() *durationpb.Duration { - if x != nil { - return x.GrpcTimeoutHeaderOffset - } - return nil -} - -type RouteAction_HashPolicy_Header struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of the request header that will be used to obtain the hash - // key. If the request header is not present, no hash will be produced. - HeaderName string `protobuf:"bytes,1,opt,name=header_name,json=headerName,proto3" json:"header_name,omitempty"` - // If specified, the request header value will be rewritten and used - // to produce the hash key. - RegexRewrite *v32.RegexMatchAndSubstitute `protobuf:"bytes,2,opt,name=regex_rewrite,json=regexRewrite,proto3" json:"regex_rewrite,omitempty"` -} - -func (x *RouteAction_HashPolicy_Header) Reset() { - *x = RouteAction_HashPolicy_Header{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[33] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RouteAction_HashPolicy_Header) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RouteAction_HashPolicy_Header) ProtoMessage() {} - -func (x *RouteAction_HashPolicy_Header) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[33] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RouteAction_HashPolicy_Header.ProtoReflect.Descriptor instead. -func (*RouteAction_HashPolicy_Header) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{8, 1, 0} -} - -func (x *RouteAction_HashPolicy_Header) GetHeaderName() string { - if x != nil { - return x.HeaderName - } - return "" -} - -func (x *RouteAction_HashPolicy_Header) GetRegexRewrite() *v32.RegexMatchAndSubstitute { - if x != nil { - return x.RegexRewrite - } - return nil -} - -// CookieAttribute defines an API for adding additional attributes for a HTTP cookie. -type RouteAction_HashPolicy_CookieAttribute struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of the cookie attribute. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The optional value of the cookie attribute. - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *RouteAction_HashPolicy_CookieAttribute) Reset() { - *x = RouteAction_HashPolicy_CookieAttribute{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[34] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RouteAction_HashPolicy_CookieAttribute) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RouteAction_HashPolicy_CookieAttribute) ProtoMessage() {} - -func (x *RouteAction_HashPolicy_CookieAttribute) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[34] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RouteAction_HashPolicy_CookieAttribute.ProtoReflect.Descriptor instead. -func (*RouteAction_HashPolicy_CookieAttribute) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{8, 1, 1} -} - -func (x *RouteAction_HashPolicy_CookieAttribute) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *RouteAction_HashPolicy_CookieAttribute) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -// Envoy supports two types of cookie affinity: -// -// 1. Passive. Envoy takes a cookie that's present in the cookies header and -// hashes on its value. -// -// 2. Generated. Envoy generates and sets a cookie with an expiration (TTL) -// on the first request from the client in its response to the client, -// based on the endpoint the request gets sent to. The client then -// presents this on the next and all subsequent requests. The hash of -// this is sufficient to ensure these requests get sent to the same -// endpoint. The cookie is generated by hashing the source and -// destination ports and addresses so that multiple independent HTTP2 -// streams on the same connection will independently receive the same -// cookie, even if they arrive at the Envoy simultaneously. -type RouteAction_HashPolicy_Cookie struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of the cookie that will be used to obtain the hash key. If the - // cookie is not present and ttl below is not set, no hash will be - // produced. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // If specified, a cookie with the TTL will be generated if the cookie is - // not present. If the TTL is present and zero, the generated cookie will - // be a session cookie. - Ttl *durationpb.Duration `protobuf:"bytes,2,opt,name=ttl,proto3" json:"ttl,omitempty"` - // The name of the path for the cookie. If no path is specified here, no path - // will be set for the cookie. - Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"` - // Additional attributes for the cookie. They will be used when generating a new cookie. - Attributes []*RouteAction_HashPolicy_CookieAttribute `protobuf:"bytes,4,rep,name=attributes,proto3" json:"attributes,omitempty"` -} - -func (x *RouteAction_HashPolicy_Cookie) Reset() { - *x = RouteAction_HashPolicy_Cookie{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[35] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RouteAction_HashPolicy_Cookie) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RouteAction_HashPolicy_Cookie) ProtoMessage() {} - -func (x *RouteAction_HashPolicy_Cookie) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[35] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RouteAction_HashPolicy_Cookie.ProtoReflect.Descriptor instead. -func (*RouteAction_HashPolicy_Cookie) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{8, 1, 2} -} - -func (x *RouteAction_HashPolicy_Cookie) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *RouteAction_HashPolicy_Cookie) GetTtl() *durationpb.Duration { - if x != nil { - return x.Ttl - } - return nil -} - -func (x *RouteAction_HashPolicy_Cookie) GetPath() string { - if x != nil { - return x.Path - } - return "" -} - -func (x *RouteAction_HashPolicy_Cookie) GetAttributes() []*RouteAction_HashPolicy_CookieAttribute { - if x != nil { - return x.Attributes - } - return nil -} - -type RouteAction_HashPolicy_ConnectionProperties struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Hash on source IP address. - SourceIp bool `protobuf:"varint,1,opt,name=source_ip,json=sourceIp,proto3" json:"source_ip,omitempty"` -} - -func (x *RouteAction_HashPolicy_ConnectionProperties) Reset() { - *x = RouteAction_HashPolicy_ConnectionProperties{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[36] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RouteAction_HashPolicy_ConnectionProperties) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RouteAction_HashPolicy_ConnectionProperties) ProtoMessage() {} - -func (x *RouteAction_HashPolicy_ConnectionProperties) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[36] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RouteAction_HashPolicy_ConnectionProperties.ProtoReflect.Descriptor instead. -func (*RouteAction_HashPolicy_ConnectionProperties) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{8, 1, 3} -} - -func (x *RouteAction_HashPolicy_ConnectionProperties) GetSourceIp() bool { - if x != nil { - return x.SourceIp - } - return false -} - -type RouteAction_HashPolicy_QueryParameter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of the URL query parameter that will be used to obtain the hash - // key. If the parameter is not present, no hash will be produced. Query - // parameter names are case-sensitive. If query parameters are repeated, only - // the first value will be considered. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` -} - -func (x *RouteAction_HashPolicy_QueryParameter) Reset() { - *x = RouteAction_HashPolicy_QueryParameter{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[37] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RouteAction_HashPolicy_QueryParameter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RouteAction_HashPolicy_QueryParameter) ProtoMessage() {} - -func (x *RouteAction_HashPolicy_QueryParameter) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[37] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RouteAction_HashPolicy_QueryParameter.ProtoReflect.Descriptor instead. -func (*RouteAction_HashPolicy_QueryParameter) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{8, 1, 4} -} - -func (x *RouteAction_HashPolicy_QueryParameter) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type RouteAction_HashPolicy_FilterState struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of the Object in the per-request filterState, which is an - // Envoy::Hashable object. If there is no data associated with the key, - // or the stored object is not Envoy::Hashable, no hash will be produced. - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` -} - -func (x *RouteAction_HashPolicy_FilterState) Reset() { - *x = RouteAction_HashPolicy_FilterState{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[38] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RouteAction_HashPolicy_FilterState) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RouteAction_HashPolicy_FilterState) ProtoMessage() {} - -func (x *RouteAction_HashPolicy_FilterState) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[38] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RouteAction_HashPolicy_FilterState.ProtoReflect.Descriptor instead. -func (*RouteAction_HashPolicy_FilterState) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{8, 1, 5} -} - -func (x *RouteAction_HashPolicy_FilterState) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -// Configuration for sending data upstream as a raw data payload. This is used for -// CONNECT or POST requests, when forwarding request payload as raw TCP. -type RouteAction_UpgradeConfig_ConnectConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // If present, the proxy protocol header will be prepended to the CONNECT payload sent upstream. - ProxyProtocolConfig *v31.ProxyProtocolConfig `protobuf:"bytes,1,opt,name=proxy_protocol_config,json=proxyProtocolConfig,proto3" json:"proxy_protocol_config,omitempty"` - // If set, the route will also allow forwarding POST payload as raw TCP. - AllowPost bool `protobuf:"varint,2,opt,name=allow_post,json=allowPost,proto3" json:"allow_post,omitempty"` -} - -func (x *RouteAction_UpgradeConfig_ConnectConfig) Reset() { - *x = RouteAction_UpgradeConfig_ConnectConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[39] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RouteAction_UpgradeConfig_ConnectConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RouteAction_UpgradeConfig_ConnectConfig) ProtoMessage() {} - -func (x *RouteAction_UpgradeConfig_ConnectConfig) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[39] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RouteAction_UpgradeConfig_ConnectConfig.ProtoReflect.Descriptor instead. -func (*RouteAction_UpgradeConfig_ConnectConfig) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{8, 2, 0} -} - -func (x *RouteAction_UpgradeConfig_ConnectConfig) GetProxyProtocolConfig() *v31.ProxyProtocolConfig { - if x != nil { - return x.ProxyProtocolConfig - } - return nil -} - -func (x *RouteAction_UpgradeConfig_ConnectConfig) GetAllowPost() bool { - if x != nil { - return x.AllowPost - } - return false -} - -type RetryPolicy_RetryPriority struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // [#extension-category: envoy.retry_priorities] - // - // Types that are assignable to ConfigType: - // - // *RetryPolicy_RetryPriority_TypedConfig - ConfigType isRetryPolicy_RetryPriority_ConfigType `protobuf_oneof:"config_type"` -} - -func (x *RetryPolicy_RetryPriority) Reset() { - *x = RetryPolicy_RetryPriority{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[40] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RetryPolicy_RetryPriority) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RetryPolicy_RetryPriority) ProtoMessage() {} - -func (x *RetryPolicy_RetryPriority) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[40] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RetryPolicy_RetryPriority.ProtoReflect.Descriptor instead. -func (*RetryPolicy_RetryPriority) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{9, 0} -} - -func (x *RetryPolicy_RetryPriority) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (m *RetryPolicy_RetryPriority) GetConfigType() isRetryPolicy_RetryPriority_ConfigType { - if m != nil { - return m.ConfigType - } - return nil -} - -func (x *RetryPolicy_RetryPriority) GetTypedConfig() *anypb.Any { - if x, ok := x.GetConfigType().(*RetryPolicy_RetryPriority_TypedConfig); ok { - return x.TypedConfig - } - return nil -} - -type isRetryPolicy_RetryPriority_ConfigType interface { - isRetryPolicy_RetryPriority_ConfigType() -} - -type RetryPolicy_RetryPriority_TypedConfig struct { - TypedConfig *anypb.Any `protobuf:"bytes,3,opt,name=typed_config,json=typedConfig,proto3,oneof"` -} - -func (*RetryPolicy_RetryPriority_TypedConfig) isRetryPolicy_RetryPriority_ConfigType() {} - -type RetryPolicy_RetryHostPredicate struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // [#extension-category: envoy.retry_host_predicates] - // - // Types that are assignable to ConfigType: - // - // *RetryPolicy_RetryHostPredicate_TypedConfig - ConfigType isRetryPolicy_RetryHostPredicate_ConfigType `protobuf_oneof:"config_type"` -} - -func (x *RetryPolicy_RetryHostPredicate) Reset() { - *x = RetryPolicy_RetryHostPredicate{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[41] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RetryPolicy_RetryHostPredicate) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RetryPolicy_RetryHostPredicate) ProtoMessage() {} - -func (x *RetryPolicy_RetryHostPredicate) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[41] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RetryPolicy_RetryHostPredicate.ProtoReflect.Descriptor instead. -func (*RetryPolicy_RetryHostPredicate) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{9, 1} -} - -func (x *RetryPolicy_RetryHostPredicate) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (m *RetryPolicy_RetryHostPredicate) GetConfigType() isRetryPolicy_RetryHostPredicate_ConfigType { - if m != nil { - return m.ConfigType - } - return nil -} - -func (x *RetryPolicy_RetryHostPredicate) GetTypedConfig() *anypb.Any { - if x, ok := x.GetConfigType().(*RetryPolicy_RetryHostPredicate_TypedConfig); ok { - return x.TypedConfig - } - return nil -} - -type isRetryPolicy_RetryHostPredicate_ConfigType interface { - isRetryPolicy_RetryHostPredicate_ConfigType() -} - -type RetryPolicy_RetryHostPredicate_TypedConfig struct { - TypedConfig *anypb.Any `protobuf:"bytes,3,opt,name=typed_config,json=typedConfig,proto3,oneof"` -} - -func (*RetryPolicy_RetryHostPredicate_TypedConfig) isRetryPolicy_RetryHostPredicate_ConfigType() {} - -type RetryPolicy_RetryBackOff struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Specifies the base interval between retries. This parameter is required and must be greater - // than zero. Values less than 1 ms are rounded up to 1 ms. - // See :ref:`config_http_filters_router_x-envoy-max-retries` for a discussion of Envoy's - // back-off algorithm. - BaseInterval *durationpb.Duration `protobuf:"bytes,1,opt,name=base_interval,json=baseInterval,proto3" json:"base_interval,omitempty"` - // Specifies the maximum interval between retries. This parameter is optional, but must be - // greater than or equal to the “base_interval“ if set. The default is 10 times the - // “base_interval“. See :ref:`config_http_filters_router_x-envoy-max-retries` for a discussion - // of Envoy's back-off algorithm. - MaxInterval *durationpb.Duration `protobuf:"bytes,2,opt,name=max_interval,json=maxInterval,proto3" json:"max_interval,omitempty"` -} - -func (x *RetryPolicy_RetryBackOff) Reset() { - *x = RetryPolicy_RetryBackOff{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[42] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RetryPolicy_RetryBackOff) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RetryPolicy_RetryBackOff) ProtoMessage() {} - -func (x *RetryPolicy_RetryBackOff) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[42] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RetryPolicy_RetryBackOff.ProtoReflect.Descriptor instead. -func (*RetryPolicy_RetryBackOff) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{9, 2} -} - -func (x *RetryPolicy_RetryBackOff) GetBaseInterval() *durationpb.Duration { - if x != nil { - return x.BaseInterval - } - return nil -} - -func (x *RetryPolicy_RetryBackOff) GetMaxInterval() *durationpb.Duration { - if x != nil { - return x.MaxInterval - } - return nil -} - -type RetryPolicy_ResetHeader struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of the reset header. - // - // .. note:: - // - // If the header appears multiple times only the first value is used. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The format of the reset header. - Format RetryPolicy_ResetHeaderFormat `protobuf:"varint,2,opt,name=format,proto3,enum=envoy.config.route.v3.RetryPolicy_ResetHeaderFormat" json:"format,omitempty"` -} - -func (x *RetryPolicy_ResetHeader) Reset() { - *x = RetryPolicy_ResetHeader{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[43] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RetryPolicy_ResetHeader) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RetryPolicy_ResetHeader) ProtoMessage() {} - -func (x *RetryPolicy_ResetHeader) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[43] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RetryPolicy_ResetHeader.ProtoReflect.Descriptor instead. -func (*RetryPolicy_ResetHeader) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{9, 3} -} - -func (x *RetryPolicy_ResetHeader) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *RetryPolicy_ResetHeader) GetFormat() RetryPolicy_ResetHeaderFormat { - if x != nil { - return x.Format - } - return RetryPolicy_SECONDS -} - -// A retry back-off strategy that applies when the upstream server rate limits -// the request. -// -// Given this configuration: -// -// .. code-block:: yaml -// -// rate_limited_retry_back_off: -// reset_headers: -// - name: Retry-After -// format: SECONDS -// - name: X-RateLimit-Reset -// format: UNIX_TIMESTAMP -// max_interval: "300s" -// -// The following algorithm will apply: -// -// 1. If the response contains the header “Retry-After“ its value must be on -// the form “120“ (an integer that represents the number of seconds to -// wait before retrying). If so, this value is used as the back-off interval. -// 2. Otherwise, if the response contains the header “X-RateLimit-Reset“ its -// value must be on the form “1595320702“ (an integer that represents the -// point in time at which to retry, as a Unix timestamp in seconds). If so, -// the current time is subtracted from this value and the result is used as -// the back-off interval. -// 3. Otherwise, Envoy will use the default -// :ref:`exponential back-off ` -// strategy. -// -// No matter which format is used, if the resulting back-off interval exceeds -// “max_interval“ it is discarded and the next header in “reset_headers“ -// is tried. If a request timeout is configured for the route it will further -// limit how long the request will be allowed to run. -// -// To prevent many clients retrying at the same point in time jitter is added -// to the back-off interval, so the resulting interval is decided by taking: -// “random(interval, interval * 1.5)“. -// -// .. attention:: -// -// Configuring ``rate_limited_retry_back_off`` will not by itself cause a request -// to be retried. You will still need to configure the right retry policy to match -// the responses from the upstream server. -type RetryPolicy_RateLimitedRetryBackOff struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Specifies the reset headers (like “Retry-After“ or “X-RateLimit-Reset“) - // to match against the response. Headers are tried in order, and matched case - // insensitive. The first header to be parsed successfully is used. If no headers - // match the default exponential back-off is used instead. - ResetHeaders []*RetryPolicy_ResetHeader `protobuf:"bytes,1,rep,name=reset_headers,json=resetHeaders,proto3" json:"reset_headers,omitempty"` - // Specifies the maximum back off interval that Envoy will allow. If a reset - // header contains an interval longer than this then it will be discarded and - // the next header will be tried. Defaults to 300 seconds. - MaxInterval *durationpb.Duration `protobuf:"bytes,2,opt,name=max_interval,json=maxInterval,proto3" json:"max_interval,omitempty"` -} - -func (x *RetryPolicy_RateLimitedRetryBackOff) Reset() { - *x = RetryPolicy_RateLimitedRetryBackOff{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[44] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RetryPolicy_RateLimitedRetryBackOff) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RetryPolicy_RateLimitedRetryBackOff) ProtoMessage() {} - -func (x *RetryPolicy_RateLimitedRetryBackOff) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[44] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RetryPolicy_RateLimitedRetryBackOff.ProtoReflect.Descriptor instead. -func (*RetryPolicy_RateLimitedRetryBackOff) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{9, 4} -} - -func (x *RetryPolicy_RateLimitedRetryBackOff) GetResetHeaders() []*RetryPolicy_ResetHeader { - if x != nil { - return x.ResetHeaders - } - return nil -} - -func (x *RetryPolicy_RateLimitedRetryBackOff) GetMaxInterval() *durationpb.Duration { - if x != nil { - return x.MaxInterval - } - return nil -} - -// [#next-free-field: 12] -type RateLimit_Action struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to ActionSpecifier: - // - // *RateLimit_Action_SourceCluster_ - // *RateLimit_Action_DestinationCluster_ - // *RateLimit_Action_RequestHeaders_ - // *RateLimit_Action_RemoteAddress_ - // *RateLimit_Action_GenericKey_ - // *RateLimit_Action_HeaderValueMatch_ - // *RateLimit_Action_DynamicMetadata - // *RateLimit_Action_Metadata - // *RateLimit_Action_Extension - // *RateLimit_Action_MaskedRemoteAddress_ - // *RateLimit_Action_QueryParameterValueMatch_ - ActionSpecifier isRateLimit_Action_ActionSpecifier `protobuf_oneof:"action_specifier"` -} - -func (x *RateLimit_Action) Reset() { - *x = RateLimit_Action{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[45] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RateLimit_Action) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RateLimit_Action) ProtoMessage() {} - -func (x *RateLimit_Action) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[45] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RateLimit_Action.ProtoReflect.Descriptor instead. -func (*RateLimit_Action) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{17, 0} -} - -func (m *RateLimit_Action) GetActionSpecifier() isRateLimit_Action_ActionSpecifier { - if m != nil { - return m.ActionSpecifier - } - return nil -} - -func (x *RateLimit_Action) GetSourceCluster() *RateLimit_Action_SourceCluster { - if x, ok := x.GetActionSpecifier().(*RateLimit_Action_SourceCluster_); ok { - return x.SourceCluster - } - return nil -} - -func (x *RateLimit_Action) GetDestinationCluster() *RateLimit_Action_DestinationCluster { - if x, ok := x.GetActionSpecifier().(*RateLimit_Action_DestinationCluster_); ok { - return x.DestinationCluster - } - return nil -} - -func (x *RateLimit_Action) GetRequestHeaders() *RateLimit_Action_RequestHeaders { - if x, ok := x.GetActionSpecifier().(*RateLimit_Action_RequestHeaders_); ok { - return x.RequestHeaders - } - return nil -} - -func (x *RateLimit_Action) GetRemoteAddress() *RateLimit_Action_RemoteAddress { - if x, ok := x.GetActionSpecifier().(*RateLimit_Action_RemoteAddress_); ok { - return x.RemoteAddress - } - return nil -} - -func (x *RateLimit_Action) GetGenericKey() *RateLimit_Action_GenericKey { - if x, ok := x.GetActionSpecifier().(*RateLimit_Action_GenericKey_); ok { - return x.GenericKey - } - return nil -} - -func (x *RateLimit_Action) GetHeaderValueMatch() *RateLimit_Action_HeaderValueMatch { - if x, ok := x.GetActionSpecifier().(*RateLimit_Action_HeaderValueMatch_); ok { - return x.HeaderValueMatch - } - return nil -} - -// Deprecated: Do not use. -func (x *RateLimit_Action) GetDynamicMetadata() *RateLimit_Action_DynamicMetaData { - if x, ok := x.GetActionSpecifier().(*RateLimit_Action_DynamicMetadata); ok { - return x.DynamicMetadata - } - return nil -} - -func (x *RateLimit_Action) GetMetadata() *RateLimit_Action_MetaData { - if x, ok := x.GetActionSpecifier().(*RateLimit_Action_Metadata); ok { - return x.Metadata - } - return nil -} - -func (x *RateLimit_Action) GetExtension() *v31.TypedExtensionConfig { - if x, ok := x.GetActionSpecifier().(*RateLimit_Action_Extension); ok { - return x.Extension - } - return nil -} - -func (x *RateLimit_Action) GetMaskedRemoteAddress() *RateLimit_Action_MaskedRemoteAddress { - if x, ok := x.GetActionSpecifier().(*RateLimit_Action_MaskedRemoteAddress_); ok { - return x.MaskedRemoteAddress - } - return nil -} - -func (x *RateLimit_Action) GetQueryParameterValueMatch() *RateLimit_Action_QueryParameterValueMatch { - if x, ok := x.GetActionSpecifier().(*RateLimit_Action_QueryParameterValueMatch_); ok { - return x.QueryParameterValueMatch - } - return nil -} - -type isRateLimit_Action_ActionSpecifier interface { - isRateLimit_Action_ActionSpecifier() -} - -type RateLimit_Action_SourceCluster_ struct { - // Rate limit on source cluster. - SourceCluster *RateLimit_Action_SourceCluster `protobuf:"bytes,1,opt,name=source_cluster,json=sourceCluster,proto3,oneof"` -} - -type RateLimit_Action_DestinationCluster_ struct { - // Rate limit on destination cluster. - DestinationCluster *RateLimit_Action_DestinationCluster `protobuf:"bytes,2,opt,name=destination_cluster,json=destinationCluster,proto3,oneof"` -} - -type RateLimit_Action_RequestHeaders_ struct { - // Rate limit on request headers. - RequestHeaders *RateLimit_Action_RequestHeaders `protobuf:"bytes,3,opt,name=request_headers,json=requestHeaders,proto3,oneof"` -} - -type RateLimit_Action_RemoteAddress_ struct { - // Rate limit on remote address. - RemoteAddress *RateLimit_Action_RemoteAddress `protobuf:"bytes,4,opt,name=remote_address,json=remoteAddress,proto3,oneof"` -} - -type RateLimit_Action_GenericKey_ struct { - // Rate limit on a generic key. - GenericKey *RateLimit_Action_GenericKey `protobuf:"bytes,5,opt,name=generic_key,json=genericKey,proto3,oneof"` -} - -type RateLimit_Action_HeaderValueMatch_ struct { - // Rate limit on the existence of request headers. - HeaderValueMatch *RateLimit_Action_HeaderValueMatch `protobuf:"bytes,6,opt,name=header_value_match,json=headerValueMatch,proto3,oneof"` -} - -type RateLimit_Action_DynamicMetadata struct { - // Rate limit on dynamic metadata. - // - // .. attention:: - // - // This field has been deprecated in favor of the :ref:`metadata ` field - // - // Deprecated: Do not use. - DynamicMetadata *RateLimit_Action_DynamicMetaData `protobuf:"bytes,7,opt,name=dynamic_metadata,json=dynamicMetadata,proto3,oneof"` -} - -type RateLimit_Action_Metadata struct { - // Rate limit on metadata. - Metadata *RateLimit_Action_MetaData `protobuf:"bytes,8,opt,name=metadata,proto3,oneof"` -} - -type RateLimit_Action_Extension struct { - // Rate limit descriptor extension. See the rate limit descriptor extensions documentation. - // - // :ref:`HTTP matching input functions ` are - // permitted as descriptor extensions. The input functions are only - // looked up if there is no rate limit descriptor extension matching - // the type URL. - // - // [#extension-category: envoy.rate_limit_descriptors] - Extension *v31.TypedExtensionConfig `protobuf:"bytes,9,opt,name=extension,proto3,oneof"` -} - -type RateLimit_Action_MaskedRemoteAddress_ struct { - // Rate limit on masked remote address. - MaskedRemoteAddress *RateLimit_Action_MaskedRemoteAddress `protobuf:"bytes,10,opt,name=masked_remote_address,json=maskedRemoteAddress,proto3,oneof"` -} - -type RateLimit_Action_QueryParameterValueMatch_ struct { - // Rate limit on the existence of query parameters. - QueryParameterValueMatch *RateLimit_Action_QueryParameterValueMatch `protobuf:"bytes,11,opt,name=query_parameter_value_match,json=queryParameterValueMatch,proto3,oneof"` -} - -func (*RateLimit_Action_SourceCluster_) isRateLimit_Action_ActionSpecifier() {} - -func (*RateLimit_Action_DestinationCluster_) isRateLimit_Action_ActionSpecifier() {} - -func (*RateLimit_Action_RequestHeaders_) isRateLimit_Action_ActionSpecifier() {} - -func (*RateLimit_Action_RemoteAddress_) isRateLimit_Action_ActionSpecifier() {} - -func (*RateLimit_Action_GenericKey_) isRateLimit_Action_ActionSpecifier() {} - -func (*RateLimit_Action_HeaderValueMatch_) isRateLimit_Action_ActionSpecifier() {} - -func (*RateLimit_Action_DynamicMetadata) isRateLimit_Action_ActionSpecifier() {} - -func (*RateLimit_Action_Metadata) isRateLimit_Action_ActionSpecifier() {} - -func (*RateLimit_Action_Extension) isRateLimit_Action_ActionSpecifier() {} - -func (*RateLimit_Action_MaskedRemoteAddress_) isRateLimit_Action_ActionSpecifier() {} - -func (*RateLimit_Action_QueryParameterValueMatch_) isRateLimit_Action_ActionSpecifier() {} - -type RateLimit_Override struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to OverrideSpecifier: - // - // *RateLimit_Override_DynamicMetadata_ - OverrideSpecifier isRateLimit_Override_OverrideSpecifier `protobuf_oneof:"override_specifier"` -} - -func (x *RateLimit_Override) Reset() { - *x = RateLimit_Override{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[46] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RateLimit_Override) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RateLimit_Override) ProtoMessage() {} - -func (x *RateLimit_Override) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[46] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RateLimit_Override.ProtoReflect.Descriptor instead. -func (*RateLimit_Override) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{17, 1} -} - -func (m *RateLimit_Override) GetOverrideSpecifier() isRateLimit_Override_OverrideSpecifier { - if m != nil { - return m.OverrideSpecifier - } - return nil -} - -func (x *RateLimit_Override) GetDynamicMetadata() *RateLimit_Override_DynamicMetadata { - if x, ok := x.GetOverrideSpecifier().(*RateLimit_Override_DynamicMetadata_); ok { - return x.DynamicMetadata - } - return nil -} - -type isRateLimit_Override_OverrideSpecifier interface { - isRateLimit_Override_OverrideSpecifier() -} - -type RateLimit_Override_DynamicMetadata_ struct { - // Limit override from dynamic metadata. - DynamicMetadata *RateLimit_Override_DynamicMetadata `protobuf:"bytes,1,opt,name=dynamic_metadata,json=dynamicMetadata,proto3,oneof"` -} - -func (*RateLimit_Override_DynamicMetadata_) isRateLimit_Override_OverrideSpecifier() {} - -// The following descriptor entry is appended to the descriptor: -// -// .. code-block:: cpp -// -// ("source_cluster", "") -// -// is derived from the :option:`--service-cluster` option. -type RateLimit_Action_SourceCluster struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *RateLimit_Action_SourceCluster) Reset() { - *x = RateLimit_Action_SourceCluster{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[47] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RateLimit_Action_SourceCluster) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RateLimit_Action_SourceCluster) ProtoMessage() {} - -func (x *RateLimit_Action_SourceCluster) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[47] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RateLimit_Action_SourceCluster.ProtoReflect.Descriptor instead. -func (*RateLimit_Action_SourceCluster) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{17, 0, 0} -} - -// The following descriptor entry is appended to the descriptor: -// -// .. code-block:: cpp -// -// ("destination_cluster", "") -// -// Once a request matches against a route table rule, a routed cluster is determined by one of -// the following :ref:`route table configuration ` -// settings: -// -// - :ref:`cluster ` indicates the upstream cluster -// to route to. -// - :ref:`weighted_clusters ` -// chooses a cluster randomly from a set of clusters with attributed weight. -// - :ref:`cluster_header ` indicates which -// header in the request contains the target cluster. -type RateLimit_Action_DestinationCluster struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *RateLimit_Action_DestinationCluster) Reset() { - *x = RateLimit_Action_DestinationCluster{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[48] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RateLimit_Action_DestinationCluster) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RateLimit_Action_DestinationCluster) ProtoMessage() {} - -func (x *RateLimit_Action_DestinationCluster) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[48] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RateLimit_Action_DestinationCluster.ProtoReflect.Descriptor instead. -func (*RateLimit_Action_DestinationCluster) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{17, 0, 1} -} - -// The following descriptor entry is appended when a header contains a key that matches the -// “header_name“: -// -// .. code-block:: cpp -// -// ("", "") -type RateLimit_Action_RequestHeaders struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The header name to be queried from the request headers. The header’s - // value is used to populate the value of the descriptor entry for the - // descriptor_key. - HeaderName string `protobuf:"bytes,1,opt,name=header_name,json=headerName,proto3" json:"header_name,omitempty"` - // The key to use in the descriptor entry. - DescriptorKey string `protobuf:"bytes,2,opt,name=descriptor_key,json=descriptorKey,proto3" json:"descriptor_key,omitempty"` - // If set to true, Envoy skips the descriptor while calling rate limiting service - // when header is not present in the request. By default it skips calling the - // rate limiting service if this header is not present in the request. - SkipIfAbsent bool `protobuf:"varint,3,opt,name=skip_if_absent,json=skipIfAbsent,proto3" json:"skip_if_absent,omitempty"` -} - -func (x *RateLimit_Action_RequestHeaders) Reset() { - *x = RateLimit_Action_RequestHeaders{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[49] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RateLimit_Action_RequestHeaders) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RateLimit_Action_RequestHeaders) ProtoMessage() {} - -func (x *RateLimit_Action_RequestHeaders) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[49] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RateLimit_Action_RequestHeaders.ProtoReflect.Descriptor instead. -func (*RateLimit_Action_RequestHeaders) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{17, 0, 2} -} - -func (x *RateLimit_Action_RequestHeaders) GetHeaderName() string { - if x != nil { - return x.HeaderName - } - return "" -} - -func (x *RateLimit_Action_RequestHeaders) GetDescriptorKey() string { - if x != nil { - return x.DescriptorKey - } - return "" -} - -func (x *RateLimit_Action_RequestHeaders) GetSkipIfAbsent() bool { - if x != nil { - return x.SkipIfAbsent - } - return false -} - -// The following descriptor entry is appended to the descriptor and is populated using the -// trusted address from :ref:`x-forwarded-for `: -// -// .. code-block:: cpp -// -// ("remote_address", "") -type RateLimit_Action_RemoteAddress struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *RateLimit_Action_RemoteAddress) Reset() { - *x = RateLimit_Action_RemoteAddress{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[50] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RateLimit_Action_RemoteAddress) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RateLimit_Action_RemoteAddress) ProtoMessage() {} - -func (x *RateLimit_Action_RemoteAddress) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[50] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RateLimit_Action_RemoteAddress.ProtoReflect.Descriptor instead. -func (*RateLimit_Action_RemoteAddress) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{17, 0, 3} -} - -// The following descriptor entry is appended to the descriptor and is populated using the -// masked address from :ref:`x-forwarded-for `: -// -// .. code-block:: cpp -// -// ("masked_remote_address", "") -type RateLimit_Action_MaskedRemoteAddress struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Length of prefix mask len for IPv4 (e.g. 0, 32). - // Defaults to 32 when unset. - // For example, trusted address from x-forwarded-for is “192.168.1.1“, - // the descriptor entry is ("masked_remote_address", "192.168.1.1/32"); - // if mask len is 24, the descriptor entry is ("masked_remote_address", "192.168.1.0/24"). - V4PrefixMaskLen *wrapperspb.UInt32Value `protobuf:"bytes,1,opt,name=v4_prefix_mask_len,json=v4PrefixMaskLen,proto3" json:"v4_prefix_mask_len,omitempty"` - // Length of prefix mask len for IPv6 (e.g. 0, 128). - // Defaults to 128 when unset. - // For example, trusted address from x-forwarded-for is “2001:abcd:ef01:2345:6789:abcd:ef01:234“, - // the descriptor entry is ("masked_remote_address", "2001:abcd:ef01:2345:6789:abcd:ef01:234/128"); - // if mask len is 64, the descriptor entry is ("masked_remote_address", "2001:abcd:ef01:2345::/64"). - V6PrefixMaskLen *wrapperspb.UInt32Value `protobuf:"bytes,2,opt,name=v6_prefix_mask_len,json=v6PrefixMaskLen,proto3" json:"v6_prefix_mask_len,omitempty"` -} - -func (x *RateLimit_Action_MaskedRemoteAddress) Reset() { - *x = RateLimit_Action_MaskedRemoteAddress{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[51] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RateLimit_Action_MaskedRemoteAddress) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RateLimit_Action_MaskedRemoteAddress) ProtoMessage() {} - -func (x *RateLimit_Action_MaskedRemoteAddress) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[51] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RateLimit_Action_MaskedRemoteAddress.ProtoReflect.Descriptor instead. -func (*RateLimit_Action_MaskedRemoteAddress) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{17, 0, 4} -} - -func (x *RateLimit_Action_MaskedRemoteAddress) GetV4PrefixMaskLen() *wrapperspb.UInt32Value { - if x != nil { - return x.V4PrefixMaskLen - } - return nil -} - -func (x *RateLimit_Action_MaskedRemoteAddress) GetV6PrefixMaskLen() *wrapperspb.UInt32Value { - if x != nil { - return x.V6PrefixMaskLen - } - return nil -} - -// The following descriptor entry is appended to the descriptor: -// -// .. code-block:: cpp -// -// ("generic_key", "") -type RateLimit_Action_GenericKey struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The value to use in the descriptor entry. - DescriptorValue string `protobuf:"bytes,1,opt,name=descriptor_value,json=descriptorValue,proto3" json:"descriptor_value,omitempty"` - // An optional key to use in the descriptor entry. If not set it defaults - // to 'generic_key' as the descriptor key. - DescriptorKey string `protobuf:"bytes,2,opt,name=descriptor_key,json=descriptorKey,proto3" json:"descriptor_key,omitempty"` -} - -func (x *RateLimit_Action_GenericKey) Reset() { - *x = RateLimit_Action_GenericKey{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[52] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RateLimit_Action_GenericKey) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RateLimit_Action_GenericKey) ProtoMessage() {} - -func (x *RateLimit_Action_GenericKey) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[52] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RateLimit_Action_GenericKey.ProtoReflect.Descriptor instead. -func (*RateLimit_Action_GenericKey) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{17, 0, 5} -} - -func (x *RateLimit_Action_GenericKey) GetDescriptorValue() string { - if x != nil { - return x.DescriptorValue - } - return "" -} - -func (x *RateLimit_Action_GenericKey) GetDescriptorKey() string { - if x != nil { - return x.DescriptorKey - } - return "" -} - -// The following descriptor entry is appended to the descriptor: -// -// .. code-block:: cpp -// -// ("header_match", "") -type RateLimit_Action_HeaderValueMatch struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The key to use in the descriptor entry. Defaults to “header_match“. - DescriptorKey string `protobuf:"bytes,4,opt,name=descriptor_key,json=descriptorKey,proto3" json:"descriptor_key,omitempty"` - // The value to use in the descriptor entry. - DescriptorValue string `protobuf:"bytes,1,opt,name=descriptor_value,json=descriptorValue,proto3" json:"descriptor_value,omitempty"` - // If set to true, the action will append a descriptor entry when the - // request matches the headers. If set to false, the action will append a - // descriptor entry when the request does not match the headers. The - // default value is true. - ExpectMatch *wrapperspb.BoolValue `protobuf:"bytes,2,opt,name=expect_match,json=expectMatch,proto3" json:"expect_match,omitempty"` - // Specifies a set of headers that the rate limit action should match - // on. The action will check the request’s headers against all the - // specified headers in the config. A match will happen if all the - // headers in the config are present in the request with the same values - // (or based on presence if the value field is not in the config). - Headers []*HeaderMatcher `protobuf:"bytes,3,rep,name=headers,proto3" json:"headers,omitempty"` -} - -func (x *RateLimit_Action_HeaderValueMatch) Reset() { - *x = RateLimit_Action_HeaderValueMatch{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[53] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RateLimit_Action_HeaderValueMatch) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RateLimit_Action_HeaderValueMatch) ProtoMessage() {} - -func (x *RateLimit_Action_HeaderValueMatch) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[53] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RateLimit_Action_HeaderValueMatch.ProtoReflect.Descriptor instead. -func (*RateLimit_Action_HeaderValueMatch) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{17, 0, 6} -} - -func (x *RateLimit_Action_HeaderValueMatch) GetDescriptorKey() string { - if x != nil { - return x.DescriptorKey - } - return "" -} - -func (x *RateLimit_Action_HeaderValueMatch) GetDescriptorValue() string { - if x != nil { - return x.DescriptorValue - } - return "" -} - -func (x *RateLimit_Action_HeaderValueMatch) GetExpectMatch() *wrapperspb.BoolValue { - if x != nil { - return x.ExpectMatch - } - return nil -} - -func (x *RateLimit_Action_HeaderValueMatch) GetHeaders() []*HeaderMatcher { - if x != nil { - return x.Headers - } - return nil -} - -// The following descriptor entry is appended when the -// :ref:`dynamic metadata ` contains a key value: -// -// .. code-block:: cpp -// -// ("", "") -// -// .. attention:: -// -// This action has been deprecated in favor of the :ref:`metadata ` action -type RateLimit_Action_DynamicMetaData struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The key to use in the descriptor entry. - DescriptorKey string `protobuf:"bytes,1,opt,name=descriptor_key,json=descriptorKey,proto3" json:"descriptor_key,omitempty"` - // Metadata struct that defines the key and path to retrieve the string value. A match will - // only happen if the value in the dynamic metadata is of type string. - MetadataKey *v35.MetadataKey `protobuf:"bytes,2,opt,name=metadata_key,json=metadataKey,proto3" json:"metadata_key,omitempty"` - // An optional value to use if “metadata_key“ is empty. If not set and - // no value is present under the metadata_key then no descriptor is generated. - DefaultValue string `protobuf:"bytes,3,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` -} - -func (x *RateLimit_Action_DynamicMetaData) Reset() { - *x = RateLimit_Action_DynamicMetaData{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[54] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RateLimit_Action_DynamicMetaData) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RateLimit_Action_DynamicMetaData) ProtoMessage() {} - -func (x *RateLimit_Action_DynamicMetaData) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[54] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RateLimit_Action_DynamicMetaData.ProtoReflect.Descriptor instead. -func (*RateLimit_Action_DynamicMetaData) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{17, 0, 7} -} - -func (x *RateLimit_Action_DynamicMetaData) GetDescriptorKey() string { - if x != nil { - return x.DescriptorKey - } - return "" -} - -func (x *RateLimit_Action_DynamicMetaData) GetMetadataKey() *v35.MetadataKey { - if x != nil { - return x.MetadataKey - } - return nil -} - -func (x *RateLimit_Action_DynamicMetaData) GetDefaultValue() string { - if x != nil { - return x.DefaultValue - } - return "" -} - -// The following descriptor entry is appended when the metadata contains a key value: -// -// .. code-block:: cpp -// -// ("", "") -// -// [#next-free-field: 6] -type RateLimit_Action_MetaData struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The key to use in the descriptor entry. - DescriptorKey string `protobuf:"bytes,1,opt,name=descriptor_key,json=descriptorKey,proto3" json:"descriptor_key,omitempty"` - // Metadata struct that defines the key and path to retrieve the string value. A match will - // only happen if the value in the metadata is of type string. - MetadataKey *v35.MetadataKey `protobuf:"bytes,2,opt,name=metadata_key,json=metadataKey,proto3" json:"metadata_key,omitempty"` - // An optional value to use if “metadata_key“ is empty. If not set and - // no value is present under the metadata_key then “skip_if_absent“ is followed to - // skip calling the rate limiting service or skip the descriptor. - DefaultValue string `protobuf:"bytes,3,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` - // Source of metadata - Source RateLimit_Action_MetaData_Source `protobuf:"varint,4,opt,name=source,proto3,enum=envoy.config.route.v3.RateLimit_Action_MetaData_Source" json:"source,omitempty"` - // If set to true, Envoy skips the descriptor while calling rate limiting service - // when “metadata_key“ is empty and “default_value“ is not set. By default it skips calling the - // rate limiting service in that case. - SkipIfAbsent bool `protobuf:"varint,5,opt,name=skip_if_absent,json=skipIfAbsent,proto3" json:"skip_if_absent,omitempty"` -} - -func (x *RateLimit_Action_MetaData) Reset() { - *x = RateLimit_Action_MetaData{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[55] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RateLimit_Action_MetaData) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RateLimit_Action_MetaData) ProtoMessage() {} - -func (x *RateLimit_Action_MetaData) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[55] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RateLimit_Action_MetaData.ProtoReflect.Descriptor instead. -func (*RateLimit_Action_MetaData) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{17, 0, 8} -} - -func (x *RateLimit_Action_MetaData) GetDescriptorKey() string { - if x != nil { - return x.DescriptorKey - } - return "" -} - -func (x *RateLimit_Action_MetaData) GetMetadataKey() *v35.MetadataKey { - if x != nil { - return x.MetadataKey - } - return nil -} - -func (x *RateLimit_Action_MetaData) GetDefaultValue() string { - if x != nil { - return x.DefaultValue - } - return "" -} - -func (x *RateLimit_Action_MetaData) GetSource() RateLimit_Action_MetaData_Source { - if x != nil { - return x.Source - } - return RateLimit_Action_MetaData_DYNAMIC -} - -func (x *RateLimit_Action_MetaData) GetSkipIfAbsent() bool { - if x != nil { - return x.SkipIfAbsent - } - return false -} - -// The following descriptor entry is appended to the descriptor: -// -// .. code-block:: cpp -// -// ("query_match", "") -type RateLimit_Action_QueryParameterValueMatch struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The key to use in the descriptor entry. Defaults to “query_match“. - DescriptorKey string `protobuf:"bytes,4,opt,name=descriptor_key,json=descriptorKey,proto3" json:"descriptor_key,omitempty"` - // The value to use in the descriptor entry. - DescriptorValue string `protobuf:"bytes,1,opt,name=descriptor_value,json=descriptorValue,proto3" json:"descriptor_value,omitempty"` - // If set to true, the action will append a descriptor entry when the - // request matches the headers. If set to false, the action will append a - // descriptor entry when the request does not match the headers. The - // default value is true. - ExpectMatch *wrapperspb.BoolValue `protobuf:"bytes,2,opt,name=expect_match,json=expectMatch,proto3" json:"expect_match,omitempty"` - // Specifies a set of query parameters that the rate limit action should match - // on. The action will check the request’s query parameters against all the - // specified query parameters in the config. A match will happen if all the - // query parameters in the config are present in the request with the same values - // (or based on presence if the value field is not in the config). - QueryParameters []*QueryParameterMatcher `protobuf:"bytes,3,rep,name=query_parameters,json=queryParameters,proto3" json:"query_parameters,omitempty"` -} - -func (x *RateLimit_Action_QueryParameterValueMatch) Reset() { - *x = RateLimit_Action_QueryParameterValueMatch{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[56] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RateLimit_Action_QueryParameterValueMatch) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RateLimit_Action_QueryParameterValueMatch) ProtoMessage() {} - -func (x *RateLimit_Action_QueryParameterValueMatch) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[56] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RateLimit_Action_QueryParameterValueMatch.ProtoReflect.Descriptor instead. -func (*RateLimit_Action_QueryParameterValueMatch) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{17, 0, 9} -} - -func (x *RateLimit_Action_QueryParameterValueMatch) GetDescriptorKey() string { - if x != nil { - return x.DescriptorKey - } - return "" -} - -func (x *RateLimit_Action_QueryParameterValueMatch) GetDescriptorValue() string { - if x != nil { - return x.DescriptorValue - } - return "" -} - -func (x *RateLimit_Action_QueryParameterValueMatch) GetExpectMatch() *wrapperspb.BoolValue { - if x != nil { - return x.ExpectMatch - } - return nil -} - -func (x *RateLimit_Action_QueryParameterValueMatch) GetQueryParameters() []*QueryParameterMatcher { - if x != nil { - return x.QueryParameters - } - return nil -} - -// Fetches the override from the dynamic metadata. -type RateLimit_Override_DynamicMetadata struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Metadata struct that defines the key and path to retrieve the struct value. - // The value must be a struct containing an integer "requests_per_unit" property - // and a "unit" property with a value parseable to :ref:`RateLimitUnit - // enum ` - MetadataKey *v35.MetadataKey `protobuf:"bytes,1,opt,name=metadata_key,json=metadataKey,proto3" json:"metadata_key,omitempty"` -} - -func (x *RateLimit_Override_DynamicMetadata) Reset() { - *x = RateLimit_Override_DynamicMetadata{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[57] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RateLimit_Override_DynamicMetadata) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RateLimit_Override_DynamicMetadata) ProtoMessage() {} - -func (x *RateLimit_Override_DynamicMetadata) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_route_components_proto_msgTypes[57] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RateLimit_Override_DynamicMetadata.ProtoReflect.Descriptor instead. -func (*RateLimit_Override_DynamicMetadata) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_route_components_proto_rawDescGZIP(), []int{17, 1, 0} -} - -func (x *RateLimit_Override_DynamicMetadata) GetMetadataKey() *v35.MetadataKey { - if x != nil { - return x.MetadataKey - } - return nil -} - -var File_envoy_config_route_v3_route_components_proto protoreflect.FileDescriptor - -var file_envoy_config_route_v3_route_components_proto_rawDesc = []byte{ - 0x0a, 0x2c, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x72, - 0x6f, 0x75, 0x74, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x5f, 0x63, 0x6f, - 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, - 0x74, 0x65, 0x2e, 0x76, 0x33, 0x1a, 0x1f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x62, 0x61, 0x73, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x24, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x65, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x29, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, - 0x76, 0x33, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, - 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x24, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, - 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x6d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x22, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x25, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, - 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x76, 0x33, 0x2f, 0x6d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x26, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x74, 0x72, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x2f, - 0x76, 0x33, 0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x74, 0x61, 0x67, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, - 0x76, 0x33, 0x2f, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x19, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x2f, - 0x72, 0x61, 0x6e, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x78, 0x64, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, 0x70, - 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x64, 0x65, - 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x1e, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, - 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x95, 0x0f, 0x0a, 0x0b, 0x56, - 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, - 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x07, 0x64, 0x6f, 0x6d, 0x61, 0x69, - 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x42, 0x12, 0xfa, 0x42, 0x0f, 0x92, 0x01, 0x0c, - 0x08, 0x01, 0x22, 0x08, 0x72, 0x06, 0xc0, 0x01, 0x02, 0xc8, 0x01, 0x00, 0x52, 0x07, 0x64, 0x6f, - 0x6d, 0x61, 0x69, 0x6e, 0x73, 0x12, 0x34, 0x0a, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x6f, - 0x75, 0x74, 0x65, 0x52, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x12, 0x40, 0x0a, 0x07, 0x6d, - 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x78, - 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, - 0x76, 0x33, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x42, 0x08, 0xd2, 0xc6, 0xa4, 0xe1, - 0x06, 0x02, 0x08, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x60, 0x0a, - 0x0b, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x5f, 0x74, 0x6c, 0x73, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x35, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x56, 0x69, 0x72, 0x74, 0x75, - 0x61, 0x6c, 0x48, 0x6f, 0x73, 0x74, 0x2e, 0x54, 0x6c, 0x73, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, - 0x02, 0x10, 0x01, 0x52, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x54, 0x6c, 0x73, 0x12, - 0x50, 0x0a, 0x10, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, - 0x65, 0x72, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, - 0x33, 0x2e, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, - 0x52, 0x0f, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, - 0x73, 0x12, 0x41, 0x0a, 0x0b, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x73, - 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, - 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x0a, 0x72, 0x61, 0x74, 0x65, 0x4c, 0x69, - 0x6d, 0x69, 0x74, 0x73, 0x12, 0x67, 0x0a, 0x16, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, - 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x18, 0x07, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x09, 0xfa, - 0x42, 0x06, 0x92, 0x01, 0x03, 0x10, 0xe8, 0x07, 0x52, 0x13, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x54, 0x6f, 0x41, 0x64, 0x64, 0x12, 0x4d, 0x0a, - 0x19, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, - 0x5f, 0x74, 0x6f, 0x5f, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x09, - 0x42, 0x12, 0xfa, 0x42, 0x0f, 0x92, 0x01, 0x0c, 0x22, 0x0a, 0x72, 0x08, 0x10, 0x01, 0xc0, 0x01, - 0x01, 0xc8, 0x01, 0x00, 0x52, 0x16, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x73, 0x54, 0x6f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x12, 0x69, 0x0a, 0x17, - 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, - 0x5f, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x09, 0xfa, 0x42, 0x06, 0x92, 0x01, 0x03, 0x10, 0xe8, - 0x07, 0x52, 0x14, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x73, 0x54, 0x6f, 0x41, 0x64, 0x64, 0x12, 0x4f, 0x0a, 0x1a, 0x72, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x72, - 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x42, 0x12, 0xfa, 0x42, 0x0f, - 0x92, 0x01, 0x0c, 0x22, 0x0a, 0x72, 0x08, 0x10, 0x01, 0xc0, 0x01, 0x01, 0xc8, 0x01, 0x00, 0x52, - 0x17, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, - 0x54, 0x6f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x12, 0x42, 0x0a, 0x04, 0x63, 0x6f, 0x72, 0x73, - 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x43, - 0x6f, 0x72, 0x73, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x42, 0x0b, 0x18, 0x01, 0x92, 0xc7, 0x86, - 0xd8, 0x04, 0x03, 0x33, 0x2e, 0x30, 0x52, 0x04, 0x63, 0x6f, 0x72, 0x73, 0x12, 0x73, 0x0a, 0x17, - 0x74, 0x79, 0x70, 0x65, 0x64, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, - 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3c, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, - 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x48, 0x6f, 0x73, - 0x74, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x50, 0x65, 0x72, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x14, 0x74, 0x79, 0x70, - 0x65, 0x64, 0x50, 0x65, 0x72, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x12, 0x41, 0x0a, 0x1d, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x72, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x5f, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x1a, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x41, 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x21, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, - 0x61, 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x69, 0x6e, - 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x13, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x1d, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x41, 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, - 0x0a, 0x0c, 0x72, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x10, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x74, - 0x72, 0x79, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x0b, 0x72, 0x65, 0x74, 0x72, 0x79, 0x50, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x4f, 0x0a, 0x19, 0x72, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x70, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x16, - 0x72, 0x65, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x54, 0x79, 0x70, 0x65, 0x64, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x45, 0x0a, 0x0c, 0x68, 0x65, 0x64, 0x67, 0x65, 0x5f, - 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, - 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x64, 0x67, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x52, 0x0b, 0x68, 0x65, 0x64, 0x67, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x44, 0x0a, - 0x1f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x69, 0x73, 0x5f, 0x74, 0x69, 0x6d, 0x65, - 0x6f, 0x75, 0x74, 0x5f, 0x72, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x18, 0x17, 0x20, 0x01, 0x28, 0x08, 0x52, 0x1b, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x49, - 0x73, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x74, 0x72, 0x79, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x12, 0x60, 0x0a, 0x1e, 0x70, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x5f, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x5f, - 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, - 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x1a, 0x70, 0x65, 0x72, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x4c, 0x69, 0x6d, 0x69, 0x74, - 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x6e, 0x0a, 0x17, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x5f, 0x6d, 0x69, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, - 0x18, 0x16, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, - 0x6f, 0x75, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x4d, 0x69, 0x72, 0x72, 0x6f, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x15, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x69, 0x72, 0x72, 0x6f, 0x72, 0x50, 0x6f, 0x6c, - 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, 0x3a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x18, 0x18, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x1a, 0x5d, 0x0a, 0x19, 0x54, 0x79, 0x70, 0x65, 0x64, 0x50, 0x65, 0x72, 0x46, 0x69, 0x6c, - 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, - 0x22, 0x3a, 0x0a, 0x12, 0x54, 0x6c, 0x73, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, - 0x12, 0x11, 0x0a, 0x0d, 0x45, 0x58, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x5f, 0x4f, 0x4e, 0x4c, - 0x59, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4c, 0x4c, 0x10, 0x02, 0x3a, 0x25, 0x9a, 0xc5, - 0x88, 0x1e, 0x20, 0x0a, 0x1e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x48, - 0x6f, 0x73, 0x74, 0x4a, 0x04, 0x08, 0x09, 0x10, 0x0a, 0x4a, 0x04, 0x08, 0x0c, 0x10, 0x0d, 0x52, - 0x11, 0x70, 0x65, 0x72, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x22, 0x64, 0x0a, 0x0c, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x41, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x2c, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x3a, 0x26, 0x9a, 0xc5, 0x88, 0x1e, 0x21, 0x0a, 0x1f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x46, 0x69, 0x6c, 0x74, - 0x65, 0x72, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x41, 0x0a, 0x09, 0x52, 0x6f, 0x75, 0x74, - 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x6f, - 0x75, 0x74, 0x65, 0x52, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x22, 0xaf, 0x0b, 0x0a, 0x05, - 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0e, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x41, 0x0a, 0x05, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, - 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x42, 0x08, 0xfa, 0x42, 0x05, - 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x05, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x3a, 0x0a, 0x05, - 0x72, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, - 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, - 0x00, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x43, 0x0a, 0x08, 0x72, 0x65, 0x64, 0x69, - 0x72, 0x65, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, - 0x76, 0x33, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x12, 0x56, 0x0a, - 0x0f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x44, - 0x69, 0x72, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x41, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0e, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x0d, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x5f, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, - 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x41, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x48, 0x00, 0x52, 0x0c, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x41, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x60, 0x0a, 0x15, 0x6e, 0x6f, 0x6e, 0x5f, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, - 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x2a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, - 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x77, - 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x13, - 0x6e, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x3a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, - 0x3e, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x65, 0x63, 0x6f, 0x72, - 0x61, 0x74, 0x6f, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, - 0x6d, 0x0a, 0x17, 0x74, 0x79, 0x70, 0x65, 0x64, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x66, 0x69, 0x6c, - 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x36, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, - 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x54, - 0x79, 0x70, 0x65, 0x64, 0x50, 0x65, 0x72, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x14, 0x74, 0x79, 0x70, 0x65, 0x64, 0x50, - 0x65, 0x72, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x67, - 0x0a, 0x16, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, - 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x09, 0xfa, 0x42, 0x06, 0x92, 0x01, 0x03, 0x10, - 0xe8, 0x07, 0x52, 0x13, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x73, 0x54, 0x6f, 0x41, 0x64, 0x64, 0x12, 0x4d, 0x0a, 0x19, 0x72, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x72, 0x65, - 0x6d, 0x6f, 0x76, 0x65, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x09, 0x42, 0x12, 0xfa, 0x42, 0x0f, 0x92, - 0x01, 0x0c, 0x22, 0x0a, 0x72, 0x08, 0x10, 0x01, 0xc0, 0x01, 0x01, 0xc8, 0x01, 0x00, 0x52, 0x16, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x54, 0x6f, - 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x12, 0x69, 0x0a, 0x17, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x61, 0x64, - 0x64, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x42, 0x09, 0xfa, 0x42, 0x06, 0x92, 0x01, 0x03, 0x10, 0xe8, 0x07, 0x52, 0x14, 0x72, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x54, 0x6f, 0x41, 0x64, - 0x64, 0x12, 0x4f, 0x0a, 0x1a, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x68, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x18, - 0x0b, 0x20, 0x03, 0x28, 0x09, 0x42, 0x12, 0xfa, 0x42, 0x0f, 0x92, 0x01, 0x0c, 0x22, 0x0a, 0x72, - 0x08, 0x10, 0x01, 0xc0, 0x01, 0x01, 0xc8, 0x01, 0x00, 0x52, 0x17, 0x72, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x54, 0x6f, 0x52, 0x65, 0x6d, 0x6f, - 0x76, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x74, 0x72, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x18, 0x0f, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x54, 0x72, 0x61, 0x63, - 0x69, 0x6e, 0x67, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x12, 0x60, 0x0a, 0x1e, - 0x70, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x75, 0x66, 0x66, - 0x65, 0x72, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x10, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x52, 0x1a, 0x70, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x75, - 0x66, 0x66, 0x65, 0x72, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1f, - 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x13, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x1a, - 0x5d, 0x0a, 0x19, 0x54, 0x79, 0x70, 0x65, 0x64, 0x50, 0x65, 0x72, 0x46, 0x69, 0x6c, 0x74, 0x65, - 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2a, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x3a, 0x1f, - 0x9a, 0xc5, 0x88, 0x1e, 0x1a, 0x0a, 0x18, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x42, - 0x0d, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x4a, 0x04, - 0x08, 0x06, 0x10, 0x07, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x52, 0x11, 0x70, 0x65, 0x72, 0x5f, - 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0xf3, 0x0a, - 0x0a, 0x0f, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, - 0x72, 0x12, 0x5a, 0x0a, 0x08, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x57, 0x65, 0x69, 0x67, - 0x68, 0x74, 0x65, 0x64, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x6c, 0x75, 0x73, - 0x74, 0x65, 0x72, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, - 0x02, 0x08, 0x01, 0x52, 0x08, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x12, 0x4c, 0x0a, - 0x0c, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x42, 0x0b, 0x18, 0x01, 0x92, 0xc7, 0x86, 0xd8, 0x04, 0x03, 0x33, 0x2e, 0x30, 0x52, 0x0b, - 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x2c, 0x0a, 0x12, 0x72, - 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, - 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, - 0x4b, 0x65, 0x79, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x2e, 0x0a, 0x0b, 0x68, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, - 0xfa, 0x42, 0x08, 0x72, 0x06, 0xc0, 0x01, 0x01, 0xc8, 0x01, 0x00, 0x48, 0x00, 0x52, 0x0a, 0x68, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x92, 0x08, 0x0a, 0x0d, 0x43, 0x6c, - 0x75, 0x73, 0x74, 0x65, 0x72, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x2d, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x19, 0xf2, 0x98, 0xfe, 0x8f, 0x05, - 0x13, 0x12, 0x11, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x65, 0x72, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x4b, 0x0a, 0x0e, 0x63, 0x6c, - 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x0c, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x24, 0xfa, 0x42, 0x08, 0x72, 0x06, 0xc0, 0x01, 0x01, 0xc8, 0x01, 0x00, 0xf2, - 0x98, 0xfe, 0x8f, 0x05, 0x13, 0x12, 0x11, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x73, - 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, - 0x72, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x06, 0x77, 0x65, 0x69, 0x67, 0x68, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x45, 0x0a, - 0x0e, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, - 0x61, 0x74, 0x63, 0x68, 0x12, 0x67, 0x0a, 0x16, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, - 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x18, 0x04, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x09, 0xfa, - 0x42, 0x06, 0x92, 0x01, 0x03, 0x10, 0xe8, 0x07, 0x52, 0x13, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x54, 0x6f, 0x41, 0x64, 0x64, 0x12, 0x4b, 0x0a, - 0x19, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, - 0x5f, 0x74, 0x6f, 0x5f, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, - 0x42, 0x10, 0xfa, 0x42, 0x0d, 0x92, 0x01, 0x0a, 0x22, 0x08, 0x72, 0x06, 0xc0, 0x01, 0x01, 0xc8, - 0x01, 0x00, 0x52, 0x16, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x73, 0x54, 0x6f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x12, 0x69, 0x0a, 0x17, 0x72, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x74, - 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, - 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x09, 0xfa, 0x42, 0x06, 0x92, 0x01, 0x03, 0x10, 0xe8, 0x07, 0x52, - 0x14, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, - 0x54, 0x6f, 0x41, 0x64, 0x64, 0x12, 0x4d, 0x0a, 0x1a, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x72, 0x65, 0x6d, - 0x6f, 0x76, 0x65, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x42, 0x10, 0xfa, 0x42, 0x0d, 0x92, 0x01, - 0x0a, 0x22, 0x08, 0x72, 0x06, 0xc0, 0x01, 0x01, 0xc8, 0x01, 0x00, 0x52, 0x17, 0x72, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x54, 0x6f, 0x52, 0x65, - 0x6d, 0x6f, 0x76, 0x65, 0x12, 0x85, 0x01, 0x0a, 0x17, 0x74, 0x79, 0x70, 0x65, 0x64, 0x5f, 0x70, - 0x65, 0x72, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x4e, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x57, - 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x43, - 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x2e, 0x54, 0x79, 0x70, - 0x65, 0x64, 0x50, 0x65, 0x72, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x14, 0x74, 0x79, 0x70, 0x65, 0x64, 0x50, 0x65, 0x72, - 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x3f, 0x0a, 0x14, - 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x6c, 0x69, 0x74, - 0x65, 0x72, 0x61, 0x6c, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, 0xfa, 0x42, 0x08, 0x72, - 0x06, 0xc0, 0x01, 0x02, 0xc8, 0x01, 0x00, 0x48, 0x00, 0x52, 0x12, 0x68, 0x6f, 0x73, 0x74, 0x52, - 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x4c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x1a, 0x5d, 0x0a, - 0x19, 0x54, 0x79, 0x70, 0x65, 0x64, 0x50, 0x65, 0x72, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2a, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, - 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x3a, 0x37, 0x9a, 0xc5, - 0x88, 0x1e, 0x32, 0x0a, 0x30, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, - 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x57, - 0x65, 0x69, 0x67, 0x68, 0x74, 0x42, 0x18, 0x0a, 0x16, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x72, 0x65, - 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x4a, - 0x04, 0x08, 0x07, 0x10, 0x08, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x52, 0x11, 0x70, 0x65, 0x72, - 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x3a, 0x29, - 0x9a, 0xc5, 0x88, 0x1e, 0x24, 0x0a, 0x22, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, - 0x65, 0x64, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x42, 0x18, 0x0a, 0x16, 0x72, 0x61, 0x6e, - 0x64, 0x6f, 0x6d, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, - 0x69, 0x65, 0x72, 0x22, 0x8d, 0x01, 0x0a, 0x16, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x53, - 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x52, - 0x0a, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x2a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x45, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x08, 0xfa, - 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, - 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x61, 0x6c, 0x22, 0xc5, 0x0a, 0x0a, 0x0a, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x12, 0x18, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x14, 0x0a, 0x04, - 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x70, 0x61, - 0x74, 0x68, 0x12, 0x4e, 0x0a, 0x0a, 0x73, 0x61, 0x66, 0x65, 0x5f, 0x72, 0x65, 0x67, 0x65, 0x78, - 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x52, - 0x65, 0x67, 0x65, 0x78, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x42, 0x08, 0xfa, 0x42, 0x05, - 0x8a, 0x01, 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, 0x09, 0x73, 0x61, 0x66, 0x65, 0x52, 0x65, 0x67, - 0x65, 0x78, 0x12, 0x5b, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f, 0x6d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, - 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x2e, 0x43, - 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x48, 0x00, 0x52, - 0x0e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, - 0x4b, 0x0a, 0x15, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x70, 0x61, 0x72, 0x61, 0x74, 0x65, - 0x64, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x42, 0x15, - 0xfa, 0x42, 0x12, 0x72, 0x10, 0x32, 0x0e, 0x5e, 0x5b, 0x5e, 0x3f, 0x23, 0x5d, 0x2b, 0x5b, 0x5e, - 0x3f, 0x23, 0x2f, 0x5d, 0x24, 0x48, 0x00, 0x52, 0x13, 0x70, 0x61, 0x74, 0x68, 0x53, 0x65, 0x70, - 0x61, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x58, 0x0a, 0x11, - 0x70, 0x61, 0x74, 0x68, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x54, - 0x79, 0x70, 0x65, 0x64, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x48, 0x00, 0x52, 0x0f, 0x70, 0x61, 0x74, 0x68, 0x4d, 0x61, 0x74, 0x63, 0x68, - 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x41, 0x0a, 0x0e, 0x63, 0x61, 0x73, 0x65, 0x5f, 0x73, - 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0d, 0x63, 0x61, 0x73, 0x65, - 0x53, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x12, 0x59, 0x0a, 0x10, 0x72, 0x75, 0x6e, - 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x66, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x75, 0x6e, 0x74, 0x69, - 0x6d, 0x65, 0x46, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x63, - 0x65, 0x6e, 0x74, 0x52, 0x0f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x46, 0x72, 0x61, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, - 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x52, 0x07, 0x68, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x73, 0x12, 0x57, 0x0a, 0x10, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, - 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, - 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x65, 0x74, 0x65, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x52, 0x0f, 0x71, 0x75, - 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x4b, 0x0a, - 0x04, 0x67, 0x72, 0x70, 0x63, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, - 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x2e, 0x47, - 0x72, 0x70, 0x63, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x04, 0x67, 0x72, 0x70, 0x63, 0x12, 0x59, 0x0a, 0x0b, 0x74, 0x6c, - 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x38, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, - 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x2e, 0x54, 0x6c, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0a, 0x74, 0x6c, 0x73, 0x43, 0x6f, - 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x51, 0x0a, 0x10, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, - 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x26, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x52, 0x0f, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x53, 0x0a, 0x15, 0x47, 0x72, 0x70, 0x63, - 0x52, 0x6f, 0x75, 0x74, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x3a, 0x3a, 0x9a, 0xc5, 0x88, 0x1e, 0x35, 0x0a, 0x33, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x52, 0x6f, 0x75, - 0x74, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x52, 0x6f, 0x75, 0x74, - 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0xc9, 0x01, - 0x0a, 0x16, 0x54, 0x6c, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x4d, 0x61, 0x74, 0x63, - 0x68, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x38, 0x0a, 0x09, 0x70, 0x72, 0x65, 0x73, - 0x65, 0x6e, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, - 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x09, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, - 0x65, 0x64, 0x12, 0x38, 0x0a, 0x09, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x52, 0x09, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x64, 0x3a, 0x3b, 0x9a, 0xc5, - 0x88, 0x1e, 0x36, 0x0a, 0x34, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x2e, 0x54, 0x6c, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x10, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x3a, 0x24, 0x9a, 0xc5, 0x88, - 0x1e, 0x1f, 0x0a, 0x1d, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x4d, 0x61, 0x74, 0x63, - 0x68, 0x42, 0x15, 0x0a, 0x0e, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, - 0x69, 0x65, 0x72, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x4a, 0x04, - 0x08, 0x03, 0x10, 0x04, 0x52, 0x05, 0x72, 0x65, 0x67, 0x65, 0x78, 0x22, 0xc5, 0x05, 0x0a, 0x0a, - 0x43, 0x6f, 0x72, 0x73, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x5f, 0x0a, 0x19, 0x61, 0x6c, - 0x6c, 0x6f, 0x77, 0x5f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, - 0x68, 0x65, 0x72, 0x52, 0x16, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x23, 0x0a, 0x0d, 0x61, - 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0c, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, - 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x48, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x78, 0x70, 0x6f, 0x73, 0x65, 0x5f, - 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x65, - 0x78, 0x70, 0x6f, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x17, 0x0a, 0x07, - 0x6d, 0x61, 0x78, 0x5f, 0x61, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, - 0x61, 0x78, 0x41, 0x67, 0x65, 0x12, 0x47, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x63, - 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x10, 0x61, 0x6c, - 0x6c, 0x6f, 0x77, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x12, 0x57, - 0x0a, 0x0e, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, - 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x75, - 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x46, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, - 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0d, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, - 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x55, 0x0a, 0x0e, 0x73, 0x68, 0x61, 0x64, 0x6f, - 0x77, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x2e, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, - 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x46, 0x72, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x52, - 0x0d, 0x73, 0x68, 0x61, 0x64, 0x6f, 0x77, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x5b, - 0x0a, 0x1c, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x5f, - 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x0c, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x52, 0x19, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4e, 0x65, - 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x3a, 0x24, 0x9a, 0xc5, 0x88, - 0x1e, 0x1f, 0x0a, 0x1d, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x43, 0x6f, 0x72, 0x73, 0x50, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x42, 0x13, 0x0a, 0x11, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x5f, 0x73, 0x70, 0x65, - 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x4a, 0x04, 0x08, 0x01, 0x10, 0x02, 0x4a, 0x04, 0x08, 0x08, - 0x10, 0x09, 0x4a, 0x04, 0x08, 0x07, 0x10, 0x08, 0x52, 0x0c, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, - 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x12, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x6f, 0x72, - 0x69, 0x67, 0x69, 0x6e, 0x5f, 0x72, 0x65, 0x67, 0x65, 0x78, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, - 0x6c, 0x65, 0x64, 0x22, 0xdc, 0x2c, 0x0a, 0x0b, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x41, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, - 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x36, 0x0a, 0x0e, 0x63, 0x6c, 0x75, 0x73, - 0x74, 0x65, 0x72, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x0d, 0xfa, 0x42, 0x0a, 0x72, 0x08, 0x10, 0x01, 0xc0, 0x01, 0x01, 0xc8, 0x01, 0x00, 0x48, - 0x00, 0x52, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x12, 0x55, 0x0a, 0x11, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6c, 0x75, - 0x73, 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, - 0x2e, 0x76, 0x33, 0x2e, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x43, 0x6c, 0x75, 0x73, - 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x10, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x43, - 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x12, 0x3a, 0x0a, 0x18, 0x63, 0x6c, 0x75, 0x73, 0x74, - 0x65, 0x72, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f, 0x70, 0x6c, 0x75, - 0x67, 0x69, 0x6e, 0x18, 0x25, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x16, 0x63, 0x6c, 0x75, - 0x73, 0x74, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x50, 0x6c, 0x75, - 0x67, 0x69, 0x6e, 0x12, 0x76, 0x0a, 0x1f, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x63, 0x6c, - 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f, - 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x18, 0x27, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, - 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x65, 0x72, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x48, 0x00, 0x52, 0x1c, 0x69, - 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x65, 0x72, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x8e, 0x01, 0x0a, 0x1f, - 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x6e, 0x6f, 0x74, 0x5f, 0x66, 0x6f, 0x75, 0x6e, - 0x64, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, - 0x14, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3e, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x6f, - 0x75, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, - 0x72, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x43, 0x6f, 0x64, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, - 0x1b, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x45, 0x0a, 0x0e, - 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x52, 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x61, - 0x74, 0x63, 0x68, 0x12, 0x32, 0x0a, 0x0e, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x5f, 0x72, 0x65, - 0x77, 0x72, 0x69, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, 0xfa, 0x42, 0x08, - 0x72, 0x06, 0xc0, 0x01, 0x02, 0xc8, 0x01, 0x00, 0x52, 0x0d, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, - 0x52, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x12, 0x53, 0x0a, 0x0d, 0x72, 0x65, 0x67, 0x65, 0x78, - 0x5f, 0x72, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x18, 0x20, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, - 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, - 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x67, 0x65, 0x78, 0x4d, 0x61, 0x74, 0x63, - 0x68, 0x41, 0x6e, 0x64, 0x53, 0x75, 0x62, 0x73, 0x74, 0x69, 0x74, 0x75, 0x74, 0x65, 0x52, 0x0c, - 0x72, 0x65, 0x67, 0x65, 0x78, 0x52, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x12, 0x5a, 0x0a, 0x13, - 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x70, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x18, 0x29, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, - 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x11, 0x70, 0x61, 0x74, 0x68, 0x52, 0x65, 0x77, 0x72, 0x69, - 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x3f, 0x0a, 0x14, 0x68, 0x6f, 0x73, 0x74, - 0x5f, 0x72, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x6c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, 0xfa, 0x42, 0x08, 0x72, 0x06, 0xc0, 0x01, 0x02, - 0xc8, 0x01, 0x00, 0x48, 0x01, 0x52, 0x12, 0x68, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x77, 0x72, 0x69, - 0x74, 0x65, 0x4c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x12, 0x48, 0x0a, 0x11, 0x61, 0x75, 0x74, - 0x6f, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x48, 0x01, 0x52, 0x0f, 0x61, 0x75, 0x74, 0x6f, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x77, 0x72, - 0x69, 0x74, 0x65, 0x12, 0x3d, 0x0a, 0x13, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x77, 0x72, - 0x69, 0x74, 0x65, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x1d, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x0b, 0xfa, 0x42, 0x08, 0x72, 0x06, 0xc0, 0x01, 0x01, 0xc8, 0x01, 0x00, 0x48, 0x01, 0x52, - 0x11, 0x68, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x48, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x12, 0x67, 0x0a, 0x17, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x77, 0x72, 0x69, - 0x74, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x67, 0x65, 0x78, 0x18, 0x23, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x67, 0x65, - 0x78, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x41, 0x6e, 0x64, 0x53, 0x75, 0x62, 0x73, 0x74, 0x69, 0x74, - 0x75, 0x74, 0x65, 0x48, 0x01, 0x52, 0x14, 0x68, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x77, 0x72, 0x69, - 0x74, 0x65, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x67, 0x65, 0x78, 0x12, 0x35, 0x0a, 0x17, 0x61, - 0x70, 0x70, 0x65, 0x6e, 0x64, 0x5f, 0x78, 0x5f, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, - 0x64, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x26, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x61, 0x70, - 0x70, 0x65, 0x6e, 0x64, 0x58, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x64, 0x48, 0x6f, - 0x73, 0x74, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x08, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, - 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x3c, 0x0a, 0x0c, 0x69, 0x64, 0x6c, 0x65, 0x5f, - 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x18, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x69, 0x64, 0x6c, 0x65, 0x54, 0x69, - 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x56, 0x0a, 0x11, 0x65, 0x61, 0x72, 0x6c, 0x79, 0x5f, 0x64, - 0x61, 0x74, 0x61, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x28, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x2a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, - 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x45, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0f, 0x65, 0x61, - 0x72, 0x6c, 0x79, 0x44, 0x61, 0x74, 0x61, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x45, 0x0a, - 0x0c, 0x72, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x09, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x74, 0x72, - 0x79, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x0b, 0x72, 0x65, 0x74, 0x72, 0x79, 0x50, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x12, 0x4f, 0x0a, 0x19, 0x72, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x18, 0x21, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x72, - 0x65, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x54, 0x79, 0x70, 0x65, 0x64, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x6e, 0x0a, 0x17, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x5f, 0x6d, 0x69, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, - 0x18, 0x1e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, - 0x6f, 0x75, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x4d, 0x69, 0x72, 0x72, 0x6f, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x15, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x69, 0x72, 0x72, 0x6f, 0x72, 0x50, 0x6f, 0x6c, - 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, 0x4b, 0x0a, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, - 0x79, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, - 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x42, 0x08, - 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, - 0x74, 0x79, 0x12, 0x41, 0x0a, 0x0b, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, - 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, - 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x0a, 0x72, 0x61, 0x74, 0x65, 0x4c, - 0x69, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x5c, 0x0a, 0x16, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, - 0x5f, 0x76, 0x68, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x18, - 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x42, 0x0b, 0x18, 0x01, 0x92, 0xc7, 0x86, 0xd8, 0x04, 0x03, 0x33, 0x2e, 0x30, 0x52, 0x13, - 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x56, 0x68, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, - 0x69, 0x74, 0x73, 0x12, 0x4e, 0x0a, 0x0b, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, - 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x48, 0x61, 0x73, - 0x68, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x0a, 0x68, 0x61, 0x73, 0x68, 0x50, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x12, 0x42, 0x0a, 0x04, 0x63, 0x6f, 0x72, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x21, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x6f, 0x72, 0x73, 0x50, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x42, 0x0b, 0x18, 0x01, 0x92, 0xc7, 0x86, 0xd8, 0x04, 0x03, 0x33, 0x2e, - 0x30, 0x52, 0x04, 0x63, 0x6f, 0x72, 0x73, 0x12, 0x50, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x5f, 0x67, - 0x72, 0x70, 0x63, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x17, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0b, 0x18, 0x01, - 0x92, 0xc7, 0x86, 0xd8, 0x04, 0x03, 0x33, 0x2e, 0x30, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x47, 0x72, - 0x70, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x56, 0x0a, 0x13, 0x67, 0x72, 0x70, - 0x63, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x18, 0x1c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x42, 0x0b, 0x18, 0x01, 0x92, 0xc7, 0x86, 0xd8, 0x04, 0x03, 0x33, 0x2e, 0x30, 0x52, 0x11, - 0x67, 0x72, 0x70, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x12, 0x59, 0x0a, 0x0f, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x5f, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x73, 0x18, 0x19, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, - 0x76, 0x33, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x55, - 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0e, 0x75, 0x70, - 0x67, 0x72, 0x61, 0x64, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x67, 0x0a, 0x18, - 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, - 0x74, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, - 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, - 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, - 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x16, 0x69, - 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x50, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x80, 0x01, 0x0a, 0x18, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, - 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x5f, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x39, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, - 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x49, 0x6e, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x41, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x42, 0x0b, 0x18, 0x01, 0x92, 0xc7, 0x86, 0xd8, 0x04, 0x03, 0x33, 0x2e, 0x30, - 0x52, 0x16, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, - 0x63, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x5f, 0x0a, 0x16, 0x6d, 0x61, 0x78, 0x5f, - 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, - 0x74, 0x73, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, - 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x0b, 0x18, 0x01, 0x92, 0xc7, 0x86, 0xd8, 0x04, 0x03, - 0x33, 0x2e, 0x30, 0x52, 0x14, 0x6d, 0x61, 0x78, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, - 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x73, 0x12, 0x45, 0x0a, 0x0c, 0x68, 0x65, 0x64, - 0x67, 0x65, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x22, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, - 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x64, 0x67, 0x65, 0x50, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x52, 0x0b, 0x68, 0x65, 0x64, 0x67, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x12, 0x64, 0x0a, 0x13, 0x6d, 0x61, 0x78, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x64, - 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x24, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, - 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x4d, 0x61, 0x78, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x44, 0x75, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x6d, 0x61, 0x78, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x44, 0x75, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x81, 0x03, 0x0a, 0x13, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x4d, 0x69, 0x72, 0x72, 0x6f, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x33, - 0x0a, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x19, 0xf2, 0x98, 0xfe, 0x8f, 0x05, 0x13, 0x12, 0x11, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, - 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x07, 0x63, 0x6c, 0x75, 0x73, - 0x74, 0x65, 0x72, 0x12, 0x4b, 0x0a, 0x0e, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x68, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x24, 0xfa, 0x42, 0x08, - 0x72, 0x06, 0xc0, 0x01, 0x01, 0xc8, 0x01, 0x00, 0xf2, 0x98, 0xfe, 0x8f, 0x05, 0x13, 0x12, 0x11, - 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, - 0x72, 0x52, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x12, 0x59, 0x0a, 0x10, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x66, 0x72, 0x61, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, - 0x33, 0x2e, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x46, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x52, 0x0f, 0x72, 0x75, 0x6e, 0x74, - 0x69, 0x6d, 0x65, 0x46, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x0d, 0x74, - 0x72, 0x61, 0x63, 0x65, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0c, - 0x74, 0x72, 0x61, 0x63, 0x65, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x64, 0x3a, 0x39, 0x9a, 0xc5, - 0x88, 0x1e, 0x34, 0x0a, 0x32, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x41, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x69, 0x72, 0x72, 0x6f, - 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4a, 0x04, 0x08, 0x02, 0x10, 0x03, 0x52, 0x0b, 0x72, - 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x1a, 0xd6, 0x0b, 0x0a, 0x0a, 0x48, - 0x61, 0x73, 0x68, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x4e, 0x0a, 0x06, 0x68, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, - 0x33, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x48, 0x61, - 0x73, 0x68, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x48, - 0x00, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x4e, 0x0a, 0x06, 0x63, 0x6f, 0x6f, - 0x6b, 0x69, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, - 0x33, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x48, 0x61, - 0x73, 0x68, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x43, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x48, - 0x00, 0x52, 0x06, 0x63, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x12, 0x79, 0x0a, 0x15, 0x63, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, - 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x42, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, - 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x48, 0x61, 0x73, - 0x68, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x48, 0x00, 0x52, 0x14, - 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, - 0x74, 0x69, 0x65, 0x73, 0x12, 0x67, 0x0a, 0x0f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3c, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, - 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x48, 0x61, 0x73, 0x68, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0e, 0x71, - 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x5e, 0x0a, - 0x0c, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x6f, 0x75, 0x74, - 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x48, 0x61, 0x73, 0x68, 0x50, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x48, 0x00, - 0x52, 0x0b, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1a, 0x0a, - 0x08, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x08, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x1a, 0xc6, 0x01, 0x0a, 0x06, 0x48, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x12, 0x2e, 0x0a, 0x0b, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0d, 0xfa, 0x42, 0x0a, 0x72, 0x08, - 0x10, 0x01, 0xc0, 0x01, 0x01, 0xc8, 0x01, 0x00, 0x52, 0x0a, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x53, 0x0a, 0x0d, 0x72, 0x65, 0x67, 0x65, 0x78, 0x5f, 0x72, 0x65, - 0x77, 0x72, 0x69, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, - 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x67, 0x65, 0x78, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x41, 0x6e, - 0x64, 0x53, 0x75, 0x62, 0x73, 0x74, 0x69, 0x74, 0x75, 0x74, 0x65, 0x52, 0x0c, 0x72, 0x65, 0x67, - 0x65, 0x78, 0x52, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x3a, 0x37, 0x9a, 0xc5, 0x88, 0x1e, 0x32, - 0x0a, 0x30, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x72, - 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x48, 0x61, 0x73, 0x68, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x48, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x1a, 0x5f, 0x0a, 0x0f, 0x43, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x41, 0x74, 0x74, 0x72, - 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x25, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x11, 0xfa, 0x42, 0x0e, 0x72, 0x0c, 0x10, 0x01, 0x28, 0x80, 0x80, 0x01, - 0xc0, 0x01, 0x01, 0xc8, 0x01, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x25, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0f, 0xfa, 0x42, 0x0c, - 0x72, 0x0a, 0x28, 0x80, 0x80, 0x01, 0xc0, 0x01, 0x02, 0xc8, 0x01, 0x00, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x1a, 0xfe, 0x01, 0x0a, 0x06, 0x43, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x12, 0x1b, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, - 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2b, 0x0a, 0x03, 0x74, - 0x74, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x5d, 0x0a, 0x0a, - 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x3d, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, - 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x41, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x48, 0x61, 0x73, 0x68, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, - 0x43, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, - 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x3a, 0x37, 0x9a, 0xc5, 0x88, - 0x1e, 0x32, 0x0a, 0x30, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x2e, 0x48, 0x61, 0x73, 0x68, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x43, 0x6f, - 0x6f, 0x6b, 0x69, 0x65, 0x1a, 0x7a, 0x0a, 0x14, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x09, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x08, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x70, 0x3a, 0x45, 0x9a, 0xc5, 0x88, 0x1e, 0x40, - 0x0a, 0x3e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x72, - 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x48, 0x61, 0x73, 0x68, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, - 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, - 0x1a, 0x6e, 0x0a, 0x0e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, - 0x65, 0x72, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x3a, - 0x3f, 0x9a, 0xc5, 0x88, 0x1e, 0x3a, 0x0a, 0x38, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, - 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x48, 0x61, 0x73, 0x68, 0x50, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, - 0x1a, 0x66, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, - 0x19, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, - 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x3a, 0x3c, 0x9a, 0xc5, 0x88, 0x1e, - 0x37, 0x0a, 0x35, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x48, 0x61, 0x73, 0x68, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x46, 0x69, 0x6c, - 0x74, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x3a, 0x30, 0x9a, 0xc5, 0x88, 0x1e, 0x2b, 0x0a, - 0x29, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x6f, - 0x75, 0x74, 0x65, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x48, 0x61, 0x73, 0x68, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x42, 0x17, 0x0a, 0x10, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x03, - 0xf8, 0x42, 0x01, 0x1a, 0xa3, 0x03, 0x0a, 0x0d, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x30, 0x0a, 0x0c, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, - 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0d, 0xfa, 0x42, 0x0a, - 0x72, 0x08, 0x10, 0x01, 0xc0, 0x01, 0x02, 0xc8, 0x01, 0x00, 0x52, 0x0b, 0x75, 0x70, 0x67, 0x72, - 0x61, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x34, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, - 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x65, 0x0a, - 0x0e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x6f, - 0x75, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, - 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x1a, 0x8d, 0x01, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x5d, 0x0a, 0x15, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x72, 0x6f, - 0x78, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x52, 0x13, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x70, - 0x6f, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x61, 0x6c, 0x6c, 0x6f, 0x77, - 0x50, 0x6f, 0x73, 0x74, 0x3a, 0x33, 0x9a, 0xc5, 0x88, 0x1e, 0x2e, 0x0a, 0x2c, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, - 0x52, 0x6f, 0x75, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x55, 0x70, 0x67, 0x72, - 0x61, 0x64, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x1a, 0x88, 0x02, 0x0a, 0x11, 0x4d, 0x61, - 0x78, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x49, 0x0a, 0x13, 0x6d, 0x61, 0x78, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x64, 0x75, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, - 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x6d, 0x61, 0x78, 0x53, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x50, 0x0a, 0x17, 0x67, 0x72, - 0x70, 0x63, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x5f, 0x6d, 0x61, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x14, 0x67, 0x72, 0x70, 0x63, 0x54, 0x69, 0x6d, 0x65, - 0x6f, 0x75, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x61, 0x78, 0x12, 0x56, 0x0a, 0x1a, - 0x67, 0x72, 0x70, 0x63, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x68, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x17, 0x67, 0x72, 0x70, - 0x63, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x22, 0x60, 0x0a, 0x1b, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4e, - 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x43, - 0x6f, 0x64, 0x65, 0x12, 0x17, 0x0a, 0x13, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x5f, 0x55, - 0x4e, 0x41, 0x56, 0x41, 0x49, 0x4c, 0x41, 0x42, 0x4c, 0x45, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, - 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x19, 0x0a, 0x15, 0x49, - 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x45, - 0x52, 0x52, 0x4f, 0x52, 0x10, 0x02, 0x22, 0x5e, 0x0a, 0x16, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, - 0x61, 0x6c, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x22, 0x0a, 0x1e, 0x50, 0x41, 0x53, 0x53, 0x5f, 0x54, 0x48, 0x52, 0x4f, 0x55, 0x47, 0x48, - 0x5f, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x5f, 0x52, 0x45, 0x44, 0x49, 0x52, 0x45, - 0x43, 0x54, 0x10, 0x00, 0x12, 0x1c, 0x0a, 0x18, 0x48, 0x41, 0x4e, 0x44, 0x4c, 0x45, 0x5f, 0x49, - 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x5f, 0x52, 0x45, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, - 0x10, 0x01, 0x1a, 0x02, 0x18, 0x01, 0x3a, 0x25, 0x9a, 0xc5, 0x88, 0x1e, 0x20, 0x0a, 0x1e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x6f, 0x75, 0x74, - 0x65, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x18, 0x0a, - 0x11, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x65, 0x72, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x42, 0x18, 0x0a, 0x16, 0x68, 0x6f, 0x73, 0x74, 0x5f, - 0x72, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, - 0x72, 0x4a, 0x04, 0x08, 0x0c, 0x10, 0x0d, 0x4a, 0x04, 0x08, 0x12, 0x10, 0x13, 0x4a, 0x04, 0x08, - 0x13, 0x10, 0x14, 0x4a, 0x04, 0x08, 0x10, 0x10, 0x11, 0x4a, 0x04, 0x08, 0x16, 0x10, 0x17, 0x4a, - 0x04, 0x08, 0x15, 0x10, 0x16, 0x4a, 0x04, 0x08, 0x0a, 0x10, 0x0b, 0x52, 0x15, 0x72, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x5f, 0x6d, 0x69, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x22, 0xbf, 0x10, 0x0a, 0x0b, 0x52, 0x65, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6f, 0x6e, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x74, 0x72, 0x79, 0x4f, 0x6e, 0x12, 0x52, 0x0a, - 0x0b, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x42, 0x13, 0xf2, 0x98, 0xfe, 0x8f, 0x05, 0x0d, 0x0a, 0x0b, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x65, - 0x74, 0x72, 0x69, 0x65, 0x73, 0x52, 0x0a, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x74, 0x72, 0x69, 0x65, - 0x73, 0x12, 0x41, 0x0a, 0x0f, 0x70, 0x65, 0x72, 0x5f, 0x74, 0x72, 0x79, 0x5f, 0x74, 0x69, 0x6d, - 0x65, 0x6f, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x70, 0x65, 0x72, 0x54, 0x72, 0x79, 0x54, 0x69, 0x6d, - 0x65, 0x6f, 0x75, 0x74, 0x12, 0x4a, 0x0a, 0x14, 0x70, 0x65, 0x72, 0x5f, 0x74, 0x72, 0x79, 0x5f, - 0x69, 0x64, 0x6c, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x0d, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x70, - 0x65, 0x72, 0x54, 0x72, 0x79, 0x49, 0x64, 0x6c, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, - 0x12, 0x57, 0x0a, 0x0e, 0x72, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, - 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, - 0x2e, 0x52, 0x65, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x52, 0x65, 0x74, - 0x72, 0x79, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x52, 0x0d, 0x72, 0x65, 0x74, 0x72, - 0x79, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x67, 0x0a, 0x14, 0x72, 0x65, 0x74, - 0x72, 0x79, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, - 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, - 0x52, 0x65, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x52, 0x65, 0x74, 0x72, - 0x79, 0x48, 0x6f, 0x73, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x12, - 0x72, 0x65, 0x74, 0x72, 0x79, 0x48, 0x6f, 0x73, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, - 0x74, 0x65, 0x12, 0x64, 0x0a, 0x18, 0x72, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x18, 0x0c, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x54, 0x79, 0x70, 0x65, - 0x64, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x52, 0x16, 0x72, 0x65, 0x74, 0x72, 0x79, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x50, 0x72, - 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x12, 0x48, 0x0a, 0x21, 0x68, 0x6f, 0x73, 0x74, - 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x74, 0x72, 0x79, - 0x5f, 0x6d, 0x61, 0x78, 0x5f, 0x61, 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x73, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x1d, 0x68, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x74, 0x72, 0x79, 0x4d, 0x61, 0x78, 0x41, 0x74, 0x74, 0x65, 0x6d, 0x70, - 0x74, 0x73, 0x12, 0x34, 0x0a, 0x16, 0x72, 0x65, 0x74, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x5f, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, - 0x28, 0x0d, 0x52, 0x14, 0x72, 0x65, 0x74, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x55, 0x0a, 0x0e, 0x72, 0x65, 0x74, 0x72, - 0x79, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x5f, 0x6f, 0x66, 0x66, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x2f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, - 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x74, 0x72, 0x79, 0x50, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x52, 0x65, 0x74, 0x72, 0x79, 0x42, 0x61, 0x63, 0x6b, 0x4f, 0x66, - 0x66, 0x52, 0x0c, 0x72, 0x65, 0x74, 0x72, 0x79, 0x42, 0x61, 0x63, 0x6b, 0x4f, 0x66, 0x66, 0x12, - 0x78, 0x0a, 0x1b, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x5f, - 0x72, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x5f, 0x6f, 0x66, 0x66, 0x18, 0x0b, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x74, - 0x72, 0x79, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, - 0x69, 0x74, 0x65, 0x64, 0x52, 0x65, 0x74, 0x72, 0x79, 0x42, 0x61, 0x63, 0x6b, 0x4f, 0x66, 0x66, - 0x52, 0x17, 0x72, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x52, 0x65, 0x74, - 0x72, 0x79, 0x42, 0x61, 0x63, 0x6b, 0x4f, 0x66, 0x66, 0x12, 0x51, 0x0a, 0x11, 0x72, 0x65, 0x74, - 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x09, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x52, 0x10, 0x72, 0x65, 0x74, 0x72, - 0x69, 0x61, 0x62, 0x6c, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x60, 0x0a, 0x19, - 0x72, 0x65, 0x74, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x24, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, - 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x52, 0x17, 0x72, 0x65, 0x74, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x1a, 0xb9, - 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x74, 0x72, 0x79, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, - 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, - 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x39, 0x0a, - 0x0c, 0x74, 0x79, 0x70, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x48, 0x00, 0x52, 0x0b, 0x74, 0x79, 0x70, - 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x3a, 0x33, 0x9a, 0xc5, 0x88, 0x1e, 0x2e, 0x0a, - 0x2c, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x6f, - 0x75, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, - 0x52, 0x65, 0x74, 0x72, 0x79, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x42, 0x0d, 0x0a, - 0x0b, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x4a, 0x04, 0x08, 0x02, - 0x10, 0x03, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x1a, 0xc3, 0x01, 0x0a, 0x12, 0x52, - 0x65, 0x74, 0x72, 0x79, 0x48, 0x6f, 0x73, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, - 0x65, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x39, - 0x0a, 0x0c, 0x74, 0x79, 0x70, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x48, 0x00, 0x52, 0x0b, 0x74, 0x79, - 0x70, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x3a, 0x38, 0x9a, 0xc5, 0x88, 0x1e, 0x33, - 0x0a, 0x31, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x72, - 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x2e, 0x52, 0x65, 0x74, 0x72, 0x79, 0x48, 0x6f, 0x73, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, - 0x61, 0x74, 0x65, 0x42, 0x0d, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x74, 0x79, - 0x70, 0x65, 0x4a, 0x04, 0x08, 0x02, 0x10, 0x03, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x1a, 0xd6, 0x01, 0x0a, 0x0c, 0x52, 0x65, 0x74, 0x72, 0x79, 0x42, 0x61, 0x63, 0x6b, 0x4f, 0x66, - 0x66, 0x12, 0x4a, 0x0a, 0x0d, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, - 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x42, 0x0a, 0xfa, 0x42, 0x07, 0xaa, 0x01, 0x04, 0x08, 0x01, 0x2a, 0x00, 0x52, - 0x0c, 0x62, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x46, 0x0a, - 0x0c, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, - 0xfa, 0x42, 0x05, 0xaa, 0x01, 0x02, 0x2a, 0x00, 0x52, 0x0b, 0x6d, 0x61, 0x78, 0x49, 0x6e, 0x74, - 0x65, 0x72, 0x76, 0x61, 0x6c, 0x3a, 0x32, 0x9a, 0xc5, 0x88, 0x1e, 0x2d, 0x0a, 0x2b, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, - 0x2e, 0x52, 0x65, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x52, 0x65, 0x74, - 0x72, 0x79, 0x42, 0x61, 0x63, 0x6b, 0x4f, 0x66, 0x66, 0x1a, 0x88, 0x01, 0x0a, 0x0b, 0x52, 0x65, - 0x73, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0d, 0xfa, 0x42, 0x0a, 0x72, 0x08, 0x10, 0x01, - 0xc0, 0x01, 0x01, 0xc8, 0x01, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x56, 0x0a, 0x06, - 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x34, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, - 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x2e, 0x52, 0x65, 0x73, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x46, 0x6f, 0x72, 0x6d, - 0x61, 0x74, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x06, 0x66, 0x6f, - 0x72, 0x6d, 0x61, 0x74, 0x1a, 0xc0, 0x01, 0x0a, 0x17, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, - 0x69, 0x74, 0x65, 0x64, 0x52, 0x65, 0x74, 0x72, 0x79, 0x42, 0x61, 0x63, 0x6b, 0x4f, 0x66, 0x66, - 0x12, 0x5d, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, - 0x52, 0x65, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x52, 0x65, 0x73, 0x65, - 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, - 0x01, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, - 0x46, 0x0a, 0x0c, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x42, 0x08, 0xfa, 0x42, 0x05, 0xaa, 0x01, 0x02, 0x2a, 0x00, 0x52, 0x0b, 0x6d, 0x61, 0x78, 0x49, - 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x22, 0x34, 0x0a, 0x11, 0x52, 0x65, 0x73, 0x65, 0x74, - 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x0b, 0x0a, 0x07, - 0x53, 0x45, 0x43, 0x4f, 0x4e, 0x44, 0x53, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x55, 0x4e, 0x49, - 0x58, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x53, 0x54, 0x41, 0x4d, 0x50, 0x10, 0x01, 0x3a, 0x25, 0x9a, - 0xc5, 0x88, 0x1e, 0x20, 0x0a, 0x1e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x74, 0x72, 0x79, 0x50, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x22, 0x9c, 0x02, 0x0a, 0x0b, 0x48, 0x65, 0x64, 0x67, 0x65, 0x50, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x12, 0x50, 0x0a, 0x10, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x5f, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x07, 0xfa, 0x42, - 0x04, 0x2a, 0x02, 0x28, 0x01, 0x52, 0x0f, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x12, 0x5c, 0x0a, 0x19, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x68, 0x61, - 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x46, 0x72, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x52, 0x17, 0x61, 0x64, 0x64, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x43, 0x68, - 0x61, 0x6e, 0x63, 0x65, 0x12, 0x36, 0x0a, 0x18, 0x68, 0x65, 0x64, 0x67, 0x65, 0x5f, 0x6f, 0x6e, - 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x74, 0x72, 0x79, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x68, 0x65, 0x64, 0x67, 0x65, 0x4f, 0x6e, 0x50, - 0x65, 0x72, 0x54, 0x72, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x3a, 0x25, 0x9a, 0xc5, - 0x88, 0x1e, 0x20, 0x0a, 0x1e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x32, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x48, 0x65, 0x64, 0x67, 0x65, 0x50, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x22, 0xe1, 0x05, 0x0a, 0x0e, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, - 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x0e, 0x68, 0x74, 0x74, 0x70, 0x73, 0x5f, - 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, - 0x52, 0x0d, 0x68, 0x74, 0x74, 0x70, 0x73, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x12, - 0x29, 0x0a, 0x0f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, - 0x63, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0e, 0x73, 0x63, 0x68, 0x65, - 0x6d, 0x65, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x12, 0x30, 0x0a, 0x0d, 0x68, 0x6f, - 0x73, 0x74, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x0b, 0xfa, 0x42, 0x08, 0x72, 0x06, 0xc0, 0x01, 0x02, 0xc8, 0x01, 0x00, 0x52, 0x0c, - 0x68, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x12, 0x23, 0x0a, 0x0d, - 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x18, 0x08, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, - 0x74, 0x12, 0x32, 0x0a, 0x0d, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, - 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, 0xfa, 0x42, 0x08, 0x72, 0x06, 0xc0, - 0x01, 0x02, 0xc8, 0x01, 0x00, 0x48, 0x01, 0x52, 0x0c, 0x70, 0x61, 0x74, 0x68, 0x52, 0x65, 0x64, - 0x69, 0x72, 0x65, 0x63, 0x74, 0x12, 0x34, 0x0a, 0x0e, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x5f, - 0x72, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, 0xfa, - 0x42, 0x08, 0x72, 0x06, 0xc0, 0x01, 0x02, 0xc8, 0x01, 0x00, 0x48, 0x01, 0x52, 0x0d, 0x70, 0x72, - 0x65, 0x66, 0x69, 0x78, 0x52, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x12, 0x55, 0x0a, 0x0d, 0x72, - 0x65, 0x67, 0x65, 0x78, 0x5f, 0x72, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x67, 0x65, 0x78, - 0x4d, 0x61, 0x74, 0x63, 0x68, 0x41, 0x6e, 0x64, 0x53, 0x75, 0x62, 0x73, 0x74, 0x69, 0x74, 0x75, - 0x74, 0x65, 0x48, 0x01, 0x52, 0x0c, 0x72, 0x65, 0x67, 0x65, 0x78, 0x52, 0x65, 0x77, 0x72, 0x69, - 0x74, 0x65, 0x12, 0x69, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x63, - 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, - 0x33, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x43, 0x6f, 0x64, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, - 0x0c, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1f, 0x0a, - 0x0b, 0x73, 0x74, 0x72, 0x69, 0x70, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x0a, 0x73, 0x74, 0x72, 0x69, 0x70, 0x51, 0x75, 0x65, 0x72, 0x79, 0x22, 0x77, - 0x0a, 0x14, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x4d, 0x4f, 0x56, 0x45, 0x44, 0x5f, - 0x50, 0x45, 0x52, 0x4d, 0x41, 0x4e, 0x45, 0x4e, 0x54, 0x4c, 0x59, 0x10, 0x00, 0x12, 0x09, 0x0a, - 0x05, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x45, 0x45, 0x5f, - 0x4f, 0x54, 0x48, 0x45, 0x52, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x54, 0x45, 0x4d, 0x50, 0x4f, - 0x52, 0x41, 0x52, 0x59, 0x5f, 0x52, 0x45, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x10, 0x03, 0x12, - 0x16, 0x0a, 0x12, 0x50, 0x45, 0x52, 0x4d, 0x41, 0x4e, 0x45, 0x4e, 0x54, 0x5f, 0x52, 0x45, 0x44, - 0x49, 0x52, 0x45, 0x43, 0x54, 0x10, 0x04, 0x3a, 0x28, 0x9a, 0xc5, 0x88, 0x1e, 0x23, 0x0a, 0x21, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x6f, 0x75, - 0x74, 0x65, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x42, 0x1a, 0x0a, 0x18, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x5f, 0x72, 0x65, 0x77, 0x72, - 0x69, 0x74, 0x65, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x42, 0x18, 0x0a, - 0x16, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x72, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0xa1, 0x01, 0x0a, 0x14, 0x44, 0x69, 0x72, 0x65, - 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x23, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, - 0x42, 0x0b, 0xfa, 0x42, 0x08, 0x2a, 0x06, 0x10, 0xd8, 0x04, 0x28, 0xc8, 0x01, 0x52, 0x06, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x34, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x53, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x3a, 0x2e, 0x9a, 0xc5, 0x88, - 0x1e, 0x29, 0x0a, 0x27, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x15, 0x0a, 0x13, 0x4e, - 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x22, 0x91, 0x01, 0x0a, 0x09, 0x44, 0x65, 0x63, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, - 0x12, 0x25, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x09, 0x6f, 0x70, - 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x38, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x70, 0x61, - 0x67, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, - 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x70, 0x61, 0x67, 0x61, 0x74, - 0x65, 0x3a, 0x23, 0x9a, 0xc5, 0x88, 0x1e, 0x1e, 0x0a, 0x1c, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x44, 0x65, 0x63, - 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x22, 0xd2, 0x02, 0x0a, 0x07, 0x54, 0x72, 0x61, 0x63, 0x69, - 0x6e, 0x67, 0x12, 0x49, 0x0a, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x61, 0x6d, - 0x70, 0x6c, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x46, 0x72, 0x61, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x52, 0x0e, 0x63, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x69, 0x6e, 0x67, 0x12, 0x49, 0x0a, - 0x0f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x69, 0x6e, 0x67, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x46, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, - 0x6c, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x52, 0x0e, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, - 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x69, 0x6e, 0x67, 0x12, 0x4b, 0x0a, 0x10, 0x6f, 0x76, 0x65, 0x72, - 0x61, 0x6c, 0x6c, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, - 0x76, 0x33, 0x2e, 0x46, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x65, 0x72, - 0x63, 0x65, 0x6e, 0x74, 0x52, 0x0f, 0x6f, 0x76, 0x65, 0x72, 0x61, 0x6c, 0x6c, 0x53, 0x61, 0x6d, - 0x70, 0x6c, 0x69, 0x6e, 0x67, 0x12, 0x41, 0x0a, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, - 0x74, 0x61, 0x67, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x2e, - 0x76, 0x33, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x63, 0x75, - 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x61, 0x67, 0x73, 0x3a, 0x21, 0x9a, 0xc5, 0x88, 0x1e, 0x1c, 0x0a, - 0x1a, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x6f, - 0x75, 0x74, 0x65, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x22, 0xb4, 0x01, 0x0a, 0x0e, - 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x3e, - 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x24, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, - 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x1b, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, - 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x28, 0x9a, 0xc5, 0x88, - 0x1e, 0x23, 0x0a, 0x21, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x43, 0x6c, - 0x75, 0x73, 0x74, 0x65, 0x72, 0x4a, 0x04, 0x08, 0x01, 0x10, 0x02, 0x4a, 0x04, 0x08, 0x03, 0x10, - 0x04, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, - 0x6f, 0x64, 0x22, 0xc9, 0x1c, 0x0a, 0x09, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, - 0x12, 0x3b, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x07, 0xfa, - 0x42, 0x04, 0x2a, 0x02, 0x18, 0x0a, 0x52, 0x05, 0x73, 0x74, 0x61, 0x67, 0x65, 0x12, 0x1f, 0x0a, - 0x0b, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0a, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x4b, - 0x0a, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x27, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, - 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, - 0x74, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, - 0x08, 0x01, 0x52, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3f, 0x0a, 0x05, 0x6c, - 0x69, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, - 0x76, 0x33, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x4f, 0x76, 0x65, - 0x72, 0x72, 0x69, 0x64, 0x65, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x1a, 0xb5, 0x18, 0x0a, - 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x5e, 0x0a, 0x0e, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x35, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, - 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, - 0x74, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, - 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0d, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x6d, 0x0a, 0x13, 0x64, 0x65, 0x73, 0x74, 0x69, - 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x61, 0x74, - 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x44, 0x65, - 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, - 0x48, 0x00, 0x52, 0x12, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, - 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x61, 0x0a, 0x0f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x36, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, - 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, - 0x74, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x48, 0x00, 0x52, 0x0e, 0x72, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x5e, 0x0a, 0x0e, 0x72, 0x65, 0x6d, - 0x6f, 0x74, 0x65, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x35, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, - 0x6d, 0x69, 0x74, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x74, - 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x48, 0x00, 0x52, 0x0d, 0x72, 0x65, 0x6d, 0x6f, - 0x74, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x55, 0x0a, 0x0b, 0x67, 0x65, 0x6e, - 0x65, 0x72, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, - 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, - 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, - 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x4b, - 0x65, 0x79, 0x48, 0x00, 0x52, 0x0a, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, - 0x12, 0x68, 0x0a, 0x12, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, - 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x41, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x10, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x77, 0x0a, 0x10, 0x64, 0x79, - 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x61, 0x74, - 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x44, 0x79, - 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x42, 0x11, 0x18, - 0x01, 0x92, 0xc7, 0x86, 0xd8, 0x04, 0x03, 0x33, 0x2e, 0x30, 0xb8, 0xee, 0xf2, 0xd2, 0x05, 0x01, - 0x48, 0x00, 0x52, 0x0f, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x12, 0x4e, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x61, - 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, - 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x48, 0x00, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x12, 0x4a, 0x0a, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x54, 0x79, - 0x70, 0x65, 0x64, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x48, 0x00, 0x52, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x71, 0x0a, 0x15, 0x6d, 0x61, 0x73, 0x6b, 0x65, 0x64, 0x5f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, - 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3b, - 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, - 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, - 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x73, 0x6b, 0x65, 0x64, 0x52, 0x65, - 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x48, 0x00, 0x52, 0x13, 0x6d, - 0x61, 0x73, 0x6b, 0x65, 0x64, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x81, 0x01, 0x0a, 0x1b, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, - 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x18, 0x71, 0x75, - 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x1a, 0x49, 0x0a, 0x0d, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x3a, 0x38, 0x9a, 0xc5, 0x88, 0x1e, 0x33, 0x0a, 0x31, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x6f, 0x75, - 0x74, 0x65, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x41, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, - 0x72, 0x1a, 0x53, 0x0a, 0x12, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x3a, 0x3d, 0x9a, 0xc5, 0x88, 0x1e, 0x38, 0x0a, 0x36, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x6f, 0x75, - 0x74, 0x65, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x41, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, - 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x1a, 0xd1, 0x01, 0x0a, 0x0e, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x2e, 0x0a, 0x0b, 0x68, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0d, - 0xfa, 0x42, 0x0a, 0x72, 0x08, 0x10, 0x01, 0xc0, 0x01, 0x01, 0xc8, 0x01, 0x00, 0x52, 0x0a, 0x68, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2e, 0x0a, 0x0e, 0x64, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0d, 0x64, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x24, 0x0a, 0x0e, 0x73, 0x6b, 0x69, - 0x70, 0x5f, 0x69, 0x66, 0x5f, 0x61, 0x62, 0x73, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x0c, 0x73, 0x6b, 0x69, 0x70, 0x49, 0x66, 0x41, 0x62, 0x73, 0x65, 0x6e, 0x74, 0x3a, - 0x39, 0x9a, 0xc5, 0x88, 0x1e, 0x34, 0x0a, 0x32, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, - 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x1a, 0x49, 0x0a, 0x0d, 0x52, 0x65, - 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x38, 0x9a, 0xc5, 0x88, - 0x1e, 0x33, 0x0a, 0x31, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, - 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x1a, 0xbe, 0x01, 0x0a, 0x13, 0x4d, 0x61, 0x73, 0x6b, 0x65, 0x64, - 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x52, 0x0a, - 0x12, 0x76, 0x34, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x5f, - 0x6c, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, - 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x18, 0x20, - 0x52, 0x0f, 0x76, 0x34, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x4d, 0x61, 0x73, 0x6b, 0x4c, 0x65, - 0x6e, 0x12, 0x53, 0x0a, 0x12, 0x76, 0x36, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x5f, 0x6d, - 0x61, 0x73, 0x6b, 0x5f, 0x6c, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, - 0x2a, 0x03, 0x18, 0x80, 0x01, 0x52, 0x0f, 0x76, 0x36, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x4d, - 0x61, 0x73, 0x6b, 0x4c, 0x65, 0x6e, 0x1a, 0x9e, 0x01, 0x0a, 0x0a, 0x47, 0x65, 0x6e, 0x65, 0x72, - 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x32, 0x0a, 0x10, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x6f, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x6f, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0d, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x4b, 0x65, 0x79, - 0x3a, 0x35, 0x9a, 0xc5, 0x88, 0x1e, 0x30, 0x0a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x52, 0x61, 0x74, 0x65, - 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x47, 0x65, 0x6e, - 0x65, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x1a, 0xb3, 0x02, 0x0a, 0x10, 0x48, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x25, 0x0a, 0x0e, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, - 0x4b, 0x65, 0x79, 0x12, 0x32, 0x0a, 0x10, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, - 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, - 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x6f, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3d, 0x0a, 0x0c, 0x65, 0x78, 0x70, 0x65, 0x63, - 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0b, 0x65, 0x78, 0x70, 0x65, 0x63, - 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x48, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, - 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x42, 0x08, 0xfa, - 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, - 0x3a, 0x3b, 0x9a, 0xc5, 0x88, 0x1e, 0x36, 0x0a, 0x34, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x52, 0x61, 0x74, 0x65, - 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x1a, 0xb8, 0x01, - 0x0a, 0x0f, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, - 0x61, 0x12, 0x2e, 0x0a, 0x0e, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x5f, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, - 0x10, 0x01, 0x52, 0x0d, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x4b, 0x65, - 0x79, 0x12, 0x50, 0x0a, 0x0c, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6b, 0x65, - 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x76, 0x33, - 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4b, 0x65, 0x79, 0x42, 0x08, 0xfa, 0x42, - 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x4b, 0x65, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, - 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0xda, 0x02, 0x0a, 0x08, 0x4d, 0x65, 0x74, - 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x2e, 0x0a, 0x0e, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x6f, 0x72, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, - 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0d, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x6f, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x50, 0x0a, 0x0c, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4b, 0x65, 0x79, - 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x0b, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x4b, 0x65, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, - 0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, - 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x59, 0x0a, 0x06, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x37, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, - 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x41, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x53, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, - 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x73, 0x6b, 0x69, 0x70, 0x5f, - 0x69, 0x66, 0x5f, 0x61, 0x62, 0x73, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x0c, 0x73, 0x6b, 0x69, 0x70, 0x49, 0x66, 0x41, 0x62, 0x73, 0x65, 0x6e, 0x74, 0x22, 0x26, 0x0a, - 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x59, 0x4e, 0x41, 0x4d, - 0x49, 0x43, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x52, 0x4f, 0x55, 0x54, 0x45, 0x5f, 0x45, 0x4e, - 0x54, 0x52, 0x59, 0x10, 0x01, 0x1a, 0x97, 0x02, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, - 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x64, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x32, 0x0a, 0x10, 0x64, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0f, 0x64, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3d, 0x0a, - 0x0c, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, - 0x0b, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x61, 0x0a, 0x10, - 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x0f, - 0x71, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x3a, - 0x2a, 0x9a, 0xc5, 0x88, 0x1e, 0x25, 0x0a, 0x23, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, - 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x17, 0x0a, 0x10, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, - 0x03, 0xf8, 0x42, 0x01, 0x1a, 0xf2, 0x01, 0x0a, 0x08, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, - 0x65, 0x12, 0x66, 0x0a, 0x10, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x5f, 0x6d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, - 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x4f, 0x76, - 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x2e, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x48, 0x00, 0x52, 0x0f, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, - 0x63, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x63, 0x0a, 0x0f, 0x44, 0x79, 0x6e, - 0x61, 0x6d, 0x69, 0x63, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x50, 0x0a, 0x0c, - 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, - 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x4b, 0x65, 0x79, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, - 0x01, 0x52, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4b, 0x65, 0x79, 0x42, 0x19, - 0x0a, 0x12, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x65, 0x72, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x3a, 0x23, 0x9a, 0xc5, 0x88, 0x1e, 0x1e, - 0x0a, 0x1c, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x72, - 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0xe6, - 0x05, 0x0a, 0x0d, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, - 0x12, 0x21, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0d, - 0xfa, 0x42, 0x0a, 0x72, 0x08, 0x10, 0x01, 0xc0, 0x01, 0x01, 0xc8, 0x01, 0x00, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x2e, 0x0a, 0x0b, 0x65, 0x78, 0x61, 0x63, 0x74, 0x5f, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, 0x18, 0x01, 0x92, 0xc7, 0x86, 0xd8, - 0x04, 0x03, 0x33, 0x2e, 0x30, 0x48, 0x00, 0x52, 0x0a, 0x65, 0x78, 0x61, 0x63, 0x74, 0x4d, 0x61, - 0x74, 0x63, 0x68, 0x12, 0x5c, 0x0a, 0x10, 0x73, 0x61, 0x66, 0x65, 0x5f, 0x72, 0x65, 0x67, 0x65, - 0x78, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x67, 0x65, 0x78, 0x4d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x42, 0x0b, 0x18, 0x01, 0x92, 0xc7, 0x86, 0xd8, 0x04, 0x03, 0x33, 0x2e, 0x30, 0x48, - 0x00, 0x52, 0x0e, 0x73, 0x61, 0x66, 0x65, 0x52, 0x65, 0x67, 0x65, 0x78, 0x4d, 0x61, 0x74, 0x63, - 0x68, 0x12, 0x3c, 0x0a, 0x0b, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x61, 0x6e, 0x67, - 0x65, 0x48, 0x00, 0x52, 0x0a, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, - 0x25, 0x0a, 0x0d, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x0c, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, - 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x37, 0x0a, 0x0c, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, - 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x42, 0x12, 0x18, 0x01, - 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x92, 0xc7, 0x86, 0xd8, 0x04, 0x03, 0x33, 0x2e, 0x30, - 0x48, 0x00, 0x52, 0x0b, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, - 0x37, 0x0a, 0x0c, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, - 0x0a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x12, 0x18, 0x01, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, - 0x92, 0xc7, 0x86, 0xd8, 0x04, 0x03, 0x33, 0x2e, 0x30, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x75, 0x66, - 0x66, 0x69, 0x78, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x3b, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x73, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x12, 0x18, 0x01, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x92, 0xc7, 0x86, 0xd8, 0x04, - 0x03, 0x33, 0x2e, 0x30, 0x48, 0x00, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, - 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x49, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, - 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, - 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x4d, 0x61, - 0x74, 0x63, 0x68, 0x12, 0x40, 0x0a, 0x1d, 0x74, 0x72, 0x65, 0x61, 0x74, 0x5f, 0x6d, 0x69, 0x73, - 0x73, 0x69, 0x6e, 0x67, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x61, 0x73, 0x5f, 0x65, - 0x6d, 0x70, 0x74, 0x79, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x19, 0x74, 0x72, 0x65, 0x61, - 0x74, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x41, 0x73, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x3a, 0x27, 0x9a, 0xc5, 0x88, 0x1e, 0x22, 0x0a, 0x20, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, - 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x42, 0x18, - 0x0a, 0x16, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x73, - 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x4a, 0x04, 0x08, 0x02, 0x10, 0x03, 0x4a, 0x04, - 0x08, 0x03, 0x10, 0x04, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x52, 0x0b, 0x72, 0x65, 0x67, 0x65, - 0x78, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x22, 0xa1, 0x02, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x12, 0x1e, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x0a, 0xfa, 0x42, 0x07, 0x72, 0x05, 0x10, 0x01, 0x28, 0x80, 0x08, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x53, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6d, 0x61, 0x74, 0x63, - 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x42, 0x08, 0xfa, - 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x25, 0x0a, 0x0d, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, - 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, - 0x0c, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x3a, 0x2f, 0x9a, - 0xc5, 0x88, 0x1e, 0x2a, 0x0a, 0x28, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x42, 0x21, - 0x0a, 0x1f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, - 0x72, 0x4a, 0x04, 0x08, 0x03, 0x10, 0x04, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x72, 0x65, 0x67, 0x65, 0x78, 0x22, 0x86, 0x03, 0x0a, 0x16, - 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, - 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x52, 0x0a, 0x16, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x52, 0x14, 0x6d, 0x61, 0x78, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, - 0x6c, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x73, 0x12, 0x40, 0x0a, 0x17, 0x72, 0x65, - 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, - 0x63, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, 0x42, 0x08, 0xfa, 0x42, 0x05, - 0x92, 0x01, 0x02, 0x10, 0x05, 0x52, 0x15, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x4a, 0x0a, 0x0a, - 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x2a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, - 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x45, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0a, 0x70, 0x72, - 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x12, 0x3d, 0x0a, 0x1b, 0x61, 0x6c, 0x6c, 0x6f, - 0x77, 0x5f, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x5f, 0x72, - 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x18, 0x61, - 0x6c, 0x6c, 0x6f, 0x77, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x52, - 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x12, 0x4b, 0x0a, 0x18, 0x72, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x63, - 0x6f, 0x70, 0x79, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x42, 0x12, 0xfa, 0x42, 0x0f, 0x92, 0x01, - 0x0c, 0x18, 0x01, 0x22, 0x08, 0x72, 0x06, 0xc0, 0x01, 0x01, 0xc8, 0x01, 0x00, 0x52, 0x15, 0x72, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x54, 0x6f, - 0x43, 0x6f, 0x70, 0x79, 0x22, 0x79, 0x0a, 0x0c, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2c, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, - 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x61, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x42, - 0x8b, 0x01, 0x0a, 0x23, 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, - 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, - 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x42, 0x14, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x43, 0x6f, - 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, - 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2f, 0x76, 0x33, 0x3b, 0x72, 0x6f, - 0x75, 0x74, 0x65, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_config_route_v3_route_components_proto_rawDescOnce sync.Once - file_envoy_config_route_v3_route_components_proto_rawDescData = file_envoy_config_route_v3_route_components_proto_rawDesc -) - -func file_envoy_config_route_v3_route_components_proto_rawDescGZIP() []byte { - file_envoy_config_route_v3_route_components_proto_rawDescOnce.Do(func() { - file_envoy_config_route_v3_route_components_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_config_route_v3_route_components_proto_rawDescData) - }) - return file_envoy_config_route_v3_route_components_proto_rawDescData -} - -var file_envoy_config_route_v3_route_components_proto_enumTypes = make([]protoimpl.EnumInfo, 6) -var file_envoy_config_route_v3_route_components_proto_msgTypes = make([]protoimpl.MessageInfo, 58) -var file_envoy_config_route_v3_route_components_proto_goTypes = []interface{}{ - (VirtualHost_TlsRequirementType)(0), // 0: envoy.config.route.v3.VirtualHost.TlsRequirementType - (RouteAction_ClusterNotFoundResponseCode)(0), // 1: envoy.config.route.v3.RouteAction.ClusterNotFoundResponseCode - (RouteAction_InternalRedirectAction)(0), // 2: envoy.config.route.v3.RouteAction.InternalRedirectAction - (RetryPolicy_ResetHeaderFormat)(0), // 3: envoy.config.route.v3.RetryPolicy.ResetHeaderFormat - (RedirectAction_RedirectResponseCode)(0), // 4: envoy.config.route.v3.RedirectAction.RedirectResponseCode - (RateLimit_Action_MetaData_Source)(0), // 5: envoy.config.route.v3.RateLimit.Action.MetaData.Source - (*VirtualHost)(nil), // 6: envoy.config.route.v3.VirtualHost - (*FilterAction)(nil), // 7: envoy.config.route.v3.FilterAction - (*RouteList)(nil), // 8: envoy.config.route.v3.RouteList - (*Route)(nil), // 9: envoy.config.route.v3.Route - (*WeightedCluster)(nil), // 10: envoy.config.route.v3.WeightedCluster - (*ClusterSpecifierPlugin)(nil), // 11: envoy.config.route.v3.ClusterSpecifierPlugin - (*RouteMatch)(nil), // 12: envoy.config.route.v3.RouteMatch - (*CorsPolicy)(nil), // 13: envoy.config.route.v3.CorsPolicy - (*RouteAction)(nil), // 14: envoy.config.route.v3.RouteAction - (*RetryPolicy)(nil), // 15: envoy.config.route.v3.RetryPolicy - (*HedgePolicy)(nil), // 16: envoy.config.route.v3.HedgePolicy - (*RedirectAction)(nil), // 17: envoy.config.route.v3.RedirectAction - (*DirectResponseAction)(nil), // 18: envoy.config.route.v3.DirectResponseAction - (*NonForwardingAction)(nil), // 19: envoy.config.route.v3.NonForwardingAction - (*Decorator)(nil), // 20: envoy.config.route.v3.Decorator - (*Tracing)(nil), // 21: envoy.config.route.v3.Tracing - (*VirtualCluster)(nil), // 22: envoy.config.route.v3.VirtualCluster - (*RateLimit)(nil), // 23: envoy.config.route.v3.RateLimit - (*HeaderMatcher)(nil), // 24: envoy.config.route.v3.HeaderMatcher - (*QueryParameterMatcher)(nil), // 25: envoy.config.route.v3.QueryParameterMatcher - (*InternalRedirectPolicy)(nil), // 26: envoy.config.route.v3.InternalRedirectPolicy - (*FilterConfig)(nil), // 27: envoy.config.route.v3.FilterConfig - nil, // 28: envoy.config.route.v3.VirtualHost.TypedPerFilterConfigEntry - nil, // 29: envoy.config.route.v3.Route.TypedPerFilterConfigEntry - (*WeightedCluster_ClusterWeight)(nil), // 30: envoy.config.route.v3.WeightedCluster.ClusterWeight - nil, // 31: envoy.config.route.v3.WeightedCluster.ClusterWeight.TypedPerFilterConfigEntry - (*RouteMatch_GrpcRouteMatchOptions)(nil), // 32: envoy.config.route.v3.RouteMatch.GrpcRouteMatchOptions - (*RouteMatch_TlsContextMatchOptions)(nil), // 33: envoy.config.route.v3.RouteMatch.TlsContextMatchOptions - (*RouteMatch_ConnectMatcher)(nil), // 34: envoy.config.route.v3.RouteMatch.ConnectMatcher - (*RouteAction_RequestMirrorPolicy)(nil), // 35: envoy.config.route.v3.RouteAction.RequestMirrorPolicy - (*RouteAction_HashPolicy)(nil), // 36: envoy.config.route.v3.RouteAction.HashPolicy - (*RouteAction_UpgradeConfig)(nil), // 37: envoy.config.route.v3.RouteAction.UpgradeConfig - (*RouteAction_MaxStreamDuration)(nil), // 38: envoy.config.route.v3.RouteAction.MaxStreamDuration - (*RouteAction_HashPolicy_Header)(nil), // 39: envoy.config.route.v3.RouteAction.HashPolicy.Header - (*RouteAction_HashPolicy_CookieAttribute)(nil), // 40: envoy.config.route.v3.RouteAction.HashPolicy.CookieAttribute - (*RouteAction_HashPolicy_Cookie)(nil), // 41: envoy.config.route.v3.RouteAction.HashPolicy.Cookie - (*RouteAction_HashPolicy_ConnectionProperties)(nil), // 42: envoy.config.route.v3.RouteAction.HashPolicy.ConnectionProperties - (*RouteAction_HashPolicy_QueryParameter)(nil), // 43: envoy.config.route.v3.RouteAction.HashPolicy.QueryParameter - (*RouteAction_HashPolicy_FilterState)(nil), // 44: envoy.config.route.v3.RouteAction.HashPolicy.FilterState - (*RouteAction_UpgradeConfig_ConnectConfig)(nil), // 45: envoy.config.route.v3.RouteAction.UpgradeConfig.ConnectConfig - (*RetryPolicy_RetryPriority)(nil), // 46: envoy.config.route.v3.RetryPolicy.RetryPriority - (*RetryPolicy_RetryHostPredicate)(nil), // 47: envoy.config.route.v3.RetryPolicy.RetryHostPredicate - (*RetryPolicy_RetryBackOff)(nil), // 48: envoy.config.route.v3.RetryPolicy.RetryBackOff - (*RetryPolicy_ResetHeader)(nil), // 49: envoy.config.route.v3.RetryPolicy.ResetHeader - (*RetryPolicy_RateLimitedRetryBackOff)(nil), // 50: envoy.config.route.v3.RetryPolicy.RateLimitedRetryBackOff - (*RateLimit_Action)(nil), // 51: envoy.config.route.v3.RateLimit.Action - (*RateLimit_Override)(nil), // 52: envoy.config.route.v3.RateLimit.Override - (*RateLimit_Action_SourceCluster)(nil), // 53: envoy.config.route.v3.RateLimit.Action.SourceCluster - (*RateLimit_Action_DestinationCluster)(nil), // 54: envoy.config.route.v3.RateLimit.Action.DestinationCluster - (*RateLimit_Action_RequestHeaders)(nil), // 55: envoy.config.route.v3.RateLimit.Action.RequestHeaders - (*RateLimit_Action_RemoteAddress)(nil), // 56: envoy.config.route.v3.RateLimit.Action.RemoteAddress - (*RateLimit_Action_MaskedRemoteAddress)(nil), // 57: envoy.config.route.v3.RateLimit.Action.MaskedRemoteAddress - (*RateLimit_Action_GenericKey)(nil), // 58: envoy.config.route.v3.RateLimit.Action.GenericKey - (*RateLimit_Action_HeaderValueMatch)(nil), // 59: envoy.config.route.v3.RateLimit.Action.HeaderValueMatch - (*RateLimit_Action_DynamicMetaData)(nil), // 60: envoy.config.route.v3.RateLimit.Action.DynamicMetaData - (*RateLimit_Action_MetaData)(nil), // 61: envoy.config.route.v3.RateLimit.Action.MetaData - (*RateLimit_Action_QueryParameterValueMatch)(nil), // 62: envoy.config.route.v3.RateLimit.Action.QueryParameterValueMatch - (*RateLimit_Override_DynamicMetadata)(nil), // 63: envoy.config.route.v3.RateLimit.Override.DynamicMetadata - (*v3.Matcher)(nil), // 64: xds.type.matcher.v3.Matcher - (*v31.HeaderValueOption)(nil), // 65: envoy.config.core.v3.HeaderValueOption - (*anypb.Any)(nil), // 66: google.protobuf.Any - (*wrapperspb.UInt32Value)(nil), // 67: google.protobuf.UInt32Value - (*v31.Metadata)(nil), // 68: envoy.config.core.v3.Metadata - (*v31.TypedExtensionConfig)(nil), // 69: envoy.config.core.v3.TypedExtensionConfig - (*v32.RegexMatcher)(nil), // 70: envoy.type.matcher.v3.RegexMatcher - (*wrapperspb.BoolValue)(nil), // 71: google.protobuf.BoolValue - (*v31.RuntimeFractionalPercent)(nil), // 72: envoy.config.core.v3.RuntimeFractionalPercent - (*v32.MetadataMatcher)(nil), // 73: envoy.type.matcher.v3.MetadataMatcher - (*v32.StringMatcher)(nil), // 74: envoy.type.matcher.v3.StringMatcher - (*v32.RegexMatchAndSubstitute)(nil), // 75: envoy.type.matcher.v3.RegexMatchAndSubstitute - (*durationpb.Duration)(nil), // 76: google.protobuf.Duration - (v31.RoutingPriority)(0), // 77: envoy.config.core.v3.RoutingPriority - (*v33.FractionalPercent)(nil), // 78: envoy.type.v3.FractionalPercent - (*v31.DataSource)(nil), // 79: envoy.config.core.v3.DataSource - (*v34.CustomTag)(nil), // 80: envoy.type.tracing.v3.CustomTag - (*v33.Int64Range)(nil), // 81: envoy.type.v3.Int64Range - (*v31.ProxyProtocolConfig)(nil), // 82: envoy.config.core.v3.ProxyProtocolConfig - (*v35.MetadataKey)(nil), // 83: envoy.type.metadata.v3.MetadataKey -} -var file_envoy_config_route_v3_route_components_proto_depIdxs = []int32{ - 9, // 0: envoy.config.route.v3.VirtualHost.routes:type_name -> envoy.config.route.v3.Route - 64, // 1: envoy.config.route.v3.VirtualHost.matcher:type_name -> xds.type.matcher.v3.Matcher - 0, // 2: envoy.config.route.v3.VirtualHost.require_tls:type_name -> envoy.config.route.v3.VirtualHost.TlsRequirementType - 22, // 3: envoy.config.route.v3.VirtualHost.virtual_clusters:type_name -> envoy.config.route.v3.VirtualCluster - 23, // 4: envoy.config.route.v3.VirtualHost.rate_limits:type_name -> envoy.config.route.v3.RateLimit - 65, // 5: envoy.config.route.v3.VirtualHost.request_headers_to_add:type_name -> envoy.config.core.v3.HeaderValueOption - 65, // 6: envoy.config.route.v3.VirtualHost.response_headers_to_add:type_name -> envoy.config.core.v3.HeaderValueOption - 13, // 7: envoy.config.route.v3.VirtualHost.cors:type_name -> envoy.config.route.v3.CorsPolicy - 28, // 8: envoy.config.route.v3.VirtualHost.typed_per_filter_config:type_name -> envoy.config.route.v3.VirtualHost.TypedPerFilterConfigEntry - 15, // 9: envoy.config.route.v3.VirtualHost.retry_policy:type_name -> envoy.config.route.v3.RetryPolicy - 66, // 10: envoy.config.route.v3.VirtualHost.retry_policy_typed_config:type_name -> google.protobuf.Any - 16, // 11: envoy.config.route.v3.VirtualHost.hedge_policy:type_name -> envoy.config.route.v3.HedgePolicy - 67, // 12: envoy.config.route.v3.VirtualHost.per_request_buffer_limit_bytes:type_name -> google.protobuf.UInt32Value - 35, // 13: envoy.config.route.v3.VirtualHost.request_mirror_policies:type_name -> envoy.config.route.v3.RouteAction.RequestMirrorPolicy - 68, // 14: envoy.config.route.v3.VirtualHost.metadata:type_name -> envoy.config.core.v3.Metadata - 66, // 15: envoy.config.route.v3.FilterAction.action:type_name -> google.protobuf.Any - 9, // 16: envoy.config.route.v3.RouteList.routes:type_name -> envoy.config.route.v3.Route - 12, // 17: envoy.config.route.v3.Route.match:type_name -> envoy.config.route.v3.RouteMatch - 14, // 18: envoy.config.route.v3.Route.route:type_name -> envoy.config.route.v3.RouteAction - 17, // 19: envoy.config.route.v3.Route.redirect:type_name -> envoy.config.route.v3.RedirectAction - 18, // 20: envoy.config.route.v3.Route.direct_response:type_name -> envoy.config.route.v3.DirectResponseAction - 7, // 21: envoy.config.route.v3.Route.filter_action:type_name -> envoy.config.route.v3.FilterAction - 19, // 22: envoy.config.route.v3.Route.non_forwarding_action:type_name -> envoy.config.route.v3.NonForwardingAction - 68, // 23: envoy.config.route.v3.Route.metadata:type_name -> envoy.config.core.v3.Metadata - 20, // 24: envoy.config.route.v3.Route.decorator:type_name -> envoy.config.route.v3.Decorator - 29, // 25: envoy.config.route.v3.Route.typed_per_filter_config:type_name -> envoy.config.route.v3.Route.TypedPerFilterConfigEntry - 65, // 26: envoy.config.route.v3.Route.request_headers_to_add:type_name -> envoy.config.core.v3.HeaderValueOption - 65, // 27: envoy.config.route.v3.Route.response_headers_to_add:type_name -> envoy.config.core.v3.HeaderValueOption - 21, // 28: envoy.config.route.v3.Route.tracing:type_name -> envoy.config.route.v3.Tracing - 67, // 29: envoy.config.route.v3.Route.per_request_buffer_limit_bytes:type_name -> google.protobuf.UInt32Value - 30, // 30: envoy.config.route.v3.WeightedCluster.clusters:type_name -> envoy.config.route.v3.WeightedCluster.ClusterWeight - 67, // 31: envoy.config.route.v3.WeightedCluster.total_weight:type_name -> google.protobuf.UInt32Value - 69, // 32: envoy.config.route.v3.ClusterSpecifierPlugin.extension:type_name -> envoy.config.core.v3.TypedExtensionConfig - 70, // 33: envoy.config.route.v3.RouteMatch.safe_regex:type_name -> envoy.type.matcher.v3.RegexMatcher - 34, // 34: envoy.config.route.v3.RouteMatch.connect_matcher:type_name -> envoy.config.route.v3.RouteMatch.ConnectMatcher - 69, // 35: envoy.config.route.v3.RouteMatch.path_match_policy:type_name -> envoy.config.core.v3.TypedExtensionConfig - 71, // 36: envoy.config.route.v3.RouteMatch.case_sensitive:type_name -> google.protobuf.BoolValue - 72, // 37: envoy.config.route.v3.RouteMatch.runtime_fraction:type_name -> envoy.config.core.v3.RuntimeFractionalPercent - 24, // 38: envoy.config.route.v3.RouteMatch.headers:type_name -> envoy.config.route.v3.HeaderMatcher - 25, // 39: envoy.config.route.v3.RouteMatch.query_parameters:type_name -> envoy.config.route.v3.QueryParameterMatcher - 32, // 40: envoy.config.route.v3.RouteMatch.grpc:type_name -> envoy.config.route.v3.RouteMatch.GrpcRouteMatchOptions - 33, // 41: envoy.config.route.v3.RouteMatch.tls_context:type_name -> envoy.config.route.v3.RouteMatch.TlsContextMatchOptions - 73, // 42: envoy.config.route.v3.RouteMatch.dynamic_metadata:type_name -> envoy.type.matcher.v3.MetadataMatcher - 74, // 43: envoy.config.route.v3.CorsPolicy.allow_origin_string_match:type_name -> envoy.type.matcher.v3.StringMatcher - 71, // 44: envoy.config.route.v3.CorsPolicy.allow_credentials:type_name -> google.protobuf.BoolValue - 72, // 45: envoy.config.route.v3.CorsPolicy.filter_enabled:type_name -> envoy.config.core.v3.RuntimeFractionalPercent - 72, // 46: envoy.config.route.v3.CorsPolicy.shadow_enabled:type_name -> envoy.config.core.v3.RuntimeFractionalPercent - 71, // 47: envoy.config.route.v3.CorsPolicy.allow_private_network_access:type_name -> google.protobuf.BoolValue - 10, // 48: envoy.config.route.v3.RouteAction.weighted_clusters:type_name -> envoy.config.route.v3.WeightedCluster - 11, // 49: envoy.config.route.v3.RouteAction.inline_cluster_specifier_plugin:type_name -> envoy.config.route.v3.ClusterSpecifierPlugin - 1, // 50: envoy.config.route.v3.RouteAction.cluster_not_found_response_code:type_name -> envoy.config.route.v3.RouteAction.ClusterNotFoundResponseCode - 68, // 51: envoy.config.route.v3.RouteAction.metadata_match:type_name -> envoy.config.core.v3.Metadata - 75, // 52: envoy.config.route.v3.RouteAction.regex_rewrite:type_name -> envoy.type.matcher.v3.RegexMatchAndSubstitute - 69, // 53: envoy.config.route.v3.RouteAction.path_rewrite_policy:type_name -> envoy.config.core.v3.TypedExtensionConfig - 71, // 54: envoy.config.route.v3.RouteAction.auto_host_rewrite:type_name -> google.protobuf.BoolValue - 75, // 55: envoy.config.route.v3.RouteAction.host_rewrite_path_regex:type_name -> envoy.type.matcher.v3.RegexMatchAndSubstitute - 76, // 56: envoy.config.route.v3.RouteAction.timeout:type_name -> google.protobuf.Duration - 76, // 57: envoy.config.route.v3.RouteAction.idle_timeout:type_name -> google.protobuf.Duration - 69, // 58: envoy.config.route.v3.RouteAction.early_data_policy:type_name -> envoy.config.core.v3.TypedExtensionConfig - 15, // 59: envoy.config.route.v3.RouteAction.retry_policy:type_name -> envoy.config.route.v3.RetryPolicy - 66, // 60: envoy.config.route.v3.RouteAction.retry_policy_typed_config:type_name -> google.protobuf.Any - 35, // 61: envoy.config.route.v3.RouteAction.request_mirror_policies:type_name -> envoy.config.route.v3.RouteAction.RequestMirrorPolicy - 77, // 62: envoy.config.route.v3.RouteAction.priority:type_name -> envoy.config.core.v3.RoutingPriority - 23, // 63: envoy.config.route.v3.RouteAction.rate_limits:type_name -> envoy.config.route.v3.RateLimit - 71, // 64: envoy.config.route.v3.RouteAction.include_vh_rate_limits:type_name -> google.protobuf.BoolValue - 36, // 65: envoy.config.route.v3.RouteAction.hash_policy:type_name -> envoy.config.route.v3.RouteAction.HashPolicy - 13, // 66: envoy.config.route.v3.RouteAction.cors:type_name -> envoy.config.route.v3.CorsPolicy - 76, // 67: envoy.config.route.v3.RouteAction.max_grpc_timeout:type_name -> google.protobuf.Duration - 76, // 68: envoy.config.route.v3.RouteAction.grpc_timeout_offset:type_name -> google.protobuf.Duration - 37, // 69: envoy.config.route.v3.RouteAction.upgrade_configs:type_name -> envoy.config.route.v3.RouteAction.UpgradeConfig - 26, // 70: envoy.config.route.v3.RouteAction.internal_redirect_policy:type_name -> envoy.config.route.v3.InternalRedirectPolicy - 2, // 71: envoy.config.route.v3.RouteAction.internal_redirect_action:type_name -> envoy.config.route.v3.RouteAction.InternalRedirectAction - 67, // 72: envoy.config.route.v3.RouteAction.max_internal_redirects:type_name -> google.protobuf.UInt32Value - 16, // 73: envoy.config.route.v3.RouteAction.hedge_policy:type_name -> envoy.config.route.v3.HedgePolicy - 38, // 74: envoy.config.route.v3.RouteAction.max_stream_duration:type_name -> envoy.config.route.v3.RouteAction.MaxStreamDuration - 67, // 75: envoy.config.route.v3.RetryPolicy.num_retries:type_name -> google.protobuf.UInt32Value - 76, // 76: envoy.config.route.v3.RetryPolicy.per_try_timeout:type_name -> google.protobuf.Duration - 76, // 77: envoy.config.route.v3.RetryPolicy.per_try_idle_timeout:type_name -> google.protobuf.Duration - 46, // 78: envoy.config.route.v3.RetryPolicy.retry_priority:type_name -> envoy.config.route.v3.RetryPolicy.RetryPriority - 47, // 79: envoy.config.route.v3.RetryPolicy.retry_host_predicate:type_name -> envoy.config.route.v3.RetryPolicy.RetryHostPredicate - 69, // 80: envoy.config.route.v3.RetryPolicy.retry_options_predicates:type_name -> envoy.config.core.v3.TypedExtensionConfig - 48, // 81: envoy.config.route.v3.RetryPolicy.retry_back_off:type_name -> envoy.config.route.v3.RetryPolicy.RetryBackOff - 50, // 82: envoy.config.route.v3.RetryPolicy.rate_limited_retry_back_off:type_name -> envoy.config.route.v3.RetryPolicy.RateLimitedRetryBackOff - 24, // 83: envoy.config.route.v3.RetryPolicy.retriable_headers:type_name -> envoy.config.route.v3.HeaderMatcher - 24, // 84: envoy.config.route.v3.RetryPolicy.retriable_request_headers:type_name -> envoy.config.route.v3.HeaderMatcher - 67, // 85: envoy.config.route.v3.HedgePolicy.initial_requests:type_name -> google.protobuf.UInt32Value - 78, // 86: envoy.config.route.v3.HedgePolicy.additional_request_chance:type_name -> envoy.type.v3.FractionalPercent - 75, // 87: envoy.config.route.v3.RedirectAction.regex_rewrite:type_name -> envoy.type.matcher.v3.RegexMatchAndSubstitute - 4, // 88: envoy.config.route.v3.RedirectAction.response_code:type_name -> envoy.config.route.v3.RedirectAction.RedirectResponseCode - 79, // 89: envoy.config.route.v3.DirectResponseAction.body:type_name -> envoy.config.core.v3.DataSource - 71, // 90: envoy.config.route.v3.Decorator.propagate:type_name -> google.protobuf.BoolValue - 78, // 91: envoy.config.route.v3.Tracing.client_sampling:type_name -> envoy.type.v3.FractionalPercent - 78, // 92: envoy.config.route.v3.Tracing.random_sampling:type_name -> envoy.type.v3.FractionalPercent - 78, // 93: envoy.config.route.v3.Tracing.overall_sampling:type_name -> envoy.type.v3.FractionalPercent - 80, // 94: envoy.config.route.v3.Tracing.custom_tags:type_name -> envoy.type.tracing.v3.CustomTag - 24, // 95: envoy.config.route.v3.VirtualCluster.headers:type_name -> envoy.config.route.v3.HeaderMatcher - 67, // 96: envoy.config.route.v3.RateLimit.stage:type_name -> google.protobuf.UInt32Value - 51, // 97: envoy.config.route.v3.RateLimit.actions:type_name -> envoy.config.route.v3.RateLimit.Action - 52, // 98: envoy.config.route.v3.RateLimit.limit:type_name -> envoy.config.route.v3.RateLimit.Override - 70, // 99: envoy.config.route.v3.HeaderMatcher.safe_regex_match:type_name -> envoy.type.matcher.v3.RegexMatcher - 81, // 100: envoy.config.route.v3.HeaderMatcher.range_match:type_name -> envoy.type.v3.Int64Range - 74, // 101: envoy.config.route.v3.HeaderMatcher.string_match:type_name -> envoy.type.matcher.v3.StringMatcher - 74, // 102: envoy.config.route.v3.QueryParameterMatcher.string_match:type_name -> envoy.type.matcher.v3.StringMatcher - 67, // 103: envoy.config.route.v3.InternalRedirectPolicy.max_internal_redirects:type_name -> google.protobuf.UInt32Value - 69, // 104: envoy.config.route.v3.InternalRedirectPolicy.predicates:type_name -> envoy.config.core.v3.TypedExtensionConfig - 66, // 105: envoy.config.route.v3.FilterConfig.config:type_name -> google.protobuf.Any - 66, // 106: envoy.config.route.v3.VirtualHost.TypedPerFilterConfigEntry.value:type_name -> google.protobuf.Any - 66, // 107: envoy.config.route.v3.Route.TypedPerFilterConfigEntry.value:type_name -> google.protobuf.Any - 67, // 108: envoy.config.route.v3.WeightedCluster.ClusterWeight.weight:type_name -> google.protobuf.UInt32Value - 68, // 109: envoy.config.route.v3.WeightedCluster.ClusterWeight.metadata_match:type_name -> envoy.config.core.v3.Metadata - 65, // 110: envoy.config.route.v3.WeightedCluster.ClusterWeight.request_headers_to_add:type_name -> envoy.config.core.v3.HeaderValueOption - 65, // 111: envoy.config.route.v3.WeightedCluster.ClusterWeight.response_headers_to_add:type_name -> envoy.config.core.v3.HeaderValueOption - 31, // 112: envoy.config.route.v3.WeightedCluster.ClusterWeight.typed_per_filter_config:type_name -> envoy.config.route.v3.WeightedCluster.ClusterWeight.TypedPerFilterConfigEntry - 66, // 113: envoy.config.route.v3.WeightedCluster.ClusterWeight.TypedPerFilterConfigEntry.value:type_name -> google.protobuf.Any - 71, // 114: envoy.config.route.v3.RouteMatch.TlsContextMatchOptions.presented:type_name -> google.protobuf.BoolValue - 71, // 115: envoy.config.route.v3.RouteMatch.TlsContextMatchOptions.validated:type_name -> google.protobuf.BoolValue - 72, // 116: envoy.config.route.v3.RouteAction.RequestMirrorPolicy.runtime_fraction:type_name -> envoy.config.core.v3.RuntimeFractionalPercent - 71, // 117: envoy.config.route.v3.RouteAction.RequestMirrorPolicy.trace_sampled:type_name -> google.protobuf.BoolValue - 39, // 118: envoy.config.route.v3.RouteAction.HashPolicy.header:type_name -> envoy.config.route.v3.RouteAction.HashPolicy.Header - 41, // 119: envoy.config.route.v3.RouteAction.HashPolicy.cookie:type_name -> envoy.config.route.v3.RouteAction.HashPolicy.Cookie - 42, // 120: envoy.config.route.v3.RouteAction.HashPolicy.connection_properties:type_name -> envoy.config.route.v3.RouteAction.HashPolicy.ConnectionProperties - 43, // 121: envoy.config.route.v3.RouteAction.HashPolicy.query_parameter:type_name -> envoy.config.route.v3.RouteAction.HashPolicy.QueryParameter - 44, // 122: envoy.config.route.v3.RouteAction.HashPolicy.filter_state:type_name -> envoy.config.route.v3.RouteAction.HashPolicy.FilterState - 71, // 123: envoy.config.route.v3.RouteAction.UpgradeConfig.enabled:type_name -> google.protobuf.BoolValue - 45, // 124: envoy.config.route.v3.RouteAction.UpgradeConfig.connect_config:type_name -> envoy.config.route.v3.RouteAction.UpgradeConfig.ConnectConfig - 76, // 125: envoy.config.route.v3.RouteAction.MaxStreamDuration.max_stream_duration:type_name -> google.protobuf.Duration - 76, // 126: envoy.config.route.v3.RouteAction.MaxStreamDuration.grpc_timeout_header_max:type_name -> google.protobuf.Duration - 76, // 127: envoy.config.route.v3.RouteAction.MaxStreamDuration.grpc_timeout_header_offset:type_name -> google.protobuf.Duration - 75, // 128: envoy.config.route.v3.RouteAction.HashPolicy.Header.regex_rewrite:type_name -> envoy.type.matcher.v3.RegexMatchAndSubstitute - 76, // 129: envoy.config.route.v3.RouteAction.HashPolicy.Cookie.ttl:type_name -> google.protobuf.Duration - 40, // 130: envoy.config.route.v3.RouteAction.HashPolicy.Cookie.attributes:type_name -> envoy.config.route.v3.RouteAction.HashPolicy.CookieAttribute - 82, // 131: envoy.config.route.v3.RouteAction.UpgradeConfig.ConnectConfig.proxy_protocol_config:type_name -> envoy.config.core.v3.ProxyProtocolConfig - 66, // 132: envoy.config.route.v3.RetryPolicy.RetryPriority.typed_config:type_name -> google.protobuf.Any - 66, // 133: envoy.config.route.v3.RetryPolicy.RetryHostPredicate.typed_config:type_name -> google.protobuf.Any - 76, // 134: envoy.config.route.v3.RetryPolicy.RetryBackOff.base_interval:type_name -> google.protobuf.Duration - 76, // 135: envoy.config.route.v3.RetryPolicy.RetryBackOff.max_interval:type_name -> google.protobuf.Duration - 3, // 136: envoy.config.route.v3.RetryPolicy.ResetHeader.format:type_name -> envoy.config.route.v3.RetryPolicy.ResetHeaderFormat - 49, // 137: envoy.config.route.v3.RetryPolicy.RateLimitedRetryBackOff.reset_headers:type_name -> envoy.config.route.v3.RetryPolicy.ResetHeader - 76, // 138: envoy.config.route.v3.RetryPolicy.RateLimitedRetryBackOff.max_interval:type_name -> google.protobuf.Duration - 53, // 139: envoy.config.route.v3.RateLimit.Action.source_cluster:type_name -> envoy.config.route.v3.RateLimit.Action.SourceCluster - 54, // 140: envoy.config.route.v3.RateLimit.Action.destination_cluster:type_name -> envoy.config.route.v3.RateLimit.Action.DestinationCluster - 55, // 141: envoy.config.route.v3.RateLimit.Action.request_headers:type_name -> envoy.config.route.v3.RateLimit.Action.RequestHeaders - 56, // 142: envoy.config.route.v3.RateLimit.Action.remote_address:type_name -> envoy.config.route.v3.RateLimit.Action.RemoteAddress - 58, // 143: envoy.config.route.v3.RateLimit.Action.generic_key:type_name -> envoy.config.route.v3.RateLimit.Action.GenericKey - 59, // 144: envoy.config.route.v3.RateLimit.Action.header_value_match:type_name -> envoy.config.route.v3.RateLimit.Action.HeaderValueMatch - 60, // 145: envoy.config.route.v3.RateLimit.Action.dynamic_metadata:type_name -> envoy.config.route.v3.RateLimit.Action.DynamicMetaData - 61, // 146: envoy.config.route.v3.RateLimit.Action.metadata:type_name -> envoy.config.route.v3.RateLimit.Action.MetaData - 69, // 147: envoy.config.route.v3.RateLimit.Action.extension:type_name -> envoy.config.core.v3.TypedExtensionConfig - 57, // 148: envoy.config.route.v3.RateLimit.Action.masked_remote_address:type_name -> envoy.config.route.v3.RateLimit.Action.MaskedRemoteAddress - 62, // 149: envoy.config.route.v3.RateLimit.Action.query_parameter_value_match:type_name -> envoy.config.route.v3.RateLimit.Action.QueryParameterValueMatch - 63, // 150: envoy.config.route.v3.RateLimit.Override.dynamic_metadata:type_name -> envoy.config.route.v3.RateLimit.Override.DynamicMetadata - 67, // 151: envoy.config.route.v3.RateLimit.Action.MaskedRemoteAddress.v4_prefix_mask_len:type_name -> google.protobuf.UInt32Value - 67, // 152: envoy.config.route.v3.RateLimit.Action.MaskedRemoteAddress.v6_prefix_mask_len:type_name -> google.protobuf.UInt32Value - 71, // 153: envoy.config.route.v3.RateLimit.Action.HeaderValueMatch.expect_match:type_name -> google.protobuf.BoolValue - 24, // 154: envoy.config.route.v3.RateLimit.Action.HeaderValueMatch.headers:type_name -> envoy.config.route.v3.HeaderMatcher - 83, // 155: envoy.config.route.v3.RateLimit.Action.DynamicMetaData.metadata_key:type_name -> envoy.type.metadata.v3.MetadataKey - 83, // 156: envoy.config.route.v3.RateLimit.Action.MetaData.metadata_key:type_name -> envoy.type.metadata.v3.MetadataKey - 5, // 157: envoy.config.route.v3.RateLimit.Action.MetaData.source:type_name -> envoy.config.route.v3.RateLimit.Action.MetaData.Source - 71, // 158: envoy.config.route.v3.RateLimit.Action.QueryParameterValueMatch.expect_match:type_name -> google.protobuf.BoolValue - 25, // 159: envoy.config.route.v3.RateLimit.Action.QueryParameterValueMatch.query_parameters:type_name -> envoy.config.route.v3.QueryParameterMatcher - 83, // 160: envoy.config.route.v3.RateLimit.Override.DynamicMetadata.metadata_key:type_name -> envoy.type.metadata.v3.MetadataKey - 161, // [161:161] is the sub-list for method output_type - 161, // [161:161] is the sub-list for method input_type - 161, // [161:161] is the sub-list for extension type_name - 161, // [161:161] is the sub-list for extension extendee - 0, // [0:161] is the sub-list for field type_name -} - -func init() { file_envoy_config_route_v3_route_components_proto_init() } -func file_envoy_config_route_v3_route_components_proto_init() { - if File_envoy_config_route_v3_route_components_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_envoy_config_route_v3_route_components_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*VirtualHost); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FilterAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RouteList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Route); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WeightedCluster); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClusterSpecifierPlugin); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RouteMatch); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CorsPolicy); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RouteAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RetryPolicy); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HedgePolicy); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RedirectAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DirectResponseAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NonForwardingAction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Decorator); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Tracing); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*VirtualCluster); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RateLimit); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HeaderMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryParameterMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InternalRedirectPolicy); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FilterConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WeightedCluster_ClusterWeight); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RouteMatch_GrpcRouteMatchOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RouteMatch_TlsContextMatchOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RouteMatch_ConnectMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RouteAction_RequestMirrorPolicy); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RouteAction_HashPolicy); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RouteAction_UpgradeConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RouteAction_MaxStreamDuration); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RouteAction_HashPolicy_Header); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RouteAction_HashPolicy_CookieAttribute); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RouteAction_HashPolicy_Cookie); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RouteAction_HashPolicy_ConnectionProperties); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RouteAction_HashPolicy_QueryParameter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RouteAction_HashPolicy_FilterState); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RouteAction_UpgradeConfig_ConnectConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RetryPolicy_RetryPriority); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RetryPolicy_RetryHostPredicate); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RetryPolicy_RetryBackOff); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RetryPolicy_ResetHeader); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RetryPolicy_RateLimitedRetryBackOff); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RateLimit_Action); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RateLimit_Override); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RateLimit_Action_SourceCluster); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RateLimit_Action_DestinationCluster); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RateLimit_Action_RequestHeaders); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[50].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RateLimit_Action_RemoteAddress); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[51].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RateLimit_Action_MaskedRemoteAddress); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[52].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RateLimit_Action_GenericKey); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[53].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RateLimit_Action_HeaderValueMatch); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[54].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RateLimit_Action_DynamicMetaData); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[55].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RateLimit_Action_MetaData); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[56].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RateLimit_Action_QueryParameterValueMatch); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[57].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RateLimit_Override_DynamicMetadata); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_config_route_v3_route_components_proto_msgTypes[3].OneofWrappers = []interface{}{ - (*Route_Route)(nil), - (*Route_Redirect)(nil), - (*Route_DirectResponse)(nil), - (*Route_FilterAction)(nil), - (*Route_NonForwardingAction)(nil), - } - file_envoy_config_route_v3_route_components_proto_msgTypes[4].OneofWrappers = []interface{}{ - (*WeightedCluster_HeaderName)(nil), - } - file_envoy_config_route_v3_route_components_proto_msgTypes[6].OneofWrappers = []interface{}{ - (*RouteMatch_Prefix)(nil), - (*RouteMatch_Path)(nil), - (*RouteMatch_SafeRegex)(nil), - (*RouteMatch_ConnectMatcher_)(nil), - (*RouteMatch_PathSeparatedPrefix)(nil), - (*RouteMatch_PathMatchPolicy)(nil), - } - file_envoy_config_route_v3_route_components_proto_msgTypes[7].OneofWrappers = []interface{}{ - (*CorsPolicy_FilterEnabled)(nil), - } - file_envoy_config_route_v3_route_components_proto_msgTypes[8].OneofWrappers = []interface{}{ - (*RouteAction_Cluster)(nil), - (*RouteAction_ClusterHeader)(nil), - (*RouteAction_WeightedClusters)(nil), - (*RouteAction_ClusterSpecifierPlugin)(nil), - (*RouteAction_InlineClusterSpecifierPlugin)(nil), - (*RouteAction_HostRewriteLiteral)(nil), - (*RouteAction_AutoHostRewrite)(nil), - (*RouteAction_HostRewriteHeader)(nil), - (*RouteAction_HostRewritePathRegex)(nil), - } - file_envoy_config_route_v3_route_components_proto_msgTypes[11].OneofWrappers = []interface{}{ - (*RedirectAction_HttpsRedirect)(nil), - (*RedirectAction_SchemeRedirect)(nil), - (*RedirectAction_PathRedirect)(nil), - (*RedirectAction_PrefixRewrite)(nil), - (*RedirectAction_RegexRewrite)(nil), - } - file_envoy_config_route_v3_route_components_proto_msgTypes[18].OneofWrappers = []interface{}{ - (*HeaderMatcher_ExactMatch)(nil), - (*HeaderMatcher_SafeRegexMatch)(nil), - (*HeaderMatcher_RangeMatch)(nil), - (*HeaderMatcher_PresentMatch)(nil), - (*HeaderMatcher_PrefixMatch)(nil), - (*HeaderMatcher_SuffixMatch)(nil), - (*HeaderMatcher_ContainsMatch)(nil), - (*HeaderMatcher_StringMatch)(nil), - } - file_envoy_config_route_v3_route_components_proto_msgTypes[19].OneofWrappers = []interface{}{ - (*QueryParameterMatcher_StringMatch)(nil), - (*QueryParameterMatcher_PresentMatch)(nil), - } - file_envoy_config_route_v3_route_components_proto_msgTypes[24].OneofWrappers = []interface{}{ - (*WeightedCluster_ClusterWeight_HostRewriteLiteral)(nil), - } - file_envoy_config_route_v3_route_components_proto_msgTypes[30].OneofWrappers = []interface{}{ - (*RouteAction_HashPolicy_Header_)(nil), - (*RouteAction_HashPolicy_Cookie_)(nil), - (*RouteAction_HashPolicy_ConnectionProperties_)(nil), - (*RouteAction_HashPolicy_QueryParameter_)(nil), - (*RouteAction_HashPolicy_FilterState_)(nil), - } - file_envoy_config_route_v3_route_components_proto_msgTypes[40].OneofWrappers = []interface{}{ - (*RetryPolicy_RetryPriority_TypedConfig)(nil), - } - file_envoy_config_route_v3_route_components_proto_msgTypes[41].OneofWrappers = []interface{}{ - (*RetryPolicy_RetryHostPredicate_TypedConfig)(nil), - } - file_envoy_config_route_v3_route_components_proto_msgTypes[45].OneofWrappers = []interface{}{ - (*RateLimit_Action_SourceCluster_)(nil), - (*RateLimit_Action_DestinationCluster_)(nil), - (*RateLimit_Action_RequestHeaders_)(nil), - (*RateLimit_Action_RemoteAddress_)(nil), - (*RateLimit_Action_GenericKey_)(nil), - (*RateLimit_Action_HeaderValueMatch_)(nil), - (*RateLimit_Action_DynamicMetadata)(nil), - (*RateLimit_Action_Metadata)(nil), - (*RateLimit_Action_Extension)(nil), - (*RateLimit_Action_MaskedRemoteAddress_)(nil), - (*RateLimit_Action_QueryParameterValueMatch_)(nil), - } - file_envoy_config_route_v3_route_components_proto_msgTypes[46].OneofWrappers = []interface{}{ - (*RateLimit_Override_DynamicMetadata_)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_config_route_v3_route_components_proto_rawDesc, - NumEnums: 6, - NumMessages: 58, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_config_route_v3_route_components_proto_goTypes, - DependencyIndexes: file_envoy_config_route_v3_route_components_proto_depIdxs, - EnumInfos: file_envoy_config_route_v3_route_components_proto_enumTypes, - MessageInfos: file_envoy_config_route_v3_route_components_proto_msgTypes, - }.Build() - File_envoy_config_route_v3_route_components_proto = out.File - file_envoy_config_route_v3_route_components_proto_rawDesc = nil - file_envoy_config_route_v3_route_components_proto_goTypes = nil - file_envoy_config_route_v3_route_components_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/route/v3/route_components.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/config/route/v3/route_components.pb.validate.go deleted file mode 100644 index 57f79fad6..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/route/v3/route_components.pb.validate.go +++ /dev/null @@ -1,12204 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/config/route/v3/route_components.proto - -package routev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" - - v3 "github.com/cilium/proxy/go/envoy/config/core/v3" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort - - _ = v3.RoutingPriority(0) -) - -// Validate checks the field values on VirtualHost with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *VirtualHost) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on VirtualHost with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in VirtualHostMultiError, or -// nil if none found. -func (m *VirtualHost) ValidateAll() error { - return m.validate(true) -} - -func (m *VirtualHost) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := VirtualHostValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(m.GetDomains()) < 1 { - err := VirtualHostValidationError{ - field: "Domains", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetDomains() { - _, _ = idx, item - - if !_VirtualHost_Domains_Pattern.MatchString(item) { - err := VirtualHostValidationError{ - field: fmt.Sprintf("Domains[%v]", idx), - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - for idx, item := range m.GetRoutes() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: fmt.Sprintf("Routes[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: fmt.Sprintf("Routes[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return VirtualHostValidationError{ - field: fmt.Sprintf("Routes[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetMatcher()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: "Matcher", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: "Matcher", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMatcher()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return VirtualHostValidationError{ - field: "Matcher", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if _, ok := VirtualHost_TlsRequirementType_name[int32(m.GetRequireTls())]; !ok { - err := VirtualHostValidationError{ - field: "RequireTls", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetVirtualClusters() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: fmt.Sprintf("VirtualClusters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: fmt.Sprintf("VirtualClusters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return VirtualHostValidationError{ - field: fmt.Sprintf("VirtualClusters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetRateLimits() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: fmt.Sprintf("RateLimits[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: fmt.Sprintf("RateLimits[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return VirtualHostValidationError{ - field: fmt.Sprintf("RateLimits[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(m.GetRequestHeadersToAdd()) > 1000 { - err := VirtualHostValidationError{ - field: "RequestHeadersToAdd", - reason: "value must contain no more than 1000 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetRequestHeadersToAdd() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return VirtualHostValidationError{ - field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetRequestHeadersToRemove() { - _, _ = idx, item - - if utf8.RuneCountInString(item) < 1 { - err := VirtualHostValidationError{ - field: fmt.Sprintf("RequestHeadersToRemove[%v]", idx), - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_VirtualHost_RequestHeadersToRemove_Pattern.MatchString(item) { - err := VirtualHostValidationError{ - field: fmt.Sprintf("RequestHeadersToRemove[%v]", idx), - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if len(m.GetResponseHeadersToAdd()) > 1000 { - err := VirtualHostValidationError{ - field: "ResponseHeadersToAdd", - reason: "value must contain no more than 1000 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetResponseHeadersToAdd() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return VirtualHostValidationError{ - field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetResponseHeadersToRemove() { - _, _ = idx, item - - if utf8.RuneCountInString(item) < 1 { - err := VirtualHostValidationError{ - field: fmt.Sprintf("ResponseHeadersToRemove[%v]", idx), - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_VirtualHost_ResponseHeadersToRemove_Pattern.MatchString(item) { - err := VirtualHostValidationError{ - field: fmt.Sprintf("ResponseHeadersToRemove[%v]", idx), - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if all { - switch v := interface{}(m.GetCors()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: "Cors", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: "Cors", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCors()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return VirtualHostValidationError{ - field: "Cors", - reason: "embedded message failed validation", - cause: err, - } - } - } - - { - sorted_keys := make([]string, len(m.GetTypedPerFilterConfig())) - i := 0 - for key := range m.GetTypedPerFilterConfig() { - sorted_keys[i] = key - i++ - } - sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] }) - for _, key := range sorted_keys { - val := m.GetTypedPerFilterConfig()[key] - _ = val - - // no validation rules for TypedPerFilterConfig[key] - - if all { - switch v := interface{}(val).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: fmt.Sprintf("TypedPerFilterConfig[%v]", key), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: fmt.Sprintf("TypedPerFilterConfig[%v]", key), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(val).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return VirtualHostValidationError{ - field: fmt.Sprintf("TypedPerFilterConfig[%v]", key), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - } - - // no validation rules for IncludeRequestAttemptCount - - // no validation rules for IncludeAttemptCountInResponse - - if all { - switch v := interface{}(m.GetRetryPolicy()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: "RetryPolicy", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: "RetryPolicy", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRetryPolicy()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return VirtualHostValidationError{ - field: "RetryPolicy", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetRetryPolicyTypedConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: "RetryPolicyTypedConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: "RetryPolicyTypedConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRetryPolicyTypedConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return VirtualHostValidationError{ - field: "RetryPolicyTypedConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetHedgePolicy()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: "HedgePolicy", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: "HedgePolicy", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHedgePolicy()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return VirtualHostValidationError{ - field: "HedgePolicy", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for IncludeIsTimeoutRetryHeader - - if all { - switch v := interface{}(m.GetPerRequestBufferLimitBytes()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: "PerRequestBufferLimitBytes", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: "PerRequestBufferLimitBytes", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPerRequestBufferLimitBytes()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return VirtualHostValidationError{ - field: "PerRequestBufferLimitBytes", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetRequestMirrorPolicies() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: fmt.Sprintf("RequestMirrorPolicies[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: fmt.Sprintf("RequestMirrorPolicies[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return VirtualHostValidationError{ - field: fmt.Sprintf("RequestMirrorPolicies[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetMetadata()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, VirtualHostValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return VirtualHostValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return VirtualHostMultiError(errors) - } - - return nil -} - -// VirtualHostMultiError is an error wrapping multiple validation errors -// returned by VirtualHost.ValidateAll() if the designated constraints aren't met. -type VirtualHostMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m VirtualHostMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m VirtualHostMultiError) AllErrors() []error { return m } - -// VirtualHostValidationError is the validation error returned by -// VirtualHost.Validate if the designated constraints aren't met. -type VirtualHostValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e VirtualHostValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e VirtualHostValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e VirtualHostValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e VirtualHostValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e VirtualHostValidationError) ErrorName() string { return "VirtualHostValidationError" } - -// Error satisfies the builtin error interface -func (e VirtualHostValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sVirtualHost.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = VirtualHostValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = VirtualHostValidationError{} - -var _VirtualHost_Domains_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -var _VirtualHost_RequestHeadersToRemove_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -var _VirtualHost_ResponseHeadersToRemove_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -// Validate checks the field values on FilterAction with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *FilterAction) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on FilterAction with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in FilterActionMultiError, or -// nil if none found. -func (m *FilterAction) ValidateAll() error { - return m.validate(true) -} - -func (m *FilterAction) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetAction()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, FilterActionValidationError{ - field: "Action", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, FilterActionValidationError{ - field: "Action", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetAction()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return FilterActionValidationError{ - field: "Action", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return FilterActionMultiError(errors) - } - - return nil -} - -// FilterActionMultiError is an error wrapping multiple validation errors -// returned by FilterAction.ValidateAll() if the designated constraints aren't met. -type FilterActionMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m FilterActionMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m FilterActionMultiError) AllErrors() []error { return m } - -// FilterActionValidationError is the validation error returned by -// FilterAction.Validate if the designated constraints aren't met. -type FilterActionValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e FilterActionValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e FilterActionValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e FilterActionValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e FilterActionValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e FilterActionValidationError) ErrorName() string { return "FilterActionValidationError" } - -// Error satisfies the builtin error interface -func (e FilterActionValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sFilterAction.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = FilterActionValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = FilterActionValidationError{} - -// Validate checks the field values on RouteList with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *RouteList) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RouteList with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in RouteListMultiError, or nil -// if none found. -func (m *RouteList) ValidateAll() error { - return m.validate(true) -} - -func (m *RouteList) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetRoutes() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteListValidationError{ - field: fmt.Sprintf("Routes[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteListValidationError{ - field: fmt.Sprintf("Routes[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteListValidationError{ - field: fmt.Sprintf("Routes[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return RouteListMultiError(errors) - } - - return nil -} - -// RouteListMultiError is an error wrapping multiple validation errors returned -// by RouteList.ValidateAll() if the designated constraints aren't met. -type RouteListMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RouteListMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RouteListMultiError) AllErrors() []error { return m } - -// RouteListValidationError is the validation error returned by -// RouteList.Validate if the designated constraints aren't met. -type RouteListValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RouteListValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RouteListValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RouteListValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RouteListValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RouteListValidationError) ErrorName() string { return "RouteListValidationError" } - -// Error satisfies the builtin error interface -func (e RouteListValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRouteList.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RouteListValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RouteListValidationError{} - -// Validate checks the field values on Route with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Route) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Route with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in RouteMultiError, or nil if none found. -func (m *Route) ValidateAll() error { - return m.validate(true) -} - -func (m *Route) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Name - - if m.GetMatch() == nil { - err := RouteValidationError{ - field: "Match", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteValidationError{ - field: "Match", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteValidationError{ - field: "Match", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteValidationError{ - field: "Match", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetMetadata()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetDecorator()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteValidationError{ - field: "Decorator", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteValidationError{ - field: "Decorator", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDecorator()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteValidationError{ - field: "Decorator", - reason: "embedded message failed validation", - cause: err, - } - } - } - - { - sorted_keys := make([]string, len(m.GetTypedPerFilterConfig())) - i := 0 - for key := range m.GetTypedPerFilterConfig() { - sorted_keys[i] = key - i++ - } - sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] }) - for _, key := range sorted_keys { - val := m.GetTypedPerFilterConfig()[key] - _ = val - - // no validation rules for TypedPerFilterConfig[key] - - if all { - switch v := interface{}(val).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteValidationError{ - field: fmt.Sprintf("TypedPerFilterConfig[%v]", key), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteValidationError{ - field: fmt.Sprintf("TypedPerFilterConfig[%v]", key), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(val).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteValidationError{ - field: fmt.Sprintf("TypedPerFilterConfig[%v]", key), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - } - - if len(m.GetRequestHeadersToAdd()) > 1000 { - err := RouteValidationError{ - field: "RequestHeadersToAdd", - reason: "value must contain no more than 1000 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetRequestHeadersToAdd() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteValidationError{ - field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteValidationError{ - field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteValidationError{ - field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetRequestHeadersToRemove() { - _, _ = idx, item - - if utf8.RuneCountInString(item) < 1 { - err := RouteValidationError{ - field: fmt.Sprintf("RequestHeadersToRemove[%v]", idx), - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_Route_RequestHeadersToRemove_Pattern.MatchString(item) { - err := RouteValidationError{ - field: fmt.Sprintf("RequestHeadersToRemove[%v]", idx), - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if len(m.GetResponseHeadersToAdd()) > 1000 { - err := RouteValidationError{ - field: "ResponseHeadersToAdd", - reason: "value must contain no more than 1000 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetResponseHeadersToAdd() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteValidationError{ - field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteValidationError{ - field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteValidationError{ - field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetResponseHeadersToRemove() { - _, _ = idx, item - - if utf8.RuneCountInString(item) < 1 { - err := RouteValidationError{ - field: fmt.Sprintf("ResponseHeadersToRemove[%v]", idx), - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_Route_ResponseHeadersToRemove_Pattern.MatchString(item) { - err := RouteValidationError{ - field: fmt.Sprintf("ResponseHeadersToRemove[%v]", idx), - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if all { - switch v := interface{}(m.GetTracing()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteValidationError{ - field: "Tracing", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteValidationError{ - field: "Tracing", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTracing()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteValidationError{ - field: "Tracing", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetPerRequestBufferLimitBytes()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteValidationError{ - field: "PerRequestBufferLimitBytes", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteValidationError{ - field: "PerRequestBufferLimitBytes", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPerRequestBufferLimitBytes()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteValidationError{ - field: "PerRequestBufferLimitBytes", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for StatPrefix - - oneofActionPresent := false - switch v := m.Action.(type) { - case *Route_Route: - if v == nil { - err := RouteValidationError{ - field: "Action", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofActionPresent = true - - if all { - switch v := interface{}(m.GetRoute()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteValidationError{ - field: "Route", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteValidationError{ - field: "Route", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRoute()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteValidationError{ - field: "Route", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Route_Redirect: - if v == nil { - err := RouteValidationError{ - field: "Action", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofActionPresent = true - - if all { - switch v := interface{}(m.GetRedirect()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteValidationError{ - field: "Redirect", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteValidationError{ - field: "Redirect", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRedirect()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteValidationError{ - field: "Redirect", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Route_DirectResponse: - if v == nil { - err := RouteValidationError{ - field: "Action", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofActionPresent = true - - if all { - switch v := interface{}(m.GetDirectResponse()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteValidationError{ - field: "DirectResponse", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteValidationError{ - field: "DirectResponse", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDirectResponse()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteValidationError{ - field: "DirectResponse", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Route_FilterAction: - if v == nil { - err := RouteValidationError{ - field: "Action", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofActionPresent = true - - if all { - switch v := interface{}(m.GetFilterAction()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteValidationError{ - field: "FilterAction", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteValidationError{ - field: "FilterAction", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetFilterAction()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteValidationError{ - field: "FilterAction", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Route_NonForwardingAction: - if v == nil { - err := RouteValidationError{ - field: "Action", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofActionPresent = true - - if all { - switch v := interface{}(m.GetNonForwardingAction()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteValidationError{ - field: "NonForwardingAction", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteValidationError{ - field: "NonForwardingAction", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetNonForwardingAction()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteValidationError{ - field: "NonForwardingAction", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofActionPresent { - err := RouteValidationError{ - field: "Action", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return RouteMultiError(errors) - } - - return nil -} - -// RouteMultiError is an error wrapping multiple validation errors returned by -// Route.ValidateAll() if the designated constraints aren't met. -type RouteMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RouteMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RouteMultiError) AllErrors() []error { return m } - -// RouteValidationError is the validation error returned by Route.Validate if -// the designated constraints aren't met. -type RouteValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RouteValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RouteValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RouteValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RouteValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RouteValidationError) ErrorName() string { return "RouteValidationError" } - -// Error satisfies the builtin error interface -func (e RouteValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRoute.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RouteValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RouteValidationError{} - -var _Route_RequestHeadersToRemove_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -var _Route_ResponseHeadersToRemove_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -// Validate checks the field values on WeightedCluster with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *WeightedCluster) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on WeightedCluster with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// WeightedClusterMultiError, or nil if none found. -func (m *WeightedCluster) ValidateAll() error { - return m.validate(true) -} - -func (m *WeightedCluster) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(m.GetClusters()) < 1 { - err := WeightedClusterValidationError{ - field: "Clusters", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetClusters() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, WeightedClusterValidationError{ - field: fmt.Sprintf("Clusters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, WeightedClusterValidationError{ - field: fmt.Sprintf("Clusters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return WeightedClusterValidationError{ - field: fmt.Sprintf("Clusters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetTotalWeight()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, WeightedClusterValidationError{ - field: "TotalWeight", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, WeightedClusterValidationError{ - field: "TotalWeight", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTotalWeight()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return WeightedClusterValidationError{ - field: "TotalWeight", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for RuntimeKeyPrefix - - switch v := m.RandomValueSpecifier.(type) { - case *WeightedCluster_HeaderName: - if v == nil { - err := WeightedClusterValidationError{ - field: "RandomValueSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_WeightedCluster_HeaderName_Pattern.MatchString(m.GetHeaderName()) { - err := WeightedClusterValidationError{ - field: "HeaderName", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return WeightedClusterMultiError(errors) - } - - return nil -} - -// WeightedClusterMultiError is an error wrapping multiple validation errors -// returned by WeightedCluster.ValidateAll() if the designated constraints -// aren't met. -type WeightedClusterMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m WeightedClusterMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m WeightedClusterMultiError) AllErrors() []error { return m } - -// WeightedClusterValidationError is the validation error returned by -// WeightedCluster.Validate if the designated constraints aren't met. -type WeightedClusterValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e WeightedClusterValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e WeightedClusterValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e WeightedClusterValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e WeightedClusterValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e WeightedClusterValidationError) ErrorName() string { return "WeightedClusterValidationError" } - -// Error satisfies the builtin error interface -func (e WeightedClusterValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sWeightedCluster.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = WeightedClusterValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = WeightedClusterValidationError{} - -var _WeightedCluster_HeaderName_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -// Validate checks the field values on ClusterSpecifierPlugin with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ClusterSpecifierPlugin) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ClusterSpecifierPlugin with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ClusterSpecifierPluginMultiError, or nil if none found. -func (m *ClusterSpecifierPlugin) ValidateAll() error { - return m.validate(true) -} - -func (m *ClusterSpecifierPlugin) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetExtension() == nil { - err := ClusterSpecifierPluginValidationError{ - field: "Extension", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetExtension()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ClusterSpecifierPluginValidationError{ - field: "Extension", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ClusterSpecifierPluginValidationError{ - field: "Extension", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetExtension()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ClusterSpecifierPluginValidationError{ - field: "Extension", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for IsOptional - - if len(errors) > 0 { - return ClusterSpecifierPluginMultiError(errors) - } - - return nil -} - -// ClusterSpecifierPluginMultiError is an error wrapping multiple validation -// errors returned by ClusterSpecifierPlugin.ValidateAll() if the designated -// constraints aren't met. -type ClusterSpecifierPluginMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ClusterSpecifierPluginMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ClusterSpecifierPluginMultiError) AllErrors() []error { return m } - -// ClusterSpecifierPluginValidationError is the validation error returned by -// ClusterSpecifierPlugin.Validate if the designated constraints aren't met. -type ClusterSpecifierPluginValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ClusterSpecifierPluginValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ClusterSpecifierPluginValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ClusterSpecifierPluginValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ClusterSpecifierPluginValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ClusterSpecifierPluginValidationError) ErrorName() string { - return "ClusterSpecifierPluginValidationError" -} - -// Error satisfies the builtin error interface -func (e ClusterSpecifierPluginValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sClusterSpecifierPlugin.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ClusterSpecifierPluginValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ClusterSpecifierPluginValidationError{} - -// Validate checks the field values on RouteMatch with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *RouteMatch) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RouteMatch with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in RouteMatchMultiError, or -// nil if none found. -func (m *RouteMatch) ValidateAll() error { - return m.validate(true) -} - -func (m *RouteMatch) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetCaseSensitive()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteMatchValidationError{ - field: "CaseSensitive", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteMatchValidationError{ - field: "CaseSensitive", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCaseSensitive()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteMatchValidationError{ - field: "CaseSensitive", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetRuntimeFraction()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteMatchValidationError{ - field: "RuntimeFraction", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteMatchValidationError{ - field: "RuntimeFraction", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRuntimeFraction()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteMatchValidationError{ - field: "RuntimeFraction", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetHeaders() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteMatchValidationError{ - field: fmt.Sprintf("Headers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteMatchValidationError{ - field: fmt.Sprintf("Headers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteMatchValidationError{ - field: fmt.Sprintf("Headers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetQueryParameters() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteMatchValidationError{ - field: fmt.Sprintf("QueryParameters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteMatchValidationError{ - field: fmt.Sprintf("QueryParameters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteMatchValidationError{ - field: fmt.Sprintf("QueryParameters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetGrpc()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteMatchValidationError{ - field: "Grpc", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteMatchValidationError{ - field: "Grpc", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetGrpc()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteMatchValidationError{ - field: "Grpc", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetTlsContext()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteMatchValidationError{ - field: "TlsContext", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteMatchValidationError{ - field: "TlsContext", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTlsContext()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteMatchValidationError{ - field: "TlsContext", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetDynamicMetadata() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteMatchValidationError{ - field: fmt.Sprintf("DynamicMetadata[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteMatchValidationError{ - field: fmt.Sprintf("DynamicMetadata[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteMatchValidationError{ - field: fmt.Sprintf("DynamicMetadata[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - oneofPathSpecifierPresent := false - switch v := m.PathSpecifier.(type) { - case *RouteMatch_Prefix: - if v == nil { - err := RouteMatchValidationError{ - field: "PathSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofPathSpecifierPresent = true - // no validation rules for Prefix - case *RouteMatch_Path: - if v == nil { - err := RouteMatchValidationError{ - field: "PathSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofPathSpecifierPresent = true - // no validation rules for Path - case *RouteMatch_SafeRegex: - if v == nil { - err := RouteMatchValidationError{ - field: "PathSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofPathSpecifierPresent = true - - if m.GetSafeRegex() == nil { - err := RouteMatchValidationError{ - field: "SafeRegex", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetSafeRegex()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteMatchValidationError{ - field: "SafeRegex", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteMatchValidationError{ - field: "SafeRegex", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSafeRegex()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteMatchValidationError{ - field: "SafeRegex", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *RouteMatch_ConnectMatcher_: - if v == nil { - err := RouteMatchValidationError{ - field: "PathSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofPathSpecifierPresent = true - - if all { - switch v := interface{}(m.GetConnectMatcher()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteMatchValidationError{ - field: "ConnectMatcher", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteMatchValidationError{ - field: "ConnectMatcher", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetConnectMatcher()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteMatchValidationError{ - field: "ConnectMatcher", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *RouteMatch_PathSeparatedPrefix: - if v == nil { - err := RouteMatchValidationError{ - field: "PathSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofPathSpecifierPresent = true - - if !_RouteMatch_PathSeparatedPrefix_Pattern.MatchString(m.GetPathSeparatedPrefix()) { - err := RouteMatchValidationError{ - field: "PathSeparatedPrefix", - reason: "value does not match regex pattern \"^[^?#]+[^?#/]$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - case *RouteMatch_PathMatchPolicy: - if v == nil { - err := RouteMatchValidationError{ - field: "PathSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofPathSpecifierPresent = true - - if all { - switch v := interface{}(m.GetPathMatchPolicy()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteMatchValidationError{ - field: "PathMatchPolicy", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteMatchValidationError{ - field: "PathMatchPolicy", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPathMatchPolicy()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteMatchValidationError{ - field: "PathMatchPolicy", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofPathSpecifierPresent { - err := RouteMatchValidationError{ - field: "PathSpecifier", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return RouteMatchMultiError(errors) - } - - return nil -} - -// RouteMatchMultiError is an error wrapping multiple validation errors -// returned by RouteMatch.ValidateAll() if the designated constraints aren't met. -type RouteMatchMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RouteMatchMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RouteMatchMultiError) AllErrors() []error { return m } - -// RouteMatchValidationError is the validation error returned by -// RouteMatch.Validate if the designated constraints aren't met. -type RouteMatchValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RouteMatchValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RouteMatchValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RouteMatchValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RouteMatchValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RouteMatchValidationError) ErrorName() string { return "RouteMatchValidationError" } - -// Error satisfies the builtin error interface -func (e RouteMatchValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRouteMatch.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RouteMatchValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RouteMatchValidationError{} - -var _RouteMatch_PathSeparatedPrefix_Pattern = regexp.MustCompile("^[^?#]+[^?#/]$") - -// Validate checks the field values on CorsPolicy with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *CorsPolicy) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CorsPolicy with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in CorsPolicyMultiError, or -// nil if none found. -func (m *CorsPolicy) ValidateAll() error { - return m.validate(true) -} - -func (m *CorsPolicy) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetAllowOriginStringMatch() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CorsPolicyValidationError{ - field: fmt.Sprintf("AllowOriginStringMatch[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CorsPolicyValidationError{ - field: fmt.Sprintf("AllowOriginStringMatch[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CorsPolicyValidationError{ - field: fmt.Sprintf("AllowOriginStringMatch[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - // no validation rules for AllowMethods - - // no validation rules for AllowHeaders - - // no validation rules for ExposeHeaders - - // no validation rules for MaxAge - - if all { - switch v := interface{}(m.GetAllowCredentials()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CorsPolicyValidationError{ - field: "AllowCredentials", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CorsPolicyValidationError{ - field: "AllowCredentials", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetAllowCredentials()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CorsPolicyValidationError{ - field: "AllowCredentials", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetShadowEnabled()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CorsPolicyValidationError{ - field: "ShadowEnabled", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CorsPolicyValidationError{ - field: "ShadowEnabled", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetShadowEnabled()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CorsPolicyValidationError{ - field: "ShadowEnabled", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetAllowPrivateNetworkAccess()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CorsPolicyValidationError{ - field: "AllowPrivateNetworkAccess", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CorsPolicyValidationError{ - field: "AllowPrivateNetworkAccess", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetAllowPrivateNetworkAccess()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CorsPolicyValidationError{ - field: "AllowPrivateNetworkAccess", - reason: "embedded message failed validation", - cause: err, - } - } - } - - switch v := m.EnabledSpecifier.(type) { - case *CorsPolicy_FilterEnabled: - if v == nil { - err := CorsPolicyValidationError{ - field: "EnabledSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetFilterEnabled()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CorsPolicyValidationError{ - field: "FilterEnabled", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CorsPolicyValidationError{ - field: "FilterEnabled", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetFilterEnabled()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CorsPolicyValidationError{ - field: "FilterEnabled", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return CorsPolicyMultiError(errors) - } - - return nil -} - -// CorsPolicyMultiError is an error wrapping multiple validation errors -// returned by CorsPolicy.ValidateAll() if the designated constraints aren't met. -type CorsPolicyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CorsPolicyMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CorsPolicyMultiError) AllErrors() []error { return m } - -// CorsPolicyValidationError is the validation error returned by -// CorsPolicy.Validate if the designated constraints aren't met. -type CorsPolicyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CorsPolicyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CorsPolicyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CorsPolicyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CorsPolicyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CorsPolicyValidationError) ErrorName() string { return "CorsPolicyValidationError" } - -// Error satisfies the builtin error interface -func (e CorsPolicyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCorsPolicy.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CorsPolicyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CorsPolicyValidationError{} - -// Validate checks the field values on RouteAction with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *RouteAction) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RouteAction with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in RouteActionMultiError, or -// nil if none found. -func (m *RouteAction) ValidateAll() error { - return m.validate(true) -} - -func (m *RouteAction) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if _, ok := RouteAction_ClusterNotFoundResponseCode_name[int32(m.GetClusterNotFoundResponseCode())]; !ok { - err := RouteActionValidationError{ - field: "ClusterNotFoundResponseCode", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetMetadataMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "MetadataMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "MetadataMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMetadataMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteActionValidationError{ - field: "MetadataMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if !_RouteAction_PrefixRewrite_Pattern.MatchString(m.GetPrefixRewrite()) { - err := RouteActionValidationError{ - field: "PrefixRewrite", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetRegexRewrite()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "RegexRewrite", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "RegexRewrite", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRegexRewrite()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteActionValidationError{ - field: "RegexRewrite", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetPathRewritePolicy()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "PathRewritePolicy", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "PathRewritePolicy", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPathRewritePolicy()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteActionValidationError{ - field: "PathRewritePolicy", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for AppendXForwardedHost - - if all { - switch v := interface{}(m.GetTimeout()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "Timeout", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "Timeout", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTimeout()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteActionValidationError{ - field: "Timeout", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetIdleTimeout()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "IdleTimeout", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "IdleTimeout", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetIdleTimeout()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteActionValidationError{ - field: "IdleTimeout", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetEarlyDataPolicy()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "EarlyDataPolicy", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "EarlyDataPolicy", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetEarlyDataPolicy()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteActionValidationError{ - field: "EarlyDataPolicy", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetRetryPolicy()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "RetryPolicy", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "RetryPolicy", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRetryPolicy()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteActionValidationError{ - field: "RetryPolicy", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetRetryPolicyTypedConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "RetryPolicyTypedConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "RetryPolicyTypedConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRetryPolicyTypedConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteActionValidationError{ - field: "RetryPolicyTypedConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetRequestMirrorPolicies() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: fmt.Sprintf("RequestMirrorPolicies[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: fmt.Sprintf("RequestMirrorPolicies[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteActionValidationError{ - field: fmt.Sprintf("RequestMirrorPolicies[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if _, ok := v3.RoutingPriority_name[int32(m.GetPriority())]; !ok { - err := RouteActionValidationError{ - field: "Priority", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetRateLimits() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: fmt.Sprintf("RateLimits[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: fmt.Sprintf("RateLimits[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteActionValidationError{ - field: fmt.Sprintf("RateLimits[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetIncludeVhRateLimits()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "IncludeVhRateLimits", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "IncludeVhRateLimits", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetIncludeVhRateLimits()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteActionValidationError{ - field: "IncludeVhRateLimits", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetHashPolicy() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: fmt.Sprintf("HashPolicy[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: fmt.Sprintf("HashPolicy[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteActionValidationError{ - field: fmt.Sprintf("HashPolicy[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetCors()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "Cors", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "Cors", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCors()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteActionValidationError{ - field: "Cors", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetMaxGrpcTimeout()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "MaxGrpcTimeout", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "MaxGrpcTimeout", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMaxGrpcTimeout()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteActionValidationError{ - field: "MaxGrpcTimeout", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetGrpcTimeoutOffset()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "GrpcTimeoutOffset", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "GrpcTimeoutOffset", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetGrpcTimeoutOffset()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteActionValidationError{ - field: "GrpcTimeoutOffset", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetUpgradeConfigs() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: fmt.Sprintf("UpgradeConfigs[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: fmt.Sprintf("UpgradeConfigs[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteActionValidationError{ - field: fmt.Sprintf("UpgradeConfigs[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetInternalRedirectPolicy()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "InternalRedirectPolicy", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "InternalRedirectPolicy", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetInternalRedirectPolicy()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteActionValidationError{ - field: "InternalRedirectPolicy", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for InternalRedirectAction - - if all { - switch v := interface{}(m.GetMaxInternalRedirects()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "MaxInternalRedirects", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "MaxInternalRedirects", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMaxInternalRedirects()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteActionValidationError{ - field: "MaxInternalRedirects", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetHedgePolicy()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "HedgePolicy", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "HedgePolicy", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHedgePolicy()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteActionValidationError{ - field: "HedgePolicy", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetMaxStreamDuration()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "MaxStreamDuration", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "MaxStreamDuration", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMaxStreamDuration()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteActionValidationError{ - field: "MaxStreamDuration", - reason: "embedded message failed validation", - cause: err, - } - } - } - - oneofClusterSpecifierPresent := false - switch v := m.ClusterSpecifier.(type) { - case *RouteAction_Cluster: - if v == nil { - err := RouteActionValidationError{ - field: "ClusterSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofClusterSpecifierPresent = true - - if utf8.RuneCountInString(m.GetCluster()) < 1 { - err := RouteActionValidationError{ - field: "Cluster", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - case *RouteAction_ClusterHeader: - if v == nil { - err := RouteActionValidationError{ - field: "ClusterSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofClusterSpecifierPresent = true - - if utf8.RuneCountInString(m.GetClusterHeader()) < 1 { - err := RouteActionValidationError{ - field: "ClusterHeader", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_RouteAction_ClusterHeader_Pattern.MatchString(m.GetClusterHeader()) { - err := RouteActionValidationError{ - field: "ClusterHeader", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - case *RouteAction_WeightedClusters: - if v == nil { - err := RouteActionValidationError{ - field: "ClusterSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofClusterSpecifierPresent = true - - if all { - switch v := interface{}(m.GetWeightedClusters()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "WeightedClusters", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "WeightedClusters", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetWeightedClusters()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteActionValidationError{ - field: "WeightedClusters", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *RouteAction_ClusterSpecifierPlugin: - if v == nil { - err := RouteActionValidationError{ - field: "ClusterSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofClusterSpecifierPresent = true - // no validation rules for ClusterSpecifierPlugin - case *RouteAction_InlineClusterSpecifierPlugin: - if v == nil { - err := RouteActionValidationError{ - field: "ClusterSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofClusterSpecifierPresent = true - - if all { - switch v := interface{}(m.GetInlineClusterSpecifierPlugin()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "InlineClusterSpecifierPlugin", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "InlineClusterSpecifierPlugin", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetInlineClusterSpecifierPlugin()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteActionValidationError{ - field: "InlineClusterSpecifierPlugin", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofClusterSpecifierPresent { - err := RouteActionValidationError{ - field: "ClusterSpecifier", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - switch v := m.HostRewriteSpecifier.(type) { - case *RouteAction_HostRewriteLiteral: - if v == nil { - err := RouteActionValidationError{ - field: "HostRewriteSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_RouteAction_HostRewriteLiteral_Pattern.MatchString(m.GetHostRewriteLiteral()) { - err := RouteActionValidationError{ - field: "HostRewriteLiteral", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - case *RouteAction_AutoHostRewrite: - if v == nil { - err := RouteActionValidationError{ - field: "HostRewriteSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetAutoHostRewrite()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "AutoHostRewrite", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "AutoHostRewrite", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetAutoHostRewrite()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteActionValidationError{ - field: "AutoHostRewrite", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *RouteAction_HostRewriteHeader: - if v == nil { - err := RouteActionValidationError{ - field: "HostRewriteSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_RouteAction_HostRewriteHeader_Pattern.MatchString(m.GetHostRewriteHeader()) { - err := RouteActionValidationError{ - field: "HostRewriteHeader", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - case *RouteAction_HostRewritePathRegex: - if v == nil { - err := RouteActionValidationError{ - field: "HostRewriteSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetHostRewritePathRegex()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "HostRewritePathRegex", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteActionValidationError{ - field: "HostRewritePathRegex", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHostRewritePathRegex()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteActionValidationError{ - field: "HostRewritePathRegex", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return RouteActionMultiError(errors) - } - - return nil -} - -// RouteActionMultiError is an error wrapping multiple validation errors -// returned by RouteAction.ValidateAll() if the designated constraints aren't met. -type RouteActionMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RouteActionMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RouteActionMultiError) AllErrors() []error { return m } - -// RouteActionValidationError is the validation error returned by -// RouteAction.Validate if the designated constraints aren't met. -type RouteActionValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RouteActionValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RouteActionValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RouteActionValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RouteActionValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RouteActionValidationError) ErrorName() string { return "RouteActionValidationError" } - -// Error satisfies the builtin error interface -func (e RouteActionValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRouteAction.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RouteActionValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RouteActionValidationError{} - -var _RouteAction_ClusterHeader_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -var _RouteAction_PrefixRewrite_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -var _RouteAction_HostRewriteLiteral_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -var _RouteAction_HostRewriteHeader_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -// Validate checks the field values on RetryPolicy with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *RetryPolicy) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RetryPolicy with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in RetryPolicyMultiError, or -// nil if none found. -func (m *RetryPolicy) ValidateAll() error { - return m.validate(true) -} - -func (m *RetryPolicy) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for RetryOn - - if all { - switch v := interface{}(m.GetNumRetries()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RetryPolicyValidationError{ - field: "NumRetries", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RetryPolicyValidationError{ - field: "NumRetries", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetNumRetries()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RetryPolicyValidationError{ - field: "NumRetries", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetPerTryTimeout()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RetryPolicyValidationError{ - field: "PerTryTimeout", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RetryPolicyValidationError{ - field: "PerTryTimeout", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPerTryTimeout()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RetryPolicyValidationError{ - field: "PerTryTimeout", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetPerTryIdleTimeout()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RetryPolicyValidationError{ - field: "PerTryIdleTimeout", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RetryPolicyValidationError{ - field: "PerTryIdleTimeout", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPerTryIdleTimeout()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RetryPolicyValidationError{ - field: "PerTryIdleTimeout", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetRetryPriority()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RetryPolicyValidationError{ - field: "RetryPriority", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RetryPolicyValidationError{ - field: "RetryPriority", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRetryPriority()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RetryPolicyValidationError{ - field: "RetryPriority", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetRetryHostPredicate() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RetryPolicyValidationError{ - field: fmt.Sprintf("RetryHostPredicate[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RetryPolicyValidationError{ - field: fmt.Sprintf("RetryHostPredicate[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RetryPolicyValidationError{ - field: fmt.Sprintf("RetryHostPredicate[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetRetryOptionsPredicates() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RetryPolicyValidationError{ - field: fmt.Sprintf("RetryOptionsPredicates[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RetryPolicyValidationError{ - field: fmt.Sprintf("RetryOptionsPredicates[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RetryPolicyValidationError{ - field: fmt.Sprintf("RetryOptionsPredicates[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - // no validation rules for HostSelectionRetryMaxAttempts - - if all { - switch v := interface{}(m.GetRetryBackOff()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RetryPolicyValidationError{ - field: "RetryBackOff", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RetryPolicyValidationError{ - field: "RetryBackOff", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRetryBackOff()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RetryPolicyValidationError{ - field: "RetryBackOff", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetRateLimitedRetryBackOff()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RetryPolicyValidationError{ - field: "RateLimitedRetryBackOff", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RetryPolicyValidationError{ - field: "RateLimitedRetryBackOff", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRateLimitedRetryBackOff()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RetryPolicyValidationError{ - field: "RateLimitedRetryBackOff", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetRetriableHeaders() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RetryPolicyValidationError{ - field: fmt.Sprintf("RetriableHeaders[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RetryPolicyValidationError{ - field: fmt.Sprintf("RetriableHeaders[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RetryPolicyValidationError{ - field: fmt.Sprintf("RetriableHeaders[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetRetriableRequestHeaders() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RetryPolicyValidationError{ - field: fmt.Sprintf("RetriableRequestHeaders[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RetryPolicyValidationError{ - field: fmt.Sprintf("RetriableRequestHeaders[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RetryPolicyValidationError{ - field: fmt.Sprintf("RetriableRequestHeaders[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return RetryPolicyMultiError(errors) - } - - return nil -} - -// RetryPolicyMultiError is an error wrapping multiple validation errors -// returned by RetryPolicy.ValidateAll() if the designated constraints aren't met. -type RetryPolicyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RetryPolicyMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RetryPolicyMultiError) AllErrors() []error { return m } - -// RetryPolicyValidationError is the validation error returned by -// RetryPolicy.Validate if the designated constraints aren't met. -type RetryPolicyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RetryPolicyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RetryPolicyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RetryPolicyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RetryPolicyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RetryPolicyValidationError) ErrorName() string { return "RetryPolicyValidationError" } - -// Error satisfies the builtin error interface -func (e RetryPolicyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRetryPolicy.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RetryPolicyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RetryPolicyValidationError{} - -// Validate checks the field values on HedgePolicy with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *HedgePolicy) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HedgePolicy with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in HedgePolicyMultiError, or -// nil if none found. -func (m *HedgePolicy) ValidateAll() error { - return m.validate(true) -} - -func (m *HedgePolicy) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if wrapper := m.GetInitialRequests(); wrapper != nil { - - if wrapper.GetValue() < 1 { - err := HedgePolicyValidationError{ - field: "InitialRequests", - reason: "value must be greater than or equal to 1", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if all { - switch v := interface{}(m.GetAdditionalRequestChance()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HedgePolicyValidationError{ - field: "AdditionalRequestChance", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HedgePolicyValidationError{ - field: "AdditionalRequestChance", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetAdditionalRequestChance()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HedgePolicyValidationError{ - field: "AdditionalRequestChance", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for HedgeOnPerTryTimeout - - if len(errors) > 0 { - return HedgePolicyMultiError(errors) - } - - return nil -} - -// HedgePolicyMultiError is an error wrapping multiple validation errors -// returned by HedgePolicy.ValidateAll() if the designated constraints aren't met. -type HedgePolicyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HedgePolicyMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HedgePolicyMultiError) AllErrors() []error { return m } - -// HedgePolicyValidationError is the validation error returned by -// HedgePolicy.Validate if the designated constraints aren't met. -type HedgePolicyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HedgePolicyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HedgePolicyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HedgePolicyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HedgePolicyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HedgePolicyValidationError) ErrorName() string { return "HedgePolicyValidationError" } - -// Error satisfies the builtin error interface -func (e HedgePolicyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHedgePolicy.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HedgePolicyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HedgePolicyValidationError{} - -// Validate checks the field values on RedirectAction with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *RedirectAction) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RedirectAction with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in RedirectActionMultiError, -// or nil if none found. -func (m *RedirectAction) ValidateAll() error { - return m.validate(true) -} - -func (m *RedirectAction) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if !_RedirectAction_HostRedirect_Pattern.MatchString(m.GetHostRedirect()) { - err := RedirectActionValidationError{ - field: "HostRedirect", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for PortRedirect - - if _, ok := RedirectAction_RedirectResponseCode_name[int32(m.GetResponseCode())]; !ok { - err := RedirectActionValidationError{ - field: "ResponseCode", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for StripQuery - - switch v := m.SchemeRewriteSpecifier.(type) { - case *RedirectAction_HttpsRedirect: - if v == nil { - err := RedirectActionValidationError{ - field: "SchemeRewriteSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - // no validation rules for HttpsRedirect - case *RedirectAction_SchemeRedirect: - if v == nil { - err := RedirectActionValidationError{ - field: "SchemeRewriteSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - // no validation rules for SchemeRedirect - default: - _ = v // ensures v is used - } - switch v := m.PathRewriteSpecifier.(type) { - case *RedirectAction_PathRedirect: - if v == nil { - err := RedirectActionValidationError{ - field: "PathRewriteSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_RedirectAction_PathRedirect_Pattern.MatchString(m.GetPathRedirect()) { - err := RedirectActionValidationError{ - field: "PathRedirect", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - case *RedirectAction_PrefixRewrite: - if v == nil { - err := RedirectActionValidationError{ - field: "PathRewriteSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_RedirectAction_PrefixRewrite_Pattern.MatchString(m.GetPrefixRewrite()) { - err := RedirectActionValidationError{ - field: "PrefixRewrite", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - case *RedirectAction_RegexRewrite: - if v == nil { - err := RedirectActionValidationError{ - field: "PathRewriteSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetRegexRewrite()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RedirectActionValidationError{ - field: "RegexRewrite", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RedirectActionValidationError{ - field: "RegexRewrite", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRegexRewrite()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RedirectActionValidationError{ - field: "RegexRewrite", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return RedirectActionMultiError(errors) - } - - return nil -} - -// RedirectActionMultiError is an error wrapping multiple validation errors -// returned by RedirectAction.ValidateAll() if the designated constraints -// aren't met. -type RedirectActionMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RedirectActionMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RedirectActionMultiError) AllErrors() []error { return m } - -// RedirectActionValidationError is the validation error returned by -// RedirectAction.Validate if the designated constraints aren't met. -type RedirectActionValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RedirectActionValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RedirectActionValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RedirectActionValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RedirectActionValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RedirectActionValidationError) ErrorName() string { return "RedirectActionValidationError" } - -// Error satisfies the builtin error interface -func (e RedirectActionValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRedirectAction.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RedirectActionValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RedirectActionValidationError{} - -var _RedirectAction_HostRedirect_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -var _RedirectAction_PathRedirect_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -var _RedirectAction_PrefixRewrite_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -// Validate checks the field values on DirectResponseAction with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *DirectResponseAction) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DirectResponseAction with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// DirectResponseActionMultiError, or nil if none found. -func (m *DirectResponseAction) ValidateAll() error { - return m.validate(true) -} - -func (m *DirectResponseAction) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if val := m.GetStatus(); val < 200 || val >= 600 { - err := DirectResponseActionValidationError{ - field: "Status", - reason: "value must be inside range [200, 600)", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetBody()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DirectResponseActionValidationError{ - field: "Body", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DirectResponseActionValidationError{ - field: "Body", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetBody()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DirectResponseActionValidationError{ - field: "Body", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return DirectResponseActionMultiError(errors) - } - - return nil -} - -// DirectResponseActionMultiError is an error wrapping multiple validation -// errors returned by DirectResponseAction.ValidateAll() if the designated -// constraints aren't met. -type DirectResponseActionMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DirectResponseActionMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DirectResponseActionMultiError) AllErrors() []error { return m } - -// DirectResponseActionValidationError is the validation error returned by -// DirectResponseAction.Validate if the designated constraints aren't met. -type DirectResponseActionValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DirectResponseActionValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DirectResponseActionValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DirectResponseActionValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DirectResponseActionValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DirectResponseActionValidationError) ErrorName() string { - return "DirectResponseActionValidationError" -} - -// Error satisfies the builtin error interface -func (e DirectResponseActionValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDirectResponseAction.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DirectResponseActionValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DirectResponseActionValidationError{} - -// Validate checks the field values on NonForwardingAction with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *NonForwardingAction) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on NonForwardingAction with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// NonForwardingActionMultiError, or nil if none found. -func (m *NonForwardingAction) ValidateAll() error { - return m.validate(true) -} - -func (m *NonForwardingAction) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return NonForwardingActionMultiError(errors) - } - - return nil -} - -// NonForwardingActionMultiError is an error wrapping multiple validation -// errors returned by NonForwardingAction.ValidateAll() if the designated -// constraints aren't met. -type NonForwardingActionMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m NonForwardingActionMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m NonForwardingActionMultiError) AllErrors() []error { return m } - -// NonForwardingActionValidationError is the validation error returned by -// NonForwardingAction.Validate if the designated constraints aren't met. -type NonForwardingActionValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e NonForwardingActionValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e NonForwardingActionValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e NonForwardingActionValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e NonForwardingActionValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e NonForwardingActionValidationError) ErrorName() string { - return "NonForwardingActionValidationError" -} - -// Error satisfies the builtin error interface -func (e NonForwardingActionValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sNonForwardingAction.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = NonForwardingActionValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = NonForwardingActionValidationError{} - -// Validate checks the field values on Decorator with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Decorator) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Decorator with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in DecoratorMultiError, or nil -// if none found. -func (m *Decorator) ValidateAll() error { - return m.validate(true) -} - -func (m *Decorator) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetOperation()) < 1 { - err := DecoratorValidationError{ - field: "Operation", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetPropagate()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DecoratorValidationError{ - field: "Propagate", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DecoratorValidationError{ - field: "Propagate", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPropagate()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DecoratorValidationError{ - field: "Propagate", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return DecoratorMultiError(errors) - } - - return nil -} - -// DecoratorMultiError is an error wrapping multiple validation errors returned -// by Decorator.ValidateAll() if the designated constraints aren't met. -type DecoratorMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DecoratorMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DecoratorMultiError) AllErrors() []error { return m } - -// DecoratorValidationError is the validation error returned by -// Decorator.Validate if the designated constraints aren't met. -type DecoratorValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DecoratorValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DecoratorValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DecoratorValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DecoratorValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DecoratorValidationError) ErrorName() string { return "DecoratorValidationError" } - -// Error satisfies the builtin error interface -func (e DecoratorValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDecorator.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DecoratorValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DecoratorValidationError{} - -// Validate checks the field values on Tracing with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Tracing) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Tracing with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in TracingMultiError, or nil if none found. -func (m *Tracing) ValidateAll() error { - return m.validate(true) -} - -func (m *Tracing) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetClientSampling()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, TracingValidationError{ - field: "ClientSampling", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, TracingValidationError{ - field: "ClientSampling", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetClientSampling()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return TracingValidationError{ - field: "ClientSampling", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetRandomSampling()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, TracingValidationError{ - field: "RandomSampling", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, TracingValidationError{ - field: "RandomSampling", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRandomSampling()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return TracingValidationError{ - field: "RandomSampling", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetOverallSampling()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, TracingValidationError{ - field: "OverallSampling", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, TracingValidationError{ - field: "OverallSampling", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetOverallSampling()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return TracingValidationError{ - field: "OverallSampling", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetCustomTags() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, TracingValidationError{ - field: fmt.Sprintf("CustomTags[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, TracingValidationError{ - field: fmt.Sprintf("CustomTags[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return TracingValidationError{ - field: fmt.Sprintf("CustomTags[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return TracingMultiError(errors) - } - - return nil -} - -// TracingMultiError is an error wrapping multiple validation errors returned -// by Tracing.ValidateAll() if the designated constraints aren't met. -type TracingMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m TracingMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m TracingMultiError) AllErrors() []error { return m } - -// TracingValidationError is the validation error returned by Tracing.Validate -// if the designated constraints aren't met. -type TracingValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TracingValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TracingValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TracingValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TracingValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TracingValidationError) ErrorName() string { return "TracingValidationError" } - -// Error satisfies the builtin error interface -func (e TracingValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTracing.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TracingValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TracingValidationError{} - -// Validate checks the field values on VirtualCluster with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *VirtualCluster) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on VirtualCluster with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in VirtualClusterMultiError, -// or nil if none found. -func (m *VirtualCluster) ValidateAll() error { - return m.validate(true) -} - -func (m *VirtualCluster) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetHeaders() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, VirtualClusterValidationError{ - field: fmt.Sprintf("Headers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, VirtualClusterValidationError{ - field: fmt.Sprintf("Headers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return VirtualClusterValidationError{ - field: fmt.Sprintf("Headers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := VirtualClusterValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return VirtualClusterMultiError(errors) - } - - return nil -} - -// VirtualClusterMultiError is an error wrapping multiple validation errors -// returned by VirtualCluster.ValidateAll() if the designated constraints -// aren't met. -type VirtualClusterMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m VirtualClusterMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m VirtualClusterMultiError) AllErrors() []error { return m } - -// VirtualClusterValidationError is the validation error returned by -// VirtualCluster.Validate if the designated constraints aren't met. -type VirtualClusterValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e VirtualClusterValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e VirtualClusterValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e VirtualClusterValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e VirtualClusterValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e VirtualClusterValidationError) ErrorName() string { return "VirtualClusterValidationError" } - -// Error satisfies the builtin error interface -func (e VirtualClusterValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sVirtualCluster.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = VirtualClusterValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = VirtualClusterValidationError{} - -// Validate checks the field values on RateLimit with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *RateLimit) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RateLimit with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in RateLimitMultiError, or nil -// if none found. -func (m *RateLimit) ValidateAll() error { - return m.validate(true) -} - -func (m *RateLimit) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if wrapper := m.GetStage(); wrapper != nil { - - if wrapper.GetValue() > 10 { - err := RateLimitValidationError{ - field: "Stage", - reason: "value must be less than or equal to 10", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - // no validation rules for DisableKey - - if len(m.GetActions()) < 1 { - err := RateLimitValidationError{ - field: "Actions", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetActions() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RateLimitValidationError{ - field: fmt.Sprintf("Actions[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RateLimitValidationError{ - field: fmt.Sprintf("Actions[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RateLimitValidationError{ - field: fmt.Sprintf("Actions[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetLimit()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RateLimitValidationError{ - field: "Limit", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RateLimitValidationError{ - field: "Limit", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetLimit()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RateLimitValidationError{ - field: "Limit", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return RateLimitMultiError(errors) - } - - return nil -} - -// RateLimitMultiError is an error wrapping multiple validation errors returned -// by RateLimit.ValidateAll() if the designated constraints aren't met. -type RateLimitMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RateLimitMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RateLimitMultiError) AllErrors() []error { return m } - -// RateLimitValidationError is the validation error returned by -// RateLimit.Validate if the designated constraints aren't met. -type RateLimitValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RateLimitValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RateLimitValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RateLimitValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RateLimitValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RateLimitValidationError) ErrorName() string { return "RateLimitValidationError" } - -// Error satisfies the builtin error interface -func (e RateLimitValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRateLimit.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RateLimitValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RateLimitValidationError{} - -// Validate checks the field values on HeaderMatcher with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *HeaderMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HeaderMatcher with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in HeaderMatcherMultiError, or -// nil if none found. -func (m *HeaderMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *HeaderMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := HeaderMatcherValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_HeaderMatcher_Name_Pattern.MatchString(m.GetName()) { - err := HeaderMatcherValidationError{ - field: "Name", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for InvertMatch - - // no validation rules for TreatMissingHeaderAsEmpty - - switch v := m.HeaderMatchSpecifier.(type) { - case *HeaderMatcher_ExactMatch: - if v == nil { - err := HeaderMatcherValidationError{ - field: "HeaderMatchSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - // no validation rules for ExactMatch - case *HeaderMatcher_SafeRegexMatch: - if v == nil { - err := HeaderMatcherValidationError{ - field: "HeaderMatchSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetSafeRegexMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HeaderMatcherValidationError{ - field: "SafeRegexMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HeaderMatcherValidationError{ - field: "SafeRegexMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSafeRegexMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HeaderMatcherValidationError{ - field: "SafeRegexMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *HeaderMatcher_RangeMatch: - if v == nil { - err := HeaderMatcherValidationError{ - field: "HeaderMatchSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetRangeMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HeaderMatcherValidationError{ - field: "RangeMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HeaderMatcherValidationError{ - field: "RangeMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRangeMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HeaderMatcherValidationError{ - field: "RangeMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *HeaderMatcher_PresentMatch: - if v == nil { - err := HeaderMatcherValidationError{ - field: "HeaderMatchSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - // no validation rules for PresentMatch - case *HeaderMatcher_PrefixMatch: - if v == nil { - err := HeaderMatcherValidationError{ - field: "HeaderMatchSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if utf8.RuneCountInString(m.GetPrefixMatch()) < 1 { - err := HeaderMatcherValidationError{ - field: "PrefixMatch", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - case *HeaderMatcher_SuffixMatch: - if v == nil { - err := HeaderMatcherValidationError{ - field: "HeaderMatchSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if utf8.RuneCountInString(m.GetSuffixMatch()) < 1 { - err := HeaderMatcherValidationError{ - field: "SuffixMatch", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - case *HeaderMatcher_ContainsMatch: - if v == nil { - err := HeaderMatcherValidationError{ - field: "HeaderMatchSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if utf8.RuneCountInString(m.GetContainsMatch()) < 1 { - err := HeaderMatcherValidationError{ - field: "ContainsMatch", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - case *HeaderMatcher_StringMatch: - if v == nil { - err := HeaderMatcherValidationError{ - field: "HeaderMatchSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetStringMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HeaderMatcherValidationError{ - field: "StringMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HeaderMatcherValidationError{ - field: "StringMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetStringMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HeaderMatcherValidationError{ - field: "StringMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return HeaderMatcherMultiError(errors) - } - - return nil -} - -// HeaderMatcherMultiError is an error wrapping multiple validation errors -// returned by HeaderMatcher.ValidateAll() if the designated constraints -// aren't met. -type HeaderMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HeaderMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HeaderMatcherMultiError) AllErrors() []error { return m } - -// HeaderMatcherValidationError is the validation error returned by -// HeaderMatcher.Validate if the designated constraints aren't met. -type HeaderMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HeaderMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HeaderMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HeaderMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HeaderMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HeaderMatcherValidationError) ErrorName() string { return "HeaderMatcherValidationError" } - -// Error satisfies the builtin error interface -func (e HeaderMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHeaderMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HeaderMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HeaderMatcherValidationError{} - -var _HeaderMatcher_Name_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -// Validate checks the field values on QueryParameterMatcher with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *QueryParameterMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on QueryParameterMatcher with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// QueryParameterMatcherMultiError, or nil if none found. -func (m *QueryParameterMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *QueryParameterMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := QueryParameterMatcherValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(m.GetName()) > 1024 { - err := QueryParameterMatcherValidationError{ - field: "Name", - reason: "value length must be at most 1024 bytes", - } - if !all { - return err - } - errors = append(errors, err) - } - - switch v := m.QueryParameterMatchSpecifier.(type) { - case *QueryParameterMatcher_StringMatch: - if v == nil { - err := QueryParameterMatcherValidationError{ - field: "QueryParameterMatchSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if m.GetStringMatch() == nil { - err := QueryParameterMatcherValidationError{ - field: "StringMatch", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetStringMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, QueryParameterMatcherValidationError{ - field: "StringMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, QueryParameterMatcherValidationError{ - field: "StringMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetStringMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return QueryParameterMatcherValidationError{ - field: "StringMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *QueryParameterMatcher_PresentMatch: - if v == nil { - err := QueryParameterMatcherValidationError{ - field: "QueryParameterMatchSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - // no validation rules for PresentMatch - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return QueryParameterMatcherMultiError(errors) - } - - return nil -} - -// QueryParameterMatcherMultiError is an error wrapping multiple validation -// errors returned by QueryParameterMatcher.ValidateAll() if the designated -// constraints aren't met. -type QueryParameterMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m QueryParameterMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m QueryParameterMatcherMultiError) AllErrors() []error { return m } - -// QueryParameterMatcherValidationError is the validation error returned by -// QueryParameterMatcher.Validate if the designated constraints aren't met. -type QueryParameterMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e QueryParameterMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e QueryParameterMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e QueryParameterMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e QueryParameterMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e QueryParameterMatcherValidationError) ErrorName() string { - return "QueryParameterMatcherValidationError" -} - -// Error satisfies the builtin error interface -func (e QueryParameterMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sQueryParameterMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = QueryParameterMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = QueryParameterMatcherValidationError{} - -// Validate checks the field values on InternalRedirectPolicy with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *InternalRedirectPolicy) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on InternalRedirectPolicy with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// InternalRedirectPolicyMultiError, or nil if none found. -func (m *InternalRedirectPolicy) ValidateAll() error { - return m.validate(true) -} - -func (m *InternalRedirectPolicy) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetMaxInternalRedirects()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, InternalRedirectPolicyValidationError{ - field: "MaxInternalRedirects", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, InternalRedirectPolicyValidationError{ - field: "MaxInternalRedirects", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMaxInternalRedirects()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return InternalRedirectPolicyValidationError{ - field: "MaxInternalRedirects", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(m.GetRedirectResponseCodes()) > 5 { - err := InternalRedirectPolicyValidationError{ - field: "RedirectResponseCodes", - reason: "value must contain no more than 5 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetPredicates() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, InternalRedirectPolicyValidationError{ - field: fmt.Sprintf("Predicates[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, InternalRedirectPolicyValidationError{ - field: fmt.Sprintf("Predicates[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return InternalRedirectPolicyValidationError{ - field: fmt.Sprintf("Predicates[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - // no validation rules for AllowCrossSchemeRedirect - - _InternalRedirectPolicy_ResponseHeadersToCopy_Unique := make(map[string]struct{}, len(m.GetResponseHeadersToCopy())) - - for idx, item := range m.GetResponseHeadersToCopy() { - _, _ = idx, item - - if _, exists := _InternalRedirectPolicy_ResponseHeadersToCopy_Unique[item]; exists { - err := InternalRedirectPolicyValidationError{ - field: fmt.Sprintf("ResponseHeadersToCopy[%v]", idx), - reason: "repeated value must contain unique items", - } - if !all { - return err - } - errors = append(errors, err) - } else { - _InternalRedirectPolicy_ResponseHeadersToCopy_Unique[item] = struct{}{} - } - - if !_InternalRedirectPolicy_ResponseHeadersToCopy_Pattern.MatchString(item) { - err := InternalRedirectPolicyValidationError{ - field: fmt.Sprintf("ResponseHeadersToCopy[%v]", idx), - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if len(errors) > 0 { - return InternalRedirectPolicyMultiError(errors) - } - - return nil -} - -// InternalRedirectPolicyMultiError is an error wrapping multiple validation -// errors returned by InternalRedirectPolicy.ValidateAll() if the designated -// constraints aren't met. -type InternalRedirectPolicyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m InternalRedirectPolicyMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m InternalRedirectPolicyMultiError) AllErrors() []error { return m } - -// InternalRedirectPolicyValidationError is the validation error returned by -// InternalRedirectPolicy.Validate if the designated constraints aren't met. -type InternalRedirectPolicyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e InternalRedirectPolicyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e InternalRedirectPolicyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e InternalRedirectPolicyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e InternalRedirectPolicyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e InternalRedirectPolicyValidationError) ErrorName() string { - return "InternalRedirectPolicyValidationError" -} - -// Error satisfies the builtin error interface -func (e InternalRedirectPolicyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sInternalRedirectPolicy.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = InternalRedirectPolicyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = InternalRedirectPolicyValidationError{} - -var _InternalRedirectPolicy_ResponseHeadersToCopy_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -// Validate checks the field values on FilterConfig with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *FilterConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on FilterConfig with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in FilterConfigMultiError, or -// nil if none found. -func (m *FilterConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *FilterConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, FilterConfigValidationError{ - field: "Config", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, FilterConfigValidationError{ - field: "Config", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return FilterConfigValidationError{ - field: "Config", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for IsOptional - - // no validation rules for Disabled - - if len(errors) > 0 { - return FilterConfigMultiError(errors) - } - - return nil -} - -// FilterConfigMultiError is an error wrapping multiple validation errors -// returned by FilterConfig.ValidateAll() if the designated constraints aren't met. -type FilterConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m FilterConfigMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m FilterConfigMultiError) AllErrors() []error { return m } - -// FilterConfigValidationError is the validation error returned by -// FilterConfig.Validate if the designated constraints aren't met. -type FilterConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e FilterConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e FilterConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e FilterConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e FilterConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e FilterConfigValidationError) ErrorName() string { return "FilterConfigValidationError" } - -// Error satisfies the builtin error interface -func (e FilterConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sFilterConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = FilterConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = FilterConfigValidationError{} - -// Validate checks the field values on WeightedCluster_ClusterWeight with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *WeightedCluster_ClusterWeight) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on WeightedCluster_ClusterWeight with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// WeightedCluster_ClusterWeightMultiError, or nil if none found. -func (m *WeightedCluster_ClusterWeight) ValidateAll() error { - return m.validate(true) -} - -func (m *WeightedCluster_ClusterWeight) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Name - - if !_WeightedCluster_ClusterWeight_ClusterHeader_Pattern.MatchString(m.GetClusterHeader()) { - err := WeightedCluster_ClusterWeightValidationError{ - field: "ClusterHeader", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetWeight()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, WeightedCluster_ClusterWeightValidationError{ - field: "Weight", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, WeightedCluster_ClusterWeightValidationError{ - field: "Weight", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetWeight()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return WeightedCluster_ClusterWeightValidationError{ - field: "Weight", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetMetadataMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, WeightedCluster_ClusterWeightValidationError{ - field: "MetadataMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, WeightedCluster_ClusterWeightValidationError{ - field: "MetadataMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMetadataMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return WeightedCluster_ClusterWeightValidationError{ - field: "MetadataMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(m.GetRequestHeadersToAdd()) > 1000 { - err := WeightedCluster_ClusterWeightValidationError{ - field: "RequestHeadersToAdd", - reason: "value must contain no more than 1000 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetRequestHeadersToAdd() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, WeightedCluster_ClusterWeightValidationError{ - field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, WeightedCluster_ClusterWeightValidationError{ - field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return WeightedCluster_ClusterWeightValidationError{ - field: fmt.Sprintf("RequestHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetRequestHeadersToRemove() { - _, _ = idx, item - - if !_WeightedCluster_ClusterWeight_RequestHeadersToRemove_Pattern.MatchString(item) { - err := WeightedCluster_ClusterWeightValidationError{ - field: fmt.Sprintf("RequestHeadersToRemove[%v]", idx), - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if len(m.GetResponseHeadersToAdd()) > 1000 { - err := WeightedCluster_ClusterWeightValidationError{ - field: "ResponseHeadersToAdd", - reason: "value must contain no more than 1000 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetResponseHeadersToAdd() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, WeightedCluster_ClusterWeightValidationError{ - field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, WeightedCluster_ClusterWeightValidationError{ - field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return WeightedCluster_ClusterWeightValidationError{ - field: fmt.Sprintf("ResponseHeadersToAdd[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetResponseHeadersToRemove() { - _, _ = idx, item - - if !_WeightedCluster_ClusterWeight_ResponseHeadersToRemove_Pattern.MatchString(item) { - err := WeightedCluster_ClusterWeightValidationError{ - field: fmt.Sprintf("ResponseHeadersToRemove[%v]", idx), - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - { - sorted_keys := make([]string, len(m.GetTypedPerFilterConfig())) - i := 0 - for key := range m.GetTypedPerFilterConfig() { - sorted_keys[i] = key - i++ - } - sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] }) - for _, key := range sorted_keys { - val := m.GetTypedPerFilterConfig()[key] - _ = val - - // no validation rules for TypedPerFilterConfig[key] - - if all { - switch v := interface{}(val).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, WeightedCluster_ClusterWeightValidationError{ - field: fmt.Sprintf("TypedPerFilterConfig[%v]", key), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, WeightedCluster_ClusterWeightValidationError{ - field: fmt.Sprintf("TypedPerFilterConfig[%v]", key), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(val).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return WeightedCluster_ClusterWeightValidationError{ - field: fmt.Sprintf("TypedPerFilterConfig[%v]", key), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - } - - switch v := m.HostRewriteSpecifier.(type) { - case *WeightedCluster_ClusterWeight_HostRewriteLiteral: - if v == nil { - err := WeightedCluster_ClusterWeightValidationError{ - field: "HostRewriteSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_WeightedCluster_ClusterWeight_HostRewriteLiteral_Pattern.MatchString(m.GetHostRewriteLiteral()) { - err := WeightedCluster_ClusterWeightValidationError{ - field: "HostRewriteLiteral", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return WeightedCluster_ClusterWeightMultiError(errors) - } - - return nil -} - -// WeightedCluster_ClusterWeightMultiError is an error wrapping multiple -// validation errors returned by WeightedCluster_ClusterWeight.ValidateAll() -// if the designated constraints aren't met. -type WeightedCluster_ClusterWeightMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m WeightedCluster_ClusterWeightMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m WeightedCluster_ClusterWeightMultiError) AllErrors() []error { return m } - -// WeightedCluster_ClusterWeightValidationError is the validation error -// returned by WeightedCluster_ClusterWeight.Validate if the designated -// constraints aren't met. -type WeightedCluster_ClusterWeightValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e WeightedCluster_ClusterWeightValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e WeightedCluster_ClusterWeightValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e WeightedCluster_ClusterWeightValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e WeightedCluster_ClusterWeightValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e WeightedCluster_ClusterWeightValidationError) ErrorName() string { - return "WeightedCluster_ClusterWeightValidationError" -} - -// Error satisfies the builtin error interface -func (e WeightedCluster_ClusterWeightValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sWeightedCluster_ClusterWeight.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = WeightedCluster_ClusterWeightValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = WeightedCluster_ClusterWeightValidationError{} - -var _WeightedCluster_ClusterWeight_ClusterHeader_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -var _WeightedCluster_ClusterWeight_RequestHeadersToRemove_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -var _WeightedCluster_ClusterWeight_ResponseHeadersToRemove_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -var _WeightedCluster_ClusterWeight_HostRewriteLiteral_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -// Validate checks the field values on RouteMatch_GrpcRouteMatchOptions with -// the rules defined in the proto definition for this message. If any rules -// are violated, the first error encountered is returned, or nil if there are -// no violations. -func (m *RouteMatch_GrpcRouteMatchOptions) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RouteMatch_GrpcRouteMatchOptions with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// RouteMatch_GrpcRouteMatchOptionsMultiError, or nil if none found. -func (m *RouteMatch_GrpcRouteMatchOptions) ValidateAll() error { - return m.validate(true) -} - -func (m *RouteMatch_GrpcRouteMatchOptions) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return RouteMatch_GrpcRouteMatchOptionsMultiError(errors) - } - - return nil -} - -// RouteMatch_GrpcRouteMatchOptionsMultiError is an error wrapping multiple -// validation errors returned by -// RouteMatch_GrpcRouteMatchOptions.ValidateAll() if the designated -// constraints aren't met. -type RouteMatch_GrpcRouteMatchOptionsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RouteMatch_GrpcRouteMatchOptionsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RouteMatch_GrpcRouteMatchOptionsMultiError) AllErrors() []error { return m } - -// RouteMatch_GrpcRouteMatchOptionsValidationError is the validation error -// returned by RouteMatch_GrpcRouteMatchOptions.Validate if the designated -// constraints aren't met. -type RouteMatch_GrpcRouteMatchOptionsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RouteMatch_GrpcRouteMatchOptionsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RouteMatch_GrpcRouteMatchOptionsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RouteMatch_GrpcRouteMatchOptionsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RouteMatch_GrpcRouteMatchOptionsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RouteMatch_GrpcRouteMatchOptionsValidationError) ErrorName() string { - return "RouteMatch_GrpcRouteMatchOptionsValidationError" -} - -// Error satisfies the builtin error interface -func (e RouteMatch_GrpcRouteMatchOptionsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRouteMatch_GrpcRouteMatchOptions.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RouteMatch_GrpcRouteMatchOptionsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RouteMatch_GrpcRouteMatchOptionsValidationError{} - -// Validate checks the field values on RouteMatch_TlsContextMatchOptions with -// the rules defined in the proto definition for this message. If any rules -// are violated, the first error encountered is returned, or nil if there are -// no violations. -func (m *RouteMatch_TlsContextMatchOptions) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RouteMatch_TlsContextMatchOptions -// with the rules defined in the proto definition for this message. If any -// rules are violated, the result is a list of violation errors wrapped in -// RouteMatch_TlsContextMatchOptionsMultiError, or nil if none found. -func (m *RouteMatch_TlsContextMatchOptions) ValidateAll() error { - return m.validate(true) -} - -func (m *RouteMatch_TlsContextMatchOptions) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetPresented()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteMatch_TlsContextMatchOptionsValidationError{ - field: "Presented", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteMatch_TlsContextMatchOptionsValidationError{ - field: "Presented", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPresented()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteMatch_TlsContextMatchOptionsValidationError{ - field: "Presented", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetValidated()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteMatch_TlsContextMatchOptionsValidationError{ - field: "Validated", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteMatch_TlsContextMatchOptionsValidationError{ - field: "Validated", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetValidated()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteMatch_TlsContextMatchOptionsValidationError{ - field: "Validated", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return RouteMatch_TlsContextMatchOptionsMultiError(errors) - } - - return nil -} - -// RouteMatch_TlsContextMatchOptionsMultiError is an error wrapping multiple -// validation errors returned by -// RouteMatch_TlsContextMatchOptions.ValidateAll() if the designated -// constraints aren't met. -type RouteMatch_TlsContextMatchOptionsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RouteMatch_TlsContextMatchOptionsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RouteMatch_TlsContextMatchOptionsMultiError) AllErrors() []error { return m } - -// RouteMatch_TlsContextMatchOptionsValidationError is the validation error -// returned by RouteMatch_TlsContextMatchOptions.Validate if the designated -// constraints aren't met. -type RouteMatch_TlsContextMatchOptionsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RouteMatch_TlsContextMatchOptionsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RouteMatch_TlsContextMatchOptionsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RouteMatch_TlsContextMatchOptionsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RouteMatch_TlsContextMatchOptionsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RouteMatch_TlsContextMatchOptionsValidationError) ErrorName() string { - return "RouteMatch_TlsContextMatchOptionsValidationError" -} - -// Error satisfies the builtin error interface -func (e RouteMatch_TlsContextMatchOptionsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRouteMatch_TlsContextMatchOptions.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RouteMatch_TlsContextMatchOptionsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RouteMatch_TlsContextMatchOptionsValidationError{} - -// Validate checks the field values on RouteMatch_ConnectMatcher with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RouteMatch_ConnectMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RouteMatch_ConnectMatcher with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RouteMatch_ConnectMatcherMultiError, or nil if none found. -func (m *RouteMatch_ConnectMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *RouteMatch_ConnectMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return RouteMatch_ConnectMatcherMultiError(errors) - } - - return nil -} - -// RouteMatch_ConnectMatcherMultiError is an error wrapping multiple validation -// errors returned by RouteMatch_ConnectMatcher.ValidateAll() if the -// designated constraints aren't met. -type RouteMatch_ConnectMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RouteMatch_ConnectMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RouteMatch_ConnectMatcherMultiError) AllErrors() []error { return m } - -// RouteMatch_ConnectMatcherValidationError is the validation error returned by -// RouteMatch_ConnectMatcher.Validate if the designated constraints aren't met. -type RouteMatch_ConnectMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RouteMatch_ConnectMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RouteMatch_ConnectMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RouteMatch_ConnectMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RouteMatch_ConnectMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RouteMatch_ConnectMatcherValidationError) ErrorName() string { - return "RouteMatch_ConnectMatcherValidationError" -} - -// Error satisfies the builtin error interface -func (e RouteMatch_ConnectMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRouteMatch_ConnectMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RouteMatch_ConnectMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RouteMatch_ConnectMatcherValidationError{} - -// Validate checks the field values on RouteAction_RequestMirrorPolicy with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RouteAction_RequestMirrorPolicy) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RouteAction_RequestMirrorPolicy with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// RouteAction_RequestMirrorPolicyMultiError, or nil if none found. -func (m *RouteAction_RequestMirrorPolicy) ValidateAll() error { - return m.validate(true) -} - -func (m *RouteAction_RequestMirrorPolicy) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Cluster - - if !_RouteAction_RequestMirrorPolicy_ClusterHeader_Pattern.MatchString(m.GetClusterHeader()) { - err := RouteAction_RequestMirrorPolicyValidationError{ - field: "ClusterHeader", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetRuntimeFraction()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteAction_RequestMirrorPolicyValidationError{ - field: "RuntimeFraction", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteAction_RequestMirrorPolicyValidationError{ - field: "RuntimeFraction", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRuntimeFraction()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteAction_RequestMirrorPolicyValidationError{ - field: "RuntimeFraction", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetTraceSampled()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteAction_RequestMirrorPolicyValidationError{ - field: "TraceSampled", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteAction_RequestMirrorPolicyValidationError{ - field: "TraceSampled", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTraceSampled()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteAction_RequestMirrorPolicyValidationError{ - field: "TraceSampled", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return RouteAction_RequestMirrorPolicyMultiError(errors) - } - - return nil -} - -// RouteAction_RequestMirrorPolicyMultiError is an error wrapping multiple -// validation errors returned by RouteAction_RequestMirrorPolicy.ValidateAll() -// if the designated constraints aren't met. -type RouteAction_RequestMirrorPolicyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RouteAction_RequestMirrorPolicyMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RouteAction_RequestMirrorPolicyMultiError) AllErrors() []error { return m } - -// RouteAction_RequestMirrorPolicyValidationError is the validation error -// returned by RouteAction_RequestMirrorPolicy.Validate if the designated -// constraints aren't met. -type RouteAction_RequestMirrorPolicyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RouteAction_RequestMirrorPolicyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RouteAction_RequestMirrorPolicyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RouteAction_RequestMirrorPolicyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RouteAction_RequestMirrorPolicyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RouteAction_RequestMirrorPolicyValidationError) ErrorName() string { - return "RouteAction_RequestMirrorPolicyValidationError" -} - -// Error satisfies the builtin error interface -func (e RouteAction_RequestMirrorPolicyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRouteAction_RequestMirrorPolicy.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RouteAction_RequestMirrorPolicyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RouteAction_RequestMirrorPolicyValidationError{} - -var _RouteAction_RequestMirrorPolicy_ClusterHeader_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -// Validate checks the field values on RouteAction_HashPolicy with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RouteAction_HashPolicy) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RouteAction_HashPolicy with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RouteAction_HashPolicyMultiError, or nil if none found. -func (m *RouteAction_HashPolicy) ValidateAll() error { - return m.validate(true) -} - -func (m *RouteAction_HashPolicy) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Terminal - - oneofPolicySpecifierPresent := false - switch v := m.PolicySpecifier.(type) { - case *RouteAction_HashPolicy_Header_: - if v == nil { - err := RouteAction_HashPolicyValidationError{ - field: "PolicySpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofPolicySpecifierPresent = true - - if all { - switch v := interface{}(m.GetHeader()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteAction_HashPolicyValidationError{ - field: "Header", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteAction_HashPolicyValidationError{ - field: "Header", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteAction_HashPolicyValidationError{ - field: "Header", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *RouteAction_HashPolicy_Cookie_: - if v == nil { - err := RouteAction_HashPolicyValidationError{ - field: "PolicySpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofPolicySpecifierPresent = true - - if all { - switch v := interface{}(m.GetCookie()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteAction_HashPolicyValidationError{ - field: "Cookie", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteAction_HashPolicyValidationError{ - field: "Cookie", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCookie()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteAction_HashPolicyValidationError{ - field: "Cookie", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *RouteAction_HashPolicy_ConnectionProperties_: - if v == nil { - err := RouteAction_HashPolicyValidationError{ - field: "PolicySpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofPolicySpecifierPresent = true - - if all { - switch v := interface{}(m.GetConnectionProperties()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteAction_HashPolicyValidationError{ - field: "ConnectionProperties", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteAction_HashPolicyValidationError{ - field: "ConnectionProperties", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetConnectionProperties()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteAction_HashPolicyValidationError{ - field: "ConnectionProperties", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *RouteAction_HashPolicy_QueryParameter_: - if v == nil { - err := RouteAction_HashPolicyValidationError{ - field: "PolicySpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofPolicySpecifierPresent = true - - if all { - switch v := interface{}(m.GetQueryParameter()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteAction_HashPolicyValidationError{ - field: "QueryParameter", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteAction_HashPolicyValidationError{ - field: "QueryParameter", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetQueryParameter()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteAction_HashPolicyValidationError{ - field: "QueryParameter", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *RouteAction_HashPolicy_FilterState_: - if v == nil { - err := RouteAction_HashPolicyValidationError{ - field: "PolicySpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofPolicySpecifierPresent = true - - if all { - switch v := interface{}(m.GetFilterState()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteAction_HashPolicyValidationError{ - field: "FilterState", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteAction_HashPolicyValidationError{ - field: "FilterState", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetFilterState()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteAction_HashPolicyValidationError{ - field: "FilterState", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofPolicySpecifierPresent { - err := RouteAction_HashPolicyValidationError{ - field: "PolicySpecifier", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return RouteAction_HashPolicyMultiError(errors) - } - - return nil -} - -// RouteAction_HashPolicyMultiError is an error wrapping multiple validation -// errors returned by RouteAction_HashPolicy.ValidateAll() if the designated -// constraints aren't met. -type RouteAction_HashPolicyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RouteAction_HashPolicyMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RouteAction_HashPolicyMultiError) AllErrors() []error { return m } - -// RouteAction_HashPolicyValidationError is the validation error returned by -// RouteAction_HashPolicy.Validate if the designated constraints aren't met. -type RouteAction_HashPolicyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RouteAction_HashPolicyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RouteAction_HashPolicyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RouteAction_HashPolicyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RouteAction_HashPolicyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RouteAction_HashPolicyValidationError) ErrorName() string { - return "RouteAction_HashPolicyValidationError" -} - -// Error satisfies the builtin error interface -func (e RouteAction_HashPolicyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRouteAction_HashPolicy.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RouteAction_HashPolicyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RouteAction_HashPolicyValidationError{} - -// Validate checks the field values on RouteAction_UpgradeConfig with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RouteAction_UpgradeConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RouteAction_UpgradeConfig with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RouteAction_UpgradeConfigMultiError, or nil if none found. -func (m *RouteAction_UpgradeConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *RouteAction_UpgradeConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetUpgradeType()) < 1 { - err := RouteAction_UpgradeConfigValidationError{ - field: "UpgradeType", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_RouteAction_UpgradeConfig_UpgradeType_Pattern.MatchString(m.GetUpgradeType()) { - err := RouteAction_UpgradeConfigValidationError{ - field: "UpgradeType", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetEnabled()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteAction_UpgradeConfigValidationError{ - field: "Enabled", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteAction_UpgradeConfigValidationError{ - field: "Enabled", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetEnabled()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteAction_UpgradeConfigValidationError{ - field: "Enabled", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetConnectConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteAction_UpgradeConfigValidationError{ - field: "ConnectConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteAction_UpgradeConfigValidationError{ - field: "ConnectConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetConnectConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteAction_UpgradeConfigValidationError{ - field: "ConnectConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return RouteAction_UpgradeConfigMultiError(errors) - } - - return nil -} - -// RouteAction_UpgradeConfigMultiError is an error wrapping multiple validation -// errors returned by RouteAction_UpgradeConfig.ValidateAll() if the -// designated constraints aren't met. -type RouteAction_UpgradeConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RouteAction_UpgradeConfigMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RouteAction_UpgradeConfigMultiError) AllErrors() []error { return m } - -// RouteAction_UpgradeConfigValidationError is the validation error returned by -// RouteAction_UpgradeConfig.Validate if the designated constraints aren't met. -type RouteAction_UpgradeConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RouteAction_UpgradeConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RouteAction_UpgradeConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RouteAction_UpgradeConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RouteAction_UpgradeConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RouteAction_UpgradeConfigValidationError) ErrorName() string { - return "RouteAction_UpgradeConfigValidationError" -} - -// Error satisfies the builtin error interface -func (e RouteAction_UpgradeConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRouteAction_UpgradeConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RouteAction_UpgradeConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RouteAction_UpgradeConfigValidationError{} - -var _RouteAction_UpgradeConfig_UpgradeType_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -// Validate checks the field values on RouteAction_MaxStreamDuration with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RouteAction_MaxStreamDuration) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RouteAction_MaxStreamDuration with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// RouteAction_MaxStreamDurationMultiError, or nil if none found. -func (m *RouteAction_MaxStreamDuration) ValidateAll() error { - return m.validate(true) -} - -func (m *RouteAction_MaxStreamDuration) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetMaxStreamDuration()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteAction_MaxStreamDurationValidationError{ - field: "MaxStreamDuration", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteAction_MaxStreamDurationValidationError{ - field: "MaxStreamDuration", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMaxStreamDuration()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteAction_MaxStreamDurationValidationError{ - field: "MaxStreamDuration", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetGrpcTimeoutHeaderMax()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteAction_MaxStreamDurationValidationError{ - field: "GrpcTimeoutHeaderMax", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteAction_MaxStreamDurationValidationError{ - field: "GrpcTimeoutHeaderMax", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetGrpcTimeoutHeaderMax()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteAction_MaxStreamDurationValidationError{ - field: "GrpcTimeoutHeaderMax", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetGrpcTimeoutHeaderOffset()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteAction_MaxStreamDurationValidationError{ - field: "GrpcTimeoutHeaderOffset", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteAction_MaxStreamDurationValidationError{ - field: "GrpcTimeoutHeaderOffset", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetGrpcTimeoutHeaderOffset()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteAction_MaxStreamDurationValidationError{ - field: "GrpcTimeoutHeaderOffset", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return RouteAction_MaxStreamDurationMultiError(errors) - } - - return nil -} - -// RouteAction_MaxStreamDurationMultiError is an error wrapping multiple -// validation errors returned by RouteAction_MaxStreamDuration.ValidateAll() -// if the designated constraints aren't met. -type RouteAction_MaxStreamDurationMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RouteAction_MaxStreamDurationMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RouteAction_MaxStreamDurationMultiError) AllErrors() []error { return m } - -// RouteAction_MaxStreamDurationValidationError is the validation error -// returned by RouteAction_MaxStreamDuration.Validate if the designated -// constraints aren't met. -type RouteAction_MaxStreamDurationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RouteAction_MaxStreamDurationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RouteAction_MaxStreamDurationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RouteAction_MaxStreamDurationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RouteAction_MaxStreamDurationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RouteAction_MaxStreamDurationValidationError) ErrorName() string { - return "RouteAction_MaxStreamDurationValidationError" -} - -// Error satisfies the builtin error interface -func (e RouteAction_MaxStreamDurationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRouteAction_MaxStreamDuration.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RouteAction_MaxStreamDurationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RouteAction_MaxStreamDurationValidationError{} - -// Validate checks the field values on RouteAction_HashPolicy_Header with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RouteAction_HashPolicy_Header) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RouteAction_HashPolicy_Header with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// RouteAction_HashPolicy_HeaderMultiError, or nil if none found. -func (m *RouteAction_HashPolicy_Header) ValidateAll() error { - return m.validate(true) -} - -func (m *RouteAction_HashPolicy_Header) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetHeaderName()) < 1 { - err := RouteAction_HashPolicy_HeaderValidationError{ - field: "HeaderName", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_RouteAction_HashPolicy_Header_HeaderName_Pattern.MatchString(m.GetHeaderName()) { - err := RouteAction_HashPolicy_HeaderValidationError{ - field: "HeaderName", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetRegexRewrite()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteAction_HashPolicy_HeaderValidationError{ - field: "RegexRewrite", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteAction_HashPolicy_HeaderValidationError{ - field: "RegexRewrite", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRegexRewrite()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteAction_HashPolicy_HeaderValidationError{ - field: "RegexRewrite", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return RouteAction_HashPolicy_HeaderMultiError(errors) - } - - return nil -} - -// RouteAction_HashPolicy_HeaderMultiError is an error wrapping multiple -// validation errors returned by RouteAction_HashPolicy_Header.ValidateAll() -// if the designated constraints aren't met. -type RouteAction_HashPolicy_HeaderMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RouteAction_HashPolicy_HeaderMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RouteAction_HashPolicy_HeaderMultiError) AllErrors() []error { return m } - -// RouteAction_HashPolicy_HeaderValidationError is the validation error -// returned by RouteAction_HashPolicy_Header.Validate if the designated -// constraints aren't met. -type RouteAction_HashPolicy_HeaderValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RouteAction_HashPolicy_HeaderValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RouteAction_HashPolicy_HeaderValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RouteAction_HashPolicy_HeaderValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RouteAction_HashPolicy_HeaderValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RouteAction_HashPolicy_HeaderValidationError) ErrorName() string { - return "RouteAction_HashPolicy_HeaderValidationError" -} - -// Error satisfies the builtin error interface -func (e RouteAction_HashPolicy_HeaderValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRouteAction_HashPolicy_Header.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RouteAction_HashPolicy_HeaderValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RouteAction_HashPolicy_HeaderValidationError{} - -var _RouteAction_HashPolicy_Header_HeaderName_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -// Validate checks the field values on RouteAction_HashPolicy_CookieAttribute -// with the rules defined in the proto definition for this message. If any -// rules are violated, the first error encountered is returned, or nil if -// there are no violations. -func (m *RouteAction_HashPolicy_CookieAttribute) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on -// RouteAction_HashPolicy_CookieAttribute with the rules defined in the proto -// definition for this message. If any rules are violated, the result is a -// list of violation errors wrapped in -// RouteAction_HashPolicy_CookieAttributeMultiError, or nil if none found. -func (m *RouteAction_HashPolicy_CookieAttribute) ValidateAll() error { - return m.validate(true) -} - -func (m *RouteAction_HashPolicy_CookieAttribute) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := RouteAction_HashPolicy_CookieAttributeValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(m.GetName()) > 16384 { - err := RouteAction_HashPolicy_CookieAttributeValidationError{ - field: "Name", - reason: "value length must be at most 16384 bytes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_RouteAction_HashPolicy_CookieAttribute_Name_Pattern.MatchString(m.GetName()) { - err := RouteAction_HashPolicy_CookieAttributeValidationError{ - field: "Name", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(m.GetValue()) > 16384 { - err := RouteAction_HashPolicy_CookieAttributeValidationError{ - field: "Value", - reason: "value length must be at most 16384 bytes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_RouteAction_HashPolicy_CookieAttribute_Value_Pattern.MatchString(m.GetValue()) { - err := RouteAction_HashPolicy_CookieAttributeValidationError{ - field: "Value", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return RouteAction_HashPolicy_CookieAttributeMultiError(errors) - } - - return nil -} - -// RouteAction_HashPolicy_CookieAttributeMultiError is an error wrapping -// multiple validation errors returned by -// RouteAction_HashPolicy_CookieAttribute.ValidateAll() if the designated -// constraints aren't met. -type RouteAction_HashPolicy_CookieAttributeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RouteAction_HashPolicy_CookieAttributeMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RouteAction_HashPolicy_CookieAttributeMultiError) AllErrors() []error { return m } - -// RouteAction_HashPolicy_CookieAttributeValidationError is the validation -// error returned by RouteAction_HashPolicy_CookieAttribute.Validate if the -// designated constraints aren't met. -type RouteAction_HashPolicy_CookieAttributeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RouteAction_HashPolicy_CookieAttributeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RouteAction_HashPolicy_CookieAttributeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RouteAction_HashPolicy_CookieAttributeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RouteAction_HashPolicy_CookieAttributeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RouteAction_HashPolicy_CookieAttributeValidationError) ErrorName() string { - return "RouteAction_HashPolicy_CookieAttributeValidationError" -} - -// Error satisfies the builtin error interface -func (e RouteAction_HashPolicy_CookieAttributeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRouteAction_HashPolicy_CookieAttribute.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RouteAction_HashPolicy_CookieAttributeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RouteAction_HashPolicy_CookieAttributeValidationError{} - -var _RouteAction_HashPolicy_CookieAttribute_Name_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -var _RouteAction_HashPolicy_CookieAttribute_Value_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -// Validate checks the field values on RouteAction_HashPolicy_Cookie with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RouteAction_HashPolicy_Cookie) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RouteAction_HashPolicy_Cookie with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// RouteAction_HashPolicy_CookieMultiError, or nil if none found. -func (m *RouteAction_HashPolicy_Cookie) ValidateAll() error { - return m.validate(true) -} - -func (m *RouteAction_HashPolicy_Cookie) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := RouteAction_HashPolicy_CookieValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetTtl()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteAction_HashPolicy_CookieValidationError{ - field: "Ttl", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteAction_HashPolicy_CookieValidationError{ - field: "Ttl", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTtl()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteAction_HashPolicy_CookieValidationError{ - field: "Ttl", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for Path - - for idx, item := range m.GetAttributes() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteAction_HashPolicy_CookieValidationError{ - field: fmt.Sprintf("Attributes[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteAction_HashPolicy_CookieValidationError{ - field: fmt.Sprintf("Attributes[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteAction_HashPolicy_CookieValidationError{ - field: fmt.Sprintf("Attributes[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return RouteAction_HashPolicy_CookieMultiError(errors) - } - - return nil -} - -// RouteAction_HashPolicy_CookieMultiError is an error wrapping multiple -// validation errors returned by RouteAction_HashPolicy_Cookie.ValidateAll() -// if the designated constraints aren't met. -type RouteAction_HashPolicy_CookieMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RouteAction_HashPolicy_CookieMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RouteAction_HashPolicy_CookieMultiError) AllErrors() []error { return m } - -// RouteAction_HashPolicy_CookieValidationError is the validation error -// returned by RouteAction_HashPolicy_Cookie.Validate if the designated -// constraints aren't met. -type RouteAction_HashPolicy_CookieValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RouteAction_HashPolicy_CookieValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RouteAction_HashPolicy_CookieValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RouteAction_HashPolicy_CookieValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RouteAction_HashPolicy_CookieValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RouteAction_HashPolicy_CookieValidationError) ErrorName() string { - return "RouteAction_HashPolicy_CookieValidationError" -} - -// Error satisfies the builtin error interface -func (e RouteAction_HashPolicy_CookieValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRouteAction_HashPolicy_Cookie.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RouteAction_HashPolicy_CookieValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RouteAction_HashPolicy_CookieValidationError{} - -// Validate checks the field values on -// RouteAction_HashPolicy_ConnectionProperties with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *RouteAction_HashPolicy_ConnectionProperties) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on -// RouteAction_HashPolicy_ConnectionProperties with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in -// RouteAction_HashPolicy_ConnectionPropertiesMultiError, or nil if none found. -func (m *RouteAction_HashPolicy_ConnectionProperties) ValidateAll() error { - return m.validate(true) -} - -func (m *RouteAction_HashPolicy_ConnectionProperties) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for SourceIp - - if len(errors) > 0 { - return RouteAction_HashPolicy_ConnectionPropertiesMultiError(errors) - } - - return nil -} - -// RouteAction_HashPolicy_ConnectionPropertiesMultiError is an error wrapping -// multiple validation errors returned by -// RouteAction_HashPolicy_ConnectionProperties.ValidateAll() if the designated -// constraints aren't met. -type RouteAction_HashPolicy_ConnectionPropertiesMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RouteAction_HashPolicy_ConnectionPropertiesMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RouteAction_HashPolicy_ConnectionPropertiesMultiError) AllErrors() []error { return m } - -// RouteAction_HashPolicy_ConnectionPropertiesValidationError is the validation -// error returned by RouteAction_HashPolicy_ConnectionProperties.Validate if -// the designated constraints aren't met. -type RouteAction_HashPolicy_ConnectionPropertiesValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) ErrorName() string { - return "RouteAction_HashPolicy_ConnectionPropertiesValidationError" -} - -// Error satisfies the builtin error interface -func (e RouteAction_HashPolicy_ConnectionPropertiesValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRouteAction_HashPolicy_ConnectionProperties.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RouteAction_HashPolicy_ConnectionPropertiesValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RouteAction_HashPolicy_ConnectionPropertiesValidationError{} - -// Validate checks the field values on RouteAction_HashPolicy_QueryParameter -// with the rules defined in the proto definition for this message. If any -// rules are violated, the first error encountered is returned, or nil if -// there are no violations. -func (m *RouteAction_HashPolicy_QueryParameter) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RouteAction_HashPolicy_QueryParameter -// with the rules defined in the proto definition for this message. If any -// rules are violated, the result is a list of violation errors wrapped in -// RouteAction_HashPolicy_QueryParameterMultiError, or nil if none found. -func (m *RouteAction_HashPolicy_QueryParameter) ValidateAll() error { - return m.validate(true) -} - -func (m *RouteAction_HashPolicy_QueryParameter) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := RouteAction_HashPolicy_QueryParameterValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return RouteAction_HashPolicy_QueryParameterMultiError(errors) - } - - return nil -} - -// RouteAction_HashPolicy_QueryParameterMultiError is an error wrapping -// multiple validation errors returned by -// RouteAction_HashPolicy_QueryParameter.ValidateAll() if the designated -// constraints aren't met. -type RouteAction_HashPolicy_QueryParameterMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RouteAction_HashPolicy_QueryParameterMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RouteAction_HashPolicy_QueryParameterMultiError) AllErrors() []error { return m } - -// RouteAction_HashPolicy_QueryParameterValidationError is the validation error -// returned by RouteAction_HashPolicy_QueryParameter.Validate if the -// designated constraints aren't met. -type RouteAction_HashPolicy_QueryParameterValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RouteAction_HashPolicy_QueryParameterValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RouteAction_HashPolicy_QueryParameterValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RouteAction_HashPolicy_QueryParameterValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RouteAction_HashPolicy_QueryParameterValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RouteAction_HashPolicy_QueryParameterValidationError) ErrorName() string { - return "RouteAction_HashPolicy_QueryParameterValidationError" -} - -// Error satisfies the builtin error interface -func (e RouteAction_HashPolicy_QueryParameterValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRouteAction_HashPolicy_QueryParameter.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RouteAction_HashPolicy_QueryParameterValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RouteAction_HashPolicy_QueryParameterValidationError{} - -// Validate checks the field values on RouteAction_HashPolicy_FilterState with -// the rules defined in the proto definition for this message. If any rules -// are violated, the first error encountered is returned, or nil if there are -// no violations. -func (m *RouteAction_HashPolicy_FilterState) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RouteAction_HashPolicy_FilterState -// with the rules defined in the proto definition for this message. If any -// rules are violated, the result is a list of violation errors wrapped in -// RouteAction_HashPolicy_FilterStateMultiError, or nil if none found. -func (m *RouteAction_HashPolicy_FilterState) ValidateAll() error { - return m.validate(true) -} - -func (m *RouteAction_HashPolicy_FilterState) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetKey()) < 1 { - err := RouteAction_HashPolicy_FilterStateValidationError{ - field: "Key", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return RouteAction_HashPolicy_FilterStateMultiError(errors) - } - - return nil -} - -// RouteAction_HashPolicy_FilterStateMultiError is an error wrapping multiple -// validation errors returned by -// RouteAction_HashPolicy_FilterState.ValidateAll() if the designated -// constraints aren't met. -type RouteAction_HashPolicy_FilterStateMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RouteAction_HashPolicy_FilterStateMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RouteAction_HashPolicy_FilterStateMultiError) AllErrors() []error { return m } - -// RouteAction_HashPolicy_FilterStateValidationError is the validation error -// returned by RouteAction_HashPolicy_FilterState.Validate if the designated -// constraints aren't met. -type RouteAction_HashPolicy_FilterStateValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RouteAction_HashPolicy_FilterStateValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RouteAction_HashPolicy_FilterStateValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RouteAction_HashPolicy_FilterStateValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RouteAction_HashPolicy_FilterStateValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RouteAction_HashPolicy_FilterStateValidationError) ErrorName() string { - return "RouteAction_HashPolicy_FilterStateValidationError" -} - -// Error satisfies the builtin error interface -func (e RouteAction_HashPolicy_FilterStateValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRouteAction_HashPolicy_FilterState.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RouteAction_HashPolicy_FilterStateValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RouteAction_HashPolicy_FilterStateValidationError{} - -// Validate checks the field values on RouteAction_UpgradeConfig_ConnectConfig -// with the rules defined in the proto definition for this message. If any -// rules are violated, the first error encountered is returned, or nil if -// there are no violations. -func (m *RouteAction_UpgradeConfig_ConnectConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on -// RouteAction_UpgradeConfig_ConnectConfig with the rules defined in the proto -// definition for this message. If any rules are violated, the result is a -// list of violation errors wrapped in -// RouteAction_UpgradeConfig_ConnectConfigMultiError, or nil if none found. -func (m *RouteAction_UpgradeConfig_ConnectConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *RouteAction_UpgradeConfig_ConnectConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetProxyProtocolConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RouteAction_UpgradeConfig_ConnectConfigValidationError{ - field: "ProxyProtocolConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RouteAction_UpgradeConfig_ConnectConfigValidationError{ - field: "ProxyProtocolConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetProxyProtocolConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RouteAction_UpgradeConfig_ConnectConfigValidationError{ - field: "ProxyProtocolConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for AllowPost - - if len(errors) > 0 { - return RouteAction_UpgradeConfig_ConnectConfigMultiError(errors) - } - - return nil -} - -// RouteAction_UpgradeConfig_ConnectConfigMultiError is an error wrapping -// multiple validation errors returned by -// RouteAction_UpgradeConfig_ConnectConfig.ValidateAll() if the designated -// constraints aren't met. -type RouteAction_UpgradeConfig_ConnectConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RouteAction_UpgradeConfig_ConnectConfigMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RouteAction_UpgradeConfig_ConnectConfigMultiError) AllErrors() []error { return m } - -// RouteAction_UpgradeConfig_ConnectConfigValidationError is the validation -// error returned by RouteAction_UpgradeConfig_ConnectConfig.Validate if the -// designated constraints aren't met. -type RouteAction_UpgradeConfig_ConnectConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RouteAction_UpgradeConfig_ConnectConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RouteAction_UpgradeConfig_ConnectConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RouteAction_UpgradeConfig_ConnectConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RouteAction_UpgradeConfig_ConnectConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RouteAction_UpgradeConfig_ConnectConfigValidationError) ErrorName() string { - return "RouteAction_UpgradeConfig_ConnectConfigValidationError" -} - -// Error satisfies the builtin error interface -func (e RouteAction_UpgradeConfig_ConnectConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRouteAction_UpgradeConfig_ConnectConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RouteAction_UpgradeConfig_ConnectConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RouteAction_UpgradeConfig_ConnectConfigValidationError{} - -// Validate checks the field values on RetryPolicy_RetryPriority with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RetryPolicy_RetryPriority) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RetryPolicy_RetryPriority with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RetryPolicy_RetryPriorityMultiError, or nil if none found. -func (m *RetryPolicy_RetryPriority) ValidateAll() error { - return m.validate(true) -} - -func (m *RetryPolicy_RetryPriority) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := RetryPolicy_RetryPriorityValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - switch v := m.ConfigType.(type) { - case *RetryPolicy_RetryPriority_TypedConfig: - if v == nil { - err := RetryPolicy_RetryPriorityValidationError{ - field: "ConfigType", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetTypedConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RetryPolicy_RetryPriorityValidationError{ - field: "TypedConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RetryPolicy_RetryPriorityValidationError{ - field: "TypedConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RetryPolicy_RetryPriorityValidationError{ - field: "TypedConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return RetryPolicy_RetryPriorityMultiError(errors) - } - - return nil -} - -// RetryPolicy_RetryPriorityMultiError is an error wrapping multiple validation -// errors returned by RetryPolicy_RetryPriority.ValidateAll() if the -// designated constraints aren't met. -type RetryPolicy_RetryPriorityMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RetryPolicy_RetryPriorityMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RetryPolicy_RetryPriorityMultiError) AllErrors() []error { return m } - -// RetryPolicy_RetryPriorityValidationError is the validation error returned by -// RetryPolicy_RetryPriority.Validate if the designated constraints aren't met. -type RetryPolicy_RetryPriorityValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RetryPolicy_RetryPriorityValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RetryPolicy_RetryPriorityValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RetryPolicy_RetryPriorityValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RetryPolicy_RetryPriorityValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RetryPolicy_RetryPriorityValidationError) ErrorName() string { - return "RetryPolicy_RetryPriorityValidationError" -} - -// Error satisfies the builtin error interface -func (e RetryPolicy_RetryPriorityValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRetryPolicy_RetryPriority.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RetryPolicy_RetryPriorityValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RetryPolicy_RetryPriorityValidationError{} - -// Validate checks the field values on RetryPolicy_RetryHostPredicate with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RetryPolicy_RetryHostPredicate) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RetryPolicy_RetryHostPredicate with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// RetryPolicy_RetryHostPredicateMultiError, or nil if none found. -func (m *RetryPolicy_RetryHostPredicate) ValidateAll() error { - return m.validate(true) -} - -func (m *RetryPolicy_RetryHostPredicate) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := RetryPolicy_RetryHostPredicateValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - switch v := m.ConfigType.(type) { - case *RetryPolicy_RetryHostPredicate_TypedConfig: - if v == nil { - err := RetryPolicy_RetryHostPredicateValidationError{ - field: "ConfigType", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetTypedConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RetryPolicy_RetryHostPredicateValidationError{ - field: "TypedConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RetryPolicy_RetryHostPredicateValidationError{ - field: "TypedConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RetryPolicy_RetryHostPredicateValidationError{ - field: "TypedConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return RetryPolicy_RetryHostPredicateMultiError(errors) - } - - return nil -} - -// RetryPolicy_RetryHostPredicateMultiError is an error wrapping multiple -// validation errors returned by RetryPolicy_RetryHostPredicate.ValidateAll() -// if the designated constraints aren't met. -type RetryPolicy_RetryHostPredicateMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RetryPolicy_RetryHostPredicateMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RetryPolicy_RetryHostPredicateMultiError) AllErrors() []error { return m } - -// RetryPolicy_RetryHostPredicateValidationError is the validation error -// returned by RetryPolicy_RetryHostPredicate.Validate if the designated -// constraints aren't met. -type RetryPolicy_RetryHostPredicateValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RetryPolicy_RetryHostPredicateValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RetryPolicy_RetryHostPredicateValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RetryPolicy_RetryHostPredicateValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RetryPolicy_RetryHostPredicateValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RetryPolicy_RetryHostPredicateValidationError) ErrorName() string { - return "RetryPolicy_RetryHostPredicateValidationError" -} - -// Error satisfies the builtin error interface -func (e RetryPolicy_RetryHostPredicateValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRetryPolicy_RetryHostPredicate.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RetryPolicy_RetryHostPredicateValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RetryPolicy_RetryHostPredicateValidationError{} - -// Validate checks the field values on RetryPolicy_RetryBackOff with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RetryPolicy_RetryBackOff) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RetryPolicy_RetryBackOff with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RetryPolicy_RetryBackOffMultiError, or nil if none found. -func (m *RetryPolicy_RetryBackOff) ValidateAll() error { - return m.validate(true) -} - -func (m *RetryPolicy_RetryBackOff) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetBaseInterval() == nil { - err := RetryPolicy_RetryBackOffValidationError{ - field: "BaseInterval", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if d := m.GetBaseInterval(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = RetryPolicy_RetryBackOffValidationError{ - field: "BaseInterval", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - gt := time.Duration(0*time.Second + 0*time.Nanosecond) - - if dur <= gt { - err := RetryPolicy_RetryBackOffValidationError{ - field: "BaseInterval", - reason: "value must be greater than 0s", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if d := m.GetMaxInterval(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = RetryPolicy_RetryBackOffValidationError{ - field: "MaxInterval", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - gt := time.Duration(0*time.Second + 0*time.Nanosecond) - - if dur <= gt { - err := RetryPolicy_RetryBackOffValidationError{ - field: "MaxInterval", - reason: "value must be greater than 0s", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if len(errors) > 0 { - return RetryPolicy_RetryBackOffMultiError(errors) - } - - return nil -} - -// RetryPolicy_RetryBackOffMultiError is an error wrapping multiple validation -// errors returned by RetryPolicy_RetryBackOff.ValidateAll() if the designated -// constraints aren't met. -type RetryPolicy_RetryBackOffMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RetryPolicy_RetryBackOffMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RetryPolicy_RetryBackOffMultiError) AllErrors() []error { return m } - -// RetryPolicy_RetryBackOffValidationError is the validation error returned by -// RetryPolicy_RetryBackOff.Validate if the designated constraints aren't met. -type RetryPolicy_RetryBackOffValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RetryPolicy_RetryBackOffValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RetryPolicy_RetryBackOffValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RetryPolicy_RetryBackOffValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RetryPolicy_RetryBackOffValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RetryPolicy_RetryBackOffValidationError) ErrorName() string { - return "RetryPolicy_RetryBackOffValidationError" -} - -// Error satisfies the builtin error interface -func (e RetryPolicy_RetryBackOffValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRetryPolicy_RetryBackOff.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RetryPolicy_RetryBackOffValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RetryPolicy_RetryBackOffValidationError{} - -// Validate checks the field values on RetryPolicy_ResetHeader with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RetryPolicy_ResetHeader) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RetryPolicy_ResetHeader with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RetryPolicy_ResetHeaderMultiError, or nil if none found. -func (m *RetryPolicy_ResetHeader) ValidateAll() error { - return m.validate(true) -} - -func (m *RetryPolicy_ResetHeader) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := RetryPolicy_ResetHeaderValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_RetryPolicy_ResetHeader_Name_Pattern.MatchString(m.GetName()) { - err := RetryPolicy_ResetHeaderValidationError{ - field: "Name", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - if _, ok := RetryPolicy_ResetHeaderFormat_name[int32(m.GetFormat())]; !ok { - err := RetryPolicy_ResetHeaderValidationError{ - field: "Format", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return RetryPolicy_ResetHeaderMultiError(errors) - } - - return nil -} - -// RetryPolicy_ResetHeaderMultiError is an error wrapping multiple validation -// errors returned by RetryPolicy_ResetHeader.ValidateAll() if the designated -// constraints aren't met. -type RetryPolicy_ResetHeaderMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RetryPolicy_ResetHeaderMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RetryPolicy_ResetHeaderMultiError) AllErrors() []error { return m } - -// RetryPolicy_ResetHeaderValidationError is the validation error returned by -// RetryPolicy_ResetHeader.Validate if the designated constraints aren't met. -type RetryPolicy_ResetHeaderValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RetryPolicy_ResetHeaderValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RetryPolicy_ResetHeaderValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RetryPolicy_ResetHeaderValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RetryPolicy_ResetHeaderValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RetryPolicy_ResetHeaderValidationError) ErrorName() string { - return "RetryPolicy_ResetHeaderValidationError" -} - -// Error satisfies the builtin error interface -func (e RetryPolicy_ResetHeaderValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRetryPolicy_ResetHeader.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RetryPolicy_ResetHeaderValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RetryPolicy_ResetHeaderValidationError{} - -var _RetryPolicy_ResetHeader_Name_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -// Validate checks the field values on RetryPolicy_RateLimitedRetryBackOff with -// the rules defined in the proto definition for this message. If any rules -// are violated, the first error encountered is returned, or nil if there are -// no violations. -func (m *RetryPolicy_RateLimitedRetryBackOff) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RetryPolicy_RateLimitedRetryBackOff -// with the rules defined in the proto definition for this message. If any -// rules are violated, the result is a list of violation errors wrapped in -// RetryPolicy_RateLimitedRetryBackOffMultiError, or nil if none found. -func (m *RetryPolicy_RateLimitedRetryBackOff) ValidateAll() error { - return m.validate(true) -} - -func (m *RetryPolicy_RateLimitedRetryBackOff) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(m.GetResetHeaders()) < 1 { - err := RetryPolicy_RateLimitedRetryBackOffValidationError{ - field: "ResetHeaders", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetResetHeaders() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RetryPolicy_RateLimitedRetryBackOffValidationError{ - field: fmt.Sprintf("ResetHeaders[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RetryPolicy_RateLimitedRetryBackOffValidationError{ - field: fmt.Sprintf("ResetHeaders[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RetryPolicy_RateLimitedRetryBackOffValidationError{ - field: fmt.Sprintf("ResetHeaders[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if d := m.GetMaxInterval(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = RetryPolicy_RateLimitedRetryBackOffValidationError{ - field: "MaxInterval", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - gt := time.Duration(0*time.Second + 0*time.Nanosecond) - - if dur <= gt { - err := RetryPolicy_RateLimitedRetryBackOffValidationError{ - field: "MaxInterval", - reason: "value must be greater than 0s", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if len(errors) > 0 { - return RetryPolicy_RateLimitedRetryBackOffMultiError(errors) - } - - return nil -} - -// RetryPolicy_RateLimitedRetryBackOffMultiError is an error wrapping multiple -// validation errors returned by -// RetryPolicy_RateLimitedRetryBackOff.ValidateAll() if the designated -// constraints aren't met. -type RetryPolicy_RateLimitedRetryBackOffMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RetryPolicy_RateLimitedRetryBackOffMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RetryPolicy_RateLimitedRetryBackOffMultiError) AllErrors() []error { return m } - -// RetryPolicy_RateLimitedRetryBackOffValidationError is the validation error -// returned by RetryPolicy_RateLimitedRetryBackOff.Validate if the designated -// constraints aren't met. -type RetryPolicy_RateLimitedRetryBackOffValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RetryPolicy_RateLimitedRetryBackOffValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RetryPolicy_RateLimitedRetryBackOffValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RetryPolicy_RateLimitedRetryBackOffValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RetryPolicy_RateLimitedRetryBackOffValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RetryPolicy_RateLimitedRetryBackOffValidationError) ErrorName() string { - return "RetryPolicy_RateLimitedRetryBackOffValidationError" -} - -// Error satisfies the builtin error interface -func (e RetryPolicy_RateLimitedRetryBackOffValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRetryPolicy_RateLimitedRetryBackOff.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RetryPolicy_RateLimitedRetryBackOffValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RetryPolicy_RateLimitedRetryBackOffValidationError{} - -// Validate checks the field values on RateLimit_Action with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *RateLimit_Action) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RateLimit_Action with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RateLimit_ActionMultiError, or nil if none found. -func (m *RateLimit_Action) ValidateAll() error { - return m.validate(true) -} - -func (m *RateLimit_Action) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofActionSpecifierPresent := false - switch v := m.ActionSpecifier.(type) { - case *RateLimit_Action_SourceCluster_: - if v == nil { - err := RateLimit_ActionValidationError{ - field: "ActionSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofActionSpecifierPresent = true - - if all { - switch v := interface{}(m.GetSourceCluster()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RateLimit_ActionValidationError{ - field: "SourceCluster", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RateLimit_ActionValidationError{ - field: "SourceCluster", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSourceCluster()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RateLimit_ActionValidationError{ - field: "SourceCluster", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *RateLimit_Action_DestinationCluster_: - if v == nil { - err := RateLimit_ActionValidationError{ - field: "ActionSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofActionSpecifierPresent = true - - if all { - switch v := interface{}(m.GetDestinationCluster()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RateLimit_ActionValidationError{ - field: "DestinationCluster", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RateLimit_ActionValidationError{ - field: "DestinationCluster", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDestinationCluster()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RateLimit_ActionValidationError{ - field: "DestinationCluster", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *RateLimit_Action_RequestHeaders_: - if v == nil { - err := RateLimit_ActionValidationError{ - field: "ActionSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofActionSpecifierPresent = true - - if all { - switch v := interface{}(m.GetRequestHeaders()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RateLimit_ActionValidationError{ - field: "RequestHeaders", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RateLimit_ActionValidationError{ - field: "RequestHeaders", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRequestHeaders()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RateLimit_ActionValidationError{ - field: "RequestHeaders", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *RateLimit_Action_RemoteAddress_: - if v == nil { - err := RateLimit_ActionValidationError{ - field: "ActionSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofActionSpecifierPresent = true - - if all { - switch v := interface{}(m.GetRemoteAddress()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RateLimit_ActionValidationError{ - field: "RemoteAddress", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RateLimit_ActionValidationError{ - field: "RemoteAddress", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRemoteAddress()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RateLimit_ActionValidationError{ - field: "RemoteAddress", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *RateLimit_Action_GenericKey_: - if v == nil { - err := RateLimit_ActionValidationError{ - field: "ActionSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofActionSpecifierPresent = true - - if all { - switch v := interface{}(m.GetGenericKey()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RateLimit_ActionValidationError{ - field: "GenericKey", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RateLimit_ActionValidationError{ - field: "GenericKey", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetGenericKey()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RateLimit_ActionValidationError{ - field: "GenericKey", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *RateLimit_Action_HeaderValueMatch_: - if v == nil { - err := RateLimit_ActionValidationError{ - field: "ActionSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofActionSpecifierPresent = true - - if all { - switch v := interface{}(m.GetHeaderValueMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RateLimit_ActionValidationError{ - field: "HeaderValueMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RateLimit_ActionValidationError{ - field: "HeaderValueMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHeaderValueMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RateLimit_ActionValidationError{ - field: "HeaderValueMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *RateLimit_Action_DynamicMetadata: - if v == nil { - err := RateLimit_ActionValidationError{ - field: "ActionSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofActionSpecifierPresent = true - - if all { - switch v := interface{}(m.GetDynamicMetadata()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RateLimit_ActionValidationError{ - field: "DynamicMetadata", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RateLimit_ActionValidationError{ - field: "DynamicMetadata", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDynamicMetadata()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RateLimit_ActionValidationError{ - field: "DynamicMetadata", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *RateLimit_Action_Metadata: - if v == nil { - err := RateLimit_ActionValidationError{ - field: "ActionSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofActionSpecifierPresent = true - - if all { - switch v := interface{}(m.GetMetadata()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RateLimit_ActionValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RateLimit_ActionValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RateLimit_ActionValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *RateLimit_Action_Extension: - if v == nil { - err := RateLimit_ActionValidationError{ - field: "ActionSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofActionSpecifierPresent = true - - if all { - switch v := interface{}(m.GetExtension()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RateLimit_ActionValidationError{ - field: "Extension", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RateLimit_ActionValidationError{ - field: "Extension", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetExtension()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RateLimit_ActionValidationError{ - field: "Extension", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *RateLimit_Action_MaskedRemoteAddress_: - if v == nil { - err := RateLimit_ActionValidationError{ - field: "ActionSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofActionSpecifierPresent = true - - if all { - switch v := interface{}(m.GetMaskedRemoteAddress()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RateLimit_ActionValidationError{ - field: "MaskedRemoteAddress", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RateLimit_ActionValidationError{ - field: "MaskedRemoteAddress", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMaskedRemoteAddress()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RateLimit_ActionValidationError{ - field: "MaskedRemoteAddress", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *RateLimit_Action_QueryParameterValueMatch_: - if v == nil { - err := RateLimit_ActionValidationError{ - field: "ActionSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofActionSpecifierPresent = true - - if all { - switch v := interface{}(m.GetQueryParameterValueMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RateLimit_ActionValidationError{ - field: "QueryParameterValueMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RateLimit_ActionValidationError{ - field: "QueryParameterValueMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetQueryParameterValueMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RateLimit_ActionValidationError{ - field: "QueryParameterValueMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofActionSpecifierPresent { - err := RateLimit_ActionValidationError{ - field: "ActionSpecifier", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return RateLimit_ActionMultiError(errors) - } - - return nil -} - -// RateLimit_ActionMultiError is an error wrapping multiple validation errors -// returned by RateLimit_Action.ValidateAll() if the designated constraints -// aren't met. -type RateLimit_ActionMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RateLimit_ActionMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RateLimit_ActionMultiError) AllErrors() []error { return m } - -// RateLimit_ActionValidationError is the validation error returned by -// RateLimit_Action.Validate if the designated constraints aren't met. -type RateLimit_ActionValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RateLimit_ActionValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RateLimit_ActionValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RateLimit_ActionValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RateLimit_ActionValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RateLimit_ActionValidationError) ErrorName() string { return "RateLimit_ActionValidationError" } - -// Error satisfies the builtin error interface -func (e RateLimit_ActionValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRateLimit_Action.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RateLimit_ActionValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RateLimit_ActionValidationError{} - -// Validate checks the field values on RateLimit_Override with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RateLimit_Override) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RateLimit_Override with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RateLimit_OverrideMultiError, or nil if none found. -func (m *RateLimit_Override) ValidateAll() error { - return m.validate(true) -} - -func (m *RateLimit_Override) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofOverrideSpecifierPresent := false - switch v := m.OverrideSpecifier.(type) { - case *RateLimit_Override_DynamicMetadata_: - if v == nil { - err := RateLimit_OverrideValidationError{ - field: "OverrideSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofOverrideSpecifierPresent = true - - if all { - switch v := interface{}(m.GetDynamicMetadata()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RateLimit_OverrideValidationError{ - field: "DynamicMetadata", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RateLimit_OverrideValidationError{ - field: "DynamicMetadata", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDynamicMetadata()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RateLimit_OverrideValidationError{ - field: "DynamicMetadata", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofOverrideSpecifierPresent { - err := RateLimit_OverrideValidationError{ - field: "OverrideSpecifier", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return RateLimit_OverrideMultiError(errors) - } - - return nil -} - -// RateLimit_OverrideMultiError is an error wrapping multiple validation errors -// returned by RateLimit_Override.ValidateAll() if the designated constraints -// aren't met. -type RateLimit_OverrideMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RateLimit_OverrideMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RateLimit_OverrideMultiError) AllErrors() []error { return m } - -// RateLimit_OverrideValidationError is the validation error returned by -// RateLimit_Override.Validate if the designated constraints aren't met. -type RateLimit_OverrideValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RateLimit_OverrideValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RateLimit_OverrideValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RateLimit_OverrideValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RateLimit_OverrideValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RateLimit_OverrideValidationError) ErrorName() string { - return "RateLimit_OverrideValidationError" -} - -// Error satisfies the builtin error interface -func (e RateLimit_OverrideValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRateLimit_Override.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RateLimit_OverrideValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RateLimit_OverrideValidationError{} - -// Validate checks the field values on RateLimit_Action_SourceCluster with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RateLimit_Action_SourceCluster) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RateLimit_Action_SourceCluster with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// RateLimit_Action_SourceClusterMultiError, or nil if none found. -func (m *RateLimit_Action_SourceCluster) ValidateAll() error { - return m.validate(true) -} - -func (m *RateLimit_Action_SourceCluster) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return RateLimit_Action_SourceClusterMultiError(errors) - } - - return nil -} - -// RateLimit_Action_SourceClusterMultiError is an error wrapping multiple -// validation errors returned by RateLimit_Action_SourceCluster.ValidateAll() -// if the designated constraints aren't met. -type RateLimit_Action_SourceClusterMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RateLimit_Action_SourceClusterMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RateLimit_Action_SourceClusterMultiError) AllErrors() []error { return m } - -// RateLimit_Action_SourceClusterValidationError is the validation error -// returned by RateLimit_Action_SourceCluster.Validate if the designated -// constraints aren't met. -type RateLimit_Action_SourceClusterValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RateLimit_Action_SourceClusterValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RateLimit_Action_SourceClusterValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RateLimit_Action_SourceClusterValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RateLimit_Action_SourceClusterValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RateLimit_Action_SourceClusterValidationError) ErrorName() string { - return "RateLimit_Action_SourceClusterValidationError" -} - -// Error satisfies the builtin error interface -func (e RateLimit_Action_SourceClusterValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRateLimit_Action_SourceCluster.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RateLimit_Action_SourceClusterValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RateLimit_Action_SourceClusterValidationError{} - -// Validate checks the field values on RateLimit_Action_DestinationCluster with -// the rules defined in the proto definition for this message. If any rules -// are violated, the first error encountered is returned, or nil if there are -// no violations. -func (m *RateLimit_Action_DestinationCluster) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RateLimit_Action_DestinationCluster -// with the rules defined in the proto definition for this message. If any -// rules are violated, the result is a list of violation errors wrapped in -// RateLimit_Action_DestinationClusterMultiError, or nil if none found. -func (m *RateLimit_Action_DestinationCluster) ValidateAll() error { - return m.validate(true) -} - -func (m *RateLimit_Action_DestinationCluster) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return RateLimit_Action_DestinationClusterMultiError(errors) - } - - return nil -} - -// RateLimit_Action_DestinationClusterMultiError is an error wrapping multiple -// validation errors returned by -// RateLimit_Action_DestinationCluster.ValidateAll() if the designated -// constraints aren't met. -type RateLimit_Action_DestinationClusterMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RateLimit_Action_DestinationClusterMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RateLimit_Action_DestinationClusterMultiError) AllErrors() []error { return m } - -// RateLimit_Action_DestinationClusterValidationError is the validation error -// returned by RateLimit_Action_DestinationCluster.Validate if the designated -// constraints aren't met. -type RateLimit_Action_DestinationClusterValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RateLimit_Action_DestinationClusterValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RateLimit_Action_DestinationClusterValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RateLimit_Action_DestinationClusterValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RateLimit_Action_DestinationClusterValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RateLimit_Action_DestinationClusterValidationError) ErrorName() string { - return "RateLimit_Action_DestinationClusterValidationError" -} - -// Error satisfies the builtin error interface -func (e RateLimit_Action_DestinationClusterValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRateLimit_Action_DestinationCluster.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RateLimit_Action_DestinationClusterValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RateLimit_Action_DestinationClusterValidationError{} - -// Validate checks the field values on RateLimit_Action_RequestHeaders with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RateLimit_Action_RequestHeaders) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RateLimit_Action_RequestHeaders with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// RateLimit_Action_RequestHeadersMultiError, or nil if none found. -func (m *RateLimit_Action_RequestHeaders) ValidateAll() error { - return m.validate(true) -} - -func (m *RateLimit_Action_RequestHeaders) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetHeaderName()) < 1 { - err := RateLimit_Action_RequestHeadersValidationError{ - field: "HeaderName", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_RateLimit_Action_RequestHeaders_HeaderName_Pattern.MatchString(m.GetHeaderName()) { - err := RateLimit_Action_RequestHeadersValidationError{ - field: "HeaderName", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - if utf8.RuneCountInString(m.GetDescriptorKey()) < 1 { - err := RateLimit_Action_RequestHeadersValidationError{ - field: "DescriptorKey", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for SkipIfAbsent - - if len(errors) > 0 { - return RateLimit_Action_RequestHeadersMultiError(errors) - } - - return nil -} - -// RateLimit_Action_RequestHeadersMultiError is an error wrapping multiple -// validation errors returned by RateLimit_Action_RequestHeaders.ValidateAll() -// if the designated constraints aren't met. -type RateLimit_Action_RequestHeadersMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RateLimit_Action_RequestHeadersMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RateLimit_Action_RequestHeadersMultiError) AllErrors() []error { return m } - -// RateLimit_Action_RequestHeadersValidationError is the validation error -// returned by RateLimit_Action_RequestHeaders.Validate if the designated -// constraints aren't met. -type RateLimit_Action_RequestHeadersValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RateLimit_Action_RequestHeadersValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RateLimit_Action_RequestHeadersValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RateLimit_Action_RequestHeadersValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RateLimit_Action_RequestHeadersValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RateLimit_Action_RequestHeadersValidationError) ErrorName() string { - return "RateLimit_Action_RequestHeadersValidationError" -} - -// Error satisfies the builtin error interface -func (e RateLimit_Action_RequestHeadersValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRateLimit_Action_RequestHeaders.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RateLimit_Action_RequestHeadersValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RateLimit_Action_RequestHeadersValidationError{} - -var _RateLimit_Action_RequestHeaders_HeaderName_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -// Validate checks the field values on RateLimit_Action_RemoteAddress with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RateLimit_Action_RemoteAddress) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RateLimit_Action_RemoteAddress with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// RateLimit_Action_RemoteAddressMultiError, or nil if none found. -func (m *RateLimit_Action_RemoteAddress) ValidateAll() error { - return m.validate(true) -} - -func (m *RateLimit_Action_RemoteAddress) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return RateLimit_Action_RemoteAddressMultiError(errors) - } - - return nil -} - -// RateLimit_Action_RemoteAddressMultiError is an error wrapping multiple -// validation errors returned by RateLimit_Action_RemoteAddress.ValidateAll() -// if the designated constraints aren't met. -type RateLimit_Action_RemoteAddressMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RateLimit_Action_RemoteAddressMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RateLimit_Action_RemoteAddressMultiError) AllErrors() []error { return m } - -// RateLimit_Action_RemoteAddressValidationError is the validation error -// returned by RateLimit_Action_RemoteAddress.Validate if the designated -// constraints aren't met. -type RateLimit_Action_RemoteAddressValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RateLimit_Action_RemoteAddressValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RateLimit_Action_RemoteAddressValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RateLimit_Action_RemoteAddressValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RateLimit_Action_RemoteAddressValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RateLimit_Action_RemoteAddressValidationError) ErrorName() string { - return "RateLimit_Action_RemoteAddressValidationError" -} - -// Error satisfies the builtin error interface -func (e RateLimit_Action_RemoteAddressValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRateLimit_Action_RemoteAddress.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RateLimit_Action_RemoteAddressValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RateLimit_Action_RemoteAddressValidationError{} - -// Validate checks the field values on RateLimit_Action_MaskedRemoteAddress -// with the rules defined in the proto definition for this message. If any -// rules are violated, the first error encountered is returned, or nil if -// there are no violations. -func (m *RateLimit_Action_MaskedRemoteAddress) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RateLimit_Action_MaskedRemoteAddress -// with the rules defined in the proto definition for this message. If any -// rules are violated, the result is a list of violation errors wrapped in -// RateLimit_Action_MaskedRemoteAddressMultiError, or nil if none found. -func (m *RateLimit_Action_MaskedRemoteAddress) ValidateAll() error { - return m.validate(true) -} - -func (m *RateLimit_Action_MaskedRemoteAddress) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if wrapper := m.GetV4PrefixMaskLen(); wrapper != nil { - - if wrapper.GetValue() > 32 { - err := RateLimit_Action_MaskedRemoteAddressValidationError{ - field: "V4PrefixMaskLen", - reason: "value must be less than or equal to 32", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if wrapper := m.GetV6PrefixMaskLen(); wrapper != nil { - - if wrapper.GetValue() > 128 { - err := RateLimit_Action_MaskedRemoteAddressValidationError{ - field: "V6PrefixMaskLen", - reason: "value must be less than or equal to 128", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if len(errors) > 0 { - return RateLimit_Action_MaskedRemoteAddressMultiError(errors) - } - - return nil -} - -// RateLimit_Action_MaskedRemoteAddressMultiError is an error wrapping multiple -// validation errors returned by -// RateLimit_Action_MaskedRemoteAddress.ValidateAll() if the designated -// constraints aren't met. -type RateLimit_Action_MaskedRemoteAddressMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RateLimit_Action_MaskedRemoteAddressMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RateLimit_Action_MaskedRemoteAddressMultiError) AllErrors() []error { return m } - -// RateLimit_Action_MaskedRemoteAddressValidationError is the validation error -// returned by RateLimit_Action_MaskedRemoteAddress.Validate if the designated -// constraints aren't met. -type RateLimit_Action_MaskedRemoteAddressValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RateLimit_Action_MaskedRemoteAddressValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RateLimit_Action_MaskedRemoteAddressValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RateLimit_Action_MaskedRemoteAddressValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RateLimit_Action_MaskedRemoteAddressValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RateLimit_Action_MaskedRemoteAddressValidationError) ErrorName() string { - return "RateLimit_Action_MaskedRemoteAddressValidationError" -} - -// Error satisfies the builtin error interface -func (e RateLimit_Action_MaskedRemoteAddressValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRateLimit_Action_MaskedRemoteAddress.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RateLimit_Action_MaskedRemoteAddressValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RateLimit_Action_MaskedRemoteAddressValidationError{} - -// Validate checks the field values on RateLimit_Action_GenericKey with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RateLimit_Action_GenericKey) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RateLimit_Action_GenericKey with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RateLimit_Action_GenericKeyMultiError, or nil if none found. -func (m *RateLimit_Action_GenericKey) ValidateAll() error { - return m.validate(true) -} - -func (m *RateLimit_Action_GenericKey) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetDescriptorValue()) < 1 { - err := RateLimit_Action_GenericKeyValidationError{ - field: "DescriptorValue", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for DescriptorKey - - if len(errors) > 0 { - return RateLimit_Action_GenericKeyMultiError(errors) - } - - return nil -} - -// RateLimit_Action_GenericKeyMultiError is an error wrapping multiple -// validation errors returned by RateLimit_Action_GenericKey.ValidateAll() if -// the designated constraints aren't met. -type RateLimit_Action_GenericKeyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RateLimit_Action_GenericKeyMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RateLimit_Action_GenericKeyMultiError) AllErrors() []error { return m } - -// RateLimit_Action_GenericKeyValidationError is the validation error returned -// by RateLimit_Action_GenericKey.Validate if the designated constraints -// aren't met. -type RateLimit_Action_GenericKeyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RateLimit_Action_GenericKeyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RateLimit_Action_GenericKeyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RateLimit_Action_GenericKeyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RateLimit_Action_GenericKeyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RateLimit_Action_GenericKeyValidationError) ErrorName() string { - return "RateLimit_Action_GenericKeyValidationError" -} - -// Error satisfies the builtin error interface -func (e RateLimit_Action_GenericKeyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRateLimit_Action_GenericKey.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RateLimit_Action_GenericKeyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RateLimit_Action_GenericKeyValidationError{} - -// Validate checks the field values on RateLimit_Action_HeaderValueMatch with -// the rules defined in the proto definition for this message. If any rules -// are violated, the first error encountered is returned, or nil if there are -// no violations. -func (m *RateLimit_Action_HeaderValueMatch) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RateLimit_Action_HeaderValueMatch -// with the rules defined in the proto definition for this message. If any -// rules are violated, the result is a list of violation errors wrapped in -// RateLimit_Action_HeaderValueMatchMultiError, or nil if none found. -func (m *RateLimit_Action_HeaderValueMatch) ValidateAll() error { - return m.validate(true) -} - -func (m *RateLimit_Action_HeaderValueMatch) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for DescriptorKey - - if utf8.RuneCountInString(m.GetDescriptorValue()) < 1 { - err := RateLimit_Action_HeaderValueMatchValidationError{ - field: "DescriptorValue", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetExpectMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RateLimit_Action_HeaderValueMatchValidationError{ - field: "ExpectMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RateLimit_Action_HeaderValueMatchValidationError{ - field: "ExpectMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetExpectMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RateLimit_Action_HeaderValueMatchValidationError{ - field: "ExpectMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(m.GetHeaders()) < 1 { - err := RateLimit_Action_HeaderValueMatchValidationError{ - field: "Headers", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetHeaders() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RateLimit_Action_HeaderValueMatchValidationError{ - field: fmt.Sprintf("Headers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RateLimit_Action_HeaderValueMatchValidationError{ - field: fmt.Sprintf("Headers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RateLimit_Action_HeaderValueMatchValidationError{ - field: fmt.Sprintf("Headers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return RateLimit_Action_HeaderValueMatchMultiError(errors) - } - - return nil -} - -// RateLimit_Action_HeaderValueMatchMultiError is an error wrapping multiple -// validation errors returned by -// RateLimit_Action_HeaderValueMatch.ValidateAll() if the designated -// constraints aren't met. -type RateLimit_Action_HeaderValueMatchMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RateLimit_Action_HeaderValueMatchMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RateLimit_Action_HeaderValueMatchMultiError) AllErrors() []error { return m } - -// RateLimit_Action_HeaderValueMatchValidationError is the validation error -// returned by RateLimit_Action_HeaderValueMatch.Validate if the designated -// constraints aren't met. -type RateLimit_Action_HeaderValueMatchValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RateLimit_Action_HeaderValueMatchValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RateLimit_Action_HeaderValueMatchValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RateLimit_Action_HeaderValueMatchValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RateLimit_Action_HeaderValueMatchValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RateLimit_Action_HeaderValueMatchValidationError) ErrorName() string { - return "RateLimit_Action_HeaderValueMatchValidationError" -} - -// Error satisfies the builtin error interface -func (e RateLimit_Action_HeaderValueMatchValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRateLimit_Action_HeaderValueMatch.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RateLimit_Action_HeaderValueMatchValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RateLimit_Action_HeaderValueMatchValidationError{} - -// Validate checks the field values on RateLimit_Action_DynamicMetaData with -// the rules defined in the proto definition for this message. If any rules -// are violated, the first error encountered is returned, or nil if there are -// no violations. -func (m *RateLimit_Action_DynamicMetaData) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RateLimit_Action_DynamicMetaData with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// RateLimit_Action_DynamicMetaDataMultiError, or nil if none found. -func (m *RateLimit_Action_DynamicMetaData) ValidateAll() error { - return m.validate(true) -} - -func (m *RateLimit_Action_DynamicMetaData) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetDescriptorKey()) < 1 { - err := RateLimit_Action_DynamicMetaDataValidationError{ - field: "DescriptorKey", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if m.GetMetadataKey() == nil { - err := RateLimit_Action_DynamicMetaDataValidationError{ - field: "MetadataKey", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetMetadataKey()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RateLimit_Action_DynamicMetaDataValidationError{ - field: "MetadataKey", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RateLimit_Action_DynamicMetaDataValidationError{ - field: "MetadataKey", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMetadataKey()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RateLimit_Action_DynamicMetaDataValidationError{ - field: "MetadataKey", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for DefaultValue - - if len(errors) > 0 { - return RateLimit_Action_DynamicMetaDataMultiError(errors) - } - - return nil -} - -// RateLimit_Action_DynamicMetaDataMultiError is an error wrapping multiple -// validation errors returned by -// RateLimit_Action_DynamicMetaData.ValidateAll() if the designated -// constraints aren't met. -type RateLimit_Action_DynamicMetaDataMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RateLimit_Action_DynamicMetaDataMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RateLimit_Action_DynamicMetaDataMultiError) AllErrors() []error { return m } - -// RateLimit_Action_DynamicMetaDataValidationError is the validation error -// returned by RateLimit_Action_DynamicMetaData.Validate if the designated -// constraints aren't met. -type RateLimit_Action_DynamicMetaDataValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RateLimit_Action_DynamicMetaDataValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RateLimit_Action_DynamicMetaDataValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RateLimit_Action_DynamicMetaDataValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RateLimit_Action_DynamicMetaDataValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RateLimit_Action_DynamicMetaDataValidationError) ErrorName() string { - return "RateLimit_Action_DynamicMetaDataValidationError" -} - -// Error satisfies the builtin error interface -func (e RateLimit_Action_DynamicMetaDataValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRateLimit_Action_DynamicMetaData.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RateLimit_Action_DynamicMetaDataValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RateLimit_Action_DynamicMetaDataValidationError{} - -// Validate checks the field values on RateLimit_Action_MetaData with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RateLimit_Action_MetaData) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RateLimit_Action_MetaData with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RateLimit_Action_MetaDataMultiError, or nil if none found. -func (m *RateLimit_Action_MetaData) ValidateAll() error { - return m.validate(true) -} - -func (m *RateLimit_Action_MetaData) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetDescriptorKey()) < 1 { - err := RateLimit_Action_MetaDataValidationError{ - field: "DescriptorKey", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if m.GetMetadataKey() == nil { - err := RateLimit_Action_MetaDataValidationError{ - field: "MetadataKey", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetMetadataKey()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RateLimit_Action_MetaDataValidationError{ - field: "MetadataKey", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RateLimit_Action_MetaDataValidationError{ - field: "MetadataKey", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMetadataKey()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RateLimit_Action_MetaDataValidationError{ - field: "MetadataKey", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for DefaultValue - - if _, ok := RateLimit_Action_MetaData_Source_name[int32(m.GetSource())]; !ok { - err := RateLimit_Action_MetaDataValidationError{ - field: "Source", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for SkipIfAbsent - - if len(errors) > 0 { - return RateLimit_Action_MetaDataMultiError(errors) - } - - return nil -} - -// RateLimit_Action_MetaDataMultiError is an error wrapping multiple validation -// errors returned by RateLimit_Action_MetaData.ValidateAll() if the -// designated constraints aren't met. -type RateLimit_Action_MetaDataMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RateLimit_Action_MetaDataMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RateLimit_Action_MetaDataMultiError) AllErrors() []error { return m } - -// RateLimit_Action_MetaDataValidationError is the validation error returned by -// RateLimit_Action_MetaData.Validate if the designated constraints aren't met. -type RateLimit_Action_MetaDataValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RateLimit_Action_MetaDataValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RateLimit_Action_MetaDataValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RateLimit_Action_MetaDataValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RateLimit_Action_MetaDataValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RateLimit_Action_MetaDataValidationError) ErrorName() string { - return "RateLimit_Action_MetaDataValidationError" -} - -// Error satisfies the builtin error interface -func (e RateLimit_Action_MetaDataValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRateLimit_Action_MetaData.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RateLimit_Action_MetaDataValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RateLimit_Action_MetaDataValidationError{} - -// Validate checks the field values on -// RateLimit_Action_QueryParameterValueMatch with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *RateLimit_Action_QueryParameterValueMatch) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on -// RateLimit_Action_QueryParameterValueMatch with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in -// RateLimit_Action_QueryParameterValueMatchMultiError, or nil if none found. -func (m *RateLimit_Action_QueryParameterValueMatch) ValidateAll() error { - return m.validate(true) -} - -func (m *RateLimit_Action_QueryParameterValueMatch) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for DescriptorKey - - if utf8.RuneCountInString(m.GetDescriptorValue()) < 1 { - err := RateLimit_Action_QueryParameterValueMatchValidationError{ - field: "DescriptorValue", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetExpectMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RateLimit_Action_QueryParameterValueMatchValidationError{ - field: "ExpectMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RateLimit_Action_QueryParameterValueMatchValidationError{ - field: "ExpectMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetExpectMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RateLimit_Action_QueryParameterValueMatchValidationError{ - field: "ExpectMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(m.GetQueryParameters()) < 1 { - err := RateLimit_Action_QueryParameterValueMatchValidationError{ - field: "QueryParameters", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetQueryParameters() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RateLimit_Action_QueryParameterValueMatchValidationError{ - field: fmt.Sprintf("QueryParameters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RateLimit_Action_QueryParameterValueMatchValidationError{ - field: fmt.Sprintf("QueryParameters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RateLimit_Action_QueryParameterValueMatchValidationError{ - field: fmt.Sprintf("QueryParameters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return RateLimit_Action_QueryParameterValueMatchMultiError(errors) - } - - return nil -} - -// RateLimit_Action_QueryParameterValueMatchMultiError is an error wrapping -// multiple validation errors returned by -// RateLimit_Action_QueryParameterValueMatch.ValidateAll() if the designated -// constraints aren't met. -type RateLimit_Action_QueryParameterValueMatchMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RateLimit_Action_QueryParameterValueMatchMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RateLimit_Action_QueryParameterValueMatchMultiError) AllErrors() []error { return m } - -// RateLimit_Action_QueryParameterValueMatchValidationError is the validation -// error returned by RateLimit_Action_QueryParameterValueMatch.Validate if the -// designated constraints aren't met. -type RateLimit_Action_QueryParameterValueMatchValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RateLimit_Action_QueryParameterValueMatchValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RateLimit_Action_QueryParameterValueMatchValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RateLimit_Action_QueryParameterValueMatchValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RateLimit_Action_QueryParameterValueMatchValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RateLimit_Action_QueryParameterValueMatchValidationError) ErrorName() string { - return "RateLimit_Action_QueryParameterValueMatchValidationError" -} - -// Error satisfies the builtin error interface -func (e RateLimit_Action_QueryParameterValueMatchValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRateLimit_Action_QueryParameterValueMatch.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RateLimit_Action_QueryParameterValueMatchValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RateLimit_Action_QueryParameterValueMatchValidationError{} - -// Validate checks the field values on RateLimit_Override_DynamicMetadata with -// the rules defined in the proto definition for this message. If any rules -// are violated, the first error encountered is returned, or nil if there are -// no violations. -func (m *RateLimit_Override_DynamicMetadata) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RateLimit_Override_DynamicMetadata -// with the rules defined in the proto definition for this message. If any -// rules are violated, the result is a list of violation errors wrapped in -// RateLimit_Override_DynamicMetadataMultiError, or nil if none found. -func (m *RateLimit_Override_DynamicMetadata) ValidateAll() error { - return m.validate(true) -} - -func (m *RateLimit_Override_DynamicMetadata) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetMetadataKey() == nil { - err := RateLimit_Override_DynamicMetadataValidationError{ - field: "MetadataKey", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetMetadataKey()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RateLimit_Override_DynamicMetadataValidationError{ - field: "MetadataKey", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RateLimit_Override_DynamicMetadataValidationError{ - field: "MetadataKey", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMetadataKey()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RateLimit_Override_DynamicMetadataValidationError{ - field: "MetadataKey", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return RateLimit_Override_DynamicMetadataMultiError(errors) - } - - return nil -} - -// RateLimit_Override_DynamicMetadataMultiError is an error wrapping multiple -// validation errors returned by -// RateLimit_Override_DynamicMetadata.ValidateAll() if the designated -// constraints aren't met. -type RateLimit_Override_DynamicMetadataMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RateLimit_Override_DynamicMetadataMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RateLimit_Override_DynamicMetadataMultiError) AllErrors() []error { return m } - -// RateLimit_Override_DynamicMetadataValidationError is the validation error -// returned by RateLimit_Override_DynamicMetadata.Validate if the designated -// constraints aren't met. -type RateLimit_Override_DynamicMetadataValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RateLimit_Override_DynamicMetadataValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RateLimit_Override_DynamicMetadataValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RateLimit_Override_DynamicMetadataValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RateLimit_Override_DynamicMetadataValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RateLimit_Override_DynamicMetadataValidationError) ErrorName() string { - return "RateLimit_Override_DynamicMetadataValidationError" -} - -// Error satisfies the builtin error interface -func (e RateLimit_Override_DynamicMetadataValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRateLimit_Override_DynamicMetadata.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RateLimit_Override_DynamicMetadataValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RateLimit_Override_DynamicMetadataValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/route/v3/scoped_route.pb.go b/vendor/github.com/cilium/proxy/go/envoy/config/route/v3/scoped_route.pb.go deleted file mode 100644 index 33b1fd6f2..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/route/v3/scoped_route.pb.go +++ /dev/null @@ -1,469 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/config/route/v3/scoped_route.proto - -package routev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Specifies a routing scope, which associates a -// :ref:`Key` to a -// :ref:`envoy_v3_api_msg_config.route.v3.RouteConfiguration`. -// The :ref:`envoy_v3_api_msg_config.route.v3.RouteConfiguration` can be obtained dynamically -// via RDS (:ref:`route_configuration_name`) -// or specified inline (:ref:`route_configuration`). -// -// The HTTP connection manager builds up a table consisting of these Key to -// RouteConfiguration mappings, and looks up the RouteConfiguration to use per -// request according to the algorithm specified in the -// :ref:`scope_key_builder` -// assigned to the HttpConnectionManager. -// -// For example, with the following configurations (in YAML): -// -// HttpConnectionManager config: -// -// .. code:: -// -// ... -// scoped_routes: -// name: foo-scoped-routes -// scope_key_builder: -// fragments: -// - header_value_extractor: -// name: X-Route-Selector -// element_separator: "," -// element: -// separator: = -// key: vip -// -// ScopedRouteConfiguration resources (specified statically via -// :ref:`scoped_route_configurations_list` -// or obtained dynamically via SRDS): -// -// .. code:: -// -// (1) -// name: route-scope1 -// route_configuration_name: route-config1 -// key: -// fragments: -// - string_key: 172.10.10.20 -// -// (2) -// name: route-scope2 -// route_configuration_name: route-config2 -// key: -// fragments: -// - string_key: 172.20.20.30 -// -// A request from a client such as: -// -// .. code:: -// -// GET / HTTP/1.1 -// Host: foo.com -// X-Route-Selector: vip=172.10.10.20 -// -// would result in the routing table defined by the “route-config1“ -// RouteConfiguration being assigned to the HTTP request/stream. -// -// [#next-free-field: 6] -type ScopedRouteConfiguration struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Whether the RouteConfiguration should be loaded on demand. - OnDemand bool `protobuf:"varint,4,opt,name=on_demand,json=onDemand,proto3" json:"on_demand,omitempty"` - // The name assigned to the routing scope. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The resource name to use for a :ref:`envoy_v3_api_msg_service.discovery.v3.DiscoveryRequest` to an - // RDS server to fetch the :ref:`envoy_v3_api_msg_config.route.v3.RouteConfiguration` associated - // with this scope. - RouteConfigurationName string `protobuf:"bytes,2,opt,name=route_configuration_name,json=routeConfigurationName,proto3" json:"route_configuration_name,omitempty"` - // The :ref:`envoy_v3_api_msg_config.route.v3.RouteConfiguration` associated with the scope. - RouteConfiguration *RouteConfiguration `protobuf:"bytes,5,opt,name=route_configuration,json=routeConfiguration,proto3" json:"route_configuration,omitempty"` - // The key to match against. - Key *ScopedRouteConfiguration_Key `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` -} - -func (x *ScopedRouteConfiguration) Reset() { - *x = ScopedRouteConfiguration{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_scoped_route_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ScopedRouteConfiguration) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ScopedRouteConfiguration) ProtoMessage() {} - -func (x *ScopedRouteConfiguration) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_scoped_route_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ScopedRouteConfiguration.ProtoReflect.Descriptor instead. -func (*ScopedRouteConfiguration) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_scoped_route_proto_rawDescGZIP(), []int{0} -} - -func (x *ScopedRouteConfiguration) GetOnDemand() bool { - if x != nil { - return x.OnDemand - } - return false -} - -func (x *ScopedRouteConfiguration) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *ScopedRouteConfiguration) GetRouteConfigurationName() string { - if x != nil { - return x.RouteConfigurationName - } - return "" -} - -func (x *ScopedRouteConfiguration) GetRouteConfiguration() *RouteConfiguration { - if x != nil { - return x.RouteConfiguration - } - return nil -} - -func (x *ScopedRouteConfiguration) GetKey() *ScopedRouteConfiguration_Key { - if x != nil { - return x.Key - } - return nil -} - -// Specifies a key which is matched against the output of the -// :ref:`scope_key_builder` -// specified in the HttpConnectionManager. The matching is done per HTTP -// request and is dependent on the order of the fragments contained in the -// Key. -type ScopedRouteConfiguration_Key struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The ordered set of fragments to match against. The order must match the - // fragments in the corresponding - // :ref:`scope_key_builder`. - Fragments []*ScopedRouteConfiguration_Key_Fragment `protobuf:"bytes,1,rep,name=fragments,proto3" json:"fragments,omitempty"` -} - -func (x *ScopedRouteConfiguration_Key) Reset() { - *x = ScopedRouteConfiguration_Key{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_scoped_route_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ScopedRouteConfiguration_Key) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ScopedRouteConfiguration_Key) ProtoMessage() {} - -func (x *ScopedRouteConfiguration_Key) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_scoped_route_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ScopedRouteConfiguration_Key.ProtoReflect.Descriptor instead. -func (*ScopedRouteConfiguration_Key) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_scoped_route_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *ScopedRouteConfiguration_Key) GetFragments() []*ScopedRouteConfiguration_Key_Fragment { - if x != nil { - return x.Fragments - } - return nil -} - -type ScopedRouteConfiguration_Key_Fragment struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Type: - // - // *ScopedRouteConfiguration_Key_Fragment_StringKey - Type isScopedRouteConfiguration_Key_Fragment_Type `protobuf_oneof:"type"` -} - -func (x *ScopedRouteConfiguration_Key_Fragment) Reset() { - *x = ScopedRouteConfiguration_Key_Fragment{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_config_route_v3_scoped_route_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ScopedRouteConfiguration_Key_Fragment) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ScopedRouteConfiguration_Key_Fragment) ProtoMessage() {} - -func (x *ScopedRouteConfiguration_Key_Fragment) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_route_v3_scoped_route_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ScopedRouteConfiguration_Key_Fragment.ProtoReflect.Descriptor instead. -func (*ScopedRouteConfiguration_Key_Fragment) Descriptor() ([]byte, []int) { - return file_envoy_config_route_v3_scoped_route_proto_rawDescGZIP(), []int{0, 0, 0} -} - -func (m *ScopedRouteConfiguration_Key_Fragment) GetType() isScopedRouteConfiguration_Key_Fragment_Type { - if m != nil { - return m.Type - } - return nil -} - -func (x *ScopedRouteConfiguration_Key_Fragment) GetStringKey() string { - if x, ok := x.GetType().(*ScopedRouteConfiguration_Key_Fragment_StringKey); ok { - return x.StringKey - } - return "" -} - -type isScopedRouteConfiguration_Key_Fragment_Type interface { - isScopedRouteConfiguration_Key_Fragment_Type() -} - -type ScopedRouteConfiguration_Key_Fragment_StringKey struct { - // A string to match against. - StringKey string `protobuf:"bytes,1,opt,name=string_key,json=stringKey,proto3,oneof"` -} - -func (*ScopedRouteConfiguration_Key_Fragment_StringKey) isScopedRouteConfiguration_Key_Fragment_Type() { -} - -var File_envoy_config_route_v3_scoped_route_proto protoreflect.FileDescriptor - -var file_envoy_config_route_v3_scoped_route_proto_rawDesc = []byte{ - 0x0a, 0x28, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x72, - 0x6f, 0x75, 0x74, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x64, 0x5f, 0x72, - 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, - 0x33, 0x1a, 0x21, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, - 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0xaa, 0x05, 0x0a, 0x18, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, - 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x08, 0x6f, 0x6e, 0x44, 0x65, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x4e, 0x0a, 0x18, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x5f, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x14, 0xf2, 0x98, 0xfe, 0x8f, 0x05, 0x0e, - 0x12, 0x0c, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x16, - 0x72, 0x6f, 0x75, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x70, 0x0a, 0x13, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x5f, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x6f, 0x75, 0x74, - 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x14, - 0xf2, 0x98, 0xfe, 0x8f, 0x05, 0x0e, 0x12, 0x0c, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x5f, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x52, 0x12, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4f, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x63, - 0x6f, 0x70, 0x65, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4b, 0x65, 0x79, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, - 0x01, 0x02, 0x10, 0x01, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x1a, 0x92, 0x02, 0x0a, 0x03, 0x4b, 0x65, - 0x79, 0x12, 0x64, 0x0a, 0x09, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x63, 0x6f, - 0x70, 0x65, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4b, 0x65, 0x79, 0x2e, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, - 0x6e, 0x74, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x09, 0x66, 0x72, - 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x1a, 0x73, 0x0a, 0x08, 0x46, 0x72, 0x61, 0x67, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x1f, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x09, 0x73, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x4b, 0x65, 0x79, 0x3a, 0x39, 0x9a, 0xc5, 0x88, 0x1e, 0x34, 0x0a, 0x32, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x64, - 0x52, 0x6f, 0x75, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x2e, 0x4b, 0x65, 0x79, 0x2e, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x42, - 0x0b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x3a, 0x30, 0x9a, 0xc5, - 0x88, 0x1e, 0x2b, 0x0a, 0x29, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x32, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4b, 0x65, 0x79, 0x3a, 0x2c, - 0x9a, 0xc5, 0x88, 0x1e, 0x27, 0x0a, 0x25, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x87, 0x01, 0x0a, - 0x23, 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, - 0x65, 0x2e, 0x76, 0x33, 0x42, 0x10, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x64, 0x52, 0x6f, 0x75, 0x74, - 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, - 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, - 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x72, 0x6f, - 0x75, 0x74, 0x65, 0x2f, 0x76, 0x33, 0x3b, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x76, 0x33, 0xba, 0x80, - 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_config_route_v3_scoped_route_proto_rawDescOnce sync.Once - file_envoy_config_route_v3_scoped_route_proto_rawDescData = file_envoy_config_route_v3_scoped_route_proto_rawDesc -) - -func file_envoy_config_route_v3_scoped_route_proto_rawDescGZIP() []byte { - file_envoy_config_route_v3_scoped_route_proto_rawDescOnce.Do(func() { - file_envoy_config_route_v3_scoped_route_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_config_route_v3_scoped_route_proto_rawDescData) - }) - return file_envoy_config_route_v3_scoped_route_proto_rawDescData -} - -var file_envoy_config_route_v3_scoped_route_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_envoy_config_route_v3_scoped_route_proto_goTypes = []interface{}{ - (*ScopedRouteConfiguration)(nil), // 0: envoy.config.route.v3.ScopedRouteConfiguration - (*ScopedRouteConfiguration_Key)(nil), // 1: envoy.config.route.v3.ScopedRouteConfiguration.Key - (*ScopedRouteConfiguration_Key_Fragment)(nil), // 2: envoy.config.route.v3.ScopedRouteConfiguration.Key.Fragment - (*RouteConfiguration)(nil), // 3: envoy.config.route.v3.RouteConfiguration -} -var file_envoy_config_route_v3_scoped_route_proto_depIdxs = []int32{ - 3, // 0: envoy.config.route.v3.ScopedRouteConfiguration.route_configuration:type_name -> envoy.config.route.v3.RouteConfiguration - 1, // 1: envoy.config.route.v3.ScopedRouteConfiguration.key:type_name -> envoy.config.route.v3.ScopedRouteConfiguration.Key - 2, // 2: envoy.config.route.v3.ScopedRouteConfiguration.Key.fragments:type_name -> envoy.config.route.v3.ScopedRouteConfiguration.Key.Fragment - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_envoy_config_route_v3_scoped_route_proto_init() } -func file_envoy_config_route_v3_scoped_route_proto_init() { - if File_envoy_config_route_v3_scoped_route_proto != nil { - return - } - file_envoy_config_route_v3_route_proto_init() - if !protoimpl.UnsafeEnabled { - file_envoy_config_route_v3_scoped_route_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ScopedRouteConfiguration); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_scoped_route_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ScopedRouteConfiguration_Key); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_config_route_v3_scoped_route_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ScopedRouteConfiguration_Key_Fragment); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_config_route_v3_scoped_route_proto_msgTypes[2].OneofWrappers = []interface{}{ - (*ScopedRouteConfiguration_Key_Fragment_StringKey)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_config_route_v3_scoped_route_proto_rawDesc, - NumEnums: 0, - NumMessages: 3, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_config_route_v3_scoped_route_proto_goTypes, - DependencyIndexes: file_envoy_config_route_v3_scoped_route_proto_depIdxs, - MessageInfos: file_envoy_config_route_v3_scoped_route_proto_msgTypes, - }.Build() - File_envoy_config_route_v3_scoped_route_proto = out.File - file_envoy_config_route_v3_scoped_route_proto_rawDesc = nil - file_envoy_config_route_v3_scoped_route_proto_goTypes = nil - file_envoy_config_route_v3_scoped_route_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/config/route/v3/scoped_route.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/config/route/v3/scoped_route.pb.validate.go deleted file mode 100644 index 5e52729bb..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/config/route/v3/scoped_route.pb.validate.go +++ /dev/null @@ -1,504 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/config/route/v3/scoped_route.proto - -package routev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on ScopedRouteConfiguration with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ScopedRouteConfiguration) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ScopedRouteConfiguration with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ScopedRouteConfigurationMultiError, or nil if none found. -func (m *ScopedRouteConfiguration) ValidateAll() error { - return m.validate(true) -} - -func (m *ScopedRouteConfiguration) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for OnDemand - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := ScopedRouteConfigurationValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for RouteConfigurationName - - if all { - switch v := interface{}(m.GetRouteConfiguration()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ScopedRouteConfigurationValidationError{ - field: "RouteConfiguration", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ScopedRouteConfigurationValidationError{ - field: "RouteConfiguration", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRouteConfiguration()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ScopedRouteConfigurationValidationError{ - field: "RouteConfiguration", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if m.GetKey() == nil { - err := ScopedRouteConfigurationValidationError{ - field: "Key", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetKey()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ScopedRouteConfigurationValidationError{ - field: "Key", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ScopedRouteConfigurationValidationError{ - field: "Key", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetKey()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ScopedRouteConfigurationValidationError{ - field: "Key", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return ScopedRouteConfigurationMultiError(errors) - } - - return nil -} - -// ScopedRouteConfigurationMultiError is an error wrapping multiple validation -// errors returned by ScopedRouteConfiguration.ValidateAll() if the designated -// constraints aren't met. -type ScopedRouteConfigurationMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ScopedRouteConfigurationMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ScopedRouteConfigurationMultiError) AllErrors() []error { return m } - -// ScopedRouteConfigurationValidationError is the validation error returned by -// ScopedRouteConfiguration.Validate if the designated constraints aren't met. -type ScopedRouteConfigurationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ScopedRouteConfigurationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ScopedRouteConfigurationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ScopedRouteConfigurationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ScopedRouteConfigurationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ScopedRouteConfigurationValidationError) ErrorName() string { - return "ScopedRouteConfigurationValidationError" -} - -// Error satisfies the builtin error interface -func (e ScopedRouteConfigurationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sScopedRouteConfiguration.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ScopedRouteConfigurationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ScopedRouteConfigurationValidationError{} - -// Validate checks the field values on ScopedRouteConfiguration_Key with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ScopedRouteConfiguration_Key) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ScopedRouteConfiguration_Key with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ScopedRouteConfiguration_KeyMultiError, or nil if none found. -func (m *ScopedRouteConfiguration_Key) ValidateAll() error { - return m.validate(true) -} - -func (m *ScopedRouteConfiguration_Key) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(m.GetFragments()) < 1 { - err := ScopedRouteConfiguration_KeyValidationError{ - field: "Fragments", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetFragments() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ScopedRouteConfiguration_KeyValidationError{ - field: fmt.Sprintf("Fragments[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ScopedRouteConfiguration_KeyValidationError{ - field: fmt.Sprintf("Fragments[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ScopedRouteConfiguration_KeyValidationError{ - field: fmt.Sprintf("Fragments[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return ScopedRouteConfiguration_KeyMultiError(errors) - } - - return nil -} - -// ScopedRouteConfiguration_KeyMultiError is an error wrapping multiple -// validation errors returned by ScopedRouteConfiguration_Key.ValidateAll() if -// the designated constraints aren't met. -type ScopedRouteConfiguration_KeyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ScopedRouteConfiguration_KeyMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ScopedRouteConfiguration_KeyMultiError) AllErrors() []error { return m } - -// ScopedRouteConfiguration_KeyValidationError is the validation error returned -// by ScopedRouteConfiguration_Key.Validate if the designated constraints -// aren't met. -type ScopedRouteConfiguration_KeyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ScopedRouteConfiguration_KeyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ScopedRouteConfiguration_KeyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ScopedRouteConfiguration_KeyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ScopedRouteConfiguration_KeyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ScopedRouteConfiguration_KeyValidationError) ErrorName() string { - return "ScopedRouteConfiguration_KeyValidationError" -} - -// Error satisfies the builtin error interface -func (e ScopedRouteConfiguration_KeyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sScopedRouteConfiguration_Key.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ScopedRouteConfiguration_KeyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ScopedRouteConfiguration_KeyValidationError{} - -// Validate checks the field values on ScopedRouteConfiguration_Key_Fragment -// with the rules defined in the proto definition for this message. If any -// rules are violated, the first error encountered is returned, or nil if -// there are no violations. -func (m *ScopedRouteConfiguration_Key_Fragment) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ScopedRouteConfiguration_Key_Fragment -// with the rules defined in the proto definition for this message. If any -// rules are violated, the result is a list of violation errors wrapped in -// ScopedRouteConfiguration_Key_FragmentMultiError, or nil if none found. -func (m *ScopedRouteConfiguration_Key_Fragment) ValidateAll() error { - return m.validate(true) -} - -func (m *ScopedRouteConfiguration_Key_Fragment) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofTypePresent := false - switch v := m.Type.(type) { - case *ScopedRouteConfiguration_Key_Fragment_StringKey: - if v == nil { - err := ScopedRouteConfiguration_Key_FragmentValidationError{ - field: "Type", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofTypePresent = true - // no validation rules for StringKey - default: - _ = v // ensures v is used - } - if !oneofTypePresent { - err := ScopedRouteConfiguration_Key_FragmentValidationError{ - field: "Type", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return ScopedRouteConfiguration_Key_FragmentMultiError(errors) - } - - return nil -} - -// ScopedRouteConfiguration_Key_FragmentMultiError is an error wrapping -// multiple validation errors returned by -// ScopedRouteConfiguration_Key_Fragment.ValidateAll() if the designated -// constraints aren't met. -type ScopedRouteConfiguration_Key_FragmentMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ScopedRouteConfiguration_Key_FragmentMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ScopedRouteConfiguration_Key_FragmentMultiError) AllErrors() []error { return m } - -// ScopedRouteConfiguration_Key_FragmentValidationError is the validation error -// returned by ScopedRouteConfiguration_Key_Fragment.Validate if the -// designated constraints aren't met. -type ScopedRouteConfiguration_Key_FragmentValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ScopedRouteConfiguration_Key_FragmentValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ScopedRouteConfiguration_Key_FragmentValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ScopedRouteConfiguration_Key_FragmentValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ScopedRouteConfiguration_Key_FragmentValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ScopedRouteConfiguration_Key_FragmentValidationError) ErrorName() string { - return "ScopedRouteConfiguration_Key_FragmentValidationError" -} - -// Error satisfies the builtin error interface -func (e ScopedRouteConfiguration_Key_FragmentValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sScopedRouteConfiguration_Key_Fragment.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ScopedRouteConfiguration_Key_FragmentValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ScopedRouteConfiguration_Key_FragmentValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/service/discovery/v3/ads.pb.go b/vendor/github.com/cilium/proxy/go/envoy/service/discovery/v3/ads.pb.go deleted file mode 100644 index 0b31fb43f..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/service/discovery/v3/ads.pb.go +++ /dev/null @@ -1,373 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/service/discovery/v3/ads.proto - -package discoveryv3 - -import ( - context "context" - _ "github.com/cncf/xds/go/udpa/annotations" - proto "github.com/golang/protobuf/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// [#not-implemented-hide:] Not configuration. Workaround c++ protobuf issue with importing -// services: https://github.com/google/protobuf/issues/4221 -type AdsDummy struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *AdsDummy) Reset() { - *x = AdsDummy{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_service_discovery_v3_ads_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdsDummy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdsDummy) ProtoMessage() {} - -func (x *AdsDummy) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_discovery_v3_ads_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdsDummy.ProtoReflect.Descriptor instead. -func (*AdsDummy) Descriptor() ([]byte, []int) { - return file_envoy_service_discovery_v3_ads_proto_rawDescGZIP(), []int{0} -} - -var File_envoy_service_discovery_v3_ads_proto protoreflect.FileDescriptor - -var file_envoy_service_discovery_v3_ads_proto_rawDesc = []byte{ - 0x0a, 0x24, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, - 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x33, 0x2f, 0x61, 0x64, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1a, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, - 0x76, 0x33, 0x1a, 0x2a, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x33, 0x2f, 0x64, - 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, - 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x75, - 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x36, 0x0a, 0x08, 0x41, 0x64, 0x73, 0x44, 0x75, 0x6d, 0x6d, 0x79, 0x3a, 0x2a, 0x9a, 0xc5, - 0x88, 0x1e, 0x25, 0x0a, 0x23, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x32, 0x2e, - 0x41, 0x64, 0x73, 0x44, 0x75, 0x6d, 0x6d, 0x79, 0x32, 0xa6, 0x02, 0x0a, 0x1a, 0x41, 0x67, 0x67, - 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7e, 0x0a, 0x19, 0x53, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x73, 0x12, 0x2c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, - 0x33, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x33, 0x2e, - 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x87, 0x01, 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x74, - 0x61, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x73, 0x12, 0x31, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, - 0x33, 0x2e, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, - 0x79, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, - 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, - 0x01, 0x42, 0x8d, 0x01, 0x0a, 0x28, 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, - 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x33, 0x42, 0x08, - 0x41, 0x64, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x4d, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, - 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, - 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x33, 0x3b, 0x64, 0x69, - 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x10, - 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_service_discovery_v3_ads_proto_rawDescOnce sync.Once - file_envoy_service_discovery_v3_ads_proto_rawDescData = file_envoy_service_discovery_v3_ads_proto_rawDesc -) - -func file_envoy_service_discovery_v3_ads_proto_rawDescGZIP() []byte { - file_envoy_service_discovery_v3_ads_proto_rawDescOnce.Do(func() { - file_envoy_service_discovery_v3_ads_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_service_discovery_v3_ads_proto_rawDescData) - }) - return file_envoy_service_discovery_v3_ads_proto_rawDescData -} - -var file_envoy_service_discovery_v3_ads_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_service_discovery_v3_ads_proto_goTypes = []interface{}{ - (*AdsDummy)(nil), // 0: envoy.service.discovery.v3.AdsDummy - (*DiscoveryRequest)(nil), // 1: envoy.service.discovery.v3.DiscoveryRequest - (*DeltaDiscoveryRequest)(nil), // 2: envoy.service.discovery.v3.DeltaDiscoveryRequest - (*DiscoveryResponse)(nil), // 3: envoy.service.discovery.v3.DiscoveryResponse - (*DeltaDiscoveryResponse)(nil), // 4: envoy.service.discovery.v3.DeltaDiscoveryResponse -} -var file_envoy_service_discovery_v3_ads_proto_depIdxs = []int32{ - 1, // 0: envoy.service.discovery.v3.AggregatedDiscoveryService.StreamAggregatedResources:input_type -> envoy.service.discovery.v3.DiscoveryRequest - 2, // 1: envoy.service.discovery.v3.AggregatedDiscoveryService.DeltaAggregatedResources:input_type -> envoy.service.discovery.v3.DeltaDiscoveryRequest - 3, // 2: envoy.service.discovery.v3.AggregatedDiscoveryService.StreamAggregatedResources:output_type -> envoy.service.discovery.v3.DiscoveryResponse - 4, // 3: envoy.service.discovery.v3.AggregatedDiscoveryService.DeltaAggregatedResources:output_type -> envoy.service.discovery.v3.DeltaDiscoveryResponse - 2, // [2:4] is the sub-list for method output_type - 0, // [0:2] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_envoy_service_discovery_v3_ads_proto_init() } -func file_envoy_service_discovery_v3_ads_proto_init() { - if File_envoy_service_discovery_v3_ads_proto != nil { - return - } - file_envoy_service_discovery_v3_discovery_proto_init() - if !protoimpl.UnsafeEnabled { - file_envoy_service_discovery_v3_ads_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdsDummy); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_service_discovery_v3_ads_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_envoy_service_discovery_v3_ads_proto_goTypes, - DependencyIndexes: file_envoy_service_discovery_v3_ads_proto_depIdxs, - MessageInfos: file_envoy_service_discovery_v3_ads_proto_msgTypes, - }.Build() - File_envoy_service_discovery_v3_ads_proto = out.File - file_envoy_service_discovery_v3_ads_proto_rawDesc = nil - file_envoy_service_discovery_v3_ads_proto_goTypes = nil - file_envoy_service_discovery_v3_ads_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// 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.SupportPackageIsVersion6 - -// AggregatedDiscoveryServiceClient is the client API for AggregatedDiscoveryService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type AggregatedDiscoveryServiceClient interface { - // This is a gRPC-only API. - StreamAggregatedResources(ctx context.Context, opts ...grpc.CallOption) (AggregatedDiscoveryService_StreamAggregatedResourcesClient, error) - DeltaAggregatedResources(ctx context.Context, opts ...grpc.CallOption) (AggregatedDiscoveryService_DeltaAggregatedResourcesClient, error) -} - -type aggregatedDiscoveryServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewAggregatedDiscoveryServiceClient(cc grpc.ClientConnInterface) AggregatedDiscoveryServiceClient { - return &aggregatedDiscoveryServiceClient{cc} -} - -func (c *aggregatedDiscoveryServiceClient) StreamAggregatedResources(ctx context.Context, opts ...grpc.CallOption) (AggregatedDiscoveryService_StreamAggregatedResourcesClient, error) { - stream, err := c.cc.NewStream(ctx, &_AggregatedDiscoveryService_serviceDesc.Streams[0], "/envoy.service.discovery.v3.AggregatedDiscoveryService/StreamAggregatedResources", opts...) - if err != nil { - return nil, err - } - x := &aggregatedDiscoveryServiceStreamAggregatedResourcesClient{stream} - return x, nil -} - -type AggregatedDiscoveryService_StreamAggregatedResourcesClient interface { - Send(*DiscoveryRequest) error - Recv() (*DiscoveryResponse, error) - grpc.ClientStream -} - -type aggregatedDiscoveryServiceStreamAggregatedResourcesClient struct { - grpc.ClientStream -} - -func (x *aggregatedDiscoveryServiceStreamAggregatedResourcesClient) Send(m *DiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *aggregatedDiscoveryServiceStreamAggregatedResourcesClient) Recv() (*DiscoveryResponse, error) { - m := new(DiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *aggregatedDiscoveryServiceClient) DeltaAggregatedResources(ctx context.Context, opts ...grpc.CallOption) (AggregatedDiscoveryService_DeltaAggregatedResourcesClient, error) { - stream, err := c.cc.NewStream(ctx, &_AggregatedDiscoveryService_serviceDesc.Streams[1], "/envoy.service.discovery.v3.AggregatedDiscoveryService/DeltaAggregatedResources", opts...) - if err != nil { - return nil, err - } - x := &aggregatedDiscoveryServiceDeltaAggregatedResourcesClient{stream} - return x, nil -} - -type AggregatedDiscoveryService_DeltaAggregatedResourcesClient interface { - Send(*DeltaDiscoveryRequest) error - Recv() (*DeltaDiscoveryResponse, error) - grpc.ClientStream -} - -type aggregatedDiscoveryServiceDeltaAggregatedResourcesClient struct { - grpc.ClientStream -} - -func (x *aggregatedDiscoveryServiceDeltaAggregatedResourcesClient) Send(m *DeltaDiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *aggregatedDiscoveryServiceDeltaAggregatedResourcesClient) Recv() (*DeltaDiscoveryResponse, error) { - m := new(DeltaDiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// AggregatedDiscoveryServiceServer is the server API for AggregatedDiscoveryService service. -type AggregatedDiscoveryServiceServer interface { - // This is a gRPC-only API. - StreamAggregatedResources(AggregatedDiscoveryService_StreamAggregatedResourcesServer) error - DeltaAggregatedResources(AggregatedDiscoveryService_DeltaAggregatedResourcesServer) error -} - -// UnimplementedAggregatedDiscoveryServiceServer can be embedded to have forward compatible implementations. -type UnimplementedAggregatedDiscoveryServiceServer struct { -} - -func (*UnimplementedAggregatedDiscoveryServiceServer) StreamAggregatedResources(AggregatedDiscoveryService_StreamAggregatedResourcesServer) error { - return status.Errorf(codes.Unimplemented, "method StreamAggregatedResources not implemented") -} -func (*UnimplementedAggregatedDiscoveryServiceServer) DeltaAggregatedResources(AggregatedDiscoveryService_DeltaAggregatedResourcesServer) error { - return status.Errorf(codes.Unimplemented, "method DeltaAggregatedResources not implemented") -} - -func RegisterAggregatedDiscoveryServiceServer(s *grpc.Server, srv AggregatedDiscoveryServiceServer) { - s.RegisterService(&_AggregatedDiscoveryService_serviceDesc, srv) -} - -func _AggregatedDiscoveryService_StreamAggregatedResources_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(AggregatedDiscoveryServiceServer).StreamAggregatedResources(&aggregatedDiscoveryServiceStreamAggregatedResourcesServer{stream}) -} - -type AggregatedDiscoveryService_StreamAggregatedResourcesServer interface { - Send(*DiscoveryResponse) error - Recv() (*DiscoveryRequest, error) - grpc.ServerStream -} - -type aggregatedDiscoveryServiceStreamAggregatedResourcesServer struct { - grpc.ServerStream -} - -func (x *aggregatedDiscoveryServiceStreamAggregatedResourcesServer) Send(m *DiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *aggregatedDiscoveryServiceStreamAggregatedResourcesServer) Recv() (*DiscoveryRequest, error) { - m := new(DiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _AggregatedDiscoveryService_DeltaAggregatedResources_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(AggregatedDiscoveryServiceServer).DeltaAggregatedResources(&aggregatedDiscoveryServiceDeltaAggregatedResourcesServer{stream}) -} - -type AggregatedDiscoveryService_DeltaAggregatedResourcesServer interface { - Send(*DeltaDiscoveryResponse) error - Recv() (*DeltaDiscoveryRequest, error) - grpc.ServerStream -} - -type aggregatedDiscoveryServiceDeltaAggregatedResourcesServer struct { - grpc.ServerStream -} - -func (x *aggregatedDiscoveryServiceDeltaAggregatedResourcesServer) Send(m *DeltaDiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *aggregatedDiscoveryServiceDeltaAggregatedResourcesServer) Recv() (*DeltaDiscoveryRequest, error) { - m := new(DeltaDiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -var _AggregatedDiscoveryService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "envoy.service.discovery.v3.AggregatedDiscoveryService", - HandlerType: (*AggregatedDiscoveryServiceServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "StreamAggregatedResources", - Handler: _AggregatedDiscoveryService_StreamAggregatedResources_Handler, - ServerStreams: true, - ClientStreams: true, - }, - { - StreamName: "DeltaAggregatedResources", - Handler: _AggregatedDiscoveryService_DeltaAggregatedResources_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "envoy/service/discovery/v3/ads.proto", -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/service/discovery/v3/ads.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/service/discovery/v3/ads.pb.validate.go deleted file mode 100644 index 966eb457e..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/service/discovery/v3/ads.pb.validate.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/service/discovery/v3/ads.proto - -package discoveryv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on AdsDummy with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *AdsDummy) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on AdsDummy with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in AdsDummyMultiError, or nil -// if none found. -func (m *AdsDummy) ValidateAll() error { - return m.validate(true) -} - -func (m *AdsDummy) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return AdsDummyMultiError(errors) - } - - return nil -} - -// AdsDummyMultiError is an error wrapping multiple validation errors returned -// by AdsDummy.ValidateAll() if the designated constraints aren't met. -type AdsDummyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AdsDummyMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AdsDummyMultiError) AllErrors() []error { return m } - -// AdsDummyValidationError is the validation error returned by -// AdsDummy.Validate if the designated constraints aren't met. -type AdsDummyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AdsDummyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AdsDummyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AdsDummyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AdsDummyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AdsDummyValidationError) ErrorName() string { return "AdsDummyValidationError" } - -// Error satisfies the builtin error interface -func (e AdsDummyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAdsDummy.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AdsDummyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AdsDummyValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/service/discovery/v3/discovery.pb.go b/vendor/github.com/cilium/proxy/go/envoy/service/discovery/v3/discovery.pb.go deleted file mode 100644 index 487036dc7..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/service/discovery/v3/discovery.pb.go +++ /dev/null @@ -1,1698 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/service/discovery/v3/discovery.proto - -package discoveryv3 - -import ( - v3 "github.com/cilium/proxy/go/envoy/config/core/v3" - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - status "google.golang.org/genproto/googleapis/rpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - durationpb "google.golang.org/protobuf/types/known/durationpb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Specifies a resource to be subscribed to. -type ResourceLocator struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The resource name to subscribe to. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // A set of dynamic parameters used to match against the dynamic parameter - // constraints on the resource. This allows clients to select between - // multiple variants of the same resource. - DynamicParameters map[string]string `protobuf:"bytes,2,rep,name=dynamic_parameters,json=dynamicParameters,proto3" json:"dynamic_parameters,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *ResourceLocator) Reset() { - *x = ResourceLocator{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_service_discovery_v3_discovery_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ResourceLocator) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ResourceLocator) ProtoMessage() {} - -func (x *ResourceLocator) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_discovery_v3_discovery_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ResourceLocator.ProtoReflect.Descriptor instead. -func (*ResourceLocator) Descriptor() ([]byte, []int) { - return file_envoy_service_discovery_v3_discovery_proto_rawDescGZIP(), []int{0} -} - -func (x *ResourceLocator) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *ResourceLocator) GetDynamicParameters() map[string]string { - if x != nil { - return x.DynamicParameters - } - return nil -} - -// Specifies a concrete resource name. -type ResourceName struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of the resource. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Dynamic parameter constraints associated with this resource. To be used by client-side caches - // (including xDS proxies) when matching subscribed resource locators. - DynamicParameterConstraints *DynamicParameterConstraints `protobuf:"bytes,2,opt,name=dynamic_parameter_constraints,json=dynamicParameterConstraints,proto3" json:"dynamic_parameter_constraints,omitempty"` -} - -func (x *ResourceName) Reset() { - *x = ResourceName{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_service_discovery_v3_discovery_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ResourceName) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ResourceName) ProtoMessage() {} - -func (x *ResourceName) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_discovery_v3_discovery_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ResourceName.ProtoReflect.Descriptor instead. -func (*ResourceName) Descriptor() ([]byte, []int) { - return file_envoy_service_discovery_v3_discovery_proto_rawDescGZIP(), []int{1} -} - -func (x *ResourceName) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *ResourceName) GetDynamicParameterConstraints() *DynamicParameterConstraints { - if x != nil { - return x.DynamicParameterConstraints - } - return nil -} - -// A DiscoveryRequest requests a set of versioned resources of the same type for -// a given Envoy node on some API. -// [#next-free-field: 8] -type DiscoveryRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The version_info provided in the request messages will be the version_info - // received with the most recent successfully processed response or empty on - // the first request. It is expected that no new request is sent after a - // response is received until the Envoy instance is ready to ACK/NACK the new - // configuration. ACK/NACK takes place by returning the new API config version - // as applied or the previous API config version respectively. Each type_url - // (see below) has an independent version associated with it. - VersionInfo string `protobuf:"bytes,1,opt,name=version_info,json=versionInfo,proto3" json:"version_info,omitempty"` - // The node making the request. - Node *v3.Node `protobuf:"bytes,2,opt,name=node,proto3" json:"node,omitempty"` - // List of resources to subscribe to, e.g. list of cluster names or a route - // configuration name. If this is empty, all resources for the API are - // returned. LDS/CDS may have empty resource_names, which will cause all - // resources for the Envoy instance to be returned. The LDS and CDS responses - // will then imply a number of resources that need to be fetched via EDS/RDS, - // which will be explicitly enumerated in resource_names. - ResourceNames []string `protobuf:"bytes,3,rep,name=resource_names,json=resourceNames,proto3" json:"resource_names,omitempty"` - // [#not-implemented-hide:] - // Alternative to “resource_names“ field that allows specifying dynamic - // parameters along with each resource name. Clients that populate this - // field must be able to handle responses from the server where resources - // are wrapped in a Resource message. - // Note that it is legal for a request to have some resources listed - // in “resource_names“ and others in “resource_locators“. - ResourceLocators []*ResourceLocator `protobuf:"bytes,7,rep,name=resource_locators,json=resourceLocators,proto3" json:"resource_locators,omitempty"` - // Type of the resource that is being requested, e.g. - // "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment". This is implicit - // in requests made via singleton xDS APIs such as CDS, LDS, etc. but is - // required for ADS. - TypeUrl string `protobuf:"bytes,4,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` - // nonce corresponding to DiscoveryResponse being ACK/NACKed. See above - // discussion on version_info and the DiscoveryResponse nonce comment. This - // may be empty only if 1) this is a non-persistent-stream xDS such as HTTP, - // or 2) the client has not yet accepted an update in this xDS stream (unlike - // delta, where it is populated only for new explicit ACKs). - ResponseNonce string `protobuf:"bytes,5,opt,name=response_nonce,json=responseNonce,proto3" json:"response_nonce,omitempty"` - // This is populated when the previous :ref:`DiscoveryResponse ` - // failed to update configuration. The “message“ field in “error_details“ provides the Envoy - // internal exception related to the failure. It is only intended for consumption during manual - // debugging, the string provided is not guaranteed to be stable across Envoy versions. - ErrorDetail *status.Status `protobuf:"bytes,6,opt,name=error_detail,json=errorDetail,proto3" json:"error_detail,omitempty"` -} - -func (x *DiscoveryRequest) Reset() { - *x = DiscoveryRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_service_discovery_v3_discovery_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DiscoveryRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DiscoveryRequest) ProtoMessage() {} - -func (x *DiscoveryRequest) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_discovery_v3_discovery_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DiscoveryRequest.ProtoReflect.Descriptor instead. -func (*DiscoveryRequest) Descriptor() ([]byte, []int) { - return file_envoy_service_discovery_v3_discovery_proto_rawDescGZIP(), []int{2} -} - -func (x *DiscoveryRequest) GetVersionInfo() string { - if x != nil { - return x.VersionInfo - } - return "" -} - -func (x *DiscoveryRequest) GetNode() *v3.Node { - if x != nil { - return x.Node - } - return nil -} - -func (x *DiscoveryRequest) GetResourceNames() []string { - if x != nil { - return x.ResourceNames - } - return nil -} - -func (x *DiscoveryRequest) GetResourceLocators() []*ResourceLocator { - if x != nil { - return x.ResourceLocators - } - return nil -} - -func (x *DiscoveryRequest) GetTypeUrl() string { - if x != nil { - return x.TypeUrl - } - return "" -} - -func (x *DiscoveryRequest) GetResponseNonce() string { - if x != nil { - return x.ResponseNonce - } - return "" -} - -func (x *DiscoveryRequest) GetErrorDetail() *status.Status { - if x != nil { - return x.ErrorDetail - } - return nil -} - -// [#next-free-field: 7] -type DiscoveryResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The version of the response data. - VersionInfo string `protobuf:"bytes,1,opt,name=version_info,json=versionInfo,proto3" json:"version_info,omitempty"` - // The response resources. These resources are typed and depend on the API being called. - Resources []*anypb.Any `protobuf:"bytes,2,rep,name=resources,proto3" json:"resources,omitempty"` - // [#not-implemented-hide:] - // Canary is used to support two Envoy command line flags: - // - // - --terminate-on-canary-transition-failure. When set, Envoy is able to - // terminate if it detects that configuration is stuck at canary. Consider - // this example sequence of updates: - // - Management server applies a canary config successfully. - // - Management server rolls back to a production config. - // - Envoy rejects the new production config. - // Since there is no sensible way to continue receiving configuration - // updates, Envoy will then terminate and apply production config from a - // clean slate. - // - --dry-run-canary. When set, a canary response will never be applied, only - // validated via a dry run. - Canary bool `protobuf:"varint,3,opt,name=canary,proto3" json:"canary,omitempty"` - // Type URL for resources. Identifies the xDS API when muxing over ADS. - // Must be consistent with the type_url in the 'resources' repeated Any (if non-empty). - TypeUrl string `protobuf:"bytes,4,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` - // For gRPC based subscriptions, the nonce provides a way to explicitly ack a - // specific DiscoveryResponse in a following DiscoveryRequest. Additional - // messages may have been sent by Envoy to the management server for the - // previous version on the stream prior to this DiscoveryResponse, that were - // unprocessed at response send time. The nonce allows the management server - // to ignore any further DiscoveryRequests for the previous version until a - // DiscoveryRequest bearing the nonce. The nonce is optional and is not - // required for non-stream based xDS implementations. - Nonce string `protobuf:"bytes,5,opt,name=nonce,proto3" json:"nonce,omitempty"` - // The control plane instance that sent the response. - ControlPlane *v3.ControlPlane `protobuf:"bytes,6,opt,name=control_plane,json=controlPlane,proto3" json:"control_plane,omitempty"` -} - -func (x *DiscoveryResponse) Reset() { - *x = DiscoveryResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_service_discovery_v3_discovery_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DiscoveryResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DiscoveryResponse) ProtoMessage() {} - -func (x *DiscoveryResponse) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_discovery_v3_discovery_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DiscoveryResponse.ProtoReflect.Descriptor instead. -func (*DiscoveryResponse) Descriptor() ([]byte, []int) { - return file_envoy_service_discovery_v3_discovery_proto_rawDescGZIP(), []int{3} -} - -func (x *DiscoveryResponse) GetVersionInfo() string { - if x != nil { - return x.VersionInfo - } - return "" -} - -func (x *DiscoveryResponse) GetResources() []*anypb.Any { - if x != nil { - return x.Resources - } - return nil -} - -func (x *DiscoveryResponse) GetCanary() bool { - if x != nil { - return x.Canary - } - return false -} - -func (x *DiscoveryResponse) GetTypeUrl() string { - if x != nil { - return x.TypeUrl - } - return "" -} - -func (x *DiscoveryResponse) GetNonce() string { - if x != nil { - return x.Nonce - } - return "" -} - -func (x *DiscoveryResponse) GetControlPlane() *v3.ControlPlane { - if x != nil { - return x.ControlPlane - } - return nil -} - -// DeltaDiscoveryRequest and DeltaDiscoveryResponse are used in a new gRPC -// endpoint for Delta xDS. -// -// With Delta xDS, the DeltaDiscoveryResponses do not need to include a full -// snapshot of the tracked resources. Instead, DeltaDiscoveryResponses are a -// diff to the state of a xDS client. -// In Delta XDS there are per-resource versions, which allow tracking state at -// the resource granularity. -// An xDS Delta session is always in the context of a gRPC bidirectional -// stream. This allows the xDS server to keep track of the state of xDS clients -// connected to it. -// -// In Delta xDS the nonce field is required and used to pair -// DeltaDiscoveryResponse to a DeltaDiscoveryRequest ACK or NACK. -// Optionally, a response message level system_version_info is present for -// debugging purposes only. -// -// DeltaDiscoveryRequest plays two independent roles. Any DeltaDiscoveryRequest -// can be either or both of: [1] informing the server of what resources the -// client has gained/lost interest in (using resource_names_subscribe and -// resource_names_unsubscribe), or [2] (N)ACKing an earlier resource update from -// the server (using response_nonce, with presence of error_detail making it a NACK). -// Additionally, the first message (for a given type_url) of a reconnected gRPC stream -// has a third role: informing the server of the resources (and their versions) -// that the client already possesses, using the initial_resource_versions field. -// -// As with state-of-the-world, when multiple resource types are multiplexed (ADS), -// all requests/acknowledgments/updates are logically walled off by type_url: -// a Cluster ACK exists in a completely separate world from a prior Route NACK. -// In particular, initial_resource_versions being sent at the "start" of every -// gRPC stream actually entails a message for each type_url, each with its own -// initial_resource_versions. -// [#next-free-field: 10] -type DeltaDiscoveryRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The node making the request. - Node *v3.Node `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"` - // Type of the resource that is being requested, e.g. - // “type.googleapis.com/envoy.api.v2.ClusterLoadAssignment“. This does not need to be set if - // resources are only referenced via “xds_resource_subscribe“ and - // “xds_resources_unsubscribe“. - TypeUrl string `protobuf:"bytes,2,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` - // DeltaDiscoveryRequests allow the client to add or remove individual - // resources to the set of tracked resources in the context of a stream. - // All resource names in the resource_names_subscribe list are added to the - // set of tracked resources and all resource names in the resource_names_unsubscribe - // list are removed from the set of tracked resources. - // - // *Unlike* state-of-the-world xDS, an empty resource_names_subscribe or - // resource_names_unsubscribe list simply means that no resources are to be - // added or removed to the resource list. - // *Like* state-of-the-world xDS, the server must send updates for all tracked - // resources, but can also send updates for resources the client has not subscribed to. - // - // NOTE: the server must respond with all resources listed in resource_names_subscribe, - // even if it believes the client has the most recent version of them. The reason: - // the client may have dropped them, but then regained interest before it had a chance - // to send the unsubscribe message. See DeltaSubscriptionStateTest.RemoveThenAdd. - // - // These two fields can be set in any DeltaDiscoveryRequest, including ACKs - // and initial_resource_versions. - // - // A list of Resource names to add to the list of tracked resources. - ResourceNamesSubscribe []string `protobuf:"bytes,3,rep,name=resource_names_subscribe,json=resourceNamesSubscribe,proto3" json:"resource_names_subscribe,omitempty"` - // A list of Resource names to remove from the list of tracked resources. - ResourceNamesUnsubscribe []string `protobuf:"bytes,4,rep,name=resource_names_unsubscribe,json=resourceNamesUnsubscribe,proto3" json:"resource_names_unsubscribe,omitempty"` - // [#not-implemented-hide:] - // Alternative to “resource_names_subscribe“ field that allows specifying dynamic parameters - // along with each resource name. - // Note that it is legal for a request to have some resources listed - // in “resource_names_subscribe“ and others in “resource_locators_subscribe“. - ResourceLocatorsSubscribe []*ResourceLocator `protobuf:"bytes,8,rep,name=resource_locators_subscribe,json=resourceLocatorsSubscribe,proto3" json:"resource_locators_subscribe,omitempty"` - // [#not-implemented-hide:] - // Alternative to “resource_names_unsubscribe“ field that allows specifying dynamic parameters - // along with each resource name. - // Note that it is legal for a request to have some resources listed - // in “resource_names_unsubscribe“ and others in “resource_locators_unsubscribe“. - ResourceLocatorsUnsubscribe []*ResourceLocator `protobuf:"bytes,9,rep,name=resource_locators_unsubscribe,json=resourceLocatorsUnsubscribe,proto3" json:"resource_locators_unsubscribe,omitempty"` - // Informs the server of the versions of the resources the xDS client knows of, to enable the - // client to continue the same logical xDS session even in the face of gRPC stream reconnection. - // It will not be populated: [1] in the very first stream of a session, since the client will - // not yet have any resources, [2] in any message after the first in a stream (for a given - // type_url), since the server will already be correctly tracking the client's state. - // (In ADS, the first message *of each type_url* of a reconnected stream populates this map.) - // The map's keys are names of xDS resources known to the xDS client. - // The map's values are opaque resource versions. - InitialResourceVersions map[string]string `protobuf:"bytes,5,rep,name=initial_resource_versions,json=initialResourceVersions,proto3" json:"initial_resource_versions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // When the DeltaDiscoveryRequest is a ACK or NACK message in response - // to a previous DeltaDiscoveryResponse, the response_nonce must be the - // nonce in the DeltaDiscoveryResponse. - // Otherwise (unlike in DiscoveryRequest) response_nonce must be omitted. - ResponseNonce string `protobuf:"bytes,6,opt,name=response_nonce,json=responseNonce,proto3" json:"response_nonce,omitempty"` - // This is populated when the previous :ref:`DiscoveryResponse ` - // failed to update configuration. The “message“ field in “error_details“ - // provides the Envoy internal exception related to the failure. - ErrorDetail *status.Status `protobuf:"bytes,7,opt,name=error_detail,json=errorDetail,proto3" json:"error_detail,omitempty"` -} - -func (x *DeltaDiscoveryRequest) Reset() { - *x = DeltaDiscoveryRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_service_discovery_v3_discovery_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeltaDiscoveryRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeltaDiscoveryRequest) ProtoMessage() {} - -func (x *DeltaDiscoveryRequest) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_discovery_v3_discovery_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeltaDiscoveryRequest.ProtoReflect.Descriptor instead. -func (*DeltaDiscoveryRequest) Descriptor() ([]byte, []int) { - return file_envoy_service_discovery_v3_discovery_proto_rawDescGZIP(), []int{4} -} - -func (x *DeltaDiscoveryRequest) GetNode() *v3.Node { - if x != nil { - return x.Node - } - return nil -} - -func (x *DeltaDiscoveryRequest) GetTypeUrl() string { - if x != nil { - return x.TypeUrl - } - return "" -} - -func (x *DeltaDiscoveryRequest) GetResourceNamesSubscribe() []string { - if x != nil { - return x.ResourceNamesSubscribe - } - return nil -} - -func (x *DeltaDiscoveryRequest) GetResourceNamesUnsubscribe() []string { - if x != nil { - return x.ResourceNamesUnsubscribe - } - return nil -} - -func (x *DeltaDiscoveryRequest) GetResourceLocatorsSubscribe() []*ResourceLocator { - if x != nil { - return x.ResourceLocatorsSubscribe - } - return nil -} - -func (x *DeltaDiscoveryRequest) GetResourceLocatorsUnsubscribe() []*ResourceLocator { - if x != nil { - return x.ResourceLocatorsUnsubscribe - } - return nil -} - -func (x *DeltaDiscoveryRequest) GetInitialResourceVersions() map[string]string { - if x != nil { - return x.InitialResourceVersions - } - return nil -} - -func (x *DeltaDiscoveryRequest) GetResponseNonce() string { - if x != nil { - return x.ResponseNonce - } - return "" -} - -func (x *DeltaDiscoveryRequest) GetErrorDetail() *status.Status { - if x != nil { - return x.ErrorDetail - } - return nil -} - -// [#next-free-field: 9] -type DeltaDiscoveryResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The version of the response data (used for debugging). - SystemVersionInfo string `protobuf:"bytes,1,opt,name=system_version_info,json=systemVersionInfo,proto3" json:"system_version_info,omitempty"` - // The response resources. These are typed resources, whose types must match - // the type_url field. - Resources []*Resource `protobuf:"bytes,2,rep,name=resources,proto3" json:"resources,omitempty"` - // Type URL for resources. Identifies the xDS API when muxing over ADS. - // Must be consistent with the type_url in the Any within 'resources' if 'resources' is non-empty. - TypeUrl string `protobuf:"bytes,4,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` - // Resources names of resources that have be deleted and to be removed from the xDS Client. - // Removed resources for missing resources can be ignored. - RemovedResources []string `protobuf:"bytes,6,rep,name=removed_resources,json=removedResources,proto3" json:"removed_resources,omitempty"` - // Alternative to removed_resources that allows specifying which variant of - // a resource is being removed. This variant must be used for any resource - // for which dynamic parameter constraints were sent to the client. - RemovedResourceNames []*ResourceName `protobuf:"bytes,8,rep,name=removed_resource_names,json=removedResourceNames,proto3" json:"removed_resource_names,omitempty"` - // The nonce provides a way for DeltaDiscoveryRequests to uniquely - // reference a DeltaDiscoveryResponse when (N)ACKing. The nonce is required. - Nonce string `protobuf:"bytes,5,opt,name=nonce,proto3" json:"nonce,omitempty"` - // [#not-implemented-hide:] - // The control plane instance that sent the response. - ControlPlane *v3.ControlPlane `protobuf:"bytes,7,opt,name=control_plane,json=controlPlane,proto3" json:"control_plane,omitempty"` -} - -func (x *DeltaDiscoveryResponse) Reset() { - *x = DeltaDiscoveryResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_service_discovery_v3_discovery_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeltaDiscoveryResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeltaDiscoveryResponse) ProtoMessage() {} - -func (x *DeltaDiscoveryResponse) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_discovery_v3_discovery_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeltaDiscoveryResponse.ProtoReflect.Descriptor instead. -func (*DeltaDiscoveryResponse) Descriptor() ([]byte, []int) { - return file_envoy_service_discovery_v3_discovery_proto_rawDescGZIP(), []int{5} -} - -func (x *DeltaDiscoveryResponse) GetSystemVersionInfo() string { - if x != nil { - return x.SystemVersionInfo - } - return "" -} - -func (x *DeltaDiscoveryResponse) GetResources() []*Resource { - if x != nil { - return x.Resources - } - return nil -} - -func (x *DeltaDiscoveryResponse) GetTypeUrl() string { - if x != nil { - return x.TypeUrl - } - return "" -} - -func (x *DeltaDiscoveryResponse) GetRemovedResources() []string { - if x != nil { - return x.RemovedResources - } - return nil -} - -func (x *DeltaDiscoveryResponse) GetRemovedResourceNames() []*ResourceName { - if x != nil { - return x.RemovedResourceNames - } - return nil -} - -func (x *DeltaDiscoveryResponse) GetNonce() string { - if x != nil { - return x.Nonce - } - return "" -} - -func (x *DeltaDiscoveryResponse) GetControlPlane() *v3.ControlPlane { - if x != nil { - return x.ControlPlane - } - return nil -} - -// A set of dynamic parameter constraints associated with a variant of an individual xDS resource. -// These constraints determine whether the resource matches a subscription based on the set of -// dynamic parameters in the subscription, as specified in the -// :ref:`ResourceLocator.dynamic_parameters` -// field. This allows xDS implementations (clients, servers, and caching proxies) to determine -// which variant of a resource is appropriate for a given client. -type DynamicParameterConstraints struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Type: - // - // *DynamicParameterConstraints_Constraint - // *DynamicParameterConstraints_OrConstraints - // *DynamicParameterConstraints_AndConstraints - // *DynamicParameterConstraints_NotConstraints - Type isDynamicParameterConstraints_Type `protobuf_oneof:"type"` -} - -func (x *DynamicParameterConstraints) Reset() { - *x = DynamicParameterConstraints{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_service_discovery_v3_discovery_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DynamicParameterConstraints) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DynamicParameterConstraints) ProtoMessage() {} - -func (x *DynamicParameterConstraints) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_discovery_v3_discovery_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DynamicParameterConstraints.ProtoReflect.Descriptor instead. -func (*DynamicParameterConstraints) Descriptor() ([]byte, []int) { - return file_envoy_service_discovery_v3_discovery_proto_rawDescGZIP(), []int{6} -} - -func (m *DynamicParameterConstraints) GetType() isDynamicParameterConstraints_Type { - if m != nil { - return m.Type - } - return nil -} - -func (x *DynamicParameterConstraints) GetConstraint() *DynamicParameterConstraints_SingleConstraint { - if x, ok := x.GetType().(*DynamicParameterConstraints_Constraint); ok { - return x.Constraint - } - return nil -} - -func (x *DynamicParameterConstraints) GetOrConstraints() *DynamicParameterConstraints_ConstraintList { - if x, ok := x.GetType().(*DynamicParameterConstraints_OrConstraints); ok { - return x.OrConstraints - } - return nil -} - -func (x *DynamicParameterConstraints) GetAndConstraints() *DynamicParameterConstraints_ConstraintList { - if x, ok := x.GetType().(*DynamicParameterConstraints_AndConstraints); ok { - return x.AndConstraints - } - return nil -} - -func (x *DynamicParameterConstraints) GetNotConstraints() *DynamicParameterConstraints { - if x, ok := x.GetType().(*DynamicParameterConstraints_NotConstraints); ok { - return x.NotConstraints - } - return nil -} - -type isDynamicParameterConstraints_Type interface { - isDynamicParameterConstraints_Type() -} - -type DynamicParameterConstraints_Constraint struct { - // A single constraint to evaluate. - Constraint *DynamicParameterConstraints_SingleConstraint `protobuf:"bytes,1,opt,name=constraint,proto3,oneof"` -} - -type DynamicParameterConstraints_OrConstraints struct { - // A list of constraints that match if any one constraint in the list - // matches. - OrConstraints *DynamicParameterConstraints_ConstraintList `protobuf:"bytes,2,opt,name=or_constraints,json=orConstraints,proto3,oneof"` -} - -type DynamicParameterConstraints_AndConstraints struct { - // A list of constraints that must all match. - AndConstraints *DynamicParameterConstraints_ConstraintList `protobuf:"bytes,3,opt,name=and_constraints,json=andConstraints,proto3,oneof"` -} - -type DynamicParameterConstraints_NotConstraints struct { - // The inverse (NOT) of a set of constraints. - NotConstraints *DynamicParameterConstraints `protobuf:"bytes,4,opt,name=not_constraints,json=notConstraints,proto3,oneof"` -} - -func (*DynamicParameterConstraints_Constraint) isDynamicParameterConstraints_Type() {} - -func (*DynamicParameterConstraints_OrConstraints) isDynamicParameterConstraints_Type() {} - -func (*DynamicParameterConstraints_AndConstraints) isDynamicParameterConstraints_Type() {} - -func (*DynamicParameterConstraints_NotConstraints) isDynamicParameterConstraints_Type() {} - -// [#next-free-field: 10] -type Resource struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The resource's name, to distinguish it from others of the same type of resource. - // Only one of “name“ or “resource_name“ may be set. - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - // Alternative to the “name“ field, to be used when the server supports - // multiple variants of the named resource that are differentiated by - // dynamic parameter constraints. - // Only one of “name“ or “resource_name“ may be set. - ResourceName *ResourceName `protobuf:"bytes,8,opt,name=resource_name,json=resourceName,proto3" json:"resource_name,omitempty"` - // The aliases are a list of other names that this resource can go by. - Aliases []string `protobuf:"bytes,4,rep,name=aliases,proto3" json:"aliases,omitempty"` - // The resource level version. It allows xDS to track the state of individual - // resources. - Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - // The resource being tracked. - Resource *anypb.Any `protobuf:"bytes,2,opt,name=resource,proto3" json:"resource,omitempty"` - // Time-to-live value for the resource. For each resource, a timer is started. The timer is - // reset each time the resource is received with a new TTL. If the resource is received with - // no TTL set, the timer is removed for the resource. Upon expiration of the timer, the - // configuration for the resource will be removed. - // - // The TTL can be refreshed or changed by sending a response that doesn't change the resource - // version. In this case the resource field does not need to be populated, which allows for - // light-weight "heartbeat" updates to keep a resource with a TTL alive. - // - // The TTL feature is meant to support configurations that should be removed in the event of - // a management server failure. For example, the feature may be used for fault injection - // testing where the fault injection should be terminated in the event that Envoy loses contact - // with the management server. - Ttl *durationpb.Duration `protobuf:"bytes,6,opt,name=ttl,proto3" json:"ttl,omitempty"` - // Cache control properties for the resource. - // [#not-implemented-hide:] - CacheControl *Resource_CacheControl `protobuf:"bytes,7,opt,name=cache_control,json=cacheControl,proto3" json:"cache_control,omitempty"` - // The Metadata field can be used to provide additional information for the resource. - // E.g. the trace data for debugging. - Metadata *v3.Metadata `protobuf:"bytes,9,opt,name=metadata,proto3" json:"metadata,omitempty"` -} - -func (x *Resource) Reset() { - *x = Resource{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_service_discovery_v3_discovery_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Resource) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Resource) ProtoMessage() {} - -func (x *Resource) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_discovery_v3_discovery_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Resource.ProtoReflect.Descriptor instead. -func (*Resource) Descriptor() ([]byte, []int) { - return file_envoy_service_discovery_v3_discovery_proto_rawDescGZIP(), []int{7} -} - -func (x *Resource) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Resource) GetResourceName() *ResourceName { - if x != nil { - return x.ResourceName - } - return nil -} - -func (x *Resource) GetAliases() []string { - if x != nil { - return x.Aliases - } - return nil -} - -func (x *Resource) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *Resource) GetResource() *anypb.Any { - if x != nil { - return x.Resource - } - return nil -} - -func (x *Resource) GetTtl() *durationpb.Duration { - if x != nil { - return x.Ttl - } - return nil -} - -func (x *Resource) GetCacheControl() *Resource_CacheControl { - if x != nil { - return x.CacheControl - } - return nil -} - -func (x *Resource) GetMetadata() *v3.Metadata { - if x != nil { - return x.Metadata - } - return nil -} - -// A single constraint for a given key. -type DynamicParameterConstraints_SingleConstraint struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The key to match against. - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // Types that are assignable to ConstraintType: - // - // *DynamicParameterConstraints_SingleConstraint_Value - // *DynamicParameterConstraints_SingleConstraint_Exists_ - ConstraintType isDynamicParameterConstraints_SingleConstraint_ConstraintType `protobuf_oneof:"constraint_type"` -} - -func (x *DynamicParameterConstraints_SingleConstraint) Reset() { - *x = DynamicParameterConstraints_SingleConstraint{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_service_discovery_v3_discovery_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DynamicParameterConstraints_SingleConstraint) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DynamicParameterConstraints_SingleConstraint) ProtoMessage() {} - -func (x *DynamicParameterConstraints_SingleConstraint) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_discovery_v3_discovery_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DynamicParameterConstraints_SingleConstraint.ProtoReflect.Descriptor instead. -func (*DynamicParameterConstraints_SingleConstraint) Descriptor() ([]byte, []int) { - return file_envoy_service_discovery_v3_discovery_proto_rawDescGZIP(), []int{6, 0} -} - -func (x *DynamicParameterConstraints_SingleConstraint) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (m *DynamicParameterConstraints_SingleConstraint) GetConstraintType() isDynamicParameterConstraints_SingleConstraint_ConstraintType { - if m != nil { - return m.ConstraintType - } - return nil -} - -func (x *DynamicParameterConstraints_SingleConstraint) GetValue() string { - if x, ok := x.GetConstraintType().(*DynamicParameterConstraints_SingleConstraint_Value); ok { - return x.Value - } - return "" -} - -func (x *DynamicParameterConstraints_SingleConstraint) GetExists() *DynamicParameterConstraints_SingleConstraint_Exists { - if x, ok := x.GetConstraintType().(*DynamicParameterConstraints_SingleConstraint_Exists_); ok { - return x.Exists - } - return nil -} - -type isDynamicParameterConstraints_SingleConstraint_ConstraintType interface { - isDynamicParameterConstraints_SingleConstraint_ConstraintType() -} - -type DynamicParameterConstraints_SingleConstraint_Value struct { - // Matches this exact value. - Value string `protobuf:"bytes,2,opt,name=value,proto3,oneof"` -} - -type DynamicParameterConstraints_SingleConstraint_Exists_ struct { - // Key is present (matches any value except for the key being absent). - // This allows setting a default constraint for clients that do - // not send a key at all, while there may be other clients that need - // special configuration based on that key. - Exists *DynamicParameterConstraints_SingleConstraint_Exists `protobuf:"bytes,3,opt,name=exists,proto3,oneof"` -} - -func (*DynamicParameterConstraints_SingleConstraint_Value) isDynamicParameterConstraints_SingleConstraint_ConstraintType() { -} - -func (*DynamicParameterConstraints_SingleConstraint_Exists_) isDynamicParameterConstraints_SingleConstraint_ConstraintType() { -} - -type DynamicParameterConstraints_ConstraintList struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Constraints []*DynamicParameterConstraints `protobuf:"bytes,1,rep,name=constraints,proto3" json:"constraints,omitempty"` -} - -func (x *DynamicParameterConstraints_ConstraintList) Reset() { - *x = DynamicParameterConstraints_ConstraintList{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_service_discovery_v3_discovery_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DynamicParameterConstraints_ConstraintList) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DynamicParameterConstraints_ConstraintList) ProtoMessage() {} - -func (x *DynamicParameterConstraints_ConstraintList) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_discovery_v3_discovery_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DynamicParameterConstraints_ConstraintList.ProtoReflect.Descriptor instead. -func (*DynamicParameterConstraints_ConstraintList) Descriptor() ([]byte, []int) { - return file_envoy_service_discovery_v3_discovery_proto_rawDescGZIP(), []int{6, 1} -} - -func (x *DynamicParameterConstraints_ConstraintList) GetConstraints() []*DynamicParameterConstraints { - if x != nil { - return x.Constraints - } - return nil -} - -type DynamicParameterConstraints_SingleConstraint_Exists struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *DynamicParameterConstraints_SingleConstraint_Exists) Reset() { - *x = DynamicParameterConstraints_SingleConstraint_Exists{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_service_discovery_v3_discovery_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DynamicParameterConstraints_SingleConstraint_Exists) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DynamicParameterConstraints_SingleConstraint_Exists) ProtoMessage() {} - -func (x *DynamicParameterConstraints_SingleConstraint_Exists) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_discovery_v3_discovery_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DynamicParameterConstraints_SingleConstraint_Exists.ProtoReflect.Descriptor instead. -func (*DynamicParameterConstraints_SingleConstraint_Exists) Descriptor() ([]byte, []int) { - return file_envoy_service_discovery_v3_discovery_proto_rawDescGZIP(), []int{6, 0, 0} -} - -// Cache control properties for the resource. -// [#not-implemented-hide:] -type Resource_CacheControl struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // If true, xDS proxies may not cache this resource. - // Note that this does not apply to clients other than xDS proxies, which must cache resources - // for their own use, regardless of the value of this field. - DoNotCache bool `protobuf:"varint,1,opt,name=do_not_cache,json=doNotCache,proto3" json:"do_not_cache,omitempty"` -} - -func (x *Resource_CacheControl) Reset() { - *x = Resource_CacheControl{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_service_discovery_v3_discovery_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Resource_CacheControl) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Resource_CacheControl) ProtoMessage() {} - -func (x *Resource_CacheControl) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_discovery_v3_discovery_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Resource_CacheControl.ProtoReflect.Descriptor instead. -func (*Resource_CacheControl) Descriptor() ([]byte, []int) { - return file_envoy_service_discovery_v3_discovery_proto_rawDescGZIP(), []int{7, 0} -} - -func (x *Resource_CacheControl) GetDoNotCache() bool { - if x != nil { - return x.DoNotCache - } - return false -} - -var File_envoy_service_discovery_v3_discovery_proto protoreflect.FileDescriptor - -var file_envoy_service_discovery_v3_discovery_proto_rawDesc = []byte{ - 0x0a, 0x2a, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, - 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x33, 0x2f, 0x64, 0x69, 0x73, - 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1a, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, - 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x33, 0x1a, 0x1f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x62, - 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x72, 0x70, 0x63, - 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x75, - 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x75, 0x64, - 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xde, 0x01, 0x0a, 0x0f, 0x52, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x71, 0x0a, 0x12, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x5f, 0x70, 0x61, 0x72, 0x61, - 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x42, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, - 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, - 0x63, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x52, 0x11, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, - 0x65, 0x72, 0x73, 0x1a, 0x44, 0x0a, 0x16, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x9f, 0x01, 0x0a, 0x0c, 0x52, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x7b, - 0x0a, 0x1d, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, - 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, - 0x76, 0x33, 0x2e, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, - 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x1b, - 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, - 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x22, 0x85, 0x03, 0x0a, 0x10, - 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x21, 0x0a, 0x0c, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x66, 0x6f, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x49, - 0x6e, 0x66, 0x6f, 0x12, 0x2e, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, - 0x6f, 0x64, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x72, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x11, 0x72, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x18, - 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, - 0x76, 0x33, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x74, - 0x6f, 0x72, 0x52, 0x10, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, - 0x74, 0x6f, 0x72, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x75, 0x72, 0x6c, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x79, 0x70, 0x65, 0x55, 0x72, 0x6c, 0x12, - 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x6e, 0x6f, 0x6e, 0x63, - 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x35, 0x0a, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, - 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x52, 0x0b, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x3a, 0x24, 0x9a, - 0xc5, 0x88, 0x1e, 0x1f, 0x0a, 0x1d, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x22, 0xa3, 0x02, 0x0a, 0x11, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, - 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0b, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x32, 0x0a, 0x09, - 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, - 0x12, 0x16, 0x0a, 0x06, 0x63, 0x61, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x06, 0x63, 0x61, 0x6e, 0x61, 0x72, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x79, 0x70, 0x65, - 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x79, 0x70, 0x65, - 0x55, 0x72, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x47, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x22, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, - 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x50, - 0x6c, 0x61, 0x6e, 0x65, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x50, 0x6c, 0x61, - 0x6e, 0x65, 0x3a, 0x25, 0x9a, 0xc5, 0x88, 0x1e, 0x20, 0x0a, 0x1e, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, - 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x9a, 0x06, 0x0a, 0x15, 0x44, 0x65, - 0x6c, 0x74, 0x61, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, - 0x6f, 0x64, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x79, 0x70, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x38, - 0x0a, 0x18, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, - 0x5f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x16, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x53, - 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x3c, 0x0a, 0x1a, 0x72, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x5f, 0x75, 0x6e, 0x73, 0x75, 0x62, - 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x18, 0x72, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x55, 0x6e, 0x73, 0x75, 0x62, - 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x6b, 0x0a, 0x1b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x5f, 0x73, 0x75, 0x62, 0x73, - 0x63, 0x72, 0x69, 0x62, 0x65, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, - 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x19, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, - 0x69, 0x62, 0x65, 0x12, 0x6f, 0x0a, 0x1d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, - 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x5f, 0x75, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x62, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, - 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x1b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x62, 0x65, 0x12, 0x8a, 0x01, 0x0a, 0x19, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, - 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x4e, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, - 0x72, 0x79, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x44, 0x69, 0x73, 0x63, 0x6f, - 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x49, 0x6e, 0x69, 0x74, - 0x69, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x17, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, - 0x6c, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x6e, 0x6f, - 0x6e, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x35, 0x0a, 0x0c, 0x65, 0x72, 0x72, 0x6f, - 0x72, 0x5f, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x52, 0x0b, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x1a, - 0x4a, 0x0a, 0x1c, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, - 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, - 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x3a, 0x29, 0x9a, 0xc5, 0x88, - 0x1e, 0x24, 0x0a, 0x22, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xbf, 0x03, 0x0a, 0x16, 0x44, 0x65, 0x6c, 0x74, 0x61, - 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x2e, 0x0a, 0x13, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, - 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, - 0x6f, 0x12, 0x42, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, - 0x33, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x75, 0x72, - 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x79, 0x70, 0x65, 0x55, 0x72, 0x6c, - 0x12, 0x2b, 0x0a, 0x11, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x5f, 0x72, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x72, 0x65, 0x6d, - 0x6f, 0x76, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x5e, 0x0a, - 0x16, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, - 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x14, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, - 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x14, 0x0a, - 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6e, 0x6f, - 0x6e, 0x63, 0x65, 0x12, 0x47, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x70, - 0x6c, 0x61, 0x6e, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, - 0x33, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x50, 0x6c, 0x61, 0x6e, 0x65, 0x52, 0x0c, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x50, 0x6c, 0x61, 0x6e, 0x65, 0x3a, 0x2a, 0x9a, 0xc5, - 0x88, 0x1e, 0x25, 0x0a, 0x23, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x32, 0x2e, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x92, 0x06, 0x0a, 0x1b, 0x44, 0x79, 0x6e, - 0x61, 0x6d, 0x69, 0x63, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, - 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x12, 0x6a, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x73, - 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x48, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, - 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, - 0x63, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, - 0x61, 0x69, 0x6e, 0x74, 0x73, 0x2e, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x73, - 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, - 0x61, 0x69, 0x6e, 0x74, 0x12, 0x6f, 0x0a, 0x0e, 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x74, - 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, - 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, - 0x63, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, - 0x61, 0x69, 0x6e, 0x74, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, - 0x4c, 0x69, 0x73, 0x74, 0x48, 0x00, 0x52, 0x0d, 0x6f, 0x72, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, - 0x61, 0x69, 0x6e, 0x74, 0x73, 0x12, 0x71, 0x0a, 0x0f, 0x61, 0x6e, 0x64, 0x5f, 0x63, 0x6f, 0x6e, - 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x46, - 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, - 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x79, 0x6e, 0x61, - 0x6d, 0x69, 0x63, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x73, - 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, - 0x6e, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x00, 0x52, 0x0e, 0x61, 0x6e, 0x64, 0x43, 0x6f, 0x6e, - 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x12, 0x62, 0x0a, 0x0f, 0x6e, 0x6f, 0x74, 0x5f, - 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x37, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x33, 0x2e, 0x44, - 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x43, - 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x48, 0x00, 0x52, 0x0e, 0x6e, 0x6f, - 0x74, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x1a, 0xc9, 0x01, 0x0a, - 0x10, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, - 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x12, 0x16, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x69, 0x0a, 0x06, 0x65, - 0x78, 0x69, 0x73, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x4f, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, - 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, - 0x69, 0x6e, 0x74, 0x73, 0x2e, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x73, 0x74, - 0x72, 0x61, 0x69, 0x6e, 0x74, 0x2e, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x48, 0x00, 0x52, 0x06, - 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, 0x1a, 0x08, 0x0a, 0x06, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, - 0x42, 0x16, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, 0x6b, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x73, - 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x59, 0x0a, 0x0b, 0x63, 0x6f, - 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x37, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, - 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x79, 0x6e, - 0x61, 0x6d, 0x69, 0x63, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, - 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, - 0x61, 0x69, 0x6e, 0x74, 0x73, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xe4, 0x03, - 0x0a, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x4d, - 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, - 0x76, 0x33, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x52, - 0x0c, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, - 0x07, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, - 0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x30, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x12, 0x2b, 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x74, 0x74, 0x6c, - 0x12, 0x56, 0x0a, 0x0d, 0x63, 0x61, 0x63, 0x68, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, - 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, - 0x79, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x43, 0x61, - 0x63, 0x68, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x52, 0x0c, 0x63, 0x61, 0x63, 0x68, - 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x12, 0x3a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, - 0x33, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x1a, 0x30, 0x0a, 0x0c, 0x43, 0x61, 0x63, 0x68, 0x65, 0x43, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x12, 0x20, 0x0a, 0x0c, 0x64, 0x6f, 0x5f, 0x6e, 0x6f, 0x74, 0x5f, 0x63, - 0x61, 0x63, 0x68, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x6f, 0x4e, 0x6f, - 0x74, 0x43, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x1c, 0x9a, 0xc5, 0x88, 0x1e, 0x17, 0x0a, 0x15, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x42, 0x93, 0x01, 0x0a, 0x28, 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, - 0x33, 0x42, 0x0e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x4d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, - 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, - 0x65, 0x72, 0x79, 0x2f, 0x76, 0x33, 0x3b, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, - 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_envoy_service_discovery_v3_discovery_proto_rawDescOnce sync.Once - file_envoy_service_discovery_v3_discovery_proto_rawDescData = file_envoy_service_discovery_v3_discovery_proto_rawDesc -) - -func file_envoy_service_discovery_v3_discovery_proto_rawDescGZIP() []byte { - file_envoy_service_discovery_v3_discovery_proto_rawDescOnce.Do(func() { - file_envoy_service_discovery_v3_discovery_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_service_discovery_v3_discovery_proto_rawDescData) - }) - return file_envoy_service_discovery_v3_discovery_proto_rawDescData -} - -var file_envoy_service_discovery_v3_discovery_proto_msgTypes = make([]protoimpl.MessageInfo, 14) -var file_envoy_service_discovery_v3_discovery_proto_goTypes = []interface{}{ - (*ResourceLocator)(nil), // 0: envoy.service.discovery.v3.ResourceLocator - (*ResourceName)(nil), // 1: envoy.service.discovery.v3.ResourceName - (*DiscoveryRequest)(nil), // 2: envoy.service.discovery.v3.DiscoveryRequest - (*DiscoveryResponse)(nil), // 3: envoy.service.discovery.v3.DiscoveryResponse - (*DeltaDiscoveryRequest)(nil), // 4: envoy.service.discovery.v3.DeltaDiscoveryRequest - (*DeltaDiscoveryResponse)(nil), // 5: envoy.service.discovery.v3.DeltaDiscoveryResponse - (*DynamicParameterConstraints)(nil), // 6: envoy.service.discovery.v3.DynamicParameterConstraints - (*Resource)(nil), // 7: envoy.service.discovery.v3.Resource - nil, // 8: envoy.service.discovery.v3.ResourceLocator.DynamicParametersEntry - nil, // 9: envoy.service.discovery.v3.DeltaDiscoveryRequest.InitialResourceVersionsEntry - (*DynamicParameterConstraints_SingleConstraint)(nil), // 10: envoy.service.discovery.v3.DynamicParameterConstraints.SingleConstraint - (*DynamicParameterConstraints_ConstraintList)(nil), // 11: envoy.service.discovery.v3.DynamicParameterConstraints.ConstraintList - (*DynamicParameterConstraints_SingleConstraint_Exists)(nil), // 12: envoy.service.discovery.v3.DynamicParameterConstraints.SingleConstraint.Exists - (*Resource_CacheControl)(nil), // 13: envoy.service.discovery.v3.Resource.CacheControl - (*v3.Node)(nil), // 14: envoy.config.core.v3.Node - (*status.Status)(nil), // 15: google.rpc.Status - (*anypb.Any)(nil), // 16: google.protobuf.Any - (*v3.ControlPlane)(nil), // 17: envoy.config.core.v3.ControlPlane - (*durationpb.Duration)(nil), // 18: google.protobuf.Duration - (*v3.Metadata)(nil), // 19: envoy.config.core.v3.Metadata -} -var file_envoy_service_discovery_v3_discovery_proto_depIdxs = []int32{ - 8, // 0: envoy.service.discovery.v3.ResourceLocator.dynamic_parameters:type_name -> envoy.service.discovery.v3.ResourceLocator.DynamicParametersEntry - 6, // 1: envoy.service.discovery.v3.ResourceName.dynamic_parameter_constraints:type_name -> envoy.service.discovery.v3.DynamicParameterConstraints - 14, // 2: envoy.service.discovery.v3.DiscoveryRequest.node:type_name -> envoy.config.core.v3.Node - 0, // 3: envoy.service.discovery.v3.DiscoveryRequest.resource_locators:type_name -> envoy.service.discovery.v3.ResourceLocator - 15, // 4: envoy.service.discovery.v3.DiscoveryRequest.error_detail:type_name -> google.rpc.Status - 16, // 5: envoy.service.discovery.v3.DiscoveryResponse.resources:type_name -> google.protobuf.Any - 17, // 6: envoy.service.discovery.v3.DiscoveryResponse.control_plane:type_name -> envoy.config.core.v3.ControlPlane - 14, // 7: envoy.service.discovery.v3.DeltaDiscoveryRequest.node:type_name -> envoy.config.core.v3.Node - 0, // 8: envoy.service.discovery.v3.DeltaDiscoveryRequest.resource_locators_subscribe:type_name -> envoy.service.discovery.v3.ResourceLocator - 0, // 9: envoy.service.discovery.v3.DeltaDiscoveryRequest.resource_locators_unsubscribe:type_name -> envoy.service.discovery.v3.ResourceLocator - 9, // 10: envoy.service.discovery.v3.DeltaDiscoveryRequest.initial_resource_versions:type_name -> envoy.service.discovery.v3.DeltaDiscoveryRequest.InitialResourceVersionsEntry - 15, // 11: envoy.service.discovery.v3.DeltaDiscoveryRequest.error_detail:type_name -> google.rpc.Status - 7, // 12: envoy.service.discovery.v3.DeltaDiscoveryResponse.resources:type_name -> envoy.service.discovery.v3.Resource - 1, // 13: envoy.service.discovery.v3.DeltaDiscoveryResponse.removed_resource_names:type_name -> envoy.service.discovery.v3.ResourceName - 17, // 14: envoy.service.discovery.v3.DeltaDiscoveryResponse.control_plane:type_name -> envoy.config.core.v3.ControlPlane - 10, // 15: envoy.service.discovery.v3.DynamicParameterConstraints.constraint:type_name -> envoy.service.discovery.v3.DynamicParameterConstraints.SingleConstraint - 11, // 16: envoy.service.discovery.v3.DynamicParameterConstraints.or_constraints:type_name -> envoy.service.discovery.v3.DynamicParameterConstraints.ConstraintList - 11, // 17: envoy.service.discovery.v3.DynamicParameterConstraints.and_constraints:type_name -> envoy.service.discovery.v3.DynamicParameterConstraints.ConstraintList - 6, // 18: envoy.service.discovery.v3.DynamicParameterConstraints.not_constraints:type_name -> envoy.service.discovery.v3.DynamicParameterConstraints - 1, // 19: envoy.service.discovery.v3.Resource.resource_name:type_name -> envoy.service.discovery.v3.ResourceName - 16, // 20: envoy.service.discovery.v3.Resource.resource:type_name -> google.protobuf.Any - 18, // 21: envoy.service.discovery.v3.Resource.ttl:type_name -> google.protobuf.Duration - 13, // 22: envoy.service.discovery.v3.Resource.cache_control:type_name -> envoy.service.discovery.v3.Resource.CacheControl - 19, // 23: envoy.service.discovery.v3.Resource.metadata:type_name -> envoy.config.core.v3.Metadata - 12, // 24: envoy.service.discovery.v3.DynamicParameterConstraints.SingleConstraint.exists:type_name -> envoy.service.discovery.v3.DynamicParameterConstraints.SingleConstraint.Exists - 6, // 25: envoy.service.discovery.v3.DynamicParameterConstraints.ConstraintList.constraints:type_name -> envoy.service.discovery.v3.DynamicParameterConstraints - 26, // [26:26] is the sub-list for method output_type - 26, // [26:26] is the sub-list for method input_type - 26, // [26:26] is the sub-list for extension type_name - 26, // [26:26] is the sub-list for extension extendee - 0, // [0:26] is the sub-list for field type_name -} - -func init() { file_envoy_service_discovery_v3_discovery_proto_init() } -func file_envoy_service_discovery_v3_discovery_proto_init() { - if File_envoy_service_discovery_v3_discovery_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_envoy_service_discovery_v3_discovery_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResourceLocator); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_service_discovery_v3_discovery_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResourceName); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_service_discovery_v3_discovery_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DiscoveryRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_service_discovery_v3_discovery_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DiscoveryResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_service_discovery_v3_discovery_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeltaDiscoveryRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_service_discovery_v3_discovery_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeltaDiscoveryResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_service_discovery_v3_discovery_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DynamicParameterConstraints); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_service_discovery_v3_discovery_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Resource); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_service_discovery_v3_discovery_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DynamicParameterConstraints_SingleConstraint); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_service_discovery_v3_discovery_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DynamicParameterConstraints_ConstraintList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_service_discovery_v3_discovery_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DynamicParameterConstraints_SingleConstraint_Exists); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_service_discovery_v3_discovery_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Resource_CacheControl); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_service_discovery_v3_discovery_proto_msgTypes[6].OneofWrappers = []interface{}{ - (*DynamicParameterConstraints_Constraint)(nil), - (*DynamicParameterConstraints_OrConstraints)(nil), - (*DynamicParameterConstraints_AndConstraints)(nil), - (*DynamicParameterConstraints_NotConstraints)(nil), - } - file_envoy_service_discovery_v3_discovery_proto_msgTypes[10].OneofWrappers = []interface{}{ - (*DynamicParameterConstraints_SingleConstraint_Value)(nil), - (*DynamicParameterConstraints_SingleConstraint_Exists_)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_service_discovery_v3_discovery_proto_rawDesc, - NumEnums: 0, - NumMessages: 14, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_service_discovery_v3_discovery_proto_goTypes, - DependencyIndexes: file_envoy_service_discovery_v3_discovery_proto_depIdxs, - MessageInfos: file_envoy_service_discovery_v3_discovery_proto_msgTypes, - }.Build() - File_envoy_service_discovery_v3_discovery_proto = out.File - file_envoy_service_discovery_v3_discovery_proto_rawDesc = nil - file_envoy_service_discovery_v3_discovery_proto_goTypes = nil - file_envoy_service_discovery_v3_discovery_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/service/discovery/v3/discovery.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/service/discovery/v3/discovery.pb.validate.go deleted file mode 100644 index 913cdb609..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/service/discovery/v3/discovery.pb.validate.go +++ /dev/null @@ -1,2138 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/service/discovery/v3/discovery.proto - -package discoveryv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on ResourceLocator with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *ResourceLocator) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ResourceLocator with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ResourceLocatorMultiError, or nil if none found. -func (m *ResourceLocator) ValidateAll() error { - return m.validate(true) -} - -func (m *ResourceLocator) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Name - - // no validation rules for DynamicParameters - - if len(errors) > 0 { - return ResourceLocatorMultiError(errors) - } - - return nil -} - -// ResourceLocatorMultiError is an error wrapping multiple validation errors -// returned by ResourceLocator.ValidateAll() if the designated constraints -// aren't met. -type ResourceLocatorMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ResourceLocatorMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ResourceLocatorMultiError) AllErrors() []error { return m } - -// ResourceLocatorValidationError is the validation error returned by -// ResourceLocator.Validate if the designated constraints aren't met. -type ResourceLocatorValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ResourceLocatorValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ResourceLocatorValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ResourceLocatorValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ResourceLocatorValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ResourceLocatorValidationError) ErrorName() string { return "ResourceLocatorValidationError" } - -// Error satisfies the builtin error interface -func (e ResourceLocatorValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sResourceLocator.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ResourceLocatorValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ResourceLocatorValidationError{} - -// Validate checks the field values on ResourceName with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *ResourceName) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ResourceName with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in ResourceNameMultiError, or -// nil if none found. -func (m *ResourceName) ValidateAll() error { - return m.validate(true) -} - -func (m *ResourceName) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Name - - if all { - switch v := interface{}(m.GetDynamicParameterConstraints()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ResourceNameValidationError{ - field: "DynamicParameterConstraints", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ResourceNameValidationError{ - field: "DynamicParameterConstraints", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDynamicParameterConstraints()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ResourceNameValidationError{ - field: "DynamicParameterConstraints", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return ResourceNameMultiError(errors) - } - - return nil -} - -// ResourceNameMultiError is an error wrapping multiple validation errors -// returned by ResourceName.ValidateAll() if the designated constraints aren't met. -type ResourceNameMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ResourceNameMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ResourceNameMultiError) AllErrors() []error { return m } - -// ResourceNameValidationError is the validation error returned by -// ResourceName.Validate if the designated constraints aren't met. -type ResourceNameValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ResourceNameValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ResourceNameValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ResourceNameValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ResourceNameValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ResourceNameValidationError) ErrorName() string { return "ResourceNameValidationError" } - -// Error satisfies the builtin error interface -func (e ResourceNameValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sResourceName.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ResourceNameValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ResourceNameValidationError{} - -// Validate checks the field values on DiscoveryRequest with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *DiscoveryRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DiscoveryRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// DiscoveryRequestMultiError, or nil if none found. -func (m *DiscoveryRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *DiscoveryRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for VersionInfo - - if all { - switch v := interface{}(m.GetNode()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DiscoveryRequestValidationError{ - field: "Node", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DiscoveryRequestValidationError{ - field: "Node", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetNode()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DiscoveryRequestValidationError{ - field: "Node", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetResourceLocators() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DiscoveryRequestValidationError{ - field: fmt.Sprintf("ResourceLocators[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DiscoveryRequestValidationError{ - field: fmt.Sprintf("ResourceLocators[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DiscoveryRequestValidationError{ - field: fmt.Sprintf("ResourceLocators[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - // no validation rules for TypeUrl - - // no validation rules for ResponseNonce - - if all { - switch v := interface{}(m.GetErrorDetail()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DiscoveryRequestValidationError{ - field: "ErrorDetail", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DiscoveryRequestValidationError{ - field: "ErrorDetail", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetErrorDetail()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DiscoveryRequestValidationError{ - field: "ErrorDetail", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return DiscoveryRequestMultiError(errors) - } - - return nil -} - -// DiscoveryRequestMultiError is an error wrapping multiple validation errors -// returned by DiscoveryRequest.ValidateAll() if the designated constraints -// aren't met. -type DiscoveryRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DiscoveryRequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DiscoveryRequestMultiError) AllErrors() []error { return m } - -// DiscoveryRequestValidationError is the validation error returned by -// DiscoveryRequest.Validate if the designated constraints aren't met. -type DiscoveryRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DiscoveryRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DiscoveryRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DiscoveryRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DiscoveryRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DiscoveryRequestValidationError) ErrorName() string { return "DiscoveryRequestValidationError" } - -// Error satisfies the builtin error interface -func (e DiscoveryRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDiscoveryRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DiscoveryRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DiscoveryRequestValidationError{} - -// Validate checks the field values on DiscoveryResponse with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *DiscoveryResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DiscoveryResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// DiscoveryResponseMultiError, or nil if none found. -func (m *DiscoveryResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *DiscoveryResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for VersionInfo - - for idx, item := range m.GetResources() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DiscoveryResponseValidationError{ - field: fmt.Sprintf("Resources[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DiscoveryResponseValidationError{ - field: fmt.Sprintf("Resources[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DiscoveryResponseValidationError{ - field: fmt.Sprintf("Resources[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - // no validation rules for Canary - - // no validation rules for TypeUrl - - // no validation rules for Nonce - - if all { - switch v := interface{}(m.GetControlPlane()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DiscoveryResponseValidationError{ - field: "ControlPlane", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DiscoveryResponseValidationError{ - field: "ControlPlane", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetControlPlane()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DiscoveryResponseValidationError{ - field: "ControlPlane", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return DiscoveryResponseMultiError(errors) - } - - return nil -} - -// DiscoveryResponseMultiError is an error wrapping multiple validation errors -// returned by DiscoveryResponse.ValidateAll() if the designated constraints -// aren't met. -type DiscoveryResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DiscoveryResponseMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DiscoveryResponseMultiError) AllErrors() []error { return m } - -// DiscoveryResponseValidationError is the validation error returned by -// DiscoveryResponse.Validate if the designated constraints aren't met. -type DiscoveryResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DiscoveryResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DiscoveryResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DiscoveryResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DiscoveryResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DiscoveryResponseValidationError) ErrorName() string { - return "DiscoveryResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e DiscoveryResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDiscoveryResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DiscoveryResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DiscoveryResponseValidationError{} - -// Validate checks the field values on DeltaDiscoveryRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *DeltaDiscoveryRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DeltaDiscoveryRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// DeltaDiscoveryRequestMultiError, or nil if none found. -func (m *DeltaDiscoveryRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *DeltaDiscoveryRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetNode()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DeltaDiscoveryRequestValidationError{ - field: "Node", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DeltaDiscoveryRequestValidationError{ - field: "Node", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetNode()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DeltaDiscoveryRequestValidationError{ - field: "Node", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for TypeUrl - - for idx, item := range m.GetResourceLocatorsSubscribe() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DeltaDiscoveryRequestValidationError{ - field: fmt.Sprintf("ResourceLocatorsSubscribe[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DeltaDiscoveryRequestValidationError{ - field: fmt.Sprintf("ResourceLocatorsSubscribe[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DeltaDiscoveryRequestValidationError{ - field: fmt.Sprintf("ResourceLocatorsSubscribe[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetResourceLocatorsUnsubscribe() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DeltaDiscoveryRequestValidationError{ - field: fmt.Sprintf("ResourceLocatorsUnsubscribe[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DeltaDiscoveryRequestValidationError{ - field: fmt.Sprintf("ResourceLocatorsUnsubscribe[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DeltaDiscoveryRequestValidationError{ - field: fmt.Sprintf("ResourceLocatorsUnsubscribe[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - // no validation rules for InitialResourceVersions - - // no validation rules for ResponseNonce - - if all { - switch v := interface{}(m.GetErrorDetail()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DeltaDiscoveryRequestValidationError{ - field: "ErrorDetail", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DeltaDiscoveryRequestValidationError{ - field: "ErrorDetail", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetErrorDetail()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DeltaDiscoveryRequestValidationError{ - field: "ErrorDetail", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return DeltaDiscoveryRequestMultiError(errors) - } - - return nil -} - -// DeltaDiscoveryRequestMultiError is an error wrapping multiple validation -// errors returned by DeltaDiscoveryRequest.ValidateAll() if the designated -// constraints aren't met. -type DeltaDiscoveryRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DeltaDiscoveryRequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DeltaDiscoveryRequestMultiError) AllErrors() []error { return m } - -// DeltaDiscoveryRequestValidationError is the validation error returned by -// DeltaDiscoveryRequest.Validate if the designated constraints aren't met. -type DeltaDiscoveryRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DeltaDiscoveryRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DeltaDiscoveryRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DeltaDiscoveryRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DeltaDiscoveryRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DeltaDiscoveryRequestValidationError) ErrorName() string { - return "DeltaDiscoveryRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e DeltaDiscoveryRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDeltaDiscoveryRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DeltaDiscoveryRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DeltaDiscoveryRequestValidationError{} - -// Validate checks the field values on DeltaDiscoveryResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *DeltaDiscoveryResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DeltaDiscoveryResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// DeltaDiscoveryResponseMultiError, or nil if none found. -func (m *DeltaDiscoveryResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *DeltaDiscoveryResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for SystemVersionInfo - - for idx, item := range m.GetResources() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DeltaDiscoveryResponseValidationError{ - field: fmt.Sprintf("Resources[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DeltaDiscoveryResponseValidationError{ - field: fmt.Sprintf("Resources[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DeltaDiscoveryResponseValidationError{ - field: fmt.Sprintf("Resources[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - // no validation rules for TypeUrl - - for idx, item := range m.GetRemovedResourceNames() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DeltaDiscoveryResponseValidationError{ - field: fmt.Sprintf("RemovedResourceNames[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DeltaDiscoveryResponseValidationError{ - field: fmt.Sprintf("RemovedResourceNames[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DeltaDiscoveryResponseValidationError{ - field: fmt.Sprintf("RemovedResourceNames[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - // no validation rules for Nonce - - if all { - switch v := interface{}(m.GetControlPlane()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DeltaDiscoveryResponseValidationError{ - field: "ControlPlane", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DeltaDiscoveryResponseValidationError{ - field: "ControlPlane", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetControlPlane()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DeltaDiscoveryResponseValidationError{ - field: "ControlPlane", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return DeltaDiscoveryResponseMultiError(errors) - } - - return nil -} - -// DeltaDiscoveryResponseMultiError is an error wrapping multiple validation -// errors returned by DeltaDiscoveryResponse.ValidateAll() if the designated -// constraints aren't met. -type DeltaDiscoveryResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DeltaDiscoveryResponseMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DeltaDiscoveryResponseMultiError) AllErrors() []error { return m } - -// DeltaDiscoveryResponseValidationError is the validation error returned by -// DeltaDiscoveryResponse.Validate if the designated constraints aren't met. -type DeltaDiscoveryResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DeltaDiscoveryResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DeltaDiscoveryResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DeltaDiscoveryResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DeltaDiscoveryResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DeltaDiscoveryResponseValidationError) ErrorName() string { - return "DeltaDiscoveryResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e DeltaDiscoveryResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDeltaDiscoveryResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DeltaDiscoveryResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DeltaDiscoveryResponseValidationError{} - -// Validate checks the field values on DynamicParameterConstraints with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *DynamicParameterConstraints) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DynamicParameterConstraints with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// DynamicParameterConstraintsMultiError, or nil if none found. -func (m *DynamicParameterConstraints) ValidateAll() error { - return m.validate(true) -} - -func (m *DynamicParameterConstraints) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - switch v := m.Type.(type) { - case *DynamicParameterConstraints_Constraint: - if v == nil { - err := DynamicParameterConstraintsValidationError{ - field: "Type", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetConstraint()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DynamicParameterConstraintsValidationError{ - field: "Constraint", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DynamicParameterConstraintsValidationError{ - field: "Constraint", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetConstraint()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DynamicParameterConstraintsValidationError{ - field: "Constraint", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *DynamicParameterConstraints_OrConstraints: - if v == nil { - err := DynamicParameterConstraintsValidationError{ - field: "Type", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetOrConstraints()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DynamicParameterConstraintsValidationError{ - field: "OrConstraints", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DynamicParameterConstraintsValidationError{ - field: "OrConstraints", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetOrConstraints()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DynamicParameterConstraintsValidationError{ - field: "OrConstraints", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *DynamicParameterConstraints_AndConstraints: - if v == nil { - err := DynamicParameterConstraintsValidationError{ - field: "Type", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetAndConstraints()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DynamicParameterConstraintsValidationError{ - field: "AndConstraints", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DynamicParameterConstraintsValidationError{ - field: "AndConstraints", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetAndConstraints()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DynamicParameterConstraintsValidationError{ - field: "AndConstraints", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *DynamicParameterConstraints_NotConstraints: - if v == nil { - err := DynamicParameterConstraintsValidationError{ - field: "Type", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetNotConstraints()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DynamicParameterConstraintsValidationError{ - field: "NotConstraints", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DynamicParameterConstraintsValidationError{ - field: "NotConstraints", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetNotConstraints()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DynamicParameterConstraintsValidationError{ - field: "NotConstraints", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return DynamicParameterConstraintsMultiError(errors) - } - - return nil -} - -// DynamicParameterConstraintsMultiError is an error wrapping multiple -// validation errors returned by DynamicParameterConstraints.ValidateAll() if -// the designated constraints aren't met. -type DynamicParameterConstraintsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DynamicParameterConstraintsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DynamicParameterConstraintsMultiError) AllErrors() []error { return m } - -// DynamicParameterConstraintsValidationError is the validation error returned -// by DynamicParameterConstraints.Validate if the designated constraints -// aren't met. -type DynamicParameterConstraintsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DynamicParameterConstraintsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DynamicParameterConstraintsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DynamicParameterConstraintsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DynamicParameterConstraintsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DynamicParameterConstraintsValidationError) ErrorName() string { - return "DynamicParameterConstraintsValidationError" -} - -// Error satisfies the builtin error interface -func (e DynamicParameterConstraintsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDynamicParameterConstraints.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DynamicParameterConstraintsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DynamicParameterConstraintsValidationError{} - -// Validate checks the field values on Resource with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Resource) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Resource with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in ResourceMultiError, or nil -// if none found. -func (m *Resource) ValidateAll() error { - return m.validate(true) -} - -func (m *Resource) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Name - - if all { - switch v := interface{}(m.GetResourceName()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ResourceValidationError{ - field: "ResourceName", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ResourceValidationError{ - field: "ResourceName", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetResourceName()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ResourceValidationError{ - field: "ResourceName", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for Version - - if all { - switch v := interface{}(m.GetResource()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ResourceValidationError{ - field: "Resource", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ResourceValidationError{ - field: "Resource", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetResource()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ResourceValidationError{ - field: "Resource", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetTtl()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ResourceValidationError{ - field: "Ttl", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ResourceValidationError{ - field: "Ttl", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTtl()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ResourceValidationError{ - field: "Ttl", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetCacheControl()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ResourceValidationError{ - field: "CacheControl", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ResourceValidationError{ - field: "CacheControl", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCacheControl()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ResourceValidationError{ - field: "CacheControl", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetMetadata()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ResourceValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ResourceValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ResourceValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return ResourceMultiError(errors) - } - - return nil -} - -// ResourceMultiError is an error wrapping multiple validation errors returned -// by Resource.ValidateAll() if the designated constraints aren't met. -type ResourceMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ResourceMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ResourceMultiError) AllErrors() []error { return m } - -// ResourceValidationError is the validation error returned by -// Resource.Validate if the designated constraints aren't met. -type ResourceValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ResourceValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ResourceValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ResourceValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ResourceValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ResourceValidationError) ErrorName() string { return "ResourceValidationError" } - -// Error satisfies the builtin error interface -func (e ResourceValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sResource.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ResourceValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ResourceValidationError{} - -// Validate checks the field values on -// DynamicParameterConstraints_SingleConstraint with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *DynamicParameterConstraints_SingleConstraint) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on -// DynamicParameterConstraints_SingleConstraint with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in -// DynamicParameterConstraints_SingleConstraintMultiError, or nil if none found. -func (m *DynamicParameterConstraints_SingleConstraint) ValidateAll() error { - return m.validate(true) -} - -func (m *DynamicParameterConstraints_SingleConstraint) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Key - - oneofConstraintTypePresent := false - switch v := m.ConstraintType.(type) { - case *DynamicParameterConstraints_SingleConstraint_Value: - if v == nil { - err := DynamicParameterConstraints_SingleConstraintValidationError{ - field: "ConstraintType", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofConstraintTypePresent = true - // no validation rules for Value - case *DynamicParameterConstraints_SingleConstraint_Exists_: - if v == nil { - err := DynamicParameterConstraints_SingleConstraintValidationError{ - field: "ConstraintType", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofConstraintTypePresent = true - - if all { - switch v := interface{}(m.GetExists()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DynamicParameterConstraints_SingleConstraintValidationError{ - field: "Exists", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DynamicParameterConstraints_SingleConstraintValidationError{ - field: "Exists", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetExists()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DynamicParameterConstraints_SingleConstraintValidationError{ - field: "Exists", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofConstraintTypePresent { - err := DynamicParameterConstraints_SingleConstraintValidationError{ - field: "ConstraintType", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return DynamicParameterConstraints_SingleConstraintMultiError(errors) - } - - return nil -} - -// DynamicParameterConstraints_SingleConstraintMultiError is an error wrapping -// multiple validation errors returned by -// DynamicParameterConstraints_SingleConstraint.ValidateAll() if the -// designated constraints aren't met. -type DynamicParameterConstraints_SingleConstraintMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DynamicParameterConstraints_SingleConstraintMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DynamicParameterConstraints_SingleConstraintMultiError) AllErrors() []error { return m } - -// DynamicParameterConstraints_SingleConstraintValidationError is the -// validation error returned by -// DynamicParameterConstraints_SingleConstraint.Validate if the designated -// constraints aren't met. -type DynamicParameterConstraints_SingleConstraintValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DynamicParameterConstraints_SingleConstraintValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DynamicParameterConstraints_SingleConstraintValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DynamicParameterConstraints_SingleConstraintValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DynamicParameterConstraints_SingleConstraintValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DynamicParameterConstraints_SingleConstraintValidationError) ErrorName() string { - return "DynamicParameterConstraints_SingleConstraintValidationError" -} - -// Error satisfies the builtin error interface -func (e DynamicParameterConstraints_SingleConstraintValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDynamicParameterConstraints_SingleConstraint.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DynamicParameterConstraints_SingleConstraintValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DynamicParameterConstraints_SingleConstraintValidationError{} - -// Validate checks the field values on -// DynamicParameterConstraints_ConstraintList with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *DynamicParameterConstraints_ConstraintList) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on -// DynamicParameterConstraints_ConstraintList with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in -// DynamicParameterConstraints_ConstraintListMultiError, or nil if none found. -func (m *DynamicParameterConstraints_ConstraintList) ValidateAll() error { - return m.validate(true) -} - -func (m *DynamicParameterConstraints_ConstraintList) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetConstraints() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DynamicParameterConstraints_ConstraintListValidationError{ - field: fmt.Sprintf("Constraints[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DynamicParameterConstraints_ConstraintListValidationError{ - field: fmt.Sprintf("Constraints[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DynamicParameterConstraints_ConstraintListValidationError{ - field: fmt.Sprintf("Constraints[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return DynamicParameterConstraints_ConstraintListMultiError(errors) - } - - return nil -} - -// DynamicParameterConstraints_ConstraintListMultiError is an error wrapping -// multiple validation errors returned by -// DynamicParameterConstraints_ConstraintList.ValidateAll() if the designated -// constraints aren't met. -type DynamicParameterConstraints_ConstraintListMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DynamicParameterConstraints_ConstraintListMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DynamicParameterConstraints_ConstraintListMultiError) AllErrors() []error { return m } - -// DynamicParameterConstraints_ConstraintListValidationError is the validation -// error returned by DynamicParameterConstraints_ConstraintList.Validate if -// the designated constraints aren't met. -type DynamicParameterConstraints_ConstraintListValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DynamicParameterConstraints_ConstraintListValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DynamicParameterConstraints_ConstraintListValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DynamicParameterConstraints_ConstraintListValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DynamicParameterConstraints_ConstraintListValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DynamicParameterConstraints_ConstraintListValidationError) ErrorName() string { - return "DynamicParameterConstraints_ConstraintListValidationError" -} - -// Error satisfies the builtin error interface -func (e DynamicParameterConstraints_ConstraintListValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDynamicParameterConstraints_ConstraintList.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DynamicParameterConstraints_ConstraintListValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DynamicParameterConstraints_ConstraintListValidationError{} - -// Validate checks the field values on -// DynamicParameterConstraints_SingleConstraint_Exists with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *DynamicParameterConstraints_SingleConstraint_Exists) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on -// DynamicParameterConstraints_SingleConstraint_Exists with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in -// DynamicParameterConstraints_SingleConstraint_ExistsMultiError, or nil if -// none found. -func (m *DynamicParameterConstraints_SingleConstraint_Exists) ValidateAll() error { - return m.validate(true) -} - -func (m *DynamicParameterConstraints_SingleConstraint_Exists) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return DynamicParameterConstraints_SingleConstraint_ExistsMultiError(errors) - } - - return nil -} - -// DynamicParameterConstraints_SingleConstraint_ExistsMultiError is an error -// wrapping multiple validation errors returned by -// DynamicParameterConstraints_SingleConstraint_Exists.ValidateAll() if the -// designated constraints aren't met. -type DynamicParameterConstraints_SingleConstraint_ExistsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DynamicParameterConstraints_SingleConstraint_ExistsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DynamicParameterConstraints_SingleConstraint_ExistsMultiError) AllErrors() []error { return m } - -// DynamicParameterConstraints_SingleConstraint_ExistsValidationError is the -// validation error returned by -// DynamicParameterConstraints_SingleConstraint_Exists.Validate if the -// designated constraints aren't met. -type DynamicParameterConstraints_SingleConstraint_ExistsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DynamicParameterConstraints_SingleConstraint_ExistsValidationError) Field() string { - return e.field -} - -// Reason function returns reason value. -func (e DynamicParameterConstraints_SingleConstraint_ExistsValidationError) Reason() string { - return e.reason -} - -// Cause function returns cause value. -func (e DynamicParameterConstraints_SingleConstraint_ExistsValidationError) Cause() error { - return e.cause -} - -// Key function returns key value. -func (e DynamicParameterConstraints_SingleConstraint_ExistsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DynamicParameterConstraints_SingleConstraint_ExistsValidationError) ErrorName() string { - return "DynamicParameterConstraints_SingleConstraint_ExistsValidationError" -} - -// Error satisfies the builtin error interface -func (e DynamicParameterConstraints_SingleConstraint_ExistsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDynamicParameterConstraints_SingleConstraint_Exists.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DynamicParameterConstraints_SingleConstraint_ExistsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DynamicParameterConstraints_SingleConstraint_ExistsValidationError{} - -// Validate checks the field values on Resource_CacheControl with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *Resource_CacheControl) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Resource_CacheControl with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// Resource_CacheControlMultiError, or nil if none found. -func (m *Resource_CacheControl) ValidateAll() error { - return m.validate(true) -} - -func (m *Resource_CacheControl) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for DoNotCache - - if len(errors) > 0 { - return Resource_CacheControlMultiError(errors) - } - - return nil -} - -// Resource_CacheControlMultiError is an error wrapping multiple validation -// errors returned by Resource_CacheControl.ValidateAll() if the designated -// constraints aren't met. -type Resource_CacheControlMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m Resource_CacheControlMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m Resource_CacheControlMultiError) AllErrors() []error { return m } - -// Resource_CacheControlValidationError is the validation error returned by -// Resource_CacheControl.Validate if the designated constraints aren't met. -type Resource_CacheControlValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e Resource_CacheControlValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e Resource_CacheControlValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e Resource_CacheControlValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e Resource_CacheControlValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e Resource_CacheControlValidationError) ErrorName() string { - return "Resource_CacheControlValidationError" -} - -// Error satisfies the builtin error interface -func (e Resource_CacheControlValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sResource_CacheControl.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = Resource_CacheControlValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = Resource_CacheControlValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/filter_state.pb.go b/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/filter_state.pb.go deleted file mode 100644 index 49a7d2b1e..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/filter_state.pb.go +++ /dev/null @@ -1,208 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/type/matcher/v3/filter_state.proto - -package matcherv3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// FilterStateMatcher provides a general interface for matching the filter state objects. -type FilterStateMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The filter state key to retrieve the object. - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // Types that are assignable to Matcher: - // - // *FilterStateMatcher_StringMatch - Matcher isFilterStateMatcher_Matcher `protobuf_oneof:"matcher"` -} - -func (x *FilterStateMatcher) Reset() { - *x = FilterStateMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_matcher_v3_filter_state_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FilterStateMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FilterStateMatcher) ProtoMessage() {} - -func (x *FilterStateMatcher) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_matcher_v3_filter_state_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FilterStateMatcher.ProtoReflect.Descriptor instead. -func (*FilterStateMatcher) Descriptor() ([]byte, []int) { - return file_envoy_type_matcher_v3_filter_state_proto_rawDescGZIP(), []int{0} -} - -func (x *FilterStateMatcher) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (m *FilterStateMatcher) GetMatcher() isFilterStateMatcher_Matcher { - if m != nil { - return m.Matcher - } - return nil -} - -func (x *FilterStateMatcher) GetStringMatch() *StringMatcher { - if x, ok := x.GetMatcher().(*FilterStateMatcher_StringMatch); ok { - return x.StringMatch - } - return nil -} - -type isFilterStateMatcher_Matcher interface { - isFilterStateMatcher_Matcher() -} - -type FilterStateMatcher_StringMatch struct { - // Matches the filter state object as a string value. - StringMatch *StringMatcher `protobuf:"bytes,2,opt,name=string_match,json=stringMatch,proto3,oneof"` -} - -func (*FilterStateMatcher_StringMatch) isFilterStateMatcher_Matcher() {} - -var File_envoy_type_matcher_v3_filter_state_proto protoreflect.FileDescriptor - -var file_envoy_type_matcher_v3_filter_state_proto_rawDesc = []byte{ - 0x0a, 0x28, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x5f, 0x73, - 0x74, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, - 0x33, 0x1a, 0x22, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8a, 0x01, - 0x0a, 0x12, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x49, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0b, 0x73, - 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x42, 0x0e, 0x0a, 0x07, 0x6d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x42, 0x89, 0x01, 0x0a, 0x23, 0x69, - 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, - 0x76, 0x33, 0x42, 0x10, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, - 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x2f, 0x76, 0x33, 0x3b, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x76, 0x33, 0xba, 0x80, - 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_type_matcher_v3_filter_state_proto_rawDescOnce sync.Once - file_envoy_type_matcher_v3_filter_state_proto_rawDescData = file_envoy_type_matcher_v3_filter_state_proto_rawDesc -) - -func file_envoy_type_matcher_v3_filter_state_proto_rawDescGZIP() []byte { - file_envoy_type_matcher_v3_filter_state_proto_rawDescOnce.Do(func() { - file_envoy_type_matcher_v3_filter_state_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_type_matcher_v3_filter_state_proto_rawDescData) - }) - return file_envoy_type_matcher_v3_filter_state_proto_rawDescData -} - -var file_envoy_type_matcher_v3_filter_state_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_type_matcher_v3_filter_state_proto_goTypes = []interface{}{ - (*FilterStateMatcher)(nil), // 0: envoy.type.matcher.v3.FilterStateMatcher - (*StringMatcher)(nil), // 1: envoy.type.matcher.v3.StringMatcher -} -var file_envoy_type_matcher_v3_filter_state_proto_depIdxs = []int32{ - 1, // 0: envoy.type.matcher.v3.FilterStateMatcher.string_match:type_name -> envoy.type.matcher.v3.StringMatcher - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_envoy_type_matcher_v3_filter_state_proto_init() } -func file_envoy_type_matcher_v3_filter_state_proto_init() { - if File_envoy_type_matcher_v3_filter_state_proto != nil { - return - } - file_envoy_type_matcher_v3_string_proto_init() - if !protoimpl.UnsafeEnabled { - file_envoy_type_matcher_v3_filter_state_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FilterStateMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_type_matcher_v3_filter_state_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*FilterStateMatcher_StringMatch)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_type_matcher_v3_filter_state_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_type_matcher_v3_filter_state_proto_goTypes, - DependencyIndexes: file_envoy_type_matcher_v3_filter_state_proto_depIdxs, - MessageInfos: file_envoy_type_matcher_v3_filter_state_proto_msgTypes, - }.Build() - File_envoy_type_matcher_v3_filter_state_proto = out.File - file_envoy_type_matcher_v3_filter_state_proto_rawDesc = nil - file_envoy_type_matcher_v3_filter_state_proto_goTypes = nil - file_envoy_type_matcher_v3_filter_state_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/filter_state.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/filter_state.pb.validate.go deleted file mode 100644 index 0152061d5..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/filter_state.pb.validate.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/type/matcher/v3/filter_state.proto - -package matcherv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on FilterStateMatcher with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *FilterStateMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on FilterStateMatcher with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// FilterStateMatcherMultiError, or nil if none found. -func (m *FilterStateMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *FilterStateMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetKey()) < 1 { - err := FilterStateMatcherValidationError{ - field: "Key", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - oneofMatcherPresent := false - switch v := m.Matcher.(type) { - case *FilterStateMatcher_StringMatch: - if v == nil { - err := FilterStateMatcherValidationError{ - field: "Matcher", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatcherPresent = true - - if all { - switch v := interface{}(m.GetStringMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, FilterStateMatcherValidationError{ - field: "StringMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, FilterStateMatcherValidationError{ - field: "StringMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetStringMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return FilterStateMatcherValidationError{ - field: "StringMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofMatcherPresent { - err := FilterStateMatcherValidationError{ - field: "Matcher", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return FilterStateMatcherMultiError(errors) - } - - return nil -} - -// FilterStateMatcherMultiError is an error wrapping multiple validation errors -// returned by FilterStateMatcher.ValidateAll() if the designated constraints -// aren't met. -type FilterStateMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m FilterStateMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m FilterStateMatcherMultiError) AllErrors() []error { return m } - -// FilterStateMatcherValidationError is the validation error returned by -// FilterStateMatcher.Validate if the designated constraints aren't met. -type FilterStateMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e FilterStateMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e FilterStateMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e FilterStateMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e FilterStateMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e FilterStateMatcherValidationError) ErrorName() string { - return "FilterStateMatcherValidationError" -} - -// Error satisfies the builtin error interface -func (e FilterStateMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sFilterStateMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = FilterStateMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = FilterStateMatcherValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/http_inputs.pb.go b/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/http_inputs.pb.go deleted file mode 100644 index 94e8aefe9..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/http_inputs.pb.go +++ /dev/null @@ -1,457 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/type/matcher/v3/http_inputs.proto - -package matcherv3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Match input indicates that matching should be done on a specific request header. -// The resulting input string will be all headers for the given key joined by a comma, -// e.g. if the request contains two 'foo' headers with value 'bar' and 'baz', the input -// string will be 'bar,baz'. -// [#comment:TODO(snowp): Link to unified matching docs.] -// [#extension: envoy.matching.inputs.request_headers] -type HttpRequestHeaderMatchInput struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The request header to match on. - HeaderName string `protobuf:"bytes,1,opt,name=header_name,json=headerName,proto3" json:"header_name,omitempty"` -} - -func (x *HttpRequestHeaderMatchInput) Reset() { - *x = HttpRequestHeaderMatchInput{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_matcher_v3_http_inputs_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HttpRequestHeaderMatchInput) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HttpRequestHeaderMatchInput) ProtoMessage() {} - -func (x *HttpRequestHeaderMatchInput) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_matcher_v3_http_inputs_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HttpRequestHeaderMatchInput.ProtoReflect.Descriptor instead. -func (*HttpRequestHeaderMatchInput) Descriptor() ([]byte, []int) { - return file_envoy_type_matcher_v3_http_inputs_proto_rawDescGZIP(), []int{0} -} - -func (x *HttpRequestHeaderMatchInput) GetHeaderName() string { - if x != nil { - return x.HeaderName - } - return "" -} - -// Match input indicates that matching should be done on a specific request trailer. -// The resulting input string will be all headers for the given key joined by a comma, -// e.g. if the request contains two 'foo' headers with value 'bar' and 'baz', the input -// string will be 'bar,baz'. -// [#comment:TODO(snowp): Link to unified matching docs.] -// [#extension: envoy.matching.inputs.request_trailers] -type HttpRequestTrailerMatchInput struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The request trailer to match on. - HeaderName string `protobuf:"bytes,1,opt,name=header_name,json=headerName,proto3" json:"header_name,omitempty"` -} - -func (x *HttpRequestTrailerMatchInput) Reset() { - *x = HttpRequestTrailerMatchInput{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_matcher_v3_http_inputs_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HttpRequestTrailerMatchInput) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HttpRequestTrailerMatchInput) ProtoMessage() {} - -func (x *HttpRequestTrailerMatchInput) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_matcher_v3_http_inputs_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HttpRequestTrailerMatchInput.ProtoReflect.Descriptor instead. -func (*HttpRequestTrailerMatchInput) Descriptor() ([]byte, []int) { - return file_envoy_type_matcher_v3_http_inputs_proto_rawDescGZIP(), []int{1} -} - -func (x *HttpRequestTrailerMatchInput) GetHeaderName() string { - if x != nil { - return x.HeaderName - } - return "" -} - -// Match input indicating that matching should be done on a specific response header. -// The resulting input string will be all headers for the given key joined by a comma, -// e.g. if the response contains two 'foo' headers with value 'bar' and 'baz', the input -// string will be 'bar,baz'. -// [#comment:TODO(snowp): Link to unified matching docs.] -// [#extension: envoy.matching.inputs.response_headers] -type HttpResponseHeaderMatchInput struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The response header to match on. - HeaderName string `protobuf:"bytes,1,opt,name=header_name,json=headerName,proto3" json:"header_name,omitempty"` -} - -func (x *HttpResponseHeaderMatchInput) Reset() { - *x = HttpResponseHeaderMatchInput{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_matcher_v3_http_inputs_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HttpResponseHeaderMatchInput) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HttpResponseHeaderMatchInput) ProtoMessage() {} - -func (x *HttpResponseHeaderMatchInput) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_matcher_v3_http_inputs_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HttpResponseHeaderMatchInput.ProtoReflect.Descriptor instead. -func (*HttpResponseHeaderMatchInput) Descriptor() ([]byte, []int) { - return file_envoy_type_matcher_v3_http_inputs_proto_rawDescGZIP(), []int{2} -} - -func (x *HttpResponseHeaderMatchInput) GetHeaderName() string { - if x != nil { - return x.HeaderName - } - return "" -} - -// Match input indicates that matching should be done on a specific response trailer. -// The resulting input string will be all headers for the given key joined by a comma, -// e.g. if the request contains two 'foo' headers with value 'bar' and 'baz', the input -// string will be 'bar,baz'. -// [#comment:TODO(snowp): Link to unified matching docs.] -// [#extension: envoy.matching.inputs.response_trailers] -type HttpResponseTrailerMatchInput struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The response trailer to match on. - HeaderName string `protobuf:"bytes,1,opt,name=header_name,json=headerName,proto3" json:"header_name,omitempty"` -} - -func (x *HttpResponseTrailerMatchInput) Reset() { - *x = HttpResponseTrailerMatchInput{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_matcher_v3_http_inputs_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HttpResponseTrailerMatchInput) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HttpResponseTrailerMatchInput) ProtoMessage() {} - -func (x *HttpResponseTrailerMatchInput) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_matcher_v3_http_inputs_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HttpResponseTrailerMatchInput.ProtoReflect.Descriptor instead. -func (*HttpResponseTrailerMatchInput) Descriptor() ([]byte, []int) { - return file_envoy_type_matcher_v3_http_inputs_proto_rawDescGZIP(), []int{3} -} - -func (x *HttpResponseTrailerMatchInput) GetHeaderName() string { - if x != nil { - return x.HeaderName - } - return "" -} - -// Match input indicates that matching should be done on a specific query parameter. -// The resulting input string will be the first query parameter for the value -// 'query_param'. -// [#extension: envoy.matching.inputs.query_params] -type HttpRequestQueryParamMatchInput struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The query parameter to match on. - QueryParam string `protobuf:"bytes,1,opt,name=query_param,json=queryParam,proto3" json:"query_param,omitempty"` -} - -func (x *HttpRequestQueryParamMatchInput) Reset() { - *x = HttpRequestQueryParamMatchInput{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_matcher_v3_http_inputs_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HttpRequestQueryParamMatchInput) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HttpRequestQueryParamMatchInput) ProtoMessage() {} - -func (x *HttpRequestQueryParamMatchInput) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_matcher_v3_http_inputs_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HttpRequestQueryParamMatchInput.ProtoReflect.Descriptor instead. -func (*HttpRequestQueryParamMatchInput) Descriptor() ([]byte, []int) { - return file_envoy_type_matcher_v3_http_inputs_proto_rawDescGZIP(), []int{4} -} - -func (x *HttpRequestQueryParamMatchInput) GetQueryParam() string { - if x != nil { - return x.QueryParam - } - return "" -} - -var File_envoy_type_matcher_v3_http_inputs_proto protoreflect.FileDescriptor - -var file_envoy_type_matcher_v3_http_inputs_proto_rawDesc = []byte{ - 0x0a, 0x27, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x69, 0x6e, 0x70, - 0x75, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, - 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x4b, 0x0a, 0x1b, 0x48, 0x74, 0x74, 0x70, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x2c, 0x0a, 0x0b, 0x68, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, 0xfa, 0x42, - 0x08, 0x72, 0x06, 0xc0, 0x01, 0x01, 0xc8, 0x01, 0x00, 0x52, 0x0a, 0x68, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x4c, 0x0a, 0x1c, 0x48, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x54, 0x72, 0x61, 0x69, 0x6c, 0x65, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, - 0x49, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x2c, 0x0a, 0x0b, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, 0xfa, 0x42, 0x08, 0x72, - 0x06, 0xc0, 0x01, 0x01, 0xc8, 0x01, 0x00, 0x52, 0x0a, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4e, - 0x61, 0x6d, 0x65, 0x22, 0x4c, 0x0a, 0x1c, 0x48, 0x74, 0x74, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x49, 0x6e, - 0x70, 0x75, 0x74, 0x12, 0x2c, 0x0a, 0x0b, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, 0xfa, 0x42, 0x08, 0x72, 0x06, 0xc0, - 0x01, 0x01, 0xc8, 0x01, 0x00, 0x52, 0x0a, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4e, 0x61, 0x6d, - 0x65, 0x22, 0x4d, 0x0a, 0x1d, 0x48, 0x74, 0x74, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x54, 0x72, 0x61, 0x69, 0x6c, 0x65, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x70, - 0x75, 0x74, 0x12, 0x2c, 0x0a, 0x0b, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, 0xfa, 0x42, 0x08, 0x72, 0x06, 0xc0, 0x01, - 0x01, 0xc8, 0x01, 0x00, 0x52, 0x0a, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, - 0x22, 0x4b, 0x0a, 0x1f, 0x48, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x49, 0x6e, - 0x70, 0x75, 0x74, 0x12, 0x28, 0x0a, 0x0b, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, - 0x01, 0x52, 0x0a, 0x71, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x42, 0x88, 0x01, - 0x0a, 0x23, 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x2e, 0x76, 0x33, 0x42, 0x0f, 0x48, 0x74, 0x74, 0x70, 0x49, 0x6e, 0x70, 0x75, 0x74, - 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, - 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, - 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, - 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x3b, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x76, 0x33, - 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_type_matcher_v3_http_inputs_proto_rawDescOnce sync.Once - file_envoy_type_matcher_v3_http_inputs_proto_rawDescData = file_envoy_type_matcher_v3_http_inputs_proto_rawDesc -) - -func file_envoy_type_matcher_v3_http_inputs_proto_rawDescGZIP() []byte { - file_envoy_type_matcher_v3_http_inputs_proto_rawDescOnce.Do(func() { - file_envoy_type_matcher_v3_http_inputs_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_type_matcher_v3_http_inputs_proto_rawDescData) - }) - return file_envoy_type_matcher_v3_http_inputs_proto_rawDescData -} - -var file_envoy_type_matcher_v3_http_inputs_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_envoy_type_matcher_v3_http_inputs_proto_goTypes = []interface{}{ - (*HttpRequestHeaderMatchInput)(nil), // 0: envoy.type.matcher.v3.HttpRequestHeaderMatchInput - (*HttpRequestTrailerMatchInput)(nil), // 1: envoy.type.matcher.v3.HttpRequestTrailerMatchInput - (*HttpResponseHeaderMatchInput)(nil), // 2: envoy.type.matcher.v3.HttpResponseHeaderMatchInput - (*HttpResponseTrailerMatchInput)(nil), // 3: envoy.type.matcher.v3.HttpResponseTrailerMatchInput - (*HttpRequestQueryParamMatchInput)(nil), // 4: envoy.type.matcher.v3.HttpRequestQueryParamMatchInput -} -var file_envoy_type_matcher_v3_http_inputs_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_envoy_type_matcher_v3_http_inputs_proto_init() } -func file_envoy_type_matcher_v3_http_inputs_proto_init() { - if File_envoy_type_matcher_v3_http_inputs_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_envoy_type_matcher_v3_http_inputs_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HttpRequestHeaderMatchInput); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_matcher_v3_http_inputs_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HttpRequestTrailerMatchInput); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_matcher_v3_http_inputs_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HttpResponseHeaderMatchInput); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_matcher_v3_http_inputs_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HttpResponseTrailerMatchInput); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_matcher_v3_http_inputs_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HttpRequestQueryParamMatchInput); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_type_matcher_v3_http_inputs_proto_rawDesc, - NumEnums: 0, - NumMessages: 5, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_type_matcher_v3_http_inputs_proto_goTypes, - DependencyIndexes: file_envoy_type_matcher_v3_http_inputs_proto_depIdxs, - MessageInfos: file_envoy_type_matcher_v3_http_inputs_proto_msgTypes, - }.Build() - File_envoy_type_matcher_v3_http_inputs_proto = out.File - file_envoy_type_matcher_v3_http_inputs_proto_rawDesc = nil - file_envoy_type_matcher_v3_http_inputs_proto_goTypes = nil - file_envoy_type_matcher_v3_http_inputs_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/http_inputs.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/http_inputs.pb.validate.go deleted file mode 100644 index 24950b97a..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/http_inputs.pb.validate.go +++ /dev/null @@ -1,614 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/type/matcher/v3/http_inputs.proto - -package matcherv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on HttpRequestHeaderMatchInput with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *HttpRequestHeaderMatchInput) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HttpRequestHeaderMatchInput with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// HttpRequestHeaderMatchInputMultiError, or nil if none found. -func (m *HttpRequestHeaderMatchInput) ValidateAll() error { - return m.validate(true) -} - -func (m *HttpRequestHeaderMatchInput) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if !_HttpRequestHeaderMatchInput_HeaderName_Pattern.MatchString(m.GetHeaderName()) { - err := HttpRequestHeaderMatchInputValidationError{ - field: "HeaderName", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return HttpRequestHeaderMatchInputMultiError(errors) - } - - return nil -} - -// HttpRequestHeaderMatchInputMultiError is an error wrapping multiple -// validation errors returned by HttpRequestHeaderMatchInput.ValidateAll() if -// the designated constraints aren't met. -type HttpRequestHeaderMatchInputMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HttpRequestHeaderMatchInputMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HttpRequestHeaderMatchInputMultiError) AllErrors() []error { return m } - -// HttpRequestHeaderMatchInputValidationError is the validation error returned -// by HttpRequestHeaderMatchInput.Validate if the designated constraints -// aren't met. -type HttpRequestHeaderMatchInputValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HttpRequestHeaderMatchInputValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HttpRequestHeaderMatchInputValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HttpRequestHeaderMatchInputValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HttpRequestHeaderMatchInputValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HttpRequestHeaderMatchInputValidationError) ErrorName() string { - return "HttpRequestHeaderMatchInputValidationError" -} - -// Error satisfies the builtin error interface -func (e HttpRequestHeaderMatchInputValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttpRequestHeaderMatchInput.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HttpRequestHeaderMatchInputValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HttpRequestHeaderMatchInputValidationError{} - -var _HttpRequestHeaderMatchInput_HeaderName_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -// Validate checks the field values on HttpRequestTrailerMatchInput with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *HttpRequestTrailerMatchInput) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HttpRequestTrailerMatchInput with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// HttpRequestTrailerMatchInputMultiError, or nil if none found. -func (m *HttpRequestTrailerMatchInput) ValidateAll() error { - return m.validate(true) -} - -func (m *HttpRequestTrailerMatchInput) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if !_HttpRequestTrailerMatchInput_HeaderName_Pattern.MatchString(m.GetHeaderName()) { - err := HttpRequestTrailerMatchInputValidationError{ - field: "HeaderName", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return HttpRequestTrailerMatchInputMultiError(errors) - } - - return nil -} - -// HttpRequestTrailerMatchInputMultiError is an error wrapping multiple -// validation errors returned by HttpRequestTrailerMatchInput.ValidateAll() if -// the designated constraints aren't met. -type HttpRequestTrailerMatchInputMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HttpRequestTrailerMatchInputMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HttpRequestTrailerMatchInputMultiError) AllErrors() []error { return m } - -// HttpRequestTrailerMatchInputValidationError is the validation error returned -// by HttpRequestTrailerMatchInput.Validate if the designated constraints -// aren't met. -type HttpRequestTrailerMatchInputValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HttpRequestTrailerMatchInputValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HttpRequestTrailerMatchInputValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HttpRequestTrailerMatchInputValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HttpRequestTrailerMatchInputValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HttpRequestTrailerMatchInputValidationError) ErrorName() string { - return "HttpRequestTrailerMatchInputValidationError" -} - -// Error satisfies the builtin error interface -func (e HttpRequestTrailerMatchInputValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttpRequestTrailerMatchInput.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HttpRequestTrailerMatchInputValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HttpRequestTrailerMatchInputValidationError{} - -var _HttpRequestTrailerMatchInput_HeaderName_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -// Validate checks the field values on HttpResponseHeaderMatchInput with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *HttpResponseHeaderMatchInput) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HttpResponseHeaderMatchInput with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// HttpResponseHeaderMatchInputMultiError, or nil if none found. -func (m *HttpResponseHeaderMatchInput) ValidateAll() error { - return m.validate(true) -} - -func (m *HttpResponseHeaderMatchInput) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if !_HttpResponseHeaderMatchInput_HeaderName_Pattern.MatchString(m.GetHeaderName()) { - err := HttpResponseHeaderMatchInputValidationError{ - field: "HeaderName", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return HttpResponseHeaderMatchInputMultiError(errors) - } - - return nil -} - -// HttpResponseHeaderMatchInputMultiError is an error wrapping multiple -// validation errors returned by HttpResponseHeaderMatchInput.ValidateAll() if -// the designated constraints aren't met. -type HttpResponseHeaderMatchInputMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HttpResponseHeaderMatchInputMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HttpResponseHeaderMatchInputMultiError) AllErrors() []error { return m } - -// HttpResponseHeaderMatchInputValidationError is the validation error returned -// by HttpResponseHeaderMatchInput.Validate if the designated constraints -// aren't met. -type HttpResponseHeaderMatchInputValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HttpResponseHeaderMatchInputValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HttpResponseHeaderMatchInputValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HttpResponseHeaderMatchInputValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HttpResponseHeaderMatchInputValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HttpResponseHeaderMatchInputValidationError) ErrorName() string { - return "HttpResponseHeaderMatchInputValidationError" -} - -// Error satisfies the builtin error interface -func (e HttpResponseHeaderMatchInputValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttpResponseHeaderMatchInput.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HttpResponseHeaderMatchInputValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HttpResponseHeaderMatchInputValidationError{} - -var _HttpResponseHeaderMatchInput_HeaderName_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -// Validate checks the field values on HttpResponseTrailerMatchInput with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *HttpResponseTrailerMatchInput) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HttpResponseTrailerMatchInput with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// HttpResponseTrailerMatchInputMultiError, or nil if none found. -func (m *HttpResponseTrailerMatchInput) ValidateAll() error { - return m.validate(true) -} - -func (m *HttpResponseTrailerMatchInput) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if !_HttpResponseTrailerMatchInput_HeaderName_Pattern.MatchString(m.GetHeaderName()) { - err := HttpResponseTrailerMatchInputValidationError{ - field: "HeaderName", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return HttpResponseTrailerMatchInputMultiError(errors) - } - - return nil -} - -// HttpResponseTrailerMatchInputMultiError is an error wrapping multiple -// validation errors returned by HttpResponseTrailerMatchInput.ValidateAll() -// if the designated constraints aren't met. -type HttpResponseTrailerMatchInputMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HttpResponseTrailerMatchInputMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HttpResponseTrailerMatchInputMultiError) AllErrors() []error { return m } - -// HttpResponseTrailerMatchInputValidationError is the validation error -// returned by HttpResponseTrailerMatchInput.Validate if the designated -// constraints aren't met. -type HttpResponseTrailerMatchInputValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HttpResponseTrailerMatchInputValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HttpResponseTrailerMatchInputValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HttpResponseTrailerMatchInputValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HttpResponseTrailerMatchInputValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HttpResponseTrailerMatchInputValidationError) ErrorName() string { - return "HttpResponseTrailerMatchInputValidationError" -} - -// Error satisfies the builtin error interface -func (e HttpResponseTrailerMatchInputValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttpResponseTrailerMatchInput.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HttpResponseTrailerMatchInputValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HttpResponseTrailerMatchInputValidationError{} - -var _HttpResponseTrailerMatchInput_HeaderName_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -// Validate checks the field values on HttpRequestQueryParamMatchInput with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *HttpRequestQueryParamMatchInput) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HttpRequestQueryParamMatchInput with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// HttpRequestQueryParamMatchInputMultiError, or nil if none found. -func (m *HttpRequestQueryParamMatchInput) ValidateAll() error { - return m.validate(true) -} - -func (m *HttpRequestQueryParamMatchInput) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetQueryParam()) < 1 { - err := HttpRequestQueryParamMatchInputValidationError{ - field: "QueryParam", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return HttpRequestQueryParamMatchInputMultiError(errors) - } - - return nil -} - -// HttpRequestQueryParamMatchInputMultiError is an error wrapping multiple -// validation errors returned by HttpRequestQueryParamMatchInput.ValidateAll() -// if the designated constraints aren't met. -type HttpRequestQueryParamMatchInputMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HttpRequestQueryParamMatchInputMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HttpRequestQueryParamMatchInputMultiError) AllErrors() []error { return m } - -// HttpRequestQueryParamMatchInputValidationError is the validation error -// returned by HttpRequestQueryParamMatchInput.Validate if the designated -// constraints aren't met. -type HttpRequestQueryParamMatchInputValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HttpRequestQueryParamMatchInputValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HttpRequestQueryParamMatchInputValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HttpRequestQueryParamMatchInputValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HttpRequestQueryParamMatchInputValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HttpRequestQueryParamMatchInputValidationError) ErrorName() string { - return "HttpRequestQueryParamMatchInputValidationError" -} - -// Error satisfies the builtin error interface -func (e HttpRequestQueryParamMatchInputValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttpRequestQueryParamMatchInput.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HttpRequestQueryParamMatchInputValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HttpRequestQueryParamMatchInputValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/metadata.pb.go b/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/metadata.pb.go deleted file mode 100644 index f9c863e22..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/metadata.pb.go +++ /dev/null @@ -1,308 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/type/matcher/v3/metadata.proto - -package matcherv3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// [#next-major-version: MetadataMatcher should use StructMatcher] -type MetadataMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The filter name to retrieve the Struct from the Metadata. - Filter string `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"` - // The path to retrieve the Value from the Struct. - Path []*MetadataMatcher_PathSegment `protobuf:"bytes,2,rep,name=path,proto3" json:"path,omitempty"` - // The MetadataMatcher is matched if the value retrieved by path is matched to this value. - Value *ValueMatcher `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` - // If true, the match result will be inverted. - Invert bool `protobuf:"varint,4,opt,name=invert,proto3" json:"invert,omitempty"` -} - -func (x *MetadataMatcher) Reset() { - *x = MetadataMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_matcher_v3_metadata_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MetadataMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MetadataMatcher) ProtoMessage() {} - -func (x *MetadataMatcher) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_matcher_v3_metadata_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MetadataMatcher.ProtoReflect.Descriptor instead. -func (*MetadataMatcher) Descriptor() ([]byte, []int) { - return file_envoy_type_matcher_v3_metadata_proto_rawDescGZIP(), []int{0} -} - -func (x *MetadataMatcher) GetFilter() string { - if x != nil { - return x.Filter - } - return "" -} - -func (x *MetadataMatcher) GetPath() []*MetadataMatcher_PathSegment { - if x != nil { - return x.Path - } - return nil -} - -func (x *MetadataMatcher) GetValue() *ValueMatcher { - if x != nil { - return x.Value - } - return nil -} - -func (x *MetadataMatcher) GetInvert() bool { - if x != nil { - return x.Invert - } - return false -} - -// Specifies the segment in a path to retrieve value from Metadata. -// Note: Currently it's not supported to retrieve a value from a list in Metadata. This means that -// if the segment key refers to a list, it has to be the last segment in a path. -type MetadataMatcher_PathSegment struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Segment: - // - // *MetadataMatcher_PathSegment_Key - Segment isMetadataMatcher_PathSegment_Segment `protobuf_oneof:"segment"` -} - -func (x *MetadataMatcher_PathSegment) Reset() { - *x = MetadataMatcher_PathSegment{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_matcher_v3_metadata_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MetadataMatcher_PathSegment) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MetadataMatcher_PathSegment) ProtoMessage() {} - -func (x *MetadataMatcher_PathSegment) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_matcher_v3_metadata_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MetadataMatcher_PathSegment.ProtoReflect.Descriptor instead. -func (*MetadataMatcher_PathSegment) Descriptor() ([]byte, []int) { - return file_envoy_type_matcher_v3_metadata_proto_rawDescGZIP(), []int{0, 0} -} - -func (m *MetadataMatcher_PathSegment) GetSegment() isMetadataMatcher_PathSegment_Segment { - if m != nil { - return m.Segment - } - return nil -} - -func (x *MetadataMatcher_PathSegment) GetKey() string { - if x, ok := x.GetSegment().(*MetadataMatcher_PathSegment_Key); ok { - return x.Key - } - return "" -} - -type isMetadataMatcher_PathSegment_Segment interface { - isMetadataMatcher_PathSegment_Segment() -} - -type MetadataMatcher_PathSegment_Key struct { - // If specified, use the key to retrieve the value in a Struct. - Key string `protobuf:"bytes,1,opt,name=key,proto3,oneof"` -} - -func (*MetadataMatcher_PathSegment_Key) isMetadataMatcher_PathSegment_Segment() {} - -var File_envoy_type_matcher_v3_metadata_proto protoreflect.FileDescriptor - -var file_envoy_type_matcher_v3_metadata_proto_rawDesc = []byte{ - 0x0a, 0x24, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x1a, 0x21, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x21, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xff, 0x02, 0x0a, 0x0f, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, - 0x1f, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, - 0x12, 0x50, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x32, - 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, - 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, - 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x67, 0x6d, 0x65, - 0x6e, 0x74, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x04, 0x70, 0x61, - 0x74, 0x68, 0x12, 0x43, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x23, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, - 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, - 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x6e, 0x76, 0x65, 0x72, - 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x1a, - 0x71, 0x0a, 0x0b, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1b, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, - 0x72, 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x3a, 0x35, 0x9a, 0xc5, 0x88, - 0x1e, 0x30, 0x0a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, - 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, - 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x67, 0x6d, 0x65, - 0x6e, 0x74, 0x42, 0x0e, 0x0a, 0x07, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x03, 0xf8, - 0x42, 0x01, 0x3a, 0x29, 0x9a, 0xc5, 0x88, 0x1e, 0x24, 0x0a, 0x22, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x42, 0x86, 0x01, - 0x0a, 0x23, 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x2e, 0x76, 0x33, 0x42, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, - 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x2f, 0x76, 0x33, 0x3b, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x76, 0x33, 0xba, 0x80, - 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_type_matcher_v3_metadata_proto_rawDescOnce sync.Once - file_envoy_type_matcher_v3_metadata_proto_rawDescData = file_envoy_type_matcher_v3_metadata_proto_rawDesc -) - -func file_envoy_type_matcher_v3_metadata_proto_rawDescGZIP() []byte { - file_envoy_type_matcher_v3_metadata_proto_rawDescOnce.Do(func() { - file_envoy_type_matcher_v3_metadata_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_type_matcher_v3_metadata_proto_rawDescData) - }) - return file_envoy_type_matcher_v3_metadata_proto_rawDescData -} - -var file_envoy_type_matcher_v3_metadata_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_envoy_type_matcher_v3_metadata_proto_goTypes = []interface{}{ - (*MetadataMatcher)(nil), // 0: envoy.type.matcher.v3.MetadataMatcher - (*MetadataMatcher_PathSegment)(nil), // 1: envoy.type.matcher.v3.MetadataMatcher.PathSegment - (*ValueMatcher)(nil), // 2: envoy.type.matcher.v3.ValueMatcher -} -var file_envoy_type_matcher_v3_metadata_proto_depIdxs = []int32{ - 1, // 0: envoy.type.matcher.v3.MetadataMatcher.path:type_name -> envoy.type.matcher.v3.MetadataMatcher.PathSegment - 2, // 1: envoy.type.matcher.v3.MetadataMatcher.value:type_name -> envoy.type.matcher.v3.ValueMatcher - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_envoy_type_matcher_v3_metadata_proto_init() } -func file_envoy_type_matcher_v3_metadata_proto_init() { - if File_envoy_type_matcher_v3_metadata_proto != nil { - return - } - file_envoy_type_matcher_v3_value_proto_init() - if !protoimpl.UnsafeEnabled { - file_envoy_type_matcher_v3_metadata_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MetadataMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_matcher_v3_metadata_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MetadataMatcher_PathSegment); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_type_matcher_v3_metadata_proto_msgTypes[1].OneofWrappers = []interface{}{ - (*MetadataMatcher_PathSegment_Key)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_type_matcher_v3_metadata_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_type_matcher_v3_metadata_proto_goTypes, - DependencyIndexes: file_envoy_type_matcher_v3_metadata_proto_depIdxs, - MessageInfos: file_envoy_type_matcher_v3_metadata_proto_msgTypes, - }.Build() - File_envoy_type_matcher_v3_metadata_proto = out.File - file_envoy_type_matcher_v3_metadata_proto_rawDesc = nil - file_envoy_type_matcher_v3_metadata_proto_goTypes = nil - file_envoy_type_matcher_v3_metadata_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/metadata.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/metadata.pb.validate.go deleted file mode 100644 index 0a00e4faa..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/metadata.pb.validate.go +++ /dev/null @@ -1,377 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/type/matcher/v3/metadata.proto - -package matcherv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on MetadataMatcher with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *MetadataMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on MetadataMatcher with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// MetadataMatcherMultiError, or nil if none found. -func (m *MetadataMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *MetadataMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetFilter()) < 1 { - err := MetadataMatcherValidationError{ - field: "Filter", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(m.GetPath()) < 1 { - err := MetadataMatcherValidationError{ - field: "Path", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetPath() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, MetadataMatcherValidationError{ - field: fmt.Sprintf("Path[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, MetadataMatcherValidationError{ - field: fmt.Sprintf("Path[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return MetadataMatcherValidationError{ - field: fmt.Sprintf("Path[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if m.GetValue() == nil { - err := MetadataMatcherValidationError{ - field: "Value", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetValue()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, MetadataMatcherValidationError{ - field: "Value", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, MetadataMatcherValidationError{ - field: "Value", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetValue()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return MetadataMatcherValidationError{ - field: "Value", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for Invert - - if len(errors) > 0 { - return MetadataMatcherMultiError(errors) - } - - return nil -} - -// MetadataMatcherMultiError is an error wrapping multiple validation errors -// returned by MetadataMatcher.ValidateAll() if the designated constraints -// aren't met. -type MetadataMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m MetadataMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m MetadataMatcherMultiError) AllErrors() []error { return m } - -// MetadataMatcherValidationError is the validation error returned by -// MetadataMatcher.Validate if the designated constraints aren't met. -type MetadataMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e MetadataMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e MetadataMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e MetadataMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e MetadataMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e MetadataMatcherValidationError) ErrorName() string { return "MetadataMatcherValidationError" } - -// Error satisfies the builtin error interface -func (e MetadataMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMetadataMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = MetadataMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = MetadataMatcherValidationError{} - -// Validate checks the field values on MetadataMatcher_PathSegment with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *MetadataMatcher_PathSegment) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on MetadataMatcher_PathSegment with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// MetadataMatcher_PathSegmentMultiError, or nil if none found. -func (m *MetadataMatcher_PathSegment) ValidateAll() error { - return m.validate(true) -} - -func (m *MetadataMatcher_PathSegment) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofSegmentPresent := false - switch v := m.Segment.(type) { - case *MetadataMatcher_PathSegment_Key: - if v == nil { - err := MetadataMatcher_PathSegmentValidationError{ - field: "Segment", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofSegmentPresent = true - - if utf8.RuneCountInString(m.GetKey()) < 1 { - err := MetadataMatcher_PathSegmentValidationError{ - field: "Key", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - default: - _ = v // ensures v is used - } - if !oneofSegmentPresent { - err := MetadataMatcher_PathSegmentValidationError{ - field: "Segment", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return MetadataMatcher_PathSegmentMultiError(errors) - } - - return nil -} - -// MetadataMatcher_PathSegmentMultiError is an error wrapping multiple -// validation errors returned by MetadataMatcher_PathSegment.ValidateAll() if -// the designated constraints aren't met. -type MetadataMatcher_PathSegmentMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m MetadataMatcher_PathSegmentMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m MetadataMatcher_PathSegmentMultiError) AllErrors() []error { return m } - -// MetadataMatcher_PathSegmentValidationError is the validation error returned -// by MetadataMatcher_PathSegment.Validate if the designated constraints -// aren't met. -type MetadataMatcher_PathSegmentValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e MetadataMatcher_PathSegmentValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e MetadataMatcher_PathSegmentValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e MetadataMatcher_PathSegmentValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e MetadataMatcher_PathSegmentValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e MetadataMatcher_PathSegmentValidationError) ErrorName() string { - return "MetadataMatcher_PathSegmentValidationError" -} - -// Error satisfies the builtin error interface -func (e MetadataMatcher_PathSegmentValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMetadataMatcher_PathSegment.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = MetadataMatcher_PathSegmentValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = MetadataMatcher_PathSegmentValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/node.pb.go b/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/node.pb.go deleted file mode 100644 index 09e104ae5..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/node.pb.go +++ /dev/null @@ -1,194 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/type/matcher/v3/node.proto - -package matcherv3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Specifies the way to match a Node. -// The match follows AND semantics. -type NodeMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Specifies match criteria on the node id. - NodeId *StringMatcher `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` - // Specifies match criteria on the node metadata. - NodeMetadatas []*StructMatcher `protobuf:"bytes,2,rep,name=node_metadatas,json=nodeMetadatas,proto3" json:"node_metadatas,omitempty"` -} - -func (x *NodeMatcher) Reset() { - *x = NodeMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_matcher_v3_node_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NodeMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NodeMatcher) ProtoMessage() {} - -func (x *NodeMatcher) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_matcher_v3_node_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NodeMatcher.ProtoReflect.Descriptor instead. -func (*NodeMatcher) Descriptor() ([]byte, []int) { - return file_envoy_type_matcher_v3_node_proto_rawDescGZIP(), []int{0} -} - -func (x *NodeMatcher) GetNodeId() *StringMatcher { - if x != nil { - return x.NodeId - } - return nil -} - -func (x *NodeMatcher) GetNodeMetadatas() []*StructMatcher { - if x != nil { - return x.NodeMetadatas - } - return nil -} - -var File_envoy_type_matcher_v3_node_proto protoreflect.FileDescriptor - -var file_envoy_type_matcher_v3_node_proto_rawDesc = []byte{ - 0x0a, 0x20, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x15, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, - 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x1a, 0x22, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, - 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x22, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x21, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0xc0, 0x01, 0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x61, 0x74, 0x63, - 0x68, 0x65, 0x72, 0x12, 0x3d, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, - 0x49, 0x64, 0x12, 0x4b, 0x0a, 0x0e, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, - 0x76, 0x33, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, - 0x52, 0x0d, 0x6e, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x73, 0x3a, - 0x25, 0x9a, 0xc5, 0x88, 0x1e, 0x20, 0x0a, 0x1e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x4d, - 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x42, 0x82, 0x01, 0x0a, 0x23, 0x69, 0x6f, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x42, 0x09, - 0x4e, 0x6f, 0x64, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x46, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, - 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, - 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, - 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x3b, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_type_matcher_v3_node_proto_rawDescOnce sync.Once - file_envoy_type_matcher_v3_node_proto_rawDescData = file_envoy_type_matcher_v3_node_proto_rawDesc -) - -func file_envoy_type_matcher_v3_node_proto_rawDescGZIP() []byte { - file_envoy_type_matcher_v3_node_proto_rawDescOnce.Do(func() { - file_envoy_type_matcher_v3_node_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_type_matcher_v3_node_proto_rawDescData) - }) - return file_envoy_type_matcher_v3_node_proto_rawDescData -} - -var file_envoy_type_matcher_v3_node_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_type_matcher_v3_node_proto_goTypes = []interface{}{ - (*NodeMatcher)(nil), // 0: envoy.type.matcher.v3.NodeMatcher - (*StringMatcher)(nil), // 1: envoy.type.matcher.v3.StringMatcher - (*StructMatcher)(nil), // 2: envoy.type.matcher.v3.StructMatcher -} -var file_envoy_type_matcher_v3_node_proto_depIdxs = []int32{ - 1, // 0: envoy.type.matcher.v3.NodeMatcher.node_id:type_name -> envoy.type.matcher.v3.StringMatcher - 2, // 1: envoy.type.matcher.v3.NodeMatcher.node_metadatas:type_name -> envoy.type.matcher.v3.StructMatcher - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_envoy_type_matcher_v3_node_proto_init() } -func file_envoy_type_matcher_v3_node_proto_init() { - if File_envoy_type_matcher_v3_node_proto != nil { - return - } - file_envoy_type_matcher_v3_string_proto_init() - file_envoy_type_matcher_v3_struct_proto_init() - if !protoimpl.UnsafeEnabled { - file_envoy_type_matcher_v3_node_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NodeMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_type_matcher_v3_node_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_type_matcher_v3_node_proto_goTypes, - DependencyIndexes: file_envoy_type_matcher_v3_node_proto_depIdxs, - MessageInfos: file_envoy_type_matcher_v3_node_proto_msgTypes, - }.Build() - File_envoy_type_matcher_v3_node_proto = out.File - file_envoy_type_matcher_v3_node_proto_rawDesc = nil - file_envoy_type_matcher_v3_node_proto_goTypes = nil - file_envoy_type_matcher_v3_node_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/node.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/node.pb.validate.go deleted file mode 100644 index fb9b77f21..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/node.pb.validate.go +++ /dev/null @@ -1,198 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/type/matcher/v3/node.proto - -package matcherv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on NodeMatcher with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *NodeMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on NodeMatcher with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in NodeMatcherMultiError, or -// nil if none found. -func (m *NodeMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *NodeMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetNodeId()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, NodeMatcherValidationError{ - field: "NodeId", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, NodeMatcherValidationError{ - field: "NodeId", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetNodeId()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return NodeMatcherValidationError{ - field: "NodeId", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetNodeMetadatas() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, NodeMatcherValidationError{ - field: fmt.Sprintf("NodeMetadatas[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, NodeMatcherValidationError{ - field: fmt.Sprintf("NodeMetadatas[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return NodeMatcherValidationError{ - field: fmt.Sprintf("NodeMetadatas[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return NodeMatcherMultiError(errors) - } - - return nil -} - -// NodeMatcherMultiError is an error wrapping multiple validation errors -// returned by NodeMatcher.ValidateAll() if the designated constraints aren't met. -type NodeMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m NodeMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m NodeMatcherMultiError) AllErrors() []error { return m } - -// NodeMatcherValidationError is the validation error returned by -// NodeMatcher.Validate if the designated constraints aren't met. -type NodeMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e NodeMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e NodeMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e NodeMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e NodeMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e NodeMatcherValidationError) ErrorName() string { return "NodeMatcherValidationError" } - -// Error satisfies the builtin error interface -func (e NodeMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sNodeMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = NodeMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = NodeMatcherValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/number.pb.go b/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/number.pb.go deleted file mode 100644 index 95a00303a..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/number.pb.go +++ /dev/null @@ -1,218 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/type/matcher/v3/number.proto - -package matcherv3 - -import ( - v3 "github.com/cilium/proxy/go/envoy/type/v3" - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Specifies the way to match a double value. -type DoubleMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to MatchPattern: - // - // *DoubleMatcher_Range - // *DoubleMatcher_Exact - MatchPattern isDoubleMatcher_MatchPattern `protobuf_oneof:"match_pattern"` -} - -func (x *DoubleMatcher) Reset() { - *x = DoubleMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_matcher_v3_number_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DoubleMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DoubleMatcher) ProtoMessage() {} - -func (x *DoubleMatcher) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_matcher_v3_number_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DoubleMatcher.ProtoReflect.Descriptor instead. -func (*DoubleMatcher) Descriptor() ([]byte, []int) { - return file_envoy_type_matcher_v3_number_proto_rawDescGZIP(), []int{0} -} - -func (m *DoubleMatcher) GetMatchPattern() isDoubleMatcher_MatchPattern { - if m != nil { - return m.MatchPattern - } - return nil -} - -func (x *DoubleMatcher) GetRange() *v3.DoubleRange { - if x, ok := x.GetMatchPattern().(*DoubleMatcher_Range); ok { - return x.Range - } - return nil -} - -func (x *DoubleMatcher) GetExact() float64 { - if x, ok := x.GetMatchPattern().(*DoubleMatcher_Exact); ok { - return x.Exact - } - return 0 -} - -type isDoubleMatcher_MatchPattern interface { - isDoubleMatcher_MatchPattern() -} - -type DoubleMatcher_Range struct { - // If specified, the input double value must be in the range specified here. - // Note: The range is using half-open interval semantics [start, end). - Range *v3.DoubleRange `protobuf:"bytes,1,opt,name=range,proto3,oneof"` -} - -type DoubleMatcher_Exact struct { - // If specified, the input double value must be equal to the value specified here. - Exact float64 `protobuf:"fixed64,2,opt,name=exact,proto3,oneof"` -} - -func (*DoubleMatcher_Range) isDoubleMatcher_MatchPattern() {} - -func (*DoubleMatcher_Exact) isDoubleMatcher_MatchPattern() {} - -var File_envoy_type_matcher_v3_number_proto protoreflect.FileDescriptor - -var file_envoy_type_matcher_v3_number_proto_rawDesc = []byte{ - 0x0a, 0x22, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x1a, 0x19, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x72, 0x61, 0x6e, 0x67, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, - 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, - 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0x9a, 0x01, 0x0a, 0x0d, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x4d, 0x61, 0x74, 0x63, - 0x68, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, - 0x76, 0x33, 0x2e, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x00, - 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x05, 0x65, 0x78, 0x61, 0x63, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, 0x05, 0x65, 0x78, 0x61, 0x63, 0x74, 0x3a, - 0x27, 0x9a, 0xc5, 0x88, 0x1e, 0x22, 0x0a, 0x20, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x44, 0x6f, 0x75, 0x62, 0x6c, - 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x42, 0x14, 0x0a, 0x0d, 0x6d, 0x61, 0x74, 0x63, - 0x68, 0x5f, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x42, 0x84, - 0x01, 0x0a, 0x23, 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, - 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, - 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x42, 0x0b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, - 0x2f, 0x76, 0x33, 0x3b, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x76, 0x33, 0xba, 0x80, 0xc8, - 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_type_matcher_v3_number_proto_rawDescOnce sync.Once - file_envoy_type_matcher_v3_number_proto_rawDescData = file_envoy_type_matcher_v3_number_proto_rawDesc -) - -func file_envoy_type_matcher_v3_number_proto_rawDescGZIP() []byte { - file_envoy_type_matcher_v3_number_proto_rawDescOnce.Do(func() { - file_envoy_type_matcher_v3_number_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_type_matcher_v3_number_proto_rawDescData) - }) - return file_envoy_type_matcher_v3_number_proto_rawDescData -} - -var file_envoy_type_matcher_v3_number_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_type_matcher_v3_number_proto_goTypes = []interface{}{ - (*DoubleMatcher)(nil), // 0: envoy.type.matcher.v3.DoubleMatcher - (*v3.DoubleRange)(nil), // 1: envoy.type.v3.DoubleRange -} -var file_envoy_type_matcher_v3_number_proto_depIdxs = []int32{ - 1, // 0: envoy.type.matcher.v3.DoubleMatcher.range:type_name -> envoy.type.v3.DoubleRange - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_envoy_type_matcher_v3_number_proto_init() } -func file_envoy_type_matcher_v3_number_proto_init() { - if File_envoy_type_matcher_v3_number_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_envoy_type_matcher_v3_number_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DoubleMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_type_matcher_v3_number_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*DoubleMatcher_Range)(nil), - (*DoubleMatcher_Exact)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_type_matcher_v3_number_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_type_matcher_v3_number_proto_goTypes, - DependencyIndexes: file_envoy_type_matcher_v3_number_proto_depIdxs, - MessageInfos: file_envoy_type_matcher_v3_number_proto_msgTypes, - }.Build() - File_envoy_type_matcher_v3_number_proto = out.File - file_envoy_type_matcher_v3_number_proto_rawDesc = nil - file_envoy_type_matcher_v3_number_proto_goTypes = nil - file_envoy_type_matcher_v3_number_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/number.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/number.pb.validate.go deleted file mode 100644 index d656d7f44..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/number.pb.validate.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/type/matcher/v3/number.proto - -package matcherv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on DoubleMatcher with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *DoubleMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DoubleMatcher with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in DoubleMatcherMultiError, or -// nil if none found. -func (m *DoubleMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *DoubleMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofMatchPatternPresent := false - switch v := m.MatchPattern.(type) { - case *DoubleMatcher_Range: - if v == nil { - err := DoubleMatcherValidationError{ - field: "MatchPattern", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchPatternPresent = true - - if all { - switch v := interface{}(m.GetRange()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DoubleMatcherValidationError{ - field: "Range", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DoubleMatcherValidationError{ - field: "Range", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRange()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DoubleMatcherValidationError{ - field: "Range", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *DoubleMatcher_Exact: - if v == nil { - err := DoubleMatcherValidationError{ - field: "MatchPattern", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchPatternPresent = true - // no validation rules for Exact - default: - _ = v // ensures v is used - } - if !oneofMatchPatternPresent { - err := DoubleMatcherValidationError{ - field: "MatchPattern", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return DoubleMatcherMultiError(errors) - } - - return nil -} - -// DoubleMatcherMultiError is an error wrapping multiple validation errors -// returned by DoubleMatcher.ValidateAll() if the designated constraints -// aren't met. -type DoubleMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DoubleMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DoubleMatcherMultiError) AllErrors() []error { return m } - -// DoubleMatcherValidationError is the validation error returned by -// DoubleMatcher.Validate if the designated constraints aren't met. -type DoubleMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DoubleMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DoubleMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DoubleMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DoubleMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DoubleMatcherValidationError) ErrorName() string { return "DoubleMatcherValidationError" } - -// Error satisfies the builtin error interface -func (e DoubleMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDoubleMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DoubleMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DoubleMatcherValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/path.pb.go b/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/path.pb.go deleted file mode 100644 index 26a9d1f71..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/path.pb.go +++ /dev/null @@ -1,202 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/type/matcher/v3/path.proto - -package matcherv3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Specifies the way to match a path on HTTP request. -type PathMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Rule: - // - // *PathMatcher_Path - Rule isPathMatcher_Rule `protobuf_oneof:"rule"` -} - -func (x *PathMatcher) Reset() { - *x = PathMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_matcher_v3_path_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PathMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PathMatcher) ProtoMessage() {} - -func (x *PathMatcher) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_matcher_v3_path_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PathMatcher.ProtoReflect.Descriptor instead. -func (*PathMatcher) Descriptor() ([]byte, []int) { - return file_envoy_type_matcher_v3_path_proto_rawDescGZIP(), []int{0} -} - -func (m *PathMatcher) GetRule() isPathMatcher_Rule { - if m != nil { - return m.Rule - } - return nil -} - -func (x *PathMatcher) GetPath() *StringMatcher { - if x, ok := x.GetRule().(*PathMatcher_Path); ok { - return x.Path - } - return nil -} - -type isPathMatcher_Rule interface { - isPathMatcher_Rule() -} - -type PathMatcher_Path struct { - // The “path“ must match the URL path portion of the :path header. The query and fragment - // string (if present) are removed in the URL path portion. - // For example, the path “/data“ will match the “:path“ header “/data#fragment?param=value“. - Path *StringMatcher `protobuf:"bytes,1,opt,name=path,proto3,oneof"` -} - -func (*PathMatcher_Path) isPathMatcher_Rule() {} - -var File_envoy_type_matcher_v3_path_proto protoreflect.FileDescriptor - -var file_envoy_type_matcher_v3_path_proto_rawDesc = []byte{ - 0x0a, 0x20, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x15, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, - 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x1a, 0x22, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, - 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x75, - 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x75, 0x64, - 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x87, 0x01, 0x0a, 0x0b, 0x50, 0x61, 0x74, - 0x68, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x44, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x53, - 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x42, 0x08, 0xfa, 0x42, - 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x3a, 0x25, - 0x9a, 0xc5, 0x88, 0x1e, 0x20, 0x0a, 0x1e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x4d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x42, 0x0b, 0x0a, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x12, 0x03, 0xf8, - 0x42, 0x01, 0x42, 0x82, 0x01, 0x0a, 0x23, 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, - 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x42, 0x09, 0x50, 0x61, 0x74, 0x68, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, - 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x2f, 0x76, 0x33, 0x3b, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x76, 0x33, 0xba, - 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_type_matcher_v3_path_proto_rawDescOnce sync.Once - file_envoy_type_matcher_v3_path_proto_rawDescData = file_envoy_type_matcher_v3_path_proto_rawDesc -) - -func file_envoy_type_matcher_v3_path_proto_rawDescGZIP() []byte { - file_envoy_type_matcher_v3_path_proto_rawDescOnce.Do(func() { - file_envoy_type_matcher_v3_path_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_type_matcher_v3_path_proto_rawDescData) - }) - return file_envoy_type_matcher_v3_path_proto_rawDescData -} - -var file_envoy_type_matcher_v3_path_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_type_matcher_v3_path_proto_goTypes = []interface{}{ - (*PathMatcher)(nil), // 0: envoy.type.matcher.v3.PathMatcher - (*StringMatcher)(nil), // 1: envoy.type.matcher.v3.StringMatcher -} -var file_envoy_type_matcher_v3_path_proto_depIdxs = []int32{ - 1, // 0: envoy.type.matcher.v3.PathMatcher.path:type_name -> envoy.type.matcher.v3.StringMatcher - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_envoy_type_matcher_v3_path_proto_init() } -func file_envoy_type_matcher_v3_path_proto_init() { - if File_envoy_type_matcher_v3_path_proto != nil { - return - } - file_envoy_type_matcher_v3_string_proto_init() - if !protoimpl.UnsafeEnabled { - file_envoy_type_matcher_v3_path_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PathMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_type_matcher_v3_path_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*PathMatcher_Path)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_type_matcher_v3_path_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_type_matcher_v3_path_proto_goTypes, - DependencyIndexes: file_envoy_type_matcher_v3_path_proto_depIdxs, - MessageInfos: file_envoy_type_matcher_v3_path_proto_msgTypes, - }.Build() - File_envoy_type_matcher_v3_path_proto = out.File - file_envoy_type_matcher_v3_path_proto_rawDesc = nil - file_envoy_type_matcher_v3_path_proto_goTypes = nil - file_envoy_type_matcher_v3_path_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/path.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/path.pb.validate.go deleted file mode 100644 index 524fae95a..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/path.pb.validate.go +++ /dev/null @@ -1,204 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/type/matcher/v3/path.proto - -package matcherv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on PathMatcher with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *PathMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on PathMatcher with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in PathMatcherMultiError, or -// nil if none found. -func (m *PathMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *PathMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofRulePresent := false - switch v := m.Rule.(type) { - case *PathMatcher_Path: - if v == nil { - err := PathMatcherValidationError{ - field: "Rule", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofRulePresent = true - - if m.GetPath() == nil { - err := PathMatcherValidationError{ - field: "Path", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetPath()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PathMatcherValidationError{ - field: "Path", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PathMatcherValidationError{ - field: "Path", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPath()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return PathMatcherValidationError{ - field: "Path", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofRulePresent { - err := PathMatcherValidationError{ - field: "Rule", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return PathMatcherMultiError(errors) - } - - return nil -} - -// PathMatcherMultiError is an error wrapping multiple validation errors -// returned by PathMatcher.ValidateAll() if the designated constraints aren't met. -type PathMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PathMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m PathMatcherMultiError) AllErrors() []error { return m } - -// PathMatcherValidationError is the validation error returned by -// PathMatcher.Validate if the designated constraints aren't met. -type PathMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e PathMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e PathMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e PathMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e PathMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e PathMatcherValidationError) ErrorName() string { return "PathMatcherValidationError" } - -// Error satisfies the builtin error interface -func (e PathMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sPathMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = PathMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = PathMatcherValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/regex.pb.go b/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/regex.pb.go deleted file mode 100644 index 856cf6acc..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/regex.pb.go +++ /dev/null @@ -1,420 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/type/matcher/v3/regex.proto - -package matcherv3 - -import ( - _ "github.com/cilium/proxy/go/envoy/annotations" - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// A regex matcher designed for safety when used with untrusted input. -type RegexMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to EngineType: - // - // *RegexMatcher_GoogleRe2 - EngineType isRegexMatcher_EngineType `protobuf_oneof:"engine_type"` - // The regex match string. The string must be supported by the configured engine. The regex is matched - // against the full string, not as a partial match. - Regex string `protobuf:"bytes,2,opt,name=regex,proto3" json:"regex,omitempty"` -} - -func (x *RegexMatcher) Reset() { - *x = RegexMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_matcher_v3_regex_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RegexMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RegexMatcher) ProtoMessage() {} - -func (x *RegexMatcher) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_matcher_v3_regex_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RegexMatcher.ProtoReflect.Descriptor instead. -func (*RegexMatcher) Descriptor() ([]byte, []int) { - return file_envoy_type_matcher_v3_regex_proto_rawDescGZIP(), []int{0} -} - -func (m *RegexMatcher) GetEngineType() isRegexMatcher_EngineType { - if m != nil { - return m.EngineType - } - return nil -} - -// Deprecated: Do not use. -func (x *RegexMatcher) GetGoogleRe2() *RegexMatcher_GoogleRE2 { - if x, ok := x.GetEngineType().(*RegexMatcher_GoogleRe2); ok { - return x.GoogleRe2 - } - return nil -} - -func (x *RegexMatcher) GetRegex() string { - if x != nil { - return x.Regex - } - return "" -} - -type isRegexMatcher_EngineType interface { - isRegexMatcher_EngineType() -} - -type RegexMatcher_GoogleRe2 struct { - // Google's RE2 regex engine. - // - // Deprecated: Do not use. - GoogleRe2 *RegexMatcher_GoogleRE2 `protobuf:"bytes,1,opt,name=google_re2,json=googleRe2,proto3,oneof"` -} - -func (*RegexMatcher_GoogleRe2) isRegexMatcher_EngineType() {} - -// Describes how to match a string and then produce a new string using a regular -// expression and a substitution string. -type RegexMatchAndSubstitute struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The regular expression used to find portions of a string (hereafter called - // the "subject string") that should be replaced. When a new string is - // produced during the substitution operation, the new string is initially - // the same as the subject string, but then all matches in the subject string - // are replaced by the substitution string. If replacing all matches isn't - // desired, regular expression anchors can be used to ensure a single match, - // so as to replace just one occurrence of a pattern. Capture groups can be - // used in the pattern to extract portions of the subject string, and then - // referenced in the substitution string. - Pattern *RegexMatcher `protobuf:"bytes,1,opt,name=pattern,proto3" json:"pattern,omitempty"` - // The string that should be substituted into matching portions of the - // subject string during a substitution operation to produce a new string. - // Capture groups in the pattern can be referenced in the substitution - // string. Note, however, that the syntax for referring to capture groups is - // defined by the chosen regular expression engine. Google's `RE2 - // `_ regular expression engine uses a - // backslash followed by the capture group number to denote a numbered - // capture group. E.g., “\1“ refers to capture group 1, and “\2“ refers - // to capture group 2. - Substitution string `protobuf:"bytes,2,opt,name=substitution,proto3" json:"substitution,omitempty"` -} - -func (x *RegexMatchAndSubstitute) Reset() { - *x = RegexMatchAndSubstitute{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_matcher_v3_regex_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RegexMatchAndSubstitute) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RegexMatchAndSubstitute) ProtoMessage() {} - -func (x *RegexMatchAndSubstitute) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_matcher_v3_regex_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RegexMatchAndSubstitute.ProtoReflect.Descriptor instead. -func (*RegexMatchAndSubstitute) Descriptor() ([]byte, []int) { - return file_envoy_type_matcher_v3_regex_proto_rawDescGZIP(), []int{1} -} - -func (x *RegexMatchAndSubstitute) GetPattern() *RegexMatcher { - if x != nil { - return x.Pattern - } - return nil -} - -func (x *RegexMatchAndSubstitute) GetSubstitution() string { - if x != nil { - return x.Substitution - } - return "" -} - -// Google's `RE2 `_ regex engine. The regex string must adhere to -// the documented `syntax `_. The engine is designed -// to complete execution in linear time as well as limit the amount of memory used. -// -// Envoy supports program size checking via runtime. The runtime keys “re2.max_program_size.error_level“ -// and “re2.max_program_size.warn_level“ can be set to integers as the maximum program size or -// complexity that a compiled regex can have before an exception is thrown or a warning is -// logged, respectively. “re2.max_program_size.error_level“ defaults to 100, and -// “re2.max_program_size.warn_level“ has no default if unset (will not check/log a warning). -// -// Envoy emits two stats for tracking the program size of regexes: the histogram “re2.program_size“, -// which records the program size, and the counter “re2.exceeded_warn_level“, which is incremented -// each time the program size exceeds the warn level threshold. -type RegexMatcher_GoogleRE2 struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // This field controls the RE2 "program size" which is a rough estimate of how complex a - // compiled regex is to evaluate. A regex that has a program size greater than the configured - // value will fail to compile. In this case, the configured max program size can be increased - // or the regex can be simplified. If not specified, the default is 100. - // - // This field is deprecated; regexp validation should be performed on the management server - // instead of being done by each individual client. - // - // .. note:: - // - // Although this field is deprecated, the program size will still be checked against the - // global ``re2.max_program_size.error_level`` runtime value. - // - // Deprecated: Do not use. - MaxProgramSize *wrapperspb.UInt32Value `protobuf:"bytes,1,opt,name=max_program_size,json=maxProgramSize,proto3" json:"max_program_size,omitempty"` -} - -func (x *RegexMatcher_GoogleRE2) Reset() { - *x = RegexMatcher_GoogleRE2{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_matcher_v3_regex_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RegexMatcher_GoogleRE2) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RegexMatcher_GoogleRE2) ProtoMessage() {} - -func (x *RegexMatcher_GoogleRE2) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_matcher_v3_regex_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RegexMatcher_GoogleRE2.ProtoReflect.Descriptor instead. -func (*RegexMatcher_GoogleRE2) Descriptor() ([]byte, []int) { - return file_envoy_type_matcher_v3_regex_proto_rawDescGZIP(), []int{0, 0} -} - -// Deprecated: Do not use. -func (x *RegexMatcher_GoogleRE2) GetMaxProgramSize() *wrapperspb.UInt32Value { - if x != nil { - return x.MaxProgramSize - } - return nil -} - -var File_envoy_type_matcher_v3_regex_proto protoreflect.FileDescriptor - -var file_envoy_type_matcher_v3_regex_proto_rawDesc = []byte{ - 0x0a, 0x21, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x78, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, - 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x64, 0x65, - 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, - 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd6, 0x02, 0x0a, 0x0c, 0x52, - 0x65, 0x67, 0x65, 0x78, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x5b, 0x0a, 0x0a, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x5f, 0x72, 0x65, 0x32, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x2d, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x67, 0x65, 0x78, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x52, 0x45, 0x32, 0x42, 0x0b, - 0x18, 0x01, 0x92, 0xc7, 0x86, 0xd8, 0x04, 0x03, 0x33, 0x2e, 0x30, 0x48, 0x00, 0x52, 0x09, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x52, 0x65, 0x32, 0x12, 0x1d, 0x0a, 0x05, 0x72, 0x65, 0x67, 0x65, - 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, - 0x52, 0x05, 0x72, 0x65, 0x67, 0x65, 0x78, 0x1a, 0x92, 0x01, 0x0a, 0x09, 0x47, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x52, 0x45, 0x32, 0x12, 0x53, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x72, 0x6f, - 0x67, 0x72, 0x61, 0x6d, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x0b, 0x18, - 0x01, 0x92, 0xc7, 0x86, 0xd8, 0x04, 0x03, 0x33, 0x2e, 0x30, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x50, - 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x53, 0x69, 0x7a, 0x65, 0x3a, 0x30, 0x9a, 0xc5, 0x88, 0x1e, - 0x2b, 0x0a, 0x29, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x65, 0x78, 0x4d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x52, 0x45, 0x32, 0x3a, 0x26, 0x9a, 0xc5, - 0x88, 0x1e, 0x21, 0x0a, 0x1f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x65, 0x78, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x42, 0x0d, 0x0a, 0x0b, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x22, 0xc6, 0x01, 0x0a, 0x17, 0x52, 0x65, 0x67, 0x65, 0x78, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x41, 0x6e, 0x64, 0x53, 0x75, 0x62, 0x73, 0x74, 0x69, 0x74, 0x75, 0x74, 0x65, 0x12, - 0x47, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x23, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x67, 0x65, 0x78, 0x4d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, - 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x2f, 0x0a, 0x0c, 0x73, 0x75, 0x62, 0x73, - 0x74, 0x69, 0x74, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, - 0xfa, 0x42, 0x08, 0x72, 0x06, 0xc0, 0x01, 0x02, 0xc8, 0x01, 0x00, 0x52, 0x0c, 0x73, 0x75, 0x62, - 0x73, 0x74, 0x69, 0x74, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x31, 0x9a, 0xc5, 0x88, 0x1e, 0x2c, - 0x0a, 0x2a, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x65, 0x78, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x41, - 0x6e, 0x64, 0x53, 0x75, 0x62, 0x73, 0x74, 0x69, 0x74, 0x75, 0x74, 0x65, 0x42, 0x83, 0x01, 0x0a, - 0x23, 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x2e, 0x76, 0x33, 0x42, 0x0a, 0x52, 0x65, 0x67, 0x65, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, - 0x3b, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, - 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_type_matcher_v3_regex_proto_rawDescOnce sync.Once - file_envoy_type_matcher_v3_regex_proto_rawDescData = file_envoy_type_matcher_v3_regex_proto_rawDesc -) - -func file_envoy_type_matcher_v3_regex_proto_rawDescGZIP() []byte { - file_envoy_type_matcher_v3_regex_proto_rawDescOnce.Do(func() { - file_envoy_type_matcher_v3_regex_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_type_matcher_v3_regex_proto_rawDescData) - }) - return file_envoy_type_matcher_v3_regex_proto_rawDescData -} - -var file_envoy_type_matcher_v3_regex_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_envoy_type_matcher_v3_regex_proto_goTypes = []interface{}{ - (*RegexMatcher)(nil), // 0: envoy.type.matcher.v3.RegexMatcher - (*RegexMatchAndSubstitute)(nil), // 1: envoy.type.matcher.v3.RegexMatchAndSubstitute - (*RegexMatcher_GoogleRE2)(nil), // 2: envoy.type.matcher.v3.RegexMatcher.GoogleRE2 - (*wrapperspb.UInt32Value)(nil), // 3: google.protobuf.UInt32Value -} -var file_envoy_type_matcher_v3_regex_proto_depIdxs = []int32{ - 2, // 0: envoy.type.matcher.v3.RegexMatcher.google_re2:type_name -> envoy.type.matcher.v3.RegexMatcher.GoogleRE2 - 0, // 1: envoy.type.matcher.v3.RegexMatchAndSubstitute.pattern:type_name -> envoy.type.matcher.v3.RegexMatcher - 3, // 2: envoy.type.matcher.v3.RegexMatcher.GoogleRE2.max_program_size:type_name -> google.protobuf.UInt32Value - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_envoy_type_matcher_v3_regex_proto_init() } -func file_envoy_type_matcher_v3_regex_proto_init() { - if File_envoy_type_matcher_v3_regex_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_envoy_type_matcher_v3_regex_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RegexMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_matcher_v3_regex_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RegexMatchAndSubstitute); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_matcher_v3_regex_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RegexMatcher_GoogleRE2); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_type_matcher_v3_regex_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*RegexMatcher_GoogleRe2)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_type_matcher_v3_regex_proto_rawDesc, - NumEnums: 0, - NumMessages: 3, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_type_matcher_v3_regex_proto_goTypes, - DependencyIndexes: file_envoy_type_matcher_v3_regex_proto_depIdxs, - MessageInfos: file_envoy_type_matcher_v3_regex_proto_msgTypes, - }.Build() - File_envoy_type_matcher_v3_regex_proto = out.File - file_envoy_type_matcher_v3_regex_proto_rawDesc = nil - file_envoy_type_matcher_v3_regex_proto_goTypes = nil - file_envoy_type_matcher_v3_regex_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/regex.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/regex.pb.validate.go deleted file mode 100644 index efd4f4144..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/regex.pb.validate.go +++ /dev/null @@ -1,478 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/type/matcher/v3/regex.proto - -package matcherv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on RegexMatcher with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *RegexMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RegexMatcher with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in RegexMatcherMultiError, or -// nil if none found. -func (m *RegexMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *RegexMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetRegex()) < 1 { - err := RegexMatcherValidationError{ - field: "Regex", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - switch v := m.EngineType.(type) { - case *RegexMatcher_GoogleRe2: - if v == nil { - err := RegexMatcherValidationError{ - field: "EngineType", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetGoogleRe2()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RegexMatcherValidationError{ - field: "GoogleRe2", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RegexMatcherValidationError{ - field: "GoogleRe2", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetGoogleRe2()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RegexMatcherValidationError{ - field: "GoogleRe2", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return RegexMatcherMultiError(errors) - } - - return nil -} - -// RegexMatcherMultiError is an error wrapping multiple validation errors -// returned by RegexMatcher.ValidateAll() if the designated constraints aren't met. -type RegexMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RegexMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RegexMatcherMultiError) AllErrors() []error { return m } - -// RegexMatcherValidationError is the validation error returned by -// RegexMatcher.Validate if the designated constraints aren't met. -type RegexMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RegexMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RegexMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RegexMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RegexMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RegexMatcherValidationError) ErrorName() string { return "RegexMatcherValidationError" } - -// Error satisfies the builtin error interface -func (e RegexMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRegexMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RegexMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RegexMatcherValidationError{} - -// Validate checks the field values on RegexMatchAndSubstitute with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RegexMatchAndSubstitute) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RegexMatchAndSubstitute with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RegexMatchAndSubstituteMultiError, or nil if none found. -func (m *RegexMatchAndSubstitute) ValidateAll() error { - return m.validate(true) -} - -func (m *RegexMatchAndSubstitute) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetPattern() == nil { - err := RegexMatchAndSubstituteValidationError{ - field: "Pattern", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetPattern()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RegexMatchAndSubstituteValidationError{ - field: "Pattern", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RegexMatchAndSubstituteValidationError{ - field: "Pattern", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPattern()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RegexMatchAndSubstituteValidationError{ - field: "Pattern", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if !_RegexMatchAndSubstitute_Substitution_Pattern.MatchString(m.GetSubstitution()) { - err := RegexMatchAndSubstituteValidationError{ - field: "Substitution", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return RegexMatchAndSubstituteMultiError(errors) - } - - return nil -} - -// RegexMatchAndSubstituteMultiError is an error wrapping multiple validation -// errors returned by RegexMatchAndSubstitute.ValidateAll() if the designated -// constraints aren't met. -type RegexMatchAndSubstituteMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RegexMatchAndSubstituteMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RegexMatchAndSubstituteMultiError) AllErrors() []error { return m } - -// RegexMatchAndSubstituteValidationError is the validation error returned by -// RegexMatchAndSubstitute.Validate if the designated constraints aren't met. -type RegexMatchAndSubstituteValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RegexMatchAndSubstituteValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RegexMatchAndSubstituteValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RegexMatchAndSubstituteValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RegexMatchAndSubstituteValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RegexMatchAndSubstituteValidationError) ErrorName() string { - return "RegexMatchAndSubstituteValidationError" -} - -// Error satisfies the builtin error interface -func (e RegexMatchAndSubstituteValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRegexMatchAndSubstitute.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RegexMatchAndSubstituteValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RegexMatchAndSubstituteValidationError{} - -var _RegexMatchAndSubstitute_Substitution_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -// Validate checks the field values on RegexMatcher_GoogleRE2 with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RegexMatcher_GoogleRE2) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RegexMatcher_GoogleRE2 with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RegexMatcher_GoogleRE2MultiError, or nil if none found. -func (m *RegexMatcher_GoogleRE2) ValidateAll() error { - return m.validate(true) -} - -func (m *RegexMatcher_GoogleRE2) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetMaxProgramSize()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RegexMatcher_GoogleRE2ValidationError{ - field: "MaxProgramSize", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RegexMatcher_GoogleRE2ValidationError{ - field: "MaxProgramSize", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMaxProgramSize()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RegexMatcher_GoogleRE2ValidationError{ - field: "MaxProgramSize", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return RegexMatcher_GoogleRE2MultiError(errors) - } - - return nil -} - -// RegexMatcher_GoogleRE2MultiError is an error wrapping multiple validation -// errors returned by RegexMatcher_GoogleRE2.ValidateAll() if the designated -// constraints aren't met. -type RegexMatcher_GoogleRE2MultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RegexMatcher_GoogleRE2MultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RegexMatcher_GoogleRE2MultiError) AllErrors() []error { return m } - -// RegexMatcher_GoogleRE2ValidationError is the validation error returned by -// RegexMatcher_GoogleRE2.Validate if the designated constraints aren't met. -type RegexMatcher_GoogleRE2ValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RegexMatcher_GoogleRE2ValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RegexMatcher_GoogleRE2ValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RegexMatcher_GoogleRE2ValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RegexMatcher_GoogleRE2ValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RegexMatcher_GoogleRE2ValidationError) ErrorName() string { - return "RegexMatcher_GoogleRE2ValidationError" -} - -// Error satisfies the builtin error interface -func (e RegexMatcher_GoogleRE2ValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRegexMatcher_GoogleRE2.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RegexMatcher_GoogleRE2ValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RegexMatcher_GoogleRE2ValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/status_code_input.pb.go b/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/status_code_input.pb.go deleted file mode 100644 index 4a99bcee4..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/status_code_input.pb.go +++ /dev/null @@ -1,209 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/type/matcher/v3/status_code_input.proto - -package matcherv3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Match input indicates that matching should be done on the response status -// code. -type HttpResponseStatusCodeMatchInput struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *HttpResponseStatusCodeMatchInput) Reset() { - *x = HttpResponseStatusCodeMatchInput{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_matcher_v3_status_code_input_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HttpResponseStatusCodeMatchInput) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HttpResponseStatusCodeMatchInput) ProtoMessage() {} - -func (x *HttpResponseStatusCodeMatchInput) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_matcher_v3_status_code_input_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HttpResponseStatusCodeMatchInput.ProtoReflect.Descriptor instead. -func (*HttpResponseStatusCodeMatchInput) Descriptor() ([]byte, []int) { - return file_envoy_type_matcher_v3_status_code_input_proto_rawDescGZIP(), []int{0} -} - -// Match input indicates that the matching should be done on the class of the -// response status code. For eg: 1xx, 2xx, 3xx, 4xx or 5xx. -type HttpResponseStatusCodeClassMatchInput struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *HttpResponseStatusCodeClassMatchInput) Reset() { - *x = HttpResponseStatusCodeClassMatchInput{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_matcher_v3_status_code_input_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HttpResponseStatusCodeClassMatchInput) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HttpResponseStatusCodeClassMatchInput) ProtoMessage() {} - -func (x *HttpResponseStatusCodeClassMatchInput) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_matcher_v3_status_code_input_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HttpResponseStatusCodeClassMatchInput.ProtoReflect.Descriptor instead. -func (*HttpResponseStatusCodeClassMatchInput) Descriptor() ([]byte, []int) { - return file_envoy_type_matcher_v3_status_code_input_proto_rawDescGZIP(), []int{1} -} - -var File_envoy_type_matcher_v3_status_code_input_proto protoreflect.FileDescriptor - -var file_envoy_type_matcher_v3_status_code_input_proto_rawDesc = []byte{ - 0x0a, 0x2d, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x63, - 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x15, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, - 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, - 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x22, 0x0a, 0x20, 0x48, 0x74, 0x74, 0x70, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x4d, - 0x61, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x22, 0x27, 0x0a, 0x25, 0x48, 0x74, 0x74, - 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, - 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x70, - 0x75, 0x74, 0x42, 0x8d, 0x01, 0x0a, 0x23, 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, - 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x42, 0x14, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, - 0x3b, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, - 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_type_matcher_v3_status_code_input_proto_rawDescOnce sync.Once - file_envoy_type_matcher_v3_status_code_input_proto_rawDescData = file_envoy_type_matcher_v3_status_code_input_proto_rawDesc -) - -func file_envoy_type_matcher_v3_status_code_input_proto_rawDescGZIP() []byte { - file_envoy_type_matcher_v3_status_code_input_proto_rawDescOnce.Do(func() { - file_envoy_type_matcher_v3_status_code_input_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_type_matcher_v3_status_code_input_proto_rawDescData) - }) - return file_envoy_type_matcher_v3_status_code_input_proto_rawDescData -} - -var file_envoy_type_matcher_v3_status_code_input_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_envoy_type_matcher_v3_status_code_input_proto_goTypes = []interface{}{ - (*HttpResponseStatusCodeMatchInput)(nil), // 0: envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput - (*HttpResponseStatusCodeClassMatchInput)(nil), // 1: envoy.type.matcher.v3.HttpResponseStatusCodeClassMatchInput -} -var file_envoy_type_matcher_v3_status_code_input_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_envoy_type_matcher_v3_status_code_input_proto_init() } -func file_envoy_type_matcher_v3_status_code_input_proto_init() { - if File_envoy_type_matcher_v3_status_code_input_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_envoy_type_matcher_v3_status_code_input_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HttpResponseStatusCodeMatchInput); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_matcher_v3_status_code_input_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HttpResponseStatusCodeClassMatchInput); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_type_matcher_v3_status_code_input_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_type_matcher_v3_status_code_input_proto_goTypes, - DependencyIndexes: file_envoy_type_matcher_v3_status_code_input_proto_depIdxs, - MessageInfos: file_envoy_type_matcher_v3_status_code_input_proto_msgTypes, - }.Build() - File_envoy_type_matcher_v3_status_code_input_proto = out.File - file_envoy_type_matcher_v3_status_code_input_proto_rawDesc = nil - file_envoy_type_matcher_v3_status_code_input_proto_goTypes = nil - file_envoy_type_matcher_v3_status_code_input_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/status_code_input.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/status_code_input.pb.validate.go deleted file mode 100644 index 763fa9f33..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/status_code_input.pb.validate.go +++ /dev/null @@ -1,246 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/type/matcher/v3/status_code_input.proto - -package matcherv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on HttpResponseStatusCodeMatchInput with -// the rules defined in the proto definition for this message. If any rules -// are violated, the first error encountered is returned, or nil if there are -// no violations. -func (m *HttpResponseStatusCodeMatchInput) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HttpResponseStatusCodeMatchInput with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// HttpResponseStatusCodeMatchInputMultiError, or nil if none found. -func (m *HttpResponseStatusCodeMatchInput) ValidateAll() error { - return m.validate(true) -} - -func (m *HttpResponseStatusCodeMatchInput) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return HttpResponseStatusCodeMatchInputMultiError(errors) - } - - return nil -} - -// HttpResponseStatusCodeMatchInputMultiError is an error wrapping multiple -// validation errors returned by -// HttpResponseStatusCodeMatchInput.ValidateAll() if the designated -// constraints aren't met. -type HttpResponseStatusCodeMatchInputMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HttpResponseStatusCodeMatchInputMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HttpResponseStatusCodeMatchInputMultiError) AllErrors() []error { return m } - -// HttpResponseStatusCodeMatchInputValidationError is the validation error -// returned by HttpResponseStatusCodeMatchInput.Validate if the designated -// constraints aren't met. -type HttpResponseStatusCodeMatchInputValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HttpResponseStatusCodeMatchInputValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HttpResponseStatusCodeMatchInputValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HttpResponseStatusCodeMatchInputValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HttpResponseStatusCodeMatchInputValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HttpResponseStatusCodeMatchInputValidationError) ErrorName() string { - return "HttpResponseStatusCodeMatchInputValidationError" -} - -// Error satisfies the builtin error interface -func (e HttpResponseStatusCodeMatchInputValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttpResponseStatusCodeMatchInput.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HttpResponseStatusCodeMatchInputValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HttpResponseStatusCodeMatchInputValidationError{} - -// Validate checks the field values on HttpResponseStatusCodeClassMatchInput -// with the rules defined in the proto definition for this message. If any -// rules are violated, the first error encountered is returned, or nil if -// there are no violations. -func (m *HttpResponseStatusCodeClassMatchInput) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HttpResponseStatusCodeClassMatchInput -// with the rules defined in the proto definition for this message. If any -// rules are violated, the result is a list of violation errors wrapped in -// HttpResponseStatusCodeClassMatchInputMultiError, or nil if none found. -func (m *HttpResponseStatusCodeClassMatchInput) ValidateAll() error { - return m.validate(true) -} - -func (m *HttpResponseStatusCodeClassMatchInput) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return HttpResponseStatusCodeClassMatchInputMultiError(errors) - } - - return nil -} - -// HttpResponseStatusCodeClassMatchInputMultiError is an error wrapping -// multiple validation errors returned by -// HttpResponseStatusCodeClassMatchInput.ValidateAll() if the designated -// constraints aren't met. -type HttpResponseStatusCodeClassMatchInputMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HttpResponseStatusCodeClassMatchInputMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HttpResponseStatusCodeClassMatchInputMultiError) AllErrors() []error { return m } - -// HttpResponseStatusCodeClassMatchInputValidationError is the validation error -// returned by HttpResponseStatusCodeClassMatchInput.Validate if the -// designated constraints aren't met. -type HttpResponseStatusCodeClassMatchInputValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HttpResponseStatusCodeClassMatchInputValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HttpResponseStatusCodeClassMatchInputValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HttpResponseStatusCodeClassMatchInputValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HttpResponseStatusCodeClassMatchInputValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HttpResponseStatusCodeClassMatchInputValidationError) ErrorName() string { - return "HttpResponseStatusCodeClassMatchInputValidationError" -} - -// Error satisfies the builtin error interface -func (e HttpResponseStatusCodeClassMatchInputValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttpResponseStatusCodeClassMatchInput.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HttpResponseStatusCodeClassMatchInputValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HttpResponseStatusCodeClassMatchInputValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/string.pb.go b/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/string.pb.go deleted file mode 100644 index aeb8e9cdf..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/string.pb.go +++ /dev/null @@ -1,379 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/type/matcher/v3/string.proto - -package matcherv3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Specifies the way to match a string. -// [#next-free-field: 8] -type StringMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to MatchPattern: - // - // *StringMatcher_Exact - // *StringMatcher_Prefix - // *StringMatcher_Suffix - // *StringMatcher_SafeRegex - // *StringMatcher_Contains - MatchPattern isStringMatcher_MatchPattern `protobuf_oneof:"match_pattern"` - // If true, indicates the exact/prefix/suffix/contains matching should be case insensitive. This - // has no effect for the safe_regex match. - // For example, the matcher “data“ will match both input string “Data“ and “data“ if set to true. - IgnoreCase bool `protobuf:"varint,6,opt,name=ignore_case,json=ignoreCase,proto3" json:"ignore_case,omitempty"` -} - -func (x *StringMatcher) Reset() { - *x = StringMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_matcher_v3_string_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StringMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StringMatcher) ProtoMessage() {} - -func (x *StringMatcher) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_matcher_v3_string_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StringMatcher.ProtoReflect.Descriptor instead. -func (*StringMatcher) Descriptor() ([]byte, []int) { - return file_envoy_type_matcher_v3_string_proto_rawDescGZIP(), []int{0} -} - -func (m *StringMatcher) GetMatchPattern() isStringMatcher_MatchPattern { - if m != nil { - return m.MatchPattern - } - return nil -} - -func (x *StringMatcher) GetExact() string { - if x, ok := x.GetMatchPattern().(*StringMatcher_Exact); ok { - return x.Exact - } - return "" -} - -func (x *StringMatcher) GetPrefix() string { - if x, ok := x.GetMatchPattern().(*StringMatcher_Prefix); ok { - return x.Prefix - } - return "" -} - -func (x *StringMatcher) GetSuffix() string { - if x, ok := x.GetMatchPattern().(*StringMatcher_Suffix); ok { - return x.Suffix - } - return "" -} - -func (x *StringMatcher) GetSafeRegex() *RegexMatcher { - if x, ok := x.GetMatchPattern().(*StringMatcher_SafeRegex); ok { - return x.SafeRegex - } - return nil -} - -func (x *StringMatcher) GetContains() string { - if x, ok := x.GetMatchPattern().(*StringMatcher_Contains); ok { - return x.Contains - } - return "" -} - -func (x *StringMatcher) GetIgnoreCase() bool { - if x != nil { - return x.IgnoreCase - } - return false -} - -type isStringMatcher_MatchPattern interface { - isStringMatcher_MatchPattern() -} - -type StringMatcher_Exact struct { - // The input string must match exactly the string specified here. - // - // Examples: - // - // * “abc“ only matches the value “abc“. - Exact string `protobuf:"bytes,1,opt,name=exact,proto3,oneof"` -} - -type StringMatcher_Prefix struct { - // The input string must have the prefix specified here. - // Note: empty prefix is not allowed, please use regex instead. - // - // Examples: - // - // * “abc“ matches the value “abc.xyz“ - Prefix string `protobuf:"bytes,2,opt,name=prefix,proto3,oneof"` -} - -type StringMatcher_Suffix struct { - // The input string must have the suffix specified here. - // Note: empty prefix is not allowed, please use regex instead. - // - // Examples: - // - // * “abc“ matches the value “xyz.abc“ - Suffix string `protobuf:"bytes,3,opt,name=suffix,proto3,oneof"` -} - -type StringMatcher_SafeRegex struct { - // The input string must match the regular expression specified here. - SafeRegex *RegexMatcher `protobuf:"bytes,5,opt,name=safe_regex,json=safeRegex,proto3,oneof"` -} - -type StringMatcher_Contains struct { - // The input string must have the substring specified here. - // Note: empty contains match is not allowed, please use regex instead. - // - // Examples: - // - // * “abc“ matches the value “xyz.abc.def“ - Contains string `protobuf:"bytes,7,opt,name=contains,proto3,oneof"` -} - -func (*StringMatcher_Exact) isStringMatcher_MatchPattern() {} - -func (*StringMatcher_Prefix) isStringMatcher_MatchPattern() {} - -func (*StringMatcher_Suffix) isStringMatcher_MatchPattern() {} - -func (*StringMatcher_SafeRegex) isStringMatcher_MatchPattern() {} - -func (*StringMatcher_Contains) isStringMatcher_MatchPattern() {} - -// Specifies a list of ways to match a string. -type ListStringMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Patterns []*StringMatcher `protobuf:"bytes,1,rep,name=patterns,proto3" json:"patterns,omitempty"` -} - -func (x *ListStringMatcher) Reset() { - *x = ListStringMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_matcher_v3_string_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListStringMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListStringMatcher) ProtoMessage() {} - -func (x *ListStringMatcher) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_matcher_v3_string_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListStringMatcher.ProtoReflect.Descriptor instead. -func (*ListStringMatcher) Descriptor() ([]byte, []int) { - return file_envoy_type_matcher_v3_string_proto_rawDescGZIP(), []int{1} -} - -func (x *ListStringMatcher) GetPatterns() []*StringMatcher { - if x != nil { - return x.Patterns - } - return nil -} - -var File_envoy_type_matcher_v3_string_proto protoreflect.FileDescriptor - -var file_envoy_type_matcher_v3_string_proto_rawDesc = []byte{ - 0x0a, 0x22, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x1a, 0x21, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, - 0x76, 0x33, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, - 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x75, - 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd1, 0x02, 0x0a, 0x0d, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x05, 0x65, - 0x78, 0x61, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x65, 0x78, - 0x61, 0x63, 0x74, 0x12, 0x21, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, 0x06, - 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x21, 0x0a, 0x06, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x48, - 0x00, 0x52, 0x06, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x12, 0x4e, 0x0a, 0x0a, 0x73, 0x61, 0x66, - 0x65, 0x5f, 0x72, 0x65, 0x67, 0x65, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x67, 0x65, 0x78, 0x4d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, 0x09, - 0x73, 0x61, 0x66, 0x65, 0x52, 0x65, 0x67, 0x65, 0x78, 0x12, 0x25, 0x0a, 0x08, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, - 0x72, 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, - 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x63, 0x61, 0x73, 0x65, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x43, 0x61, 0x73, - 0x65, 0x3a, 0x27, 0x9a, 0xc5, 0x88, 0x1e, 0x22, 0x0a, 0x20, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x42, 0x14, 0x0a, 0x0d, 0x6d, 0x61, - 0x74, 0x63, 0x68, 0x5f, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x03, 0xf8, 0x42, 0x01, - 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x52, 0x05, 0x72, 0x65, 0x67, 0x65, 0x78, 0x22, 0x8c, 0x01, - 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, - 0x68, 0x65, 0x72, 0x12, 0x4a, 0x0a, 0x08, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x42, 0x08, 0xfa, 0x42, 0x05, - 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x08, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x73, 0x3a, - 0x2b, 0x9a, 0xc5, 0x88, 0x1e, 0x26, 0x0a, 0x24, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, - 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x42, 0x84, 0x01, 0x0a, - 0x23, 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x2e, 0x76, 0x33, 0x42, 0x0b, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, - 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, - 0x33, 0x3b, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, - 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_type_matcher_v3_string_proto_rawDescOnce sync.Once - file_envoy_type_matcher_v3_string_proto_rawDescData = file_envoy_type_matcher_v3_string_proto_rawDesc -) - -func file_envoy_type_matcher_v3_string_proto_rawDescGZIP() []byte { - file_envoy_type_matcher_v3_string_proto_rawDescOnce.Do(func() { - file_envoy_type_matcher_v3_string_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_type_matcher_v3_string_proto_rawDescData) - }) - return file_envoy_type_matcher_v3_string_proto_rawDescData -} - -var file_envoy_type_matcher_v3_string_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_envoy_type_matcher_v3_string_proto_goTypes = []interface{}{ - (*StringMatcher)(nil), // 0: envoy.type.matcher.v3.StringMatcher - (*ListStringMatcher)(nil), // 1: envoy.type.matcher.v3.ListStringMatcher - (*RegexMatcher)(nil), // 2: envoy.type.matcher.v3.RegexMatcher -} -var file_envoy_type_matcher_v3_string_proto_depIdxs = []int32{ - 2, // 0: envoy.type.matcher.v3.StringMatcher.safe_regex:type_name -> envoy.type.matcher.v3.RegexMatcher - 0, // 1: envoy.type.matcher.v3.ListStringMatcher.patterns:type_name -> envoy.type.matcher.v3.StringMatcher - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_envoy_type_matcher_v3_string_proto_init() } -func file_envoy_type_matcher_v3_string_proto_init() { - if File_envoy_type_matcher_v3_string_proto != nil { - return - } - file_envoy_type_matcher_v3_regex_proto_init() - if !protoimpl.UnsafeEnabled { - file_envoy_type_matcher_v3_string_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StringMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_matcher_v3_string_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListStringMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_type_matcher_v3_string_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*StringMatcher_Exact)(nil), - (*StringMatcher_Prefix)(nil), - (*StringMatcher_Suffix)(nil), - (*StringMatcher_SafeRegex)(nil), - (*StringMatcher_Contains)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_type_matcher_v3_string_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_type_matcher_v3_string_proto_goTypes, - DependencyIndexes: file_envoy_type_matcher_v3_string_proto_depIdxs, - MessageInfos: file_envoy_type_matcher_v3_string_proto_msgTypes, - }.Build() - File_envoy_type_matcher_v3_string_proto = out.File - file_envoy_type_matcher_v3_string_proto_rawDesc = nil - file_envoy_type_matcher_v3_string_proto_goTypes = nil - file_envoy_type_matcher_v3_string_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/string.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/string.pb.validate.go deleted file mode 100644 index 9a67d92a6..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/string.pb.validate.go +++ /dev/null @@ -1,439 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/type/matcher/v3/string.proto - -package matcherv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on StringMatcher with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *StringMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on StringMatcher with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in StringMatcherMultiError, or -// nil if none found. -func (m *StringMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *StringMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for IgnoreCase - - oneofMatchPatternPresent := false - switch v := m.MatchPattern.(type) { - case *StringMatcher_Exact: - if v == nil { - err := StringMatcherValidationError{ - field: "MatchPattern", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchPatternPresent = true - // no validation rules for Exact - case *StringMatcher_Prefix: - if v == nil { - err := StringMatcherValidationError{ - field: "MatchPattern", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchPatternPresent = true - - if utf8.RuneCountInString(m.GetPrefix()) < 1 { - err := StringMatcherValidationError{ - field: "Prefix", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - case *StringMatcher_Suffix: - if v == nil { - err := StringMatcherValidationError{ - field: "MatchPattern", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchPatternPresent = true - - if utf8.RuneCountInString(m.GetSuffix()) < 1 { - err := StringMatcherValidationError{ - field: "Suffix", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - case *StringMatcher_SafeRegex: - if v == nil { - err := StringMatcherValidationError{ - field: "MatchPattern", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchPatternPresent = true - - if m.GetSafeRegex() == nil { - err := StringMatcherValidationError{ - field: "SafeRegex", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetSafeRegex()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, StringMatcherValidationError{ - field: "SafeRegex", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, StringMatcherValidationError{ - field: "SafeRegex", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSafeRegex()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return StringMatcherValidationError{ - field: "SafeRegex", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *StringMatcher_Contains: - if v == nil { - err := StringMatcherValidationError{ - field: "MatchPattern", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchPatternPresent = true - - if utf8.RuneCountInString(m.GetContains()) < 1 { - err := StringMatcherValidationError{ - field: "Contains", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - default: - _ = v // ensures v is used - } - if !oneofMatchPatternPresent { - err := StringMatcherValidationError{ - field: "MatchPattern", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return StringMatcherMultiError(errors) - } - - return nil -} - -// StringMatcherMultiError is an error wrapping multiple validation errors -// returned by StringMatcher.ValidateAll() if the designated constraints -// aren't met. -type StringMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m StringMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m StringMatcherMultiError) AllErrors() []error { return m } - -// StringMatcherValidationError is the validation error returned by -// StringMatcher.Validate if the designated constraints aren't met. -type StringMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e StringMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e StringMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e StringMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e StringMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e StringMatcherValidationError) ErrorName() string { return "StringMatcherValidationError" } - -// Error satisfies the builtin error interface -func (e StringMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sStringMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = StringMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = StringMatcherValidationError{} - -// Validate checks the field values on ListStringMatcher with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *ListStringMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ListStringMatcher with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ListStringMatcherMultiError, or nil if none found. -func (m *ListStringMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *ListStringMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(m.GetPatterns()) < 1 { - err := ListStringMatcherValidationError{ - field: "Patterns", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetPatterns() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ListStringMatcherValidationError{ - field: fmt.Sprintf("Patterns[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ListStringMatcherValidationError{ - field: fmt.Sprintf("Patterns[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ListStringMatcherValidationError{ - field: fmt.Sprintf("Patterns[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return ListStringMatcherMultiError(errors) - } - - return nil -} - -// ListStringMatcherMultiError is an error wrapping multiple validation errors -// returned by ListStringMatcher.ValidateAll() if the designated constraints -// aren't met. -type ListStringMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ListStringMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ListStringMatcherMultiError) AllErrors() []error { return m } - -// ListStringMatcherValidationError is the validation error returned by -// ListStringMatcher.Validate if the designated constraints aren't met. -type ListStringMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ListStringMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ListStringMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ListStringMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ListStringMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ListStringMatcherValidationError) ErrorName() string { - return "ListStringMatcherValidationError" -} - -// Error satisfies the builtin error interface -func (e ListStringMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sListStringMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ListStringMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ListStringMatcherValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/struct.pb.go b/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/struct.pb.go deleted file mode 100644 index 1024c39c9..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/struct.pb.go +++ /dev/null @@ -1,334 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/type/matcher/v3/struct.proto - -package matcherv3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// StructMatcher provides a general interface to check if a given value is matched in -// google.protobuf.Struct. It uses “path“ to retrieve the value -// from the struct and then check if it's matched to the specified value. -// -// For example, for the following Struct: -// -// .. code-block:: yaml -// -// fields: -// a: -// struct_value: -// fields: -// b: -// struct_value: -// fields: -// c: -// string_value: pro -// t: -// list_value: -// values: -// - string_value: m -// - string_value: n -// -// The following MetadataMatcher is matched as the path [a, b, c] will retrieve a string value "pro" -// from the Metadata which is matched to the specified prefix match. -// -// .. code-block:: yaml -// -// path: -// - key: a -// - key: b -// - key: c -// value: -// string_match: -// prefix: pr -// -// The following StructMatcher is matched as the code will match one of the string values in the -// list at the path [a, t]. -// -// .. code-block:: yaml -// -// path: -// - key: a -// - key: t -// value: -// list_match: -// one_of: -// string_match: -// exact: m -// -// An example use of StructMatcher is to match metadata in envoy.v*.core.Node. -type StructMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The path to retrieve the Value from the Struct. - Path []*StructMatcher_PathSegment `protobuf:"bytes,2,rep,name=path,proto3" json:"path,omitempty"` - // The StructMatcher is matched if the value retrieved by path is matched to this value. - Value *ValueMatcher `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *StructMatcher) Reset() { - *x = StructMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_matcher_v3_struct_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StructMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StructMatcher) ProtoMessage() {} - -func (x *StructMatcher) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_matcher_v3_struct_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StructMatcher.ProtoReflect.Descriptor instead. -func (*StructMatcher) Descriptor() ([]byte, []int) { - return file_envoy_type_matcher_v3_struct_proto_rawDescGZIP(), []int{0} -} - -func (x *StructMatcher) GetPath() []*StructMatcher_PathSegment { - if x != nil { - return x.Path - } - return nil -} - -func (x *StructMatcher) GetValue() *ValueMatcher { - if x != nil { - return x.Value - } - return nil -} - -// Specifies the segment in a path to retrieve value from Struct. -type StructMatcher_PathSegment struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Segment: - // - // *StructMatcher_PathSegment_Key - Segment isStructMatcher_PathSegment_Segment `protobuf_oneof:"segment"` -} - -func (x *StructMatcher_PathSegment) Reset() { - *x = StructMatcher_PathSegment{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_matcher_v3_struct_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StructMatcher_PathSegment) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StructMatcher_PathSegment) ProtoMessage() {} - -func (x *StructMatcher_PathSegment) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_matcher_v3_struct_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StructMatcher_PathSegment.ProtoReflect.Descriptor instead. -func (*StructMatcher_PathSegment) Descriptor() ([]byte, []int) { - return file_envoy_type_matcher_v3_struct_proto_rawDescGZIP(), []int{0, 0} -} - -func (m *StructMatcher_PathSegment) GetSegment() isStructMatcher_PathSegment_Segment { - if m != nil { - return m.Segment - } - return nil -} - -func (x *StructMatcher_PathSegment) GetKey() string { - if x, ok := x.GetSegment().(*StructMatcher_PathSegment_Key); ok { - return x.Key - } - return "" -} - -type isStructMatcher_PathSegment_Segment interface { - isStructMatcher_PathSegment_Segment() -} - -type StructMatcher_PathSegment_Key struct { - // If specified, use the key to retrieve the value in a Struct. - Key string `protobuf:"bytes,1,opt,name=key,proto3,oneof"` -} - -func (*StructMatcher_PathSegment_Key) isStructMatcher_PathSegment_Segment() {} - -var File_envoy_type_matcher_v3_struct_proto protoreflect.FileDescriptor - -var file_envoy_type_matcher_v3_struct_proto_rawDesc = []byte{ - 0x0a, 0x22, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x1a, 0x21, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, - 0x76, 0x33, 0x2f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, - 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x75, - 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbe, 0x02, 0x0a, 0x0d, 0x53, 0x74, - 0x72, 0x75, 0x63, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x4e, 0x0a, 0x04, 0x70, - 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, - 0x33, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, - 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x08, 0xfa, 0x42, 0x05, - 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x43, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, - 0x76, 0x33, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x42, - 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x1a, 0x6f, 0x0a, 0x0b, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x1b, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, - 0x04, 0x72, 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x3a, 0x33, 0x9a, 0xc5, - 0x88, 0x1e, 0x2e, 0x0a, 0x2c, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x4d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, - 0x74, 0x42, 0x0e, 0x0a, 0x07, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x03, 0xf8, 0x42, - 0x01, 0x3a, 0x27, 0x9a, 0xc5, 0x88, 0x1e, 0x22, 0x0a, 0x20, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x72, - 0x75, 0x63, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x42, 0x84, 0x01, 0x0a, 0x23, 0x69, - 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, - 0x76, 0x33, 0x42, 0x0b, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, - 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x3b, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x10, - 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_type_matcher_v3_struct_proto_rawDescOnce sync.Once - file_envoy_type_matcher_v3_struct_proto_rawDescData = file_envoy_type_matcher_v3_struct_proto_rawDesc -) - -func file_envoy_type_matcher_v3_struct_proto_rawDescGZIP() []byte { - file_envoy_type_matcher_v3_struct_proto_rawDescOnce.Do(func() { - file_envoy_type_matcher_v3_struct_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_type_matcher_v3_struct_proto_rawDescData) - }) - return file_envoy_type_matcher_v3_struct_proto_rawDescData -} - -var file_envoy_type_matcher_v3_struct_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_envoy_type_matcher_v3_struct_proto_goTypes = []interface{}{ - (*StructMatcher)(nil), // 0: envoy.type.matcher.v3.StructMatcher - (*StructMatcher_PathSegment)(nil), // 1: envoy.type.matcher.v3.StructMatcher.PathSegment - (*ValueMatcher)(nil), // 2: envoy.type.matcher.v3.ValueMatcher -} -var file_envoy_type_matcher_v3_struct_proto_depIdxs = []int32{ - 1, // 0: envoy.type.matcher.v3.StructMatcher.path:type_name -> envoy.type.matcher.v3.StructMatcher.PathSegment - 2, // 1: envoy.type.matcher.v3.StructMatcher.value:type_name -> envoy.type.matcher.v3.ValueMatcher - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_envoy_type_matcher_v3_struct_proto_init() } -func file_envoy_type_matcher_v3_struct_proto_init() { - if File_envoy_type_matcher_v3_struct_proto != nil { - return - } - file_envoy_type_matcher_v3_value_proto_init() - if !protoimpl.UnsafeEnabled { - file_envoy_type_matcher_v3_struct_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StructMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_matcher_v3_struct_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StructMatcher_PathSegment); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_type_matcher_v3_struct_proto_msgTypes[1].OneofWrappers = []interface{}{ - (*StructMatcher_PathSegment_Key)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_type_matcher_v3_struct_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_type_matcher_v3_struct_proto_goTypes, - DependencyIndexes: file_envoy_type_matcher_v3_struct_proto_depIdxs, - MessageInfos: file_envoy_type_matcher_v3_struct_proto_msgTypes, - }.Build() - File_envoy_type_matcher_v3_struct_proto = out.File - file_envoy_type_matcher_v3_struct_proto_rawDesc = nil - file_envoy_type_matcher_v3_struct_proto_goTypes = nil - file_envoy_type_matcher_v3_struct_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/struct.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/struct.pb.validate.go deleted file mode 100644 index 47d7eeb50..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/struct.pb.validate.go +++ /dev/null @@ -1,363 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/type/matcher/v3/struct.proto - -package matcherv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on StructMatcher with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *StructMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on StructMatcher with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in StructMatcherMultiError, or -// nil if none found. -func (m *StructMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *StructMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(m.GetPath()) < 1 { - err := StructMatcherValidationError{ - field: "Path", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetPath() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, StructMatcherValidationError{ - field: fmt.Sprintf("Path[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, StructMatcherValidationError{ - field: fmt.Sprintf("Path[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return StructMatcherValidationError{ - field: fmt.Sprintf("Path[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if m.GetValue() == nil { - err := StructMatcherValidationError{ - field: "Value", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetValue()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, StructMatcherValidationError{ - field: "Value", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, StructMatcherValidationError{ - field: "Value", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetValue()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return StructMatcherValidationError{ - field: "Value", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return StructMatcherMultiError(errors) - } - - return nil -} - -// StructMatcherMultiError is an error wrapping multiple validation errors -// returned by StructMatcher.ValidateAll() if the designated constraints -// aren't met. -type StructMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m StructMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m StructMatcherMultiError) AllErrors() []error { return m } - -// StructMatcherValidationError is the validation error returned by -// StructMatcher.Validate if the designated constraints aren't met. -type StructMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e StructMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e StructMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e StructMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e StructMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e StructMatcherValidationError) ErrorName() string { return "StructMatcherValidationError" } - -// Error satisfies the builtin error interface -func (e StructMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sStructMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = StructMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = StructMatcherValidationError{} - -// Validate checks the field values on StructMatcher_PathSegment with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *StructMatcher_PathSegment) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on StructMatcher_PathSegment with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// StructMatcher_PathSegmentMultiError, or nil if none found. -func (m *StructMatcher_PathSegment) ValidateAll() error { - return m.validate(true) -} - -func (m *StructMatcher_PathSegment) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofSegmentPresent := false - switch v := m.Segment.(type) { - case *StructMatcher_PathSegment_Key: - if v == nil { - err := StructMatcher_PathSegmentValidationError{ - field: "Segment", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofSegmentPresent = true - - if utf8.RuneCountInString(m.GetKey()) < 1 { - err := StructMatcher_PathSegmentValidationError{ - field: "Key", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - default: - _ = v // ensures v is used - } - if !oneofSegmentPresent { - err := StructMatcher_PathSegmentValidationError{ - field: "Segment", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return StructMatcher_PathSegmentMultiError(errors) - } - - return nil -} - -// StructMatcher_PathSegmentMultiError is an error wrapping multiple validation -// errors returned by StructMatcher_PathSegment.ValidateAll() if the -// designated constraints aren't met. -type StructMatcher_PathSegmentMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m StructMatcher_PathSegmentMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m StructMatcher_PathSegmentMultiError) AllErrors() []error { return m } - -// StructMatcher_PathSegmentValidationError is the validation error returned by -// StructMatcher_PathSegment.Validate if the designated constraints aren't met. -type StructMatcher_PathSegmentValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e StructMatcher_PathSegmentValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e StructMatcher_PathSegmentValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e StructMatcher_PathSegmentValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e StructMatcher_PathSegmentValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e StructMatcher_PathSegmentValidationError) ErrorName() string { - return "StructMatcher_PathSegmentValidationError" -} - -// Error satisfies the builtin error interface -func (e StructMatcher_PathSegmentValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sStructMatcher_PathSegment.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = StructMatcher_PathSegmentValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = StructMatcher_PathSegmentValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/value.pb.go b/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/value.pb.go deleted file mode 100644 index 0b4a7731b..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/value.pb.go +++ /dev/null @@ -1,557 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/type/matcher/v3/value.proto - -package matcherv3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Specifies the way to match a ProtobufWkt::Value. Primitive values and ListValue are supported. -// StructValue is not supported and is always not matched. -// [#next-free-field: 8] -type ValueMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Specifies how to match a value. - // - // Types that are assignable to MatchPattern: - // - // *ValueMatcher_NullMatch_ - // *ValueMatcher_DoubleMatch - // *ValueMatcher_StringMatch - // *ValueMatcher_BoolMatch - // *ValueMatcher_PresentMatch - // *ValueMatcher_ListMatch - // *ValueMatcher_OrMatch - MatchPattern isValueMatcher_MatchPattern `protobuf_oneof:"match_pattern"` -} - -func (x *ValueMatcher) Reset() { - *x = ValueMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_matcher_v3_value_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ValueMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ValueMatcher) ProtoMessage() {} - -func (x *ValueMatcher) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_matcher_v3_value_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ValueMatcher.ProtoReflect.Descriptor instead. -func (*ValueMatcher) Descriptor() ([]byte, []int) { - return file_envoy_type_matcher_v3_value_proto_rawDescGZIP(), []int{0} -} - -func (m *ValueMatcher) GetMatchPattern() isValueMatcher_MatchPattern { - if m != nil { - return m.MatchPattern - } - return nil -} - -func (x *ValueMatcher) GetNullMatch() *ValueMatcher_NullMatch { - if x, ok := x.GetMatchPattern().(*ValueMatcher_NullMatch_); ok { - return x.NullMatch - } - return nil -} - -func (x *ValueMatcher) GetDoubleMatch() *DoubleMatcher { - if x, ok := x.GetMatchPattern().(*ValueMatcher_DoubleMatch); ok { - return x.DoubleMatch - } - return nil -} - -func (x *ValueMatcher) GetStringMatch() *StringMatcher { - if x, ok := x.GetMatchPattern().(*ValueMatcher_StringMatch); ok { - return x.StringMatch - } - return nil -} - -func (x *ValueMatcher) GetBoolMatch() bool { - if x, ok := x.GetMatchPattern().(*ValueMatcher_BoolMatch); ok { - return x.BoolMatch - } - return false -} - -func (x *ValueMatcher) GetPresentMatch() bool { - if x, ok := x.GetMatchPattern().(*ValueMatcher_PresentMatch); ok { - return x.PresentMatch - } - return false -} - -func (x *ValueMatcher) GetListMatch() *ListMatcher { - if x, ok := x.GetMatchPattern().(*ValueMatcher_ListMatch); ok { - return x.ListMatch - } - return nil -} - -func (x *ValueMatcher) GetOrMatch() *OrMatcher { - if x, ok := x.GetMatchPattern().(*ValueMatcher_OrMatch); ok { - return x.OrMatch - } - return nil -} - -type isValueMatcher_MatchPattern interface { - isValueMatcher_MatchPattern() -} - -type ValueMatcher_NullMatch_ struct { - // If specified, a match occurs if and only if the target value is a NullValue. - NullMatch *ValueMatcher_NullMatch `protobuf:"bytes,1,opt,name=null_match,json=nullMatch,proto3,oneof"` -} - -type ValueMatcher_DoubleMatch struct { - // If specified, a match occurs if and only if the target value is a double value and is - // matched to this field. - DoubleMatch *DoubleMatcher `protobuf:"bytes,2,opt,name=double_match,json=doubleMatch,proto3,oneof"` -} - -type ValueMatcher_StringMatch struct { - // If specified, a match occurs if and only if the target value is a string value and is - // matched to this field. - StringMatch *StringMatcher `protobuf:"bytes,3,opt,name=string_match,json=stringMatch,proto3,oneof"` -} - -type ValueMatcher_BoolMatch struct { - // If specified, a match occurs if and only if the target value is a bool value and is equal - // to this field. - BoolMatch bool `protobuf:"varint,4,opt,name=bool_match,json=boolMatch,proto3,oneof"` -} - -type ValueMatcher_PresentMatch struct { - // If specified, value match will be performed based on whether the path is referring to a - // valid primitive value in the metadata. If the path is referring to a non-primitive value, - // the result is always not matched. - PresentMatch bool `protobuf:"varint,5,opt,name=present_match,json=presentMatch,proto3,oneof"` -} - -type ValueMatcher_ListMatch struct { - // If specified, a match occurs if and only if the target value is a list value and - // is matched to this field. - ListMatch *ListMatcher `protobuf:"bytes,6,opt,name=list_match,json=listMatch,proto3,oneof"` -} - -type ValueMatcher_OrMatch struct { - // If specified, a match occurs if and only if any of the alternatives in the match accept the value. - OrMatch *OrMatcher `protobuf:"bytes,7,opt,name=or_match,json=orMatch,proto3,oneof"` -} - -func (*ValueMatcher_NullMatch_) isValueMatcher_MatchPattern() {} - -func (*ValueMatcher_DoubleMatch) isValueMatcher_MatchPattern() {} - -func (*ValueMatcher_StringMatch) isValueMatcher_MatchPattern() {} - -func (*ValueMatcher_BoolMatch) isValueMatcher_MatchPattern() {} - -func (*ValueMatcher_PresentMatch) isValueMatcher_MatchPattern() {} - -func (*ValueMatcher_ListMatch) isValueMatcher_MatchPattern() {} - -func (*ValueMatcher_OrMatch) isValueMatcher_MatchPattern() {} - -// Specifies the way to match a list value. -type ListMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to MatchPattern: - // - // *ListMatcher_OneOf - MatchPattern isListMatcher_MatchPattern `protobuf_oneof:"match_pattern"` -} - -func (x *ListMatcher) Reset() { - *x = ListMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_matcher_v3_value_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListMatcher) ProtoMessage() {} - -func (x *ListMatcher) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_matcher_v3_value_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListMatcher.ProtoReflect.Descriptor instead. -func (*ListMatcher) Descriptor() ([]byte, []int) { - return file_envoy_type_matcher_v3_value_proto_rawDescGZIP(), []int{1} -} - -func (m *ListMatcher) GetMatchPattern() isListMatcher_MatchPattern { - if m != nil { - return m.MatchPattern - } - return nil -} - -func (x *ListMatcher) GetOneOf() *ValueMatcher { - if x, ok := x.GetMatchPattern().(*ListMatcher_OneOf); ok { - return x.OneOf - } - return nil -} - -type isListMatcher_MatchPattern interface { - isListMatcher_MatchPattern() -} - -type ListMatcher_OneOf struct { - // If specified, at least one of the values in the list must match the value specified. - OneOf *ValueMatcher `protobuf:"bytes,1,opt,name=one_of,json=oneOf,proto3,oneof"` -} - -func (*ListMatcher_OneOf) isListMatcher_MatchPattern() {} - -// Specifies a list of alternatives for the match. -type OrMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ValueMatchers []*ValueMatcher `protobuf:"bytes,1,rep,name=value_matchers,json=valueMatchers,proto3" json:"value_matchers,omitempty"` -} - -func (x *OrMatcher) Reset() { - *x = OrMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_matcher_v3_value_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *OrMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*OrMatcher) ProtoMessage() {} - -func (x *OrMatcher) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_matcher_v3_value_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use OrMatcher.ProtoReflect.Descriptor instead. -func (*OrMatcher) Descriptor() ([]byte, []int) { - return file_envoy_type_matcher_v3_value_proto_rawDescGZIP(), []int{2} -} - -func (x *OrMatcher) GetValueMatchers() []*ValueMatcher { - if x != nil { - return x.ValueMatchers - } - return nil -} - -// NullMatch is an empty message to specify a null value. -type ValueMatcher_NullMatch struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *ValueMatcher_NullMatch) Reset() { - *x = ValueMatcher_NullMatch{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_matcher_v3_value_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ValueMatcher_NullMatch) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ValueMatcher_NullMatch) ProtoMessage() {} - -func (x *ValueMatcher_NullMatch) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_matcher_v3_value_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ValueMatcher_NullMatch.ProtoReflect.Descriptor instead. -func (*ValueMatcher_NullMatch) Descriptor() ([]byte, []int) { - return file_envoy_type_matcher_v3_value_proto_rawDescGZIP(), []int{0, 0} -} - -var File_envoy_type_matcher_v3_value_proto protoreflect.FileDescriptor - -var file_envoy_type_matcher_v3_value_proto_rawDesc = []byte{ - 0x0a, 0x21, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x1a, 0x22, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, - 0x33, 0x2f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x22, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x21, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbd, 0x04, - 0x0a, 0x0c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x4e, - 0x0a, 0x0a, 0x6e, 0x75, 0x6c, 0x6c, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4e, 0x75, 0x6c, 0x6c, 0x4d, 0x61, 0x74, 0x63, - 0x68, 0x48, 0x00, 0x52, 0x09, 0x6e, 0x75, 0x6c, 0x6c, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x49, - 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x6f, 0x75, - 0x62, 0x6c, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0b, 0x64, 0x6f, - 0x75, 0x62, 0x6c, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x49, 0x0a, 0x0c, 0x73, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x24, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, - 0x61, 0x74, 0x63, 0x68, 0x12, 0x1f, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, - 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x25, 0x0a, 0x0d, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, - 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x0c, - 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x43, 0x0a, 0x0a, - 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x22, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x48, 0x00, 0x52, 0x09, 0x6c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x74, 0x63, - 0x68, 0x12, 0x3d, 0x0a, 0x08, 0x6f, 0x72, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4f, 0x72, 0x4d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x48, 0x00, 0x52, 0x07, 0x6f, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, - 0x1a, 0x3d, 0x0a, 0x09, 0x4e, 0x75, 0x6c, 0x6c, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x3a, 0x30, 0x9a, - 0xc5, 0x88, 0x1e, 0x2b, 0x0a, 0x29, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4e, 0x75, 0x6c, 0x6c, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x3a, - 0x26, 0x9a, 0xc5, 0x88, 0x1e, 0x21, 0x0a, 0x1f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x42, 0x14, 0x0a, 0x0d, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x5f, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0x88, 0x01, - 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x3c, 0x0a, - 0x06, 0x6f, 0x6e, 0x65, 0x5f, 0x6f, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x48, 0x00, 0x52, 0x05, 0x6f, 0x6e, 0x65, 0x4f, 0x66, 0x3a, 0x25, 0x9a, 0xc5, 0x88, - 0x1e, 0x20, 0x0a, 0x1e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, - 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x42, 0x14, 0x0a, 0x0d, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x70, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0x61, 0x0a, 0x09, 0x4f, 0x72, 0x4d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x54, 0x0a, 0x0e, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x6d, - 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x02, 0x52, 0x0d, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x73, 0x42, 0x83, 0x01, 0x0a, 0x23, - 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, - 0x2e, 0x76, 0x33, 0x42, 0x0a, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, - 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x3b, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x10, - 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_type_matcher_v3_value_proto_rawDescOnce sync.Once - file_envoy_type_matcher_v3_value_proto_rawDescData = file_envoy_type_matcher_v3_value_proto_rawDesc -) - -func file_envoy_type_matcher_v3_value_proto_rawDescGZIP() []byte { - file_envoy_type_matcher_v3_value_proto_rawDescOnce.Do(func() { - file_envoy_type_matcher_v3_value_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_type_matcher_v3_value_proto_rawDescData) - }) - return file_envoy_type_matcher_v3_value_proto_rawDescData -} - -var file_envoy_type_matcher_v3_value_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_envoy_type_matcher_v3_value_proto_goTypes = []interface{}{ - (*ValueMatcher)(nil), // 0: envoy.type.matcher.v3.ValueMatcher - (*ListMatcher)(nil), // 1: envoy.type.matcher.v3.ListMatcher - (*OrMatcher)(nil), // 2: envoy.type.matcher.v3.OrMatcher - (*ValueMatcher_NullMatch)(nil), // 3: envoy.type.matcher.v3.ValueMatcher.NullMatch - (*DoubleMatcher)(nil), // 4: envoy.type.matcher.v3.DoubleMatcher - (*StringMatcher)(nil), // 5: envoy.type.matcher.v3.StringMatcher -} -var file_envoy_type_matcher_v3_value_proto_depIdxs = []int32{ - 3, // 0: envoy.type.matcher.v3.ValueMatcher.null_match:type_name -> envoy.type.matcher.v3.ValueMatcher.NullMatch - 4, // 1: envoy.type.matcher.v3.ValueMatcher.double_match:type_name -> envoy.type.matcher.v3.DoubleMatcher - 5, // 2: envoy.type.matcher.v3.ValueMatcher.string_match:type_name -> envoy.type.matcher.v3.StringMatcher - 1, // 3: envoy.type.matcher.v3.ValueMatcher.list_match:type_name -> envoy.type.matcher.v3.ListMatcher - 2, // 4: envoy.type.matcher.v3.ValueMatcher.or_match:type_name -> envoy.type.matcher.v3.OrMatcher - 0, // 5: envoy.type.matcher.v3.ListMatcher.one_of:type_name -> envoy.type.matcher.v3.ValueMatcher - 0, // 6: envoy.type.matcher.v3.OrMatcher.value_matchers:type_name -> envoy.type.matcher.v3.ValueMatcher - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name -} - -func init() { file_envoy_type_matcher_v3_value_proto_init() } -func file_envoy_type_matcher_v3_value_proto_init() { - if File_envoy_type_matcher_v3_value_proto != nil { - return - } - file_envoy_type_matcher_v3_number_proto_init() - file_envoy_type_matcher_v3_string_proto_init() - if !protoimpl.UnsafeEnabled { - file_envoy_type_matcher_v3_value_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ValueMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_matcher_v3_value_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_matcher_v3_value_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*OrMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_matcher_v3_value_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ValueMatcher_NullMatch); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_type_matcher_v3_value_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*ValueMatcher_NullMatch_)(nil), - (*ValueMatcher_DoubleMatch)(nil), - (*ValueMatcher_StringMatch)(nil), - (*ValueMatcher_BoolMatch)(nil), - (*ValueMatcher_PresentMatch)(nil), - (*ValueMatcher_ListMatch)(nil), - (*ValueMatcher_OrMatch)(nil), - } - file_envoy_type_matcher_v3_value_proto_msgTypes[1].OneofWrappers = []interface{}{ - (*ListMatcher_OneOf)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_type_matcher_v3_value_proto_rawDesc, - NumEnums: 0, - NumMessages: 4, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_type_matcher_v3_value_proto_goTypes, - DependencyIndexes: file_envoy_type_matcher_v3_value_proto_depIdxs, - MessageInfos: file_envoy_type_matcher_v3_value_proto_msgTypes, - }.Build() - File_envoy_type_matcher_v3_value_proto = out.File - file_envoy_type_matcher_v3_value_proto_rawDesc = nil - file_envoy_type_matcher_v3_value_proto_goTypes = nil - file_envoy_type_matcher_v3_value_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/value.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/value.pb.validate.go deleted file mode 100644 index 5bbf95eba..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/matcher/v3/value.pb.validate.go +++ /dev/null @@ -1,790 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/type/matcher/v3/value.proto - -package matcherv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on ValueMatcher with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *ValueMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ValueMatcher with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in ValueMatcherMultiError, or -// nil if none found. -func (m *ValueMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *ValueMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofMatchPatternPresent := false - switch v := m.MatchPattern.(type) { - case *ValueMatcher_NullMatch_: - if v == nil { - err := ValueMatcherValidationError{ - field: "MatchPattern", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchPatternPresent = true - - if all { - switch v := interface{}(m.GetNullMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ValueMatcherValidationError{ - field: "NullMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ValueMatcherValidationError{ - field: "NullMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetNullMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ValueMatcherValidationError{ - field: "NullMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ValueMatcher_DoubleMatch: - if v == nil { - err := ValueMatcherValidationError{ - field: "MatchPattern", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchPatternPresent = true - - if all { - switch v := interface{}(m.GetDoubleMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ValueMatcherValidationError{ - field: "DoubleMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ValueMatcherValidationError{ - field: "DoubleMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDoubleMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ValueMatcherValidationError{ - field: "DoubleMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ValueMatcher_StringMatch: - if v == nil { - err := ValueMatcherValidationError{ - field: "MatchPattern", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchPatternPresent = true - - if all { - switch v := interface{}(m.GetStringMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ValueMatcherValidationError{ - field: "StringMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ValueMatcherValidationError{ - field: "StringMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetStringMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ValueMatcherValidationError{ - field: "StringMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ValueMatcher_BoolMatch: - if v == nil { - err := ValueMatcherValidationError{ - field: "MatchPattern", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchPatternPresent = true - // no validation rules for BoolMatch - case *ValueMatcher_PresentMatch: - if v == nil { - err := ValueMatcherValidationError{ - field: "MatchPattern", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchPatternPresent = true - // no validation rules for PresentMatch - case *ValueMatcher_ListMatch: - if v == nil { - err := ValueMatcherValidationError{ - field: "MatchPattern", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchPatternPresent = true - - if all { - switch v := interface{}(m.GetListMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ValueMatcherValidationError{ - field: "ListMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ValueMatcherValidationError{ - field: "ListMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetListMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ValueMatcherValidationError{ - field: "ListMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ValueMatcher_OrMatch: - if v == nil { - err := ValueMatcherValidationError{ - field: "MatchPattern", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchPatternPresent = true - - if all { - switch v := interface{}(m.GetOrMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ValueMatcherValidationError{ - field: "OrMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ValueMatcherValidationError{ - field: "OrMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetOrMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ValueMatcherValidationError{ - field: "OrMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofMatchPatternPresent { - err := ValueMatcherValidationError{ - field: "MatchPattern", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return ValueMatcherMultiError(errors) - } - - return nil -} - -// ValueMatcherMultiError is an error wrapping multiple validation errors -// returned by ValueMatcher.ValidateAll() if the designated constraints aren't met. -type ValueMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ValueMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ValueMatcherMultiError) AllErrors() []error { return m } - -// ValueMatcherValidationError is the validation error returned by -// ValueMatcher.Validate if the designated constraints aren't met. -type ValueMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ValueMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ValueMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ValueMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ValueMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ValueMatcherValidationError) ErrorName() string { return "ValueMatcherValidationError" } - -// Error satisfies the builtin error interface -func (e ValueMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sValueMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ValueMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ValueMatcherValidationError{} - -// Validate checks the field values on ListMatcher with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *ListMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ListMatcher with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in ListMatcherMultiError, or -// nil if none found. -func (m *ListMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *ListMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofMatchPatternPresent := false - switch v := m.MatchPattern.(type) { - case *ListMatcher_OneOf: - if v == nil { - err := ListMatcherValidationError{ - field: "MatchPattern", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchPatternPresent = true - - if all { - switch v := interface{}(m.GetOneOf()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ListMatcherValidationError{ - field: "OneOf", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ListMatcherValidationError{ - field: "OneOf", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetOneOf()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ListMatcherValidationError{ - field: "OneOf", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofMatchPatternPresent { - err := ListMatcherValidationError{ - field: "MatchPattern", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return ListMatcherMultiError(errors) - } - - return nil -} - -// ListMatcherMultiError is an error wrapping multiple validation errors -// returned by ListMatcher.ValidateAll() if the designated constraints aren't met. -type ListMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ListMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ListMatcherMultiError) AllErrors() []error { return m } - -// ListMatcherValidationError is the validation error returned by -// ListMatcher.Validate if the designated constraints aren't met. -type ListMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ListMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ListMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ListMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ListMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ListMatcherValidationError) ErrorName() string { return "ListMatcherValidationError" } - -// Error satisfies the builtin error interface -func (e ListMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sListMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ListMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ListMatcherValidationError{} - -// Validate checks the field values on OrMatcher with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *OrMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on OrMatcher with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in OrMatcherMultiError, or nil -// if none found. -func (m *OrMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *OrMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(m.GetValueMatchers()) < 2 { - err := OrMatcherValidationError{ - field: "ValueMatchers", - reason: "value must contain at least 2 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetValueMatchers() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, OrMatcherValidationError{ - field: fmt.Sprintf("ValueMatchers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, OrMatcherValidationError{ - field: fmt.Sprintf("ValueMatchers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return OrMatcherValidationError{ - field: fmt.Sprintf("ValueMatchers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return OrMatcherMultiError(errors) - } - - return nil -} - -// OrMatcherMultiError is an error wrapping multiple validation errors returned -// by OrMatcher.ValidateAll() if the designated constraints aren't met. -type OrMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m OrMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m OrMatcherMultiError) AllErrors() []error { return m } - -// OrMatcherValidationError is the validation error returned by -// OrMatcher.Validate if the designated constraints aren't met. -type OrMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e OrMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e OrMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e OrMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e OrMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e OrMatcherValidationError) ErrorName() string { return "OrMatcherValidationError" } - -// Error satisfies the builtin error interface -func (e OrMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sOrMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = OrMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = OrMatcherValidationError{} - -// Validate checks the field values on ValueMatcher_NullMatch with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ValueMatcher_NullMatch) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ValueMatcher_NullMatch with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ValueMatcher_NullMatchMultiError, or nil if none found. -func (m *ValueMatcher_NullMatch) ValidateAll() error { - return m.validate(true) -} - -func (m *ValueMatcher_NullMatch) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return ValueMatcher_NullMatchMultiError(errors) - } - - return nil -} - -// ValueMatcher_NullMatchMultiError is an error wrapping multiple validation -// errors returned by ValueMatcher_NullMatch.ValidateAll() if the designated -// constraints aren't met. -type ValueMatcher_NullMatchMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ValueMatcher_NullMatchMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ValueMatcher_NullMatchMultiError) AllErrors() []error { return m } - -// ValueMatcher_NullMatchValidationError is the validation error returned by -// ValueMatcher_NullMatch.Validate if the designated constraints aren't met. -type ValueMatcher_NullMatchValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ValueMatcher_NullMatchValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ValueMatcher_NullMatchValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ValueMatcher_NullMatchValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ValueMatcher_NullMatchValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ValueMatcher_NullMatchValidationError) ErrorName() string { - return "ValueMatcher_NullMatchValidationError" -} - -// Error satisfies the builtin error interface -func (e ValueMatcher_NullMatchValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sValueMatcher_NullMatch.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ValueMatcher_NullMatchValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ValueMatcher_NullMatchValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/metadata/v3/metadata.pb.go b/vendor/github.com/cilium/proxy/go/envoy/type/metadata/v3/metadata.pb.go deleted file mode 100644 index 797a22c0a..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/metadata/v3/metadata.pb.go +++ /dev/null @@ -1,688 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/type/metadata/v3/metadata.proto - -package metadatav3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// MetadataKey provides a general interface using “key“ and “path“ to retrieve value from -// :ref:`Metadata `. -// -// For example, for the following Metadata: -// -// .. code-block:: yaml -// -// filter_metadata: -// envoy.xxx: -// prop: -// foo: bar -// xyz: -// hello: envoy -// -// The following MetadataKey will retrieve a string value "bar" from the Metadata. -// -// .. code-block:: yaml -// -// key: envoy.xxx -// path: -// - key: prop -// - key: foo -type MetadataKey struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The key name of Metadata to retrieve the Struct from the metadata. - // Typically, it represents a builtin subsystem or custom extension. - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // The path to retrieve the Value from the Struct. It can be a prefix or a full path, - // e.g. “[prop, xyz]“ for a struct or “[prop, foo]“ for a string in the example, - // which depends on the particular scenario. - // - // Note: Due to that only the key type segment is supported, the path can not specify a list - // unless the list is the last segment. - Path []*MetadataKey_PathSegment `protobuf:"bytes,2,rep,name=path,proto3" json:"path,omitempty"` -} - -func (x *MetadataKey) Reset() { - *x = MetadataKey{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_metadata_v3_metadata_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MetadataKey) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MetadataKey) ProtoMessage() {} - -func (x *MetadataKey) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_metadata_v3_metadata_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MetadataKey.ProtoReflect.Descriptor instead. -func (*MetadataKey) Descriptor() ([]byte, []int) { - return file_envoy_type_metadata_v3_metadata_proto_rawDescGZIP(), []int{0} -} - -func (x *MetadataKey) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *MetadataKey) GetPath() []*MetadataKey_PathSegment { - if x != nil { - return x.Path - } - return nil -} - -// Describes what kind of metadata. -type MetadataKind struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Kind: - // - // *MetadataKind_Request_ - // *MetadataKind_Route_ - // *MetadataKind_Cluster_ - // *MetadataKind_Host_ - Kind isMetadataKind_Kind `protobuf_oneof:"kind"` -} - -func (x *MetadataKind) Reset() { - *x = MetadataKind{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_metadata_v3_metadata_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MetadataKind) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MetadataKind) ProtoMessage() {} - -func (x *MetadataKind) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_metadata_v3_metadata_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MetadataKind.ProtoReflect.Descriptor instead. -func (*MetadataKind) Descriptor() ([]byte, []int) { - return file_envoy_type_metadata_v3_metadata_proto_rawDescGZIP(), []int{1} -} - -func (m *MetadataKind) GetKind() isMetadataKind_Kind { - if m != nil { - return m.Kind - } - return nil -} - -func (x *MetadataKind) GetRequest() *MetadataKind_Request { - if x, ok := x.GetKind().(*MetadataKind_Request_); ok { - return x.Request - } - return nil -} - -func (x *MetadataKind) GetRoute() *MetadataKind_Route { - if x, ok := x.GetKind().(*MetadataKind_Route_); ok { - return x.Route - } - return nil -} - -func (x *MetadataKind) GetCluster() *MetadataKind_Cluster { - if x, ok := x.GetKind().(*MetadataKind_Cluster_); ok { - return x.Cluster - } - return nil -} - -func (x *MetadataKind) GetHost() *MetadataKind_Host { - if x, ok := x.GetKind().(*MetadataKind_Host_); ok { - return x.Host - } - return nil -} - -type isMetadataKind_Kind interface { - isMetadataKind_Kind() -} - -type MetadataKind_Request_ struct { - // Request kind of metadata. - Request *MetadataKind_Request `protobuf:"bytes,1,opt,name=request,proto3,oneof"` -} - -type MetadataKind_Route_ struct { - // Route kind of metadata. - Route *MetadataKind_Route `protobuf:"bytes,2,opt,name=route,proto3,oneof"` -} - -type MetadataKind_Cluster_ struct { - // Cluster kind of metadata. - Cluster *MetadataKind_Cluster `protobuf:"bytes,3,opt,name=cluster,proto3,oneof"` -} - -type MetadataKind_Host_ struct { - // Host kind of metadata. - Host *MetadataKind_Host `protobuf:"bytes,4,opt,name=host,proto3,oneof"` -} - -func (*MetadataKind_Request_) isMetadataKind_Kind() {} - -func (*MetadataKind_Route_) isMetadataKind_Kind() {} - -func (*MetadataKind_Cluster_) isMetadataKind_Kind() {} - -func (*MetadataKind_Host_) isMetadataKind_Kind() {} - -// Specifies the segment in a path to retrieve value from Metadata. -// Currently it is only supported to specify the key, i.e. field name, as one segment of a path. -type MetadataKey_PathSegment struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Segment: - // - // *MetadataKey_PathSegment_Key - Segment isMetadataKey_PathSegment_Segment `protobuf_oneof:"segment"` -} - -func (x *MetadataKey_PathSegment) Reset() { - *x = MetadataKey_PathSegment{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_metadata_v3_metadata_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MetadataKey_PathSegment) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MetadataKey_PathSegment) ProtoMessage() {} - -func (x *MetadataKey_PathSegment) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_metadata_v3_metadata_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MetadataKey_PathSegment.ProtoReflect.Descriptor instead. -func (*MetadataKey_PathSegment) Descriptor() ([]byte, []int) { - return file_envoy_type_metadata_v3_metadata_proto_rawDescGZIP(), []int{0, 0} -} - -func (m *MetadataKey_PathSegment) GetSegment() isMetadataKey_PathSegment_Segment { - if m != nil { - return m.Segment - } - return nil -} - -func (x *MetadataKey_PathSegment) GetKey() string { - if x, ok := x.GetSegment().(*MetadataKey_PathSegment_Key); ok { - return x.Key - } - return "" -} - -type isMetadataKey_PathSegment_Segment interface { - isMetadataKey_PathSegment_Segment() -} - -type MetadataKey_PathSegment_Key struct { - // If specified, use the key to retrieve the value in a Struct. - Key string `protobuf:"bytes,1,opt,name=key,proto3,oneof"` -} - -func (*MetadataKey_PathSegment_Key) isMetadataKey_PathSegment_Segment() {} - -// Represents dynamic metadata associated with the request. -type MetadataKind_Request struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *MetadataKind_Request) Reset() { - *x = MetadataKind_Request{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_metadata_v3_metadata_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MetadataKind_Request) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MetadataKind_Request) ProtoMessage() {} - -func (x *MetadataKind_Request) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_metadata_v3_metadata_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MetadataKind_Request.ProtoReflect.Descriptor instead. -func (*MetadataKind_Request) Descriptor() ([]byte, []int) { - return file_envoy_type_metadata_v3_metadata_proto_rawDescGZIP(), []int{1, 0} -} - -// Represents metadata from :ref:`the route`. -type MetadataKind_Route struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *MetadataKind_Route) Reset() { - *x = MetadataKind_Route{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_metadata_v3_metadata_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MetadataKind_Route) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MetadataKind_Route) ProtoMessage() {} - -func (x *MetadataKind_Route) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_metadata_v3_metadata_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MetadataKind_Route.ProtoReflect.Descriptor instead. -func (*MetadataKind_Route) Descriptor() ([]byte, []int) { - return file_envoy_type_metadata_v3_metadata_proto_rawDescGZIP(), []int{1, 1} -} - -// Represents metadata from :ref:`the upstream cluster`. -type MetadataKind_Cluster struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *MetadataKind_Cluster) Reset() { - *x = MetadataKind_Cluster{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_metadata_v3_metadata_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MetadataKind_Cluster) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MetadataKind_Cluster) ProtoMessage() {} - -func (x *MetadataKind_Cluster) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_metadata_v3_metadata_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MetadataKind_Cluster.ProtoReflect.Descriptor instead. -func (*MetadataKind_Cluster) Descriptor() ([]byte, []int) { - return file_envoy_type_metadata_v3_metadata_proto_rawDescGZIP(), []int{1, 2} -} - -// Represents metadata from :ref:`the upstream -// host`. -type MetadataKind_Host struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *MetadataKind_Host) Reset() { - *x = MetadataKind_Host{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_metadata_v3_metadata_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MetadataKind_Host) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MetadataKind_Host) ProtoMessage() {} - -func (x *MetadataKind_Host) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_metadata_v3_metadata_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MetadataKind_Host.ProtoReflect.Descriptor instead. -func (*MetadataKind_Host) Descriptor() ([]byte, []int) { - return file_envoy_type_metadata_v3_metadata_proto_rawDescGZIP(), []int{1, 3} -} - -var File_envoy_type_metadata_v3_metadata_proto protoreflect.FileDescriptor - -var file_envoy_type_metadata_v3_metadata_proto_rawDesc = []byte{ - 0x0a, 0x25, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x76, 0x33, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x76, 0x33, 0x1a, - 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, - 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x95, 0x02, 0x0a, 0x0b, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4b, 0x65, 0x79, 0x12, 0x19, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, - 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x4d, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x4b, 0x65, 0x79, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x67, - 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x04, - 0x70, 0x61, 0x74, 0x68, 0x1a, 0x71, 0x0a, 0x0b, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x67, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x3a, 0x35, 0x9a, 0xc5, 0x88, 0x1e, 0x30, 0x0a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x76, 0x32, 0x2e, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4b, 0x65, 0x79, 0x2e, 0x50, 0x61, 0x74, 0x68, - 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x0e, 0x0a, 0x07, 0x73, 0x65, 0x67, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x3a, 0x29, 0x9a, 0xc5, 0x88, 0x1e, 0x24, 0x0a, 0x22, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4b, - 0x65, 0x79, 0x22, 0xd2, 0x04, 0x0a, 0x0c, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4b, - 0x69, 0x6e, 0x64, 0x12, 0x48, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4b, 0x69, 0x6e, 0x64, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x48, 0x00, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x42, 0x0a, - 0x05, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4b, 0x69, - 0x6e, 0x64, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x48, 0x00, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x74, - 0x65, 0x12, 0x48, 0x0a, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, - 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x4b, 0x69, 0x6e, 0x64, 0x2e, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, - 0x48, 0x00, 0x52, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x3f, 0x0a, 0x04, 0x68, - 0x6f, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, - 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4b, 0x69, 0x6e, 0x64, 0x2e, - 0x48, 0x6f, 0x73, 0x74, 0x48, 0x00, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x1a, 0x3d, 0x0a, 0x07, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x3a, 0x32, 0x9a, 0xc5, 0x88, 0x1e, 0x2d, 0x0a, 0x2b, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4b, - 0x69, 0x6e, 0x64, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x39, 0x0a, 0x05, 0x52, - 0x6f, 0x75, 0x74, 0x65, 0x3a, 0x30, 0x9a, 0xc5, 0x88, 0x1e, 0x2b, 0x0a, 0x29, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4b, 0x69, 0x6e, 0x64, - 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x1a, 0x3d, 0x0a, 0x07, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, - 0x72, 0x3a, 0x32, 0x9a, 0xc5, 0x88, 0x1e, 0x2d, 0x0a, 0x2b, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x76, 0x32, - 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4b, 0x69, 0x6e, 0x64, 0x2e, 0x43, 0x6c, - 0x75, 0x73, 0x74, 0x65, 0x72, 0x1a, 0x37, 0x0a, 0x04, 0x48, 0x6f, 0x73, 0x74, 0x3a, 0x2f, 0x9a, - 0xc5, 0x88, 0x1e, 0x2a, 0x0a, 0x28, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x4b, 0x69, 0x6e, 0x64, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x3a, 0x2a, - 0x9a, 0xc5, 0x88, 0x1e, 0x25, 0x0a, 0x23, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4b, 0x69, 0x6e, 0x64, 0x42, 0x0b, 0x0a, 0x04, 0x6b, 0x69, - 0x6e, 0x64, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x42, 0x89, 0x01, 0x0a, 0x24, 0x69, 0x6f, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x76, 0x33, - 0x42, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x48, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, - 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x76, 0x33, - 0x3b, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, - 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_type_metadata_v3_metadata_proto_rawDescOnce sync.Once - file_envoy_type_metadata_v3_metadata_proto_rawDescData = file_envoy_type_metadata_v3_metadata_proto_rawDesc -) - -func file_envoy_type_metadata_v3_metadata_proto_rawDescGZIP() []byte { - file_envoy_type_metadata_v3_metadata_proto_rawDescOnce.Do(func() { - file_envoy_type_metadata_v3_metadata_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_type_metadata_v3_metadata_proto_rawDescData) - }) - return file_envoy_type_metadata_v3_metadata_proto_rawDescData -} - -var file_envoy_type_metadata_v3_metadata_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_envoy_type_metadata_v3_metadata_proto_goTypes = []interface{}{ - (*MetadataKey)(nil), // 0: envoy.type.metadata.v3.MetadataKey - (*MetadataKind)(nil), // 1: envoy.type.metadata.v3.MetadataKind - (*MetadataKey_PathSegment)(nil), // 2: envoy.type.metadata.v3.MetadataKey.PathSegment - (*MetadataKind_Request)(nil), // 3: envoy.type.metadata.v3.MetadataKind.Request - (*MetadataKind_Route)(nil), // 4: envoy.type.metadata.v3.MetadataKind.Route - (*MetadataKind_Cluster)(nil), // 5: envoy.type.metadata.v3.MetadataKind.Cluster - (*MetadataKind_Host)(nil), // 6: envoy.type.metadata.v3.MetadataKind.Host -} -var file_envoy_type_metadata_v3_metadata_proto_depIdxs = []int32{ - 2, // 0: envoy.type.metadata.v3.MetadataKey.path:type_name -> envoy.type.metadata.v3.MetadataKey.PathSegment - 3, // 1: envoy.type.metadata.v3.MetadataKind.request:type_name -> envoy.type.metadata.v3.MetadataKind.Request - 4, // 2: envoy.type.metadata.v3.MetadataKind.route:type_name -> envoy.type.metadata.v3.MetadataKind.Route - 5, // 3: envoy.type.metadata.v3.MetadataKind.cluster:type_name -> envoy.type.metadata.v3.MetadataKind.Cluster - 6, // 4: envoy.type.metadata.v3.MetadataKind.host:type_name -> envoy.type.metadata.v3.MetadataKind.Host - 5, // [5:5] is the sub-list for method output_type - 5, // [5:5] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name -} - -func init() { file_envoy_type_metadata_v3_metadata_proto_init() } -func file_envoy_type_metadata_v3_metadata_proto_init() { - if File_envoy_type_metadata_v3_metadata_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_envoy_type_metadata_v3_metadata_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MetadataKey); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_metadata_v3_metadata_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MetadataKind); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_metadata_v3_metadata_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MetadataKey_PathSegment); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_metadata_v3_metadata_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MetadataKind_Request); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_metadata_v3_metadata_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MetadataKind_Route); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_metadata_v3_metadata_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MetadataKind_Cluster); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_metadata_v3_metadata_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MetadataKind_Host); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_type_metadata_v3_metadata_proto_msgTypes[1].OneofWrappers = []interface{}{ - (*MetadataKind_Request_)(nil), - (*MetadataKind_Route_)(nil), - (*MetadataKind_Cluster_)(nil), - (*MetadataKind_Host_)(nil), - } - file_envoy_type_metadata_v3_metadata_proto_msgTypes[2].OneofWrappers = []interface{}{ - (*MetadataKey_PathSegment_Key)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_type_metadata_v3_metadata_proto_rawDesc, - NumEnums: 0, - NumMessages: 7, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_type_metadata_v3_metadata_proto_goTypes, - DependencyIndexes: file_envoy_type_metadata_v3_metadata_proto_depIdxs, - MessageInfos: file_envoy_type_metadata_v3_metadata_proto_msgTypes, - }.Build() - File_envoy_type_metadata_v3_metadata_proto = out.File - file_envoy_type_metadata_v3_metadata_proto_rawDesc = nil - file_envoy_type_metadata_v3_metadata_proto_goTypes = nil - file_envoy_type_metadata_v3_metadata_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/metadata/v3/metadata.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/type/metadata/v3/metadata.pb.validate.go deleted file mode 100644 index 37e45c4f0..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/metadata/v3/metadata.pb.validate.go +++ /dev/null @@ -1,1024 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/type/metadata/v3/metadata.proto - -package metadatav3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on MetadataKey with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *MetadataKey) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on MetadataKey with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in MetadataKeyMultiError, or -// nil if none found. -func (m *MetadataKey) ValidateAll() error { - return m.validate(true) -} - -func (m *MetadataKey) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetKey()) < 1 { - err := MetadataKeyValidationError{ - field: "Key", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(m.GetPath()) < 1 { - err := MetadataKeyValidationError{ - field: "Path", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetPath() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, MetadataKeyValidationError{ - field: fmt.Sprintf("Path[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, MetadataKeyValidationError{ - field: fmt.Sprintf("Path[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return MetadataKeyValidationError{ - field: fmt.Sprintf("Path[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return MetadataKeyMultiError(errors) - } - - return nil -} - -// MetadataKeyMultiError is an error wrapping multiple validation errors -// returned by MetadataKey.ValidateAll() if the designated constraints aren't met. -type MetadataKeyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m MetadataKeyMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m MetadataKeyMultiError) AllErrors() []error { return m } - -// MetadataKeyValidationError is the validation error returned by -// MetadataKey.Validate if the designated constraints aren't met. -type MetadataKeyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e MetadataKeyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e MetadataKeyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e MetadataKeyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e MetadataKeyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e MetadataKeyValidationError) ErrorName() string { return "MetadataKeyValidationError" } - -// Error satisfies the builtin error interface -func (e MetadataKeyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMetadataKey.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = MetadataKeyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = MetadataKeyValidationError{} - -// Validate checks the field values on MetadataKind with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *MetadataKind) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on MetadataKind with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in MetadataKindMultiError, or -// nil if none found. -func (m *MetadataKind) ValidateAll() error { - return m.validate(true) -} - -func (m *MetadataKind) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofKindPresent := false - switch v := m.Kind.(type) { - case *MetadataKind_Request_: - if v == nil { - err := MetadataKindValidationError{ - field: "Kind", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofKindPresent = true - - if all { - switch v := interface{}(m.GetRequest()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, MetadataKindValidationError{ - field: "Request", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, MetadataKindValidationError{ - field: "Request", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRequest()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return MetadataKindValidationError{ - field: "Request", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *MetadataKind_Route_: - if v == nil { - err := MetadataKindValidationError{ - field: "Kind", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofKindPresent = true - - if all { - switch v := interface{}(m.GetRoute()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, MetadataKindValidationError{ - field: "Route", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, MetadataKindValidationError{ - field: "Route", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRoute()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return MetadataKindValidationError{ - field: "Route", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *MetadataKind_Cluster_: - if v == nil { - err := MetadataKindValidationError{ - field: "Kind", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofKindPresent = true - - if all { - switch v := interface{}(m.GetCluster()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, MetadataKindValidationError{ - field: "Cluster", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, MetadataKindValidationError{ - field: "Cluster", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCluster()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return MetadataKindValidationError{ - field: "Cluster", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *MetadataKind_Host_: - if v == nil { - err := MetadataKindValidationError{ - field: "Kind", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofKindPresent = true - - if all { - switch v := interface{}(m.GetHost()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, MetadataKindValidationError{ - field: "Host", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, MetadataKindValidationError{ - field: "Host", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHost()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return MetadataKindValidationError{ - field: "Host", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofKindPresent { - err := MetadataKindValidationError{ - field: "Kind", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return MetadataKindMultiError(errors) - } - - return nil -} - -// MetadataKindMultiError is an error wrapping multiple validation errors -// returned by MetadataKind.ValidateAll() if the designated constraints aren't met. -type MetadataKindMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m MetadataKindMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m MetadataKindMultiError) AllErrors() []error { return m } - -// MetadataKindValidationError is the validation error returned by -// MetadataKind.Validate if the designated constraints aren't met. -type MetadataKindValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e MetadataKindValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e MetadataKindValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e MetadataKindValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e MetadataKindValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e MetadataKindValidationError) ErrorName() string { return "MetadataKindValidationError" } - -// Error satisfies the builtin error interface -func (e MetadataKindValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMetadataKind.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = MetadataKindValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = MetadataKindValidationError{} - -// Validate checks the field values on MetadataKey_PathSegment with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *MetadataKey_PathSegment) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on MetadataKey_PathSegment with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// MetadataKey_PathSegmentMultiError, or nil if none found. -func (m *MetadataKey_PathSegment) ValidateAll() error { - return m.validate(true) -} - -func (m *MetadataKey_PathSegment) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofSegmentPresent := false - switch v := m.Segment.(type) { - case *MetadataKey_PathSegment_Key: - if v == nil { - err := MetadataKey_PathSegmentValidationError{ - field: "Segment", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofSegmentPresent = true - - if utf8.RuneCountInString(m.GetKey()) < 1 { - err := MetadataKey_PathSegmentValidationError{ - field: "Key", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - default: - _ = v // ensures v is used - } - if !oneofSegmentPresent { - err := MetadataKey_PathSegmentValidationError{ - field: "Segment", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return MetadataKey_PathSegmentMultiError(errors) - } - - return nil -} - -// MetadataKey_PathSegmentMultiError is an error wrapping multiple validation -// errors returned by MetadataKey_PathSegment.ValidateAll() if the designated -// constraints aren't met. -type MetadataKey_PathSegmentMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m MetadataKey_PathSegmentMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m MetadataKey_PathSegmentMultiError) AllErrors() []error { return m } - -// MetadataKey_PathSegmentValidationError is the validation error returned by -// MetadataKey_PathSegment.Validate if the designated constraints aren't met. -type MetadataKey_PathSegmentValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e MetadataKey_PathSegmentValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e MetadataKey_PathSegmentValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e MetadataKey_PathSegmentValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e MetadataKey_PathSegmentValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e MetadataKey_PathSegmentValidationError) ErrorName() string { - return "MetadataKey_PathSegmentValidationError" -} - -// Error satisfies the builtin error interface -func (e MetadataKey_PathSegmentValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMetadataKey_PathSegment.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = MetadataKey_PathSegmentValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = MetadataKey_PathSegmentValidationError{} - -// Validate checks the field values on MetadataKind_Request with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *MetadataKind_Request) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on MetadataKind_Request with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// MetadataKind_RequestMultiError, or nil if none found. -func (m *MetadataKind_Request) ValidateAll() error { - return m.validate(true) -} - -func (m *MetadataKind_Request) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return MetadataKind_RequestMultiError(errors) - } - - return nil -} - -// MetadataKind_RequestMultiError is an error wrapping multiple validation -// errors returned by MetadataKind_Request.ValidateAll() if the designated -// constraints aren't met. -type MetadataKind_RequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m MetadataKind_RequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m MetadataKind_RequestMultiError) AllErrors() []error { return m } - -// MetadataKind_RequestValidationError is the validation error returned by -// MetadataKind_Request.Validate if the designated constraints aren't met. -type MetadataKind_RequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e MetadataKind_RequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e MetadataKind_RequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e MetadataKind_RequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e MetadataKind_RequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e MetadataKind_RequestValidationError) ErrorName() string { - return "MetadataKind_RequestValidationError" -} - -// Error satisfies the builtin error interface -func (e MetadataKind_RequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMetadataKind_Request.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = MetadataKind_RequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = MetadataKind_RequestValidationError{} - -// Validate checks the field values on MetadataKind_Route with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *MetadataKind_Route) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on MetadataKind_Route with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// MetadataKind_RouteMultiError, or nil if none found. -func (m *MetadataKind_Route) ValidateAll() error { - return m.validate(true) -} - -func (m *MetadataKind_Route) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return MetadataKind_RouteMultiError(errors) - } - - return nil -} - -// MetadataKind_RouteMultiError is an error wrapping multiple validation errors -// returned by MetadataKind_Route.ValidateAll() if the designated constraints -// aren't met. -type MetadataKind_RouteMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m MetadataKind_RouteMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m MetadataKind_RouteMultiError) AllErrors() []error { return m } - -// MetadataKind_RouteValidationError is the validation error returned by -// MetadataKind_Route.Validate if the designated constraints aren't met. -type MetadataKind_RouteValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e MetadataKind_RouteValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e MetadataKind_RouteValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e MetadataKind_RouteValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e MetadataKind_RouteValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e MetadataKind_RouteValidationError) ErrorName() string { - return "MetadataKind_RouteValidationError" -} - -// Error satisfies the builtin error interface -func (e MetadataKind_RouteValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMetadataKind_Route.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = MetadataKind_RouteValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = MetadataKind_RouteValidationError{} - -// Validate checks the field values on MetadataKind_Cluster with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *MetadataKind_Cluster) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on MetadataKind_Cluster with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// MetadataKind_ClusterMultiError, or nil if none found. -func (m *MetadataKind_Cluster) ValidateAll() error { - return m.validate(true) -} - -func (m *MetadataKind_Cluster) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return MetadataKind_ClusterMultiError(errors) - } - - return nil -} - -// MetadataKind_ClusterMultiError is an error wrapping multiple validation -// errors returned by MetadataKind_Cluster.ValidateAll() if the designated -// constraints aren't met. -type MetadataKind_ClusterMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m MetadataKind_ClusterMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m MetadataKind_ClusterMultiError) AllErrors() []error { return m } - -// MetadataKind_ClusterValidationError is the validation error returned by -// MetadataKind_Cluster.Validate if the designated constraints aren't met. -type MetadataKind_ClusterValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e MetadataKind_ClusterValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e MetadataKind_ClusterValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e MetadataKind_ClusterValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e MetadataKind_ClusterValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e MetadataKind_ClusterValidationError) ErrorName() string { - return "MetadataKind_ClusterValidationError" -} - -// Error satisfies the builtin error interface -func (e MetadataKind_ClusterValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMetadataKind_Cluster.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = MetadataKind_ClusterValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = MetadataKind_ClusterValidationError{} - -// Validate checks the field values on MetadataKind_Host with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *MetadataKind_Host) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on MetadataKind_Host with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// MetadataKind_HostMultiError, or nil if none found. -func (m *MetadataKind_Host) ValidateAll() error { - return m.validate(true) -} - -func (m *MetadataKind_Host) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return MetadataKind_HostMultiError(errors) - } - - return nil -} - -// MetadataKind_HostMultiError is an error wrapping multiple validation errors -// returned by MetadataKind_Host.ValidateAll() if the designated constraints -// aren't met. -type MetadataKind_HostMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m MetadataKind_HostMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m MetadataKind_HostMultiError) AllErrors() []error { return m } - -// MetadataKind_HostValidationError is the validation error returned by -// MetadataKind_Host.Validate if the designated constraints aren't met. -type MetadataKind_HostValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e MetadataKind_HostValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e MetadataKind_HostValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e MetadataKind_HostValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e MetadataKind_HostValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e MetadataKind_HostValidationError) ErrorName() string { - return "MetadataKind_HostValidationError" -} - -// Error satisfies the builtin error interface -func (e MetadataKind_HostValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMetadataKind_Host.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = MetadataKind_HostValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = MetadataKind_HostValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/tracing/v3/custom_tag.pb.go b/vendor/github.com/cilium/proxy/go/envoy/type/tracing/v3/custom_tag.pb.go deleted file mode 100644 index 90581f0ce..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/tracing/v3/custom_tag.pb.go +++ /dev/null @@ -1,614 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/type/tracing/v3/custom_tag.proto - -package tracingv3 - -import ( - v3 "github.com/cilium/proxy/go/envoy/type/metadata/v3" - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Describes custom tags for the active span. -// [#next-free-field: 6] -type CustomTag struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Used to populate the tag name. - Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"` - // Used to specify what kind of custom tag. - // - // Types that are assignable to Type: - // - // *CustomTag_Literal_ - // *CustomTag_Environment_ - // *CustomTag_RequestHeader - // *CustomTag_Metadata_ - Type isCustomTag_Type `protobuf_oneof:"type"` -} - -func (x *CustomTag) Reset() { - *x = CustomTag{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_tracing_v3_custom_tag_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CustomTag) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CustomTag) ProtoMessage() {} - -func (x *CustomTag) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_tracing_v3_custom_tag_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CustomTag.ProtoReflect.Descriptor instead. -func (*CustomTag) Descriptor() ([]byte, []int) { - return file_envoy_type_tracing_v3_custom_tag_proto_rawDescGZIP(), []int{0} -} - -func (x *CustomTag) GetTag() string { - if x != nil { - return x.Tag - } - return "" -} - -func (m *CustomTag) GetType() isCustomTag_Type { - if m != nil { - return m.Type - } - return nil -} - -func (x *CustomTag) GetLiteral() *CustomTag_Literal { - if x, ok := x.GetType().(*CustomTag_Literal_); ok { - return x.Literal - } - return nil -} - -func (x *CustomTag) GetEnvironment() *CustomTag_Environment { - if x, ok := x.GetType().(*CustomTag_Environment_); ok { - return x.Environment - } - return nil -} - -func (x *CustomTag) GetRequestHeader() *CustomTag_Header { - if x, ok := x.GetType().(*CustomTag_RequestHeader); ok { - return x.RequestHeader - } - return nil -} - -func (x *CustomTag) GetMetadata() *CustomTag_Metadata { - if x, ok := x.GetType().(*CustomTag_Metadata_); ok { - return x.Metadata - } - return nil -} - -type isCustomTag_Type interface { - isCustomTag_Type() -} - -type CustomTag_Literal_ struct { - // A literal custom tag. - Literal *CustomTag_Literal `protobuf:"bytes,2,opt,name=literal,proto3,oneof"` -} - -type CustomTag_Environment_ struct { - // An environment custom tag. - Environment *CustomTag_Environment `protobuf:"bytes,3,opt,name=environment,proto3,oneof"` -} - -type CustomTag_RequestHeader struct { - // A request header custom tag. - RequestHeader *CustomTag_Header `protobuf:"bytes,4,opt,name=request_header,json=requestHeader,proto3,oneof"` -} - -type CustomTag_Metadata_ struct { - // A custom tag to obtain tag value from the metadata. - Metadata *CustomTag_Metadata `protobuf:"bytes,5,opt,name=metadata,proto3,oneof"` -} - -func (*CustomTag_Literal_) isCustomTag_Type() {} - -func (*CustomTag_Environment_) isCustomTag_Type() {} - -func (*CustomTag_RequestHeader) isCustomTag_Type() {} - -func (*CustomTag_Metadata_) isCustomTag_Type() {} - -// Literal type custom tag with static value for the tag value. -type CustomTag_Literal struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Static literal value to populate the tag value. - Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *CustomTag_Literal) Reset() { - *x = CustomTag_Literal{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_tracing_v3_custom_tag_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CustomTag_Literal) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CustomTag_Literal) ProtoMessage() {} - -func (x *CustomTag_Literal) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_tracing_v3_custom_tag_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CustomTag_Literal.ProtoReflect.Descriptor instead. -func (*CustomTag_Literal) Descriptor() ([]byte, []int) { - return file_envoy_type_tracing_v3_custom_tag_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *CustomTag_Literal) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -// Environment type custom tag with environment name and default value. -type CustomTag_Environment struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Environment variable name to obtain the value to populate the tag value. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // When the environment variable is not found, - // the tag value will be populated with this default value if specified, - // otherwise no tag will be populated. - DefaultValue string `protobuf:"bytes,2,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` -} - -func (x *CustomTag_Environment) Reset() { - *x = CustomTag_Environment{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_tracing_v3_custom_tag_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CustomTag_Environment) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CustomTag_Environment) ProtoMessage() {} - -func (x *CustomTag_Environment) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_tracing_v3_custom_tag_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CustomTag_Environment.ProtoReflect.Descriptor instead. -func (*CustomTag_Environment) Descriptor() ([]byte, []int) { - return file_envoy_type_tracing_v3_custom_tag_proto_rawDescGZIP(), []int{0, 1} -} - -func (x *CustomTag_Environment) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *CustomTag_Environment) GetDefaultValue() string { - if x != nil { - return x.DefaultValue - } - return "" -} - -// Header type custom tag with header name and default value. -type CustomTag_Header struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Header name to obtain the value to populate the tag value. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // When the header does not exist, - // the tag value will be populated with this default value if specified, - // otherwise no tag will be populated. - DefaultValue string `protobuf:"bytes,2,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` -} - -func (x *CustomTag_Header) Reset() { - *x = CustomTag_Header{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_tracing_v3_custom_tag_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CustomTag_Header) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CustomTag_Header) ProtoMessage() {} - -func (x *CustomTag_Header) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_tracing_v3_custom_tag_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CustomTag_Header.ProtoReflect.Descriptor instead. -func (*CustomTag_Header) Descriptor() ([]byte, []int) { - return file_envoy_type_tracing_v3_custom_tag_proto_rawDescGZIP(), []int{0, 2} -} - -func (x *CustomTag_Header) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *CustomTag_Header) GetDefaultValue() string { - if x != nil { - return x.DefaultValue - } - return "" -} - -// Metadata type custom tag using -// :ref:`MetadataKey ` to retrieve the protobuf value -// from :ref:`Metadata `, and populate the tag value with -// `the canonical JSON `_ -// representation of it. -type CustomTag_Metadata struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Specify what kind of metadata to obtain tag value from. - Kind *v3.MetadataKind `protobuf:"bytes,1,opt,name=kind,proto3" json:"kind,omitempty"` - // Metadata key to define the path to retrieve the tag value. - MetadataKey *v3.MetadataKey `protobuf:"bytes,2,opt,name=metadata_key,json=metadataKey,proto3" json:"metadata_key,omitempty"` - // When no valid metadata is found, - // the tag value would be populated with this default value if specified, - // otherwise no tag would be populated. - DefaultValue string `protobuf:"bytes,3,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` -} - -func (x *CustomTag_Metadata) Reset() { - *x = CustomTag_Metadata{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_tracing_v3_custom_tag_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CustomTag_Metadata) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CustomTag_Metadata) ProtoMessage() {} - -func (x *CustomTag_Metadata) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_tracing_v3_custom_tag_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CustomTag_Metadata.ProtoReflect.Descriptor instead. -func (*CustomTag_Metadata) Descriptor() ([]byte, []int) { - return file_envoy_type_tracing_v3_custom_tag_proto_rawDescGZIP(), []int{0, 3} -} - -func (x *CustomTag_Metadata) GetKind() *v3.MetadataKind { - if x != nil { - return x.Kind - } - return nil -} - -func (x *CustomTag_Metadata) GetMetadataKey() *v3.MetadataKey { - if x != nil { - return x.MetadataKey - } - return nil -} - -func (x *CustomTag_Metadata) GetDefaultValue() string { - if x != nil { - return x.DefaultValue - } - return "" -} - -var File_envoy_type_tracing_v3_custom_tag_proto protoreflect.FileDescriptor - -var file_envoy_type_tracing_v3_custom_tag_proto_rawDesc = []byte{ - 0x0a, 0x26, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x74, 0x72, 0x61, - 0x63, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x33, 0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x74, - 0x61, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x33, 0x1a, - 0x25, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x2f, 0x76, 0x33, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, - 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, - 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0xd4, 0x07, 0x0a, 0x09, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x61, 0x67, 0x12, - 0x19, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, - 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x44, 0x0a, 0x07, 0x6c, 0x69, - 0x74, 0x65, 0x72, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x69, 0x6e, 0x67, - 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x61, 0x67, 0x2e, 0x4c, 0x69, - 0x74, 0x65, 0x72, 0x61, 0x6c, 0x48, 0x00, 0x52, 0x07, 0x6c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, - 0x12, 0x50, 0x0a, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x75, - 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x61, 0x67, 0x2e, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, - 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x50, 0x0a, 0x0e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x68, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x2e, - 0x76, 0x33, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x61, 0x67, 0x2e, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0d, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x12, 0x47, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x33, 0x2e, 0x43, - 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x61, 0x67, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x48, 0x00, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x58, 0x0a, - 0x07, 0x4c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x12, 0x1d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x2e, 0x9a, 0xc5, 0x88, 0x1e, 0x29, 0x0a, 0x27, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x69, - 0x6e, 0x67, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x61, 0x67, 0x2e, - 0x4c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x1a, 0x83, 0x01, 0x0a, 0x0b, 0x45, 0x6e, 0x76, 0x69, - 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x32, 0x9a, 0xc5, 0x88, 0x1e, 0x2d, - 0x0a, 0x2b, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x74, 0x72, 0x61, - 0x63, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x61, - 0x67, 0x2e, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x7f, 0x0a, - 0x06, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0d, 0xfa, 0x42, 0x0a, 0x72, 0x08, 0x10, 0x01, 0xc0, 0x01, - 0x01, 0xc8, 0x01, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, - 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x3a, - 0x2d, 0x9a, 0xc5, 0x88, 0x1e, 0x28, 0x0a, 0x26, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x75, - 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x61, 0x67, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0xe2, - 0x01, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x38, 0x0a, 0x04, 0x6b, - 0x69, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, - 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4b, 0x69, 0x6e, 0x64, 0x52, - 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x46, 0x0a, 0x0c, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4b, 0x65, 0x79, - 0x52, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4b, 0x65, 0x79, 0x12, 0x23, 0x0a, - 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x3a, 0x2f, 0x9a, 0xc5, 0x88, 0x1e, 0x2a, 0x0a, 0x28, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x32, - 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x61, 0x67, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x3a, 0x26, 0x9a, 0xc5, 0x88, 0x1e, 0x21, 0x0a, 0x1f, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x2e, 0x76, - 0x32, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x61, 0x67, 0x42, 0x0b, 0x0a, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x42, 0x87, 0x01, 0x0a, 0x23, 0x69, 0x6f, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x33, - 0x42, 0x0e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x61, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x74, 0x72, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x33, - 0x3b, 0x74, 0x72, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, - 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_type_tracing_v3_custom_tag_proto_rawDescOnce sync.Once - file_envoy_type_tracing_v3_custom_tag_proto_rawDescData = file_envoy_type_tracing_v3_custom_tag_proto_rawDesc -) - -func file_envoy_type_tracing_v3_custom_tag_proto_rawDescGZIP() []byte { - file_envoy_type_tracing_v3_custom_tag_proto_rawDescOnce.Do(func() { - file_envoy_type_tracing_v3_custom_tag_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_type_tracing_v3_custom_tag_proto_rawDescData) - }) - return file_envoy_type_tracing_v3_custom_tag_proto_rawDescData -} - -var file_envoy_type_tracing_v3_custom_tag_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_envoy_type_tracing_v3_custom_tag_proto_goTypes = []interface{}{ - (*CustomTag)(nil), // 0: envoy.type.tracing.v3.CustomTag - (*CustomTag_Literal)(nil), // 1: envoy.type.tracing.v3.CustomTag.Literal - (*CustomTag_Environment)(nil), // 2: envoy.type.tracing.v3.CustomTag.Environment - (*CustomTag_Header)(nil), // 3: envoy.type.tracing.v3.CustomTag.Header - (*CustomTag_Metadata)(nil), // 4: envoy.type.tracing.v3.CustomTag.Metadata - (*v3.MetadataKind)(nil), // 5: envoy.type.metadata.v3.MetadataKind - (*v3.MetadataKey)(nil), // 6: envoy.type.metadata.v3.MetadataKey -} -var file_envoy_type_tracing_v3_custom_tag_proto_depIdxs = []int32{ - 1, // 0: envoy.type.tracing.v3.CustomTag.literal:type_name -> envoy.type.tracing.v3.CustomTag.Literal - 2, // 1: envoy.type.tracing.v3.CustomTag.environment:type_name -> envoy.type.tracing.v3.CustomTag.Environment - 3, // 2: envoy.type.tracing.v3.CustomTag.request_header:type_name -> envoy.type.tracing.v3.CustomTag.Header - 4, // 3: envoy.type.tracing.v3.CustomTag.metadata:type_name -> envoy.type.tracing.v3.CustomTag.Metadata - 5, // 4: envoy.type.tracing.v3.CustomTag.Metadata.kind:type_name -> envoy.type.metadata.v3.MetadataKind - 6, // 5: envoy.type.tracing.v3.CustomTag.Metadata.metadata_key:type_name -> envoy.type.metadata.v3.MetadataKey - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name -} - -func init() { file_envoy_type_tracing_v3_custom_tag_proto_init() } -func file_envoy_type_tracing_v3_custom_tag_proto_init() { - if File_envoy_type_tracing_v3_custom_tag_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_envoy_type_tracing_v3_custom_tag_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CustomTag); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_tracing_v3_custom_tag_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CustomTag_Literal); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_tracing_v3_custom_tag_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CustomTag_Environment); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_tracing_v3_custom_tag_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CustomTag_Header); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_tracing_v3_custom_tag_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CustomTag_Metadata); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_type_tracing_v3_custom_tag_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*CustomTag_Literal_)(nil), - (*CustomTag_Environment_)(nil), - (*CustomTag_RequestHeader)(nil), - (*CustomTag_Metadata_)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_type_tracing_v3_custom_tag_proto_rawDesc, - NumEnums: 0, - NumMessages: 5, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_type_tracing_v3_custom_tag_proto_goTypes, - DependencyIndexes: file_envoy_type_tracing_v3_custom_tag_proto_depIdxs, - MessageInfos: file_envoy_type_tracing_v3_custom_tag_proto_msgTypes, - }.Build() - File_envoy_type_tracing_v3_custom_tag_proto = out.File - file_envoy_type_tracing_v3_custom_tag_proto_rawDesc = nil - file_envoy_type_tracing_v3_custom_tag_proto_goTypes = nil - file_envoy_type_tracing_v3_custom_tag_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/tracing/v3/custom_tag.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/type/tracing/v3/custom_tag.pb.validate.go deleted file mode 100644 index eeebc9efd..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/tracing/v3/custom_tag.pb.validate.go +++ /dev/null @@ -1,846 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/type/tracing/v3/custom_tag.proto - -package tracingv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on CustomTag with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *CustomTag) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CustomTag with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in CustomTagMultiError, or nil -// if none found. -func (m *CustomTag) ValidateAll() error { - return m.validate(true) -} - -func (m *CustomTag) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetTag()) < 1 { - err := CustomTagValidationError{ - field: "Tag", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - oneofTypePresent := false - switch v := m.Type.(type) { - case *CustomTag_Literal_: - if v == nil { - err := CustomTagValidationError{ - field: "Type", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofTypePresent = true - - if all { - switch v := interface{}(m.GetLiteral()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CustomTagValidationError{ - field: "Literal", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CustomTagValidationError{ - field: "Literal", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetLiteral()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CustomTagValidationError{ - field: "Literal", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *CustomTag_Environment_: - if v == nil { - err := CustomTagValidationError{ - field: "Type", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofTypePresent = true - - if all { - switch v := interface{}(m.GetEnvironment()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CustomTagValidationError{ - field: "Environment", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CustomTagValidationError{ - field: "Environment", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetEnvironment()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CustomTagValidationError{ - field: "Environment", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *CustomTag_RequestHeader: - if v == nil { - err := CustomTagValidationError{ - field: "Type", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofTypePresent = true - - if all { - switch v := interface{}(m.GetRequestHeader()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CustomTagValidationError{ - field: "RequestHeader", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CustomTagValidationError{ - field: "RequestHeader", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRequestHeader()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CustomTagValidationError{ - field: "RequestHeader", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *CustomTag_Metadata_: - if v == nil { - err := CustomTagValidationError{ - field: "Type", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofTypePresent = true - - if all { - switch v := interface{}(m.GetMetadata()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CustomTagValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CustomTagValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CustomTagValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofTypePresent { - err := CustomTagValidationError{ - field: "Type", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return CustomTagMultiError(errors) - } - - return nil -} - -// CustomTagMultiError is an error wrapping multiple validation errors returned -// by CustomTag.ValidateAll() if the designated constraints aren't met. -type CustomTagMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CustomTagMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CustomTagMultiError) AllErrors() []error { return m } - -// CustomTagValidationError is the validation error returned by -// CustomTag.Validate if the designated constraints aren't met. -type CustomTagValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CustomTagValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CustomTagValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CustomTagValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CustomTagValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CustomTagValidationError) ErrorName() string { return "CustomTagValidationError" } - -// Error satisfies the builtin error interface -func (e CustomTagValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCustomTag.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CustomTagValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CustomTagValidationError{} - -// Validate checks the field values on CustomTag_Literal with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *CustomTag_Literal) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CustomTag_Literal with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// CustomTag_LiteralMultiError, or nil if none found. -func (m *CustomTag_Literal) ValidateAll() error { - return m.validate(true) -} - -func (m *CustomTag_Literal) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetValue()) < 1 { - err := CustomTag_LiteralValidationError{ - field: "Value", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return CustomTag_LiteralMultiError(errors) - } - - return nil -} - -// CustomTag_LiteralMultiError is an error wrapping multiple validation errors -// returned by CustomTag_Literal.ValidateAll() if the designated constraints -// aren't met. -type CustomTag_LiteralMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CustomTag_LiteralMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CustomTag_LiteralMultiError) AllErrors() []error { return m } - -// CustomTag_LiteralValidationError is the validation error returned by -// CustomTag_Literal.Validate if the designated constraints aren't met. -type CustomTag_LiteralValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CustomTag_LiteralValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CustomTag_LiteralValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CustomTag_LiteralValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CustomTag_LiteralValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CustomTag_LiteralValidationError) ErrorName() string { - return "CustomTag_LiteralValidationError" -} - -// Error satisfies the builtin error interface -func (e CustomTag_LiteralValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCustomTag_Literal.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CustomTag_LiteralValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CustomTag_LiteralValidationError{} - -// Validate checks the field values on CustomTag_Environment with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *CustomTag_Environment) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CustomTag_Environment with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// CustomTag_EnvironmentMultiError, or nil if none found. -func (m *CustomTag_Environment) ValidateAll() error { - return m.validate(true) -} - -func (m *CustomTag_Environment) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := CustomTag_EnvironmentValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for DefaultValue - - if len(errors) > 0 { - return CustomTag_EnvironmentMultiError(errors) - } - - return nil -} - -// CustomTag_EnvironmentMultiError is an error wrapping multiple validation -// errors returned by CustomTag_Environment.ValidateAll() if the designated -// constraints aren't met. -type CustomTag_EnvironmentMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CustomTag_EnvironmentMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CustomTag_EnvironmentMultiError) AllErrors() []error { return m } - -// CustomTag_EnvironmentValidationError is the validation error returned by -// CustomTag_Environment.Validate if the designated constraints aren't met. -type CustomTag_EnvironmentValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CustomTag_EnvironmentValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CustomTag_EnvironmentValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CustomTag_EnvironmentValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CustomTag_EnvironmentValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CustomTag_EnvironmentValidationError) ErrorName() string { - return "CustomTag_EnvironmentValidationError" -} - -// Error satisfies the builtin error interface -func (e CustomTag_EnvironmentValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCustomTag_Environment.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CustomTag_EnvironmentValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CustomTag_EnvironmentValidationError{} - -// Validate checks the field values on CustomTag_Header with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *CustomTag_Header) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CustomTag_Header with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// CustomTag_HeaderMultiError, or nil if none found. -func (m *CustomTag_Header) ValidateAll() error { - return m.validate(true) -} - -func (m *CustomTag_Header) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := CustomTag_HeaderValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_CustomTag_Header_Name_Pattern.MatchString(m.GetName()) { - err := CustomTag_HeaderValidationError{ - field: "Name", - reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for DefaultValue - - if len(errors) > 0 { - return CustomTag_HeaderMultiError(errors) - } - - return nil -} - -// CustomTag_HeaderMultiError is an error wrapping multiple validation errors -// returned by CustomTag_Header.ValidateAll() if the designated constraints -// aren't met. -type CustomTag_HeaderMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CustomTag_HeaderMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CustomTag_HeaderMultiError) AllErrors() []error { return m } - -// CustomTag_HeaderValidationError is the validation error returned by -// CustomTag_Header.Validate if the designated constraints aren't met. -type CustomTag_HeaderValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CustomTag_HeaderValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CustomTag_HeaderValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CustomTag_HeaderValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CustomTag_HeaderValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CustomTag_HeaderValidationError) ErrorName() string { return "CustomTag_HeaderValidationError" } - -// Error satisfies the builtin error interface -func (e CustomTag_HeaderValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCustomTag_Header.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CustomTag_HeaderValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CustomTag_HeaderValidationError{} - -var _CustomTag_Header_Name_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") - -// Validate checks the field values on CustomTag_Metadata with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *CustomTag_Metadata) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CustomTag_Metadata with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// CustomTag_MetadataMultiError, or nil if none found. -func (m *CustomTag_Metadata) ValidateAll() error { - return m.validate(true) -} - -func (m *CustomTag_Metadata) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetKind()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CustomTag_MetadataValidationError{ - field: "Kind", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CustomTag_MetadataValidationError{ - field: "Kind", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetKind()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CustomTag_MetadataValidationError{ - field: "Kind", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetMetadataKey()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CustomTag_MetadataValidationError{ - field: "MetadataKey", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CustomTag_MetadataValidationError{ - field: "MetadataKey", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMetadataKey()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CustomTag_MetadataValidationError{ - field: "MetadataKey", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for DefaultValue - - if len(errors) > 0 { - return CustomTag_MetadataMultiError(errors) - } - - return nil -} - -// CustomTag_MetadataMultiError is an error wrapping multiple validation errors -// returned by CustomTag_Metadata.ValidateAll() if the designated constraints -// aren't met. -type CustomTag_MetadataMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CustomTag_MetadataMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CustomTag_MetadataMultiError) AllErrors() []error { return m } - -// CustomTag_MetadataValidationError is the validation error returned by -// CustomTag_Metadata.Validate if the designated constraints aren't met. -type CustomTag_MetadataValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CustomTag_MetadataValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CustomTag_MetadataValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CustomTag_MetadataValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CustomTag_MetadataValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CustomTag_MetadataValidationError) ErrorName() string { - return "CustomTag_MetadataValidationError" -} - -// Error satisfies the builtin error interface -func (e CustomTag_MetadataValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCustomTag_Metadata.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CustomTag_MetadataValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CustomTag_MetadataValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/v3/hash_policy.pb.go b/vendor/github.com/cilium/proxy/go/envoy/type/v3/hash_policy.pb.go deleted file mode 100644 index 85a3f859f..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/v3/hash_policy.pb.go +++ /dev/null @@ -1,338 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/type/v3/hash_policy.proto - -package typev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Specifies the hash policy -type HashPolicy struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to PolicySpecifier: - // - // *HashPolicy_SourceIp_ - // *HashPolicy_FilterState_ - PolicySpecifier isHashPolicy_PolicySpecifier `protobuf_oneof:"policy_specifier"` -} - -func (x *HashPolicy) Reset() { - *x = HashPolicy{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_v3_hash_policy_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HashPolicy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HashPolicy) ProtoMessage() {} - -func (x *HashPolicy) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_v3_hash_policy_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HashPolicy.ProtoReflect.Descriptor instead. -func (*HashPolicy) Descriptor() ([]byte, []int) { - return file_envoy_type_v3_hash_policy_proto_rawDescGZIP(), []int{0} -} - -func (m *HashPolicy) GetPolicySpecifier() isHashPolicy_PolicySpecifier { - if m != nil { - return m.PolicySpecifier - } - return nil -} - -func (x *HashPolicy) GetSourceIp() *HashPolicy_SourceIp { - if x, ok := x.GetPolicySpecifier().(*HashPolicy_SourceIp_); ok { - return x.SourceIp - } - return nil -} - -func (x *HashPolicy) GetFilterState() *HashPolicy_FilterState { - if x, ok := x.GetPolicySpecifier().(*HashPolicy_FilterState_); ok { - return x.FilterState - } - return nil -} - -type isHashPolicy_PolicySpecifier interface { - isHashPolicy_PolicySpecifier() -} - -type HashPolicy_SourceIp_ struct { - SourceIp *HashPolicy_SourceIp `protobuf:"bytes,1,opt,name=source_ip,json=sourceIp,proto3,oneof"` -} - -type HashPolicy_FilterState_ struct { - FilterState *HashPolicy_FilterState `protobuf:"bytes,2,opt,name=filter_state,json=filterState,proto3,oneof"` -} - -func (*HashPolicy_SourceIp_) isHashPolicy_PolicySpecifier() {} - -func (*HashPolicy_FilterState_) isHashPolicy_PolicySpecifier() {} - -// The source IP will be used to compute the hash used by hash-based load balancing -// algorithms. -type HashPolicy_SourceIp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *HashPolicy_SourceIp) Reset() { - *x = HashPolicy_SourceIp{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_v3_hash_policy_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HashPolicy_SourceIp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HashPolicy_SourceIp) ProtoMessage() {} - -func (x *HashPolicy_SourceIp) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_v3_hash_policy_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HashPolicy_SourceIp.ProtoReflect.Descriptor instead. -func (*HashPolicy_SourceIp) Descriptor() ([]byte, []int) { - return file_envoy_type_v3_hash_policy_proto_rawDescGZIP(), []int{0, 0} -} - -// An Object in the :ref:`filterState ` will be used -// to compute the hash used by hash-based load balancing algorithms. -type HashPolicy_FilterState struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of the Object in the filterState, which is an Envoy::Hashable object. If there is no - // data associated with the key, or the stored object is not Envoy::Hashable, no hash will be - // produced. - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` -} - -func (x *HashPolicy_FilterState) Reset() { - *x = HashPolicy_FilterState{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_v3_hash_policy_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HashPolicy_FilterState) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HashPolicy_FilterState) ProtoMessage() {} - -func (x *HashPolicy_FilterState) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_v3_hash_policy_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HashPolicy_FilterState.ProtoReflect.Descriptor instead. -func (*HashPolicy_FilterState) Descriptor() ([]byte, []int) { - return file_envoy_type_v3_hash_policy_proto_rawDescGZIP(), []int{0, 1} -} - -func (x *HashPolicy_FilterState) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -var File_envoy_type_v3_hash_policy_proto protoreflect.FileDescriptor - -var file_envoy_type_v3_hash_policy_proto_rawDesc = []byte{ - 0x0a, 0x1f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x2f, - 0x68, 0x61, 0x73, 0x68, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x0d, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, - 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x21, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xaf, 0x02, 0x0a, 0x0a, - 0x48, 0x61, 0x73, 0x68, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x41, 0x0a, 0x09, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x61, - 0x73, 0x68, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, - 0x70, 0x48, 0x00, 0x52, 0x08, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x70, 0x12, 0x4a, 0x0a, - 0x0c, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x61, 0x73, 0x68, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x46, - 0x69, 0x6c, 0x74, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x48, 0x00, 0x52, 0x0b, 0x66, 0x69, - 0x6c, 0x74, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x1a, 0x31, 0x0a, 0x08, 0x53, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x49, 0x70, 0x3a, 0x25, 0x9a, 0xc5, 0x88, 0x1e, 0x20, 0x0a, 0x1e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x48, 0x61, 0x73, 0x68, 0x50, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x70, 0x1a, 0x28, 0x0a, 0x0b, - 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x19, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, - 0x01, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x3a, 0x1c, 0x9a, 0xc5, 0x88, 0x1e, 0x17, 0x0a, 0x15, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x48, 0x61, 0x73, 0x68, 0x50, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x42, 0x17, 0x0a, 0x10, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x73, - 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x42, 0x75, 0x0a, - 0x1b, 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x42, 0x0f, 0x48, 0x61, - 0x73, 0x68, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, - 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, - 0x70, 0x65, 0x2f, 0x76, 0x33, 0x3b, 0x74, 0x79, 0x70, 0x65, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, - 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_type_v3_hash_policy_proto_rawDescOnce sync.Once - file_envoy_type_v3_hash_policy_proto_rawDescData = file_envoy_type_v3_hash_policy_proto_rawDesc -) - -func file_envoy_type_v3_hash_policy_proto_rawDescGZIP() []byte { - file_envoy_type_v3_hash_policy_proto_rawDescOnce.Do(func() { - file_envoy_type_v3_hash_policy_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_type_v3_hash_policy_proto_rawDescData) - }) - return file_envoy_type_v3_hash_policy_proto_rawDescData -} - -var file_envoy_type_v3_hash_policy_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_envoy_type_v3_hash_policy_proto_goTypes = []interface{}{ - (*HashPolicy)(nil), // 0: envoy.type.v3.HashPolicy - (*HashPolicy_SourceIp)(nil), // 1: envoy.type.v3.HashPolicy.SourceIp - (*HashPolicy_FilterState)(nil), // 2: envoy.type.v3.HashPolicy.FilterState -} -var file_envoy_type_v3_hash_policy_proto_depIdxs = []int32{ - 1, // 0: envoy.type.v3.HashPolicy.source_ip:type_name -> envoy.type.v3.HashPolicy.SourceIp - 2, // 1: envoy.type.v3.HashPolicy.filter_state:type_name -> envoy.type.v3.HashPolicy.FilterState - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_envoy_type_v3_hash_policy_proto_init() } -func file_envoy_type_v3_hash_policy_proto_init() { - if File_envoy_type_v3_hash_policy_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_envoy_type_v3_hash_policy_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HashPolicy); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_v3_hash_policy_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HashPolicy_SourceIp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_v3_hash_policy_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HashPolicy_FilterState); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_type_v3_hash_policy_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*HashPolicy_SourceIp_)(nil), - (*HashPolicy_FilterState_)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_type_v3_hash_policy_proto_rawDesc, - NumEnums: 0, - NumMessages: 3, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_type_v3_hash_policy_proto_goTypes, - DependencyIndexes: file_envoy_type_v3_hash_policy_proto_depIdxs, - MessageInfos: file_envoy_type_v3_hash_policy_proto_msgTypes, - }.Build() - File_envoy_type_v3_hash_policy_proto = out.File - file_envoy_type_v3_hash_policy_proto_rawDesc = nil - file_envoy_type_v3_hash_policy_proto_goTypes = nil - file_envoy_type_v3_hash_policy_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/v3/hash_policy.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/type/v3/hash_policy.pb.validate.go deleted file mode 100644 index 5cb102e80..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/v3/hash_policy.pb.validate.go +++ /dev/null @@ -1,450 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/type/v3/hash_policy.proto - -package typev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on HashPolicy with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *HashPolicy) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HashPolicy with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in HashPolicyMultiError, or -// nil if none found. -func (m *HashPolicy) ValidateAll() error { - return m.validate(true) -} - -func (m *HashPolicy) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofPolicySpecifierPresent := false - switch v := m.PolicySpecifier.(type) { - case *HashPolicy_SourceIp_: - if v == nil { - err := HashPolicyValidationError{ - field: "PolicySpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofPolicySpecifierPresent = true - - if all { - switch v := interface{}(m.GetSourceIp()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HashPolicyValidationError{ - field: "SourceIp", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HashPolicyValidationError{ - field: "SourceIp", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSourceIp()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HashPolicyValidationError{ - field: "SourceIp", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *HashPolicy_FilterState_: - if v == nil { - err := HashPolicyValidationError{ - field: "PolicySpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofPolicySpecifierPresent = true - - if all { - switch v := interface{}(m.GetFilterState()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HashPolicyValidationError{ - field: "FilterState", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HashPolicyValidationError{ - field: "FilterState", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetFilterState()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HashPolicyValidationError{ - field: "FilterState", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofPolicySpecifierPresent { - err := HashPolicyValidationError{ - field: "PolicySpecifier", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return HashPolicyMultiError(errors) - } - - return nil -} - -// HashPolicyMultiError is an error wrapping multiple validation errors -// returned by HashPolicy.ValidateAll() if the designated constraints aren't met. -type HashPolicyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HashPolicyMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HashPolicyMultiError) AllErrors() []error { return m } - -// HashPolicyValidationError is the validation error returned by -// HashPolicy.Validate if the designated constraints aren't met. -type HashPolicyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HashPolicyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HashPolicyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HashPolicyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HashPolicyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HashPolicyValidationError) ErrorName() string { return "HashPolicyValidationError" } - -// Error satisfies the builtin error interface -func (e HashPolicyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHashPolicy.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HashPolicyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HashPolicyValidationError{} - -// Validate checks the field values on HashPolicy_SourceIp with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *HashPolicy_SourceIp) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HashPolicy_SourceIp with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// HashPolicy_SourceIpMultiError, or nil if none found. -func (m *HashPolicy_SourceIp) ValidateAll() error { - return m.validate(true) -} - -func (m *HashPolicy_SourceIp) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return HashPolicy_SourceIpMultiError(errors) - } - - return nil -} - -// HashPolicy_SourceIpMultiError is an error wrapping multiple validation -// errors returned by HashPolicy_SourceIp.ValidateAll() if the designated -// constraints aren't met. -type HashPolicy_SourceIpMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HashPolicy_SourceIpMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HashPolicy_SourceIpMultiError) AllErrors() []error { return m } - -// HashPolicy_SourceIpValidationError is the validation error returned by -// HashPolicy_SourceIp.Validate if the designated constraints aren't met. -type HashPolicy_SourceIpValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HashPolicy_SourceIpValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HashPolicy_SourceIpValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HashPolicy_SourceIpValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HashPolicy_SourceIpValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HashPolicy_SourceIpValidationError) ErrorName() string { - return "HashPolicy_SourceIpValidationError" -} - -// Error satisfies the builtin error interface -func (e HashPolicy_SourceIpValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHashPolicy_SourceIp.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HashPolicy_SourceIpValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HashPolicy_SourceIpValidationError{} - -// Validate checks the field values on HashPolicy_FilterState with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *HashPolicy_FilterState) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HashPolicy_FilterState with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// HashPolicy_FilterStateMultiError, or nil if none found. -func (m *HashPolicy_FilterState) ValidateAll() error { - return m.validate(true) -} - -func (m *HashPolicy_FilterState) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetKey()) < 1 { - err := HashPolicy_FilterStateValidationError{ - field: "Key", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return HashPolicy_FilterStateMultiError(errors) - } - - return nil -} - -// HashPolicy_FilterStateMultiError is an error wrapping multiple validation -// errors returned by HashPolicy_FilterState.ValidateAll() if the designated -// constraints aren't met. -type HashPolicy_FilterStateMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HashPolicy_FilterStateMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HashPolicy_FilterStateMultiError) AllErrors() []error { return m } - -// HashPolicy_FilterStateValidationError is the validation error returned by -// HashPolicy_FilterState.Validate if the designated constraints aren't met. -type HashPolicy_FilterStateValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HashPolicy_FilterStateValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HashPolicy_FilterStateValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HashPolicy_FilterStateValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HashPolicy_FilterStateValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HashPolicy_FilterStateValidationError) ErrorName() string { - return "HashPolicy_FilterStateValidationError" -} - -// Error satisfies the builtin error interface -func (e HashPolicy_FilterStateValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHashPolicy_FilterState.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HashPolicy_FilterStateValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HashPolicy_FilterStateValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/v3/http.pb.go b/vendor/github.com/cilium/proxy/go/envoy/type/v3/http.pb.go deleted file mode 100644 index 0b3fb3ad0..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/v3/http.pb.go +++ /dev/null @@ -1,149 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/type/v3/http.proto - -package typev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -type CodecClientType int32 - -const ( - CodecClientType_HTTP1 CodecClientType = 0 - CodecClientType_HTTP2 CodecClientType = 1 - // [#not-implemented-hide:] QUIC implementation is not production ready yet. Use this enum with - // caution to prevent accidental execution of QUIC code. I.e. `!= HTTP2` is no longer sufficient - // to distinguish HTTP1 and HTTP2 traffic. - CodecClientType_HTTP3 CodecClientType = 2 -) - -// Enum value maps for CodecClientType. -var ( - CodecClientType_name = map[int32]string{ - 0: "HTTP1", - 1: "HTTP2", - 2: "HTTP3", - } - CodecClientType_value = map[string]int32{ - "HTTP1": 0, - "HTTP2": 1, - "HTTP3": 2, - } -) - -func (x CodecClientType) Enum() *CodecClientType { - p := new(CodecClientType) - *p = x - return p -} - -func (x CodecClientType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (CodecClientType) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_type_v3_http_proto_enumTypes[0].Descriptor() -} - -func (CodecClientType) Type() protoreflect.EnumType { - return &file_envoy_type_v3_http_proto_enumTypes[0] -} - -func (x CodecClientType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use CodecClientType.Descriptor instead. -func (CodecClientType) EnumDescriptor() ([]byte, []int) { - return file_envoy_type_v3_http_proto_rawDescGZIP(), []int{0} -} - -var File_envoy_type_v3_http_proto protoreflect.FileDescriptor - -var file_envoy_type_v3_http_proto_rawDesc = []byte{ - 0x0a, 0x18, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x2f, - 0x68, 0x74, 0x74, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, - 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2a, 0x32, 0x0a, 0x0f, 0x43, 0x6f, 0x64, 0x65, - 0x63, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x48, - 0x54, 0x54, 0x50, 0x31, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x48, 0x54, 0x54, 0x50, 0x32, 0x10, - 0x01, 0x12, 0x09, 0x0a, 0x05, 0x48, 0x54, 0x54, 0x50, 0x33, 0x10, 0x02, 0x42, 0x6f, 0x0a, 0x1b, - 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x42, 0x09, 0x48, 0x74, 0x74, - 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, - 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, - 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x3b, 0x74, - 0x79, 0x70, 0x65, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_type_v3_http_proto_rawDescOnce sync.Once - file_envoy_type_v3_http_proto_rawDescData = file_envoy_type_v3_http_proto_rawDesc -) - -func file_envoy_type_v3_http_proto_rawDescGZIP() []byte { - file_envoy_type_v3_http_proto_rawDescOnce.Do(func() { - file_envoy_type_v3_http_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_type_v3_http_proto_rawDescData) - }) - return file_envoy_type_v3_http_proto_rawDescData -} - -var file_envoy_type_v3_http_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_envoy_type_v3_http_proto_goTypes = []interface{}{ - (CodecClientType)(0), // 0: envoy.type.v3.CodecClientType -} -var file_envoy_type_v3_http_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_envoy_type_v3_http_proto_init() } -func file_envoy_type_v3_http_proto_init() { - if File_envoy_type_v3_http_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_type_v3_http_proto_rawDesc, - NumEnums: 1, - NumMessages: 0, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_type_v3_http_proto_goTypes, - DependencyIndexes: file_envoy_type_v3_http_proto_depIdxs, - EnumInfos: file_envoy_type_v3_http_proto_enumTypes, - }.Build() - File_envoy_type_v3_http_proto = out.File - file_envoy_type_v3_http_proto_rawDesc = nil - file_envoy_type_v3_http_proto_goTypes = nil - file_envoy_type_v3_http_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/v3/http.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/type/v3/http.pb.validate.go deleted file mode 100644 index fff363617..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/v3/http.pb.validate.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/type/v3/http.proto - -package typev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/v3/http_status.pb.go b/vendor/github.com/cilium/proxy/go/envoy/type/v3/http_status.pb.go deleted file mode 100644 index ed73e5231..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/v3/http_status.pb.go +++ /dev/null @@ -1,463 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/type/v3/http_status.proto - -package typev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// HTTP response codes supported in Envoy. -// For more details: https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml -type StatusCode int32 - -const ( - // Empty - This code not part of the HTTP status code specification, but it is needed for proto - // `enum` type. - StatusCode_Empty StatusCode = 0 - StatusCode_Continue StatusCode = 100 - StatusCode_OK StatusCode = 200 - StatusCode_Created StatusCode = 201 - StatusCode_Accepted StatusCode = 202 - StatusCode_NonAuthoritativeInformation StatusCode = 203 - StatusCode_NoContent StatusCode = 204 - StatusCode_ResetContent StatusCode = 205 - StatusCode_PartialContent StatusCode = 206 - StatusCode_MultiStatus StatusCode = 207 - StatusCode_AlreadyReported StatusCode = 208 - StatusCode_IMUsed StatusCode = 226 - StatusCode_MultipleChoices StatusCode = 300 - StatusCode_MovedPermanently StatusCode = 301 - StatusCode_Found StatusCode = 302 - StatusCode_SeeOther StatusCode = 303 - StatusCode_NotModified StatusCode = 304 - StatusCode_UseProxy StatusCode = 305 - StatusCode_TemporaryRedirect StatusCode = 307 - StatusCode_PermanentRedirect StatusCode = 308 - StatusCode_BadRequest StatusCode = 400 - StatusCode_Unauthorized StatusCode = 401 - StatusCode_PaymentRequired StatusCode = 402 - StatusCode_Forbidden StatusCode = 403 - StatusCode_NotFound StatusCode = 404 - StatusCode_MethodNotAllowed StatusCode = 405 - StatusCode_NotAcceptable StatusCode = 406 - StatusCode_ProxyAuthenticationRequired StatusCode = 407 - StatusCode_RequestTimeout StatusCode = 408 - StatusCode_Conflict StatusCode = 409 - StatusCode_Gone StatusCode = 410 - StatusCode_LengthRequired StatusCode = 411 - StatusCode_PreconditionFailed StatusCode = 412 - StatusCode_PayloadTooLarge StatusCode = 413 - StatusCode_URITooLong StatusCode = 414 - StatusCode_UnsupportedMediaType StatusCode = 415 - StatusCode_RangeNotSatisfiable StatusCode = 416 - StatusCode_ExpectationFailed StatusCode = 417 - StatusCode_MisdirectedRequest StatusCode = 421 - StatusCode_UnprocessableEntity StatusCode = 422 - StatusCode_Locked StatusCode = 423 - StatusCode_FailedDependency StatusCode = 424 - StatusCode_UpgradeRequired StatusCode = 426 - StatusCode_PreconditionRequired StatusCode = 428 - StatusCode_TooManyRequests StatusCode = 429 - StatusCode_RequestHeaderFieldsTooLarge StatusCode = 431 - StatusCode_InternalServerError StatusCode = 500 - StatusCode_NotImplemented StatusCode = 501 - StatusCode_BadGateway StatusCode = 502 - StatusCode_ServiceUnavailable StatusCode = 503 - StatusCode_GatewayTimeout StatusCode = 504 - StatusCode_HTTPVersionNotSupported StatusCode = 505 - StatusCode_VariantAlsoNegotiates StatusCode = 506 - StatusCode_InsufficientStorage StatusCode = 507 - StatusCode_LoopDetected StatusCode = 508 - StatusCode_NotExtended StatusCode = 510 - StatusCode_NetworkAuthenticationRequired StatusCode = 511 -) - -// Enum value maps for StatusCode. -var ( - StatusCode_name = map[int32]string{ - 0: "Empty", - 100: "Continue", - 200: "OK", - 201: "Created", - 202: "Accepted", - 203: "NonAuthoritativeInformation", - 204: "NoContent", - 205: "ResetContent", - 206: "PartialContent", - 207: "MultiStatus", - 208: "AlreadyReported", - 226: "IMUsed", - 300: "MultipleChoices", - 301: "MovedPermanently", - 302: "Found", - 303: "SeeOther", - 304: "NotModified", - 305: "UseProxy", - 307: "TemporaryRedirect", - 308: "PermanentRedirect", - 400: "BadRequest", - 401: "Unauthorized", - 402: "PaymentRequired", - 403: "Forbidden", - 404: "NotFound", - 405: "MethodNotAllowed", - 406: "NotAcceptable", - 407: "ProxyAuthenticationRequired", - 408: "RequestTimeout", - 409: "Conflict", - 410: "Gone", - 411: "LengthRequired", - 412: "PreconditionFailed", - 413: "PayloadTooLarge", - 414: "URITooLong", - 415: "UnsupportedMediaType", - 416: "RangeNotSatisfiable", - 417: "ExpectationFailed", - 421: "MisdirectedRequest", - 422: "UnprocessableEntity", - 423: "Locked", - 424: "FailedDependency", - 426: "UpgradeRequired", - 428: "PreconditionRequired", - 429: "TooManyRequests", - 431: "RequestHeaderFieldsTooLarge", - 500: "InternalServerError", - 501: "NotImplemented", - 502: "BadGateway", - 503: "ServiceUnavailable", - 504: "GatewayTimeout", - 505: "HTTPVersionNotSupported", - 506: "VariantAlsoNegotiates", - 507: "InsufficientStorage", - 508: "LoopDetected", - 510: "NotExtended", - 511: "NetworkAuthenticationRequired", - } - StatusCode_value = map[string]int32{ - "Empty": 0, - "Continue": 100, - "OK": 200, - "Created": 201, - "Accepted": 202, - "NonAuthoritativeInformation": 203, - "NoContent": 204, - "ResetContent": 205, - "PartialContent": 206, - "MultiStatus": 207, - "AlreadyReported": 208, - "IMUsed": 226, - "MultipleChoices": 300, - "MovedPermanently": 301, - "Found": 302, - "SeeOther": 303, - "NotModified": 304, - "UseProxy": 305, - "TemporaryRedirect": 307, - "PermanentRedirect": 308, - "BadRequest": 400, - "Unauthorized": 401, - "PaymentRequired": 402, - "Forbidden": 403, - "NotFound": 404, - "MethodNotAllowed": 405, - "NotAcceptable": 406, - "ProxyAuthenticationRequired": 407, - "RequestTimeout": 408, - "Conflict": 409, - "Gone": 410, - "LengthRequired": 411, - "PreconditionFailed": 412, - "PayloadTooLarge": 413, - "URITooLong": 414, - "UnsupportedMediaType": 415, - "RangeNotSatisfiable": 416, - "ExpectationFailed": 417, - "MisdirectedRequest": 421, - "UnprocessableEntity": 422, - "Locked": 423, - "FailedDependency": 424, - "UpgradeRequired": 426, - "PreconditionRequired": 428, - "TooManyRequests": 429, - "RequestHeaderFieldsTooLarge": 431, - "InternalServerError": 500, - "NotImplemented": 501, - "BadGateway": 502, - "ServiceUnavailable": 503, - "GatewayTimeout": 504, - "HTTPVersionNotSupported": 505, - "VariantAlsoNegotiates": 506, - "InsufficientStorage": 507, - "LoopDetected": 508, - "NotExtended": 510, - "NetworkAuthenticationRequired": 511, - } -) - -func (x StatusCode) Enum() *StatusCode { - p := new(StatusCode) - *p = x - return p -} - -func (x StatusCode) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (StatusCode) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_type_v3_http_status_proto_enumTypes[0].Descriptor() -} - -func (StatusCode) Type() protoreflect.EnumType { - return &file_envoy_type_v3_http_status_proto_enumTypes[0] -} - -func (x StatusCode) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use StatusCode.Descriptor instead. -func (StatusCode) EnumDescriptor() ([]byte, []int) { - return file_envoy_type_v3_http_status_proto_rawDescGZIP(), []int{0} -} - -// HTTP status. -type HttpStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Supplies HTTP response code. - Code StatusCode `protobuf:"varint,1,opt,name=code,proto3,enum=envoy.type.v3.StatusCode" json:"code,omitempty"` -} - -func (x *HttpStatus) Reset() { - *x = HttpStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_v3_http_status_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HttpStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HttpStatus) ProtoMessage() {} - -func (x *HttpStatus) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_v3_http_status_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HttpStatus.ProtoReflect.Descriptor instead. -func (*HttpStatus) Descriptor() ([]byte, []int) { - return file_envoy_type_v3_http_status_proto_rawDescGZIP(), []int{0} -} - -func (x *HttpStatus) GetCode() StatusCode { - if x != nil { - return x.Code - } - return StatusCode_Empty -} - -var File_envoy_type_v3_http_status_proto protoreflect.FileDescriptor - -var file_envoy_type_v3_http_status_proto_rawDesc = []byte{ - 0x0a, 0x1f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x2f, - 0x68, 0x74, 0x74, 0x70, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x0d, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, - 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x21, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x65, 0x0a, 0x0a, 0x48, - 0x74, 0x74, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x39, 0x0a, 0x04, 0x63, 0x6f, 0x64, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, - 0x64, 0x65, 0x42, 0x0a, 0xfa, 0x42, 0x07, 0x82, 0x01, 0x04, 0x10, 0x01, 0x20, 0x00, 0x52, 0x04, - 0x63, 0x6f, 0x64, 0x65, 0x3a, 0x1c, 0x9a, 0xc5, 0x88, 0x1e, 0x17, 0x0a, 0x15, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x2a, 0xb5, 0x09, 0x0a, 0x0a, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, - 0x65, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, - 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x10, 0x64, 0x12, 0x07, 0x0a, 0x02, 0x4f, 0x4b, - 0x10, 0xc8, 0x01, 0x12, 0x0c, 0x0a, 0x07, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x10, 0xc9, - 0x01, 0x12, 0x0d, 0x0a, 0x08, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x10, 0xca, 0x01, - 0x12, 0x20, 0x0a, 0x1b, 0x4e, 0x6f, 0x6e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x61, - 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x10, - 0xcb, 0x01, 0x12, 0x0e, 0x0a, 0x09, 0x4e, 0x6f, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x10, - 0xcc, 0x01, 0x12, 0x11, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x10, 0xcd, 0x01, 0x12, 0x13, 0x0a, 0x0e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x61, 0x6c, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x10, 0xce, 0x01, 0x12, 0x10, 0x0a, 0x0b, 0x4d, 0x75, - 0x6c, 0x74, 0x69, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x10, 0xcf, 0x01, 0x12, 0x14, 0x0a, 0x0f, - 0x41, 0x6c, 0x72, 0x65, 0x61, 0x64, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x10, - 0xd0, 0x01, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x4d, 0x55, 0x73, 0x65, 0x64, 0x10, 0xe2, 0x01, 0x12, - 0x14, 0x0a, 0x0f, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x43, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x73, 0x10, 0xac, 0x02, 0x12, 0x15, 0x0a, 0x10, 0x4d, 0x6f, 0x76, 0x65, 0x64, 0x50, 0x65, - 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x6c, 0x79, 0x10, 0xad, 0x02, 0x12, 0x0a, 0x0a, 0x05, - 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xae, 0x02, 0x12, 0x0d, 0x0a, 0x08, 0x53, 0x65, 0x65, 0x4f, - 0x74, 0x68, 0x65, 0x72, 0x10, 0xaf, 0x02, 0x12, 0x10, 0x0a, 0x0b, 0x4e, 0x6f, 0x74, 0x4d, 0x6f, - 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0xb0, 0x02, 0x12, 0x0d, 0x0a, 0x08, 0x55, 0x73, 0x65, - 0x50, 0x72, 0x6f, 0x78, 0x79, 0x10, 0xb1, 0x02, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x65, 0x6d, 0x70, - 0x6f, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x10, 0xb3, 0x02, - 0x12, 0x16, 0x0a, 0x11, 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x64, - 0x69, 0x72, 0x65, 0x63, 0x74, 0x10, 0xb4, 0x02, 0x12, 0x0f, 0x0a, 0x0a, 0x42, 0x61, 0x64, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x10, 0x90, 0x03, 0x12, 0x11, 0x0a, 0x0c, 0x55, 0x6e, 0x61, - 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x10, 0x91, 0x03, 0x12, 0x14, 0x0a, 0x0f, - 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x10, - 0x92, 0x03, 0x12, 0x0e, 0x0a, 0x09, 0x46, 0x6f, 0x72, 0x62, 0x69, 0x64, 0x64, 0x65, 0x6e, 0x10, - 0x93, 0x03, 0x12, 0x0d, 0x0a, 0x08, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0x94, - 0x03, 0x12, 0x15, 0x0a, 0x10, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4e, 0x6f, 0x74, 0x41, 0x6c, - 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x10, 0x95, 0x03, 0x12, 0x12, 0x0a, 0x0d, 0x4e, 0x6f, 0x74, 0x41, - 0x63, 0x63, 0x65, 0x70, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x10, 0x96, 0x03, 0x12, 0x20, 0x0a, 0x1b, - 0x50, 0x72, 0x6f, 0x78, 0x79, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x10, 0x97, 0x03, 0x12, 0x13, - 0x0a, 0x0e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, - 0x10, 0x98, 0x03, 0x12, 0x0d, 0x0a, 0x08, 0x43, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x10, - 0x99, 0x03, 0x12, 0x09, 0x0a, 0x04, 0x47, 0x6f, 0x6e, 0x65, 0x10, 0x9a, 0x03, 0x12, 0x13, 0x0a, - 0x0e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x10, - 0x9b, 0x03, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x72, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0x9c, 0x03, 0x12, 0x14, 0x0a, 0x0f, 0x50, - 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x6f, 0x6f, 0x4c, 0x61, 0x72, 0x67, 0x65, 0x10, 0x9d, - 0x03, 0x12, 0x0f, 0x0a, 0x0a, 0x55, 0x52, 0x49, 0x54, 0x6f, 0x6f, 0x4c, 0x6f, 0x6e, 0x67, 0x10, - 0x9e, 0x03, 0x12, 0x19, 0x0a, 0x14, 0x55, 0x6e, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, - 0x64, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x10, 0x9f, 0x03, 0x12, 0x18, 0x0a, - 0x13, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4e, 0x6f, 0x74, 0x53, 0x61, 0x74, 0x69, 0x73, 0x66, 0x69, - 0x61, 0x62, 0x6c, 0x65, 0x10, 0xa0, 0x03, 0x12, 0x16, 0x0a, 0x11, 0x45, 0x78, 0x70, 0x65, 0x63, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0xa1, 0x03, 0x12, - 0x17, 0x0a, 0x12, 0x4d, 0x69, 0x73, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x65, 0x64, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x10, 0xa5, 0x03, 0x12, 0x18, 0x0a, 0x13, 0x55, 0x6e, 0x70, 0x72, - 0x6f, 0x63, 0x65, 0x73, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x10, - 0xa6, 0x03, 0x12, 0x0b, 0x0a, 0x06, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x10, 0xa7, 0x03, 0x12, - 0x15, 0x0a, 0x10, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, - 0x6e, 0x63, 0x79, 0x10, 0xa8, 0x03, 0x12, 0x14, 0x0a, 0x0f, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x10, 0xaa, 0x03, 0x12, 0x19, 0x0a, 0x14, - 0x50, 0x72, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, - 0x69, 0x72, 0x65, 0x64, 0x10, 0xac, 0x03, 0x12, 0x14, 0x0a, 0x0f, 0x54, 0x6f, 0x6f, 0x4d, 0x61, - 0x6e, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x10, 0xad, 0x03, 0x12, 0x20, 0x0a, - 0x1b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x46, 0x69, - 0x65, 0x6c, 0x64, 0x73, 0x54, 0x6f, 0x6f, 0x4c, 0x61, 0x72, 0x67, 0x65, 0x10, 0xaf, 0x03, 0x12, - 0x18, 0x0a, 0x13, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0xf4, 0x03, 0x12, 0x13, 0x0a, 0x0e, 0x4e, 0x6f, 0x74, - 0x49, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x65, 0x64, 0x10, 0xf5, 0x03, 0x12, 0x0f, - 0x0a, 0x0a, 0x42, 0x61, 0x64, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x10, 0xf6, 0x03, 0x12, - 0x17, 0x0a, 0x12, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x6e, 0x61, 0x76, 0x61, 0x69, - 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x10, 0xf7, 0x03, 0x12, 0x13, 0x0a, 0x0e, 0x47, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x10, 0xf8, 0x03, 0x12, 0x1c, 0x0a, - 0x17, 0x48, 0x54, 0x54, 0x50, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x4e, 0x6f, 0x74, 0x53, - 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x10, 0xf9, 0x03, 0x12, 0x1a, 0x0a, 0x15, 0x56, - 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x41, 0x6c, 0x73, 0x6f, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, - 0x61, 0x74, 0x65, 0x73, 0x10, 0xfa, 0x03, 0x12, 0x18, 0x0a, 0x13, 0x49, 0x6e, 0x73, 0x75, 0x66, - 0x66, 0x69, 0x63, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x10, 0xfb, - 0x03, 0x12, 0x11, 0x0a, 0x0c, 0x4c, 0x6f, 0x6f, 0x70, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x65, - 0x64, 0x10, 0xfc, 0x03, 0x12, 0x10, 0x0a, 0x0b, 0x4e, 0x6f, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x64, 0x65, 0x64, 0x10, 0xfe, 0x03, 0x12, 0x22, 0x0a, 0x1d, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, - 0x6b, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x10, 0xff, 0x03, 0x42, 0x75, 0x0a, 0x1b, 0x69, 0x6f, - 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x42, 0x0f, 0x48, 0x74, 0x74, 0x70, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3b, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, - 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, - 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, - 0x76, 0x33, 0x3b, 0x74, 0x79, 0x70, 0x65, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x10, - 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_type_v3_http_status_proto_rawDescOnce sync.Once - file_envoy_type_v3_http_status_proto_rawDescData = file_envoy_type_v3_http_status_proto_rawDesc -) - -func file_envoy_type_v3_http_status_proto_rawDescGZIP() []byte { - file_envoy_type_v3_http_status_proto_rawDescOnce.Do(func() { - file_envoy_type_v3_http_status_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_type_v3_http_status_proto_rawDescData) - }) - return file_envoy_type_v3_http_status_proto_rawDescData -} - -var file_envoy_type_v3_http_status_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_envoy_type_v3_http_status_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_type_v3_http_status_proto_goTypes = []interface{}{ - (StatusCode)(0), // 0: envoy.type.v3.StatusCode - (*HttpStatus)(nil), // 1: envoy.type.v3.HttpStatus -} -var file_envoy_type_v3_http_status_proto_depIdxs = []int32{ - 0, // 0: envoy.type.v3.HttpStatus.code:type_name -> envoy.type.v3.StatusCode - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_envoy_type_v3_http_status_proto_init() } -func file_envoy_type_v3_http_status_proto_init() { - if File_envoy_type_v3_http_status_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_envoy_type_v3_http_status_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HttpStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_type_v3_http_status_proto_rawDesc, - NumEnums: 1, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_type_v3_http_status_proto_goTypes, - DependencyIndexes: file_envoy_type_v3_http_status_proto_depIdxs, - EnumInfos: file_envoy_type_v3_http_status_proto_enumTypes, - MessageInfos: file_envoy_type_v3_http_status_proto_msgTypes, - }.Build() - File_envoy_type_v3_http_status_proto = out.File - file_envoy_type_v3_http_status_proto_rawDesc = nil - file_envoy_type_v3_http_status_proto_goTypes = nil - file_envoy_type_v3_http_status_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/v3/http_status.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/type/v3/http_status.pb.validate.go deleted file mode 100644 index 985e8d94c..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/v3/http_status.pb.validate.go +++ /dev/null @@ -1,161 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/type/v3/http_status.proto - -package typev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on HttpStatus with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *HttpStatus) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HttpStatus with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in HttpStatusMultiError, or -// nil if none found. -func (m *HttpStatus) ValidateAll() error { - return m.validate(true) -} - -func (m *HttpStatus) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if _, ok := _HttpStatus_Code_NotInLookup[m.GetCode()]; ok { - err := HttpStatusValidationError{ - field: "Code", - reason: "value must not be in list [Empty]", - } - if !all { - return err - } - errors = append(errors, err) - } - - if _, ok := StatusCode_name[int32(m.GetCode())]; !ok { - err := HttpStatusValidationError{ - field: "Code", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return HttpStatusMultiError(errors) - } - - return nil -} - -// HttpStatusMultiError is an error wrapping multiple validation errors -// returned by HttpStatus.ValidateAll() if the designated constraints aren't met. -type HttpStatusMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HttpStatusMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HttpStatusMultiError) AllErrors() []error { return m } - -// HttpStatusValidationError is the validation error returned by -// HttpStatus.Validate if the designated constraints aren't met. -type HttpStatusValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HttpStatusValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HttpStatusValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HttpStatusValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HttpStatusValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HttpStatusValidationError) ErrorName() string { return "HttpStatusValidationError" } - -// Error satisfies the builtin error interface -func (e HttpStatusValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttpStatus.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HttpStatusValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HttpStatusValidationError{} - -var _HttpStatus_Code_NotInLookup = map[StatusCode]struct{}{ - 0: {}, -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/v3/percent.pb.go b/vendor/github.com/cilium/proxy/go/envoy/type/v3/percent.pb.go deleted file mode 100644 index 873f9e131..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/v3/percent.pb.go +++ /dev/null @@ -1,321 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/type/v3/percent.proto - -package typev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Fraction percentages support several fixed denominator values. -type FractionalPercent_DenominatorType int32 - -const ( - // 100. - // - // **Example**: 1/100 = 1%. - FractionalPercent_HUNDRED FractionalPercent_DenominatorType = 0 - // 10,000. - // - // **Example**: 1/10000 = 0.01%. - FractionalPercent_TEN_THOUSAND FractionalPercent_DenominatorType = 1 - // 1,000,000. - // - // **Example**: 1/1000000 = 0.0001%. - FractionalPercent_MILLION FractionalPercent_DenominatorType = 2 -) - -// Enum value maps for FractionalPercent_DenominatorType. -var ( - FractionalPercent_DenominatorType_name = map[int32]string{ - 0: "HUNDRED", - 1: "TEN_THOUSAND", - 2: "MILLION", - } - FractionalPercent_DenominatorType_value = map[string]int32{ - "HUNDRED": 0, - "TEN_THOUSAND": 1, - "MILLION": 2, - } -) - -func (x FractionalPercent_DenominatorType) Enum() *FractionalPercent_DenominatorType { - p := new(FractionalPercent_DenominatorType) - *p = x - return p -} - -func (x FractionalPercent_DenominatorType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (FractionalPercent_DenominatorType) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_type_v3_percent_proto_enumTypes[0].Descriptor() -} - -func (FractionalPercent_DenominatorType) Type() protoreflect.EnumType { - return &file_envoy_type_v3_percent_proto_enumTypes[0] -} - -func (x FractionalPercent_DenominatorType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use FractionalPercent_DenominatorType.Descriptor instead. -func (FractionalPercent_DenominatorType) EnumDescriptor() ([]byte, []int) { - return file_envoy_type_v3_percent_proto_rawDescGZIP(), []int{1, 0} -} - -// Identifies a percentage, in the range [0.0, 100.0]. -type Percent struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *Percent) Reset() { - *x = Percent{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_v3_percent_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Percent) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Percent) ProtoMessage() {} - -func (x *Percent) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_v3_percent_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Percent.ProtoReflect.Descriptor instead. -func (*Percent) Descriptor() ([]byte, []int) { - return file_envoy_type_v3_percent_proto_rawDescGZIP(), []int{0} -} - -func (x *Percent) GetValue() float64 { - if x != nil { - return x.Value - } - return 0 -} - -// A fractional percentage is used in cases in which for performance reasons performing floating -// point to integer conversions during randomness calculations is undesirable. The message includes -// both a numerator and denominator that together determine the final fractional value. -// -// * **Example**: 1/100 = 1%. -// * **Example**: 3/10000 = 0.03%. -type FractionalPercent struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Specifies the numerator. Defaults to 0. - Numerator uint32 `protobuf:"varint,1,opt,name=numerator,proto3" json:"numerator,omitempty"` - // Specifies the denominator. If the denominator specified is less than the numerator, the final - // fractional percentage is capped at 1 (100%). - Denominator FractionalPercent_DenominatorType `protobuf:"varint,2,opt,name=denominator,proto3,enum=envoy.type.v3.FractionalPercent_DenominatorType" json:"denominator,omitempty"` -} - -func (x *FractionalPercent) Reset() { - *x = FractionalPercent{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_v3_percent_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FractionalPercent) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FractionalPercent) ProtoMessage() {} - -func (x *FractionalPercent) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_v3_percent_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FractionalPercent.ProtoReflect.Descriptor instead. -func (*FractionalPercent) Descriptor() ([]byte, []int) { - return file_envoy_type_v3_percent_proto_rawDescGZIP(), []int{1} -} - -func (x *FractionalPercent) GetNumerator() uint32 { - if x != nil { - return x.Numerator - } - return 0 -} - -func (x *FractionalPercent) GetDenominator() FractionalPercent_DenominatorType { - if x != nil { - return x.Denominator - } - return FractionalPercent_HUNDRED -} - -var File_envoy_type_v3_percent_proto protoreflect.FileDescriptor - -var file_envoy_type_v3_percent_proto_rawDesc = []byte{ - 0x0a, 0x1b, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x2f, - 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x1a, 0x1d, 0x75, 0x64, - 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x75, 0x64, 0x70, - 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, - 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x53, 0x0a, 0x07, 0x50, 0x65, 0x72, 0x63, 0x65, - 0x6e, 0x74, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x01, 0x42, 0x17, 0xfa, 0x42, 0x14, 0x12, 0x12, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, - 0x40, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x3a, 0x19, 0x9a, 0xc5, 0x88, 0x1e, 0x14, 0x0a, 0x12, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x2e, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x22, 0xf3, 0x01, 0x0a, - 0x11, 0x46, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x63, 0x65, - 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, - 0x12, 0x5c, 0x0a, 0x0b, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x30, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x46, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, - 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x2e, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x6e, 0x61, - 0x74, 0x6f, 0x72, 0x54, 0x79, 0x70, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, - 0x01, 0x52, 0x0b, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x22, 0x3d, - 0x0a, 0x0f, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x48, 0x55, 0x4e, 0x44, 0x52, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, - 0x0a, 0x0c, 0x54, 0x45, 0x4e, 0x5f, 0x54, 0x48, 0x4f, 0x55, 0x53, 0x41, 0x4e, 0x44, 0x10, 0x01, - 0x12, 0x0b, 0x0a, 0x07, 0x4d, 0x49, 0x4c, 0x4c, 0x49, 0x4f, 0x4e, 0x10, 0x02, 0x3a, 0x23, 0x9a, - 0xc5, 0x88, 0x1e, 0x1e, 0x0a, 0x1c, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x2e, 0x46, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x63, 0x65, - 0x6e, 0x74, 0x42, 0x72, 0x0a, 0x1b, 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, - 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, - 0x33, 0x42, 0x0c, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, - 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x3b, 0x74, 0x79, 0x70, 0x65, 0x76, 0x33, 0xba, 0x80, - 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_type_v3_percent_proto_rawDescOnce sync.Once - file_envoy_type_v3_percent_proto_rawDescData = file_envoy_type_v3_percent_proto_rawDesc -) - -func file_envoy_type_v3_percent_proto_rawDescGZIP() []byte { - file_envoy_type_v3_percent_proto_rawDescOnce.Do(func() { - file_envoy_type_v3_percent_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_type_v3_percent_proto_rawDescData) - }) - return file_envoy_type_v3_percent_proto_rawDescData -} - -var file_envoy_type_v3_percent_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_envoy_type_v3_percent_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_envoy_type_v3_percent_proto_goTypes = []interface{}{ - (FractionalPercent_DenominatorType)(0), // 0: envoy.type.v3.FractionalPercent.DenominatorType - (*Percent)(nil), // 1: envoy.type.v3.Percent - (*FractionalPercent)(nil), // 2: envoy.type.v3.FractionalPercent -} -var file_envoy_type_v3_percent_proto_depIdxs = []int32{ - 0, // 0: envoy.type.v3.FractionalPercent.denominator:type_name -> envoy.type.v3.FractionalPercent.DenominatorType - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_envoy_type_v3_percent_proto_init() } -func file_envoy_type_v3_percent_proto_init() { - if File_envoy_type_v3_percent_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_envoy_type_v3_percent_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Percent); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_v3_percent_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FractionalPercent); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_type_v3_percent_proto_rawDesc, - NumEnums: 1, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_type_v3_percent_proto_goTypes, - DependencyIndexes: file_envoy_type_v3_percent_proto_depIdxs, - EnumInfos: file_envoy_type_v3_percent_proto_enumTypes, - MessageInfos: file_envoy_type_v3_percent_proto_msgTypes, - }.Build() - File_envoy_type_v3_percent_proto = out.File - file_envoy_type_v3_percent_proto_rawDesc = nil - file_envoy_type_v3_percent_proto_goTypes = nil - file_envoy_type_v3_percent_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/v3/percent.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/type/v3/percent.pb.validate.go deleted file mode 100644 index 25a5815f0..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/v3/percent.pb.validate.go +++ /dev/null @@ -1,260 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/type/v3/percent.proto - -package typev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on Percent with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Percent) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Percent with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in PercentMultiError, or nil if none found. -func (m *Percent) ValidateAll() error { - return m.validate(true) -} - -func (m *Percent) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if val := m.GetValue(); val < 0 || val > 100 { - err := PercentValidationError{ - field: "Value", - reason: "value must be inside range [0, 100]", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return PercentMultiError(errors) - } - - return nil -} - -// PercentMultiError is an error wrapping multiple validation errors returned -// by Percent.ValidateAll() if the designated constraints aren't met. -type PercentMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PercentMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m PercentMultiError) AllErrors() []error { return m } - -// PercentValidationError is the validation error returned by Percent.Validate -// if the designated constraints aren't met. -type PercentValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e PercentValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e PercentValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e PercentValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e PercentValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e PercentValidationError) ErrorName() string { return "PercentValidationError" } - -// Error satisfies the builtin error interface -func (e PercentValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sPercent.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = PercentValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = PercentValidationError{} - -// Validate checks the field values on FractionalPercent with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *FractionalPercent) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on FractionalPercent with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// FractionalPercentMultiError, or nil if none found. -func (m *FractionalPercent) ValidateAll() error { - return m.validate(true) -} - -func (m *FractionalPercent) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Numerator - - if _, ok := FractionalPercent_DenominatorType_name[int32(m.GetDenominator())]; !ok { - err := FractionalPercentValidationError{ - field: "Denominator", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return FractionalPercentMultiError(errors) - } - - return nil -} - -// FractionalPercentMultiError is an error wrapping multiple validation errors -// returned by FractionalPercent.ValidateAll() if the designated constraints -// aren't met. -type FractionalPercentMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m FractionalPercentMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m FractionalPercentMultiError) AllErrors() []error { return m } - -// FractionalPercentValidationError is the validation error returned by -// FractionalPercent.Validate if the designated constraints aren't met. -type FractionalPercentValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e FractionalPercentValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e FractionalPercentValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e FractionalPercentValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e FractionalPercentValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e FractionalPercentValidationError) ErrorName() string { - return "FractionalPercentValidationError" -} - -// Error satisfies the builtin error interface -func (e FractionalPercentValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sFractionalPercent.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = FractionalPercentValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = FractionalPercentValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/v3/range.pb.go b/vendor/github.com/cilium/proxy/go/envoy/type/v3/range.pb.go deleted file mode 100644 index f787c6829..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/v3/range.pb.go +++ /dev/null @@ -1,329 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/type/v3/range.proto - -package typev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Specifies the int64 start and end of the range using half-open interval semantics [start, -// end). -type Int64Range struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // start of the range (inclusive) - Start int64 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"` - // end of the range (exclusive) - End int64 `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"` -} - -func (x *Int64Range) Reset() { - *x = Int64Range{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_v3_range_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Int64Range) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Int64Range) ProtoMessage() {} - -func (x *Int64Range) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_v3_range_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Int64Range.ProtoReflect.Descriptor instead. -func (*Int64Range) Descriptor() ([]byte, []int) { - return file_envoy_type_v3_range_proto_rawDescGZIP(), []int{0} -} - -func (x *Int64Range) GetStart() int64 { - if x != nil { - return x.Start - } - return 0 -} - -func (x *Int64Range) GetEnd() int64 { - if x != nil { - return x.End - } - return 0 -} - -// Specifies the int32 start and end of the range using half-open interval semantics [start, -// end). -type Int32Range struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // start of the range (inclusive) - Start int32 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"` - // end of the range (exclusive) - End int32 `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"` -} - -func (x *Int32Range) Reset() { - *x = Int32Range{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_v3_range_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Int32Range) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Int32Range) ProtoMessage() {} - -func (x *Int32Range) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_v3_range_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Int32Range.ProtoReflect.Descriptor instead. -func (*Int32Range) Descriptor() ([]byte, []int) { - return file_envoy_type_v3_range_proto_rawDescGZIP(), []int{1} -} - -func (x *Int32Range) GetStart() int32 { - if x != nil { - return x.Start - } - return 0 -} - -func (x *Int32Range) GetEnd() int32 { - if x != nil { - return x.End - } - return 0 -} - -// Specifies the double start and end of the range using half-open interval semantics [start, -// end). -type DoubleRange struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // start of the range (inclusive) - Start float64 `protobuf:"fixed64,1,opt,name=start,proto3" json:"start,omitempty"` - // end of the range (exclusive) - End float64 `protobuf:"fixed64,2,opt,name=end,proto3" json:"end,omitempty"` -} - -func (x *DoubleRange) Reset() { - *x = DoubleRange{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_v3_range_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DoubleRange) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DoubleRange) ProtoMessage() {} - -func (x *DoubleRange) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_v3_range_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DoubleRange.ProtoReflect.Descriptor instead. -func (*DoubleRange) Descriptor() ([]byte, []int) { - return file_envoy_type_v3_range_proto_rawDescGZIP(), []int{2} -} - -func (x *DoubleRange) GetStart() float64 { - if x != nil { - return x.Start - } - return 0 -} - -func (x *DoubleRange) GetEnd() float64 { - if x != nil { - return x.End - } - return 0 -} - -var File_envoy_type_v3_range_proto protoreflect.FileDescriptor - -var file_envoy_type_v3_range_proto_rawDesc = []byte{ - 0x0a, 0x19, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x2f, - 0x72, 0x61, 0x6e, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, - 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x75, 0x64, 0x70, 0x61, 0x2f, - 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x52, 0x0a, 0x0a, - 0x49, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x65, - 0x6e, 0x64, 0x3a, 0x1c, 0x9a, 0xc5, 0x88, 0x1e, 0x17, 0x0a, 0x15, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x61, 0x6e, 0x67, 0x65, - 0x22, 0x52, 0x0a, 0x0a, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, - 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x3a, 0x1c, 0x9a, 0xc5, 0x88, 0x1e, 0x17, 0x0a, 0x15, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x52, - 0x61, 0x6e, 0x67, 0x65, 0x22, 0x54, 0x0a, 0x0b, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x52, 0x61, - 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x01, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x3a, 0x1d, 0x9a, 0xc5, 0x88, - 0x1e, 0x18, 0x0a, 0x16, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x44, - 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x42, 0x70, 0x0a, 0x1b, 0x69, 0x6f, - 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x42, 0x0a, 0x52, 0x61, 0x6e, 0x67, 0x65, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, - 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x3b, 0x74, 0x79, - 0x70, 0x65, 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_type_v3_range_proto_rawDescOnce sync.Once - file_envoy_type_v3_range_proto_rawDescData = file_envoy_type_v3_range_proto_rawDesc -) - -func file_envoy_type_v3_range_proto_rawDescGZIP() []byte { - file_envoy_type_v3_range_proto_rawDescOnce.Do(func() { - file_envoy_type_v3_range_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_type_v3_range_proto_rawDescData) - }) - return file_envoy_type_v3_range_proto_rawDescData -} - -var file_envoy_type_v3_range_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_envoy_type_v3_range_proto_goTypes = []interface{}{ - (*Int64Range)(nil), // 0: envoy.type.v3.Int64Range - (*Int32Range)(nil), // 1: envoy.type.v3.Int32Range - (*DoubleRange)(nil), // 2: envoy.type.v3.DoubleRange -} -var file_envoy_type_v3_range_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_envoy_type_v3_range_proto_init() } -func file_envoy_type_v3_range_proto_init() { - if File_envoy_type_v3_range_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_envoy_type_v3_range_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Int64Range); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_v3_range_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Int32Range); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_v3_range_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DoubleRange); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_type_v3_range_proto_rawDesc, - NumEnums: 0, - NumMessages: 3, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_type_v3_range_proto_goTypes, - DependencyIndexes: file_envoy_type_v3_range_proto_depIdxs, - MessageInfos: file_envoy_type_v3_range_proto_msgTypes, - }.Build() - File_envoy_type_v3_range_proto = out.File - file_envoy_type_v3_range_proto_rawDesc = nil - file_envoy_type_v3_range_proto_goTypes = nil - file_envoy_type_v3_range_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/v3/range.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/type/v3/range.pb.validate.go deleted file mode 100644 index b6a0f4ef5..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/v3/range.pb.validate.go +++ /dev/null @@ -1,345 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/type/v3/range.proto - -package typev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on Int64Range with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Int64Range) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Int64Range with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in Int64RangeMultiError, or -// nil if none found. -func (m *Int64Range) ValidateAll() error { - return m.validate(true) -} - -func (m *Int64Range) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Start - - // no validation rules for End - - if len(errors) > 0 { - return Int64RangeMultiError(errors) - } - - return nil -} - -// Int64RangeMultiError is an error wrapping multiple validation errors -// returned by Int64Range.ValidateAll() if the designated constraints aren't met. -type Int64RangeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m Int64RangeMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m Int64RangeMultiError) AllErrors() []error { return m } - -// Int64RangeValidationError is the validation error returned by -// Int64Range.Validate if the designated constraints aren't met. -type Int64RangeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e Int64RangeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e Int64RangeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e Int64RangeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e Int64RangeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e Int64RangeValidationError) ErrorName() string { return "Int64RangeValidationError" } - -// Error satisfies the builtin error interface -func (e Int64RangeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sInt64Range.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = Int64RangeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = Int64RangeValidationError{} - -// Validate checks the field values on Int32Range with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Int32Range) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Int32Range with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in Int32RangeMultiError, or -// nil if none found. -func (m *Int32Range) ValidateAll() error { - return m.validate(true) -} - -func (m *Int32Range) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Start - - // no validation rules for End - - if len(errors) > 0 { - return Int32RangeMultiError(errors) - } - - return nil -} - -// Int32RangeMultiError is an error wrapping multiple validation errors -// returned by Int32Range.ValidateAll() if the designated constraints aren't met. -type Int32RangeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m Int32RangeMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m Int32RangeMultiError) AllErrors() []error { return m } - -// Int32RangeValidationError is the validation error returned by -// Int32Range.Validate if the designated constraints aren't met. -type Int32RangeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e Int32RangeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e Int32RangeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e Int32RangeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e Int32RangeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e Int32RangeValidationError) ErrorName() string { return "Int32RangeValidationError" } - -// Error satisfies the builtin error interface -func (e Int32RangeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sInt32Range.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = Int32RangeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = Int32RangeValidationError{} - -// Validate checks the field values on DoubleRange with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *DoubleRange) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DoubleRange with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in DoubleRangeMultiError, or -// nil if none found. -func (m *DoubleRange) ValidateAll() error { - return m.validate(true) -} - -func (m *DoubleRange) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Start - - // no validation rules for End - - if len(errors) > 0 { - return DoubleRangeMultiError(errors) - } - - return nil -} - -// DoubleRangeMultiError is an error wrapping multiple validation errors -// returned by DoubleRange.ValidateAll() if the designated constraints aren't met. -type DoubleRangeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DoubleRangeMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DoubleRangeMultiError) AllErrors() []error { return m } - -// DoubleRangeValidationError is the validation error returned by -// DoubleRange.Validate if the designated constraints aren't met. -type DoubleRangeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DoubleRangeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DoubleRangeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DoubleRangeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DoubleRangeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DoubleRangeValidationError) ErrorName() string { return "DoubleRangeValidationError" } - -// Error satisfies the builtin error interface -func (e DoubleRangeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDoubleRange.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DoubleRangeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DoubleRangeValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/v3/ratelimit_strategy.pb.go b/vendor/github.com/cilium/proxy/go/envoy/type/v3/ratelimit_strategy.pb.go deleted file mode 100644 index f4383540a..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/v3/ratelimit_strategy.pb.go +++ /dev/null @@ -1,412 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/type/v3/ratelimit_strategy.proto - -package typev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/cncf/xds/go/xds/annotations/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Choose between allow all and deny all. -type RateLimitStrategy_BlanketRule int32 - -const ( - RateLimitStrategy_ALLOW_ALL RateLimitStrategy_BlanketRule = 0 - RateLimitStrategy_DENY_ALL RateLimitStrategy_BlanketRule = 1 -) - -// Enum value maps for RateLimitStrategy_BlanketRule. -var ( - RateLimitStrategy_BlanketRule_name = map[int32]string{ - 0: "ALLOW_ALL", - 1: "DENY_ALL", - } - RateLimitStrategy_BlanketRule_value = map[string]int32{ - "ALLOW_ALL": 0, - "DENY_ALL": 1, - } -) - -func (x RateLimitStrategy_BlanketRule) Enum() *RateLimitStrategy_BlanketRule { - p := new(RateLimitStrategy_BlanketRule) - *p = x - return p -} - -func (x RateLimitStrategy_BlanketRule) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (RateLimitStrategy_BlanketRule) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_type_v3_ratelimit_strategy_proto_enumTypes[0].Descriptor() -} - -func (RateLimitStrategy_BlanketRule) Type() protoreflect.EnumType { - return &file_envoy_type_v3_ratelimit_strategy_proto_enumTypes[0] -} - -func (x RateLimitStrategy_BlanketRule) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use RateLimitStrategy_BlanketRule.Descriptor instead. -func (RateLimitStrategy_BlanketRule) EnumDescriptor() ([]byte, []int) { - return file_envoy_type_v3_ratelimit_strategy_proto_rawDescGZIP(), []int{0, 0} -} - -type RateLimitStrategy struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Strategy: - // - // *RateLimitStrategy_BlanketRule_ - // *RateLimitStrategy_RequestsPerTimeUnit_ - // *RateLimitStrategy_TokenBucket - Strategy isRateLimitStrategy_Strategy `protobuf_oneof:"strategy"` -} - -func (x *RateLimitStrategy) Reset() { - *x = RateLimitStrategy{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_v3_ratelimit_strategy_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RateLimitStrategy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RateLimitStrategy) ProtoMessage() {} - -func (x *RateLimitStrategy) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_v3_ratelimit_strategy_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RateLimitStrategy.ProtoReflect.Descriptor instead. -func (*RateLimitStrategy) Descriptor() ([]byte, []int) { - return file_envoy_type_v3_ratelimit_strategy_proto_rawDescGZIP(), []int{0} -} - -func (m *RateLimitStrategy) GetStrategy() isRateLimitStrategy_Strategy { - if m != nil { - return m.Strategy - } - return nil -} - -func (x *RateLimitStrategy) GetBlanketRule() RateLimitStrategy_BlanketRule { - if x, ok := x.GetStrategy().(*RateLimitStrategy_BlanketRule_); ok { - return x.BlanketRule - } - return RateLimitStrategy_ALLOW_ALL -} - -func (x *RateLimitStrategy) GetRequestsPerTimeUnit() *RateLimitStrategy_RequestsPerTimeUnit { - if x, ok := x.GetStrategy().(*RateLimitStrategy_RequestsPerTimeUnit_); ok { - return x.RequestsPerTimeUnit - } - return nil -} - -func (x *RateLimitStrategy) GetTokenBucket() *TokenBucket { - if x, ok := x.GetStrategy().(*RateLimitStrategy_TokenBucket); ok { - return x.TokenBucket - } - return nil -} - -type isRateLimitStrategy_Strategy interface { - isRateLimitStrategy_Strategy() -} - -type RateLimitStrategy_BlanketRule_ struct { - // Allow or Deny the requests. - // If unset, allow all. - BlanketRule RateLimitStrategy_BlanketRule `protobuf:"varint,1,opt,name=blanket_rule,json=blanketRule,proto3,enum=envoy.type.v3.RateLimitStrategy_BlanketRule,oneof"` -} - -type RateLimitStrategy_RequestsPerTimeUnit_ struct { - // Best-effort limit of the number of requests per time unit, f.e. requests per second. - // Does not prescribe any specific rate limiting algorithm, see :ref:`RequestsPerTimeUnit - // ` for details. - RequestsPerTimeUnit *RateLimitStrategy_RequestsPerTimeUnit `protobuf:"bytes,2,opt,name=requests_per_time_unit,json=requestsPerTimeUnit,proto3,oneof"` -} - -type RateLimitStrategy_TokenBucket struct { - // Limit the requests by consuming tokens from the Token Bucket. - // Allow the same number of requests as the number of tokens available in - // the token bucket. - TokenBucket *TokenBucket `protobuf:"bytes,3,opt,name=token_bucket,json=tokenBucket,proto3,oneof"` -} - -func (*RateLimitStrategy_BlanketRule_) isRateLimitStrategy_Strategy() {} - -func (*RateLimitStrategy_RequestsPerTimeUnit_) isRateLimitStrategy_Strategy() {} - -func (*RateLimitStrategy_TokenBucket) isRateLimitStrategy_Strategy() {} - -// Best-effort limit of the number of requests per time unit. -// -// Allows to specify the desired requests per second (RPS, QPS), requests per minute (QPM, RPM), -// etc., without specifying a rate limiting algorithm implementation. -// -// “RequestsPerTimeUnit“ strategy does not demand any specific rate limiting algorithm to be -// used (in contrast to the :ref:`TokenBucket `, -// for example). It implies that the implementation details of rate limiting algorithm are -// irrelevant as long as the configured number of "requests per time unit" is achieved. -// -// Note that the “TokenBucket“ is still a valid implementation of the “RequestsPerTimeUnit“ -// strategy, and may be chosen to enforce the rate limit. However, there's no guarantee it will be -// the “TokenBucket“ in particular, and not the Leaky Bucket, the Sliding Window, or any other -// rate limiting algorithm that fulfills the requirements. -type RateLimitStrategy_RequestsPerTimeUnit struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The desired number of requests per :ref:`time_unit - // ` to allow. - // If set to “0“, deny all (equivalent to “BlanketRule.DENY_ALL“). - // - // .. note:: - // - // Note that the algorithm implementation determines the course of action for the requests - // over the limit. As long as the ``requests_per_time_unit`` converges on the desired value, - // it's allowed to treat this field as a soft-limit: allow bursts, redistribute the allowance - // over time, etc. - RequestsPerTimeUnit uint64 `protobuf:"varint,1,opt,name=requests_per_time_unit,json=requestsPerTimeUnit,proto3" json:"requests_per_time_unit,omitempty"` - // The unit of time. Ignored when :ref:`requests_per_time_unit - // ` - // is “0“ (deny all). - TimeUnit RateLimitUnit `protobuf:"varint,2,opt,name=time_unit,json=timeUnit,proto3,enum=envoy.type.v3.RateLimitUnit" json:"time_unit,omitempty"` -} - -func (x *RateLimitStrategy_RequestsPerTimeUnit) Reset() { - *x = RateLimitStrategy_RequestsPerTimeUnit{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_v3_ratelimit_strategy_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RateLimitStrategy_RequestsPerTimeUnit) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RateLimitStrategy_RequestsPerTimeUnit) ProtoMessage() {} - -func (x *RateLimitStrategy_RequestsPerTimeUnit) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_v3_ratelimit_strategy_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RateLimitStrategy_RequestsPerTimeUnit.ProtoReflect.Descriptor instead. -func (*RateLimitStrategy_RequestsPerTimeUnit) Descriptor() ([]byte, []int) { - return file_envoy_type_v3_ratelimit_strategy_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *RateLimitStrategy_RequestsPerTimeUnit) GetRequestsPerTimeUnit() uint64 { - if x != nil { - return x.RequestsPerTimeUnit - } - return 0 -} - -func (x *RateLimitStrategy_RequestsPerTimeUnit) GetTimeUnit() RateLimitUnit { - if x != nil { - return x.TimeUnit - } - return RateLimitUnit_UNKNOWN -} - -var File_envoy_type_v3_ratelimit_strategy_proto protoreflect.FileDescriptor - -var file_envoy_type_v3_ratelimit_strategy_proto_rawDesc = []byte{ - 0x0a, 0x26, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x2f, - 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, - 0x67, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x1a, 0x22, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, - 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, - 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, - 0x5f, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x78, - 0x64, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, - 0x33, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, - 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xed, 0x03, 0x0a, 0x11, 0x52, 0x61, 0x74, 0x65, 0x4c, - 0x69, 0x6d, 0x69, 0x74, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x5b, 0x0a, 0x0c, - 0x62, 0x6c, 0x61, 0x6e, 0x6b, 0x65, 0x74, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, - 0x76, 0x33, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x53, 0x74, 0x72, 0x61, - 0x74, 0x65, 0x67, 0x79, 0x2e, 0x42, 0x6c, 0x61, 0x6e, 0x6b, 0x65, 0x74, 0x52, 0x75, 0x6c, 0x65, - 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, 0x0b, 0x62, 0x6c, - 0x61, 0x6e, 0x6b, 0x65, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x6b, 0x0a, 0x16, 0x72, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x75, - 0x6e, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, - 0x6d, 0x69, 0x74, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x2e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x73, 0x50, 0x65, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x48, - 0x00, 0x52, 0x13, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x50, 0x65, 0x72, 0x54, 0x69, - 0x6d, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x3f, 0x0a, 0x0c, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, - 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x74, 0x6f, 0x6b, 0x65, - 0x6e, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x1a, 0x8f, 0x01, 0x0a, 0x13, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x73, 0x50, 0x65, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x12, - 0x33, 0x0a, 0x16, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, - 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x13, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x50, 0x65, 0x72, 0x54, 0x69, 0x6d, 0x65, - 0x55, 0x6e, 0x69, 0x74, 0x12, 0x43, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x75, 0x6e, 0x69, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, - 0x74, 0x55, 0x6e, 0x69, 0x74, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, - 0x08, 0x74, 0x69, 0x6d, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x22, 0x2a, 0x0a, 0x0b, 0x42, 0x6c, 0x61, - 0x6e, 0x6b, 0x65, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x0d, 0x0a, 0x09, 0x41, 0x4c, 0x4c, 0x4f, - 0x57, 0x5f, 0x41, 0x4c, 0x4c, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x45, 0x4e, 0x59, 0x5f, - 0x41, 0x4c, 0x4c, 0x10, 0x01, 0x42, 0x0f, 0x0a, 0x08, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, - 0x79, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x42, 0x84, 0x01, 0x0a, 0x1b, 0x69, 0x6f, 0x2e, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x42, 0x16, 0x52, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, - 0x74, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, - 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x3b, 0x74, 0x79, 0x70, 0x65, 0x76, 0x33, 0xba, 0x80, 0xc8, - 0xd1, 0x06, 0x02, 0x10, 0x02, 0xd2, 0xc6, 0xa4, 0xe1, 0x06, 0x02, 0x08, 0x01, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_type_v3_ratelimit_strategy_proto_rawDescOnce sync.Once - file_envoy_type_v3_ratelimit_strategy_proto_rawDescData = file_envoy_type_v3_ratelimit_strategy_proto_rawDesc -) - -func file_envoy_type_v3_ratelimit_strategy_proto_rawDescGZIP() []byte { - file_envoy_type_v3_ratelimit_strategy_proto_rawDescOnce.Do(func() { - file_envoy_type_v3_ratelimit_strategy_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_type_v3_ratelimit_strategy_proto_rawDescData) - }) - return file_envoy_type_v3_ratelimit_strategy_proto_rawDescData -} - -var file_envoy_type_v3_ratelimit_strategy_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_envoy_type_v3_ratelimit_strategy_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_envoy_type_v3_ratelimit_strategy_proto_goTypes = []interface{}{ - (RateLimitStrategy_BlanketRule)(0), // 0: envoy.type.v3.RateLimitStrategy.BlanketRule - (*RateLimitStrategy)(nil), // 1: envoy.type.v3.RateLimitStrategy - (*RateLimitStrategy_RequestsPerTimeUnit)(nil), // 2: envoy.type.v3.RateLimitStrategy.RequestsPerTimeUnit - (*TokenBucket)(nil), // 3: envoy.type.v3.TokenBucket - (RateLimitUnit)(0), // 4: envoy.type.v3.RateLimitUnit -} -var file_envoy_type_v3_ratelimit_strategy_proto_depIdxs = []int32{ - 0, // 0: envoy.type.v3.RateLimitStrategy.blanket_rule:type_name -> envoy.type.v3.RateLimitStrategy.BlanketRule - 2, // 1: envoy.type.v3.RateLimitStrategy.requests_per_time_unit:type_name -> envoy.type.v3.RateLimitStrategy.RequestsPerTimeUnit - 3, // 2: envoy.type.v3.RateLimitStrategy.token_bucket:type_name -> envoy.type.v3.TokenBucket - 4, // 3: envoy.type.v3.RateLimitStrategy.RequestsPerTimeUnit.time_unit:type_name -> envoy.type.v3.RateLimitUnit - 4, // [4:4] is the sub-list for method output_type - 4, // [4:4] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name -} - -func init() { file_envoy_type_v3_ratelimit_strategy_proto_init() } -func file_envoy_type_v3_ratelimit_strategy_proto_init() { - if File_envoy_type_v3_ratelimit_strategy_proto != nil { - return - } - file_envoy_type_v3_ratelimit_unit_proto_init() - file_envoy_type_v3_token_bucket_proto_init() - if !protoimpl.UnsafeEnabled { - file_envoy_type_v3_ratelimit_strategy_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RateLimitStrategy); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_envoy_type_v3_ratelimit_strategy_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RateLimitStrategy_RequestsPerTimeUnit); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_envoy_type_v3_ratelimit_strategy_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*RateLimitStrategy_BlanketRule_)(nil), - (*RateLimitStrategy_RequestsPerTimeUnit_)(nil), - (*RateLimitStrategy_TokenBucket)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_type_v3_ratelimit_strategy_proto_rawDesc, - NumEnums: 1, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_type_v3_ratelimit_strategy_proto_goTypes, - DependencyIndexes: file_envoy_type_v3_ratelimit_strategy_proto_depIdxs, - EnumInfos: file_envoy_type_v3_ratelimit_strategy_proto_enumTypes, - MessageInfos: file_envoy_type_v3_ratelimit_strategy_proto_msgTypes, - }.Build() - File_envoy_type_v3_ratelimit_strategy_proto = out.File - file_envoy_type_v3_ratelimit_strategy_proto_rawDesc = nil - file_envoy_type_v3_ratelimit_strategy_proto_goTypes = nil - file_envoy_type_v3_ratelimit_strategy_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/v3/ratelimit_strategy.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/type/v3/ratelimit_strategy.pb.validate.go deleted file mode 100644 index 1d22adb09..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/v3/ratelimit_strategy.pb.validate.go +++ /dev/null @@ -1,380 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/type/v3/ratelimit_strategy.proto - -package typev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on RateLimitStrategy with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *RateLimitStrategy) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RateLimitStrategy with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RateLimitStrategyMultiError, or nil if none found. -func (m *RateLimitStrategy) ValidateAll() error { - return m.validate(true) -} - -func (m *RateLimitStrategy) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofStrategyPresent := false - switch v := m.Strategy.(type) { - case *RateLimitStrategy_BlanketRule_: - if v == nil { - err := RateLimitStrategyValidationError{ - field: "Strategy", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofStrategyPresent = true - - if _, ok := RateLimitStrategy_BlanketRule_name[int32(m.GetBlanketRule())]; !ok { - err := RateLimitStrategyValidationError{ - field: "BlanketRule", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - case *RateLimitStrategy_RequestsPerTimeUnit_: - if v == nil { - err := RateLimitStrategyValidationError{ - field: "Strategy", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofStrategyPresent = true - - if all { - switch v := interface{}(m.GetRequestsPerTimeUnit()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RateLimitStrategyValidationError{ - field: "RequestsPerTimeUnit", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RateLimitStrategyValidationError{ - field: "RequestsPerTimeUnit", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRequestsPerTimeUnit()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RateLimitStrategyValidationError{ - field: "RequestsPerTimeUnit", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *RateLimitStrategy_TokenBucket: - if v == nil { - err := RateLimitStrategyValidationError{ - field: "Strategy", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofStrategyPresent = true - - if all { - switch v := interface{}(m.GetTokenBucket()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RateLimitStrategyValidationError{ - field: "TokenBucket", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RateLimitStrategyValidationError{ - field: "TokenBucket", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTokenBucket()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RateLimitStrategyValidationError{ - field: "TokenBucket", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofStrategyPresent { - err := RateLimitStrategyValidationError{ - field: "Strategy", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return RateLimitStrategyMultiError(errors) - } - - return nil -} - -// RateLimitStrategyMultiError is an error wrapping multiple validation errors -// returned by RateLimitStrategy.ValidateAll() if the designated constraints -// aren't met. -type RateLimitStrategyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RateLimitStrategyMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RateLimitStrategyMultiError) AllErrors() []error { return m } - -// RateLimitStrategyValidationError is the validation error returned by -// RateLimitStrategy.Validate if the designated constraints aren't met. -type RateLimitStrategyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RateLimitStrategyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RateLimitStrategyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RateLimitStrategyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RateLimitStrategyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RateLimitStrategyValidationError) ErrorName() string { - return "RateLimitStrategyValidationError" -} - -// Error satisfies the builtin error interface -func (e RateLimitStrategyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRateLimitStrategy.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RateLimitStrategyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RateLimitStrategyValidationError{} - -// Validate checks the field values on RateLimitStrategy_RequestsPerTimeUnit -// with the rules defined in the proto definition for this message. If any -// rules are violated, the first error encountered is returned, or nil if -// there are no violations. -func (m *RateLimitStrategy_RequestsPerTimeUnit) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RateLimitStrategy_RequestsPerTimeUnit -// with the rules defined in the proto definition for this message. If any -// rules are violated, the result is a list of violation errors wrapped in -// RateLimitStrategy_RequestsPerTimeUnitMultiError, or nil if none found. -func (m *RateLimitStrategy_RequestsPerTimeUnit) ValidateAll() error { - return m.validate(true) -} - -func (m *RateLimitStrategy_RequestsPerTimeUnit) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for RequestsPerTimeUnit - - if _, ok := RateLimitUnit_name[int32(m.GetTimeUnit())]; !ok { - err := RateLimitStrategy_RequestsPerTimeUnitValidationError{ - field: "TimeUnit", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return RateLimitStrategy_RequestsPerTimeUnitMultiError(errors) - } - - return nil -} - -// RateLimitStrategy_RequestsPerTimeUnitMultiError is an error wrapping -// multiple validation errors returned by -// RateLimitStrategy_RequestsPerTimeUnit.ValidateAll() if the designated -// constraints aren't met. -type RateLimitStrategy_RequestsPerTimeUnitMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RateLimitStrategy_RequestsPerTimeUnitMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RateLimitStrategy_RequestsPerTimeUnitMultiError) AllErrors() []error { return m } - -// RateLimitStrategy_RequestsPerTimeUnitValidationError is the validation error -// returned by RateLimitStrategy_RequestsPerTimeUnit.Validate if the -// designated constraints aren't met. -type RateLimitStrategy_RequestsPerTimeUnitValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RateLimitStrategy_RequestsPerTimeUnitValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RateLimitStrategy_RequestsPerTimeUnitValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RateLimitStrategy_RequestsPerTimeUnitValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RateLimitStrategy_RequestsPerTimeUnitValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RateLimitStrategy_RequestsPerTimeUnitValidationError) ErrorName() string { - return "RateLimitStrategy_RequestsPerTimeUnitValidationError" -} - -// Error satisfies the builtin error interface -func (e RateLimitStrategy_RequestsPerTimeUnitValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRateLimitStrategy_RequestsPerTimeUnit.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RateLimitStrategy_RequestsPerTimeUnitValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RateLimitStrategy_RequestsPerTimeUnitValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/v3/ratelimit_unit.pb.go b/vendor/github.com/cilium/proxy/go/envoy/type/v3/ratelimit_unit.pb.go deleted file mode 100644 index a1c5bf3dd..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/v3/ratelimit_unit.pb.go +++ /dev/null @@ -1,170 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/type/v3/ratelimit_unit.proto - -package typev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Identifies the unit of of time for rate limit. -type RateLimitUnit int32 - -const ( - // The time unit is not known. - RateLimitUnit_UNKNOWN RateLimitUnit = 0 - // The time unit representing a second. - RateLimitUnit_SECOND RateLimitUnit = 1 - // The time unit representing a minute. - RateLimitUnit_MINUTE RateLimitUnit = 2 - // The time unit representing an hour. - RateLimitUnit_HOUR RateLimitUnit = 3 - // The time unit representing a day. - RateLimitUnit_DAY RateLimitUnit = 4 - // The time unit representing a month. - RateLimitUnit_MONTH RateLimitUnit = 5 - // The time unit representing a year. - RateLimitUnit_YEAR RateLimitUnit = 6 -) - -// Enum value maps for RateLimitUnit. -var ( - RateLimitUnit_name = map[int32]string{ - 0: "UNKNOWN", - 1: "SECOND", - 2: "MINUTE", - 3: "HOUR", - 4: "DAY", - 5: "MONTH", - 6: "YEAR", - } - RateLimitUnit_value = map[string]int32{ - "UNKNOWN": 0, - "SECOND": 1, - "MINUTE": 2, - "HOUR": 3, - "DAY": 4, - "MONTH": 5, - "YEAR": 6, - } -) - -func (x RateLimitUnit) Enum() *RateLimitUnit { - p := new(RateLimitUnit) - *p = x - return p -} - -func (x RateLimitUnit) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (RateLimitUnit) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_type_v3_ratelimit_unit_proto_enumTypes[0].Descriptor() -} - -func (RateLimitUnit) Type() protoreflect.EnumType { - return &file_envoy_type_v3_ratelimit_unit_proto_enumTypes[0] -} - -func (x RateLimitUnit) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use RateLimitUnit.Descriptor instead. -func (RateLimitUnit) EnumDescriptor() ([]byte, []int) { - return file_envoy_type_v3_ratelimit_unit_proto_rawDescGZIP(), []int{0} -} - -var File_envoy_type_v3_ratelimit_unit_proto protoreflect.FileDescriptor - -var file_envoy_type_v3_ratelimit_unit_proto_rawDesc = []byte{ - 0x0a, 0x22, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x2f, - 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x2e, 0x76, 0x33, 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2a, 0x5c, 0x0a, 0x0d, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x55, - 0x6e, 0x69, 0x74, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, - 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x45, 0x43, 0x4f, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, - 0x4d, 0x49, 0x4e, 0x55, 0x54, 0x45, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x4f, 0x55, 0x52, - 0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x44, 0x41, 0x59, 0x10, 0x04, 0x12, 0x09, 0x0a, 0x05, 0x4d, - 0x4f, 0x4e, 0x54, 0x48, 0x10, 0x05, 0x12, 0x08, 0x0a, 0x04, 0x59, 0x45, 0x41, 0x52, 0x10, 0x06, - 0x42, 0x78, 0x0a, 0x1b, 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, - 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x42, - 0x12, 0x52, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x55, 0x6e, 0x69, 0x74, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x3b, 0x74, 0x79, 0x70, 0x65, - 0x76, 0x33, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_envoy_type_v3_ratelimit_unit_proto_rawDescOnce sync.Once - file_envoy_type_v3_ratelimit_unit_proto_rawDescData = file_envoy_type_v3_ratelimit_unit_proto_rawDesc -) - -func file_envoy_type_v3_ratelimit_unit_proto_rawDescGZIP() []byte { - file_envoy_type_v3_ratelimit_unit_proto_rawDescOnce.Do(func() { - file_envoy_type_v3_ratelimit_unit_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_type_v3_ratelimit_unit_proto_rawDescData) - }) - return file_envoy_type_v3_ratelimit_unit_proto_rawDescData -} - -var file_envoy_type_v3_ratelimit_unit_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_envoy_type_v3_ratelimit_unit_proto_goTypes = []interface{}{ - (RateLimitUnit)(0), // 0: envoy.type.v3.RateLimitUnit -} -var file_envoy_type_v3_ratelimit_unit_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_envoy_type_v3_ratelimit_unit_proto_init() } -func file_envoy_type_v3_ratelimit_unit_proto_init() { - if File_envoy_type_v3_ratelimit_unit_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_type_v3_ratelimit_unit_proto_rawDesc, - NumEnums: 1, - NumMessages: 0, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_type_v3_ratelimit_unit_proto_goTypes, - DependencyIndexes: file_envoy_type_v3_ratelimit_unit_proto_depIdxs, - EnumInfos: file_envoy_type_v3_ratelimit_unit_proto_enumTypes, - }.Build() - File_envoy_type_v3_ratelimit_unit_proto = out.File - file_envoy_type_v3_ratelimit_unit_proto_rawDesc = nil - file_envoy_type_v3_ratelimit_unit_proto_goTypes = nil - file_envoy_type_v3_ratelimit_unit_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/v3/ratelimit_unit.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/type/v3/ratelimit_unit.pb.validate.go deleted file mode 100644 index 472396797..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/v3/ratelimit_unit.pb.validate.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/type/v3/ratelimit_unit.proto - -package typev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/v3/semantic_version.pb.go b/vendor/github.com/cilium/proxy/go/envoy/type/v3/semantic_version.pb.go deleted file mode 100644 index a4ccee6d9..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/v3/semantic_version.pb.go +++ /dev/null @@ -1,186 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/type/v3/semantic_version.proto - -package typev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Envoy uses SemVer (https://semver.org/). Major/minor versions indicate -// expected behaviors and APIs, the patch version field is used only -// for security fixes and can be generally ignored. -type SemanticVersion struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - MajorNumber uint32 `protobuf:"varint,1,opt,name=major_number,json=majorNumber,proto3" json:"major_number,omitempty"` - MinorNumber uint32 `protobuf:"varint,2,opt,name=minor_number,json=minorNumber,proto3" json:"minor_number,omitempty"` - Patch uint32 `protobuf:"varint,3,opt,name=patch,proto3" json:"patch,omitempty"` -} - -func (x *SemanticVersion) Reset() { - *x = SemanticVersion{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_v3_semantic_version_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SemanticVersion) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SemanticVersion) ProtoMessage() {} - -func (x *SemanticVersion) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_v3_semantic_version_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SemanticVersion.ProtoReflect.Descriptor instead. -func (*SemanticVersion) Descriptor() ([]byte, []int) { - return file_envoy_type_v3_semantic_version_proto_rawDescGZIP(), []int{0} -} - -func (x *SemanticVersion) GetMajorNumber() uint32 { - if x != nil { - return x.MajorNumber - } - return 0 -} - -func (x *SemanticVersion) GetMinorNumber() uint32 { - if x != nil { - return x.MinorNumber - } - return 0 -} - -func (x *SemanticVersion) GetPatch() uint32 { - if x != nil { - return x.Patch - } - return 0 -} - -var File_envoy_type_v3_semantic_version_proto protoreflect.FileDescriptor - -var file_envoy_type_v3_semantic_version_proto_rawDesc = []byte{ - 0x0a, 0x24, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x2f, - 0x73, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x2e, 0x76, 0x33, 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, - 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x90, 0x01, 0x0a, 0x0f, 0x53, 0x65, 0x6d, 0x61, - 0x6e, 0x74, 0x69, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x6d, - 0x61, 0x6a, 0x6f, 0x72, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x0b, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x21, - 0x0a, 0x0c, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x4e, 0x75, 0x6d, 0x62, 0x65, - 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x3a, 0x21, 0x9a, 0xc5, 0x88, 0x1e, 0x1c, 0x0a, 0x1a, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x53, 0x65, 0x6d, 0x61, 0x6e, - 0x74, 0x69, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x7a, 0x0a, 0x1b, 0x69, 0x6f, - 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, - 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x42, 0x14, 0x53, 0x65, 0x6d, 0x61, 0x6e, - 0x74, 0x69, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, - 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x3b, 0x74, 0x79, 0x70, 0x65, 0x76, 0x33, 0xba, 0x80, - 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_type_v3_semantic_version_proto_rawDescOnce sync.Once - file_envoy_type_v3_semantic_version_proto_rawDescData = file_envoy_type_v3_semantic_version_proto_rawDesc -) - -func file_envoy_type_v3_semantic_version_proto_rawDescGZIP() []byte { - file_envoy_type_v3_semantic_version_proto_rawDescOnce.Do(func() { - file_envoy_type_v3_semantic_version_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_type_v3_semantic_version_proto_rawDescData) - }) - return file_envoy_type_v3_semantic_version_proto_rawDescData -} - -var file_envoy_type_v3_semantic_version_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_type_v3_semantic_version_proto_goTypes = []interface{}{ - (*SemanticVersion)(nil), // 0: envoy.type.v3.SemanticVersion -} -var file_envoy_type_v3_semantic_version_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_envoy_type_v3_semantic_version_proto_init() } -func file_envoy_type_v3_semantic_version_proto_init() { - if File_envoy_type_v3_semantic_version_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_envoy_type_v3_semantic_version_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SemanticVersion); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_type_v3_semantic_version_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_type_v3_semantic_version_proto_goTypes, - DependencyIndexes: file_envoy_type_v3_semantic_version_proto_depIdxs, - MessageInfos: file_envoy_type_v3_semantic_version_proto_msgTypes, - }.Build() - File_envoy_type_v3_semantic_version_proto = out.File - file_envoy_type_v3_semantic_version_proto_rawDesc = nil - file_envoy_type_v3_semantic_version_proto_goTypes = nil - file_envoy_type_v3_semantic_version_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/v3/semantic_version.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/type/v3/semantic_version.pb.validate.go deleted file mode 100644 index e0db1e39d..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/v3/semantic_version.pb.validate.go +++ /dev/null @@ -1,142 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/type/v3/semantic_version.proto - -package typev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on SemanticVersion with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *SemanticVersion) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SemanticVersion with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// SemanticVersionMultiError, or nil if none found. -func (m *SemanticVersion) ValidateAll() error { - return m.validate(true) -} - -func (m *SemanticVersion) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for MajorNumber - - // no validation rules for MinorNumber - - // no validation rules for Patch - - if len(errors) > 0 { - return SemanticVersionMultiError(errors) - } - - return nil -} - -// SemanticVersionMultiError is an error wrapping multiple validation errors -// returned by SemanticVersion.ValidateAll() if the designated constraints -// aren't met. -type SemanticVersionMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SemanticVersionMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m SemanticVersionMultiError) AllErrors() []error { return m } - -// SemanticVersionValidationError is the validation error returned by -// SemanticVersion.Validate if the designated constraints aren't met. -type SemanticVersionValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SemanticVersionValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SemanticVersionValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SemanticVersionValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SemanticVersionValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SemanticVersionValidationError) ErrorName() string { return "SemanticVersionValidationError" } - -// Error satisfies the builtin error interface -func (e SemanticVersionValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSemanticVersion.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SemanticVersionValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SemanticVersionValidationError{} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/v3/token_bucket.pb.go b/vendor/github.com/cilium/proxy/go/envoy/type/v3/token_bucket.pb.go deleted file mode 100644 index 16e93736e..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/v3/token_bucket.pb.go +++ /dev/null @@ -1,209 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v4.23.4 -// source: envoy/type/v3/token_bucket.proto - -package typev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - durationpb "google.golang.org/protobuf/types/known/durationpb" - wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Configures a token bucket, typically used for rate limiting. -type TokenBucket struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The maximum tokens that the bucket can hold. This is also the number of tokens that the bucket - // initially contains. - MaxTokens uint32 `protobuf:"varint,1,opt,name=max_tokens,json=maxTokens,proto3" json:"max_tokens,omitempty"` - // The number of tokens added to the bucket during each fill interval. If not specified, defaults - // to a single token. - TokensPerFill *wrapperspb.UInt32Value `protobuf:"bytes,2,opt,name=tokens_per_fill,json=tokensPerFill,proto3" json:"tokens_per_fill,omitempty"` - // The fill interval that tokens are added to the bucket. During each fill interval - // “tokens_per_fill“ are added to the bucket. The bucket will never contain more than - // “max_tokens“ tokens. - FillInterval *durationpb.Duration `protobuf:"bytes,3,opt,name=fill_interval,json=fillInterval,proto3" json:"fill_interval,omitempty"` -} - -func (x *TokenBucket) Reset() { - *x = TokenBucket{} - if protoimpl.UnsafeEnabled { - mi := &file_envoy_type_v3_token_bucket_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TokenBucket) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TokenBucket) ProtoMessage() {} - -func (x *TokenBucket) ProtoReflect() protoreflect.Message { - mi := &file_envoy_type_v3_token_bucket_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TokenBucket.ProtoReflect.Descriptor instead. -func (*TokenBucket) Descriptor() ([]byte, []int) { - return file_envoy_type_v3_token_bucket_proto_rawDescGZIP(), []int{0} -} - -func (x *TokenBucket) GetMaxTokens() uint32 { - if x != nil { - return x.MaxTokens - } - return 0 -} - -func (x *TokenBucket) GetTokensPerFill() *wrapperspb.UInt32Value { - if x != nil { - return x.TokensPerFill - } - return nil -} - -func (x *TokenBucket) GetFillInterval() *durationpb.Duration { - if x != nil { - return x.FillInterval - } - return nil -} - -var File_envoy_type_v3_token_bucket_proto protoreflect.FileDescriptor - -var file_envoy_type_v3_token_bucket_proto_rawDesc = []byte{ - 0x0a, 0x20, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x2f, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x0d, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, - 0x33, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x21, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xef, 0x01, 0x0a, - 0x0b, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x26, 0x0a, 0x0a, - 0x6d, 0x61, 0x78, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, - 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x20, 0x00, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x54, 0x6f, - 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x4d, 0x0a, 0x0f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x5f, 0x70, - 0x65, 0x72, 0x5f, 0x66, 0x69, 0x6c, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x07, 0xfa, 0x42, 0x04, - 0x2a, 0x02, 0x20, 0x00, 0x52, 0x0d, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x50, 0x65, 0x72, 0x46, - 0x69, 0x6c, 0x6c, 0x12, 0x4a, 0x0a, 0x0d, 0x66, 0x69, 0x6c, 0x6c, 0x5f, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x76, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0a, 0xfa, 0x42, 0x07, 0xaa, 0x01, 0x04, 0x08, 0x01, 0x2a, - 0x00, 0x52, 0x0c, 0x66, 0x69, 0x6c, 0x6c, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x3a, - 0x1d, 0x9a, 0xc5, 0x88, 0x1e, 0x18, 0x0a, 0x16, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x42, 0x76, - 0x0a, 0x1b, 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x42, 0x10, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, - 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, - 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x3b, 0x74, 0x79, 0x70, 0x65, 0x76, 0x33, 0xba, 0x80, - 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_envoy_type_v3_token_bucket_proto_rawDescOnce sync.Once - file_envoy_type_v3_token_bucket_proto_rawDescData = file_envoy_type_v3_token_bucket_proto_rawDesc -) - -func file_envoy_type_v3_token_bucket_proto_rawDescGZIP() []byte { - file_envoy_type_v3_token_bucket_proto_rawDescOnce.Do(func() { - file_envoy_type_v3_token_bucket_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_type_v3_token_bucket_proto_rawDescData) - }) - return file_envoy_type_v3_token_bucket_proto_rawDescData -} - -var file_envoy_type_v3_token_bucket_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_type_v3_token_bucket_proto_goTypes = []interface{}{ - (*TokenBucket)(nil), // 0: envoy.type.v3.TokenBucket - (*wrapperspb.UInt32Value)(nil), // 1: google.protobuf.UInt32Value - (*durationpb.Duration)(nil), // 2: google.protobuf.Duration -} -var file_envoy_type_v3_token_bucket_proto_depIdxs = []int32{ - 1, // 0: envoy.type.v3.TokenBucket.tokens_per_fill:type_name -> google.protobuf.UInt32Value - 2, // 1: envoy.type.v3.TokenBucket.fill_interval:type_name -> google.protobuf.Duration - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_envoy_type_v3_token_bucket_proto_init() } -func file_envoy_type_v3_token_bucket_proto_init() { - if File_envoy_type_v3_token_bucket_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_envoy_type_v3_token_bucket_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TokenBucket); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_envoy_type_v3_token_bucket_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_type_v3_token_bucket_proto_goTypes, - DependencyIndexes: file_envoy_type_v3_token_bucket_proto_depIdxs, - MessageInfos: file_envoy_type_v3_token_bucket_proto_msgTypes, - }.Build() - File_envoy_type_v3_token_bucket_proto = out.File - file_envoy_type_v3_token_bucket_proto_rawDesc = nil - file_envoy_type_v3_token_bucket_proto_goTypes = nil - file_envoy_type_v3_token_bucket_proto_depIdxs = nil -} diff --git a/vendor/github.com/cilium/proxy/go/envoy/type/v3/token_bucket.pb.validate.go b/vendor/github.com/cilium/proxy/go/envoy/type/v3/token_bucket.pb.validate.go deleted file mode 100644 index dbc6448ac..000000000 --- a/vendor/github.com/cilium/proxy/go/envoy/type/v3/token_bucket.pb.validate.go +++ /dev/null @@ -1,202 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/type/v3/token_bucket.proto - -package typev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on TokenBucket with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *TokenBucket) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on TokenBucket with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in TokenBucketMultiError, or -// nil if none found. -func (m *TokenBucket) ValidateAll() error { - return m.validate(true) -} - -func (m *TokenBucket) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetMaxTokens() <= 0 { - err := TokenBucketValidationError{ - field: "MaxTokens", - reason: "value must be greater than 0", - } - if !all { - return err - } - errors = append(errors, err) - } - - if wrapper := m.GetTokensPerFill(); wrapper != nil { - - if wrapper.GetValue() <= 0 { - err := TokenBucketValidationError{ - field: "TokensPerFill", - reason: "value must be greater than 0", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if m.GetFillInterval() == nil { - err := TokenBucketValidationError{ - field: "FillInterval", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if d := m.GetFillInterval(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = TokenBucketValidationError{ - field: "FillInterval", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - gt := time.Duration(0*time.Second + 0*time.Nanosecond) - - if dur <= gt { - err := TokenBucketValidationError{ - field: "FillInterval", - reason: "value must be greater than 0s", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if len(errors) > 0 { - return TokenBucketMultiError(errors) - } - - return nil -} - -// TokenBucketMultiError is an error wrapping multiple validation errors -// returned by TokenBucket.ValidateAll() if the designated constraints aren't met. -type TokenBucketMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m TokenBucketMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m TokenBucketMultiError) AllErrors() []error { return m } - -// TokenBucketValidationError is the validation error returned by -// TokenBucket.Validate if the designated constraints aren't met. -type TokenBucketValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TokenBucketValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TokenBucketValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TokenBucketValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TokenBucketValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TokenBucketValidationError) ErrorName() string { return "TokenBucketValidationError" } - -// Error satisfies the builtin error interface -func (e TokenBucketValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTokenBucket.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TokenBucketValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TokenBucketValidationError{} diff --git a/vendor/github.com/cilium/proxy/pkg/policy/api/kafka/doc.go b/vendor/github.com/cilium/proxy/pkg/policy/api/kafka/doc.go deleted file mode 100644 index d7f4fc0ca..000000000 --- a/vendor/github.com/cilium/proxy/pkg/policy/api/kafka/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// +k8s:openapi-gen=true -// +deepequal-gen=package - -// Package kafka defines the Kafka API of the Cilium network policy interface -// +groupName=policy -package kafka diff --git a/vendor/github.com/cilium/proxy/pkg/policy/api/kafka/kafka.go b/vendor/github.com/cilium/proxy/pkg/policy/api/kafka/kafka.go deleted file mode 100644 index 606701b7d..000000000 --- a/vendor/github.com/cilium/proxy/pkg/policy/api/kafka/kafka.go +++ /dev/null @@ -1,318 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package kafka - -import ( - "fmt" - "math" - "regexp" - "strconv" - "strings" -) - -// PortRule is a list of Kafka protocol constraints. All fields are -// optional, if all fields are empty or missing, the rule will match all -// Kafka messages. -type PortRule struct { - // Role is a case-insensitive string and describes a group of API keys - // necessary to perform certain higher-level Kafka operations such as "produce" - // or "consume". A Role automatically expands into all APIKeys required - // to perform the specified higher-level operation. - // - // The following values are supported: - // - "produce": Allow producing to the topics specified in the rule - // - "consume": Allow consuming from the topics specified in the rule - // - // This field is incompatible with the APIKey field, i.e APIKey and Role - // cannot both be specified in the same rule. - // - // If omitted or empty, and if APIKey is not specified, then all keys are - // allowed. - // - // +kubebuilder:validation:Enum=produce;consume - // +kubebuilder:validation:Optional - Role string `json:"role,omitempty"` - - // APIKey is a case-insensitive string matched against the key of a - // request, e.g. "produce", "fetch", "createtopic", "deletetopic", et al - // Reference: https://kafka.apache.org/protocol#protocol_api_keys - // - // If omitted or empty, and if Role is not specified, then all keys are allowed. - // - // +kubebuilder:validation:Optional - APIKey string `json:"apiKey,omitempty"` - - // APIVersion is the version matched against the api version of the - // Kafka message. If set, it has to be a string representing a positive - // integer. - // - // If omitted or empty, all versions are allowed. - // - // +kubebuilder:validation:Optional - APIVersion string `json:"apiVersion,omitempty"` - - // ClientID is the client identifier as provided in the request. - // - // From Kafka protocol documentation: - // This is a user supplied identifier for the client application. The - // user can use any identifier they like and it will be used when - // logging errors, monitoring aggregates, etc. For example, one might - // want to monitor not just the requests per second overall, but the - // number coming from each client application (each of which could - // reside on multiple servers). This id acts as a logical grouping - // across all requests from a particular client. - // - // If omitted or empty, all client identifiers are allowed. - // - // +kubebuilder:validation:Optional - ClientID string `json:"clientID,omitempty"` - - // Topic is the topic name contained in the message. If a Kafka request - // contains multiple topics, then all topics must be allowed or the - // message will be rejected. - // - // This constraint is ignored if the matched request message type - // doesn't contain any topic. Maximum size of Topic can be 249 - // characters as per recent Kafka spec and allowed characters are - // a-z, A-Z, 0-9, -, . and _. - // - // Older Kafka versions had longer topic lengths of 255, but in Kafka 0.10 - // version the length was changed from 255 to 249. For compatibility - // reasons we are using 255. - // - // If omitted or empty, all topics are allowed. - // - // +kubebuilder:validation:MaxLength=255 - // +kubebuilder:validation:Optional - Topic string `json:"topic,omitempty"` -} - -// List of Kafka apiKeys which have a topic in their -// request -const ( - ProduceKey = 0 - FetchKey = 1 - OffsetsKey = 2 - MetadataKey = 3 - LeaderAndIsr = 4 - StopReplica = 5 - UpdateMetadata = 6 - OffsetCommitKey = 8 - OffsetFetchKey = 9 - FindCoordinatorKey = 10 - JoinGroupKey = 11 - CreateTopicsKey = 19 - DeleteTopicsKey = 20 - DeleteRecordsKey = 21 - OffsetForLeaderEpochKey = 23 - AddPartitionsToTxnKey = 24 - WriteTxnMarkersKey = 27 - TxnOffsetCommitKey = 28 - AlterReplicaLogDirsKey = 34 - DescribeLogDirsKey = 35 - CreatePartitionsKey = 37 -) - -// List of Kafka apiKey which are not associated with -// any topic -const ( - HeartbeatKey = 12 - LeaveGroupKey = 13 - SyncgroupKey = 14 - APIVersionsKey = 18 -) - -// List of Kafka Roles -const ( - ProduceRole = "produce" - ConsumeRole = "consume" -) - -// APIKeyMap is the map of all allowed kafka API keys -// with the key values. -// Reference: https://kafka.apache.org/protocol#protocol_api_keys -var APIKeyMap = map[string]int16{ - "produce": 0, /* Produce */ - "fetch": 1, /* Fetch */ - "offsets": 2, /* Offsets */ - "metadata": 3, /* Metadata */ - "leaderandisr": 4, /* LeaderAndIsr */ - "stopreplica": 5, /* StopReplica */ - "updatemetadata": 6, /* UpdateMetadata */ - "controlledshutdown": 7, /* ControlledShutdown */ - "offsetcommit": 8, /* OffsetCommit */ - "offsetfetch": 9, /* OffsetFetch */ - "findcoordinator": 10, /* FindCoordinator */ - "joingroup": 11, /* JoinGroup */ - "heartbeat": 12, /* Heartbeat */ - "leavegroup": 13, /* LeaveGroup */ - "syncgroup": 14, /* SyncGroup */ - "describegroups": 15, /* DescribeGroups */ - "listgroups": 16, /* ListGroups */ - "saslhandshake": 17, /* SaslHandshake */ - "apiversions": 18, /* ApiVersions */ - "createtopics": 19, /* CreateTopics */ - "deletetopics": 20, /* DeleteTopics */ - "deleterecords": 21, /* DeleteRecords */ - "initproducerid": 22, /* InitProducerId */ - "offsetforleaderepoch": 23, /* OffsetForLeaderEpoch */ - "addpartitionstotxn": 24, /* AddPartitionsToTxn */ - "addoffsetstotxn": 25, /* AddOffsetsToTxn */ - "endtxn": 26, /* EndTxn */ - "writetxnmarkers": 27, /* WriteTxnMarkers */ - "txnoffsetcommit": 28, /* TxnOffsetCommit */ - "describeacls": 29, /* DescribeAcls */ - "createacls": 30, /* CreateAcls */ - "deleteacls": 31, /* DeleteAcls */ - "describeconfigs": 32, /* DescribeConfigs */ - "alterconfigs": 33, /* AlterConfigs */ -} - -// ReverseApiKeyMap is the map of all allowed kafka API keys -// with the key values. -// Reference: https://kafka.apache.org/protocol#protocol_api_keys -var ReverseAPIKeyMap = map[int16]string{ - 0: "produce", /* Produce */ - 1: "fetch", /* Fetch */ - 2: "offsets", /* Offsets */ - 3: "metadata", /* Metadata */ - 4: "leaderandisr", /* LeaderAndIsr */ - 5: "stopreplica", /* StopReplica */ - 6: "updatemetadata", /* UpdateMetadata */ - 7: "controlledshutdown", /* ControlledShutdown */ - 8: "offsetcommit", /* OffsetCommit */ - 9: "offsetfetch", /* OffsetFetch */ - 10: "findcoordinator", /* FindCoordinator */ - 11: "joingroup", /* JoinGroup */ - 12: "heartbeat", /* Heartbeat */ - 13: "leavegroup", /* LeaveGroup */ - 14: "syncgroup", /* SyncGroup */ - 15: "describegroups", /* DescribeGroups */ - 16: "listgroups", /* ListGroups */ - 17: "saslhandshake", /* SaslHandshake */ - 18: "apiversions", /* ApiVersions */ - 19: "createtopics", /* CreateTopics */ - 20: "deletetopics", /* DeleteTopics */ - 21: "deleterecords", /* DeleteRecords */ - 22: "initproducerid", /* InitProducerId */ - 23: "offsetforleaderepoch", /* OffsetForLeaderEpoch */ - 24: "addpartitionstotxn", /* AddPartitionsToTxn */ - 25: "addoffsetstotxn", /* AddOffsetsToTxn */ - 26: "endtxn", /* EndTxn */ - 27: "writetxnmarkers", /* WriteTxnMarkers */ - 28: "txnoffsetcommit", /* TxnOffsetCommit */ - 29: "describeacls", /* DescribeAcls */ - 30: "createacls", /* CreateAcls */ - 31: "deleteacls", /* DeleteAcls */ - 32: "describeconfigs", /* DescribeConfigs */ - 33: "alterconfigs", /* AlterConfigs */ -} - -func ApiKeyToString(apiKey int16) string { - if key, ok := ReverseAPIKeyMap[apiKey]; ok { - return key - } - return fmt.Sprintf("%d", apiKey) -} - -// MaxTopicLen is the maximum character len of a topic. -// Older Kafka versions had longer topic lengths of 255, in Kafka 0.10 version -// the length was changed from 255 to 249. For compatibility reasons we are -// using 255 -const ( - MaxTopicLen = 255 -) - -// TopicValidChar is a one-time regex generation of all allowed characters -// in kafka topic name. -var TopicValidChar = regexp.MustCompile(`^[a-zA-Z0-9\\._\\-]+$`) - -// Sanitize sanitizes Kafka rules -// TODO we need to add support to check -// wildcard and prefix/suffix later on. -func (kr *PortRule) Sanitize() error { - if (len(kr.APIKey) > 0) && (len(kr.Role) > 0) { - return fmt.Errorf("cannot set both Role %q and APIKey %q together", kr.Role, kr.APIKey) - } - - if len(kr.APIKey) > 0 { - if _, ok := APIKeyMap[strings.ToLower(kr.APIKey)]; !ok { - return fmt.Errorf("invalid Kafka APIKey %q", kr.APIKey) - } - } - - if len(kr.Role) > 0 { - switch strings.ToLower(kr.Role) { - default: - return fmt.Errorf("invalid Kafka Role %q", kr.Role) - case ProduceRole: - case ConsumeRole: - } - } - - if len(kr.APIVersion) > 0 { - n, err := strconv.ParseInt(kr.APIVersion, 10, 16) - if err != nil || n < 0 || n > math.MaxInt16 { - return fmt.Errorf("invalid Kafka APIVersion %q", kr.APIVersion) - } - } - - if len(kr.Topic) > 0 { - if len(kr.Topic) > MaxTopicLen { - return fmt.Errorf("kafka topic exceeds maximum len of %d", MaxTopicLen) - } - if TopicValidChar.MatchString(kr.Topic) == false { - return fmt.Errorf("invalid Kafka Topic name %q", kr.Topic) - } - } - return nil -} - -// GetAPIVersion() returns the numeric API version for the PortRule -func (kr *PortRule) GetAPIVersion() int32 { - if kr.APIVersion != "" { - n, err := strconv.ParseInt(kr.APIVersion, 10, 16) - if err != nil || n < 0 || n > math.MaxInt16 { - panic(fmt.Sprintf("Unsanitized Kafka PortRule: %v", kr)) - } - return int32(n) - } - return -1 // any version is allowed -} - -// GetAPIKeys() returns a slice of numeric apikeys for the PortRule -func (kr *PortRule) GetAPIKeys() []int32 { - // Expand the kr.apiKeyInt array based on the Role. - // For produce role, we need to add mandatory apiKeys produce, metadata and - // apiversions. While for consume, we need to add mandatory apiKeys like - // fetch, offsets, offsetcommit, offsetfetch, apiversions, metadata, - // findcoordinator, joingroup, heartbeat, - // leavegroup and syncgroup. - switch strings.ToLower(kr.Role) { - case ProduceRole: - return []int32{int32(ProduceKey), int32(MetadataKey), int32(APIVersionsKey)} - case ConsumeRole: - return []int32{int32(FetchKey), int32(OffsetsKey), int32(MetadataKey), - int32(OffsetCommitKey), int32(OffsetFetchKey), int32(FindCoordinatorKey), - int32(JoinGroupKey), int32(HeartbeatKey), int32(LeaveGroupKey), int32(SyncgroupKey), int32(APIVersionsKey)} - default: - if kr.APIKey != "" { - if apiKey, ok := APIKeyMap[strings.ToLower(kr.APIKey)]; ok { - return []int32{int32(apiKey)} - } - } - } - return nil -} - -// Exists returns true if the Kafka rule already exists in the list of rules -func (k *PortRule) Exists(rules []PortRule) bool { - for _, existingRule := range rules { - if *k == existingRule { - return true - } - } - - return false -} diff --git a/vendor/github.com/cilium/proxy/pkg/policy/api/kafka/zz_generated.deepequal.go b/vendor/github.com/cilium/proxy/pkg/policy/api/kafka/zz_generated.deepequal.go deleted file mode 100644 index 3d04ee332..000000000 --- a/vendor/github.com/cilium/proxy/pkg/policy/api/kafka/zz_generated.deepequal.go +++ /dev/null @@ -1,35 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// Code generated by deepequal-gen. DO NOT EDIT. - -package kafka - -// DeepEqual is an autogenerated deepequal function, deeply comparing the -// receiver with other. in must be non-nil. -func (in *PortRule) DeepEqual(other *PortRule) bool { - if other == nil { - return false - } - - if in.Role != other.Role { - return false - } - if in.APIKey != other.APIKey { - return false - } - if in.APIVersion != other.APIVersion { - return false - } - if in.ClientID != other.ClientID { - return false - } - if in.Topic != other.Topic { - return false - } - - return true -} diff --git a/vendor/github.com/cilium/stream/LICENSE b/vendor/github.com/cilium/stream/LICENSE deleted file mode 100644 index a2e486a80..000000000 --- a/vendor/github.com/cilium/stream/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - 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} Authors of Cilium - - 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. - diff --git a/vendor/github.com/cilium/stream/Makefile b/vendor/github.com/cilium/stream/Makefile deleted file mode 100644 index df2ee74e7..000000000 --- a/vendor/github.com/cilium/stream/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -.PHONY: all build test test-race bench - -all: build test test-race bench - -build: - go build ./... - -test: - go test ./... -cover - -test-race: - go test -race ./... - -bench: - go test ./... -bench . -test.run xxx diff --git a/vendor/github.com/cilium/stream/README.md b/vendor/github.com/cilium/stream/README.md deleted file mode 100644 index 6e9a0a032..000000000 --- a/vendor/github.com/cilium/stream/README.md +++ /dev/null @@ -1,164 +0,0 @@ -# Reactive streams for Go - -A reactive streams library for Go in the spirit of Reactive Extensions (Rx) implemented -with generic functions. The library provides a rich set of utilities for wiring -event-passing in a complex application. Included are, for example, operators for -pubsub/fanning out (Multicast), for transforming (Map, Reduce), for rate limiting (Throttle) -and for buffering/coalescing (Buffer). New operators are easy to add as they are normal -top-level functions that take/return the `Observable` type. - -## The Observable - -The stream package provides the Observable interface for observing a stream of -values that can be cancelled and can be either infinite or finite in length. - -The Observable interface is defined as: - -```go -type Observable[T any] interface { - Observe(ctx context.Context, next func(T), complete func(error)) -} -``` - -The `next` function is called for each element in the stream. When the stream -is terminated or cancelled (via `ctx`) `next` will be called for remaining -elements and then `complete` after which neither function is invoked. - -An Observable must adhere to the following rules: - -* Observe() call must not block, e.g. be asynchronous by forking a goroutine. -* `next` must be called sequentially and never in parallel (previous call must complete - before `next` can be called again). -* `complete` can be called at most once. `complete` must not be called in parallel with - `next`. After `complete` is called neither `next` nor `complete` can be called again. -* if `ctx` is completed, calls to `next` should stop in short amount of time and `complete` - must be called with `ctx.Err()`. - -## Operators - -The functions that operate on `Observable[T]` are divided into: - -* [sources](sources.go) that create Observables -* [operators](operators.go) that transform Observables -* [sinks](sinks.go) that consume the Observable - -Since Go's generics does not yet allow new type parameters in methods, all of these -are implemented as top-level functions rather than methods in the Observable interface. -This also makes it easy to add new operators as they're just normal functions. - -## Creating an observable by hand - -As a first example, we'll implement a simple source `Observable` that emits a single integer: - -```go - -type singleIntegerObservable int - -func (num singleIntegerObservable) Observe(ctx context.Context, next func(int), complete func(error)) { - go func() { - next(int(num)) - complete(nil) - }() -} -``` - -We can now try it out with the `Map` operator: - -```go -func main() { - var ten stream.Observable[int] = singleIntegerObservable(10) - - twenty := stream.Map(ten, func(x int) int) { return x * 2 }) - - twenty.Observe( - context.Background(), - func(x int) { - fmt.Printf("%d\n", x) - }, - func(err error) { - fmt.Printf("complete: %s\n", err) - }, - ) -} -``` - -Instead of defining a new type every time we want to implement `Observe`, we can use the `FuncObservable` -helper: - -```go -func singleInt(x int) stream.Observable[int] { - return stream.FuncObservable( - func(ctx context.Context, next func(int), complete func(error)) error { - next(x) - complete(nil) - }, - ) -} -``` - -## Tour of the included operators - -[Sources](sources.go) provide different ways of creating `Observable`s without -having to implement `Observe`: - -```go -Just(10) // emits 10 and completes -Error(errors.New("oh no")) // completes with error -Empty() // completes with nil error -FromSlice([]int{1,2,3}) // emits 1,2,3 and completes -FromChannel(in) // emits items from the given channel -Range(0,3) // emits 0,1,2 and completes - - -// Multicast creates an observable that emits items to all observers. -src, next, complete := Multicast[int]() - -ch1 := ToChannel(ctx, src) -ch2 := ToChannel(ctx, src) -next(1) -<-ch1 // 1 -<-ch2 // 1 -``` - -[Operators](operators.go) transform streams in different ways: -```go -// Map[A, B any](src Observable[A], apply func(A) B) Observable[B] -Map(src, apply) // applies function 'apply' to each item. - -// Filter[T any](src Observable[T], filter func(T) bool) Observable[T] -Filter(src, filter) // applies function 'filter' to each item. If 'filter' returns false the - // item is dropped. - -// Reduce[T, Result any](src Observable[T], init Result, reduce func(T, Result) Result) Observable[Result] -// Applies function 'reduce' to each item to "reduce" the stream into a single value. -Reduce(Range(0, 3), 0, func(x, result int) int { return x + result }) // 0 + 1 + 2 = 3 - -// ToMulticast[T any](src Observable[T], opts ...MulticastOpt) (mcast Observable[T], connect func(context.Context)) -// Converts an observable into a multicast observable -src, connect := ToMulticast(Range(1,5)) -ch1 := ToChannel(ctx, src) -ch2 := ToChannel(ctx, src) -connect(ctx) // start observing the parent observable -<-ch1 // 1 -<-ch2 // 1 -``` - -[Sinks](stream/sinks.go) consume streams: -```go -// First[T any](ctx context.Context, src Observable[T]) (item T, err error) -// Takes the first item from the observable and then cancels it. -item, err := First(ctx, src) - -// ToSlice[T any](ctx context.Context, src Observable[T]) (items []T, err error) -// Converts the observable into a slice. -items, err := ToSlice(ctx, src) - -// ToChannel[T any](ctx context.Context, src Observable[T], opts ...ToChannelOpt) <-chan T -// Converts the observable into a channel. -items := ToChannel(ctx, src) - -// Discard[T any](ctx context.Context, src Observable[T]) error -// Consumes the observable by discarding the elements. -Discard(ctx, src) -``` - diff --git a/vendor/github.com/cilium/stream/observable.go b/vendor/github.com/cilium/stream/observable.go deleted file mode 100644 index 22e96af95..000000000 --- a/vendor/github.com/cilium/stream/observable.go +++ /dev/null @@ -1,59 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -// The stream package provides utilities for working with observable streams. -// Any type that implements the Observable interface can be transformed and -// consumed with these utilities. -package stream - -import "context" - -// Observable defines the Observe method for observing a stream of values. -// -// Also see https://reactivex.io/documentation/observable.html for in-depth -// description of observables. -// -// For interactive diagrams see https://rxmarbles.com/. -type Observable[T any] interface { - // Observe a stream of values as long as the given context is valid. - // 'next' is called for each item, and finally 'complete' is called - // when the stream is complete, or an error has occurred. - // - // Observable implementations are allowed to call 'next' and 'complete' - // from any goroutine, but never concurrently. - Observe(ctx context.Context, next func(T), complete func(error)) -} - -// FuncObservable implements the Observable interface with a function. -// -// This provides a convenient way of creating new observables without having -// to introduce a new type: -// -// var Ones Observable[int] = -// FuncObservable[int]( -// func(ctx context.Context, next func(int), complete func(error)) { -// go func() { -// defer complete(nil) -// for ctx.Err() == nil { -// next(1) -// } -// }() -// }) -// -// versus with a new type: -// -// type onesObservable struct {} -// -// func (o onesObservable) Observe(ctx context.Context, next func(int), complete func(error)) { -// go func() { -// defer complete(nil) -// for ctx.Err() == nil { -// next(1) -// } -// }() -// } -type FuncObservable[T any] func(context.Context, func(T), func(error)) - -func (f FuncObservable[T]) Observe(ctx context.Context, next func(T), complete func(error)) { - f(ctx, next, complete) -} diff --git a/vendor/github.com/cilium/stream/operators.go b/vendor/github.com/cilium/stream/operators.go deleted file mode 100644 index 6823f281a..000000000 --- a/vendor/github.com/cilium/stream/operators.go +++ /dev/null @@ -1,383 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package stream - -import ( - "context" - "time" - - "golang.org/x/time/rate" -) - -// -// Operators transform the observable stream. -// - -// Map applies a function onto values of an observable and emits the resulting values. -// -// Map(Range(1,4), func(x int) int { return x * 2}) -// => [2,4,6] -func Map[A, B any](src Observable[A], apply func(A) B) Observable[B] { - return FuncObservable[B]( - func(ctx context.Context, next func(B), complete func(error)) { - src.Observe( - ctx, - func(a A) { next(apply(a)) }, - complete) - }) -} - -// Filter only emits the values for which the provided predicate returns true. -// -// Filter(Range(1,4), func(x int) int { return x%2 == 0 }) -// => [2] -func Filter[T any](src Observable[T], pred func(T) bool) Observable[T] { - return FuncObservable[T]( - func(ctx context.Context, next func(T), complete func(error)) { - src.Observe( - ctx, - func(x T) { - if pred(x) { - next(x) - } - }, - complete) - }) -} - -// Reduce takes an initial state, and a function 'reduce' that is called on each element -// along with a state and returns an observable with a single item: the state produced -// by the last call to 'reduce'. -// -// Reduce(Range(1,4), 0, func(sum, item int) int { return sum + item }) -// => [(0+1+2+3)] => [6] -func Reduce[Item, Result any](src Observable[Item], init Result, reduce func(Result, Item) Result) Observable[Result] { - result := init - return FuncObservable[Result]( - func(ctx context.Context, next func(Result), complete func(error)) { - src.Observe( - ctx, - func(x Item) { - result = reduce(result, x) - }, - func(err error) { - if err == nil { - next(result) - } - complete(err) - }) - }) -} - -// Concat takes one or more observable of the same type and emits the items from each of -// them in order. -func Concat[T any](srcs ...Observable[T]) Observable[T] { - return FuncObservable[T]( - func(ctx context.Context, next func(T), complete func(error)) { - go func() { - for _, src := range srcs { - errs := make(chan error, 1) - src.Observe( - ctx, - next, - func(err error) { - if err != nil { - errs <- err - } - close(errs) - }, - ) - if err, ok := <-errs; ok { - complete(err) - return - } - } - complete(nil) - }() - }) -} - -// FlatMap applies a function that returns an observable of Bs to the source observable of As. -// The observable from the 'apply' function is flattened to produce a flat stream of Bs. -func FlatMap[A, B any](src Observable[A], apply func(A) Observable[B]) Observable[B] { - return FuncObservable[B]( - func(ctx context.Context, next func(B), complete func(error)) { - ctx, cancel := context.WithCancel(ctx) - innerErrs := make(chan error, 1) - src.Observe( - ctx, - func(a A) { - done := make(chan struct{}) - apply(a).Observe( - ctx, - next, - func(err error) { - if err != nil { - select { - case innerErrs <- err: - default: - } - cancel() - } - close(done) - }, - ) - <-done - }, - func(err error) { - defer close(innerErrs) - select { - case innerErr := <-innerErrs: - complete(innerErr) - default: - complete(err) - } - }, - ) - }) -} - -// Distinct skips adjacent equal values. -// -// Distinct(FromSlice([]int{1,1,2,2,3}) -// => [1,2,3] -func Distinct[T comparable](src Observable[T]) Observable[T] { - var prev T - first := true - return Filter(src, func(item T) bool { - if first { - first = false - prev = item - return true - } - eq := prev == item - prev = item - return !eq - }) -} - -// RetryFunc decides whether the processing should be retried given the error -type RetryFunc func(err error) bool - -// Retry resubscribes to the observable if it completes with an error. -func Retry[T any](src Observable[T], shouldRetry RetryFunc) Observable[T] { - return FuncObservable[T]( - func(ctx context.Context, next func(T), complete func(error)) { - var observe func() - observe = func() { - src.Observe( - ctx, - next, - func(err error) { - if err != nil && shouldRetry(err) { - observe() - } else { - complete(err) - } - }) - } - observe() - }) -} - -// AlwaysRetry always asks for a retry regardless of the error. -func AlwaysRetry(err error) bool { - return true -} - -// BackoffRetry retries with an exponential backoff. -func BackoffRetry(shouldRetry RetryFunc, minBackoff, maxBackoff time.Duration) RetryFunc { - backoff := minBackoff - return func(err error) bool { - time.Sleep(backoff) - backoff *= 2 - if backoff > maxBackoff { - backoff = maxBackoff - } - return shouldRetry(err) - } - -} - -// LimitRetries limits the number of retries with the given retry method. -// e.g. LimitRetries(BackoffRetry(time.Millisecond, time.Second), 5) -func LimitRetries(shouldRetry RetryFunc, numRetries int) RetryFunc { - return func(err error) bool { - if numRetries <= 0 { - return false - } - numRetries-- - return shouldRetry(err) - } -} - -// ToMulticast makes 'src' a multicast observable, e.g. each observer will observe -// the same sequence. Useful for fanning out items to multiple observers from a source -// that is consumed by the act of observing. -// -// mcast, connect := ToMulticast(FromChannel(values)) -// a := ToSlice(mcast) -// b := ToSlice(mcast) -// connect(ctx) // start! -// => a == b -func ToMulticast[T any](src Observable[T], opts ...MulticastOpt) (mcast Observable[T], connect func(context.Context)) { - mcast, next, complete := Multicast[T](opts...) - connect = func(ctx context.Context) { - src.Observe(ctx, next, complete) - } - return mcast, connect -} - -// Throttle limits the rate at which items are emitted. -func Throttle[T any](src Observable[T], ratePerSecond float64, burst int) Observable[T] { - return FuncObservable[T]( - func(ctx context.Context, next func(T), complete func(error)) { - limiter := rate.NewLimiter(rate.Limit(ratePerSecond), burst) - var limiterErr error - subCtx, cancel := context.WithCancel(ctx) - src.Observe( - subCtx, - func(item T) { - limiterErr = limiter.Wait(ctx) - if limiterErr != nil { - cancel() - return - } - next(item) - }, - func(err error) { - if limiterErr != nil { - complete(limiterErr) - } else { - complete(err) - } - - }, - ) - }) -} - -// Debounce emits an item only after the specified duration has lapsed since -// the previous item was emitted. Only the latest item is emitted. -// -// In: a b c d e |-> -// Out: a d e |-> -func Debounce[T any](src Observable[T], duration time.Duration) Observable[T] { - return FuncObservable[T]( - func(ctx context.Context, next func(T), complete func(error)) { - errs := make(chan error, 1) - items := ToChannel(ctx, src, WithErrorChan(errs)) - go func() { - defer close(errs) - - timer := time.NewTimer(duration) - defer timer.Stop() - - timerElapsed := true // Do not delay the first item. - var latest *T - - for { - select { - case err := <-errs: - complete(err) - return - - case item, ok := <-items: - if !ok { - items = nil - latest = nil - continue - } - - if timerElapsed { - next(item) - timerElapsed = false - latest = nil - timer.Reset(duration) - } else { - latest = &item - } - - case <-timer.C: - if latest != nil { - next(*latest) - latest = nil - timer.Reset(duration) - } else { - timerElapsed = true - } - } - } - }() - }) -} - -// Buffer collects items into a buffer using the given buffering function and -// emits the buffer when 'waitTime' has elapsed. Buffer does not emit empty -// buffers. -// -// In: a b c |-> -// Out: [a,b] [c] |-> -func Buffer[Buf any, T any]( - src Observable[T], - bufferSize int, - waitTime time.Duration, - bufferItem func(Buf, T) Buf) Observable[Buf] { - - return FuncObservable[Buf]( - func(ctx context.Context, next func(Buf), complete func(error)) { - items := make(chan T, bufferSize) - errs := make(chan error, 1) - src.Observe( - ctx, - func(item T) { - items <- item - }, - func(err error) { - close(items) - errs <- err - close(errs) - }) - go func() { - ticker := time.NewTicker(waitTime) - defer ticker.Stop() - - var ( - emptyBuf Buf - buf Buf - ) - n := 0 - loop: - for { - select { - case <-ticker.C: - if n > 0 { - next(buf) - buf = emptyBuf - n = 0 - } - - case item, ok := <-items: - if !ok { - break loop - } - buf = bufferItem(buf, item) - n++ - if n >= bufferSize { - next(buf) - buf = emptyBuf - n = 0 - } - } - } - - if n > 0 { - next(buf) - } - complete(<-errs) - }() - - }) - -} diff --git a/vendor/github.com/cilium/stream/sinks.go b/vendor/github.com/cilium/stream/sinks.go deleted file mode 100644 index 23c5ee227..000000000 --- a/vendor/github.com/cilium/stream/sinks.go +++ /dev/null @@ -1,165 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package stream - -import ( - "context" - "io" - "sync" - "sync/atomic" -) - -// -// Sinks: operators that consume the observable to produce a value. -// - -// First returns the first item from 'src' observable and then cancels -// the subscription. Blocks until first item is observed or the stream -// is completed. If the observable completes without emitting items -// then io.EOF error is returned. -func First[T any](ctx context.Context, src Observable[T]) (item T, err error) { - subCtx, cancel := context.WithCancel(ctx) - var taken atomic.Bool - errs := make(chan error) - src.Observe(subCtx, - func(x T) { - if !taken.CompareAndSwap(false, true) { - return - } - item = x - cancel() - }, - func(err error) { - errs <- err - close(errs) - }) - - err = <-errs - - if taken.Load() { - // We got the item, ignore any error. - err = nil - } else if err == nil { - // No error and no item => EOF - err = io.EOF - } - - return -} - -// Last returns the last item from 'src' observable. Blocks until -// the stream has been completed. If no items are observed then -// io.EOF error is returned. -func Last[T any](ctx context.Context, src Observable[T]) (item T, err error) { - errs := make(chan error) - var taken atomic.Bool - src.Observe( - ctx, - func(x T) { - item = x - taken.Store(true) - }, - func(err error) { - errs <- err - close(errs) - }) - - err = <-errs - if taken.Load() { - // We got the item, ignore any error. - err = nil - } else if err == nil { - // No error and no item => EOF - err = io.EOF - } - return item, err -} - -// ToSlice converts an Observable into a slice. -// -// ToSlice(ctx, Range(1,4)) -// => ([]int{1,2,3}, nil) -func ToSlice[T any](ctx context.Context, src Observable[T]) (items []T, err error) { - errs := make(chan error) - items = make([]T, 0) - src.Observe( - ctx, - func(item T) { - items = append(items, item) - }, - func(err error) { - errs <- err - close(errs) - }) - return items, <-errs -} - -type toChannelOpts struct { - bufferSize int - errorChan chan error -} - -type ToChannelOpt func(*toChannelOpts) - -// WithBufferSize sets the buffer size of the channel returned by ToChannel. -func WithBufferSize(n int) ToChannelOpt { - return func(o *toChannelOpts) { - o.bufferSize = n - } -} - -// WithErrorChan asks ToChannel to send completion error to the provided channel. -func WithErrorChan(errCh chan error) ToChannelOpt { - return func(o *toChannelOpts) { - o.errorChan = errCh - } -} - -// ToChannel converts an observable into a channel. -// When the provided context is cancelled the underlying subscription is cancelled -// and the channel is closed. To receive completion errors use [WithErrorChan]. -// -// items <- ToChannel(ctx, Range(1,4)) -// a := <- items -// b := <- items -// c := <- items -// _, ok := <- items -// => a=1, b=2, c=3, ok=false -func ToChannel[T any](ctx context.Context, src Observable[T], opts ...ToChannelOpt) <-chan T { - var o toChannelOpts - for _, opt := range opts { - opt(&o) - } - items := make(chan T, o.bufferSize) - src.Observe( - ctx, - func(item T) { items <- item }, - func(err error) { - close(items) - if o.errorChan != nil { - o.errorChan <- err - } - }) - return items -} - -// Discard discards all items from 'src'. -func Discard[T any](ctx context.Context, src Observable[T]) { - src.Observe(ctx, - func(item T) {}, - func(err error) {}) -} - -// ObserveWithWaitGroup is like Observe(), but adds to a WaitGroup and calls -// Done() when complete. -func ObserveWithWaitGroup[T any](ctx context.Context, wg *sync.WaitGroup, src Observable[T], next func(T), complete func(error)) { - wg.Add(1) - src.Observe( - ctx, - next, - func(err error) { - complete(err) - wg.Done() - }) -} diff --git a/vendor/github.com/cilium/stream/sources.go b/vendor/github.com/cilium/stream/sources.go deleted file mode 100644 index 004532fd2..000000000 --- a/vendor/github.com/cilium/stream/sources.go +++ /dev/null @@ -1,262 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Authors of Cilium - -package stream - -import ( - "context" - "sync" -) - -// Just creates an observable that emits a single item and completes. -// -// xs, err := ToSlice(ctx, Just(1)) -// => xs == []int{1}, err == nil -func Just[T any](item T) Observable[T] { - return FuncObservable[T]( - func(ctx context.Context, next func(T), complete func(error)) { - go func() { - if err := ctx.Err(); err != nil { - complete(err) - } else { - next(item) - complete(nil) - } - }() - }) -} - -// Stuck creates an observable that never emits anything and -// just waits for the context to be cancelled. -// Mainly meant for testing. -func Stuck[T any]() Observable[T] { - return FuncObservable[T]( - func(ctx context.Context, next func(T), complete func(error)) { - go func() { - <-ctx.Done() - complete(ctx.Err()) - }() - }) -} - -// Error creates an observable that fails immediately with given error. -// -// failErr = errors.New("fail") -// xs, err := ToSlice(ctx, Error[int](failErr)) -// => xs == []int{}, err == failErr -func Error[T any](err error) Observable[T] { - return FuncObservable[T]( - func(ctx context.Context, next func(T), complete func(error)) { - go complete(err) - }) -} - -// Empty creates an "empty" observable that completes immediately. -// -// xs, err := ToSlice(Empty[int]()) -// => xs == []int{}, err == nil -func Empty[T any]() Observable[T] { - return Error[T](nil) -} - -// FromSlice converts a slice into an Observable. -// -// ToSlice(ctx, FromSlice([]int{1,2,3}) -// => []int{1,2,3} -func FromSlice[T any](items []T) Observable[T] { - // Emit items in chunks to reduce overhead of mutex in ctx.Err(). - const chunkSize = 64 - return FuncObservable[T]( - func(ctx context.Context, next func(T), complete func(error)) { - go func() { - for chunk := 0; chunk < len(items); chunk += chunkSize { - if err := ctx.Err(); err != nil { - complete(err) - return - } - for i := chunk; i < len(items) && i < chunk+chunkSize; i++ { - next(items[i]) - } - } - complete(nil) - }() - }) -} - -// FromChannel creates an observable from a channel. The channel is consumed -// by the first observer. -// -// values := make(chan int) -// go func() { -// values <- 1 -// values <- 2 -// values <- 3 -// close(values) -// }() -// obs := FromChannel(values) -// xs, err := ToSlice(ctx, obs) -// => xs == []int{1,2,3}, err == nil -// -// xs, err = ToSlice(ctx, obs) -// => xs == []int{}, err == nil -func FromChannel[T any](in <-chan T) Observable[T] { - return FuncObservable[T]( - func(ctx context.Context, next func(T), complete func(error)) { - go func() { - done := ctx.Done() - for { - select { - case <-done: - complete(ctx.Err()) - return - case v, ok := <-in: - if !ok { - complete(nil) - return - } - next(v) - } - } - }() - }) -} - -// Range creates an observable that emits integers in range from...to-1. -// -// ToSlice(ctx, Range(1,2,3)) => []int{1,2,3} -func Range(from, to int) Observable[int] { - return FuncObservable[int]( - func(ctx context.Context, next func(int), complete func(error)) { - go func() { - for i := from; i < to; i++ { - if ctx.Err() != nil { - break - } - next(i) - } - complete(ctx.Err()) - }() - }) -} - -type mcastSubscriber[T any] struct { - next func(T) - complete func() -} - -type MulticastOpt func(o *mcastOpts) - -type mcastOpts struct { - emitLatest bool -} - -func (o mcastOpts) apply(opts []MulticastOpt) mcastOpts { - for _, opt := range opts { - opt(&o) - } - return o -} - -// Multicast options -var ( - // Emit the latest seen item when subscribing. - EmitLatest = func(o *mcastOpts) { o.emitLatest = true } -) - -// Multicast creates an observable that "multicasts" the emitted items to all observers. -// -// mcast, next, complete := Multicast[int]() -// next(1) // no observers, none receives this -// sub1 := ToChannel(ctx, mcast, WithBufferSize(10)) -// sub2 := ToChannel(ctx, mcast, WithBufferSize(10)) -// next(2) -// next(3) -// complete(nil) -// => sub1 == sub2 == [2,3] -// -// mcast, next, complete = Multicast[int](EmitLatest) -// next(1) -// next(2) // "EmitLatest" tells Multicast to keep this -// x, err := First(ctx, mcast) -// => x == 2, err == nil -func Multicast[T any](opts ...MulticastOpt) (mcast Observable[T], next func(T), complete func(error)) { - var ( - mu sync.Mutex - subId int - subs = make(map[int]mcastSubscriber[T]) - latestValue T - completed bool - completeErr error - haveLatest bool - opt = mcastOpts{}.apply(opts) - ) - - next = func(item T) { - mu.Lock() - defer mu.Unlock() - if completed { - return - } - if opt.emitLatest { - latestValue = item - haveLatest = true - } - for _, sub := range subs { - sub.next(item) - } - } - - complete = func(err error) { - mu.Lock() - defer mu.Unlock() - completed = true - completeErr = err - for _, sub := range subs { - sub.complete() - } - subs = nil - } - - mcast = FuncObservable[T]( - func(ctx context.Context, subNext func(T), subComplete func(error)) { - mu.Lock() - if completed { - mu.Unlock() - go subComplete(completeErr) - return - } - - subCtx, cancel := context.WithCancel(ctx) - thisId := subId - subId++ - subs[thisId] = mcastSubscriber[T]{ - subNext, - cancel, - } - - // Continue subscribing asynchronously so caller is not blocked. - go func() { - if opt.emitLatest && haveLatest { - subNext(latestValue) - } - mu.Unlock() - - // Wait for cancellation by observer, or completion from upstream. - <-subCtx.Done() - - // Remove the observer and complete. - var err error - mu.Lock() - delete(subs, thisId) - if completed { - err = completeErr - } else { - err = subCtx.Err() - } - mu.Unlock() - subComplete(err) - }() - }) - - return -} diff --git a/vendor/github.com/cncf/xds/go/LICENSE b/vendor/github.com/cncf/xds/go/LICENSE deleted file mode 100644 index 261eeb9e9..000000000 --- a/vendor/github.com/cncf/xds/go/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - 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. diff --git a/vendor/github.com/cncf/xds/go/udpa/annotations/migrate.pb.go b/vendor/github.com/cncf/xds/go/udpa/annotations/migrate.pb.go deleted file mode 100644 index 7d3e1536b..000000000 --- a/vendor/github.com/cncf/xds/go/udpa/annotations/migrate.pb.go +++ /dev/null @@ -1,411 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: udpa/annotations/migrate.proto - -package annotations - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - descriptorpb "google.golang.org/protobuf/types/descriptorpb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type MigrateAnnotation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Rename string `protobuf:"bytes,1,opt,name=rename,proto3" json:"rename,omitempty"` -} - -func (x *MigrateAnnotation) Reset() { - *x = MigrateAnnotation{} - if protoimpl.UnsafeEnabled { - mi := &file_udpa_annotations_migrate_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MigrateAnnotation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MigrateAnnotation) ProtoMessage() {} - -func (x *MigrateAnnotation) ProtoReflect() protoreflect.Message { - mi := &file_udpa_annotations_migrate_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MigrateAnnotation.ProtoReflect.Descriptor instead. -func (*MigrateAnnotation) Descriptor() ([]byte, []int) { - return file_udpa_annotations_migrate_proto_rawDescGZIP(), []int{0} -} - -func (x *MigrateAnnotation) GetRename() string { - if x != nil { - return x.Rename - } - return "" -} - -type FieldMigrateAnnotation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Rename string `protobuf:"bytes,1,opt,name=rename,proto3" json:"rename,omitempty"` - OneofPromotion string `protobuf:"bytes,2,opt,name=oneof_promotion,json=oneofPromotion,proto3" json:"oneof_promotion,omitempty"` -} - -func (x *FieldMigrateAnnotation) Reset() { - *x = FieldMigrateAnnotation{} - if protoimpl.UnsafeEnabled { - mi := &file_udpa_annotations_migrate_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FieldMigrateAnnotation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FieldMigrateAnnotation) ProtoMessage() {} - -func (x *FieldMigrateAnnotation) ProtoReflect() protoreflect.Message { - mi := &file_udpa_annotations_migrate_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FieldMigrateAnnotation.ProtoReflect.Descriptor instead. -func (*FieldMigrateAnnotation) Descriptor() ([]byte, []int) { - return file_udpa_annotations_migrate_proto_rawDescGZIP(), []int{1} -} - -func (x *FieldMigrateAnnotation) GetRename() string { - if x != nil { - return x.Rename - } - return "" -} - -func (x *FieldMigrateAnnotation) GetOneofPromotion() string { - if x != nil { - return x.OneofPromotion - } - return "" -} - -type FileMigrateAnnotation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - MoveToPackage string `protobuf:"bytes,2,opt,name=move_to_package,json=moveToPackage,proto3" json:"move_to_package,omitempty"` -} - -func (x *FileMigrateAnnotation) Reset() { - *x = FileMigrateAnnotation{} - if protoimpl.UnsafeEnabled { - mi := &file_udpa_annotations_migrate_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FileMigrateAnnotation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FileMigrateAnnotation) ProtoMessage() {} - -func (x *FileMigrateAnnotation) ProtoReflect() protoreflect.Message { - mi := &file_udpa_annotations_migrate_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FileMigrateAnnotation.ProtoReflect.Descriptor instead. -func (*FileMigrateAnnotation) Descriptor() ([]byte, []int) { - return file_udpa_annotations_migrate_proto_rawDescGZIP(), []int{2} -} - -func (x *FileMigrateAnnotation) GetMoveToPackage() string { - if x != nil { - return x.MoveToPackage - } - return "" -} - -var file_udpa_annotations_migrate_proto_extTypes = []protoimpl.ExtensionInfo{ - { - ExtendedType: (*descriptorpb.MessageOptions)(nil), - ExtensionType: (*MigrateAnnotation)(nil), - Field: 171962766, - Name: "udpa.annotations.message_migrate", - Tag: "bytes,171962766,opt,name=message_migrate", - Filename: "udpa/annotations/migrate.proto", - }, - { - ExtendedType: (*descriptorpb.FieldOptions)(nil), - ExtensionType: (*FieldMigrateAnnotation)(nil), - Field: 171962766, - Name: "udpa.annotations.field_migrate", - Tag: "bytes,171962766,opt,name=field_migrate", - Filename: "udpa/annotations/migrate.proto", - }, - { - ExtendedType: (*descriptorpb.EnumOptions)(nil), - ExtensionType: (*MigrateAnnotation)(nil), - Field: 171962766, - Name: "udpa.annotations.enum_migrate", - Tag: "bytes,171962766,opt,name=enum_migrate", - Filename: "udpa/annotations/migrate.proto", - }, - { - ExtendedType: (*descriptorpb.EnumValueOptions)(nil), - ExtensionType: (*MigrateAnnotation)(nil), - Field: 171962766, - Name: "udpa.annotations.enum_value_migrate", - Tag: "bytes,171962766,opt,name=enum_value_migrate", - Filename: "udpa/annotations/migrate.proto", - }, - { - ExtendedType: (*descriptorpb.FileOptions)(nil), - ExtensionType: (*FileMigrateAnnotation)(nil), - Field: 171962766, - Name: "udpa.annotations.file_migrate", - Tag: "bytes,171962766,opt,name=file_migrate", - Filename: "udpa/annotations/migrate.proto", - }, -} - -// Extension fields to descriptorpb.MessageOptions. -var ( - // optional udpa.annotations.MigrateAnnotation message_migrate = 171962766; - E_MessageMigrate = &file_udpa_annotations_migrate_proto_extTypes[0] -) - -// Extension fields to descriptorpb.FieldOptions. -var ( - // optional udpa.annotations.FieldMigrateAnnotation field_migrate = 171962766; - E_FieldMigrate = &file_udpa_annotations_migrate_proto_extTypes[1] -) - -// Extension fields to descriptorpb.EnumOptions. -var ( - // optional udpa.annotations.MigrateAnnotation enum_migrate = 171962766; - E_EnumMigrate = &file_udpa_annotations_migrate_proto_extTypes[2] -) - -// Extension fields to descriptorpb.EnumValueOptions. -var ( - // optional udpa.annotations.MigrateAnnotation enum_value_migrate = 171962766; - E_EnumValueMigrate = &file_udpa_annotations_migrate_proto_extTypes[3] -) - -// Extension fields to descriptorpb.FileOptions. -var ( - // optional udpa.annotations.FileMigrateAnnotation file_migrate = 171962766; - E_FileMigrate = &file_udpa_annotations_migrate_proto_extTypes[4] -) - -var File_udpa_annotations_migrate_proto protoreflect.FileDescriptor - -var file_udpa_annotations_migrate_proto_rawDesc = []byte{ - 0x0a, 0x1e, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x10, 0x75, 0x64, 0x70, 0x61, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2b, 0x0a, 0x11, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x41, - 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x6e, 0x61, 0x6d, - 0x65, 0x22, 0x59, 0x0a, 0x16, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, - 0x65, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x72, - 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x70, 0x72, 0x6f, - 0x6d, 0x6f, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x6e, - 0x65, 0x6f, 0x66, 0x50, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3f, 0x0a, 0x15, - 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x41, 0x6e, 0x6e, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0f, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x74, 0x6f, - 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, - 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x6f, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x3a, 0x70, 0x0a, - 0x0f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, - 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x18, 0x8e, 0xe3, 0xff, 0x51, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x75, 0x64, 0x70, - 0x61, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4d, 0x69, - 0x67, 0x72, 0x61, 0x74, 0x65, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x0e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x3a, - 0x6f, 0x0a, 0x0d, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, - 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, - 0x8e, 0xe3, 0xff, 0x51, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x75, 0x64, 0x70, 0x61, 0x2e, - 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x46, 0x69, 0x65, 0x6c, - 0x64, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x0c, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, - 0x3a, 0x67, 0x0a, 0x0c, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, - 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x8e, - 0xe3, 0xff, 0x51, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x75, 0x64, 0x70, 0x61, 0x2e, 0x61, - 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4d, 0x69, 0x67, 0x72, 0x61, - 0x74, 0x65, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x65, 0x6e, - 0x75, 0x6d, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x3a, 0x77, 0x0a, 0x12, 0x65, 0x6e, 0x75, - 0x6d, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x12, - 0x21, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x18, 0x8e, 0xe3, 0xff, 0x51, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x75, 0x64, - 0x70, 0x61, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4d, - 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x10, 0x65, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x69, 0x67, 0x72, 0x61, - 0x74, 0x65, 0x3a, 0x6b, 0x0a, 0x0c, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6d, 0x69, 0x67, 0x72, 0x61, - 0x74, 0x65, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x18, 0x8e, 0xe3, 0xff, 0x51, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x75, 0x64, 0x70, 0x61, - 0x2e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x46, 0x69, 0x6c, - 0x65, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x0b, 0x66, 0x69, 0x6c, 0x65, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x42, - 0x29, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6e, - 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, - 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_udpa_annotations_migrate_proto_rawDescOnce sync.Once - file_udpa_annotations_migrate_proto_rawDescData = file_udpa_annotations_migrate_proto_rawDesc -) - -func file_udpa_annotations_migrate_proto_rawDescGZIP() []byte { - file_udpa_annotations_migrate_proto_rawDescOnce.Do(func() { - file_udpa_annotations_migrate_proto_rawDescData = protoimpl.X.CompressGZIP(file_udpa_annotations_migrate_proto_rawDescData) - }) - return file_udpa_annotations_migrate_proto_rawDescData -} - -var file_udpa_annotations_migrate_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_udpa_annotations_migrate_proto_goTypes = []interface{}{ - (*MigrateAnnotation)(nil), // 0: udpa.annotations.MigrateAnnotation - (*FieldMigrateAnnotation)(nil), // 1: udpa.annotations.FieldMigrateAnnotation - (*FileMigrateAnnotation)(nil), // 2: udpa.annotations.FileMigrateAnnotation - (*descriptorpb.MessageOptions)(nil), // 3: google.protobuf.MessageOptions - (*descriptorpb.FieldOptions)(nil), // 4: google.protobuf.FieldOptions - (*descriptorpb.EnumOptions)(nil), // 5: google.protobuf.EnumOptions - (*descriptorpb.EnumValueOptions)(nil), // 6: google.protobuf.EnumValueOptions - (*descriptorpb.FileOptions)(nil), // 7: google.protobuf.FileOptions -} -var file_udpa_annotations_migrate_proto_depIdxs = []int32{ - 3, // 0: udpa.annotations.message_migrate:extendee -> google.protobuf.MessageOptions - 4, // 1: udpa.annotations.field_migrate:extendee -> google.protobuf.FieldOptions - 5, // 2: udpa.annotations.enum_migrate:extendee -> google.protobuf.EnumOptions - 6, // 3: udpa.annotations.enum_value_migrate:extendee -> google.protobuf.EnumValueOptions - 7, // 4: udpa.annotations.file_migrate:extendee -> google.protobuf.FileOptions - 0, // 5: udpa.annotations.message_migrate:type_name -> udpa.annotations.MigrateAnnotation - 1, // 6: udpa.annotations.field_migrate:type_name -> udpa.annotations.FieldMigrateAnnotation - 0, // 7: udpa.annotations.enum_migrate:type_name -> udpa.annotations.MigrateAnnotation - 0, // 8: udpa.annotations.enum_value_migrate:type_name -> udpa.annotations.MigrateAnnotation - 2, // 9: udpa.annotations.file_migrate:type_name -> udpa.annotations.FileMigrateAnnotation - 10, // [10:10] is the sub-list for method output_type - 10, // [10:10] is the sub-list for method input_type - 5, // [5:10] is the sub-list for extension type_name - 0, // [0:5] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_udpa_annotations_migrate_proto_init() } -func file_udpa_annotations_migrate_proto_init() { - if File_udpa_annotations_migrate_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_udpa_annotations_migrate_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MigrateAnnotation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_udpa_annotations_migrate_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FieldMigrateAnnotation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_udpa_annotations_migrate_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileMigrateAnnotation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_udpa_annotations_migrate_proto_rawDesc, - NumEnums: 0, - NumMessages: 3, - NumExtensions: 5, - NumServices: 0, - }, - GoTypes: file_udpa_annotations_migrate_proto_goTypes, - DependencyIndexes: file_udpa_annotations_migrate_proto_depIdxs, - MessageInfos: file_udpa_annotations_migrate_proto_msgTypes, - ExtensionInfos: file_udpa_annotations_migrate_proto_extTypes, - }.Build() - File_udpa_annotations_migrate_proto = out.File - file_udpa_annotations_migrate_proto_rawDesc = nil - file_udpa_annotations_migrate_proto_goTypes = nil - file_udpa_annotations_migrate_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/udpa/annotations/migrate.pb.validate.go b/vendor/github.com/cncf/xds/go/udpa/annotations/migrate.pb.validate.go deleted file mode 100644 index 38196d5eb..000000000 --- a/vendor/github.com/cncf/xds/go/udpa/annotations/migrate.pb.validate.go +++ /dev/null @@ -1,350 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: udpa/annotations/migrate.proto - -package annotations - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on MigrateAnnotation with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *MigrateAnnotation) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on MigrateAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// MigrateAnnotationMultiError, or nil if none found. -func (m *MigrateAnnotation) ValidateAll() error { - return m.validate(true) -} - -func (m *MigrateAnnotation) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Rename - - if len(errors) > 0 { - return MigrateAnnotationMultiError(errors) - } - - return nil -} - -// MigrateAnnotationMultiError is an error wrapping multiple validation errors -// returned by MigrateAnnotation.ValidateAll() if the designated constraints -// aren't met. -type MigrateAnnotationMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m MigrateAnnotationMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m MigrateAnnotationMultiError) AllErrors() []error { return m } - -// MigrateAnnotationValidationError is the validation error returned by -// MigrateAnnotation.Validate if the designated constraints aren't met. -type MigrateAnnotationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e MigrateAnnotationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e MigrateAnnotationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e MigrateAnnotationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e MigrateAnnotationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e MigrateAnnotationValidationError) ErrorName() string { - return "MigrateAnnotationValidationError" -} - -// Error satisfies the builtin error interface -func (e MigrateAnnotationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMigrateAnnotation.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = MigrateAnnotationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = MigrateAnnotationValidationError{} - -// Validate checks the field values on FieldMigrateAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *FieldMigrateAnnotation) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on FieldMigrateAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// FieldMigrateAnnotationMultiError, or nil if none found. -func (m *FieldMigrateAnnotation) ValidateAll() error { - return m.validate(true) -} - -func (m *FieldMigrateAnnotation) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Rename - - // no validation rules for OneofPromotion - - if len(errors) > 0 { - return FieldMigrateAnnotationMultiError(errors) - } - - return nil -} - -// FieldMigrateAnnotationMultiError is an error wrapping multiple validation -// errors returned by FieldMigrateAnnotation.ValidateAll() if the designated -// constraints aren't met. -type FieldMigrateAnnotationMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m FieldMigrateAnnotationMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m FieldMigrateAnnotationMultiError) AllErrors() []error { return m } - -// FieldMigrateAnnotationValidationError is the validation error returned by -// FieldMigrateAnnotation.Validate if the designated constraints aren't met. -type FieldMigrateAnnotationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e FieldMigrateAnnotationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e FieldMigrateAnnotationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e FieldMigrateAnnotationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e FieldMigrateAnnotationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e FieldMigrateAnnotationValidationError) ErrorName() string { - return "FieldMigrateAnnotationValidationError" -} - -// Error satisfies the builtin error interface -func (e FieldMigrateAnnotationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sFieldMigrateAnnotation.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = FieldMigrateAnnotationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = FieldMigrateAnnotationValidationError{} - -// Validate checks the field values on FileMigrateAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *FileMigrateAnnotation) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on FileMigrateAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// FileMigrateAnnotationMultiError, or nil if none found. -func (m *FileMigrateAnnotation) ValidateAll() error { - return m.validate(true) -} - -func (m *FileMigrateAnnotation) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for MoveToPackage - - if len(errors) > 0 { - return FileMigrateAnnotationMultiError(errors) - } - - return nil -} - -// FileMigrateAnnotationMultiError is an error wrapping multiple validation -// errors returned by FileMigrateAnnotation.ValidateAll() if the designated -// constraints aren't met. -type FileMigrateAnnotationMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m FileMigrateAnnotationMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m FileMigrateAnnotationMultiError) AllErrors() []error { return m } - -// FileMigrateAnnotationValidationError is the validation error returned by -// FileMigrateAnnotation.Validate if the designated constraints aren't met. -type FileMigrateAnnotationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e FileMigrateAnnotationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e FileMigrateAnnotationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e FileMigrateAnnotationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e FileMigrateAnnotationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e FileMigrateAnnotationValidationError) ErrorName() string { - return "FileMigrateAnnotationValidationError" -} - -// Error satisfies the builtin error interface -func (e FileMigrateAnnotationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sFileMigrateAnnotation.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = FileMigrateAnnotationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = FileMigrateAnnotationValidationError{} diff --git a/vendor/github.com/cncf/xds/go/udpa/annotations/security.pb.go b/vendor/github.com/cncf/xds/go/udpa/annotations/security.pb.go deleted file mode 100644 index 719577895..000000000 --- a/vendor/github.com/cncf/xds/go/udpa/annotations/security.pb.go +++ /dev/null @@ -1,196 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: udpa/annotations/security.proto - -package annotations - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - descriptorpb "google.golang.org/protobuf/types/descriptorpb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type FieldSecurityAnnotation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ConfigureForUntrustedDownstream bool `protobuf:"varint,1,opt,name=configure_for_untrusted_downstream,json=configureForUntrustedDownstream,proto3" json:"configure_for_untrusted_downstream,omitempty"` - ConfigureForUntrustedUpstream bool `protobuf:"varint,2,opt,name=configure_for_untrusted_upstream,json=configureForUntrustedUpstream,proto3" json:"configure_for_untrusted_upstream,omitempty"` -} - -func (x *FieldSecurityAnnotation) Reset() { - *x = FieldSecurityAnnotation{} - if protoimpl.UnsafeEnabled { - mi := &file_udpa_annotations_security_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FieldSecurityAnnotation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FieldSecurityAnnotation) ProtoMessage() {} - -func (x *FieldSecurityAnnotation) ProtoReflect() protoreflect.Message { - mi := &file_udpa_annotations_security_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FieldSecurityAnnotation.ProtoReflect.Descriptor instead. -func (*FieldSecurityAnnotation) Descriptor() ([]byte, []int) { - return file_udpa_annotations_security_proto_rawDescGZIP(), []int{0} -} - -func (x *FieldSecurityAnnotation) GetConfigureForUntrustedDownstream() bool { - if x != nil { - return x.ConfigureForUntrustedDownstream - } - return false -} - -func (x *FieldSecurityAnnotation) GetConfigureForUntrustedUpstream() bool { - if x != nil { - return x.ConfigureForUntrustedUpstream - } - return false -} - -var file_udpa_annotations_security_proto_extTypes = []protoimpl.ExtensionInfo{ - { - ExtendedType: (*descriptorpb.FieldOptions)(nil), - ExtensionType: (*FieldSecurityAnnotation)(nil), - Field: 11122993, - Name: "udpa.annotations.security", - Tag: "bytes,11122993,opt,name=security", - Filename: "udpa/annotations/security.proto", - }, -} - -// Extension fields to descriptorpb.FieldOptions. -var ( - // optional udpa.annotations.FieldSecurityAnnotation security = 11122993; - E_Security = &file_udpa_annotations_security_proto_extTypes[0] -) - -var File_udpa_annotations_security_proto protoreflect.FileDescriptor - -var file_udpa_annotations_security_proto_rawDesc = []byte{ - 0x0a, 0x1f, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x10, 0x75, 0x64, 0x70, 0x61, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xaf, 0x01, 0x0a, 0x17, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x53, 0x65, - 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x4b, 0x0a, 0x22, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x5f, 0x66, 0x6f, - 0x72, 0x5f, 0x75, 0x6e, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x64, 0x6f, 0x77, 0x6e, - 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x1f, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x46, 0x6f, 0x72, 0x55, 0x6e, 0x74, 0x72, 0x75, 0x73, - 0x74, 0x65, 0x64, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x47, 0x0a, - 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x5f, 0x75, - 0x6e, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x1d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, - 0x72, 0x65, 0x46, 0x6f, 0x72, 0x55, 0x6e, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, 0x64, 0x55, 0x70, - 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x3a, 0x67, 0x0a, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, - 0x74, 0x79, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x18, 0xb1, 0xf2, 0xa6, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x75, 0x64, 0x70, - 0x61, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x46, 0x69, - 0x65, 0x6c, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x41, 0x6e, 0x6e, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x42, - 0x31, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x08, 0x01, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6e, 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, - 0x6f, 0x2f, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_udpa_annotations_security_proto_rawDescOnce sync.Once - file_udpa_annotations_security_proto_rawDescData = file_udpa_annotations_security_proto_rawDesc -) - -func file_udpa_annotations_security_proto_rawDescGZIP() []byte { - file_udpa_annotations_security_proto_rawDescOnce.Do(func() { - file_udpa_annotations_security_proto_rawDescData = protoimpl.X.CompressGZIP(file_udpa_annotations_security_proto_rawDescData) - }) - return file_udpa_annotations_security_proto_rawDescData -} - -var file_udpa_annotations_security_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_udpa_annotations_security_proto_goTypes = []interface{}{ - (*FieldSecurityAnnotation)(nil), // 0: udpa.annotations.FieldSecurityAnnotation - (*descriptorpb.FieldOptions)(nil), // 1: google.protobuf.FieldOptions -} -var file_udpa_annotations_security_proto_depIdxs = []int32{ - 1, // 0: udpa.annotations.security:extendee -> google.protobuf.FieldOptions - 0, // 1: udpa.annotations.security:type_name -> udpa.annotations.FieldSecurityAnnotation - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 1, // [1:2] is the sub-list for extension type_name - 0, // [0:1] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_udpa_annotations_security_proto_init() } -func file_udpa_annotations_security_proto_init() { - if File_udpa_annotations_security_proto != nil { - return - } - file_udpa_annotations_status_proto_init() - if !protoimpl.UnsafeEnabled { - file_udpa_annotations_security_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FieldSecurityAnnotation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_udpa_annotations_security_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 1, - NumServices: 0, - }, - GoTypes: file_udpa_annotations_security_proto_goTypes, - DependencyIndexes: file_udpa_annotations_security_proto_depIdxs, - MessageInfos: file_udpa_annotations_security_proto_msgTypes, - ExtensionInfos: file_udpa_annotations_security_proto_extTypes, - }.Build() - File_udpa_annotations_security_proto = out.File - file_udpa_annotations_security_proto_rawDesc = nil - file_udpa_annotations_security_proto_goTypes = nil - file_udpa_annotations_security_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/udpa/annotations/security.pb.validate.go b/vendor/github.com/cncf/xds/go/udpa/annotations/security.pb.validate.go deleted file mode 100644 index acc9bd7a1..000000000 --- a/vendor/github.com/cncf/xds/go/udpa/annotations/security.pb.validate.go +++ /dev/null @@ -1,142 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: udpa/annotations/security.proto - -package annotations - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on FieldSecurityAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *FieldSecurityAnnotation) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on FieldSecurityAnnotation with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// FieldSecurityAnnotationMultiError, or nil if none found. -func (m *FieldSecurityAnnotation) ValidateAll() error { - return m.validate(true) -} - -func (m *FieldSecurityAnnotation) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ConfigureForUntrustedDownstream - - // no validation rules for ConfigureForUntrustedUpstream - - if len(errors) > 0 { - return FieldSecurityAnnotationMultiError(errors) - } - - return nil -} - -// FieldSecurityAnnotationMultiError is an error wrapping multiple validation -// errors returned by FieldSecurityAnnotation.ValidateAll() if the designated -// constraints aren't met. -type FieldSecurityAnnotationMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m FieldSecurityAnnotationMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m FieldSecurityAnnotationMultiError) AllErrors() []error { return m } - -// FieldSecurityAnnotationValidationError is the validation error returned by -// FieldSecurityAnnotation.Validate if the designated constraints aren't met. -type FieldSecurityAnnotationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e FieldSecurityAnnotationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e FieldSecurityAnnotationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e FieldSecurityAnnotationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e FieldSecurityAnnotationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e FieldSecurityAnnotationValidationError) ErrorName() string { - return "FieldSecurityAnnotationValidationError" -} - -// Error satisfies the builtin error interface -func (e FieldSecurityAnnotationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sFieldSecurityAnnotation.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = FieldSecurityAnnotationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = FieldSecurityAnnotationValidationError{} diff --git a/vendor/github.com/cncf/xds/go/udpa/annotations/sensitive.pb.go b/vendor/github.com/cncf/xds/go/udpa/annotations/sensitive.pb.go deleted file mode 100644 index 8631b8568..000000000 --- a/vendor/github.com/cncf/xds/go/udpa/annotations/sensitive.pb.go +++ /dev/null @@ -1,93 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: udpa/annotations/sensitive.proto - -package annotations - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - descriptorpb "google.golang.org/protobuf/types/descriptorpb" - reflect "reflect" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -var file_udpa_annotations_sensitive_proto_extTypes = []protoimpl.ExtensionInfo{ - { - ExtendedType: (*descriptorpb.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 76569463, - Name: "udpa.annotations.sensitive", - Tag: "varint,76569463,opt,name=sensitive", - Filename: "udpa/annotations/sensitive.proto", - }, -} - -// Extension fields to descriptorpb.FieldOptions. -var ( - // optional bool sensitive = 76569463; - E_Sensitive = &file_udpa_annotations_sensitive_proto_extTypes[0] -) - -var File_udpa_annotations_sensitive_proto protoreflect.FileDescriptor - -var file_udpa_annotations_sensitive_proto_rawDesc = []byte{ - 0x0a, 0x20, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2f, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x10, 0x75, 0x64, 0x70, 0x61, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3a, 0x3e, 0x0a, 0x09, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, - 0x69, 0x76, 0x65, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x18, 0xf7, 0xb6, 0xc1, 0x24, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x65, 0x6e, - 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x42, 0x29, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6e, 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, 0x6f, - 0x2f, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var file_udpa_annotations_sensitive_proto_goTypes = []interface{}{ - (*descriptorpb.FieldOptions)(nil), // 0: google.protobuf.FieldOptions -} -var file_udpa_annotations_sensitive_proto_depIdxs = []int32{ - 0, // 0: udpa.annotations.sensitive:extendee -> google.protobuf.FieldOptions - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 0, // [0:1] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_udpa_annotations_sensitive_proto_init() } -func file_udpa_annotations_sensitive_proto_init() { - if File_udpa_annotations_sensitive_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_udpa_annotations_sensitive_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 1, - NumServices: 0, - }, - GoTypes: file_udpa_annotations_sensitive_proto_goTypes, - DependencyIndexes: file_udpa_annotations_sensitive_proto_depIdxs, - ExtensionInfos: file_udpa_annotations_sensitive_proto_extTypes, - }.Build() - File_udpa_annotations_sensitive_proto = out.File - file_udpa_annotations_sensitive_proto_rawDesc = nil - file_udpa_annotations_sensitive_proto_goTypes = nil - file_udpa_annotations_sensitive_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/udpa/annotations/sensitive.pb.validate.go b/vendor/github.com/cncf/xds/go/udpa/annotations/sensitive.pb.validate.go deleted file mode 100644 index f3fa61974..000000000 --- a/vendor/github.com/cncf/xds/go/udpa/annotations/sensitive.pb.validate.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: udpa/annotations/sensitive.proto - -package annotations - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) diff --git a/vendor/github.com/cncf/xds/go/udpa/annotations/status.pb.go b/vendor/github.com/cncf/xds/go/udpa/annotations/status.pb.go deleted file mode 100644 index f2fdc3ca3..000000000 --- a/vendor/github.com/cncf/xds/go/udpa/annotations/status.pb.go +++ /dev/null @@ -1,253 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: udpa/annotations/status.proto - -package annotations - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - descriptorpb "google.golang.org/protobuf/types/descriptorpb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type PackageVersionStatus int32 - -const ( - PackageVersionStatus_UNKNOWN PackageVersionStatus = 0 - PackageVersionStatus_FROZEN PackageVersionStatus = 1 - PackageVersionStatus_ACTIVE PackageVersionStatus = 2 - PackageVersionStatus_NEXT_MAJOR_VERSION_CANDIDATE PackageVersionStatus = 3 -) - -// Enum value maps for PackageVersionStatus. -var ( - PackageVersionStatus_name = map[int32]string{ - 0: "UNKNOWN", - 1: "FROZEN", - 2: "ACTIVE", - 3: "NEXT_MAJOR_VERSION_CANDIDATE", - } - PackageVersionStatus_value = map[string]int32{ - "UNKNOWN": 0, - "FROZEN": 1, - "ACTIVE": 2, - "NEXT_MAJOR_VERSION_CANDIDATE": 3, - } -) - -func (x PackageVersionStatus) Enum() *PackageVersionStatus { - p := new(PackageVersionStatus) - *p = x - return p -} - -func (x PackageVersionStatus) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (PackageVersionStatus) Descriptor() protoreflect.EnumDescriptor { - return file_udpa_annotations_status_proto_enumTypes[0].Descriptor() -} - -func (PackageVersionStatus) Type() protoreflect.EnumType { - return &file_udpa_annotations_status_proto_enumTypes[0] -} - -func (x PackageVersionStatus) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use PackageVersionStatus.Descriptor instead. -func (PackageVersionStatus) EnumDescriptor() ([]byte, []int) { - return file_udpa_annotations_status_proto_rawDescGZIP(), []int{0} -} - -type StatusAnnotation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - WorkInProgress bool `protobuf:"varint,1,opt,name=work_in_progress,json=workInProgress,proto3" json:"work_in_progress,omitempty"` - PackageVersionStatus PackageVersionStatus `protobuf:"varint,2,opt,name=package_version_status,json=packageVersionStatus,proto3,enum=udpa.annotations.PackageVersionStatus" json:"package_version_status,omitempty"` -} - -func (x *StatusAnnotation) Reset() { - *x = StatusAnnotation{} - if protoimpl.UnsafeEnabled { - mi := &file_udpa_annotations_status_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StatusAnnotation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StatusAnnotation) ProtoMessage() {} - -func (x *StatusAnnotation) ProtoReflect() protoreflect.Message { - mi := &file_udpa_annotations_status_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StatusAnnotation.ProtoReflect.Descriptor instead. -func (*StatusAnnotation) Descriptor() ([]byte, []int) { - return file_udpa_annotations_status_proto_rawDescGZIP(), []int{0} -} - -func (x *StatusAnnotation) GetWorkInProgress() bool { - if x != nil { - return x.WorkInProgress - } - return false -} - -func (x *StatusAnnotation) GetPackageVersionStatus() PackageVersionStatus { - if x != nil { - return x.PackageVersionStatus - } - return PackageVersionStatus_UNKNOWN -} - -var file_udpa_annotations_status_proto_extTypes = []protoimpl.ExtensionInfo{ - { - ExtendedType: (*descriptorpb.FileOptions)(nil), - ExtensionType: (*StatusAnnotation)(nil), - Field: 222707719, - Name: "udpa.annotations.file_status", - Tag: "bytes,222707719,opt,name=file_status", - Filename: "udpa/annotations/status.proto", - }, -} - -// Extension fields to descriptorpb.FileOptions. -var ( - // optional udpa.annotations.StatusAnnotation file_status = 222707719; - E_FileStatus = &file_udpa_annotations_status_proto_extTypes[0] -) - -var File_udpa_annotations_status_proto protoreflect.FileDescriptor - -var file_udpa_annotations_status_proto_rawDesc = []byte{ - 0x0a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x10, 0x75, 0x64, 0x70, 0x61, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x9a, 0x01, 0x0a, 0x10, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x41, 0x6e, - 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x10, 0x77, 0x6f, 0x72, 0x6b, - 0x5f, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x5c, 0x0a, 0x16, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x75, 0x64, 0x70, 0x61, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x14, 0x70, 0x61, 0x63, 0x6b, - 0x61, 0x67, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x2a, 0x5d, 0x0a, 0x14, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, - 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x52, 0x4f, 0x5a, 0x45, 0x4e, 0x10, - 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x02, 0x12, 0x20, 0x0a, - 0x1c, 0x4e, 0x45, 0x58, 0x54, 0x5f, 0x4d, 0x41, 0x4a, 0x4f, 0x52, 0x5f, 0x56, 0x45, 0x52, 0x53, - 0x49, 0x4f, 0x4e, 0x5f, 0x43, 0x41, 0x4e, 0x44, 0x49, 0x44, 0x41, 0x54, 0x45, 0x10, 0x03, 0x3a, - 0x64, 0x0a, 0x0b, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x87, 0x80, 0x99, - 0x6a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x75, 0x64, 0x70, 0x61, 0x2e, 0x61, 0x6e, 0x6e, - 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x41, - 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x66, 0x69, 0x6c, 0x65, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x29, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6e, 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, 0x6f, 0x2f, - 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_udpa_annotations_status_proto_rawDescOnce sync.Once - file_udpa_annotations_status_proto_rawDescData = file_udpa_annotations_status_proto_rawDesc -) - -func file_udpa_annotations_status_proto_rawDescGZIP() []byte { - file_udpa_annotations_status_proto_rawDescOnce.Do(func() { - file_udpa_annotations_status_proto_rawDescData = protoimpl.X.CompressGZIP(file_udpa_annotations_status_proto_rawDescData) - }) - return file_udpa_annotations_status_proto_rawDescData -} - -var file_udpa_annotations_status_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_udpa_annotations_status_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_udpa_annotations_status_proto_goTypes = []interface{}{ - (PackageVersionStatus)(0), // 0: udpa.annotations.PackageVersionStatus - (*StatusAnnotation)(nil), // 1: udpa.annotations.StatusAnnotation - (*descriptorpb.FileOptions)(nil), // 2: google.protobuf.FileOptions -} -var file_udpa_annotations_status_proto_depIdxs = []int32{ - 0, // 0: udpa.annotations.StatusAnnotation.package_version_status:type_name -> udpa.annotations.PackageVersionStatus - 2, // 1: udpa.annotations.file_status:extendee -> google.protobuf.FileOptions - 1, // 2: udpa.annotations.file_status:type_name -> udpa.annotations.StatusAnnotation - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 2, // [2:3] is the sub-list for extension type_name - 1, // [1:2] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_udpa_annotations_status_proto_init() } -func file_udpa_annotations_status_proto_init() { - if File_udpa_annotations_status_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_udpa_annotations_status_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StatusAnnotation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_udpa_annotations_status_proto_rawDesc, - NumEnums: 1, - NumMessages: 1, - NumExtensions: 1, - NumServices: 0, - }, - GoTypes: file_udpa_annotations_status_proto_goTypes, - DependencyIndexes: file_udpa_annotations_status_proto_depIdxs, - EnumInfos: file_udpa_annotations_status_proto_enumTypes, - MessageInfos: file_udpa_annotations_status_proto_msgTypes, - ExtensionInfos: file_udpa_annotations_status_proto_extTypes, - }.Build() - File_udpa_annotations_status_proto = out.File - file_udpa_annotations_status_proto_rawDesc = nil - file_udpa_annotations_status_proto_goTypes = nil - file_udpa_annotations_status_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/udpa/annotations/status.pb.validate.go b/vendor/github.com/cncf/xds/go/udpa/annotations/status.pb.validate.go deleted file mode 100644 index 5633a8383..000000000 --- a/vendor/github.com/cncf/xds/go/udpa/annotations/status.pb.validate.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: udpa/annotations/status.proto - -package annotations - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on StatusAnnotation with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *StatusAnnotation) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on StatusAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// StatusAnnotationMultiError, or nil if none found. -func (m *StatusAnnotation) ValidateAll() error { - return m.validate(true) -} - -func (m *StatusAnnotation) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for WorkInProgress - - // no validation rules for PackageVersionStatus - - if len(errors) > 0 { - return StatusAnnotationMultiError(errors) - } - - return nil -} - -// StatusAnnotationMultiError is an error wrapping multiple validation errors -// returned by StatusAnnotation.ValidateAll() if the designated constraints -// aren't met. -type StatusAnnotationMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m StatusAnnotationMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m StatusAnnotationMultiError) AllErrors() []error { return m } - -// StatusAnnotationValidationError is the validation error returned by -// StatusAnnotation.Validate if the designated constraints aren't met. -type StatusAnnotationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e StatusAnnotationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e StatusAnnotationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e StatusAnnotationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e StatusAnnotationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e StatusAnnotationValidationError) ErrorName() string { return "StatusAnnotationValidationError" } - -// Error satisfies the builtin error interface -func (e StatusAnnotationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sStatusAnnotation.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = StatusAnnotationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = StatusAnnotationValidationError{} diff --git a/vendor/github.com/cncf/xds/go/udpa/annotations/versioning.pb.go b/vendor/github.com/cncf/xds/go/udpa/annotations/versioning.pb.go deleted file mode 100644 index df83e0a2e..000000000 --- a/vendor/github.com/cncf/xds/go/udpa/annotations/versioning.pb.go +++ /dev/null @@ -1,179 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: udpa/annotations/versioning.proto - -package annotations - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - descriptorpb "google.golang.org/protobuf/types/descriptorpb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type VersioningAnnotation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - PreviousMessageType string `protobuf:"bytes,1,opt,name=previous_message_type,json=previousMessageType,proto3" json:"previous_message_type,omitempty"` -} - -func (x *VersioningAnnotation) Reset() { - *x = VersioningAnnotation{} - if protoimpl.UnsafeEnabled { - mi := &file_udpa_annotations_versioning_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *VersioningAnnotation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*VersioningAnnotation) ProtoMessage() {} - -func (x *VersioningAnnotation) ProtoReflect() protoreflect.Message { - mi := &file_udpa_annotations_versioning_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use VersioningAnnotation.ProtoReflect.Descriptor instead. -func (*VersioningAnnotation) Descriptor() ([]byte, []int) { - return file_udpa_annotations_versioning_proto_rawDescGZIP(), []int{0} -} - -func (x *VersioningAnnotation) GetPreviousMessageType() string { - if x != nil { - return x.PreviousMessageType - } - return "" -} - -var file_udpa_annotations_versioning_proto_extTypes = []protoimpl.ExtensionInfo{ - { - ExtendedType: (*descriptorpb.MessageOptions)(nil), - ExtensionType: (*VersioningAnnotation)(nil), - Field: 7881811, - Name: "udpa.annotations.versioning", - Tag: "bytes,7881811,opt,name=versioning", - Filename: "udpa/annotations/versioning.proto", - }, -} - -// Extension fields to descriptorpb.MessageOptions. -var ( - // optional udpa.annotations.VersioningAnnotation versioning = 7881811; - E_Versioning = &file_udpa_annotations_versioning_proto_extTypes[0] -) - -var File_udpa_annotations_versioning_proto protoreflect.FileDescriptor - -var file_udpa_annotations_versioning_proto_rawDesc = []byte{ - 0x0a, 0x21, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x75, 0x64, 0x70, 0x61, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, - 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x4a, 0x0a, 0x14, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x32, 0x0a, 0x15, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x5f, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, - 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, - 0x79, 0x70, 0x65, 0x3a, 0x6a, 0x0a, 0x0a, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, - 0x67, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x18, 0xd3, 0x88, 0xe1, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x75, 0x64, - 0x70, 0x61, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x56, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x42, - 0x29, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6e, - 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, - 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_udpa_annotations_versioning_proto_rawDescOnce sync.Once - file_udpa_annotations_versioning_proto_rawDescData = file_udpa_annotations_versioning_proto_rawDesc -) - -func file_udpa_annotations_versioning_proto_rawDescGZIP() []byte { - file_udpa_annotations_versioning_proto_rawDescOnce.Do(func() { - file_udpa_annotations_versioning_proto_rawDescData = protoimpl.X.CompressGZIP(file_udpa_annotations_versioning_proto_rawDescData) - }) - return file_udpa_annotations_versioning_proto_rawDescData -} - -var file_udpa_annotations_versioning_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_udpa_annotations_versioning_proto_goTypes = []interface{}{ - (*VersioningAnnotation)(nil), // 0: udpa.annotations.VersioningAnnotation - (*descriptorpb.MessageOptions)(nil), // 1: google.protobuf.MessageOptions -} -var file_udpa_annotations_versioning_proto_depIdxs = []int32{ - 1, // 0: udpa.annotations.versioning:extendee -> google.protobuf.MessageOptions - 0, // 1: udpa.annotations.versioning:type_name -> udpa.annotations.VersioningAnnotation - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 1, // [1:2] is the sub-list for extension type_name - 0, // [0:1] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_udpa_annotations_versioning_proto_init() } -func file_udpa_annotations_versioning_proto_init() { - if File_udpa_annotations_versioning_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_udpa_annotations_versioning_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*VersioningAnnotation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_udpa_annotations_versioning_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 1, - NumServices: 0, - }, - GoTypes: file_udpa_annotations_versioning_proto_goTypes, - DependencyIndexes: file_udpa_annotations_versioning_proto_depIdxs, - MessageInfos: file_udpa_annotations_versioning_proto_msgTypes, - ExtensionInfos: file_udpa_annotations_versioning_proto_extTypes, - }.Build() - File_udpa_annotations_versioning_proto = out.File - file_udpa_annotations_versioning_proto_rawDesc = nil - file_udpa_annotations_versioning_proto_goTypes = nil - file_udpa_annotations_versioning_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/udpa/annotations/versioning.pb.validate.go b/vendor/github.com/cncf/xds/go/udpa/annotations/versioning.pb.validate.go deleted file mode 100644 index 5fd86baff..000000000 --- a/vendor/github.com/cncf/xds/go/udpa/annotations/versioning.pb.validate.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: udpa/annotations/versioning.proto - -package annotations - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on VersioningAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *VersioningAnnotation) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on VersioningAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// VersioningAnnotationMultiError, or nil if none found. -func (m *VersioningAnnotation) ValidateAll() error { - return m.validate(true) -} - -func (m *VersioningAnnotation) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for PreviousMessageType - - if len(errors) > 0 { - return VersioningAnnotationMultiError(errors) - } - - return nil -} - -// VersioningAnnotationMultiError is an error wrapping multiple validation -// errors returned by VersioningAnnotation.ValidateAll() if the designated -// constraints aren't met. -type VersioningAnnotationMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m VersioningAnnotationMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m VersioningAnnotationMultiError) AllErrors() []error { return m } - -// VersioningAnnotationValidationError is the validation error returned by -// VersioningAnnotation.Validate if the designated constraints aren't met. -type VersioningAnnotationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e VersioningAnnotationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e VersioningAnnotationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e VersioningAnnotationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e VersioningAnnotationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e VersioningAnnotationValidationError) ErrorName() string { - return "VersioningAnnotationValidationError" -} - -// Error satisfies the builtin error interface -func (e VersioningAnnotationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sVersioningAnnotation.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = VersioningAnnotationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = VersioningAnnotationValidationError{} diff --git a/vendor/github.com/cncf/xds/go/xds/annotations/v3/migrate.pb.go b/vendor/github.com/cncf/xds/go/xds/annotations/v3/migrate.pb.go deleted file mode 100644 index ad24b1f7f..000000000 --- a/vendor/github.com/cncf/xds/go/xds/annotations/v3/migrate.pb.go +++ /dev/null @@ -1,412 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: xds/annotations/v3/migrate.proto - -package v3 - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - descriptorpb "google.golang.org/protobuf/types/descriptorpb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type MigrateAnnotation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Rename string `protobuf:"bytes,1,opt,name=rename,proto3" json:"rename,omitempty"` -} - -func (x *MigrateAnnotation) Reset() { - *x = MigrateAnnotation{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_annotations_v3_migrate_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MigrateAnnotation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MigrateAnnotation) ProtoMessage() {} - -func (x *MigrateAnnotation) ProtoReflect() protoreflect.Message { - mi := &file_xds_annotations_v3_migrate_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MigrateAnnotation.ProtoReflect.Descriptor instead. -func (*MigrateAnnotation) Descriptor() ([]byte, []int) { - return file_xds_annotations_v3_migrate_proto_rawDescGZIP(), []int{0} -} - -func (x *MigrateAnnotation) GetRename() string { - if x != nil { - return x.Rename - } - return "" -} - -type FieldMigrateAnnotation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Rename string `protobuf:"bytes,1,opt,name=rename,proto3" json:"rename,omitempty"` - OneofPromotion string `protobuf:"bytes,2,opt,name=oneof_promotion,json=oneofPromotion,proto3" json:"oneof_promotion,omitempty"` -} - -func (x *FieldMigrateAnnotation) Reset() { - *x = FieldMigrateAnnotation{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_annotations_v3_migrate_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FieldMigrateAnnotation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FieldMigrateAnnotation) ProtoMessage() {} - -func (x *FieldMigrateAnnotation) ProtoReflect() protoreflect.Message { - mi := &file_xds_annotations_v3_migrate_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FieldMigrateAnnotation.ProtoReflect.Descriptor instead. -func (*FieldMigrateAnnotation) Descriptor() ([]byte, []int) { - return file_xds_annotations_v3_migrate_proto_rawDescGZIP(), []int{1} -} - -func (x *FieldMigrateAnnotation) GetRename() string { - if x != nil { - return x.Rename - } - return "" -} - -func (x *FieldMigrateAnnotation) GetOneofPromotion() string { - if x != nil { - return x.OneofPromotion - } - return "" -} - -type FileMigrateAnnotation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - MoveToPackage string `protobuf:"bytes,2,opt,name=move_to_package,json=moveToPackage,proto3" json:"move_to_package,omitempty"` -} - -func (x *FileMigrateAnnotation) Reset() { - *x = FileMigrateAnnotation{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_annotations_v3_migrate_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FileMigrateAnnotation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FileMigrateAnnotation) ProtoMessage() {} - -func (x *FileMigrateAnnotation) ProtoReflect() protoreflect.Message { - mi := &file_xds_annotations_v3_migrate_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FileMigrateAnnotation.ProtoReflect.Descriptor instead. -func (*FileMigrateAnnotation) Descriptor() ([]byte, []int) { - return file_xds_annotations_v3_migrate_proto_rawDescGZIP(), []int{2} -} - -func (x *FileMigrateAnnotation) GetMoveToPackage() string { - if x != nil { - return x.MoveToPackage - } - return "" -} - -var file_xds_annotations_v3_migrate_proto_extTypes = []protoimpl.ExtensionInfo{ - { - ExtendedType: (*descriptorpb.MessageOptions)(nil), - ExtensionType: (*MigrateAnnotation)(nil), - Field: 112948430, - Name: "xds.annotations.v3.message_migrate", - Tag: "bytes,112948430,opt,name=message_migrate", - Filename: "xds/annotations/v3/migrate.proto", - }, - { - ExtendedType: (*descriptorpb.FieldOptions)(nil), - ExtensionType: (*FieldMigrateAnnotation)(nil), - Field: 112948430, - Name: "xds.annotations.v3.field_migrate", - Tag: "bytes,112948430,opt,name=field_migrate", - Filename: "xds/annotations/v3/migrate.proto", - }, - { - ExtendedType: (*descriptorpb.EnumOptions)(nil), - ExtensionType: (*MigrateAnnotation)(nil), - Field: 112948430, - Name: "xds.annotations.v3.enum_migrate", - Tag: "bytes,112948430,opt,name=enum_migrate", - Filename: "xds/annotations/v3/migrate.proto", - }, - { - ExtendedType: (*descriptorpb.EnumValueOptions)(nil), - ExtensionType: (*MigrateAnnotation)(nil), - Field: 112948430, - Name: "xds.annotations.v3.enum_value_migrate", - Tag: "bytes,112948430,opt,name=enum_value_migrate", - Filename: "xds/annotations/v3/migrate.proto", - }, - { - ExtendedType: (*descriptorpb.FileOptions)(nil), - ExtensionType: (*FileMigrateAnnotation)(nil), - Field: 112948430, - Name: "xds.annotations.v3.file_migrate", - Tag: "bytes,112948430,opt,name=file_migrate", - Filename: "xds/annotations/v3/migrate.proto", - }, -} - -// Extension fields to descriptorpb.MessageOptions. -var ( - // optional xds.annotations.v3.MigrateAnnotation message_migrate = 112948430; - E_MessageMigrate = &file_xds_annotations_v3_migrate_proto_extTypes[0] -) - -// Extension fields to descriptorpb.FieldOptions. -var ( - // optional xds.annotations.v3.FieldMigrateAnnotation field_migrate = 112948430; - E_FieldMigrate = &file_xds_annotations_v3_migrate_proto_extTypes[1] -) - -// Extension fields to descriptorpb.EnumOptions. -var ( - // optional xds.annotations.v3.MigrateAnnotation enum_migrate = 112948430; - E_EnumMigrate = &file_xds_annotations_v3_migrate_proto_extTypes[2] -) - -// Extension fields to descriptorpb.EnumValueOptions. -var ( - // optional xds.annotations.v3.MigrateAnnotation enum_value_migrate = 112948430; - E_EnumValueMigrate = &file_xds_annotations_v3_migrate_proto_extTypes[3] -) - -// Extension fields to descriptorpb.FileOptions. -var ( - // optional xds.annotations.v3.FileMigrateAnnotation file_migrate = 112948430; - E_FileMigrate = &file_xds_annotations_v3_migrate_proto_extTypes[4] -) - -var File_xds_annotations_v3_migrate_proto protoreflect.FileDescriptor - -var file_xds_annotations_v3_migrate_proto_rawDesc = []byte{ - 0x0a, 0x20, 0x78, 0x64, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2f, 0x76, 0x33, 0x2f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x12, 0x78, 0x64, 0x73, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x33, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2b, 0x0a, 0x11, 0x4d, 0x69, 0x67, 0x72, - 0x61, 0x74, 0x65, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, - 0x06, 0x72, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, - 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x59, 0x0a, 0x16, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x69, - 0x67, 0x72, 0x61, 0x74, 0x65, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x72, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x6e, 0x65, 0x6f, 0x66, - 0x5f, 0x70, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0e, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x50, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x69, 0x6f, 0x6e, - 0x22, 0x3f, 0x0a, 0x15, 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x41, - 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0f, 0x6d, 0x6f, 0x76, - 0x65, 0x5f, 0x74, 0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0d, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x6f, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, - 0x65, 0x3a, 0x72, 0x0a, 0x0f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x6d, 0x69, 0x67, - 0x72, 0x61, 0x74, 0x65, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xce, 0xe9, 0xed, 0x35, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, - 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x41, 0x6e, 0x6e, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4d, 0x69, - 0x67, 0x72, 0x61, 0x74, 0x65, 0x3a, 0x71, 0x0a, 0x0d, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, - 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xce, 0xe9, 0xed, 0x35, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, - 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x76, 0x33, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, - 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x66, 0x69, 0x65, 0x6c, - 0x64, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x3a, 0x69, 0x0a, 0x0c, 0x65, 0x6e, 0x75, 0x6d, - 0x5f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xce, 0xe9, 0xed, 0x35, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x25, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x41, 0x6e, 0x6e, 0x6f, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x65, 0x6e, 0x75, 0x6d, 0x4d, 0x69, 0x67, 0x72, - 0x61, 0x74, 0x65, 0x3a, 0x79, 0x0a, 0x12, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x5f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x12, 0x21, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xce, 0xe9, 0xed, - 0x35, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x69, 0x67, 0x72, 0x61, - 0x74, 0x65, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x10, 0x65, 0x6e, - 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x3a, 0x6d, - 0x0a, 0x0c, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x12, 0x1c, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xce, 0xe9, 0xed, - 0x35, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x33, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4d, - 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x0b, 0x66, 0x69, 0x6c, 0x65, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x42, 0x2b, 0x5a, - 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6e, 0x63, 0x66, - 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_xds_annotations_v3_migrate_proto_rawDescOnce sync.Once - file_xds_annotations_v3_migrate_proto_rawDescData = file_xds_annotations_v3_migrate_proto_rawDesc -) - -func file_xds_annotations_v3_migrate_proto_rawDescGZIP() []byte { - file_xds_annotations_v3_migrate_proto_rawDescOnce.Do(func() { - file_xds_annotations_v3_migrate_proto_rawDescData = protoimpl.X.CompressGZIP(file_xds_annotations_v3_migrate_proto_rawDescData) - }) - return file_xds_annotations_v3_migrate_proto_rawDescData -} - -var file_xds_annotations_v3_migrate_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_xds_annotations_v3_migrate_proto_goTypes = []interface{}{ - (*MigrateAnnotation)(nil), // 0: xds.annotations.v3.MigrateAnnotation - (*FieldMigrateAnnotation)(nil), // 1: xds.annotations.v3.FieldMigrateAnnotation - (*FileMigrateAnnotation)(nil), // 2: xds.annotations.v3.FileMigrateAnnotation - (*descriptorpb.MessageOptions)(nil), // 3: google.protobuf.MessageOptions - (*descriptorpb.FieldOptions)(nil), // 4: google.protobuf.FieldOptions - (*descriptorpb.EnumOptions)(nil), // 5: google.protobuf.EnumOptions - (*descriptorpb.EnumValueOptions)(nil), // 6: google.protobuf.EnumValueOptions - (*descriptorpb.FileOptions)(nil), // 7: google.protobuf.FileOptions -} -var file_xds_annotations_v3_migrate_proto_depIdxs = []int32{ - 3, // 0: xds.annotations.v3.message_migrate:extendee -> google.protobuf.MessageOptions - 4, // 1: xds.annotations.v3.field_migrate:extendee -> google.protobuf.FieldOptions - 5, // 2: xds.annotations.v3.enum_migrate:extendee -> google.protobuf.EnumOptions - 6, // 3: xds.annotations.v3.enum_value_migrate:extendee -> google.protobuf.EnumValueOptions - 7, // 4: xds.annotations.v3.file_migrate:extendee -> google.protobuf.FileOptions - 0, // 5: xds.annotations.v3.message_migrate:type_name -> xds.annotations.v3.MigrateAnnotation - 1, // 6: xds.annotations.v3.field_migrate:type_name -> xds.annotations.v3.FieldMigrateAnnotation - 0, // 7: xds.annotations.v3.enum_migrate:type_name -> xds.annotations.v3.MigrateAnnotation - 0, // 8: xds.annotations.v3.enum_value_migrate:type_name -> xds.annotations.v3.MigrateAnnotation - 2, // 9: xds.annotations.v3.file_migrate:type_name -> xds.annotations.v3.FileMigrateAnnotation - 10, // [10:10] is the sub-list for method output_type - 10, // [10:10] is the sub-list for method input_type - 5, // [5:10] is the sub-list for extension type_name - 0, // [0:5] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_xds_annotations_v3_migrate_proto_init() } -func file_xds_annotations_v3_migrate_proto_init() { - if File_xds_annotations_v3_migrate_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_xds_annotations_v3_migrate_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MigrateAnnotation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_annotations_v3_migrate_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FieldMigrateAnnotation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_annotations_v3_migrate_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileMigrateAnnotation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_xds_annotations_v3_migrate_proto_rawDesc, - NumEnums: 0, - NumMessages: 3, - NumExtensions: 5, - NumServices: 0, - }, - GoTypes: file_xds_annotations_v3_migrate_proto_goTypes, - DependencyIndexes: file_xds_annotations_v3_migrate_proto_depIdxs, - MessageInfos: file_xds_annotations_v3_migrate_proto_msgTypes, - ExtensionInfos: file_xds_annotations_v3_migrate_proto_extTypes, - }.Build() - File_xds_annotations_v3_migrate_proto = out.File - file_xds_annotations_v3_migrate_proto_rawDesc = nil - file_xds_annotations_v3_migrate_proto_goTypes = nil - file_xds_annotations_v3_migrate_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/xds/annotations/v3/migrate.pb.validate.go b/vendor/github.com/cncf/xds/go/xds/annotations/v3/migrate.pb.validate.go deleted file mode 100644 index d57d77824..000000000 --- a/vendor/github.com/cncf/xds/go/xds/annotations/v3/migrate.pb.validate.go +++ /dev/null @@ -1,350 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: xds/annotations/v3/migrate.proto - -package v3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on MigrateAnnotation with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *MigrateAnnotation) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on MigrateAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// MigrateAnnotationMultiError, or nil if none found. -func (m *MigrateAnnotation) ValidateAll() error { - return m.validate(true) -} - -func (m *MigrateAnnotation) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Rename - - if len(errors) > 0 { - return MigrateAnnotationMultiError(errors) - } - - return nil -} - -// MigrateAnnotationMultiError is an error wrapping multiple validation errors -// returned by MigrateAnnotation.ValidateAll() if the designated constraints -// aren't met. -type MigrateAnnotationMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m MigrateAnnotationMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m MigrateAnnotationMultiError) AllErrors() []error { return m } - -// MigrateAnnotationValidationError is the validation error returned by -// MigrateAnnotation.Validate if the designated constraints aren't met. -type MigrateAnnotationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e MigrateAnnotationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e MigrateAnnotationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e MigrateAnnotationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e MigrateAnnotationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e MigrateAnnotationValidationError) ErrorName() string { - return "MigrateAnnotationValidationError" -} - -// Error satisfies the builtin error interface -func (e MigrateAnnotationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMigrateAnnotation.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = MigrateAnnotationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = MigrateAnnotationValidationError{} - -// Validate checks the field values on FieldMigrateAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *FieldMigrateAnnotation) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on FieldMigrateAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// FieldMigrateAnnotationMultiError, or nil if none found. -func (m *FieldMigrateAnnotation) ValidateAll() error { - return m.validate(true) -} - -func (m *FieldMigrateAnnotation) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Rename - - // no validation rules for OneofPromotion - - if len(errors) > 0 { - return FieldMigrateAnnotationMultiError(errors) - } - - return nil -} - -// FieldMigrateAnnotationMultiError is an error wrapping multiple validation -// errors returned by FieldMigrateAnnotation.ValidateAll() if the designated -// constraints aren't met. -type FieldMigrateAnnotationMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m FieldMigrateAnnotationMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m FieldMigrateAnnotationMultiError) AllErrors() []error { return m } - -// FieldMigrateAnnotationValidationError is the validation error returned by -// FieldMigrateAnnotation.Validate if the designated constraints aren't met. -type FieldMigrateAnnotationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e FieldMigrateAnnotationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e FieldMigrateAnnotationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e FieldMigrateAnnotationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e FieldMigrateAnnotationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e FieldMigrateAnnotationValidationError) ErrorName() string { - return "FieldMigrateAnnotationValidationError" -} - -// Error satisfies the builtin error interface -func (e FieldMigrateAnnotationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sFieldMigrateAnnotation.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = FieldMigrateAnnotationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = FieldMigrateAnnotationValidationError{} - -// Validate checks the field values on FileMigrateAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *FileMigrateAnnotation) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on FileMigrateAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// FileMigrateAnnotationMultiError, or nil if none found. -func (m *FileMigrateAnnotation) ValidateAll() error { - return m.validate(true) -} - -func (m *FileMigrateAnnotation) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for MoveToPackage - - if len(errors) > 0 { - return FileMigrateAnnotationMultiError(errors) - } - - return nil -} - -// FileMigrateAnnotationMultiError is an error wrapping multiple validation -// errors returned by FileMigrateAnnotation.ValidateAll() if the designated -// constraints aren't met. -type FileMigrateAnnotationMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m FileMigrateAnnotationMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m FileMigrateAnnotationMultiError) AllErrors() []error { return m } - -// FileMigrateAnnotationValidationError is the validation error returned by -// FileMigrateAnnotation.Validate if the designated constraints aren't met. -type FileMigrateAnnotationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e FileMigrateAnnotationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e FileMigrateAnnotationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e FileMigrateAnnotationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e FileMigrateAnnotationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e FileMigrateAnnotationValidationError) ErrorName() string { - return "FileMigrateAnnotationValidationError" -} - -// Error satisfies the builtin error interface -func (e FileMigrateAnnotationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sFileMigrateAnnotation.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = FileMigrateAnnotationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = FileMigrateAnnotationValidationError{} diff --git a/vendor/github.com/cncf/xds/go/xds/annotations/v3/security.pb.go b/vendor/github.com/cncf/xds/go/xds/annotations/v3/security.pb.go deleted file mode 100644 index 61df6890b..000000000 --- a/vendor/github.com/cncf/xds/go/xds/annotations/v3/security.pb.go +++ /dev/null @@ -1,197 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: xds/annotations/v3/security.proto - -package v3 - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - descriptorpb "google.golang.org/protobuf/types/descriptorpb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type FieldSecurityAnnotation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ConfigureForUntrustedDownstream bool `protobuf:"varint,1,opt,name=configure_for_untrusted_downstream,json=configureForUntrustedDownstream,proto3" json:"configure_for_untrusted_downstream,omitempty"` - ConfigureForUntrustedUpstream bool `protobuf:"varint,2,opt,name=configure_for_untrusted_upstream,json=configureForUntrustedUpstream,proto3" json:"configure_for_untrusted_upstream,omitempty"` -} - -func (x *FieldSecurityAnnotation) Reset() { - *x = FieldSecurityAnnotation{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_annotations_v3_security_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FieldSecurityAnnotation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FieldSecurityAnnotation) ProtoMessage() {} - -func (x *FieldSecurityAnnotation) ProtoReflect() protoreflect.Message { - mi := &file_xds_annotations_v3_security_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FieldSecurityAnnotation.ProtoReflect.Descriptor instead. -func (*FieldSecurityAnnotation) Descriptor() ([]byte, []int) { - return file_xds_annotations_v3_security_proto_rawDescGZIP(), []int{0} -} - -func (x *FieldSecurityAnnotation) GetConfigureForUntrustedDownstream() bool { - if x != nil { - return x.ConfigureForUntrustedDownstream - } - return false -} - -func (x *FieldSecurityAnnotation) GetConfigureForUntrustedUpstream() bool { - if x != nil { - return x.ConfigureForUntrustedUpstream - } - return false -} - -var file_xds_annotations_v3_security_proto_extTypes = []protoimpl.ExtensionInfo{ - { - ExtendedType: (*descriptorpb.FieldOptions)(nil), - ExtensionType: (*FieldSecurityAnnotation)(nil), - Field: 99044135, - Name: "xds.annotations.v3.security", - Tag: "bytes,99044135,opt,name=security", - Filename: "xds/annotations/v3/security.proto", - }, -} - -// Extension fields to descriptorpb.FieldOptions. -var ( - // optional xds.annotations.v3.FieldSecurityAnnotation security = 99044135; - E_Security = &file_xds_annotations_v3_security_proto_extTypes[0] -) - -var File_xds_annotations_v3_security_proto protoreflect.FileDescriptor - -var file_xds_annotations_v3_security_proto_rawDesc = []byte{ - 0x0a, 0x21, 0x78, 0x64, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x78, 0x64, 0x73, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x33, 0x1a, 0x1f, 0x78, 0x64, 0x73, 0x2f, 0x61, 0x6e, 0x6e, - 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xaf, 0x01, 0x0a, 0x17, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x41, 0x6e, 0x6e, 0x6f, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4b, 0x0a, 0x22, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x75, 0x72, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x5f, 0x75, 0x6e, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, - 0x64, 0x5f, 0x64, 0x6f, 0x77, 0x6e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x1f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x46, 0x6f, 0x72, - 0x55, 0x6e, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, 0x64, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x74, 0x72, - 0x65, 0x61, 0x6d, 0x12, 0x47, 0x0a, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, - 0x5f, 0x66, 0x6f, 0x72, 0x5f, 0x75, 0x6e, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x75, - 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x1d, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x46, 0x6f, 0x72, 0x55, 0x6e, 0x74, 0x72, 0x75, - 0x73, 0x74, 0x65, 0x64, 0x55, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x3a, 0x69, 0x0a, 0x08, - 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, - 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xa7, 0x96, 0x9d, 0x2f, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x2b, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2e, 0x76, 0x33, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, - 0x69, 0x74, 0x79, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x73, - 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x42, 0x33, 0xd2, 0xc6, 0xa4, 0xe1, 0x06, 0x02, 0x08, - 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6e, - 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x61, 0x6e, - 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x33, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_xds_annotations_v3_security_proto_rawDescOnce sync.Once - file_xds_annotations_v3_security_proto_rawDescData = file_xds_annotations_v3_security_proto_rawDesc -) - -func file_xds_annotations_v3_security_proto_rawDescGZIP() []byte { - file_xds_annotations_v3_security_proto_rawDescOnce.Do(func() { - file_xds_annotations_v3_security_proto_rawDescData = protoimpl.X.CompressGZIP(file_xds_annotations_v3_security_proto_rawDescData) - }) - return file_xds_annotations_v3_security_proto_rawDescData -} - -var file_xds_annotations_v3_security_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_xds_annotations_v3_security_proto_goTypes = []interface{}{ - (*FieldSecurityAnnotation)(nil), // 0: xds.annotations.v3.FieldSecurityAnnotation - (*descriptorpb.FieldOptions)(nil), // 1: google.protobuf.FieldOptions -} -var file_xds_annotations_v3_security_proto_depIdxs = []int32{ - 1, // 0: xds.annotations.v3.security:extendee -> google.protobuf.FieldOptions - 0, // 1: xds.annotations.v3.security:type_name -> xds.annotations.v3.FieldSecurityAnnotation - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 1, // [1:2] is the sub-list for extension type_name - 0, // [0:1] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_xds_annotations_v3_security_proto_init() } -func file_xds_annotations_v3_security_proto_init() { - if File_xds_annotations_v3_security_proto != nil { - return - } - file_xds_annotations_v3_status_proto_init() - if !protoimpl.UnsafeEnabled { - file_xds_annotations_v3_security_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FieldSecurityAnnotation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_xds_annotations_v3_security_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 1, - NumServices: 0, - }, - GoTypes: file_xds_annotations_v3_security_proto_goTypes, - DependencyIndexes: file_xds_annotations_v3_security_proto_depIdxs, - MessageInfos: file_xds_annotations_v3_security_proto_msgTypes, - ExtensionInfos: file_xds_annotations_v3_security_proto_extTypes, - }.Build() - File_xds_annotations_v3_security_proto = out.File - file_xds_annotations_v3_security_proto_rawDesc = nil - file_xds_annotations_v3_security_proto_goTypes = nil - file_xds_annotations_v3_security_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/xds/annotations/v3/security.pb.validate.go b/vendor/github.com/cncf/xds/go/xds/annotations/v3/security.pb.validate.go deleted file mode 100644 index ac0143f27..000000000 --- a/vendor/github.com/cncf/xds/go/xds/annotations/v3/security.pb.validate.go +++ /dev/null @@ -1,142 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: xds/annotations/v3/security.proto - -package v3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on FieldSecurityAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *FieldSecurityAnnotation) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on FieldSecurityAnnotation with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// FieldSecurityAnnotationMultiError, or nil if none found. -func (m *FieldSecurityAnnotation) ValidateAll() error { - return m.validate(true) -} - -func (m *FieldSecurityAnnotation) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ConfigureForUntrustedDownstream - - // no validation rules for ConfigureForUntrustedUpstream - - if len(errors) > 0 { - return FieldSecurityAnnotationMultiError(errors) - } - - return nil -} - -// FieldSecurityAnnotationMultiError is an error wrapping multiple validation -// errors returned by FieldSecurityAnnotation.ValidateAll() if the designated -// constraints aren't met. -type FieldSecurityAnnotationMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m FieldSecurityAnnotationMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m FieldSecurityAnnotationMultiError) AllErrors() []error { return m } - -// FieldSecurityAnnotationValidationError is the validation error returned by -// FieldSecurityAnnotation.Validate if the designated constraints aren't met. -type FieldSecurityAnnotationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e FieldSecurityAnnotationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e FieldSecurityAnnotationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e FieldSecurityAnnotationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e FieldSecurityAnnotationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e FieldSecurityAnnotationValidationError) ErrorName() string { - return "FieldSecurityAnnotationValidationError" -} - -// Error satisfies the builtin error interface -func (e FieldSecurityAnnotationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sFieldSecurityAnnotation.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = FieldSecurityAnnotationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = FieldSecurityAnnotationValidationError{} diff --git a/vendor/github.com/cncf/xds/go/xds/annotations/v3/sensitive.pb.go b/vendor/github.com/cncf/xds/go/xds/annotations/v3/sensitive.pb.go deleted file mode 100644 index 274eace05..000000000 --- a/vendor/github.com/cncf/xds/go/xds/annotations/v3/sensitive.pb.go +++ /dev/null @@ -1,93 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: xds/annotations/v3/sensitive.proto - -package v3 - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - descriptorpb "google.golang.org/protobuf/types/descriptorpb" - reflect "reflect" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -var file_xds_annotations_v3_sensitive_proto_extTypes = []protoimpl.ExtensionInfo{ - { - ExtendedType: (*descriptorpb.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 61008053, - Name: "xds.annotations.v3.sensitive", - Tag: "varint,61008053,opt,name=sensitive", - Filename: "xds/annotations/v3/sensitive.proto", - }, -} - -// Extension fields to descriptorpb.FieldOptions. -var ( - // optional bool sensitive = 61008053; - E_Sensitive = &file_xds_annotations_v3_sensitive_proto_extTypes[0] -) - -var File_xds_annotations_v3_sensitive_proto protoreflect.FileDescriptor - -var file_xds_annotations_v3_sensitive_proto_rawDesc = []byte{ - 0x0a, 0x22, 0x78, 0x64, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x78, 0x64, 0x73, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x33, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3a, 0x3e, 0x0a, 0x09, 0x73, 0x65, - 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xb5, 0xd1, 0x8b, 0x1d, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x09, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x42, 0x2b, 0x5a, 0x29, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6e, 0x63, 0x66, 0x2f, 0x78, 0x64, - 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var file_xds_annotations_v3_sensitive_proto_goTypes = []interface{}{ - (*descriptorpb.FieldOptions)(nil), // 0: google.protobuf.FieldOptions -} -var file_xds_annotations_v3_sensitive_proto_depIdxs = []int32{ - 0, // 0: xds.annotations.v3.sensitive:extendee -> google.protobuf.FieldOptions - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 0, // [0:1] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_xds_annotations_v3_sensitive_proto_init() } -func file_xds_annotations_v3_sensitive_proto_init() { - if File_xds_annotations_v3_sensitive_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_xds_annotations_v3_sensitive_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 1, - NumServices: 0, - }, - GoTypes: file_xds_annotations_v3_sensitive_proto_goTypes, - DependencyIndexes: file_xds_annotations_v3_sensitive_proto_depIdxs, - ExtensionInfos: file_xds_annotations_v3_sensitive_proto_extTypes, - }.Build() - File_xds_annotations_v3_sensitive_proto = out.File - file_xds_annotations_v3_sensitive_proto_rawDesc = nil - file_xds_annotations_v3_sensitive_proto_goTypes = nil - file_xds_annotations_v3_sensitive_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/xds/annotations/v3/sensitive.pb.validate.go b/vendor/github.com/cncf/xds/go/xds/annotations/v3/sensitive.pb.validate.go deleted file mode 100644 index c101d3acc..000000000 --- a/vendor/github.com/cncf/xds/go/xds/annotations/v3/sensitive.pb.validate.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: xds/annotations/v3/sensitive.proto - -package v3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) diff --git a/vendor/github.com/cncf/xds/go/xds/annotations/v3/status.pb.go b/vendor/github.com/cncf/xds/go/xds/annotations/v3/status.pb.go deleted file mode 100644 index 2497e0b2f..000000000 --- a/vendor/github.com/cncf/xds/go/xds/annotations/v3/status.pb.go +++ /dev/null @@ -1,495 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: xds/annotations/v3/status.proto - -package v3 - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - descriptorpb "google.golang.org/protobuf/types/descriptorpb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type PackageVersionStatus int32 - -const ( - PackageVersionStatus_UNKNOWN PackageVersionStatus = 0 - PackageVersionStatus_FROZEN PackageVersionStatus = 1 - PackageVersionStatus_ACTIVE PackageVersionStatus = 2 - PackageVersionStatus_NEXT_MAJOR_VERSION_CANDIDATE PackageVersionStatus = 3 -) - -// Enum value maps for PackageVersionStatus. -var ( - PackageVersionStatus_name = map[int32]string{ - 0: "UNKNOWN", - 1: "FROZEN", - 2: "ACTIVE", - 3: "NEXT_MAJOR_VERSION_CANDIDATE", - } - PackageVersionStatus_value = map[string]int32{ - "UNKNOWN": 0, - "FROZEN": 1, - "ACTIVE": 2, - "NEXT_MAJOR_VERSION_CANDIDATE": 3, - } -) - -func (x PackageVersionStatus) Enum() *PackageVersionStatus { - p := new(PackageVersionStatus) - *p = x - return p -} - -func (x PackageVersionStatus) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (PackageVersionStatus) Descriptor() protoreflect.EnumDescriptor { - return file_xds_annotations_v3_status_proto_enumTypes[0].Descriptor() -} - -func (PackageVersionStatus) Type() protoreflect.EnumType { - return &file_xds_annotations_v3_status_proto_enumTypes[0] -} - -func (x PackageVersionStatus) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use PackageVersionStatus.Descriptor instead. -func (PackageVersionStatus) EnumDescriptor() ([]byte, []int) { - return file_xds_annotations_v3_status_proto_rawDescGZIP(), []int{0} -} - -type FileStatusAnnotation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - WorkInProgress bool `protobuf:"varint,1,opt,name=work_in_progress,json=workInProgress,proto3" json:"work_in_progress,omitempty"` -} - -func (x *FileStatusAnnotation) Reset() { - *x = FileStatusAnnotation{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_annotations_v3_status_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FileStatusAnnotation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FileStatusAnnotation) ProtoMessage() {} - -func (x *FileStatusAnnotation) ProtoReflect() protoreflect.Message { - mi := &file_xds_annotations_v3_status_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FileStatusAnnotation.ProtoReflect.Descriptor instead. -func (*FileStatusAnnotation) Descriptor() ([]byte, []int) { - return file_xds_annotations_v3_status_proto_rawDescGZIP(), []int{0} -} - -func (x *FileStatusAnnotation) GetWorkInProgress() bool { - if x != nil { - return x.WorkInProgress - } - return false -} - -type MessageStatusAnnotation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - WorkInProgress bool `protobuf:"varint,1,opt,name=work_in_progress,json=workInProgress,proto3" json:"work_in_progress,omitempty"` -} - -func (x *MessageStatusAnnotation) Reset() { - *x = MessageStatusAnnotation{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_annotations_v3_status_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessageStatusAnnotation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessageStatusAnnotation) ProtoMessage() {} - -func (x *MessageStatusAnnotation) ProtoReflect() protoreflect.Message { - mi := &file_xds_annotations_v3_status_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessageStatusAnnotation.ProtoReflect.Descriptor instead. -func (*MessageStatusAnnotation) Descriptor() ([]byte, []int) { - return file_xds_annotations_v3_status_proto_rawDescGZIP(), []int{1} -} - -func (x *MessageStatusAnnotation) GetWorkInProgress() bool { - if x != nil { - return x.WorkInProgress - } - return false -} - -type FieldStatusAnnotation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - WorkInProgress bool `protobuf:"varint,1,opt,name=work_in_progress,json=workInProgress,proto3" json:"work_in_progress,omitempty"` -} - -func (x *FieldStatusAnnotation) Reset() { - *x = FieldStatusAnnotation{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_annotations_v3_status_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FieldStatusAnnotation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FieldStatusAnnotation) ProtoMessage() {} - -func (x *FieldStatusAnnotation) ProtoReflect() protoreflect.Message { - mi := &file_xds_annotations_v3_status_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FieldStatusAnnotation.ProtoReflect.Descriptor instead. -func (*FieldStatusAnnotation) Descriptor() ([]byte, []int) { - return file_xds_annotations_v3_status_proto_rawDescGZIP(), []int{2} -} - -func (x *FieldStatusAnnotation) GetWorkInProgress() bool { - if x != nil { - return x.WorkInProgress - } - return false -} - -type StatusAnnotation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - WorkInProgress bool `protobuf:"varint,1,opt,name=work_in_progress,json=workInProgress,proto3" json:"work_in_progress,omitempty"` - PackageVersionStatus PackageVersionStatus `protobuf:"varint,2,opt,name=package_version_status,json=packageVersionStatus,proto3,enum=xds.annotations.v3.PackageVersionStatus" json:"package_version_status,omitempty"` -} - -func (x *StatusAnnotation) Reset() { - *x = StatusAnnotation{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_annotations_v3_status_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StatusAnnotation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StatusAnnotation) ProtoMessage() {} - -func (x *StatusAnnotation) ProtoReflect() protoreflect.Message { - mi := &file_xds_annotations_v3_status_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StatusAnnotation.ProtoReflect.Descriptor instead. -func (*StatusAnnotation) Descriptor() ([]byte, []int) { - return file_xds_annotations_v3_status_proto_rawDescGZIP(), []int{3} -} - -func (x *StatusAnnotation) GetWorkInProgress() bool { - if x != nil { - return x.WorkInProgress - } - return false -} - -func (x *StatusAnnotation) GetPackageVersionStatus() PackageVersionStatus { - if x != nil { - return x.PackageVersionStatus - } - return PackageVersionStatus_UNKNOWN -} - -var file_xds_annotations_v3_status_proto_extTypes = []protoimpl.ExtensionInfo{ - { - ExtendedType: (*descriptorpb.FileOptions)(nil), - ExtensionType: (*FileStatusAnnotation)(nil), - Field: 226829418, - Name: "xds.annotations.v3.file_status", - Tag: "bytes,226829418,opt,name=file_status", - Filename: "xds/annotations/v3/status.proto", - }, - { - ExtendedType: (*descriptorpb.MessageOptions)(nil), - ExtensionType: (*MessageStatusAnnotation)(nil), - Field: 226829418, - Name: "xds.annotations.v3.message_status", - Tag: "bytes,226829418,opt,name=message_status", - Filename: "xds/annotations/v3/status.proto", - }, - { - ExtendedType: (*descriptorpb.FieldOptions)(nil), - ExtensionType: (*FieldStatusAnnotation)(nil), - Field: 226829418, - Name: "xds.annotations.v3.field_status", - Tag: "bytes,226829418,opt,name=field_status", - Filename: "xds/annotations/v3/status.proto", - }, -} - -// Extension fields to descriptorpb.FileOptions. -var ( - // optional xds.annotations.v3.FileStatusAnnotation file_status = 226829418; - E_FileStatus = &file_xds_annotations_v3_status_proto_extTypes[0] -) - -// Extension fields to descriptorpb.MessageOptions. -var ( - // optional xds.annotations.v3.MessageStatusAnnotation message_status = 226829418; - E_MessageStatus = &file_xds_annotations_v3_status_proto_extTypes[1] -) - -// Extension fields to descriptorpb.FieldOptions. -var ( - // optional xds.annotations.v3.FieldStatusAnnotation field_status = 226829418; - E_FieldStatus = &file_xds_annotations_v3_status_proto_extTypes[2] -) - -var File_xds_annotations_v3_status_proto protoreflect.FileDescriptor - -var file_xds_annotations_v3_status_proto_rawDesc = []byte{ - 0x0a, 0x1f, 0x78, 0x64, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x12, 0x78, 0x64, 0x73, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2e, 0x76, 0x33, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, - 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x40, 0x0a, 0x14, 0x46, 0x69, 0x6c, 0x65, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x28, 0x0a, 0x10, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x67, 0x72, - 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x49, - 0x6e, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x22, 0x43, 0x0a, 0x17, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x10, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x69, 0x6e, 0x5f, - 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, - 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x22, 0x41, - 0x0a, 0x15, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x41, 0x6e, 0x6e, - 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x10, 0x77, 0x6f, 0x72, 0x6b, 0x5f, - 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, - 0x73, 0x22, 0x9c, 0x01, 0x0a, 0x10, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x41, 0x6e, 0x6e, 0x6f, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x10, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x69, - 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, - 0x12, 0x5e, 0x0a, 0x16, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x28, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x14, 0x70, 0x61, 0x63, 0x6b, - 0x61, 0x67, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x2a, 0x5d, 0x0a, 0x14, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, - 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x52, 0x4f, 0x5a, 0x45, 0x4e, 0x10, - 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x02, 0x12, 0x20, 0x0a, - 0x1c, 0x4e, 0x45, 0x58, 0x54, 0x5f, 0x4d, 0x41, 0x4a, 0x4f, 0x52, 0x5f, 0x56, 0x45, 0x52, 0x53, - 0x49, 0x4f, 0x4e, 0x5f, 0x43, 0x41, 0x4e, 0x44, 0x49, 0x44, 0x41, 0x54, 0x45, 0x10, 0x03, 0x3a, - 0x6a, 0x0a, 0x0b, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xea, 0xc8, 0x94, - 0x6c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x33, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x0a, 0x66, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x3a, 0x76, 0x0a, 0x0e, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1f, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xea, - 0xc8, 0x94, 0x6c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x61, 0x6e, - 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x3a, 0x6e, 0x0a, 0x0c, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x73, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x18, 0xea, 0xc8, 0x94, 0x6c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x78, 0x64, - 0x73, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x33, - 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x41, 0x6e, 0x6e, 0x6f, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x42, 0x2b, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x63, 0x6e, 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x78, 0x64, - 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x33, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_xds_annotations_v3_status_proto_rawDescOnce sync.Once - file_xds_annotations_v3_status_proto_rawDescData = file_xds_annotations_v3_status_proto_rawDesc -) - -func file_xds_annotations_v3_status_proto_rawDescGZIP() []byte { - file_xds_annotations_v3_status_proto_rawDescOnce.Do(func() { - file_xds_annotations_v3_status_proto_rawDescData = protoimpl.X.CompressGZIP(file_xds_annotations_v3_status_proto_rawDescData) - }) - return file_xds_annotations_v3_status_proto_rawDescData -} - -var file_xds_annotations_v3_status_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_xds_annotations_v3_status_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_xds_annotations_v3_status_proto_goTypes = []interface{}{ - (PackageVersionStatus)(0), // 0: xds.annotations.v3.PackageVersionStatus - (*FileStatusAnnotation)(nil), // 1: xds.annotations.v3.FileStatusAnnotation - (*MessageStatusAnnotation)(nil), // 2: xds.annotations.v3.MessageStatusAnnotation - (*FieldStatusAnnotation)(nil), // 3: xds.annotations.v3.FieldStatusAnnotation - (*StatusAnnotation)(nil), // 4: xds.annotations.v3.StatusAnnotation - (*descriptorpb.FileOptions)(nil), // 5: google.protobuf.FileOptions - (*descriptorpb.MessageOptions)(nil), // 6: google.protobuf.MessageOptions - (*descriptorpb.FieldOptions)(nil), // 7: google.protobuf.FieldOptions -} -var file_xds_annotations_v3_status_proto_depIdxs = []int32{ - 0, // 0: xds.annotations.v3.StatusAnnotation.package_version_status:type_name -> xds.annotations.v3.PackageVersionStatus - 5, // 1: xds.annotations.v3.file_status:extendee -> google.protobuf.FileOptions - 6, // 2: xds.annotations.v3.message_status:extendee -> google.protobuf.MessageOptions - 7, // 3: xds.annotations.v3.field_status:extendee -> google.protobuf.FieldOptions - 1, // 4: xds.annotations.v3.file_status:type_name -> xds.annotations.v3.FileStatusAnnotation - 2, // 5: xds.annotations.v3.message_status:type_name -> xds.annotations.v3.MessageStatusAnnotation - 3, // 6: xds.annotations.v3.field_status:type_name -> xds.annotations.v3.FieldStatusAnnotation - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] is the sub-list for method input_type - 4, // [4:7] is the sub-list for extension type_name - 1, // [1:4] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_xds_annotations_v3_status_proto_init() } -func file_xds_annotations_v3_status_proto_init() { - if File_xds_annotations_v3_status_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_xds_annotations_v3_status_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileStatusAnnotation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_annotations_v3_status_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageStatusAnnotation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_annotations_v3_status_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FieldStatusAnnotation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_annotations_v3_status_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StatusAnnotation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_xds_annotations_v3_status_proto_rawDesc, - NumEnums: 1, - NumMessages: 4, - NumExtensions: 3, - NumServices: 0, - }, - GoTypes: file_xds_annotations_v3_status_proto_goTypes, - DependencyIndexes: file_xds_annotations_v3_status_proto_depIdxs, - EnumInfos: file_xds_annotations_v3_status_proto_enumTypes, - MessageInfos: file_xds_annotations_v3_status_proto_msgTypes, - ExtensionInfos: file_xds_annotations_v3_status_proto_extTypes, - }.Build() - File_xds_annotations_v3_status_proto = out.File - file_xds_annotations_v3_status_proto_rawDesc = nil - file_xds_annotations_v3_status_proto_goTypes = nil - file_xds_annotations_v3_status_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/xds/annotations/v3/status.pb.validate.go b/vendor/github.com/cncf/xds/go/xds/annotations/v3/status.pb.validate.go deleted file mode 100644 index a87dbee8d..000000000 --- a/vendor/github.com/cncf/xds/go/xds/annotations/v3/status.pb.validate.go +++ /dev/null @@ -1,452 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: xds/annotations/v3/status.proto - -package v3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on FileStatusAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *FileStatusAnnotation) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on FileStatusAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// FileStatusAnnotationMultiError, or nil if none found. -func (m *FileStatusAnnotation) ValidateAll() error { - return m.validate(true) -} - -func (m *FileStatusAnnotation) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for WorkInProgress - - if len(errors) > 0 { - return FileStatusAnnotationMultiError(errors) - } - - return nil -} - -// FileStatusAnnotationMultiError is an error wrapping multiple validation -// errors returned by FileStatusAnnotation.ValidateAll() if the designated -// constraints aren't met. -type FileStatusAnnotationMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m FileStatusAnnotationMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m FileStatusAnnotationMultiError) AllErrors() []error { return m } - -// FileStatusAnnotationValidationError is the validation error returned by -// FileStatusAnnotation.Validate if the designated constraints aren't met. -type FileStatusAnnotationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e FileStatusAnnotationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e FileStatusAnnotationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e FileStatusAnnotationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e FileStatusAnnotationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e FileStatusAnnotationValidationError) ErrorName() string { - return "FileStatusAnnotationValidationError" -} - -// Error satisfies the builtin error interface -func (e FileStatusAnnotationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sFileStatusAnnotation.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = FileStatusAnnotationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = FileStatusAnnotationValidationError{} - -// Validate checks the field values on MessageStatusAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *MessageStatusAnnotation) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on MessageStatusAnnotation with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// MessageStatusAnnotationMultiError, or nil if none found. -func (m *MessageStatusAnnotation) ValidateAll() error { - return m.validate(true) -} - -func (m *MessageStatusAnnotation) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for WorkInProgress - - if len(errors) > 0 { - return MessageStatusAnnotationMultiError(errors) - } - - return nil -} - -// MessageStatusAnnotationMultiError is an error wrapping multiple validation -// errors returned by MessageStatusAnnotation.ValidateAll() if the designated -// constraints aren't met. -type MessageStatusAnnotationMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m MessageStatusAnnotationMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m MessageStatusAnnotationMultiError) AllErrors() []error { return m } - -// MessageStatusAnnotationValidationError is the validation error returned by -// MessageStatusAnnotation.Validate if the designated constraints aren't met. -type MessageStatusAnnotationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e MessageStatusAnnotationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e MessageStatusAnnotationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e MessageStatusAnnotationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e MessageStatusAnnotationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e MessageStatusAnnotationValidationError) ErrorName() string { - return "MessageStatusAnnotationValidationError" -} - -// Error satisfies the builtin error interface -func (e MessageStatusAnnotationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMessageStatusAnnotation.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = MessageStatusAnnotationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = MessageStatusAnnotationValidationError{} - -// Validate checks the field values on FieldStatusAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *FieldStatusAnnotation) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on FieldStatusAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// FieldStatusAnnotationMultiError, or nil if none found. -func (m *FieldStatusAnnotation) ValidateAll() error { - return m.validate(true) -} - -func (m *FieldStatusAnnotation) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for WorkInProgress - - if len(errors) > 0 { - return FieldStatusAnnotationMultiError(errors) - } - - return nil -} - -// FieldStatusAnnotationMultiError is an error wrapping multiple validation -// errors returned by FieldStatusAnnotation.ValidateAll() if the designated -// constraints aren't met. -type FieldStatusAnnotationMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m FieldStatusAnnotationMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m FieldStatusAnnotationMultiError) AllErrors() []error { return m } - -// FieldStatusAnnotationValidationError is the validation error returned by -// FieldStatusAnnotation.Validate if the designated constraints aren't met. -type FieldStatusAnnotationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e FieldStatusAnnotationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e FieldStatusAnnotationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e FieldStatusAnnotationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e FieldStatusAnnotationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e FieldStatusAnnotationValidationError) ErrorName() string { - return "FieldStatusAnnotationValidationError" -} - -// Error satisfies the builtin error interface -func (e FieldStatusAnnotationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sFieldStatusAnnotation.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = FieldStatusAnnotationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = FieldStatusAnnotationValidationError{} - -// Validate checks the field values on StatusAnnotation with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *StatusAnnotation) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on StatusAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// StatusAnnotationMultiError, or nil if none found. -func (m *StatusAnnotation) ValidateAll() error { - return m.validate(true) -} - -func (m *StatusAnnotation) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for WorkInProgress - - // no validation rules for PackageVersionStatus - - if len(errors) > 0 { - return StatusAnnotationMultiError(errors) - } - - return nil -} - -// StatusAnnotationMultiError is an error wrapping multiple validation errors -// returned by StatusAnnotation.ValidateAll() if the designated constraints -// aren't met. -type StatusAnnotationMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m StatusAnnotationMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m StatusAnnotationMultiError) AllErrors() []error { return m } - -// StatusAnnotationValidationError is the validation error returned by -// StatusAnnotation.Validate if the designated constraints aren't met. -type StatusAnnotationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e StatusAnnotationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e StatusAnnotationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e StatusAnnotationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e StatusAnnotationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e StatusAnnotationValidationError) ErrorName() string { return "StatusAnnotationValidationError" } - -// Error satisfies the builtin error interface -func (e StatusAnnotationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sStatusAnnotation.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = StatusAnnotationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = StatusAnnotationValidationError{} diff --git a/vendor/github.com/cncf/xds/go/xds/annotations/v3/versioning.pb.go b/vendor/github.com/cncf/xds/go/xds/annotations/v3/versioning.pb.go deleted file mode 100644 index 2307dc874..000000000 --- a/vendor/github.com/cncf/xds/go/xds/annotations/v3/versioning.pb.go +++ /dev/null @@ -1,179 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: xds/annotations/v3/versioning.proto - -package v3 - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - descriptorpb "google.golang.org/protobuf/types/descriptorpb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type VersioningAnnotation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - PreviousMessageType string `protobuf:"bytes,1,opt,name=previous_message_type,json=previousMessageType,proto3" json:"previous_message_type,omitempty"` -} - -func (x *VersioningAnnotation) Reset() { - *x = VersioningAnnotation{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_annotations_v3_versioning_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *VersioningAnnotation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*VersioningAnnotation) ProtoMessage() {} - -func (x *VersioningAnnotation) ProtoReflect() protoreflect.Message { - mi := &file_xds_annotations_v3_versioning_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use VersioningAnnotation.ProtoReflect.Descriptor instead. -func (*VersioningAnnotation) Descriptor() ([]byte, []int) { - return file_xds_annotations_v3_versioning_proto_rawDescGZIP(), []int{0} -} - -func (x *VersioningAnnotation) GetPreviousMessageType() string { - if x != nil { - return x.PreviousMessageType - } - return "" -} - -var file_xds_annotations_v3_versioning_proto_extTypes = []protoimpl.ExtensionInfo{ - { - ExtendedType: (*descriptorpb.MessageOptions)(nil), - ExtensionType: (*VersioningAnnotation)(nil), - Field: 92389011, - Name: "xds.annotations.v3.versioning", - Tag: "bytes,92389011,opt,name=versioning", - Filename: "xds/annotations/v3/versioning.proto", - }, -} - -// Extension fields to descriptorpb.MessageOptions. -var ( - // optional xds.annotations.v3.VersioningAnnotation versioning = 92389011; - E_Versioning = &file_xds_annotations_v3_versioning_proto_extTypes[0] -) - -var File_xds_annotations_v3_versioning_proto protoreflect.FileDescriptor - -var file_xds_annotations_v3_versioning_proto_rawDesc = []byte{ - 0x0a, 0x23, 0x78, 0x64, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2f, 0x76, 0x33, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x78, 0x64, 0x73, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x33, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x4a, 0x0a, 0x14, 0x56, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x32, 0x0a, 0x15, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x5f, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x13, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x6c, 0x0a, 0x0a, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x93, 0xfd, 0x86, 0x2c, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x28, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2e, 0x76, 0x33, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x41, - 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x42, 0x2b, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6e, 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, 0x6f, 0x2f, - 0x78, 0x64, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, - 0x76, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_xds_annotations_v3_versioning_proto_rawDescOnce sync.Once - file_xds_annotations_v3_versioning_proto_rawDescData = file_xds_annotations_v3_versioning_proto_rawDesc -) - -func file_xds_annotations_v3_versioning_proto_rawDescGZIP() []byte { - file_xds_annotations_v3_versioning_proto_rawDescOnce.Do(func() { - file_xds_annotations_v3_versioning_proto_rawDescData = protoimpl.X.CompressGZIP(file_xds_annotations_v3_versioning_proto_rawDescData) - }) - return file_xds_annotations_v3_versioning_proto_rawDescData -} - -var file_xds_annotations_v3_versioning_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_xds_annotations_v3_versioning_proto_goTypes = []interface{}{ - (*VersioningAnnotation)(nil), // 0: xds.annotations.v3.VersioningAnnotation - (*descriptorpb.MessageOptions)(nil), // 1: google.protobuf.MessageOptions -} -var file_xds_annotations_v3_versioning_proto_depIdxs = []int32{ - 1, // 0: xds.annotations.v3.versioning:extendee -> google.protobuf.MessageOptions - 0, // 1: xds.annotations.v3.versioning:type_name -> xds.annotations.v3.VersioningAnnotation - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 1, // [1:2] is the sub-list for extension type_name - 0, // [0:1] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_xds_annotations_v3_versioning_proto_init() } -func file_xds_annotations_v3_versioning_proto_init() { - if File_xds_annotations_v3_versioning_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_xds_annotations_v3_versioning_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*VersioningAnnotation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_xds_annotations_v3_versioning_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 1, - NumServices: 0, - }, - GoTypes: file_xds_annotations_v3_versioning_proto_goTypes, - DependencyIndexes: file_xds_annotations_v3_versioning_proto_depIdxs, - MessageInfos: file_xds_annotations_v3_versioning_proto_msgTypes, - ExtensionInfos: file_xds_annotations_v3_versioning_proto_extTypes, - }.Build() - File_xds_annotations_v3_versioning_proto = out.File - file_xds_annotations_v3_versioning_proto_rawDesc = nil - file_xds_annotations_v3_versioning_proto_goTypes = nil - file_xds_annotations_v3_versioning_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/xds/annotations/v3/versioning.pb.validate.go b/vendor/github.com/cncf/xds/go/xds/annotations/v3/versioning.pb.validate.go deleted file mode 100644 index 042c266e1..000000000 --- a/vendor/github.com/cncf/xds/go/xds/annotations/v3/versioning.pb.validate.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: xds/annotations/v3/versioning.proto - -package v3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on VersioningAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *VersioningAnnotation) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on VersioningAnnotation with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// VersioningAnnotationMultiError, or nil if none found. -func (m *VersioningAnnotation) ValidateAll() error { - return m.validate(true) -} - -func (m *VersioningAnnotation) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for PreviousMessageType - - if len(errors) > 0 { - return VersioningAnnotationMultiError(errors) - } - - return nil -} - -// VersioningAnnotationMultiError is an error wrapping multiple validation -// errors returned by VersioningAnnotation.ValidateAll() if the designated -// constraints aren't met. -type VersioningAnnotationMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m VersioningAnnotationMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m VersioningAnnotationMultiError) AllErrors() []error { return m } - -// VersioningAnnotationValidationError is the validation error returned by -// VersioningAnnotation.Validate if the designated constraints aren't met. -type VersioningAnnotationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e VersioningAnnotationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e VersioningAnnotationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e VersioningAnnotationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e VersioningAnnotationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e VersioningAnnotationValidationError) ErrorName() string { - return "VersioningAnnotationValidationError" -} - -// Error satisfies the builtin error interface -func (e VersioningAnnotationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sVersioningAnnotation.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = VersioningAnnotationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = VersioningAnnotationValidationError{} diff --git a/vendor/github.com/cncf/xds/go/xds/core/v3/authority.pb.go b/vendor/github.com/cncf/xds/go/xds/core/v3/authority.pb.go deleted file mode 100644 index 3c361216c..000000000 --- a/vendor/github.com/cncf/xds/go/xds/core/v3/authority.pb.go +++ /dev/null @@ -1,153 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: xds/core/v3/authority.proto - -package v3 - -import ( - _ "github.com/cncf/xds/go/xds/annotations/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type Authority struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` -} - -func (x *Authority) Reset() { - *x = Authority{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_core_v3_authority_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Authority) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Authority) ProtoMessage() {} - -func (x *Authority) ProtoReflect() protoreflect.Message { - mi := &file_xds_core_v3_authority_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Authority.ProtoReflect.Descriptor instead. -func (*Authority) Descriptor() ([]byte, []int) { - return file_xds_core_v3_authority_proto_rawDescGZIP(), []int{0} -} - -func (x *Authority) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -var File_xds_core_v3_authority_proto protoreflect.FileDescriptor - -var file_xds_core_v3_authority_proto_rawDesc = []byte{ - 0x0a, 0x1b, 0x78, 0x64, 0x73, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x61, 0x75, - 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x78, - 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x1a, 0x1f, 0x78, 0x64, 0x73, 0x2f, - 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x33, 0x2f, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x28, 0x0a, 0x09, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, - 0x79, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x56, - 0xd2, 0xc6, 0xa4, 0xe1, 0x06, 0x02, 0x08, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, - 0x42, 0x0e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, - 0x6e, 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_xds_core_v3_authority_proto_rawDescOnce sync.Once - file_xds_core_v3_authority_proto_rawDescData = file_xds_core_v3_authority_proto_rawDesc -) - -func file_xds_core_v3_authority_proto_rawDescGZIP() []byte { - file_xds_core_v3_authority_proto_rawDescOnce.Do(func() { - file_xds_core_v3_authority_proto_rawDescData = protoimpl.X.CompressGZIP(file_xds_core_v3_authority_proto_rawDescData) - }) - return file_xds_core_v3_authority_proto_rawDescData -} - -var file_xds_core_v3_authority_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_xds_core_v3_authority_proto_goTypes = []interface{}{ - (*Authority)(nil), // 0: xds.core.v3.Authority -} -var file_xds_core_v3_authority_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_xds_core_v3_authority_proto_init() } -func file_xds_core_v3_authority_proto_init() { - if File_xds_core_v3_authority_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_xds_core_v3_authority_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Authority); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_xds_core_v3_authority_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_xds_core_v3_authority_proto_goTypes, - DependencyIndexes: file_xds_core_v3_authority_proto_depIdxs, - MessageInfos: file_xds_core_v3_authority_proto_msgTypes, - }.Build() - File_xds_core_v3_authority_proto = out.File - file_xds_core_v3_authority_proto_rawDesc = nil - file_xds_core_v3_authority_proto_goTypes = nil - file_xds_core_v3_authority_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/xds/core/v3/authority.pb.validate.go b/vendor/github.com/cncf/xds/go/xds/core/v3/authority.pb.validate.go deleted file mode 100644 index 94317c2af..000000000 --- a/vendor/github.com/cncf/xds/go/xds/core/v3/authority.pb.validate.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: xds/core/v3/authority.proto - -package v3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on Authority with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Authority) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Authority with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in AuthorityMultiError, or nil -// if none found. -func (m *Authority) ValidateAll() error { - return m.validate(true) -} - -func (m *Authority) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := AuthorityValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return AuthorityMultiError(errors) - } - - return nil -} - -// AuthorityMultiError is an error wrapping multiple validation errors returned -// by Authority.ValidateAll() if the designated constraints aren't met. -type AuthorityMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AuthorityMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AuthorityMultiError) AllErrors() []error { return m } - -// AuthorityValidationError is the validation error returned by -// Authority.Validate if the designated constraints aren't met. -type AuthorityValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AuthorityValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AuthorityValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AuthorityValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AuthorityValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AuthorityValidationError) ErrorName() string { return "AuthorityValidationError" } - -// Error satisfies the builtin error interface -func (e AuthorityValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAuthority.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AuthorityValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AuthorityValidationError{} diff --git a/vendor/github.com/cncf/xds/go/xds/core/v3/cidr.pb.go b/vendor/github.com/cncf/xds/go/xds/core/v3/cidr.pb.go deleted file mode 100644 index d7be5c4d2..000000000 --- a/vendor/github.com/cncf/xds/go/xds/core/v3/cidr.pb.go +++ /dev/null @@ -1,172 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: xds/core/v3/cidr.proto - -package v3 - -import ( - _ "github.com/cncf/xds/go/xds/annotations/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type CidrRange struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AddressPrefix string `protobuf:"bytes,1,opt,name=address_prefix,json=addressPrefix,proto3" json:"address_prefix,omitempty"` - PrefixLen *wrapperspb.UInt32Value `protobuf:"bytes,2,opt,name=prefix_len,json=prefixLen,proto3" json:"prefix_len,omitempty"` -} - -func (x *CidrRange) Reset() { - *x = CidrRange{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_core_v3_cidr_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CidrRange) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CidrRange) ProtoMessage() {} - -func (x *CidrRange) ProtoReflect() protoreflect.Message { - mi := &file_xds_core_v3_cidr_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CidrRange.ProtoReflect.Descriptor instead. -func (*CidrRange) Descriptor() ([]byte, []int) { - return file_xds_core_v3_cidr_proto_rawDescGZIP(), []int{0} -} - -func (x *CidrRange) GetAddressPrefix() string { - if x != nil { - return x.AddressPrefix - } - return "" -} - -func (x *CidrRange) GetPrefixLen() *wrapperspb.UInt32Value { - if x != nil { - return x.PrefixLen - } - return nil -} - -var File_xds_core_v3_cidr_proto protoreflect.FileDescriptor - -var file_xds_core_v3_cidr_proto_rawDesc = []byte{ - 0x0a, 0x16, 0x78, 0x64, 0x73, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x63, 0x69, - 0x64, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x76, 0x33, 0x1a, 0x1f, 0x78, 0x64, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0x82, 0x01, 0x0a, 0x09, 0x43, 0x69, 0x64, 0x72, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x2e, 0x0a, - 0x0e, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0d, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x45, 0x0a, - 0x0a, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, - 0x08, 0xfa, 0x42, 0x05, 0x2a, 0x03, 0x18, 0x80, 0x01, 0x52, 0x09, 0x70, 0x72, 0x65, 0x66, 0x69, - 0x78, 0x4c, 0x65, 0x6e, 0x42, 0x56, 0xd2, 0xc6, 0xa4, 0xe1, 0x06, 0x02, 0x08, 0x01, 0x0a, 0x16, - 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x63, - 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x42, 0x0e, 0x43, 0x69, 0x64, 0x72, 0x52, 0x61, 0x6e, 0x67, - 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6e, 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, 0x6f, - 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_xds_core_v3_cidr_proto_rawDescOnce sync.Once - file_xds_core_v3_cidr_proto_rawDescData = file_xds_core_v3_cidr_proto_rawDesc -) - -func file_xds_core_v3_cidr_proto_rawDescGZIP() []byte { - file_xds_core_v3_cidr_proto_rawDescOnce.Do(func() { - file_xds_core_v3_cidr_proto_rawDescData = protoimpl.X.CompressGZIP(file_xds_core_v3_cidr_proto_rawDescData) - }) - return file_xds_core_v3_cidr_proto_rawDescData -} - -var file_xds_core_v3_cidr_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_xds_core_v3_cidr_proto_goTypes = []interface{}{ - (*CidrRange)(nil), // 0: xds.core.v3.CidrRange - (*wrapperspb.UInt32Value)(nil), // 1: google.protobuf.UInt32Value -} -var file_xds_core_v3_cidr_proto_depIdxs = []int32{ - 1, // 0: xds.core.v3.CidrRange.prefix_len:type_name -> google.protobuf.UInt32Value - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_xds_core_v3_cidr_proto_init() } -func file_xds_core_v3_cidr_proto_init() { - if File_xds_core_v3_cidr_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_xds_core_v3_cidr_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CidrRange); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_xds_core_v3_cidr_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_xds_core_v3_cidr_proto_goTypes, - DependencyIndexes: file_xds_core_v3_cidr_proto_depIdxs, - MessageInfos: file_xds_core_v3_cidr_proto_msgTypes, - }.Build() - File_xds_core_v3_cidr_proto = out.File - file_xds_core_v3_cidr_proto_rawDesc = nil - file_xds_core_v3_cidr_proto_goTypes = nil - file_xds_core_v3_cidr_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/xds/core/v3/cidr.pb.validate.go b/vendor/github.com/cncf/xds/go/xds/core/v3/cidr.pb.validate.go deleted file mode 100644 index 43327f56b..000000000 --- a/vendor/github.com/cncf/xds/go/xds/core/v3/cidr.pb.validate.go +++ /dev/null @@ -1,161 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: xds/core/v3/cidr.proto - -package v3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on CidrRange with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *CidrRange) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CidrRange with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in CidrRangeMultiError, or nil -// if none found. -func (m *CidrRange) ValidateAll() error { - return m.validate(true) -} - -func (m *CidrRange) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetAddressPrefix()) < 1 { - err := CidrRangeValidationError{ - field: "AddressPrefix", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if wrapper := m.GetPrefixLen(); wrapper != nil { - - if wrapper.GetValue() > 128 { - err := CidrRangeValidationError{ - field: "PrefixLen", - reason: "value must be less than or equal to 128", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if len(errors) > 0 { - return CidrRangeMultiError(errors) - } - - return nil -} - -// CidrRangeMultiError is an error wrapping multiple validation errors returned -// by CidrRange.ValidateAll() if the designated constraints aren't met. -type CidrRangeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CidrRangeMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CidrRangeMultiError) AllErrors() []error { return m } - -// CidrRangeValidationError is the validation error returned by -// CidrRange.Validate if the designated constraints aren't met. -type CidrRangeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CidrRangeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CidrRangeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CidrRangeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CidrRangeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CidrRangeValidationError) ErrorName() string { return "CidrRangeValidationError" } - -// Error satisfies the builtin error interface -func (e CidrRangeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCidrRange.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CidrRangeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CidrRangeValidationError{} diff --git a/vendor/github.com/cncf/xds/go/xds/core/v3/collection_entry.pb.go b/vendor/github.com/cncf/xds/go/xds/core/v3/collection_entry.pb.go deleted file mode 100644 index 52b520af4..000000000 --- a/vendor/github.com/cncf/xds/go/xds/core/v3/collection_entry.pb.go +++ /dev/null @@ -1,297 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: xds/core/v3/collection_entry.proto - -package v3 - -import ( - _ "github.com/cncf/xds/go/xds/annotations/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type CollectionEntry struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to ResourceSpecifier: - // - // *CollectionEntry_Locator - // *CollectionEntry_InlineEntry_ - ResourceSpecifier isCollectionEntry_ResourceSpecifier `protobuf_oneof:"resource_specifier"` -} - -func (x *CollectionEntry) Reset() { - *x = CollectionEntry{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_core_v3_collection_entry_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CollectionEntry) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CollectionEntry) ProtoMessage() {} - -func (x *CollectionEntry) ProtoReflect() protoreflect.Message { - mi := &file_xds_core_v3_collection_entry_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CollectionEntry.ProtoReflect.Descriptor instead. -func (*CollectionEntry) Descriptor() ([]byte, []int) { - return file_xds_core_v3_collection_entry_proto_rawDescGZIP(), []int{0} -} - -func (m *CollectionEntry) GetResourceSpecifier() isCollectionEntry_ResourceSpecifier { - if m != nil { - return m.ResourceSpecifier - } - return nil -} - -func (x *CollectionEntry) GetLocator() *ResourceLocator { - if x, ok := x.GetResourceSpecifier().(*CollectionEntry_Locator); ok { - return x.Locator - } - return nil -} - -func (x *CollectionEntry) GetInlineEntry() *CollectionEntry_InlineEntry { - if x, ok := x.GetResourceSpecifier().(*CollectionEntry_InlineEntry_); ok { - return x.InlineEntry - } - return nil -} - -type isCollectionEntry_ResourceSpecifier interface { - isCollectionEntry_ResourceSpecifier() -} - -type CollectionEntry_Locator struct { - Locator *ResourceLocator `protobuf:"bytes,1,opt,name=locator,proto3,oneof"` -} - -type CollectionEntry_InlineEntry_ struct { - InlineEntry *CollectionEntry_InlineEntry `protobuf:"bytes,2,opt,name=inline_entry,json=inlineEntry,proto3,oneof"` -} - -func (*CollectionEntry_Locator) isCollectionEntry_ResourceSpecifier() {} - -func (*CollectionEntry_InlineEntry_) isCollectionEntry_ResourceSpecifier() {} - -type CollectionEntry_InlineEntry struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - Resource *anypb.Any `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource,omitempty"` -} - -func (x *CollectionEntry_InlineEntry) Reset() { - *x = CollectionEntry_InlineEntry{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_core_v3_collection_entry_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CollectionEntry_InlineEntry) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CollectionEntry_InlineEntry) ProtoMessage() {} - -func (x *CollectionEntry_InlineEntry) ProtoReflect() protoreflect.Message { - mi := &file_xds_core_v3_collection_entry_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CollectionEntry_InlineEntry.ProtoReflect.Descriptor instead. -func (*CollectionEntry_InlineEntry) Descriptor() ([]byte, []int) { - return file_xds_core_v3_collection_entry_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *CollectionEntry_InlineEntry) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *CollectionEntry_InlineEntry) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *CollectionEntry_InlineEntry) GetResource() *anypb.Any { - if x != nil { - return x.Resource - } - return nil -} - -var File_xds_core_v3_collection_entry_proto protoreflect.FileDescriptor - -var file_xds_core_v3_collection_entry_proto_rawDesc = []byte{ - 0x0a, 0x22, 0x78, 0x64, 0x73, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x63, 0x6f, - 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, - 0x33, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x78, 0x64, - 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x33, - 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x22, 0x78, - 0x64, 0x73, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc3, 0x02, 0x0a, 0x0f, 0x43, - 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x38, - 0x0a, 0x07, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1c, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x48, 0x00, 0x52, - 0x07, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x4d, 0x0a, 0x0c, 0x69, 0x6e, 0x6c, 0x69, - 0x6e, 0x65, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, - 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x6f, 0x6c, - 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x2e, 0x49, 0x6e, 0x6c, - 0x69, 0x6e, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x48, 0x00, 0x52, 0x0b, 0x69, 0x6e, 0x6c, 0x69, - 0x6e, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x1a, 0x8b, 0x01, 0x0a, 0x0b, 0x49, 0x6e, 0x6c, 0x69, - 0x6e, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x30, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1c, 0xfa, 0x42, 0x19, 0x72, 0x17, 0x32, 0x15, 0x5e, 0x5b, - 0x30, 0x2d, 0x39, 0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0x5f, 0x5c, 0x2d, 0x5c, 0x2e, 0x7e, 0x3a, - 0x5d, 0x2b, 0x24, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x30, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x08, 0x72, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x19, 0x0a, 0x12, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x03, 0xf8, 0x42, 0x01, - 0x42, 0x5c, 0xd2, 0xc6, 0xa4, 0xe1, 0x06, 0x02, 0x08, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, - 0x76, 0x33, 0x42, 0x14, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6e, 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, - 0x67, 0x6f, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_xds_core_v3_collection_entry_proto_rawDescOnce sync.Once - file_xds_core_v3_collection_entry_proto_rawDescData = file_xds_core_v3_collection_entry_proto_rawDesc -) - -func file_xds_core_v3_collection_entry_proto_rawDescGZIP() []byte { - file_xds_core_v3_collection_entry_proto_rawDescOnce.Do(func() { - file_xds_core_v3_collection_entry_proto_rawDescData = protoimpl.X.CompressGZIP(file_xds_core_v3_collection_entry_proto_rawDescData) - }) - return file_xds_core_v3_collection_entry_proto_rawDescData -} - -var file_xds_core_v3_collection_entry_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_xds_core_v3_collection_entry_proto_goTypes = []interface{}{ - (*CollectionEntry)(nil), // 0: xds.core.v3.CollectionEntry - (*CollectionEntry_InlineEntry)(nil), // 1: xds.core.v3.CollectionEntry.InlineEntry - (*ResourceLocator)(nil), // 2: xds.core.v3.ResourceLocator - (*anypb.Any)(nil), // 3: google.protobuf.Any -} -var file_xds_core_v3_collection_entry_proto_depIdxs = []int32{ - 2, // 0: xds.core.v3.CollectionEntry.locator:type_name -> xds.core.v3.ResourceLocator - 1, // 1: xds.core.v3.CollectionEntry.inline_entry:type_name -> xds.core.v3.CollectionEntry.InlineEntry - 3, // 2: xds.core.v3.CollectionEntry.InlineEntry.resource:type_name -> google.protobuf.Any - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_xds_core_v3_collection_entry_proto_init() } -func file_xds_core_v3_collection_entry_proto_init() { - if File_xds_core_v3_collection_entry_proto != nil { - return - } - file_xds_core_v3_resource_locator_proto_init() - if !protoimpl.UnsafeEnabled { - file_xds_core_v3_collection_entry_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CollectionEntry); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_core_v3_collection_entry_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CollectionEntry_InlineEntry); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_xds_core_v3_collection_entry_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*CollectionEntry_Locator)(nil), - (*CollectionEntry_InlineEntry_)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_xds_core_v3_collection_entry_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_xds_core_v3_collection_entry_proto_goTypes, - DependencyIndexes: file_xds_core_v3_collection_entry_proto_depIdxs, - MessageInfos: file_xds_core_v3_collection_entry_proto_msgTypes, - }.Build() - File_xds_core_v3_collection_entry_proto = out.File - file_xds_core_v3_collection_entry_proto_rawDesc = nil - file_xds_core_v3_collection_entry_proto_goTypes = nil - file_xds_core_v3_collection_entry_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/xds/core/v3/collection_entry.pb.validate.go b/vendor/github.com/cncf/xds/go/xds/core/v3/collection_entry.pb.validate.go deleted file mode 100644 index 610990b7f..000000000 --- a/vendor/github.com/cncf/xds/go/xds/core/v3/collection_entry.pb.validate.go +++ /dev/null @@ -1,383 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: xds/core/v3/collection_entry.proto - -package v3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on CollectionEntry with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *CollectionEntry) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CollectionEntry with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// CollectionEntryMultiError, or nil if none found. -func (m *CollectionEntry) ValidateAll() error { - return m.validate(true) -} - -func (m *CollectionEntry) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofResourceSpecifierPresent := false - switch v := m.ResourceSpecifier.(type) { - case *CollectionEntry_Locator: - if v == nil { - err := CollectionEntryValidationError{ - field: "ResourceSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofResourceSpecifierPresent = true - - if all { - switch v := interface{}(m.GetLocator()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CollectionEntryValidationError{ - field: "Locator", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CollectionEntryValidationError{ - field: "Locator", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetLocator()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CollectionEntryValidationError{ - field: "Locator", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *CollectionEntry_InlineEntry_: - if v == nil { - err := CollectionEntryValidationError{ - field: "ResourceSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofResourceSpecifierPresent = true - - if all { - switch v := interface{}(m.GetInlineEntry()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CollectionEntryValidationError{ - field: "InlineEntry", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CollectionEntryValidationError{ - field: "InlineEntry", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetInlineEntry()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CollectionEntryValidationError{ - field: "InlineEntry", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofResourceSpecifierPresent { - err := CollectionEntryValidationError{ - field: "ResourceSpecifier", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return CollectionEntryMultiError(errors) - } - - return nil -} - -// CollectionEntryMultiError is an error wrapping multiple validation errors -// returned by CollectionEntry.ValidateAll() if the designated constraints -// aren't met. -type CollectionEntryMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CollectionEntryMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CollectionEntryMultiError) AllErrors() []error { return m } - -// CollectionEntryValidationError is the validation error returned by -// CollectionEntry.Validate if the designated constraints aren't met. -type CollectionEntryValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CollectionEntryValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CollectionEntryValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CollectionEntryValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CollectionEntryValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CollectionEntryValidationError) ErrorName() string { return "CollectionEntryValidationError" } - -// Error satisfies the builtin error interface -func (e CollectionEntryValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCollectionEntry.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CollectionEntryValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CollectionEntryValidationError{} - -// Validate checks the field values on CollectionEntry_InlineEntry with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *CollectionEntry_InlineEntry) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CollectionEntry_InlineEntry with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// CollectionEntry_InlineEntryMultiError, or nil if none found. -func (m *CollectionEntry_InlineEntry) ValidateAll() error { - return m.validate(true) -} - -func (m *CollectionEntry_InlineEntry) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if !_CollectionEntry_InlineEntry_Name_Pattern.MatchString(m.GetName()) { - err := CollectionEntry_InlineEntryValidationError{ - field: "Name", - reason: "value does not match regex pattern \"^[0-9a-zA-Z_\\\\-\\\\.~:]+$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for Version - - if all { - switch v := interface{}(m.GetResource()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CollectionEntry_InlineEntryValidationError{ - field: "Resource", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CollectionEntry_InlineEntryValidationError{ - field: "Resource", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetResource()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CollectionEntry_InlineEntryValidationError{ - field: "Resource", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return CollectionEntry_InlineEntryMultiError(errors) - } - - return nil -} - -// CollectionEntry_InlineEntryMultiError is an error wrapping multiple -// validation errors returned by CollectionEntry_InlineEntry.ValidateAll() if -// the designated constraints aren't met. -type CollectionEntry_InlineEntryMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CollectionEntry_InlineEntryMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CollectionEntry_InlineEntryMultiError) AllErrors() []error { return m } - -// CollectionEntry_InlineEntryValidationError is the validation error returned -// by CollectionEntry_InlineEntry.Validate if the designated constraints -// aren't met. -type CollectionEntry_InlineEntryValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CollectionEntry_InlineEntryValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CollectionEntry_InlineEntryValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CollectionEntry_InlineEntryValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CollectionEntry_InlineEntryValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CollectionEntry_InlineEntryValidationError) ErrorName() string { - return "CollectionEntry_InlineEntryValidationError" -} - -// Error satisfies the builtin error interface -func (e CollectionEntry_InlineEntryValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCollectionEntry_InlineEntry.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CollectionEntry_InlineEntryValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CollectionEntry_InlineEntryValidationError{} - -var _CollectionEntry_InlineEntry_Name_Pattern = regexp.MustCompile("^[0-9a-zA-Z_\\-\\.~:]+$") diff --git a/vendor/github.com/cncf/xds/go/xds/core/v3/context_params.pb.go b/vendor/github.com/cncf/xds/go/xds/core/v3/context_params.pb.go deleted file mode 100644 index 563775a1f..000000000 --- a/vendor/github.com/cncf/xds/go/xds/core/v3/context_params.pb.go +++ /dev/null @@ -1,160 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: xds/core/v3/context_params.proto - -package v3 - -import ( - _ "github.com/cncf/xds/go/xds/annotations/v3" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type ContextParams struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Params map[string]string `protobuf:"bytes,1,rep,name=params,proto3" json:"params,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *ContextParams) Reset() { - *x = ContextParams{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_core_v3_context_params_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ContextParams) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ContextParams) ProtoMessage() {} - -func (x *ContextParams) ProtoReflect() protoreflect.Message { - mi := &file_xds_core_v3_context_params_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ContextParams.ProtoReflect.Descriptor instead. -func (*ContextParams) Descriptor() ([]byte, []int) { - return file_xds_core_v3_context_params_proto_rawDescGZIP(), []int{0} -} - -func (x *ContextParams) GetParams() map[string]string { - if x != nil { - return x.Params - } - return nil -} - -var File_xds_core_v3_context_params_proto protoreflect.FileDescriptor - -var file_xds_core_v3_context_params_proto_rawDesc = []byte{ - 0x0a, 0x20, 0x78, 0x64, 0x73, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x0b, 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x1a, - 0x1f, 0x78, 0x64, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x8a, 0x01, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x12, 0x3e, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, - 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x1a, 0x39, 0x0a, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x5a, 0xd2, - 0xc6, 0xa4, 0xe1, 0x06, 0x02, 0x08, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x42, - 0x12, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x63, 0x6e, 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x78, 0x64, - 0x73, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} - -var ( - file_xds_core_v3_context_params_proto_rawDescOnce sync.Once - file_xds_core_v3_context_params_proto_rawDescData = file_xds_core_v3_context_params_proto_rawDesc -) - -func file_xds_core_v3_context_params_proto_rawDescGZIP() []byte { - file_xds_core_v3_context_params_proto_rawDescOnce.Do(func() { - file_xds_core_v3_context_params_proto_rawDescData = protoimpl.X.CompressGZIP(file_xds_core_v3_context_params_proto_rawDescData) - }) - return file_xds_core_v3_context_params_proto_rawDescData -} - -var file_xds_core_v3_context_params_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_xds_core_v3_context_params_proto_goTypes = []interface{}{ - (*ContextParams)(nil), // 0: xds.core.v3.ContextParams - nil, // 1: xds.core.v3.ContextParams.ParamsEntry -} -var file_xds_core_v3_context_params_proto_depIdxs = []int32{ - 1, // 0: xds.core.v3.ContextParams.params:type_name -> xds.core.v3.ContextParams.ParamsEntry - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_xds_core_v3_context_params_proto_init() } -func file_xds_core_v3_context_params_proto_init() { - if File_xds_core_v3_context_params_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_xds_core_v3_context_params_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContextParams); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_xds_core_v3_context_params_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_xds_core_v3_context_params_proto_goTypes, - DependencyIndexes: file_xds_core_v3_context_params_proto_depIdxs, - MessageInfos: file_xds_core_v3_context_params_proto_msgTypes, - }.Build() - File_xds_core_v3_context_params_proto = out.File - file_xds_core_v3_context_params_proto_rawDesc = nil - file_xds_core_v3_context_params_proto_goTypes = nil - file_xds_core_v3_context_params_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/xds/core/v3/context_params.pb.validate.go b/vendor/github.com/cncf/xds/go/xds/core/v3/context_params.pb.validate.go deleted file mode 100644 index 1c9accaa3..000000000 --- a/vendor/github.com/cncf/xds/go/xds/core/v3/context_params.pb.validate.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: xds/core/v3/context_params.proto - -package v3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on ContextParams with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *ContextParams) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ContextParams with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in ContextParamsMultiError, or -// nil if none found. -func (m *ContextParams) ValidateAll() error { - return m.validate(true) -} - -func (m *ContextParams) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Params - - if len(errors) > 0 { - return ContextParamsMultiError(errors) - } - - return nil -} - -// ContextParamsMultiError is an error wrapping multiple validation errors -// returned by ContextParams.ValidateAll() if the designated constraints -// aren't met. -type ContextParamsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ContextParamsMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ContextParamsMultiError) AllErrors() []error { return m } - -// ContextParamsValidationError is the validation error returned by -// ContextParams.Validate if the designated constraints aren't met. -type ContextParamsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ContextParamsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ContextParamsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ContextParamsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ContextParamsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ContextParamsValidationError) ErrorName() string { return "ContextParamsValidationError" } - -// Error satisfies the builtin error interface -func (e ContextParamsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sContextParams.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ContextParamsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ContextParamsValidationError{} diff --git a/vendor/github.com/cncf/xds/go/xds/core/v3/extension.pb.go b/vendor/github.com/cncf/xds/go/xds/core/v3/extension.pb.go deleted file mode 100644 index 476fa47c2..000000000 --- a/vendor/github.com/cncf/xds/go/xds/core/v3/extension.pb.go +++ /dev/null @@ -1,167 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: xds/core/v3/extension.proto - -package v3 - -import ( - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type TypedExtensionConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - TypedConfig *anypb.Any `protobuf:"bytes,2,opt,name=typed_config,json=typedConfig,proto3" json:"typed_config,omitempty"` -} - -func (x *TypedExtensionConfig) Reset() { - *x = TypedExtensionConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_core_v3_extension_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TypedExtensionConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TypedExtensionConfig) ProtoMessage() {} - -func (x *TypedExtensionConfig) ProtoReflect() protoreflect.Message { - mi := &file_xds_core_v3_extension_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TypedExtensionConfig.ProtoReflect.Descriptor instead. -func (*TypedExtensionConfig) Descriptor() ([]byte, []int) { - return file_xds_core_v3_extension_proto_rawDescGZIP(), []int{0} -} - -func (x *TypedExtensionConfig) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *TypedExtensionConfig) GetTypedConfig() *anypb.Any { - if x != nil { - return x.TypedConfig - } - return nil -} - -var File_xds_core_v3_extension_proto protoreflect.FileDescriptor - -var file_xds_core_v3_extension_proto_rawDesc = []byte{ - 0x0a, 0x1b, 0x78, 0x64, 0x73, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x65, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x78, - 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x76, - 0x0a, 0x14, 0x54, 0x79, 0x70, 0x65, 0x64, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x41, 0x0a, 0x0c, 0x74, 0x79, 0x70, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x42, - 0x08, 0xfa, 0x42, 0x05, 0xa2, 0x01, 0x02, 0x08, 0x01, 0x52, 0x0b, 0x74, 0x79, 0x70, 0x65, 0x64, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x4e, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, - 0x42, 0x0e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, - 0x6e, 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_xds_core_v3_extension_proto_rawDescOnce sync.Once - file_xds_core_v3_extension_proto_rawDescData = file_xds_core_v3_extension_proto_rawDesc -) - -func file_xds_core_v3_extension_proto_rawDescGZIP() []byte { - file_xds_core_v3_extension_proto_rawDescOnce.Do(func() { - file_xds_core_v3_extension_proto_rawDescData = protoimpl.X.CompressGZIP(file_xds_core_v3_extension_proto_rawDescData) - }) - return file_xds_core_v3_extension_proto_rawDescData -} - -var file_xds_core_v3_extension_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_xds_core_v3_extension_proto_goTypes = []interface{}{ - (*TypedExtensionConfig)(nil), // 0: xds.core.v3.TypedExtensionConfig - (*anypb.Any)(nil), // 1: google.protobuf.Any -} -var file_xds_core_v3_extension_proto_depIdxs = []int32{ - 1, // 0: xds.core.v3.TypedExtensionConfig.typed_config:type_name -> google.protobuf.Any - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_xds_core_v3_extension_proto_init() } -func file_xds_core_v3_extension_proto_init() { - if File_xds_core_v3_extension_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_xds_core_v3_extension_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TypedExtensionConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_xds_core_v3_extension_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_xds_core_v3_extension_proto_goTypes, - DependencyIndexes: file_xds_core_v3_extension_proto_depIdxs, - MessageInfos: file_xds_core_v3_extension_proto_msgTypes, - }.Build() - File_xds_core_v3_extension_proto = out.File - file_xds_core_v3_extension_proto_rawDesc = nil - file_xds_core_v3_extension_proto_goTypes = nil - file_xds_core_v3_extension_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/xds/core/v3/extension.pb.validate.go b/vendor/github.com/cncf/xds/go/xds/core/v3/extension.pb.validate.go deleted file mode 100644 index 839f3fef7..000000000 --- a/vendor/github.com/cncf/xds/go/xds/core/v3/extension.pb.validate.go +++ /dev/null @@ -1,164 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: xds/core/v3/extension.proto - -package v3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on TypedExtensionConfig with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *TypedExtensionConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on TypedExtensionConfig with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// TypedExtensionConfigMultiError, or nil if none found. -func (m *TypedExtensionConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *TypedExtensionConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := TypedExtensionConfigValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if m.GetTypedConfig() == nil { - err := TypedExtensionConfigValidationError{ - field: "TypedConfig", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if a := m.GetTypedConfig(); a != nil { - - } - - if len(errors) > 0 { - return TypedExtensionConfigMultiError(errors) - } - - return nil -} - -// TypedExtensionConfigMultiError is an error wrapping multiple validation -// errors returned by TypedExtensionConfig.ValidateAll() if the designated -// constraints aren't met. -type TypedExtensionConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m TypedExtensionConfigMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m TypedExtensionConfigMultiError) AllErrors() []error { return m } - -// TypedExtensionConfigValidationError is the validation error returned by -// TypedExtensionConfig.Validate if the designated constraints aren't met. -type TypedExtensionConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TypedExtensionConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TypedExtensionConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TypedExtensionConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TypedExtensionConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TypedExtensionConfigValidationError) ErrorName() string { - return "TypedExtensionConfigValidationError" -} - -// Error satisfies the builtin error interface -func (e TypedExtensionConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTypedExtensionConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TypedExtensionConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TypedExtensionConfigValidationError{} diff --git a/vendor/github.com/cncf/xds/go/xds/core/v3/resource.pb.go b/vendor/github.com/cncf/xds/go/xds/core/v3/resource.pb.go deleted file mode 100644 index 9402230d5..000000000 --- a/vendor/github.com/cncf/xds/go/xds/core/v3/resource.pb.go +++ /dev/null @@ -1,182 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: xds/core/v3/resource.proto - -package v3 - -import ( - _ "github.com/cncf/xds/go/xds/annotations/v3" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type Resource struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name *ResourceName `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - Resource *anypb.Any `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource,omitempty"` -} - -func (x *Resource) Reset() { - *x = Resource{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_core_v3_resource_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Resource) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Resource) ProtoMessage() {} - -func (x *Resource) ProtoReflect() protoreflect.Message { - mi := &file_xds_core_v3_resource_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Resource.ProtoReflect.Descriptor instead. -func (*Resource) Descriptor() ([]byte, []int) { - return file_xds_core_v3_resource_proto_rawDescGZIP(), []int{0} -} - -func (x *Resource) GetName() *ResourceName { - if x != nil { - return x.Name - } - return nil -} - -func (x *Resource) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *Resource) GetResource() *anypb.Any { - if x != nil { - return x.Resource - } - return nil -} - -var File_xds_core_v3_resource_proto protoreflect.FileDescriptor - -var file_xds_core_v3_resource_proto_rawDesc = []byte{ - 0x0a, 0x1a, 0x78, 0x64, 0x73, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x72, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x78, 0x64, - 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x78, 0x64, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x78, 0x64, 0x73, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, - 0x76, 0x33, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x85, 0x01, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x12, 0x2d, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, - 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x30, 0x0a, 0x08, - 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x55, - 0xd2, 0xc6, 0xa4, 0xe1, 0x06, 0x02, 0x08, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, - 0x42, 0x0d, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6e, - 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x63, 0x6f, - 0x72, 0x65, 0x2f, 0x76, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_xds_core_v3_resource_proto_rawDescOnce sync.Once - file_xds_core_v3_resource_proto_rawDescData = file_xds_core_v3_resource_proto_rawDesc -) - -func file_xds_core_v3_resource_proto_rawDescGZIP() []byte { - file_xds_core_v3_resource_proto_rawDescOnce.Do(func() { - file_xds_core_v3_resource_proto_rawDescData = protoimpl.X.CompressGZIP(file_xds_core_v3_resource_proto_rawDescData) - }) - return file_xds_core_v3_resource_proto_rawDescData -} - -var file_xds_core_v3_resource_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_xds_core_v3_resource_proto_goTypes = []interface{}{ - (*Resource)(nil), // 0: xds.core.v3.Resource - (*ResourceName)(nil), // 1: xds.core.v3.ResourceName - (*anypb.Any)(nil), // 2: google.protobuf.Any -} -var file_xds_core_v3_resource_proto_depIdxs = []int32{ - 1, // 0: xds.core.v3.Resource.name:type_name -> xds.core.v3.ResourceName - 2, // 1: xds.core.v3.Resource.resource:type_name -> google.protobuf.Any - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_xds_core_v3_resource_proto_init() } -func file_xds_core_v3_resource_proto_init() { - if File_xds_core_v3_resource_proto != nil { - return - } - file_xds_core_v3_resource_name_proto_init() - if !protoimpl.UnsafeEnabled { - file_xds_core_v3_resource_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Resource); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_xds_core_v3_resource_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_xds_core_v3_resource_proto_goTypes, - DependencyIndexes: file_xds_core_v3_resource_proto_depIdxs, - MessageInfos: file_xds_core_v3_resource_proto_msgTypes, - }.Build() - File_xds_core_v3_resource_proto = out.File - file_xds_core_v3_resource_proto_rawDesc = nil - file_xds_core_v3_resource_proto_goTypes = nil - file_xds_core_v3_resource_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/xds/core/v3/resource.pb.validate.go b/vendor/github.com/cncf/xds/go/xds/core/v3/resource.pb.validate.go deleted file mode 100644 index dc972171c..000000000 --- a/vendor/github.com/cncf/xds/go/xds/core/v3/resource.pb.validate.go +++ /dev/null @@ -1,195 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: xds/core/v3/resource.proto - -package v3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on Resource with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Resource) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Resource with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in ResourceMultiError, or nil -// if none found. -func (m *Resource) ValidateAll() error { - return m.validate(true) -} - -func (m *Resource) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetName()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ResourceValidationError{ - field: "Name", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ResourceValidationError{ - field: "Name", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetName()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ResourceValidationError{ - field: "Name", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for Version - - if all { - switch v := interface{}(m.GetResource()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ResourceValidationError{ - field: "Resource", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ResourceValidationError{ - field: "Resource", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetResource()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ResourceValidationError{ - field: "Resource", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return ResourceMultiError(errors) - } - - return nil -} - -// ResourceMultiError is an error wrapping multiple validation errors returned -// by Resource.ValidateAll() if the designated constraints aren't met. -type ResourceMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ResourceMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ResourceMultiError) AllErrors() []error { return m } - -// ResourceValidationError is the validation error returned by -// Resource.Validate if the designated constraints aren't met. -type ResourceValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ResourceValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ResourceValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ResourceValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ResourceValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ResourceValidationError) ErrorName() string { return "ResourceValidationError" } - -// Error satisfies the builtin error interface -func (e ResourceValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sResource.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ResourceValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ResourceValidationError{} diff --git a/vendor/github.com/cncf/xds/go/xds/core/v3/resource_locator.pb.go b/vendor/github.com/cncf/xds/go/xds/core/v3/resource_locator.pb.go deleted file mode 100644 index 50fe599db..000000000 --- a/vendor/github.com/cncf/xds/go/xds/core/v3/resource_locator.pb.go +++ /dev/null @@ -1,406 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: xds/core/v3/resource_locator.proto - -package v3 - -import ( - _ "github.com/cncf/xds/go/xds/annotations/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type ResourceLocator_Scheme int32 - -const ( - ResourceLocator_XDSTP ResourceLocator_Scheme = 0 - ResourceLocator_HTTP ResourceLocator_Scheme = 1 - ResourceLocator_FILE ResourceLocator_Scheme = 2 -) - -// Enum value maps for ResourceLocator_Scheme. -var ( - ResourceLocator_Scheme_name = map[int32]string{ - 0: "XDSTP", - 1: "HTTP", - 2: "FILE", - } - ResourceLocator_Scheme_value = map[string]int32{ - "XDSTP": 0, - "HTTP": 1, - "FILE": 2, - } -) - -func (x ResourceLocator_Scheme) Enum() *ResourceLocator_Scheme { - p := new(ResourceLocator_Scheme) - *p = x - return p -} - -func (x ResourceLocator_Scheme) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ResourceLocator_Scheme) Descriptor() protoreflect.EnumDescriptor { - return file_xds_core_v3_resource_locator_proto_enumTypes[0].Descriptor() -} - -func (ResourceLocator_Scheme) Type() protoreflect.EnumType { - return &file_xds_core_v3_resource_locator_proto_enumTypes[0] -} - -func (x ResourceLocator_Scheme) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ResourceLocator_Scheme.Descriptor instead. -func (ResourceLocator_Scheme) EnumDescriptor() ([]byte, []int) { - return file_xds_core_v3_resource_locator_proto_rawDescGZIP(), []int{0, 0} -} - -type ResourceLocator struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Scheme ResourceLocator_Scheme `protobuf:"varint,1,opt,name=scheme,proto3,enum=xds.core.v3.ResourceLocator_Scheme" json:"scheme,omitempty"` - Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` - Authority string `protobuf:"bytes,3,opt,name=authority,proto3" json:"authority,omitempty"` - ResourceType string `protobuf:"bytes,4,opt,name=resource_type,json=resourceType,proto3" json:"resource_type,omitempty"` - // Types that are assignable to ContextParamSpecifier: - // - // *ResourceLocator_ExactContext - ContextParamSpecifier isResourceLocator_ContextParamSpecifier `protobuf_oneof:"context_param_specifier"` - Directives []*ResourceLocator_Directive `protobuf:"bytes,6,rep,name=directives,proto3" json:"directives,omitempty"` -} - -func (x *ResourceLocator) Reset() { - *x = ResourceLocator{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_core_v3_resource_locator_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ResourceLocator) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ResourceLocator) ProtoMessage() {} - -func (x *ResourceLocator) ProtoReflect() protoreflect.Message { - mi := &file_xds_core_v3_resource_locator_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ResourceLocator.ProtoReflect.Descriptor instead. -func (*ResourceLocator) Descriptor() ([]byte, []int) { - return file_xds_core_v3_resource_locator_proto_rawDescGZIP(), []int{0} -} - -func (x *ResourceLocator) GetScheme() ResourceLocator_Scheme { - if x != nil { - return x.Scheme - } - return ResourceLocator_XDSTP -} - -func (x *ResourceLocator) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *ResourceLocator) GetAuthority() string { - if x != nil { - return x.Authority - } - return "" -} - -func (x *ResourceLocator) GetResourceType() string { - if x != nil { - return x.ResourceType - } - return "" -} - -func (m *ResourceLocator) GetContextParamSpecifier() isResourceLocator_ContextParamSpecifier { - if m != nil { - return m.ContextParamSpecifier - } - return nil -} - -func (x *ResourceLocator) GetExactContext() *ContextParams { - if x, ok := x.GetContextParamSpecifier().(*ResourceLocator_ExactContext); ok { - return x.ExactContext - } - return nil -} - -func (x *ResourceLocator) GetDirectives() []*ResourceLocator_Directive { - if x != nil { - return x.Directives - } - return nil -} - -type isResourceLocator_ContextParamSpecifier interface { - isResourceLocator_ContextParamSpecifier() -} - -type ResourceLocator_ExactContext struct { - ExactContext *ContextParams `protobuf:"bytes,5,opt,name=exact_context,json=exactContext,proto3,oneof"` -} - -func (*ResourceLocator_ExactContext) isResourceLocator_ContextParamSpecifier() {} - -type ResourceLocator_Directive struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Directive: - // - // *ResourceLocator_Directive_Alt - // *ResourceLocator_Directive_Entry - Directive isResourceLocator_Directive_Directive `protobuf_oneof:"directive"` -} - -func (x *ResourceLocator_Directive) Reset() { - *x = ResourceLocator_Directive{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_core_v3_resource_locator_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ResourceLocator_Directive) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ResourceLocator_Directive) ProtoMessage() {} - -func (x *ResourceLocator_Directive) ProtoReflect() protoreflect.Message { - mi := &file_xds_core_v3_resource_locator_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ResourceLocator_Directive.ProtoReflect.Descriptor instead. -func (*ResourceLocator_Directive) Descriptor() ([]byte, []int) { - return file_xds_core_v3_resource_locator_proto_rawDescGZIP(), []int{0, 0} -} - -func (m *ResourceLocator_Directive) GetDirective() isResourceLocator_Directive_Directive { - if m != nil { - return m.Directive - } - return nil -} - -func (x *ResourceLocator_Directive) GetAlt() *ResourceLocator { - if x, ok := x.GetDirective().(*ResourceLocator_Directive_Alt); ok { - return x.Alt - } - return nil -} - -func (x *ResourceLocator_Directive) GetEntry() string { - if x, ok := x.GetDirective().(*ResourceLocator_Directive_Entry); ok { - return x.Entry - } - return "" -} - -type isResourceLocator_Directive_Directive interface { - isResourceLocator_Directive_Directive() -} - -type ResourceLocator_Directive_Alt struct { - Alt *ResourceLocator `protobuf:"bytes,1,opt,name=alt,proto3,oneof"` -} - -type ResourceLocator_Directive_Entry struct { - Entry string `protobuf:"bytes,2,opt,name=entry,proto3,oneof"` -} - -func (*ResourceLocator_Directive_Alt) isResourceLocator_Directive_Directive() {} - -func (*ResourceLocator_Directive_Entry) isResourceLocator_Directive_Directive() {} - -var File_xds_core_v3_resource_locator_proto protoreflect.FileDescriptor - -var file_xds_core_v3_resource_locator_proto_rawDesc = []byte{ - 0x0a, 0x22, 0x78, 0x64, 0x73, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x72, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, - 0x33, 0x1a, 0x1f, 0x78, 0x64, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x20, 0x78, 0x64, 0x73, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8e, 0x04, - 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x6f, - 0x72, 0x12, 0x45, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x23, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, - 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x2e, - 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, - 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, - 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x2c, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, - 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x0d, 0x65, 0x78, 0x61, 0x63, 0x74, 0x5f, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x78, 0x64, - 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, - 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x48, 0x00, 0x52, 0x0c, 0x65, 0x78, 0x61, 0x63, 0x74, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x64, 0x69, 0x72, 0x65, 0x63, - 0x74, 0x69, 0x76, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x78, 0x64, - 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, - 0x69, 0x76, 0x65, 0x52, 0x0a, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x73, 0x1a, - 0x88, 0x01, 0x0a, 0x09, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x30, 0x0a, - 0x03, 0x61, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x78, 0x64, 0x73, - 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x48, 0x00, 0x52, 0x03, 0x61, 0x6c, 0x74, 0x12, - 0x37, 0x0a, 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1f, - 0xfa, 0x42, 0x1c, 0x72, 0x1a, 0x10, 0x01, 0x32, 0x16, 0x5e, 0x5b, 0x30, 0x2d, 0x39, 0x61, 0x2d, - 0x7a, 0x41, 0x2d, 0x5a, 0x5f, 0x5c, 0x2d, 0x5c, 0x2e, 0x2f, 0x7e, 0x3a, 0x5d, 0x2b, 0x24, 0x48, - 0x00, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x10, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, - 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0x27, 0x0a, 0x06, 0x53, 0x63, - 0x68, 0x65, 0x6d, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x58, 0x44, 0x53, 0x54, 0x50, 0x10, 0x00, 0x12, - 0x08, 0x0a, 0x04, 0x48, 0x54, 0x54, 0x50, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x49, 0x4c, - 0x45, 0x10, 0x02, 0x42, 0x19, 0x0a, 0x17, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x5f, 0x70, - 0x61, 0x72, 0x61, 0x6d, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x42, 0x5c, - 0xd2, 0xc6, 0xa4, 0xe1, 0x06, 0x02, 0x08, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, - 0x42, 0x14, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x6f, - 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6e, 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, 0x6f, - 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_xds_core_v3_resource_locator_proto_rawDescOnce sync.Once - file_xds_core_v3_resource_locator_proto_rawDescData = file_xds_core_v3_resource_locator_proto_rawDesc -) - -func file_xds_core_v3_resource_locator_proto_rawDescGZIP() []byte { - file_xds_core_v3_resource_locator_proto_rawDescOnce.Do(func() { - file_xds_core_v3_resource_locator_proto_rawDescData = protoimpl.X.CompressGZIP(file_xds_core_v3_resource_locator_proto_rawDescData) - }) - return file_xds_core_v3_resource_locator_proto_rawDescData -} - -var file_xds_core_v3_resource_locator_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_xds_core_v3_resource_locator_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_xds_core_v3_resource_locator_proto_goTypes = []interface{}{ - (ResourceLocator_Scheme)(0), // 0: xds.core.v3.ResourceLocator.Scheme - (*ResourceLocator)(nil), // 1: xds.core.v3.ResourceLocator - (*ResourceLocator_Directive)(nil), // 2: xds.core.v3.ResourceLocator.Directive - (*ContextParams)(nil), // 3: xds.core.v3.ContextParams -} -var file_xds_core_v3_resource_locator_proto_depIdxs = []int32{ - 0, // 0: xds.core.v3.ResourceLocator.scheme:type_name -> xds.core.v3.ResourceLocator.Scheme - 3, // 1: xds.core.v3.ResourceLocator.exact_context:type_name -> xds.core.v3.ContextParams - 2, // 2: xds.core.v3.ResourceLocator.directives:type_name -> xds.core.v3.ResourceLocator.Directive - 1, // 3: xds.core.v3.ResourceLocator.Directive.alt:type_name -> xds.core.v3.ResourceLocator - 4, // [4:4] is the sub-list for method output_type - 4, // [4:4] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name -} - -func init() { file_xds_core_v3_resource_locator_proto_init() } -func file_xds_core_v3_resource_locator_proto_init() { - if File_xds_core_v3_resource_locator_proto != nil { - return - } - file_xds_core_v3_context_params_proto_init() - if !protoimpl.UnsafeEnabled { - file_xds_core_v3_resource_locator_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResourceLocator); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_core_v3_resource_locator_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResourceLocator_Directive); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_xds_core_v3_resource_locator_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*ResourceLocator_ExactContext)(nil), - } - file_xds_core_v3_resource_locator_proto_msgTypes[1].OneofWrappers = []interface{}{ - (*ResourceLocator_Directive_Alt)(nil), - (*ResourceLocator_Directive_Entry)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_xds_core_v3_resource_locator_proto_rawDesc, - NumEnums: 1, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_xds_core_v3_resource_locator_proto_goTypes, - DependencyIndexes: file_xds_core_v3_resource_locator_proto_depIdxs, - EnumInfos: file_xds_core_v3_resource_locator_proto_enumTypes, - MessageInfos: file_xds_core_v3_resource_locator_proto_msgTypes, - }.Build() - File_xds_core_v3_resource_locator_proto = out.File - file_xds_core_v3_resource_locator_proto_rawDesc = nil - file_xds_core_v3_resource_locator_proto_goTypes = nil - file_xds_core_v3_resource_locator_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/xds/core/v3/resource_locator.pb.validate.go b/vendor/github.com/cncf/xds/go/xds/core/v3/resource_locator.pb.validate.go deleted file mode 100644 index 1686e98d1..000000000 --- a/vendor/github.com/cncf/xds/go/xds/core/v3/resource_locator.pb.validate.go +++ /dev/null @@ -1,439 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: xds/core/v3/resource_locator.proto - -package v3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on ResourceLocator with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *ResourceLocator) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ResourceLocator with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ResourceLocatorMultiError, or nil if none found. -func (m *ResourceLocator) ValidateAll() error { - return m.validate(true) -} - -func (m *ResourceLocator) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if _, ok := ResourceLocator_Scheme_name[int32(m.GetScheme())]; !ok { - err := ResourceLocatorValidationError{ - field: "Scheme", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for Id - - // no validation rules for Authority - - if utf8.RuneCountInString(m.GetResourceType()) < 1 { - err := ResourceLocatorValidationError{ - field: "ResourceType", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetDirectives() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ResourceLocatorValidationError{ - field: fmt.Sprintf("Directives[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ResourceLocatorValidationError{ - field: fmt.Sprintf("Directives[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ResourceLocatorValidationError{ - field: fmt.Sprintf("Directives[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - switch v := m.ContextParamSpecifier.(type) { - case *ResourceLocator_ExactContext: - if v == nil { - err := ResourceLocatorValidationError{ - field: "ContextParamSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetExactContext()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ResourceLocatorValidationError{ - field: "ExactContext", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ResourceLocatorValidationError{ - field: "ExactContext", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetExactContext()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ResourceLocatorValidationError{ - field: "ExactContext", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return ResourceLocatorMultiError(errors) - } - - return nil -} - -// ResourceLocatorMultiError is an error wrapping multiple validation errors -// returned by ResourceLocator.ValidateAll() if the designated constraints -// aren't met. -type ResourceLocatorMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ResourceLocatorMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ResourceLocatorMultiError) AllErrors() []error { return m } - -// ResourceLocatorValidationError is the validation error returned by -// ResourceLocator.Validate if the designated constraints aren't met. -type ResourceLocatorValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ResourceLocatorValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ResourceLocatorValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ResourceLocatorValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ResourceLocatorValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ResourceLocatorValidationError) ErrorName() string { return "ResourceLocatorValidationError" } - -// Error satisfies the builtin error interface -func (e ResourceLocatorValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sResourceLocator.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ResourceLocatorValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ResourceLocatorValidationError{} - -// Validate checks the field values on ResourceLocator_Directive with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ResourceLocator_Directive) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ResourceLocator_Directive with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ResourceLocator_DirectiveMultiError, or nil if none found. -func (m *ResourceLocator_Directive) ValidateAll() error { - return m.validate(true) -} - -func (m *ResourceLocator_Directive) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofDirectivePresent := false - switch v := m.Directive.(type) { - case *ResourceLocator_Directive_Alt: - if v == nil { - err := ResourceLocator_DirectiveValidationError{ - field: "Directive", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofDirectivePresent = true - - if all { - switch v := interface{}(m.GetAlt()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ResourceLocator_DirectiveValidationError{ - field: "Alt", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ResourceLocator_DirectiveValidationError{ - field: "Alt", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetAlt()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ResourceLocator_DirectiveValidationError{ - field: "Alt", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ResourceLocator_Directive_Entry: - if v == nil { - err := ResourceLocator_DirectiveValidationError{ - field: "Directive", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofDirectivePresent = true - - if utf8.RuneCountInString(m.GetEntry()) < 1 { - err := ResourceLocator_DirectiveValidationError{ - field: "Entry", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if !_ResourceLocator_Directive_Entry_Pattern.MatchString(m.GetEntry()) { - err := ResourceLocator_DirectiveValidationError{ - field: "Entry", - reason: "value does not match regex pattern \"^[0-9a-zA-Z_\\\\-\\\\./~:]+$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - default: - _ = v // ensures v is used - } - if !oneofDirectivePresent { - err := ResourceLocator_DirectiveValidationError{ - field: "Directive", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return ResourceLocator_DirectiveMultiError(errors) - } - - return nil -} - -// ResourceLocator_DirectiveMultiError is an error wrapping multiple validation -// errors returned by ResourceLocator_Directive.ValidateAll() if the -// designated constraints aren't met. -type ResourceLocator_DirectiveMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ResourceLocator_DirectiveMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ResourceLocator_DirectiveMultiError) AllErrors() []error { return m } - -// ResourceLocator_DirectiveValidationError is the validation error returned by -// ResourceLocator_Directive.Validate if the designated constraints aren't met. -type ResourceLocator_DirectiveValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ResourceLocator_DirectiveValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ResourceLocator_DirectiveValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ResourceLocator_DirectiveValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ResourceLocator_DirectiveValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ResourceLocator_DirectiveValidationError) ErrorName() string { - return "ResourceLocator_DirectiveValidationError" -} - -// Error satisfies the builtin error interface -func (e ResourceLocator_DirectiveValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sResourceLocator_Directive.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ResourceLocator_DirectiveValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ResourceLocator_DirectiveValidationError{} - -var _ResourceLocator_Directive_Entry_Pattern = regexp.MustCompile("^[0-9a-zA-Z_\\-\\./~:]+$") diff --git a/vendor/github.com/cncf/xds/go/xds/core/v3/resource_name.pb.go b/vendor/github.com/cncf/xds/go/xds/core/v3/resource_name.pb.go deleted file mode 100644 index 92d5fa853..000000000 --- a/vendor/github.com/cncf/xds/go/xds/core/v3/resource_name.pb.go +++ /dev/null @@ -1,190 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: xds/core/v3/resource_name.proto - -package v3 - -import ( - _ "github.com/cncf/xds/go/xds/annotations/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type ResourceName struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"` - ResourceType string `protobuf:"bytes,3,opt,name=resource_type,json=resourceType,proto3" json:"resource_type,omitempty"` - Context *ContextParams `protobuf:"bytes,4,opt,name=context,proto3" json:"context,omitempty"` -} - -func (x *ResourceName) Reset() { - *x = ResourceName{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_core_v3_resource_name_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ResourceName) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ResourceName) ProtoMessage() {} - -func (x *ResourceName) ProtoReflect() protoreflect.Message { - mi := &file_xds_core_v3_resource_name_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ResourceName.ProtoReflect.Descriptor instead. -func (*ResourceName) Descriptor() ([]byte, []int) { - return file_xds_core_v3_resource_name_proto_rawDescGZIP(), []int{0} -} - -func (x *ResourceName) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *ResourceName) GetAuthority() string { - if x != nil { - return x.Authority - } - return "" -} - -func (x *ResourceName) GetResourceType() string { - if x != nil { - return x.ResourceType - } - return "" -} - -func (x *ResourceName) GetContext() *ContextParams { - if x != nil { - return x.Context - } - return nil -} - -var File_xds_core_v3_resource_name_proto protoreflect.FileDescriptor - -var file_xds_core_v3_resource_name_proto_rawDesc = []byte{ - 0x0a, 0x1f, 0x78, 0x64, 0x73, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x72, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x0b, 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x1a, 0x1f, - 0x78, 0x64, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, - 0x76, 0x33, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x20, 0x78, 0x64, 0x73, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa0, 0x01, 0x0a, 0x0c, 0x52, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x61, - 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x2c, 0x0a, 0x0d, 0x72, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x34, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x78, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x63, - 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x42, 0x59, 0xd2, - 0xc6, 0xa4, 0xe1, 0x06, 0x02, 0x08, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x42, - 0x11, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x63, 0x6e, 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x78, 0x64, 0x73, - 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_xds_core_v3_resource_name_proto_rawDescOnce sync.Once - file_xds_core_v3_resource_name_proto_rawDescData = file_xds_core_v3_resource_name_proto_rawDesc -) - -func file_xds_core_v3_resource_name_proto_rawDescGZIP() []byte { - file_xds_core_v3_resource_name_proto_rawDescOnce.Do(func() { - file_xds_core_v3_resource_name_proto_rawDescData = protoimpl.X.CompressGZIP(file_xds_core_v3_resource_name_proto_rawDescData) - }) - return file_xds_core_v3_resource_name_proto_rawDescData -} - -var file_xds_core_v3_resource_name_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_xds_core_v3_resource_name_proto_goTypes = []interface{}{ - (*ResourceName)(nil), // 0: xds.core.v3.ResourceName - (*ContextParams)(nil), // 1: xds.core.v3.ContextParams -} -var file_xds_core_v3_resource_name_proto_depIdxs = []int32{ - 1, // 0: xds.core.v3.ResourceName.context:type_name -> xds.core.v3.ContextParams - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_xds_core_v3_resource_name_proto_init() } -func file_xds_core_v3_resource_name_proto_init() { - if File_xds_core_v3_resource_name_proto != nil { - return - } - file_xds_core_v3_context_params_proto_init() - if !protoimpl.UnsafeEnabled { - file_xds_core_v3_resource_name_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResourceName); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_xds_core_v3_resource_name_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_xds_core_v3_resource_name_proto_goTypes, - DependencyIndexes: file_xds_core_v3_resource_name_proto_depIdxs, - MessageInfos: file_xds_core_v3_resource_name_proto_msgTypes, - }.Build() - File_xds_core_v3_resource_name_proto = out.File - file_xds_core_v3_resource_name_proto_rawDesc = nil - file_xds_core_v3_resource_name_proto_goTypes = nil - file_xds_core_v3_resource_name_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/xds/core/v3/resource_name.pb.validate.go b/vendor/github.com/cncf/xds/go/xds/core/v3/resource_name.pb.validate.go deleted file mode 100644 index 270e921bc..000000000 --- a/vendor/github.com/cncf/xds/go/xds/core/v3/resource_name.pb.validate.go +++ /dev/null @@ -1,179 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: xds/core/v3/resource_name.proto - -package v3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on ResourceName with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *ResourceName) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ResourceName with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in ResourceNameMultiError, or -// nil if none found. -func (m *ResourceName) ValidateAll() error { - return m.validate(true) -} - -func (m *ResourceName) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Id - - // no validation rules for Authority - - if utf8.RuneCountInString(m.GetResourceType()) < 1 { - err := ResourceNameValidationError{ - field: "ResourceType", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetContext()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ResourceNameValidationError{ - field: "Context", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ResourceNameValidationError{ - field: "Context", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetContext()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ResourceNameValidationError{ - field: "Context", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return ResourceNameMultiError(errors) - } - - return nil -} - -// ResourceNameMultiError is an error wrapping multiple validation errors -// returned by ResourceName.ValidateAll() if the designated constraints aren't met. -type ResourceNameMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ResourceNameMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ResourceNameMultiError) AllErrors() []error { return m } - -// ResourceNameValidationError is the validation error returned by -// ResourceName.Validate if the designated constraints aren't met. -type ResourceNameValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ResourceNameValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ResourceNameValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ResourceNameValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ResourceNameValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ResourceNameValidationError) ErrorName() string { return "ResourceNameValidationError" } - -// Error satisfies the builtin error interface -func (e ResourceNameValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sResourceName.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ResourceNameValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ResourceNameValidationError{} diff --git a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/cel.pb.go b/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/cel.pb.go deleted file mode 100644 index 0d9825aff..000000000 --- a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/cel.pb.go +++ /dev/null @@ -1,172 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: xds/type/matcher/v3/cel.proto - -package v3 - -import ( - _ "github.com/cncf/xds/go/xds/annotations/v3" - v3 "github.com/cncf/xds/go/xds/type/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type CelMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ExprMatch *v3.CelExpression `protobuf:"bytes,1,opt,name=expr_match,json=exprMatch,proto3" json:"expr_match,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` -} - -func (x *CelMatcher) Reset() { - *x = CelMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_cel_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CelMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CelMatcher) ProtoMessage() {} - -func (x *CelMatcher) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_cel_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CelMatcher.ProtoReflect.Descriptor instead. -func (*CelMatcher) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_cel_proto_rawDescGZIP(), []int{0} -} - -func (x *CelMatcher) GetExprMatch() *v3.CelExpression { - if x != nil { - return x.ExprMatch - } - return nil -} - -func (x *CelMatcher) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -var File_xds_type_matcher_v3_cel_proto protoreflect.FileDescriptor - -var file_xds_type_matcher_v3_cel_proto_rawDesc = []byte{ - 0x0a, 0x1d, 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x63, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x13, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x2e, 0x76, 0x33, 0x1a, 0x1f, 0x78, 0x64, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, - 0x76, 0x33, 0x2f, 0x63, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x73, 0x0a, 0x0a, 0x43, 0x65, 0x6c, 0x4d, 0x61, 0x74, 0x63, - 0x68, 0x65, 0x72, 0x12, 0x43, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x5f, 0x6d, 0x61, 0x74, 0x63, - 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x65, 0x6c, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x09, 0x65, - 0x78, 0x70, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x60, 0xd2, 0xc6, 0xa4, 0xe1, - 0x06, 0x02, 0x08, 0x01, 0x0a, 0x1e, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x2e, 0x76, 0x33, 0x42, 0x08, 0x43, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6e, 0x63, - 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, 0x70, - 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_xds_type_matcher_v3_cel_proto_rawDescOnce sync.Once - file_xds_type_matcher_v3_cel_proto_rawDescData = file_xds_type_matcher_v3_cel_proto_rawDesc -) - -func file_xds_type_matcher_v3_cel_proto_rawDescGZIP() []byte { - file_xds_type_matcher_v3_cel_proto_rawDescOnce.Do(func() { - file_xds_type_matcher_v3_cel_proto_rawDescData = protoimpl.X.CompressGZIP(file_xds_type_matcher_v3_cel_proto_rawDescData) - }) - return file_xds_type_matcher_v3_cel_proto_rawDescData -} - -var file_xds_type_matcher_v3_cel_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_xds_type_matcher_v3_cel_proto_goTypes = []interface{}{ - (*CelMatcher)(nil), // 0: xds.type.matcher.v3.CelMatcher - (*v3.CelExpression)(nil), // 1: xds.type.v3.CelExpression -} -var file_xds_type_matcher_v3_cel_proto_depIdxs = []int32{ - 1, // 0: xds.type.matcher.v3.CelMatcher.expr_match:type_name -> xds.type.v3.CelExpression - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_xds_type_matcher_v3_cel_proto_init() } -func file_xds_type_matcher_v3_cel_proto_init() { - if File_xds_type_matcher_v3_cel_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_xds_type_matcher_v3_cel_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CelMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_xds_type_matcher_v3_cel_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_xds_type_matcher_v3_cel_proto_goTypes, - DependencyIndexes: file_xds_type_matcher_v3_cel_proto_depIdxs, - MessageInfos: file_xds_type_matcher_v3_cel_proto_msgTypes, - }.Build() - File_xds_type_matcher_v3_cel_proto = out.File - file_xds_type_matcher_v3_cel_proto_rawDesc = nil - file_xds_type_matcher_v3_cel_proto_goTypes = nil - file_xds_type_matcher_v3_cel_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/cel.pb.validate.go b/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/cel.pb.validate.go deleted file mode 100644 index 091267b0c..000000000 --- a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/cel.pb.validate.go +++ /dev/null @@ -1,177 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: xds/type/matcher/v3/cel.proto - -package v3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on CelMatcher with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *CelMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CelMatcher with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in CelMatcherMultiError, or -// nil if none found. -func (m *CelMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *CelMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetExprMatch() == nil { - err := CelMatcherValidationError{ - field: "ExprMatch", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetExprMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CelMatcherValidationError{ - field: "ExprMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CelMatcherValidationError{ - field: "ExprMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetExprMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CelMatcherValidationError{ - field: "ExprMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for Description - - if len(errors) > 0 { - return CelMatcherMultiError(errors) - } - - return nil -} - -// CelMatcherMultiError is an error wrapping multiple validation errors -// returned by CelMatcher.ValidateAll() if the designated constraints aren't met. -type CelMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CelMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CelMatcherMultiError) AllErrors() []error { return m } - -// CelMatcherValidationError is the validation error returned by -// CelMatcher.Validate if the designated constraints aren't met. -type CelMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CelMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CelMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CelMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CelMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CelMatcherValidationError) ErrorName() string { return "CelMatcherValidationError" } - -// Error satisfies the builtin error interface -func (e CelMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCelMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CelMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CelMatcherValidationError{} diff --git a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/domain.pb.go b/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/domain.pb.go deleted file mode 100644 index 28a4655ed..000000000 --- a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/domain.pb.go +++ /dev/null @@ -1,242 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: xds/type/matcher/v3/domain.proto - -package v3 - -import ( - _ "github.com/cncf/xds/go/xds/annotations/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type ServerNameMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - DomainMatchers []*ServerNameMatcher_DomainMatcher `protobuf:"bytes,1,rep,name=domain_matchers,json=domainMatchers,proto3" json:"domain_matchers,omitempty"` -} - -func (x *ServerNameMatcher) Reset() { - *x = ServerNameMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_domain_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ServerNameMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ServerNameMatcher) ProtoMessage() {} - -func (x *ServerNameMatcher) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_domain_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ServerNameMatcher.ProtoReflect.Descriptor instead. -func (*ServerNameMatcher) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_domain_proto_rawDescGZIP(), []int{0} -} - -func (x *ServerNameMatcher) GetDomainMatchers() []*ServerNameMatcher_DomainMatcher { - if x != nil { - return x.DomainMatchers - } - return nil -} - -type ServerNameMatcher_DomainMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Domains []string `protobuf:"bytes,1,rep,name=domains,proto3" json:"domains,omitempty"` - OnMatch *Matcher_OnMatch `protobuf:"bytes,2,opt,name=on_match,json=onMatch,proto3" json:"on_match,omitempty"` -} - -func (x *ServerNameMatcher_DomainMatcher) Reset() { - *x = ServerNameMatcher_DomainMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_domain_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ServerNameMatcher_DomainMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ServerNameMatcher_DomainMatcher) ProtoMessage() {} - -func (x *ServerNameMatcher_DomainMatcher) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_domain_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ServerNameMatcher_DomainMatcher.ProtoReflect.Descriptor instead. -func (*ServerNameMatcher_DomainMatcher) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_domain_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *ServerNameMatcher_DomainMatcher) GetDomains() []string { - if x != nil { - return x.Domains - } - return nil -} - -func (x *ServerNameMatcher_DomainMatcher) GetOnMatch() *Matcher_OnMatch { - if x != nil { - return x.OnMatch - } - return nil -} - -var File_xds_type_matcher_v3_domain_proto protoreflect.FileDescriptor - -var file_xds_type_matcher_v3_domain_proto_rawDesc = []byte{ - 0x0a, 0x20, 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x13, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x1a, 0x1f, 0x78, 0x64, 0x73, 0x2f, 0x61, 0x6e, 0x6e, - 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, - 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x6d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe8, 0x01, 0x0a, 0x11, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4e, - 0x61, 0x6d, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x5d, 0x0a, 0x0f, 0x64, 0x6f, - 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, - 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x4e, 0x61, 0x6d, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x44, 0x6f, 0x6d, 0x61, - 0x69, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x52, 0x0e, 0x64, 0x6f, 0x6d, 0x61, 0x69, - 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x73, 0x1a, 0x74, 0x0a, 0x0d, 0x44, 0x6f, 0x6d, - 0x61, 0x69, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x22, 0x0a, 0x07, 0x64, 0x6f, - 0x6d, 0x61, 0x69, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x42, 0x08, 0xfa, 0x42, 0x05, - 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x07, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x73, 0x12, 0x3f, - 0x0a, 0x08, 0x6f, 0x6e, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x24, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, - 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4f, - 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x52, 0x07, 0x6f, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x42, - 0x6e, 0xd2, 0xc6, 0xa4, 0xe1, 0x06, 0x02, 0x08, 0x01, 0x0a, 0x1e, 0x63, 0x6f, 0x6d, 0x2e, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, - 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x42, 0x16, 0x53, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x63, 0x6e, 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x78, 0x64, 0x73, 0x2f, - 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_xds_type_matcher_v3_domain_proto_rawDescOnce sync.Once - file_xds_type_matcher_v3_domain_proto_rawDescData = file_xds_type_matcher_v3_domain_proto_rawDesc -) - -func file_xds_type_matcher_v3_domain_proto_rawDescGZIP() []byte { - file_xds_type_matcher_v3_domain_proto_rawDescOnce.Do(func() { - file_xds_type_matcher_v3_domain_proto_rawDescData = protoimpl.X.CompressGZIP(file_xds_type_matcher_v3_domain_proto_rawDescData) - }) - return file_xds_type_matcher_v3_domain_proto_rawDescData -} - -var file_xds_type_matcher_v3_domain_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_xds_type_matcher_v3_domain_proto_goTypes = []interface{}{ - (*ServerNameMatcher)(nil), // 0: xds.type.matcher.v3.ServerNameMatcher - (*ServerNameMatcher_DomainMatcher)(nil), // 1: xds.type.matcher.v3.ServerNameMatcher.DomainMatcher - (*Matcher_OnMatch)(nil), // 2: xds.type.matcher.v3.Matcher.OnMatch -} -var file_xds_type_matcher_v3_domain_proto_depIdxs = []int32{ - 1, // 0: xds.type.matcher.v3.ServerNameMatcher.domain_matchers:type_name -> xds.type.matcher.v3.ServerNameMatcher.DomainMatcher - 2, // 1: xds.type.matcher.v3.ServerNameMatcher.DomainMatcher.on_match:type_name -> xds.type.matcher.v3.Matcher.OnMatch - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_xds_type_matcher_v3_domain_proto_init() } -func file_xds_type_matcher_v3_domain_proto_init() { - if File_xds_type_matcher_v3_domain_proto != nil { - return - } - file_xds_type_matcher_v3_matcher_proto_init() - if !protoimpl.UnsafeEnabled { - file_xds_type_matcher_v3_domain_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServerNameMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_type_matcher_v3_domain_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServerNameMatcher_DomainMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_xds_type_matcher_v3_domain_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_xds_type_matcher_v3_domain_proto_goTypes, - DependencyIndexes: file_xds_type_matcher_v3_domain_proto_depIdxs, - MessageInfos: file_xds_type_matcher_v3_domain_proto_msgTypes, - }.Build() - File_xds_type_matcher_v3_domain_proto = out.File - file_xds_type_matcher_v3_domain_proto_rawDesc = nil - file_xds_type_matcher_v3_domain_proto_goTypes = nil - file_xds_type_matcher_v3_domain_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/domain.pb.validate.go b/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/domain.pb.validate.go deleted file mode 100644 index e95bdfa28..000000000 --- a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/domain.pb.validate.go +++ /dev/null @@ -1,315 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: xds/type/matcher/v3/domain.proto - -package v3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on ServerNameMatcher with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *ServerNameMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ServerNameMatcher with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ServerNameMatcherMultiError, or nil if none found. -func (m *ServerNameMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *ServerNameMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetDomainMatchers() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ServerNameMatcherValidationError{ - field: fmt.Sprintf("DomainMatchers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ServerNameMatcherValidationError{ - field: fmt.Sprintf("DomainMatchers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ServerNameMatcherValidationError{ - field: fmt.Sprintf("DomainMatchers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return ServerNameMatcherMultiError(errors) - } - - return nil -} - -// ServerNameMatcherMultiError is an error wrapping multiple validation errors -// returned by ServerNameMatcher.ValidateAll() if the designated constraints -// aren't met. -type ServerNameMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ServerNameMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ServerNameMatcherMultiError) AllErrors() []error { return m } - -// ServerNameMatcherValidationError is the validation error returned by -// ServerNameMatcher.Validate if the designated constraints aren't met. -type ServerNameMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ServerNameMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ServerNameMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ServerNameMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ServerNameMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ServerNameMatcherValidationError) ErrorName() string { - return "ServerNameMatcherValidationError" -} - -// Error satisfies the builtin error interface -func (e ServerNameMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sServerNameMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ServerNameMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ServerNameMatcherValidationError{} - -// Validate checks the field values on ServerNameMatcher_DomainMatcher with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ServerNameMatcher_DomainMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ServerNameMatcher_DomainMatcher with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// ServerNameMatcher_DomainMatcherMultiError, or nil if none found. -func (m *ServerNameMatcher_DomainMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *ServerNameMatcher_DomainMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(m.GetDomains()) < 1 { - err := ServerNameMatcher_DomainMatcherValidationError{ - field: "Domains", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetOnMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ServerNameMatcher_DomainMatcherValidationError{ - field: "OnMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ServerNameMatcher_DomainMatcherValidationError{ - field: "OnMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetOnMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ServerNameMatcher_DomainMatcherValidationError{ - field: "OnMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return ServerNameMatcher_DomainMatcherMultiError(errors) - } - - return nil -} - -// ServerNameMatcher_DomainMatcherMultiError is an error wrapping multiple -// validation errors returned by ServerNameMatcher_DomainMatcher.ValidateAll() -// if the designated constraints aren't met. -type ServerNameMatcher_DomainMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ServerNameMatcher_DomainMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ServerNameMatcher_DomainMatcherMultiError) AllErrors() []error { return m } - -// ServerNameMatcher_DomainMatcherValidationError is the validation error -// returned by ServerNameMatcher_DomainMatcher.Validate if the designated -// constraints aren't met. -type ServerNameMatcher_DomainMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ServerNameMatcher_DomainMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ServerNameMatcher_DomainMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ServerNameMatcher_DomainMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ServerNameMatcher_DomainMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ServerNameMatcher_DomainMatcherValidationError) ErrorName() string { - return "ServerNameMatcher_DomainMatcherValidationError" -} - -// Error satisfies the builtin error interface -func (e ServerNameMatcher_DomainMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sServerNameMatcher_DomainMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ServerNameMatcher_DomainMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ServerNameMatcher_DomainMatcherValidationError{} diff --git a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/http_inputs.pb.go b/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/http_inputs.pb.go deleted file mode 100644 index 40656caf0..000000000 --- a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/http_inputs.pb.go +++ /dev/null @@ -1,143 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: xds/type/matcher/v3/http_inputs.proto - -package v3 - -import ( - _ "github.com/cncf/xds/go/xds/annotations/v3" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type HttpAttributesCelMatchInput struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *HttpAttributesCelMatchInput) Reset() { - *x = HttpAttributesCelMatchInput{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_http_inputs_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HttpAttributesCelMatchInput) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HttpAttributesCelMatchInput) ProtoMessage() {} - -func (x *HttpAttributesCelMatchInput) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_http_inputs_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HttpAttributesCelMatchInput.ProtoReflect.Descriptor instead. -func (*HttpAttributesCelMatchInput) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_http_inputs_proto_rawDescGZIP(), []int{0} -} - -var File_xds_type_matcher_v3_http_inputs_proto protoreflect.FileDescriptor - -var file_xds_type_matcher_v3_http_inputs_proto_rawDesc = []byte{ - 0x0a, 0x25, 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, - 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x1a, 0x1f, 0x78, 0x64, - 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x33, - 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x1d, 0x0a, - 0x1b, 0x48, 0x74, 0x74, 0x70, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x43, - 0x65, 0x6c, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x42, 0x67, 0xd2, 0xc6, - 0xa4, 0xe1, 0x06, 0x02, 0x08, 0x01, 0x0a, 0x1e, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, - 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x42, 0x0f, 0x48, 0x74, 0x74, 0x70, 0x49, 0x6e, 0x70, 0x75, - 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6e, 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, - 0x6f, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x2f, 0x76, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_xds_type_matcher_v3_http_inputs_proto_rawDescOnce sync.Once - file_xds_type_matcher_v3_http_inputs_proto_rawDescData = file_xds_type_matcher_v3_http_inputs_proto_rawDesc -) - -func file_xds_type_matcher_v3_http_inputs_proto_rawDescGZIP() []byte { - file_xds_type_matcher_v3_http_inputs_proto_rawDescOnce.Do(func() { - file_xds_type_matcher_v3_http_inputs_proto_rawDescData = protoimpl.X.CompressGZIP(file_xds_type_matcher_v3_http_inputs_proto_rawDescData) - }) - return file_xds_type_matcher_v3_http_inputs_proto_rawDescData -} - -var file_xds_type_matcher_v3_http_inputs_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_xds_type_matcher_v3_http_inputs_proto_goTypes = []interface{}{ - (*HttpAttributesCelMatchInput)(nil), // 0: xds.type.matcher.v3.HttpAttributesCelMatchInput -} -var file_xds_type_matcher_v3_http_inputs_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_xds_type_matcher_v3_http_inputs_proto_init() } -func file_xds_type_matcher_v3_http_inputs_proto_init() { - if File_xds_type_matcher_v3_http_inputs_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_xds_type_matcher_v3_http_inputs_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HttpAttributesCelMatchInput); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_xds_type_matcher_v3_http_inputs_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_xds_type_matcher_v3_http_inputs_proto_goTypes, - DependencyIndexes: file_xds_type_matcher_v3_http_inputs_proto_depIdxs, - MessageInfos: file_xds_type_matcher_v3_http_inputs_proto_msgTypes, - }.Build() - File_xds_type_matcher_v3_http_inputs_proto = out.File - file_xds_type_matcher_v3_http_inputs_proto_rawDesc = nil - file_xds_type_matcher_v3_http_inputs_proto_goTypes = nil - file_xds_type_matcher_v3_http_inputs_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/http_inputs.pb.validate.go b/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/http_inputs.pb.validate.go deleted file mode 100644 index 5d8742927..000000000 --- a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/http_inputs.pb.validate.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: xds/type/matcher/v3/http_inputs.proto - -package v3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on HttpAttributesCelMatchInput with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *HttpAttributesCelMatchInput) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HttpAttributesCelMatchInput with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// HttpAttributesCelMatchInputMultiError, or nil if none found. -func (m *HttpAttributesCelMatchInput) ValidateAll() error { - return m.validate(true) -} - -func (m *HttpAttributesCelMatchInput) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return HttpAttributesCelMatchInputMultiError(errors) - } - - return nil -} - -// HttpAttributesCelMatchInputMultiError is an error wrapping multiple -// validation errors returned by HttpAttributesCelMatchInput.ValidateAll() if -// the designated constraints aren't met. -type HttpAttributesCelMatchInputMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HttpAttributesCelMatchInputMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HttpAttributesCelMatchInputMultiError) AllErrors() []error { return m } - -// HttpAttributesCelMatchInputValidationError is the validation error returned -// by HttpAttributesCelMatchInput.Validate if the designated constraints -// aren't met. -type HttpAttributesCelMatchInputValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HttpAttributesCelMatchInputValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HttpAttributesCelMatchInputValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HttpAttributesCelMatchInputValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HttpAttributesCelMatchInputValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HttpAttributesCelMatchInputValidationError) ErrorName() string { - return "HttpAttributesCelMatchInputValidationError" -} - -// Error satisfies the builtin error interface -func (e HttpAttributesCelMatchInputValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttpAttributesCelMatchInput.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HttpAttributesCelMatchInputValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HttpAttributesCelMatchInputValidationError{} diff --git a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/ip.pb.go b/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/ip.pb.go deleted file mode 100644 index 7254d3ba5..000000000 --- a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/ip.pb.go +++ /dev/null @@ -1,256 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: xds/type/matcher/v3/ip.proto - -package v3 - -import ( - _ "github.com/cncf/xds/go/xds/annotations/v3" - v3 "github.com/cncf/xds/go/xds/core/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type IPMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RangeMatchers []*IPMatcher_IPRangeMatcher `protobuf:"bytes,1,rep,name=range_matchers,json=rangeMatchers,proto3" json:"range_matchers,omitempty"` -} - -func (x *IPMatcher) Reset() { - *x = IPMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_ip_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *IPMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*IPMatcher) ProtoMessage() {} - -func (x *IPMatcher) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_ip_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use IPMatcher.ProtoReflect.Descriptor instead. -func (*IPMatcher) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_ip_proto_rawDescGZIP(), []int{0} -} - -func (x *IPMatcher) GetRangeMatchers() []*IPMatcher_IPRangeMatcher { - if x != nil { - return x.RangeMatchers - } - return nil -} - -type IPMatcher_IPRangeMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Ranges []*v3.CidrRange `protobuf:"bytes,1,rep,name=ranges,proto3" json:"ranges,omitempty"` - OnMatch *Matcher_OnMatch `protobuf:"bytes,2,opt,name=on_match,json=onMatch,proto3" json:"on_match,omitempty"` - Exclusive bool `protobuf:"varint,3,opt,name=exclusive,proto3" json:"exclusive,omitempty"` -} - -func (x *IPMatcher_IPRangeMatcher) Reset() { - *x = IPMatcher_IPRangeMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_ip_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *IPMatcher_IPRangeMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*IPMatcher_IPRangeMatcher) ProtoMessage() {} - -func (x *IPMatcher_IPRangeMatcher) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_ip_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use IPMatcher_IPRangeMatcher.ProtoReflect.Descriptor instead. -func (*IPMatcher_IPRangeMatcher) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_ip_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *IPMatcher_IPRangeMatcher) GetRanges() []*v3.CidrRange { - if x != nil { - return x.Ranges - } - return nil -} - -func (x *IPMatcher_IPRangeMatcher) GetOnMatch() *Matcher_OnMatch { - if x != nil { - return x.OnMatch - } - return nil -} - -func (x *IPMatcher_IPRangeMatcher) GetExclusive() bool { - if x != nil { - return x.Exclusive - } - return false -} - -var File_xds_type_matcher_v3_ip_proto protoreflect.FileDescriptor - -var file_xds_type_matcher_v3_ip_proto_rawDesc = []byte{ - 0x0a, 0x1c, 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x69, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, - 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, - 0x2e, 0x76, 0x33, 0x1a, 0x1f, 0x78, 0x64, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x78, 0x64, 0x73, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, - 0x33, 0x2f, 0x63, 0x69, 0x64, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x78, 0x64, - 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, - 0x33, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8d, 0x02, 0x0a, 0x09, 0x49, 0x50, 0x4d, - 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x54, 0x0a, 0x0e, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, - 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x50, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x49, - 0x50, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x52, 0x0d, 0x72, - 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x73, 0x1a, 0xa9, 0x01, 0x0a, - 0x0e, 0x49, 0x50, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, - 0x38, 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x16, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x69, - 0x64, 0x72, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, - 0x01, 0x52, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x08, 0x6f, 0x6e, 0x5f, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x78, 0x64, - 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, - 0x33, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4f, 0x6e, 0x4d, 0x61, 0x74, 0x63, - 0x68, 0x52, 0x07, 0x6f, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x78, - 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x65, - 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x42, 0x66, 0xd2, 0xc6, 0xa4, 0xe1, 0x06, 0x02, - 0x08, 0x01, 0x0a, 0x1e, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x78, - 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, - 0x76, 0x33, 0x42, 0x0e, 0x49, 0x50, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x63, 0x6e, 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x78, 0x64, 0x73, - 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_xds_type_matcher_v3_ip_proto_rawDescOnce sync.Once - file_xds_type_matcher_v3_ip_proto_rawDescData = file_xds_type_matcher_v3_ip_proto_rawDesc -) - -func file_xds_type_matcher_v3_ip_proto_rawDescGZIP() []byte { - file_xds_type_matcher_v3_ip_proto_rawDescOnce.Do(func() { - file_xds_type_matcher_v3_ip_proto_rawDescData = protoimpl.X.CompressGZIP(file_xds_type_matcher_v3_ip_proto_rawDescData) - }) - return file_xds_type_matcher_v3_ip_proto_rawDescData -} - -var file_xds_type_matcher_v3_ip_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_xds_type_matcher_v3_ip_proto_goTypes = []interface{}{ - (*IPMatcher)(nil), // 0: xds.type.matcher.v3.IPMatcher - (*IPMatcher_IPRangeMatcher)(nil), // 1: xds.type.matcher.v3.IPMatcher.IPRangeMatcher - (*v3.CidrRange)(nil), // 2: xds.core.v3.CidrRange - (*Matcher_OnMatch)(nil), // 3: xds.type.matcher.v3.Matcher.OnMatch -} -var file_xds_type_matcher_v3_ip_proto_depIdxs = []int32{ - 1, // 0: xds.type.matcher.v3.IPMatcher.range_matchers:type_name -> xds.type.matcher.v3.IPMatcher.IPRangeMatcher - 2, // 1: xds.type.matcher.v3.IPMatcher.IPRangeMatcher.ranges:type_name -> xds.core.v3.CidrRange - 3, // 2: xds.type.matcher.v3.IPMatcher.IPRangeMatcher.on_match:type_name -> xds.type.matcher.v3.Matcher.OnMatch - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_xds_type_matcher_v3_ip_proto_init() } -func file_xds_type_matcher_v3_ip_proto_init() { - if File_xds_type_matcher_v3_ip_proto != nil { - return - } - file_xds_type_matcher_v3_matcher_proto_init() - if !protoimpl.UnsafeEnabled { - file_xds_type_matcher_v3_ip_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IPMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_type_matcher_v3_ip_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IPMatcher_IPRangeMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_xds_type_matcher_v3_ip_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_xds_type_matcher_v3_ip_proto_goTypes, - DependencyIndexes: file_xds_type_matcher_v3_ip_proto_depIdxs, - MessageInfos: file_xds_type_matcher_v3_ip_proto_msgTypes, - }.Build() - File_xds_type_matcher_v3_ip_proto = out.File - file_xds_type_matcher_v3_ip_proto_rawDesc = nil - file_xds_type_matcher_v3_ip_proto_goTypes = nil - file_xds_type_matcher_v3_ip_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/ip.pb.validate.go b/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/ip.pb.validate.go deleted file mode 100644 index c1fca03bc..000000000 --- a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/ip.pb.validate.go +++ /dev/null @@ -1,347 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: xds/type/matcher/v3/ip.proto - -package v3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on IPMatcher with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *IPMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on IPMatcher with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in IPMatcherMultiError, or nil -// if none found. -func (m *IPMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *IPMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetRangeMatchers() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, IPMatcherValidationError{ - field: fmt.Sprintf("RangeMatchers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, IPMatcherValidationError{ - field: fmt.Sprintf("RangeMatchers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return IPMatcherValidationError{ - field: fmt.Sprintf("RangeMatchers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return IPMatcherMultiError(errors) - } - - return nil -} - -// IPMatcherMultiError is an error wrapping multiple validation errors returned -// by IPMatcher.ValidateAll() if the designated constraints aren't met. -type IPMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m IPMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m IPMatcherMultiError) AllErrors() []error { return m } - -// IPMatcherValidationError is the validation error returned by -// IPMatcher.Validate if the designated constraints aren't met. -type IPMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e IPMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e IPMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e IPMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e IPMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e IPMatcherValidationError) ErrorName() string { return "IPMatcherValidationError" } - -// Error satisfies the builtin error interface -func (e IPMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sIPMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = IPMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = IPMatcherValidationError{} - -// Validate checks the field values on IPMatcher_IPRangeMatcher with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *IPMatcher_IPRangeMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on IPMatcher_IPRangeMatcher with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// IPMatcher_IPRangeMatcherMultiError, or nil if none found. -func (m *IPMatcher_IPRangeMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *IPMatcher_IPRangeMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(m.GetRanges()) < 1 { - err := IPMatcher_IPRangeMatcherValidationError{ - field: "Ranges", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetRanges() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, IPMatcher_IPRangeMatcherValidationError{ - field: fmt.Sprintf("Ranges[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, IPMatcher_IPRangeMatcherValidationError{ - field: fmt.Sprintf("Ranges[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return IPMatcher_IPRangeMatcherValidationError{ - field: fmt.Sprintf("Ranges[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetOnMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, IPMatcher_IPRangeMatcherValidationError{ - field: "OnMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, IPMatcher_IPRangeMatcherValidationError{ - field: "OnMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetOnMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return IPMatcher_IPRangeMatcherValidationError{ - field: "OnMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for Exclusive - - if len(errors) > 0 { - return IPMatcher_IPRangeMatcherMultiError(errors) - } - - return nil -} - -// IPMatcher_IPRangeMatcherMultiError is an error wrapping multiple validation -// errors returned by IPMatcher_IPRangeMatcher.ValidateAll() if the designated -// constraints aren't met. -type IPMatcher_IPRangeMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m IPMatcher_IPRangeMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m IPMatcher_IPRangeMatcherMultiError) AllErrors() []error { return m } - -// IPMatcher_IPRangeMatcherValidationError is the validation error returned by -// IPMatcher_IPRangeMatcher.Validate if the designated constraints aren't met. -type IPMatcher_IPRangeMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e IPMatcher_IPRangeMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e IPMatcher_IPRangeMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e IPMatcher_IPRangeMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e IPMatcher_IPRangeMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e IPMatcher_IPRangeMatcherValidationError) ErrorName() string { - return "IPMatcher_IPRangeMatcherValidationError" -} - -// Error satisfies the builtin error interface -func (e IPMatcher_IPRangeMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sIPMatcher_IPRangeMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = IPMatcher_IPRangeMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = IPMatcher_IPRangeMatcherValidationError{} diff --git a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/matcher.pb.go b/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/matcher.pb.go deleted file mode 100644 index eff1ce1aa..000000000 --- a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/matcher.pb.go +++ /dev/null @@ -1,1060 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: xds/type/matcher/v3/matcher.proto - -package v3 - -import ( - _ "github.com/cncf/xds/go/xds/annotations/v3" - v3 "github.com/cncf/xds/go/xds/core/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type Matcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to MatcherType: - // - // *Matcher_MatcherList_ - // *Matcher_MatcherTree_ - MatcherType isMatcher_MatcherType `protobuf_oneof:"matcher_type"` - OnNoMatch *Matcher_OnMatch `protobuf:"bytes,3,opt,name=on_no_match,json=onNoMatch,proto3" json:"on_no_match,omitempty"` -} - -func (x *Matcher) Reset() { - *x = Matcher{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_matcher_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Matcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Matcher) ProtoMessage() {} - -func (x *Matcher) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_matcher_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Matcher.ProtoReflect.Descriptor instead. -func (*Matcher) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_matcher_proto_rawDescGZIP(), []int{0} -} - -func (m *Matcher) GetMatcherType() isMatcher_MatcherType { - if m != nil { - return m.MatcherType - } - return nil -} - -func (x *Matcher) GetMatcherList() *Matcher_MatcherList { - if x, ok := x.GetMatcherType().(*Matcher_MatcherList_); ok { - return x.MatcherList - } - return nil -} - -func (x *Matcher) GetMatcherTree() *Matcher_MatcherTree { - if x, ok := x.GetMatcherType().(*Matcher_MatcherTree_); ok { - return x.MatcherTree - } - return nil -} - -func (x *Matcher) GetOnNoMatch() *Matcher_OnMatch { - if x != nil { - return x.OnNoMatch - } - return nil -} - -type isMatcher_MatcherType interface { - isMatcher_MatcherType() -} - -type Matcher_MatcherList_ struct { - MatcherList *Matcher_MatcherList `protobuf:"bytes,1,opt,name=matcher_list,json=matcherList,proto3,oneof"` -} - -type Matcher_MatcherTree_ struct { - MatcherTree *Matcher_MatcherTree `protobuf:"bytes,2,opt,name=matcher_tree,json=matcherTree,proto3,oneof"` -} - -func (*Matcher_MatcherList_) isMatcher_MatcherType() {} - -func (*Matcher_MatcherTree_) isMatcher_MatcherType() {} - -type Matcher_OnMatch struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to OnMatch: - // - // *Matcher_OnMatch_Matcher - // *Matcher_OnMatch_Action - OnMatch isMatcher_OnMatch_OnMatch `protobuf_oneof:"on_match"` -} - -func (x *Matcher_OnMatch) Reset() { - *x = Matcher_OnMatch{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_matcher_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Matcher_OnMatch) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Matcher_OnMatch) ProtoMessage() {} - -func (x *Matcher_OnMatch) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_matcher_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Matcher_OnMatch.ProtoReflect.Descriptor instead. -func (*Matcher_OnMatch) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_matcher_proto_rawDescGZIP(), []int{0, 0} -} - -func (m *Matcher_OnMatch) GetOnMatch() isMatcher_OnMatch_OnMatch { - if m != nil { - return m.OnMatch - } - return nil -} - -func (x *Matcher_OnMatch) GetMatcher() *Matcher { - if x, ok := x.GetOnMatch().(*Matcher_OnMatch_Matcher); ok { - return x.Matcher - } - return nil -} - -func (x *Matcher_OnMatch) GetAction() *v3.TypedExtensionConfig { - if x, ok := x.GetOnMatch().(*Matcher_OnMatch_Action); ok { - return x.Action - } - return nil -} - -type isMatcher_OnMatch_OnMatch interface { - isMatcher_OnMatch_OnMatch() -} - -type Matcher_OnMatch_Matcher struct { - Matcher *Matcher `protobuf:"bytes,1,opt,name=matcher,proto3,oneof"` -} - -type Matcher_OnMatch_Action struct { - Action *v3.TypedExtensionConfig `protobuf:"bytes,2,opt,name=action,proto3,oneof"` -} - -func (*Matcher_OnMatch_Matcher) isMatcher_OnMatch_OnMatch() {} - -func (*Matcher_OnMatch_Action) isMatcher_OnMatch_OnMatch() {} - -type Matcher_MatcherList struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Matchers []*Matcher_MatcherList_FieldMatcher `protobuf:"bytes,1,rep,name=matchers,proto3" json:"matchers,omitempty"` -} - -func (x *Matcher_MatcherList) Reset() { - *x = Matcher_MatcherList{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_matcher_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Matcher_MatcherList) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Matcher_MatcherList) ProtoMessage() {} - -func (x *Matcher_MatcherList) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_matcher_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Matcher_MatcherList.ProtoReflect.Descriptor instead. -func (*Matcher_MatcherList) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_matcher_proto_rawDescGZIP(), []int{0, 1} -} - -func (x *Matcher_MatcherList) GetMatchers() []*Matcher_MatcherList_FieldMatcher { - if x != nil { - return x.Matchers - } - return nil -} - -type Matcher_MatcherTree struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Input *v3.TypedExtensionConfig `protobuf:"bytes,1,opt,name=input,proto3" json:"input,omitempty"` - // Types that are assignable to TreeType: - // - // *Matcher_MatcherTree_ExactMatchMap - // *Matcher_MatcherTree_PrefixMatchMap - // *Matcher_MatcherTree_CustomMatch - TreeType isMatcher_MatcherTree_TreeType `protobuf_oneof:"tree_type"` -} - -func (x *Matcher_MatcherTree) Reset() { - *x = Matcher_MatcherTree{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_matcher_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Matcher_MatcherTree) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Matcher_MatcherTree) ProtoMessage() {} - -func (x *Matcher_MatcherTree) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_matcher_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Matcher_MatcherTree.ProtoReflect.Descriptor instead. -func (*Matcher_MatcherTree) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_matcher_proto_rawDescGZIP(), []int{0, 2} -} - -func (x *Matcher_MatcherTree) GetInput() *v3.TypedExtensionConfig { - if x != nil { - return x.Input - } - return nil -} - -func (m *Matcher_MatcherTree) GetTreeType() isMatcher_MatcherTree_TreeType { - if m != nil { - return m.TreeType - } - return nil -} - -func (x *Matcher_MatcherTree) GetExactMatchMap() *Matcher_MatcherTree_MatchMap { - if x, ok := x.GetTreeType().(*Matcher_MatcherTree_ExactMatchMap); ok { - return x.ExactMatchMap - } - return nil -} - -func (x *Matcher_MatcherTree) GetPrefixMatchMap() *Matcher_MatcherTree_MatchMap { - if x, ok := x.GetTreeType().(*Matcher_MatcherTree_PrefixMatchMap); ok { - return x.PrefixMatchMap - } - return nil -} - -func (x *Matcher_MatcherTree) GetCustomMatch() *v3.TypedExtensionConfig { - if x, ok := x.GetTreeType().(*Matcher_MatcherTree_CustomMatch); ok { - return x.CustomMatch - } - return nil -} - -type isMatcher_MatcherTree_TreeType interface { - isMatcher_MatcherTree_TreeType() -} - -type Matcher_MatcherTree_ExactMatchMap struct { - ExactMatchMap *Matcher_MatcherTree_MatchMap `protobuf:"bytes,2,opt,name=exact_match_map,json=exactMatchMap,proto3,oneof"` -} - -type Matcher_MatcherTree_PrefixMatchMap struct { - PrefixMatchMap *Matcher_MatcherTree_MatchMap `protobuf:"bytes,3,opt,name=prefix_match_map,json=prefixMatchMap,proto3,oneof"` -} - -type Matcher_MatcherTree_CustomMatch struct { - CustomMatch *v3.TypedExtensionConfig `protobuf:"bytes,4,opt,name=custom_match,json=customMatch,proto3,oneof"` -} - -func (*Matcher_MatcherTree_ExactMatchMap) isMatcher_MatcherTree_TreeType() {} - -func (*Matcher_MatcherTree_PrefixMatchMap) isMatcher_MatcherTree_TreeType() {} - -func (*Matcher_MatcherTree_CustomMatch) isMatcher_MatcherTree_TreeType() {} - -type Matcher_MatcherList_Predicate struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to MatchType: - // - // *Matcher_MatcherList_Predicate_SinglePredicate_ - // *Matcher_MatcherList_Predicate_OrMatcher - // *Matcher_MatcherList_Predicate_AndMatcher - // *Matcher_MatcherList_Predicate_NotMatcher - MatchType isMatcher_MatcherList_Predicate_MatchType `protobuf_oneof:"match_type"` -} - -func (x *Matcher_MatcherList_Predicate) Reset() { - *x = Matcher_MatcherList_Predicate{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_matcher_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Matcher_MatcherList_Predicate) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Matcher_MatcherList_Predicate) ProtoMessage() {} - -func (x *Matcher_MatcherList_Predicate) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_matcher_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Matcher_MatcherList_Predicate.ProtoReflect.Descriptor instead. -func (*Matcher_MatcherList_Predicate) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_matcher_proto_rawDescGZIP(), []int{0, 1, 0} -} - -func (m *Matcher_MatcherList_Predicate) GetMatchType() isMatcher_MatcherList_Predicate_MatchType { - if m != nil { - return m.MatchType - } - return nil -} - -func (x *Matcher_MatcherList_Predicate) GetSinglePredicate() *Matcher_MatcherList_Predicate_SinglePredicate { - if x, ok := x.GetMatchType().(*Matcher_MatcherList_Predicate_SinglePredicate_); ok { - return x.SinglePredicate - } - return nil -} - -func (x *Matcher_MatcherList_Predicate) GetOrMatcher() *Matcher_MatcherList_Predicate_PredicateList { - if x, ok := x.GetMatchType().(*Matcher_MatcherList_Predicate_OrMatcher); ok { - return x.OrMatcher - } - return nil -} - -func (x *Matcher_MatcherList_Predicate) GetAndMatcher() *Matcher_MatcherList_Predicate_PredicateList { - if x, ok := x.GetMatchType().(*Matcher_MatcherList_Predicate_AndMatcher); ok { - return x.AndMatcher - } - return nil -} - -func (x *Matcher_MatcherList_Predicate) GetNotMatcher() *Matcher_MatcherList_Predicate { - if x, ok := x.GetMatchType().(*Matcher_MatcherList_Predicate_NotMatcher); ok { - return x.NotMatcher - } - return nil -} - -type isMatcher_MatcherList_Predicate_MatchType interface { - isMatcher_MatcherList_Predicate_MatchType() -} - -type Matcher_MatcherList_Predicate_SinglePredicate_ struct { - SinglePredicate *Matcher_MatcherList_Predicate_SinglePredicate `protobuf:"bytes,1,opt,name=single_predicate,json=singlePredicate,proto3,oneof"` -} - -type Matcher_MatcherList_Predicate_OrMatcher struct { - OrMatcher *Matcher_MatcherList_Predicate_PredicateList `protobuf:"bytes,2,opt,name=or_matcher,json=orMatcher,proto3,oneof"` -} - -type Matcher_MatcherList_Predicate_AndMatcher struct { - AndMatcher *Matcher_MatcherList_Predicate_PredicateList `protobuf:"bytes,3,opt,name=and_matcher,json=andMatcher,proto3,oneof"` -} - -type Matcher_MatcherList_Predicate_NotMatcher struct { - NotMatcher *Matcher_MatcherList_Predicate `protobuf:"bytes,4,opt,name=not_matcher,json=notMatcher,proto3,oneof"` -} - -func (*Matcher_MatcherList_Predicate_SinglePredicate_) isMatcher_MatcherList_Predicate_MatchType() {} - -func (*Matcher_MatcherList_Predicate_OrMatcher) isMatcher_MatcherList_Predicate_MatchType() {} - -func (*Matcher_MatcherList_Predicate_AndMatcher) isMatcher_MatcherList_Predicate_MatchType() {} - -func (*Matcher_MatcherList_Predicate_NotMatcher) isMatcher_MatcherList_Predicate_MatchType() {} - -type Matcher_MatcherList_FieldMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Predicate *Matcher_MatcherList_Predicate `protobuf:"bytes,1,opt,name=predicate,proto3" json:"predicate,omitempty"` - OnMatch *Matcher_OnMatch `protobuf:"bytes,2,opt,name=on_match,json=onMatch,proto3" json:"on_match,omitempty"` -} - -func (x *Matcher_MatcherList_FieldMatcher) Reset() { - *x = Matcher_MatcherList_FieldMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_matcher_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Matcher_MatcherList_FieldMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Matcher_MatcherList_FieldMatcher) ProtoMessage() {} - -func (x *Matcher_MatcherList_FieldMatcher) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_matcher_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Matcher_MatcherList_FieldMatcher.ProtoReflect.Descriptor instead. -func (*Matcher_MatcherList_FieldMatcher) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_matcher_proto_rawDescGZIP(), []int{0, 1, 1} -} - -func (x *Matcher_MatcherList_FieldMatcher) GetPredicate() *Matcher_MatcherList_Predicate { - if x != nil { - return x.Predicate - } - return nil -} - -func (x *Matcher_MatcherList_FieldMatcher) GetOnMatch() *Matcher_OnMatch { - if x != nil { - return x.OnMatch - } - return nil -} - -type Matcher_MatcherList_Predicate_SinglePredicate struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Input *v3.TypedExtensionConfig `protobuf:"bytes,1,opt,name=input,proto3" json:"input,omitempty"` - // Types that are assignable to Matcher: - // - // *Matcher_MatcherList_Predicate_SinglePredicate_ValueMatch - // *Matcher_MatcherList_Predicate_SinglePredicate_CustomMatch - Matcher isMatcher_MatcherList_Predicate_SinglePredicate_Matcher `protobuf_oneof:"matcher"` -} - -func (x *Matcher_MatcherList_Predicate_SinglePredicate) Reset() { - *x = Matcher_MatcherList_Predicate_SinglePredicate{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_matcher_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Matcher_MatcherList_Predicate_SinglePredicate) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Matcher_MatcherList_Predicate_SinglePredicate) ProtoMessage() {} - -func (x *Matcher_MatcherList_Predicate_SinglePredicate) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_matcher_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Matcher_MatcherList_Predicate_SinglePredicate.ProtoReflect.Descriptor instead. -func (*Matcher_MatcherList_Predicate_SinglePredicate) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_matcher_proto_rawDescGZIP(), []int{0, 1, 0, 0} -} - -func (x *Matcher_MatcherList_Predicate_SinglePredicate) GetInput() *v3.TypedExtensionConfig { - if x != nil { - return x.Input - } - return nil -} - -func (m *Matcher_MatcherList_Predicate_SinglePredicate) GetMatcher() isMatcher_MatcherList_Predicate_SinglePredicate_Matcher { - if m != nil { - return m.Matcher - } - return nil -} - -func (x *Matcher_MatcherList_Predicate_SinglePredicate) GetValueMatch() *StringMatcher { - if x, ok := x.GetMatcher().(*Matcher_MatcherList_Predicate_SinglePredicate_ValueMatch); ok { - return x.ValueMatch - } - return nil -} - -func (x *Matcher_MatcherList_Predicate_SinglePredicate) GetCustomMatch() *v3.TypedExtensionConfig { - if x, ok := x.GetMatcher().(*Matcher_MatcherList_Predicate_SinglePredicate_CustomMatch); ok { - return x.CustomMatch - } - return nil -} - -type isMatcher_MatcherList_Predicate_SinglePredicate_Matcher interface { - isMatcher_MatcherList_Predicate_SinglePredicate_Matcher() -} - -type Matcher_MatcherList_Predicate_SinglePredicate_ValueMatch struct { - ValueMatch *StringMatcher `protobuf:"bytes,2,opt,name=value_match,json=valueMatch,proto3,oneof"` -} - -type Matcher_MatcherList_Predicate_SinglePredicate_CustomMatch struct { - CustomMatch *v3.TypedExtensionConfig `protobuf:"bytes,3,opt,name=custom_match,json=customMatch,proto3,oneof"` -} - -func (*Matcher_MatcherList_Predicate_SinglePredicate_ValueMatch) isMatcher_MatcherList_Predicate_SinglePredicate_Matcher() { -} - -func (*Matcher_MatcherList_Predicate_SinglePredicate_CustomMatch) isMatcher_MatcherList_Predicate_SinglePredicate_Matcher() { -} - -type Matcher_MatcherList_Predicate_PredicateList struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Predicate []*Matcher_MatcherList_Predicate `protobuf:"bytes,1,rep,name=predicate,proto3" json:"predicate,omitempty"` -} - -func (x *Matcher_MatcherList_Predicate_PredicateList) Reset() { - *x = Matcher_MatcherList_Predicate_PredicateList{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_matcher_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Matcher_MatcherList_Predicate_PredicateList) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Matcher_MatcherList_Predicate_PredicateList) ProtoMessage() {} - -func (x *Matcher_MatcherList_Predicate_PredicateList) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_matcher_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Matcher_MatcherList_Predicate_PredicateList.ProtoReflect.Descriptor instead. -func (*Matcher_MatcherList_Predicate_PredicateList) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_matcher_proto_rawDescGZIP(), []int{0, 1, 0, 1} -} - -func (x *Matcher_MatcherList_Predicate_PredicateList) GetPredicate() []*Matcher_MatcherList_Predicate { - if x != nil { - return x.Predicate - } - return nil -} - -type Matcher_MatcherTree_MatchMap struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Map map[string]*Matcher_OnMatch `protobuf:"bytes,1,rep,name=map,proto3" json:"map,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *Matcher_MatcherTree_MatchMap) Reset() { - *x = Matcher_MatcherTree_MatchMap{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_matcher_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Matcher_MatcherTree_MatchMap) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Matcher_MatcherTree_MatchMap) ProtoMessage() {} - -func (x *Matcher_MatcherTree_MatchMap) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_matcher_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Matcher_MatcherTree_MatchMap.ProtoReflect.Descriptor instead. -func (*Matcher_MatcherTree_MatchMap) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_matcher_proto_rawDescGZIP(), []int{0, 2, 0} -} - -func (x *Matcher_MatcherTree_MatchMap) GetMap() map[string]*Matcher_OnMatch { - if x != nil { - return x.Map - } - return nil -} - -var File_xds_type_matcher_v3_matcher_proto protoreflect.FileDescriptor - -var file_xds_type_matcher_v3_matcher_proto_rawDesc = []byte{ - 0x0a, 0x21, 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x1a, 0x1f, 0x78, 0x64, 0x73, 0x2f, 0x61, 0x6e, - 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x78, 0x64, 0x73, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, - 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x74, 0x72, 0x69, - 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0x80, 0x10, 0x0a, 0x07, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x4d, 0x0a, - 0x0c, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, - 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x00, 0x52, - 0x0b, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x4d, 0x0a, 0x0c, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x5f, 0x74, 0x72, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, - 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x54, 0x72, 0x65, 0x65, 0x48, 0x00, 0x52, 0x0b, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x54, 0x72, 0x65, 0x65, 0x12, 0x44, 0x0a, 0x0b, 0x6f, - 0x6e, 0x5f, 0x6e, 0x6f, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x24, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, - 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4f, - 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x52, 0x09, 0x6f, 0x6e, 0x4e, 0x6f, 0x4d, 0x61, 0x74, 0x63, - 0x68, 0x1a, 0x91, 0x01, 0x0a, 0x07, 0x4f, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x38, 0x0a, - 0x07, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, - 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x48, 0x00, 0x52, 0x07, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x00, 0x52, 0x06, 0x61, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0f, 0x0a, 0x08, 0x6f, 0x6e, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, 0xb6, 0x08, 0x0a, 0x0b, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x5b, 0x0a, 0x08, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x4c, 0x69, 0x73, - 0x74, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x42, 0x08, - 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x08, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x73, 0x1a, 0x91, 0x06, 0x0a, 0x09, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, - 0x12, 0x6f, 0x0a, 0x10, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x5f, 0x70, 0x72, 0x65, 0x64, 0x69, - 0x63, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x42, 0x2e, 0x78, 0x64, 0x73, - 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, - 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, - 0x4c, 0x69, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x53, - 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x48, 0x00, - 0x52, 0x0f, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, - 0x65, 0x12, 0x61, 0x0a, 0x0a, 0x6f, 0x72, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x61, 0x74, 0x63, - 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x2e, - 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, - 0x61, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x00, 0x52, 0x09, 0x6f, 0x72, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x12, 0x63, 0x0a, 0x0b, 0x61, 0x6e, 0x64, 0x5f, 0x6d, 0x61, 0x74, 0x63, - 0x68, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x78, 0x64, 0x73, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, - 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x4c, - 0x69, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x50, 0x72, - 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x00, 0x52, 0x0a, 0x61, - 0x6e, 0x64, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x55, 0x0a, 0x0b, 0x6e, 0x6f, 0x74, - 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, - 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, - 0x74, 0x65, 0x48, 0x00, 0x52, 0x0a, 0x6e, 0x6f, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, - 0x1a, 0xf3, 0x01, 0x0a, 0x0f, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x50, 0x72, 0x65, 0x64, 0x69, - 0x63, 0x61, 0x74, 0x65, 0x12, 0x41, 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, - 0x33, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, - 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x45, 0x0a, 0x0b, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x78, - 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, - 0x76, 0x33, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, - 0x48, 0x00, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x46, - 0x0a, 0x0c, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, - 0x76, 0x33, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x00, 0x52, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f, - 0x6d, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x42, 0x0e, 0x0a, 0x07, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, 0x6b, 0x0a, 0x0d, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, - 0x61, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x5a, 0x0a, 0x09, 0x70, 0x72, 0x65, 0x64, 0x69, - 0x63, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x78, 0x64, 0x73, - 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, - 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, - 0x4c, 0x69, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x08, - 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x02, 0x52, 0x09, 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, - 0x61, 0x74, 0x65, 0x42, 0x11, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x74, 0x79, 0x70, - 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, 0xb5, 0x01, 0x0a, 0x0c, 0x46, 0x69, 0x65, 0x6c, 0x64, - 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x5a, 0x0a, 0x09, 0x70, 0x72, 0x65, 0x64, 0x69, - 0x63, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x78, 0x64, 0x73, - 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, - 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, - 0x4c, 0x69, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x08, - 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x09, 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, - 0x61, 0x74, 0x65, 0x12, 0x49, 0x0a, 0x08, 0x6f, 0x6e, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x61, 0x74, 0x63, - 0x68, 0x65, 0x72, 0x2e, 0x4f, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x42, 0x08, 0xfa, 0x42, 0x05, - 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x07, 0x6f, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x1a, 0xa9, - 0x04, 0x0a, 0x0b, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x54, 0x72, 0x65, 0x65, 0x12, 0x41, - 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, - 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x54, 0x79, 0x70, 0x65, - 0x64, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, - 0x74, 0x12, 0x5b, 0x0a, 0x0f, 0x65, 0x78, 0x61, 0x63, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x78, 0x64, 0x73, - 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, - 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, - 0x54, 0x72, 0x65, 0x65, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4d, 0x61, 0x70, 0x48, 0x00, 0x52, - 0x0d, 0x65, 0x78, 0x61, 0x63, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4d, 0x61, 0x70, 0x12, 0x5d, - 0x0a, 0x10, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x6d, - 0x61, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, - 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x54, 0x72, - 0x65, 0x65, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4d, 0x61, 0x70, 0x48, 0x00, 0x52, 0x0e, 0x70, - 0x72, 0x65, 0x66, 0x69, 0x78, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4d, 0x61, 0x70, 0x12, 0x46, 0x0a, - 0x0c, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, - 0x33, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x00, 0x52, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, - 0x4d, 0x61, 0x74, 0x63, 0x68, 0x1a, 0xc0, 0x01, 0x0a, 0x08, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4d, - 0x61, 0x70, 0x12, 0x56, 0x0a, 0x03, 0x6d, 0x61, 0x70, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x3a, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x54, 0x72, 0x65, 0x65, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4d, - 0x61, 0x70, 0x2e, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x08, 0xfa, 0x42, 0x05, - 0x9a, 0x01, 0x02, 0x08, 0x01, 0x52, 0x03, 0x6d, 0x61, 0x70, 0x1a, 0x5c, 0x0a, 0x08, 0x4d, 0x61, - 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x3a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4f, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x10, 0x0a, 0x09, 0x74, 0x72, 0x65, 0x65, - 0x5f, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x3a, 0x08, 0xd2, 0xc6, 0xa4, 0xe1, - 0x06, 0x02, 0x08, 0x01, 0x42, 0x0e, 0x0a, 0x0c, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x5f, - 0x74, 0x79, 0x70, 0x65, 0x42, 0x5c, 0x0a, 0x1e, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, - 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x42, 0x0c, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x63, 0x6e, 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x78, - 0x64, 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, - 0x76, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_xds_type_matcher_v3_matcher_proto_rawDescOnce sync.Once - file_xds_type_matcher_v3_matcher_proto_rawDescData = file_xds_type_matcher_v3_matcher_proto_rawDesc -) - -func file_xds_type_matcher_v3_matcher_proto_rawDescGZIP() []byte { - file_xds_type_matcher_v3_matcher_proto_rawDescOnce.Do(func() { - file_xds_type_matcher_v3_matcher_proto_rawDescData = protoimpl.X.CompressGZIP(file_xds_type_matcher_v3_matcher_proto_rawDescData) - }) - return file_xds_type_matcher_v3_matcher_proto_rawDescData -} - -var file_xds_type_matcher_v3_matcher_proto_msgTypes = make([]protoimpl.MessageInfo, 10) -var file_xds_type_matcher_v3_matcher_proto_goTypes = []interface{}{ - (*Matcher)(nil), // 0: xds.type.matcher.v3.Matcher - (*Matcher_OnMatch)(nil), // 1: xds.type.matcher.v3.Matcher.OnMatch - (*Matcher_MatcherList)(nil), // 2: xds.type.matcher.v3.Matcher.MatcherList - (*Matcher_MatcherTree)(nil), // 3: xds.type.matcher.v3.Matcher.MatcherTree - (*Matcher_MatcherList_Predicate)(nil), // 4: xds.type.matcher.v3.Matcher.MatcherList.Predicate - (*Matcher_MatcherList_FieldMatcher)(nil), // 5: xds.type.matcher.v3.Matcher.MatcherList.FieldMatcher - (*Matcher_MatcherList_Predicate_SinglePredicate)(nil), // 6: xds.type.matcher.v3.Matcher.MatcherList.Predicate.SinglePredicate - (*Matcher_MatcherList_Predicate_PredicateList)(nil), // 7: xds.type.matcher.v3.Matcher.MatcherList.Predicate.PredicateList - (*Matcher_MatcherTree_MatchMap)(nil), // 8: xds.type.matcher.v3.Matcher.MatcherTree.MatchMap - nil, // 9: xds.type.matcher.v3.Matcher.MatcherTree.MatchMap.MapEntry - (*v3.TypedExtensionConfig)(nil), // 10: xds.core.v3.TypedExtensionConfig - (*StringMatcher)(nil), // 11: xds.type.matcher.v3.StringMatcher -} -var file_xds_type_matcher_v3_matcher_proto_depIdxs = []int32{ - 2, // 0: xds.type.matcher.v3.Matcher.matcher_list:type_name -> xds.type.matcher.v3.Matcher.MatcherList - 3, // 1: xds.type.matcher.v3.Matcher.matcher_tree:type_name -> xds.type.matcher.v3.Matcher.MatcherTree - 1, // 2: xds.type.matcher.v3.Matcher.on_no_match:type_name -> xds.type.matcher.v3.Matcher.OnMatch - 0, // 3: xds.type.matcher.v3.Matcher.OnMatch.matcher:type_name -> xds.type.matcher.v3.Matcher - 10, // 4: xds.type.matcher.v3.Matcher.OnMatch.action:type_name -> xds.core.v3.TypedExtensionConfig - 5, // 5: xds.type.matcher.v3.Matcher.MatcherList.matchers:type_name -> xds.type.matcher.v3.Matcher.MatcherList.FieldMatcher - 10, // 6: xds.type.matcher.v3.Matcher.MatcherTree.input:type_name -> xds.core.v3.TypedExtensionConfig - 8, // 7: xds.type.matcher.v3.Matcher.MatcherTree.exact_match_map:type_name -> xds.type.matcher.v3.Matcher.MatcherTree.MatchMap - 8, // 8: xds.type.matcher.v3.Matcher.MatcherTree.prefix_match_map:type_name -> xds.type.matcher.v3.Matcher.MatcherTree.MatchMap - 10, // 9: xds.type.matcher.v3.Matcher.MatcherTree.custom_match:type_name -> xds.core.v3.TypedExtensionConfig - 6, // 10: xds.type.matcher.v3.Matcher.MatcherList.Predicate.single_predicate:type_name -> xds.type.matcher.v3.Matcher.MatcherList.Predicate.SinglePredicate - 7, // 11: xds.type.matcher.v3.Matcher.MatcherList.Predicate.or_matcher:type_name -> xds.type.matcher.v3.Matcher.MatcherList.Predicate.PredicateList - 7, // 12: xds.type.matcher.v3.Matcher.MatcherList.Predicate.and_matcher:type_name -> xds.type.matcher.v3.Matcher.MatcherList.Predicate.PredicateList - 4, // 13: xds.type.matcher.v3.Matcher.MatcherList.Predicate.not_matcher:type_name -> xds.type.matcher.v3.Matcher.MatcherList.Predicate - 4, // 14: xds.type.matcher.v3.Matcher.MatcherList.FieldMatcher.predicate:type_name -> xds.type.matcher.v3.Matcher.MatcherList.Predicate - 1, // 15: xds.type.matcher.v3.Matcher.MatcherList.FieldMatcher.on_match:type_name -> xds.type.matcher.v3.Matcher.OnMatch - 10, // 16: xds.type.matcher.v3.Matcher.MatcherList.Predicate.SinglePredicate.input:type_name -> xds.core.v3.TypedExtensionConfig - 11, // 17: xds.type.matcher.v3.Matcher.MatcherList.Predicate.SinglePredicate.value_match:type_name -> xds.type.matcher.v3.StringMatcher - 10, // 18: xds.type.matcher.v3.Matcher.MatcherList.Predicate.SinglePredicate.custom_match:type_name -> xds.core.v3.TypedExtensionConfig - 4, // 19: xds.type.matcher.v3.Matcher.MatcherList.Predicate.PredicateList.predicate:type_name -> xds.type.matcher.v3.Matcher.MatcherList.Predicate - 9, // 20: xds.type.matcher.v3.Matcher.MatcherTree.MatchMap.map:type_name -> xds.type.matcher.v3.Matcher.MatcherTree.MatchMap.MapEntry - 1, // 21: xds.type.matcher.v3.Matcher.MatcherTree.MatchMap.MapEntry.value:type_name -> xds.type.matcher.v3.Matcher.OnMatch - 22, // [22:22] is the sub-list for method output_type - 22, // [22:22] is the sub-list for method input_type - 22, // [22:22] is the sub-list for extension type_name - 22, // [22:22] is the sub-list for extension extendee - 0, // [0:22] is the sub-list for field type_name -} - -func init() { file_xds_type_matcher_v3_matcher_proto_init() } -func file_xds_type_matcher_v3_matcher_proto_init() { - if File_xds_type_matcher_v3_matcher_proto != nil { - return - } - file_xds_type_matcher_v3_string_proto_init() - if !protoimpl.UnsafeEnabled { - file_xds_type_matcher_v3_matcher_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Matcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_type_matcher_v3_matcher_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Matcher_OnMatch); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_type_matcher_v3_matcher_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Matcher_MatcherList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_type_matcher_v3_matcher_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Matcher_MatcherTree); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_type_matcher_v3_matcher_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Matcher_MatcherList_Predicate); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_type_matcher_v3_matcher_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Matcher_MatcherList_FieldMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_type_matcher_v3_matcher_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Matcher_MatcherList_Predicate_SinglePredicate); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_type_matcher_v3_matcher_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Matcher_MatcherList_Predicate_PredicateList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_type_matcher_v3_matcher_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Matcher_MatcherTree_MatchMap); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_xds_type_matcher_v3_matcher_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*Matcher_MatcherList_)(nil), - (*Matcher_MatcherTree_)(nil), - } - file_xds_type_matcher_v3_matcher_proto_msgTypes[1].OneofWrappers = []interface{}{ - (*Matcher_OnMatch_Matcher)(nil), - (*Matcher_OnMatch_Action)(nil), - } - file_xds_type_matcher_v3_matcher_proto_msgTypes[3].OneofWrappers = []interface{}{ - (*Matcher_MatcherTree_ExactMatchMap)(nil), - (*Matcher_MatcherTree_PrefixMatchMap)(nil), - (*Matcher_MatcherTree_CustomMatch)(nil), - } - file_xds_type_matcher_v3_matcher_proto_msgTypes[4].OneofWrappers = []interface{}{ - (*Matcher_MatcherList_Predicate_SinglePredicate_)(nil), - (*Matcher_MatcherList_Predicate_OrMatcher)(nil), - (*Matcher_MatcherList_Predicate_AndMatcher)(nil), - (*Matcher_MatcherList_Predicate_NotMatcher)(nil), - } - file_xds_type_matcher_v3_matcher_proto_msgTypes[6].OneofWrappers = []interface{}{ - (*Matcher_MatcherList_Predicate_SinglePredicate_ValueMatch)(nil), - (*Matcher_MatcherList_Predicate_SinglePredicate_CustomMatch)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_xds_type_matcher_v3_matcher_proto_rawDesc, - NumEnums: 0, - NumMessages: 10, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_xds_type_matcher_v3_matcher_proto_goTypes, - DependencyIndexes: file_xds_type_matcher_v3_matcher_proto_depIdxs, - MessageInfos: file_xds_type_matcher_v3_matcher_proto_msgTypes, - }.Build() - File_xds_type_matcher_v3_matcher_proto = out.File - file_xds_type_matcher_v3_matcher_proto_rawDesc = nil - file_xds_type_matcher_v3_matcher_proto_goTypes = nil - file_xds_type_matcher_v3_matcher_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/matcher.pb.validate.go b/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/matcher.pb.validate.go deleted file mode 100644 index 60b721f5f..000000000 --- a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/matcher.pb.validate.go +++ /dev/null @@ -1,1913 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: xds/type/matcher/v3/matcher.proto - -package v3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on Matcher with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Matcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Matcher with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in MatcherMultiError, or nil if none found. -func (m *Matcher) ValidateAll() error { - return m.validate(true) -} - -func (m *Matcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetOnNoMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, MatcherValidationError{ - field: "OnNoMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, MatcherValidationError{ - field: "OnNoMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetOnNoMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return MatcherValidationError{ - field: "OnNoMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - switch v := m.MatcherType.(type) { - case *Matcher_MatcherList_: - if v == nil { - err := MatcherValidationError{ - field: "MatcherType", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetMatcherList()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, MatcherValidationError{ - field: "MatcherList", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, MatcherValidationError{ - field: "MatcherList", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMatcherList()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return MatcherValidationError{ - field: "MatcherList", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Matcher_MatcherTree_: - if v == nil { - err := MatcherValidationError{ - field: "MatcherType", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetMatcherTree()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, MatcherValidationError{ - field: "MatcherTree", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, MatcherValidationError{ - field: "MatcherTree", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMatcherTree()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return MatcherValidationError{ - field: "MatcherTree", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return MatcherMultiError(errors) - } - - return nil -} - -// MatcherMultiError is an error wrapping multiple validation errors returned -// by Matcher.ValidateAll() if the designated constraints aren't met. -type MatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m MatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m MatcherMultiError) AllErrors() []error { return m } - -// MatcherValidationError is the validation error returned by Matcher.Validate -// if the designated constraints aren't met. -type MatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e MatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e MatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e MatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e MatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e MatcherValidationError) ErrorName() string { return "MatcherValidationError" } - -// Error satisfies the builtin error interface -func (e MatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = MatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = MatcherValidationError{} - -// Validate checks the field values on Matcher_OnMatch with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *Matcher_OnMatch) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Matcher_OnMatch with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// Matcher_OnMatchMultiError, or nil if none found. -func (m *Matcher_OnMatch) ValidateAll() error { - return m.validate(true) -} - -func (m *Matcher_OnMatch) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofOnMatchPresent := false - switch v := m.OnMatch.(type) { - case *Matcher_OnMatch_Matcher: - if v == nil { - err := Matcher_OnMatchValidationError{ - field: "OnMatch", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofOnMatchPresent = true - - if all { - switch v := interface{}(m.GetMatcher()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Matcher_OnMatchValidationError{ - field: "Matcher", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Matcher_OnMatchValidationError{ - field: "Matcher", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMatcher()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Matcher_OnMatchValidationError{ - field: "Matcher", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Matcher_OnMatch_Action: - if v == nil { - err := Matcher_OnMatchValidationError{ - field: "OnMatch", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofOnMatchPresent = true - - if all { - switch v := interface{}(m.GetAction()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Matcher_OnMatchValidationError{ - field: "Action", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Matcher_OnMatchValidationError{ - field: "Action", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetAction()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Matcher_OnMatchValidationError{ - field: "Action", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofOnMatchPresent { - err := Matcher_OnMatchValidationError{ - field: "OnMatch", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return Matcher_OnMatchMultiError(errors) - } - - return nil -} - -// Matcher_OnMatchMultiError is an error wrapping multiple validation errors -// returned by Matcher_OnMatch.ValidateAll() if the designated constraints -// aren't met. -type Matcher_OnMatchMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m Matcher_OnMatchMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m Matcher_OnMatchMultiError) AllErrors() []error { return m } - -// Matcher_OnMatchValidationError is the validation error returned by -// Matcher_OnMatch.Validate if the designated constraints aren't met. -type Matcher_OnMatchValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e Matcher_OnMatchValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e Matcher_OnMatchValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e Matcher_OnMatchValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e Matcher_OnMatchValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e Matcher_OnMatchValidationError) ErrorName() string { return "Matcher_OnMatchValidationError" } - -// Error satisfies the builtin error interface -func (e Matcher_OnMatchValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMatcher_OnMatch.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = Matcher_OnMatchValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = Matcher_OnMatchValidationError{} - -// Validate checks the field values on Matcher_MatcherList with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *Matcher_MatcherList) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Matcher_MatcherList with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// Matcher_MatcherListMultiError, or nil if none found. -func (m *Matcher_MatcherList) ValidateAll() error { - return m.validate(true) -} - -func (m *Matcher_MatcherList) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(m.GetMatchers()) < 1 { - err := Matcher_MatcherListValidationError{ - field: "Matchers", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetMatchers() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Matcher_MatcherListValidationError{ - field: fmt.Sprintf("Matchers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Matcher_MatcherListValidationError{ - field: fmt.Sprintf("Matchers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Matcher_MatcherListValidationError{ - field: fmt.Sprintf("Matchers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return Matcher_MatcherListMultiError(errors) - } - - return nil -} - -// Matcher_MatcherListMultiError is an error wrapping multiple validation -// errors returned by Matcher_MatcherList.ValidateAll() if the designated -// constraints aren't met. -type Matcher_MatcherListMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m Matcher_MatcherListMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m Matcher_MatcherListMultiError) AllErrors() []error { return m } - -// Matcher_MatcherListValidationError is the validation error returned by -// Matcher_MatcherList.Validate if the designated constraints aren't met. -type Matcher_MatcherListValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e Matcher_MatcherListValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e Matcher_MatcherListValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e Matcher_MatcherListValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e Matcher_MatcherListValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e Matcher_MatcherListValidationError) ErrorName() string { - return "Matcher_MatcherListValidationError" -} - -// Error satisfies the builtin error interface -func (e Matcher_MatcherListValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMatcher_MatcherList.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = Matcher_MatcherListValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = Matcher_MatcherListValidationError{} - -// Validate checks the field values on Matcher_MatcherTree with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *Matcher_MatcherTree) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Matcher_MatcherTree with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// Matcher_MatcherTreeMultiError, or nil if none found. -func (m *Matcher_MatcherTree) ValidateAll() error { - return m.validate(true) -} - -func (m *Matcher_MatcherTree) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetInput() == nil { - err := Matcher_MatcherTreeValidationError{ - field: "Input", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetInput()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Matcher_MatcherTreeValidationError{ - field: "Input", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Matcher_MatcherTreeValidationError{ - field: "Input", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetInput()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Matcher_MatcherTreeValidationError{ - field: "Input", - reason: "embedded message failed validation", - cause: err, - } - } - } - - oneofTreeTypePresent := false - switch v := m.TreeType.(type) { - case *Matcher_MatcherTree_ExactMatchMap: - if v == nil { - err := Matcher_MatcherTreeValidationError{ - field: "TreeType", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofTreeTypePresent = true - - if all { - switch v := interface{}(m.GetExactMatchMap()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Matcher_MatcherTreeValidationError{ - field: "ExactMatchMap", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Matcher_MatcherTreeValidationError{ - field: "ExactMatchMap", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetExactMatchMap()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Matcher_MatcherTreeValidationError{ - field: "ExactMatchMap", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Matcher_MatcherTree_PrefixMatchMap: - if v == nil { - err := Matcher_MatcherTreeValidationError{ - field: "TreeType", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofTreeTypePresent = true - - if all { - switch v := interface{}(m.GetPrefixMatchMap()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Matcher_MatcherTreeValidationError{ - field: "PrefixMatchMap", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Matcher_MatcherTreeValidationError{ - field: "PrefixMatchMap", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPrefixMatchMap()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Matcher_MatcherTreeValidationError{ - field: "PrefixMatchMap", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Matcher_MatcherTree_CustomMatch: - if v == nil { - err := Matcher_MatcherTreeValidationError{ - field: "TreeType", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofTreeTypePresent = true - - if all { - switch v := interface{}(m.GetCustomMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Matcher_MatcherTreeValidationError{ - field: "CustomMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Matcher_MatcherTreeValidationError{ - field: "CustomMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCustomMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Matcher_MatcherTreeValidationError{ - field: "CustomMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofTreeTypePresent { - err := Matcher_MatcherTreeValidationError{ - field: "TreeType", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return Matcher_MatcherTreeMultiError(errors) - } - - return nil -} - -// Matcher_MatcherTreeMultiError is an error wrapping multiple validation -// errors returned by Matcher_MatcherTree.ValidateAll() if the designated -// constraints aren't met. -type Matcher_MatcherTreeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m Matcher_MatcherTreeMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m Matcher_MatcherTreeMultiError) AllErrors() []error { return m } - -// Matcher_MatcherTreeValidationError is the validation error returned by -// Matcher_MatcherTree.Validate if the designated constraints aren't met. -type Matcher_MatcherTreeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e Matcher_MatcherTreeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e Matcher_MatcherTreeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e Matcher_MatcherTreeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e Matcher_MatcherTreeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e Matcher_MatcherTreeValidationError) ErrorName() string { - return "Matcher_MatcherTreeValidationError" -} - -// Error satisfies the builtin error interface -func (e Matcher_MatcherTreeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMatcher_MatcherTree.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = Matcher_MatcherTreeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = Matcher_MatcherTreeValidationError{} - -// Validate checks the field values on Matcher_MatcherList_Predicate with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *Matcher_MatcherList_Predicate) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Matcher_MatcherList_Predicate with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// Matcher_MatcherList_PredicateMultiError, or nil if none found. -func (m *Matcher_MatcherList_Predicate) ValidateAll() error { - return m.validate(true) -} - -func (m *Matcher_MatcherList_Predicate) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofMatchTypePresent := false - switch v := m.MatchType.(type) { - case *Matcher_MatcherList_Predicate_SinglePredicate_: - if v == nil { - err := Matcher_MatcherList_PredicateValidationError{ - field: "MatchType", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchTypePresent = true - - if all { - switch v := interface{}(m.GetSinglePredicate()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Matcher_MatcherList_PredicateValidationError{ - field: "SinglePredicate", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Matcher_MatcherList_PredicateValidationError{ - field: "SinglePredicate", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSinglePredicate()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Matcher_MatcherList_PredicateValidationError{ - field: "SinglePredicate", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Matcher_MatcherList_Predicate_OrMatcher: - if v == nil { - err := Matcher_MatcherList_PredicateValidationError{ - field: "MatchType", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchTypePresent = true - - if all { - switch v := interface{}(m.GetOrMatcher()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Matcher_MatcherList_PredicateValidationError{ - field: "OrMatcher", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Matcher_MatcherList_PredicateValidationError{ - field: "OrMatcher", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetOrMatcher()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Matcher_MatcherList_PredicateValidationError{ - field: "OrMatcher", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Matcher_MatcherList_Predicate_AndMatcher: - if v == nil { - err := Matcher_MatcherList_PredicateValidationError{ - field: "MatchType", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchTypePresent = true - - if all { - switch v := interface{}(m.GetAndMatcher()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Matcher_MatcherList_PredicateValidationError{ - field: "AndMatcher", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Matcher_MatcherList_PredicateValidationError{ - field: "AndMatcher", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetAndMatcher()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Matcher_MatcherList_PredicateValidationError{ - field: "AndMatcher", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Matcher_MatcherList_Predicate_NotMatcher: - if v == nil { - err := Matcher_MatcherList_PredicateValidationError{ - field: "MatchType", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchTypePresent = true - - if all { - switch v := interface{}(m.GetNotMatcher()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Matcher_MatcherList_PredicateValidationError{ - field: "NotMatcher", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Matcher_MatcherList_PredicateValidationError{ - field: "NotMatcher", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetNotMatcher()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Matcher_MatcherList_PredicateValidationError{ - field: "NotMatcher", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofMatchTypePresent { - err := Matcher_MatcherList_PredicateValidationError{ - field: "MatchType", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return Matcher_MatcherList_PredicateMultiError(errors) - } - - return nil -} - -// Matcher_MatcherList_PredicateMultiError is an error wrapping multiple -// validation errors returned by Matcher_MatcherList_Predicate.ValidateAll() -// if the designated constraints aren't met. -type Matcher_MatcherList_PredicateMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m Matcher_MatcherList_PredicateMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m Matcher_MatcherList_PredicateMultiError) AllErrors() []error { return m } - -// Matcher_MatcherList_PredicateValidationError is the validation error -// returned by Matcher_MatcherList_Predicate.Validate if the designated -// constraints aren't met. -type Matcher_MatcherList_PredicateValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e Matcher_MatcherList_PredicateValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e Matcher_MatcherList_PredicateValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e Matcher_MatcherList_PredicateValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e Matcher_MatcherList_PredicateValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e Matcher_MatcherList_PredicateValidationError) ErrorName() string { - return "Matcher_MatcherList_PredicateValidationError" -} - -// Error satisfies the builtin error interface -func (e Matcher_MatcherList_PredicateValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMatcher_MatcherList_Predicate.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = Matcher_MatcherList_PredicateValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = Matcher_MatcherList_PredicateValidationError{} - -// Validate checks the field values on Matcher_MatcherList_FieldMatcher with -// the rules defined in the proto definition for this message. If any rules -// are violated, the first error encountered is returned, or nil if there are -// no violations. -func (m *Matcher_MatcherList_FieldMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Matcher_MatcherList_FieldMatcher with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// Matcher_MatcherList_FieldMatcherMultiError, or nil if none found. -func (m *Matcher_MatcherList_FieldMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *Matcher_MatcherList_FieldMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetPredicate() == nil { - err := Matcher_MatcherList_FieldMatcherValidationError{ - field: "Predicate", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetPredicate()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Matcher_MatcherList_FieldMatcherValidationError{ - field: "Predicate", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Matcher_MatcherList_FieldMatcherValidationError{ - field: "Predicate", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPredicate()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Matcher_MatcherList_FieldMatcherValidationError{ - field: "Predicate", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if m.GetOnMatch() == nil { - err := Matcher_MatcherList_FieldMatcherValidationError{ - field: "OnMatch", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetOnMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Matcher_MatcherList_FieldMatcherValidationError{ - field: "OnMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Matcher_MatcherList_FieldMatcherValidationError{ - field: "OnMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetOnMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Matcher_MatcherList_FieldMatcherValidationError{ - field: "OnMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return Matcher_MatcherList_FieldMatcherMultiError(errors) - } - - return nil -} - -// Matcher_MatcherList_FieldMatcherMultiError is an error wrapping multiple -// validation errors returned by -// Matcher_MatcherList_FieldMatcher.ValidateAll() if the designated -// constraints aren't met. -type Matcher_MatcherList_FieldMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m Matcher_MatcherList_FieldMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m Matcher_MatcherList_FieldMatcherMultiError) AllErrors() []error { return m } - -// Matcher_MatcherList_FieldMatcherValidationError is the validation error -// returned by Matcher_MatcherList_FieldMatcher.Validate if the designated -// constraints aren't met. -type Matcher_MatcherList_FieldMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e Matcher_MatcherList_FieldMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e Matcher_MatcherList_FieldMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e Matcher_MatcherList_FieldMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e Matcher_MatcherList_FieldMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e Matcher_MatcherList_FieldMatcherValidationError) ErrorName() string { - return "Matcher_MatcherList_FieldMatcherValidationError" -} - -// Error satisfies the builtin error interface -func (e Matcher_MatcherList_FieldMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMatcher_MatcherList_FieldMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = Matcher_MatcherList_FieldMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = Matcher_MatcherList_FieldMatcherValidationError{} - -// Validate checks the field values on -// Matcher_MatcherList_Predicate_SinglePredicate with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Matcher_MatcherList_Predicate_SinglePredicate) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on -// Matcher_MatcherList_Predicate_SinglePredicate with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in -// Matcher_MatcherList_Predicate_SinglePredicateMultiError, or nil if none found. -func (m *Matcher_MatcherList_Predicate_SinglePredicate) ValidateAll() error { - return m.validate(true) -} - -func (m *Matcher_MatcherList_Predicate_SinglePredicate) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetInput() == nil { - err := Matcher_MatcherList_Predicate_SinglePredicateValidationError{ - field: "Input", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetInput()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{ - field: "Input", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{ - field: "Input", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetInput()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Matcher_MatcherList_Predicate_SinglePredicateValidationError{ - field: "Input", - reason: "embedded message failed validation", - cause: err, - } - } - } - - oneofMatcherPresent := false - switch v := m.Matcher.(type) { - case *Matcher_MatcherList_Predicate_SinglePredicate_ValueMatch: - if v == nil { - err := Matcher_MatcherList_Predicate_SinglePredicateValidationError{ - field: "Matcher", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatcherPresent = true - - if all { - switch v := interface{}(m.GetValueMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{ - field: "ValueMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{ - field: "ValueMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetValueMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Matcher_MatcherList_Predicate_SinglePredicateValidationError{ - field: "ValueMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Matcher_MatcherList_Predicate_SinglePredicate_CustomMatch: - if v == nil { - err := Matcher_MatcherList_Predicate_SinglePredicateValidationError{ - field: "Matcher", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatcherPresent = true - - if all { - switch v := interface{}(m.GetCustomMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{ - field: "CustomMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{ - field: "CustomMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCustomMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Matcher_MatcherList_Predicate_SinglePredicateValidationError{ - field: "CustomMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofMatcherPresent { - err := Matcher_MatcherList_Predicate_SinglePredicateValidationError{ - field: "Matcher", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return Matcher_MatcherList_Predicate_SinglePredicateMultiError(errors) - } - - return nil -} - -// Matcher_MatcherList_Predicate_SinglePredicateMultiError is an error wrapping -// multiple validation errors returned by -// Matcher_MatcherList_Predicate_SinglePredicate.ValidateAll() if the -// designated constraints aren't met. -type Matcher_MatcherList_Predicate_SinglePredicateMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m Matcher_MatcherList_Predicate_SinglePredicateMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m Matcher_MatcherList_Predicate_SinglePredicateMultiError) AllErrors() []error { return m } - -// Matcher_MatcherList_Predicate_SinglePredicateValidationError is the -// validation error returned by -// Matcher_MatcherList_Predicate_SinglePredicate.Validate if the designated -// constraints aren't met. -type Matcher_MatcherList_Predicate_SinglePredicateValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Reason() string { - return e.reason -} - -// Cause function returns cause value. -func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) ErrorName() string { - return "Matcher_MatcherList_Predicate_SinglePredicateValidationError" -} - -// Error satisfies the builtin error interface -func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMatcher_MatcherList_Predicate_SinglePredicate.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = Matcher_MatcherList_Predicate_SinglePredicateValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = Matcher_MatcherList_Predicate_SinglePredicateValidationError{} - -// Validate checks the field values on -// Matcher_MatcherList_Predicate_PredicateList with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Matcher_MatcherList_Predicate_PredicateList) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on -// Matcher_MatcherList_Predicate_PredicateList with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in -// Matcher_MatcherList_Predicate_PredicateListMultiError, or nil if none found. -func (m *Matcher_MatcherList_Predicate_PredicateList) ValidateAll() error { - return m.validate(true) -} - -func (m *Matcher_MatcherList_Predicate_PredicateList) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(m.GetPredicate()) < 2 { - err := Matcher_MatcherList_Predicate_PredicateListValidationError{ - field: "Predicate", - reason: "value must contain at least 2 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetPredicate() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Matcher_MatcherList_Predicate_PredicateListValidationError{ - field: fmt.Sprintf("Predicate[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Matcher_MatcherList_Predicate_PredicateListValidationError{ - field: fmt.Sprintf("Predicate[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Matcher_MatcherList_Predicate_PredicateListValidationError{ - field: fmt.Sprintf("Predicate[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return Matcher_MatcherList_Predicate_PredicateListMultiError(errors) - } - - return nil -} - -// Matcher_MatcherList_Predicate_PredicateListMultiError is an error wrapping -// multiple validation errors returned by -// Matcher_MatcherList_Predicate_PredicateList.ValidateAll() if the designated -// constraints aren't met. -type Matcher_MatcherList_Predicate_PredicateListMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m Matcher_MatcherList_Predicate_PredicateListMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m Matcher_MatcherList_Predicate_PredicateListMultiError) AllErrors() []error { return m } - -// Matcher_MatcherList_Predicate_PredicateListValidationError is the validation -// error returned by Matcher_MatcherList_Predicate_PredicateList.Validate if -// the designated constraints aren't met. -type Matcher_MatcherList_Predicate_PredicateListValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e Matcher_MatcherList_Predicate_PredicateListValidationError) ErrorName() string { - return "Matcher_MatcherList_Predicate_PredicateListValidationError" -} - -// Error satisfies the builtin error interface -func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMatcher_MatcherList_Predicate_PredicateList.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = Matcher_MatcherList_Predicate_PredicateListValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = Matcher_MatcherList_Predicate_PredicateListValidationError{} - -// Validate checks the field values on Matcher_MatcherTree_MatchMap with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *Matcher_MatcherTree_MatchMap) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Matcher_MatcherTree_MatchMap with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// Matcher_MatcherTree_MatchMapMultiError, or nil if none found. -func (m *Matcher_MatcherTree_MatchMap) ValidateAll() error { - return m.validate(true) -} - -func (m *Matcher_MatcherTree_MatchMap) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(m.GetMap()) < 1 { - err := Matcher_MatcherTree_MatchMapValidationError{ - field: "Map", - reason: "value must contain at least 1 pair(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - { - sorted_keys := make([]string, len(m.GetMap())) - i := 0 - for key := range m.GetMap() { - sorted_keys[i] = key - i++ - } - sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] }) - for _, key := range sorted_keys { - val := m.GetMap()[key] - _ = val - - // no validation rules for Map[key] - - if all { - switch v := interface{}(val).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Matcher_MatcherTree_MatchMapValidationError{ - field: fmt.Sprintf("Map[%v]", key), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Matcher_MatcherTree_MatchMapValidationError{ - field: fmt.Sprintf("Map[%v]", key), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(val).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Matcher_MatcherTree_MatchMapValidationError{ - field: fmt.Sprintf("Map[%v]", key), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - } - - if len(errors) > 0 { - return Matcher_MatcherTree_MatchMapMultiError(errors) - } - - return nil -} - -// Matcher_MatcherTree_MatchMapMultiError is an error wrapping multiple -// validation errors returned by Matcher_MatcherTree_MatchMap.ValidateAll() if -// the designated constraints aren't met. -type Matcher_MatcherTree_MatchMapMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m Matcher_MatcherTree_MatchMapMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m Matcher_MatcherTree_MatchMapMultiError) AllErrors() []error { return m } - -// Matcher_MatcherTree_MatchMapValidationError is the validation error returned -// by Matcher_MatcherTree_MatchMap.Validate if the designated constraints -// aren't met. -type Matcher_MatcherTree_MatchMapValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e Matcher_MatcherTree_MatchMapValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e Matcher_MatcherTree_MatchMapValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e Matcher_MatcherTree_MatchMapValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e Matcher_MatcherTree_MatchMapValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e Matcher_MatcherTree_MatchMapValidationError) ErrorName() string { - return "Matcher_MatcherTree_MatchMapValidationError" -} - -// Error satisfies the builtin error interface -func (e Matcher_MatcherTree_MatchMapValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMatcher_MatcherTree_MatchMap.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = Matcher_MatcherTree_MatchMapValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = Matcher_MatcherTree_MatchMapValidationError{} diff --git a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/range.pb.go b/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/range.pb.go deleted file mode 100644 index d7bc620b9..000000000 --- a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/range.pb.go +++ /dev/null @@ -1,539 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: xds/type/matcher/v3/range.proto - -package v3 - -import ( - v3 "github.com/cncf/xds/go/xds/type/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type Int64RangeMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RangeMatchers []*Int64RangeMatcher_RangeMatcher `protobuf:"bytes,1,rep,name=range_matchers,json=rangeMatchers,proto3" json:"range_matchers,omitempty"` -} - -func (x *Int64RangeMatcher) Reset() { - *x = Int64RangeMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_range_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Int64RangeMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Int64RangeMatcher) ProtoMessage() {} - -func (x *Int64RangeMatcher) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_range_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Int64RangeMatcher.ProtoReflect.Descriptor instead. -func (*Int64RangeMatcher) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_range_proto_rawDescGZIP(), []int{0} -} - -func (x *Int64RangeMatcher) GetRangeMatchers() []*Int64RangeMatcher_RangeMatcher { - if x != nil { - return x.RangeMatchers - } - return nil -} - -type Int32RangeMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RangeMatchers []*Int32RangeMatcher_RangeMatcher `protobuf:"bytes,1,rep,name=range_matchers,json=rangeMatchers,proto3" json:"range_matchers,omitempty"` -} - -func (x *Int32RangeMatcher) Reset() { - *x = Int32RangeMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_range_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Int32RangeMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Int32RangeMatcher) ProtoMessage() {} - -func (x *Int32RangeMatcher) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_range_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Int32RangeMatcher.ProtoReflect.Descriptor instead. -func (*Int32RangeMatcher) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_range_proto_rawDescGZIP(), []int{1} -} - -func (x *Int32RangeMatcher) GetRangeMatchers() []*Int32RangeMatcher_RangeMatcher { - if x != nil { - return x.RangeMatchers - } - return nil -} - -type DoubleRangeMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RangeMatchers []*DoubleRangeMatcher_RangeMatcher `protobuf:"bytes,1,rep,name=range_matchers,json=rangeMatchers,proto3" json:"range_matchers,omitempty"` -} - -func (x *DoubleRangeMatcher) Reset() { - *x = DoubleRangeMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_range_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DoubleRangeMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DoubleRangeMatcher) ProtoMessage() {} - -func (x *DoubleRangeMatcher) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_range_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DoubleRangeMatcher.ProtoReflect.Descriptor instead. -func (*DoubleRangeMatcher) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_range_proto_rawDescGZIP(), []int{2} -} - -func (x *DoubleRangeMatcher) GetRangeMatchers() []*DoubleRangeMatcher_RangeMatcher { - if x != nil { - return x.RangeMatchers - } - return nil -} - -type Int64RangeMatcher_RangeMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Ranges []*v3.Int64Range `protobuf:"bytes,1,rep,name=ranges,proto3" json:"ranges,omitempty"` - OnMatch *Matcher_OnMatch `protobuf:"bytes,2,opt,name=on_match,json=onMatch,proto3" json:"on_match,omitempty"` -} - -func (x *Int64RangeMatcher_RangeMatcher) Reset() { - *x = Int64RangeMatcher_RangeMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_range_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Int64RangeMatcher_RangeMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Int64RangeMatcher_RangeMatcher) ProtoMessage() {} - -func (x *Int64RangeMatcher_RangeMatcher) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_range_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Int64RangeMatcher_RangeMatcher.ProtoReflect.Descriptor instead. -func (*Int64RangeMatcher_RangeMatcher) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_range_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *Int64RangeMatcher_RangeMatcher) GetRanges() []*v3.Int64Range { - if x != nil { - return x.Ranges - } - return nil -} - -func (x *Int64RangeMatcher_RangeMatcher) GetOnMatch() *Matcher_OnMatch { - if x != nil { - return x.OnMatch - } - return nil -} - -type Int32RangeMatcher_RangeMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Ranges []*v3.Int32Range `protobuf:"bytes,1,rep,name=ranges,proto3" json:"ranges,omitempty"` - OnMatch *Matcher_OnMatch `protobuf:"bytes,2,opt,name=on_match,json=onMatch,proto3" json:"on_match,omitempty"` -} - -func (x *Int32RangeMatcher_RangeMatcher) Reset() { - *x = Int32RangeMatcher_RangeMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_range_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Int32RangeMatcher_RangeMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Int32RangeMatcher_RangeMatcher) ProtoMessage() {} - -func (x *Int32RangeMatcher_RangeMatcher) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_range_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Int32RangeMatcher_RangeMatcher.ProtoReflect.Descriptor instead. -func (*Int32RangeMatcher_RangeMatcher) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_range_proto_rawDescGZIP(), []int{1, 0} -} - -func (x *Int32RangeMatcher_RangeMatcher) GetRanges() []*v3.Int32Range { - if x != nil { - return x.Ranges - } - return nil -} - -func (x *Int32RangeMatcher_RangeMatcher) GetOnMatch() *Matcher_OnMatch { - if x != nil { - return x.OnMatch - } - return nil -} - -type DoubleRangeMatcher_RangeMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Ranges []*v3.DoubleRange `protobuf:"bytes,1,rep,name=ranges,proto3" json:"ranges,omitempty"` - OnMatch *Matcher_OnMatch `protobuf:"bytes,2,opt,name=on_match,json=onMatch,proto3" json:"on_match,omitempty"` -} - -func (x *DoubleRangeMatcher_RangeMatcher) Reset() { - *x = DoubleRangeMatcher_RangeMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_range_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DoubleRangeMatcher_RangeMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DoubleRangeMatcher_RangeMatcher) ProtoMessage() {} - -func (x *DoubleRangeMatcher_RangeMatcher) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_range_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DoubleRangeMatcher_RangeMatcher.ProtoReflect.Descriptor instead. -func (*DoubleRangeMatcher_RangeMatcher) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_range_proto_rawDescGZIP(), []int{2, 0} -} - -func (x *DoubleRangeMatcher_RangeMatcher) GetRanges() []*v3.DoubleRange { - if x != nil { - return x.Ranges - } - return nil -} - -func (x *DoubleRangeMatcher_RangeMatcher) GetOnMatch() *Matcher_OnMatch { - if x != nil { - return x.OnMatch - } - return nil -} - -var File_xds_type_matcher_v3_range_proto protoreflect.FileDescriptor - -var file_xds_type_matcher_v3_range_proto_rawDesc = []byte{ - 0x0a, 0x1f, 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x13, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, - 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x1a, 0x17, 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, - 0x2f, 0x76, 0x33, 0x2f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x21, 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfc, 0x01, 0x0a, 0x11, - 0x49, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x12, 0x5a, 0x0a, 0x0e, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x78, 0x64, 0x73, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, - 0x49, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x52, 0x0d, - 0x72, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x73, 0x1a, 0x8a, 0x01, - 0x0a, 0x0c, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x39, - 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, - 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x6e, 0x74, - 0x36, 0x34, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, - 0x01, 0x52, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x08, 0x6f, 0x6e, 0x5f, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x78, 0x64, - 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, - 0x33, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4f, 0x6e, 0x4d, 0x61, 0x74, 0x63, - 0x68, 0x52, 0x07, 0x6f, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x22, 0xfc, 0x01, 0x0a, 0x11, 0x49, - 0x6e, 0x74, 0x33, 0x32, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, - 0x12, 0x5a, 0x0a, 0x0e, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x49, - 0x6e, 0x74, 0x33, 0x32, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, - 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x52, 0x0d, 0x72, - 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x73, 0x1a, 0x8a, 0x01, 0x0a, - 0x0c, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x39, 0x0a, - 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, - 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x6e, 0x74, 0x33, - 0x32, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, - 0x52, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x08, 0x6f, 0x6e, 0x5f, 0x6d, - 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x78, 0x64, 0x73, - 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, - 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4f, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, - 0x52, 0x07, 0x6f, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x22, 0xff, 0x01, 0x0a, 0x12, 0x44, 0x6f, - 0x75, 0x62, 0x6c, 0x65, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, - 0x12, 0x5b, 0x0a, 0x0e, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x44, - 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x52, 0x0d, - 0x72, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x73, 0x1a, 0x8b, 0x01, - 0x0a, 0x0c, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x3a, - 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, - 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x6f, 0x75, - 0x62, 0x6c, 0x65, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, - 0x08, 0x01, 0x52, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x08, 0x6f, 0x6e, - 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x78, - 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, - 0x76, 0x33, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4f, 0x6e, 0x4d, 0x61, 0x74, - 0x63, 0x68, 0x52, 0x07, 0x6f, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x42, 0x5a, 0x0a, 0x1e, 0x63, - 0x6f, 0x6d, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x42, 0x0a, 0x52, - 0x61, 0x6e, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6e, 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, - 0x2f, 0x67, 0x6f, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_xds_type_matcher_v3_range_proto_rawDescOnce sync.Once - file_xds_type_matcher_v3_range_proto_rawDescData = file_xds_type_matcher_v3_range_proto_rawDesc -) - -func file_xds_type_matcher_v3_range_proto_rawDescGZIP() []byte { - file_xds_type_matcher_v3_range_proto_rawDescOnce.Do(func() { - file_xds_type_matcher_v3_range_proto_rawDescData = protoimpl.X.CompressGZIP(file_xds_type_matcher_v3_range_proto_rawDescData) - }) - return file_xds_type_matcher_v3_range_proto_rawDescData -} - -var file_xds_type_matcher_v3_range_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_xds_type_matcher_v3_range_proto_goTypes = []interface{}{ - (*Int64RangeMatcher)(nil), // 0: xds.type.matcher.v3.Int64RangeMatcher - (*Int32RangeMatcher)(nil), // 1: xds.type.matcher.v3.Int32RangeMatcher - (*DoubleRangeMatcher)(nil), // 2: xds.type.matcher.v3.DoubleRangeMatcher - (*Int64RangeMatcher_RangeMatcher)(nil), // 3: xds.type.matcher.v3.Int64RangeMatcher.RangeMatcher - (*Int32RangeMatcher_RangeMatcher)(nil), // 4: xds.type.matcher.v3.Int32RangeMatcher.RangeMatcher - (*DoubleRangeMatcher_RangeMatcher)(nil), // 5: xds.type.matcher.v3.DoubleRangeMatcher.RangeMatcher - (*v3.Int64Range)(nil), // 6: xds.type.v3.Int64Range - (*Matcher_OnMatch)(nil), // 7: xds.type.matcher.v3.Matcher.OnMatch - (*v3.Int32Range)(nil), // 8: xds.type.v3.Int32Range - (*v3.DoubleRange)(nil), // 9: xds.type.v3.DoubleRange -} -var file_xds_type_matcher_v3_range_proto_depIdxs = []int32{ - 3, // 0: xds.type.matcher.v3.Int64RangeMatcher.range_matchers:type_name -> xds.type.matcher.v3.Int64RangeMatcher.RangeMatcher - 4, // 1: xds.type.matcher.v3.Int32RangeMatcher.range_matchers:type_name -> xds.type.matcher.v3.Int32RangeMatcher.RangeMatcher - 5, // 2: xds.type.matcher.v3.DoubleRangeMatcher.range_matchers:type_name -> xds.type.matcher.v3.DoubleRangeMatcher.RangeMatcher - 6, // 3: xds.type.matcher.v3.Int64RangeMatcher.RangeMatcher.ranges:type_name -> xds.type.v3.Int64Range - 7, // 4: xds.type.matcher.v3.Int64RangeMatcher.RangeMatcher.on_match:type_name -> xds.type.matcher.v3.Matcher.OnMatch - 8, // 5: xds.type.matcher.v3.Int32RangeMatcher.RangeMatcher.ranges:type_name -> xds.type.v3.Int32Range - 7, // 6: xds.type.matcher.v3.Int32RangeMatcher.RangeMatcher.on_match:type_name -> xds.type.matcher.v3.Matcher.OnMatch - 9, // 7: xds.type.matcher.v3.DoubleRangeMatcher.RangeMatcher.ranges:type_name -> xds.type.v3.DoubleRange - 7, // 8: xds.type.matcher.v3.DoubleRangeMatcher.RangeMatcher.on_match:type_name -> xds.type.matcher.v3.Matcher.OnMatch - 9, // [9:9] is the sub-list for method output_type - 9, // [9:9] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name -} - -func init() { file_xds_type_matcher_v3_range_proto_init() } -func file_xds_type_matcher_v3_range_proto_init() { - if File_xds_type_matcher_v3_range_proto != nil { - return - } - file_xds_type_matcher_v3_matcher_proto_init() - if !protoimpl.UnsafeEnabled { - file_xds_type_matcher_v3_range_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Int64RangeMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_type_matcher_v3_range_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Int32RangeMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_type_matcher_v3_range_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DoubleRangeMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_type_matcher_v3_range_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Int64RangeMatcher_RangeMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_type_matcher_v3_range_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Int32RangeMatcher_RangeMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_type_matcher_v3_range_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DoubleRangeMatcher_RangeMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_xds_type_matcher_v3_range_proto_rawDesc, - NumEnums: 0, - NumMessages: 6, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_xds_type_matcher_v3_range_proto_goTypes, - DependencyIndexes: file_xds_type_matcher_v3_range_proto_depIdxs, - MessageInfos: file_xds_type_matcher_v3_range_proto_msgTypes, - }.Build() - File_xds_type_matcher_v3_range_proto = out.File - file_xds_type_matcher_v3_range_proto_rawDesc = nil - file_xds_type_matcher_v3_range_proto_goTypes = nil - file_xds_type_matcher_v3_range_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/range.pb.validate.go b/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/range.pb.validate.go deleted file mode 100644 index 8cb598643..000000000 --- a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/range.pb.validate.go +++ /dev/null @@ -1,975 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: xds/type/matcher/v3/range.proto - -package v3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on Int64RangeMatcher with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *Int64RangeMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Int64RangeMatcher with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// Int64RangeMatcherMultiError, or nil if none found. -func (m *Int64RangeMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *Int64RangeMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetRangeMatchers() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Int64RangeMatcherValidationError{ - field: fmt.Sprintf("RangeMatchers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Int64RangeMatcherValidationError{ - field: fmt.Sprintf("RangeMatchers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Int64RangeMatcherValidationError{ - field: fmt.Sprintf("RangeMatchers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return Int64RangeMatcherMultiError(errors) - } - - return nil -} - -// Int64RangeMatcherMultiError is an error wrapping multiple validation errors -// returned by Int64RangeMatcher.ValidateAll() if the designated constraints -// aren't met. -type Int64RangeMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m Int64RangeMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m Int64RangeMatcherMultiError) AllErrors() []error { return m } - -// Int64RangeMatcherValidationError is the validation error returned by -// Int64RangeMatcher.Validate if the designated constraints aren't met. -type Int64RangeMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e Int64RangeMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e Int64RangeMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e Int64RangeMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e Int64RangeMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e Int64RangeMatcherValidationError) ErrorName() string { - return "Int64RangeMatcherValidationError" -} - -// Error satisfies the builtin error interface -func (e Int64RangeMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sInt64RangeMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = Int64RangeMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = Int64RangeMatcherValidationError{} - -// Validate checks the field values on Int32RangeMatcher with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *Int32RangeMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Int32RangeMatcher with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// Int32RangeMatcherMultiError, or nil if none found. -func (m *Int32RangeMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *Int32RangeMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetRangeMatchers() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Int32RangeMatcherValidationError{ - field: fmt.Sprintf("RangeMatchers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Int32RangeMatcherValidationError{ - field: fmt.Sprintf("RangeMatchers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Int32RangeMatcherValidationError{ - field: fmt.Sprintf("RangeMatchers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return Int32RangeMatcherMultiError(errors) - } - - return nil -} - -// Int32RangeMatcherMultiError is an error wrapping multiple validation errors -// returned by Int32RangeMatcher.ValidateAll() if the designated constraints -// aren't met. -type Int32RangeMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m Int32RangeMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m Int32RangeMatcherMultiError) AllErrors() []error { return m } - -// Int32RangeMatcherValidationError is the validation error returned by -// Int32RangeMatcher.Validate if the designated constraints aren't met. -type Int32RangeMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e Int32RangeMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e Int32RangeMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e Int32RangeMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e Int32RangeMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e Int32RangeMatcherValidationError) ErrorName() string { - return "Int32RangeMatcherValidationError" -} - -// Error satisfies the builtin error interface -func (e Int32RangeMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sInt32RangeMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = Int32RangeMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = Int32RangeMatcherValidationError{} - -// Validate checks the field values on DoubleRangeMatcher with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *DoubleRangeMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DoubleRangeMatcher with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// DoubleRangeMatcherMultiError, or nil if none found. -func (m *DoubleRangeMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *DoubleRangeMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetRangeMatchers() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DoubleRangeMatcherValidationError{ - field: fmt.Sprintf("RangeMatchers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DoubleRangeMatcherValidationError{ - field: fmt.Sprintf("RangeMatchers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DoubleRangeMatcherValidationError{ - field: fmt.Sprintf("RangeMatchers[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return DoubleRangeMatcherMultiError(errors) - } - - return nil -} - -// DoubleRangeMatcherMultiError is an error wrapping multiple validation errors -// returned by DoubleRangeMatcher.ValidateAll() if the designated constraints -// aren't met. -type DoubleRangeMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DoubleRangeMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DoubleRangeMatcherMultiError) AllErrors() []error { return m } - -// DoubleRangeMatcherValidationError is the validation error returned by -// DoubleRangeMatcher.Validate if the designated constraints aren't met. -type DoubleRangeMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DoubleRangeMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DoubleRangeMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DoubleRangeMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DoubleRangeMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DoubleRangeMatcherValidationError) ErrorName() string { - return "DoubleRangeMatcherValidationError" -} - -// Error satisfies the builtin error interface -func (e DoubleRangeMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDoubleRangeMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DoubleRangeMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DoubleRangeMatcherValidationError{} - -// Validate checks the field values on Int64RangeMatcher_RangeMatcher with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *Int64RangeMatcher_RangeMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Int64RangeMatcher_RangeMatcher with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// Int64RangeMatcher_RangeMatcherMultiError, or nil if none found. -func (m *Int64RangeMatcher_RangeMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *Int64RangeMatcher_RangeMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(m.GetRanges()) < 1 { - err := Int64RangeMatcher_RangeMatcherValidationError{ - field: "Ranges", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetRanges() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Int64RangeMatcher_RangeMatcherValidationError{ - field: fmt.Sprintf("Ranges[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Int64RangeMatcher_RangeMatcherValidationError{ - field: fmt.Sprintf("Ranges[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Int64RangeMatcher_RangeMatcherValidationError{ - field: fmt.Sprintf("Ranges[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetOnMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Int64RangeMatcher_RangeMatcherValidationError{ - field: "OnMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Int64RangeMatcher_RangeMatcherValidationError{ - field: "OnMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetOnMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Int64RangeMatcher_RangeMatcherValidationError{ - field: "OnMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return Int64RangeMatcher_RangeMatcherMultiError(errors) - } - - return nil -} - -// Int64RangeMatcher_RangeMatcherMultiError is an error wrapping multiple -// validation errors returned by Int64RangeMatcher_RangeMatcher.ValidateAll() -// if the designated constraints aren't met. -type Int64RangeMatcher_RangeMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m Int64RangeMatcher_RangeMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m Int64RangeMatcher_RangeMatcherMultiError) AllErrors() []error { return m } - -// Int64RangeMatcher_RangeMatcherValidationError is the validation error -// returned by Int64RangeMatcher_RangeMatcher.Validate if the designated -// constraints aren't met. -type Int64RangeMatcher_RangeMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e Int64RangeMatcher_RangeMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e Int64RangeMatcher_RangeMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e Int64RangeMatcher_RangeMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e Int64RangeMatcher_RangeMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e Int64RangeMatcher_RangeMatcherValidationError) ErrorName() string { - return "Int64RangeMatcher_RangeMatcherValidationError" -} - -// Error satisfies the builtin error interface -func (e Int64RangeMatcher_RangeMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sInt64RangeMatcher_RangeMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = Int64RangeMatcher_RangeMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = Int64RangeMatcher_RangeMatcherValidationError{} - -// Validate checks the field values on Int32RangeMatcher_RangeMatcher with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *Int32RangeMatcher_RangeMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Int32RangeMatcher_RangeMatcher with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// Int32RangeMatcher_RangeMatcherMultiError, or nil if none found. -func (m *Int32RangeMatcher_RangeMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *Int32RangeMatcher_RangeMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(m.GetRanges()) < 1 { - err := Int32RangeMatcher_RangeMatcherValidationError{ - field: "Ranges", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetRanges() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Int32RangeMatcher_RangeMatcherValidationError{ - field: fmt.Sprintf("Ranges[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Int32RangeMatcher_RangeMatcherValidationError{ - field: fmt.Sprintf("Ranges[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Int32RangeMatcher_RangeMatcherValidationError{ - field: fmt.Sprintf("Ranges[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetOnMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, Int32RangeMatcher_RangeMatcherValidationError{ - field: "OnMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, Int32RangeMatcher_RangeMatcherValidationError{ - field: "OnMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetOnMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return Int32RangeMatcher_RangeMatcherValidationError{ - field: "OnMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return Int32RangeMatcher_RangeMatcherMultiError(errors) - } - - return nil -} - -// Int32RangeMatcher_RangeMatcherMultiError is an error wrapping multiple -// validation errors returned by Int32RangeMatcher_RangeMatcher.ValidateAll() -// if the designated constraints aren't met. -type Int32RangeMatcher_RangeMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m Int32RangeMatcher_RangeMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m Int32RangeMatcher_RangeMatcherMultiError) AllErrors() []error { return m } - -// Int32RangeMatcher_RangeMatcherValidationError is the validation error -// returned by Int32RangeMatcher_RangeMatcher.Validate if the designated -// constraints aren't met. -type Int32RangeMatcher_RangeMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e Int32RangeMatcher_RangeMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e Int32RangeMatcher_RangeMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e Int32RangeMatcher_RangeMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e Int32RangeMatcher_RangeMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e Int32RangeMatcher_RangeMatcherValidationError) ErrorName() string { - return "Int32RangeMatcher_RangeMatcherValidationError" -} - -// Error satisfies the builtin error interface -func (e Int32RangeMatcher_RangeMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sInt32RangeMatcher_RangeMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = Int32RangeMatcher_RangeMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = Int32RangeMatcher_RangeMatcherValidationError{} - -// Validate checks the field values on DoubleRangeMatcher_RangeMatcher with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *DoubleRangeMatcher_RangeMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DoubleRangeMatcher_RangeMatcher with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// DoubleRangeMatcher_RangeMatcherMultiError, or nil if none found. -func (m *DoubleRangeMatcher_RangeMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *DoubleRangeMatcher_RangeMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(m.GetRanges()) < 1 { - err := DoubleRangeMatcher_RangeMatcherValidationError{ - field: "Ranges", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetRanges() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DoubleRangeMatcher_RangeMatcherValidationError{ - field: fmt.Sprintf("Ranges[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DoubleRangeMatcher_RangeMatcherValidationError{ - field: fmt.Sprintf("Ranges[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DoubleRangeMatcher_RangeMatcherValidationError{ - field: fmt.Sprintf("Ranges[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetOnMatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DoubleRangeMatcher_RangeMatcherValidationError{ - field: "OnMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DoubleRangeMatcher_RangeMatcherValidationError{ - field: "OnMatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetOnMatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DoubleRangeMatcher_RangeMatcherValidationError{ - field: "OnMatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return DoubleRangeMatcher_RangeMatcherMultiError(errors) - } - - return nil -} - -// DoubleRangeMatcher_RangeMatcherMultiError is an error wrapping multiple -// validation errors returned by DoubleRangeMatcher_RangeMatcher.ValidateAll() -// if the designated constraints aren't met. -type DoubleRangeMatcher_RangeMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DoubleRangeMatcher_RangeMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DoubleRangeMatcher_RangeMatcherMultiError) AllErrors() []error { return m } - -// DoubleRangeMatcher_RangeMatcherValidationError is the validation error -// returned by DoubleRangeMatcher_RangeMatcher.Validate if the designated -// constraints aren't met. -type DoubleRangeMatcher_RangeMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DoubleRangeMatcher_RangeMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DoubleRangeMatcher_RangeMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DoubleRangeMatcher_RangeMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DoubleRangeMatcher_RangeMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DoubleRangeMatcher_RangeMatcherValidationError) ErrorName() string { - return "DoubleRangeMatcher_RangeMatcherValidationError" -} - -// Error satisfies the builtin error interface -func (e DoubleRangeMatcher_RangeMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDoubleRangeMatcher_RangeMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DoubleRangeMatcher_RangeMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DoubleRangeMatcher_RangeMatcherValidationError{} diff --git a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/regex.pb.go b/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/regex.pb.go deleted file mode 100644 index 28d3c8064..000000000 --- a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/regex.pb.go +++ /dev/null @@ -1,242 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: xds/type/matcher/v3/regex.proto - -package v3 - -import ( - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type RegexMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to EngineType: - // - // *RegexMatcher_GoogleRe2 - EngineType isRegexMatcher_EngineType `protobuf_oneof:"engine_type"` - Regex string `protobuf:"bytes,2,opt,name=regex,proto3" json:"regex,omitempty"` -} - -func (x *RegexMatcher) Reset() { - *x = RegexMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_regex_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RegexMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RegexMatcher) ProtoMessage() {} - -func (x *RegexMatcher) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_regex_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RegexMatcher.ProtoReflect.Descriptor instead. -func (*RegexMatcher) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_regex_proto_rawDescGZIP(), []int{0} -} - -func (m *RegexMatcher) GetEngineType() isRegexMatcher_EngineType { - if m != nil { - return m.EngineType - } - return nil -} - -func (x *RegexMatcher) GetGoogleRe2() *RegexMatcher_GoogleRE2 { - if x, ok := x.GetEngineType().(*RegexMatcher_GoogleRe2); ok { - return x.GoogleRe2 - } - return nil -} - -func (x *RegexMatcher) GetRegex() string { - if x != nil { - return x.Regex - } - return "" -} - -type isRegexMatcher_EngineType interface { - isRegexMatcher_EngineType() -} - -type RegexMatcher_GoogleRe2 struct { - GoogleRe2 *RegexMatcher_GoogleRE2 `protobuf:"bytes,1,opt,name=google_re2,json=googleRe2,proto3,oneof"` -} - -func (*RegexMatcher_GoogleRe2) isRegexMatcher_EngineType() {} - -type RegexMatcher_GoogleRE2 struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *RegexMatcher_GoogleRE2) Reset() { - *x = RegexMatcher_GoogleRE2{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_regex_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RegexMatcher_GoogleRE2) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RegexMatcher_GoogleRE2) ProtoMessage() {} - -func (x *RegexMatcher_GoogleRE2) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_regex_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RegexMatcher_GoogleRE2.ProtoReflect.Descriptor instead. -func (*RegexMatcher_GoogleRE2) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_regex_proto_rawDescGZIP(), []int{0, 0} -} - -var File_xds_type_matcher_v3_regex_proto protoreflect.FileDescriptor - -var file_xds_type_matcher_v3_regex_proto_rawDesc = []byte{ - 0x0a, 0x1f, 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x13, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, - 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0xa6, 0x01, 0x0a, 0x0c, 0x52, 0x65, 0x67, 0x65, 0x78, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, - 0x12, 0x56, 0x0a, 0x0a, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x5f, 0x72, 0x65, 0x32, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x67, 0x65, 0x78, - 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x52, 0x45, - 0x32, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, 0x09, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x52, 0x65, 0x32, 0x12, 0x1d, 0x0a, 0x05, 0x72, 0x65, 0x67, 0x65, - 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, - 0x52, 0x05, 0x72, 0x65, 0x67, 0x65, 0x78, 0x1a, 0x0b, 0x0a, 0x09, 0x47, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x52, 0x45, 0x32, 0x42, 0x12, 0x0a, 0x0b, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x42, 0x5a, 0x0a, 0x1e, 0x63, 0x6f, 0x6d, 0x2e, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x42, 0x0a, 0x52, 0x65, 0x67, 0x65, - 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6e, 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, 0x6f, - 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x2f, 0x76, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_xds_type_matcher_v3_regex_proto_rawDescOnce sync.Once - file_xds_type_matcher_v3_regex_proto_rawDescData = file_xds_type_matcher_v3_regex_proto_rawDesc -) - -func file_xds_type_matcher_v3_regex_proto_rawDescGZIP() []byte { - file_xds_type_matcher_v3_regex_proto_rawDescOnce.Do(func() { - file_xds_type_matcher_v3_regex_proto_rawDescData = protoimpl.X.CompressGZIP(file_xds_type_matcher_v3_regex_proto_rawDescData) - }) - return file_xds_type_matcher_v3_regex_proto_rawDescData -} - -var file_xds_type_matcher_v3_regex_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_xds_type_matcher_v3_regex_proto_goTypes = []interface{}{ - (*RegexMatcher)(nil), // 0: xds.type.matcher.v3.RegexMatcher - (*RegexMatcher_GoogleRE2)(nil), // 1: xds.type.matcher.v3.RegexMatcher.GoogleRE2 -} -var file_xds_type_matcher_v3_regex_proto_depIdxs = []int32{ - 1, // 0: xds.type.matcher.v3.RegexMatcher.google_re2:type_name -> xds.type.matcher.v3.RegexMatcher.GoogleRE2 - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_xds_type_matcher_v3_regex_proto_init() } -func file_xds_type_matcher_v3_regex_proto_init() { - if File_xds_type_matcher_v3_regex_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_xds_type_matcher_v3_regex_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RegexMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_type_matcher_v3_regex_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RegexMatcher_GoogleRE2); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_xds_type_matcher_v3_regex_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*RegexMatcher_GoogleRe2)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_xds_type_matcher_v3_regex_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_xds_type_matcher_v3_regex_proto_goTypes, - DependencyIndexes: file_xds_type_matcher_v3_regex_proto_depIdxs, - MessageInfos: file_xds_type_matcher_v3_regex_proto_msgTypes, - }.Build() - File_xds_type_matcher_v3_regex_proto = out.File - file_xds_type_matcher_v3_regex_proto_rawDesc = nil - file_xds_type_matcher_v3_regex_proto_goTypes = nil - file_xds_type_matcher_v3_regex_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/regex.pb.validate.go b/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/regex.pb.validate.go deleted file mode 100644 index 8b7682964..000000000 --- a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/regex.pb.validate.go +++ /dev/null @@ -1,317 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: xds/type/matcher/v3/regex.proto - -package v3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on RegexMatcher with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *RegexMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RegexMatcher with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in RegexMatcherMultiError, or -// nil if none found. -func (m *RegexMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *RegexMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetRegex()) < 1 { - err := RegexMatcherValidationError{ - field: "Regex", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - oneofEngineTypePresent := false - switch v := m.EngineType.(type) { - case *RegexMatcher_GoogleRe2: - if v == nil { - err := RegexMatcherValidationError{ - field: "EngineType", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofEngineTypePresent = true - - if m.GetGoogleRe2() == nil { - err := RegexMatcherValidationError{ - field: "GoogleRe2", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetGoogleRe2()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RegexMatcherValidationError{ - field: "GoogleRe2", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RegexMatcherValidationError{ - field: "GoogleRe2", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetGoogleRe2()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RegexMatcherValidationError{ - field: "GoogleRe2", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofEngineTypePresent { - err := RegexMatcherValidationError{ - field: "EngineType", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return RegexMatcherMultiError(errors) - } - - return nil -} - -// RegexMatcherMultiError is an error wrapping multiple validation errors -// returned by RegexMatcher.ValidateAll() if the designated constraints aren't met. -type RegexMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RegexMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RegexMatcherMultiError) AllErrors() []error { return m } - -// RegexMatcherValidationError is the validation error returned by -// RegexMatcher.Validate if the designated constraints aren't met. -type RegexMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RegexMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RegexMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RegexMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RegexMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RegexMatcherValidationError) ErrorName() string { return "RegexMatcherValidationError" } - -// Error satisfies the builtin error interface -func (e RegexMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRegexMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RegexMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RegexMatcherValidationError{} - -// Validate checks the field values on RegexMatcher_GoogleRE2 with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RegexMatcher_GoogleRE2) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RegexMatcher_GoogleRE2 with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RegexMatcher_GoogleRE2MultiError, or nil if none found. -func (m *RegexMatcher_GoogleRE2) ValidateAll() error { - return m.validate(true) -} - -func (m *RegexMatcher_GoogleRE2) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return RegexMatcher_GoogleRE2MultiError(errors) - } - - return nil -} - -// RegexMatcher_GoogleRE2MultiError is an error wrapping multiple validation -// errors returned by RegexMatcher_GoogleRE2.ValidateAll() if the designated -// constraints aren't met. -type RegexMatcher_GoogleRE2MultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RegexMatcher_GoogleRE2MultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RegexMatcher_GoogleRE2MultiError) AllErrors() []error { return m } - -// RegexMatcher_GoogleRE2ValidationError is the validation error returned by -// RegexMatcher_GoogleRE2.Validate if the designated constraints aren't met. -type RegexMatcher_GoogleRE2ValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RegexMatcher_GoogleRE2ValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RegexMatcher_GoogleRE2ValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RegexMatcher_GoogleRE2ValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RegexMatcher_GoogleRE2ValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RegexMatcher_GoogleRE2ValidationError) ErrorName() string { - return "RegexMatcher_GoogleRE2ValidationError" -} - -// Error satisfies the builtin error interface -func (e RegexMatcher_GoogleRE2ValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRegexMatcher_GoogleRE2.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RegexMatcher_GoogleRE2ValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RegexMatcher_GoogleRE2ValidationError{} diff --git a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/string.pb.go b/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/string.pb.go deleted file mode 100644 index 7e1946cb1..000000000 --- a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/string.pb.go +++ /dev/null @@ -1,353 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: xds/type/matcher/v3/string.proto - -package v3 - -import ( - v3 "github.com/cncf/xds/go/xds/core/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type StringMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to MatchPattern: - // - // *StringMatcher_Exact - // *StringMatcher_Prefix - // *StringMatcher_Suffix - // *StringMatcher_SafeRegex - // *StringMatcher_Contains - // *StringMatcher_Custom - MatchPattern isStringMatcher_MatchPattern `protobuf_oneof:"match_pattern"` - IgnoreCase bool `protobuf:"varint,6,opt,name=ignore_case,json=ignoreCase,proto3" json:"ignore_case,omitempty"` -} - -func (x *StringMatcher) Reset() { - *x = StringMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_string_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StringMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StringMatcher) ProtoMessage() {} - -func (x *StringMatcher) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_string_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StringMatcher.ProtoReflect.Descriptor instead. -func (*StringMatcher) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_string_proto_rawDescGZIP(), []int{0} -} - -func (m *StringMatcher) GetMatchPattern() isStringMatcher_MatchPattern { - if m != nil { - return m.MatchPattern - } - return nil -} - -func (x *StringMatcher) GetExact() string { - if x, ok := x.GetMatchPattern().(*StringMatcher_Exact); ok { - return x.Exact - } - return "" -} - -func (x *StringMatcher) GetPrefix() string { - if x, ok := x.GetMatchPattern().(*StringMatcher_Prefix); ok { - return x.Prefix - } - return "" -} - -func (x *StringMatcher) GetSuffix() string { - if x, ok := x.GetMatchPattern().(*StringMatcher_Suffix); ok { - return x.Suffix - } - return "" -} - -func (x *StringMatcher) GetSafeRegex() *RegexMatcher { - if x, ok := x.GetMatchPattern().(*StringMatcher_SafeRegex); ok { - return x.SafeRegex - } - return nil -} - -func (x *StringMatcher) GetContains() string { - if x, ok := x.GetMatchPattern().(*StringMatcher_Contains); ok { - return x.Contains - } - return "" -} - -func (x *StringMatcher) GetCustom() *v3.TypedExtensionConfig { - if x, ok := x.GetMatchPattern().(*StringMatcher_Custom); ok { - return x.Custom - } - return nil -} - -func (x *StringMatcher) GetIgnoreCase() bool { - if x != nil { - return x.IgnoreCase - } - return false -} - -type isStringMatcher_MatchPattern interface { - isStringMatcher_MatchPattern() -} - -type StringMatcher_Exact struct { - Exact string `protobuf:"bytes,1,opt,name=exact,proto3,oneof"` -} - -type StringMatcher_Prefix struct { - Prefix string `protobuf:"bytes,2,opt,name=prefix,proto3,oneof"` -} - -type StringMatcher_Suffix struct { - Suffix string `protobuf:"bytes,3,opt,name=suffix,proto3,oneof"` -} - -type StringMatcher_SafeRegex struct { - SafeRegex *RegexMatcher `protobuf:"bytes,5,opt,name=safe_regex,json=safeRegex,proto3,oneof"` -} - -type StringMatcher_Contains struct { - Contains string `protobuf:"bytes,7,opt,name=contains,proto3,oneof"` -} - -type StringMatcher_Custom struct { - Custom *v3.TypedExtensionConfig `protobuf:"bytes,8,opt,name=custom,proto3,oneof"` -} - -func (*StringMatcher_Exact) isStringMatcher_MatchPattern() {} - -func (*StringMatcher_Prefix) isStringMatcher_MatchPattern() {} - -func (*StringMatcher_Suffix) isStringMatcher_MatchPattern() {} - -func (*StringMatcher_SafeRegex) isStringMatcher_MatchPattern() {} - -func (*StringMatcher_Contains) isStringMatcher_MatchPattern() {} - -func (*StringMatcher_Custom) isStringMatcher_MatchPattern() {} - -type ListStringMatcher struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Patterns []*StringMatcher `protobuf:"bytes,1,rep,name=patterns,proto3" json:"patterns,omitempty"` -} - -func (x *ListStringMatcher) Reset() { - *x = ListStringMatcher{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_matcher_v3_string_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListStringMatcher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListStringMatcher) ProtoMessage() {} - -func (x *ListStringMatcher) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_matcher_v3_string_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListStringMatcher.ProtoReflect.Descriptor instead. -func (*ListStringMatcher) Descriptor() ([]byte, []int) { - return file_xds_type_matcher_v3_string_proto_rawDescGZIP(), []int{1} -} - -func (x *ListStringMatcher) GetPatterns() []*StringMatcher { - if x != nil { - return x.Patterns - } - return nil -} - -var File_xds_type_matcher_v3_string_proto protoreflect.FileDescriptor - -var file_xds_type_matcher_v3_string_proto_rawDesc = []byte{ - 0x0a, 0x20, 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x13, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x1a, 0x1b, 0x78, 0x64, 0x73, 0x2f, 0x63, 0x6f, 0x72, - 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, - 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x33, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x78, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, - 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd6, - 0x02, 0x0a, 0x0d, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, - 0x12, 0x16, 0x0a, 0x05, 0x65, 0x78, 0x61, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, - 0x00, 0x52, 0x05, 0x65, 0x78, 0x61, 0x63, 0x74, 0x12, 0x21, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, - 0x69, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, - 0x01, 0x48, 0x00, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x21, 0x0a, 0x06, 0x73, - 0x75, 0x66, 0x66, 0x69, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, - 0x72, 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, 0x06, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x12, 0x4c, - 0x0a, 0x0a, 0x73, 0x61, 0x66, 0x65, 0x5f, 0x72, 0x65, 0x67, 0x65, 0x78, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x67, 0x65, 0x78, 0x4d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x48, - 0x00, 0x52, 0x09, 0x73, 0x61, 0x66, 0x65, 0x52, 0x65, 0x67, 0x65, 0x78, 0x12, 0x25, 0x0a, 0x08, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, - 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x73, 0x12, 0x3b, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x18, 0x08, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, - 0x33, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x00, 0x52, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, - 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x63, 0x61, 0x73, 0x65, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x43, 0x61, 0x73, - 0x65, 0x42, 0x14, 0x0a, 0x0d, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x70, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0x5d, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x53, - 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x48, 0x0a, 0x08, - 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, - 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x72, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x08, 0x70, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x73, 0x42, 0x5b, 0x0a, 0x1e, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x42, 0x0b, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6e, 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, 0x6f, 0x2f, - 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, - 0x2f, 0x76, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_xds_type_matcher_v3_string_proto_rawDescOnce sync.Once - file_xds_type_matcher_v3_string_proto_rawDescData = file_xds_type_matcher_v3_string_proto_rawDesc -) - -func file_xds_type_matcher_v3_string_proto_rawDescGZIP() []byte { - file_xds_type_matcher_v3_string_proto_rawDescOnce.Do(func() { - file_xds_type_matcher_v3_string_proto_rawDescData = protoimpl.X.CompressGZIP(file_xds_type_matcher_v3_string_proto_rawDescData) - }) - return file_xds_type_matcher_v3_string_proto_rawDescData -} - -var file_xds_type_matcher_v3_string_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_xds_type_matcher_v3_string_proto_goTypes = []interface{}{ - (*StringMatcher)(nil), // 0: xds.type.matcher.v3.StringMatcher - (*ListStringMatcher)(nil), // 1: xds.type.matcher.v3.ListStringMatcher - (*RegexMatcher)(nil), // 2: xds.type.matcher.v3.RegexMatcher - (*v3.TypedExtensionConfig)(nil), // 3: xds.core.v3.TypedExtensionConfig -} -var file_xds_type_matcher_v3_string_proto_depIdxs = []int32{ - 2, // 0: xds.type.matcher.v3.StringMatcher.safe_regex:type_name -> xds.type.matcher.v3.RegexMatcher - 3, // 1: xds.type.matcher.v3.StringMatcher.custom:type_name -> xds.core.v3.TypedExtensionConfig - 0, // 2: xds.type.matcher.v3.ListStringMatcher.patterns:type_name -> xds.type.matcher.v3.StringMatcher - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_xds_type_matcher_v3_string_proto_init() } -func file_xds_type_matcher_v3_string_proto_init() { - if File_xds_type_matcher_v3_string_proto != nil { - return - } - file_xds_type_matcher_v3_regex_proto_init() - if !protoimpl.UnsafeEnabled { - file_xds_type_matcher_v3_string_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StringMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_type_matcher_v3_string_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListStringMatcher); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_xds_type_matcher_v3_string_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*StringMatcher_Exact)(nil), - (*StringMatcher_Prefix)(nil), - (*StringMatcher_Suffix)(nil), - (*StringMatcher_SafeRegex)(nil), - (*StringMatcher_Contains)(nil), - (*StringMatcher_Custom)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_xds_type_matcher_v3_string_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_xds_type_matcher_v3_string_proto_goTypes, - DependencyIndexes: file_xds_type_matcher_v3_string_proto_depIdxs, - MessageInfos: file_xds_type_matcher_v3_string_proto_msgTypes, - }.Build() - File_xds_type_matcher_v3_string_proto = out.File - file_xds_type_matcher_v3_string_proto_rawDesc = nil - file_xds_type_matcher_v3_string_proto_goTypes = nil - file_xds_type_matcher_v3_string_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/string.pb.validate.go b/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/string.pb.validate.go deleted file mode 100644 index 339d3b631..000000000 --- a/vendor/github.com/cncf/xds/go/xds/type/matcher/v3/string.pb.validate.go +++ /dev/null @@ -1,481 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: xds/type/matcher/v3/string.proto - -package v3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on StringMatcher with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *StringMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on StringMatcher with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in StringMatcherMultiError, or -// nil if none found. -func (m *StringMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *StringMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for IgnoreCase - - oneofMatchPatternPresent := false - switch v := m.MatchPattern.(type) { - case *StringMatcher_Exact: - if v == nil { - err := StringMatcherValidationError{ - field: "MatchPattern", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchPatternPresent = true - // no validation rules for Exact - case *StringMatcher_Prefix: - if v == nil { - err := StringMatcherValidationError{ - field: "MatchPattern", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchPatternPresent = true - - if utf8.RuneCountInString(m.GetPrefix()) < 1 { - err := StringMatcherValidationError{ - field: "Prefix", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - case *StringMatcher_Suffix: - if v == nil { - err := StringMatcherValidationError{ - field: "MatchPattern", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchPatternPresent = true - - if utf8.RuneCountInString(m.GetSuffix()) < 1 { - err := StringMatcherValidationError{ - field: "Suffix", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - case *StringMatcher_SafeRegex: - if v == nil { - err := StringMatcherValidationError{ - field: "MatchPattern", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchPatternPresent = true - - if m.GetSafeRegex() == nil { - err := StringMatcherValidationError{ - field: "SafeRegex", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetSafeRegex()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, StringMatcherValidationError{ - field: "SafeRegex", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, StringMatcherValidationError{ - field: "SafeRegex", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSafeRegex()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return StringMatcherValidationError{ - field: "SafeRegex", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *StringMatcher_Contains: - if v == nil { - err := StringMatcherValidationError{ - field: "MatchPattern", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchPatternPresent = true - - if utf8.RuneCountInString(m.GetContains()) < 1 { - err := StringMatcherValidationError{ - field: "Contains", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - case *StringMatcher_Custom: - if v == nil { - err := StringMatcherValidationError{ - field: "MatchPattern", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofMatchPatternPresent = true - - if all { - switch v := interface{}(m.GetCustom()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, StringMatcherValidationError{ - field: "Custom", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, StringMatcherValidationError{ - field: "Custom", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCustom()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return StringMatcherValidationError{ - field: "Custom", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofMatchPatternPresent { - err := StringMatcherValidationError{ - field: "MatchPattern", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return StringMatcherMultiError(errors) - } - - return nil -} - -// StringMatcherMultiError is an error wrapping multiple validation errors -// returned by StringMatcher.ValidateAll() if the designated constraints -// aren't met. -type StringMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m StringMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m StringMatcherMultiError) AllErrors() []error { return m } - -// StringMatcherValidationError is the validation error returned by -// StringMatcher.Validate if the designated constraints aren't met. -type StringMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e StringMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e StringMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e StringMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e StringMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e StringMatcherValidationError) ErrorName() string { return "StringMatcherValidationError" } - -// Error satisfies the builtin error interface -func (e StringMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sStringMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = StringMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = StringMatcherValidationError{} - -// Validate checks the field values on ListStringMatcher with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *ListStringMatcher) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ListStringMatcher with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ListStringMatcherMultiError, or nil if none found. -func (m *ListStringMatcher) ValidateAll() error { - return m.validate(true) -} - -func (m *ListStringMatcher) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(m.GetPatterns()) < 1 { - err := ListStringMatcherValidationError{ - field: "Patterns", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetPatterns() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ListStringMatcherValidationError{ - field: fmt.Sprintf("Patterns[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ListStringMatcherValidationError{ - field: fmt.Sprintf("Patterns[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ListStringMatcherValidationError{ - field: fmt.Sprintf("Patterns[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return ListStringMatcherMultiError(errors) - } - - return nil -} - -// ListStringMatcherMultiError is an error wrapping multiple validation errors -// returned by ListStringMatcher.ValidateAll() if the designated constraints -// aren't met. -type ListStringMatcherMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ListStringMatcherMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ListStringMatcherMultiError) AllErrors() []error { return m } - -// ListStringMatcherValidationError is the validation error returned by -// ListStringMatcher.Validate if the designated constraints aren't met. -type ListStringMatcherValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ListStringMatcherValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ListStringMatcherValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ListStringMatcherValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ListStringMatcherValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ListStringMatcherValidationError) ErrorName() string { - return "ListStringMatcherValidationError" -} - -// Error satisfies the builtin error interface -func (e ListStringMatcherValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sListStringMatcher.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ListStringMatcherValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ListStringMatcherValidationError{} diff --git a/vendor/github.com/cncf/xds/go/xds/type/v3/cel.pb.go b/vendor/github.com/cncf/xds/go/xds/type/v3/cel.pb.go deleted file mode 100644 index ac963e832..000000000 --- a/vendor/github.com/cncf/xds/go/xds/type/v3/cel.pb.go +++ /dev/null @@ -1,330 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: xds/type/v3/cel.proto - -package v3 - -import ( - expr "cel.dev/expr" - _ "github.com/cncf/xds/go/xds/annotations/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - v1alpha1 "google.golang.org/genproto/googleapis/api/expr/v1alpha1" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type CelExpression struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to ExprSpecifier: - // - // *CelExpression_ParsedExpr - // *CelExpression_CheckedExpr - ExprSpecifier isCelExpression_ExprSpecifier `protobuf_oneof:"expr_specifier"` - CelExprParsed *expr.ParsedExpr `protobuf:"bytes,3,opt,name=cel_expr_parsed,json=celExprParsed,proto3" json:"cel_expr_parsed,omitempty"` - CelExprChecked *expr.CheckedExpr `protobuf:"bytes,4,opt,name=cel_expr_checked,json=celExprChecked,proto3" json:"cel_expr_checked,omitempty"` -} - -func (x *CelExpression) Reset() { - *x = CelExpression{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_v3_cel_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CelExpression) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CelExpression) ProtoMessage() {} - -func (x *CelExpression) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_v3_cel_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CelExpression.ProtoReflect.Descriptor instead. -func (*CelExpression) Descriptor() ([]byte, []int) { - return file_xds_type_v3_cel_proto_rawDescGZIP(), []int{0} -} - -func (m *CelExpression) GetExprSpecifier() isCelExpression_ExprSpecifier { - if m != nil { - return m.ExprSpecifier - } - return nil -} - -// Deprecated: Marked as deprecated in xds/type/v3/cel.proto. -func (x *CelExpression) GetParsedExpr() *v1alpha1.ParsedExpr { - if x, ok := x.GetExprSpecifier().(*CelExpression_ParsedExpr); ok { - return x.ParsedExpr - } - return nil -} - -// Deprecated: Marked as deprecated in xds/type/v3/cel.proto. -func (x *CelExpression) GetCheckedExpr() *v1alpha1.CheckedExpr { - if x, ok := x.GetExprSpecifier().(*CelExpression_CheckedExpr); ok { - return x.CheckedExpr - } - return nil -} - -func (x *CelExpression) GetCelExprParsed() *expr.ParsedExpr { - if x != nil { - return x.CelExprParsed - } - return nil -} - -func (x *CelExpression) GetCelExprChecked() *expr.CheckedExpr { - if x != nil { - return x.CelExprChecked - } - return nil -} - -type isCelExpression_ExprSpecifier interface { - isCelExpression_ExprSpecifier() -} - -type CelExpression_ParsedExpr struct { - // Deprecated: Marked as deprecated in xds/type/v3/cel.proto. - ParsedExpr *v1alpha1.ParsedExpr `protobuf:"bytes,1,opt,name=parsed_expr,json=parsedExpr,proto3,oneof"` -} - -type CelExpression_CheckedExpr struct { - // Deprecated: Marked as deprecated in xds/type/v3/cel.proto. - CheckedExpr *v1alpha1.CheckedExpr `protobuf:"bytes,2,opt,name=checked_expr,json=checkedExpr,proto3,oneof"` -} - -func (*CelExpression_ParsedExpr) isCelExpression_ExprSpecifier() {} - -func (*CelExpression_CheckedExpr) isCelExpression_ExprSpecifier() {} - -type CelExtractString struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ExprExtract *CelExpression `protobuf:"bytes,1,opt,name=expr_extract,json=exprExtract,proto3" json:"expr_extract,omitempty"` - DefaultValue *wrapperspb.StringValue `protobuf:"bytes,2,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` -} - -func (x *CelExtractString) Reset() { - *x = CelExtractString{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_v3_cel_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CelExtractString) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CelExtractString) ProtoMessage() {} - -func (x *CelExtractString) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_v3_cel_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CelExtractString.ProtoReflect.Descriptor instead. -func (*CelExtractString) Descriptor() ([]byte, []int) { - return file_xds_type_v3_cel_proto_rawDescGZIP(), []int{1} -} - -func (x *CelExtractString) GetExprExtract() *CelExpression { - if x != nil { - return x.ExprExtract - } - return nil -} - -func (x *CelExtractString) GetDefaultValue() *wrapperspb.StringValue { - if x != nil { - return x.DefaultValue - } - return nil -} - -var File_xds_type_v3_cel_proto protoreflect.FileDescriptor - -var file_xds_type_v3_cel_proto_rawDesc = []byte{ - 0x0a, 0x15, 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x63, 0x65, - 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x2e, 0x76, 0x33, 0x1a, 0x26, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x65, 0x78, 0x70, 0x72, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x63, - 0x68, 0x65, 0x63, 0x6b, 0x65, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x25, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x65, 0x78, 0x70, 0x72, 0x2f, 0x76, 0x31, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x63, 0x65, 0x6c, 0x2f, 0x65, 0x78, 0x70, 0x72, 0x2f, 0x63, 0x68, - 0x65, 0x63, 0x6b, 0x65, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x63, 0x65, 0x6c, - 0x2f, 0x65, 0x78, 0x70, 0x72, 0x2f, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x1f, 0x78, 0x64, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbd, 0x02, 0x0a, - 0x0d, 0x43, 0x65, 0x6c, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x4b, - 0x0a, 0x0b, 0x70, 0x61, 0x72, 0x73, 0x65, 0x64, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, - 0x61, 0x72, 0x73, 0x65, 0x64, 0x45, 0x78, 0x70, 0x72, 0x42, 0x02, 0x18, 0x01, 0x48, 0x00, 0x52, - 0x0a, 0x70, 0x61, 0x72, 0x73, 0x65, 0x64, 0x45, 0x78, 0x70, 0x72, 0x12, 0x4e, 0x0a, 0x0c, 0x63, - 0x68, 0x65, 0x63, 0x6b, 0x65, 0x64, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x65, - 0x78, 0x70, 0x72, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x68, 0x65, - 0x63, 0x6b, 0x65, 0x64, 0x45, 0x78, 0x70, 0x72, 0x42, 0x02, 0x18, 0x01, 0x48, 0x00, 0x52, 0x0b, - 0x63, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x64, 0x45, 0x78, 0x70, 0x72, 0x12, 0x3c, 0x0a, 0x0f, 0x63, - 0x65, 0x6c, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x5f, 0x70, 0x61, 0x72, 0x73, 0x65, 0x64, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, - 0x50, 0x61, 0x72, 0x73, 0x65, 0x64, 0x45, 0x78, 0x70, 0x72, 0x52, 0x0d, 0x63, 0x65, 0x6c, 0x45, - 0x78, 0x70, 0x72, 0x50, 0x61, 0x72, 0x73, 0x65, 0x64, 0x12, 0x3f, 0x0a, 0x10, 0x63, 0x65, 0x6c, - 0x5f, 0x65, 0x78, 0x70, 0x72, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x43, - 0x68, 0x65, 0x63, 0x6b, 0x65, 0x64, 0x45, 0x78, 0x70, 0x72, 0x52, 0x0e, 0x63, 0x65, 0x6c, 0x45, - 0x78, 0x70, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x64, 0x42, 0x10, 0x0a, 0x0e, 0x65, 0x78, - 0x70, 0x72, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x9e, 0x01, 0x0a, - 0x10, 0x43, 0x65, 0x6c, 0x45, 0x78, 0x74, 0x72, 0x61, 0x63, 0x74, 0x53, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x12, 0x47, 0x0a, 0x0c, 0x65, 0x78, 0x70, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x72, 0x61, 0x63, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x65, 0x6c, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x0b, 0x65, - 0x78, 0x70, 0x72, 0x45, 0x78, 0x74, 0x72, 0x61, 0x63, 0x74, 0x12, 0x41, 0x0a, 0x0d, 0x64, 0x65, - 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, - 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x50, 0xd2, - 0xc6, 0xa4, 0xe1, 0x06, 0x02, 0x08, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x42, - 0x08, 0x43, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6e, 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, - 0x2f, 0x67, 0x6f, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_xds_type_v3_cel_proto_rawDescOnce sync.Once - file_xds_type_v3_cel_proto_rawDescData = file_xds_type_v3_cel_proto_rawDesc -) - -func file_xds_type_v3_cel_proto_rawDescGZIP() []byte { - file_xds_type_v3_cel_proto_rawDescOnce.Do(func() { - file_xds_type_v3_cel_proto_rawDescData = protoimpl.X.CompressGZIP(file_xds_type_v3_cel_proto_rawDescData) - }) - return file_xds_type_v3_cel_proto_rawDescData -} - -var file_xds_type_v3_cel_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_xds_type_v3_cel_proto_goTypes = []interface{}{ - (*CelExpression)(nil), // 0: xds.type.v3.CelExpression - (*CelExtractString)(nil), // 1: xds.type.v3.CelExtractString - (*v1alpha1.ParsedExpr)(nil), // 2: google.api.expr.v1alpha1.ParsedExpr - (*v1alpha1.CheckedExpr)(nil), // 3: google.api.expr.v1alpha1.CheckedExpr - (*expr.ParsedExpr)(nil), // 4: cel.expr.ParsedExpr - (*expr.CheckedExpr)(nil), // 5: cel.expr.CheckedExpr - (*wrapperspb.StringValue)(nil), // 6: google.protobuf.StringValue -} -var file_xds_type_v3_cel_proto_depIdxs = []int32{ - 2, // 0: xds.type.v3.CelExpression.parsed_expr:type_name -> google.api.expr.v1alpha1.ParsedExpr - 3, // 1: xds.type.v3.CelExpression.checked_expr:type_name -> google.api.expr.v1alpha1.CheckedExpr - 4, // 2: xds.type.v3.CelExpression.cel_expr_parsed:type_name -> cel.expr.ParsedExpr - 5, // 3: xds.type.v3.CelExpression.cel_expr_checked:type_name -> cel.expr.CheckedExpr - 0, // 4: xds.type.v3.CelExtractString.expr_extract:type_name -> xds.type.v3.CelExpression - 6, // 5: xds.type.v3.CelExtractString.default_value:type_name -> google.protobuf.StringValue - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name -} - -func init() { file_xds_type_v3_cel_proto_init() } -func file_xds_type_v3_cel_proto_init() { - if File_xds_type_v3_cel_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_xds_type_v3_cel_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CelExpression); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_type_v3_cel_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CelExtractString); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_xds_type_v3_cel_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*CelExpression_ParsedExpr)(nil), - (*CelExpression_CheckedExpr)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_xds_type_v3_cel_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_xds_type_v3_cel_proto_goTypes, - DependencyIndexes: file_xds_type_v3_cel_proto_depIdxs, - MessageInfos: file_xds_type_v3_cel_proto_msgTypes, - }.Build() - File_xds_type_v3_cel_proto = out.File - file_xds_type_v3_cel_proto_rawDesc = nil - file_xds_type_v3_cel_proto_goTypes = nil - file_xds_type_v3_cel_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/xds/type/v3/cel.pb.validate.go b/vendor/github.com/cncf/xds/go/xds/type/v3/cel.pb.validate.go deleted file mode 100644 index 0855edee9..000000000 --- a/vendor/github.com/cncf/xds/go/xds/type/v3/cel.pb.validate.go +++ /dev/null @@ -1,450 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: xds/type/v3/cel.proto - -package v3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on CelExpression with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *CelExpression) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CelExpression with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in CelExpressionMultiError, or -// nil if none found. -func (m *CelExpression) ValidateAll() error { - return m.validate(true) -} - -func (m *CelExpression) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetCelExprParsed()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CelExpressionValidationError{ - field: "CelExprParsed", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CelExpressionValidationError{ - field: "CelExprParsed", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCelExprParsed()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CelExpressionValidationError{ - field: "CelExprParsed", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetCelExprChecked()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CelExpressionValidationError{ - field: "CelExprChecked", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CelExpressionValidationError{ - field: "CelExprChecked", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCelExprChecked()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CelExpressionValidationError{ - field: "CelExprChecked", - reason: "embedded message failed validation", - cause: err, - } - } - } - - switch v := m.ExprSpecifier.(type) { - case *CelExpression_ParsedExpr: - if v == nil { - err := CelExpressionValidationError{ - field: "ExprSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetParsedExpr()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CelExpressionValidationError{ - field: "ParsedExpr", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CelExpressionValidationError{ - field: "ParsedExpr", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetParsedExpr()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CelExpressionValidationError{ - field: "ParsedExpr", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *CelExpression_CheckedExpr: - if v == nil { - err := CelExpressionValidationError{ - field: "ExprSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetCheckedExpr()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CelExpressionValidationError{ - field: "CheckedExpr", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CelExpressionValidationError{ - field: "CheckedExpr", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCheckedExpr()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CelExpressionValidationError{ - field: "CheckedExpr", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return CelExpressionMultiError(errors) - } - - return nil -} - -// CelExpressionMultiError is an error wrapping multiple validation errors -// returned by CelExpression.ValidateAll() if the designated constraints -// aren't met. -type CelExpressionMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CelExpressionMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CelExpressionMultiError) AllErrors() []error { return m } - -// CelExpressionValidationError is the validation error returned by -// CelExpression.Validate if the designated constraints aren't met. -type CelExpressionValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CelExpressionValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CelExpressionValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CelExpressionValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CelExpressionValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CelExpressionValidationError) ErrorName() string { return "CelExpressionValidationError" } - -// Error satisfies the builtin error interface -func (e CelExpressionValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCelExpression.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CelExpressionValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CelExpressionValidationError{} - -// Validate checks the field values on CelExtractString with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *CelExtractString) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CelExtractString with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// CelExtractStringMultiError, or nil if none found. -func (m *CelExtractString) ValidateAll() error { - return m.validate(true) -} - -func (m *CelExtractString) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetExprExtract() == nil { - err := CelExtractStringValidationError{ - field: "ExprExtract", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetExprExtract()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CelExtractStringValidationError{ - field: "ExprExtract", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CelExtractStringValidationError{ - field: "ExprExtract", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetExprExtract()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CelExtractStringValidationError{ - field: "ExprExtract", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetDefaultValue()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CelExtractStringValidationError{ - field: "DefaultValue", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CelExtractStringValidationError{ - field: "DefaultValue", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDefaultValue()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CelExtractStringValidationError{ - field: "DefaultValue", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return CelExtractStringMultiError(errors) - } - - return nil -} - -// CelExtractStringMultiError is an error wrapping multiple validation errors -// returned by CelExtractString.ValidateAll() if the designated constraints -// aren't met. -type CelExtractStringMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CelExtractStringMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CelExtractStringMultiError) AllErrors() []error { return m } - -// CelExtractStringValidationError is the validation error returned by -// CelExtractString.Validate if the designated constraints aren't met. -type CelExtractStringValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CelExtractStringValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CelExtractStringValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CelExtractStringValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CelExtractStringValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CelExtractStringValidationError) ErrorName() string { return "CelExtractStringValidationError" } - -// Error satisfies the builtin error interface -func (e CelExtractStringValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCelExtractString.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CelExtractStringValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CelExtractStringValidationError{} diff --git a/vendor/github.com/cncf/xds/go/xds/type/v3/range.pb.go b/vendor/github.com/cncf/xds/go/xds/type/v3/range.pb.go deleted file mode 100644 index bebf34485..000000000 --- a/vendor/github.com/cncf/xds/go/xds/type/v3/range.pb.go +++ /dev/null @@ -1,298 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: xds/type/v3/range.proto - -package v3 - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type Int64Range struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Start int64 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"` - End int64 `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"` -} - -func (x *Int64Range) Reset() { - *x = Int64Range{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_v3_range_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Int64Range) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Int64Range) ProtoMessage() {} - -func (x *Int64Range) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_v3_range_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Int64Range.ProtoReflect.Descriptor instead. -func (*Int64Range) Descriptor() ([]byte, []int) { - return file_xds_type_v3_range_proto_rawDescGZIP(), []int{0} -} - -func (x *Int64Range) GetStart() int64 { - if x != nil { - return x.Start - } - return 0 -} - -func (x *Int64Range) GetEnd() int64 { - if x != nil { - return x.End - } - return 0 -} - -type Int32Range struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Start int32 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"` - End int32 `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"` -} - -func (x *Int32Range) Reset() { - *x = Int32Range{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_v3_range_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Int32Range) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Int32Range) ProtoMessage() {} - -func (x *Int32Range) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_v3_range_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Int32Range.ProtoReflect.Descriptor instead. -func (*Int32Range) Descriptor() ([]byte, []int) { - return file_xds_type_v3_range_proto_rawDescGZIP(), []int{1} -} - -func (x *Int32Range) GetStart() int32 { - if x != nil { - return x.Start - } - return 0 -} - -func (x *Int32Range) GetEnd() int32 { - if x != nil { - return x.End - } - return 0 -} - -type DoubleRange struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Start float64 `protobuf:"fixed64,1,opt,name=start,proto3" json:"start,omitempty"` - End float64 `protobuf:"fixed64,2,opt,name=end,proto3" json:"end,omitempty"` -} - -func (x *DoubleRange) Reset() { - *x = DoubleRange{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_v3_range_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DoubleRange) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DoubleRange) ProtoMessage() {} - -func (x *DoubleRange) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_v3_range_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DoubleRange.ProtoReflect.Descriptor instead. -func (*DoubleRange) Descriptor() ([]byte, []int) { - return file_xds_type_v3_range_proto_rawDescGZIP(), []int{2} -} - -func (x *DoubleRange) GetStart() float64 { - if x != nil { - return x.Start - } - return 0 -} - -func (x *DoubleRange) GetEnd() float64 { - if x != nil { - return x.End - } - return 0 -} - -var File_xds_type_v3_range_proto protoreflect.FileDescriptor - -var file_xds_type_v3_range_proto_rawDesc = []byte{ - 0x0a, 0x17, 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x72, 0x61, - 0x6e, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x78, 0x64, 0x73, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x22, 0x34, 0x0a, 0x0a, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x52, - 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, - 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, 0x34, 0x0a, 0x0a, - 0x49, 0x6e, 0x74, 0x33, 0x32, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, - 0x6e, 0x64, 0x22, 0x35, 0x0a, 0x0b, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x52, 0x61, 0x6e, 0x67, - 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, - 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x01, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x42, 0x4a, 0x0a, 0x16, 0x63, 0x6f, 0x6d, - 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x2e, 0x76, 0x33, 0x42, 0x0a, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6e, - 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, - 0x70, 0x65, 0x2f, 0x76, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_xds_type_v3_range_proto_rawDescOnce sync.Once - file_xds_type_v3_range_proto_rawDescData = file_xds_type_v3_range_proto_rawDesc -) - -func file_xds_type_v3_range_proto_rawDescGZIP() []byte { - file_xds_type_v3_range_proto_rawDescOnce.Do(func() { - file_xds_type_v3_range_proto_rawDescData = protoimpl.X.CompressGZIP(file_xds_type_v3_range_proto_rawDescData) - }) - return file_xds_type_v3_range_proto_rawDescData -} - -var file_xds_type_v3_range_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_xds_type_v3_range_proto_goTypes = []interface{}{ - (*Int64Range)(nil), // 0: xds.type.v3.Int64Range - (*Int32Range)(nil), // 1: xds.type.v3.Int32Range - (*DoubleRange)(nil), // 2: xds.type.v3.DoubleRange -} -var file_xds_type_v3_range_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_xds_type_v3_range_proto_init() } -func file_xds_type_v3_range_proto_init() { - if File_xds_type_v3_range_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_xds_type_v3_range_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Int64Range); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_type_v3_range_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Int32Range); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_xds_type_v3_range_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DoubleRange); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_xds_type_v3_range_proto_rawDesc, - NumEnums: 0, - NumMessages: 3, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_xds_type_v3_range_proto_goTypes, - DependencyIndexes: file_xds_type_v3_range_proto_depIdxs, - MessageInfos: file_xds_type_v3_range_proto_msgTypes, - }.Build() - File_xds_type_v3_range_proto = out.File - file_xds_type_v3_range_proto_rawDesc = nil - file_xds_type_v3_range_proto_goTypes = nil - file_xds_type_v3_range_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/xds/type/v3/range.pb.validate.go b/vendor/github.com/cncf/xds/go/xds/type/v3/range.pb.validate.go deleted file mode 100644 index ccaf418e5..000000000 --- a/vendor/github.com/cncf/xds/go/xds/type/v3/range.pb.validate.go +++ /dev/null @@ -1,345 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: xds/type/v3/range.proto - -package v3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on Int64Range with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Int64Range) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Int64Range with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in Int64RangeMultiError, or -// nil if none found. -func (m *Int64Range) ValidateAll() error { - return m.validate(true) -} - -func (m *Int64Range) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Start - - // no validation rules for End - - if len(errors) > 0 { - return Int64RangeMultiError(errors) - } - - return nil -} - -// Int64RangeMultiError is an error wrapping multiple validation errors -// returned by Int64Range.ValidateAll() if the designated constraints aren't met. -type Int64RangeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m Int64RangeMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m Int64RangeMultiError) AllErrors() []error { return m } - -// Int64RangeValidationError is the validation error returned by -// Int64Range.Validate if the designated constraints aren't met. -type Int64RangeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e Int64RangeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e Int64RangeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e Int64RangeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e Int64RangeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e Int64RangeValidationError) ErrorName() string { return "Int64RangeValidationError" } - -// Error satisfies the builtin error interface -func (e Int64RangeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sInt64Range.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = Int64RangeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = Int64RangeValidationError{} - -// Validate checks the field values on Int32Range with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Int32Range) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Int32Range with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in Int32RangeMultiError, or -// nil if none found. -func (m *Int32Range) ValidateAll() error { - return m.validate(true) -} - -func (m *Int32Range) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Start - - // no validation rules for End - - if len(errors) > 0 { - return Int32RangeMultiError(errors) - } - - return nil -} - -// Int32RangeMultiError is an error wrapping multiple validation errors -// returned by Int32Range.ValidateAll() if the designated constraints aren't met. -type Int32RangeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m Int32RangeMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m Int32RangeMultiError) AllErrors() []error { return m } - -// Int32RangeValidationError is the validation error returned by -// Int32Range.Validate if the designated constraints aren't met. -type Int32RangeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e Int32RangeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e Int32RangeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e Int32RangeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e Int32RangeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e Int32RangeValidationError) ErrorName() string { return "Int32RangeValidationError" } - -// Error satisfies the builtin error interface -func (e Int32RangeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sInt32Range.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = Int32RangeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = Int32RangeValidationError{} - -// Validate checks the field values on DoubleRange with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *DoubleRange) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DoubleRange with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in DoubleRangeMultiError, or -// nil if none found. -func (m *DoubleRange) ValidateAll() error { - return m.validate(true) -} - -func (m *DoubleRange) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Start - - // no validation rules for End - - if len(errors) > 0 { - return DoubleRangeMultiError(errors) - } - - return nil -} - -// DoubleRangeMultiError is an error wrapping multiple validation errors -// returned by DoubleRange.ValidateAll() if the designated constraints aren't met. -type DoubleRangeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DoubleRangeMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DoubleRangeMultiError) AllErrors() []error { return m } - -// DoubleRangeValidationError is the validation error returned by -// DoubleRange.Validate if the designated constraints aren't met. -type DoubleRangeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DoubleRangeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DoubleRangeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DoubleRangeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DoubleRangeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DoubleRangeValidationError) ErrorName() string { return "DoubleRangeValidationError" } - -// Error satisfies the builtin error interface -func (e DoubleRangeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDoubleRange.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DoubleRangeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DoubleRangeValidationError{} diff --git a/vendor/github.com/cncf/xds/go/xds/type/v3/typed_struct.pb.go b/vendor/github.com/cncf/xds/go/xds/type/v3/typed_struct.pb.go deleted file mode 100644 index e02917a87..000000000 --- a/vendor/github.com/cncf/xds/go/xds/type/v3/typed_struct.pb.go +++ /dev/null @@ -1,163 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.5 -// source: xds/type/v3/typed_struct.proto - -package v3 - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - structpb "google.golang.org/protobuf/types/known/structpb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type TypedStruct struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TypeUrl string `protobuf:"bytes,1,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` - Value *structpb.Struct `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *TypedStruct) Reset() { - *x = TypedStruct{} - if protoimpl.UnsafeEnabled { - mi := &file_xds_type_v3_typed_struct_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TypedStruct) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TypedStruct) ProtoMessage() {} - -func (x *TypedStruct) ProtoReflect() protoreflect.Message { - mi := &file_xds_type_v3_typed_struct_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TypedStruct.ProtoReflect.Descriptor instead. -func (*TypedStruct) Descriptor() ([]byte, []int) { - return file_xds_type_v3_typed_struct_proto_rawDescGZIP(), []int{0} -} - -func (x *TypedStruct) GetTypeUrl() string { - if x != nil { - return x.TypeUrl - } - return "" -} - -func (x *TypedStruct) GetValue() *structpb.Struct { - if x != nil { - return x.Value - } - return nil -} - -var File_xds_type_v3_typed_struct_proto protoreflect.FileDescriptor - -var file_xds_type_v3_typed_struct_proto_rawDesc = []byte{ - 0x0a, 0x1e, 0x78, 0x64, 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x2f, 0x74, 0x79, - 0x70, 0x65, 0x64, 0x5f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x0b, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x1a, 0x1c, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, - 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x57, 0x0a, 0x0b, 0x54, - 0x79, 0x70, 0x65, 0x64, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x79, - 0x70, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x79, - 0x70, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x42, 0x50, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x78, 0x64, 0x73, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x33, 0x42, 0x10, - 0x54, 0x79, 0x70, 0x65, 0x64, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, - 0x6e, 0x63, 0x66, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x78, 0x64, 0x73, 0x2f, 0x74, - 0x79, 0x70, 0x65, 0x2f, 0x76, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_xds_type_v3_typed_struct_proto_rawDescOnce sync.Once - file_xds_type_v3_typed_struct_proto_rawDescData = file_xds_type_v3_typed_struct_proto_rawDesc -) - -func file_xds_type_v3_typed_struct_proto_rawDescGZIP() []byte { - file_xds_type_v3_typed_struct_proto_rawDescOnce.Do(func() { - file_xds_type_v3_typed_struct_proto_rawDescData = protoimpl.X.CompressGZIP(file_xds_type_v3_typed_struct_proto_rawDescData) - }) - return file_xds_type_v3_typed_struct_proto_rawDescData -} - -var file_xds_type_v3_typed_struct_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_xds_type_v3_typed_struct_proto_goTypes = []interface{}{ - (*TypedStruct)(nil), // 0: xds.type.v3.TypedStruct - (*structpb.Struct)(nil), // 1: google.protobuf.Struct -} -var file_xds_type_v3_typed_struct_proto_depIdxs = []int32{ - 1, // 0: xds.type.v3.TypedStruct.value:type_name -> google.protobuf.Struct - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_xds_type_v3_typed_struct_proto_init() } -func file_xds_type_v3_typed_struct_proto_init() { - if File_xds_type_v3_typed_struct_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_xds_type_v3_typed_struct_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TypedStruct); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_xds_type_v3_typed_struct_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_xds_type_v3_typed_struct_proto_goTypes, - DependencyIndexes: file_xds_type_v3_typed_struct_proto_depIdxs, - MessageInfos: file_xds_type_v3_typed_struct_proto_msgTypes, - }.Build() - File_xds_type_v3_typed_struct_proto = out.File - file_xds_type_v3_typed_struct_proto_rawDesc = nil - file_xds_type_v3_typed_struct_proto_goTypes = nil - file_xds_type_v3_typed_struct_proto_depIdxs = nil -} diff --git a/vendor/github.com/cncf/xds/go/xds/type/v3/typed_struct.pb.validate.go b/vendor/github.com/cncf/xds/go/xds/type/v3/typed_struct.pb.validate.go deleted file mode 100644 index f39bce906..000000000 --- a/vendor/github.com/cncf/xds/go/xds/type/v3/typed_struct.pb.validate.go +++ /dev/null @@ -1,166 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: xds/type/v3/typed_struct.proto - -package v3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on TypedStruct with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *TypedStruct) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on TypedStruct with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in TypedStructMultiError, or -// nil if none found. -func (m *TypedStruct) ValidateAll() error { - return m.validate(true) -} - -func (m *TypedStruct) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for TypeUrl - - if all { - switch v := interface{}(m.GetValue()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, TypedStructValidationError{ - field: "Value", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, TypedStructValidationError{ - field: "Value", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetValue()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return TypedStructValidationError{ - field: "Value", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return TypedStructMultiError(errors) - } - - return nil -} - -// TypedStructMultiError is an error wrapping multiple validation errors -// returned by TypedStruct.ValidateAll() if the designated constraints aren't met. -type TypedStructMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m TypedStructMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m TypedStructMultiError) AllErrors() []error { return m } - -// TypedStructValidationError is the validation error returned by -// TypedStruct.Validate if the designated constraints aren't met. -type TypedStructValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TypedStructValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TypedStructValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TypedStructValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TypedStructValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TypedStructValidationError) ErrorName() string { return "TypedStructValidationError" } - -// Error satisfies the builtin error interface -func (e TypedStructValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTypedStruct.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TypedStructValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TypedStructValidationError{} diff --git a/vendor/github.com/coreos/go-semver/LICENSE b/vendor/github.com/coreos/go-semver/LICENSE deleted file mode 100644 index d64569567..000000000 --- a/vendor/github.com/coreos/go-semver/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - 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. diff --git a/vendor/github.com/coreos/go-semver/NOTICE b/vendor/github.com/coreos/go-semver/NOTICE deleted file mode 100644 index 23a0ada2f..000000000 --- a/vendor/github.com/coreos/go-semver/NOTICE +++ /dev/null @@ -1,5 +0,0 @@ -CoreOS Project -Copyright 2018 CoreOS, Inc - -This product includes software developed at CoreOS, Inc. -(http://www.coreos.com/). diff --git a/vendor/github.com/coreos/go-semver/semver/semver.go b/vendor/github.com/coreos/go-semver/semver/semver.go deleted file mode 100644 index eb9fb7ff2..000000000 --- a/vendor/github.com/coreos/go-semver/semver/semver.go +++ /dev/null @@ -1,296 +0,0 @@ -// Copyright 2013-2015 CoreOS, Inc. -// -// 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. - -// Semantic Versions http://semver.org -package semver - -import ( - "bytes" - "errors" - "fmt" - "regexp" - "strconv" - "strings" -) - -type Version struct { - Major int64 - Minor int64 - Patch int64 - PreRelease PreRelease - Metadata string -} - -type PreRelease string - -func splitOff(input *string, delim string) (val string) { - parts := strings.SplitN(*input, delim, 2) - - if len(parts) == 2 { - *input = parts[0] - val = parts[1] - } - - return val -} - -func New(version string) *Version { - return Must(NewVersion(version)) -} - -func NewVersion(version string) (*Version, error) { - v := Version{} - - if err := v.Set(version); err != nil { - return nil, err - } - - return &v, nil -} - -// Must is a helper for wrapping NewVersion and will panic if err is not nil. -func Must(v *Version, err error) *Version { - if err != nil { - panic(err) - } - return v -} - -// Set parses and updates v from the given version string. Implements flag.Value -func (v *Version) Set(version string) error { - metadata := splitOff(&version, "+") - preRelease := PreRelease(splitOff(&version, "-")) - dotParts := strings.SplitN(version, ".", 3) - - if len(dotParts) != 3 { - return fmt.Errorf("%s is not in dotted-tri format", version) - } - - if err := validateIdentifier(string(preRelease)); err != nil { - return fmt.Errorf("failed to validate pre-release: %v", err) - } - - if err := validateIdentifier(metadata); err != nil { - return fmt.Errorf("failed to validate metadata: %v", err) - } - - parsed := make([]int64, 3) - - for i, v := range dotParts[:3] { - val, err := strconv.ParseInt(v, 10, 64) - parsed[i] = val - if err != nil { - return err - } - } - - v.Metadata = metadata - v.PreRelease = preRelease - v.Major = parsed[0] - v.Minor = parsed[1] - v.Patch = parsed[2] - return nil -} - -func (v Version) String() string { - var buffer bytes.Buffer - - fmt.Fprintf(&buffer, "%d.%d.%d", v.Major, v.Minor, v.Patch) - - if v.PreRelease != "" { - fmt.Fprintf(&buffer, "-%s", v.PreRelease) - } - - if v.Metadata != "" { - fmt.Fprintf(&buffer, "+%s", v.Metadata) - } - - return buffer.String() -} - -func (v *Version) UnmarshalYAML(unmarshal func(interface{}) error) error { - var data string - if err := unmarshal(&data); err != nil { - return err - } - return v.Set(data) -} - -func (v Version) MarshalJSON() ([]byte, error) { - return []byte(`"` + v.String() + `"`), nil -} - -func (v *Version) UnmarshalJSON(data []byte) error { - l := len(data) - if l == 0 || string(data) == `""` { - return nil - } - if l < 2 || data[0] != '"' || data[l-1] != '"' { - return errors.New("invalid semver string") - } - return v.Set(string(data[1 : l-1])) -} - -// Compare tests if v is less than, equal to, or greater than versionB, -// returning -1, 0, or +1 respectively. -func (v Version) Compare(versionB Version) int { - if cmp := recursiveCompare(v.Slice(), versionB.Slice()); cmp != 0 { - return cmp - } - return preReleaseCompare(v, versionB) -} - -// Equal tests if v is equal to versionB. -func (v Version) Equal(versionB Version) bool { - return v.Compare(versionB) == 0 -} - -// LessThan tests if v is less than versionB. -func (v Version) LessThan(versionB Version) bool { - return v.Compare(versionB) < 0 -} - -// Slice converts the comparable parts of the semver into a slice of integers. -func (v Version) Slice() []int64 { - return []int64{v.Major, v.Minor, v.Patch} -} - -func (p PreRelease) Slice() []string { - preRelease := string(p) - return strings.Split(preRelease, ".") -} - -func preReleaseCompare(versionA Version, versionB Version) int { - a := versionA.PreRelease - b := versionB.PreRelease - - /* Handle the case where if two versions are otherwise equal it is the - * one without a PreRelease that is greater */ - if len(a) == 0 && (len(b) > 0) { - return 1 - } else if len(b) == 0 && (len(a) > 0) { - return -1 - } - - // If there is a prerelease, check and compare each part. - return recursivePreReleaseCompare(a.Slice(), b.Slice()) -} - -func recursiveCompare(versionA []int64, versionB []int64) int { - if len(versionA) == 0 { - return 0 - } - - a := versionA[0] - b := versionB[0] - - if a > b { - return 1 - } else if a < b { - return -1 - } - - return recursiveCompare(versionA[1:], versionB[1:]) -} - -func recursivePreReleaseCompare(versionA []string, versionB []string) int { - // A larger set of pre-release fields has a higher precedence than a smaller set, - // if all of the preceding identifiers are equal. - if len(versionA) == 0 { - if len(versionB) > 0 { - return -1 - } - return 0 - } else if len(versionB) == 0 { - // We're longer than versionB so return 1. - return 1 - } - - a := versionA[0] - b := versionB[0] - - aInt := false - bInt := false - - aI, err := strconv.Atoi(versionA[0]) - if err == nil { - aInt = true - } - - bI, err := strconv.Atoi(versionB[0]) - if err == nil { - bInt = true - } - - // Numeric identifiers always have lower precedence than non-numeric identifiers. - if aInt && !bInt { - return -1 - } else if !aInt && bInt { - return 1 - } - - // Handle Integer Comparison - if aInt && bInt { - if aI > bI { - return 1 - } else if aI < bI { - return -1 - } - } - - // Handle String Comparison - if a > b { - return 1 - } else if a < b { - return -1 - } - - return recursivePreReleaseCompare(versionA[1:], versionB[1:]) -} - -// BumpMajor increments the Major field by 1 and resets all other fields to their default values -func (v *Version) BumpMajor() { - v.Major += 1 - v.Minor = 0 - v.Patch = 0 - v.PreRelease = PreRelease("") - v.Metadata = "" -} - -// BumpMinor increments the Minor field by 1 and resets all other fields to their default values -func (v *Version) BumpMinor() { - v.Minor += 1 - v.Patch = 0 - v.PreRelease = PreRelease("") - v.Metadata = "" -} - -// BumpPatch increments the Patch field by 1 and resets all other fields to their default values -func (v *Version) BumpPatch() { - v.Patch += 1 - v.PreRelease = PreRelease("") - v.Metadata = "" -} - -// validateIdentifier makes sure the provided identifier satisfies semver spec -func validateIdentifier(id string) error { - if id != "" && !reIdentifier.MatchString(id) { - return fmt.Errorf("%s is not a valid semver identifier", id) - } - return nil -} - -// reIdentifier is a regular expression used to check that pre-release and metadata -// identifiers satisfy the spec requirements -var reIdentifier = regexp.MustCompile(`^[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*$`) diff --git a/vendor/github.com/coreos/go-semver/semver/sort.go b/vendor/github.com/coreos/go-semver/semver/sort.go deleted file mode 100644 index e256b41a5..000000000 --- a/vendor/github.com/coreos/go-semver/semver/sort.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2013-2015 CoreOS, Inc. -// -// 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 semver - -import ( - "sort" -) - -type Versions []*Version - -func (s Versions) Len() int { - return len(s) -} - -func (s Versions) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} - -func (s Versions) Less(i, j int) bool { - return s[i].LessThan(*s[j]) -} - -// Sort sorts the given slice of Version -func Sort(versions []*Version) { - sort.Sort(Versions(versions)) -} diff --git a/vendor/github.com/coreos/go-systemd/v22/LICENSE b/vendor/github.com/coreos/go-systemd/v22/LICENSE deleted file mode 100644 index 37ec93a14..000000000 --- a/vendor/github.com/coreos/go-systemd/v22/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ -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: - -You must give any other recipients of the Work or Derivative Works a copy of -this License; and -You must cause any modified files to carry prominent notices stating that You -changed the files; and -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 -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. diff --git a/vendor/github.com/coreos/go-systemd/v22/NOTICE b/vendor/github.com/coreos/go-systemd/v22/NOTICE deleted file mode 100644 index 23a0ada2f..000000000 --- a/vendor/github.com/coreos/go-systemd/v22/NOTICE +++ /dev/null @@ -1,5 +0,0 @@ -CoreOS Project -Copyright 2018 CoreOS, Inc - -This product includes software developed at CoreOS, Inc. -(http://www.coreos.com/). diff --git a/vendor/github.com/coreos/go-systemd/v22/journal/journal.go b/vendor/github.com/coreos/go-systemd/v22/journal/journal.go deleted file mode 100644 index ac24c7767..000000000 --- a/vendor/github.com/coreos/go-systemd/v22/journal/journal.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// 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 journal provides write bindings to the local systemd journal. -// It is implemented in pure Go and connects to the journal directly over its -// unix socket. -// -// To read from the journal, see the "sdjournal" package, which wraps the -// sd-journal a C API. -// -// http://www.freedesktop.org/software/systemd/man/systemd-journald.service.html -package journal - -import ( - "fmt" -) - -// Priority of a journal message -type Priority int - -const ( - PriEmerg Priority = iota - PriAlert - PriCrit - PriErr - PriWarning - PriNotice - PriInfo - PriDebug -) - -// Print prints a message to the local systemd journal using Send(). -func Print(priority Priority, format string, a ...interface{}) error { - return Send(fmt.Sprintf(format, a...), priority, nil) -} diff --git a/vendor/github.com/coreos/go-systemd/v22/journal/journal_unix.go b/vendor/github.com/coreos/go-systemd/v22/journal/journal_unix.go deleted file mode 100644 index c5b23a819..000000000 --- a/vendor/github.com/coreos/go-systemd/v22/journal/journal_unix.go +++ /dev/null @@ -1,267 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// 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. - -//go:build !windows -// +build !windows - -// Package journal provides write bindings to the local systemd journal. -// It is implemented in pure Go and connects to the journal directly over its -// unix socket. -// -// To read from the journal, see the "sdjournal" package, which wraps the -// sd-journal a C API. -// -// http://www.freedesktop.org/software/systemd/man/systemd-journald.service.html -package journal - -import ( - "bytes" - "encoding/binary" - "errors" - "fmt" - "io" - "io/ioutil" - "net" - "os" - "strconv" - "strings" - "sync" - "sync/atomic" - "syscall" - "unsafe" -) - -var ( - // This can be overridden at build-time: - // https://github.com/golang/go/wiki/GcToolchainTricks#including-build-information-in-the-executable - journalSocket = "/run/systemd/journal/socket" - - // unixConnPtr atomically holds the local unconnected Unix-domain socket. - // Concrete safe pointer type: *net.UnixConn - unixConnPtr unsafe.Pointer - // onceConn ensures that unixConnPtr is initialized exactly once. - onceConn sync.Once -) - -// Enabled checks whether the local systemd journal is available for logging. -func Enabled() bool { - if c := getOrInitConn(); c == nil { - return false - } - - conn, err := net.Dial("unixgram", journalSocket) - if err != nil { - return false - } - defer conn.Close() - - return true -} - -// StderrIsJournalStream returns whether the process stderr is connected -// to the Journal's stream transport. -// -// This can be used for automatic protocol upgrading described in [Journal Native Protocol]. -// -// Returns true if JOURNAL_STREAM environment variable is present, -// and stderr's device and inode numbers match it. -// -// Error is returned if unexpected error occurs: e.g. if JOURNAL_STREAM environment variable -// is present, but malformed, fstat syscall fails, etc. -// -// [Journal Native Protocol]: https://systemd.io/JOURNAL_NATIVE_PROTOCOL/#automatic-protocol-upgrading -func StderrIsJournalStream() (bool, error) { - return fdIsJournalStream(syscall.Stderr) -} - -// StdoutIsJournalStream returns whether the process stdout is connected -// to the Journal's stream transport. -// -// Returns true if JOURNAL_STREAM environment variable is present, -// and stdout's device and inode numbers match it. -// -// Error is returned if unexpected error occurs: e.g. if JOURNAL_STREAM environment variable -// is present, but malformed, fstat syscall fails, etc. -// -// Most users should probably use [StderrIsJournalStream]. -func StdoutIsJournalStream() (bool, error) { - return fdIsJournalStream(syscall.Stdout) -} - -func fdIsJournalStream(fd int) (bool, error) { - journalStream := os.Getenv("JOURNAL_STREAM") - if journalStream == "" { - return false, nil - } - - var expectedStat syscall.Stat_t - _, err := fmt.Sscanf(journalStream, "%d:%d", &expectedStat.Dev, &expectedStat.Ino) - if err != nil { - return false, fmt.Errorf("failed to parse JOURNAL_STREAM=%q: %v", journalStream, err) - } - - var stat syscall.Stat_t - err = syscall.Fstat(fd, &stat) - if err != nil { - return false, err - } - - match := stat.Dev == expectedStat.Dev && stat.Ino == expectedStat.Ino - return match, nil -} - -// Send a message to the local systemd journal. vars is a map of journald -// fields to values. Fields must be composed of uppercase letters, numbers, -// and underscores, but must not start with an underscore. Within these -// restrictions, any arbitrary field name may be used. Some names have special -// significance: see the journalctl documentation -// (http://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html) -// for more details. vars may be nil. -func Send(message string, priority Priority, vars map[string]string) error { - conn := getOrInitConn() - if conn == nil { - return errors.New("could not initialize socket to journald") - } - - socketAddr := &net.UnixAddr{ - Name: journalSocket, - Net: "unixgram", - } - - data := new(bytes.Buffer) - appendVariable(data, "PRIORITY", strconv.Itoa(int(priority))) - appendVariable(data, "MESSAGE", message) - for k, v := range vars { - appendVariable(data, k, v) - } - - _, _, err := conn.WriteMsgUnix(data.Bytes(), nil, socketAddr) - if err == nil { - return nil - } - if !isSocketSpaceError(err) { - return err - } - - // Large log entry, send it via tempfile and ancillary-fd. - file, err := tempFd() - if err != nil { - return err - } - defer file.Close() - _, err = io.Copy(file, data) - if err != nil { - return err - } - rights := syscall.UnixRights(int(file.Fd())) - _, _, err = conn.WriteMsgUnix([]byte{}, rights, socketAddr) - if err != nil { - return err - } - - return nil -} - -// getOrInitConn attempts to get the global `unixConnPtr` socket, initializing if necessary -func getOrInitConn() *net.UnixConn { - conn := (*net.UnixConn)(atomic.LoadPointer(&unixConnPtr)) - if conn != nil { - return conn - } - onceConn.Do(initConn) - return (*net.UnixConn)(atomic.LoadPointer(&unixConnPtr)) -} - -func appendVariable(w io.Writer, name, value string) { - if err := validVarName(name); err != nil { - fmt.Fprintf(os.Stderr, "variable name %s contains invalid character, ignoring\n", name) - } - if strings.ContainsRune(value, '\n') { - /* When the value contains a newline, we write: - * - the variable name, followed by a newline - * - the size (in 64bit little endian format) - * - the data, followed by a newline - */ - fmt.Fprintln(w, name) - binary.Write(w, binary.LittleEndian, uint64(len(value))) - fmt.Fprintln(w, value) - } else { - /* just write the variable and value all on one line */ - fmt.Fprintf(w, "%s=%s\n", name, value) - } -} - -// validVarName validates a variable name to make sure journald will accept it. -// The variable name must be in uppercase and consist only of characters, -// numbers and underscores, and may not begin with an underscore: -// https://www.freedesktop.org/software/systemd/man/sd_journal_print.html -func validVarName(name string) error { - if name == "" { - return errors.New("Empty variable name") - } else if name[0] == '_' { - return errors.New("Variable name begins with an underscore") - } - - for _, c := range name { - if !(('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || c == '_') { - return errors.New("Variable name contains invalid characters") - } - } - return nil -} - -// isSocketSpaceError checks whether the error is signaling -// an "overlarge message" condition. -func isSocketSpaceError(err error) bool { - opErr, ok := err.(*net.OpError) - if !ok || opErr == nil { - return false - } - - sysErr, ok := opErr.Err.(*os.SyscallError) - if !ok || sysErr == nil { - return false - } - - return sysErr.Err == syscall.EMSGSIZE || sysErr.Err == syscall.ENOBUFS -} - -// tempFd creates a temporary, unlinked file under `/dev/shm`. -func tempFd() (*os.File, error) { - file, err := ioutil.TempFile("/dev/shm/", "journal.XXXXX") - if err != nil { - return nil, err - } - err = syscall.Unlink(file.Name()) - if err != nil { - return nil, err - } - return file, nil -} - -// initConn initializes the global `unixConnPtr` socket. -// It is automatically called when needed. -func initConn() { - autobind, err := net.ResolveUnixAddr("unixgram", "") - if err != nil { - return - } - - sock, err := net.ListenUnixgram("unixgram", autobind) - if err != nil { - return - } - - atomic.StorePointer(&unixConnPtr, unsafe.Pointer(sock)) -} diff --git a/vendor/github.com/coreos/go-systemd/v22/journal/journal_windows.go b/vendor/github.com/coreos/go-systemd/v22/journal/journal_windows.go deleted file mode 100644 index 322e41e74..000000000 --- a/vendor/github.com/coreos/go-systemd/v22/journal/journal_windows.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// 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 journal provides write bindings to the local systemd journal. -// It is implemented in pure Go and connects to the journal directly over its -// unix socket. -// -// To read from the journal, see the "sdjournal" package, which wraps the -// sd-journal a C API. -// -// http://www.freedesktop.org/software/systemd/man/systemd-journald.service.html -package journal - -import ( - "errors" -) - -func Enabled() bool { - return false -} - -func Send(message string, priority Priority, vars map[string]string) error { - return errors.New("could not initialize socket to journald") -} - -func StderrIsJournalStream() (bool, error) { - return false, nil -} - -func StdoutIsJournalStream() (bool, error) { - return false, nil -} diff --git a/vendor/github.com/davecgh/go-spew/LICENSE b/vendor/github.com/davecgh/go-spew/LICENSE deleted file mode 100644 index bc52e96f2..000000000 --- a/vendor/github.com/davecgh/go-spew/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -ISC License - -Copyright (c) 2012-2016 Dave Collins - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/vendor/github.com/davecgh/go-spew/spew/bypass.go b/vendor/github.com/davecgh/go-spew/spew/bypass.go deleted file mode 100644 index 792994785..000000000 --- a/vendor/github.com/davecgh/go-spew/spew/bypass.go +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright (c) 2015-2016 Dave Collins -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// NOTE: Due to the following build constraints, this file will only be compiled -// when the code is not running on Google App Engine, compiled by GopherJS, and -// "-tags safe" is not added to the go build command line. The "disableunsafe" -// tag is deprecated and thus should not be used. -// Go versions prior to 1.4 are disabled because they use a different layout -// for interfaces which make the implementation of unsafeReflectValue more complex. -// +build !js,!appengine,!safe,!disableunsafe,go1.4 - -package spew - -import ( - "reflect" - "unsafe" -) - -const ( - // UnsafeDisabled is a build-time constant which specifies whether or - // not access to the unsafe package is available. - UnsafeDisabled = false - - // ptrSize is the size of a pointer on the current arch. - ptrSize = unsafe.Sizeof((*byte)(nil)) -) - -type flag uintptr - -var ( - // flagRO indicates whether the value field of a reflect.Value - // is read-only. - flagRO flag - - // flagAddr indicates whether the address of the reflect.Value's - // value may be taken. - flagAddr flag -) - -// flagKindMask holds the bits that make up the kind -// part of the flags field. In all the supported versions, -// it is in the lower 5 bits. -const flagKindMask = flag(0x1f) - -// Different versions of Go have used different -// bit layouts for the flags type. This table -// records the known combinations. -var okFlags = []struct { - ro, addr flag -}{{ - // From Go 1.4 to 1.5 - ro: 1 << 5, - addr: 1 << 7, -}, { - // Up to Go tip. - ro: 1<<5 | 1<<6, - addr: 1 << 8, -}} - -var flagValOffset = func() uintptr { - field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag") - if !ok { - panic("reflect.Value has no flag field") - } - return field.Offset -}() - -// flagField returns a pointer to the flag field of a reflect.Value. -func flagField(v *reflect.Value) *flag { - return (*flag)(unsafe.Pointer(uintptr(unsafe.Pointer(v)) + flagValOffset)) -} - -// unsafeReflectValue converts the passed reflect.Value into a one that bypasses -// the typical safety restrictions preventing access to unaddressable and -// unexported data. It works by digging the raw pointer to the underlying -// value out of the protected value and generating a new unprotected (unsafe) -// reflect.Value to it. -// -// This allows us to check for implementations of the Stringer and error -// interfaces to be used for pretty printing ordinarily unaddressable and -// inaccessible values such as unexported struct fields. -func unsafeReflectValue(v reflect.Value) reflect.Value { - if !v.IsValid() || (v.CanInterface() && v.CanAddr()) { - return v - } - flagFieldPtr := flagField(&v) - *flagFieldPtr &^= flagRO - *flagFieldPtr |= flagAddr - return v -} - -// Sanity checks against future reflect package changes -// to the type or semantics of the Value.flag field. -func init() { - field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag") - if !ok { - panic("reflect.Value has no flag field") - } - if field.Type.Kind() != reflect.TypeOf(flag(0)).Kind() { - panic("reflect.Value flag field has changed kind") - } - type t0 int - var t struct { - A t0 - // t0 will have flagEmbedRO set. - t0 - // a will have flagStickyRO set - a t0 - } - vA := reflect.ValueOf(t).FieldByName("A") - va := reflect.ValueOf(t).FieldByName("a") - vt0 := reflect.ValueOf(t).FieldByName("t0") - - // Infer flagRO from the difference between the flags - // for the (otherwise identical) fields in t. - flagPublic := *flagField(&vA) - flagWithRO := *flagField(&va) | *flagField(&vt0) - flagRO = flagPublic ^ flagWithRO - - // Infer flagAddr from the difference between a value - // taken from a pointer and not. - vPtrA := reflect.ValueOf(&t).Elem().FieldByName("A") - flagNoPtr := *flagField(&vA) - flagPtr := *flagField(&vPtrA) - flagAddr = flagNoPtr ^ flagPtr - - // Check that the inferred flags tally with one of the known versions. - for _, f := range okFlags { - if flagRO == f.ro && flagAddr == f.addr { - return - } - } - panic("reflect.Value read-only flag has changed semantics") -} diff --git a/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go b/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go deleted file mode 100644 index 205c28d68..000000000 --- a/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2015-2016 Dave Collins -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// NOTE: Due to the following build constraints, this file will only be compiled -// when the code is running on Google App Engine, compiled by GopherJS, or -// "-tags safe" is added to the go build command line. The "disableunsafe" -// tag is deprecated and thus should not be used. -// +build js appengine safe disableunsafe !go1.4 - -package spew - -import "reflect" - -const ( - // UnsafeDisabled is a build-time constant which specifies whether or - // not access to the unsafe package is available. - UnsafeDisabled = true -) - -// unsafeReflectValue typically converts the passed reflect.Value into a one -// that bypasses the typical safety restrictions preventing access to -// unaddressable and unexported data. However, doing this relies on access to -// the unsafe package. This is a stub version which simply returns the passed -// reflect.Value when the unsafe package is not available. -func unsafeReflectValue(v reflect.Value) reflect.Value { - return v -} diff --git a/vendor/github.com/davecgh/go-spew/spew/common.go b/vendor/github.com/davecgh/go-spew/spew/common.go deleted file mode 100644 index 1be8ce945..000000000 --- a/vendor/github.com/davecgh/go-spew/spew/common.go +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "bytes" - "fmt" - "io" - "reflect" - "sort" - "strconv" -) - -// Some constants in the form of bytes to avoid string overhead. This mirrors -// the technique used in the fmt package. -var ( - panicBytes = []byte("(PANIC=") - plusBytes = []byte("+") - iBytes = []byte("i") - trueBytes = []byte("true") - falseBytes = []byte("false") - interfaceBytes = []byte("(interface {})") - commaNewlineBytes = []byte(",\n") - newlineBytes = []byte("\n") - openBraceBytes = []byte("{") - openBraceNewlineBytes = []byte("{\n") - closeBraceBytes = []byte("}") - asteriskBytes = []byte("*") - colonBytes = []byte(":") - colonSpaceBytes = []byte(": ") - openParenBytes = []byte("(") - closeParenBytes = []byte(")") - spaceBytes = []byte(" ") - pointerChainBytes = []byte("->") - nilAngleBytes = []byte("") - maxNewlineBytes = []byte("\n") - maxShortBytes = []byte("") - circularBytes = []byte("") - circularShortBytes = []byte("") - invalidAngleBytes = []byte("") - openBracketBytes = []byte("[") - closeBracketBytes = []byte("]") - percentBytes = []byte("%") - precisionBytes = []byte(".") - openAngleBytes = []byte("<") - closeAngleBytes = []byte(">") - openMapBytes = []byte("map[") - closeMapBytes = []byte("]") - lenEqualsBytes = []byte("len=") - capEqualsBytes = []byte("cap=") -) - -// hexDigits is used to map a decimal value to a hex digit. -var hexDigits = "0123456789abcdef" - -// catchPanic handles any panics that might occur during the handleMethods -// calls. -func catchPanic(w io.Writer, v reflect.Value) { - if err := recover(); err != nil { - w.Write(panicBytes) - fmt.Fprintf(w, "%v", err) - w.Write(closeParenBytes) - } -} - -// handleMethods attempts to call the Error and String methods on the underlying -// type the passed reflect.Value represents and outputes the result to Writer w. -// -// It handles panics in any called methods by catching and displaying the error -// as the formatted value. -func handleMethods(cs *ConfigState, w io.Writer, v reflect.Value) (handled bool) { - // We need an interface to check if the type implements the error or - // Stringer interface. However, the reflect package won't give us an - // interface on certain things like unexported struct fields in order - // to enforce visibility rules. We use unsafe, when it's available, - // to bypass these restrictions since this package does not mutate the - // values. - if !v.CanInterface() { - if UnsafeDisabled { - return false - } - - v = unsafeReflectValue(v) - } - - // Choose whether or not to do error and Stringer interface lookups against - // the base type or a pointer to the base type depending on settings. - // Technically calling one of these methods with a pointer receiver can - // mutate the value, however, types which choose to satisify an error or - // Stringer interface with a pointer receiver should not be mutating their - // state inside these interface methods. - if !cs.DisablePointerMethods && !UnsafeDisabled && !v.CanAddr() { - v = unsafeReflectValue(v) - } - if v.CanAddr() { - v = v.Addr() - } - - // Is it an error or Stringer? - switch iface := v.Interface().(type) { - case error: - defer catchPanic(w, v) - if cs.ContinueOnMethod { - w.Write(openParenBytes) - w.Write([]byte(iface.Error())) - w.Write(closeParenBytes) - w.Write(spaceBytes) - return false - } - - w.Write([]byte(iface.Error())) - return true - - case fmt.Stringer: - defer catchPanic(w, v) - if cs.ContinueOnMethod { - w.Write(openParenBytes) - w.Write([]byte(iface.String())) - w.Write(closeParenBytes) - w.Write(spaceBytes) - return false - } - w.Write([]byte(iface.String())) - return true - } - return false -} - -// printBool outputs a boolean value as true or false to Writer w. -func printBool(w io.Writer, val bool) { - if val { - w.Write(trueBytes) - } else { - w.Write(falseBytes) - } -} - -// printInt outputs a signed integer value to Writer w. -func printInt(w io.Writer, val int64, base int) { - w.Write([]byte(strconv.FormatInt(val, base))) -} - -// printUint outputs an unsigned integer value to Writer w. -func printUint(w io.Writer, val uint64, base int) { - w.Write([]byte(strconv.FormatUint(val, base))) -} - -// printFloat outputs a floating point value using the specified precision, -// which is expected to be 32 or 64bit, to Writer w. -func printFloat(w io.Writer, val float64, precision int) { - w.Write([]byte(strconv.FormatFloat(val, 'g', -1, precision))) -} - -// printComplex outputs a complex value using the specified float precision -// for the real and imaginary parts to Writer w. -func printComplex(w io.Writer, c complex128, floatPrecision int) { - r := real(c) - w.Write(openParenBytes) - w.Write([]byte(strconv.FormatFloat(r, 'g', -1, floatPrecision))) - i := imag(c) - if i >= 0 { - w.Write(plusBytes) - } - w.Write([]byte(strconv.FormatFloat(i, 'g', -1, floatPrecision))) - w.Write(iBytes) - w.Write(closeParenBytes) -} - -// printHexPtr outputs a uintptr formatted as hexadecimal with a leading '0x' -// prefix to Writer w. -func printHexPtr(w io.Writer, p uintptr) { - // Null pointer. - num := uint64(p) - if num == 0 { - w.Write(nilAngleBytes) - return - } - - // Max uint64 is 16 bytes in hex + 2 bytes for '0x' prefix - buf := make([]byte, 18) - - // It's simpler to construct the hex string right to left. - base := uint64(16) - i := len(buf) - 1 - for num >= base { - buf[i] = hexDigits[num%base] - num /= base - i-- - } - buf[i] = hexDigits[num] - - // Add '0x' prefix. - i-- - buf[i] = 'x' - i-- - buf[i] = '0' - - // Strip unused leading bytes. - buf = buf[i:] - w.Write(buf) -} - -// valuesSorter implements sort.Interface to allow a slice of reflect.Value -// elements to be sorted. -type valuesSorter struct { - values []reflect.Value - strings []string // either nil or same len and values - cs *ConfigState -} - -// newValuesSorter initializes a valuesSorter instance, which holds a set of -// surrogate keys on which the data should be sorted. It uses flags in -// ConfigState to decide if and how to populate those surrogate keys. -func newValuesSorter(values []reflect.Value, cs *ConfigState) sort.Interface { - vs := &valuesSorter{values: values, cs: cs} - if canSortSimply(vs.values[0].Kind()) { - return vs - } - if !cs.DisableMethods { - vs.strings = make([]string, len(values)) - for i := range vs.values { - b := bytes.Buffer{} - if !handleMethods(cs, &b, vs.values[i]) { - vs.strings = nil - break - } - vs.strings[i] = b.String() - } - } - if vs.strings == nil && cs.SpewKeys { - vs.strings = make([]string, len(values)) - for i := range vs.values { - vs.strings[i] = Sprintf("%#v", vs.values[i].Interface()) - } - } - return vs -} - -// canSortSimply tests whether a reflect.Kind is a primitive that can be sorted -// directly, or whether it should be considered for sorting by surrogate keys -// (if the ConfigState allows it). -func canSortSimply(kind reflect.Kind) bool { - // This switch parallels valueSortLess, except for the default case. - switch kind { - case reflect.Bool: - return true - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - return true - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: - return true - case reflect.Float32, reflect.Float64: - return true - case reflect.String: - return true - case reflect.Uintptr: - return true - case reflect.Array: - return true - } - return false -} - -// Len returns the number of values in the slice. It is part of the -// sort.Interface implementation. -func (s *valuesSorter) Len() int { - return len(s.values) -} - -// Swap swaps the values at the passed indices. It is part of the -// sort.Interface implementation. -func (s *valuesSorter) Swap(i, j int) { - s.values[i], s.values[j] = s.values[j], s.values[i] - if s.strings != nil { - s.strings[i], s.strings[j] = s.strings[j], s.strings[i] - } -} - -// valueSortLess returns whether the first value should sort before the second -// value. It is used by valueSorter.Less as part of the sort.Interface -// implementation. -func valueSortLess(a, b reflect.Value) bool { - switch a.Kind() { - case reflect.Bool: - return !a.Bool() && b.Bool() - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - return a.Int() < b.Int() - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: - return a.Uint() < b.Uint() - case reflect.Float32, reflect.Float64: - return a.Float() < b.Float() - case reflect.String: - return a.String() < b.String() - case reflect.Uintptr: - return a.Uint() < b.Uint() - case reflect.Array: - // Compare the contents of both arrays. - l := a.Len() - for i := 0; i < l; i++ { - av := a.Index(i) - bv := b.Index(i) - if av.Interface() == bv.Interface() { - continue - } - return valueSortLess(av, bv) - } - } - return a.String() < b.String() -} - -// Less returns whether the value at index i should sort before the -// value at index j. It is part of the sort.Interface implementation. -func (s *valuesSorter) Less(i, j int) bool { - if s.strings == nil { - return valueSortLess(s.values[i], s.values[j]) - } - return s.strings[i] < s.strings[j] -} - -// sortValues is a sort function that handles both native types and any type that -// can be converted to error or Stringer. Other inputs are sorted according to -// their Value.String() value to ensure display stability. -func sortValues(values []reflect.Value, cs *ConfigState) { - if len(values) == 0 { - return - } - sort.Sort(newValuesSorter(values, cs)) -} diff --git a/vendor/github.com/davecgh/go-spew/spew/config.go b/vendor/github.com/davecgh/go-spew/spew/config.go deleted file mode 100644 index 2e3d22f31..000000000 --- a/vendor/github.com/davecgh/go-spew/spew/config.go +++ /dev/null @@ -1,306 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "bytes" - "fmt" - "io" - "os" -) - -// ConfigState houses the configuration options used by spew to format and -// display values. There is a global instance, Config, that is used to control -// all top-level Formatter and Dump functionality. Each ConfigState instance -// provides methods equivalent to the top-level functions. -// -// The zero value for ConfigState provides no indentation. You would typically -// want to set it to a space or a tab. -// -// Alternatively, you can use NewDefaultConfig to get a ConfigState instance -// with default settings. See the documentation of NewDefaultConfig for default -// values. -type ConfigState struct { - // Indent specifies the string to use for each indentation level. The - // global config instance that all top-level functions use set this to a - // single space by default. If you would like more indentation, you might - // set this to a tab with "\t" or perhaps two spaces with " ". - Indent string - - // MaxDepth controls the maximum number of levels to descend into nested - // data structures. The default, 0, means there is no limit. - // - // NOTE: Circular data structures are properly detected, so it is not - // necessary to set this value unless you specifically want to limit deeply - // nested data structures. - MaxDepth int - - // DisableMethods specifies whether or not error and Stringer interfaces are - // invoked for types that implement them. - DisableMethods bool - - // DisablePointerMethods specifies whether or not to check for and invoke - // error and Stringer interfaces on types which only accept a pointer - // receiver when the current type is not a pointer. - // - // NOTE: This might be an unsafe action since calling one of these methods - // with a pointer receiver could technically mutate the value, however, - // in practice, types which choose to satisify an error or Stringer - // interface with a pointer receiver should not be mutating their state - // inside these interface methods. As a result, this option relies on - // access to the unsafe package, so it will not have any effect when - // running in environments without access to the unsafe package such as - // Google App Engine or with the "safe" build tag specified. - DisablePointerMethods bool - - // DisablePointerAddresses specifies whether to disable the printing of - // pointer addresses. This is useful when diffing data structures in tests. - DisablePointerAddresses bool - - // DisableCapacities specifies whether to disable the printing of capacities - // for arrays, slices, maps and channels. This is useful when diffing - // data structures in tests. - DisableCapacities bool - - // ContinueOnMethod specifies whether or not recursion should continue once - // a custom error or Stringer interface is invoked. The default, false, - // means it will print the results of invoking the custom error or Stringer - // interface and return immediately instead of continuing to recurse into - // the internals of the data type. - // - // NOTE: This flag does not have any effect if method invocation is disabled - // via the DisableMethods or DisablePointerMethods options. - ContinueOnMethod bool - - // SortKeys specifies map keys should be sorted before being printed. Use - // this to have a more deterministic, diffable output. Note that only - // native types (bool, int, uint, floats, uintptr and string) and types - // that support the error or Stringer interfaces (if methods are - // enabled) are supported, with other types sorted according to the - // reflect.Value.String() output which guarantees display stability. - SortKeys bool - - // SpewKeys specifies that, as a last resort attempt, map keys should - // be spewed to strings and sorted by those strings. This is only - // considered if SortKeys is true. - SpewKeys bool -} - -// Config is the active configuration of the top-level functions. -// The configuration can be changed by modifying the contents of spew.Config. -var Config = ConfigState{Indent: " "} - -// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the formatted string as a value that satisfies error. See NewFormatter -// for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Errorf(format, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Errorf(format string, a ...interface{}) (err error) { - return fmt.Errorf(format, c.convertArgs(a)...) -} - -// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprint(w, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Fprint(w io.Writer, a ...interface{}) (n int, err error) { - return fmt.Fprint(w, c.convertArgs(a)...) -} - -// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprintf(w, format, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) { - return fmt.Fprintf(w, format, c.convertArgs(a)...) -} - -// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it -// passed with a Formatter interface returned by c.NewFormatter. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprintln(w, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Fprintln(w io.Writer, a ...interface{}) (n int, err error) { - return fmt.Fprintln(w, c.convertArgs(a)...) -} - -// Print is a wrapper for fmt.Print that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Print(c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Print(a ...interface{}) (n int, err error) { - return fmt.Print(c.convertArgs(a)...) -} - -// Printf is a wrapper for fmt.Printf that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Printf(format, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Printf(format string, a ...interface{}) (n int, err error) { - return fmt.Printf(format, c.convertArgs(a)...) -} - -// Println is a wrapper for fmt.Println that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Println(c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Println(a ...interface{}) (n int, err error) { - return fmt.Println(c.convertArgs(a)...) -} - -// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprint(c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Sprint(a ...interface{}) string { - return fmt.Sprint(c.convertArgs(a)...) -} - -// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprintf(format, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Sprintf(format string, a ...interface{}) string { - return fmt.Sprintf(format, c.convertArgs(a)...) -} - -// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it -// were passed with a Formatter interface returned by c.NewFormatter. It -// returns the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprintln(c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Sprintln(a ...interface{}) string { - return fmt.Sprintln(c.convertArgs(a)...) -} - -/* -NewFormatter returns a custom formatter that satisfies the fmt.Formatter -interface. As a result, it integrates cleanly with standard fmt package -printing functions. The formatter is useful for inline printing of smaller data -types similar to the standard %v format specifier. - -The custom formatter only responds to the %v (most compact), %+v (adds pointer -addresses), %#v (adds types), and %#+v (adds types and pointer addresses) verb -combinations. Any other verbs such as %x and %q will be sent to the the -standard fmt package for formatting. In addition, the custom formatter ignores -the width and precision arguments (however they will still work on the format -specifiers not handled by the custom formatter). - -Typically this function shouldn't be called directly. It is much easier to make -use of the custom formatter by calling one of the convenience functions such as -c.Printf, c.Println, or c.Printf. -*/ -func (c *ConfigState) NewFormatter(v interface{}) fmt.Formatter { - return newFormatter(c, v) -} - -// Fdump formats and displays the passed arguments to io.Writer w. It formats -// exactly the same as Dump. -func (c *ConfigState) Fdump(w io.Writer, a ...interface{}) { - fdump(c, w, a...) -} - -/* -Dump displays the passed parameters to standard out with newlines, customizable -indentation, and additional debug information such as complete types and all -pointer addresses used to indirect to the final value. It provides the -following features over the built-in printing facilities provided by the fmt -package: - - * Pointers are dereferenced and followed - * Circular data structures are detected and handled properly - * Custom Stringer/error interfaces are optionally invoked, including - on unexported types - * Custom types which only implement the Stringer/error interfaces via - a pointer receiver are optionally invoked when passing non-pointer - variables - * Byte arrays and slices are dumped like the hexdump -C command which - includes offsets, byte values in hex, and ASCII output - -The configuration options are controlled by modifying the public members -of c. See ConfigState for options documentation. - -See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to -get the formatted result as a string. -*/ -func (c *ConfigState) Dump(a ...interface{}) { - fdump(c, os.Stdout, a...) -} - -// Sdump returns a string with the passed arguments formatted exactly the same -// as Dump. -func (c *ConfigState) Sdump(a ...interface{}) string { - var buf bytes.Buffer - fdump(c, &buf, a...) - return buf.String() -} - -// convertArgs accepts a slice of arguments and returns a slice of the same -// length with each argument converted to a spew Formatter interface using -// the ConfigState associated with s. -func (c *ConfigState) convertArgs(args []interface{}) (formatters []interface{}) { - formatters = make([]interface{}, len(args)) - for index, arg := range args { - formatters[index] = newFormatter(c, arg) - } - return formatters -} - -// NewDefaultConfig returns a ConfigState with the following default settings. -// -// Indent: " " -// MaxDepth: 0 -// DisableMethods: false -// DisablePointerMethods: false -// ContinueOnMethod: false -// SortKeys: false -func NewDefaultConfig() *ConfigState { - return &ConfigState{Indent: " "} -} diff --git a/vendor/github.com/davecgh/go-spew/spew/doc.go b/vendor/github.com/davecgh/go-spew/spew/doc.go deleted file mode 100644 index aacaac6f1..000000000 --- a/vendor/github.com/davecgh/go-spew/spew/doc.go +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* -Package spew implements a deep pretty printer for Go data structures to aid in -debugging. - -A quick overview of the additional features spew provides over the built-in -printing facilities for Go data types are as follows: - - * Pointers are dereferenced and followed - * Circular data structures are detected and handled properly - * Custom Stringer/error interfaces are optionally invoked, including - on unexported types - * Custom types which only implement the Stringer/error interfaces via - a pointer receiver are optionally invoked when passing non-pointer - variables - * Byte arrays and slices are dumped like the hexdump -C command which - includes offsets, byte values in hex, and ASCII output (only when using - Dump style) - -There are two different approaches spew allows for dumping Go data structures: - - * Dump style which prints with newlines, customizable indentation, - and additional debug information such as types and all pointer addresses - used to indirect to the final value - * A custom Formatter interface that integrates cleanly with the standard fmt - package and replaces %v, %+v, %#v, and %#+v to provide inline printing - similar to the default %v while providing the additional functionality - outlined above and passing unsupported format verbs such as %x and %q - along to fmt - -Quick Start - -This section demonstrates how to quickly get started with spew. See the -sections below for further details on formatting and configuration options. - -To dump a variable with full newlines, indentation, type, and pointer -information use Dump, Fdump, or Sdump: - spew.Dump(myVar1, myVar2, ...) - spew.Fdump(someWriter, myVar1, myVar2, ...) - str := spew.Sdump(myVar1, myVar2, ...) - -Alternatively, if you would prefer to use format strings with a compacted inline -printing style, use the convenience wrappers Printf, Fprintf, etc with -%v (most compact), %+v (adds pointer addresses), %#v (adds types), or -%#+v (adds types and pointer addresses): - spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2) - spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) - spew.Fprintf(someWriter, "myVar1: %v -- myVar2: %+v", myVar1, myVar2) - spew.Fprintf(someWriter, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) - -Configuration Options - -Configuration of spew is handled by fields in the ConfigState type. For -convenience, all of the top-level functions use a global state available -via the spew.Config global. - -It is also possible to create a ConfigState instance that provides methods -equivalent to the top-level functions. This allows concurrent configuration -options. See the ConfigState documentation for more details. - -The following configuration options are available: - * Indent - String to use for each indentation level for Dump functions. - It is a single space by default. A popular alternative is "\t". - - * MaxDepth - Maximum number of levels to descend into nested data structures. - There is no limit by default. - - * DisableMethods - Disables invocation of error and Stringer interface methods. - Method invocation is enabled by default. - - * DisablePointerMethods - Disables invocation of error and Stringer interface methods on types - which only accept pointer receivers from non-pointer variables. - Pointer method invocation is enabled by default. - - * DisablePointerAddresses - DisablePointerAddresses specifies whether to disable the printing of - pointer addresses. This is useful when diffing data structures in tests. - - * DisableCapacities - DisableCapacities specifies whether to disable the printing of - capacities for arrays, slices, maps and channels. This is useful when - diffing data structures in tests. - - * ContinueOnMethod - Enables recursion into types after invoking error and Stringer interface - methods. Recursion after method invocation is disabled by default. - - * SortKeys - Specifies map keys should be sorted before being printed. Use - this to have a more deterministic, diffable output. Note that - only native types (bool, int, uint, floats, uintptr and string) - and types which implement error or Stringer interfaces are - supported with other types sorted according to the - reflect.Value.String() output which guarantees display - stability. Natural map order is used by default. - - * SpewKeys - Specifies that, as a last resort attempt, map keys should be - spewed to strings and sorted by those strings. This is only - considered if SortKeys is true. - -Dump Usage - -Simply call spew.Dump with a list of variables you want to dump: - - spew.Dump(myVar1, myVar2, ...) - -You may also call spew.Fdump if you would prefer to output to an arbitrary -io.Writer. For example, to dump to standard error: - - spew.Fdump(os.Stderr, myVar1, myVar2, ...) - -A third option is to call spew.Sdump to get the formatted output as a string: - - str := spew.Sdump(myVar1, myVar2, ...) - -Sample Dump Output - -See the Dump example for details on the setup of the types and variables being -shown here. - - (main.Foo) { - unexportedField: (*main.Bar)(0xf84002e210)({ - flag: (main.Flag) flagTwo, - data: (uintptr) - }), - ExportedField: (map[interface {}]interface {}) (len=1) { - (string) (len=3) "one": (bool) true - } - } - -Byte (and uint8) arrays and slices are displayed uniquely like the hexdump -C -command as shown. - ([]uint8) (len=32 cap=32) { - 00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 |............... | - 00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 |!"#$%&'()*+,-./0| - 00000020 31 32 |12| - } - -Custom Formatter - -Spew provides a custom formatter that implements the fmt.Formatter interface -so that it integrates cleanly with standard fmt package printing functions. The -formatter is useful for inline printing of smaller data types similar to the -standard %v format specifier. - -The custom formatter only responds to the %v (most compact), %+v (adds pointer -addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb -combinations. Any other verbs such as %x and %q will be sent to the the -standard fmt package for formatting. In addition, the custom formatter ignores -the width and precision arguments (however they will still work on the format -specifiers not handled by the custom formatter). - -Custom Formatter Usage - -The simplest way to make use of the spew custom formatter is to call one of the -convenience functions such as spew.Printf, spew.Println, or spew.Printf. The -functions have syntax you are most likely already familiar with: - - spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2) - spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) - spew.Println(myVar, myVar2) - spew.Fprintf(os.Stderr, "myVar1: %v -- myVar2: %+v", myVar1, myVar2) - spew.Fprintf(os.Stderr, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) - -See the Index for the full list convenience functions. - -Sample Formatter Output - -Double pointer to a uint8: - %v: <**>5 - %+v: <**>(0xf8400420d0->0xf8400420c8)5 - %#v: (**uint8)5 - %#+v: (**uint8)(0xf8400420d0->0xf8400420c8)5 - -Pointer to circular struct with a uint8 field and a pointer to itself: - %v: <*>{1 <*>} - %+v: <*>(0xf84003e260){ui8:1 c:<*>(0xf84003e260)} - %#v: (*main.circular){ui8:(uint8)1 c:(*main.circular)} - %#+v: (*main.circular)(0xf84003e260){ui8:(uint8)1 c:(*main.circular)(0xf84003e260)} - -See the Printf example for details on the setup of variables being shown -here. - -Errors - -Since it is possible for custom Stringer/error interfaces to panic, spew -detects them and handles them internally by printing the panic information -inline with the output. Since spew is intended to provide deep pretty printing -capabilities on structures, it intentionally does not return any errors. -*/ -package spew diff --git a/vendor/github.com/davecgh/go-spew/spew/dump.go b/vendor/github.com/davecgh/go-spew/spew/dump.go deleted file mode 100644 index f78d89fc1..000000000 --- a/vendor/github.com/davecgh/go-spew/spew/dump.go +++ /dev/null @@ -1,509 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "bytes" - "encoding/hex" - "fmt" - "io" - "os" - "reflect" - "regexp" - "strconv" - "strings" -) - -var ( - // uint8Type is a reflect.Type representing a uint8. It is used to - // convert cgo types to uint8 slices for hexdumping. - uint8Type = reflect.TypeOf(uint8(0)) - - // cCharRE is a regular expression that matches a cgo char. - // It is used to detect character arrays to hexdump them. - cCharRE = regexp.MustCompile(`^.*\._Ctype_char$`) - - // cUnsignedCharRE is a regular expression that matches a cgo unsigned - // char. It is used to detect unsigned character arrays to hexdump - // them. - cUnsignedCharRE = regexp.MustCompile(`^.*\._Ctype_unsignedchar$`) - - // cUint8tCharRE is a regular expression that matches a cgo uint8_t. - // It is used to detect uint8_t arrays to hexdump them. - cUint8tCharRE = regexp.MustCompile(`^.*\._Ctype_uint8_t$`) -) - -// dumpState contains information about the state of a dump operation. -type dumpState struct { - w io.Writer - depth int - pointers map[uintptr]int - ignoreNextType bool - ignoreNextIndent bool - cs *ConfigState -} - -// indent performs indentation according to the depth level and cs.Indent -// option. -func (d *dumpState) indent() { - if d.ignoreNextIndent { - d.ignoreNextIndent = false - return - } - d.w.Write(bytes.Repeat([]byte(d.cs.Indent), d.depth)) -} - -// unpackValue returns values inside of non-nil interfaces when possible. -// This is useful for data types like structs, arrays, slices, and maps which -// can contain varying types packed inside an interface. -func (d *dumpState) unpackValue(v reflect.Value) reflect.Value { - if v.Kind() == reflect.Interface && !v.IsNil() { - v = v.Elem() - } - return v -} - -// dumpPtr handles formatting of pointers by indirecting them as necessary. -func (d *dumpState) dumpPtr(v reflect.Value) { - // Remove pointers at or below the current depth from map used to detect - // circular refs. - for k, depth := range d.pointers { - if depth >= d.depth { - delete(d.pointers, k) - } - } - - // Keep list of all dereferenced pointers to show later. - pointerChain := make([]uintptr, 0) - - // Figure out how many levels of indirection there are by dereferencing - // pointers and unpacking interfaces down the chain while detecting circular - // references. - nilFound := false - cycleFound := false - indirects := 0 - ve := v - for ve.Kind() == reflect.Ptr { - if ve.IsNil() { - nilFound = true - break - } - indirects++ - addr := ve.Pointer() - pointerChain = append(pointerChain, addr) - if pd, ok := d.pointers[addr]; ok && pd < d.depth { - cycleFound = true - indirects-- - break - } - d.pointers[addr] = d.depth - - ve = ve.Elem() - if ve.Kind() == reflect.Interface { - if ve.IsNil() { - nilFound = true - break - } - ve = ve.Elem() - } - } - - // Display type information. - d.w.Write(openParenBytes) - d.w.Write(bytes.Repeat(asteriskBytes, indirects)) - d.w.Write([]byte(ve.Type().String())) - d.w.Write(closeParenBytes) - - // Display pointer information. - if !d.cs.DisablePointerAddresses && len(pointerChain) > 0 { - d.w.Write(openParenBytes) - for i, addr := range pointerChain { - if i > 0 { - d.w.Write(pointerChainBytes) - } - printHexPtr(d.w, addr) - } - d.w.Write(closeParenBytes) - } - - // Display dereferenced value. - d.w.Write(openParenBytes) - switch { - case nilFound: - d.w.Write(nilAngleBytes) - - case cycleFound: - d.w.Write(circularBytes) - - default: - d.ignoreNextType = true - d.dump(ve) - } - d.w.Write(closeParenBytes) -} - -// dumpSlice handles formatting of arrays and slices. Byte (uint8 under -// reflection) arrays and slices are dumped in hexdump -C fashion. -func (d *dumpState) dumpSlice(v reflect.Value) { - // Determine whether this type should be hex dumped or not. Also, - // for types which should be hexdumped, try to use the underlying data - // first, then fall back to trying to convert them to a uint8 slice. - var buf []uint8 - doConvert := false - doHexDump := false - numEntries := v.Len() - if numEntries > 0 { - vt := v.Index(0).Type() - vts := vt.String() - switch { - // C types that need to be converted. - case cCharRE.MatchString(vts): - fallthrough - case cUnsignedCharRE.MatchString(vts): - fallthrough - case cUint8tCharRE.MatchString(vts): - doConvert = true - - // Try to use existing uint8 slices and fall back to converting - // and copying if that fails. - case vt.Kind() == reflect.Uint8: - // We need an addressable interface to convert the type - // to a byte slice. However, the reflect package won't - // give us an interface on certain things like - // unexported struct fields in order to enforce - // visibility rules. We use unsafe, when available, to - // bypass these restrictions since this package does not - // mutate the values. - vs := v - if !vs.CanInterface() || !vs.CanAddr() { - vs = unsafeReflectValue(vs) - } - if !UnsafeDisabled { - vs = vs.Slice(0, numEntries) - - // Use the existing uint8 slice if it can be - // type asserted. - iface := vs.Interface() - if slice, ok := iface.([]uint8); ok { - buf = slice - doHexDump = true - break - } - } - - // The underlying data needs to be converted if it can't - // be type asserted to a uint8 slice. - doConvert = true - } - - // Copy and convert the underlying type if needed. - if doConvert && vt.ConvertibleTo(uint8Type) { - // Convert and copy each element into a uint8 byte - // slice. - buf = make([]uint8, numEntries) - for i := 0; i < numEntries; i++ { - vv := v.Index(i) - buf[i] = uint8(vv.Convert(uint8Type).Uint()) - } - doHexDump = true - } - } - - // Hexdump the entire slice as needed. - if doHexDump { - indent := strings.Repeat(d.cs.Indent, d.depth) - str := indent + hex.Dump(buf) - str = strings.Replace(str, "\n", "\n"+indent, -1) - str = strings.TrimRight(str, d.cs.Indent) - d.w.Write([]byte(str)) - return - } - - // Recursively call dump for each item. - for i := 0; i < numEntries; i++ { - d.dump(d.unpackValue(v.Index(i))) - if i < (numEntries - 1) { - d.w.Write(commaNewlineBytes) - } else { - d.w.Write(newlineBytes) - } - } -} - -// dump is the main workhorse for dumping a value. It uses the passed reflect -// value to figure out what kind of object we are dealing with and formats it -// appropriately. It is a recursive function, however circular data structures -// are detected and handled properly. -func (d *dumpState) dump(v reflect.Value) { - // Handle invalid reflect values immediately. - kind := v.Kind() - if kind == reflect.Invalid { - d.w.Write(invalidAngleBytes) - return - } - - // Handle pointers specially. - if kind == reflect.Ptr { - d.indent() - d.dumpPtr(v) - return - } - - // Print type information unless already handled elsewhere. - if !d.ignoreNextType { - d.indent() - d.w.Write(openParenBytes) - d.w.Write([]byte(v.Type().String())) - d.w.Write(closeParenBytes) - d.w.Write(spaceBytes) - } - d.ignoreNextType = false - - // Display length and capacity if the built-in len and cap functions - // work with the value's kind and the len/cap itself is non-zero. - valueLen, valueCap := 0, 0 - switch v.Kind() { - case reflect.Array, reflect.Slice, reflect.Chan: - valueLen, valueCap = v.Len(), v.Cap() - case reflect.Map, reflect.String: - valueLen = v.Len() - } - if valueLen != 0 || !d.cs.DisableCapacities && valueCap != 0 { - d.w.Write(openParenBytes) - if valueLen != 0 { - d.w.Write(lenEqualsBytes) - printInt(d.w, int64(valueLen), 10) - } - if !d.cs.DisableCapacities && valueCap != 0 { - if valueLen != 0 { - d.w.Write(spaceBytes) - } - d.w.Write(capEqualsBytes) - printInt(d.w, int64(valueCap), 10) - } - d.w.Write(closeParenBytes) - d.w.Write(spaceBytes) - } - - // Call Stringer/error interfaces if they exist and the handle methods flag - // is enabled - if !d.cs.DisableMethods { - if (kind != reflect.Invalid) && (kind != reflect.Interface) { - if handled := handleMethods(d.cs, d.w, v); handled { - return - } - } - } - - switch kind { - case reflect.Invalid: - // Do nothing. We should never get here since invalid has already - // been handled above. - - case reflect.Bool: - printBool(d.w, v.Bool()) - - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - printInt(d.w, v.Int(), 10) - - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: - printUint(d.w, v.Uint(), 10) - - case reflect.Float32: - printFloat(d.w, v.Float(), 32) - - case reflect.Float64: - printFloat(d.w, v.Float(), 64) - - case reflect.Complex64: - printComplex(d.w, v.Complex(), 32) - - case reflect.Complex128: - printComplex(d.w, v.Complex(), 64) - - case reflect.Slice: - if v.IsNil() { - d.w.Write(nilAngleBytes) - break - } - fallthrough - - case reflect.Array: - d.w.Write(openBraceNewlineBytes) - d.depth++ - if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { - d.indent() - d.w.Write(maxNewlineBytes) - } else { - d.dumpSlice(v) - } - d.depth-- - d.indent() - d.w.Write(closeBraceBytes) - - case reflect.String: - d.w.Write([]byte(strconv.Quote(v.String()))) - - case reflect.Interface: - // The only time we should get here is for nil interfaces due to - // unpackValue calls. - if v.IsNil() { - d.w.Write(nilAngleBytes) - } - - case reflect.Ptr: - // Do nothing. We should never get here since pointers have already - // been handled above. - - case reflect.Map: - // nil maps should be indicated as different than empty maps - if v.IsNil() { - d.w.Write(nilAngleBytes) - break - } - - d.w.Write(openBraceNewlineBytes) - d.depth++ - if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { - d.indent() - d.w.Write(maxNewlineBytes) - } else { - numEntries := v.Len() - keys := v.MapKeys() - if d.cs.SortKeys { - sortValues(keys, d.cs) - } - for i, key := range keys { - d.dump(d.unpackValue(key)) - d.w.Write(colonSpaceBytes) - d.ignoreNextIndent = true - d.dump(d.unpackValue(v.MapIndex(key))) - if i < (numEntries - 1) { - d.w.Write(commaNewlineBytes) - } else { - d.w.Write(newlineBytes) - } - } - } - d.depth-- - d.indent() - d.w.Write(closeBraceBytes) - - case reflect.Struct: - d.w.Write(openBraceNewlineBytes) - d.depth++ - if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { - d.indent() - d.w.Write(maxNewlineBytes) - } else { - vt := v.Type() - numFields := v.NumField() - for i := 0; i < numFields; i++ { - d.indent() - vtf := vt.Field(i) - d.w.Write([]byte(vtf.Name)) - d.w.Write(colonSpaceBytes) - d.ignoreNextIndent = true - d.dump(d.unpackValue(v.Field(i))) - if i < (numFields - 1) { - d.w.Write(commaNewlineBytes) - } else { - d.w.Write(newlineBytes) - } - } - } - d.depth-- - d.indent() - d.w.Write(closeBraceBytes) - - case reflect.Uintptr: - printHexPtr(d.w, uintptr(v.Uint())) - - case reflect.UnsafePointer, reflect.Chan, reflect.Func: - printHexPtr(d.w, v.Pointer()) - - // There were not any other types at the time this code was written, but - // fall back to letting the default fmt package handle it in case any new - // types are added. - default: - if v.CanInterface() { - fmt.Fprintf(d.w, "%v", v.Interface()) - } else { - fmt.Fprintf(d.w, "%v", v.String()) - } - } -} - -// fdump is a helper function to consolidate the logic from the various public -// methods which take varying writers and config states. -func fdump(cs *ConfigState, w io.Writer, a ...interface{}) { - for _, arg := range a { - if arg == nil { - w.Write(interfaceBytes) - w.Write(spaceBytes) - w.Write(nilAngleBytes) - w.Write(newlineBytes) - continue - } - - d := dumpState{w: w, cs: cs} - d.pointers = make(map[uintptr]int) - d.dump(reflect.ValueOf(arg)) - d.w.Write(newlineBytes) - } -} - -// Fdump formats and displays the passed arguments to io.Writer w. It formats -// exactly the same as Dump. -func Fdump(w io.Writer, a ...interface{}) { - fdump(&Config, w, a...) -} - -// Sdump returns a string with the passed arguments formatted exactly the same -// as Dump. -func Sdump(a ...interface{}) string { - var buf bytes.Buffer - fdump(&Config, &buf, a...) - return buf.String() -} - -/* -Dump displays the passed parameters to standard out with newlines, customizable -indentation, and additional debug information such as complete types and all -pointer addresses used to indirect to the final value. It provides the -following features over the built-in printing facilities provided by the fmt -package: - - * Pointers are dereferenced and followed - * Circular data structures are detected and handled properly - * Custom Stringer/error interfaces are optionally invoked, including - on unexported types - * Custom types which only implement the Stringer/error interfaces via - a pointer receiver are optionally invoked when passing non-pointer - variables - * Byte arrays and slices are dumped like the hexdump -C command which - includes offsets, byte values in hex, and ASCII output - -The configuration options are controlled by an exported package global, -spew.Config. See ConfigState for options documentation. - -See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to -get the formatted result as a string. -*/ -func Dump(a ...interface{}) { - fdump(&Config, os.Stdout, a...) -} diff --git a/vendor/github.com/davecgh/go-spew/spew/format.go b/vendor/github.com/davecgh/go-spew/spew/format.go deleted file mode 100644 index b04edb7d7..000000000 --- a/vendor/github.com/davecgh/go-spew/spew/format.go +++ /dev/null @@ -1,419 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "bytes" - "fmt" - "reflect" - "strconv" - "strings" -) - -// supportedFlags is a list of all the character flags supported by fmt package. -const supportedFlags = "0-+# " - -// formatState implements the fmt.Formatter interface and contains information -// about the state of a formatting operation. The NewFormatter function can -// be used to get a new Formatter which can be used directly as arguments -// in standard fmt package printing calls. -type formatState struct { - value interface{} - fs fmt.State - depth int - pointers map[uintptr]int - ignoreNextType bool - cs *ConfigState -} - -// buildDefaultFormat recreates the original format string without precision -// and width information to pass in to fmt.Sprintf in the case of an -// unrecognized type. Unless new types are added to the language, this -// function won't ever be called. -func (f *formatState) buildDefaultFormat() (format string) { - buf := bytes.NewBuffer(percentBytes) - - for _, flag := range supportedFlags { - if f.fs.Flag(int(flag)) { - buf.WriteRune(flag) - } - } - - buf.WriteRune('v') - - format = buf.String() - return format -} - -// constructOrigFormat recreates the original format string including precision -// and width information to pass along to the standard fmt package. This allows -// automatic deferral of all format strings this package doesn't support. -func (f *formatState) constructOrigFormat(verb rune) (format string) { - buf := bytes.NewBuffer(percentBytes) - - for _, flag := range supportedFlags { - if f.fs.Flag(int(flag)) { - buf.WriteRune(flag) - } - } - - if width, ok := f.fs.Width(); ok { - buf.WriteString(strconv.Itoa(width)) - } - - if precision, ok := f.fs.Precision(); ok { - buf.Write(precisionBytes) - buf.WriteString(strconv.Itoa(precision)) - } - - buf.WriteRune(verb) - - format = buf.String() - return format -} - -// unpackValue returns values inside of non-nil interfaces when possible and -// ensures that types for values which have been unpacked from an interface -// are displayed when the show types flag is also set. -// This is useful for data types like structs, arrays, slices, and maps which -// can contain varying types packed inside an interface. -func (f *formatState) unpackValue(v reflect.Value) reflect.Value { - if v.Kind() == reflect.Interface { - f.ignoreNextType = false - if !v.IsNil() { - v = v.Elem() - } - } - return v -} - -// formatPtr handles formatting of pointers by indirecting them as necessary. -func (f *formatState) formatPtr(v reflect.Value) { - // Display nil if top level pointer is nil. - showTypes := f.fs.Flag('#') - if v.IsNil() && (!showTypes || f.ignoreNextType) { - f.fs.Write(nilAngleBytes) - return - } - - // Remove pointers at or below the current depth from map used to detect - // circular refs. - for k, depth := range f.pointers { - if depth >= f.depth { - delete(f.pointers, k) - } - } - - // Keep list of all dereferenced pointers to possibly show later. - pointerChain := make([]uintptr, 0) - - // Figure out how many levels of indirection there are by derferencing - // pointers and unpacking interfaces down the chain while detecting circular - // references. - nilFound := false - cycleFound := false - indirects := 0 - ve := v - for ve.Kind() == reflect.Ptr { - if ve.IsNil() { - nilFound = true - break - } - indirects++ - addr := ve.Pointer() - pointerChain = append(pointerChain, addr) - if pd, ok := f.pointers[addr]; ok && pd < f.depth { - cycleFound = true - indirects-- - break - } - f.pointers[addr] = f.depth - - ve = ve.Elem() - if ve.Kind() == reflect.Interface { - if ve.IsNil() { - nilFound = true - break - } - ve = ve.Elem() - } - } - - // Display type or indirection level depending on flags. - if showTypes && !f.ignoreNextType { - f.fs.Write(openParenBytes) - f.fs.Write(bytes.Repeat(asteriskBytes, indirects)) - f.fs.Write([]byte(ve.Type().String())) - f.fs.Write(closeParenBytes) - } else { - if nilFound || cycleFound { - indirects += strings.Count(ve.Type().String(), "*") - } - f.fs.Write(openAngleBytes) - f.fs.Write([]byte(strings.Repeat("*", indirects))) - f.fs.Write(closeAngleBytes) - } - - // Display pointer information depending on flags. - if f.fs.Flag('+') && (len(pointerChain) > 0) { - f.fs.Write(openParenBytes) - for i, addr := range pointerChain { - if i > 0 { - f.fs.Write(pointerChainBytes) - } - printHexPtr(f.fs, addr) - } - f.fs.Write(closeParenBytes) - } - - // Display dereferenced value. - switch { - case nilFound: - f.fs.Write(nilAngleBytes) - - case cycleFound: - f.fs.Write(circularShortBytes) - - default: - f.ignoreNextType = true - f.format(ve) - } -} - -// format is the main workhorse for providing the Formatter interface. It -// uses the passed reflect value to figure out what kind of object we are -// dealing with and formats it appropriately. It is a recursive function, -// however circular data structures are detected and handled properly. -func (f *formatState) format(v reflect.Value) { - // Handle invalid reflect values immediately. - kind := v.Kind() - if kind == reflect.Invalid { - f.fs.Write(invalidAngleBytes) - return - } - - // Handle pointers specially. - if kind == reflect.Ptr { - f.formatPtr(v) - return - } - - // Print type information unless already handled elsewhere. - if !f.ignoreNextType && f.fs.Flag('#') { - f.fs.Write(openParenBytes) - f.fs.Write([]byte(v.Type().String())) - f.fs.Write(closeParenBytes) - } - f.ignoreNextType = false - - // Call Stringer/error interfaces if they exist and the handle methods - // flag is enabled. - if !f.cs.DisableMethods { - if (kind != reflect.Invalid) && (kind != reflect.Interface) { - if handled := handleMethods(f.cs, f.fs, v); handled { - return - } - } - } - - switch kind { - case reflect.Invalid: - // Do nothing. We should never get here since invalid has already - // been handled above. - - case reflect.Bool: - printBool(f.fs, v.Bool()) - - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - printInt(f.fs, v.Int(), 10) - - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: - printUint(f.fs, v.Uint(), 10) - - case reflect.Float32: - printFloat(f.fs, v.Float(), 32) - - case reflect.Float64: - printFloat(f.fs, v.Float(), 64) - - case reflect.Complex64: - printComplex(f.fs, v.Complex(), 32) - - case reflect.Complex128: - printComplex(f.fs, v.Complex(), 64) - - case reflect.Slice: - if v.IsNil() { - f.fs.Write(nilAngleBytes) - break - } - fallthrough - - case reflect.Array: - f.fs.Write(openBracketBytes) - f.depth++ - if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { - f.fs.Write(maxShortBytes) - } else { - numEntries := v.Len() - for i := 0; i < numEntries; i++ { - if i > 0 { - f.fs.Write(spaceBytes) - } - f.ignoreNextType = true - f.format(f.unpackValue(v.Index(i))) - } - } - f.depth-- - f.fs.Write(closeBracketBytes) - - case reflect.String: - f.fs.Write([]byte(v.String())) - - case reflect.Interface: - // The only time we should get here is for nil interfaces due to - // unpackValue calls. - if v.IsNil() { - f.fs.Write(nilAngleBytes) - } - - case reflect.Ptr: - // Do nothing. We should never get here since pointers have already - // been handled above. - - case reflect.Map: - // nil maps should be indicated as different than empty maps - if v.IsNil() { - f.fs.Write(nilAngleBytes) - break - } - - f.fs.Write(openMapBytes) - f.depth++ - if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { - f.fs.Write(maxShortBytes) - } else { - keys := v.MapKeys() - if f.cs.SortKeys { - sortValues(keys, f.cs) - } - for i, key := range keys { - if i > 0 { - f.fs.Write(spaceBytes) - } - f.ignoreNextType = true - f.format(f.unpackValue(key)) - f.fs.Write(colonBytes) - f.ignoreNextType = true - f.format(f.unpackValue(v.MapIndex(key))) - } - } - f.depth-- - f.fs.Write(closeMapBytes) - - case reflect.Struct: - numFields := v.NumField() - f.fs.Write(openBraceBytes) - f.depth++ - if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { - f.fs.Write(maxShortBytes) - } else { - vt := v.Type() - for i := 0; i < numFields; i++ { - if i > 0 { - f.fs.Write(spaceBytes) - } - vtf := vt.Field(i) - if f.fs.Flag('+') || f.fs.Flag('#') { - f.fs.Write([]byte(vtf.Name)) - f.fs.Write(colonBytes) - } - f.format(f.unpackValue(v.Field(i))) - } - } - f.depth-- - f.fs.Write(closeBraceBytes) - - case reflect.Uintptr: - printHexPtr(f.fs, uintptr(v.Uint())) - - case reflect.UnsafePointer, reflect.Chan, reflect.Func: - printHexPtr(f.fs, v.Pointer()) - - // There were not any other types at the time this code was written, but - // fall back to letting the default fmt package handle it if any get added. - default: - format := f.buildDefaultFormat() - if v.CanInterface() { - fmt.Fprintf(f.fs, format, v.Interface()) - } else { - fmt.Fprintf(f.fs, format, v.String()) - } - } -} - -// Format satisfies the fmt.Formatter interface. See NewFormatter for usage -// details. -func (f *formatState) Format(fs fmt.State, verb rune) { - f.fs = fs - - // Use standard formatting for verbs that are not v. - if verb != 'v' { - format := f.constructOrigFormat(verb) - fmt.Fprintf(fs, format, f.value) - return - } - - if f.value == nil { - if fs.Flag('#') { - fs.Write(interfaceBytes) - } - fs.Write(nilAngleBytes) - return - } - - f.format(reflect.ValueOf(f.value)) -} - -// newFormatter is a helper function to consolidate the logic from the various -// public methods which take varying config states. -func newFormatter(cs *ConfigState, v interface{}) fmt.Formatter { - fs := &formatState{value: v, cs: cs} - fs.pointers = make(map[uintptr]int) - return fs -} - -/* -NewFormatter returns a custom formatter that satisfies the fmt.Formatter -interface. As a result, it integrates cleanly with standard fmt package -printing functions. The formatter is useful for inline printing of smaller data -types similar to the standard %v format specifier. - -The custom formatter only responds to the %v (most compact), %+v (adds pointer -addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb -combinations. Any other verbs such as %x and %q will be sent to the the -standard fmt package for formatting. In addition, the custom formatter ignores -the width and precision arguments (however they will still work on the format -specifiers not handled by the custom formatter). - -Typically this function shouldn't be called directly. It is much easier to make -use of the custom formatter by calling one of the convenience functions such as -Printf, Println, or Fprintf. -*/ -func NewFormatter(v interface{}) fmt.Formatter { - return newFormatter(&Config, v) -} diff --git a/vendor/github.com/davecgh/go-spew/spew/spew.go b/vendor/github.com/davecgh/go-spew/spew/spew.go deleted file mode 100644 index 32c0e3388..000000000 --- a/vendor/github.com/davecgh/go-spew/spew/spew.go +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "fmt" - "io" -) - -// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the formatted string as a value that satisfies error. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Errorf(format, spew.NewFormatter(a), spew.NewFormatter(b)) -func Errorf(format string, a ...interface{}) (err error) { - return fmt.Errorf(format, convertArgs(a)...) -} - -// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprint(w, spew.NewFormatter(a), spew.NewFormatter(b)) -func Fprint(w io.Writer, a ...interface{}) (n int, err error) { - return fmt.Fprint(w, convertArgs(a)...) -} - -// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprintf(w, format, spew.NewFormatter(a), spew.NewFormatter(b)) -func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) { - return fmt.Fprintf(w, format, convertArgs(a)...) -} - -// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it -// passed with a default Formatter interface returned by NewFormatter. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprintln(w, spew.NewFormatter(a), spew.NewFormatter(b)) -func Fprintln(w io.Writer, a ...interface{}) (n int, err error) { - return fmt.Fprintln(w, convertArgs(a)...) -} - -// Print is a wrapper for fmt.Print that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Print(spew.NewFormatter(a), spew.NewFormatter(b)) -func Print(a ...interface{}) (n int, err error) { - return fmt.Print(convertArgs(a)...) -} - -// Printf is a wrapper for fmt.Printf that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Printf(format, spew.NewFormatter(a), spew.NewFormatter(b)) -func Printf(format string, a ...interface{}) (n int, err error) { - return fmt.Printf(format, convertArgs(a)...) -} - -// Println is a wrapper for fmt.Println that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Println(spew.NewFormatter(a), spew.NewFormatter(b)) -func Println(a ...interface{}) (n int, err error) { - return fmt.Println(convertArgs(a)...) -} - -// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprint(spew.NewFormatter(a), spew.NewFormatter(b)) -func Sprint(a ...interface{}) string { - return fmt.Sprint(convertArgs(a)...) -} - -// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprintf(format, spew.NewFormatter(a), spew.NewFormatter(b)) -func Sprintf(format string, a ...interface{}) string { - return fmt.Sprintf(format, convertArgs(a)...) -} - -// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it -// were passed with a default Formatter interface returned by NewFormatter. It -// returns the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprintln(spew.NewFormatter(a), spew.NewFormatter(b)) -func Sprintln(a ...interface{}) string { - return fmt.Sprintln(convertArgs(a)...) -} - -// convertArgs accepts a slice of arguments and returns a slice of the same -// length with each argument converted to a default spew Formatter interface. -func convertArgs(args []interface{}) (formatters []interface{}) { - formatters = make([]interface{}, len(args)) - for index, arg := range args { - formatters[index] = NewFormatter(arg) - } - return formatters -} diff --git a/vendor/github.com/emicklei/go-restful/v3/.gitignore b/vendor/github.com/emicklei/go-restful/v3/.gitignore deleted file mode 100644 index 446be09b4..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/.gitignore +++ /dev/null @@ -1,71 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe - -restful.html - -*.out - -tmp.prof - -go-restful.test - -examples/restful-basic-authentication - -examples/restful-encoding-filter - -examples/restful-filters - -examples/restful-hello-world - -examples/restful-resource-functions - -examples/restful-serve-static - -examples/restful-user-service - -*.DS_Store -examples/restful-user-resource - -examples/restful-multi-containers - -examples/restful-form-handling - -examples/restful-CORS-filter - -examples/restful-options-filter - -examples/restful-curly-router - -examples/restful-cpuprofiler-service - -examples/restful-pre-post-filters - -curly.prof - -examples/restful-NCSA-logging - -examples/restful-html-template - -s.html -restful-path-tail -.idea diff --git a/vendor/github.com/emicklei/go-restful/v3/.goconvey b/vendor/github.com/emicklei/go-restful/v3/.goconvey deleted file mode 100644 index 8485e986e..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/.goconvey +++ /dev/null @@ -1 +0,0 @@ -ignore \ No newline at end of file diff --git a/vendor/github.com/emicklei/go-restful/v3/.travis.yml b/vendor/github.com/emicklei/go-restful/v3/.travis.yml deleted file mode 100644 index 3a0bf5ff1..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: go - -go: - - 1.x - -before_install: - - go test -v - -script: - - go test -race -coverprofile=coverage.txt -covermode=atomic - -after_success: - - bash <(curl -s https://codecov.io/bash) \ No newline at end of file diff --git a/vendor/github.com/emicklei/go-restful/v3/CHANGES.md b/vendor/github.com/emicklei/go-restful/v3/CHANGES.md deleted file mode 100644 index 5edd5a7ca..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/CHANGES.md +++ /dev/null @@ -1,396 +0,0 @@ -# Change history of go-restful - -## [v3.11.0] - 2023-08-19 - -- restored behavior as <= v3.9.0 with option to change path strategy using TrimRightSlashEnabled. - -## [v3.10.2] - 2023-03-09 - DO NOT USE - -- introduced MergePathStrategy to be able to revert behaviour of path concatenation to 3.9.0 - see comment in Readme how to customize this behaviour. - -## [v3.10.1] - 2022-11-19 - DO NOT USE - -- fix broken 3.10.0 by using path package for joining paths - -## [v3.10.0] - 2022-10-11 - BROKEN - -- changed tokenizer to match std route match behavior; do not trimright the path (#511) -- Add MIME_ZIP (#512) -- Add MIME_ZIP and HEADER_ContentDisposition (#513) -- Changed how to get query parameter issue #510 - -## [v3.9.0] - 2022-07-21 - -- add support for http.Handler implementations to work as FilterFunction, issue #504 (thanks to https://github.com/ggicci) - -## [v3.8.0] - 2022-06-06 - -- use exact matching of allowed domain entries, issue #489 (#493) - - this changes fixes [security] Authorization Bypass Through User-Controlled Key - by changing the behaviour of the AllowedDomains setting in the CORS filter. - To support the previous behaviour, the CORS filter type now has a AllowedDomainFunc - callback mechanism which is called when a simple domain match fails. -- add test and fix for POST without body and Content-type, issue #492 (#496) -- [Minor] Bad practice to have a mix of Receiver types. (#491) - -## [v3.7.2] - 2021-11-24 - -- restored FilterChain (#482 by SVilgelm) - - -## [v3.7.1] - 2021-10-04 - -- fix problem with contentEncodingEnabled setting (#479) - -## [v3.7.0] - 2021-09-24 - -- feat(parameter): adds additional openapi mappings (#478) - -## [v3.6.0] - 2021-09-18 - -- add support for vendor extensions (#477 thx erraggy) - -## [v3.5.2] - 2021-07-14 - -- fix removing absent route from webservice (#472) - -## [v3.5.1] - 2021-04-12 - -- fix handling no match access selected path -- remove obsolete field - -## [v3.5.0] - 2021-04-10 - -- add check for wildcard (#463) in CORS -- add access to Route from Request, issue #459 (#462) - -## [v3.4.0] - 2020-11-10 - -- Added OPTIONS to WebService - -## [v3.3.2] - 2020-01-23 - -- Fixed duplicate compression in dispatch. #449 - - -## [v3.3.1] - 2020-08-31 - -- Added check on writer to prevent compression of response twice. #447 - -## [v3.3.0] - 2020-08-19 - -- Enable content encoding on Handle and ServeHTTP (#446) -- List available representations in 406 body (#437) -- Convert to string using rune() (#443) - -## [v3.2.0] - 2020-06-21 - -- 405 Method Not Allowed must have Allow header (#436) (thx Bracken ) -- add field allowedMethodsWithoutContentType (#424) - -## [v3.1.0] - -- support describing response headers (#426) -- fix openapi examples (#425) - -v3.0.0 - -- fix: use request/response resulting from filter chain -- add Go module - Module consumer should use github.com/emicklei/go-restful/v3 as import path - -v2.10.0 - -- support for Custom Verbs (thanks Vinci Xu <277040271@qq.com>) -- fixed static example (thanks Arthur ) -- simplify code (thanks Christian Muehlhaeuser ) -- added JWT HMAC with SHA-512 authentication code example (thanks Amim Knabben ) - -v2.9.6 - -- small optimization in filter code - -v2.11.1 - -- fix WriteError return value (#415) - -v2.11.0 - -- allow prefix and suffix in path variable expression (#414) - -v2.9.6 - -- support google custome verb (#413) - -v2.9.5 - -- fix panic in Response.WriteError if err == nil - -v2.9.4 - -- fix issue #400 , parsing mime type quality -- Route Builder added option for contentEncodingEnabled (#398) - -v2.9.3 - -- Avoid return of 415 Unsupported Media Type when request body is empty (#396) - -v2.9.2 - -- Reduce allocations in per-request methods to improve performance (#395) - -v2.9.1 - -- Fix issue with default responses and invalid status code 0. (#393) - -v2.9.0 - -- add per Route content encoding setting (overrides container setting) - -v2.8.0 - -- add Request.QueryParameters() -- add json-iterator (via build tag) -- disable vgo module (until log is moved) - -v2.7.1 - -- add vgo module - -v2.6.1 - -- add JSONNewDecoderFunc to allow custom JSON Decoder usage (go 1.10+) - -v2.6.0 - -- Make JSR 311 routing and path param processing consistent -- Adding description to RouteBuilder.Reads() -- Update example for Swagger12 and OpenAPI - -2017-09-13 - -- added route condition functions using `.If(func)` in route building. - -2017-02-16 - -- solved issue #304, make operation names unique - -2017-01-30 - - [IMPORTANT] For swagger users, change your import statement to: - swagger "github.com/emicklei/go-restful-swagger12" - -- moved swagger 1.2 code to go-restful-swagger12 -- created TAG 2.0.0 - -2017-01-27 - -- remove defer request body close -- expose Dispatch for testing filters and Routefunctions -- swagger response model cannot be array -- created TAG 1.0.0 - -2016-12-22 - -- (API change) Remove code related to caching request content. Removes SetCacheReadEntity(doCache bool) - -2016-11-26 - -- Default change! now use CurlyRouter (was RouterJSR311) -- Default change! no more caching of request content -- Default change! do not recover from panics - -2016-09-22 - -- fix the DefaultRequestContentType feature - -2016-02-14 - -- take the qualify factor of the Accept header mediatype into account when deciding the contentype of the response -- add constructors for custom entity accessors for xml and json - -2015-09-27 - -- rename new WriteStatusAnd... to WriteHeaderAnd... for consistency - -2015-09-25 - -- fixed problem with changing Header after WriteHeader (issue 235) - -2015-09-14 - -- changed behavior of WriteHeader (immediate write) and WriteEntity (no status write) -- added support for custom EntityReaderWriters. - -2015-08-06 - -- add support for reading entities from compressed request content -- use sync.Pool for compressors of http response and request body -- add Description to Parameter for documentation in Swagger UI - -2015-03-20 - -- add configurable logging - -2015-03-18 - -- if not specified, the Operation is derived from the Route function - -2015-03-17 - -- expose Parameter creation functions -- make trace logger an interface -- fix OPTIONSFilter -- customize rendering of ServiceError -- JSR311 router now handles wildcards -- add Notes to Route - -2014-11-27 - -- (api add) PrettyPrint per response. (as proposed in #167) - -2014-11-12 - -- (api add) ApiVersion(.) for documentation in Swagger UI - -2014-11-10 - -- (api change) struct fields tagged with "description" show up in Swagger UI - -2014-10-31 - -- (api change) ReturnsError -> Returns -- (api add) RouteBuilder.Do(aBuilder) for DRY use of RouteBuilder -- fix swagger nested structs -- sort Swagger response messages by code - -2014-10-23 - -- (api add) ReturnsError allows you to document Http codes in swagger -- fixed problem with greedy CurlyRouter -- (api add) Access-Control-Max-Age in CORS -- add tracing functionality (injectable) for debugging purposes -- support JSON parse 64bit int -- fix empty parameters for swagger -- WebServicesUrl is now optional for swagger -- fixed duplicate AccessControlAllowOrigin in CORS -- (api change) expose ServeMux in container -- (api add) added AllowedDomains in CORS -- (api add) ParameterNamed for detailed documentation - -2014-04-16 - -- (api add) expose constructor of Request for testing. - -2014-06-27 - -- (api add) ParameterNamed gives access to a Parameter definition and its data (for further specification). -- (api add) SetCacheReadEntity allow scontrol over whether or not the request body is being cached (default true for compatibility reasons). - -2014-07-03 - -- (api add) CORS can be configured with a list of allowed domains - -2014-03-12 - -- (api add) Route path parameters can use wildcard or regular expressions. (requires CurlyRouter) - -2014-02-26 - -- (api add) Request now provides information about the matched Route, see method SelectedRoutePath - -2014-02-17 - -- (api change) renamed parameter constants (go-lint checks) - -2014-01-10 - -- (api add) support for CloseNotify, see http://golang.org/pkg/net/http/#CloseNotifier - -2014-01-07 - -- (api change) Write* methods in Response now return the error or nil. -- added example of serving HTML from a Go template. -- fixed comparing Allowed headers in CORS (is now case-insensitive) - -2013-11-13 - -- (api add) Response knows how many bytes are written to the response body. - -2013-10-29 - -- (api add) RecoverHandler(handler RecoverHandleFunction) to change how panic recovery is handled. Default behavior is to log and return a stacktrace. This may be a security issue as it exposes sourcecode information. - -2013-10-04 - -- (api add) Response knows what HTTP status has been written -- (api add) Request can have attributes (map of string->interface, also called request-scoped variables - -2013-09-12 - -- (api change) Router interface simplified -- Implemented CurlyRouter, a Router that does not use|allow regular expressions in paths - -2013-08-05 - - add OPTIONS support - - add CORS support - -2013-08-27 - -- fixed some reported issues (see github) -- (api change) deprecated use of WriteError; use WriteErrorString instead - -2014-04-15 - -- (fix) v1.0.1 tag: fix Issue 111: WriteErrorString - -2013-08-08 - -- (api add) Added implementation Container: a WebServices collection with its own http.ServeMux allowing multiple endpoints per program. Existing uses of go-restful will register their services to the DefaultContainer. -- (api add) the swagger package has be extended to have a UI per container. -- if panic is detected then a small stack trace is printed (thanks to runner-mei) -- (api add) WriteErrorString to Response - -Important API changes: - -- (api remove) package variable DoNotRecover no longer works ; use restful.DefaultContainer.DoNotRecover(true) instead. -- (api remove) package variable EnableContentEncoding no longer works ; use restful.DefaultContainer.EnableContentEncoding(true) instead. - - -2013-07-06 - -- (api add) Added support for response encoding (gzip and deflate(zlib)). This feature is disabled on default (for backwards compatibility). Use restful.EnableContentEncoding = true in your initialization to enable this feature. - -2013-06-19 - -- (improve) DoNotRecover option, moved request body closer, improved ReadEntity - -2013-06-03 - -- (api change) removed Dispatcher interface, hide PathExpression -- changed receiver names of type functions to be more idiomatic Go - -2013-06-02 - -- (optimize) Cache the RegExp compilation of Paths. - -2013-05-22 - -- (api add) Added support for request/response filter functions - -2013-05-18 - - -- (api add) Added feature to change the default Http Request Dispatch function (travis cline) -- (api change) Moved Swagger Webservice to swagger package (see example restful-user) - -[2012-11-14 .. 2013-05-18> - -- See https://github.com/emicklei/go-restful/commits - -2012-11-14 - -- Initial commit - - diff --git a/vendor/github.com/emicklei/go-restful/v3/LICENSE b/vendor/github.com/emicklei/go-restful/v3/LICENSE deleted file mode 100644 index ece7ec61e..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2012,2013 Ernest Micklei - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/emicklei/go-restful/v3/Makefile b/vendor/github.com/emicklei/go-restful/v3/Makefile deleted file mode 100644 index 16d0b80bb..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -all: test - -test: - go vet . - go test -cover -v . - -ex: - find ./examples -type f -name "*.go" | xargs -I {} go build -o /tmp/ignore {} \ No newline at end of file diff --git a/vendor/github.com/emicklei/go-restful/v3/README.md b/vendor/github.com/emicklei/go-restful/v3/README.md deleted file mode 100644 index 95a05a089..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/README.md +++ /dev/null @@ -1,111 +0,0 @@ -go-restful -========== -package for building REST-style Web Services using Google Go - -[![Build Status](https://travis-ci.org/emicklei/go-restful.png)](https://travis-ci.org/emicklei/go-restful) -[![Go Report Card](https://goreportcard.com/badge/github.com/emicklei/go-restful)](https://goreportcard.com/report/github.com/emicklei/go-restful) -[![GoDoc](https://godoc.org/github.com/emicklei/go-restful?status.svg)](https://pkg.go.dev/github.com/emicklei/go-restful) -[![codecov](https://codecov.io/gh/emicklei/go-restful/branch/master/graph/badge.svg)](https://codecov.io/gh/emicklei/go-restful) - -- [Code examples use v3](https://github.com/emicklei/go-restful/tree/v3/examples) - -REST asks developers to use HTTP methods explicitly and in a way that's consistent with the protocol definition. This basic REST design principle establishes a one-to-one mapping between create, read, update, and delete (CRUD) operations and HTTP methods. According to this mapping: - -- GET = Retrieve a representation of a resource -- POST = Create if you are sending content to the server to create a subordinate of the specified resource collection, using some server-side algorithm. -- PUT = Create if you are sending the full content of the specified resource (URI). -- PUT = Update if you are updating the full content of the specified resource. -- DELETE = Delete if you are requesting the server to delete the resource -- PATCH = Update partial content of a resource -- OPTIONS = Get information about the communication options for the request URI - -### Usage - -#### Without Go Modules - -All versions up to `v2.*.*` (on the master) are not supporting Go modules. - -``` -import ( - restful "github.com/emicklei/go-restful" -) -``` - -#### Using Go Modules - -As of version `v3.0.0` (on the v3 branch), this package supports Go modules. - -``` -import ( - restful "github.com/emicklei/go-restful/v3" -) -``` - -### Example - -```Go -ws := new(restful.WebService) -ws. - Path("/users"). - Consumes(restful.MIME_XML, restful.MIME_JSON). - Produces(restful.MIME_JSON, restful.MIME_XML) - -ws.Route(ws.GET("/{user-id}").To(u.findUser). - Doc("get a user"). - Param(ws.PathParameter("user-id", "identifier of the user").DataType("string")). - Writes(User{})) -... - -func (u UserResource) findUser(request *restful.Request, response *restful.Response) { - id := request.PathParameter("user-id") - ... -} -``` - -[Full API of a UserResource](https://github.com/emicklei/go-restful/blob/v3/examples/user-resource/restful-user-resource.go) - -### Features - -- Routes for request → function mapping with path parameter (e.g. {id} but also prefix_{var} and {var}_suffix) support -- Configurable router: - - (default) Fast routing algorithm that allows static elements, [google custom method](https://cloud.google.com/apis/design/custom_methods), regular expressions and dynamic parameters in the URL path (e.g. /resource/name:customVerb, /meetings/{id} or /static/{subpath:*}) - - Routing algorithm after [JSR311](http://jsr311.java.net/nonav/releases/1.1/spec/spec.html) that is implemented using (but does **not** accept) regular expressions -- Request API for reading structs from JSON/XML and accessing parameters (path,query,header) -- Response API for writing structs to JSON/XML and setting headers -- Customizable encoding using EntityReaderWriter registration -- Filters for intercepting the request → response flow on Service or Route level -- Request-scoped variables using attributes -- Containers for WebServices on different HTTP endpoints -- Content encoding (gzip,deflate) of request and response payloads -- Automatic responses on OPTIONS (using a filter) -- Automatic CORS request handling (using a filter) -- API declaration for Swagger UI ([go-restful-openapi](https://github.com/emicklei/go-restful-openapi)) -- Panic recovery to produce HTTP 500, customizable using RecoverHandler(...) -- Route errors produce HTTP 404/405/406/415 errors, customizable using ServiceErrorHandler(...) -- Configurable (trace) logging -- Customizable gzip/deflate readers and writers using CompressorProvider registration -- Inject your own http.Handler using the `HttpMiddlewareHandlerToFilter` function - -## How to customize -There are several hooks to customize the behavior of the go-restful package. - -- Router algorithm -- Panic recovery -- JSON decoder -- Trace logging -- Compression -- Encoders for other serializers -- Use the package variable `TrimRightSlashEnabled` (default true) to control the behavior of matching routes that end with a slash `/` - -## Resources - -- [Example programs](./examples) -- [Example posted on blog](http://ernestmicklei.com/2012/11/go-restful-first-working-example/) -- [Design explained on blog](http://ernestmicklei.com/2012/11/go-restful-api-design/) -- [sourcegraph](https://sourcegraph.com/github.com/emicklei/go-restful) -- [showcase: Zazkia - tcp proxy for testing resiliency](https://github.com/emicklei/zazkia) -- [showcase: Mora - MongoDB REST Api server](https://github.com/emicklei/mora) - -Type ```git shortlog -s``` for a full list of contributors. - -© 2012 - 2023, http://ernestmicklei.com. MIT License. Contributions are welcome. diff --git a/vendor/github.com/emicklei/go-restful/v3/SECURITY.md b/vendor/github.com/emicklei/go-restful/v3/SECURITY.md deleted file mode 100644 index 810d3b510..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/SECURITY.md +++ /dev/null @@ -1,13 +0,0 @@ -# Security Policy - -## Supported Versions - -| Version | Supported | -| ------- | ------------------ | -| v3.7.x | :white_check_mark: | -| < v3.0.1 | :x: | - -## Reporting a Vulnerability - -Create an Issue and put the label `[security]` in the title of the issue. -Valid reported security issues are expected to be solved within a week. diff --git a/vendor/github.com/emicklei/go-restful/v3/Srcfile b/vendor/github.com/emicklei/go-restful/v3/Srcfile deleted file mode 100644 index 16fd18689..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/Srcfile +++ /dev/null @@ -1 +0,0 @@ -{"SkipDirs": ["examples"]} diff --git a/vendor/github.com/emicklei/go-restful/v3/bench_test.sh b/vendor/github.com/emicklei/go-restful/v3/bench_test.sh deleted file mode 100644 index 47ffbe4ac..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/bench_test.sh +++ /dev/null @@ -1,10 +0,0 @@ -#go test -run=none -file bench_test.go -test.bench . -cpuprofile=bench_test.out - -go test -c -./go-restful.test -test.run=none -test.cpuprofile=tmp.prof -test.bench=BenchmarkMany -./go-restful.test -test.run=none -test.cpuprofile=curly.prof -test.bench=BenchmarkManyCurly - -#go tool pprof go-restful.test tmp.prof -go tool pprof go-restful.test curly.prof - - diff --git a/vendor/github.com/emicklei/go-restful/v3/compress.go b/vendor/github.com/emicklei/go-restful/v3/compress.go deleted file mode 100644 index 1ff239f99..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/compress.go +++ /dev/null @@ -1,127 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "bufio" - "compress/gzip" - "compress/zlib" - "errors" - "io" - "net" - "net/http" - "strings" -) - -// OBSOLETE : use restful.DefaultContainer.EnableContentEncoding(true) to change this setting. -var EnableContentEncoding = false - -// CompressingResponseWriter is a http.ResponseWriter that can perform content encoding (gzip and zlib) -type CompressingResponseWriter struct { - writer http.ResponseWriter - compressor io.WriteCloser - encoding string -} - -// Header is part of http.ResponseWriter interface -func (c *CompressingResponseWriter) Header() http.Header { - return c.writer.Header() -} - -// WriteHeader is part of http.ResponseWriter interface -func (c *CompressingResponseWriter) WriteHeader(status int) { - c.writer.WriteHeader(status) -} - -// Write is part of http.ResponseWriter interface -// It is passed through the compressor -func (c *CompressingResponseWriter) Write(bytes []byte) (int, error) { - if c.isCompressorClosed() { - return -1, errors.New("Compressing error: tried to write data using closed compressor") - } - return c.compressor.Write(bytes) -} - -// CloseNotify is part of http.CloseNotifier interface -func (c *CompressingResponseWriter) CloseNotify() <-chan bool { - return c.writer.(http.CloseNotifier).CloseNotify() -} - -// Close the underlying compressor -func (c *CompressingResponseWriter) Close() error { - if c.isCompressorClosed() { - return errors.New("Compressing error: tried to close already closed compressor") - } - - c.compressor.Close() - if ENCODING_GZIP == c.encoding { - currentCompressorProvider.ReleaseGzipWriter(c.compressor.(*gzip.Writer)) - } - if ENCODING_DEFLATE == c.encoding { - currentCompressorProvider.ReleaseZlibWriter(c.compressor.(*zlib.Writer)) - } - // gc hint needed? - c.compressor = nil - return nil -} - -func (c *CompressingResponseWriter) isCompressorClosed() bool { - return nil == c.compressor -} - -// Hijack implements the Hijacker interface -// This is especially useful when combining Container.EnabledContentEncoding -// in combination with websockets (for instance gorilla/websocket) -func (c *CompressingResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) { - hijacker, ok := c.writer.(http.Hijacker) - if !ok { - return nil, nil, errors.New("ResponseWriter doesn't support Hijacker interface") - } - return hijacker.Hijack() -} - -// WantsCompressedResponse reads the Accept-Encoding header to see if and which encoding is requested. -// It also inspects the httpWriter whether its content-encoding is already set (non-empty). -func wantsCompressedResponse(httpRequest *http.Request, httpWriter http.ResponseWriter) (bool, string) { - if contentEncoding := httpWriter.Header().Get(HEADER_ContentEncoding); contentEncoding != "" { - return false, "" - } - header := httpRequest.Header.Get(HEADER_AcceptEncoding) - gi := strings.Index(header, ENCODING_GZIP) - zi := strings.Index(header, ENCODING_DEFLATE) - // use in order of appearance - if gi == -1 { - return zi != -1, ENCODING_DEFLATE - } else if zi == -1 { - return gi != -1, ENCODING_GZIP - } else { - if gi < zi { - return true, ENCODING_GZIP - } - return true, ENCODING_DEFLATE - } -} - -// NewCompressingResponseWriter create a CompressingResponseWriter for a known encoding = {gzip,deflate} -func NewCompressingResponseWriter(httpWriter http.ResponseWriter, encoding string) (*CompressingResponseWriter, error) { - httpWriter.Header().Set(HEADER_ContentEncoding, encoding) - c := new(CompressingResponseWriter) - c.writer = httpWriter - var err error - if ENCODING_GZIP == encoding { - w := currentCompressorProvider.AcquireGzipWriter() - w.Reset(httpWriter) - c.compressor = w - c.encoding = ENCODING_GZIP - } else if ENCODING_DEFLATE == encoding { - w := currentCompressorProvider.AcquireZlibWriter() - w.Reset(httpWriter) - c.compressor = w - c.encoding = ENCODING_DEFLATE - } else { - return nil, errors.New("Unknown encoding:" + encoding) - } - return c, err -} diff --git a/vendor/github.com/emicklei/go-restful/v3/compressor_cache.go b/vendor/github.com/emicklei/go-restful/v3/compressor_cache.go deleted file mode 100644 index ee426010a..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/compressor_cache.go +++ /dev/null @@ -1,103 +0,0 @@ -package restful - -// Copyright 2015 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "compress/gzip" - "compress/zlib" -) - -// BoundedCachedCompressors is a CompressorProvider that uses a cache with a fixed amount -// of writers and readers (resources). -// If a new resource is acquired and all are in use, it will return a new unmanaged resource. -type BoundedCachedCompressors struct { - gzipWriters chan *gzip.Writer - gzipReaders chan *gzip.Reader - zlibWriters chan *zlib.Writer - writersCapacity int - readersCapacity int -} - -// NewBoundedCachedCompressors returns a new, with filled cache, BoundedCachedCompressors. -func NewBoundedCachedCompressors(writersCapacity, readersCapacity int) *BoundedCachedCompressors { - b := &BoundedCachedCompressors{ - gzipWriters: make(chan *gzip.Writer, writersCapacity), - gzipReaders: make(chan *gzip.Reader, readersCapacity), - zlibWriters: make(chan *zlib.Writer, writersCapacity), - writersCapacity: writersCapacity, - readersCapacity: readersCapacity, - } - for ix := 0; ix < writersCapacity; ix++ { - b.gzipWriters <- newGzipWriter() - b.zlibWriters <- newZlibWriter() - } - for ix := 0; ix < readersCapacity; ix++ { - b.gzipReaders <- newGzipReader() - } - return b -} - -// AcquireGzipWriter returns an resettable *gzip.Writer. Needs to be released. -func (b *BoundedCachedCompressors) AcquireGzipWriter() *gzip.Writer { - var writer *gzip.Writer - select { - case writer, _ = <-b.gzipWriters: - default: - // return a new unmanaged one - writer = newGzipWriter() - } - return writer -} - -// ReleaseGzipWriter accepts a writer (does not have to be one that was cached) -// only when the cache has room for it. It will ignore it otherwise. -func (b *BoundedCachedCompressors) ReleaseGzipWriter(w *gzip.Writer) { - // forget the unmanaged ones - if len(b.gzipWriters) < b.writersCapacity { - b.gzipWriters <- w - } -} - -// AcquireGzipReader returns a *gzip.Reader. Needs to be released. -func (b *BoundedCachedCompressors) AcquireGzipReader() *gzip.Reader { - var reader *gzip.Reader - select { - case reader, _ = <-b.gzipReaders: - default: - // return a new unmanaged one - reader = newGzipReader() - } - return reader -} - -// ReleaseGzipReader accepts a reader (does not have to be one that was cached) -// only when the cache has room for it. It will ignore it otherwise. -func (b *BoundedCachedCompressors) ReleaseGzipReader(r *gzip.Reader) { - // forget the unmanaged ones - if len(b.gzipReaders) < b.readersCapacity { - b.gzipReaders <- r - } -} - -// AcquireZlibWriter returns an resettable *zlib.Writer. Needs to be released. -func (b *BoundedCachedCompressors) AcquireZlibWriter() *zlib.Writer { - var writer *zlib.Writer - select { - case writer, _ = <-b.zlibWriters: - default: - // return a new unmanaged one - writer = newZlibWriter() - } - return writer -} - -// ReleaseZlibWriter accepts a writer (does not have to be one that was cached) -// only when the cache has room for it. It will ignore it otherwise. -func (b *BoundedCachedCompressors) ReleaseZlibWriter(w *zlib.Writer) { - // forget the unmanaged ones - if len(b.zlibWriters) < b.writersCapacity { - b.zlibWriters <- w - } -} diff --git a/vendor/github.com/emicklei/go-restful/v3/compressor_pools.go b/vendor/github.com/emicklei/go-restful/v3/compressor_pools.go deleted file mode 100644 index d866ce64b..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/compressor_pools.go +++ /dev/null @@ -1,91 +0,0 @@ -package restful - -// Copyright 2015 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "bytes" - "compress/gzip" - "compress/zlib" - "sync" -) - -// SyncPoolCompessors is a CompressorProvider that use the standard sync.Pool. -type SyncPoolCompessors struct { - GzipWriterPool *sync.Pool - GzipReaderPool *sync.Pool - ZlibWriterPool *sync.Pool -} - -// NewSyncPoolCompessors returns a new ("empty") SyncPoolCompessors. -func NewSyncPoolCompessors() *SyncPoolCompessors { - return &SyncPoolCompessors{ - GzipWriterPool: &sync.Pool{ - New: func() interface{} { return newGzipWriter() }, - }, - GzipReaderPool: &sync.Pool{ - New: func() interface{} { return newGzipReader() }, - }, - ZlibWriterPool: &sync.Pool{ - New: func() interface{} { return newZlibWriter() }, - }, - } -} - -func (s *SyncPoolCompessors) AcquireGzipWriter() *gzip.Writer { - return s.GzipWriterPool.Get().(*gzip.Writer) -} - -func (s *SyncPoolCompessors) ReleaseGzipWriter(w *gzip.Writer) { - s.GzipWriterPool.Put(w) -} - -func (s *SyncPoolCompessors) AcquireGzipReader() *gzip.Reader { - return s.GzipReaderPool.Get().(*gzip.Reader) -} - -func (s *SyncPoolCompessors) ReleaseGzipReader(r *gzip.Reader) { - s.GzipReaderPool.Put(r) -} - -func (s *SyncPoolCompessors) AcquireZlibWriter() *zlib.Writer { - return s.ZlibWriterPool.Get().(*zlib.Writer) -} - -func (s *SyncPoolCompessors) ReleaseZlibWriter(w *zlib.Writer) { - s.ZlibWriterPool.Put(w) -} - -func newGzipWriter() *gzip.Writer { - // create with an empty bytes writer; it will be replaced before using the gzipWriter - writer, err := gzip.NewWriterLevel(new(bytes.Buffer), gzip.BestSpeed) - if err != nil { - panic(err.Error()) - } - return writer -} - -func newGzipReader() *gzip.Reader { - // create with an empty reader (but with GZIP header); it will be replaced before using the gzipReader - // we can safely use currentCompressProvider because it is set on package initialization. - w := currentCompressorProvider.AcquireGzipWriter() - defer currentCompressorProvider.ReleaseGzipWriter(w) - b := new(bytes.Buffer) - w.Reset(b) - w.Flush() - w.Close() - reader, err := gzip.NewReader(bytes.NewReader(b.Bytes())) - if err != nil { - panic(err.Error()) - } - return reader -} - -func newZlibWriter() *zlib.Writer { - writer, err := zlib.NewWriterLevel(new(bytes.Buffer), gzip.BestSpeed) - if err != nil { - panic(err.Error()) - } - return writer -} diff --git a/vendor/github.com/emicklei/go-restful/v3/compressors.go b/vendor/github.com/emicklei/go-restful/v3/compressors.go deleted file mode 100644 index 9db4a8c8e..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/compressors.go +++ /dev/null @@ -1,54 +0,0 @@ -package restful - -// Copyright 2015 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "compress/gzip" - "compress/zlib" -) - -// CompressorProvider describes a component that can provider compressors for the std methods. -type CompressorProvider interface { - // Returns a *gzip.Writer which needs to be released later. - // Before using it, call Reset(). - AcquireGzipWriter() *gzip.Writer - - // Releases an acquired *gzip.Writer. - ReleaseGzipWriter(w *gzip.Writer) - - // Returns a *gzip.Reader which needs to be released later. - AcquireGzipReader() *gzip.Reader - - // Releases an acquired *gzip.Reader. - ReleaseGzipReader(w *gzip.Reader) - - // Returns a *zlib.Writer which needs to be released later. - // Before using it, call Reset(). - AcquireZlibWriter() *zlib.Writer - - // Releases an acquired *zlib.Writer. - ReleaseZlibWriter(w *zlib.Writer) -} - -// DefaultCompressorProvider is the actual provider of compressors (zlib or gzip). -var currentCompressorProvider CompressorProvider - -func init() { - currentCompressorProvider = NewSyncPoolCompessors() -} - -// CurrentCompressorProvider returns the current CompressorProvider. -// It is initialized using a SyncPoolCompessors. -func CurrentCompressorProvider() CompressorProvider { - return currentCompressorProvider -} - -// SetCompressorProvider sets the actual provider of compressors (zlib or gzip). -func SetCompressorProvider(p CompressorProvider) { - if p == nil { - panic("cannot set compressor provider to nil") - } - currentCompressorProvider = p -} diff --git a/vendor/github.com/emicklei/go-restful/v3/constants.go b/vendor/github.com/emicklei/go-restful/v3/constants.go deleted file mode 100644 index 2328bde6c..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/constants.go +++ /dev/null @@ -1,32 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -const ( - MIME_XML = "application/xml" // Accept or Content-Type used in Consumes() and/or Produces() - MIME_JSON = "application/json" // Accept or Content-Type used in Consumes() and/or Produces() - MIME_ZIP = "application/zip" // Accept or Content-Type used in Consumes() and/or Produces() - MIME_OCTET = "application/octet-stream" // If Content-Type is not present in request, use the default - - HEADER_Allow = "Allow" - HEADER_Accept = "Accept" - HEADER_Origin = "Origin" - HEADER_ContentType = "Content-Type" - HEADER_ContentDisposition = "Content-Disposition" - HEADER_LastModified = "Last-Modified" - HEADER_AcceptEncoding = "Accept-Encoding" - HEADER_ContentEncoding = "Content-Encoding" - HEADER_AccessControlExposeHeaders = "Access-Control-Expose-Headers" - HEADER_AccessControlRequestMethod = "Access-Control-Request-Method" - HEADER_AccessControlRequestHeaders = "Access-Control-Request-Headers" - HEADER_AccessControlAllowMethods = "Access-Control-Allow-Methods" - HEADER_AccessControlAllowOrigin = "Access-Control-Allow-Origin" - HEADER_AccessControlAllowCredentials = "Access-Control-Allow-Credentials" - HEADER_AccessControlAllowHeaders = "Access-Control-Allow-Headers" - HEADER_AccessControlMaxAge = "Access-Control-Max-Age" - - ENCODING_GZIP = "gzip" - ENCODING_DEFLATE = "deflate" -) diff --git a/vendor/github.com/emicklei/go-restful/v3/container.go b/vendor/github.com/emicklei/go-restful/v3/container.go deleted file mode 100644 index dd56246dd..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/container.go +++ /dev/null @@ -1,450 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "bytes" - "errors" - "fmt" - "net/http" - "os" - "runtime" - "strings" - "sync" - - "github.com/emicklei/go-restful/v3/log" -) - -// Container holds a collection of WebServices and a http.ServeMux to dispatch http requests. -// The requests are further dispatched to routes of WebServices using a RouteSelector -type Container struct { - webServicesLock sync.RWMutex - webServices []*WebService - ServeMux *http.ServeMux - isRegisteredOnRoot bool - containerFilters []FilterFunction - doNotRecover bool // default is true - recoverHandleFunc RecoverHandleFunction - serviceErrorHandleFunc ServiceErrorHandleFunction - router RouteSelector // default is a CurlyRouter (RouterJSR311 is a slower alternative) - contentEncodingEnabled bool // default is false -} - -// NewContainer creates a new Container using a new ServeMux and default router (CurlyRouter) -func NewContainer() *Container { - return &Container{ - webServices: []*WebService{}, - ServeMux: http.NewServeMux(), - isRegisteredOnRoot: false, - containerFilters: []FilterFunction{}, - doNotRecover: true, - recoverHandleFunc: logStackOnRecover, - serviceErrorHandleFunc: writeServiceError, - router: CurlyRouter{}, - contentEncodingEnabled: false} -} - -// RecoverHandleFunction declares functions that can be used to handle a panic situation. -// The first argument is what recover() returns. The second must be used to communicate an error response. -type RecoverHandleFunction func(interface{}, http.ResponseWriter) - -// RecoverHandler changes the default function (logStackOnRecover) to be called -// when a panic is detected. DoNotRecover must be have its default value (=false). -func (c *Container) RecoverHandler(handler RecoverHandleFunction) { - c.recoverHandleFunc = handler -} - -// ServiceErrorHandleFunction declares functions that can be used to handle a service error situation. -// The first argument is the service error, the second is the request that resulted in the error and -// the third must be used to communicate an error response. -type ServiceErrorHandleFunction func(ServiceError, *Request, *Response) - -// ServiceErrorHandler changes the default function (writeServiceError) to be called -// when a ServiceError is detected. -func (c *Container) ServiceErrorHandler(handler ServiceErrorHandleFunction) { - c.serviceErrorHandleFunc = handler -} - -// DoNotRecover controls whether panics will be caught to return HTTP 500. -// If set to true, Route functions are responsible for handling any error situation. -// Default value is true. -func (c *Container) DoNotRecover(doNot bool) { - c.doNotRecover = doNot -} - -// Router changes the default Router (currently CurlyRouter) -func (c *Container) Router(aRouter RouteSelector) { - c.router = aRouter -} - -// EnableContentEncoding (default=false) allows for GZIP or DEFLATE encoding of responses. -func (c *Container) EnableContentEncoding(enabled bool) { - c.contentEncodingEnabled = enabled -} - -// Add a WebService to the Container. It will detect duplicate root paths and exit in that case. -func (c *Container) Add(service *WebService) *Container { - c.webServicesLock.Lock() - defer c.webServicesLock.Unlock() - - // if rootPath was not set then lazy initialize it - if len(service.rootPath) == 0 { - service.Path("/") - } - - // cannot have duplicate root paths - for _, each := range c.webServices { - if each.RootPath() == service.RootPath() { - log.Printf("WebService with duplicate root path detected:['%v']", each) - os.Exit(1) - } - } - - // If not registered on root then add specific mapping - if !c.isRegisteredOnRoot { - c.isRegisteredOnRoot = c.addHandler(service, c.ServeMux) - } - c.webServices = append(c.webServices, service) - return c -} - -// addHandler may set a new HandleFunc for the serveMux -// this function must run inside the critical region protected by the webServicesLock. -// returns true if the function was registered on root ("/") -func (c *Container) addHandler(service *WebService, serveMux *http.ServeMux) bool { - pattern := fixedPrefixPath(service.RootPath()) - // check if root path registration is needed - if "/" == pattern || "" == pattern { - serveMux.HandleFunc("/", c.dispatch) - return true - } - // detect if registration already exists - alreadyMapped := false - for _, each := range c.webServices { - if each.RootPath() == service.RootPath() { - alreadyMapped = true - break - } - } - if !alreadyMapped { - serveMux.HandleFunc(pattern, c.dispatch) - if !strings.HasSuffix(pattern, "/") { - serveMux.HandleFunc(pattern+"/", c.dispatch) - } - } - return false -} - -func (c *Container) Remove(ws *WebService) error { - if c.ServeMux == http.DefaultServeMux { - errMsg := fmt.Sprintf("cannot remove a WebService from a Container using the DefaultServeMux: ['%v']", ws) - log.Print(errMsg) - return errors.New(errMsg) - } - c.webServicesLock.Lock() - defer c.webServicesLock.Unlock() - // build a new ServeMux and re-register all WebServices - newServeMux := http.NewServeMux() - newServices := []*WebService{} - newIsRegisteredOnRoot := false - for _, each := range c.webServices { - if each.rootPath != ws.rootPath { - // If not registered on root then add specific mapping - if !newIsRegisteredOnRoot { - newIsRegisteredOnRoot = c.addHandler(each, newServeMux) - } - newServices = append(newServices, each) - } - } - c.webServices, c.ServeMux, c.isRegisteredOnRoot = newServices, newServeMux, newIsRegisteredOnRoot - return nil -} - -// logStackOnRecover is the default RecoverHandleFunction and is called -// when DoNotRecover is false and the recoverHandleFunc is not set for the container. -// Default implementation logs the stacktrace and writes the stacktrace on the response. -// This may be a security issue as it exposes sourcecode information. -func logStackOnRecover(panicReason interface{}, httpWriter http.ResponseWriter) { - var buffer bytes.Buffer - buffer.WriteString(fmt.Sprintf("recover from panic situation: - %v\r\n", panicReason)) - for i := 2; ; i += 1 { - _, file, line, ok := runtime.Caller(i) - if !ok { - break - } - buffer.WriteString(fmt.Sprintf(" %s:%d\r\n", file, line)) - } - log.Print(buffer.String()) - httpWriter.WriteHeader(http.StatusInternalServerError) - httpWriter.Write(buffer.Bytes()) -} - -// writeServiceError is the default ServiceErrorHandleFunction and is called -// when a ServiceError is returned during route selection. Default implementation -// calls resp.WriteErrorString(err.Code, err.Message) -func writeServiceError(err ServiceError, req *Request, resp *Response) { - for header, values := range err.Header { - for _, value := range values { - resp.Header().Add(header, value) - } - } - resp.WriteErrorString(err.Code, err.Message) -} - -// Dispatch the incoming Http Request to a matching WebService. -func (c *Container) Dispatch(httpWriter http.ResponseWriter, httpRequest *http.Request) { - if httpWriter == nil { - panic("httpWriter cannot be nil") - } - if httpRequest == nil { - panic("httpRequest cannot be nil") - } - c.dispatch(httpWriter, httpRequest) -} - -// Dispatch the incoming Http Request to a matching WebService. -func (c *Container) dispatch(httpWriter http.ResponseWriter, httpRequest *http.Request) { - // so we can assign a compressing one later - writer := httpWriter - - // CompressingResponseWriter should be closed after all operations are done - defer func() { - if compressWriter, ok := writer.(*CompressingResponseWriter); ok { - compressWriter.Close() - } - }() - - // Instal panic recovery unless told otherwise - if !c.doNotRecover { // catch all for 500 response - defer func() { - if r := recover(); r != nil { - c.recoverHandleFunc(r, writer) - return - } - }() - } - - // Find best match Route ; err is non nil if no match was found - var webService *WebService - var route *Route - var err error - func() { - c.webServicesLock.RLock() - defer c.webServicesLock.RUnlock() - webService, route, err = c.router.SelectRoute( - c.webServices, - httpRequest) - }() - if err != nil { - // a non-200 response (may be compressed) has already been written - // run container filters anyway ; they should not touch the response... - chain := FilterChain{Filters: c.containerFilters, Target: func(req *Request, resp *Response) { - switch err.(type) { - case ServiceError: - ser := err.(ServiceError) - c.serviceErrorHandleFunc(ser, req, resp) - } - // TODO - }} - chain.ProcessFilter(NewRequest(httpRequest), NewResponse(writer)) - return - } - - // Unless httpWriter is already an CompressingResponseWriter see if we need to install one - if _, isCompressing := httpWriter.(*CompressingResponseWriter); !isCompressing { - // Detect if compression is needed - // assume without compression, test for override - contentEncodingEnabled := c.contentEncodingEnabled - if route != nil && route.contentEncodingEnabled != nil { - contentEncodingEnabled = *route.contentEncodingEnabled - } - if contentEncodingEnabled { - doCompress, encoding := wantsCompressedResponse(httpRequest, httpWriter) - if doCompress { - var err error - writer, err = NewCompressingResponseWriter(httpWriter, encoding) - if err != nil { - log.Print("unable to install compressor: ", err) - httpWriter.WriteHeader(http.StatusInternalServerError) - return - } - } - } - } - - pathProcessor, routerProcessesPath := c.router.(PathProcessor) - if !routerProcessesPath { - pathProcessor = defaultPathProcessor{} - } - pathParams := pathProcessor.ExtractParameters(route, webService, httpRequest.URL.Path) - wrappedRequest, wrappedResponse := route.wrapRequestResponse(writer, httpRequest, pathParams) - // pass through filters (if any) - if size := len(c.containerFilters) + len(webService.filters) + len(route.Filters); size > 0 { - // compose filter chain - allFilters := make([]FilterFunction, 0, size) - allFilters = append(allFilters, c.containerFilters...) - allFilters = append(allFilters, webService.filters...) - allFilters = append(allFilters, route.Filters...) - chain := FilterChain{ - Filters: allFilters, - Target: route.Function, - ParameterDocs: route.ParameterDocs, - Operation: route.Operation, - } - chain.ProcessFilter(wrappedRequest, wrappedResponse) - } else { - // no filters, handle request by route - route.Function(wrappedRequest, wrappedResponse) - } -} - -// fixedPrefixPath returns the fixed part of the partspec ; it may include template vars {} -func fixedPrefixPath(pathspec string) string { - varBegin := strings.Index(pathspec, "{") - if -1 == varBegin { - return pathspec - } - return pathspec[:varBegin] -} - -// ServeHTTP implements net/http.Handler therefore a Container can be a Handler in a http.Server -func (c *Container) ServeHTTP(httpWriter http.ResponseWriter, httpRequest *http.Request) { - // Skip, if content encoding is disabled - if !c.contentEncodingEnabled { - c.ServeMux.ServeHTTP(httpWriter, httpRequest) - return - } - // content encoding is enabled - - // Skip, if httpWriter is already an CompressingResponseWriter - if _, ok := httpWriter.(*CompressingResponseWriter); ok { - c.ServeMux.ServeHTTP(httpWriter, httpRequest) - return - } - - writer := httpWriter - // CompressingResponseWriter should be closed after all operations are done - defer func() { - if compressWriter, ok := writer.(*CompressingResponseWriter); ok { - compressWriter.Close() - } - }() - - doCompress, encoding := wantsCompressedResponse(httpRequest, httpWriter) - if doCompress { - var err error - writer, err = NewCompressingResponseWriter(httpWriter, encoding) - if err != nil { - log.Print("unable to install compressor: ", err) - httpWriter.WriteHeader(http.StatusInternalServerError) - return - } - } - - c.ServeMux.ServeHTTP(writer, httpRequest) -} - -// Handle registers the handler for the given pattern. If a handler already exists for pattern, Handle panics. -func (c *Container) Handle(pattern string, handler http.Handler) { - c.ServeMux.Handle(pattern, http.HandlerFunc(func(httpWriter http.ResponseWriter, httpRequest *http.Request) { - // Skip, if httpWriter is already an CompressingResponseWriter - if _, ok := httpWriter.(*CompressingResponseWriter); ok { - handler.ServeHTTP(httpWriter, httpRequest) - return - } - - writer := httpWriter - - // CompressingResponseWriter should be closed after all operations are done - defer func() { - if compressWriter, ok := writer.(*CompressingResponseWriter); ok { - compressWriter.Close() - } - }() - - if c.contentEncodingEnabled { - doCompress, encoding := wantsCompressedResponse(httpRequest, httpWriter) - if doCompress { - var err error - writer, err = NewCompressingResponseWriter(httpWriter, encoding) - if err != nil { - log.Print("unable to install compressor: ", err) - httpWriter.WriteHeader(http.StatusInternalServerError) - return - } - } - } - - handler.ServeHTTP(writer, httpRequest) - })) -} - -// HandleWithFilter registers the handler for the given pattern. -// Container's filter chain is applied for handler. -// If a handler already exists for pattern, HandleWithFilter panics. -func (c *Container) HandleWithFilter(pattern string, handler http.Handler) { - f := func(httpResponse http.ResponseWriter, httpRequest *http.Request) { - if len(c.containerFilters) == 0 { - handler.ServeHTTP(httpResponse, httpRequest) - return - } - - chain := FilterChain{Filters: c.containerFilters, Target: func(req *Request, resp *Response) { - handler.ServeHTTP(resp, req.Request) - }} - chain.ProcessFilter(NewRequest(httpRequest), NewResponse(httpResponse)) - } - - c.Handle(pattern, http.HandlerFunc(f)) -} - -// Filter appends a container FilterFunction. These are called before dispatching -// a http.Request to a WebService from the container -func (c *Container) Filter(filter FilterFunction) { - c.containerFilters = append(c.containerFilters, filter) -} - -// RegisteredWebServices returns the collections of added WebServices -func (c *Container) RegisteredWebServices() []*WebService { - c.webServicesLock.RLock() - defer c.webServicesLock.RUnlock() - result := make([]*WebService, len(c.webServices)) - for ix := range c.webServices { - result[ix] = c.webServices[ix] - } - return result -} - -// computeAllowedMethods returns a list of HTTP methods that are valid for a Request -func (c *Container) computeAllowedMethods(req *Request) []string { - // Go through all RegisteredWebServices() and all its Routes to collect the options - methods := []string{} - requestPath := req.Request.URL.Path - for _, ws := range c.RegisteredWebServices() { - matches := ws.pathExpr.Matcher.FindStringSubmatch(requestPath) - if matches != nil { - finalMatch := matches[len(matches)-1] - for _, rt := range ws.Routes() { - matches := rt.pathExpr.Matcher.FindStringSubmatch(finalMatch) - if matches != nil { - lastMatch := matches[len(matches)-1] - if lastMatch == "" || lastMatch == "/" { // do not include if value is neither empty nor ‘/’. - methods = append(methods, rt.Method) - } - } - } - } - } - // methods = append(methods, "OPTIONS") not sure about this - return methods -} - -// newBasicRequestResponse creates a pair of Request,Response from its http versions. -// It is basic because no parameter or (produces) content-type information is given. -func newBasicRequestResponse(httpWriter http.ResponseWriter, httpRequest *http.Request) (*Request, *Response) { - resp := NewResponse(httpWriter) - resp.requestAccept = httpRequest.Header.Get(HEADER_Accept) - return NewRequest(httpRequest), resp -} diff --git a/vendor/github.com/emicklei/go-restful/v3/cors_filter.go b/vendor/github.com/emicklei/go-restful/v3/cors_filter.go deleted file mode 100644 index 9d18dfb7b..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/cors_filter.go +++ /dev/null @@ -1,193 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "regexp" - "strconv" - "strings" -) - -// CrossOriginResourceSharing is used to create a Container Filter that implements CORS. -// Cross-origin resource sharing (CORS) is a mechanism that allows JavaScript on a web page -// to make XMLHttpRequests to another domain, not the domain the JavaScript originated from. -// -// http://en.wikipedia.org/wiki/Cross-origin_resource_sharing -// http://enable-cors.org/server.html -// http://www.html5rocks.com/en/tutorials/cors/#toc-handling-a-not-so-simple-request -type CrossOriginResourceSharing struct { - ExposeHeaders []string // list of Header names - - // AllowedHeaders is alist of Header names. Checking is case-insensitive. - // The list may contain the special wildcard string ".*" ; all is allowed - AllowedHeaders []string - - // AllowedDomains is a list of allowed values for Http Origin. - // The list may contain the special wildcard string ".*" ; all is allowed - // If empty all are allowed. - AllowedDomains []string - - // AllowedDomainFunc is optional and is a function that will do the check - // when the origin is not part of the AllowedDomains and it does not contain the wildcard ".*". - AllowedDomainFunc func(origin string) bool - - // AllowedMethods is either empty or has a list of http methods names. Checking is case-insensitive. - AllowedMethods []string - MaxAge int // number of seconds before requiring new Options request - CookiesAllowed bool - Container *Container - - allowedOriginPatterns []*regexp.Regexp // internal field for origin regexp check. -} - -// Filter is a filter function that implements the CORS flow as documented on http://enable-cors.org/server.html -// and http://www.html5rocks.com/static/images/cors_server_flowchart.png -func (c CrossOriginResourceSharing) Filter(req *Request, resp *Response, chain *FilterChain) { - origin := req.Request.Header.Get(HEADER_Origin) - if len(origin) == 0 { - if trace { - traceLogger.Print("no Http header Origin set") - } - chain.ProcessFilter(req, resp) - return - } - if !c.isOriginAllowed(origin) { // check whether this origin is allowed - if trace { - traceLogger.Printf("HTTP Origin:%s is not part of %v, neither matches any part of %v", origin, c.AllowedDomains, c.allowedOriginPatterns) - } - chain.ProcessFilter(req, resp) - return - } - if req.Request.Method != "OPTIONS" { - c.doActualRequest(req, resp) - chain.ProcessFilter(req, resp) - return - } - if acrm := req.Request.Header.Get(HEADER_AccessControlRequestMethod); acrm != "" { - c.doPreflightRequest(req, resp) - } else { - c.doActualRequest(req, resp) - chain.ProcessFilter(req, resp) - return - } -} - -func (c CrossOriginResourceSharing) doActualRequest(req *Request, resp *Response) { - c.setOptionsHeaders(req, resp) - // continue processing the response -} - -func (c *CrossOriginResourceSharing) doPreflightRequest(req *Request, resp *Response) { - if len(c.AllowedMethods) == 0 { - if c.Container == nil { - c.AllowedMethods = DefaultContainer.computeAllowedMethods(req) - } else { - c.AllowedMethods = c.Container.computeAllowedMethods(req) - } - } - - acrm := req.Request.Header.Get(HEADER_AccessControlRequestMethod) - if !c.isValidAccessControlRequestMethod(acrm, c.AllowedMethods) { - if trace { - traceLogger.Printf("Http header %s:%s is not in %v", - HEADER_AccessControlRequestMethod, - acrm, - c.AllowedMethods) - } - return - } - acrhs := req.Request.Header.Get(HEADER_AccessControlRequestHeaders) - if len(acrhs) > 0 { - for _, each := range strings.Split(acrhs, ",") { - if !c.isValidAccessControlRequestHeader(strings.Trim(each, " ")) { - if trace { - traceLogger.Printf("Http header %s:%s is not in %v", - HEADER_AccessControlRequestHeaders, - acrhs, - c.AllowedHeaders) - } - return - } - } - } - resp.AddHeader(HEADER_AccessControlAllowMethods, strings.Join(c.AllowedMethods, ",")) - resp.AddHeader(HEADER_AccessControlAllowHeaders, acrhs) - c.setOptionsHeaders(req, resp) - - // return http 200 response, no body -} - -func (c CrossOriginResourceSharing) setOptionsHeaders(req *Request, resp *Response) { - c.checkAndSetExposeHeaders(resp) - c.setAllowOriginHeader(req, resp) - c.checkAndSetAllowCredentials(resp) - if c.MaxAge > 0 { - resp.AddHeader(HEADER_AccessControlMaxAge, strconv.Itoa(c.MaxAge)) - } -} - -func (c CrossOriginResourceSharing) isOriginAllowed(origin string) bool { - if len(origin) == 0 { - return false - } - lowerOrigin := strings.ToLower(origin) - if len(c.AllowedDomains) == 0 { - if c.AllowedDomainFunc != nil { - return c.AllowedDomainFunc(lowerOrigin) - } - return true - } - - // exact match on each allowed domain - for _, domain := range c.AllowedDomains { - if domain == ".*" || strings.ToLower(domain) == lowerOrigin { - return true - } - } - if c.AllowedDomainFunc != nil { - return c.AllowedDomainFunc(origin) - } - return false -} - -func (c CrossOriginResourceSharing) setAllowOriginHeader(req *Request, resp *Response) { - origin := req.Request.Header.Get(HEADER_Origin) - if c.isOriginAllowed(origin) { - resp.AddHeader(HEADER_AccessControlAllowOrigin, origin) - } -} - -func (c CrossOriginResourceSharing) checkAndSetExposeHeaders(resp *Response) { - if len(c.ExposeHeaders) > 0 { - resp.AddHeader(HEADER_AccessControlExposeHeaders, strings.Join(c.ExposeHeaders, ",")) - } -} - -func (c CrossOriginResourceSharing) checkAndSetAllowCredentials(resp *Response) { - if c.CookiesAllowed { - resp.AddHeader(HEADER_AccessControlAllowCredentials, "true") - } -} - -func (c CrossOriginResourceSharing) isValidAccessControlRequestMethod(method string, allowedMethods []string) bool { - for _, each := range allowedMethods { - if each == method { - return true - } - } - return false -} - -func (c CrossOriginResourceSharing) isValidAccessControlRequestHeader(header string) bool { - for _, each := range c.AllowedHeaders { - if strings.ToLower(each) == strings.ToLower(header) { - return true - } - if each == "*" { - return true - } - } - return false -} diff --git a/vendor/github.com/emicklei/go-restful/v3/coverage.sh b/vendor/github.com/emicklei/go-restful/v3/coverage.sh deleted file mode 100644 index e27dbf1a9..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/coverage.sh +++ /dev/null @@ -1,2 +0,0 @@ -go test -coverprofile=coverage.out -go tool cover -html=coverage.out \ No newline at end of file diff --git a/vendor/github.com/emicklei/go-restful/v3/curly.go b/vendor/github.com/emicklei/go-restful/v3/curly.go deleted file mode 100644 index ba1fc5d5f..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/curly.go +++ /dev/null @@ -1,173 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "net/http" - "regexp" - "sort" - "strings" -) - -// CurlyRouter expects Routes with paths that contain zero or more parameters in curly brackets. -type CurlyRouter struct{} - -// SelectRoute is part of the Router interface and returns the best match -// for the WebService and its Route for the given Request. -func (c CurlyRouter) SelectRoute( - webServices []*WebService, - httpRequest *http.Request) (selectedService *WebService, selected *Route, err error) { - - requestTokens := tokenizePath(httpRequest.URL.Path) - - detectedService := c.detectWebService(requestTokens, webServices) - if detectedService == nil { - if trace { - traceLogger.Printf("no WebService was found to match URL path:%s\n", httpRequest.URL.Path) - } - return nil, nil, NewError(http.StatusNotFound, "404: Page Not Found") - } - candidateRoutes := c.selectRoutes(detectedService, requestTokens) - if len(candidateRoutes) == 0 { - if trace { - traceLogger.Printf("no Route in WebService with path %s was found to match URL path:%s\n", detectedService.rootPath, httpRequest.URL.Path) - } - return detectedService, nil, NewError(http.StatusNotFound, "404: Page Not Found") - } - selectedRoute, err := c.detectRoute(candidateRoutes, httpRequest) - if selectedRoute == nil { - return detectedService, nil, err - } - return detectedService, selectedRoute, nil -} - -// selectRoutes return a collection of Route from a WebService that matches the path tokens from the request. -func (c CurlyRouter) selectRoutes(ws *WebService, requestTokens []string) sortableCurlyRoutes { - candidates := make(sortableCurlyRoutes, 0, 8) - for _, each := range ws.routes { - matches, paramCount, staticCount := c.matchesRouteByPathTokens(each.pathParts, requestTokens, each.hasCustomVerb) - if matches { - candidates.add(curlyRoute{each, paramCount, staticCount}) // TODO make sure Routes() return pointers? - } - } - sort.Sort(candidates) - return candidates -} - -// matchesRouteByPathTokens computes whether it matches, howmany parameters do match and what the number of static path elements are. -func (c CurlyRouter) matchesRouteByPathTokens(routeTokens, requestTokens []string, routeHasCustomVerb bool) (matches bool, paramCount int, staticCount int) { - if len(routeTokens) < len(requestTokens) { - // proceed in matching only if last routeToken is wildcard - count := len(routeTokens) - if count == 0 || !strings.HasSuffix(routeTokens[count-1], "*}") { - return false, 0, 0 - } - // proceed - } - for i, routeToken := range routeTokens { - if i == len(requestTokens) { - // reached end of request path - return false, 0, 0 - } - requestToken := requestTokens[i] - if routeHasCustomVerb && hasCustomVerb(routeToken){ - if !isMatchCustomVerb(routeToken, requestToken) { - return false, 0, 0 - } - staticCount++ - requestToken = removeCustomVerb(requestToken) - routeToken = removeCustomVerb(routeToken) - } - - if strings.HasPrefix(routeToken, "{") { - paramCount++ - if colon := strings.Index(routeToken, ":"); colon != -1 { - // match by regex - matchesToken, matchesRemainder := c.regularMatchesPathToken(routeToken, colon, requestToken) - if !matchesToken { - return false, 0, 0 - } - if matchesRemainder { - break - } - } - } else { // no { prefix - if requestToken != routeToken { - return false, 0, 0 - } - staticCount++ - } - } - return true, paramCount, staticCount -} - -// regularMatchesPathToken tests whether the regular expression part of routeToken matches the requestToken or all remaining tokens -// format routeToken is {someVar:someExpression}, e.g. {zipcode:[\d][\d][\d][\d][A-Z][A-Z]} -func (c CurlyRouter) regularMatchesPathToken(routeToken string, colon int, requestToken string) (matchesToken bool, matchesRemainder bool) { - regPart := routeToken[colon+1 : len(routeToken)-1] - if regPart == "*" { - if trace { - traceLogger.Printf("wildcard parameter detected in route token %s that matches %s\n", routeToken, requestToken) - } - return true, true - } - matched, err := regexp.MatchString(regPart, requestToken) - return (matched && err == nil), false -} - -var jsr311Router = RouterJSR311{} - -// detectRoute selectes from a list of Route the first match by inspecting both the Accept and Content-Type -// headers of the Request. See also RouterJSR311 in jsr311.go -func (c CurlyRouter) detectRoute(candidateRoutes sortableCurlyRoutes, httpRequest *http.Request) (*Route, error) { - // tracing is done inside detectRoute - return jsr311Router.detectRoute(candidateRoutes.routes(), httpRequest) -} - -// detectWebService returns the best matching webService given the list of path tokens. -// see also computeWebserviceScore -func (c CurlyRouter) detectWebService(requestTokens []string, webServices []*WebService) *WebService { - var best *WebService - score := -1 - for _, each := range webServices { - matches, eachScore := c.computeWebserviceScore(requestTokens, each.pathExpr.tokens) - if matches && (eachScore > score) { - best = each - score = eachScore - } - } - return best -} - -// computeWebserviceScore returns whether tokens match and -// the weighted score of the longest matching consecutive tokens from the beginning. -func (c CurlyRouter) computeWebserviceScore(requestTokens []string, tokens []string) (bool, int) { - if len(tokens) > len(requestTokens) { - return false, 0 - } - score := 0 - for i := 0; i < len(tokens); i++ { - each := requestTokens[i] - other := tokens[i] - if len(each) == 0 && len(other) == 0 { - score++ - continue - } - if len(other) > 0 && strings.HasPrefix(other, "{") { - // no empty match - if len(each) == 0 { - return false, score - } - score += 1 - } else { - // not a parameter - if each != other { - return false, score - } - score += (len(tokens) - i) * 10 //fuzzy - } - } - return true, score -} diff --git a/vendor/github.com/emicklei/go-restful/v3/curly_route.go b/vendor/github.com/emicklei/go-restful/v3/curly_route.go deleted file mode 100644 index 403dd3be9..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/curly_route.go +++ /dev/null @@ -1,54 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -// curlyRoute exits for sorting Routes by the CurlyRouter based on number of parameters and number of static path elements. -type curlyRoute struct { - route Route - paramCount int - staticCount int -} - -// sortableCurlyRoutes orders by most parameters and path elements first. -type sortableCurlyRoutes []curlyRoute - -func (s *sortableCurlyRoutes) add(route curlyRoute) { - *s = append(*s, route) -} - -func (s sortableCurlyRoutes) routes() (routes []Route) { - routes = make([]Route, 0, len(s)) - for _, each := range s { - routes = append(routes, each.route) // TODO change return type - } - return routes -} - -func (s sortableCurlyRoutes) Len() int { - return len(s) -} -func (s sortableCurlyRoutes) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} -func (s sortableCurlyRoutes) Less(i, j int) bool { - a := s[j] - b := s[i] - - // primary key - if a.staticCount < b.staticCount { - return true - } - if a.staticCount > b.staticCount { - return false - } - // secundary key - if a.paramCount < b.paramCount { - return true - } - if a.paramCount > b.paramCount { - return false - } - return a.route.Path < b.route.Path -} diff --git a/vendor/github.com/emicklei/go-restful/v3/custom_verb.go b/vendor/github.com/emicklei/go-restful/v3/custom_verb.go deleted file mode 100644 index bfc17efde..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/custom_verb.go +++ /dev/null @@ -1,29 +0,0 @@ -package restful - -import ( - "fmt" - "regexp" -) - -var ( - customVerbReg = regexp.MustCompile(":([A-Za-z]+)$") -) - -func hasCustomVerb(routeToken string) bool { - return customVerbReg.MatchString(routeToken) -} - -func isMatchCustomVerb(routeToken string, pathToken string) bool { - rs := customVerbReg.FindStringSubmatch(routeToken) - if len(rs) < 2 { - return false - } - - customVerb := rs[1] - specificVerbReg := regexp.MustCompile(fmt.Sprintf(":%s$", customVerb)) - return specificVerbReg.MatchString(pathToken) -} - -func removeCustomVerb(str string) string { - return customVerbReg.ReplaceAllString(str, "") -} diff --git a/vendor/github.com/emicklei/go-restful/v3/doc.go b/vendor/github.com/emicklei/go-restful/v3/doc.go deleted file mode 100644 index 69b13057d..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/doc.go +++ /dev/null @@ -1,185 +0,0 @@ -/* -Package restful , a lean package for creating REST-style WebServices without magic. - -WebServices and Routes - -A WebService has a collection of Route objects that dispatch incoming Http Requests to a function calls. -Typically, a WebService has a root path (e.g. /users) and defines common MIME types for its routes. -WebServices must be added to a container (see below) in order to handler Http requests from a server. - -A Route is defined by a HTTP method, an URL path and (optionally) the MIME types it consumes (Content-Type) and produces (Accept). -This package has the logic to find the best matching Route and if found, call its Function. - - ws := new(restful.WebService) - ws. - Path("/users"). - Consumes(restful.MIME_JSON, restful.MIME_XML). - Produces(restful.MIME_JSON, restful.MIME_XML) - - ws.Route(ws.GET("/{user-id}").To(u.findUser)) // u is a UserResource - - ... - - // GET http://localhost:8080/users/1 - func (u UserResource) findUser(request *restful.Request, response *restful.Response) { - id := request.PathParameter("user-id") - ... - } - -The (*Request, *Response) arguments provide functions for reading information from the request and writing information back to the response. - -See the example https://github.com/emicklei/go-restful/blob/v3/examples/user-resource/restful-user-resource.go with a full implementation. - -Regular expression matching Routes - -A Route parameter can be specified using the format "uri/{var[:regexp]}" or the special version "uri/{var:*}" for matching the tail of the path. -For example, /persons/{name:[A-Z][A-Z]} can be used to restrict values for the parameter "name" to only contain capital alphabetic characters. -Regular expressions must use the standard Go syntax as described in the regexp package. (https://code.google.com/p/re2/wiki/Syntax) -This feature requires the use of a CurlyRouter. - -Containers - -A Container holds a collection of WebServices, Filters and a http.ServeMux for multiplexing http requests. -Using the statements "restful.Add(...) and restful.Filter(...)" will register WebServices and Filters to the Default Container. -The Default container of go-restful uses the http.DefaultServeMux. -You can create your own Container and create a new http.Server for that particular container. - - container := restful.NewContainer() - server := &http.Server{Addr: ":8081", Handler: container} - -Filters - -A filter dynamically intercepts requests and responses to transform or use the information contained in the requests or responses. -You can use filters to perform generic logging, measurement, authentication, redirect, set response headers etc. -In the restful package there are three hooks into the request,response flow where filters can be added. -Each filter must define a FilterFunction: - - func (req *restful.Request, resp *restful.Response, chain *restful.FilterChain) - -Use the following statement to pass the request,response pair to the next filter or RouteFunction - - chain.ProcessFilter(req, resp) - -Container Filters - -These are processed before any registered WebService. - - // install a (global) filter for the default container (processed before any webservice) - restful.Filter(globalLogging) - -WebService Filters - -These are processed before any Route of a WebService. - - // install a webservice filter (processed before any route) - ws.Filter(webserviceLogging).Filter(measureTime) - - -Route Filters - -These are processed before calling the function associated with the Route. - - // install 2 chained route filters (processed before calling findUser) - ws.Route(ws.GET("/{user-id}").Filter(routeLogging).Filter(NewCountFilter().routeCounter).To(findUser)) - -See the example https://github.com/emicklei/go-restful/blob/v3/examples/filters/restful-filters.go with full implementations. - -Response Encoding - -Two encodings are supported: gzip and deflate. To enable this for all responses: - - restful.DefaultContainer.EnableContentEncoding(true) - -If a Http request includes the Accept-Encoding header then the response content will be compressed using the specified encoding. -Alternatively, you can create a Filter that performs the encoding and install it per WebService or Route. - -See the example https://github.com/emicklei/go-restful/blob/v3/examples/encoding/restful-encoding-filter.go - -OPTIONS support - -By installing a pre-defined container filter, your Webservice(s) can respond to the OPTIONS Http request. - - Filter(OPTIONSFilter()) - -CORS - -By installing the filter of a CrossOriginResourceSharing (CORS), your WebService(s) can handle CORS requests. - - cors := CrossOriginResourceSharing{ExposeHeaders: []string{"X-My-Header"}, CookiesAllowed: false, Container: DefaultContainer} - Filter(cors.Filter) - -Error Handling - -Unexpected things happen. If a request cannot be processed because of a failure, your service needs to tell via the response what happened and why. -For this reason HTTP status codes exist and it is important to use the correct code in every exceptional situation. - - 400: Bad Request - -If path or query parameters are not valid (content or type) then use http.StatusBadRequest. - - 404: Not Found - -Despite a valid URI, the resource requested may not be available - - 500: Internal Server Error - -If the application logic could not process the request (or write the response) then use http.StatusInternalServerError. - - 405: Method Not Allowed - -The request has a valid URL but the method (GET,PUT,POST,...) is not allowed. - - 406: Not Acceptable - -The request does not have or has an unknown Accept Header set for this operation. - - 415: Unsupported Media Type - -The request does not have or has an unknown Content-Type Header set for this operation. - -ServiceError - -In addition to setting the correct (error) Http status code, you can choose to write a ServiceError message on the response. - -Performance options - -This package has several options that affect the performance of your service. It is important to understand them and how you can change it. - - restful.DefaultContainer.DoNotRecover(false) - -DoNotRecover controls whether panics will be caught to return HTTP 500. -If set to false, the container will recover from panics. -Default value is true - - restful.SetCompressorProvider(NewBoundedCachedCompressors(20, 20)) - -If content encoding is enabled then the default strategy for getting new gzip/zlib writers and readers is to use a sync.Pool. -Because writers are expensive structures, performance is even more improved when using a preloaded cache. You can also inject your own implementation. - -Trouble shooting - -This package has the means to produce detail logging of the complete Http request matching process and filter invocation. -Enabling this feature requires you to set an implementation of restful.StdLogger (e.g. log.Logger) instance such as: - - restful.TraceLogger(log.New(os.Stdout, "[restful] ", log.LstdFlags|log.Lshortfile)) - -Logging - -The restful.SetLogger() method allows you to override the logger used by the package. By default restful -uses the standard library `log` package and logs to stdout. Different logging packages are supported as -long as they conform to `StdLogger` interface defined in the `log` sub-package, writing an adapter for your -preferred package is simple. - -Resources - -[project]: https://github.com/emicklei/go-restful - -[examples]: https://github.com/emicklei/go-restful/blob/master/examples - -[design]: http://ernestmicklei.com/2012/11/11/go-restful-api-design/ - -[showcases]: https://github.com/emicklei/mora, https://github.com/emicklei/landskape - -(c) 2012-2015, http://ernestmicklei.com. MIT License -*/ -package restful diff --git a/vendor/github.com/emicklei/go-restful/v3/entity_accessors.go b/vendor/github.com/emicklei/go-restful/v3/entity_accessors.go deleted file mode 100644 index 9808752ac..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/entity_accessors.go +++ /dev/null @@ -1,169 +0,0 @@ -package restful - -// Copyright 2015 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "encoding/json" - "encoding/xml" - "strings" - "sync" -) - -var ( - MarshalIndent = json.MarshalIndent - NewDecoder = json.NewDecoder - NewEncoder = json.NewEncoder -) - -// EntityReaderWriter can read and write values using an encoding such as JSON,XML. -type EntityReaderWriter interface { - // Read a serialized version of the value from the request. - // The Request may have a decompressing reader. Depends on Content-Encoding. - Read(req *Request, v interface{}) error - - // Write a serialized version of the value on the response. - // The Response may have a compressing writer. Depends on Accept-Encoding. - // status should be a valid Http Status code - Write(resp *Response, status int, v interface{}) error -} - -// entityAccessRegistry is a singleton -var entityAccessRegistry = &entityReaderWriters{ - protection: new(sync.RWMutex), - accessors: map[string]EntityReaderWriter{}, -} - -// entityReaderWriters associates MIME to an EntityReaderWriter -type entityReaderWriters struct { - protection *sync.RWMutex - accessors map[string]EntityReaderWriter -} - -func init() { - RegisterEntityAccessor(MIME_JSON, NewEntityAccessorJSON(MIME_JSON)) - RegisterEntityAccessor(MIME_XML, NewEntityAccessorXML(MIME_XML)) -} - -// RegisterEntityAccessor add/overrides the ReaderWriter for encoding content with this MIME type. -func RegisterEntityAccessor(mime string, erw EntityReaderWriter) { - entityAccessRegistry.protection.Lock() - defer entityAccessRegistry.protection.Unlock() - entityAccessRegistry.accessors[mime] = erw -} - -// NewEntityAccessorJSON returns a new EntityReaderWriter for accessing JSON content. -// This package is already initialized with such an accessor using the MIME_JSON contentType. -func NewEntityAccessorJSON(contentType string) EntityReaderWriter { - return entityJSONAccess{ContentType: contentType} -} - -// NewEntityAccessorXML returns a new EntityReaderWriter for accessing XML content. -// This package is already initialized with such an accessor using the MIME_XML contentType. -func NewEntityAccessorXML(contentType string) EntityReaderWriter { - return entityXMLAccess{ContentType: contentType} -} - -// accessorAt returns the registered ReaderWriter for this MIME type. -func (r *entityReaderWriters) accessorAt(mime string) (EntityReaderWriter, bool) { - r.protection.RLock() - defer r.protection.RUnlock() - er, ok := r.accessors[mime] - if !ok { - // retry with reverse lookup - // more expensive but we are in an exceptional situation anyway - for k, v := range r.accessors { - if strings.Contains(mime, k) { - return v, true - } - } - } - return er, ok -} - -// entityXMLAccess is a EntityReaderWriter for XML encoding -type entityXMLAccess struct { - // This is used for setting the Content-Type header when writing - ContentType string -} - -// Read unmarshalls the value from XML -func (e entityXMLAccess) Read(req *Request, v interface{}) error { - return xml.NewDecoder(req.Request.Body).Decode(v) -} - -// Write marshalls the value to JSON and set the Content-Type Header. -func (e entityXMLAccess) Write(resp *Response, status int, v interface{}) error { - return writeXML(resp, status, e.ContentType, v) -} - -// writeXML marshalls the value to JSON and set the Content-Type Header. -func writeXML(resp *Response, status int, contentType string, v interface{}) error { - if v == nil { - resp.WriteHeader(status) - // do not write a nil representation - return nil - } - if resp.prettyPrint { - // pretty output must be created and written explicitly - output, err := xml.MarshalIndent(v, " ", " ") - if err != nil { - return err - } - resp.Header().Set(HEADER_ContentType, contentType) - resp.WriteHeader(status) - _, err = resp.Write([]byte(xml.Header)) - if err != nil { - return err - } - _, err = resp.Write(output) - return err - } - // not-so-pretty - resp.Header().Set(HEADER_ContentType, contentType) - resp.WriteHeader(status) - return xml.NewEncoder(resp).Encode(v) -} - -// entityJSONAccess is a EntityReaderWriter for JSON encoding -type entityJSONAccess struct { - // This is used for setting the Content-Type header when writing - ContentType string -} - -// Read unmarshalls the value from JSON -func (e entityJSONAccess) Read(req *Request, v interface{}) error { - decoder := NewDecoder(req.Request.Body) - decoder.UseNumber() - return decoder.Decode(v) -} - -// Write marshalls the value to JSON and set the Content-Type Header. -func (e entityJSONAccess) Write(resp *Response, status int, v interface{}) error { - return writeJSON(resp, status, e.ContentType, v) -} - -// write marshalls the value to JSON and set the Content-Type Header. -func writeJSON(resp *Response, status int, contentType string, v interface{}) error { - if v == nil { - resp.WriteHeader(status) - // do not write a nil representation - return nil - } - if resp.prettyPrint { - // pretty output must be created and written explicitly - output, err := MarshalIndent(v, "", " ") - if err != nil { - return err - } - resp.Header().Set(HEADER_ContentType, contentType) - resp.WriteHeader(status) - _, err = resp.Write(output) - return err - } - // not-so-pretty - resp.Header().Set(HEADER_ContentType, contentType) - resp.WriteHeader(status) - return NewEncoder(resp).Encode(v) -} diff --git a/vendor/github.com/emicklei/go-restful/v3/extensions.go b/vendor/github.com/emicklei/go-restful/v3/extensions.go deleted file mode 100644 index 5023fa049..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/extensions.go +++ /dev/null @@ -1,21 +0,0 @@ -package restful - -// Copyright 2021 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -// ExtensionProperties provides storage of vendor extensions for entities -type ExtensionProperties struct { - // Extensions vendor extensions used to describe extra functionality - // (https://swagger.io/docs/specification/2-0/swagger-extensions/) - Extensions map[string]interface{} -} - -// AddExtension adds or updates a key=value pair to the extension map. -func (ep *ExtensionProperties) AddExtension(key string, value interface{}) { - if ep.Extensions == nil { - ep.Extensions = map[string]interface{}{key: value} - } else { - ep.Extensions[key] = value - } -} diff --git a/vendor/github.com/emicklei/go-restful/v3/filter.go b/vendor/github.com/emicklei/go-restful/v3/filter.go deleted file mode 100644 index fd88c536c..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/filter.go +++ /dev/null @@ -1,37 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -// FilterChain is a request scoped object to process one or more filters before calling the target RouteFunction. -type FilterChain struct { - Filters []FilterFunction // ordered list of FilterFunction - Index int // index into filters that is currently in progress - Target RouteFunction // function to call after passing all filters - ParameterDocs []*Parameter // the parameter docs for the route - Operation string // the name of the operation -} - -// ProcessFilter passes the request,response pair through the next of Filters. -// Each filter can decide to proceed to the next Filter or handle the Response itself. -func (f *FilterChain) ProcessFilter(request *Request, response *Response) { - if f.Index < len(f.Filters) { - f.Index++ - f.Filters[f.Index-1](request, response, f) - } else { - f.Target(request, response) - } -} - -// FilterFunction definitions must call ProcessFilter on the FilterChain to pass on the control and eventually call the RouteFunction -type FilterFunction func(*Request, *Response, *FilterChain) - -// NoBrowserCacheFilter is a filter function to set HTTP headers that disable browser caching -// See examples/restful-no-cache-filter.go for usage -func NoBrowserCacheFilter(req *Request, resp *Response, chain *FilterChain) { - resp.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") // HTTP 1.1. - resp.Header().Set("Pragma", "no-cache") // HTTP 1.0. - resp.Header().Set("Expires", "0") // Proxies. - chain.ProcessFilter(req, resp) -} diff --git a/vendor/github.com/emicklei/go-restful/v3/filter_adapter.go b/vendor/github.com/emicklei/go-restful/v3/filter_adapter.go deleted file mode 100644 index c246512fc..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/filter_adapter.go +++ /dev/null @@ -1,21 +0,0 @@ -package restful - -import ( - "net/http" -) - -// HttpMiddlewareHandler is a function that takes a http.Handler and returns a http.Handler -type HttpMiddlewareHandler func(http.Handler) http.Handler - -// HttpMiddlewareHandlerToFilter converts a HttpMiddlewareHandler to a FilterFunction. -func HttpMiddlewareHandlerToFilter(middleware HttpMiddlewareHandler) FilterFunction { - return func(req *Request, resp *Response, chain *FilterChain) { - next := http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { - req.Request = r - resp.ResponseWriter = rw - chain.ProcessFilter(req, resp) - }) - - middleware(next).ServeHTTP(resp.ResponseWriter, req.Request) - } -} diff --git a/vendor/github.com/emicklei/go-restful/v3/jsr311.go b/vendor/github.com/emicklei/go-restful/v3/jsr311.go deleted file mode 100644 index 07a0c91e9..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/jsr311.go +++ /dev/null @@ -1,326 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "errors" - "fmt" - "net/http" - "sort" - "strings" -) - -// RouterJSR311 implements the flow for matching Requests to Routes (and consequently Resource Functions) -// as specified by the JSR311 http://jsr311.java.net/nonav/releases/1.1/spec/spec.html. -// RouterJSR311 implements the Router interface. -// Concept of locators is not implemented. -type RouterJSR311 struct{} - -// SelectRoute is part of the Router interface and returns the best match -// for the WebService and its Route for the given Request. -func (r RouterJSR311) SelectRoute( - webServices []*WebService, - httpRequest *http.Request) (selectedService *WebService, selectedRoute *Route, err error) { - - // Identify the root resource class (WebService) - dispatcher, finalMatch, err := r.detectDispatcher(httpRequest.URL.Path, webServices) - if err != nil { - return nil, nil, NewError(http.StatusNotFound, "") - } - // Obtain the set of candidate methods (Routes) - routes := r.selectRoutes(dispatcher, finalMatch) - if len(routes) == 0 { - return dispatcher, nil, NewError(http.StatusNotFound, "404: Page Not Found") - } - - // Identify the method (Route) that will handle the request - route, ok := r.detectRoute(routes, httpRequest) - return dispatcher, route, ok -} - -// ExtractParameters is used to obtain the path parameters from the route using the same matching -// engine as the JSR 311 router. -func (r RouterJSR311) ExtractParameters(route *Route, webService *WebService, urlPath string) map[string]string { - webServiceExpr := webService.pathExpr - webServiceMatches := webServiceExpr.Matcher.FindStringSubmatch(urlPath) - pathParameters := r.extractParams(webServiceExpr, webServiceMatches) - routeExpr := route.pathExpr - routeMatches := routeExpr.Matcher.FindStringSubmatch(webServiceMatches[len(webServiceMatches)-1]) - routeParams := r.extractParams(routeExpr, routeMatches) - for key, value := range routeParams { - pathParameters[key] = value - } - return pathParameters -} - -func (RouterJSR311) extractParams(pathExpr *pathExpression, matches []string) map[string]string { - params := map[string]string{} - for i := 1; i < len(matches); i++ { - if len(pathExpr.VarNames) >= i { - params[pathExpr.VarNames[i-1]] = matches[i] - } - } - return params -} - -// http://jsr311.java.net/nonav/releases/1.1/spec/spec3.html#x3-360003.7.2 -func (r RouterJSR311) detectRoute(routes []Route, httpRequest *http.Request) (*Route, error) { - candidates := make([]*Route, 0, 8) - for i, each := range routes { - ok := true - for _, fn := range each.If { - if !fn(httpRequest) { - ok = false - break - } - } - if ok { - candidates = append(candidates, &routes[i]) - } - } - if len(candidates) == 0 { - if trace { - traceLogger.Printf("no Route found (from %d) that passes conditional checks", len(routes)) - } - return nil, NewError(http.StatusNotFound, "404: Not Found") - } - - // http method - previous := candidates - candidates = candidates[:0] - for _, each := range previous { - if httpRequest.Method == each.Method { - candidates = append(candidates, each) - } - } - if len(candidates) == 0 { - if trace { - traceLogger.Printf("no Route found (in %d routes) that matches HTTP method %s\n", len(previous), httpRequest.Method) - } - allowed := []string{} - allowedLoop: - for _, candidate := range previous { - for _, method := range allowed { - if method == candidate.Method { - continue allowedLoop - } - } - allowed = append(allowed, candidate.Method) - } - header := http.Header{"Allow": []string{strings.Join(allowed, ", ")}} - return nil, NewErrorWithHeader(http.StatusMethodNotAllowed, "405: Method Not Allowed", header) - } - - // content-type - contentType := httpRequest.Header.Get(HEADER_ContentType) - previous = candidates - candidates = candidates[:0] - for _, each := range previous { - if each.matchesContentType(contentType) { - candidates = append(candidates, each) - } - } - if len(candidates) == 0 { - if trace { - traceLogger.Printf("no Route found (from %d) that matches HTTP Content-Type: %s\n", len(previous), contentType) - } - if httpRequest.ContentLength > 0 { - return nil, NewError(http.StatusUnsupportedMediaType, "415: Unsupported Media Type") - } - } - - // accept - previous = candidates - candidates = candidates[:0] - accept := httpRequest.Header.Get(HEADER_Accept) - if len(accept) == 0 { - accept = "*/*" - } - for _, each := range previous { - if each.matchesAccept(accept) { - candidates = append(candidates, each) - } - } - if len(candidates) == 0 { - if trace { - traceLogger.Printf("no Route found (from %d) that matches HTTP Accept: %s\n", len(previous), accept) - } - available := []string{} - for _, candidate := range previous { - available = append(available, candidate.Produces...) - } - // if POST,PUT,PATCH without body - method, length := httpRequest.Method, httpRequest.Header.Get("Content-Length") - if (method == http.MethodPost || - method == http.MethodPut || - method == http.MethodPatch) && length == "" { - return nil, NewError( - http.StatusUnsupportedMediaType, - fmt.Sprintf("415: Unsupported Media Type\n\nAvailable representations: %s", strings.Join(available, ", ")), - ) - } - return nil, NewError( - http.StatusNotAcceptable, - fmt.Sprintf("406: Not Acceptable\n\nAvailable representations: %s", strings.Join(available, ", ")), - ) - } - // return r.bestMatchByMedia(outputMediaOk, contentType, accept), nil - return candidates[0], nil -} - -// http://jsr311.java.net/nonav/releases/1.1/spec/spec3.html#x3-360003.7.2 -// n/m > n/* > */* -func (r RouterJSR311) bestMatchByMedia(routes []Route, contentType string, accept string) *Route { - // TODO - return &routes[0] -} - -// http://jsr311.java.net/nonav/releases/1.1/spec/spec3.html#x3-360003.7.2 (step 2) -func (r RouterJSR311) selectRoutes(dispatcher *WebService, pathRemainder string) []Route { - filtered := &sortableRouteCandidates{} - for _, each := range dispatcher.Routes() { - pathExpr := each.pathExpr - matches := pathExpr.Matcher.FindStringSubmatch(pathRemainder) - if matches != nil { - lastMatch := matches[len(matches)-1] - if len(lastMatch) == 0 || lastMatch == "/" { // do not include if value is neither empty nor ‘/’. - filtered.candidates = append(filtered.candidates, - routeCandidate{each, len(matches) - 1, pathExpr.LiteralCount, pathExpr.VarCount}) - } - } - } - if len(filtered.candidates) == 0 { - if trace { - traceLogger.Printf("WebService on path %s has no routes that match URL path remainder:%s\n", dispatcher.rootPath, pathRemainder) - } - return []Route{} - } - sort.Sort(sort.Reverse(filtered)) - - // select other routes from candidates whoes expression matches rmatch - matchingRoutes := []Route{filtered.candidates[0].route} - for c := 1; c < len(filtered.candidates); c++ { - each := filtered.candidates[c] - if each.route.pathExpr.Matcher.MatchString(pathRemainder) { - matchingRoutes = append(matchingRoutes, each.route) - } - } - return matchingRoutes -} - -// http://jsr311.java.net/nonav/releases/1.1/spec/spec3.html#x3-360003.7.2 (step 1) -func (r RouterJSR311) detectDispatcher(requestPath string, dispatchers []*WebService) (*WebService, string, error) { - filtered := &sortableDispatcherCandidates{} - for _, each := range dispatchers { - matches := each.pathExpr.Matcher.FindStringSubmatch(requestPath) - if matches != nil { - filtered.candidates = append(filtered.candidates, - dispatcherCandidate{each, matches[len(matches)-1], len(matches), each.pathExpr.LiteralCount, each.pathExpr.VarCount}) - } - } - if len(filtered.candidates) == 0 { - if trace { - traceLogger.Printf("no WebService was found to match URL path:%s\n", requestPath) - } - return nil, "", errors.New("not found") - } - sort.Sort(sort.Reverse(filtered)) - return filtered.candidates[0].dispatcher, filtered.candidates[0].finalMatch, nil -} - -// Types and functions to support the sorting of Routes - -type routeCandidate struct { - route Route - matchesCount int // the number of capturing groups - literalCount int // the number of literal characters (means those not resulting from template variable substitution) - nonDefaultCount int // the number of capturing groups with non-default regular expressions (i.e. not ‘([^ /]+?)’) -} - -func (r routeCandidate) expressionToMatch() string { - return r.route.pathExpr.Source -} - -func (r routeCandidate) String() string { - return fmt.Sprintf("(m=%d,l=%d,n=%d)", r.matchesCount, r.literalCount, r.nonDefaultCount) -} - -type sortableRouteCandidates struct { - candidates []routeCandidate -} - -func (rcs *sortableRouteCandidates) Len() int { - return len(rcs.candidates) -} -func (rcs *sortableRouteCandidates) Swap(i, j int) { - rcs.candidates[i], rcs.candidates[j] = rcs.candidates[j], rcs.candidates[i] -} -func (rcs *sortableRouteCandidates) Less(i, j int) bool { - ci := rcs.candidates[i] - cj := rcs.candidates[j] - // primary key - if ci.literalCount < cj.literalCount { - return true - } - if ci.literalCount > cj.literalCount { - return false - } - // secundary key - if ci.matchesCount < cj.matchesCount { - return true - } - if ci.matchesCount > cj.matchesCount { - return false - } - // tertiary key - if ci.nonDefaultCount < cj.nonDefaultCount { - return true - } - if ci.nonDefaultCount > cj.nonDefaultCount { - return false - } - // quaternary key ("source" is interpreted as Path) - return ci.route.Path < cj.route.Path -} - -// Types and functions to support the sorting of Dispatchers - -type dispatcherCandidate struct { - dispatcher *WebService - finalMatch string - matchesCount int // the number of capturing groups - literalCount int // the number of literal characters (means those not resulting from template variable substitution) - nonDefaultCount int // the number of capturing groups with non-default regular expressions (i.e. not ‘([^ /]+?)’) -} -type sortableDispatcherCandidates struct { - candidates []dispatcherCandidate -} - -func (dc *sortableDispatcherCandidates) Len() int { - return len(dc.candidates) -} -func (dc *sortableDispatcherCandidates) Swap(i, j int) { - dc.candidates[i], dc.candidates[j] = dc.candidates[j], dc.candidates[i] -} -func (dc *sortableDispatcherCandidates) Less(i, j int) bool { - ci := dc.candidates[i] - cj := dc.candidates[j] - // primary key - if ci.matchesCount < cj.matchesCount { - return true - } - if ci.matchesCount > cj.matchesCount { - return false - } - // secundary key - if ci.literalCount < cj.literalCount { - return true - } - if ci.literalCount > cj.literalCount { - return false - } - // tertiary key - return ci.nonDefaultCount < cj.nonDefaultCount -} diff --git a/vendor/github.com/emicklei/go-restful/v3/log/log.go b/vendor/github.com/emicklei/go-restful/v3/log/log.go deleted file mode 100644 index 6cd44c7a5..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/log/log.go +++ /dev/null @@ -1,34 +0,0 @@ -package log - -import ( - stdlog "log" - "os" -) - -// StdLogger corresponds to a minimal subset of the interface satisfied by stdlib log.Logger -type StdLogger interface { - Print(v ...interface{}) - Printf(format string, v ...interface{}) -} - -var Logger StdLogger - -func init() { - // default Logger - SetLogger(stdlog.New(os.Stderr, "[restful] ", stdlog.LstdFlags|stdlog.Lshortfile)) -} - -// SetLogger sets the logger for this package -func SetLogger(customLogger StdLogger) { - Logger = customLogger -} - -// Print delegates to the Logger -func Print(v ...interface{}) { - Logger.Print(v...) -} - -// Printf delegates to the Logger -func Printf(format string, v ...interface{}) { - Logger.Printf(format, v...) -} diff --git a/vendor/github.com/emicklei/go-restful/v3/logger.go b/vendor/github.com/emicklei/go-restful/v3/logger.go deleted file mode 100644 index 29202726f..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/logger.go +++ /dev/null @@ -1,32 +0,0 @@ -package restful - -// Copyright 2014 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. -import ( - "github.com/emicklei/go-restful/v3/log" -) - -var trace bool = false -var traceLogger log.StdLogger - -func init() { - traceLogger = log.Logger // use the package logger by default -} - -// TraceLogger enables detailed logging of Http request matching and filter invocation. Default no logger is set. -// You may call EnableTracing() directly to enable trace logging to the package-wide logger. -func TraceLogger(logger log.StdLogger) { - traceLogger = logger - EnableTracing(logger != nil) -} - -// SetLogger exposes the setter for the global logger on the top-level package -func SetLogger(customLogger log.StdLogger) { - log.SetLogger(customLogger) -} - -// EnableTracing can be used to Trace logging on and off. -func EnableTracing(enabled bool) { - trace = enabled -} diff --git a/vendor/github.com/emicklei/go-restful/v3/mime.go b/vendor/github.com/emicklei/go-restful/v3/mime.go deleted file mode 100644 index 33014471b..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/mime.go +++ /dev/null @@ -1,50 +0,0 @@ -package restful - -import ( - "strconv" - "strings" -) - -type mime struct { - media string - quality float64 -} - -// insertMime adds a mime to a list and keeps it sorted by quality. -func insertMime(l []mime, e mime) []mime { - for i, each := range l { - // if current mime has lower quality then insert before - if e.quality > each.quality { - left := append([]mime{}, l[0:i]...) - return append(append(left, e), l[i:]...) - } - } - return append(l, e) -} - -const qFactorWeightingKey = "q" - -// sortedMimes returns a list of mime sorted (desc) by its specified quality. -// e.g. text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3 -func sortedMimes(accept string) (sorted []mime) { - for _, each := range strings.Split(accept, ",") { - typeAndQuality := strings.Split(strings.Trim(each, " "), ";") - if len(typeAndQuality) == 1 { - sorted = insertMime(sorted, mime{typeAndQuality[0], 1.0}) - } else { - // take factor - qAndWeight := strings.Split(typeAndQuality[1], "=") - if len(qAndWeight) == 2 && strings.Trim(qAndWeight[0], " ") == qFactorWeightingKey { - f, err := strconv.ParseFloat(qAndWeight[1], 64) - if err != nil { - traceLogger.Printf("unable to parse quality in %s, %v", each, err) - } else { - sorted = insertMime(sorted, mime{typeAndQuality[0], f}) - } - } else { - sorted = insertMime(sorted, mime{typeAndQuality[0], 1.0}) - } - } - } - return -} diff --git a/vendor/github.com/emicklei/go-restful/v3/options_filter.go b/vendor/github.com/emicklei/go-restful/v3/options_filter.go deleted file mode 100644 index 5c1b34251..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/options_filter.go +++ /dev/null @@ -1,34 +0,0 @@ -package restful - -import "strings" - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -// OPTIONSFilter is a filter function that inspects the Http Request for the OPTIONS method -// and provides the response with a set of allowed methods for the request URL Path. -// As for any filter, you can also install it for a particular WebService within a Container. -// Note: this filter is not needed when using CrossOriginResourceSharing (for CORS). -func (c *Container) OPTIONSFilter(req *Request, resp *Response, chain *FilterChain) { - if "OPTIONS" != req.Request.Method { - chain.ProcessFilter(req, resp) - return - } - - archs := req.Request.Header.Get(HEADER_AccessControlRequestHeaders) - methods := strings.Join(c.computeAllowedMethods(req), ",") - origin := req.Request.Header.Get(HEADER_Origin) - - resp.AddHeader(HEADER_Allow, methods) - resp.AddHeader(HEADER_AccessControlAllowOrigin, origin) - resp.AddHeader(HEADER_AccessControlAllowHeaders, archs) - resp.AddHeader(HEADER_AccessControlAllowMethods, methods) -} - -// OPTIONSFilter is a filter function that inspects the Http Request for the OPTIONS method -// and provides the response with a set of allowed methods for the request URL Path. -// Note: this filter is not needed when using CrossOriginResourceSharing (for CORS). -func OPTIONSFilter() FilterFunction { - return DefaultContainer.OPTIONSFilter -} diff --git a/vendor/github.com/emicklei/go-restful/v3/parameter.go b/vendor/github.com/emicklei/go-restful/v3/parameter.go deleted file mode 100644 index 0b851bb43..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/parameter.go +++ /dev/null @@ -1,242 +0,0 @@ -package restful - -import "sort" - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -const ( - // PathParameterKind = indicator of Request parameter type "path" - PathParameterKind = iota - - // QueryParameterKind = indicator of Request parameter type "query" - QueryParameterKind - - // BodyParameterKind = indicator of Request parameter type "body" - BodyParameterKind - - // HeaderParameterKind = indicator of Request parameter type "header" - HeaderParameterKind - - // FormParameterKind = indicator of Request parameter type "form" - FormParameterKind - - // MultiPartFormParameterKind = indicator of Request parameter type "multipart/form-data" - MultiPartFormParameterKind - - // CollectionFormatCSV comma separated values `foo,bar` - CollectionFormatCSV = CollectionFormat("csv") - - // CollectionFormatSSV space separated values `foo bar` - CollectionFormatSSV = CollectionFormat("ssv") - - // CollectionFormatTSV tab separated values `foo\tbar` - CollectionFormatTSV = CollectionFormat("tsv") - - // CollectionFormatPipes pipe separated values `foo|bar` - CollectionFormatPipes = CollectionFormat("pipes") - - // CollectionFormatMulti corresponds to multiple parameter instances instead of multiple values for a single - // instance `foo=bar&foo=baz`. This is valid only for QueryParameters and FormParameters - CollectionFormatMulti = CollectionFormat("multi") -) - -type CollectionFormat string - -func (cf CollectionFormat) String() string { - return string(cf) -} - -// Parameter is for documententing the parameter used in a Http Request -// ParameterData kinds are Path,Query and Body -type Parameter struct { - data *ParameterData -} - -// ParameterData represents the state of a Parameter. -// It is made public to make it accessible to e.g. the Swagger package. -type ParameterData struct { - ExtensionProperties - Name, Description, DataType, DataFormat string - Kind int - Required bool - // AllowableValues is deprecated. Use PossibleValues instead - AllowableValues map[string]string - PossibleValues []string - AllowMultiple bool - AllowEmptyValue bool - DefaultValue string - CollectionFormat string - Pattern string - Minimum *float64 - Maximum *float64 - MinLength *int64 - MaxLength *int64 - MinItems *int64 - MaxItems *int64 - UniqueItems bool -} - -// Data returns the state of the Parameter -func (p *Parameter) Data() ParameterData { - return *p.data -} - -// Kind returns the parameter type indicator (see const for valid values) -func (p *Parameter) Kind() int { - return p.data.Kind -} - -func (p *Parameter) bePath() *Parameter { - p.data.Kind = PathParameterKind - return p -} -func (p *Parameter) beQuery() *Parameter { - p.data.Kind = QueryParameterKind - return p -} -func (p *Parameter) beBody() *Parameter { - p.data.Kind = BodyParameterKind - return p -} - -func (p *Parameter) beHeader() *Parameter { - p.data.Kind = HeaderParameterKind - return p -} - -func (p *Parameter) beForm() *Parameter { - p.data.Kind = FormParameterKind - return p -} - -func (p *Parameter) beMultiPartForm() *Parameter { - p.data.Kind = MultiPartFormParameterKind - return p -} - -// Required sets the required field and returns the receiver -func (p *Parameter) Required(required bool) *Parameter { - p.data.Required = required - return p -} - -// AllowMultiple sets the allowMultiple field and returns the receiver -func (p *Parameter) AllowMultiple(multiple bool) *Parameter { - p.data.AllowMultiple = multiple - return p -} - -// AddExtension adds or updates a key=value pair to the extension map -func (p *Parameter) AddExtension(key string, value interface{}) *Parameter { - p.data.AddExtension(key, value) - return p -} - -// AllowEmptyValue sets the AllowEmptyValue field and returns the receiver -func (p *Parameter) AllowEmptyValue(multiple bool) *Parameter { - p.data.AllowEmptyValue = multiple - return p -} - -// AllowableValues is deprecated. Use PossibleValues instead. Both will be set. -func (p *Parameter) AllowableValues(values map[string]string) *Parameter { - p.data.AllowableValues = values - - allowableSortedKeys := make([]string, 0, len(values)) - for k := range values { - allowableSortedKeys = append(allowableSortedKeys, k) - } - sort.Strings(allowableSortedKeys) - - p.data.PossibleValues = make([]string, 0, len(values)) - for _, k := range allowableSortedKeys { - p.data.PossibleValues = append(p.data.PossibleValues, values[k]) - } - return p -} - -// PossibleValues sets the possible values field and returns the receiver -func (p *Parameter) PossibleValues(values []string) *Parameter { - p.data.PossibleValues = values - return p -} - -// DataType sets the dataType field and returns the receiver -func (p *Parameter) DataType(typeName string) *Parameter { - p.data.DataType = typeName - return p -} - -// DataFormat sets the dataFormat field for Swagger UI -func (p *Parameter) DataFormat(formatName string) *Parameter { - p.data.DataFormat = formatName - return p -} - -// DefaultValue sets the default value field and returns the receiver -func (p *Parameter) DefaultValue(stringRepresentation string) *Parameter { - p.data.DefaultValue = stringRepresentation - return p -} - -// Description sets the description value field and returns the receiver -func (p *Parameter) Description(doc string) *Parameter { - p.data.Description = doc - return p -} - -// CollectionFormat sets the collection format for an array type -func (p *Parameter) CollectionFormat(format CollectionFormat) *Parameter { - p.data.CollectionFormat = format.String() - return p -} - -// Pattern sets the pattern field and returns the receiver -func (p *Parameter) Pattern(pattern string) *Parameter { - p.data.Pattern = pattern - return p -} - -// Minimum sets the minimum field and returns the receiver -func (p *Parameter) Minimum(minimum float64) *Parameter { - p.data.Minimum = &minimum - return p -} - -// Maximum sets the maximum field and returns the receiver -func (p *Parameter) Maximum(maximum float64) *Parameter { - p.data.Maximum = &maximum - return p -} - -// MinLength sets the minLength field and returns the receiver -func (p *Parameter) MinLength(minLength int64) *Parameter { - p.data.MinLength = &minLength - return p -} - -// MaxLength sets the maxLength field and returns the receiver -func (p *Parameter) MaxLength(maxLength int64) *Parameter { - p.data.MaxLength = &maxLength - return p -} - -// MinItems sets the minItems field and returns the receiver -func (p *Parameter) MinItems(minItems int64) *Parameter { - p.data.MinItems = &minItems - return p -} - -// MaxItems sets the maxItems field and returns the receiver -func (p *Parameter) MaxItems(maxItems int64) *Parameter { - p.data.MaxItems = &maxItems - return p -} - -// UniqueItems sets the uniqueItems field and returns the receiver -func (p *Parameter) UniqueItems(uniqueItems bool) *Parameter { - p.data.UniqueItems = uniqueItems - return p -} diff --git a/vendor/github.com/emicklei/go-restful/v3/path_expression.go b/vendor/github.com/emicklei/go-restful/v3/path_expression.go deleted file mode 100644 index 95a9a2545..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/path_expression.go +++ /dev/null @@ -1,74 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "bytes" - "fmt" - "regexp" - "strings" -) - -// PathExpression holds a compiled path expression (RegExp) needed to match against -// Http request paths and to extract path parameter values. -type pathExpression struct { - LiteralCount int // the number of literal characters (means those not resulting from template variable substitution) - VarNames []string // the names of parameters (enclosed by {}) in the path - VarCount int // the number of named parameters (enclosed by {}) in the path - Matcher *regexp.Regexp - Source string // Path as defined by the RouteBuilder - tokens []string -} - -// NewPathExpression creates a PathExpression from the input URL path. -// Returns an error if the path is invalid. -func newPathExpression(path string) (*pathExpression, error) { - expression, literalCount, varNames, varCount, tokens := templateToRegularExpression(path) - compiled, err := regexp.Compile(expression) - if err != nil { - return nil, err - } - return &pathExpression{literalCount, varNames, varCount, compiled, expression, tokens}, nil -} - -// http://jsr311.java.net/nonav/releases/1.1/spec/spec3.html#x3-370003.7.3 -func templateToRegularExpression(template string) (expression string, literalCount int, varNames []string, varCount int, tokens []string) { - var buffer bytes.Buffer - buffer.WriteString("^") - //tokens = strings.Split(template, "/") - tokens = tokenizePath(template) - for _, each := range tokens { - if each == "" { - continue - } - buffer.WriteString("/") - if strings.HasPrefix(each, "{") { - // check for regular expression in variable - colon := strings.Index(each, ":") - var varName string - if colon != -1 { - // extract expression - varName = strings.TrimSpace(each[1:colon]) - paramExpr := strings.TrimSpace(each[colon+1 : len(each)-1]) - if paramExpr == "*" { // special case - buffer.WriteString("(.*)") - } else { - buffer.WriteString(fmt.Sprintf("(%s)", paramExpr)) // between colon and closing moustache - } - } else { - // plain var - varName = strings.TrimSpace(each[1 : len(each)-1]) - buffer.WriteString("([^/]+?)") - } - varNames = append(varNames, varName) - varCount += 1 - } else { - literalCount += len(each) - encoded := each // TODO URI encode - buffer.WriteString(regexp.QuoteMeta(encoded)) - } - } - return strings.TrimRight(buffer.String(), "/") + "(/.*)?$", literalCount, varNames, varCount, tokens -} diff --git a/vendor/github.com/emicklei/go-restful/v3/path_processor.go b/vendor/github.com/emicklei/go-restful/v3/path_processor.go deleted file mode 100644 index 141573245..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/path_processor.go +++ /dev/null @@ -1,74 +0,0 @@ -package restful - -import ( - "bytes" - "strings" -) - -// Copyright 2018 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -// PathProcessor is extra behaviour that a Router can provide to extract path parameters from the path. -// If a Router does not implement this interface then the default behaviour will be used. -type PathProcessor interface { - // ExtractParameters gets the path parameters defined in the route and webService from the urlPath - ExtractParameters(route *Route, webService *WebService, urlPath string) map[string]string -} - -type defaultPathProcessor struct{} - -// Extract the parameters from the request url path -func (d defaultPathProcessor) ExtractParameters(r *Route, _ *WebService, urlPath string) map[string]string { - urlParts := tokenizePath(urlPath) - pathParameters := map[string]string{} - for i, key := range r.pathParts { - var value string - if i >= len(urlParts) { - value = "" - } else { - value = urlParts[i] - } - if r.hasCustomVerb && hasCustomVerb(key) { - key = removeCustomVerb(key) - value = removeCustomVerb(value) - } - - if strings.Index(key, "{") > -1 { // path-parameter - if colon := strings.Index(key, ":"); colon != -1 { - // extract by regex - regPart := key[colon+1 : len(key)-1] - keyPart := key[1:colon] - if regPart == "*" { - pathParameters[keyPart] = untokenizePath(i, urlParts) - break - } else { - pathParameters[keyPart] = value - } - } else { - // without enclosing {} - startIndex := strings.Index(key, "{") - endKeyIndex := strings.Index(key, "}") - - suffixLength := len(key) - endKeyIndex - 1 - endValueIndex := len(value) - suffixLength - - pathParameters[key[startIndex+1:endKeyIndex]] = value[startIndex:endValueIndex] - } - } - } - return pathParameters -} - -// Untokenize back into an URL path using the slash separator -func untokenizePath(offset int, parts []string) string { - var buffer bytes.Buffer - for p := offset; p < len(parts); p++ { - buffer.WriteString(parts[p]) - // do not end - if p < len(parts)-1 { - buffer.WriteString("/") - } - } - return buffer.String() -} diff --git a/vendor/github.com/emicklei/go-restful/v3/request.go b/vendor/github.com/emicklei/go-restful/v3/request.go deleted file mode 100644 index 0020095e8..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/request.go +++ /dev/null @@ -1,133 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "compress/zlib" - "net/http" -) - -var defaultRequestContentType string - -// Request is a wrapper for a http Request that provides convenience methods -type Request struct { - Request *http.Request - pathParameters map[string]string - attributes map[string]interface{} // for storing request-scoped values - selectedRoute *Route // is nil when no route was matched -} - -func NewRequest(httpRequest *http.Request) *Request { - return &Request{ - Request: httpRequest, - pathParameters: map[string]string{}, - attributes: map[string]interface{}{}, - } // empty parameters, attributes -} - -// If ContentType is missing or */* is given then fall back to this type, otherwise -// a "Unable to unmarshal content of type:" response is returned. -// Valid values are restful.MIME_JSON and restful.MIME_XML -// Example: -// -// restful.DefaultRequestContentType(restful.MIME_JSON) -func DefaultRequestContentType(mime string) { - defaultRequestContentType = mime -} - -// PathParameter accesses the Path parameter value by its name -func (r *Request) PathParameter(name string) string { - return r.pathParameters[name] -} - -// PathParameters accesses the Path parameter values -func (r *Request) PathParameters() map[string]string { - return r.pathParameters -} - -// QueryParameter returns the (first) Query parameter value by its name -func (r *Request) QueryParameter(name string) string { - return r.Request.URL.Query().Get(name) -} - -// QueryParameters returns the all the query parameters values by name -func (r *Request) QueryParameters(name string) []string { - return r.Request.URL.Query()[name] -} - -// BodyParameter parses the body of the request (once for typically a POST or a PUT) and returns the value of the given name or an error. -func (r *Request) BodyParameter(name string) (string, error) { - err := r.Request.ParseForm() - if err != nil { - return "", err - } - return r.Request.PostFormValue(name), nil -} - -// HeaderParameter returns the HTTP Header value of a Header name or empty if missing -func (r *Request) HeaderParameter(name string) string { - return r.Request.Header.Get(name) -} - -// ReadEntity checks the Accept header and reads the content into the entityPointer. -func (r *Request) ReadEntity(entityPointer interface{}) (err error) { - contentType := r.Request.Header.Get(HEADER_ContentType) - contentEncoding := r.Request.Header.Get(HEADER_ContentEncoding) - - // check if the request body needs decompression - if ENCODING_GZIP == contentEncoding { - gzipReader := currentCompressorProvider.AcquireGzipReader() - defer currentCompressorProvider.ReleaseGzipReader(gzipReader) - gzipReader.Reset(r.Request.Body) - r.Request.Body = gzipReader - } else if ENCODING_DEFLATE == contentEncoding { - zlibReader, err := zlib.NewReader(r.Request.Body) - if err != nil { - return err - } - r.Request.Body = zlibReader - } - - // lookup the EntityReader, use defaultRequestContentType if needed and provided - entityReader, ok := entityAccessRegistry.accessorAt(contentType) - if !ok { - if len(defaultRequestContentType) != 0 { - entityReader, ok = entityAccessRegistry.accessorAt(defaultRequestContentType) - } - if !ok { - return NewError(http.StatusBadRequest, "Unable to unmarshal content of type:"+contentType) - } - } - return entityReader.Read(r, entityPointer) -} - -// SetAttribute adds or replaces the attribute with the given value. -func (r *Request) SetAttribute(name string, value interface{}) { - r.attributes[name] = value -} - -// Attribute returns the value associated to the given name. Returns nil if absent. -func (r Request) Attribute(name string) interface{} { - return r.attributes[name] -} - -// SelectedRoutePath root path + route path that matched the request, e.g. /meetings/{id}/attendees -// If no route was matched then return an empty string. -func (r Request) SelectedRoutePath() string { - if r.selectedRoute == nil { - return "" - } - // skip creating an accessor - return r.selectedRoute.Path -} - -// SelectedRoute returns a reader to access the selected Route by the container -// Returns nil if no route was matched. -func (r Request) SelectedRoute() RouteReader { - if r.selectedRoute == nil { - return nil - } - return routeAccessor{route: r.selectedRoute} -} diff --git a/vendor/github.com/emicklei/go-restful/v3/response.go b/vendor/github.com/emicklei/go-restful/v3/response.go deleted file mode 100644 index a41a92cc2..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/response.go +++ /dev/null @@ -1,259 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "bufio" - "errors" - "net" - "net/http" -) - -// DefaultResponseMimeType is DEPRECATED, use DefaultResponseContentType(mime) -var DefaultResponseMimeType string - -//PrettyPrintResponses controls the indentation feature of XML and JSON serialization -var PrettyPrintResponses = true - -// Response is a wrapper on the actual http ResponseWriter -// It provides several convenience methods to prepare and write response content. -type Response struct { - http.ResponseWriter - requestAccept string // mime-type what the Http Request says it wants to receive - routeProduces []string // mime-types what the Route says it can produce - statusCode int // HTTP status code that has been written explicitly (if zero then net/http has written 200) - contentLength int // number of bytes written for the response body - prettyPrint bool // controls the indentation feature of XML and JSON serialization. It is initialized using var PrettyPrintResponses. - err error // err property is kept when WriteError is called - hijacker http.Hijacker // if underlying ResponseWriter supports it -} - -// NewResponse creates a new response based on a http ResponseWriter. -func NewResponse(httpWriter http.ResponseWriter) *Response { - hijacker, _ := httpWriter.(http.Hijacker) - return &Response{ResponseWriter: httpWriter, routeProduces: []string{}, statusCode: http.StatusOK, prettyPrint: PrettyPrintResponses, hijacker: hijacker} -} - -// DefaultResponseContentType set a default. -// If Accept header matching fails, fall back to this type. -// Valid values are restful.MIME_JSON and restful.MIME_XML -// Example: -// restful.DefaultResponseContentType(restful.MIME_JSON) -func DefaultResponseContentType(mime string) { - DefaultResponseMimeType = mime -} - -// InternalServerError writes the StatusInternalServerError header. -// DEPRECATED, use WriteErrorString(http.StatusInternalServerError,reason) -func (r Response) InternalServerError() Response { - r.WriteHeader(http.StatusInternalServerError) - return r -} - -// Hijack implements the http.Hijacker interface. This expands -// the Response to fulfill http.Hijacker if the underlying -// http.ResponseWriter supports it. -func (r *Response) Hijack() (net.Conn, *bufio.ReadWriter, error) { - if r.hijacker == nil { - return nil, nil, errors.New("http.Hijacker not implemented by underlying http.ResponseWriter") - } - return r.hijacker.Hijack() -} - -// PrettyPrint changes whether this response must produce pretty (line-by-line, indented) JSON or XML output. -func (r *Response) PrettyPrint(bePretty bool) { - r.prettyPrint = bePretty -} - -// AddHeader is a shortcut for .Header().Add(header,value) -func (r Response) AddHeader(header string, value string) Response { - r.Header().Add(header, value) - return r -} - -// SetRequestAccepts tells the response what Mime-type(s) the HTTP request said it wants to accept. Exposed for testing. -func (r *Response) SetRequestAccepts(mime string) { - r.requestAccept = mime -} - -// EntityWriter returns the registered EntityWriter that the entity (requested resource) -// can write according to what the request wants (Accept) and what the Route can produce or what the restful defaults say. -// If called before WriteEntity and WriteHeader then a false return value can be used to write a 406: Not Acceptable. -func (r *Response) EntityWriter() (EntityReaderWriter, bool) { - sorted := sortedMimes(r.requestAccept) - for _, eachAccept := range sorted { - for _, eachProduce := range r.routeProduces { - if eachProduce == eachAccept.media { - if w, ok := entityAccessRegistry.accessorAt(eachAccept.media); ok { - return w, true - } - } - } - if eachAccept.media == "*/*" { - for _, each := range r.routeProduces { - if w, ok := entityAccessRegistry.accessorAt(each); ok { - return w, true - } - } - } - } - // if requestAccept is empty - writer, ok := entityAccessRegistry.accessorAt(r.requestAccept) - if !ok { - // if not registered then fallback to the defaults (if set) - if DefaultResponseMimeType == MIME_JSON { - return entityAccessRegistry.accessorAt(MIME_JSON) - } - if DefaultResponseMimeType == MIME_XML { - return entityAccessRegistry.accessorAt(MIME_XML) - } - if DefaultResponseMimeType == MIME_ZIP { - return entityAccessRegistry.accessorAt(MIME_ZIP) - } - // Fallback to whatever the route says it can produce. - // https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html - for _, each := range r.routeProduces { - if w, ok := entityAccessRegistry.accessorAt(each); ok { - return w, true - } - } - if trace { - traceLogger.Printf("no registered EntityReaderWriter found for %s", r.requestAccept) - } - } - return writer, ok -} - -// WriteEntity calls WriteHeaderAndEntity with Http Status OK (200) -func (r *Response) WriteEntity(value interface{}) error { - return r.WriteHeaderAndEntity(http.StatusOK, value) -} - -// WriteHeaderAndEntity marshals the value using the representation denoted by the Accept Header and the registered EntityWriters. -// If no Accept header is specified (or */*) then respond with the Content-Type as specified by the first in the Route.Produces. -// If an Accept header is specified then respond with the Content-Type as specified by the first in the Route.Produces that is matched with the Accept header. -// If the value is nil then no response is send except for the Http status. You may want to call WriteHeader(http.StatusNotFound) instead. -// If there is no writer available that can represent the value in the requested MIME type then Http Status NotAcceptable is written. -// Current implementation ignores any q-parameters in the Accept Header. -// Returns an error if the value could not be written on the response. -func (r *Response) WriteHeaderAndEntity(status int, value interface{}) error { - writer, ok := r.EntityWriter() - if !ok { - r.WriteHeader(http.StatusNotAcceptable) - return nil - } - return writer.Write(r, status, value) -} - -// WriteAsXml is a convenience method for writing a value in xml (requires Xml tags on the value) -// It uses the standard encoding/xml package for marshalling the value ; not using a registered EntityReaderWriter. -func (r *Response) WriteAsXml(value interface{}) error { - return writeXML(r, http.StatusOK, MIME_XML, value) -} - -// WriteHeaderAndXml is a convenience method for writing a status and value in xml (requires Xml tags on the value) -// It uses the standard encoding/xml package for marshalling the value ; not using a registered EntityReaderWriter. -func (r *Response) WriteHeaderAndXml(status int, value interface{}) error { - return writeXML(r, status, MIME_XML, value) -} - -// WriteAsJson is a convenience method for writing a value in json. -// It uses the standard encoding/json package for marshalling the value ; not using a registered EntityReaderWriter. -func (r *Response) WriteAsJson(value interface{}) error { - return writeJSON(r, http.StatusOK, MIME_JSON, value) -} - -// WriteJson is a convenience method for writing a value in Json with a given Content-Type. -// It uses the standard encoding/json package for marshalling the value ; not using a registered EntityReaderWriter. -func (r *Response) WriteJson(value interface{}, contentType string) error { - return writeJSON(r, http.StatusOK, contentType, value) -} - -// WriteHeaderAndJson is a convenience method for writing the status and a value in Json with a given Content-Type. -// It uses the standard encoding/json package for marshalling the value ; not using a registered EntityReaderWriter. -func (r *Response) WriteHeaderAndJson(status int, value interface{}, contentType string) error { - return writeJSON(r, status, contentType, value) -} - -// WriteError writes the http status and the error string on the response. err can be nil. -// Return an error if writing was not successful. -func (r *Response) WriteError(httpStatus int, err error) (writeErr error) { - r.err = err - if err == nil { - writeErr = r.WriteErrorString(httpStatus, "") - } else { - writeErr = r.WriteErrorString(httpStatus, err.Error()) - } - return writeErr -} - -// WriteServiceError is a convenience method for a responding with a status and a ServiceError -func (r *Response) WriteServiceError(httpStatus int, err ServiceError) error { - r.err = err - return r.WriteHeaderAndEntity(httpStatus, err) -} - -// WriteErrorString is a convenience method for an error status with the actual error -func (r *Response) WriteErrorString(httpStatus int, errorReason string) error { - if r.err == nil { - // if not called from WriteError - r.err = errors.New(errorReason) - } - r.WriteHeader(httpStatus) - if _, err := r.Write([]byte(errorReason)); err != nil { - return err - } - return nil -} - -// Flush implements http.Flusher interface, which sends any buffered data to the client. -func (r *Response) Flush() { - if f, ok := r.ResponseWriter.(http.Flusher); ok { - f.Flush() - } else if trace { - traceLogger.Printf("ResponseWriter %v doesn't support Flush", r) - } -} - -// WriteHeader is overridden to remember the Status Code that has been written. -// Changes to the Header of the response have no effect after this. -func (r *Response) WriteHeader(httpStatus int) { - r.statusCode = httpStatus - r.ResponseWriter.WriteHeader(httpStatus) -} - -// StatusCode returns the code that has been written using WriteHeader. -func (r Response) StatusCode() int { - if 0 == r.statusCode { - // no status code has been written yet; assume OK - return http.StatusOK - } - return r.statusCode -} - -// Write writes the data to the connection as part of an HTTP reply. -// Write is part of http.ResponseWriter interface. -func (r *Response) Write(bytes []byte) (int, error) { - written, err := r.ResponseWriter.Write(bytes) - r.contentLength += written - return written, err -} - -// ContentLength returns the number of bytes written for the response content. -// Note that this value is only correct if all data is written through the Response using its Write* methods. -// Data written directly using the underlying http.ResponseWriter is not accounted for. -func (r Response) ContentLength() int { - return r.contentLength -} - -// CloseNotify is part of http.CloseNotifier interface -func (r Response) CloseNotify() <-chan bool { - return r.ResponseWriter.(http.CloseNotifier).CloseNotify() -} - -// Error returns the err created by WriteError -func (r Response) Error() error { - return r.err -} diff --git a/vendor/github.com/emicklei/go-restful/v3/route.go b/vendor/github.com/emicklei/go-restful/v3/route.go deleted file mode 100644 index 306c44be7..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/route.go +++ /dev/null @@ -1,191 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "net/http" - "strings" -) - -// RouteFunction declares the signature of a function that can be bound to a Route. -type RouteFunction func(*Request, *Response) - -// RouteSelectionConditionFunction declares the signature of a function that -// can be used to add extra conditional logic when selecting whether the route -// matches the HTTP request. -type RouteSelectionConditionFunction func(httpRequest *http.Request) bool - -// Route binds a HTTP Method,Path,Consumes combination to a RouteFunction. -type Route struct { - ExtensionProperties - Method string - Produces []string - Consumes []string - Path string // webservice root path + described path - Function RouteFunction - Filters []FilterFunction - If []RouteSelectionConditionFunction - - // cached values for dispatching - relativePath string - pathParts []string - pathExpr *pathExpression // cached compilation of relativePath as RegExp - - // documentation - Doc string - Notes string - Operation string - ParameterDocs []*Parameter - ResponseErrors map[int]ResponseError - DefaultResponse *ResponseError - ReadSample, WriteSample interface{} // structs that model an example request or response payload - WriteSamples []interface{} // if more than one return types is possible (oneof) then this will contain multiple values - - // Extra information used to store custom information about the route. - Metadata map[string]interface{} - - // marks a route as deprecated - Deprecated bool - - //Overrides the container.contentEncodingEnabled - contentEncodingEnabled *bool - - // indicate route path has custom verb - hasCustomVerb bool - - // if a request does not include a content-type header then - // depending on the method, it may return a 415 Unsupported Media - // Must have uppercase HTTP Method names such as GET,HEAD,OPTIONS,... - allowedMethodsWithoutContentType []string -} - -// Initialize for Route -func (r *Route) postBuild() { - r.pathParts = tokenizePath(r.Path) - r.hasCustomVerb = hasCustomVerb(r.Path) -} - -// Create Request and Response from their http versions -func (r *Route) wrapRequestResponse(httpWriter http.ResponseWriter, httpRequest *http.Request, pathParams map[string]string) (*Request, *Response) { - wrappedRequest := NewRequest(httpRequest) - wrappedRequest.pathParameters = pathParams - wrappedRequest.selectedRoute = r - wrappedResponse := NewResponse(httpWriter) - wrappedResponse.requestAccept = httpRequest.Header.Get(HEADER_Accept) - wrappedResponse.routeProduces = r.Produces - return wrappedRequest, wrappedResponse -} - -func stringTrimSpaceCutset(r rune) bool { - return r == ' ' -} - -// Return whether the mimeType matches to what this Route can produce. -func (r Route) matchesAccept(mimeTypesWithQuality string) bool { - remaining := mimeTypesWithQuality - for { - var mimeType string - if end := strings.Index(remaining, ","); end == -1 { - mimeType, remaining = remaining, "" - } else { - mimeType, remaining = remaining[:end], remaining[end+1:] - } - if quality := strings.Index(mimeType, ";"); quality != -1 { - mimeType = mimeType[:quality] - } - mimeType = strings.TrimFunc(mimeType, stringTrimSpaceCutset) - if mimeType == "*/*" { - return true - } - for _, producibleType := range r.Produces { - if producibleType == "*/*" || producibleType == mimeType { - return true - } - } - if len(remaining) == 0 { - return false - } - } -} - -// Return whether this Route can consume content with a type specified by mimeTypes (can be empty). -func (r Route) matchesContentType(mimeTypes string) bool { - - if len(r.Consumes) == 0 { - // did not specify what it can consume ; any media type (“*/*”) is assumed - return true - } - - if len(mimeTypes) == 0 { - // idempotent methods with (most-likely or guaranteed) empty content match missing Content-Type - m := r.Method - // if route specifies less or non-idempotent methods then use that - if len(r.allowedMethodsWithoutContentType) > 0 { - for _, each := range r.allowedMethodsWithoutContentType { - if m == each { - return true - } - } - } else { - if m == "GET" || m == "HEAD" || m == "OPTIONS" || m == "DELETE" || m == "TRACE" { - return true - } - } - // proceed with default - mimeTypes = MIME_OCTET - } - - remaining := mimeTypes - for { - var mimeType string - if end := strings.Index(remaining, ","); end == -1 { - mimeType, remaining = remaining, "" - } else { - mimeType, remaining = remaining[:end], remaining[end+1:] - } - if quality := strings.Index(mimeType, ";"); quality != -1 { - mimeType = mimeType[:quality] - } - mimeType = strings.TrimFunc(mimeType, stringTrimSpaceCutset) - for _, consumeableType := range r.Consumes { - if consumeableType == "*/*" || consumeableType == mimeType { - return true - } - } - if len(remaining) == 0 { - return false - } - } -} - -// Tokenize an URL path using the slash separator ; the result does not have empty tokens -func tokenizePath(path string) []string { - if "/" == path { - return nil - } - if TrimRightSlashEnabled { - // 3.9.0 - return strings.Split(strings.Trim(path, "/"), "/") - } else { - // 3.10.2 - return strings.Split(strings.TrimLeft(path, "/"), "/") - } -} - -// for debugging -func (r *Route) String() string { - return r.Method + " " + r.Path -} - -// EnableContentEncoding (default=false) allows for GZIP or DEFLATE encoding of responses. Overrides the container.contentEncodingEnabled value. -func (r *Route) EnableContentEncoding(enabled bool) { - r.contentEncodingEnabled = &enabled -} - -// TrimRightSlashEnabled controls whether -// - path on route building is using path.Join -// - the path of the incoming request is trimmed of its slash suffux. -// Value of true matches the behavior of <= 3.9.0 -var TrimRightSlashEnabled = true diff --git a/vendor/github.com/emicklei/go-restful/v3/route_builder.go b/vendor/github.com/emicklei/go-restful/v3/route_builder.go deleted file mode 100644 index 75168c12e..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/route_builder.go +++ /dev/null @@ -1,389 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "fmt" - "os" - "path" - "reflect" - "runtime" - "strings" - "sync/atomic" - - "github.com/emicklei/go-restful/v3/log" -) - -// RouteBuilder is a helper to construct Routes. -type RouteBuilder struct { - rootPath string - currentPath string - produces []string - consumes []string - httpMethod string // required - function RouteFunction // required - filters []FilterFunction - conditions []RouteSelectionConditionFunction - allowedMethodsWithoutContentType []string // see Route - - typeNameHandleFunc TypeNameHandleFunction // required - - // documentation - doc string - notes string - operation string - readSample interface{} - writeSamples []interface{} - parameters []*Parameter - errorMap map[int]ResponseError - defaultResponse *ResponseError - metadata map[string]interface{} - extensions map[string]interface{} - deprecated bool - contentEncodingEnabled *bool -} - -// Do evaluates each argument with the RouteBuilder itself. -// This allows you to follow DRY principles without breaking the fluent programming style. -// Example: -// -// ws.Route(ws.DELETE("/{name}").To(t.deletePerson).Do(Returns200, Returns500)) -// -// func Returns500(b *RouteBuilder) { -// b.Returns(500, "Internal Server Error", restful.ServiceError{}) -// } -func (b *RouteBuilder) Do(oneArgBlocks ...func(*RouteBuilder)) *RouteBuilder { - for _, each := range oneArgBlocks { - each(b) - } - return b -} - -// To bind the route to a function. -// If this route is matched with the incoming Http Request then call this function with the *Request,*Response pair. Required. -func (b *RouteBuilder) To(function RouteFunction) *RouteBuilder { - b.function = function - return b -} - -// Method specifies what HTTP method to match. Required. -func (b *RouteBuilder) Method(method string) *RouteBuilder { - b.httpMethod = method - return b -} - -// Produces specifies what MIME types can be produced ; the matched one will appear in the Content-Type Http header. -func (b *RouteBuilder) Produces(mimeTypes ...string) *RouteBuilder { - b.produces = mimeTypes - return b -} - -// Consumes specifies what MIME types can be consumes ; the Accept Http header must matched any of these -func (b *RouteBuilder) Consumes(mimeTypes ...string) *RouteBuilder { - b.consumes = mimeTypes - return b -} - -// Path specifies the relative (w.r.t WebService root path) URL path to match. Default is "/". -func (b *RouteBuilder) Path(subPath string) *RouteBuilder { - b.currentPath = subPath - return b -} - -// Doc tells what this route is all about. Optional. -func (b *RouteBuilder) Doc(documentation string) *RouteBuilder { - b.doc = documentation - return b -} - -// Notes is a verbose explanation of the operation behavior. Optional. -func (b *RouteBuilder) Notes(notes string) *RouteBuilder { - b.notes = notes - return b -} - -// Reads tells what resource type will be read from the request payload. Optional. -// A parameter of type "body" is added ,required is set to true and the dataType is set to the qualified name of the sample's type. -func (b *RouteBuilder) Reads(sample interface{}, optionalDescription ...string) *RouteBuilder { - fn := b.typeNameHandleFunc - if fn == nil { - fn = reflectTypeName - } - typeAsName := fn(sample) - description := "" - if len(optionalDescription) > 0 { - description = optionalDescription[0] - } - b.readSample = sample - bodyParameter := &Parameter{&ParameterData{Name: "body", Description: description}} - bodyParameter.beBody() - bodyParameter.Required(true) - bodyParameter.DataType(typeAsName) - b.Param(bodyParameter) - return b -} - -// ParameterNamed returns a Parameter already known to the RouteBuilder. Returns nil if not. -// Use this to modify or extend information for the Parameter (through its Data()). -func (b RouteBuilder) ParameterNamed(name string) (p *Parameter) { - for _, each := range b.parameters { - if each.Data().Name == name { - return each - } - } - return p -} - -// Writes tells which one of the resource types will be written as the response payload. Optional. -func (b *RouteBuilder) Writes(samples ...interface{}) *RouteBuilder { - b.writeSamples = samples // oneof - return b -} - -// Param allows you to document the parameters of the Route. It adds a new Parameter (does not check for duplicates). -func (b *RouteBuilder) Param(parameter *Parameter) *RouteBuilder { - if b.parameters == nil { - b.parameters = []*Parameter{} - } - b.parameters = append(b.parameters, parameter) - return b -} - -// Operation allows you to document what the actual method/function call is of the Route. -// Unless called, the operation name is derived from the RouteFunction set using To(..). -func (b *RouteBuilder) Operation(name string) *RouteBuilder { - b.operation = name - return b -} - -// ReturnsError is deprecated, use Returns instead. -func (b *RouteBuilder) ReturnsError(code int, message string, model interface{}) *RouteBuilder { - log.Print("ReturnsError is deprecated, use Returns instead.") - return b.Returns(code, message, model) -} - -// Returns allows you to document what responses (errors or regular) can be expected. -// The model parameter is optional ; either pass a struct instance or use nil if not applicable. -func (b *RouteBuilder) Returns(code int, message string, model interface{}) *RouteBuilder { - err := ResponseError{ - Code: code, - Message: message, - Model: model, - IsDefault: false, // this field is deprecated, use default response instead. - } - // lazy init because there is no NewRouteBuilder (yet) - if b.errorMap == nil { - b.errorMap = map[int]ResponseError{} - } - b.errorMap[code] = err - return b -} - -// ReturnsWithHeaders is similar to Returns, but can specify response headers -func (b *RouteBuilder) ReturnsWithHeaders(code int, message string, model interface{}, headers map[string]Header) *RouteBuilder { - b.Returns(code, message, model) - err := b.errorMap[code] - err.Headers = headers - b.errorMap[code] = err - return b -} - -// DefaultReturns is a special Returns call that sets the default of the response. -func (b *RouteBuilder) DefaultReturns(message string, model interface{}) *RouteBuilder { - b.defaultResponse = &ResponseError{ - Message: message, - Model: model, - } - return b -} - -// Metadata adds or updates a key=value pair to the metadata map. -func (b *RouteBuilder) Metadata(key string, value interface{}) *RouteBuilder { - if b.metadata == nil { - b.metadata = map[string]interface{}{} - } - b.metadata[key] = value - return b -} - -// AddExtension adds or updates a key=value pair to the extensions map. -func (b *RouteBuilder) AddExtension(key string, value interface{}) *RouteBuilder { - if b.extensions == nil { - b.extensions = map[string]interface{}{} - } - b.extensions[key] = value - return b -} - -// Deprecate sets the value of deprecated to true. Deprecated routes have a special UI treatment to warn against use -func (b *RouteBuilder) Deprecate() *RouteBuilder { - b.deprecated = true - return b -} - -// AllowedMethodsWithoutContentType overrides the default list GET,HEAD,OPTIONS,DELETE,TRACE -// If a request does not include a content-type header then -// depending on the method, it may return a 415 Unsupported Media. -// Must have uppercase HTTP Method names such as GET,HEAD,OPTIONS,... -func (b *RouteBuilder) AllowedMethodsWithoutContentType(methods []string) *RouteBuilder { - b.allowedMethodsWithoutContentType = methods - return b -} - -// ResponseError represents a response; not necessarily an error. -type ResponseError struct { - ExtensionProperties - Code int - Message string - Model interface{} - Headers map[string]Header - IsDefault bool -} - -// Header describes a header for a response of the API -// -// For more information: http://goo.gl/8us55a#headerObject -type Header struct { - *Items - Description string -} - -// Items describe swagger simple schemas for headers -type Items struct { - Type string - Format string - Items *Items - CollectionFormat string - Default interface{} -} - -func (b *RouteBuilder) servicePath(path string) *RouteBuilder { - b.rootPath = path - return b -} - -// Filter appends a FilterFunction to the end of filters for this Route to build. -func (b *RouteBuilder) Filter(filter FilterFunction) *RouteBuilder { - b.filters = append(b.filters, filter) - return b -} - -// If sets a condition function that controls matching the Route based on custom logic. -// The condition function is provided the HTTP request and should return true if the route -// should be considered. -// -// Efficiency note: the condition function is called before checking the method, produces, and -// consumes criteria, so that the correct HTTP status code can be returned. -// -// Lifecycle note: no filter functions have been called prior to calling the condition function, -// so the condition function should not depend on any context that might be set up by container -// or route filters. -func (b *RouteBuilder) If(condition RouteSelectionConditionFunction) *RouteBuilder { - b.conditions = append(b.conditions, condition) - return b -} - -// ContentEncodingEnabled allows you to override the Containers value for auto-compressing this route response. -func (b *RouteBuilder) ContentEncodingEnabled(enabled bool) *RouteBuilder { - b.contentEncodingEnabled = &enabled - return b -} - -// If no specific Route path then set to rootPath -// If no specific Produces then set to rootProduces -// If no specific Consumes then set to rootConsumes -func (b *RouteBuilder) copyDefaults(rootProduces, rootConsumes []string) { - if len(b.produces) == 0 { - b.produces = rootProduces - } - if len(b.consumes) == 0 { - b.consumes = rootConsumes - } -} - -// typeNameHandler sets the function that will convert types to strings in the parameter -// and model definitions. -func (b *RouteBuilder) typeNameHandler(handler TypeNameHandleFunction) *RouteBuilder { - b.typeNameHandleFunc = handler - return b -} - -// Build creates a new Route using the specification details collected by the RouteBuilder -func (b *RouteBuilder) Build() Route { - pathExpr, err := newPathExpression(b.currentPath) - if err != nil { - log.Printf("Invalid path:%s because:%v", b.currentPath, err) - os.Exit(1) - } - if b.function == nil { - log.Printf("No function specified for route:" + b.currentPath) - os.Exit(1) - } - operationName := b.operation - if len(operationName) == 0 && b.function != nil { - // extract from definition - operationName = nameOfFunction(b.function) - } - route := Route{ - Method: b.httpMethod, - Path: concatPath(b.rootPath, b.currentPath), - Produces: b.produces, - Consumes: b.consumes, - Function: b.function, - Filters: b.filters, - If: b.conditions, - relativePath: b.currentPath, - pathExpr: pathExpr, - Doc: b.doc, - Notes: b.notes, - Operation: operationName, - ParameterDocs: b.parameters, - ResponseErrors: b.errorMap, - DefaultResponse: b.defaultResponse, - ReadSample: b.readSample, - WriteSamples: b.writeSamples, - Metadata: b.metadata, - Deprecated: b.deprecated, - contentEncodingEnabled: b.contentEncodingEnabled, - allowedMethodsWithoutContentType: b.allowedMethodsWithoutContentType, - } - // set WriteSample if one specified - if len(b.writeSamples) == 1 { - route.WriteSample = b.writeSamples[0] - } - route.Extensions = b.extensions - route.postBuild() - return route -} - -// merge two paths using the current (package global) merge path strategy. -func concatPath(rootPath, routePath string) string { - - if TrimRightSlashEnabled { - return strings.TrimRight(rootPath, "/") + "/" + strings.TrimLeft(routePath, "/") - } else { - return path.Join(rootPath, routePath) - } -} - -var anonymousFuncCount int32 - -// nameOfFunction returns the short name of the function f for documentation. -// It uses a runtime feature for debugging ; its value may change for later Go versions. -func nameOfFunction(f interface{}) string { - fun := runtime.FuncForPC(reflect.ValueOf(f).Pointer()) - tokenized := strings.Split(fun.Name(), ".") - last := tokenized[len(tokenized)-1] - last = strings.TrimSuffix(last, ")·fm") // < Go 1.5 - last = strings.TrimSuffix(last, ")-fm") // Go 1.5 - last = strings.TrimSuffix(last, "·fm") // < Go 1.5 - last = strings.TrimSuffix(last, "-fm") // Go 1.5 - if last == "func1" { // this could mean conflicts in API docs - val := atomic.AddInt32(&anonymousFuncCount, 1) - last = "func" + fmt.Sprintf("%d", val) - atomic.StoreInt32(&anonymousFuncCount, val) - } - return last -} diff --git a/vendor/github.com/emicklei/go-restful/v3/route_reader.go b/vendor/github.com/emicklei/go-restful/v3/route_reader.go deleted file mode 100644 index c9f4ee75f..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/route_reader.go +++ /dev/null @@ -1,66 +0,0 @@ -package restful - -// Copyright 2021 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -type RouteReader interface { - Method() string - Consumes() []string - Path() string - Doc() string - Notes() string - Operation() string - ParameterDocs() []*Parameter - // Returns a copy - Metadata() map[string]interface{} - Deprecated() bool -} - -type routeAccessor struct { - route *Route -} - -func (r routeAccessor) Method() string { - return r.route.Method -} -func (r routeAccessor) Consumes() []string { - return r.route.Consumes[:] -} -func (r routeAccessor) Path() string { - return r.route.Path -} -func (r routeAccessor) Doc() string { - return r.route.Doc -} -func (r routeAccessor) Notes() string { - return r.route.Notes -} -func (r routeAccessor) Operation() string { - return r.route.Operation -} -func (r routeAccessor) ParameterDocs() []*Parameter { - return r.route.ParameterDocs[:] -} - -// Returns a copy -func (r routeAccessor) Metadata() map[string]interface{} { - return copyMap(r.route.Metadata) -} -func (r routeAccessor) Deprecated() bool { - return r.route.Deprecated -} - -// https://stackoverflow.com/questions/23057785/how-to-copy-a-map -func copyMap(m map[string]interface{}) map[string]interface{} { - cp := make(map[string]interface{}) - for k, v := range m { - vm, ok := v.(map[string]interface{}) - if ok { - cp[k] = copyMap(vm) - } else { - cp[k] = v - } - } - return cp -} diff --git a/vendor/github.com/emicklei/go-restful/v3/router.go b/vendor/github.com/emicklei/go-restful/v3/router.go deleted file mode 100644 index 19078af1c..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/router.go +++ /dev/null @@ -1,20 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import "net/http" - -// A RouteSelector finds the best matching Route given the input HTTP Request -// RouteSelectors can optionally also implement the PathProcessor interface to also calculate the -// path parameters after the route has been selected. -type RouteSelector interface { - - // SelectRoute finds a Route given the input HTTP Request and a list of WebServices. - // It returns a selected Route and its containing WebService or an error indicating - // a problem. - SelectRoute( - webServices []*WebService, - httpRequest *http.Request) (selectedService *WebService, selected *Route, err error) -} diff --git a/vendor/github.com/emicklei/go-restful/v3/service_error.go b/vendor/github.com/emicklei/go-restful/v3/service_error.go deleted file mode 100644 index a41575469..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/service_error.go +++ /dev/null @@ -1,32 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "fmt" - "net/http" -) - -// ServiceError is a transport object to pass information about a non-Http error occurred in a WebService while processing a request. -type ServiceError struct { - Code int - Message string - Header http.Header -} - -// NewError returns a ServiceError using the code and reason -func NewError(code int, message string) ServiceError { - return ServiceError{Code: code, Message: message} -} - -// NewErrorWithHeader returns a ServiceError using the code, reason and header -func NewErrorWithHeader(code int, message string, header http.Header) ServiceError { - return ServiceError{Code: code, Message: message, Header: header} -} - -// Error returns a text representation of the service error -func (s ServiceError) Error() string { - return fmt.Sprintf("[ServiceError:%v] %v", s.Code, s.Message) -} diff --git a/vendor/github.com/emicklei/go-restful/v3/web_service.go b/vendor/github.com/emicklei/go-restful/v3/web_service.go deleted file mode 100644 index 789c4df25..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/web_service.go +++ /dev/null @@ -1,305 +0,0 @@ -package restful - -import ( - "errors" - "os" - "reflect" - "sync" - - "github.com/emicklei/go-restful/v3/log" -) - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -// WebService holds a collection of Route values that bind a Http Method + URL Path to a function. -type WebService struct { - rootPath string - pathExpr *pathExpression // cached compilation of rootPath as RegExp - routes []Route - produces []string - consumes []string - pathParameters []*Parameter - filters []FilterFunction - documentation string - apiVersion string - - typeNameHandleFunc TypeNameHandleFunction - - dynamicRoutes bool - - // protects 'routes' if dynamic routes are enabled - routesLock sync.RWMutex -} - -func (w *WebService) SetDynamicRoutes(enable bool) { - w.dynamicRoutes = enable -} - -// TypeNameHandleFunction declares functions that can handle translating the name of a sample object -// into the restful documentation for the service. -type TypeNameHandleFunction func(sample interface{}) string - -// TypeNameHandler sets the function that will convert types to strings in the parameter -// and model definitions. If not set, the web service will invoke -// reflect.TypeOf(object).String(). -func (w *WebService) TypeNameHandler(handler TypeNameHandleFunction) *WebService { - w.typeNameHandleFunc = handler - return w -} - -// reflectTypeName is the default TypeNameHandleFunction and for a given object -// returns the name that Go identifies it with (e.g. "string" or "v1.Object") via -// the reflection API. -func reflectTypeName(sample interface{}) string { - return reflect.TypeOf(sample).String() -} - -// compilePathExpression ensures that the path is compiled into a RegEx for those routers that need it. -func (w *WebService) compilePathExpression() { - compiled, err := newPathExpression(w.rootPath) - if err != nil { - log.Printf("invalid path:%s because:%v", w.rootPath, err) - os.Exit(1) - } - w.pathExpr = compiled -} - -// ApiVersion sets the API version for documentation purposes. -func (w *WebService) ApiVersion(apiVersion string) *WebService { - w.apiVersion = apiVersion - return w -} - -// Version returns the API version for documentation purposes. -func (w *WebService) Version() string { return w.apiVersion } - -// Path specifies the root URL template path of the WebService. -// All Routes will be relative to this path. -func (w *WebService) Path(root string) *WebService { - w.rootPath = root - if len(w.rootPath) == 0 { - w.rootPath = "/" - } - w.compilePathExpression() - return w -} - -// Param adds a PathParameter to document parameters used in the root path. -func (w *WebService) Param(parameter *Parameter) *WebService { - if w.pathParameters == nil { - w.pathParameters = []*Parameter{} - } - w.pathParameters = append(w.pathParameters, parameter) - return w -} - -// PathParameter creates a new Parameter of kind Path for documentation purposes. -// It is initialized as required with string as its DataType. -func (w *WebService) PathParameter(name, description string) *Parameter { - return PathParameter(name, description) -} - -// PathParameter creates a new Parameter of kind Path for documentation purposes. -// It is initialized as required with string as its DataType. -func PathParameter(name, description string) *Parameter { - p := &Parameter{&ParameterData{Name: name, Description: description, Required: true, DataType: "string"}} - p.bePath() - return p -} - -// QueryParameter creates a new Parameter of kind Query for documentation purposes. -// It is initialized as not required with string as its DataType. -func (w *WebService) QueryParameter(name, description string) *Parameter { - return QueryParameter(name, description) -} - -// QueryParameter creates a new Parameter of kind Query for documentation purposes. -// It is initialized as not required with string as its DataType. -func QueryParameter(name, description string) *Parameter { - p := &Parameter{&ParameterData{Name: name, Description: description, Required: false, DataType: "string", CollectionFormat: CollectionFormatCSV.String()}} - p.beQuery() - return p -} - -// BodyParameter creates a new Parameter of kind Body for documentation purposes. -// It is initialized as required without a DataType. -func (w *WebService) BodyParameter(name, description string) *Parameter { - return BodyParameter(name, description) -} - -// BodyParameter creates a new Parameter of kind Body for documentation purposes. -// It is initialized as required without a DataType. -func BodyParameter(name, description string) *Parameter { - p := &Parameter{&ParameterData{Name: name, Description: description, Required: true}} - p.beBody() - return p -} - -// HeaderParameter creates a new Parameter of kind (Http) Header for documentation purposes. -// It is initialized as not required with string as its DataType. -func (w *WebService) HeaderParameter(name, description string) *Parameter { - return HeaderParameter(name, description) -} - -// HeaderParameter creates a new Parameter of kind (Http) Header for documentation purposes. -// It is initialized as not required with string as its DataType. -func HeaderParameter(name, description string) *Parameter { - p := &Parameter{&ParameterData{Name: name, Description: description, Required: false, DataType: "string"}} - p.beHeader() - return p -} - -// FormParameter creates a new Parameter of kind Form (using application/x-www-form-urlencoded) for documentation purposes. -// It is initialized as required with string as its DataType. -func (w *WebService) FormParameter(name, description string) *Parameter { - return FormParameter(name, description) -} - -// FormParameter creates a new Parameter of kind Form (using application/x-www-form-urlencoded) for documentation purposes. -// It is initialized as required with string as its DataType. -func FormParameter(name, description string) *Parameter { - p := &Parameter{&ParameterData{Name: name, Description: description, Required: false, DataType: "string"}} - p.beForm() - return p -} - -// MultiPartFormParameter creates a new Parameter of kind Form (using multipart/form-data) for documentation purposes. -// It is initialized as required with string as its DataType. -func (w *WebService) MultiPartFormParameter(name, description string) *Parameter { - return MultiPartFormParameter(name, description) -} - -func MultiPartFormParameter(name, description string) *Parameter { - p := &Parameter{&ParameterData{Name: name, Description: description, Required: false, DataType: "string"}} - p.beMultiPartForm() - return p -} - -// Route creates a new Route using the RouteBuilder and add to the ordered list of Routes. -func (w *WebService) Route(builder *RouteBuilder) *WebService { - w.routesLock.Lock() - defer w.routesLock.Unlock() - builder.copyDefaults(w.produces, w.consumes) - w.routes = append(w.routes, builder.Build()) - return w -} - -// RemoveRoute removes the specified route, looks for something that matches 'path' and 'method' -func (w *WebService) RemoveRoute(path, method string) error { - if !w.dynamicRoutes { - return errors.New("dynamic routes are not enabled.") - } - w.routesLock.Lock() - defer w.routesLock.Unlock() - newRoutes := []Route{} - for _, route := range w.routes { - if route.Method == method && route.Path == path { - continue - } - newRoutes = append(newRoutes, route) - } - w.routes = newRoutes - return nil -} - -// Method creates a new RouteBuilder and initialize its http method -func (w *WebService) Method(httpMethod string) *RouteBuilder { - return new(RouteBuilder).typeNameHandler(w.typeNameHandleFunc).servicePath(w.rootPath).Method(httpMethod) -} - -// Produces specifies that this WebService can produce one or more MIME types. -// Http requests must have one of these values set for the Accept header. -func (w *WebService) Produces(contentTypes ...string) *WebService { - w.produces = contentTypes - return w -} - -// Consumes specifies that this WebService can consume one or more MIME types. -// Http requests must have one of these values set for the Content-Type header. -func (w *WebService) Consumes(accepts ...string) *WebService { - w.consumes = accepts - return w -} - -// Routes returns the Routes associated with this WebService -func (w *WebService) Routes() []Route { - if !w.dynamicRoutes { - return w.routes - } - // Make a copy of the array to prevent concurrency problems - w.routesLock.RLock() - defer w.routesLock.RUnlock() - result := make([]Route, len(w.routes)) - for ix := range w.routes { - result[ix] = w.routes[ix] - } - return result -} - -// RootPath returns the RootPath associated with this WebService. Default "/" -func (w *WebService) RootPath() string { - return w.rootPath -} - -// PathParameters return the path parameter names for (shared among its Routes) -func (w *WebService) PathParameters() []*Parameter { - return w.pathParameters -} - -// Filter adds a filter function to the chain of filters applicable to all its Routes -func (w *WebService) Filter(filter FilterFunction) *WebService { - w.filters = append(w.filters, filter) - return w -} - -// Doc is used to set the documentation of this service. -func (w *WebService) Doc(plainText string) *WebService { - w.documentation = plainText - return w -} - -// Documentation returns it. -func (w *WebService) Documentation() string { - return w.documentation -} - -/* - Convenience methods -*/ - -// HEAD is a shortcut for .Method("HEAD").Path(subPath) -func (w *WebService) HEAD(subPath string) *RouteBuilder { - return new(RouteBuilder).typeNameHandler(w.typeNameHandleFunc).servicePath(w.rootPath).Method("HEAD").Path(subPath) -} - -// GET is a shortcut for .Method("GET").Path(subPath) -func (w *WebService) GET(subPath string) *RouteBuilder { - return new(RouteBuilder).typeNameHandler(w.typeNameHandleFunc).servicePath(w.rootPath).Method("GET").Path(subPath) -} - -// POST is a shortcut for .Method("POST").Path(subPath) -func (w *WebService) POST(subPath string) *RouteBuilder { - return new(RouteBuilder).typeNameHandler(w.typeNameHandleFunc).servicePath(w.rootPath).Method("POST").Path(subPath) -} - -// PUT is a shortcut for .Method("PUT").Path(subPath) -func (w *WebService) PUT(subPath string) *RouteBuilder { - return new(RouteBuilder).typeNameHandler(w.typeNameHandleFunc).servicePath(w.rootPath).Method("PUT").Path(subPath) -} - -// PATCH is a shortcut for .Method("PATCH").Path(subPath) -func (w *WebService) PATCH(subPath string) *RouteBuilder { - return new(RouteBuilder).typeNameHandler(w.typeNameHandleFunc).servicePath(w.rootPath).Method("PATCH").Path(subPath) -} - -// DELETE is a shortcut for .Method("DELETE").Path(subPath) -func (w *WebService) DELETE(subPath string) *RouteBuilder { - return new(RouteBuilder).typeNameHandler(w.typeNameHandleFunc).servicePath(w.rootPath).Method("DELETE").Path(subPath) -} - -// OPTIONS is a shortcut for .Method("OPTIONS").Path(subPath) -func (w *WebService) OPTIONS(subPath string) *RouteBuilder { - return new(RouteBuilder).typeNameHandler(w.typeNameHandleFunc).servicePath(w.rootPath).Method("OPTIONS").Path(subPath) -} diff --git a/vendor/github.com/emicklei/go-restful/v3/web_service_container.go b/vendor/github.com/emicklei/go-restful/v3/web_service_container.go deleted file mode 100644 index c9d31b06c..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/web_service_container.go +++ /dev/null @@ -1,39 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "net/http" -) - -// DefaultContainer is a restful.Container that uses http.DefaultServeMux -var DefaultContainer *Container - -func init() { - DefaultContainer = NewContainer() - DefaultContainer.ServeMux = http.DefaultServeMux -} - -// If set the true then panics will not be caught to return HTTP 500. -// In that case, Route functions are responsible for handling any error situation. -// Default value is false = recover from panics. This has performance implications. -// OBSOLETE ; use restful.DefaultContainer.DoNotRecover(true) -var DoNotRecover = false - -// Add registers a new WebService add it to the DefaultContainer. -func Add(service *WebService) { - DefaultContainer.Add(service) -} - -// Filter appends a container FilterFunction from the DefaultContainer. -// These are called before dispatching a http.Request to a WebService. -func Filter(filter FilterFunction) { - DefaultContainer.Filter(filter) -} - -// RegisteredWebServices returns the collections of WebServices from the DefaultContainer -func RegisteredWebServices() []*WebService { - return DefaultContainer.RegisteredWebServices() -} diff --git a/vendor/github.com/envoyproxy/protoc-gen-validate/LICENSE b/vendor/github.com/envoyproxy/protoc-gen-validate/LICENSE deleted file mode 100644 index d64569567..000000000 --- a/vendor/github.com/envoyproxy/protoc-gen-validate/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - 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. diff --git a/vendor/github.com/envoyproxy/protoc-gen-validate/validate/BUILD b/vendor/github.com/envoyproxy/protoc-gen-validate/validate/BUILD deleted file mode 100644 index a9d38c51b..000000000 --- a/vendor/github.com/envoyproxy/protoc-gen-validate/validate/BUILD +++ /dev/null @@ -1,74 +0,0 @@ -load("@com_google_protobuf//:protobuf.bzl", "py_proto_library") -load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") -load("@rules_cc//cc:defs.bzl", "cc_library", "cc_proto_library") -load("@rules_java//java:defs.bzl", "java_proto_library") -load("@rules_proto//proto:defs.bzl", "proto_library") -load("@io_bazel_rules_go//go:def.bzl", "go_library") - -package( - default_visibility = - ["//visibility:public"], -) - -proto_library( - name = "validate_proto", - srcs = ["validate.proto"], - deps = [ - "@com_google_protobuf//:descriptor_proto", - "@com_google_protobuf//:duration_proto", - "@com_google_protobuf//:timestamp_proto", - ], -) - -cc_proto_library( - name = "validate_cc", - deps = [":validate_proto"], -) - -py_proto_library( - name = "validate_py", - srcs = ["validate.proto"], - deps = ["@com_google_protobuf//:protobuf_python"], -) - -go_proto_library( - name = "validate_go_proto", - importpath = "github.com/envoyproxy/protoc-gen-validate/validate", - proto = ":validate_proto", -) - -cc_library( - name = "cc_validate", - hdrs = ["validate.h"], -) - -go_library( - name = "validate_go", - embed = [":validate_go_proto"], - importpath = "github.com/envoyproxy/protoc-gen-validate/validate", -) - -java_proto_library( - name = "validate_java", - deps = [":validate_proto"], -) - -filegroup( - name = "validate_src", - srcs = ["validate.proto"], -) - -alias( - name = "go_default_library", - actual = ":validate", - deprecation = "Use :validate instead of :go_default_library. Details about the new naming convention: https://github.com/bazelbuild/bazel-gazelle/pull/863", - visibility = ["//visibility:public"], -) - -# this alias allows build files generated with Gazelle in other repositories -# to find validate as an external dependency -alias( - name = "validate", - actual = ":validate_go", - visibility = ["//visibility:public"], -) diff --git a/vendor/github.com/envoyproxy/protoc-gen-validate/validate/validate.h b/vendor/github.com/envoyproxy/protoc-gen-validate/validate/validate.h deleted file mode 100644 index d6cf6c9d9..000000000 --- a/vendor/github.com/envoyproxy/protoc-gen-validate/validate/validate.h +++ /dev/null @@ -1,183 +0,0 @@ -#ifndef _VALIDATE_H -#define _VALIDATE_H - -#include -#include -#include -#include -#include -#include -#include - -#if !defined(_WIN32) -#include -#else -#include -#include - -// uses macros to #define a ton of symbols, -// many of which interfere with our code here and down -// the line in various extensions. -#undef DELETE -#undef ERROR -#undef GetMessage -#undef interface -#undef TRUE -#undef min - -#endif - -#include "google/protobuf/message.h" - -namespace pgv { -using std::string; - -class UnimplementedException : public std::runtime_error { -public: - UnimplementedException() : std::runtime_error("not yet implemented") {} - UnimplementedException(const std::string& message) : std::runtime_error(message) {} - // Thrown by C++ validation code that is not yet implemented. -}; - -using ValidationMsg = std::string; - -class BaseValidator { -public: - /** - * Validate/check a generic message object with a registered validator for the concrete message - * type. - * @param m supplies the message to check. - * @param err supplies the place to return error information. - * @return true if the validation passes OR there is no registered validator for the concrete - * message type. false is returned if validation explicitly fails. - */ - static bool AbstractCheckMessage(const google::protobuf::Message& m, ValidationMsg* err) { - // Polymorphic lookup is used to see if there is a matching concrete validator. If so, call it. - // Otherwise return success. - auto it = abstractValidators().find(std::type_index(typeid(m))); - if (it == abstractValidators().end()) { - return true; - } - return it->second(m, err); - } - -protected: - // Used to implement AbstractCheckMessage() above. Every message that is linked into the binary - // will register itself by type_index, allowing for polymorphic lookup later. - static std::unordered_map>& - abstractValidators() { - static auto* validator_map = new std::unordered_map< - std::type_index, std::function>(); - return *validator_map; - } -}; - -template class Validator : public BaseValidator { -public: - Validator(std::function check) : check_(check) { - abstractValidators()[std::type_index(typeid(T))] = [this](const google::protobuf::Message& m, - ValidationMsg* err) -> bool { - return check_(dynamic_cast(m), err); - }; - } - -private: - std::function check_; -}; - -static inline std::string String(const ValidationMsg& msg) { return std::string(msg); } - -static inline bool IsPrefix(const string& maybe_prefix, const string& search_in) { - return search_in.compare(0, maybe_prefix.size(), maybe_prefix) == 0; -} - -static inline bool IsSuffix(const string& maybe_suffix, const string& search_in) { - return maybe_suffix.size() <= search_in.size() && - search_in.compare(search_in.size() - maybe_suffix.size(), maybe_suffix.size(), - maybe_suffix) == 0; -} - -static inline bool Contains(const string& search_in, const string& to_find) { - return search_in.find(to_find) != string::npos; -} - -static inline bool NotContains(const string& search_in, const string& to_find) { - return !Contains(search_in, to_find); -} - -static inline bool IsIpv4(const string& to_validate) { - struct sockaddr_in sa; - return !(inet_pton(AF_INET, to_validate.c_str(), &sa.sin_addr) < 1); -} - -static inline bool IsIpv6(const string& to_validate) { - struct sockaddr_in6 sa_six; - return !(inet_pton(AF_INET6, to_validate.c_str(), &sa_six.sin6_addr) < 1); -} - -static inline bool IsIp(const string& to_validate) { - return IsIpv4(to_validate) || IsIpv6(to_validate); -} - -static inline bool IsHostname(const string& to_validate) { - if (to_validate.length() > 253) { - return false; - } - - const std::regex dot_regex{"\\."}; - const auto iter_end = std::sregex_token_iterator(); - auto iter = std::sregex_token_iterator(to_validate.begin(), to_validate.end(), dot_regex, -1); - for (; iter != iter_end; ++iter) { - const std::string& part = *iter; - if (part.empty() || part.length() > 63) { - return false; - } - if (part.at(0) == '-') { - return false; - } - if (part.at(part.length() - 1) == '-') { - return false; - } - for (const auto& character : part) { - if ((character < 'A' || character > 'Z') && (character < 'a' || character > 'z') && - (character < '0' || character > '9') && character != '-') { - return false; - } - } - } - - return true; -} - -namespace { - -inline int OneCharLen(const char* src) { - return "\1\1\1\1\1\1\1\1\1\1\1\1\2\2\3\4"[(*src & 0xFF) >> 4]; -} - -inline int UTF8FirstLetterNumBytes(const char *utf8_str, int str_len) { - if (str_len == 0) - return 0; - return OneCharLen(utf8_str); -} - -inline size_t Utf8Len(const string& narrow_string) { - const char* str_char = narrow_string.c_str(); - ptrdiff_t byte_len = narrow_string.length(); - size_t unicode_len = 0; - int char_len = 1; - while (byte_len > 0 && char_len > 0) { - char_len = UTF8FirstLetterNumBytes(str_char, byte_len); - str_char += char_len; - byte_len -= char_len; - ++unicode_len; - } - return unicode_len; -} - -} // namespace - -} // namespace pgv - -#endif // _VALIDATE_H diff --git a/vendor/github.com/envoyproxy/protoc-gen-validate/validate/validate.pb.go b/vendor/github.com/envoyproxy/protoc-gen-validate/validate/validate.pb.go deleted file mode 100644 index a31b2e1a3..000000000 --- a/vendor/github.com/envoyproxy/protoc-gen-validate/validate/validate.pb.go +++ /dev/null @@ -1,4106 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.30.0 -// protoc v4.22.2 -// source: validate/validate.proto - -package validate - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - descriptorpb "google.golang.org/protobuf/types/descriptorpb" - durationpb "google.golang.org/protobuf/types/known/durationpb" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// WellKnownRegex contain some well-known patterns. -type KnownRegex int32 - -const ( - KnownRegex_UNKNOWN KnownRegex = 0 - // HTTP header name as defined by RFC 7230. - KnownRegex_HTTP_HEADER_NAME KnownRegex = 1 - // HTTP header value as defined by RFC 7230. - KnownRegex_HTTP_HEADER_VALUE KnownRegex = 2 -) - -// Enum value maps for KnownRegex. -var ( - KnownRegex_name = map[int32]string{ - 0: "UNKNOWN", - 1: "HTTP_HEADER_NAME", - 2: "HTTP_HEADER_VALUE", - } - KnownRegex_value = map[string]int32{ - "UNKNOWN": 0, - "HTTP_HEADER_NAME": 1, - "HTTP_HEADER_VALUE": 2, - } -) - -func (x KnownRegex) Enum() *KnownRegex { - p := new(KnownRegex) - *p = x - return p -} - -func (x KnownRegex) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (KnownRegex) Descriptor() protoreflect.EnumDescriptor { - return file_validate_validate_proto_enumTypes[0].Descriptor() -} - -func (KnownRegex) Type() protoreflect.EnumType { - return &file_validate_validate_proto_enumTypes[0] -} - -func (x KnownRegex) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Do not use. -func (x *KnownRegex) UnmarshalJSON(b []byte) error { - num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) - if err != nil { - return err - } - *x = KnownRegex(num) - return nil -} - -// Deprecated: Use KnownRegex.Descriptor instead. -func (KnownRegex) EnumDescriptor() ([]byte, []int) { - return file_validate_validate_proto_rawDescGZIP(), []int{0} -} - -// FieldRules encapsulates the rules for each type of field. Depending on the -// field, the correct set should be used to ensure proper validations. -type FieldRules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Message *MessageRules `protobuf:"bytes,17,opt,name=message" json:"message,omitempty"` - // Types that are assignable to Type: - // - // *FieldRules_Float - // *FieldRules_Double - // *FieldRules_Int32 - // *FieldRules_Int64 - // *FieldRules_Uint32 - // *FieldRules_Uint64 - // *FieldRules_Sint32 - // *FieldRules_Sint64 - // *FieldRules_Fixed32 - // *FieldRules_Fixed64 - // *FieldRules_Sfixed32 - // *FieldRules_Sfixed64 - // *FieldRules_Bool - // *FieldRules_String_ - // *FieldRules_Bytes - // *FieldRules_Enum - // *FieldRules_Repeated - // *FieldRules_Map - // *FieldRules_Any - // *FieldRules_Duration - // *FieldRules_Timestamp - Type isFieldRules_Type `protobuf_oneof:"type"` -} - -func (x *FieldRules) Reset() { - *x = FieldRules{} - if protoimpl.UnsafeEnabled { - mi := &file_validate_validate_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FieldRules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FieldRules) ProtoMessage() {} - -func (x *FieldRules) ProtoReflect() protoreflect.Message { - mi := &file_validate_validate_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FieldRules.ProtoReflect.Descriptor instead. -func (*FieldRules) Descriptor() ([]byte, []int) { - return file_validate_validate_proto_rawDescGZIP(), []int{0} -} - -func (x *FieldRules) GetMessage() *MessageRules { - if x != nil { - return x.Message - } - return nil -} - -func (m *FieldRules) GetType() isFieldRules_Type { - if m != nil { - return m.Type - } - return nil -} - -func (x *FieldRules) GetFloat() *FloatRules { - if x, ok := x.GetType().(*FieldRules_Float); ok { - return x.Float - } - return nil -} - -func (x *FieldRules) GetDouble() *DoubleRules { - if x, ok := x.GetType().(*FieldRules_Double); ok { - return x.Double - } - return nil -} - -func (x *FieldRules) GetInt32() *Int32Rules { - if x, ok := x.GetType().(*FieldRules_Int32); ok { - return x.Int32 - } - return nil -} - -func (x *FieldRules) GetInt64() *Int64Rules { - if x, ok := x.GetType().(*FieldRules_Int64); ok { - return x.Int64 - } - return nil -} - -func (x *FieldRules) GetUint32() *UInt32Rules { - if x, ok := x.GetType().(*FieldRules_Uint32); ok { - return x.Uint32 - } - return nil -} - -func (x *FieldRules) GetUint64() *UInt64Rules { - if x, ok := x.GetType().(*FieldRules_Uint64); ok { - return x.Uint64 - } - return nil -} - -func (x *FieldRules) GetSint32() *SInt32Rules { - if x, ok := x.GetType().(*FieldRules_Sint32); ok { - return x.Sint32 - } - return nil -} - -func (x *FieldRules) GetSint64() *SInt64Rules { - if x, ok := x.GetType().(*FieldRules_Sint64); ok { - return x.Sint64 - } - return nil -} - -func (x *FieldRules) GetFixed32() *Fixed32Rules { - if x, ok := x.GetType().(*FieldRules_Fixed32); ok { - return x.Fixed32 - } - return nil -} - -func (x *FieldRules) GetFixed64() *Fixed64Rules { - if x, ok := x.GetType().(*FieldRules_Fixed64); ok { - return x.Fixed64 - } - return nil -} - -func (x *FieldRules) GetSfixed32() *SFixed32Rules { - if x, ok := x.GetType().(*FieldRules_Sfixed32); ok { - return x.Sfixed32 - } - return nil -} - -func (x *FieldRules) GetSfixed64() *SFixed64Rules { - if x, ok := x.GetType().(*FieldRules_Sfixed64); ok { - return x.Sfixed64 - } - return nil -} - -func (x *FieldRules) GetBool() *BoolRules { - if x, ok := x.GetType().(*FieldRules_Bool); ok { - return x.Bool - } - return nil -} - -func (x *FieldRules) GetString_() *StringRules { - if x, ok := x.GetType().(*FieldRules_String_); ok { - return x.String_ - } - return nil -} - -func (x *FieldRules) GetBytes() *BytesRules { - if x, ok := x.GetType().(*FieldRules_Bytes); ok { - return x.Bytes - } - return nil -} - -func (x *FieldRules) GetEnum() *EnumRules { - if x, ok := x.GetType().(*FieldRules_Enum); ok { - return x.Enum - } - return nil -} - -func (x *FieldRules) GetRepeated() *RepeatedRules { - if x, ok := x.GetType().(*FieldRules_Repeated); ok { - return x.Repeated - } - return nil -} - -func (x *FieldRules) GetMap() *MapRules { - if x, ok := x.GetType().(*FieldRules_Map); ok { - return x.Map - } - return nil -} - -func (x *FieldRules) GetAny() *AnyRules { - if x, ok := x.GetType().(*FieldRules_Any); ok { - return x.Any - } - return nil -} - -func (x *FieldRules) GetDuration() *DurationRules { - if x, ok := x.GetType().(*FieldRules_Duration); ok { - return x.Duration - } - return nil -} - -func (x *FieldRules) GetTimestamp() *TimestampRules { - if x, ok := x.GetType().(*FieldRules_Timestamp); ok { - return x.Timestamp - } - return nil -} - -type isFieldRules_Type interface { - isFieldRules_Type() -} - -type FieldRules_Float struct { - // Scalar Field Types - Float *FloatRules `protobuf:"bytes,1,opt,name=float,oneof"` -} - -type FieldRules_Double struct { - Double *DoubleRules `protobuf:"bytes,2,opt,name=double,oneof"` -} - -type FieldRules_Int32 struct { - Int32 *Int32Rules `protobuf:"bytes,3,opt,name=int32,oneof"` -} - -type FieldRules_Int64 struct { - Int64 *Int64Rules `protobuf:"bytes,4,opt,name=int64,oneof"` -} - -type FieldRules_Uint32 struct { - Uint32 *UInt32Rules `protobuf:"bytes,5,opt,name=uint32,oneof"` -} - -type FieldRules_Uint64 struct { - Uint64 *UInt64Rules `protobuf:"bytes,6,opt,name=uint64,oneof"` -} - -type FieldRules_Sint32 struct { - Sint32 *SInt32Rules `protobuf:"bytes,7,opt,name=sint32,oneof"` -} - -type FieldRules_Sint64 struct { - Sint64 *SInt64Rules `protobuf:"bytes,8,opt,name=sint64,oneof"` -} - -type FieldRules_Fixed32 struct { - Fixed32 *Fixed32Rules `protobuf:"bytes,9,opt,name=fixed32,oneof"` -} - -type FieldRules_Fixed64 struct { - Fixed64 *Fixed64Rules `protobuf:"bytes,10,opt,name=fixed64,oneof"` -} - -type FieldRules_Sfixed32 struct { - Sfixed32 *SFixed32Rules `protobuf:"bytes,11,opt,name=sfixed32,oneof"` -} - -type FieldRules_Sfixed64 struct { - Sfixed64 *SFixed64Rules `protobuf:"bytes,12,opt,name=sfixed64,oneof"` -} - -type FieldRules_Bool struct { - Bool *BoolRules `protobuf:"bytes,13,opt,name=bool,oneof"` -} - -type FieldRules_String_ struct { - String_ *StringRules `protobuf:"bytes,14,opt,name=string,oneof"` -} - -type FieldRules_Bytes struct { - Bytes *BytesRules `protobuf:"bytes,15,opt,name=bytes,oneof"` -} - -type FieldRules_Enum struct { - // Complex Field Types - Enum *EnumRules `protobuf:"bytes,16,opt,name=enum,oneof"` -} - -type FieldRules_Repeated struct { - Repeated *RepeatedRules `protobuf:"bytes,18,opt,name=repeated,oneof"` -} - -type FieldRules_Map struct { - Map *MapRules `protobuf:"bytes,19,opt,name=map,oneof"` -} - -type FieldRules_Any struct { - // Well-Known Field Types - Any *AnyRules `protobuf:"bytes,20,opt,name=any,oneof"` -} - -type FieldRules_Duration struct { - Duration *DurationRules `protobuf:"bytes,21,opt,name=duration,oneof"` -} - -type FieldRules_Timestamp struct { - Timestamp *TimestampRules `protobuf:"bytes,22,opt,name=timestamp,oneof"` -} - -func (*FieldRules_Float) isFieldRules_Type() {} - -func (*FieldRules_Double) isFieldRules_Type() {} - -func (*FieldRules_Int32) isFieldRules_Type() {} - -func (*FieldRules_Int64) isFieldRules_Type() {} - -func (*FieldRules_Uint32) isFieldRules_Type() {} - -func (*FieldRules_Uint64) isFieldRules_Type() {} - -func (*FieldRules_Sint32) isFieldRules_Type() {} - -func (*FieldRules_Sint64) isFieldRules_Type() {} - -func (*FieldRules_Fixed32) isFieldRules_Type() {} - -func (*FieldRules_Fixed64) isFieldRules_Type() {} - -func (*FieldRules_Sfixed32) isFieldRules_Type() {} - -func (*FieldRules_Sfixed64) isFieldRules_Type() {} - -func (*FieldRules_Bool) isFieldRules_Type() {} - -func (*FieldRules_String_) isFieldRules_Type() {} - -func (*FieldRules_Bytes) isFieldRules_Type() {} - -func (*FieldRules_Enum) isFieldRules_Type() {} - -func (*FieldRules_Repeated) isFieldRules_Type() {} - -func (*FieldRules_Map) isFieldRules_Type() {} - -func (*FieldRules_Any) isFieldRules_Type() {} - -func (*FieldRules_Duration) isFieldRules_Type() {} - -func (*FieldRules_Timestamp) isFieldRules_Type() {} - -// FloatRules describes the constraints applied to `float` values -type FloatRules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Const specifies that this field must be exactly the specified value - Const *float32 `protobuf:"fixed32,1,opt,name=const" json:"const,omitempty"` - // Lt specifies that this field must be less than the specified value, - // exclusive - Lt *float32 `protobuf:"fixed32,2,opt,name=lt" json:"lt,omitempty"` - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - Lte *float32 `protobuf:"fixed32,3,opt,name=lte" json:"lte,omitempty"` - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - Gt *float32 `protobuf:"fixed32,4,opt,name=gt" json:"gt,omitempty"` - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - Gte *float32 `protobuf:"fixed32,5,opt,name=gte" json:"gte,omitempty"` - // In specifies that this field must be equal to one of the specified - // values - In []float32 `protobuf:"fixed32,6,rep,name=in" json:"in,omitempty"` - // NotIn specifies that this field cannot be equal to one of the specified - // values - NotIn []float32 `protobuf:"fixed32,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - IgnoreEmpty *bool `protobuf:"varint,8,opt,name=ignore_empty,json=ignoreEmpty" json:"ignore_empty,omitempty"` -} - -func (x *FloatRules) Reset() { - *x = FloatRules{} - if protoimpl.UnsafeEnabled { - mi := &file_validate_validate_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FloatRules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FloatRules) ProtoMessage() {} - -func (x *FloatRules) ProtoReflect() protoreflect.Message { - mi := &file_validate_validate_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FloatRules.ProtoReflect.Descriptor instead. -func (*FloatRules) Descriptor() ([]byte, []int) { - return file_validate_validate_proto_rawDescGZIP(), []int{1} -} - -func (x *FloatRules) GetConst() float32 { - if x != nil && x.Const != nil { - return *x.Const - } - return 0 -} - -func (x *FloatRules) GetLt() float32 { - if x != nil && x.Lt != nil { - return *x.Lt - } - return 0 -} - -func (x *FloatRules) GetLte() float32 { - if x != nil && x.Lte != nil { - return *x.Lte - } - return 0 -} - -func (x *FloatRules) GetGt() float32 { - if x != nil && x.Gt != nil { - return *x.Gt - } - return 0 -} - -func (x *FloatRules) GetGte() float32 { - if x != nil && x.Gte != nil { - return *x.Gte - } - return 0 -} - -func (x *FloatRules) GetIn() []float32 { - if x != nil { - return x.In - } - return nil -} - -func (x *FloatRules) GetNotIn() []float32 { - if x != nil { - return x.NotIn - } - return nil -} - -func (x *FloatRules) GetIgnoreEmpty() bool { - if x != nil && x.IgnoreEmpty != nil { - return *x.IgnoreEmpty - } - return false -} - -// DoubleRules describes the constraints applied to `double` values -type DoubleRules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Const specifies that this field must be exactly the specified value - Const *float64 `protobuf:"fixed64,1,opt,name=const" json:"const,omitempty"` - // Lt specifies that this field must be less than the specified value, - // exclusive - Lt *float64 `protobuf:"fixed64,2,opt,name=lt" json:"lt,omitempty"` - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - Lte *float64 `protobuf:"fixed64,3,opt,name=lte" json:"lte,omitempty"` - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - Gt *float64 `protobuf:"fixed64,4,opt,name=gt" json:"gt,omitempty"` - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - Gte *float64 `protobuf:"fixed64,5,opt,name=gte" json:"gte,omitempty"` - // In specifies that this field must be equal to one of the specified - // values - In []float64 `protobuf:"fixed64,6,rep,name=in" json:"in,omitempty"` - // NotIn specifies that this field cannot be equal to one of the specified - // values - NotIn []float64 `protobuf:"fixed64,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - IgnoreEmpty *bool `protobuf:"varint,8,opt,name=ignore_empty,json=ignoreEmpty" json:"ignore_empty,omitempty"` -} - -func (x *DoubleRules) Reset() { - *x = DoubleRules{} - if protoimpl.UnsafeEnabled { - mi := &file_validate_validate_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DoubleRules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DoubleRules) ProtoMessage() {} - -func (x *DoubleRules) ProtoReflect() protoreflect.Message { - mi := &file_validate_validate_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DoubleRules.ProtoReflect.Descriptor instead. -func (*DoubleRules) Descriptor() ([]byte, []int) { - return file_validate_validate_proto_rawDescGZIP(), []int{2} -} - -func (x *DoubleRules) GetConst() float64 { - if x != nil && x.Const != nil { - return *x.Const - } - return 0 -} - -func (x *DoubleRules) GetLt() float64 { - if x != nil && x.Lt != nil { - return *x.Lt - } - return 0 -} - -func (x *DoubleRules) GetLte() float64 { - if x != nil && x.Lte != nil { - return *x.Lte - } - return 0 -} - -func (x *DoubleRules) GetGt() float64 { - if x != nil && x.Gt != nil { - return *x.Gt - } - return 0 -} - -func (x *DoubleRules) GetGte() float64 { - if x != nil && x.Gte != nil { - return *x.Gte - } - return 0 -} - -func (x *DoubleRules) GetIn() []float64 { - if x != nil { - return x.In - } - return nil -} - -func (x *DoubleRules) GetNotIn() []float64 { - if x != nil { - return x.NotIn - } - return nil -} - -func (x *DoubleRules) GetIgnoreEmpty() bool { - if x != nil && x.IgnoreEmpty != nil { - return *x.IgnoreEmpty - } - return false -} - -// Int32Rules describes the constraints applied to `int32` values -type Int32Rules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Const specifies that this field must be exactly the specified value - Const *int32 `protobuf:"varint,1,opt,name=const" json:"const,omitempty"` - // Lt specifies that this field must be less than the specified value, - // exclusive - Lt *int32 `protobuf:"varint,2,opt,name=lt" json:"lt,omitempty"` - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - Lte *int32 `protobuf:"varint,3,opt,name=lte" json:"lte,omitempty"` - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - Gt *int32 `protobuf:"varint,4,opt,name=gt" json:"gt,omitempty"` - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - Gte *int32 `protobuf:"varint,5,opt,name=gte" json:"gte,omitempty"` - // In specifies that this field must be equal to one of the specified - // values - In []int32 `protobuf:"varint,6,rep,name=in" json:"in,omitempty"` - // NotIn specifies that this field cannot be equal to one of the specified - // values - NotIn []int32 `protobuf:"varint,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - IgnoreEmpty *bool `protobuf:"varint,8,opt,name=ignore_empty,json=ignoreEmpty" json:"ignore_empty,omitempty"` -} - -func (x *Int32Rules) Reset() { - *x = Int32Rules{} - if protoimpl.UnsafeEnabled { - mi := &file_validate_validate_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Int32Rules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Int32Rules) ProtoMessage() {} - -func (x *Int32Rules) ProtoReflect() protoreflect.Message { - mi := &file_validate_validate_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Int32Rules.ProtoReflect.Descriptor instead. -func (*Int32Rules) Descriptor() ([]byte, []int) { - return file_validate_validate_proto_rawDescGZIP(), []int{3} -} - -func (x *Int32Rules) GetConst() int32 { - if x != nil && x.Const != nil { - return *x.Const - } - return 0 -} - -func (x *Int32Rules) GetLt() int32 { - if x != nil && x.Lt != nil { - return *x.Lt - } - return 0 -} - -func (x *Int32Rules) GetLte() int32 { - if x != nil && x.Lte != nil { - return *x.Lte - } - return 0 -} - -func (x *Int32Rules) GetGt() int32 { - if x != nil && x.Gt != nil { - return *x.Gt - } - return 0 -} - -func (x *Int32Rules) GetGte() int32 { - if x != nil && x.Gte != nil { - return *x.Gte - } - return 0 -} - -func (x *Int32Rules) GetIn() []int32 { - if x != nil { - return x.In - } - return nil -} - -func (x *Int32Rules) GetNotIn() []int32 { - if x != nil { - return x.NotIn - } - return nil -} - -func (x *Int32Rules) GetIgnoreEmpty() bool { - if x != nil && x.IgnoreEmpty != nil { - return *x.IgnoreEmpty - } - return false -} - -// Int64Rules describes the constraints applied to `int64` values -type Int64Rules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Const specifies that this field must be exactly the specified value - Const *int64 `protobuf:"varint,1,opt,name=const" json:"const,omitempty"` - // Lt specifies that this field must be less than the specified value, - // exclusive - Lt *int64 `protobuf:"varint,2,opt,name=lt" json:"lt,omitempty"` - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - Lte *int64 `protobuf:"varint,3,opt,name=lte" json:"lte,omitempty"` - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - Gt *int64 `protobuf:"varint,4,opt,name=gt" json:"gt,omitempty"` - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - Gte *int64 `protobuf:"varint,5,opt,name=gte" json:"gte,omitempty"` - // In specifies that this field must be equal to one of the specified - // values - In []int64 `protobuf:"varint,6,rep,name=in" json:"in,omitempty"` - // NotIn specifies that this field cannot be equal to one of the specified - // values - NotIn []int64 `protobuf:"varint,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - IgnoreEmpty *bool `protobuf:"varint,8,opt,name=ignore_empty,json=ignoreEmpty" json:"ignore_empty,omitempty"` -} - -func (x *Int64Rules) Reset() { - *x = Int64Rules{} - if protoimpl.UnsafeEnabled { - mi := &file_validate_validate_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Int64Rules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Int64Rules) ProtoMessage() {} - -func (x *Int64Rules) ProtoReflect() protoreflect.Message { - mi := &file_validate_validate_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Int64Rules.ProtoReflect.Descriptor instead. -func (*Int64Rules) Descriptor() ([]byte, []int) { - return file_validate_validate_proto_rawDescGZIP(), []int{4} -} - -func (x *Int64Rules) GetConst() int64 { - if x != nil && x.Const != nil { - return *x.Const - } - return 0 -} - -func (x *Int64Rules) GetLt() int64 { - if x != nil && x.Lt != nil { - return *x.Lt - } - return 0 -} - -func (x *Int64Rules) GetLte() int64 { - if x != nil && x.Lte != nil { - return *x.Lte - } - return 0 -} - -func (x *Int64Rules) GetGt() int64 { - if x != nil && x.Gt != nil { - return *x.Gt - } - return 0 -} - -func (x *Int64Rules) GetGte() int64 { - if x != nil && x.Gte != nil { - return *x.Gte - } - return 0 -} - -func (x *Int64Rules) GetIn() []int64 { - if x != nil { - return x.In - } - return nil -} - -func (x *Int64Rules) GetNotIn() []int64 { - if x != nil { - return x.NotIn - } - return nil -} - -func (x *Int64Rules) GetIgnoreEmpty() bool { - if x != nil && x.IgnoreEmpty != nil { - return *x.IgnoreEmpty - } - return false -} - -// UInt32Rules describes the constraints applied to `uint32` values -type UInt32Rules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Const specifies that this field must be exactly the specified value - Const *uint32 `protobuf:"varint,1,opt,name=const" json:"const,omitempty"` - // Lt specifies that this field must be less than the specified value, - // exclusive - Lt *uint32 `protobuf:"varint,2,opt,name=lt" json:"lt,omitempty"` - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - Lte *uint32 `protobuf:"varint,3,opt,name=lte" json:"lte,omitempty"` - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - Gt *uint32 `protobuf:"varint,4,opt,name=gt" json:"gt,omitempty"` - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - Gte *uint32 `protobuf:"varint,5,opt,name=gte" json:"gte,omitempty"` - // In specifies that this field must be equal to one of the specified - // values - In []uint32 `protobuf:"varint,6,rep,name=in" json:"in,omitempty"` - // NotIn specifies that this field cannot be equal to one of the specified - // values - NotIn []uint32 `protobuf:"varint,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - IgnoreEmpty *bool `protobuf:"varint,8,opt,name=ignore_empty,json=ignoreEmpty" json:"ignore_empty,omitempty"` -} - -func (x *UInt32Rules) Reset() { - *x = UInt32Rules{} - if protoimpl.UnsafeEnabled { - mi := &file_validate_validate_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UInt32Rules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UInt32Rules) ProtoMessage() {} - -func (x *UInt32Rules) ProtoReflect() protoreflect.Message { - mi := &file_validate_validate_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UInt32Rules.ProtoReflect.Descriptor instead. -func (*UInt32Rules) Descriptor() ([]byte, []int) { - return file_validate_validate_proto_rawDescGZIP(), []int{5} -} - -func (x *UInt32Rules) GetConst() uint32 { - if x != nil && x.Const != nil { - return *x.Const - } - return 0 -} - -func (x *UInt32Rules) GetLt() uint32 { - if x != nil && x.Lt != nil { - return *x.Lt - } - return 0 -} - -func (x *UInt32Rules) GetLte() uint32 { - if x != nil && x.Lte != nil { - return *x.Lte - } - return 0 -} - -func (x *UInt32Rules) GetGt() uint32 { - if x != nil && x.Gt != nil { - return *x.Gt - } - return 0 -} - -func (x *UInt32Rules) GetGte() uint32 { - if x != nil && x.Gte != nil { - return *x.Gte - } - return 0 -} - -func (x *UInt32Rules) GetIn() []uint32 { - if x != nil { - return x.In - } - return nil -} - -func (x *UInt32Rules) GetNotIn() []uint32 { - if x != nil { - return x.NotIn - } - return nil -} - -func (x *UInt32Rules) GetIgnoreEmpty() bool { - if x != nil && x.IgnoreEmpty != nil { - return *x.IgnoreEmpty - } - return false -} - -// UInt64Rules describes the constraints applied to `uint64` values -type UInt64Rules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Const specifies that this field must be exactly the specified value - Const *uint64 `protobuf:"varint,1,opt,name=const" json:"const,omitempty"` - // Lt specifies that this field must be less than the specified value, - // exclusive - Lt *uint64 `protobuf:"varint,2,opt,name=lt" json:"lt,omitempty"` - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - Lte *uint64 `protobuf:"varint,3,opt,name=lte" json:"lte,omitempty"` - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - Gt *uint64 `protobuf:"varint,4,opt,name=gt" json:"gt,omitempty"` - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - Gte *uint64 `protobuf:"varint,5,opt,name=gte" json:"gte,omitempty"` - // In specifies that this field must be equal to one of the specified - // values - In []uint64 `protobuf:"varint,6,rep,name=in" json:"in,omitempty"` - // NotIn specifies that this field cannot be equal to one of the specified - // values - NotIn []uint64 `protobuf:"varint,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - IgnoreEmpty *bool `protobuf:"varint,8,opt,name=ignore_empty,json=ignoreEmpty" json:"ignore_empty,omitempty"` -} - -func (x *UInt64Rules) Reset() { - *x = UInt64Rules{} - if protoimpl.UnsafeEnabled { - mi := &file_validate_validate_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UInt64Rules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UInt64Rules) ProtoMessage() {} - -func (x *UInt64Rules) ProtoReflect() protoreflect.Message { - mi := &file_validate_validate_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UInt64Rules.ProtoReflect.Descriptor instead. -func (*UInt64Rules) Descriptor() ([]byte, []int) { - return file_validate_validate_proto_rawDescGZIP(), []int{6} -} - -func (x *UInt64Rules) GetConst() uint64 { - if x != nil && x.Const != nil { - return *x.Const - } - return 0 -} - -func (x *UInt64Rules) GetLt() uint64 { - if x != nil && x.Lt != nil { - return *x.Lt - } - return 0 -} - -func (x *UInt64Rules) GetLte() uint64 { - if x != nil && x.Lte != nil { - return *x.Lte - } - return 0 -} - -func (x *UInt64Rules) GetGt() uint64 { - if x != nil && x.Gt != nil { - return *x.Gt - } - return 0 -} - -func (x *UInt64Rules) GetGte() uint64 { - if x != nil && x.Gte != nil { - return *x.Gte - } - return 0 -} - -func (x *UInt64Rules) GetIn() []uint64 { - if x != nil { - return x.In - } - return nil -} - -func (x *UInt64Rules) GetNotIn() []uint64 { - if x != nil { - return x.NotIn - } - return nil -} - -func (x *UInt64Rules) GetIgnoreEmpty() bool { - if x != nil && x.IgnoreEmpty != nil { - return *x.IgnoreEmpty - } - return false -} - -// SInt32Rules describes the constraints applied to `sint32` values -type SInt32Rules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Const specifies that this field must be exactly the specified value - Const *int32 `protobuf:"zigzag32,1,opt,name=const" json:"const,omitempty"` - // Lt specifies that this field must be less than the specified value, - // exclusive - Lt *int32 `protobuf:"zigzag32,2,opt,name=lt" json:"lt,omitempty"` - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - Lte *int32 `protobuf:"zigzag32,3,opt,name=lte" json:"lte,omitempty"` - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - Gt *int32 `protobuf:"zigzag32,4,opt,name=gt" json:"gt,omitempty"` - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - Gte *int32 `protobuf:"zigzag32,5,opt,name=gte" json:"gte,omitempty"` - // In specifies that this field must be equal to one of the specified - // values - In []int32 `protobuf:"zigzag32,6,rep,name=in" json:"in,omitempty"` - // NotIn specifies that this field cannot be equal to one of the specified - // values - NotIn []int32 `protobuf:"zigzag32,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - IgnoreEmpty *bool `protobuf:"varint,8,opt,name=ignore_empty,json=ignoreEmpty" json:"ignore_empty,omitempty"` -} - -func (x *SInt32Rules) Reset() { - *x = SInt32Rules{} - if protoimpl.UnsafeEnabled { - mi := &file_validate_validate_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SInt32Rules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SInt32Rules) ProtoMessage() {} - -func (x *SInt32Rules) ProtoReflect() protoreflect.Message { - mi := &file_validate_validate_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SInt32Rules.ProtoReflect.Descriptor instead. -func (*SInt32Rules) Descriptor() ([]byte, []int) { - return file_validate_validate_proto_rawDescGZIP(), []int{7} -} - -func (x *SInt32Rules) GetConst() int32 { - if x != nil && x.Const != nil { - return *x.Const - } - return 0 -} - -func (x *SInt32Rules) GetLt() int32 { - if x != nil && x.Lt != nil { - return *x.Lt - } - return 0 -} - -func (x *SInt32Rules) GetLte() int32 { - if x != nil && x.Lte != nil { - return *x.Lte - } - return 0 -} - -func (x *SInt32Rules) GetGt() int32 { - if x != nil && x.Gt != nil { - return *x.Gt - } - return 0 -} - -func (x *SInt32Rules) GetGte() int32 { - if x != nil && x.Gte != nil { - return *x.Gte - } - return 0 -} - -func (x *SInt32Rules) GetIn() []int32 { - if x != nil { - return x.In - } - return nil -} - -func (x *SInt32Rules) GetNotIn() []int32 { - if x != nil { - return x.NotIn - } - return nil -} - -func (x *SInt32Rules) GetIgnoreEmpty() bool { - if x != nil && x.IgnoreEmpty != nil { - return *x.IgnoreEmpty - } - return false -} - -// SInt64Rules describes the constraints applied to `sint64` values -type SInt64Rules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Const specifies that this field must be exactly the specified value - Const *int64 `protobuf:"zigzag64,1,opt,name=const" json:"const,omitempty"` - // Lt specifies that this field must be less than the specified value, - // exclusive - Lt *int64 `protobuf:"zigzag64,2,opt,name=lt" json:"lt,omitempty"` - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - Lte *int64 `protobuf:"zigzag64,3,opt,name=lte" json:"lte,omitempty"` - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - Gt *int64 `protobuf:"zigzag64,4,opt,name=gt" json:"gt,omitempty"` - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - Gte *int64 `protobuf:"zigzag64,5,opt,name=gte" json:"gte,omitempty"` - // In specifies that this field must be equal to one of the specified - // values - In []int64 `protobuf:"zigzag64,6,rep,name=in" json:"in,omitempty"` - // NotIn specifies that this field cannot be equal to one of the specified - // values - NotIn []int64 `protobuf:"zigzag64,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - IgnoreEmpty *bool `protobuf:"varint,8,opt,name=ignore_empty,json=ignoreEmpty" json:"ignore_empty,omitempty"` -} - -func (x *SInt64Rules) Reset() { - *x = SInt64Rules{} - if protoimpl.UnsafeEnabled { - mi := &file_validate_validate_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SInt64Rules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SInt64Rules) ProtoMessage() {} - -func (x *SInt64Rules) ProtoReflect() protoreflect.Message { - mi := &file_validate_validate_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SInt64Rules.ProtoReflect.Descriptor instead. -func (*SInt64Rules) Descriptor() ([]byte, []int) { - return file_validate_validate_proto_rawDescGZIP(), []int{8} -} - -func (x *SInt64Rules) GetConst() int64 { - if x != nil && x.Const != nil { - return *x.Const - } - return 0 -} - -func (x *SInt64Rules) GetLt() int64 { - if x != nil && x.Lt != nil { - return *x.Lt - } - return 0 -} - -func (x *SInt64Rules) GetLte() int64 { - if x != nil && x.Lte != nil { - return *x.Lte - } - return 0 -} - -func (x *SInt64Rules) GetGt() int64 { - if x != nil && x.Gt != nil { - return *x.Gt - } - return 0 -} - -func (x *SInt64Rules) GetGte() int64 { - if x != nil && x.Gte != nil { - return *x.Gte - } - return 0 -} - -func (x *SInt64Rules) GetIn() []int64 { - if x != nil { - return x.In - } - return nil -} - -func (x *SInt64Rules) GetNotIn() []int64 { - if x != nil { - return x.NotIn - } - return nil -} - -func (x *SInt64Rules) GetIgnoreEmpty() bool { - if x != nil && x.IgnoreEmpty != nil { - return *x.IgnoreEmpty - } - return false -} - -// Fixed32Rules describes the constraints applied to `fixed32` values -type Fixed32Rules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Const specifies that this field must be exactly the specified value - Const *uint32 `protobuf:"fixed32,1,opt,name=const" json:"const,omitempty"` - // Lt specifies that this field must be less than the specified value, - // exclusive - Lt *uint32 `protobuf:"fixed32,2,opt,name=lt" json:"lt,omitempty"` - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - Lte *uint32 `protobuf:"fixed32,3,opt,name=lte" json:"lte,omitempty"` - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - Gt *uint32 `protobuf:"fixed32,4,opt,name=gt" json:"gt,omitempty"` - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - Gte *uint32 `protobuf:"fixed32,5,opt,name=gte" json:"gte,omitempty"` - // In specifies that this field must be equal to one of the specified - // values - In []uint32 `protobuf:"fixed32,6,rep,name=in" json:"in,omitempty"` - // NotIn specifies that this field cannot be equal to one of the specified - // values - NotIn []uint32 `protobuf:"fixed32,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - IgnoreEmpty *bool `protobuf:"varint,8,opt,name=ignore_empty,json=ignoreEmpty" json:"ignore_empty,omitempty"` -} - -func (x *Fixed32Rules) Reset() { - *x = Fixed32Rules{} - if protoimpl.UnsafeEnabled { - mi := &file_validate_validate_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Fixed32Rules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Fixed32Rules) ProtoMessage() {} - -func (x *Fixed32Rules) ProtoReflect() protoreflect.Message { - mi := &file_validate_validate_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Fixed32Rules.ProtoReflect.Descriptor instead. -func (*Fixed32Rules) Descriptor() ([]byte, []int) { - return file_validate_validate_proto_rawDescGZIP(), []int{9} -} - -func (x *Fixed32Rules) GetConst() uint32 { - if x != nil && x.Const != nil { - return *x.Const - } - return 0 -} - -func (x *Fixed32Rules) GetLt() uint32 { - if x != nil && x.Lt != nil { - return *x.Lt - } - return 0 -} - -func (x *Fixed32Rules) GetLte() uint32 { - if x != nil && x.Lte != nil { - return *x.Lte - } - return 0 -} - -func (x *Fixed32Rules) GetGt() uint32 { - if x != nil && x.Gt != nil { - return *x.Gt - } - return 0 -} - -func (x *Fixed32Rules) GetGte() uint32 { - if x != nil && x.Gte != nil { - return *x.Gte - } - return 0 -} - -func (x *Fixed32Rules) GetIn() []uint32 { - if x != nil { - return x.In - } - return nil -} - -func (x *Fixed32Rules) GetNotIn() []uint32 { - if x != nil { - return x.NotIn - } - return nil -} - -func (x *Fixed32Rules) GetIgnoreEmpty() bool { - if x != nil && x.IgnoreEmpty != nil { - return *x.IgnoreEmpty - } - return false -} - -// Fixed64Rules describes the constraints applied to `fixed64` values -type Fixed64Rules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Const specifies that this field must be exactly the specified value - Const *uint64 `protobuf:"fixed64,1,opt,name=const" json:"const,omitempty"` - // Lt specifies that this field must be less than the specified value, - // exclusive - Lt *uint64 `protobuf:"fixed64,2,opt,name=lt" json:"lt,omitempty"` - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - Lte *uint64 `protobuf:"fixed64,3,opt,name=lte" json:"lte,omitempty"` - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - Gt *uint64 `protobuf:"fixed64,4,opt,name=gt" json:"gt,omitempty"` - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - Gte *uint64 `protobuf:"fixed64,5,opt,name=gte" json:"gte,omitempty"` - // In specifies that this field must be equal to one of the specified - // values - In []uint64 `protobuf:"fixed64,6,rep,name=in" json:"in,omitempty"` - // NotIn specifies that this field cannot be equal to one of the specified - // values - NotIn []uint64 `protobuf:"fixed64,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - IgnoreEmpty *bool `protobuf:"varint,8,opt,name=ignore_empty,json=ignoreEmpty" json:"ignore_empty,omitempty"` -} - -func (x *Fixed64Rules) Reset() { - *x = Fixed64Rules{} - if protoimpl.UnsafeEnabled { - mi := &file_validate_validate_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Fixed64Rules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Fixed64Rules) ProtoMessage() {} - -func (x *Fixed64Rules) ProtoReflect() protoreflect.Message { - mi := &file_validate_validate_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Fixed64Rules.ProtoReflect.Descriptor instead. -func (*Fixed64Rules) Descriptor() ([]byte, []int) { - return file_validate_validate_proto_rawDescGZIP(), []int{10} -} - -func (x *Fixed64Rules) GetConst() uint64 { - if x != nil && x.Const != nil { - return *x.Const - } - return 0 -} - -func (x *Fixed64Rules) GetLt() uint64 { - if x != nil && x.Lt != nil { - return *x.Lt - } - return 0 -} - -func (x *Fixed64Rules) GetLte() uint64 { - if x != nil && x.Lte != nil { - return *x.Lte - } - return 0 -} - -func (x *Fixed64Rules) GetGt() uint64 { - if x != nil && x.Gt != nil { - return *x.Gt - } - return 0 -} - -func (x *Fixed64Rules) GetGte() uint64 { - if x != nil && x.Gte != nil { - return *x.Gte - } - return 0 -} - -func (x *Fixed64Rules) GetIn() []uint64 { - if x != nil { - return x.In - } - return nil -} - -func (x *Fixed64Rules) GetNotIn() []uint64 { - if x != nil { - return x.NotIn - } - return nil -} - -func (x *Fixed64Rules) GetIgnoreEmpty() bool { - if x != nil && x.IgnoreEmpty != nil { - return *x.IgnoreEmpty - } - return false -} - -// SFixed32Rules describes the constraints applied to `sfixed32` values -type SFixed32Rules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Const specifies that this field must be exactly the specified value - Const *int32 `protobuf:"fixed32,1,opt,name=const" json:"const,omitempty"` - // Lt specifies that this field must be less than the specified value, - // exclusive - Lt *int32 `protobuf:"fixed32,2,opt,name=lt" json:"lt,omitempty"` - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - Lte *int32 `protobuf:"fixed32,3,opt,name=lte" json:"lte,omitempty"` - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - Gt *int32 `protobuf:"fixed32,4,opt,name=gt" json:"gt,omitempty"` - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - Gte *int32 `protobuf:"fixed32,5,opt,name=gte" json:"gte,omitempty"` - // In specifies that this field must be equal to one of the specified - // values - In []int32 `protobuf:"fixed32,6,rep,name=in" json:"in,omitempty"` - // NotIn specifies that this field cannot be equal to one of the specified - // values - NotIn []int32 `protobuf:"fixed32,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - IgnoreEmpty *bool `protobuf:"varint,8,opt,name=ignore_empty,json=ignoreEmpty" json:"ignore_empty,omitempty"` -} - -func (x *SFixed32Rules) Reset() { - *x = SFixed32Rules{} - if protoimpl.UnsafeEnabled { - mi := &file_validate_validate_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SFixed32Rules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SFixed32Rules) ProtoMessage() {} - -func (x *SFixed32Rules) ProtoReflect() protoreflect.Message { - mi := &file_validate_validate_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SFixed32Rules.ProtoReflect.Descriptor instead. -func (*SFixed32Rules) Descriptor() ([]byte, []int) { - return file_validate_validate_proto_rawDescGZIP(), []int{11} -} - -func (x *SFixed32Rules) GetConst() int32 { - if x != nil && x.Const != nil { - return *x.Const - } - return 0 -} - -func (x *SFixed32Rules) GetLt() int32 { - if x != nil && x.Lt != nil { - return *x.Lt - } - return 0 -} - -func (x *SFixed32Rules) GetLte() int32 { - if x != nil && x.Lte != nil { - return *x.Lte - } - return 0 -} - -func (x *SFixed32Rules) GetGt() int32 { - if x != nil && x.Gt != nil { - return *x.Gt - } - return 0 -} - -func (x *SFixed32Rules) GetGte() int32 { - if x != nil && x.Gte != nil { - return *x.Gte - } - return 0 -} - -func (x *SFixed32Rules) GetIn() []int32 { - if x != nil { - return x.In - } - return nil -} - -func (x *SFixed32Rules) GetNotIn() []int32 { - if x != nil { - return x.NotIn - } - return nil -} - -func (x *SFixed32Rules) GetIgnoreEmpty() bool { - if x != nil && x.IgnoreEmpty != nil { - return *x.IgnoreEmpty - } - return false -} - -// SFixed64Rules describes the constraints applied to `sfixed64` values -type SFixed64Rules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Const specifies that this field must be exactly the specified value - Const *int64 `protobuf:"fixed64,1,opt,name=const" json:"const,omitempty"` - // Lt specifies that this field must be less than the specified value, - // exclusive - Lt *int64 `protobuf:"fixed64,2,opt,name=lt" json:"lt,omitempty"` - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - Lte *int64 `protobuf:"fixed64,3,opt,name=lte" json:"lte,omitempty"` - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - Gt *int64 `protobuf:"fixed64,4,opt,name=gt" json:"gt,omitempty"` - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - Gte *int64 `protobuf:"fixed64,5,opt,name=gte" json:"gte,omitempty"` - // In specifies that this field must be equal to one of the specified - // values - In []int64 `protobuf:"fixed64,6,rep,name=in" json:"in,omitempty"` - // NotIn specifies that this field cannot be equal to one of the specified - // values - NotIn []int64 `protobuf:"fixed64,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - IgnoreEmpty *bool `protobuf:"varint,8,opt,name=ignore_empty,json=ignoreEmpty" json:"ignore_empty,omitempty"` -} - -func (x *SFixed64Rules) Reset() { - *x = SFixed64Rules{} - if protoimpl.UnsafeEnabled { - mi := &file_validate_validate_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SFixed64Rules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SFixed64Rules) ProtoMessage() {} - -func (x *SFixed64Rules) ProtoReflect() protoreflect.Message { - mi := &file_validate_validate_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SFixed64Rules.ProtoReflect.Descriptor instead. -func (*SFixed64Rules) Descriptor() ([]byte, []int) { - return file_validate_validate_proto_rawDescGZIP(), []int{12} -} - -func (x *SFixed64Rules) GetConst() int64 { - if x != nil && x.Const != nil { - return *x.Const - } - return 0 -} - -func (x *SFixed64Rules) GetLt() int64 { - if x != nil && x.Lt != nil { - return *x.Lt - } - return 0 -} - -func (x *SFixed64Rules) GetLte() int64 { - if x != nil && x.Lte != nil { - return *x.Lte - } - return 0 -} - -func (x *SFixed64Rules) GetGt() int64 { - if x != nil && x.Gt != nil { - return *x.Gt - } - return 0 -} - -func (x *SFixed64Rules) GetGte() int64 { - if x != nil && x.Gte != nil { - return *x.Gte - } - return 0 -} - -func (x *SFixed64Rules) GetIn() []int64 { - if x != nil { - return x.In - } - return nil -} - -func (x *SFixed64Rules) GetNotIn() []int64 { - if x != nil { - return x.NotIn - } - return nil -} - -func (x *SFixed64Rules) GetIgnoreEmpty() bool { - if x != nil && x.IgnoreEmpty != nil { - return *x.IgnoreEmpty - } - return false -} - -// BoolRules describes the constraints applied to `bool` values -type BoolRules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Const specifies that this field must be exactly the specified value - Const *bool `protobuf:"varint,1,opt,name=const" json:"const,omitempty"` -} - -func (x *BoolRules) Reset() { - *x = BoolRules{} - if protoimpl.UnsafeEnabled { - mi := &file_validate_validate_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BoolRules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BoolRules) ProtoMessage() {} - -func (x *BoolRules) ProtoReflect() protoreflect.Message { - mi := &file_validate_validate_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BoolRules.ProtoReflect.Descriptor instead. -func (*BoolRules) Descriptor() ([]byte, []int) { - return file_validate_validate_proto_rawDescGZIP(), []int{13} -} - -func (x *BoolRules) GetConst() bool { - if x != nil && x.Const != nil { - return *x.Const - } - return false -} - -// StringRules describe the constraints applied to `string` values -type StringRules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Const specifies that this field must be exactly the specified value - Const *string `protobuf:"bytes,1,opt,name=const" json:"const,omitempty"` - // Len specifies that this field must be the specified number of - // characters (Unicode code points). Note that the number of - // characters may differ from the number of bytes in the string. - Len *uint64 `protobuf:"varint,19,opt,name=len" json:"len,omitempty"` - // MinLen specifies that this field must be the specified number of - // characters (Unicode code points) at a minimum. Note that the number of - // characters may differ from the number of bytes in the string. - MinLen *uint64 `protobuf:"varint,2,opt,name=min_len,json=minLen" json:"min_len,omitempty"` - // MaxLen specifies that this field must be the specified number of - // characters (Unicode code points) at a maximum. Note that the number of - // characters may differ from the number of bytes in the string. - MaxLen *uint64 `protobuf:"varint,3,opt,name=max_len,json=maxLen" json:"max_len,omitempty"` - // LenBytes specifies that this field must be the specified number of bytes - LenBytes *uint64 `protobuf:"varint,20,opt,name=len_bytes,json=lenBytes" json:"len_bytes,omitempty"` - // MinBytes specifies that this field must be the specified number of bytes - // at a minimum - MinBytes *uint64 `protobuf:"varint,4,opt,name=min_bytes,json=minBytes" json:"min_bytes,omitempty"` - // MaxBytes specifies that this field must be the specified number of bytes - // at a maximum - MaxBytes *uint64 `protobuf:"varint,5,opt,name=max_bytes,json=maxBytes" json:"max_bytes,omitempty"` - // Pattern specifes that this field must match against the specified - // regular expression (RE2 syntax). The included expression should elide - // any delimiters. - Pattern *string `protobuf:"bytes,6,opt,name=pattern" json:"pattern,omitempty"` - // Prefix specifies that this field must have the specified substring at - // the beginning of the string. - Prefix *string `protobuf:"bytes,7,opt,name=prefix" json:"prefix,omitempty"` - // Suffix specifies that this field must have the specified substring at - // the end of the string. - Suffix *string `protobuf:"bytes,8,opt,name=suffix" json:"suffix,omitempty"` - // Contains specifies that this field must have the specified substring - // anywhere in the string. - Contains *string `protobuf:"bytes,9,opt,name=contains" json:"contains,omitempty"` - // NotContains specifies that this field cannot have the specified substring - // anywhere in the string. - NotContains *string `protobuf:"bytes,23,opt,name=not_contains,json=notContains" json:"not_contains,omitempty"` - // In specifies that this field must be equal to one of the specified - // values - In []string `protobuf:"bytes,10,rep,name=in" json:"in,omitempty"` - // NotIn specifies that this field cannot be equal to one of the specified - // values - NotIn []string `protobuf:"bytes,11,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - // WellKnown rules provide advanced constraints against common string - // patterns - // - // Types that are assignable to WellKnown: - // - // *StringRules_Email - // *StringRules_Hostname - // *StringRules_Ip - // *StringRules_Ipv4 - // *StringRules_Ipv6 - // *StringRules_Uri - // *StringRules_UriRef - // *StringRules_Address - // *StringRules_Uuid - // *StringRules_WellKnownRegex - WellKnown isStringRules_WellKnown `protobuf_oneof:"well_known"` - // This applies to regexes HTTP_HEADER_NAME and HTTP_HEADER_VALUE to enable - // strict header validation. - // By default, this is true, and HTTP header validations are RFC-compliant. - // Setting to false will enable a looser validations that only disallows - // \r\n\0 characters, which can be used to bypass header matching rules. - Strict *bool `protobuf:"varint,25,opt,name=strict,def=1" json:"strict,omitempty"` - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - IgnoreEmpty *bool `protobuf:"varint,26,opt,name=ignore_empty,json=ignoreEmpty" json:"ignore_empty,omitempty"` -} - -// Default values for StringRules fields. -const ( - Default_StringRules_Strict = bool(true) -) - -func (x *StringRules) Reset() { - *x = StringRules{} - if protoimpl.UnsafeEnabled { - mi := &file_validate_validate_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StringRules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StringRules) ProtoMessage() {} - -func (x *StringRules) ProtoReflect() protoreflect.Message { - mi := &file_validate_validate_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StringRules.ProtoReflect.Descriptor instead. -func (*StringRules) Descriptor() ([]byte, []int) { - return file_validate_validate_proto_rawDescGZIP(), []int{14} -} - -func (x *StringRules) GetConst() string { - if x != nil && x.Const != nil { - return *x.Const - } - return "" -} - -func (x *StringRules) GetLen() uint64 { - if x != nil && x.Len != nil { - return *x.Len - } - return 0 -} - -func (x *StringRules) GetMinLen() uint64 { - if x != nil && x.MinLen != nil { - return *x.MinLen - } - return 0 -} - -func (x *StringRules) GetMaxLen() uint64 { - if x != nil && x.MaxLen != nil { - return *x.MaxLen - } - return 0 -} - -func (x *StringRules) GetLenBytes() uint64 { - if x != nil && x.LenBytes != nil { - return *x.LenBytes - } - return 0 -} - -func (x *StringRules) GetMinBytes() uint64 { - if x != nil && x.MinBytes != nil { - return *x.MinBytes - } - return 0 -} - -func (x *StringRules) GetMaxBytes() uint64 { - if x != nil && x.MaxBytes != nil { - return *x.MaxBytes - } - return 0 -} - -func (x *StringRules) GetPattern() string { - if x != nil && x.Pattern != nil { - return *x.Pattern - } - return "" -} - -func (x *StringRules) GetPrefix() string { - if x != nil && x.Prefix != nil { - return *x.Prefix - } - return "" -} - -func (x *StringRules) GetSuffix() string { - if x != nil && x.Suffix != nil { - return *x.Suffix - } - return "" -} - -func (x *StringRules) GetContains() string { - if x != nil && x.Contains != nil { - return *x.Contains - } - return "" -} - -func (x *StringRules) GetNotContains() string { - if x != nil && x.NotContains != nil { - return *x.NotContains - } - return "" -} - -func (x *StringRules) GetIn() []string { - if x != nil { - return x.In - } - return nil -} - -func (x *StringRules) GetNotIn() []string { - if x != nil { - return x.NotIn - } - return nil -} - -func (m *StringRules) GetWellKnown() isStringRules_WellKnown { - if m != nil { - return m.WellKnown - } - return nil -} - -func (x *StringRules) GetEmail() bool { - if x, ok := x.GetWellKnown().(*StringRules_Email); ok { - return x.Email - } - return false -} - -func (x *StringRules) GetHostname() bool { - if x, ok := x.GetWellKnown().(*StringRules_Hostname); ok { - return x.Hostname - } - return false -} - -func (x *StringRules) GetIp() bool { - if x, ok := x.GetWellKnown().(*StringRules_Ip); ok { - return x.Ip - } - return false -} - -func (x *StringRules) GetIpv4() bool { - if x, ok := x.GetWellKnown().(*StringRules_Ipv4); ok { - return x.Ipv4 - } - return false -} - -func (x *StringRules) GetIpv6() bool { - if x, ok := x.GetWellKnown().(*StringRules_Ipv6); ok { - return x.Ipv6 - } - return false -} - -func (x *StringRules) GetUri() bool { - if x, ok := x.GetWellKnown().(*StringRules_Uri); ok { - return x.Uri - } - return false -} - -func (x *StringRules) GetUriRef() bool { - if x, ok := x.GetWellKnown().(*StringRules_UriRef); ok { - return x.UriRef - } - return false -} - -func (x *StringRules) GetAddress() bool { - if x, ok := x.GetWellKnown().(*StringRules_Address); ok { - return x.Address - } - return false -} - -func (x *StringRules) GetUuid() bool { - if x, ok := x.GetWellKnown().(*StringRules_Uuid); ok { - return x.Uuid - } - return false -} - -func (x *StringRules) GetWellKnownRegex() KnownRegex { - if x, ok := x.GetWellKnown().(*StringRules_WellKnownRegex); ok { - return x.WellKnownRegex - } - return KnownRegex_UNKNOWN -} - -func (x *StringRules) GetStrict() bool { - if x != nil && x.Strict != nil { - return *x.Strict - } - return Default_StringRules_Strict -} - -func (x *StringRules) GetIgnoreEmpty() bool { - if x != nil && x.IgnoreEmpty != nil { - return *x.IgnoreEmpty - } - return false -} - -type isStringRules_WellKnown interface { - isStringRules_WellKnown() -} - -type StringRules_Email struct { - // Email specifies that the field must be a valid email address as - // defined by RFC 5322 - Email bool `protobuf:"varint,12,opt,name=email,oneof"` -} - -type StringRules_Hostname struct { - // Hostname specifies that the field must be a valid hostname as - // defined by RFC 1034. This constraint does not support - // internationalized domain names (IDNs). - Hostname bool `protobuf:"varint,13,opt,name=hostname,oneof"` -} - -type StringRules_Ip struct { - // Ip specifies that the field must be a valid IP (v4 or v6) address. - // Valid IPv6 addresses should not include surrounding square brackets. - Ip bool `protobuf:"varint,14,opt,name=ip,oneof"` -} - -type StringRules_Ipv4 struct { - // Ipv4 specifies that the field must be a valid IPv4 address. - Ipv4 bool `protobuf:"varint,15,opt,name=ipv4,oneof"` -} - -type StringRules_Ipv6 struct { - // Ipv6 specifies that the field must be a valid IPv6 address. Valid - // IPv6 addresses should not include surrounding square brackets. - Ipv6 bool `protobuf:"varint,16,opt,name=ipv6,oneof"` -} - -type StringRules_Uri struct { - // Uri specifies that the field must be a valid, absolute URI as defined - // by RFC 3986 - Uri bool `protobuf:"varint,17,opt,name=uri,oneof"` -} - -type StringRules_UriRef struct { - // UriRef specifies that the field must be a valid URI as defined by RFC - // 3986 and may be relative or absolute. - UriRef bool `protobuf:"varint,18,opt,name=uri_ref,json=uriRef,oneof"` -} - -type StringRules_Address struct { - // Address specifies that the field must be either a valid hostname as - // defined by RFC 1034 (which does not support internationalized domain - // names or IDNs), or it can be a valid IP (v4 or v6). - Address bool `protobuf:"varint,21,opt,name=address,oneof"` -} - -type StringRules_Uuid struct { - // Uuid specifies that the field must be a valid UUID as defined by - // RFC 4122 - Uuid bool `protobuf:"varint,22,opt,name=uuid,oneof"` -} - -type StringRules_WellKnownRegex struct { - // WellKnownRegex specifies a common well known pattern defined as a regex. - WellKnownRegex KnownRegex `protobuf:"varint,24,opt,name=well_known_regex,json=wellKnownRegex,enum=validate.KnownRegex,oneof"` -} - -func (*StringRules_Email) isStringRules_WellKnown() {} - -func (*StringRules_Hostname) isStringRules_WellKnown() {} - -func (*StringRules_Ip) isStringRules_WellKnown() {} - -func (*StringRules_Ipv4) isStringRules_WellKnown() {} - -func (*StringRules_Ipv6) isStringRules_WellKnown() {} - -func (*StringRules_Uri) isStringRules_WellKnown() {} - -func (*StringRules_UriRef) isStringRules_WellKnown() {} - -func (*StringRules_Address) isStringRules_WellKnown() {} - -func (*StringRules_Uuid) isStringRules_WellKnown() {} - -func (*StringRules_WellKnownRegex) isStringRules_WellKnown() {} - -// BytesRules describe the constraints applied to `bytes` values -type BytesRules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Const specifies that this field must be exactly the specified value - Const []byte `protobuf:"bytes,1,opt,name=const" json:"const,omitempty"` - // Len specifies that this field must be the specified number of bytes - Len *uint64 `protobuf:"varint,13,opt,name=len" json:"len,omitempty"` - // MinLen specifies that this field must be the specified number of bytes - // at a minimum - MinLen *uint64 `protobuf:"varint,2,opt,name=min_len,json=minLen" json:"min_len,omitempty"` - // MaxLen specifies that this field must be the specified number of bytes - // at a maximum - MaxLen *uint64 `protobuf:"varint,3,opt,name=max_len,json=maxLen" json:"max_len,omitempty"` - // Pattern specifes that this field must match against the specified - // regular expression (RE2 syntax). The included expression should elide - // any delimiters. - Pattern *string `protobuf:"bytes,4,opt,name=pattern" json:"pattern,omitempty"` - // Prefix specifies that this field must have the specified bytes at the - // beginning of the string. - Prefix []byte `protobuf:"bytes,5,opt,name=prefix" json:"prefix,omitempty"` - // Suffix specifies that this field must have the specified bytes at the - // end of the string. - Suffix []byte `protobuf:"bytes,6,opt,name=suffix" json:"suffix,omitempty"` - // Contains specifies that this field must have the specified bytes - // anywhere in the string. - Contains []byte `protobuf:"bytes,7,opt,name=contains" json:"contains,omitempty"` - // In specifies that this field must be equal to one of the specified - // values - In [][]byte `protobuf:"bytes,8,rep,name=in" json:"in,omitempty"` - // NotIn specifies that this field cannot be equal to one of the specified - // values - NotIn [][]byte `protobuf:"bytes,9,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - // WellKnown rules provide advanced constraints against common byte - // patterns - // - // Types that are assignable to WellKnown: - // - // *BytesRules_Ip - // *BytesRules_Ipv4 - // *BytesRules_Ipv6 - WellKnown isBytesRules_WellKnown `protobuf_oneof:"well_known"` - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - IgnoreEmpty *bool `protobuf:"varint,14,opt,name=ignore_empty,json=ignoreEmpty" json:"ignore_empty,omitempty"` -} - -func (x *BytesRules) Reset() { - *x = BytesRules{} - if protoimpl.UnsafeEnabled { - mi := &file_validate_validate_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BytesRules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BytesRules) ProtoMessage() {} - -func (x *BytesRules) ProtoReflect() protoreflect.Message { - mi := &file_validate_validate_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BytesRules.ProtoReflect.Descriptor instead. -func (*BytesRules) Descriptor() ([]byte, []int) { - return file_validate_validate_proto_rawDescGZIP(), []int{15} -} - -func (x *BytesRules) GetConst() []byte { - if x != nil { - return x.Const - } - return nil -} - -func (x *BytesRules) GetLen() uint64 { - if x != nil && x.Len != nil { - return *x.Len - } - return 0 -} - -func (x *BytesRules) GetMinLen() uint64 { - if x != nil && x.MinLen != nil { - return *x.MinLen - } - return 0 -} - -func (x *BytesRules) GetMaxLen() uint64 { - if x != nil && x.MaxLen != nil { - return *x.MaxLen - } - return 0 -} - -func (x *BytesRules) GetPattern() string { - if x != nil && x.Pattern != nil { - return *x.Pattern - } - return "" -} - -func (x *BytesRules) GetPrefix() []byte { - if x != nil { - return x.Prefix - } - return nil -} - -func (x *BytesRules) GetSuffix() []byte { - if x != nil { - return x.Suffix - } - return nil -} - -func (x *BytesRules) GetContains() []byte { - if x != nil { - return x.Contains - } - return nil -} - -func (x *BytesRules) GetIn() [][]byte { - if x != nil { - return x.In - } - return nil -} - -func (x *BytesRules) GetNotIn() [][]byte { - if x != nil { - return x.NotIn - } - return nil -} - -func (m *BytesRules) GetWellKnown() isBytesRules_WellKnown { - if m != nil { - return m.WellKnown - } - return nil -} - -func (x *BytesRules) GetIp() bool { - if x, ok := x.GetWellKnown().(*BytesRules_Ip); ok { - return x.Ip - } - return false -} - -func (x *BytesRules) GetIpv4() bool { - if x, ok := x.GetWellKnown().(*BytesRules_Ipv4); ok { - return x.Ipv4 - } - return false -} - -func (x *BytesRules) GetIpv6() bool { - if x, ok := x.GetWellKnown().(*BytesRules_Ipv6); ok { - return x.Ipv6 - } - return false -} - -func (x *BytesRules) GetIgnoreEmpty() bool { - if x != nil && x.IgnoreEmpty != nil { - return *x.IgnoreEmpty - } - return false -} - -type isBytesRules_WellKnown interface { - isBytesRules_WellKnown() -} - -type BytesRules_Ip struct { - // Ip specifies that the field must be a valid IP (v4 or v6) address in - // byte format - Ip bool `protobuf:"varint,10,opt,name=ip,oneof"` -} - -type BytesRules_Ipv4 struct { - // Ipv4 specifies that the field must be a valid IPv4 address in byte - // format - Ipv4 bool `protobuf:"varint,11,opt,name=ipv4,oneof"` -} - -type BytesRules_Ipv6 struct { - // Ipv6 specifies that the field must be a valid IPv6 address in byte - // format - Ipv6 bool `protobuf:"varint,12,opt,name=ipv6,oneof"` -} - -func (*BytesRules_Ip) isBytesRules_WellKnown() {} - -func (*BytesRules_Ipv4) isBytesRules_WellKnown() {} - -func (*BytesRules_Ipv6) isBytesRules_WellKnown() {} - -// EnumRules describe the constraints applied to enum values -type EnumRules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Const specifies that this field must be exactly the specified value - Const *int32 `protobuf:"varint,1,opt,name=const" json:"const,omitempty"` - // DefinedOnly specifies that this field must be only one of the defined - // values for this enum, failing on any undefined value. - DefinedOnly *bool `protobuf:"varint,2,opt,name=defined_only,json=definedOnly" json:"defined_only,omitempty"` - // In specifies that this field must be equal to one of the specified - // values - In []int32 `protobuf:"varint,3,rep,name=in" json:"in,omitempty"` - // NotIn specifies that this field cannot be equal to one of the specified - // values - NotIn []int32 `protobuf:"varint,4,rep,name=not_in,json=notIn" json:"not_in,omitempty"` -} - -func (x *EnumRules) Reset() { - *x = EnumRules{} - if protoimpl.UnsafeEnabled { - mi := &file_validate_validate_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EnumRules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EnumRules) ProtoMessage() {} - -func (x *EnumRules) ProtoReflect() protoreflect.Message { - mi := &file_validate_validate_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EnumRules.ProtoReflect.Descriptor instead. -func (*EnumRules) Descriptor() ([]byte, []int) { - return file_validate_validate_proto_rawDescGZIP(), []int{16} -} - -func (x *EnumRules) GetConst() int32 { - if x != nil && x.Const != nil { - return *x.Const - } - return 0 -} - -func (x *EnumRules) GetDefinedOnly() bool { - if x != nil && x.DefinedOnly != nil { - return *x.DefinedOnly - } - return false -} - -func (x *EnumRules) GetIn() []int32 { - if x != nil { - return x.In - } - return nil -} - -func (x *EnumRules) GetNotIn() []int32 { - if x != nil { - return x.NotIn - } - return nil -} - -// MessageRules describe the constraints applied to embedded message values. -// For message-type fields, validation is performed recursively. -type MessageRules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Skip specifies that the validation rules of this field should not be - // evaluated - Skip *bool `protobuf:"varint,1,opt,name=skip" json:"skip,omitempty"` - // Required specifies that this field must be set - Required *bool `protobuf:"varint,2,opt,name=required" json:"required,omitempty"` -} - -func (x *MessageRules) Reset() { - *x = MessageRules{} - if protoimpl.UnsafeEnabled { - mi := &file_validate_validate_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessageRules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessageRules) ProtoMessage() {} - -func (x *MessageRules) ProtoReflect() protoreflect.Message { - mi := &file_validate_validate_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessageRules.ProtoReflect.Descriptor instead. -func (*MessageRules) Descriptor() ([]byte, []int) { - return file_validate_validate_proto_rawDescGZIP(), []int{17} -} - -func (x *MessageRules) GetSkip() bool { - if x != nil && x.Skip != nil { - return *x.Skip - } - return false -} - -func (x *MessageRules) GetRequired() bool { - if x != nil && x.Required != nil { - return *x.Required - } - return false -} - -// RepeatedRules describe the constraints applied to `repeated` values -type RepeatedRules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // MinItems specifies that this field must have the specified number of - // items at a minimum - MinItems *uint64 `protobuf:"varint,1,opt,name=min_items,json=minItems" json:"min_items,omitempty"` - // MaxItems specifies that this field must have the specified number of - // items at a maximum - MaxItems *uint64 `protobuf:"varint,2,opt,name=max_items,json=maxItems" json:"max_items,omitempty"` - // Unique specifies that all elements in this field must be unique. This - // contraint is only applicable to scalar and enum types (messages are not - // supported). - Unique *bool `protobuf:"varint,3,opt,name=unique" json:"unique,omitempty"` - // Items specifies the contraints to be applied to each item in the field. - // Repeated message fields will still execute validation against each item - // unless skip is specified here. - Items *FieldRules `protobuf:"bytes,4,opt,name=items" json:"items,omitempty"` - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - IgnoreEmpty *bool `protobuf:"varint,5,opt,name=ignore_empty,json=ignoreEmpty" json:"ignore_empty,omitempty"` -} - -func (x *RepeatedRules) Reset() { - *x = RepeatedRules{} - if protoimpl.UnsafeEnabled { - mi := &file_validate_validate_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RepeatedRules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RepeatedRules) ProtoMessage() {} - -func (x *RepeatedRules) ProtoReflect() protoreflect.Message { - mi := &file_validate_validate_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RepeatedRules.ProtoReflect.Descriptor instead. -func (*RepeatedRules) Descriptor() ([]byte, []int) { - return file_validate_validate_proto_rawDescGZIP(), []int{18} -} - -func (x *RepeatedRules) GetMinItems() uint64 { - if x != nil && x.MinItems != nil { - return *x.MinItems - } - return 0 -} - -func (x *RepeatedRules) GetMaxItems() uint64 { - if x != nil && x.MaxItems != nil { - return *x.MaxItems - } - return 0 -} - -func (x *RepeatedRules) GetUnique() bool { - if x != nil && x.Unique != nil { - return *x.Unique - } - return false -} - -func (x *RepeatedRules) GetItems() *FieldRules { - if x != nil { - return x.Items - } - return nil -} - -func (x *RepeatedRules) GetIgnoreEmpty() bool { - if x != nil && x.IgnoreEmpty != nil { - return *x.IgnoreEmpty - } - return false -} - -// MapRules describe the constraints applied to `map` values -type MapRules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // MinPairs specifies that this field must have the specified number of - // KVs at a minimum - MinPairs *uint64 `protobuf:"varint,1,opt,name=min_pairs,json=minPairs" json:"min_pairs,omitempty"` - // MaxPairs specifies that this field must have the specified number of - // KVs at a maximum - MaxPairs *uint64 `protobuf:"varint,2,opt,name=max_pairs,json=maxPairs" json:"max_pairs,omitempty"` - // NoSparse specifies values in this field cannot be unset. This only - // applies to map's with message value types. - NoSparse *bool `protobuf:"varint,3,opt,name=no_sparse,json=noSparse" json:"no_sparse,omitempty"` - // Keys specifies the constraints to be applied to each key in the field. - Keys *FieldRules `protobuf:"bytes,4,opt,name=keys" json:"keys,omitempty"` - // Values specifies the constraints to be applied to the value of each key - // in the field. Message values will still have their validations evaluated - // unless skip is specified here. - Values *FieldRules `protobuf:"bytes,5,opt,name=values" json:"values,omitempty"` - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - IgnoreEmpty *bool `protobuf:"varint,6,opt,name=ignore_empty,json=ignoreEmpty" json:"ignore_empty,omitempty"` -} - -func (x *MapRules) Reset() { - *x = MapRules{} - if protoimpl.UnsafeEnabled { - mi := &file_validate_validate_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MapRules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MapRules) ProtoMessage() {} - -func (x *MapRules) ProtoReflect() protoreflect.Message { - mi := &file_validate_validate_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MapRules.ProtoReflect.Descriptor instead. -func (*MapRules) Descriptor() ([]byte, []int) { - return file_validate_validate_proto_rawDescGZIP(), []int{19} -} - -func (x *MapRules) GetMinPairs() uint64 { - if x != nil && x.MinPairs != nil { - return *x.MinPairs - } - return 0 -} - -func (x *MapRules) GetMaxPairs() uint64 { - if x != nil && x.MaxPairs != nil { - return *x.MaxPairs - } - return 0 -} - -func (x *MapRules) GetNoSparse() bool { - if x != nil && x.NoSparse != nil { - return *x.NoSparse - } - return false -} - -func (x *MapRules) GetKeys() *FieldRules { - if x != nil { - return x.Keys - } - return nil -} - -func (x *MapRules) GetValues() *FieldRules { - if x != nil { - return x.Values - } - return nil -} - -func (x *MapRules) GetIgnoreEmpty() bool { - if x != nil && x.IgnoreEmpty != nil { - return *x.IgnoreEmpty - } - return false -} - -// AnyRules describe constraints applied exclusively to the -// `google.protobuf.Any` well-known type -type AnyRules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Required specifies that this field must be set - Required *bool `protobuf:"varint,1,opt,name=required" json:"required,omitempty"` - // In specifies that this field's `type_url` must be equal to one of the - // specified values. - In []string `protobuf:"bytes,2,rep,name=in" json:"in,omitempty"` - // NotIn specifies that this field's `type_url` must not be equal to any of - // the specified values. - NotIn []string `protobuf:"bytes,3,rep,name=not_in,json=notIn" json:"not_in,omitempty"` -} - -func (x *AnyRules) Reset() { - *x = AnyRules{} - if protoimpl.UnsafeEnabled { - mi := &file_validate_validate_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AnyRules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AnyRules) ProtoMessage() {} - -func (x *AnyRules) ProtoReflect() protoreflect.Message { - mi := &file_validate_validate_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AnyRules.ProtoReflect.Descriptor instead. -func (*AnyRules) Descriptor() ([]byte, []int) { - return file_validate_validate_proto_rawDescGZIP(), []int{20} -} - -func (x *AnyRules) GetRequired() bool { - if x != nil && x.Required != nil { - return *x.Required - } - return false -} - -func (x *AnyRules) GetIn() []string { - if x != nil { - return x.In - } - return nil -} - -func (x *AnyRules) GetNotIn() []string { - if x != nil { - return x.NotIn - } - return nil -} - -// DurationRules describe the constraints applied exclusively to the -// `google.protobuf.Duration` well-known type -type DurationRules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Required specifies that this field must be set - Required *bool `protobuf:"varint,1,opt,name=required" json:"required,omitempty"` - // Const specifies that this field must be exactly the specified value - Const *durationpb.Duration `protobuf:"bytes,2,opt,name=const" json:"const,omitempty"` - // Lt specifies that this field must be less than the specified value, - // exclusive - Lt *durationpb.Duration `protobuf:"bytes,3,opt,name=lt" json:"lt,omitempty"` - // Lt specifies that this field must be less than the specified value, - // inclusive - Lte *durationpb.Duration `protobuf:"bytes,4,opt,name=lte" json:"lte,omitempty"` - // Gt specifies that this field must be greater than the specified value, - // exclusive - Gt *durationpb.Duration `protobuf:"bytes,5,opt,name=gt" json:"gt,omitempty"` - // Gte specifies that this field must be greater than the specified value, - // inclusive - Gte *durationpb.Duration `protobuf:"bytes,6,opt,name=gte" json:"gte,omitempty"` - // In specifies that this field must be equal to one of the specified - // values - In []*durationpb.Duration `protobuf:"bytes,7,rep,name=in" json:"in,omitempty"` - // NotIn specifies that this field cannot be equal to one of the specified - // values - NotIn []*durationpb.Duration `protobuf:"bytes,8,rep,name=not_in,json=notIn" json:"not_in,omitempty"` -} - -func (x *DurationRules) Reset() { - *x = DurationRules{} - if protoimpl.UnsafeEnabled { - mi := &file_validate_validate_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DurationRules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DurationRules) ProtoMessage() {} - -func (x *DurationRules) ProtoReflect() protoreflect.Message { - mi := &file_validate_validate_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DurationRules.ProtoReflect.Descriptor instead. -func (*DurationRules) Descriptor() ([]byte, []int) { - return file_validate_validate_proto_rawDescGZIP(), []int{21} -} - -func (x *DurationRules) GetRequired() bool { - if x != nil && x.Required != nil { - return *x.Required - } - return false -} - -func (x *DurationRules) GetConst() *durationpb.Duration { - if x != nil { - return x.Const - } - return nil -} - -func (x *DurationRules) GetLt() *durationpb.Duration { - if x != nil { - return x.Lt - } - return nil -} - -func (x *DurationRules) GetLte() *durationpb.Duration { - if x != nil { - return x.Lte - } - return nil -} - -func (x *DurationRules) GetGt() *durationpb.Duration { - if x != nil { - return x.Gt - } - return nil -} - -func (x *DurationRules) GetGte() *durationpb.Duration { - if x != nil { - return x.Gte - } - return nil -} - -func (x *DurationRules) GetIn() []*durationpb.Duration { - if x != nil { - return x.In - } - return nil -} - -func (x *DurationRules) GetNotIn() []*durationpb.Duration { - if x != nil { - return x.NotIn - } - return nil -} - -// TimestampRules describe the constraints applied exclusively to the -// `google.protobuf.Timestamp` well-known type -type TimestampRules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Required specifies that this field must be set - Required *bool `protobuf:"varint,1,opt,name=required" json:"required,omitempty"` - // Const specifies that this field must be exactly the specified value - Const *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=const" json:"const,omitempty"` - // Lt specifies that this field must be less than the specified value, - // exclusive - Lt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=lt" json:"lt,omitempty"` - // Lte specifies that this field must be less than the specified value, - // inclusive - Lte *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=lte" json:"lte,omitempty"` - // Gt specifies that this field must be greater than the specified value, - // exclusive - Gt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=gt" json:"gt,omitempty"` - // Gte specifies that this field must be greater than the specified value, - // inclusive - Gte *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=gte" json:"gte,omitempty"` - // LtNow specifies that this must be less than the current time. LtNow - // can only be used with the Within rule. - LtNow *bool `protobuf:"varint,7,opt,name=lt_now,json=ltNow" json:"lt_now,omitempty"` - // GtNow specifies that this must be greater than the current time. GtNow - // can only be used with the Within rule. - GtNow *bool `protobuf:"varint,8,opt,name=gt_now,json=gtNow" json:"gt_now,omitempty"` - // Within specifies that this field must be within this duration of the - // current time. This constraint can be used alone or with the LtNow and - // GtNow rules. - Within *durationpb.Duration `protobuf:"bytes,9,opt,name=within" json:"within,omitempty"` -} - -func (x *TimestampRules) Reset() { - *x = TimestampRules{} - if protoimpl.UnsafeEnabled { - mi := &file_validate_validate_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TimestampRules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TimestampRules) ProtoMessage() {} - -func (x *TimestampRules) ProtoReflect() protoreflect.Message { - mi := &file_validate_validate_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TimestampRules.ProtoReflect.Descriptor instead. -func (*TimestampRules) Descriptor() ([]byte, []int) { - return file_validate_validate_proto_rawDescGZIP(), []int{22} -} - -func (x *TimestampRules) GetRequired() bool { - if x != nil && x.Required != nil { - return *x.Required - } - return false -} - -func (x *TimestampRules) GetConst() *timestamppb.Timestamp { - if x != nil { - return x.Const - } - return nil -} - -func (x *TimestampRules) GetLt() *timestamppb.Timestamp { - if x != nil { - return x.Lt - } - return nil -} - -func (x *TimestampRules) GetLte() *timestamppb.Timestamp { - if x != nil { - return x.Lte - } - return nil -} - -func (x *TimestampRules) GetGt() *timestamppb.Timestamp { - if x != nil { - return x.Gt - } - return nil -} - -func (x *TimestampRules) GetGte() *timestamppb.Timestamp { - if x != nil { - return x.Gte - } - return nil -} - -func (x *TimestampRules) GetLtNow() bool { - if x != nil && x.LtNow != nil { - return *x.LtNow - } - return false -} - -func (x *TimestampRules) GetGtNow() bool { - if x != nil && x.GtNow != nil { - return *x.GtNow - } - return false -} - -func (x *TimestampRules) GetWithin() *durationpb.Duration { - if x != nil { - return x.Within - } - return nil -} - -var file_validate_validate_proto_extTypes = []protoimpl.ExtensionInfo{ - { - ExtendedType: (*descriptorpb.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 1071, - Name: "validate.disabled", - Tag: "varint,1071,opt,name=disabled", - Filename: "validate/validate.proto", - }, - { - ExtendedType: (*descriptorpb.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 1072, - Name: "validate.ignored", - Tag: "varint,1072,opt,name=ignored", - Filename: "validate/validate.proto", - }, - { - ExtendedType: (*descriptorpb.OneofOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 1071, - Name: "validate.required", - Tag: "varint,1071,opt,name=required", - Filename: "validate/validate.proto", - }, - { - ExtendedType: (*descriptorpb.FieldOptions)(nil), - ExtensionType: (*FieldRules)(nil), - Field: 1071, - Name: "validate.rules", - Tag: "bytes,1071,opt,name=rules", - Filename: "validate/validate.proto", - }, -} - -// Extension fields to descriptorpb.MessageOptions. -var ( - // Disabled nullifies any validation rules for this message, including any - // message fields associated with it that do support validation. - // - // optional bool disabled = 1071; - E_Disabled = &file_validate_validate_proto_extTypes[0] - // Ignore skips generation of validation methods for this message. - // - // optional bool ignored = 1072; - E_Ignored = &file_validate_validate_proto_extTypes[1] -) - -// Extension fields to descriptorpb.OneofOptions. -var ( - // Required ensures that exactly one the field options in a oneof is set; - // validation fails if no fields in the oneof are set. - // - // optional bool required = 1071; - E_Required = &file_validate_validate_proto_extTypes[2] -) - -// Extension fields to descriptorpb.FieldOptions. -var ( - // Rules specify the validations to be performed on this field. By default, - // no validation is performed against a field. - // - // optional validate.FieldRules rules = 1071; - E_Rules = &file_validate_validate_proto_extTypes[3] -) - -var File_validate_validate_proto protoreflect.FileDescriptor - -var file_validate_validate_proto_rawDesc = []byte{ - 0x0a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x65, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc8, 0x08, 0x0a, 0x0a, 0x46, 0x69, 0x65, 0x6c, 0x64, - 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x30, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, - 0x65, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x52, 0x07, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x2c, 0x0a, 0x05, 0x66, 0x6c, 0x6f, 0x61, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, - 0x65, 0x2e, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x05, - 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x2f, 0x0a, 0x06, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x2e, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x06, - 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x12, 0x2c, 0x0a, 0x05, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x05, 0x69, - 0x6e, 0x74, 0x33, 0x32, 0x12, 0x2c, 0x0a, 0x05, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x49, - 0x6e, 0x74, 0x36, 0x34, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x05, 0x69, 0x6e, 0x74, - 0x36, 0x34, 0x12, 0x2f, 0x0a, 0x06, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x55, 0x49, - 0x6e, 0x74, 0x33, 0x32, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x06, 0x75, 0x69, 0x6e, - 0x74, 0x33, 0x32, 0x12, 0x2f, 0x0a, 0x06, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x55, - 0x49, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x06, 0x75, 0x69, - 0x6e, 0x74, 0x36, 0x34, 0x12, 0x2f, 0x0a, 0x06, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, - 0x53, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x06, 0x73, - 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x2f, 0x0a, 0x06, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x2e, 0x53, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x06, - 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x32, 0x0a, 0x07, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, - 0x32, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x2e, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, - 0x00, 0x52, 0x07, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x12, 0x32, 0x0a, 0x07, 0x66, 0x69, - 0x78, 0x65, 0x64, 0x36, 0x34, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x76, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x52, 0x75, - 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x07, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x12, 0x35, - 0x0a, 0x08, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x17, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x46, 0x69, 0x78, - 0x65, 0x64, 0x33, 0x32, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x08, 0x73, 0x66, 0x69, - 0x78, 0x65, 0x64, 0x33, 0x32, 0x12, 0x35, 0x0a, 0x08, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, - 0x34, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x2e, 0x53, 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x52, 0x75, 0x6c, 0x65, 0x73, - 0x48, 0x00, 0x52, 0x08, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x12, 0x29, 0x0a, 0x04, - 0x62, 0x6f, 0x6f, 0x6c, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x76, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, - 0x00, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x12, 0x2f, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, - 0x52, 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x2c, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, - 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x2e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, - 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x12, 0x29, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x10, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, - 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x04, 0x65, 0x6e, 0x75, - 0x6d, 0x12, 0x35, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x12, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x52, - 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x08, - 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x26, 0x0a, 0x03, 0x6d, 0x61, 0x70, 0x18, - 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x2e, 0x4d, 0x61, 0x70, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x03, 0x6d, 0x61, 0x70, - 0x12, 0x26, 0x0a, 0x03, 0x61, 0x6e, 0x79, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, - 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x75, 0x6c, 0x65, - 0x73, 0x48, 0x00, 0x52, 0x03, 0x61, 0x6e, 0x79, 0x12, 0x35, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x76, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x75, - 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x16, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x54, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x09, - 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x22, 0xb0, 0x01, 0x0a, 0x0a, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x73, - 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 0x52, - 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x02, 0x52, 0x02, 0x6c, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6c, 0x74, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x02, 0x52, 0x03, 0x6c, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x67, 0x74, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x02, 0x52, 0x02, 0x67, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x67, 0x74, 0x65, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x02, 0x52, 0x03, 0x67, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, - 0x18, 0x06, 0x20, 0x03, 0x28, 0x02, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x15, 0x0a, 0x06, 0x6e, 0x6f, - 0x74, 0x5f, 0x69, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x02, 0x52, 0x05, 0x6e, 0x6f, 0x74, 0x49, - 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x65, 0x6d, 0x70, 0x74, - 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x22, 0xb1, 0x01, 0x0a, 0x0b, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x52, - 0x75, 0x6c, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x01, 0x52, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x02, 0x6c, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6c, 0x74, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x03, 0x6c, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, - 0x67, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x02, 0x67, 0x74, 0x12, 0x10, 0x0a, 0x03, - 0x67, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x01, 0x52, 0x03, 0x67, 0x74, 0x65, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x01, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x15, - 0x0a, 0x06, 0x6e, 0x6f, 0x74, 0x5f, 0x69, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x01, 0x52, 0x05, - 0x6e, 0x6f, 0x74, 0x49, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, - 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x67, 0x6e, - 0x6f, 0x72, 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0xb0, 0x01, 0x0a, 0x0a, 0x49, 0x6e, 0x74, - 0x33, 0x32, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x12, 0x0e, 0x0a, - 0x02, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x74, 0x12, 0x10, 0x0a, - 0x03, 0x6c, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6c, 0x74, 0x65, 0x12, - 0x0e, 0x0a, 0x02, 0x67, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x67, 0x74, 0x12, - 0x10, 0x0a, 0x03, 0x67, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x67, 0x74, - 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x05, 0x52, 0x02, 0x69, - 0x6e, 0x12, 0x15, 0x0a, 0x06, 0x6e, 0x6f, 0x74, 0x5f, 0x69, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, - 0x05, 0x52, 0x05, 0x6e, 0x6f, 0x74, 0x49, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x67, 0x6e, 0x6f, - 0x72, 0x65, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, - 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0xb0, 0x01, 0x0a, 0x0a, - 0x49, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, - 0x6e, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, - 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x6c, 0x74, - 0x12, 0x10, 0x0a, 0x03, 0x6c, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6c, - 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x67, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, - 0x67, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x67, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x03, 0x67, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x03, - 0x52, 0x02, 0x69, 0x6e, 0x12, 0x15, 0x0a, 0x06, 0x6e, 0x6f, 0x74, 0x5f, 0x69, 0x6e, 0x18, 0x07, - 0x20, 0x03, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x6f, 0x74, 0x49, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x69, - 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x0b, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0xb1, - 0x01, 0x0a, 0x0b, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x14, - 0x0a, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, - 0x6f, 0x6e, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x02, 0x6c, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6c, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x03, 0x6c, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x67, 0x74, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x02, 0x67, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x67, 0x74, 0x65, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x03, 0x67, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x06, - 0x20, 0x03, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x15, 0x0a, 0x06, 0x6e, 0x6f, 0x74, 0x5f, - 0x69, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x05, 0x6e, 0x6f, 0x74, 0x49, 0x6e, 0x12, - 0x21, 0x0a, 0x0c, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x22, 0xb1, 0x01, 0x0a, 0x0b, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x75, 0x6c, - 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x74, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x6c, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6c, 0x74, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6c, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x67, 0x74, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x67, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x67, 0x74, - 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x67, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x04, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x15, 0x0a, 0x06, - 0x6e, 0x6f, 0x74, 0x5f, 0x69, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x04, 0x52, 0x05, 0x6e, 0x6f, - 0x74, 0x49, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x65, 0x6d, - 0x70, 0x74, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x67, 0x6e, 0x6f, 0x72, - 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0xb1, 0x01, 0x0a, 0x0b, 0x53, 0x49, 0x6e, 0x74, 0x33, - 0x32, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x11, 0x52, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, - 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x11, 0x52, 0x02, 0x6c, 0x74, 0x12, 0x10, 0x0a, 0x03, - 0x6c, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x11, 0x52, 0x03, 0x6c, 0x74, 0x65, 0x12, 0x0e, - 0x0a, 0x02, 0x67, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x11, 0x52, 0x02, 0x67, 0x74, 0x12, 0x10, - 0x0a, 0x03, 0x67, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x11, 0x52, 0x03, 0x67, 0x74, 0x65, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x11, 0x52, 0x02, 0x69, 0x6e, - 0x12, 0x15, 0x0a, 0x06, 0x6e, 0x6f, 0x74, 0x5f, 0x69, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x11, - 0x52, 0x05, 0x6e, 0x6f, 0x74, 0x49, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x67, 0x6e, 0x6f, 0x72, - 0x65, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, - 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0xb1, 0x01, 0x0a, 0x0b, 0x53, - 0x49, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, - 0x6e, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x12, 0x52, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, - 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x12, 0x52, 0x02, 0x6c, 0x74, - 0x12, 0x10, 0x0a, 0x03, 0x6c, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x12, 0x52, 0x03, 0x6c, - 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x67, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x12, 0x52, 0x02, - 0x67, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x67, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x12, 0x52, - 0x03, 0x67, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x12, - 0x52, 0x02, 0x69, 0x6e, 0x12, 0x15, 0x0a, 0x06, 0x6e, 0x6f, 0x74, 0x5f, 0x69, 0x6e, 0x18, 0x07, - 0x20, 0x03, 0x28, 0x12, 0x52, 0x05, 0x6e, 0x6f, 0x74, 0x49, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x69, - 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x0b, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0xb2, - 0x01, 0x0a, 0x0c, 0x46, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, - 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x07, 0x52, 0x05, - 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x07, 0x52, 0x02, 0x6c, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6c, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x07, 0x52, 0x03, 0x6c, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x67, 0x74, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x07, 0x52, 0x02, 0x67, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x67, 0x74, 0x65, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x07, 0x52, 0x03, 0x67, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, - 0x06, 0x20, 0x03, 0x28, 0x07, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x15, 0x0a, 0x06, 0x6e, 0x6f, 0x74, - 0x5f, 0x69, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x07, 0x52, 0x05, 0x6e, 0x6f, 0x74, 0x49, 0x6e, - 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, - 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x22, 0xb2, 0x01, 0x0a, 0x0c, 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x52, - 0x75, 0x6c, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x06, 0x52, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x06, 0x52, 0x02, 0x6c, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6c, 0x74, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x06, 0x52, 0x03, 0x6c, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, - 0x67, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x06, 0x52, 0x02, 0x67, 0x74, 0x12, 0x10, 0x0a, 0x03, - 0x67, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x06, 0x52, 0x03, 0x67, 0x74, 0x65, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x06, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x15, - 0x0a, 0x06, 0x6e, 0x6f, 0x74, 0x5f, 0x69, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x06, 0x52, 0x05, - 0x6e, 0x6f, 0x74, 0x49, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, - 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x67, 0x6e, - 0x6f, 0x72, 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0xb3, 0x01, 0x0a, 0x0d, 0x53, 0x46, 0x69, - 0x78, 0x65, 0x64, 0x33, 0x32, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, - 0x6e, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0f, 0x52, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, - 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0f, 0x52, 0x02, 0x6c, 0x74, - 0x12, 0x10, 0x0a, 0x03, 0x6c, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0f, 0x52, 0x03, 0x6c, - 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x67, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0f, 0x52, 0x02, - 0x67, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x67, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0f, 0x52, - 0x03, 0x67, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0f, - 0x52, 0x02, 0x69, 0x6e, 0x12, 0x15, 0x0a, 0x06, 0x6e, 0x6f, 0x74, 0x5f, 0x69, 0x6e, 0x18, 0x07, - 0x20, 0x03, 0x28, 0x0f, 0x52, 0x05, 0x6e, 0x6f, 0x74, 0x49, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x69, - 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x0b, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0xb3, - 0x01, 0x0a, 0x0d, 0x53, 0x46, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x52, 0x75, 0x6c, 0x65, 0x73, - 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x10, 0x52, - 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x10, 0x52, 0x02, 0x6c, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6c, 0x74, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x10, 0x52, 0x03, 0x6c, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x67, 0x74, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x10, 0x52, 0x02, 0x67, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x67, 0x74, 0x65, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x10, 0x52, 0x03, 0x67, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, - 0x18, 0x06, 0x20, 0x03, 0x28, 0x10, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x15, 0x0a, 0x06, 0x6e, 0x6f, - 0x74, 0x5f, 0x69, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x10, 0x52, 0x05, 0x6e, 0x6f, 0x74, 0x49, - 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x65, 0x6d, 0x70, 0x74, - 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x22, 0x21, 0x0a, 0x09, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x75, 0x6c, 0x65, - 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x22, 0xd4, 0x05, 0x0a, 0x0b, 0x53, 0x74, 0x72, 0x69, - 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x12, 0x10, 0x0a, - 0x03, 0x6c, 0x65, 0x6e, 0x18, 0x13, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6c, 0x65, 0x6e, 0x12, - 0x17, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x06, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x5f, - 0x6c, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6d, 0x61, 0x78, 0x4c, 0x65, - 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x65, 0x6e, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x14, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x6c, 0x65, 0x6e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1b, - 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, - 0x61, 0x78, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, - 0x6d, 0x61, 0x78, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x75, - 0x66, 0x66, 0x69, 0x78, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x75, 0x66, 0x66, - 0x69, 0x78, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x18, 0x09, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x12, 0x21, - 0x0a, 0x0c, 0x6e, 0x6f, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x18, 0x17, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6e, 0x6f, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x02, 0x69, - 0x6e, 0x12, 0x15, 0x0a, 0x06, 0x6e, 0x6f, 0x74, 0x5f, 0x69, 0x6e, 0x18, 0x0b, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x05, 0x6e, 0x6f, 0x74, 0x49, 0x6e, 0x12, 0x16, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, - 0x6c, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, - 0x12, 0x1c, 0x0a, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0d, 0x20, 0x01, - 0x28, 0x08, 0x48, 0x00, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, - 0x0a, 0x02, 0x69, 0x70, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x02, 0x69, 0x70, - 0x12, 0x14, 0x0a, 0x04, 0x69, 0x70, 0x76, 0x34, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, - 0x52, 0x04, 0x69, 0x70, 0x76, 0x34, 0x12, 0x14, 0x0a, 0x04, 0x69, 0x70, 0x76, 0x36, 0x18, 0x10, - 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x04, 0x69, 0x70, 0x76, 0x36, 0x12, 0x12, 0x0a, 0x03, - 0x75, 0x72, 0x69, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x03, 0x75, 0x72, 0x69, - 0x12, 0x19, 0x0a, 0x07, 0x75, 0x72, 0x69, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x12, 0x20, 0x01, 0x28, - 0x08, 0x48, 0x00, 0x52, 0x06, 0x75, 0x72, 0x69, 0x52, 0x65, 0x66, 0x12, 0x1a, 0x0a, 0x07, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x15, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x07, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x14, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, - 0x16, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x40, 0x0a, - 0x10, 0x77, 0x65, 0x6c, 0x6c, 0x5f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x72, 0x65, 0x67, 0x65, - 0x78, 0x18, 0x18, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x2e, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x67, 0x65, 0x78, 0x48, 0x00, 0x52, - 0x0e, 0x77, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x67, 0x65, 0x78, 0x12, - 0x1c, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x18, 0x19, 0x20, 0x01, 0x28, 0x08, 0x3a, - 0x04, 0x74, 0x72, 0x75, 0x65, 0x52, 0x06, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x12, 0x21, 0x0a, - 0x0c, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x1a, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x42, 0x0c, 0x0a, 0x0a, 0x77, 0x65, 0x6c, 0x6c, 0x5f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x22, 0xe2, - 0x02, 0x0a, 0x0a, 0x42, 0x79, 0x74, 0x65, 0x73, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x14, 0x0a, - 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x63, 0x6f, - 0x6e, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6c, 0x65, 0x6e, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x03, 0x6c, 0x65, 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x12, 0x17, - 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x06, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x75, 0x66, - 0x66, 0x69, 0x78, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x75, 0x66, 0x66, 0x69, - 0x78, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x6e, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x15, 0x0a, - 0x06, 0x6e, 0x6f, 0x74, 0x5f, 0x69, 0x6e, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x05, 0x6e, - 0x6f, 0x74, 0x49, 0x6e, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, - 0x48, 0x00, 0x52, 0x02, 0x69, 0x70, 0x12, 0x14, 0x0a, 0x04, 0x69, 0x70, 0x76, 0x34, 0x18, 0x0b, - 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x04, 0x69, 0x70, 0x76, 0x34, 0x12, 0x14, 0x0a, 0x04, - 0x69, 0x70, 0x76, 0x36, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x04, 0x69, 0x70, - 0x76, 0x36, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x65, 0x6d, 0x70, - 0x74, 0x79, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x0c, 0x0a, 0x0a, 0x77, 0x65, 0x6c, 0x6c, 0x5f, 0x6b, 0x6e, - 0x6f, 0x77, 0x6e, 0x22, 0x6b, 0x0a, 0x09, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x75, 0x6c, 0x65, 0x73, - 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, - 0x64, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x64, 0x65, - 0x66, 0x69, 0x6e, 0x65, 0x64, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x15, 0x0a, 0x06, 0x6e, 0x6f, 0x74, - 0x5f, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x6f, 0x74, 0x49, 0x6e, - 0x22, 0x3e, 0x0a, 0x0c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x75, 0x6c, 0x65, 0x73, - 0x12, 0x12, 0x0a, 0x04, 0x73, 0x6b, 0x69, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, - 0x73, 0x6b, 0x69, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, - 0x22, 0xb0, 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x52, 0x75, 0x6c, - 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, - 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x16, 0x0a, 0x06, - 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x75, 0x6e, - 0x69, 0x71, 0x75, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, - 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x22, 0xdc, 0x01, 0x0a, 0x08, 0x4d, 0x61, 0x70, 0x52, 0x75, 0x6c, 0x65, 0x73, - 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x70, 0x61, 0x69, 0x72, 0x73, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x50, 0x61, 0x69, 0x72, 0x73, 0x12, 0x1b, 0x0a, - 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x61, 0x69, 0x72, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x08, 0x6d, 0x61, 0x78, 0x50, 0x61, 0x69, 0x72, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x6f, - 0x5f, 0x73, 0x70, 0x61, 0x72, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6e, - 0x6f, 0x53, 0x70, 0x61, 0x72, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x52, 0x04, 0x6b, 0x65, 0x79, - 0x73, 0x12, 0x2c, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x14, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x46, 0x69, 0x65, - 0x6c, 0x64, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, - 0x21, 0x0a, 0x0c, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x22, 0x4d, 0x0a, 0x08, 0x41, 0x6e, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x1a, - 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x15, 0x0a, 0x06, 0x6e, 0x6f, - 0x74, 0x5f, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x6e, 0x6f, 0x74, 0x49, - 0x6e, 0x22, 0xe9, 0x02, 0x0a, 0x0d, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x75, - 0x6c, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, - 0x2f, 0x0a, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, - 0x12, 0x29, 0x0a, 0x02, 0x6c, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, - 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x02, 0x6c, 0x74, 0x12, 0x2b, 0x0a, 0x03, 0x6c, - 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x6c, 0x74, 0x65, 0x12, 0x29, 0x0a, 0x02, 0x67, 0x74, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x02, 0x67, 0x74, 0x12, 0x2b, 0x0a, 0x03, 0x67, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x67, 0x74, 0x65, - 0x12, 0x29, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, - 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x30, 0x0a, 0x06, 0x6e, - 0x6f, 0x74, 0x5f, 0x69, 0x6e, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x6e, 0x6f, 0x74, 0x49, 0x6e, 0x22, 0xf3, 0x02, - 0x0a, 0x0e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x75, 0x6c, 0x65, 0x73, - 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x30, 0x0a, 0x05, - 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x05, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x12, 0x2a, - 0x0a, 0x02, 0x6c, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x02, 0x6c, 0x74, 0x12, 0x2c, 0x0a, 0x03, 0x6c, 0x74, - 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x52, 0x03, 0x6c, 0x74, 0x65, 0x12, 0x2a, 0x0a, 0x02, 0x67, 0x74, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x52, 0x02, 0x67, 0x74, 0x12, 0x2c, 0x0a, 0x03, 0x67, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x03, 0x67, - 0x74, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x6c, 0x74, 0x5f, 0x6e, 0x6f, 0x77, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x05, 0x6c, 0x74, 0x4e, 0x6f, 0x77, 0x12, 0x15, 0x0a, 0x06, 0x67, 0x74, 0x5f, - 0x6e, 0x6f, 0x77, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x67, 0x74, 0x4e, 0x6f, 0x77, - 0x12, 0x31, 0x0a, 0x06, 0x77, 0x69, 0x74, 0x68, 0x69, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x77, 0x69, 0x74, - 0x68, 0x69, 0x6e, 0x2a, 0x46, 0x0a, 0x0a, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x67, 0x65, - 0x78, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x14, - 0x0a, 0x10, 0x48, 0x54, 0x54, 0x50, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5f, 0x4e, 0x41, - 0x4d, 0x45, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x48, 0x54, 0x54, 0x50, 0x5f, 0x48, 0x45, 0x41, - 0x44, 0x45, 0x52, 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x10, 0x02, 0x3a, 0x3c, 0x0a, 0x08, 0x64, - 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xaf, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x3a, 0x3a, 0x0a, 0x07, 0x69, 0x67, 0x6e, - 0x6f, 0x72, 0x65, 0x64, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xb0, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x67, - 0x6e, 0x6f, 0x72, 0x65, 0x64, 0x3a, 0x3a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, - 0x64, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x18, 0xaf, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, - 0x64, 0x3a, 0x4a, 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, - 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xaf, 0x08, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x14, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x46, 0x69, 0x65, 0x6c, - 0x64, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x42, 0x50, 0x0a, - 0x1a, 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x70, - 0x67, 0x76, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5a, 0x32, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, - 0x78, 0x79, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x76, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, -} - -var ( - file_validate_validate_proto_rawDescOnce sync.Once - file_validate_validate_proto_rawDescData = file_validate_validate_proto_rawDesc -) - -func file_validate_validate_proto_rawDescGZIP() []byte { - file_validate_validate_proto_rawDescOnce.Do(func() { - file_validate_validate_proto_rawDescData = protoimpl.X.CompressGZIP(file_validate_validate_proto_rawDescData) - }) - return file_validate_validate_proto_rawDescData -} - -var file_validate_validate_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_validate_validate_proto_msgTypes = make([]protoimpl.MessageInfo, 23) -var file_validate_validate_proto_goTypes = []interface{}{ - (KnownRegex)(0), // 0: validate.KnownRegex - (*FieldRules)(nil), // 1: validate.FieldRules - (*FloatRules)(nil), // 2: validate.FloatRules - (*DoubleRules)(nil), // 3: validate.DoubleRules - (*Int32Rules)(nil), // 4: validate.Int32Rules - (*Int64Rules)(nil), // 5: validate.Int64Rules - (*UInt32Rules)(nil), // 6: validate.UInt32Rules - (*UInt64Rules)(nil), // 7: validate.UInt64Rules - (*SInt32Rules)(nil), // 8: validate.SInt32Rules - (*SInt64Rules)(nil), // 9: validate.SInt64Rules - (*Fixed32Rules)(nil), // 10: validate.Fixed32Rules - (*Fixed64Rules)(nil), // 11: validate.Fixed64Rules - (*SFixed32Rules)(nil), // 12: validate.SFixed32Rules - (*SFixed64Rules)(nil), // 13: validate.SFixed64Rules - (*BoolRules)(nil), // 14: validate.BoolRules - (*StringRules)(nil), // 15: validate.StringRules - (*BytesRules)(nil), // 16: validate.BytesRules - (*EnumRules)(nil), // 17: validate.EnumRules - (*MessageRules)(nil), // 18: validate.MessageRules - (*RepeatedRules)(nil), // 19: validate.RepeatedRules - (*MapRules)(nil), // 20: validate.MapRules - (*AnyRules)(nil), // 21: validate.AnyRules - (*DurationRules)(nil), // 22: validate.DurationRules - (*TimestampRules)(nil), // 23: validate.TimestampRules - (*durationpb.Duration)(nil), // 24: google.protobuf.Duration - (*timestamppb.Timestamp)(nil), // 25: google.protobuf.Timestamp - (*descriptorpb.MessageOptions)(nil), // 26: google.protobuf.MessageOptions - (*descriptorpb.OneofOptions)(nil), // 27: google.protobuf.OneofOptions - (*descriptorpb.FieldOptions)(nil), // 28: google.protobuf.FieldOptions -} -var file_validate_validate_proto_depIdxs = []int32{ - 18, // 0: validate.FieldRules.message:type_name -> validate.MessageRules - 2, // 1: validate.FieldRules.float:type_name -> validate.FloatRules - 3, // 2: validate.FieldRules.double:type_name -> validate.DoubleRules - 4, // 3: validate.FieldRules.int32:type_name -> validate.Int32Rules - 5, // 4: validate.FieldRules.int64:type_name -> validate.Int64Rules - 6, // 5: validate.FieldRules.uint32:type_name -> validate.UInt32Rules - 7, // 6: validate.FieldRules.uint64:type_name -> validate.UInt64Rules - 8, // 7: validate.FieldRules.sint32:type_name -> validate.SInt32Rules - 9, // 8: validate.FieldRules.sint64:type_name -> validate.SInt64Rules - 10, // 9: validate.FieldRules.fixed32:type_name -> validate.Fixed32Rules - 11, // 10: validate.FieldRules.fixed64:type_name -> validate.Fixed64Rules - 12, // 11: validate.FieldRules.sfixed32:type_name -> validate.SFixed32Rules - 13, // 12: validate.FieldRules.sfixed64:type_name -> validate.SFixed64Rules - 14, // 13: validate.FieldRules.bool:type_name -> validate.BoolRules - 15, // 14: validate.FieldRules.string:type_name -> validate.StringRules - 16, // 15: validate.FieldRules.bytes:type_name -> validate.BytesRules - 17, // 16: validate.FieldRules.enum:type_name -> validate.EnumRules - 19, // 17: validate.FieldRules.repeated:type_name -> validate.RepeatedRules - 20, // 18: validate.FieldRules.map:type_name -> validate.MapRules - 21, // 19: validate.FieldRules.any:type_name -> validate.AnyRules - 22, // 20: validate.FieldRules.duration:type_name -> validate.DurationRules - 23, // 21: validate.FieldRules.timestamp:type_name -> validate.TimestampRules - 0, // 22: validate.StringRules.well_known_regex:type_name -> validate.KnownRegex - 1, // 23: validate.RepeatedRules.items:type_name -> validate.FieldRules - 1, // 24: validate.MapRules.keys:type_name -> validate.FieldRules - 1, // 25: validate.MapRules.values:type_name -> validate.FieldRules - 24, // 26: validate.DurationRules.const:type_name -> google.protobuf.Duration - 24, // 27: validate.DurationRules.lt:type_name -> google.protobuf.Duration - 24, // 28: validate.DurationRules.lte:type_name -> google.protobuf.Duration - 24, // 29: validate.DurationRules.gt:type_name -> google.protobuf.Duration - 24, // 30: validate.DurationRules.gte:type_name -> google.protobuf.Duration - 24, // 31: validate.DurationRules.in:type_name -> google.protobuf.Duration - 24, // 32: validate.DurationRules.not_in:type_name -> google.protobuf.Duration - 25, // 33: validate.TimestampRules.const:type_name -> google.protobuf.Timestamp - 25, // 34: validate.TimestampRules.lt:type_name -> google.protobuf.Timestamp - 25, // 35: validate.TimestampRules.lte:type_name -> google.protobuf.Timestamp - 25, // 36: validate.TimestampRules.gt:type_name -> google.protobuf.Timestamp - 25, // 37: validate.TimestampRules.gte:type_name -> google.protobuf.Timestamp - 24, // 38: validate.TimestampRules.within:type_name -> google.protobuf.Duration - 26, // 39: validate.disabled:extendee -> google.protobuf.MessageOptions - 26, // 40: validate.ignored:extendee -> google.protobuf.MessageOptions - 27, // 41: validate.required:extendee -> google.protobuf.OneofOptions - 28, // 42: validate.rules:extendee -> google.protobuf.FieldOptions - 1, // 43: validate.rules:type_name -> validate.FieldRules - 44, // [44:44] is the sub-list for method output_type - 44, // [44:44] is the sub-list for method input_type - 43, // [43:44] is the sub-list for extension type_name - 39, // [39:43] is the sub-list for extension extendee - 0, // [0:39] is the sub-list for field type_name -} - -func init() { file_validate_validate_proto_init() } -func file_validate_validate_proto_init() { - if File_validate_validate_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_validate_validate_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FieldRules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_validate_validate_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FloatRules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_validate_validate_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DoubleRules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_validate_validate_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Int32Rules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_validate_validate_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Int64Rules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_validate_validate_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UInt32Rules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_validate_validate_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UInt64Rules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_validate_validate_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SInt32Rules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_validate_validate_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SInt64Rules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_validate_validate_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Fixed32Rules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_validate_validate_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Fixed64Rules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_validate_validate_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SFixed32Rules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_validate_validate_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SFixed64Rules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_validate_validate_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BoolRules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_validate_validate_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StringRules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_validate_validate_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BytesRules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_validate_validate_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EnumRules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_validate_validate_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageRules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_validate_validate_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RepeatedRules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_validate_validate_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MapRules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_validate_validate_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AnyRules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_validate_validate_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DurationRules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_validate_validate_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TimestampRules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_validate_validate_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*FieldRules_Float)(nil), - (*FieldRules_Double)(nil), - (*FieldRules_Int32)(nil), - (*FieldRules_Int64)(nil), - (*FieldRules_Uint32)(nil), - (*FieldRules_Uint64)(nil), - (*FieldRules_Sint32)(nil), - (*FieldRules_Sint64)(nil), - (*FieldRules_Fixed32)(nil), - (*FieldRules_Fixed64)(nil), - (*FieldRules_Sfixed32)(nil), - (*FieldRules_Sfixed64)(nil), - (*FieldRules_Bool)(nil), - (*FieldRules_String_)(nil), - (*FieldRules_Bytes)(nil), - (*FieldRules_Enum)(nil), - (*FieldRules_Repeated)(nil), - (*FieldRules_Map)(nil), - (*FieldRules_Any)(nil), - (*FieldRules_Duration)(nil), - (*FieldRules_Timestamp)(nil), - } - file_validate_validate_proto_msgTypes[14].OneofWrappers = []interface{}{ - (*StringRules_Email)(nil), - (*StringRules_Hostname)(nil), - (*StringRules_Ip)(nil), - (*StringRules_Ipv4)(nil), - (*StringRules_Ipv6)(nil), - (*StringRules_Uri)(nil), - (*StringRules_UriRef)(nil), - (*StringRules_Address)(nil), - (*StringRules_Uuid)(nil), - (*StringRules_WellKnownRegex)(nil), - } - file_validate_validate_proto_msgTypes[15].OneofWrappers = []interface{}{ - (*BytesRules_Ip)(nil), - (*BytesRules_Ipv4)(nil), - (*BytesRules_Ipv6)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_validate_validate_proto_rawDesc, - NumEnums: 1, - NumMessages: 23, - NumExtensions: 4, - NumServices: 0, - }, - GoTypes: file_validate_validate_proto_goTypes, - DependencyIndexes: file_validate_validate_proto_depIdxs, - EnumInfos: file_validate_validate_proto_enumTypes, - MessageInfos: file_validate_validate_proto_msgTypes, - ExtensionInfos: file_validate_validate_proto_extTypes, - }.Build() - File_validate_validate_proto = out.File - file_validate_validate_proto_rawDesc = nil - file_validate_validate_proto_goTypes = nil - file_validate_validate_proto_depIdxs = nil -} diff --git a/vendor/github.com/envoyproxy/protoc-gen-validate/validate/validate.proto b/vendor/github.com/envoyproxy/protoc-gen-validate/validate/validate.proto deleted file mode 100644 index 5aa965393..000000000 --- a/vendor/github.com/envoyproxy/protoc-gen-validate/validate/validate.proto +++ /dev/null @@ -1,862 +0,0 @@ -syntax = "proto2"; -package validate; - -option go_package = "github.com/envoyproxy/protoc-gen-validate/validate"; -option java_package = "io.envoyproxy.pgv.validate"; - -import "google/protobuf/descriptor.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; - -// Validation rules applied at the message level -extend google.protobuf.MessageOptions { - // Disabled nullifies any validation rules for this message, including any - // message fields associated with it that do support validation. - optional bool disabled = 1071; - // Ignore skips generation of validation methods for this message. - optional bool ignored = 1072; -} - -// Validation rules applied at the oneof level -extend google.protobuf.OneofOptions { - // Required ensures that exactly one the field options in a oneof is set; - // validation fails if no fields in the oneof are set. - optional bool required = 1071; -} - -// Validation rules applied at the field level -extend google.protobuf.FieldOptions { - // Rules specify the validations to be performed on this field. By default, - // no validation is performed against a field. - optional FieldRules rules = 1071; -} - -// FieldRules encapsulates the rules for each type of field. Depending on the -// field, the correct set should be used to ensure proper validations. -message FieldRules { - optional MessageRules message = 17; - oneof type { - // Scalar Field Types - FloatRules float = 1; - DoubleRules double = 2; - Int32Rules int32 = 3; - Int64Rules int64 = 4; - UInt32Rules uint32 = 5; - UInt64Rules uint64 = 6; - SInt32Rules sint32 = 7; - SInt64Rules sint64 = 8; - Fixed32Rules fixed32 = 9; - Fixed64Rules fixed64 = 10; - SFixed32Rules sfixed32 = 11; - SFixed64Rules sfixed64 = 12; - BoolRules bool = 13; - StringRules string = 14; - BytesRules bytes = 15; - - // Complex Field Types - EnumRules enum = 16; - RepeatedRules repeated = 18; - MapRules map = 19; - - // Well-Known Field Types - AnyRules any = 20; - DurationRules duration = 21; - TimestampRules timestamp = 22; - } -} - -// FloatRules describes the constraints applied to `float` values -message FloatRules { - // Const specifies that this field must be exactly the specified value - optional float const = 1; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional float lt = 2; - - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - optional float lte = 3; - - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - optional float gt = 4; - - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - optional float gte = 5; - - // In specifies that this field must be equal to one of the specified - // values - repeated float in = 6; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated float not_in = 7; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 8; -} - -// DoubleRules describes the constraints applied to `double` values -message DoubleRules { - // Const specifies that this field must be exactly the specified value - optional double const = 1; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional double lt = 2; - - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - optional double lte = 3; - - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - optional double gt = 4; - - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - optional double gte = 5; - - // In specifies that this field must be equal to one of the specified - // values - repeated double in = 6; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated double not_in = 7; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 8; -} - -// Int32Rules describes the constraints applied to `int32` values -message Int32Rules { - // Const specifies that this field must be exactly the specified value - optional int32 const = 1; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional int32 lt = 2; - - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - optional int32 lte = 3; - - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - optional int32 gt = 4; - - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - optional int32 gte = 5; - - // In specifies that this field must be equal to one of the specified - // values - repeated int32 in = 6; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated int32 not_in = 7; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 8; -} - -// Int64Rules describes the constraints applied to `int64` values -message Int64Rules { - // Const specifies that this field must be exactly the specified value - optional int64 const = 1; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional int64 lt = 2; - - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - optional int64 lte = 3; - - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - optional int64 gt = 4; - - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - optional int64 gte = 5; - - // In specifies that this field must be equal to one of the specified - // values - repeated int64 in = 6; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated int64 not_in = 7; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 8; -} - -// UInt32Rules describes the constraints applied to `uint32` values -message UInt32Rules { - // Const specifies that this field must be exactly the specified value - optional uint32 const = 1; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional uint32 lt = 2; - - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - optional uint32 lte = 3; - - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - optional uint32 gt = 4; - - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - optional uint32 gte = 5; - - // In specifies that this field must be equal to one of the specified - // values - repeated uint32 in = 6; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated uint32 not_in = 7; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 8; -} - -// UInt64Rules describes the constraints applied to `uint64` values -message UInt64Rules { - // Const specifies that this field must be exactly the specified value - optional uint64 const = 1; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional uint64 lt = 2; - - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - optional uint64 lte = 3; - - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - optional uint64 gt = 4; - - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - optional uint64 gte = 5; - - // In specifies that this field must be equal to one of the specified - // values - repeated uint64 in = 6; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated uint64 not_in = 7; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 8; -} - -// SInt32Rules describes the constraints applied to `sint32` values -message SInt32Rules { - // Const specifies that this field must be exactly the specified value - optional sint32 const = 1; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional sint32 lt = 2; - - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - optional sint32 lte = 3; - - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - optional sint32 gt = 4; - - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - optional sint32 gte = 5; - - // In specifies that this field must be equal to one of the specified - // values - repeated sint32 in = 6; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated sint32 not_in = 7; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 8; -} - -// SInt64Rules describes the constraints applied to `sint64` values -message SInt64Rules { - // Const specifies that this field must be exactly the specified value - optional sint64 const = 1; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional sint64 lt = 2; - - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - optional sint64 lte = 3; - - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - optional sint64 gt = 4; - - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - optional sint64 gte = 5; - - // In specifies that this field must be equal to one of the specified - // values - repeated sint64 in = 6; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated sint64 not_in = 7; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 8; -} - -// Fixed32Rules describes the constraints applied to `fixed32` values -message Fixed32Rules { - // Const specifies that this field must be exactly the specified value - optional fixed32 const = 1; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional fixed32 lt = 2; - - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - optional fixed32 lte = 3; - - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - optional fixed32 gt = 4; - - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - optional fixed32 gte = 5; - - // In specifies that this field must be equal to one of the specified - // values - repeated fixed32 in = 6; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated fixed32 not_in = 7; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 8; -} - -// Fixed64Rules describes the constraints applied to `fixed64` values -message Fixed64Rules { - // Const specifies that this field must be exactly the specified value - optional fixed64 const = 1; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional fixed64 lt = 2; - - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - optional fixed64 lte = 3; - - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - optional fixed64 gt = 4; - - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - optional fixed64 gte = 5; - - // In specifies that this field must be equal to one of the specified - // values - repeated fixed64 in = 6; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated fixed64 not_in = 7; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 8; -} - -// SFixed32Rules describes the constraints applied to `sfixed32` values -message SFixed32Rules { - // Const specifies that this field must be exactly the specified value - optional sfixed32 const = 1; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional sfixed32 lt = 2; - - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - optional sfixed32 lte = 3; - - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - optional sfixed32 gt = 4; - - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - optional sfixed32 gte = 5; - - // In specifies that this field must be equal to one of the specified - // values - repeated sfixed32 in = 6; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated sfixed32 not_in = 7; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 8; -} - -// SFixed64Rules describes the constraints applied to `sfixed64` values -message SFixed64Rules { - // Const specifies that this field must be exactly the specified value - optional sfixed64 const = 1; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional sfixed64 lt = 2; - - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - optional sfixed64 lte = 3; - - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - optional sfixed64 gt = 4; - - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - optional sfixed64 gte = 5; - - // In specifies that this field must be equal to one of the specified - // values - repeated sfixed64 in = 6; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated sfixed64 not_in = 7; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 8; -} - -// BoolRules describes the constraints applied to `bool` values -message BoolRules { - // Const specifies that this field must be exactly the specified value - optional bool const = 1; -} - -// StringRules describe the constraints applied to `string` values -message StringRules { - // Const specifies that this field must be exactly the specified value - optional string const = 1; - - // Len specifies that this field must be the specified number of - // characters (Unicode code points). Note that the number of - // characters may differ from the number of bytes in the string. - optional uint64 len = 19; - - // MinLen specifies that this field must be the specified number of - // characters (Unicode code points) at a minimum. Note that the number of - // characters may differ from the number of bytes in the string. - optional uint64 min_len = 2; - - // MaxLen specifies that this field must be the specified number of - // characters (Unicode code points) at a maximum. Note that the number of - // characters may differ from the number of bytes in the string. - optional uint64 max_len = 3; - - // LenBytes specifies that this field must be the specified number of bytes - optional uint64 len_bytes = 20; - - // MinBytes specifies that this field must be the specified number of bytes - // at a minimum - optional uint64 min_bytes = 4; - - // MaxBytes specifies that this field must be the specified number of bytes - // at a maximum - optional uint64 max_bytes = 5; - - // Pattern specifies that this field must match against the specified - // regular expression (RE2 syntax). The included expression should elide - // any delimiters. - optional string pattern = 6; - - // Prefix specifies that this field must have the specified substring at - // the beginning of the string. - optional string prefix = 7; - - // Suffix specifies that this field must have the specified substring at - // the end of the string. - optional string suffix = 8; - - // Contains specifies that this field must have the specified substring - // anywhere in the string. - optional string contains = 9; - - // NotContains specifies that this field cannot have the specified substring - // anywhere in the string. - optional string not_contains = 23; - - // In specifies that this field must be equal to one of the specified - // values - repeated string in = 10; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated string not_in = 11; - - // WellKnown rules provide advanced constraints against common string - // patterns - oneof well_known { - // Email specifies that the field must be a valid email address as - // defined by RFC 5322 - bool email = 12; - - // Hostname specifies that the field must be a valid hostname as - // defined by RFC 1034. This constraint does not support - // internationalized domain names (IDNs). - bool hostname = 13; - - // Ip specifies that the field must be a valid IP (v4 or v6) address. - // Valid IPv6 addresses should not include surrounding square brackets. - bool ip = 14; - - // Ipv4 specifies that the field must be a valid IPv4 address. - bool ipv4 = 15; - - // Ipv6 specifies that the field must be a valid IPv6 address. Valid - // IPv6 addresses should not include surrounding square brackets. - bool ipv6 = 16; - - // Uri specifies that the field must be a valid, absolute URI as defined - // by RFC 3986 - bool uri = 17; - - // UriRef specifies that the field must be a valid URI as defined by RFC - // 3986 and may be relative or absolute. - bool uri_ref = 18; - - // Address specifies that the field must be either a valid hostname as - // defined by RFC 1034 (which does not support internationalized domain - // names or IDNs), or it can be a valid IP (v4 or v6). - bool address = 21; - - // Uuid specifies that the field must be a valid UUID as defined by - // RFC 4122 - bool uuid = 22; - - // WellKnownRegex specifies a common well known pattern defined as a regex. - KnownRegex well_known_regex = 24; - } - - // This applies to regexes HTTP_HEADER_NAME and HTTP_HEADER_VALUE to enable - // strict header validation. - // By default, this is true, and HTTP header validations are RFC-compliant. - // Setting to false will enable a looser validations that only disallows - // \r\n\0 characters, which can be used to bypass header matching rules. - optional bool strict = 25 [default = true]; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 26; -} - -// WellKnownRegex contain some well-known patterns. -enum KnownRegex { - UNKNOWN = 0; - - // HTTP header name as defined by RFC 7230. - HTTP_HEADER_NAME = 1; - - // HTTP header value as defined by RFC 7230. - HTTP_HEADER_VALUE = 2; -} - -// BytesRules describe the constraints applied to `bytes` values -message BytesRules { - // Const specifies that this field must be exactly the specified value - optional bytes const = 1; - - // Len specifies that this field must be the specified number of bytes - optional uint64 len = 13; - - // MinLen specifies that this field must be the specified number of bytes - // at a minimum - optional uint64 min_len = 2; - - // MaxLen specifies that this field must be the specified number of bytes - // at a maximum - optional uint64 max_len = 3; - - // Pattern specifies that this field must match against the specified - // regular expression (RE2 syntax). The included expression should elide - // any delimiters. - optional string pattern = 4; - - // Prefix specifies that this field must have the specified bytes at the - // beginning of the string. - optional bytes prefix = 5; - - // Suffix specifies that this field must have the specified bytes at the - // end of the string. - optional bytes suffix = 6; - - // Contains specifies that this field must have the specified bytes - // anywhere in the string. - optional bytes contains = 7; - - // In specifies that this field must be equal to one of the specified - // values - repeated bytes in = 8; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated bytes not_in = 9; - - // WellKnown rules provide advanced constraints against common byte - // patterns - oneof well_known { - // Ip specifies that the field must be a valid IP (v4 or v6) address in - // byte format - bool ip = 10; - - // Ipv4 specifies that the field must be a valid IPv4 address in byte - // format - bool ipv4 = 11; - - // Ipv6 specifies that the field must be a valid IPv6 address in byte - // format - bool ipv6 = 12; - } - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 14; -} - -// EnumRules describe the constraints applied to enum values -message EnumRules { - // Const specifies that this field must be exactly the specified value - optional int32 const = 1; - - // DefinedOnly specifies that this field must be only one of the defined - // values for this enum, failing on any undefined value. - optional bool defined_only = 2; - - // In specifies that this field must be equal to one of the specified - // values - repeated int32 in = 3; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated int32 not_in = 4; -} - -// MessageRules describe the constraints applied to embedded message values. -// For message-type fields, validation is performed recursively. -message MessageRules { - // Skip specifies that the validation rules of this field should not be - // evaluated - optional bool skip = 1; - - // Required specifies that this field must be set - optional bool required = 2; -} - -// RepeatedRules describe the constraints applied to `repeated` values -message RepeatedRules { - // MinItems specifies that this field must have the specified number of - // items at a minimum - optional uint64 min_items = 1; - - // MaxItems specifies that this field must have the specified number of - // items at a maximum - optional uint64 max_items = 2; - - // Unique specifies that all elements in this field must be unique. This - // constraint is only applicable to scalar and enum types (messages are not - // supported). - optional bool unique = 3; - - // Items specifies the constraints to be applied to each item in the field. - // Repeated message fields will still execute validation against each item - // unless skip is specified here. - optional FieldRules items = 4; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 5; -} - -// MapRules describe the constraints applied to `map` values -message MapRules { - // MinPairs specifies that this field must have the specified number of - // KVs at a minimum - optional uint64 min_pairs = 1; - - // MaxPairs specifies that this field must have the specified number of - // KVs at a maximum - optional uint64 max_pairs = 2; - - // NoSparse specifies values in this field cannot be unset. This only - // applies to map's with message value types. - optional bool no_sparse = 3; - - // Keys specifies the constraints to be applied to each key in the field. - optional FieldRules keys = 4; - - // Values specifies the constraints to be applied to the value of each key - // in the field. Message values will still have their validations evaluated - // unless skip is specified here. - optional FieldRules values = 5; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 6; -} - -// AnyRules describe constraints applied exclusively to the -// `google.protobuf.Any` well-known type -message AnyRules { - // Required specifies that this field must be set - optional bool required = 1; - - // In specifies that this field's `type_url` must be equal to one of the - // specified values. - repeated string in = 2; - - // NotIn specifies that this field's `type_url` must not be equal to any of - // the specified values. - repeated string not_in = 3; -} - -// DurationRules describe the constraints applied exclusively to the -// `google.protobuf.Duration` well-known type -message DurationRules { - // Required specifies that this field must be set - optional bool required = 1; - - // Const specifies that this field must be exactly the specified value - optional google.protobuf.Duration const = 2; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional google.protobuf.Duration lt = 3; - - // Lt specifies that this field must be less than the specified value, - // inclusive - optional google.protobuf.Duration lte = 4; - - // Gt specifies that this field must be greater than the specified value, - // exclusive - optional google.protobuf.Duration gt = 5; - - // Gte specifies that this field must be greater than the specified value, - // inclusive - optional google.protobuf.Duration gte = 6; - - // In specifies that this field must be equal to one of the specified - // values - repeated google.protobuf.Duration in = 7; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated google.protobuf.Duration not_in = 8; -} - -// TimestampRules describe the constraints applied exclusively to the -// `google.protobuf.Timestamp` well-known type -message TimestampRules { - // Required specifies that this field must be set - optional bool required = 1; - - // Const specifies that this field must be exactly the specified value - optional google.protobuf.Timestamp const = 2; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional google.protobuf.Timestamp lt = 3; - - // Lte specifies that this field must be less than the specified value, - // inclusive - optional google.protobuf.Timestamp lte = 4; - - // Gt specifies that this field must be greater than the specified value, - // exclusive - optional google.protobuf.Timestamp gt = 5; - - // Gte specifies that this field must be greater than the specified value, - // inclusive - optional google.protobuf.Timestamp gte = 6; - - // LtNow specifies that this must be less than the current time. LtNow - // can only be used with the Within rule. - optional bool lt_now = 7; - - // GtNow specifies that this must be greater than the current time. GtNow - // can only be used with the Within rule. - optional bool gt_now = 8; - - // Within specifies that this field must be within this duration of the - // current time. This constraint can be used alone or with the LtNow and - // GtNow rules. - optional google.protobuf.Duration within = 9; -} diff --git a/vendor/github.com/evanphx/json-patch/.gitignore b/vendor/github.com/evanphx/json-patch/.gitignore deleted file mode 100644 index b7ed7f956..000000000 --- a/vendor/github.com/evanphx/json-patch/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -# editor and IDE paraphernalia -.idea -.vscode - -# macOS paraphernalia -.DS_Store diff --git a/vendor/github.com/evanphx/json-patch/LICENSE b/vendor/github.com/evanphx/json-patch/LICENSE deleted file mode 100644 index df76d7d77..000000000 --- a/vendor/github.com/evanphx/json-patch/LICENSE +++ /dev/null @@ -1,25 +0,0 @@ -Copyright (c) 2014, Evan Phoenix -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. -* Neither the name of the Evan Phoenix 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. diff --git a/vendor/github.com/evanphx/json-patch/README.md b/vendor/github.com/evanphx/json-patch/README.md deleted file mode 100644 index 97e319b21..000000000 --- a/vendor/github.com/evanphx/json-patch/README.md +++ /dev/null @@ -1,317 +0,0 @@ -# JSON-Patch -`jsonpatch` is a library which provides functionality for both applying -[RFC6902 JSON patches](http://tools.ietf.org/html/rfc6902) against documents, as -well as for calculating & applying [RFC7396 JSON merge patches](https://tools.ietf.org/html/rfc7396). - -[![GoDoc](https://godoc.org/github.com/evanphx/json-patch?status.svg)](http://godoc.org/github.com/evanphx/json-patch) -[![Build Status](https://github.com/evanphx/json-patch/actions/workflows/go.yml/badge.svg)](https://github.com/evanphx/json-patch/actions/workflows/go.yml) -[![Report Card](https://goreportcard.com/badge/github.com/evanphx/json-patch)](https://goreportcard.com/report/github.com/evanphx/json-patch) - -# Get It! - -**Latest and greatest**: -```bash -go get -u github.com/evanphx/json-patch/v5 -``` - -**Stable Versions**: -* Version 5: `go get -u gopkg.in/evanphx/json-patch.v5` -* Version 4: `go get -u gopkg.in/evanphx/json-patch.v4` - -(previous versions below `v3` are unavailable) - -# Use It! -* [Create and apply a merge patch](#create-and-apply-a-merge-patch) -* [Create and apply a JSON Patch](#create-and-apply-a-json-patch) -* [Comparing JSON documents](#comparing-json-documents) -* [Combine merge patches](#combine-merge-patches) - - -# Configuration - -* There is a global configuration variable `jsonpatch.SupportNegativeIndices`. - This defaults to `true` and enables the non-standard practice of allowing - negative indices to mean indices starting at the end of an array. This - functionality can be disabled by setting `jsonpatch.SupportNegativeIndices = - false`. - -* There is a global configuration variable `jsonpatch.AccumulatedCopySizeLimit`, - which limits the total size increase in bytes caused by "copy" operations in a - patch. It defaults to 0, which means there is no limit. - -These global variables control the behavior of `jsonpatch.Apply`. - -An alternative to `jsonpatch.Apply` is `jsonpatch.ApplyWithOptions` whose behavior -is controlled by an `options` parameter of type `*jsonpatch.ApplyOptions`. - -Structure `jsonpatch.ApplyOptions` includes the configuration options above -and adds two new options: `AllowMissingPathOnRemove` and `EnsurePathExistsOnAdd`. - -When `AllowMissingPathOnRemove` is set to `true`, `jsonpatch.ApplyWithOptions` will ignore -`remove` operations whose `path` points to a non-existent location in the JSON document. -`AllowMissingPathOnRemove` defaults to `false` which will lead to `jsonpatch.ApplyWithOptions` -returning an error when hitting a missing `path` on `remove`. - -When `EnsurePathExistsOnAdd` is set to `true`, `jsonpatch.ApplyWithOptions` will make sure -that `add` operations produce all the `path` elements that are missing from the target object. - -Use `jsonpatch.NewApplyOptions` to create an instance of `jsonpatch.ApplyOptions` -whose values are populated from the global configuration variables. - -## Create and apply a merge patch -Given both an original JSON document and a modified JSON document, you can create -a [Merge Patch](https://tools.ietf.org/html/rfc7396) document. - -It can describe the changes needed to convert from the original to the -modified JSON document. - -Once you have a merge patch, you can apply it to other JSON documents using the -`jsonpatch.MergePatch(document, patch)` function. - -```go -package main - -import ( - "fmt" - - jsonpatch "github.com/evanphx/json-patch" -) - -func main() { - // Let's create a merge patch from these two documents... - original := []byte(`{"name": "John", "age": 24, "height": 3.21}`) - target := []byte(`{"name": "Jane", "age": 24}`) - - patch, err := jsonpatch.CreateMergePatch(original, target) - if err != nil { - panic(err) - } - - // Now lets apply the patch against a different JSON document... - - alternative := []byte(`{"name": "Tina", "age": 28, "height": 3.75}`) - modifiedAlternative, err := jsonpatch.MergePatch(alternative, patch) - - fmt.Printf("patch document: %s\n", patch) - fmt.Printf("updated alternative doc: %s\n", modifiedAlternative) -} -``` - -When ran, you get the following output: - -```bash -$ go run main.go -patch document: {"height":null,"name":"Jane"} -updated alternative doc: {"age":28,"name":"Jane"} -``` - -## Create and apply a JSON Patch -You can create patch objects using `DecodePatch([]byte)`, which can then -be applied against JSON documents. - -The following is an example of creating a patch from two operations, and -applying it against a JSON document. - -```go -package main - -import ( - "fmt" - - jsonpatch "github.com/evanphx/json-patch" -) - -func main() { - original := []byte(`{"name": "John", "age": 24, "height": 3.21}`) - patchJSON := []byte(`[ - {"op": "replace", "path": "/name", "value": "Jane"}, - {"op": "remove", "path": "/height"} - ]`) - - patch, err := jsonpatch.DecodePatch(patchJSON) - if err != nil { - panic(err) - } - - modified, err := patch.Apply(original) - if err != nil { - panic(err) - } - - fmt.Printf("Original document: %s\n", original) - fmt.Printf("Modified document: %s\n", modified) -} -``` - -When ran, you get the following output: - -```bash -$ go run main.go -Original document: {"name": "John", "age": 24, "height": 3.21} -Modified document: {"age":24,"name":"Jane"} -``` - -## Comparing JSON documents -Due to potential whitespace and ordering differences, one cannot simply compare -JSON strings or byte-arrays directly. - -As such, you can instead use `jsonpatch.Equal(document1, document2)` to -determine if two JSON documents are _structurally_ equal. This ignores -whitespace differences, and key-value ordering. - -```go -package main - -import ( - "fmt" - - jsonpatch "github.com/evanphx/json-patch" -) - -func main() { - original := []byte(`{"name": "John", "age": 24, "height": 3.21}`) - similar := []byte(` - { - "age": 24, - "height": 3.21, - "name": "John" - } - `) - different := []byte(`{"name": "Jane", "age": 20, "height": 3.37}`) - - if jsonpatch.Equal(original, similar) { - fmt.Println(`"original" is structurally equal to "similar"`) - } - - if !jsonpatch.Equal(original, different) { - fmt.Println(`"original" is _not_ structurally equal to "different"`) - } -} -``` - -When ran, you get the following output: -```bash -$ go run main.go -"original" is structurally equal to "similar" -"original" is _not_ structurally equal to "different" -``` - -## Combine merge patches -Given two JSON merge patch documents, it is possible to combine them into a -single merge patch which can describe both set of changes. - -The resulting merge patch can be used such that applying it results in a -document structurally similar as merging each merge patch to the document -in succession. - -```go -package main - -import ( - "fmt" - - jsonpatch "github.com/evanphx/json-patch" -) - -func main() { - original := []byte(`{"name": "John", "age": 24, "height": 3.21}`) - - nameAndHeight := []byte(`{"height":null,"name":"Jane"}`) - ageAndEyes := []byte(`{"age":4.23,"eyes":"blue"}`) - - // Let's combine these merge patch documents... - combinedPatch, err := jsonpatch.MergeMergePatches(nameAndHeight, ageAndEyes) - if err != nil { - panic(err) - } - - // Apply each patch individual against the original document - withoutCombinedPatch, err := jsonpatch.MergePatch(original, nameAndHeight) - if err != nil { - panic(err) - } - - withoutCombinedPatch, err = jsonpatch.MergePatch(withoutCombinedPatch, ageAndEyes) - if err != nil { - panic(err) - } - - // Apply the combined patch against the original document - - withCombinedPatch, err := jsonpatch.MergePatch(original, combinedPatch) - if err != nil { - panic(err) - } - - // Do both result in the same thing? They should! - if jsonpatch.Equal(withCombinedPatch, withoutCombinedPatch) { - fmt.Println("Both JSON documents are structurally the same!") - } - - fmt.Printf("combined merge patch: %s", combinedPatch) -} -``` - -When ran, you get the following output: -```bash -$ go run main.go -Both JSON documents are structurally the same! -combined merge patch: {"age":4.23,"eyes":"blue","height":null,"name":"Jane"} -``` - -# CLI for comparing JSON documents -You can install the commandline program `json-patch`. - -This program can take multiple JSON patch documents as arguments, -and fed a JSON document from `stdin`. It will apply the patch(es) against -the document and output the modified doc. - -**patch.1.json** -```json -[ - {"op": "replace", "path": "/name", "value": "Jane"}, - {"op": "remove", "path": "/height"} -] -``` - -**patch.2.json** -```json -[ - {"op": "add", "path": "/address", "value": "123 Main St"}, - {"op": "replace", "path": "/age", "value": "21"} -] -``` - -**document.json** -```json -{ - "name": "John", - "age": 24, - "height": 3.21 -} -``` - -You can then run: - -```bash -$ go install github.com/evanphx/json-patch/cmd/json-patch -$ cat document.json | json-patch -p patch.1.json -p patch.2.json -{"address":"123 Main St","age":"21","name":"Jane"} -``` - -# Help It! -Contributions are welcomed! Leave [an issue](https://github.com/evanphx/json-patch/issues) -or [create a PR](https://github.com/evanphx/json-patch/compare). - - -Before creating a pull request, we'd ask that you make sure tests are passing -and that you have added new tests when applicable. - -Contributors can run tests using: - -```bash -go test -cover ./... -``` - -Builds for pull requests are tested automatically -using [GitHub Actions](https://github.com/evanphx/json-patch/actions/workflows/go.yml). diff --git a/vendor/github.com/evanphx/json-patch/errors.go b/vendor/github.com/evanphx/json-patch/errors.go deleted file mode 100644 index 75304b443..000000000 --- a/vendor/github.com/evanphx/json-patch/errors.go +++ /dev/null @@ -1,38 +0,0 @@ -package jsonpatch - -import "fmt" - -// AccumulatedCopySizeError is an error type returned when the accumulated size -// increase caused by copy operations in a patch operation has exceeded the -// limit. -type AccumulatedCopySizeError struct { - limit int64 - accumulated int64 -} - -// NewAccumulatedCopySizeError returns an AccumulatedCopySizeError. -func NewAccumulatedCopySizeError(l, a int64) *AccumulatedCopySizeError { - return &AccumulatedCopySizeError{limit: l, accumulated: a} -} - -// Error implements the error interface. -func (a *AccumulatedCopySizeError) Error() string { - return fmt.Sprintf("Unable to complete the copy, the accumulated size increase of copy is %d, exceeding the limit %d", a.accumulated, a.limit) -} - -// ArraySizeError is an error type returned when the array size has exceeded -// the limit. -type ArraySizeError struct { - limit int - size int -} - -// NewArraySizeError returns an ArraySizeError. -func NewArraySizeError(l, s int) *ArraySizeError { - return &ArraySizeError{limit: l, size: s} -} - -// Error implements the error interface. -func (a *ArraySizeError) Error() string { - return fmt.Sprintf("Unable to create array of size %d, limit is %d", a.size, a.limit) -} diff --git a/vendor/github.com/evanphx/json-patch/merge.go b/vendor/github.com/evanphx/json-patch/merge.go deleted file mode 100644 index ad88d4018..000000000 --- a/vendor/github.com/evanphx/json-patch/merge.go +++ /dev/null @@ -1,389 +0,0 @@ -package jsonpatch - -import ( - "bytes" - "encoding/json" - "fmt" - "reflect" -) - -func merge(cur, patch *lazyNode, mergeMerge bool) *lazyNode { - curDoc, err := cur.intoDoc() - - if err != nil { - pruneNulls(patch) - return patch - } - - patchDoc, err := patch.intoDoc() - - if err != nil { - return patch - } - - mergeDocs(curDoc, patchDoc, mergeMerge) - - return cur -} - -func mergeDocs(doc, patch *partialDoc, mergeMerge bool) { - for k, v := range *patch { - if v == nil { - if mergeMerge { - (*doc)[k] = nil - } else { - delete(*doc, k) - } - } else { - cur, ok := (*doc)[k] - - if !ok || cur == nil { - if !mergeMerge { - pruneNulls(v) - } - - (*doc)[k] = v - } else { - (*doc)[k] = merge(cur, v, mergeMerge) - } - } - } -} - -func pruneNulls(n *lazyNode) { - sub, err := n.intoDoc() - - if err == nil { - pruneDocNulls(sub) - } else { - ary, err := n.intoAry() - - if err == nil { - pruneAryNulls(ary) - } - } -} - -func pruneDocNulls(doc *partialDoc) *partialDoc { - for k, v := range *doc { - if v == nil { - delete(*doc, k) - } else { - pruneNulls(v) - } - } - - return doc -} - -func pruneAryNulls(ary *partialArray) *partialArray { - newAry := []*lazyNode{} - - for _, v := range *ary { - if v != nil { - pruneNulls(v) - } - newAry = append(newAry, v) - } - - *ary = newAry - - return ary -} - -var ErrBadJSONDoc = fmt.Errorf("Invalid JSON Document") -var ErrBadJSONPatch = fmt.Errorf("Invalid JSON Patch") -var errBadMergeTypes = fmt.Errorf("Mismatched JSON Documents") - -// MergeMergePatches merges two merge patches together, such that -// applying this resulting merged merge patch to a document yields the same -// as merging each merge patch to the document in succession. -func MergeMergePatches(patch1Data, patch2Data []byte) ([]byte, error) { - return doMergePatch(patch1Data, patch2Data, true) -} - -// MergePatch merges the patchData into the docData. -func MergePatch(docData, patchData []byte) ([]byte, error) { - return doMergePatch(docData, patchData, false) -} - -func doMergePatch(docData, patchData []byte, mergeMerge bool) ([]byte, error) { - doc := &partialDoc{} - - docErr := json.Unmarshal(docData, doc) - - patch := &partialDoc{} - - patchErr := json.Unmarshal(patchData, patch) - - if _, ok := docErr.(*json.SyntaxError); ok { - return nil, ErrBadJSONDoc - } - - if _, ok := patchErr.(*json.SyntaxError); ok { - return nil, ErrBadJSONPatch - } - - if docErr == nil && *doc == nil { - return nil, ErrBadJSONDoc - } - - if patchErr == nil && *patch == nil { - return nil, ErrBadJSONPatch - } - - if docErr != nil || patchErr != nil { - // Not an error, just not a doc, so we turn straight into the patch - if patchErr == nil { - if mergeMerge { - doc = patch - } else { - doc = pruneDocNulls(patch) - } - } else { - patchAry := &partialArray{} - patchErr = json.Unmarshal(patchData, patchAry) - - if patchErr != nil { - return nil, ErrBadJSONPatch - } - - pruneAryNulls(patchAry) - - out, patchErr := json.Marshal(patchAry) - - if patchErr != nil { - return nil, ErrBadJSONPatch - } - - return out, nil - } - } else { - mergeDocs(doc, patch, mergeMerge) - } - - return json.Marshal(doc) -} - -// resemblesJSONArray indicates whether the byte-slice "appears" to be -// a JSON array or not. -// False-positives are possible, as this function does not check the internal -// structure of the array. It only checks that the outer syntax is present and -// correct. -func resemblesJSONArray(input []byte) bool { - input = bytes.TrimSpace(input) - - hasPrefix := bytes.HasPrefix(input, []byte("[")) - hasSuffix := bytes.HasSuffix(input, []byte("]")) - - return hasPrefix && hasSuffix -} - -// CreateMergePatch will return a merge patch document capable of converting -// the original document(s) to the modified document(s). -// The parameters can be bytes of either two JSON Documents, or two arrays of -// JSON documents. -// The merge patch returned follows the specification defined at http://tools.ietf.org/html/draft-ietf-appsawg-json-merge-patch-07 -func CreateMergePatch(originalJSON, modifiedJSON []byte) ([]byte, error) { - originalResemblesArray := resemblesJSONArray(originalJSON) - modifiedResemblesArray := resemblesJSONArray(modifiedJSON) - - // Do both byte-slices seem like JSON arrays? - if originalResemblesArray && modifiedResemblesArray { - return createArrayMergePatch(originalJSON, modifiedJSON) - } - - // Are both byte-slices are not arrays? Then they are likely JSON objects... - if !originalResemblesArray && !modifiedResemblesArray { - return createObjectMergePatch(originalJSON, modifiedJSON) - } - - // None of the above? Then return an error because of mismatched types. - return nil, errBadMergeTypes -} - -// createObjectMergePatch will return a merge-patch document capable of -// converting the original document to the modified document. -func createObjectMergePatch(originalJSON, modifiedJSON []byte) ([]byte, error) { - originalDoc := map[string]interface{}{} - modifiedDoc := map[string]interface{}{} - - err := json.Unmarshal(originalJSON, &originalDoc) - if err != nil { - return nil, ErrBadJSONDoc - } - - err = json.Unmarshal(modifiedJSON, &modifiedDoc) - if err != nil { - return nil, ErrBadJSONDoc - } - - dest, err := getDiff(originalDoc, modifiedDoc) - if err != nil { - return nil, err - } - - return json.Marshal(dest) -} - -// createArrayMergePatch will return an array of merge-patch documents capable -// of converting the original document to the modified document for each -// pair of JSON documents provided in the arrays. -// Arrays of mismatched sizes will result in an error. -func createArrayMergePatch(originalJSON, modifiedJSON []byte) ([]byte, error) { - originalDocs := []json.RawMessage{} - modifiedDocs := []json.RawMessage{} - - err := json.Unmarshal(originalJSON, &originalDocs) - if err != nil { - return nil, ErrBadJSONDoc - } - - err = json.Unmarshal(modifiedJSON, &modifiedDocs) - if err != nil { - return nil, ErrBadJSONDoc - } - - total := len(originalDocs) - if len(modifiedDocs) != total { - return nil, ErrBadJSONDoc - } - - result := []json.RawMessage{} - for i := 0; i < len(originalDocs); i++ { - original := originalDocs[i] - modified := modifiedDocs[i] - - patch, err := createObjectMergePatch(original, modified) - if err != nil { - return nil, err - } - - result = append(result, json.RawMessage(patch)) - } - - return json.Marshal(result) -} - -// Returns true if the array matches (must be json types). -// As is idiomatic for go, an empty array is not the same as a nil array. -func matchesArray(a, b []interface{}) bool { - if len(a) != len(b) { - return false - } - if (a == nil && b != nil) || (a != nil && b == nil) { - return false - } - for i := range a { - if !matchesValue(a[i], b[i]) { - return false - } - } - return true -} - -// Returns true if the values matches (must be json types) -// The types of the values must match, otherwise it will always return false -// If two map[string]interface{} are given, all elements must match. -func matchesValue(av, bv interface{}) bool { - if reflect.TypeOf(av) != reflect.TypeOf(bv) { - return false - } - switch at := av.(type) { - case string: - bt := bv.(string) - if bt == at { - return true - } - case float64: - bt := bv.(float64) - if bt == at { - return true - } - case bool: - bt := bv.(bool) - if bt == at { - return true - } - case nil: - // Both nil, fine. - return true - case map[string]interface{}: - bt := bv.(map[string]interface{}) - if len(bt) != len(at) { - return false - } - for key := range bt { - av, aOK := at[key] - bv, bOK := bt[key] - if aOK != bOK { - return false - } - if !matchesValue(av, bv) { - return false - } - } - return true - case []interface{}: - bt := bv.([]interface{}) - return matchesArray(at, bt) - } - return false -} - -// getDiff returns the (recursive) difference between a and b as a map[string]interface{}. -func getDiff(a, b map[string]interface{}) (map[string]interface{}, error) { - into := map[string]interface{}{} - for key, bv := range b { - av, ok := a[key] - // value was added - if !ok { - into[key] = bv - continue - } - // If types have changed, replace completely - if reflect.TypeOf(av) != reflect.TypeOf(bv) { - into[key] = bv - continue - } - // Types are the same, compare values - switch at := av.(type) { - case map[string]interface{}: - bt := bv.(map[string]interface{}) - dst := make(map[string]interface{}, len(bt)) - dst, err := getDiff(at, bt) - if err != nil { - return nil, err - } - if len(dst) > 0 { - into[key] = dst - } - case string, float64, bool: - if !matchesValue(av, bv) { - into[key] = bv - } - case []interface{}: - bt := bv.([]interface{}) - if !matchesArray(at, bt) { - into[key] = bv - } - case nil: - switch bv.(type) { - case nil: - // Both nil, fine. - default: - into[key] = bv - } - default: - panic(fmt.Sprintf("Unknown type:%T in key %s", av, key)) - } - } - // Now add all deleted values as nil - for key := range a { - _, found := b[key] - if !found { - into[key] = nil - } - } - return into, nil -} diff --git a/vendor/github.com/evanphx/json-patch/patch.go b/vendor/github.com/evanphx/json-patch/patch.go deleted file mode 100644 index cd0274e1e..000000000 --- a/vendor/github.com/evanphx/json-patch/patch.go +++ /dev/null @@ -1,851 +0,0 @@ -package jsonpatch - -import ( - "bytes" - "encoding/json" - "fmt" - "strconv" - "strings" - - "github.com/pkg/errors" -) - -const ( - eRaw = iota - eDoc - eAry -) - -var ( - // SupportNegativeIndices decides whether to support non-standard practice of - // allowing negative indices to mean indices starting at the end of an array. - // Default to true. - SupportNegativeIndices bool = true - // AccumulatedCopySizeLimit limits the total size increase in bytes caused by - // "copy" operations in a patch. - AccumulatedCopySizeLimit int64 = 0 -) - -var ( - ErrTestFailed = errors.New("test failed") - ErrMissing = errors.New("missing value") - ErrUnknownType = errors.New("unknown object type") - ErrInvalid = errors.New("invalid state detected") - ErrInvalidIndex = errors.New("invalid index referenced") -) - -type lazyNode struct { - raw *json.RawMessage - doc partialDoc - ary partialArray - which int -} - -// Operation is a single JSON-Patch step, such as a single 'add' operation. -type Operation map[string]*json.RawMessage - -// Patch is an ordered collection of Operations. -type Patch []Operation - -type partialDoc map[string]*lazyNode -type partialArray []*lazyNode - -type container interface { - get(key string) (*lazyNode, error) - set(key string, val *lazyNode) error - add(key string, val *lazyNode) error - remove(key string) error -} - -func newLazyNode(raw *json.RawMessage) *lazyNode { - return &lazyNode{raw: raw, doc: nil, ary: nil, which: eRaw} -} - -func (n *lazyNode) MarshalJSON() ([]byte, error) { - switch n.which { - case eRaw: - return json.Marshal(n.raw) - case eDoc: - return json.Marshal(n.doc) - case eAry: - return json.Marshal(n.ary) - default: - return nil, ErrUnknownType - } -} - -func (n *lazyNode) UnmarshalJSON(data []byte) error { - dest := make(json.RawMessage, len(data)) - copy(dest, data) - n.raw = &dest - n.which = eRaw - return nil -} - -func deepCopy(src *lazyNode) (*lazyNode, int, error) { - if src == nil { - return nil, 0, nil - } - a, err := src.MarshalJSON() - if err != nil { - return nil, 0, err - } - sz := len(a) - ra := make(json.RawMessage, sz) - copy(ra, a) - return newLazyNode(&ra), sz, nil -} - -func (n *lazyNode) intoDoc() (*partialDoc, error) { - if n.which == eDoc { - return &n.doc, nil - } - - if n.raw == nil { - return nil, ErrInvalid - } - - err := json.Unmarshal(*n.raw, &n.doc) - - if err != nil { - return nil, err - } - - n.which = eDoc - return &n.doc, nil -} - -func (n *lazyNode) intoAry() (*partialArray, error) { - if n.which == eAry { - return &n.ary, nil - } - - if n.raw == nil { - return nil, ErrInvalid - } - - err := json.Unmarshal(*n.raw, &n.ary) - - if err != nil { - return nil, err - } - - n.which = eAry - return &n.ary, nil -} - -func (n *lazyNode) compact() []byte { - buf := &bytes.Buffer{} - - if n.raw == nil { - return nil - } - - err := json.Compact(buf, *n.raw) - - if err != nil { - return *n.raw - } - - return buf.Bytes() -} - -func (n *lazyNode) tryDoc() bool { - if n.raw == nil { - return false - } - - err := json.Unmarshal(*n.raw, &n.doc) - - if err != nil { - return false - } - - n.which = eDoc - return true -} - -func (n *lazyNode) tryAry() bool { - if n.raw == nil { - return false - } - - err := json.Unmarshal(*n.raw, &n.ary) - - if err != nil { - return false - } - - n.which = eAry - return true -} - -func (n *lazyNode) equal(o *lazyNode) bool { - if n.which == eRaw { - if !n.tryDoc() && !n.tryAry() { - if o.which != eRaw { - return false - } - - return bytes.Equal(n.compact(), o.compact()) - } - } - - if n.which == eDoc { - if o.which == eRaw { - if !o.tryDoc() { - return false - } - } - - if o.which != eDoc { - return false - } - - if len(n.doc) != len(o.doc) { - return false - } - - for k, v := range n.doc { - ov, ok := o.doc[k] - - if !ok { - return false - } - - if (v == nil) != (ov == nil) { - return false - } - - if v == nil && ov == nil { - continue - } - - if !v.equal(ov) { - return false - } - } - - return true - } - - if o.which != eAry && !o.tryAry() { - return false - } - - if len(n.ary) != len(o.ary) { - return false - } - - for idx, val := range n.ary { - if !val.equal(o.ary[idx]) { - return false - } - } - - return true -} - -// Kind reads the "op" field of the Operation. -func (o Operation) Kind() string { - if obj, ok := o["op"]; ok && obj != nil { - var op string - - err := json.Unmarshal(*obj, &op) - - if err != nil { - return "unknown" - } - - return op - } - - return "unknown" -} - -// Path reads the "path" field of the Operation. -func (o Operation) Path() (string, error) { - if obj, ok := o["path"]; ok && obj != nil { - var op string - - err := json.Unmarshal(*obj, &op) - - if err != nil { - return "unknown", err - } - - return op, nil - } - - return "unknown", errors.Wrapf(ErrMissing, "operation missing path field") -} - -// From reads the "from" field of the Operation. -func (o Operation) From() (string, error) { - if obj, ok := o["from"]; ok && obj != nil { - var op string - - err := json.Unmarshal(*obj, &op) - - if err != nil { - return "unknown", err - } - - return op, nil - } - - return "unknown", errors.Wrapf(ErrMissing, "operation, missing from field") -} - -func (o Operation) value() *lazyNode { - if obj, ok := o["value"]; ok { - return newLazyNode(obj) - } - - return nil -} - -// ValueInterface decodes the operation value into an interface. -func (o Operation) ValueInterface() (interface{}, error) { - if obj, ok := o["value"]; ok && obj != nil { - var v interface{} - - err := json.Unmarshal(*obj, &v) - - if err != nil { - return nil, err - } - - return v, nil - } - - return nil, errors.Wrapf(ErrMissing, "operation, missing value field") -} - -func isArray(buf []byte) bool { -Loop: - for _, c := range buf { - switch c { - case ' ': - case '\n': - case '\t': - continue - case '[': - return true - default: - break Loop - } - } - - return false -} - -func findObject(pd *container, path string) (container, string) { - doc := *pd - - split := strings.Split(path, "/") - - if len(split) < 2 { - return nil, "" - } - - parts := split[1 : len(split)-1] - - key := split[len(split)-1] - - var err error - - for _, part := range parts { - - next, ok := doc.get(decodePatchKey(part)) - - if next == nil || ok != nil || next.raw == nil { - return nil, "" - } - - if isArray(*next.raw) { - doc, err = next.intoAry() - - if err != nil { - return nil, "" - } - } else { - doc, err = next.intoDoc() - - if err != nil { - return nil, "" - } - } - } - - return doc, decodePatchKey(key) -} - -func (d *partialDoc) set(key string, val *lazyNode) error { - (*d)[key] = val - return nil -} - -func (d *partialDoc) add(key string, val *lazyNode) error { - (*d)[key] = val - return nil -} - -func (d *partialDoc) get(key string) (*lazyNode, error) { - return (*d)[key], nil -} - -func (d *partialDoc) remove(key string) error { - _, ok := (*d)[key] - if !ok { - return errors.Wrapf(ErrMissing, "Unable to remove nonexistent key: %s", key) - } - - delete(*d, key) - return nil -} - -// set should only be used to implement the "replace" operation, so "key" must -// be an already existing index in "d". -func (d *partialArray) set(key string, val *lazyNode) error { - idx, err := strconv.Atoi(key) - if err != nil { - return err - } - - if idx < 0 { - if !SupportNegativeIndices { - return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) - } - if idx < -len(*d) { - return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) - } - idx += len(*d) - } - - (*d)[idx] = val - return nil -} - -func (d *partialArray) add(key string, val *lazyNode) error { - if key == "-" { - *d = append(*d, val) - return nil - } - - idx, err := strconv.Atoi(key) - if err != nil { - return errors.Wrapf(err, "value was not a proper array index: '%s'", key) - } - - sz := len(*d) + 1 - - ary := make([]*lazyNode, sz) - - cur := *d - - if idx >= len(ary) { - return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) - } - - if idx < 0 { - if !SupportNegativeIndices { - return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) - } - if idx < -len(ary) { - return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) - } - idx += len(ary) - } - - copy(ary[0:idx], cur[0:idx]) - ary[idx] = val - copy(ary[idx+1:], cur[idx:]) - - *d = ary - return nil -} - -func (d *partialArray) get(key string) (*lazyNode, error) { - idx, err := strconv.Atoi(key) - - if err != nil { - return nil, err - } - - if idx < 0 { - if !SupportNegativeIndices { - return nil, errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) - } - if idx < -len(*d) { - return nil, errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) - } - idx += len(*d) - } - - if idx >= len(*d) { - return nil, errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) - } - - return (*d)[idx], nil -} - -func (d *partialArray) remove(key string) error { - idx, err := strconv.Atoi(key) - if err != nil { - return err - } - - cur := *d - - if idx >= len(cur) { - return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) - } - - if idx < 0 { - if !SupportNegativeIndices { - return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) - } - if idx < -len(cur) { - return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) - } - idx += len(cur) - } - - ary := make([]*lazyNode, len(cur)-1) - - copy(ary[0:idx], cur[0:idx]) - copy(ary[idx:], cur[idx+1:]) - - *d = ary - return nil - -} - -func (p Patch) add(doc *container, op Operation) error { - path, err := op.Path() - if err != nil { - return errors.Wrapf(ErrMissing, "add operation failed to decode path") - } - - con, key := findObject(doc, path) - - if con == nil { - return errors.Wrapf(ErrMissing, "add operation does not apply: doc is missing path: \"%s\"", path) - } - - err = con.add(key, op.value()) - if err != nil { - return errors.Wrapf(err, "error in add for path: '%s'", path) - } - - return nil -} - -func (p Patch) remove(doc *container, op Operation) error { - path, err := op.Path() - if err != nil { - return errors.Wrapf(ErrMissing, "remove operation failed to decode path") - } - - con, key := findObject(doc, path) - - if con == nil { - return errors.Wrapf(ErrMissing, "remove operation does not apply: doc is missing path: \"%s\"", path) - } - - err = con.remove(key) - if err != nil { - return errors.Wrapf(err, "error in remove for path: '%s'", path) - } - - return nil -} - -func (p Patch) replace(doc *container, op Operation) error { - path, err := op.Path() - if err != nil { - return errors.Wrapf(err, "replace operation failed to decode path") - } - - if path == "" { - val := op.value() - - if val.which == eRaw { - if !val.tryDoc() { - if !val.tryAry() { - return errors.Wrapf(err, "replace operation value must be object or array") - } - } - } - - switch val.which { - case eAry: - *doc = &val.ary - case eDoc: - *doc = &val.doc - case eRaw: - return errors.Wrapf(err, "replace operation hit impossible case") - } - - return nil - } - - con, key := findObject(doc, path) - - if con == nil { - return errors.Wrapf(ErrMissing, "replace operation does not apply: doc is missing path: %s", path) - } - - _, ok := con.get(key) - if ok != nil { - return errors.Wrapf(ErrMissing, "replace operation does not apply: doc is missing key: %s", path) - } - - err = con.set(key, op.value()) - if err != nil { - return errors.Wrapf(err, "error in remove for path: '%s'", path) - } - - return nil -} - -func (p Patch) move(doc *container, op Operation) error { - from, err := op.From() - if err != nil { - return errors.Wrapf(err, "move operation failed to decode from") - } - - con, key := findObject(doc, from) - - if con == nil { - return errors.Wrapf(ErrMissing, "move operation does not apply: doc is missing from path: %s", from) - } - - val, err := con.get(key) - if err != nil { - return errors.Wrapf(err, "error in move for path: '%s'", key) - } - - err = con.remove(key) - if err != nil { - return errors.Wrapf(err, "error in move for path: '%s'", key) - } - - path, err := op.Path() - if err != nil { - return errors.Wrapf(err, "move operation failed to decode path") - } - - con, key = findObject(doc, path) - - if con == nil { - return errors.Wrapf(ErrMissing, "move operation does not apply: doc is missing destination path: %s", path) - } - - err = con.add(key, val) - if err != nil { - return errors.Wrapf(err, "error in move for path: '%s'", path) - } - - return nil -} - -func (p Patch) test(doc *container, op Operation) error { - path, err := op.Path() - if err != nil { - return errors.Wrapf(err, "test operation failed to decode path") - } - - if path == "" { - var self lazyNode - - switch sv := (*doc).(type) { - case *partialDoc: - self.doc = *sv - self.which = eDoc - case *partialArray: - self.ary = *sv - self.which = eAry - } - - if self.equal(op.value()) { - return nil - } - - return errors.Wrapf(ErrTestFailed, "testing value %s failed", path) - } - - con, key := findObject(doc, path) - - if con == nil { - return errors.Wrapf(ErrMissing, "test operation does not apply: is missing path: %s", path) - } - - val, err := con.get(key) - if err != nil { - return errors.Wrapf(err, "error in test for path: '%s'", path) - } - - if val == nil { - if op.value() == nil || op.value().raw == nil { - return nil - } - return errors.Wrapf(ErrTestFailed, "testing value %s failed", path) - } else if op.value() == nil { - return errors.Wrapf(ErrTestFailed, "testing value %s failed", path) - } - - if val.equal(op.value()) { - return nil - } - - return errors.Wrapf(ErrTestFailed, "testing value %s failed", path) -} - -func (p Patch) copy(doc *container, op Operation, accumulatedCopySize *int64) error { - from, err := op.From() - if err != nil { - return errors.Wrapf(err, "copy operation failed to decode from") - } - - con, key := findObject(doc, from) - - if con == nil { - return errors.Wrapf(ErrMissing, "copy operation does not apply: doc is missing from path: %s", from) - } - - val, err := con.get(key) - if err != nil { - return errors.Wrapf(err, "error in copy for from: '%s'", from) - } - - path, err := op.Path() - if err != nil { - return errors.Wrapf(ErrMissing, "copy operation failed to decode path") - } - - con, key = findObject(doc, path) - - if con == nil { - return errors.Wrapf(ErrMissing, "copy operation does not apply: doc is missing destination path: %s", path) - } - - valCopy, sz, err := deepCopy(val) - if err != nil { - return errors.Wrapf(err, "error while performing deep copy") - } - - (*accumulatedCopySize) += int64(sz) - if AccumulatedCopySizeLimit > 0 && *accumulatedCopySize > AccumulatedCopySizeLimit { - return NewAccumulatedCopySizeError(AccumulatedCopySizeLimit, *accumulatedCopySize) - } - - err = con.add(key, valCopy) - if err != nil { - return errors.Wrapf(err, "error while adding value during copy") - } - - return nil -} - -// Equal indicates if 2 JSON documents have the same structural equality. -func Equal(a, b []byte) bool { - ra := make(json.RawMessage, len(a)) - copy(ra, a) - la := newLazyNode(&ra) - - rb := make(json.RawMessage, len(b)) - copy(rb, b) - lb := newLazyNode(&rb) - - return la.equal(lb) -} - -// DecodePatch decodes the passed JSON document as an RFC 6902 patch. -func DecodePatch(buf []byte) (Patch, error) { - var p Patch - - err := json.Unmarshal(buf, &p) - - if err != nil { - return nil, err - } - - return p, nil -} - -// Apply mutates a JSON document according to the patch, and returns the new -// document. -func (p Patch) Apply(doc []byte) ([]byte, error) { - return p.ApplyIndent(doc, "") -} - -// ApplyIndent mutates a JSON document according to the patch, and returns the new -// document indented. -func (p Patch) ApplyIndent(doc []byte, indent string) ([]byte, error) { - if len(doc) == 0 { - return doc, nil - } - - var pd container - if doc[0] == '[' { - pd = &partialArray{} - } else { - pd = &partialDoc{} - } - - err := json.Unmarshal(doc, pd) - - if err != nil { - return nil, err - } - - err = nil - - var accumulatedCopySize int64 - - for _, op := range p { - switch op.Kind() { - case "add": - err = p.add(&pd, op) - case "remove": - err = p.remove(&pd, op) - case "replace": - err = p.replace(&pd, op) - case "move": - err = p.move(&pd, op) - case "test": - err = p.test(&pd, op) - case "copy": - err = p.copy(&pd, op, &accumulatedCopySize) - default: - err = fmt.Errorf("Unexpected kind: %s", op.Kind()) - } - - if err != nil { - return nil, err - } - } - - if indent != "" { - return json.MarshalIndent(pd, "", indent) - } - - return json.Marshal(pd) -} - -// From http://tools.ietf.org/html/rfc6901#section-4 : -// -// Evaluation of each reference token begins by decoding any escaped -// character sequence. This is performed by first transforming any -// occurrence of the sequence '~1' to '/', and then transforming any -// occurrence of the sequence '~0' to '~'. - -var ( - rfc6901Decoder = strings.NewReplacer("~1", "/", "~0", "~") -) - -func decodePatchKey(k string) string { - return rfc6901Decoder.Replace(k) -} diff --git a/vendor/github.com/fatih/color/color.go b/vendor/github.com/fatih/color/color.go index c4234287d..81094e87c 100644 --- a/vendor/github.com/fatih/color/color.go +++ b/vendor/github.com/fatih/color/color.go @@ -269,7 +269,7 @@ func (c *Color) Printf(format string, a ...interface{}) (n int, err error) { // On Windows, users should wrap w with colorable.NewColorable() if w is of // type *os.File. func (c *Color) Fprintln(w io.Writer, a ...interface{}) (n int, err error) { - return fmt.Fprintln(w, c.wrap(fmt.Sprint(a...))) + return fmt.Fprintln(w, c.wrap(sprintln(a...))) } // Println formats using the default formats for its operands and writes to @@ -278,7 +278,7 @@ func (c *Color) Fprintln(w io.Writer, a ...interface{}) (n int, err error) { // encountered. This is the standard fmt.Print() method wrapped with the given // color. func (c *Color) Println(a ...interface{}) (n int, err error) { - return fmt.Fprintln(Output, c.wrap(fmt.Sprint(a...))) + return fmt.Fprintln(Output, c.wrap(sprintln(a...))) } // Sprint is just like Print, but returns a string instead of printing it. @@ -288,7 +288,7 @@ func (c *Color) Sprint(a ...interface{}) string { // Sprintln is just like Println, but returns a string instead of printing it. func (c *Color) Sprintln(a ...interface{}) string { - return fmt.Sprintln(c.Sprint(a...)) + return c.wrap(sprintln(a...)) + "\n" } // Sprintf is just like Printf, but returns a string instead of printing it. @@ -370,7 +370,7 @@ func (c *Color) SprintfFunc() func(format string, a ...interface{}) string { // string. Windows users should use this in conjunction with color.Output. func (c *Color) SprintlnFunc() func(a ...interface{}) string { return func(a ...interface{}) string { - return fmt.Sprintln(c.Sprint(a...)) + return c.wrap(sprintln(a...)) + "\n" } } @@ -648,3 +648,8 @@ func HiCyanString(format string, a ...interface{}) string { return colorString(f func HiWhiteString(format string, a ...interface{}) string { return colorString(format, FgHiWhite, a...) } + +// sprintln is a helper function to format a string with fmt.Sprintln and trim the trailing newline. +func sprintln(a ...interface{}) string { + return strings.TrimSuffix(fmt.Sprintln(a...), "\n") +} diff --git a/vendor/github.com/go-logr/logr/funcr/funcr.go b/vendor/github.com/go-logr/logr/funcr/funcr.go deleted file mode 100644 index fb2f866f4..000000000 --- a/vendor/github.com/go-logr/logr/funcr/funcr.go +++ /dev/null @@ -1,911 +0,0 @@ -/* -Copyright 2021 The logr 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 funcr implements formatting of structured log messages and -// optionally captures the call site and timestamp. -// -// The simplest way to use it is via its implementation of a -// github.com/go-logr/logr.LogSink with output through an arbitrary -// "write" function. See New and NewJSON for details. -// -// # Custom LogSinks -// -// For users who need more control, a funcr.Formatter can be embedded inside -// your own custom LogSink implementation. This is useful when the LogSink -// needs to implement additional methods, for example. -// -// # Formatting -// -// This will respect logr.Marshaler, fmt.Stringer, and error interfaces for -// values which are being logged. When rendering a struct, funcr will use Go's -// standard JSON tags (all except "string"). -package funcr - -import ( - "bytes" - "encoding" - "encoding/json" - "fmt" - "path/filepath" - "reflect" - "runtime" - "strconv" - "strings" - "time" - - "github.com/go-logr/logr" -) - -// New returns a logr.Logger which is implemented by an arbitrary function. -func New(fn func(prefix, args string), opts Options) logr.Logger { - return logr.New(newSink(fn, NewFormatter(opts))) -} - -// NewJSON returns a logr.Logger which is implemented by an arbitrary function -// and produces JSON output. -func NewJSON(fn func(obj string), opts Options) logr.Logger { - fnWrapper := func(_, obj string) { - fn(obj) - } - return logr.New(newSink(fnWrapper, NewFormatterJSON(opts))) -} - -// Underlier exposes access to the underlying logging function. Since -// callers only have a logr.Logger, they have to know which -// implementation is in use, so this interface is less of an -// abstraction and more of a way to test type conversion. -type Underlier interface { - GetUnderlying() func(prefix, args string) -} - -func newSink(fn func(prefix, args string), formatter Formatter) logr.LogSink { - l := &fnlogger{ - Formatter: formatter, - write: fn, - } - // For skipping fnlogger.Info and fnlogger.Error. - l.Formatter.AddCallDepth(1) - return l -} - -// Options carries parameters which influence the way logs are generated. -type Options struct { - // LogCaller tells funcr to add a "caller" key to some or all log lines. - // This has some overhead, so some users might not want it. - LogCaller MessageClass - - // LogCallerFunc tells funcr to also log the calling function name. This - // has no effect if caller logging is not enabled (see Options.LogCaller). - LogCallerFunc bool - - // LogTimestamp tells funcr to add a "ts" key to log lines. This has some - // overhead, so some users might not want it. - LogTimestamp bool - - // TimestampFormat tells funcr how to render timestamps when LogTimestamp - // is enabled. If not specified, a default format will be used. For more - // details, see docs for Go's time.Layout. - TimestampFormat string - - // LogInfoLevel tells funcr what key to use to log the info level. - // If not specified, the info level will be logged as "level". - // If this is set to "", the info level will not be logged at all. - LogInfoLevel *string - - // Verbosity tells funcr which V logs to produce. Higher values enable - // more logs. Info logs at or below this level will be written, while logs - // above this level will be discarded. - Verbosity int - - // RenderBuiltinsHook allows users to mutate the list of key-value pairs - // while a log line is being rendered. The kvList argument follows logr - // conventions - each pair of slice elements is comprised of a string key - // and an arbitrary value (verified and sanitized before calling this - // hook). The value returned must follow the same conventions. This hook - // can be used to audit or modify logged data. For example, you might want - // to prefix all of funcr's built-in keys with some string. This hook is - // only called for built-in (provided by funcr itself) key-value pairs. - // Equivalent hooks are offered for key-value pairs saved via - // logr.Logger.WithValues or Formatter.AddValues (see RenderValuesHook) and - // for user-provided pairs (see RenderArgsHook). - RenderBuiltinsHook func(kvList []any) []any - - // RenderValuesHook is the same as RenderBuiltinsHook, except that it is - // only called for key-value pairs saved via logr.Logger.WithValues. See - // RenderBuiltinsHook for more details. - RenderValuesHook func(kvList []any) []any - - // RenderArgsHook is the same as RenderBuiltinsHook, except that it is only - // called for key-value pairs passed directly to Info and Error. See - // RenderBuiltinsHook for more details. - RenderArgsHook func(kvList []any) []any - - // MaxLogDepth tells funcr how many levels of nested fields (e.g. a struct - // that contains a struct, etc.) it may log. Every time it finds a struct, - // slice, array, or map the depth is increased by one. When the maximum is - // reached, the value will be converted to a string indicating that the max - // depth has been exceeded. If this field is not specified, a default - // value will be used. - MaxLogDepth int -} - -// MessageClass indicates which category or categories of messages to consider. -type MessageClass int - -const ( - // None ignores all message classes. - None MessageClass = iota - // All considers all message classes. - All - // Info only considers info messages. - Info - // Error only considers error messages. - Error -) - -// fnlogger inherits some of its LogSink implementation from Formatter -// and just needs to add some glue code. -type fnlogger struct { - Formatter - write func(prefix, args string) -} - -func (l fnlogger) WithName(name string) logr.LogSink { - l.Formatter.AddName(name) - return &l -} - -func (l fnlogger) WithValues(kvList ...any) logr.LogSink { - l.Formatter.AddValues(kvList) - return &l -} - -func (l fnlogger) WithCallDepth(depth int) logr.LogSink { - l.Formatter.AddCallDepth(depth) - return &l -} - -func (l fnlogger) Info(level int, msg string, kvList ...any) { - prefix, args := l.FormatInfo(level, msg, kvList) - l.write(prefix, args) -} - -func (l fnlogger) Error(err error, msg string, kvList ...any) { - prefix, args := l.FormatError(err, msg, kvList) - l.write(prefix, args) -} - -func (l fnlogger) GetUnderlying() func(prefix, args string) { - return l.write -} - -// Assert conformance to the interfaces. -var _ logr.LogSink = &fnlogger{} -var _ logr.CallDepthLogSink = &fnlogger{} -var _ Underlier = &fnlogger{} - -// NewFormatter constructs a Formatter which emits a JSON-like key=value format. -func NewFormatter(opts Options) Formatter { - return newFormatter(opts, outputKeyValue) -} - -// NewFormatterJSON constructs a Formatter which emits strict JSON. -func NewFormatterJSON(opts Options) Formatter { - return newFormatter(opts, outputJSON) -} - -// Defaults for Options. -const defaultTimestampFormat = "2006-01-02 15:04:05.000000" -const defaultMaxLogDepth = 16 - -func newFormatter(opts Options, outfmt outputFormat) Formatter { - if opts.TimestampFormat == "" { - opts.TimestampFormat = defaultTimestampFormat - } - if opts.MaxLogDepth == 0 { - opts.MaxLogDepth = defaultMaxLogDepth - } - if opts.LogInfoLevel == nil { - opts.LogInfoLevel = new(string) - *opts.LogInfoLevel = "level" - } - f := Formatter{ - outputFormat: outfmt, - prefix: "", - values: nil, - depth: 0, - opts: &opts, - } - return f -} - -// Formatter is an opaque struct which can be embedded in a LogSink -// implementation. It should be constructed with NewFormatter. Some of -// its methods directly implement logr.LogSink. -type Formatter struct { - outputFormat outputFormat - prefix string - values []any - valuesStr string - parentValuesStr string - depth int - opts *Options - group string // for slog groups - groupDepth int -} - -// outputFormat indicates which outputFormat to use. -type outputFormat int - -const ( - // outputKeyValue emits a JSON-like key=value format, but not strict JSON. - outputKeyValue outputFormat = iota - // outputJSON emits strict JSON. - outputJSON -) - -// PseudoStruct is a list of key-value pairs that gets logged as a struct. -type PseudoStruct []any - -// render produces a log line, ready to use. -func (f Formatter) render(builtins, args []any) string { - // Empirically bytes.Buffer is faster than strings.Builder for this. - buf := bytes.NewBuffer(make([]byte, 0, 1024)) - if f.outputFormat == outputJSON { - buf.WriteByte('{') // for the whole line - } - - vals := builtins - if hook := f.opts.RenderBuiltinsHook; hook != nil { - vals = hook(f.sanitize(vals)) - } - f.flatten(buf, vals, false, false) // keys are ours, no need to escape - continuing := len(builtins) > 0 - - if f.parentValuesStr != "" { - if continuing { - buf.WriteByte(f.comma()) - } - buf.WriteString(f.parentValuesStr) - continuing = true - } - - groupDepth := f.groupDepth - if f.group != "" { - if f.valuesStr != "" || len(args) != 0 { - if continuing { - buf.WriteByte(f.comma()) - } - buf.WriteString(f.quoted(f.group, true)) // escape user-provided keys - buf.WriteByte(f.colon()) - buf.WriteByte('{') // for the group - continuing = false - } else { - // The group was empty - groupDepth-- - } - } - - if f.valuesStr != "" { - if continuing { - buf.WriteByte(f.comma()) - } - buf.WriteString(f.valuesStr) - continuing = true - } - - vals = args - if hook := f.opts.RenderArgsHook; hook != nil { - vals = hook(f.sanitize(vals)) - } - f.flatten(buf, vals, continuing, true) // escape user-provided keys - - for i := 0; i < groupDepth; i++ { - buf.WriteByte('}') // for the groups - } - - if f.outputFormat == outputJSON { - buf.WriteByte('}') // for the whole line - } - - return buf.String() -} - -// flatten renders a list of key-value pairs into a buffer. If continuing is -// true, it assumes that the buffer has previous values and will emit a -// separator (which depends on the output format) before the first pair it -// writes. If escapeKeys is true, the keys are assumed to have -// non-JSON-compatible characters in them and must be evaluated for escapes. -// -// This function returns a potentially modified version of kvList, which -// ensures that there is a value for every key (adding a value if needed) and -// that each key is a string (substituting a key if needed). -func (f Formatter) flatten(buf *bytes.Buffer, kvList []any, continuing bool, escapeKeys bool) []any { - // This logic overlaps with sanitize() but saves one type-cast per key, - // which can be measurable. - if len(kvList)%2 != 0 { - kvList = append(kvList, noValue) - } - copied := false - for i := 0; i < len(kvList); i += 2 { - k, ok := kvList[i].(string) - if !ok { - if !copied { - newList := make([]any, len(kvList)) - copy(newList, kvList) - kvList = newList - copied = true - } - k = f.nonStringKey(kvList[i]) - kvList[i] = k - } - v := kvList[i+1] - - if i > 0 || continuing { - if f.outputFormat == outputJSON { - buf.WriteByte(f.comma()) - } else { - // In theory the format could be something we don't understand. In - // practice, we control it, so it won't be. - buf.WriteByte(' ') - } - } - - buf.WriteString(f.quoted(k, escapeKeys)) - buf.WriteByte(f.colon()) - buf.WriteString(f.pretty(v)) - } - return kvList -} - -func (f Formatter) quoted(str string, escape bool) string { - if escape { - return prettyString(str) - } - // this is faster - return `"` + str + `"` -} - -func (f Formatter) comma() byte { - if f.outputFormat == outputJSON { - return ',' - } - return ' ' -} - -func (f Formatter) colon() byte { - if f.outputFormat == outputJSON { - return ':' - } - return '=' -} - -func (f Formatter) pretty(value any) string { - return f.prettyWithFlags(value, 0, 0) -} - -const ( - flagRawStruct = 0x1 // do not print braces on structs -) - -// TODO: This is not fast. Most of the overhead goes here. -func (f Formatter) prettyWithFlags(value any, flags uint32, depth int) string { - if depth > f.opts.MaxLogDepth { - return `""` - } - - // Handle types that take full control of logging. - if v, ok := value.(logr.Marshaler); ok { - // Replace the value with what the type wants to get logged. - // That then gets handled below via reflection. - value = invokeMarshaler(v) - } - - // Handle types that want to format themselves. - switch v := value.(type) { - case fmt.Stringer: - value = invokeStringer(v) - case error: - value = invokeError(v) - } - - // Handling the most common types without reflect is a small perf win. - switch v := value.(type) { - case bool: - return strconv.FormatBool(v) - case string: - return prettyString(v) - case int: - return strconv.FormatInt(int64(v), 10) - case int8: - return strconv.FormatInt(int64(v), 10) - case int16: - return strconv.FormatInt(int64(v), 10) - case int32: - return strconv.FormatInt(int64(v), 10) - case int64: - return strconv.FormatInt(int64(v), 10) - case uint: - return strconv.FormatUint(uint64(v), 10) - case uint8: - return strconv.FormatUint(uint64(v), 10) - case uint16: - return strconv.FormatUint(uint64(v), 10) - case uint32: - return strconv.FormatUint(uint64(v), 10) - case uint64: - return strconv.FormatUint(v, 10) - case uintptr: - return strconv.FormatUint(uint64(v), 10) - case float32: - return strconv.FormatFloat(float64(v), 'f', -1, 32) - case float64: - return strconv.FormatFloat(v, 'f', -1, 64) - case complex64: - return `"` + strconv.FormatComplex(complex128(v), 'f', -1, 64) + `"` - case complex128: - return `"` + strconv.FormatComplex(v, 'f', -1, 128) + `"` - case PseudoStruct: - buf := bytes.NewBuffer(make([]byte, 0, 1024)) - v = f.sanitize(v) - if flags&flagRawStruct == 0 { - buf.WriteByte('{') - } - for i := 0; i < len(v); i += 2 { - if i > 0 { - buf.WriteByte(f.comma()) - } - k, _ := v[i].(string) // sanitize() above means no need to check success - // arbitrary keys might need escaping - buf.WriteString(prettyString(k)) - buf.WriteByte(f.colon()) - buf.WriteString(f.prettyWithFlags(v[i+1], 0, depth+1)) - } - if flags&flagRawStruct == 0 { - buf.WriteByte('}') - } - return buf.String() - } - - buf := bytes.NewBuffer(make([]byte, 0, 256)) - t := reflect.TypeOf(value) - if t == nil { - return "null" - } - v := reflect.ValueOf(value) - switch t.Kind() { - case reflect.Bool: - return strconv.FormatBool(v.Bool()) - case reflect.String: - return prettyString(v.String()) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return strconv.FormatInt(int64(v.Int()), 10) - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return strconv.FormatUint(uint64(v.Uint()), 10) - case reflect.Float32: - return strconv.FormatFloat(float64(v.Float()), 'f', -1, 32) - case reflect.Float64: - return strconv.FormatFloat(v.Float(), 'f', -1, 64) - case reflect.Complex64: - return `"` + strconv.FormatComplex(complex128(v.Complex()), 'f', -1, 64) + `"` - case reflect.Complex128: - return `"` + strconv.FormatComplex(v.Complex(), 'f', -1, 128) + `"` - case reflect.Struct: - if flags&flagRawStruct == 0 { - buf.WriteByte('{') - } - printComma := false // testing i>0 is not enough because of JSON omitted fields - for i := 0; i < t.NumField(); i++ { - fld := t.Field(i) - if fld.PkgPath != "" { - // reflect says this field is only defined for non-exported fields. - continue - } - if !v.Field(i).CanInterface() { - // reflect isn't clear exactly what this means, but we can't use it. - continue - } - name := "" - omitempty := false - if tag, found := fld.Tag.Lookup("json"); found { - if tag == "-" { - continue - } - if comma := strings.Index(tag, ","); comma != -1 { - if n := tag[:comma]; n != "" { - name = n - } - rest := tag[comma:] - if strings.Contains(rest, ",omitempty,") || strings.HasSuffix(rest, ",omitempty") { - omitempty = true - } - } else { - name = tag - } - } - if omitempty && isEmpty(v.Field(i)) { - continue - } - if printComma { - buf.WriteByte(f.comma()) - } - printComma = true // if we got here, we are rendering a field - if fld.Anonymous && fld.Type.Kind() == reflect.Struct && name == "" { - buf.WriteString(f.prettyWithFlags(v.Field(i).Interface(), flags|flagRawStruct, depth+1)) - continue - } - if name == "" { - name = fld.Name - } - // field names can't contain characters which need escaping - buf.WriteString(f.quoted(name, false)) - buf.WriteByte(f.colon()) - buf.WriteString(f.prettyWithFlags(v.Field(i).Interface(), 0, depth+1)) - } - if flags&flagRawStruct == 0 { - buf.WriteByte('}') - } - return buf.String() - case reflect.Slice, reflect.Array: - // If this is outputing as JSON make sure this isn't really a json.RawMessage. - // If so just emit "as-is" and don't pretty it as that will just print - // it as [X,Y,Z,...] which isn't terribly useful vs the string form you really want. - if f.outputFormat == outputJSON { - if rm, ok := value.(json.RawMessage); ok { - // If it's empty make sure we emit an empty value as the array style would below. - if len(rm) > 0 { - buf.Write(rm) - } else { - buf.WriteString("null") - } - return buf.String() - } - } - buf.WriteByte('[') - for i := 0; i < v.Len(); i++ { - if i > 0 { - buf.WriteByte(f.comma()) - } - e := v.Index(i) - buf.WriteString(f.prettyWithFlags(e.Interface(), 0, depth+1)) - } - buf.WriteByte(']') - return buf.String() - case reflect.Map: - buf.WriteByte('{') - // This does not sort the map keys, for best perf. - it := v.MapRange() - i := 0 - for it.Next() { - if i > 0 { - buf.WriteByte(f.comma()) - } - // If a map key supports TextMarshaler, use it. - keystr := "" - if m, ok := it.Key().Interface().(encoding.TextMarshaler); ok { - txt, err := m.MarshalText() - if err != nil { - keystr = fmt.Sprintf("", err.Error()) - } else { - keystr = string(txt) - } - keystr = prettyString(keystr) - } else { - // prettyWithFlags will produce already-escaped values - keystr = f.prettyWithFlags(it.Key().Interface(), 0, depth+1) - if t.Key().Kind() != reflect.String { - // JSON only does string keys. Unlike Go's standard JSON, we'll - // convert just about anything to a string. - keystr = prettyString(keystr) - } - } - buf.WriteString(keystr) - buf.WriteByte(f.colon()) - buf.WriteString(f.prettyWithFlags(it.Value().Interface(), 0, depth+1)) - i++ - } - buf.WriteByte('}') - return buf.String() - case reflect.Ptr, reflect.Interface: - if v.IsNil() { - return "null" - } - return f.prettyWithFlags(v.Elem().Interface(), 0, depth) - } - return fmt.Sprintf(`""`, t.Kind().String()) -} - -func prettyString(s string) string { - // Avoid escaping (which does allocations) if we can. - if needsEscape(s) { - return strconv.Quote(s) - } - b := bytes.NewBuffer(make([]byte, 0, 1024)) - b.WriteByte('"') - b.WriteString(s) - b.WriteByte('"') - return b.String() -} - -// needsEscape determines whether the input string needs to be escaped or not, -// without doing any allocations. -func needsEscape(s string) bool { - for _, r := range s { - if !strconv.IsPrint(r) || r == '\\' || r == '"' { - return true - } - } - return false -} - -func isEmpty(v reflect.Value) bool { - switch v.Kind() { - case reflect.Array, reflect.Map, reflect.Slice, reflect.String: - return v.Len() == 0 - case reflect.Bool: - return !v.Bool() - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.Complex64, reflect.Complex128: - return v.Complex() == 0 - case reflect.Interface, reflect.Ptr: - return v.IsNil() - } - return false -} - -func invokeMarshaler(m logr.Marshaler) (ret any) { - defer func() { - if r := recover(); r != nil { - ret = fmt.Sprintf("", r) - } - }() - return m.MarshalLog() -} - -func invokeStringer(s fmt.Stringer) (ret string) { - defer func() { - if r := recover(); r != nil { - ret = fmt.Sprintf("", r) - } - }() - return s.String() -} - -func invokeError(e error) (ret string) { - defer func() { - if r := recover(); r != nil { - ret = fmt.Sprintf("", r) - } - }() - return e.Error() -} - -// Caller represents the original call site for a log line, after considering -// logr.Logger.WithCallDepth and logr.Logger.WithCallStackHelper. The File and -// Line fields will always be provided, while the Func field is optional. -// Users can set the render hook fields in Options to examine logged key-value -// pairs, one of which will be {"caller", Caller} if the Options.LogCaller -// field is enabled for the given MessageClass. -type Caller struct { - // File is the basename of the file for this call site. - File string `json:"file"` - // Line is the line number in the file for this call site. - Line int `json:"line"` - // Func is the function name for this call site, or empty if - // Options.LogCallerFunc is not enabled. - Func string `json:"function,omitempty"` -} - -func (f Formatter) caller() Caller { - // +1 for this frame, +1 for Info/Error. - pc, file, line, ok := runtime.Caller(f.depth + 2) - if !ok { - return Caller{"", 0, ""} - } - fn := "" - if f.opts.LogCallerFunc { - if fp := runtime.FuncForPC(pc); fp != nil { - fn = fp.Name() - } - } - - return Caller{filepath.Base(file), line, fn} -} - -const noValue = "" - -func (f Formatter) nonStringKey(v any) string { - return fmt.Sprintf("", f.snippet(v)) -} - -// snippet produces a short snippet string of an arbitrary value. -func (f Formatter) snippet(v any) string { - const snipLen = 16 - - snip := f.pretty(v) - if len(snip) > snipLen { - snip = snip[:snipLen] - } - return snip -} - -// sanitize ensures that a list of key-value pairs has a value for every key -// (adding a value if needed) and that each key is a string (substituting a key -// if needed). -func (f Formatter) sanitize(kvList []any) []any { - if len(kvList)%2 != 0 { - kvList = append(kvList, noValue) - } - for i := 0; i < len(kvList); i += 2 { - _, ok := kvList[i].(string) - if !ok { - kvList[i] = f.nonStringKey(kvList[i]) - } - } - return kvList -} - -// startGroup opens a new group scope (basically a sub-struct), which locks all -// the current saved values and starts them anew. This is needed to satisfy -// slog. -func (f *Formatter) startGroup(group string) { - // Unnamed groups are just inlined. - if group == "" { - return - } - - // Any saved values can no longer be changed. - buf := bytes.NewBuffer(make([]byte, 0, 1024)) - continuing := false - - if f.parentValuesStr != "" { - buf.WriteString(f.parentValuesStr) - continuing = true - } - - if f.group != "" && f.valuesStr != "" { - if continuing { - buf.WriteByte(f.comma()) - } - buf.WriteString(f.quoted(f.group, true)) // escape user-provided keys - buf.WriteByte(f.colon()) - buf.WriteByte('{') // for the group - continuing = false - } - - if f.valuesStr != "" { - if continuing { - buf.WriteByte(f.comma()) - } - buf.WriteString(f.valuesStr) - } - - // NOTE: We don't close the scope here - that's done later, when a log line - // is actually rendered (because we have N scopes to close). - - f.parentValuesStr = buf.String() - - // Start collecting new values. - f.group = group - f.groupDepth++ - f.valuesStr = "" - f.values = nil -} - -// Init configures this Formatter from runtime info, such as the call depth -// imposed by logr itself. -// Note that this receiver is a pointer, so depth can be saved. -func (f *Formatter) Init(info logr.RuntimeInfo) { - f.depth += info.CallDepth -} - -// Enabled checks whether an info message at the given level should be logged. -func (f Formatter) Enabled(level int) bool { - return level <= f.opts.Verbosity -} - -// GetDepth returns the current depth of this Formatter. This is useful for -// implementations which do their own caller attribution. -func (f Formatter) GetDepth() int { - return f.depth -} - -// FormatInfo renders an Info log message into strings. The prefix will be -// empty when no names were set (via AddNames), or when the output is -// configured for JSON. -func (f Formatter) FormatInfo(level int, msg string, kvList []any) (prefix, argsStr string) { - args := make([]any, 0, 64) // using a constant here impacts perf - prefix = f.prefix - if f.outputFormat == outputJSON { - args = append(args, "logger", prefix) - prefix = "" - } - if f.opts.LogTimestamp { - args = append(args, "ts", time.Now().Format(f.opts.TimestampFormat)) - } - if policy := f.opts.LogCaller; policy == All || policy == Info { - args = append(args, "caller", f.caller()) - } - if key := *f.opts.LogInfoLevel; key != "" { - args = append(args, key, level) - } - args = append(args, "msg", msg) - return prefix, f.render(args, kvList) -} - -// FormatError renders an Error log message into strings. The prefix will be -// empty when no names were set (via AddNames), or when the output is -// configured for JSON. -func (f Formatter) FormatError(err error, msg string, kvList []any) (prefix, argsStr string) { - args := make([]any, 0, 64) // using a constant here impacts perf - prefix = f.prefix - if f.outputFormat == outputJSON { - args = append(args, "logger", prefix) - prefix = "" - } - if f.opts.LogTimestamp { - args = append(args, "ts", time.Now().Format(f.opts.TimestampFormat)) - } - if policy := f.opts.LogCaller; policy == All || policy == Error { - args = append(args, "caller", f.caller()) - } - args = append(args, "msg", msg) - var loggableErr any - if err != nil { - loggableErr = err.Error() - } - args = append(args, "error", loggableErr) - return prefix, f.render(args, kvList) -} - -// AddName appends the specified name. funcr uses '/' characters to separate -// name elements. Callers should not pass '/' in the provided name string, but -// this library does not actually enforce that. -func (f *Formatter) AddName(name string) { - if len(f.prefix) > 0 { - f.prefix += "/" - } - f.prefix += name -} - -// AddValues adds key-value pairs to the set of saved values to be logged with -// each log line. -func (f *Formatter) AddValues(kvList []any) { - // Three slice args forces a copy. - n := len(f.values) - f.values = append(f.values[:n:n], kvList...) - - vals := f.values - if hook := f.opts.RenderValuesHook; hook != nil { - vals = hook(f.sanitize(vals)) - } - - // Pre-render values, so we don't have to do it on each Info/Error call. - buf := bytes.NewBuffer(make([]byte, 0, 1024)) - f.flatten(buf, vals, false, true) // escape user-provided keys - f.valuesStr = buf.String() -} - -// AddCallDepth increases the number of stack-frames to skip when attributing -// the log line to a file and line. -func (f *Formatter) AddCallDepth(depth int) { - f.depth += depth -} diff --git a/vendor/github.com/go-logr/logr/funcr/slogsink.go b/vendor/github.com/go-logr/logr/funcr/slogsink.go deleted file mode 100644 index 7bd84761e..000000000 --- a/vendor/github.com/go-logr/logr/funcr/slogsink.go +++ /dev/null @@ -1,105 +0,0 @@ -//go:build go1.21 -// +build go1.21 - -/* -Copyright 2023 The logr 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 funcr - -import ( - "context" - "log/slog" - - "github.com/go-logr/logr" -) - -var _ logr.SlogSink = &fnlogger{} - -const extraSlogSinkDepth = 3 // 2 for slog, 1 for SlogSink - -func (l fnlogger) Handle(_ context.Context, record slog.Record) error { - kvList := make([]any, 0, 2*record.NumAttrs()) - record.Attrs(func(attr slog.Attr) bool { - kvList = attrToKVs(attr, kvList) - return true - }) - - if record.Level >= slog.LevelError { - l.WithCallDepth(extraSlogSinkDepth).Error(nil, record.Message, kvList...) - } else { - level := l.levelFromSlog(record.Level) - l.WithCallDepth(extraSlogSinkDepth).Info(level, record.Message, kvList...) - } - return nil -} - -func (l fnlogger) WithAttrs(attrs []slog.Attr) logr.SlogSink { - kvList := make([]any, 0, 2*len(attrs)) - for _, attr := range attrs { - kvList = attrToKVs(attr, kvList) - } - l.AddValues(kvList) - return &l -} - -func (l fnlogger) WithGroup(name string) logr.SlogSink { - l.startGroup(name) - return &l -} - -// attrToKVs appends a slog.Attr to a logr-style kvList. It handle slog Groups -// and other details of slog. -func attrToKVs(attr slog.Attr, kvList []any) []any { - attrVal := attr.Value.Resolve() - if attrVal.Kind() == slog.KindGroup { - groupVal := attrVal.Group() - grpKVs := make([]any, 0, 2*len(groupVal)) - for _, attr := range groupVal { - grpKVs = attrToKVs(attr, grpKVs) - } - if attr.Key == "" { - // slog says we have to inline these - kvList = append(kvList, grpKVs...) - } else { - kvList = append(kvList, attr.Key, PseudoStruct(grpKVs)) - } - } else if attr.Key != "" { - kvList = append(kvList, attr.Key, attrVal.Any()) - } - - return kvList -} - -// levelFromSlog adjusts the level by the logger's verbosity and negates it. -// It ensures that the result is >= 0. This is necessary because the result is -// passed to a LogSink and that API did not historically document whether -// levels could be negative or what that meant. -// -// Some example usage: -// -// logrV0 := getMyLogger() -// logrV2 := logrV0.V(2) -// slogV2 := slog.New(logr.ToSlogHandler(logrV2)) -// slogV2.Debug("msg") // =~ logrV2.V(4) =~ logrV0.V(6) -// slogV2.Info("msg") // =~ logrV2.V(0) =~ logrV0.V(2) -// slogv2.Warn("msg") // =~ logrV2.V(-4) =~ logrV0.V(0) -func (l fnlogger) levelFromSlog(level slog.Level) int { - result := -level - if result < 0 { - result = 0 // because LogSink doesn't expect negative V levels - } - return int(result) -} diff --git a/vendor/github.com/go-logr/stdr/LICENSE b/vendor/github.com/go-logr/stdr/LICENSE deleted file mode 100644 index 261eeb9e9..000000000 --- a/vendor/github.com/go-logr/stdr/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - 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. diff --git a/vendor/github.com/go-logr/stdr/README.md b/vendor/github.com/go-logr/stdr/README.md deleted file mode 100644 index 515866789..000000000 --- a/vendor/github.com/go-logr/stdr/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Minimal Go logging using logr and Go's standard library - -[![Go Reference](https://pkg.go.dev/badge/github.com/go-logr/stdr.svg)](https://pkg.go.dev/github.com/go-logr/stdr) - -This package implements the [logr interface](https://github.com/go-logr/logr) -in terms of Go's standard log package(https://pkg.go.dev/log). diff --git a/vendor/github.com/go-logr/stdr/stdr.go b/vendor/github.com/go-logr/stdr/stdr.go deleted file mode 100644 index 93a8aab51..000000000 --- a/vendor/github.com/go-logr/stdr/stdr.go +++ /dev/null @@ -1,170 +0,0 @@ -/* -Copyright 2019 The logr 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 stdr implements github.com/go-logr/logr.Logger in terms of -// Go's standard log package. -package stdr - -import ( - "log" - "os" - - "github.com/go-logr/logr" - "github.com/go-logr/logr/funcr" -) - -// The global verbosity level. See SetVerbosity(). -var globalVerbosity int - -// SetVerbosity sets the global level against which all info logs will be -// compared. If this is greater than or equal to the "V" of the logger, the -// message will be logged. A higher value here means more logs will be written. -// The previous verbosity value is returned. This is not concurrent-safe - -// callers must be sure to call it from only one goroutine. -func SetVerbosity(v int) int { - old := globalVerbosity - globalVerbosity = v - return old -} - -// New returns a logr.Logger which is implemented by Go's standard log package, -// or something like it. If std is nil, this will use a default logger -// instead. -// -// Example: stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile))) -func New(std StdLogger) logr.Logger { - return NewWithOptions(std, Options{}) -} - -// NewWithOptions returns a logr.Logger which is implemented by Go's standard -// log package, or something like it. See New for details. -func NewWithOptions(std StdLogger, opts Options) logr.Logger { - if std == nil { - // Go's log.Default() is only available in 1.16 and higher. - std = log.New(os.Stderr, "", log.LstdFlags) - } - - if opts.Depth < 0 { - opts.Depth = 0 - } - - fopts := funcr.Options{ - LogCaller: funcr.MessageClass(opts.LogCaller), - } - - sl := &logger{ - Formatter: funcr.NewFormatter(fopts), - std: std, - } - - // For skipping our own logger.Info/Error. - sl.Formatter.AddCallDepth(1 + opts.Depth) - - return logr.New(sl) -} - -// Options carries parameters which influence the way logs are generated. -type Options struct { - // Depth biases the assumed number of call frames to the "true" caller. - // This is useful when the calling code calls a function which then calls - // stdr (e.g. a logging shim to another API). Values less than zero will - // be treated as zero. - Depth int - - // LogCaller tells stdr to add a "caller" key to some or all log lines. - // Go's log package has options to log this natively, too. - LogCaller MessageClass - - // TODO: add an option to log the date/time -} - -// MessageClass indicates which category or categories of messages to consider. -type MessageClass int - -const ( - // None ignores all message classes. - None MessageClass = iota - // All considers all message classes. - All - // Info only considers info messages. - Info - // Error only considers error messages. - Error -) - -// StdLogger is the subset of the Go stdlib log.Logger API that is needed for -// this adapter. -type StdLogger interface { - // Output is the same as log.Output and log.Logger.Output. - Output(calldepth int, logline string) error -} - -type logger struct { - funcr.Formatter - std StdLogger -} - -var _ logr.LogSink = &logger{} -var _ logr.CallDepthLogSink = &logger{} - -func (l logger) Enabled(level int) bool { - return globalVerbosity >= level -} - -func (l logger) Info(level int, msg string, kvList ...interface{}) { - prefix, args := l.FormatInfo(level, msg, kvList) - if prefix != "" { - args = prefix + ": " + args - } - _ = l.std.Output(l.Formatter.GetDepth()+1, args) -} - -func (l logger) Error(err error, msg string, kvList ...interface{}) { - prefix, args := l.FormatError(err, msg, kvList) - if prefix != "" { - args = prefix + ": " + args - } - _ = l.std.Output(l.Formatter.GetDepth()+1, args) -} - -func (l logger) WithName(name string) logr.LogSink { - l.Formatter.AddName(name) - return &l -} - -func (l logger) WithValues(kvList ...interface{}) logr.LogSink { - l.Formatter.AddValues(kvList) - return &l -} - -func (l logger) WithCallDepth(depth int) logr.LogSink { - l.Formatter.AddCallDepth(depth) - return &l -} - -// Underlier exposes access to the underlying logging implementation. Since -// callers only have a logr.Logger, they have to know which implementation is -// in use, so this interface is less of an abstraction and more of way to test -// type conversion. -type Underlier interface { - GetUnderlying() StdLogger -} - -// GetUnderlying returns the StdLogger underneath this logger. Since StdLogger -// is itself an interface, the result may or may not be a Go log.Logger. -func (l logger) GetUnderlying() StdLogger { - return l.std -} diff --git a/vendor/github.com/go-openapi/runtime/.editorconfig b/vendor/github.com/go-openapi/runtime/.editorconfig deleted file mode 100644 index 3152da69a..000000000 --- a/vendor/github.com/go-openapi/runtime/.editorconfig +++ /dev/null @@ -1,26 +0,0 @@ -# top-most EditorConfig file -root = true - -# Unix-style newlines with a newline ending every file -[*] -end_of_line = lf -insert_final_newline = true -indent_style = space -indent_size = 2 -trim_trailing_whitespace = true - -# Set default charset -[*.{js,py,go,scala,rb,java,html,css,less,sass,md}] -charset = utf-8 - -# Tab indentation (no size specified) -[*.go] -indent_style = tab - -[*.md] -trim_trailing_whitespace = false - -# Matches the exact files either package.json or .travis.yml -[{package.json,.travis.yml}] -indent_style = space -indent_size = 2 diff --git a/vendor/github.com/go-openapi/runtime/.gitattributes b/vendor/github.com/go-openapi/runtime/.gitattributes deleted file mode 100644 index d207b1802..000000000 --- a/vendor/github.com/go-openapi/runtime/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -*.go text eol=lf diff --git a/vendor/github.com/go-openapi/runtime/.gitignore b/vendor/github.com/go-openapi/runtime/.gitignore deleted file mode 100644 index fea8b84ec..000000000 --- a/vendor/github.com/go-openapi/runtime/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -secrets.yml -coverage.out -*.cov -*.out -playground diff --git a/vendor/github.com/go-openapi/runtime/.golangci.yml b/vendor/github.com/go-openapi/runtime/.golangci.yml deleted file mode 100644 index 1c75557ba..000000000 --- a/vendor/github.com/go-openapi/runtime/.golangci.yml +++ /dev/null @@ -1,62 +0,0 @@ -linters-settings: - govet: - check-shadowing: true - golint: - min-confidence: 0 - gocyclo: - min-complexity: 45 - maligned: - suggest-new: true - dupl: - threshold: 200 - goconst: - min-len: 2 - min-occurrences: 3 - -linters: - enable-all: true - disable: - - nilerr # nilerr crashes on this repo - - maligned - - unparam - - lll - - gochecknoinits - - gochecknoglobals - - funlen - - godox - - gocognit - - whitespace - - wsl - - wrapcheck - - testpackage - - nlreturn - - gomnd - - exhaustivestruct - - goerr113 - - errorlint - - nestif - - godot - - gofumpt - - paralleltest - - tparallel - - thelper - - ifshort - - exhaustruct - - varnamelen - - gci - - depguard - - errchkjson - - inamedparam - - nonamedreturns - - musttag - - ireturn - - forcetypeassert - - cyclop - # deprecated linters - - deadcode - - interfacer - - scopelint - - varcheck - - structcheck - - golint - - nosnakecase diff --git a/vendor/github.com/go-openapi/runtime/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/runtime/CODE_OF_CONDUCT.md deleted file mode 100644 index 9322b065e..000000000 --- a/vendor/github.com/go-openapi/runtime/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,74 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, gender identity and expression, level of experience, -nationality, personal appearance, race, religion, or sexual identity and -orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or -advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at ivan+abuse@flanders.co.nz. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at [http://contributor-covenant.org/version/1/4][version] - -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/go-openapi/runtime/LICENSE b/vendor/github.com/go-openapi/runtime/LICENSE deleted file mode 100644 index d64569567..000000000 --- a/vendor/github.com/go-openapi/runtime/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - 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. diff --git a/vendor/github.com/go-openapi/runtime/README.md b/vendor/github.com/go-openapi/runtime/README.md deleted file mode 100644 index b07e0ad9d..000000000 --- a/vendor/github.com/go-openapi/runtime/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# runtime [![Build Status](https://github.com/go-openapi/runtime/actions/workflows/go-test.yml/badge.svg)](https://github.com/go-openapi/runtime/actions?query=workflow%3A"go+test") [![codecov](https://codecov.io/gh/go-openapi/runtime/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/runtime) - -[![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) -[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/runtime/master/LICENSE) -[![Go Reference](https://pkg.go.dev/badge/github.com/go-openapi/runtime.svg)](https://pkg.go.dev/github.com/go-openapi/runtime) -[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/runtime)](https://goreportcard.com/report/github.com/go-openapi/runtime) - -# go OpenAPI toolkit runtime - -The runtime component for use in code generation or as untyped usage. diff --git a/vendor/github.com/go-openapi/runtime/bytestream.go b/vendor/github.com/go-openapi/runtime/bytestream.go deleted file mode 100644 index f8fb48223..000000000 --- a/vendor/github.com/go-openapi/runtime/bytestream.go +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 runtime - -import ( - "bytes" - "encoding" - "errors" - "fmt" - "io" - "reflect" - - "github.com/go-openapi/swag" -) - -func defaultCloser() error { return nil } - -type byteStreamOpt func(opts *byteStreamOpts) - -// ClosesStream when the bytestream consumer or producer is finished -func ClosesStream(opts *byteStreamOpts) { - opts.Close = true -} - -type byteStreamOpts struct { - Close bool -} - -// ByteStreamConsumer creates a consumer for byte streams. -// -// The consumer consumes from a provided reader into the data passed by reference. -// -// Supported output underlying types and interfaces, prioritized in this order: -// - io.ReaderFrom (for maximum control) -// - io.Writer (performs io.Copy) -// - encoding.BinaryUnmarshaler -// - *string -// - *[]byte -func ByteStreamConsumer(opts ...byteStreamOpt) Consumer { - var vals byteStreamOpts - for _, opt := range opts { - opt(&vals) - } - - return ConsumerFunc(func(reader io.Reader, data interface{}) error { - if reader == nil { - return errors.New("ByteStreamConsumer requires a reader") // early exit - } - if data == nil { - return errors.New("nil destination for ByteStreamConsumer") - } - - closer := defaultCloser - if vals.Close { - if cl, isReaderCloser := reader.(io.Closer); isReaderCloser { - closer = cl.Close - } - } - defer func() { - _ = closer() - }() - - if readerFrom, isReaderFrom := data.(io.ReaderFrom); isReaderFrom { - _, err := readerFrom.ReadFrom(reader) - return err - } - - if writer, isDataWriter := data.(io.Writer); isDataWriter { - _, err := io.Copy(writer, reader) - return err - } - - // buffers input before writing to data - var buf bytes.Buffer - _, err := buf.ReadFrom(reader) - if err != nil { - return err - } - b := buf.Bytes() - - switch destinationPointer := data.(type) { - case encoding.BinaryUnmarshaler: - return destinationPointer.UnmarshalBinary(b) - case *any: - switch (*destinationPointer).(type) { - case string: - *destinationPointer = string(b) - - return nil - - case []byte: - *destinationPointer = b - - return nil - } - default: - // check for the underlying type to be pointer to []byte or string, - if ptr := reflect.TypeOf(data); ptr.Kind() != reflect.Ptr { - return errors.New("destination must be a pointer") - } - - v := reflect.Indirect(reflect.ValueOf(data)) - t := v.Type() - - switch { - case t.Kind() == reflect.Slice && t.Elem().Kind() == reflect.Uint8: - v.SetBytes(b) - return nil - - case t.Kind() == reflect.String: - v.SetString(string(b)) - return nil - } - } - - return fmt.Errorf("%v (%T) is not supported by the ByteStreamConsumer, %s", - data, data, "can be resolved by supporting Writer/BinaryUnmarshaler interface") - }) -} - -// ByteStreamProducer creates a producer for byte streams. -// -// The producer takes input data then writes to an output writer (essentially as a pipe). -// -// Supported input underlying types and interfaces, prioritized in this order: -// - io.WriterTo (for maximum control) -// - io.Reader (performs io.Copy). A ReadCloser is closed before exiting. -// - encoding.BinaryMarshaler -// - error (writes as a string) -// - []byte -// - string -// - struct, other slices: writes as JSON -func ByteStreamProducer(opts ...byteStreamOpt) Producer { - var vals byteStreamOpts - for _, opt := range opts { - opt(&vals) - } - - return ProducerFunc(func(writer io.Writer, data interface{}) error { - if writer == nil { - return errors.New("ByteStreamProducer requires a writer") // early exit - } - if data == nil { - return errors.New("nil data for ByteStreamProducer") - } - - closer := defaultCloser - if vals.Close { - if cl, isWriterCloser := writer.(io.Closer); isWriterCloser { - closer = cl.Close - } - } - defer func() { - _ = closer() - }() - - if rc, isDataCloser := data.(io.ReadCloser); isDataCloser { - defer rc.Close() - } - - switch origin := data.(type) { - case io.WriterTo: - _, err := origin.WriteTo(writer) - return err - - case io.Reader: - _, err := io.Copy(writer, origin) - return err - - case encoding.BinaryMarshaler: - bytes, err := origin.MarshalBinary() - if err != nil { - return err - } - - _, err = writer.Write(bytes) - return err - - case error: - _, err := writer.Write([]byte(origin.Error())) - return err - - default: - v := reflect.Indirect(reflect.ValueOf(data)) - t := v.Type() - - switch { - case t.Kind() == reflect.Slice && t.Elem().Kind() == reflect.Uint8: - _, err := writer.Write(v.Bytes()) - return err - - case t.Kind() == reflect.String: - _, err := writer.Write([]byte(v.String())) - return err - - case t.Kind() == reflect.Struct || t.Kind() == reflect.Slice: - b, err := swag.WriteJSON(data) - if err != nil { - return err - } - - _, err = writer.Write(b) - return err - } - } - - return fmt.Errorf("%v (%T) is not supported by the ByteStreamProducer, %s", - data, data, "can be resolved by supporting Reader/BinaryMarshaler interface") - }) -} diff --git a/vendor/github.com/go-openapi/runtime/client/auth_info.go b/vendor/github.com/go-openapi/runtime/client/auth_info.go deleted file mode 100644 index 4f26e9234..000000000 --- a/vendor/github.com/go-openapi/runtime/client/auth_info.go +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 client - -import ( - "encoding/base64" - - "github.com/go-openapi/strfmt" - - "github.com/go-openapi/runtime" -) - -// PassThroughAuth never manipulates the request -var PassThroughAuth runtime.ClientAuthInfoWriter - -func init() { - PassThroughAuth = runtime.ClientAuthInfoWriterFunc(func(_ runtime.ClientRequest, _ strfmt.Registry) error { return nil }) -} - -// BasicAuth provides a basic auth info writer -func BasicAuth(username, password string) runtime.ClientAuthInfoWriter { - return runtime.ClientAuthInfoWriterFunc(func(r runtime.ClientRequest, _ strfmt.Registry) error { - encoded := base64.StdEncoding.EncodeToString([]byte(username + ":" + password)) - return r.SetHeaderParam(runtime.HeaderAuthorization, "Basic "+encoded) - }) -} - -// APIKeyAuth provides an API key auth info writer -func APIKeyAuth(name, in, value string) runtime.ClientAuthInfoWriter { - if in == "query" { - return runtime.ClientAuthInfoWriterFunc(func(r runtime.ClientRequest, _ strfmt.Registry) error { - return r.SetQueryParam(name, value) - }) - } - - if in == "header" { - return runtime.ClientAuthInfoWriterFunc(func(r runtime.ClientRequest, _ strfmt.Registry) error { - return r.SetHeaderParam(name, value) - }) - } - return nil -} - -// BearerToken provides a header based oauth2 bearer access token auth info writer -func BearerToken(token string) runtime.ClientAuthInfoWriter { - return runtime.ClientAuthInfoWriterFunc(func(r runtime.ClientRequest, _ strfmt.Registry) error { - return r.SetHeaderParam(runtime.HeaderAuthorization, "Bearer "+token) - }) -} - -// Compose combines multiple ClientAuthInfoWriters into a single one. -// Useful when multiple auth headers are needed. -func Compose(auths ...runtime.ClientAuthInfoWriter) runtime.ClientAuthInfoWriter { - return runtime.ClientAuthInfoWriterFunc(func(r runtime.ClientRequest, _ strfmt.Registry) error { - for _, auth := range auths { - if auth == nil { - continue - } - if err := auth.AuthenticateRequest(r, nil); err != nil { - return err - } - } - return nil - }) -} diff --git a/vendor/github.com/go-openapi/runtime/client/keepalive.go b/vendor/github.com/go-openapi/runtime/client/keepalive.go deleted file mode 100644 index 7dd6b51c4..000000000 --- a/vendor/github.com/go-openapi/runtime/client/keepalive.go +++ /dev/null @@ -1,54 +0,0 @@ -package client - -import ( - "io" - "net/http" - "sync/atomic" -) - -// KeepAliveTransport drains the remaining body from a response -// so that go will reuse the TCP connections. -// This is not enabled by default because there are servers where -// the response never gets closed and that would make the code hang forever. -// So instead it's provided as a http client middleware that can be used to override -// any request. -func KeepAliveTransport(rt http.RoundTripper) http.RoundTripper { - return &keepAliveTransport{wrapped: rt} -} - -type keepAliveTransport struct { - wrapped http.RoundTripper -} - -func (k *keepAliveTransport) RoundTrip(r *http.Request) (*http.Response, error) { - resp, err := k.wrapped.RoundTrip(r) - if err != nil { - return resp, err - } - resp.Body = &drainingReadCloser{rdr: resp.Body} - return resp, nil -} - -type drainingReadCloser struct { - rdr io.ReadCloser - seenEOF uint32 -} - -func (d *drainingReadCloser) Read(p []byte) (n int, err error) { - n, err = d.rdr.Read(p) - if err == io.EOF || n == 0 { - atomic.StoreUint32(&d.seenEOF, 1) - } - return -} - -func (d *drainingReadCloser) Close() error { - // drain buffer - if atomic.LoadUint32(&d.seenEOF) != 1 { - // If the reader side (a HTTP server) is misbehaving, it still may send - // some bytes, but the closer ignores them to keep the underling - // connection open. - _, _ = io.Copy(io.Discard, d.rdr) - } - return d.rdr.Close() -} diff --git a/vendor/github.com/go-openapi/runtime/client/opentelemetry.go b/vendor/github.com/go-openapi/runtime/client/opentelemetry.go deleted file mode 100644 index 256cd1b4f..000000000 --- a/vendor/github.com/go-openapi/runtime/client/opentelemetry.go +++ /dev/null @@ -1,211 +0,0 @@ -package client - -import ( - "fmt" - "net/http" - "strings" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/propagation" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" - "go.opentelemetry.io/otel/semconv/v1.17.0/httpconv" - "go.opentelemetry.io/otel/trace" -) - -const ( - instrumentationVersion = "1.0.0" - tracerName = "go-openapi" -) - -type config struct { - Tracer trace.Tracer - Propagator propagation.TextMapPropagator - SpanStartOptions []trace.SpanStartOption - SpanNameFormatter func(*runtime.ClientOperation) string - TracerProvider trace.TracerProvider -} - -type OpenTelemetryOpt interface { - apply(*config) -} - -type optionFunc func(*config) - -func (o optionFunc) apply(c *config) { - o(c) -} - -// WithTracerProvider specifies a tracer provider to use for creating a tracer. -// If none is specified, the global provider is used. -func WithTracerProvider(provider trace.TracerProvider) OpenTelemetryOpt { - return optionFunc(func(c *config) { - if provider != nil { - c.TracerProvider = provider - } - }) -} - -// WithPropagators configures specific propagators. If this -// option isn't specified, then the global TextMapPropagator is used. -func WithPropagators(ps propagation.TextMapPropagator) OpenTelemetryOpt { - return optionFunc(func(c *config) { - if ps != nil { - c.Propagator = ps - } - }) -} - -// WithSpanOptions configures an additional set of -// trace.SpanOptions, which are applied to each new span. -func WithSpanOptions(opts ...trace.SpanStartOption) OpenTelemetryOpt { - return optionFunc(func(c *config) { - c.SpanStartOptions = append(c.SpanStartOptions, opts...) - }) -} - -// WithSpanNameFormatter takes a function that will be called on every -// request and the returned string will become the Span Name. -func WithSpanNameFormatter(f func(op *runtime.ClientOperation) string) OpenTelemetryOpt { - return optionFunc(func(c *config) { - c.SpanNameFormatter = f - }) -} - -func defaultTransportFormatter(op *runtime.ClientOperation) string { - if op.ID != "" { - return op.ID - } - - return fmt.Sprintf("%s_%s", strings.ToLower(op.Method), op.PathPattern) -} - -type openTelemetryTransport struct { - transport runtime.ClientTransport - host string - tracer trace.Tracer - config *config -} - -func newOpenTelemetryTransport(transport runtime.ClientTransport, host string, opts []OpenTelemetryOpt) *openTelemetryTransport { - tr := &openTelemetryTransport{ - transport: transport, - host: host, - } - - defaultOpts := []OpenTelemetryOpt{ - WithSpanOptions(trace.WithSpanKind(trace.SpanKindClient)), - WithSpanNameFormatter(defaultTransportFormatter), - WithPropagators(otel.GetTextMapPropagator()), - WithTracerProvider(otel.GetTracerProvider()), - } - - c := newConfig(append(defaultOpts, opts...)...) - tr.config = c - - return tr -} - -func (t *openTelemetryTransport) Submit(op *runtime.ClientOperation) (interface{}, error) { - if op.Context == nil { - return t.transport.Submit(op) - } - - params := op.Params - reader := op.Reader - - var span trace.Span - defer func() { - if span != nil { - span.End() - } - }() - - op.Params = runtime.ClientRequestWriterFunc(func(req runtime.ClientRequest, reg strfmt.Registry) error { - span = t.newOpenTelemetrySpan(op, req.GetHeaderParams()) - return params.WriteToRequest(req, reg) - }) - - op.Reader = runtime.ClientResponseReaderFunc(func(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - if span != nil { - statusCode := response.Code() - // NOTE: this is replaced by semconv.HTTPResponseStatusCode in semconv v1.21 - span.SetAttributes(semconv.HTTPStatusCode(statusCode)) - // NOTE: the conversion from HTTP status code to trace code is no longer available with - // semconv v1.21 - span.SetStatus(httpconv.ServerStatus(statusCode)) - } - - return reader.ReadResponse(response, consumer) - }) - - submit, err := t.transport.Submit(op) - if err != nil && span != nil { - span.RecordError(err) - span.SetStatus(codes.Error, err.Error()) - } - - return submit, err -} - -func (t *openTelemetryTransport) newOpenTelemetrySpan(op *runtime.ClientOperation, header http.Header) trace.Span { - ctx := op.Context - - tracer := t.tracer - if tracer == nil { - if span := trace.SpanFromContext(ctx); span.SpanContext().IsValid() { - tracer = newTracer(span.TracerProvider()) - } else { - tracer = newTracer(otel.GetTracerProvider()) - } - } - - ctx, span := tracer.Start(ctx, t.config.SpanNameFormatter(op), t.config.SpanStartOptions...) - - var scheme string - if len(op.Schemes) > 0 { - scheme = op.Schemes[0] - } - - span.SetAttributes( - attribute.String("net.peer.name", t.host), - attribute.String(string(semconv.HTTPRouteKey), op.PathPattern), - attribute.String(string(semconv.HTTPMethodKey), op.Method), - attribute.String("span.kind", trace.SpanKindClient.String()), - attribute.String("http.scheme", scheme), - ) - - carrier := propagation.HeaderCarrier(header) - t.config.Propagator.Inject(ctx, carrier) - - return span -} - -func newTracer(tp trace.TracerProvider) trace.Tracer { - return tp.Tracer(tracerName, trace.WithInstrumentationVersion(version())) -} - -func newConfig(opts ...OpenTelemetryOpt) *config { - c := &config{ - Propagator: otel.GetTextMapPropagator(), - } - - for _, opt := range opts { - opt.apply(c) - } - - // Tracer is only initialized if manually specified. Otherwise, can be passed with the tracing context. - if c.TracerProvider != nil { - c.Tracer = newTracer(c.TracerProvider) - } - - return c -} - -// Version is the current release version of the go-runtime instrumentation. -func version() string { - return instrumentationVersion -} diff --git a/vendor/github.com/go-openapi/runtime/client/opentracing.go b/vendor/github.com/go-openapi/runtime/client/opentracing.go deleted file mode 100644 index 627286d12..000000000 --- a/vendor/github.com/go-openapi/runtime/client/opentracing.go +++ /dev/null @@ -1,99 +0,0 @@ -package client - -import ( - "fmt" - "net/http" - - "github.com/go-openapi/strfmt" - "github.com/opentracing/opentracing-go" - "github.com/opentracing/opentracing-go/ext" - "github.com/opentracing/opentracing-go/log" - - "github.com/go-openapi/runtime" -) - -type tracingTransport struct { - transport runtime.ClientTransport - host string - opts []opentracing.StartSpanOption -} - -func newOpenTracingTransport(transport runtime.ClientTransport, host string, opts []opentracing.StartSpanOption, -) runtime.ClientTransport { - return &tracingTransport{ - transport: transport, - host: host, - opts: opts, - } -} - -func (t *tracingTransport) Submit(op *runtime.ClientOperation) (interface{}, error) { - if op.Context == nil { - return t.transport.Submit(op) - } - - params := op.Params - reader := op.Reader - - var span opentracing.Span - defer func() { - if span != nil { - span.Finish() - } - }() - - op.Params = runtime.ClientRequestWriterFunc(func(req runtime.ClientRequest, reg strfmt.Registry) error { - span = createClientSpan(op, req.GetHeaderParams(), t.host, t.opts) - return params.WriteToRequest(req, reg) - }) - - op.Reader = runtime.ClientResponseReaderFunc(func(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - if span != nil { - code := response.Code() - ext.HTTPStatusCode.Set(span, uint16(code)) - if code >= 400 { - ext.Error.Set(span, true) - } - } - return reader.ReadResponse(response, consumer) - }) - - submit, err := t.transport.Submit(op) - if err != nil && span != nil { - ext.Error.Set(span, true) - span.LogFields(log.Error(err)) - } - return submit, err -} - -func createClientSpan(op *runtime.ClientOperation, header http.Header, host string, - opts []opentracing.StartSpanOption) opentracing.Span { - ctx := op.Context - span := opentracing.SpanFromContext(ctx) - - if span != nil { - opts = append(opts, ext.SpanKindRPCClient) - span, _ = opentracing.StartSpanFromContextWithTracer( - ctx, span.Tracer(), operationName(op), opts...) - - ext.Component.Set(span, "go-openapi") - ext.PeerHostname.Set(span, host) - span.SetTag("http.path", op.PathPattern) - ext.HTTPMethod.Set(span, op.Method) - - _ = span.Tracer().Inject( - span.Context(), - opentracing.HTTPHeaders, - opentracing.HTTPHeadersCarrier(header)) - - return span - } - return nil -} - -func operationName(op *runtime.ClientOperation) string { - if op.ID != "" { - return op.ID - } - return fmt.Sprintf("%s_%s", op.Method, op.PathPattern) -} diff --git a/vendor/github.com/go-openapi/runtime/client/request.go b/vendor/github.com/go-openapi/runtime/client/request.go deleted file mode 100644 index c4a891d0b..000000000 --- a/vendor/github.com/go-openapi/runtime/client/request.go +++ /dev/null @@ -1,482 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 client - -import ( - "bytes" - "context" - "fmt" - "io" - "log" - "mime/multipart" - "net/http" - "net/textproto" - "net/url" - "os" - "path" - "path/filepath" - "strings" - "time" - - "github.com/go-openapi/strfmt" - - "github.com/go-openapi/runtime" -) - -// NewRequest creates a new swagger http client request -func newRequest(method, pathPattern string, writer runtime.ClientRequestWriter) *request { - return &request{ - pathPattern: pathPattern, - method: method, - writer: writer, - header: make(http.Header), - query: make(url.Values), - timeout: DefaultTimeout, - getBody: getRequestBuffer, - } -} - -// Request represents a swagger client request. -// -// This Request struct converts to a HTTP request. -// There might be others that convert to other transports. -// There is no error checking here, it is assumed to be used after a spec has been validated. -// so impossible combinations should not arise (hopefully). -// -// The main purpose of this struct is to hide the machinery of adding params to a transport request. -// The generated code only implements what is necessary to turn a param into a valid value for these methods. -type request struct { - pathPattern string - method string - writer runtime.ClientRequestWriter - - pathParams map[string]string - header http.Header - query url.Values - formFields url.Values - fileFields map[string][]runtime.NamedReadCloser - payload interface{} - timeout time.Duration - buf *bytes.Buffer - - getBody func(r *request) []byte -} - -var ( - // ensure interface compliance - _ runtime.ClientRequest = new(request) -) - -func (r *request) isMultipart(mediaType string) bool { - if len(r.fileFields) > 0 { - return true - } - - return runtime.MultipartFormMime == mediaType -} - -// BuildHTTP creates a new http request based on the data from the params -func (r *request) BuildHTTP(mediaType, basePath string, producers map[string]runtime.Producer, registry strfmt.Registry) (*http.Request, error) { - return r.buildHTTP(mediaType, basePath, producers, registry, nil) -} -func escapeQuotes(s string) string { - return strings.NewReplacer("\\", "\\\\", `"`, "\\\"").Replace(s) -} - -func logClose(err error, pw *io.PipeWriter) { - log.Println(err) - closeErr := pw.CloseWithError(err) - if closeErr != nil { - log.Println(closeErr) - } -} - -func (r *request) buildHTTP(mediaType, basePath string, producers map[string]runtime.Producer, registry strfmt.Registry, auth runtime.ClientAuthInfoWriter) (*http.Request, error) { //nolint:gocyclo,maintidx - // build the data - if err := r.writer.WriteToRequest(r, registry); err != nil { - return nil, err - } - - // Our body must be an io.Reader. - // When we create the http.Request, if we pass it a - // bytes.Buffer then it will wrap it in an io.ReadCloser - // and set the content length automatically. - var body io.Reader - var pr *io.PipeReader - var pw *io.PipeWriter - - r.buf = bytes.NewBuffer(nil) - if r.payload != nil || len(r.formFields) > 0 || len(r.fileFields) > 0 { - body = r.buf - if r.isMultipart(mediaType) { - pr, pw = io.Pipe() - body = pr - } - } - - // check if this is a form type request - if len(r.formFields) > 0 || len(r.fileFields) > 0 { - if !r.isMultipart(mediaType) { - r.header.Set(runtime.HeaderContentType, mediaType) - formString := r.formFields.Encode() - r.buf.WriteString(formString) - goto DoneChoosingBodySource - } - - mp := multipart.NewWriter(pw) - r.header.Set(runtime.HeaderContentType, mangleContentType(mediaType, mp.Boundary())) - - go func() { - defer func() { - mp.Close() - pw.Close() - }() - - for fn, v := range r.formFields { - for _, vi := range v { - if err := mp.WriteField(fn, vi); err != nil { - logClose(err, pw) - return - } - } - } - - defer func() { - for _, ff := range r.fileFields { - for _, ffi := range ff { - ffi.Close() - } - } - }() - for fn, f := range r.fileFields { - for _, fi := range f { - var fileContentType string - if p, ok := fi.(interface { - ContentType() string - }); ok { - fileContentType = p.ContentType() - } else { - // Need to read the data so that we can detect the content type - buf := make([]byte, 512) - size, err := fi.Read(buf) - if err != nil && err != io.EOF { - logClose(err, pw) - return - } - fileContentType = http.DetectContentType(buf) - fi = runtime.NamedReader(fi.Name(), io.MultiReader(bytes.NewReader(buf[:size]), fi)) - } - - // Create the MIME headers for the new part - h := make(textproto.MIMEHeader) - h.Set("Content-Disposition", - fmt.Sprintf(`form-data; name="%s"; filename="%s"`, - escapeQuotes(fn), escapeQuotes(filepath.Base(fi.Name())))) - h.Set("Content-Type", fileContentType) - - wrtr, err := mp.CreatePart(h) - if err != nil { - logClose(err, pw) - return - } - if _, err := io.Copy(wrtr, fi); err != nil { - logClose(err, pw) - } - } - } - }() - - goto DoneChoosingBodySource - } - - // if there is payload, use the producer to write the payload, and then - // set the header to the content-type appropriate for the payload produced - if r.payload != nil { - // TODO: infer most appropriate content type based on the producer used, - // and the `consumers` section of the spec/operation - r.header.Set(runtime.HeaderContentType, mediaType) - if rdr, ok := r.payload.(io.ReadCloser); ok { - body = rdr - goto DoneChoosingBodySource - } - - if rdr, ok := r.payload.(io.Reader); ok { - body = rdr - goto DoneChoosingBodySource - } - - producer := producers[mediaType] - if err := producer.Produce(r.buf, r.payload); err != nil { - return nil, err - } - } - -DoneChoosingBodySource: - - if runtime.CanHaveBody(r.method) && body != nil && r.header.Get(runtime.HeaderContentType) == "" { - r.header.Set(runtime.HeaderContentType, mediaType) - } - - if auth != nil { - // If we're not using r.buf as our http.Request's body, - // either the payload is an io.Reader or io.ReadCloser, - // or we're doing a multipart form/file. - // - // In those cases, if the AuthenticateRequest call asks for the body, - // we must read it into a buffer and provide that, then use that buffer - // as the body of our http.Request. - // - // This is done in-line with the GetBody() request rather than ahead - // of time, because there's no way to know if the AuthenticateRequest - // will even ask for the body of the request. - // - // If for some reason the copy fails, there's no way to return that - // error to the GetBody() call, so return it afterwards. - // - // An error from the copy action is prioritized over any error - // from the AuthenticateRequest call, because the mis-read - // body may have interfered with the auth. - // - var copyErr error - if buf, ok := body.(*bytes.Buffer); body != nil && (!ok || buf != r.buf) { - var copied bool - r.getBody = func(r *request) []byte { - if copied { - return getRequestBuffer(r) - } - - defer func() { - copied = true - }() - - if _, copyErr = io.Copy(r.buf, body); copyErr != nil { - return nil - } - - if closer, ok := body.(io.ReadCloser); ok { - if copyErr = closer.Close(); copyErr != nil { - return nil - } - } - - body = r.buf - return getRequestBuffer(r) - } - } - - authErr := auth.AuthenticateRequest(r, registry) - - if copyErr != nil { - return nil, fmt.Errorf("error retrieving the response body: %v", copyErr) - } - - if authErr != nil { - return nil, authErr - } - } - - // In case the basePath or the request pathPattern include static query parameters, - // parse those out before constructing the final path. The parameters themselves - // will be merged with the ones set by the client, with the priority given first to - // the ones set by the client, then the path pattern, and lastly the base path. - basePathURL, err := url.Parse(basePath) - if err != nil { - return nil, err - } - staticQueryParams := basePathURL.Query() - - pathPatternURL, err := url.Parse(r.pathPattern) - if err != nil { - return nil, err - } - for name, values := range pathPatternURL.Query() { - if _, present := staticQueryParams[name]; present { - staticQueryParams.Del(name) - } - for _, value := range values { - staticQueryParams.Add(name, value) - } - } - - // create http request - var reinstateSlash bool - if pathPatternURL.Path != "" && pathPatternURL.Path != "/" && pathPatternURL.Path[len(pathPatternURL.Path)-1] == '/' { - reinstateSlash = true - } - - urlPath := path.Join(basePathURL.Path, pathPatternURL.Path) - for k, v := range r.pathParams { - urlPath = strings.ReplaceAll(urlPath, "{"+k+"}", url.PathEscape(v)) - } - if reinstateSlash { - urlPath += "/" - } - - req, err := http.NewRequestWithContext(context.Background(), r.method, urlPath, body) - if err != nil { - return nil, err - } - - originalParams := r.GetQueryParams() - - // Merge the query parameters extracted from the basePath with the ones set by - // the client in this struct. In case of conflict, the client wins. - for k, v := range staticQueryParams { - _, present := originalParams[k] - if !present { - if err = r.SetQueryParam(k, v...); err != nil { - return nil, err - } - } - } - - req.URL.RawQuery = r.query.Encode() - req.Header = r.header - - return req, nil -} - -func mangleContentType(mediaType, boundary string) string { - if strings.ToLower(mediaType) == runtime.URLencodedFormMime { - return fmt.Sprintf("%s; boundary=%s", mediaType, boundary) - } - return "multipart/form-data; boundary=" + boundary -} - -func (r *request) GetMethod() string { - return r.method -} - -func (r *request) GetPath() string { - path := r.pathPattern - for k, v := range r.pathParams { - path = strings.ReplaceAll(path, "{"+k+"}", v) - } - return path -} - -func (r *request) GetBody() []byte { - return r.getBody(r) -} - -func getRequestBuffer(r *request) []byte { - if r.buf == nil { - return nil - } - return r.buf.Bytes() -} - -// SetHeaderParam adds a header param to the request -// when there is only 1 value provided for the varargs, it will set it. -// when there are several values provided for the varargs it will add it (no overriding) -func (r *request) SetHeaderParam(name string, values ...string) error { - if r.header == nil { - r.header = make(http.Header) - } - r.header[http.CanonicalHeaderKey(name)] = values - return nil -} - -// GetHeaderParams returns the all headers currently set for the request -func (r *request) GetHeaderParams() http.Header { - return r.header -} - -// SetQueryParam adds a query param to the request -// when there is only 1 value provided for the varargs, it will set it. -// when there are several values provided for the varargs it will add it (no overriding) -func (r *request) SetQueryParam(name string, values ...string) error { - if r.query == nil { - r.query = make(url.Values) - } - r.query[name] = values - return nil -} - -// GetQueryParams returns a copy of all query params currently set for the request -func (r *request) GetQueryParams() url.Values { - var result = make(url.Values) - for key, value := range r.query { - result[key] = append([]string{}, value...) - } - return result -} - -// SetFormParam adds a forn param to the request -// when there is only 1 value provided for the varargs, it will set it. -// when there are several values provided for the varargs it will add it (no overriding) -func (r *request) SetFormParam(name string, values ...string) error { - if r.formFields == nil { - r.formFields = make(url.Values) - } - r.formFields[name] = values - return nil -} - -// SetPathParam adds a path param to the request -func (r *request) SetPathParam(name string, value string) error { - if r.pathParams == nil { - r.pathParams = make(map[string]string) - } - - r.pathParams[name] = value - return nil -} - -// SetFileParam adds a file param to the request -func (r *request) SetFileParam(name string, files ...runtime.NamedReadCloser) error { - for _, file := range files { - if actualFile, ok := file.(*os.File); ok { - fi, err := os.Stat(actualFile.Name()) - if err != nil { - return err - } - if fi.IsDir() { - return fmt.Errorf("%q is a directory, only files are supported", file.Name()) - } - } - } - - if r.fileFields == nil { - r.fileFields = make(map[string][]runtime.NamedReadCloser) - } - if r.formFields == nil { - r.formFields = make(url.Values) - } - - r.fileFields[name] = files - return nil -} - -func (r *request) GetFileParam() map[string][]runtime.NamedReadCloser { - return r.fileFields -} - -// SetBodyParam sets a body parameter on the request. -// This does not yet serialze the object, this happens as late as possible. -func (r *request) SetBodyParam(payload interface{}) error { - r.payload = payload - return nil -} - -func (r *request) GetBodyParam() interface{} { - return r.payload -} - -// SetTimeout sets the timeout for a request -func (r *request) SetTimeout(timeout time.Duration) error { - r.timeout = timeout - return nil -} diff --git a/vendor/github.com/go-openapi/runtime/client/response.go b/vendor/github.com/go-openapi/runtime/client/response.go deleted file mode 100644 index 0bbd388bc..000000000 --- a/vendor/github.com/go-openapi/runtime/client/response.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 client - -import ( - "io" - "net/http" - - "github.com/go-openapi/runtime" -) - -var _ runtime.ClientResponse = response{} - -func newResponse(resp *http.Response) runtime.ClientResponse { return response{resp: resp} } - -type response struct { - resp *http.Response -} - -func (r response) Code() int { - return r.resp.StatusCode -} - -func (r response) Message() string { - return r.resp.Status -} - -func (r response) GetHeader(name string) string { - return r.resp.Header.Get(name) -} - -func (r response) GetHeaders(name string) []string { - return r.resp.Header.Values(name) -} - -func (r response) Body() io.ReadCloser { - return r.resp.Body -} diff --git a/vendor/github.com/go-openapi/runtime/client/runtime.go b/vendor/github.com/go-openapi/runtime/client/runtime.go deleted file mode 100644 index 5bd4d75d9..000000000 --- a/vendor/github.com/go-openapi/runtime/client/runtime.go +++ /dev/null @@ -1,552 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 client - -import ( - "context" - "crypto" - "crypto/ecdsa" - "crypto/rsa" - "crypto/tls" - "crypto/x509" - "encoding/pem" - "errors" - "fmt" - "mime" - "net/http" - "net/http/httputil" - "os" - "strings" - "sync" - "time" - - "github.com/go-openapi/strfmt" - "github.com/opentracing/opentracing-go" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/logger" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/runtime/yamlpc" -) - -const ( - schemeHTTP = "http" - schemeHTTPS = "https" -) - -// TLSClientOptions to configure client authentication with mutual TLS -type TLSClientOptions struct { - // Certificate is the path to a PEM-encoded certificate to be used for - // client authentication. If set then Key must also be set. - Certificate string - - // LoadedCertificate is the certificate to be used for client authentication. - // This field is ignored if Certificate is set. If this field is set, LoadedKey - // is also required. - LoadedCertificate *x509.Certificate - - // Key is the path to an unencrypted PEM-encoded private key for client - // authentication. This field is required if Certificate is set. - Key string - - // LoadedKey is the key for client authentication. This field is required if - // LoadedCertificate is set. - LoadedKey crypto.PrivateKey - - // CA is a path to a PEM-encoded certificate that specifies the root certificate - // to use when validating the TLS certificate presented by the server. If this field - // (and LoadedCA) is not set, the system certificate pool is used. This field is ignored if LoadedCA - // is set. - CA string - - // LoadedCA specifies the root certificate to use when validating the server's TLS certificate. - // If this field (and CA) is not set, the system certificate pool is used. - LoadedCA *x509.Certificate - - // LoadedCAPool specifies a pool of RootCAs to use when validating the server's TLS certificate. - // If set, it will be combined with the other loaded certificates (see LoadedCA and CA). - // If neither LoadedCA or CA is set, the provided pool with override the system - // certificate pool. - // The caller must not use the supplied pool after calling TLSClientAuth. - LoadedCAPool *x509.CertPool - - // ServerName specifies the hostname to use when verifying the server certificate. - // If this field is set then InsecureSkipVerify will be ignored and treated as - // false. - ServerName string - - // InsecureSkipVerify controls whether the certificate chain and hostname presented - // by the server are validated. If true, any certificate is accepted. - InsecureSkipVerify bool - - // VerifyPeerCertificate, if not nil, is called after normal - // certificate verification. It receives the raw ASN.1 certificates - // provided by the peer and also any verified chains that normal processing found. - // If it returns a non-nil error, the handshake is aborted and that error results. - // - // If normal verification fails then the handshake will abort before - // considering this callback. If normal verification is disabled by - // setting InsecureSkipVerify then this callback will be considered but - // the verifiedChains argument will always be nil. - VerifyPeerCertificate func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error - - // SessionTicketsDisabled may be set to true to disable session ticket and - // PSK (resumption) support. Note that on clients, session ticket support is - // also disabled if ClientSessionCache is nil. - SessionTicketsDisabled bool - - // ClientSessionCache is a cache of ClientSessionState entries for TLS - // session resumption. It is only used by clients. - ClientSessionCache tls.ClientSessionCache - - // Prevents callers using unkeyed fields. - _ struct{} -} - -// TLSClientAuth creates a tls.Config for mutual auth -func TLSClientAuth(opts TLSClientOptions) (*tls.Config, error) { - // create client tls config - cfg := &tls.Config{ - MinVersion: tls.VersionTLS12, - } - - // load client cert if specified - if opts.Certificate != "" { - cert, err := tls.LoadX509KeyPair(opts.Certificate, opts.Key) - if err != nil { - return nil, fmt.Errorf("tls client cert: %v", err) - } - cfg.Certificates = []tls.Certificate{cert} - } else if opts.LoadedCertificate != nil { - block := pem.Block{Type: "CERTIFICATE", Bytes: opts.LoadedCertificate.Raw} - certPem := pem.EncodeToMemory(&block) - - var keyBytes []byte - switch k := opts.LoadedKey.(type) { - case *rsa.PrivateKey: - keyBytes = x509.MarshalPKCS1PrivateKey(k) - case *ecdsa.PrivateKey: - var err error - keyBytes, err = x509.MarshalECPrivateKey(k) - if err != nil { - return nil, fmt.Errorf("tls client priv key: %v", err) - } - default: - return nil, errors.New("tls client priv key: unsupported key type") - } - - block = pem.Block{Type: "PRIVATE KEY", Bytes: keyBytes} - keyPem := pem.EncodeToMemory(&block) - - cert, err := tls.X509KeyPair(certPem, keyPem) - if err != nil { - return nil, fmt.Errorf("tls client cert: %v", err) - } - cfg.Certificates = []tls.Certificate{cert} - } - - cfg.InsecureSkipVerify = opts.InsecureSkipVerify - - cfg.VerifyPeerCertificate = opts.VerifyPeerCertificate - cfg.SessionTicketsDisabled = opts.SessionTicketsDisabled - cfg.ClientSessionCache = opts.ClientSessionCache - - // When no CA certificate is provided, default to the system cert pool - // that way when a request is made to a server known by the system trust store, - // the name is still verified - switch { - case opts.LoadedCA != nil: - caCertPool := basePool(opts.LoadedCAPool) - caCertPool.AddCert(opts.LoadedCA) - cfg.RootCAs = caCertPool - case opts.CA != "": - // load ca cert - caCert, err := os.ReadFile(opts.CA) - if err != nil { - return nil, fmt.Errorf("tls client ca: %v", err) - } - caCertPool := basePool(opts.LoadedCAPool) - caCertPool.AppendCertsFromPEM(caCert) - cfg.RootCAs = caCertPool - case opts.LoadedCAPool != nil: - cfg.RootCAs = opts.LoadedCAPool - } - - // apply servername overrride - if opts.ServerName != "" { - cfg.InsecureSkipVerify = false - cfg.ServerName = opts.ServerName - } - - return cfg, nil -} - -func basePool(pool *x509.CertPool) *x509.CertPool { - if pool == nil { - return x509.NewCertPool() - } - return pool -} - -// TLSTransport creates a http client transport suitable for mutual tls auth -func TLSTransport(opts TLSClientOptions) (http.RoundTripper, error) { - cfg, err := TLSClientAuth(opts) - if err != nil { - return nil, err - } - - return &http.Transport{TLSClientConfig: cfg}, nil -} - -// TLSClient creates a http.Client for mutual auth -func TLSClient(opts TLSClientOptions) (*http.Client, error) { - transport, err := TLSTransport(opts) - if err != nil { - return nil, err - } - return &http.Client{Transport: transport}, nil -} - -// DefaultTimeout the default request timeout -var DefaultTimeout = 30 * time.Second - -// Runtime represents an API client that uses the transport -// to make http requests based on a swagger specification. -type Runtime struct { - DefaultMediaType string - DefaultAuthentication runtime.ClientAuthInfoWriter - Consumers map[string]runtime.Consumer - Producers map[string]runtime.Producer - - Transport http.RoundTripper - Jar http.CookieJar - // Spec *spec.Document - Host string - BasePath string - Formats strfmt.Registry - Context context.Context //nolint:containedctx // we precisely want this type to contain the request context - - Debug bool - logger logger.Logger - - clientOnce *sync.Once - client *http.Client - schemes []string - response ClientResponseFunc -} - -// New creates a new default runtime for a swagger api runtime.Client -func New(host, basePath string, schemes []string) *Runtime { - var rt Runtime - rt.DefaultMediaType = runtime.JSONMime - - // TODO: actually infer this stuff from the spec - rt.Consumers = map[string]runtime.Consumer{ - runtime.YAMLMime: yamlpc.YAMLConsumer(), - runtime.JSONMime: runtime.JSONConsumer(), - runtime.XMLMime: runtime.XMLConsumer(), - runtime.TextMime: runtime.TextConsumer(), - runtime.HTMLMime: runtime.TextConsumer(), - runtime.CSVMime: runtime.CSVConsumer(), - runtime.DefaultMime: runtime.ByteStreamConsumer(), - } - rt.Producers = map[string]runtime.Producer{ - runtime.YAMLMime: yamlpc.YAMLProducer(), - runtime.JSONMime: runtime.JSONProducer(), - runtime.XMLMime: runtime.XMLProducer(), - runtime.TextMime: runtime.TextProducer(), - runtime.HTMLMime: runtime.TextProducer(), - runtime.CSVMime: runtime.CSVProducer(), - runtime.DefaultMime: runtime.ByteStreamProducer(), - } - rt.Transport = http.DefaultTransport - rt.Jar = nil - rt.Host = host - rt.BasePath = basePath - rt.Context = context.Background() - rt.clientOnce = new(sync.Once) - if !strings.HasPrefix(rt.BasePath, "/") { - rt.BasePath = "/" + rt.BasePath - } - - rt.Debug = logger.DebugEnabled() - rt.logger = logger.StandardLogger{} - rt.response = newResponse - - if len(schemes) > 0 { - rt.schemes = schemes - } - return &rt -} - -// NewWithClient allows you to create a new transport with a configured http.Client -func NewWithClient(host, basePath string, schemes []string, client *http.Client) *Runtime { - rt := New(host, basePath, schemes) - if client != nil { - rt.clientOnce.Do(func() { - rt.client = client - }) - } - return rt -} - -// WithOpenTracing adds opentracing support to the provided runtime. -// A new client span is created for each request. -// If the context of the client operation does not contain an active span, no span is created. -// The provided opts are applied to each spans - for example to add global tags. -func (r *Runtime) WithOpenTracing(opts ...opentracing.StartSpanOption) runtime.ClientTransport { - return newOpenTracingTransport(r, r.Host, opts) -} - -// WithOpenTelemetry adds opentelemetry support to the provided runtime. -// A new client span is created for each request. -// If the context of the client operation does not contain an active span, no span is created. -// The provided opts are applied to each spans - for example to add global tags. -func (r *Runtime) WithOpenTelemetry(opts ...OpenTelemetryOpt) runtime.ClientTransport { - return newOpenTelemetryTransport(r, r.Host, opts) -} - -func (r *Runtime) pickScheme(schemes []string) string { - if v := r.selectScheme(r.schemes); v != "" { - return v - } - if v := r.selectScheme(schemes); v != "" { - return v - } - return schemeHTTP -} - -func (r *Runtime) selectScheme(schemes []string) string { - schLen := len(schemes) - if schLen == 0 { - return "" - } - - scheme := schemes[0] - // prefer https, but skip when not possible - if scheme != schemeHTTPS && schLen > 1 { - for _, sch := range schemes { - if sch == schemeHTTPS { - scheme = sch - break - } - } - } - return scheme -} - -func transportOrDefault(left, right http.RoundTripper) http.RoundTripper { - if left == nil { - return right - } - return left -} - -// EnableConnectionReuse drains the remaining body from a response -// so that go will reuse the TCP connections. -// -// This is not enabled by default because there are servers where -// the response never gets closed and that would make the code hang forever. -// So instead it's provided as a http client middleware that can be used to override -// any request. -func (r *Runtime) EnableConnectionReuse() { - if r.client == nil { - r.Transport = KeepAliveTransport( - transportOrDefault(r.Transport, http.DefaultTransport), - ) - return - } - - r.client.Transport = KeepAliveTransport( - transportOrDefault(r.client.Transport, - transportOrDefault(r.Transport, http.DefaultTransport), - ), - ) -} - -// takes a client operation and creates equivalent http.Request -func (r *Runtime) createHttpRequest(operation *runtime.ClientOperation) (*request, *http.Request, error) { //nolint:revive,stylecheck - params, _, auth := operation.Params, operation.Reader, operation.AuthInfo - - request := newRequest(operation.Method, operation.PathPattern, params) - - var accept []string - accept = append(accept, operation.ProducesMediaTypes...) - if err := request.SetHeaderParam(runtime.HeaderAccept, accept...); err != nil { - return nil, nil, err - } - - if auth == nil && r.DefaultAuthentication != nil { - auth = runtime.ClientAuthInfoWriterFunc(func(req runtime.ClientRequest, reg strfmt.Registry) error { - if req.GetHeaderParams().Get(runtime.HeaderAuthorization) != "" { - return nil - } - return r.DefaultAuthentication.AuthenticateRequest(req, reg) - }) - } - // if auth != nil { - // if err := auth.AuthenticateRequest(request, r.Formats); err != nil { - // return nil, err - // } - //} - - // TODO: pick appropriate media type - cmt := r.DefaultMediaType - for _, mediaType := range operation.ConsumesMediaTypes { - // Pick first non-empty media type - if mediaType != "" { - cmt = mediaType - break - } - } - - if _, ok := r.Producers[cmt]; !ok && cmt != runtime.MultipartFormMime && cmt != runtime.URLencodedFormMime { - return nil, nil, fmt.Errorf("none of producers: %v registered. try %s", r.Producers, cmt) - } - - req, err := request.buildHTTP(cmt, r.BasePath, r.Producers, r.Formats, auth) - if err != nil { - return nil, nil, err - } - req.URL.Scheme = r.pickScheme(operation.Schemes) - req.URL.Host = r.Host - req.Host = r.Host - return request, req, nil -} - -func (r *Runtime) CreateHttpRequest(operation *runtime.ClientOperation) (req *http.Request, err error) { //nolint:revive,stylecheck - _, req, err = r.createHttpRequest(operation) - return -} - -// Submit a request and when there is a body on success it will turn that into the result -// all other things are turned into an api error for swagger which retains the status code -func (r *Runtime) Submit(operation *runtime.ClientOperation) (interface{}, error) { - _, readResponse, _ := operation.Params, operation.Reader, operation.AuthInfo - - request, req, err := r.createHttpRequest(operation) - if err != nil { - return nil, err - } - - r.clientOnce.Do(func() { - r.client = &http.Client{ - Transport: r.Transport, - Jar: r.Jar, - } - }) - - if r.Debug { - b, err2 := httputil.DumpRequestOut(req, true) - if err2 != nil { - return nil, err2 - } - r.logger.Debugf("%s\n", string(b)) - } - - var parentCtx context.Context - switch { - case operation.Context != nil: - parentCtx = operation.Context - case r.Context != nil: - parentCtx = r.Context - default: - parentCtx = context.Background() - } - - var ( - ctx context.Context - cancel context.CancelFunc - ) - if request.timeout == 0 { - // There may be a deadline in the context passed to the operation. - // Otherwise, there is no timeout set. - ctx, cancel = context.WithCancel(parentCtx) - } else { - // Sets the timeout passed from request params (by default runtime.DefaultTimeout). - // If there is already a deadline in the parent context, the shortest will - // apply. - ctx, cancel = context.WithTimeout(parentCtx, request.timeout) - } - defer cancel() - - var client *http.Client - if operation.Client != nil { - client = operation.Client - } else { - client = r.client - } - req = req.WithContext(ctx) - res, err := client.Do(req) // make requests, by default follows 10 redirects before failing - if err != nil { - return nil, err - } - defer res.Body.Close() - - ct := res.Header.Get(runtime.HeaderContentType) - if ct == "" { // this should really never occur - ct = r.DefaultMediaType - } - - if r.Debug { - printBody := true - if ct == runtime.DefaultMime { - printBody = false // Spare the terminal from a binary blob. - } - b, err2 := httputil.DumpResponse(res, printBody) - if err2 != nil { - return nil, err2 - } - r.logger.Debugf("%s\n", string(b)) - } - - mt, _, err := mime.ParseMediaType(ct) - if err != nil { - return nil, fmt.Errorf("parse content type: %s", err) - } - - cons, ok := r.Consumers[mt] - if !ok { - if cons, ok = r.Consumers["*/*"]; !ok { - // scream about not knowing what to do - return nil, fmt.Errorf("no consumer: %q", ct) - } - } - return readResponse.ReadResponse(r.response(res), cons) -} - -// SetDebug changes the debug flag. -// It ensures that client and middlewares have the set debug level. -func (r *Runtime) SetDebug(debug bool) { - r.Debug = debug - middleware.Debug = debug -} - -// SetLogger changes the logger stream. -// It ensures that client and middlewares use the same logger. -func (r *Runtime) SetLogger(logger logger.Logger) { - r.logger = logger - middleware.Logger = logger -} - -type ClientResponseFunc = func(*http.Response) runtime.ClientResponse //nolint:revive - -// SetResponseReader changes the response reader implementation. -func (r *Runtime) SetResponseReader(f ClientResponseFunc) { - if f == nil { - return - } - r.response = f -} diff --git a/vendor/github.com/go-openapi/runtime/client_auth_info.go b/vendor/github.com/go-openapi/runtime/client_auth_info.go deleted file mode 100644 index c6c97d9a7..000000000 --- a/vendor/github.com/go-openapi/runtime/client_auth_info.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 runtime - -import "github.com/go-openapi/strfmt" - -// A ClientAuthInfoWriterFunc converts a function to a request writer interface -type ClientAuthInfoWriterFunc func(ClientRequest, strfmt.Registry) error - -// AuthenticateRequest adds authentication data to the request -func (fn ClientAuthInfoWriterFunc) AuthenticateRequest(req ClientRequest, reg strfmt.Registry) error { - return fn(req, reg) -} - -// A ClientAuthInfoWriter implementor knows how to write authentication info to a request -type ClientAuthInfoWriter interface { - AuthenticateRequest(ClientRequest, strfmt.Registry) error -} diff --git a/vendor/github.com/go-openapi/runtime/client_operation.go b/vendor/github.com/go-openapi/runtime/client_operation.go deleted file mode 100644 index 5a5d63563..000000000 --- a/vendor/github.com/go-openapi/runtime/client_operation.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 runtime - -import ( - "context" - "net/http" -) - -// ClientOperation represents the context for a swagger operation to be submitted to the transport -type ClientOperation struct { - ID string - Method string - PathPattern string - ProducesMediaTypes []string - ConsumesMediaTypes []string - Schemes []string - AuthInfo ClientAuthInfoWriter - Params ClientRequestWriter - Reader ClientResponseReader - Context context.Context //nolint:containedctx // we precisely want this type to contain the request context - Client *http.Client -} - -// A ClientTransport implementor knows how to submit Request objects to some destination -type ClientTransport interface { - // Submit(string, RequestWriter, ResponseReader, AuthInfoWriter) (interface{}, error) - Submit(*ClientOperation) (interface{}, error) -} diff --git a/vendor/github.com/go-openapi/runtime/client_request.go b/vendor/github.com/go-openapi/runtime/client_request.go deleted file mode 100644 index 4ebb2deab..000000000 --- a/vendor/github.com/go-openapi/runtime/client_request.go +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 runtime - -import ( - "io" - "net/http" - "net/url" - "time" - - "github.com/go-openapi/strfmt" -) - -// ClientRequestWriterFunc converts a function to a request writer interface -type ClientRequestWriterFunc func(ClientRequest, strfmt.Registry) error - -// WriteToRequest adds data to the request -func (fn ClientRequestWriterFunc) WriteToRequest(req ClientRequest, reg strfmt.Registry) error { - return fn(req, reg) -} - -// ClientRequestWriter is an interface for things that know how to write to a request -type ClientRequestWriter interface { - WriteToRequest(ClientRequest, strfmt.Registry) error -} - -// ClientRequest is an interface for things that know how to -// add information to a swagger client request. -type ClientRequest interface { //nolint:interfacebloat // a swagger-capable request is quite rich, hence the many getter/setters - SetHeaderParam(string, ...string) error - - GetHeaderParams() http.Header - - SetQueryParam(string, ...string) error - - SetFormParam(string, ...string) error - - SetPathParam(string, string) error - - GetQueryParams() url.Values - - SetFileParam(string, ...NamedReadCloser) error - - SetBodyParam(interface{}) error - - SetTimeout(time.Duration) error - - GetMethod() string - - GetPath() string - - GetBody() []byte - - GetBodyParam() interface{} - - GetFileParam() map[string][]NamedReadCloser -} - -// NamedReadCloser represents a named ReadCloser interface -type NamedReadCloser interface { - io.ReadCloser - Name() string -} - -// NamedReader creates a NamedReadCloser for use as file upload -func NamedReader(name string, rdr io.Reader) NamedReadCloser { - rc, ok := rdr.(io.ReadCloser) - if !ok { - rc = io.NopCloser(rdr) - } - return &namedReadCloser{ - name: name, - cr: rc, - } -} - -type namedReadCloser struct { - name string - cr io.ReadCloser -} - -func (n *namedReadCloser) Close() error { - return n.cr.Close() -} -func (n *namedReadCloser) Read(p []byte) (int, error) { - return n.cr.Read(p) -} -func (n *namedReadCloser) Name() string { - return n.name -} - -type TestClientRequest struct { - Headers http.Header - Body interface{} -} - -func (t *TestClientRequest) SetHeaderParam(name string, values ...string) error { - if t.Headers == nil { - t.Headers = make(http.Header) - } - t.Headers.Set(name, values[0]) - return nil -} - -func (t *TestClientRequest) SetQueryParam(_ string, _ ...string) error { return nil } - -func (t *TestClientRequest) SetFormParam(_ string, _ ...string) error { return nil } - -func (t *TestClientRequest) SetPathParam(_ string, _ string) error { return nil } - -func (t *TestClientRequest) SetFileParam(_ string, _ ...NamedReadCloser) error { return nil } - -func (t *TestClientRequest) SetBodyParam(body interface{}) error { - t.Body = body - return nil -} - -func (t *TestClientRequest) SetTimeout(time.Duration) error { - return nil -} - -func (t *TestClientRequest) GetQueryParams() url.Values { return nil } - -func (t *TestClientRequest) GetMethod() string { return "" } - -func (t *TestClientRequest) GetPath() string { return "" } - -func (t *TestClientRequest) GetBody() []byte { return nil } - -func (t *TestClientRequest) GetBodyParam() interface{} { - return t.Body -} - -func (t *TestClientRequest) GetFileParam() map[string][]NamedReadCloser { - return nil -} - -func (t *TestClientRequest) GetHeaderParams() http.Header { - return t.Headers -} diff --git a/vendor/github.com/go-openapi/runtime/client_response.go b/vendor/github.com/go-openapi/runtime/client_response.go deleted file mode 100644 index 0d1691149..000000000 --- a/vendor/github.com/go-openapi/runtime/client_response.go +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 runtime - -import ( - "encoding/json" - "fmt" - "io" -) - -// A ClientResponse represents a client response -// This bridges between responses obtained from different transports -type ClientResponse interface { - Code() int - Message() string - GetHeader(string) string - GetHeaders(string) []string - Body() io.ReadCloser -} - -// A ClientResponseReaderFunc turns a function into a ClientResponseReader interface implementation -type ClientResponseReaderFunc func(ClientResponse, Consumer) (interface{}, error) - -// ReadResponse reads the response -func (read ClientResponseReaderFunc) ReadResponse(resp ClientResponse, consumer Consumer) (interface{}, error) { - return read(resp, consumer) -} - -// A ClientResponseReader is an interface for things want to read a response. -// An application of this is to create structs from response values -type ClientResponseReader interface { - ReadResponse(ClientResponse, Consumer) (interface{}, error) -} - -// NewAPIError creates a new API error -func NewAPIError(opName string, payload interface{}, code int) *APIError { - return &APIError{ - OperationName: opName, - Response: payload, - Code: code, - } -} - -// APIError wraps an error model and captures the status code -type APIError struct { - OperationName string - Response interface{} - Code int -} - -func (o *APIError) Error() string { - var resp []byte - if err, ok := o.Response.(error); ok { - resp = []byte("'" + err.Error() + "'") - } else { - resp, _ = json.Marshal(o.Response) - } - return fmt.Sprintf("%s (status %d): %s", o.OperationName, o.Code, resp) -} - -func (o *APIError) String() string { - return o.Error() -} - -// IsSuccess returns true when this elapse o k response returns a 2xx status code -func (o *APIError) IsSuccess() bool { - return o.Code/100 == 2 -} - -// IsRedirect returns true when this elapse o k response returns a 3xx status code -func (o *APIError) IsRedirect() bool { - return o.Code/100 == 3 -} - -// IsClientError returns true when this elapse o k response returns a 4xx status code -func (o *APIError) IsClientError() bool { - return o.Code/100 == 4 -} - -// IsServerError returns true when this elapse o k response returns a 5xx status code -func (o *APIError) IsServerError() bool { - return o.Code/100 == 5 -} - -// IsCode returns true when this elapse o k response returns a 4xx status code -func (o *APIError) IsCode(code int) bool { - return o.Code == code -} - -// A ClientResponseStatus is a common interface implemented by all responses on the generated code -// You can use this to treat any client response based on status code -type ClientResponseStatus interface { - IsSuccess() bool - IsRedirect() bool - IsClientError() bool - IsServerError() bool - IsCode(int) bool -} diff --git a/vendor/github.com/go-openapi/runtime/constants.go b/vendor/github.com/go-openapi/runtime/constants.go deleted file mode 100644 index 515969242..000000000 --- a/vendor/github.com/go-openapi/runtime/constants.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 runtime - -const ( - // HeaderContentType represents a http content-type header, it's value is supposed to be a mime type - HeaderContentType = "Content-Type" - - // HeaderTransferEncoding represents a http transfer-encoding header. - HeaderTransferEncoding = "Transfer-Encoding" - - // HeaderAccept the Accept header - HeaderAccept = "Accept" - // HeaderAuthorization the Authorization header - HeaderAuthorization = "Authorization" - - charsetKey = "charset" - - // DefaultMime the default fallback mime type - DefaultMime = "application/octet-stream" - // JSONMime the json mime type - JSONMime = "application/json" - // YAMLMime the yaml mime type - YAMLMime = "application/x-yaml" - // XMLMime the xml mime type - XMLMime = "application/xml" - // TextMime the text mime type - TextMime = "text/plain" - // HTMLMime the html mime type - HTMLMime = "text/html" - // CSVMime the csv mime type - CSVMime = "text/csv" - // MultipartFormMime the multipart form mime type - MultipartFormMime = "multipart/form-data" - // URLencodedFormMime the url encoded form mime type - URLencodedFormMime = "application/x-www-form-urlencoded" -) diff --git a/vendor/github.com/go-openapi/runtime/csv.go b/vendor/github.com/go-openapi/runtime/csv.go deleted file mode 100644 index c9597bcd6..000000000 --- a/vendor/github.com/go-openapi/runtime/csv.go +++ /dev/null @@ -1,350 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 runtime - -import ( - "bytes" - "context" - "encoding" - "encoding/csv" - "errors" - "fmt" - "io" - "reflect" - - "golang.org/x/sync/errgroup" -) - -// CSVConsumer creates a new CSV consumer. -// -// The consumer consumes CSV records from a provided reader into the data passed by reference. -// -// CSVOpts options may be specified to alter the default CSV behavior on the reader and the writer side (e.g. separator, skip header, ...). -// The defaults are those of the standard library's csv.Reader and csv.Writer. -// -// Supported output underlying types and interfaces, prioritized in this order: -// - *csv.Writer -// - CSVWriter (writer options are ignored) -// - io.Writer (as raw bytes) -// - io.ReaderFrom (as raw bytes) -// - encoding.BinaryUnmarshaler (as raw bytes) -// - *[][]string (as a collection of records) -// - *[]byte (as raw bytes) -// - *string (a raw bytes) -// -// The consumer prioritizes situations where buffering the input is not required. -func CSVConsumer(opts ...CSVOpt) Consumer { - o := csvOptsWithDefaults(opts) - - return ConsumerFunc(func(reader io.Reader, data interface{}) error { - if reader == nil { - return errors.New("CSVConsumer requires a reader") - } - if data == nil { - return errors.New("nil destination for CSVConsumer") - } - - csvReader := csv.NewReader(reader) - o.applyToReader(csvReader) - closer := defaultCloser - if o.closeStream { - if cl, isReaderCloser := reader.(io.Closer); isReaderCloser { - closer = cl.Close - } - } - defer func() { - _ = closer() - }() - - switch destination := data.(type) { - case *csv.Writer: - csvWriter := destination - o.applyToWriter(csvWriter) - - return pipeCSV(csvWriter, csvReader, o) - - case CSVWriter: - csvWriter := destination - // no writer options available - - return pipeCSV(csvWriter, csvReader, o) - - case io.Writer: - csvWriter := csv.NewWriter(destination) - o.applyToWriter(csvWriter) - - return pipeCSV(csvWriter, csvReader, o) - - case io.ReaderFrom: - var buf bytes.Buffer - csvWriter := csv.NewWriter(&buf) - o.applyToWriter(csvWriter) - if err := bufferedCSV(csvWriter, csvReader, o); err != nil { - return err - } - _, err := destination.ReadFrom(&buf) - - return err - - case encoding.BinaryUnmarshaler: - var buf bytes.Buffer - csvWriter := csv.NewWriter(&buf) - o.applyToWriter(csvWriter) - if err := bufferedCSV(csvWriter, csvReader, o); err != nil { - return err - } - - return destination.UnmarshalBinary(buf.Bytes()) - - default: - // support *[][]string, *[]byte, *string - if ptr := reflect.TypeOf(data); ptr.Kind() != reflect.Ptr { - return errors.New("destination must be a pointer") - } - - v := reflect.Indirect(reflect.ValueOf(data)) - t := v.Type() - - switch { - case t.Kind() == reflect.Slice && t.Elem().Kind() == reflect.Slice && t.Elem().Elem().Kind() == reflect.String: - csvWriter := &csvRecordsWriter{} - // writer options are ignored - if err := pipeCSV(csvWriter, csvReader, o); err != nil { - return err - } - - v.Grow(len(csvWriter.records)) - v.SetCap(len(csvWriter.records)) // in case Grow was unnessary, trim down the capacity - v.SetLen(len(csvWriter.records)) - reflect.Copy(v, reflect.ValueOf(csvWriter.records)) - - return nil - - case t.Kind() == reflect.Slice && t.Elem().Kind() == reflect.Uint8: - var buf bytes.Buffer - csvWriter := csv.NewWriter(&buf) - o.applyToWriter(csvWriter) - if err := bufferedCSV(csvWriter, csvReader, o); err != nil { - return err - } - v.SetBytes(buf.Bytes()) - - return nil - - case t.Kind() == reflect.String: - var buf bytes.Buffer - csvWriter := csv.NewWriter(&buf) - o.applyToWriter(csvWriter) - if err := bufferedCSV(csvWriter, csvReader, o); err != nil { - return err - } - v.SetString(buf.String()) - - return nil - - default: - return fmt.Errorf("%v (%T) is not supported by the CSVConsumer, %s", - data, data, "can be resolved by supporting CSVWriter/Writer/BinaryUnmarshaler interface", - ) - } - } - }) -} - -// CSVProducer creates a new CSV producer. -// -// The producer takes input data then writes as CSV to an output writer (essentially as a pipe). -// -// Supported input underlying types and interfaces, prioritized in this order: -// - *csv.Reader -// - CSVReader (reader options are ignored) -// - io.Reader -// - io.WriterTo -// - encoding.BinaryMarshaler -// - [][]string -// - []byte -// - string -// -// The producer prioritizes situations where buffering the input is not required. -func CSVProducer(opts ...CSVOpt) Producer { - o := csvOptsWithDefaults(opts) - - return ProducerFunc(func(writer io.Writer, data interface{}) error { - if writer == nil { - return errors.New("CSVProducer requires a writer") - } - if data == nil { - return errors.New("nil data for CSVProducer") - } - - csvWriter := csv.NewWriter(writer) - o.applyToWriter(csvWriter) - closer := defaultCloser - if o.closeStream { - if cl, isWriterCloser := writer.(io.Closer); isWriterCloser { - closer = cl.Close - } - } - defer func() { - _ = closer() - }() - - if rc, isDataCloser := data.(io.ReadCloser); isDataCloser { - defer rc.Close() - } - - switch origin := data.(type) { - case *csv.Reader: - csvReader := origin - o.applyToReader(csvReader) - - return pipeCSV(csvWriter, csvReader, o) - - case CSVReader: - csvReader := origin - // no reader options available - - return pipeCSV(csvWriter, csvReader, o) - - case io.Reader: - csvReader := csv.NewReader(origin) - o.applyToReader(csvReader) - - return pipeCSV(csvWriter, csvReader, o) - - case io.WriterTo: - // async piping of the writes performed by WriteTo - r, w := io.Pipe() - csvReader := csv.NewReader(r) - o.applyToReader(csvReader) - - pipe, _ := errgroup.WithContext(context.Background()) - pipe.Go(func() error { - _, err := origin.WriteTo(w) - _ = w.Close() - return err - }) - - pipe.Go(func() error { - defer func() { - _ = r.Close() - }() - - return pipeCSV(csvWriter, csvReader, o) - }) - - return pipe.Wait() - - case encoding.BinaryMarshaler: - buf, err := origin.MarshalBinary() - if err != nil { - return err - } - rdr := bytes.NewBuffer(buf) - csvReader := csv.NewReader(rdr) - - return bufferedCSV(csvWriter, csvReader, o) - - default: - // support [][]string, []byte, string (or pointers to those) - v := reflect.Indirect(reflect.ValueOf(data)) - t := v.Type() - - switch { - case t.Kind() == reflect.Slice && t.Elem().Kind() == reflect.Slice && t.Elem().Elem().Kind() == reflect.String: - csvReader := &csvRecordsWriter{ - records: make([][]string, v.Len()), - } - reflect.Copy(reflect.ValueOf(csvReader.records), v) - - return pipeCSV(csvWriter, csvReader, o) - - case t.Kind() == reflect.Slice && t.Elem().Kind() == reflect.Uint8: - buf := bytes.NewBuffer(v.Bytes()) - csvReader := csv.NewReader(buf) - o.applyToReader(csvReader) - - return bufferedCSV(csvWriter, csvReader, o) - - case t.Kind() == reflect.String: - buf := bytes.NewBufferString(v.String()) - csvReader := csv.NewReader(buf) - o.applyToReader(csvReader) - - return bufferedCSV(csvWriter, csvReader, o) - - default: - return fmt.Errorf("%v (%T) is not supported by the CSVProducer, %s", - data, data, "can be resolved by supporting CSVReader/Reader/BinaryMarshaler interface", - ) - } - } - }) -} - -// pipeCSV copies CSV records from a CSV reader to a CSV writer -func pipeCSV(csvWriter CSVWriter, csvReader CSVReader, opts csvOpts) error { - for ; opts.skippedLines > 0; opts.skippedLines-- { - _, err := csvReader.Read() - if err != nil { - if errors.Is(err, io.EOF) { - return nil - } - - return err - } - } - - for { - record, err := csvReader.Read() - if err != nil { - if errors.Is(err, io.EOF) { - break - } - - return err - } - - if err := csvWriter.Write(record); err != nil { - return err - } - } - - csvWriter.Flush() - - return csvWriter.Error() -} - -// bufferedCSV copies CSV records from a CSV reader to a CSV writer, -// by first reading all records then writing them at once. -func bufferedCSV(csvWriter *csv.Writer, csvReader *csv.Reader, opts csvOpts) error { - for ; opts.skippedLines > 0; opts.skippedLines-- { - _, err := csvReader.Read() - if err != nil { - if errors.Is(err, io.EOF) { - return nil - } - - return err - } - } - - records, err := csvReader.ReadAll() - if err != nil { - return err - } - - return csvWriter.WriteAll(records) -} diff --git a/vendor/github.com/go-openapi/runtime/csv_options.go b/vendor/github.com/go-openapi/runtime/csv_options.go deleted file mode 100644 index c16464c57..000000000 --- a/vendor/github.com/go-openapi/runtime/csv_options.go +++ /dev/null @@ -1,121 +0,0 @@ -package runtime - -import ( - "encoding/csv" - "io" -) - -// CSVOpts alter the behavior of the CSV consumer or producer. -type CSVOpt func(*csvOpts) - -type csvOpts struct { - csvReader csv.Reader - csvWriter csv.Writer - skippedLines int - closeStream bool -} - -// WithCSVReaderOpts specifies the options to csv.Reader -// when reading CSV. -func WithCSVReaderOpts(reader csv.Reader) CSVOpt { - return func(o *csvOpts) { - o.csvReader = reader - } -} - -// WithCSVWriterOpts specifies the options to csv.Writer -// when writing CSV. -func WithCSVWriterOpts(writer csv.Writer) CSVOpt { - return func(o *csvOpts) { - o.csvWriter = writer - } -} - -// WithCSVSkipLines will skip header lines. -func WithCSVSkipLines(skipped int) CSVOpt { - return func(o *csvOpts) { - o.skippedLines = skipped - } -} - -func WithCSVClosesStream() CSVOpt { - return func(o *csvOpts) { - o.closeStream = true - } -} - -func (o csvOpts) applyToReader(in *csv.Reader) { - if o.csvReader.Comma != 0 { - in.Comma = o.csvReader.Comma - } - if o.csvReader.Comment != 0 { - in.Comment = o.csvReader.Comment - } - if o.csvReader.FieldsPerRecord != 0 { - in.FieldsPerRecord = o.csvReader.FieldsPerRecord - } - - in.LazyQuotes = o.csvReader.LazyQuotes - in.TrimLeadingSpace = o.csvReader.TrimLeadingSpace - in.ReuseRecord = o.csvReader.ReuseRecord -} - -func (o csvOpts) applyToWriter(in *csv.Writer) { - if o.csvWriter.Comma != 0 { - in.Comma = o.csvWriter.Comma - } - in.UseCRLF = o.csvWriter.UseCRLF -} - -func csvOptsWithDefaults(opts []CSVOpt) csvOpts { - var o csvOpts - for _, apply := range opts { - apply(&o) - } - - return o -} - -type CSVWriter interface { - Write([]string) error - Flush() - Error() error -} - -type CSVReader interface { - Read() ([]string, error) -} - -var ( - _ CSVWriter = &csvRecordsWriter{} - _ CSVReader = &csvRecordsWriter{} -) - -// csvRecordsWriter is an internal container to move CSV records back and forth -type csvRecordsWriter struct { - i int - records [][]string -} - -func (w *csvRecordsWriter) Write(record []string) error { - w.records = append(w.records, record) - - return nil -} - -func (w *csvRecordsWriter) Read() ([]string, error) { - if w.i >= len(w.records) { - return nil, io.EOF - } - defer func() { - w.i++ - }() - - return w.records[w.i], nil -} - -func (w *csvRecordsWriter) Flush() {} - -func (w *csvRecordsWriter) Error() error { - return nil -} diff --git a/vendor/github.com/go-openapi/runtime/discard.go b/vendor/github.com/go-openapi/runtime/discard.go deleted file mode 100644 index 0d390cfd6..000000000 --- a/vendor/github.com/go-openapi/runtime/discard.go +++ /dev/null @@ -1,9 +0,0 @@ -package runtime - -import "io" - -// DiscardConsumer does absolutely nothing, it's a black hole. -var DiscardConsumer = ConsumerFunc(func(_ io.Reader, _ interface{}) error { return nil }) - -// DiscardProducer does absolutely nothing, it's a black hole. -var DiscardProducer = ProducerFunc(func(_ io.Writer, _ interface{}) error { return nil }) diff --git a/vendor/github.com/go-openapi/runtime/file.go b/vendor/github.com/go-openapi/runtime/file.go deleted file mode 100644 index 397d8a459..000000000 --- a/vendor/github.com/go-openapi/runtime/file.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 runtime - -import "github.com/go-openapi/swag" - -type File = swag.File diff --git a/vendor/github.com/go-openapi/runtime/headers.go b/vendor/github.com/go-openapi/runtime/headers.go deleted file mode 100644 index 4d111db4f..000000000 --- a/vendor/github.com/go-openapi/runtime/headers.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 runtime - -import ( - "mime" - "net/http" - - "github.com/go-openapi/errors" -) - -// ContentType parses a content type header -func ContentType(headers http.Header) (string, string, error) { - ct := headers.Get(HeaderContentType) - orig := ct - if ct == "" { - ct = DefaultMime - } - if ct == "" { - return "", "", nil - } - - mt, opts, err := mime.ParseMediaType(ct) - if err != nil { - return "", "", errors.NewParseError(HeaderContentType, "header", orig, err) - } - - if cs, ok := opts[charsetKey]; ok { - return mt, cs, nil - } - - return mt, "", nil -} diff --git a/vendor/github.com/go-openapi/runtime/interfaces.go b/vendor/github.com/go-openapi/runtime/interfaces.go deleted file mode 100644 index e33412868..000000000 --- a/vendor/github.com/go-openapi/runtime/interfaces.go +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 runtime - -import ( - "context" - "io" - "net/http" - - "github.com/go-openapi/strfmt" -) - -// OperationHandlerFunc an adapter for a function to the OperationHandler interface -type OperationHandlerFunc func(interface{}) (interface{}, error) - -// Handle implements the operation handler interface -func (s OperationHandlerFunc) Handle(data interface{}) (interface{}, error) { - return s(data) -} - -// OperationHandler a handler for a swagger operation -type OperationHandler interface { - Handle(interface{}) (interface{}, error) -} - -// ConsumerFunc represents a function that can be used as a consumer -type ConsumerFunc func(io.Reader, interface{}) error - -// Consume consumes the reader into the data parameter -func (fn ConsumerFunc) Consume(reader io.Reader, data interface{}) error { - return fn(reader, data) -} - -// Consumer implementations know how to bind the values on the provided interface to -// data provided by the request body -type Consumer interface { - // Consume performs the binding of request values - Consume(io.Reader, interface{}) error -} - -// ProducerFunc represents a function that can be used as a producer -type ProducerFunc func(io.Writer, interface{}) error - -// Produce produces the response for the provided data -func (f ProducerFunc) Produce(writer io.Writer, data interface{}) error { - return f(writer, data) -} - -// Producer implementations know how to turn the provided interface into a valid -// HTTP response -type Producer interface { - // Produce writes to the http response - Produce(io.Writer, interface{}) error -} - -// AuthenticatorFunc turns a function into an authenticator -type AuthenticatorFunc func(interface{}) (bool, interface{}, error) - -// Authenticate authenticates the request with the provided data -func (f AuthenticatorFunc) Authenticate(params interface{}) (bool, interface{}, error) { - return f(params) -} - -// Authenticator represents an authentication strategy -// implementations of Authenticator know how to authenticate the -// request data and translate that into a valid principal object or an error -type Authenticator interface { - Authenticate(interface{}) (bool, interface{}, error) -} - -// AuthorizerFunc turns a function into an authorizer -type AuthorizerFunc func(*http.Request, interface{}) error - -// Authorize authorizes the processing of the request for the principal -func (f AuthorizerFunc) Authorize(r *http.Request, principal interface{}) error { - return f(r, principal) -} - -// Authorizer represents an authorization strategy -// implementations of Authorizer know how to authorize the principal object -// using the request data and returns error if unauthorized -type Authorizer interface { - Authorize(*http.Request, interface{}) error -} - -// Validatable types implementing this interface allow customizing their validation -// this will be used instead of the reflective validation based on the spec document. -// the implementations are assumed to have been generated by the swagger tool so they should -// contain all the validations obtained from the spec -type Validatable interface { - Validate(strfmt.Registry) error -} - -// ContextValidatable types implementing this interface allow customizing their validation -// this will be used instead of the reflective validation based on the spec document. -// the implementations are assumed to have been generated by the swagger tool so they should -// contain all the context validations obtained from the spec -type ContextValidatable interface { - ContextValidate(context.Context, strfmt.Registry) error -} diff --git a/vendor/github.com/go-openapi/runtime/json.go b/vendor/github.com/go-openapi/runtime/json.go deleted file mode 100644 index 5a690559c..000000000 --- a/vendor/github.com/go-openapi/runtime/json.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 runtime - -import ( - "encoding/json" - "io" -) - -// JSONConsumer creates a new JSON consumer -func JSONConsumer() Consumer { - return ConsumerFunc(func(reader io.Reader, data interface{}) error { - dec := json.NewDecoder(reader) - dec.UseNumber() // preserve number formats - return dec.Decode(data) - }) -} - -// JSONProducer creates a new JSON producer -func JSONProducer() Producer { - return ProducerFunc(func(writer io.Writer, data interface{}) error { - enc := json.NewEncoder(writer) - enc.SetEscapeHTML(false) - return enc.Encode(data) - }) -} diff --git a/vendor/github.com/go-openapi/runtime/logger/logger.go b/vendor/github.com/go-openapi/runtime/logger/logger.go deleted file mode 100644 index 6f4debcc1..000000000 --- a/vendor/github.com/go-openapi/runtime/logger/logger.go +++ /dev/null @@ -1,20 +0,0 @@ -package logger - -import "os" - -type Logger interface { - Printf(format string, args ...interface{}) - Debugf(format string, args ...interface{}) -} - -func DebugEnabled() bool { - d := os.Getenv("SWAGGER_DEBUG") - if d != "" && d != "false" && d != "0" { - return true - } - d = os.Getenv("DEBUG") - if d != "" && d != "false" && d != "0" { - return true - } - return false -} diff --git a/vendor/github.com/go-openapi/runtime/logger/standard.go b/vendor/github.com/go-openapi/runtime/logger/standard.go deleted file mode 100644 index 30035a777..000000000 --- a/vendor/github.com/go-openapi/runtime/logger/standard.go +++ /dev/null @@ -1,24 +0,0 @@ -package logger - -import ( - "fmt" - "os" -) - -var _ Logger = StandardLogger{} - -type StandardLogger struct{} - -func (StandardLogger) Printf(format string, args ...interface{}) { - if len(format) == 0 || format[len(format)-1] != '\n' { - format += "\n" - } - fmt.Fprintf(os.Stderr, format, args...) -} - -func (StandardLogger) Debugf(format string, args ...interface{}) { - if len(format) == 0 || format[len(format)-1] != '\n' { - format += "\n" - } - fmt.Fprintf(os.Stderr, format, args...) -} diff --git a/vendor/github.com/go-openapi/runtime/middleware/context.go b/vendor/github.com/go-openapi/runtime/middleware/context.go deleted file mode 100644 index 44cecf118..000000000 --- a/vendor/github.com/go-openapi/runtime/middleware/context.go +++ /dev/null @@ -1,722 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 middleware - -import ( - stdContext "context" - "fmt" - "net/http" - "net/url" - "path" - "strings" - "sync" - - "github.com/go-openapi/analysis" - "github.com/go-openapi/errors" - "github.com/go-openapi/loads" - "github.com/go-openapi/spec" - "github.com/go-openapi/strfmt" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/logger" - "github.com/go-openapi/runtime/middleware/untyped" - "github.com/go-openapi/runtime/security" -) - -// Debug when true turns on verbose logging -var Debug = logger.DebugEnabled() - -// Logger is the standard libray logger used for printing debug messages -var Logger logger.Logger = logger.StandardLogger{} - -func debugLogfFunc(lg logger.Logger) func(string, ...any) { - if logger.DebugEnabled() { - if lg == nil { - return Logger.Debugf - } - - return lg.Debugf - } - - // muted logger - return func(_ string, _ ...any) {} -} - -// A Builder can create middlewares -type Builder func(http.Handler) http.Handler - -// PassthroughBuilder returns the handler, aka the builder identity function -func PassthroughBuilder(handler http.Handler) http.Handler { return handler } - -// RequestBinder is an interface for types to implement -// when they want to be able to bind from a request -type RequestBinder interface { - BindRequest(*http.Request, *MatchedRoute) error -} - -// Responder is an interface for types to implement -// when they want to be considered for writing HTTP responses -type Responder interface { - WriteResponse(http.ResponseWriter, runtime.Producer) -} - -// ResponderFunc wraps a func as a Responder interface -type ResponderFunc func(http.ResponseWriter, runtime.Producer) - -// WriteResponse writes to the response -func (fn ResponderFunc) WriteResponse(rw http.ResponseWriter, pr runtime.Producer) { - fn(rw, pr) -} - -// Context is a type safe wrapper around an untyped request context -// used throughout to store request context with the standard context attached -// to the http.Request -type Context struct { - spec *loads.Document - analyzer *analysis.Spec - api RoutableAPI - router Router - debugLogf func(string, ...any) // a logging function to debug context and all components using it -} - -type routableUntypedAPI struct { - api *untyped.API - hlock *sync.Mutex - handlers map[string]map[string]http.Handler - defaultConsumes string - defaultProduces string -} - -func newRoutableUntypedAPI(spec *loads.Document, api *untyped.API, context *Context) *routableUntypedAPI { - var handlers map[string]map[string]http.Handler - if spec == nil || api == nil { - return nil - } - analyzer := analysis.New(spec.Spec()) - for method, hls := range analyzer.Operations() { - um := strings.ToUpper(method) - for path, op := range hls { - schemes := analyzer.SecurityRequirementsFor(op) - - if oh, ok := api.OperationHandlerFor(method, path); ok { - if handlers == nil { - handlers = make(map[string]map[string]http.Handler) - } - if b, ok := handlers[um]; !ok || b == nil { - handlers[um] = make(map[string]http.Handler) - } - - var handler http.Handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - // lookup route info in the context - route, rCtx, _ := context.RouteInfo(r) - if rCtx != nil { - r = rCtx - } - - // bind and validate the request using reflection - var bound interface{} - var validation error - bound, r, validation = context.BindAndValidate(r, route) - if validation != nil { - context.Respond(w, r, route.Produces, route, validation) - return - } - - // actually handle the request - result, err := oh.Handle(bound) - if err != nil { - // respond with failure - context.Respond(w, r, route.Produces, route, err) - return - } - - // respond with success - context.Respond(w, r, route.Produces, route, result) - }) - - if len(schemes) > 0 { - handler = newSecureAPI(context, handler) - } - handlers[um][path] = handler - } - } - } - - return &routableUntypedAPI{ - api: api, - hlock: new(sync.Mutex), - handlers: handlers, - defaultProduces: api.DefaultProduces, - defaultConsumes: api.DefaultConsumes, - } -} - -func (r *routableUntypedAPI) HandlerFor(method, path string) (http.Handler, bool) { - r.hlock.Lock() - paths, ok := r.handlers[strings.ToUpper(method)] - if !ok { - r.hlock.Unlock() - return nil, false - } - handler, ok := paths[path] - r.hlock.Unlock() - return handler, ok -} -func (r *routableUntypedAPI) ServeErrorFor(_ string) func(http.ResponseWriter, *http.Request, error) { - return r.api.ServeError -} -func (r *routableUntypedAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer { - return r.api.ConsumersFor(mediaTypes) -} -func (r *routableUntypedAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer { - return r.api.ProducersFor(mediaTypes) -} -func (r *routableUntypedAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator { - return r.api.AuthenticatorsFor(schemes) -} -func (r *routableUntypedAPI) Authorizer() runtime.Authorizer { - return r.api.Authorizer() -} -func (r *routableUntypedAPI) Formats() strfmt.Registry { - return r.api.Formats() -} - -func (r *routableUntypedAPI) DefaultProduces() string { - return r.defaultProduces -} - -func (r *routableUntypedAPI) DefaultConsumes() string { - return r.defaultConsumes -} - -// NewRoutableContext creates a new context for a routable API. -// -// If a nil Router is provided, the DefaultRouter (denco-based) will be used. -func NewRoutableContext(spec *loads.Document, routableAPI RoutableAPI, routes Router) *Context { - var an *analysis.Spec - if spec != nil { - an = analysis.New(spec.Spec()) - } - - return NewRoutableContextWithAnalyzedSpec(spec, an, routableAPI, routes) -} - -// NewRoutableContextWithAnalyzedSpec is like NewRoutableContext but takes as input an already analysed spec. -// -// If a nil Router is provided, the DefaultRouter (denco-based) will be used. -func NewRoutableContextWithAnalyzedSpec(spec *loads.Document, an *analysis.Spec, routableAPI RoutableAPI, routes Router) *Context { - // Either there are no spec doc and analysis, or both of them. - if !((spec == nil && an == nil) || (spec != nil && an != nil)) { - panic(errors.New(http.StatusInternalServerError, "routable context requires either both spec doc and analysis, or none of them")) - } - - return &Context{ - spec: spec, - api: routableAPI, - analyzer: an, - router: routes, - debugLogf: debugLogfFunc(nil), - } -} - -// NewContext creates a new context wrapper. -// -// If a nil Router is provided, the DefaultRouter (denco-based) will be used. -func NewContext(spec *loads.Document, api *untyped.API, routes Router) *Context { - var an *analysis.Spec - if spec != nil { - an = analysis.New(spec.Spec()) - } - ctx := &Context{ - spec: spec, - analyzer: an, - router: routes, - debugLogf: debugLogfFunc(nil), - } - ctx.api = newRoutableUntypedAPI(spec, api, ctx) - - return ctx -} - -// Serve serves the specified spec with the specified api registrations as a http.Handler -func Serve(spec *loads.Document, api *untyped.API) http.Handler { - return ServeWithBuilder(spec, api, PassthroughBuilder) -} - -// ServeWithBuilder serves the specified spec with the specified api registrations as a http.Handler that is decorated -// by the Builder -func ServeWithBuilder(spec *loads.Document, api *untyped.API, builder Builder) http.Handler { - context := NewContext(spec, api, nil) - return context.APIHandler(builder) -} - -type contextKey int8 - -const ( - _ contextKey = iota - ctxContentType - ctxResponseFormat - ctxMatchedRoute - ctxBoundParams - ctxSecurityPrincipal - ctxSecurityScopes -) - -// MatchedRouteFrom request context value. -func MatchedRouteFrom(req *http.Request) *MatchedRoute { - mr := req.Context().Value(ctxMatchedRoute) - if mr == nil { - return nil - } - if res, ok := mr.(*MatchedRoute); ok { - return res - } - return nil -} - -// SecurityPrincipalFrom request context value. -func SecurityPrincipalFrom(req *http.Request) interface{} { - return req.Context().Value(ctxSecurityPrincipal) -} - -// SecurityScopesFrom request context value. -func SecurityScopesFrom(req *http.Request) []string { - rs := req.Context().Value(ctxSecurityScopes) - if res, ok := rs.([]string); ok { - return res - } - return nil -} - -type contentTypeValue struct { - MediaType string - Charset string -} - -// BasePath returns the base path for this API -func (c *Context) BasePath() string { - return c.spec.BasePath() -} - -// SetLogger allows for injecting a logger to catch debug entries. -// -// The logger is enabled in DEBUG mode only. -func (c *Context) SetLogger(lg logger.Logger) { - c.debugLogf = debugLogfFunc(lg) -} - -// RequiredProduces returns the accepted content types for responses -func (c *Context) RequiredProduces() []string { - return c.analyzer.RequiredProduces() -} - -// BindValidRequest binds a params object to a request but only when the request is valid -// if the request is not valid an error will be returned -func (c *Context) BindValidRequest(request *http.Request, route *MatchedRoute, binder RequestBinder) error { - var res []error - var requestContentType string - - // check and validate content type, select consumer - if runtime.HasBody(request) { - ct, _, err := runtime.ContentType(request.Header) - if err != nil { - res = append(res, err) - } else { - c.debugLogf("validating content type for %q against [%s]", ct, strings.Join(route.Consumes, ", ")) - if err := validateContentType(route.Consumes, ct); err != nil { - res = append(res, err) - } - if len(res) == 0 { - cons, ok := route.Consumers[ct] - if !ok { - res = append(res, errors.New(500, "no consumer registered for %s", ct)) - } else { - route.Consumer = cons - requestContentType = ct - } - } - } - } - - // check and validate the response format - if len(res) == 0 { - // if the route does not provide Produces and a default contentType could not be identified - // based on a body, typical for GET and DELETE requests, then default contentType to. - if len(route.Produces) == 0 && requestContentType == "" { - requestContentType = "*/*" - } - - if str := NegotiateContentType(request, route.Produces, requestContentType); str == "" { - res = append(res, errors.InvalidResponseFormat(request.Header.Get(runtime.HeaderAccept), route.Produces)) - } - } - - // now bind the request with the provided binder - // it's assumed the binder will also validate the request and return an error if the - // request is invalid - if binder != nil && len(res) == 0 { - if err := binder.BindRequest(request, route); err != nil { - return err - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// ContentType gets the parsed value of a content type -// Returns the media type, its charset and a shallow copy of the request -// when its context doesn't contain the content type value, otherwise it returns -// the same request -// Returns the error that runtime.ContentType may retunrs. -func (c *Context) ContentType(request *http.Request) (string, string, *http.Request, error) { - var rCtx = request.Context() - - if v, ok := rCtx.Value(ctxContentType).(*contentTypeValue); ok { - return v.MediaType, v.Charset, request, nil - } - - mt, cs, err := runtime.ContentType(request.Header) - if err != nil { - return "", "", nil, err - } - rCtx = stdContext.WithValue(rCtx, ctxContentType, &contentTypeValue{mt, cs}) - return mt, cs, request.WithContext(rCtx), nil -} - -// LookupRoute looks a route up and returns true when it is found -func (c *Context) LookupRoute(request *http.Request) (*MatchedRoute, bool) { - if route, ok := c.router.Lookup(request.Method, request.URL.EscapedPath()); ok { - return route, ok - } - return nil, false -} - -// RouteInfo tries to match a route for this request -// Returns the matched route, a shallow copy of the request if its context -// contains the matched router, otherwise the same request, and a bool to -// indicate if it the request matches one of the routes, if it doesn't -// then it returns false and nil for the other two return values -func (c *Context) RouteInfo(request *http.Request) (*MatchedRoute, *http.Request, bool) { - var rCtx = request.Context() - - if v, ok := rCtx.Value(ctxMatchedRoute).(*MatchedRoute); ok { - return v, request, ok - } - - if route, ok := c.LookupRoute(request); ok { - rCtx = stdContext.WithValue(rCtx, ctxMatchedRoute, route) - return route, request.WithContext(rCtx), ok - } - - return nil, nil, false -} - -// ResponseFormat negotiates the response content type -// Returns the response format and a shallow copy of the request if its context -// doesn't contain the response format, otherwise the same request -func (c *Context) ResponseFormat(r *http.Request, offers []string) (string, *http.Request) { - var rCtx = r.Context() - - if v, ok := rCtx.Value(ctxResponseFormat).(string); ok { - c.debugLogf("[%s %s] found response format %q in context", r.Method, r.URL.Path, v) - return v, r - } - - format := NegotiateContentType(r, offers, "") - if format != "" { - c.debugLogf("[%s %s] set response format %q in context", r.Method, r.URL.Path, format) - r = r.WithContext(stdContext.WithValue(rCtx, ctxResponseFormat, format)) - } - c.debugLogf("[%s %s] negotiated response format %q", r.Method, r.URL.Path, format) - return format, r -} - -// AllowedMethods gets the allowed methods for the path of this request -func (c *Context) AllowedMethods(request *http.Request) []string { - return c.router.OtherMethods(request.Method, request.URL.EscapedPath()) -} - -// ResetAuth removes the current principal from the request context -func (c *Context) ResetAuth(request *http.Request) *http.Request { - rctx := request.Context() - rctx = stdContext.WithValue(rctx, ctxSecurityPrincipal, nil) - rctx = stdContext.WithValue(rctx, ctxSecurityScopes, nil) - return request.WithContext(rctx) -} - -// Authorize authorizes the request -// Returns the principal object and a shallow copy of the request when its -// context doesn't contain the principal, otherwise the same request or an error -// (the last) if one of the authenticators returns one or an Unauthenticated error -func (c *Context) Authorize(request *http.Request, route *MatchedRoute) (interface{}, *http.Request, error) { - if route == nil || !route.HasAuth() { - return nil, nil, nil - } - - var rCtx = request.Context() - if v := rCtx.Value(ctxSecurityPrincipal); v != nil { - return v, request, nil - } - - applies, usr, err := route.Authenticators.Authenticate(request, route) - if !applies || err != nil || !route.Authenticators.AllowsAnonymous() && usr == nil { - if err != nil { - return nil, nil, err - } - return nil, nil, errors.Unauthenticated("invalid credentials") - } - if route.Authorizer != nil { - if err := route.Authorizer.Authorize(request, usr); err != nil { - if _, ok := err.(errors.Error); ok { - return nil, nil, err - } - - return nil, nil, errors.New(http.StatusForbidden, err.Error()) - } - } - - rCtx = request.Context() - - rCtx = stdContext.WithValue(rCtx, ctxSecurityPrincipal, usr) - rCtx = stdContext.WithValue(rCtx, ctxSecurityScopes, route.Authenticator.AllScopes()) - return usr, request.WithContext(rCtx), nil -} - -// BindAndValidate binds and validates the request -// Returns the validation map and a shallow copy of the request when its context -// doesn't contain the validation, otherwise it returns the same request or an -// CompositeValidationError error -func (c *Context) BindAndValidate(request *http.Request, matched *MatchedRoute) (interface{}, *http.Request, error) { - var rCtx = request.Context() - - if v, ok := rCtx.Value(ctxBoundParams).(*validation); ok { - c.debugLogf("got cached validation (valid: %t)", len(v.result) == 0) - if len(v.result) > 0 { - return v.bound, request, errors.CompositeValidationError(v.result...) - } - return v.bound, request, nil - } - result := validateRequest(c, request, matched) - rCtx = stdContext.WithValue(rCtx, ctxBoundParams, result) - request = request.WithContext(rCtx) - if len(result.result) > 0 { - return result.bound, request, errors.CompositeValidationError(result.result...) - } - c.debugLogf("no validation errors found") - return result.bound, request, nil -} - -// NotFound the default not found responder for when no route has been matched yet -func (c *Context) NotFound(rw http.ResponseWriter, r *http.Request) { - c.Respond(rw, r, []string{c.api.DefaultProduces()}, nil, errors.NotFound("not found")) -} - -// Respond renders the response after doing some content negotiation -func (c *Context) Respond(rw http.ResponseWriter, r *http.Request, produces []string, route *MatchedRoute, data interface{}) { - c.debugLogf("responding to %s %s with produces: %v", r.Method, r.URL.Path, produces) - offers := []string{} - for _, mt := range produces { - if mt != c.api.DefaultProduces() { - offers = append(offers, mt) - } - } - // the default producer is last so more specific producers take precedence - offers = append(offers, c.api.DefaultProduces()) - c.debugLogf("offers: %v", offers) - - var format string - format, r = c.ResponseFormat(r, offers) - rw.Header().Set(runtime.HeaderContentType, format) - - if resp, ok := data.(Responder); ok { - producers := route.Producers - // producers contains keys with normalized format, if a format has MIME type parameter such as `text/plain; charset=utf-8` - // then you must provide `text/plain` to get the correct producer. HOWEVER, format here is not normalized. - prod, ok := producers[normalizeOffer(format)] - if !ok { - prods := c.api.ProducersFor(normalizeOffers([]string{c.api.DefaultProduces()})) - pr, ok := prods[c.api.DefaultProduces()] - if !ok { - panic(errors.New(http.StatusInternalServerError, cantFindProducer(format))) - } - prod = pr - } - resp.WriteResponse(rw, prod) - return - } - - if err, ok := data.(error); ok { - if format == "" { - rw.Header().Set(runtime.HeaderContentType, runtime.JSONMime) - } - - if realm := security.FailedBasicAuth(r); realm != "" { - rw.Header().Set("WWW-Authenticate", fmt.Sprintf("Basic realm=%q", realm)) - } - - if route == nil || route.Operation == nil { - c.api.ServeErrorFor("")(rw, r, err) - return - } - c.api.ServeErrorFor(route.Operation.ID)(rw, r, err) - return - } - - if route == nil || route.Operation == nil { - rw.WriteHeader(http.StatusOK) - if r.Method == http.MethodHead { - return - } - producers := c.api.ProducersFor(normalizeOffers(offers)) - prod, ok := producers[format] - if !ok { - panic(errors.New(http.StatusInternalServerError, cantFindProducer(format))) - } - if err := prod.Produce(rw, data); err != nil { - panic(err) // let the recovery middleware deal with this - } - return - } - - if _, code, ok := route.Operation.SuccessResponse(); ok { - rw.WriteHeader(code) - if code == http.StatusNoContent || r.Method == http.MethodHead { - return - } - - producers := route.Producers - prod, ok := producers[format] - if !ok { - if !ok { - prods := c.api.ProducersFor(normalizeOffers([]string{c.api.DefaultProduces()})) - pr, ok := prods[c.api.DefaultProduces()] - if !ok { - panic(errors.New(http.StatusInternalServerError, cantFindProducer(format))) - } - prod = pr - } - } - if err := prod.Produce(rw, data); err != nil { - panic(err) // let the recovery middleware deal with this - } - return - } - - c.api.ServeErrorFor(route.Operation.ID)(rw, r, errors.New(http.StatusInternalServerError, "can't produce response")) -} - -// APIHandlerSwaggerUI returns a handler to serve the API. -// -// This handler includes a swagger spec, router and the contract defined in the swagger spec. -// -// A spec UI (SwaggerUI) is served at {API base path}/docs and the spec document at /swagger.json -// (these can be modified with uiOptions). -func (c *Context) APIHandlerSwaggerUI(builder Builder, opts ...UIOption) http.Handler { - b := builder - if b == nil { - b = PassthroughBuilder - } - - specPath, uiOpts, specOpts := c.uiOptionsForHandler(opts) - var swaggerUIOpts SwaggerUIOpts - fromCommonToAnyOptions(uiOpts, &swaggerUIOpts) - - return Spec(specPath, c.spec.Raw(), SwaggerUI(swaggerUIOpts, c.RoutesHandler(b)), specOpts...) -} - -// APIHandlerRapiDoc returns a handler to serve the API. -// -// This handler includes a swagger spec, router and the contract defined in the swagger spec. -// -// A spec UI (RapiDoc) is served at {API base path}/docs and the spec document at /swagger.json -// (these can be modified with uiOptions). -func (c *Context) APIHandlerRapiDoc(builder Builder, opts ...UIOption) http.Handler { - b := builder - if b == nil { - b = PassthroughBuilder - } - - specPath, uiOpts, specOpts := c.uiOptionsForHandler(opts) - var rapidocUIOpts RapiDocOpts - fromCommonToAnyOptions(uiOpts, &rapidocUIOpts) - - return Spec(specPath, c.spec.Raw(), RapiDoc(rapidocUIOpts, c.RoutesHandler(b)), specOpts...) -} - -// APIHandler returns a handler to serve the API. -// -// This handler includes a swagger spec, router and the contract defined in the swagger spec. -// -// A spec UI (Redoc) is served at {API base path}/docs and the spec document at /swagger.json -// (these can be modified with uiOptions). -func (c *Context) APIHandler(builder Builder, opts ...UIOption) http.Handler { - b := builder - if b == nil { - b = PassthroughBuilder - } - - specPath, uiOpts, specOpts := c.uiOptionsForHandler(opts) - var redocOpts RedocOpts - fromCommonToAnyOptions(uiOpts, &redocOpts) - - return Spec(specPath, c.spec.Raw(), Redoc(redocOpts, c.RoutesHandler(b)), specOpts...) -} - -func (c Context) uiOptionsForHandler(opts []UIOption) (string, uiOptions, []SpecOption) { - var title string - sp := c.spec.Spec() - if sp != nil && sp.Info != nil && sp.Info.Title != "" { - title = sp.Info.Title - } - - // default options (may be overridden) - optsForContext := []UIOption{ - WithUIBasePath(c.BasePath()), - WithUITitle(title), - } - optsForContext = append(optsForContext, opts...) - uiOpts := uiOptionsWithDefaults(optsForContext) - - // If spec URL is provided, there is a non-default path to serve the spec. - // This makes sure that the UI middleware is aligned with the Spec middleware. - u, _ := url.Parse(uiOpts.SpecURL) - var specPath string - if u != nil { - specPath = u.Path - } - - pth, doc := path.Split(specPath) - if pth == "." { - pth = "" - } - - return pth, uiOpts, []SpecOption{WithSpecDocument(doc)} -} - -// RoutesHandler returns a handler to serve the API, just the routes and the contract defined in the swagger spec -func (c *Context) RoutesHandler(builder Builder) http.Handler { - b := builder - if b == nil { - b = PassthroughBuilder - } - return NewRouter(c, b(NewOperationExecutor(c))) -} - -func cantFindProducer(format string) string { - return "can't find a producer for " + format -} diff --git a/vendor/github.com/go-openapi/runtime/middleware/denco/LICENSE b/vendor/github.com/go-openapi/runtime/middleware/denco/LICENSE deleted file mode 100644 index e65039ad8..000000000 --- a/vendor/github.com/go-openapi/runtime/middleware/denco/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2014 Naoya Inada - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/go-openapi/runtime/middleware/denco/README.md b/vendor/github.com/go-openapi/runtime/middleware/denco/README.md deleted file mode 100644 index 30109e17d..000000000 --- a/vendor/github.com/go-openapi/runtime/middleware/denco/README.md +++ /dev/null @@ -1,180 +0,0 @@ -# Denco [![Build Status](https://travis-ci.org/naoina/denco.png?branch=master)](https://travis-ci.org/naoina/denco) - -The fast and flexible HTTP request router for [Go](http://golang.org). - -Denco is based on Double-Array implementation of [Kocha-urlrouter](https://github.com/naoina/kocha-urlrouter). -However, Denco is optimized and some features added. - -## Features - -* Fast (See [go-http-routing-benchmark](https://github.com/naoina/go-http-routing-benchmark)) -* [URL patterns](#url-patterns) (`/foo/:bar` and `/foo/*wildcard`) -* Small (but enough) URL router API -* HTTP request multiplexer like `http.ServeMux` - -## Installation - - go get -u github.com/go-openapi/runtime/middleware/denco - -## Using as HTTP request multiplexer - -```go -package main - -import ( - "fmt" - "log" - "net/http" - - "github.com/go-openapi/runtime/middleware/denco" -) - -func Index(w http.ResponseWriter, r *http.Request, params denco.Params) { - fmt.Fprintf(w, "Welcome to Denco!\n") -} - -func User(w http.ResponseWriter, r *http.Request, params denco.Params) { - fmt.Fprintf(w, "Hello %s!\n", params.Get("name")) -} - -func main() { - mux := denco.NewMux() - handler, err := mux.Build([]denco.Handler{ - mux.GET("/", Index), - mux.GET("/user/:name", User), - mux.POST("/user/:name", User), - }) - if err != nil { - panic(err) - } - log.Fatal(http.ListenAndServe(":8080", handler)) -} -``` - -## Using as URL router - -```go -package main - -import ( - "fmt" - - "github.com/go-openapi/runtime/middleware/denco" -) - -type route struct { - name string -} - -func main() { - router := denco.New() - router.Build([]denco.Record{ - {"/", &route{"root"}}, - {"/user/:id", &route{"user"}}, - {"/user/:name/:id", &route{"username"}}, - {"/static/*filepath", &route{"static"}}, - }) - - data, params, found := router.Lookup("/") - // print `&main.route{name:"root"}, denco.Params(nil), true`. - fmt.Printf("%#v, %#v, %#v\n", data, params, found) - - data, params, found = router.Lookup("/user/hoge") - // print `&main.route{name:"user"}, denco.Params{denco.Param{Name:"id", Value:"hoge"}}, true`. - fmt.Printf("%#v, %#v, %#v\n", data, params, found) - - data, params, found = router.Lookup("/user/hoge/7") - // print `&main.route{name:"username"}, denco.Params{denco.Param{Name:"name", Value:"hoge"}, denco.Param{Name:"id", Value:"7"}}, true`. - fmt.Printf("%#v, %#v, %#v\n", data, params, found) - - data, params, found = router.Lookup("/static/path/to/file") - // print `&main.route{name:"static"}, denco.Params{denco.Param{Name:"filepath", Value:"path/to/file"}}, true`. - fmt.Printf("%#v, %#v, %#v\n", data, params, found) -} -``` - -See [Godoc](http://godoc.org/github.com/go-openapi/runtime/middleware/denco) for more details. - -## Getting the value of path parameter - -You can get the value of path parameter by 2 ways. - -1. Using [`denco.Params.Get`](http://godoc.org/github.com/go-openapi/runtime/middleware/denco#Params.Get) method -2. Find by loop - -```go -package main - -import ( - "fmt" - - "github.com/go-openapi/runtime/middleware/denco" -) - -func main() { - router := denco.New() - if err := router.Build([]denco.Record{ - {"/user/:name/:id", "route1"}, - }); err != nil { - panic(err) - } - - // 1. Using denco.Params.Get method. - _, params, _ := router.Lookup("/user/alice/1") - name := params.Get("name") - if name != "" { - fmt.Printf("Hello %s.\n", name) // prints "Hello alice.". - } - - // 2. Find by loop. - for _, param := range params { - if param.Name == "name" { - fmt.Printf("Hello %s.\n", name) // prints "Hello alice.". - } - } -} -``` - -## URL patterns - -Denco's route matching strategy is "most nearly matching". - -When routes `/:name` and `/alice` have been built, URI `/alice` matches the route `/alice`, not `/:name`. -Because URI `/alice` is more match with the route `/alice` than `/:name`. - -For more example, when routes below have been built: - -``` -/user/alice -/user/:name -/user/:name/:id -/user/alice/:id -/user/:id/bob -``` - -Routes matching are: - -``` -/user/alice => "/user/alice" (no match with "/user/:name") -/user/bob => "/user/:name" -/user/naoina/1 => "/user/:name/1" -/user/alice/1 => "/user/alice/:id" (no match with "/user/:name/:id") -/user/1/bob => "/user/:id/bob" (no match with "/user/:name/:id") -/user/alice/bob => "/user/alice/:id" (no match with "/user/:name/:id" and "/user/:id/bob") -``` - -## Limitation - -Denco has some limitations below. - -* Number of param records (such as `/:name`) must be less than 2^22 -* Number of elements of internal slice must be less than 2^22 - -## Benchmarks - - cd $GOPATH/github.com/go-openapi/runtime/middleware/denco - go test -bench . -benchmem - -## License - -Denco is licensed under the MIT License. diff --git a/vendor/github.com/go-openapi/runtime/middleware/denco/router.go b/vendor/github.com/go-openapi/runtime/middleware/denco/router.go deleted file mode 100644 index 4377f77a4..000000000 --- a/vendor/github.com/go-openapi/runtime/middleware/denco/router.go +++ /dev/null @@ -1,467 +0,0 @@ -// Package denco provides fast URL router. -package denco - -import ( - "errors" - "fmt" - "sort" - "strings" -) - -const ( - // ParamCharacter is a special character for path parameter. - ParamCharacter = ':' - - // WildcardCharacter is a special character for wildcard path parameter. - WildcardCharacter = '*' - - // TerminationCharacter is a special character for end of path. - TerminationCharacter = '#' - - // SeparatorCharacter separates path segments. - SeparatorCharacter = '/' - - // PathParamCharacter indicates a RESTCONF path param - PathParamCharacter = '=' - - // MaxSize is max size of records and internal slice. - MaxSize = (1 << 22) - 1 -) - -// Router represents a URL router. -type Router struct { - param *doubleArray - // SizeHint expects the maximum number of path parameters in records to Build. - // SizeHint will be used to determine the capacity of the memory to allocate. - // By default, SizeHint will be determined from given records to Build. - SizeHint int - - static map[string]interface{} -} - -// New returns a new Router. -func New() *Router { - return &Router{ - SizeHint: -1, - static: make(map[string]interface{}), - param: newDoubleArray(), - } -} - -// Lookup returns data and path parameters that associated with path. -// params is a slice of the Param that arranged in the order in which parameters appeared. -// e.g. when built routing path is "/path/to/:id/:name" and given path is "/path/to/1/alice". params order is [{"id": "1"}, {"name": "alice"}], not [{"name": "alice"}, {"id": "1"}]. -func (rt *Router) Lookup(path string) (data interface{}, params Params, found bool) { - if data, found = rt.static[path]; found { - return data, nil, true - } - if len(rt.param.node) == 1 { - return nil, nil, false - } - nd, params, found := rt.param.lookup(path, make([]Param, 0, rt.SizeHint), 1) - if !found { - return nil, nil, false - } - for i := 0; i < len(params); i++ { - params[i].Name = nd.paramNames[i] - } - return nd.data, params, true -} - -// Build builds URL router from records. -func (rt *Router) Build(records []Record) error { - statics, params := makeRecords(records) - if len(params) > MaxSize { - return errors.New("denco: too many records") - } - if rt.SizeHint < 0 { - rt.SizeHint = 0 - for _, p := range params { - size := 0 - for _, k := range p.Key { - if k == ParamCharacter || k == WildcardCharacter { - size++ - } - } - if size > rt.SizeHint { - rt.SizeHint = size - } - } - } - for _, r := range statics { - rt.static[r.Key] = r.Value - } - if err := rt.param.build(params, 1, 0, make(map[int]struct{})); err != nil { - return err - } - return nil -} - -// Param represents name and value of path parameter. -type Param struct { - Name string - Value string -} - -// Params represents the name and value of path parameters. -type Params []Param - -// Get gets the first value associated with the given name. -// If there are no values associated with the key, Get returns "". -func (ps Params) Get(name string) string { - for _, p := range ps { - if p.Name == name { - return p.Value - } - } - return "" -} - -type doubleArray struct { - bc []baseCheck - node []*node -} - -func newDoubleArray() *doubleArray { - return &doubleArray{ - bc: []baseCheck{0}, - node: []*node{nil}, // A start index is adjusting to 1 because 0 will be used as a mark of non-existent node. - } -} - -// baseCheck contains BASE, CHECK and Extra flags. -// From the top, 22bits of BASE, 2bits of Extra flags and 8bits of CHECK. -// -// BASE (22bit) | Extra flags (2bit) | CHECK (8bit) -// -// |----------------------|--|--------| -// 32 10 8 0 -type baseCheck uint32 - -func (bc baseCheck) Base() int { - return int(bc >> 10) -} - -func (bc *baseCheck) SetBase(base int) { - *bc |= baseCheck(base) << 10 -} - -func (bc baseCheck) Check() byte { - return byte(bc) -} - -func (bc *baseCheck) SetCheck(check byte) { - *bc |= baseCheck(check) -} - -func (bc baseCheck) IsEmpty() bool { - return bc&0xfffffcff == 0 -} - -func (bc baseCheck) IsSingleParam() bool { - return bc¶mTypeSingle == paramTypeSingle -} - -func (bc baseCheck) IsWildcardParam() bool { - return bc¶mTypeWildcard == paramTypeWildcard -} - -func (bc baseCheck) IsAnyParam() bool { - return bc¶mTypeAny != 0 -} - -func (bc *baseCheck) SetSingleParam() { - *bc |= (1 << 8) -} - -func (bc *baseCheck) SetWildcardParam() { - *bc |= (1 << 9) -} - -const ( - paramTypeSingle = 0x0100 - paramTypeWildcard = 0x0200 - paramTypeAny = 0x0300 -) - -func (da *doubleArray) lookup(path string, params []Param, idx int) (*node, []Param, bool) { - indices := make([]uint64, 0, 1) - for i := 0; i < len(path); i++ { - if da.bc[idx].IsAnyParam() { - indices = append(indices, (uint64(i)<<32)|(uint64(idx)&0xffffffff)) - } - c := path[i] - if idx = nextIndex(da.bc[idx].Base(), c); idx >= len(da.bc) || da.bc[idx].Check() != c { - goto BACKTRACKING - } - } - if next := nextIndex(da.bc[idx].Base(), TerminationCharacter); next < len(da.bc) && da.bc[next].Check() == TerminationCharacter { - return da.node[da.bc[next].Base()], params, true - } - -BACKTRACKING: - for j := len(indices) - 1; j >= 0; j-- { - i, idx := int(indices[j]>>32), int(indices[j]&0xffffffff) - if da.bc[idx].IsSingleParam() { - nextIdx := nextIndex(da.bc[idx].Base(), ParamCharacter) - if nextIdx >= len(da.bc) { - break - } - - next := NextSeparator(path, i) - nextParams := params - nextParams = append(nextParams, Param{Value: path[i:next]}) - if nd, nextNextParams, found := da.lookup(path[next:], nextParams, nextIdx); found { - return nd, nextNextParams, true - } - } - - if da.bc[idx].IsWildcardParam() { - nextIdx := nextIndex(da.bc[idx].Base(), WildcardCharacter) - nextParams := params - nextParams = append(nextParams, Param{Value: path[i:]}) - return da.node[da.bc[nextIdx].Base()], nextParams, true - } - } - return nil, nil, false -} - -// build builds double-array from records. -func (da *doubleArray) build(srcs []*record, idx, depth int, usedBase map[int]struct{}) error { - sort.Stable(recordSlice(srcs)) - base, siblings, leaf, err := da.arrange(srcs, idx, depth, usedBase) - if err != nil { - return err - } - if leaf != nil { - nd, err := makeNode(leaf) - if err != nil { - return err - } - da.bc[idx].SetBase(len(da.node)) - da.node = append(da.node, nd) - } - for _, sib := range siblings { - da.setCheck(nextIndex(base, sib.c), sib.c) - } - for _, sib := range siblings { - records := srcs[sib.start:sib.end] - switch sib.c { - case ParamCharacter: - for _, r := range records { - next := NextSeparator(r.Key, depth+1) - name := r.Key[depth+1 : next] - r.paramNames = append(r.paramNames, name) - r.Key = r.Key[next:] - } - da.bc[idx].SetSingleParam() - if err := da.build(records, nextIndex(base, sib.c), 0, usedBase); err != nil { - return err - } - case WildcardCharacter: - r := records[0] - name := r.Key[depth+1 : len(r.Key)-1] - r.paramNames = append(r.paramNames, name) - r.Key = "" - da.bc[idx].SetWildcardParam() - if err := da.build(records, nextIndex(base, sib.c), 0, usedBase); err != nil { - return err - } - default: - if err := da.build(records, nextIndex(base, sib.c), depth+1, usedBase); err != nil { - return err - } - } - } - return nil -} - -// setBase sets BASE. -func (da *doubleArray) setBase(i, base int) { - da.bc[i].SetBase(base) -} - -// setCheck sets CHECK. -func (da *doubleArray) setCheck(i int, check byte) { - da.bc[i].SetCheck(check) -} - -// findEmptyIndex returns an index of unused BASE/CHECK node. -func (da *doubleArray) findEmptyIndex(start int) int { - i := start - for ; i < len(da.bc); i++ { - if da.bc[i].IsEmpty() { - break - } - } - return i -} - -// findBase returns good BASE. -func (da *doubleArray) findBase(siblings []sibling, start int, usedBase map[int]struct{}) (base int) { - for idx, firstChar := start+1, siblings[0].c; ; idx = da.findEmptyIndex(idx + 1) { - base = nextIndex(idx, firstChar) - if _, used := usedBase[base]; used { - continue - } - i := 0 - for ; i < len(siblings); i++ { - next := nextIndex(base, siblings[i].c) - if len(da.bc) <= next { - da.bc = append(da.bc, make([]baseCheck, next-len(da.bc)+1)...) - } - if !da.bc[next].IsEmpty() { - break - } - } - if i == len(siblings) { - break - } - } - usedBase[base] = struct{}{} - return base -} - -func (da *doubleArray) arrange(records []*record, idx, depth int, usedBase map[int]struct{}) (base int, siblings []sibling, leaf *record, err error) { - siblings, leaf, err = makeSiblings(records, depth) - if err != nil { - return -1, nil, nil, err - } - if len(siblings) < 1 { - return -1, nil, leaf, nil - } - base = da.findBase(siblings, idx, usedBase) - if base > MaxSize { - return -1, nil, nil, errors.New("denco: too many elements of internal slice") - } - da.setBase(idx, base) - return base, siblings, leaf, err -} - -// node represents a node of Double-Array. -type node struct { - data interface{} - - // Names of path parameters. - paramNames []string -} - -// makeNode returns a new node from record. -func makeNode(r *record) (*node, error) { - dups := make(map[string]bool) - for _, name := range r.paramNames { - if dups[name] { - return nil, fmt.Errorf("denco: path parameter `%v' is duplicated in the key `%v'", name, r.Key) - } - dups[name] = true - } - return &node{data: r.Value, paramNames: r.paramNames}, nil -} - -// sibling represents an intermediate data of build for Double-Array. -type sibling struct { - // An index of start of duplicated characters. - start int - - // An index of end of duplicated characters. - end int - - // A character of sibling. - c byte -} - -// nextIndex returns a next index of array of BASE/CHECK. -func nextIndex(base int, c byte) int { - return base ^ int(c) -} - -// makeSiblings returns slice of sibling. -func makeSiblings(records []*record, depth int) (sib []sibling, leaf *record, err error) { - var ( - pc byte - n int - ) - for i, r := range records { - if len(r.Key) <= depth { - leaf = r - continue - } - c := r.Key[depth] - switch { - case pc < c: - sib = append(sib, sibling{start: i, c: c}) - case pc == c: - continue - default: - return nil, nil, errors.New("denco: BUG: routing table hasn't been sorted") - } - if n > 0 { - sib[n-1].end = i - } - pc = c - n++ - } - if n == 0 { - return nil, leaf, nil - } - sib[n-1].end = len(records) - return sib, leaf, nil -} - -// Record represents a record data for router construction. -type Record struct { - // Key for router construction. - Key string - - // Result value for Key. - Value interface{} -} - -// NewRecord returns a new Record. -func NewRecord(key string, value interface{}) Record { - return Record{ - Key: key, - Value: value, - } -} - -// record represents a record that use to build the Double-Array. -type record struct { - Record - paramNames []string -} - -// makeRecords returns the records that use to build Double-Arrays. -func makeRecords(srcs []Record) (statics, params []*record) { - termChar := string(TerminationCharacter) - paramPrefix := string(SeparatorCharacter) + string(ParamCharacter) - wildcardPrefix := string(SeparatorCharacter) + string(WildcardCharacter) - restconfPrefix := string(PathParamCharacter) + string(ParamCharacter) - for _, r := range srcs { - if strings.Contains(r.Key, paramPrefix) || strings.Contains(r.Key, wildcardPrefix) || strings.Contains(r.Key, restconfPrefix) { - r.Key += termChar - params = append(params, &record{Record: r}) - } else { - statics = append(statics, &record{Record: r}) - } - } - return statics, params -} - -// recordSlice represents a slice of Record for sort and implements the sort.Interface. -type recordSlice []*record - -// Len implements the sort.Interface.Len. -func (rs recordSlice) Len() int { - return len(rs) -} - -// Less implements the sort.Interface.Less. -func (rs recordSlice) Less(i, j int) bool { - return rs[i].Key < rs[j].Key -} - -// Swap implements the sort.Interface.Swap. -func (rs recordSlice) Swap(i, j int) { - rs[i], rs[j] = rs[j], rs[i] -} diff --git a/vendor/github.com/go-openapi/runtime/middleware/denco/server.go b/vendor/github.com/go-openapi/runtime/middleware/denco/server.go deleted file mode 100644 index 0886713c1..000000000 --- a/vendor/github.com/go-openapi/runtime/middleware/denco/server.go +++ /dev/null @@ -1,106 +0,0 @@ -package denco - -import ( - "net/http" -) - -// Mux represents a multiplexer for HTTP request. -type Mux struct{} - -// NewMux returns a new Mux. -func NewMux() *Mux { - return &Mux{} -} - -// GET is shorthand of Mux.Handler("GET", path, handler). -func (m *Mux) GET(path string, handler HandlerFunc) Handler { - return m.Handler("GET", path, handler) -} - -// POST is shorthand of Mux.Handler("POST", path, handler). -func (m *Mux) POST(path string, handler HandlerFunc) Handler { - return m.Handler("POST", path, handler) -} - -// PUT is shorthand of Mux.Handler("PUT", path, handler). -func (m *Mux) PUT(path string, handler HandlerFunc) Handler { - return m.Handler("PUT", path, handler) -} - -// HEAD is shorthand of Mux.Handler("HEAD", path, handler). -func (m *Mux) HEAD(path string, handler HandlerFunc) Handler { - return m.Handler("HEAD", path, handler) -} - -// Handler returns a handler for HTTP method. -func (m *Mux) Handler(method, path string, handler HandlerFunc) Handler { - return Handler{ - Method: method, - Path: path, - Func: handler, - } -} - -// Build builds a http.Handler. -func (m *Mux) Build(handlers []Handler) (http.Handler, error) { - recordMap := make(map[string][]Record) - for _, h := range handlers { - recordMap[h.Method] = append(recordMap[h.Method], NewRecord(h.Path, h.Func)) - } - mux := newServeMux() - for m, records := range recordMap { - router := New() - if err := router.Build(records); err != nil { - return nil, err - } - mux.routers[m] = router - } - return mux, nil -} - -// Handler represents a handler of HTTP request. -type Handler struct { - // Method is an HTTP method. - Method string - - // Path is a routing path for handler. - Path string - - // Func is a function of handler of HTTP request. - Func HandlerFunc -} - -// The HandlerFunc type is aliased to type of handler function. -type HandlerFunc func(w http.ResponseWriter, r *http.Request, params Params) - -type serveMux struct { - routers map[string]*Router -} - -func newServeMux() *serveMux { - return &serveMux{ - routers: make(map[string]*Router), - } -} - -// ServeHTTP implements http.Handler interface. -func (mux *serveMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { - handler, params := mux.handler(r.Method, r.URL.Path) - handler(w, r, params) -} - -func (mux *serveMux) handler(method, path string) (HandlerFunc, []Param) { - if router, found := mux.routers[method]; found { - if handler, params, found := router.Lookup(path); found { - return handler.(HandlerFunc), params - } - } - return NotFound, nil -} - -// NotFound replies to the request with an HTTP 404 not found error. -// NotFound is called when unknown HTTP method or a handler not found. -// If you want to use the your own NotFound handler, please overwrite this variable. -var NotFound = func(w http.ResponseWriter, r *http.Request, _ Params) { - http.NotFound(w, r) -} diff --git a/vendor/github.com/go-openapi/runtime/middleware/denco/util.go b/vendor/github.com/go-openapi/runtime/middleware/denco/util.go deleted file mode 100644 index edc1f6ab8..000000000 --- a/vendor/github.com/go-openapi/runtime/middleware/denco/util.go +++ /dev/null @@ -1,12 +0,0 @@ -package denco - -// NextSeparator returns an index of next separator in path. -func NextSeparator(path string, start int) int { - for start < len(path) { - if c := path[start]; c == '/' || c == TerminationCharacter { - break - } - start++ - } - return start -} diff --git a/vendor/github.com/go-openapi/runtime/middleware/doc.go b/vendor/github.com/go-openapi/runtime/middleware/doc.go deleted file mode 100644 index 836a98850..000000000 --- a/vendor/github.com/go-openapi/runtime/middleware/doc.go +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 middleware provides the library with helper functions for serving swagger APIs. - -Pseudo middleware handler - - import ( - "net/http" - - "github.com/go-openapi/errors" - ) - - func newCompleteMiddleware(ctx *Context) http.Handler { - return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { - // use context to lookup routes - if matched, ok := ctx.RouteInfo(r); ok { - - if matched.NeedsAuth() { - if _, err := ctx.Authorize(r, matched); err != nil { - ctx.Respond(rw, r, matched.Produces, matched, err) - return - } - } - - bound, validation := ctx.BindAndValidate(r, matched) - if validation != nil { - ctx.Respond(rw, r, matched.Produces, matched, validation) - return - } - - result, err := matched.Handler.Handle(bound) - if err != nil { - ctx.Respond(rw, r, matched.Produces, matched, err) - return - } - - ctx.Respond(rw, r, matched.Produces, matched, result) - return - } - - // Not found, check if it exists in the other methods first - if others := ctx.AllowedMethods(r); len(others) > 0 { - ctx.Respond(rw, r, ctx.spec.RequiredProduces(), nil, errors.MethodNotAllowed(r.Method, others)) - return - } - ctx.Respond(rw, r, ctx.spec.RequiredProduces(), nil, errors.NotFound("path %s was not found", r.URL.Path)) - }) - } -*/ -package middleware diff --git a/vendor/github.com/go-openapi/runtime/middleware/header/header.go b/vendor/github.com/go-openapi/runtime/middleware/header/header.go deleted file mode 100644 index df073c87d..000000000 --- a/vendor/github.com/go-openapi/runtime/middleware/header/header.go +++ /dev/null @@ -1,332 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file or at -// https://developers.google.com/open-source/licenses/bsd. - -// this file was taken from the github.com/golang/gddo repository - -// Package header provides functions for parsing HTTP headers. -package header - -import ( - "net/http" - "strings" - "time" -) - -// Octet types from RFC 2616. -var octetTypes [256]octetType - -type octetType byte - -const ( - isToken octetType = 1 << iota - isSpace -) - -func init() { - // OCTET = - // CHAR = - // CTL = - // CR = - // LF = - // SP = - // HT = - // <"> = - // CRLF = CR LF - // LWS = [CRLF] 1*( SP | HT ) - // TEXT = - // separators = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\" | <"> - // | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HT - // token = 1* - // qdtext = > - - for c := 0; c < 256; c++ { - var t octetType - isCtl := c <= 31 || c == 127 - isChar := 0 <= c && c <= 127 - isSeparator := strings.ContainsRune(" \t\"(),/:;<=>?@[]\\{}", rune(c)) - if strings.ContainsRune(" \t\r\n", rune(c)) { - t |= isSpace - } - if isChar && !isCtl && !isSeparator { - t |= isToken - } - octetTypes[c] = t - } -} - -// Copy returns a shallow copy of the header. -func Copy(header http.Header) http.Header { - h := make(http.Header) - for k, vs := range header { - h[k] = vs - } - return h -} - -var timeLayouts = []string{"Mon, 02 Jan 2006 15:04:05 GMT", time.RFC850, time.ANSIC} - -// ParseTime parses the header as time. The zero value is returned if the -// header is not present or there is an error parsing the -// header. -func ParseTime(header http.Header, key string) time.Time { - if s := header.Get(key); s != "" { - for _, layout := range timeLayouts { - if t, err := time.Parse(layout, s); err == nil { - return t.UTC() - } - } - } - return time.Time{} -} - -// ParseList parses a comma separated list of values. Commas are ignored in -// quoted strings. Quoted values are not unescaped or unquoted. Whitespace is -// trimmed. -func ParseList(header http.Header, key string) []string { - var result []string - for _, s := range header[http.CanonicalHeaderKey(key)] { - begin := 0 - end := 0 - escape := false - quote := false - for i := 0; i < len(s); i++ { - b := s[i] - switch { - case escape: - escape = false - end = i + 1 - case quote: - switch b { - case '\\': - escape = true - case '"': - quote = false - } - end = i + 1 - case b == '"': - quote = true - end = i + 1 - case octetTypes[b]&isSpace != 0: - if begin == end { - begin = i + 1 - end = begin - } - case b == ',': - if begin < end { - result = append(result, s[begin:end]) - } - begin = i + 1 - end = begin - default: - end = i + 1 - } - } - if begin < end { - result = append(result, s[begin:end]) - } - } - return result -} - -// ParseValueAndParams parses a comma separated list of values with optional -// semicolon separated name-value pairs. Content-Type and Content-Disposition -// headers are in this format. -func ParseValueAndParams(header http.Header, key string) (string, map[string]string) { - return parseValueAndParams(header.Get(key)) -} - -func parseValueAndParams(s string) (value string, params map[string]string) { - params = make(map[string]string) - value, s = expectTokenSlash(s) - if value == "" { - return - } - value = strings.ToLower(value) - s = skipSpace(s) - for strings.HasPrefix(s, ";") { - var pkey string - pkey, s = expectToken(skipSpace(s[1:])) - if pkey == "" { - return - } - if !strings.HasPrefix(s, "=") { - return - } - var pvalue string - pvalue, s = expectTokenOrQuoted(s[1:]) - if pvalue == "" { - return - } - pkey = strings.ToLower(pkey) - params[pkey] = pvalue - s = skipSpace(s) - } - return -} - -// AcceptSpec ... -type AcceptSpec struct { - Value string - Q float64 -} - -// ParseAccept2 ... -func ParseAccept2(header http.Header, key string) (specs []AcceptSpec) { - for _, en := range ParseList(header, key) { - v, p := parseValueAndParams(en) - var spec AcceptSpec - spec.Value = v - spec.Q = 1.0 - if p != nil { - if q, ok := p["q"]; ok { - spec.Q, _ = expectQuality(q) - } - } - if spec.Q < 0.0 { - continue - } - specs = append(specs, spec) - } - - return -} - -// ParseAccept parses Accept* headers. -func ParseAccept(header http.Header, key string) []AcceptSpec { - var specs []AcceptSpec -loop: - for _, s := range header[key] { - for { - var spec AcceptSpec - spec.Value, s = expectTokenSlash(s) - if spec.Value == "" { - continue loop - } - spec.Q = 1.0 - s = skipSpace(s) - if strings.HasPrefix(s, ";") { - s = skipSpace(s[1:]) - for !strings.HasPrefix(s, "q=") && s != "" && !strings.HasPrefix(s, ",") { - s = skipSpace(s[1:]) - } - if strings.HasPrefix(s, "q=") { - spec.Q, s = expectQuality(s[2:]) - if spec.Q < 0.0 { - continue loop - } - } - } - - specs = append(specs, spec) - s = skipSpace(s) - if !strings.HasPrefix(s, ",") { - continue loop - } - s = skipSpace(s[1:]) - } - } - - return specs -} - -func skipSpace(s string) (rest string) { - i := 0 - for ; i < len(s); i++ { - if octetTypes[s[i]]&isSpace == 0 { - break - } - } - return s[i:] -} - -func expectToken(s string) (token, rest string) { - i := 0 - for ; i < len(s); i++ { - if octetTypes[s[i]]&isToken == 0 { - break - } - } - return s[:i], s[i:] -} - -func expectTokenSlash(s string) (token, rest string) { - i := 0 - for ; i < len(s); i++ { - b := s[i] - if (octetTypes[b]&isToken == 0) && b != '/' { - break - } - } - return s[:i], s[i:] -} - -func expectQuality(s string) (q float64, rest string) { - switch { - case len(s) == 0: - return -1, "" - case s[0] == '0': - // q is already 0 - s = s[1:] - case s[0] == '1': - s = s[1:] - q = 1 - case s[0] == '.': - // q is already 0 - default: - return -1, "" - } - if !strings.HasPrefix(s, ".") { - return q, s - } - s = s[1:] - i := 0 - n := 0 - d := 1 - for ; i < len(s); i++ { - b := s[i] - if b < '0' || b > '9' { - break - } - n = n*10 + int(b) - '0' - d *= 10 - } - return q + float64(n)/float64(d), s[i:] -} - -func expectTokenOrQuoted(s string) (value string, rest string) { - if !strings.HasPrefix(s, "\"") { - return expectToken(s) - } - s = s[1:] - for i := 0; i < len(s); i++ { - switch s[i] { - case '"': - return s[:i], s[i+1:] - case '\\': - p := make([]byte, len(s)-1) - j := copy(p, s[:i]) - escape := true - for i++; i < len(s); i++ { - b := s[i] - switch { - case escape: - escape = false - p[j] = b - j++ - case b == '\\': - escape = true - case b == '"': - return string(p[:j]), s[i+1:] - default: - p[j] = b - j++ - } - } - return "", "" - } - } - return "", "" -} diff --git a/vendor/github.com/go-openapi/runtime/middleware/negotiate.go b/vendor/github.com/go-openapi/runtime/middleware/negotiate.go deleted file mode 100644 index a9b6f27d3..000000000 --- a/vendor/github.com/go-openapi/runtime/middleware/negotiate.go +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file or at -// https://developers.google.com/open-source/licenses/bsd. - -// this file was taken from the github.com/golang/gddo repository - -package middleware - -import ( - "net/http" - "strings" - - "github.com/go-openapi/runtime/middleware/header" -) - -// NegotiateContentEncoding returns the best offered content encoding for the -// request's Accept-Encoding header. If two offers match with equal weight and -// then the offer earlier in the list is preferred. If no offers are -// acceptable, then "" is returned. -func NegotiateContentEncoding(r *http.Request, offers []string) string { - bestOffer := "identity" - bestQ := -1.0 - specs := header.ParseAccept(r.Header, "Accept-Encoding") - for _, offer := range offers { - for _, spec := range specs { - if spec.Q > bestQ && - (spec.Value == "*" || spec.Value == offer) { - bestQ = spec.Q - bestOffer = offer - } - } - } - if bestQ == 0 { - bestOffer = "" - } - return bestOffer -} - -// NegotiateContentType returns the best offered content type for the request's -// Accept header. If two offers match with equal weight, then the more specific -// offer is preferred. For example, text/* trumps */*. If two offers match -// with equal weight and specificity, then the offer earlier in the list is -// preferred. If no offers match, then defaultOffer is returned. -func NegotiateContentType(r *http.Request, offers []string, defaultOffer string) string { - bestOffer := defaultOffer - bestQ := -1.0 - bestWild := 3 - specs := header.ParseAccept(r.Header, "Accept") - for _, rawOffer := range offers { - offer := normalizeOffer(rawOffer) - // No Accept header: just return the first offer. - if len(specs) == 0 { - return rawOffer - } - for _, spec := range specs { - switch { - case spec.Q == 0.0: - // ignore - case spec.Q < bestQ: - // better match found - case spec.Value == "*/*": - if spec.Q > bestQ || bestWild > 2 { - bestQ = spec.Q - bestWild = 2 - bestOffer = rawOffer - } - case strings.HasSuffix(spec.Value, "/*"): - if strings.HasPrefix(offer, spec.Value[:len(spec.Value)-1]) && - (spec.Q > bestQ || bestWild > 1) { - bestQ = spec.Q - bestWild = 1 - bestOffer = rawOffer - } - default: - if spec.Value == offer && - (spec.Q > bestQ || bestWild > 0) { - bestQ = spec.Q - bestWild = 0 - bestOffer = rawOffer - } - } - } - } - return bestOffer -} - -func normalizeOffers(orig []string) (norm []string) { - for _, o := range orig { - norm = append(norm, normalizeOffer(o)) - } - return -} - -func normalizeOffer(orig string) string { - return strings.SplitN(orig, ";", 2)[0] -} diff --git a/vendor/github.com/go-openapi/runtime/middleware/not_implemented.go b/vendor/github.com/go-openapi/runtime/middleware/not_implemented.go deleted file mode 100644 index bc6942a0f..000000000 --- a/vendor/github.com/go-openapi/runtime/middleware/not_implemented.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 middleware - -import ( - "net/http" - - "github.com/go-openapi/runtime" -) - -type errorResp struct { - code int - response interface{} - headers http.Header -} - -func (e *errorResp) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - for k, v := range e.headers { - for _, val := range v { - rw.Header().Add(k, val) - } - } - if e.code > 0 { - rw.WriteHeader(e.code) - } else { - rw.WriteHeader(http.StatusInternalServerError) - } - if err := producer.Produce(rw, e.response); err != nil { - Logger.Printf("failed to write error response: %v", err) - } -} - -// NotImplemented the error response when the response is not implemented -func NotImplemented(message string) Responder { - return Error(http.StatusNotImplemented, message) -} - -// Error creates a generic responder for returning errors, the data will be serialized -// with the matching producer for the request -func Error(code int, data interface{}, headers ...http.Header) Responder { - var hdr http.Header - for _, h := range headers { - for k, v := range h { - if hdr == nil { - hdr = make(http.Header) - } - hdr[k] = v - } - } - return &errorResp{ - code: code, - response: data, - headers: hdr, - } -} diff --git a/vendor/github.com/go-openapi/runtime/middleware/operation.go b/vendor/github.com/go-openapi/runtime/middleware/operation.go deleted file mode 100644 index 1175a63cf..000000000 --- a/vendor/github.com/go-openapi/runtime/middleware/operation.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 middleware - -import "net/http" - -// NewOperationExecutor creates a context aware middleware that handles the operations after routing -func NewOperationExecutor(ctx *Context) http.Handler { - return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { - // use context to lookup routes - route, rCtx, _ := ctx.RouteInfo(r) - if rCtx != nil { - r = rCtx - } - - route.Handler.ServeHTTP(rw, r) - }) -} diff --git a/vendor/github.com/go-openapi/runtime/middleware/parameter.go b/vendor/github.com/go-openapi/runtime/middleware/parameter.go deleted file mode 100644 index 9c3353a95..000000000 --- a/vendor/github.com/go-openapi/runtime/middleware/parameter.go +++ /dev/null @@ -1,491 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 middleware - -import ( - "encoding" - "encoding/base64" - "fmt" - "io" - "net/http" - "reflect" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/spec" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" - - "github.com/go-openapi/runtime" -) - -const defaultMaxMemory = 32 << 20 - -const ( - typeString = "string" - typeArray = "array" -) - -var textUnmarshalType = reflect.TypeOf(new(encoding.TextUnmarshaler)).Elem() - -func newUntypedParamBinder(param spec.Parameter, spec *spec.Swagger, formats strfmt.Registry) *untypedParamBinder { - binder := new(untypedParamBinder) - binder.Name = param.Name - binder.parameter = ¶m - binder.formats = formats - if param.In != "body" { - binder.validator = validate.NewParamValidator(¶m, formats) - } else { - binder.validator = validate.NewSchemaValidator(param.Schema, spec, param.Name, formats) - } - - return binder -} - -type untypedParamBinder struct { - parameter *spec.Parameter - formats strfmt.Registry - Name string - validator validate.EntityValidator -} - -func (p *untypedParamBinder) Type() reflect.Type { - return p.typeForSchema(p.parameter.Type, p.parameter.Format, p.parameter.Items) -} - -func (p *untypedParamBinder) typeForSchema(tpe, format string, items *spec.Items) reflect.Type { - switch tpe { - case "boolean": - return reflect.TypeOf(true) - - case typeString: - if tt, ok := p.formats.GetType(format); ok { - return tt - } - return reflect.TypeOf("") - - case "integer": - switch format { - case "int8": - return reflect.TypeOf(int8(0)) - case "int16": - return reflect.TypeOf(int16(0)) - case "int32": - return reflect.TypeOf(int32(0)) - case "int64": - return reflect.TypeOf(int64(0)) - default: - return reflect.TypeOf(int64(0)) - } - - case "number": - switch format { - case "float": - return reflect.TypeOf(float32(0)) - case "double": - return reflect.TypeOf(float64(0)) - } - - case typeArray: - if items == nil { - return nil - } - itemsType := p.typeForSchema(items.Type, items.Format, items.Items) - if itemsType == nil { - return nil - } - return reflect.MakeSlice(reflect.SliceOf(itemsType), 0, 0).Type() - - case "file": - return reflect.TypeOf(&runtime.File{}).Elem() - - case "object": - return reflect.TypeOf(map[string]interface{}{}) - } - return nil -} - -func (p *untypedParamBinder) allowsMulti() bool { - return p.parameter.In == "query" || p.parameter.In == "formData" -} - -func (p *untypedParamBinder) readValue(values runtime.Gettable, target reflect.Value) ([]string, bool, bool, error) { - name, in, cf, tpe := p.parameter.Name, p.parameter.In, p.parameter.CollectionFormat, p.parameter.Type - if tpe == typeArray { - if cf == "multi" { - if !p.allowsMulti() { - return nil, false, false, errors.InvalidCollectionFormat(name, in, cf) - } - vv, hasKey, _ := values.GetOK(name) - return vv, false, hasKey, nil - } - - v, hk, hv := values.GetOK(name) - if !hv { - return nil, false, hk, nil - } - d, c, e := p.readFormattedSliceFieldValue(v[len(v)-1], target) - return d, c, hk, e - } - - vv, hk, _ := values.GetOK(name) - return vv, false, hk, nil -} - -func (p *untypedParamBinder) Bind(request *http.Request, routeParams RouteParams, consumer runtime.Consumer, target reflect.Value) error { - // fmt.Println("binding", p.name, "as", p.Type()) - switch p.parameter.In { - case "query": - data, custom, hasKey, err := p.readValue(runtime.Values(request.URL.Query()), target) - if err != nil { - return err - } - if custom { - return nil - } - - return p.bindValue(data, hasKey, target) - - case "header": - data, custom, hasKey, err := p.readValue(runtime.Values(request.Header), target) - if err != nil { - return err - } - if custom { - return nil - } - return p.bindValue(data, hasKey, target) - - case "path": - data, custom, hasKey, err := p.readValue(routeParams, target) - if err != nil { - return err - } - if custom { - return nil - } - return p.bindValue(data, hasKey, target) - - case "formData": - var err error - var mt string - - mt, _, e := runtime.ContentType(request.Header) - if e != nil { - // because of the interface conversion go thinks the error is not nil - // so we first check for nil and then set the err var if it's not nil - err = e - } - - if err != nil { - return errors.InvalidContentType("", []string{"multipart/form-data", "application/x-www-form-urlencoded"}) - } - - if mt != "multipart/form-data" && mt != "application/x-www-form-urlencoded" { - return errors.InvalidContentType(mt, []string{"multipart/form-data", "application/x-www-form-urlencoded"}) - } - - if mt == "multipart/form-data" { - if err = request.ParseMultipartForm(defaultMaxMemory); err != nil { - return errors.NewParseError(p.Name, p.parameter.In, "", err) - } - } - - if err = request.ParseForm(); err != nil { - return errors.NewParseError(p.Name, p.parameter.In, "", err) - } - - if p.parameter.Type == "file" { - file, header, ffErr := request.FormFile(p.parameter.Name) - if ffErr != nil { - if p.parameter.Required { - return errors.NewParseError(p.Name, p.parameter.In, "", ffErr) - } - - return nil - } - - target.Set(reflect.ValueOf(runtime.File{Data: file, Header: header})) - return nil - } - - if request.MultipartForm != nil { - data, custom, hasKey, rvErr := p.readValue(runtime.Values(request.MultipartForm.Value), target) - if rvErr != nil { - return rvErr - } - if custom { - return nil - } - return p.bindValue(data, hasKey, target) - } - data, custom, hasKey, err := p.readValue(runtime.Values(request.PostForm), target) - if err != nil { - return err - } - if custom { - return nil - } - return p.bindValue(data, hasKey, target) - - case "body": - newValue := reflect.New(target.Type()) - if !runtime.HasBody(request) { - if p.parameter.Default != nil { - target.Set(reflect.ValueOf(p.parameter.Default)) - } - - return nil - } - if err := consumer.Consume(request.Body, newValue.Interface()); err != nil { - if err == io.EOF && p.parameter.Default != nil { - target.Set(reflect.ValueOf(p.parameter.Default)) - return nil - } - tpe := p.parameter.Type - if p.parameter.Format != "" { - tpe = p.parameter.Format - } - return errors.InvalidType(p.Name, p.parameter.In, tpe, nil) - } - target.Set(reflect.Indirect(newValue)) - return nil - default: - return errors.New(500, fmt.Sprintf("invalid parameter location %q", p.parameter.In)) - } -} - -func (p *untypedParamBinder) bindValue(data []string, hasKey bool, target reflect.Value) error { - if p.parameter.Type == typeArray { - return p.setSliceFieldValue(target, p.parameter.Default, data, hasKey) - } - var d string - if len(data) > 0 { - d = data[len(data)-1] - } - return p.setFieldValue(target, p.parameter.Default, d, hasKey) -} - -func (p *untypedParamBinder) setFieldValue(target reflect.Value, defaultValue interface{}, data string, hasKey bool) error { //nolint:gocyclo - tpe := p.parameter.Type - if p.parameter.Format != "" { - tpe = p.parameter.Format - } - - if (!hasKey || (!p.parameter.AllowEmptyValue && data == "")) && p.parameter.Required && p.parameter.Default == nil { - return errors.Required(p.Name, p.parameter.In, data) - } - - ok, err := p.tryUnmarshaler(target, defaultValue, data) - if err != nil { - return errors.InvalidType(p.Name, p.parameter.In, tpe, data) - } - if ok { - return nil - } - - defVal := reflect.Zero(target.Type()) - if defaultValue != nil { - defVal = reflect.ValueOf(defaultValue) - } - - if tpe == "byte" { - if data == "" { - if target.CanSet() { - target.SetBytes(defVal.Bytes()) - } - return nil - } - - b, err := base64.StdEncoding.DecodeString(data) - if err != nil { - b, err = base64.URLEncoding.DecodeString(data) - if err != nil { - return errors.InvalidType(p.Name, p.parameter.In, tpe, data) - } - } - if target.CanSet() { - target.SetBytes(b) - } - return nil - } - - switch target.Kind() { //nolint:exhaustive // we want to check only types that map from a swagger parameter - case reflect.Bool: - if data == "" { - if target.CanSet() { - target.SetBool(defVal.Bool()) - } - return nil - } - b, err := swag.ConvertBool(data) - if err != nil { - return err - } - if target.CanSet() { - target.SetBool(b) - } - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - if data == "" { - if target.CanSet() { - rd := defVal.Convert(reflect.TypeOf(int64(0))) - target.SetInt(rd.Int()) - } - return nil - } - i, err := strconv.ParseInt(data, 10, 64) - if err != nil { - return errors.InvalidType(p.Name, p.parameter.In, tpe, data) - } - if target.OverflowInt(i) { - return errors.InvalidType(p.Name, p.parameter.In, tpe, data) - } - if target.CanSet() { - target.SetInt(i) - } - - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - if data == "" { - if target.CanSet() { - rd := defVal.Convert(reflect.TypeOf(uint64(0))) - target.SetUint(rd.Uint()) - } - return nil - } - u, err := strconv.ParseUint(data, 10, 64) - if err != nil { - return errors.InvalidType(p.Name, p.parameter.In, tpe, data) - } - if target.OverflowUint(u) { - return errors.InvalidType(p.Name, p.parameter.In, tpe, data) - } - if target.CanSet() { - target.SetUint(u) - } - - case reflect.Float32, reflect.Float64: - if data == "" { - if target.CanSet() { - rd := defVal.Convert(reflect.TypeOf(float64(0))) - target.SetFloat(rd.Float()) - } - return nil - } - f, err := strconv.ParseFloat(data, 64) - if err != nil { - return errors.InvalidType(p.Name, p.parameter.In, tpe, data) - } - if target.OverflowFloat(f) { - return errors.InvalidType(p.Name, p.parameter.In, tpe, data) - } - if target.CanSet() { - target.SetFloat(f) - } - - case reflect.String: - value := data - if value == "" { - value = defVal.String() - } - // validate string - if target.CanSet() { - target.SetString(value) - } - - case reflect.Ptr: - if data == "" && defVal.Kind() == reflect.Ptr { - if target.CanSet() { - target.Set(defVal) - } - return nil - } - newVal := reflect.New(target.Type().Elem()) - if err := p.setFieldValue(reflect.Indirect(newVal), defVal, data, hasKey); err != nil { - return err - } - if target.CanSet() { - target.Set(newVal) - } - - default: - return errors.InvalidType(p.Name, p.parameter.In, tpe, data) - } - return nil -} - -func (p *untypedParamBinder) tryUnmarshaler(target reflect.Value, defaultValue interface{}, data string) (bool, error) { - if !target.CanSet() { - return false, nil - } - // When a type implements encoding.TextUnmarshaler we'll use that instead of reflecting some more - if reflect.PtrTo(target.Type()).Implements(textUnmarshalType) { - if defaultValue != nil && len(data) == 0 { - target.Set(reflect.ValueOf(defaultValue)) - return true, nil - } - value := reflect.New(target.Type()) - if err := value.Interface().(encoding.TextUnmarshaler).UnmarshalText([]byte(data)); err != nil { - return true, err - } - target.Set(reflect.Indirect(value)) - return true, nil - } - return false, nil -} - -func (p *untypedParamBinder) readFormattedSliceFieldValue(data string, target reflect.Value) ([]string, bool, error) { - ok, err := p.tryUnmarshaler(target, p.parameter.Default, data) - if err != nil { - return nil, true, err - } - if ok { - return nil, true, nil - } - - return swag.SplitByFormat(data, p.parameter.CollectionFormat), false, nil -} - -func (p *untypedParamBinder) setSliceFieldValue(target reflect.Value, defaultValue interface{}, data []string, hasKey bool) error { - sz := len(data) - if (!hasKey || (!p.parameter.AllowEmptyValue && (sz == 0 || (sz == 1 && data[0] == "")))) && p.parameter.Required && defaultValue == nil { - return errors.Required(p.Name, p.parameter.In, data) - } - - defVal := reflect.Zero(target.Type()) - if defaultValue != nil { - defVal = reflect.ValueOf(defaultValue) - } - - if !target.CanSet() { - return nil - } - if sz == 0 { - target.Set(defVal) - return nil - } - - value := reflect.MakeSlice(reflect.SliceOf(target.Type().Elem()), sz, sz) - - for i := 0; i < sz; i++ { - if err := p.setFieldValue(value.Index(i), nil, data[i], hasKey); err != nil { - return err - } - } - - target.Set(value) - - return nil -} diff --git a/vendor/github.com/go-openapi/runtime/middleware/rapidoc.go b/vendor/github.com/go-openapi/runtime/middleware/rapidoc.go deleted file mode 100644 index ef75e7441..000000000 --- a/vendor/github.com/go-openapi/runtime/middleware/rapidoc.go +++ /dev/null @@ -1,80 +0,0 @@ -package middleware - -import ( - "bytes" - "fmt" - "html/template" - "net/http" - "path" -) - -// RapiDocOpts configures the RapiDoc middlewares -type RapiDocOpts struct { - // BasePath for the UI, defaults to: / - BasePath string - - // Path combines with BasePath to construct the path to the UI, defaults to: "docs". - Path string - - // SpecURL is the URL of the spec document. - // - // Defaults to: /swagger.json - SpecURL string - - // Title for the documentation site, default to: API documentation - Title string - - // Template specifies a custom template to serve the UI - Template string - - // RapiDocURL points to the js asset that generates the rapidoc site. - // - // Defaults to https://unpkg.com/rapidoc/dist/rapidoc-min.js - RapiDocURL string -} - -func (r *RapiDocOpts) EnsureDefaults() { - common := toCommonUIOptions(r) - common.EnsureDefaults() - fromCommonToAnyOptions(common, r) - - // rapidoc-specifics - if r.RapiDocURL == "" { - r.RapiDocURL = rapidocLatest - } - if r.Template == "" { - r.Template = rapidocTemplate - } -} - -// RapiDoc creates a middleware to serve a documentation site for a swagger spec. -// -// This allows for altering the spec before starting the http listener. -func RapiDoc(opts RapiDocOpts, next http.Handler) http.Handler { - opts.EnsureDefaults() - - pth := path.Join(opts.BasePath, opts.Path) - tmpl := template.Must(template.New("rapidoc").Parse(opts.Template)) - assets := bytes.NewBuffer(nil) - if err := tmpl.Execute(assets, opts); err != nil { - panic(fmt.Errorf("cannot execute template: %w", err)) - } - - return serveUI(pth, assets.Bytes(), next) -} - -const ( - rapidocLatest = "https://unpkg.com/rapidoc/dist/rapidoc-min.js" - rapidocTemplate = ` - - - {{ .Title }} - - - - - - - -` -) diff --git a/vendor/github.com/go-openapi/runtime/middleware/redoc.go b/vendor/github.com/go-openapi/runtime/middleware/redoc.go deleted file mode 100644 index b96b01e7f..000000000 --- a/vendor/github.com/go-openapi/runtime/middleware/redoc.go +++ /dev/null @@ -1,94 +0,0 @@ -package middleware - -import ( - "bytes" - "fmt" - "html/template" - "net/http" - "path" -) - -// RedocOpts configures the Redoc middlewares -type RedocOpts struct { - // BasePath for the UI, defaults to: / - BasePath string - - // Path combines with BasePath to construct the path to the UI, defaults to: "docs". - Path string - - // SpecURL is the URL of the spec document. - // - // Defaults to: /swagger.json - SpecURL string - - // Title for the documentation site, default to: API documentation - Title string - - // Template specifies a custom template to serve the UI - Template string - - // RedocURL points to the js that generates the redoc site. - // - // Defaults to: https://cdn.jsdelivr.net/npm/redoc/bundles/redoc.standalone.js - RedocURL string -} - -// EnsureDefaults in case some options are missing -func (r *RedocOpts) EnsureDefaults() { - common := toCommonUIOptions(r) - common.EnsureDefaults() - fromCommonToAnyOptions(common, r) - - // redoc-specifics - if r.RedocURL == "" { - r.RedocURL = redocLatest - } - if r.Template == "" { - r.Template = redocTemplate - } -} - -// Redoc creates a middleware to serve a documentation site for a swagger spec. -// -// This allows for altering the spec before starting the http listener. -func Redoc(opts RedocOpts, next http.Handler) http.Handler { - opts.EnsureDefaults() - - pth := path.Join(opts.BasePath, opts.Path) - tmpl := template.Must(template.New("redoc").Parse(opts.Template)) - assets := bytes.NewBuffer(nil) - if err := tmpl.Execute(assets, opts); err != nil { - panic(fmt.Errorf("cannot execute template: %w", err)) - } - - return serveUI(pth, assets.Bytes(), next) -} - -const ( - redocLatest = "https://cdn.jsdelivr.net/npm/redoc/bundles/redoc.standalone.js" - redocTemplate = ` - - - {{ .Title }} - - - - - - - - - - - - - -` -) diff --git a/vendor/github.com/go-openapi/runtime/middleware/request.go b/vendor/github.com/go-openapi/runtime/middleware/request.go deleted file mode 100644 index 82e143665..000000000 --- a/vendor/github.com/go-openapi/runtime/middleware/request.go +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 middleware - -import ( - "net/http" - "reflect" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/logger" - "github.com/go-openapi/spec" - "github.com/go-openapi/strfmt" -) - -// UntypedRequestBinder binds and validates the data from a http request -type UntypedRequestBinder struct { - Spec *spec.Swagger - Parameters map[string]spec.Parameter - Formats strfmt.Registry - paramBinders map[string]*untypedParamBinder - debugLogf func(string, ...any) // a logging function to debug context and all components using it -} - -// NewUntypedRequestBinder creates a new binder for reading a request. -func NewUntypedRequestBinder(parameters map[string]spec.Parameter, spec *spec.Swagger, formats strfmt.Registry) *UntypedRequestBinder { - binders := make(map[string]*untypedParamBinder) - for fieldName, param := range parameters { - binders[fieldName] = newUntypedParamBinder(param, spec, formats) - } - return &UntypedRequestBinder{ - Parameters: parameters, - paramBinders: binders, - Spec: spec, - Formats: formats, - debugLogf: debugLogfFunc(nil), - } -} - -// Bind perform the databinding and validation -func (o *UntypedRequestBinder) Bind(request *http.Request, routeParams RouteParams, consumer runtime.Consumer, data interface{}) error { - val := reflect.Indirect(reflect.ValueOf(data)) - isMap := val.Kind() == reflect.Map - var result []error - o.debugLogf("binding %d parameters for %s %s", len(o.Parameters), request.Method, request.URL.EscapedPath()) - for fieldName, param := range o.Parameters { - binder := o.paramBinders[fieldName] - o.debugLogf("binding parameter %s for %s %s", fieldName, request.Method, request.URL.EscapedPath()) - var target reflect.Value - if !isMap { - binder.Name = fieldName - target = val.FieldByName(fieldName) - } - - if isMap { - tpe := binder.Type() - if tpe == nil { - if param.Schema.Type.Contains(typeArray) { - tpe = reflect.TypeOf([]interface{}{}) - } else { - tpe = reflect.TypeOf(map[string]interface{}{}) - } - } - target = reflect.Indirect(reflect.New(tpe)) - } - - if !target.IsValid() { - result = append(result, errors.New(500, "parameter name %q is an unknown field", binder.Name)) - continue - } - - if err := binder.Bind(request, routeParams, consumer, target); err != nil { - result = append(result, err) - continue - } - - if binder.validator != nil { - rr := binder.validator.Validate(target.Interface()) - if rr != nil && rr.HasErrors() { - result = append(result, rr.AsError()) - } - } - - if isMap { - val.SetMapIndex(reflect.ValueOf(param.Name), target) - } - } - - if len(result) > 0 { - return errors.CompositeValidationError(result...) - } - - return nil -} - -// SetLogger allows for injecting a logger to catch debug entries. -// -// The logger is enabled in DEBUG mode only. -func (o *UntypedRequestBinder) SetLogger(lg logger.Logger) { - o.debugLogf = debugLogfFunc(lg) -} - -func (o *UntypedRequestBinder) setDebugLogf(fn func(string, ...any)) { - o.debugLogf = fn -} diff --git a/vendor/github.com/go-openapi/runtime/middleware/router.go b/vendor/github.com/go-openapi/runtime/middleware/router.go deleted file mode 100644 index 3a6aee90e..000000000 --- a/vendor/github.com/go-openapi/runtime/middleware/router.go +++ /dev/null @@ -1,531 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 middleware - -import ( - "fmt" - "net/http" - "net/url" - fpath "path" - "regexp" - "strings" - - "github.com/go-openapi/runtime/logger" - "github.com/go-openapi/runtime/security" - "github.com/go-openapi/swag" - - "github.com/go-openapi/analysis" - "github.com/go-openapi/errors" - "github.com/go-openapi/loads" - "github.com/go-openapi/spec" - "github.com/go-openapi/strfmt" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware/denco" -) - -// RouteParam is a object to capture route params in a framework agnostic way. -// implementations of the muxer should use these route params to communicate with the -// swagger framework -type RouteParam struct { - Name string - Value string -} - -// RouteParams the collection of route params -type RouteParams []RouteParam - -// Get gets the value for the route param for the specified key -func (r RouteParams) Get(name string) string { - vv, _, _ := r.GetOK(name) - if len(vv) > 0 { - return vv[len(vv)-1] - } - return "" -} - -// GetOK gets the value but also returns booleans to indicate if a key or value -// is present. This aids in validation and satisfies an interface in use there -// -// The returned values are: data, has key, has value -func (r RouteParams) GetOK(name string) ([]string, bool, bool) { - for _, p := range r { - if p.Name == name { - return []string{p.Value}, true, p.Value != "" - } - } - return nil, false, false -} - -// NewRouter creates a new context-aware router middleware -func NewRouter(ctx *Context, next http.Handler) http.Handler { - if ctx.router == nil { - ctx.router = DefaultRouter(ctx.spec, ctx.api, WithDefaultRouterLoggerFunc(ctx.debugLogf)) - } - - return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { - if _, rCtx, ok := ctx.RouteInfo(r); ok { - next.ServeHTTP(rw, rCtx) - return - } - - // Not found, check if it exists in the other methods first - if others := ctx.AllowedMethods(r); len(others) > 0 { - ctx.Respond(rw, r, ctx.analyzer.RequiredProduces(), nil, errors.MethodNotAllowed(r.Method, others)) - return - } - - ctx.Respond(rw, r, ctx.analyzer.RequiredProduces(), nil, errors.NotFound("path %s was not found", r.URL.EscapedPath())) - }) -} - -// RoutableAPI represents an interface for things that can serve -// as a provider of implementations for the swagger router -type RoutableAPI interface { - HandlerFor(string, string) (http.Handler, bool) - ServeErrorFor(string) func(http.ResponseWriter, *http.Request, error) - ConsumersFor([]string) map[string]runtime.Consumer - ProducersFor([]string) map[string]runtime.Producer - AuthenticatorsFor(map[string]spec.SecurityScheme) map[string]runtime.Authenticator - Authorizer() runtime.Authorizer - Formats() strfmt.Registry - DefaultProduces() string - DefaultConsumes() string -} - -// Router represents a swagger-aware router -type Router interface { - Lookup(method, path string) (*MatchedRoute, bool) - OtherMethods(method, path string) []string -} - -type defaultRouteBuilder struct { - spec *loads.Document - analyzer *analysis.Spec - api RoutableAPI - records map[string][]denco.Record - debugLogf func(string, ...any) // a logging function to debug context and all components using it -} - -type defaultRouter struct { - spec *loads.Document - routers map[string]*denco.Router - debugLogf func(string, ...any) // a logging function to debug context and all components using it -} - -func newDefaultRouteBuilder(spec *loads.Document, api RoutableAPI, opts ...DefaultRouterOpt) *defaultRouteBuilder { - var o defaultRouterOpts - for _, apply := range opts { - apply(&o) - } - if o.debugLogf == nil { - o.debugLogf = debugLogfFunc(nil) // defaults to standard logger - } - - return &defaultRouteBuilder{ - spec: spec, - analyzer: analysis.New(spec.Spec()), - api: api, - records: make(map[string][]denco.Record), - debugLogf: o.debugLogf, - } -} - -// DefaultRouterOpt allows to inject optional behavior to the default router. -type DefaultRouterOpt func(*defaultRouterOpts) - -type defaultRouterOpts struct { - debugLogf func(string, ...any) -} - -// WithDefaultRouterLogger sets the debug logger for the default router. -// -// This is enabled only in DEBUG mode. -func WithDefaultRouterLogger(lg logger.Logger) DefaultRouterOpt { - return func(o *defaultRouterOpts) { - o.debugLogf = debugLogfFunc(lg) - } -} - -// WithDefaultRouterLoggerFunc sets a logging debug method for the default router. -func WithDefaultRouterLoggerFunc(fn func(string, ...any)) DefaultRouterOpt { - return func(o *defaultRouterOpts) { - o.debugLogf = fn - } -} - -// DefaultRouter creates a default implementation of the router -func DefaultRouter(spec *loads.Document, api RoutableAPI, opts ...DefaultRouterOpt) Router { - builder := newDefaultRouteBuilder(spec, api, opts...) - if spec != nil { - for method, paths := range builder.analyzer.Operations() { - for path, operation := range paths { - fp := fpath.Join(spec.BasePath(), path) - builder.debugLogf("adding route %s %s %q", method, fp, operation.ID) - builder.AddRoute(method, fp, operation) - } - } - } - return builder.Build() -} - -// RouteAuthenticator is an authenticator that can compose several authenticators together. -// It also knows when it contains an authenticator that allows for anonymous pass through. -// Contains a group of 1 or more authenticators that have a logical AND relationship -type RouteAuthenticator struct { - Authenticator map[string]runtime.Authenticator - Schemes []string - Scopes map[string][]string - allScopes []string - commonScopes []string - allowAnonymous bool -} - -func (ra *RouteAuthenticator) AllowsAnonymous() bool { - return ra.allowAnonymous -} - -// AllScopes returns a list of unique scopes that is the combination -// of all the scopes in the requirements -func (ra *RouteAuthenticator) AllScopes() []string { - return ra.allScopes -} - -// CommonScopes returns a list of unique scopes that are common in all the -// scopes in the requirements -func (ra *RouteAuthenticator) CommonScopes() []string { - return ra.commonScopes -} - -// Authenticate Authenticator interface implementation -func (ra *RouteAuthenticator) Authenticate(req *http.Request, route *MatchedRoute) (bool, interface{}, error) { - if ra.allowAnonymous { - route.Authenticator = ra - return true, nil, nil - } - // iterate in proper order - var lastResult interface{} - for _, scheme := range ra.Schemes { - if authenticator, ok := ra.Authenticator[scheme]; ok { - applies, princ, err := authenticator.Authenticate(&security.ScopedAuthRequest{ - Request: req, - RequiredScopes: ra.Scopes[scheme], - }) - if !applies { - return false, nil, nil - } - if err != nil { - route.Authenticator = ra - return true, nil, err - } - lastResult = princ - } - } - route.Authenticator = ra - return true, lastResult, nil -} - -func stringSliceUnion(slices ...[]string) []string { - unique := make(map[string]struct{}) - var result []string - for _, slice := range slices { - for _, entry := range slice { - if _, ok := unique[entry]; ok { - continue - } - unique[entry] = struct{}{} - result = append(result, entry) - } - } - return result -} - -func stringSliceIntersection(slices ...[]string) []string { - unique := make(map[string]int) - var intersection []string - - total := len(slices) - var emptyCnt int - for _, slice := range slices { - if len(slice) == 0 { - emptyCnt++ - continue - } - - for _, entry := range slice { - unique[entry]++ - if unique[entry] == total-emptyCnt { // this entry appeared in all the non-empty slices - intersection = append(intersection, entry) - } - } - } - - return intersection -} - -// RouteAuthenticators represents a group of authenticators that represent a logical OR -type RouteAuthenticators []RouteAuthenticator - -// AllowsAnonymous returns true when there is an authenticator that means optional auth -func (ras RouteAuthenticators) AllowsAnonymous() bool { - for _, ra := range ras { - if ra.AllowsAnonymous() { - return true - } - } - return false -} - -// Authenticate method implemention so this collection can be used as authenticator -func (ras RouteAuthenticators) Authenticate(req *http.Request, route *MatchedRoute) (bool, interface{}, error) { - var lastError error - var allowsAnon bool - var anonAuth RouteAuthenticator - - for _, ra := range ras { - if ra.AllowsAnonymous() { - anonAuth = ra - allowsAnon = true - continue - } - applies, usr, err := ra.Authenticate(req, route) - if !applies || err != nil || usr == nil { - if err != nil { - lastError = err - } - continue - } - return applies, usr, nil - } - - if allowsAnon && lastError == nil { - route.Authenticator = &anonAuth - return true, nil, lastError - } - return lastError != nil, nil, lastError -} - -type routeEntry struct { - PathPattern string - BasePath string - Operation *spec.Operation - Consumes []string - Consumers map[string]runtime.Consumer - Produces []string - Producers map[string]runtime.Producer - Parameters map[string]spec.Parameter - Handler http.Handler - Formats strfmt.Registry - Binder *UntypedRequestBinder - Authenticators RouteAuthenticators - Authorizer runtime.Authorizer -} - -// MatchedRoute represents the route that was matched in this request -type MatchedRoute struct { - routeEntry - Params RouteParams - Consumer runtime.Consumer - Producer runtime.Producer - Authenticator *RouteAuthenticator -} - -// HasAuth returns true when the route has a security requirement defined -func (m *MatchedRoute) HasAuth() bool { - return len(m.Authenticators) > 0 -} - -// NeedsAuth returns true when the request still -// needs to perform authentication -func (m *MatchedRoute) NeedsAuth() bool { - return m.HasAuth() && m.Authenticator == nil -} - -func (d *defaultRouter) Lookup(method, path string) (*MatchedRoute, bool) { - mth := strings.ToUpper(method) - d.debugLogf("looking up route for %s %s", method, path) - if Debug { - if len(d.routers) == 0 { - d.debugLogf("there are no known routers") - } - for meth := range d.routers { - d.debugLogf("got a router for %s", meth) - } - } - if router, ok := d.routers[mth]; ok { - if m, rp, ok := router.Lookup(fpath.Clean(path)); ok && m != nil { - if entry, ok := m.(*routeEntry); ok { - d.debugLogf("found a route for %s %s with %d parameters", method, path, len(entry.Parameters)) - var params RouteParams - for _, p := range rp { - v, err := url.PathUnescape(p.Value) - if err != nil { - d.debugLogf("failed to escape %q: %v", p.Value, err) - v = p.Value - } - // a workaround to handle fragment/composing parameters until they are supported in denco router - // check if this parameter is a fragment within a path segment - if xpos := strings.Index(entry.PathPattern, fmt.Sprintf("{%s}", p.Name)) + len(p.Name) + 2; xpos < len(entry.PathPattern) && entry.PathPattern[xpos] != '/' { - // extract fragment parameters - ep := strings.Split(entry.PathPattern[xpos:], "/")[0] - pnames, pvalues := decodeCompositParams(p.Name, v, ep, nil, nil) - for i, pname := range pnames { - params = append(params, RouteParam{Name: pname, Value: pvalues[i]}) - } - } else { - // use the parameter directly - params = append(params, RouteParam{Name: p.Name, Value: v}) - } - } - return &MatchedRoute{routeEntry: *entry, Params: params}, true - } - } else { - d.debugLogf("couldn't find a route by path for %s %s", method, path) - } - } else { - d.debugLogf("couldn't find a route by method for %s %s", method, path) - } - return nil, false -} - -func (d *defaultRouter) OtherMethods(method, path string) []string { - mn := strings.ToUpper(method) - var methods []string - for k, v := range d.routers { - if k != mn { - if _, _, ok := v.Lookup(fpath.Clean(path)); ok { - methods = append(methods, k) - continue - } - } - } - return methods -} - -func (d *defaultRouter) SetLogger(lg logger.Logger) { - d.debugLogf = debugLogfFunc(lg) -} - -// convert swagger parameters per path segment into a denco parameter as multiple parameters per segment are not supported in denco -var pathConverter = regexp.MustCompile(`{(.+?)}([^/]*)`) - -func decodeCompositParams(name string, value string, pattern string, names []string, values []string) ([]string, []string) { - pleft := strings.Index(pattern, "{") - names = append(names, name) - if pleft < 0 { - if strings.HasSuffix(value, pattern) { - values = append(values, value[:len(value)-len(pattern)]) - } else { - values = append(values, "") - } - } else { - toskip := pattern[:pleft] - pright := strings.Index(pattern, "}") - vright := strings.Index(value, toskip) - if vright >= 0 { - values = append(values, value[:vright]) - } else { - values = append(values, "") - value = "" - } - return decodeCompositParams(pattern[pleft+1:pright], value[vright+len(toskip):], pattern[pright+1:], names, values) - } - return names, values -} - -func (d *defaultRouteBuilder) AddRoute(method, path string, operation *spec.Operation) { - mn := strings.ToUpper(method) - - bp := fpath.Clean(d.spec.BasePath()) - if len(bp) > 0 && bp[len(bp)-1] == '/' { - bp = bp[:len(bp)-1] - } - - d.debugLogf("operation: %#v", *operation) - if handler, ok := d.api.HandlerFor(method, strings.TrimPrefix(path, bp)); ok { - consumes := d.analyzer.ConsumesFor(operation) - produces := d.analyzer.ProducesFor(operation) - parameters := d.analyzer.ParamsFor(method, strings.TrimPrefix(path, bp)) - - // add API defaults if not part of the spec - if defConsumes := d.api.DefaultConsumes(); defConsumes != "" && !swag.ContainsStringsCI(consumes, defConsumes) { - consumes = append(consumes, defConsumes) - } - - if defProduces := d.api.DefaultProduces(); defProduces != "" && !swag.ContainsStringsCI(produces, defProduces) { - produces = append(produces, defProduces) - } - - requestBinder := NewUntypedRequestBinder(parameters, d.spec.Spec(), d.api.Formats()) - requestBinder.setDebugLogf(d.debugLogf) - record := denco.NewRecord(pathConverter.ReplaceAllString(path, ":$1"), &routeEntry{ - BasePath: bp, - PathPattern: path, - Operation: operation, - Handler: handler, - Consumes: consumes, - Produces: produces, - Consumers: d.api.ConsumersFor(normalizeOffers(consumes)), - Producers: d.api.ProducersFor(normalizeOffers(produces)), - Parameters: parameters, - Formats: d.api.Formats(), - Binder: requestBinder, - Authenticators: d.buildAuthenticators(operation), - Authorizer: d.api.Authorizer(), - }) - d.records[mn] = append(d.records[mn], record) - } -} - -func (d *defaultRouteBuilder) buildAuthenticators(operation *spec.Operation) RouteAuthenticators { - requirements := d.analyzer.SecurityRequirementsFor(operation) - auths := make([]RouteAuthenticator, 0, len(requirements)) - for _, reqs := range requirements { - schemes := make([]string, 0, len(reqs)) - scopes := make(map[string][]string, len(reqs)) - scopeSlices := make([][]string, 0, len(reqs)) - for _, req := range reqs { - schemes = append(schemes, req.Name) - scopes[req.Name] = req.Scopes - scopeSlices = append(scopeSlices, req.Scopes) - } - - definitions := d.analyzer.SecurityDefinitionsForRequirements(reqs) - authenticators := d.api.AuthenticatorsFor(definitions) - auths = append(auths, RouteAuthenticator{ - Authenticator: authenticators, - Schemes: schemes, - Scopes: scopes, - allScopes: stringSliceUnion(scopeSlices...), - commonScopes: stringSliceIntersection(scopeSlices...), - allowAnonymous: len(reqs) == 1 && reqs[0].Name == "", - }) - } - return auths -} - -func (d *defaultRouteBuilder) Build() *defaultRouter { - routers := make(map[string]*denco.Router) - for method, records := range d.records { - router := denco.New() - _ = router.Build(records) - routers[method] = router - } - return &defaultRouter{ - spec: d.spec, - routers: routers, - debugLogf: d.debugLogf, - } -} diff --git a/vendor/github.com/go-openapi/runtime/middleware/security.go b/vendor/github.com/go-openapi/runtime/middleware/security.go deleted file mode 100644 index 2b061caef..000000000 --- a/vendor/github.com/go-openapi/runtime/middleware/security.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 middleware - -import "net/http" - -func newSecureAPI(ctx *Context, next http.Handler) http.Handler { - return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := ctx.RouteInfo(r) - if rCtx != nil { - r = rCtx - } - if route != nil && !route.NeedsAuth() { - next.ServeHTTP(rw, r) - return - } - - _, rCtx, err := ctx.Authorize(r, route) - if err != nil { - ctx.Respond(rw, r, route.Produces, route, err) - return - } - r = rCtx - - next.ServeHTTP(rw, r) - }) -} diff --git a/vendor/github.com/go-openapi/runtime/middleware/spec.go b/vendor/github.com/go-openapi/runtime/middleware/spec.go deleted file mode 100644 index 87e17e342..000000000 --- a/vendor/github.com/go-openapi/runtime/middleware/spec.go +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 middleware - -import ( - "net/http" - "path" -) - -const ( - contentTypeHeader = "Content-Type" - applicationJSON = "application/json" -) - -// SpecOption can be applied to the Spec serving middleware -type SpecOption func(*specOptions) - -var defaultSpecOptions = specOptions{ - Path: "", - Document: "swagger.json", -} - -type specOptions struct { - Path string - Document string -} - -func specOptionsWithDefaults(opts []SpecOption) specOptions { - o := defaultSpecOptions - for _, apply := range opts { - apply(&o) - } - - return o -} - -// Spec creates a middleware to serve a swagger spec as a JSON document. -// -// This allows for altering the spec before starting the http listener. -// -// The basePath argument indicates the path of the spec document (defaults to "/"). -// Additional SpecOption can be used to change the name of the document (defaults to "swagger.json"). -func Spec(basePath string, b []byte, next http.Handler, opts ...SpecOption) http.Handler { - if basePath == "" { - basePath = "/" - } - o := specOptionsWithDefaults(opts) - pth := path.Join(basePath, o.Path, o.Document) - - return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { - if path.Clean(r.URL.Path) == pth { - rw.Header().Set(contentTypeHeader, applicationJSON) - rw.WriteHeader(http.StatusOK) - _, _ = rw.Write(b) - - return - } - - if next != nil { - next.ServeHTTP(rw, r) - - return - } - - rw.Header().Set(contentTypeHeader, applicationJSON) - rw.WriteHeader(http.StatusNotFound) - }) -} - -// WithSpecPath sets the path to be joined to the base path of the Spec middleware. -// -// This is empty by default. -func WithSpecPath(pth string) SpecOption { - return func(o *specOptions) { - o.Path = pth - } -} - -// WithSpecDocument sets the name of the JSON document served as a spec. -// -// By default, this is "swagger.json" -func WithSpecDocument(doc string) SpecOption { - return func(o *specOptions) { - if doc == "" { - return - } - - o.Document = doc - } -} diff --git a/vendor/github.com/go-openapi/runtime/middleware/swaggerui.go b/vendor/github.com/go-openapi/runtime/middleware/swaggerui.go deleted file mode 100644 index ec3c10cba..000000000 --- a/vendor/github.com/go-openapi/runtime/middleware/swaggerui.go +++ /dev/null @@ -1,175 +0,0 @@ -package middleware - -import ( - "bytes" - "fmt" - "html/template" - "net/http" - "path" -) - -// SwaggerUIOpts configures the SwaggerUI middleware -type SwaggerUIOpts struct { - // BasePath for the API, defaults to: / - BasePath string - - // Path combines with BasePath to construct the path to the UI, defaults to: "docs". - Path string - - // SpecURL is the URL of the spec document. - // - // Defaults to: /swagger.json - SpecURL string - - // Title for the documentation site, default to: API documentation - Title string - - // Template specifies a custom template to serve the UI - Template string - - // OAuthCallbackURL the url called after OAuth2 login - OAuthCallbackURL string - - // The three components needed to embed swagger-ui - - // SwaggerURL points to the js that generates the SwaggerUI site. - // - // Defaults to: https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js - SwaggerURL string - - SwaggerPresetURL string - SwaggerStylesURL string - - Favicon32 string - Favicon16 string -} - -// EnsureDefaults in case some options are missing -func (r *SwaggerUIOpts) EnsureDefaults() { - r.ensureDefaults() - - if r.Template == "" { - r.Template = swaggeruiTemplate - } -} - -func (r *SwaggerUIOpts) EnsureDefaultsOauth2() { - r.ensureDefaults() - - if r.Template == "" { - r.Template = swaggerOAuthTemplate - } -} - -func (r *SwaggerUIOpts) ensureDefaults() { - common := toCommonUIOptions(r) - common.EnsureDefaults() - fromCommonToAnyOptions(common, r) - - // swaggerui-specifics - if r.OAuthCallbackURL == "" { - r.OAuthCallbackURL = path.Join(r.BasePath, r.Path, "oauth2-callback") - } - if r.SwaggerURL == "" { - r.SwaggerURL = swaggerLatest - } - if r.SwaggerPresetURL == "" { - r.SwaggerPresetURL = swaggerPresetLatest - } - if r.SwaggerStylesURL == "" { - r.SwaggerStylesURL = swaggerStylesLatest - } - if r.Favicon16 == "" { - r.Favicon16 = swaggerFavicon16Latest - } - if r.Favicon32 == "" { - r.Favicon32 = swaggerFavicon32Latest - } -} - -// SwaggerUI creates a middleware to serve a documentation site for a swagger spec. -// -// This allows for altering the spec before starting the http listener. -func SwaggerUI(opts SwaggerUIOpts, next http.Handler) http.Handler { - opts.EnsureDefaults() - - pth := path.Join(opts.BasePath, opts.Path) - tmpl := template.Must(template.New("swaggerui").Parse(opts.Template)) - assets := bytes.NewBuffer(nil) - if err := tmpl.Execute(assets, opts); err != nil { - panic(fmt.Errorf("cannot execute template: %w", err)) - } - - return serveUI(pth, assets.Bytes(), next) -} - -const ( - swaggerLatest = "https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js" - swaggerPresetLatest = "https://unpkg.com/swagger-ui-dist/swagger-ui-standalone-preset.js" - swaggerStylesLatest = "https://unpkg.com/swagger-ui-dist/swagger-ui.css" - swaggerFavicon32Latest = "https://unpkg.com/swagger-ui-dist/favicon-32x32.png" - swaggerFavicon16Latest = "https://unpkg.com/swagger-ui-dist/favicon-16x16.png" - swaggeruiTemplate = ` - - - - - {{ .Title }} - - - - - - - - -
- - - - - - -` -) diff --git a/vendor/github.com/go-openapi/runtime/middleware/swaggerui_oauth2.go b/vendor/github.com/go-openapi/runtime/middleware/swaggerui_oauth2.go deleted file mode 100644 index e81212f71..000000000 --- a/vendor/github.com/go-openapi/runtime/middleware/swaggerui_oauth2.go +++ /dev/null @@ -1,105 +0,0 @@ -package middleware - -import ( - "bytes" - "fmt" - "net/http" - "text/template" -) - -func SwaggerUIOAuth2Callback(opts SwaggerUIOpts, next http.Handler) http.Handler { - opts.EnsureDefaultsOauth2() - - pth := opts.OAuthCallbackURL - tmpl := template.Must(template.New("swaggeroauth").Parse(opts.Template)) - assets := bytes.NewBuffer(nil) - if err := tmpl.Execute(assets, opts); err != nil { - panic(fmt.Errorf("cannot execute template: %w", err)) - } - - return serveUI(pth, assets.Bytes(), next) -} - -const ( - swaggerOAuthTemplate = ` - - - - {{ .Title }} - - - - - -` -) diff --git a/vendor/github.com/go-openapi/runtime/middleware/ui_options.go b/vendor/github.com/go-openapi/runtime/middleware/ui_options.go deleted file mode 100644 index b86efa008..000000000 --- a/vendor/github.com/go-openapi/runtime/middleware/ui_options.go +++ /dev/null @@ -1,173 +0,0 @@ -package middleware - -import ( - "bytes" - "encoding/gob" - "fmt" - "net/http" - "path" - "strings" -) - -const ( - // constants that are common to all UI-serving middlewares - defaultDocsPath = "docs" - defaultDocsURL = "/swagger.json" - defaultDocsTitle = "API Documentation" -) - -// uiOptions defines common options for UI serving middlewares. -type uiOptions struct { - // BasePath for the UI, defaults to: / - BasePath string - - // Path combines with BasePath to construct the path to the UI, defaults to: "docs". - Path string - - // SpecURL is the URL of the spec document. - // - // Defaults to: /swagger.json - SpecURL string - - // Title for the documentation site, default to: API documentation - Title string - - // Template specifies a custom template to serve the UI - Template string -} - -// toCommonUIOptions converts any UI option type to retain the common options. -// -// This uses gob encoding/decoding to convert common fields from one struct to another. -func toCommonUIOptions(opts interface{}) uiOptions { - var buf bytes.Buffer - enc := gob.NewEncoder(&buf) - dec := gob.NewDecoder(&buf) - var o uiOptions - err := enc.Encode(opts) - if err != nil { - panic(err) - } - - err = dec.Decode(&o) - if err != nil { - panic(err) - } - - return o -} - -func fromCommonToAnyOptions[T any](source uiOptions, target *T) { - var buf bytes.Buffer - enc := gob.NewEncoder(&buf) - dec := gob.NewDecoder(&buf) - err := enc.Encode(source) - if err != nil { - panic(err) - } - - err = dec.Decode(target) - if err != nil { - panic(err) - } -} - -// UIOption can be applied to UI serving middleware, such as Context.APIHandler or -// Context.APIHandlerSwaggerUI to alter the defaut behavior. -type UIOption func(*uiOptions) - -func uiOptionsWithDefaults(opts []UIOption) uiOptions { - var o uiOptions - for _, apply := range opts { - apply(&o) - } - - return o -} - -// WithUIBasePath sets the base path from where to serve the UI assets. -// -// By default, Context middleware sets this value to the API base path. -func WithUIBasePath(base string) UIOption { - return func(o *uiOptions) { - if !strings.HasPrefix(base, "/") { - base = "/" + base - } - o.BasePath = base - } -} - -// WithUIPath sets the path from where to serve the UI assets (i.e. /{basepath}/{path}. -func WithUIPath(pth string) UIOption { - return func(o *uiOptions) { - o.Path = pth - } -} - -// WithUISpecURL sets the path from where to serve swagger spec document. -// -// This may be specified as a full URL or a path. -// -// By default, this is "/swagger.json" -func WithUISpecURL(specURL string) UIOption { - return func(o *uiOptions) { - o.SpecURL = specURL - } -} - -// WithUITitle sets the title of the UI. -// -// By default, Context middleware sets this value to the title found in the API spec. -func WithUITitle(title string) UIOption { - return func(o *uiOptions) { - o.Title = title - } -} - -// WithTemplate allows to set a custom template for the UI. -// -// UI middleware will panic if the template does not parse or execute properly. -func WithTemplate(tpl string) UIOption { - return func(o *uiOptions) { - o.Template = tpl - } -} - -// EnsureDefaults in case some options are missing -func (r *uiOptions) EnsureDefaults() { - if r.BasePath == "" { - r.BasePath = "/" - } - if r.Path == "" { - r.Path = defaultDocsPath - } - if r.SpecURL == "" { - r.SpecURL = defaultDocsURL - } - if r.Title == "" { - r.Title = defaultDocsTitle - } -} - -// serveUI creates a middleware that serves a templated asset as text/html. -func serveUI(pth string, assets []byte, next http.Handler) http.Handler { - return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { - if path.Clean(r.URL.Path) == pth { - rw.Header().Set(contentTypeHeader, "text/html; charset=utf-8") - rw.WriteHeader(http.StatusOK) - _, _ = rw.Write(assets) - - return - } - - if next != nil { - next.ServeHTTP(rw, r) - - return - } - - rw.Header().Set(contentTypeHeader, "text/plain") - rw.WriteHeader(http.StatusNotFound) - _, _ = rw.Write([]byte(fmt.Sprintf("%q not found", pth))) - }) -} diff --git a/vendor/github.com/go-openapi/runtime/middleware/untyped/api.go b/vendor/github.com/go-openapi/runtime/middleware/untyped/api.go deleted file mode 100644 index 7b7269bd1..000000000 --- a/vendor/github.com/go-openapi/runtime/middleware/untyped/api.go +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 untyped - -import ( - "fmt" - "net/http" - "sort" - "strings" - - "github.com/go-openapi/analysis" - "github.com/go-openapi/errors" - "github.com/go-openapi/loads" - "github.com/go-openapi/spec" - "github.com/go-openapi/strfmt" - - "github.com/go-openapi/runtime" -) - -// NewAPI creates the default untyped API -func NewAPI(spec *loads.Document) *API { - var an *analysis.Spec - if spec != nil && spec.Spec() != nil { - an = analysis.New(spec.Spec()) - } - api := &API{ - spec: spec, - analyzer: an, - consumers: make(map[string]runtime.Consumer, 10), - producers: make(map[string]runtime.Producer, 10), - authenticators: make(map[string]runtime.Authenticator), - operations: make(map[string]map[string]runtime.OperationHandler), - ServeError: errors.ServeError, - Models: make(map[string]func() interface{}), - formats: strfmt.NewFormats(), - } - return api.WithJSONDefaults() -} - -// API represents an untyped mux for a swagger spec -type API struct { - spec *loads.Document - analyzer *analysis.Spec - DefaultProduces string - DefaultConsumes string - consumers map[string]runtime.Consumer - producers map[string]runtime.Producer - authenticators map[string]runtime.Authenticator - authorizer runtime.Authorizer - operations map[string]map[string]runtime.OperationHandler - ServeError func(http.ResponseWriter, *http.Request, error) - Models map[string]func() interface{} - formats strfmt.Registry -} - -// WithJSONDefaults loads the json defaults for this api -func (d *API) WithJSONDefaults() *API { - d.DefaultConsumes = runtime.JSONMime - d.DefaultProduces = runtime.JSONMime - d.consumers[runtime.JSONMime] = runtime.JSONConsumer() - d.producers[runtime.JSONMime] = runtime.JSONProducer() - return d -} - -// WithoutJSONDefaults clears the json defaults for this api -func (d *API) WithoutJSONDefaults() *API { - d.DefaultConsumes = "" - d.DefaultProduces = "" - delete(d.consumers, runtime.JSONMime) - delete(d.producers, runtime.JSONMime) - return d -} - -// Formats returns the registered string formats -func (d *API) Formats() strfmt.Registry { - if d.formats == nil { - d.formats = strfmt.NewFormats() - } - return d.formats -} - -// RegisterFormat registers a custom format validator -func (d *API) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator) { - if d.formats == nil { - d.formats = strfmt.NewFormats() - } - d.formats.Add(name, format, validator) -} - -// RegisterAuth registers an auth handler in this api -func (d *API) RegisterAuth(scheme string, handler runtime.Authenticator) { - if d.authenticators == nil { - d.authenticators = make(map[string]runtime.Authenticator) - } - d.authenticators[scheme] = handler -} - -// RegisterAuthorizer registers an authorizer handler in this api -func (d *API) RegisterAuthorizer(handler runtime.Authorizer) { - d.authorizer = handler -} - -// RegisterConsumer registers a consumer for a media type. -func (d *API) RegisterConsumer(mediaType string, handler runtime.Consumer) { - if d.consumers == nil { - d.consumers = make(map[string]runtime.Consumer, 10) - } - d.consumers[strings.ToLower(mediaType)] = handler -} - -// RegisterProducer registers a producer for a media type -func (d *API) RegisterProducer(mediaType string, handler runtime.Producer) { - if d.producers == nil { - d.producers = make(map[string]runtime.Producer, 10) - } - d.producers[strings.ToLower(mediaType)] = handler -} - -// RegisterOperation registers an operation handler for an operation name -func (d *API) RegisterOperation(method, path string, handler runtime.OperationHandler) { - if d.operations == nil { - d.operations = make(map[string]map[string]runtime.OperationHandler, 30) - } - um := strings.ToUpper(method) - if b, ok := d.operations[um]; !ok || b == nil { - d.operations[um] = make(map[string]runtime.OperationHandler) - } - d.operations[um][path] = handler -} - -// OperationHandlerFor returns the operation handler for the specified id if it can be found -func (d *API) OperationHandlerFor(method, path string) (runtime.OperationHandler, bool) { - if d.operations == nil { - return nil, false - } - if pi, ok := d.operations[strings.ToUpper(method)]; ok { - h, ok := pi[path] - return h, ok - } - return nil, false -} - -// ConsumersFor gets the consumers for the specified media types -func (d *API) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer { - result := make(map[string]runtime.Consumer) - for _, mt := range mediaTypes { - if consumer, ok := d.consumers[mt]; ok { - result[mt] = consumer - } - } - return result -} - -// ProducersFor gets the producers for the specified media types -func (d *API) ProducersFor(mediaTypes []string) map[string]runtime.Producer { - result := make(map[string]runtime.Producer) - for _, mt := range mediaTypes { - if producer, ok := d.producers[mt]; ok { - result[mt] = producer - } - } - return result -} - -// AuthenticatorsFor gets the authenticators for the specified security schemes -func (d *API) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator { - result := make(map[string]runtime.Authenticator) - for k := range schemes { - if a, ok := d.authenticators[k]; ok { - result[k] = a - } - } - return result -} - -// Authorizer returns the registered authorizer -func (d *API) Authorizer() runtime.Authorizer { - return d.authorizer -} - -// Validate validates this API for any missing items -func (d *API) Validate() error { - return d.validate() -} - -// validateWith validates the registrations in this API against the provided spec analyzer -func (d *API) validate() error { - consumes := make([]string, 0, len(d.consumers)) - for k := range d.consumers { - consumes = append(consumes, k) - } - - produces := make([]string, 0, len(d.producers)) - for k := range d.producers { - produces = append(produces, k) - } - - authenticators := make([]string, 0, len(d.authenticators)) - for k := range d.authenticators { - authenticators = append(authenticators, k) - } - - operations := make([]string, 0, len(d.operations)) - for m, v := range d.operations { - for p := range v { - operations = append(operations, fmt.Sprintf("%s %s", strings.ToUpper(m), p)) - } - } - - secDefinitions := d.spec.Spec().SecurityDefinitions - definedAuths := make([]string, 0, len(secDefinitions)) - for k := range secDefinitions { - definedAuths = append(definedAuths, k) - } - - if err := d.verify("consumes", consumes, d.analyzer.RequiredConsumes()); err != nil { - return err - } - if err := d.verify("produces", produces, d.analyzer.RequiredProduces()); err != nil { - return err - } - if err := d.verify("operation", operations, d.analyzer.OperationMethodPaths()); err != nil { - return err - } - - requiredAuths := d.analyzer.RequiredSecuritySchemes() - if err := d.verify("auth scheme", authenticators, requiredAuths); err != nil { - return err - } - if err := d.verify("security definitions", definedAuths, requiredAuths); err != nil { - return err - } - return nil -} - -func (d *API) verify(name string, registrations []string, expectations []string) error { - sort.Strings(registrations) - sort.Strings(expectations) - - expected := map[string]struct{}{} - seen := map[string]struct{}{} - - for _, v := range expectations { - expected[v] = struct{}{} - } - - var unspecified []string - for _, v := range registrations { - seen[v] = struct{}{} - if _, ok := expected[v]; !ok { - unspecified = append(unspecified, v) - } - } - - for k := range seen { - delete(expected, k) - } - - unregistered := make([]string, 0, len(expected)) - for k := range expected { - unregistered = append(unregistered, k) - } - sort.Strings(unspecified) - sort.Strings(unregistered) - - if len(unregistered) > 0 || len(unspecified) > 0 { - return &errors.APIVerificationFailed{ - Section: name, - MissingSpecification: unspecified, - MissingRegistration: unregistered, - } - } - - return nil -} diff --git a/vendor/github.com/go-openapi/runtime/middleware/validation.go b/vendor/github.com/go-openapi/runtime/middleware/validation.go deleted file mode 100644 index 0a5356c60..000000000 --- a/vendor/github.com/go-openapi/runtime/middleware/validation.go +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 middleware - -import ( - "mime" - "net/http" - "strings" - - "github.com/go-openapi/errors" - "github.com/go-openapi/swag" - - "github.com/go-openapi/runtime" -) - -type validation struct { - context *Context - result []error - request *http.Request - route *MatchedRoute - bound map[string]interface{} -} - -// ContentType validates the content type of a request -func validateContentType(allowed []string, actual string) error { - if len(allowed) == 0 { - return nil - } - mt, _, err := mime.ParseMediaType(actual) - if err != nil { - return errors.InvalidContentType(actual, allowed) - } - if swag.ContainsStringsCI(allowed, mt) { - return nil - } - if swag.ContainsStringsCI(allowed, "*/*") { - return nil - } - parts := strings.Split(actual, "/") - if len(parts) == 2 && swag.ContainsStringsCI(allowed, parts[0]+"/*") { - return nil - } - return errors.InvalidContentType(actual, allowed) -} - -func validateRequest(ctx *Context, request *http.Request, route *MatchedRoute) *validation { - validate := &validation{ - context: ctx, - request: request, - route: route, - bound: make(map[string]interface{}), - } - validate.debugLogf("validating request %s %s", request.Method, request.URL.EscapedPath()) - - validate.contentType() - if len(validate.result) == 0 { - validate.responseFormat() - } - if len(validate.result) == 0 { - validate.parameters() - } - - return validate -} - -func (v *validation) debugLogf(format string, args ...any) { - v.context.debugLogf(format, args...) -} - -func (v *validation) parameters() { - v.debugLogf("validating request parameters for %s %s", v.request.Method, v.request.URL.EscapedPath()) - if result := v.route.Binder.Bind(v.request, v.route.Params, v.route.Consumer, v.bound); result != nil { - if result.Error() == "validation failure list" { - for _, e := range result.(*errors.Validation).Value.([]interface{}) { - v.result = append(v.result, e.(error)) - } - return - } - v.result = append(v.result, result) - } -} - -func (v *validation) contentType() { - if len(v.result) == 0 && runtime.HasBody(v.request) { - v.debugLogf("validating body content type for %s %s", v.request.Method, v.request.URL.EscapedPath()) - ct, _, req, err := v.context.ContentType(v.request) - if err != nil { - v.result = append(v.result, err) - } else { - v.request = req - } - - if len(v.result) == 0 { - v.debugLogf("validating content type for %q against [%s]", ct, strings.Join(v.route.Consumes, ", ")) - if err := validateContentType(v.route.Consumes, ct); err != nil { - v.result = append(v.result, err) - } - } - if ct != "" && v.route.Consumer == nil { - cons, ok := v.route.Consumers[ct] - if !ok { - v.result = append(v.result, errors.New(500, "no consumer registered for %s", ct)) - } else { - v.route.Consumer = cons - } - } - } -} - -func (v *validation) responseFormat() { - // if the route provides values for Produces and no format could be identify then return an error. - // if the route does not specify values for Produces then treat request as valid since the API designer - // choose not to specify the format for responses. - if str, rCtx := v.context.ResponseFormat(v.request, v.route.Produces); str == "" && len(v.route.Produces) > 0 { - v.request = rCtx - v.result = append(v.result, errors.InvalidResponseFormat(v.request.Header.Get(runtime.HeaderAccept), v.route.Produces)) - } -} diff --git a/vendor/github.com/go-openapi/runtime/request.go b/vendor/github.com/go-openapi/runtime/request.go deleted file mode 100644 index 9e3e1ecb1..000000000 --- a/vendor/github.com/go-openapi/runtime/request.go +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 runtime - -import ( - "bufio" - "context" - "errors" - "io" - "net/http" - "strings" - - "github.com/go-openapi/swag" -) - -// CanHaveBody returns true if this method can have a body -func CanHaveBody(method string) bool { - mn := strings.ToUpper(method) - return mn == "POST" || mn == "PUT" || mn == "PATCH" || mn == "DELETE" -} - -// IsSafe returns true if this is a request with a safe method -func IsSafe(r *http.Request) bool { - mn := strings.ToUpper(r.Method) - return mn == "GET" || mn == "HEAD" -} - -// AllowsBody returns true if the request allows for a body -func AllowsBody(r *http.Request) bool { - mn := strings.ToUpper(r.Method) - return mn != "HEAD" -} - -// HasBody returns true if this method needs a content-type -func HasBody(r *http.Request) bool { - // happy case: we have a content length set - if r.ContentLength > 0 { - return true - } - - if r.Header.Get("content-length") != "" { - // in this case, no Transfer-Encoding should be present - // we have a header set but it was explicitly set to 0, so we assume no body - return false - } - - rdr := newPeekingReader(r.Body) - r.Body = rdr - return rdr.HasContent() -} - -func newPeekingReader(r io.ReadCloser) *peekingReader { - if r == nil { - return nil - } - return &peekingReader{ - underlying: bufio.NewReader(r), - orig: r, - } -} - -type peekingReader struct { - underlying interface { - Buffered() int - Peek(int) ([]byte, error) - Read([]byte) (int, error) - } - orig io.ReadCloser -} - -func (p *peekingReader) HasContent() bool { - if p == nil { - return false - } - if p.underlying.Buffered() > 0 { - return true - } - b, err := p.underlying.Peek(1) - if err != nil { - return false - } - return len(b) > 0 -} - -func (p *peekingReader) Read(d []byte) (int, error) { - if p == nil { - return 0, io.EOF - } - if p.underlying == nil { - return 0, io.ErrUnexpectedEOF - } - return p.underlying.Read(d) -} - -func (p *peekingReader) Close() error { - if p.underlying == nil { - return errors.New("reader already closed") - } - p.underlying = nil - if p.orig != nil { - return p.orig.Close() - } - return nil -} - -// JSONRequest creates a new http request with json headers set. -// -// It uses context.Background. -func JSONRequest(method, urlStr string, body io.Reader) (*http.Request, error) { - req, err := http.NewRequestWithContext(context.Background(), method, urlStr, body) - if err != nil { - return nil, err - } - req.Header.Add(HeaderContentType, JSONMime) - req.Header.Add(HeaderAccept, JSONMime) - return req, nil -} - -// Gettable for things with a method GetOK(string) (data string, hasKey bool, hasValue bool) -type Gettable interface { - GetOK(string) ([]string, bool, bool) -} - -// ReadSingleValue reads a single value from the source -func ReadSingleValue(values Gettable, name string) string { - vv, _, hv := values.GetOK(name) - if hv { - return vv[len(vv)-1] - } - return "" -} - -// ReadCollectionValue reads a collection value from a string data source -func ReadCollectionValue(values Gettable, name, collectionFormat string) []string { - v := ReadSingleValue(values, name) - return swag.SplitByFormat(v, collectionFormat) -} diff --git a/vendor/github.com/go-openapi/runtime/security/authenticator.go b/vendor/github.com/go-openapi/runtime/security/authenticator.go deleted file mode 100644 index bb30472bb..000000000 --- a/vendor/github.com/go-openapi/runtime/security/authenticator.go +++ /dev/null @@ -1,277 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 security - -import ( - "context" - "net/http" - "strings" - - "github.com/go-openapi/errors" - - "github.com/go-openapi/runtime" -) - -const ( - query = "query" - header = "header" - accessTokenParam = "access_token" -) - -// HttpAuthenticator is a function that authenticates a HTTP request -func HttpAuthenticator(handler func(*http.Request) (bool, interface{}, error)) runtime.Authenticator { //nolint:revive,stylecheck - return runtime.AuthenticatorFunc(func(params interface{}) (bool, interface{}, error) { - if request, ok := params.(*http.Request); ok { - return handler(request) - } - if scoped, ok := params.(*ScopedAuthRequest); ok { - return handler(scoped.Request) - } - return false, nil, nil - }) -} - -// ScopedAuthenticator is a function that authenticates a HTTP request against a list of valid scopes -func ScopedAuthenticator(handler func(*ScopedAuthRequest) (bool, interface{}, error)) runtime.Authenticator { - return runtime.AuthenticatorFunc(func(params interface{}) (bool, interface{}, error) { - if request, ok := params.(*ScopedAuthRequest); ok { - return handler(request) - } - return false, nil, nil - }) -} - -// UserPassAuthentication authentication function -type UserPassAuthentication func(string, string) (interface{}, error) - -// UserPassAuthenticationCtx authentication function with context.Context -type UserPassAuthenticationCtx func(context.Context, string, string) (context.Context, interface{}, error) - -// TokenAuthentication authentication function -type TokenAuthentication func(string) (interface{}, error) - -// TokenAuthenticationCtx authentication function with context.Context -type TokenAuthenticationCtx func(context.Context, string) (context.Context, interface{}, error) - -// ScopedTokenAuthentication authentication function -type ScopedTokenAuthentication func(string, []string) (interface{}, error) - -// ScopedTokenAuthenticationCtx authentication function with context.Context -type ScopedTokenAuthenticationCtx func(context.Context, string, []string) (context.Context, interface{}, error) - -var DefaultRealmName = "API" - -type secCtxKey uint8 - -const ( - failedBasicAuth secCtxKey = iota - oauth2SchemeName -) - -func FailedBasicAuth(r *http.Request) string { - return FailedBasicAuthCtx(r.Context()) -} - -func FailedBasicAuthCtx(ctx context.Context) string { - v, ok := ctx.Value(failedBasicAuth).(string) - if !ok { - return "" - } - return v -} - -func OAuth2SchemeName(r *http.Request) string { - return OAuth2SchemeNameCtx(r.Context()) -} - -func OAuth2SchemeNameCtx(ctx context.Context) string { - v, ok := ctx.Value(oauth2SchemeName).(string) - if !ok { - return "" - } - return v -} - -// BasicAuth creates a basic auth authenticator with the provided authentication function -func BasicAuth(authenticate UserPassAuthentication) runtime.Authenticator { - return BasicAuthRealm(DefaultRealmName, authenticate) -} - -// BasicAuthRealm creates a basic auth authenticator with the provided authentication function and realm name -func BasicAuthRealm(realm string, authenticate UserPassAuthentication) runtime.Authenticator { - if realm == "" { - realm = DefaultRealmName - } - - return HttpAuthenticator(func(r *http.Request) (bool, interface{}, error) { - if usr, pass, ok := r.BasicAuth(); ok { - p, err := authenticate(usr, pass) - if err != nil { - *r = *r.WithContext(context.WithValue(r.Context(), failedBasicAuth, realm)) - } - return true, p, err - } - *r = *r.WithContext(context.WithValue(r.Context(), failedBasicAuth, realm)) - return false, nil, nil - }) -} - -// BasicAuthCtx creates a basic auth authenticator with the provided authentication function with support for context.Context -func BasicAuthCtx(authenticate UserPassAuthenticationCtx) runtime.Authenticator { - return BasicAuthRealmCtx(DefaultRealmName, authenticate) -} - -// BasicAuthRealmCtx creates a basic auth authenticator with the provided authentication function and realm name with support for context.Context -func BasicAuthRealmCtx(realm string, authenticate UserPassAuthenticationCtx) runtime.Authenticator { - if realm == "" { - realm = DefaultRealmName - } - - return HttpAuthenticator(func(r *http.Request) (bool, interface{}, error) { - if usr, pass, ok := r.BasicAuth(); ok { - ctx, p, err := authenticate(r.Context(), usr, pass) - if err != nil { - ctx = context.WithValue(ctx, failedBasicAuth, realm) - } - *r = *r.WithContext(ctx) - return true, p, err - } - *r = *r.WithContext(context.WithValue(r.Context(), failedBasicAuth, realm)) - return false, nil, nil - }) -} - -// APIKeyAuth creates an authenticator that uses a token for authorization. -// This token can be obtained from either a header or a query string -func APIKeyAuth(name, in string, authenticate TokenAuthentication) runtime.Authenticator { - inl := strings.ToLower(in) - if inl != query && inl != header { - // panic because this is most likely a typo - panic(errors.New(500, "api key auth: in value needs to be either \"query\" or \"header\"")) - } - - var getToken func(*http.Request) string - switch inl { - case header: - getToken = func(r *http.Request) string { return r.Header.Get(name) } - case query: - getToken = func(r *http.Request) string { return r.URL.Query().Get(name) } - } - - return HttpAuthenticator(func(r *http.Request) (bool, interface{}, error) { - token := getToken(r) - if token == "" { - return false, nil, nil - } - - p, err := authenticate(token) - return true, p, err - }) -} - -// APIKeyAuthCtx creates an authenticator that uses a token for authorization with support for context.Context. -// This token can be obtained from either a header or a query string -func APIKeyAuthCtx(name, in string, authenticate TokenAuthenticationCtx) runtime.Authenticator { - inl := strings.ToLower(in) - if inl != query && inl != header { - // panic because this is most likely a typo - panic(errors.New(500, "api key auth: in value needs to be either \"query\" or \"header\"")) - } - - var getToken func(*http.Request) string - switch inl { - case header: - getToken = func(r *http.Request) string { return r.Header.Get(name) } - case query: - getToken = func(r *http.Request) string { return r.URL.Query().Get(name) } - } - - return HttpAuthenticator(func(r *http.Request) (bool, interface{}, error) { - token := getToken(r) - if token == "" { - return false, nil, nil - } - - ctx, p, err := authenticate(r.Context(), token) - *r = *r.WithContext(ctx) - return true, p, err - }) -} - -// ScopedAuthRequest contains both a http request and the required scopes for a particular operation -type ScopedAuthRequest struct { - Request *http.Request - RequiredScopes []string -} - -// BearerAuth for use with oauth2 flows -func BearerAuth(name string, authenticate ScopedTokenAuthentication) runtime.Authenticator { - const prefix = "Bearer " - return ScopedAuthenticator(func(r *ScopedAuthRequest) (bool, interface{}, error) { - var token string - hdr := r.Request.Header.Get(runtime.HeaderAuthorization) - if strings.HasPrefix(hdr, prefix) { - token = strings.TrimPrefix(hdr, prefix) - } - if token == "" { - qs := r.Request.URL.Query() - token = qs.Get(accessTokenParam) - } - //#nosec - ct, _, _ := runtime.ContentType(r.Request.Header) - if token == "" && (ct == "application/x-www-form-urlencoded" || ct == "multipart/form-data") { - token = r.Request.FormValue(accessTokenParam) - } - - if token == "" { - return false, nil, nil - } - - rctx := context.WithValue(r.Request.Context(), oauth2SchemeName, name) - *r.Request = *r.Request.WithContext(rctx) - p, err := authenticate(token, r.RequiredScopes) - return true, p, err - }) -} - -// BearerAuthCtx for use with oauth2 flows with support for context.Context. -func BearerAuthCtx(name string, authenticate ScopedTokenAuthenticationCtx) runtime.Authenticator { - const prefix = "Bearer " - return ScopedAuthenticator(func(r *ScopedAuthRequest) (bool, interface{}, error) { - var token string - hdr := r.Request.Header.Get(runtime.HeaderAuthorization) - if strings.HasPrefix(hdr, prefix) { - token = strings.TrimPrefix(hdr, prefix) - } - if token == "" { - qs := r.Request.URL.Query() - token = qs.Get(accessTokenParam) - } - //#nosec - ct, _, _ := runtime.ContentType(r.Request.Header) - if token == "" && (ct == "application/x-www-form-urlencoded" || ct == "multipart/form-data") { - token = r.Request.FormValue(accessTokenParam) - } - - if token == "" { - return false, nil, nil - } - - rctx := context.WithValue(r.Request.Context(), oauth2SchemeName, name) - ctx, p, err := authenticate(rctx, token, r.RequiredScopes) - *r.Request = *r.Request.WithContext(ctx) - return true, p, err - }) -} diff --git a/vendor/github.com/go-openapi/runtime/security/authorizer.go b/vendor/github.com/go-openapi/runtime/security/authorizer.go deleted file mode 100644 index 00c1a4d6a..000000000 --- a/vendor/github.com/go-openapi/runtime/security/authorizer.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 security - -import ( - "net/http" - - "github.com/go-openapi/runtime" -) - -// Authorized provides a default implementation of the Authorizer interface where all -// requests are authorized (successful) -func Authorized() runtime.Authorizer { - return runtime.AuthorizerFunc(func(_ *http.Request, _ interface{}) error { return nil }) -} diff --git a/vendor/github.com/go-openapi/runtime/statuses.go b/vendor/github.com/go-openapi/runtime/statuses.go deleted file mode 100644 index 3b011a0bf..000000000 --- a/vendor/github.com/go-openapi/runtime/statuses.go +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 runtime - -// Statuses lists the most common HTTP status codes to default message -// taken from https://httpstatuses.com/ -var Statuses = map[int]string{ - 100: "Continue", - 101: "Switching Protocols", - 102: "Processing", - 103: "Checkpoint", - 122: "URI too long", - 200: "OK", - 201: "Created", - 202: "Accepted", - 203: "Request Processed", - 204: "No Content", - 205: "Reset Content", - 206: "Partial Content", - 207: "Multi-Status", - 208: "Already Reported", - 226: "IM Used", - 300: "Multiple Choices", - 301: "Moved Permanently", - 302: "Found", - 303: "See Other", - 304: "Not Modified", - 305: "Use Proxy", - 306: "Switch Proxy", - 307: "Temporary Redirect", - 308: "Permanent Redirect", - 400: "Bad Request", - 401: "Unauthorized", - 402: "Payment Required", - 403: "Forbidden", - 404: "Not Found", - 405: "Method Not Allowed", - 406: "Not Acceptable", - 407: "Proxy Authentication Required", - 408: "Request Timeout", - 409: "Conflict", - 410: "Gone", - 411: "Length Required", - 412: "Precondition Failed", - 413: "Request Entity Too Large", - 414: "Request-URI Too Long", - 415: "Unsupported Media Type", - 416: "Request Range Not Satisfiable", - 417: "Expectation Failed", - 418: "I'm a teapot", - 420: "Enhance Your Calm", - 422: "Unprocessable Entity", - 423: "Locked", - 424: "Failed Dependency", - 426: "Upgrade Required", - 428: "Precondition Required", - 429: "Too Many Requests", - 431: "Request Header Fields Too Large", - 444: "No Response", - 449: "Retry With", - 450: "Blocked by Windows Parental Controls", - 451: "Wrong Exchange Server", - 499: "Client Closed Request", - 500: "Internal Server Error", - 501: "Not Implemented", - 502: "Bad Gateway", - 503: "Service Unavailable", - 504: "Gateway Timeout", - 505: "HTTP Version Not Supported", - 506: "Variant Also Negotiates", - 507: "Insufficient Storage", - 508: "Loop Detected", - 509: "Bandwidth Limit Exceeded", - 510: "Not Extended", - 511: "Network Authentication Required", - 598: "Network read timeout error", - 599: "Network connect timeout error", -} diff --git a/vendor/github.com/go-openapi/runtime/text.go b/vendor/github.com/go-openapi/runtime/text.go deleted file mode 100644 index f33320b7d..000000000 --- a/vendor/github.com/go-openapi/runtime/text.go +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 runtime - -import ( - "bytes" - "encoding" - "errors" - "fmt" - "io" - "reflect" - - "github.com/go-openapi/swag" -) - -// TextConsumer creates a new text consumer -func TextConsumer() Consumer { - return ConsumerFunc(func(reader io.Reader, data interface{}) error { - if reader == nil { - return errors.New("TextConsumer requires a reader") // early exit - } - - buf := new(bytes.Buffer) - _, err := buf.ReadFrom(reader) - if err != nil { - return err - } - b := buf.Bytes() - - // If the buffer is empty, no need to unmarshal it, which causes a panic. - if len(b) == 0 { - return nil - } - - if tu, ok := data.(encoding.TextUnmarshaler); ok { - err := tu.UnmarshalText(b) - if err != nil { - return fmt.Errorf("text consumer: %v", err) - } - - return nil - } - - t := reflect.TypeOf(data) - if data != nil && t.Kind() == reflect.Ptr { - v := reflect.Indirect(reflect.ValueOf(data)) - if t.Elem().Kind() == reflect.String { - v.SetString(string(b)) - return nil - } - } - - return fmt.Errorf("%v (%T) is not supported by the TextConsumer, %s", - data, data, "can be resolved by supporting TextUnmarshaler interface") - }) -} - -// TextProducer creates a new text producer -func TextProducer() Producer { - return ProducerFunc(func(writer io.Writer, data interface{}) error { - if writer == nil { - return errors.New("TextProducer requires a writer") // early exit - } - - if data == nil { - return errors.New("no data given to produce text from") - } - - if tm, ok := data.(encoding.TextMarshaler); ok { - txt, err := tm.MarshalText() - if err != nil { - return fmt.Errorf("text producer: %v", err) - } - _, err = writer.Write(txt) - return err - } - - if str, ok := data.(error); ok { - _, err := writer.Write([]byte(str.Error())) - return err - } - - if str, ok := data.(fmt.Stringer); ok { - _, err := writer.Write([]byte(str.String())) - return err - } - - v := reflect.Indirect(reflect.ValueOf(data)) - if t := v.Type(); t.Kind() == reflect.Struct || t.Kind() == reflect.Slice { - b, err := swag.WriteJSON(data) - if err != nil { - return err - } - _, err = writer.Write(b) - return err - } - if v.Kind() != reflect.String { - return fmt.Errorf("%T is not a supported type by the TextProducer", data) - } - - _, err := writer.Write([]byte(v.String())) - return err - }) -} diff --git a/vendor/github.com/go-openapi/runtime/values.go b/vendor/github.com/go-openapi/runtime/values.go deleted file mode 100644 index 11f5732af..000000000 --- a/vendor/github.com/go-openapi/runtime/values.go +++ /dev/null @@ -1,19 +0,0 @@ -package runtime - -// Values typically represent parameters on a http request. -type Values map[string][]string - -// GetOK returns the values collection for the given key. -// When the key is present in the map it will return true for hasKey. -// When the value is not empty it will return true for hasValue. -func (v Values) GetOK(key string) (value []string, hasKey bool, hasValue bool) { - value, hasKey = v[key] - if !hasKey { - return - } - if len(value) == 0 { - return - } - hasValue = true - return -} diff --git a/vendor/github.com/go-openapi/runtime/xml.go b/vendor/github.com/go-openapi/runtime/xml.go deleted file mode 100644 index 821c7393d..000000000 --- a/vendor/github.com/go-openapi/runtime/xml.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 runtime - -import ( - "encoding/xml" - "io" -) - -// XMLConsumer creates a new XML consumer -func XMLConsumer() Consumer { - return ConsumerFunc(func(reader io.Reader, data interface{}) error { - dec := xml.NewDecoder(reader) - return dec.Decode(data) - }) -} - -// XMLProducer creates a new XML producer -func XMLProducer() Producer { - return ProducerFunc(func(writer io.Writer, data interface{}) error { - enc := xml.NewEncoder(writer) - return enc.Encode(data) - }) -} diff --git a/vendor/github.com/go-openapi/runtime/yamlpc/yaml.go b/vendor/github.com/go-openapi/runtime/yamlpc/yaml.go deleted file mode 100644 index a1a0a589d..000000000 --- a/vendor/github.com/go-openapi/runtime/yamlpc/yaml.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// 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 yamlpc - -import ( - "io" - - "github.com/go-openapi/runtime" - "gopkg.in/yaml.v3" -) - -// YAMLConsumer creates a consumer for yaml data -func YAMLConsumer() runtime.Consumer { - return runtime.ConsumerFunc(func(r io.Reader, v interface{}) error { - dec := yaml.NewDecoder(r) - return dec.Decode(v) - }) -} - -// YAMLProducer creates a producer for yaml data -func YAMLProducer() runtime.Producer { - return runtime.ProducerFunc(func(w io.Writer, v interface{}) error { - enc := yaml.NewEncoder(w) - defer enc.Close() - return enc.Encode(v) - }) -} diff --git a/vendor/github.com/gogo/protobuf/AUTHORS b/vendor/github.com/gogo/protobuf/AUTHORS deleted file mode 100644 index 3d97fc7a2..000000000 --- a/vendor/github.com/gogo/protobuf/AUTHORS +++ /dev/null @@ -1,15 +0,0 @@ -# This is the official list of GoGo authors for copyright purposes. -# This file is distinct from the CONTRIBUTORS file, which -# lists people. For example, employees are listed in CONTRIBUTORS, -# but not in AUTHORS, because the employer holds the copyright. - -# Names should be added to this file as one of -# Organization's name -# Individual's name -# Individual's name - -# Please keep the list sorted. - -Sendgrid, Inc -Vastech SA (PTY) LTD -Walter Schulze diff --git a/vendor/github.com/gogo/protobuf/CONTRIBUTORS b/vendor/github.com/gogo/protobuf/CONTRIBUTORS deleted file mode 100644 index 1b4f6c208..000000000 --- a/vendor/github.com/gogo/protobuf/CONTRIBUTORS +++ /dev/null @@ -1,23 +0,0 @@ -Anton Povarov -Brian Goff -Clayton Coleman -Denis Smirnov -DongYun Kang -Dwayne Schultz -Georg Apitz -Gustav Paul -Johan Brandhorst -John Shahid -John Tuley -Laurent -Patrick Lee -Peter Edge -Roger Johansson -Sam Nguyen -Sergio Arbeo -Stephen J Day -Tamir Duberstein -Todd Eisenberger -Tormod Erevik Lea -Vyacheslav Kim -Walter Schulze diff --git a/vendor/github.com/gogo/protobuf/LICENSE b/vendor/github.com/gogo/protobuf/LICENSE deleted file mode 100644 index f57de90da..000000000 --- a/vendor/github.com/gogo/protobuf/LICENSE +++ /dev/null @@ -1,35 +0,0 @@ -Copyright (c) 2013, The GoGo Authors. All rights reserved. - -Protocol Buffers for Go with Gadgets - -Go support for Protocol Buffers - Google's data interchange format - -Copyright 2010 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. - diff --git a/vendor/github.com/gogo/protobuf/gogoproto/Makefile b/vendor/github.com/gogo/protobuf/gogoproto/Makefile deleted file mode 100644 index 0b4659b73..000000000 --- a/vendor/github.com/gogo/protobuf/gogoproto/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# Protocol Buffers for Go with Gadgets -# -# Copyright (c) 2013, The GoGo Authors. All rights reserved. -# http://github.com/gogo/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. -# -# 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. - -regenerate: - go install github.com/gogo/protobuf/protoc-gen-gogo - protoc --gogo_out=Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/protoc-gen-gogo/descriptor:../../../../ --proto_path=../../../../:../protobuf/:. *.proto - -restore: - cp gogo.pb.golden gogo.pb.go - -preserve: - cp gogo.pb.go gogo.pb.golden diff --git a/vendor/github.com/gogo/protobuf/gogoproto/doc.go b/vendor/github.com/gogo/protobuf/gogoproto/doc.go deleted file mode 100644 index 081c86fa8..000000000 --- a/vendor/github.com/gogo/protobuf/gogoproto/doc.go +++ /dev/null @@ -1,169 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/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. -// -// 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 gogoproto provides extensions for protocol buffers to achieve: - - - fast marshalling and unmarshalling. - - peace of mind by optionally generating test and benchmark code. - - more canonical Go structures. - - less typing by optionally generating extra helper code. - - goprotobuf compatibility - -More Canonical Go Structures - -A lot of time working with a goprotobuf struct will lead you to a place where you create another struct that is easier to work with and then have a function to copy the values between the two structs. -You might also find that basic structs that started their life as part of an API need to be sent over the wire. With gob, you could just send it. With goprotobuf, you need to make a parallel struct. -Gogoprotobuf tries to fix these problems with the nullable, embed, customtype and customname field extensions. - - - nullable, if false, a field is generated without a pointer (see warning below). - - embed, if true, the field is generated as an embedded field. - - customtype, It works with the Marshal and Unmarshal methods, to allow you to have your own types in your struct, but marshal to bytes. For example, custom.Uuid or custom.Fixed128 - - customname (beta), Changes the generated fieldname. This is especially useful when generated methods conflict with fieldnames. - - casttype (beta), Changes the generated fieldtype. All generated code assumes that this type is castable to the protocol buffer field type. It does not work for structs or enums. - - castkey (beta), Changes the generated fieldtype for a map key. All generated code assumes that this type is castable to the protocol buffer field type. Only supported on maps. - - castvalue (beta), Changes the generated fieldtype for a map value. All generated code assumes that this type is castable to the protocol buffer field type. Only supported on maps. - -Warning about nullable: According to the Protocol Buffer specification, you should be able to tell whether a field is set or unset. With the option nullable=false this feature is lost, since your non-nullable fields will always be set. It can be seen as a layer on top of Protocol Buffers, where before and after marshalling all non-nullable fields are set and they cannot be unset. - -Let us look at: - - github.com/gogo/protobuf/test/example/example.proto - -for a quicker overview. - -The following message: - - package test; - - import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - - message A { - optional string Description = 1 [(gogoproto.nullable) = false]; - optional int64 Number = 2 [(gogoproto.nullable) = false]; - optional bytes Id = 3 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uuid", (gogoproto.nullable) = false]; - } - -Will generate a go struct which looks a lot like this: - - type A struct { - Description string - Number int64 - Id github_com_gogo_protobuf_test_custom.Uuid - } - -You will see there are no pointers, since all fields are non-nullable. -You will also see a custom type which marshals to a string. -Be warned it is your responsibility to test your custom types thoroughly. -You should think of every possible empty and nil case for your marshaling, unmarshaling and size methods. - -Next we will embed the message A in message B. - - message B { - optional A A = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; - repeated bytes G = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false]; - } - -See below that A is embedded in B. - - type B struct { - A - G []github_com_gogo_protobuf_test_custom.Uint128 - } - -Also see the repeated custom type. - - type Uint128 [2]uint64 - -Next we will create a custom name for one of our fields. - - message C { - optional int64 size = 1 [(gogoproto.customname) = "MySize"]; - } - -See below that the field's name is MySize and not Size. - - type C struct { - MySize *int64 - } - -The is useful when having a protocol buffer message with a field name which conflicts with a generated method. -As an example, having a field name size and using the sizer plugin to generate a Size method will cause a go compiler error. -Using customname you can fix this error without changing the field name. -This is typically useful when working with a protocol buffer that was designed before these methods and/or the go language were avialable. - -Gogoprotobuf also has some more subtle changes, these could be changed back: - - - the generated package name for imports do not have the extra /filename.pb, - but are actually the imports specified in the .proto file. - -Gogoprotobuf also has lost some features which should be brought back with time: - - - Marshalling and unmarshalling with reflect and without the unsafe package, - this requires work in pointer_reflect.go - -Why does nullable break protocol buffer specifications: - -The protocol buffer specification states, somewhere, that you should be able to tell whether a -field is set or unset. With the option nullable=false this feature is lost, -since your non-nullable fields will always be set. It can be seen as a layer on top of -protocol buffers, where before and after marshalling all non-nullable fields are set -and they cannot be unset. - -Goprotobuf Compatibility: - -Gogoprotobuf is compatible with Goprotobuf, because it is compatible with protocol buffers. -Gogoprotobuf generates the same code as goprotobuf if no extensions are used. -The enumprefix, getters and stringer extensions can be used to remove some of the unnecessary code generated by goprotobuf: - - - gogoproto_import, if false, the generated code imports github.com/golang/protobuf/proto instead of github.com/gogo/protobuf/proto. - - goproto_enum_prefix, if false, generates the enum constant names without the messagetype prefix - - goproto_enum_stringer (experimental), if false, the enum is generated without the default string method, this is useful for rather using enum_stringer, or allowing you to write your own string method. - - goproto_getters, if false, the message is generated without get methods, this is useful when you would rather want to use face - - goproto_stringer, if false, the message is generated without the default string method, this is useful for rather using stringer, or allowing you to write your own string method. - - goproto_extensions_map (beta), if false, the extensions field is generated as type []byte instead of type map[int32]proto.Extension - - goproto_unrecognized (beta), if false, XXX_unrecognized field is not generated. This is useful in conjunction with gogoproto.nullable=false, to generate structures completely devoid of pointers and reduce GC pressure at the cost of losing information about unrecognized fields. - - goproto_registration (beta), if true, the generated files will register all messages and types against both gogo/protobuf and golang/protobuf. This is necessary when using third-party packages which read registrations from golang/protobuf (such as the grpc-gateway). - -Less Typing and Peace of Mind is explained in their specific plugin folders godoc: - - - github.com/gogo/protobuf/plugin/ - -If you do not use any of these extension the code that is generated -will be the same as if goprotobuf has generated it. - -The most complete way to see examples is to look at - - github.com/gogo/protobuf/test/thetest.proto - -Gogoprototest is a seperate project, -because we want to keep gogoprotobuf independent of goprotobuf, -but we still want to test it thoroughly. - -*/ -package gogoproto diff --git a/vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.go b/vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.go deleted file mode 100644 index 1e91766ae..000000000 --- a/vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.go +++ /dev/null @@ -1,874 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: gogo.proto - -package gogoproto - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -var E_GoprotoEnumPrefix = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 62001, - Name: "gogoproto.goproto_enum_prefix", - Tag: "varint,62001,opt,name=goproto_enum_prefix", - Filename: "gogo.proto", -} - -var E_GoprotoEnumStringer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 62021, - Name: "gogoproto.goproto_enum_stringer", - Tag: "varint,62021,opt,name=goproto_enum_stringer", - Filename: "gogo.proto", -} - -var E_EnumStringer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 62022, - Name: "gogoproto.enum_stringer", - Tag: "varint,62022,opt,name=enum_stringer", - Filename: "gogo.proto", -} - -var E_EnumCustomname = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumOptions)(nil), - ExtensionType: (*string)(nil), - Field: 62023, - Name: "gogoproto.enum_customname", - Tag: "bytes,62023,opt,name=enum_customname", - Filename: "gogo.proto", -} - -var E_Enumdecl = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 62024, - Name: "gogoproto.enumdecl", - Tag: "varint,62024,opt,name=enumdecl", - Filename: "gogo.proto", -} - -var E_EnumvalueCustomname = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumValueOptions)(nil), - ExtensionType: (*string)(nil), - Field: 66001, - Name: "gogoproto.enumvalue_customname", - Tag: "bytes,66001,opt,name=enumvalue_customname", - Filename: "gogo.proto", -} - -var E_GoprotoGettersAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63001, - Name: "gogoproto.goproto_getters_all", - Tag: "varint,63001,opt,name=goproto_getters_all", - Filename: "gogo.proto", -} - -var E_GoprotoEnumPrefixAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63002, - Name: "gogoproto.goproto_enum_prefix_all", - Tag: "varint,63002,opt,name=goproto_enum_prefix_all", - Filename: "gogo.proto", -} - -var E_GoprotoStringerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63003, - Name: "gogoproto.goproto_stringer_all", - Tag: "varint,63003,opt,name=goproto_stringer_all", - Filename: "gogo.proto", -} - -var E_VerboseEqualAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63004, - Name: "gogoproto.verbose_equal_all", - Tag: "varint,63004,opt,name=verbose_equal_all", - Filename: "gogo.proto", -} - -var E_FaceAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63005, - Name: "gogoproto.face_all", - Tag: "varint,63005,opt,name=face_all", - Filename: "gogo.proto", -} - -var E_GostringAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63006, - Name: "gogoproto.gostring_all", - Tag: "varint,63006,opt,name=gostring_all", - Filename: "gogo.proto", -} - -var E_PopulateAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63007, - Name: "gogoproto.populate_all", - Tag: "varint,63007,opt,name=populate_all", - Filename: "gogo.proto", -} - -var E_StringerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63008, - Name: "gogoproto.stringer_all", - Tag: "varint,63008,opt,name=stringer_all", - Filename: "gogo.proto", -} - -var E_OnlyoneAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63009, - Name: "gogoproto.onlyone_all", - Tag: "varint,63009,opt,name=onlyone_all", - Filename: "gogo.proto", -} - -var E_EqualAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63013, - Name: "gogoproto.equal_all", - Tag: "varint,63013,opt,name=equal_all", - Filename: "gogo.proto", -} - -var E_DescriptionAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63014, - Name: "gogoproto.description_all", - Tag: "varint,63014,opt,name=description_all", - Filename: "gogo.proto", -} - -var E_TestgenAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63015, - Name: "gogoproto.testgen_all", - Tag: "varint,63015,opt,name=testgen_all", - Filename: "gogo.proto", -} - -var E_BenchgenAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63016, - Name: "gogoproto.benchgen_all", - Tag: "varint,63016,opt,name=benchgen_all", - Filename: "gogo.proto", -} - -var E_MarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63017, - Name: "gogoproto.marshaler_all", - Tag: "varint,63017,opt,name=marshaler_all", - Filename: "gogo.proto", -} - -var E_UnmarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63018, - Name: "gogoproto.unmarshaler_all", - Tag: "varint,63018,opt,name=unmarshaler_all", - Filename: "gogo.proto", -} - -var E_StableMarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63019, - Name: "gogoproto.stable_marshaler_all", - Tag: "varint,63019,opt,name=stable_marshaler_all", - Filename: "gogo.proto", -} - -var E_SizerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63020, - Name: "gogoproto.sizer_all", - Tag: "varint,63020,opt,name=sizer_all", - Filename: "gogo.proto", -} - -var E_GoprotoEnumStringerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63021, - Name: "gogoproto.goproto_enum_stringer_all", - Tag: "varint,63021,opt,name=goproto_enum_stringer_all", - Filename: "gogo.proto", -} - -var E_EnumStringerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63022, - Name: "gogoproto.enum_stringer_all", - Tag: "varint,63022,opt,name=enum_stringer_all", - Filename: "gogo.proto", -} - -var E_UnsafeMarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63023, - Name: "gogoproto.unsafe_marshaler_all", - Tag: "varint,63023,opt,name=unsafe_marshaler_all", - Filename: "gogo.proto", -} - -var E_UnsafeUnmarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63024, - Name: "gogoproto.unsafe_unmarshaler_all", - Tag: "varint,63024,opt,name=unsafe_unmarshaler_all", - Filename: "gogo.proto", -} - -var E_GoprotoExtensionsMapAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63025, - Name: "gogoproto.goproto_extensions_map_all", - Tag: "varint,63025,opt,name=goproto_extensions_map_all", - Filename: "gogo.proto", -} - -var E_GoprotoUnrecognizedAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63026, - Name: "gogoproto.goproto_unrecognized_all", - Tag: "varint,63026,opt,name=goproto_unrecognized_all", - Filename: "gogo.proto", -} - -var E_GogoprotoImport = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63027, - Name: "gogoproto.gogoproto_import", - Tag: "varint,63027,opt,name=gogoproto_import", - Filename: "gogo.proto", -} - -var E_ProtosizerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63028, - Name: "gogoproto.protosizer_all", - Tag: "varint,63028,opt,name=protosizer_all", - Filename: "gogo.proto", -} - -var E_CompareAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63029, - Name: "gogoproto.compare_all", - Tag: "varint,63029,opt,name=compare_all", - Filename: "gogo.proto", -} - -var E_TypedeclAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63030, - Name: "gogoproto.typedecl_all", - Tag: "varint,63030,opt,name=typedecl_all", - Filename: "gogo.proto", -} - -var E_EnumdeclAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63031, - Name: "gogoproto.enumdecl_all", - Tag: "varint,63031,opt,name=enumdecl_all", - Filename: "gogo.proto", -} - -var E_GoprotoRegistration = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63032, - Name: "gogoproto.goproto_registration", - Tag: "varint,63032,opt,name=goproto_registration", - Filename: "gogo.proto", -} - -var E_MessagenameAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63033, - Name: "gogoproto.messagename_all", - Tag: "varint,63033,opt,name=messagename_all", - Filename: "gogo.proto", -} - -var E_GoprotoSizecacheAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63034, - Name: "gogoproto.goproto_sizecache_all", - Tag: "varint,63034,opt,name=goproto_sizecache_all", - Filename: "gogo.proto", -} - -var E_GoprotoUnkeyedAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63035, - Name: "gogoproto.goproto_unkeyed_all", - Tag: "varint,63035,opt,name=goproto_unkeyed_all", - Filename: "gogo.proto", -} - -var E_GoprotoGetters = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64001, - Name: "gogoproto.goproto_getters", - Tag: "varint,64001,opt,name=goproto_getters", - Filename: "gogo.proto", -} - -var E_GoprotoStringer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64003, - Name: "gogoproto.goproto_stringer", - Tag: "varint,64003,opt,name=goproto_stringer", - Filename: "gogo.proto", -} - -var E_VerboseEqual = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64004, - Name: "gogoproto.verbose_equal", - Tag: "varint,64004,opt,name=verbose_equal", - Filename: "gogo.proto", -} - -var E_Face = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64005, - Name: "gogoproto.face", - Tag: "varint,64005,opt,name=face", - Filename: "gogo.proto", -} - -var E_Gostring = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64006, - Name: "gogoproto.gostring", - Tag: "varint,64006,opt,name=gostring", - Filename: "gogo.proto", -} - -var E_Populate = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64007, - Name: "gogoproto.populate", - Tag: "varint,64007,opt,name=populate", - Filename: "gogo.proto", -} - -var E_Stringer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 67008, - Name: "gogoproto.stringer", - Tag: "varint,67008,opt,name=stringer", - Filename: "gogo.proto", -} - -var E_Onlyone = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64009, - Name: "gogoproto.onlyone", - Tag: "varint,64009,opt,name=onlyone", - Filename: "gogo.proto", -} - -var E_Equal = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64013, - Name: "gogoproto.equal", - Tag: "varint,64013,opt,name=equal", - Filename: "gogo.proto", -} - -var E_Description = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64014, - Name: "gogoproto.description", - Tag: "varint,64014,opt,name=description", - Filename: "gogo.proto", -} - -var E_Testgen = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64015, - Name: "gogoproto.testgen", - Tag: "varint,64015,opt,name=testgen", - Filename: "gogo.proto", -} - -var E_Benchgen = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64016, - Name: "gogoproto.benchgen", - Tag: "varint,64016,opt,name=benchgen", - Filename: "gogo.proto", -} - -var E_Marshaler = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64017, - Name: "gogoproto.marshaler", - Tag: "varint,64017,opt,name=marshaler", - Filename: "gogo.proto", -} - -var E_Unmarshaler = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64018, - Name: "gogoproto.unmarshaler", - Tag: "varint,64018,opt,name=unmarshaler", - Filename: "gogo.proto", -} - -var E_StableMarshaler = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64019, - Name: "gogoproto.stable_marshaler", - Tag: "varint,64019,opt,name=stable_marshaler", - Filename: "gogo.proto", -} - -var E_Sizer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64020, - Name: "gogoproto.sizer", - Tag: "varint,64020,opt,name=sizer", - Filename: "gogo.proto", -} - -var E_UnsafeMarshaler = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64023, - Name: "gogoproto.unsafe_marshaler", - Tag: "varint,64023,opt,name=unsafe_marshaler", - Filename: "gogo.proto", -} - -var E_UnsafeUnmarshaler = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64024, - Name: "gogoproto.unsafe_unmarshaler", - Tag: "varint,64024,opt,name=unsafe_unmarshaler", - Filename: "gogo.proto", -} - -var E_GoprotoExtensionsMap = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64025, - Name: "gogoproto.goproto_extensions_map", - Tag: "varint,64025,opt,name=goproto_extensions_map", - Filename: "gogo.proto", -} - -var E_GoprotoUnrecognized = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64026, - Name: "gogoproto.goproto_unrecognized", - Tag: "varint,64026,opt,name=goproto_unrecognized", - Filename: "gogo.proto", -} - -var E_Protosizer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64028, - Name: "gogoproto.protosizer", - Tag: "varint,64028,opt,name=protosizer", - Filename: "gogo.proto", -} - -var E_Compare = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64029, - Name: "gogoproto.compare", - Tag: "varint,64029,opt,name=compare", - Filename: "gogo.proto", -} - -var E_Typedecl = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64030, - Name: "gogoproto.typedecl", - Tag: "varint,64030,opt,name=typedecl", - Filename: "gogo.proto", -} - -var E_Messagename = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64033, - Name: "gogoproto.messagename", - Tag: "varint,64033,opt,name=messagename", - Filename: "gogo.proto", -} - -var E_GoprotoSizecache = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64034, - Name: "gogoproto.goproto_sizecache", - Tag: "varint,64034,opt,name=goproto_sizecache", - Filename: "gogo.proto", -} - -var E_GoprotoUnkeyed = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64035, - Name: "gogoproto.goproto_unkeyed", - Tag: "varint,64035,opt,name=goproto_unkeyed", - Filename: "gogo.proto", -} - -var E_Nullable = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 65001, - Name: "gogoproto.nullable", - Tag: "varint,65001,opt,name=nullable", - Filename: "gogo.proto", -} - -var E_Embed = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 65002, - Name: "gogoproto.embed", - Tag: "varint,65002,opt,name=embed", - Filename: "gogo.proto", -} - -var E_Customtype = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65003, - Name: "gogoproto.customtype", - Tag: "bytes,65003,opt,name=customtype", - Filename: "gogo.proto", -} - -var E_Customname = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65004, - Name: "gogoproto.customname", - Tag: "bytes,65004,opt,name=customname", - Filename: "gogo.proto", -} - -var E_Jsontag = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65005, - Name: "gogoproto.jsontag", - Tag: "bytes,65005,opt,name=jsontag", - Filename: "gogo.proto", -} - -var E_Moretags = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65006, - Name: "gogoproto.moretags", - Tag: "bytes,65006,opt,name=moretags", - Filename: "gogo.proto", -} - -var E_Casttype = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65007, - Name: "gogoproto.casttype", - Tag: "bytes,65007,opt,name=casttype", - Filename: "gogo.proto", -} - -var E_Castkey = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65008, - Name: "gogoproto.castkey", - Tag: "bytes,65008,opt,name=castkey", - Filename: "gogo.proto", -} - -var E_Castvalue = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65009, - Name: "gogoproto.castvalue", - Tag: "bytes,65009,opt,name=castvalue", - Filename: "gogo.proto", -} - -var E_Stdtime = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 65010, - Name: "gogoproto.stdtime", - Tag: "varint,65010,opt,name=stdtime", - Filename: "gogo.proto", -} - -var E_Stdduration = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 65011, - Name: "gogoproto.stdduration", - Tag: "varint,65011,opt,name=stdduration", - Filename: "gogo.proto", -} - -var E_Wktpointer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 65012, - Name: "gogoproto.wktpointer", - Tag: "varint,65012,opt,name=wktpointer", - Filename: "gogo.proto", -} - -func init() { - proto.RegisterExtension(E_GoprotoEnumPrefix) - proto.RegisterExtension(E_GoprotoEnumStringer) - proto.RegisterExtension(E_EnumStringer) - proto.RegisterExtension(E_EnumCustomname) - proto.RegisterExtension(E_Enumdecl) - proto.RegisterExtension(E_EnumvalueCustomname) - proto.RegisterExtension(E_GoprotoGettersAll) - proto.RegisterExtension(E_GoprotoEnumPrefixAll) - proto.RegisterExtension(E_GoprotoStringerAll) - proto.RegisterExtension(E_VerboseEqualAll) - proto.RegisterExtension(E_FaceAll) - proto.RegisterExtension(E_GostringAll) - proto.RegisterExtension(E_PopulateAll) - proto.RegisterExtension(E_StringerAll) - proto.RegisterExtension(E_OnlyoneAll) - proto.RegisterExtension(E_EqualAll) - proto.RegisterExtension(E_DescriptionAll) - proto.RegisterExtension(E_TestgenAll) - proto.RegisterExtension(E_BenchgenAll) - proto.RegisterExtension(E_MarshalerAll) - proto.RegisterExtension(E_UnmarshalerAll) - proto.RegisterExtension(E_StableMarshalerAll) - proto.RegisterExtension(E_SizerAll) - proto.RegisterExtension(E_GoprotoEnumStringerAll) - proto.RegisterExtension(E_EnumStringerAll) - proto.RegisterExtension(E_UnsafeMarshalerAll) - proto.RegisterExtension(E_UnsafeUnmarshalerAll) - proto.RegisterExtension(E_GoprotoExtensionsMapAll) - proto.RegisterExtension(E_GoprotoUnrecognizedAll) - proto.RegisterExtension(E_GogoprotoImport) - proto.RegisterExtension(E_ProtosizerAll) - proto.RegisterExtension(E_CompareAll) - proto.RegisterExtension(E_TypedeclAll) - proto.RegisterExtension(E_EnumdeclAll) - proto.RegisterExtension(E_GoprotoRegistration) - proto.RegisterExtension(E_MessagenameAll) - proto.RegisterExtension(E_GoprotoSizecacheAll) - proto.RegisterExtension(E_GoprotoUnkeyedAll) - proto.RegisterExtension(E_GoprotoGetters) - proto.RegisterExtension(E_GoprotoStringer) - proto.RegisterExtension(E_VerboseEqual) - proto.RegisterExtension(E_Face) - proto.RegisterExtension(E_Gostring) - proto.RegisterExtension(E_Populate) - proto.RegisterExtension(E_Stringer) - proto.RegisterExtension(E_Onlyone) - proto.RegisterExtension(E_Equal) - proto.RegisterExtension(E_Description) - proto.RegisterExtension(E_Testgen) - proto.RegisterExtension(E_Benchgen) - proto.RegisterExtension(E_Marshaler) - proto.RegisterExtension(E_Unmarshaler) - proto.RegisterExtension(E_StableMarshaler) - proto.RegisterExtension(E_Sizer) - proto.RegisterExtension(E_UnsafeMarshaler) - proto.RegisterExtension(E_UnsafeUnmarshaler) - proto.RegisterExtension(E_GoprotoExtensionsMap) - proto.RegisterExtension(E_GoprotoUnrecognized) - proto.RegisterExtension(E_Protosizer) - proto.RegisterExtension(E_Compare) - proto.RegisterExtension(E_Typedecl) - proto.RegisterExtension(E_Messagename) - proto.RegisterExtension(E_GoprotoSizecache) - proto.RegisterExtension(E_GoprotoUnkeyed) - proto.RegisterExtension(E_Nullable) - proto.RegisterExtension(E_Embed) - proto.RegisterExtension(E_Customtype) - proto.RegisterExtension(E_Customname) - proto.RegisterExtension(E_Jsontag) - proto.RegisterExtension(E_Moretags) - proto.RegisterExtension(E_Casttype) - proto.RegisterExtension(E_Castkey) - proto.RegisterExtension(E_Castvalue) - proto.RegisterExtension(E_Stdtime) - proto.RegisterExtension(E_Stdduration) - proto.RegisterExtension(E_Wktpointer) -} - -func init() { proto.RegisterFile("gogo.proto", fileDescriptor_592445b5231bc2b9) } - -var fileDescriptor_592445b5231bc2b9 = []byte{ - // 1328 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x98, 0x49, 0x6f, 0x1c, 0x45, - 0x14, 0x80, 0x85, 0x48, 0x64, 0x4f, 0x79, 0x8b, 0xc7, 0xc6, 0x84, 0x08, 0x44, 0xe0, 0xc4, 0xc9, - 0x3e, 0x45, 0x28, 0x65, 0x45, 0x96, 0x63, 0x39, 0x56, 0x10, 0x0e, 0xc6, 0x89, 0xc3, 0x76, 0x18, - 0xf5, 0xf4, 0x94, 0xdb, 0x8d, 0xbb, 0xbb, 0x9a, 0xee, 0xea, 0x10, 0xe7, 0x86, 0xc2, 0x22, 0x84, - 0xd8, 0x91, 0x20, 0x21, 0x09, 0x04, 0xc4, 0xbe, 0x86, 0x7d, 0xb9, 0x70, 0x61, 0xb9, 0xf2, 0x1f, - 0xb8, 0x00, 0x66, 0xf7, 0xcd, 0x17, 0xf4, 0xba, 0xdf, 0xeb, 0xa9, 0x69, 0x8f, 0x54, 0x35, 0xb7, - 0xf6, 0xb8, 0xbe, 0x6f, 0xaa, 0xdf, 0xeb, 0x7a, 0xef, 0x4d, 0x33, 0xe6, 0x49, 0x4f, 0x4e, 0xc6, - 0x89, 0x54, 0xb2, 0x5e, 0x83, 0xeb, 0xfc, 0x72, 0xdf, 0x7e, 0x4f, 0x4a, 0x2f, 0x10, 0x53, 0xf9, - 0x5f, 0xcd, 0x6c, 0x75, 0xaa, 0x25, 0x52, 0x37, 0xf1, 0x63, 0x25, 0x93, 0x62, 0x31, 0x3f, 0xc6, - 0xc6, 0x70, 0x71, 0x43, 0x44, 0x59, 0xd8, 0x88, 0x13, 0xb1, 0xea, 0x9f, 0xae, 0x5f, 0x3f, 0x59, - 0x90, 0x93, 0x44, 0x4e, 0xce, 0x47, 0x59, 0x78, 0x47, 0xac, 0x7c, 0x19, 0xa5, 0x7b, 0xaf, 0xfc, - 0x72, 0xf5, 0xfe, 0xab, 0x6e, 0xe9, 0x5f, 0x1e, 0x45, 0x14, 0xfe, 0xb7, 0x94, 0x83, 0x7c, 0x99, - 0x5d, 0xd3, 0xe1, 0x4b, 0x55, 0xe2, 0x47, 0x9e, 0x48, 0x0c, 0xc6, 0xef, 0xd1, 0x38, 0xa6, 0x19, - 0x8f, 0x23, 0xca, 0xe7, 0xd8, 0x50, 0x2f, 0xae, 0x1f, 0xd0, 0x35, 0x28, 0x74, 0xc9, 0x02, 0x1b, - 0xc9, 0x25, 0x6e, 0x96, 0x2a, 0x19, 0x46, 0x4e, 0x28, 0x0c, 0x9a, 0x1f, 0x73, 0x4d, 0x6d, 0x79, - 0x18, 0xb0, 0xb9, 0x92, 0xe2, 0x9c, 0xf5, 0xc3, 0x27, 0x2d, 0xe1, 0x06, 0x06, 0xc3, 0x4f, 0xb8, - 0x91, 0x72, 0x3d, 0x3f, 0xc9, 0xc6, 0xe1, 0xfa, 0x94, 0x13, 0x64, 0x42, 0xdf, 0xc9, 0x4d, 0x5d, - 0x3d, 0x27, 0x61, 0x19, 0xc9, 0x7e, 0x3e, 0xbb, 0x2b, 0xdf, 0xce, 0x58, 0x29, 0xd0, 0xf6, 0xa4, - 0x65, 0xd1, 0x13, 0x4a, 0x89, 0x24, 0x6d, 0x38, 0x41, 0xb7, 0xed, 0x1d, 0xf1, 0x83, 0xd2, 0x78, - 0x6e, 0xb3, 0x33, 0x8b, 0x0b, 0x05, 0x39, 0x1b, 0x04, 0x7c, 0x85, 0x5d, 0xdb, 0xe5, 0xa9, 0xb0, - 0x70, 0x9e, 0x47, 0xe7, 0xf8, 0x8e, 0x27, 0x03, 0xb4, 0x4b, 0x8c, 0x3e, 0x2f, 0x73, 0x69, 0xe1, - 0x7c, 0x19, 0x9d, 0x75, 0x64, 0x29, 0xa5, 0x60, 0xbc, 0x8d, 0x8d, 0x9e, 0x12, 0x49, 0x53, 0xa6, - 0xa2, 0x21, 0x1e, 0xc8, 0x9c, 0xc0, 0x42, 0x77, 0x01, 0x75, 0x23, 0x08, 0xce, 0x03, 0x07, 0xae, - 0x83, 0xac, 0x7f, 0xd5, 0x71, 0x85, 0x85, 0xe2, 0x22, 0x2a, 0xfa, 0x60, 0x3d, 0xa0, 0xb3, 0x6c, - 0xd0, 0x93, 0xc5, 0x2d, 0x59, 0xe0, 0x97, 0x10, 0x1f, 0x20, 0x06, 0x15, 0xb1, 0x8c, 0xb3, 0xc0, - 0x51, 0x36, 0x3b, 0x78, 0x85, 0x14, 0xc4, 0xa0, 0xa2, 0x87, 0xb0, 0xbe, 0x4a, 0x8a, 0x54, 0x8b, - 0xe7, 0x0c, 0x1b, 0x90, 0x51, 0xb0, 0x21, 0x23, 0x9b, 0x4d, 0x5c, 0x46, 0x03, 0x43, 0x04, 0x04, - 0xd3, 0xac, 0x66, 0x9b, 0x88, 0x37, 0x36, 0xe9, 0x78, 0x50, 0x06, 0x16, 0xd8, 0x08, 0x15, 0x28, - 0x5f, 0x46, 0x16, 0x8a, 0x37, 0x51, 0x31, 0xac, 0x61, 0x78, 0x1b, 0x4a, 0xa4, 0xca, 0x13, 0x36, - 0x92, 0xb7, 0xe8, 0x36, 0x10, 0xc1, 0x50, 0x36, 0x45, 0xe4, 0xae, 0xd9, 0x19, 0xde, 0xa6, 0x50, - 0x12, 0x03, 0x8a, 0x39, 0x36, 0x14, 0x3a, 0x49, 0xba, 0xe6, 0x04, 0x56, 0xe9, 0x78, 0x07, 0x1d, - 0x83, 0x25, 0x84, 0x11, 0xc9, 0xa2, 0x5e, 0x34, 0xef, 0x52, 0x44, 0x34, 0x0c, 0x8f, 0x5e, 0xaa, - 0x9c, 0x66, 0x20, 0x1a, 0xbd, 0xd8, 0xde, 0xa3, 0xa3, 0x57, 0xb0, 0x8b, 0xba, 0x71, 0x9a, 0xd5, - 0x52, 0xff, 0x8c, 0x95, 0xe6, 0x7d, 0xca, 0x74, 0x0e, 0x00, 0x7c, 0x0f, 0xbb, 0xae, 0x6b, 0x9b, - 0xb0, 0x90, 0x7d, 0x80, 0xb2, 0x89, 0x2e, 0xad, 0x02, 0x4b, 0x42, 0xaf, 0xca, 0x0f, 0xa9, 0x24, - 0x88, 0x8a, 0x6b, 0x89, 0x8d, 0x67, 0x51, 0xea, 0xac, 0xf6, 0x16, 0xb5, 0x8f, 0x28, 0x6a, 0x05, - 0xdb, 0x11, 0xb5, 0x13, 0x6c, 0x02, 0x8d, 0xbd, 0xe5, 0xf5, 0x63, 0x2a, 0xac, 0x05, 0xbd, 0xd2, - 0x99, 0xdd, 0xfb, 0xd8, 0xbe, 0x32, 0x9c, 0xa7, 0x95, 0x88, 0x52, 0x60, 0x1a, 0xa1, 0x13, 0x5b, - 0x98, 0xaf, 0xa0, 0x99, 0x2a, 0xfe, 0x7c, 0x29, 0x58, 0x74, 0x62, 0x90, 0xdf, 0xcd, 0xf6, 0x92, - 0x3c, 0x8b, 0x12, 0xe1, 0x4a, 0x2f, 0xf2, 0xcf, 0x88, 0x96, 0x85, 0xfa, 0x93, 0x4a, 0xaa, 0x56, - 0x34, 0x1c, 0xcc, 0x47, 0xd9, 0x9e, 0x72, 0x56, 0x69, 0xf8, 0x61, 0x2c, 0x13, 0x65, 0x30, 0x7e, - 0x4a, 0x99, 0x2a, 0xb9, 0xa3, 0x39, 0xc6, 0xe7, 0xd9, 0x70, 0xfe, 0xa7, 0xed, 0x23, 0xf9, 0x19, - 0x8a, 0x86, 0xda, 0x14, 0x16, 0x0e, 0x57, 0x86, 0xb1, 0x93, 0xd8, 0xd4, 0xbf, 0xcf, 0xa9, 0x70, - 0x20, 0x82, 0x85, 0x43, 0x6d, 0xc4, 0x02, 0xba, 0xbd, 0x85, 0xe1, 0x0b, 0x2a, 0x1c, 0xc4, 0xa0, - 0x82, 0x06, 0x06, 0x0b, 0xc5, 0x97, 0xa4, 0x20, 0x06, 0x14, 0x77, 0xb6, 0x1b, 0x6d, 0x22, 0x3c, - 0x3f, 0x55, 0x89, 0x03, 0xab, 0x0d, 0xaa, 0xaf, 0x36, 0x3b, 0x87, 0xb0, 0x65, 0x0d, 0x85, 0x4a, - 0x14, 0x8a, 0x34, 0x75, 0x3c, 0x01, 0x13, 0x87, 0xc5, 0xc6, 0xbe, 0xa6, 0x4a, 0xa4, 0x61, 0xb0, - 0x37, 0x6d, 0x42, 0x84, 0xb0, 0xbb, 0x8e, 0xbb, 0x66, 0xa3, 0xfb, 0xa6, 0xb2, 0xb9, 0xe3, 0xc4, - 0x82, 0x53, 0x9b, 0x7f, 0xb2, 0x68, 0x5d, 0x6c, 0x58, 0x3d, 0x9d, 0xdf, 0x56, 0xe6, 0x9f, 0x95, - 0x82, 0x2c, 0x6a, 0xc8, 0x48, 0x65, 0x9e, 0xaa, 0xdf, 0xb8, 0xc3, 0xb5, 0x58, 0xdc, 0x17, 0xe9, - 0x1e, 0xda, 0xc2, 0xfb, 0xed, 0x1c, 0xa7, 0xf8, 0xed, 0xf0, 0x90, 0x77, 0x0e, 0x3d, 0x66, 0xd9, - 0xd9, 0xad, 0xf2, 0x39, 0xef, 0x98, 0x79, 0xf8, 0x11, 0x36, 0xd4, 0x31, 0xf0, 0x98, 0x55, 0x0f, - 0xa3, 0x6a, 0x50, 0x9f, 0x77, 0xf8, 0x01, 0xb6, 0x0b, 0x86, 0x17, 0x33, 0xfe, 0x08, 0xe2, 0xf9, - 0x72, 0x7e, 0x88, 0xf5, 0xd3, 0xd0, 0x62, 0x46, 0x1f, 0x45, 0xb4, 0x44, 0x00, 0xa7, 0x81, 0xc5, - 0x8c, 0x3f, 0x46, 0x38, 0x21, 0x80, 0xdb, 0x87, 0xf0, 0xbb, 0x27, 0x76, 0x61, 0xd3, 0xa1, 0xd8, - 0x4d, 0xb3, 0x3e, 0x9c, 0x54, 0xcc, 0xf4, 0xe3, 0xf8, 0xe5, 0x44, 0xf0, 0x5b, 0xd9, 0x6e, 0xcb, - 0x80, 0x3f, 0x89, 0x68, 0xb1, 0x9e, 0xcf, 0xb1, 0x01, 0x6d, 0x3a, 0x31, 0xe3, 0x4f, 0x21, 0xae, - 0x53, 0xb0, 0x75, 0x9c, 0x4e, 0xcc, 0x82, 0xa7, 0x69, 0xeb, 0x48, 0x40, 0xd8, 0x68, 0x30, 0x31, - 0xd3, 0xcf, 0x50, 0xd4, 0x09, 0xe1, 0x33, 0xac, 0x56, 0x36, 0x1b, 0x33, 0xff, 0x2c, 0xf2, 0x6d, - 0x06, 0x22, 0xa0, 0x35, 0x3b, 0xb3, 0xe2, 0x39, 0x8a, 0x80, 0x46, 0xc1, 0x31, 0xaa, 0x0e, 0x30, - 0x66, 0xd3, 0xf3, 0x74, 0x8c, 0x2a, 0xf3, 0x0b, 0x64, 0x33, 0xaf, 0xf9, 0x66, 0xc5, 0x0b, 0x94, - 0xcd, 0x7c, 0x3d, 0x6c, 0xa3, 0x3a, 0x11, 0x98, 0x1d, 0x2f, 0xd2, 0x36, 0x2a, 0x03, 0x01, 0x5f, - 0x62, 0xf5, 0x9d, 0xd3, 0x80, 0xd9, 0xf7, 0x12, 0xfa, 0x46, 0x77, 0x0c, 0x03, 0xfc, 0x2e, 0x36, - 0xd1, 0x7d, 0x12, 0x30, 0x5b, 0xcf, 0x6d, 0x55, 0x7e, 0xbb, 0xe9, 0x83, 0x00, 0x3f, 0xd1, 0x6e, - 0x29, 0xfa, 0x14, 0x60, 0xd6, 0x9e, 0xdf, 0xea, 0x2c, 0xdc, 0xfa, 0x10, 0xc0, 0x67, 0x19, 0x6b, - 0x37, 0x60, 0xb3, 0xeb, 0x02, 0xba, 0x34, 0x08, 0x8e, 0x06, 0xf6, 0x5f, 0x33, 0x7f, 0x91, 0x8e, - 0x06, 0x12, 0x70, 0x34, 0xa8, 0xf5, 0x9a, 0xe9, 0x4b, 0x74, 0x34, 0x08, 0x81, 0x27, 0x5b, 0xeb, - 0x6e, 0x66, 0xc3, 0x65, 0x7a, 0xb2, 0x35, 0x8a, 0x1f, 0x63, 0xa3, 0x3b, 0x1a, 0xa2, 0x59, 0xf5, - 0x1a, 0xaa, 0xf6, 0x54, 0xfb, 0xa1, 0xde, 0xbc, 0xb0, 0x19, 0x9a, 0x6d, 0xaf, 0x57, 0x9a, 0x17, - 0xf6, 0x42, 0x3e, 0xcd, 0xfa, 0xa3, 0x2c, 0x08, 0xe0, 0xf0, 0xd4, 0x6f, 0xe8, 0xd2, 0x4d, 0x45, - 0xd0, 0x22, 0xc5, 0xaf, 0xdb, 0x18, 0x1d, 0x02, 0xf8, 0x01, 0xb6, 0x5b, 0x84, 0x4d, 0xd1, 0x32, - 0x91, 0xbf, 0x6d, 0x53, 0xc1, 0x84, 0xd5, 0x7c, 0x86, 0xb1, 0xe2, 0xd5, 0x08, 0x84, 0xd9, 0xc4, - 0xfe, 0xbe, 0x5d, 0xbc, 0xa5, 0xd1, 0x90, 0xb6, 0x20, 0x4f, 0x8a, 0x41, 0xb0, 0xd9, 0x29, 0xc8, - 0x33, 0x72, 0x90, 0xf5, 0xdd, 0x9f, 0xca, 0x48, 0x39, 0x9e, 0x89, 0xfe, 0x03, 0x69, 0x5a, 0x0f, - 0x01, 0x0b, 0x65, 0x22, 0x94, 0xe3, 0xa5, 0x26, 0xf6, 0x4f, 0x64, 0x4b, 0x00, 0x60, 0xd7, 0x49, - 0x95, 0xcd, 0x7d, 0xff, 0x45, 0x30, 0x01, 0xb0, 0x69, 0xb8, 0x5e, 0x17, 0x1b, 0x26, 0xf6, 0x6f, - 0xda, 0x34, 0xae, 0xe7, 0x87, 0x58, 0x0d, 0x2e, 0xf3, 0xb7, 0x4a, 0x26, 0xf8, 0x1f, 0x84, 0xdb, - 0x04, 0x7c, 0x73, 0xaa, 0x5a, 0xca, 0x37, 0x07, 0xfb, 0x5f, 0xcc, 0x34, 0xad, 0xe7, 0xb3, 0x6c, - 0x20, 0x55, 0xad, 0x56, 0x86, 0xf3, 0xa9, 0x01, 0xff, 0x6f, 0xbb, 0x7c, 0x65, 0x51, 0x32, 0x90, - 0xed, 0x07, 0xd7, 0x55, 0x2c, 0xfd, 0x48, 0x89, 0xc4, 0x64, 0xd8, 0x42, 0x83, 0x86, 0x1c, 0x9e, - 0x67, 0x63, 0xae, 0x0c, 0xab, 0xdc, 0x61, 0xb6, 0x20, 0x17, 0xe4, 0x52, 0x5e, 0x67, 0xee, 0xbd, - 0xd9, 0xf3, 0xd5, 0x5a, 0xd6, 0x9c, 0x74, 0x65, 0x38, 0x05, 0xbf, 0x3c, 0xda, 0x2f, 0x54, 0xcb, - 0xdf, 0x21, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0x9c, 0xaf, 0x70, 0x4e, 0x83, 0x15, 0x00, 0x00, -} diff --git a/vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.golden b/vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.golden deleted file mode 100644 index f6502e4b9..000000000 --- a/vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.golden +++ /dev/null @@ -1,45 +0,0 @@ -// Code generated by protoc-gen-go. -// source: gogo.proto -// DO NOT EDIT! - -package gogoproto - -import proto "github.com/gogo/protobuf/proto" -import json "encoding/json" -import math "math" -import google_protobuf "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - -// Reference proto, json, and math imports to suppress error if they are not otherwise used. -var _ = proto.Marshal -var _ = &json.SyntaxError{} -var _ = math.Inf - -var E_Nullable = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 51235, - Name: "gogoproto.nullable", - Tag: "varint,51235,opt,name=nullable", -} - -var E_Embed = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 51236, - Name: "gogoproto.embed", - Tag: "varint,51236,opt,name=embed", -} - -var E_Customtype = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 51237, - Name: "gogoproto.customtype", - Tag: "bytes,51237,opt,name=customtype", -} - -func init() { - proto.RegisterExtension(E_Nullable) - proto.RegisterExtension(E_Embed) - proto.RegisterExtension(E_Customtype) -} diff --git a/vendor/github.com/gogo/protobuf/gogoproto/gogo.proto b/vendor/github.com/gogo/protobuf/gogoproto/gogo.proto deleted file mode 100644 index b80c85653..000000000 --- a/vendor/github.com/gogo/protobuf/gogoproto/gogo.proto +++ /dev/null @@ -1,144 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/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. -// -// 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 = "proto2"; -package gogoproto; - -import "google/protobuf/descriptor.proto"; - -option java_package = "com.google.protobuf"; -option java_outer_classname = "GoGoProtos"; -option go_package = "github.com/gogo/protobuf/gogoproto"; - -extend google.protobuf.EnumOptions { - optional bool goproto_enum_prefix = 62001; - optional bool goproto_enum_stringer = 62021; - optional bool enum_stringer = 62022; - optional string enum_customname = 62023; - optional bool enumdecl = 62024; -} - -extend google.protobuf.EnumValueOptions { - optional string enumvalue_customname = 66001; -} - -extend google.protobuf.FileOptions { - optional bool goproto_getters_all = 63001; - optional bool goproto_enum_prefix_all = 63002; - optional bool goproto_stringer_all = 63003; - optional bool verbose_equal_all = 63004; - optional bool face_all = 63005; - optional bool gostring_all = 63006; - optional bool populate_all = 63007; - optional bool stringer_all = 63008; - optional bool onlyone_all = 63009; - - optional bool equal_all = 63013; - optional bool description_all = 63014; - optional bool testgen_all = 63015; - optional bool benchgen_all = 63016; - optional bool marshaler_all = 63017; - optional bool unmarshaler_all = 63018; - optional bool stable_marshaler_all = 63019; - - optional bool sizer_all = 63020; - - optional bool goproto_enum_stringer_all = 63021; - optional bool enum_stringer_all = 63022; - - optional bool unsafe_marshaler_all = 63023; - optional bool unsafe_unmarshaler_all = 63024; - - optional bool goproto_extensions_map_all = 63025; - optional bool goproto_unrecognized_all = 63026; - optional bool gogoproto_import = 63027; - optional bool protosizer_all = 63028; - optional bool compare_all = 63029; - optional bool typedecl_all = 63030; - optional bool enumdecl_all = 63031; - - optional bool goproto_registration = 63032; - optional bool messagename_all = 63033; - - optional bool goproto_sizecache_all = 63034; - optional bool goproto_unkeyed_all = 63035; -} - -extend google.protobuf.MessageOptions { - optional bool goproto_getters = 64001; - optional bool goproto_stringer = 64003; - optional bool verbose_equal = 64004; - optional bool face = 64005; - optional bool gostring = 64006; - optional bool populate = 64007; - optional bool stringer = 67008; - optional bool onlyone = 64009; - - optional bool equal = 64013; - optional bool description = 64014; - optional bool testgen = 64015; - optional bool benchgen = 64016; - optional bool marshaler = 64017; - optional bool unmarshaler = 64018; - optional bool stable_marshaler = 64019; - - optional bool sizer = 64020; - - optional bool unsafe_marshaler = 64023; - optional bool unsafe_unmarshaler = 64024; - - optional bool goproto_extensions_map = 64025; - optional bool goproto_unrecognized = 64026; - - optional bool protosizer = 64028; - optional bool compare = 64029; - - optional bool typedecl = 64030; - - optional bool messagename = 64033; - - optional bool goproto_sizecache = 64034; - optional bool goproto_unkeyed = 64035; -} - -extend google.protobuf.FieldOptions { - optional bool nullable = 65001; - optional bool embed = 65002; - optional string customtype = 65003; - optional string customname = 65004; - optional string jsontag = 65005; - optional string moretags = 65006; - optional string casttype = 65007; - optional string castkey = 65008; - optional string castvalue = 65009; - - optional bool stdtime = 65010; - optional bool stdduration = 65011; - optional bool wktpointer = 65012; - -} diff --git a/vendor/github.com/gogo/protobuf/gogoproto/helper.go b/vendor/github.com/gogo/protobuf/gogoproto/helper.go deleted file mode 100644 index 390d4e4be..000000000 --- a/vendor/github.com/gogo/protobuf/gogoproto/helper.go +++ /dev/null @@ -1,415 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/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. -// -// 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 gogoproto - -import google_protobuf "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" -import proto "github.com/gogo/protobuf/proto" - -func IsEmbed(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Embed, false) -} - -func IsNullable(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Nullable, true) -} - -func IsStdTime(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Stdtime, false) -} - -func IsStdDuration(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Stdduration, false) -} - -func IsStdDouble(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.DoubleValue" -} - -func IsStdFloat(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.FloatValue" -} - -func IsStdInt64(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.Int64Value" -} - -func IsStdUInt64(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.UInt64Value" -} - -func IsStdInt32(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.Int32Value" -} - -func IsStdUInt32(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.UInt32Value" -} - -func IsStdBool(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.BoolValue" -} - -func IsStdString(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.StringValue" -} - -func IsStdBytes(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.BytesValue" -} - -func IsStdType(field *google_protobuf.FieldDescriptorProto) bool { - return (IsStdTime(field) || IsStdDuration(field) || - IsStdDouble(field) || IsStdFloat(field) || - IsStdInt64(field) || IsStdUInt64(field) || - IsStdInt32(field) || IsStdUInt32(field) || - IsStdBool(field) || - IsStdString(field) || IsStdBytes(field)) -} - -func IsWktPtr(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) -} - -func NeedsNilCheck(proto3 bool, field *google_protobuf.FieldDescriptorProto) bool { - nullable := IsNullable(field) - if field.IsMessage() || IsCustomType(field) { - return nullable - } - if proto3 { - return false - } - return nullable || *field.Type == google_protobuf.FieldDescriptorProto_TYPE_BYTES -} - -func IsCustomType(field *google_protobuf.FieldDescriptorProto) bool { - typ := GetCustomType(field) - if len(typ) > 0 { - return true - } - return false -} - -func IsCastType(field *google_protobuf.FieldDescriptorProto) bool { - typ := GetCastType(field) - if len(typ) > 0 { - return true - } - return false -} - -func IsCastKey(field *google_protobuf.FieldDescriptorProto) bool { - typ := GetCastKey(field) - if len(typ) > 0 { - return true - } - return false -} - -func IsCastValue(field *google_protobuf.FieldDescriptorProto) bool { - typ := GetCastValue(field) - if len(typ) > 0 { - return true - } - return false -} - -func HasEnumDecl(file *google_protobuf.FileDescriptorProto, enum *google_protobuf.EnumDescriptorProto) bool { - return proto.GetBoolExtension(enum.Options, E_Enumdecl, proto.GetBoolExtension(file.Options, E_EnumdeclAll, true)) -} - -func HasTypeDecl(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Typedecl, proto.GetBoolExtension(file.Options, E_TypedeclAll, true)) -} - -func GetCustomType(field *google_protobuf.FieldDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Customtype) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func GetCastType(field *google_protobuf.FieldDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Casttype) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func GetCastKey(field *google_protobuf.FieldDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Castkey) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func GetCastValue(field *google_protobuf.FieldDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Castvalue) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func IsCustomName(field *google_protobuf.FieldDescriptorProto) bool { - name := GetCustomName(field) - if len(name) > 0 { - return true - } - return false -} - -func IsEnumCustomName(field *google_protobuf.EnumDescriptorProto) bool { - name := GetEnumCustomName(field) - if len(name) > 0 { - return true - } - return false -} - -func IsEnumValueCustomName(field *google_protobuf.EnumValueDescriptorProto) bool { - name := GetEnumValueCustomName(field) - if len(name) > 0 { - return true - } - return false -} - -func GetCustomName(field *google_protobuf.FieldDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Customname) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func GetEnumCustomName(field *google_protobuf.EnumDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_EnumCustomname) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func GetEnumValueCustomName(field *google_protobuf.EnumValueDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_EnumvalueCustomname) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func GetJsonTag(field *google_protobuf.FieldDescriptorProto) *string { - if field == nil { - return nil - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Jsontag) - if err == nil && v.(*string) != nil { - return (v.(*string)) - } - } - return nil -} - -func GetMoreTags(field *google_protobuf.FieldDescriptorProto) *string { - if field == nil { - return nil - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Moretags) - if err == nil && v.(*string) != nil { - return (v.(*string)) - } - } - return nil -} - -type EnableFunc func(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool - -func EnabledGoEnumPrefix(file *google_protobuf.FileDescriptorProto, enum *google_protobuf.EnumDescriptorProto) bool { - return proto.GetBoolExtension(enum.Options, E_GoprotoEnumPrefix, proto.GetBoolExtension(file.Options, E_GoprotoEnumPrefixAll, true)) -} - -func EnabledGoStringer(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_GoprotoStringer, proto.GetBoolExtension(file.Options, E_GoprotoStringerAll, true)) -} - -func HasGoGetters(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_GoprotoGetters, proto.GetBoolExtension(file.Options, E_GoprotoGettersAll, true)) -} - -func IsUnion(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Onlyone, proto.GetBoolExtension(file.Options, E_OnlyoneAll, false)) -} - -func HasGoString(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Gostring, proto.GetBoolExtension(file.Options, E_GostringAll, false)) -} - -func HasEqual(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Equal, proto.GetBoolExtension(file.Options, E_EqualAll, false)) -} - -func HasVerboseEqual(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_VerboseEqual, proto.GetBoolExtension(file.Options, E_VerboseEqualAll, false)) -} - -func IsStringer(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Stringer, proto.GetBoolExtension(file.Options, E_StringerAll, false)) -} - -func IsFace(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Face, proto.GetBoolExtension(file.Options, E_FaceAll, false)) -} - -func HasDescription(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Description, proto.GetBoolExtension(file.Options, E_DescriptionAll, false)) -} - -func HasPopulate(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Populate, proto.GetBoolExtension(file.Options, E_PopulateAll, false)) -} - -func HasTestGen(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Testgen, proto.GetBoolExtension(file.Options, E_TestgenAll, false)) -} - -func HasBenchGen(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Benchgen, proto.GetBoolExtension(file.Options, E_BenchgenAll, false)) -} - -func IsMarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Marshaler, proto.GetBoolExtension(file.Options, E_MarshalerAll, false)) -} - -func IsUnmarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Unmarshaler, proto.GetBoolExtension(file.Options, E_UnmarshalerAll, false)) -} - -func IsStableMarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_StableMarshaler, proto.GetBoolExtension(file.Options, E_StableMarshalerAll, false)) -} - -func IsSizer(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Sizer, proto.GetBoolExtension(file.Options, E_SizerAll, false)) -} - -func IsProtoSizer(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Protosizer, proto.GetBoolExtension(file.Options, E_ProtosizerAll, false)) -} - -func IsGoEnumStringer(file *google_protobuf.FileDescriptorProto, enum *google_protobuf.EnumDescriptorProto) bool { - return proto.GetBoolExtension(enum.Options, E_GoprotoEnumStringer, proto.GetBoolExtension(file.Options, E_GoprotoEnumStringerAll, true)) -} - -func IsEnumStringer(file *google_protobuf.FileDescriptorProto, enum *google_protobuf.EnumDescriptorProto) bool { - return proto.GetBoolExtension(enum.Options, E_EnumStringer, proto.GetBoolExtension(file.Options, E_EnumStringerAll, false)) -} - -func IsUnsafeMarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_UnsafeMarshaler, proto.GetBoolExtension(file.Options, E_UnsafeMarshalerAll, false)) -} - -func IsUnsafeUnmarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_UnsafeUnmarshaler, proto.GetBoolExtension(file.Options, E_UnsafeUnmarshalerAll, false)) -} - -func HasExtensionsMap(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_GoprotoExtensionsMap, proto.GetBoolExtension(file.Options, E_GoprotoExtensionsMapAll, true)) -} - -func HasUnrecognized(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_GoprotoUnrecognized, proto.GetBoolExtension(file.Options, E_GoprotoUnrecognizedAll, true)) -} - -func IsProto3(file *google_protobuf.FileDescriptorProto) bool { - return file.GetSyntax() == "proto3" -} - -func ImportsGoGoProto(file *google_protobuf.FileDescriptorProto) bool { - return proto.GetBoolExtension(file.Options, E_GogoprotoImport, true) -} - -func HasCompare(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Compare, proto.GetBoolExtension(file.Options, E_CompareAll, false)) -} - -func RegistersGolangProto(file *google_protobuf.FileDescriptorProto) bool { - return proto.GetBoolExtension(file.Options, E_GoprotoRegistration, false) -} - -func HasMessageName(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Messagename, proto.GetBoolExtension(file.Options, E_MessagenameAll, false)) -} - -func HasSizecache(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_GoprotoSizecache, proto.GetBoolExtension(file.Options, E_GoprotoSizecacheAll, true)) -} - -func HasUnkeyed(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_GoprotoUnkeyed, proto.GetBoolExtension(file.Options, E_GoprotoUnkeyedAll, true)) -} diff --git a/vendor/github.com/gogo/protobuf/proto/Makefile b/vendor/github.com/gogo/protobuf/proto/Makefile deleted file mode 100644 index 00d65f327..000000000 --- a/vendor/github.com/gogo/protobuf/proto/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# Go support for Protocol Buffers - Google's data interchange format -# -# Copyright 2010 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. - -install: - go install - -test: install generate-test-pbs - go test - - -generate-test-pbs: - make install - make -C test_proto - make -C proto3_proto - make diff --git a/vendor/github.com/gogo/protobuf/proto/clone.go b/vendor/github.com/gogo/protobuf/proto/clone.go deleted file mode 100644 index a26b046d9..000000000 --- a/vendor/github.com/gogo/protobuf/proto/clone.go +++ /dev/null @@ -1,258 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2011 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. - -// Protocol buffer deep copy and merge. -// TODO: RawMessage. - -package proto - -import ( - "fmt" - "log" - "reflect" - "strings" -) - -// Clone returns a deep copy of a protocol buffer. -func Clone(src Message) Message { - in := reflect.ValueOf(src) - if in.IsNil() { - return src - } - out := reflect.New(in.Type().Elem()) - dst := out.Interface().(Message) - Merge(dst, src) - return dst -} - -// Merger is the interface representing objects that can merge messages of the same type. -type Merger interface { - // Merge merges src into this message. - // Required and optional fields that are set in src will be set to that value in dst. - // Elements of repeated fields will be appended. - // - // Merge may panic if called with a different argument type than the receiver. - Merge(src Message) -} - -// generatedMerger is the custom merge method that generated protos will have. -// We must add this method since a generate Merge method will conflict with -// many existing protos that have a Merge data field already defined. -type generatedMerger interface { - XXX_Merge(src Message) -} - -// Merge merges src into dst. -// Required and optional fields that are set in src will be set to that value in dst. -// Elements of repeated fields will be appended. -// Merge panics if src and dst are not the same type, or if dst is nil. -func Merge(dst, src Message) { - if m, ok := dst.(Merger); ok { - m.Merge(src) - return - } - - in := reflect.ValueOf(src) - out := reflect.ValueOf(dst) - if out.IsNil() { - panic("proto: nil destination") - } - if in.Type() != out.Type() { - panic(fmt.Sprintf("proto.Merge(%T, %T) type mismatch", dst, src)) - } - if in.IsNil() { - return // Merge from nil src is a noop - } - if m, ok := dst.(generatedMerger); ok { - m.XXX_Merge(src) - return - } - mergeStruct(out.Elem(), in.Elem()) -} - -func mergeStruct(out, in reflect.Value) { - sprop := GetProperties(in.Type()) - for i := 0; i < in.NumField(); i++ { - f := in.Type().Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - mergeAny(out.Field(i), in.Field(i), false, sprop.Prop[i]) - } - - if emIn, ok := in.Addr().Interface().(extensionsBytes); ok { - emOut := out.Addr().Interface().(extensionsBytes) - bIn := emIn.GetExtensions() - bOut := emOut.GetExtensions() - *bOut = append(*bOut, *bIn...) - } else if emIn, err := extendable(in.Addr().Interface()); err == nil { - emOut, _ := extendable(out.Addr().Interface()) - mIn, muIn := emIn.extensionsRead() - if mIn != nil { - mOut := emOut.extensionsWrite() - muIn.Lock() - mergeExtension(mOut, mIn) - muIn.Unlock() - } - } - - uf := in.FieldByName("XXX_unrecognized") - if !uf.IsValid() { - return - } - uin := uf.Bytes() - if len(uin) > 0 { - out.FieldByName("XXX_unrecognized").SetBytes(append([]byte(nil), uin...)) - } -} - -// mergeAny performs a merge between two values of the same type. -// viaPtr indicates whether the values were indirected through a pointer (implying proto2). -// prop is set if this is a struct field (it may be nil). -func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) { - if in.Type() == protoMessageType { - if !in.IsNil() { - if out.IsNil() { - out.Set(reflect.ValueOf(Clone(in.Interface().(Message)))) - } else { - Merge(out.Interface().(Message), in.Interface().(Message)) - } - } - return - } - switch in.Kind() { - case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, - reflect.String, reflect.Uint32, reflect.Uint64: - if !viaPtr && isProto3Zero(in) { - return - } - out.Set(in) - case reflect.Interface: - // Probably a oneof field; copy non-nil values. - if in.IsNil() { - return - } - // Allocate destination if it is not set, or set to a different type. - // Otherwise we will merge as normal. - if out.IsNil() || out.Elem().Type() != in.Elem().Type() { - out.Set(reflect.New(in.Elem().Elem().Type())) // interface -> *T -> T -> new(T) - } - mergeAny(out.Elem(), in.Elem(), false, nil) - case reflect.Map: - if in.Len() == 0 { - return - } - if out.IsNil() { - out.Set(reflect.MakeMap(in.Type())) - } - // For maps with value types of *T or []byte we need to deep copy each value. - elemKind := in.Type().Elem().Kind() - for _, key := range in.MapKeys() { - var val reflect.Value - switch elemKind { - case reflect.Ptr: - val = reflect.New(in.Type().Elem().Elem()) - mergeAny(val, in.MapIndex(key), false, nil) - case reflect.Slice: - val = in.MapIndex(key) - val = reflect.ValueOf(append([]byte{}, val.Bytes()...)) - default: - val = in.MapIndex(key) - } - out.SetMapIndex(key, val) - } - case reflect.Ptr: - if in.IsNil() { - return - } - if out.IsNil() { - out.Set(reflect.New(in.Elem().Type())) - } - mergeAny(out.Elem(), in.Elem(), true, nil) - case reflect.Slice: - if in.IsNil() { - return - } - if in.Type().Elem().Kind() == reflect.Uint8 { - // []byte is a scalar bytes field, not a repeated field. - - // Edge case: if this is in a proto3 message, a zero length - // bytes field is considered the zero value, and should not - // be merged. - if prop != nil && prop.proto3 && in.Len() == 0 { - return - } - - // Make a deep copy. - // Append to []byte{} instead of []byte(nil) so that we never end up - // with a nil result. - out.SetBytes(append([]byte{}, in.Bytes()...)) - return - } - n := in.Len() - if out.IsNil() { - out.Set(reflect.MakeSlice(in.Type(), 0, n)) - } - switch in.Type().Elem().Kind() { - case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, - reflect.String, reflect.Uint32, reflect.Uint64: - out.Set(reflect.AppendSlice(out, in)) - default: - for i := 0; i < n; i++ { - x := reflect.Indirect(reflect.New(in.Type().Elem())) - mergeAny(x, in.Index(i), false, nil) - out.Set(reflect.Append(out, x)) - } - } - case reflect.Struct: - mergeStruct(out, in) - default: - // unknown type, so not a protocol buffer - log.Printf("proto: don't know how to copy %v", in) - } -} - -func mergeExtension(out, in map[int32]Extension) { - for extNum, eIn := range in { - eOut := Extension{desc: eIn.desc} - if eIn.value != nil { - v := reflect.New(reflect.TypeOf(eIn.value)).Elem() - mergeAny(v, reflect.ValueOf(eIn.value), false, nil) - eOut.value = v.Interface() - } - if eIn.enc != nil { - eOut.enc = make([]byte, len(eIn.enc)) - copy(eOut.enc, eIn.enc) - } - - out[extNum] = eOut - } -} diff --git a/vendor/github.com/gogo/protobuf/proto/custom_gogo.go b/vendor/github.com/gogo/protobuf/proto/custom_gogo.go deleted file mode 100644 index 24552483c..000000000 --- a/vendor/github.com/gogo/protobuf/proto/custom_gogo.go +++ /dev/null @@ -1,39 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/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. -// -// 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 proto - -import "reflect" - -type custom interface { - Marshal() ([]byte, error) - Unmarshal(data []byte) error - Size() int -} - -var customType = reflect.TypeOf((*custom)(nil)).Elem() diff --git a/vendor/github.com/gogo/protobuf/proto/decode.go b/vendor/github.com/gogo/protobuf/proto/decode.go deleted file mode 100644 index 63b0f08be..000000000 --- a/vendor/github.com/gogo/protobuf/proto/decode.go +++ /dev/null @@ -1,427 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 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 proto - -/* - * Routines for decoding protocol buffer data to construct in-memory representations. - */ - -import ( - "errors" - "fmt" - "io" -) - -// errOverflow is returned when an integer is too large to be represented. -var errOverflow = errors.New("proto: integer overflow") - -// ErrInternalBadWireType is returned by generated code when an incorrect -// wire type is encountered. It does not get returned to user code. -var ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof") - -// DecodeVarint reads a varint-encoded integer from the slice. -// It returns the integer and the number of bytes consumed, or -// zero if there is not enough. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -func DecodeVarint(buf []byte) (x uint64, n int) { - for shift := uint(0); shift < 64; shift += 7 { - if n >= len(buf) { - return 0, 0 - } - b := uint64(buf[n]) - n++ - x |= (b & 0x7F) << shift - if (b & 0x80) == 0 { - return x, n - } - } - - // The number is too large to represent in a 64-bit value. - return 0, 0 -} - -func (p *Buffer) decodeVarintSlow() (x uint64, err error) { - i := p.index - l := len(p.buf) - - for shift := uint(0); shift < 64; shift += 7 { - if i >= l { - err = io.ErrUnexpectedEOF - return - } - b := p.buf[i] - i++ - x |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - p.index = i - return - } - } - - // The number is too large to represent in a 64-bit value. - err = errOverflow - return -} - -// DecodeVarint reads a varint-encoded integer from the Buffer. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -func (p *Buffer) DecodeVarint() (x uint64, err error) { - i := p.index - buf := p.buf - - if i >= len(buf) { - return 0, io.ErrUnexpectedEOF - } else if buf[i] < 0x80 { - p.index++ - return uint64(buf[i]), nil - } else if len(buf)-i < 10 { - return p.decodeVarintSlow() - } - - var b uint64 - // we already checked the first byte - x = uint64(buf[i]) - 0x80 - i++ - - b = uint64(buf[i]) - i++ - x += b << 7 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 7 - - b = uint64(buf[i]) - i++ - x += b << 14 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 14 - - b = uint64(buf[i]) - i++ - x += b << 21 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 21 - - b = uint64(buf[i]) - i++ - x += b << 28 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 28 - - b = uint64(buf[i]) - i++ - x += b << 35 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 35 - - b = uint64(buf[i]) - i++ - x += b << 42 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 42 - - b = uint64(buf[i]) - i++ - x += b << 49 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 49 - - b = uint64(buf[i]) - i++ - x += b << 56 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 56 - - b = uint64(buf[i]) - i++ - x += b << 63 - if b&0x80 == 0 { - goto done - } - - return 0, errOverflow - -done: - p.index = i - return x, nil -} - -// DecodeFixed64 reads a 64-bit integer from the Buffer. -// This is the format for the -// fixed64, sfixed64, and double protocol buffer types. -func (p *Buffer) DecodeFixed64() (x uint64, err error) { - // x, err already 0 - i := p.index + 8 - if i < 0 || i > len(p.buf) { - err = io.ErrUnexpectedEOF - return - } - p.index = i - - x = uint64(p.buf[i-8]) - x |= uint64(p.buf[i-7]) << 8 - x |= uint64(p.buf[i-6]) << 16 - x |= uint64(p.buf[i-5]) << 24 - x |= uint64(p.buf[i-4]) << 32 - x |= uint64(p.buf[i-3]) << 40 - x |= uint64(p.buf[i-2]) << 48 - x |= uint64(p.buf[i-1]) << 56 - return -} - -// DecodeFixed32 reads a 32-bit integer from the Buffer. -// This is the format for the -// fixed32, sfixed32, and float protocol buffer types. -func (p *Buffer) DecodeFixed32() (x uint64, err error) { - // x, err already 0 - i := p.index + 4 - if i < 0 || i > len(p.buf) { - err = io.ErrUnexpectedEOF - return - } - p.index = i - - x = uint64(p.buf[i-4]) - x |= uint64(p.buf[i-3]) << 8 - x |= uint64(p.buf[i-2]) << 16 - x |= uint64(p.buf[i-1]) << 24 - return -} - -// DecodeZigzag64 reads a zigzag-encoded 64-bit integer -// from the Buffer. -// This is the format used for the sint64 protocol buffer type. -func (p *Buffer) DecodeZigzag64() (x uint64, err error) { - x, err = p.DecodeVarint() - if err != nil { - return - } - x = (x >> 1) ^ uint64((int64(x&1)<<63)>>63) - return -} - -// DecodeZigzag32 reads a zigzag-encoded 32-bit integer -// from the Buffer. -// This is the format used for the sint32 protocol buffer type. -func (p *Buffer) DecodeZigzag32() (x uint64, err error) { - x, err = p.DecodeVarint() - if err != nil { - return - } - x = uint64((uint32(x) >> 1) ^ uint32((int32(x&1)<<31)>>31)) - return -} - -// DecodeRawBytes reads a count-delimited byte buffer from the Buffer. -// This is the format used for the bytes protocol buffer -// type and for embedded messages. -func (p *Buffer) DecodeRawBytes(alloc bool) (buf []byte, err error) { - n, err := p.DecodeVarint() - if err != nil { - return nil, err - } - - nb := int(n) - if nb < 0 { - return nil, fmt.Errorf("proto: bad byte length %d", nb) - } - end := p.index + nb - if end < p.index || end > len(p.buf) { - return nil, io.ErrUnexpectedEOF - } - - if !alloc { - // todo: check if can get more uses of alloc=false - buf = p.buf[p.index:end] - p.index += nb - return - } - - buf = make([]byte, nb) - copy(buf, p.buf[p.index:]) - p.index += nb - return -} - -// DecodeStringBytes reads an encoded string from the Buffer. -// This is the format used for the proto2 string type. -func (p *Buffer) DecodeStringBytes() (s string, err error) { - buf, err := p.DecodeRawBytes(false) - if err != nil { - return - } - return string(buf), nil -} - -// Unmarshaler is the interface representing objects that can -// unmarshal themselves. The argument points to data that may be -// overwritten, so implementations should not keep references to the -// buffer. -// Unmarshal implementations should not clear the receiver. -// Any unmarshaled data should be merged into the receiver. -// Callers of Unmarshal that do not want to retain existing data -// should Reset the receiver before calling Unmarshal. -type Unmarshaler interface { - Unmarshal([]byte) error -} - -// newUnmarshaler is the interface representing objects that can -// unmarshal themselves. The semantics are identical to Unmarshaler. -// -// This exists to support protoc-gen-go generated messages. -// The proto package will stop type-asserting to this interface in the future. -// -// DO NOT DEPEND ON THIS. -type newUnmarshaler interface { - XXX_Unmarshal([]byte) error -} - -// Unmarshal parses the protocol buffer representation in buf and places the -// decoded result in pb. If the struct underlying pb does not match -// the data in buf, the results can be unpredictable. -// -// Unmarshal resets pb before starting to unmarshal, so any -// existing data in pb is always removed. Use UnmarshalMerge -// to preserve and append to existing data. -func Unmarshal(buf []byte, pb Message) error { - pb.Reset() - if u, ok := pb.(newUnmarshaler); ok { - return u.XXX_Unmarshal(buf) - } - if u, ok := pb.(Unmarshaler); ok { - return u.Unmarshal(buf) - } - return NewBuffer(buf).Unmarshal(pb) -} - -// UnmarshalMerge parses the protocol buffer representation in buf and -// writes the decoded result to pb. If the struct underlying pb does not match -// the data in buf, the results can be unpredictable. -// -// UnmarshalMerge merges into existing data in pb. -// Most code should use Unmarshal instead. -func UnmarshalMerge(buf []byte, pb Message) error { - if u, ok := pb.(newUnmarshaler); ok { - return u.XXX_Unmarshal(buf) - } - if u, ok := pb.(Unmarshaler); ok { - // NOTE: The history of proto have unfortunately been inconsistent - // whether Unmarshaler should or should not implicitly clear itself. - // Some implementations do, most do not. - // Thus, calling this here may or may not do what people want. - // - // See https://github.com/golang/protobuf/issues/424 - return u.Unmarshal(buf) - } - return NewBuffer(buf).Unmarshal(pb) -} - -// DecodeMessage reads a count-delimited message from the Buffer. -func (p *Buffer) DecodeMessage(pb Message) error { - enc, err := p.DecodeRawBytes(false) - if err != nil { - return err - } - return NewBuffer(enc).Unmarshal(pb) -} - -// DecodeGroup reads a tag-delimited group from the Buffer. -// StartGroup tag is already consumed. This function consumes -// EndGroup tag. -func (p *Buffer) DecodeGroup(pb Message) error { - b := p.buf[p.index:] - x, y := findEndGroup(b) - if x < 0 { - return io.ErrUnexpectedEOF - } - err := Unmarshal(b[:x], pb) - p.index += y - return err -} - -// Unmarshal parses the protocol buffer representation in the -// Buffer and places the decoded result in pb. If the struct -// underlying pb does not match the data in the buffer, the results can be -// unpredictable. -// -// Unlike proto.Unmarshal, this does not reset pb before starting to unmarshal. -func (p *Buffer) Unmarshal(pb Message) error { - // If the object can unmarshal itself, let it. - if u, ok := pb.(newUnmarshaler); ok { - err := u.XXX_Unmarshal(p.buf[p.index:]) - p.index = len(p.buf) - return err - } - if u, ok := pb.(Unmarshaler); ok { - // NOTE: The history of proto have unfortunately been inconsistent - // whether Unmarshaler should or should not implicitly clear itself. - // Some implementations do, most do not. - // Thus, calling this here may or may not do what people want. - // - // See https://github.com/golang/protobuf/issues/424 - err := u.Unmarshal(p.buf[p.index:]) - p.index = len(p.buf) - return err - } - - // Slow workaround for messages that aren't Unmarshalers. - // This includes some hand-coded .pb.go files and - // bootstrap protos. - // TODO: fix all of those and then add Unmarshal to - // the Message interface. Then: - // The cast above and code below can be deleted. - // The old unmarshaler can be deleted. - // Clients can call Unmarshal directly (can already do that, actually). - var info InternalMessageInfo - err := info.Unmarshal(pb, p.buf[p.index:]) - p.index = len(p.buf) - return err -} diff --git a/vendor/github.com/gogo/protobuf/proto/deprecated.go b/vendor/github.com/gogo/protobuf/proto/deprecated.go deleted file mode 100644 index 35b882c09..000000000 --- a/vendor/github.com/gogo/protobuf/proto/deprecated.go +++ /dev/null @@ -1,63 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2018 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 proto - -import "errors" - -// Deprecated: do not use. -type Stats struct{ Emalloc, Dmalloc, Encode, Decode, Chit, Cmiss, Size uint64 } - -// Deprecated: do not use. -func GetStats() Stats { return Stats{} } - -// Deprecated: do not use. -func MarshalMessageSet(interface{}) ([]byte, error) { - return nil, errors.New("proto: not implemented") -} - -// Deprecated: do not use. -func UnmarshalMessageSet([]byte, interface{}) error { - return errors.New("proto: not implemented") -} - -// Deprecated: do not use. -func MarshalMessageSetJSON(interface{}) ([]byte, error) { - return nil, errors.New("proto: not implemented") -} - -// Deprecated: do not use. -func UnmarshalMessageSetJSON([]byte, interface{}) error { - return errors.New("proto: not implemented") -} - -// Deprecated: do not use. -func RegisterMessageSetType(Message, int32, string) {} diff --git a/vendor/github.com/gogo/protobuf/proto/discard.go b/vendor/github.com/gogo/protobuf/proto/discard.go deleted file mode 100644 index fe1bd7d90..000000000 --- a/vendor/github.com/gogo/protobuf/proto/discard.go +++ /dev/null @@ -1,350 +0,0 @@ -// 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 proto - -import ( - "fmt" - "reflect" - "strings" - "sync" - "sync/atomic" -) - -type generatedDiscarder interface { - XXX_DiscardUnknown() -} - -// DiscardUnknown recursively discards all unknown fields from this message -// and all embedded messages. -// -// When unmarshaling a message with unrecognized fields, the tags and values -// of such fields are preserved in the Message. This allows a later call to -// marshal to be able to produce a message that continues to have those -// unrecognized fields. To avoid this, DiscardUnknown is used to -// explicitly clear the unknown fields after unmarshaling. -// -// For proto2 messages, the unknown fields of message extensions are only -// discarded from messages that have been accessed via GetExtension. -func DiscardUnknown(m Message) { - if m, ok := m.(generatedDiscarder); ok { - m.XXX_DiscardUnknown() - return - } - // TODO: Dynamically populate a InternalMessageInfo for legacy messages, - // but the master branch has no implementation for InternalMessageInfo, - // so it would be more work to replicate that approach. - discardLegacy(m) -} - -// DiscardUnknown recursively discards all unknown fields. -func (a *InternalMessageInfo) DiscardUnknown(m Message) { - di := atomicLoadDiscardInfo(&a.discard) - if di == nil { - di = getDiscardInfo(reflect.TypeOf(m).Elem()) - atomicStoreDiscardInfo(&a.discard, di) - } - di.discard(toPointer(&m)) -} - -type discardInfo struct { - typ reflect.Type - - initialized int32 // 0: only typ is valid, 1: everything is valid - lock sync.Mutex - - fields []discardFieldInfo - unrecognized field -} - -type discardFieldInfo struct { - field field // Offset of field, guaranteed to be valid - discard func(src pointer) -} - -var ( - discardInfoMap = map[reflect.Type]*discardInfo{} - discardInfoLock sync.Mutex -) - -func getDiscardInfo(t reflect.Type) *discardInfo { - discardInfoLock.Lock() - defer discardInfoLock.Unlock() - di := discardInfoMap[t] - if di == nil { - di = &discardInfo{typ: t} - discardInfoMap[t] = di - } - return di -} - -func (di *discardInfo) discard(src pointer) { - if src.isNil() { - return // Nothing to do. - } - - if atomic.LoadInt32(&di.initialized) == 0 { - di.computeDiscardInfo() - } - - for _, fi := range di.fields { - sfp := src.offset(fi.field) - fi.discard(sfp) - } - - // For proto2 messages, only discard unknown fields in message extensions - // that have been accessed via GetExtension. - if em, err := extendable(src.asPointerTo(di.typ).Interface()); err == nil { - // Ignore lock since DiscardUnknown is not concurrency safe. - emm, _ := em.extensionsRead() - for _, mx := range emm { - if m, ok := mx.value.(Message); ok { - DiscardUnknown(m) - } - } - } - - if di.unrecognized.IsValid() { - *src.offset(di.unrecognized).toBytes() = nil - } -} - -func (di *discardInfo) computeDiscardInfo() { - di.lock.Lock() - defer di.lock.Unlock() - if di.initialized != 0 { - return - } - t := di.typ - n := t.NumField() - - for i := 0; i < n; i++ { - f := t.Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - - dfi := discardFieldInfo{field: toField(&f)} - tf := f.Type - - // Unwrap tf to get its most basic type. - var isPointer, isSlice bool - if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { - isSlice = true - tf = tf.Elem() - } - if tf.Kind() == reflect.Ptr { - isPointer = true - tf = tf.Elem() - } - if isPointer && isSlice && tf.Kind() != reflect.Struct { - panic(fmt.Sprintf("%v.%s cannot be a slice of pointers to primitive types", t, f.Name)) - } - - switch tf.Kind() { - case reflect.Struct: - switch { - case !isPointer: - panic(fmt.Sprintf("%v.%s cannot be a direct struct value", t, f.Name)) - case isSlice: // E.g., []*pb.T - discardInfo := getDiscardInfo(tf) - dfi.discard = func(src pointer) { - sps := src.getPointerSlice() - for _, sp := range sps { - if !sp.isNil() { - discardInfo.discard(sp) - } - } - } - default: // E.g., *pb.T - discardInfo := getDiscardInfo(tf) - dfi.discard = func(src pointer) { - sp := src.getPointer() - if !sp.isNil() { - discardInfo.discard(sp) - } - } - } - case reflect.Map: - switch { - case isPointer || isSlice: - panic(fmt.Sprintf("%v.%s cannot be a pointer to a map or a slice of map values", t, f.Name)) - default: // E.g., map[K]V - if tf.Elem().Kind() == reflect.Ptr { // Proto struct (e.g., *T) - dfi.discard = func(src pointer) { - sm := src.asPointerTo(tf).Elem() - if sm.Len() == 0 { - return - } - for _, key := range sm.MapKeys() { - val := sm.MapIndex(key) - DiscardUnknown(val.Interface().(Message)) - } - } - } else { - dfi.discard = func(pointer) {} // Noop - } - } - case reflect.Interface: - // Must be oneof field. - switch { - case isPointer || isSlice: - panic(fmt.Sprintf("%v.%s cannot be a pointer to a interface or a slice of interface values", t, f.Name)) - default: // E.g., interface{} - // TODO: Make this faster? - dfi.discard = func(src pointer) { - su := src.asPointerTo(tf).Elem() - if !su.IsNil() { - sv := su.Elem().Elem().Field(0) - if sv.Kind() == reflect.Ptr && sv.IsNil() { - return - } - switch sv.Type().Kind() { - case reflect.Ptr: // Proto struct (e.g., *T) - DiscardUnknown(sv.Interface().(Message)) - } - } - } - } - default: - continue - } - di.fields = append(di.fields, dfi) - } - - di.unrecognized = invalidField - if f, ok := t.FieldByName("XXX_unrecognized"); ok { - if f.Type != reflect.TypeOf([]byte{}) { - panic("expected XXX_unrecognized to be of type []byte") - } - di.unrecognized = toField(&f) - } - - atomic.StoreInt32(&di.initialized, 1) -} - -func discardLegacy(m Message) { - v := reflect.ValueOf(m) - if v.Kind() != reflect.Ptr || v.IsNil() { - return - } - v = v.Elem() - if v.Kind() != reflect.Struct { - return - } - t := v.Type() - - for i := 0; i < v.NumField(); i++ { - f := t.Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - vf := v.Field(i) - tf := f.Type - - // Unwrap tf to get its most basic type. - var isPointer, isSlice bool - if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { - isSlice = true - tf = tf.Elem() - } - if tf.Kind() == reflect.Ptr { - isPointer = true - tf = tf.Elem() - } - if isPointer && isSlice && tf.Kind() != reflect.Struct { - panic(fmt.Sprintf("%T.%s cannot be a slice of pointers to primitive types", m, f.Name)) - } - - switch tf.Kind() { - case reflect.Struct: - switch { - case !isPointer: - panic(fmt.Sprintf("%T.%s cannot be a direct struct value", m, f.Name)) - case isSlice: // E.g., []*pb.T - for j := 0; j < vf.Len(); j++ { - discardLegacy(vf.Index(j).Interface().(Message)) - } - default: // E.g., *pb.T - discardLegacy(vf.Interface().(Message)) - } - case reflect.Map: - switch { - case isPointer || isSlice: - panic(fmt.Sprintf("%T.%s cannot be a pointer to a map or a slice of map values", m, f.Name)) - default: // E.g., map[K]V - tv := vf.Type().Elem() - if tv.Kind() == reflect.Ptr && tv.Implements(protoMessageType) { // Proto struct (e.g., *T) - for _, key := range vf.MapKeys() { - val := vf.MapIndex(key) - discardLegacy(val.Interface().(Message)) - } - } - } - case reflect.Interface: - // Must be oneof field. - switch { - case isPointer || isSlice: - panic(fmt.Sprintf("%T.%s cannot be a pointer to a interface or a slice of interface values", m, f.Name)) - default: // E.g., test_proto.isCommunique_Union interface - if !vf.IsNil() && f.Tag.Get("protobuf_oneof") != "" { - vf = vf.Elem() // E.g., *test_proto.Communique_Msg - if !vf.IsNil() { - vf = vf.Elem() // E.g., test_proto.Communique_Msg - vf = vf.Field(0) // E.g., Proto struct (e.g., *T) or primitive value - if vf.Kind() == reflect.Ptr { - discardLegacy(vf.Interface().(Message)) - } - } - } - } - } - } - - if vf := v.FieldByName("XXX_unrecognized"); vf.IsValid() { - if vf.Type() != reflect.TypeOf([]byte{}) { - panic("expected XXX_unrecognized to be of type []byte") - } - vf.Set(reflect.ValueOf([]byte(nil))) - } - - // For proto2 messages, only discard unknown fields in message extensions - // that have been accessed via GetExtension. - if em, err := extendable(m); err == nil { - // Ignore lock since discardLegacy is not concurrency safe. - emm, _ := em.extensionsRead() - for _, mx := range emm { - if m, ok := mx.value.(Message); ok { - discardLegacy(m) - } - } - } -} diff --git a/vendor/github.com/gogo/protobuf/proto/duration.go b/vendor/github.com/gogo/protobuf/proto/duration.go deleted file mode 100644 index 93464c91c..000000000 --- a/vendor/github.com/gogo/protobuf/proto/duration.go +++ /dev/null @@ -1,100 +0,0 @@ -// 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 proto - -// This file implements conversions between google.protobuf.Duration -// and time.Duration. - -import ( - "errors" - "fmt" - "time" -) - -const ( - // Range of a 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 Duration is valid according to the -// definition in google/protobuf/duration.proto. A valid Duration -// may still be too large to fit into a time.Duration (the range of Duration -// is about 10,000 years, and the range of time.Duration is about 290). -func validateDuration(d *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 -} - -// DurationFromProto converts a Duration to a time.Duration. DurationFromProto -// returns an error if the Duration is invalid or is too large to be -// represented in a time.Duration. -func durationFromProto(p *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 Duration. -func durationProto(d time.Duration) *duration { - nanos := d.Nanoseconds() - secs := nanos / 1e9 - nanos -= secs * 1e9 - return &duration{ - Seconds: secs, - Nanos: int32(nanos), - } -} diff --git a/vendor/github.com/gogo/protobuf/proto/duration_gogo.go b/vendor/github.com/gogo/protobuf/proto/duration_gogo.go deleted file mode 100644 index e748e1730..000000000 --- a/vendor/github.com/gogo/protobuf/proto/duration_gogo.go +++ /dev/null @@ -1,49 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2016, The GoGo Authors. All rights reserved. -// http://github.com/gogo/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. -// -// 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 proto - -import ( - "reflect" - "time" -) - -var durationType = reflect.TypeOf((*time.Duration)(nil)).Elem() - -type duration struct { - Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` - Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` -} - -func (m *duration) Reset() { *m = duration{} } -func (*duration) ProtoMessage() {} -func (*duration) String() string { return "duration" } - -func init() { - RegisterType((*duration)(nil), "gogo.protobuf.proto.duration") -} diff --git a/vendor/github.com/gogo/protobuf/proto/encode.go b/vendor/github.com/gogo/protobuf/proto/encode.go deleted file mode 100644 index 9581ccd30..000000000 --- a/vendor/github.com/gogo/protobuf/proto/encode.go +++ /dev/null @@ -1,205 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 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 proto - -/* - * Routines for encoding data into the wire format for protocol buffers. - */ - -import ( - "errors" - "reflect" -) - -var ( - // errRepeatedHasNil is the error returned if Marshal is called with - // a struct with a repeated field containing a nil element. - errRepeatedHasNil = errors.New("proto: repeated field has nil element") - - // errOneofHasNil is the error returned if Marshal is called with - // a struct with a oneof field containing a nil element. - errOneofHasNil = errors.New("proto: oneof field has nil value") - - // ErrNil is the error returned if Marshal is called with nil. - ErrNil = errors.New("proto: Marshal called with nil") - - // ErrTooLarge is the error returned if Marshal is called with a - // message that encodes to >2GB. - ErrTooLarge = errors.New("proto: message encodes to over 2 GB") -) - -// The fundamental encoders that put bytes on the wire. -// Those that take integer types all accept uint64 and are -// therefore of type valueEncoder. - -const maxVarintBytes = 10 // maximum length of a varint - -// EncodeVarint returns the varint encoding of x. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -// Not used by the package itself, but helpful to clients -// wishing to use the same encoding. -func EncodeVarint(x uint64) []byte { - var buf [maxVarintBytes]byte - var n int - for n = 0; x > 127; n++ { - buf[n] = 0x80 | uint8(x&0x7F) - x >>= 7 - } - buf[n] = uint8(x) - n++ - return buf[0:n] -} - -// EncodeVarint writes a varint-encoded integer to the Buffer. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -func (p *Buffer) EncodeVarint(x uint64) error { - for x >= 1<<7 { - p.buf = append(p.buf, uint8(x&0x7f|0x80)) - x >>= 7 - } - p.buf = append(p.buf, uint8(x)) - return nil -} - -// SizeVarint returns the varint encoding size of an integer. -func SizeVarint(x uint64) int { - switch { - case x < 1<<7: - return 1 - case x < 1<<14: - return 2 - case x < 1<<21: - return 3 - case x < 1<<28: - return 4 - case x < 1<<35: - return 5 - case x < 1<<42: - return 6 - case x < 1<<49: - return 7 - case x < 1<<56: - return 8 - case x < 1<<63: - return 9 - } - return 10 -} - -// EncodeFixed64 writes a 64-bit integer to the Buffer. -// This is the format for the -// fixed64, sfixed64, and double protocol buffer types. -func (p *Buffer) EncodeFixed64(x uint64) error { - p.buf = append(p.buf, - uint8(x), - uint8(x>>8), - uint8(x>>16), - uint8(x>>24), - uint8(x>>32), - uint8(x>>40), - uint8(x>>48), - uint8(x>>56)) - return nil -} - -// EncodeFixed32 writes a 32-bit integer to the Buffer. -// This is the format for the -// fixed32, sfixed32, and float protocol buffer types. -func (p *Buffer) EncodeFixed32(x uint64) error { - p.buf = append(p.buf, - uint8(x), - uint8(x>>8), - uint8(x>>16), - uint8(x>>24)) - return nil -} - -// EncodeZigzag64 writes a zigzag-encoded 64-bit integer -// to the Buffer. -// This is the format used for the sint64 protocol buffer type. -func (p *Buffer) EncodeZigzag64(x uint64) error { - // use signed number to get arithmetic right shift. - return p.EncodeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} - -// EncodeZigzag32 writes a zigzag-encoded 32-bit integer -// to the Buffer. -// This is the format used for the sint32 protocol buffer type. -func (p *Buffer) EncodeZigzag32(x uint64) error { - // use signed number to get arithmetic right shift. - return p.EncodeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31)))) -} - -// EncodeRawBytes writes a count-delimited byte buffer to the Buffer. -// This is the format used for the bytes protocol buffer -// type and for embedded messages. -func (p *Buffer) EncodeRawBytes(b []byte) error { - p.EncodeVarint(uint64(len(b))) - p.buf = append(p.buf, b...) - return nil -} - -// EncodeStringBytes writes an encoded string to the Buffer. -// This is the format used for the proto2 string type. -func (p *Buffer) EncodeStringBytes(s string) error { - p.EncodeVarint(uint64(len(s))) - p.buf = append(p.buf, s...) - return nil -} - -// Marshaler is the interface representing objects that can marshal themselves. -type Marshaler interface { - Marshal() ([]byte, error) -} - -// EncodeMessage writes the protocol buffer to the Buffer, -// prefixed by a varint-encoded length. -func (p *Buffer) EncodeMessage(pb Message) error { - siz := Size(pb) - sizVar := SizeVarint(uint64(siz)) - p.grow(siz + sizVar) - p.EncodeVarint(uint64(siz)) - return p.Marshal(pb) -} - -// All protocol buffer fields are nillable, but be careful. -func isNil(v reflect.Value) bool { - switch v.Kind() { - case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: - return v.IsNil() - } - return false -} diff --git a/vendor/github.com/gogo/protobuf/proto/encode_gogo.go b/vendor/github.com/gogo/protobuf/proto/encode_gogo.go deleted file mode 100644 index 0f5fb173e..000000000 --- a/vendor/github.com/gogo/protobuf/proto/encode_gogo.go +++ /dev/null @@ -1,33 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/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. -// -// 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 proto - -func NewRequiredNotSetError(field string) *RequiredNotSetError { - return &RequiredNotSetError{field} -} diff --git a/vendor/github.com/gogo/protobuf/proto/equal.go b/vendor/github.com/gogo/protobuf/proto/equal.go deleted file mode 100644 index d4db5a1c1..000000000 --- a/vendor/github.com/gogo/protobuf/proto/equal.go +++ /dev/null @@ -1,300 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2011 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. - -// Protocol buffer comparison. - -package proto - -import ( - "bytes" - "log" - "reflect" - "strings" -) - -/* -Equal returns true iff protocol buffers a and b are equal. -The arguments must both be pointers to protocol buffer structs. - -Equality is defined in this way: - - Two messages are equal iff they are the same type, - corresponding fields are equal, unknown field sets - are equal, and extensions sets are equal. - - Two set scalar fields are equal iff their values are equal. - If the fields are of a floating-point type, remember that - NaN != x for all x, including NaN. If the message is defined - in a proto3 .proto file, fields are not "set"; specifically, - zero length proto3 "bytes" fields are equal (nil == {}). - - Two repeated fields are equal iff their lengths are the same, - and their corresponding elements are equal. Note a "bytes" field, - although represented by []byte, is not a repeated field and the - rule for the scalar fields described above applies. - - Two unset fields are equal. - - Two unknown field sets are equal if their current - encoded state is equal. - - Two extension sets are equal iff they have corresponding - elements that are pairwise equal. - - Two map fields are equal iff their lengths are the same, - and they contain the same set of elements. Zero-length map - fields are equal. - - Every other combination of things are not equal. - -The return value is undefined if a and b are not protocol buffers. -*/ -func Equal(a, b Message) bool { - if a == nil || b == nil { - return a == b - } - v1, v2 := reflect.ValueOf(a), reflect.ValueOf(b) - if v1.Type() != v2.Type() { - return false - } - if v1.Kind() == reflect.Ptr { - if v1.IsNil() { - return v2.IsNil() - } - if v2.IsNil() { - return false - } - v1, v2 = v1.Elem(), v2.Elem() - } - if v1.Kind() != reflect.Struct { - return false - } - return equalStruct(v1, v2) -} - -// v1 and v2 are known to have the same type. -func equalStruct(v1, v2 reflect.Value) bool { - sprop := GetProperties(v1.Type()) - for i := 0; i < v1.NumField(); i++ { - f := v1.Type().Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - f1, f2 := v1.Field(i), v2.Field(i) - if f.Type.Kind() == reflect.Ptr { - if n1, n2 := f1.IsNil(), f2.IsNil(); n1 && n2 { - // both unset - continue - } else if n1 != n2 { - // set/unset mismatch - return false - } - f1, f2 = f1.Elem(), f2.Elem() - } - if !equalAny(f1, f2, sprop.Prop[i]) { - return false - } - } - - if em1 := v1.FieldByName("XXX_InternalExtensions"); em1.IsValid() { - em2 := v2.FieldByName("XXX_InternalExtensions") - if !equalExtensions(v1.Type(), em1.Interface().(XXX_InternalExtensions), em2.Interface().(XXX_InternalExtensions)) { - return false - } - } - - if em1 := v1.FieldByName("XXX_extensions"); em1.IsValid() { - em2 := v2.FieldByName("XXX_extensions") - if !equalExtMap(v1.Type(), em1.Interface().(map[int32]Extension), em2.Interface().(map[int32]Extension)) { - return false - } - } - - uf := v1.FieldByName("XXX_unrecognized") - if !uf.IsValid() { - return true - } - - u1 := uf.Bytes() - u2 := v2.FieldByName("XXX_unrecognized").Bytes() - return bytes.Equal(u1, u2) -} - -// v1 and v2 are known to have the same type. -// prop may be nil. -func equalAny(v1, v2 reflect.Value, prop *Properties) bool { - if v1.Type() == protoMessageType { - m1, _ := v1.Interface().(Message) - m2, _ := v2.Interface().(Message) - return Equal(m1, m2) - } - switch v1.Kind() { - case reflect.Bool: - return v1.Bool() == v2.Bool() - case reflect.Float32, reflect.Float64: - return v1.Float() == v2.Float() - case reflect.Int32, reflect.Int64: - return v1.Int() == v2.Int() - case reflect.Interface: - // Probably a oneof field; compare the inner values. - n1, n2 := v1.IsNil(), v2.IsNil() - if n1 || n2 { - return n1 == n2 - } - e1, e2 := v1.Elem(), v2.Elem() - if e1.Type() != e2.Type() { - return false - } - return equalAny(e1, e2, nil) - case reflect.Map: - if v1.Len() != v2.Len() { - return false - } - for _, key := range v1.MapKeys() { - val2 := v2.MapIndex(key) - if !val2.IsValid() { - // This key was not found in the second map. - return false - } - if !equalAny(v1.MapIndex(key), val2, nil) { - return false - } - } - return true - case reflect.Ptr: - // Maps may have nil values in them, so check for nil. - if v1.IsNil() && v2.IsNil() { - return true - } - if v1.IsNil() != v2.IsNil() { - return false - } - return equalAny(v1.Elem(), v2.Elem(), prop) - case reflect.Slice: - if v1.Type().Elem().Kind() == reflect.Uint8 { - // short circuit: []byte - - // Edge case: if this is in a proto3 message, a zero length - // bytes field is considered the zero value. - if prop != nil && prop.proto3 && v1.Len() == 0 && v2.Len() == 0 { - return true - } - if v1.IsNil() != v2.IsNil() { - return false - } - return bytes.Equal(v1.Interface().([]byte), v2.Interface().([]byte)) - } - - if v1.Len() != v2.Len() { - return false - } - for i := 0; i < v1.Len(); i++ { - if !equalAny(v1.Index(i), v2.Index(i), prop) { - return false - } - } - return true - case reflect.String: - return v1.Interface().(string) == v2.Interface().(string) - case reflect.Struct: - return equalStruct(v1, v2) - case reflect.Uint32, reflect.Uint64: - return v1.Uint() == v2.Uint() - } - - // unknown type, so not a protocol buffer - log.Printf("proto: don't know how to compare %v", v1) - return false -} - -// base is the struct type that the extensions are based on. -// x1 and x2 are InternalExtensions. -func equalExtensions(base reflect.Type, x1, x2 XXX_InternalExtensions) bool { - em1, _ := x1.extensionsRead() - em2, _ := x2.extensionsRead() - return equalExtMap(base, em1, em2) -} - -func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool { - if len(em1) != len(em2) { - return false - } - - for extNum, e1 := range em1 { - e2, ok := em2[extNum] - if !ok { - return false - } - - m1, m2 := e1.value, e2.value - - if m1 == nil && m2 == nil { - // Both have only encoded form. - if bytes.Equal(e1.enc, e2.enc) { - continue - } - // The bytes are different, but the extensions might still be - // equal. We need to decode them to compare. - } - - if m1 != nil && m2 != nil { - // Both are unencoded. - if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { - return false - } - continue - } - - // At least one is encoded. To do a semantically correct comparison - // we need to unmarshal them first. - var desc *ExtensionDesc - if m := extensionMaps[base]; m != nil { - desc = m[extNum] - } - if desc == nil { - // If both have only encoded form and the bytes are the same, - // it is handled above. We get here when the bytes are different. - // We don't know how to decode it, so just compare them as byte - // slices. - log.Printf("proto: don't know how to compare extension %d of %v", extNum, base) - return false - } - var err error - if m1 == nil { - m1, err = decodeExtension(e1.enc, desc) - } - if m2 == nil && err == nil { - m2, err = decodeExtension(e2.enc, desc) - } - if err != nil { - // The encoded form is invalid. - log.Printf("proto: badly encoded extension %d of %v: %v", extNum, base, err) - return false - } - if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { - return false - } - } - - return true -} diff --git a/vendor/github.com/gogo/protobuf/proto/extensions.go b/vendor/github.com/gogo/protobuf/proto/extensions.go deleted file mode 100644 index 341c6f57f..000000000 --- a/vendor/github.com/gogo/protobuf/proto/extensions.go +++ /dev/null @@ -1,605 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 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 proto - -/* - * Types and routines for supporting protocol buffer extensions. - */ - -import ( - "errors" - "fmt" - "io" - "reflect" - "strconv" - "sync" -) - -// ErrMissingExtension is the error returned by GetExtension if the named extension is not in the message. -var ErrMissingExtension = errors.New("proto: missing extension") - -// ExtensionRange represents a range of message extensions for a protocol buffer. -// Used in code generated by the protocol compiler. -type ExtensionRange struct { - Start, End int32 // both inclusive -} - -// extendableProto is an interface implemented by any protocol buffer generated by the current -// proto compiler that may be extended. -type extendableProto interface { - Message - ExtensionRangeArray() []ExtensionRange - extensionsWrite() map[int32]Extension - extensionsRead() (map[int32]Extension, sync.Locker) -} - -// extendableProtoV1 is an interface implemented by a protocol buffer generated by the previous -// version of the proto compiler that may be extended. -type extendableProtoV1 interface { - Message - ExtensionRangeArray() []ExtensionRange - ExtensionMap() map[int32]Extension -} - -// extensionAdapter is a wrapper around extendableProtoV1 that implements extendableProto. -type extensionAdapter struct { - extendableProtoV1 -} - -func (e extensionAdapter) extensionsWrite() map[int32]Extension { - return e.ExtensionMap() -} - -func (e extensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) { - return e.ExtensionMap(), notLocker{} -} - -// notLocker is a sync.Locker whose Lock and Unlock methods are nops. -type notLocker struct{} - -func (n notLocker) Lock() {} -func (n notLocker) Unlock() {} - -// extendable returns the extendableProto interface for the given generated proto message. -// If the proto message has the old extension format, it returns a wrapper that implements -// the extendableProto interface. -func extendable(p interface{}) (extendableProto, error) { - switch p := p.(type) { - case extendableProto: - if isNilPtr(p) { - return nil, fmt.Errorf("proto: nil %T is not extendable", p) - } - return p, nil - case extendableProtoV1: - if isNilPtr(p) { - return nil, fmt.Errorf("proto: nil %T is not extendable", p) - } - return extensionAdapter{p}, nil - case extensionsBytes: - return slowExtensionAdapter{p}, nil - } - // Don't allocate a specific error containing %T: - // this is the hot path for Clone and MarshalText. - return nil, errNotExtendable -} - -var errNotExtendable = errors.New("proto: not an extendable proto.Message") - -func isNilPtr(x interface{}) bool { - v := reflect.ValueOf(x) - return v.Kind() == reflect.Ptr && v.IsNil() -} - -// XXX_InternalExtensions is an internal representation of proto extensions. -// -// Each generated message struct type embeds an anonymous XXX_InternalExtensions field, -// thus gaining the unexported 'extensions' method, which can be called only from the proto package. -// -// The methods of XXX_InternalExtensions are not concurrency safe in general, -// but calls to logically read-only methods such as has and get may be executed concurrently. -type XXX_InternalExtensions struct { - // The struct must be indirect so that if a user inadvertently copies a - // generated message and its embedded XXX_InternalExtensions, they - // avoid the mayhem of a copied mutex. - // - // The mutex serializes all logically read-only operations to p.extensionMap. - // It is up to the client to ensure that write operations to p.extensionMap are - // mutually exclusive with other accesses. - p *struct { - mu sync.Mutex - extensionMap map[int32]Extension - } -} - -// extensionsWrite returns the extension map, creating it on first use. -func (e *XXX_InternalExtensions) extensionsWrite() map[int32]Extension { - if e.p == nil { - e.p = new(struct { - mu sync.Mutex - extensionMap map[int32]Extension - }) - e.p.extensionMap = make(map[int32]Extension) - } - return e.p.extensionMap -} - -// extensionsRead returns the extensions map for read-only use. It may be nil. -// The caller must hold the returned mutex's lock when accessing Elements within the map. -func (e *XXX_InternalExtensions) extensionsRead() (map[int32]Extension, sync.Locker) { - if e.p == nil { - return nil, nil - } - return e.p.extensionMap, &e.p.mu -} - -// ExtensionDesc represents an extension specification. -// Used in generated code from the protocol compiler. -type ExtensionDesc struct { - ExtendedType Message // nil pointer to the type that is being extended - ExtensionType interface{} // nil pointer to the extension type - Field int32 // field number - Name string // fully-qualified name of extension, for text formatting - Tag string // protobuf tag style - Filename string // name of the file in which the extension is defined -} - -func (ed *ExtensionDesc) repeated() bool { - t := reflect.TypeOf(ed.ExtensionType) - return t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 -} - -// Extension represents an extension in a message. -type Extension struct { - // When an extension is stored in a message using SetExtension - // only desc and value are set. When the message is marshaled - // enc will be set to the encoded form of the message. - // - // When a message is unmarshaled and contains extensions, each - // extension will have only enc set. When such an extension is - // accessed using GetExtension (or GetExtensions) desc and value - // will be set. - desc *ExtensionDesc - value interface{} - enc []byte -} - -// SetRawExtension is for testing only. -func SetRawExtension(base Message, id int32, b []byte) { - if ebase, ok := base.(extensionsBytes); ok { - clearExtension(base, id) - ext := ebase.GetExtensions() - *ext = append(*ext, b...) - return - } - epb, err := extendable(base) - if err != nil { - return - } - extmap := epb.extensionsWrite() - extmap[id] = Extension{enc: b} -} - -// isExtensionField returns true iff the given field number is in an extension range. -func isExtensionField(pb extendableProto, field int32) bool { - for _, er := range pb.ExtensionRangeArray() { - if er.Start <= field && field <= er.End { - return true - } - } - return false -} - -// checkExtensionTypes checks that the given extension is valid for pb. -func checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) error { - var pbi interface{} = pb - // Check the extended type. - if ea, ok := pbi.(extensionAdapter); ok { - pbi = ea.extendableProtoV1 - } - if ea, ok := pbi.(slowExtensionAdapter); ok { - pbi = ea.extensionsBytes - } - if a, b := reflect.TypeOf(pbi), reflect.TypeOf(extension.ExtendedType); a != b { - return fmt.Errorf("proto: bad extended type; %v does not extend %v", b, a) - } - // Check the range. - if !isExtensionField(pb, extension.Field) { - return errors.New("proto: bad extension number; not in declared ranges") - } - return nil -} - -// extPropKey is sufficient to uniquely identify an extension. -type extPropKey struct { - base reflect.Type - field int32 -} - -var extProp = struct { - sync.RWMutex - m map[extPropKey]*Properties -}{ - m: make(map[extPropKey]*Properties), -} - -func extensionProperties(ed *ExtensionDesc) *Properties { - key := extPropKey{base: reflect.TypeOf(ed.ExtendedType), field: ed.Field} - - extProp.RLock() - if prop, ok := extProp.m[key]; ok { - extProp.RUnlock() - return prop - } - extProp.RUnlock() - - extProp.Lock() - defer extProp.Unlock() - // Check again. - if prop, ok := extProp.m[key]; ok { - return prop - } - - prop := new(Properties) - prop.Init(reflect.TypeOf(ed.ExtensionType), "unknown_name", ed.Tag, nil) - extProp.m[key] = prop - return prop -} - -// HasExtension returns whether the given extension is present in pb. -func HasExtension(pb Message, extension *ExtensionDesc) bool { - if epb, doki := pb.(extensionsBytes); doki { - ext := epb.GetExtensions() - buf := *ext - o := 0 - for o < len(buf) { - tag, n := DecodeVarint(buf[o:]) - fieldNum := int32(tag >> 3) - if int32(fieldNum) == extension.Field { - return true - } - wireType := int(tag & 0x7) - o += n - l, err := size(buf[o:], wireType) - if err != nil { - return false - } - o += l - } - return false - } - // TODO: Check types, field numbers, etc.? - epb, err := extendable(pb) - if err != nil { - return false - } - extmap, mu := epb.extensionsRead() - if extmap == nil { - return false - } - mu.Lock() - _, ok := extmap[extension.Field] - mu.Unlock() - return ok -} - -// ClearExtension removes the given extension from pb. -func ClearExtension(pb Message, extension *ExtensionDesc) { - clearExtension(pb, extension.Field) -} - -func clearExtension(pb Message, fieldNum int32) { - if epb, ok := pb.(extensionsBytes); ok { - offset := 0 - for offset != -1 { - offset = deleteExtension(epb, fieldNum, offset) - } - return - } - epb, err := extendable(pb) - if err != nil { - return - } - // TODO: Check types, field numbers, etc.? - extmap := epb.extensionsWrite() - delete(extmap, fieldNum) -} - -// GetExtension retrieves a proto2 extended field from pb. -// -// If the descriptor is type complete (i.e., ExtensionDesc.ExtensionType is non-nil), -// then GetExtension parses the encoded field and returns a Go value of the specified type. -// If the field is not present, then the default value is returned (if one is specified), -// otherwise ErrMissingExtension is reported. -// -// If the descriptor is not type complete (i.e., ExtensionDesc.ExtensionType is nil), -// then GetExtension returns the raw encoded bytes of the field extension. -func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { - if epb, doki := pb.(extensionsBytes); doki { - ext := epb.GetExtensions() - return decodeExtensionFromBytes(extension, *ext) - } - - epb, err := extendable(pb) - if err != nil { - return nil, err - } - - if extension.ExtendedType != nil { - // can only check type if this is a complete descriptor - if cerr := checkExtensionTypes(epb, extension); cerr != nil { - return nil, cerr - } - } - - emap, mu := epb.extensionsRead() - if emap == nil { - return defaultExtensionValue(extension) - } - mu.Lock() - defer mu.Unlock() - e, ok := emap[extension.Field] - if !ok { - // defaultExtensionValue returns the default value or - // ErrMissingExtension if there is no default. - return defaultExtensionValue(extension) - } - - if e.value != nil { - // Already decoded. Check the descriptor, though. - if e.desc != extension { - // This shouldn't happen. If it does, it means that - // GetExtension was called twice with two different - // descriptors with the same field number. - return nil, errors.New("proto: descriptor conflict") - } - return e.value, nil - } - - if extension.ExtensionType == nil { - // incomplete descriptor - return e.enc, nil - } - - v, err := decodeExtension(e.enc, extension) - if err != nil { - return nil, err - } - - // Remember the decoded version and drop the encoded version. - // That way it is safe to mutate what we return. - e.value = v - e.desc = extension - e.enc = nil - emap[extension.Field] = e - return e.value, nil -} - -// defaultExtensionValue returns the default value for extension. -// If no default for an extension is defined ErrMissingExtension is returned. -func defaultExtensionValue(extension *ExtensionDesc) (interface{}, error) { - if extension.ExtensionType == nil { - // incomplete descriptor, so no default - return nil, ErrMissingExtension - } - - t := reflect.TypeOf(extension.ExtensionType) - props := extensionProperties(extension) - - sf, _, err := fieldDefault(t, props) - if err != nil { - return nil, err - } - - if sf == nil || sf.value == nil { - // There is no default value. - return nil, ErrMissingExtension - } - - if t.Kind() != reflect.Ptr { - // We do not need to return a Ptr, we can directly return sf.value. - return sf.value, nil - } - - // We need to return an interface{} that is a pointer to sf.value. - value := reflect.New(t).Elem() - value.Set(reflect.New(value.Type().Elem())) - if sf.kind == reflect.Int32 { - // We may have an int32 or an enum, but the underlying data is int32. - // Since we can't set an int32 into a non int32 reflect.value directly - // set it as a int32. - value.Elem().SetInt(int64(sf.value.(int32))) - } else { - value.Elem().Set(reflect.ValueOf(sf.value)) - } - return value.Interface(), nil -} - -// decodeExtension decodes an extension encoded in b. -func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) { - t := reflect.TypeOf(extension.ExtensionType) - unmarshal := typeUnmarshaler(t, extension.Tag) - - // t is a pointer to a struct, pointer to basic type or a slice. - // Allocate space to store the pointer/slice. - value := reflect.New(t).Elem() - - var err error - for { - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - wire := int(x) & 7 - - b, err = unmarshal(b, valToPointer(value.Addr()), wire) - if err != nil { - return nil, err - } - - if len(b) == 0 { - break - } - } - return value.Interface(), nil -} - -// GetExtensions returns a slice of the extensions present in pb that are also listed in es. -// The returned slice has the same length as es; missing extensions will appear as nil elements. -func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) { - epb, err := extendable(pb) - if err != nil { - return nil, err - } - extensions = make([]interface{}, len(es)) - for i, e := range es { - extensions[i], err = GetExtension(epb, e) - if err == ErrMissingExtension { - err = nil - } - if err != nil { - return - } - } - return -} - -// ExtensionDescs returns a new slice containing pb's extension descriptors, in undefined order. -// For non-registered extensions, ExtensionDescs returns an incomplete descriptor containing -// just the Field field, which defines the extension's field number. -func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) { - epb, err := extendable(pb) - if err != nil { - return nil, err - } - registeredExtensions := RegisteredExtensions(pb) - - emap, mu := epb.extensionsRead() - if emap == nil { - return nil, nil - } - mu.Lock() - defer mu.Unlock() - extensions := make([]*ExtensionDesc, 0, len(emap)) - for extid, e := range emap { - desc := e.desc - if desc == nil { - desc = registeredExtensions[extid] - if desc == nil { - desc = &ExtensionDesc{Field: extid} - } - } - - extensions = append(extensions, desc) - } - return extensions, nil -} - -// SetExtension sets the specified extension of pb to the specified value. -func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error { - if epb, ok := pb.(extensionsBytes); ok { - ClearExtension(pb, extension) - newb, err := encodeExtension(extension, value) - if err != nil { - return err - } - bb := epb.GetExtensions() - *bb = append(*bb, newb...) - return nil - } - epb, err := extendable(pb) - if err != nil { - return err - } - if err := checkExtensionTypes(epb, extension); err != nil { - return err - } - typ := reflect.TypeOf(extension.ExtensionType) - if typ != reflect.TypeOf(value) { - return fmt.Errorf("proto: bad extension value type. got: %T, want: %T", value, extension.ExtensionType) - } - // nil extension values need to be caught early, because the - // encoder can't distinguish an ErrNil due to a nil extension - // from an ErrNil due to a missing field. Extensions are - // always optional, so the encoder would just swallow the error - // and drop all the extensions from the encoded message. - if reflect.ValueOf(value).IsNil() { - return fmt.Errorf("proto: SetExtension called with nil value of type %T", value) - } - - extmap := epb.extensionsWrite() - extmap[extension.Field] = Extension{desc: extension, value: value} - return nil -} - -// ClearAllExtensions clears all extensions from pb. -func ClearAllExtensions(pb Message) { - if epb, doki := pb.(extensionsBytes); doki { - ext := epb.GetExtensions() - *ext = []byte{} - return - } - epb, err := extendable(pb) - if err != nil { - return - } - m := epb.extensionsWrite() - for k := range m { - delete(m, k) - } -} - -// A global registry of extensions. -// The generated code will register the generated descriptors by calling RegisterExtension. - -var extensionMaps = make(map[reflect.Type]map[int32]*ExtensionDesc) - -// RegisterExtension is called from the generated code. -func RegisterExtension(desc *ExtensionDesc) { - st := reflect.TypeOf(desc.ExtendedType).Elem() - m := extensionMaps[st] - if m == nil { - m = make(map[int32]*ExtensionDesc) - extensionMaps[st] = m - } - if _, ok := m[desc.Field]; ok { - panic("proto: duplicate extension registered: " + st.String() + " " + strconv.Itoa(int(desc.Field))) - } - m[desc.Field] = desc -} - -// RegisteredExtensions returns a map of the registered extensions of a -// protocol buffer struct, indexed by the extension number. -// The argument pb should be a nil pointer to the struct type. -func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc { - return extensionMaps[reflect.TypeOf(pb).Elem()] -} diff --git a/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go b/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go deleted file mode 100644 index 6f1ae120e..000000000 --- a/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go +++ /dev/null @@ -1,389 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/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. -// -// 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 proto - -import ( - "bytes" - "errors" - "fmt" - "io" - "reflect" - "sort" - "strings" - "sync" -) - -type extensionsBytes interface { - Message - ExtensionRangeArray() []ExtensionRange - GetExtensions() *[]byte -} - -type slowExtensionAdapter struct { - extensionsBytes -} - -func (s slowExtensionAdapter) extensionsWrite() map[int32]Extension { - panic("Please report a bug to github.com/gogo/protobuf if you see this message: Writing extensions is not supported for extensions stored in a byte slice field.") -} - -func (s slowExtensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) { - b := s.GetExtensions() - m, err := BytesToExtensionsMap(*b) - if err != nil { - panic(err) - } - return m, notLocker{} -} - -func GetBoolExtension(pb Message, extension *ExtensionDesc, ifnotset bool) bool { - if reflect.ValueOf(pb).IsNil() { - return ifnotset - } - value, err := GetExtension(pb, extension) - if err != nil { - return ifnotset - } - if value == nil { - return ifnotset - } - if value.(*bool) == nil { - return ifnotset - } - return *(value.(*bool)) -} - -func (this *Extension) Equal(that *Extension) bool { - if err := this.Encode(); err != nil { - return false - } - if err := that.Encode(); err != nil { - return false - } - return bytes.Equal(this.enc, that.enc) -} - -func (this *Extension) Compare(that *Extension) int { - if err := this.Encode(); err != nil { - return 1 - } - if err := that.Encode(); err != nil { - return -1 - } - return bytes.Compare(this.enc, that.enc) -} - -func SizeOfInternalExtension(m extendableProto) (n int) { - info := getMarshalInfo(reflect.TypeOf(m)) - return info.sizeV1Extensions(m.extensionsWrite()) -} - -type sortableMapElem struct { - field int32 - ext Extension -} - -func newSortableExtensionsFromMap(m map[int32]Extension) sortableExtensions { - s := make(sortableExtensions, 0, len(m)) - for k, v := range m { - s = append(s, &sortableMapElem{field: k, ext: v}) - } - return s -} - -type sortableExtensions []*sortableMapElem - -func (this sortableExtensions) Len() int { return len(this) } - -func (this sortableExtensions) Swap(i, j int) { this[i], this[j] = this[j], this[i] } - -func (this sortableExtensions) Less(i, j int) bool { return this[i].field < this[j].field } - -func (this sortableExtensions) String() string { - sort.Sort(this) - ss := make([]string, len(this)) - for i := range this { - ss[i] = fmt.Sprintf("%d: %v", this[i].field, this[i].ext) - } - return "map[" + strings.Join(ss, ",") + "]" -} - -func StringFromInternalExtension(m extendableProto) string { - return StringFromExtensionsMap(m.extensionsWrite()) -} - -func StringFromExtensionsMap(m map[int32]Extension) string { - return newSortableExtensionsFromMap(m).String() -} - -func StringFromExtensionsBytes(ext []byte) string { - m, err := BytesToExtensionsMap(ext) - if err != nil { - panic(err) - } - return StringFromExtensionsMap(m) -} - -func EncodeInternalExtension(m extendableProto, data []byte) (n int, err error) { - return EncodeExtensionMap(m.extensionsWrite(), data) -} - -func EncodeInternalExtensionBackwards(m extendableProto, data []byte) (n int, err error) { - return EncodeExtensionMapBackwards(m.extensionsWrite(), data) -} - -func EncodeExtensionMap(m map[int32]Extension, data []byte) (n int, err error) { - o := 0 - for _, e := range m { - if err := e.Encode(); err != nil { - return 0, err - } - n := copy(data[o:], e.enc) - if n != len(e.enc) { - return 0, io.ErrShortBuffer - } - o += n - } - return o, nil -} - -func EncodeExtensionMapBackwards(m map[int32]Extension, data []byte) (n int, err error) { - o := 0 - end := len(data) - for _, e := range m { - if err := e.Encode(); err != nil { - return 0, err - } - n := copy(data[end-len(e.enc):], e.enc) - if n != len(e.enc) { - return 0, io.ErrShortBuffer - } - end -= n - o += n - } - return o, nil -} - -func GetRawExtension(m map[int32]Extension, id int32) ([]byte, error) { - e := m[id] - if err := e.Encode(); err != nil { - return nil, err - } - return e.enc, nil -} - -func size(buf []byte, wire int) (int, error) { - switch wire { - case WireVarint: - _, n := DecodeVarint(buf) - return n, nil - case WireFixed64: - return 8, nil - case WireBytes: - v, n := DecodeVarint(buf) - return int(v) + n, nil - case WireFixed32: - return 4, nil - case WireStartGroup: - offset := 0 - for { - u, n := DecodeVarint(buf[offset:]) - fwire := int(u & 0x7) - offset += n - if fwire == WireEndGroup { - return offset, nil - } - s, err := size(buf[offset:], wire) - if err != nil { - return 0, err - } - offset += s - } - } - return 0, fmt.Errorf("proto: can't get size for unknown wire type %d", wire) -} - -func BytesToExtensionsMap(buf []byte) (map[int32]Extension, error) { - m := make(map[int32]Extension) - i := 0 - for i < len(buf) { - tag, n := DecodeVarint(buf[i:]) - if n <= 0 { - return nil, fmt.Errorf("unable to decode varint") - } - fieldNum := int32(tag >> 3) - wireType := int(tag & 0x7) - l, err := size(buf[i+n:], wireType) - if err != nil { - return nil, err - } - end := i + int(l) + n - m[int32(fieldNum)] = Extension{enc: buf[i:end]} - i = end - } - return m, nil -} - -func NewExtension(e []byte) Extension { - ee := Extension{enc: make([]byte, len(e))} - copy(ee.enc, e) - return ee -} - -func AppendExtension(e Message, tag int32, buf []byte) { - if ee, eok := e.(extensionsBytes); eok { - ext := ee.GetExtensions() - *ext = append(*ext, buf...) - return - } - if ee, eok := e.(extendableProto); eok { - m := ee.extensionsWrite() - ext := m[int32(tag)] // may be missing - ext.enc = append(ext.enc, buf...) - m[int32(tag)] = ext - } -} - -func encodeExtension(extension *ExtensionDesc, value interface{}) ([]byte, error) { - u := getMarshalInfo(reflect.TypeOf(extension.ExtendedType)) - ei := u.getExtElemInfo(extension) - v := value - p := toAddrPointer(&v, ei.isptr) - siz := ei.sizer(p, SizeVarint(ei.wiretag)) - buf := make([]byte, 0, siz) - return ei.marshaler(buf, p, ei.wiretag, false) -} - -func decodeExtensionFromBytes(extension *ExtensionDesc, buf []byte) (interface{}, error) { - o := 0 - for o < len(buf) { - tag, n := DecodeVarint((buf)[o:]) - fieldNum := int32(tag >> 3) - wireType := int(tag & 0x7) - if o+n > len(buf) { - return nil, fmt.Errorf("unable to decode extension") - } - l, err := size((buf)[o+n:], wireType) - if err != nil { - return nil, err - } - if int32(fieldNum) == extension.Field { - if o+n+l > len(buf) { - return nil, fmt.Errorf("unable to decode extension") - } - v, err := decodeExtension((buf)[o:o+n+l], extension) - if err != nil { - return nil, err - } - return v, nil - } - o += n + l - } - return defaultExtensionValue(extension) -} - -func (this *Extension) Encode() error { - if this.enc == nil { - var err error - this.enc, err = encodeExtension(this.desc, this.value) - if err != nil { - return err - } - } - return nil -} - -func (this Extension) GoString() string { - if err := this.Encode(); err != nil { - return fmt.Sprintf("error encoding extension: %v", err) - } - return fmt.Sprintf("proto.NewExtension(%#v)", this.enc) -} - -func SetUnsafeExtension(pb Message, fieldNum int32, value interface{}) error { - typ := reflect.TypeOf(pb).Elem() - ext, ok := extensionMaps[typ] - if !ok { - return fmt.Errorf("proto: bad extended type; %s is not extendable", typ.String()) - } - desc, ok := ext[fieldNum] - if !ok { - return errors.New("proto: bad extension number; not in declared ranges") - } - return SetExtension(pb, desc, value) -} - -func GetUnsafeExtension(pb Message, fieldNum int32) (interface{}, error) { - typ := reflect.TypeOf(pb).Elem() - ext, ok := extensionMaps[typ] - if !ok { - return nil, fmt.Errorf("proto: bad extended type; %s is not extendable", typ.String()) - } - desc, ok := ext[fieldNum] - if !ok { - return nil, fmt.Errorf("unregistered field number %d", fieldNum) - } - return GetExtension(pb, desc) -} - -func NewUnsafeXXX_InternalExtensions(m map[int32]Extension) XXX_InternalExtensions { - x := &XXX_InternalExtensions{ - p: new(struct { - mu sync.Mutex - extensionMap map[int32]Extension - }), - } - x.p.extensionMap = m - return *x -} - -func GetUnsafeExtensionsMap(extendable Message) map[int32]Extension { - pb := extendable.(extendableProto) - return pb.extensionsWrite() -} - -func deleteExtension(pb extensionsBytes, theFieldNum int32, offset int) int { - ext := pb.GetExtensions() - for offset < len(*ext) { - tag, n1 := DecodeVarint((*ext)[offset:]) - fieldNum := int32(tag >> 3) - wireType := int(tag & 0x7) - n2, err := size((*ext)[offset+n1:], wireType) - if err != nil { - panic(err) - } - newOffset := offset + n1 + n2 - if fieldNum == theFieldNum { - *ext = append((*ext)[:offset], (*ext)[newOffset:]...) - return offset - } - offset = newOffset - } - return -1 -} diff --git a/vendor/github.com/gogo/protobuf/proto/lib.go b/vendor/github.com/gogo/protobuf/proto/lib.go deleted file mode 100644 index 80db1c155..000000000 --- a/vendor/github.com/gogo/protobuf/proto/lib.go +++ /dev/null @@ -1,973 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 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 proto converts data structures to and from the wire format of -protocol buffers. It works in concert with the Go source code generated -for .proto files by the protocol compiler. - -A summary of the properties of the protocol buffer interface -for a protocol buffer variable v: - - - Names are turned from camel_case to CamelCase for export. - - There are no methods on v to set fields; just treat - them as structure fields. - - There are getters that return a field's value if set, - and return the field's default value if unset. - The getters work even if the receiver is a nil message. - - The zero value for a struct is its correct initialization state. - All desired fields must be set before marshaling. - - A Reset() method will restore a protobuf struct to its zero state. - - Non-repeated fields are pointers to the values; nil means unset. - That is, optional or required field int32 f becomes F *int32. - - Repeated fields are slices. - - Helper functions are available to aid the setting of fields. - msg.Foo = proto.String("hello") // set field - - Constants are defined to hold the default values of all fields that - have them. They have the form Default_StructName_FieldName. - Because the getter methods handle defaulted values, - direct use of these constants should be rare. - - Enums are given type names and maps from names to values. - Enum values are prefixed by the enclosing message's name, or by the - enum's type name if it is a top-level enum. Enum types have a String - method, and a Enum method to assist in message construction. - - Nested messages, groups and enums have type names prefixed with the name of - the surrounding message type. - - Extensions are given descriptor names that start with E_, - followed by an underscore-delimited list of the nested messages - that contain it (if any) followed by the CamelCased name of the - extension field itself. HasExtension, ClearExtension, GetExtension - and SetExtension are functions for manipulating extensions. - - Oneof field sets are given a single field in their message, - with distinguished wrapper types for each possible field value. - - Marshal and Unmarshal are functions to encode and decode the wire format. - -When the .proto file specifies `syntax="proto3"`, there are some differences: - - - Non-repeated fields of non-message type are values instead of pointers. - - Enum types do not get an Enum method. - -The simplest way to describe this is to see an example. -Given file test.proto, containing - - package example; - - enum FOO { X = 17; } - - message Test { - required string label = 1; - optional int32 type = 2 [default=77]; - repeated int64 reps = 3; - optional group OptionalGroup = 4 { - required string RequiredField = 5; - } - oneof union { - int32 number = 6; - string name = 7; - } - } - -The resulting file, test.pb.go, is: - - package example - - import proto "github.com/gogo/protobuf/proto" - import math "math" - - type FOO int32 - const ( - FOO_X FOO = 17 - ) - var FOO_name = map[int32]string{ - 17: "X", - } - var FOO_value = map[string]int32{ - "X": 17, - } - - func (x FOO) Enum() *FOO { - p := new(FOO) - *p = x - return p - } - func (x FOO) String() string { - return proto.EnumName(FOO_name, int32(x)) - } - func (x *FOO) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FOO_value, data) - if err != nil { - return err - } - *x = FOO(value) - return nil - } - - type Test struct { - Label *string `protobuf:"bytes,1,req,name=label" json:"label,omitempty"` - Type *int32 `protobuf:"varint,2,opt,name=type,def=77" json:"type,omitempty"` - Reps []int64 `protobuf:"varint,3,rep,name=reps" json:"reps,omitempty"` - Optionalgroup *Test_OptionalGroup `protobuf:"group,4,opt,name=OptionalGroup" json:"optionalgroup,omitempty"` - // Types that are valid to be assigned to Union: - // *Test_Number - // *Test_Name - Union isTest_Union `protobuf_oneof:"union"` - XXX_unrecognized []byte `json:"-"` - } - func (m *Test) Reset() { *m = Test{} } - func (m *Test) String() string { return proto.CompactTextString(m) } - func (*Test) ProtoMessage() {} - - type isTest_Union interface { - isTest_Union() - } - - type Test_Number struct { - Number int32 `protobuf:"varint,6,opt,name=number"` - } - type Test_Name struct { - Name string `protobuf:"bytes,7,opt,name=name"` - } - - func (*Test_Number) isTest_Union() {} - func (*Test_Name) isTest_Union() {} - - func (m *Test) GetUnion() isTest_Union { - if m != nil { - return m.Union - } - return nil - } - const Default_Test_Type int32 = 77 - - func (m *Test) GetLabel() string { - if m != nil && m.Label != nil { - return *m.Label - } - return "" - } - - func (m *Test) GetType() int32 { - if m != nil && m.Type != nil { - return *m.Type - } - return Default_Test_Type - } - - func (m *Test) GetOptionalgroup() *Test_OptionalGroup { - if m != nil { - return m.Optionalgroup - } - return nil - } - - type Test_OptionalGroup struct { - RequiredField *string `protobuf:"bytes,5,req" json:"RequiredField,omitempty"` - } - func (m *Test_OptionalGroup) Reset() { *m = Test_OptionalGroup{} } - func (m *Test_OptionalGroup) String() string { return proto.CompactTextString(m) } - - func (m *Test_OptionalGroup) GetRequiredField() string { - if m != nil && m.RequiredField != nil { - return *m.RequiredField - } - return "" - } - - func (m *Test) GetNumber() int32 { - if x, ok := m.GetUnion().(*Test_Number); ok { - return x.Number - } - return 0 - } - - func (m *Test) GetName() string { - if x, ok := m.GetUnion().(*Test_Name); ok { - return x.Name - } - return "" - } - - func init() { - proto.RegisterEnum("example.FOO", FOO_name, FOO_value) - } - -To create and play with a Test object: - - package main - - import ( - "log" - - "github.com/gogo/protobuf/proto" - pb "./example.pb" - ) - - func main() { - test := &pb.Test{ - Label: proto.String("hello"), - Type: proto.Int32(17), - Reps: []int64{1, 2, 3}, - Optionalgroup: &pb.Test_OptionalGroup{ - RequiredField: proto.String("good bye"), - }, - Union: &pb.Test_Name{"fred"}, - } - data, err := proto.Marshal(test) - if err != nil { - log.Fatal("marshaling error: ", err) - } - newTest := &pb.Test{} - err = proto.Unmarshal(data, newTest) - if err != nil { - log.Fatal("unmarshaling error: ", err) - } - // Now test and newTest contain the same data. - if test.GetLabel() != newTest.GetLabel() { - log.Fatalf("data mismatch %q != %q", test.GetLabel(), newTest.GetLabel()) - } - // Use a type switch to determine which oneof was set. - switch u := test.Union.(type) { - case *pb.Test_Number: // u.Number contains the number. - case *pb.Test_Name: // u.Name contains the string. - } - // etc. - } -*/ -package proto - -import ( - "encoding/json" - "fmt" - "log" - "reflect" - "sort" - "strconv" - "sync" -) - -// RequiredNotSetError is an error type returned by either Marshal or Unmarshal. -// Marshal reports this when a required field is not initialized. -// Unmarshal reports this when a required field is missing from the wire data. -type RequiredNotSetError struct{ field string } - -func (e *RequiredNotSetError) Error() string { - if e.field == "" { - return fmt.Sprintf("proto: required field not set") - } - return fmt.Sprintf("proto: required field %q not set", e.field) -} -func (e *RequiredNotSetError) RequiredNotSet() bool { - return true -} - -type invalidUTF8Error struct{ field string } - -func (e *invalidUTF8Error) Error() string { - if e.field == "" { - return "proto: invalid UTF-8 detected" - } - return fmt.Sprintf("proto: field %q contains invalid UTF-8", e.field) -} -func (e *invalidUTF8Error) InvalidUTF8() bool { - return true -} - -// errInvalidUTF8 is a sentinel error to identify fields with invalid UTF-8. -// This error should not be exposed to the external API as such errors should -// be recreated with the field information. -var errInvalidUTF8 = &invalidUTF8Error{} - -// isNonFatal reports whether the error is either a RequiredNotSet error -// or a InvalidUTF8 error. -func isNonFatal(err error) bool { - if re, ok := err.(interface{ RequiredNotSet() bool }); ok && re.RequiredNotSet() { - return true - } - if re, ok := err.(interface{ InvalidUTF8() bool }); ok && re.InvalidUTF8() { - return true - } - return false -} - -type nonFatal struct{ E error } - -// Merge merges err into nf and reports whether it was successful. -// Otherwise it returns false for any fatal non-nil errors. -func (nf *nonFatal) Merge(err error) (ok bool) { - if err == nil { - return true // not an error - } - if !isNonFatal(err) { - return false // fatal error - } - if nf.E == nil { - nf.E = err // store first instance of non-fatal error - } - return true -} - -// Message is implemented by generated protocol buffer messages. -type Message interface { - Reset() - String() string - ProtoMessage() -} - -// A Buffer is a buffer manager for marshaling and unmarshaling -// protocol buffers. It may be reused between invocations to -// reduce memory usage. It is not necessary to use a Buffer; -// the global functions Marshal and Unmarshal create a -// temporary Buffer and are fine for most applications. -type Buffer struct { - buf []byte // encode/decode byte stream - index int // read point - - deterministic bool -} - -// NewBuffer allocates a new Buffer and initializes its internal data to -// the contents of the argument slice. -func NewBuffer(e []byte) *Buffer { - return &Buffer{buf: e} -} - -// Reset resets the Buffer, ready for marshaling a new protocol buffer. -func (p *Buffer) Reset() { - p.buf = p.buf[0:0] // for reading/writing - p.index = 0 // for reading -} - -// SetBuf replaces the internal buffer with the slice, -// ready for unmarshaling the contents of the slice. -func (p *Buffer) SetBuf(s []byte) { - p.buf = s - p.index = 0 -} - -// Bytes returns the contents of the Buffer. -func (p *Buffer) Bytes() []byte { return p.buf } - -// SetDeterministic sets whether to use deterministic serialization. -// -// Deterministic serialization guarantees that for a given binary, equal -// messages will always be serialized to the same bytes. This implies: -// -// - Repeated serialization of a message will return the same bytes. -// - Different processes of the same binary (which may be executing on -// different machines) will serialize equal messages to the same bytes. -// -// Note that the deterministic serialization is NOT canonical across -// languages. It is not guaranteed to remain stable over time. It is unstable -// across different builds with schema changes due to unknown fields. -// Users who need canonical serialization (e.g., persistent storage in a -// canonical form, fingerprinting, etc.) should define their own -// canonicalization specification and implement their own serializer rather -// than relying on this API. -// -// If deterministic serialization is requested, map entries will be sorted -// by keys in lexographical order. This is an implementation detail and -// subject to change. -func (p *Buffer) SetDeterministic(deterministic bool) { - p.deterministic = deterministic -} - -/* - * Helper routines for simplifying the creation of optional fields of basic type. - */ - -// Bool is a helper routine that allocates a new bool value -// to store v and returns a pointer to it. -func Bool(v bool) *bool { - return &v -} - -// Int32 is a helper routine that allocates a new int32 value -// to store v and returns a pointer to it. -func Int32(v int32) *int32 { - return &v -} - -// Int is a helper routine that allocates a new int32 value -// to store v and returns a pointer to it, but unlike Int32 -// its argument value is an int. -func Int(v int) *int32 { - p := new(int32) - *p = int32(v) - return p -} - -// Int64 is a helper routine that allocates a new int64 value -// to store v and returns a pointer to it. -func Int64(v int64) *int64 { - return &v -} - -// Float32 is a helper routine that allocates a new float32 value -// to store v and returns a pointer to it. -func Float32(v float32) *float32 { - return &v -} - -// Float64 is a helper routine that allocates a new float64 value -// to store v and returns a pointer to it. -func Float64(v float64) *float64 { - return &v -} - -// Uint32 is a helper routine that allocates a new uint32 value -// to store v and returns a pointer to it. -func Uint32(v uint32) *uint32 { - return &v -} - -// Uint64 is a helper routine that allocates a new uint64 value -// to store v and returns a pointer to it. -func Uint64(v uint64) *uint64 { - return &v -} - -// String is a helper routine that allocates a new string value -// to store v and returns a pointer to it. -func String(v string) *string { - return &v -} - -// EnumName is a helper function to simplify printing protocol buffer enums -// by name. Given an enum map and a value, it returns a useful string. -func EnumName(m map[int32]string, v int32) string { - s, ok := m[v] - if ok { - return s - } - return strconv.Itoa(int(v)) -} - -// UnmarshalJSONEnum is a helper function to simplify recovering enum int values -// from their JSON-encoded representation. Given a map from the enum's symbolic -// names to its int values, and a byte buffer containing the JSON-encoded -// value, it returns an int32 that can be cast to the enum type by the caller. -// -// The function can deal with both JSON representations, numeric and symbolic. -func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) { - if data[0] == '"' { - // New style: enums are strings. - var repr string - if err := json.Unmarshal(data, &repr); err != nil { - return -1, err - } - val, ok := m[repr] - if !ok { - return 0, fmt.Errorf("unrecognized enum %s value %q", enumName, repr) - } - return val, nil - } - // Old style: enums are ints. - var val int32 - if err := json.Unmarshal(data, &val); err != nil { - return 0, fmt.Errorf("cannot unmarshal %#q into enum %s", data, enumName) - } - return val, nil -} - -// DebugPrint dumps the encoded data in b in a debugging format with a header -// including the string s. Used in testing but made available for general debugging. -func (p *Buffer) DebugPrint(s string, b []byte) { - var u uint64 - - obuf := p.buf - sindex := p.index - p.buf = b - p.index = 0 - depth := 0 - - fmt.Printf("\n--- %s ---\n", s) - -out: - for { - for i := 0; i < depth; i++ { - fmt.Print(" ") - } - - index := p.index - if index == len(p.buf) { - break - } - - op, err := p.DecodeVarint() - if err != nil { - fmt.Printf("%3d: fetching op err %v\n", index, err) - break out - } - tag := op >> 3 - wire := op & 7 - - switch wire { - default: - fmt.Printf("%3d: t=%3d unknown wire=%d\n", - index, tag, wire) - break out - - case WireBytes: - var r []byte - - r, err = p.DecodeRawBytes(false) - if err != nil { - break out - } - fmt.Printf("%3d: t=%3d bytes [%d]", index, tag, len(r)) - if len(r) <= 6 { - for i := 0; i < len(r); i++ { - fmt.Printf(" %.2x", r[i]) - } - } else { - for i := 0; i < 3; i++ { - fmt.Printf(" %.2x", r[i]) - } - fmt.Printf(" ..") - for i := len(r) - 3; i < len(r); i++ { - fmt.Printf(" %.2x", r[i]) - } - } - fmt.Printf("\n") - - case WireFixed32: - u, err = p.DecodeFixed32() - if err != nil { - fmt.Printf("%3d: t=%3d fix32 err %v\n", index, tag, err) - break out - } - fmt.Printf("%3d: t=%3d fix32 %d\n", index, tag, u) - - case WireFixed64: - u, err = p.DecodeFixed64() - if err != nil { - fmt.Printf("%3d: t=%3d fix64 err %v\n", index, tag, err) - break out - } - fmt.Printf("%3d: t=%3d fix64 %d\n", index, tag, u) - - case WireVarint: - u, err = p.DecodeVarint() - if err != nil { - fmt.Printf("%3d: t=%3d varint err %v\n", index, tag, err) - break out - } - fmt.Printf("%3d: t=%3d varint %d\n", index, tag, u) - - case WireStartGroup: - fmt.Printf("%3d: t=%3d start\n", index, tag) - depth++ - - case WireEndGroup: - depth-- - fmt.Printf("%3d: t=%3d end\n", index, tag) - } - } - - if depth != 0 { - fmt.Printf("%3d: start-end not balanced %d\n", p.index, depth) - } - fmt.Printf("\n") - - p.buf = obuf - p.index = sindex -} - -// SetDefaults sets unset protocol buffer fields to their default values. -// It only modifies fields that are both unset and have defined defaults. -// It recursively sets default values in any non-nil sub-messages. -func SetDefaults(pb Message) { - setDefaults(reflect.ValueOf(pb), true, false) -} - -// v is a struct. -func setDefaults(v reflect.Value, recur, zeros bool) { - if v.Kind() == reflect.Ptr { - v = v.Elem() - } - - defaultMu.RLock() - dm, ok := defaults[v.Type()] - defaultMu.RUnlock() - if !ok { - dm = buildDefaultMessage(v.Type()) - defaultMu.Lock() - defaults[v.Type()] = dm - defaultMu.Unlock() - } - - for _, sf := range dm.scalars { - f := v.Field(sf.index) - if !f.IsNil() { - // field already set - continue - } - dv := sf.value - if dv == nil && !zeros { - // no explicit default, and don't want to set zeros - continue - } - fptr := f.Addr().Interface() // **T - // TODO: Consider batching the allocations we do here. - switch sf.kind { - case reflect.Bool: - b := new(bool) - if dv != nil { - *b = dv.(bool) - } - *(fptr.(**bool)) = b - case reflect.Float32: - f := new(float32) - if dv != nil { - *f = dv.(float32) - } - *(fptr.(**float32)) = f - case reflect.Float64: - f := new(float64) - if dv != nil { - *f = dv.(float64) - } - *(fptr.(**float64)) = f - case reflect.Int32: - // might be an enum - if ft := f.Type(); ft != int32PtrType { - // enum - f.Set(reflect.New(ft.Elem())) - if dv != nil { - f.Elem().SetInt(int64(dv.(int32))) - } - } else { - // int32 field - i := new(int32) - if dv != nil { - *i = dv.(int32) - } - *(fptr.(**int32)) = i - } - case reflect.Int64: - i := new(int64) - if dv != nil { - *i = dv.(int64) - } - *(fptr.(**int64)) = i - case reflect.String: - s := new(string) - if dv != nil { - *s = dv.(string) - } - *(fptr.(**string)) = s - case reflect.Uint8: - // exceptional case: []byte - var b []byte - if dv != nil { - db := dv.([]byte) - b = make([]byte, len(db)) - copy(b, db) - } else { - b = []byte{} - } - *(fptr.(*[]byte)) = b - case reflect.Uint32: - u := new(uint32) - if dv != nil { - *u = dv.(uint32) - } - *(fptr.(**uint32)) = u - case reflect.Uint64: - u := new(uint64) - if dv != nil { - *u = dv.(uint64) - } - *(fptr.(**uint64)) = u - default: - log.Printf("proto: can't set default for field %v (sf.kind=%v)", f, sf.kind) - } - } - - for _, ni := range dm.nested { - f := v.Field(ni) - // f is *T or T or []*T or []T - switch f.Kind() { - case reflect.Struct: - setDefaults(f, recur, zeros) - - case reflect.Ptr: - if f.IsNil() { - continue - } - setDefaults(f, recur, zeros) - - case reflect.Slice: - for i := 0; i < f.Len(); i++ { - e := f.Index(i) - if e.Kind() == reflect.Ptr && e.IsNil() { - continue - } - setDefaults(e, recur, zeros) - } - - case reflect.Map: - for _, k := range f.MapKeys() { - e := f.MapIndex(k) - if e.IsNil() { - continue - } - setDefaults(e, recur, zeros) - } - } - } -} - -var ( - // defaults maps a protocol buffer struct type to a slice of the fields, - // with its scalar fields set to their proto-declared non-zero default values. - defaultMu sync.RWMutex - defaults = make(map[reflect.Type]defaultMessage) - - int32PtrType = reflect.TypeOf((*int32)(nil)) -) - -// defaultMessage represents information about the default values of a message. -type defaultMessage struct { - scalars []scalarField - nested []int // struct field index of nested messages -} - -type scalarField struct { - index int // struct field index - kind reflect.Kind // element type (the T in *T or []T) - value interface{} // the proto-declared default value, or nil -} - -// t is a struct type. -func buildDefaultMessage(t reflect.Type) (dm defaultMessage) { - sprop := GetProperties(t) - for _, prop := range sprop.Prop { - fi, ok := sprop.decoderTags.get(prop.Tag) - if !ok { - // XXX_unrecognized - continue - } - ft := t.Field(fi).Type - - sf, nested, err := fieldDefault(ft, prop) - switch { - case err != nil: - log.Print(err) - case nested: - dm.nested = append(dm.nested, fi) - case sf != nil: - sf.index = fi - dm.scalars = append(dm.scalars, *sf) - } - } - - return dm -} - -// fieldDefault returns the scalarField for field type ft. -// sf will be nil if the field can not have a default. -// nestedMessage will be true if this is a nested message. -// Note that sf.index is not set on return. -func fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, nestedMessage bool, err error) { - var canHaveDefault bool - switch ft.Kind() { - case reflect.Struct: - nestedMessage = true // non-nullable - - case reflect.Ptr: - if ft.Elem().Kind() == reflect.Struct { - nestedMessage = true - } else { - canHaveDefault = true // proto2 scalar field - } - - case reflect.Slice: - switch ft.Elem().Kind() { - case reflect.Ptr, reflect.Struct: - nestedMessage = true // repeated message - case reflect.Uint8: - canHaveDefault = true // bytes field - } - - case reflect.Map: - if ft.Elem().Kind() == reflect.Ptr { - nestedMessage = true // map with message values - } - } - - if !canHaveDefault { - if nestedMessage { - return nil, true, nil - } - return nil, false, nil - } - - // We now know that ft is a pointer or slice. - sf = &scalarField{kind: ft.Elem().Kind()} - - // scalar fields without defaults - if !prop.HasDefault { - return sf, false, nil - } - - // a scalar field: either *T or []byte - switch ft.Elem().Kind() { - case reflect.Bool: - x, err := strconv.ParseBool(prop.Default) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default bool %q: %v", prop.Default, err) - } - sf.value = x - case reflect.Float32: - x, err := strconv.ParseFloat(prop.Default, 32) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default float32 %q: %v", prop.Default, err) - } - sf.value = float32(x) - case reflect.Float64: - x, err := strconv.ParseFloat(prop.Default, 64) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default float64 %q: %v", prop.Default, err) - } - sf.value = x - case reflect.Int32: - x, err := strconv.ParseInt(prop.Default, 10, 32) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default int32 %q: %v", prop.Default, err) - } - sf.value = int32(x) - case reflect.Int64: - x, err := strconv.ParseInt(prop.Default, 10, 64) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default int64 %q: %v", prop.Default, err) - } - sf.value = x - case reflect.String: - sf.value = prop.Default - case reflect.Uint8: - // []byte (not *uint8) - sf.value = []byte(prop.Default) - case reflect.Uint32: - x, err := strconv.ParseUint(prop.Default, 10, 32) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default uint32 %q: %v", prop.Default, err) - } - sf.value = uint32(x) - case reflect.Uint64: - x, err := strconv.ParseUint(prop.Default, 10, 64) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default uint64 %q: %v", prop.Default, err) - } - sf.value = x - default: - return nil, false, fmt.Errorf("proto: unhandled def kind %v", ft.Elem().Kind()) - } - - return sf, false, nil -} - -// mapKeys returns a sort.Interface to be used for sorting the map keys. -// Map fields may have key types of non-float scalars, strings and enums. -func mapKeys(vs []reflect.Value) sort.Interface { - s := mapKeySorter{vs: vs} - - // Type specialization per https://developers.google.com/protocol-buffers/docs/proto#maps. - if len(vs) == 0 { - return s - } - switch vs[0].Kind() { - case reflect.Int32, reflect.Int64: - s.less = func(a, b reflect.Value) bool { return a.Int() < b.Int() } - case reflect.Uint32, reflect.Uint64: - s.less = func(a, b reflect.Value) bool { return a.Uint() < b.Uint() } - case reflect.Bool: - s.less = func(a, b reflect.Value) bool { return !a.Bool() && b.Bool() } // false < true - case reflect.String: - s.less = func(a, b reflect.Value) bool { return a.String() < b.String() } - default: - panic(fmt.Sprintf("unsupported map key type: %v", vs[0].Kind())) - } - - return s -} - -type mapKeySorter struct { - vs []reflect.Value - less func(a, b reflect.Value) bool -} - -func (s mapKeySorter) Len() int { return len(s.vs) } -func (s mapKeySorter) Swap(i, j int) { s.vs[i], s.vs[j] = s.vs[j], s.vs[i] } -func (s mapKeySorter) Less(i, j int) bool { - return s.less(s.vs[i], s.vs[j]) -} - -// isProto3Zero reports whether v is a zero proto3 value. -func isProto3Zero(v reflect.Value) bool { - switch v.Kind() { - case reflect.Bool: - return !v.Bool() - case reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint32, reflect.Uint64: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.String: - return v.String() == "" - } - return false -} - -const ( - // ProtoPackageIsVersion3 is referenced from generated protocol buffer files - // to assert that that code is compatible with this version of the proto package. - GoGoProtoPackageIsVersion3 = true - - // ProtoPackageIsVersion2 is referenced from generated protocol buffer files - // to assert that that code is compatible with this version of the proto package. - GoGoProtoPackageIsVersion2 = true - - // ProtoPackageIsVersion1 is referenced from generated protocol buffer files - // to assert that that code is compatible with this version of the proto package. - GoGoProtoPackageIsVersion1 = true -) - -// InternalMessageInfo is a type used internally by generated .pb.go files. -// This type is not intended to be used by non-generated code. -// This type is not subject to any compatibility guarantee. -type InternalMessageInfo struct { - marshal *marshalInfo - unmarshal *unmarshalInfo - merge *mergeInfo - discard *discardInfo -} diff --git a/vendor/github.com/gogo/protobuf/proto/lib_gogo.go b/vendor/github.com/gogo/protobuf/proto/lib_gogo.go deleted file mode 100644 index b3aa39190..000000000 --- a/vendor/github.com/gogo/protobuf/proto/lib_gogo.go +++ /dev/null @@ -1,50 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/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. -// -// 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 proto - -import ( - "encoding/json" - "strconv" -) - -type Sizer interface { - Size() int -} - -type ProtoSizer interface { - ProtoSize() int -} - -func MarshalJSONEnum(m map[int32]string, value int32) ([]byte, error) { - s, ok := m[value] - if !ok { - s = strconv.Itoa(int(value)) - } - return json.Marshal(s) -} diff --git a/vendor/github.com/gogo/protobuf/proto/message_set.go b/vendor/github.com/gogo/protobuf/proto/message_set.go deleted file mode 100644 index f48a75676..000000000 --- a/vendor/github.com/gogo/protobuf/proto/message_set.go +++ /dev/null @@ -1,181 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 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 proto - -/* - * Support for message sets. - */ - -import ( - "errors" -) - -// errNoMessageTypeID occurs when a protocol buffer does not have a message type ID. -// A message type ID is required for storing a protocol buffer in a message set. -var errNoMessageTypeID = errors.New("proto does not have a message type ID") - -// The first two types (_MessageSet_Item and messageSet) -// model what the protocol compiler produces for the following protocol message: -// message MessageSet { -// repeated group Item = 1 { -// required int32 type_id = 2; -// required string message = 3; -// }; -// } -// That is the MessageSet wire format. We can't use a proto to generate these -// because that would introduce a circular dependency between it and this package. - -type _MessageSet_Item struct { - TypeId *int32 `protobuf:"varint,2,req,name=type_id"` - Message []byte `protobuf:"bytes,3,req,name=message"` -} - -type messageSet struct { - Item []*_MessageSet_Item `protobuf:"group,1,rep"` - XXX_unrecognized []byte - // TODO: caching? -} - -// Make sure messageSet is a Message. -var _ Message = (*messageSet)(nil) - -// messageTypeIder is an interface satisfied by a protocol buffer type -// that may be stored in a MessageSet. -type messageTypeIder interface { - MessageTypeId() int32 -} - -func (ms *messageSet) find(pb Message) *_MessageSet_Item { - mti, ok := pb.(messageTypeIder) - if !ok { - return nil - } - id := mti.MessageTypeId() - for _, item := range ms.Item { - if *item.TypeId == id { - return item - } - } - return nil -} - -func (ms *messageSet) Has(pb Message) bool { - return ms.find(pb) != nil -} - -func (ms *messageSet) Unmarshal(pb Message) error { - if item := ms.find(pb); item != nil { - return Unmarshal(item.Message, pb) - } - if _, ok := pb.(messageTypeIder); !ok { - return errNoMessageTypeID - } - return nil // TODO: return error instead? -} - -func (ms *messageSet) Marshal(pb Message) error { - msg, err := Marshal(pb) - if err != nil { - return err - } - if item := ms.find(pb); item != nil { - // reuse existing item - item.Message = msg - return nil - } - - mti, ok := pb.(messageTypeIder) - if !ok { - return errNoMessageTypeID - } - - mtid := mti.MessageTypeId() - ms.Item = append(ms.Item, &_MessageSet_Item{ - TypeId: &mtid, - Message: msg, - }) - return nil -} - -func (ms *messageSet) Reset() { *ms = messageSet{} } -func (ms *messageSet) String() string { return CompactTextString(ms) } -func (*messageSet) ProtoMessage() {} - -// Support for the message_set_wire_format message option. - -func skipVarint(buf []byte) []byte { - i := 0 - for ; buf[i]&0x80 != 0; i++ { - } - return buf[i+1:] -} - -// unmarshalMessageSet decodes the extension map encoded in buf in the message set wire format. -// It is called by Unmarshal methods on protocol buffer messages with the message_set_wire_format option. -func unmarshalMessageSet(buf []byte, exts interface{}) error { - var m map[int32]Extension - switch exts := exts.(type) { - case *XXX_InternalExtensions: - m = exts.extensionsWrite() - case map[int32]Extension: - m = exts - default: - return errors.New("proto: not an extension map") - } - - ms := new(messageSet) - if err := Unmarshal(buf, ms); err != nil { - return err - } - for _, item := range ms.Item { - id := *item.TypeId - msg := item.Message - - // Restore wire type and field number varint, plus length varint. - // Be careful to preserve duplicate items. - b := EncodeVarint(uint64(id)<<3 | WireBytes) - if ext, ok := m[id]; ok { - // Existing data; rip off the tag and length varint - // so we join the new data correctly. - // We can assume that ext.enc is set because we are unmarshaling. - o := ext.enc[len(b):] // skip wire type and field number - _, n := DecodeVarint(o) // calculate length of length varint - o = o[n:] // skip length varint - msg = append(o, msg...) // join old data and new data - } - b = append(b, EncodeVarint(uint64(len(msg)))...) - b = append(b, msg...) - - m[id] = Extension{enc: b} - } - return nil -} diff --git a/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go b/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go deleted file mode 100644 index b6cad9083..000000000 --- a/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go +++ /dev/null @@ -1,357 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2012 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. - -// +build purego appengine js - -// This file contains an implementation of proto field accesses using package reflect. -// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can -// be used on App Engine. - -package proto - -import ( - "reflect" - "sync" -) - -const unsafeAllowed = false - -// A field identifies a field in a struct, accessible from a pointer. -// In this implementation, a field is identified by the sequence of field indices -// passed to reflect's FieldByIndex. -type field []int - -// toField returns a field equivalent to the given reflect field. -func toField(f *reflect.StructField) field { - return f.Index -} - -// invalidField is an invalid field identifier. -var invalidField = field(nil) - -// zeroField is a noop when calling pointer.offset. -var zeroField = field([]int{}) - -// IsValid reports whether the field identifier is valid. -func (f field) IsValid() bool { return f != nil } - -// The pointer type is for the table-driven decoder. -// The implementation here uses a reflect.Value of pointer type to -// create a generic pointer. In pointer_unsafe.go we use unsafe -// instead of reflect to implement the same (but faster) interface. -type pointer struct { - v reflect.Value -} - -// toPointer converts an interface of pointer type to a pointer -// that points to the same target. -func toPointer(i *Message) pointer { - return pointer{v: reflect.ValueOf(*i)} -} - -// toAddrPointer converts an interface to a pointer that points to -// the interface data. -func toAddrPointer(i *interface{}, isptr bool) pointer { - v := reflect.ValueOf(*i) - u := reflect.New(v.Type()) - u.Elem().Set(v) - return pointer{v: u} -} - -// valToPointer converts v to a pointer. v must be of pointer type. -func valToPointer(v reflect.Value) pointer { - return pointer{v: v} -} - -// offset converts from a pointer to a structure to a pointer to -// one of its fields. -func (p pointer) offset(f field) pointer { - return pointer{v: p.v.Elem().FieldByIndex(f).Addr()} -} - -func (p pointer) isNil() bool { - return p.v.IsNil() -} - -// grow updates the slice s in place to make it one element longer. -// s must be addressable. -// Returns the (addressable) new element. -func grow(s reflect.Value) reflect.Value { - n, m := s.Len(), s.Cap() - if n < m { - s.SetLen(n + 1) - } else { - s.Set(reflect.Append(s, reflect.Zero(s.Type().Elem()))) - } - return s.Index(n) -} - -func (p pointer) toInt64() *int64 { - return p.v.Interface().(*int64) -} -func (p pointer) toInt64Ptr() **int64 { - return p.v.Interface().(**int64) -} -func (p pointer) toInt64Slice() *[]int64 { - return p.v.Interface().(*[]int64) -} - -var int32ptr = reflect.TypeOf((*int32)(nil)) - -func (p pointer) toInt32() *int32 { - return p.v.Convert(int32ptr).Interface().(*int32) -} - -// The toInt32Ptr/Slice methods don't work because of enums. -// Instead, we must use set/get methods for the int32ptr/slice case. -/* - func (p pointer) toInt32Ptr() **int32 { - return p.v.Interface().(**int32) -} - func (p pointer) toInt32Slice() *[]int32 { - return p.v.Interface().(*[]int32) -} -*/ -func (p pointer) getInt32Ptr() *int32 { - if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { - // raw int32 type - return p.v.Elem().Interface().(*int32) - } - // an enum - return p.v.Elem().Convert(int32PtrType).Interface().(*int32) -} -func (p pointer) setInt32Ptr(v int32) { - // Allocate value in a *int32. Possibly convert that to a *enum. - // Then assign it to a **int32 or **enum. - // Note: we can convert *int32 to *enum, but we can't convert - // **int32 to **enum! - p.v.Elem().Set(reflect.ValueOf(&v).Convert(p.v.Type().Elem())) -} - -// getInt32Slice copies []int32 from p as a new slice. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) getInt32Slice() []int32 { - if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { - // raw int32 type - return p.v.Elem().Interface().([]int32) - } - // an enum - // Allocate a []int32, then assign []enum's values into it. - // Note: we can't convert []enum to []int32. - slice := p.v.Elem() - s := make([]int32, slice.Len()) - for i := 0; i < slice.Len(); i++ { - s[i] = int32(slice.Index(i).Int()) - } - return s -} - -// setInt32Slice copies []int32 into p as a new slice. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) setInt32Slice(v []int32) { - if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { - // raw int32 type - p.v.Elem().Set(reflect.ValueOf(v)) - return - } - // an enum - // Allocate a []enum, then assign []int32's values into it. - // Note: we can't convert []enum to []int32. - slice := reflect.MakeSlice(p.v.Type().Elem(), len(v), cap(v)) - for i, x := range v { - slice.Index(i).SetInt(int64(x)) - } - p.v.Elem().Set(slice) -} -func (p pointer) appendInt32Slice(v int32) { - grow(p.v.Elem()).SetInt(int64(v)) -} - -func (p pointer) toUint64() *uint64 { - return p.v.Interface().(*uint64) -} -func (p pointer) toUint64Ptr() **uint64 { - return p.v.Interface().(**uint64) -} -func (p pointer) toUint64Slice() *[]uint64 { - return p.v.Interface().(*[]uint64) -} -func (p pointer) toUint32() *uint32 { - return p.v.Interface().(*uint32) -} -func (p pointer) toUint32Ptr() **uint32 { - return p.v.Interface().(**uint32) -} -func (p pointer) toUint32Slice() *[]uint32 { - return p.v.Interface().(*[]uint32) -} -func (p pointer) toBool() *bool { - return p.v.Interface().(*bool) -} -func (p pointer) toBoolPtr() **bool { - return p.v.Interface().(**bool) -} -func (p pointer) toBoolSlice() *[]bool { - return p.v.Interface().(*[]bool) -} -func (p pointer) toFloat64() *float64 { - return p.v.Interface().(*float64) -} -func (p pointer) toFloat64Ptr() **float64 { - return p.v.Interface().(**float64) -} -func (p pointer) toFloat64Slice() *[]float64 { - return p.v.Interface().(*[]float64) -} -func (p pointer) toFloat32() *float32 { - return p.v.Interface().(*float32) -} -func (p pointer) toFloat32Ptr() **float32 { - return p.v.Interface().(**float32) -} -func (p pointer) toFloat32Slice() *[]float32 { - return p.v.Interface().(*[]float32) -} -func (p pointer) toString() *string { - return p.v.Interface().(*string) -} -func (p pointer) toStringPtr() **string { - return p.v.Interface().(**string) -} -func (p pointer) toStringSlice() *[]string { - return p.v.Interface().(*[]string) -} -func (p pointer) toBytes() *[]byte { - return p.v.Interface().(*[]byte) -} -func (p pointer) toBytesSlice() *[][]byte { - return p.v.Interface().(*[][]byte) -} -func (p pointer) toExtensions() *XXX_InternalExtensions { - return p.v.Interface().(*XXX_InternalExtensions) -} -func (p pointer) toOldExtensions() *map[int32]Extension { - return p.v.Interface().(*map[int32]Extension) -} -func (p pointer) getPointer() pointer { - return pointer{v: p.v.Elem()} -} -func (p pointer) setPointer(q pointer) { - p.v.Elem().Set(q.v) -} -func (p pointer) appendPointer(q pointer) { - grow(p.v.Elem()).Set(q.v) -} - -// getPointerSlice copies []*T from p as a new []pointer. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) getPointerSlice() []pointer { - if p.v.IsNil() { - return nil - } - n := p.v.Elem().Len() - s := make([]pointer, n) - for i := 0; i < n; i++ { - s[i] = pointer{v: p.v.Elem().Index(i)} - } - return s -} - -// setPointerSlice copies []pointer into p as a new []*T. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) setPointerSlice(v []pointer) { - if v == nil { - p.v.Elem().Set(reflect.New(p.v.Elem().Type()).Elem()) - return - } - s := reflect.MakeSlice(p.v.Elem().Type(), 0, len(v)) - for _, p := range v { - s = reflect.Append(s, p.v) - } - p.v.Elem().Set(s) -} - -// getInterfacePointer returns a pointer that points to the -// interface data of the interface pointed by p. -func (p pointer) getInterfacePointer() pointer { - if p.v.Elem().IsNil() { - return pointer{v: p.v.Elem()} - } - return pointer{v: p.v.Elem().Elem().Elem().Field(0).Addr()} // *interface -> interface -> *struct -> struct -} - -func (p pointer) asPointerTo(t reflect.Type) reflect.Value { - // TODO: check that p.v.Type().Elem() == t? - return p.v -} - -func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo { - atomicLock.Lock() - defer atomicLock.Unlock() - return *p -} -func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) { - atomicLock.Lock() - defer atomicLock.Unlock() - *p = v -} -func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo { - atomicLock.Lock() - defer atomicLock.Unlock() - return *p -} -func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) { - atomicLock.Lock() - defer atomicLock.Unlock() - *p = v -} -func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo { - atomicLock.Lock() - defer atomicLock.Unlock() - return *p -} -func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) { - atomicLock.Lock() - defer atomicLock.Unlock() - *p = v -} -func atomicLoadDiscardInfo(p **discardInfo) *discardInfo { - atomicLock.Lock() - defer atomicLock.Unlock() - return *p -} -func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) { - atomicLock.Lock() - defer atomicLock.Unlock() - *p = v -} - -var atomicLock sync.Mutex diff --git a/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go b/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go deleted file mode 100644 index 7ffd3c29d..000000000 --- a/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go +++ /dev/null @@ -1,59 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/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. -// -// 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. - -// +build purego appengine js - -// This file contains an implementation of proto field accesses using package reflect. -// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can -// be used on App Engine. - -package proto - -import ( - "reflect" -) - -// TODO: untested, so probably incorrect. - -func (p pointer) getRef() pointer { - return pointer{v: p.v.Addr()} -} - -func (p pointer) appendRef(v pointer, typ reflect.Type) { - slice := p.getSlice(typ) - elem := v.asPointerTo(typ).Elem() - newSlice := reflect.Append(slice, elem) - slice.Set(newSlice) -} - -func (p pointer) getSlice(typ reflect.Type) reflect.Value { - sliceTyp := reflect.SliceOf(typ) - slice := p.asPointerTo(sliceTyp) - slice = slice.Elem() - return slice -} diff --git a/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go b/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go deleted file mode 100644 index d55a335d9..000000000 --- a/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go +++ /dev/null @@ -1,308 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2012 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. - -// +build !purego,!appengine,!js - -// This file contains the implementation of the proto field accesses using package unsafe. - -package proto - -import ( - "reflect" - "sync/atomic" - "unsafe" -) - -const unsafeAllowed = true - -// A field identifies a field in a struct, accessible from a pointer. -// In this implementation, a field is identified by its byte offset from the start of the struct. -type field uintptr - -// toField returns a field equivalent to the given reflect field. -func toField(f *reflect.StructField) field { - return field(f.Offset) -} - -// invalidField is an invalid field identifier. -const invalidField = ^field(0) - -// zeroField is a noop when calling pointer.offset. -const zeroField = field(0) - -// IsValid reports whether the field identifier is valid. -func (f field) IsValid() bool { - return f != invalidField -} - -// The pointer type below is for the new table-driven encoder/decoder. -// The implementation here uses unsafe.Pointer to create a generic pointer. -// In pointer_reflect.go we use reflect instead of unsafe to implement -// the same (but slower) interface. -type pointer struct { - p unsafe.Pointer -} - -// size of pointer -var ptrSize = unsafe.Sizeof(uintptr(0)) - -// toPointer converts an interface of pointer type to a pointer -// that points to the same target. -func toPointer(i *Message) pointer { - // Super-tricky - read pointer out of data word of interface value. - // Saves ~25ns over the equivalent: - // return valToPointer(reflect.ValueOf(*i)) - return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} -} - -// toAddrPointer converts an interface to a pointer that points to -// the interface data. -func toAddrPointer(i *interface{}, isptr bool) pointer { - // Super-tricky - read or get the address of data word of interface value. - if isptr { - // The interface is of pointer type, thus it is a direct interface. - // The data word is the pointer data itself. We take its address. - return pointer{p: unsafe.Pointer(uintptr(unsafe.Pointer(i)) + ptrSize)} - } - // The interface is not of pointer type. The data word is the pointer - // to the data. - return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} -} - -// valToPointer converts v to a pointer. v must be of pointer type. -func valToPointer(v reflect.Value) pointer { - return pointer{p: unsafe.Pointer(v.Pointer())} -} - -// offset converts from a pointer to a structure to a pointer to -// one of its fields. -func (p pointer) offset(f field) pointer { - // For safety, we should panic if !f.IsValid, however calling panic causes - // this to no longer be inlineable, which is a serious performance cost. - /* - if !f.IsValid() { - panic("invalid field") - } - */ - return pointer{p: unsafe.Pointer(uintptr(p.p) + uintptr(f))} -} - -func (p pointer) isNil() bool { - return p.p == nil -} - -func (p pointer) toInt64() *int64 { - return (*int64)(p.p) -} -func (p pointer) toInt64Ptr() **int64 { - return (**int64)(p.p) -} -func (p pointer) toInt64Slice() *[]int64 { - return (*[]int64)(p.p) -} -func (p pointer) toInt32() *int32 { - return (*int32)(p.p) -} - -// See pointer_reflect.go for why toInt32Ptr/Slice doesn't exist. -/* - func (p pointer) toInt32Ptr() **int32 { - return (**int32)(p.p) - } - func (p pointer) toInt32Slice() *[]int32 { - return (*[]int32)(p.p) - } -*/ -func (p pointer) getInt32Ptr() *int32 { - return *(**int32)(p.p) -} -func (p pointer) setInt32Ptr(v int32) { - *(**int32)(p.p) = &v -} - -// getInt32Slice loads a []int32 from p. -// The value returned is aliased with the original slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) getInt32Slice() []int32 { - return *(*[]int32)(p.p) -} - -// setInt32Slice stores a []int32 to p. -// The value set is aliased with the input slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) setInt32Slice(v []int32) { - *(*[]int32)(p.p) = v -} - -// TODO: Can we get rid of appendInt32Slice and use setInt32Slice instead? -func (p pointer) appendInt32Slice(v int32) { - s := (*[]int32)(p.p) - *s = append(*s, v) -} - -func (p pointer) toUint64() *uint64 { - return (*uint64)(p.p) -} -func (p pointer) toUint64Ptr() **uint64 { - return (**uint64)(p.p) -} -func (p pointer) toUint64Slice() *[]uint64 { - return (*[]uint64)(p.p) -} -func (p pointer) toUint32() *uint32 { - return (*uint32)(p.p) -} -func (p pointer) toUint32Ptr() **uint32 { - return (**uint32)(p.p) -} -func (p pointer) toUint32Slice() *[]uint32 { - return (*[]uint32)(p.p) -} -func (p pointer) toBool() *bool { - return (*bool)(p.p) -} -func (p pointer) toBoolPtr() **bool { - return (**bool)(p.p) -} -func (p pointer) toBoolSlice() *[]bool { - return (*[]bool)(p.p) -} -func (p pointer) toFloat64() *float64 { - return (*float64)(p.p) -} -func (p pointer) toFloat64Ptr() **float64 { - return (**float64)(p.p) -} -func (p pointer) toFloat64Slice() *[]float64 { - return (*[]float64)(p.p) -} -func (p pointer) toFloat32() *float32 { - return (*float32)(p.p) -} -func (p pointer) toFloat32Ptr() **float32 { - return (**float32)(p.p) -} -func (p pointer) toFloat32Slice() *[]float32 { - return (*[]float32)(p.p) -} -func (p pointer) toString() *string { - return (*string)(p.p) -} -func (p pointer) toStringPtr() **string { - return (**string)(p.p) -} -func (p pointer) toStringSlice() *[]string { - return (*[]string)(p.p) -} -func (p pointer) toBytes() *[]byte { - return (*[]byte)(p.p) -} -func (p pointer) toBytesSlice() *[][]byte { - return (*[][]byte)(p.p) -} -func (p pointer) toExtensions() *XXX_InternalExtensions { - return (*XXX_InternalExtensions)(p.p) -} -func (p pointer) toOldExtensions() *map[int32]Extension { - return (*map[int32]Extension)(p.p) -} - -// getPointerSlice loads []*T from p as a []pointer. -// The value returned is aliased with the original slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) getPointerSlice() []pointer { - // Super-tricky - p should point to a []*T where T is a - // message type. We load it as []pointer. - return *(*[]pointer)(p.p) -} - -// setPointerSlice stores []pointer into p as a []*T. -// The value set is aliased with the input slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) setPointerSlice(v []pointer) { - // Super-tricky - p should point to a []*T where T is a - // message type. We store it as []pointer. - *(*[]pointer)(p.p) = v -} - -// getPointer loads the pointer at p and returns it. -func (p pointer) getPointer() pointer { - return pointer{p: *(*unsafe.Pointer)(p.p)} -} - -// setPointer stores the pointer q at p. -func (p pointer) setPointer(q pointer) { - *(*unsafe.Pointer)(p.p) = q.p -} - -// append q to the slice pointed to by p. -func (p pointer) appendPointer(q pointer) { - s := (*[]unsafe.Pointer)(p.p) - *s = append(*s, q.p) -} - -// getInterfacePointer returns a pointer that points to the -// interface data of the interface pointed by p. -func (p pointer) getInterfacePointer() pointer { - // Super-tricky - read pointer out of data word of interface value. - return pointer{p: (*(*[2]unsafe.Pointer)(p.p))[1]} -} - -// asPointerTo returns a reflect.Value that is a pointer to an -// object of type t stored at p. -func (p pointer) asPointerTo(t reflect.Type) reflect.Value { - return reflect.NewAt(t, p.p) -} - -func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo { - return (*unmarshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) -} -func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) -} -func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo { - return (*marshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) -} -func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) -} -func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo { - return (*mergeInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) -} -func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) -} -func atomicLoadDiscardInfo(p **discardInfo) *discardInfo { - return (*discardInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) -} -func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) -} diff --git a/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go b/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go deleted file mode 100644 index aca8eed02..000000000 --- a/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go +++ /dev/null @@ -1,56 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/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. -// -// 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. - -// +build !purego,!appengine,!js - -// This file contains the implementation of the proto field accesses using package unsafe. - -package proto - -import ( - "reflect" - "unsafe" -) - -func (p pointer) getRef() pointer { - return pointer{p: (unsafe.Pointer)(&p.p)} -} - -func (p pointer) appendRef(v pointer, typ reflect.Type) { - slice := p.getSlice(typ) - elem := v.asPointerTo(typ).Elem() - newSlice := reflect.Append(slice, elem) - slice.Set(newSlice) -} - -func (p pointer) getSlice(typ reflect.Type) reflect.Value { - sliceTyp := reflect.SliceOf(typ) - slice := p.asPointerTo(sliceTyp) - slice = slice.Elem() - return slice -} diff --git a/vendor/github.com/gogo/protobuf/proto/properties.go b/vendor/github.com/gogo/protobuf/proto/properties.go deleted file mode 100644 index 28da1475f..000000000 --- a/vendor/github.com/gogo/protobuf/proto/properties.go +++ /dev/null @@ -1,610 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 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 proto - -/* - * Routines for encoding data into the wire format for protocol buffers. - */ - -import ( - "fmt" - "log" - "reflect" - "sort" - "strconv" - "strings" - "sync" -) - -const debug bool = false - -// Constants that identify the encoding of a value on the wire. -const ( - WireVarint = 0 - WireFixed64 = 1 - WireBytes = 2 - WireStartGroup = 3 - WireEndGroup = 4 - WireFixed32 = 5 -) - -// tagMap is an optimization over map[int]int for typical protocol buffer -// use-cases. Encoded protocol buffers are often in tag order with small tag -// numbers. -type tagMap struct { - fastTags []int - slowTags map[int]int -} - -// tagMapFastLimit is the upper bound on the tag number that will be stored in -// the tagMap slice rather than its map. -const tagMapFastLimit = 1024 - -func (p *tagMap) get(t int) (int, bool) { - if t > 0 && t < tagMapFastLimit { - if t >= len(p.fastTags) { - return 0, false - } - fi := p.fastTags[t] - return fi, fi >= 0 - } - fi, ok := p.slowTags[t] - return fi, ok -} - -func (p *tagMap) put(t int, fi int) { - if t > 0 && t < tagMapFastLimit { - for len(p.fastTags) < t+1 { - p.fastTags = append(p.fastTags, -1) - } - p.fastTags[t] = fi - return - } - if p.slowTags == nil { - p.slowTags = make(map[int]int) - } - p.slowTags[t] = fi -} - -// StructProperties represents properties for all the fields of a struct. -// decoderTags and decoderOrigNames should only be used by the decoder. -type StructProperties struct { - Prop []*Properties // properties for each field - reqCount int // required count - decoderTags tagMap // map from proto tag to struct field number - decoderOrigNames map[string]int // map from original name to struct field number - order []int // list of struct field numbers in tag order - - // OneofTypes contains information about the oneof fields in this message. - // It is keyed by the original name of a field. - OneofTypes map[string]*OneofProperties -} - -// OneofProperties represents information about a specific field in a oneof. -type OneofProperties struct { - Type reflect.Type // pointer to generated struct type for this oneof field - Field int // struct field number of the containing oneof in the message - Prop *Properties -} - -// Implement the sorting interface so we can sort the fields in tag order, as recommended by the spec. -// See encode.go, (*Buffer).enc_struct. - -func (sp *StructProperties) Len() int { return len(sp.order) } -func (sp *StructProperties) Less(i, j int) bool { - return sp.Prop[sp.order[i]].Tag < sp.Prop[sp.order[j]].Tag -} -func (sp *StructProperties) Swap(i, j int) { sp.order[i], sp.order[j] = sp.order[j], sp.order[i] } - -// Properties represents the protocol-specific behavior of a single struct field. -type Properties struct { - Name string // name of the field, for error messages - OrigName string // original name before protocol compiler (always set) - JSONName string // name to use for JSON; determined by protoc - Wire string - WireType int - Tag int - Required bool - Optional bool - Repeated bool - Packed bool // relevant for repeated primitives only - Enum string // set for enum types only - proto3 bool // whether this is known to be a proto3 field - oneof bool // whether this is a oneof field - - Default string // default value - HasDefault bool // whether an explicit default was provided - CustomType string - CastType string - StdTime bool - StdDuration bool - WktPointer bool - - stype reflect.Type // set for struct types only - ctype reflect.Type // set for custom types only - sprop *StructProperties // set for struct types only - - mtype reflect.Type // set for map types only - MapKeyProp *Properties // set for map types only - MapValProp *Properties // set for map types only -} - -// String formats the properties in the protobuf struct field tag style. -func (p *Properties) String() string { - s := p.Wire - s += "," - s += strconv.Itoa(p.Tag) - if p.Required { - s += ",req" - } - if p.Optional { - s += ",opt" - } - if p.Repeated { - s += ",rep" - } - if p.Packed { - s += ",packed" - } - s += ",name=" + p.OrigName - if p.JSONName != p.OrigName { - s += ",json=" + p.JSONName - } - if p.proto3 { - s += ",proto3" - } - if p.oneof { - s += ",oneof" - } - if len(p.Enum) > 0 { - s += ",enum=" + p.Enum - } - if p.HasDefault { - s += ",def=" + p.Default - } - return s -} - -// Parse populates p by parsing a string in the protobuf struct field tag style. -func (p *Properties) Parse(s string) { - // "bytes,49,opt,name=foo,def=hello!" - fields := strings.Split(s, ",") // breaks def=, but handled below. - if len(fields) < 2 { - log.Printf("proto: tag has too few fields: %q", s) - return - } - - p.Wire = fields[0] - switch p.Wire { - case "varint": - p.WireType = WireVarint - case "fixed32": - p.WireType = WireFixed32 - case "fixed64": - p.WireType = WireFixed64 - case "zigzag32": - p.WireType = WireVarint - case "zigzag64": - p.WireType = WireVarint - case "bytes", "group": - p.WireType = WireBytes - // no numeric converter for non-numeric types - default: - log.Printf("proto: tag has unknown wire type: %q", s) - return - } - - var err error - p.Tag, err = strconv.Atoi(fields[1]) - if err != nil { - return - } - -outer: - for i := 2; i < len(fields); i++ { - f := fields[i] - switch { - case f == "req": - p.Required = true - case f == "opt": - p.Optional = true - case f == "rep": - p.Repeated = true - case f == "packed": - p.Packed = true - case strings.HasPrefix(f, "name="): - p.OrigName = f[5:] - case strings.HasPrefix(f, "json="): - p.JSONName = f[5:] - case strings.HasPrefix(f, "enum="): - p.Enum = f[5:] - case f == "proto3": - p.proto3 = true - case f == "oneof": - p.oneof = true - case strings.HasPrefix(f, "def="): - p.HasDefault = true - p.Default = f[4:] // rest of string - if i+1 < len(fields) { - // Commas aren't escaped, and def is always last. - p.Default += "," + strings.Join(fields[i+1:], ",") - break outer - } - case strings.HasPrefix(f, "embedded="): - p.OrigName = strings.Split(f, "=")[1] - case strings.HasPrefix(f, "customtype="): - p.CustomType = strings.Split(f, "=")[1] - case strings.HasPrefix(f, "casttype="): - p.CastType = strings.Split(f, "=")[1] - case f == "stdtime": - p.StdTime = true - case f == "stdduration": - p.StdDuration = true - case f == "wktptr": - p.WktPointer = true - } - } -} - -var protoMessageType = reflect.TypeOf((*Message)(nil)).Elem() - -// setFieldProps initializes the field properties for submessages and maps. -func (p *Properties) setFieldProps(typ reflect.Type, f *reflect.StructField, lockGetProp bool) { - isMap := typ.Kind() == reflect.Map - if len(p.CustomType) > 0 && !isMap { - p.ctype = typ - p.setTag(lockGetProp) - return - } - if p.StdTime && !isMap { - p.setTag(lockGetProp) - return - } - if p.StdDuration && !isMap { - p.setTag(lockGetProp) - return - } - if p.WktPointer && !isMap { - p.setTag(lockGetProp) - return - } - switch t1 := typ; t1.Kind() { - case reflect.Struct: - p.stype = typ - case reflect.Ptr: - if t1.Elem().Kind() == reflect.Struct { - p.stype = t1.Elem() - } - case reflect.Slice: - switch t2 := t1.Elem(); t2.Kind() { - case reflect.Ptr: - switch t3 := t2.Elem(); t3.Kind() { - case reflect.Struct: - p.stype = t3 - } - case reflect.Struct: - p.stype = t2 - } - - case reflect.Map: - - p.mtype = t1 - p.MapKeyProp = &Properties{} - p.MapKeyProp.init(reflect.PtrTo(p.mtype.Key()), "Key", f.Tag.Get("protobuf_key"), nil, lockGetProp) - p.MapValProp = &Properties{} - vtype := p.mtype.Elem() - if vtype.Kind() != reflect.Ptr && vtype.Kind() != reflect.Slice { - // The value type is not a message (*T) or bytes ([]byte), - // so we need encoders for the pointer to this type. - vtype = reflect.PtrTo(vtype) - } - - p.MapValProp.CustomType = p.CustomType - p.MapValProp.StdDuration = p.StdDuration - p.MapValProp.StdTime = p.StdTime - p.MapValProp.WktPointer = p.WktPointer - p.MapValProp.init(vtype, "Value", f.Tag.Get("protobuf_val"), nil, lockGetProp) - } - p.setTag(lockGetProp) -} - -func (p *Properties) setTag(lockGetProp bool) { - if p.stype != nil { - if lockGetProp { - p.sprop = GetProperties(p.stype) - } else { - p.sprop = getPropertiesLocked(p.stype) - } - } -} - -var ( - marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem() -) - -// Init populates the properties from a protocol buffer struct tag. -func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) { - p.init(typ, name, tag, f, true) -} - -func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructField, lockGetProp bool) { - // "bytes,49,opt,def=hello!" - p.Name = name - p.OrigName = name - if tag == "" { - return - } - p.Parse(tag) - p.setFieldProps(typ, f, lockGetProp) -} - -var ( - propertiesMu sync.RWMutex - propertiesMap = make(map[reflect.Type]*StructProperties) -) - -// GetProperties returns the list of properties for the type represented by t. -// t must represent a generated struct type of a protocol message. -func GetProperties(t reflect.Type) *StructProperties { - if t.Kind() != reflect.Struct { - panic("proto: type must have kind struct") - } - - // Most calls to GetProperties in a long-running program will be - // retrieving details for types we have seen before. - propertiesMu.RLock() - sprop, ok := propertiesMap[t] - propertiesMu.RUnlock() - if ok { - return sprop - } - - propertiesMu.Lock() - sprop = getPropertiesLocked(t) - propertiesMu.Unlock() - return sprop -} - -type ( - oneofFuncsIface interface { - XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) - } - oneofWrappersIface interface { - XXX_OneofWrappers() []interface{} - } -) - -// getPropertiesLocked requires that propertiesMu is held. -func getPropertiesLocked(t reflect.Type) *StructProperties { - if prop, ok := propertiesMap[t]; ok { - return prop - } - - prop := new(StructProperties) - // in case of recursive protos, fill this in now. - propertiesMap[t] = prop - - // build properties - prop.Prop = make([]*Properties, t.NumField()) - prop.order = make([]int, t.NumField()) - - isOneofMessage := false - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - p := new(Properties) - name := f.Name - p.init(f.Type, name, f.Tag.Get("protobuf"), &f, false) - - oneof := f.Tag.Get("protobuf_oneof") // special case - if oneof != "" { - isOneofMessage = true - // Oneof fields don't use the traditional protobuf tag. - p.OrigName = oneof - } - prop.Prop[i] = p - prop.order[i] = i - if debug { - print(i, " ", f.Name, " ", t.String(), " ") - if p.Tag > 0 { - print(p.String()) - } - print("\n") - } - } - - // Re-order prop.order. - sort.Sort(prop) - - if isOneofMessage { - var oots []interface{} - switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { - case oneofFuncsIface: - _, _, _, oots = m.XXX_OneofFuncs() - case oneofWrappersIface: - oots = m.XXX_OneofWrappers() - } - if len(oots) > 0 { - // Interpret oneof metadata. - prop.OneofTypes = make(map[string]*OneofProperties) - for _, oot := range oots { - oop := &OneofProperties{ - Type: reflect.ValueOf(oot).Type(), // *T - Prop: new(Properties), - } - sft := oop.Type.Elem().Field(0) - oop.Prop.Name = sft.Name - oop.Prop.Parse(sft.Tag.Get("protobuf")) - // There will be exactly one interface field that - // this new value is assignable to. - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - if f.Type.Kind() != reflect.Interface { - continue - } - if !oop.Type.AssignableTo(f.Type) { - continue - } - oop.Field = i - break - } - prop.OneofTypes[oop.Prop.OrigName] = oop - } - } - } - - // build required counts - // build tags - reqCount := 0 - prop.decoderOrigNames = make(map[string]int) - for i, p := range prop.Prop { - if strings.HasPrefix(p.Name, "XXX_") { - // Internal fields should not appear in tags/origNames maps. - // They are handled specially when encoding and decoding. - continue - } - if p.Required { - reqCount++ - } - prop.decoderTags.put(p.Tag, i) - prop.decoderOrigNames[p.OrigName] = i - } - prop.reqCount = reqCount - - return prop -} - -// A global registry of enum types. -// The generated code will register the generated maps by calling RegisterEnum. - -var enumValueMaps = make(map[string]map[string]int32) -var enumStringMaps = make(map[string]map[int32]string) - -// RegisterEnum is called from the generated code to install the enum descriptor -// maps into the global table to aid parsing text format protocol buffers. -func RegisterEnum(typeName string, unusedNameMap map[int32]string, valueMap map[string]int32) { - if _, ok := enumValueMaps[typeName]; ok { - panic("proto: duplicate enum registered: " + typeName) - } - enumValueMaps[typeName] = valueMap - if _, ok := enumStringMaps[typeName]; ok { - panic("proto: duplicate enum registered: " + typeName) - } - enumStringMaps[typeName] = unusedNameMap -} - -// EnumValueMap returns the mapping from names to integers of the -// enum type enumType, or a nil if not found. -func EnumValueMap(enumType string) map[string]int32 { - return enumValueMaps[enumType] -} - -// A registry of all linked message types. -// The string is a fully-qualified proto name ("pkg.Message"). -var ( - protoTypedNils = make(map[string]Message) // a map from proto names to typed nil pointers - protoMapTypes = make(map[string]reflect.Type) // a map from proto names to map types - revProtoTypes = make(map[reflect.Type]string) -) - -// RegisterType is called from generated code and maps from the fully qualified -// proto name to the type (pointer to struct) of the protocol buffer. -func RegisterType(x Message, name string) { - if _, ok := protoTypedNils[name]; ok { - // TODO: Some day, make this a panic. - log.Printf("proto: duplicate proto type registered: %s", name) - return - } - t := reflect.TypeOf(x) - if v := reflect.ValueOf(x); v.Kind() == reflect.Ptr && v.Pointer() == 0 { - // Generated code always calls RegisterType with nil x. - // This check is just for extra safety. - protoTypedNils[name] = x - } else { - protoTypedNils[name] = reflect.Zero(t).Interface().(Message) - } - revProtoTypes[t] = name -} - -// RegisterMapType is called from generated code and maps from the fully qualified -// proto name to the native map type of the proto map definition. -func RegisterMapType(x interface{}, name string) { - if reflect.TypeOf(x).Kind() != reflect.Map { - panic(fmt.Sprintf("RegisterMapType(%T, %q); want map", x, name)) - } - if _, ok := protoMapTypes[name]; ok { - log.Printf("proto: duplicate proto type registered: %s", name) - return - } - t := reflect.TypeOf(x) - protoMapTypes[name] = t - revProtoTypes[t] = name -} - -// MessageName returns the fully-qualified proto name for the given message type. -func MessageName(x Message) string { - type xname interface { - XXX_MessageName() string - } - if m, ok := x.(xname); ok { - return m.XXX_MessageName() - } - return revProtoTypes[reflect.TypeOf(x)] -} - -// MessageType returns the message type (pointer to struct) for a named message. -// The type is not guaranteed to implement proto.Message if the name refers to a -// map entry. -func MessageType(name string) reflect.Type { - if t, ok := protoTypedNils[name]; ok { - return reflect.TypeOf(t) - } - return protoMapTypes[name] -} - -// A registry of all linked proto files. -var ( - protoFiles = make(map[string][]byte) // file name => fileDescriptor -) - -// RegisterFile is called from generated code and maps from the -// full file name of a .proto file to its compressed FileDescriptorProto. -func RegisterFile(filename string, fileDescriptor []byte) { - protoFiles[filename] = fileDescriptor -} - -// FileDescriptor returns the compressed FileDescriptorProto for a .proto file. -func FileDescriptor(filename string) []byte { return protoFiles[filename] } diff --git a/vendor/github.com/gogo/protobuf/proto/properties_gogo.go b/vendor/github.com/gogo/protobuf/proto/properties_gogo.go deleted file mode 100644 index 40ea3dd93..000000000 --- a/vendor/github.com/gogo/protobuf/proto/properties_gogo.go +++ /dev/null @@ -1,36 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/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. -// -// 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 proto - -import ( - "reflect" -) - -var sizerType = reflect.TypeOf((*Sizer)(nil)).Elem() -var protosizerType = reflect.TypeOf((*ProtoSizer)(nil)).Elem() diff --git a/vendor/github.com/gogo/protobuf/proto/skip_gogo.go b/vendor/github.com/gogo/protobuf/proto/skip_gogo.go deleted file mode 100644 index 5a5fd93f7..000000000 --- a/vendor/github.com/gogo/protobuf/proto/skip_gogo.go +++ /dev/null @@ -1,119 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/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. -// -// 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 proto - -import ( - "fmt" - "io" -) - -func Skip(data []byte) (n int, err error) { - l := len(data) - index := 0 - for index < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if index >= l { - return 0, io.ErrUnexpectedEOF - } - b := data[index] - index++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for { - if index >= l { - return 0, io.ErrUnexpectedEOF - } - index++ - if data[index-1] < 0x80 { - break - } - } - return index, nil - case 1: - index += 8 - return index, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if index >= l { - return 0, io.ErrUnexpectedEOF - } - b := data[index] - index++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - index += length - return index, nil - case 3: - for { - var innerWire uint64 - var start int = index - for shift := uint(0); ; shift += 7 { - if index >= l { - return 0, io.ErrUnexpectedEOF - } - b := data[index] - index++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := Skip(data[start:]) - if err != nil { - return 0, err - } - index = start + next - } - return index, nil - case 4: - return index, nil - case 5: - index += 4 - return index, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} diff --git a/vendor/github.com/gogo/protobuf/proto/table_marshal.go b/vendor/github.com/gogo/protobuf/proto/table_marshal.go deleted file mode 100644 index f8babdefa..000000000 --- a/vendor/github.com/gogo/protobuf/proto/table_marshal.go +++ /dev/null @@ -1,3009 +0,0 @@ -// 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 proto - -import ( - "errors" - "fmt" - "math" - "reflect" - "sort" - "strconv" - "strings" - "sync" - "sync/atomic" - "unicode/utf8" -) - -// a sizer takes a pointer to a field and the size of its tag, computes the size of -// the encoded data. -type sizer func(pointer, int) int - -// a marshaler takes a byte slice, a pointer to a field, and its tag (in wire format), -// marshals the field to the end of the slice, returns the slice and error (if any). -type marshaler func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) - -// marshalInfo is the information used for marshaling a message. -type marshalInfo struct { - typ reflect.Type - fields []*marshalFieldInfo - unrecognized field // offset of XXX_unrecognized - extensions field // offset of XXX_InternalExtensions - v1extensions field // offset of XXX_extensions - sizecache field // offset of XXX_sizecache - initialized int32 // 0 -- only typ is set, 1 -- fully initialized - messageset bool // uses message set wire format - hasmarshaler bool // has custom marshaler - sync.RWMutex // protect extElems map, also for initialization - extElems map[int32]*marshalElemInfo // info of extension elements - - hassizer bool // has custom sizer - hasprotosizer bool // has custom protosizer - - bytesExtensions field // offset of XXX_extensions where the field type is []byte -} - -// marshalFieldInfo is the information used for marshaling a field of a message. -type marshalFieldInfo struct { - field field - wiretag uint64 // tag in wire format - tagsize int // size of tag in wire format - sizer sizer - marshaler marshaler - isPointer bool - required bool // field is required - name string // name of the field, for error reporting - oneofElems map[reflect.Type]*marshalElemInfo // info of oneof elements -} - -// marshalElemInfo is the information used for marshaling an extension or oneof element. -type marshalElemInfo struct { - wiretag uint64 // tag in wire format - tagsize int // size of tag in wire format - sizer sizer - marshaler marshaler - isptr bool // elem is pointer typed, thus interface of this type is a direct interface (extension only) -} - -var ( - marshalInfoMap = map[reflect.Type]*marshalInfo{} - marshalInfoLock sync.Mutex - - uint8SliceType = reflect.TypeOf(([]uint8)(nil)).Kind() -) - -// getMarshalInfo returns the information to marshal a given type of message. -// The info it returns may not necessarily initialized. -// t is the type of the message (NOT the pointer to it). -func getMarshalInfo(t reflect.Type) *marshalInfo { - marshalInfoLock.Lock() - u, ok := marshalInfoMap[t] - if !ok { - u = &marshalInfo{typ: t} - marshalInfoMap[t] = u - } - marshalInfoLock.Unlock() - return u -} - -// Size is the entry point from generated code, -// and should be ONLY called by generated code. -// It computes the size of encoded data of msg. -// a is a pointer to a place to store cached marshal info. -func (a *InternalMessageInfo) Size(msg Message) int { - u := getMessageMarshalInfo(msg, a) - ptr := toPointer(&msg) - if ptr.isNil() { - // We get here if msg is a typed nil ((*SomeMessage)(nil)), - // so it satisfies the interface, and msg == nil wouldn't - // catch it. We don't want crash in this case. - return 0 - } - return u.size(ptr) -} - -// Marshal is the entry point from generated code, -// and should be ONLY called by generated code. -// It marshals msg to the end of b. -// a is a pointer to a place to store cached marshal info. -func (a *InternalMessageInfo) Marshal(b []byte, msg Message, deterministic bool) ([]byte, error) { - u := getMessageMarshalInfo(msg, a) - ptr := toPointer(&msg) - if ptr.isNil() { - // We get here if msg is a typed nil ((*SomeMessage)(nil)), - // so it satisfies the interface, and msg == nil wouldn't - // catch it. We don't want crash in this case. - return b, ErrNil - } - return u.marshal(b, ptr, deterministic) -} - -func getMessageMarshalInfo(msg interface{}, a *InternalMessageInfo) *marshalInfo { - // u := a.marshal, but atomically. - // We use an atomic here to ensure memory consistency. - u := atomicLoadMarshalInfo(&a.marshal) - if u == nil { - // Get marshal information from type of message. - t := reflect.ValueOf(msg).Type() - if t.Kind() != reflect.Ptr { - panic(fmt.Sprintf("cannot handle non-pointer message type %v", t)) - } - u = getMarshalInfo(t.Elem()) - // Store it in the cache for later users. - // a.marshal = u, but atomically. - atomicStoreMarshalInfo(&a.marshal, u) - } - return u -} - -// size is the main function to compute the size of the encoded data of a message. -// ptr is the pointer to the message. -func (u *marshalInfo) size(ptr pointer) int { - if atomic.LoadInt32(&u.initialized) == 0 { - u.computeMarshalInfo() - } - - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - if u.hasmarshaler { - // Uses the message's Size method if available - if u.hassizer { - s := ptr.asPointerTo(u.typ).Interface().(Sizer) - return s.Size() - } - // Uses the message's ProtoSize method if available - if u.hasprotosizer { - s := ptr.asPointerTo(u.typ).Interface().(ProtoSizer) - return s.ProtoSize() - } - - m := ptr.asPointerTo(u.typ).Interface().(Marshaler) - b, _ := m.Marshal() - return len(b) - } - - n := 0 - for _, f := range u.fields { - if f.isPointer && ptr.offset(f.field).getPointer().isNil() { - // nil pointer always marshals to nothing - continue - } - n += f.sizer(ptr.offset(f.field), f.tagsize) - } - if u.extensions.IsValid() { - e := ptr.offset(u.extensions).toExtensions() - if u.messageset { - n += u.sizeMessageSet(e) - } else { - n += u.sizeExtensions(e) - } - } - if u.v1extensions.IsValid() { - m := *ptr.offset(u.v1extensions).toOldExtensions() - n += u.sizeV1Extensions(m) - } - if u.bytesExtensions.IsValid() { - s := *ptr.offset(u.bytesExtensions).toBytes() - n += len(s) - } - if u.unrecognized.IsValid() { - s := *ptr.offset(u.unrecognized).toBytes() - n += len(s) - } - - // cache the result for use in marshal - if u.sizecache.IsValid() { - atomic.StoreInt32(ptr.offset(u.sizecache).toInt32(), int32(n)) - } - return n -} - -// cachedsize gets the size from cache. If there is no cache (i.e. message is not generated), -// fall back to compute the size. -func (u *marshalInfo) cachedsize(ptr pointer) int { - if u.sizecache.IsValid() { - return int(atomic.LoadInt32(ptr.offset(u.sizecache).toInt32())) - } - return u.size(ptr) -} - -// marshal is the main function to marshal a message. It takes a byte slice and appends -// the encoded data to the end of the slice, returns the slice and error (if any). -// ptr is the pointer to the message. -// If deterministic is true, map is marshaled in deterministic order. -func (u *marshalInfo) marshal(b []byte, ptr pointer, deterministic bool) ([]byte, error) { - if atomic.LoadInt32(&u.initialized) == 0 { - u.computeMarshalInfo() - } - - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - if u.hasmarshaler { - m := ptr.asPointerTo(u.typ).Interface().(Marshaler) - b1, err := m.Marshal() - b = append(b, b1...) - return b, err - } - - var err, errLater error - // The old marshaler encodes extensions at beginning. - if u.extensions.IsValid() { - e := ptr.offset(u.extensions).toExtensions() - if u.messageset { - b, err = u.appendMessageSet(b, e, deterministic) - } else { - b, err = u.appendExtensions(b, e, deterministic) - } - if err != nil { - return b, err - } - } - if u.v1extensions.IsValid() { - m := *ptr.offset(u.v1extensions).toOldExtensions() - b, err = u.appendV1Extensions(b, m, deterministic) - if err != nil { - return b, err - } - } - if u.bytesExtensions.IsValid() { - s := *ptr.offset(u.bytesExtensions).toBytes() - b = append(b, s...) - } - for _, f := range u.fields { - if f.required { - if f.isPointer && ptr.offset(f.field).getPointer().isNil() { - // Required field is not set. - // We record the error but keep going, to give a complete marshaling. - if errLater == nil { - errLater = &RequiredNotSetError{f.name} - } - continue - } - } - if f.isPointer && ptr.offset(f.field).getPointer().isNil() { - // nil pointer always marshals to nothing - continue - } - b, err = f.marshaler(b, ptr.offset(f.field), f.wiretag, deterministic) - if err != nil { - if err1, ok := err.(*RequiredNotSetError); ok { - // Required field in submessage is not set. - // We record the error but keep going, to give a complete marshaling. - if errLater == nil { - errLater = &RequiredNotSetError{f.name + "." + err1.field} - } - continue - } - if err == errRepeatedHasNil { - err = errors.New("proto: repeated field " + f.name + " has nil element") - } - if err == errInvalidUTF8 { - if errLater == nil { - fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name - errLater = &invalidUTF8Error{fullName} - } - continue - } - return b, err - } - } - if u.unrecognized.IsValid() { - s := *ptr.offset(u.unrecognized).toBytes() - b = append(b, s...) - } - return b, errLater -} - -// computeMarshalInfo initializes the marshal info. -func (u *marshalInfo) computeMarshalInfo() { - u.Lock() - defer u.Unlock() - if u.initialized != 0 { // non-atomic read is ok as it is protected by the lock - return - } - - t := u.typ - u.unrecognized = invalidField - u.extensions = invalidField - u.v1extensions = invalidField - u.bytesExtensions = invalidField - u.sizecache = invalidField - isOneofMessage := false - - if reflect.PtrTo(t).Implements(sizerType) { - u.hassizer = true - } - if reflect.PtrTo(t).Implements(protosizerType) { - u.hasprotosizer = true - } - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - if reflect.PtrTo(t).Implements(marshalerType) { - u.hasmarshaler = true - atomic.StoreInt32(&u.initialized, 1) - return - } - - n := t.NumField() - - // deal with XXX fields first - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - if f.Tag.Get("protobuf_oneof") != "" { - isOneofMessage = true - } - if !strings.HasPrefix(f.Name, "XXX_") { - continue - } - switch f.Name { - case "XXX_sizecache": - u.sizecache = toField(&f) - case "XXX_unrecognized": - u.unrecognized = toField(&f) - case "XXX_InternalExtensions": - u.extensions = toField(&f) - u.messageset = f.Tag.Get("protobuf_messageset") == "1" - case "XXX_extensions": - if f.Type.Kind() == reflect.Map { - u.v1extensions = toField(&f) - } else { - u.bytesExtensions = toField(&f) - } - case "XXX_NoUnkeyedLiteral": - // nothing to do - default: - panic("unknown XXX field: " + f.Name) - } - n-- - } - - // get oneof implementers - var oneofImplementers []interface{} - // gogo: isOneofMessage is needed for embedded oneof messages, without a marshaler and unmarshaler - if isOneofMessage { - switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { - case oneofFuncsIface: - _, _, _, oneofImplementers = m.XXX_OneofFuncs() - case oneofWrappersIface: - oneofImplementers = m.XXX_OneofWrappers() - } - } - - // normal fields - fields := make([]marshalFieldInfo, n) // batch allocation - u.fields = make([]*marshalFieldInfo, 0, n) - for i, j := 0, 0; i < t.NumField(); i++ { - f := t.Field(i) - - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - field := &fields[j] - j++ - field.name = f.Name - u.fields = append(u.fields, field) - if f.Tag.Get("protobuf_oneof") != "" { - field.computeOneofFieldInfo(&f, oneofImplementers) - continue - } - if f.Tag.Get("protobuf") == "" { - // field has no tag (not in generated message), ignore it - u.fields = u.fields[:len(u.fields)-1] - j-- - continue - } - field.computeMarshalFieldInfo(&f) - } - - // fields are marshaled in tag order on the wire. - sort.Sort(byTag(u.fields)) - - atomic.StoreInt32(&u.initialized, 1) -} - -// helper for sorting fields by tag -type byTag []*marshalFieldInfo - -func (a byTag) Len() int { return len(a) } -func (a byTag) Swap(i, j int) { a[i], a[j] = a[j], a[i] } -func (a byTag) Less(i, j int) bool { return a[i].wiretag < a[j].wiretag } - -// getExtElemInfo returns the information to marshal an extension element. -// The info it returns is initialized. -func (u *marshalInfo) getExtElemInfo(desc *ExtensionDesc) *marshalElemInfo { - // get from cache first - u.RLock() - e, ok := u.extElems[desc.Field] - u.RUnlock() - if ok { - return e - } - - t := reflect.TypeOf(desc.ExtensionType) // pointer or slice to basic type or struct - tags := strings.Split(desc.Tag, ",") - tag, err := strconv.Atoi(tags[1]) - if err != nil { - panic("tag is not an integer") - } - wt := wiretype(tags[0]) - sizr, marshalr := typeMarshaler(t, tags, false, false) - e = &marshalElemInfo{ - wiretag: uint64(tag)<<3 | wt, - tagsize: SizeVarint(uint64(tag) << 3), - sizer: sizr, - marshaler: marshalr, - isptr: t.Kind() == reflect.Ptr, - } - - // update cache - u.Lock() - if u.extElems == nil { - u.extElems = make(map[int32]*marshalElemInfo) - } - u.extElems[desc.Field] = e - u.Unlock() - return e -} - -// computeMarshalFieldInfo fills up the information to marshal a field. -func (fi *marshalFieldInfo) computeMarshalFieldInfo(f *reflect.StructField) { - // parse protobuf tag of the field. - // tag has format of "bytes,49,opt,name=foo,def=hello!" - tags := strings.Split(f.Tag.Get("protobuf"), ",") - if tags[0] == "" { - return - } - tag, err := strconv.Atoi(tags[1]) - if err != nil { - panic("tag is not an integer") - } - wt := wiretype(tags[0]) - if tags[2] == "req" { - fi.required = true - } - fi.setTag(f, tag, wt) - fi.setMarshaler(f, tags) -} - -func (fi *marshalFieldInfo) computeOneofFieldInfo(f *reflect.StructField, oneofImplementers []interface{}) { - fi.field = toField(f) - fi.wiretag = math.MaxInt32 // Use a large tag number, make oneofs sorted at the end. This tag will not appear on the wire. - fi.isPointer = true - fi.sizer, fi.marshaler = makeOneOfMarshaler(fi, f) - fi.oneofElems = make(map[reflect.Type]*marshalElemInfo) - - ityp := f.Type // interface type - for _, o := range oneofImplementers { - t := reflect.TypeOf(o) - if !t.Implements(ityp) { - continue - } - sf := t.Elem().Field(0) // oneof implementer is a struct with a single field - tags := strings.Split(sf.Tag.Get("protobuf"), ",") - tag, err := strconv.Atoi(tags[1]) - if err != nil { - panic("tag is not an integer") - } - wt := wiretype(tags[0]) - sizr, marshalr := typeMarshaler(sf.Type, tags, false, true) // oneof should not omit any zero value - fi.oneofElems[t.Elem()] = &marshalElemInfo{ - wiretag: uint64(tag)<<3 | wt, - tagsize: SizeVarint(uint64(tag) << 3), - sizer: sizr, - marshaler: marshalr, - } - } -} - -// wiretype returns the wire encoding of the type. -func wiretype(encoding string) uint64 { - switch encoding { - case "fixed32": - return WireFixed32 - case "fixed64": - return WireFixed64 - case "varint", "zigzag32", "zigzag64": - return WireVarint - case "bytes": - return WireBytes - case "group": - return WireStartGroup - } - panic("unknown wire type " + encoding) -} - -// setTag fills up the tag (in wire format) and its size in the info of a field. -func (fi *marshalFieldInfo) setTag(f *reflect.StructField, tag int, wt uint64) { - fi.field = toField(f) - fi.wiretag = uint64(tag)<<3 | wt - fi.tagsize = SizeVarint(uint64(tag) << 3) -} - -// setMarshaler fills up the sizer and marshaler in the info of a field. -func (fi *marshalFieldInfo) setMarshaler(f *reflect.StructField, tags []string) { - switch f.Type.Kind() { - case reflect.Map: - // map field - fi.isPointer = true - fi.sizer, fi.marshaler = makeMapMarshaler(f) - return - case reflect.Ptr, reflect.Slice: - fi.isPointer = true - } - fi.sizer, fi.marshaler = typeMarshaler(f.Type, tags, true, false) -} - -// typeMarshaler returns the sizer and marshaler of a given field. -// t is the type of the field. -// tags is the generated "protobuf" tag of the field. -// If nozero is true, zero value is not marshaled to the wire. -// If oneof is true, it is a oneof field. -func typeMarshaler(t reflect.Type, tags []string, nozero, oneof bool) (sizer, marshaler) { - encoding := tags[0] - - pointer := false - slice := false - if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 { - slice = true - t = t.Elem() - } - if t.Kind() == reflect.Ptr { - pointer = true - t = t.Elem() - } - - packed := false - proto3 := false - ctype := false - isTime := false - isDuration := false - isWktPointer := false - validateUTF8 := true - for i := 2; i < len(tags); i++ { - if tags[i] == "packed" { - packed = true - } - if tags[i] == "proto3" { - proto3 = true - } - if strings.HasPrefix(tags[i], "customtype=") { - ctype = true - } - if tags[i] == "stdtime" { - isTime = true - } - if tags[i] == "stdduration" { - isDuration = true - } - if tags[i] == "wktptr" { - isWktPointer = true - } - } - validateUTF8 = validateUTF8 && proto3 - if !proto3 && !pointer && !slice { - nozero = false - } - - if ctype { - if reflect.PtrTo(t).Implements(customType) { - if slice { - return makeMessageRefSliceMarshaler(getMarshalInfo(t)) - } - if pointer { - return makeCustomPtrMarshaler(getMarshalInfo(t)) - } - return makeCustomMarshaler(getMarshalInfo(t)) - } else { - panic(fmt.Sprintf("custom type: type: %v, does not implement the proto.custom interface", t)) - } - } - - if isTime { - if pointer { - if slice { - return makeTimePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeTimePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeTimeSliceMarshaler(getMarshalInfo(t)) - } - return makeTimeMarshaler(getMarshalInfo(t)) - } - - if isDuration { - if pointer { - if slice { - return makeDurationPtrSliceMarshaler(getMarshalInfo(t)) - } - return makeDurationPtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeDurationSliceMarshaler(getMarshalInfo(t)) - } - return makeDurationMarshaler(getMarshalInfo(t)) - } - - if isWktPointer { - switch t.Kind() { - case reflect.Float64: - if pointer { - if slice { - return makeStdDoubleValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdDoubleValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdDoubleValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdDoubleValueMarshaler(getMarshalInfo(t)) - case reflect.Float32: - if pointer { - if slice { - return makeStdFloatValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdFloatValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdFloatValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdFloatValueMarshaler(getMarshalInfo(t)) - case reflect.Int64: - if pointer { - if slice { - return makeStdInt64ValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdInt64ValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdInt64ValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdInt64ValueMarshaler(getMarshalInfo(t)) - case reflect.Uint64: - if pointer { - if slice { - return makeStdUInt64ValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdUInt64ValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdUInt64ValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdUInt64ValueMarshaler(getMarshalInfo(t)) - case reflect.Int32: - if pointer { - if slice { - return makeStdInt32ValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdInt32ValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdInt32ValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdInt32ValueMarshaler(getMarshalInfo(t)) - case reflect.Uint32: - if pointer { - if slice { - return makeStdUInt32ValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdUInt32ValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdUInt32ValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdUInt32ValueMarshaler(getMarshalInfo(t)) - case reflect.Bool: - if pointer { - if slice { - return makeStdBoolValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdBoolValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdBoolValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdBoolValueMarshaler(getMarshalInfo(t)) - case reflect.String: - if pointer { - if slice { - return makeStdStringValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdStringValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdStringValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdStringValueMarshaler(getMarshalInfo(t)) - case uint8SliceType: - if pointer { - if slice { - return makeStdBytesValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdBytesValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdBytesValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdBytesValueMarshaler(getMarshalInfo(t)) - default: - panic(fmt.Sprintf("unknown wktpointer type %#v", t)) - } - } - - switch t.Kind() { - case reflect.Bool: - if pointer { - return sizeBoolPtr, appendBoolPtr - } - if slice { - if packed { - return sizeBoolPackedSlice, appendBoolPackedSlice - } - return sizeBoolSlice, appendBoolSlice - } - if nozero { - return sizeBoolValueNoZero, appendBoolValueNoZero - } - return sizeBoolValue, appendBoolValue - case reflect.Uint32: - switch encoding { - case "fixed32": - if pointer { - return sizeFixed32Ptr, appendFixed32Ptr - } - if slice { - if packed { - return sizeFixed32PackedSlice, appendFixed32PackedSlice - } - return sizeFixed32Slice, appendFixed32Slice - } - if nozero { - return sizeFixed32ValueNoZero, appendFixed32ValueNoZero - } - return sizeFixed32Value, appendFixed32Value - case "varint": - if pointer { - return sizeVarint32Ptr, appendVarint32Ptr - } - if slice { - if packed { - return sizeVarint32PackedSlice, appendVarint32PackedSlice - } - return sizeVarint32Slice, appendVarint32Slice - } - if nozero { - return sizeVarint32ValueNoZero, appendVarint32ValueNoZero - } - return sizeVarint32Value, appendVarint32Value - } - case reflect.Int32: - switch encoding { - case "fixed32": - if pointer { - return sizeFixedS32Ptr, appendFixedS32Ptr - } - if slice { - if packed { - return sizeFixedS32PackedSlice, appendFixedS32PackedSlice - } - return sizeFixedS32Slice, appendFixedS32Slice - } - if nozero { - return sizeFixedS32ValueNoZero, appendFixedS32ValueNoZero - } - return sizeFixedS32Value, appendFixedS32Value - case "varint": - if pointer { - return sizeVarintS32Ptr, appendVarintS32Ptr - } - if slice { - if packed { - return sizeVarintS32PackedSlice, appendVarintS32PackedSlice - } - return sizeVarintS32Slice, appendVarintS32Slice - } - if nozero { - return sizeVarintS32ValueNoZero, appendVarintS32ValueNoZero - } - return sizeVarintS32Value, appendVarintS32Value - case "zigzag32": - if pointer { - return sizeZigzag32Ptr, appendZigzag32Ptr - } - if slice { - if packed { - return sizeZigzag32PackedSlice, appendZigzag32PackedSlice - } - return sizeZigzag32Slice, appendZigzag32Slice - } - if nozero { - return sizeZigzag32ValueNoZero, appendZigzag32ValueNoZero - } - return sizeZigzag32Value, appendZigzag32Value - } - case reflect.Uint64: - switch encoding { - case "fixed64": - if pointer { - return sizeFixed64Ptr, appendFixed64Ptr - } - if slice { - if packed { - return sizeFixed64PackedSlice, appendFixed64PackedSlice - } - return sizeFixed64Slice, appendFixed64Slice - } - if nozero { - return sizeFixed64ValueNoZero, appendFixed64ValueNoZero - } - return sizeFixed64Value, appendFixed64Value - case "varint": - if pointer { - return sizeVarint64Ptr, appendVarint64Ptr - } - if slice { - if packed { - return sizeVarint64PackedSlice, appendVarint64PackedSlice - } - return sizeVarint64Slice, appendVarint64Slice - } - if nozero { - return sizeVarint64ValueNoZero, appendVarint64ValueNoZero - } - return sizeVarint64Value, appendVarint64Value - } - case reflect.Int64: - switch encoding { - case "fixed64": - if pointer { - return sizeFixedS64Ptr, appendFixedS64Ptr - } - if slice { - if packed { - return sizeFixedS64PackedSlice, appendFixedS64PackedSlice - } - return sizeFixedS64Slice, appendFixedS64Slice - } - if nozero { - return sizeFixedS64ValueNoZero, appendFixedS64ValueNoZero - } - return sizeFixedS64Value, appendFixedS64Value - case "varint": - if pointer { - return sizeVarintS64Ptr, appendVarintS64Ptr - } - if slice { - if packed { - return sizeVarintS64PackedSlice, appendVarintS64PackedSlice - } - return sizeVarintS64Slice, appendVarintS64Slice - } - if nozero { - return sizeVarintS64ValueNoZero, appendVarintS64ValueNoZero - } - return sizeVarintS64Value, appendVarintS64Value - case "zigzag64": - if pointer { - return sizeZigzag64Ptr, appendZigzag64Ptr - } - if slice { - if packed { - return sizeZigzag64PackedSlice, appendZigzag64PackedSlice - } - return sizeZigzag64Slice, appendZigzag64Slice - } - if nozero { - return sizeZigzag64ValueNoZero, appendZigzag64ValueNoZero - } - return sizeZigzag64Value, appendZigzag64Value - } - case reflect.Float32: - if pointer { - return sizeFloat32Ptr, appendFloat32Ptr - } - if slice { - if packed { - return sizeFloat32PackedSlice, appendFloat32PackedSlice - } - return sizeFloat32Slice, appendFloat32Slice - } - if nozero { - return sizeFloat32ValueNoZero, appendFloat32ValueNoZero - } - return sizeFloat32Value, appendFloat32Value - case reflect.Float64: - if pointer { - return sizeFloat64Ptr, appendFloat64Ptr - } - if slice { - if packed { - return sizeFloat64PackedSlice, appendFloat64PackedSlice - } - return sizeFloat64Slice, appendFloat64Slice - } - if nozero { - return sizeFloat64ValueNoZero, appendFloat64ValueNoZero - } - return sizeFloat64Value, appendFloat64Value - case reflect.String: - if validateUTF8 { - if pointer { - return sizeStringPtr, appendUTF8StringPtr - } - if slice { - return sizeStringSlice, appendUTF8StringSlice - } - if nozero { - return sizeStringValueNoZero, appendUTF8StringValueNoZero - } - return sizeStringValue, appendUTF8StringValue - } - if pointer { - return sizeStringPtr, appendStringPtr - } - if slice { - return sizeStringSlice, appendStringSlice - } - if nozero { - return sizeStringValueNoZero, appendStringValueNoZero - } - return sizeStringValue, appendStringValue - case reflect.Slice: - if slice { - return sizeBytesSlice, appendBytesSlice - } - if oneof { - // Oneof bytes field may also have "proto3" tag. - // We want to marshal it as a oneof field. Do this - // check before the proto3 check. - return sizeBytesOneof, appendBytesOneof - } - if proto3 { - return sizeBytes3, appendBytes3 - } - return sizeBytes, appendBytes - case reflect.Struct: - switch encoding { - case "group": - if slice { - return makeGroupSliceMarshaler(getMarshalInfo(t)) - } - return makeGroupMarshaler(getMarshalInfo(t)) - case "bytes": - if pointer { - if slice { - return makeMessageSliceMarshaler(getMarshalInfo(t)) - } - return makeMessageMarshaler(getMarshalInfo(t)) - } else { - if slice { - return makeMessageRefSliceMarshaler(getMarshalInfo(t)) - } - return makeMessageRefMarshaler(getMarshalInfo(t)) - } - } - } - panic(fmt.Sprintf("unknown or mismatched type: type: %v, wire type: %v", t, encoding)) -} - -// Below are functions to size/marshal a specific type of a field. -// They are stored in the field's info, and called by function pointers. -// They have type sizer or marshaler. - -func sizeFixed32Value(_ pointer, tagsize int) int { - return 4 + tagsize -} -func sizeFixed32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toUint32() - if v == 0 { - return 0 - } - return 4 + tagsize -} -func sizeFixed32Ptr(ptr pointer, tagsize int) int { - p := *ptr.toUint32Ptr() - if p == nil { - return 0 - } - return 4 + tagsize -} -func sizeFixed32Slice(ptr pointer, tagsize int) int { - s := *ptr.toUint32Slice() - return (4 + tagsize) * len(s) -} -func sizeFixed32PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toUint32Slice() - if len(s) == 0 { - return 0 - } - return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize -} -func sizeFixedS32Value(_ pointer, tagsize int) int { - return 4 + tagsize -} -func sizeFixedS32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - if v == 0 { - return 0 - } - return 4 + tagsize -} -func sizeFixedS32Ptr(ptr pointer, tagsize int) int { - p := ptr.getInt32Ptr() - if p == nil { - return 0 - } - return 4 + tagsize -} -func sizeFixedS32Slice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - return (4 + tagsize) * len(s) -} -func sizeFixedS32PackedSlice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - if len(s) == 0 { - return 0 - } - return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize -} -func sizeFloat32Value(_ pointer, tagsize int) int { - return 4 + tagsize -} -func sizeFloat32ValueNoZero(ptr pointer, tagsize int) int { - v := math.Float32bits(*ptr.toFloat32()) - if v == 0 { - return 0 - } - return 4 + tagsize -} -func sizeFloat32Ptr(ptr pointer, tagsize int) int { - p := *ptr.toFloat32Ptr() - if p == nil { - return 0 - } - return 4 + tagsize -} -func sizeFloat32Slice(ptr pointer, tagsize int) int { - s := *ptr.toFloat32Slice() - return (4 + tagsize) * len(s) -} -func sizeFloat32PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toFloat32Slice() - if len(s) == 0 { - return 0 - } - return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize -} -func sizeFixed64Value(_ pointer, tagsize int) int { - return 8 + tagsize -} -func sizeFixed64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toUint64() - if v == 0 { - return 0 - } - return 8 + tagsize -} -func sizeFixed64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toUint64Ptr() - if p == nil { - return 0 - } - return 8 + tagsize -} -func sizeFixed64Slice(ptr pointer, tagsize int) int { - s := *ptr.toUint64Slice() - return (8 + tagsize) * len(s) -} -func sizeFixed64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toUint64Slice() - if len(s) == 0 { - return 0 - } - return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize -} -func sizeFixedS64Value(_ pointer, tagsize int) int { - return 8 + tagsize -} -func sizeFixedS64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - if v == 0 { - return 0 - } - return 8 + tagsize -} -func sizeFixedS64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toInt64Ptr() - if p == nil { - return 0 - } - return 8 + tagsize -} -func sizeFixedS64Slice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - return (8 + tagsize) * len(s) -} -func sizeFixedS64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return 0 - } - return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize -} -func sizeFloat64Value(_ pointer, tagsize int) int { - return 8 + tagsize -} -func sizeFloat64ValueNoZero(ptr pointer, tagsize int) int { - v := math.Float64bits(*ptr.toFloat64()) - if v == 0 { - return 0 - } - return 8 + tagsize -} -func sizeFloat64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toFloat64Ptr() - if p == nil { - return 0 - } - return 8 + tagsize -} -func sizeFloat64Slice(ptr pointer, tagsize int) int { - s := *ptr.toFloat64Slice() - return (8 + tagsize) * len(s) -} -func sizeFloat64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toFloat64Slice() - if len(s) == 0 { - return 0 - } - return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize -} -func sizeVarint32Value(ptr pointer, tagsize int) int { - v := *ptr.toUint32() - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarint32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toUint32() - if v == 0 { - return 0 - } - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarint32Ptr(ptr pointer, tagsize int) int { - p := *ptr.toUint32Ptr() - if p == nil { - return 0 - } - return SizeVarint(uint64(*p)) + tagsize -} -func sizeVarint32Slice(ptr pointer, tagsize int) int { - s := *ptr.toUint32Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) + tagsize - } - return n -} -func sizeVarint32PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toUint32Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeVarintS32Value(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarintS32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - if v == 0 { - return 0 - } - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarintS32Ptr(ptr pointer, tagsize int) int { - p := ptr.getInt32Ptr() - if p == nil { - return 0 - } - return SizeVarint(uint64(*p)) + tagsize -} -func sizeVarintS32Slice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) + tagsize - } - return n -} -func sizeVarintS32PackedSlice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeVarint64Value(ptr pointer, tagsize int) int { - v := *ptr.toUint64() - return SizeVarint(v) + tagsize -} -func sizeVarint64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toUint64() - if v == 0 { - return 0 - } - return SizeVarint(v) + tagsize -} -func sizeVarint64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toUint64Ptr() - if p == nil { - return 0 - } - return SizeVarint(*p) + tagsize -} -func sizeVarint64Slice(ptr pointer, tagsize int) int { - s := *ptr.toUint64Slice() - n := 0 - for _, v := range s { - n += SizeVarint(v) + tagsize - } - return n -} -func sizeVarint64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toUint64Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(v) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeVarintS64Value(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarintS64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - if v == 0 { - return 0 - } - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarintS64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toInt64Ptr() - if p == nil { - return 0 - } - return SizeVarint(uint64(*p)) + tagsize -} -func sizeVarintS64Slice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) + tagsize - } - return n -} -func sizeVarintS64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeZigzag32Value(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize -} -func sizeZigzag32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - if v == 0 { - return 0 - } - return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize -} -func sizeZigzag32Ptr(ptr pointer, tagsize int) int { - p := ptr.getInt32Ptr() - if p == nil { - return 0 - } - v := *p - return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize -} -func sizeZigzag32Slice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize - } - return n -} -func sizeZigzag32PackedSlice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31)))) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeZigzag64Value(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize -} -func sizeZigzag64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - if v == 0 { - return 0 - } - return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize -} -func sizeZigzag64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toInt64Ptr() - if p == nil { - return 0 - } - v := *p - return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize -} -func sizeZigzag64Slice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize - } - return n -} -func sizeZigzag64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v<<1) ^ uint64((int64(v) >> 63))) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeBoolValue(_ pointer, tagsize int) int { - return 1 + tagsize -} -func sizeBoolValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toBool() - if !v { - return 0 - } - return 1 + tagsize -} -func sizeBoolPtr(ptr pointer, tagsize int) int { - p := *ptr.toBoolPtr() - if p == nil { - return 0 - } - return 1 + tagsize -} -func sizeBoolSlice(ptr pointer, tagsize int) int { - s := *ptr.toBoolSlice() - return (1 + tagsize) * len(s) -} -func sizeBoolPackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toBoolSlice() - if len(s) == 0 { - return 0 - } - return len(s) + SizeVarint(uint64(len(s))) + tagsize -} -func sizeStringValue(ptr pointer, tagsize int) int { - v := *ptr.toString() - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeStringValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toString() - if v == "" { - return 0 - } - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeStringPtr(ptr pointer, tagsize int) int { - p := *ptr.toStringPtr() - if p == nil { - return 0 - } - v := *p - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeStringSlice(ptr pointer, tagsize int) int { - s := *ptr.toStringSlice() - n := 0 - for _, v := range s { - n += len(v) + SizeVarint(uint64(len(v))) + tagsize - } - return n -} -func sizeBytes(ptr pointer, tagsize int) int { - v := *ptr.toBytes() - if v == nil { - return 0 - } - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeBytes3(ptr pointer, tagsize int) int { - v := *ptr.toBytes() - if len(v) == 0 { - return 0 - } - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeBytesOneof(ptr pointer, tagsize int) int { - v := *ptr.toBytes() - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeBytesSlice(ptr pointer, tagsize int) int { - s := *ptr.toBytesSlice() - n := 0 - for _, v := range s { - n += len(v) + SizeVarint(uint64(len(v))) + tagsize - } - return n -} - -// appendFixed32 appends an encoded fixed32 to b. -func appendFixed32(b []byte, v uint32) []byte { - b = append(b, - byte(v), - byte(v>>8), - byte(v>>16), - byte(v>>24)) - return b -} - -// appendFixed64 appends an encoded fixed64 to b. -func appendFixed64(b []byte, v uint64) []byte { - b = append(b, - byte(v), - byte(v>>8), - byte(v>>16), - byte(v>>24), - byte(v>>32), - byte(v>>40), - byte(v>>48), - byte(v>>56)) - return b -} - -// appendVarint appends an encoded varint to b. -func appendVarint(b []byte, v uint64) []byte { - // TODO: make 1-byte (maybe 2-byte) case inline-able, once we - // have non-leaf inliner. - switch { - case v < 1<<7: - b = append(b, byte(v)) - case v < 1<<14: - b = append(b, - byte(v&0x7f|0x80), - byte(v>>7)) - case v < 1<<21: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte(v>>14)) - case v < 1<<28: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte(v>>21)) - case v < 1<<35: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte(v>>28)) - case v < 1<<42: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte(v>>35)) - case v < 1<<49: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte(v>>42)) - case v < 1<<56: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte((v>>42)&0x7f|0x80), - byte(v>>49)) - case v < 1<<63: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte((v>>42)&0x7f|0x80), - byte((v>>49)&0x7f|0x80), - byte(v>>56)) - default: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte((v>>42)&0x7f|0x80), - byte((v>>49)&0x7f|0x80), - byte((v>>56)&0x7f|0x80), - 1) - } - return b -} - -func appendFixed32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint32() - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - return b, nil -} -func appendFixed32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - return b, nil -} -func appendFixed32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toUint32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, *p) - return b, nil -} -func appendFixed32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - } - return b, nil -} -func appendFixed32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(4*len(s))) - for _, v := range s { - b = appendFixed32(b, v) - } - return b, nil -} -func appendFixedS32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - b = appendVarint(b, wiretag) - b = appendFixed32(b, uint32(v)) - return b, nil -} -func appendFixedS32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, uint32(v)) - return b, nil -} -func appendFixedS32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := ptr.getInt32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, uint32(*p)) - return b, nil -} -func appendFixedS32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed32(b, uint32(v)) - } - return b, nil -} -func appendFixedS32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(4*len(s))) - for _, v := range s { - b = appendFixed32(b, uint32(v)) - } - return b, nil -} -func appendFloat32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := math.Float32bits(*ptr.toFloat32()) - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - return b, nil -} -func appendFloat32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := math.Float32bits(*ptr.toFloat32()) - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - return b, nil -} -func appendFloat32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toFloat32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, math.Float32bits(*p)) - return b, nil -} -func appendFloat32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toFloat32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed32(b, math.Float32bits(v)) - } - return b, nil -} -func appendFloat32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toFloat32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(4*len(s))) - for _, v := range s { - b = appendFixed32(b, math.Float32bits(v)) - } - return b, nil -} -func appendFixed64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint64() - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - return b, nil -} -func appendFixed64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - return b, nil -} -func appendFixed64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toUint64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, *p) - return b, nil -} -func appendFixed64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - } - return b, nil -} -func appendFixed64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(8*len(s))) - for _, v := range s { - b = appendFixed64(b, v) - } - return b, nil -} -func appendFixedS64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - b = appendVarint(b, wiretag) - b = appendFixed64(b, uint64(v)) - return b, nil -} -func appendFixedS64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, uint64(v)) - return b, nil -} -func appendFixedS64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toInt64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, uint64(*p)) - return b, nil -} -func appendFixedS64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed64(b, uint64(v)) - } - return b, nil -} -func appendFixedS64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(8*len(s))) - for _, v := range s { - b = appendFixed64(b, uint64(v)) - } - return b, nil -} -func appendFloat64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := math.Float64bits(*ptr.toFloat64()) - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - return b, nil -} -func appendFloat64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := math.Float64bits(*ptr.toFloat64()) - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - return b, nil -} -func appendFloat64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toFloat64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, math.Float64bits(*p)) - return b, nil -} -func appendFloat64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toFloat64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed64(b, math.Float64bits(v)) - } - return b, nil -} -func appendFloat64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toFloat64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(8*len(s))) - for _, v := range s { - b = appendFixed64(b, math.Float64bits(v)) - } - return b, nil -} -func appendVarint32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint32() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarint32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarint32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toUint32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(*p)) - return b, nil -} -func appendVarint32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarint32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarintS32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarintS32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarintS32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := ptr.getInt32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(*p)) - return b, nil -} -func appendVarintS32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarintS32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarint64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint64() - b = appendVarint(b, wiretag) - b = appendVarint(b, v) - return b, nil -} -func appendVarint64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, v) - return b, nil -} -func appendVarint64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toUint64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, *p) - return b, nil -} -func appendVarint64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, v) - } - return b, nil -} -func appendVarint64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(v) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, v) - } - return b, nil -} -func appendVarintS64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarintS64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarintS64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toInt64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(*p)) - return b, nil -} -func appendVarintS64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarintS64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendZigzag32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - return b, nil -} -func appendZigzag32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - return b, nil -} -func appendZigzag32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := ptr.getInt32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - v := *p - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - return b, nil -} -func appendZigzag32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - } - return b, nil -} -func appendZigzag32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31)))) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - } - return b, nil -} -func appendZigzag64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - return b, nil -} -func appendZigzag64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - return b, nil -} -func appendZigzag64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toInt64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - v := *p - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - return b, nil -} -func appendZigzag64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - } - return b, nil -} -func appendZigzag64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v<<1) ^ uint64((int64(v) >> 63))) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - } - return b, nil -} -func appendBoolValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBool() - b = appendVarint(b, wiretag) - if v { - b = append(b, 1) - } else { - b = append(b, 0) - } - return b, nil -} -func appendBoolValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBool() - if !v { - return b, nil - } - b = appendVarint(b, wiretag) - b = append(b, 1) - return b, nil -} - -func appendBoolPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toBoolPtr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - if *p { - b = append(b, 1) - } else { - b = append(b, 0) - } - return b, nil -} -func appendBoolSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toBoolSlice() - for _, v := range s { - b = appendVarint(b, wiretag) - if v { - b = append(b, 1) - } else { - b = append(b, 0) - } - } - return b, nil -} -func appendBoolPackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toBoolSlice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(len(s))) - for _, v := range s { - if v { - b = append(b, 1) - } else { - b = append(b, 0) - } - } - return b, nil -} -func appendStringValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toString() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendStringValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toString() - if v == "" { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendStringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toStringPtr() - if p == nil { - return b, nil - } - v := *p - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendStringSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toStringSlice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - } - return b, nil -} -func appendUTF8StringValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - var invalidUTF8 bool - v := *ptr.toString() - if !utf8.ValidString(v) { - invalidUTF8 = true - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - if invalidUTF8 { - return b, errInvalidUTF8 - } - return b, nil -} -func appendUTF8StringValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - var invalidUTF8 bool - v := *ptr.toString() - if v == "" { - return b, nil - } - if !utf8.ValidString(v) { - invalidUTF8 = true - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - if invalidUTF8 { - return b, errInvalidUTF8 - } - return b, nil -} -func appendUTF8StringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - var invalidUTF8 bool - p := *ptr.toStringPtr() - if p == nil { - return b, nil - } - v := *p - if !utf8.ValidString(v) { - invalidUTF8 = true - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - if invalidUTF8 { - return b, errInvalidUTF8 - } - return b, nil -} -func appendUTF8StringSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - var invalidUTF8 bool - s := *ptr.toStringSlice() - for _, v := range s { - if !utf8.ValidString(v) { - invalidUTF8 = true - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - } - if invalidUTF8 { - return b, errInvalidUTF8 - } - return b, nil -} -func appendBytes(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBytes() - if v == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendBytes3(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBytes() - if len(v) == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendBytesOneof(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBytes() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendBytesSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toBytesSlice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - } - return b, nil -} - -// makeGroupMarshaler returns the sizer and marshaler for a group. -// u is the marshal info of the underlying message. -func makeGroupMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - p := ptr.getPointer() - if p.isNil() { - return 0 - } - return u.size(p) + 2*tagsize - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - p := ptr.getPointer() - if p.isNil() { - return b, nil - } - var err error - b = appendVarint(b, wiretag) // start group - b, err = u.marshal(b, p, deterministic) - b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group - return b, err - } -} - -// makeGroupSliceMarshaler returns the sizer and marshaler for a group slice. -// u is the marshal info of the underlying message. -func makeGroupSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getPointerSlice() - n := 0 - for _, v := range s { - if v.isNil() { - continue - } - n += u.size(v) + 2*tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getPointerSlice() - var err error - var nerr nonFatal - for _, v := range s { - if v.isNil() { - return b, errRepeatedHasNil - } - b = appendVarint(b, wiretag) // start group - b, err = u.marshal(b, v, deterministic) - b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group - if !nerr.Merge(err) { - if err == ErrNil { - err = errRepeatedHasNil - } - return b, err - } - } - return b, nerr.E - } -} - -// makeMessageMarshaler returns the sizer and marshaler for a message field. -// u is the marshal info of the message. -func makeMessageMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - p := ptr.getPointer() - if p.isNil() { - return 0 - } - siz := u.size(p) - return siz + SizeVarint(uint64(siz)) + tagsize - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - p := ptr.getPointer() - if p.isNil() { - return b, nil - } - b = appendVarint(b, wiretag) - siz := u.cachedsize(p) - b = appendVarint(b, uint64(siz)) - return u.marshal(b, p, deterministic) - } -} - -// makeMessageSliceMarshaler returns the sizer and marshaler for a message slice. -// u is the marshal info of the message. -func makeMessageSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getPointerSlice() - n := 0 - for _, v := range s { - if v.isNil() { - continue - } - siz := u.size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getPointerSlice() - var err error - var nerr nonFatal - for _, v := range s { - if v.isNil() { - return b, errRepeatedHasNil - } - b = appendVarint(b, wiretag) - siz := u.cachedsize(v) - b = appendVarint(b, uint64(siz)) - b, err = u.marshal(b, v, deterministic) - - if !nerr.Merge(err) { - if err == ErrNil { - err = errRepeatedHasNil - } - return b, err - } - } - return b, nerr.E - } -} - -// makeMapMarshaler returns the sizer and marshaler for a map field. -// f is the pointer to the reflect data structure of the field. -func makeMapMarshaler(f *reflect.StructField) (sizer, marshaler) { - // figure out key and value type - t := f.Type - keyType := t.Key() - valType := t.Elem() - tags := strings.Split(f.Tag.Get("protobuf"), ",") - keyTags := strings.Split(f.Tag.Get("protobuf_key"), ",") - valTags := strings.Split(f.Tag.Get("protobuf_val"), ",") - stdOptions := false - for _, t := range tags { - if strings.HasPrefix(t, "customtype=") { - valTags = append(valTags, t) - } - if t == "stdtime" { - valTags = append(valTags, t) - stdOptions = true - } - if t == "stdduration" { - valTags = append(valTags, t) - stdOptions = true - } - if t == "wktptr" { - valTags = append(valTags, t) - } - } - keySizer, keyMarshaler := typeMarshaler(keyType, keyTags, false, false) // don't omit zero value in map - valSizer, valMarshaler := typeMarshaler(valType, valTags, false, false) // don't omit zero value in map - keyWireTag := 1<<3 | wiretype(keyTags[0]) - valWireTag := 2<<3 | wiretype(valTags[0]) - - // We create an interface to get the addresses of the map key and value. - // If value is pointer-typed, the interface is a direct interface, the - // idata itself is the value. Otherwise, the idata is the pointer to the - // value. - // Key cannot be pointer-typed. - valIsPtr := valType.Kind() == reflect.Ptr - - // If value is a message with nested maps, calling - // valSizer in marshal may be quadratic. We should use - // cached version in marshal (but not in size). - // If value is not message type, we don't have size cache, - // but it cannot be nested either. Just use valSizer. - valCachedSizer := valSizer - if valIsPtr && !stdOptions && valType.Elem().Kind() == reflect.Struct { - u := getMarshalInfo(valType.Elem()) - valCachedSizer = func(ptr pointer, tagsize int) int { - // Same as message sizer, but use cache. - p := ptr.getPointer() - if p.isNil() { - return 0 - } - siz := u.cachedsize(p) - return siz + SizeVarint(uint64(siz)) + tagsize - } - } - return func(ptr pointer, tagsize int) int { - m := ptr.asPointerTo(t).Elem() // the map - n := 0 - for _, k := range m.MapKeys() { - ki := k.Interface() - vi := m.MapIndex(k).Interface() - kaddr := toAddrPointer(&ki, false) // pointer to key - vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value - siz := keySizer(kaddr, 1) + valSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, tag uint64, deterministic bool) ([]byte, error) { - m := ptr.asPointerTo(t).Elem() // the map - var err error - keys := m.MapKeys() - if len(keys) > 1 && deterministic { - sort.Sort(mapKeys(keys)) - } - - var nerr nonFatal - for _, k := range keys { - ki := k.Interface() - vi := m.MapIndex(k).Interface() - kaddr := toAddrPointer(&ki, false) // pointer to key - vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value - b = appendVarint(b, tag) - siz := keySizer(kaddr, 1) + valCachedSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1) - b = appendVarint(b, uint64(siz)) - b, err = keyMarshaler(b, kaddr, keyWireTag, deterministic) - if !nerr.Merge(err) { - return b, err - } - b, err = valMarshaler(b, vaddr, valWireTag, deterministic) - if err != ErrNil && !nerr.Merge(err) { // allow nil value in map - return b, err - } - } - return b, nerr.E - } -} - -// makeOneOfMarshaler returns the sizer and marshaler for a oneof field. -// fi is the marshal info of the field. -// f is the pointer to the reflect data structure of the field. -func makeOneOfMarshaler(fi *marshalFieldInfo, f *reflect.StructField) (sizer, marshaler) { - // Oneof field is an interface. We need to get the actual data type on the fly. - t := f.Type - return func(ptr pointer, _ int) int { - p := ptr.getInterfacePointer() - if p.isNil() { - return 0 - } - v := ptr.asPointerTo(t).Elem().Elem().Elem() // *interface -> interface -> *struct -> struct - telem := v.Type() - e := fi.oneofElems[telem] - return e.sizer(p, e.tagsize) - }, - func(b []byte, ptr pointer, _ uint64, deterministic bool) ([]byte, error) { - p := ptr.getInterfacePointer() - if p.isNil() { - return b, nil - } - v := ptr.asPointerTo(t).Elem().Elem().Elem() // *interface -> interface -> *struct -> struct - telem := v.Type() - if telem.Field(0).Type.Kind() == reflect.Ptr && p.getPointer().isNil() { - return b, errOneofHasNil - } - e := fi.oneofElems[telem] - return e.marshaler(b, p, e.wiretag, deterministic) - } -} - -// sizeExtensions computes the size of encoded data for a XXX_InternalExtensions field. -func (u *marshalInfo) sizeExtensions(ext *XXX_InternalExtensions) int { - m, mu := ext.extensionsRead() - if m == nil { - return 0 - } - mu.Lock() - - n := 0 - for _, e := range m { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - n += len(e.enc) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - n += ei.sizer(p, ei.tagsize) - } - mu.Unlock() - return n -} - -// appendExtensions marshals a XXX_InternalExtensions field to the end of byte slice b. -func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) { - m, mu := ext.extensionsRead() - if m == nil { - return b, nil - } - mu.Lock() - defer mu.Unlock() - - var err error - var nerr nonFatal - - // Fast-path for common cases: zero or one extensions. - // Don't bother sorting the keys. - if len(m) <= 1 { - for _, e := range m { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - b = append(b, e.enc...) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, ei.wiretag, deterministic) - if !nerr.Merge(err) { - return b, err - } - } - return b, nerr.E - } - - // Sort the keys to provide a deterministic encoding. - // Not sure this is required, but the old code does it. - keys := make([]int, 0, len(m)) - for k := range m { - keys = append(keys, int(k)) - } - sort.Ints(keys) - - for _, k := range keys { - e := m[int32(k)] - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - b = append(b, e.enc...) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, ei.wiretag, deterministic) - if !nerr.Merge(err) { - return b, err - } - } - return b, nerr.E -} - -// message set format is: -// message MessageSet { -// repeated group Item = 1 { -// required int32 type_id = 2; -// required string message = 3; -// }; -// } - -// sizeMessageSet computes the size of encoded data for a XXX_InternalExtensions field -// in message set format (above). -func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions) int { - m, mu := ext.extensionsRead() - if m == nil { - return 0 - } - mu.Lock() - - n := 0 - for id, e := range m { - n += 2 // start group, end group. tag = 1 (size=1) - n += SizeVarint(uint64(id)) + 1 // type_id, tag = 2 (size=1) - - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint - siz := len(msgWithLen) - n += siz + 1 // message, tag = 3 (size=1) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - n += ei.sizer(p, 1) // message, tag = 3 (size=1) - } - mu.Unlock() - return n -} - -// appendMessageSet marshals a XXX_InternalExtensions field in message set format (above) -// to the end of byte slice b. -func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) { - m, mu := ext.extensionsRead() - if m == nil { - return b, nil - } - mu.Lock() - defer mu.Unlock() - - var err error - var nerr nonFatal - - // Fast-path for common cases: zero or one extensions. - // Don't bother sorting the keys. - if len(m) <= 1 { - for id, e := range m { - b = append(b, 1<<3|WireStartGroup) - b = append(b, 2<<3|WireVarint) - b = appendVarint(b, uint64(id)) - - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint - b = append(b, 3<<3|WireBytes) - b = append(b, msgWithLen...) - b = append(b, 1<<3|WireEndGroup) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) - if !nerr.Merge(err) { - return b, err - } - b = append(b, 1<<3|WireEndGroup) - } - return b, nerr.E - } - - // Sort the keys to provide a deterministic encoding. - keys := make([]int, 0, len(m)) - for k := range m { - keys = append(keys, int(k)) - } - sort.Ints(keys) - - for _, id := range keys { - e := m[int32(id)] - b = append(b, 1<<3|WireStartGroup) - b = append(b, 2<<3|WireVarint) - b = appendVarint(b, uint64(id)) - - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint - b = append(b, 3<<3|WireBytes) - b = append(b, msgWithLen...) - b = append(b, 1<<3|WireEndGroup) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) - b = append(b, 1<<3|WireEndGroup) - if !nerr.Merge(err) { - return b, err - } - } - return b, nerr.E -} - -// sizeV1Extensions computes the size of encoded data for a V1-API extension field. -func (u *marshalInfo) sizeV1Extensions(m map[int32]Extension) int { - if m == nil { - return 0 - } - - n := 0 - for _, e := range m { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - n += len(e.enc) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - n += ei.sizer(p, ei.tagsize) - } - return n -} - -// appendV1Extensions marshals a V1-API extension field to the end of byte slice b. -func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, deterministic bool) ([]byte, error) { - if m == nil { - return b, nil - } - - // Sort the keys to provide a deterministic encoding. - keys := make([]int, 0, len(m)) - for k := range m { - keys = append(keys, int(k)) - } - sort.Ints(keys) - - var err error - var nerr nonFatal - for _, k := range keys { - e := m[int32(k)] - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - b = append(b, e.enc...) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, ei.wiretag, deterministic) - if !nerr.Merge(err) { - return b, err - } - } - return b, nerr.E -} - -// newMarshaler is the interface representing objects that can marshal themselves. -// -// This exists to support protoc-gen-go generated messages. -// The proto package will stop type-asserting to this interface in the future. -// -// DO NOT DEPEND ON THIS. -type newMarshaler interface { - XXX_Size() int - XXX_Marshal(b []byte, deterministic bool) ([]byte, error) -} - -// Size returns the encoded size of a protocol buffer message. -// This is the main entry point. -func Size(pb Message) int { - if m, ok := pb.(newMarshaler); ok { - return m.XXX_Size() - } - if m, ok := pb.(Marshaler); ok { - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - b, _ := m.Marshal() - return len(b) - } - // in case somehow we didn't generate the wrapper - if pb == nil { - return 0 - } - var info InternalMessageInfo - return info.Size(pb) -} - -// Marshal takes a protocol buffer message -// and encodes it into the wire format, returning the data. -// This is the main entry point. -func Marshal(pb Message) ([]byte, error) { - if m, ok := pb.(newMarshaler); ok { - siz := m.XXX_Size() - b := make([]byte, 0, siz) - return m.XXX_Marshal(b, false) - } - if m, ok := pb.(Marshaler); ok { - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - return m.Marshal() - } - // in case somehow we didn't generate the wrapper - if pb == nil { - return nil, ErrNil - } - var info InternalMessageInfo - siz := info.Size(pb) - b := make([]byte, 0, siz) - return info.Marshal(b, pb, false) -} - -// Marshal takes a protocol buffer message -// and encodes it into the wire format, writing the result to the -// Buffer. -// This is an alternative entry point. It is not necessary to use -// a Buffer for most applications. -func (p *Buffer) Marshal(pb Message) error { - var err error - if p.deterministic { - if _, ok := pb.(Marshaler); ok { - return fmt.Errorf("proto: deterministic not supported by the Marshal method of %T", pb) - } - } - if m, ok := pb.(newMarshaler); ok { - siz := m.XXX_Size() - p.grow(siz) // make sure buf has enough capacity - pp := p.buf[len(p.buf) : len(p.buf) : len(p.buf)+siz] - pp, err = m.XXX_Marshal(pp, p.deterministic) - p.buf = append(p.buf, pp...) - return err - } - if m, ok := pb.(Marshaler); ok { - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - var b []byte - b, err = m.Marshal() - p.buf = append(p.buf, b...) - return err - } - // in case somehow we didn't generate the wrapper - if pb == nil { - return ErrNil - } - var info InternalMessageInfo - siz := info.Size(pb) - p.grow(siz) // make sure buf has enough capacity - p.buf, err = info.Marshal(p.buf, pb, p.deterministic) - return err -} - -// grow grows the buffer's capacity, if necessary, to guarantee space for -// another n bytes. After grow(n), at least n bytes can be written to the -// buffer without another allocation. -func (p *Buffer) grow(n int) { - need := len(p.buf) + n - if need <= cap(p.buf) { - return - } - newCap := len(p.buf) * 2 - if newCap < need { - newCap = need - } - p.buf = append(make([]byte, 0, newCap), p.buf...) -} diff --git a/vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go b/vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go deleted file mode 100644 index 997f57c1e..000000000 --- a/vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go +++ /dev/null @@ -1,388 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/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. -// -// 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 proto - -import ( - "reflect" - "time" -) - -// makeMessageRefMarshaler differs a bit from makeMessageMarshaler -// It marshal a message T instead of a *T -func makeMessageRefMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - siz := u.size(ptr) - return siz + SizeVarint(uint64(siz)) + tagsize - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - b = appendVarint(b, wiretag) - siz := u.cachedsize(ptr) - b = appendVarint(b, uint64(siz)) - return u.marshal(b, ptr, deterministic) - } -} - -// makeMessageRefSliceMarshaler differs quite a lot from makeMessageSliceMarshaler -// It marshals a slice of messages []T instead of []*T -func makeMessageRefSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - e := elem.Interface() - v := toAddrPointer(&e, false) - siz := u.size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - var err, errreq error - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - e := elem.Interface() - v := toAddrPointer(&e, false) - b = appendVarint(b, wiretag) - siz := u.size(v) - b = appendVarint(b, uint64(siz)) - b, err = u.marshal(b, v, deterministic) - - if err != nil { - if _, ok := err.(*RequiredNotSetError); ok { - // Required field in submessage is not set. - // We record the error but keep going, to give a complete marshaling. - if errreq == nil { - errreq = err - } - continue - } - if err == ErrNil { - err = errRepeatedHasNil - } - return b, err - } - } - - return b, errreq - } -} - -func makeCustomPtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - m := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(custom) - siz := m.Size() - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - m := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(custom) - siz := m.Size() - buf, err := m.Marshal() - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - return b, nil - } -} - -func makeCustomMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - m := ptr.asPointerTo(u.typ).Interface().(custom) - siz := m.Size() - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - m := ptr.asPointerTo(u.typ).Interface().(custom) - siz := m.Size() - buf, err := m.Marshal() - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - return b, nil - } -} - -func makeTimeMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*time.Time) - ts, err := timestampProto(*t) - if err != nil { - return 0 - } - siz := Size(ts) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*time.Time) - ts, err := timestampProto(*t) - if err != nil { - return nil, err - } - buf, err := Marshal(ts) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeTimePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Time) - ts, err := timestampProto(*t) - if err != nil { - return 0 - } - siz := Size(ts) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Time) - ts, err := timestampProto(*t) - if err != nil { - return nil, err - } - buf, err := Marshal(ts) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeTimeSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(time.Time) - ts, err := timestampProto(t) - if err != nil { - return 0 - } - siz := Size(ts) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(time.Time) - ts, err := timestampProto(t) - if err != nil { - return nil, err - } - siz := Size(ts) - buf, err := Marshal(ts) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeTimePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*time.Time) - ts, err := timestampProto(*t) - if err != nil { - return 0 - } - siz := Size(ts) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*time.Time) - ts, err := timestampProto(*t) - if err != nil { - return nil, err - } - siz := Size(ts) - buf, err := Marshal(ts) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeDurationMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - d := ptr.asPointerTo(u.typ).Interface().(*time.Duration) - dur := durationProto(*d) - siz := Size(dur) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - d := ptr.asPointerTo(u.typ).Interface().(*time.Duration) - dur := durationProto(*d) - buf, err := Marshal(dur) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeDurationPtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - d := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Duration) - dur := durationProto(*d) - siz := Size(dur) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - d := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Duration) - dur := durationProto(*d) - buf, err := Marshal(dur) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeDurationSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - d := elem.Interface().(time.Duration) - dur := durationProto(d) - siz := Size(dur) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - d := elem.Interface().(time.Duration) - dur := durationProto(d) - siz := Size(dur) - buf, err := Marshal(dur) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeDurationPtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - d := elem.Interface().(*time.Duration) - dur := durationProto(*d) - siz := Size(dur) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - d := elem.Interface().(*time.Duration) - dur := durationProto(*d) - siz := Size(dur) - buf, err := Marshal(dur) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} diff --git a/vendor/github.com/gogo/protobuf/proto/table_merge.go b/vendor/github.com/gogo/protobuf/proto/table_merge.go deleted file mode 100644 index 60dcf70d1..000000000 --- a/vendor/github.com/gogo/protobuf/proto/table_merge.go +++ /dev/null @@ -1,676 +0,0 @@ -// 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 proto - -import ( - "fmt" - "reflect" - "strings" - "sync" - "sync/atomic" -) - -// Merge merges the src message into dst. -// This assumes that dst and src of the same type and are non-nil. -func (a *InternalMessageInfo) Merge(dst, src Message) { - mi := atomicLoadMergeInfo(&a.merge) - if mi == nil { - mi = getMergeInfo(reflect.TypeOf(dst).Elem()) - atomicStoreMergeInfo(&a.merge, mi) - } - mi.merge(toPointer(&dst), toPointer(&src)) -} - -type mergeInfo struct { - typ reflect.Type - - initialized int32 // 0: only typ is valid, 1: everything is valid - lock sync.Mutex - - fields []mergeFieldInfo - unrecognized field // Offset of XXX_unrecognized -} - -type mergeFieldInfo struct { - field field // Offset of field, guaranteed to be valid - - // isPointer reports whether the value in the field is a pointer. - // This is true for the following situations: - // * Pointer to struct - // * Pointer to basic type (proto2 only) - // * Slice (first value in slice header is a pointer) - // * String (first value in string header is a pointer) - isPointer bool - - // basicWidth reports the width of the field assuming that it is directly - // embedded in the struct (as is the case for basic types in proto3). - // The possible values are: - // 0: invalid - // 1: bool - // 4: int32, uint32, float32 - // 8: int64, uint64, float64 - basicWidth int - - // Where dst and src are pointers to the types being merged. - merge func(dst, src pointer) -} - -var ( - mergeInfoMap = map[reflect.Type]*mergeInfo{} - mergeInfoLock sync.Mutex -) - -func getMergeInfo(t reflect.Type) *mergeInfo { - mergeInfoLock.Lock() - defer mergeInfoLock.Unlock() - mi := mergeInfoMap[t] - if mi == nil { - mi = &mergeInfo{typ: t} - mergeInfoMap[t] = mi - } - return mi -} - -// merge merges src into dst assuming they are both of type *mi.typ. -func (mi *mergeInfo) merge(dst, src pointer) { - if dst.isNil() { - panic("proto: nil destination") - } - if src.isNil() { - return // Nothing to do. - } - - if atomic.LoadInt32(&mi.initialized) == 0 { - mi.computeMergeInfo() - } - - for _, fi := range mi.fields { - sfp := src.offset(fi.field) - - // As an optimization, we can avoid the merge function call cost - // if we know for sure that the source will have no effect - // by checking if it is the zero value. - if unsafeAllowed { - if fi.isPointer && sfp.getPointer().isNil() { // Could be slice or string - continue - } - if fi.basicWidth > 0 { - switch { - case fi.basicWidth == 1 && !*sfp.toBool(): - continue - case fi.basicWidth == 4 && *sfp.toUint32() == 0: - continue - case fi.basicWidth == 8 && *sfp.toUint64() == 0: - continue - } - } - } - - dfp := dst.offset(fi.field) - fi.merge(dfp, sfp) - } - - // TODO: Make this faster? - out := dst.asPointerTo(mi.typ).Elem() - in := src.asPointerTo(mi.typ).Elem() - if emIn, err := extendable(in.Addr().Interface()); err == nil { - emOut, _ := extendable(out.Addr().Interface()) - mIn, muIn := emIn.extensionsRead() - if mIn != nil { - mOut := emOut.extensionsWrite() - muIn.Lock() - mergeExtension(mOut, mIn) - muIn.Unlock() - } - } - - if mi.unrecognized.IsValid() { - if b := *src.offset(mi.unrecognized).toBytes(); len(b) > 0 { - *dst.offset(mi.unrecognized).toBytes() = append([]byte(nil), b...) - } - } -} - -func (mi *mergeInfo) computeMergeInfo() { - mi.lock.Lock() - defer mi.lock.Unlock() - if mi.initialized != 0 { - return - } - t := mi.typ - n := t.NumField() - - props := GetProperties(t) - for i := 0; i < n; i++ { - f := t.Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - - mfi := mergeFieldInfo{field: toField(&f)} - tf := f.Type - - // As an optimization, we can avoid the merge function call cost - // if we know for sure that the source will have no effect - // by checking if it is the zero value. - if unsafeAllowed { - switch tf.Kind() { - case reflect.Ptr, reflect.Slice, reflect.String: - // As a special case, we assume slices and strings are pointers - // since we know that the first field in the SliceSlice or - // StringHeader is a data pointer. - mfi.isPointer = true - case reflect.Bool: - mfi.basicWidth = 1 - case reflect.Int32, reflect.Uint32, reflect.Float32: - mfi.basicWidth = 4 - case reflect.Int64, reflect.Uint64, reflect.Float64: - mfi.basicWidth = 8 - } - } - - // Unwrap tf to get at its most basic type. - var isPointer, isSlice bool - if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { - isSlice = true - tf = tf.Elem() - } - if tf.Kind() == reflect.Ptr { - isPointer = true - tf = tf.Elem() - } - if isPointer && isSlice && tf.Kind() != reflect.Struct { - panic("both pointer and slice for basic type in " + tf.Name()) - } - - switch tf.Kind() { - case reflect.Int32: - switch { - case isSlice: // E.g., []int32 - mfi.merge = func(dst, src pointer) { - // NOTE: toInt32Slice is not defined (see pointer_reflect.go). - /* - sfsp := src.toInt32Slice() - if *sfsp != nil { - dfsp := dst.toInt32Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []int64{} - } - } - */ - sfs := src.getInt32Slice() - if sfs != nil { - dfs := dst.getInt32Slice() - dfs = append(dfs, sfs...) - if dfs == nil { - dfs = []int32{} - } - dst.setInt32Slice(dfs) - } - } - case isPointer: // E.g., *int32 - mfi.merge = func(dst, src pointer) { - // NOTE: toInt32Ptr is not defined (see pointer_reflect.go). - /* - sfpp := src.toInt32Ptr() - if *sfpp != nil { - dfpp := dst.toInt32Ptr() - if *dfpp == nil { - *dfpp = Int32(**sfpp) - } else { - **dfpp = **sfpp - } - } - */ - sfp := src.getInt32Ptr() - if sfp != nil { - dfp := dst.getInt32Ptr() - if dfp == nil { - dst.setInt32Ptr(*sfp) - } else { - *dfp = *sfp - } - } - } - default: // E.g., int32 - mfi.merge = func(dst, src pointer) { - if v := *src.toInt32(); v != 0 { - *dst.toInt32() = v - } - } - } - case reflect.Int64: - switch { - case isSlice: // E.g., []int64 - mfi.merge = func(dst, src pointer) { - sfsp := src.toInt64Slice() - if *sfsp != nil { - dfsp := dst.toInt64Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []int64{} - } - } - } - case isPointer: // E.g., *int64 - mfi.merge = func(dst, src pointer) { - sfpp := src.toInt64Ptr() - if *sfpp != nil { - dfpp := dst.toInt64Ptr() - if *dfpp == nil { - *dfpp = Int64(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., int64 - mfi.merge = func(dst, src pointer) { - if v := *src.toInt64(); v != 0 { - *dst.toInt64() = v - } - } - } - case reflect.Uint32: - switch { - case isSlice: // E.g., []uint32 - mfi.merge = func(dst, src pointer) { - sfsp := src.toUint32Slice() - if *sfsp != nil { - dfsp := dst.toUint32Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []uint32{} - } - } - } - case isPointer: // E.g., *uint32 - mfi.merge = func(dst, src pointer) { - sfpp := src.toUint32Ptr() - if *sfpp != nil { - dfpp := dst.toUint32Ptr() - if *dfpp == nil { - *dfpp = Uint32(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., uint32 - mfi.merge = func(dst, src pointer) { - if v := *src.toUint32(); v != 0 { - *dst.toUint32() = v - } - } - } - case reflect.Uint64: - switch { - case isSlice: // E.g., []uint64 - mfi.merge = func(dst, src pointer) { - sfsp := src.toUint64Slice() - if *sfsp != nil { - dfsp := dst.toUint64Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []uint64{} - } - } - } - case isPointer: // E.g., *uint64 - mfi.merge = func(dst, src pointer) { - sfpp := src.toUint64Ptr() - if *sfpp != nil { - dfpp := dst.toUint64Ptr() - if *dfpp == nil { - *dfpp = Uint64(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., uint64 - mfi.merge = func(dst, src pointer) { - if v := *src.toUint64(); v != 0 { - *dst.toUint64() = v - } - } - } - case reflect.Float32: - switch { - case isSlice: // E.g., []float32 - mfi.merge = func(dst, src pointer) { - sfsp := src.toFloat32Slice() - if *sfsp != nil { - dfsp := dst.toFloat32Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []float32{} - } - } - } - case isPointer: // E.g., *float32 - mfi.merge = func(dst, src pointer) { - sfpp := src.toFloat32Ptr() - if *sfpp != nil { - dfpp := dst.toFloat32Ptr() - if *dfpp == nil { - *dfpp = Float32(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., float32 - mfi.merge = func(dst, src pointer) { - if v := *src.toFloat32(); v != 0 { - *dst.toFloat32() = v - } - } - } - case reflect.Float64: - switch { - case isSlice: // E.g., []float64 - mfi.merge = func(dst, src pointer) { - sfsp := src.toFloat64Slice() - if *sfsp != nil { - dfsp := dst.toFloat64Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []float64{} - } - } - } - case isPointer: // E.g., *float64 - mfi.merge = func(dst, src pointer) { - sfpp := src.toFloat64Ptr() - if *sfpp != nil { - dfpp := dst.toFloat64Ptr() - if *dfpp == nil { - *dfpp = Float64(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., float64 - mfi.merge = func(dst, src pointer) { - if v := *src.toFloat64(); v != 0 { - *dst.toFloat64() = v - } - } - } - case reflect.Bool: - switch { - case isSlice: // E.g., []bool - mfi.merge = func(dst, src pointer) { - sfsp := src.toBoolSlice() - if *sfsp != nil { - dfsp := dst.toBoolSlice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []bool{} - } - } - } - case isPointer: // E.g., *bool - mfi.merge = func(dst, src pointer) { - sfpp := src.toBoolPtr() - if *sfpp != nil { - dfpp := dst.toBoolPtr() - if *dfpp == nil { - *dfpp = Bool(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., bool - mfi.merge = func(dst, src pointer) { - if v := *src.toBool(); v { - *dst.toBool() = v - } - } - } - case reflect.String: - switch { - case isSlice: // E.g., []string - mfi.merge = func(dst, src pointer) { - sfsp := src.toStringSlice() - if *sfsp != nil { - dfsp := dst.toStringSlice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []string{} - } - } - } - case isPointer: // E.g., *string - mfi.merge = func(dst, src pointer) { - sfpp := src.toStringPtr() - if *sfpp != nil { - dfpp := dst.toStringPtr() - if *dfpp == nil { - *dfpp = String(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., string - mfi.merge = func(dst, src pointer) { - if v := *src.toString(); v != "" { - *dst.toString() = v - } - } - } - case reflect.Slice: - isProto3 := props.Prop[i].proto3 - switch { - case isPointer: - panic("bad pointer in byte slice case in " + tf.Name()) - case tf.Elem().Kind() != reflect.Uint8: - panic("bad element kind in byte slice case in " + tf.Name()) - case isSlice: // E.g., [][]byte - mfi.merge = func(dst, src pointer) { - sbsp := src.toBytesSlice() - if *sbsp != nil { - dbsp := dst.toBytesSlice() - for _, sb := range *sbsp { - if sb == nil { - *dbsp = append(*dbsp, nil) - } else { - *dbsp = append(*dbsp, append([]byte{}, sb...)) - } - } - if *dbsp == nil { - *dbsp = [][]byte{} - } - } - } - default: // E.g., []byte - mfi.merge = func(dst, src pointer) { - sbp := src.toBytes() - if *sbp != nil { - dbp := dst.toBytes() - if !isProto3 || len(*sbp) > 0 { - *dbp = append([]byte{}, *sbp...) - } - } - } - } - case reflect.Struct: - switch { - case isSlice && !isPointer: // E.g. []pb.T - mergeInfo := getMergeInfo(tf) - zero := reflect.Zero(tf) - mfi.merge = func(dst, src pointer) { - // TODO: Make this faster? - dstsp := dst.asPointerTo(f.Type) - dsts := dstsp.Elem() - srcs := src.asPointerTo(f.Type).Elem() - for i := 0; i < srcs.Len(); i++ { - dsts = reflect.Append(dsts, zero) - srcElement := srcs.Index(i).Addr() - dstElement := dsts.Index(dsts.Len() - 1).Addr() - mergeInfo.merge(valToPointer(dstElement), valToPointer(srcElement)) - } - if dsts.IsNil() { - dsts = reflect.MakeSlice(f.Type, 0, 0) - } - dstsp.Elem().Set(dsts) - } - case !isPointer: - mergeInfo := getMergeInfo(tf) - mfi.merge = func(dst, src pointer) { - mergeInfo.merge(dst, src) - } - case isSlice: // E.g., []*pb.T - mergeInfo := getMergeInfo(tf) - mfi.merge = func(dst, src pointer) { - sps := src.getPointerSlice() - if sps != nil { - dps := dst.getPointerSlice() - for _, sp := range sps { - var dp pointer - if !sp.isNil() { - dp = valToPointer(reflect.New(tf)) - mergeInfo.merge(dp, sp) - } - dps = append(dps, dp) - } - if dps == nil { - dps = []pointer{} - } - dst.setPointerSlice(dps) - } - } - default: // E.g., *pb.T - mergeInfo := getMergeInfo(tf) - mfi.merge = func(dst, src pointer) { - sp := src.getPointer() - if !sp.isNil() { - dp := dst.getPointer() - if dp.isNil() { - dp = valToPointer(reflect.New(tf)) - dst.setPointer(dp) - } - mergeInfo.merge(dp, sp) - } - } - } - case reflect.Map: - switch { - case isPointer || isSlice: - panic("bad pointer or slice in map case in " + tf.Name()) - default: // E.g., map[K]V - mfi.merge = func(dst, src pointer) { - sm := src.asPointerTo(tf).Elem() - if sm.Len() == 0 { - return - } - dm := dst.asPointerTo(tf).Elem() - if dm.IsNil() { - dm.Set(reflect.MakeMap(tf)) - } - - switch tf.Elem().Kind() { - case reflect.Ptr: // Proto struct (e.g., *T) - for _, key := range sm.MapKeys() { - val := sm.MapIndex(key) - val = reflect.ValueOf(Clone(val.Interface().(Message))) - dm.SetMapIndex(key, val) - } - case reflect.Slice: // E.g. Bytes type (e.g., []byte) - for _, key := range sm.MapKeys() { - val := sm.MapIndex(key) - val = reflect.ValueOf(append([]byte{}, val.Bytes()...)) - dm.SetMapIndex(key, val) - } - default: // Basic type (e.g., string) - for _, key := range sm.MapKeys() { - val := sm.MapIndex(key) - dm.SetMapIndex(key, val) - } - } - } - } - case reflect.Interface: - // Must be oneof field. - switch { - case isPointer || isSlice: - panic("bad pointer or slice in interface case in " + tf.Name()) - default: // E.g., interface{} - // TODO: Make this faster? - mfi.merge = func(dst, src pointer) { - su := src.asPointerTo(tf).Elem() - if !su.IsNil() { - du := dst.asPointerTo(tf).Elem() - typ := su.Elem().Type() - if du.IsNil() || du.Elem().Type() != typ { - du.Set(reflect.New(typ.Elem())) // Initialize interface if empty - } - sv := su.Elem().Elem().Field(0) - if sv.Kind() == reflect.Ptr && sv.IsNil() { - return - } - dv := du.Elem().Elem().Field(0) - if dv.Kind() == reflect.Ptr && dv.IsNil() { - dv.Set(reflect.New(sv.Type().Elem())) // Initialize proto message if empty - } - switch sv.Type().Kind() { - case reflect.Ptr: // Proto struct (e.g., *T) - Merge(dv.Interface().(Message), sv.Interface().(Message)) - case reflect.Slice: // E.g. Bytes type (e.g., []byte) - dv.Set(reflect.ValueOf(append([]byte{}, sv.Bytes()...))) - default: // Basic type (e.g., string) - dv.Set(sv) - } - } - } - } - default: - panic(fmt.Sprintf("merger not found for type:%s", tf)) - } - mi.fields = append(mi.fields, mfi) - } - - mi.unrecognized = invalidField - if f, ok := t.FieldByName("XXX_unrecognized"); ok { - if f.Type != reflect.TypeOf([]byte{}) { - panic("expected XXX_unrecognized to be of type []byte") - } - mi.unrecognized = toField(&f) - } - - atomic.StoreInt32(&mi.initialized, 1) -} diff --git a/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go b/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go deleted file mode 100644 index 937229386..000000000 --- a/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go +++ /dev/null @@ -1,2249 +0,0 @@ -// 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 proto - -import ( - "errors" - "fmt" - "io" - "math" - "reflect" - "strconv" - "strings" - "sync" - "sync/atomic" - "unicode/utf8" -) - -// Unmarshal is the entry point from the generated .pb.go files. -// This function is not intended to be used by non-generated code. -// This function is not subject to any compatibility guarantee. -// msg contains a pointer to a protocol buffer struct. -// b is the data to be unmarshaled into the protocol buffer. -// a is a pointer to a place to store cached unmarshal information. -func (a *InternalMessageInfo) Unmarshal(msg Message, b []byte) error { - // Load the unmarshal information for this message type. - // The atomic load ensures memory consistency. - u := atomicLoadUnmarshalInfo(&a.unmarshal) - if u == nil { - // Slow path: find unmarshal info for msg, update a with it. - u = getUnmarshalInfo(reflect.TypeOf(msg).Elem()) - atomicStoreUnmarshalInfo(&a.unmarshal, u) - } - // Then do the unmarshaling. - err := u.unmarshal(toPointer(&msg), b) - return err -} - -type unmarshalInfo struct { - typ reflect.Type // type of the protobuf struct - - // 0 = only typ field is initialized - // 1 = completely initialized - initialized int32 - lock sync.Mutex // prevents double initialization - dense []unmarshalFieldInfo // fields indexed by tag # - sparse map[uint64]unmarshalFieldInfo // fields indexed by tag # - reqFields []string // names of required fields - reqMask uint64 // 1< 0 { - // Read tag and wire type. - // Special case 1 and 2 byte varints. - var x uint64 - if b[0] < 128 { - x = uint64(b[0]) - b = b[1:] - } else if len(b) >= 2 && b[1] < 128 { - x = uint64(b[0]&0x7f) + uint64(b[1])<<7 - b = b[2:] - } else { - var n int - x, n = decodeVarint(b) - if n == 0 { - return io.ErrUnexpectedEOF - } - b = b[n:] - } - tag := x >> 3 - wire := int(x) & 7 - - // Dispatch on the tag to one of the unmarshal* functions below. - var f unmarshalFieldInfo - if tag < uint64(len(u.dense)) { - f = u.dense[tag] - } else { - f = u.sparse[tag] - } - if fn := f.unmarshal; fn != nil { - var err error - b, err = fn(b, m.offset(f.field), wire) - if err == nil { - reqMask |= f.reqMask - continue - } - if r, ok := err.(*RequiredNotSetError); ok { - // Remember this error, but keep parsing. We need to produce - // a full parse even if a required field is missing. - if errLater == nil { - errLater = r - } - reqMask |= f.reqMask - continue - } - if err != errInternalBadWireType { - if err == errInvalidUTF8 { - if errLater == nil { - fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name - errLater = &invalidUTF8Error{fullName} - } - continue - } - return err - } - // Fragments with bad wire type are treated as unknown fields. - } - - // Unknown tag. - if !u.unrecognized.IsValid() { - // Don't keep unrecognized data; just skip it. - var err error - b, err = skipField(b, wire) - if err != nil { - return err - } - continue - } - // Keep unrecognized data around. - // maybe in extensions, maybe in the unrecognized field. - z := m.offset(u.unrecognized).toBytes() - var emap map[int32]Extension - var e Extension - for _, r := range u.extensionRanges { - if uint64(r.Start) <= tag && tag <= uint64(r.End) { - if u.extensions.IsValid() { - mp := m.offset(u.extensions).toExtensions() - emap = mp.extensionsWrite() - e = emap[int32(tag)] - z = &e.enc - break - } - if u.oldExtensions.IsValid() { - p := m.offset(u.oldExtensions).toOldExtensions() - emap = *p - if emap == nil { - emap = map[int32]Extension{} - *p = emap - } - e = emap[int32(tag)] - z = &e.enc - break - } - if u.bytesExtensions.IsValid() { - z = m.offset(u.bytesExtensions).toBytes() - break - } - panic("no extensions field available") - } - } - // Use wire type to skip data. - var err error - b0 := b - b, err = skipField(b, wire) - if err != nil { - return err - } - *z = encodeVarint(*z, tag<<3|uint64(wire)) - *z = append(*z, b0[:len(b0)-len(b)]...) - - if emap != nil { - emap[int32(tag)] = e - } - } - if reqMask != u.reqMask && errLater == nil { - // A required field of this message is missing. - for _, n := range u.reqFields { - if reqMask&1 == 0 { - errLater = &RequiredNotSetError{n} - } - reqMask >>= 1 - } - } - return errLater -} - -// computeUnmarshalInfo fills in u with information for use -// in unmarshaling protocol buffers of type u.typ. -func (u *unmarshalInfo) computeUnmarshalInfo() { - u.lock.Lock() - defer u.lock.Unlock() - if u.initialized != 0 { - return - } - t := u.typ - n := t.NumField() - - // Set up the "not found" value for the unrecognized byte buffer. - // This is the default for proto3. - u.unrecognized = invalidField - u.extensions = invalidField - u.oldExtensions = invalidField - u.bytesExtensions = invalidField - - // List of the generated type and offset for each oneof field. - type oneofField struct { - ityp reflect.Type // interface type of oneof field - field field // offset in containing message - } - var oneofFields []oneofField - - for i := 0; i < n; i++ { - f := t.Field(i) - if f.Name == "XXX_unrecognized" { - // The byte slice used to hold unrecognized input is special. - if f.Type != reflect.TypeOf(([]byte)(nil)) { - panic("bad type for XXX_unrecognized field: " + f.Type.Name()) - } - u.unrecognized = toField(&f) - continue - } - if f.Name == "XXX_InternalExtensions" { - // Ditto here. - if f.Type != reflect.TypeOf(XXX_InternalExtensions{}) { - panic("bad type for XXX_InternalExtensions field: " + f.Type.Name()) - } - u.extensions = toField(&f) - if f.Tag.Get("protobuf_messageset") == "1" { - u.isMessageSet = true - } - continue - } - if f.Name == "XXX_extensions" { - // An older form of the extensions field. - if f.Type == reflect.TypeOf((map[int32]Extension)(nil)) { - u.oldExtensions = toField(&f) - continue - } else if f.Type == reflect.TypeOf(([]byte)(nil)) { - u.bytesExtensions = toField(&f) - continue - } - panic("bad type for XXX_extensions field: " + f.Type.Name()) - } - if f.Name == "XXX_NoUnkeyedLiteral" || f.Name == "XXX_sizecache" { - continue - } - - oneof := f.Tag.Get("protobuf_oneof") - if oneof != "" { - oneofFields = append(oneofFields, oneofField{f.Type, toField(&f)}) - // The rest of oneof processing happens below. - continue - } - - tags := f.Tag.Get("protobuf") - tagArray := strings.Split(tags, ",") - if len(tagArray) < 2 { - panic("protobuf tag not enough fields in " + t.Name() + "." + f.Name + ": " + tags) - } - tag, err := strconv.Atoi(tagArray[1]) - if err != nil { - panic("protobuf tag field not an integer: " + tagArray[1]) - } - - name := "" - for _, tag := range tagArray[3:] { - if strings.HasPrefix(tag, "name=") { - name = tag[5:] - } - } - - // Extract unmarshaling function from the field (its type and tags). - unmarshal := fieldUnmarshaler(&f) - - // Required field? - var reqMask uint64 - if tagArray[2] == "req" { - bit := len(u.reqFields) - u.reqFields = append(u.reqFields, name) - reqMask = uint64(1) << uint(bit) - // TODO: if we have more than 64 required fields, we end up - // not verifying that all required fields are present. - // Fix this, perhaps using a count of required fields? - } - - // Store the info in the correct slot in the message. - u.setTag(tag, toField(&f), unmarshal, reqMask, name) - } - - // Find any types associated with oneof fields. - // gogo: len(oneofFields) > 0 is needed for embedded oneof messages, without a marshaler and unmarshaler - if len(oneofFields) > 0 { - var oneofImplementers []interface{} - switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { - case oneofFuncsIface: - _, _, _, oneofImplementers = m.XXX_OneofFuncs() - case oneofWrappersIface: - oneofImplementers = m.XXX_OneofWrappers() - } - for _, v := range oneofImplementers { - tptr := reflect.TypeOf(v) // *Msg_X - typ := tptr.Elem() // Msg_X - - f := typ.Field(0) // oneof implementers have one field - baseUnmarshal := fieldUnmarshaler(&f) - tags := strings.Split(f.Tag.Get("protobuf"), ",") - fieldNum, err := strconv.Atoi(tags[1]) - if err != nil { - panic("protobuf tag field not an integer: " + tags[1]) - } - var name string - for _, tag := range tags { - if strings.HasPrefix(tag, "name=") { - name = strings.TrimPrefix(tag, "name=") - break - } - } - - // Find the oneof field that this struct implements. - // Might take O(n^2) to process all of the oneofs, but who cares. - for _, of := range oneofFields { - if tptr.Implements(of.ityp) { - // We have found the corresponding interface for this struct. - // That lets us know where this struct should be stored - // when we encounter it during unmarshaling. - unmarshal := makeUnmarshalOneof(typ, of.ityp, baseUnmarshal) - u.setTag(fieldNum, of.field, unmarshal, 0, name) - } - } - - } - } - - // Get extension ranges, if any. - fn := reflect.Zero(reflect.PtrTo(t)).MethodByName("ExtensionRangeArray") - if fn.IsValid() { - if !u.extensions.IsValid() && !u.oldExtensions.IsValid() && !u.bytesExtensions.IsValid() { - panic("a message with extensions, but no extensions field in " + t.Name()) - } - u.extensionRanges = fn.Call(nil)[0].Interface().([]ExtensionRange) - } - - // Explicitly disallow tag 0. This will ensure we flag an error - // when decoding a buffer of all zeros. Without this code, we - // would decode and skip an all-zero buffer of even length. - // [0 0] is [tag=0/wiretype=varint varint-encoded-0]. - u.setTag(0, zeroField, func(b []byte, f pointer, w int) ([]byte, error) { - return nil, fmt.Errorf("proto: %s: illegal tag 0 (wire type %d)", t, w) - }, 0, "") - - // Set mask for required field check. - u.reqMask = uint64(1)<= 0 && (tag < 16 || tag < 2*n) { // TODO: what are the right numbers here? - for len(u.dense) <= tag { - u.dense = append(u.dense, unmarshalFieldInfo{}) - } - u.dense[tag] = i - return - } - if u.sparse == nil { - u.sparse = map[uint64]unmarshalFieldInfo{} - } - u.sparse[uint64(tag)] = i -} - -// fieldUnmarshaler returns an unmarshaler for the given field. -func fieldUnmarshaler(f *reflect.StructField) unmarshaler { - if f.Type.Kind() == reflect.Map { - return makeUnmarshalMap(f) - } - return typeUnmarshaler(f.Type, f.Tag.Get("protobuf")) -} - -// typeUnmarshaler returns an unmarshaler for the given field type / field tag pair. -func typeUnmarshaler(t reflect.Type, tags string) unmarshaler { - tagArray := strings.Split(tags, ",") - encoding := tagArray[0] - name := "unknown" - ctype := false - isTime := false - isDuration := false - isWktPointer := false - proto3 := false - validateUTF8 := true - for _, tag := range tagArray[3:] { - if strings.HasPrefix(tag, "name=") { - name = tag[5:] - } - if tag == "proto3" { - proto3 = true - } - if strings.HasPrefix(tag, "customtype=") { - ctype = true - } - if tag == "stdtime" { - isTime = true - } - if tag == "stdduration" { - isDuration = true - } - if tag == "wktptr" { - isWktPointer = true - } - } - validateUTF8 = validateUTF8 && proto3 - - // Figure out packaging (pointer, slice, or both) - slice := false - pointer := false - if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 { - slice = true - t = t.Elem() - } - if t.Kind() == reflect.Ptr { - pointer = true - t = t.Elem() - } - - if ctype { - if reflect.PtrTo(t).Implements(customType) { - if slice { - return makeUnmarshalCustomSlice(getUnmarshalInfo(t), name) - } - if pointer { - return makeUnmarshalCustomPtr(getUnmarshalInfo(t), name) - } - return makeUnmarshalCustom(getUnmarshalInfo(t), name) - } else { - panic(fmt.Sprintf("custom type: type: %v, does not implement the proto.custom interface", t)) - } - } - - if isTime { - if pointer { - if slice { - return makeUnmarshalTimePtrSlice(getUnmarshalInfo(t), name) - } - return makeUnmarshalTimePtr(getUnmarshalInfo(t), name) - } - if slice { - return makeUnmarshalTimeSlice(getUnmarshalInfo(t), name) - } - return makeUnmarshalTime(getUnmarshalInfo(t), name) - } - - if isDuration { - if pointer { - if slice { - return makeUnmarshalDurationPtrSlice(getUnmarshalInfo(t), name) - } - return makeUnmarshalDurationPtr(getUnmarshalInfo(t), name) - } - if slice { - return makeUnmarshalDurationSlice(getUnmarshalInfo(t), name) - } - return makeUnmarshalDuration(getUnmarshalInfo(t), name) - } - - if isWktPointer { - switch t.Kind() { - case reflect.Float64: - if pointer { - if slice { - return makeStdDoubleValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdDoubleValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdDoubleValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdDoubleValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.Float32: - if pointer { - if slice { - return makeStdFloatValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdFloatValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdFloatValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdFloatValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.Int64: - if pointer { - if slice { - return makeStdInt64ValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdInt64ValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdInt64ValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdInt64ValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.Uint64: - if pointer { - if slice { - return makeStdUInt64ValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdUInt64ValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdUInt64ValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdUInt64ValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.Int32: - if pointer { - if slice { - return makeStdInt32ValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdInt32ValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdInt32ValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdInt32ValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.Uint32: - if pointer { - if slice { - return makeStdUInt32ValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdUInt32ValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdUInt32ValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdUInt32ValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.Bool: - if pointer { - if slice { - return makeStdBoolValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdBoolValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdBoolValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdBoolValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.String: - if pointer { - if slice { - return makeStdStringValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdStringValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdStringValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdStringValueUnmarshaler(getUnmarshalInfo(t), name) - case uint8SliceType: - if pointer { - if slice { - return makeStdBytesValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdBytesValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdBytesValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdBytesValueUnmarshaler(getUnmarshalInfo(t), name) - default: - panic(fmt.Sprintf("unknown wktpointer type %#v", t)) - } - } - - // We'll never have both pointer and slice for basic types. - if pointer && slice && t.Kind() != reflect.Struct { - panic("both pointer and slice for basic type in " + t.Name()) - } - - switch t.Kind() { - case reflect.Bool: - if pointer { - return unmarshalBoolPtr - } - if slice { - return unmarshalBoolSlice - } - return unmarshalBoolValue - case reflect.Int32: - switch encoding { - case "fixed32": - if pointer { - return unmarshalFixedS32Ptr - } - if slice { - return unmarshalFixedS32Slice - } - return unmarshalFixedS32Value - case "varint": - // this could be int32 or enum - if pointer { - return unmarshalInt32Ptr - } - if slice { - return unmarshalInt32Slice - } - return unmarshalInt32Value - case "zigzag32": - if pointer { - return unmarshalSint32Ptr - } - if slice { - return unmarshalSint32Slice - } - return unmarshalSint32Value - } - case reflect.Int64: - switch encoding { - case "fixed64": - if pointer { - return unmarshalFixedS64Ptr - } - if slice { - return unmarshalFixedS64Slice - } - return unmarshalFixedS64Value - case "varint": - if pointer { - return unmarshalInt64Ptr - } - if slice { - return unmarshalInt64Slice - } - return unmarshalInt64Value - case "zigzag64": - if pointer { - return unmarshalSint64Ptr - } - if slice { - return unmarshalSint64Slice - } - return unmarshalSint64Value - } - case reflect.Uint32: - switch encoding { - case "fixed32": - if pointer { - return unmarshalFixed32Ptr - } - if slice { - return unmarshalFixed32Slice - } - return unmarshalFixed32Value - case "varint": - if pointer { - return unmarshalUint32Ptr - } - if slice { - return unmarshalUint32Slice - } - return unmarshalUint32Value - } - case reflect.Uint64: - switch encoding { - case "fixed64": - if pointer { - return unmarshalFixed64Ptr - } - if slice { - return unmarshalFixed64Slice - } - return unmarshalFixed64Value - case "varint": - if pointer { - return unmarshalUint64Ptr - } - if slice { - return unmarshalUint64Slice - } - return unmarshalUint64Value - } - case reflect.Float32: - if pointer { - return unmarshalFloat32Ptr - } - if slice { - return unmarshalFloat32Slice - } - return unmarshalFloat32Value - case reflect.Float64: - if pointer { - return unmarshalFloat64Ptr - } - if slice { - return unmarshalFloat64Slice - } - return unmarshalFloat64Value - case reflect.Map: - panic("map type in typeUnmarshaler in " + t.Name()) - case reflect.Slice: - if pointer { - panic("bad pointer in slice case in " + t.Name()) - } - if slice { - return unmarshalBytesSlice - } - return unmarshalBytesValue - case reflect.String: - if validateUTF8 { - if pointer { - return unmarshalUTF8StringPtr - } - if slice { - return unmarshalUTF8StringSlice - } - return unmarshalUTF8StringValue - } - if pointer { - return unmarshalStringPtr - } - if slice { - return unmarshalStringSlice - } - return unmarshalStringValue - case reflect.Struct: - // message or group field - if !pointer { - switch encoding { - case "bytes": - if slice { - return makeUnmarshalMessageSlice(getUnmarshalInfo(t), name) - } - return makeUnmarshalMessage(getUnmarshalInfo(t), name) - } - } - switch encoding { - case "bytes": - if slice { - return makeUnmarshalMessageSlicePtr(getUnmarshalInfo(t), name) - } - return makeUnmarshalMessagePtr(getUnmarshalInfo(t), name) - case "group": - if slice { - return makeUnmarshalGroupSlicePtr(getUnmarshalInfo(t), name) - } - return makeUnmarshalGroupPtr(getUnmarshalInfo(t), name) - } - } - panic(fmt.Sprintf("unmarshaler not found type:%s encoding:%s", t, encoding)) -} - -// Below are all the unmarshalers for individual fields of various types. - -func unmarshalInt64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x) - *f.toInt64() = v - return b, nil -} - -func unmarshalInt64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x) - *f.toInt64Ptr() = &v - return b, nil -} - -func unmarshalInt64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x) - s := f.toInt64Slice() - *s = append(*s, v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x) - s := f.toInt64Slice() - *s = append(*s, v) - return b, nil -} - -func unmarshalSint64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x>>1) ^ int64(x)<<63>>63 - *f.toInt64() = v - return b, nil -} - -func unmarshalSint64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x>>1) ^ int64(x)<<63>>63 - *f.toInt64Ptr() = &v - return b, nil -} - -func unmarshalSint64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x>>1) ^ int64(x)<<63>>63 - s := f.toInt64Slice() - *s = append(*s, v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x>>1) ^ int64(x)<<63>>63 - s := f.toInt64Slice() - *s = append(*s, v) - return b, nil -} - -func unmarshalUint64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint64(x) - *f.toUint64() = v - return b, nil -} - -func unmarshalUint64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint64(x) - *f.toUint64Ptr() = &v - return b, nil -} - -func unmarshalUint64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint64(x) - s := f.toUint64Slice() - *s = append(*s, v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint64(x) - s := f.toUint64Slice() - *s = append(*s, v) - return b, nil -} - -func unmarshalInt32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x) - *f.toInt32() = v - return b, nil -} - -func unmarshalInt32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x) - f.setInt32Ptr(v) - return b, nil -} - -func unmarshalInt32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x) - f.appendInt32Slice(v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x) - f.appendInt32Slice(v) - return b, nil -} - -func unmarshalSint32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x>>1) ^ int32(x)<<31>>31 - *f.toInt32() = v - return b, nil -} - -func unmarshalSint32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x>>1) ^ int32(x)<<31>>31 - f.setInt32Ptr(v) - return b, nil -} - -func unmarshalSint32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x>>1) ^ int32(x)<<31>>31 - f.appendInt32Slice(v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x>>1) ^ int32(x)<<31>>31 - f.appendInt32Slice(v) - return b, nil -} - -func unmarshalUint32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint32(x) - *f.toUint32() = v - return b, nil -} - -func unmarshalUint32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint32(x) - *f.toUint32Ptr() = &v - return b, nil -} - -func unmarshalUint32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint32(x) - s := f.toUint32Slice() - *s = append(*s, v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint32(x) - s := f.toUint32Slice() - *s = append(*s, v) - return b, nil -} - -func unmarshalFixed64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - *f.toUint64() = v - return b[8:], nil -} - -func unmarshalFixed64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - *f.toUint64Ptr() = &v - return b[8:], nil -} - -func unmarshalFixed64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - s := f.toUint64Slice() - *s = append(*s, v) - b = b[8:] - } - return res, nil - } - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - s := f.toUint64Slice() - *s = append(*s, v) - return b[8:], nil -} - -func unmarshalFixedS64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 - *f.toInt64() = v - return b[8:], nil -} - -func unmarshalFixedS64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 - *f.toInt64Ptr() = &v - return b[8:], nil -} - -func unmarshalFixedS64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 - s := f.toInt64Slice() - *s = append(*s, v) - b = b[8:] - } - return res, nil - } - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 - s := f.toInt64Slice() - *s = append(*s, v) - return b[8:], nil -} - -func unmarshalFixed32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - *f.toUint32() = v - return b[4:], nil -} - -func unmarshalFixed32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - *f.toUint32Ptr() = &v - return b[4:], nil -} - -func unmarshalFixed32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - s := f.toUint32Slice() - *s = append(*s, v) - b = b[4:] - } - return res, nil - } - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - s := f.toUint32Slice() - *s = append(*s, v) - return b[4:], nil -} - -func unmarshalFixedS32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 - *f.toInt32() = v - return b[4:], nil -} - -func unmarshalFixedS32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 - f.setInt32Ptr(v) - return b[4:], nil -} - -func unmarshalFixedS32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 - f.appendInt32Slice(v) - b = b[4:] - } - return res, nil - } - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 - f.appendInt32Slice(v) - return b[4:], nil -} - -func unmarshalBoolValue(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - // Note: any length varint is allowed, even though any sane - // encoder will use one byte. - // See https://github.com/golang/protobuf/issues/76 - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - // TODO: check if x>1? Tests seem to indicate no. - v := x != 0 - *f.toBool() = v - return b[n:], nil -} - -func unmarshalBoolPtr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - v := x != 0 - *f.toBoolPtr() = &v - return b[n:], nil -} - -func unmarshalBoolSlice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - v := x != 0 - s := f.toBoolSlice() - *s = append(*s, v) - b = b[n:] - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - v := x != 0 - s := f.toBoolSlice() - *s = append(*s, v) - return b[n:], nil -} - -func unmarshalFloat64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) - *f.toFloat64() = v - return b[8:], nil -} - -func unmarshalFloat64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) - *f.toFloat64Ptr() = &v - return b[8:], nil -} - -func unmarshalFloat64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) - s := f.toFloat64Slice() - *s = append(*s, v) - b = b[8:] - } - return res, nil - } - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) - s := f.toFloat64Slice() - *s = append(*s, v) - return b[8:], nil -} - -func unmarshalFloat32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) - *f.toFloat32() = v - return b[4:], nil -} - -func unmarshalFloat32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) - *f.toFloat32Ptr() = &v - return b[4:], nil -} - -func unmarshalFloat32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) - s := f.toFloat32Slice() - *s = append(*s, v) - b = b[4:] - } - return res, nil - } - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) - s := f.toFloat32Slice() - *s = append(*s, v) - return b[4:], nil -} - -func unmarshalStringValue(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - *f.toString() = v - return b[x:], nil -} - -func unmarshalStringPtr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - *f.toStringPtr() = &v - return b[x:], nil -} - -func unmarshalStringSlice(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - s := f.toStringSlice() - *s = append(*s, v) - return b[x:], nil -} - -func unmarshalUTF8StringValue(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - *f.toString() = v - if !utf8.ValidString(v) { - return b[x:], errInvalidUTF8 - } - return b[x:], nil -} - -func unmarshalUTF8StringPtr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - *f.toStringPtr() = &v - if !utf8.ValidString(v) { - return b[x:], errInvalidUTF8 - } - return b[x:], nil -} - -func unmarshalUTF8StringSlice(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - s := f.toStringSlice() - *s = append(*s, v) - if !utf8.ValidString(v) { - return b[x:], errInvalidUTF8 - } - return b[x:], nil -} - -var emptyBuf [0]byte - -func unmarshalBytesValue(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - // The use of append here is a trick which avoids the zeroing - // that would be required if we used a make/copy pair. - // We append to emptyBuf instead of nil because we want - // a non-nil result even when the length is 0. - v := append(emptyBuf[:], b[:x]...) - *f.toBytes() = v - return b[x:], nil -} - -func unmarshalBytesSlice(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := append(emptyBuf[:], b[:x]...) - s := f.toBytesSlice() - *s = append(*s, v) - return b[x:], nil -} - -func makeUnmarshalMessagePtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - // First read the message field to see if something is there. - // The semantics of multiple submessages are weird. Instead of - // the last one winning (as it is for all other fields), multiple - // submessages are merged. - v := f.getPointer() - if v.isNil() { - v = valToPointer(reflect.New(sub.typ)) - f.setPointer(v) - } - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - return b[x:], err - } -} - -func makeUnmarshalMessageSlicePtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := valToPointer(reflect.New(sub.typ)) - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - f.appendPointer(v) - return b[x:], err - } -} - -func makeUnmarshalGroupPtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireStartGroup { - return b, errInternalBadWireType - } - x, y := findEndGroup(b) - if x < 0 { - return nil, io.ErrUnexpectedEOF - } - v := f.getPointer() - if v.isNil() { - v = valToPointer(reflect.New(sub.typ)) - f.setPointer(v) - } - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - return b[y:], err - } -} - -func makeUnmarshalGroupSlicePtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireStartGroup { - return b, errInternalBadWireType - } - x, y := findEndGroup(b) - if x < 0 { - return nil, io.ErrUnexpectedEOF - } - v := valToPointer(reflect.New(sub.typ)) - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - f.appendPointer(v) - return b[y:], err - } -} - -func makeUnmarshalMap(f *reflect.StructField) unmarshaler { - t := f.Type - kt := t.Key() - vt := t.Elem() - tagArray := strings.Split(f.Tag.Get("protobuf"), ",") - valTags := strings.Split(f.Tag.Get("protobuf_val"), ",") - for _, t := range tagArray { - if strings.HasPrefix(t, "customtype=") { - valTags = append(valTags, t) - } - if t == "stdtime" { - valTags = append(valTags, t) - } - if t == "stdduration" { - valTags = append(valTags, t) - } - if t == "wktptr" { - valTags = append(valTags, t) - } - } - unmarshalKey := typeUnmarshaler(kt, f.Tag.Get("protobuf_key")) - unmarshalVal := typeUnmarshaler(vt, strings.Join(valTags, ",")) - return func(b []byte, f pointer, w int) ([]byte, error) { - // The map entry is a submessage. Figure out how big it is. - if w != WireBytes { - return nil, fmt.Errorf("proto: bad wiretype for map field: got %d want %d", w, WireBytes) - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - r := b[x:] // unused data to return - b = b[:x] // data for map entry - - // Note: we could use #keys * #values ~= 200 functions - // to do map decoding without reflection. Probably not worth it. - // Maps will be somewhat slow. Oh well. - - // Read key and value from data. - var nerr nonFatal - k := reflect.New(kt) - v := reflect.New(vt) - for len(b) > 0 { - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - wire := int(x) & 7 - b = b[n:] - - var err error - switch x >> 3 { - case 1: - b, err = unmarshalKey(b, valToPointer(k), wire) - case 2: - b, err = unmarshalVal(b, valToPointer(v), wire) - default: - err = errInternalBadWireType // skip unknown tag - } - - if nerr.Merge(err) { - continue - } - if err != errInternalBadWireType { - return nil, err - } - - // Skip past unknown fields. - b, err = skipField(b, wire) - if err != nil { - return nil, err - } - } - - // Get map, allocate if needed. - m := f.asPointerTo(t).Elem() // an addressable map[K]T - if m.IsNil() { - m.Set(reflect.MakeMap(t)) - } - - // Insert into map. - m.SetMapIndex(k.Elem(), v.Elem()) - - return r, nerr.E - } -} - -// makeUnmarshalOneof makes an unmarshaler for oneof fields. -// for: -// message Msg { -// oneof F { -// int64 X = 1; -// float64 Y = 2; -// } -// } -// typ is the type of the concrete entry for a oneof case (e.g. Msg_X). -// ityp is the interface type of the oneof field (e.g. isMsg_F). -// unmarshal is the unmarshaler for the base type of the oneof case (e.g. int64). -// Note that this function will be called once for each case in the oneof. -func makeUnmarshalOneof(typ, ityp reflect.Type, unmarshal unmarshaler) unmarshaler { - sf := typ.Field(0) - field0 := toField(&sf) - return func(b []byte, f pointer, w int) ([]byte, error) { - // Allocate holder for value. - v := reflect.New(typ) - - // Unmarshal data into holder. - // We unmarshal into the first field of the holder object. - var err error - var nerr nonFatal - b, err = unmarshal(b, valToPointer(v).offset(field0), w) - if !nerr.Merge(err) { - return nil, err - } - - // Write pointer to holder into target field. - f.asPointerTo(ityp).Elem().Set(v) - - return b, nerr.E - } -} - -// Error used by decode internally. -var errInternalBadWireType = errors.New("proto: internal error: bad wiretype") - -// skipField skips past a field of type wire and returns the remaining bytes. -func skipField(b []byte, wire int) ([]byte, error) { - switch wire { - case WireVarint: - _, k := decodeVarint(b) - if k == 0 { - return b, io.ErrUnexpectedEOF - } - b = b[k:] - case WireFixed32: - if len(b) < 4 { - return b, io.ErrUnexpectedEOF - } - b = b[4:] - case WireFixed64: - if len(b) < 8 { - return b, io.ErrUnexpectedEOF - } - b = b[8:] - case WireBytes: - m, k := decodeVarint(b) - if k == 0 || uint64(len(b)-k) < m { - return b, io.ErrUnexpectedEOF - } - b = b[uint64(k)+m:] - case WireStartGroup: - _, i := findEndGroup(b) - if i == -1 { - return b, io.ErrUnexpectedEOF - } - b = b[i:] - default: - return b, fmt.Errorf("proto: can't skip unknown wire type %d", wire) - } - return b, nil -} - -// findEndGroup finds the index of the next EndGroup tag. -// Groups may be nested, so the "next" EndGroup tag is the first -// unpaired EndGroup. -// findEndGroup returns the indexes of the start and end of the EndGroup tag. -// Returns (-1,-1) if it can't find one. -func findEndGroup(b []byte) (int, int) { - depth := 1 - i := 0 - for { - x, n := decodeVarint(b[i:]) - if n == 0 { - return -1, -1 - } - j := i - i += n - switch x & 7 { - case WireVarint: - _, k := decodeVarint(b[i:]) - if k == 0 { - return -1, -1 - } - i += k - case WireFixed32: - if len(b)-4 < i { - return -1, -1 - } - i += 4 - case WireFixed64: - if len(b)-8 < i { - return -1, -1 - } - i += 8 - case WireBytes: - m, k := decodeVarint(b[i:]) - if k == 0 { - return -1, -1 - } - i += k - if uint64(len(b)-i) < m { - return -1, -1 - } - i += int(m) - case WireStartGroup: - depth++ - case WireEndGroup: - depth-- - if depth == 0 { - return j, i - } - default: - return -1, -1 - } - } -} - -// encodeVarint appends a varint-encoded integer to b and returns the result. -func encodeVarint(b []byte, x uint64) []byte { - for x >= 1<<7 { - b = append(b, byte(x&0x7f|0x80)) - x >>= 7 - } - return append(b, byte(x)) -} - -// decodeVarint reads a varint-encoded integer from b. -// Returns the decoded integer and the number of bytes read. -// If there is an error, it returns 0,0. -func decodeVarint(b []byte) (uint64, int) { - var x, y uint64 - if len(b) == 0 { - goto bad - } - x = uint64(b[0]) - if x < 0x80 { - return x, 1 - } - x -= 0x80 - - if len(b) <= 1 { - goto bad - } - y = uint64(b[1]) - x += y << 7 - if y < 0x80 { - return x, 2 - } - x -= 0x80 << 7 - - if len(b) <= 2 { - goto bad - } - y = uint64(b[2]) - x += y << 14 - if y < 0x80 { - return x, 3 - } - x -= 0x80 << 14 - - if len(b) <= 3 { - goto bad - } - y = uint64(b[3]) - x += y << 21 - if y < 0x80 { - return x, 4 - } - x -= 0x80 << 21 - - if len(b) <= 4 { - goto bad - } - y = uint64(b[4]) - x += y << 28 - if y < 0x80 { - return x, 5 - } - x -= 0x80 << 28 - - if len(b) <= 5 { - goto bad - } - y = uint64(b[5]) - x += y << 35 - if y < 0x80 { - return x, 6 - } - x -= 0x80 << 35 - - if len(b) <= 6 { - goto bad - } - y = uint64(b[6]) - x += y << 42 - if y < 0x80 { - return x, 7 - } - x -= 0x80 << 42 - - if len(b) <= 7 { - goto bad - } - y = uint64(b[7]) - x += y << 49 - if y < 0x80 { - return x, 8 - } - x -= 0x80 << 49 - - if len(b) <= 8 { - goto bad - } - y = uint64(b[8]) - x += y << 56 - if y < 0x80 { - return x, 9 - } - x -= 0x80 << 56 - - if len(b) <= 9 { - goto bad - } - y = uint64(b[9]) - x += y << 63 - if y < 2 { - return x, 10 - } - -bad: - return 0, 0 -} diff --git a/vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go b/vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go deleted file mode 100644 index 00d6c7ad9..000000000 --- a/vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go +++ /dev/null @@ -1,385 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/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. -// -// 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 proto - -import ( - "io" - "reflect" -) - -func makeUnmarshalMessage(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - // First read the message field to see if something is there. - // The semantics of multiple submessages are weird. Instead of - // the last one winning (as it is for all other fields), multiple - // submessages are merged. - v := f // gogo: changed from v := f.getPointer() - if v.isNil() { - v = valToPointer(reflect.New(sub.typ)) - f.setPointer(v) - } - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - return b[x:], err - } -} - -func makeUnmarshalMessageSlice(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := valToPointer(reflect.New(sub.typ)) - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - f.appendRef(v, sub.typ) // gogo: changed from f.appendPointer(v) - return b[x:], err - } -} - -func makeUnmarshalCustomPtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.New(sub.typ)) - m := s.Interface().(custom) - if err := m.Unmarshal(b[:x]); err != nil { - return nil, err - } - return b[x:], nil - } -} - -func makeUnmarshalCustomSlice(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := reflect.New(sub.typ) - c := m.Interface().(custom) - if err := c.Unmarshal(b[:x]); err != nil { - return nil, err - } - v := valToPointer(m) - f.appendRef(v, sub.typ) - return b[x:], nil - } -} - -func makeUnmarshalCustom(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - - m := f.asPointerTo(sub.typ).Interface().(custom) - if err := m.Unmarshal(b[:x]); err != nil { - return nil, err - } - return b[x:], nil - } -} - -func makeUnmarshalTime(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := ×tamp{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - t, err := timestampFromProto(m) - if err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(t)) - return b[x:], nil - } -} - -func makeUnmarshalTimePtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := ×tamp{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - t, err := timestampFromProto(m) - if err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&t)) - return b[x:], nil - } -} - -func makeUnmarshalTimePtrSlice(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := ×tamp{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - t, err := timestampFromProto(m) - if err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&t)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeUnmarshalTimeSlice(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := ×tamp{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - t, err := timestampFromProto(m) - if err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(t)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeUnmarshalDurationPtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &duration{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - d, err := durationFromProto(m) - if err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&d)) - return b[x:], nil - } -} - -func makeUnmarshalDuration(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &duration{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - d, err := durationFromProto(m) - if err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(d)) - return b[x:], nil - } -} - -func makeUnmarshalDurationPtrSlice(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &duration{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - d, err := durationFromProto(m) - if err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&d)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeUnmarshalDurationSlice(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &duration{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - d, err := durationFromProto(m) - if err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(d)) - slice.Set(newSlice) - return b[x:], nil - } -} diff --git a/vendor/github.com/gogo/protobuf/proto/text.go b/vendor/github.com/gogo/protobuf/proto/text.go deleted file mode 100644 index 87416afe9..000000000 --- a/vendor/github.com/gogo/protobuf/proto/text.go +++ /dev/null @@ -1,930 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 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 proto - -// Functions for writing the text protocol buffer format. - -import ( - "bufio" - "bytes" - "encoding" - "errors" - "fmt" - "io" - "log" - "math" - "reflect" - "sort" - "strings" - "sync" - "time" -) - -var ( - newline = []byte("\n") - spaces = []byte(" ") - endBraceNewline = []byte("}\n") - backslashN = []byte{'\\', 'n'} - backslashR = []byte{'\\', 'r'} - backslashT = []byte{'\\', 't'} - backslashDQ = []byte{'\\', '"'} - backslashBS = []byte{'\\', '\\'} - posInf = []byte("inf") - negInf = []byte("-inf") - nan = []byte("nan") -) - -type writer interface { - io.Writer - WriteByte(byte) error -} - -// textWriter is an io.Writer that tracks its indentation level. -type textWriter struct { - ind int - complete bool // if the current position is a complete line - compact bool // whether to write out as a one-liner - w writer -} - -func (w *textWriter) WriteString(s string) (n int, err error) { - if !strings.Contains(s, "\n") { - if !w.compact && w.complete { - w.writeIndent() - } - w.complete = false - return io.WriteString(w.w, s) - } - // WriteString is typically called without newlines, so this - // codepath and its copy are rare. We copy to avoid - // duplicating all of Write's logic here. - return w.Write([]byte(s)) -} - -func (w *textWriter) Write(p []byte) (n int, err error) { - newlines := bytes.Count(p, newline) - if newlines == 0 { - if !w.compact && w.complete { - w.writeIndent() - } - n, err = w.w.Write(p) - w.complete = false - return n, err - } - - frags := bytes.SplitN(p, newline, newlines+1) - if w.compact { - for i, frag := range frags { - if i > 0 { - if err := w.w.WriteByte(' '); err != nil { - return n, err - } - n++ - } - nn, err := w.w.Write(frag) - n += nn - if err != nil { - return n, err - } - } - return n, nil - } - - for i, frag := range frags { - if w.complete { - w.writeIndent() - } - nn, err := w.w.Write(frag) - n += nn - if err != nil { - return n, err - } - if i+1 < len(frags) { - if err := w.w.WriteByte('\n'); err != nil { - return n, err - } - n++ - } - } - w.complete = len(frags[len(frags)-1]) == 0 - return n, nil -} - -func (w *textWriter) WriteByte(c byte) error { - if w.compact && c == '\n' { - c = ' ' - } - if !w.compact && w.complete { - w.writeIndent() - } - err := w.w.WriteByte(c) - w.complete = c == '\n' - return err -} - -func (w *textWriter) indent() { w.ind++ } - -func (w *textWriter) unindent() { - if w.ind == 0 { - log.Print("proto: textWriter unindented too far") - return - } - w.ind-- -} - -func writeName(w *textWriter, props *Properties) error { - if _, err := w.WriteString(props.OrigName); err != nil { - return err - } - if props.Wire != "group" { - return w.WriteByte(':') - } - return nil -} - -func requiresQuotes(u string) bool { - // When type URL contains any characters except [0-9A-Za-z./\-]*, it must be quoted. - for _, ch := range u { - switch { - case ch == '.' || ch == '/' || ch == '_': - continue - case '0' <= ch && ch <= '9': - continue - case 'A' <= ch && ch <= 'Z': - continue - case 'a' <= ch && ch <= 'z': - continue - default: - return true - } - } - return false -} - -// isAny reports whether sv is a google.protobuf.Any message -func isAny(sv reflect.Value) bool { - type wkt interface { - XXX_WellKnownType() string - } - t, ok := sv.Addr().Interface().(wkt) - return ok && t.XXX_WellKnownType() == "Any" -} - -// writeProto3Any writes an expanded google.protobuf.Any message. -// -// It returns (false, nil) if sv value can't be unmarshaled (e.g. because -// required messages are not linked in). -// -// It returns (true, error) when sv was written in expanded format or an error -// was encountered. -func (tm *TextMarshaler) writeProto3Any(w *textWriter, sv reflect.Value) (bool, error) { - turl := sv.FieldByName("TypeUrl") - val := sv.FieldByName("Value") - if !turl.IsValid() || !val.IsValid() { - return true, errors.New("proto: invalid google.protobuf.Any message") - } - - b, ok := val.Interface().([]byte) - if !ok { - return true, errors.New("proto: invalid google.protobuf.Any message") - } - - parts := strings.Split(turl.String(), "/") - mt := MessageType(parts[len(parts)-1]) - if mt == nil { - return false, nil - } - m := reflect.New(mt.Elem()) - if err := Unmarshal(b, m.Interface().(Message)); err != nil { - return false, nil - } - w.Write([]byte("[")) - u := turl.String() - if requiresQuotes(u) { - writeString(w, u) - } else { - w.Write([]byte(u)) - } - if w.compact { - w.Write([]byte("]:<")) - } else { - w.Write([]byte("]: <\n")) - w.ind++ - } - if err := tm.writeStruct(w, m.Elem()); err != nil { - return true, err - } - if w.compact { - w.Write([]byte("> ")) - } else { - w.ind-- - w.Write([]byte(">\n")) - } - return true, nil -} - -func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { - if tm.ExpandAny && isAny(sv) { - if canExpand, err := tm.writeProto3Any(w, sv); canExpand { - return err - } - } - st := sv.Type() - sprops := GetProperties(st) - for i := 0; i < sv.NumField(); i++ { - fv := sv.Field(i) - props := sprops.Prop[i] - name := st.Field(i).Name - - if name == "XXX_NoUnkeyedLiteral" { - continue - } - - if strings.HasPrefix(name, "XXX_") { - // There are two XXX_ fields: - // XXX_unrecognized []byte - // XXX_extensions map[int32]proto.Extension - // The first is handled here; - // the second is handled at the bottom of this function. - if name == "XXX_unrecognized" && !fv.IsNil() { - if err := writeUnknownStruct(w, fv.Interface().([]byte)); err != nil { - return err - } - } - continue - } - if fv.Kind() == reflect.Ptr && fv.IsNil() { - // Field not filled in. This could be an optional field or - // a required field that wasn't filled in. Either way, there - // isn't anything we can show for it. - continue - } - if fv.Kind() == reflect.Slice && fv.IsNil() { - // Repeated field that is empty, or a bytes field that is unused. - continue - } - - if props.Repeated && fv.Kind() == reflect.Slice { - // Repeated field. - for j := 0; j < fv.Len(); j++ { - if err := writeName(w, props); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - v := fv.Index(j) - if v.Kind() == reflect.Ptr && v.IsNil() { - // A nil message in a repeated field is not valid, - // but we can handle that more gracefully than panicking. - if _, err := w.Write([]byte("\n")); err != nil { - return err - } - continue - } - if len(props.Enum) > 0 { - if err := tm.writeEnum(w, v, props); err != nil { - return err - } - } else if err := tm.writeAny(w, v, props); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - continue - } - if fv.Kind() == reflect.Map { - // Map fields are rendered as a repeated struct with key/value fields. - keys := fv.MapKeys() - sort.Sort(mapKeys(keys)) - for _, key := range keys { - val := fv.MapIndex(key) - if err := writeName(w, props); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - // open struct - if err := w.WriteByte('<'); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte('\n'); err != nil { - return err - } - } - w.indent() - // key - if _, err := w.WriteString("key:"); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if err := tm.writeAny(w, key, props.MapKeyProp); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - // nil values aren't legal, but we can avoid panicking because of them. - if val.Kind() != reflect.Ptr || !val.IsNil() { - // value - if _, err := w.WriteString("value:"); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if err := tm.writeAny(w, val, props.MapValProp); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - // close struct - w.unindent() - if err := w.WriteByte('>'); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - continue - } - if props.proto3 && fv.Kind() == reflect.Slice && fv.Len() == 0 { - // empty bytes field - continue - } - if props.proto3 && fv.Kind() != reflect.Ptr && fv.Kind() != reflect.Slice { - // proto3 non-repeated scalar field; skip if zero value - if isProto3Zero(fv) { - continue - } - } - - if fv.Kind() == reflect.Interface { - // Check if it is a oneof. - if st.Field(i).Tag.Get("protobuf_oneof") != "" { - // fv is nil, or holds a pointer to generated struct. - // That generated struct has exactly one field, - // which has a protobuf struct tag. - if fv.IsNil() { - continue - } - inner := fv.Elem().Elem() // interface -> *T -> T - tag := inner.Type().Field(0).Tag.Get("protobuf") - props = new(Properties) // Overwrite the outer props var, but not its pointee. - props.Parse(tag) - // Write the value in the oneof, not the oneof itself. - fv = inner.Field(0) - - // Special case to cope with malformed messages gracefully: - // If the value in the oneof is a nil pointer, don't panic - // in writeAny. - if fv.Kind() == reflect.Ptr && fv.IsNil() { - // Use errors.New so writeAny won't render quotes. - msg := errors.New("/* nil */") - fv = reflect.ValueOf(&msg).Elem() - } - } - } - - if err := writeName(w, props); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - - if len(props.Enum) > 0 { - if err := tm.writeEnum(w, fv, props); err != nil { - return err - } - } else if err := tm.writeAny(w, fv, props); err != nil { - return err - } - - if err := w.WriteByte('\n'); err != nil { - return err - } - } - - // Extensions (the XXX_extensions field). - pv := sv - if pv.CanAddr() { - pv = sv.Addr() - } else { - pv = reflect.New(sv.Type()) - pv.Elem().Set(sv) - } - if _, err := extendable(pv.Interface()); err == nil { - if err := tm.writeExtensions(w, pv); err != nil { - return err - } - } - - return nil -} - -var textMarshalerType = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem() - -// writeAny writes an arbitrary field. -func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error { - v = reflect.Indirect(v) - - if props != nil { - if len(props.CustomType) > 0 { - custom, ok := v.Interface().(Marshaler) - if ok { - data, err := custom.Marshal() - if err != nil { - return err - } - if err := writeString(w, string(data)); err != nil { - return err - } - return nil - } - } else if len(props.CastType) > 0 { - if _, ok := v.Interface().(interface { - String() string - }); ok { - switch v.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, - reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - _, err := fmt.Fprintf(w, "%d", v.Interface()) - return err - } - } - } else if props.StdTime { - t, ok := v.Interface().(time.Time) - if !ok { - return fmt.Errorf("stdtime is not time.Time, but %T", v.Interface()) - } - tproto, err := timestampProto(t) - if err != nil { - return err - } - propsCopy := *props // Make a copy so that this is goroutine-safe - propsCopy.StdTime = false - err = tm.writeAny(w, reflect.ValueOf(tproto), &propsCopy) - return err - } else if props.StdDuration { - d, ok := v.Interface().(time.Duration) - if !ok { - return fmt.Errorf("stdtime is not time.Duration, but %T", v.Interface()) - } - dproto := durationProto(d) - propsCopy := *props // Make a copy so that this is goroutine-safe - propsCopy.StdDuration = false - err := tm.writeAny(w, reflect.ValueOf(dproto), &propsCopy) - return err - } - } - - // Floats have special cases. - if v.Kind() == reflect.Float32 || v.Kind() == reflect.Float64 { - x := v.Float() - var b []byte - switch { - case math.IsInf(x, 1): - b = posInf - case math.IsInf(x, -1): - b = negInf - case math.IsNaN(x): - b = nan - } - if b != nil { - _, err := w.Write(b) - return err - } - // Other values are handled below. - } - - // We don't attempt to serialise every possible value type; only those - // that can occur in protocol buffers. - switch v.Kind() { - case reflect.Slice: - // Should only be a []byte; repeated fields are handled in writeStruct. - if err := writeString(w, string(v.Bytes())); err != nil { - return err - } - case reflect.String: - if err := writeString(w, v.String()); err != nil { - return err - } - case reflect.Struct: - // Required/optional group/message. - var bra, ket byte = '<', '>' - if props != nil && props.Wire == "group" { - bra, ket = '{', '}' - } - if err := w.WriteByte(bra); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte('\n'); err != nil { - return err - } - } - w.indent() - if v.CanAddr() { - // Calling v.Interface on a struct causes the reflect package to - // copy the entire struct. This is racy with the new Marshaler - // since we atomically update the XXX_sizecache. - // - // Thus, we retrieve a pointer to the struct if possible to avoid - // a race since v.Interface on the pointer doesn't copy the struct. - // - // If v is not addressable, then we are not worried about a race - // since it implies that the binary Marshaler cannot possibly be - // mutating this value. - v = v.Addr() - } - if v.Type().Implements(textMarshalerType) { - text, err := v.Interface().(encoding.TextMarshaler).MarshalText() - if err != nil { - return err - } - if _, err = w.Write(text); err != nil { - return err - } - } else { - if v.Kind() == reflect.Ptr { - v = v.Elem() - } - if err := tm.writeStruct(w, v); err != nil { - return err - } - } - w.unindent() - if err := w.WriteByte(ket); err != nil { - return err - } - default: - _, err := fmt.Fprint(w, v.Interface()) - return err - } - return nil -} - -// equivalent to C's isprint. -func isprint(c byte) bool { - return c >= 0x20 && c < 0x7f -} - -// writeString writes a string in the protocol buffer text format. -// It is similar to strconv.Quote except we don't use Go escape sequences, -// we treat the string as a byte sequence, and we use octal escapes. -// These differences are to maintain interoperability with the other -// languages' implementations of the text format. -func writeString(w *textWriter, s string) error { - // use WriteByte here to get any needed indent - if err := w.WriteByte('"'); err != nil { - return err - } - // Loop over the bytes, not the runes. - for i := 0; i < len(s); i++ { - var err error - // Divergence from C++: we don't escape apostrophes. - // There's no need to escape them, and the C++ parser - // copes with a naked apostrophe. - switch c := s[i]; c { - case '\n': - _, err = w.w.Write(backslashN) - case '\r': - _, err = w.w.Write(backslashR) - case '\t': - _, err = w.w.Write(backslashT) - case '"': - _, err = w.w.Write(backslashDQ) - case '\\': - _, err = w.w.Write(backslashBS) - default: - if isprint(c) { - err = w.w.WriteByte(c) - } else { - _, err = fmt.Fprintf(w.w, "\\%03o", c) - } - } - if err != nil { - return err - } - } - return w.WriteByte('"') -} - -func writeUnknownStruct(w *textWriter, data []byte) (err error) { - if !w.compact { - if _, err := fmt.Fprintf(w, "/* %d unknown bytes */\n", len(data)); err != nil { - return err - } - } - b := NewBuffer(data) - for b.index < len(b.buf) { - x, err := b.DecodeVarint() - if err != nil { - _, ferr := fmt.Fprintf(w, "/* %v */\n", err) - return ferr - } - wire, tag := x&7, x>>3 - if wire == WireEndGroup { - w.unindent() - if _, werr := w.Write(endBraceNewline); werr != nil { - return werr - } - continue - } - if _, ferr := fmt.Fprint(w, tag); ferr != nil { - return ferr - } - if wire != WireStartGroup { - if err = w.WriteByte(':'); err != nil { - return err - } - } - if !w.compact || wire == WireStartGroup { - if err = w.WriteByte(' '); err != nil { - return err - } - } - switch wire { - case WireBytes: - buf, e := b.DecodeRawBytes(false) - if e == nil { - _, err = fmt.Fprintf(w, "%q", buf) - } else { - _, err = fmt.Fprintf(w, "/* %v */", e) - } - case WireFixed32: - x, err = b.DecodeFixed32() - err = writeUnknownInt(w, x, err) - case WireFixed64: - x, err = b.DecodeFixed64() - err = writeUnknownInt(w, x, err) - case WireStartGroup: - err = w.WriteByte('{') - w.indent() - case WireVarint: - x, err = b.DecodeVarint() - err = writeUnknownInt(w, x, err) - default: - _, err = fmt.Fprintf(w, "/* unknown wire type %d */", wire) - } - if err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - return nil -} - -func writeUnknownInt(w *textWriter, x uint64, err error) error { - if err == nil { - _, err = fmt.Fprint(w, x) - } else { - _, err = fmt.Fprintf(w, "/* %v */", err) - } - return err -} - -type int32Slice []int32 - -func (s int32Slice) Len() int { return len(s) } -func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] } -func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } - -// writeExtensions writes all the extensions in pv. -// pv is assumed to be a pointer to a protocol message struct that is extendable. -func (tm *TextMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error { - emap := extensionMaps[pv.Type().Elem()] - e := pv.Interface().(Message) - - var m map[int32]Extension - var mu sync.Locker - if em, ok := e.(extensionsBytes); ok { - eb := em.GetExtensions() - var err error - m, err = BytesToExtensionsMap(*eb) - if err != nil { - return err - } - mu = notLocker{} - } else if _, ok := e.(extendableProto); ok { - ep, _ := extendable(e) - m, mu = ep.extensionsRead() - if m == nil { - return nil - } - } - - // Order the extensions by ID. - // This isn't strictly necessary, but it will give us - // canonical output, which will also make testing easier. - - mu.Lock() - ids := make([]int32, 0, len(m)) - for id := range m { - ids = append(ids, id) - } - sort.Sort(int32Slice(ids)) - mu.Unlock() - - for _, extNum := range ids { - ext := m[extNum] - var desc *ExtensionDesc - if emap != nil { - desc = emap[extNum] - } - if desc == nil { - // Unknown extension. - if err := writeUnknownStruct(w, ext.enc); err != nil { - return err - } - continue - } - - pb, err := GetExtension(e, desc) - if err != nil { - return fmt.Errorf("failed getting extension: %v", err) - } - - // Repeated extensions will appear as a slice. - if !desc.repeated() { - if err := tm.writeExtension(w, desc.Name, pb); err != nil { - return err - } - } else { - v := reflect.ValueOf(pb) - for i := 0; i < v.Len(); i++ { - if err := tm.writeExtension(w, desc.Name, v.Index(i).Interface()); err != nil { - return err - } - } - } - } - return nil -} - -func (tm *TextMarshaler) writeExtension(w *textWriter, name string, pb interface{}) error { - if _, err := fmt.Fprintf(w, "[%s]:", name); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if err := tm.writeAny(w, reflect.ValueOf(pb), nil); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - return nil -} - -func (w *textWriter) writeIndent() { - if !w.complete { - return - } - remain := w.ind * 2 - for remain > 0 { - n := remain - if n > len(spaces) { - n = len(spaces) - } - w.w.Write(spaces[:n]) - remain -= n - } - w.complete = false -} - -// TextMarshaler is a configurable text format marshaler. -type TextMarshaler struct { - Compact bool // use compact text format (one line). - ExpandAny bool // expand google.protobuf.Any messages of known types -} - -// Marshal writes a given protocol buffer in text format. -// The only errors returned are from w. -func (tm *TextMarshaler) Marshal(w io.Writer, pb Message) error { - val := reflect.ValueOf(pb) - if pb == nil || val.IsNil() { - w.Write([]byte("")) - return nil - } - var bw *bufio.Writer - ww, ok := w.(writer) - if !ok { - bw = bufio.NewWriter(w) - ww = bw - } - aw := &textWriter{ - w: ww, - complete: true, - compact: tm.Compact, - } - - if etm, ok := pb.(encoding.TextMarshaler); ok { - text, err := etm.MarshalText() - if err != nil { - return err - } - if _, err = aw.Write(text); err != nil { - return err - } - if bw != nil { - return bw.Flush() - } - return nil - } - // Dereference the received pointer so we don't have outer < and >. - v := reflect.Indirect(val) - if err := tm.writeStruct(aw, v); err != nil { - return err - } - if bw != nil { - return bw.Flush() - } - return nil -} - -// Text is the same as Marshal, but returns the string directly. -func (tm *TextMarshaler) Text(pb Message) string { - var buf bytes.Buffer - tm.Marshal(&buf, pb) - return buf.String() -} - -var ( - defaultTextMarshaler = TextMarshaler{} - compactTextMarshaler = TextMarshaler{Compact: true} -) - -// TODO: consider removing some of the Marshal functions below. - -// MarshalText writes a given protocol buffer in text format. -// The only errors returned are from w. -func MarshalText(w io.Writer, pb Message) error { return defaultTextMarshaler.Marshal(w, pb) } - -// MarshalTextString is the same as MarshalText, but returns the string directly. -func MarshalTextString(pb Message) string { return defaultTextMarshaler.Text(pb) } - -// CompactText writes a given protocol buffer in compact text format (one line). -func CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Marshal(w, pb) } - -// CompactTextString is the same as CompactText, but returns the string directly. -func CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) } diff --git a/vendor/github.com/gogo/protobuf/proto/text_gogo.go b/vendor/github.com/gogo/protobuf/proto/text_gogo.go deleted file mode 100644 index 1d6c6aa0e..000000000 --- a/vendor/github.com/gogo/protobuf/proto/text_gogo.go +++ /dev/null @@ -1,57 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/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. -// -// 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 proto - -import ( - "fmt" - "reflect" -) - -func (tm *TextMarshaler) writeEnum(w *textWriter, v reflect.Value, props *Properties) error { - m, ok := enumStringMaps[props.Enum] - if !ok { - if err := tm.writeAny(w, v, props); err != nil { - return err - } - } - key := int32(0) - if v.Kind() == reflect.Ptr { - key = int32(v.Elem().Int()) - } else { - key = int32(v.Int()) - } - s, ok := m[key] - if !ok { - if err := tm.writeAny(w, v, props); err != nil { - return err - } - } - _, err := fmt.Fprint(w, s) - return err -} diff --git a/vendor/github.com/gogo/protobuf/proto/text_parser.go b/vendor/github.com/gogo/protobuf/proto/text_parser.go deleted file mode 100644 index f85c0cc81..000000000 --- a/vendor/github.com/gogo/protobuf/proto/text_parser.go +++ /dev/null @@ -1,1018 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 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 proto - -// Functions for parsing the Text protocol buffer format. -// TODO: message sets. - -import ( - "encoding" - "errors" - "fmt" - "reflect" - "strconv" - "strings" - "time" - "unicode/utf8" -) - -// Error string emitted when deserializing Any and fields are already set -const anyRepeatedlyUnpacked = "Any message unpacked multiple times, or %q already set" - -type ParseError struct { - Message string - Line int // 1-based line number - Offset int // 0-based byte offset from start of input -} - -func (p *ParseError) Error() string { - if p.Line == 1 { - // show offset only for first line - return fmt.Sprintf("line 1.%d: %v", p.Offset, p.Message) - } - return fmt.Sprintf("line %d: %v", p.Line, p.Message) -} - -type token struct { - value string - err *ParseError - line int // line number - offset int // byte number from start of input, not start of line - unquoted string // the unquoted version of value, if it was a quoted string -} - -func (t *token) String() string { - if t.err == nil { - return fmt.Sprintf("%q (line=%d, offset=%d)", t.value, t.line, t.offset) - } - return fmt.Sprintf("parse error: %v", t.err) -} - -type textParser struct { - s string // remaining input - done bool // whether the parsing is finished (success or error) - backed bool // whether back() was called - offset, line int - cur token -} - -func newTextParser(s string) *textParser { - p := new(textParser) - p.s = s - p.line = 1 - p.cur.line = 1 - return p -} - -func (p *textParser) errorf(format string, a ...interface{}) *ParseError { - pe := &ParseError{fmt.Sprintf(format, a...), p.cur.line, p.cur.offset} - p.cur.err = pe - p.done = true - return pe -} - -// Numbers and identifiers are matched by [-+._A-Za-z0-9] -func isIdentOrNumberChar(c byte) bool { - switch { - case 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z': - return true - case '0' <= c && c <= '9': - return true - } - switch c { - case '-', '+', '.', '_': - return true - } - return false -} - -func isWhitespace(c byte) bool { - switch c { - case ' ', '\t', '\n', '\r': - return true - } - return false -} - -func isQuote(c byte) bool { - switch c { - case '"', '\'': - return true - } - return false -} - -func (p *textParser) skipWhitespace() { - i := 0 - for i < len(p.s) && (isWhitespace(p.s[i]) || p.s[i] == '#') { - if p.s[i] == '#' { - // comment; skip to end of line or input - for i < len(p.s) && p.s[i] != '\n' { - i++ - } - if i == len(p.s) { - break - } - } - if p.s[i] == '\n' { - p.line++ - } - i++ - } - p.offset += i - p.s = p.s[i:len(p.s)] - if len(p.s) == 0 { - p.done = true - } -} - -func (p *textParser) advance() { - // Skip whitespace - p.skipWhitespace() - if p.done { - return - } - - // Start of non-whitespace - p.cur.err = nil - p.cur.offset, p.cur.line = p.offset, p.line - p.cur.unquoted = "" - switch p.s[0] { - case '<', '>', '{', '}', ':', '[', ']', ';', ',', '/': - // Single symbol - p.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)] - case '"', '\'': - // Quoted string - i := 1 - for i < len(p.s) && p.s[i] != p.s[0] && p.s[i] != '\n' { - if p.s[i] == '\\' && i+1 < len(p.s) { - // skip escaped char - i++ - } - i++ - } - if i >= len(p.s) || p.s[i] != p.s[0] { - p.errorf("unmatched quote") - return - } - unq, err := unquoteC(p.s[1:i], rune(p.s[0])) - if err != nil { - p.errorf("invalid quoted string %s: %v", p.s[0:i+1], err) - return - } - p.cur.value, p.s = p.s[0:i+1], p.s[i+1:len(p.s)] - p.cur.unquoted = unq - default: - i := 0 - for i < len(p.s) && isIdentOrNumberChar(p.s[i]) { - i++ - } - if i == 0 { - p.errorf("unexpected byte %#x", p.s[0]) - return - } - p.cur.value, p.s = p.s[0:i], p.s[i:len(p.s)] - } - p.offset += len(p.cur.value) -} - -var ( - errBadUTF8 = errors.New("proto: bad UTF-8") -) - -func unquoteC(s string, quote rune) (string, error) { - // This is based on C++'s tokenizer.cc. - // Despite its name, this is *not* parsing C syntax. - // For instance, "\0" is an invalid quoted string. - - // Avoid allocation in trivial cases. - simple := true - for _, r := range s { - if r == '\\' || r == quote { - simple = false - break - } - } - if simple { - return s, nil - } - - buf := make([]byte, 0, 3*len(s)/2) - for len(s) > 0 { - r, n := utf8.DecodeRuneInString(s) - if r == utf8.RuneError && n == 1 { - return "", errBadUTF8 - } - s = s[n:] - if r != '\\' { - if r < utf8.RuneSelf { - buf = append(buf, byte(r)) - } else { - buf = append(buf, string(r)...) - } - continue - } - - ch, tail, err := unescape(s) - if err != nil { - return "", err - } - buf = append(buf, ch...) - s = tail - } - return string(buf), nil -} - -func unescape(s string) (ch string, tail string, err error) { - r, n := utf8.DecodeRuneInString(s) - if r == utf8.RuneError && n == 1 { - return "", "", errBadUTF8 - } - s = s[n:] - switch r { - case 'a': - return "\a", s, nil - case 'b': - return "\b", s, nil - case 'f': - return "\f", s, nil - case 'n': - return "\n", s, nil - case 'r': - return "\r", s, nil - case 't': - return "\t", s, nil - case 'v': - return "\v", s, nil - case '?': - return "?", s, nil // trigraph workaround - case '\'', '"', '\\': - return string(r), s, nil - case '0', '1', '2', '3', '4', '5', '6', '7': - if len(s) < 2 { - return "", "", fmt.Errorf(`\%c requires 2 following digits`, r) - } - ss := string(r) + s[:2] - s = s[2:] - i, err := strconv.ParseUint(ss, 8, 8) - if err != nil { - return "", "", fmt.Errorf(`\%s contains non-octal digits`, ss) - } - return string([]byte{byte(i)}), s, nil - case 'x', 'X', 'u', 'U': - var n int - switch r { - case 'x', 'X': - n = 2 - case 'u': - n = 4 - case 'U': - n = 8 - } - if len(s) < n { - return "", "", fmt.Errorf(`\%c requires %d following digits`, r, n) - } - ss := s[:n] - s = s[n:] - i, err := strconv.ParseUint(ss, 16, 64) - if err != nil { - return "", "", fmt.Errorf(`\%c%s contains non-hexadecimal digits`, r, ss) - } - if r == 'x' || r == 'X' { - return string([]byte{byte(i)}), s, nil - } - if i > utf8.MaxRune { - return "", "", fmt.Errorf(`\%c%s is not a valid Unicode code point`, r, ss) - } - return string(rune(i)), s, nil - } - return "", "", fmt.Errorf(`unknown escape \%c`, r) -} - -// Back off the parser by one token. Can only be done between calls to next(). -// It makes the next advance() a no-op. -func (p *textParser) back() { p.backed = true } - -// Advances the parser and returns the new current token. -func (p *textParser) next() *token { - if p.backed || p.done { - p.backed = false - return &p.cur - } - p.advance() - if p.done { - p.cur.value = "" - } else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) { - // Look for multiple quoted strings separated by whitespace, - // and concatenate them. - cat := p.cur - for { - p.skipWhitespace() - if p.done || !isQuote(p.s[0]) { - break - } - p.advance() - if p.cur.err != nil { - return &p.cur - } - cat.value += " " + p.cur.value - cat.unquoted += p.cur.unquoted - } - p.done = false // parser may have seen EOF, but we want to return cat - p.cur = cat - } - return &p.cur -} - -func (p *textParser) consumeToken(s string) error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != s { - p.back() - return p.errorf("expected %q, found %q", s, tok.value) - } - return nil -} - -// Return a RequiredNotSetError indicating which required field was not set. -func (p *textParser) missingRequiredFieldError(sv reflect.Value) *RequiredNotSetError { - st := sv.Type() - sprops := GetProperties(st) - for i := 0; i < st.NumField(); i++ { - if !isNil(sv.Field(i)) { - continue - } - - props := sprops.Prop[i] - if props.Required { - return &RequiredNotSetError{fmt.Sprintf("%v.%v", st, props.OrigName)} - } - } - return &RequiredNotSetError{fmt.Sprintf("%v.", st)} // should not happen -} - -// Returns the index in the struct for the named field, as well as the parsed tag properties. -func structFieldByName(sprops *StructProperties, name string) (int, *Properties, bool) { - i, ok := sprops.decoderOrigNames[name] - if ok { - return i, sprops.Prop[i], true - } - return -1, nil, false -} - -// Consume a ':' from the input stream (if the next token is a colon), -// returning an error if a colon is needed but not present. -func (p *textParser) checkForColon(props *Properties, typ reflect.Type) *ParseError { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != ":" { - // Colon is optional when the field is a group or message. - needColon := true - switch props.Wire { - case "group": - needColon = false - case "bytes": - // A "bytes" field is either a message, a string, or a repeated field; - // those three become *T, *string and []T respectively, so we can check for - // this field being a pointer to a non-string. - if typ.Kind() == reflect.Ptr { - // *T or *string - if typ.Elem().Kind() == reflect.String { - break - } - } else if typ.Kind() == reflect.Slice { - // []T or []*T - if typ.Elem().Kind() != reflect.Ptr { - break - } - } else if typ.Kind() == reflect.String { - // The proto3 exception is for a string field, - // which requires a colon. - break - } - needColon = false - } - if needColon { - return p.errorf("expected ':', found %q", tok.value) - } - p.back() - } - return nil -} - -func (p *textParser) readStruct(sv reflect.Value, terminator string) error { - st := sv.Type() - sprops := GetProperties(st) - reqCount := sprops.reqCount - var reqFieldErr error - fieldSet := make(map[string]bool) - // A struct is a sequence of "name: value", terminated by one of - // '>' or '}', or the end of the input. A name may also be - // "[extension]" or "[type/url]". - // - // The whole struct can also be an expanded Any message, like: - // [type/url] < ... struct contents ... > - for { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == terminator { - break - } - if tok.value == "[" { - // Looks like an extension or an Any. - // - // TODO: Check whether we need to handle - // namespace rooted names (e.g. ".something.Foo"). - extName, err := p.consumeExtName() - if err != nil { - return err - } - - if s := strings.LastIndex(extName, "/"); s >= 0 { - // If it contains a slash, it's an Any type URL. - messageName := extName[s+1:] - mt := MessageType(messageName) - if mt == nil { - return p.errorf("unrecognized message %q in google.protobuf.Any", messageName) - } - tok = p.next() - if tok.err != nil { - return tok.err - } - // consume an optional colon - if tok.value == ":" { - tok = p.next() - if tok.err != nil { - return tok.err - } - } - var terminator string - switch tok.value { - case "<": - terminator = ">" - case "{": - terminator = "}" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - v := reflect.New(mt.Elem()) - if pe := p.readStruct(v.Elem(), terminator); pe != nil { - return pe - } - b, err := Marshal(v.Interface().(Message)) - if err != nil { - return p.errorf("failed to marshal message of type %q: %v", messageName, err) - } - if fieldSet["type_url"] { - return p.errorf(anyRepeatedlyUnpacked, "type_url") - } - if fieldSet["value"] { - return p.errorf(anyRepeatedlyUnpacked, "value") - } - sv.FieldByName("TypeUrl").SetString(extName) - sv.FieldByName("Value").SetBytes(b) - fieldSet["type_url"] = true - fieldSet["value"] = true - continue - } - - var desc *ExtensionDesc - // This could be faster, but it's functional. - // TODO: Do something smarter than a linear scan. - for _, d := range RegisteredExtensions(reflect.New(st).Interface().(Message)) { - if d.Name == extName { - desc = d - break - } - } - if desc == nil { - return p.errorf("unrecognized extension %q", extName) - } - - props := &Properties{} - props.Parse(desc.Tag) - - typ := reflect.TypeOf(desc.ExtensionType) - if err := p.checkForColon(props, typ); err != nil { - return err - } - - rep := desc.repeated() - - // Read the extension structure, and set it in - // the value we're constructing. - var ext reflect.Value - if !rep { - ext = reflect.New(typ).Elem() - } else { - ext = reflect.New(typ.Elem()).Elem() - } - if err := p.readAny(ext, props); err != nil { - if _, ok := err.(*RequiredNotSetError); !ok { - return err - } - reqFieldErr = err - } - ep := sv.Addr().Interface().(Message) - if !rep { - SetExtension(ep, desc, ext.Interface()) - } else { - old, err := GetExtension(ep, desc) - var sl reflect.Value - if err == nil { - sl = reflect.ValueOf(old) // existing slice - } else { - sl = reflect.MakeSlice(typ, 0, 1) - } - sl = reflect.Append(sl, ext) - SetExtension(ep, desc, sl.Interface()) - } - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - continue - } - - // This is a normal, non-extension field. - name := tok.value - var dst reflect.Value - fi, props, ok := structFieldByName(sprops, name) - if ok { - dst = sv.Field(fi) - } else if oop, ok := sprops.OneofTypes[name]; ok { - // It is a oneof. - props = oop.Prop - nv := reflect.New(oop.Type.Elem()) - dst = nv.Elem().Field(0) - field := sv.Field(oop.Field) - if !field.IsNil() { - return p.errorf("field '%s' would overwrite already parsed oneof '%s'", name, sv.Type().Field(oop.Field).Name) - } - field.Set(nv) - } - if !dst.IsValid() { - return p.errorf("unknown field name %q in %v", name, st) - } - - if dst.Kind() == reflect.Map { - // Consume any colon. - if err := p.checkForColon(props, dst.Type()); err != nil { - return err - } - - // Construct the map if it doesn't already exist. - if dst.IsNil() { - dst.Set(reflect.MakeMap(dst.Type())) - } - key := reflect.New(dst.Type().Key()).Elem() - val := reflect.New(dst.Type().Elem()).Elem() - - // The map entry should be this sequence of tokens: - // < key : KEY value : VALUE > - // However, implementations may omit key or value, and technically - // we should support them in any order. See b/28924776 for a time - // this went wrong. - - tok := p.next() - var terminator string - switch tok.value { - case "<": - terminator = ">" - case "{": - terminator = "}" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - for { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == terminator { - break - } - switch tok.value { - case "key": - if err := p.consumeToken(":"); err != nil { - return err - } - if err := p.readAny(key, props.MapKeyProp); err != nil { - return err - } - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - case "value": - if err := p.checkForColon(props.MapValProp, dst.Type().Elem()); err != nil { - return err - } - if err := p.readAny(val, props.MapValProp); err != nil { - return err - } - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - default: - p.back() - return p.errorf(`expected "key", "value", or %q, found %q`, terminator, tok.value) - } - } - - dst.SetMapIndex(key, val) - continue - } - - // Check that it's not already set if it's not a repeated field. - if !props.Repeated && fieldSet[name] { - return p.errorf("non-repeated field %q was repeated", name) - } - - if err := p.checkForColon(props, dst.Type()); err != nil { - return err - } - - // Parse into the field. - fieldSet[name] = true - if err := p.readAny(dst, props); err != nil { - if _, ok := err.(*RequiredNotSetError); !ok { - return err - } - reqFieldErr = err - } - if props.Required { - reqCount-- - } - - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - - } - - if reqCount > 0 { - return p.missingRequiredFieldError(sv) - } - return reqFieldErr -} - -// consumeExtName consumes extension name or expanded Any type URL and the -// following ']'. It returns the name or URL consumed. -func (p *textParser) consumeExtName() (string, error) { - tok := p.next() - if tok.err != nil { - return "", tok.err - } - - // If extension name or type url is quoted, it's a single token. - if len(tok.value) > 2 && isQuote(tok.value[0]) && tok.value[len(tok.value)-1] == tok.value[0] { - name, err := unquoteC(tok.value[1:len(tok.value)-1], rune(tok.value[0])) - if err != nil { - return "", err - } - return name, p.consumeToken("]") - } - - // Consume everything up to "]" - var parts []string - for tok.value != "]" { - parts = append(parts, tok.value) - tok = p.next() - if tok.err != nil { - return "", p.errorf("unrecognized type_url or extension name: %s", tok.err) - } - if p.done && tok.value != "]" { - return "", p.errorf("unclosed type_url or extension name") - } - } - return strings.Join(parts, ""), nil -} - -// consumeOptionalSeparator consumes an optional semicolon or comma. -// It is used in readStruct to provide backward compatibility. -func (p *textParser) consumeOptionalSeparator() error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != ";" && tok.value != "," { - p.back() - } - return nil -} - -func (p *textParser) readAny(v reflect.Value, props *Properties) error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == "" { - return p.errorf("unexpected EOF") - } - if len(props.CustomType) > 0 { - if props.Repeated { - t := reflect.TypeOf(v.Interface()) - if t.Kind() == reflect.Slice { - tc := reflect.TypeOf(new(Marshaler)) - ok := t.Elem().Implements(tc.Elem()) - if ok { - fv := v - flen := fv.Len() - if flen == fv.Cap() { - nav := reflect.MakeSlice(v.Type(), flen, 2*flen+1) - reflect.Copy(nav, fv) - fv.Set(nav) - } - fv.SetLen(flen + 1) - - // Read one. - p.back() - return p.readAny(fv.Index(flen), props) - } - } - } - if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr { - custom := reflect.New(props.ctype.Elem()).Interface().(Unmarshaler) - err := custom.Unmarshal([]byte(tok.unquoted)) - if err != nil { - return p.errorf("%v %v: %v", err, v.Type(), tok.value) - } - v.Set(reflect.ValueOf(custom)) - } else { - custom := reflect.New(reflect.TypeOf(v.Interface())).Interface().(Unmarshaler) - err := custom.Unmarshal([]byte(tok.unquoted)) - if err != nil { - return p.errorf("%v %v: %v", err, v.Type(), tok.value) - } - v.Set(reflect.Indirect(reflect.ValueOf(custom))) - } - return nil - } - if props.StdTime { - fv := v - p.back() - props.StdTime = false - tproto := ×tamp{} - err := p.readAny(reflect.ValueOf(tproto).Elem(), props) - props.StdTime = true - if err != nil { - return err - } - tim, err := timestampFromProto(tproto) - if err != nil { - return err - } - if props.Repeated { - t := reflect.TypeOf(v.Interface()) - if t.Kind() == reflect.Slice { - if t.Elem().Kind() == reflect.Ptr { - ts := fv.Interface().([]*time.Time) - ts = append(ts, &tim) - fv.Set(reflect.ValueOf(ts)) - return nil - } else { - ts := fv.Interface().([]time.Time) - ts = append(ts, tim) - fv.Set(reflect.ValueOf(ts)) - return nil - } - } - } - if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr { - v.Set(reflect.ValueOf(&tim)) - } else { - v.Set(reflect.Indirect(reflect.ValueOf(&tim))) - } - return nil - } - if props.StdDuration { - fv := v - p.back() - props.StdDuration = false - dproto := &duration{} - err := p.readAny(reflect.ValueOf(dproto).Elem(), props) - props.StdDuration = true - if err != nil { - return err - } - dur, err := durationFromProto(dproto) - if err != nil { - return err - } - if props.Repeated { - t := reflect.TypeOf(v.Interface()) - if t.Kind() == reflect.Slice { - if t.Elem().Kind() == reflect.Ptr { - ds := fv.Interface().([]*time.Duration) - ds = append(ds, &dur) - fv.Set(reflect.ValueOf(ds)) - return nil - } else { - ds := fv.Interface().([]time.Duration) - ds = append(ds, dur) - fv.Set(reflect.ValueOf(ds)) - return nil - } - } - } - if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr { - v.Set(reflect.ValueOf(&dur)) - } else { - v.Set(reflect.Indirect(reflect.ValueOf(&dur))) - } - return nil - } - switch fv := v; fv.Kind() { - case reflect.Slice: - at := v.Type() - if at.Elem().Kind() == reflect.Uint8 { - // Special case for []byte - if tok.value[0] != '"' && tok.value[0] != '\'' { - // Deliberately written out here, as the error after - // this switch statement would write "invalid []byte: ...", - // which is not as user-friendly. - return p.errorf("invalid string: %v", tok.value) - } - bytes := []byte(tok.unquoted) - fv.Set(reflect.ValueOf(bytes)) - return nil - } - // Repeated field. - if tok.value == "[" { - // Repeated field with list notation, like [1,2,3]. - for { - fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem())) - err := p.readAny(fv.Index(fv.Len()-1), props) - if err != nil { - return err - } - ntok := p.next() - if ntok.err != nil { - return ntok.err - } - if ntok.value == "]" { - break - } - if ntok.value != "," { - return p.errorf("Expected ']' or ',' found %q", ntok.value) - } - } - return nil - } - // One value of the repeated field. - p.back() - fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem())) - return p.readAny(fv.Index(fv.Len()-1), props) - case reflect.Bool: - // true/1/t/True or false/f/0/False. - switch tok.value { - case "true", "1", "t", "True": - fv.SetBool(true) - return nil - case "false", "0", "f", "False": - fv.SetBool(false) - return nil - } - case reflect.Float32, reflect.Float64: - v := tok.value - // Ignore 'f' for compatibility with output generated by C++, but don't - // remove 'f' when the value is "-inf" or "inf". - if strings.HasSuffix(v, "f") && tok.value != "-inf" && tok.value != "inf" { - v = v[:len(v)-1] - } - if f, err := strconv.ParseFloat(v, fv.Type().Bits()); err == nil { - fv.SetFloat(f) - return nil - } - case reflect.Int8: - if x, err := strconv.ParseInt(tok.value, 0, 8); err == nil { - fv.SetInt(x) - return nil - } - case reflect.Int16: - if x, err := strconv.ParseInt(tok.value, 0, 16); err == nil { - fv.SetInt(x) - return nil - } - case reflect.Int32: - if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil { - fv.SetInt(x) - return nil - } - - if len(props.Enum) == 0 { - break - } - m, ok := enumValueMaps[props.Enum] - if !ok { - break - } - x, ok := m[tok.value] - if !ok { - break - } - fv.SetInt(int64(x)) - return nil - case reflect.Int64: - if x, err := strconv.ParseInt(tok.value, 0, 64); err == nil { - fv.SetInt(x) - return nil - } - - case reflect.Ptr: - // A basic field (indirected through pointer), or a repeated message/group - p.back() - fv.Set(reflect.New(fv.Type().Elem())) - return p.readAny(fv.Elem(), props) - case reflect.String: - if tok.value[0] == '"' || tok.value[0] == '\'' { - fv.SetString(tok.unquoted) - return nil - } - case reflect.Struct: - var terminator string - switch tok.value { - case "{": - terminator = "}" - case "<": - terminator = ">" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - // TODO: Handle nested messages which implement encoding.TextUnmarshaler. - return p.readStruct(fv, terminator) - case reflect.Uint8: - if x, err := strconv.ParseUint(tok.value, 0, 8); err == nil { - fv.SetUint(x) - return nil - } - case reflect.Uint16: - if x, err := strconv.ParseUint(tok.value, 0, 16); err == nil { - fv.SetUint(x) - return nil - } - case reflect.Uint32: - if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil { - fv.SetUint(uint64(x)) - return nil - } - case reflect.Uint64: - if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil { - fv.SetUint(x) - return nil - } - } - return p.errorf("invalid %v: %v", v.Type(), tok.value) -} - -// UnmarshalText reads a protocol buffer in Text format. UnmarshalText resets pb -// before starting to unmarshal, so any existing data in pb is always removed. -// If a required field is not set and no other error occurs, -// UnmarshalText returns *RequiredNotSetError. -func UnmarshalText(s string, pb Message) error { - if um, ok := pb.(encoding.TextUnmarshaler); ok { - return um.UnmarshalText([]byte(s)) - } - pb.Reset() - v := reflect.ValueOf(pb) - return newTextParser(s).readStruct(v.Elem(), "") -} diff --git a/vendor/github.com/gogo/protobuf/proto/timestamp.go b/vendor/github.com/gogo/protobuf/proto/timestamp.go deleted file mode 100644 index 9324f6542..000000000 --- a/vendor/github.com/gogo/protobuf/proto/timestamp.go +++ /dev/null @@ -1,113 +0,0 @@ -// 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 proto - -// This file implements operations on google.protobuf.Timestamp. - -import ( - "errors" - "fmt" - "time" -) - -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 *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 -} - -// TimestampFromProto 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 timestampFromProto(ts *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) -} - -// 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) (*timestamp, error) { - seconds := t.Unix() - nanos := int32(t.Sub(time.Unix(seconds, 0))) - ts := ×tamp{ - Seconds: seconds, - Nanos: nanos, - } - if err := validateTimestamp(ts); err != nil { - return nil, err - } - return ts, nil -} diff --git a/vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go b/vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go deleted file mode 100644 index 38439fa99..000000000 --- a/vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go +++ /dev/null @@ -1,49 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2016, The GoGo Authors. All rights reserved. -// http://github.com/gogo/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. -// -// 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 proto - -import ( - "reflect" - "time" -) - -var timeType = reflect.TypeOf((*time.Time)(nil)).Elem() - -type timestamp struct { - Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` - Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` -} - -func (m *timestamp) Reset() { *m = timestamp{} } -func (*timestamp) ProtoMessage() {} -func (*timestamp) String() string { return "timestamp" } - -func init() { - RegisterType((*timestamp)(nil), "gogo.protobuf.proto.timestamp") -} diff --git a/vendor/github.com/gogo/protobuf/proto/wrappers.go b/vendor/github.com/gogo/protobuf/proto/wrappers.go deleted file mode 100644 index b175d1b64..000000000 --- a/vendor/github.com/gogo/protobuf/proto/wrappers.go +++ /dev/null @@ -1,1888 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/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. -// -// 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 proto - -import ( - "io" - "reflect" -) - -func makeStdDoubleValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*float64) - v := &float64Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*float64) - v := &float64Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdDoubleValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*float64) - v := &float64Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*float64) - v := &float64Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdDoubleValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(float64) - v := &float64Value{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(float64) - v := &float64Value{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdDoubleValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*float64) - v := &float64Value{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*float64) - v := &float64Value{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdDoubleValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdDoubleValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdDoubleValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdDoubleValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdFloatValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*float32) - v := &float32Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*float32) - v := &float32Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdFloatValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*float32) - v := &float32Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*float32) - v := &float32Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdFloatValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(float32) - v := &float32Value{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(float32) - v := &float32Value{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdFloatValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*float32) - v := &float32Value{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*float32) - v := &float32Value{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdFloatValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdFloatValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdFloatValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdFloatValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdInt64ValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*int64) - v := &int64Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*int64) - v := &int64Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdInt64ValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*int64) - v := &int64Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*int64) - v := &int64Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdInt64ValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(int64) - v := &int64Value{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(int64) - v := &int64Value{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdInt64ValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*int64) - v := &int64Value{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*int64) - v := &int64Value{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdInt64ValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdInt64ValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdInt64ValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdInt64ValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdUInt64ValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*uint64) - v := &uint64Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*uint64) - v := &uint64Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdUInt64ValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*uint64) - v := &uint64Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*uint64) - v := &uint64Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdUInt64ValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(uint64) - v := &uint64Value{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(uint64) - v := &uint64Value{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdUInt64ValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*uint64) - v := &uint64Value{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*uint64) - v := &uint64Value{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdUInt64ValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdUInt64ValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdUInt64ValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdUInt64ValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdInt32ValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*int32) - v := &int32Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*int32) - v := &int32Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdInt32ValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*int32) - v := &int32Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*int32) - v := &int32Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdInt32ValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(int32) - v := &int32Value{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(int32) - v := &int32Value{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdInt32ValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*int32) - v := &int32Value{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*int32) - v := &int32Value{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdInt32ValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdInt32ValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdInt32ValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdInt32ValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdUInt32ValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*uint32) - v := &uint32Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*uint32) - v := &uint32Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdUInt32ValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*uint32) - v := &uint32Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*uint32) - v := &uint32Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdUInt32ValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(uint32) - v := &uint32Value{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(uint32) - v := &uint32Value{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdUInt32ValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*uint32) - v := &uint32Value{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*uint32) - v := &uint32Value{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdUInt32ValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdUInt32ValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdUInt32ValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdUInt32ValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdBoolValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*bool) - v := &boolValue{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*bool) - v := &boolValue{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdBoolValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*bool) - v := &boolValue{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*bool) - v := &boolValue{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdBoolValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(bool) - v := &boolValue{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(bool) - v := &boolValue{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdBoolValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*bool) - v := &boolValue{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*bool) - v := &boolValue{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdBoolValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &boolValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdBoolValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &boolValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdBoolValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &boolValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdBoolValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &boolValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdStringValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*string) - v := &stringValue{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*string) - v := &stringValue{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdStringValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*string) - v := &stringValue{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*string) - v := &stringValue{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdStringValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(string) - v := &stringValue{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(string) - v := &stringValue{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdStringValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*string) - v := &stringValue{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*string) - v := &stringValue{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdStringValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &stringValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdStringValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &stringValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdStringValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &stringValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdStringValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &stringValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdBytesValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*[]byte) - v := &bytesValue{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*[]byte) - v := &bytesValue{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdBytesValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*[]byte) - v := &bytesValue{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*[]byte) - v := &bytesValue{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdBytesValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().([]byte) - v := &bytesValue{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().([]byte) - v := &bytesValue{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdBytesValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*[]byte) - v := &bytesValue{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*[]byte) - v := &bytesValue{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdBytesValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &bytesValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdBytesValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &bytesValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdBytesValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &bytesValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdBytesValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &bytesValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} diff --git a/vendor/github.com/gogo/protobuf/proto/wrappers_gogo.go b/vendor/github.com/gogo/protobuf/proto/wrappers_gogo.go deleted file mode 100644 index c1cf7bf85..000000000 --- a/vendor/github.com/gogo/protobuf/proto/wrappers_gogo.go +++ /dev/null @@ -1,113 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/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. -// -// 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 proto - -type float64Value struct { - Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *float64Value) Reset() { *m = float64Value{} } -func (*float64Value) ProtoMessage() {} -func (*float64Value) String() string { return "float64" } - -type float32Value struct { - Value float32 `protobuf:"fixed32,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *float32Value) Reset() { *m = float32Value{} } -func (*float32Value) ProtoMessage() {} -func (*float32Value) String() string { return "float32" } - -type int64Value struct { - Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *int64Value) Reset() { *m = int64Value{} } -func (*int64Value) ProtoMessage() {} -func (*int64Value) String() string { return "int64" } - -type uint64Value struct { - Value uint64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *uint64Value) Reset() { *m = uint64Value{} } -func (*uint64Value) ProtoMessage() {} -func (*uint64Value) String() string { return "uint64" } - -type int32Value struct { - Value int32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *int32Value) Reset() { *m = int32Value{} } -func (*int32Value) ProtoMessage() {} -func (*int32Value) String() string { return "int32" } - -type uint32Value struct { - Value uint32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *uint32Value) Reset() { *m = uint32Value{} } -func (*uint32Value) ProtoMessage() {} -func (*uint32Value) String() string { return "uint32" } - -type boolValue struct { - Value bool `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *boolValue) Reset() { *m = boolValue{} } -func (*boolValue) ProtoMessage() {} -func (*boolValue) String() string { return "bool" } - -type stringValue struct { - Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *stringValue) Reset() { *m = stringValue{} } -func (*stringValue) ProtoMessage() {} -func (*stringValue) String() string { return "string" } - -type bytesValue struct { - Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *bytesValue) Reset() { *m = bytesValue{} } -func (*bytesValue) ProtoMessage() {} -func (*bytesValue) String() string { return "[]byte" } - -func init() { - RegisterType((*float64Value)(nil), "gogo.protobuf.proto.DoubleValue") - RegisterType((*float32Value)(nil), "gogo.protobuf.proto.FloatValue") - RegisterType((*int64Value)(nil), "gogo.protobuf.proto.Int64Value") - RegisterType((*uint64Value)(nil), "gogo.protobuf.proto.UInt64Value") - RegisterType((*int32Value)(nil), "gogo.protobuf.proto.Int32Value") - RegisterType((*uint32Value)(nil), "gogo.protobuf.proto.UInt32Value") - RegisterType((*boolValue)(nil), "gogo.protobuf.proto.BoolValue") - RegisterType((*stringValue)(nil), "gogo.protobuf.proto.StringValue") - RegisterType((*bytesValue)(nil), "gogo.protobuf.proto.BytesValue") -} diff --git a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/Makefile b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/Makefile deleted file mode 100644 index 3496dc99d..000000000 --- a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# Go support for Protocol Buffers - Google's data interchange format -# -# Copyright 2010 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. - -regenerate: - go install github.com/gogo/protobuf/protoc-gen-gogo - go install github.com/gogo/protobuf/protoc-gen-gostring - protoc --gogo_out=. -I=../../protobuf/google/protobuf ../../protobuf/google/protobuf/descriptor.proto - protoc --gostring_out=. -I=../../protobuf/google/protobuf ../../protobuf/google/protobuf/descriptor.proto diff --git a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.go b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.go deleted file mode 100644 index a85bf1984..000000000 --- a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.go +++ /dev/null @@ -1,118 +0,0 @@ -// 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 descriptor provides functions for obtaining protocol buffer -// descriptors for generated Go types. -// -// These functions cannot go in package proto because they depend on the -// generated protobuf descriptor messages, which themselves depend on proto. -package descriptor - -import ( - "bytes" - "compress/gzip" - "fmt" - "io/ioutil" - - "github.com/gogo/protobuf/proto" -) - -// extractFile extracts a FileDescriptorProto from a gzip'd buffer. -func extractFile(gz []byte) (*FileDescriptorProto, error) { - r, err := gzip.NewReader(bytes.NewReader(gz)) - if err != nil { - return nil, fmt.Errorf("failed to open gzip reader: %v", err) - } - defer r.Close() - - b, err := ioutil.ReadAll(r) - if err != nil { - return nil, fmt.Errorf("failed to uncompress descriptor: %v", err) - } - - fd := new(FileDescriptorProto) - if err := proto.Unmarshal(b, fd); err != nil { - return nil, fmt.Errorf("malformed FileDescriptorProto: %v", err) - } - - return fd, nil -} - -// Message is a proto.Message with a method to return its descriptor. -// -// Message types generated by the protocol compiler always satisfy -// the Message interface. -type Message interface { - proto.Message - Descriptor() ([]byte, []int) -} - -// ForMessage returns a FileDescriptorProto and a DescriptorProto from within it -// describing the given message. -func ForMessage(msg Message) (fd *FileDescriptorProto, md *DescriptorProto) { - gz, path := msg.Descriptor() - fd, err := extractFile(gz) - if err != nil { - panic(fmt.Sprintf("invalid FileDescriptorProto for %T: %v", msg, err)) - } - - md = fd.MessageType[path[0]] - for _, i := range path[1:] { - md = md.NestedType[i] - } - return fd, md -} - -// Is this field a scalar numeric type? -func (field *FieldDescriptorProto) IsScalar() bool { - if field.Type == nil { - return false - } - switch *field.Type { - case FieldDescriptorProto_TYPE_DOUBLE, - FieldDescriptorProto_TYPE_FLOAT, - FieldDescriptorProto_TYPE_INT64, - FieldDescriptorProto_TYPE_UINT64, - FieldDescriptorProto_TYPE_INT32, - FieldDescriptorProto_TYPE_FIXED64, - FieldDescriptorProto_TYPE_FIXED32, - FieldDescriptorProto_TYPE_BOOL, - FieldDescriptorProto_TYPE_UINT32, - FieldDescriptorProto_TYPE_ENUM, - FieldDescriptorProto_TYPE_SFIXED32, - FieldDescriptorProto_TYPE_SFIXED64, - FieldDescriptorProto_TYPE_SINT32, - FieldDescriptorProto_TYPE_SINT64: - return true - default: - return false - } -} diff --git a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.pb.go b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.pb.go deleted file mode 100644 index 18b2a3318..000000000 --- a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.pb.go +++ /dev/null @@ -1,2865 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: descriptor.proto - -package descriptor - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type FieldDescriptorProto_Type int32 - -const ( - // 0 is reserved for errors. - // Order is weird for historical reasons. - FieldDescriptorProto_TYPE_DOUBLE FieldDescriptorProto_Type = 1 - FieldDescriptorProto_TYPE_FLOAT FieldDescriptorProto_Type = 2 - // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if - // negative values are likely. - FieldDescriptorProto_TYPE_INT64 FieldDescriptorProto_Type = 3 - FieldDescriptorProto_TYPE_UINT64 FieldDescriptorProto_Type = 4 - // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if - // negative values are likely. - FieldDescriptorProto_TYPE_INT32 FieldDescriptorProto_Type = 5 - FieldDescriptorProto_TYPE_FIXED64 FieldDescriptorProto_Type = 6 - FieldDescriptorProto_TYPE_FIXED32 FieldDescriptorProto_Type = 7 - FieldDescriptorProto_TYPE_BOOL FieldDescriptorProto_Type = 8 - FieldDescriptorProto_TYPE_STRING FieldDescriptorProto_Type = 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. - FieldDescriptorProto_TYPE_GROUP FieldDescriptorProto_Type = 10 - FieldDescriptorProto_TYPE_MESSAGE FieldDescriptorProto_Type = 11 - // New in version 2. - FieldDescriptorProto_TYPE_BYTES FieldDescriptorProto_Type = 12 - FieldDescriptorProto_TYPE_UINT32 FieldDescriptorProto_Type = 13 - FieldDescriptorProto_TYPE_ENUM FieldDescriptorProto_Type = 14 - FieldDescriptorProto_TYPE_SFIXED32 FieldDescriptorProto_Type = 15 - FieldDescriptorProto_TYPE_SFIXED64 FieldDescriptorProto_Type = 16 - FieldDescriptorProto_TYPE_SINT32 FieldDescriptorProto_Type = 17 - FieldDescriptorProto_TYPE_SINT64 FieldDescriptorProto_Type = 18 -) - -var FieldDescriptorProto_Type_name = map[int32]string{ - 1: "TYPE_DOUBLE", - 2: "TYPE_FLOAT", - 3: "TYPE_INT64", - 4: "TYPE_UINT64", - 5: "TYPE_INT32", - 6: "TYPE_FIXED64", - 7: "TYPE_FIXED32", - 8: "TYPE_BOOL", - 9: "TYPE_STRING", - 10: "TYPE_GROUP", - 11: "TYPE_MESSAGE", - 12: "TYPE_BYTES", - 13: "TYPE_UINT32", - 14: "TYPE_ENUM", - 15: "TYPE_SFIXED32", - 16: "TYPE_SFIXED64", - 17: "TYPE_SINT32", - 18: "TYPE_SINT64", -} - -var FieldDescriptorProto_Type_value = map[string]int32{ - "TYPE_DOUBLE": 1, - "TYPE_FLOAT": 2, - "TYPE_INT64": 3, - "TYPE_UINT64": 4, - "TYPE_INT32": 5, - "TYPE_FIXED64": 6, - "TYPE_FIXED32": 7, - "TYPE_BOOL": 8, - "TYPE_STRING": 9, - "TYPE_GROUP": 10, - "TYPE_MESSAGE": 11, - "TYPE_BYTES": 12, - "TYPE_UINT32": 13, - "TYPE_ENUM": 14, - "TYPE_SFIXED32": 15, - "TYPE_SFIXED64": 16, - "TYPE_SINT32": 17, - "TYPE_SINT64": 18, -} - -func (x FieldDescriptorProto_Type) Enum() *FieldDescriptorProto_Type { - p := new(FieldDescriptorProto_Type) - *p = x - return p -} - -func (x FieldDescriptorProto_Type) String() string { - return proto.EnumName(FieldDescriptorProto_Type_name, int32(x)) -} - -func (x *FieldDescriptorProto_Type) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FieldDescriptorProto_Type_value, data, "FieldDescriptorProto_Type") - if err != nil { - return err - } - *x = FieldDescriptorProto_Type(value) - return nil -} - -func (FieldDescriptorProto_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{4, 0} -} - -type FieldDescriptorProto_Label int32 - -const ( - // 0 is reserved for errors - FieldDescriptorProto_LABEL_OPTIONAL FieldDescriptorProto_Label = 1 - FieldDescriptorProto_LABEL_REQUIRED FieldDescriptorProto_Label = 2 - FieldDescriptorProto_LABEL_REPEATED FieldDescriptorProto_Label = 3 -) - -var FieldDescriptorProto_Label_name = map[int32]string{ - 1: "LABEL_OPTIONAL", - 2: "LABEL_REQUIRED", - 3: "LABEL_REPEATED", -} - -var FieldDescriptorProto_Label_value = map[string]int32{ - "LABEL_OPTIONAL": 1, - "LABEL_REQUIRED": 2, - "LABEL_REPEATED": 3, -} - -func (x FieldDescriptorProto_Label) Enum() *FieldDescriptorProto_Label { - p := new(FieldDescriptorProto_Label) - *p = x - return p -} - -func (x FieldDescriptorProto_Label) String() string { - return proto.EnumName(FieldDescriptorProto_Label_name, int32(x)) -} - -func (x *FieldDescriptorProto_Label) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FieldDescriptorProto_Label_value, data, "FieldDescriptorProto_Label") - if err != nil { - return err - } - *x = FieldDescriptorProto_Label(value) - return nil -} - -func (FieldDescriptorProto_Label) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{4, 1} -} - -// Generated classes can be optimized for speed or code size. -type FileOptions_OptimizeMode int32 - -const ( - FileOptions_SPEED FileOptions_OptimizeMode = 1 - // etc. - FileOptions_CODE_SIZE FileOptions_OptimizeMode = 2 - FileOptions_LITE_RUNTIME FileOptions_OptimizeMode = 3 -) - -var FileOptions_OptimizeMode_name = map[int32]string{ - 1: "SPEED", - 2: "CODE_SIZE", - 3: "LITE_RUNTIME", -} - -var FileOptions_OptimizeMode_value = map[string]int32{ - "SPEED": 1, - "CODE_SIZE": 2, - "LITE_RUNTIME": 3, -} - -func (x FileOptions_OptimizeMode) Enum() *FileOptions_OptimizeMode { - p := new(FileOptions_OptimizeMode) - *p = x - return p -} - -func (x FileOptions_OptimizeMode) String() string { - return proto.EnumName(FileOptions_OptimizeMode_name, int32(x)) -} - -func (x *FileOptions_OptimizeMode) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FileOptions_OptimizeMode_value, data, "FileOptions_OptimizeMode") - if err != nil { - return err - } - *x = FileOptions_OptimizeMode(value) - return nil -} - -func (FileOptions_OptimizeMode) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{10, 0} -} - -type FieldOptions_CType int32 - -const ( - // Default mode. - FieldOptions_STRING FieldOptions_CType = 0 - FieldOptions_CORD FieldOptions_CType = 1 - FieldOptions_STRING_PIECE FieldOptions_CType = 2 -) - -var FieldOptions_CType_name = map[int32]string{ - 0: "STRING", - 1: "CORD", - 2: "STRING_PIECE", -} - -var FieldOptions_CType_value = map[string]int32{ - "STRING": 0, - "CORD": 1, - "STRING_PIECE": 2, -} - -func (x FieldOptions_CType) Enum() *FieldOptions_CType { - p := new(FieldOptions_CType) - *p = x - return p -} - -func (x FieldOptions_CType) String() string { - return proto.EnumName(FieldOptions_CType_name, int32(x)) -} - -func (x *FieldOptions_CType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FieldOptions_CType_value, data, "FieldOptions_CType") - if err != nil { - return err - } - *x = FieldOptions_CType(value) - return nil -} - -func (FieldOptions_CType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{12, 0} -} - -type FieldOptions_JSType int32 - -const ( - // Use the default type. - FieldOptions_JS_NORMAL FieldOptions_JSType = 0 - // Use JavaScript strings. - FieldOptions_JS_STRING FieldOptions_JSType = 1 - // Use JavaScript numbers. - FieldOptions_JS_NUMBER FieldOptions_JSType = 2 -) - -var FieldOptions_JSType_name = map[int32]string{ - 0: "JS_NORMAL", - 1: "JS_STRING", - 2: "JS_NUMBER", -} - -var FieldOptions_JSType_value = map[string]int32{ - "JS_NORMAL": 0, - "JS_STRING": 1, - "JS_NUMBER": 2, -} - -func (x FieldOptions_JSType) Enum() *FieldOptions_JSType { - p := new(FieldOptions_JSType) - *p = x - return p -} - -func (x FieldOptions_JSType) String() string { - return proto.EnumName(FieldOptions_JSType_name, int32(x)) -} - -func (x *FieldOptions_JSType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FieldOptions_JSType_value, data, "FieldOptions_JSType") - if err != nil { - return err - } - *x = FieldOptions_JSType(value) - return nil -} - -func (FieldOptions_JSType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{12, 1} -} - -// 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. -type MethodOptions_IdempotencyLevel int32 - -const ( - MethodOptions_IDEMPOTENCY_UNKNOWN MethodOptions_IdempotencyLevel = 0 - MethodOptions_NO_SIDE_EFFECTS MethodOptions_IdempotencyLevel = 1 - MethodOptions_IDEMPOTENT MethodOptions_IdempotencyLevel = 2 -) - -var MethodOptions_IdempotencyLevel_name = map[int32]string{ - 0: "IDEMPOTENCY_UNKNOWN", - 1: "NO_SIDE_EFFECTS", - 2: "IDEMPOTENT", -} - -var MethodOptions_IdempotencyLevel_value = map[string]int32{ - "IDEMPOTENCY_UNKNOWN": 0, - "NO_SIDE_EFFECTS": 1, - "IDEMPOTENT": 2, -} - -func (x MethodOptions_IdempotencyLevel) Enum() *MethodOptions_IdempotencyLevel { - p := new(MethodOptions_IdempotencyLevel) - *p = x - return p -} - -func (x MethodOptions_IdempotencyLevel) String() string { - return proto.EnumName(MethodOptions_IdempotencyLevel_name, int32(x)) -} - -func (x *MethodOptions_IdempotencyLevel) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(MethodOptions_IdempotencyLevel_value, data, "MethodOptions_IdempotencyLevel") - if err != nil { - return err - } - *x = MethodOptions_IdempotencyLevel(value) - return nil -} - -func (MethodOptions_IdempotencyLevel) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{17, 0} -} - -// The protocol compiler can output a FileDescriptorSet containing the .proto -// files it parses. -type FileDescriptorSet struct { - File []*FileDescriptorProto `protobuf:"bytes,1,rep,name=file" json:"file,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FileDescriptorSet) Reset() { *m = FileDescriptorSet{} } -func (m *FileDescriptorSet) String() string { return proto.CompactTextString(m) } -func (*FileDescriptorSet) ProtoMessage() {} -func (*FileDescriptorSet) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{0} -} -func (m *FileDescriptorSet) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FileDescriptorSet.Unmarshal(m, b) -} -func (m *FileDescriptorSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FileDescriptorSet.Marshal(b, m, deterministic) -} -func (m *FileDescriptorSet) XXX_Merge(src proto.Message) { - xxx_messageInfo_FileDescriptorSet.Merge(m, src) -} -func (m *FileDescriptorSet) XXX_Size() int { - return xxx_messageInfo_FileDescriptorSet.Size(m) -} -func (m *FileDescriptorSet) XXX_DiscardUnknown() { - xxx_messageInfo_FileDescriptorSet.DiscardUnknown(m) -} - -var xxx_messageInfo_FileDescriptorSet proto.InternalMessageInfo - -func (m *FileDescriptorSet) GetFile() []*FileDescriptorProto { - if m != nil { - return m.File - } - return nil -} - -// Describes a complete .proto file. -type FileDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Package *string `protobuf:"bytes,2,opt,name=package" json:"package,omitempty"` - // Names of files imported by this file. - Dependency []string `protobuf:"bytes,3,rep,name=dependency" json:"dependency,omitempty"` - // Indexes of the public imported files in the dependency list above. - PublicDependency []int32 `protobuf:"varint,10,rep,name=public_dependency,json=publicDependency" json:"public_dependency,omitempty"` - // Indexes of the weak imported files in the dependency list. - // For Google-internal migration only. Do not use. - WeakDependency []int32 `protobuf:"varint,11,rep,name=weak_dependency,json=weakDependency" json:"weak_dependency,omitempty"` - // All top-level definitions in this file. - MessageType []*DescriptorProto `protobuf:"bytes,4,rep,name=message_type,json=messageType" json:"message_type,omitempty"` - EnumType []*EnumDescriptorProto `protobuf:"bytes,5,rep,name=enum_type,json=enumType" json:"enum_type,omitempty"` - Service []*ServiceDescriptorProto `protobuf:"bytes,6,rep,name=service" json:"service,omitempty"` - Extension []*FieldDescriptorProto `protobuf:"bytes,7,rep,name=extension" json:"extension,omitempty"` - Options *FileOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` - // 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. - SourceCodeInfo *SourceCodeInfo `protobuf:"bytes,9,opt,name=source_code_info,json=sourceCodeInfo" json:"source_code_info,omitempty"` - // The syntax of the proto file. - // The supported values are "proto2" and "proto3". - Syntax *string `protobuf:"bytes,12,opt,name=syntax" json:"syntax,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FileDescriptorProto) Reset() { *m = FileDescriptorProto{} } -func (m *FileDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*FileDescriptorProto) ProtoMessage() {} -func (*FileDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{1} -} -func (m *FileDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FileDescriptorProto.Unmarshal(m, b) -} -func (m *FileDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FileDescriptorProto.Marshal(b, m, deterministic) -} -func (m *FileDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_FileDescriptorProto.Merge(m, src) -} -func (m *FileDescriptorProto) XXX_Size() int { - return xxx_messageInfo_FileDescriptorProto.Size(m) -} -func (m *FileDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_FileDescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_FileDescriptorProto proto.InternalMessageInfo - -func (m *FileDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *FileDescriptorProto) GetPackage() string { - if m != nil && m.Package != nil { - return *m.Package - } - return "" -} - -func (m *FileDescriptorProto) GetDependency() []string { - if m != nil { - return m.Dependency - } - return nil -} - -func (m *FileDescriptorProto) GetPublicDependency() []int32 { - if m != nil { - return m.PublicDependency - } - return nil -} - -func (m *FileDescriptorProto) GetWeakDependency() []int32 { - if m != nil { - return m.WeakDependency - } - return nil -} - -func (m *FileDescriptorProto) GetMessageType() []*DescriptorProto { - if m != nil { - return m.MessageType - } - return nil -} - -func (m *FileDescriptorProto) GetEnumType() []*EnumDescriptorProto { - if m != nil { - return m.EnumType - } - return nil -} - -func (m *FileDescriptorProto) GetService() []*ServiceDescriptorProto { - if m != nil { - return m.Service - } - return nil -} - -func (m *FileDescriptorProto) GetExtension() []*FieldDescriptorProto { - if m != nil { - return m.Extension - } - return nil -} - -func (m *FileDescriptorProto) GetOptions() *FileOptions { - if m != nil { - return m.Options - } - return nil -} - -func (m *FileDescriptorProto) GetSourceCodeInfo() *SourceCodeInfo { - if m != nil { - return m.SourceCodeInfo - } - return nil -} - -func (m *FileDescriptorProto) GetSyntax() string { - if m != nil && m.Syntax != nil { - return *m.Syntax - } - return "" -} - -// Describes a message type. -type DescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Field []*FieldDescriptorProto `protobuf:"bytes,2,rep,name=field" json:"field,omitempty"` - Extension []*FieldDescriptorProto `protobuf:"bytes,6,rep,name=extension" json:"extension,omitempty"` - NestedType []*DescriptorProto `protobuf:"bytes,3,rep,name=nested_type,json=nestedType" json:"nested_type,omitempty"` - EnumType []*EnumDescriptorProto `protobuf:"bytes,4,rep,name=enum_type,json=enumType" json:"enum_type,omitempty"` - ExtensionRange []*DescriptorProto_ExtensionRange `protobuf:"bytes,5,rep,name=extension_range,json=extensionRange" json:"extension_range,omitempty"` - OneofDecl []*OneofDescriptorProto `protobuf:"bytes,8,rep,name=oneof_decl,json=oneofDecl" json:"oneof_decl,omitempty"` - Options *MessageOptions `protobuf:"bytes,7,opt,name=options" json:"options,omitempty"` - ReservedRange []*DescriptorProto_ReservedRange `protobuf:"bytes,9,rep,name=reserved_range,json=reservedRange" json:"reserved_range,omitempty"` - // Reserved field names, which may not be used by fields in the same message. - // A given name may only be reserved once. - ReservedName []string `protobuf:"bytes,10,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DescriptorProto) Reset() { *m = DescriptorProto{} } -func (m *DescriptorProto) String() string { return proto.CompactTextString(m) } -func (*DescriptorProto) ProtoMessage() {} -func (*DescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{2} -} -func (m *DescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DescriptorProto.Unmarshal(m, b) -} -func (m *DescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DescriptorProto.Marshal(b, m, deterministic) -} -func (m *DescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_DescriptorProto.Merge(m, src) -} -func (m *DescriptorProto) XXX_Size() int { - return xxx_messageInfo_DescriptorProto.Size(m) -} -func (m *DescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_DescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_DescriptorProto proto.InternalMessageInfo - -func (m *DescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *DescriptorProto) GetField() []*FieldDescriptorProto { - if m != nil { - return m.Field - } - return nil -} - -func (m *DescriptorProto) GetExtension() []*FieldDescriptorProto { - if m != nil { - return m.Extension - } - return nil -} - -func (m *DescriptorProto) GetNestedType() []*DescriptorProto { - if m != nil { - return m.NestedType - } - return nil -} - -func (m *DescriptorProto) GetEnumType() []*EnumDescriptorProto { - if m != nil { - return m.EnumType - } - return nil -} - -func (m *DescriptorProto) GetExtensionRange() []*DescriptorProto_ExtensionRange { - if m != nil { - return m.ExtensionRange - } - return nil -} - -func (m *DescriptorProto) GetOneofDecl() []*OneofDescriptorProto { - if m != nil { - return m.OneofDecl - } - return nil -} - -func (m *DescriptorProto) GetOptions() *MessageOptions { - if m != nil { - return m.Options - } - return nil -} - -func (m *DescriptorProto) GetReservedRange() []*DescriptorProto_ReservedRange { - if m != nil { - return m.ReservedRange - } - return nil -} - -func (m *DescriptorProto) GetReservedName() []string { - if m != nil { - return m.ReservedName - } - return nil -} - -type DescriptorProto_ExtensionRange struct { - Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` - End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` - Options *ExtensionRangeOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DescriptorProto_ExtensionRange) Reset() { *m = DescriptorProto_ExtensionRange{} } -func (m *DescriptorProto_ExtensionRange) String() string { return proto.CompactTextString(m) } -func (*DescriptorProto_ExtensionRange) ProtoMessage() {} -func (*DescriptorProto_ExtensionRange) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{2, 0} -} -func (m *DescriptorProto_ExtensionRange) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DescriptorProto_ExtensionRange.Unmarshal(m, b) -} -func (m *DescriptorProto_ExtensionRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DescriptorProto_ExtensionRange.Marshal(b, m, deterministic) -} -func (m *DescriptorProto_ExtensionRange) XXX_Merge(src proto.Message) { - xxx_messageInfo_DescriptorProto_ExtensionRange.Merge(m, src) -} -func (m *DescriptorProto_ExtensionRange) XXX_Size() int { - return xxx_messageInfo_DescriptorProto_ExtensionRange.Size(m) -} -func (m *DescriptorProto_ExtensionRange) XXX_DiscardUnknown() { - xxx_messageInfo_DescriptorProto_ExtensionRange.DiscardUnknown(m) -} - -var xxx_messageInfo_DescriptorProto_ExtensionRange proto.InternalMessageInfo - -func (m *DescriptorProto_ExtensionRange) GetStart() int32 { - if m != nil && m.Start != nil { - return *m.Start - } - return 0 -} - -func (m *DescriptorProto_ExtensionRange) GetEnd() int32 { - if m != nil && m.End != nil { - return *m.End - } - return 0 -} - -func (m *DescriptorProto_ExtensionRange) GetOptions() *ExtensionRangeOptions { - if m != nil { - return m.Options - } - return nil -} - -// 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. -type DescriptorProto_ReservedRange struct { - Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` - End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DescriptorProto_ReservedRange) Reset() { *m = DescriptorProto_ReservedRange{} } -func (m *DescriptorProto_ReservedRange) String() string { return proto.CompactTextString(m) } -func (*DescriptorProto_ReservedRange) ProtoMessage() {} -func (*DescriptorProto_ReservedRange) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{2, 1} -} -func (m *DescriptorProto_ReservedRange) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DescriptorProto_ReservedRange.Unmarshal(m, b) -} -func (m *DescriptorProto_ReservedRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DescriptorProto_ReservedRange.Marshal(b, m, deterministic) -} -func (m *DescriptorProto_ReservedRange) XXX_Merge(src proto.Message) { - xxx_messageInfo_DescriptorProto_ReservedRange.Merge(m, src) -} -func (m *DescriptorProto_ReservedRange) XXX_Size() int { - return xxx_messageInfo_DescriptorProto_ReservedRange.Size(m) -} -func (m *DescriptorProto_ReservedRange) XXX_DiscardUnknown() { - xxx_messageInfo_DescriptorProto_ReservedRange.DiscardUnknown(m) -} - -var xxx_messageInfo_DescriptorProto_ReservedRange proto.InternalMessageInfo - -func (m *DescriptorProto_ReservedRange) GetStart() int32 { - if m != nil && m.Start != nil { - return *m.Start - } - return 0 -} - -func (m *DescriptorProto_ReservedRange) GetEnd() int32 { - if m != nil && m.End != nil { - return *m.End - } - return 0 -} - -type ExtensionRangeOptions struct { - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ExtensionRangeOptions) Reset() { *m = ExtensionRangeOptions{} } -func (m *ExtensionRangeOptions) String() string { return proto.CompactTextString(m) } -func (*ExtensionRangeOptions) ProtoMessage() {} -func (*ExtensionRangeOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{3} -} - -var extRange_ExtensionRangeOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*ExtensionRangeOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_ExtensionRangeOptions -} - -func (m *ExtensionRangeOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ExtensionRangeOptions.Unmarshal(m, b) -} -func (m *ExtensionRangeOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ExtensionRangeOptions.Marshal(b, m, deterministic) -} -func (m *ExtensionRangeOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExtensionRangeOptions.Merge(m, src) -} -func (m *ExtensionRangeOptions) XXX_Size() int { - return xxx_messageInfo_ExtensionRangeOptions.Size(m) -} -func (m *ExtensionRangeOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ExtensionRangeOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_ExtensionRangeOptions proto.InternalMessageInfo - -func (m *ExtensionRangeOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -// Describes a field within a message. -type FieldDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Number *int32 `protobuf:"varint,3,opt,name=number" json:"number,omitempty"` - Label *FieldDescriptorProto_Label `protobuf:"varint,4,opt,name=label,enum=google.protobuf.FieldDescriptorProto_Label" json:"label,omitempty"` - // 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. - Type *FieldDescriptorProto_Type `protobuf:"varint,5,opt,name=type,enum=google.protobuf.FieldDescriptorProto_Type" json:"type,omitempty"` - // 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). - TypeName *string `protobuf:"bytes,6,opt,name=type_name,json=typeName" json:"type_name,omitempty"` - // For extensions, this is the name of the type being extended. It is - // resolved in the same manner as type_name. - Extendee *string `protobuf:"bytes,2,opt,name=extendee" json:"extendee,omitempty"` - // 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? - DefaultValue *string `protobuf:"bytes,7,opt,name=default_value,json=defaultValue" json:"default_value,omitempty"` - // If set, gives the index of a oneof in the containing type's oneof_decl - // list. This field is a member of that oneof. - OneofIndex *int32 `protobuf:"varint,9,opt,name=oneof_index,json=oneofIndex" json:"oneof_index,omitempty"` - // 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. - JsonName *string `protobuf:"bytes,10,opt,name=json_name,json=jsonName" json:"json_name,omitempty"` - Options *FieldOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FieldDescriptorProto) Reset() { *m = FieldDescriptorProto{} } -func (m *FieldDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*FieldDescriptorProto) ProtoMessage() {} -func (*FieldDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{4} -} -func (m *FieldDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FieldDescriptorProto.Unmarshal(m, b) -} -func (m *FieldDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FieldDescriptorProto.Marshal(b, m, deterministic) -} -func (m *FieldDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_FieldDescriptorProto.Merge(m, src) -} -func (m *FieldDescriptorProto) XXX_Size() int { - return xxx_messageInfo_FieldDescriptorProto.Size(m) -} -func (m *FieldDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_FieldDescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_FieldDescriptorProto proto.InternalMessageInfo - -func (m *FieldDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *FieldDescriptorProto) GetNumber() int32 { - if m != nil && m.Number != nil { - return *m.Number - } - return 0 -} - -func (m *FieldDescriptorProto) GetLabel() FieldDescriptorProto_Label { - if m != nil && m.Label != nil { - return *m.Label - } - return FieldDescriptorProto_LABEL_OPTIONAL -} - -func (m *FieldDescriptorProto) GetType() FieldDescriptorProto_Type { - if m != nil && m.Type != nil { - return *m.Type - } - return FieldDescriptorProto_TYPE_DOUBLE -} - -func (m *FieldDescriptorProto) GetTypeName() string { - if m != nil && m.TypeName != nil { - return *m.TypeName - } - return "" -} - -func (m *FieldDescriptorProto) GetExtendee() string { - if m != nil && m.Extendee != nil { - return *m.Extendee - } - return "" -} - -func (m *FieldDescriptorProto) GetDefaultValue() string { - if m != nil && m.DefaultValue != nil { - return *m.DefaultValue - } - return "" -} - -func (m *FieldDescriptorProto) GetOneofIndex() int32 { - if m != nil && m.OneofIndex != nil { - return *m.OneofIndex - } - return 0 -} - -func (m *FieldDescriptorProto) GetJsonName() string { - if m != nil && m.JsonName != nil { - return *m.JsonName - } - return "" -} - -func (m *FieldDescriptorProto) GetOptions() *FieldOptions { - if m != nil { - return m.Options - } - return nil -} - -// Describes a oneof. -type OneofDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Options *OneofOptions `protobuf:"bytes,2,opt,name=options" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OneofDescriptorProto) Reset() { *m = OneofDescriptorProto{} } -func (m *OneofDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*OneofDescriptorProto) ProtoMessage() {} -func (*OneofDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{5} -} -func (m *OneofDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OneofDescriptorProto.Unmarshal(m, b) -} -func (m *OneofDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OneofDescriptorProto.Marshal(b, m, deterministic) -} -func (m *OneofDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_OneofDescriptorProto.Merge(m, src) -} -func (m *OneofDescriptorProto) XXX_Size() int { - return xxx_messageInfo_OneofDescriptorProto.Size(m) -} -func (m *OneofDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_OneofDescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_OneofDescriptorProto proto.InternalMessageInfo - -func (m *OneofDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *OneofDescriptorProto) GetOptions() *OneofOptions { - if m != nil { - return m.Options - } - return nil -} - -// Describes an enum type. -type EnumDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Value []*EnumValueDescriptorProto `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"` - Options *EnumOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` - // 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. - ReservedRange []*EnumDescriptorProto_EnumReservedRange `protobuf:"bytes,4,rep,name=reserved_range,json=reservedRange" json:"reserved_range,omitempty"` - // Reserved enum value names, which may not be reused. A given name may only - // be reserved once. - ReservedName []string `protobuf:"bytes,5,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EnumDescriptorProto) Reset() { *m = EnumDescriptorProto{} } -func (m *EnumDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*EnumDescriptorProto) ProtoMessage() {} -func (*EnumDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{6} -} -func (m *EnumDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EnumDescriptorProto.Unmarshal(m, b) -} -func (m *EnumDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EnumDescriptorProto.Marshal(b, m, deterministic) -} -func (m *EnumDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_EnumDescriptorProto.Merge(m, src) -} -func (m *EnumDescriptorProto) XXX_Size() int { - return xxx_messageInfo_EnumDescriptorProto.Size(m) -} -func (m *EnumDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_EnumDescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_EnumDescriptorProto proto.InternalMessageInfo - -func (m *EnumDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *EnumDescriptorProto) GetValue() []*EnumValueDescriptorProto { - if m != nil { - return m.Value - } - return nil -} - -func (m *EnumDescriptorProto) GetOptions() *EnumOptions { - if m != nil { - return m.Options - } - return nil -} - -func (m *EnumDescriptorProto) GetReservedRange() []*EnumDescriptorProto_EnumReservedRange { - if m != nil { - return m.ReservedRange - } - return nil -} - -func (m *EnumDescriptorProto) GetReservedName() []string { - if m != nil { - return m.ReservedName - } - return nil -} - -// 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. -type EnumDescriptorProto_EnumReservedRange struct { - Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` - End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EnumDescriptorProto_EnumReservedRange) Reset() { *m = EnumDescriptorProto_EnumReservedRange{} } -func (m *EnumDescriptorProto_EnumReservedRange) String() string { return proto.CompactTextString(m) } -func (*EnumDescriptorProto_EnumReservedRange) ProtoMessage() {} -func (*EnumDescriptorProto_EnumReservedRange) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{6, 0} -} -func (m *EnumDescriptorProto_EnumReservedRange) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Unmarshal(m, b) -} -func (m *EnumDescriptorProto_EnumReservedRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Marshal(b, m, deterministic) -} -func (m *EnumDescriptorProto_EnumReservedRange) XXX_Merge(src proto.Message) { - xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Merge(m, src) -} -func (m *EnumDescriptorProto_EnumReservedRange) XXX_Size() int { - return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Size(m) -} -func (m *EnumDescriptorProto_EnumReservedRange) XXX_DiscardUnknown() { - xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.DiscardUnknown(m) -} - -var xxx_messageInfo_EnumDescriptorProto_EnumReservedRange proto.InternalMessageInfo - -func (m *EnumDescriptorProto_EnumReservedRange) GetStart() int32 { - if m != nil && m.Start != nil { - return *m.Start - } - return 0 -} - -func (m *EnumDescriptorProto_EnumReservedRange) GetEnd() int32 { - if m != nil && m.End != nil { - return *m.End - } - return 0 -} - -// Describes a value within an enum. -type EnumValueDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Number *int32 `protobuf:"varint,2,opt,name=number" json:"number,omitempty"` - Options *EnumValueOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EnumValueDescriptorProto) Reset() { *m = EnumValueDescriptorProto{} } -func (m *EnumValueDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*EnumValueDescriptorProto) ProtoMessage() {} -func (*EnumValueDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{7} -} -func (m *EnumValueDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EnumValueDescriptorProto.Unmarshal(m, b) -} -func (m *EnumValueDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EnumValueDescriptorProto.Marshal(b, m, deterministic) -} -func (m *EnumValueDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_EnumValueDescriptorProto.Merge(m, src) -} -func (m *EnumValueDescriptorProto) XXX_Size() int { - return xxx_messageInfo_EnumValueDescriptorProto.Size(m) -} -func (m *EnumValueDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_EnumValueDescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_EnumValueDescriptorProto proto.InternalMessageInfo - -func (m *EnumValueDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *EnumValueDescriptorProto) GetNumber() int32 { - if m != nil && m.Number != nil { - return *m.Number - } - return 0 -} - -func (m *EnumValueDescriptorProto) GetOptions() *EnumValueOptions { - if m != nil { - return m.Options - } - return nil -} - -// Describes a service. -type ServiceDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Method []*MethodDescriptorProto `protobuf:"bytes,2,rep,name=method" json:"method,omitempty"` - Options *ServiceOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ServiceDescriptorProto) Reset() { *m = ServiceDescriptorProto{} } -func (m *ServiceDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*ServiceDescriptorProto) ProtoMessage() {} -func (*ServiceDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{8} -} -func (m *ServiceDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ServiceDescriptorProto.Unmarshal(m, b) -} -func (m *ServiceDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ServiceDescriptorProto.Marshal(b, m, deterministic) -} -func (m *ServiceDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServiceDescriptorProto.Merge(m, src) -} -func (m *ServiceDescriptorProto) XXX_Size() int { - return xxx_messageInfo_ServiceDescriptorProto.Size(m) -} -func (m *ServiceDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_ServiceDescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_ServiceDescriptorProto proto.InternalMessageInfo - -func (m *ServiceDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *ServiceDescriptorProto) GetMethod() []*MethodDescriptorProto { - if m != nil { - return m.Method - } - return nil -} - -func (m *ServiceDescriptorProto) GetOptions() *ServiceOptions { - if m != nil { - return m.Options - } - return nil -} - -// Describes a method of a service. -type MethodDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - // Input and output type names. These are resolved in the same way as - // FieldDescriptorProto.type_name, but must refer to a message type. - InputType *string `protobuf:"bytes,2,opt,name=input_type,json=inputType" json:"input_type,omitempty"` - OutputType *string `protobuf:"bytes,3,opt,name=output_type,json=outputType" json:"output_type,omitempty"` - Options *MethodOptions `protobuf:"bytes,4,opt,name=options" json:"options,omitempty"` - // Identifies if client streams multiple client messages - ClientStreaming *bool `protobuf:"varint,5,opt,name=client_streaming,json=clientStreaming,def=0" json:"client_streaming,omitempty"` - // Identifies if server streams multiple server messages - ServerStreaming *bool `protobuf:"varint,6,opt,name=server_streaming,json=serverStreaming,def=0" json:"server_streaming,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MethodDescriptorProto) Reset() { *m = MethodDescriptorProto{} } -func (m *MethodDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*MethodDescriptorProto) ProtoMessage() {} -func (*MethodDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{9} -} -func (m *MethodDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MethodDescriptorProto.Unmarshal(m, b) -} -func (m *MethodDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MethodDescriptorProto.Marshal(b, m, deterministic) -} -func (m *MethodDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_MethodDescriptorProto.Merge(m, src) -} -func (m *MethodDescriptorProto) XXX_Size() int { - return xxx_messageInfo_MethodDescriptorProto.Size(m) -} -func (m *MethodDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_MethodDescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_MethodDescriptorProto proto.InternalMessageInfo - -const Default_MethodDescriptorProto_ClientStreaming bool = false -const Default_MethodDescriptorProto_ServerStreaming bool = false - -func (m *MethodDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *MethodDescriptorProto) GetInputType() string { - if m != nil && m.InputType != nil { - return *m.InputType - } - return "" -} - -func (m *MethodDescriptorProto) GetOutputType() string { - if m != nil && m.OutputType != nil { - return *m.OutputType - } - return "" -} - -func (m *MethodDescriptorProto) GetOptions() *MethodOptions { - if m != nil { - return m.Options - } - return nil -} - -func (m *MethodDescriptorProto) GetClientStreaming() bool { - if m != nil && m.ClientStreaming != nil { - return *m.ClientStreaming - } - return Default_MethodDescriptorProto_ClientStreaming -} - -func (m *MethodDescriptorProto) GetServerStreaming() bool { - if m != nil && m.ServerStreaming != nil { - return *m.ServerStreaming - } - return Default_MethodDescriptorProto_ServerStreaming -} - -type FileOptions struct { - // 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. - JavaPackage *string `protobuf:"bytes,1,opt,name=java_package,json=javaPackage" json:"java_package,omitempty"` - // 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). - JavaOuterClassname *string `protobuf:"bytes,8,opt,name=java_outer_classname,json=javaOuterClassname" json:"java_outer_classname,omitempty"` - // 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. - JavaMultipleFiles *bool `protobuf:"varint,10,opt,name=java_multiple_files,json=javaMultipleFiles,def=0" json:"java_multiple_files,omitempty"` - // This option does nothing. - JavaGenerateEqualsAndHash *bool `protobuf:"varint,20,opt,name=java_generate_equals_and_hash,json=javaGenerateEqualsAndHash" json:"java_generate_equals_and_hash,omitempty"` // Deprecated: Do not use. - // 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. - JavaStringCheckUtf8 *bool `protobuf:"varint,27,opt,name=java_string_check_utf8,json=javaStringCheckUtf8,def=0" json:"java_string_check_utf8,omitempty"` - OptimizeFor *FileOptions_OptimizeMode `protobuf:"varint,9,opt,name=optimize_for,json=optimizeFor,enum=google.protobuf.FileOptions_OptimizeMode,def=1" json:"optimize_for,omitempty"` - // 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. - GoPackage *string `protobuf:"bytes,11,opt,name=go_package,json=goPackage" json:"go_package,omitempty"` - // 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. - CcGenericServices *bool `protobuf:"varint,16,opt,name=cc_generic_services,json=ccGenericServices,def=0" json:"cc_generic_services,omitempty"` - JavaGenericServices *bool `protobuf:"varint,17,opt,name=java_generic_services,json=javaGenericServices,def=0" json:"java_generic_services,omitempty"` - PyGenericServices *bool `protobuf:"varint,18,opt,name=py_generic_services,json=pyGenericServices,def=0" json:"py_generic_services,omitempty"` - PhpGenericServices *bool `protobuf:"varint,42,opt,name=php_generic_services,json=phpGenericServices,def=0" json:"php_generic_services,omitempty"` - // 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. - Deprecated *bool `protobuf:"varint,23,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // Enables the use of arenas for the proto messages in this file. This applies - // only to generated classes for C++. - CcEnableArenas *bool `protobuf:"varint,31,opt,name=cc_enable_arenas,json=ccEnableArenas,def=0" json:"cc_enable_arenas,omitempty"` - // Sets the objective c class prefix which is prepended to all objective c - // generated classes from this .proto. There is no default. - ObjcClassPrefix *string `protobuf:"bytes,36,opt,name=objc_class_prefix,json=objcClassPrefix" json:"objc_class_prefix,omitempty"` - // Namespace for generated classes; defaults to the package. - CsharpNamespace *string `protobuf:"bytes,37,opt,name=csharp_namespace,json=csharpNamespace" json:"csharp_namespace,omitempty"` - // 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. - SwiftPrefix *string `protobuf:"bytes,39,opt,name=swift_prefix,json=swiftPrefix" json:"swift_prefix,omitempty"` - // Sets the php class prefix which is prepended to all php generated classes - // from this .proto. Default is empty. - PhpClassPrefix *string `protobuf:"bytes,40,opt,name=php_class_prefix,json=phpClassPrefix" json:"php_class_prefix,omitempty"` - // 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. - PhpNamespace *string `protobuf:"bytes,41,opt,name=php_namespace,json=phpNamespace" json:"php_namespace,omitempty"` - // Use this option to change the namespace of php generated metadata classes. - // Default is empty. When this option is empty, the proto file name will be - // used for determining the namespace. - PhpMetadataNamespace *string `protobuf:"bytes,44,opt,name=php_metadata_namespace,json=phpMetadataNamespace" json:"php_metadata_namespace,omitempty"` - // Use this option to change the package of ruby generated classes. Default - // is empty. When this option is not set, the package name will be used for - // determining the ruby package. - RubyPackage *string `protobuf:"bytes,45,opt,name=ruby_package,json=rubyPackage" json:"ruby_package,omitempty"` - // The parser stores options it doesn't recognize here. - // See the documentation for the "Options" section above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FileOptions) Reset() { *m = FileOptions{} } -func (m *FileOptions) String() string { return proto.CompactTextString(m) } -func (*FileOptions) ProtoMessage() {} -func (*FileOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{10} -} - -var extRange_FileOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*FileOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_FileOptions -} - -func (m *FileOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FileOptions.Unmarshal(m, b) -} -func (m *FileOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FileOptions.Marshal(b, m, deterministic) -} -func (m *FileOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_FileOptions.Merge(m, src) -} -func (m *FileOptions) XXX_Size() int { - return xxx_messageInfo_FileOptions.Size(m) -} -func (m *FileOptions) XXX_DiscardUnknown() { - xxx_messageInfo_FileOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_FileOptions proto.InternalMessageInfo - -const Default_FileOptions_JavaMultipleFiles bool = false -const Default_FileOptions_JavaStringCheckUtf8 bool = false -const Default_FileOptions_OptimizeFor FileOptions_OptimizeMode = FileOptions_SPEED -const Default_FileOptions_CcGenericServices bool = false -const Default_FileOptions_JavaGenericServices bool = false -const Default_FileOptions_PyGenericServices bool = false -const Default_FileOptions_PhpGenericServices bool = false -const Default_FileOptions_Deprecated bool = false -const Default_FileOptions_CcEnableArenas bool = false - -func (m *FileOptions) GetJavaPackage() string { - if m != nil && m.JavaPackage != nil { - return *m.JavaPackage - } - return "" -} - -func (m *FileOptions) GetJavaOuterClassname() string { - if m != nil && m.JavaOuterClassname != nil { - return *m.JavaOuterClassname - } - return "" -} - -func (m *FileOptions) GetJavaMultipleFiles() bool { - if m != nil && m.JavaMultipleFiles != nil { - return *m.JavaMultipleFiles - } - return Default_FileOptions_JavaMultipleFiles -} - -// Deprecated: Do not use. -func (m *FileOptions) GetJavaGenerateEqualsAndHash() bool { - if m != nil && m.JavaGenerateEqualsAndHash != nil { - return *m.JavaGenerateEqualsAndHash - } - return false -} - -func (m *FileOptions) GetJavaStringCheckUtf8() bool { - if m != nil && m.JavaStringCheckUtf8 != nil { - return *m.JavaStringCheckUtf8 - } - return Default_FileOptions_JavaStringCheckUtf8 -} - -func (m *FileOptions) GetOptimizeFor() FileOptions_OptimizeMode { - if m != nil && m.OptimizeFor != nil { - return *m.OptimizeFor - } - return Default_FileOptions_OptimizeFor -} - -func (m *FileOptions) GetGoPackage() string { - if m != nil && m.GoPackage != nil { - return *m.GoPackage - } - return "" -} - -func (m *FileOptions) GetCcGenericServices() bool { - if m != nil && m.CcGenericServices != nil { - return *m.CcGenericServices - } - return Default_FileOptions_CcGenericServices -} - -func (m *FileOptions) GetJavaGenericServices() bool { - if m != nil && m.JavaGenericServices != nil { - return *m.JavaGenericServices - } - return Default_FileOptions_JavaGenericServices -} - -func (m *FileOptions) GetPyGenericServices() bool { - if m != nil && m.PyGenericServices != nil { - return *m.PyGenericServices - } - return Default_FileOptions_PyGenericServices -} - -func (m *FileOptions) GetPhpGenericServices() bool { - if m != nil && m.PhpGenericServices != nil { - return *m.PhpGenericServices - } - return Default_FileOptions_PhpGenericServices -} - -func (m *FileOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_FileOptions_Deprecated -} - -func (m *FileOptions) GetCcEnableArenas() bool { - if m != nil && m.CcEnableArenas != nil { - return *m.CcEnableArenas - } - return Default_FileOptions_CcEnableArenas -} - -func (m *FileOptions) GetObjcClassPrefix() string { - if m != nil && m.ObjcClassPrefix != nil { - return *m.ObjcClassPrefix - } - return "" -} - -func (m *FileOptions) GetCsharpNamespace() string { - if m != nil && m.CsharpNamespace != nil { - return *m.CsharpNamespace - } - return "" -} - -func (m *FileOptions) GetSwiftPrefix() string { - if m != nil && m.SwiftPrefix != nil { - return *m.SwiftPrefix - } - return "" -} - -func (m *FileOptions) GetPhpClassPrefix() string { - if m != nil && m.PhpClassPrefix != nil { - return *m.PhpClassPrefix - } - return "" -} - -func (m *FileOptions) GetPhpNamespace() string { - if m != nil && m.PhpNamespace != nil { - return *m.PhpNamespace - } - return "" -} - -func (m *FileOptions) GetPhpMetadataNamespace() string { - if m != nil && m.PhpMetadataNamespace != nil { - return *m.PhpMetadataNamespace - } - return "" -} - -func (m *FileOptions) GetRubyPackage() string { - if m != nil && m.RubyPackage != nil { - return *m.RubyPackage - } - return "" -} - -func (m *FileOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type MessageOptions struct { - // 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. - MessageSetWireFormat *bool `protobuf:"varint,1,opt,name=message_set_wire_format,json=messageSetWireFormat,def=0" json:"message_set_wire_format,omitempty"` - // 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". - NoStandardDescriptorAccessor *bool `protobuf:"varint,2,opt,name=no_standard_descriptor_accessor,json=noStandardDescriptorAccessor,def=0" json:"no_standard_descriptor_accessor,omitempty"` - // 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. - Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // Whether the message is an automatically generated map entry type for the - // maps field. - // - // For maps fields: - // map 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 implementations 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. - MapEntry *bool `protobuf:"varint,7,opt,name=map_entry,json=mapEntry" json:"map_entry,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MessageOptions) Reset() { *m = MessageOptions{} } -func (m *MessageOptions) String() string { return proto.CompactTextString(m) } -func (*MessageOptions) ProtoMessage() {} -func (*MessageOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{11} -} - -var extRange_MessageOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*MessageOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_MessageOptions -} - -func (m *MessageOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MessageOptions.Unmarshal(m, b) -} -func (m *MessageOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MessageOptions.Marshal(b, m, deterministic) -} -func (m *MessageOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_MessageOptions.Merge(m, src) -} -func (m *MessageOptions) XXX_Size() int { - return xxx_messageInfo_MessageOptions.Size(m) -} -func (m *MessageOptions) XXX_DiscardUnknown() { - xxx_messageInfo_MessageOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_MessageOptions proto.InternalMessageInfo - -const Default_MessageOptions_MessageSetWireFormat bool = false -const Default_MessageOptions_NoStandardDescriptorAccessor bool = false -const Default_MessageOptions_Deprecated bool = false - -func (m *MessageOptions) GetMessageSetWireFormat() bool { - if m != nil && m.MessageSetWireFormat != nil { - return *m.MessageSetWireFormat - } - return Default_MessageOptions_MessageSetWireFormat -} - -func (m *MessageOptions) GetNoStandardDescriptorAccessor() bool { - if m != nil && m.NoStandardDescriptorAccessor != nil { - return *m.NoStandardDescriptorAccessor - } - return Default_MessageOptions_NoStandardDescriptorAccessor -} - -func (m *MessageOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_MessageOptions_Deprecated -} - -func (m *MessageOptions) GetMapEntry() bool { - if m != nil && m.MapEntry != nil { - return *m.MapEntry - } - return false -} - -func (m *MessageOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type FieldOptions struct { - // 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! - Ctype *FieldOptions_CType `protobuf:"varint,1,opt,name=ctype,enum=google.protobuf.FieldOptions_CType,def=0" json:"ctype,omitempty"` - // 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. - Packed *bool `protobuf:"varint,2,opt,name=packed" json:"packed,omitempty"` - // 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. - Jstype *FieldOptions_JSType `protobuf:"varint,6,opt,name=jstype,enum=google.protobuf.FieldOptions_JSType,def=0" json:"jstype,omitempty"` - // 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. - Lazy *bool `protobuf:"varint,5,opt,name=lazy,def=0" json:"lazy,omitempty"` - // 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. - Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // For Google-internal migration only. Do not use. - Weak *bool `protobuf:"varint,10,opt,name=weak,def=0" json:"weak,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FieldOptions) Reset() { *m = FieldOptions{} } -func (m *FieldOptions) String() string { return proto.CompactTextString(m) } -func (*FieldOptions) ProtoMessage() {} -func (*FieldOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{12} -} - -var extRange_FieldOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*FieldOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_FieldOptions -} - -func (m *FieldOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FieldOptions.Unmarshal(m, b) -} -func (m *FieldOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FieldOptions.Marshal(b, m, deterministic) -} -func (m *FieldOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_FieldOptions.Merge(m, src) -} -func (m *FieldOptions) XXX_Size() int { - return xxx_messageInfo_FieldOptions.Size(m) -} -func (m *FieldOptions) XXX_DiscardUnknown() { - xxx_messageInfo_FieldOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_FieldOptions proto.InternalMessageInfo - -const Default_FieldOptions_Ctype FieldOptions_CType = FieldOptions_STRING -const Default_FieldOptions_Jstype FieldOptions_JSType = FieldOptions_JS_NORMAL -const Default_FieldOptions_Lazy bool = false -const Default_FieldOptions_Deprecated bool = false -const Default_FieldOptions_Weak bool = false - -func (m *FieldOptions) GetCtype() FieldOptions_CType { - if m != nil && m.Ctype != nil { - return *m.Ctype - } - return Default_FieldOptions_Ctype -} - -func (m *FieldOptions) GetPacked() bool { - if m != nil && m.Packed != nil { - return *m.Packed - } - return false -} - -func (m *FieldOptions) GetJstype() FieldOptions_JSType { - if m != nil && m.Jstype != nil { - return *m.Jstype - } - return Default_FieldOptions_Jstype -} - -func (m *FieldOptions) GetLazy() bool { - if m != nil && m.Lazy != nil { - return *m.Lazy - } - return Default_FieldOptions_Lazy -} - -func (m *FieldOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_FieldOptions_Deprecated -} - -func (m *FieldOptions) GetWeak() bool { - if m != nil && m.Weak != nil { - return *m.Weak - } - return Default_FieldOptions_Weak -} - -func (m *FieldOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type OneofOptions struct { - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OneofOptions) Reset() { *m = OneofOptions{} } -func (m *OneofOptions) String() string { return proto.CompactTextString(m) } -func (*OneofOptions) ProtoMessage() {} -func (*OneofOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{13} -} - -var extRange_OneofOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*OneofOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_OneofOptions -} - -func (m *OneofOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OneofOptions.Unmarshal(m, b) -} -func (m *OneofOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OneofOptions.Marshal(b, m, deterministic) -} -func (m *OneofOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_OneofOptions.Merge(m, src) -} -func (m *OneofOptions) XXX_Size() int { - return xxx_messageInfo_OneofOptions.Size(m) -} -func (m *OneofOptions) XXX_DiscardUnknown() { - xxx_messageInfo_OneofOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_OneofOptions proto.InternalMessageInfo - -func (m *OneofOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type EnumOptions struct { - // Set this option to true to allow mapping different tag names to the same - // value. - AllowAlias *bool `protobuf:"varint,2,opt,name=allow_alias,json=allowAlias" json:"allow_alias,omitempty"` - // 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. - Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EnumOptions) Reset() { *m = EnumOptions{} } -func (m *EnumOptions) String() string { return proto.CompactTextString(m) } -func (*EnumOptions) ProtoMessage() {} -func (*EnumOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{14} -} - -var extRange_EnumOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*EnumOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_EnumOptions -} - -func (m *EnumOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EnumOptions.Unmarshal(m, b) -} -func (m *EnumOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EnumOptions.Marshal(b, m, deterministic) -} -func (m *EnumOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_EnumOptions.Merge(m, src) -} -func (m *EnumOptions) XXX_Size() int { - return xxx_messageInfo_EnumOptions.Size(m) -} -func (m *EnumOptions) XXX_DiscardUnknown() { - xxx_messageInfo_EnumOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_EnumOptions proto.InternalMessageInfo - -const Default_EnumOptions_Deprecated bool = false - -func (m *EnumOptions) GetAllowAlias() bool { - if m != nil && m.AllowAlias != nil { - return *m.AllowAlias - } - return false -} - -func (m *EnumOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_EnumOptions_Deprecated -} - -func (m *EnumOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type EnumValueOptions struct { - // 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. - Deprecated *bool `protobuf:"varint,1,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EnumValueOptions) Reset() { *m = EnumValueOptions{} } -func (m *EnumValueOptions) String() string { return proto.CompactTextString(m) } -func (*EnumValueOptions) ProtoMessage() {} -func (*EnumValueOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{15} -} - -var extRange_EnumValueOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*EnumValueOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_EnumValueOptions -} - -func (m *EnumValueOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EnumValueOptions.Unmarshal(m, b) -} -func (m *EnumValueOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EnumValueOptions.Marshal(b, m, deterministic) -} -func (m *EnumValueOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_EnumValueOptions.Merge(m, src) -} -func (m *EnumValueOptions) XXX_Size() int { - return xxx_messageInfo_EnumValueOptions.Size(m) -} -func (m *EnumValueOptions) XXX_DiscardUnknown() { - xxx_messageInfo_EnumValueOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_EnumValueOptions proto.InternalMessageInfo - -const Default_EnumValueOptions_Deprecated bool = false - -func (m *EnumValueOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_EnumValueOptions_Deprecated -} - -func (m *EnumValueOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type ServiceOptions struct { - // 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. - Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ServiceOptions) Reset() { *m = ServiceOptions{} } -func (m *ServiceOptions) String() string { return proto.CompactTextString(m) } -func (*ServiceOptions) ProtoMessage() {} -func (*ServiceOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{16} -} - -var extRange_ServiceOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*ServiceOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_ServiceOptions -} - -func (m *ServiceOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ServiceOptions.Unmarshal(m, b) -} -func (m *ServiceOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ServiceOptions.Marshal(b, m, deterministic) -} -func (m *ServiceOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServiceOptions.Merge(m, src) -} -func (m *ServiceOptions) XXX_Size() int { - return xxx_messageInfo_ServiceOptions.Size(m) -} -func (m *ServiceOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ServiceOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_ServiceOptions proto.InternalMessageInfo - -const Default_ServiceOptions_Deprecated bool = false - -func (m *ServiceOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_ServiceOptions_Deprecated -} - -func (m *ServiceOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type MethodOptions struct { - // 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. - Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - IdempotencyLevel *MethodOptions_IdempotencyLevel `protobuf:"varint,34,opt,name=idempotency_level,json=idempotencyLevel,enum=google.protobuf.MethodOptions_IdempotencyLevel,def=0" json:"idempotency_level,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MethodOptions) Reset() { *m = MethodOptions{} } -func (m *MethodOptions) String() string { return proto.CompactTextString(m) } -func (*MethodOptions) ProtoMessage() {} -func (*MethodOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{17} -} - -var extRange_MethodOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*MethodOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_MethodOptions -} - -func (m *MethodOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MethodOptions.Unmarshal(m, b) -} -func (m *MethodOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MethodOptions.Marshal(b, m, deterministic) -} -func (m *MethodOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_MethodOptions.Merge(m, src) -} -func (m *MethodOptions) XXX_Size() int { - return xxx_messageInfo_MethodOptions.Size(m) -} -func (m *MethodOptions) XXX_DiscardUnknown() { - xxx_messageInfo_MethodOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_MethodOptions proto.InternalMessageInfo - -const Default_MethodOptions_Deprecated bool = false -const Default_MethodOptions_IdempotencyLevel MethodOptions_IdempotencyLevel = MethodOptions_IDEMPOTENCY_UNKNOWN - -func (m *MethodOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_MethodOptions_Deprecated -} - -func (m *MethodOptions) GetIdempotencyLevel() MethodOptions_IdempotencyLevel { - if m != nil && m.IdempotencyLevel != nil { - return *m.IdempotencyLevel - } - return Default_MethodOptions_IdempotencyLevel -} - -func (m *MethodOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -// 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. -type UninterpretedOption struct { - Name []*UninterpretedOption_NamePart `protobuf:"bytes,2,rep,name=name" json:"name,omitempty"` - // The value of the uninterpreted option, in whatever type the tokenizer - // identified it as during parsing. Exactly one of these should be set. - IdentifierValue *string `protobuf:"bytes,3,opt,name=identifier_value,json=identifierValue" json:"identifier_value,omitempty"` - PositiveIntValue *uint64 `protobuf:"varint,4,opt,name=positive_int_value,json=positiveIntValue" json:"positive_int_value,omitempty"` - NegativeIntValue *int64 `protobuf:"varint,5,opt,name=negative_int_value,json=negativeIntValue" json:"negative_int_value,omitempty"` - DoubleValue *float64 `protobuf:"fixed64,6,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` - StringValue []byte `protobuf:"bytes,7,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` - AggregateValue *string `protobuf:"bytes,8,opt,name=aggregate_value,json=aggregateValue" json:"aggregate_value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UninterpretedOption) Reset() { *m = UninterpretedOption{} } -func (m *UninterpretedOption) String() string { return proto.CompactTextString(m) } -func (*UninterpretedOption) ProtoMessage() {} -func (*UninterpretedOption) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{18} -} -func (m *UninterpretedOption) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UninterpretedOption.Unmarshal(m, b) -} -func (m *UninterpretedOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UninterpretedOption.Marshal(b, m, deterministic) -} -func (m *UninterpretedOption) XXX_Merge(src proto.Message) { - xxx_messageInfo_UninterpretedOption.Merge(m, src) -} -func (m *UninterpretedOption) XXX_Size() int { - return xxx_messageInfo_UninterpretedOption.Size(m) -} -func (m *UninterpretedOption) XXX_DiscardUnknown() { - xxx_messageInfo_UninterpretedOption.DiscardUnknown(m) -} - -var xxx_messageInfo_UninterpretedOption proto.InternalMessageInfo - -func (m *UninterpretedOption) GetName() []*UninterpretedOption_NamePart { - if m != nil { - return m.Name - } - return nil -} - -func (m *UninterpretedOption) GetIdentifierValue() string { - if m != nil && m.IdentifierValue != nil { - return *m.IdentifierValue - } - return "" -} - -func (m *UninterpretedOption) GetPositiveIntValue() uint64 { - if m != nil && m.PositiveIntValue != nil { - return *m.PositiveIntValue - } - return 0 -} - -func (m *UninterpretedOption) GetNegativeIntValue() int64 { - if m != nil && m.NegativeIntValue != nil { - return *m.NegativeIntValue - } - return 0 -} - -func (m *UninterpretedOption) GetDoubleValue() float64 { - if m != nil && m.DoubleValue != nil { - return *m.DoubleValue - } - return 0 -} - -func (m *UninterpretedOption) GetStringValue() []byte { - if m != nil { - return m.StringValue - } - return nil -} - -func (m *UninterpretedOption) GetAggregateValue() string { - if m != nil && m.AggregateValue != nil { - return *m.AggregateValue - } - return "" -} - -// 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". -type UninterpretedOption_NamePart struct { - NamePart *string `protobuf:"bytes,1,req,name=name_part,json=namePart" json:"name_part,omitempty"` - IsExtension *bool `protobuf:"varint,2,req,name=is_extension,json=isExtension" json:"is_extension,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UninterpretedOption_NamePart) Reset() { *m = UninterpretedOption_NamePart{} } -func (m *UninterpretedOption_NamePart) String() string { return proto.CompactTextString(m) } -func (*UninterpretedOption_NamePart) ProtoMessage() {} -func (*UninterpretedOption_NamePart) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{18, 0} -} -func (m *UninterpretedOption_NamePart) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UninterpretedOption_NamePart.Unmarshal(m, b) -} -func (m *UninterpretedOption_NamePart) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UninterpretedOption_NamePart.Marshal(b, m, deterministic) -} -func (m *UninterpretedOption_NamePart) XXX_Merge(src proto.Message) { - xxx_messageInfo_UninterpretedOption_NamePart.Merge(m, src) -} -func (m *UninterpretedOption_NamePart) XXX_Size() int { - return xxx_messageInfo_UninterpretedOption_NamePart.Size(m) -} -func (m *UninterpretedOption_NamePart) XXX_DiscardUnknown() { - xxx_messageInfo_UninterpretedOption_NamePart.DiscardUnknown(m) -} - -var xxx_messageInfo_UninterpretedOption_NamePart proto.InternalMessageInfo - -func (m *UninterpretedOption_NamePart) GetNamePart() string { - if m != nil && m.NamePart != nil { - return *m.NamePart - } - return "" -} - -func (m *UninterpretedOption_NamePart) GetIsExtension() bool { - if m != nil && m.IsExtension != nil { - return *m.IsExtension - } - return false -} - -// Encapsulates information about the original source file from which a -// FileDescriptorProto was generated. -type SourceCodeInfo struct { - // 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 descendant. 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. - Location []*SourceCodeInfo_Location `protobuf:"bytes,1,rep,name=location" json:"location,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SourceCodeInfo) Reset() { *m = SourceCodeInfo{} } -func (m *SourceCodeInfo) String() string { return proto.CompactTextString(m) } -func (*SourceCodeInfo) ProtoMessage() {} -func (*SourceCodeInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{19} -} -func (m *SourceCodeInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SourceCodeInfo.Unmarshal(m, b) -} -func (m *SourceCodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SourceCodeInfo.Marshal(b, m, deterministic) -} -func (m *SourceCodeInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_SourceCodeInfo.Merge(m, src) -} -func (m *SourceCodeInfo) XXX_Size() int { - return xxx_messageInfo_SourceCodeInfo.Size(m) -} -func (m *SourceCodeInfo) XXX_DiscardUnknown() { - xxx_messageInfo_SourceCodeInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_SourceCodeInfo proto.InternalMessageInfo - -func (m *SourceCodeInfo) GetLocation() []*SourceCodeInfo_Location { - if m != nil { - return m.Location - } - return nil -} - -type SourceCodeInfo_Location struct { - // 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). - Path []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"` - // 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. - Span []int32 `protobuf:"varint,2,rep,packed,name=span" json:"span,omitempty"` - // 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. - LeadingComments *string `protobuf:"bytes,3,opt,name=leading_comments,json=leadingComments" json:"leading_comments,omitempty"` - TrailingComments *string `protobuf:"bytes,4,opt,name=trailing_comments,json=trailingComments" json:"trailing_comments,omitempty"` - LeadingDetachedComments []string `protobuf:"bytes,6,rep,name=leading_detached_comments,json=leadingDetachedComments" json:"leading_detached_comments,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SourceCodeInfo_Location) Reset() { *m = SourceCodeInfo_Location{} } -func (m *SourceCodeInfo_Location) String() string { return proto.CompactTextString(m) } -func (*SourceCodeInfo_Location) ProtoMessage() {} -func (*SourceCodeInfo_Location) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{19, 0} -} -func (m *SourceCodeInfo_Location) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SourceCodeInfo_Location.Unmarshal(m, b) -} -func (m *SourceCodeInfo_Location) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SourceCodeInfo_Location.Marshal(b, m, deterministic) -} -func (m *SourceCodeInfo_Location) XXX_Merge(src proto.Message) { - xxx_messageInfo_SourceCodeInfo_Location.Merge(m, src) -} -func (m *SourceCodeInfo_Location) XXX_Size() int { - return xxx_messageInfo_SourceCodeInfo_Location.Size(m) -} -func (m *SourceCodeInfo_Location) XXX_DiscardUnknown() { - xxx_messageInfo_SourceCodeInfo_Location.DiscardUnknown(m) -} - -var xxx_messageInfo_SourceCodeInfo_Location proto.InternalMessageInfo - -func (m *SourceCodeInfo_Location) GetPath() []int32 { - if m != nil { - return m.Path - } - return nil -} - -func (m *SourceCodeInfo_Location) GetSpan() []int32 { - if m != nil { - return m.Span - } - return nil -} - -func (m *SourceCodeInfo_Location) GetLeadingComments() string { - if m != nil && m.LeadingComments != nil { - return *m.LeadingComments - } - return "" -} - -func (m *SourceCodeInfo_Location) GetTrailingComments() string { - if m != nil && m.TrailingComments != nil { - return *m.TrailingComments - } - return "" -} - -func (m *SourceCodeInfo_Location) GetLeadingDetachedComments() []string { - if m != nil { - return m.LeadingDetachedComments - } - return nil -} - -// 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. -type GeneratedCodeInfo struct { - // An Annotation connects some span of text in generated code to an element - // of its generating .proto file. - Annotation []*GeneratedCodeInfo_Annotation `protobuf:"bytes,1,rep,name=annotation" json:"annotation,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GeneratedCodeInfo) Reset() { *m = GeneratedCodeInfo{} } -func (m *GeneratedCodeInfo) String() string { return proto.CompactTextString(m) } -func (*GeneratedCodeInfo) ProtoMessage() {} -func (*GeneratedCodeInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{20} -} -func (m *GeneratedCodeInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GeneratedCodeInfo.Unmarshal(m, b) -} -func (m *GeneratedCodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GeneratedCodeInfo.Marshal(b, m, deterministic) -} -func (m *GeneratedCodeInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_GeneratedCodeInfo.Merge(m, src) -} -func (m *GeneratedCodeInfo) XXX_Size() int { - return xxx_messageInfo_GeneratedCodeInfo.Size(m) -} -func (m *GeneratedCodeInfo) XXX_DiscardUnknown() { - xxx_messageInfo_GeneratedCodeInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_GeneratedCodeInfo proto.InternalMessageInfo - -func (m *GeneratedCodeInfo) GetAnnotation() []*GeneratedCodeInfo_Annotation { - if m != nil { - return m.Annotation - } - return nil -} - -type GeneratedCodeInfo_Annotation struct { - // Identifies the element in the original source .proto file. This field - // is formatted the same as SourceCodeInfo.Location.path. - Path []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"` - // Identifies the filesystem path to the original source .proto. - SourceFile *string `protobuf:"bytes,2,opt,name=source_file,json=sourceFile" json:"source_file,omitempty"` - // Identifies the starting offset in bytes in the generated code - // that relates to the identified object. - Begin *int32 `protobuf:"varint,3,opt,name=begin" json:"begin,omitempty"` - // 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). - End *int32 `protobuf:"varint,4,opt,name=end" json:"end,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GeneratedCodeInfo_Annotation) Reset() { *m = GeneratedCodeInfo_Annotation{} } -func (m *GeneratedCodeInfo_Annotation) String() string { return proto.CompactTextString(m) } -func (*GeneratedCodeInfo_Annotation) ProtoMessage() {} -func (*GeneratedCodeInfo_Annotation) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{20, 0} -} -func (m *GeneratedCodeInfo_Annotation) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GeneratedCodeInfo_Annotation.Unmarshal(m, b) -} -func (m *GeneratedCodeInfo_Annotation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GeneratedCodeInfo_Annotation.Marshal(b, m, deterministic) -} -func (m *GeneratedCodeInfo_Annotation) XXX_Merge(src proto.Message) { - xxx_messageInfo_GeneratedCodeInfo_Annotation.Merge(m, src) -} -func (m *GeneratedCodeInfo_Annotation) XXX_Size() int { - return xxx_messageInfo_GeneratedCodeInfo_Annotation.Size(m) -} -func (m *GeneratedCodeInfo_Annotation) XXX_DiscardUnknown() { - xxx_messageInfo_GeneratedCodeInfo_Annotation.DiscardUnknown(m) -} - -var xxx_messageInfo_GeneratedCodeInfo_Annotation proto.InternalMessageInfo - -func (m *GeneratedCodeInfo_Annotation) GetPath() []int32 { - if m != nil { - return m.Path - } - return nil -} - -func (m *GeneratedCodeInfo_Annotation) GetSourceFile() string { - if m != nil && m.SourceFile != nil { - return *m.SourceFile - } - return "" -} - -func (m *GeneratedCodeInfo_Annotation) GetBegin() int32 { - if m != nil && m.Begin != nil { - return *m.Begin - } - return 0 -} - -func (m *GeneratedCodeInfo_Annotation) GetEnd() int32 { - if m != nil && m.End != nil { - return *m.End - } - return 0 -} - -func init() { - proto.RegisterEnum("google.protobuf.FieldDescriptorProto_Type", FieldDescriptorProto_Type_name, FieldDescriptorProto_Type_value) - proto.RegisterEnum("google.protobuf.FieldDescriptorProto_Label", FieldDescriptorProto_Label_name, FieldDescriptorProto_Label_value) - proto.RegisterEnum("google.protobuf.FileOptions_OptimizeMode", FileOptions_OptimizeMode_name, FileOptions_OptimizeMode_value) - proto.RegisterEnum("google.protobuf.FieldOptions_CType", FieldOptions_CType_name, FieldOptions_CType_value) - proto.RegisterEnum("google.protobuf.FieldOptions_JSType", FieldOptions_JSType_name, FieldOptions_JSType_value) - proto.RegisterEnum("google.protobuf.MethodOptions_IdempotencyLevel", MethodOptions_IdempotencyLevel_name, MethodOptions_IdempotencyLevel_value) - proto.RegisterType((*FileDescriptorSet)(nil), "google.protobuf.FileDescriptorSet") - proto.RegisterType((*FileDescriptorProto)(nil), "google.protobuf.FileDescriptorProto") - proto.RegisterType((*DescriptorProto)(nil), "google.protobuf.DescriptorProto") - proto.RegisterType((*DescriptorProto_ExtensionRange)(nil), "google.protobuf.DescriptorProto.ExtensionRange") - proto.RegisterType((*DescriptorProto_ReservedRange)(nil), "google.protobuf.DescriptorProto.ReservedRange") - proto.RegisterType((*ExtensionRangeOptions)(nil), "google.protobuf.ExtensionRangeOptions") - proto.RegisterType((*FieldDescriptorProto)(nil), "google.protobuf.FieldDescriptorProto") - proto.RegisterType((*OneofDescriptorProto)(nil), "google.protobuf.OneofDescriptorProto") - proto.RegisterType((*EnumDescriptorProto)(nil), "google.protobuf.EnumDescriptorProto") - proto.RegisterType((*EnumDescriptorProto_EnumReservedRange)(nil), "google.protobuf.EnumDescriptorProto.EnumReservedRange") - proto.RegisterType((*EnumValueDescriptorProto)(nil), "google.protobuf.EnumValueDescriptorProto") - proto.RegisterType((*ServiceDescriptorProto)(nil), "google.protobuf.ServiceDescriptorProto") - proto.RegisterType((*MethodDescriptorProto)(nil), "google.protobuf.MethodDescriptorProto") - proto.RegisterType((*FileOptions)(nil), "google.protobuf.FileOptions") - proto.RegisterType((*MessageOptions)(nil), "google.protobuf.MessageOptions") - proto.RegisterType((*FieldOptions)(nil), "google.protobuf.FieldOptions") - proto.RegisterType((*OneofOptions)(nil), "google.protobuf.OneofOptions") - proto.RegisterType((*EnumOptions)(nil), "google.protobuf.EnumOptions") - proto.RegisterType((*EnumValueOptions)(nil), "google.protobuf.EnumValueOptions") - proto.RegisterType((*ServiceOptions)(nil), "google.protobuf.ServiceOptions") - proto.RegisterType((*MethodOptions)(nil), "google.protobuf.MethodOptions") - proto.RegisterType((*UninterpretedOption)(nil), "google.protobuf.UninterpretedOption") - proto.RegisterType((*UninterpretedOption_NamePart)(nil), "google.protobuf.UninterpretedOption.NamePart") - proto.RegisterType((*SourceCodeInfo)(nil), "google.protobuf.SourceCodeInfo") - proto.RegisterType((*SourceCodeInfo_Location)(nil), "google.protobuf.SourceCodeInfo.Location") - proto.RegisterType((*GeneratedCodeInfo)(nil), "google.protobuf.GeneratedCodeInfo") - proto.RegisterType((*GeneratedCodeInfo_Annotation)(nil), "google.protobuf.GeneratedCodeInfo.Annotation") -} - -func init() { proto.RegisterFile("descriptor.proto", fileDescriptor_308767df5ffe18af) } - -var fileDescriptor_308767df5ffe18af = []byte{ - // 2522 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x59, 0xcd, 0x6f, 0xdb, 0xc8, - 0x15, 0x5f, 0x7d, 0x5a, 0x7a, 0x92, 0x65, 0x7a, 0xec, 0x75, 0x18, 0xef, 0x47, 0x1c, 0xed, 0x66, - 0xe3, 0x24, 0xbb, 0xca, 0xc2, 0x49, 0x9c, 0xac, 0x53, 0x6c, 0x2b, 0x4b, 0x8c, 0x57, 0xa9, 0xbe, - 0x4a, 0xc9, 0xdd, 0x64, 0x8b, 0x82, 0x18, 0x93, 0x23, 0x89, 0x09, 0x45, 0x72, 0x49, 0x2a, 0x89, - 0x83, 0x1e, 0x02, 0xf4, 0x54, 0xa0, 0x7f, 0x40, 0x51, 0x14, 0x3d, 0xf4, 0xb2, 0x40, 0xff, 0x80, - 0x02, 0xed, 0xbd, 0xd7, 0x02, 0xbd, 0xf7, 0x50, 0xa0, 0x05, 0xda, 0x3f, 0xa1, 0xc7, 0x62, 0x66, - 0x48, 0x8a, 0xd4, 0x47, 0xe2, 0x5d, 0x20, 0xd9, 0x93, 0x3d, 0xef, 0xfd, 0xde, 0x9b, 0x37, 0x8f, - 0xbf, 0x79, 0xf3, 0x66, 0x04, 0x82, 0x46, 0x5c, 0xd5, 0xd1, 0x6d, 0xcf, 0x72, 0x2a, 0xb6, 0x63, - 0x79, 0x16, 0x5a, 0x1b, 0x5a, 0xd6, 0xd0, 0x20, 0x7c, 0x74, 0x32, 0x19, 0x94, 0x5b, 0xb0, 0x7e, - 0x4f, 0x37, 0x48, 0x3d, 0x04, 0xf6, 0x88, 0x87, 0xee, 0x40, 0x7a, 0xa0, 0x1b, 0x44, 0x4c, 0xec, - 0xa4, 0x76, 0x0b, 0x7b, 0x1f, 0x56, 0x66, 0x8c, 0x2a, 0x71, 0x8b, 0x2e, 0x15, 0xcb, 0xcc, 0xa2, - 0xfc, 0xef, 0x34, 0x6c, 0x2c, 0xd0, 0x22, 0x04, 0x69, 0x13, 0x8f, 0xa9, 0xc7, 0xc4, 0x6e, 0x5e, - 0x66, 0xff, 0x23, 0x11, 0x56, 0x6c, 0xac, 0x3e, 0xc6, 0x43, 0x22, 0x26, 0x99, 0x38, 0x18, 0xa2, - 0xf7, 0x01, 0x34, 0x62, 0x13, 0x53, 0x23, 0xa6, 0x7a, 0x2a, 0xa6, 0x76, 0x52, 0xbb, 0x79, 0x39, - 0x22, 0x41, 0xd7, 0x60, 0xdd, 0x9e, 0x9c, 0x18, 0xba, 0xaa, 0x44, 0x60, 0xb0, 0x93, 0xda, 0xcd, - 0xc8, 0x02, 0x57, 0xd4, 0xa7, 0xe0, 0xcb, 0xb0, 0xf6, 0x94, 0xe0, 0xc7, 0x51, 0x68, 0x81, 0x41, - 0x4b, 0x54, 0x1c, 0x01, 0xd6, 0xa0, 0x38, 0x26, 0xae, 0x8b, 0x87, 0x44, 0xf1, 0x4e, 0x6d, 0x22, - 0xa6, 0xd9, 0xea, 0x77, 0xe6, 0x56, 0x3f, 0xbb, 0xf2, 0x82, 0x6f, 0xd5, 0x3f, 0xb5, 0x09, 0xaa, - 0x42, 0x9e, 0x98, 0x93, 0x31, 0xf7, 0x90, 0x59, 0x92, 0x3f, 0xc9, 0x9c, 0x8c, 0x67, 0xbd, 0xe4, - 0xa8, 0x99, 0xef, 0x62, 0xc5, 0x25, 0xce, 0x13, 0x5d, 0x25, 0x62, 0x96, 0x39, 0xb8, 0x3c, 0xe7, - 0xa0, 0xc7, 0xf5, 0xb3, 0x3e, 0x02, 0x3b, 0x54, 0x83, 0x3c, 0x79, 0xe6, 0x11, 0xd3, 0xd5, 0x2d, - 0x53, 0x5c, 0x61, 0x4e, 0x2e, 0x2d, 0xf8, 0x8a, 0xc4, 0xd0, 0x66, 0x5d, 0x4c, 0xed, 0xd0, 0x3e, - 0xac, 0x58, 0xb6, 0xa7, 0x5b, 0xa6, 0x2b, 0xe6, 0x76, 0x12, 0xbb, 0x85, 0xbd, 0x77, 0x17, 0x12, - 0xa1, 0xc3, 0x31, 0x72, 0x00, 0x46, 0x0d, 0x10, 0x5c, 0x6b, 0xe2, 0xa8, 0x44, 0x51, 0x2d, 0x8d, - 0x28, 0xba, 0x39, 0xb0, 0xc4, 0x3c, 0x73, 0x70, 0x61, 0x7e, 0x21, 0x0c, 0x58, 0xb3, 0x34, 0xd2, - 0x30, 0x07, 0x96, 0x5c, 0x72, 0x63, 0x63, 0xb4, 0x05, 0x59, 0xf7, 0xd4, 0xf4, 0xf0, 0x33, 0xb1, - 0xc8, 0x18, 0xe2, 0x8f, 0xca, 0x7f, 0xce, 0xc2, 0xda, 0x59, 0x28, 0x76, 0x17, 0x32, 0x03, 0xba, - 0x4a, 0x31, 0xf9, 0x6d, 0x72, 0xc0, 0x6d, 0xe2, 0x49, 0xcc, 0x7e, 0xc7, 0x24, 0x56, 0xa1, 0x60, - 0x12, 0xd7, 0x23, 0x1a, 0x67, 0x44, 0xea, 0x8c, 0x9c, 0x02, 0x6e, 0x34, 0x4f, 0xa9, 0xf4, 0x77, - 0xa2, 0xd4, 0x03, 0x58, 0x0b, 0x43, 0x52, 0x1c, 0x6c, 0x0e, 0x03, 0x6e, 0x5e, 0x7f, 0x55, 0x24, - 0x15, 0x29, 0xb0, 0x93, 0xa9, 0x99, 0x5c, 0x22, 0xb1, 0x31, 0xaa, 0x03, 0x58, 0x26, 0xb1, 0x06, - 0x8a, 0x46, 0x54, 0x43, 0xcc, 0x2d, 0xc9, 0x52, 0x87, 0x42, 0xe6, 0xb2, 0x64, 0x71, 0xa9, 0x6a, - 0xa0, 0xcf, 0xa6, 0x54, 0x5b, 0x59, 0xc2, 0x94, 0x16, 0xdf, 0x64, 0x73, 0x6c, 0x3b, 0x86, 0x92, - 0x43, 0x28, 0xef, 0x89, 0xe6, 0xaf, 0x2c, 0xcf, 0x82, 0xa8, 0xbc, 0x72, 0x65, 0xb2, 0x6f, 0xc6, - 0x17, 0xb6, 0xea, 0x44, 0x87, 0xe8, 0x03, 0x08, 0x05, 0x0a, 0xa3, 0x15, 0xb0, 0x2a, 0x54, 0x0c, - 0x84, 0x6d, 0x3c, 0x26, 0xdb, 0xcf, 0xa1, 0x14, 0x4f, 0x0f, 0xda, 0x84, 0x8c, 0xeb, 0x61, 0xc7, - 0x63, 0x2c, 0xcc, 0xc8, 0x7c, 0x80, 0x04, 0x48, 0x11, 0x53, 0x63, 0x55, 0x2e, 0x23, 0xd3, 0x7f, - 0xd1, 0x8f, 0xa6, 0x0b, 0x4e, 0xb1, 0x05, 0x7f, 0x34, 0xff, 0x45, 0x63, 0x9e, 0x67, 0xd7, 0xbd, - 0x7d, 0x1b, 0x56, 0x63, 0x0b, 0x38, 0xeb, 0xd4, 0xe5, 0x5f, 0xc0, 0xdb, 0x0b, 0x5d, 0xa3, 0x07, - 0xb0, 0x39, 0x31, 0x75, 0xd3, 0x23, 0x8e, 0xed, 0x10, 0xca, 0x58, 0x3e, 0x95, 0xf8, 0x9f, 0x95, - 0x25, 0x9c, 0x3b, 0x8e, 0xa2, 0xb9, 0x17, 0x79, 0x63, 0x32, 0x2f, 0xbc, 0x9a, 0xcf, 0xfd, 0x77, - 0x45, 0x78, 0xf1, 0xe2, 0xc5, 0x8b, 0x64, 0xf9, 0x37, 0x59, 0xd8, 0x5c, 0xb4, 0x67, 0x16, 0x6e, - 0xdf, 0x2d, 0xc8, 0x9a, 0x93, 0xf1, 0x09, 0x71, 0x58, 0x92, 0x32, 0xb2, 0x3f, 0x42, 0x55, 0xc8, - 0x18, 0xf8, 0x84, 0x18, 0x62, 0x7a, 0x27, 0xb1, 0x5b, 0xda, 0xbb, 0x76, 0xa6, 0x5d, 0x59, 0x69, - 0x52, 0x13, 0x99, 0x5b, 0xa2, 0xcf, 0x21, 0xed, 0x97, 0x68, 0xea, 0xe1, 0xea, 0xd9, 0x3c, 0xd0, - 0xbd, 0x24, 0x33, 0x3b, 0xf4, 0x0e, 0xe4, 0xe9, 0x5f, 0xce, 0x8d, 0x2c, 0x8b, 0x39, 0x47, 0x05, - 0x94, 0x17, 0x68, 0x1b, 0x72, 0x6c, 0x9b, 0x68, 0x24, 0x38, 0xda, 0xc2, 0x31, 0x25, 0x96, 0x46, - 0x06, 0x78, 0x62, 0x78, 0xca, 0x13, 0x6c, 0x4c, 0x08, 0x23, 0x7c, 0x5e, 0x2e, 0xfa, 0xc2, 0x9f, - 0x52, 0x19, 0xba, 0x00, 0x05, 0xbe, 0xab, 0x74, 0x53, 0x23, 0xcf, 0x58, 0xf5, 0xcc, 0xc8, 0x7c, - 0xa3, 0x35, 0xa8, 0x84, 0x4e, 0xff, 0xc8, 0xb5, 0xcc, 0x80, 0x9a, 0x6c, 0x0a, 0x2a, 0x60, 0xd3, - 0xdf, 0x9e, 0x2d, 0xdc, 0xef, 0x2d, 0x5e, 0xde, 0x2c, 0xa7, 0xca, 0x7f, 0x4a, 0x42, 0x9a, 0xd5, - 0x8b, 0x35, 0x28, 0xf4, 0x1f, 0x76, 0x25, 0xa5, 0xde, 0x39, 0x3e, 0x6c, 0x4a, 0x42, 0x02, 0x95, - 0x00, 0x98, 0xe0, 0x5e, 0xb3, 0x53, 0xed, 0x0b, 0xc9, 0x70, 0xdc, 0x68, 0xf7, 0xf7, 0x6f, 0x0a, - 0xa9, 0xd0, 0xe0, 0x98, 0x0b, 0xd2, 0x51, 0xc0, 0x8d, 0x3d, 0x21, 0x83, 0x04, 0x28, 0x72, 0x07, - 0x8d, 0x07, 0x52, 0x7d, 0xff, 0xa6, 0x90, 0x8d, 0x4b, 0x6e, 0xec, 0x09, 0x2b, 0x68, 0x15, 0xf2, - 0x4c, 0x72, 0xd8, 0xe9, 0x34, 0x85, 0x5c, 0xe8, 0xb3, 0xd7, 0x97, 0x1b, 0xed, 0x23, 0x21, 0x1f, - 0xfa, 0x3c, 0x92, 0x3b, 0xc7, 0x5d, 0x01, 0x42, 0x0f, 0x2d, 0xa9, 0xd7, 0xab, 0x1e, 0x49, 0x42, - 0x21, 0x44, 0x1c, 0x3e, 0xec, 0x4b, 0x3d, 0xa1, 0x18, 0x0b, 0xeb, 0xc6, 0x9e, 0xb0, 0x1a, 0x4e, - 0x21, 0xb5, 0x8f, 0x5b, 0x42, 0x09, 0xad, 0xc3, 0x2a, 0x9f, 0x22, 0x08, 0x62, 0x6d, 0x46, 0xb4, - 0x7f, 0x53, 0x10, 0xa6, 0x81, 0x70, 0x2f, 0xeb, 0x31, 0xc1, 0xfe, 0x4d, 0x01, 0x95, 0x6b, 0x90, - 0x61, 0xec, 0x42, 0x08, 0x4a, 0xcd, 0xea, 0xa1, 0xd4, 0x54, 0x3a, 0xdd, 0x7e, 0xa3, 0xd3, 0xae, - 0x36, 0x85, 0xc4, 0x54, 0x26, 0x4b, 0x3f, 0x39, 0x6e, 0xc8, 0x52, 0x5d, 0x48, 0x46, 0x65, 0x5d, - 0xa9, 0xda, 0x97, 0xea, 0x42, 0xaa, 0xac, 0xc2, 0xe6, 0xa2, 0x3a, 0xb9, 0x70, 0x67, 0x44, 0x3e, - 0x71, 0x72, 0xc9, 0x27, 0x66, 0xbe, 0xe6, 0x3e, 0xf1, 0xbf, 0x92, 0xb0, 0xb1, 0xe0, 0xac, 0x58, - 0x38, 0xc9, 0x0f, 0x21, 0xc3, 0x29, 0xca, 0x4f, 0xcf, 0x2b, 0x0b, 0x0f, 0x1d, 0x46, 0xd8, 0xb9, - 0x13, 0x94, 0xd9, 0x45, 0x3b, 0x88, 0xd4, 0x92, 0x0e, 0x82, 0xba, 0x98, 0xab, 0xe9, 0x3f, 0x9f, - 0xab, 0xe9, 0xfc, 0xd8, 0xdb, 0x3f, 0xcb, 0xb1, 0xc7, 0x64, 0xdf, 0xae, 0xb6, 0x67, 0x16, 0xd4, - 0xf6, 0xbb, 0xb0, 0x3e, 0xe7, 0xe8, 0xcc, 0x35, 0xf6, 0x97, 0x09, 0x10, 0x97, 0x25, 0xe7, 0x15, - 0x95, 0x2e, 0x19, 0xab, 0x74, 0x77, 0x67, 0x33, 0x78, 0x71, 0xf9, 0x47, 0x98, 0xfb, 0xd6, 0xdf, - 0x24, 0x60, 0x6b, 0x71, 0xa7, 0xb8, 0x30, 0x86, 0xcf, 0x21, 0x3b, 0x26, 0xde, 0xc8, 0x0a, 0xba, - 0xa5, 0x8f, 0x16, 0x9c, 0xc1, 0x54, 0x3d, 0xfb, 0xb1, 0x7d, 0xab, 0xe8, 0x21, 0x9e, 0x5a, 0xd6, - 0xee, 0xf1, 0x68, 0xe6, 0x22, 0xfd, 0x55, 0x12, 0xde, 0x5e, 0xe8, 0x7c, 0x61, 0xa0, 0xef, 0x01, - 0xe8, 0xa6, 0x3d, 0xf1, 0x78, 0x47, 0xc4, 0x0b, 0x6c, 0x9e, 0x49, 0x58, 0xf1, 0xa2, 0xc5, 0x73, - 0xe2, 0x85, 0xfa, 0x14, 0xd3, 0x03, 0x17, 0x31, 0xc0, 0x9d, 0x69, 0xa0, 0x69, 0x16, 0xe8, 0xfb, - 0x4b, 0x56, 0x3a, 0x47, 0xcc, 0x4f, 0x41, 0x50, 0x0d, 0x9d, 0x98, 0x9e, 0xe2, 0x7a, 0x0e, 0xc1, - 0x63, 0xdd, 0x1c, 0xb2, 0x13, 0x24, 0x77, 0x90, 0x19, 0x60, 0xc3, 0x25, 0xf2, 0x1a, 0x57, 0xf7, - 0x02, 0x2d, 0xb5, 0x60, 0x04, 0x72, 0x22, 0x16, 0xd9, 0x98, 0x05, 0x57, 0x87, 0x16, 0xe5, 0x5f, - 0xe7, 0xa1, 0x10, 0xe9, 0xab, 0xd1, 0x45, 0x28, 0x3e, 0xc2, 0x4f, 0xb0, 0x12, 0xdc, 0x95, 0x78, - 0x26, 0x0a, 0x54, 0xd6, 0xf5, 0xef, 0x4b, 0x9f, 0xc2, 0x26, 0x83, 0x58, 0x13, 0x8f, 0x38, 0x8a, - 0x6a, 0x60, 0xd7, 0x65, 0x49, 0xcb, 0x31, 0x28, 0xa2, 0xba, 0x0e, 0x55, 0xd5, 0x02, 0x0d, 0xba, - 0x05, 0x1b, 0xcc, 0x62, 0x3c, 0x31, 0x3c, 0xdd, 0x36, 0x88, 0x42, 0x6f, 0x6f, 0x2e, 0x3b, 0x49, - 0xc2, 0xc8, 0xd6, 0x29, 0xa2, 0xe5, 0x03, 0x68, 0x44, 0x2e, 0xaa, 0xc3, 0x7b, 0xcc, 0x6c, 0x48, - 0x4c, 0xe2, 0x60, 0x8f, 0x28, 0xe4, 0xeb, 0x09, 0x36, 0x5c, 0x05, 0x9b, 0x9a, 0x32, 0xc2, 0xee, - 0x48, 0xdc, 0xa4, 0x0e, 0x0e, 0x93, 0x62, 0x42, 0x3e, 0x4f, 0x81, 0x47, 0x3e, 0x4e, 0x62, 0xb0, - 0xaa, 0xa9, 0x7d, 0x81, 0xdd, 0x11, 0x3a, 0x80, 0x2d, 0xe6, 0xc5, 0xf5, 0x1c, 0xdd, 0x1c, 0x2a, - 0xea, 0x88, 0xa8, 0x8f, 0x95, 0x89, 0x37, 0xb8, 0x23, 0xbe, 0x13, 0x9d, 0x9f, 0x45, 0xd8, 0x63, - 0x98, 0x1a, 0x85, 0x1c, 0x7b, 0x83, 0x3b, 0xa8, 0x07, 0x45, 0xfa, 0x31, 0xc6, 0xfa, 0x73, 0xa2, - 0x0c, 0x2c, 0x87, 0x1d, 0x8d, 0xa5, 0x05, 0xa5, 0x29, 0x92, 0xc1, 0x4a, 0xc7, 0x37, 0x68, 0x59, - 0x1a, 0x39, 0xc8, 0xf4, 0xba, 0x92, 0x54, 0x97, 0x0b, 0x81, 0x97, 0x7b, 0x96, 0x43, 0x09, 0x35, - 0xb4, 0xc2, 0x04, 0x17, 0x38, 0xa1, 0x86, 0x56, 0x90, 0xde, 0x5b, 0xb0, 0xa1, 0xaa, 0x7c, 0xcd, - 0xba, 0xaa, 0xf8, 0x77, 0x2c, 0x57, 0x14, 0x62, 0xc9, 0x52, 0xd5, 0x23, 0x0e, 0xf0, 0x39, 0xee, - 0xa2, 0xcf, 0xe0, 0xed, 0x69, 0xb2, 0xa2, 0x86, 0xeb, 0x73, 0xab, 0x9c, 0x35, 0xbd, 0x05, 0x1b, - 0xf6, 0xe9, 0xbc, 0x21, 0x8a, 0xcd, 0x68, 0x9f, 0xce, 0x9a, 0xdd, 0x86, 0x4d, 0x7b, 0x64, 0xcf, - 0xdb, 0x5d, 0x8d, 0xda, 0x21, 0x7b, 0x64, 0xcf, 0x1a, 0x5e, 0x62, 0x17, 0x6e, 0x87, 0xa8, 0xd8, - 0x23, 0x9a, 0x78, 0x2e, 0x0a, 0x8f, 0x28, 0xd0, 0x75, 0x10, 0x54, 0x55, 0x21, 0x26, 0x3e, 0x31, - 0x88, 0x82, 0x1d, 0x62, 0x62, 0x57, 0xbc, 0x10, 0x05, 0x97, 0x54, 0x55, 0x62, 0xda, 0x2a, 0x53, - 0xa2, 0xab, 0xb0, 0x6e, 0x9d, 0x3c, 0x52, 0x39, 0x25, 0x15, 0xdb, 0x21, 0x03, 0xfd, 0x99, 0xf8, - 0x21, 0xcb, 0xef, 0x1a, 0x55, 0x30, 0x42, 0x76, 0x99, 0x18, 0x5d, 0x01, 0x41, 0x75, 0x47, 0xd8, - 0xb1, 0x59, 0x4d, 0x76, 0x6d, 0xac, 0x12, 0xf1, 0x12, 0x87, 0x72, 0x79, 0x3b, 0x10, 0xd3, 0x2d, - 0xe1, 0x3e, 0xd5, 0x07, 0x5e, 0xe0, 0xf1, 0x32, 0xdf, 0x12, 0x4c, 0xe6, 0x7b, 0xdb, 0x05, 0x81, - 0xa6, 0x22, 0x36, 0xf1, 0x2e, 0x83, 0x95, 0xec, 0x91, 0x1d, 0x9d, 0xf7, 0x03, 0x58, 0xa5, 0xc8, - 0xe9, 0xa4, 0x57, 0x78, 0x43, 0x66, 0x8f, 0x22, 0x33, 0xde, 0x84, 0x2d, 0x0a, 0x1a, 0x13, 0x0f, - 0x6b, 0xd8, 0xc3, 0x11, 0xf4, 0xc7, 0x0c, 0x4d, 0xf3, 0xde, 0xf2, 0x95, 0xb1, 0x38, 0x9d, 0xc9, - 0xc9, 0x69, 0xc8, 0xac, 0x4f, 0x78, 0x9c, 0x54, 0x16, 0x70, 0xeb, 0xb5, 0x35, 0xdd, 0xe5, 0x03, - 0x28, 0x46, 0x89, 0x8f, 0xf2, 0xc0, 0xa9, 0x2f, 0x24, 0x68, 0x17, 0x54, 0xeb, 0xd4, 0x69, 0xff, - 0xf2, 0x95, 0x24, 0x24, 0x69, 0x1f, 0xd5, 0x6c, 0xf4, 0x25, 0x45, 0x3e, 0x6e, 0xf7, 0x1b, 0x2d, - 0x49, 0x48, 0x45, 0x1b, 0xf6, 0xbf, 0x26, 0xa1, 0x14, 0xbf, 0x7b, 0xa1, 0x1f, 0xc0, 0xb9, 0xe0, - 0xa1, 0xc4, 0x25, 0x9e, 0xf2, 0x54, 0x77, 0xd8, 0x5e, 0x1c, 0x63, 0x7e, 0x2e, 0x86, 0x6c, 0xd8, - 0xf4, 0x51, 0x3d, 0xe2, 0x7d, 0xa9, 0x3b, 0x74, 0xa7, 0x8d, 0xb1, 0x87, 0x9a, 0x70, 0xc1, 0xb4, - 0x14, 0xd7, 0xc3, 0xa6, 0x86, 0x1d, 0x4d, 0x99, 0x3e, 0x51, 0x29, 0x58, 0x55, 0x89, 0xeb, 0x5a, - 0xfc, 0x0c, 0x0c, 0xbd, 0xbc, 0x6b, 0x5a, 0x3d, 0x1f, 0x3c, 0x3d, 0x1c, 0xaa, 0x3e, 0x74, 0x86, - 0xb9, 0xa9, 0x65, 0xcc, 0x7d, 0x07, 0xf2, 0x63, 0x6c, 0x2b, 0xc4, 0xf4, 0x9c, 0x53, 0xd6, 0x71, - 0xe7, 0xe4, 0xdc, 0x18, 0xdb, 0x12, 0x1d, 0xbf, 0x99, 0x8b, 0xcf, 0x3f, 0x52, 0x50, 0x8c, 0x76, - 0xdd, 0xf4, 0x12, 0xa3, 0xb2, 0x03, 0x2a, 0xc1, 0x4a, 0xd8, 0x07, 0x2f, 0xed, 0xd1, 0x2b, 0x35, - 0x7a, 0x72, 0x1d, 0x64, 0x79, 0x2f, 0x2c, 0x73, 0x4b, 0xda, 0x35, 0x50, 0x6a, 0x11, 0xde, 0x7b, - 0xe4, 0x64, 0x7f, 0x84, 0x8e, 0x20, 0xfb, 0xc8, 0x65, 0xbe, 0xb3, 0xcc, 0xf7, 0x87, 0x2f, 0xf7, - 0x7d, 0xbf, 0xc7, 0x9c, 0xe7, 0xef, 0xf7, 0x94, 0x76, 0x47, 0x6e, 0x55, 0x9b, 0xb2, 0x6f, 0x8e, - 0xce, 0x43, 0xda, 0xc0, 0xcf, 0x4f, 0xe3, 0x67, 0x1c, 0x13, 0x9d, 0x35, 0xf1, 0xe7, 0x21, 0xfd, - 0x94, 0xe0, 0xc7, 0xf1, 0x93, 0x85, 0x89, 0x5e, 0x23, 0xf5, 0xaf, 0x43, 0x86, 0xe5, 0x0b, 0x01, - 0xf8, 0x19, 0x13, 0xde, 0x42, 0x39, 0x48, 0xd7, 0x3a, 0x32, 0xa5, 0xbf, 0x00, 0x45, 0x2e, 0x55, - 0xba, 0x0d, 0xa9, 0x26, 0x09, 0xc9, 0xf2, 0x2d, 0xc8, 0xf2, 0x24, 0xd0, 0xad, 0x11, 0xa6, 0x41, - 0x78, 0xcb, 0x1f, 0xfa, 0x3e, 0x12, 0x81, 0xf6, 0xb8, 0x75, 0x28, 0xc9, 0x42, 0x32, 0xfa, 0x79, - 0x5d, 0x28, 0x46, 0x1b, 0xee, 0x37, 0xc3, 0xa9, 0xbf, 0x24, 0xa0, 0x10, 0x69, 0xa0, 0x69, 0xe7, - 0x83, 0x0d, 0xc3, 0x7a, 0xaa, 0x60, 0x43, 0xc7, 0xae, 0x4f, 0x0a, 0x60, 0xa2, 0x2a, 0x95, 0x9c, - 0xf5, 0xa3, 0xbd, 0x91, 0xe0, 0x7f, 0x9f, 0x00, 0x61, 0xb6, 0x77, 0x9d, 0x09, 0x30, 0xf1, 0xbd, - 0x06, 0xf8, 0xbb, 0x04, 0x94, 0xe2, 0x0d, 0xeb, 0x4c, 0x78, 0x17, 0xbf, 0xd7, 0xf0, 0xfe, 0x99, - 0x84, 0xd5, 0x58, 0x9b, 0x7a, 0xd6, 0xe8, 0xbe, 0x86, 0x75, 0x5d, 0x23, 0x63, 0xdb, 0xf2, 0x88, - 0xa9, 0x9e, 0x2a, 0x06, 0x79, 0x42, 0x0c, 0xb1, 0xcc, 0x0a, 0xc5, 0xf5, 0x97, 0x37, 0xc2, 0x95, - 0xc6, 0xd4, 0xae, 0x49, 0xcd, 0x0e, 0x36, 0x1a, 0x75, 0xa9, 0xd5, 0xed, 0xf4, 0xa5, 0x76, 0xed, - 0xa1, 0x72, 0xdc, 0xfe, 0x71, 0xbb, 0xf3, 0x65, 0x5b, 0x16, 0xf4, 0x19, 0xd8, 0x6b, 0xdc, 0xea, - 0x5d, 0x10, 0x66, 0x83, 0x42, 0xe7, 0x60, 0x51, 0x58, 0xc2, 0x5b, 0x68, 0x03, 0xd6, 0xda, 0x1d, - 0xa5, 0xd7, 0xa8, 0x4b, 0x8a, 0x74, 0xef, 0x9e, 0x54, 0xeb, 0xf7, 0xf8, 0xd3, 0x46, 0x88, 0xee, - 0xc7, 0x37, 0xf5, 0x6f, 0x53, 0xb0, 0xb1, 0x20, 0x12, 0x54, 0xf5, 0x2f, 0x25, 0xfc, 0x9e, 0xf4, - 0xc9, 0x59, 0xa2, 0xaf, 0xd0, 0xae, 0xa0, 0x8b, 0x1d, 0xcf, 0xbf, 0xc3, 0x5c, 0x01, 0x9a, 0x25, - 0xd3, 0xd3, 0x07, 0x3a, 0x71, 0xfc, 0x97, 0x20, 0x7e, 0x53, 0x59, 0x9b, 0xca, 0xf9, 0x63, 0xd0, - 0xc7, 0x80, 0x6c, 0xcb, 0xd5, 0x3d, 0xfd, 0x09, 0x51, 0x74, 0x33, 0x78, 0x36, 0xa2, 0x37, 0x97, - 0xb4, 0x2c, 0x04, 0x9a, 0x86, 0xe9, 0x85, 0x68, 0x93, 0x0c, 0xf1, 0x0c, 0x9a, 0x16, 0xf0, 0x94, - 0x2c, 0x04, 0x9a, 0x10, 0x7d, 0x11, 0x8a, 0x9a, 0x35, 0xa1, 0xed, 0x1c, 0xc7, 0xd1, 0xf3, 0x22, - 0x21, 0x17, 0xb8, 0x2c, 0x84, 0xf8, 0x8d, 0xfa, 0xf4, 0xbd, 0xaa, 0x28, 0x17, 0xb8, 0x8c, 0x43, - 0x2e, 0xc3, 0x1a, 0x1e, 0x0e, 0x1d, 0xea, 0x3c, 0x70, 0xc4, 0xaf, 0x1e, 0xa5, 0x50, 0xcc, 0x80, - 0xdb, 0xf7, 0x21, 0x17, 0xe4, 0x81, 0x1e, 0xc9, 0x34, 0x13, 0x8a, 0xcd, 0xef, 0xd3, 0xc9, 0xdd, - 0xbc, 0x9c, 0x33, 0x03, 0xe5, 0x45, 0x28, 0xea, 0xae, 0x32, 0x7d, 0x7e, 0x4f, 0xee, 0x24, 0x77, - 0x73, 0x72, 0x41, 0x77, 0xc3, 0xa7, 0xcb, 0xf2, 0x37, 0x49, 0x28, 0xc5, 0x7f, 0x3e, 0x40, 0x75, - 0xc8, 0x19, 0x96, 0x8a, 0x19, 0xb5, 0xf8, 0x6f, 0x57, 0xbb, 0xaf, 0xf8, 0xc5, 0xa1, 0xd2, 0xf4, - 0xf1, 0x72, 0x68, 0xb9, 0xfd, 0xb7, 0x04, 0xe4, 0x02, 0x31, 0xda, 0x82, 0xb4, 0x8d, 0xbd, 0x11, - 0x73, 0x97, 0x39, 0x4c, 0x0a, 0x09, 0x99, 0x8d, 0xa9, 0xdc, 0xb5, 0xb1, 0xc9, 0x28, 0xe0, 0xcb, - 0xe9, 0x98, 0x7e, 0x57, 0x83, 0x60, 0x8d, 0xdd, 0x6b, 0xac, 0xf1, 0x98, 0x98, 0x9e, 0x1b, 0x7c, - 0x57, 0x5f, 0x5e, 0xf3, 0xc5, 0xe8, 0x1a, 0xac, 0x7b, 0x0e, 0xd6, 0x8d, 0x18, 0x36, 0xcd, 0xb0, - 0x42, 0xa0, 0x08, 0xc1, 0x07, 0x70, 0x3e, 0xf0, 0xab, 0x11, 0x0f, 0xab, 0x23, 0xa2, 0x4d, 0x8d, - 0xb2, 0xec, 0xfd, 0xe2, 0x9c, 0x0f, 0xa8, 0xfb, 0xfa, 0xc0, 0xb6, 0xfc, 0xf7, 0x04, 0xac, 0x07, - 0x37, 0x31, 0x2d, 0x4c, 0x56, 0x0b, 0x00, 0x9b, 0xa6, 0xe5, 0x45, 0xd3, 0x35, 0x4f, 0xe5, 0x39, - 0xbb, 0x4a, 0x35, 0x34, 0x92, 0x23, 0x0e, 0xb6, 0xc7, 0x00, 0x53, 0xcd, 0xd2, 0xb4, 0x5d, 0x80, - 0x82, 0xff, 0xdb, 0x10, 0xfb, 0x81, 0x91, 0xdf, 0xdd, 0x81, 0x8b, 0xe8, 0x95, 0x0d, 0x6d, 0x42, - 0xe6, 0x84, 0x0c, 0x75, 0xd3, 0x7f, 0xf1, 0xe5, 0x83, 0xe0, 0x85, 0x25, 0x1d, 0xbe, 0xb0, 0x1c, - 0xfe, 0x0c, 0x36, 0x54, 0x6b, 0x3c, 0x1b, 0xee, 0xa1, 0x30, 0xf3, 0x7e, 0xe0, 0x7e, 0x91, 0xf8, - 0x0a, 0xa6, 0x2d, 0xe6, 0xff, 0x12, 0x89, 0x3f, 0x24, 0x53, 0x47, 0xdd, 0xc3, 0x3f, 0x26, 0xb7, - 0x8f, 0xb8, 0x69, 0x37, 0x58, 0xa9, 0x4c, 0x06, 0x06, 0x51, 0x69, 0xf4, 0xff, 0x0f, 0x00, 0x00, - 0xff, 0xff, 0x88, 0x17, 0xc1, 0xbe, 0x38, 0x1d, 0x00, 0x00, -} diff --git a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go deleted file mode 100644 index 165b2110d..000000000 --- a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go +++ /dev/null @@ -1,752 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: descriptor.proto - -package descriptor - -import ( - fmt "fmt" - github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" - proto "github.com/gogo/protobuf/proto" - math "math" - reflect "reflect" - sort "sort" - strconv "strconv" - strings "strings" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -func (this *FileDescriptorSet) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&descriptor.FileDescriptorSet{") - if this.File != nil { - s = append(s, "File: "+fmt.Sprintf("%#v", this.File)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *FileDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 16) - s = append(s, "&descriptor.FileDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Package != nil { - s = append(s, "Package: "+valueToGoStringDescriptor(this.Package, "string")+",\n") - } - if this.Dependency != nil { - s = append(s, "Dependency: "+fmt.Sprintf("%#v", this.Dependency)+",\n") - } - if this.PublicDependency != nil { - s = append(s, "PublicDependency: "+fmt.Sprintf("%#v", this.PublicDependency)+",\n") - } - if this.WeakDependency != nil { - s = append(s, "WeakDependency: "+fmt.Sprintf("%#v", this.WeakDependency)+",\n") - } - if this.MessageType != nil { - s = append(s, "MessageType: "+fmt.Sprintf("%#v", this.MessageType)+",\n") - } - if this.EnumType != nil { - s = append(s, "EnumType: "+fmt.Sprintf("%#v", this.EnumType)+",\n") - } - if this.Service != nil { - s = append(s, "Service: "+fmt.Sprintf("%#v", this.Service)+",\n") - } - if this.Extension != nil { - s = append(s, "Extension: "+fmt.Sprintf("%#v", this.Extension)+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.SourceCodeInfo != nil { - s = append(s, "SourceCodeInfo: "+fmt.Sprintf("%#v", this.SourceCodeInfo)+",\n") - } - if this.Syntax != nil { - s = append(s, "Syntax: "+valueToGoStringDescriptor(this.Syntax, "string")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *DescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 14) - s = append(s, "&descriptor.DescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Field != nil { - s = append(s, "Field: "+fmt.Sprintf("%#v", this.Field)+",\n") - } - if this.Extension != nil { - s = append(s, "Extension: "+fmt.Sprintf("%#v", this.Extension)+",\n") - } - if this.NestedType != nil { - s = append(s, "NestedType: "+fmt.Sprintf("%#v", this.NestedType)+",\n") - } - if this.EnumType != nil { - s = append(s, "EnumType: "+fmt.Sprintf("%#v", this.EnumType)+",\n") - } - if this.ExtensionRange != nil { - s = append(s, "ExtensionRange: "+fmt.Sprintf("%#v", this.ExtensionRange)+",\n") - } - if this.OneofDecl != nil { - s = append(s, "OneofDecl: "+fmt.Sprintf("%#v", this.OneofDecl)+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.ReservedRange != nil { - s = append(s, "ReservedRange: "+fmt.Sprintf("%#v", this.ReservedRange)+",\n") - } - if this.ReservedName != nil { - s = append(s, "ReservedName: "+fmt.Sprintf("%#v", this.ReservedName)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *DescriptorProto_ExtensionRange) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&descriptor.DescriptorProto_ExtensionRange{") - if this.Start != nil { - s = append(s, "Start: "+valueToGoStringDescriptor(this.Start, "int32")+",\n") - } - if this.End != nil { - s = append(s, "End: "+valueToGoStringDescriptor(this.End, "int32")+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *DescriptorProto_ReservedRange) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.DescriptorProto_ReservedRange{") - if this.Start != nil { - s = append(s, "Start: "+valueToGoStringDescriptor(this.Start, "int32")+",\n") - } - if this.End != nil { - s = append(s, "End: "+valueToGoStringDescriptor(this.End, "int32")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *ExtensionRangeOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&descriptor.ExtensionRangeOptions{") - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *FieldDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 14) - s = append(s, "&descriptor.FieldDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Number != nil { - s = append(s, "Number: "+valueToGoStringDescriptor(this.Number, "int32")+",\n") - } - if this.Label != nil { - s = append(s, "Label: "+valueToGoStringDescriptor(this.Label, "FieldDescriptorProto_Label")+",\n") - } - if this.Type != nil { - s = append(s, "Type: "+valueToGoStringDescriptor(this.Type, "FieldDescriptorProto_Type")+",\n") - } - if this.TypeName != nil { - s = append(s, "TypeName: "+valueToGoStringDescriptor(this.TypeName, "string")+",\n") - } - if this.Extendee != nil { - s = append(s, "Extendee: "+valueToGoStringDescriptor(this.Extendee, "string")+",\n") - } - if this.DefaultValue != nil { - s = append(s, "DefaultValue: "+valueToGoStringDescriptor(this.DefaultValue, "string")+",\n") - } - if this.OneofIndex != nil { - s = append(s, "OneofIndex: "+valueToGoStringDescriptor(this.OneofIndex, "int32")+",\n") - } - if this.JsonName != nil { - s = append(s, "JsonName: "+valueToGoStringDescriptor(this.JsonName, "string")+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *OneofDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.OneofDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *EnumDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 9) - s = append(s, "&descriptor.EnumDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Value != nil { - s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.ReservedRange != nil { - s = append(s, "ReservedRange: "+fmt.Sprintf("%#v", this.ReservedRange)+",\n") - } - if this.ReservedName != nil { - s = append(s, "ReservedName: "+fmt.Sprintf("%#v", this.ReservedName)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *EnumDescriptorProto_EnumReservedRange) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.EnumDescriptorProto_EnumReservedRange{") - if this.Start != nil { - s = append(s, "Start: "+valueToGoStringDescriptor(this.Start, "int32")+",\n") - } - if this.End != nil { - s = append(s, "End: "+valueToGoStringDescriptor(this.End, "int32")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *EnumValueDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&descriptor.EnumValueDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Number != nil { - s = append(s, "Number: "+valueToGoStringDescriptor(this.Number, "int32")+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *ServiceDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&descriptor.ServiceDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Method != nil { - s = append(s, "Method: "+fmt.Sprintf("%#v", this.Method)+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *MethodDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 10) - s = append(s, "&descriptor.MethodDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.InputType != nil { - s = append(s, "InputType: "+valueToGoStringDescriptor(this.InputType, "string")+",\n") - } - if this.OutputType != nil { - s = append(s, "OutputType: "+valueToGoStringDescriptor(this.OutputType, "string")+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.ClientStreaming != nil { - s = append(s, "ClientStreaming: "+valueToGoStringDescriptor(this.ClientStreaming, "bool")+",\n") - } - if this.ServerStreaming != nil { - s = append(s, "ServerStreaming: "+valueToGoStringDescriptor(this.ServerStreaming, "bool")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *FileOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 25) - s = append(s, "&descriptor.FileOptions{") - if this.JavaPackage != nil { - s = append(s, "JavaPackage: "+valueToGoStringDescriptor(this.JavaPackage, "string")+",\n") - } - if this.JavaOuterClassname != nil { - s = append(s, "JavaOuterClassname: "+valueToGoStringDescriptor(this.JavaOuterClassname, "string")+",\n") - } - if this.JavaMultipleFiles != nil { - s = append(s, "JavaMultipleFiles: "+valueToGoStringDescriptor(this.JavaMultipleFiles, "bool")+",\n") - } - if this.JavaGenerateEqualsAndHash != nil { - s = append(s, "JavaGenerateEqualsAndHash: "+valueToGoStringDescriptor(this.JavaGenerateEqualsAndHash, "bool")+",\n") - } - if this.JavaStringCheckUtf8 != nil { - s = append(s, "JavaStringCheckUtf8: "+valueToGoStringDescriptor(this.JavaStringCheckUtf8, "bool")+",\n") - } - if this.OptimizeFor != nil { - s = append(s, "OptimizeFor: "+valueToGoStringDescriptor(this.OptimizeFor, "FileOptions_OptimizeMode")+",\n") - } - if this.GoPackage != nil { - s = append(s, "GoPackage: "+valueToGoStringDescriptor(this.GoPackage, "string")+",\n") - } - if this.CcGenericServices != nil { - s = append(s, "CcGenericServices: "+valueToGoStringDescriptor(this.CcGenericServices, "bool")+",\n") - } - if this.JavaGenericServices != nil { - s = append(s, "JavaGenericServices: "+valueToGoStringDescriptor(this.JavaGenericServices, "bool")+",\n") - } - if this.PyGenericServices != nil { - s = append(s, "PyGenericServices: "+valueToGoStringDescriptor(this.PyGenericServices, "bool")+",\n") - } - if this.PhpGenericServices != nil { - s = append(s, "PhpGenericServices: "+valueToGoStringDescriptor(this.PhpGenericServices, "bool")+",\n") - } - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.CcEnableArenas != nil { - s = append(s, "CcEnableArenas: "+valueToGoStringDescriptor(this.CcEnableArenas, "bool")+",\n") - } - if this.ObjcClassPrefix != nil { - s = append(s, "ObjcClassPrefix: "+valueToGoStringDescriptor(this.ObjcClassPrefix, "string")+",\n") - } - if this.CsharpNamespace != nil { - s = append(s, "CsharpNamespace: "+valueToGoStringDescriptor(this.CsharpNamespace, "string")+",\n") - } - if this.SwiftPrefix != nil { - s = append(s, "SwiftPrefix: "+valueToGoStringDescriptor(this.SwiftPrefix, "string")+",\n") - } - if this.PhpClassPrefix != nil { - s = append(s, "PhpClassPrefix: "+valueToGoStringDescriptor(this.PhpClassPrefix, "string")+",\n") - } - if this.PhpNamespace != nil { - s = append(s, "PhpNamespace: "+valueToGoStringDescriptor(this.PhpNamespace, "string")+",\n") - } - if this.PhpMetadataNamespace != nil { - s = append(s, "PhpMetadataNamespace: "+valueToGoStringDescriptor(this.PhpMetadataNamespace, "string")+",\n") - } - if this.RubyPackage != nil { - s = append(s, "RubyPackage: "+valueToGoStringDescriptor(this.RubyPackage, "string")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *MessageOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 9) - s = append(s, "&descriptor.MessageOptions{") - if this.MessageSetWireFormat != nil { - s = append(s, "MessageSetWireFormat: "+valueToGoStringDescriptor(this.MessageSetWireFormat, "bool")+",\n") - } - if this.NoStandardDescriptorAccessor != nil { - s = append(s, "NoStandardDescriptorAccessor: "+valueToGoStringDescriptor(this.NoStandardDescriptorAccessor, "bool")+",\n") - } - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.MapEntry != nil { - s = append(s, "MapEntry: "+valueToGoStringDescriptor(this.MapEntry, "bool")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *FieldOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 11) - s = append(s, "&descriptor.FieldOptions{") - if this.Ctype != nil { - s = append(s, "Ctype: "+valueToGoStringDescriptor(this.Ctype, "FieldOptions_CType")+",\n") - } - if this.Packed != nil { - s = append(s, "Packed: "+valueToGoStringDescriptor(this.Packed, "bool")+",\n") - } - if this.Jstype != nil { - s = append(s, "Jstype: "+valueToGoStringDescriptor(this.Jstype, "FieldOptions_JSType")+",\n") - } - if this.Lazy != nil { - s = append(s, "Lazy: "+valueToGoStringDescriptor(this.Lazy, "bool")+",\n") - } - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.Weak != nil { - s = append(s, "Weak: "+valueToGoStringDescriptor(this.Weak, "bool")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *OneofOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&descriptor.OneofOptions{") - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *EnumOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&descriptor.EnumOptions{") - if this.AllowAlias != nil { - s = append(s, "AllowAlias: "+valueToGoStringDescriptor(this.AllowAlias, "bool")+",\n") - } - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *EnumValueOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.EnumValueOptions{") - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *ServiceOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.ServiceOptions{") - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *MethodOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&descriptor.MethodOptions{") - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.IdempotencyLevel != nil { - s = append(s, "IdempotencyLevel: "+valueToGoStringDescriptor(this.IdempotencyLevel, "MethodOptions_IdempotencyLevel")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *UninterpretedOption) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 11) - s = append(s, "&descriptor.UninterpretedOption{") - if this.Name != nil { - s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") - } - if this.IdentifierValue != nil { - s = append(s, "IdentifierValue: "+valueToGoStringDescriptor(this.IdentifierValue, "string")+",\n") - } - if this.PositiveIntValue != nil { - s = append(s, "PositiveIntValue: "+valueToGoStringDescriptor(this.PositiveIntValue, "uint64")+",\n") - } - if this.NegativeIntValue != nil { - s = append(s, "NegativeIntValue: "+valueToGoStringDescriptor(this.NegativeIntValue, "int64")+",\n") - } - if this.DoubleValue != nil { - s = append(s, "DoubleValue: "+valueToGoStringDescriptor(this.DoubleValue, "float64")+",\n") - } - if this.StringValue != nil { - s = append(s, "StringValue: "+valueToGoStringDescriptor(this.StringValue, "byte")+",\n") - } - if this.AggregateValue != nil { - s = append(s, "AggregateValue: "+valueToGoStringDescriptor(this.AggregateValue, "string")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *UninterpretedOption_NamePart) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.UninterpretedOption_NamePart{") - if this.NamePart != nil { - s = append(s, "NamePart: "+valueToGoStringDescriptor(this.NamePart, "string")+",\n") - } - if this.IsExtension != nil { - s = append(s, "IsExtension: "+valueToGoStringDescriptor(this.IsExtension, "bool")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *SourceCodeInfo) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&descriptor.SourceCodeInfo{") - if this.Location != nil { - s = append(s, "Location: "+fmt.Sprintf("%#v", this.Location)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *SourceCodeInfo_Location) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 9) - s = append(s, "&descriptor.SourceCodeInfo_Location{") - if this.Path != nil { - s = append(s, "Path: "+fmt.Sprintf("%#v", this.Path)+",\n") - } - if this.Span != nil { - s = append(s, "Span: "+fmt.Sprintf("%#v", this.Span)+",\n") - } - if this.LeadingComments != nil { - s = append(s, "LeadingComments: "+valueToGoStringDescriptor(this.LeadingComments, "string")+",\n") - } - if this.TrailingComments != nil { - s = append(s, "TrailingComments: "+valueToGoStringDescriptor(this.TrailingComments, "string")+",\n") - } - if this.LeadingDetachedComments != nil { - s = append(s, "LeadingDetachedComments: "+fmt.Sprintf("%#v", this.LeadingDetachedComments)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *GeneratedCodeInfo) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&descriptor.GeneratedCodeInfo{") - if this.Annotation != nil { - s = append(s, "Annotation: "+fmt.Sprintf("%#v", this.Annotation)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *GeneratedCodeInfo_Annotation) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 8) - s = append(s, "&descriptor.GeneratedCodeInfo_Annotation{") - if this.Path != nil { - s = append(s, "Path: "+fmt.Sprintf("%#v", this.Path)+",\n") - } - if this.SourceFile != nil { - s = append(s, "SourceFile: "+valueToGoStringDescriptor(this.SourceFile, "string")+",\n") - } - if this.Begin != nil { - s = append(s, "Begin: "+valueToGoStringDescriptor(this.Begin, "int32")+",\n") - } - if this.End != nil { - s = append(s, "End: "+valueToGoStringDescriptor(this.End, "int32")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringDescriptor(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func extensionToGoStringDescriptor(m github_com_gogo_protobuf_proto.Message) string { - e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) - if e == nil { - return "nil" - } - s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" - keys := make([]int, 0, len(e)) - for k := range e { - keys = append(keys, int(k)) - } - sort.Ints(keys) - ss := []string{} - for _, k := range keys { - ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) - } - s += strings.Join(ss, ",") + "})" - return s -} diff --git a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/helper.go b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/helper.go deleted file mode 100644 index e0846a357..000000000 --- a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/helper.go +++ /dev/null @@ -1,390 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/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. -// -// 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 descriptor - -import ( - "strings" -) - -func (msg *DescriptorProto) GetMapFields() (*FieldDescriptorProto, *FieldDescriptorProto) { - if !msg.GetOptions().GetMapEntry() { - return nil, nil - } - return msg.GetField()[0], msg.GetField()[1] -} - -func dotToUnderscore(r rune) rune { - if r == '.' { - return '_' - } - return r -} - -func (field *FieldDescriptorProto) WireType() (wire int) { - switch *field.Type { - case FieldDescriptorProto_TYPE_DOUBLE: - return 1 - case FieldDescriptorProto_TYPE_FLOAT: - return 5 - case FieldDescriptorProto_TYPE_INT64: - return 0 - case FieldDescriptorProto_TYPE_UINT64: - return 0 - case FieldDescriptorProto_TYPE_INT32: - return 0 - case FieldDescriptorProto_TYPE_UINT32: - return 0 - case FieldDescriptorProto_TYPE_FIXED64: - return 1 - case FieldDescriptorProto_TYPE_FIXED32: - return 5 - case FieldDescriptorProto_TYPE_BOOL: - return 0 - case FieldDescriptorProto_TYPE_STRING: - return 2 - case FieldDescriptorProto_TYPE_GROUP: - return 2 - case FieldDescriptorProto_TYPE_MESSAGE: - return 2 - case FieldDescriptorProto_TYPE_BYTES: - return 2 - case FieldDescriptorProto_TYPE_ENUM: - return 0 - case FieldDescriptorProto_TYPE_SFIXED32: - return 5 - case FieldDescriptorProto_TYPE_SFIXED64: - return 1 - case FieldDescriptorProto_TYPE_SINT32: - return 0 - case FieldDescriptorProto_TYPE_SINT64: - return 0 - } - panic("unreachable") -} - -func (field *FieldDescriptorProto) GetKeyUint64() (x uint64) { - packed := field.IsPacked() - wireType := field.WireType() - fieldNumber := field.GetNumber() - if packed { - wireType = 2 - } - x = uint64(uint32(fieldNumber)<<3 | uint32(wireType)) - return x -} - -func (field *FieldDescriptorProto) GetKey3Uint64() (x uint64) { - packed := field.IsPacked3() - wireType := field.WireType() - fieldNumber := field.GetNumber() - if packed { - wireType = 2 - } - x = uint64(uint32(fieldNumber)<<3 | uint32(wireType)) - return x -} - -func (field *FieldDescriptorProto) GetKey() []byte { - x := field.GetKeyUint64() - i := 0 - keybuf := make([]byte, 0) - for i = 0; x > 127; i++ { - keybuf = append(keybuf, 0x80|uint8(x&0x7F)) - x >>= 7 - } - keybuf = append(keybuf, uint8(x)) - return keybuf -} - -func (field *FieldDescriptorProto) GetKey3() []byte { - x := field.GetKey3Uint64() - i := 0 - keybuf := make([]byte, 0) - for i = 0; x > 127; i++ { - keybuf = append(keybuf, 0x80|uint8(x&0x7F)) - x >>= 7 - } - keybuf = append(keybuf, uint8(x)) - return keybuf -} - -func (desc *FileDescriptorSet) GetField(packageName, messageName, fieldName string) *FieldDescriptorProto { - msg := desc.GetMessage(packageName, messageName) - if msg == nil { - return nil - } - for _, field := range msg.GetField() { - if field.GetName() == fieldName { - return field - } - } - return nil -} - -func (file *FileDescriptorProto) GetMessage(typeName string) *DescriptorProto { - for _, msg := range file.GetMessageType() { - if msg.GetName() == typeName { - return msg - } - nes := file.GetNestedMessage(msg, strings.TrimPrefix(typeName, msg.GetName()+".")) - if nes != nil { - return nes - } - } - return nil -} - -func (file *FileDescriptorProto) GetNestedMessage(msg *DescriptorProto, typeName string) *DescriptorProto { - for _, nes := range msg.GetNestedType() { - if nes.GetName() == typeName { - return nes - } - res := file.GetNestedMessage(nes, strings.TrimPrefix(typeName, nes.GetName()+".")) - if res != nil { - return res - } - } - return nil -} - -func (desc *FileDescriptorSet) GetMessage(packageName string, typeName string) *DescriptorProto { - for _, file := range desc.GetFile() { - if strings.Map(dotToUnderscore, file.GetPackage()) != strings.Map(dotToUnderscore, packageName) { - continue - } - for _, msg := range file.GetMessageType() { - if msg.GetName() == typeName { - return msg - } - } - for _, msg := range file.GetMessageType() { - for _, nes := range msg.GetNestedType() { - if nes.GetName() == typeName { - return nes - } - if msg.GetName()+"."+nes.GetName() == typeName { - return nes - } - } - } - } - return nil -} - -func (desc *FileDescriptorSet) IsProto3(packageName string, typeName string) bool { - for _, file := range desc.GetFile() { - if strings.Map(dotToUnderscore, file.GetPackage()) != strings.Map(dotToUnderscore, packageName) { - continue - } - for _, msg := range file.GetMessageType() { - if msg.GetName() == typeName { - return file.GetSyntax() == "proto3" - } - } - for _, msg := range file.GetMessageType() { - for _, nes := range msg.GetNestedType() { - if nes.GetName() == typeName { - return file.GetSyntax() == "proto3" - } - if msg.GetName()+"."+nes.GetName() == typeName { - return file.GetSyntax() == "proto3" - } - } - } - } - return false -} - -func (msg *DescriptorProto) IsExtendable() bool { - return len(msg.GetExtensionRange()) > 0 -} - -func (desc *FileDescriptorSet) FindExtension(packageName string, typeName string, fieldName string) (extPackageName string, field *FieldDescriptorProto) { - parent := desc.GetMessage(packageName, typeName) - if parent == nil { - return "", nil - } - if !parent.IsExtendable() { - return "", nil - } - extendee := "." + packageName + "." + typeName - for _, file := range desc.GetFile() { - for _, ext := range file.GetExtension() { - if strings.Map(dotToUnderscore, file.GetPackage()) == strings.Map(dotToUnderscore, packageName) { - if !(ext.GetExtendee() == typeName || ext.GetExtendee() == extendee) { - continue - } - } else { - if ext.GetExtendee() != extendee { - continue - } - } - if ext.GetName() == fieldName { - return file.GetPackage(), ext - } - } - } - return "", nil -} - -func (desc *FileDescriptorSet) FindExtensionByFieldNumber(packageName string, typeName string, fieldNum int32) (extPackageName string, field *FieldDescriptorProto) { - parent := desc.GetMessage(packageName, typeName) - if parent == nil { - return "", nil - } - if !parent.IsExtendable() { - return "", nil - } - extendee := "." + packageName + "." + typeName - for _, file := range desc.GetFile() { - for _, ext := range file.GetExtension() { - if strings.Map(dotToUnderscore, file.GetPackage()) == strings.Map(dotToUnderscore, packageName) { - if !(ext.GetExtendee() == typeName || ext.GetExtendee() == extendee) { - continue - } - } else { - if ext.GetExtendee() != extendee { - continue - } - } - if ext.GetNumber() == fieldNum { - return file.GetPackage(), ext - } - } - } - return "", nil -} - -func (desc *FileDescriptorSet) FindMessage(packageName string, typeName string, fieldName string) (msgPackageName string, msgName string) { - parent := desc.GetMessage(packageName, typeName) - if parent == nil { - return "", "" - } - field := parent.GetFieldDescriptor(fieldName) - if field == nil { - var extPackageName string - extPackageName, field = desc.FindExtension(packageName, typeName, fieldName) - if field == nil { - return "", "" - } - packageName = extPackageName - } - typeNames := strings.Split(field.GetTypeName(), ".") - if len(typeNames) == 1 { - msg := desc.GetMessage(packageName, typeName) - if msg == nil { - return "", "" - } - return packageName, msg.GetName() - } - if len(typeNames) > 2 { - for i := 1; i < len(typeNames)-1; i++ { - packageName = strings.Join(typeNames[1:len(typeNames)-i], ".") - typeName = strings.Join(typeNames[len(typeNames)-i:], ".") - msg := desc.GetMessage(packageName, typeName) - if msg != nil { - typeNames := strings.Split(msg.GetName(), ".") - if len(typeNames) == 1 { - return packageName, msg.GetName() - } - return strings.Join(typeNames[1:len(typeNames)-1], "."), typeNames[len(typeNames)-1] - } - } - } - return "", "" -} - -func (msg *DescriptorProto) GetFieldDescriptor(fieldName string) *FieldDescriptorProto { - for _, field := range msg.GetField() { - if field.GetName() == fieldName { - return field - } - } - return nil -} - -func (desc *FileDescriptorSet) GetEnum(packageName string, typeName string) *EnumDescriptorProto { - for _, file := range desc.GetFile() { - if strings.Map(dotToUnderscore, file.GetPackage()) != strings.Map(dotToUnderscore, packageName) { - continue - } - for _, enum := range file.GetEnumType() { - if enum.GetName() == typeName { - return enum - } - } - } - return nil -} - -func (f *FieldDescriptorProto) IsEnum() bool { - return *f.Type == FieldDescriptorProto_TYPE_ENUM -} - -func (f *FieldDescriptorProto) IsMessage() bool { - return *f.Type == FieldDescriptorProto_TYPE_MESSAGE -} - -func (f *FieldDescriptorProto) IsBytes() bool { - return *f.Type == FieldDescriptorProto_TYPE_BYTES -} - -func (f *FieldDescriptorProto) IsRepeated() bool { - return f.Label != nil && *f.Label == FieldDescriptorProto_LABEL_REPEATED -} - -func (f *FieldDescriptorProto) IsString() bool { - return *f.Type == FieldDescriptorProto_TYPE_STRING -} - -func (f *FieldDescriptorProto) IsBool() bool { - return *f.Type == FieldDescriptorProto_TYPE_BOOL -} - -func (f *FieldDescriptorProto) IsRequired() bool { - return f.Label != nil && *f.Label == FieldDescriptorProto_LABEL_REQUIRED -} - -func (f *FieldDescriptorProto) IsPacked() bool { - return f.Options != nil && f.GetOptions().GetPacked() -} - -func (f *FieldDescriptorProto) IsPacked3() bool { - if f.IsRepeated() && f.IsScalar() { - if f.Options == nil || f.GetOptions().Packed == nil { - return true - } - return f.Options != nil && f.GetOptions().GetPacked() - } - return false -} - -func (m *DescriptorProto) HasExtension() bool { - return len(m.ExtensionRange) > 0 -} diff --git a/vendor/github.com/gogo/protobuf/sortkeys/sortkeys.go b/vendor/github.com/gogo/protobuf/sortkeys/sortkeys.go deleted file mode 100644 index ceadde6a5..000000000 --- a/vendor/github.com/gogo/protobuf/sortkeys/sortkeys.go +++ /dev/null @@ -1,101 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/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. -// -// 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 sortkeys - -import ( - "sort" -) - -func Strings(l []string) { - sort.Strings(l) -} - -func Float64s(l []float64) { - sort.Float64s(l) -} - -func Float32s(l []float32) { - sort.Sort(Float32Slice(l)) -} - -func Int64s(l []int64) { - sort.Sort(Int64Slice(l)) -} - -func Int32s(l []int32) { - sort.Sort(Int32Slice(l)) -} - -func Uint64s(l []uint64) { - sort.Sort(Uint64Slice(l)) -} - -func Uint32s(l []uint32) { - sort.Sort(Uint32Slice(l)) -} - -func Bools(l []bool) { - sort.Sort(BoolSlice(l)) -} - -type BoolSlice []bool - -func (p BoolSlice) Len() int { return len(p) } -func (p BoolSlice) Less(i, j int) bool { return p[j] } -func (p BoolSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } - -type Int64Slice []int64 - -func (p Int64Slice) Len() int { return len(p) } -func (p Int64Slice) Less(i, j int) bool { return p[i] < p[j] } -func (p Int64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } - -type Int32Slice []int32 - -func (p Int32Slice) Len() int { return len(p) } -func (p Int32Slice) Less(i, j int) bool { return p[i] < p[j] } -func (p Int32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } - -type Uint64Slice []uint64 - -func (p Uint64Slice) Len() int { return len(p) } -func (p Uint64Slice) Less(i, j int) bool { return p[i] < p[j] } -func (p Uint64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } - -type Uint32Slice []uint32 - -func (p Uint32Slice) Len() int { return len(p) } -func (p Uint32Slice) Less(i, j int) bool { return p[i] < p[j] } -func (p Uint32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } - -type Float32Slice []float32 - -func (p Float32Slice) Len() int { return len(p) } -func (p Float32Slice) Less(i, j int) bool { return p[i] < p[j] } -func (p Float32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } diff --git a/vendor/github.com/golang/groupcache/LICENSE b/vendor/github.com/golang/groupcache/LICENSE deleted file mode 100644 index 37ec93a14..000000000 --- a/vendor/github.com/golang/groupcache/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ -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: - -You must give any other recipients of the Work or Derivative Works a copy of -this License; and -You must cause any modified files to carry prominent notices stating that You -changed the files; and -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 -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. diff --git a/vendor/github.com/golang/groupcache/lru/lru.go b/vendor/github.com/golang/groupcache/lru/lru.go deleted file mode 100644 index eac1c7664..000000000 --- a/vendor/github.com/golang/groupcache/lru/lru.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright 2013 Google Inc. - -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 lru implements an LRU cache. -package lru - -import "container/list" - -// Cache is an LRU cache. It is not safe for concurrent access. -type Cache struct { - // MaxEntries is the maximum number of cache entries before - // an item is evicted. Zero means no limit. - MaxEntries int - - // OnEvicted optionally specifies a callback function to be - // executed when an entry is purged from the cache. - OnEvicted func(key Key, value interface{}) - - ll *list.List - cache map[interface{}]*list.Element -} - -// A Key may be any value that is comparable. See http://golang.org/ref/spec#Comparison_operators -type Key interface{} - -type entry struct { - key Key - value interface{} -} - -// New creates a new Cache. -// If maxEntries is zero, the cache has no limit and it's assumed -// that eviction is done by the caller. -func New(maxEntries int) *Cache { - return &Cache{ - MaxEntries: maxEntries, - ll: list.New(), - cache: make(map[interface{}]*list.Element), - } -} - -// Add adds a value to the cache. -func (c *Cache) Add(key Key, value interface{}) { - if c.cache == nil { - c.cache = make(map[interface{}]*list.Element) - c.ll = list.New() - } - if ee, ok := c.cache[key]; ok { - c.ll.MoveToFront(ee) - ee.Value.(*entry).value = value - return - } - ele := c.ll.PushFront(&entry{key, value}) - c.cache[key] = ele - if c.MaxEntries != 0 && c.ll.Len() > c.MaxEntries { - c.RemoveOldest() - } -} - -// Get looks up a key's value from the cache. -func (c *Cache) Get(key Key) (value interface{}, ok bool) { - if c.cache == nil { - return - } - if ele, hit := c.cache[key]; hit { - c.ll.MoveToFront(ele) - return ele.Value.(*entry).value, true - } - return -} - -// Remove removes the provided key from the cache. -func (c *Cache) Remove(key Key) { - if c.cache == nil { - return - } - if ele, hit := c.cache[key]; hit { - c.removeElement(ele) - } -} - -// RemoveOldest removes the oldest item from the cache. -func (c *Cache) RemoveOldest() { - if c.cache == nil { - return - } - ele := c.ll.Back() - if ele != nil { - c.removeElement(ele) - } -} - -func (c *Cache) removeElement(e *list.Element) { - c.ll.Remove(e) - kv := e.Value.(*entry) - delete(c.cache, kv.key) - if c.OnEvicted != nil { - c.OnEvicted(kv.key, kv.value) - } -} - -// Len returns the number of items in the cache. -func (c *Cache) Len() int { - if c.cache == nil { - return 0 - } - return c.ll.Len() -} - -// Clear purges all stored items from the cache. -func (c *Cache) Clear() { - if c.OnEvicted != nil { - for _, e := range c.cache { - kv := e.Value.(*entry) - c.OnEvicted(kv.key, kv.value) - } - } - c.ll = nil - c.cache = nil -} diff --git a/vendor/github.com/golang/protobuf/AUTHORS b/vendor/github.com/golang/protobuf/AUTHORS deleted file mode 100644 index 15167cd74..000000000 --- a/vendor/github.com/golang/protobuf/AUTHORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code refers to The Go Authors for copyright purposes. -# The master list of authors is in the main Go distribution, -# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/github.com/golang/protobuf/CONTRIBUTORS b/vendor/github.com/golang/protobuf/CONTRIBUTORS deleted file mode 100644 index 1c4577e96..000000000 --- a/vendor/github.com/golang/protobuf/CONTRIBUTORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code was written by the Go contributors. -# The master list of contributors is in the main Go distribution, -# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/vendor/github.com/golang/protobuf/LICENSE b/vendor/github.com/golang/protobuf/LICENSE deleted file mode 100644 index 0f646931a..000000000 --- a/vendor/github.com/golang/protobuf/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ -Copyright 2010 The Go Authors. 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 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. - diff --git a/vendor/github.com/golang/protobuf/proto/buffer.go b/vendor/github.com/golang/protobuf/proto/buffer.go deleted file mode 100644 index e810e6fea..000000000 --- a/vendor/github.com/golang/protobuf/proto/buffer.go +++ /dev/null @@ -1,324 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "errors" - "fmt" - - "google.golang.org/protobuf/encoding/prototext" - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - WireVarint = 0 - WireFixed32 = 5 - WireFixed64 = 1 - WireBytes = 2 - WireStartGroup = 3 - WireEndGroup = 4 -) - -// EncodeVarint returns the varint encoded bytes of v. -func EncodeVarint(v uint64) []byte { - return protowire.AppendVarint(nil, v) -} - -// SizeVarint returns the length of the varint encoded bytes of v. -// This is equal to len(EncodeVarint(v)). -func SizeVarint(v uint64) int { - return protowire.SizeVarint(v) -} - -// DecodeVarint parses a varint encoded integer from b, -// returning the integer value and the length of the varint. -// It returns (0, 0) if there is a parse error. -func DecodeVarint(b []byte) (uint64, int) { - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return 0, 0 - } - return v, n -} - -// Buffer is a buffer for encoding and decoding the protobuf wire format. -// It may be reused between invocations to reduce memory usage. -type Buffer struct { - buf []byte - idx int - deterministic bool -} - -// NewBuffer allocates a new Buffer initialized with buf, -// where the contents of buf are considered the unread portion of the buffer. -func NewBuffer(buf []byte) *Buffer { - return &Buffer{buf: buf} -} - -// SetDeterministic specifies whether to use deterministic serialization. -// -// Deterministic serialization guarantees that for a given binary, equal -// messages will always be serialized to the same bytes. This implies: -// -// - Repeated serialization of a message will return the same bytes. -// - Different processes of the same binary (which may be executing on -// different machines) will serialize equal messages to the same bytes. -// -// Note that the deterministic serialization is NOT canonical across -// languages. It is not guaranteed to remain stable over time. It is unstable -// across different builds with schema changes due to unknown fields. -// Users who need canonical serialization (e.g., persistent storage in a -// canonical form, fingerprinting, etc.) should define their own -// canonicalization specification and implement their own serializer rather -// than relying on this API. -// -// If deterministic serialization is requested, map entries will be sorted -// by keys in lexographical order. This is an implementation detail and -// subject to change. -func (b *Buffer) SetDeterministic(deterministic bool) { - b.deterministic = deterministic -} - -// SetBuf sets buf as the internal buffer, -// where the contents of buf are considered the unread portion of the buffer. -func (b *Buffer) SetBuf(buf []byte) { - b.buf = buf - b.idx = 0 -} - -// Reset clears the internal buffer of all written and unread data. -func (b *Buffer) Reset() { - b.buf = b.buf[:0] - b.idx = 0 -} - -// Bytes returns the internal buffer. -func (b *Buffer) Bytes() []byte { - return b.buf -} - -// Unread returns the unread portion of the buffer. -func (b *Buffer) Unread() []byte { - return b.buf[b.idx:] -} - -// Marshal appends the wire-format encoding of m to the buffer. -func (b *Buffer) Marshal(m Message) error { - var err error - b.buf, err = marshalAppend(b.buf, m, b.deterministic) - return err -} - -// Unmarshal parses the wire-format message in the buffer and -// places the decoded results in m. -// It does not reset m before unmarshaling. -func (b *Buffer) Unmarshal(m Message) error { - err := UnmarshalMerge(b.Unread(), m) - b.idx = len(b.buf) - return err -} - -type unknownFields struct{ XXX_unrecognized protoimpl.UnknownFields } - -func (m *unknownFields) String() string { panic("not implemented") } -func (m *unknownFields) Reset() { panic("not implemented") } -func (m *unknownFields) ProtoMessage() { panic("not implemented") } - -// DebugPrint dumps the encoded bytes of b with a header and footer including s -// to stdout. This is only intended for debugging. -func (*Buffer) DebugPrint(s string, b []byte) { - m := MessageReflect(new(unknownFields)) - m.SetUnknown(b) - b, _ = prototext.MarshalOptions{AllowPartial: true, Indent: "\t"}.Marshal(m.Interface()) - fmt.Printf("==== %s ====\n%s==== %s ====\n", s, b, s) -} - -// EncodeVarint appends an unsigned varint encoding to the buffer. -func (b *Buffer) EncodeVarint(v uint64) error { - b.buf = protowire.AppendVarint(b.buf, v) - return nil -} - -// EncodeZigzag32 appends a 32-bit zig-zag varint encoding to the buffer. -func (b *Buffer) EncodeZigzag32(v uint64) error { - return b.EncodeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31)))) -} - -// EncodeZigzag64 appends a 64-bit zig-zag varint encoding to the buffer. -func (b *Buffer) EncodeZigzag64(v uint64) error { - return b.EncodeVarint(uint64((uint64(v) << 1) ^ uint64((int64(v) >> 63)))) -} - -// EncodeFixed32 appends a 32-bit little-endian integer to the buffer. -func (b *Buffer) EncodeFixed32(v uint64) error { - b.buf = protowire.AppendFixed32(b.buf, uint32(v)) - return nil -} - -// EncodeFixed64 appends a 64-bit little-endian integer to the buffer. -func (b *Buffer) EncodeFixed64(v uint64) error { - b.buf = protowire.AppendFixed64(b.buf, uint64(v)) - return nil -} - -// EncodeRawBytes appends a length-prefixed raw bytes to the buffer. -func (b *Buffer) EncodeRawBytes(v []byte) error { - b.buf = protowire.AppendBytes(b.buf, v) - return nil -} - -// EncodeStringBytes appends a length-prefixed raw bytes to the buffer. -// It does not validate whether v contains valid UTF-8. -func (b *Buffer) EncodeStringBytes(v string) error { - b.buf = protowire.AppendString(b.buf, v) - return nil -} - -// EncodeMessage appends a length-prefixed encoded message to the buffer. -func (b *Buffer) EncodeMessage(m Message) error { - var err error - b.buf = protowire.AppendVarint(b.buf, uint64(Size(m))) - b.buf, err = marshalAppend(b.buf, m, b.deterministic) - return err -} - -// DecodeVarint consumes an encoded unsigned varint from the buffer. -func (b *Buffer) DecodeVarint() (uint64, error) { - v, n := protowire.ConsumeVarint(b.buf[b.idx:]) - if n < 0 { - return 0, protowire.ParseError(n) - } - b.idx += n - return uint64(v), nil -} - -// DecodeZigzag32 consumes an encoded 32-bit zig-zag varint from the buffer. -func (b *Buffer) DecodeZigzag32() (uint64, error) { - v, err := b.DecodeVarint() - if err != nil { - return 0, err - } - return uint64((uint32(v) >> 1) ^ uint32((int32(v&1)<<31)>>31)), nil -} - -// DecodeZigzag64 consumes an encoded 64-bit zig-zag varint from the buffer. -func (b *Buffer) DecodeZigzag64() (uint64, error) { - v, err := b.DecodeVarint() - if err != nil { - return 0, err - } - return uint64((uint64(v) >> 1) ^ uint64((int64(v&1)<<63)>>63)), nil -} - -// DecodeFixed32 consumes a 32-bit little-endian integer from the buffer. -func (b *Buffer) DecodeFixed32() (uint64, error) { - v, n := protowire.ConsumeFixed32(b.buf[b.idx:]) - if n < 0 { - return 0, protowire.ParseError(n) - } - b.idx += n - return uint64(v), nil -} - -// DecodeFixed64 consumes a 64-bit little-endian integer from the buffer. -func (b *Buffer) DecodeFixed64() (uint64, error) { - v, n := protowire.ConsumeFixed64(b.buf[b.idx:]) - if n < 0 { - return 0, protowire.ParseError(n) - } - b.idx += n - return uint64(v), nil -} - -// DecodeRawBytes consumes a length-prefixed raw bytes from the buffer. -// If alloc is specified, it returns a copy the raw bytes -// rather than a sub-slice of the buffer. -func (b *Buffer) DecodeRawBytes(alloc bool) ([]byte, error) { - v, n := protowire.ConsumeBytes(b.buf[b.idx:]) - if n < 0 { - return nil, protowire.ParseError(n) - } - b.idx += n - if alloc { - v = append([]byte(nil), v...) - } - return v, nil -} - -// DecodeStringBytes consumes a length-prefixed raw bytes from the buffer. -// It does not validate whether the raw bytes contain valid UTF-8. -func (b *Buffer) DecodeStringBytes() (string, error) { - v, n := protowire.ConsumeString(b.buf[b.idx:]) - if n < 0 { - return "", protowire.ParseError(n) - } - b.idx += n - return v, nil -} - -// DecodeMessage consumes a length-prefixed message from the buffer. -// It does not reset m before unmarshaling. -func (b *Buffer) DecodeMessage(m Message) error { - v, err := b.DecodeRawBytes(false) - if err != nil { - return err - } - return UnmarshalMerge(v, m) -} - -// DecodeGroup consumes a message group from the buffer. -// It assumes that the start group marker has already been consumed and -// consumes all bytes until (and including the end group marker). -// It does not reset m before unmarshaling. -func (b *Buffer) DecodeGroup(m Message) error { - v, n, err := consumeGroup(b.buf[b.idx:]) - if err != nil { - return err - } - b.idx += n - return UnmarshalMerge(v, m) -} - -// consumeGroup parses b until it finds an end group marker, returning -// the raw bytes of the message (excluding the end group marker) and the -// the total length of the message (including the end group marker). -func consumeGroup(b []byte) ([]byte, int, error) { - b0 := b - depth := 1 // assume this follows a start group marker - for { - _, wtyp, tagLen := protowire.ConsumeTag(b) - if tagLen < 0 { - return nil, 0, protowire.ParseError(tagLen) - } - b = b[tagLen:] - - var valLen int - switch wtyp { - case protowire.VarintType: - _, valLen = protowire.ConsumeVarint(b) - case protowire.Fixed32Type: - _, valLen = protowire.ConsumeFixed32(b) - case protowire.Fixed64Type: - _, valLen = protowire.ConsumeFixed64(b) - case protowire.BytesType: - _, valLen = protowire.ConsumeBytes(b) - case protowire.StartGroupType: - depth++ - case protowire.EndGroupType: - depth-- - default: - return nil, 0, errors.New("proto: cannot parse reserved wire type") - } - if valLen < 0 { - return nil, 0, protowire.ParseError(valLen) - } - b = b[valLen:] - - if depth == 0 { - return b0[:len(b0)-len(b)-tagLen], len(b0) - len(b), nil - } - } -} diff --git a/vendor/github.com/golang/protobuf/proto/defaults.go b/vendor/github.com/golang/protobuf/proto/defaults.go deleted file mode 100644 index d399bf069..000000000 --- a/vendor/github.com/golang/protobuf/proto/defaults.go +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "google.golang.org/protobuf/reflect/protoreflect" -) - -// SetDefaults sets unpopulated scalar fields to their default values. -// Fields within a oneof are not set even if they have a default value. -// SetDefaults is recursively called upon any populated message fields. -func SetDefaults(m Message) { - if m != nil { - setDefaults(MessageReflect(m)) - } -} - -func setDefaults(m protoreflect.Message) { - fds := m.Descriptor().Fields() - for i := 0; i < fds.Len(); i++ { - fd := fds.Get(i) - if !m.Has(fd) { - if fd.HasDefault() && fd.ContainingOneof() == nil { - v := fd.Default() - if fd.Kind() == protoreflect.BytesKind { - v = protoreflect.ValueOf(append([]byte(nil), v.Bytes()...)) // copy the default bytes - } - m.Set(fd, v) - } - continue - } - } - - m.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { - switch { - // Handle singular message. - case fd.Cardinality() != protoreflect.Repeated: - if fd.Message() != nil { - setDefaults(m.Get(fd).Message()) - } - // Handle list of messages. - case fd.IsList(): - if fd.Message() != nil { - ls := m.Get(fd).List() - for i := 0; i < ls.Len(); i++ { - setDefaults(ls.Get(i).Message()) - } - } - // Handle map of messages. - case fd.IsMap(): - if fd.MapValue().Message() != nil { - ms := m.Get(fd).Map() - ms.Range(func(_ protoreflect.MapKey, v protoreflect.Value) bool { - setDefaults(v.Message()) - return true - }) - } - } - return true - }) -} diff --git a/vendor/github.com/golang/protobuf/proto/deprecated.go b/vendor/github.com/golang/protobuf/proto/deprecated.go deleted file mode 100644 index e8db57e09..000000000 --- a/vendor/github.com/golang/protobuf/proto/deprecated.go +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "encoding/json" - "errors" - "fmt" - "strconv" - - protoV2 "google.golang.org/protobuf/proto" -) - -var ( - // Deprecated: No longer returned. - ErrNil = errors.New("proto: Marshal called with nil") - - // Deprecated: No longer returned. - ErrTooLarge = errors.New("proto: message encodes to over 2 GB") - - // Deprecated: No longer returned. - ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof") -) - -// Deprecated: Do not use. -type Stats struct{ Emalloc, Dmalloc, Encode, Decode, Chit, Cmiss, Size uint64 } - -// Deprecated: Do not use. -func GetStats() Stats { return Stats{} } - -// Deprecated: Do not use. -func MarshalMessageSet(interface{}) ([]byte, error) { - return nil, errors.New("proto: not implemented") -} - -// Deprecated: Do not use. -func UnmarshalMessageSet([]byte, interface{}) error { - return errors.New("proto: not implemented") -} - -// Deprecated: Do not use. -func MarshalMessageSetJSON(interface{}) ([]byte, error) { - return nil, errors.New("proto: not implemented") -} - -// Deprecated: Do not use. -func UnmarshalMessageSetJSON([]byte, interface{}) error { - return errors.New("proto: not implemented") -} - -// Deprecated: Do not use. -func RegisterMessageSetType(Message, int32, string) {} - -// Deprecated: Do not use. -func EnumName(m map[int32]string, v int32) string { - s, ok := m[v] - if ok { - return s - } - return strconv.Itoa(int(v)) -} - -// Deprecated: Do not use. -func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) { - if data[0] == '"' { - // New style: enums are strings. - var repr string - if err := json.Unmarshal(data, &repr); err != nil { - return -1, err - } - val, ok := m[repr] - if !ok { - return 0, fmt.Errorf("unrecognized enum %s value %q", enumName, repr) - } - return val, nil - } - // Old style: enums are ints. - var val int32 - if err := json.Unmarshal(data, &val); err != nil { - return 0, fmt.Errorf("cannot unmarshal %#q into enum %s", data, enumName) - } - return val, nil -} - -// Deprecated: Do not use; this type existed for intenal-use only. -type InternalMessageInfo struct{} - -// Deprecated: Do not use; this method existed for intenal-use only. -func (*InternalMessageInfo) DiscardUnknown(m Message) { - DiscardUnknown(m) -} - -// Deprecated: Do not use; this method existed for intenal-use only. -func (*InternalMessageInfo) Marshal(b []byte, m Message, deterministic bool) ([]byte, error) { - return protoV2.MarshalOptions{Deterministic: deterministic}.MarshalAppend(b, MessageV2(m)) -} - -// Deprecated: Do not use; this method existed for intenal-use only. -func (*InternalMessageInfo) Merge(dst, src Message) { - protoV2.Merge(MessageV2(dst), MessageV2(src)) -} - -// Deprecated: Do not use; this method existed for intenal-use only. -func (*InternalMessageInfo) Size(m Message) int { - return protoV2.Size(MessageV2(m)) -} - -// Deprecated: Do not use; this method existed for intenal-use only. -func (*InternalMessageInfo) Unmarshal(m Message, b []byte) error { - return protoV2.UnmarshalOptions{Merge: true}.Unmarshal(b, MessageV2(m)) -} diff --git a/vendor/github.com/golang/protobuf/proto/discard.go b/vendor/github.com/golang/protobuf/proto/discard.go deleted file mode 100644 index 2187e877f..000000000 --- a/vendor/github.com/golang/protobuf/proto/discard.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "google.golang.org/protobuf/reflect/protoreflect" -) - -// DiscardUnknown recursively discards all unknown fields from this message -// and all embedded messages. -// -// When unmarshaling a message with unrecognized fields, the tags and values -// of such fields are preserved in the Message. This allows a later call to -// marshal to be able to produce a message that continues to have those -// unrecognized fields. To avoid this, DiscardUnknown is used to -// explicitly clear the unknown fields after unmarshaling. -func DiscardUnknown(m Message) { - if m != nil { - discardUnknown(MessageReflect(m)) - } -} - -func discardUnknown(m protoreflect.Message) { - m.Range(func(fd protoreflect.FieldDescriptor, val protoreflect.Value) bool { - switch { - // Handle singular message. - case fd.Cardinality() != protoreflect.Repeated: - if fd.Message() != nil { - discardUnknown(m.Get(fd).Message()) - } - // Handle list of messages. - case fd.IsList(): - if fd.Message() != nil { - ls := m.Get(fd).List() - for i := 0; i < ls.Len(); i++ { - discardUnknown(ls.Get(i).Message()) - } - } - // Handle map of messages. - case fd.IsMap(): - if fd.MapValue().Message() != nil { - ms := m.Get(fd).Map() - ms.Range(func(_ protoreflect.MapKey, v protoreflect.Value) bool { - discardUnknown(v.Message()) - return true - }) - } - } - return true - }) - - // Discard unknown fields. - if len(m.GetUnknown()) > 0 { - m.SetUnknown(nil) - } -} diff --git a/vendor/github.com/golang/protobuf/proto/extensions.go b/vendor/github.com/golang/protobuf/proto/extensions.go deleted file mode 100644 index 42fc120c9..000000000 --- a/vendor/github.com/golang/protobuf/proto/extensions.go +++ /dev/null @@ -1,356 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "errors" - "fmt" - "reflect" - - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" - "google.golang.org/protobuf/runtime/protoiface" - "google.golang.org/protobuf/runtime/protoimpl" -) - -type ( - // ExtensionDesc represents an extension descriptor and - // is used to interact with an extension field in a message. - // - // Variables of this type are generated in code by protoc-gen-go. - ExtensionDesc = protoimpl.ExtensionInfo - - // ExtensionRange represents a range of message extensions. - // Used in code generated by protoc-gen-go. - ExtensionRange = protoiface.ExtensionRangeV1 - - // Deprecated: Do not use; this is an internal type. - Extension = protoimpl.ExtensionFieldV1 - - // Deprecated: Do not use; this is an internal type. - XXX_InternalExtensions = protoimpl.ExtensionFields -) - -// ErrMissingExtension reports whether the extension was not present. -var ErrMissingExtension = errors.New("proto: missing extension") - -var errNotExtendable = errors.New("proto: not an extendable proto.Message") - -// HasExtension reports whether the extension field is present in m -// either as an explicitly populated field or as an unknown field. -func HasExtension(m Message, xt *ExtensionDesc) (has bool) { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() { - return false - } - - // Check whether any populated known field matches the field number. - xtd := xt.TypeDescriptor() - if isValidExtension(mr.Descriptor(), xtd) { - has = mr.Has(xtd) - } else { - mr.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool { - has = int32(fd.Number()) == xt.Field - return !has - }) - } - - // Check whether any unknown field matches the field number. - for b := mr.GetUnknown(); !has && len(b) > 0; { - num, _, n := protowire.ConsumeField(b) - has = int32(num) == xt.Field - b = b[n:] - } - return has -} - -// ClearExtension removes the extension field from m -// either as an explicitly populated field or as an unknown field. -func ClearExtension(m Message, xt *ExtensionDesc) { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() { - return - } - - xtd := xt.TypeDescriptor() - if isValidExtension(mr.Descriptor(), xtd) { - mr.Clear(xtd) - } else { - mr.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool { - if int32(fd.Number()) == xt.Field { - mr.Clear(fd) - return false - } - return true - }) - } - clearUnknown(mr, fieldNum(xt.Field)) -} - -// ClearAllExtensions clears all extensions from m. -// This includes populated fields and unknown fields in the extension range. -func ClearAllExtensions(m Message) { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() { - return - } - - mr.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool { - if fd.IsExtension() { - mr.Clear(fd) - } - return true - }) - clearUnknown(mr, mr.Descriptor().ExtensionRanges()) -} - -// GetExtension retrieves a proto2 extended field from m. -// -// If the descriptor is type complete (i.e., ExtensionDesc.ExtensionType is non-nil), -// then GetExtension parses the encoded field and returns a Go value of the specified type. -// If the field is not present, then the default value is returned (if one is specified), -// otherwise ErrMissingExtension is reported. -// -// If the descriptor is type incomplete (i.e., ExtensionDesc.ExtensionType is nil), -// then GetExtension returns the raw encoded bytes for the extension field. -func GetExtension(m Message, xt *ExtensionDesc) (interface{}, error) { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() || mr.Descriptor().ExtensionRanges().Len() == 0 { - return nil, errNotExtendable - } - - // Retrieve the unknown fields for this extension field. - var bo protoreflect.RawFields - for bi := mr.GetUnknown(); len(bi) > 0; { - num, _, n := protowire.ConsumeField(bi) - if int32(num) == xt.Field { - bo = append(bo, bi[:n]...) - } - bi = bi[n:] - } - - // For type incomplete descriptors, only retrieve the unknown fields. - if xt.ExtensionType == nil { - return []byte(bo), nil - } - - // If the extension field only exists as unknown fields, unmarshal it. - // This is rarely done since proto.Unmarshal eagerly unmarshals extensions. - xtd := xt.TypeDescriptor() - if !isValidExtension(mr.Descriptor(), xtd) { - return nil, fmt.Errorf("proto: bad extended type; %T does not extend %T", xt.ExtendedType, m) - } - if !mr.Has(xtd) && len(bo) > 0 { - m2 := mr.New() - if err := (proto.UnmarshalOptions{ - Resolver: extensionResolver{xt}, - }.Unmarshal(bo, m2.Interface())); err != nil { - return nil, err - } - if m2.Has(xtd) { - mr.Set(xtd, m2.Get(xtd)) - clearUnknown(mr, fieldNum(xt.Field)) - } - } - - // Check whether the message has the extension field set or a default. - var pv protoreflect.Value - switch { - case mr.Has(xtd): - pv = mr.Get(xtd) - case xtd.HasDefault(): - pv = xtd.Default() - default: - return nil, ErrMissingExtension - } - - v := xt.InterfaceOf(pv) - rv := reflect.ValueOf(v) - if isScalarKind(rv.Kind()) { - rv2 := reflect.New(rv.Type()) - rv2.Elem().Set(rv) - v = rv2.Interface() - } - return v, nil -} - -// extensionResolver is a custom extension resolver that stores a single -// extension type that takes precedence over the global registry. -type extensionResolver struct{ xt protoreflect.ExtensionType } - -func (r extensionResolver) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) { - if xtd := r.xt.TypeDescriptor(); xtd.FullName() == field { - return r.xt, nil - } - return protoregistry.GlobalTypes.FindExtensionByName(field) -} - -func (r extensionResolver) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) { - if xtd := r.xt.TypeDescriptor(); xtd.ContainingMessage().FullName() == message && xtd.Number() == field { - return r.xt, nil - } - return protoregistry.GlobalTypes.FindExtensionByNumber(message, field) -} - -// GetExtensions returns a list of the extensions values present in m, -// corresponding with the provided list of extension descriptors, xts. -// If an extension is missing in m, the corresponding value is nil. -func GetExtensions(m Message, xts []*ExtensionDesc) ([]interface{}, error) { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() { - return nil, errNotExtendable - } - - vs := make([]interface{}, len(xts)) - for i, xt := range xts { - v, err := GetExtension(m, xt) - if err != nil { - if err == ErrMissingExtension { - continue - } - return vs, err - } - vs[i] = v - } - return vs, nil -} - -// SetExtension sets an extension field in m to the provided value. -func SetExtension(m Message, xt *ExtensionDesc, v interface{}) error { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() || mr.Descriptor().ExtensionRanges().Len() == 0 { - return errNotExtendable - } - - rv := reflect.ValueOf(v) - if reflect.TypeOf(v) != reflect.TypeOf(xt.ExtensionType) { - return fmt.Errorf("proto: bad extension value type. got: %T, want: %T", v, xt.ExtensionType) - } - if rv.Kind() == reflect.Ptr { - if rv.IsNil() { - return fmt.Errorf("proto: SetExtension called with nil value of type %T", v) - } - if isScalarKind(rv.Elem().Kind()) { - v = rv.Elem().Interface() - } - } - - xtd := xt.TypeDescriptor() - if !isValidExtension(mr.Descriptor(), xtd) { - return fmt.Errorf("proto: bad extended type; %T does not extend %T", xt.ExtendedType, m) - } - mr.Set(xtd, xt.ValueOf(v)) - clearUnknown(mr, fieldNum(xt.Field)) - return nil -} - -// SetRawExtension inserts b into the unknown fields of m. -// -// Deprecated: Use Message.ProtoReflect.SetUnknown instead. -func SetRawExtension(m Message, fnum int32, b []byte) { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() { - return - } - - // Verify that the raw field is valid. - for b0 := b; len(b0) > 0; { - num, _, n := protowire.ConsumeField(b0) - if int32(num) != fnum { - panic(fmt.Sprintf("mismatching field number: got %d, want %d", num, fnum)) - } - b0 = b0[n:] - } - - ClearExtension(m, &ExtensionDesc{Field: fnum}) - mr.SetUnknown(append(mr.GetUnknown(), b...)) -} - -// ExtensionDescs returns a list of extension descriptors found in m, -// containing descriptors for both populated extension fields in m and -// also unknown fields of m that are in the extension range. -// For the later case, an type incomplete descriptor is provided where only -// the ExtensionDesc.Field field is populated. -// The order of the extension descriptors is undefined. -func ExtensionDescs(m Message) ([]*ExtensionDesc, error) { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() || mr.Descriptor().ExtensionRanges().Len() == 0 { - return nil, errNotExtendable - } - - // Collect a set of known extension descriptors. - extDescs := make(map[protoreflect.FieldNumber]*ExtensionDesc) - mr.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { - if fd.IsExtension() { - xt := fd.(protoreflect.ExtensionTypeDescriptor) - if xd, ok := xt.Type().(*ExtensionDesc); ok { - extDescs[fd.Number()] = xd - } - } - return true - }) - - // Collect a set of unknown extension descriptors. - extRanges := mr.Descriptor().ExtensionRanges() - for b := mr.GetUnknown(); len(b) > 0; { - num, _, n := protowire.ConsumeField(b) - if extRanges.Has(num) && extDescs[num] == nil { - extDescs[num] = nil - } - b = b[n:] - } - - // Transpose the set of descriptors into a list. - var xts []*ExtensionDesc - for num, xt := range extDescs { - if xt == nil { - xt = &ExtensionDesc{Field: int32(num)} - } - xts = append(xts, xt) - } - return xts, nil -} - -// isValidExtension reports whether xtd is a valid extension descriptor for md. -func isValidExtension(md protoreflect.MessageDescriptor, xtd protoreflect.ExtensionTypeDescriptor) bool { - return xtd.ContainingMessage() == md && md.ExtensionRanges().Has(xtd.Number()) -} - -// isScalarKind reports whether k is a protobuf scalar kind (except bytes). -// This function exists for historical reasons since the representation of -// scalars differs between v1 and v2, where v1 uses *T and v2 uses T. -func isScalarKind(k reflect.Kind) bool { - switch k { - case reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String: - return true - default: - return false - } -} - -// clearUnknown removes unknown fields from m where remover.Has reports true. -func clearUnknown(m protoreflect.Message, remover interface { - Has(protoreflect.FieldNumber) bool -}) { - var bo protoreflect.RawFields - for bi := m.GetUnknown(); len(bi) > 0; { - num, _, n := protowire.ConsumeField(bi) - if !remover.Has(num) { - bo = append(bo, bi[:n]...) - } - bi = bi[n:] - } - if bi := m.GetUnknown(); len(bi) != len(bo) { - m.SetUnknown(bo) - } -} - -type fieldNum protoreflect.FieldNumber - -func (n1 fieldNum) Has(n2 protoreflect.FieldNumber) bool { - return protoreflect.FieldNumber(n1) == n2 -} diff --git a/vendor/github.com/golang/protobuf/proto/properties.go b/vendor/github.com/golang/protobuf/proto/properties.go deleted file mode 100644 index dcdc2202f..000000000 --- a/vendor/github.com/golang/protobuf/proto/properties.go +++ /dev/null @@ -1,306 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "fmt" - "reflect" - "strconv" - "strings" - "sync" - - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/runtime/protoimpl" -) - -// StructProperties represents protocol buffer type information for a -// generated protobuf message in the open-struct API. -// -// Deprecated: Do not use. -type StructProperties struct { - // Prop are the properties for each field. - // - // Fields belonging to a oneof are stored in OneofTypes instead, with a - // single Properties representing the parent oneof held here. - // - // The order of Prop matches the order of fields in the Go struct. - // Struct fields that are not related to protobufs have a "XXX_" prefix - // in the Properties.Name and must be ignored by the user. - Prop []*Properties - - // OneofTypes contains information about the oneof fields in this message. - // It is keyed by the protobuf field name. - OneofTypes map[string]*OneofProperties -} - -// Properties represents the type information for a protobuf message field. -// -// Deprecated: Do not use. -type Properties struct { - // Name is a placeholder name with little meaningful semantic value. - // If the name has an "XXX_" prefix, the entire Properties must be ignored. - Name string - // OrigName is the protobuf field name or oneof name. - OrigName string - // JSONName is the JSON name for the protobuf field. - JSONName string - // Enum is a placeholder name for enums. - // For historical reasons, this is neither the Go name for the enum, - // nor the protobuf name for the enum. - Enum string // Deprecated: Do not use. - // Weak contains the full name of the weakly referenced message. - Weak string - // Wire is a string representation of the wire type. - Wire string - // WireType is the protobuf wire type for the field. - WireType int - // Tag is the protobuf field number. - Tag int - // Required reports whether this is a required field. - Required bool - // Optional reports whether this is a optional field. - Optional bool - // Repeated reports whether this is a repeated field. - Repeated bool - // Packed reports whether this is a packed repeated field of scalars. - Packed bool - // Proto3 reports whether this field operates under the proto3 syntax. - Proto3 bool - // Oneof reports whether this field belongs within a oneof. - Oneof bool - - // Default is the default value in string form. - Default string - // HasDefault reports whether the field has a default value. - HasDefault bool - - // MapKeyProp is the properties for the key field for a map field. - MapKeyProp *Properties - // MapValProp is the properties for the value field for a map field. - MapValProp *Properties -} - -// OneofProperties represents the type information for a protobuf oneof. -// -// Deprecated: Do not use. -type OneofProperties struct { - // Type is a pointer to the generated wrapper type for the field value. - // This is nil for messages that are not in the open-struct API. - Type reflect.Type - // Field is the index into StructProperties.Prop for the containing oneof. - Field int - // Prop is the properties for the field. - Prop *Properties -} - -// String formats the properties in the protobuf struct field tag style. -func (p *Properties) String() string { - s := p.Wire - s += "," + strconv.Itoa(p.Tag) - if p.Required { - s += ",req" - } - if p.Optional { - s += ",opt" - } - if p.Repeated { - s += ",rep" - } - if p.Packed { - s += ",packed" - } - s += ",name=" + p.OrigName - if p.JSONName != "" { - s += ",json=" + p.JSONName - } - if len(p.Enum) > 0 { - s += ",enum=" + p.Enum - } - if len(p.Weak) > 0 { - s += ",weak=" + p.Weak - } - if p.Proto3 { - s += ",proto3" - } - if p.Oneof { - s += ",oneof" - } - if p.HasDefault { - s += ",def=" + p.Default - } - return s -} - -// Parse populates p by parsing a string in the protobuf struct field tag style. -func (p *Properties) Parse(tag string) { - // For example: "bytes,49,opt,name=foo,def=hello!" - for len(tag) > 0 { - i := strings.IndexByte(tag, ',') - if i < 0 { - i = len(tag) - } - switch s := tag[:i]; { - case strings.HasPrefix(s, "name="): - p.OrigName = s[len("name="):] - case strings.HasPrefix(s, "json="): - p.JSONName = s[len("json="):] - case strings.HasPrefix(s, "enum="): - p.Enum = s[len("enum="):] - case strings.HasPrefix(s, "weak="): - p.Weak = s[len("weak="):] - case strings.Trim(s, "0123456789") == "": - n, _ := strconv.ParseUint(s, 10, 32) - p.Tag = int(n) - case s == "opt": - p.Optional = true - case s == "req": - p.Required = true - case s == "rep": - p.Repeated = true - case s == "varint" || s == "zigzag32" || s == "zigzag64": - p.Wire = s - p.WireType = WireVarint - case s == "fixed32": - p.Wire = s - p.WireType = WireFixed32 - case s == "fixed64": - p.Wire = s - p.WireType = WireFixed64 - case s == "bytes": - p.Wire = s - p.WireType = WireBytes - case s == "group": - p.Wire = s - p.WireType = WireStartGroup - case s == "packed": - p.Packed = true - case s == "proto3": - p.Proto3 = true - case s == "oneof": - p.Oneof = true - case strings.HasPrefix(s, "def="): - // The default tag is special in that everything afterwards is the - // default regardless of the presence of commas. - p.HasDefault = true - p.Default, i = tag[len("def="):], len(tag) - } - tag = strings.TrimPrefix(tag[i:], ",") - } -} - -// Init populates the properties from a protocol buffer struct tag. -// -// Deprecated: Do not use. -func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) { - p.Name = name - p.OrigName = name - if tag == "" { - return - } - p.Parse(tag) - - if typ != nil && typ.Kind() == reflect.Map { - p.MapKeyProp = new(Properties) - p.MapKeyProp.Init(nil, "Key", f.Tag.Get("protobuf_key"), nil) - p.MapValProp = new(Properties) - p.MapValProp.Init(nil, "Value", f.Tag.Get("protobuf_val"), nil) - } -} - -var propertiesCache sync.Map // map[reflect.Type]*StructProperties - -// GetProperties returns the list of properties for the type represented by t, -// which must be a generated protocol buffer message in the open-struct API, -// where protobuf message fields are represented by exported Go struct fields. -// -// Deprecated: Use protobuf reflection instead. -func GetProperties(t reflect.Type) *StructProperties { - if p, ok := propertiesCache.Load(t); ok { - return p.(*StructProperties) - } - p, _ := propertiesCache.LoadOrStore(t, newProperties(t)) - return p.(*StructProperties) -} - -func newProperties(t reflect.Type) *StructProperties { - if t.Kind() != reflect.Struct { - panic(fmt.Sprintf("%v is not a generated message in the open-struct API", t)) - } - - var hasOneof bool - prop := new(StructProperties) - - // Construct a list of properties for each field in the struct. - for i := 0; i < t.NumField(); i++ { - p := new(Properties) - f := t.Field(i) - tagField := f.Tag.Get("protobuf") - p.Init(f.Type, f.Name, tagField, &f) - - tagOneof := f.Tag.Get("protobuf_oneof") - if tagOneof != "" { - hasOneof = true - p.OrigName = tagOneof - } - - // Rename unrelated struct fields with the "XXX_" prefix since so much - // user code simply checks for this to exclude special fields. - if tagField == "" && tagOneof == "" && !strings.HasPrefix(p.Name, "XXX_") { - p.Name = "XXX_" + p.Name - p.OrigName = "XXX_" + p.OrigName - } else if p.Weak != "" { - p.Name = p.OrigName // avoid possible "XXX_" prefix on weak field - } - - prop.Prop = append(prop.Prop, p) - } - - // Construct a mapping of oneof field names to properties. - if hasOneof { - var oneofWrappers []interface{} - if fn, ok := reflect.PtrTo(t).MethodByName("XXX_OneofFuncs"); ok { - oneofWrappers = fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[3].Interface().([]interface{}) - } - if fn, ok := reflect.PtrTo(t).MethodByName("XXX_OneofWrappers"); ok { - oneofWrappers = fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[0].Interface().([]interface{}) - } - if m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(protoreflect.ProtoMessage); ok { - if m, ok := m.ProtoReflect().(interface{ ProtoMessageInfo() *protoimpl.MessageInfo }); ok { - oneofWrappers = m.ProtoMessageInfo().OneofWrappers - } - } - - prop.OneofTypes = make(map[string]*OneofProperties) - for _, wrapper := range oneofWrappers { - p := &OneofProperties{ - Type: reflect.ValueOf(wrapper).Type(), // *T - Prop: new(Properties), - } - f := p.Type.Elem().Field(0) - p.Prop.Name = f.Name - p.Prop.Parse(f.Tag.Get("protobuf")) - - // Determine the struct field that contains this oneof. - // Each wrapper is assignable to exactly one parent field. - var foundOneof bool - for i := 0; i < t.NumField() && !foundOneof; i++ { - if p.Type.AssignableTo(t.Field(i).Type) { - p.Field = i - foundOneof = true - } - } - if !foundOneof { - panic(fmt.Sprintf("%v is not a generated message in the open-struct API", t)) - } - prop.OneofTypes[p.Prop.OrigName] = p - } - } - - return prop -} - -func (sp *StructProperties) Len() int { return len(sp.Prop) } -func (sp *StructProperties) Less(i, j int) bool { return false } -func (sp *StructProperties) Swap(i, j int) { return } diff --git a/vendor/github.com/golang/protobuf/proto/proto.go b/vendor/github.com/golang/protobuf/proto/proto.go deleted file mode 100644 index 5aee89c32..000000000 --- a/vendor/github.com/golang/protobuf/proto/proto.go +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package proto provides functionality for handling protocol buffer messages. -// In particular, it provides marshaling and unmarshaling between a protobuf -// message and the binary wire format. -// -// See https://developers.google.com/protocol-buffers/docs/gotutorial for -// more information. -// -// Deprecated: Use the "google.golang.org/protobuf/proto" package instead. -package proto - -import ( - protoV2 "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/runtime/protoiface" - "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - ProtoPackageIsVersion1 = true - ProtoPackageIsVersion2 = true - ProtoPackageIsVersion3 = true - ProtoPackageIsVersion4 = true -) - -// GeneratedEnum is any enum type generated by protoc-gen-go -// which is a named int32 kind. -// This type exists for documentation purposes. -type GeneratedEnum interface{} - -// GeneratedMessage is any message type generated by protoc-gen-go -// which is a pointer to a named struct kind. -// This type exists for documentation purposes. -type GeneratedMessage interface{} - -// Message is a protocol buffer message. -// -// This is the v1 version of the message interface and is marginally better -// than an empty interface as it lacks any method to programatically interact -// with the contents of the message. -// -// A v2 message is declared in "google.golang.org/protobuf/proto".Message and -// exposes protobuf reflection as a first-class feature of the interface. -// -// To convert a v1 message to a v2 message, use the MessageV2 function. -// To convert a v2 message to a v1 message, use the MessageV1 function. -type Message = protoiface.MessageV1 - -// MessageV1 converts either a v1 or v2 message to a v1 message. -// It returns nil if m is nil. -func MessageV1(m GeneratedMessage) protoiface.MessageV1 { - return protoimpl.X.ProtoMessageV1Of(m) -} - -// MessageV2 converts either a v1 or v2 message to a v2 message. -// It returns nil if m is nil. -func MessageV2(m GeneratedMessage) protoV2.Message { - return protoimpl.X.ProtoMessageV2Of(m) -} - -// MessageReflect returns a reflective view for a message. -// It returns nil if m is nil. -func MessageReflect(m Message) protoreflect.Message { - return protoimpl.X.MessageOf(m) -} - -// Marshaler is implemented by messages that can marshal themselves. -// This interface is used by the following functions: Size, Marshal, -// Buffer.Marshal, and Buffer.EncodeMessage. -// -// Deprecated: Do not implement. -type Marshaler interface { - // Marshal formats the encoded bytes of the message. - // It should be deterministic and emit valid protobuf wire data. - // The caller takes ownership of the returned buffer. - Marshal() ([]byte, error) -} - -// Unmarshaler is implemented by messages that can unmarshal themselves. -// This interface is used by the following functions: Unmarshal, UnmarshalMerge, -// Buffer.Unmarshal, Buffer.DecodeMessage, and Buffer.DecodeGroup. -// -// Deprecated: Do not implement. -type Unmarshaler interface { - // Unmarshal parses the encoded bytes of the protobuf wire input. - // The provided buffer is only valid for during method call. - // It should not reset the receiver message. - Unmarshal([]byte) error -} - -// Merger is implemented by messages that can merge themselves. -// This interface is used by the following functions: Clone and Merge. -// -// Deprecated: Do not implement. -type Merger interface { - // Merge merges the contents of src into the receiver message. - // It clones all data structures in src such that it aliases no mutable - // memory referenced by src. - Merge(src Message) -} - -// RequiredNotSetError is an error type returned when -// marshaling or unmarshaling a message with missing required fields. -type RequiredNotSetError struct { - err error -} - -func (e *RequiredNotSetError) Error() string { - if e.err != nil { - return e.err.Error() - } - return "proto: required field not set" -} -func (e *RequiredNotSetError) RequiredNotSet() bool { - return true -} - -func checkRequiredNotSet(m protoV2.Message) error { - if err := protoV2.CheckInitialized(m); err != nil { - return &RequiredNotSetError{err: err} - } - return nil -} - -// Clone returns a deep copy of src. -func Clone(src Message) Message { - return MessageV1(protoV2.Clone(MessageV2(src))) -} - -// Merge merges src into dst, which must be messages of the same type. -// -// Populated scalar fields in src are copied to dst, while populated -// singular messages in src are merged into dst by recursively calling Merge. -// The elements of every list field in src is appended to the corresponded -// list fields in dst. The entries of every map field in src is copied into -// the corresponding map field in dst, possibly replacing existing entries. -// The unknown fields of src are appended to the unknown fields of dst. -func Merge(dst, src Message) { - protoV2.Merge(MessageV2(dst), MessageV2(src)) -} - -// Equal reports whether two messages are equal. -// If two messages marshal to the same bytes under deterministic serialization, -// then Equal is guaranteed to report true. -// -// Two messages are equal if they are the same protobuf message type, -// have the same set of populated known and extension field values, -// and the same set of unknown fields values. -// -// Scalar values are compared with the equivalent of the == operator in Go, -// except bytes values which are compared using bytes.Equal and -// floating point values which specially treat NaNs as equal. -// Message values are compared by recursively calling Equal. -// Lists are equal if each element value is also equal. -// Maps are equal if they have the same set of keys, where the pair of values -// for each key is also equal. -func Equal(x, y Message) bool { - return protoV2.Equal(MessageV2(x), MessageV2(y)) -} - -func isMessageSet(md protoreflect.MessageDescriptor) bool { - ms, ok := md.(interface{ IsMessageSet() bool }) - return ok && ms.IsMessageSet() -} diff --git a/vendor/github.com/golang/protobuf/proto/registry.go b/vendor/github.com/golang/protobuf/proto/registry.go deleted file mode 100644 index 066b4323b..000000000 --- a/vendor/github.com/golang/protobuf/proto/registry.go +++ /dev/null @@ -1,317 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "bytes" - "compress/gzip" - "fmt" - "io/ioutil" - "reflect" - "strings" - "sync" - - "google.golang.org/protobuf/reflect/protodesc" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" - "google.golang.org/protobuf/runtime/protoimpl" -) - -// filePath is the path to the proto source file. -type filePath = string // e.g., "google/protobuf/descriptor.proto" - -// fileDescGZIP is the compressed contents of the encoded FileDescriptorProto. -type fileDescGZIP = []byte - -var fileCache sync.Map // map[filePath]fileDescGZIP - -// RegisterFile is called from generated code to register the compressed -// FileDescriptorProto with the file path for a proto source file. -// -// Deprecated: Use protoregistry.GlobalFiles.RegisterFile instead. -func RegisterFile(s filePath, d fileDescGZIP) { - // Decompress the descriptor. - zr, err := gzip.NewReader(bytes.NewReader(d)) - if err != nil { - panic(fmt.Sprintf("proto: invalid compressed file descriptor: %v", err)) - } - b, err := ioutil.ReadAll(zr) - if err != nil { - panic(fmt.Sprintf("proto: invalid compressed file descriptor: %v", err)) - } - - // Construct a protoreflect.FileDescriptor from the raw descriptor. - // Note that DescBuilder.Build automatically registers the constructed - // file descriptor with the v2 registry. - protoimpl.DescBuilder{RawDescriptor: b}.Build() - - // Locally cache the raw descriptor form for the file. - fileCache.Store(s, d) -} - -// FileDescriptor returns the compressed FileDescriptorProto given the file path -// for a proto source file. It returns nil if not found. -// -// Deprecated: Use protoregistry.GlobalFiles.FindFileByPath instead. -func FileDescriptor(s filePath) fileDescGZIP { - if v, ok := fileCache.Load(s); ok { - return v.(fileDescGZIP) - } - - // Find the descriptor in the v2 registry. - var b []byte - if fd, _ := protoregistry.GlobalFiles.FindFileByPath(s); fd != nil { - b, _ = Marshal(protodesc.ToFileDescriptorProto(fd)) - } - - // Locally cache the raw descriptor form for the file. - if len(b) > 0 { - v, _ := fileCache.LoadOrStore(s, protoimpl.X.CompressGZIP(b)) - return v.(fileDescGZIP) - } - return nil -} - -// enumName is the name of an enum. For historical reasons, the enum name is -// neither the full Go name nor the full protobuf name of the enum. -// The name is the dot-separated combination of just the proto package that the -// enum is declared within followed by the Go type name of the generated enum. -type enumName = string // e.g., "my.proto.package.GoMessage_GoEnum" - -// enumsByName maps enum values by name to their numeric counterpart. -type enumsByName = map[string]int32 - -// enumsByNumber maps enum values by number to their name counterpart. -type enumsByNumber = map[int32]string - -var enumCache sync.Map // map[enumName]enumsByName -var numFilesCache sync.Map // map[protoreflect.FullName]int - -// RegisterEnum is called from the generated code to register the mapping of -// enum value names to enum numbers for the enum identified by s. -// -// Deprecated: Use protoregistry.GlobalTypes.RegisterEnum instead. -func RegisterEnum(s enumName, _ enumsByNumber, m enumsByName) { - if _, ok := enumCache.Load(s); ok { - panic("proto: duplicate enum registered: " + s) - } - enumCache.Store(s, m) - - // This does not forward registration to the v2 registry since this API - // lacks sufficient information to construct a complete v2 enum descriptor. -} - -// EnumValueMap returns the mapping from enum value names to enum numbers for -// the enum of the given name. It returns nil if not found. -// -// Deprecated: Use protoregistry.GlobalTypes.FindEnumByName instead. -func EnumValueMap(s enumName) enumsByName { - if v, ok := enumCache.Load(s); ok { - return v.(enumsByName) - } - - // Check whether the cache is stale. If the number of files in the current - // package differs, then it means that some enums may have been recently - // registered upstream that we do not know about. - var protoPkg protoreflect.FullName - if i := strings.LastIndexByte(s, '.'); i >= 0 { - protoPkg = protoreflect.FullName(s[:i]) - } - v, _ := numFilesCache.Load(protoPkg) - numFiles, _ := v.(int) - if protoregistry.GlobalFiles.NumFilesByPackage(protoPkg) == numFiles { - return nil // cache is up-to-date; was not found earlier - } - - // Update the enum cache for all enums declared in the given proto package. - numFiles = 0 - protoregistry.GlobalFiles.RangeFilesByPackage(protoPkg, func(fd protoreflect.FileDescriptor) bool { - walkEnums(fd, func(ed protoreflect.EnumDescriptor) { - name := protoimpl.X.LegacyEnumName(ed) - if _, ok := enumCache.Load(name); !ok { - m := make(enumsByName) - evs := ed.Values() - for i := evs.Len() - 1; i >= 0; i-- { - ev := evs.Get(i) - m[string(ev.Name())] = int32(ev.Number()) - } - enumCache.LoadOrStore(name, m) - } - }) - numFiles++ - return true - }) - numFilesCache.Store(protoPkg, numFiles) - - // Check cache again for enum map. - if v, ok := enumCache.Load(s); ok { - return v.(enumsByName) - } - return nil -} - -// walkEnums recursively walks all enums declared in d. -func walkEnums(d interface { - Enums() protoreflect.EnumDescriptors - Messages() protoreflect.MessageDescriptors -}, f func(protoreflect.EnumDescriptor)) { - eds := d.Enums() - for i := eds.Len() - 1; i >= 0; i-- { - f(eds.Get(i)) - } - mds := d.Messages() - for i := mds.Len() - 1; i >= 0; i-- { - walkEnums(mds.Get(i), f) - } -} - -// messageName is the full name of protobuf message. -type messageName = string - -var messageTypeCache sync.Map // map[messageName]reflect.Type - -// RegisterType is called from generated code to register the message Go type -// for a message of the given name. -// -// Deprecated: Use protoregistry.GlobalTypes.RegisterMessage instead. -func RegisterType(m Message, s messageName) { - mt := protoimpl.X.LegacyMessageTypeOf(m, protoreflect.FullName(s)) - if err := protoregistry.GlobalTypes.RegisterMessage(mt); err != nil { - panic(err) - } - messageTypeCache.Store(s, reflect.TypeOf(m)) -} - -// RegisterMapType is called from generated code to register the Go map type -// for a protobuf message representing a map entry. -// -// Deprecated: Do not use. -func RegisterMapType(m interface{}, s messageName) { - t := reflect.TypeOf(m) - if t.Kind() != reflect.Map { - panic(fmt.Sprintf("invalid map kind: %v", t)) - } - if _, ok := messageTypeCache.Load(s); ok { - panic(fmt.Errorf("proto: duplicate proto message registered: %s", s)) - } - messageTypeCache.Store(s, t) -} - -// MessageType returns the message type for a named message. -// It returns nil if not found. -// -// Deprecated: Use protoregistry.GlobalTypes.FindMessageByName instead. -func MessageType(s messageName) reflect.Type { - if v, ok := messageTypeCache.Load(s); ok { - return v.(reflect.Type) - } - - // Derive the message type from the v2 registry. - var t reflect.Type - if mt, _ := protoregistry.GlobalTypes.FindMessageByName(protoreflect.FullName(s)); mt != nil { - t = messageGoType(mt) - } - - // If we could not get a concrete type, it is possible that it is a - // pseudo-message for a map entry. - if t == nil { - d, _ := protoregistry.GlobalFiles.FindDescriptorByName(protoreflect.FullName(s)) - if md, _ := d.(protoreflect.MessageDescriptor); md != nil && md.IsMapEntry() { - kt := goTypeForField(md.Fields().ByNumber(1)) - vt := goTypeForField(md.Fields().ByNumber(2)) - t = reflect.MapOf(kt, vt) - } - } - - // Locally cache the message type for the given name. - if t != nil { - v, _ := messageTypeCache.LoadOrStore(s, t) - return v.(reflect.Type) - } - return nil -} - -func goTypeForField(fd protoreflect.FieldDescriptor) reflect.Type { - switch k := fd.Kind(); k { - case protoreflect.EnumKind: - if et, _ := protoregistry.GlobalTypes.FindEnumByName(fd.Enum().FullName()); et != nil { - return enumGoType(et) - } - return reflect.TypeOf(protoreflect.EnumNumber(0)) - case protoreflect.MessageKind, protoreflect.GroupKind: - if mt, _ := protoregistry.GlobalTypes.FindMessageByName(fd.Message().FullName()); mt != nil { - return messageGoType(mt) - } - return reflect.TypeOf((*protoreflect.Message)(nil)).Elem() - default: - return reflect.TypeOf(fd.Default().Interface()) - } -} - -func enumGoType(et protoreflect.EnumType) reflect.Type { - return reflect.TypeOf(et.New(0)) -} - -func messageGoType(mt protoreflect.MessageType) reflect.Type { - return reflect.TypeOf(MessageV1(mt.Zero().Interface())) -} - -// MessageName returns the full protobuf name for the given message type. -// -// Deprecated: Use protoreflect.MessageDescriptor.FullName instead. -func MessageName(m Message) messageName { - if m == nil { - return "" - } - if m, ok := m.(interface{ XXX_MessageName() messageName }); ok { - return m.XXX_MessageName() - } - return messageName(protoimpl.X.MessageDescriptorOf(m).FullName()) -} - -// RegisterExtension is called from the generated code to register -// the extension descriptor. -// -// Deprecated: Use protoregistry.GlobalTypes.RegisterExtension instead. -func RegisterExtension(d *ExtensionDesc) { - if err := protoregistry.GlobalTypes.RegisterExtension(d); err != nil { - panic(err) - } -} - -type extensionsByNumber = map[int32]*ExtensionDesc - -var extensionCache sync.Map // map[messageName]extensionsByNumber - -// RegisteredExtensions returns a map of the registered extensions for the -// provided protobuf message, indexed by the extension field number. -// -// Deprecated: Use protoregistry.GlobalTypes.RangeExtensionsByMessage instead. -func RegisteredExtensions(m Message) extensionsByNumber { - // Check whether the cache is stale. If the number of extensions for - // the given message differs, then it means that some extensions were - // recently registered upstream that we do not know about. - s := MessageName(m) - v, _ := extensionCache.Load(s) - xs, _ := v.(extensionsByNumber) - if protoregistry.GlobalTypes.NumExtensionsByMessage(protoreflect.FullName(s)) == len(xs) { - return xs // cache is up-to-date - } - - // Cache is stale, re-compute the extensions map. - xs = make(extensionsByNumber) - protoregistry.GlobalTypes.RangeExtensionsByMessage(protoreflect.FullName(s), func(xt protoreflect.ExtensionType) bool { - if xd, ok := xt.(*ExtensionDesc); ok { - xs[int32(xt.TypeDescriptor().Number())] = xd - } else { - // TODO: This implies that the protoreflect.ExtensionType is a - // custom type not generated by protoc-gen-go. We could try and - // convert the type to an ExtensionDesc. - } - return true - }) - extensionCache.Store(s, xs) - return xs -} diff --git a/vendor/github.com/golang/protobuf/proto/text_decode.go b/vendor/github.com/golang/protobuf/proto/text_decode.go deleted file mode 100644 index 47eb3e445..000000000 --- a/vendor/github.com/golang/protobuf/proto/text_decode.go +++ /dev/null @@ -1,801 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "encoding" - "errors" - "fmt" - "reflect" - "strconv" - "strings" - "unicode/utf8" - - "google.golang.org/protobuf/encoding/prototext" - protoV2 "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" -) - -const wrapTextUnmarshalV2 = false - -// ParseError is returned by UnmarshalText. -type ParseError struct { - Message string - - // Deprecated: Do not use. - Line, Offset int -} - -func (e *ParseError) Error() string { - if wrapTextUnmarshalV2 { - return e.Message - } - if e.Line == 1 { - return fmt.Sprintf("line 1.%d: %v", e.Offset, e.Message) - } - return fmt.Sprintf("line %d: %v", e.Line, e.Message) -} - -// UnmarshalText parses a proto text formatted string into m. -func UnmarshalText(s string, m Message) error { - if u, ok := m.(encoding.TextUnmarshaler); ok { - return u.UnmarshalText([]byte(s)) - } - - m.Reset() - mi := MessageV2(m) - - if wrapTextUnmarshalV2 { - err := prototext.UnmarshalOptions{ - AllowPartial: true, - }.Unmarshal([]byte(s), mi) - if err != nil { - return &ParseError{Message: err.Error()} - } - return checkRequiredNotSet(mi) - } else { - if err := newTextParser(s).unmarshalMessage(mi.ProtoReflect(), ""); err != nil { - return err - } - return checkRequiredNotSet(mi) - } -} - -type textParser struct { - s string // remaining input - done bool // whether the parsing is finished (success or error) - backed bool // whether back() was called - offset, line int - cur token -} - -type token struct { - value string - err *ParseError - line int // line number - offset int // byte number from start of input, not start of line - unquoted string // the unquoted version of value, if it was a quoted string -} - -func newTextParser(s string) *textParser { - p := new(textParser) - p.s = s - p.line = 1 - p.cur.line = 1 - return p -} - -func (p *textParser) unmarshalMessage(m protoreflect.Message, terminator string) (err error) { - md := m.Descriptor() - fds := md.Fields() - - // A struct is a sequence of "name: value", terminated by one of - // '>' or '}', or the end of the input. A name may also be - // "[extension]" or "[type/url]". - // - // The whole struct can also be an expanded Any message, like: - // [type/url] < ... struct contents ... > - seen := make(map[protoreflect.FieldNumber]bool) - for { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == terminator { - break - } - if tok.value == "[" { - if err := p.unmarshalExtensionOrAny(m, seen); err != nil { - return err - } - continue - } - - // This is a normal, non-extension field. - name := protoreflect.Name(tok.value) - fd := fds.ByName(name) - switch { - case fd == nil: - gd := fds.ByName(protoreflect.Name(strings.ToLower(string(name)))) - if gd != nil && gd.Kind() == protoreflect.GroupKind && gd.Message().Name() == name { - fd = gd - } - case fd.Kind() == protoreflect.GroupKind && fd.Message().Name() != name: - fd = nil - case fd.IsWeak() && fd.Message().IsPlaceholder(): - fd = nil - } - if fd == nil { - typeName := string(md.FullName()) - if m, ok := m.Interface().(Message); ok { - t := reflect.TypeOf(m) - if t.Kind() == reflect.Ptr { - typeName = t.Elem().String() - } - } - return p.errorf("unknown field name %q in %v", name, typeName) - } - if od := fd.ContainingOneof(); od != nil && m.WhichOneof(od) != nil { - return p.errorf("field '%s' would overwrite already parsed oneof '%s'", name, od.Name()) - } - if fd.Cardinality() != protoreflect.Repeated && seen[fd.Number()] { - return p.errorf("non-repeated field %q was repeated", fd.Name()) - } - seen[fd.Number()] = true - - // Consume any colon. - if err := p.checkForColon(fd); err != nil { - return err - } - - // Parse into the field. - v := m.Get(fd) - if !m.Has(fd) && (fd.IsList() || fd.IsMap() || fd.Message() != nil) { - v = m.Mutable(fd) - } - if v, err = p.unmarshalValue(v, fd); err != nil { - return err - } - m.Set(fd, v) - - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - } - return nil -} - -func (p *textParser) unmarshalExtensionOrAny(m protoreflect.Message, seen map[protoreflect.FieldNumber]bool) error { - name, err := p.consumeExtensionOrAnyName() - if err != nil { - return err - } - - // If it contains a slash, it's an Any type URL. - if slashIdx := strings.LastIndex(name, "/"); slashIdx >= 0 { - tok := p.next() - if tok.err != nil { - return tok.err - } - // consume an optional colon - if tok.value == ":" { - tok = p.next() - if tok.err != nil { - return tok.err - } - } - - var terminator string - switch tok.value { - case "<": - terminator = ">" - case "{": - terminator = "}" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - - mt, err := protoregistry.GlobalTypes.FindMessageByURL(name) - if err != nil { - return p.errorf("unrecognized message %q in google.protobuf.Any", name[slashIdx+len("/"):]) - } - m2 := mt.New() - if err := p.unmarshalMessage(m2, terminator); err != nil { - return err - } - b, err := protoV2.Marshal(m2.Interface()) - if err != nil { - return p.errorf("failed to marshal message of type %q: %v", name[slashIdx+len("/"):], err) - } - - urlFD := m.Descriptor().Fields().ByName("type_url") - valFD := m.Descriptor().Fields().ByName("value") - if seen[urlFD.Number()] { - return p.errorf("Any message unpacked multiple times, or %q already set", urlFD.Name()) - } - if seen[valFD.Number()] { - return p.errorf("Any message unpacked multiple times, or %q already set", valFD.Name()) - } - m.Set(urlFD, protoreflect.ValueOfString(name)) - m.Set(valFD, protoreflect.ValueOfBytes(b)) - seen[urlFD.Number()] = true - seen[valFD.Number()] = true - return nil - } - - xname := protoreflect.FullName(name) - xt, _ := protoregistry.GlobalTypes.FindExtensionByName(xname) - if xt == nil && isMessageSet(m.Descriptor()) { - xt, _ = protoregistry.GlobalTypes.FindExtensionByName(xname.Append("message_set_extension")) - } - if xt == nil { - return p.errorf("unrecognized extension %q", name) - } - fd := xt.TypeDescriptor() - if fd.ContainingMessage().FullName() != m.Descriptor().FullName() { - return p.errorf("extension field %q does not extend message %q", name, m.Descriptor().FullName()) - } - - if err := p.checkForColon(fd); err != nil { - return err - } - - v := m.Get(fd) - if !m.Has(fd) && (fd.IsList() || fd.IsMap() || fd.Message() != nil) { - v = m.Mutable(fd) - } - v, err = p.unmarshalValue(v, fd) - if err != nil { - return err - } - m.Set(fd, v) - return p.consumeOptionalSeparator() -} - -func (p *textParser) unmarshalValue(v protoreflect.Value, fd protoreflect.FieldDescriptor) (protoreflect.Value, error) { - tok := p.next() - if tok.err != nil { - return v, tok.err - } - if tok.value == "" { - return v, p.errorf("unexpected EOF") - } - - switch { - case fd.IsList(): - lv := v.List() - var err error - if tok.value == "[" { - // Repeated field with list notation, like [1,2,3]. - for { - vv := lv.NewElement() - vv, err = p.unmarshalSingularValue(vv, fd) - if err != nil { - return v, err - } - lv.Append(vv) - - tok := p.next() - if tok.err != nil { - return v, tok.err - } - if tok.value == "]" { - break - } - if tok.value != "," { - return v, p.errorf("Expected ']' or ',' found %q", tok.value) - } - } - return v, nil - } - - // One value of the repeated field. - p.back() - vv := lv.NewElement() - vv, err = p.unmarshalSingularValue(vv, fd) - if err != nil { - return v, err - } - lv.Append(vv) - return v, nil - case fd.IsMap(): - // The map entry should be this sequence of tokens: - // < key : KEY value : VALUE > - // However, implementations may omit key or value, and technically - // we should support them in any order. - var terminator string - switch tok.value { - case "<": - terminator = ">" - case "{": - terminator = "}" - default: - return v, p.errorf("expected '{' or '<', found %q", tok.value) - } - - keyFD := fd.MapKey() - valFD := fd.MapValue() - - mv := v.Map() - kv := keyFD.Default() - vv := mv.NewValue() - for { - tok := p.next() - if tok.err != nil { - return v, tok.err - } - if tok.value == terminator { - break - } - var err error - switch tok.value { - case "key": - if err := p.consumeToken(":"); err != nil { - return v, err - } - if kv, err = p.unmarshalSingularValue(kv, keyFD); err != nil { - return v, err - } - if err := p.consumeOptionalSeparator(); err != nil { - return v, err - } - case "value": - if err := p.checkForColon(valFD); err != nil { - return v, err - } - if vv, err = p.unmarshalSingularValue(vv, valFD); err != nil { - return v, err - } - if err := p.consumeOptionalSeparator(); err != nil { - return v, err - } - default: - p.back() - return v, p.errorf(`expected "key", "value", or %q, found %q`, terminator, tok.value) - } - } - mv.Set(kv.MapKey(), vv) - return v, nil - default: - p.back() - return p.unmarshalSingularValue(v, fd) - } -} - -func (p *textParser) unmarshalSingularValue(v protoreflect.Value, fd protoreflect.FieldDescriptor) (protoreflect.Value, error) { - tok := p.next() - if tok.err != nil { - return v, tok.err - } - if tok.value == "" { - return v, p.errorf("unexpected EOF") - } - - switch fd.Kind() { - case protoreflect.BoolKind: - switch tok.value { - case "true", "1", "t", "True": - return protoreflect.ValueOfBool(true), nil - case "false", "0", "f", "False": - return protoreflect.ValueOfBool(false), nil - } - case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: - if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil { - return protoreflect.ValueOfInt32(int32(x)), nil - } - - // The C++ parser accepts large positive hex numbers that uses - // two's complement arithmetic to represent negative numbers. - // This feature is here for backwards compatibility with C++. - if strings.HasPrefix(tok.value, "0x") { - if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil { - return protoreflect.ValueOfInt32(int32(-(int64(^x) + 1))), nil - } - } - case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: - if x, err := strconv.ParseInt(tok.value, 0, 64); err == nil { - return protoreflect.ValueOfInt64(int64(x)), nil - } - - // The C++ parser accepts large positive hex numbers that uses - // two's complement arithmetic to represent negative numbers. - // This feature is here for backwards compatibility with C++. - if strings.HasPrefix(tok.value, "0x") { - if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil { - return protoreflect.ValueOfInt64(int64(-(int64(^x) + 1))), nil - } - } - case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: - if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil { - return protoreflect.ValueOfUint32(uint32(x)), nil - } - case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: - if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil { - return protoreflect.ValueOfUint64(uint64(x)), nil - } - case protoreflect.FloatKind: - // Ignore 'f' for compatibility with output generated by C++, - // but don't remove 'f' when the value is "-inf" or "inf". - v := tok.value - if strings.HasSuffix(v, "f") && v != "-inf" && v != "inf" { - v = v[:len(v)-len("f")] - } - if x, err := strconv.ParseFloat(v, 32); err == nil { - return protoreflect.ValueOfFloat32(float32(x)), nil - } - case protoreflect.DoubleKind: - // Ignore 'f' for compatibility with output generated by C++, - // but don't remove 'f' when the value is "-inf" or "inf". - v := tok.value - if strings.HasSuffix(v, "f") && v != "-inf" && v != "inf" { - v = v[:len(v)-len("f")] - } - if x, err := strconv.ParseFloat(v, 64); err == nil { - return protoreflect.ValueOfFloat64(float64(x)), nil - } - case protoreflect.StringKind: - if isQuote(tok.value[0]) { - return protoreflect.ValueOfString(tok.unquoted), nil - } - case protoreflect.BytesKind: - if isQuote(tok.value[0]) { - return protoreflect.ValueOfBytes([]byte(tok.unquoted)), nil - } - case protoreflect.EnumKind: - if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil { - return protoreflect.ValueOfEnum(protoreflect.EnumNumber(x)), nil - } - vd := fd.Enum().Values().ByName(protoreflect.Name(tok.value)) - if vd != nil { - return protoreflect.ValueOfEnum(vd.Number()), nil - } - case protoreflect.MessageKind, protoreflect.GroupKind: - var terminator string - switch tok.value { - case "{": - terminator = "}" - case "<": - terminator = ">" - default: - return v, p.errorf("expected '{' or '<', found %q", tok.value) - } - err := p.unmarshalMessage(v.Message(), terminator) - return v, err - default: - panic(fmt.Sprintf("invalid kind %v", fd.Kind())) - } - return v, p.errorf("invalid %v: %v", fd.Kind(), tok.value) -} - -// Consume a ':' from the input stream (if the next token is a colon), -// returning an error if a colon is needed but not present. -func (p *textParser) checkForColon(fd protoreflect.FieldDescriptor) *ParseError { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != ":" { - if fd.Message() == nil { - return p.errorf("expected ':', found %q", tok.value) - } - p.back() - } - return nil -} - -// consumeExtensionOrAnyName consumes an extension name or an Any type URL and -// the following ']'. It returns the name or URL consumed. -func (p *textParser) consumeExtensionOrAnyName() (string, error) { - tok := p.next() - if tok.err != nil { - return "", tok.err - } - - // If extension name or type url is quoted, it's a single token. - if len(tok.value) > 2 && isQuote(tok.value[0]) && tok.value[len(tok.value)-1] == tok.value[0] { - name, err := unquoteC(tok.value[1:len(tok.value)-1], rune(tok.value[0])) - if err != nil { - return "", err - } - return name, p.consumeToken("]") - } - - // Consume everything up to "]" - var parts []string - for tok.value != "]" { - parts = append(parts, tok.value) - tok = p.next() - if tok.err != nil { - return "", p.errorf("unrecognized type_url or extension name: %s", tok.err) - } - if p.done && tok.value != "]" { - return "", p.errorf("unclosed type_url or extension name") - } - } - return strings.Join(parts, ""), nil -} - -// consumeOptionalSeparator consumes an optional semicolon or comma. -// It is used in unmarshalMessage to provide backward compatibility. -func (p *textParser) consumeOptionalSeparator() error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != ";" && tok.value != "," { - p.back() - } - return nil -} - -func (p *textParser) errorf(format string, a ...interface{}) *ParseError { - pe := &ParseError{fmt.Sprintf(format, a...), p.cur.line, p.cur.offset} - p.cur.err = pe - p.done = true - return pe -} - -func (p *textParser) skipWhitespace() { - i := 0 - for i < len(p.s) && (isWhitespace(p.s[i]) || p.s[i] == '#') { - if p.s[i] == '#' { - // comment; skip to end of line or input - for i < len(p.s) && p.s[i] != '\n' { - i++ - } - if i == len(p.s) { - break - } - } - if p.s[i] == '\n' { - p.line++ - } - i++ - } - p.offset += i - p.s = p.s[i:len(p.s)] - if len(p.s) == 0 { - p.done = true - } -} - -func (p *textParser) advance() { - // Skip whitespace - p.skipWhitespace() - if p.done { - return - } - - // Start of non-whitespace - p.cur.err = nil - p.cur.offset, p.cur.line = p.offset, p.line - p.cur.unquoted = "" - switch p.s[0] { - case '<', '>', '{', '}', ':', '[', ']', ';', ',', '/': - // Single symbol - p.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)] - case '"', '\'': - // Quoted string - i := 1 - for i < len(p.s) && p.s[i] != p.s[0] && p.s[i] != '\n' { - if p.s[i] == '\\' && i+1 < len(p.s) { - // skip escaped char - i++ - } - i++ - } - if i >= len(p.s) || p.s[i] != p.s[0] { - p.errorf("unmatched quote") - return - } - unq, err := unquoteC(p.s[1:i], rune(p.s[0])) - if err != nil { - p.errorf("invalid quoted string %s: %v", p.s[0:i+1], err) - return - } - p.cur.value, p.s = p.s[0:i+1], p.s[i+1:len(p.s)] - p.cur.unquoted = unq - default: - i := 0 - for i < len(p.s) && isIdentOrNumberChar(p.s[i]) { - i++ - } - if i == 0 { - p.errorf("unexpected byte %#x", p.s[0]) - return - } - p.cur.value, p.s = p.s[0:i], p.s[i:len(p.s)] - } - p.offset += len(p.cur.value) -} - -// Back off the parser by one token. Can only be done between calls to next(). -// It makes the next advance() a no-op. -func (p *textParser) back() { p.backed = true } - -// Advances the parser and returns the new current token. -func (p *textParser) next() *token { - if p.backed || p.done { - p.backed = false - return &p.cur - } - p.advance() - if p.done { - p.cur.value = "" - } else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) { - // Look for multiple quoted strings separated by whitespace, - // and concatenate them. - cat := p.cur - for { - p.skipWhitespace() - if p.done || !isQuote(p.s[0]) { - break - } - p.advance() - if p.cur.err != nil { - return &p.cur - } - cat.value += " " + p.cur.value - cat.unquoted += p.cur.unquoted - } - p.done = false // parser may have seen EOF, but we want to return cat - p.cur = cat - } - return &p.cur -} - -func (p *textParser) consumeToken(s string) error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != s { - p.back() - return p.errorf("expected %q, found %q", s, tok.value) - } - return nil -} - -var errBadUTF8 = errors.New("proto: bad UTF-8") - -func unquoteC(s string, quote rune) (string, error) { - // This is based on C++'s tokenizer.cc. - // Despite its name, this is *not* parsing C syntax. - // For instance, "\0" is an invalid quoted string. - - // Avoid allocation in trivial cases. - simple := true - for _, r := range s { - if r == '\\' || r == quote { - simple = false - break - } - } - if simple { - return s, nil - } - - buf := make([]byte, 0, 3*len(s)/2) - for len(s) > 0 { - r, n := utf8.DecodeRuneInString(s) - if r == utf8.RuneError && n == 1 { - return "", errBadUTF8 - } - s = s[n:] - if r != '\\' { - if r < utf8.RuneSelf { - buf = append(buf, byte(r)) - } else { - buf = append(buf, string(r)...) - } - continue - } - - ch, tail, err := unescape(s) - if err != nil { - return "", err - } - buf = append(buf, ch...) - s = tail - } - return string(buf), nil -} - -func unescape(s string) (ch string, tail string, err error) { - r, n := utf8.DecodeRuneInString(s) - if r == utf8.RuneError && n == 1 { - return "", "", errBadUTF8 - } - s = s[n:] - switch r { - case 'a': - return "\a", s, nil - case 'b': - return "\b", s, nil - case 'f': - return "\f", s, nil - case 'n': - return "\n", s, nil - case 'r': - return "\r", s, nil - case 't': - return "\t", s, nil - case 'v': - return "\v", s, nil - case '?': - return "?", s, nil // trigraph workaround - case '\'', '"', '\\': - return string(r), s, nil - case '0', '1', '2', '3', '4', '5', '6', '7': - if len(s) < 2 { - return "", "", fmt.Errorf(`\%c requires 2 following digits`, r) - } - ss := string(r) + s[:2] - s = s[2:] - i, err := strconv.ParseUint(ss, 8, 8) - if err != nil { - return "", "", fmt.Errorf(`\%s contains non-octal digits`, ss) - } - return string([]byte{byte(i)}), s, nil - case 'x', 'X', 'u', 'U': - var n int - switch r { - case 'x', 'X': - n = 2 - case 'u': - n = 4 - case 'U': - n = 8 - } - if len(s) < n { - return "", "", fmt.Errorf(`\%c requires %d following digits`, r, n) - } - ss := s[:n] - s = s[n:] - i, err := strconv.ParseUint(ss, 16, 64) - if err != nil { - return "", "", fmt.Errorf(`\%c%s contains non-hexadecimal digits`, r, ss) - } - if r == 'x' || r == 'X' { - return string([]byte{byte(i)}), s, nil - } - if i > utf8.MaxRune { - return "", "", fmt.Errorf(`\%c%s is not a valid Unicode code point`, r, ss) - } - return string(rune(i)), s, nil - } - return "", "", fmt.Errorf(`unknown escape \%c`, r) -} - -func isIdentOrNumberChar(c byte) bool { - switch { - case 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z': - return true - case '0' <= c && c <= '9': - return true - } - switch c { - case '-', '+', '.', '_': - return true - } - return false -} - -func isWhitespace(c byte) bool { - switch c { - case ' ', '\t', '\n', '\r': - return true - } - return false -} - -func isQuote(c byte) bool { - switch c { - case '"', '\'': - return true - } - return false -} diff --git a/vendor/github.com/golang/protobuf/proto/text_encode.go b/vendor/github.com/golang/protobuf/proto/text_encode.go deleted file mode 100644 index a31134eeb..000000000 --- a/vendor/github.com/golang/protobuf/proto/text_encode.go +++ /dev/null @@ -1,560 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "bytes" - "encoding" - "fmt" - "io" - "math" - "sort" - "strings" - - "google.golang.org/protobuf/encoding/prototext" - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" -) - -const wrapTextMarshalV2 = false - -// TextMarshaler is a configurable text format marshaler. -type TextMarshaler struct { - Compact bool // use compact text format (one line) - ExpandAny bool // expand google.protobuf.Any messages of known types -} - -// Marshal writes the proto text format of m to w. -func (tm *TextMarshaler) Marshal(w io.Writer, m Message) error { - b, err := tm.marshal(m) - if len(b) > 0 { - if _, err := w.Write(b); err != nil { - return err - } - } - return err -} - -// Text returns a proto text formatted string of m. -func (tm *TextMarshaler) Text(m Message) string { - b, _ := tm.marshal(m) - return string(b) -} - -func (tm *TextMarshaler) marshal(m Message) ([]byte, error) { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() { - return []byte(""), nil - } - - if wrapTextMarshalV2 { - if m, ok := m.(encoding.TextMarshaler); ok { - return m.MarshalText() - } - - opts := prototext.MarshalOptions{ - AllowPartial: true, - EmitUnknown: true, - } - if !tm.Compact { - opts.Indent = " " - } - if !tm.ExpandAny { - opts.Resolver = (*protoregistry.Types)(nil) - } - return opts.Marshal(mr.Interface()) - } else { - w := &textWriter{ - compact: tm.Compact, - expandAny: tm.ExpandAny, - complete: true, - } - - if m, ok := m.(encoding.TextMarshaler); ok { - b, err := m.MarshalText() - if err != nil { - return nil, err - } - w.Write(b) - return w.buf, nil - } - - err := w.writeMessage(mr) - return w.buf, err - } -} - -var ( - defaultTextMarshaler = TextMarshaler{} - compactTextMarshaler = TextMarshaler{Compact: true} -) - -// MarshalText writes the proto text format of m to w. -func MarshalText(w io.Writer, m Message) error { return defaultTextMarshaler.Marshal(w, m) } - -// MarshalTextString returns a proto text formatted string of m. -func MarshalTextString(m Message) string { return defaultTextMarshaler.Text(m) } - -// CompactText writes the compact proto text format of m to w. -func CompactText(w io.Writer, m Message) error { return compactTextMarshaler.Marshal(w, m) } - -// CompactTextString returns a compact proto text formatted string of m. -func CompactTextString(m Message) string { return compactTextMarshaler.Text(m) } - -var ( - newline = []byte("\n") - endBraceNewline = []byte("}\n") - posInf = []byte("inf") - negInf = []byte("-inf") - nan = []byte("nan") -) - -// textWriter is an io.Writer that tracks its indentation level. -type textWriter struct { - compact bool // same as TextMarshaler.Compact - expandAny bool // same as TextMarshaler.ExpandAny - complete bool // whether the current position is a complete line - indent int // indentation level; never negative - buf []byte -} - -func (w *textWriter) Write(p []byte) (n int, _ error) { - newlines := bytes.Count(p, newline) - if newlines == 0 { - if !w.compact && w.complete { - w.writeIndent() - } - w.buf = append(w.buf, p...) - w.complete = false - return len(p), nil - } - - frags := bytes.SplitN(p, newline, newlines+1) - if w.compact { - for i, frag := range frags { - if i > 0 { - w.buf = append(w.buf, ' ') - n++ - } - w.buf = append(w.buf, frag...) - n += len(frag) - } - return n, nil - } - - for i, frag := range frags { - if w.complete { - w.writeIndent() - } - w.buf = append(w.buf, frag...) - n += len(frag) - if i+1 < len(frags) { - w.buf = append(w.buf, '\n') - n++ - } - } - w.complete = len(frags[len(frags)-1]) == 0 - return n, nil -} - -func (w *textWriter) WriteByte(c byte) error { - if w.compact && c == '\n' { - c = ' ' - } - if !w.compact && w.complete { - w.writeIndent() - } - w.buf = append(w.buf, c) - w.complete = c == '\n' - return nil -} - -func (w *textWriter) writeName(fd protoreflect.FieldDescriptor) { - if !w.compact && w.complete { - w.writeIndent() - } - w.complete = false - - if fd.Kind() != protoreflect.GroupKind { - w.buf = append(w.buf, fd.Name()...) - w.WriteByte(':') - } else { - // Use message type name for group field name. - w.buf = append(w.buf, fd.Message().Name()...) - } - - if !w.compact { - w.WriteByte(' ') - } -} - -func requiresQuotes(u string) bool { - // When type URL contains any characters except [0-9A-Za-z./\-]*, it must be quoted. - for _, ch := range u { - switch { - case ch == '.' || ch == '/' || ch == '_': - continue - case '0' <= ch && ch <= '9': - continue - case 'A' <= ch && ch <= 'Z': - continue - case 'a' <= ch && ch <= 'z': - continue - default: - return true - } - } - return false -} - -// writeProto3Any writes an expanded google.protobuf.Any message. -// -// It returns (false, nil) if sv value can't be unmarshaled (e.g. because -// required messages are not linked in). -// -// It returns (true, error) when sv was written in expanded format or an error -// was encountered. -func (w *textWriter) writeProto3Any(m protoreflect.Message) (bool, error) { - md := m.Descriptor() - fdURL := md.Fields().ByName("type_url") - fdVal := md.Fields().ByName("value") - - url := m.Get(fdURL).String() - mt, err := protoregistry.GlobalTypes.FindMessageByURL(url) - if err != nil { - return false, nil - } - - b := m.Get(fdVal).Bytes() - m2 := mt.New() - if err := proto.Unmarshal(b, m2.Interface()); err != nil { - return false, nil - } - w.Write([]byte("[")) - if requiresQuotes(url) { - w.writeQuotedString(url) - } else { - w.Write([]byte(url)) - } - if w.compact { - w.Write([]byte("]:<")) - } else { - w.Write([]byte("]: <\n")) - w.indent++ - } - if err := w.writeMessage(m2); err != nil { - return true, err - } - if w.compact { - w.Write([]byte("> ")) - } else { - w.indent-- - w.Write([]byte(">\n")) - } - return true, nil -} - -func (w *textWriter) writeMessage(m protoreflect.Message) error { - md := m.Descriptor() - if w.expandAny && md.FullName() == "google.protobuf.Any" { - if canExpand, err := w.writeProto3Any(m); canExpand { - return err - } - } - - fds := md.Fields() - for i := 0; i < fds.Len(); { - fd := fds.Get(i) - if od := fd.ContainingOneof(); od != nil { - fd = m.WhichOneof(od) - i += od.Fields().Len() - } else { - i++ - } - if fd == nil || !m.Has(fd) { - continue - } - - switch { - case fd.IsList(): - lv := m.Get(fd).List() - for j := 0; j < lv.Len(); j++ { - w.writeName(fd) - v := lv.Get(j) - if err := w.writeSingularValue(v, fd); err != nil { - return err - } - w.WriteByte('\n') - } - case fd.IsMap(): - kfd := fd.MapKey() - vfd := fd.MapValue() - mv := m.Get(fd).Map() - - type entry struct{ key, val protoreflect.Value } - var entries []entry - mv.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool { - entries = append(entries, entry{k.Value(), v}) - return true - }) - sort.Slice(entries, func(i, j int) bool { - switch kfd.Kind() { - case protoreflect.BoolKind: - return !entries[i].key.Bool() && entries[j].key.Bool() - case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind, protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: - return entries[i].key.Int() < entries[j].key.Int() - case protoreflect.Uint32Kind, protoreflect.Fixed32Kind, protoreflect.Uint64Kind, protoreflect.Fixed64Kind: - return entries[i].key.Uint() < entries[j].key.Uint() - case protoreflect.StringKind: - return entries[i].key.String() < entries[j].key.String() - default: - panic("invalid kind") - } - }) - for _, entry := range entries { - w.writeName(fd) - w.WriteByte('<') - if !w.compact { - w.WriteByte('\n') - } - w.indent++ - w.writeName(kfd) - if err := w.writeSingularValue(entry.key, kfd); err != nil { - return err - } - w.WriteByte('\n') - w.writeName(vfd) - if err := w.writeSingularValue(entry.val, vfd); err != nil { - return err - } - w.WriteByte('\n') - w.indent-- - w.WriteByte('>') - w.WriteByte('\n') - } - default: - w.writeName(fd) - if err := w.writeSingularValue(m.Get(fd), fd); err != nil { - return err - } - w.WriteByte('\n') - } - } - - if b := m.GetUnknown(); len(b) > 0 { - w.writeUnknownFields(b) - } - return w.writeExtensions(m) -} - -func (w *textWriter) writeSingularValue(v protoreflect.Value, fd protoreflect.FieldDescriptor) error { - switch fd.Kind() { - case protoreflect.FloatKind, protoreflect.DoubleKind: - switch vf := v.Float(); { - case math.IsInf(vf, +1): - w.Write(posInf) - case math.IsInf(vf, -1): - w.Write(negInf) - case math.IsNaN(vf): - w.Write(nan) - default: - fmt.Fprint(w, v.Interface()) - } - case protoreflect.StringKind: - // NOTE: This does not validate UTF-8 for historical reasons. - w.writeQuotedString(string(v.String())) - case protoreflect.BytesKind: - w.writeQuotedString(string(v.Bytes())) - case protoreflect.MessageKind, protoreflect.GroupKind: - var bra, ket byte = '<', '>' - if fd.Kind() == protoreflect.GroupKind { - bra, ket = '{', '}' - } - w.WriteByte(bra) - if !w.compact { - w.WriteByte('\n') - } - w.indent++ - m := v.Message() - if m2, ok := m.Interface().(encoding.TextMarshaler); ok { - b, err := m2.MarshalText() - if err != nil { - return err - } - w.Write(b) - } else { - w.writeMessage(m) - } - w.indent-- - w.WriteByte(ket) - case protoreflect.EnumKind: - if ev := fd.Enum().Values().ByNumber(v.Enum()); ev != nil { - fmt.Fprint(w, ev.Name()) - } else { - fmt.Fprint(w, v.Enum()) - } - default: - fmt.Fprint(w, v.Interface()) - } - return nil -} - -// writeQuotedString writes a quoted string in the protocol buffer text format. -func (w *textWriter) writeQuotedString(s string) { - w.WriteByte('"') - for i := 0; i < len(s); i++ { - switch c := s[i]; c { - case '\n': - w.buf = append(w.buf, `\n`...) - case '\r': - w.buf = append(w.buf, `\r`...) - case '\t': - w.buf = append(w.buf, `\t`...) - case '"': - w.buf = append(w.buf, `\"`...) - case '\\': - w.buf = append(w.buf, `\\`...) - default: - if isPrint := c >= 0x20 && c < 0x7f; isPrint { - w.buf = append(w.buf, c) - } else { - w.buf = append(w.buf, fmt.Sprintf(`\%03o`, c)...) - } - } - } - w.WriteByte('"') -} - -func (w *textWriter) writeUnknownFields(b []byte) { - if !w.compact { - fmt.Fprintf(w, "/* %d unknown bytes */\n", len(b)) - } - - for len(b) > 0 { - num, wtyp, n := protowire.ConsumeTag(b) - if n < 0 { - return - } - b = b[n:] - - if wtyp == protowire.EndGroupType { - w.indent-- - w.Write(endBraceNewline) - continue - } - fmt.Fprint(w, num) - if wtyp != protowire.StartGroupType { - w.WriteByte(':') - } - if !w.compact || wtyp == protowire.StartGroupType { - w.WriteByte(' ') - } - switch wtyp { - case protowire.VarintType: - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return - } - b = b[n:] - fmt.Fprint(w, v) - case protowire.Fixed32Type: - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return - } - b = b[n:] - fmt.Fprint(w, v) - case protowire.Fixed64Type: - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return - } - b = b[n:] - fmt.Fprint(w, v) - case protowire.BytesType: - v, n := protowire.ConsumeBytes(b) - if n < 0 { - return - } - b = b[n:] - fmt.Fprintf(w, "%q", v) - case protowire.StartGroupType: - w.WriteByte('{') - w.indent++ - default: - fmt.Fprintf(w, "/* unknown wire type %d */", wtyp) - } - w.WriteByte('\n') - } -} - -// writeExtensions writes all the extensions in m. -func (w *textWriter) writeExtensions(m protoreflect.Message) error { - md := m.Descriptor() - if md.ExtensionRanges().Len() == 0 { - return nil - } - - type ext struct { - desc protoreflect.FieldDescriptor - val protoreflect.Value - } - var exts []ext - m.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { - if fd.IsExtension() { - exts = append(exts, ext{fd, v}) - } - return true - }) - sort.Slice(exts, func(i, j int) bool { - return exts[i].desc.Number() < exts[j].desc.Number() - }) - - for _, ext := range exts { - // For message set, use the name of the message as the extension name. - name := string(ext.desc.FullName()) - if isMessageSet(ext.desc.ContainingMessage()) { - name = strings.TrimSuffix(name, ".message_set_extension") - } - - if !ext.desc.IsList() { - if err := w.writeSingularExtension(name, ext.val, ext.desc); err != nil { - return err - } - } else { - lv := ext.val.List() - for i := 0; i < lv.Len(); i++ { - if err := w.writeSingularExtension(name, lv.Get(i), ext.desc); err != nil { - return err - } - } - } - } - return nil -} - -func (w *textWriter) writeSingularExtension(name string, v protoreflect.Value, fd protoreflect.FieldDescriptor) error { - fmt.Fprintf(w, "[%s]:", name) - if !w.compact { - w.WriteByte(' ') - } - if err := w.writeSingularValue(v, fd); err != nil { - return err - } - w.WriteByte('\n') - return nil -} - -func (w *textWriter) writeIndent() { - if !w.complete { - return - } - for i := 0; i < w.indent*2; i++ { - w.buf = append(w.buf, ' ') - } - w.complete = false -} diff --git a/vendor/github.com/golang/protobuf/proto/wire.go b/vendor/github.com/golang/protobuf/proto/wire.go deleted file mode 100644 index d7c28da5a..000000000 --- a/vendor/github.com/golang/protobuf/proto/wire.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - protoV2 "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/runtime/protoiface" -) - -// Size returns the size in bytes of the wire-format encoding of m. -func Size(m Message) int { - if m == nil { - return 0 - } - mi := MessageV2(m) - return protoV2.Size(mi) -} - -// Marshal returns the wire-format encoding of m. -func Marshal(m Message) ([]byte, error) { - b, err := marshalAppend(nil, m, false) - if b == nil { - b = zeroBytes - } - return b, err -} - -var zeroBytes = make([]byte, 0, 0) - -func marshalAppend(buf []byte, m Message, deterministic bool) ([]byte, error) { - if m == nil { - return nil, ErrNil - } - mi := MessageV2(m) - nbuf, err := protoV2.MarshalOptions{ - Deterministic: deterministic, - AllowPartial: true, - }.MarshalAppend(buf, mi) - if err != nil { - return buf, err - } - if len(buf) == len(nbuf) { - if !mi.ProtoReflect().IsValid() { - return buf, ErrNil - } - } - return nbuf, checkRequiredNotSet(mi) -} - -// Unmarshal parses a wire-format message in b and places the decoded results in m. -// -// Unmarshal resets m before starting to unmarshal, so any existing data in m is always -// removed. Use UnmarshalMerge to preserve and append to existing data. -func Unmarshal(b []byte, m Message) error { - m.Reset() - return UnmarshalMerge(b, m) -} - -// UnmarshalMerge parses a wire-format message in b and places the decoded results in m. -func UnmarshalMerge(b []byte, m Message) error { - mi := MessageV2(m) - out, err := protoV2.UnmarshalOptions{ - AllowPartial: true, - Merge: true, - }.UnmarshalState(protoiface.UnmarshalInput{ - Buf: b, - Message: mi.ProtoReflect(), - }) - if err != nil { - return err - } - if out.Flags&protoiface.UnmarshalInitialized > 0 { - return nil - } - return checkRequiredNotSet(mi) -} diff --git a/vendor/github.com/golang/protobuf/proto/wrappers.go b/vendor/github.com/golang/protobuf/proto/wrappers.go deleted file mode 100644 index 398e34859..000000000 --- a/vendor/github.com/golang/protobuf/proto/wrappers.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -// Bool stores v in a new bool value and returns a pointer to it. -func Bool(v bool) *bool { return &v } - -// Int stores v in a new int32 value and returns a pointer to it. -// -// Deprecated: Use Int32 instead. -func Int(v int) *int32 { return Int32(int32(v)) } - -// Int32 stores v in a new int32 value and returns a pointer to it. -func Int32(v int32) *int32 { return &v } - -// Int64 stores v in a new int64 value and returns a pointer to it. -func Int64(v int64) *int64 { return &v } - -// Uint32 stores v in a new uint32 value and returns a pointer to it. -func Uint32(v uint32) *uint32 { return &v } - -// Uint64 stores v in a new uint64 value and returns a pointer to it. -func Uint64(v uint64) *uint64 { return &v } - -// Float32 stores v in a new float32 value and returns a pointer to it. -func Float32(v float32) *float32 { return &v } - -// Float64 stores v in a new float64 value and returns a pointer to it. -func Float64(v float64) *float64 { return &v } - -// String stores v in a new string value and returns a pointer to it. -func String(v string) *string { return &v } diff --git a/vendor/github.com/golang/protobuf/ptypes/any.go b/vendor/github.com/golang/protobuf/ptypes/any.go deleted file mode 100644 index fdff3fdb4..000000000 --- a/vendor/github.com/golang/protobuf/ptypes/any.go +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ptypes - -import ( - "fmt" - "strings" - - "github.com/golang/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" - - anypb "github.com/golang/protobuf/ptypes/any" -) - -const urlPrefix = "type.googleapis.com/" - -// AnyMessageName returns the message name contained in an anypb.Any message. -// Most type assertions should use the Is function instead. -// -// Deprecated: Call the any.MessageName method instead. -func AnyMessageName(any *anypb.Any) (string, error) { - name, err := anyMessageName(any) - return string(name), err -} -func anyMessageName(any *anypb.Any) (protoreflect.FullName, error) { - if any == nil { - return "", fmt.Errorf("message is nil") - } - name := protoreflect.FullName(any.TypeUrl) - if i := strings.LastIndex(any.TypeUrl, "/"); i >= 0 { - name = name[i+len("/"):] - } - if !name.IsValid() { - return "", fmt.Errorf("message type url %q is invalid", any.TypeUrl) - } - return name, nil -} - -// MarshalAny marshals the given message m into an anypb.Any message. -// -// Deprecated: Call the anypb.New function instead. -func MarshalAny(m proto.Message) (*anypb.Any, error) { - switch dm := m.(type) { - case DynamicAny: - m = dm.Message - case *DynamicAny: - if dm == nil { - return nil, proto.ErrNil - } - m = dm.Message - } - b, err := proto.Marshal(m) - if err != nil { - return nil, err - } - return &anypb.Any{TypeUrl: urlPrefix + proto.MessageName(m), Value: b}, nil -} - -// Empty returns a new message of the type specified in an anypb.Any message. -// It returns protoregistry.NotFound if the corresponding message type could not -// be resolved in the global registry. -// -// Deprecated: Use protoregistry.GlobalTypes.FindMessageByName instead -// to resolve the message name and create a new instance of it. -func Empty(any *anypb.Any) (proto.Message, error) { - name, err := anyMessageName(any) - if err != nil { - return nil, err - } - mt, err := protoregistry.GlobalTypes.FindMessageByName(name) - if err != nil { - return nil, err - } - return proto.MessageV1(mt.New().Interface()), nil -} - -// UnmarshalAny unmarshals the encoded value contained in the anypb.Any message -// into the provided message m. It returns an error if the target message -// does not match the type in the Any message or if an unmarshal error occurs. -// -// The target message m may be a *DynamicAny message. If the underlying message -// type could not be resolved, then this returns protoregistry.NotFound. -// -// Deprecated: Call the any.UnmarshalTo method instead. -func UnmarshalAny(any *anypb.Any, m proto.Message) error { - if dm, ok := m.(*DynamicAny); ok { - if dm.Message == nil { - var err error - dm.Message, err = Empty(any) - if err != nil { - return err - } - } - m = dm.Message - } - - anyName, err := AnyMessageName(any) - if err != nil { - return err - } - msgName := proto.MessageName(m) - if anyName != msgName { - return fmt.Errorf("mismatched message type: got %q want %q", anyName, msgName) - } - return proto.Unmarshal(any.Value, m) -} - -// Is reports whether the Any message contains a message of the specified type. -// -// Deprecated: Call the any.MessageIs method instead. -func Is(any *anypb.Any, m proto.Message) bool { - if any == nil || m == nil { - return false - } - name := proto.MessageName(m) - if !strings.HasSuffix(any.TypeUrl, name) { - return false - } - return len(any.TypeUrl) == len(name) || any.TypeUrl[len(any.TypeUrl)-len(name)-1] == '/' -} - -// DynamicAny is a value that can be passed to UnmarshalAny to automatically -// allocate a proto.Message for the type specified in an anypb.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) -// -// Deprecated: Use the any.UnmarshalNew method instead to unmarshal -// the any message contents into a new instance of the underlying message. -type DynamicAny struct{ proto.Message } - -func (m DynamicAny) String() string { - if m.Message == nil { - return "" - } - return m.Message.String() -} -func (m DynamicAny) Reset() { - if m.Message == nil { - return - } - m.Message.Reset() -} -func (m DynamicAny) ProtoMessage() { - return -} -func (m DynamicAny) ProtoReflect() protoreflect.Message { - if m.Message == nil { - return nil - } - return dynamicAny{proto.MessageReflect(m.Message)} -} - -type dynamicAny struct{ protoreflect.Message } - -func (m dynamicAny) Type() protoreflect.MessageType { - return dynamicAnyType{m.Message.Type()} -} -func (m dynamicAny) New() protoreflect.Message { - return dynamicAnyType{m.Message.Type()}.New() -} -func (m dynamicAny) Interface() protoreflect.ProtoMessage { - return DynamicAny{proto.MessageV1(m.Message.Interface())} -} - -type dynamicAnyType struct{ protoreflect.MessageType } - -func (t dynamicAnyType) New() protoreflect.Message { - return dynamicAny{t.MessageType.New()} -} -func (t dynamicAnyType) Zero() protoreflect.Message { - return dynamicAny{t.MessageType.Zero()} -} diff --git a/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go b/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go deleted file mode 100644 index 0ef27d33d..000000000 --- a/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: github.com/golang/protobuf/ptypes/any/any.proto - -package any - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - reflect "reflect" -) - -// Symbols defined in public import of google/protobuf/any.proto. - -type Any = anypb.Any - -var File_github_com_golang_protobuf_ptypes_any_any_proto protoreflect.FileDescriptor - -var file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc = []byte{ - 0x0a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, - 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2f, 0x61, 0x6e, 0x79, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x2b, 0x5a, 0x29, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, - 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2f, 0x61, 0x6e, 0x79, 0x3b, 0x61, 0x6e, 0x79, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = []interface{}{} -var file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_github_com_golang_protobuf_ptypes_any_any_proto_init() } -func file_github_com_golang_protobuf_ptypes_any_any_proto_init() { - if File_github_com_golang_protobuf_ptypes_any_any_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes, - DependencyIndexes: file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs, - }.Build() - File_github_com_golang_protobuf_ptypes_any_any_proto = out.File - file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc = nil - file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = nil - file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = nil -} diff --git a/vendor/github.com/golang/protobuf/ptypes/doc.go b/vendor/github.com/golang/protobuf/ptypes/doc.go deleted file mode 100644 index d3c33259d..000000000 --- a/vendor/github.com/golang/protobuf/ptypes/doc.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package ptypes provides functionality for interacting with well-known types. -// -// Deprecated: Well-known types have specialized functionality directly -// injected into the generated packages for each message type. -// See the deprecation notice for each function for the suggested alternative. -package ptypes diff --git a/vendor/github.com/golang/protobuf/ptypes/duration.go b/vendor/github.com/golang/protobuf/ptypes/duration.go deleted file mode 100644 index b2b55dd85..000000000 --- a/vendor/github.com/golang/protobuf/ptypes/duration.go +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ptypes - -import ( - "errors" - "fmt" - "time" - - durationpb "github.com/golang/protobuf/ptypes/duration" -) - -// Range of google.protobuf.Duration as specified in duration.proto. -// This is about 10,000 years in seconds. -const ( - maxSeconds = int64(10000 * 365.25 * 24 * 60 * 60) - minSeconds = -maxSeconds -) - -// Duration converts a durationpb.Duration to a time.Duration. -// Duration returns an error if dur is invalid or overflows a time.Duration. -// -// Deprecated: Call the dur.AsDuration and dur.CheckValid methods instead. -func Duration(dur *durationpb.Duration) (time.Duration, error) { - if err := validateDuration(dur); err != nil { - return 0, err - } - d := time.Duration(dur.Seconds) * time.Second - if int64(d/time.Second) != dur.Seconds { - return 0, fmt.Errorf("duration: %v is out of range for time.Duration", dur) - } - if dur.Nanos != 0 { - d += time.Duration(dur.Nanos) * time.Nanosecond - if (d < 0) != (dur.Nanos < 0) { - return 0, fmt.Errorf("duration: %v is out of range for time.Duration", dur) - } - } - return d, nil -} - -// DurationProto converts a time.Duration to a durationpb.Duration. -// -// Deprecated: Call the durationpb.New function instead. -func DurationProto(d time.Duration) *durationpb.Duration { - nanos := d.Nanoseconds() - secs := nanos / 1e9 - nanos -= secs * 1e9 - return &durationpb.Duration{ - Seconds: int64(secs), - Nanos: int32(nanos), - } -} - -// validateDuration determines whether the durationpb.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 -// Note that the range of durationpb.Duration is about 10,000 years, -// while the range of time.Duration is about 290 years. -func validateDuration(dur *durationpb.Duration) error { - if dur == nil { - return errors.New("duration: nil Duration") - } - if dur.Seconds < minSeconds || dur.Seconds > maxSeconds { - return fmt.Errorf("duration: %v: seconds out of range", dur) - } - if dur.Nanos <= -1e9 || dur.Nanos >= 1e9 { - return fmt.Errorf("duration: %v: nanos out of range", dur) - } - // Seconds and Nanos must have the same sign, unless d.Nanos is zero. - if (dur.Seconds < 0 && dur.Nanos > 0) || (dur.Seconds > 0 && dur.Nanos < 0) { - return fmt.Errorf("duration: %v: seconds and nanos have different signs", dur) - } - return nil -} diff --git a/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go b/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go deleted file mode 100644 index d0079ee3e..000000000 --- a/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go +++ /dev/null @@ -1,63 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: github.com/golang/protobuf/ptypes/duration/duration.proto - -package duration - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - durationpb "google.golang.org/protobuf/types/known/durationpb" - reflect "reflect" -) - -// Symbols defined in public import of google/protobuf/duration.proto. - -type Duration = durationpb.Duration - -var File_github_com_golang_protobuf_ptypes_duration_duration_proto protoreflect.FileDescriptor - -var file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc = []byte{ - 0x0a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, - 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x64, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x35, 0x5a, 0x33, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var file_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes = []interface{}{} -var file_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_github_com_golang_protobuf_ptypes_duration_duration_proto_init() } -func file_github_com_golang_protobuf_ptypes_duration_duration_proto_init() { - if File_github_com_golang_protobuf_ptypes_duration_duration_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes, - DependencyIndexes: file_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs, - }.Build() - File_github_com_golang_protobuf_ptypes_duration_duration_proto = out.File - file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc = nil - file_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes = nil - file_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs = nil -} diff --git a/vendor/github.com/golang/protobuf/ptypes/timestamp.go b/vendor/github.com/golang/protobuf/ptypes/timestamp.go deleted file mode 100644 index 8368a3f70..000000000 --- a/vendor/github.com/golang/protobuf/ptypes/timestamp.go +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ptypes - -import ( - "errors" - "fmt" - "time" - - timestamppb "github.com/golang/protobuf/ptypes/timestamp" -) - -// Range of google.protobuf.Duration as specified in timestamp.proto. -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 -) - -// Timestamp converts a timestamppb.Timestamp 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. -// -// Deprecated: Call the ts.AsTime and ts.CheckValid methods instead. -func Timestamp(ts *timestamppb.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. -// -// Deprecated: Call the timestamppb.Now function instead. -func TimestampNow() *timestamppb.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. -// -// Deprecated: Call the timestamppb.New function instead. -func TimestampProto(t time.Time) (*timestamppb.Timestamp, error) { - ts := ×tamppb.Timestamp{ - Seconds: t.Unix(), - Nanos: int32(t.Nanosecond()), - } - 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. -// -// Deprecated: Call the ts.AsTime method instead, -// followed by a call to the Format method on the time.Time value. -func TimestampString(ts *timestamppb.Timestamp) string { - t, err := Timestamp(ts) - if err != nil { - return fmt.Sprintf("(%v)", err) - } - return t.Format(time.RFC3339Nano) -} - -// 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 *timestamppb.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 -} diff --git a/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go b/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go deleted file mode 100644 index a76f80760..000000000 --- a/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go +++ /dev/null @@ -1,64 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: github.com/golang/protobuf/ptypes/timestamp/timestamp.proto - -package timestamp - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" - reflect "reflect" -) - -// Symbols defined in public import of google/protobuf/timestamp.proto. - -type Timestamp = timestamppb.Timestamp - -var File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto protoreflect.FileDescriptor - -var file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc = []byte{ - 0x0a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, - 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2f, 0x74, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x37, - 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, - 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x3b, 0x74, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} - -var file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes = []interface{}{} -var file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_init() } -func file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_init() { - if File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes, - DependencyIndexes: file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs, - }.Build() - File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto = out.File - file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc = nil - file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes = nil - file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs = nil -} diff --git a/vendor/github.com/google/gnostic-models/LICENSE b/vendor/github.com/google/gnostic-models/LICENSE deleted file mode 100644 index 6b0b1270f..000000000 --- a/vendor/github.com/google/gnostic-models/LICENSE +++ /dev/null @@ -1,203 +0,0 @@ - - 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. - diff --git a/vendor/github.com/google/gnostic-models/compiler/README.md b/vendor/github.com/google/gnostic-models/compiler/README.md deleted file mode 100644 index ee9783d23..000000000 --- a/vendor/github.com/google/gnostic-models/compiler/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Compiler support code - -This directory contains compiler support code used by Gnostic and Gnostic -extensions. diff --git a/vendor/github.com/google/gnostic-models/compiler/context.go b/vendor/github.com/google/gnostic-models/compiler/context.go deleted file mode 100644 index 1bfe96121..000000000 --- a/vendor/github.com/google/gnostic-models/compiler/context.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// 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 compiler - -import ( - yaml "gopkg.in/yaml.v3" -) - -// Context contains state of the compiler as it traverses a document. -type Context struct { - Parent *Context - Name string - Node *yaml.Node - ExtensionHandlers *[]ExtensionHandler -} - -// NewContextWithExtensions returns a new object representing the compiler state -func NewContextWithExtensions(name string, node *yaml.Node, parent *Context, extensionHandlers *[]ExtensionHandler) *Context { - return &Context{Name: name, Node: node, Parent: parent, ExtensionHandlers: extensionHandlers} -} - -// NewContext returns a new object representing the compiler state -func NewContext(name string, node *yaml.Node, parent *Context) *Context { - if parent != nil { - return &Context{Name: name, Node: node, Parent: parent, ExtensionHandlers: parent.ExtensionHandlers} - } - return &Context{Name: name, Parent: parent, ExtensionHandlers: nil} -} - -// Description returns a text description of the compiler state -func (context *Context) Description() string { - name := context.Name - if context.Parent != nil { - name = context.Parent.Description() + "." + name - } - return name -} diff --git a/vendor/github.com/google/gnostic-models/compiler/error.go b/vendor/github.com/google/gnostic-models/compiler/error.go deleted file mode 100644 index 6f40515d6..000000000 --- a/vendor/github.com/google/gnostic-models/compiler/error.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// 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 compiler - -import "fmt" - -// Error represents compiler errors and their location in the document. -type Error struct { - Context *Context - Message string -} - -// NewError creates an Error. -func NewError(context *Context, message string) *Error { - return &Error{Context: context, Message: message} -} - -func (err *Error) locationDescription() string { - if err.Context.Node != nil { - return fmt.Sprintf("[%d,%d] %s", err.Context.Node.Line, err.Context.Node.Column, err.Context.Description()) - } - return err.Context.Description() -} - -// Error returns the string value of an Error. -func (err *Error) Error() string { - if err.Context == nil { - return err.Message - } - return err.locationDescription() + " " + err.Message -} - -// ErrorGroup is a container for groups of Error values. -type ErrorGroup struct { - Errors []error -} - -// NewErrorGroupOrNil returns a new ErrorGroup for a slice of errors or nil if the slice is empty. -func NewErrorGroupOrNil(errors []error) error { - if len(errors) == 0 { - return nil - } else if len(errors) == 1 { - return errors[0] - } else { - return &ErrorGroup{Errors: errors} - } -} - -func (group *ErrorGroup) Error() string { - result := "" - for i, err := range group.Errors { - if i > 0 { - result += "\n" - } - result += err.Error() - } - return result -} diff --git a/vendor/github.com/google/gnostic-models/compiler/extensions.go b/vendor/github.com/google/gnostic-models/compiler/extensions.go deleted file mode 100644 index 250c81e8c..000000000 --- a/vendor/github.com/google/gnostic-models/compiler/extensions.go +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// 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 compiler - -import ( - "bytes" - "fmt" - "os/exec" - "strings" - - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes/any" - yaml "gopkg.in/yaml.v3" - - extensions "github.com/google/gnostic-models/extensions" -) - -// ExtensionHandler describes a binary that is called by the compiler to handle specification extensions. -type ExtensionHandler struct { - Name string -} - -// CallExtension calls a binary extension handler. -func CallExtension(context *Context, in *yaml.Node, extensionName string) (handled bool, response *any.Any, err error) { - if context == nil || context.ExtensionHandlers == nil { - return false, nil, nil - } - handled = false - for _, handler := range *(context.ExtensionHandlers) { - response, err = handler.handle(in, extensionName) - if response == nil { - continue - } else { - handled = true - break - } - } - return handled, response, err -} - -func (extensionHandlers *ExtensionHandler) handle(in *yaml.Node, extensionName string) (*any.Any, error) { - if extensionHandlers.Name != "" { - yamlData, _ := yaml.Marshal(in) - request := &extensions.ExtensionHandlerRequest{ - CompilerVersion: &extensions.Version{ - Major: 0, - Minor: 1, - Patch: 0, - }, - Wrapper: &extensions.Wrapper{ - Version: "unknown", // TODO: set this to the type/version of spec being parsed. - Yaml: string(yamlData), - ExtensionName: extensionName, - }, - } - requestBytes, _ := proto.Marshal(request) - cmd := exec.Command(extensionHandlers.Name) - cmd.Stdin = bytes.NewReader(requestBytes) - output, err := cmd.Output() - if err != nil { - return nil, err - } - response := &extensions.ExtensionHandlerResponse{} - err = proto.Unmarshal(output, response) - if err != nil || !response.Handled { - return nil, err - } - if len(response.Errors) != 0 { - return nil, fmt.Errorf("Errors when parsing: %+v for field %s by vendor extension handler %s. Details %+v", in, extensionName, extensionHandlers.Name, strings.Join(response.Errors, ",")) - } - return response.Value, nil - } - return nil, nil -} diff --git a/vendor/github.com/google/gnostic-models/compiler/helpers.go b/vendor/github.com/google/gnostic-models/compiler/helpers.go deleted file mode 100644 index 975d65e8f..000000000 --- a/vendor/github.com/google/gnostic-models/compiler/helpers.go +++ /dev/null @@ -1,397 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// 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 compiler - -import ( - "fmt" - "regexp" - "sort" - "strconv" - - "gopkg.in/yaml.v3" - - "github.com/google/gnostic-models/jsonschema" -) - -// compiler helper functions, usually called from generated code - -// UnpackMap gets a *yaml.Node if possible. -func UnpackMap(in *yaml.Node) (*yaml.Node, bool) { - if in == nil { - return nil, false - } - return in, true -} - -// SortedKeysForMap returns the sorted keys of a yamlv2.MapSlice. -func SortedKeysForMap(m *yaml.Node) []string { - keys := make([]string, 0) - if m.Kind == yaml.MappingNode { - for i := 0; i < len(m.Content); i += 2 { - keys = append(keys, m.Content[i].Value) - } - } - sort.Strings(keys) - return keys -} - -// MapHasKey returns true if a yamlv2.MapSlice contains a specified key. -func MapHasKey(m *yaml.Node, key string) bool { - if m == nil { - return false - } - if m.Kind == yaml.MappingNode { - for i := 0; i < len(m.Content); i += 2 { - itemKey := m.Content[i].Value - if key == itemKey { - return true - } - } - } - return false -} - -// MapValueForKey gets the value of a map value for a specified key. -func MapValueForKey(m *yaml.Node, key string) *yaml.Node { - if m == nil { - return nil - } - if m.Kind == yaml.MappingNode { - for i := 0; i < len(m.Content); i += 2 { - itemKey := m.Content[i].Value - if key == itemKey { - return m.Content[i+1] - } - } - } - return nil -} - -// ConvertInterfaceArrayToStringArray converts an array of interfaces to an array of strings, if possible. -func ConvertInterfaceArrayToStringArray(interfaceArray []interface{}) []string { - stringArray := make([]string, 0) - for _, item := range interfaceArray { - v, ok := item.(string) - if ok { - stringArray = append(stringArray, v) - } - } - return stringArray -} - -// SequenceNodeForNode returns a node if it is a SequenceNode. -func SequenceNodeForNode(node *yaml.Node) (*yaml.Node, bool) { - if node.Kind != yaml.SequenceNode { - return nil, false - } - return node, true -} - -// BoolForScalarNode returns the bool value of a node. -func BoolForScalarNode(node *yaml.Node) (bool, bool) { - if node == nil { - return false, false - } - if node.Kind == yaml.DocumentNode { - return BoolForScalarNode(node.Content[0]) - } - if node.Kind != yaml.ScalarNode { - return false, false - } - if node.Tag != "!!bool" { - return false, false - } - v, err := strconv.ParseBool(node.Value) - if err != nil { - return false, false - } - return v, true -} - -// IntForScalarNode returns the integer value of a node. -func IntForScalarNode(node *yaml.Node) (int64, bool) { - if node == nil { - return 0, false - } - if node.Kind == yaml.DocumentNode { - return IntForScalarNode(node.Content[0]) - } - if node.Kind != yaml.ScalarNode { - return 0, false - } - if node.Tag != "!!int" { - return 0, false - } - v, err := strconv.ParseInt(node.Value, 10, 64) - if err != nil { - return 0, false - } - return v, true -} - -// FloatForScalarNode returns the float value of a node. -func FloatForScalarNode(node *yaml.Node) (float64, bool) { - if node == nil { - return 0.0, false - } - if node.Kind == yaml.DocumentNode { - return FloatForScalarNode(node.Content[0]) - } - if node.Kind != yaml.ScalarNode { - return 0.0, false - } - if (node.Tag != "!!int") && (node.Tag != "!!float") { - return 0.0, false - } - v, err := strconv.ParseFloat(node.Value, 64) - if err != nil { - return 0.0, false - } - return v, true -} - -// StringForScalarNode returns the string value of a node. -func StringForScalarNode(node *yaml.Node) (string, bool) { - if node == nil { - return "", false - } - if node.Kind == yaml.DocumentNode { - return StringForScalarNode(node.Content[0]) - } - switch node.Kind { - case yaml.ScalarNode: - switch node.Tag { - case "!!int": - return node.Value, true - case "!!str": - return node.Value, true - case "!!timestamp": - return node.Value, true - case "!!null": - return "", true - default: - return "", false - } - default: - return "", false - } -} - -// StringArrayForSequenceNode converts a sequence node to an array of strings, if possible. -func StringArrayForSequenceNode(node *yaml.Node) []string { - stringArray := make([]string, 0) - for _, item := range node.Content { - v, ok := StringForScalarNode(item) - if ok { - stringArray = append(stringArray, v) - } - } - return stringArray -} - -// MissingKeysInMap identifies which keys from a list of required keys are not in a map. -func MissingKeysInMap(m *yaml.Node, requiredKeys []string) []string { - missingKeys := make([]string, 0) - for _, k := range requiredKeys { - if !MapHasKey(m, k) { - missingKeys = append(missingKeys, k) - } - } - return missingKeys -} - -// InvalidKeysInMap returns keys in a map that don't match a list of allowed keys and patterns. -func InvalidKeysInMap(m *yaml.Node, allowedKeys []string, allowedPatterns []*regexp.Regexp) []string { - invalidKeys := make([]string, 0) - if m == nil || m.Kind != yaml.MappingNode { - return invalidKeys - } - for i := 0; i < len(m.Content); i += 2 { - key := m.Content[i].Value - found := false - // does the key match an allowed key? - for _, allowedKey := range allowedKeys { - if key == allowedKey { - found = true - break - } - } - if !found { - // does the key match an allowed pattern? - for _, allowedPattern := range allowedPatterns { - if allowedPattern.MatchString(key) { - found = true - break - } - } - if !found { - invalidKeys = append(invalidKeys, key) - } - } - } - return invalidKeys -} - -// NewNullNode creates a new Null node. -func NewNullNode() *yaml.Node { - node := &yaml.Node{ - Kind: yaml.ScalarNode, - Tag: "!!null", - } - return node -} - -// NewMappingNode creates a new Mapping node. -func NewMappingNode() *yaml.Node { - return &yaml.Node{ - Kind: yaml.MappingNode, - Content: make([]*yaml.Node, 0), - } -} - -// NewSequenceNode creates a new Sequence node. -func NewSequenceNode() *yaml.Node { - node := &yaml.Node{ - Kind: yaml.SequenceNode, - Content: make([]*yaml.Node, 0), - } - return node -} - -// NewScalarNodeForString creates a new node to hold a string. -func NewScalarNodeForString(s string) *yaml.Node { - return &yaml.Node{ - Kind: yaml.ScalarNode, - Tag: "!!str", - Value: s, - } -} - -// NewSequenceNodeForStringArray creates a new node to hold an array of strings. -func NewSequenceNodeForStringArray(strings []string) *yaml.Node { - node := &yaml.Node{ - Kind: yaml.SequenceNode, - Content: make([]*yaml.Node, 0), - } - for _, s := range strings { - node.Content = append(node.Content, NewScalarNodeForString(s)) - } - return node -} - -// NewScalarNodeForBool creates a new node to hold a bool. -func NewScalarNodeForBool(b bool) *yaml.Node { - return &yaml.Node{ - Kind: yaml.ScalarNode, - Tag: "!!bool", - Value: fmt.Sprintf("%t", b), - } -} - -// NewScalarNodeForFloat creates a new node to hold a float. -func NewScalarNodeForFloat(f float64) *yaml.Node { - return &yaml.Node{ - Kind: yaml.ScalarNode, - Tag: "!!float", - Value: fmt.Sprintf("%g", f), - } -} - -// NewScalarNodeForInt creates a new node to hold an integer. -func NewScalarNodeForInt(i int64) *yaml.Node { - return &yaml.Node{ - Kind: yaml.ScalarNode, - Tag: "!!int", - Value: fmt.Sprintf("%d", i), - } -} - -// PluralProperties returns the string "properties" pluralized. -func PluralProperties(count int) string { - if count == 1 { - return "property" - } - return "properties" -} - -// StringArrayContainsValue returns true if a string array contains a specified value. -func StringArrayContainsValue(array []string, value string) bool { - for _, item := range array { - if item == value { - return true - } - } - return false -} - -// StringArrayContainsValues returns true if a string array contains all of a list of specified values. -func StringArrayContainsValues(array []string, values []string) bool { - for _, value := range values { - if !StringArrayContainsValue(array, value) { - return false - } - } - return true -} - -// StringValue returns the string value of an item. -func StringValue(item interface{}) (value string, ok bool) { - value, ok = item.(string) - if ok { - return value, ok - } - intValue, ok := item.(int) - if ok { - return strconv.Itoa(intValue), true - } - return "", false -} - -// Description returns a human-readable represention of an item. -func Description(item interface{}) string { - value, ok := item.(*yaml.Node) - if ok { - return jsonschema.Render(value) - } - return fmt.Sprintf("%+v", item) -} - -// Display returns a description of a node for use in error messages. -func Display(node *yaml.Node) string { - switch node.Kind { - case yaml.ScalarNode: - switch node.Tag { - case "!!str": - return fmt.Sprintf("%s (string)", node.Value) - } - } - return fmt.Sprintf("%+v (%T)", node, node) -} - -// Marshal creates a yaml version of a structure in our preferred style -func Marshal(in *yaml.Node) []byte { - clearStyle(in) - //bytes, _ := yaml.Marshal(&yaml.Node{Kind: yaml.DocumentNode, Content: []*yaml.Node{in}}) - bytes, _ := yaml.Marshal(in) - - return bytes -} - -func clearStyle(node *yaml.Node) { - node.Style = 0 - for _, c := range node.Content { - clearStyle(c) - } -} diff --git a/vendor/github.com/google/gnostic-models/compiler/main.go b/vendor/github.com/google/gnostic-models/compiler/main.go deleted file mode 100644 index ce9fcc456..000000000 --- a/vendor/github.com/google/gnostic-models/compiler/main.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// 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 compiler provides support functions to generated compiler code. -package compiler diff --git a/vendor/github.com/google/gnostic-models/compiler/reader.go b/vendor/github.com/google/gnostic-models/compiler/reader.go deleted file mode 100644 index be0e8b40c..000000000 --- a/vendor/github.com/google/gnostic-models/compiler/reader.go +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// 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 compiler - -import ( - "fmt" - "io/ioutil" - "log" - "net/http" - "net/url" - "path/filepath" - "strings" - "sync" - - yaml "gopkg.in/yaml.v3" -) - -var verboseReader = false - -var fileCache map[string][]byte -var infoCache map[string]*yaml.Node - -var fileCacheEnable = true -var infoCacheEnable = true - -// These locks are used to synchronize accesses to the fileCache and infoCache -// maps (above). They are global state and can throw thread-related errors -// when modified from separate goroutines. The general strategy is to protect -// all public functions in this file with mutex Lock() calls. As a result, to -// avoid deadlock, these public functions should not call other public -// functions, so some public functions have private equivalents. -// In the future, we might consider replacing the maps with sync.Map and -// eliminating these mutexes. -var fileCacheMutex sync.Mutex -var infoCacheMutex sync.Mutex - -func initializeFileCache() { - if fileCache == nil { - fileCache = make(map[string][]byte, 0) - } -} - -func initializeInfoCache() { - if infoCache == nil { - infoCache = make(map[string]*yaml.Node, 0) - } -} - -// EnableFileCache turns on file caching. -func EnableFileCache() { - fileCacheMutex.Lock() - defer fileCacheMutex.Unlock() - fileCacheEnable = true -} - -// EnableInfoCache turns on parsed info caching. -func EnableInfoCache() { - infoCacheMutex.Lock() - defer infoCacheMutex.Unlock() - infoCacheEnable = true -} - -// DisableFileCache turns off file caching. -func DisableFileCache() { - fileCacheMutex.Lock() - defer fileCacheMutex.Unlock() - fileCacheEnable = false -} - -// DisableInfoCache turns off parsed info caching. -func DisableInfoCache() { - infoCacheMutex.Lock() - defer infoCacheMutex.Unlock() - infoCacheEnable = false -} - -// RemoveFromFileCache removes an entry from the file cache. -func RemoveFromFileCache(fileurl string) { - fileCacheMutex.Lock() - defer fileCacheMutex.Unlock() - if !fileCacheEnable { - return - } - initializeFileCache() - delete(fileCache, fileurl) -} - -// RemoveFromInfoCache removes an entry from the info cache. -func RemoveFromInfoCache(filename string) { - infoCacheMutex.Lock() - defer infoCacheMutex.Unlock() - if !infoCacheEnable { - return - } - initializeInfoCache() - delete(infoCache, filename) -} - -// GetInfoCache returns the info cache map. -func GetInfoCache() map[string]*yaml.Node { - infoCacheMutex.Lock() - defer infoCacheMutex.Unlock() - if infoCache == nil { - initializeInfoCache() - } - return infoCache -} - -// ClearFileCache clears the file cache. -func ClearFileCache() { - fileCacheMutex.Lock() - defer fileCacheMutex.Unlock() - fileCache = make(map[string][]byte, 0) -} - -// ClearInfoCache clears the info cache. -func ClearInfoCache() { - infoCacheMutex.Lock() - defer infoCacheMutex.Unlock() - infoCache = make(map[string]*yaml.Node) -} - -// ClearCaches clears all caches. -func ClearCaches() { - ClearFileCache() - ClearInfoCache() -} - -// FetchFile gets a specified file from the local filesystem or a remote location. -func FetchFile(fileurl string) ([]byte, error) { - fileCacheMutex.Lock() - defer fileCacheMutex.Unlock() - return fetchFile(fileurl) -} - -func fetchFile(fileurl string) ([]byte, error) { - var bytes []byte - initializeFileCache() - if fileCacheEnable { - bytes, ok := fileCache[fileurl] - if ok { - if verboseReader { - log.Printf("Cache hit %s", fileurl) - } - return bytes, nil - } - if verboseReader { - log.Printf("Fetching %s", fileurl) - } - } - response, err := http.Get(fileurl) - if err != nil { - return nil, err - } - defer response.Body.Close() - if response.StatusCode != 200 { - return nil, fmt.Errorf("Error downloading %s: %s", fileurl, response.Status) - } - bytes, err = ioutil.ReadAll(response.Body) - if fileCacheEnable && err == nil { - fileCache[fileurl] = bytes - } - return bytes, err -} - -// ReadBytesForFile reads the bytes of a file. -func ReadBytesForFile(filename string) ([]byte, error) { - fileCacheMutex.Lock() - defer fileCacheMutex.Unlock() - return readBytesForFile(filename) -} - -func readBytesForFile(filename string) ([]byte, error) { - // is the filename a url? - fileurl, _ := url.Parse(filename) - if fileurl.Scheme != "" { - // yes, fetch it - bytes, err := fetchFile(filename) - if err != nil { - return nil, err - } - return bytes, nil - } - // no, it's a local filename - bytes, err := ioutil.ReadFile(filename) - if err != nil { - return nil, err - } - return bytes, nil -} - -// ReadInfoFromBytes unmarshals a file as a *yaml.Node. -func ReadInfoFromBytes(filename string, bytes []byte) (*yaml.Node, error) { - infoCacheMutex.Lock() - defer infoCacheMutex.Unlock() - return readInfoFromBytes(filename, bytes) -} - -func readInfoFromBytes(filename string, bytes []byte) (*yaml.Node, error) { - initializeInfoCache() - if infoCacheEnable { - cachedInfo, ok := infoCache[filename] - if ok { - if verboseReader { - log.Printf("Cache hit info for file %s", filename) - } - return cachedInfo, nil - } - if verboseReader { - log.Printf("Reading info for file %s", filename) - } - } - var info yaml.Node - err := yaml.Unmarshal(bytes, &info) - if err != nil { - return nil, err - } - if infoCacheEnable && len(filename) > 0 { - infoCache[filename] = &info - } - return &info, nil -} - -// ReadInfoForRef reads a file and return the fragment needed to resolve a $ref. -func ReadInfoForRef(basefile string, ref string) (*yaml.Node, error) { - fileCacheMutex.Lock() - defer fileCacheMutex.Unlock() - infoCacheMutex.Lock() - defer infoCacheMutex.Unlock() - initializeInfoCache() - if infoCacheEnable { - info, ok := infoCache[ref] - if ok { - if verboseReader { - log.Printf("Cache hit for ref %s#%s", basefile, ref) - } - return info, nil - } - if verboseReader { - log.Printf("Reading info for ref %s#%s", basefile, ref) - } - } - basedir, _ := filepath.Split(basefile) - parts := strings.Split(ref, "#") - var filename string - if parts[0] != "" { - filename = parts[0] - if _, err := url.ParseRequestURI(parts[0]); err != nil { - // It is not an URL, so the file is local - filename = basedir + parts[0] - } - } else { - filename = basefile - } - bytes, err := readBytesForFile(filename) - if err != nil { - return nil, err - } - info, err := readInfoFromBytes(filename, bytes) - if info != nil && info.Kind == yaml.DocumentNode { - info = info.Content[0] - } - if err != nil { - log.Printf("File error: %v\n", err) - } else { - if info == nil { - return nil, NewError(nil, fmt.Sprintf("could not resolve %s", ref)) - } - if len(parts) > 1 { - path := strings.Split(parts[1], "/") - for i, key := range path { - if i > 0 { - m := info - if true { - found := false - for i := 0; i < len(m.Content); i += 2 { - if m.Content[i].Value == key { - info = m.Content[i+1] - found = true - } - } - if !found { - infoCache[ref] = nil - return nil, NewError(nil, fmt.Sprintf("could not resolve %s", ref)) - } - } - } - } - } - } - if infoCacheEnable { - infoCache[ref] = info - } - return info, nil -} diff --git a/vendor/github.com/google/gnostic-models/extensions/README.md b/vendor/github.com/google/gnostic-models/extensions/README.md deleted file mode 100644 index 4b5d63e58..000000000 --- a/vendor/github.com/google/gnostic-models/extensions/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# Extensions - -**Extension Support is experimental.** - -This directory contains support code for building Gnostic extensio handlers and -associated examples. - -Extension handlers can be used to compile vendor or specification extensions -into protocol buffer structures. - -Like plugins, extension handlers are built as separate executables. Extension -bodies are written to extension handlers as serialized -ExtensionHandlerRequests. diff --git a/vendor/github.com/google/gnostic-models/extensions/extension.pb.go b/vendor/github.com/google/gnostic-models/extensions/extension.pb.go deleted file mode 100644 index a71df8abe..000000000 --- a/vendor/github.com/google/gnostic-models/extensions/extension.pb.go +++ /dev/null @@ -1,461 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// 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. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.3 -// source: extensions/extension.proto - -package gnostic_extension_v1 - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// The version number of Gnostic. -type Version struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Major int32 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"` - Minor int32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"` - Patch int32 `protobuf:"varint,3,opt,name=patch,proto3" 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,proto3" json:"suffix,omitempty"` -} - -func (x *Version) Reset() { - *x = Version{} - if protoimpl.UnsafeEnabled { - mi := &file_extensions_extension_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Version) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Version) ProtoMessage() {} - -func (x *Version) ProtoReflect() protoreflect.Message { - mi := &file_extensions_extension_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Version.ProtoReflect.Descriptor instead. -func (*Version) Descriptor() ([]byte, []int) { - return file_extensions_extension_proto_rawDescGZIP(), []int{0} -} - -func (x *Version) GetMajor() int32 { - if x != nil { - return x.Major - } - return 0 -} - -func (x *Version) GetMinor() int32 { - if x != nil { - return x.Minor - } - return 0 -} - -func (x *Version) GetPatch() int32 { - if x != nil { - return x.Patch - } - return 0 -} - -func (x *Version) GetSuffix() string { - if x != nil { - return x.Suffix - } - return "" -} - -// An encoded Request is written to the ExtensionHandler's stdin. -type ExtensionHandlerRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The extension to process. - Wrapper *Wrapper `protobuf:"bytes,1,opt,name=wrapper,proto3" json:"wrapper,omitempty"` - // The version number of Gnostic. - CompilerVersion *Version `protobuf:"bytes,2,opt,name=compiler_version,json=compilerVersion,proto3" json:"compiler_version,omitempty"` -} - -func (x *ExtensionHandlerRequest) Reset() { - *x = ExtensionHandlerRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_extensions_extension_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ExtensionHandlerRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExtensionHandlerRequest) ProtoMessage() {} - -func (x *ExtensionHandlerRequest) ProtoReflect() protoreflect.Message { - mi := &file_extensions_extension_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExtensionHandlerRequest.ProtoReflect.Descriptor instead. -func (*ExtensionHandlerRequest) Descriptor() ([]byte, []int) { - return file_extensions_extension_proto_rawDescGZIP(), []int{1} -} - -func (x *ExtensionHandlerRequest) GetWrapper() *Wrapper { - if x != nil { - return x.Wrapper - } - return nil -} - -func (x *ExtensionHandlerRequest) GetCompilerVersion() *Version { - if x != nil { - return x.CompilerVersion - } - return nil -} - -// The extensions writes an encoded ExtensionHandlerResponse to stdout. -type ExtensionHandlerResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // true if the extension is handled by the extension handler; false otherwise - Handled bool `protobuf:"varint,1,opt,name=handled,proto3" json:"handled,omitempty"` - // Error message(s). If non-empty, the extension handling failed. - // The extension handler process should exit with status code zero - // even if it reports an error in this way. - // - // This should be used to indicate errors which prevent the extension from - // operating as intended. Errors which indicate a problem in gnostic - // itself -- such as the input Document being unparseable -- should be - // reported by writing a message to stderr and exiting with a non-zero - // status code. - Errors []string `protobuf:"bytes,2,rep,name=errors,proto3" json:"errors,omitempty"` - // text output - Value *anypb.Any `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *ExtensionHandlerResponse) Reset() { - *x = ExtensionHandlerResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_extensions_extension_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ExtensionHandlerResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExtensionHandlerResponse) ProtoMessage() {} - -func (x *ExtensionHandlerResponse) ProtoReflect() protoreflect.Message { - mi := &file_extensions_extension_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExtensionHandlerResponse.ProtoReflect.Descriptor instead. -func (*ExtensionHandlerResponse) Descriptor() ([]byte, []int) { - return file_extensions_extension_proto_rawDescGZIP(), []int{2} -} - -func (x *ExtensionHandlerResponse) GetHandled() bool { - if x != nil { - return x.Handled - } - return false -} - -func (x *ExtensionHandlerResponse) GetErrors() []string { - if x != nil { - return x.Errors - } - return nil -} - -func (x *ExtensionHandlerResponse) GetValue() *anypb.Any { - if x != nil { - return x.Value - } - return nil -} - -type Wrapper struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // version of the OpenAPI specification in which this extension was written. - Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - // Name of the extension. - ExtensionName string `protobuf:"bytes,2,opt,name=extension_name,json=extensionName,proto3" json:"extension_name,omitempty"` - // YAML-formatted extension value. - Yaml string `protobuf:"bytes,3,opt,name=yaml,proto3" json:"yaml,omitempty"` -} - -func (x *Wrapper) Reset() { - *x = Wrapper{} - if protoimpl.UnsafeEnabled { - mi := &file_extensions_extension_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Wrapper) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Wrapper) ProtoMessage() {} - -func (x *Wrapper) ProtoReflect() protoreflect.Message { - mi := &file_extensions_extension_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Wrapper.ProtoReflect.Descriptor instead. -func (*Wrapper) Descriptor() ([]byte, []int) { - return file_extensions_extension_proto_rawDescGZIP(), []int{3} -} - -func (x *Wrapper) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *Wrapper) GetExtensionName() string { - if x != nil { - return x.ExtensionName - } - return "" -} - -func (x *Wrapper) GetYaml() string { - if x != nil { - return x.Yaml - } - return "" -} - -var File_extensions_extension_proto protoreflect.FileDescriptor - -var file_extensions_extension_proto_rawDesc = []byte{ - 0x0a, 0x1a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x65, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x67, 0x6e, - 0x6f, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e, - 0x76, 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x63, 0x0a, - 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x6a, 0x6f, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x12, 0x14, - 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, - 0x69, 0x6e, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x75, - 0x66, 0x66, 0x69, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x75, 0x66, 0x66, - 0x69, 0x78, 0x22, 0x9c, 0x01, 0x0a, 0x17, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x37, - 0x0a, 0x07, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1d, 0x2e, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x52, 0x07, - 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x48, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x70, 0x69, - 0x6c, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x65, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x52, 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x22, 0x78, 0x0a, 0x18, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x61, - 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, - 0x07, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, - 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, - 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x12, - 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x5e, 0x0a, 0x07, 0x57, - 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x42, 0x4d, 0x0a, 0x0e, 0x6f, - 0x72, 0x67, 0x2e, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x76, 0x31, 0x42, 0x10, 0x47, - 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x50, - 0x01, 0x5a, 0x21, 0x2e, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x3b, - 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x5f, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x47, 0x4e, 0x58, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_extensions_extension_proto_rawDescOnce sync.Once - file_extensions_extension_proto_rawDescData = file_extensions_extension_proto_rawDesc -) - -func file_extensions_extension_proto_rawDescGZIP() []byte { - file_extensions_extension_proto_rawDescOnce.Do(func() { - file_extensions_extension_proto_rawDescData = protoimpl.X.CompressGZIP(file_extensions_extension_proto_rawDescData) - }) - return file_extensions_extension_proto_rawDescData -} - -var file_extensions_extension_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_extensions_extension_proto_goTypes = []interface{}{ - (*Version)(nil), // 0: gnostic.extension.v1.Version - (*ExtensionHandlerRequest)(nil), // 1: gnostic.extension.v1.ExtensionHandlerRequest - (*ExtensionHandlerResponse)(nil), // 2: gnostic.extension.v1.ExtensionHandlerResponse - (*Wrapper)(nil), // 3: gnostic.extension.v1.Wrapper - (*anypb.Any)(nil), // 4: google.protobuf.Any -} -var file_extensions_extension_proto_depIdxs = []int32{ - 3, // 0: gnostic.extension.v1.ExtensionHandlerRequest.wrapper:type_name -> gnostic.extension.v1.Wrapper - 0, // 1: gnostic.extension.v1.ExtensionHandlerRequest.compiler_version:type_name -> gnostic.extension.v1.Version - 4, // 2: gnostic.extension.v1.ExtensionHandlerResponse.value:type_name -> google.protobuf.Any - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_extensions_extension_proto_init() } -func file_extensions_extension_proto_init() { - if File_extensions_extension_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_extensions_extension_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Version); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_extensions_extension_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExtensionHandlerRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_extensions_extension_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExtensionHandlerResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_extensions_extension_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Wrapper); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_extensions_extension_proto_rawDesc, - NumEnums: 0, - NumMessages: 4, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_extensions_extension_proto_goTypes, - DependencyIndexes: file_extensions_extension_proto_depIdxs, - MessageInfos: file_extensions_extension_proto_msgTypes, - }.Build() - File_extensions_extension_proto = out.File - file_extensions_extension_proto_rawDesc = nil - file_extensions_extension_proto_goTypes = nil - file_extensions_extension_proto_depIdxs = nil -} diff --git a/vendor/github.com/google/gnostic-models/extensions/extension.proto b/vendor/github.com/google/gnostic-models/extensions/extension.proto deleted file mode 100644 index 875137c1a..000000000 --- a/vendor/github.com/google/gnostic-models/extensions/extension.proto +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// 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. - -syntax = "proto3"; - -package gnostic.extension.v1; - -import "google/protobuf/any.proto"; - -// This option lets the proto compiler generate Java code inside the package -// name (see below) instead of inside an outer class. It creates a simpler -// developer experience by reducing one-level of name nesting and be -// consistent with most programming languages that don't support outer classes. -option java_multiple_files = true; - -// The Java outer classname should be the filename in UpperCamelCase. This -// class is only used to hold proto descriptor, so developers don't need to -// work with it directly. -option java_outer_classname = "GnosticExtension"; - -// The Java package name must be proto package name with proper prefix. -option java_package = "org.gnostic.v1"; - -// A reasonable prefix for the Objective-C symbols generated from the package. -// It should at a minimum be 3 characters long, all uppercase, and convention -// is to use an abbreviation of the package name. Something short, but -// hopefully unique enough to not conflict with things that may come along in -// the future. 'GPB' is reserved for the protocol buffer implementation itself. -// -// "Gnostic Extension" -option objc_class_prefix = "GNX"; - -// The Go package name. -option go_package = "./extensions;gnostic_extension_v1"; - -// The version number of Gnostic. -message Version { - int32 major = 1; - int32 minor = 2; - int32 patch = 3; - // A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should - // be empty for mainline stable releases. - string suffix = 4; -} - -// An encoded Request is written to the ExtensionHandler's stdin. -message ExtensionHandlerRequest { - - // The extension to process. - Wrapper wrapper = 1; - - // The version number of Gnostic. - Version compiler_version = 2; -} - -// The extensions writes an encoded ExtensionHandlerResponse to stdout. -message ExtensionHandlerResponse { - - // true if the extension is handled by the extension handler; false otherwise - bool handled = 1; - - // Error message(s). If non-empty, the extension handling failed. - // The extension handler process should exit with status code zero - // even if it reports an error in this way. - // - // This should be used to indicate errors which prevent the extension from - // operating as intended. Errors which indicate a problem in gnostic - // itself -- such as the input Document being unparseable -- should be - // reported by writing a message to stderr and exiting with a non-zero - // status code. - repeated string errors = 2; - - // text output - google.protobuf.Any value = 3; -} - -message Wrapper { - // version of the OpenAPI specification in which this extension was written. - string version = 1; - - // Name of the extension. - string extension_name = 2; - - // YAML-formatted extension value. - string yaml = 3; -} diff --git a/vendor/github.com/google/gnostic-models/extensions/extensions.go b/vendor/github.com/google/gnostic-models/extensions/extensions.go deleted file mode 100644 index ec8afd009..000000000 --- a/vendor/github.com/google/gnostic-models/extensions/extensions.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// 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 gnostic_extension_v1 - -import ( - "io/ioutil" - "log" - "os" - - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes" -) - -type extensionHandler func(name string, yamlInput string) (bool, proto.Message, error) - -// Main implements the main program of an extension handler. -func Main(handler extensionHandler) { - // unpack the request - data, err := ioutil.ReadAll(os.Stdin) - if err != nil { - log.Println("File error:", err.Error()) - os.Exit(1) - } - if len(data) == 0 { - log.Println("No input data.") - os.Exit(1) - } - request := &ExtensionHandlerRequest{} - err = proto.Unmarshal(data, request) - if err != nil { - log.Println("Input error:", err.Error()) - os.Exit(1) - } - // call the handler - handled, output, err := handler(request.Wrapper.ExtensionName, request.Wrapper.Yaml) - // respond with the output of the handler - response := &ExtensionHandlerResponse{ - Handled: false, // default assumption - Errors: make([]string, 0), - } - if err != nil { - response.Errors = append(response.Errors, err.Error()) - } else if handled { - response.Handled = true - response.Value, err = ptypes.MarshalAny(output) - if err != nil { - response.Errors = append(response.Errors, err.Error()) - } - } - responseBytes, _ := proto.Marshal(response) - os.Stdout.Write(responseBytes) -} diff --git a/vendor/github.com/google/gnostic-models/jsonschema/README.md b/vendor/github.com/google/gnostic-models/jsonschema/README.md deleted file mode 100644 index 6793c5179..000000000 --- a/vendor/github.com/google/gnostic-models/jsonschema/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# jsonschema - -This directory contains code for reading, writing, and manipulating JSON -schemas. diff --git a/vendor/github.com/google/gnostic-models/jsonschema/base.go b/vendor/github.com/google/gnostic-models/jsonschema/base.go deleted file mode 100644 index 5fcc4885a..000000000 --- a/vendor/github.com/google/gnostic-models/jsonschema/base.go +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// 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. - -// THIS FILE IS AUTOMATICALLY GENERATED. - -package jsonschema - -import ( - "encoding/base64" -) - -func baseSchemaBytes() ([]byte, error){ - return base64.StdEncoding.DecodeString( -`ewogICAgImlkIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDQvc2NoZW1hIyIsCiAgICAi -JHNjaGVtYSI6ICJodHRwOi8vanNvbi1zY2hlbWEub3JnL2RyYWZ0LTA0L3NjaGVtYSMiLAogICAgImRl -c2NyaXB0aW9uIjogIkNvcmUgc2NoZW1hIG1ldGEtc2NoZW1hIiwKICAgICJkZWZpbml0aW9ucyI6IHsK -ICAgICAgICAic2NoZW1hQXJyYXkiOiB7CiAgICAgICAgICAgICJ0eXBlIjogImFycmF5IiwKICAgICAg -ICAgICAgIm1pbkl0ZW1zIjogMSwKICAgICAgICAgICAgIml0ZW1zIjogeyAiJHJlZiI6ICIjIiB9CiAg -ICAgICAgfSwKICAgICAgICAicG9zaXRpdmVJbnRlZ2VyIjogewogICAgICAgICAgICAidHlwZSI6ICJp -bnRlZ2VyIiwKICAgICAgICAgICAgIm1pbmltdW0iOiAwCiAgICAgICAgfSwKICAgICAgICAicG9zaXRp -dmVJbnRlZ2VyRGVmYXVsdDAiOiB7CiAgICAgICAgICAgICJhbGxPZiI6IFsgeyAiJHJlZiI6ICIjL2Rl -ZmluaXRpb25zL3Bvc2l0aXZlSW50ZWdlciIgfSwgeyAiZGVmYXVsdCI6IDAgfSBdCiAgICAgICAgfSwK -ICAgICAgICAic2ltcGxlVHlwZXMiOiB7CiAgICAgICAgICAgICJlbnVtIjogWyAiYXJyYXkiLCAiYm9v -bGVhbiIsICJpbnRlZ2VyIiwgIm51bGwiLCAibnVtYmVyIiwgIm9iamVjdCIsICJzdHJpbmciIF0KICAg -ICAgICB9LAogICAgICAgICJzdHJpbmdBcnJheSI6IHsKICAgICAgICAgICAgInR5cGUiOiAiYXJyYXki -LAogICAgICAgICAgICAiaXRlbXMiOiB7ICJ0eXBlIjogInN0cmluZyIgfSwKICAgICAgICAgICAgIm1p -bkl0ZW1zIjogMSwKICAgICAgICAgICAgInVuaXF1ZUl0ZW1zIjogdHJ1ZQogICAgICAgIH0KICAgIH0s -CiAgICAidHlwZSI6ICJvYmplY3QiLAogICAgInByb3BlcnRpZXMiOiB7CiAgICAgICAgImlkIjogewog -ICAgICAgICAgICAidHlwZSI6ICJzdHJpbmciLAogICAgICAgICAgICAiZm9ybWF0IjogInVyaSIKICAg -ICAgICB9LAogICAgICAgICIkc2NoZW1hIjogewogICAgICAgICAgICAidHlwZSI6ICJzdHJpbmciLAog -ICAgICAgICAgICAiZm9ybWF0IjogInVyaSIKICAgICAgICB9LAogICAgICAgICJ0aXRsZSI6IHsKICAg -ICAgICAgICAgInR5cGUiOiAic3RyaW5nIgogICAgICAgIH0sCiAgICAgICAgImRlc2NyaXB0aW9uIjog -ewogICAgICAgICAgICAidHlwZSI6ICJzdHJpbmciCiAgICAgICAgfSwKICAgICAgICAiZGVmYXVsdCI6 -IHt9LAogICAgICAgICJtdWx0aXBsZU9mIjogewogICAgICAgICAgICAidHlwZSI6ICJudW1iZXIiLAog -ICAgICAgICAgICAibWluaW11bSI6IDAsCiAgICAgICAgICAgICJleGNsdXNpdmVNaW5pbXVtIjogdHJ1 -ZQogICAgICAgIH0sCiAgICAgICAgIm1heGltdW0iOiB7CiAgICAgICAgICAgICJ0eXBlIjogIm51bWJl -ciIKICAgICAgICB9LAogICAgICAgICJleGNsdXNpdmVNYXhpbXVtIjogewogICAgICAgICAgICAidHlw -ZSI6ICJib29sZWFuIiwKICAgICAgICAgICAgImRlZmF1bHQiOiBmYWxzZQogICAgICAgIH0sCiAgICAg -ICAgIm1pbmltdW0iOiB7CiAgICAgICAgICAgICJ0eXBlIjogIm51bWJlciIKICAgICAgICB9LAogICAg -ICAgICJleGNsdXNpdmVNaW5pbXVtIjogewogICAgICAgICAgICAidHlwZSI6ICJib29sZWFuIiwKICAg -ICAgICAgICAgImRlZmF1bHQiOiBmYWxzZQogICAgICAgIH0sCiAgICAgICAgIm1heExlbmd0aCI6IHsg -IiRyZWYiOiAiIy9kZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXIiIH0sCiAgICAgICAgIm1pbkxlbmd0 -aCI6IHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXJEZWZhdWx0MCIgfSwKICAg -ICAgICAicGF0dGVybiI6IHsKICAgICAgICAgICAgInR5cGUiOiAic3RyaW5nIiwKICAgICAgICAgICAg -ImZvcm1hdCI6ICJyZWdleCIKICAgICAgICB9LAogICAgICAgICJhZGRpdGlvbmFsSXRlbXMiOiB7CiAg -ICAgICAgICAgICJhbnlPZiI6IFsKICAgICAgICAgICAgICAgIHsgInR5cGUiOiAiYm9vbGVhbiIgfSwK -ICAgICAgICAgICAgICAgIHsgIiRyZWYiOiAiIyIgfQogICAgICAgICAgICBdLAogICAgICAgICAgICAi -ZGVmYXVsdCI6IHt9CiAgICAgICAgfSwKICAgICAgICAiaXRlbXMiOiB7CiAgICAgICAgICAgICJhbnlP -ZiI6IFsKICAgICAgICAgICAgICAgIHsgIiRyZWYiOiAiIyIgfSwKICAgICAgICAgICAgICAgIHsgIiRy -ZWYiOiAiIy9kZWZpbml0aW9ucy9zY2hlbWFBcnJheSIgfQogICAgICAgICAgICBdLAogICAgICAgICAg -ICAiZGVmYXVsdCI6IHt9CiAgICAgICAgfSwKICAgICAgICAibWF4SXRlbXMiOiB7ICIkcmVmIjogIiMv -ZGVmaW5pdGlvbnMvcG9zaXRpdmVJbnRlZ2VyIiB9LAogICAgICAgICJtaW5JdGVtcyI6IHsgIiRyZWYi -OiAiIy9kZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXJEZWZhdWx0MCIgfSwKICAgICAgICAidW5pcXVl -SXRlbXMiOiB7CiAgICAgICAgICAgICJ0eXBlIjogImJvb2xlYW4iLAogICAgICAgICAgICAiZGVmYXVs -dCI6IGZhbHNlCiAgICAgICAgfSwKICAgICAgICAibWF4UHJvcGVydGllcyI6IHsgIiRyZWYiOiAiIy9k -ZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXIiIH0sCiAgICAgICAgIm1pblByb3BlcnRpZXMiOiB7ICIk -cmVmIjogIiMvZGVmaW5pdGlvbnMvcG9zaXRpdmVJbnRlZ2VyRGVmYXVsdDAiIH0sCiAgICAgICAgInJl -cXVpcmVkIjogeyAiJHJlZiI6ICIjL2RlZmluaXRpb25zL3N0cmluZ0FycmF5IiB9LAogICAgICAgICJh -ZGRpdGlvbmFsUHJvcGVydGllcyI6IHsKICAgICAgICAgICAgImFueU9mIjogWwogICAgICAgICAgICAg -ICAgeyAidHlwZSI6ICJib29sZWFuIiB9LAogICAgICAgICAgICAgICAgeyAiJHJlZiI6ICIjIiB9CiAg -ICAgICAgICAgIF0sCiAgICAgICAgICAgICJkZWZhdWx0Ijoge30KICAgICAgICB9LAogICAgICAgICJk -ZWZpbml0aW9ucyI6IHsKICAgICAgICAgICAgInR5cGUiOiAib2JqZWN0IiwKICAgICAgICAgICAgImFk -ZGl0aW9uYWxQcm9wZXJ0aWVzIjogeyAiJHJlZiI6ICIjIiB9LAogICAgICAgICAgICAiZGVmYXVsdCI6 -IHt9CiAgICAgICAgfSwKICAgICAgICAicHJvcGVydGllcyI6IHsKICAgICAgICAgICAgInR5cGUiOiAi -b2JqZWN0IiwKICAgICAgICAgICAgImFkZGl0aW9uYWxQcm9wZXJ0aWVzIjogeyAiJHJlZiI6ICIjIiB9 -LAogICAgICAgICAgICAiZGVmYXVsdCI6IHt9CiAgICAgICAgfSwKICAgICAgICAicGF0dGVyblByb3Bl -cnRpZXMiOiB7CiAgICAgICAgICAgICJ0eXBlIjogIm9iamVjdCIsCiAgICAgICAgICAgICJhZGRpdGlv -bmFsUHJvcGVydGllcyI6IHsgIiRyZWYiOiAiIyIgfSwKICAgICAgICAgICAgImRlZmF1bHQiOiB7fQog -ICAgICAgIH0sCiAgICAgICAgImRlcGVuZGVuY2llcyI6IHsKICAgICAgICAgICAgInR5cGUiOiAib2Jq -ZWN0IiwKICAgICAgICAgICAgImFkZGl0aW9uYWxQcm9wZXJ0aWVzIjogewogICAgICAgICAgICAgICAg -ImFueU9mIjogWwogICAgICAgICAgICAgICAgICAgIHsgIiRyZWYiOiAiIyIgfSwKICAgICAgICAgICAg -ICAgICAgICB7ICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvc3RyaW5nQXJyYXkiIH0KICAgICAgICAgICAg -ICAgIF0KICAgICAgICAgICAgfQogICAgICAgIH0sCiAgICAgICAgImVudW0iOiB7CiAgICAgICAgICAg -ICJ0eXBlIjogImFycmF5IiwKICAgICAgICAgICAgIm1pbkl0ZW1zIjogMSwKICAgICAgICAgICAgInVu -aXF1ZUl0ZW1zIjogdHJ1ZQogICAgICAgIH0sCiAgICAgICAgInR5cGUiOiB7CiAgICAgICAgICAgICJh -bnlPZiI6IFsKICAgICAgICAgICAgICAgIHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9zaW1wbGVUeXBl -cyIgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAidHlwZSI6ICJhcnJheSIs -CiAgICAgICAgICAgICAgICAgICAgIml0ZW1zIjogeyAiJHJlZiI6ICIjL2RlZmluaXRpb25zL3NpbXBs -ZVR5cGVzIiB9LAogICAgICAgICAgICAgICAgICAgICJtaW5JdGVtcyI6IDEsCiAgICAgICAgICAgICAg -ICAgICAgInVuaXF1ZUl0ZW1zIjogdHJ1ZQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICBdCiAg -ICAgICAgfSwKICAgICAgICAiYWxsT2YiOiB7ICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvc2NoZW1hQXJy -YXkiIH0sCiAgICAgICAgImFueU9mIjogeyAiJHJlZiI6ICIjL2RlZmluaXRpb25zL3NjaGVtYUFycmF5 -IiB9LAogICAgICAgICJvbmVPZiI6IHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9zY2hlbWFBcnJheSIg -fSwKICAgICAgICAibm90IjogeyAiJHJlZiI6ICIjIiB9CiAgICB9LAogICAgImRlcGVuZGVuY2llcyI6 -IHsKICAgICAgICAiZXhjbHVzaXZlTWF4aW11bSI6IFsgIm1heGltdW0iIF0sCiAgICAgICAgImV4Y2x1 -c2l2ZU1pbmltdW0iOiBbICJtaW5pbXVtIiBdCiAgICB9LAogICAgImRlZmF1bHQiOiB7fQp9Cg==`)} diff --git a/vendor/github.com/google/gnostic-models/jsonschema/display.go b/vendor/github.com/google/gnostic-models/jsonschema/display.go deleted file mode 100644 index 028a760a9..000000000 --- a/vendor/github.com/google/gnostic-models/jsonschema/display.go +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// 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 jsonschema - -import ( - "fmt" - "strings" -) - -// -// DISPLAY -// The following methods display Schemas. -// - -// Description returns a string representation of a string or string array. -func (s *StringOrStringArray) Description() string { - if s.String != nil { - return *s.String - } - if s.StringArray != nil { - return strings.Join(*s.StringArray, ", ") - } - return "" -} - -// Returns a string representation of a Schema. -func (schema *Schema) String() string { - return schema.describeSchema("") -} - -// Helper: Returns a string representation of a Schema indented by a specified string. -func (schema *Schema) describeSchema(indent string) string { - result := "" - if schema.Schema != nil { - result += indent + "$schema: " + *(schema.Schema) + "\n" - } - if schema.ID != nil { - result += indent + "id: " + *(schema.ID) + "\n" - } - if schema.MultipleOf != nil { - result += indent + fmt.Sprintf("multipleOf: %+v\n", *(schema.MultipleOf)) - } - if schema.Maximum != nil { - result += indent + fmt.Sprintf("maximum: %+v\n", *(schema.Maximum)) - } - if schema.ExclusiveMaximum != nil { - result += indent + fmt.Sprintf("exclusiveMaximum: %+v\n", *(schema.ExclusiveMaximum)) - } - if schema.Minimum != nil { - result += indent + fmt.Sprintf("minimum: %+v\n", *(schema.Minimum)) - } - if schema.ExclusiveMinimum != nil { - result += indent + fmt.Sprintf("exclusiveMinimum: %+v\n", *(schema.ExclusiveMinimum)) - } - if schema.MaxLength != nil { - result += indent + fmt.Sprintf("maxLength: %+v\n", *(schema.MaxLength)) - } - if schema.MinLength != nil { - result += indent + fmt.Sprintf("minLength: %+v\n", *(schema.MinLength)) - } - if schema.Pattern != nil { - result += indent + fmt.Sprintf("pattern: %+v\n", *(schema.Pattern)) - } - if schema.AdditionalItems != nil { - s := schema.AdditionalItems.Schema - if s != nil { - result += indent + "additionalItems:\n" - result += s.describeSchema(indent + " ") - } else { - b := *(schema.AdditionalItems.Boolean) - result += indent + fmt.Sprintf("additionalItems: %+v\n", b) - } - } - if schema.Items != nil { - result += indent + "items:\n" - items := schema.Items - if items.SchemaArray != nil { - for i, s := range *(items.SchemaArray) { - result += indent + " " + fmt.Sprintf("%d", i) + ":\n" - result += s.describeSchema(indent + " " + " ") - } - } else if items.Schema != nil { - result += items.Schema.describeSchema(indent + " " + " ") - } - } - if schema.MaxItems != nil { - result += indent + fmt.Sprintf("maxItems: %+v\n", *(schema.MaxItems)) - } - if schema.MinItems != nil { - result += indent + fmt.Sprintf("minItems: %+v\n", *(schema.MinItems)) - } - if schema.UniqueItems != nil { - result += indent + fmt.Sprintf("uniqueItems: %+v\n", *(schema.UniqueItems)) - } - if schema.MaxProperties != nil { - result += indent + fmt.Sprintf("maxProperties: %+v\n", *(schema.MaxProperties)) - } - if schema.MinProperties != nil { - result += indent + fmt.Sprintf("minProperties: %+v\n", *(schema.MinProperties)) - } - if schema.Required != nil { - result += indent + fmt.Sprintf("required: %+v\n", *(schema.Required)) - } - if schema.AdditionalProperties != nil { - s := schema.AdditionalProperties.Schema - if s != nil { - result += indent + "additionalProperties:\n" - result += s.describeSchema(indent + " ") - } else { - b := *(schema.AdditionalProperties.Boolean) - result += indent + fmt.Sprintf("additionalProperties: %+v\n", b) - } - } - if schema.Properties != nil { - result += indent + "properties:\n" - for _, pair := range *(schema.Properties) { - name := pair.Name - s := pair.Value - result += indent + " " + name + ":\n" - result += s.describeSchema(indent + " " + " ") - } - } - if schema.PatternProperties != nil { - result += indent + "patternProperties:\n" - for _, pair := range *(schema.PatternProperties) { - name := pair.Name - s := pair.Value - result += indent + " " + name + ":\n" - result += s.describeSchema(indent + " " + " ") - } - } - if schema.Dependencies != nil { - result += indent + "dependencies:\n" - for _, pair := range *(schema.Dependencies) { - name := pair.Name - schemaOrStringArray := pair.Value - s := schemaOrStringArray.Schema - if s != nil { - result += indent + " " + name + ":\n" - result += s.describeSchema(indent + " " + " ") - } else { - a := schemaOrStringArray.StringArray - if a != nil { - result += indent + " " + name + ":\n" - for _, s2 := range *a { - result += indent + " " + " " + s2 + "\n" - } - } - } - - } - } - if schema.Enumeration != nil { - result += indent + "enumeration:\n" - for _, value := range *(schema.Enumeration) { - if value.String != nil { - result += indent + " " + fmt.Sprintf("%+v\n", *value.String) - } else { - result += indent + " " + fmt.Sprintf("%+v\n", *value.Bool) - } - } - } - if schema.Type != nil { - result += indent + fmt.Sprintf("type: %+v\n", schema.Type.Description()) - } - if schema.AllOf != nil { - result += indent + "allOf:\n" - for _, s := range *(schema.AllOf) { - result += s.describeSchema(indent + " ") - result += indent + "-\n" - } - } - if schema.AnyOf != nil { - result += indent + "anyOf:\n" - for _, s := range *(schema.AnyOf) { - result += s.describeSchema(indent + " ") - result += indent + "-\n" - } - } - if schema.OneOf != nil { - result += indent + "oneOf:\n" - for _, s := range *(schema.OneOf) { - result += s.describeSchema(indent + " ") - result += indent + "-\n" - } - } - if schema.Not != nil { - result += indent + "not:\n" - result += schema.Not.describeSchema(indent + " ") - } - if schema.Definitions != nil { - result += indent + "definitions:\n" - for _, pair := range *(schema.Definitions) { - name := pair.Name - s := pair.Value - result += indent + " " + name + ":\n" - result += s.describeSchema(indent + " " + " ") - } - } - if schema.Title != nil { - result += indent + "title: " + *(schema.Title) + "\n" - } - if schema.Description != nil { - result += indent + "description: " + *(schema.Description) + "\n" - } - if schema.Default != nil { - result += indent + "default:\n" - result += indent + fmt.Sprintf(" %+v\n", *(schema.Default)) - } - if schema.Format != nil { - result += indent + "format: " + *(schema.Format) + "\n" - } - if schema.Ref != nil { - result += indent + "$ref: " + *(schema.Ref) + "\n" - } - return result -} diff --git a/vendor/github.com/google/gnostic-models/jsonschema/models.go b/vendor/github.com/google/gnostic-models/jsonschema/models.go deleted file mode 100644 index 4781bdc5f..000000000 --- a/vendor/github.com/google/gnostic-models/jsonschema/models.go +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// 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 jsonschema supports the reading, writing, and manipulation -// of JSON Schemas. -package jsonschema - -import "gopkg.in/yaml.v3" - -// The Schema struct models a JSON Schema and, because schemas are -// defined hierarchically, contains many references to itself. -// All fields are pointers and are nil if the associated values -// are not specified. -type Schema struct { - Schema *string // $schema - ID *string // id keyword used for $ref resolution scope - Ref *string // $ref, i.e. JSON Pointers - - // http://json-schema.org/latest/json-schema-validation.html - // 5.1. Validation keywords for numeric instances (number and integer) - MultipleOf *SchemaNumber - Maximum *SchemaNumber - ExclusiveMaximum *bool - Minimum *SchemaNumber - ExclusiveMinimum *bool - - // 5.2. Validation keywords for strings - MaxLength *int64 - MinLength *int64 - Pattern *string - - // 5.3. Validation keywords for arrays - AdditionalItems *SchemaOrBoolean - Items *SchemaOrSchemaArray - MaxItems *int64 - MinItems *int64 - UniqueItems *bool - - // 5.4. Validation keywords for objects - MaxProperties *int64 - MinProperties *int64 - Required *[]string - AdditionalProperties *SchemaOrBoolean - Properties *[]*NamedSchema - PatternProperties *[]*NamedSchema - Dependencies *[]*NamedSchemaOrStringArray - - // 5.5. Validation keywords for any instance type - Enumeration *[]SchemaEnumValue - Type *StringOrStringArray - AllOf *[]*Schema - AnyOf *[]*Schema - OneOf *[]*Schema - Not *Schema - Definitions *[]*NamedSchema - - // 6. Metadata keywords - Title *string - Description *string - Default *yaml.Node - - // 7. Semantic validation with "format" - Format *string -} - -// These helper structs represent "combination" types that generally can -// have values of one type or another. All are used to represent parts -// of Schemas. - -// SchemaNumber represents a value that can be either an Integer or a Float. -type SchemaNumber struct { - Integer *int64 - Float *float64 -} - -// NewSchemaNumberWithInteger creates and returns a new object -func NewSchemaNumberWithInteger(i int64) *SchemaNumber { - result := &SchemaNumber{} - result.Integer = &i - return result -} - -// NewSchemaNumberWithFloat creates and returns a new object -func NewSchemaNumberWithFloat(f float64) *SchemaNumber { - result := &SchemaNumber{} - result.Float = &f - return result -} - -// SchemaOrBoolean represents a value that can be either a Schema or a Boolean. -type SchemaOrBoolean struct { - Schema *Schema - Boolean *bool -} - -// NewSchemaOrBooleanWithSchema creates and returns a new object -func NewSchemaOrBooleanWithSchema(s *Schema) *SchemaOrBoolean { - result := &SchemaOrBoolean{} - result.Schema = s - return result -} - -// NewSchemaOrBooleanWithBoolean creates and returns a new object -func NewSchemaOrBooleanWithBoolean(b bool) *SchemaOrBoolean { - result := &SchemaOrBoolean{} - result.Boolean = &b - return result -} - -// StringOrStringArray represents a value that can be either -// a String or an Array of Strings. -type StringOrStringArray struct { - String *string - StringArray *[]string -} - -// NewStringOrStringArrayWithString creates and returns a new object -func NewStringOrStringArrayWithString(s string) *StringOrStringArray { - result := &StringOrStringArray{} - result.String = &s - return result -} - -// NewStringOrStringArrayWithStringArray creates and returns a new object -func NewStringOrStringArrayWithStringArray(a []string) *StringOrStringArray { - result := &StringOrStringArray{} - result.StringArray = &a - return result -} - -// SchemaOrStringArray represents a value that can be either -// a Schema or an Array of Strings. -type SchemaOrStringArray struct { - Schema *Schema - StringArray *[]string -} - -// SchemaOrSchemaArray represents a value that can be either -// a Schema or an Array of Schemas. -type SchemaOrSchemaArray struct { - Schema *Schema - SchemaArray *[]*Schema -} - -// NewSchemaOrSchemaArrayWithSchema creates and returns a new object -func NewSchemaOrSchemaArrayWithSchema(s *Schema) *SchemaOrSchemaArray { - result := &SchemaOrSchemaArray{} - result.Schema = s - return result -} - -// NewSchemaOrSchemaArrayWithSchemaArray creates and returns a new object -func NewSchemaOrSchemaArrayWithSchemaArray(a []*Schema) *SchemaOrSchemaArray { - result := &SchemaOrSchemaArray{} - result.SchemaArray = &a - return result -} - -// SchemaEnumValue represents a value that can be part of an -// enumeration in a Schema. -type SchemaEnumValue struct { - String *string - Bool *bool -} - -// NamedSchema is a name-value pair that is used to emulate maps -// with ordered keys. -type NamedSchema struct { - Name string - Value *Schema -} - -// NewNamedSchema creates and returns a new object -func NewNamedSchema(name string, value *Schema) *NamedSchema { - return &NamedSchema{Name: name, Value: value} -} - -// NamedSchemaOrStringArray is a name-value pair that is used -// to emulate maps with ordered keys. -type NamedSchemaOrStringArray struct { - Name string - Value *SchemaOrStringArray -} - -// Access named subschemas by name - -func namedSchemaArrayElementWithName(array *[]*NamedSchema, name string) *Schema { - if array == nil { - return nil - } - for _, pair := range *array { - if pair.Name == name { - return pair.Value - } - } - return nil -} - -// PropertyWithName returns the selected element. -func (s *Schema) PropertyWithName(name string) *Schema { - return namedSchemaArrayElementWithName(s.Properties, name) -} - -// PatternPropertyWithName returns the selected element. -func (s *Schema) PatternPropertyWithName(name string) *Schema { - return namedSchemaArrayElementWithName(s.PatternProperties, name) -} - -// DefinitionWithName returns the selected element. -func (s *Schema) DefinitionWithName(name string) *Schema { - return namedSchemaArrayElementWithName(s.Definitions, name) -} - -// AddProperty adds a named property. -func (s *Schema) AddProperty(name string, property *Schema) { - *s.Properties = append(*s.Properties, NewNamedSchema(name, property)) -} diff --git a/vendor/github.com/google/gnostic-models/jsonschema/operations.go b/vendor/github.com/google/gnostic-models/jsonschema/operations.go deleted file mode 100644 index ba8dd4a91..000000000 --- a/vendor/github.com/google/gnostic-models/jsonschema/operations.go +++ /dev/null @@ -1,394 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// 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 jsonschema - -import ( - "fmt" - "log" - "strings" -) - -// -// OPERATIONS -// The following methods perform operations on Schemas. -// - -// IsEmpty returns true if no members of the Schema are specified. -func (schema *Schema) IsEmpty() bool { - return (schema.Schema == nil) && - (schema.ID == nil) && - (schema.MultipleOf == nil) && - (schema.Maximum == nil) && - (schema.ExclusiveMaximum == nil) && - (schema.Minimum == nil) && - (schema.ExclusiveMinimum == nil) && - (schema.MaxLength == nil) && - (schema.MinLength == nil) && - (schema.Pattern == nil) && - (schema.AdditionalItems == nil) && - (schema.Items == nil) && - (schema.MaxItems == nil) && - (schema.MinItems == nil) && - (schema.UniqueItems == nil) && - (schema.MaxProperties == nil) && - (schema.MinProperties == nil) && - (schema.Required == nil) && - (schema.AdditionalProperties == nil) && - (schema.Properties == nil) && - (schema.PatternProperties == nil) && - (schema.Dependencies == nil) && - (schema.Enumeration == nil) && - (schema.Type == nil) && - (schema.AllOf == nil) && - (schema.AnyOf == nil) && - (schema.OneOf == nil) && - (schema.Not == nil) && - (schema.Definitions == nil) && - (schema.Title == nil) && - (schema.Description == nil) && - (schema.Default == nil) && - (schema.Format == nil) && - (schema.Ref == nil) -} - -// IsEqual returns true if two schemas are equal. -func (schema *Schema) IsEqual(schema2 *Schema) bool { - return schema.String() == schema2.String() -} - -// SchemaOperation represents a function that can be applied to a Schema. -type SchemaOperation func(schema *Schema, context string) - -// Applies a specified function to a Schema and all of the Schemas that it contains. -func (schema *Schema) applyToSchemas(operation SchemaOperation, context string) { - - if schema.AdditionalItems != nil { - s := schema.AdditionalItems.Schema - if s != nil { - s.applyToSchemas(operation, "AdditionalItems") - } - } - - if schema.Items != nil { - if schema.Items.SchemaArray != nil { - for _, s := range *(schema.Items.SchemaArray) { - s.applyToSchemas(operation, "Items.SchemaArray") - } - } else if schema.Items.Schema != nil { - schema.Items.Schema.applyToSchemas(operation, "Items.Schema") - } - } - - if schema.AdditionalProperties != nil { - s := schema.AdditionalProperties.Schema - if s != nil { - s.applyToSchemas(operation, "AdditionalProperties") - } - } - - if schema.Properties != nil { - for _, pair := range *(schema.Properties) { - s := pair.Value - s.applyToSchemas(operation, "Properties") - } - } - if schema.PatternProperties != nil { - for _, pair := range *(schema.PatternProperties) { - s := pair.Value - s.applyToSchemas(operation, "PatternProperties") - } - } - - if schema.Dependencies != nil { - for _, pair := range *(schema.Dependencies) { - schemaOrStringArray := pair.Value - s := schemaOrStringArray.Schema - if s != nil { - s.applyToSchemas(operation, "Dependencies") - } - } - } - - if schema.AllOf != nil { - for _, s := range *(schema.AllOf) { - s.applyToSchemas(operation, "AllOf") - } - } - if schema.AnyOf != nil { - for _, s := range *(schema.AnyOf) { - s.applyToSchemas(operation, "AnyOf") - } - } - if schema.OneOf != nil { - for _, s := range *(schema.OneOf) { - s.applyToSchemas(operation, "OneOf") - } - } - if schema.Not != nil { - schema.Not.applyToSchemas(operation, "Not") - } - - if schema.Definitions != nil { - for _, pair := range *(schema.Definitions) { - s := pair.Value - s.applyToSchemas(operation, "Definitions") - } - } - - operation(schema, context) -} - -// CopyProperties copies all non-nil properties from the source Schema to the schema Schema. -func (schema *Schema) CopyProperties(source *Schema) { - if source.Schema != nil { - schema.Schema = source.Schema - } - if source.ID != nil { - schema.ID = source.ID - } - if source.MultipleOf != nil { - schema.MultipleOf = source.MultipleOf - } - if source.Maximum != nil { - schema.Maximum = source.Maximum - } - if source.ExclusiveMaximum != nil { - schema.ExclusiveMaximum = source.ExclusiveMaximum - } - if source.Minimum != nil { - schema.Minimum = source.Minimum - } - if source.ExclusiveMinimum != nil { - schema.ExclusiveMinimum = source.ExclusiveMinimum - } - if source.MaxLength != nil { - schema.MaxLength = source.MaxLength - } - if source.MinLength != nil { - schema.MinLength = source.MinLength - } - if source.Pattern != nil { - schema.Pattern = source.Pattern - } - if source.AdditionalItems != nil { - schema.AdditionalItems = source.AdditionalItems - } - if source.Items != nil { - schema.Items = source.Items - } - if source.MaxItems != nil { - schema.MaxItems = source.MaxItems - } - if source.MinItems != nil { - schema.MinItems = source.MinItems - } - if source.UniqueItems != nil { - schema.UniqueItems = source.UniqueItems - } - if source.MaxProperties != nil { - schema.MaxProperties = source.MaxProperties - } - if source.MinProperties != nil { - schema.MinProperties = source.MinProperties - } - if source.Required != nil { - schema.Required = source.Required - } - if source.AdditionalProperties != nil { - schema.AdditionalProperties = source.AdditionalProperties - } - if source.Properties != nil { - schema.Properties = source.Properties - } - if source.PatternProperties != nil { - schema.PatternProperties = source.PatternProperties - } - if source.Dependencies != nil { - schema.Dependencies = source.Dependencies - } - if source.Enumeration != nil { - schema.Enumeration = source.Enumeration - } - if source.Type != nil { - schema.Type = source.Type - } - if source.AllOf != nil { - schema.AllOf = source.AllOf - } - if source.AnyOf != nil { - schema.AnyOf = source.AnyOf - } - if source.OneOf != nil { - schema.OneOf = source.OneOf - } - if source.Not != nil { - schema.Not = source.Not - } - if source.Definitions != nil { - schema.Definitions = source.Definitions - } - if source.Title != nil { - schema.Title = source.Title - } - if source.Description != nil { - schema.Description = source.Description - } - if source.Default != nil { - schema.Default = source.Default - } - if source.Format != nil { - schema.Format = source.Format - } - if source.Ref != nil { - schema.Ref = source.Ref - } -} - -// TypeIs returns true if the Type of a Schema includes the specified type -func (schema *Schema) TypeIs(typeName string) bool { - if schema.Type != nil { - // the schema Type is either a string or an array of strings - if schema.Type.String != nil { - return (*(schema.Type.String) == typeName) - } else if schema.Type.StringArray != nil { - for _, n := range *(schema.Type.StringArray) { - if n == typeName { - return true - } - } - } - } - return false -} - -// ResolveRefs resolves "$ref" elements in a Schema and its children. -// But if a reference refers to an object type, is inside a oneOf, or contains a oneOf, -// the reference is kept and we expect downstream tools to separately model these -// referenced schemas. -func (schema *Schema) ResolveRefs() { - rootSchema := schema - count := 1 - for count > 0 { - count = 0 - schema.applyToSchemas( - func(schema *Schema, context string) { - if schema.Ref != nil { - resolvedRef, err := rootSchema.resolveJSONPointer(*(schema.Ref)) - if err != nil { - log.Printf("%+v", err) - } else if resolvedRef.TypeIs("object") { - // don't substitute for objects, we'll model the referenced schema with a class - } else if context == "OneOf" { - // don't substitute for references inside oneOf declarations - } else if resolvedRef.OneOf != nil { - // don't substitute for references that contain oneOf declarations - } else if resolvedRef.AdditionalProperties != nil { - // don't substitute for references that look like objects - } else { - schema.Ref = nil - schema.CopyProperties(resolvedRef) - count++ - } - } - }, "") - } -} - -// resolveJSONPointer resolves JSON pointers. -// This current implementation is very crude and custom for OpenAPI 2.0 schemas. -// It panics for any pointer that it is unable to resolve. -func (schema *Schema) resolveJSONPointer(ref string) (result *Schema, err error) { - parts := strings.Split(ref, "#") - if len(parts) == 2 { - documentName := parts[0] + "#" - if documentName == "#" && schema.ID != nil { - documentName = *(schema.ID) - } - path := parts[1] - document := schemas[documentName] - pathParts := strings.Split(path, "/") - - // we currently do a very limited (hard-coded) resolution of certain paths and log errors for missed cases - if len(pathParts) == 1 { - return document, nil - } else if len(pathParts) == 3 { - switch pathParts[1] { - case "definitions": - dictionary := document.Definitions - for _, pair := range *dictionary { - if pair.Name == pathParts[2] { - result = pair.Value - } - } - case "properties": - dictionary := document.Properties - for _, pair := range *dictionary { - if pair.Name == pathParts[2] { - result = pair.Value - } - } - default: - break - } - } - } - if result == nil { - return nil, fmt.Errorf("unresolved pointer: %+v", ref) - } - return result, nil -} - -// ResolveAllOfs replaces "allOf" elements by merging their properties into the parent Schema. -func (schema *Schema) ResolveAllOfs() { - schema.applyToSchemas( - func(schema *Schema, context string) { - if schema.AllOf != nil { - for _, allOf := range *(schema.AllOf) { - schema.CopyProperties(allOf) - } - schema.AllOf = nil - } - }, "resolveAllOfs") -} - -// ResolveAnyOfs replaces all "anyOf" elements with "oneOf". -func (schema *Schema) ResolveAnyOfs() { - schema.applyToSchemas( - func(schema *Schema, context string) { - if schema.AnyOf != nil { - schema.OneOf = schema.AnyOf - schema.AnyOf = nil - } - }, "resolveAnyOfs") -} - -// return a pointer to a copy of a passed-in string -func stringptr(input string) (output *string) { - return &input -} - -// CopyOfficialSchemaProperty copies a named property from the official JSON Schema definition -func (schema *Schema) CopyOfficialSchemaProperty(name string) { - *schema.Properties = append(*schema.Properties, - NewNamedSchema(name, - &Schema{Ref: stringptr("http://json-schema.org/draft-04/schema#/properties/" + name)})) -} - -// CopyOfficialSchemaProperties copies named properties from the official JSON Schema definition -func (schema *Schema) CopyOfficialSchemaProperties(names []string) { - for _, name := range names { - schema.CopyOfficialSchemaProperty(name) - } -} diff --git a/vendor/github.com/google/gnostic-models/jsonschema/reader.go b/vendor/github.com/google/gnostic-models/jsonschema/reader.go deleted file mode 100644 index b8583d466..000000000 --- a/vendor/github.com/google/gnostic-models/jsonschema/reader.go +++ /dev/null @@ -1,442 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// 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. - -//go:generate go run generate-base.go - -package jsonschema - -import ( - "fmt" - "io/ioutil" - "strconv" - - "gopkg.in/yaml.v3" -) - -// This is a global map of all known Schemas. -// It is initialized when the first Schema is created and inserted. -var schemas map[string]*Schema - -// NewBaseSchema builds a schema object from an embedded json representation. -func NewBaseSchema() (schema *Schema, err error) { - b, err := baseSchemaBytes() - if err != nil { - return nil, err - } - var node yaml.Node - err = yaml.Unmarshal(b, &node) - if err != nil { - return nil, err - } - return NewSchemaFromObject(&node), nil -} - -// NewSchemaFromFile reads a schema from a file. -// Currently this assumes that schemas are stored in the source distribution of this project. -func NewSchemaFromFile(filename string) (schema *Schema, err error) { - file, err := ioutil.ReadFile(filename) - if err != nil { - return nil, err - } - var node yaml.Node - err = yaml.Unmarshal(file, &node) - if err != nil { - return nil, err - } - return NewSchemaFromObject(&node), nil -} - -// NewSchemaFromObject constructs a schema from a parsed JSON object. -// Due to the complexity of the schema representation, this is a -// custom reader and not the standard Go JSON reader (encoding/json). -func NewSchemaFromObject(jsonData *yaml.Node) *Schema { - switch jsonData.Kind { - case yaml.DocumentNode: - return NewSchemaFromObject(jsonData.Content[0]) - case yaml.MappingNode: - schema := &Schema{} - - for i := 0; i < len(jsonData.Content); i += 2 { - k := jsonData.Content[i].Value - v := jsonData.Content[i+1] - - switch k { - case "$schema": - schema.Schema = schema.stringValue(v) - case "id": - schema.ID = schema.stringValue(v) - - case "multipleOf": - schema.MultipleOf = schema.numberValue(v) - case "maximum": - schema.Maximum = schema.numberValue(v) - case "exclusiveMaximum": - schema.ExclusiveMaximum = schema.boolValue(v) - case "minimum": - schema.Minimum = schema.numberValue(v) - case "exclusiveMinimum": - schema.ExclusiveMinimum = schema.boolValue(v) - - case "maxLength": - schema.MaxLength = schema.intValue(v) - case "minLength": - schema.MinLength = schema.intValue(v) - case "pattern": - schema.Pattern = schema.stringValue(v) - - case "additionalItems": - schema.AdditionalItems = schema.schemaOrBooleanValue(v) - case "items": - schema.Items = schema.schemaOrSchemaArrayValue(v) - case "maxItems": - schema.MaxItems = schema.intValue(v) - case "minItems": - schema.MinItems = schema.intValue(v) - case "uniqueItems": - schema.UniqueItems = schema.boolValue(v) - - case "maxProperties": - schema.MaxProperties = schema.intValue(v) - case "minProperties": - schema.MinProperties = schema.intValue(v) - case "required": - schema.Required = schema.arrayOfStringsValue(v) - case "additionalProperties": - schema.AdditionalProperties = schema.schemaOrBooleanValue(v) - case "properties": - schema.Properties = schema.mapOfSchemasValue(v) - case "patternProperties": - schema.PatternProperties = schema.mapOfSchemasValue(v) - case "dependencies": - schema.Dependencies = schema.mapOfSchemasOrStringArraysValue(v) - - case "enum": - schema.Enumeration = schema.arrayOfEnumValuesValue(v) - - case "type": - schema.Type = schema.stringOrStringArrayValue(v) - case "allOf": - schema.AllOf = schema.arrayOfSchemasValue(v) - case "anyOf": - schema.AnyOf = schema.arrayOfSchemasValue(v) - case "oneOf": - schema.OneOf = schema.arrayOfSchemasValue(v) - case "not": - schema.Not = NewSchemaFromObject(v) - case "definitions": - schema.Definitions = schema.mapOfSchemasValue(v) - - case "title": - schema.Title = schema.stringValue(v) - case "description": - schema.Description = schema.stringValue(v) - - case "default": - schema.Default = v - - case "format": - schema.Format = schema.stringValue(v) - case "$ref": - schema.Ref = schema.stringValue(v) - default: - fmt.Printf("UNSUPPORTED (%s)\n", k) - } - } - - // insert schema in global map - if schema.ID != nil { - if schemas == nil { - schemas = make(map[string]*Schema, 0) - } - schemas[*(schema.ID)] = schema - } - return schema - - default: - fmt.Printf("schemaValue: unexpected node %+v\n", jsonData) - return nil - } - - return nil -} - -// -// BUILDERS -// The following methods build elements of Schemas from interface{} values. -// Each returns nil if it is unable to build the desired element. -// - -// Gets the string value of an interface{} value if possible. -func (schema *Schema) stringValue(v *yaml.Node) *string { - switch v.Kind { - case yaml.ScalarNode: - return &v.Value - default: - fmt.Printf("stringValue: unexpected node %+v\n", v) - } - return nil -} - -// Gets the numeric value of an interface{} value if possible. -func (schema *Schema) numberValue(v *yaml.Node) *SchemaNumber { - number := &SchemaNumber{} - switch v.Kind { - case yaml.ScalarNode: - switch v.Tag { - case "!!float": - v2, _ := strconv.ParseFloat(v.Value, 64) - number.Float = &v2 - return number - case "!!int": - v2, _ := strconv.ParseInt(v.Value, 10, 64) - number.Integer = &v2 - return number - default: - fmt.Printf("stringValue: unexpected node %+v\n", v) - } - default: - fmt.Printf("stringValue: unexpected node %+v\n", v) - } - return nil -} - -// Gets the integer value of an interface{} value if possible. -func (schema *Schema) intValue(v *yaml.Node) *int64 { - switch v.Kind { - case yaml.ScalarNode: - switch v.Tag { - case "!!float": - v2, _ := strconv.ParseFloat(v.Value, 64) - v3 := int64(v2) - return &v3 - case "!!int": - v2, _ := strconv.ParseInt(v.Value, 10, 64) - return &v2 - default: - fmt.Printf("intValue: unexpected node %+v\n", v) - } - default: - fmt.Printf("intValue: unexpected node %+v\n", v) - } - return nil -} - -// Gets the bool value of an interface{} value if possible. -func (schema *Schema) boolValue(v *yaml.Node) *bool { - switch v.Kind { - case yaml.ScalarNode: - switch v.Tag { - case "!!bool": - v2, _ := strconv.ParseBool(v.Value) - return &v2 - default: - fmt.Printf("boolValue: unexpected node %+v\n", v) - } - default: - fmt.Printf("boolValue: unexpected node %+v\n", v) - } - return nil -} - -// Gets a map of Schemas from an interface{} value if possible. -func (schema *Schema) mapOfSchemasValue(v *yaml.Node) *[]*NamedSchema { - switch v.Kind { - case yaml.MappingNode: - m := make([]*NamedSchema, 0) - for i := 0; i < len(v.Content); i += 2 { - k2 := v.Content[i].Value - v2 := v.Content[i+1] - pair := &NamedSchema{Name: k2, Value: NewSchemaFromObject(v2)} - m = append(m, pair) - } - return &m - default: - fmt.Printf("mapOfSchemasValue: unexpected node %+v\n", v) - } - return nil -} - -// Gets an array of Schemas from an interface{} value if possible. -func (schema *Schema) arrayOfSchemasValue(v *yaml.Node) *[]*Schema { - switch v.Kind { - case yaml.SequenceNode: - m := make([]*Schema, 0) - for _, v2 := range v.Content { - switch v2.Kind { - case yaml.MappingNode: - s := NewSchemaFromObject(v2) - m = append(m, s) - default: - fmt.Printf("arrayOfSchemasValue: unexpected node %+v\n", v2) - } - } - return &m - case yaml.MappingNode: - m := make([]*Schema, 0) - s := NewSchemaFromObject(v) - m = append(m, s) - return &m - default: - fmt.Printf("arrayOfSchemasValue: unexpected node %+v\n", v) - } - return nil -} - -// Gets a Schema or an array of Schemas from an interface{} value if possible. -func (schema *Schema) schemaOrSchemaArrayValue(v *yaml.Node) *SchemaOrSchemaArray { - switch v.Kind { - case yaml.SequenceNode: - m := make([]*Schema, 0) - for _, v2 := range v.Content { - switch v2.Kind { - case yaml.MappingNode: - s := NewSchemaFromObject(v2) - m = append(m, s) - default: - fmt.Printf("schemaOrSchemaArrayValue: unexpected node %+v\n", v2) - } - } - return &SchemaOrSchemaArray{SchemaArray: &m} - case yaml.MappingNode: - s := NewSchemaFromObject(v) - return &SchemaOrSchemaArray{Schema: s} - default: - fmt.Printf("schemaOrSchemaArrayValue: unexpected node %+v\n", v) - } - return nil -} - -// Gets an array of strings from an interface{} value if possible. -func (schema *Schema) arrayOfStringsValue(v *yaml.Node) *[]string { - switch v.Kind { - case yaml.ScalarNode: - a := []string{v.Value} - return &a - case yaml.SequenceNode: - a := make([]string, 0) - for _, v2 := range v.Content { - switch v2.Kind { - case yaml.ScalarNode: - a = append(a, v2.Value) - default: - fmt.Printf("arrayOfStringsValue: unexpected node %+v\n", v2) - } - } - return &a - default: - fmt.Printf("arrayOfStringsValue: unexpected node %+v\n", v) - } - return nil -} - -// Gets a string or an array of strings from an interface{} value if possible. -func (schema *Schema) stringOrStringArrayValue(v *yaml.Node) *StringOrStringArray { - switch v.Kind { - case yaml.ScalarNode: - s := &StringOrStringArray{} - s.String = &v.Value - return s - case yaml.SequenceNode: - a := make([]string, 0) - for _, v2 := range v.Content { - switch v2.Kind { - case yaml.ScalarNode: - a = append(a, v2.Value) - default: - fmt.Printf("arrayOfStringsValue: unexpected node %+v\n", v2) - } - } - s := &StringOrStringArray{} - s.StringArray = &a - return s - default: - fmt.Printf("arrayOfStringsValue: unexpected node %+v\n", v) - } - return nil -} - -// Gets an array of enum values from an interface{} value if possible. -func (schema *Schema) arrayOfEnumValuesValue(v *yaml.Node) *[]SchemaEnumValue { - a := make([]SchemaEnumValue, 0) - switch v.Kind { - case yaml.SequenceNode: - for _, v2 := range v.Content { - switch v2.Kind { - case yaml.ScalarNode: - switch v2.Tag { - case "!!str": - a = append(a, SchemaEnumValue{String: &v2.Value}) - case "!!bool": - v3, _ := strconv.ParseBool(v2.Value) - a = append(a, SchemaEnumValue{Bool: &v3}) - default: - fmt.Printf("arrayOfEnumValuesValue: unexpected type %s\n", v2.Tag) - } - default: - fmt.Printf("arrayOfEnumValuesValue: unexpected node %+v\n", v2) - } - } - default: - fmt.Printf("arrayOfEnumValuesValue: unexpected node %+v\n", v) - } - return &a -} - -// Gets a map of schemas or string arrays from an interface{} value if possible. -func (schema *Schema) mapOfSchemasOrStringArraysValue(v *yaml.Node) *[]*NamedSchemaOrStringArray { - m := make([]*NamedSchemaOrStringArray, 0) - switch v.Kind { - case yaml.MappingNode: - for i := 0; i < len(v.Content); i += 2 { - k2 := v.Content[i].Value - v2 := v.Content[i+1] - switch v2.Kind { - case yaml.SequenceNode: - a := make([]string, 0) - for _, v3 := range v2.Content { - switch v3.Kind { - case yaml.ScalarNode: - a = append(a, v3.Value) - default: - fmt.Printf("mapOfSchemasOrStringArraysValue: unexpected node %+v\n", v3) - } - } - s := &SchemaOrStringArray{} - s.StringArray = &a - pair := &NamedSchemaOrStringArray{Name: k2, Value: s} - m = append(m, pair) - default: - fmt.Printf("mapOfSchemasOrStringArraysValue: unexpected node %+v\n", v2) - } - } - default: - fmt.Printf("mapOfSchemasOrStringArraysValue: unexpected node %+v\n", v) - } - return &m -} - -// Gets a schema or a boolean value from an interface{} value if possible. -func (schema *Schema) schemaOrBooleanValue(v *yaml.Node) *SchemaOrBoolean { - schemaOrBoolean := &SchemaOrBoolean{} - switch v.Kind { - case yaml.ScalarNode: - v2, _ := strconv.ParseBool(v.Value) - schemaOrBoolean.Boolean = &v2 - case yaml.MappingNode: - schemaOrBoolean.Schema = NewSchemaFromObject(v) - default: - fmt.Printf("schemaOrBooleanValue: unexpected node %+v\n", v) - } - return schemaOrBoolean -} diff --git a/vendor/github.com/google/gnostic-models/jsonschema/schema.json b/vendor/github.com/google/gnostic-models/jsonschema/schema.json deleted file mode 100644 index 85eb502a6..000000000 --- a/vendor/github.com/google/gnostic-models/jsonschema/schema.json +++ /dev/null @@ -1,150 +0,0 @@ -{ - "id": "http://json-schema.org/draft-04/schema#", - "$schema": "http://json-schema.org/draft-04/schema#", - "description": "Core schema meta-schema", - "definitions": { - "schemaArray": { - "type": "array", - "minItems": 1, - "items": { "$ref": "#" } - }, - "positiveInteger": { - "type": "integer", - "minimum": 0 - }, - "positiveIntegerDefault0": { - "allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ] - }, - "simpleTypes": { - "enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ] - }, - "stringArray": { - "type": "array", - "items": { "type": "string" }, - "minItems": 1, - "uniqueItems": true - } - }, - "type": "object", - "properties": { - "id": { - "type": "string", - "format": "uri" - }, - "$schema": { - "type": "string", - "format": "uri" - }, - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "default": {}, - "multipleOf": { - "type": "number", - "minimum": 0, - "exclusiveMinimum": true - }, - "maximum": { - "type": "number" - }, - "exclusiveMaximum": { - "type": "boolean", - "default": false - }, - "minimum": { - "type": "number" - }, - "exclusiveMinimum": { - "type": "boolean", - "default": false - }, - "maxLength": { "$ref": "#/definitions/positiveInteger" }, - "minLength": { "$ref": "#/definitions/positiveIntegerDefault0" }, - "pattern": { - "type": "string", - "format": "regex" - }, - "additionalItems": { - "anyOf": [ - { "type": "boolean" }, - { "$ref": "#" } - ], - "default": {} - }, - "items": { - "anyOf": [ - { "$ref": "#" }, - { "$ref": "#/definitions/schemaArray" } - ], - "default": {} - }, - "maxItems": { "$ref": "#/definitions/positiveInteger" }, - "minItems": { "$ref": "#/definitions/positiveIntegerDefault0" }, - "uniqueItems": { - "type": "boolean", - "default": false - }, - "maxProperties": { "$ref": "#/definitions/positiveInteger" }, - "minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" }, - "required": { "$ref": "#/definitions/stringArray" }, - "additionalProperties": { - "anyOf": [ - { "type": "boolean" }, - { "$ref": "#" } - ], - "default": {} - }, - "definitions": { - "type": "object", - "additionalProperties": { "$ref": "#" }, - "default": {} - }, - "properties": { - "type": "object", - "additionalProperties": { "$ref": "#" }, - "default": {} - }, - "patternProperties": { - "type": "object", - "additionalProperties": { "$ref": "#" }, - "default": {} - }, - "dependencies": { - "type": "object", - "additionalProperties": { - "anyOf": [ - { "$ref": "#" }, - { "$ref": "#/definitions/stringArray" } - ] - } - }, - "enum": { - "type": "array", - "minItems": 1, - "uniqueItems": true - }, - "type": { - "anyOf": [ - { "$ref": "#/definitions/simpleTypes" }, - { - "type": "array", - "items": { "$ref": "#/definitions/simpleTypes" }, - "minItems": 1, - "uniqueItems": true - } - ] - }, - "allOf": { "$ref": "#/definitions/schemaArray" }, - "anyOf": { "$ref": "#/definitions/schemaArray" }, - "oneOf": { "$ref": "#/definitions/schemaArray" }, - "not": { "$ref": "#" } - }, - "dependencies": { - "exclusiveMaximum": [ "maximum" ], - "exclusiveMinimum": [ "minimum" ] - }, - "default": {} -} diff --git a/vendor/github.com/google/gnostic-models/jsonschema/writer.go b/vendor/github.com/google/gnostic-models/jsonschema/writer.go deleted file mode 100644 index 340dc5f93..000000000 --- a/vendor/github.com/google/gnostic-models/jsonschema/writer.go +++ /dev/null @@ -1,369 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// 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 jsonschema - -import ( - "fmt" - - "gopkg.in/yaml.v3" -) - -const indentation = " " - -func renderMappingNode(node *yaml.Node, indent string) (result string) { - result = "{\n" - innerIndent := indent + indentation - for i := 0; i < len(node.Content); i += 2 { - // first print the key - key := node.Content[i].Value - result += fmt.Sprintf("%s\"%+v\": ", innerIndent, key) - // then the value - value := node.Content[i+1] - switch value.Kind { - case yaml.ScalarNode: - result += "\"" + value.Value + "\"" - case yaml.MappingNode: - result += renderMappingNode(value, innerIndent) - case yaml.SequenceNode: - result += renderSequenceNode(value, innerIndent) - default: - result += fmt.Sprintf("???MapItem(Key:%+v, Value:%T)", value, value) - } - if i < len(node.Content)-2 { - result += "," - } - result += "\n" - } - - result += indent + "}" - return result -} - -func renderSequenceNode(node *yaml.Node, indent string) (result string) { - result = "[\n" - innerIndent := indent + indentation - for i := 0; i < len(node.Content); i++ { - item := node.Content[i] - switch item.Kind { - case yaml.ScalarNode: - result += innerIndent + "\"" + item.Value + "\"" - case yaml.MappingNode: - result += innerIndent + renderMappingNode(item, innerIndent) + "" - default: - result += innerIndent + fmt.Sprintf("???ArrayItem(%+v)", item) - } - if i < len(node.Content)-1 { - result += "," - } - result += "\n" - } - result += indent + "]" - return result -} - -func renderStringArray(array []string, indent string) (result string) { - result = "[\n" - innerIndent := indent + indentation - for i, item := range array { - result += innerIndent + "\"" + item + "\"" - if i < len(array)-1 { - result += "," - } - result += "\n" - } - result += indent + "]" - return result -} - -// Render renders a yaml.Node as JSON -func Render(node *yaml.Node) string { - if node.Kind == yaml.DocumentNode { - if len(node.Content) == 1 { - return Render(node.Content[0]) - } - } else if node.Kind == yaml.MappingNode { - return renderMappingNode(node, "") + "\n" - } else if node.Kind == yaml.SequenceNode { - return renderSequenceNode(node, "") + "\n" - } - return "" -} - -func (object *SchemaNumber) nodeValue() *yaml.Node { - if object.Integer != nil { - return nodeForInt64(*object.Integer) - } else if object.Float != nil { - return nodeForFloat64(*object.Float) - } else { - return nil - } -} - -func (object *SchemaOrBoolean) nodeValue() *yaml.Node { - if object.Schema != nil { - return object.Schema.nodeValue() - } else if object.Boolean != nil { - return nodeForBoolean(*object.Boolean) - } else { - return nil - } -} - -func nodeForStringArray(array []string) *yaml.Node { - content := make([]*yaml.Node, 0) - for _, item := range array { - content = append(content, nodeForString(item)) - } - return nodeForSequence(content) -} - -func nodeForSchemaArray(array []*Schema) *yaml.Node { - content := make([]*yaml.Node, 0) - for _, item := range array { - content = append(content, item.nodeValue()) - } - return nodeForSequence(content) -} - -func (object *StringOrStringArray) nodeValue() *yaml.Node { - if object.String != nil { - return nodeForString(*object.String) - } else if object.StringArray != nil { - return nodeForStringArray(*(object.StringArray)) - } else { - return nil - } -} - -func (object *SchemaOrStringArray) nodeValue() *yaml.Node { - if object.Schema != nil { - return object.Schema.nodeValue() - } else if object.StringArray != nil { - return nodeForStringArray(*(object.StringArray)) - } else { - return nil - } -} - -func (object *SchemaOrSchemaArray) nodeValue() *yaml.Node { - if object.Schema != nil { - return object.Schema.nodeValue() - } else if object.SchemaArray != nil { - return nodeForSchemaArray(*(object.SchemaArray)) - } else { - return nil - } -} - -func (object *SchemaEnumValue) nodeValue() *yaml.Node { - if object.String != nil { - return nodeForString(*object.String) - } else if object.Bool != nil { - return nodeForBoolean(*object.Bool) - } else { - return nil - } -} - -func nodeForNamedSchemaArray(array *[]*NamedSchema) *yaml.Node { - content := make([]*yaml.Node, 0) - for _, pair := range *(array) { - content = appendPair(content, pair.Name, pair.Value.nodeValue()) - } - return nodeForMapping(content) -} - -func nodeForNamedSchemaOrStringArray(array *[]*NamedSchemaOrStringArray) *yaml.Node { - content := make([]*yaml.Node, 0) - for _, pair := range *(array) { - content = appendPair(content, pair.Name, pair.Value.nodeValue()) - } - return nodeForMapping(content) -} - -func nodeForSchemaEnumArray(array *[]SchemaEnumValue) *yaml.Node { - content := make([]*yaml.Node, 0) - for _, item := range *array { - content = append(content, item.nodeValue()) - } - return nodeForSequence(content) -} - -func nodeForMapping(content []*yaml.Node) *yaml.Node { - return &yaml.Node{ - Kind: yaml.MappingNode, - Content: content, - } -} - -func nodeForSequence(content []*yaml.Node) *yaml.Node { - return &yaml.Node{ - Kind: yaml.SequenceNode, - Content: content, - } -} - -func nodeForString(value string) *yaml.Node { - return &yaml.Node{ - Kind: yaml.ScalarNode, - Tag: "!!str", - Value: value, - } -} - -func nodeForBoolean(value bool) *yaml.Node { - return &yaml.Node{ - Kind: yaml.ScalarNode, - Tag: "!!bool", - Value: fmt.Sprintf("%t", value), - } -} - -func nodeForInt64(value int64) *yaml.Node { - return &yaml.Node{ - Kind: yaml.ScalarNode, - Tag: "!!int", - Value: fmt.Sprintf("%d", value), - } -} - -func nodeForFloat64(value float64) *yaml.Node { - return &yaml.Node{ - Kind: yaml.ScalarNode, - Tag: "!!float", - Value: fmt.Sprintf("%f", value), - } -} - -func appendPair(nodes []*yaml.Node, name string, value *yaml.Node) []*yaml.Node { - nodes = append(nodes, nodeForString(name)) - nodes = append(nodes, value) - return nodes -} - -func (schema *Schema) nodeValue() *yaml.Node { - n := &yaml.Node{Kind: yaml.MappingNode} - content := make([]*yaml.Node, 0) - if schema.Title != nil { - content = appendPair(content, "title", nodeForString(*schema.Title)) - } - if schema.ID != nil { - content = appendPair(content, "id", nodeForString(*schema.ID)) - } - if schema.Schema != nil { - content = appendPair(content, "$schema", nodeForString(*schema.Schema)) - } - if schema.Type != nil { - content = appendPair(content, "type", schema.Type.nodeValue()) - } - if schema.Items != nil { - content = appendPair(content, "items", schema.Items.nodeValue()) - } - if schema.Description != nil { - content = appendPair(content, "description", nodeForString(*schema.Description)) - } - if schema.Required != nil { - content = appendPair(content, "required", nodeForStringArray(*schema.Required)) - } - if schema.AdditionalProperties != nil { - content = appendPair(content, "additionalProperties", schema.AdditionalProperties.nodeValue()) - } - if schema.PatternProperties != nil { - content = appendPair(content, "patternProperties", nodeForNamedSchemaArray(schema.PatternProperties)) - } - if schema.Properties != nil { - content = appendPair(content, "properties", nodeForNamedSchemaArray(schema.Properties)) - } - if schema.Dependencies != nil { - content = appendPair(content, "dependencies", nodeForNamedSchemaOrStringArray(schema.Dependencies)) - } - if schema.Ref != nil { - content = appendPair(content, "$ref", nodeForString(*schema.Ref)) - } - if schema.MultipleOf != nil { - content = appendPair(content, "multipleOf", schema.MultipleOf.nodeValue()) - } - if schema.Maximum != nil { - content = appendPair(content, "maximum", schema.Maximum.nodeValue()) - } - if schema.ExclusiveMaximum != nil { - content = appendPair(content, "exclusiveMaximum", nodeForBoolean(*schema.ExclusiveMaximum)) - } - if schema.Minimum != nil { - content = appendPair(content, "minimum", schema.Minimum.nodeValue()) - } - if schema.ExclusiveMinimum != nil { - content = appendPair(content, "exclusiveMinimum", nodeForBoolean(*schema.ExclusiveMinimum)) - } - if schema.MaxLength != nil { - content = appendPair(content, "maxLength", nodeForInt64(*schema.MaxLength)) - } - if schema.MinLength != nil { - content = appendPair(content, "minLength", nodeForInt64(*schema.MinLength)) - } - if schema.Pattern != nil { - content = appendPair(content, "pattern", nodeForString(*schema.Pattern)) - } - if schema.AdditionalItems != nil { - content = appendPair(content, "additionalItems", schema.AdditionalItems.nodeValue()) - } - if schema.MaxItems != nil { - content = appendPair(content, "maxItems", nodeForInt64(*schema.MaxItems)) - } - if schema.MinItems != nil { - content = appendPair(content, "minItems", nodeForInt64(*schema.MinItems)) - } - if schema.UniqueItems != nil { - content = appendPair(content, "uniqueItems", nodeForBoolean(*schema.UniqueItems)) - } - if schema.MaxProperties != nil { - content = appendPair(content, "maxProperties", nodeForInt64(*schema.MaxProperties)) - } - if schema.MinProperties != nil { - content = appendPair(content, "minProperties", nodeForInt64(*schema.MinProperties)) - } - if schema.Enumeration != nil { - content = appendPair(content, "enum", nodeForSchemaEnumArray(schema.Enumeration)) - } - if schema.AllOf != nil { - content = appendPair(content, "allOf", nodeForSchemaArray(*schema.AllOf)) - } - if schema.AnyOf != nil { - content = appendPair(content, "anyOf", nodeForSchemaArray(*schema.AnyOf)) - } - if schema.OneOf != nil { - content = appendPair(content, "oneOf", nodeForSchemaArray(*schema.OneOf)) - } - if schema.Not != nil { - content = appendPair(content, "not", schema.Not.nodeValue()) - } - if schema.Definitions != nil { - content = appendPair(content, "definitions", nodeForNamedSchemaArray(schema.Definitions)) - } - if schema.Default != nil { - // m = append(m, yaml.MapItem{Key: "default", Value: *schema.Default}) - } - if schema.Format != nil { - content = appendPair(content, "format", nodeForString(*schema.Format)) - } - n.Content = content - return n -} - -// JSONString returns a json representation of a schema. -func (schema *Schema) JSONString() string { - node := schema.nodeValue() - return Render(node) -} diff --git a/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.go b/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.go deleted file mode 100644 index d71fe6d54..000000000 --- a/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.go +++ /dev/null @@ -1,8820 +0,0 @@ -// Copyright 2020 Google LLC. All Rights Reserved. -// -// 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. - -// THIS FILE IS AUTOMATICALLY GENERATED. - -package openapi_v2 - -import ( - "fmt" - "regexp" - "strings" - - "gopkg.in/yaml.v3" - - "github.com/google/gnostic-models/compiler" -) - -// Version returns the package name (and OpenAPI version). -func Version() string { - return "openapi_v2" -} - -// NewAdditionalPropertiesItem creates an object of type AdditionalPropertiesItem if possible, returning an error if not. -func NewAdditionalPropertiesItem(in *yaml.Node, context *compiler.Context) (*AdditionalPropertiesItem, error) { - errors := make([]error, 0) - x := &AdditionalPropertiesItem{} - matched := false - // Schema schema = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewSchema(m, compiler.NewContext("schema", m, context)) - if matchingError == nil { - x.Oneof = &AdditionalPropertiesItem_Schema{Schema: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // bool boolean = 2; - boolValue, ok := compiler.BoolForScalarNode(in) - if ok { - x.Oneof = &AdditionalPropertiesItem_Boolean{Boolean: boolValue} - matched = true - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid AdditionalPropertiesItem") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewAny creates an object of type Any if possible, returning an error if not. -func NewAny(in *yaml.Node, context *compiler.Context) (*Any, error) { - errors := make([]error, 0) - x := &Any{} - bytes := compiler.Marshal(in) - x.Yaml = string(bytes) - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewApiKeySecurity creates an object of type ApiKeySecurity if possible, returning an error if not. -func NewApiKeySecurity(in *yaml.Node, context *compiler.Context) (*ApiKeySecurity, error) { - errors := make([]error, 0) - x := &ApiKeySecurity{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"in", "name", "type"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"description", "in", "name", "type"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string type = 1; - v1 := compiler.MapValueForKey(m, "type") - if v1 != nil { - x.Type, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [apiKey] - if ok && !compiler.StringArrayContainsValue([]string{"apiKey"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string name = 2; - v2 := compiler.MapValueForKey(m, "name") - if v2 != nil { - x.Name, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string in = 3; - v3 := compiler.MapValueForKey(m, "in") - if v3 != nil { - x.In, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [header query] - if ok && !compiler.StringArrayContainsValue([]string{"header", "query"}, x.In) { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 4; - v4 := compiler.MapValueForKey(m, "description") - if v4 != nil { - x.Description, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 5; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewBasicAuthenticationSecurity creates an object of type BasicAuthenticationSecurity if possible, returning an error if not. -func NewBasicAuthenticationSecurity(in *yaml.Node, context *compiler.Context) (*BasicAuthenticationSecurity, error) { - errors := make([]error, 0) - x := &BasicAuthenticationSecurity{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"type"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"description", "type"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string type = 1; - v1 := compiler.MapValueForKey(m, "type") - if v1 != nil { - x.Type, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [basic] - if ok && !compiler.StringArrayContainsValue([]string{"basic"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 2; - v2 := compiler.MapValueForKey(m, "description") - if v2 != nil { - x.Description, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 3; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewBodyParameter creates an object of type BodyParameter if possible, returning an error if not. -func NewBodyParameter(in *yaml.Node, context *compiler.Context) (*BodyParameter, error) { - errors := make([]error, 0) - x := &BodyParameter{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"in", "name", "schema"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"description", "in", "name", "required", "schema"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string description = 1; - v1 := compiler.MapValueForKey(m, "description") - if v1 != nil { - x.Description, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string name = 2; - v2 := compiler.MapValueForKey(m, "name") - if v2 != nil { - x.Name, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string in = 3; - v3 := compiler.MapValueForKey(m, "in") - if v3 != nil { - x.In, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [body] - if ok && !compiler.StringArrayContainsValue([]string{"body"}, x.In) { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool required = 4; - v4 := compiler.MapValueForKey(m, "required") - if v4 != nil { - x.Required, ok = compiler.BoolForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Schema schema = 5; - v5 := compiler.MapValueForKey(m, "schema") - if v5 != nil { - var err error - x.Schema, err = NewSchema(v5, compiler.NewContext("schema", v5, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny vendor_extension = 6; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewContact creates an object of type Contact if possible, returning an error if not. -func NewContact(in *yaml.Node, context *compiler.Context) (*Contact, error) { - errors := make([]error, 0) - x := &Contact{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"email", "name", "url"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string url = 2; - v2 := compiler.MapValueForKey(m, "url") - if v2 != nil { - x.Url, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string email = 3; - v3 := compiler.MapValueForKey(m, "email") - if v3 != nil { - x.Email, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for email: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 4; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewDefault creates an object of type Default if possible, returning an error if not. -func NewDefault(in *yaml.Node, context *compiler.Context) (*Default, error) { - errors := make([]error, 0) - x := &Default{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedAny additional_properties = 1; - // MAP: Any - x.AdditionalProperties = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewDefinitions creates an object of type Definitions if possible, returning an error if not. -func NewDefinitions(in *yaml.Node, context *compiler.Context) (*Definitions, error) { - errors := make([]error, 0) - x := &Definitions{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedSchema additional_properties = 1; - // MAP: Schema - x.AdditionalProperties = make([]*NamedSchema, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedSchema{} - pair.Name = k - var err error - pair.Value, err = NewSchema(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewDocument creates an object of type Document if possible, returning an error if not. -func NewDocument(in *yaml.Node, context *compiler.Context) (*Document, error) { - errors := make([]error, 0) - x := &Document{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"info", "paths", "swagger"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"basePath", "consumes", "definitions", "externalDocs", "host", "info", "parameters", "paths", "produces", "responses", "schemes", "security", "securityDefinitions", "swagger", "tags"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string swagger = 1; - v1 := compiler.MapValueForKey(m, "swagger") - if v1 != nil { - x.Swagger, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for swagger: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [2.0] - if ok && !compiler.StringArrayContainsValue([]string{"2.0"}, x.Swagger) { - message := fmt.Sprintf("has unexpected value for swagger: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Info info = 2; - v2 := compiler.MapValueForKey(m, "info") - if v2 != nil { - var err error - x.Info, err = NewInfo(v2, compiler.NewContext("info", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - // string host = 3; - v3 := compiler.MapValueForKey(m, "host") - if v3 != nil { - x.Host, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for host: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string base_path = 4; - v4 := compiler.MapValueForKey(m, "basePath") - if v4 != nil { - x.BasePath, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for basePath: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated string schemes = 5; - v5 := compiler.MapValueForKey(m, "schemes") - if v5 != nil { - v, ok := compiler.SequenceNodeForNode(v5) - if ok { - x.Schemes = compiler.StringArrayForSequenceNode(v) - } else { - message := fmt.Sprintf("has unexpected value for schemes: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [http https ws wss] - if ok && !compiler.StringArrayContainsValues([]string{"http", "https", "ws", "wss"}, x.Schemes) { - message := fmt.Sprintf("has unexpected value for schemes: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated string consumes = 6; - v6 := compiler.MapValueForKey(m, "consumes") - if v6 != nil { - v, ok := compiler.SequenceNodeForNode(v6) - if ok { - x.Consumes = compiler.StringArrayForSequenceNode(v) - } else { - message := fmt.Sprintf("has unexpected value for consumes: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated string produces = 7; - v7 := compiler.MapValueForKey(m, "produces") - if v7 != nil { - v, ok := compiler.SequenceNodeForNode(v7) - if ok { - x.Produces = compiler.StringArrayForSequenceNode(v) - } else { - message := fmt.Sprintf("has unexpected value for produces: %s", compiler.Display(v7)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Paths paths = 8; - v8 := compiler.MapValueForKey(m, "paths") - if v8 != nil { - var err error - x.Paths, err = NewPaths(v8, compiler.NewContext("paths", v8, context)) - if err != nil { - errors = append(errors, err) - } - } - // Definitions definitions = 9; - v9 := compiler.MapValueForKey(m, "definitions") - if v9 != nil { - var err error - x.Definitions, err = NewDefinitions(v9, compiler.NewContext("definitions", v9, context)) - if err != nil { - errors = append(errors, err) - } - } - // ParameterDefinitions parameters = 10; - v10 := compiler.MapValueForKey(m, "parameters") - if v10 != nil { - var err error - x.Parameters, err = NewParameterDefinitions(v10, compiler.NewContext("parameters", v10, context)) - if err != nil { - errors = append(errors, err) - } - } - // ResponseDefinitions responses = 11; - v11 := compiler.MapValueForKey(m, "responses") - if v11 != nil { - var err error - x.Responses, err = NewResponseDefinitions(v11, compiler.NewContext("responses", v11, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated SecurityRequirement security = 12; - v12 := compiler.MapValueForKey(m, "security") - if v12 != nil { - // repeated SecurityRequirement - x.Security = make([]*SecurityRequirement, 0) - a, ok := compiler.SequenceNodeForNode(v12) - if ok { - for _, item := range a.Content { - y, err := NewSecurityRequirement(item, compiler.NewContext("security", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Security = append(x.Security, y) - } - } - } - // SecurityDefinitions security_definitions = 13; - v13 := compiler.MapValueForKey(m, "securityDefinitions") - if v13 != nil { - var err error - x.SecurityDefinitions, err = NewSecurityDefinitions(v13, compiler.NewContext("securityDefinitions", v13, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated Tag tags = 14; - v14 := compiler.MapValueForKey(m, "tags") - if v14 != nil { - // repeated Tag - x.Tags = make([]*Tag, 0) - a, ok := compiler.SequenceNodeForNode(v14) - if ok { - for _, item := range a.Content { - y, err := NewTag(item, compiler.NewContext("tags", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Tags = append(x.Tags, y) - } - } - } - // ExternalDocs external_docs = 15; - v15 := compiler.MapValueForKey(m, "externalDocs") - if v15 != nil { - var err error - x.ExternalDocs, err = NewExternalDocs(v15, compiler.NewContext("externalDocs", v15, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny vendor_extension = 16; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewExamples creates an object of type Examples if possible, returning an error if not. -func NewExamples(in *yaml.Node, context *compiler.Context) (*Examples, error) { - errors := make([]error, 0) - x := &Examples{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedAny additional_properties = 1; - // MAP: Any - x.AdditionalProperties = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewExternalDocs creates an object of type ExternalDocs if possible, returning an error if not. -func NewExternalDocs(in *yaml.Node, context *compiler.Context) (*ExternalDocs, error) { - errors := make([]error, 0) - x := &ExternalDocs{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"url"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"description", "url"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string description = 1; - v1 := compiler.MapValueForKey(m, "description") - if v1 != nil { - x.Description, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string url = 2; - v2 := compiler.MapValueForKey(m, "url") - if v2 != nil { - x.Url, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 3; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewFileSchema creates an object of type FileSchema if possible, returning an error if not. -func NewFileSchema(in *yaml.Node, context *compiler.Context) (*FileSchema, error) { - errors := make([]error, 0) - x := &FileSchema{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"type"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"default", "description", "example", "externalDocs", "format", "readOnly", "required", "title", "type"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string format = 1; - v1 := compiler.MapValueForKey(m, "format") - if v1 != nil { - x.Format, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string title = 2; - v2 := compiler.MapValueForKey(m, "title") - if v2 != nil { - x.Title, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for title: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 3; - v3 := compiler.MapValueForKey(m, "description") - if v3 != nil { - x.Description, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Any default = 4; - v4 := compiler.MapValueForKey(m, "default") - if v4 != nil { - var err error - x.Default, err = NewAny(v4, compiler.NewContext("default", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated string required = 5; - v5 := compiler.MapValueForKey(m, "required") - if v5 != nil { - v, ok := compiler.SequenceNodeForNode(v5) - if ok { - x.Required = compiler.StringArrayForSequenceNode(v) - } else { - message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string type = 6; - v6 := compiler.MapValueForKey(m, "type") - if v6 != nil { - x.Type, ok = compiler.StringForScalarNode(v6) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [file] - if ok && !compiler.StringArrayContainsValue([]string{"file"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool read_only = 7; - v7 := compiler.MapValueForKey(m, "readOnly") - if v7 != nil { - x.ReadOnly, ok = compiler.BoolForScalarNode(v7) - if !ok { - message := fmt.Sprintf("has unexpected value for readOnly: %s", compiler.Display(v7)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // ExternalDocs external_docs = 8; - v8 := compiler.MapValueForKey(m, "externalDocs") - if v8 != nil { - var err error - x.ExternalDocs, err = NewExternalDocs(v8, compiler.NewContext("externalDocs", v8, context)) - if err != nil { - errors = append(errors, err) - } - } - // Any example = 9; - v9 := compiler.MapValueForKey(m, "example") - if v9 != nil { - var err error - x.Example, err = NewAny(v9, compiler.NewContext("example", v9, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny vendor_extension = 10; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewFormDataParameterSubSchema creates an object of type FormDataParameterSubSchema if possible, returning an error if not. -func NewFormDataParameterSubSchema(in *yaml.Node, context *compiler.Context) (*FormDataParameterSubSchema, error) { - errors := make([]error, 0) - x := &FormDataParameterSubSchema{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"allowEmptyValue", "collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // bool required = 1; - v1 := compiler.MapValueForKey(m, "required") - if v1 != nil { - x.Required, ok = compiler.BoolForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string in = 2; - v2 := compiler.MapValueForKey(m, "in") - if v2 != nil { - x.In, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [formData] - if ok && !compiler.StringArrayContainsValue([]string{"formData"}, x.In) { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 3; - v3 := compiler.MapValueForKey(m, "description") - if v3 != nil { - x.Description, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string name = 4; - v4 := compiler.MapValueForKey(m, "name") - if v4 != nil { - x.Name, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool allow_empty_value = 5; - v5 := compiler.MapValueForKey(m, "allowEmptyValue") - if v5 != nil { - x.AllowEmptyValue, ok = compiler.BoolForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for allowEmptyValue: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string type = 6; - v6 := compiler.MapValueForKey(m, "type") - if v6 != nil { - x.Type, ok = compiler.StringForScalarNode(v6) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [string number boolean integer array file] - if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "boolean", "integer", "array", "file"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string format = 7; - v7 := compiler.MapValueForKey(m, "format") - if v7 != nil { - x.Format, ok = compiler.StringForScalarNode(v7) - if !ok { - message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v7)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // PrimitivesItems items = 8; - v8 := compiler.MapValueForKey(m, "items") - if v8 != nil { - var err error - x.Items, err = NewPrimitivesItems(v8, compiler.NewContext("items", v8, context)) - if err != nil { - errors = append(errors, err) - } - } - // string collection_format = 9; - v9 := compiler.MapValueForKey(m, "collectionFormat") - if v9 != nil { - x.CollectionFormat, ok = compiler.StringForScalarNode(v9) - if !ok { - message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v9)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [csv ssv tsv pipes multi] - if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes", "multi"}, x.CollectionFormat) { - message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v9)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Any default = 10; - v10 := compiler.MapValueForKey(m, "default") - if v10 != nil { - var err error - x.Default, err = NewAny(v10, compiler.NewContext("default", v10, context)) - if err != nil { - errors = append(errors, err) - } - } - // float maximum = 11; - v11 := compiler.MapValueForKey(m, "maximum") - if v11 != nil { - v, ok := compiler.FloatForScalarNode(v11) - if ok { - x.Maximum = v - } else { - message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v11)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_maximum = 12; - v12 := compiler.MapValueForKey(m, "exclusiveMaximum") - if v12 != nil { - x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v12) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v12)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // float minimum = 13; - v13 := compiler.MapValueForKey(m, "minimum") - if v13 != nil { - v, ok := compiler.FloatForScalarNode(v13) - if ok { - x.Minimum = v - } else { - message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v13)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_minimum = 14; - v14 := compiler.MapValueForKey(m, "exclusiveMinimum") - if v14 != nil { - x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v14) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v14)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_length = 15; - v15 := compiler.MapValueForKey(m, "maxLength") - if v15 != nil { - t, ok := compiler.IntForScalarNode(v15) - if ok { - x.MaxLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v15)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_length = 16; - v16 := compiler.MapValueForKey(m, "minLength") - if v16 != nil { - t, ok := compiler.IntForScalarNode(v16) - if ok { - x.MinLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v16)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string pattern = 17; - v17 := compiler.MapValueForKey(m, "pattern") - if v17 != nil { - x.Pattern, ok = compiler.StringForScalarNode(v17) - if !ok { - message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v17)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_items = 18; - v18 := compiler.MapValueForKey(m, "maxItems") - if v18 != nil { - t, ok := compiler.IntForScalarNode(v18) - if ok { - x.MaxItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v18)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_items = 19; - v19 := compiler.MapValueForKey(m, "minItems") - if v19 != nil { - t, ok := compiler.IntForScalarNode(v19) - if ok { - x.MinItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v19)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool unique_items = 20; - v20 := compiler.MapValueForKey(m, "uniqueItems") - if v20 != nil { - x.UniqueItems, ok = compiler.BoolForScalarNode(v20) - if !ok { - message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v20)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated Any enum = 21; - v21 := compiler.MapValueForKey(m, "enum") - if v21 != nil { - // repeated Any - x.Enum = make([]*Any, 0) - a, ok := compiler.SequenceNodeForNode(v21) - if ok { - for _, item := range a.Content { - y, err := NewAny(item, compiler.NewContext("enum", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Enum = append(x.Enum, y) - } - } - } - // float multiple_of = 22; - v22 := compiler.MapValueForKey(m, "multipleOf") - if v22 != nil { - v, ok := compiler.FloatForScalarNode(v22) - if ok { - x.MultipleOf = v - } else { - message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v22)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 23; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewHeader creates an object of type Header if possible, returning an error if not. -func NewHeader(in *yaml.Node, context *compiler.Context) (*Header, error) { - errors := make([]error, 0) - x := &Header{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"type"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "pattern", "type", "uniqueItems"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string type = 1; - v1 := compiler.MapValueForKey(m, "type") - if v1 != nil { - x.Type, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [string number integer boolean array] - if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "integer", "boolean", "array"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string format = 2; - v2 := compiler.MapValueForKey(m, "format") - if v2 != nil { - x.Format, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // PrimitivesItems items = 3; - v3 := compiler.MapValueForKey(m, "items") - if v3 != nil { - var err error - x.Items, err = NewPrimitivesItems(v3, compiler.NewContext("items", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // string collection_format = 4; - v4 := compiler.MapValueForKey(m, "collectionFormat") - if v4 != nil { - x.CollectionFormat, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [csv ssv tsv pipes] - if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes"}, x.CollectionFormat) { - message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Any default = 5; - v5 := compiler.MapValueForKey(m, "default") - if v5 != nil { - var err error - x.Default, err = NewAny(v5, compiler.NewContext("default", v5, context)) - if err != nil { - errors = append(errors, err) - } - } - // float maximum = 6; - v6 := compiler.MapValueForKey(m, "maximum") - if v6 != nil { - v, ok := compiler.FloatForScalarNode(v6) - if ok { - x.Maximum = v - } else { - message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_maximum = 7; - v7 := compiler.MapValueForKey(m, "exclusiveMaximum") - if v7 != nil { - x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v7) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v7)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // float minimum = 8; - v8 := compiler.MapValueForKey(m, "minimum") - if v8 != nil { - v, ok := compiler.FloatForScalarNode(v8) - if ok { - x.Minimum = v - } else { - message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v8)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_minimum = 9; - v9 := compiler.MapValueForKey(m, "exclusiveMinimum") - if v9 != nil { - x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v9) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v9)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_length = 10; - v10 := compiler.MapValueForKey(m, "maxLength") - if v10 != nil { - t, ok := compiler.IntForScalarNode(v10) - if ok { - x.MaxLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v10)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_length = 11; - v11 := compiler.MapValueForKey(m, "minLength") - if v11 != nil { - t, ok := compiler.IntForScalarNode(v11) - if ok { - x.MinLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v11)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string pattern = 12; - v12 := compiler.MapValueForKey(m, "pattern") - if v12 != nil { - x.Pattern, ok = compiler.StringForScalarNode(v12) - if !ok { - message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v12)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_items = 13; - v13 := compiler.MapValueForKey(m, "maxItems") - if v13 != nil { - t, ok := compiler.IntForScalarNode(v13) - if ok { - x.MaxItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v13)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_items = 14; - v14 := compiler.MapValueForKey(m, "minItems") - if v14 != nil { - t, ok := compiler.IntForScalarNode(v14) - if ok { - x.MinItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v14)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool unique_items = 15; - v15 := compiler.MapValueForKey(m, "uniqueItems") - if v15 != nil { - x.UniqueItems, ok = compiler.BoolForScalarNode(v15) - if !ok { - message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v15)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated Any enum = 16; - v16 := compiler.MapValueForKey(m, "enum") - if v16 != nil { - // repeated Any - x.Enum = make([]*Any, 0) - a, ok := compiler.SequenceNodeForNode(v16) - if ok { - for _, item := range a.Content { - y, err := NewAny(item, compiler.NewContext("enum", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Enum = append(x.Enum, y) - } - } - } - // float multiple_of = 17; - v17 := compiler.MapValueForKey(m, "multipleOf") - if v17 != nil { - v, ok := compiler.FloatForScalarNode(v17) - if ok { - x.MultipleOf = v - } else { - message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v17)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 18; - v18 := compiler.MapValueForKey(m, "description") - if v18 != nil { - x.Description, ok = compiler.StringForScalarNode(v18) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v18)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 19; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewHeaderParameterSubSchema creates an object of type HeaderParameterSubSchema if possible, returning an error if not. -func NewHeaderParameterSubSchema(in *yaml.Node, context *compiler.Context) (*HeaderParameterSubSchema, error) { - errors := make([]error, 0) - x := &HeaderParameterSubSchema{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // bool required = 1; - v1 := compiler.MapValueForKey(m, "required") - if v1 != nil { - x.Required, ok = compiler.BoolForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string in = 2; - v2 := compiler.MapValueForKey(m, "in") - if v2 != nil { - x.In, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [header] - if ok && !compiler.StringArrayContainsValue([]string{"header"}, x.In) { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 3; - v3 := compiler.MapValueForKey(m, "description") - if v3 != nil { - x.Description, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string name = 4; - v4 := compiler.MapValueForKey(m, "name") - if v4 != nil { - x.Name, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string type = 5; - v5 := compiler.MapValueForKey(m, "type") - if v5 != nil { - x.Type, ok = compiler.StringForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [string number boolean integer array] - if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "boolean", "integer", "array"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string format = 6; - v6 := compiler.MapValueForKey(m, "format") - if v6 != nil { - x.Format, ok = compiler.StringForScalarNode(v6) - if !ok { - message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // PrimitivesItems items = 7; - v7 := compiler.MapValueForKey(m, "items") - if v7 != nil { - var err error - x.Items, err = NewPrimitivesItems(v7, compiler.NewContext("items", v7, context)) - if err != nil { - errors = append(errors, err) - } - } - // string collection_format = 8; - v8 := compiler.MapValueForKey(m, "collectionFormat") - if v8 != nil { - x.CollectionFormat, ok = compiler.StringForScalarNode(v8) - if !ok { - message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v8)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [csv ssv tsv pipes] - if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes"}, x.CollectionFormat) { - message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v8)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Any default = 9; - v9 := compiler.MapValueForKey(m, "default") - if v9 != nil { - var err error - x.Default, err = NewAny(v9, compiler.NewContext("default", v9, context)) - if err != nil { - errors = append(errors, err) - } - } - // float maximum = 10; - v10 := compiler.MapValueForKey(m, "maximum") - if v10 != nil { - v, ok := compiler.FloatForScalarNode(v10) - if ok { - x.Maximum = v - } else { - message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v10)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_maximum = 11; - v11 := compiler.MapValueForKey(m, "exclusiveMaximum") - if v11 != nil { - x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v11) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v11)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // float minimum = 12; - v12 := compiler.MapValueForKey(m, "minimum") - if v12 != nil { - v, ok := compiler.FloatForScalarNode(v12) - if ok { - x.Minimum = v - } else { - message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v12)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_minimum = 13; - v13 := compiler.MapValueForKey(m, "exclusiveMinimum") - if v13 != nil { - x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v13) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v13)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_length = 14; - v14 := compiler.MapValueForKey(m, "maxLength") - if v14 != nil { - t, ok := compiler.IntForScalarNode(v14) - if ok { - x.MaxLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v14)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_length = 15; - v15 := compiler.MapValueForKey(m, "minLength") - if v15 != nil { - t, ok := compiler.IntForScalarNode(v15) - if ok { - x.MinLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v15)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string pattern = 16; - v16 := compiler.MapValueForKey(m, "pattern") - if v16 != nil { - x.Pattern, ok = compiler.StringForScalarNode(v16) - if !ok { - message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v16)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_items = 17; - v17 := compiler.MapValueForKey(m, "maxItems") - if v17 != nil { - t, ok := compiler.IntForScalarNode(v17) - if ok { - x.MaxItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v17)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_items = 18; - v18 := compiler.MapValueForKey(m, "minItems") - if v18 != nil { - t, ok := compiler.IntForScalarNode(v18) - if ok { - x.MinItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v18)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool unique_items = 19; - v19 := compiler.MapValueForKey(m, "uniqueItems") - if v19 != nil { - x.UniqueItems, ok = compiler.BoolForScalarNode(v19) - if !ok { - message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v19)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated Any enum = 20; - v20 := compiler.MapValueForKey(m, "enum") - if v20 != nil { - // repeated Any - x.Enum = make([]*Any, 0) - a, ok := compiler.SequenceNodeForNode(v20) - if ok { - for _, item := range a.Content { - y, err := NewAny(item, compiler.NewContext("enum", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Enum = append(x.Enum, y) - } - } - } - // float multiple_of = 21; - v21 := compiler.MapValueForKey(m, "multipleOf") - if v21 != nil { - v, ok := compiler.FloatForScalarNode(v21) - if ok { - x.MultipleOf = v - } else { - message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v21)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 22; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewHeaders creates an object of type Headers if possible, returning an error if not. -func NewHeaders(in *yaml.Node, context *compiler.Context) (*Headers, error) { - errors := make([]error, 0) - x := &Headers{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedHeader additional_properties = 1; - // MAP: Header - x.AdditionalProperties = make([]*NamedHeader, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedHeader{} - pair.Name = k - var err error - pair.Value, err = NewHeader(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewInfo creates an object of type Info if possible, returning an error if not. -func NewInfo(in *yaml.Node, context *compiler.Context) (*Info, error) { - errors := make([]error, 0) - x := &Info{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"title", "version"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"contact", "description", "license", "termsOfService", "title", "version"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string title = 1; - v1 := compiler.MapValueForKey(m, "title") - if v1 != nil { - x.Title, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for title: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string version = 2; - v2 := compiler.MapValueForKey(m, "version") - if v2 != nil { - x.Version, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for version: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 3; - v3 := compiler.MapValueForKey(m, "description") - if v3 != nil { - x.Description, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string terms_of_service = 4; - v4 := compiler.MapValueForKey(m, "termsOfService") - if v4 != nil { - x.TermsOfService, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for termsOfService: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Contact contact = 5; - v5 := compiler.MapValueForKey(m, "contact") - if v5 != nil { - var err error - x.Contact, err = NewContact(v5, compiler.NewContext("contact", v5, context)) - if err != nil { - errors = append(errors, err) - } - } - // License license = 6; - v6 := compiler.MapValueForKey(m, "license") - if v6 != nil { - var err error - x.License, err = NewLicense(v6, compiler.NewContext("license", v6, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny vendor_extension = 7; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewItemsItem creates an object of type ItemsItem if possible, returning an error if not. -func NewItemsItem(in *yaml.Node, context *compiler.Context) (*ItemsItem, error) { - errors := make([]error, 0) - x := &ItemsItem{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value for item array: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - x.Schema = make([]*Schema, 0) - y, err := NewSchema(m, compiler.NewContext("", m, context)) - if err != nil { - return nil, err - } - x.Schema = append(x.Schema, y) - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewJsonReference creates an object of type JsonReference if possible, returning an error if not. -func NewJsonReference(in *yaml.Node, context *compiler.Context) (*JsonReference, error) { - errors := make([]error, 0) - x := &JsonReference{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"$ref"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string _ref = 1; - v1 := compiler.MapValueForKey(m, "$ref") - if v1 != nil { - x.XRef, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for $ref: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 2; - v2 := compiler.MapValueForKey(m, "description") - if v2 != nil { - x.Description, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewLicense creates an object of type License if possible, returning an error if not. -func NewLicense(in *yaml.Node, context *compiler.Context) (*License, error) { - errors := make([]error, 0) - x := &License{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"name"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"name", "url"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string url = 2; - v2 := compiler.MapValueForKey(m, "url") - if v2 != nil { - x.Url, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 3; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedAny creates an object of type NamedAny if possible, returning an error if not. -func NewNamedAny(in *yaml.Node, context *compiler.Context) (*NamedAny, error) { - errors := make([]error, 0) - x := &NamedAny{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Any value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewAny(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedHeader creates an object of type NamedHeader if possible, returning an error if not. -func NewNamedHeader(in *yaml.Node, context *compiler.Context) (*NamedHeader, error) { - errors := make([]error, 0) - x := &NamedHeader{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Header value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewHeader(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedParameter creates an object of type NamedParameter if possible, returning an error if not. -func NewNamedParameter(in *yaml.Node, context *compiler.Context) (*NamedParameter, error) { - errors := make([]error, 0) - x := &NamedParameter{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Parameter value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewParameter(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedPathItem creates an object of type NamedPathItem if possible, returning an error if not. -func NewNamedPathItem(in *yaml.Node, context *compiler.Context) (*NamedPathItem, error) { - errors := make([]error, 0) - x := &NamedPathItem{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // PathItem value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewPathItem(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedResponse creates an object of type NamedResponse if possible, returning an error if not. -func NewNamedResponse(in *yaml.Node, context *compiler.Context) (*NamedResponse, error) { - errors := make([]error, 0) - x := &NamedResponse{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Response value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewResponse(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedResponseValue creates an object of type NamedResponseValue if possible, returning an error if not. -func NewNamedResponseValue(in *yaml.Node, context *compiler.Context) (*NamedResponseValue, error) { - errors := make([]error, 0) - x := &NamedResponseValue{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // ResponseValue value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewResponseValue(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedSchema creates an object of type NamedSchema if possible, returning an error if not. -func NewNamedSchema(in *yaml.Node, context *compiler.Context) (*NamedSchema, error) { - errors := make([]error, 0) - x := &NamedSchema{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Schema value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewSchema(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedSecurityDefinitionsItem creates an object of type NamedSecurityDefinitionsItem if possible, returning an error if not. -func NewNamedSecurityDefinitionsItem(in *yaml.Node, context *compiler.Context) (*NamedSecurityDefinitionsItem, error) { - errors := make([]error, 0) - x := &NamedSecurityDefinitionsItem{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // SecurityDefinitionsItem value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewSecurityDefinitionsItem(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedString creates an object of type NamedString if possible, returning an error if not. -func NewNamedString(in *yaml.Node, context *compiler.Context) (*NamedString, error) { - errors := make([]error, 0) - x := &NamedString{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - x.Value, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for value: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedStringArray creates an object of type NamedStringArray if possible, returning an error if not. -func NewNamedStringArray(in *yaml.Node, context *compiler.Context) (*NamedStringArray, error) { - errors := make([]error, 0) - x := &NamedStringArray{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // StringArray value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewStringArray(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNonBodyParameter creates an object of type NonBodyParameter if possible, returning an error if not. -func NewNonBodyParameter(in *yaml.Node, context *compiler.Context) (*NonBodyParameter, error) { - errors := make([]error, 0) - x := &NonBodyParameter{} - matched := false - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"in", "name", "type"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // HeaderParameterSubSchema header_parameter_sub_schema = 1; - { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewHeaderParameterSubSchema(m, compiler.NewContext("headerParameterSubSchema", m, context)) - if matchingError == nil { - x.Oneof = &NonBodyParameter_HeaderParameterSubSchema{HeaderParameterSubSchema: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - // FormDataParameterSubSchema form_data_parameter_sub_schema = 2; - { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewFormDataParameterSubSchema(m, compiler.NewContext("formDataParameterSubSchema", m, context)) - if matchingError == nil { - x.Oneof = &NonBodyParameter_FormDataParameterSubSchema{FormDataParameterSubSchema: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - // QueryParameterSubSchema query_parameter_sub_schema = 3; - { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewQueryParameterSubSchema(m, compiler.NewContext("queryParameterSubSchema", m, context)) - if matchingError == nil { - x.Oneof = &NonBodyParameter_QueryParameterSubSchema{QueryParameterSubSchema: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - // PathParameterSubSchema path_parameter_sub_schema = 4; - { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewPathParameterSubSchema(m, compiler.NewContext("pathParameterSubSchema", m, context)) - if matchingError == nil { - x.Oneof = &NonBodyParameter_PathParameterSubSchema{PathParameterSubSchema: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid NonBodyParameter") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewOauth2AccessCodeSecurity creates an object of type Oauth2AccessCodeSecurity if possible, returning an error if not. -func NewOauth2AccessCodeSecurity(in *yaml.Node, context *compiler.Context) (*Oauth2AccessCodeSecurity, error) { - errors := make([]error, 0) - x := &Oauth2AccessCodeSecurity{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"authorizationUrl", "flow", "tokenUrl", "type"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"authorizationUrl", "description", "flow", "scopes", "tokenUrl", "type"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string type = 1; - v1 := compiler.MapValueForKey(m, "type") - if v1 != nil { - x.Type, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [oauth2] - if ok && !compiler.StringArrayContainsValue([]string{"oauth2"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string flow = 2; - v2 := compiler.MapValueForKey(m, "flow") - if v2 != nil { - x.Flow, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [accessCode] - if ok && !compiler.StringArrayContainsValue([]string{"accessCode"}, x.Flow) { - message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Oauth2Scopes scopes = 3; - v3 := compiler.MapValueForKey(m, "scopes") - if v3 != nil { - var err error - x.Scopes, err = NewOauth2Scopes(v3, compiler.NewContext("scopes", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // string authorization_url = 4; - v4 := compiler.MapValueForKey(m, "authorizationUrl") - if v4 != nil { - x.AuthorizationUrl, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for authorizationUrl: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string token_url = 5; - v5 := compiler.MapValueForKey(m, "tokenUrl") - if v5 != nil { - x.TokenUrl, ok = compiler.StringForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for tokenUrl: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 6; - v6 := compiler.MapValueForKey(m, "description") - if v6 != nil { - x.Description, ok = compiler.StringForScalarNode(v6) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 7; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewOauth2ApplicationSecurity creates an object of type Oauth2ApplicationSecurity if possible, returning an error if not. -func NewOauth2ApplicationSecurity(in *yaml.Node, context *compiler.Context) (*Oauth2ApplicationSecurity, error) { - errors := make([]error, 0) - x := &Oauth2ApplicationSecurity{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"flow", "tokenUrl", "type"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"description", "flow", "scopes", "tokenUrl", "type"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string type = 1; - v1 := compiler.MapValueForKey(m, "type") - if v1 != nil { - x.Type, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [oauth2] - if ok && !compiler.StringArrayContainsValue([]string{"oauth2"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string flow = 2; - v2 := compiler.MapValueForKey(m, "flow") - if v2 != nil { - x.Flow, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [application] - if ok && !compiler.StringArrayContainsValue([]string{"application"}, x.Flow) { - message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Oauth2Scopes scopes = 3; - v3 := compiler.MapValueForKey(m, "scopes") - if v3 != nil { - var err error - x.Scopes, err = NewOauth2Scopes(v3, compiler.NewContext("scopes", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // string token_url = 4; - v4 := compiler.MapValueForKey(m, "tokenUrl") - if v4 != nil { - x.TokenUrl, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for tokenUrl: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 5; - v5 := compiler.MapValueForKey(m, "description") - if v5 != nil { - x.Description, ok = compiler.StringForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 6; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewOauth2ImplicitSecurity creates an object of type Oauth2ImplicitSecurity if possible, returning an error if not. -func NewOauth2ImplicitSecurity(in *yaml.Node, context *compiler.Context) (*Oauth2ImplicitSecurity, error) { - errors := make([]error, 0) - x := &Oauth2ImplicitSecurity{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"authorizationUrl", "flow", "type"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"authorizationUrl", "description", "flow", "scopes", "type"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string type = 1; - v1 := compiler.MapValueForKey(m, "type") - if v1 != nil { - x.Type, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [oauth2] - if ok && !compiler.StringArrayContainsValue([]string{"oauth2"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string flow = 2; - v2 := compiler.MapValueForKey(m, "flow") - if v2 != nil { - x.Flow, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [implicit] - if ok && !compiler.StringArrayContainsValue([]string{"implicit"}, x.Flow) { - message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Oauth2Scopes scopes = 3; - v3 := compiler.MapValueForKey(m, "scopes") - if v3 != nil { - var err error - x.Scopes, err = NewOauth2Scopes(v3, compiler.NewContext("scopes", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // string authorization_url = 4; - v4 := compiler.MapValueForKey(m, "authorizationUrl") - if v4 != nil { - x.AuthorizationUrl, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for authorizationUrl: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 5; - v5 := compiler.MapValueForKey(m, "description") - if v5 != nil { - x.Description, ok = compiler.StringForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 6; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewOauth2PasswordSecurity creates an object of type Oauth2PasswordSecurity if possible, returning an error if not. -func NewOauth2PasswordSecurity(in *yaml.Node, context *compiler.Context) (*Oauth2PasswordSecurity, error) { - errors := make([]error, 0) - x := &Oauth2PasswordSecurity{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"flow", "tokenUrl", "type"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"description", "flow", "scopes", "tokenUrl", "type"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string type = 1; - v1 := compiler.MapValueForKey(m, "type") - if v1 != nil { - x.Type, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [oauth2] - if ok && !compiler.StringArrayContainsValue([]string{"oauth2"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string flow = 2; - v2 := compiler.MapValueForKey(m, "flow") - if v2 != nil { - x.Flow, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [password] - if ok && !compiler.StringArrayContainsValue([]string{"password"}, x.Flow) { - message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Oauth2Scopes scopes = 3; - v3 := compiler.MapValueForKey(m, "scopes") - if v3 != nil { - var err error - x.Scopes, err = NewOauth2Scopes(v3, compiler.NewContext("scopes", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // string token_url = 4; - v4 := compiler.MapValueForKey(m, "tokenUrl") - if v4 != nil { - x.TokenUrl, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for tokenUrl: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 5; - v5 := compiler.MapValueForKey(m, "description") - if v5 != nil { - x.Description, ok = compiler.StringForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 6; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewOauth2Scopes creates an object of type Oauth2Scopes if possible, returning an error if not. -func NewOauth2Scopes(in *yaml.Node, context *compiler.Context) (*Oauth2Scopes, error) { - errors := make([]error, 0) - x := &Oauth2Scopes{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedString additional_properties = 1; - // MAP: string - x.AdditionalProperties = make([]*NamedString, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedString{} - pair.Name = k - pair.Value, _ = compiler.StringForScalarNode(v) - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewOperation creates an object of type Operation if possible, returning an error if not. -func NewOperation(in *yaml.Node, context *compiler.Context) (*Operation, error) { - errors := make([]error, 0) - x := &Operation{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"responses"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"consumes", "deprecated", "description", "externalDocs", "operationId", "parameters", "produces", "responses", "schemes", "security", "summary", "tags"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // repeated string tags = 1; - v1 := compiler.MapValueForKey(m, "tags") - if v1 != nil { - v, ok := compiler.SequenceNodeForNode(v1) - if ok { - x.Tags = compiler.StringArrayForSequenceNode(v) - } else { - message := fmt.Sprintf("has unexpected value for tags: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string summary = 2; - v2 := compiler.MapValueForKey(m, "summary") - if v2 != nil { - x.Summary, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for summary: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 3; - v3 := compiler.MapValueForKey(m, "description") - if v3 != nil { - x.Description, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // ExternalDocs external_docs = 4; - v4 := compiler.MapValueForKey(m, "externalDocs") - if v4 != nil { - var err error - x.ExternalDocs, err = NewExternalDocs(v4, compiler.NewContext("externalDocs", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // string operation_id = 5; - v5 := compiler.MapValueForKey(m, "operationId") - if v5 != nil { - x.OperationId, ok = compiler.StringForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for operationId: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated string produces = 6; - v6 := compiler.MapValueForKey(m, "produces") - if v6 != nil { - v, ok := compiler.SequenceNodeForNode(v6) - if ok { - x.Produces = compiler.StringArrayForSequenceNode(v) - } else { - message := fmt.Sprintf("has unexpected value for produces: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated string consumes = 7; - v7 := compiler.MapValueForKey(m, "consumes") - if v7 != nil { - v, ok := compiler.SequenceNodeForNode(v7) - if ok { - x.Consumes = compiler.StringArrayForSequenceNode(v) - } else { - message := fmt.Sprintf("has unexpected value for consumes: %s", compiler.Display(v7)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated ParametersItem parameters = 8; - v8 := compiler.MapValueForKey(m, "parameters") - if v8 != nil { - // repeated ParametersItem - x.Parameters = make([]*ParametersItem, 0) - a, ok := compiler.SequenceNodeForNode(v8) - if ok { - for _, item := range a.Content { - y, err := NewParametersItem(item, compiler.NewContext("parameters", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Parameters = append(x.Parameters, y) - } - } - } - // Responses responses = 9; - v9 := compiler.MapValueForKey(m, "responses") - if v9 != nil { - var err error - x.Responses, err = NewResponses(v9, compiler.NewContext("responses", v9, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated string schemes = 10; - v10 := compiler.MapValueForKey(m, "schemes") - if v10 != nil { - v, ok := compiler.SequenceNodeForNode(v10) - if ok { - x.Schemes = compiler.StringArrayForSequenceNode(v) - } else { - message := fmt.Sprintf("has unexpected value for schemes: %s", compiler.Display(v10)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [http https ws wss] - if ok && !compiler.StringArrayContainsValues([]string{"http", "https", "ws", "wss"}, x.Schemes) { - message := fmt.Sprintf("has unexpected value for schemes: %s", compiler.Display(v10)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool deprecated = 11; - v11 := compiler.MapValueForKey(m, "deprecated") - if v11 != nil { - x.Deprecated, ok = compiler.BoolForScalarNode(v11) - if !ok { - message := fmt.Sprintf("has unexpected value for deprecated: %s", compiler.Display(v11)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated SecurityRequirement security = 12; - v12 := compiler.MapValueForKey(m, "security") - if v12 != nil { - // repeated SecurityRequirement - x.Security = make([]*SecurityRequirement, 0) - a, ok := compiler.SequenceNodeForNode(v12) - if ok { - for _, item := range a.Content { - y, err := NewSecurityRequirement(item, compiler.NewContext("security", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Security = append(x.Security, y) - } - } - } - // repeated NamedAny vendor_extension = 13; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewParameter creates an object of type Parameter if possible, returning an error if not. -func NewParameter(in *yaml.Node, context *compiler.Context) (*Parameter, error) { - errors := make([]error, 0) - x := &Parameter{} - matched := false - // BodyParameter body_parameter = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewBodyParameter(m, compiler.NewContext("bodyParameter", m, context)) - if matchingError == nil { - x.Oneof = &Parameter_BodyParameter{BodyParameter: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // NonBodyParameter non_body_parameter = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewNonBodyParameter(m, compiler.NewContext("nonBodyParameter", m, context)) - if matchingError == nil { - x.Oneof = &Parameter_NonBodyParameter{NonBodyParameter: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid Parameter") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewParameterDefinitions creates an object of type ParameterDefinitions if possible, returning an error if not. -func NewParameterDefinitions(in *yaml.Node, context *compiler.Context) (*ParameterDefinitions, error) { - errors := make([]error, 0) - x := &ParameterDefinitions{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedParameter additional_properties = 1; - // MAP: Parameter - x.AdditionalProperties = make([]*NamedParameter, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedParameter{} - pair.Name = k - var err error - pair.Value, err = NewParameter(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewParametersItem creates an object of type ParametersItem if possible, returning an error if not. -func NewParametersItem(in *yaml.Node, context *compiler.Context) (*ParametersItem, error) { - errors := make([]error, 0) - x := &ParametersItem{} - matched := false - // Parameter parameter = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewParameter(m, compiler.NewContext("parameter", m, context)) - if matchingError == nil { - x.Oneof = &ParametersItem_Parameter{Parameter: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // JsonReference json_reference = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewJsonReference(m, compiler.NewContext("jsonReference", m, context)) - if matchingError == nil { - x.Oneof = &ParametersItem_JsonReference{JsonReference: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid ParametersItem") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewPathItem creates an object of type PathItem if possible, returning an error if not. -func NewPathItem(in *yaml.Node, context *compiler.Context) (*PathItem, error) { - errors := make([]error, 0) - x := &PathItem{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"$ref", "delete", "get", "head", "options", "parameters", "patch", "post", "put"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string _ref = 1; - v1 := compiler.MapValueForKey(m, "$ref") - if v1 != nil { - x.XRef, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for $ref: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Operation get = 2; - v2 := compiler.MapValueForKey(m, "get") - if v2 != nil { - var err error - x.Get, err = NewOperation(v2, compiler.NewContext("get", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation put = 3; - v3 := compiler.MapValueForKey(m, "put") - if v3 != nil { - var err error - x.Put, err = NewOperation(v3, compiler.NewContext("put", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation post = 4; - v4 := compiler.MapValueForKey(m, "post") - if v4 != nil { - var err error - x.Post, err = NewOperation(v4, compiler.NewContext("post", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation delete = 5; - v5 := compiler.MapValueForKey(m, "delete") - if v5 != nil { - var err error - x.Delete, err = NewOperation(v5, compiler.NewContext("delete", v5, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation options = 6; - v6 := compiler.MapValueForKey(m, "options") - if v6 != nil { - var err error - x.Options, err = NewOperation(v6, compiler.NewContext("options", v6, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation head = 7; - v7 := compiler.MapValueForKey(m, "head") - if v7 != nil { - var err error - x.Head, err = NewOperation(v7, compiler.NewContext("head", v7, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation patch = 8; - v8 := compiler.MapValueForKey(m, "patch") - if v8 != nil { - var err error - x.Patch, err = NewOperation(v8, compiler.NewContext("patch", v8, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated ParametersItem parameters = 9; - v9 := compiler.MapValueForKey(m, "parameters") - if v9 != nil { - // repeated ParametersItem - x.Parameters = make([]*ParametersItem, 0) - a, ok := compiler.SequenceNodeForNode(v9) - if ok { - for _, item := range a.Content { - y, err := NewParametersItem(item, compiler.NewContext("parameters", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Parameters = append(x.Parameters, y) - } - } - } - // repeated NamedAny vendor_extension = 10; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewPathParameterSubSchema creates an object of type PathParameterSubSchema if possible, returning an error if not. -func NewPathParameterSubSchema(in *yaml.Node, context *compiler.Context) (*PathParameterSubSchema, error) { - errors := make([]error, 0) - x := &PathParameterSubSchema{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"required"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // bool required = 1; - v1 := compiler.MapValueForKey(m, "required") - if v1 != nil { - x.Required, ok = compiler.BoolForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string in = 2; - v2 := compiler.MapValueForKey(m, "in") - if v2 != nil { - x.In, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [path] - if ok && !compiler.StringArrayContainsValue([]string{"path"}, x.In) { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 3; - v3 := compiler.MapValueForKey(m, "description") - if v3 != nil { - x.Description, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string name = 4; - v4 := compiler.MapValueForKey(m, "name") - if v4 != nil { - x.Name, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string type = 5; - v5 := compiler.MapValueForKey(m, "type") - if v5 != nil { - x.Type, ok = compiler.StringForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [string number boolean integer array] - if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "boolean", "integer", "array"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string format = 6; - v6 := compiler.MapValueForKey(m, "format") - if v6 != nil { - x.Format, ok = compiler.StringForScalarNode(v6) - if !ok { - message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // PrimitivesItems items = 7; - v7 := compiler.MapValueForKey(m, "items") - if v7 != nil { - var err error - x.Items, err = NewPrimitivesItems(v7, compiler.NewContext("items", v7, context)) - if err != nil { - errors = append(errors, err) - } - } - // string collection_format = 8; - v8 := compiler.MapValueForKey(m, "collectionFormat") - if v8 != nil { - x.CollectionFormat, ok = compiler.StringForScalarNode(v8) - if !ok { - message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v8)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [csv ssv tsv pipes] - if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes"}, x.CollectionFormat) { - message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v8)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Any default = 9; - v9 := compiler.MapValueForKey(m, "default") - if v9 != nil { - var err error - x.Default, err = NewAny(v9, compiler.NewContext("default", v9, context)) - if err != nil { - errors = append(errors, err) - } - } - // float maximum = 10; - v10 := compiler.MapValueForKey(m, "maximum") - if v10 != nil { - v, ok := compiler.FloatForScalarNode(v10) - if ok { - x.Maximum = v - } else { - message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v10)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_maximum = 11; - v11 := compiler.MapValueForKey(m, "exclusiveMaximum") - if v11 != nil { - x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v11) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v11)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // float minimum = 12; - v12 := compiler.MapValueForKey(m, "minimum") - if v12 != nil { - v, ok := compiler.FloatForScalarNode(v12) - if ok { - x.Minimum = v - } else { - message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v12)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_minimum = 13; - v13 := compiler.MapValueForKey(m, "exclusiveMinimum") - if v13 != nil { - x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v13) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v13)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_length = 14; - v14 := compiler.MapValueForKey(m, "maxLength") - if v14 != nil { - t, ok := compiler.IntForScalarNode(v14) - if ok { - x.MaxLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v14)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_length = 15; - v15 := compiler.MapValueForKey(m, "minLength") - if v15 != nil { - t, ok := compiler.IntForScalarNode(v15) - if ok { - x.MinLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v15)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string pattern = 16; - v16 := compiler.MapValueForKey(m, "pattern") - if v16 != nil { - x.Pattern, ok = compiler.StringForScalarNode(v16) - if !ok { - message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v16)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_items = 17; - v17 := compiler.MapValueForKey(m, "maxItems") - if v17 != nil { - t, ok := compiler.IntForScalarNode(v17) - if ok { - x.MaxItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v17)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_items = 18; - v18 := compiler.MapValueForKey(m, "minItems") - if v18 != nil { - t, ok := compiler.IntForScalarNode(v18) - if ok { - x.MinItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v18)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool unique_items = 19; - v19 := compiler.MapValueForKey(m, "uniqueItems") - if v19 != nil { - x.UniqueItems, ok = compiler.BoolForScalarNode(v19) - if !ok { - message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v19)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated Any enum = 20; - v20 := compiler.MapValueForKey(m, "enum") - if v20 != nil { - // repeated Any - x.Enum = make([]*Any, 0) - a, ok := compiler.SequenceNodeForNode(v20) - if ok { - for _, item := range a.Content { - y, err := NewAny(item, compiler.NewContext("enum", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Enum = append(x.Enum, y) - } - } - } - // float multiple_of = 21; - v21 := compiler.MapValueForKey(m, "multipleOf") - if v21 != nil { - v, ok := compiler.FloatForScalarNode(v21) - if ok { - x.MultipleOf = v - } else { - message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v21)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 22; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewPaths creates an object of type Paths if possible, returning an error if not. -func NewPaths(in *yaml.Node, context *compiler.Context) (*Paths, error) { - errors := make([]error, 0) - x := &Paths{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{} - allowedPatterns := []*regexp.Regexp{pattern0, pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // repeated NamedAny vendor_extension = 1; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - // repeated NamedPathItem path = 2; - // MAP: PathItem ^/ - x.Path = make([]*NamedPathItem, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "/") { - pair := &NamedPathItem{} - pair.Name = k - var err error - pair.Value, err = NewPathItem(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.Path = append(x.Path, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewPrimitivesItems creates an object of type PrimitivesItems if possible, returning an error if not. -func NewPrimitivesItems(in *yaml.Node, context *compiler.Context) (*PrimitivesItems, error) { - errors := make([]error, 0) - x := &PrimitivesItems{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"collectionFormat", "default", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "pattern", "type", "uniqueItems"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string type = 1; - v1 := compiler.MapValueForKey(m, "type") - if v1 != nil { - x.Type, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [string number integer boolean array] - if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "integer", "boolean", "array"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string format = 2; - v2 := compiler.MapValueForKey(m, "format") - if v2 != nil { - x.Format, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // PrimitivesItems items = 3; - v3 := compiler.MapValueForKey(m, "items") - if v3 != nil { - var err error - x.Items, err = NewPrimitivesItems(v3, compiler.NewContext("items", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // string collection_format = 4; - v4 := compiler.MapValueForKey(m, "collectionFormat") - if v4 != nil { - x.CollectionFormat, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [csv ssv tsv pipes] - if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes"}, x.CollectionFormat) { - message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Any default = 5; - v5 := compiler.MapValueForKey(m, "default") - if v5 != nil { - var err error - x.Default, err = NewAny(v5, compiler.NewContext("default", v5, context)) - if err != nil { - errors = append(errors, err) - } - } - // float maximum = 6; - v6 := compiler.MapValueForKey(m, "maximum") - if v6 != nil { - v, ok := compiler.FloatForScalarNode(v6) - if ok { - x.Maximum = v - } else { - message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_maximum = 7; - v7 := compiler.MapValueForKey(m, "exclusiveMaximum") - if v7 != nil { - x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v7) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v7)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // float minimum = 8; - v8 := compiler.MapValueForKey(m, "minimum") - if v8 != nil { - v, ok := compiler.FloatForScalarNode(v8) - if ok { - x.Minimum = v - } else { - message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v8)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_minimum = 9; - v9 := compiler.MapValueForKey(m, "exclusiveMinimum") - if v9 != nil { - x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v9) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v9)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_length = 10; - v10 := compiler.MapValueForKey(m, "maxLength") - if v10 != nil { - t, ok := compiler.IntForScalarNode(v10) - if ok { - x.MaxLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v10)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_length = 11; - v11 := compiler.MapValueForKey(m, "minLength") - if v11 != nil { - t, ok := compiler.IntForScalarNode(v11) - if ok { - x.MinLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v11)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string pattern = 12; - v12 := compiler.MapValueForKey(m, "pattern") - if v12 != nil { - x.Pattern, ok = compiler.StringForScalarNode(v12) - if !ok { - message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v12)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_items = 13; - v13 := compiler.MapValueForKey(m, "maxItems") - if v13 != nil { - t, ok := compiler.IntForScalarNode(v13) - if ok { - x.MaxItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v13)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_items = 14; - v14 := compiler.MapValueForKey(m, "minItems") - if v14 != nil { - t, ok := compiler.IntForScalarNode(v14) - if ok { - x.MinItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v14)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool unique_items = 15; - v15 := compiler.MapValueForKey(m, "uniqueItems") - if v15 != nil { - x.UniqueItems, ok = compiler.BoolForScalarNode(v15) - if !ok { - message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v15)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated Any enum = 16; - v16 := compiler.MapValueForKey(m, "enum") - if v16 != nil { - // repeated Any - x.Enum = make([]*Any, 0) - a, ok := compiler.SequenceNodeForNode(v16) - if ok { - for _, item := range a.Content { - y, err := NewAny(item, compiler.NewContext("enum", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Enum = append(x.Enum, y) - } - } - } - // float multiple_of = 17; - v17 := compiler.MapValueForKey(m, "multipleOf") - if v17 != nil { - v, ok := compiler.FloatForScalarNode(v17) - if ok { - x.MultipleOf = v - } else { - message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v17)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 18; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewProperties creates an object of type Properties if possible, returning an error if not. -func NewProperties(in *yaml.Node, context *compiler.Context) (*Properties, error) { - errors := make([]error, 0) - x := &Properties{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedSchema additional_properties = 1; - // MAP: Schema - x.AdditionalProperties = make([]*NamedSchema, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedSchema{} - pair.Name = k - var err error - pair.Value, err = NewSchema(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewQueryParameterSubSchema creates an object of type QueryParameterSubSchema if possible, returning an error if not. -func NewQueryParameterSubSchema(in *yaml.Node, context *compiler.Context) (*QueryParameterSubSchema, error) { - errors := make([]error, 0) - x := &QueryParameterSubSchema{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"allowEmptyValue", "collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // bool required = 1; - v1 := compiler.MapValueForKey(m, "required") - if v1 != nil { - x.Required, ok = compiler.BoolForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string in = 2; - v2 := compiler.MapValueForKey(m, "in") - if v2 != nil { - x.In, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [query] - if ok && !compiler.StringArrayContainsValue([]string{"query"}, x.In) { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 3; - v3 := compiler.MapValueForKey(m, "description") - if v3 != nil { - x.Description, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string name = 4; - v4 := compiler.MapValueForKey(m, "name") - if v4 != nil { - x.Name, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool allow_empty_value = 5; - v5 := compiler.MapValueForKey(m, "allowEmptyValue") - if v5 != nil { - x.AllowEmptyValue, ok = compiler.BoolForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for allowEmptyValue: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string type = 6; - v6 := compiler.MapValueForKey(m, "type") - if v6 != nil { - x.Type, ok = compiler.StringForScalarNode(v6) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [string number boolean integer array] - if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "boolean", "integer", "array"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string format = 7; - v7 := compiler.MapValueForKey(m, "format") - if v7 != nil { - x.Format, ok = compiler.StringForScalarNode(v7) - if !ok { - message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v7)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // PrimitivesItems items = 8; - v8 := compiler.MapValueForKey(m, "items") - if v8 != nil { - var err error - x.Items, err = NewPrimitivesItems(v8, compiler.NewContext("items", v8, context)) - if err != nil { - errors = append(errors, err) - } - } - // string collection_format = 9; - v9 := compiler.MapValueForKey(m, "collectionFormat") - if v9 != nil { - x.CollectionFormat, ok = compiler.StringForScalarNode(v9) - if !ok { - message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v9)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [csv ssv tsv pipes multi] - if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes", "multi"}, x.CollectionFormat) { - message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v9)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Any default = 10; - v10 := compiler.MapValueForKey(m, "default") - if v10 != nil { - var err error - x.Default, err = NewAny(v10, compiler.NewContext("default", v10, context)) - if err != nil { - errors = append(errors, err) - } - } - // float maximum = 11; - v11 := compiler.MapValueForKey(m, "maximum") - if v11 != nil { - v, ok := compiler.FloatForScalarNode(v11) - if ok { - x.Maximum = v - } else { - message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v11)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_maximum = 12; - v12 := compiler.MapValueForKey(m, "exclusiveMaximum") - if v12 != nil { - x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v12) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v12)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // float minimum = 13; - v13 := compiler.MapValueForKey(m, "minimum") - if v13 != nil { - v, ok := compiler.FloatForScalarNode(v13) - if ok { - x.Minimum = v - } else { - message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v13)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_minimum = 14; - v14 := compiler.MapValueForKey(m, "exclusiveMinimum") - if v14 != nil { - x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v14) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v14)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_length = 15; - v15 := compiler.MapValueForKey(m, "maxLength") - if v15 != nil { - t, ok := compiler.IntForScalarNode(v15) - if ok { - x.MaxLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v15)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_length = 16; - v16 := compiler.MapValueForKey(m, "minLength") - if v16 != nil { - t, ok := compiler.IntForScalarNode(v16) - if ok { - x.MinLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v16)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string pattern = 17; - v17 := compiler.MapValueForKey(m, "pattern") - if v17 != nil { - x.Pattern, ok = compiler.StringForScalarNode(v17) - if !ok { - message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v17)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_items = 18; - v18 := compiler.MapValueForKey(m, "maxItems") - if v18 != nil { - t, ok := compiler.IntForScalarNode(v18) - if ok { - x.MaxItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v18)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_items = 19; - v19 := compiler.MapValueForKey(m, "minItems") - if v19 != nil { - t, ok := compiler.IntForScalarNode(v19) - if ok { - x.MinItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v19)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool unique_items = 20; - v20 := compiler.MapValueForKey(m, "uniqueItems") - if v20 != nil { - x.UniqueItems, ok = compiler.BoolForScalarNode(v20) - if !ok { - message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v20)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated Any enum = 21; - v21 := compiler.MapValueForKey(m, "enum") - if v21 != nil { - // repeated Any - x.Enum = make([]*Any, 0) - a, ok := compiler.SequenceNodeForNode(v21) - if ok { - for _, item := range a.Content { - y, err := NewAny(item, compiler.NewContext("enum", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Enum = append(x.Enum, y) - } - } - } - // float multiple_of = 22; - v22 := compiler.MapValueForKey(m, "multipleOf") - if v22 != nil { - v, ok := compiler.FloatForScalarNode(v22) - if ok { - x.MultipleOf = v - } else { - message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v22)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 23; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewResponse creates an object of type Response if possible, returning an error if not. -func NewResponse(in *yaml.Node, context *compiler.Context) (*Response, error) { - errors := make([]error, 0) - x := &Response{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"description"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"description", "examples", "headers", "schema"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string description = 1; - v1 := compiler.MapValueForKey(m, "description") - if v1 != nil { - x.Description, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // SchemaItem schema = 2; - v2 := compiler.MapValueForKey(m, "schema") - if v2 != nil { - var err error - x.Schema, err = NewSchemaItem(v2, compiler.NewContext("schema", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - // Headers headers = 3; - v3 := compiler.MapValueForKey(m, "headers") - if v3 != nil { - var err error - x.Headers, err = NewHeaders(v3, compiler.NewContext("headers", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // Examples examples = 4; - v4 := compiler.MapValueForKey(m, "examples") - if v4 != nil { - var err error - x.Examples, err = NewExamples(v4, compiler.NewContext("examples", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny vendor_extension = 5; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewResponseDefinitions creates an object of type ResponseDefinitions if possible, returning an error if not. -func NewResponseDefinitions(in *yaml.Node, context *compiler.Context) (*ResponseDefinitions, error) { - errors := make([]error, 0) - x := &ResponseDefinitions{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedResponse additional_properties = 1; - // MAP: Response - x.AdditionalProperties = make([]*NamedResponse, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedResponse{} - pair.Name = k - var err error - pair.Value, err = NewResponse(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewResponseValue creates an object of type ResponseValue if possible, returning an error if not. -func NewResponseValue(in *yaml.Node, context *compiler.Context) (*ResponseValue, error) { - errors := make([]error, 0) - x := &ResponseValue{} - matched := false - // Response response = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewResponse(m, compiler.NewContext("response", m, context)) - if matchingError == nil { - x.Oneof = &ResponseValue_Response{Response: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // JsonReference json_reference = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewJsonReference(m, compiler.NewContext("jsonReference", m, context)) - if matchingError == nil { - x.Oneof = &ResponseValue_JsonReference{JsonReference: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid ResponseValue") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewResponses creates an object of type Responses if possible, returning an error if not. -func NewResponses(in *yaml.Node, context *compiler.Context) (*Responses, error) { - errors := make([]error, 0) - x := &Responses{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{} - allowedPatterns := []*regexp.Regexp{pattern2, pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // repeated NamedResponseValue response_code = 1; - // MAP: ResponseValue ^([0-9]{3})$|^(default)$ - x.ResponseCode = make([]*NamedResponseValue, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if pattern2.MatchString(k) { - pair := &NamedResponseValue{} - pair.Name = k - var err error - pair.Value, err = NewResponseValue(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.ResponseCode = append(x.ResponseCode, pair) - } - } - } - // repeated NamedAny vendor_extension = 2; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSchema creates an object of type Schema if possible, returning an error if not. -func NewSchema(in *yaml.Node, context *compiler.Context) (*Schema, error) { - errors := make([]error, 0) - x := &Schema{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"$ref", "additionalProperties", "allOf", "default", "description", "discriminator", "enum", "example", "exclusiveMaximum", "exclusiveMinimum", "externalDocs", "format", "items", "maxItems", "maxLength", "maxProperties", "maximum", "minItems", "minLength", "minProperties", "minimum", "multipleOf", "pattern", "properties", "readOnly", "required", "title", "type", "uniqueItems", "xml"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string _ref = 1; - v1 := compiler.MapValueForKey(m, "$ref") - if v1 != nil { - x.XRef, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for $ref: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string format = 2; - v2 := compiler.MapValueForKey(m, "format") - if v2 != nil { - x.Format, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string title = 3; - v3 := compiler.MapValueForKey(m, "title") - if v3 != nil { - x.Title, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for title: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 4; - v4 := compiler.MapValueForKey(m, "description") - if v4 != nil { - x.Description, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Any default = 5; - v5 := compiler.MapValueForKey(m, "default") - if v5 != nil { - var err error - x.Default, err = NewAny(v5, compiler.NewContext("default", v5, context)) - if err != nil { - errors = append(errors, err) - } - } - // float multiple_of = 6; - v6 := compiler.MapValueForKey(m, "multipleOf") - if v6 != nil { - v, ok := compiler.FloatForScalarNode(v6) - if ok { - x.MultipleOf = v - } else { - message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // float maximum = 7; - v7 := compiler.MapValueForKey(m, "maximum") - if v7 != nil { - v, ok := compiler.FloatForScalarNode(v7) - if ok { - x.Maximum = v - } else { - message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v7)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_maximum = 8; - v8 := compiler.MapValueForKey(m, "exclusiveMaximum") - if v8 != nil { - x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v8) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v8)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // float minimum = 9; - v9 := compiler.MapValueForKey(m, "minimum") - if v9 != nil { - v, ok := compiler.FloatForScalarNode(v9) - if ok { - x.Minimum = v - } else { - message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v9)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_minimum = 10; - v10 := compiler.MapValueForKey(m, "exclusiveMinimum") - if v10 != nil { - x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v10) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v10)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_length = 11; - v11 := compiler.MapValueForKey(m, "maxLength") - if v11 != nil { - t, ok := compiler.IntForScalarNode(v11) - if ok { - x.MaxLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v11)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_length = 12; - v12 := compiler.MapValueForKey(m, "minLength") - if v12 != nil { - t, ok := compiler.IntForScalarNode(v12) - if ok { - x.MinLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v12)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string pattern = 13; - v13 := compiler.MapValueForKey(m, "pattern") - if v13 != nil { - x.Pattern, ok = compiler.StringForScalarNode(v13) - if !ok { - message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v13)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_items = 14; - v14 := compiler.MapValueForKey(m, "maxItems") - if v14 != nil { - t, ok := compiler.IntForScalarNode(v14) - if ok { - x.MaxItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v14)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_items = 15; - v15 := compiler.MapValueForKey(m, "minItems") - if v15 != nil { - t, ok := compiler.IntForScalarNode(v15) - if ok { - x.MinItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v15)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool unique_items = 16; - v16 := compiler.MapValueForKey(m, "uniqueItems") - if v16 != nil { - x.UniqueItems, ok = compiler.BoolForScalarNode(v16) - if !ok { - message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v16)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_properties = 17; - v17 := compiler.MapValueForKey(m, "maxProperties") - if v17 != nil { - t, ok := compiler.IntForScalarNode(v17) - if ok { - x.MaxProperties = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxProperties: %s", compiler.Display(v17)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_properties = 18; - v18 := compiler.MapValueForKey(m, "minProperties") - if v18 != nil { - t, ok := compiler.IntForScalarNode(v18) - if ok { - x.MinProperties = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minProperties: %s", compiler.Display(v18)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated string required = 19; - v19 := compiler.MapValueForKey(m, "required") - if v19 != nil { - v, ok := compiler.SequenceNodeForNode(v19) - if ok { - x.Required = compiler.StringArrayForSequenceNode(v) - } else { - message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v19)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated Any enum = 20; - v20 := compiler.MapValueForKey(m, "enum") - if v20 != nil { - // repeated Any - x.Enum = make([]*Any, 0) - a, ok := compiler.SequenceNodeForNode(v20) - if ok { - for _, item := range a.Content { - y, err := NewAny(item, compiler.NewContext("enum", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Enum = append(x.Enum, y) - } - } - } - // AdditionalPropertiesItem additional_properties = 21; - v21 := compiler.MapValueForKey(m, "additionalProperties") - if v21 != nil { - var err error - x.AdditionalProperties, err = NewAdditionalPropertiesItem(v21, compiler.NewContext("additionalProperties", v21, context)) - if err != nil { - errors = append(errors, err) - } - } - // TypeItem type = 22; - v22 := compiler.MapValueForKey(m, "type") - if v22 != nil { - var err error - x.Type, err = NewTypeItem(v22, compiler.NewContext("type", v22, context)) - if err != nil { - errors = append(errors, err) - } - } - // ItemsItem items = 23; - v23 := compiler.MapValueForKey(m, "items") - if v23 != nil { - var err error - x.Items, err = NewItemsItem(v23, compiler.NewContext("items", v23, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated Schema all_of = 24; - v24 := compiler.MapValueForKey(m, "allOf") - if v24 != nil { - // repeated Schema - x.AllOf = make([]*Schema, 0) - a, ok := compiler.SequenceNodeForNode(v24) - if ok { - for _, item := range a.Content { - y, err := NewSchema(item, compiler.NewContext("allOf", item, context)) - if err != nil { - errors = append(errors, err) - } - x.AllOf = append(x.AllOf, y) - } - } - } - // Properties properties = 25; - v25 := compiler.MapValueForKey(m, "properties") - if v25 != nil { - var err error - x.Properties, err = NewProperties(v25, compiler.NewContext("properties", v25, context)) - if err != nil { - errors = append(errors, err) - } - } - // string discriminator = 26; - v26 := compiler.MapValueForKey(m, "discriminator") - if v26 != nil { - x.Discriminator, ok = compiler.StringForScalarNode(v26) - if !ok { - message := fmt.Sprintf("has unexpected value for discriminator: %s", compiler.Display(v26)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool read_only = 27; - v27 := compiler.MapValueForKey(m, "readOnly") - if v27 != nil { - x.ReadOnly, ok = compiler.BoolForScalarNode(v27) - if !ok { - message := fmt.Sprintf("has unexpected value for readOnly: %s", compiler.Display(v27)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Xml xml = 28; - v28 := compiler.MapValueForKey(m, "xml") - if v28 != nil { - var err error - x.Xml, err = NewXml(v28, compiler.NewContext("xml", v28, context)) - if err != nil { - errors = append(errors, err) - } - } - // ExternalDocs external_docs = 29; - v29 := compiler.MapValueForKey(m, "externalDocs") - if v29 != nil { - var err error - x.ExternalDocs, err = NewExternalDocs(v29, compiler.NewContext("externalDocs", v29, context)) - if err != nil { - errors = append(errors, err) - } - } - // Any example = 30; - v30 := compiler.MapValueForKey(m, "example") - if v30 != nil { - var err error - x.Example, err = NewAny(v30, compiler.NewContext("example", v30, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny vendor_extension = 31; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSchemaItem creates an object of type SchemaItem if possible, returning an error if not. -func NewSchemaItem(in *yaml.Node, context *compiler.Context) (*SchemaItem, error) { - errors := make([]error, 0) - x := &SchemaItem{} - matched := false - // Schema schema = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewSchema(m, compiler.NewContext("schema", m, context)) - if matchingError == nil { - x.Oneof = &SchemaItem_Schema{Schema: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // FileSchema file_schema = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewFileSchema(m, compiler.NewContext("fileSchema", m, context)) - if matchingError == nil { - x.Oneof = &SchemaItem_FileSchema{FileSchema: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid SchemaItem") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSecurityDefinitions creates an object of type SecurityDefinitions if possible, returning an error if not. -func NewSecurityDefinitions(in *yaml.Node, context *compiler.Context) (*SecurityDefinitions, error) { - errors := make([]error, 0) - x := &SecurityDefinitions{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedSecurityDefinitionsItem additional_properties = 1; - // MAP: SecurityDefinitionsItem - x.AdditionalProperties = make([]*NamedSecurityDefinitionsItem, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedSecurityDefinitionsItem{} - pair.Name = k - var err error - pair.Value, err = NewSecurityDefinitionsItem(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSecurityDefinitionsItem creates an object of type SecurityDefinitionsItem if possible, returning an error if not. -func NewSecurityDefinitionsItem(in *yaml.Node, context *compiler.Context) (*SecurityDefinitionsItem, error) { - errors := make([]error, 0) - x := &SecurityDefinitionsItem{} - matched := false - // BasicAuthenticationSecurity basic_authentication_security = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewBasicAuthenticationSecurity(m, compiler.NewContext("basicAuthenticationSecurity", m, context)) - if matchingError == nil { - x.Oneof = &SecurityDefinitionsItem_BasicAuthenticationSecurity{BasicAuthenticationSecurity: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // ApiKeySecurity api_key_security = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewApiKeySecurity(m, compiler.NewContext("apiKeySecurity", m, context)) - if matchingError == nil { - x.Oneof = &SecurityDefinitionsItem_ApiKeySecurity{ApiKeySecurity: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Oauth2ImplicitSecurity oauth2_implicit_security = 3; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewOauth2ImplicitSecurity(m, compiler.NewContext("oauth2ImplicitSecurity", m, context)) - if matchingError == nil { - x.Oneof = &SecurityDefinitionsItem_Oauth2ImplicitSecurity{Oauth2ImplicitSecurity: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Oauth2PasswordSecurity oauth2_password_security = 4; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewOauth2PasswordSecurity(m, compiler.NewContext("oauth2PasswordSecurity", m, context)) - if matchingError == nil { - x.Oneof = &SecurityDefinitionsItem_Oauth2PasswordSecurity{Oauth2PasswordSecurity: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Oauth2ApplicationSecurity oauth2_application_security = 5; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewOauth2ApplicationSecurity(m, compiler.NewContext("oauth2ApplicationSecurity", m, context)) - if matchingError == nil { - x.Oneof = &SecurityDefinitionsItem_Oauth2ApplicationSecurity{Oauth2ApplicationSecurity: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Oauth2AccessCodeSecurity oauth2_access_code_security = 6; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewOauth2AccessCodeSecurity(m, compiler.NewContext("oauth2AccessCodeSecurity", m, context)) - if matchingError == nil { - x.Oneof = &SecurityDefinitionsItem_Oauth2AccessCodeSecurity{Oauth2AccessCodeSecurity: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid SecurityDefinitionsItem") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSecurityRequirement creates an object of type SecurityRequirement if possible, returning an error if not. -func NewSecurityRequirement(in *yaml.Node, context *compiler.Context) (*SecurityRequirement, error) { - errors := make([]error, 0) - x := &SecurityRequirement{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedStringArray additional_properties = 1; - // MAP: StringArray - x.AdditionalProperties = make([]*NamedStringArray, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedStringArray{} - pair.Name = k - var err error - pair.Value, err = NewStringArray(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewStringArray creates an object of type StringArray if possible, returning an error if not. -func NewStringArray(in *yaml.Node, context *compiler.Context) (*StringArray, error) { - errors := make([]error, 0) - x := &StringArray{} - x.Value = make([]string, 0) - for _, node := range in.Content { - s, _ := compiler.StringForScalarNode(node) - x.Value = append(x.Value, s) - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewTag creates an object of type Tag if possible, returning an error if not. -func NewTag(in *yaml.Node, context *compiler.Context) (*Tag, error) { - errors := make([]error, 0) - x := &Tag{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"name"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"description", "externalDocs", "name"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 2; - v2 := compiler.MapValueForKey(m, "description") - if v2 != nil { - x.Description, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // ExternalDocs external_docs = 3; - v3 := compiler.MapValueForKey(m, "externalDocs") - if v3 != nil { - var err error - x.ExternalDocs, err = NewExternalDocs(v3, compiler.NewContext("externalDocs", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny vendor_extension = 4; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewTypeItem creates an object of type TypeItem if possible, returning an error if not. -func NewTypeItem(in *yaml.Node, context *compiler.Context) (*TypeItem, error) { - errors := make([]error, 0) - x := &TypeItem{} - v1 := in - switch v1.Kind { - case yaml.ScalarNode: - x.Value = make([]string, 0) - x.Value = append(x.Value, v1.Value) - case yaml.SequenceNode: - x.Value = make([]string, 0) - for _, v := range v1.Content { - value := v.Value - ok := v.Kind == yaml.ScalarNode - if ok { - x.Value = append(x.Value, value) - } else { - message := fmt.Sprintf("has unexpected value for string array element: %+v (%T)", value, value) - errors = append(errors, compiler.NewError(context, message)) - } - } - default: - message := fmt.Sprintf("has unexpected value for string array: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewVendorExtension creates an object of type VendorExtension if possible, returning an error if not. -func NewVendorExtension(in *yaml.Node, context *compiler.Context) (*VendorExtension, error) { - errors := make([]error, 0) - x := &VendorExtension{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedAny additional_properties = 1; - // MAP: Any - x.AdditionalProperties = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewXml creates an object of type Xml if possible, returning an error if not. -func NewXml(in *yaml.Node, context *compiler.Context) (*Xml, error) { - errors := make([]error, 0) - x := &Xml{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"attribute", "name", "namespace", "prefix", "wrapped"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string namespace = 2; - v2 := compiler.MapValueForKey(m, "namespace") - if v2 != nil { - x.Namespace, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for namespace: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string prefix = 3; - v3 := compiler.MapValueForKey(m, "prefix") - if v3 != nil { - x.Prefix, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for prefix: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool attribute = 4; - v4 := compiler.MapValueForKey(m, "attribute") - if v4 != nil { - x.Attribute, ok = compiler.BoolForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for attribute: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool wrapped = 5; - v5 := compiler.MapValueForKey(m, "wrapped") - if v5 != nil { - x.Wrapped, ok = compiler.BoolForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for wrapped: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 6; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside AdditionalPropertiesItem objects. -func (m *AdditionalPropertiesItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*AdditionalPropertiesItem_Schema) - if ok { - _, err := p.Schema.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Any objects. -func (m *Any) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ApiKeySecurity objects. -func (m *ApiKeySecurity) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside BasicAuthenticationSecurity objects. -func (m *BasicAuthenticationSecurity) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside BodyParameter objects. -func (m *BodyParameter) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Schema != nil { - _, err := m.Schema.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Contact objects. -func (m *Contact) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Default objects. -func (m *Default) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Definitions objects. -func (m *Definitions) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Document objects. -func (m *Document) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Info != nil { - _, err := m.Info.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Paths != nil { - _, err := m.Paths.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Definitions != nil { - _, err := m.Definitions.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Parameters != nil { - _, err := m.Parameters.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Responses != nil { - _, err := m.Responses.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Security { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - if m.SecurityDefinitions != nil { - _, err := m.SecurityDefinitions.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Tags { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - if m.ExternalDocs != nil { - _, err := m.ExternalDocs.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Examples objects. -func (m *Examples) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ExternalDocs objects. -func (m *ExternalDocs) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside FileSchema objects. -func (m *FileSchema) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Default != nil { - _, err := m.Default.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.ExternalDocs != nil { - _, err := m.ExternalDocs.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Example != nil { - _, err := m.Example.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside FormDataParameterSubSchema objects. -func (m *FormDataParameterSubSchema) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Items != nil { - _, err := m.Items.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Default != nil { - _, err := m.Default.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Enum { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Header objects. -func (m *Header) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Items != nil { - _, err := m.Items.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Default != nil { - _, err := m.Default.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Enum { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside HeaderParameterSubSchema objects. -func (m *HeaderParameterSubSchema) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Items != nil { - _, err := m.Items.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Default != nil { - _, err := m.Default.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Enum { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Headers objects. -func (m *Headers) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Info objects. -func (m *Info) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Contact != nil { - _, err := m.Contact.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.License != nil { - _, err := m.License.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ItemsItem objects. -func (m *ItemsItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.Schema { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside JsonReference objects. -func (m *JsonReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.XRef != "" { - info, err := compiler.ReadInfoForRef(root, m.XRef) - if err != nil { - return nil, err - } - if info != nil { - replacement, err := NewJsonReference(info, nil) - if err == nil { - *m = *replacement - return m.ResolveReferences(root) - } - } - return info, nil - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside License objects. -func (m *License) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedAny objects. -func (m *NamedAny) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedHeader objects. -func (m *NamedHeader) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedParameter objects. -func (m *NamedParameter) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedPathItem objects. -func (m *NamedPathItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedResponse objects. -func (m *NamedResponse) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedResponseValue objects. -func (m *NamedResponseValue) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedSchema objects. -func (m *NamedSchema) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedSecurityDefinitionsItem objects. -func (m *NamedSecurityDefinitionsItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedString objects. -func (m *NamedString) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedStringArray objects. -func (m *NamedStringArray) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NonBodyParameter objects. -func (m *NonBodyParameter) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*NonBodyParameter_HeaderParameterSubSchema) - if ok { - _, err := p.HeaderParameterSubSchema.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*NonBodyParameter_FormDataParameterSubSchema) - if ok { - _, err := p.FormDataParameterSubSchema.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*NonBodyParameter_QueryParameterSubSchema) - if ok { - _, err := p.QueryParameterSubSchema.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*NonBodyParameter_PathParameterSubSchema) - if ok { - _, err := p.PathParameterSubSchema.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Oauth2AccessCodeSecurity objects. -func (m *Oauth2AccessCodeSecurity) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Scopes != nil { - _, err := m.Scopes.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Oauth2ApplicationSecurity objects. -func (m *Oauth2ApplicationSecurity) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Scopes != nil { - _, err := m.Scopes.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Oauth2ImplicitSecurity objects. -func (m *Oauth2ImplicitSecurity) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Scopes != nil { - _, err := m.Scopes.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Oauth2PasswordSecurity objects. -func (m *Oauth2PasswordSecurity) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Scopes != nil { - _, err := m.Scopes.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Oauth2Scopes objects. -func (m *Oauth2Scopes) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Operation objects. -func (m *Operation) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.ExternalDocs != nil { - _, err := m.ExternalDocs.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Parameters { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - if m.Responses != nil { - _, err := m.Responses.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Security { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Parameter objects. -func (m *Parameter) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*Parameter_BodyParameter) - if ok { - _, err := p.BodyParameter.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*Parameter_NonBodyParameter) - if ok { - _, err := p.NonBodyParameter.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ParameterDefinitions objects. -func (m *ParameterDefinitions) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ParametersItem objects. -func (m *ParametersItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*ParametersItem_Parameter) - if ok { - _, err := p.Parameter.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*ParametersItem_JsonReference) - if ok { - info, err := p.JsonReference.ResolveReferences(root) - if err != nil { - return nil, err - } else if info != nil { - n, err := NewParametersItem(info, nil) - if err != nil { - return nil, err - } else if n != nil { - *m = *n - return nil, nil - } - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside PathItem objects. -func (m *PathItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.XRef != "" { - info, err := compiler.ReadInfoForRef(root, m.XRef) - if err != nil { - return nil, err - } - if info != nil { - replacement, err := NewPathItem(info, nil) - if err == nil { - *m = *replacement - return m.ResolveReferences(root) - } - } - return info, nil - } - if m.Get != nil { - _, err := m.Get.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Put != nil { - _, err := m.Put.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Post != nil { - _, err := m.Post.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Delete != nil { - _, err := m.Delete.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Options != nil { - _, err := m.Options.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Head != nil { - _, err := m.Head.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Patch != nil { - _, err := m.Patch.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Parameters { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside PathParameterSubSchema objects. -func (m *PathParameterSubSchema) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Items != nil { - _, err := m.Items.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Default != nil { - _, err := m.Default.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Enum { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Paths objects. -func (m *Paths) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.Path { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside PrimitivesItems objects. -func (m *PrimitivesItems) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Items != nil { - _, err := m.Items.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Default != nil { - _, err := m.Default.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Enum { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Properties objects. -func (m *Properties) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside QueryParameterSubSchema objects. -func (m *QueryParameterSubSchema) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Items != nil { - _, err := m.Items.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Default != nil { - _, err := m.Default.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Enum { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Response objects. -func (m *Response) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Schema != nil { - _, err := m.Schema.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Headers != nil { - _, err := m.Headers.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Examples != nil { - _, err := m.Examples.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ResponseDefinitions objects. -func (m *ResponseDefinitions) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ResponseValue objects. -func (m *ResponseValue) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*ResponseValue_Response) - if ok { - _, err := p.Response.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*ResponseValue_JsonReference) - if ok { - info, err := p.JsonReference.ResolveReferences(root) - if err != nil { - return nil, err - } else if info != nil { - n, err := NewResponseValue(info, nil) - if err != nil { - return nil, err - } else if n != nil { - *m = *n - return nil, nil - } - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Responses objects. -func (m *Responses) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.ResponseCode { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Schema objects. -func (m *Schema) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.XRef != "" { - info, err := compiler.ReadInfoForRef(root, m.XRef) - if err != nil { - return nil, err - } - if info != nil { - replacement, err := NewSchema(info, nil) - if err == nil { - *m = *replacement - return m.ResolveReferences(root) - } - } - return info, nil - } - if m.Default != nil { - _, err := m.Default.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Enum { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - if m.AdditionalProperties != nil { - _, err := m.AdditionalProperties.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Type != nil { - _, err := m.Type.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Items != nil { - _, err := m.Items.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.AllOf { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - if m.Properties != nil { - _, err := m.Properties.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Xml != nil { - _, err := m.Xml.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.ExternalDocs != nil { - _, err := m.ExternalDocs.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Example != nil { - _, err := m.Example.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside SchemaItem objects. -func (m *SchemaItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*SchemaItem_Schema) - if ok { - _, err := p.Schema.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*SchemaItem_FileSchema) - if ok { - _, err := p.FileSchema.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside SecurityDefinitions objects. -func (m *SecurityDefinitions) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside SecurityDefinitionsItem objects. -func (m *SecurityDefinitionsItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*SecurityDefinitionsItem_BasicAuthenticationSecurity) - if ok { - _, err := p.BasicAuthenticationSecurity.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*SecurityDefinitionsItem_ApiKeySecurity) - if ok { - _, err := p.ApiKeySecurity.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2ImplicitSecurity) - if ok { - _, err := p.Oauth2ImplicitSecurity.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2PasswordSecurity) - if ok { - _, err := p.Oauth2PasswordSecurity.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2ApplicationSecurity) - if ok { - _, err := p.Oauth2ApplicationSecurity.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2AccessCodeSecurity) - if ok { - _, err := p.Oauth2AccessCodeSecurity.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside SecurityRequirement objects. -func (m *SecurityRequirement) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside StringArray objects. -func (m *StringArray) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Tag objects. -func (m *Tag) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.ExternalDocs != nil { - _, err := m.ExternalDocs.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside TypeItem objects. -func (m *TypeItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside VendorExtension objects. -func (m *VendorExtension) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Xml objects. -func (m *Xml) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ToRawInfo returns a description of AdditionalPropertiesItem suitable for JSON or YAML export. -func (m *AdditionalPropertiesItem) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // AdditionalPropertiesItem - // {Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetSchema() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:boolean Type:bool StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - if v1, ok := m.GetOneof().(*AdditionalPropertiesItem_Boolean); ok { - return compiler.NewScalarNodeForBool(v1.Boolean) - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of Any suitable for JSON or YAML export. -func (m *Any) ToRawInfo() *yaml.Node { - var err error - var node yaml.Node - err = yaml.Unmarshal([]byte(m.Yaml), &node) - if err == nil { - if node.Kind == yaml.DocumentNode { - return node.Content[0] - } - return &node - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of ApiKeySecurity suitable for JSON or YAML export. -func (m *ApiKeySecurity) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("in")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of BasicAuthenticationSecurity suitable for JSON or YAML export. -func (m *BasicAuthenticationSecurity) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of BodyParameter suitable for JSON or YAML export. -func (m *BodyParameter) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("in")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In)) - if m.Required != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required)) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("schema")) - info.Content = append(info.Content, m.Schema.ToRawInfo()) - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Contact suitable for JSON or YAML export. -func (m *Contact) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.Url != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("url")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url)) - } - if m.Email != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("email")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Email)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Default suitable for JSON or YAML export. -func (m *Default) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Definitions suitable for JSON or YAML export. -func (m *Definitions) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Document suitable for JSON or YAML export. -func (m *Document) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("swagger")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Swagger)) - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("info")) - info.Content = append(info.Content, m.Info.ToRawInfo()) - if m.Host != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("host")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Host)) - } - if m.BasePath != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("basePath")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.BasePath)) - } - if len(m.Schemes) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("schemes")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Schemes)) - } - if len(m.Consumes) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("consumes")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Consumes)) - } - if len(m.Produces) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("produces")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Produces)) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("paths")) - info.Content = append(info.Content, m.Paths.ToRawInfo()) - if m.Definitions != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("definitions")) - info.Content = append(info.Content, m.Definitions.ToRawInfo()) - } - if m.Parameters != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters")) - info.Content = append(info.Content, m.Parameters.ToRawInfo()) - } - if m.Responses != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("responses")) - info.Content = append(info.Content, m.Responses.ToRawInfo()) - } - if len(m.Security) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Security { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("security")) - info.Content = append(info.Content, items) - } - if m.SecurityDefinitions != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("securityDefinitions")) - info.Content = append(info.Content, m.SecurityDefinitions.ToRawInfo()) - } - if len(m.Tags) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Tags { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("tags")) - info.Content = append(info.Content, items) - } - if m.ExternalDocs != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs")) - info.Content = append(info.Content, m.ExternalDocs.ToRawInfo()) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Examples suitable for JSON or YAML export. -func (m *Examples) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ExternalDocs suitable for JSON or YAML export. -func (m *ExternalDocs) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("url")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url)) - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of FileSchema suitable for JSON or YAML export. -func (m *FileSchema) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Format != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) - } - if m.Title != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("title")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Title)) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Default != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) - info.Content = append(info.Content, m.Default.ToRawInfo()) - } - if len(m.Required) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Required)) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - if m.ReadOnly != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("readOnly")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ReadOnly)) - } - if m.ExternalDocs != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs")) - info.Content = append(info.Content, m.ExternalDocs.ToRawInfo()) - } - if m.Example != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("example")) - info.Content = append(info.Content, m.Example.ToRawInfo()) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of FormDataParameterSubSchema suitable for JSON or YAML export. -func (m *FormDataParameterSubSchema) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Required != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required)) - } - if m.In != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("in")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In)) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.AllowEmptyValue != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("allowEmptyValue")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowEmptyValue)) - } - if m.Type != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - } - if m.Format != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) - } - if m.Items != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("items")) - info.Content = append(info.Content, m.Items.ToRawInfo()) - } - if m.CollectionFormat != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat)) - } - if m.Default != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) - info.Content = append(info.Content, m.Default.ToRawInfo()) - } - if m.Maximum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum)) - } - if m.ExclusiveMaximum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum)) - } - if m.Minimum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum)) - } - if m.ExclusiveMinimum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum)) - } - if m.MaxLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength)) - } - if m.MinLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength)) - } - if m.Pattern != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern)) - } - if m.MaxItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems)) - } - if m.MinItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems)) - } - if m.UniqueItems != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems)) - } - if len(m.Enum) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Enum { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) - info.Content = append(info.Content, items) - } - if m.MultipleOf != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Header suitable for JSON or YAML export. -func (m *Header) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - if m.Format != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) - } - if m.Items != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("items")) - info.Content = append(info.Content, m.Items.ToRawInfo()) - } - if m.CollectionFormat != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat)) - } - if m.Default != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) - info.Content = append(info.Content, m.Default.ToRawInfo()) - } - if m.Maximum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum)) - } - if m.ExclusiveMaximum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum)) - } - if m.Minimum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum)) - } - if m.ExclusiveMinimum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum)) - } - if m.MaxLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength)) - } - if m.MinLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength)) - } - if m.Pattern != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern)) - } - if m.MaxItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems)) - } - if m.MinItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems)) - } - if m.UniqueItems != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems)) - } - if len(m.Enum) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Enum { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) - info.Content = append(info.Content, items) - } - if m.MultipleOf != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf)) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of HeaderParameterSubSchema suitable for JSON or YAML export. -func (m *HeaderParameterSubSchema) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Required != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required)) - } - if m.In != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("in")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In)) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.Type != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - } - if m.Format != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) - } - if m.Items != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("items")) - info.Content = append(info.Content, m.Items.ToRawInfo()) - } - if m.CollectionFormat != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat)) - } - if m.Default != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) - info.Content = append(info.Content, m.Default.ToRawInfo()) - } - if m.Maximum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum)) - } - if m.ExclusiveMaximum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum)) - } - if m.Minimum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum)) - } - if m.ExclusiveMinimum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum)) - } - if m.MaxLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength)) - } - if m.MinLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength)) - } - if m.Pattern != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern)) - } - if m.MaxItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems)) - } - if m.MinItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems)) - } - if m.UniqueItems != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems)) - } - if len(m.Enum) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Enum { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) - info.Content = append(info.Content, items) - } - if m.MultipleOf != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Headers suitable for JSON or YAML export. -func (m *Headers) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Info suitable for JSON or YAML export. -func (m *Info) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("title")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Title)) - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("version")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Version)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.TermsOfService != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("termsOfService")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TermsOfService)) - } - if m.Contact != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("contact")) - info.Content = append(info.Content, m.Contact.ToRawInfo()) - } - if m.License != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("license")) - info.Content = append(info.Content, m.License.ToRawInfo()) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ItemsItem suitable for JSON or YAML export. -func (m *ItemsItem) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if len(m.Schema) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Schema { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("schema")) - info.Content = append(info.Content, items) - } - return info -} - -// ToRawInfo returns a description of JsonReference suitable for JSON or YAML export. -func (m *JsonReference) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("$ref")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.XRef)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - return info -} - -// ToRawInfo returns a description of License suitable for JSON or YAML export. -func (m *License) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - if m.Url != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("url")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of NamedAny suitable for JSON or YAML export. -func (m *NamedAny) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.Value != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("value")) - info.Content = append(info.Content, m.Value.ToRawInfo()) - } - return info -} - -// ToRawInfo returns a description of NamedHeader suitable for JSON or YAML export. -func (m *NamedHeader) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:Header StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedParameter suitable for JSON or YAML export. -func (m *NamedParameter) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:Parameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedPathItem suitable for JSON or YAML export. -func (m *NamedPathItem) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:PathItem StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedResponse suitable for JSON or YAML export. -func (m *NamedResponse) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:Response StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedResponseValue suitable for JSON or YAML export. -func (m *NamedResponseValue) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:ResponseValue StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedSchema suitable for JSON or YAML export. -func (m *NamedSchema) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedSecurityDefinitionsItem suitable for JSON or YAML export. -func (m *NamedSecurityDefinitionsItem) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:SecurityDefinitionsItem StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedString suitable for JSON or YAML export. -func (m *NamedString) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.Value != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("value")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Value)) - } - return info -} - -// ToRawInfo returns a description of NamedStringArray suitable for JSON or YAML export. -func (m *NamedStringArray) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:StringArray StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NonBodyParameter suitable for JSON or YAML export. -func (m *NonBodyParameter) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // NonBodyParameter - // {Name:headerParameterSubSchema Type:HeaderParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetHeaderParameterSubSchema() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:formDataParameterSubSchema Type:FormDataParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetFormDataParameterSubSchema() - if v1 != nil { - return v1.ToRawInfo() - } - // {Name:queryParameterSubSchema Type:QueryParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v2 := m.GetQueryParameterSubSchema() - if v2 != nil { - return v2.ToRawInfo() - } - // {Name:pathParameterSubSchema Type:PathParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v3 := m.GetPathParameterSubSchema() - if v3 != nil { - return v3.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of Oauth2AccessCodeSecurity suitable for JSON or YAML export. -func (m *Oauth2AccessCodeSecurity) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("flow")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Flow)) - if m.Scopes != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("scopes")) - info.Content = append(info.Content, m.Scopes.ToRawInfo()) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("authorizationUrl")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.AuthorizationUrl)) - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("tokenUrl")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TokenUrl)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Oauth2ApplicationSecurity suitable for JSON or YAML export. -func (m *Oauth2ApplicationSecurity) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("flow")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Flow)) - if m.Scopes != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("scopes")) - info.Content = append(info.Content, m.Scopes.ToRawInfo()) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("tokenUrl")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TokenUrl)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Oauth2ImplicitSecurity suitable for JSON or YAML export. -func (m *Oauth2ImplicitSecurity) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("flow")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Flow)) - if m.Scopes != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("scopes")) - info.Content = append(info.Content, m.Scopes.ToRawInfo()) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("authorizationUrl")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.AuthorizationUrl)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Oauth2PasswordSecurity suitable for JSON or YAML export. -func (m *Oauth2PasswordSecurity) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("flow")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Flow)) - if m.Scopes != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("scopes")) - info.Content = append(info.Content, m.Scopes.ToRawInfo()) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("tokenUrl")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TokenUrl)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Oauth2Scopes suitable for JSON or YAML export. -func (m *Oauth2Scopes) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // &{Name:additionalProperties Type:NamedString StringEnumValues:[] MapType:string Repeated:true Pattern: Implicit:true Description:} - return info -} - -// ToRawInfo returns a description of Operation suitable for JSON or YAML export. -func (m *Operation) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if len(m.Tags) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("tags")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Tags)) - } - if m.Summary != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("summary")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Summary)) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.ExternalDocs != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs")) - info.Content = append(info.Content, m.ExternalDocs.ToRawInfo()) - } - if m.OperationId != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("operationId")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.OperationId)) - } - if len(m.Produces) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("produces")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Produces)) - } - if len(m.Consumes) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("consumes")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Consumes)) - } - if len(m.Parameters) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Parameters { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters")) - info.Content = append(info.Content, items) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("responses")) - info.Content = append(info.Content, m.Responses.ToRawInfo()) - if len(m.Schemes) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("schemes")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Schemes)) - } - if m.Deprecated != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("deprecated")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Deprecated)) - } - if len(m.Security) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Security { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("security")) - info.Content = append(info.Content, items) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Parameter suitable for JSON or YAML export. -func (m *Parameter) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // Parameter - // {Name:bodyParameter Type:BodyParameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetBodyParameter() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:nonBodyParameter Type:NonBodyParameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetNonBodyParameter() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of ParameterDefinitions suitable for JSON or YAML export. -func (m *ParameterDefinitions) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ParametersItem suitable for JSON or YAML export. -func (m *ParametersItem) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // ParametersItem - // {Name:parameter Type:Parameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetParameter() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:jsonReference Type:JsonReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetJsonReference() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of PathItem suitable for JSON or YAML export. -func (m *PathItem) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.XRef != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("$ref")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.XRef)) - } - if m.Get != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("get")) - info.Content = append(info.Content, m.Get.ToRawInfo()) - } - if m.Put != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("put")) - info.Content = append(info.Content, m.Put.ToRawInfo()) - } - if m.Post != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("post")) - info.Content = append(info.Content, m.Post.ToRawInfo()) - } - if m.Delete != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("delete")) - info.Content = append(info.Content, m.Delete.ToRawInfo()) - } - if m.Options != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("options")) - info.Content = append(info.Content, m.Options.ToRawInfo()) - } - if m.Head != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("head")) - info.Content = append(info.Content, m.Head.ToRawInfo()) - } - if m.Patch != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("patch")) - info.Content = append(info.Content, m.Patch.ToRawInfo()) - } - if len(m.Parameters) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Parameters { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters")) - info.Content = append(info.Content, items) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of PathParameterSubSchema suitable for JSON or YAML export. -func (m *PathParameterSubSchema) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required)) - if m.In != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("in")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In)) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.Type != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - } - if m.Format != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) - } - if m.Items != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("items")) - info.Content = append(info.Content, m.Items.ToRawInfo()) - } - if m.CollectionFormat != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat)) - } - if m.Default != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) - info.Content = append(info.Content, m.Default.ToRawInfo()) - } - if m.Maximum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum)) - } - if m.ExclusiveMaximum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum)) - } - if m.Minimum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum)) - } - if m.ExclusiveMinimum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum)) - } - if m.MaxLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength)) - } - if m.MinLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength)) - } - if m.Pattern != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern)) - } - if m.MaxItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems)) - } - if m.MinItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems)) - } - if m.UniqueItems != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems)) - } - if len(m.Enum) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Enum { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) - info.Content = append(info.Content, items) - } - if m.MultipleOf != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Paths suitable for JSON or YAML export. -func (m *Paths) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - if m.Path != nil { - for _, item := range m.Path { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of PrimitivesItems suitable for JSON or YAML export. -func (m *PrimitivesItems) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Type != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - } - if m.Format != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) - } - if m.Items != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("items")) - info.Content = append(info.Content, m.Items.ToRawInfo()) - } - if m.CollectionFormat != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat)) - } - if m.Default != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) - info.Content = append(info.Content, m.Default.ToRawInfo()) - } - if m.Maximum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum)) - } - if m.ExclusiveMaximum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum)) - } - if m.Minimum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum)) - } - if m.ExclusiveMinimum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum)) - } - if m.MaxLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength)) - } - if m.MinLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength)) - } - if m.Pattern != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern)) - } - if m.MaxItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems)) - } - if m.MinItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems)) - } - if m.UniqueItems != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems)) - } - if len(m.Enum) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Enum { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) - info.Content = append(info.Content, items) - } - if m.MultipleOf != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Properties suitable for JSON or YAML export. -func (m *Properties) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of QueryParameterSubSchema suitable for JSON or YAML export. -func (m *QueryParameterSubSchema) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Required != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required)) - } - if m.In != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("in")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In)) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.AllowEmptyValue != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("allowEmptyValue")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowEmptyValue)) - } - if m.Type != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - } - if m.Format != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) - } - if m.Items != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("items")) - info.Content = append(info.Content, m.Items.ToRawInfo()) - } - if m.CollectionFormat != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat)) - } - if m.Default != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) - info.Content = append(info.Content, m.Default.ToRawInfo()) - } - if m.Maximum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum)) - } - if m.ExclusiveMaximum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum)) - } - if m.Minimum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum)) - } - if m.ExclusiveMinimum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum)) - } - if m.MaxLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength)) - } - if m.MinLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength)) - } - if m.Pattern != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern)) - } - if m.MaxItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems)) - } - if m.MinItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems)) - } - if m.UniqueItems != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems)) - } - if len(m.Enum) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Enum { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) - info.Content = append(info.Content, items) - } - if m.MultipleOf != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Response suitable for JSON or YAML export. -func (m *Response) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - if m.Schema != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("schema")) - info.Content = append(info.Content, m.Schema.ToRawInfo()) - } - if m.Headers != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("headers")) - info.Content = append(info.Content, m.Headers.ToRawInfo()) - } - if m.Examples != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("examples")) - info.Content = append(info.Content, m.Examples.ToRawInfo()) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ResponseDefinitions suitable for JSON or YAML export. -func (m *ResponseDefinitions) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ResponseValue suitable for JSON or YAML export. -func (m *ResponseValue) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // ResponseValue - // {Name:response Type:Response StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetResponse() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:jsonReference Type:JsonReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetJsonReference() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of Responses suitable for JSON or YAML export. -func (m *Responses) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.ResponseCode != nil { - for _, item := range m.ResponseCode { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Schema suitable for JSON or YAML export. -func (m *Schema) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.XRef != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("$ref")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.XRef)) - } - if m.Format != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) - } - if m.Title != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("title")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Title)) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Default != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) - info.Content = append(info.Content, m.Default.ToRawInfo()) - } - if m.MultipleOf != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf)) - } - if m.Maximum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum)) - } - if m.ExclusiveMaximum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum)) - } - if m.Minimum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum)) - } - if m.ExclusiveMinimum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum)) - } - if m.MaxLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength)) - } - if m.MinLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength)) - } - if m.Pattern != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern)) - } - if m.MaxItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems)) - } - if m.MinItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems)) - } - if m.UniqueItems != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems)) - } - if m.MaxProperties != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxProperties")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxProperties)) - } - if m.MinProperties != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minProperties")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinProperties)) - } - if len(m.Required) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Required)) - } - if len(m.Enum) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Enum { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) - info.Content = append(info.Content, items) - } - if m.AdditionalProperties != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("additionalProperties")) - info.Content = append(info.Content, m.AdditionalProperties.ToRawInfo()) - } - if m.Type != nil { - if len(m.Type.Value) == 1 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type.Value[0])) - } else { - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Type.Value)) - } - } - if m.Items != nil { - items := compiler.NewSequenceNode() - for _, item := range m.Items.Schema { - items.Content = append(items.Content, item.ToRawInfo()) - } - if len(items.Content) == 1 { - items = items.Content[0] - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("items")) - info.Content = append(info.Content, items) - } - if len(m.AllOf) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.AllOf { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("allOf")) - info.Content = append(info.Content, items) - } - if m.Properties != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("properties")) - info.Content = append(info.Content, m.Properties.ToRawInfo()) - } - if m.Discriminator != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("discriminator")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Discriminator)) - } - if m.ReadOnly != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("readOnly")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ReadOnly)) - } - if m.Xml != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("xml")) - info.Content = append(info.Content, m.Xml.ToRawInfo()) - } - if m.ExternalDocs != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs")) - info.Content = append(info.Content, m.ExternalDocs.ToRawInfo()) - } - if m.Example != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("example")) - info.Content = append(info.Content, m.Example.ToRawInfo()) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of SchemaItem suitable for JSON or YAML export. -func (m *SchemaItem) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // SchemaItem - // {Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetSchema() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:fileSchema Type:FileSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetFileSchema() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of SecurityDefinitions suitable for JSON or YAML export. -func (m *SecurityDefinitions) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of SecurityDefinitionsItem suitable for JSON or YAML export. -func (m *SecurityDefinitionsItem) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // SecurityDefinitionsItem - // {Name:basicAuthenticationSecurity Type:BasicAuthenticationSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetBasicAuthenticationSecurity() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:apiKeySecurity Type:ApiKeySecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetApiKeySecurity() - if v1 != nil { - return v1.ToRawInfo() - } - // {Name:oauth2ImplicitSecurity Type:Oauth2ImplicitSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v2 := m.GetOauth2ImplicitSecurity() - if v2 != nil { - return v2.ToRawInfo() - } - // {Name:oauth2PasswordSecurity Type:Oauth2PasswordSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v3 := m.GetOauth2PasswordSecurity() - if v3 != nil { - return v3.ToRawInfo() - } - // {Name:oauth2ApplicationSecurity Type:Oauth2ApplicationSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v4 := m.GetOauth2ApplicationSecurity() - if v4 != nil { - return v4.ToRawInfo() - } - // {Name:oauth2AccessCodeSecurity Type:Oauth2AccessCodeSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v5 := m.GetOauth2AccessCodeSecurity() - if v5 != nil { - return v5.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of SecurityRequirement suitable for JSON or YAML export. -func (m *SecurityRequirement) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of StringArray suitable for JSON or YAML export. -func (m *StringArray) ToRawInfo() *yaml.Node { - return compiler.NewSequenceNodeForStringArray(m.Value) -} - -// ToRawInfo returns a description of Tag suitable for JSON or YAML export. -func (m *Tag) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.ExternalDocs != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs")) - info.Content = append(info.Content, m.ExternalDocs.ToRawInfo()) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of TypeItem suitable for JSON or YAML export. -func (m *TypeItem) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if len(m.Value) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("value")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Value)) - } - return info -} - -// ToRawInfo returns a description of VendorExtension suitable for JSON or YAML export. -func (m *VendorExtension) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Xml suitable for JSON or YAML export. -func (m *Xml) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.Namespace != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("namespace")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Namespace)) - } - if m.Prefix != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("prefix")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Prefix)) - } - if m.Attribute != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("attribute")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Attribute)) - } - if m.Wrapped != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("wrapped")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Wrapped)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -var ( - pattern0 = regexp.MustCompile("^x-") - pattern1 = regexp.MustCompile("^/") - pattern2 = regexp.MustCompile("^([0-9]{3})$|^(default)$") -) diff --git a/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.pb.go b/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.pb.go deleted file mode 100644 index 65c4c913c..000000000 --- a/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.pb.go +++ /dev/null @@ -1,7342 +0,0 @@ -// Copyright 2020 Google LLC. All Rights Reserved. -// -// 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. - -// THIS FILE IS AUTOMATICALLY GENERATED. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.3 -// source: openapiv2/OpenAPIv2.proto - -package openapi_v2 - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type AdditionalPropertiesItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *AdditionalPropertiesItem_Schema - // *AdditionalPropertiesItem_Boolean - Oneof isAdditionalPropertiesItem_Oneof `protobuf_oneof:"oneof"` -} - -func (x *AdditionalPropertiesItem) Reset() { - *x = AdditionalPropertiesItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdditionalPropertiesItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdditionalPropertiesItem) ProtoMessage() {} - -func (x *AdditionalPropertiesItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdditionalPropertiesItem.ProtoReflect.Descriptor instead. -func (*AdditionalPropertiesItem) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{0} -} - -func (m *AdditionalPropertiesItem) GetOneof() isAdditionalPropertiesItem_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *AdditionalPropertiesItem) GetSchema() *Schema { - if x, ok := x.GetOneof().(*AdditionalPropertiesItem_Schema); ok { - return x.Schema - } - return nil -} - -func (x *AdditionalPropertiesItem) GetBoolean() bool { - if x, ok := x.GetOneof().(*AdditionalPropertiesItem_Boolean); ok { - return x.Boolean - } - return false -} - -type isAdditionalPropertiesItem_Oneof interface { - isAdditionalPropertiesItem_Oneof() -} - -type AdditionalPropertiesItem_Schema struct { - Schema *Schema `protobuf:"bytes,1,opt,name=schema,proto3,oneof"` -} - -type AdditionalPropertiesItem_Boolean struct { - Boolean bool `protobuf:"varint,2,opt,name=boolean,proto3,oneof"` -} - -func (*AdditionalPropertiesItem_Schema) isAdditionalPropertiesItem_Oneof() {} - -func (*AdditionalPropertiesItem_Boolean) isAdditionalPropertiesItem_Oneof() {} - -type Any struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Value *anypb.Any `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` - Yaml string `protobuf:"bytes,2,opt,name=yaml,proto3" json:"yaml,omitempty"` -} - -func (x *Any) Reset() { - *x = Any{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Any) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Any) ProtoMessage() {} - -func (x *Any) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Any.ProtoReflect.Descriptor instead. -func (*Any) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{1} -} - -func (x *Any) GetValue() *anypb.Any { - if x != nil { - return x.Value - } - return nil -} - -func (x *Any) GetYaml() string { - if x != nil { - return x.Yaml - } - return "" -} - -type ApiKeySecurity struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - In string `protobuf:"bytes,3,opt,name=in,proto3" json:"in,omitempty"` - Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,5,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *ApiKeySecurity) Reset() { - *x = ApiKeySecurity{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ApiKeySecurity) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ApiKeySecurity) ProtoMessage() {} - -func (x *ApiKeySecurity) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ApiKeySecurity.ProtoReflect.Descriptor instead. -func (*ApiKeySecurity) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{2} -} - -func (x *ApiKeySecurity) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *ApiKeySecurity) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *ApiKeySecurity) GetIn() string { - if x != nil { - return x.In - } - return "" -} - -func (x *ApiKeySecurity) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *ApiKeySecurity) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type BasicAuthenticationSecurity struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,3,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *BasicAuthenticationSecurity) Reset() { - *x = BasicAuthenticationSecurity{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BasicAuthenticationSecurity) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BasicAuthenticationSecurity) ProtoMessage() {} - -func (x *BasicAuthenticationSecurity) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BasicAuthenticationSecurity.ProtoReflect.Descriptor instead. -func (*BasicAuthenticationSecurity) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{3} -} - -func (x *BasicAuthenticationSecurity) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *BasicAuthenticationSecurity) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *BasicAuthenticationSecurity) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type BodyParameter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. - Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` - // The name of the parameter. - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - // Determines the location of the parameter. - In string `protobuf:"bytes,3,opt,name=in,proto3" json:"in,omitempty"` - // Determines whether or not this parameter is required or optional. - Required bool `protobuf:"varint,4,opt,name=required,proto3" json:"required,omitempty"` - Schema *Schema `protobuf:"bytes,5,opt,name=schema,proto3" json:"schema,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *BodyParameter) Reset() { - *x = BodyParameter{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BodyParameter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BodyParameter) ProtoMessage() {} - -func (x *BodyParameter) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BodyParameter.ProtoReflect.Descriptor instead. -func (*BodyParameter) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{4} -} - -func (x *BodyParameter) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *BodyParameter) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *BodyParameter) GetIn() string { - if x != nil { - return x.In - } - return "" -} - -func (x *BodyParameter) GetRequired() bool { - if x != nil { - return x.Required - } - return false -} - -func (x *BodyParameter) GetSchema() *Schema { - if x != nil { - return x.Schema - } - return nil -} - -func (x *BodyParameter) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -// Contact information for the owners of the API. -type Contact struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The identifying name of the contact person/organization. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The URL pointing to the contact information. - Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` - // The email address of the contact person/organization. - Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,4,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Contact) Reset() { - *x = Contact{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Contact) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Contact) ProtoMessage() {} - -func (x *Contact) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Contact.ProtoReflect.Descriptor instead. -func (*Contact) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{5} -} - -func (x *Contact) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Contact) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *Contact) GetEmail() string { - if x != nil { - return x.Email - } - return "" -} - -func (x *Contact) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type Default struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedAny `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *Default) Reset() { - *x = Default{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Default) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Default) ProtoMessage() {} - -func (x *Default) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Default.ProtoReflect.Descriptor instead. -func (*Default) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{6} -} - -func (x *Default) GetAdditionalProperties() []*NamedAny { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// One or more JSON objects describing the schemas being consumed and produced by the API. -type Definitions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedSchema `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *Definitions) Reset() { - *x = Definitions{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Definitions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Definitions) ProtoMessage() {} - -func (x *Definitions) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Definitions.ProtoReflect.Descriptor instead. -func (*Definitions) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{7} -} - -func (x *Definitions) GetAdditionalProperties() []*NamedSchema { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -type Document struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The Swagger version of this document. - Swagger string `protobuf:"bytes,1,opt,name=swagger,proto3" json:"swagger,omitempty"` - Info *Info `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` - // The host (name or ip) of the API. Example: 'swagger.io' - Host string `protobuf:"bytes,3,opt,name=host,proto3" json:"host,omitempty"` - // The base path to the API. Example: '/api'. - BasePath string `protobuf:"bytes,4,opt,name=base_path,json=basePath,proto3" json:"base_path,omitempty"` - // The transfer protocol of the API. - Schemes []string `protobuf:"bytes,5,rep,name=schemes,proto3" json:"schemes,omitempty"` - // A list of MIME types accepted by the API. - Consumes []string `protobuf:"bytes,6,rep,name=consumes,proto3" json:"consumes,omitempty"` - // A list of MIME types the API can produce. - Produces []string `protobuf:"bytes,7,rep,name=produces,proto3" json:"produces,omitempty"` - Paths *Paths `protobuf:"bytes,8,opt,name=paths,proto3" json:"paths,omitempty"` - Definitions *Definitions `protobuf:"bytes,9,opt,name=definitions,proto3" json:"definitions,omitempty"` - Parameters *ParameterDefinitions `protobuf:"bytes,10,opt,name=parameters,proto3" json:"parameters,omitempty"` - Responses *ResponseDefinitions `protobuf:"bytes,11,opt,name=responses,proto3" json:"responses,omitempty"` - Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security,proto3" json:"security,omitempty"` - SecurityDefinitions *SecurityDefinitions `protobuf:"bytes,13,opt,name=security_definitions,json=securityDefinitions,proto3" json:"security_definitions,omitempty"` - Tags []*Tag `protobuf:"bytes,14,rep,name=tags,proto3" json:"tags,omitempty"` - ExternalDocs *ExternalDocs `protobuf:"bytes,15,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,16,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Document) Reset() { - *x = Document{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Document) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Document) ProtoMessage() {} - -func (x *Document) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Document.ProtoReflect.Descriptor instead. -func (*Document) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{8} -} - -func (x *Document) GetSwagger() string { - if x != nil { - return x.Swagger - } - return "" -} - -func (x *Document) GetInfo() *Info { - if x != nil { - return x.Info - } - return nil -} - -func (x *Document) GetHost() string { - if x != nil { - return x.Host - } - return "" -} - -func (x *Document) GetBasePath() string { - if x != nil { - return x.BasePath - } - return "" -} - -func (x *Document) GetSchemes() []string { - if x != nil { - return x.Schemes - } - return nil -} - -func (x *Document) GetConsumes() []string { - if x != nil { - return x.Consumes - } - return nil -} - -func (x *Document) GetProduces() []string { - if x != nil { - return x.Produces - } - return nil -} - -func (x *Document) GetPaths() *Paths { - if x != nil { - return x.Paths - } - return nil -} - -func (x *Document) GetDefinitions() *Definitions { - if x != nil { - return x.Definitions - } - return nil -} - -func (x *Document) GetParameters() *ParameterDefinitions { - if x != nil { - return x.Parameters - } - return nil -} - -func (x *Document) GetResponses() *ResponseDefinitions { - if x != nil { - return x.Responses - } - return nil -} - -func (x *Document) GetSecurity() []*SecurityRequirement { - if x != nil { - return x.Security - } - return nil -} - -func (x *Document) GetSecurityDefinitions() *SecurityDefinitions { - if x != nil { - return x.SecurityDefinitions - } - return nil -} - -func (x *Document) GetTags() []*Tag { - if x != nil { - return x.Tags - } - return nil -} - -func (x *Document) GetExternalDocs() *ExternalDocs { - if x != nil { - return x.ExternalDocs - } - return nil -} - -func (x *Document) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type Examples struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedAny `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *Examples) Reset() { - *x = Examples{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Examples) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Examples) ProtoMessage() {} - -func (x *Examples) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Examples.ProtoReflect.Descriptor instead. -func (*Examples) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{9} -} - -func (x *Examples) GetAdditionalProperties() []*NamedAny { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// information about external documentation -type ExternalDocs struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` - Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,3,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *ExternalDocs) Reset() { - *x = ExternalDocs{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ExternalDocs) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExternalDocs) ProtoMessage() {} - -func (x *ExternalDocs) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExternalDocs.ProtoReflect.Descriptor instead. -func (*ExternalDocs) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{10} -} - -func (x *ExternalDocs) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *ExternalDocs) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *ExternalDocs) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -// A deterministic version of a JSON Schema object. -type FileSchema struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Format string `protobuf:"bytes,1,opt,name=format,proto3" json:"format,omitempty"` - Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - Default *Any `protobuf:"bytes,4,opt,name=default,proto3" json:"default,omitempty"` - Required []string `protobuf:"bytes,5,rep,name=required,proto3" json:"required,omitempty"` - Type string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty"` - ReadOnly bool `protobuf:"varint,7,opt,name=read_only,json=readOnly,proto3" json:"read_only,omitempty"` - ExternalDocs *ExternalDocs `protobuf:"bytes,8,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` - Example *Any `protobuf:"bytes,9,opt,name=example,proto3" json:"example,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,10,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *FileSchema) Reset() { - *x = FileSchema{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FileSchema) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FileSchema) ProtoMessage() {} - -func (x *FileSchema) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FileSchema.ProtoReflect.Descriptor instead. -func (*FileSchema) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{11} -} - -func (x *FileSchema) GetFormat() string { - if x != nil { - return x.Format - } - return "" -} - -func (x *FileSchema) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *FileSchema) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *FileSchema) GetDefault() *Any { - if x != nil { - return x.Default - } - return nil -} - -func (x *FileSchema) GetRequired() []string { - if x != nil { - return x.Required - } - return nil -} - -func (x *FileSchema) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *FileSchema) GetReadOnly() bool { - if x != nil { - return x.ReadOnly - } - return false -} - -func (x *FileSchema) GetExternalDocs() *ExternalDocs { - if x != nil { - return x.ExternalDocs - } - return nil -} - -func (x *FileSchema) GetExample() *Any { - if x != nil { - return x.Example - } - return nil -} - -func (x *FileSchema) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type FormDataParameterSubSchema struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Determines whether or not this parameter is required or optional. - Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"` - // Determines the location of the parameter. - In string `protobuf:"bytes,2,opt,name=in,proto3" json:"in,omitempty"` - // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - // The name of the parameter. - Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` - // allows sending a parameter by name only or with an empty value. - AllowEmptyValue bool `protobuf:"varint,5,opt,name=allow_empty_value,json=allowEmptyValue,proto3" json:"allow_empty_value,omitempty"` - Type string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty"` - Format string `protobuf:"bytes,7,opt,name=format,proto3" json:"format,omitempty"` - Items *PrimitivesItems `protobuf:"bytes,8,opt,name=items,proto3" json:"items,omitempty"` - CollectionFormat string `protobuf:"bytes,9,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"` - Default *Any `protobuf:"bytes,10,opt,name=default,proto3" json:"default,omitempty"` - Maximum float64 `protobuf:"fixed64,11,opt,name=maximum,proto3" json:"maximum,omitempty"` - ExclusiveMaximum bool `protobuf:"varint,12,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` - Minimum float64 `protobuf:"fixed64,13,opt,name=minimum,proto3" json:"minimum,omitempty"` - ExclusiveMinimum bool `protobuf:"varint,14,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` - MaxLength int64 `protobuf:"varint,15,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` - MinLength int64 `protobuf:"varint,16,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` - Pattern string `protobuf:"bytes,17,opt,name=pattern,proto3" json:"pattern,omitempty"` - MaxItems int64 `protobuf:"varint,18,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` - MinItems int64 `protobuf:"varint,19,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` - UniqueItems bool `protobuf:"varint,20,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` - Enum []*Any `protobuf:"bytes,21,rep,name=enum,proto3" json:"enum,omitempty"` - MultipleOf float64 `protobuf:"fixed64,22,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,23,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *FormDataParameterSubSchema) Reset() { - *x = FormDataParameterSubSchema{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FormDataParameterSubSchema) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FormDataParameterSubSchema) ProtoMessage() {} - -func (x *FormDataParameterSubSchema) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FormDataParameterSubSchema.ProtoReflect.Descriptor instead. -func (*FormDataParameterSubSchema) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{12} -} - -func (x *FormDataParameterSubSchema) GetRequired() bool { - if x != nil { - return x.Required - } - return false -} - -func (x *FormDataParameterSubSchema) GetIn() string { - if x != nil { - return x.In - } - return "" -} - -func (x *FormDataParameterSubSchema) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *FormDataParameterSubSchema) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *FormDataParameterSubSchema) GetAllowEmptyValue() bool { - if x != nil { - return x.AllowEmptyValue - } - return false -} - -func (x *FormDataParameterSubSchema) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *FormDataParameterSubSchema) GetFormat() string { - if x != nil { - return x.Format - } - return "" -} - -func (x *FormDataParameterSubSchema) GetItems() *PrimitivesItems { - if x != nil { - return x.Items - } - return nil -} - -func (x *FormDataParameterSubSchema) GetCollectionFormat() string { - if x != nil { - return x.CollectionFormat - } - return "" -} - -func (x *FormDataParameterSubSchema) GetDefault() *Any { - if x != nil { - return x.Default - } - return nil -} - -func (x *FormDataParameterSubSchema) GetMaximum() float64 { - if x != nil { - return x.Maximum - } - return 0 -} - -func (x *FormDataParameterSubSchema) GetExclusiveMaximum() bool { - if x != nil { - return x.ExclusiveMaximum - } - return false -} - -func (x *FormDataParameterSubSchema) GetMinimum() float64 { - if x != nil { - return x.Minimum - } - return 0 -} - -func (x *FormDataParameterSubSchema) GetExclusiveMinimum() bool { - if x != nil { - return x.ExclusiveMinimum - } - return false -} - -func (x *FormDataParameterSubSchema) GetMaxLength() int64 { - if x != nil { - return x.MaxLength - } - return 0 -} - -func (x *FormDataParameterSubSchema) GetMinLength() int64 { - if x != nil { - return x.MinLength - } - return 0 -} - -func (x *FormDataParameterSubSchema) GetPattern() string { - if x != nil { - return x.Pattern - } - return "" -} - -func (x *FormDataParameterSubSchema) GetMaxItems() int64 { - if x != nil { - return x.MaxItems - } - return 0 -} - -func (x *FormDataParameterSubSchema) GetMinItems() int64 { - if x != nil { - return x.MinItems - } - return 0 -} - -func (x *FormDataParameterSubSchema) GetUniqueItems() bool { - if x != nil { - return x.UniqueItems - } - return false -} - -func (x *FormDataParameterSubSchema) GetEnum() []*Any { - if x != nil { - return x.Enum - } - return nil -} - -func (x *FormDataParameterSubSchema) GetMultipleOf() float64 { - if x != nil { - return x.MultipleOf - } - return 0 -} - -func (x *FormDataParameterSubSchema) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type Header struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Format string `protobuf:"bytes,2,opt,name=format,proto3" json:"format,omitempty"` - Items *PrimitivesItems `protobuf:"bytes,3,opt,name=items,proto3" json:"items,omitempty"` - CollectionFormat string `protobuf:"bytes,4,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"` - Default *Any `protobuf:"bytes,5,opt,name=default,proto3" json:"default,omitempty"` - Maximum float64 `protobuf:"fixed64,6,opt,name=maximum,proto3" json:"maximum,omitempty"` - ExclusiveMaximum bool `protobuf:"varint,7,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` - Minimum float64 `protobuf:"fixed64,8,opt,name=minimum,proto3" json:"minimum,omitempty"` - ExclusiveMinimum bool `protobuf:"varint,9,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` - MaxLength int64 `protobuf:"varint,10,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` - MinLength int64 `protobuf:"varint,11,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` - Pattern string `protobuf:"bytes,12,opt,name=pattern,proto3" json:"pattern,omitempty"` - MaxItems int64 `protobuf:"varint,13,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` - MinItems int64 `protobuf:"varint,14,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` - UniqueItems bool `protobuf:"varint,15,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` - Enum []*Any `protobuf:"bytes,16,rep,name=enum,proto3" json:"enum,omitempty"` - MultipleOf float64 `protobuf:"fixed64,17,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` - Description string `protobuf:"bytes,18,opt,name=description,proto3" json:"description,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,19,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Header) Reset() { - *x = Header{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Header) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Header) ProtoMessage() {} - -func (x *Header) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Header.ProtoReflect.Descriptor instead. -func (*Header) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{13} -} - -func (x *Header) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *Header) GetFormat() string { - if x != nil { - return x.Format - } - return "" -} - -func (x *Header) GetItems() *PrimitivesItems { - if x != nil { - return x.Items - } - return nil -} - -func (x *Header) GetCollectionFormat() string { - if x != nil { - return x.CollectionFormat - } - return "" -} - -func (x *Header) GetDefault() *Any { - if x != nil { - return x.Default - } - return nil -} - -func (x *Header) GetMaximum() float64 { - if x != nil { - return x.Maximum - } - return 0 -} - -func (x *Header) GetExclusiveMaximum() bool { - if x != nil { - return x.ExclusiveMaximum - } - return false -} - -func (x *Header) GetMinimum() float64 { - if x != nil { - return x.Minimum - } - return 0 -} - -func (x *Header) GetExclusiveMinimum() bool { - if x != nil { - return x.ExclusiveMinimum - } - return false -} - -func (x *Header) GetMaxLength() int64 { - if x != nil { - return x.MaxLength - } - return 0 -} - -func (x *Header) GetMinLength() int64 { - if x != nil { - return x.MinLength - } - return 0 -} - -func (x *Header) GetPattern() string { - if x != nil { - return x.Pattern - } - return "" -} - -func (x *Header) GetMaxItems() int64 { - if x != nil { - return x.MaxItems - } - return 0 -} - -func (x *Header) GetMinItems() int64 { - if x != nil { - return x.MinItems - } - return 0 -} - -func (x *Header) GetUniqueItems() bool { - if x != nil { - return x.UniqueItems - } - return false -} - -func (x *Header) GetEnum() []*Any { - if x != nil { - return x.Enum - } - return nil -} - -func (x *Header) GetMultipleOf() float64 { - if x != nil { - return x.MultipleOf - } - return 0 -} - -func (x *Header) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Header) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type HeaderParameterSubSchema struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Determines whether or not this parameter is required or optional. - Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"` - // Determines the location of the parameter. - In string `protobuf:"bytes,2,opt,name=in,proto3" json:"in,omitempty"` - // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - // The name of the parameter. - Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` - Type string `protobuf:"bytes,5,opt,name=type,proto3" json:"type,omitempty"` - Format string `protobuf:"bytes,6,opt,name=format,proto3" json:"format,omitempty"` - Items *PrimitivesItems `protobuf:"bytes,7,opt,name=items,proto3" json:"items,omitempty"` - CollectionFormat string `protobuf:"bytes,8,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"` - Default *Any `protobuf:"bytes,9,opt,name=default,proto3" json:"default,omitempty"` - Maximum float64 `protobuf:"fixed64,10,opt,name=maximum,proto3" json:"maximum,omitempty"` - ExclusiveMaximum bool `protobuf:"varint,11,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` - Minimum float64 `protobuf:"fixed64,12,opt,name=minimum,proto3" json:"minimum,omitempty"` - ExclusiveMinimum bool `protobuf:"varint,13,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` - MaxLength int64 `protobuf:"varint,14,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` - MinLength int64 `protobuf:"varint,15,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` - Pattern string `protobuf:"bytes,16,opt,name=pattern,proto3" json:"pattern,omitempty"` - MaxItems int64 `protobuf:"varint,17,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` - MinItems int64 `protobuf:"varint,18,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` - UniqueItems bool `protobuf:"varint,19,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` - Enum []*Any `protobuf:"bytes,20,rep,name=enum,proto3" json:"enum,omitempty"` - MultipleOf float64 `protobuf:"fixed64,21,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,22,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *HeaderParameterSubSchema) Reset() { - *x = HeaderParameterSubSchema{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HeaderParameterSubSchema) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HeaderParameterSubSchema) ProtoMessage() {} - -func (x *HeaderParameterSubSchema) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HeaderParameterSubSchema.ProtoReflect.Descriptor instead. -func (*HeaderParameterSubSchema) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{14} -} - -func (x *HeaderParameterSubSchema) GetRequired() bool { - if x != nil { - return x.Required - } - return false -} - -func (x *HeaderParameterSubSchema) GetIn() string { - if x != nil { - return x.In - } - return "" -} - -func (x *HeaderParameterSubSchema) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *HeaderParameterSubSchema) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *HeaderParameterSubSchema) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *HeaderParameterSubSchema) GetFormat() string { - if x != nil { - return x.Format - } - return "" -} - -func (x *HeaderParameterSubSchema) GetItems() *PrimitivesItems { - if x != nil { - return x.Items - } - return nil -} - -func (x *HeaderParameterSubSchema) GetCollectionFormat() string { - if x != nil { - return x.CollectionFormat - } - return "" -} - -func (x *HeaderParameterSubSchema) GetDefault() *Any { - if x != nil { - return x.Default - } - return nil -} - -func (x *HeaderParameterSubSchema) GetMaximum() float64 { - if x != nil { - return x.Maximum - } - return 0 -} - -func (x *HeaderParameterSubSchema) GetExclusiveMaximum() bool { - if x != nil { - return x.ExclusiveMaximum - } - return false -} - -func (x *HeaderParameterSubSchema) GetMinimum() float64 { - if x != nil { - return x.Minimum - } - return 0 -} - -func (x *HeaderParameterSubSchema) GetExclusiveMinimum() bool { - if x != nil { - return x.ExclusiveMinimum - } - return false -} - -func (x *HeaderParameterSubSchema) GetMaxLength() int64 { - if x != nil { - return x.MaxLength - } - return 0 -} - -func (x *HeaderParameterSubSchema) GetMinLength() int64 { - if x != nil { - return x.MinLength - } - return 0 -} - -func (x *HeaderParameterSubSchema) GetPattern() string { - if x != nil { - return x.Pattern - } - return "" -} - -func (x *HeaderParameterSubSchema) GetMaxItems() int64 { - if x != nil { - return x.MaxItems - } - return 0 -} - -func (x *HeaderParameterSubSchema) GetMinItems() int64 { - if x != nil { - return x.MinItems - } - return 0 -} - -func (x *HeaderParameterSubSchema) GetUniqueItems() bool { - if x != nil { - return x.UniqueItems - } - return false -} - -func (x *HeaderParameterSubSchema) GetEnum() []*Any { - if x != nil { - return x.Enum - } - return nil -} - -func (x *HeaderParameterSubSchema) GetMultipleOf() float64 { - if x != nil { - return x.MultipleOf - } - return 0 -} - -func (x *HeaderParameterSubSchema) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type Headers struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedHeader `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *Headers) Reset() { - *x = Headers{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Headers) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Headers) ProtoMessage() {} - -func (x *Headers) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Headers.ProtoReflect.Descriptor instead. -func (*Headers) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{15} -} - -func (x *Headers) GetAdditionalProperties() []*NamedHeader { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// General information about the API. -type Info struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // A unique and precise title of the API. - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - // A semantic version number of the API. - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - // A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed. - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - // The terms of service for the API. - TermsOfService string `protobuf:"bytes,4,opt,name=terms_of_service,json=termsOfService,proto3" json:"terms_of_service,omitempty"` - Contact *Contact `protobuf:"bytes,5,opt,name=contact,proto3" json:"contact,omitempty"` - License *License `protobuf:"bytes,6,opt,name=license,proto3" json:"license,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,7,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Info) Reset() { - *x = Info{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Info) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Info) ProtoMessage() {} - -func (x *Info) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Info.ProtoReflect.Descriptor instead. -func (*Info) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{16} -} - -func (x *Info) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *Info) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *Info) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Info) GetTermsOfService() string { - if x != nil { - return x.TermsOfService - } - return "" -} - -func (x *Info) GetContact() *Contact { - if x != nil { - return x.Contact - } - return nil -} - -func (x *Info) GetLicense() *License { - if x != nil { - return x.License - } - return nil -} - -func (x *Info) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type ItemsItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Schema []*Schema `protobuf:"bytes,1,rep,name=schema,proto3" json:"schema,omitempty"` -} - -func (x *ItemsItem) Reset() { - *x = ItemsItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ItemsItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ItemsItem) ProtoMessage() {} - -func (x *ItemsItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ItemsItem.ProtoReflect.Descriptor instead. -func (*ItemsItem) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{17} -} - -func (x *ItemsItem) GetSchema() []*Schema { - if x != nil { - return x.Schema - } - return nil -} - -type JsonReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - XRef string `protobuf:"bytes,1,opt,name=_ref,json=Ref,proto3" json:"_ref,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` -} - -func (x *JsonReference) Reset() { - *x = JsonReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *JsonReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*JsonReference) ProtoMessage() {} - -func (x *JsonReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use JsonReference.ProtoReflect.Descriptor instead. -func (*JsonReference) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{18} -} - -func (x *JsonReference) GetXRef() string { - if x != nil { - return x.XRef - } - return "" -} - -func (x *JsonReference) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -type License struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of the license type. It's encouraged to use an OSI compatible license. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The URL pointing to the license. - Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,3,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *License) Reset() { - *x = License{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *License) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*License) ProtoMessage() {} - -func (x *License) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use License.ProtoReflect.Descriptor instead. -func (*License) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{19} -} - -func (x *License) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *License) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *License) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -// Automatically-generated message used to represent maps of Any as ordered (name,value) pairs. -type NamedAny struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *Any `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedAny) Reset() { - *x = NamedAny{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedAny) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedAny) ProtoMessage() {} - -func (x *NamedAny) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedAny.ProtoReflect.Descriptor instead. -func (*NamedAny) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{20} -} - -func (x *NamedAny) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedAny) GetValue() *Any { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of Header as ordered (name,value) pairs. -type NamedHeader struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *Header `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedHeader) Reset() { - *x = NamedHeader{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedHeader) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedHeader) ProtoMessage() {} - -func (x *NamedHeader) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedHeader.ProtoReflect.Descriptor instead. -func (*NamedHeader) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{21} -} - -func (x *NamedHeader) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedHeader) GetValue() *Header { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of Parameter as ordered (name,value) pairs. -type NamedParameter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *Parameter `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedParameter) Reset() { - *x = NamedParameter{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedParameter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedParameter) ProtoMessage() {} - -func (x *NamedParameter) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedParameter.ProtoReflect.Descriptor instead. -func (*NamedParameter) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{22} -} - -func (x *NamedParameter) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedParameter) GetValue() *Parameter { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of PathItem as ordered (name,value) pairs. -type NamedPathItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *PathItem `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedPathItem) Reset() { - *x = NamedPathItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedPathItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedPathItem) ProtoMessage() {} - -func (x *NamedPathItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedPathItem.ProtoReflect.Descriptor instead. -func (*NamedPathItem) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{23} -} - -func (x *NamedPathItem) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedPathItem) GetValue() *PathItem { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of Response as ordered (name,value) pairs. -type NamedResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *Response `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedResponse) Reset() { - *x = NamedResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedResponse) ProtoMessage() {} - -func (x *NamedResponse) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedResponse.ProtoReflect.Descriptor instead. -func (*NamedResponse) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{24} -} - -func (x *NamedResponse) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedResponse) GetValue() *Response { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of ResponseValue as ordered (name,value) pairs. -type NamedResponseValue struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *ResponseValue `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedResponseValue) Reset() { - *x = NamedResponseValue{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedResponseValue) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedResponseValue) ProtoMessage() {} - -func (x *NamedResponseValue) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[25] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedResponseValue.ProtoReflect.Descriptor instead. -func (*NamedResponseValue) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{25} -} - -func (x *NamedResponseValue) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedResponseValue) GetValue() *ResponseValue { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of Schema as ordered (name,value) pairs. -type NamedSchema struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *Schema `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedSchema) Reset() { - *x = NamedSchema{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedSchema) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedSchema) ProtoMessage() {} - -func (x *NamedSchema) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[26] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedSchema.ProtoReflect.Descriptor instead. -func (*NamedSchema) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{26} -} - -func (x *NamedSchema) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedSchema) GetValue() *Schema { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of SecurityDefinitionsItem as ordered (name,value) pairs. -type NamedSecurityDefinitionsItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *SecurityDefinitionsItem `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedSecurityDefinitionsItem) Reset() { - *x = NamedSecurityDefinitionsItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedSecurityDefinitionsItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedSecurityDefinitionsItem) ProtoMessage() {} - -func (x *NamedSecurityDefinitionsItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[27] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedSecurityDefinitionsItem.ProtoReflect.Descriptor instead. -func (*NamedSecurityDefinitionsItem) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{27} -} - -func (x *NamedSecurityDefinitionsItem) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedSecurityDefinitionsItem) GetValue() *SecurityDefinitionsItem { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of string as ordered (name,value) pairs. -type NamedString struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedString) Reset() { - *x = NamedString{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedString) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedString) ProtoMessage() {} - -func (x *NamedString) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedString.ProtoReflect.Descriptor instead. -func (*NamedString) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{28} -} - -func (x *NamedString) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedString) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -// Automatically-generated message used to represent maps of StringArray as ordered (name,value) pairs. -type NamedStringArray struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *StringArray `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedStringArray) Reset() { - *x = NamedStringArray{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedStringArray) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedStringArray) ProtoMessage() {} - -func (x *NamedStringArray) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[29] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedStringArray.ProtoReflect.Descriptor instead. -func (*NamedStringArray) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{29} -} - -func (x *NamedStringArray) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedStringArray) GetValue() *StringArray { - if x != nil { - return x.Value - } - return nil -} - -type NonBodyParameter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *NonBodyParameter_HeaderParameterSubSchema - // *NonBodyParameter_FormDataParameterSubSchema - // *NonBodyParameter_QueryParameterSubSchema - // *NonBodyParameter_PathParameterSubSchema - Oneof isNonBodyParameter_Oneof `protobuf_oneof:"oneof"` -} - -func (x *NonBodyParameter) Reset() { - *x = NonBodyParameter{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NonBodyParameter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NonBodyParameter) ProtoMessage() {} - -func (x *NonBodyParameter) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[30] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NonBodyParameter.ProtoReflect.Descriptor instead. -func (*NonBodyParameter) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{30} -} - -func (m *NonBodyParameter) GetOneof() isNonBodyParameter_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *NonBodyParameter) GetHeaderParameterSubSchema() *HeaderParameterSubSchema { - if x, ok := x.GetOneof().(*NonBodyParameter_HeaderParameterSubSchema); ok { - return x.HeaderParameterSubSchema - } - return nil -} - -func (x *NonBodyParameter) GetFormDataParameterSubSchema() *FormDataParameterSubSchema { - if x, ok := x.GetOneof().(*NonBodyParameter_FormDataParameterSubSchema); ok { - return x.FormDataParameterSubSchema - } - return nil -} - -func (x *NonBodyParameter) GetQueryParameterSubSchema() *QueryParameterSubSchema { - if x, ok := x.GetOneof().(*NonBodyParameter_QueryParameterSubSchema); ok { - return x.QueryParameterSubSchema - } - return nil -} - -func (x *NonBodyParameter) GetPathParameterSubSchema() *PathParameterSubSchema { - if x, ok := x.GetOneof().(*NonBodyParameter_PathParameterSubSchema); ok { - return x.PathParameterSubSchema - } - return nil -} - -type isNonBodyParameter_Oneof interface { - isNonBodyParameter_Oneof() -} - -type NonBodyParameter_HeaderParameterSubSchema struct { - HeaderParameterSubSchema *HeaderParameterSubSchema `protobuf:"bytes,1,opt,name=header_parameter_sub_schema,json=headerParameterSubSchema,proto3,oneof"` -} - -type NonBodyParameter_FormDataParameterSubSchema struct { - FormDataParameterSubSchema *FormDataParameterSubSchema `protobuf:"bytes,2,opt,name=form_data_parameter_sub_schema,json=formDataParameterSubSchema,proto3,oneof"` -} - -type NonBodyParameter_QueryParameterSubSchema struct { - QueryParameterSubSchema *QueryParameterSubSchema `protobuf:"bytes,3,opt,name=query_parameter_sub_schema,json=queryParameterSubSchema,proto3,oneof"` -} - -type NonBodyParameter_PathParameterSubSchema struct { - PathParameterSubSchema *PathParameterSubSchema `protobuf:"bytes,4,opt,name=path_parameter_sub_schema,json=pathParameterSubSchema,proto3,oneof"` -} - -func (*NonBodyParameter_HeaderParameterSubSchema) isNonBodyParameter_Oneof() {} - -func (*NonBodyParameter_FormDataParameterSubSchema) isNonBodyParameter_Oneof() {} - -func (*NonBodyParameter_QueryParameterSubSchema) isNonBodyParameter_Oneof() {} - -func (*NonBodyParameter_PathParameterSubSchema) isNonBodyParameter_Oneof() {} - -type Oauth2AccessCodeSecurity struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Flow string `protobuf:"bytes,2,opt,name=flow,proto3" json:"flow,omitempty"` - Scopes *Oauth2Scopes `protobuf:"bytes,3,opt,name=scopes,proto3" json:"scopes,omitempty"` - AuthorizationUrl string `protobuf:"bytes,4,opt,name=authorization_url,json=authorizationUrl,proto3" json:"authorization_url,omitempty"` - TokenUrl string `protobuf:"bytes,5,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty"` - Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,7,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Oauth2AccessCodeSecurity) Reset() { - *x = Oauth2AccessCodeSecurity{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[31] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Oauth2AccessCodeSecurity) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Oauth2AccessCodeSecurity) ProtoMessage() {} - -func (x *Oauth2AccessCodeSecurity) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[31] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Oauth2AccessCodeSecurity.ProtoReflect.Descriptor instead. -func (*Oauth2AccessCodeSecurity) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{31} -} - -func (x *Oauth2AccessCodeSecurity) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *Oauth2AccessCodeSecurity) GetFlow() string { - if x != nil { - return x.Flow - } - return "" -} - -func (x *Oauth2AccessCodeSecurity) GetScopes() *Oauth2Scopes { - if x != nil { - return x.Scopes - } - return nil -} - -func (x *Oauth2AccessCodeSecurity) GetAuthorizationUrl() string { - if x != nil { - return x.AuthorizationUrl - } - return "" -} - -func (x *Oauth2AccessCodeSecurity) GetTokenUrl() string { - if x != nil { - return x.TokenUrl - } - return "" -} - -func (x *Oauth2AccessCodeSecurity) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Oauth2AccessCodeSecurity) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type Oauth2ApplicationSecurity struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Flow string `protobuf:"bytes,2,opt,name=flow,proto3" json:"flow,omitempty"` - Scopes *Oauth2Scopes `protobuf:"bytes,3,opt,name=scopes,proto3" json:"scopes,omitempty"` - TokenUrl string `protobuf:"bytes,4,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty"` - Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Oauth2ApplicationSecurity) Reset() { - *x = Oauth2ApplicationSecurity{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[32] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Oauth2ApplicationSecurity) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Oauth2ApplicationSecurity) ProtoMessage() {} - -func (x *Oauth2ApplicationSecurity) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[32] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Oauth2ApplicationSecurity.ProtoReflect.Descriptor instead. -func (*Oauth2ApplicationSecurity) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{32} -} - -func (x *Oauth2ApplicationSecurity) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *Oauth2ApplicationSecurity) GetFlow() string { - if x != nil { - return x.Flow - } - return "" -} - -func (x *Oauth2ApplicationSecurity) GetScopes() *Oauth2Scopes { - if x != nil { - return x.Scopes - } - return nil -} - -func (x *Oauth2ApplicationSecurity) GetTokenUrl() string { - if x != nil { - return x.TokenUrl - } - return "" -} - -func (x *Oauth2ApplicationSecurity) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Oauth2ApplicationSecurity) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type Oauth2ImplicitSecurity struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Flow string `protobuf:"bytes,2,opt,name=flow,proto3" json:"flow,omitempty"` - Scopes *Oauth2Scopes `protobuf:"bytes,3,opt,name=scopes,proto3" json:"scopes,omitempty"` - AuthorizationUrl string `protobuf:"bytes,4,opt,name=authorization_url,json=authorizationUrl,proto3" json:"authorization_url,omitempty"` - Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Oauth2ImplicitSecurity) Reset() { - *x = Oauth2ImplicitSecurity{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[33] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Oauth2ImplicitSecurity) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Oauth2ImplicitSecurity) ProtoMessage() {} - -func (x *Oauth2ImplicitSecurity) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[33] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Oauth2ImplicitSecurity.ProtoReflect.Descriptor instead. -func (*Oauth2ImplicitSecurity) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{33} -} - -func (x *Oauth2ImplicitSecurity) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *Oauth2ImplicitSecurity) GetFlow() string { - if x != nil { - return x.Flow - } - return "" -} - -func (x *Oauth2ImplicitSecurity) GetScopes() *Oauth2Scopes { - if x != nil { - return x.Scopes - } - return nil -} - -func (x *Oauth2ImplicitSecurity) GetAuthorizationUrl() string { - if x != nil { - return x.AuthorizationUrl - } - return "" -} - -func (x *Oauth2ImplicitSecurity) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Oauth2ImplicitSecurity) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type Oauth2PasswordSecurity struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Flow string `protobuf:"bytes,2,opt,name=flow,proto3" json:"flow,omitempty"` - Scopes *Oauth2Scopes `protobuf:"bytes,3,opt,name=scopes,proto3" json:"scopes,omitempty"` - TokenUrl string `protobuf:"bytes,4,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty"` - Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Oauth2PasswordSecurity) Reset() { - *x = Oauth2PasswordSecurity{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[34] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Oauth2PasswordSecurity) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Oauth2PasswordSecurity) ProtoMessage() {} - -func (x *Oauth2PasswordSecurity) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[34] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Oauth2PasswordSecurity.ProtoReflect.Descriptor instead. -func (*Oauth2PasswordSecurity) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{34} -} - -func (x *Oauth2PasswordSecurity) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *Oauth2PasswordSecurity) GetFlow() string { - if x != nil { - return x.Flow - } - return "" -} - -func (x *Oauth2PasswordSecurity) GetScopes() *Oauth2Scopes { - if x != nil { - return x.Scopes - } - return nil -} - -func (x *Oauth2PasswordSecurity) GetTokenUrl() string { - if x != nil { - return x.TokenUrl - } - return "" -} - -func (x *Oauth2PasswordSecurity) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Oauth2PasswordSecurity) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type Oauth2Scopes struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedString `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *Oauth2Scopes) Reset() { - *x = Oauth2Scopes{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[35] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Oauth2Scopes) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Oauth2Scopes) ProtoMessage() {} - -func (x *Oauth2Scopes) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[35] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Oauth2Scopes.ProtoReflect.Descriptor instead. -func (*Oauth2Scopes) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{35} -} - -func (x *Oauth2Scopes) GetAdditionalProperties() []*NamedString { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -type Operation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Tags []string `protobuf:"bytes,1,rep,name=tags,proto3" json:"tags,omitempty"` - // A brief summary of the operation. - Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"` - // A longer description of the operation, GitHub Flavored Markdown is allowed. - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - ExternalDocs *ExternalDocs `protobuf:"bytes,4,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` - // A unique identifier of the operation. - OperationId string `protobuf:"bytes,5,opt,name=operation_id,json=operationId,proto3" json:"operation_id,omitempty"` - // A list of MIME types the API can produce. - Produces []string `protobuf:"bytes,6,rep,name=produces,proto3" json:"produces,omitempty"` - // A list of MIME types the API can consume. - Consumes []string `protobuf:"bytes,7,rep,name=consumes,proto3" json:"consumes,omitempty"` - // The parameters needed to send a valid API call. - Parameters []*ParametersItem `protobuf:"bytes,8,rep,name=parameters,proto3" json:"parameters,omitempty"` - Responses *Responses `protobuf:"bytes,9,opt,name=responses,proto3" json:"responses,omitempty"` - // The transfer protocol of the API. - Schemes []string `protobuf:"bytes,10,rep,name=schemes,proto3" json:"schemes,omitempty"` - Deprecated bool `protobuf:"varint,11,opt,name=deprecated,proto3" json:"deprecated,omitempty"` - Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security,proto3" json:"security,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,13,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Operation) Reset() { - *x = Operation{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[36] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Operation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Operation) ProtoMessage() {} - -func (x *Operation) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[36] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Operation.ProtoReflect.Descriptor instead. -func (*Operation) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{36} -} - -func (x *Operation) GetTags() []string { - if x != nil { - return x.Tags - } - return nil -} - -func (x *Operation) GetSummary() string { - if x != nil { - return x.Summary - } - return "" -} - -func (x *Operation) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Operation) GetExternalDocs() *ExternalDocs { - if x != nil { - return x.ExternalDocs - } - return nil -} - -func (x *Operation) GetOperationId() string { - if x != nil { - return x.OperationId - } - return "" -} - -func (x *Operation) GetProduces() []string { - if x != nil { - return x.Produces - } - return nil -} - -func (x *Operation) GetConsumes() []string { - if x != nil { - return x.Consumes - } - return nil -} - -func (x *Operation) GetParameters() []*ParametersItem { - if x != nil { - return x.Parameters - } - return nil -} - -func (x *Operation) GetResponses() *Responses { - if x != nil { - return x.Responses - } - return nil -} - -func (x *Operation) GetSchemes() []string { - if x != nil { - return x.Schemes - } - return nil -} - -func (x *Operation) GetDeprecated() bool { - if x != nil { - return x.Deprecated - } - return false -} - -func (x *Operation) GetSecurity() []*SecurityRequirement { - if x != nil { - return x.Security - } - return nil -} - -func (x *Operation) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type Parameter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *Parameter_BodyParameter - // *Parameter_NonBodyParameter - Oneof isParameter_Oneof `protobuf_oneof:"oneof"` -} - -func (x *Parameter) Reset() { - *x = Parameter{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[37] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Parameter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Parameter) ProtoMessage() {} - -func (x *Parameter) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[37] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Parameter.ProtoReflect.Descriptor instead. -func (*Parameter) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{37} -} - -func (m *Parameter) GetOneof() isParameter_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *Parameter) GetBodyParameter() *BodyParameter { - if x, ok := x.GetOneof().(*Parameter_BodyParameter); ok { - return x.BodyParameter - } - return nil -} - -func (x *Parameter) GetNonBodyParameter() *NonBodyParameter { - if x, ok := x.GetOneof().(*Parameter_NonBodyParameter); ok { - return x.NonBodyParameter - } - return nil -} - -type isParameter_Oneof interface { - isParameter_Oneof() -} - -type Parameter_BodyParameter struct { - BodyParameter *BodyParameter `protobuf:"bytes,1,opt,name=body_parameter,json=bodyParameter,proto3,oneof"` -} - -type Parameter_NonBodyParameter struct { - NonBodyParameter *NonBodyParameter `protobuf:"bytes,2,opt,name=non_body_parameter,json=nonBodyParameter,proto3,oneof"` -} - -func (*Parameter_BodyParameter) isParameter_Oneof() {} - -func (*Parameter_NonBodyParameter) isParameter_Oneof() {} - -// One or more JSON representations for parameters -type ParameterDefinitions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedParameter `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *ParameterDefinitions) Reset() { - *x = ParameterDefinitions{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[38] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ParameterDefinitions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ParameterDefinitions) ProtoMessage() {} - -func (x *ParameterDefinitions) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[38] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ParameterDefinitions.ProtoReflect.Descriptor instead. -func (*ParameterDefinitions) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{38} -} - -func (x *ParameterDefinitions) GetAdditionalProperties() []*NamedParameter { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -type ParametersItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *ParametersItem_Parameter - // *ParametersItem_JsonReference - Oneof isParametersItem_Oneof `protobuf_oneof:"oneof"` -} - -func (x *ParametersItem) Reset() { - *x = ParametersItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[39] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ParametersItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ParametersItem) ProtoMessage() {} - -func (x *ParametersItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[39] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ParametersItem.ProtoReflect.Descriptor instead. -func (*ParametersItem) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{39} -} - -func (m *ParametersItem) GetOneof() isParametersItem_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *ParametersItem) GetParameter() *Parameter { - if x, ok := x.GetOneof().(*ParametersItem_Parameter); ok { - return x.Parameter - } - return nil -} - -func (x *ParametersItem) GetJsonReference() *JsonReference { - if x, ok := x.GetOneof().(*ParametersItem_JsonReference); ok { - return x.JsonReference - } - return nil -} - -type isParametersItem_Oneof interface { - isParametersItem_Oneof() -} - -type ParametersItem_Parameter struct { - Parameter *Parameter `protobuf:"bytes,1,opt,name=parameter,proto3,oneof"` -} - -type ParametersItem_JsonReference struct { - JsonReference *JsonReference `protobuf:"bytes,2,opt,name=json_reference,json=jsonReference,proto3,oneof"` -} - -func (*ParametersItem_Parameter) isParametersItem_Oneof() {} - -func (*ParametersItem_JsonReference) isParametersItem_Oneof() {} - -type PathItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - XRef string `protobuf:"bytes,1,opt,name=_ref,json=Ref,proto3" json:"_ref,omitempty"` - Get *Operation `protobuf:"bytes,2,opt,name=get,proto3" json:"get,omitempty"` - Put *Operation `protobuf:"bytes,3,opt,name=put,proto3" json:"put,omitempty"` - Post *Operation `protobuf:"bytes,4,opt,name=post,proto3" json:"post,omitempty"` - Delete *Operation `protobuf:"bytes,5,opt,name=delete,proto3" json:"delete,omitempty"` - Options *Operation `protobuf:"bytes,6,opt,name=options,proto3" json:"options,omitempty"` - Head *Operation `protobuf:"bytes,7,opt,name=head,proto3" json:"head,omitempty"` - Patch *Operation `protobuf:"bytes,8,opt,name=patch,proto3" json:"patch,omitempty"` - // The parameters needed to send a valid API call. - Parameters []*ParametersItem `protobuf:"bytes,9,rep,name=parameters,proto3" json:"parameters,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,10,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *PathItem) Reset() { - *x = PathItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[40] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PathItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PathItem) ProtoMessage() {} - -func (x *PathItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[40] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PathItem.ProtoReflect.Descriptor instead. -func (*PathItem) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{40} -} - -func (x *PathItem) GetXRef() string { - if x != nil { - return x.XRef - } - return "" -} - -func (x *PathItem) GetGet() *Operation { - if x != nil { - return x.Get - } - return nil -} - -func (x *PathItem) GetPut() *Operation { - if x != nil { - return x.Put - } - return nil -} - -func (x *PathItem) GetPost() *Operation { - if x != nil { - return x.Post - } - return nil -} - -func (x *PathItem) GetDelete() *Operation { - if x != nil { - return x.Delete - } - return nil -} - -func (x *PathItem) GetOptions() *Operation { - if x != nil { - return x.Options - } - return nil -} - -func (x *PathItem) GetHead() *Operation { - if x != nil { - return x.Head - } - return nil -} - -func (x *PathItem) GetPatch() *Operation { - if x != nil { - return x.Patch - } - return nil -} - -func (x *PathItem) GetParameters() []*ParametersItem { - if x != nil { - return x.Parameters - } - return nil -} - -func (x *PathItem) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type PathParameterSubSchema struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Determines whether or not this parameter is required or optional. - Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"` - // Determines the location of the parameter. - In string `protobuf:"bytes,2,opt,name=in,proto3" json:"in,omitempty"` - // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - // The name of the parameter. - Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` - Type string `protobuf:"bytes,5,opt,name=type,proto3" json:"type,omitempty"` - Format string `protobuf:"bytes,6,opt,name=format,proto3" json:"format,omitempty"` - Items *PrimitivesItems `protobuf:"bytes,7,opt,name=items,proto3" json:"items,omitempty"` - CollectionFormat string `protobuf:"bytes,8,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"` - Default *Any `protobuf:"bytes,9,opt,name=default,proto3" json:"default,omitempty"` - Maximum float64 `protobuf:"fixed64,10,opt,name=maximum,proto3" json:"maximum,omitempty"` - ExclusiveMaximum bool `protobuf:"varint,11,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` - Minimum float64 `protobuf:"fixed64,12,opt,name=minimum,proto3" json:"minimum,omitempty"` - ExclusiveMinimum bool `protobuf:"varint,13,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` - MaxLength int64 `protobuf:"varint,14,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` - MinLength int64 `protobuf:"varint,15,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` - Pattern string `protobuf:"bytes,16,opt,name=pattern,proto3" json:"pattern,omitempty"` - MaxItems int64 `protobuf:"varint,17,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` - MinItems int64 `protobuf:"varint,18,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` - UniqueItems bool `protobuf:"varint,19,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` - Enum []*Any `protobuf:"bytes,20,rep,name=enum,proto3" json:"enum,omitempty"` - MultipleOf float64 `protobuf:"fixed64,21,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,22,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *PathParameterSubSchema) Reset() { - *x = PathParameterSubSchema{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[41] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PathParameterSubSchema) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PathParameterSubSchema) ProtoMessage() {} - -func (x *PathParameterSubSchema) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[41] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PathParameterSubSchema.ProtoReflect.Descriptor instead. -func (*PathParameterSubSchema) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{41} -} - -func (x *PathParameterSubSchema) GetRequired() bool { - if x != nil { - return x.Required - } - return false -} - -func (x *PathParameterSubSchema) GetIn() string { - if x != nil { - return x.In - } - return "" -} - -func (x *PathParameterSubSchema) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *PathParameterSubSchema) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *PathParameterSubSchema) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *PathParameterSubSchema) GetFormat() string { - if x != nil { - return x.Format - } - return "" -} - -func (x *PathParameterSubSchema) GetItems() *PrimitivesItems { - if x != nil { - return x.Items - } - return nil -} - -func (x *PathParameterSubSchema) GetCollectionFormat() string { - if x != nil { - return x.CollectionFormat - } - return "" -} - -func (x *PathParameterSubSchema) GetDefault() *Any { - if x != nil { - return x.Default - } - return nil -} - -func (x *PathParameterSubSchema) GetMaximum() float64 { - if x != nil { - return x.Maximum - } - return 0 -} - -func (x *PathParameterSubSchema) GetExclusiveMaximum() bool { - if x != nil { - return x.ExclusiveMaximum - } - return false -} - -func (x *PathParameterSubSchema) GetMinimum() float64 { - if x != nil { - return x.Minimum - } - return 0 -} - -func (x *PathParameterSubSchema) GetExclusiveMinimum() bool { - if x != nil { - return x.ExclusiveMinimum - } - return false -} - -func (x *PathParameterSubSchema) GetMaxLength() int64 { - if x != nil { - return x.MaxLength - } - return 0 -} - -func (x *PathParameterSubSchema) GetMinLength() int64 { - if x != nil { - return x.MinLength - } - return 0 -} - -func (x *PathParameterSubSchema) GetPattern() string { - if x != nil { - return x.Pattern - } - return "" -} - -func (x *PathParameterSubSchema) GetMaxItems() int64 { - if x != nil { - return x.MaxItems - } - return 0 -} - -func (x *PathParameterSubSchema) GetMinItems() int64 { - if x != nil { - return x.MinItems - } - return 0 -} - -func (x *PathParameterSubSchema) GetUniqueItems() bool { - if x != nil { - return x.UniqueItems - } - return false -} - -func (x *PathParameterSubSchema) GetEnum() []*Any { - if x != nil { - return x.Enum - } - return nil -} - -func (x *PathParameterSubSchema) GetMultipleOf() float64 { - if x != nil { - return x.MultipleOf - } - return 0 -} - -func (x *PathParameterSubSchema) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -// Relative paths to the individual endpoints. They must be relative to the 'basePath'. -type Paths struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - VendorExtension []*NamedAny `protobuf:"bytes,1,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` - Path []*NamedPathItem `protobuf:"bytes,2,rep,name=path,proto3" json:"path,omitempty"` -} - -func (x *Paths) Reset() { - *x = Paths{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[42] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Paths) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Paths) ProtoMessage() {} - -func (x *Paths) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[42] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Paths.ProtoReflect.Descriptor instead. -func (*Paths) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{42} -} - -func (x *Paths) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -func (x *Paths) GetPath() []*NamedPathItem { - if x != nil { - return x.Path - } - return nil -} - -type PrimitivesItems struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Format string `protobuf:"bytes,2,opt,name=format,proto3" json:"format,omitempty"` - Items *PrimitivesItems `protobuf:"bytes,3,opt,name=items,proto3" json:"items,omitempty"` - CollectionFormat string `protobuf:"bytes,4,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"` - Default *Any `protobuf:"bytes,5,opt,name=default,proto3" json:"default,omitempty"` - Maximum float64 `protobuf:"fixed64,6,opt,name=maximum,proto3" json:"maximum,omitempty"` - ExclusiveMaximum bool `protobuf:"varint,7,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` - Minimum float64 `protobuf:"fixed64,8,opt,name=minimum,proto3" json:"minimum,omitempty"` - ExclusiveMinimum bool `protobuf:"varint,9,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` - MaxLength int64 `protobuf:"varint,10,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` - MinLength int64 `protobuf:"varint,11,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` - Pattern string `protobuf:"bytes,12,opt,name=pattern,proto3" json:"pattern,omitempty"` - MaxItems int64 `protobuf:"varint,13,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` - MinItems int64 `protobuf:"varint,14,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` - UniqueItems bool `protobuf:"varint,15,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` - Enum []*Any `protobuf:"bytes,16,rep,name=enum,proto3" json:"enum,omitempty"` - MultipleOf float64 `protobuf:"fixed64,17,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,18,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *PrimitivesItems) Reset() { - *x = PrimitivesItems{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[43] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PrimitivesItems) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PrimitivesItems) ProtoMessage() {} - -func (x *PrimitivesItems) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[43] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PrimitivesItems.ProtoReflect.Descriptor instead. -func (*PrimitivesItems) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{43} -} - -func (x *PrimitivesItems) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *PrimitivesItems) GetFormat() string { - if x != nil { - return x.Format - } - return "" -} - -func (x *PrimitivesItems) GetItems() *PrimitivesItems { - if x != nil { - return x.Items - } - return nil -} - -func (x *PrimitivesItems) GetCollectionFormat() string { - if x != nil { - return x.CollectionFormat - } - return "" -} - -func (x *PrimitivesItems) GetDefault() *Any { - if x != nil { - return x.Default - } - return nil -} - -func (x *PrimitivesItems) GetMaximum() float64 { - if x != nil { - return x.Maximum - } - return 0 -} - -func (x *PrimitivesItems) GetExclusiveMaximum() bool { - if x != nil { - return x.ExclusiveMaximum - } - return false -} - -func (x *PrimitivesItems) GetMinimum() float64 { - if x != nil { - return x.Minimum - } - return 0 -} - -func (x *PrimitivesItems) GetExclusiveMinimum() bool { - if x != nil { - return x.ExclusiveMinimum - } - return false -} - -func (x *PrimitivesItems) GetMaxLength() int64 { - if x != nil { - return x.MaxLength - } - return 0 -} - -func (x *PrimitivesItems) GetMinLength() int64 { - if x != nil { - return x.MinLength - } - return 0 -} - -func (x *PrimitivesItems) GetPattern() string { - if x != nil { - return x.Pattern - } - return "" -} - -func (x *PrimitivesItems) GetMaxItems() int64 { - if x != nil { - return x.MaxItems - } - return 0 -} - -func (x *PrimitivesItems) GetMinItems() int64 { - if x != nil { - return x.MinItems - } - return 0 -} - -func (x *PrimitivesItems) GetUniqueItems() bool { - if x != nil { - return x.UniqueItems - } - return false -} - -func (x *PrimitivesItems) GetEnum() []*Any { - if x != nil { - return x.Enum - } - return nil -} - -func (x *PrimitivesItems) GetMultipleOf() float64 { - if x != nil { - return x.MultipleOf - } - return 0 -} - -func (x *PrimitivesItems) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type Properties struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedSchema `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *Properties) Reset() { - *x = Properties{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[44] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Properties) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Properties) ProtoMessage() {} - -func (x *Properties) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[44] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Properties.ProtoReflect.Descriptor instead. -func (*Properties) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{44} -} - -func (x *Properties) GetAdditionalProperties() []*NamedSchema { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -type QueryParameterSubSchema struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Determines whether or not this parameter is required or optional. - Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"` - // Determines the location of the parameter. - In string `protobuf:"bytes,2,opt,name=in,proto3" json:"in,omitempty"` - // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - // The name of the parameter. - Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` - // allows sending a parameter by name only or with an empty value. - AllowEmptyValue bool `protobuf:"varint,5,opt,name=allow_empty_value,json=allowEmptyValue,proto3" json:"allow_empty_value,omitempty"` - Type string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty"` - Format string `protobuf:"bytes,7,opt,name=format,proto3" json:"format,omitempty"` - Items *PrimitivesItems `protobuf:"bytes,8,opt,name=items,proto3" json:"items,omitempty"` - CollectionFormat string `protobuf:"bytes,9,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"` - Default *Any `protobuf:"bytes,10,opt,name=default,proto3" json:"default,omitempty"` - Maximum float64 `protobuf:"fixed64,11,opt,name=maximum,proto3" json:"maximum,omitempty"` - ExclusiveMaximum bool `protobuf:"varint,12,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` - Minimum float64 `protobuf:"fixed64,13,opt,name=minimum,proto3" json:"minimum,omitempty"` - ExclusiveMinimum bool `protobuf:"varint,14,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` - MaxLength int64 `protobuf:"varint,15,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` - MinLength int64 `protobuf:"varint,16,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` - Pattern string `protobuf:"bytes,17,opt,name=pattern,proto3" json:"pattern,omitempty"` - MaxItems int64 `protobuf:"varint,18,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` - MinItems int64 `protobuf:"varint,19,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` - UniqueItems bool `protobuf:"varint,20,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` - Enum []*Any `protobuf:"bytes,21,rep,name=enum,proto3" json:"enum,omitempty"` - MultipleOf float64 `protobuf:"fixed64,22,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,23,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *QueryParameterSubSchema) Reset() { - *x = QueryParameterSubSchema{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[45] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryParameterSubSchema) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryParameterSubSchema) ProtoMessage() {} - -func (x *QueryParameterSubSchema) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[45] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use QueryParameterSubSchema.ProtoReflect.Descriptor instead. -func (*QueryParameterSubSchema) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{45} -} - -func (x *QueryParameterSubSchema) GetRequired() bool { - if x != nil { - return x.Required - } - return false -} - -func (x *QueryParameterSubSchema) GetIn() string { - if x != nil { - return x.In - } - return "" -} - -func (x *QueryParameterSubSchema) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *QueryParameterSubSchema) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *QueryParameterSubSchema) GetAllowEmptyValue() bool { - if x != nil { - return x.AllowEmptyValue - } - return false -} - -func (x *QueryParameterSubSchema) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *QueryParameterSubSchema) GetFormat() string { - if x != nil { - return x.Format - } - return "" -} - -func (x *QueryParameterSubSchema) GetItems() *PrimitivesItems { - if x != nil { - return x.Items - } - return nil -} - -func (x *QueryParameterSubSchema) GetCollectionFormat() string { - if x != nil { - return x.CollectionFormat - } - return "" -} - -func (x *QueryParameterSubSchema) GetDefault() *Any { - if x != nil { - return x.Default - } - return nil -} - -func (x *QueryParameterSubSchema) GetMaximum() float64 { - if x != nil { - return x.Maximum - } - return 0 -} - -func (x *QueryParameterSubSchema) GetExclusiveMaximum() bool { - if x != nil { - return x.ExclusiveMaximum - } - return false -} - -func (x *QueryParameterSubSchema) GetMinimum() float64 { - if x != nil { - return x.Minimum - } - return 0 -} - -func (x *QueryParameterSubSchema) GetExclusiveMinimum() bool { - if x != nil { - return x.ExclusiveMinimum - } - return false -} - -func (x *QueryParameterSubSchema) GetMaxLength() int64 { - if x != nil { - return x.MaxLength - } - return 0 -} - -func (x *QueryParameterSubSchema) GetMinLength() int64 { - if x != nil { - return x.MinLength - } - return 0 -} - -func (x *QueryParameterSubSchema) GetPattern() string { - if x != nil { - return x.Pattern - } - return "" -} - -func (x *QueryParameterSubSchema) GetMaxItems() int64 { - if x != nil { - return x.MaxItems - } - return 0 -} - -func (x *QueryParameterSubSchema) GetMinItems() int64 { - if x != nil { - return x.MinItems - } - return 0 -} - -func (x *QueryParameterSubSchema) GetUniqueItems() bool { - if x != nil { - return x.UniqueItems - } - return false -} - -func (x *QueryParameterSubSchema) GetEnum() []*Any { - if x != nil { - return x.Enum - } - return nil -} - -func (x *QueryParameterSubSchema) GetMultipleOf() float64 { - if x != nil { - return x.MultipleOf - } - return 0 -} - -func (x *QueryParameterSubSchema) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type Response struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` - Schema *SchemaItem `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"` - Headers *Headers `protobuf:"bytes,3,opt,name=headers,proto3" json:"headers,omitempty"` - Examples *Examples `protobuf:"bytes,4,opt,name=examples,proto3" json:"examples,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,5,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Response) Reset() { - *x = Response{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[46] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Response) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Response) ProtoMessage() {} - -func (x *Response) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[46] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Response.ProtoReflect.Descriptor instead. -func (*Response) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{46} -} - -func (x *Response) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Response) GetSchema() *SchemaItem { - if x != nil { - return x.Schema - } - return nil -} - -func (x *Response) GetHeaders() *Headers { - if x != nil { - return x.Headers - } - return nil -} - -func (x *Response) GetExamples() *Examples { - if x != nil { - return x.Examples - } - return nil -} - -func (x *Response) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -// One or more JSON representations for responses -type ResponseDefinitions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedResponse `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *ResponseDefinitions) Reset() { - *x = ResponseDefinitions{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[47] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ResponseDefinitions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ResponseDefinitions) ProtoMessage() {} - -func (x *ResponseDefinitions) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[47] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ResponseDefinitions.ProtoReflect.Descriptor instead. -func (*ResponseDefinitions) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{47} -} - -func (x *ResponseDefinitions) GetAdditionalProperties() []*NamedResponse { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -type ResponseValue struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *ResponseValue_Response - // *ResponseValue_JsonReference - Oneof isResponseValue_Oneof `protobuf_oneof:"oneof"` -} - -func (x *ResponseValue) Reset() { - *x = ResponseValue{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[48] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ResponseValue) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ResponseValue) ProtoMessage() {} - -func (x *ResponseValue) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[48] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ResponseValue.ProtoReflect.Descriptor instead. -func (*ResponseValue) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{48} -} - -func (m *ResponseValue) GetOneof() isResponseValue_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *ResponseValue) GetResponse() *Response { - if x, ok := x.GetOneof().(*ResponseValue_Response); ok { - return x.Response - } - return nil -} - -func (x *ResponseValue) GetJsonReference() *JsonReference { - if x, ok := x.GetOneof().(*ResponseValue_JsonReference); ok { - return x.JsonReference - } - return nil -} - -type isResponseValue_Oneof interface { - isResponseValue_Oneof() -} - -type ResponseValue_Response struct { - Response *Response `protobuf:"bytes,1,opt,name=response,proto3,oneof"` -} - -type ResponseValue_JsonReference struct { - JsonReference *JsonReference `protobuf:"bytes,2,opt,name=json_reference,json=jsonReference,proto3,oneof"` -} - -func (*ResponseValue_Response) isResponseValue_Oneof() {} - -func (*ResponseValue_JsonReference) isResponseValue_Oneof() {} - -// Response objects names can either be any valid HTTP status code or 'default'. -type Responses struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ResponseCode []*NamedResponseValue `protobuf:"bytes,1,rep,name=response_code,json=responseCode,proto3" json:"response_code,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,2,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Responses) Reset() { - *x = Responses{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[49] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Responses) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Responses) ProtoMessage() {} - -func (x *Responses) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[49] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Responses.ProtoReflect.Descriptor instead. -func (*Responses) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{49} -} - -func (x *Responses) GetResponseCode() []*NamedResponseValue { - if x != nil { - return x.ResponseCode - } - return nil -} - -func (x *Responses) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -// A deterministic version of a JSON Schema object. -type Schema struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - XRef string `protobuf:"bytes,1,opt,name=_ref,json=Ref,proto3" json:"_ref,omitempty"` - Format string `protobuf:"bytes,2,opt,name=format,proto3" json:"format,omitempty"` - Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` - Default *Any `protobuf:"bytes,5,opt,name=default,proto3" json:"default,omitempty"` - MultipleOf float64 `protobuf:"fixed64,6,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` - Maximum float64 `protobuf:"fixed64,7,opt,name=maximum,proto3" json:"maximum,omitempty"` - ExclusiveMaximum bool `protobuf:"varint,8,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` - Minimum float64 `protobuf:"fixed64,9,opt,name=minimum,proto3" json:"minimum,omitempty"` - ExclusiveMinimum bool `protobuf:"varint,10,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` - MaxLength int64 `protobuf:"varint,11,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` - MinLength int64 `protobuf:"varint,12,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` - Pattern string `protobuf:"bytes,13,opt,name=pattern,proto3" json:"pattern,omitempty"` - MaxItems int64 `protobuf:"varint,14,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` - MinItems int64 `protobuf:"varint,15,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` - UniqueItems bool `protobuf:"varint,16,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` - MaxProperties int64 `protobuf:"varint,17,opt,name=max_properties,json=maxProperties,proto3" json:"max_properties,omitempty"` - MinProperties int64 `protobuf:"varint,18,opt,name=min_properties,json=minProperties,proto3" json:"min_properties,omitempty"` - Required []string `protobuf:"bytes,19,rep,name=required,proto3" json:"required,omitempty"` - Enum []*Any `protobuf:"bytes,20,rep,name=enum,proto3" json:"enum,omitempty"` - AdditionalProperties *AdditionalPropertiesItem `protobuf:"bytes,21,opt,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` - Type *TypeItem `protobuf:"bytes,22,opt,name=type,proto3" json:"type,omitempty"` - Items *ItemsItem `protobuf:"bytes,23,opt,name=items,proto3" json:"items,omitempty"` - AllOf []*Schema `protobuf:"bytes,24,rep,name=all_of,json=allOf,proto3" json:"all_of,omitempty"` - Properties *Properties `protobuf:"bytes,25,opt,name=properties,proto3" json:"properties,omitempty"` - Discriminator string `protobuf:"bytes,26,opt,name=discriminator,proto3" json:"discriminator,omitempty"` - ReadOnly bool `protobuf:"varint,27,opt,name=read_only,json=readOnly,proto3" json:"read_only,omitempty"` - Xml *Xml `protobuf:"bytes,28,opt,name=xml,proto3" json:"xml,omitempty"` - ExternalDocs *ExternalDocs `protobuf:"bytes,29,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` - Example *Any `protobuf:"bytes,30,opt,name=example,proto3" json:"example,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,31,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Schema) Reset() { - *x = Schema{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[50] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Schema) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Schema) ProtoMessage() {} - -func (x *Schema) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[50] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Schema.ProtoReflect.Descriptor instead. -func (*Schema) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{50} -} - -func (x *Schema) GetXRef() string { - if x != nil { - return x.XRef - } - return "" -} - -func (x *Schema) GetFormat() string { - if x != nil { - return x.Format - } - return "" -} - -func (x *Schema) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *Schema) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Schema) GetDefault() *Any { - if x != nil { - return x.Default - } - return nil -} - -func (x *Schema) GetMultipleOf() float64 { - if x != nil { - return x.MultipleOf - } - return 0 -} - -func (x *Schema) GetMaximum() float64 { - if x != nil { - return x.Maximum - } - return 0 -} - -func (x *Schema) GetExclusiveMaximum() bool { - if x != nil { - return x.ExclusiveMaximum - } - return false -} - -func (x *Schema) GetMinimum() float64 { - if x != nil { - return x.Minimum - } - return 0 -} - -func (x *Schema) GetExclusiveMinimum() bool { - if x != nil { - return x.ExclusiveMinimum - } - return false -} - -func (x *Schema) GetMaxLength() int64 { - if x != nil { - return x.MaxLength - } - return 0 -} - -func (x *Schema) GetMinLength() int64 { - if x != nil { - return x.MinLength - } - return 0 -} - -func (x *Schema) GetPattern() string { - if x != nil { - return x.Pattern - } - return "" -} - -func (x *Schema) GetMaxItems() int64 { - if x != nil { - return x.MaxItems - } - return 0 -} - -func (x *Schema) GetMinItems() int64 { - if x != nil { - return x.MinItems - } - return 0 -} - -func (x *Schema) GetUniqueItems() bool { - if x != nil { - return x.UniqueItems - } - return false -} - -func (x *Schema) GetMaxProperties() int64 { - if x != nil { - return x.MaxProperties - } - return 0 -} - -func (x *Schema) GetMinProperties() int64 { - if x != nil { - return x.MinProperties - } - return 0 -} - -func (x *Schema) GetRequired() []string { - if x != nil { - return x.Required - } - return nil -} - -func (x *Schema) GetEnum() []*Any { - if x != nil { - return x.Enum - } - return nil -} - -func (x *Schema) GetAdditionalProperties() *AdditionalPropertiesItem { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -func (x *Schema) GetType() *TypeItem { - if x != nil { - return x.Type - } - return nil -} - -func (x *Schema) GetItems() *ItemsItem { - if x != nil { - return x.Items - } - return nil -} - -func (x *Schema) GetAllOf() []*Schema { - if x != nil { - return x.AllOf - } - return nil -} - -func (x *Schema) GetProperties() *Properties { - if x != nil { - return x.Properties - } - return nil -} - -func (x *Schema) GetDiscriminator() string { - if x != nil { - return x.Discriminator - } - return "" -} - -func (x *Schema) GetReadOnly() bool { - if x != nil { - return x.ReadOnly - } - return false -} - -func (x *Schema) GetXml() *Xml { - if x != nil { - return x.Xml - } - return nil -} - -func (x *Schema) GetExternalDocs() *ExternalDocs { - if x != nil { - return x.ExternalDocs - } - return nil -} - -func (x *Schema) GetExample() *Any { - if x != nil { - return x.Example - } - return nil -} - -func (x *Schema) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type SchemaItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *SchemaItem_Schema - // *SchemaItem_FileSchema - Oneof isSchemaItem_Oneof `protobuf_oneof:"oneof"` -} - -func (x *SchemaItem) Reset() { - *x = SchemaItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[51] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SchemaItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SchemaItem) ProtoMessage() {} - -func (x *SchemaItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[51] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SchemaItem.ProtoReflect.Descriptor instead. -func (*SchemaItem) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{51} -} - -func (m *SchemaItem) GetOneof() isSchemaItem_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *SchemaItem) GetSchema() *Schema { - if x, ok := x.GetOneof().(*SchemaItem_Schema); ok { - return x.Schema - } - return nil -} - -func (x *SchemaItem) GetFileSchema() *FileSchema { - if x, ok := x.GetOneof().(*SchemaItem_FileSchema); ok { - return x.FileSchema - } - return nil -} - -type isSchemaItem_Oneof interface { - isSchemaItem_Oneof() -} - -type SchemaItem_Schema struct { - Schema *Schema `protobuf:"bytes,1,opt,name=schema,proto3,oneof"` -} - -type SchemaItem_FileSchema struct { - FileSchema *FileSchema `protobuf:"bytes,2,opt,name=file_schema,json=fileSchema,proto3,oneof"` -} - -func (*SchemaItem_Schema) isSchemaItem_Oneof() {} - -func (*SchemaItem_FileSchema) isSchemaItem_Oneof() {} - -type SecurityDefinitions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedSecurityDefinitionsItem `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *SecurityDefinitions) Reset() { - *x = SecurityDefinitions{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[52] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SecurityDefinitions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SecurityDefinitions) ProtoMessage() {} - -func (x *SecurityDefinitions) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[52] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SecurityDefinitions.ProtoReflect.Descriptor instead. -func (*SecurityDefinitions) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{52} -} - -func (x *SecurityDefinitions) GetAdditionalProperties() []*NamedSecurityDefinitionsItem { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -type SecurityDefinitionsItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *SecurityDefinitionsItem_BasicAuthenticationSecurity - // *SecurityDefinitionsItem_ApiKeySecurity - // *SecurityDefinitionsItem_Oauth2ImplicitSecurity - // *SecurityDefinitionsItem_Oauth2PasswordSecurity - // *SecurityDefinitionsItem_Oauth2ApplicationSecurity - // *SecurityDefinitionsItem_Oauth2AccessCodeSecurity - Oneof isSecurityDefinitionsItem_Oneof `protobuf_oneof:"oneof"` -} - -func (x *SecurityDefinitionsItem) Reset() { - *x = SecurityDefinitionsItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[53] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SecurityDefinitionsItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SecurityDefinitionsItem) ProtoMessage() {} - -func (x *SecurityDefinitionsItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[53] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SecurityDefinitionsItem.ProtoReflect.Descriptor instead. -func (*SecurityDefinitionsItem) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{53} -} - -func (m *SecurityDefinitionsItem) GetOneof() isSecurityDefinitionsItem_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *SecurityDefinitionsItem) GetBasicAuthenticationSecurity() *BasicAuthenticationSecurity { - if x, ok := x.GetOneof().(*SecurityDefinitionsItem_BasicAuthenticationSecurity); ok { - return x.BasicAuthenticationSecurity - } - return nil -} - -func (x *SecurityDefinitionsItem) GetApiKeySecurity() *ApiKeySecurity { - if x, ok := x.GetOneof().(*SecurityDefinitionsItem_ApiKeySecurity); ok { - return x.ApiKeySecurity - } - return nil -} - -func (x *SecurityDefinitionsItem) GetOauth2ImplicitSecurity() *Oauth2ImplicitSecurity { - if x, ok := x.GetOneof().(*SecurityDefinitionsItem_Oauth2ImplicitSecurity); ok { - return x.Oauth2ImplicitSecurity - } - return nil -} - -func (x *SecurityDefinitionsItem) GetOauth2PasswordSecurity() *Oauth2PasswordSecurity { - if x, ok := x.GetOneof().(*SecurityDefinitionsItem_Oauth2PasswordSecurity); ok { - return x.Oauth2PasswordSecurity - } - return nil -} - -func (x *SecurityDefinitionsItem) GetOauth2ApplicationSecurity() *Oauth2ApplicationSecurity { - if x, ok := x.GetOneof().(*SecurityDefinitionsItem_Oauth2ApplicationSecurity); ok { - return x.Oauth2ApplicationSecurity - } - return nil -} - -func (x *SecurityDefinitionsItem) GetOauth2AccessCodeSecurity() *Oauth2AccessCodeSecurity { - if x, ok := x.GetOneof().(*SecurityDefinitionsItem_Oauth2AccessCodeSecurity); ok { - return x.Oauth2AccessCodeSecurity - } - return nil -} - -type isSecurityDefinitionsItem_Oneof interface { - isSecurityDefinitionsItem_Oneof() -} - -type SecurityDefinitionsItem_BasicAuthenticationSecurity struct { - BasicAuthenticationSecurity *BasicAuthenticationSecurity `protobuf:"bytes,1,opt,name=basic_authentication_security,json=basicAuthenticationSecurity,proto3,oneof"` -} - -type SecurityDefinitionsItem_ApiKeySecurity struct { - ApiKeySecurity *ApiKeySecurity `protobuf:"bytes,2,opt,name=api_key_security,json=apiKeySecurity,proto3,oneof"` -} - -type SecurityDefinitionsItem_Oauth2ImplicitSecurity struct { - Oauth2ImplicitSecurity *Oauth2ImplicitSecurity `protobuf:"bytes,3,opt,name=oauth2_implicit_security,json=oauth2ImplicitSecurity,proto3,oneof"` -} - -type SecurityDefinitionsItem_Oauth2PasswordSecurity struct { - Oauth2PasswordSecurity *Oauth2PasswordSecurity `protobuf:"bytes,4,opt,name=oauth2_password_security,json=oauth2PasswordSecurity,proto3,oneof"` -} - -type SecurityDefinitionsItem_Oauth2ApplicationSecurity struct { - Oauth2ApplicationSecurity *Oauth2ApplicationSecurity `protobuf:"bytes,5,opt,name=oauth2_application_security,json=oauth2ApplicationSecurity,proto3,oneof"` -} - -type SecurityDefinitionsItem_Oauth2AccessCodeSecurity struct { - Oauth2AccessCodeSecurity *Oauth2AccessCodeSecurity `protobuf:"bytes,6,opt,name=oauth2_access_code_security,json=oauth2AccessCodeSecurity,proto3,oneof"` -} - -func (*SecurityDefinitionsItem_BasicAuthenticationSecurity) isSecurityDefinitionsItem_Oneof() {} - -func (*SecurityDefinitionsItem_ApiKeySecurity) isSecurityDefinitionsItem_Oneof() {} - -func (*SecurityDefinitionsItem_Oauth2ImplicitSecurity) isSecurityDefinitionsItem_Oneof() {} - -func (*SecurityDefinitionsItem_Oauth2PasswordSecurity) isSecurityDefinitionsItem_Oneof() {} - -func (*SecurityDefinitionsItem_Oauth2ApplicationSecurity) isSecurityDefinitionsItem_Oneof() {} - -func (*SecurityDefinitionsItem_Oauth2AccessCodeSecurity) isSecurityDefinitionsItem_Oneof() {} - -type SecurityRequirement struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedStringArray `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *SecurityRequirement) Reset() { - *x = SecurityRequirement{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[54] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SecurityRequirement) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SecurityRequirement) ProtoMessage() {} - -func (x *SecurityRequirement) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[54] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SecurityRequirement.ProtoReflect.Descriptor instead. -func (*SecurityRequirement) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{54} -} - -func (x *SecurityRequirement) GetAdditionalProperties() []*NamedStringArray { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -type StringArray struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Value []string `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"` -} - -func (x *StringArray) Reset() { - *x = StringArray{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[55] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StringArray) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StringArray) ProtoMessage() {} - -func (x *StringArray) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[55] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StringArray.ProtoReflect.Descriptor instead. -func (*StringArray) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{55} -} - -func (x *StringArray) GetValue() []string { - if x != nil { - return x.Value - } - return nil -} - -type Tag struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - ExternalDocs *ExternalDocs `protobuf:"bytes,3,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,4,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Tag) Reset() { - *x = Tag{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[56] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Tag) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Tag) ProtoMessage() {} - -func (x *Tag) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[56] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Tag.ProtoReflect.Descriptor instead. -func (*Tag) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{56} -} - -func (x *Tag) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Tag) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Tag) GetExternalDocs() *ExternalDocs { - if x != nil { - return x.ExternalDocs - } - return nil -} - -func (x *Tag) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type TypeItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Value []string `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"` -} - -func (x *TypeItem) Reset() { - *x = TypeItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[57] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TypeItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TypeItem) ProtoMessage() {} - -func (x *TypeItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[57] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TypeItem.ProtoReflect.Descriptor instead. -func (*TypeItem) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{57} -} - -func (x *TypeItem) GetValue() []string { - if x != nil { - return x.Value - } - return nil -} - -// Any property starting with x- is valid. -type VendorExtension struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedAny `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *VendorExtension) Reset() { - *x = VendorExtension{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[58] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *VendorExtension) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*VendorExtension) ProtoMessage() {} - -func (x *VendorExtension) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[58] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use VendorExtension.ProtoReflect.Descriptor instead. -func (*VendorExtension) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{58} -} - -func (x *VendorExtension) GetAdditionalProperties() []*NamedAny { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -type Xml struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` - Prefix string `protobuf:"bytes,3,opt,name=prefix,proto3" json:"prefix,omitempty"` - Attribute bool `protobuf:"varint,4,opt,name=attribute,proto3" json:"attribute,omitempty"` - Wrapped bool `protobuf:"varint,5,opt,name=wrapped,proto3" json:"wrapped,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Xml) Reset() { - *x = Xml{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[59] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Xml) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Xml) ProtoMessage() {} - -func (x *Xml) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[59] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Xml.ProtoReflect.Descriptor instead. -func (*Xml) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{59} -} - -func (x *Xml) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Xml) GetNamespace() string { - if x != nil { - return x.Namespace - } - return "" -} - -func (x *Xml) GetPrefix() string { - if x != nil { - return x.Prefix - } - return "" -} - -func (x *Xml) GetAttribute() bool { - if x != nil { - return x.Attribute - } - return false -} - -func (x *Xml) GetWrapped() bool { - if x != nil { - return x.Wrapped - } - return false -} - -func (x *Xml) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -var File_openapiv2_OpenAPIv2_proto protoreflect.FileDescriptor - -var file_openapiv2_OpenAPIv2_proto_rawDesc = []byte{ - 0x0a, 0x19, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x4f, 0x70, 0x65, 0x6e, - 0x41, 0x50, 0x49, 0x76, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x6d, 0x0a, 0x18, 0x41, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, - 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x2c, - 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, - 0x6d, 0x61, 0x48, 0x00, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x1a, 0x0a, 0x07, - 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, - 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, - 0x66, 0x22, 0x45, 0x0a, 0x03, 0x41, 0x6e, 0x79, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x22, 0xab, 0x01, 0x0a, 0x0e, 0x41, 0x70, 0x69, - 0x4b, 0x65, 0x79, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x02, 0x69, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, - 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, - 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x94, 0x01, 0x0a, 0x1b, 0x42, 0x61, 0x73, 0x69, 0x63, - 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, - 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10, - 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, - 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xde, 0x01, - 0x0a, 0x0d, 0x42, 0x6f, 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, - 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, - 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, - 0x64, 0x12, 0x2a, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, - 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x3f, 0x0a, - 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, - 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x86, - 0x01, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, - 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, - 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, - 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, - 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x54, 0x0a, 0x07, 0x44, 0x65, 0x66, 0x61, 0x75, - 0x6c, 0x74, 0x12, 0x49, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, - 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, - 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, - 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x5b, 0x0a, - 0x0b, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x4c, 0x0a, 0x15, - 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, - 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x63, - 0x68, 0x65, 0x6d, 0x61, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, - 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xe8, 0x05, 0x0a, 0x08, 0x44, - 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x77, 0x61, 0x67, 0x67, - 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x77, 0x61, 0x67, 0x67, 0x65, - 0x72, 0x12, 0x24, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x10, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x62, - 0x61, 0x73, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x62, 0x61, 0x73, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x63, 0x68, 0x65, - 0x6d, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, - 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x73, 0x18, 0x06, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x73, 0x12, 0x1a, - 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x08, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x73, 0x12, 0x27, 0x0a, 0x05, 0x70, 0x61, - 0x74, 0x68, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x73, 0x52, 0x05, 0x70, 0x61, - 0x74, 0x68, 0x73, 0x12, 0x39, 0x0a, 0x0b, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x52, 0x0b, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x40, - 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x0a, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, - 0x12, 0x3d, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x0b, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x12, - 0x3b, 0x0a, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x0c, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, - 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x52, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x52, 0x0a, 0x14, - 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, - 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x13, 0x73, 0x65, 0x63, - 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x12, 0x23, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x61, 0x67, 0x52, - 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, - 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, - 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, - 0x44, 0x6f, 0x63, 0x73, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, - 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x55, 0x0a, 0x08, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, - 0x73, 0x12, 0x49, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, - 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, - 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x83, 0x01, 0x0a, - 0x0c, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x20, 0x0a, - 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, - 0x6c, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, - 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x22, 0xff, 0x02, 0x0a, 0x0a, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, - 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, - 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x1a, 0x0a, 0x08, - 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, - 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, - 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x08, 0x72, 0x65, 0x61, 0x64, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x29, 0x0a, 0x07, 0x65, 0x78, 0x61, 0x6d, - 0x70, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x65, 0x78, 0x61, 0x6d, - 0x70, 0x6c, 0x65, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, - 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xab, 0x06, 0x0a, 0x1a, 0x46, 0x6f, 0x72, 0x6d, 0x44, 0x61, 0x74, - 0x61, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, - 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x65, - 0x6d, 0x70, 0x74, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x0f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a, - 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, - 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, - 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, - 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c, - 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a, - 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, - 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, - 0x6d, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, - 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, - 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, - 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, - 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x01, - 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, - 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0e, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, - 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x18, 0x10, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, - 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, - 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, - 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, - 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, - 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, - 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65, - 0x6e, 0x75, 0x6d, 0x18, 0x15, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, - 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18, - 0x16, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f, - 0x66, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x17, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, - 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x22, 0xab, 0x05, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x12, 0x0a, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a, 0x05, 0x69, 0x74, 0x65, - 0x6d, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, - 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x2b, 0x0a, 0x11, - 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, - 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, - 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x69, - 0x6d, 0x75, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, - 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d, - 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x69, - 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, - 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x69, 0x6e, 0x69, 0x6d, - 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, - 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, - 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, - 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69, - 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49, - 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x69, - 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e, 0x69, 0x71, - 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, - 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x1f, 0x0a, 0x0b, - 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18, 0x11, 0x20, 0x01, 0x28, - 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f, 0x66, 0x12, 0x20, 0x0a, - 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x12, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x13, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, - 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x22, 0xfd, 0x05, 0x0a, 0x18, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x1a, 0x0a, - 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a, 0x05, 0x69, - 0x74, 0x65, 0x6d, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, - 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x2b, - 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x6f, 0x72, - 0x6d, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c, 0x6c, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a, 0x07, 0x64, - 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, - 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, - 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, - 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x61, - 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, - 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x18, 0x0a, - 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, - 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, - 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0d, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x69, 0x6e, - 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x10, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, 0x0a, 0x09, - 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, - 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, - 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, - 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e, - 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65, 0x6e, 0x75, - 0x6d, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x1f, - 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18, 0x15, 0x20, - 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f, 0x66, 0x12, - 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x16, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, - 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x22, 0x57, 0x0a, 0x07, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x4c, 0x0a, 0x15, 0x61, - 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, - 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, - 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xa1, 0x02, 0x0a, 0x04, 0x49, 0x6e, - 0x66, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x10, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x5f, 0x6f, 0x66, - 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, - 0x74, 0x65, 0x72, 0x6d, 0x73, 0x4f, 0x66, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x2d, - 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x13, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x6f, 0x6e, - 0x74, 0x61, 0x63, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x2d, 0x0a, - 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x63, 0x65, - 0x6e, 0x73, 0x65, 0x52, 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x10, - 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, - 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x37, 0x0a, - 0x09, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x2a, 0x0a, 0x06, 0x73, 0x63, - 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x06, - 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22, 0x44, 0x0a, 0x0d, 0x4a, 0x73, 0x6f, 0x6e, 0x52, 0x65, - 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x11, 0x0a, 0x04, 0x5f, 0x72, 0x65, 0x66, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x52, 0x65, 0x66, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x70, 0x0a, 0x07, - 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, - 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x3f, 0x0a, - 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, - 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x45, - 0x0a, 0x08, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x25, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4b, 0x0a, 0x0b, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x48, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0x51, 0x0a, 0x0e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4f, 0x0a, 0x0d, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, - 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4f, 0x0a, 0x0d, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x59, 0x0a, 0x12, 0x4e, 0x61, 0x6d, 0x65, 0x64, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x2f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0x4b, 0x0a, 0x0b, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0x6d, 0x0a, 0x1c, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, - 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x39, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x37, - 0x0a, 0x0b, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x55, 0x0a, 0x10, 0x4e, 0x61, 0x6d, 0x65, 0x64, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x74, 0x72, 0x69, - 0x6e, 0x67, 0x41, 0x72, 0x72, 0x61, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xb5, - 0x03, 0x0a, 0x10, 0x4e, 0x6f, 0x6e, 0x42, 0x6f, 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, - 0x74, 0x65, 0x72, 0x12, 0x65, 0x0a, 0x1b, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x75, 0x62, 0x5f, 0x73, 0x63, 0x68, 0x65, - 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x48, 0x00, - 0x52, 0x18, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x6c, 0x0a, 0x1e, 0x66, 0x6f, - 0x72, 0x6d, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x5f, 0x73, 0x75, 0x62, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x46, 0x6f, 0x72, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x48, 0x00, 0x52, 0x1a, 0x66, 0x6f, - 0x72, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, - 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x62, 0x0a, 0x1a, 0x71, 0x75, 0x65, 0x72, - 0x79, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x75, 0x62, 0x5f, - 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x48, 0x00, 0x52, 0x17, 0x71, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, - 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x5f, 0x0a, 0x19, - 0x70, 0x61, 0x74, 0x68, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x73, - 0x75, 0x62, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x74, - 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x48, 0x00, 0x52, 0x16, 0x70, 0x61, 0x74, 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x42, 0x07, 0x0a, - 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0xa1, 0x02, 0x0a, 0x18, 0x4f, 0x61, 0x75, 0x74, 0x68, - 0x32, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x63, 0x75, 0x72, - 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x30, 0x0a, 0x06, 0x73, - 0x63, 0x6f, 0x70, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x53, - 0x63, 0x6f, 0x70, 0x65, 0x73, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x2b, 0x0a, - 0x11, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x75, - 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, - 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, - 0x6f, 0x6b, 0x65, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, - 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, - 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xf5, 0x01, 0x0a, 0x19, 0x4f, - 0x61, 0x75, 0x74, 0x68, 0x32, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, - 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x6c, 0x6f, 0x77, - 0x12, 0x30, 0x0a, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x61, - 0x75, 0x74, 0x68, 0x32, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x70, - 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x55, 0x72, 0x6c, 0x12, - 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, - 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x22, 0x82, 0x02, 0x0a, 0x16, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x49, 0x6d, 0x70, - 0x6c, 0x69, 0x63, 0x69, 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x52, - 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x10, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, - 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, - 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xf2, 0x01, 0x0a, 0x16, 0x4f, 0x61, 0x75, 0x74, - 0x68, 0x32, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, - 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x63, - 0x6f, 0x70, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x53, 0x63, - 0x6f, 0x70, 0x65, 0x73, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x09, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76, - 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, - 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x5c, 0x0a, 0x0c, - 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x4c, 0x0a, 0x15, - 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, - 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, - 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x9e, 0x04, 0x0a, 0x09, 0x4f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x18, 0x0a, 0x07, - 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, - 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, - 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6f, 0x70, 0x65, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, - 0x6f, 0x64, 0x75, 0x63, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, - 0x6f, 0x64, 0x75, 0x63, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, - 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, - 0x65, 0x73, 0x12, 0x3a, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, - 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x49, 0x74, - 0x65, 0x6d, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x33, - 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x18, 0x0a, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x12, 0x1e, 0x0a, - 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x3b, 0x0a, - 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, 0x63, - 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x52, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, - 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0d, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, - 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xa6, 0x01, 0x0a, 0x09, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x42, 0x0a, 0x0e, 0x62, 0x6f, 0x64, - 0x79, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x42, - 0x6f, 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0d, - 0x62, 0x6f, 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x4c, 0x0a, - 0x12, 0x6e, 0x6f, 0x6e, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, - 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x6f, 0x6e, 0x42, 0x6f, 0x64, 0x79, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x10, 0x6e, 0x6f, 0x6e, 0x42, 0x6f, - 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x42, 0x07, 0x0a, 0x05, 0x6f, - 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x67, 0x0a, 0x14, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x4f, 0x0a, 0x15, - 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, - 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, - 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x94, 0x01, - 0x0a, 0x0e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x49, 0x74, 0x65, 0x6d, - 0x12, 0x35, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x09, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x42, 0x0a, 0x0e, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, - 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4a, 0x73, 0x6f, - 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x6a, 0x73, - 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, - 0x6e, 0x65, 0x6f, 0x66, 0x22, 0xcf, 0x03, 0x0a, 0x08, 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, - 0x6d, 0x12, 0x11, 0x0a, 0x04, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x52, 0x65, 0x66, 0x12, 0x27, 0x0a, 0x03, 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x67, 0x65, 0x74, 0x12, 0x27, 0x0a, - 0x03, 0x70, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x03, 0x70, 0x75, 0x74, 0x12, 0x29, 0x0a, 0x04, 0x70, 0x6f, 0x73, 0x74, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x32, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x70, 0x6f, 0x73, - 0x74, 0x12, 0x2d, 0x0a, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x12, 0x2f, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x12, 0x29, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x70, 0x65, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x68, 0x65, 0x61, 0x64, 0x12, 0x2b, 0x0a, 0x05, - 0x70, 0x61, 0x74, 0x63, 0x68, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x12, 0x3a, 0x0a, 0x0a, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, - 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, - 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xfb, 0x05, 0x0a, 0x16, 0x50, 0x61, 0x74, 0x68, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x20, 0x0a, - 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, - 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, - 0x31, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d, - 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, - 0x6d, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, - 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, - 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, - 0x79, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, - 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, - 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, - 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, - 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0c, 0x20, 0x01, - 0x28, 0x01, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, - 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, - 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, - 0x65, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, - 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, - 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x11, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, - 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, - 0x69, 0x71, 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x0b, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a, - 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e, - 0x75, 0x6d, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, - 0x66, 0x18, 0x15, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, - 0x65, 0x4f, 0x66, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x16, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, - 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x77, 0x0a, 0x05, 0x50, 0x61, 0x74, 0x68, 0x73, 0x12, 0x3f, 0x0a, - 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, - 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2d, - 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, - 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x92, 0x05, - 0x0a, 0x0f, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, - 0x73, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a, - 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, - 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, - 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, - 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c, - 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a, - 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, - 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, - 0x6d, 0x75, 0x6d, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, - 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, - 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, - 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, - 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x01, - 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, - 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x09, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, - 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, - 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, - 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, - 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, - 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, - 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, - 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65, - 0x6e, 0x75, 0x6d, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, - 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18, - 0x11, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f, - 0x66, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x12, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, - 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x22, 0x5a, 0x0a, 0x0a, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, - 0x12, 0x4c, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, - 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x17, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, - 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xa8, - 0x06, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, - 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, - 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x11, - 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, - 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, - 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x08, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73, - 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, - 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, - 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, - 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x01, - 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, - 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0c, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, - 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, - 0x6d, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, - 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69, - 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, - 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a, - 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0f, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, - 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x10, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, - 0x6d, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, - 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, - 0x13, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, - 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, - 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65, - 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x15, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, - 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, - 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18, 0x16, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, - 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f, 0x66, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, - 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x17, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, - 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xfe, 0x01, 0x0a, 0x08, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, - 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x49, 0x74, 0x65, 0x6d, - 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x2d, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x52, 0x07, - 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x30, 0x0a, 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, - 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x52, - 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, - 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, - 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x65, 0x0a, 0x13, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x12, 0x4e, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, - 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, - 0x6d, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, - 0x73, 0x22, 0x90, 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x08, 0x72, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x0e, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, - 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4a, 0x73, 0x6f, - 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x6a, 0x73, - 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, - 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x91, 0x01, 0x0a, 0x09, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x73, 0x12, 0x43, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x63, - 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, - 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, - 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xaf, 0x09, 0x0a, 0x06, 0x53, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x12, 0x11, 0x0a, 0x04, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x52, 0x65, 0x66, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x14, - 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, - 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, - 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, - 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, - 0x4f, 0x66, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, - 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, - 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, - 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, - 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, - 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, - 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, - 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, - 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0b, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, - 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0c, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, - 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, - 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, - 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, - 0x6d, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, - 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, - 0x6d, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, - 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x72, 0x6f, - 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6d, - 0x61, 0x78, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e, - 0x6d, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x12, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6d, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, - 0x69, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, - 0x13, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, - 0x23, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, - 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x59, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x15, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x41, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, - 0x72, 0x74, 0x69, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, - 0x28, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x49, - 0x74, 0x65, 0x6d, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x69, 0x74, 0x65, - 0x6d, 0x73, 0x18, 0x17, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, - 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x29, 0x0a, 0x06, 0x61, 0x6c, 0x6c, 0x5f, 0x6f, 0x66, - 0x18, 0x18, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x05, 0x61, 0x6c, 0x6c, 0x4f, - 0x66, 0x12, 0x36, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, - 0x19, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x52, 0x0a, 0x70, - 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x64, 0x69, 0x73, - 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0d, 0x64, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x12, - 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x1b, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x61, 0x64, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x21, 0x0a, 0x03, - 0x78, 0x6d, 0x6c, 0x18, 0x1c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x58, 0x6d, 0x6c, 0x52, 0x03, 0x78, 0x6d, 0x6c, 0x12, - 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, - 0x18, 0x1d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, - 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x29, - 0x0a, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, - 0x52, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, - 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x1f, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, - 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x7e, 0x0a, 0x0a, 0x53, 0x63, - 0x68, 0x65, 0x6d, 0x61, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x2c, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, - 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x48, 0x00, 0x52, 0x06, - 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x39, 0x0a, 0x0b, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x73, - 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x48, 0x00, 0x52, 0x0a, 0x66, 0x69, 0x6c, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x74, 0x0a, 0x13, 0x53, 0x65, - 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x12, 0x5d, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, - 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x28, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, - 0x6d, 0x65, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, - 0x22, 0xe9, 0x04, 0x0a, 0x17, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, - 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x6d, 0x0a, 0x1d, - 0x62, 0x61, 0x73, 0x69, 0x63, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x42, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x1b, - 0x62, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x46, 0x0a, 0x10, 0x61, - 0x70, 0x69, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, - 0x79, 0x48, 0x00, 0x52, 0x0e, 0x61, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x53, 0x65, 0x63, 0x75, 0x72, - 0x69, 0x74, 0x79, 0x12, 0x5e, 0x0a, 0x18, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x5f, 0x69, 0x6d, - 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x49, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, - 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x16, 0x6f, 0x61, 0x75, - 0x74, 0x68, 0x32, 0x49, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, - 0x69, 0x74, 0x79, 0x12, 0x5e, 0x0a, 0x18, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x5f, 0x70, 0x61, - 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, - 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x16, 0x6f, 0x61, 0x75, - 0x74, 0x68, 0x32, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, - 0x69, 0x74, 0x79, 0x12, 0x67, 0x0a, 0x1b, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x5f, 0x61, 0x70, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, - 0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x41, 0x70, 0x70, 0x6c, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48, - 0x00, 0x52, 0x19, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x65, 0x0a, 0x1b, - 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x6f, - 0x64, 0x65, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, - 0x61, 0x75, 0x74, 0x68, 0x32, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x53, - 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x18, 0x6f, 0x61, 0x75, 0x74, 0x68, - 0x32, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x63, 0x75, 0x72, - 0x69, 0x74, 0x79, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x68, 0x0a, 0x13, - 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x51, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, - 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x41, 0x72, 0x72, 0x61, 0x79, - 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, - 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x23, 0x0a, 0x0b, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xbb, 0x01, 0x0a, 0x03, - 0x54, 0x61, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, - 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, - 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x20, 0x0a, 0x08, 0x54, 0x79, 0x70, - 0x65, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x5c, 0x0a, 0x0f, 0x56, - 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x49, - 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, - 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, - 0x41, 0x6e, 0x79, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, - 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xc8, 0x01, 0x0a, 0x03, 0x58, 0x6d, - 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x1c, 0x0a, 0x09, 0x61, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, - 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x77, 0x72, 0x61, - 0x70, 0x70, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x77, 0x72, 0x61, 0x70, - 0x70, 0x65, 0x64, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, - 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x3e, 0x0a, 0x0e, 0x6f, 0x72, 0x67, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x5f, 0x76, 0x32, 0x42, 0x0c, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x50, 0x49, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x16, 0x2e, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x76, 0x32, 0x3b, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x32, 0xa2, 0x02, - 0x03, 0x4f, 0x41, 0x53, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_openapiv2_OpenAPIv2_proto_rawDescOnce sync.Once - file_openapiv2_OpenAPIv2_proto_rawDescData = file_openapiv2_OpenAPIv2_proto_rawDesc -) - -func file_openapiv2_OpenAPIv2_proto_rawDescGZIP() []byte { - file_openapiv2_OpenAPIv2_proto_rawDescOnce.Do(func() { - file_openapiv2_OpenAPIv2_proto_rawDescData = protoimpl.X.CompressGZIP(file_openapiv2_OpenAPIv2_proto_rawDescData) - }) - return file_openapiv2_OpenAPIv2_proto_rawDescData -} - -var file_openapiv2_OpenAPIv2_proto_msgTypes = make([]protoimpl.MessageInfo, 60) -var file_openapiv2_OpenAPIv2_proto_goTypes = []interface{}{ - (*AdditionalPropertiesItem)(nil), // 0: openapi.v2.AdditionalPropertiesItem - (*Any)(nil), // 1: openapi.v2.Any - (*ApiKeySecurity)(nil), // 2: openapi.v2.ApiKeySecurity - (*BasicAuthenticationSecurity)(nil), // 3: openapi.v2.BasicAuthenticationSecurity - (*BodyParameter)(nil), // 4: openapi.v2.BodyParameter - (*Contact)(nil), // 5: openapi.v2.Contact - (*Default)(nil), // 6: openapi.v2.Default - (*Definitions)(nil), // 7: openapi.v2.Definitions - (*Document)(nil), // 8: openapi.v2.Document - (*Examples)(nil), // 9: openapi.v2.Examples - (*ExternalDocs)(nil), // 10: openapi.v2.ExternalDocs - (*FileSchema)(nil), // 11: openapi.v2.FileSchema - (*FormDataParameterSubSchema)(nil), // 12: openapi.v2.FormDataParameterSubSchema - (*Header)(nil), // 13: openapi.v2.Header - (*HeaderParameterSubSchema)(nil), // 14: openapi.v2.HeaderParameterSubSchema - (*Headers)(nil), // 15: openapi.v2.Headers - (*Info)(nil), // 16: openapi.v2.Info - (*ItemsItem)(nil), // 17: openapi.v2.ItemsItem - (*JsonReference)(nil), // 18: openapi.v2.JsonReference - (*License)(nil), // 19: openapi.v2.License - (*NamedAny)(nil), // 20: openapi.v2.NamedAny - (*NamedHeader)(nil), // 21: openapi.v2.NamedHeader - (*NamedParameter)(nil), // 22: openapi.v2.NamedParameter - (*NamedPathItem)(nil), // 23: openapi.v2.NamedPathItem - (*NamedResponse)(nil), // 24: openapi.v2.NamedResponse - (*NamedResponseValue)(nil), // 25: openapi.v2.NamedResponseValue - (*NamedSchema)(nil), // 26: openapi.v2.NamedSchema - (*NamedSecurityDefinitionsItem)(nil), // 27: openapi.v2.NamedSecurityDefinitionsItem - (*NamedString)(nil), // 28: openapi.v2.NamedString - (*NamedStringArray)(nil), // 29: openapi.v2.NamedStringArray - (*NonBodyParameter)(nil), // 30: openapi.v2.NonBodyParameter - (*Oauth2AccessCodeSecurity)(nil), // 31: openapi.v2.Oauth2AccessCodeSecurity - (*Oauth2ApplicationSecurity)(nil), // 32: openapi.v2.Oauth2ApplicationSecurity - (*Oauth2ImplicitSecurity)(nil), // 33: openapi.v2.Oauth2ImplicitSecurity - (*Oauth2PasswordSecurity)(nil), // 34: openapi.v2.Oauth2PasswordSecurity - (*Oauth2Scopes)(nil), // 35: openapi.v2.Oauth2Scopes - (*Operation)(nil), // 36: openapi.v2.Operation - (*Parameter)(nil), // 37: openapi.v2.Parameter - (*ParameterDefinitions)(nil), // 38: openapi.v2.ParameterDefinitions - (*ParametersItem)(nil), // 39: openapi.v2.ParametersItem - (*PathItem)(nil), // 40: openapi.v2.PathItem - (*PathParameterSubSchema)(nil), // 41: openapi.v2.PathParameterSubSchema - (*Paths)(nil), // 42: openapi.v2.Paths - (*PrimitivesItems)(nil), // 43: openapi.v2.PrimitivesItems - (*Properties)(nil), // 44: openapi.v2.Properties - (*QueryParameterSubSchema)(nil), // 45: openapi.v2.QueryParameterSubSchema - (*Response)(nil), // 46: openapi.v2.Response - (*ResponseDefinitions)(nil), // 47: openapi.v2.ResponseDefinitions - (*ResponseValue)(nil), // 48: openapi.v2.ResponseValue - (*Responses)(nil), // 49: openapi.v2.Responses - (*Schema)(nil), // 50: openapi.v2.Schema - (*SchemaItem)(nil), // 51: openapi.v2.SchemaItem - (*SecurityDefinitions)(nil), // 52: openapi.v2.SecurityDefinitions - (*SecurityDefinitionsItem)(nil), // 53: openapi.v2.SecurityDefinitionsItem - (*SecurityRequirement)(nil), // 54: openapi.v2.SecurityRequirement - (*StringArray)(nil), // 55: openapi.v2.StringArray - (*Tag)(nil), // 56: openapi.v2.Tag - (*TypeItem)(nil), // 57: openapi.v2.TypeItem - (*VendorExtension)(nil), // 58: openapi.v2.VendorExtension - (*Xml)(nil), // 59: openapi.v2.Xml - (*anypb.Any)(nil), // 60: google.protobuf.Any -} -var file_openapiv2_OpenAPIv2_proto_depIdxs = []int32{ - 50, // 0: openapi.v2.AdditionalPropertiesItem.schema:type_name -> openapi.v2.Schema - 60, // 1: openapi.v2.Any.value:type_name -> google.protobuf.Any - 20, // 2: openapi.v2.ApiKeySecurity.vendor_extension:type_name -> openapi.v2.NamedAny - 20, // 3: openapi.v2.BasicAuthenticationSecurity.vendor_extension:type_name -> openapi.v2.NamedAny - 50, // 4: openapi.v2.BodyParameter.schema:type_name -> openapi.v2.Schema - 20, // 5: openapi.v2.BodyParameter.vendor_extension:type_name -> openapi.v2.NamedAny - 20, // 6: openapi.v2.Contact.vendor_extension:type_name -> openapi.v2.NamedAny - 20, // 7: openapi.v2.Default.additional_properties:type_name -> openapi.v2.NamedAny - 26, // 8: openapi.v2.Definitions.additional_properties:type_name -> openapi.v2.NamedSchema - 16, // 9: openapi.v2.Document.info:type_name -> openapi.v2.Info - 42, // 10: openapi.v2.Document.paths:type_name -> openapi.v2.Paths - 7, // 11: openapi.v2.Document.definitions:type_name -> openapi.v2.Definitions - 38, // 12: openapi.v2.Document.parameters:type_name -> openapi.v2.ParameterDefinitions - 47, // 13: openapi.v2.Document.responses:type_name -> openapi.v2.ResponseDefinitions - 54, // 14: openapi.v2.Document.security:type_name -> openapi.v2.SecurityRequirement - 52, // 15: openapi.v2.Document.security_definitions:type_name -> openapi.v2.SecurityDefinitions - 56, // 16: openapi.v2.Document.tags:type_name -> openapi.v2.Tag - 10, // 17: openapi.v2.Document.external_docs:type_name -> openapi.v2.ExternalDocs - 20, // 18: openapi.v2.Document.vendor_extension:type_name -> openapi.v2.NamedAny - 20, // 19: openapi.v2.Examples.additional_properties:type_name -> openapi.v2.NamedAny - 20, // 20: openapi.v2.ExternalDocs.vendor_extension:type_name -> openapi.v2.NamedAny - 1, // 21: openapi.v2.FileSchema.default:type_name -> openapi.v2.Any - 10, // 22: openapi.v2.FileSchema.external_docs:type_name -> openapi.v2.ExternalDocs - 1, // 23: openapi.v2.FileSchema.example:type_name -> openapi.v2.Any - 20, // 24: openapi.v2.FileSchema.vendor_extension:type_name -> openapi.v2.NamedAny - 43, // 25: openapi.v2.FormDataParameterSubSchema.items:type_name -> openapi.v2.PrimitivesItems - 1, // 26: openapi.v2.FormDataParameterSubSchema.default:type_name -> openapi.v2.Any - 1, // 27: openapi.v2.FormDataParameterSubSchema.enum:type_name -> openapi.v2.Any - 20, // 28: openapi.v2.FormDataParameterSubSchema.vendor_extension:type_name -> openapi.v2.NamedAny - 43, // 29: openapi.v2.Header.items:type_name -> openapi.v2.PrimitivesItems - 1, // 30: openapi.v2.Header.default:type_name -> openapi.v2.Any - 1, // 31: openapi.v2.Header.enum:type_name -> openapi.v2.Any - 20, // 32: openapi.v2.Header.vendor_extension:type_name -> openapi.v2.NamedAny - 43, // 33: openapi.v2.HeaderParameterSubSchema.items:type_name -> openapi.v2.PrimitivesItems - 1, // 34: openapi.v2.HeaderParameterSubSchema.default:type_name -> openapi.v2.Any - 1, // 35: openapi.v2.HeaderParameterSubSchema.enum:type_name -> openapi.v2.Any - 20, // 36: openapi.v2.HeaderParameterSubSchema.vendor_extension:type_name -> openapi.v2.NamedAny - 21, // 37: openapi.v2.Headers.additional_properties:type_name -> openapi.v2.NamedHeader - 5, // 38: openapi.v2.Info.contact:type_name -> openapi.v2.Contact - 19, // 39: openapi.v2.Info.license:type_name -> openapi.v2.License - 20, // 40: openapi.v2.Info.vendor_extension:type_name -> openapi.v2.NamedAny - 50, // 41: openapi.v2.ItemsItem.schema:type_name -> openapi.v2.Schema - 20, // 42: openapi.v2.License.vendor_extension:type_name -> openapi.v2.NamedAny - 1, // 43: openapi.v2.NamedAny.value:type_name -> openapi.v2.Any - 13, // 44: openapi.v2.NamedHeader.value:type_name -> openapi.v2.Header - 37, // 45: openapi.v2.NamedParameter.value:type_name -> openapi.v2.Parameter - 40, // 46: openapi.v2.NamedPathItem.value:type_name -> openapi.v2.PathItem - 46, // 47: openapi.v2.NamedResponse.value:type_name -> openapi.v2.Response - 48, // 48: openapi.v2.NamedResponseValue.value:type_name -> openapi.v2.ResponseValue - 50, // 49: openapi.v2.NamedSchema.value:type_name -> openapi.v2.Schema - 53, // 50: openapi.v2.NamedSecurityDefinitionsItem.value:type_name -> openapi.v2.SecurityDefinitionsItem - 55, // 51: openapi.v2.NamedStringArray.value:type_name -> openapi.v2.StringArray - 14, // 52: openapi.v2.NonBodyParameter.header_parameter_sub_schema:type_name -> openapi.v2.HeaderParameterSubSchema - 12, // 53: openapi.v2.NonBodyParameter.form_data_parameter_sub_schema:type_name -> openapi.v2.FormDataParameterSubSchema - 45, // 54: openapi.v2.NonBodyParameter.query_parameter_sub_schema:type_name -> openapi.v2.QueryParameterSubSchema - 41, // 55: openapi.v2.NonBodyParameter.path_parameter_sub_schema:type_name -> openapi.v2.PathParameterSubSchema - 35, // 56: openapi.v2.Oauth2AccessCodeSecurity.scopes:type_name -> openapi.v2.Oauth2Scopes - 20, // 57: openapi.v2.Oauth2AccessCodeSecurity.vendor_extension:type_name -> openapi.v2.NamedAny - 35, // 58: openapi.v2.Oauth2ApplicationSecurity.scopes:type_name -> openapi.v2.Oauth2Scopes - 20, // 59: openapi.v2.Oauth2ApplicationSecurity.vendor_extension:type_name -> openapi.v2.NamedAny - 35, // 60: openapi.v2.Oauth2ImplicitSecurity.scopes:type_name -> openapi.v2.Oauth2Scopes - 20, // 61: openapi.v2.Oauth2ImplicitSecurity.vendor_extension:type_name -> openapi.v2.NamedAny - 35, // 62: openapi.v2.Oauth2PasswordSecurity.scopes:type_name -> openapi.v2.Oauth2Scopes - 20, // 63: openapi.v2.Oauth2PasswordSecurity.vendor_extension:type_name -> openapi.v2.NamedAny - 28, // 64: openapi.v2.Oauth2Scopes.additional_properties:type_name -> openapi.v2.NamedString - 10, // 65: openapi.v2.Operation.external_docs:type_name -> openapi.v2.ExternalDocs - 39, // 66: openapi.v2.Operation.parameters:type_name -> openapi.v2.ParametersItem - 49, // 67: openapi.v2.Operation.responses:type_name -> openapi.v2.Responses - 54, // 68: openapi.v2.Operation.security:type_name -> openapi.v2.SecurityRequirement - 20, // 69: openapi.v2.Operation.vendor_extension:type_name -> openapi.v2.NamedAny - 4, // 70: openapi.v2.Parameter.body_parameter:type_name -> openapi.v2.BodyParameter - 30, // 71: openapi.v2.Parameter.non_body_parameter:type_name -> openapi.v2.NonBodyParameter - 22, // 72: openapi.v2.ParameterDefinitions.additional_properties:type_name -> openapi.v2.NamedParameter - 37, // 73: openapi.v2.ParametersItem.parameter:type_name -> openapi.v2.Parameter - 18, // 74: openapi.v2.ParametersItem.json_reference:type_name -> openapi.v2.JsonReference - 36, // 75: openapi.v2.PathItem.get:type_name -> openapi.v2.Operation - 36, // 76: openapi.v2.PathItem.put:type_name -> openapi.v2.Operation - 36, // 77: openapi.v2.PathItem.post:type_name -> openapi.v2.Operation - 36, // 78: openapi.v2.PathItem.delete:type_name -> openapi.v2.Operation - 36, // 79: openapi.v2.PathItem.options:type_name -> openapi.v2.Operation - 36, // 80: openapi.v2.PathItem.head:type_name -> openapi.v2.Operation - 36, // 81: openapi.v2.PathItem.patch:type_name -> openapi.v2.Operation - 39, // 82: openapi.v2.PathItem.parameters:type_name -> openapi.v2.ParametersItem - 20, // 83: openapi.v2.PathItem.vendor_extension:type_name -> openapi.v2.NamedAny - 43, // 84: openapi.v2.PathParameterSubSchema.items:type_name -> openapi.v2.PrimitivesItems - 1, // 85: openapi.v2.PathParameterSubSchema.default:type_name -> openapi.v2.Any - 1, // 86: openapi.v2.PathParameterSubSchema.enum:type_name -> openapi.v2.Any - 20, // 87: openapi.v2.PathParameterSubSchema.vendor_extension:type_name -> openapi.v2.NamedAny - 20, // 88: openapi.v2.Paths.vendor_extension:type_name -> openapi.v2.NamedAny - 23, // 89: openapi.v2.Paths.path:type_name -> openapi.v2.NamedPathItem - 43, // 90: openapi.v2.PrimitivesItems.items:type_name -> openapi.v2.PrimitivesItems - 1, // 91: openapi.v2.PrimitivesItems.default:type_name -> openapi.v2.Any - 1, // 92: openapi.v2.PrimitivesItems.enum:type_name -> openapi.v2.Any - 20, // 93: openapi.v2.PrimitivesItems.vendor_extension:type_name -> openapi.v2.NamedAny - 26, // 94: openapi.v2.Properties.additional_properties:type_name -> openapi.v2.NamedSchema - 43, // 95: openapi.v2.QueryParameterSubSchema.items:type_name -> openapi.v2.PrimitivesItems - 1, // 96: openapi.v2.QueryParameterSubSchema.default:type_name -> openapi.v2.Any - 1, // 97: openapi.v2.QueryParameterSubSchema.enum:type_name -> openapi.v2.Any - 20, // 98: openapi.v2.QueryParameterSubSchema.vendor_extension:type_name -> openapi.v2.NamedAny - 51, // 99: openapi.v2.Response.schema:type_name -> openapi.v2.SchemaItem - 15, // 100: openapi.v2.Response.headers:type_name -> openapi.v2.Headers - 9, // 101: openapi.v2.Response.examples:type_name -> openapi.v2.Examples - 20, // 102: openapi.v2.Response.vendor_extension:type_name -> openapi.v2.NamedAny - 24, // 103: openapi.v2.ResponseDefinitions.additional_properties:type_name -> openapi.v2.NamedResponse - 46, // 104: openapi.v2.ResponseValue.response:type_name -> openapi.v2.Response - 18, // 105: openapi.v2.ResponseValue.json_reference:type_name -> openapi.v2.JsonReference - 25, // 106: openapi.v2.Responses.response_code:type_name -> openapi.v2.NamedResponseValue - 20, // 107: openapi.v2.Responses.vendor_extension:type_name -> openapi.v2.NamedAny - 1, // 108: openapi.v2.Schema.default:type_name -> openapi.v2.Any - 1, // 109: openapi.v2.Schema.enum:type_name -> openapi.v2.Any - 0, // 110: openapi.v2.Schema.additional_properties:type_name -> openapi.v2.AdditionalPropertiesItem - 57, // 111: openapi.v2.Schema.type:type_name -> openapi.v2.TypeItem - 17, // 112: openapi.v2.Schema.items:type_name -> openapi.v2.ItemsItem - 50, // 113: openapi.v2.Schema.all_of:type_name -> openapi.v2.Schema - 44, // 114: openapi.v2.Schema.properties:type_name -> openapi.v2.Properties - 59, // 115: openapi.v2.Schema.xml:type_name -> openapi.v2.Xml - 10, // 116: openapi.v2.Schema.external_docs:type_name -> openapi.v2.ExternalDocs - 1, // 117: openapi.v2.Schema.example:type_name -> openapi.v2.Any - 20, // 118: openapi.v2.Schema.vendor_extension:type_name -> openapi.v2.NamedAny - 50, // 119: openapi.v2.SchemaItem.schema:type_name -> openapi.v2.Schema - 11, // 120: openapi.v2.SchemaItem.file_schema:type_name -> openapi.v2.FileSchema - 27, // 121: openapi.v2.SecurityDefinitions.additional_properties:type_name -> openapi.v2.NamedSecurityDefinitionsItem - 3, // 122: openapi.v2.SecurityDefinitionsItem.basic_authentication_security:type_name -> openapi.v2.BasicAuthenticationSecurity - 2, // 123: openapi.v2.SecurityDefinitionsItem.api_key_security:type_name -> openapi.v2.ApiKeySecurity - 33, // 124: openapi.v2.SecurityDefinitionsItem.oauth2_implicit_security:type_name -> openapi.v2.Oauth2ImplicitSecurity - 34, // 125: openapi.v2.SecurityDefinitionsItem.oauth2_password_security:type_name -> openapi.v2.Oauth2PasswordSecurity - 32, // 126: openapi.v2.SecurityDefinitionsItem.oauth2_application_security:type_name -> openapi.v2.Oauth2ApplicationSecurity - 31, // 127: openapi.v2.SecurityDefinitionsItem.oauth2_access_code_security:type_name -> openapi.v2.Oauth2AccessCodeSecurity - 29, // 128: openapi.v2.SecurityRequirement.additional_properties:type_name -> openapi.v2.NamedStringArray - 10, // 129: openapi.v2.Tag.external_docs:type_name -> openapi.v2.ExternalDocs - 20, // 130: openapi.v2.Tag.vendor_extension:type_name -> openapi.v2.NamedAny - 20, // 131: openapi.v2.VendorExtension.additional_properties:type_name -> openapi.v2.NamedAny - 20, // 132: openapi.v2.Xml.vendor_extension:type_name -> openapi.v2.NamedAny - 133, // [133:133] is the sub-list for method output_type - 133, // [133:133] is the sub-list for method input_type - 133, // [133:133] is the sub-list for extension type_name - 133, // [133:133] is the sub-list for extension extendee - 0, // [0:133] is the sub-list for field type_name -} - -func init() { file_openapiv2_OpenAPIv2_proto_init() } -func file_openapiv2_OpenAPIv2_proto_init() { - if File_openapiv2_OpenAPIv2_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_openapiv2_OpenAPIv2_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdditionalPropertiesItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Any); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ApiKeySecurity); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BasicAuthenticationSecurity); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BodyParameter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Contact); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Default); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Definitions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Document); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Examples); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExternalDocs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileSchema); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FormDataParameterSubSchema); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Header); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HeaderParameterSubSchema); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Headers); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ItemsItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*JsonReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*License); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedAny); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedHeader); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedParameter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedPathItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedResponseValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedSchema); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedSecurityDefinitionsItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedString); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedStringArray); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NonBodyParameter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Oauth2AccessCodeSecurity); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Oauth2ApplicationSecurity); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Oauth2ImplicitSecurity); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Oauth2PasswordSecurity); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Oauth2Scopes); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Operation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Parameter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParameterDefinitions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParametersItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PathItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PathParameterSubSchema); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Paths); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PrimitivesItems); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Properties); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryParameterSubSchema); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Response); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResponseDefinitions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResponseValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Responses); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[50].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Schema); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[51].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SchemaItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[52].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SecurityDefinitions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[53].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SecurityDefinitionsItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[54].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SecurityRequirement); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[55].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StringArray); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[56].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Tag); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[57].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TypeItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[58].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*VendorExtension); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[59].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Xml); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*AdditionalPropertiesItem_Schema)(nil), - (*AdditionalPropertiesItem_Boolean)(nil), - } - file_openapiv2_OpenAPIv2_proto_msgTypes[30].OneofWrappers = []interface{}{ - (*NonBodyParameter_HeaderParameterSubSchema)(nil), - (*NonBodyParameter_FormDataParameterSubSchema)(nil), - (*NonBodyParameter_QueryParameterSubSchema)(nil), - (*NonBodyParameter_PathParameterSubSchema)(nil), - } - file_openapiv2_OpenAPIv2_proto_msgTypes[37].OneofWrappers = []interface{}{ - (*Parameter_BodyParameter)(nil), - (*Parameter_NonBodyParameter)(nil), - } - file_openapiv2_OpenAPIv2_proto_msgTypes[39].OneofWrappers = []interface{}{ - (*ParametersItem_Parameter)(nil), - (*ParametersItem_JsonReference)(nil), - } - file_openapiv2_OpenAPIv2_proto_msgTypes[48].OneofWrappers = []interface{}{ - (*ResponseValue_Response)(nil), - (*ResponseValue_JsonReference)(nil), - } - file_openapiv2_OpenAPIv2_proto_msgTypes[51].OneofWrappers = []interface{}{ - (*SchemaItem_Schema)(nil), - (*SchemaItem_FileSchema)(nil), - } - file_openapiv2_OpenAPIv2_proto_msgTypes[53].OneofWrappers = []interface{}{ - (*SecurityDefinitionsItem_BasicAuthenticationSecurity)(nil), - (*SecurityDefinitionsItem_ApiKeySecurity)(nil), - (*SecurityDefinitionsItem_Oauth2ImplicitSecurity)(nil), - (*SecurityDefinitionsItem_Oauth2PasswordSecurity)(nil), - (*SecurityDefinitionsItem_Oauth2ApplicationSecurity)(nil), - (*SecurityDefinitionsItem_Oauth2AccessCodeSecurity)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_openapiv2_OpenAPIv2_proto_rawDesc, - NumEnums: 0, - NumMessages: 60, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_openapiv2_OpenAPIv2_proto_goTypes, - DependencyIndexes: file_openapiv2_OpenAPIv2_proto_depIdxs, - MessageInfos: file_openapiv2_OpenAPIv2_proto_msgTypes, - }.Build() - File_openapiv2_OpenAPIv2_proto = out.File - file_openapiv2_OpenAPIv2_proto_rawDesc = nil - file_openapiv2_OpenAPIv2_proto_goTypes = nil - file_openapiv2_OpenAPIv2_proto_depIdxs = nil -} diff --git a/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.proto b/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.proto deleted file mode 100644 index 1c59b2f4a..000000000 --- a/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.proto +++ /dev/null @@ -1,666 +0,0 @@ -// Copyright 2020 Google LLC. All Rights Reserved. -// -// 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. - -// THIS FILE IS AUTOMATICALLY GENERATED. - -syntax = "proto3"; - -package openapi.v2; - -import "google/protobuf/any.proto"; - -// This option lets the proto compiler generate Java code inside the package -// name (see below) instead of inside an outer class. It creates a simpler -// developer experience by reducing one-level of name nesting and be -// consistent with most programming languages that don't support outer classes. -option java_multiple_files = true; - -// The Java outer classname should be the filename in UpperCamelCase. This -// class is only used to hold proto descriptor, so developers don't need to -// work with it directly. -option java_outer_classname = "OpenAPIProto"; - -// The Java package name must be proto package name with proper prefix. -option java_package = "org.openapi_v2"; - -// A reasonable prefix for the Objective-C symbols generated from the package. -// It should at a minimum be 3 characters long, all uppercase, and convention -// is to use an abbreviation of the package name. Something short, but -// hopefully unique enough to not conflict with things that may come along in -// the future. 'GPB' is reserved for the protocol buffer implementation itself. -option objc_class_prefix = "OAS"; - -// The Go package name. -option go_package = "./openapiv2;openapi_v2"; - -message AdditionalPropertiesItem { - oneof oneof { - Schema schema = 1; - bool boolean = 2; - } -} - -message Any { - google.protobuf.Any value = 1; - string yaml = 2; -} - -message ApiKeySecurity { - string type = 1; - string name = 2; - string in = 3; - string description = 4; - repeated NamedAny vendor_extension = 5; -} - -message BasicAuthenticationSecurity { - string type = 1; - string description = 2; - repeated NamedAny vendor_extension = 3; -} - -message BodyParameter { - // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. - string description = 1; - // The name of the parameter. - string name = 2; - // Determines the location of the parameter. - string in = 3; - // Determines whether or not this parameter is required or optional. - bool required = 4; - Schema schema = 5; - repeated NamedAny vendor_extension = 6; -} - -// Contact information for the owners of the API. -message Contact { - // The identifying name of the contact person/organization. - string name = 1; - // The URL pointing to the contact information. - string url = 2; - // The email address of the contact person/organization. - string email = 3; - repeated NamedAny vendor_extension = 4; -} - -message Default { - repeated NamedAny additional_properties = 1; -} - -// One or more JSON objects describing the schemas being consumed and produced by the API. -message Definitions { - repeated NamedSchema additional_properties = 1; -} - -message Document { - // The Swagger version of this document. - string swagger = 1; - Info info = 2; - // The host (name or ip) of the API. Example: 'swagger.io' - string host = 3; - // The base path to the API. Example: '/api'. - string base_path = 4; - // The transfer protocol of the API. - repeated string schemes = 5; - // A list of MIME types accepted by the API. - repeated string consumes = 6; - // A list of MIME types the API can produce. - repeated string produces = 7; - Paths paths = 8; - Definitions definitions = 9; - ParameterDefinitions parameters = 10; - ResponseDefinitions responses = 11; - repeated SecurityRequirement security = 12; - SecurityDefinitions security_definitions = 13; - repeated Tag tags = 14; - ExternalDocs external_docs = 15; - repeated NamedAny vendor_extension = 16; -} - -message Examples { - repeated NamedAny additional_properties = 1; -} - -// information about external documentation -message ExternalDocs { - string description = 1; - string url = 2; - repeated NamedAny vendor_extension = 3; -} - -// A deterministic version of a JSON Schema object. -message FileSchema { - string format = 1; - string title = 2; - string description = 3; - Any default = 4; - repeated string required = 5; - string type = 6; - bool read_only = 7; - ExternalDocs external_docs = 8; - Any example = 9; - repeated NamedAny vendor_extension = 10; -} - -message FormDataParameterSubSchema { - // Determines whether or not this parameter is required or optional. - bool required = 1; - // Determines the location of the parameter. - string in = 2; - // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. - string description = 3; - // The name of the parameter. - string name = 4; - // allows sending a parameter by name only or with an empty value. - bool allow_empty_value = 5; - string type = 6; - string format = 7; - PrimitivesItems items = 8; - string collection_format = 9; - Any default = 10; - double maximum = 11; - bool exclusive_maximum = 12; - double minimum = 13; - bool exclusive_minimum = 14; - int64 max_length = 15; - int64 min_length = 16; - string pattern = 17; - int64 max_items = 18; - int64 min_items = 19; - bool unique_items = 20; - repeated Any enum = 21; - double multiple_of = 22; - repeated NamedAny vendor_extension = 23; -} - -message Header { - string type = 1; - string format = 2; - PrimitivesItems items = 3; - string collection_format = 4; - Any default = 5; - double maximum = 6; - bool exclusive_maximum = 7; - double minimum = 8; - bool exclusive_minimum = 9; - int64 max_length = 10; - int64 min_length = 11; - string pattern = 12; - int64 max_items = 13; - int64 min_items = 14; - bool unique_items = 15; - repeated Any enum = 16; - double multiple_of = 17; - string description = 18; - repeated NamedAny vendor_extension = 19; -} - -message HeaderParameterSubSchema { - // Determines whether or not this parameter is required or optional. - bool required = 1; - // Determines the location of the parameter. - string in = 2; - // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. - string description = 3; - // The name of the parameter. - string name = 4; - string type = 5; - string format = 6; - PrimitivesItems items = 7; - string collection_format = 8; - Any default = 9; - double maximum = 10; - bool exclusive_maximum = 11; - double minimum = 12; - bool exclusive_minimum = 13; - int64 max_length = 14; - int64 min_length = 15; - string pattern = 16; - int64 max_items = 17; - int64 min_items = 18; - bool unique_items = 19; - repeated Any enum = 20; - double multiple_of = 21; - repeated NamedAny vendor_extension = 22; -} - -message Headers { - repeated NamedHeader additional_properties = 1; -} - -// General information about the API. -message Info { - // A unique and precise title of the API. - string title = 1; - // A semantic version number of the API. - string version = 2; - // A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed. - string description = 3; - // The terms of service for the API. - string terms_of_service = 4; - Contact contact = 5; - License license = 6; - repeated NamedAny vendor_extension = 7; -} - -message ItemsItem { - repeated Schema schema = 1; -} - -message JsonReference { - string _ref = 1; - string description = 2; -} - -message License { - // The name of the license type. It's encouraged to use an OSI compatible license. - string name = 1; - // The URL pointing to the license. - string url = 2; - repeated NamedAny vendor_extension = 3; -} - -// Automatically-generated message used to represent maps of Any as ordered (name,value) pairs. -message NamedAny { - // Map key - string name = 1; - // Mapped value - Any value = 2; -} - -// Automatically-generated message used to represent maps of Header as ordered (name,value) pairs. -message NamedHeader { - // Map key - string name = 1; - // Mapped value - Header value = 2; -} - -// Automatically-generated message used to represent maps of Parameter as ordered (name,value) pairs. -message NamedParameter { - // Map key - string name = 1; - // Mapped value - Parameter value = 2; -} - -// Automatically-generated message used to represent maps of PathItem as ordered (name,value) pairs. -message NamedPathItem { - // Map key - string name = 1; - // Mapped value - PathItem value = 2; -} - -// Automatically-generated message used to represent maps of Response as ordered (name,value) pairs. -message NamedResponse { - // Map key - string name = 1; - // Mapped value - Response value = 2; -} - -// Automatically-generated message used to represent maps of ResponseValue as ordered (name,value) pairs. -message NamedResponseValue { - // Map key - string name = 1; - // Mapped value - ResponseValue value = 2; -} - -// Automatically-generated message used to represent maps of Schema as ordered (name,value) pairs. -message NamedSchema { - // Map key - string name = 1; - // Mapped value - Schema value = 2; -} - -// Automatically-generated message used to represent maps of SecurityDefinitionsItem as ordered (name,value) pairs. -message NamedSecurityDefinitionsItem { - // Map key - string name = 1; - // Mapped value - SecurityDefinitionsItem value = 2; -} - -// Automatically-generated message used to represent maps of string as ordered (name,value) pairs. -message NamedString { - // Map key - string name = 1; - // Mapped value - string value = 2; -} - -// Automatically-generated message used to represent maps of StringArray as ordered (name,value) pairs. -message NamedStringArray { - // Map key - string name = 1; - // Mapped value - StringArray value = 2; -} - -message NonBodyParameter { - oneof oneof { - HeaderParameterSubSchema header_parameter_sub_schema = 1; - FormDataParameterSubSchema form_data_parameter_sub_schema = 2; - QueryParameterSubSchema query_parameter_sub_schema = 3; - PathParameterSubSchema path_parameter_sub_schema = 4; - } -} - -message Oauth2AccessCodeSecurity { - string type = 1; - string flow = 2; - Oauth2Scopes scopes = 3; - string authorization_url = 4; - string token_url = 5; - string description = 6; - repeated NamedAny vendor_extension = 7; -} - -message Oauth2ApplicationSecurity { - string type = 1; - string flow = 2; - Oauth2Scopes scopes = 3; - string token_url = 4; - string description = 5; - repeated NamedAny vendor_extension = 6; -} - -message Oauth2ImplicitSecurity { - string type = 1; - string flow = 2; - Oauth2Scopes scopes = 3; - string authorization_url = 4; - string description = 5; - repeated NamedAny vendor_extension = 6; -} - -message Oauth2PasswordSecurity { - string type = 1; - string flow = 2; - Oauth2Scopes scopes = 3; - string token_url = 4; - string description = 5; - repeated NamedAny vendor_extension = 6; -} - -message Oauth2Scopes { - repeated NamedString additional_properties = 1; -} - -message Operation { - repeated string tags = 1; - // A brief summary of the operation. - string summary = 2; - // A longer description of the operation, GitHub Flavored Markdown is allowed. - string description = 3; - ExternalDocs external_docs = 4; - // A unique identifier of the operation. - string operation_id = 5; - // A list of MIME types the API can produce. - repeated string produces = 6; - // A list of MIME types the API can consume. - repeated string consumes = 7; - // The parameters needed to send a valid API call. - repeated ParametersItem parameters = 8; - Responses responses = 9; - // The transfer protocol of the API. - repeated string schemes = 10; - bool deprecated = 11; - repeated SecurityRequirement security = 12; - repeated NamedAny vendor_extension = 13; -} - -message Parameter { - oneof oneof { - BodyParameter body_parameter = 1; - NonBodyParameter non_body_parameter = 2; - } -} - -// One or more JSON representations for parameters -message ParameterDefinitions { - repeated NamedParameter additional_properties = 1; -} - -message ParametersItem { - oneof oneof { - Parameter parameter = 1; - JsonReference json_reference = 2; - } -} - -message PathItem { - string _ref = 1; - Operation get = 2; - Operation put = 3; - Operation post = 4; - Operation delete = 5; - Operation options = 6; - Operation head = 7; - Operation patch = 8; - // The parameters needed to send a valid API call. - repeated ParametersItem parameters = 9; - repeated NamedAny vendor_extension = 10; -} - -message PathParameterSubSchema { - // Determines whether or not this parameter is required or optional. - bool required = 1; - // Determines the location of the parameter. - string in = 2; - // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. - string description = 3; - // The name of the parameter. - string name = 4; - string type = 5; - string format = 6; - PrimitivesItems items = 7; - string collection_format = 8; - Any default = 9; - double maximum = 10; - bool exclusive_maximum = 11; - double minimum = 12; - bool exclusive_minimum = 13; - int64 max_length = 14; - int64 min_length = 15; - string pattern = 16; - int64 max_items = 17; - int64 min_items = 18; - bool unique_items = 19; - repeated Any enum = 20; - double multiple_of = 21; - repeated NamedAny vendor_extension = 22; -} - -// Relative paths to the individual endpoints. They must be relative to the 'basePath'. -message Paths { - repeated NamedAny vendor_extension = 1; - repeated NamedPathItem path = 2; -} - -message PrimitivesItems { - string type = 1; - string format = 2; - PrimitivesItems items = 3; - string collection_format = 4; - Any default = 5; - double maximum = 6; - bool exclusive_maximum = 7; - double minimum = 8; - bool exclusive_minimum = 9; - int64 max_length = 10; - int64 min_length = 11; - string pattern = 12; - int64 max_items = 13; - int64 min_items = 14; - bool unique_items = 15; - repeated Any enum = 16; - double multiple_of = 17; - repeated NamedAny vendor_extension = 18; -} - -message Properties { - repeated NamedSchema additional_properties = 1; -} - -message QueryParameterSubSchema { - // Determines whether or not this parameter is required or optional. - bool required = 1; - // Determines the location of the parameter. - string in = 2; - // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. - string description = 3; - // The name of the parameter. - string name = 4; - // allows sending a parameter by name only or with an empty value. - bool allow_empty_value = 5; - string type = 6; - string format = 7; - PrimitivesItems items = 8; - string collection_format = 9; - Any default = 10; - double maximum = 11; - bool exclusive_maximum = 12; - double minimum = 13; - bool exclusive_minimum = 14; - int64 max_length = 15; - int64 min_length = 16; - string pattern = 17; - int64 max_items = 18; - int64 min_items = 19; - bool unique_items = 20; - repeated Any enum = 21; - double multiple_of = 22; - repeated NamedAny vendor_extension = 23; -} - -message Response { - string description = 1; - SchemaItem schema = 2; - Headers headers = 3; - Examples examples = 4; - repeated NamedAny vendor_extension = 5; -} - -// One or more JSON representations for responses -message ResponseDefinitions { - repeated NamedResponse additional_properties = 1; -} - -message ResponseValue { - oneof oneof { - Response response = 1; - JsonReference json_reference = 2; - } -} - -// Response objects names can either be any valid HTTP status code or 'default'. -message Responses { - repeated NamedResponseValue response_code = 1; - repeated NamedAny vendor_extension = 2; -} - -// A deterministic version of a JSON Schema object. -message Schema { - string _ref = 1; - string format = 2; - string title = 3; - string description = 4; - Any default = 5; - double multiple_of = 6; - double maximum = 7; - bool exclusive_maximum = 8; - double minimum = 9; - bool exclusive_minimum = 10; - int64 max_length = 11; - int64 min_length = 12; - string pattern = 13; - int64 max_items = 14; - int64 min_items = 15; - bool unique_items = 16; - int64 max_properties = 17; - int64 min_properties = 18; - repeated string required = 19; - repeated Any enum = 20; - AdditionalPropertiesItem additional_properties = 21; - TypeItem type = 22; - ItemsItem items = 23; - repeated Schema all_of = 24; - Properties properties = 25; - string discriminator = 26; - bool read_only = 27; - Xml xml = 28; - ExternalDocs external_docs = 29; - Any example = 30; - repeated NamedAny vendor_extension = 31; -} - -message SchemaItem { - oneof oneof { - Schema schema = 1; - FileSchema file_schema = 2; - } -} - -message SecurityDefinitions { - repeated NamedSecurityDefinitionsItem additional_properties = 1; -} - -message SecurityDefinitionsItem { - oneof oneof { - BasicAuthenticationSecurity basic_authentication_security = 1; - ApiKeySecurity api_key_security = 2; - Oauth2ImplicitSecurity oauth2_implicit_security = 3; - Oauth2PasswordSecurity oauth2_password_security = 4; - Oauth2ApplicationSecurity oauth2_application_security = 5; - Oauth2AccessCodeSecurity oauth2_access_code_security = 6; - } -} - -message SecurityRequirement { - repeated NamedStringArray additional_properties = 1; -} - -message StringArray { - repeated string value = 1; -} - -message Tag { - string name = 1; - string description = 2; - ExternalDocs external_docs = 3; - repeated NamedAny vendor_extension = 4; -} - -message TypeItem { - repeated string value = 1; -} - -// Any property starting with x- is valid. -message VendorExtension { - repeated NamedAny additional_properties = 1; -} - -message Xml { - string name = 1; - string namespace = 2; - string prefix = 3; - bool attribute = 4; - bool wrapped = 5; - repeated NamedAny vendor_extension = 6; -} - diff --git a/vendor/github.com/google/gnostic-models/openapiv2/README.md b/vendor/github.com/google/gnostic-models/openapiv2/README.md deleted file mode 100644 index 5276128d3..000000000 --- a/vendor/github.com/google/gnostic-models/openapiv2/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# OpenAPI v2 Protocol Buffer Models - -This directory contains a Protocol Buffer-language model and related code for -supporting OpenAPI v2. - -Gnostic applications and plugins can use OpenAPIv2.proto to generate Protocol -Buffer support code for their preferred languages. - -OpenAPIv2.go is used by Gnostic to read JSON and YAML OpenAPI descriptions into -the Protocol Buffer-based datastructures generated from OpenAPIv2.proto. - -OpenAPIv2.proto and OpenAPIv2.go are generated by the Gnostic compiler -generator, and OpenAPIv2.pb.go is generated by protoc, the Protocol Buffer -compiler, and protoc-gen-go, the Protocol Buffer Go code generation plugin. diff --git a/vendor/github.com/google/gnostic-models/openapiv2/document.go b/vendor/github.com/google/gnostic-models/openapiv2/document.go deleted file mode 100644 index e96ac0d6d..000000000 --- a/vendor/github.com/google/gnostic-models/openapiv2/document.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2020 Google LLC. All Rights Reserved. -// -// 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 openapi_v2 - -import ( - "gopkg.in/yaml.v3" - - "github.com/google/gnostic-models/compiler" -) - -// ParseDocument reads an OpenAPI v2 description from a YAML/JSON representation. -func ParseDocument(b []byte) (*Document, error) { - info, err := compiler.ReadInfoFromBytes("", b) - if err != nil { - return nil, err - } - root := info.Content[0] - return NewDocument(root, compiler.NewContextWithExtensions("$root", root, nil, nil)) -} - -// YAMLValue produces a serialized YAML representation of the document. -func (d *Document) YAMLValue(comment string) ([]byte, error) { - rawInfo := d.ToRawInfo() - rawInfo = &yaml.Node{ - Kind: yaml.DocumentNode, - Content: []*yaml.Node{rawInfo}, - HeadComment: comment, - } - return yaml.Marshal(rawInfo) -} diff --git a/vendor/github.com/google/gnostic-models/openapiv2/openapi-2.0.json b/vendor/github.com/google/gnostic-models/openapiv2/openapi-2.0.json deleted file mode 100644 index afa12b79b..000000000 --- a/vendor/github.com/google/gnostic-models/openapiv2/openapi-2.0.json +++ /dev/null @@ -1,1610 +0,0 @@ -{ - "title": "A JSON Schema for Swagger 2.0 API.", - "id": "http://swagger.io/v2/schema.json#", - "$schema": "http://json-schema.org/draft-04/schema#", - "type": "object", - "required": [ - "swagger", - "info", - "paths" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "swagger": { - "type": "string", - "enum": [ - "2.0" - ], - "description": "The Swagger version of this document." - }, - "info": { - "$ref": "#/definitions/info" - }, - "host": { - "type": "string", - "pattern": "^[^{}/ :\\\\]+(?::\\d+)?$", - "description": "The host (name or ip) of the API. Example: 'swagger.io'" - }, - "basePath": { - "type": "string", - "pattern": "^/", - "description": "The base path to the API. Example: '/api'." - }, - "schemes": { - "$ref": "#/definitions/schemesList" - }, - "consumes": { - "description": "A list of MIME types accepted by the API.", - "allOf": [ - { - "$ref": "#/definitions/mediaTypeList" - } - ] - }, - "produces": { - "description": "A list of MIME types the API can produce.", - "allOf": [ - { - "$ref": "#/definitions/mediaTypeList" - } - ] - }, - "paths": { - "$ref": "#/definitions/paths" - }, - "definitions": { - "$ref": "#/definitions/definitions" - }, - "parameters": { - "$ref": "#/definitions/parameterDefinitions" - }, - "responses": { - "$ref": "#/definitions/responseDefinitions" - }, - "security": { - "$ref": "#/definitions/security" - }, - "securityDefinitions": { - "$ref": "#/definitions/securityDefinitions" - }, - "tags": { - "type": "array", - "items": { - "$ref": "#/definitions/tag" - }, - "uniqueItems": true - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - } - }, - "definitions": { - "info": { - "type": "object", - "description": "General information about the API.", - "required": [ - "version", - "title" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "title": { - "type": "string", - "description": "A unique and precise title of the API." - }, - "version": { - "type": "string", - "description": "A semantic version number of the API." - }, - "description": { - "type": "string", - "description": "A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed." - }, - "termsOfService": { - "type": "string", - "description": "The terms of service for the API." - }, - "contact": { - "$ref": "#/definitions/contact" - }, - "license": { - "$ref": "#/definitions/license" - } - } - }, - "contact": { - "type": "object", - "description": "Contact information for the owners of the API.", - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "description": "The identifying name of the contact person/organization." - }, - "url": { - "type": "string", - "description": "The URL pointing to the contact information.", - "format": "uri" - }, - "email": { - "type": "string", - "description": "The email address of the contact person/organization.", - "format": "email" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "license": { - "type": "object", - "required": [ - "name" - ], - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "description": "The name of the license type. It's encouraged to use an OSI compatible license." - }, - "url": { - "type": "string", - "description": "The URL pointing to the license.", - "format": "uri" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "paths": { - "type": "object", - "description": "Relative paths to the individual endpoints. They must be relative to the 'basePath'.", - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - }, - "^/": { - "$ref": "#/definitions/pathItem" - } - }, - "additionalProperties": false - }, - "definitions": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/schema" - }, - "description": "One or more JSON objects describing the schemas being consumed and produced by the API." - }, - "parameterDefinitions": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/parameter" - }, - "description": "One or more JSON representations for parameters" - }, - "responseDefinitions": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/response" - }, - "description": "One or more JSON representations for responses" - }, - "externalDocs": { - "type": "object", - "additionalProperties": false, - "description": "information about external documentation", - "required": [ - "url" - ], - "properties": { - "description": { - "type": "string" - }, - "url": { - "type": "string", - "format": "uri" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "examples": { - "type": "object", - "additionalProperties": true - }, - "mimeType": { - "type": "string", - "description": "The MIME type of the HTTP message." - }, - "operation": { - "type": "object", - "required": [ - "responses" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "tags": { - "type": "array", - "items": { - "type": "string" - }, - "uniqueItems": true - }, - "summary": { - "type": "string", - "description": "A brief summary of the operation." - }, - "description": { - "type": "string", - "description": "A longer description of the operation, GitHub Flavored Markdown is allowed." - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - }, - "operationId": { - "type": "string", - "description": "A unique identifier of the operation." - }, - "produces": { - "description": "A list of MIME types the API can produce.", - "allOf": [ - { - "$ref": "#/definitions/mediaTypeList" - } - ] - }, - "consumes": { - "description": "A list of MIME types the API can consume.", - "allOf": [ - { - "$ref": "#/definitions/mediaTypeList" - } - ] - }, - "parameters": { - "$ref": "#/definitions/parametersList" - }, - "responses": { - "$ref": "#/definitions/responses" - }, - "schemes": { - "$ref": "#/definitions/schemesList" - }, - "deprecated": { - "type": "boolean", - "default": false - }, - "security": { - "$ref": "#/definitions/security" - } - } - }, - "pathItem": { - "type": "object", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "$ref": { - "type": "string" - }, - "get": { - "$ref": "#/definitions/operation" - }, - "put": { - "$ref": "#/definitions/operation" - }, - "post": { - "$ref": "#/definitions/operation" - }, - "delete": { - "$ref": "#/definitions/operation" - }, - "options": { - "$ref": "#/definitions/operation" - }, - "head": { - "$ref": "#/definitions/operation" - }, - "patch": { - "$ref": "#/definitions/operation" - }, - "parameters": { - "$ref": "#/definitions/parametersList" - } - } - }, - "responses": { - "type": "object", - "description": "Response objects names can either be any valid HTTP status code or 'default'.", - "minProperties": 1, - "additionalProperties": false, - "patternProperties": { - "^([0-9]{3})$|^(default)$": { - "$ref": "#/definitions/responseValue" - }, - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "not": { - "type": "object", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - } - }, - "responseValue": { - "oneOf": [ - { - "$ref": "#/definitions/response" - }, - { - "$ref": "#/definitions/jsonReference" - } - ] - }, - "response": { - "type": "object", - "required": [ - "description" - ], - "properties": { - "description": { - "type": "string" - }, - "schema": { - "oneOf": [ - { - "$ref": "#/definitions/schema" - }, - { - "$ref": "#/definitions/fileSchema" - } - ] - }, - "headers": { - "$ref": "#/definitions/headers" - }, - "examples": { - "$ref": "#/definitions/examples" - } - }, - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "headers": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/header" - } - }, - "header": { - "type": "object", - "additionalProperties": false, - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "string", - "number", - "integer", - "boolean", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormat" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "vendorExtension": { - "description": "Any property starting with x- is valid.", - "additionalProperties": true, - "additionalItems": true - }, - "bodyParameter": { - "type": "object", - "required": [ - "name", - "in", - "schema" - ], - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "body" - ] - }, - "required": { - "type": "boolean", - "description": "Determines whether or not this parameter is required or optional.", - "default": false - }, - "schema": { - "$ref": "#/definitions/schema" - } - }, - "additionalProperties": false - }, - "headerParameterSubSchema": { - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "required": { - "type": "boolean", - "description": "Determines whether or not this parameter is required or optional.", - "default": false - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "header" - ] - }, - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "type": { - "type": "string", - "enum": [ - "string", - "number", - "boolean", - "integer", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormat" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - } - }, - "queryParameterSubSchema": { - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "required": { - "type": "boolean", - "description": "Determines whether or not this parameter is required or optional.", - "default": false - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "query" - ] - }, - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "allowEmptyValue": { - "type": "boolean", - "default": false, - "description": "allows sending a parameter by name only or with an empty value." - }, - "type": { - "type": "string", - "enum": [ - "string", - "number", - "boolean", - "integer", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormatWithMulti" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - } - }, - "formDataParameterSubSchema": { - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "required": { - "type": "boolean", - "description": "Determines whether or not this parameter is required or optional.", - "default": false - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "formData" - ] - }, - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "allowEmptyValue": { - "type": "boolean", - "default": false, - "description": "allows sending a parameter by name only or with an empty value." - }, - "type": { - "type": "string", - "enum": [ - "string", - "number", - "boolean", - "integer", - "array", - "file" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormatWithMulti" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - } - }, - "pathParameterSubSchema": { - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "required": [ - "required" - ], - "properties": { - "required": { - "type": "boolean", - "enum": [ - true - ], - "description": "Determines whether or not this parameter is required or optional." - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "path" - ] - }, - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "type": { - "type": "string", - "enum": [ - "string", - "number", - "boolean", - "integer", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormat" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - } - }, - "nonBodyParameter": { - "type": "object", - "required": [ - "name", - "in", - "type" - ], - "oneOf": [ - { - "$ref": "#/definitions/headerParameterSubSchema" - }, - { - "$ref": "#/definitions/formDataParameterSubSchema" - }, - { - "$ref": "#/definitions/queryParameterSubSchema" - }, - { - "$ref": "#/definitions/pathParameterSubSchema" - } - ] - }, - "parameter": { - "oneOf": [ - { - "$ref": "#/definitions/bodyParameter" - }, - { - "$ref": "#/definitions/nonBodyParameter" - } - ] - }, - "schema": { - "type": "object", - "description": "A deterministic version of a JSON Schema object.", - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "$ref": { - "type": "string" - }, - "format": { - "type": "string" - }, - "title": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/title" - }, - "description": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/description" - }, - "default": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/default" - }, - "multipleOf": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf" - }, - "maximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum" - }, - "exclusiveMaximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" - }, - "minimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum" - }, - "exclusiveMinimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" - }, - "maxLength": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minLength": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "pattern": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern" - }, - "maxItems": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minItems": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "uniqueItems": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" - }, - "maxProperties": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minProperties": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "required": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray" - }, - "enum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" - }, - "additionalProperties": { - "oneOf": [ - { - "$ref": "#/definitions/schema" - }, - { - "type": "boolean" - } - ], - "default": {} - }, - "type": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/type" - }, - "items": { - "anyOf": [ - { - "$ref": "#/definitions/schema" - }, - { - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/definitions/schema" - } - } - ], - "default": {} - }, - "allOf": { - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/definitions/schema" - } - }, - "properties": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/schema" - }, - "default": {} - }, - "discriminator": { - "type": "string" - }, - "readOnly": { - "type": "boolean", - "default": false - }, - "xml": { - "$ref": "#/definitions/xml" - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - }, - "example": {} - }, - "additionalProperties": false - }, - "fileSchema": { - "type": "object", - "description": "A deterministic version of a JSON Schema object.", - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "required": [ - "type" - ], - "properties": { - "format": { - "type": "string" - }, - "title": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/title" - }, - "description": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/description" - }, - "default": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/default" - }, - "required": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray" - }, - "type": { - "type": "string", - "enum": [ - "file" - ] - }, - "readOnly": { - "type": "boolean", - "default": false - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - }, - "example": {} - }, - "additionalProperties": false - }, - "primitivesItems": { - "type": "object", - "additionalProperties": false, - "properties": { - "type": { - "type": "string", - "enum": [ - "string", - "number", - "integer", - "boolean", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormat" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "security": { - "type": "array", - "items": { - "$ref": "#/definitions/securityRequirement" - }, - "uniqueItems": true - }, - "securityRequirement": { - "type": "object", - "additionalProperties": { - "type": "array", - "items": { - "type": "string" - }, - "uniqueItems": true - } - }, - "xml": { - "type": "object", - "additionalProperties": false, - "properties": { - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "attribute": { - "type": "boolean", - "default": false - }, - "wrapped": { - "type": "boolean", - "default": false - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "tag": { - "type": "object", - "additionalProperties": false, - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "securityDefinitions": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "$ref": "#/definitions/basicAuthenticationSecurity" - }, - { - "$ref": "#/definitions/apiKeySecurity" - }, - { - "$ref": "#/definitions/oauth2ImplicitSecurity" - }, - { - "$ref": "#/definitions/oauth2PasswordSecurity" - }, - { - "$ref": "#/definitions/oauth2ApplicationSecurity" - }, - { - "$ref": "#/definitions/oauth2AccessCodeSecurity" - } - ] - } - }, - "basicAuthenticationSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "basic" - ] - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "apiKeySecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "name", - "in" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "apiKey" - ] - }, - "name": { - "type": "string" - }, - "in": { - "type": "string", - "enum": [ - "header", - "query" - ] - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "oauth2ImplicitSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "flow", - "authorizationUrl" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "oauth2" - ] - }, - "flow": { - "type": "string", - "enum": [ - "implicit" - ] - }, - "scopes": { - "$ref": "#/definitions/oauth2Scopes" - }, - "authorizationUrl": { - "type": "string", - "format": "uri" - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "oauth2PasswordSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "flow", - "tokenUrl" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "oauth2" - ] - }, - "flow": { - "type": "string", - "enum": [ - "password" - ] - }, - "scopes": { - "$ref": "#/definitions/oauth2Scopes" - }, - "tokenUrl": { - "type": "string", - "format": "uri" - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "oauth2ApplicationSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "flow", - "tokenUrl" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "oauth2" - ] - }, - "flow": { - "type": "string", - "enum": [ - "application" - ] - }, - "scopes": { - "$ref": "#/definitions/oauth2Scopes" - }, - "tokenUrl": { - "type": "string", - "format": "uri" - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "oauth2AccessCodeSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "flow", - "authorizationUrl", - "tokenUrl" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "oauth2" - ] - }, - "flow": { - "type": "string", - "enum": [ - "accessCode" - ] - }, - "scopes": { - "$ref": "#/definitions/oauth2Scopes" - }, - "authorizationUrl": { - "type": "string", - "format": "uri" - }, - "tokenUrl": { - "type": "string", - "format": "uri" - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "oauth2Scopes": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "mediaTypeList": { - "type": "array", - "items": { - "$ref": "#/definitions/mimeType" - }, - "uniqueItems": true - }, - "parametersList": { - "type": "array", - "description": "The parameters needed to send a valid API call.", - "additionalItems": false, - "items": { - "oneOf": [ - { - "$ref": "#/definitions/parameter" - }, - { - "$ref": "#/definitions/jsonReference" - } - ] - }, - "uniqueItems": true - }, - "schemesList": { - "type": "array", - "description": "The transfer protocol of the API.", - "items": { - "type": "string", - "enum": [ - "http", - "https", - "ws", - "wss" - ] - }, - "uniqueItems": true - }, - "collectionFormat": { - "type": "string", - "enum": [ - "csv", - "ssv", - "tsv", - "pipes" - ], - "default": "csv" - }, - "collectionFormatWithMulti": { - "type": "string", - "enum": [ - "csv", - "ssv", - "tsv", - "pipes", - "multi" - ], - "default": "csv" - }, - "title": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/title" - }, - "description": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/description" - }, - "default": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/default" - }, - "multipleOf": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf" - }, - "maximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum" - }, - "exclusiveMaximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" - }, - "minimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum" - }, - "exclusiveMinimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" - }, - "maxLength": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minLength": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "pattern": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern" - }, - "maxItems": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minItems": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "uniqueItems": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" - }, - "enum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" - }, - "jsonReference": { - "type": "object", - "required": [ - "$ref" - ], - "additionalProperties": false, - "properties": { - "$ref": { - "type": "string" - }, - "description": { - "type": "string" - } - } - } - } -} \ No newline at end of file diff --git a/vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.go b/vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.go deleted file mode 100644 index 4b1131ce1..000000000 --- a/vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.go +++ /dev/null @@ -1,8633 +0,0 @@ -// Copyright 2020 Google LLC. All Rights Reserved. -// -// 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. - -// THIS FILE IS AUTOMATICALLY GENERATED. - -package openapi_v3 - -import ( - "fmt" - "regexp" - "strings" - - "gopkg.in/yaml.v3" - - "github.com/google/gnostic-models/compiler" -) - -// Version returns the package name (and OpenAPI version). -func Version() string { - return "openapi_v3" -} - -// NewAdditionalPropertiesItem creates an object of type AdditionalPropertiesItem if possible, returning an error if not. -func NewAdditionalPropertiesItem(in *yaml.Node, context *compiler.Context) (*AdditionalPropertiesItem, error) { - errors := make([]error, 0) - x := &AdditionalPropertiesItem{} - matched := false - // SchemaOrReference schema_or_reference = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewSchemaOrReference(m, compiler.NewContext("schemaOrReference", m, context)) - if matchingError == nil { - x.Oneof = &AdditionalPropertiesItem_SchemaOrReference{SchemaOrReference: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // bool boolean = 2; - boolValue, ok := compiler.BoolForScalarNode(in) - if ok { - x.Oneof = &AdditionalPropertiesItem_Boolean{Boolean: boolValue} - matched = true - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid AdditionalPropertiesItem") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewAny creates an object of type Any if possible, returning an error if not. -func NewAny(in *yaml.Node, context *compiler.Context) (*Any, error) { - errors := make([]error, 0) - x := &Any{} - bytes := compiler.Marshal(in) - x.Yaml = string(bytes) - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewAnyOrExpression creates an object of type AnyOrExpression if possible, returning an error if not. -func NewAnyOrExpression(in *yaml.Node, context *compiler.Context) (*AnyOrExpression, error) { - errors := make([]error, 0) - x := &AnyOrExpression{} - matched := false - // Any any = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewAny(m, compiler.NewContext("any", m, context)) - if matchingError == nil { - x.Oneof = &AnyOrExpression_Any{Any: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Expression expression = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewExpression(m, compiler.NewContext("expression", m, context)) - if matchingError == nil { - x.Oneof = &AnyOrExpression_Expression{Expression: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid AnyOrExpression") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewCallback creates an object of type Callback if possible, returning an error if not. -func NewCallback(in *yaml.Node, context *compiler.Context) (*Callback, error) { - errors := make([]error, 0) - x := &Callback{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{} - allowedPatterns := []*regexp.Regexp{pattern0, pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // repeated NamedPathItem path = 1; - // MAP: PathItem ^ - x.Path = make([]*NamedPathItem, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if true { - pair := &NamedPathItem{} - pair.Name = k - var err error - pair.Value, err = NewPathItem(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.Path = append(x.Path, pair) - } - } - } - // repeated NamedAny specification_extension = 2; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewCallbackOrReference creates an object of type CallbackOrReference if possible, returning an error if not. -func NewCallbackOrReference(in *yaml.Node, context *compiler.Context) (*CallbackOrReference, error) { - errors := make([]error, 0) - x := &CallbackOrReference{} - matched := false - // Callback callback = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewCallback(m, compiler.NewContext("callback", m, context)) - if matchingError == nil { - x.Oneof = &CallbackOrReference_Callback{Callback: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Reference reference = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewReference(m, compiler.NewContext("reference", m, context)) - if matchingError == nil { - x.Oneof = &CallbackOrReference_Reference{Reference: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid CallbackOrReference") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewCallbacksOrReferences creates an object of type CallbacksOrReferences if possible, returning an error if not. -func NewCallbacksOrReferences(in *yaml.Node, context *compiler.Context) (*CallbacksOrReferences, error) { - errors := make([]error, 0) - x := &CallbacksOrReferences{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedCallbackOrReference additional_properties = 1; - // MAP: CallbackOrReference - x.AdditionalProperties = make([]*NamedCallbackOrReference, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedCallbackOrReference{} - pair.Name = k - var err error - pair.Value, err = NewCallbackOrReference(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewComponents creates an object of type Components if possible, returning an error if not. -func NewComponents(in *yaml.Node, context *compiler.Context) (*Components, error) { - errors := make([]error, 0) - x := &Components{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"callbacks", "examples", "headers", "links", "parameters", "requestBodies", "responses", "schemas", "securitySchemes"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // SchemasOrReferences schemas = 1; - v1 := compiler.MapValueForKey(m, "schemas") - if v1 != nil { - var err error - x.Schemas, err = NewSchemasOrReferences(v1, compiler.NewContext("schemas", v1, context)) - if err != nil { - errors = append(errors, err) - } - } - // ResponsesOrReferences responses = 2; - v2 := compiler.MapValueForKey(m, "responses") - if v2 != nil { - var err error - x.Responses, err = NewResponsesOrReferences(v2, compiler.NewContext("responses", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - // ParametersOrReferences parameters = 3; - v3 := compiler.MapValueForKey(m, "parameters") - if v3 != nil { - var err error - x.Parameters, err = NewParametersOrReferences(v3, compiler.NewContext("parameters", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // ExamplesOrReferences examples = 4; - v4 := compiler.MapValueForKey(m, "examples") - if v4 != nil { - var err error - x.Examples, err = NewExamplesOrReferences(v4, compiler.NewContext("examples", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // RequestBodiesOrReferences request_bodies = 5; - v5 := compiler.MapValueForKey(m, "requestBodies") - if v5 != nil { - var err error - x.RequestBodies, err = NewRequestBodiesOrReferences(v5, compiler.NewContext("requestBodies", v5, context)) - if err != nil { - errors = append(errors, err) - } - } - // HeadersOrReferences headers = 6; - v6 := compiler.MapValueForKey(m, "headers") - if v6 != nil { - var err error - x.Headers, err = NewHeadersOrReferences(v6, compiler.NewContext("headers", v6, context)) - if err != nil { - errors = append(errors, err) - } - } - // SecuritySchemesOrReferences security_schemes = 7; - v7 := compiler.MapValueForKey(m, "securitySchemes") - if v7 != nil { - var err error - x.SecuritySchemes, err = NewSecuritySchemesOrReferences(v7, compiler.NewContext("securitySchemes", v7, context)) - if err != nil { - errors = append(errors, err) - } - } - // LinksOrReferences links = 8; - v8 := compiler.MapValueForKey(m, "links") - if v8 != nil { - var err error - x.Links, err = NewLinksOrReferences(v8, compiler.NewContext("links", v8, context)) - if err != nil { - errors = append(errors, err) - } - } - // CallbacksOrReferences callbacks = 9; - v9 := compiler.MapValueForKey(m, "callbacks") - if v9 != nil { - var err error - x.Callbacks, err = NewCallbacksOrReferences(v9, compiler.NewContext("callbacks", v9, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny specification_extension = 10; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewContact creates an object of type Contact if possible, returning an error if not. -func NewContact(in *yaml.Node, context *compiler.Context) (*Contact, error) { - errors := make([]error, 0) - x := &Contact{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"email", "name", "url"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string url = 2; - v2 := compiler.MapValueForKey(m, "url") - if v2 != nil { - x.Url, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string email = 3; - v3 := compiler.MapValueForKey(m, "email") - if v3 != nil { - x.Email, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for email: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny specification_extension = 4; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewDefaultType creates an object of type DefaultType if possible, returning an error if not. -func NewDefaultType(in *yaml.Node, context *compiler.Context) (*DefaultType, error) { - errors := make([]error, 0) - x := &DefaultType{} - matched := false - switch in.Tag { - case "!!bool": - var v bool - v, matched = compiler.BoolForScalarNode(in) - x.Oneof = &DefaultType_Boolean{Boolean: v} - case "!!str": - var v string - v, matched = compiler.StringForScalarNode(in) - x.Oneof = &DefaultType_String_{String_: v} - case "!!float": - var v float64 - v, matched = compiler.FloatForScalarNode(in) - x.Oneof = &DefaultType_Number{Number: v} - case "!!int": - var v int64 - v, matched = compiler.IntForScalarNode(in) - x.Oneof = &DefaultType_Number{Number: float64(v)} - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewDiscriminator creates an object of type Discriminator if possible, returning an error if not. -func NewDiscriminator(in *yaml.Node, context *compiler.Context) (*Discriminator, error) { - errors := make([]error, 0) - x := &Discriminator{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"propertyName"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"mapping", "propertyName"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string property_name = 1; - v1 := compiler.MapValueForKey(m, "propertyName") - if v1 != nil { - x.PropertyName, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for propertyName: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Strings mapping = 2; - v2 := compiler.MapValueForKey(m, "mapping") - if v2 != nil { - var err error - x.Mapping, err = NewStrings(v2, compiler.NewContext("mapping", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny specification_extension = 3; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewDocument creates an object of type Document if possible, returning an error if not. -func NewDocument(in *yaml.Node, context *compiler.Context) (*Document, error) { - errors := make([]error, 0) - x := &Document{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"info", "openapi", "paths"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"components", "externalDocs", "info", "openapi", "paths", "security", "servers", "tags"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string openapi = 1; - v1 := compiler.MapValueForKey(m, "openapi") - if v1 != nil { - x.Openapi, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for openapi: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Info info = 2; - v2 := compiler.MapValueForKey(m, "info") - if v2 != nil { - var err error - x.Info, err = NewInfo(v2, compiler.NewContext("info", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated Server servers = 3; - v3 := compiler.MapValueForKey(m, "servers") - if v3 != nil { - // repeated Server - x.Servers = make([]*Server, 0) - a, ok := compiler.SequenceNodeForNode(v3) - if ok { - for _, item := range a.Content { - y, err := NewServer(item, compiler.NewContext("servers", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Servers = append(x.Servers, y) - } - } - } - // Paths paths = 4; - v4 := compiler.MapValueForKey(m, "paths") - if v4 != nil { - var err error - x.Paths, err = NewPaths(v4, compiler.NewContext("paths", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // Components components = 5; - v5 := compiler.MapValueForKey(m, "components") - if v5 != nil { - var err error - x.Components, err = NewComponents(v5, compiler.NewContext("components", v5, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated SecurityRequirement security = 6; - v6 := compiler.MapValueForKey(m, "security") - if v6 != nil { - // repeated SecurityRequirement - x.Security = make([]*SecurityRequirement, 0) - a, ok := compiler.SequenceNodeForNode(v6) - if ok { - for _, item := range a.Content { - y, err := NewSecurityRequirement(item, compiler.NewContext("security", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Security = append(x.Security, y) - } - } - } - // repeated Tag tags = 7; - v7 := compiler.MapValueForKey(m, "tags") - if v7 != nil { - // repeated Tag - x.Tags = make([]*Tag, 0) - a, ok := compiler.SequenceNodeForNode(v7) - if ok { - for _, item := range a.Content { - y, err := NewTag(item, compiler.NewContext("tags", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Tags = append(x.Tags, y) - } - } - } - // ExternalDocs external_docs = 8; - v8 := compiler.MapValueForKey(m, "externalDocs") - if v8 != nil { - var err error - x.ExternalDocs, err = NewExternalDocs(v8, compiler.NewContext("externalDocs", v8, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny specification_extension = 9; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewEncoding creates an object of type Encoding if possible, returning an error if not. -func NewEncoding(in *yaml.Node, context *compiler.Context) (*Encoding, error) { - errors := make([]error, 0) - x := &Encoding{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"allowReserved", "contentType", "explode", "headers", "style"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string content_type = 1; - v1 := compiler.MapValueForKey(m, "contentType") - if v1 != nil { - x.ContentType, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for contentType: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // HeadersOrReferences headers = 2; - v2 := compiler.MapValueForKey(m, "headers") - if v2 != nil { - var err error - x.Headers, err = NewHeadersOrReferences(v2, compiler.NewContext("headers", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - // string style = 3; - v3 := compiler.MapValueForKey(m, "style") - if v3 != nil { - x.Style, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for style: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool explode = 4; - v4 := compiler.MapValueForKey(m, "explode") - if v4 != nil { - x.Explode, ok = compiler.BoolForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for explode: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool allow_reserved = 5; - v5 := compiler.MapValueForKey(m, "allowReserved") - if v5 != nil { - x.AllowReserved, ok = compiler.BoolForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for allowReserved: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny specification_extension = 6; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewEncodings creates an object of type Encodings if possible, returning an error if not. -func NewEncodings(in *yaml.Node, context *compiler.Context) (*Encodings, error) { - errors := make([]error, 0) - x := &Encodings{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedEncoding additional_properties = 1; - // MAP: Encoding - x.AdditionalProperties = make([]*NamedEncoding, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedEncoding{} - pair.Name = k - var err error - pair.Value, err = NewEncoding(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewExample creates an object of type Example if possible, returning an error if not. -func NewExample(in *yaml.Node, context *compiler.Context) (*Example, error) { - errors := make([]error, 0) - x := &Example{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"description", "externalValue", "summary", "value"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string summary = 1; - v1 := compiler.MapValueForKey(m, "summary") - if v1 != nil { - x.Summary, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for summary: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 2; - v2 := compiler.MapValueForKey(m, "description") - if v2 != nil { - x.Description, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Any value = 3; - v3 := compiler.MapValueForKey(m, "value") - if v3 != nil { - var err error - x.Value, err = NewAny(v3, compiler.NewContext("value", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // string external_value = 4; - v4 := compiler.MapValueForKey(m, "externalValue") - if v4 != nil { - x.ExternalValue, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for externalValue: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny specification_extension = 5; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewExampleOrReference creates an object of type ExampleOrReference if possible, returning an error if not. -func NewExampleOrReference(in *yaml.Node, context *compiler.Context) (*ExampleOrReference, error) { - errors := make([]error, 0) - x := &ExampleOrReference{} - matched := false - // Example example = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewExample(m, compiler.NewContext("example", m, context)) - if matchingError == nil { - x.Oneof = &ExampleOrReference_Example{Example: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Reference reference = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewReference(m, compiler.NewContext("reference", m, context)) - if matchingError == nil { - x.Oneof = &ExampleOrReference_Reference{Reference: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid ExampleOrReference") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewExamplesOrReferences creates an object of type ExamplesOrReferences if possible, returning an error if not. -func NewExamplesOrReferences(in *yaml.Node, context *compiler.Context) (*ExamplesOrReferences, error) { - errors := make([]error, 0) - x := &ExamplesOrReferences{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedExampleOrReference additional_properties = 1; - // MAP: ExampleOrReference - x.AdditionalProperties = make([]*NamedExampleOrReference, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedExampleOrReference{} - pair.Name = k - var err error - pair.Value, err = NewExampleOrReference(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewExpression creates an object of type Expression if possible, returning an error if not. -func NewExpression(in *yaml.Node, context *compiler.Context) (*Expression, error) { - errors := make([]error, 0) - x := &Expression{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedAny additional_properties = 1; - // MAP: Any - x.AdditionalProperties = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewExternalDocs creates an object of type ExternalDocs if possible, returning an error if not. -func NewExternalDocs(in *yaml.Node, context *compiler.Context) (*ExternalDocs, error) { - errors := make([]error, 0) - x := &ExternalDocs{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"url"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"description", "url"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string description = 1; - v1 := compiler.MapValueForKey(m, "description") - if v1 != nil { - x.Description, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string url = 2; - v2 := compiler.MapValueForKey(m, "url") - if v2 != nil { - x.Url, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny specification_extension = 3; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewHeader creates an object of type Header if possible, returning an error if not. -func NewHeader(in *yaml.Node, context *compiler.Context) (*Header, error) { - errors := make([]error, 0) - x := &Header{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"allowEmptyValue", "allowReserved", "content", "deprecated", "description", "example", "examples", "explode", "required", "schema", "style"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string description = 1; - v1 := compiler.MapValueForKey(m, "description") - if v1 != nil { - x.Description, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool required = 2; - v2 := compiler.MapValueForKey(m, "required") - if v2 != nil { - x.Required, ok = compiler.BoolForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool deprecated = 3; - v3 := compiler.MapValueForKey(m, "deprecated") - if v3 != nil { - x.Deprecated, ok = compiler.BoolForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for deprecated: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool allow_empty_value = 4; - v4 := compiler.MapValueForKey(m, "allowEmptyValue") - if v4 != nil { - x.AllowEmptyValue, ok = compiler.BoolForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for allowEmptyValue: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string style = 5; - v5 := compiler.MapValueForKey(m, "style") - if v5 != nil { - x.Style, ok = compiler.StringForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for style: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool explode = 6; - v6 := compiler.MapValueForKey(m, "explode") - if v6 != nil { - x.Explode, ok = compiler.BoolForScalarNode(v6) - if !ok { - message := fmt.Sprintf("has unexpected value for explode: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool allow_reserved = 7; - v7 := compiler.MapValueForKey(m, "allowReserved") - if v7 != nil { - x.AllowReserved, ok = compiler.BoolForScalarNode(v7) - if !ok { - message := fmt.Sprintf("has unexpected value for allowReserved: %s", compiler.Display(v7)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // SchemaOrReference schema = 8; - v8 := compiler.MapValueForKey(m, "schema") - if v8 != nil { - var err error - x.Schema, err = NewSchemaOrReference(v8, compiler.NewContext("schema", v8, context)) - if err != nil { - errors = append(errors, err) - } - } - // Any example = 9; - v9 := compiler.MapValueForKey(m, "example") - if v9 != nil { - var err error - x.Example, err = NewAny(v9, compiler.NewContext("example", v9, context)) - if err != nil { - errors = append(errors, err) - } - } - // ExamplesOrReferences examples = 10; - v10 := compiler.MapValueForKey(m, "examples") - if v10 != nil { - var err error - x.Examples, err = NewExamplesOrReferences(v10, compiler.NewContext("examples", v10, context)) - if err != nil { - errors = append(errors, err) - } - } - // MediaTypes content = 11; - v11 := compiler.MapValueForKey(m, "content") - if v11 != nil { - var err error - x.Content, err = NewMediaTypes(v11, compiler.NewContext("content", v11, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny specification_extension = 12; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewHeaderOrReference creates an object of type HeaderOrReference if possible, returning an error if not. -func NewHeaderOrReference(in *yaml.Node, context *compiler.Context) (*HeaderOrReference, error) { - errors := make([]error, 0) - x := &HeaderOrReference{} - matched := false - // Header header = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewHeader(m, compiler.NewContext("header", m, context)) - if matchingError == nil { - x.Oneof = &HeaderOrReference_Header{Header: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Reference reference = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewReference(m, compiler.NewContext("reference", m, context)) - if matchingError == nil { - x.Oneof = &HeaderOrReference_Reference{Reference: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid HeaderOrReference") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewHeadersOrReferences creates an object of type HeadersOrReferences if possible, returning an error if not. -func NewHeadersOrReferences(in *yaml.Node, context *compiler.Context) (*HeadersOrReferences, error) { - errors := make([]error, 0) - x := &HeadersOrReferences{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedHeaderOrReference additional_properties = 1; - // MAP: HeaderOrReference - x.AdditionalProperties = make([]*NamedHeaderOrReference, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedHeaderOrReference{} - pair.Name = k - var err error - pair.Value, err = NewHeaderOrReference(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewInfo creates an object of type Info if possible, returning an error if not. -func NewInfo(in *yaml.Node, context *compiler.Context) (*Info, error) { - errors := make([]error, 0) - x := &Info{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"title", "version"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"contact", "description", "license", "summary", "termsOfService", "title", "version"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string title = 1; - v1 := compiler.MapValueForKey(m, "title") - if v1 != nil { - x.Title, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for title: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 2; - v2 := compiler.MapValueForKey(m, "description") - if v2 != nil { - x.Description, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string terms_of_service = 3; - v3 := compiler.MapValueForKey(m, "termsOfService") - if v3 != nil { - x.TermsOfService, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for termsOfService: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Contact contact = 4; - v4 := compiler.MapValueForKey(m, "contact") - if v4 != nil { - var err error - x.Contact, err = NewContact(v4, compiler.NewContext("contact", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // License license = 5; - v5 := compiler.MapValueForKey(m, "license") - if v5 != nil { - var err error - x.License, err = NewLicense(v5, compiler.NewContext("license", v5, context)) - if err != nil { - errors = append(errors, err) - } - } - // string version = 6; - v6 := compiler.MapValueForKey(m, "version") - if v6 != nil { - x.Version, ok = compiler.StringForScalarNode(v6) - if !ok { - message := fmt.Sprintf("has unexpected value for version: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string summary = 7; - v7 := compiler.MapValueForKey(m, "summary") - if v7 != nil { - x.Summary, ok = compiler.StringForScalarNode(v7) - if !ok { - message := fmt.Sprintf("has unexpected value for summary: %s", compiler.Display(v7)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny specification_extension = 8; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewItemsItem creates an object of type ItemsItem if possible, returning an error if not. -func NewItemsItem(in *yaml.Node, context *compiler.Context) (*ItemsItem, error) { - errors := make([]error, 0) - x := &ItemsItem{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value for item array: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - x.SchemaOrReference = make([]*SchemaOrReference, 0) - y, err := NewSchemaOrReference(m, compiler.NewContext("", m, context)) - if err != nil { - return nil, err - } - x.SchemaOrReference = append(x.SchemaOrReference, y) - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewLicense creates an object of type License if possible, returning an error if not. -func NewLicense(in *yaml.Node, context *compiler.Context) (*License, error) { - errors := make([]error, 0) - x := &License{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"name"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"name", "url"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string url = 2; - v2 := compiler.MapValueForKey(m, "url") - if v2 != nil { - x.Url, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny specification_extension = 3; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewLink creates an object of type Link if possible, returning an error if not. -func NewLink(in *yaml.Node, context *compiler.Context) (*Link, error) { - errors := make([]error, 0) - x := &Link{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"description", "operationId", "operationRef", "parameters", "requestBody", "server"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string operation_ref = 1; - v1 := compiler.MapValueForKey(m, "operationRef") - if v1 != nil { - x.OperationRef, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for operationRef: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string operation_id = 2; - v2 := compiler.MapValueForKey(m, "operationId") - if v2 != nil { - x.OperationId, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for operationId: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // AnyOrExpression parameters = 3; - v3 := compiler.MapValueForKey(m, "parameters") - if v3 != nil { - var err error - x.Parameters, err = NewAnyOrExpression(v3, compiler.NewContext("parameters", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // AnyOrExpression request_body = 4; - v4 := compiler.MapValueForKey(m, "requestBody") - if v4 != nil { - var err error - x.RequestBody, err = NewAnyOrExpression(v4, compiler.NewContext("requestBody", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // string description = 5; - v5 := compiler.MapValueForKey(m, "description") - if v5 != nil { - x.Description, ok = compiler.StringForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Server server = 6; - v6 := compiler.MapValueForKey(m, "server") - if v6 != nil { - var err error - x.Server, err = NewServer(v6, compiler.NewContext("server", v6, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny specification_extension = 7; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewLinkOrReference creates an object of type LinkOrReference if possible, returning an error if not. -func NewLinkOrReference(in *yaml.Node, context *compiler.Context) (*LinkOrReference, error) { - errors := make([]error, 0) - x := &LinkOrReference{} - matched := false - // Link link = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewLink(m, compiler.NewContext("link", m, context)) - if matchingError == nil { - x.Oneof = &LinkOrReference_Link{Link: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Reference reference = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewReference(m, compiler.NewContext("reference", m, context)) - if matchingError == nil { - x.Oneof = &LinkOrReference_Reference{Reference: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid LinkOrReference") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewLinksOrReferences creates an object of type LinksOrReferences if possible, returning an error if not. -func NewLinksOrReferences(in *yaml.Node, context *compiler.Context) (*LinksOrReferences, error) { - errors := make([]error, 0) - x := &LinksOrReferences{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedLinkOrReference additional_properties = 1; - // MAP: LinkOrReference - x.AdditionalProperties = make([]*NamedLinkOrReference, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedLinkOrReference{} - pair.Name = k - var err error - pair.Value, err = NewLinkOrReference(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewMediaType creates an object of type MediaType if possible, returning an error if not. -func NewMediaType(in *yaml.Node, context *compiler.Context) (*MediaType, error) { - errors := make([]error, 0) - x := &MediaType{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"encoding", "example", "examples", "schema"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // SchemaOrReference schema = 1; - v1 := compiler.MapValueForKey(m, "schema") - if v1 != nil { - var err error - x.Schema, err = NewSchemaOrReference(v1, compiler.NewContext("schema", v1, context)) - if err != nil { - errors = append(errors, err) - } - } - // Any example = 2; - v2 := compiler.MapValueForKey(m, "example") - if v2 != nil { - var err error - x.Example, err = NewAny(v2, compiler.NewContext("example", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - // ExamplesOrReferences examples = 3; - v3 := compiler.MapValueForKey(m, "examples") - if v3 != nil { - var err error - x.Examples, err = NewExamplesOrReferences(v3, compiler.NewContext("examples", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // Encodings encoding = 4; - v4 := compiler.MapValueForKey(m, "encoding") - if v4 != nil { - var err error - x.Encoding, err = NewEncodings(v4, compiler.NewContext("encoding", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny specification_extension = 5; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewMediaTypes creates an object of type MediaTypes if possible, returning an error if not. -func NewMediaTypes(in *yaml.Node, context *compiler.Context) (*MediaTypes, error) { - errors := make([]error, 0) - x := &MediaTypes{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedMediaType additional_properties = 1; - // MAP: MediaType - x.AdditionalProperties = make([]*NamedMediaType, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedMediaType{} - pair.Name = k - var err error - pair.Value, err = NewMediaType(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedAny creates an object of type NamedAny if possible, returning an error if not. -func NewNamedAny(in *yaml.Node, context *compiler.Context) (*NamedAny, error) { - errors := make([]error, 0) - x := &NamedAny{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Any value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewAny(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedCallbackOrReference creates an object of type NamedCallbackOrReference if possible, returning an error if not. -func NewNamedCallbackOrReference(in *yaml.Node, context *compiler.Context) (*NamedCallbackOrReference, error) { - errors := make([]error, 0) - x := &NamedCallbackOrReference{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // CallbackOrReference value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewCallbackOrReference(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedEncoding creates an object of type NamedEncoding if possible, returning an error if not. -func NewNamedEncoding(in *yaml.Node, context *compiler.Context) (*NamedEncoding, error) { - errors := make([]error, 0) - x := &NamedEncoding{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Encoding value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewEncoding(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedExampleOrReference creates an object of type NamedExampleOrReference if possible, returning an error if not. -func NewNamedExampleOrReference(in *yaml.Node, context *compiler.Context) (*NamedExampleOrReference, error) { - errors := make([]error, 0) - x := &NamedExampleOrReference{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // ExampleOrReference value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewExampleOrReference(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedHeaderOrReference creates an object of type NamedHeaderOrReference if possible, returning an error if not. -func NewNamedHeaderOrReference(in *yaml.Node, context *compiler.Context) (*NamedHeaderOrReference, error) { - errors := make([]error, 0) - x := &NamedHeaderOrReference{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // HeaderOrReference value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewHeaderOrReference(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedLinkOrReference creates an object of type NamedLinkOrReference if possible, returning an error if not. -func NewNamedLinkOrReference(in *yaml.Node, context *compiler.Context) (*NamedLinkOrReference, error) { - errors := make([]error, 0) - x := &NamedLinkOrReference{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // LinkOrReference value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewLinkOrReference(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedMediaType creates an object of type NamedMediaType if possible, returning an error if not. -func NewNamedMediaType(in *yaml.Node, context *compiler.Context) (*NamedMediaType, error) { - errors := make([]error, 0) - x := &NamedMediaType{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // MediaType value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewMediaType(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedParameterOrReference creates an object of type NamedParameterOrReference if possible, returning an error if not. -func NewNamedParameterOrReference(in *yaml.Node, context *compiler.Context) (*NamedParameterOrReference, error) { - errors := make([]error, 0) - x := &NamedParameterOrReference{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // ParameterOrReference value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewParameterOrReference(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedPathItem creates an object of type NamedPathItem if possible, returning an error if not. -func NewNamedPathItem(in *yaml.Node, context *compiler.Context) (*NamedPathItem, error) { - errors := make([]error, 0) - x := &NamedPathItem{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // PathItem value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewPathItem(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedRequestBodyOrReference creates an object of type NamedRequestBodyOrReference if possible, returning an error if not. -func NewNamedRequestBodyOrReference(in *yaml.Node, context *compiler.Context) (*NamedRequestBodyOrReference, error) { - errors := make([]error, 0) - x := &NamedRequestBodyOrReference{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // RequestBodyOrReference value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewRequestBodyOrReference(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedResponseOrReference creates an object of type NamedResponseOrReference if possible, returning an error if not. -func NewNamedResponseOrReference(in *yaml.Node, context *compiler.Context) (*NamedResponseOrReference, error) { - errors := make([]error, 0) - x := &NamedResponseOrReference{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // ResponseOrReference value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewResponseOrReference(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedSchemaOrReference creates an object of type NamedSchemaOrReference if possible, returning an error if not. -func NewNamedSchemaOrReference(in *yaml.Node, context *compiler.Context) (*NamedSchemaOrReference, error) { - errors := make([]error, 0) - x := &NamedSchemaOrReference{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // SchemaOrReference value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewSchemaOrReference(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedSecuritySchemeOrReference creates an object of type NamedSecuritySchemeOrReference if possible, returning an error if not. -func NewNamedSecuritySchemeOrReference(in *yaml.Node, context *compiler.Context) (*NamedSecuritySchemeOrReference, error) { - errors := make([]error, 0) - x := &NamedSecuritySchemeOrReference{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // SecuritySchemeOrReference value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewSecuritySchemeOrReference(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedServerVariable creates an object of type NamedServerVariable if possible, returning an error if not. -func NewNamedServerVariable(in *yaml.Node, context *compiler.Context) (*NamedServerVariable, error) { - errors := make([]error, 0) - x := &NamedServerVariable{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // ServerVariable value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewServerVariable(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedString creates an object of type NamedString if possible, returning an error if not. -func NewNamedString(in *yaml.Node, context *compiler.Context) (*NamedString, error) { - errors := make([]error, 0) - x := &NamedString{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - x.Value, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for value: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedStringArray creates an object of type NamedStringArray if possible, returning an error if not. -func NewNamedStringArray(in *yaml.Node, context *compiler.Context) (*NamedStringArray, error) { - errors := make([]error, 0) - x := &NamedStringArray{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // StringArray value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewStringArray(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewOauthFlow creates an object of type OauthFlow if possible, returning an error if not. -func NewOauthFlow(in *yaml.Node, context *compiler.Context) (*OauthFlow, error) { - errors := make([]error, 0) - x := &OauthFlow{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"authorizationUrl", "refreshUrl", "scopes", "tokenUrl"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string authorization_url = 1; - v1 := compiler.MapValueForKey(m, "authorizationUrl") - if v1 != nil { - x.AuthorizationUrl, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for authorizationUrl: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string token_url = 2; - v2 := compiler.MapValueForKey(m, "tokenUrl") - if v2 != nil { - x.TokenUrl, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for tokenUrl: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string refresh_url = 3; - v3 := compiler.MapValueForKey(m, "refreshUrl") - if v3 != nil { - x.RefreshUrl, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for refreshUrl: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Strings scopes = 4; - v4 := compiler.MapValueForKey(m, "scopes") - if v4 != nil { - var err error - x.Scopes, err = NewStrings(v4, compiler.NewContext("scopes", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny specification_extension = 5; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewOauthFlows creates an object of type OauthFlows if possible, returning an error if not. -func NewOauthFlows(in *yaml.Node, context *compiler.Context) (*OauthFlows, error) { - errors := make([]error, 0) - x := &OauthFlows{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"authorizationCode", "clientCredentials", "implicit", "password"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // OauthFlow implicit = 1; - v1 := compiler.MapValueForKey(m, "implicit") - if v1 != nil { - var err error - x.Implicit, err = NewOauthFlow(v1, compiler.NewContext("implicit", v1, context)) - if err != nil { - errors = append(errors, err) - } - } - // OauthFlow password = 2; - v2 := compiler.MapValueForKey(m, "password") - if v2 != nil { - var err error - x.Password, err = NewOauthFlow(v2, compiler.NewContext("password", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - // OauthFlow client_credentials = 3; - v3 := compiler.MapValueForKey(m, "clientCredentials") - if v3 != nil { - var err error - x.ClientCredentials, err = NewOauthFlow(v3, compiler.NewContext("clientCredentials", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // OauthFlow authorization_code = 4; - v4 := compiler.MapValueForKey(m, "authorizationCode") - if v4 != nil { - var err error - x.AuthorizationCode, err = NewOauthFlow(v4, compiler.NewContext("authorizationCode", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny specification_extension = 5; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewObject creates an object of type Object if possible, returning an error if not. -func NewObject(in *yaml.Node, context *compiler.Context) (*Object, error) { - errors := make([]error, 0) - x := &Object{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedAny additional_properties = 1; - // MAP: Any - x.AdditionalProperties = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewOperation creates an object of type Operation if possible, returning an error if not. -func NewOperation(in *yaml.Node, context *compiler.Context) (*Operation, error) { - errors := make([]error, 0) - x := &Operation{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"responses"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"callbacks", "deprecated", "description", "externalDocs", "operationId", "parameters", "requestBody", "responses", "security", "servers", "summary", "tags"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // repeated string tags = 1; - v1 := compiler.MapValueForKey(m, "tags") - if v1 != nil { - v, ok := compiler.SequenceNodeForNode(v1) - if ok { - x.Tags = compiler.StringArrayForSequenceNode(v) - } else { - message := fmt.Sprintf("has unexpected value for tags: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string summary = 2; - v2 := compiler.MapValueForKey(m, "summary") - if v2 != nil { - x.Summary, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for summary: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 3; - v3 := compiler.MapValueForKey(m, "description") - if v3 != nil { - x.Description, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // ExternalDocs external_docs = 4; - v4 := compiler.MapValueForKey(m, "externalDocs") - if v4 != nil { - var err error - x.ExternalDocs, err = NewExternalDocs(v4, compiler.NewContext("externalDocs", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // string operation_id = 5; - v5 := compiler.MapValueForKey(m, "operationId") - if v5 != nil { - x.OperationId, ok = compiler.StringForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for operationId: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated ParameterOrReference parameters = 6; - v6 := compiler.MapValueForKey(m, "parameters") - if v6 != nil { - // repeated ParameterOrReference - x.Parameters = make([]*ParameterOrReference, 0) - a, ok := compiler.SequenceNodeForNode(v6) - if ok { - for _, item := range a.Content { - y, err := NewParameterOrReference(item, compiler.NewContext("parameters", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Parameters = append(x.Parameters, y) - } - } - } - // RequestBodyOrReference request_body = 7; - v7 := compiler.MapValueForKey(m, "requestBody") - if v7 != nil { - var err error - x.RequestBody, err = NewRequestBodyOrReference(v7, compiler.NewContext("requestBody", v7, context)) - if err != nil { - errors = append(errors, err) - } - } - // Responses responses = 8; - v8 := compiler.MapValueForKey(m, "responses") - if v8 != nil { - var err error - x.Responses, err = NewResponses(v8, compiler.NewContext("responses", v8, context)) - if err != nil { - errors = append(errors, err) - } - } - // CallbacksOrReferences callbacks = 9; - v9 := compiler.MapValueForKey(m, "callbacks") - if v9 != nil { - var err error - x.Callbacks, err = NewCallbacksOrReferences(v9, compiler.NewContext("callbacks", v9, context)) - if err != nil { - errors = append(errors, err) - } - } - // bool deprecated = 10; - v10 := compiler.MapValueForKey(m, "deprecated") - if v10 != nil { - x.Deprecated, ok = compiler.BoolForScalarNode(v10) - if !ok { - message := fmt.Sprintf("has unexpected value for deprecated: %s", compiler.Display(v10)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated SecurityRequirement security = 11; - v11 := compiler.MapValueForKey(m, "security") - if v11 != nil { - // repeated SecurityRequirement - x.Security = make([]*SecurityRequirement, 0) - a, ok := compiler.SequenceNodeForNode(v11) - if ok { - for _, item := range a.Content { - y, err := NewSecurityRequirement(item, compiler.NewContext("security", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Security = append(x.Security, y) - } - } - } - // repeated Server servers = 12; - v12 := compiler.MapValueForKey(m, "servers") - if v12 != nil { - // repeated Server - x.Servers = make([]*Server, 0) - a, ok := compiler.SequenceNodeForNode(v12) - if ok { - for _, item := range a.Content { - y, err := NewServer(item, compiler.NewContext("servers", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Servers = append(x.Servers, y) - } - } - } - // repeated NamedAny specification_extension = 13; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewParameter creates an object of type Parameter if possible, returning an error if not. -func NewParameter(in *yaml.Node, context *compiler.Context) (*Parameter, error) { - errors := make([]error, 0) - x := &Parameter{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"in", "name"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"allowEmptyValue", "allowReserved", "content", "deprecated", "description", "example", "examples", "explode", "in", "name", "required", "schema", "style"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string in = 2; - v2 := compiler.MapValueForKey(m, "in") - if v2 != nil { - x.In, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 3; - v3 := compiler.MapValueForKey(m, "description") - if v3 != nil { - x.Description, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool required = 4; - v4 := compiler.MapValueForKey(m, "required") - if v4 != nil { - x.Required, ok = compiler.BoolForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool deprecated = 5; - v5 := compiler.MapValueForKey(m, "deprecated") - if v5 != nil { - x.Deprecated, ok = compiler.BoolForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for deprecated: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool allow_empty_value = 6; - v6 := compiler.MapValueForKey(m, "allowEmptyValue") - if v6 != nil { - x.AllowEmptyValue, ok = compiler.BoolForScalarNode(v6) - if !ok { - message := fmt.Sprintf("has unexpected value for allowEmptyValue: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string style = 7; - v7 := compiler.MapValueForKey(m, "style") - if v7 != nil { - x.Style, ok = compiler.StringForScalarNode(v7) - if !ok { - message := fmt.Sprintf("has unexpected value for style: %s", compiler.Display(v7)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool explode = 8; - v8 := compiler.MapValueForKey(m, "explode") - if v8 != nil { - x.Explode, ok = compiler.BoolForScalarNode(v8) - if !ok { - message := fmt.Sprintf("has unexpected value for explode: %s", compiler.Display(v8)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool allow_reserved = 9; - v9 := compiler.MapValueForKey(m, "allowReserved") - if v9 != nil { - x.AllowReserved, ok = compiler.BoolForScalarNode(v9) - if !ok { - message := fmt.Sprintf("has unexpected value for allowReserved: %s", compiler.Display(v9)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // SchemaOrReference schema = 10; - v10 := compiler.MapValueForKey(m, "schema") - if v10 != nil { - var err error - x.Schema, err = NewSchemaOrReference(v10, compiler.NewContext("schema", v10, context)) - if err != nil { - errors = append(errors, err) - } - } - // Any example = 11; - v11 := compiler.MapValueForKey(m, "example") - if v11 != nil { - var err error - x.Example, err = NewAny(v11, compiler.NewContext("example", v11, context)) - if err != nil { - errors = append(errors, err) - } - } - // ExamplesOrReferences examples = 12; - v12 := compiler.MapValueForKey(m, "examples") - if v12 != nil { - var err error - x.Examples, err = NewExamplesOrReferences(v12, compiler.NewContext("examples", v12, context)) - if err != nil { - errors = append(errors, err) - } - } - // MediaTypes content = 13; - v13 := compiler.MapValueForKey(m, "content") - if v13 != nil { - var err error - x.Content, err = NewMediaTypes(v13, compiler.NewContext("content", v13, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny specification_extension = 14; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewParameterOrReference creates an object of type ParameterOrReference if possible, returning an error if not. -func NewParameterOrReference(in *yaml.Node, context *compiler.Context) (*ParameterOrReference, error) { - errors := make([]error, 0) - x := &ParameterOrReference{} - matched := false - // Parameter parameter = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewParameter(m, compiler.NewContext("parameter", m, context)) - if matchingError == nil { - x.Oneof = &ParameterOrReference_Parameter{Parameter: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Reference reference = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewReference(m, compiler.NewContext("reference", m, context)) - if matchingError == nil { - x.Oneof = &ParameterOrReference_Reference{Reference: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid ParameterOrReference") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewParametersOrReferences creates an object of type ParametersOrReferences if possible, returning an error if not. -func NewParametersOrReferences(in *yaml.Node, context *compiler.Context) (*ParametersOrReferences, error) { - errors := make([]error, 0) - x := &ParametersOrReferences{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedParameterOrReference additional_properties = 1; - // MAP: ParameterOrReference - x.AdditionalProperties = make([]*NamedParameterOrReference, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedParameterOrReference{} - pair.Name = k - var err error - pair.Value, err = NewParameterOrReference(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewPathItem creates an object of type PathItem if possible, returning an error if not. -func NewPathItem(in *yaml.Node, context *compiler.Context) (*PathItem, error) { - errors := make([]error, 0) - x := &PathItem{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"$ref", "delete", "description", "get", "head", "options", "parameters", "patch", "post", "put", "servers", "summary", "trace"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string _ref = 1; - v1 := compiler.MapValueForKey(m, "$ref") - if v1 != nil { - x.XRef, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for $ref: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string summary = 2; - v2 := compiler.MapValueForKey(m, "summary") - if v2 != nil { - x.Summary, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for summary: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 3; - v3 := compiler.MapValueForKey(m, "description") - if v3 != nil { - x.Description, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Operation get = 4; - v4 := compiler.MapValueForKey(m, "get") - if v4 != nil { - var err error - x.Get, err = NewOperation(v4, compiler.NewContext("get", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation put = 5; - v5 := compiler.MapValueForKey(m, "put") - if v5 != nil { - var err error - x.Put, err = NewOperation(v5, compiler.NewContext("put", v5, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation post = 6; - v6 := compiler.MapValueForKey(m, "post") - if v6 != nil { - var err error - x.Post, err = NewOperation(v6, compiler.NewContext("post", v6, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation delete = 7; - v7 := compiler.MapValueForKey(m, "delete") - if v7 != nil { - var err error - x.Delete, err = NewOperation(v7, compiler.NewContext("delete", v7, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation options = 8; - v8 := compiler.MapValueForKey(m, "options") - if v8 != nil { - var err error - x.Options, err = NewOperation(v8, compiler.NewContext("options", v8, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation head = 9; - v9 := compiler.MapValueForKey(m, "head") - if v9 != nil { - var err error - x.Head, err = NewOperation(v9, compiler.NewContext("head", v9, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation patch = 10; - v10 := compiler.MapValueForKey(m, "patch") - if v10 != nil { - var err error - x.Patch, err = NewOperation(v10, compiler.NewContext("patch", v10, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation trace = 11; - v11 := compiler.MapValueForKey(m, "trace") - if v11 != nil { - var err error - x.Trace, err = NewOperation(v11, compiler.NewContext("trace", v11, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated Server servers = 12; - v12 := compiler.MapValueForKey(m, "servers") - if v12 != nil { - // repeated Server - x.Servers = make([]*Server, 0) - a, ok := compiler.SequenceNodeForNode(v12) - if ok { - for _, item := range a.Content { - y, err := NewServer(item, compiler.NewContext("servers", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Servers = append(x.Servers, y) - } - } - } - // repeated ParameterOrReference parameters = 13; - v13 := compiler.MapValueForKey(m, "parameters") - if v13 != nil { - // repeated ParameterOrReference - x.Parameters = make([]*ParameterOrReference, 0) - a, ok := compiler.SequenceNodeForNode(v13) - if ok { - for _, item := range a.Content { - y, err := NewParameterOrReference(item, compiler.NewContext("parameters", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Parameters = append(x.Parameters, y) - } - } - } - // repeated NamedAny specification_extension = 14; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewPaths creates an object of type Paths if possible, returning an error if not. -func NewPaths(in *yaml.Node, context *compiler.Context) (*Paths, error) { - errors := make([]error, 0) - x := &Paths{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{} - allowedPatterns := []*regexp.Regexp{pattern2, pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // repeated NamedPathItem path = 1; - // MAP: PathItem ^/ - x.Path = make([]*NamedPathItem, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "/") { - pair := &NamedPathItem{} - pair.Name = k - var err error - pair.Value, err = NewPathItem(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.Path = append(x.Path, pair) - } - } - } - // repeated NamedAny specification_extension = 2; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewProperties creates an object of type Properties if possible, returning an error if not. -func NewProperties(in *yaml.Node, context *compiler.Context) (*Properties, error) { - errors := make([]error, 0) - x := &Properties{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedSchemaOrReference additional_properties = 1; - // MAP: SchemaOrReference - x.AdditionalProperties = make([]*NamedSchemaOrReference, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedSchemaOrReference{} - pair.Name = k - var err error - pair.Value, err = NewSchemaOrReference(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewReference creates an object of type Reference if possible, returning an error if not. -func NewReference(in *yaml.Node, context *compiler.Context) (*Reference, error) { - errors := make([]error, 0) - x := &Reference{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"$ref"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string _ref = 1; - v1 := compiler.MapValueForKey(m, "$ref") - if v1 != nil { - x.XRef, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for $ref: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string summary = 2; - v2 := compiler.MapValueForKey(m, "summary") - if v2 != nil { - x.Summary, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for summary: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 3; - v3 := compiler.MapValueForKey(m, "description") - if v3 != nil { - x.Description, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewRequestBodiesOrReferences creates an object of type RequestBodiesOrReferences if possible, returning an error if not. -func NewRequestBodiesOrReferences(in *yaml.Node, context *compiler.Context) (*RequestBodiesOrReferences, error) { - errors := make([]error, 0) - x := &RequestBodiesOrReferences{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedRequestBodyOrReference additional_properties = 1; - // MAP: RequestBodyOrReference - x.AdditionalProperties = make([]*NamedRequestBodyOrReference, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedRequestBodyOrReference{} - pair.Name = k - var err error - pair.Value, err = NewRequestBodyOrReference(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewRequestBody creates an object of type RequestBody if possible, returning an error if not. -func NewRequestBody(in *yaml.Node, context *compiler.Context) (*RequestBody, error) { - errors := make([]error, 0) - x := &RequestBody{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"content"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"content", "description", "required"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string description = 1; - v1 := compiler.MapValueForKey(m, "description") - if v1 != nil { - x.Description, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // MediaTypes content = 2; - v2 := compiler.MapValueForKey(m, "content") - if v2 != nil { - var err error - x.Content, err = NewMediaTypes(v2, compiler.NewContext("content", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - // bool required = 3; - v3 := compiler.MapValueForKey(m, "required") - if v3 != nil { - x.Required, ok = compiler.BoolForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny specification_extension = 4; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewRequestBodyOrReference creates an object of type RequestBodyOrReference if possible, returning an error if not. -func NewRequestBodyOrReference(in *yaml.Node, context *compiler.Context) (*RequestBodyOrReference, error) { - errors := make([]error, 0) - x := &RequestBodyOrReference{} - matched := false - // RequestBody request_body = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewRequestBody(m, compiler.NewContext("requestBody", m, context)) - if matchingError == nil { - x.Oneof = &RequestBodyOrReference_RequestBody{RequestBody: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Reference reference = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewReference(m, compiler.NewContext("reference", m, context)) - if matchingError == nil { - x.Oneof = &RequestBodyOrReference_Reference{Reference: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid RequestBodyOrReference") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewResponse creates an object of type Response if possible, returning an error if not. -func NewResponse(in *yaml.Node, context *compiler.Context) (*Response, error) { - errors := make([]error, 0) - x := &Response{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"description"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"content", "description", "headers", "links"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string description = 1; - v1 := compiler.MapValueForKey(m, "description") - if v1 != nil { - x.Description, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // HeadersOrReferences headers = 2; - v2 := compiler.MapValueForKey(m, "headers") - if v2 != nil { - var err error - x.Headers, err = NewHeadersOrReferences(v2, compiler.NewContext("headers", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - // MediaTypes content = 3; - v3 := compiler.MapValueForKey(m, "content") - if v3 != nil { - var err error - x.Content, err = NewMediaTypes(v3, compiler.NewContext("content", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // LinksOrReferences links = 4; - v4 := compiler.MapValueForKey(m, "links") - if v4 != nil { - var err error - x.Links, err = NewLinksOrReferences(v4, compiler.NewContext("links", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny specification_extension = 5; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewResponseOrReference creates an object of type ResponseOrReference if possible, returning an error if not. -func NewResponseOrReference(in *yaml.Node, context *compiler.Context) (*ResponseOrReference, error) { - errors := make([]error, 0) - x := &ResponseOrReference{} - matched := false - // Response response = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewResponse(m, compiler.NewContext("response", m, context)) - if matchingError == nil { - x.Oneof = &ResponseOrReference_Response{Response: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Reference reference = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewReference(m, compiler.NewContext("reference", m, context)) - if matchingError == nil { - x.Oneof = &ResponseOrReference_Reference{Reference: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid ResponseOrReference") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewResponses creates an object of type Responses if possible, returning an error if not. -func NewResponses(in *yaml.Node, context *compiler.Context) (*Responses, error) { - errors := make([]error, 0) - x := &Responses{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"default"} - allowedPatterns := []*regexp.Regexp{pattern3, pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // ResponseOrReference default = 1; - v1 := compiler.MapValueForKey(m, "default") - if v1 != nil { - var err error - x.Default, err = NewResponseOrReference(v1, compiler.NewContext("default", v1, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedResponseOrReference response_or_reference = 2; - // MAP: ResponseOrReference ^([0-9X]{3})$ - x.ResponseOrReference = make([]*NamedResponseOrReference, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if pattern3.MatchString(k) { - pair := &NamedResponseOrReference{} - pair.Name = k - var err error - pair.Value, err = NewResponseOrReference(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.ResponseOrReference = append(x.ResponseOrReference, pair) - } - } - } - // repeated NamedAny specification_extension = 3; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewResponsesOrReferences creates an object of type ResponsesOrReferences if possible, returning an error if not. -func NewResponsesOrReferences(in *yaml.Node, context *compiler.Context) (*ResponsesOrReferences, error) { - errors := make([]error, 0) - x := &ResponsesOrReferences{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedResponseOrReference additional_properties = 1; - // MAP: ResponseOrReference - x.AdditionalProperties = make([]*NamedResponseOrReference, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedResponseOrReference{} - pair.Name = k - var err error - pair.Value, err = NewResponseOrReference(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSchema creates an object of type Schema if possible, returning an error if not. -func NewSchema(in *yaml.Node, context *compiler.Context) (*Schema, error) { - errors := make([]error, 0) - x := &Schema{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"additionalProperties", "allOf", "anyOf", "default", "deprecated", "description", "discriminator", "enum", "example", "exclusiveMaximum", "exclusiveMinimum", "externalDocs", "format", "items", "maxItems", "maxLength", "maxProperties", "maximum", "minItems", "minLength", "minProperties", "minimum", "multipleOf", "not", "nullable", "oneOf", "pattern", "properties", "readOnly", "required", "title", "type", "uniqueItems", "writeOnly", "xml"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // bool nullable = 1; - v1 := compiler.MapValueForKey(m, "nullable") - if v1 != nil { - x.Nullable, ok = compiler.BoolForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for nullable: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Discriminator discriminator = 2; - v2 := compiler.MapValueForKey(m, "discriminator") - if v2 != nil { - var err error - x.Discriminator, err = NewDiscriminator(v2, compiler.NewContext("discriminator", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - // bool read_only = 3; - v3 := compiler.MapValueForKey(m, "readOnly") - if v3 != nil { - x.ReadOnly, ok = compiler.BoolForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for readOnly: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool write_only = 4; - v4 := compiler.MapValueForKey(m, "writeOnly") - if v4 != nil { - x.WriteOnly, ok = compiler.BoolForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for writeOnly: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Xml xml = 5; - v5 := compiler.MapValueForKey(m, "xml") - if v5 != nil { - var err error - x.Xml, err = NewXml(v5, compiler.NewContext("xml", v5, context)) - if err != nil { - errors = append(errors, err) - } - } - // ExternalDocs external_docs = 6; - v6 := compiler.MapValueForKey(m, "externalDocs") - if v6 != nil { - var err error - x.ExternalDocs, err = NewExternalDocs(v6, compiler.NewContext("externalDocs", v6, context)) - if err != nil { - errors = append(errors, err) - } - } - // Any example = 7; - v7 := compiler.MapValueForKey(m, "example") - if v7 != nil { - var err error - x.Example, err = NewAny(v7, compiler.NewContext("example", v7, context)) - if err != nil { - errors = append(errors, err) - } - } - // bool deprecated = 8; - v8 := compiler.MapValueForKey(m, "deprecated") - if v8 != nil { - x.Deprecated, ok = compiler.BoolForScalarNode(v8) - if !ok { - message := fmt.Sprintf("has unexpected value for deprecated: %s", compiler.Display(v8)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string title = 9; - v9 := compiler.MapValueForKey(m, "title") - if v9 != nil { - x.Title, ok = compiler.StringForScalarNode(v9) - if !ok { - message := fmt.Sprintf("has unexpected value for title: %s", compiler.Display(v9)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // float multiple_of = 10; - v10 := compiler.MapValueForKey(m, "multipleOf") - if v10 != nil { - v, ok := compiler.FloatForScalarNode(v10) - if ok { - x.MultipleOf = v - } else { - message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v10)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // float maximum = 11; - v11 := compiler.MapValueForKey(m, "maximum") - if v11 != nil { - v, ok := compiler.FloatForScalarNode(v11) - if ok { - x.Maximum = v - } else { - message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v11)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_maximum = 12; - v12 := compiler.MapValueForKey(m, "exclusiveMaximum") - if v12 != nil { - x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v12) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v12)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // float minimum = 13; - v13 := compiler.MapValueForKey(m, "minimum") - if v13 != nil { - v, ok := compiler.FloatForScalarNode(v13) - if ok { - x.Minimum = v - } else { - message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v13)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_minimum = 14; - v14 := compiler.MapValueForKey(m, "exclusiveMinimum") - if v14 != nil { - x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v14) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v14)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_length = 15; - v15 := compiler.MapValueForKey(m, "maxLength") - if v15 != nil { - t, ok := compiler.IntForScalarNode(v15) - if ok { - x.MaxLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v15)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_length = 16; - v16 := compiler.MapValueForKey(m, "minLength") - if v16 != nil { - t, ok := compiler.IntForScalarNode(v16) - if ok { - x.MinLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v16)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string pattern = 17; - v17 := compiler.MapValueForKey(m, "pattern") - if v17 != nil { - x.Pattern, ok = compiler.StringForScalarNode(v17) - if !ok { - message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v17)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_items = 18; - v18 := compiler.MapValueForKey(m, "maxItems") - if v18 != nil { - t, ok := compiler.IntForScalarNode(v18) - if ok { - x.MaxItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v18)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_items = 19; - v19 := compiler.MapValueForKey(m, "minItems") - if v19 != nil { - t, ok := compiler.IntForScalarNode(v19) - if ok { - x.MinItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v19)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool unique_items = 20; - v20 := compiler.MapValueForKey(m, "uniqueItems") - if v20 != nil { - x.UniqueItems, ok = compiler.BoolForScalarNode(v20) - if !ok { - message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v20)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_properties = 21; - v21 := compiler.MapValueForKey(m, "maxProperties") - if v21 != nil { - t, ok := compiler.IntForScalarNode(v21) - if ok { - x.MaxProperties = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxProperties: %s", compiler.Display(v21)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_properties = 22; - v22 := compiler.MapValueForKey(m, "minProperties") - if v22 != nil { - t, ok := compiler.IntForScalarNode(v22) - if ok { - x.MinProperties = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minProperties: %s", compiler.Display(v22)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated string required = 23; - v23 := compiler.MapValueForKey(m, "required") - if v23 != nil { - v, ok := compiler.SequenceNodeForNode(v23) - if ok { - x.Required = compiler.StringArrayForSequenceNode(v) - } else { - message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v23)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated Any enum = 24; - v24 := compiler.MapValueForKey(m, "enum") - if v24 != nil { - // repeated Any - x.Enum = make([]*Any, 0) - a, ok := compiler.SequenceNodeForNode(v24) - if ok { - for _, item := range a.Content { - y, err := NewAny(item, compiler.NewContext("enum", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Enum = append(x.Enum, y) - } - } - } - // string type = 25; - v25 := compiler.MapValueForKey(m, "type") - if v25 != nil { - x.Type, ok = compiler.StringForScalarNode(v25) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v25)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated SchemaOrReference all_of = 26; - v26 := compiler.MapValueForKey(m, "allOf") - if v26 != nil { - // repeated SchemaOrReference - x.AllOf = make([]*SchemaOrReference, 0) - a, ok := compiler.SequenceNodeForNode(v26) - if ok { - for _, item := range a.Content { - y, err := NewSchemaOrReference(item, compiler.NewContext("allOf", item, context)) - if err != nil { - errors = append(errors, err) - } - x.AllOf = append(x.AllOf, y) - } - } - } - // repeated SchemaOrReference one_of = 27; - v27 := compiler.MapValueForKey(m, "oneOf") - if v27 != nil { - // repeated SchemaOrReference - x.OneOf = make([]*SchemaOrReference, 0) - a, ok := compiler.SequenceNodeForNode(v27) - if ok { - for _, item := range a.Content { - y, err := NewSchemaOrReference(item, compiler.NewContext("oneOf", item, context)) - if err != nil { - errors = append(errors, err) - } - x.OneOf = append(x.OneOf, y) - } - } - } - // repeated SchemaOrReference any_of = 28; - v28 := compiler.MapValueForKey(m, "anyOf") - if v28 != nil { - // repeated SchemaOrReference - x.AnyOf = make([]*SchemaOrReference, 0) - a, ok := compiler.SequenceNodeForNode(v28) - if ok { - for _, item := range a.Content { - y, err := NewSchemaOrReference(item, compiler.NewContext("anyOf", item, context)) - if err != nil { - errors = append(errors, err) - } - x.AnyOf = append(x.AnyOf, y) - } - } - } - // Schema not = 29; - v29 := compiler.MapValueForKey(m, "not") - if v29 != nil { - var err error - x.Not, err = NewSchema(v29, compiler.NewContext("not", v29, context)) - if err != nil { - errors = append(errors, err) - } - } - // ItemsItem items = 30; - v30 := compiler.MapValueForKey(m, "items") - if v30 != nil { - var err error - x.Items, err = NewItemsItem(v30, compiler.NewContext("items", v30, context)) - if err != nil { - errors = append(errors, err) - } - } - // Properties properties = 31; - v31 := compiler.MapValueForKey(m, "properties") - if v31 != nil { - var err error - x.Properties, err = NewProperties(v31, compiler.NewContext("properties", v31, context)) - if err != nil { - errors = append(errors, err) - } - } - // AdditionalPropertiesItem additional_properties = 32; - v32 := compiler.MapValueForKey(m, "additionalProperties") - if v32 != nil { - var err error - x.AdditionalProperties, err = NewAdditionalPropertiesItem(v32, compiler.NewContext("additionalProperties", v32, context)) - if err != nil { - errors = append(errors, err) - } - } - // DefaultType default = 33; - v33 := compiler.MapValueForKey(m, "default") - if v33 != nil { - var err error - x.Default, err = NewDefaultType(v33, compiler.NewContext("default", v33, context)) - if err != nil { - errors = append(errors, err) - } - } - // string description = 34; - v34 := compiler.MapValueForKey(m, "description") - if v34 != nil { - x.Description, ok = compiler.StringForScalarNode(v34) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v34)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string format = 35; - v35 := compiler.MapValueForKey(m, "format") - if v35 != nil { - x.Format, ok = compiler.StringForScalarNode(v35) - if !ok { - message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v35)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny specification_extension = 36; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSchemaOrReference creates an object of type SchemaOrReference if possible, returning an error if not. -func NewSchemaOrReference(in *yaml.Node, context *compiler.Context) (*SchemaOrReference, error) { - errors := make([]error, 0) - x := &SchemaOrReference{} - matched := false - // Schema schema = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewSchema(m, compiler.NewContext("schema", m, context)) - if matchingError == nil { - x.Oneof = &SchemaOrReference_Schema{Schema: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Reference reference = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewReference(m, compiler.NewContext("reference", m, context)) - if matchingError == nil { - x.Oneof = &SchemaOrReference_Reference{Reference: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid SchemaOrReference") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSchemasOrReferences creates an object of type SchemasOrReferences if possible, returning an error if not. -func NewSchemasOrReferences(in *yaml.Node, context *compiler.Context) (*SchemasOrReferences, error) { - errors := make([]error, 0) - x := &SchemasOrReferences{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedSchemaOrReference additional_properties = 1; - // MAP: SchemaOrReference - x.AdditionalProperties = make([]*NamedSchemaOrReference, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedSchemaOrReference{} - pair.Name = k - var err error - pair.Value, err = NewSchemaOrReference(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSecurityRequirement creates an object of type SecurityRequirement if possible, returning an error if not. -func NewSecurityRequirement(in *yaml.Node, context *compiler.Context) (*SecurityRequirement, error) { - errors := make([]error, 0) - x := &SecurityRequirement{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedStringArray additional_properties = 1; - // MAP: StringArray - x.AdditionalProperties = make([]*NamedStringArray, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedStringArray{} - pair.Name = k - var err error - pair.Value, err = NewStringArray(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSecurityScheme creates an object of type SecurityScheme if possible, returning an error if not. -func NewSecurityScheme(in *yaml.Node, context *compiler.Context) (*SecurityScheme, error) { - errors := make([]error, 0) - x := &SecurityScheme{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"type"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"bearerFormat", "description", "flows", "in", "name", "openIdConnectUrl", "scheme", "type"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string type = 1; - v1 := compiler.MapValueForKey(m, "type") - if v1 != nil { - x.Type, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 2; - v2 := compiler.MapValueForKey(m, "description") - if v2 != nil { - x.Description, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string name = 3; - v3 := compiler.MapValueForKey(m, "name") - if v3 != nil { - x.Name, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string in = 4; - v4 := compiler.MapValueForKey(m, "in") - if v4 != nil { - x.In, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string scheme = 5; - v5 := compiler.MapValueForKey(m, "scheme") - if v5 != nil { - x.Scheme, ok = compiler.StringForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for scheme: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string bearer_format = 6; - v6 := compiler.MapValueForKey(m, "bearerFormat") - if v6 != nil { - x.BearerFormat, ok = compiler.StringForScalarNode(v6) - if !ok { - message := fmt.Sprintf("has unexpected value for bearerFormat: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // OauthFlows flows = 7; - v7 := compiler.MapValueForKey(m, "flows") - if v7 != nil { - var err error - x.Flows, err = NewOauthFlows(v7, compiler.NewContext("flows", v7, context)) - if err != nil { - errors = append(errors, err) - } - } - // string open_id_connect_url = 8; - v8 := compiler.MapValueForKey(m, "openIdConnectUrl") - if v8 != nil { - x.OpenIdConnectUrl, ok = compiler.StringForScalarNode(v8) - if !ok { - message := fmt.Sprintf("has unexpected value for openIdConnectUrl: %s", compiler.Display(v8)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny specification_extension = 9; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSecuritySchemeOrReference creates an object of type SecuritySchemeOrReference if possible, returning an error if not. -func NewSecuritySchemeOrReference(in *yaml.Node, context *compiler.Context) (*SecuritySchemeOrReference, error) { - errors := make([]error, 0) - x := &SecuritySchemeOrReference{} - matched := false - // SecurityScheme security_scheme = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewSecurityScheme(m, compiler.NewContext("securityScheme", m, context)) - if matchingError == nil { - x.Oneof = &SecuritySchemeOrReference_SecurityScheme{SecurityScheme: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Reference reference = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewReference(m, compiler.NewContext("reference", m, context)) - if matchingError == nil { - x.Oneof = &SecuritySchemeOrReference_Reference{Reference: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid SecuritySchemeOrReference") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSecuritySchemesOrReferences creates an object of type SecuritySchemesOrReferences if possible, returning an error if not. -func NewSecuritySchemesOrReferences(in *yaml.Node, context *compiler.Context) (*SecuritySchemesOrReferences, error) { - errors := make([]error, 0) - x := &SecuritySchemesOrReferences{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedSecuritySchemeOrReference additional_properties = 1; - // MAP: SecuritySchemeOrReference - x.AdditionalProperties = make([]*NamedSecuritySchemeOrReference, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedSecuritySchemeOrReference{} - pair.Name = k - var err error - pair.Value, err = NewSecuritySchemeOrReference(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewServer creates an object of type Server if possible, returning an error if not. -func NewServer(in *yaml.Node, context *compiler.Context) (*Server, error) { - errors := make([]error, 0) - x := &Server{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"url"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"description", "url", "variables"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string url = 1; - v1 := compiler.MapValueForKey(m, "url") - if v1 != nil { - x.Url, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 2; - v2 := compiler.MapValueForKey(m, "description") - if v2 != nil { - x.Description, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // ServerVariables variables = 3; - v3 := compiler.MapValueForKey(m, "variables") - if v3 != nil { - var err error - x.Variables, err = NewServerVariables(v3, compiler.NewContext("variables", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny specification_extension = 4; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewServerVariable creates an object of type ServerVariable if possible, returning an error if not. -func NewServerVariable(in *yaml.Node, context *compiler.Context) (*ServerVariable, error) { - errors := make([]error, 0) - x := &ServerVariable{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"default"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"default", "description", "enum"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // repeated string enum = 1; - v1 := compiler.MapValueForKey(m, "enum") - if v1 != nil { - v, ok := compiler.SequenceNodeForNode(v1) - if ok { - x.Enum = compiler.StringArrayForSequenceNode(v) - } else { - message := fmt.Sprintf("has unexpected value for enum: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string default = 2; - v2 := compiler.MapValueForKey(m, "default") - if v2 != nil { - x.Default, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for default: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 3; - v3 := compiler.MapValueForKey(m, "description") - if v3 != nil { - x.Description, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny specification_extension = 4; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewServerVariables creates an object of type ServerVariables if possible, returning an error if not. -func NewServerVariables(in *yaml.Node, context *compiler.Context) (*ServerVariables, error) { - errors := make([]error, 0) - x := &ServerVariables{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedServerVariable additional_properties = 1; - // MAP: ServerVariable - x.AdditionalProperties = make([]*NamedServerVariable, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedServerVariable{} - pair.Name = k - var err error - pair.Value, err = NewServerVariable(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSpecificationExtension creates an object of type SpecificationExtension if possible, returning an error if not. -func NewSpecificationExtension(in *yaml.Node, context *compiler.Context) (*SpecificationExtension, error) { - errors := make([]error, 0) - x := &SpecificationExtension{} - matched := false - switch in.Tag { - case "!!bool": - var v bool - v, matched = compiler.BoolForScalarNode(in) - x.Oneof = &SpecificationExtension_Boolean{Boolean: v} - case "!!str": - var v string - v, matched = compiler.StringForScalarNode(in) - x.Oneof = &SpecificationExtension_String_{String_: v} - case "!!float": - var v float64 - v, matched = compiler.FloatForScalarNode(in) - x.Oneof = &SpecificationExtension_Number{Number: v} - case "!!int": - var v int64 - v, matched = compiler.IntForScalarNode(in) - x.Oneof = &SpecificationExtension_Number{Number: float64(v)} - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewStringArray creates an object of type StringArray if possible, returning an error if not. -func NewStringArray(in *yaml.Node, context *compiler.Context) (*StringArray, error) { - errors := make([]error, 0) - x := &StringArray{} - x.Value = make([]string, 0) - for _, node := range in.Content { - s, _ := compiler.StringForScalarNode(node) - x.Value = append(x.Value, s) - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewStrings creates an object of type Strings if possible, returning an error if not. -func NewStrings(in *yaml.Node, context *compiler.Context) (*Strings, error) { - errors := make([]error, 0) - x := &Strings{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedString additional_properties = 1; - // MAP: string - x.AdditionalProperties = make([]*NamedString, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedString{} - pair.Name = k - pair.Value, _ = compiler.StringForScalarNode(v) - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewTag creates an object of type Tag if possible, returning an error if not. -func NewTag(in *yaml.Node, context *compiler.Context) (*Tag, error) { - errors := make([]error, 0) - x := &Tag{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"name"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"description", "externalDocs", "name"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 2; - v2 := compiler.MapValueForKey(m, "description") - if v2 != nil { - x.Description, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // ExternalDocs external_docs = 3; - v3 := compiler.MapValueForKey(m, "externalDocs") - if v3 != nil { - var err error - x.ExternalDocs, err = NewExternalDocs(v3, compiler.NewContext("externalDocs", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny specification_extension = 4; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewXml creates an object of type Xml if possible, returning an error if not. -func NewXml(in *yaml.Node, context *compiler.Context) (*Xml, error) { - errors := make([]error, 0) - x := &Xml{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"attribute", "name", "namespace", "prefix", "wrapped"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string namespace = 2; - v2 := compiler.MapValueForKey(m, "namespace") - if v2 != nil { - x.Namespace, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for namespace: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string prefix = 3; - v3 := compiler.MapValueForKey(m, "prefix") - if v3 != nil { - x.Prefix, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for prefix: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool attribute = 4; - v4 := compiler.MapValueForKey(m, "attribute") - if v4 != nil { - x.Attribute, ok = compiler.BoolForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for attribute: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool wrapped = 5; - v5 := compiler.MapValueForKey(m, "wrapped") - if v5 != nil { - x.Wrapped, ok = compiler.BoolForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for wrapped: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny specification_extension = 6; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside AdditionalPropertiesItem objects. -func (m *AdditionalPropertiesItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*AdditionalPropertiesItem_SchemaOrReference) - if ok { - _, err := p.SchemaOrReference.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Any objects. -func (m *Any) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside AnyOrExpression objects. -func (m *AnyOrExpression) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*AnyOrExpression_Any) - if ok { - _, err := p.Any.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*AnyOrExpression_Expression) - if ok { - _, err := p.Expression.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Callback objects. -func (m *Callback) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.Path { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside CallbackOrReference objects. -func (m *CallbackOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*CallbackOrReference_Callback) - if ok { - _, err := p.Callback.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*CallbackOrReference_Reference) - if ok { - _, err := p.Reference.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside CallbacksOrReferences objects. -func (m *CallbacksOrReferences) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Components objects. -func (m *Components) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Schemas != nil { - _, err := m.Schemas.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Responses != nil { - _, err := m.Responses.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Parameters != nil { - _, err := m.Parameters.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Examples != nil { - _, err := m.Examples.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.RequestBodies != nil { - _, err := m.RequestBodies.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Headers != nil { - _, err := m.Headers.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.SecuritySchemes != nil { - _, err := m.SecuritySchemes.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Links != nil { - _, err := m.Links.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Callbacks != nil { - _, err := m.Callbacks.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Contact objects. -func (m *Contact) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside DefaultType objects. -func (m *DefaultType) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Discriminator objects. -func (m *Discriminator) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Mapping != nil { - _, err := m.Mapping.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Document objects. -func (m *Document) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Info != nil { - _, err := m.Info.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Servers { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - if m.Paths != nil { - _, err := m.Paths.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Components != nil { - _, err := m.Components.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Security { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.Tags { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - if m.ExternalDocs != nil { - _, err := m.ExternalDocs.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Encoding objects. -func (m *Encoding) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Headers != nil { - _, err := m.Headers.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Encodings objects. -func (m *Encodings) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Example objects. -func (m *Example) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ExampleOrReference objects. -func (m *ExampleOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*ExampleOrReference_Example) - if ok { - _, err := p.Example.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*ExampleOrReference_Reference) - if ok { - _, err := p.Reference.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ExamplesOrReferences objects. -func (m *ExamplesOrReferences) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Expression objects. -func (m *Expression) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ExternalDocs objects. -func (m *ExternalDocs) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Header objects. -func (m *Header) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Schema != nil { - _, err := m.Schema.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Example != nil { - _, err := m.Example.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Examples != nil { - _, err := m.Examples.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Content != nil { - _, err := m.Content.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside HeaderOrReference objects. -func (m *HeaderOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*HeaderOrReference_Header) - if ok { - _, err := p.Header.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*HeaderOrReference_Reference) - if ok { - _, err := p.Reference.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside HeadersOrReferences objects. -func (m *HeadersOrReferences) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Info objects. -func (m *Info) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Contact != nil { - _, err := m.Contact.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.License != nil { - _, err := m.License.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ItemsItem objects. -func (m *ItemsItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.SchemaOrReference { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside License objects. -func (m *License) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Link objects. -func (m *Link) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Parameters != nil { - _, err := m.Parameters.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.RequestBody != nil { - _, err := m.RequestBody.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Server != nil { - _, err := m.Server.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside LinkOrReference objects. -func (m *LinkOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*LinkOrReference_Link) - if ok { - _, err := p.Link.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*LinkOrReference_Reference) - if ok { - _, err := p.Reference.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside LinksOrReferences objects. -func (m *LinksOrReferences) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside MediaType objects. -func (m *MediaType) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Schema != nil { - _, err := m.Schema.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Example != nil { - _, err := m.Example.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Examples != nil { - _, err := m.Examples.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Encoding != nil { - _, err := m.Encoding.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside MediaTypes objects. -func (m *MediaTypes) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedAny objects. -func (m *NamedAny) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedCallbackOrReference objects. -func (m *NamedCallbackOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedEncoding objects. -func (m *NamedEncoding) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedExampleOrReference objects. -func (m *NamedExampleOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedHeaderOrReference objects. -func (m *NamedHeaderOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedLinkOrReference objects. -func (m *NamedLinkOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedMediaType objects. -func (m *NamedMediaType) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedParameterOrReference objects. -func (m *NamedParameterOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedPathItem objects. -func (m *NamedPathItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedRequestBodyOrReference objects. -func (m *NamedRequestBodyOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedResponseOrReference objects. -func (m *NamedResponseOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedSchemaOrReference objects. -func (m *NamedSchemaOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedSecuritySchemeOrReference objects. -func (m *NamedSecuritySchemeOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedServerVariable objects. -func (m *NamedServerVariable) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedString objects. -func (m *NamedString) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedStringArray objects. -func (m *NamedStringArray) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside OauthFlow objects. -func (m *OauthFlow) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Scopes != nil { - _, err := m.Scopes.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside OauthFlows objects. -func (m *OauthFlows) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Implicit != nil { - _, err := m.Implicit.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Password != nil { - _, err := m.Password.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.ClientCredentials != nil { - _, err := m.ClientCredentials.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.AuthorizationCode != nil { - _, err := m.AuthorizationCode.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Object objects. -func (m *Object) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Operation objects. -func (m *Operation) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.ExternalDocs != nil { - _, err := m.ExternalDocs.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Parameters { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - if m.RequestBody != nil { - _, err := m.RequestBody.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Responses != nil { - _, err := m.Responses.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Callbacks != nil { - _, err := m.Callbacks.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Security { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.Servers { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Parameter objects. -func (m *Parameter) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Schema != nil { - _, err := m.Schema.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Example != nil { - _, err := m.Example.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Examples != nil { - _, err := m.Examples.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Content != nil { - _, err := m.Content.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ParameterOrReference objects. -func (m *ParameterOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*ParameterOrReference_Parameter) - if ok { - _, err := p.Parameter.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*ParameterOrReference_Reference) - if ok { - _, err := p.Reference.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ParametersOrReferences objects. -func (m *ParametersOrReferences) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside PathItem objects. -func (m *PathItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.XRef != "" { - info, err := compiler.ReadInfoForRef(root, m.XRef) - if err != nil { - return nil, err - } - if info != nil { - replacement, err := NewPathItem(info, nil) - if err == nil { - *m = *replacement - return m.ResolveReferences(root) - } - } - return info, nil - } - if m.Get != nil { - _, err := m.Get.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Put != nil { - _, err := m.Put.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Post != nil { - _, err := m.Post.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Delete != nil { - _, err := m.Delete.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Options != nil { - _, err := m.Options.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Head != nil { - _, err := m.Head.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Patch != nil { - _, err := m.Patch.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Trace != nil { - _, err := m.Trace.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Servers { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.Parameters { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Paths objects. -func (m *Paths) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.Path { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Properties objects. -func (m *Properties) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Reference objects. -func (m *Reference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.XRef != "" { - info, err := compiler.ReadInfoForRef(root, m.XRef) - if err != nil { - return nil, err - } - if info != nil { - replacement, err := NewReference(info, nil) - if err == nil { - *m = *replacement - return m.ResolveReferences(root) - } - } - return info, nil - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside RequestBodiesOrReferences objects. -func (m *RequestBodiesOrReferences) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside RequestBody objects. -func (m *RequestBody) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Content != nil { - _, err := m.Content.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside RequestBodyOrReference objects. -func (m *RequestBodyOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*RequestBodyOrReference_RequestBody) - if ok { - _, err := p.RequestBody.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*RequestBodyOrReference_Reference) - if ok { - _, err := p.Reference.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Response objects. -func (m *Response) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Headers != nil { - _, err := m.Headers.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Content != nil { - _, err := m.Content.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Links != nil { - _, err := m.Links.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ResponseOrReference objects. -func (m *ResponseOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*ResponseOrReference_Response) - if ok { - _, err := p.Response.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*ResponseOrReference_Reference) - if ok { - _, err := p.Reference.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Responses objects. -func (m *Responses) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Default != nil { - _, err := m.Default.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.ResponseOrReference { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ResponsesOrReferences objects. -func (m *ResponsesOrReferences) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Schema objects. -func (m *Schema) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Discriminator != nil { - _, err := m.Discriminator.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Xml != nil { - _, err := m.Xml.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.ExternalDocs != nil { - _, err := m.ExternalDocs.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Example != nil { - _, err := m.Example.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Enum { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.AllOf { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.OneOf { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.AnyOf { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - if m.Not != nil { - _, err := m.Not.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Items != nil { - _, err := m.Items.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Properties != nil { - _, err := m.Properties.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.AdditionalProperties != nil { - _, err := m.AdditionalProperties.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Default != nil { - _, err := m.Default.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside SchemaOrReference objects. -func (m *SchemaOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*SchemaOrReference_Schema) - if ok { - _, err := p.Schema.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*SchemaOrReference_Reference) - if ok { - _, err := p.Reference.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside SchemasOrReferences objects. -func (m *SchemasOrReferences) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside SecurityRequirement objects. -func (m *SecurityRequirement) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside SecurityScheme objects. -func (m *SecurityScheme) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Flows != nil { - _, err := m.Flows.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside SecuritySchemeOrReference objects. -func (m *SecuritySchemeOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*SecuritySchemeOrReference_SecurityScheme) - if ok { - _, err := p.SecurityScheme.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*SecuritySchemeOrReference_Reference) - if ok { - _, err := p.Reference.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside SecuritySchemesOrReferences objects. -func (m *SecuritySchemesOrReferences) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Server objects. -func (m *Server) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Variables != nil { - _, err := m.Variables.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ServerVariable objects. -func (m *ServerVariable) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ServerVariables objects. -func (m *ServerVariables) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside SpecificationExtension objects. -func (m *SpecificationExtension) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside StringArray objects. -func (m *StringArray) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Strings objects. -func (m *Strings) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Tag objects. -func (m *Tag) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.ExternalDocs != nil { - _, err := m.ExternalDocs.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Xml objects. -func (m *Xml) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ToRawInfo returns a description of AdditionalPropertiesItem suitable for JSON or YAML export. -func (m *AdditionalPropertiesItem) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // AdditionalPropertiesItem - // {Name:schemaOrReference Type:SchemaOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetSchemaOrReference() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:boolean Type:bool StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - if v1, ok := m.GetOneof().(*AdditionalPropertiesItem_Boolean); ok { - return compiler.NewScalarNodeForBool(v1.Boolean) - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of Any suitable for JSON or YAML export. -func (m *Any) ToRawInfo() *yaml.Node { - var err error - var node yaml.Node - err = yaml.Unmarshal([]byte(m.Yaml), &node) - if err == nil { - if node.Kind == yaml.DocumentNode { - return node.Content[0] - } - return &node - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of AnyOrExpression suitable for JSON or YAML export. -func (m *AnyOrExpression) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // AnyOrExpression - // {Name:any Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetAny() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:expression Type:Expression StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetExpression() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of Callback suitable for JSON or YAML export. -func (m *Callback) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Path != nil { - for _, item := range m.Path { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of CallbackOrReference suitable for JSON or YAML export. -func (m *CallbackOrReference) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // CallbackOrReference - // {Name:callback Type:Callback StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetCallback() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetReference() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of CallbacksOrReferences suitable for JSON or YAML export. -func (m *CallbacksOrReferences) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Components suitable for JSON or YAML export. -func (m *Components) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Schemas != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("schemas")) - info.Content = append(info.Content, m.Schemas.ToRawInfo()) - } - if m.Responses != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("responses")) - info.Content = append(info.Content, m.Responses.ToRawInfo()) - } - if m.Parameters != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters")) - info.Content = append(info.Content, m.Parameters.ToRawInfo()) - } - if m.Examples != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("examples")) - info.Content = append(info.Content, m.Examples.ToRawInfo()) - } - if m.RequestBodies != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("requestBodies")) - info.Content = append(info.Content, m.RequestBodies.ToRawInfo()) - } - if m.Headers != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("headers")) - info.Content = append(info.Content, m.Headers.ToRawInfo()) - } - if m.SecuritySchemes != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("securitySchemes")) - info.Content = append(info.Content, m.SecuritySchemes.ToRawInfo()) - } - if m.Links != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("links")) - info.Content = append(info.Content, m.Links.ToRawInfo()) - } - if m.Callbacks != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("callbacks")) - info.Content = append(info.Content, m.Callbacks.ToRawInfo()) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Contact suitable for JSON or YAML export. -func (m *Contact) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.Url != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("url")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url)) - } - if m.Email != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("email")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Email)) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of DefaultType suitable for JSON or YAML export. -func (m *DefaultType) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // DefaultType - // {Name:number Type:float StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - if v0, ok := m.GetOneof().(*DefaultType_Number); ok { - return compiler.NewScalarNodeForFloat(v0.Number) - } - // {Name:boolean Type:bool StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - if v1, ok := m.GetOneof().(*DefaultType_Boolean); ok { - return compiler.NewScalarNodeForBool(v1.Boolean) - } - // {Name:string Type:string StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - if v2, ok := m.GetOneof().(*DefaultType_String_); ok { - return compiler.NewScalarNodeForString(v2.String_) - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of Discriminator suitable for JSON or YAML export. -func (m *Discriminator) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("propertyName")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.PropertyName)) - if m.Mapping != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("mapping")) - info.Content = append(info.Content, m.Mapping.ToRawInfo()) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Document suitable for JSON or YAML export. -func (m *Document) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("openapi")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Openapi)) - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("info")) - info.Content = append(info.Content, m.Info.ToRawInfo()) - if len(m.Servers) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Servers { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("servers")) - info.Content = append(info.Content, items) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("paths")) - info.Content = append(info.Content, m.Paths.ToRawInfo()) - if m.Components != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("components")) - info.Content = append(info.Content, m.Components.ToRawInfo()) - } - if len(m.Security) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Security { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("security")) - info.Content = append(info.Content, items) - } - if len(m.Tags) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Tags { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("tags")) - info.Content = append(info.Content, items) - } - if m.ExternalDocs != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs")) - info.Content = append(info.Content, m.ExternalDocs.ToRawInfo()) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Encoding suitable for JSON or YAML export. -func (m *Encoding) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.ContentType != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("contentType")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.ContentType)) - } - if m.Headers != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("headers")) - info.Content = append(info.Content, m.Headers.ToRawInfo()) - } - if m.Style != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("style")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Style)) - } - if m.Explode != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("explode")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Explode)) - } - if m.AllowReserved != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("allowReserved")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowReserved)) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Encodings suitable for JSON or YAML export. -func (m *Encodings) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Example suitable for JSON or YAML export. -func (m *Example) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Summary != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("summary")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Summary)) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Value != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("value")) - info.Content = append(info.Content, m.Value.ToRawInfo()) - } - if m.ExternalValue != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("externalValue")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.ExternalValue)) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ExampleOrReference suitable for JSON or YAML export. -func (m *ExampleOrReference) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // ExampleOrReference - // {Name:example Type:Example StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetExample() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetReference() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of ExamplesOrReferences suitable for JSON or YAML export. -func (m *ExamplesOrReferences) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Expression suitable for JSON or YAML export. -func (m *Expression) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ExternalDocs suitable for JSON or YAML export. -func (m *ExternalDocs) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("url")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url)) - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Header suitable for JSON or YAML export. -func (m *Header) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Required != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required)) - } - if m.Deprecated != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("deprecated")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Deprecated)) - } - if m.AllowEmptyValue != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("allowEmptyValue")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowEmptyValue)) - } - if m.Style != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("style")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Style)) - } - if m.Explode != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("explode")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Explode)) - } - if m.AllowReserved != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("allowReserved")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowReserved)) - } - if m.Schema != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("schema")) - info.Content = append(info.Content, m.Schema.ToRawInfo()) - } - if m.Example != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("example")) - info.Content = append(info.Content, m.Example.ToRawInfo()) - } - if m.Examples != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("examples")) - info.Content = append(info.Content, m.Examples.ToRawInfo()) - } - if m.Content != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("content")) - info.Content = append(info.Content, m.Content.ToRawInfo()) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of HeaderOrReference suitable for JSON or YAML export. -func (m *HeaderOrReference) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // HeaderOrReference - // {Name:header Type:Header StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetHeader() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetReference() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of HeadersOrReferences suitable for JSON or YAML export. -func (m *HeadersOrReferences) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Info suitable for JSON or YAML export. -func (m *Info) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("title")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Title)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.TermsOfService != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("termsOfService")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TermsOfService)) - } - if m.Contact != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("contact")) - info.Content = append(info.Content, m.Contact.ToRawInfo()) - } - if m.License != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("license")) - info.Content = append(info.Content, m.License.ToRawInfo()) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("version")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Version)) - if m.Summary != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("summary")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Summary)) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ItemsItem suitable for JSON or YAML export. -func (m *ItemsItem) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if len(m.SchemaOrReference) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.SchemaOrReference { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("schemaOrReference")) - info.Content = append(info.Content, items) - } - return info -} - -// ToRawInfo returns a description of License suitable for JSON or YAML export. -func (m *License) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - if m.Url != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("url")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url)) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Link suitable for JSON or YAML export. -func (m *Link) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.OperationRef != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("operationRef")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.OperationRef)) - } - if m.OperationId != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("operationId")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.OperationId)) - } - if m.Parameters != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters")) - info.Content = append(info.Content, m.Parameters.ToRawInfo()) - } - if m.RequestBody != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("requestBody")) - info.Content = append(info.Content, m.RequestBody.ToRawInfo()) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Server != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("server")) - info.Content = append(info.Content, m.Server.ToRawInfo()) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of LinkOrReference suitable for JSON or YAML export. -func (m *LinkOrReference) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // LinkOrReference - // {Name:link Type:Link StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetLink() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetReference() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of LinksOrReferences suitable for JSON or YAML export. -func (m *LinksOrReferences) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of MediaType suitable for JSON or YAML export. -func (m *MediaType) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Schema != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("schema")) - info.Content = append(info.Content, m.Schema.ToRawInfo()) - } - if m.Example != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("example")) - info.Content = append(info.Content, m.Example.ToRawInfo()) - } - if m.Examples != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("examples")) - info.Content = append(info.Content, m.Examples.ToRawInfo()) - } - if m.Encoding != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("encoding")) - info.Content = append(info.Content, m.Encoding.ToRawInfo()) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of MediaTypes suitable for JSON or YAML export. -func (m *MediaTypes) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of NamedAny suitable for JSON or YAML export. -func (m *NamedAny) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.Value != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("value")) - info.Content = append(info.Content, m.Value.ToRawInfo()) - } - return info -} - -// ToRawInfo returns a description of NamedCallbackOrReference suitable for JSON or YAML export. -func (m *NamedCallbackOrReference) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:CallbackOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedEncoding suitable for JSON or YAML export. -func (m *NamedEncoding) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:Encoding StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedExampleOrReference suitable for JSON or YAML export. -func (m *NamedExampleOrReference) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:ExampleOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedHeaderOrReference suitable for JSON or YAML export. -func (m *NamedHeaderOrReference) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:HeaderOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedLinkOrReference suitable for JSON or YAML export. -func (m *NamedLinkOrReference) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:LinkOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedMediaType suitable for JSON or YAML export. -func (m *NamedMediaType) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:MediaType StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedParameterOrReference suitable for JSON or YAML export. -func (m *NamedParameterOrReference) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:ParameterOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedPathItem suitable for JSON or YAML export. -func (m *NamedPathItem) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:PathItem StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedRequestBodyOrReference suitable for JSON or YAML export. -func (m *NamedRequestBodyOrReference) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:RequestBodyOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedResponseOrReference suitable for JSON or YAML export. -func (m *NamedResponseOrReference) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:ResponseOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedSchemaOrReference suitable for JSON or YAML export. -func (m *NamedSchemaOrReference) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:SchemaOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedSecuritySchemeOrReference suitable for JSON or YAML export. -func (m *NamedSecuritySchemeOrReference) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:SecuritySchemeOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedServerVariable suitable for JSON or YAML export. -func (m *NamedServerVariable) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:ServerVariable StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedString suitable for JSON or YAML export. -func (m *NamedString) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.Value != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("value")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Value)) - } - return info -} - -// ToRawInfo returns a description of NamedStringArray suitable for JSON or YAML export. -func (m *NamedStringArray) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:StringArray StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of OauthFlow suitable for JSON or YAML export. -func (m *OauthFlow) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AuthorizationUrl != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("authorizationUrl")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.AuthorizationUrl)) - } - if m.TokenUrl != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("tokenUrl")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TokenUrl)) - } - if m.RefreshUrl != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("refreshUrl")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.RefreshUrl)) - } - if m.Scopes != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("scopes")) - info.Content = append(info.Content, m.Scopes.ToRawInfo()) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of OauthFlows suitable for JSON or YAML export. -func (m *OauthFlows) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Implicit != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("implicit")) - info.Content = append(info.Content, m.Implicit.ToRawInfo()) - } - if m.Password != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("password")) - info.Content = append(info.Content, m.Password.ToRawInfo()) - } - if m.ClientCredentials != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("clientCredentials")) - info.Content = append(info.Content, m.ClientCredentials.ToRawInfo()) - } - if m.AuthorizationCode != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("authorizationCode")) - info.Content = append(info.Content, m.AuthorizationCode.ToRawInfo()) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Object suitable for JSON or YAML export. -func (m *Object) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Operation suitable for JSON or YAML export. -func (m *Operation) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if len(m.Tags) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("tags")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Tags)) - } - if m.Summary != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("summary")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Summary)) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.ExternalDocs != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs")) - info.Content = append(info.Content, m.ExternalDocs.ToRawInfo()) - } - if m.OperationId != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("operationId")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.OperationId)) - } - if len(m.Parameters) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Parameters { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters")) - info.Content = append(info.Content, items) - } - if m.RequestBody != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("requestBody")) - info.Content = append(info.Content, m.RequestBody.ToRawInfo()) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("responses")) - info.Content = append(info.Content, m.Responses.ToRawInfo()) - if m.Callbacks != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("callbacks")) - info.Content = append(info.Content, m.Callbacks.ToRawInfo()) - } - if m.Deprecated != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("deprecated")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Deprecated)) - } - if len(m.Security) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Security { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("security")) - info.Content = append(info.Content, items) - } - if len(m.Servers) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Servers { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("servers")) - info.Content = append(info.Content, items) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Parameter suitable for JSON or YAML export. -func (m *Parameter) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("in")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Required != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required)) - } - if m.Deprecated != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("deprecated")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Deprecated)) - } - if m.AllowEmptyValue != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("allowEmptyValue")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowEmptyValue)) - } - if m.Style != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("style")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Style)) - } - if m.Explode != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("explode")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Explode)) - } - if m.AllowReserved != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("allowReserved")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowReserved)) - } - if m.Schema != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("schema")) - info.Content = append(info.Content, m.Schema.ToRawInfo()) - } - if m.Example != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("example")) - info.Content = append(info.Content, m.Example.ToRawInfo()) - } - if m.Examples != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("examples")) - info.Content = append(info.Content, m.Examples.ToRawInfo()) - } - if m.Content != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("content")) - info.Content = append(info.Content, m.Content.ToRawInfo()) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ParameterOrReference suitable for JSON or YAML export. -func (m *ParameterOrReference) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // ParameterOrReference - // {Name:parameter Type:Parameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetParameter() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetReference() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of ParametersOrReferences suitable for JSON or YAML export. -func (m *ParametersOrReferences) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of PathItem suitable for JSON or YAML export. -func (m *PathItem) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.XRef != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("$ref")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.XRef)) - } - if m.Summary != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("summary")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Summary)) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Get != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("get")) - info.Content = append(info.Content, m.Get.ToRawInfo()) - } - if m.Put != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("put")) - info.Content = append(info.Content, m.Put.ToRawInfo()) - } - if m.Post != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("post")) - info.Content = append(info.Content, m.Post.ToRawInfo()) - } - if m.Delete != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("delete")) - info.Content = append(info.Content, m.Delete.ToRawInfo()) - } - if m.Options != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("options")) - info.Content = append(info.Content, m.Options.ToRawInfo()) - } - if m.Head != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("head")) - info.Content = append(info.Content, m.Head.ToRawInfo()) - } - if m.Patch != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("patch")) - info.Content = append(info.Content, m.Patch.ToRawInfo()) - } - if m.Trace != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("trace")) - info.Content = append(info.Content, m.Trace.ToRawInfo()) - } - if len(m.Servers) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Servers { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("servers")) - info.Content = append(info.Content, items) - } - if len(m.Parameters) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Parameters { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters")) - info.Content = append(info.Content, items) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Paths suitable for JSON or YAML export. -func (m *Paths) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Path != nil { - for _, item := range m.Path { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Properties suitable for JSON or YAML export. -func (m *Properties) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Reference suitable for JSON or YAML export. -func (m *Reference) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("$ref")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.XRef)) - if m.Summary != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("summary")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Summary)) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - return info -} - -// ToRawInfo returns a description of RequestBodiesOrReferences suitable for JSON or YAML export. -func (m *RequestBodiesOrReferences) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of RequestBody suitable for JSON or YAML export. -func (m *RequestBody) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("content")) - info.Content = append(info.Content, m.Content.ToRawInfo()) - if m.Required != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required)) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of RequestBodyOrReference suitable for JSON or YAML export. -func (m *RequestBodyOrReference) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // RequestBodyOrReference - // {Name:requestBody Type:RequestBody StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetRequestBody() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetReference() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of Response suitable for JSON or YAML export. -func (m *Response) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - if m.Headers != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("headers")) - info.Content = append(info.Content, m.Headers.ToRawInfo()) - } - if m.Content != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("content")) - info.Content = append(info.Content, m.Content.ToRawInfo()) - } - if m.Links != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("links")) - info.Content = append(info.Content, m.Links.ToRawInfo()) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ResponseOrReference suitable for JSON or YAML export. -func (m *ResponseOrReference) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // ResponseOrReference - // {Name:response Type:Response StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetResponse() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetReference() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of Responses suitable for JSON or YAML export. -func (m *Responses) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Default != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) - info.Content = append(info.Content, m.Default.ToRawInfo()) - } - if m.ResponseOrReference != nil { - for _, item := range m.ResponseOrReference { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ResponsesOrReferences suitable for JSON or YAML export. -func (m *ResponsesOrReferences) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Schema suitable for JSON or YAML export. -func (m *Schema) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Nullable != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("nullable")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Nullable)) - } - if m.Discriminator != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("discriminator")) - info.Content = append(info.Content, m.Discriminator.ToRawInfo()) - } - if m.ReadOnly != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("readOnly")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ReadOnly)) - } - if m.WriteOnly != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("writeOnly")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.WriteOnly)) - } - if m.Xml != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("xml")) - info.Content = append(info.Content, m.Xml.ToRawInfo()) - } - if m.ExternalDocs != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs")) - info.Content = append(info.Content, m.ExternalDocs.ToRawInfo()) - } - if m.Example != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("example")) - info.Content = append(info.Content, m.Example.ToRawInfo()) - } - if m.Deprecated != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("deprecated")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Deprecated)) - } - if m.Title != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("title")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Title)) - } - if m.MultipleOf != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf)) - } - if m.Maximum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum)) - } - if m.ExclusiveMaximum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum)) - } - if m.Minimum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum)) - } - if m.ExclusiveMinimum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum)) - } - if m.MaxLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength)) - } - if m.MinLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength)) - } - if m.Pattern != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern)) - } - if m.MaxItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems)) - } - if m.MinItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems)) - } - if m.UniqueItems != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems)) - } - if m.MaxProperties != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxProperties")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxProperties)) - } - if m.MinProperties != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minProperties")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinProperties)) - } - if len(m.Required) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Required)) - } - if len(m.Enum) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Enum { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) - info.Content = append(info.Content, items) - } - if m.Type != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - } - if len(m.AllOf) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.AllOf { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("allOf")) - info.Content = append(info.Content, items) - } - if len(m.OneOf) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.OneOf { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("oneOf")) - info.Content = append(info.Content, items) - } - if len(m.AnyOf) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.AnyOf { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("anyOf")) - info.Content = append(info.Content, items) - } - if m.Not != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("not")) - info.Content = append(info.Content, m.Not.ToRawInfo()) - } - if m.Items != nil { - items := compiler.NewSequenceNode() - for _, item := range m.Items.SchemaOrReference { - items.Content = append(items.Content, item.ToRawInfo()) - } - if len(items.Content) == 1 { - items = items.Content[0] - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("items")) - info.Content = append(info.Content, items) - } - if m.Properties != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("properties")) - info.Content = append(info.Content, m.Properties.ToRawInfo()) - } - if m.AdditionalProperties != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("additionalProperties")) - info.Content = append(info.Content, m.AdditionalProperties.ToRawInfo()) - } - if m.Default != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) - info.Content = append(info.Content, m.Default.ToRawInfo()) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Format != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of SchemaOrReference suitable for JSON or YAML export. -func (m *SchemaOrReference) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // SchemaOrReference - // {Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetSchema() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetReference() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of SchemasOrReferences suitable for JSON or YAML export. -func (m *SchemasOrReferences) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of SecurityRequirement suitable for JSON or YAML export. -func (m *SecurityRequirement) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of SecurityScheme suitable for JSON or YAML export. -func (m *SecurityScheme) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.In != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("in")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In)) - } - if m.Scheme != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("scheme")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Scheme)) - } - if m.BearerFormat != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("bearerFormat")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.BearerFormat)) - } - if m.Flows != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("flows")) - info.Content = append(info.Content, m.Flows.ToRawInfo()) - } - if m.OpenIdConnectUrl != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("openIdConnectUrl")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.OpenIdConnectUrl)) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of SecuritySchemeOrReference suitable for JSON or YAML export. -func (m *SecuritySchemeOrReference) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // SecuritySchemeOrReference - // {Name:securityScheme Type:SecurityScheme StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetSecurityScheme() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetReference() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of SecuritySchemesOrReferences suitable for JSON or YAML export. -func (m *SecuritySchemesOrReferences) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Server suitable for JSON or YAML export. -func (m *Server) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("url")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Variables != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("variables")) - info.Content = append(info.Content, m.Variables.ToRawInfo()) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ServerVariable suitable for JSON or YAML export. -func (m *ServerVariable) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if len(m.Enum) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Enum)) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Default)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ServerVariables suitable for JSON or YAML export. -func (m *ServerVariables) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of SpecificationExtension suitable for JSON or YAML export. -func (m *SpecificationExtension) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // SpecificationExtension - // {Name:number Type:float StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - if v0, ok := m.GetOneof().(*SpecificationExtension_Number); ok { - return compiler.NewScalarNodeForFloat(v0.Number) - } - // {Name:boolean Type:bool StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - if v1, ok := m.GetOneof().(*SpecificationExtension_Boolean); ok { - return compiler.NewScalarNodeForBool(v1.Boolean) - } - // {Name:string Type:string StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - if v2, ok := m.GetOneof().(*SpecificationExtension_String_); ok { - return compiler.NewScalarNodeForString(v2.String_) - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of StringArray suitable for JSON or YAML export. -func (m *StringArray) ToRawInfo() *yaml.Node { - return compiler.NewSequenceNodeForStringArray(m.Value) -} - -// ToRawInfo returns a description of Strings suitable for JSON or YAML export. -func (m *Strings) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // &{Name:additionalProperties Type:NamedString StringEnumValues:[] MapType:string Repeated:true Pattern: Implicit:true Description:} - return info -} - -// ToRawInfo returns a description of Tag suitable for JSON or YAML export. -func (m *Tag) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.ExternalDocs != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs")) - info.Content = append(info.Content, m.ExternalDocs.ToRawInfo()) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Xml suitable for JSON or YAML export. -func (m *Xml) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.Namespace != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("namespace")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Namespace)) - } - if m.Prefix != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("prefix")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Prefix)) - } - if m.Attribute != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("attribute")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Attribute)) - } - if m.Wrapped != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("wrapped")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Wrapped)) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -var ( - pattern0 = regexp.MustCompile("^") - pattern1 = regexp.MustCompile("^x-") - pattern2 = regexp.MustCompile("^/") - pattern3 = regexp.MustCompile("^([0-9X]{3})$") -) diff --git a/vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.pb.go b/vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.pb.go deleted file mode 100644 index 945b8d11f..000000000 --- a/vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.pb.go +++ /dev/null @@ -1,8053 +0,0 @@ -// Copyright 2020 Google LLC. All Rights Reserved. -// -// 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. - -// THIS FILE IS AUTOMATICALLY GENERATED. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.3 -// source: openapiv3/OpenAPIv3.proto - -package openapi_v3 - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type AdditionalPropertiesItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *AdditionalPropertiesItem_SchemaOrReference - // *AdditionalPropertiesItem_Boolean - Oneof isAdditionalPropertiesItem_Oneof `protobuf_oneof:"oneof"` -} - -func (x *AdditionalPropertiesItem) Reset() { - *x = AdditionalPropertiesItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdditionalPropertiesItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdditionalPropertiesItem) ProtoMessage() {} - -func (x *AdditionalPropertiesItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdditionalPropertiesItem.ProtoReflect.Descriptor instead. -func (*AdditionalPropertiesItem) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{0} -} - -func (m *AdditionalPropertiesItem) GetOneof() isAdditionalPropertiesItem_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *AdditionalPropertiesItem) GetSchemaOrReference() *SchemaOrReference { - if x, ok := x.GetOneof().(*AdditionalPropertiesItem_SchemaOrReference); ok { - return x.SchemaOrReference - } - return nil -} - -func (x *AdditionalPropertiesItem) GetBoolean() bool { - if x, ok := x.GetOneof().(*AdditionalPropertiesItem_Boolean); ok { - return x.Boolean - } - return false -} - -type isAdditionalPropertiesItem_Oneof interface { - isAdditionalPropertiesItem_Oneof() -} - -type AdditionalPropertiesItem_SchemaOrReference struct { - SchemaOrReference *SchemaOrReference `protobuf:"bytes,1,opt,name=schema_or_reference,json=schemaOrReference,proto3,oneof"` -} - -type AdditionalPropertiesItem_Boolean struct { - Boolean bool `protobuf:"varint,2,opt,name=boolean,proto3,oneof"` -} - -func (*AdditionalPropertiesItem_SchemaOrReference) isAdditionalPropertiesItem_Oneof() {} - -func (*AdditionalPropertiesItem_Boolean) isAdditionalPropertiesItem_Oneof() {} - -type Any struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Value *anypb.Any `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` - Yaml string `protobuf:"bytes,2,opt,name=yaml,proto3" json:"yaml,omitempty"` -} - -func (x *Any) Reset() { - *x = Any{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Any) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Any) ProtoMessage() {} - -func (x *Any) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Any.ProtoReflect.Descriptor instead. -func (*Any) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{1} -} - -func (x *Any) GetValue() *anypb.Any { - if x != nil { - return x.Value - } - return nil -} - -func (x *Any) GetYaml() string { - if x != nil { - return x.Yaml - } - return "" -} - -type AnyOrExpression struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *AnyOrExpression_Any - // *AnyOrExpression_Expression - Oneof isAnyOrExpression_Oneof `protobuf_oneof:"oneof"` -} - -func (x *AnyOrExpression) Reset() { - *x = AnyOrExpression{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AnyOrExpression) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AnyOrExpression) ProtoMessage() {} - -func (x *AnyOrExpression) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AnyOrExpression.ProtoReflect.Descriptor instead. -func (*AnyOrExpression) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{2} -} - -func (m *AnyOrExpression) GetOneof() isAnyOrExpression_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *AnyOrExpression) GetAny() *Any { - if x, ok := x.GetOneof().(*AnyOrExpression_Any); ok { - return x.Any - } - return nil -} - -func (x *AnyOrExpression) GetExpression() *Expression { - if x, ok := x.GetOneof().(*AnyOrExpression_Expression); ok { - return x.Expression - } - return nil -} - -type isAnyOrExpression_Oneof interface { - isAnyOrExpression_Oneof() -} - -type AnyOrExpression_Any struct { - Any *Any `protobuf:"bytes,1,opt,name=any,proto3,oneof"` -} - -type AnyOrExpression_Expression struct { - Expression *Expression `protobuf:"bytes,2,opt,name=expression,proto3,oneof"` -} - -func (*AnyOrExpression_Any) isAnyOrExpression_Oneof() {} - -func (*AnyOrExpression_Expression) isAnyOrExpression_Oneof() {} - -// A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. -type Callback struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Path []*NamedPathItem `protobuf:"bytes,1,rep,name=path,proto3" json:"path,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,2,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Callback) Reset() { - *x = Callback{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Callback) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Callback) ProtoMessage() {} - -func (x *Callback) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Callback.ProtoReflect.Descriptor instead. -func (*Callback) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{3} -} - -func (x *Callback) GetPath() []*NamedPathItem { - if x != nil { - return x.Path - } - return nil -} - -func (x *Callback) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type CallbackOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *CallbackOrReference_Callback - // *CallbackOrReference_Reference - Oneof isCallbackOrReference_Oneof `protobuf_oneof:"oneof"` -} - -func (x *CallbackOrReference) Reset() { - *x = CallbackOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallbackOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallbackOrReference) ProtoMessage() {} - -func (x *CallbackOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallbackOrReference.ProtoReflect.Descriptor instead. -func (*CallbackOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{4} -} - -func (m *CallbackOrReference) GetOneof() isCallbackOrReference_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *CallbackOrReference) GetCallback() *Callback { - if x, ok := x.GetOneof().(*CallbackOrReference_Callback); ok { - return x.Callback - } - return nil -} - -func (x *CallbackOrReference) GetReference() *Reference { - if x, ok := x.GetOneof().(*CallbackOrReference_Reference); ok { - return x.Reference - } - return nil -} - -type isCallbackOrReference_Oneof interface { - isCallbackOrReference_Oneof() -} - -type CallbackOrReference_Callback struct { - Callback *Callback `protobuf:"bytes,1,opt,name=callback,proto3,oneof"` -} - -type CallbackOrReference_Reference struct { - Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"` -} - -func (*CallbackOrReference_Callback) isCallbackOrReference_Oneof() {} - -func (*CallbackOrReference_Reference) isCallbackOrReference_Oneof() {} - -type CallbacksOrReferences struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedCallbackOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *CallbacksOrReferences) Reset() { - *x = CallbacksOrReferences{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallbacksOrReferences) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallbacksOrReferences) ProtoMessage() {} - -func (x *CallbacksOrReferences) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallbacksOrReferences.ProtoReflect.Descriptor instead. -func (*CallbacksOrReferences) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{5} -} - -func (x *CallbacksOrReferences) GetAdditionalProperties() []*NamedCallbackOrReference { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object. -type Components struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Schemas *SchemasOrReferences `protobuf:"bytes,1,opt,name=schemas,proto3" json:"schemas,omitempty"` - Responses *ResponsesOrReferences `protobuf:"bytes,2,opt,name=responses,proto3" json:"responses,omitempty"` - Parameters *ParametersOrReferences `protobuf:"bytes,3,opt,name=parameters,proto3" json:"parameters,omitempty"` - Examples *ExamplesOrReferences `protobuf:"bytes,4,opt,name=examples,proto3" json:"examples,omitempty"` - RequestBodies *RequestBodiesOrReferences `protobuf:"bytes,5,opt,name=request_bodies,json=requestBodies,proto3" json:"request_bodies,omitempty"` - Headers *HeadersOrReferences `protobuf:"bytes,6,opt,name=headers,proto3" json:"headers,omitempty"` - SecuritySchemes *SecuritySchemesOrReferences `protobuf:"bytes,7,opt,name=security_schemes,json=securitySchemes,proto3" json:"security_schemes,omitempty"` - Links *LinksOrReferences `protobuf:"bytes,8,opt,name=links,proto3" json:"links,omitempty"` - Callbacks *CallbacksOrReferences `protobuf:"bytes,9,opt,name=callbacks,proto3" json:"callbacks,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,10,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Components) Reset() { - *x = Components{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Components) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Components) ProtoMessage() {} - -func (x *Components) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Components.ProtoReflect.Descriptor instead. -func (*Components) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{6} -} - -func (x *Components) GetSchemas() *SchemasOrReferences { - if x != nil { - return x.Schemas - } - return nil -} - -func (x *Components) GetResponses() *ResponsesOrReferences { - if x != nil { - return x.Responses - } - return nil -} - -func (x *Components) GetParameters() *ParametersOrReferences { - if x != nil { - return x.Parameters - } - return nil -} - -func (x *Components) GetExamples() *ExamplesOrReferences { - if x != nil { - return x.Examples - } - return nil -} - -func (x *Components) GetRequestBodies() *RequestBodiesOrReferences { - if x != nil { - return x.RequestBodies - } - return nil -} - -func (x *Components) GetHeaders() *HeadersOrReferences { - if x != nil { - return x.Headers - } - return nil -} - -func (x *Components) GetSecuritySchemes() *SecuritySchemesOrReferences { - if x != nil { - return x.SecuritySchemes - } - return nil -} - -func (x *Components) GetLinks() *LinksOrReferences { - if x != nil { - return x.Links - } - return nil -} - -func (x *Components) GetCallbacks() *CallbacksOrReferences { - if x != nil { - return x.Callbacks - } - return nil -} - -func (x *Components) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -// Contact information for the exposed API. -type Contact struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` - Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,4,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Contact) Reset() { - *x = Contact{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Contact) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Contact) ProtoMessage() {} - -func (x *Contact) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Contact.ProtoReflect.Descriptor instead. -func (*Contact) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{7} -} - -func (x *Contact) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Contact) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *Contact) GetEmail() string { - if x != nil { - return x.Email - } - return "" -} - -func (x *Contact) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type DefaultType struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *DefaultType_Number - // *DefaultType_Boolean - // *DefaultType_String_ - Oneof isDefaultType_Oneof `protobuf_oneof:"oneof"` -} - -func (x *DefaultType) Reset() { - *x = DefaultType{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DefaultType) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DefaultType) ProtoMessage() {} - -func (x *DefaultType) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DefaultType.ProtoReflect.Descriptor instead. -func (*DefaultType) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{8} -} - -func (m *DefaultType) GetOneof() isDefaultType_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *DefaultType) GetNumber() float64 { - if x, ok := x.GetOneof().(*DefaultType_Number); ok { - return x.Number - } - return 0 -} - -func (x *DefaultType) GetBoolean() bool { - if x, ok := x.GetOneof().(*DefaultType_Boolean); ok { - return x.Boolean - } - return false -} - -func (x *DefaultType) GetString_() string { - if x, ok := x.GetOneof().(*DefaultType_String_); ok { - return x.String_ - } - return "" -} - -type isDefaultType_Oneof interface { - isDefaultType_Oneof() -} - -type DefaultType_Number struct { - Number float64 `protobuf:"fixed64,1,opt,name=number,proto3,oneof"` -} - -type DefaultType_Boolean struct { - Boolean bool `protobuf:"varint,2,opt,name=boolean,proto3,oneof"` -} - -type DefaultType_String_ struct { - String_ string `protobuf:"bytes,3,opt,name=string,proto3,oneof"` -} - -func (*DefaultType_Number) isDefaultType_Oneof() {} - -func (*DefaultType_Boolean) isDefaultType_Oneof() {} - -func (*DefaultType_String_) isDefaultType_Oneof() {} - -// When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it. When using the discriminator, _inline_ schemas will not be considered. -type Discriminator struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - PropertyName string `protobuf:"bytes,1,opt,name=property_name,json=propertyName,proto3" json:"property_name,omitempty"` - Mapping *Strings `protobuf:"bytes,2,opt,name=mapping,proto3" json:"mapping,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,3,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Discriminator) Reset() { - *x = Discriminator{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Discriminator) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Discriminator) ProtoMessage() {} - -func (x *Discriminator) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Discriminator.ProtoReflect.Descriptor instead. -func (*Discriminator) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{9} -} - -func (x *Discriminator) GetPropertyName() string { - if x != nil { - return x.PropertyName - } - return "" -} - -func (x *Discriminator) GetMapping() *Strings { - if x != nil { - return x.Mapping - } - return nil -} - -func (x *Discriminator) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type Document struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Openapi string `protobuf:"bytes,1,opt,name=openapi,proto3" json:"openapi,omitempty"` - Info *Info `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` - Servers []*Server `protobuf:"bytes,3,rep,name=servers,proto3" json:"servers,omitempty"` - Paths *Paths `protobuf:"bytes,4,opt,name=paths,proto3" json:"paths,omitempty"` - Components *Components `protobuf:"bytes,5,opt,name=components,proto3" json:"components,omitempty"` - Security []*SecurityRequirement `protobuf:"bytes,6,rep,name=security,proto3" json:"security,omitempty"` - Tags []*Tag `protobuf:"bytes,7,rep,name=tags,proto3" json:"tags,omitempty"` - ExternalDocs *ExternalDocs `protobuf:"bytes,8,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,9,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Document) Reset() { - *x = Document{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Document) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Document) ProtoMessage() {} - -func (x *Document) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Document.ProtoReflect.Descriptor instead. -func (*Document) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{10} -} - -func (x *Document) GetOpenapi() string { - if x != nil { - return x.Openapi - } - return "" -} - -func (x *Document) GetInfo() *Info { - if x != nil { - return x.Info - } - return nil -} - -func (x *Document) GetServers() []*Server { - if x != nil { - return x.Servers - } - return nil -} - -func (x *Document) GetPaths() *Paths { - if x != nil { - return x.Paths - } - return nil -} - -func (x *Document) GetComponents() *Components { - if x != nil { - return x.Components - } - return nil -} - -func (x *Document) GetSecurity() []*SecurityRequirement { - if x != nil { - return x.Security - } - return nil -} - -func (x *Document) GetTags() []*Tag { - if x != nil { - return x.Tags - } - return nil -} - -func (x *Document) GetExternalDocs() *ExternalDocs { - if x != nil { - return x.ExternalDocs - } - return nil -} - -func (x *Document) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -// A single encoding definition applied to a single schema property. -type Encoding struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ContentType string `protobuf:"bytes,1,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` - Headers *HeadersOrReferences `protobuf:"bytes,2,opt,name=headers,proto3" json:"headers,omitempty"` - Style string `protobuf:"bytes,3,opt,name=style,proto3" json:"style,omitempty"` - Explode bool `protobuf:"varint,4,opt,name=explode,proto3" json:"explode,omitempty"` - AllowReserved bool `protobuf:"varint,5,opt,name=allow_reserved,json=allowReserved,proto3" json:"allow_reserved,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,6,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Encoding) Reset() { - *x = Encoding{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Encoding) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Encoding) ProtoMessage() {} - -func (x *Encoding) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Encoding.ProtoReflect.Descriptor instead. -func (*Encoding) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{11} -} - -func (x *Encoding) GetContentType() string { - if x != nil { - return x.ContentType - } - return "" -} - -func (x *Encoding) GetHeaders() *HeadersOrReferences { - if x != nil { - return x.Headers - } - return nil -} - -func (x *Encoding) GetStyle() string { - if x != nil { - return x.Style - } - return "" -} - -func (x *Encoding) GetExplode() bool { - if x != nil { - return x.Explode - } - return false -} - -func (x *Encoding) GetAllowReserved() bool { - if x != nil { - return x.AllowReserved - } - return false -} - -func (x *Encoding) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type Encodings struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedEncoding `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *Encodings) Reset() { - *x = Encodings{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Encodings) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Encodings) ProtoMessage() {} - -func (x *Encodings) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Encodings.ProtoReflect.Descriptor instead. -func (*Encodings) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{12} -} - -func (x *Encodings) GetAdditionalProperties() []*NamedEncoding { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -type Example struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Summary string `protobuf:"bytes,1,opt,name=summary,proto3" json:"summary,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Value *Any `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` - ExternalValue string `protobuf:"bytes,4,opt,name=external_value,json=externalValue,proto3" json:"external_value,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,5,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Example) Reset() { - *x = Example{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Example) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Example) ProtoMessage() {} - -func (x *Example) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Example.ProtoReflect.Descriptor instead. -func (*Example) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{13} -} - -func (x *Example) GetSummary() string { - if x != nil { - return x.Summary - } - return "" -} - -func (x *Example) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Example) GetValue() *Any { - if x != nil { - return x.Value - } - return nil -} - -func (x *Example) GetExternalValue() string { - if x != nil { - return x.ExternalValue - } - return "" -} - -func (x *Example) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type ExampleOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *ExampleOrReference_Example - // *ExampleOrReference_Reference - Oneof isExampleOrReference_Oneof `protobuf_oneof:"oneof"` -} - -func (x *ExampleOrReference) Reset() { - *x = ExampleOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ExampleOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExampleOrReference) ProtoMessage() {} - -func (x *ExampleOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExampleOrReference.ProtoReflect.Descriptor instead. -func (*ExampleOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{14} -} - -func (m *ExampleOrReference) GetOneof() isExampleOrReference_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *ExampleOrReference) GetExample() *Example { - if x, ok := x.GetOneof().(*ExampleOrReference_Example); ok { - return x.Example - } - return nil -} - -func (x *ExampleOrReference) GetReference() *Reference { - if x, ok := x.GetOneof().(*ExampleOrReference_Reference); ok { - return x.Reference - } - return nil -} - -type isExampleOrReference_Oneof interface { - isExampleOrReference_Oneof() -} - -type ExampleOrReference_Example struct { - Example *Example `protobuf:"bytes,1,opt,name=example,proto3,oneof"` -} - -type ExampleOrReference_Reference struct { - Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"` -} - -func (*ExampleOrReference_Example) isExampleOrReference_Oneof() {} - -func (*ExampleOrReference_Reference) isExampleOrReference_Oneof() {} - -type ExamplesOrReferences struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedExampleOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *ExamplesOrReferences) Reset() { - *x = ExamplesOrReferences{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ExamplesOrReferences) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExamplesOrReferences) ProtoMessage() {} - -func (x *ExamplesOrReferences) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExamplesOrReferences.ProtoReflect.Descriptor instead. -func (*ExamplesOrReferences) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{15} -} - -func (x *ExamplesOrReferences) GetAdditionalProperties() []*NamedExampleOrReference { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -type Expression struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedAny `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *Expression) Reset() { - *x = Expression{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Expression) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Expression) ProtoMessage() {} - -func (x *Expression) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Expression.ProtoReflect.Descriptor instead. -func (*Expression) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{16} -} - -func (x *Expression) GetAdditionalProperties() []*NamedAny { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// Allows referencing an external resource for extended documentation. -type ExternalDocs struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` - Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,3,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *ExternalDocs) Reset() { - *x = ExternalDocs{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ExternalDocs) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExternalDocs) ProtoMessage() {} - -func (x *ExternalDocs) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExternalDocs.ProtoReflect.Descriptor instead. -func (*ExternalDocs) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{17} -} - -func (x *ExternalDocs) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *ExternalDocs) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *ExternalDocs) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -// The Header Object follows the structure of the Parameter Object with the following changes: 1. `name` MUST NOT be specified, it is given in the corresponding `headers` map. 1. `in` MUST NOT be specified, it is implicitly in `header`. 1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, `style`). -type Header struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` - Required bool `protobuf:"varint,2,opt,name=required,proto3" json:"required,omitempty"` - Deprecated bool `protobuf:"varint,3,opt,name=deprecated,proto3" json:"deprecated,omitempty"` - AllowEmptyValue bool `protobuf:"varint,4,opt,name=allow_empty_value,json=allowEmptyValue,proto3" json:"allow_empty_value,omitempty"` - Style string `protobuf:"bytes,5,opt,name=style,proto3" json:"style,omitempty"` - Explode bool `protobuf:"varint,6,opt,name=explode,proto3" json:"explode,omitempty"` - AllowReserved bool `protobuf:"varint,7,opt,name=allow_reserved,json=allowReserved,proto3" json:"allow_reserved,omitempty"` - Schema *SchemaOrReference `protobuf:"bytes,8,opt,name=schema,proto3" json:"schema,omitempty"` - Example *Any `protobuf:"bytes,9,opt,name=example,proto3" json:"example,omitempty"` - Examples *ExamplesOrReferences `protobuf:"bytes,10,opt,name=examples,proto3" json:"examples,omitempty"` - Content *MediaTypes `protobuf:"bytes,11,opt,name=content,proto3" json:"content,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,12,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Header) Reset() { - *x = Header{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Header) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Header) ProtoMessage() {} - -func (x *Header) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Header.ProtoReflect.Descriptor instead. -func (*Header) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{18} -} - -func (x *Header) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Header) GetRequired() bool { - if x != nil { - return x.Required - } - return false -} - -func (x *Header) GetDeprecated() bool { - if x != nil { - return x.Deprecated - } - return false -} - -func (x *Header) GetAllowEmptyValue() bool { - if x != nil { - return x.AllowEmptyValue - } - return false -} - -func (x *Header) GetStyle() string { - if x != nil { - return x.Style - } - return "" -} - -func (x *Header) GetExplode() bool { - if x != nil { - return x.Explode - } - return false -} - -func (x *Header) GetAllowReserved() bool { - if x != nil { - return x.AllowReserved - } - return false -} - -func (x *Header) GetSchema() *SchemaOrReference { - if x != nil { - return x.Schema - } - return nil -} - -func (x *Header) GetExample() *Any { - if x != nil { - return x.Example - } - return nil -} - -func (x *Header) GetExamples() *ExamplesOrReferences { - if x != nil { - return x.Examples - } - return nil -} - -func (x *Header) GetContent() *MediaTypes { - if x != nil { - return x.Content - } - return nil -} - -func (x *Header) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type HeaderOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *HeaderOrReference_Header - // *HeaderOrReference_Reference - Oneof isHeaderOrReference_Oneof `protobuf_oneof:"oneof"` -} - -func (x *HeaderOrReference) Reset() { - *x = HeaderOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HeaderOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HeaderOrReference) ProtoMessage() {} - -func (x *HeaderOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HeaderOrReference.ProtoReflect.Descriptor instead. -func (*HeaderOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{19} -} - -func (m *HeaderOrReference) GetOneof() isHeaderOrReference_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *HeaderOrReference) GetHeader() *Header { - if x, ok := x.GetOneof().(*HeaderOrReference_Header); ok { - return x.Header - } - return nil -} - -func (x *HeaderOrReference) GetReference() *Reference { - if x, ok := x.GetOneof().(*HeaderOrReference_Reference); ok { - return x.Reference - } - return nil -} - -type isHeaderOrReference_Oneof interface { - isHeaderOrReference_Oneof() -} - -type HeaderOrReference_Header struct { - Header *Header `protobuf:"bytes,1,opt,name=header,proto3,oneof"` -} - -type HeaderOrReference_Reference struct { - Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"` -} - -func (*HeaderOrReference_Header) isHeaderOrReference_Oneof() {} - -func (*HeaderOrReference_Reference) isHeaderOrReference_Oneof() {} - -type HeadersOrReferences struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedHeaderOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *HeadersOrReferences) Reset() { - *x = HeadersOrReferences{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HeadersOrReferences) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HeadersOrReferences) ProtoMessage() {} - -func (x *HeadersOrReferences) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HeadersOrReferences.ProtoReflect.Descriptor instead. -func (*HeadersOrReferences) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{20} -} - -func (x *HeadersOrReferences) GetAdditionalProperties() []*NamedHeaderOrReference { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience. -type Info struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - TermsOfService string `protobuf:"bytes,3,opt,name=terms_of_service,json=termsOfService,proto3" json:"terms_of_service,omitempty"` - Contact *Contact `protobuf:"bytes,4,opt,name=contact,proto3" json:"contact,omitempty"` - License *License `protobuf:"bytes,5,opt,name=license,proto3" json:"license,omitempty"` - Version string `protobuf:"bytes,6,opt,name=version,proto3" json:"version,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,7,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` - Summary string `protobuf:"bytes,8,opt,name=summary,proto3" json:"summary,omitempty"` -} - -func (x *Info) Reset() { - *x = Info{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Info) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Info) ProtoMessage() {} - -func (x *Info) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Info.ProtoReflect.Descriptor instead. -func (*Info) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{21} -} - -func (x *Info) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *Info) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Info) GetTermsOfService() string { - if x != nil { - return x.TermsOfService - } - return "" -} - -func (x *Info) GetContact() *Contact { - if x != nil { - return x.Contact - } - return nil -} - -func (x *Info) GetLicense() *License { - if x != nil { - return x.License - } - return nil -} - -func (x *Info) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *Info) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -func (x *Info) GetSummary() string { - if x != nil { - return x.Summary - } - return "" -} - -type ItemsItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SchemaOrReference []*SchemaOrReference `protobuf:"bytes,1,rep,name=schema_or_reference,json=schemaOrReference,proto3" json:"schema_or_reference,omitempty"` -} - -func (x *ItemsItem) Reset() { - *x = ItemsItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ItemsItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ItemsItem) ProtoMessage() {} - -func (x *ItemsItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ItemsItem.ProtoReflect.Descriptor instead. -func (*ItemsItem) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{22} -} - -func (x *ItemsItem) GetSchemaOrReference() []*SchemaOrReference { - if x != nil { - return x.SchemaOrReference - } - return nil -} - -// License information for the exposed API. -type License struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,3,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *License) Reset() { - *x = License{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *License) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*License) ProtoMessage() {} - -func (x *License) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use License.ProtoReflect.Descriptor instead. -func (*License) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{23} -} - -func (x *License) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *License) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *License) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -// The `Link object` represents a possible design-time link for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. Unlike _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require link information in the runtime response. For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation. -type Link struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - OperationRef string `protobuf:"bytes,1,opt,name=operation_ref,json=operationRef,proto3" json:"operation_ref,omitempty"` - OperationId string `protobuf:"bytes,2,opt,name=operation_id,json=operationId,proto3" json:"operation_id,omitempty"` - Parameters *AnyOrExpression `protobuf:"bytes,3,opt,name=parameters,proto3" json:"parameters,omitempty"` - RequestBody *AnyOrExpression `protobuf:"bytes,4,opt,name=request_body,json=requestBody,proto3" json:"request_body,omitempty"` - Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` - Server *Server `protobuf:"bytes,6,opt,name=server,proto3" json:"server,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,7,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Link) Reset() { - *x = Link{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Link) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Link) ProtoMessage() {} - -func (x *Link) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Link.ProtoReflect.Descriptor instead. -func (*Link) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{24} -} - -func (x *Link) GetOperationRef() string { - if x != nil { - return x.OperationRef - } - return "" -} - -func (x *Link) GetOperationId() string { - if x != nil { - return x.OperationId - } - return "" -} - -func (x *Link) GetParameters() *AnyOrExpression { - if x != nil { - return x.Parameters - } - return nil -} - -func (x *Link) GetRequestBody() *AnyOrExpression { - if x != nil { - return x.RequestBody - } - return nil -} - -func (x *Link) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Link) GetServer() *Server { - if x != nil { - return x.Server - } - return nil -} - -func (x *Link) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type LinkOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *LinkOrReference_Link - // *LinkOrReference_Reference - Oneof isLinkOrReference_Oneof `protobuf_oneof:"oneof"` -} - -func (x *LinkOrReference) Reset() { - *x = LinkOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LinkOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LinkOrReference) ProtoMessage() {} - -func (x *LinkOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[25] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LinkOrReference.ProtoReflect.Descriptor instead. -func (*LinkOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{25} -} - -func (m *LinkOrReference) GetOneof() isLinkOrReference_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *LinkOrReference) GetLink() *Link { - if x, ok := x.GetOneof().(*LinkOrReference_Link); ok { - return x.Link - } - return nil -} - -func (x *LinkOrReference) GetReference() *Reference { - if x, ok := x.GetOneof().(*LinkOrReference_Reference); ok { - return x.Reference - } - return nil -} - -type isLinkOrReference_Oneof interface { - isLinkOrReference_Oneof() -} - -type LinkOrReference_Link struct { - Link *Link `protobuf:"bytes,1,opt,name=link,proto3,oneof"` -} - -type LinkOrReference_Reference struct { - Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"` -} - -func (*LinkOrReference_Link) isLinkOrReference_Oneof() {} - -func (*LinkOrReference_Reference) isLinkOrReference_Oneof() {} - -type LinksOrReferences struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedLinkOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *LinksOrReferences) Reset() { - *x = LinksOrReferences{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LinksOrReferences) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LinksOrReferences) ProtoMessage() {} - -func (x *LinksOrReferences) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[26] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LinksOrReferences.ProtoReflect.Descriptor instead. -func (*LinksOrReferences) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{26} -} - -func (x *LinksOrReferences) GetAdditionalProperties() []*NamedLinkOrReference { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// Each Media Type Object provides schema and examples for the media type identified by its key. -type MediaType struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Schema *SchemaOrReference `protobuf:"bytes,1,opt,name=schema,proto3" json:"schema,omitempty"` - Example *Any `protobuf:"bytes,2,opt,name=example,proto3" json:"example,omitempty"` - Examples *ExamplesOrReferences `protobuf:"bytes,3,opt,name=examples,proto3" json:"examples,omitempty"` - Encoding *Encodings `protobuf:"bytes,4,opt,name=encoding,proto3" json:"encoding,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,5,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *MediaType) Reset() { - *x = MediaType{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MediaType) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MediaType) ProtoMessage() {} - -func (x *MediaType) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[27] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MediaType.ProtoReflect.Descriptor instead. -func (*MediaType) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{27} -} - -func (x *MediaType) GetSchema() *SchemaOrReference { - if x != nil { - return x.Schema - } - return nil -} - -func (x *MediaType) GetExample() *Any { - if x != nil { - return x.Example - } - return nil -} - -func (x *MediaType) GetExamples() *ExamplesOrReferences { - if x != nil { - return x.Examples - } - return nil -} - -func (x *MediaType) GetEncoding() *Encodings { - if x != nil { - return x.Encoding - } - return nil -} - -func (x *MediaType) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type MediaTypes struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedMediaType `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *MediaTypes) Reset() { - *x = MediaTypes{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MediaTypes) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MediaTypes) ProtoMessage() {} - -func (x *MediaTypes) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MediaTypes.ProtoReflect.Descriptor instead. -func (*MediaTypes) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{28} -} - -func (x *MediaTypes) GetAdditionalProperties() []*NamedMediaType { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// Automatically-generated message used to represent maps of Any as ordered (name,value) pairs. -type NamedAny struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *Any `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedAny) Reset() { - *x = NamedAny{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedAny) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedAny) ProtoMessage() {} - -func (x *NamedAny) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[29] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedAny.ProtoReflect.Descriptor instead. -func (*NamedAny) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{29} -} - -func (x *NamedAny) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedAny) GetValue() *Any { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of CallbackOrReference as ordered (name,value) pairs. -type NamedCallbackOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *CallbackOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedCallbackOrReference) Reset() { - *x = NamedCallbackOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedCallbackOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedCallbackOrReference) ProtoMessage() {} - -func (x *NamedCallbackOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[30] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedCallbackOrReference.ProtoReflect.Descriptor instead. -func (*NamedCallbackOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{30} -} - -func (x *NamedCallbackOrReference) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedCallbackOrReference) GetValue() *CallbackOrReference { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of Encoding as ordered (name,value) pairs. -type NamedEncoding struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *Encoding `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedEncoding) Reset() { - *x = NamedEncoding{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[31] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedEncoding) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedEncoding) ProtoMessage() {} - -func (x *NamedEncoding) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[31] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedEncoding.ProtoReflect.Descriptor instead. -func (*NamedEncoding) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{31} -} - -func (x *NamedEncoding) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedEncoding) GetValue() *Encoding { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of ExampleOrReference as ordered (name,value) pairs. -type NamedExampleOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *ExampleOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedExampleOrReference) Reset() { - *x = NamedExampleOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[32] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedExampleOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedExampleOrReference) ProtoMessage() {} - -func (x *NamedExampleOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[32] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedExampleOrReference.ProtoReflect.Descriptor instead. -func (*NamedExampleOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{32} -} - -func (x *NamedExampleOrReference) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedExampleOrReference) GetValue() *ExampleOrReference { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of HeaderOrReference as ordered (name,value) pairs. -type NamedHeaderOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *HeaderOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedHeaderOrReference) Reset() { - *x = NamedHeaderOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[33] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedHeaderOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedHeaderOrReference) ProtoMessage() {} - -func (x *NamedHeaderOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[33] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedHeaderOrReference.ProtoReflect.Descriptor instead. -func (*NamedHeaderOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{33} -} - -func (x *NamedHeaderOrReference) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedHeaderOrReference) GetValue() *HeaderOrReference { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of LinkOrReference as ordered (name,value) pairs. -type NamedLinkOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *LinkOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedLinkOrReference) Reset() { - *x = NamedLinkOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[34] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedLinkOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedLinkOrReference) ProtoMessage() {} - -func (x *NamedLinkOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[34] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedLinkOrReference.ProtoReflect.Descriptor instead. -func (*NamedLinkOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{34} -} - -func (x *NamedLinkOrReference) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedLinkOrReference) GetValue() *LinkOrReference { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of MediaType as ordered (name,value) pairs. -type NamedMediaType struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *MediaType `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedMediaType) Reset() { - *x = NamedMediaType{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[35] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedMediaType) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedMediaType) ProtoMessage() {} - -func (x *NamedMediaType) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[35] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedMediaType.ProtoReflect.Descriptor instead. -func (*NamedMediaType) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{35} -} - -func (x *NamedMediaType) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedMediaType) GetValue() *MediaType { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of ParameterOrReference as ordered (name,value) pairs. -type NamedParameterOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *ParameterOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedParameterOrReference) Reset() { - *x = NamedParameterOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[36] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedParameterOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedParameterOrReference) ProtoMessage() {} - -func (x *NamedParameterOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[36] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedParameterOrReference.ProtoReflect.Descriptor instead. -func (*NamedParameterOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{36} -} - -func (x *NamedParameterOrReference) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedParameterOrReference) GetValue() *ParameterOrReference { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of PathItem as ordered (name,value) pairs. -type NamedPathItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *PathItem `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedPathItem) Reset() { - *x = NamedPathItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[37] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedPathItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedPathItem) ProtoMessage() {} - -func (x *NamedPathItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[37] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedPathItem.ProtoReflect.Descriptor instead. -func (*NamedPathItem) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{37} -} - -func (x *NamedPathItem) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedPathItem) GetValue() *PathItem { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of RequestBodyOrReference as ordered (name,value) pairs. -type NamedRequestBodyOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *RequestBodyOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedRequestBodyOrReference) Reset() { - *x = NamedRequestBodyOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[38] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedRequestBodyOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedRequestBodyOrReference) ProtoMessage() {} - -func (x *NamedRequestBodyOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[38] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedRequestBodyOrReference.ProtoReflect.Descriptor instead. -func (*NamedRequestBodyOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{38} -} - -func (x *NamedRequestBodyOrReference) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedRequestBodyOrReference) GetValue() *RequestBodyOrReference { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of ResponseOrReference as ordered (name,value) pairs. -type NamedResponseOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *ResponseOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedResponseOrReference) Reset() { - *x = NamedResponseOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[39] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedResponseOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedResponseOrReference) ProtoMessage() {} - -func (x *NamedResponseOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[39] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedResponseOrReference.ProtoReflect.Descriptor instead. -func (*NamedResponseOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{39} -} - -func (x *NamedResponseOrReference) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedResponseOrReference) GetValue() *ResponseOrReference { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of SchemaOrReference as ordered (name,value) pairs. -type NamedSchemaOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *SchemaOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedSchemaOrReference) Reset() { - *x = NamedSchemaOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[40] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedSchemaOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedSchemaOrReference) ProtoMessage() {} - -func (x *NamedSchemaOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[40] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedSchemaOrReference.ProtoReflect.Descriptor instead. -func (*NamedSchemaOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{40} -} - -func (x *NamedSchemaOrReference) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedSchemaOrReference) GetValue() *SchemaOrReference { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of SecuritySchemeOrReference as ordered (name,value) pairs. -type NamedSecuritySchemeOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *SecuritySchemeOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedSecuritySchemeOrReference) Reset() { - *x = NamedSecuritySchemeOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[41] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedSecuritySchemeOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedSecuritySchemeOrReference) ProtoMessage() {} - -func (x *NamedSecuritySchemeOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[41] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedSecuritySchemeOrReference.ProtoReflect.Descriptor instead. -func (*NamedSecuritySchemeOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{41} -} - -func (x *NamedSecuritySchemeOrReference) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedSecuritySchemeOrReference) GetValue() *SecuritySchemeOrReference { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of ServerVariable as ordered (name,value) pairs. -type NamedServerVariable struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *ServerVariable `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedServerVariable) Reset() { - *x = NamedServerVariable{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[42] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedServerVariable) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedServerVariable) ProtoMessage() {} - -func (x *NamedServerVariable) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[42] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedServerVariable.ProtoReflect.Descriptor instead. -func (*NamedServerVariable) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{42} -} - -func (x *NamedServerVariable) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedServerVariable) GetValue() *ServerVariable { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of string as ordered (name,value) pairs. -type NamedString struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedString) Reset() { - *x = NamedString{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[43] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedString) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedString) ProtoMessage() {} - -func (x *NamedString) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[43] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedString.ProtoReflect.Descriptor instead. -func (*NamedString) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{43} -} - -func (x *NamedString) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedString) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -// Automatically-generated message used to represent maps of StringArray as ordered (name,value) pairs. -type NamedStringArray struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *StringArray `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedStringArray) Reset() { - *x = NamedStringArray{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[44] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedStringArray) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedStringArray) ProtoMessage() {} - -func (x *NamedStringArray) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[44] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedStringArray.ProtoReflect.Descriptor instead. -func (*NamedStringArray) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{44} -} - -func (x *NamedStringArray) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedStringArray) GetValue() *StringArray { - if x != nil { - return x.Value - } - return nil -} - -// Configuration details for a supported OAuth Flow -type OauthFlow struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AuthorizationUrl string `protobuf:"bytes,1,opt,name=authorization_url,json=authorizationUrl,proto3" json:"authorization_url,omitempty"` - TokenUrl string `protobuf:"bytes,2,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty"` - RefreshUrl string `protobuf:"bytes,3,opt,name=refresh_url,json=refreshUrl,proto3" json:"refresh_url,omitempty"` - Scopes *Strings `protobuf:"bytes,4,opt,name=scopes,proto3" json:"scopes,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,5,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *OauthFlow) Reset() { - *x = OauthFlow{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[45] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *OauthFlow) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*OauthFlow) ProtoMessage() {} - -func (x *OauthFlow) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[45] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use OauthFlow.ProtoReflect.Descriptor instead. -func (*OauthFlow) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{45} -} - -func (x *OauthFlow) GetAuthorizationUrl() string { - if x != nil { - return x.AuthorizationUrl - } - return "" -} - -func (x *OauthFlow) GetTokenUrl() string { - if x != nil { - return x.TokenUrl - } - return "" -} - -func (x *OauthFlow) GetRefreshUrl() string { - if x != nil { - return x.RefreshUrl - } - return "" -} - -func (x *OauthFlow) GetScopes() *Strings { - if x != nil { - return x.Scopes - } - return nil -} - -func (x *OauthFlow) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -// Allows configuration of the supported OAuth Flows. -type OauthFlows struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Implicit *OauthFlow `protobuf:"bytes,1,opt,name=implicit,proto3" json:"implicit,omitempty"` - Password *OauthFlow `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` - ClientCredentials *OauthFlow `protobuf:"bytes,3,opt,name=client_credentials,json=clientCredentials,proto3" json:"client_credentials,omitempty"` - AuthorizationCode *OauthFlow `protobuf:"bytes,4,opt,name=authorization_code,json=authorizationCode,proto3" json:"authorization_code,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,5,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *OauthFlows) Reset() { - *x = OauthFlows{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[46] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *OauthFlows) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*OauthFlows) ProtoMessage() {} - -func (x *OauthFlows) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[46] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use OauthFlows.ProtoReflect.Descriptor instead. -func (*OauthFlows) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{46} -} - -func (x *OauthFlows) GetImplicit() *OauthFlow { - if x != nil { - return x.Implicit - } - return nil -} - -func (x *OauthFlows) GetPassword() *OauthFlow { - if x != nil { - return x.Password - } - return nil -} - -func (x *OauthFlows) GetClientCredentials() *OauthFlow { - if x != nil { - return x.ClientCredentials - } - return nil -} - -func (x *OauthFlows) GetAuthorizationCode() *OauthFlow { - if x != nil { - return x.AuthorizationCode - } - return nil -} - -func (x *OauthFlows) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type Object struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedAny `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *Object) Reset() { - *x = Object{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[47] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Object) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Object) ProtoMessage() {} - -func (x *Object) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[47] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Object.ProtoReflect.Descriptor instead. -func (*Object) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{47} -} - -func (x *Object) GetAdditionalProperties() []*NamedAny { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// Describes a single API operation on a path. -type Operation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Tags []string `protobuf:"bytes,1,rep,name=tags,proto3" json:"tags,omitempty"` - Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - ExternalDocs *ExternalDocs `protobuf:"bytes,4,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` - OperationId string `protobuf:"bytes,5,opt,name=operation_id,json=operationId,proto3" json:"operation_id,omitempty"` - Parameters []*ParameterOrReference `protobuf:"bytes,6,rep,name=parameters,proto3" json:"parameters,omitempty"` - RequestBody *RequestBodyOrReference `protobuf:"bytes,7,opt,name=request_body,json=requestBody,proto3" json:"request_body,omitempty"` - Responses *Responses `protobuf:"bytes,8,opt,name=responses,proto3" json:"responses,omitempty"` - Callbacks *CallbacksOrReferences `protobuf:"bytes,9,opt,name=callbacks,proto3" json:"callbacks,omitempty"` - Deprecated bool `protobuf:"varint,10,opt,name=deprecated,proto3" json:"deprecated,omitempty"` - Security []*SecurityRequirement `protobuf:"bytes,11,rep,name=security,proto3" json:"security,omitempty"` - Servers []*Server `protobuf:"bytes,12,rep,name=servers,proto3" json:"servers,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,13,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Operation) Reset() { - *x = Operation{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[48] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Operation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Operation) ProtoMessage() {} - -func (x *Operation) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[48] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Operation.ProtoReflect.Descriptor instead. -func (*Operation) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{48} -} - -func (x *Operation) GetTags() []string { - if x != nil { - return x.Tags - } - return nil -} - -func (x *Operation) GetSummary() string { - if x != nil { - return x.Summary - } - return "" -} - -func (x *Operation) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Operation) GetExternalDocs() *ExternalDocs { - if x != nil { - return x.ExternalDocs - } - return nil -} - -func (x *Operation) GetOperationId() string { - if x != nil { - return x.OperationId - } - return "" -} - -func (x *Operation) GetParameters() []*ParameterOrReference { - if x != nil { - return x.Parameters - } - return nil -} - -func (x *Operation) GetRequestBody() *RequestBodyOrReference { - if x != nil { - return x.RequestBody - } - return nil -} - -func (x *Operation) GetResponses() *Responses { - if x != nil { - return x.Responses - } - return nil -} - -func (x *Operation) GetCallbacks() *CallbacksOrReferences { - if x != nil { - return x.Callbacks - } - return nil -} - -func (x *Operation) GetDeprecated() bool { - if x != nil { - return x.Deprecated - } - return false -} - -func (x *Operation) GetSecurity() []*SecurityRequirement { - if x != nil { - return x.Security - } - return nil -} - -func (x *Operation) GetServers() []*Server { - if x != nil { - return x.Servers - } - return nil -} - -func (x *Operation) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -// Describes a single operation parameter. A unique parameter is defined by a combination of a name and location. -type Parameter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - In string `protobuf:"bytes,2,opt,name=in,proto3" json:"in,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - Required bool `protobuf:"varint,4,opt,name=required,proto3" json:"required,omitempty"` - Deprecated bool `protobuf:"varint,5,opt,name=deprecated,proto3" json:"deprecated,omitempty"` - AllowEmptyValue bool `protobuf:"varint,6,opt,name=allow_empty_value,json=allowEmptyValue,proto3" json:"allow_empty_value,omitempty"` - Style string `protobuf:"bytes,7,opt,name=style,proto3" json:"style,omitempty"` - Explode bool `protobuf:"varint,8,opt,name=explode,proto3" json:"explode,omitempty"` - AllowReserved bool `protobuf:"varint,9,opt,name=allow_reserved,json=allowReserved,proto3" json:"allow_reserved,omitempty"` - Schema *SchemaOrReference `protobuf:"bytes,10,opt,name=schema,proto3" json:"schema,omitempty"` - Example *Any `protobuf:"bytes,11,opt,name=example,proto3" json:"example,omitempty"` - Examples *ExamplesOrReferences `protobuf:"bytes,12,opt,name=examples,proto3" json:"examples,omitempty"` - Content *MediaTypes `protobuf:"bytes,13,opt,name=content,proto3" json:"content,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,14,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Parameter) Reset() { - *x = Parameter{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[49] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Parameter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Parameter) ProtoMessage() {} - -func (x *Parameter) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[49] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Parameter.ProtoReflect.Descriptor instead. -func (*Parameter) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{49} -} - -func (x *Parameter) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Parameter) GetIn() string { - if x != nil { - return x.In - } - return "" -} - -func (x *Parameter) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Parameter) GetRequired() bool { - if x != nil { - return x.Required - } - return false -} - -func (x *Parameter) GetDeprecated() bool { - if x != nil { - return x.Deprecated - } - return false -} - -func (x *Parameter) GetAllowEmptyValue() bool { - if x != nil { - return x.AllowEmptyValue - } - return false -} - -func (x *Parameter) GetStyle() string { - if x != nil { - return x.Style - } - return "" -} - -func (x *Parameter) GetExplode() bool { - if x != nil { - return x.Explode - } - return false -} - -func (x *Parameter) GetAllowReserved() bool { - if x != nil { - return x.AllowReserved - } - return false -} - -func (x *Parameter) GetSchema() *SchemaOrReference { - if x != nil { - return x.Schema - } - return nil -} - -func (x *Parameter) GetExample() *Any { - if x != nil { - return x.Example - } - return nil -} - -func (x *Parameter) GetExamples() *ExamplesOrReferences { - if x != nil { - return x.Examples - } - return nil -} - -func (x *Parameter) GetContent() *MediaTypes { - if x != nil { - return x.Content - } - return nil -} - -func (x *Parameter) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type ParameterOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *ParameterOrReference_Parameter - // *ParameterOrReference_Reference - Oneof isParameterOrReference_Oneof `protobuf_oneof:"oneof"` -} - -func (x *ParameterOrReference) Reset() { - *x = ParameterOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[50] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ParameterOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ParameterOrReference) ProtoMessage() {} - -func (x *ParameterOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[50] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ParameterOrReference.ProtoReflect.Descriptor instead. -func (*ParameterOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{50} -} - -func (m *ParameterOrReference) GetOneof() isParameterOrReference_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *ParameterOrReference) GetParameter() *Parameter { - if x, ok := x.GetOneof().(*ParameterOrReference_Parameter); ok { - return x.Parameter - } - return nil -} - -func (x *ParameterOrReference) GetReference() *Reference { - if x, ok := x.GetOneof().(*ParameterOrReference_Reference); ok { - return x.Reference - } - return nil -} - -type isParameterOrReference_Oneof interface { - isParameterOrReference_Oneof() -} - -type ParameterOrReference_Parameter struct { - Parameter *Parameter `protobuf:"bytes,1,opt,name=parameter,proto3,oneof"` -} - -type ParameterOrReference_Reference struct { - Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"` -} - -func (*ParameterOrReference_Parameter) isParameterOrReference_Oneof() {} - -func (*ParameterOrReference_Reference) isParameterOrReference_Oneof() {} - -type ParametersOrReferences struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedParameterOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *ParametersOrReferences) Reset() { - *x = ParametersOrReferences{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[51] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ParametersOrReferences) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ParametersOrReferences) ProtoMessage() {} - -func (x *ParametersOrReferences) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[51] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ParametersOrReferences.ProtoReflect.Descriptor instead. -func (*ParametersOrReferences) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{51} -} - -func (x *ParametersOrReferences) GetAdditionalProperties() []*NamedParameterOrReference { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available. -type PathItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - XRef string `protobuf:"bytes,1,opt,name=_ref,json=Ref,proto3" json:"_ref,omitempty"` - Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - Get *Operation `protobuf:"bytes,4,opt,name=get,proto3" json:"get,omitempty"` - Put *Operation `protobuf:"bytes,5,opt,name=put,proto3" json:"put,omitempty"` - Post *Operation `protobuf:"bytes,6,opt,name=post,proto3" json:"post,omitempty"` - Delete *Operation `protobuf:"bytes,7,opt,name=delete,proto3" json:"delete,omitempty"` - Options *Operation `protobuf:"bytes,8,opt,name=options,proto3" json:"options,omitempty"` - Head *Operation `protobuf:"bytes,9,opt,name=head,proto3" json:"head,omitempty"` - Patch *Operation `protobuf:"bytes,10,opt,name=patch,proto3" json:"patch,omitempty"` - Trace *Operation `protobuf:"bytes,11,opt,name=trace,proto3" json:"trace,omitempty"` - Servers []*Server `protobuf:"bytes,12,rep,name=servers,proto3" json:"servers,omitempty"` - Parameters []*ParameterOrReference `protobuf:"bytes,13,rep,name=parameters,proto3" json:"parameters,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,14,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *PathItem) Reset() { - *x = PathItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[52] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PathItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PathItem) ProtoMessage() {} - -func (x *PathItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[52] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PathItem.ProtoReflect.Descriptor instead. -func (*PathItem) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{52} -} - -func (x *PathItem) GetXRef() string { - if x != nil { - return x.XRef - } - return "" -} - -func (x *PathItem) GetSummary() string { - if x != nil { - return x.Summary - } - return "" -} - -func (x *PathItem) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *PathItem) GetGet() *Operation { - if x != nil { - return x.Get - } - return nil -} - -func (x *PathItem) GetPut() *Operation { - if x != nil { - return x.Put - } - return nil -} - -func (x *PathItem) GetPost() *Operation { - if x != nil { - return x.Post - } - return nil -} - -func (x *PathItem) GetDelete() *Operation { - if x != nil { - return x.Delete - } - return nil -} - -func (x *PathItem) GetOptions() *Operation { - if x != nil { - return x.Options - } - return nil -} - -func (x *PathItem) GetHead() *Operation { - if x != nil { - return x.Head - } - return nil -} - -func (x *PathItem) GetPatch() *Operation { - if x != nil { - return x.Patch - } - return nil -} - -func (x *PathItem) GetTrace() *Operation { - if x != nil { - return x.Trace - } - return nil -} - -func (x *PathItem) GetServers() []*Server { - if x != nil { - return x.Servers - } - return nil -} - -func (x *PathItem) GetParameters() []*ParameterOrReference { - if x != nil { - return x.Parameters - } - return nil -} - -func (x *PathItem) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -// Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the `Server Object` in order to construct the full URL. The Paths MAY be empty, due to ACL constraints. -type Paths struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Path []*NamedPathItem `protobuf:"bytes,1,rep,name=path,proto3" json:"path,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,2,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Paths) Reset() { - *x = Paths{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[53] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Paths) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Paths) ProtoMessage() {} - -func (x *Paths) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[53] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Paths.ProtoReflect.Descriptor instead. -func (*Paths) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{53} -} - -func (x *Paths) GetPath() []*NamedPathItem { - if x != nil { - return x.Path - } - return nil -} - -func (x *Paths) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type Properties struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedSchemaOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *Properties) Reset() { - *x = Properties{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[54] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Properties) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Properties) ProtoMessage() {} - -func (x *Properties) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[54] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Properties.ProtoReflect.Descriptor instead. -func (*Properties) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{54} -} - -func (x *Properties) GetAdditionalProperties() []*NamedSchemaOrReference { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// A simple object to allow referencing other components in the specification, internally and externally. The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules. For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification. -type Reference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - XRef string `protobuf:"bytes,1,opt,name=_ref,json=Ref,proto3" json:"_ref,omitempty"` - Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` -} - -func (x *Reference) Reset() { - *x = Reference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[55] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Reference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Reference) ProtoMessage() {} - -func (x *Reference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[55] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Reference.ProtoReflect.Descriptor instead. -func (*Reference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{55} -} - -func (x *Reference) GetXRef() string { - if x != nil { - return x.XRef - } - return "" -} - -func (x *Reference) GetSummary() string { - if x != nil { - return x.Summary - } - return "" -} - -func (x *Reference) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -type RequestBodiesOrReferences struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedRequestBodyOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *RequestBodiesOrReferences) Reset() { - *x = RequestBodiesOrReferences{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[56] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RequestBodiesOrReferences) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RequestBodiesOrReferences) ProtoMessage() {} - -func (x *RequestBodiesOrReferences) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[56] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RequestBodiesOrReferences.ProtoReflect.Descriptor instead. -func (*RequestBodiesOrReferences) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{56} -} - -func (x *RequestBodiesOrReferences) GetAdditionalProperties() []*NamedRequestBodyOrReference { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// Describes a single request body. -type RequestBody struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` - Content *MediaTypes `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` - Required bool `protobuf:"varint,3,opt,name=required,proto3" json:"required,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,4,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *RequestBody) Reset() { - *x = RequestBody{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[57] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RequestBody) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RequestBody) ProtoMessage() {} - -func (x *RequestBody) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[57] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RequestBody.ProtoReflect.Descriptor instead. -func (*RequestBody) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{57} -} - -func (x *RequestBody) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *RequestBody) GetContent() *MediaTypes { - if x != nil { - return x.Content - } - return nil -} - -func (x *RequestBody) GetRequired() bool { - if x != nil { - return x.Required - } - return false -} - -func (x *RequestBody) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type RequestBodyOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *RequestBodyOrReference_RequestBody - // *RequestBodyOrReference_Reference - Oneof isRequestBodyOrReference_Oneof `protobuf_oneof:"oneof"` -} - -func (x *RequestBodyOrReference) Reset() { - *x = RequestBodyOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[58] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RequestBodyOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RequestBodyOrReference) ProtoMessage() {} - -func (x *RequestBodyOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[58] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RequestBodyOrReference.ProtoReflect.Descriptor instead. -func (*RequestBodyOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{58} -} - -func (m *RequestBodyOrReference) GetOneof() isRequestBodyOrReference_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *RequestBodyOrReference) GetRequestBody() *RequestBody { - if x, ok := x.GetOneof().(*RequestBodyOrReference_RequestBody); ok { - return x.RequestBody - } - return nil -} - -func (x *RequestBodyOrReference) GetReference() *Reference { - if x, ok := x.GetOneof().(*RequestBodyOrReference_Reference); ok { - return x.Reference - } - return nil -} - -type isRequestBodyOrReference_Oneof interface { - isRequestBodyOrReference_Oneof() -} - -type RequestBodyOrReference_RequestBody struct { - RequestBody *RequestBody `protobuf:"bytes,1,opt,name=request_body,json=requestBody,proto3,oneof"` -} - -type RequestBodyOrReference_Reference struct { - Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"` -} - -func (*RequestBodyOrReference_RequestBody) isRequestBodyOrReference_Oneof() {} - -func (*RequestBodyOrReference_Reference) isRequestBodyOrReference_Oneof() {} - -// Describes a single response from an API Operation, including design-time, static `links` to operations based on the response. -type Response struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` - Headers *HeadersOrReferences `protobuf:"bytes,2,opt,name=headers,proto3" json:"headers,omitempty"` - Content *MediaTypes `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` - Links *LinksOrReferences `protobuf:"bytes,4,opt,name=links,proto3" json:"links,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,5,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Response) Reset() { - *x = Response{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[59] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Response) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Response) ProtoMessage() {} - -func (x *Response) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[59] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Response.ProtoReflect.Descriptor instead. -func (*Response) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{59} -} - -func (x *Response) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Response) GetHeaders() *HeadersOrReferences { - if x != nil { - return x.Headers - } - return nil -} - -func (x *Response) GetContent() *MediaTypes { - if x != nil { - return x.Content - } - return nil -} - -func (x *Response) GetLinks() *LinksOrReferences { - if x != nil { - return x.Links - } - return nil -} - -func (x *Response) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type ResponseOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *ResponseOrReference_Response - // *ResponseOrReference_Reference - Oneof isResponseOrReference_Oneof `protobuf_oneof:"oneof"` -} - -func (x *ResponseOrReference) Reset() { - *x = ResponseOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[60] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ResponseOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ResponseOrReference) ProtoMessage() {} - -func (x *ResponseOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[60] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ResponseOrReference.ProtoReflect.Descriptor instead. -func (*ResponseOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{60} -} - -func (m *ResponseOrReference) GetOneof() isResponseOrReference_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *ResponseOrReference) GetResponse() *Response { - if x, ok := x.GetOneof().(*ResponseOrReference_Response); ok { - return x.Response - } - return nil -} - -func (x *ResponseOrReference) GetReference() *Reference { - if x, ok := x.GetOneof().(*ResponseOrReference_Reference); ok { - return x.Reference - } - return nil -} - -type isResponseOrReference_Oneof interface { - isResponseOrReference_Oneof() -} - -type ResponseOrReference_Response struct { - Response *Response `protobuf:"bytes,1,opt,name=response,proto3,oneof"` -} - -type ResponseOrReference_Reference struct { - Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"` -} - -func (*ResponseOrReference_Response) isResponseOrReference_Oneof() {} - -func (*ResponseOrReference_Reference) isResponseOrReference_Oneof() {} - -// A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. However, documentation is expected to cover a successful operation response and any known errors. The `default` MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. The `Responses Object` MUST contain at least one response code, and it SHOULD be the response for a successful operation call. -type Responses struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Default *ResponseOrReference `protobuf:"bytes,1,opt,name=default,proto3" json:"default,omitempty"` - ResponseOrReference []*NamedResponseOrReference `protobuf:"bytes,2,rep,name=response_or_reference,json=responseOrReference,proto3" json:"response_or_reference,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,3,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Responses) Reset() { - *x = Responses{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[61] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Responses) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Responses) ProtoMessage() {} - -func (x *Responses) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[61] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Responses.ProtoReflect.Descriptor instead. -func (*Responses) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{61} -} - -func (x *Responses) GetDefault() *ResponseOrReference { - if x != nil { - return x.Default - } - return nil -} - -func (x *Responses) GetResponseOrReference() []*NamedResponseOrReference { - if x != nil { - return x.ResponseOrReference - } - return nil -} - -func (x *Responses) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type ResponsesOrReferences struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedResponseOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *ResponsesOrReferences) Reset() { - *x = ResponsesOrReferences{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[62] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ResponsesOrReferences) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ResponsesOrReferences) ProtoMessage() {} - -func (x *ResponsesOrReferences) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[62] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ResponsesOrReferences.ProtoReflect.Descriptor instead. -func (*ResponsesOrReferences) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{62} -} - -func (x *ResponsesOrReferences) GetAdditionalProperties() []*NamedResponseOrReference { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is an extended subset of the JSON Schema Specification Wright Draft 00. For more information about the properties, see JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema. -type Schema struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Nullable bool `protobuf:"varint,1,opt,name=nullable,proto3" json:"nullable,omitempty"` - Discriminator *Discriminator `protobuf:"bytes,2,opt,name=discriminator,proto3" json:"discriminator,omitempty"` - ReadOnly bool `protobuf:"varint,3,opt,name=read_only,json=readOnly,proto3" json:"read_only,omitempty"` - WriteOnly bool `protobuf:"varint,4,opt,name=write_only,json=writeOnly,proto3" json:"write_only,omitempty"` - Xml *Xml `protobuf:"bytes,5,opt,name=xml,proto3" json:"xml,omitempty"` - ExternalDocs *ExternalDocs `protobuf:"bytes,6,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` - Example *Any `protobuf:"bytes,7,opt,name=example,proto3" json:"example,omitempty"` - Deprecated bool `protobuf:"varint,8,opt,name=deprecated,proto3" json:"deprecated,omitempty"` - Title string `protobuf:"bytes,9,opt,name=title,proto3" json:"title,omitempty"` - MultipleOf float64 `protobuf:"fixed64,10,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` - Maximum float64 `protobuf:"fixed64,11,opt,name=maximum,proto3" json:"maximum,omitempty"` - ExclusiveMaximum bool `protobuf:"varint,12,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` - Minimum float64 `protobuf:"fixed64,13,opt,name=minimum,proto3" json:"minimum,omitempty"` - ExclusiveMinimum bool `protobuf:"varint,14,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` - MaxLength int64 `protobuf:"varint,15,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` - MinLength int64 `protobuf:"varint,16,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` - Pattern string `protobuf:"bytes,17,opt,name=pattern,proto3" json:"pattern,omitempty"` - MaxItems int64 `protobuf:"varint,18,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` - MinItems int64 `protobuf:"varint,19,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` - UniqueItems bool `protobuf:"varint,20,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` - MaxProperties int64 `protobuf:"varint,21,opt,name=max_properties,json=maxProperties,proto3" json:"max_properties,omitempty"` - MinProperties int64 `protobuf:"varint,22,opt,name=min_properties,json=minProperties,proto3" json:"min_properties,omitempty"` - Required []string `protobuf:"bytes,23,rep,name=required,proto3" json:"required,omitempty"` - Enum []*Any `protobuf:"bytes,24,rep,name=enum,proto3" json:"enum,omitempty"` - Type string `protobuf:"bytes,25,opt,name=type,proto3" json:"type,omitempty"` - AllOf []*SchemaOrReference `protobuf:"bytes,26,rep,name=all_of,json=allOf,proto3" json:"all_of,omitempty"` - OneOf []*SchemaOrReference `protobuf:"bytes,27,rep,name=one_of,json=oneOf,proto3" json:"one_of,omitempty"` - AnyOf []*SchemaOrReference `protobuf:"bytes,28,rep,name=any_of,json=anyOf,proto3" json:"any_of,omitempty"` - Not *Schema `protobuf:"bytes,29,opt,name=not,proto3" json:"not,omitempty"` - Items *ItemsItem `protobuf:"bytes,30,opt,name=items,proto3" json:"items,omitempty"` - Properties *Properties `protobuf:"bytes,31,opt,name=properties,proto3" json:"properties,omitempty"` - AdditionalProperties *AdditionalPropertiesItem `protobuf:"bytes,32,opt,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` - Default *DefaultType `protobuf:"bytes,33,opt,name=default,proto3" json:"default,omitempty"` - Description string `protobuf:"bytes,34,opt,name=description,proto3" json:"description,omitempty"` - Format string `protobuf:"bytes,35,opt,name=format,proto3" json:"format,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,36,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Schema) Reset() { - *x = Schema{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[63] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Schema) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Schema) ProtoMessage() {} - -func (x *Schema) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[63] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Schema.ProtoReflect.Descriptor instead. -func (*Schema) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{63} -} - -func (x *Schema) GetNullable() bool { - if x != nil { - return x.Nullable - } - return false -} - -func (x *Schema) GetDiscriminator() *Discriminator { - if x != nil { - return x.Discriminator - } - return nil -} - -func (x *Schema) GetReadOnly() bool { - if x != nil { - return x.ReadOnly - } - return false -} - -func (x *Schema) GetWriteOnly() bool { - if x != nil { - return x.WriteOnly - } - return false -} - -func (x *Schema) GetXml() *Xml { - if x != nil { - return x.Xml - } - return nil -} - -func (x *Schema) GetExternalDocs() *ExternalDocs { - if x != nil { - return x.ExternalDocs - } - return nil -} - -func (x *Schema) GetExample() *Any { - if x != nil { - return x.Example - } - return nil -} - -func (x *Schema) GetDeprecated() bool { - if x != nil { - return x.Deprecated - } - return false -} - -func (x *Schema) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *Schema) GetMultipleOf() float64 { - if x != nil { - return x.MultipleOf - } - return 0 -} - -func (x *Schema) GetMaximum() float64 { - if x != nil { - return x.Maximum - } - return 0 -} - -func (x *Schema) GetExclusiveMaximum() bool { - if x != nil { - return x.ExclusiveMaximum - } - return false -} - -func (x *Schema) GetMinimum() float64 { - if x != nil { - return x.Minimum - } - return 0 -} - -func (x *Schema) GetExclusiveMinimum() bool { - if x != nil { - return x.ExclusiveMinimum - } - return false -} - -func (x *Schema) GetMaxLength() int64 { - if x != nil { - return x.MaxLength - } - return 0 -} - -func (x *Schema) GetMinLength() int64 { - if x != nil { - return x.MinLength - } - return 0 -} - -func (x *Schema) GetPattern() string { - if x != nil { - return x.Pattern - } - return "" -} - -func (x *Schema) GetMaxItems() int64 { - if x != nil { - return x.MaxItems - } - return 0 -} - -func (x *Schema) GetMinItems() int64 { - if x != nil { - return x.MinItems - } - return 0 -} - -func (x *Schema) GetUniqueItems() bool { - if x != nil { - return x.UniqueItems - } - return false -} - -func (x *Schema) GetMaxProperties() int64 { - if x != nil { - return x.MaxProperties - } - return 0 -} - -func (x *Schema) GetMinProperties() int64 { - if x != nil { - return x.MinProperties - } - return 0 -} - -func (x *Schema) GetRequired() []string { - if x != nil { - return x.Required - } - return nil -} - -func (x *Schema) GetEnum() []*Any { - if x != nil { - return x.Enum - } - return nil -} - -func (x *Schema) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *Schema) GetAllOf() []*SchemaOrReference { - if x != nil { - return x.AllOf - } - return nil -} - -func (x *Schema) GetOneOf() []*SchemaOrReference { - if x != nil { - return x.OneOf - } - return nil -} - -func (x *Schema) GetAnyOf() []*SchemaOrReference { - if x != nil { - return x.AnyOf - } - return nil -} - -func (x *Schema) GetNot() *Schema { - if x != nil { - return x.Not - } - return nil -} - -func (x *Schema) GetItems() *ItemsItem { - if x != nil { - return x.Items - } - return nil -} - -func (x *Schema) GetProperties() *Properties { - if x != nil { - return x.Properties - } - return nil -} - -func (x *Schema) GetAdditionalProperties() *AdditionalPropertiesItem { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -func (x *Schema) GetDefault() *DefaultType { - if x != nil { - return x.Default - } - return nil -} - -func (x *Schema) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Schema) GetFormat() string { - if x != nil { - return x.Format - } - return "" -} - -func (x *Schema) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type SchemaOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *SchemaOrReference_Schema - // *SchemaOrReference_Reference - Oneof isSchemaOrReference_Oneof `protobuf_oneof:"oneof"` -} - -func (x *SchemaOrReference) Reset() { - *x = SchemaOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[64] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SchemaOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SchemaOrReference) ProtoMessage() {} - -func (x *SchemaOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[64] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SchemaOrReference.ProtoReflect.Descriptor instead. -func (*SchemaOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{64} -} - -func (m *SchemaOrReference) GetOneof() isSchemaOrReference_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *SchemaOrReference) GetSchema() *Schema { - if x, ok := x.GetOneof().(*SchemaOrReference_Schema); ok { - return x.Schema - } - return nil -} - -func (x *SchemaOrReference) GetReference() *Reference { - if x, ok := x.GetOneof().(*SchemaOrReference_Reference); ok { - return x.Reference - } - return nil -} - -type isSchemaOrReference_Oneof interface { - isSchemaOrReference_Oneof() -} - -type SchemaOrReference_Schema struct { - Schema *Schema `protobuf:"bytes,1,opt,name=schema,proto3,oneof"` -} - -type SchemaOrReference_Reference struct { - Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"` -} - -func (*SchemaOrReference_Schema) isSchemaOrReference_Oneof() {} - -func (*SchemaOrReference_Reference) isSchemaOrReference_Oneof() {} - -type SchemasOrReferences struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedSchemaOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *SchemasOrReferences) Reset() { - *x = SchemasOrReferences{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[65] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SchemasOrReferences) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SchemasOrReferences) ProtoMessage() {} - -func (x *SchemasOrReferences) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[65] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SchemasOrReferences.ProtoReflect.Descriptor instead. -func (*SchemasOrReferences) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{65} -} - -func (x *SchemasOrReferences) GetAdditionalProperties() []*NamedSchemaOrReference { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object. Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information. When a list of Security Requirement Objects is defined on the OpenAPI Object or Operation Object, only one of the Security Requirement Objects in the list needs to be satisfied to authorize the request. -type SecurityRequirement struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedStringArray `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *SecurityRequirement) Reset() { - *x = SecurityRequirement{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[66] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SecurityRequirement) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SecurityRequirement) ProtoMessage() {} - -func (x *SecurityRequirement) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[66] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SecurityRequirement.ProtoReflect.Descriptor instead. -func (*SecurityRequirement) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{66} -} - -func (x *SecurityRequirement) GetAdditionalProperties() []*NamedStringArray { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header, a cookie parameter or as a query parameter), mutual TLS (use of a client certificate), OAuth2's common flows (implicit, password, application and access code) as defined in RFC6749, and OpenID Connect. Please note that currently (2019) the implicit flow is about to be deprecated OAuth 2.0 Security Best Current Practice. Recommended for most use case is Authorization Code Grant flow with PKCE. -type SecurityScheme struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - In string `protobuf:"bytes,4,opt,name=in,proto3" json:"in,omitempty"` - Scheme string `protobuf:"bytes,5,opt,name=scheme,proto3" json:"scheme,omitempty"` - BearerFormat string `protobuf:"bytes,6,opt,name=bearer_format,json=bearerFormat,proto3" json:"bearer_format,omitempty"` - Flows *OauthFlows `protobuf:"bytes,7,opt,name=flows,proto3" json:"flows,omitempty"` - OpenIdConnectUrl string `protobuf:"bytes,8,opt,name=open_id_connect_url,json=openIdConnectUrl,proto3" json:"open_id_connect_url,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,9,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *SecurityScheme) Reset() { - *x = SecurityScheme{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[67] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SecurityScheme) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SecurityScheme) ProtoMessage() {} - -func (x *SecurityScheme) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[67] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SecurityScheme.ProtoReflect.Descriptor instead. -func (*SecurityScheme) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{67} -} - -func (x *SecurityScheme) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *SecurityScheme) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *SecurityScheme) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *SecurityScheme) GetIn() string { - if x != nil { - return x.In - } - return "" -} - -func (x *SecurityScheme) GetScheme() string { - if x != nil { - return x.Scheme - } - return "" -} - -func (x *SecurityScheme) GetBearerFormat() string { - if x != nil { - return x.BearerFormat - } - return "" -} - -func (x *SecurityScheme) GetFlows() *OauthFlows { - if x != nil { - return x.Flows - } - return nil -} - -func (x *SecurityScheme) GetOpenIdConnectUrl() string { - if x != nil { - return x.OpenIdConnectUrl - } - return "" -} - -func (x *SecurityScheme) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type SecuritySchemeOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *SecuritySchemeOrReference_SecurityScheme - // *SecuritySchemeOrReference_Reference - Oneof isSecuritySchemeOrReference_Oneof `protobuf_oneof:"oneof"` -} - -func (x *SecuritySchemeOrReference) Reset() { - *x = SecuritySchemeOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[68] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SecuritySchemeOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SecuritySchemeOrReference) ProtoMessage() {} - -func (x *SecuritySchemeOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[68] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SecuritySchemeOrReference.ProtoReflect.Descriptor instead. -func (*SecuritySchemeOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{68} -} - -func (m *SecuritySchemeOrReference) GetOneof() isSecuritySchemeOrReference_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *SecuritySchemeOrReference) GetSecurityScheme() *SecurityScheme { - if x, ok := x.GetOneof().(*SecuritySchemeOrReference_SecurityScheme); ok { - return x.SecurityScheme - } - return nil -} - -func (x *SecuritySchemeOrReference) GetReference() *Reference { - if x, ok := x.GetOneof().(*SecuritySchemeOrReference_Reference); ok { - return x.Reference - } - return nil -} - -type isSecuritySchemeOrReference_Oneof interface { - isSecuritySchemeOrReference_Oneof() -} - -type SecuritySchemeOrReference_SecurityScheme struct { - SecurityScheme *SecurityScheme `protobuf:"bytes,1,opt,name=security_scheme,json=securityScheme,proto3,oneof"` -} - -type SecuritySchemeOrReference_Reference struct { - Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"` -} - -func (*SecuritySchemeOrReference_SecurityScheme) isSecuritySchemeOrReference_Oneof() {} - -func (*SecuritySchemeOrReference_Reference) isSecuritySchemeOrReference_Oneof() {} - -type SecuritySchemesOrReferences struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedSecuritySchemeOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *SecuritySchemesOrReferences) Reset() { - *x = SecuritySchemesOrReferences{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[69] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SecuritySchemesOrReferences) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SecuritySchemesOrReferences) ProtoMessage() {} - -func (x *SecuritySchemesOrReferences) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[69] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SecuritySchemesOrReferences.ProtoReflect.Descriptor instead. -func (*SecuritySchemesOrReferences) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{69} -} - -func (x *SecuritySchemesOrReferences) GetAdditionalProperties() []*NamedSecuritySchemeOrReference { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// An object representing a Server. -type Server struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Variables *ServerVariables `protobuf:"bytes,3,opt,name=variables,proto3" json:"variables,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,4,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Server) Reset() { - *x = Server{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[70] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Server) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Server) ProtoMessage() {} - -func (x *Server) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[70] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Server.ProtoReflect.Descriptor instead. -func (*Server) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{70} -} - -func (x *Server) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *Server) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Server) GetVariables() *ServerVariables { - if x != nil { - return x.Variables - } - return nil -} - -func (x *Server) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -// An object representing a Server Variable for server URL template substitution. -type ServerVariable struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Enum []string `protobuf:"bytes,1,rep,name=enum,proto3" json:"enum,omitempty"` - Default string `protobuf:"bytes,2,opt,name=default,proto3" json:"default,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,4,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *ServerVariable) Reset() { - *x = ServerVariable{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[71] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ServerVariable) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ServerVariable) ProtoMessage() {} - -func (x *ServerVariable) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[71] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ServerVariable.ProtoReflect.Descriptor instead. -func (*ServerVariable) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{71} -} - -func (x *ServerVariable) GetEnum() []string { - if x != nil { - return x.Enum - } - return nil -} - -func (x *ServerVariable) GetDefault() string { - if x != nil { - return x.Default - } - return "" -} - -func (x *ServerVariable) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *ServerVariable) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type ServerVariables struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedServerVariable `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *ServerVariables) Reset() { - *x = ServerVariables{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[72] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ServerVariables) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ServerVariables) ProtoMessage() {} - -func (x *ServerVariables) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[72] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ServerVariables.ProtoReflect.Descriptor instead. -func (*ServerVariables) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{72} -} - -func (x *ServerVariables) GetAdditionalProperties() []*NamedServerVariable { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// Any property starting with x- is valid. -type SpecificationExtension struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *SpecificationExtension_Number - // *SpecificationExtension_Boolean - // *SpecificationExtension_String_ - Oneof isSpecificationExtension_Oneof `protobuf_oneof:"oneof"` -} - -func (x *SpecificationExtension) Reset() { - *x = SpecificationExtension{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[73] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SpecificationExtension) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SpecificationExtension) ProtoMessage() {} - -func (x *SpecificationExtension) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[73] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SpecificationExtension.ProtoReflect.Descriptor instead. -func (*SpecificationExtension) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{73} -} - -func (m *SpecificationExtension) GetOneof() isSpecificationExtension_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *SpecificationExtension) GetNumber() float64 { - if x, ok := x.GetOneof().(*SpecificationExtension_Number); ok { - return x.Number - } - return 0 -} - -func (x *SpecificationExtension) GetBoolean() bool { - if x, ok := x.GetOneof().(*SpecificationExtension_Boolean); ok { - return x.Boolean - } - return false -} - -func (x *SpecificationExtension) GetString_() string { - if x, ok := x.GetOneof().(*SpecificationExtension_String_); ok { - return x.String_ - } - return "" -} - -type isSpecificationExtension_Oneof interface { - isSpecificationExtension_Oneof() -} - -type SpecificationExtension_Number struct { - Number float64 `protobuf:"fixed64,1,opt,name=number,proto3,oneof"` -} - -type SpecificationExtension_Boolean struct { - Boolean bool `protobuf:"varint,2,opt,name=boolean,proto3,oneof"` -} - -type SpecificationExtension_String_ struct { - String_ string `protobuf:"bytes,3,opt,name=string,proto3,oneof"` -} - -func (*SpecificationExtension_Number) isSpecificationExtension_Oneof() {} - -func (*SpecificationExtension_Boolean) isSpecificationExtension_Oneof() {} - -func (*SpecificationExtension_String_) isSpecificationExtension_Oneof() {} - -type StringArray struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Value []string `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"` -} - -func (x *StringArray) Reset() { - *x = StringArray{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[74] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StringArray) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StringArray) ProtoMessage() {} - -func (x *StringArray) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[74] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StringArray.ProtoReflect.Descriptor instead. -func (*StringArray) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{74} -} - -func (x *StringArray) GetValue() []string { - if x != nil { - return x.Value - } - return nil -} - -type Strings struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedString `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *Strings) Reset() { - *x = Strings{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[75] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Strings) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Strings) ProtoMessage() {} - -func (x *Strings) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[75] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Strings.ProtoReflect.Descriptor instead. -func (*Strings) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{75} -} - -func (x *Strings) GetAdditionalProperties() []*NamedString { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances. -type Tag struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - ExternalDocs *ExternalDocs `protobuf:"bytes,3,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,4,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Tag) Reset() { - *x = Tag{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[76] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Tag) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Tag) ProtoMessage() {} - -func (x *Tag) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[76] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Tag.ProtoReflect.Descriptor instead. -func (*Tag) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{76} -} - -func (x *Tag) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Tag) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Tag) GetExternalDocs() *ExternalDocs { - if x != nil { - return x.ExternalDocs - } - return nil -} - -func (x *Tag) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -// A metadata object that allows for more fine-tuned XML model definitions. When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property SHOULD be used to add that information. See examples for expected behavior. -type Xml struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` - Prefix string `protobuf:"bytes,3,opt,name=prefix,proto3" json:"prefix,omitempty"` - Attribute bool `protobuf:"varint,4,opt,name=attribute,proto3" json:"attribute,omitempty"` - Wrapped bool `protobuf:"varint,5,opt,name=wrapped,proto3" json:"wrapped,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,6,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Xml) Reset() { - *x = Xml{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[77] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Xml) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Xml) ProtoMessage() {} - -func (x *Xml) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[77] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Xml.ProtoReflect.Descriptor instead. -func (*Xml) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{77} -} - -func (x *Xml) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Xml) GetNamespace() string { - if x != nil { - return x.Namespace - } - return "" -} - -func (x *Xml) GetPrefix() string { - if x != nil { - return x.Prefix - } - return "" -} - -func (x *Xml) GetAttribute() bool { - if x != nil { - return x.Attribute - } - return false -} - -func (x *Xml) GetWrapped() bool { - if x != nil { - return x.Wrapped - } - return false -} - -func (x *Xml) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -var File_openapiv3_OpenAPIv3_proto protoreflect.FileDescriptor - -var file_openapiv3_OpenAPIv3_proto_rawDesc = []byte{ - 0x0a, 0x19, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x33, 0x2f, 0x4f, 0x70, 0x65, 0x6e, - 0x41, 0x50, 0x49, 0x76, 0x33, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x90, 0x01, 0x0a, 0x18, 0x41, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, - 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12, - 0x4f, 0x0a, 0x13, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, 0x5f, 0x72, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, - 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x11, 0x73, - 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, - 0x12, 0x1a, 0x0a, 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x08, 0x48, 0x00, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x42, 0x07, 0x0a, 0x05, - 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x45, 0x0a, 0x03, 0x41, 0x6e, 0x79, 0x12, 0x2a, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, - 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x79, 0x61, 0x6d, 0x6c, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x22, 0x79, 0x0a, 0x0f, - 0x41, 0x6e, 0x79, 0x4f, 0x72, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x23, 0x0a, 0x03, 0x61, 0x6e, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, 0x79, 0x48, 0x00, 0x52, - 0x03, 0x61, 0x6e, 0x79, 0x12, 0x38, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x48, 0x00, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x07, - 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x88, 0x01, 0x0a, 0x08, 0x43, 0x61, 0x6c, 0x6c, - 0x62, 0x61, 0x63, 0x6b, 0x12, 0x2d, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x04, 0x70, - 0x61, 0x74, 0x68, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x22, 0x89, 0x01, 0x0a, 0x13, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x4f, - 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x63, 0x61, - 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, - 0x63, 0x6b, 0x48, 0x00, 0x52, 0x08, 0x63, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x12, 0x35, - 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, - 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, - 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x72, - 0x0a, 0x15, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x59, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, - 0x6b, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x14, 0x61, 0x64, - 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, - 0x65, 0x73, 0x22, 0xac, 0x05, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, - 0x73, 0x12, 0x39, 0x0a, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, - 0x63, 0x65, 0x73, 0x52, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x12, 0x3f, 0x0a, 0x09, - 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x21, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x73, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x12, 0x42, 0x0a, - 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, - 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, - 0x73, 0x12, 0x3c, 0x0a, 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, - 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, - 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x12, - 0x4c, 0x0a, 0x0e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x6f, 0x64, 0x69, 0x65, - 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x69, - 0x65, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x0d, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x69, 0x65, 0x73, 0x12, 0x39, 0x0a, - 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, - 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x52, 0x0a, 0x10, 0x73, 0x65, 0x63, 0x75, - 0x72, 0x69, 0x74, 0x79, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x4f, - 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x0f, 0x73, 0x65, 0x63, - 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x12, 0x33, 0x0a, 0x05, - 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x4f, 0x72, - 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x05, 0x6c, 0x69, 0x6e, 0x6b, - 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x63, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x73, 0x18, 0x09, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x33, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x09, 0x63, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, - 0x6b, 0x73, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, - 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x22, 0x94, 0x01, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x75, 0x72, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, - 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, - 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x66, 0x0a, 0x0b, 0x44, 0x65, 0x66, 0x61, - 0x75, 0x6c, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, - 0x72, 0x12, 0x1a, 0x0a, 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x08, 0x48, 0x00, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x12, 0x18, 0x0a, - 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, - 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, - 0x22, 0xb2, 0x01, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, - 0x6f, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x5f, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x70, 0x65, - 0x72, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2d, 0x0a, 0x07, 0x6d, 0x61, 0x70, 0x70, 0x69, - 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x07, 0x6d, - 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, - 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xc9, 0x03, 0x0a, 0x08, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x12, 0x24, 0x0a, 0x04, - 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, - 0x66, 0x6f, 0x12, 0x2c, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, - 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, - 0x12, 0x27, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x11, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x61, 0x74, - 0x68, 0x73, 0x52, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x12, 0x36, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, - 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, - 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, - 0x73, 0x12, 0x3b, 0x0a, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x06, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, - 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x23, - 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x54, 0x61, 0x67, 0x52, 0x04, 0x74, - 0x61, 0x67, 0x73, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, - 0x64, 0x6f, 0x63, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, - 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, - 0x63, 0x73, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, - 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x22, 0x8e, 0x02, 0x0a, 0x08, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x21, - 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x39, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, - 0x63, 0x65, 0x73, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x14, 0x0a, 0x05, - 0x73, 0x74, 0x79, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x79, - 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x64, 0x65, 0x12, 0x25, 0x0a, 0x0e, - 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x64, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x22, 0x5b, 0x0a, 0x09, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x12, - 0x4e, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, - 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, - 0x64, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, - 0xe2, 0x01, 0x0a, 0x07, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, - 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, - 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x25, - 0x0a, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x85, 0x01, 0x0a, 0x12, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, - 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x2f, 0x0a, 0x07, 0x65, - 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, - 0x65, 0x48, 0x00, 0x52, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x35, 0x0a, 0x09, - 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, - 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x70, 0x0a, 0x14, - 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, - 0x6e, 0x63, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, - 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x4f, 0x72, 0x52, - 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x57, - 0x0a, 0x0a, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x49, 0x0a, 0x15, - 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, - 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, - 0x79, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, - 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x91, 0x01, 0x0a, 0x0c, 0x45, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, - 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x4d, 0x0a, 0x17, - 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, - 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x8a, 0x04, 0x0a, 0x06, - 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, - 0x69, 0x72, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, - 0x69, 0x72, 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, - 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, - 0x61, 0x74, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x65, 0x6d, - 0x70, 0x74, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x0f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x64, - 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x64, 0x65, - 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x52, - 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x35, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x29, - 0x0a, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, 0x79, - 0x52, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x3c, 0x0a, 0x08, 0x65, 0x78, 0x61, - 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, - 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x08, 0x65, - 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x12, 0x30, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x73, - 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, - 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, - 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x81, 0x01, 0x0a, 0x11, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x2c, - 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x48, 0x00, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x35, 0x0a, 0x09, - 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, - 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x6e, 0x0a, 0x13, - 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, - 0x63, 0x65, 0x73, 0x12, 0x57, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, - 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xc9, 0x02, 0x0a, - 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, - 0x10, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x5f, 0x6f, 0x66, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x4f, 0x66, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x2d, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x63, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x52, 0x07, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x2d, 0x0a, 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, - 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x52, 0x07, 0x6c, 0x69, - 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, - 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, - 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x22, 0x5a, 0x0a, 0x09, 0x49, 0x74, 0x65, 0x6d, - 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x4d, 0x0a, 0x13, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, - 0x6f, 0x72, 0x5f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x52, 0x11, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, - 0x65, 0x6e, 0x63, 0x65, 0x22, 0x7e, 0x0a, 0x07, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xe8, 0x02, 0x0a, 0x04, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x23, 0x0a, - 0x0d, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x66, 0x12, 0x21, 0x0a, 0x0c, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, - 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x3b, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, - 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, 0x79, 0x4f, 0x72, 0x45, 0x78, 0x70, 0x72, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x73, 0x12, 0x3e, 0x0a, 0x0c, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x6f, - 0x64, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, 0x79, 0x4f, 0x72, 0x45, 0x78, 0x70, 0x72, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, - 0x64, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x33, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, - 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, - 0x79, 0x0a, 0x0f, 0x4c, 0x69, 0x6e, 0x6b, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, - 0x63, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x10, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4c, 0x69, - 0x6e, 0x6b, 0x48, 0x00, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x12, 0x35, 0x0a, 0x09, 0x72, 0x65, - 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, - 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x6a, 0x0a, 0x11, 0x4c, 0x69, - 0x6e, 0x6b, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, - 0x55, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, - 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, - 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, - 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, - 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xad, 0x02, 0x0a, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x35, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, - 0x6e, 0x63, 0x65, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x29, 0x0a, 0x07, 0x65, - 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x65, - 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x3c, 0x0a, 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, - 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x4f, 0x72, - 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x08, 0x65, 0x78, 0x61, 0x6d, - 0x70, 0x6c, 0x65, 0x73, 0x12, 0x31, 0x0a, 0x08, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x08, 0x65, - 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, - 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x5d, 0x0a, 0x0a, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, - 0x79, 0x70, 0x65, 0x73, 0x12, 0x4f, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, - 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x52, - 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, - 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x45, 0x0a, 0x08, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, - 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x25, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x33, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x65, 0x0a, 0x18, - 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x4f, 0x72, 0x52, - 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, - 0x6b, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x22, 0x4f, 0x0a, 0x0d, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x45, 0x6e, 0x63, 0x6f, - 0x64, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x22, 0x63, 0x0a, 0x17, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x45, 0x78, 0x61, - 0x6d, 0x70, 0x6c, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x34, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, - 0x63, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x61, 0x0a, 0x16, 0x4e, 0x61, 0x6d, - 0x65, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, - 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x33, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, - 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x5d, 0x0a, 0x14, - 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, - 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x31, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4c, 0x69, 0x6e, 0x6b, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, - 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x51, 0x0a, 0x0e, 0x4e, - 0x61, 0x6d, 0x65, 0x64, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, - 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x67, - 0x0a, 0x19, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, - 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x36, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x65, 0x74, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4f, 0x0a, 0x0d, 0x4e, 0x61, 0x6d, 0x65, 0x64, - 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, - 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x6b, 0x0a, 0x1b, 0x4e, 0x61, 0x6d, 0x65, - 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x72, 0x52, 0x65, - 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x38, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, - 0x6f, 0x64, 0x79, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x65, 0x0a, 0x18, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x33, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, - 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x61, 0x0a, 0x16, - 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x33, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, - 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0x71, 0x0a, 0x1e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, - 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x33, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, - 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0x5b, 0x0a, 0x13, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x30, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0x37, 0x0a, 0x0b, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x12, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x55, 0x0a, 0x10, 0x4e, 0x61, 0x6d, 0x65, - 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x17, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x41, 0x72, 0x72, 0x61, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0xf2, 0x01, 0x0a, 0x09, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x46, 0x6c, 0x6f, 0x77, 0x12, 0x2b, 0x0a, - 0x11, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x75, - 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, - 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, - 0x6f, 0x6b, 0x65, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x66, 0x72, 0x65, - 0x73, 0x68, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, - 0x66, 0x72, 0x65, 0x73, 0x68, 0x55, 0x72, 0x6c, 0x12, 0x2b, 0x0a, 0x06, 0x73, 0x63, 0x6f, 0x70, - 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x06, 0x73, - 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xcd, 0x02, 0x0a, 0x0a, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x46, 0x6c, - 0x6f, 0x77, 0x73, 0x12, 0x31, 0x0a, 0x08, 0x69, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x33, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x08, 0x69, 0x6d, - 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x12, 0x31, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, - 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x46, 0x6c, 0x6f, 0x77, 0x52, - 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x44, 0x0a, 0x12, 0x63, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x33, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x11, 0x63, 0x6c, - 0x69, 0x65, 0x6e, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x12, - 0x44, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x46, 0x6c, - 0x6f, 0x77, 0x52, 0x11, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x53, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x49, - 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, - 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, - 0x41, 0x6e, 0x79, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, - 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x96, 0x05, 0x0a, 0x09, 0x4f, 0x70, - 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, - 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, - 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, - 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, - 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x70, - 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x40, 0x0a, 0x0a, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, - 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x45, 0x0a, 0x0c, 0x72, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, - 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x0b, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, - 0x64, 0x79, 0x12, 0x33, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x33, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x52, 0x09, 0x72, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x63, 0x61, 0x6c, 0x6c, 0x62, - 0x61, 0x63, 0x6b, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, - 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x09, 0x63, - 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, - 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, - 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x3b, 0x0a, 0x08, 0x73, 0x65, 0x63, 0x75, - 0x72, 0x69, 0x74, 0x79, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, - 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x73, 0x65, 0x63, - 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x2c, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, - 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x73, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0d, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x22, 0xb1, 0x04, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, - 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x02, 0x69, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, - 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, - 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, - 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x65, 0x6d, 0x70, 0x74, - 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x61, - 0x6c, 0x6c, 0x6f, 0x77, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, - 0x0a, 0x05, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, - 0x74, 0x79, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x64, 0x65, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x64, 0x65, 0x12, 0x25, - 0x0a, 0x0e, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, - 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x35, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, - 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, - 0x65, 0x6e, 0x63, 0x65, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x29, 0x0a, 0x07, - 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, - 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x3c, 0x0a, 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, - 0x6c, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x4f, - 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x08, 0x65, 0x78, 0x61, - 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x12, 0x30, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, - 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x07, - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, - 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x8d, 0x01, 0x0a, 0x14, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, - 0x35, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x09, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x35, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, - 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, - 0x48, 0x00, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, - 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x74, 0x0a, 0x16, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, - 0x74, 0x65, 0x72, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, - 0x12, 0x5a, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, - 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x25, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, - 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xfa, 0x04, 0x0a, - 0x08, 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x11, 0x0a, 0x04, 0x5f, 0x72, 0x65, - 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x52, 0x65, 0x66, 0x12, 0x18, 0x0a, 0x07, - 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, - 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x03, 0x67, 0x65, 0x74, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x33, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x67, 0x65, - 0x74, 0x12, 0x27, 0x0a, 0x03, 0x70, 0x75, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4f, 0x70, 0x65, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x70, 0x75, 0x74, 0x12, 0x29, 0x0a, 0x04, 0x70, 0x6f, - 0x73, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x04, 0x70, 0x6f, 0x73, 0x74, 0x12, 0x2d, 0x0a, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x33, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x64, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x33, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x29, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x18, 0x09, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, - 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x68, 0x65, 0x61, 0x64, - 0x12, 0x2b, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4f, 0x70, 0x65, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x12, 0x2b, 0x0a, - 0x05, 0x74, 0x72, 0x61, 0x63, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x74, 0x72, 0x61, 0x63, 0x65, 0x12, 0x2c, 0x0a, 0x07, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, - 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12, 0x40, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, - 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, - 0x74, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x0a, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, - 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x85, 0x01, 0x0a, 0x05, 0x50, 0x61, - 0x74, 0x68, 0x73, 0x12, 0x2d, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, - 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x04, 0x70, 0x61, - 0x74, 0x68, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, - 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x22, 0x65, 0x0a, 0x0a, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, - 0x57, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, - 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, - 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, - 0x63, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, - 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x5a, 0x0a, 0x09, 0x52, 0x65, 0x66, 0x65, - 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x11, 0x0a, 0x04, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x52, 0x65, 0x66, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, - 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, - 0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x79, 0x0a, 0x19, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, - 0x6f, 0x64, 0x69, 0x65, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, - 0x73, 0x12, 0x5c, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, - 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, - 0x6d, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x72, - 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, - 0xcc, 0x01, 0x0a, 0x0b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x79, 0x12, - 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x30, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, - 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, - 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, - 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x96, - 0x01, 0x0a, 0x16, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x72, - 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x3c, 0x0a, 0x0c, 0x72, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x17, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x79, 0x48, 0x00, 0x52, 0x0b, 0x72, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x35, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, - 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x48, 0x00, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, - 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x9d, 0x02, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x39, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x4f, 0x72, 0x52, 0x65, - 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x73, 0x12, 0x30, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, - 0x65, 0x6e, 0x74, 0x12, 0x33, 0x0a, 0x05, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, - 0x73, 0x52, 0x05, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, - 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x89, 0x01, 0x0a, 0x13, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, - 0x32, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, - 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, - 0x65, 0x6f, 0x66, 0x22, 0xef, 0x01, 0x0a, 0x09, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x73, 0x12, 0x39, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, - 0x6e, 0x63, 0x65, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x58, 0x0a, 0x15, - 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x6f, 0x72, 0x5f, 0x72, 0x65, 0x66, 0x65, - 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x52, 0x13, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, - 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x72, 0x0a, 0x15, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x59, - 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, - 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, - 0x6e, 0x63, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, - 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xaf, 0x0b, 0x0a, 0x06, 0x53, 0x63, - 0x68, 0x65, 0x6d, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, - 0x12, 0x3f, 0x0a, 0x0d, 0x64, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, - 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, - 0x6f, 0x72, 0x52, 0x0d, 0x64, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, - 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x61, 0x64, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x1d, - 0x0a, 0x0a, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x09, 0x77, 0x72, 0x69, 0x74, 0x65, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x21, 0x0a, - 0x03, 0x78, 0x6d, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x58, 0x6d, 0x6c, 0x52, 0x03, 0x78, 0x6d, 0x6c, - 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, - 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, - 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, - 0x29, 0x0a, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, - 0x79, 0x52, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, - 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, - 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, - 0x74, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, - 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18, - 0x0a, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f, - 0x66, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, - 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, - 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, - 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, - 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x69, - 0x6d, 0x75, 0x6d, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, - 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, - 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, - 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, - 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0f, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d, - 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x10, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a, - 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69, - 0x74, 0x65, 0x6d, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, - 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, - 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, - 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, - 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, - 0x74, 0x65, 0x6d, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x72, 0x6f, 0x70, - 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x15, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6d, 0x61, - 0x78, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x6d, - 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x16, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6d, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, - 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x17, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x23, - 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x18, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, - 0x6e, 0x75, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x19, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x34, 0x0a, 0x06, 0x61, 0x6c, 0x6c, 0x5f, 0x6f, - 0x66, 0x18, 0x1a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x61, 0x6c, 0x6c, 0x4f, 0x66, 0x12, 0x34, 0x0a, - 0x06, 0x6f, 0x6e, 0x65, 0x5f, 0x6f, 0x66, 0x18, 0x1b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x6f, 0x6e, - 0x65, 0x4f, 0x66, 0x12, 0x34, 0x0a, 0x06, 0x61, 0x6e, 0x79, 0x5f, 0x6f, 0x66, 0x18, 0x1c, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, - 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, - 0x63, 0x65, 0x52, 0x05, 0x61, 0x6e, 0x79, 0x4f, 0x66, 0x12, 0x24, 0x0a, 0x03, 0x6e, 0x6f, 0x74, - 0x18, 0x1d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x03, 0x6e, 0x6f, 0x74, 0x12, - 0x2b, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x74, 0x65, 0x6d, - 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x0a, - 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x72, - 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, - 0x74, 0x69, 0x65, 0x73, 0x12, 0x59, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x20, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, - 0x2e, 0x41, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, - 0x72, 0x74, 0x69, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, - 0x31, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x21, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x17, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x65, - 0x66, 0x61, 0x75, 0x6c, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, - 0x6c, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x22, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x23, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x4d, 0x0a, 0x17, - 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x24, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, - 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x81, 0x01, 0x0a, 0x11, - 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x12, 0x2c, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, - 0x63, 0x68, 0x65, 0x6d, 0x61, 0x48, 0x00, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, - 0x35, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x09, 0x72, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, - 0x6e, 0x0a, 0x13, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, - 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x57, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, - 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, - 0x68, 0x0a, 0x13, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x51, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x41, 0x72, - 0x72, 0x61, 0x79, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, - 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xd3, 0x02, 0x0a, 0x0e, 0x53, 0x65, - 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x23, - 0x0a, 0x0d, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x46, 0x6f, 0x72, - 0x6d, 0x61, 0x74, 0x12, 0x2c, 0x0a, 0x05, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x4f, 0x61, 0x75, 0x74, 0x68, 0x46, 0x6c, 0x6f, 0x77, 0x73, 0x52, 0x05, 0x66, 0x6c, 0x6f, 0x77, - 0x73, 0x12, 0x2d, 0x0a, 0x13, 0x6f, 0x70, 0x65, 0x6e, 0x5f, 0x69, 0x64, 0x5f, 0x63, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, - 0x6f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x55, 0x72, 0x6c, - 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, - 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, - 0xa2, 0x01, 0x0a, 0x19, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, 0x65, - 0x6d, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x45, 0x0a, - 0x0f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, 0x65, - 0x6d, 0x65, 0x48, 0x00, 0x52, 0x0e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, - 0x68, 0x65, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, - 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, - 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x7e, 0x0a, 0x1b, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, - 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, - 0x63, 0x65, 0x73, 0x12, 0x5f, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, - 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, - 0x65, 0x6d, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x14, - 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, - 0x74, 0x69, 0x65, 0x73, 0x22, 0xc6, 0x01, 0x0a, 0x06, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, - 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, - 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x39, 0x0a, 0x09, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x73, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, - 0x6c, 0x65, 0x73, 0x52, 0x09, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x12, 0x4d, - 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, - 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, - 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xaf, 0x01, - 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, - 0x12, 0x12, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, - 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x20, - 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, - 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, - 0x67, 0x0a, 0x0f, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, - 0x65, 0x73, 0x12, 0x54, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, - 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, - 0x61, 0x6d, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, - 0x6c, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, - 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x71, 0x0a, 0x16, 0x53, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x01, 0x48, 0x00, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x07, - 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, - 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x12, 0x18, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x69, - 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x72, 0x69, - 0x6e, 0x67, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x23, 0x0a, 0x0b, 0x53, - 0x74, 0x72, 0x69, 0x6e, 0x67, 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x22, 0x57, 0x0a, 0x07, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x4c, 0x0a, 0x15, 0x61, - 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, - 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, - 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xc9, 0x01, 0x0a, 0x03, 0x54, 0x61, - 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, - 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, - 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, - 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xd6, 0x01, 0x0a, 0x03, 0x58, 0x6d, 0x6c, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, - 0x16, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, - 0x62, 0x75, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x61, 0x74, 0x74, 0x72, - 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, 0x12, - 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, - 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x3e, - 0x0a, 0x0e, 0x6f, 0x72, 0x67, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x33, - 0x42, 0x0c, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x50, 0x49, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x16, 0x2e, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x33, 0x3b, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x33, 0xa2, 0x02, 0x03, 0x4f, 0x41, 0x53, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_openapiv3_OpenAPIv3_proto_rawDescOnce sync.Once - file_openapiv3_OpenAPIv3_proto_rawDescData = file_openapiv3_OpenAPIv3_proto_rawDesc -) - -func file_openapiv3_OpenAPIv3_proto_rawDescGZIP() []byte { - file_openapiv3_OpenAPIv3_proto_rawDescOnce.Do(func() { - file_openapiv3_OpenAPIv3_proto_rawDescData = protoimpl.X.CompressGZIP(file_openapiv3_OpenAPIv3_proto_rawDescData) - }) - return file_openapiv3_OpenAPIv3_proto_rawDescData -} - -var file_openapiv3_OpenAPIv3_proto_msgTypes = make([]protoimpl.MessageInfo, 78) -var file_openapiv3_OpenAPIv3_proto_goTypes = []interface{}{ - (*AdditionalPropertiesItem)(nil), // 0: openapi.v3.AdditionalPropertiesItem - (*Any)(nil), // 1: openapi.v3.Any - (*AnyOrExpression)(nil), // 2: openapi.v3.AnyOrExpression - (*Callback)(nil), // 3: openapi.v3.Callback - (*CallbackOrReference)(nil), // 4: openapi.v3.CallbackOrReference - (*CallbacksOrReferences)(nil), // 5: openapi.v3.CallbacksOrReferences - (*Components)(nil), // 6: openapi.v3.Components - (*Contact)(nil), // 7: openapi.v3.Contact - (*DefaultType)(nil), // 8: openapi.v3.DefaultType - (*Discriminator)(nil), // 9: openapi.v3.Discriminator - (*Document)(nil), // 10: openapi.v3.Document - (*Encoding)(nil), // 11: openapi.v3.Encoding - (*Encodings)(nil), // 12: openapi.v3.Encodings - (*Example)(nil), // 13: openapi.v3.Example - (*ExampleOrReference)(nil), // 14: openapi.v3.ExampleOrReference - (*ExamplesOrReferences)(nil), // 15: openapi.v3.ExamplesOrReferences - (*Expression)(nil), // 16: openapi.v3.Expression - (*ExternalDocs)(nil), // 17: openapi.v3.ExternalDocs - (*Header)(nil), // 18: openapi.v3.Header - (*HeaderOrReference)(nil), // 19: openapi.v3.HeaderOrReference - (*HeadersOrReferences)(nil), // 20: openapi.v3.HeadersOrReferences - (*Info)(nil), // 21: openapi.v3.Info - (*ItemsItem)(nil), // 22: openapi.v3.ItemsItem - (*License)(nil), // 23: openapi.v3.License - (*Link)(nil), // 24: openapi.v3.Link - (*LinkOrReference)(nil), // 25: openapi.v3.LinkOrReference - (*LinksOrReferences)(nil), // 26: openapi.v3.LinksOrReferences - (*MediaType)(nil), // 27: openapi.v3.MediaType - (*MediaTypes)(nil), // 28: openapi.v3.MediaTypes - (*NamedAny)(nil), // 29: openapi.v3.NamedAny - (*NamedCallbackOrReference)(nil), // 30: openapi.v3.NamedCallbackOrReference - (*NamedEncoding)(nil), // 31: openapi.v3.NamedEncoding - (*NamedExampleOrReference)(nil), // 32: openapi.v3.NamedExampleOrReference - (*NamedHeaderOrReference)(nil), // 33: openapi.v3.NamedHeaderOrReference - (*NamedLinkOrReference)(nil), // 34: openapi.v3.NamedLinkOrReference - (*NamedMediaType)(nil), // 35: openapi.v3.NamedMediaType - (*NamedParameterOrReference)(nil), // 36: openapi.v3.NamedParameterOrReference - (*NamedPathItem)(nil), // 37: openapi.v3.NamedPathItem - (*NamedRequestBodyOrReference)(nil), // 38: openapi.v3.NamedRequestBodyOrReference - (*NamedResponseOrReference)(nil), // 39: openapi.v3.NamedResponseOrReference - (*NamedSchemaOrReference)(nil), // 40: openapi.v3.NamedSchemaOrReference - (*NamedSecuritySchemeOrReference)(nil), // 41: openapi.v3.NamedSecuritySchemeOrReference - (*NamedServerVariable)(nil), // 42: openapi.v3.NamedServerVariable - (*NamedString)(nil), // 43: openapi.v3.NamedString - (*NamedStringArray)(nil), // 44: openapi.v3.NamedStringArray - (*OauthFlow)(nil), // 45: openapi.v3.OauthFlow - (*OauthFlows)(nil), // 46: openapi.v3.OauthFlows - (*Object)(nil), // 47: openapi.v3.Object - (*Operation)(nil), // 48: openapi.v3.Operation - (*Parameter)(nil), // 49: openapi.v3.Parameter - (*ParameterOrReference)(nil), // 50: openapi.v3.ParameterOrReference - (*ParametersOrReferences)(nil), // 51: openapi.v3.ParametersOrReferences - (*PathItem)(nil), // 52: openapi.v3.PathItem - (*Paths)(nil), // 53: openapi.v3.Paths - (*Properties)(nil), // 54: openapi.v3.Properties - (*Reference)(nil), // 55: openapi.v3.Reference - (*RequestBodiesOrReferences)(nil), // 56: openapi.v3.RequestBodiesOrReferences - (*RequestBody)(nil), // 57: openapi.v3.RequestBody - (*RequestBodyOrReference)(nil), // 58: openapi.v3.RequestBodyOrReference - (*Response)(nil), // 59: openapi.v3.Response - (*ResponseOrReference)(nil), // 60: openapi.v3.ResponseOrReference - (*Responses)(nil), // 61: openapi.v3.Responses - (*ResponsesOrReferences)(nil), // 62: openapi.v3.ResponsesOrReferences - (*Schema)(nil), // 63: openapi.v3.Schema - (*SchemaOrReference)(nil), // 64: openapi.v3.SchemaOrReference - (*SchemasOrReferences)(nil), // 65: openapi.v3.SchemasOrReferences - (*SecurityRequirement)(nil), // 66: openapi.v3.SecurityRequirement - (*SecurityScheme)(nil), // 67: openapi.v3.SecurityScheme - (*SecuritySchemeOrReference)(nil), // 68: openapi.v3.SecuritySchemeOrReference - (*SecuritySchemesOrReferences)(nil), // 69: openapi.v3.SecuritySchemesOrReferences - (*Server)(nil), // 70: openapi.v3.Server - (*ServerVariable)(nil), // 71: openapi.v3.ServerVariable - (*ServerVariables)(nil), // 72: openapi.v3.ServerVariables - (*SpecificationExtension)(nil), // 73: openapi.v3.SpecificationExtension - (*StringArray)(nil), // 74: openapi.v3.StringArray - (*Strings)(nil), // 75: openapi.v3.Strings - (*Tag)(nil), // 76: openapi.v3.Tag - (*Xml)(nil), // 77: openapi.v3.Xml - (*anypb.Any)(nil), // 78: google.protobuf.Any -} -var file_openapiv3_OpenAPIv3_proto_depIdxs = []int32{ - 64, // 0: openapi.v3.AdditionalPropertiesItem.schema_or_reference:type_name -> openapi.v3.SchemaOrReference - 78, // 1: openapi.v3.Any.value:type_name -> google.protobuf.Any - 1, // 2: openapi.v3.AnyOrExpression.any:type_name -> openapi.v3.Any - 16, // 3: openapi.v3.AnyOrExpression.expression:type_name -> openapi.v3.Expression - 37, // 4: openapi.v3.Callback.path:type_name -> openapi.v3.NamedPathItem - 29, // 5: openapi.v3.Callback.specification_extension:type_name -> openapi.v3.NamedAny - 3, // 6: openapi.v3.CallbackOrReference.callback:type_name -> openapi.v3.Callback - 55, // 7: openapi.v3.CallbackOrReference.reference:type_name -> openapi.v3.Reference - 30, // 8: openapi.v3.CallbacksOrReferences.additional_properties:type_name -> openapi.v3.NamedCallbackOrReference - 65, // 9: openapi.v3.Components.schemas:type_name -> openapi.v3.SchemasOrReferences - 62, // 10: openapi.v3.Components.responses:type_name -> openapi.v3.ResponsesOrReferences - 51, // 11: openapi.v3.Components.parameters:type_name -> openapi.v3.ParametersOrReferences - 15, // 12: openapi.v3.Components.examples:type_name -> openapi.v3.ExamplesOrReferences - 56, // 13: openapi.v3.Components.request_bodies:type_name -> openapi.v3.RequestBodiesOrReferences - 20, // 14: openapi.v3.Components.headers:type_name -> openapi.v3.HeadersOrReferences - 69, // 15: openapi.v3.Components.security_schemes:type_name -> openapi.v3.SecuritySchemesOrReferences - 26, // 16: openapi.v3.Components.links:type_name -> openapi.v3.LinksOrReferences - 5, // 17: openapi.v3.Components.callbacks:type_name -> openapi.v3.CallbacksOrReferences - 29, // 18: openapi.v3.Components.specification_extension:type_name -> openapi.v3.NamedAny - 29, // 19: openapi.v3.Contact.specification_extension:type_name -> openapi.v3.NamedAny - 75, // 20: openapi.v3.Discriminator.mapping:type_name -> openapi.v3.Strings - 29, // 21: openapi.v3.Discriminator.specification_extension:type_name -> openapi.v3.NamedAny - 21, // 22: openapi.v3.Document.info:type_name -> openapi.v3.Info - 70, // 23: openapi.v3.Document.servers:type_name -> openapi.v3.Server - 53, // 24: openapi.v3.Document.paths:type_name -> openapi.v3.Paths - 6, // 25: openapi.v3.Document.components:type_name -> openapi.v3.Components - 66, // 26: openapi.v3.Document.security:type_name -> openapi.v3.SecurityRequirement - 76, // 27: openapi.v3.Document.tags:type_name -> openapi.v3.Tag - 17, // 28: openapi.v3.Document.external_docs:type_name -> openapi.v3.ExternalDocs - 29, // 29: openapi.v3.Document.specification_extension:type_name -> openapi.v3.NamedAny - 20, // 30: openapi.v3.Encoding.headers:type_name -> openapi.v3.HeadersOrReferences - 29, // 31: openapi.v3.Encoding.specification_extension:type_name -> openapi.v3.NamedAny - 31, // 32: openapi.v3.Encodings.additional_properties:type_name -> openapi.v3.NamedEncoding - 1, // 33: openapi.v3.Example.value:type_name -> openapi.v3.Any - 29, // 34: openapi.v3.Example.specification_extension:type_name -> openapi.v3.NamedAny - 13, // 35: openapi.v3.ExampleOrReference.example:type_name -> openapi.v3.Example - 55, // 36: openapi.v3.ExampleOrReference.reference:type_name -> openapi.v3.Reference - 32, // 37: openapi.v3.ExamplesOrReferences.additional_properties:type_name -> openapi.v3.NamedExampleOrReference - 29, // 38: openapi.v3.Expression.additional_properties:type_name -> openapi.v3.NamedAny - 29, // 39: openapi.v3.ExternalDocs.specification_extension:type_name -> openapi.v3.NamedAny - 64, // 40: openapi.v3.Header.schema:type_name -> openapi.v3.SchemaOrReference - 1, // 41: openapi.v3.Header.example:type_name -> openapi.v3.Any - 15, // 42: openapi.v3.Header.examples:type_name -> openapi.v3.ExamplesOrReferences - 28, // 43: openapi.v3.Header.content:type_name -> openapi.v3.MediaTypes - 29, // 44: openapi.v3.Header.specification_extension:type_name -> openapi.v3.NamedAny - 18, // 45: openapi.v3.HeaderOrReference.header:type_name -> openapi.v3.Header - 55, // 46: openapi.v3.HeaderOrReference.reference:type_name -> openapi.v3.Reference - 33, // 47: openapi.v3.HeadersOrReferences.additional_properties:type_name -> openapi.v3.NamedHeaderOrReference - 7, // 48: openapi.v3.Info.contact:type_name -> openapi.v3.Contact - 23, // 49: openapi.v3.Info.license:type_name -> openapi.v3.License - 29, // 50: openapi.v3.Info.specification_extension:type_name -> openapi.v3.NamedAny - 64, // 51: openapi.v3.ItemsItem.schema_or_reference:type_name -> openapi.v3.SchemaOrReference - 29, // 52: openapi.v3.License.specification_extension:type_name -> openapi.v3.NamedAny - 2, // 53: openapi.v3.Link.parameters:type_name -> openapi.v3.AnyOrExpression - 2, // 54: openapi.v3.Link.request_body:type_name -> openapi.v3.AnyOrExpression - 70, // 55: openapi.v3.Link.server:type_name -> openapi.v3.Server - 29, // 56: openapi.v3.Link.specification_extension:type_name -> openapi.v3.NamedAny - 24, // 57: openapi.v3.LinkOrReference.link:type_name -> openapi.v3.Link - 55, // 58: openapi.v3.LinkOrReference.reference:type_name -> openapi.v3.Reference - 34, // 59: openapi.v3.LinksOrReferences.additional_properties:type_name -> openapi.v3.NamedLinkOrReference - 64, // 60: openapi.v3.MediaType.schema:type_name -> openapi.v3.SchemaOrReference - 1, // 61: openapi.v3.MediaType.example:type_name -> openapi.v3.Any - 15, // 62: openapi.v3.MediaType.examples:type_name -> openapi.v3.ExamplesOrReferences - 12, // 63: openapi.v3.MediaType.encoding:type_name -> openapi.v3.Encodings - 29, // 64: openapi.v3.MediaType.specification_extension:type_name -> openapi.v3.NamedAny - 35, // 65: openapi.v3.MediaTypes.additional_properties:type_name -> openapi.v3.NamedMediaType - 1, // 66: openapi.v3.NamedAny.value:type_name -> openapi.v3.Any - 4, // 67: openapi.v3.NamedCallbackOrReference.value:type_name -> openapi.v3.CallbackOrReference - 11, // 68: openapi.v3.NamedEncoding.value:type_name -> openapi.v3.Encoding - 14, // 69: openapi.v3.NamedExampleOrReference.value:type_name -> openapi.v3.ExampleOrReference - 19, // 70: openapi.v3.NamedHeaderOrReference.value:type_name -> openapi.v3.HeaderOrReference - 25, // 71: openapi.v3.NamedLinkOrReference.value:type_name -> openapi.v3.LinkOrReference - 27, // 72: openapi.v3.NamedMediaType.value:type_name -> openapi.v3.MediaType - 50, // 73: openapi.v3.NamedParameterOrReference.value:type_name -> openapi.v3.ParameterOrReference - 52, // 74: openapi.v3.NamedPathItem.value:type_name -> openapi.v3.PathItem - 58, // 75: openapi.v3.NamedRequestBodyOrReference.value:type_name -> openapi.v3.RequestBodyOrReference - 60, // 76: openapi.v3.NamedResponseOrReference.value:type_name -> openapi.v3.ResponseOrReference - 64, // 77: openapi.v3.NamedSchemaOrReference.value:type_name -> openapi.v3.SchemaOrReference - 68, // 78: openapi.v3.NamedSecuritySchemeOrReference.value:type_name -> openapi.v3.SecuritySchemeOrReference - 71, // 79: openapi.v3.NamedServerVariable.value:type_name -> openapi.v3.ServerVariable - 74, // 80: openapi.v3.NamedStringArray.value:type_name -> openapi.v3.StringArray - 75, // 81: openapi.v3.OauthFlow.scopes:type_name -> openapi.v3.Strings - 29, // 82: openapi.v3.OauthFlow.specification_extension:type_name -> openapi.v3.NamedAny - 45, // 83: openapi.v3.OauthFlows.implicit:type_name -> openapi.v3.OauthFlow - 45, // 84: openapi.v3.OauthFlows.password:type_name -> openapi.v3.OauthFlow - 45, // 85: openapi.v3.OauthFlows.client_credentials:type_name -> openapi.v3.OauthFlow - 45, // 86: openapi.v3.OauthFlows.authorization_code:type_name -> openapi.v3.OauthFlow - 29, // 87: openapi.v3.OauthFlows.specification_extension:type_name -> openapi.v3.NamedAny - 29, // 88: openapi.v3.Object.additional_properties:type_name -> openapi.v3.NamedAny - 17, // 89: openapi.v3.Operation.external_docs:type_name -> openapi.v3.ExternalDocs - 50, // 90: openapi.v3.Operation.parameters:type_name -> openapi.v3.ParameterOrReference - 58, // 91: openapi.v3.Operation.request_body:type_name -> openapi.v3.RequestBodyOrReference - 61, // 92: openapi.v3.Operation.responses:type_name -> openapi.v3.Responses - 5, // 93: openapi.v3.Operation.callbacks:type_name -> openapi.v3.CallbacksOrReferences - 66, // 94: openapi.v3.Operation.security:type_name -> openapi.v3.SecurityRequirement - 70, // 95: openapi.v3.Operation.servers:type_name -> openapi.v3.Server - 29, // 96: openapi.v3.Operation.specification_extension:type_name -> openapi.v3.NamedAny - 64, // 97: openapi.v3.Parameter.schema:type_name -> openapi.v3.SchemaOrReference - 1, // 98: openapi.v3.Parameter.example:type_name -> openapi.v3.Any - 15, // 99: openapi.v3.Parameter.examples:type_name -> openapi.v3.ExamplesOrReferences - 28, // 100: openapi.v3.Parameter.content:type_name -> openapi.v3.MediaTypes - 29, // 101: openapi.v3.Parameter.specification_extension:type_name -> openapi.v3.NamedAny - 49, // 102: openapi.v3.ParameterOrReference.parameter:type_name -> openapi.v3.Parameter - 55, // 103: openapi.v3.ParameterOrReference.reference:type_name -> openapi.v3.Reference - 36, // 104: openapi.v3.ParametersOrReferences.additional_properties:type_name -> openapi.v3.NamedParameterOrReference - 48, // 105: openapi.v3.PathItem.get:type_name -> openapi.v3.Operation - 48, // 106: openapi.v3.PathItem.put:type_name -> openapi.v3.Operation - 48, // 107: openapi.v3.PathItem.post:type_name -> openapi.v3.Operation - 48, // 108: openapi.v3.PathItem.delete:type_name -> openapi.v3.Operation - 48, // 109: openapi.v3.PathItem.options:type_name -> openapi.v3.Operation - 48, // 110: openapi.v3.PathItem.head:type_name -> openapi.v3.Operation - 48, // 111: openapi.v3.PathItem.patch:type_name -> openapi.v3.Operation - 48, // 112: openapi.v3.PathItem.trace:type_name -> openapi.v3.Operation - 70, // 113: openapi.v3.PathItem.servers:type_name -> openapi.v3.Server - 50, // 114: openapi.v3.PathItem.parameters:type_name -> openapi.v3.ParameterOrReference - 29, // 115: openapi.v3.PathItem.specification_extension:type_name -> openapi.v3.NamedAny - 37, // 116: openapi.v3.Paths.path:type_name -> openapi.v3.NamedPathItem - 29, // 117: openapi.v3.Paths.specification_extension:type_name -> openapi.v3.NamedAny - 40, // 118: openapi.v3.Properties.additional_properties:type_name -> openapi.v3.NamedSchemaOrReference - 38, // 119: openapi.v3.RequestBodiesOrReferences.additional_properties:type_name -> openapi.v3.NamedRequestBodyOrReference - 28, // 120: openapi.v3.RequestBody.content:type_name -> openapi.v3.MediaTypes - 29, // 121: openapi.v3.RequestBody.specification_extension:type_name -> openapi.v3.NamedAny - 57, // 122: openapi.v3.RequestBodyOrReference.request_body:type_name -> openapi.v3.RequestBody - 55, // 123: openapi.v3.RequestBodyOrReference.reference:type_name -> openapi.v3.Reference - 20, // 124: openapi.v3.Response.headers:type_name -> openapi.v3.HeadersOrReferences - 28, // 125: openapi.v3.Response.content:type_name -> openapi.v3.MediaTypes - 26, // 126: openapi.v3.Response.links:type_name -> openapi.v3.LinksOrReferences - 29, // 127: openapi.v3.Response.specification_extension:type_name -> openapi.v3.NamedAny - 59, // 128: openapi.v3.ResponseOrReference.response:type_name -> openapi.v3.Response - 55, // 129: openapi.v3.ResponseOrReference.reference:type_name -> openapi.v3.Reference - 60, // 130: openapi.v3.Responses.default:type_name -> openapi.v3.ResponseOrReference - 39, // 131: openapi.v3.Responses.response_or_reference:type_name -> openapi.v3.NamedResponseOrReference - 29, // 132: openapi.v3.Responses.specification_extension:type_name -> openapi.v3.NamedAny - 39, // 133: openapi.v3.ResponsesOrReferences.additional_properties:type_name -> openapi.v3.NamedResponseOrReference - 9, // 134: openapi.v3.Schema.discriminator:type_name -> openapi.v3.Discriminator - 77, // 135: openapi.v3.Schema.xml:type_name -> openapi.v3.Xml - 17, // 136: openapi.v3.Schema.external_docs:type_name -> openapi.v3.ExternalDocs - 1, // 137: openapi.v3.Schema.example:type_name -> openapi.v3.Any - 1, // 138: openapi.v3.Schema.enum:type_name -> openapi.v3.Any - 64, // 139: openapi.v3.Schema.all_of:type_name -> openapi.v3.SchemaOrReference - 64, // 140: openapi.v3.Schema.one_of:type_name -> openapi.v3.SchemaOrReference - 64, // 141: openapi.v3.Schema.any_of:type_name -> openapi.v3.SchemaOrReference - 63, // 142: openapi.v3.Schema.not:type_name -> openapi.v3.Schema - 22, // 143: openapi.v3.Schema.items:type_name -> openapi.v3.ItemsItem - 54, // 144: openapi.v3.Schema.properties:type_name -> openapi.v3.Properties - 0, // 145: openapi.v3.Schema.additional_properties:type_name -> openapi.v3.AdditionalPropertiesItem - 8, // 146: openapi.v3.Schema.default:type_name -> openapi.v3.DefaultType - 29, // 147: openapi.v3.Schema.specification_extension:type_name -> openapi.v3.NamedAny - 63, // 148: openapi.v3.SchemaOrReference.schema:type_name -> openapi.v3.Schema - 55, // 149: openapi.v3.SchemaOrReference.reference:type_name -> openapi.v3.Reference - 40, // 150: openapi.v3.SchemasOrReferences.additional_properties:type_name -> openapi.v3.NamedSchemaOrReference - 44, // 151: openapi.v3.SecurityRequirement.additional_properties:type_name -> openapi.v3.NamedStringArray - 46, // 152: openapi.v3.SecurityScheme.flows:type_name -> openapi.v3.OauthFlows - 29, // 153: openapi.v3.SecurityScheme.specification_extension:type_name -> openapi.v3.NamedAny - 67, // 154: openapi.v3.SecuritySchemeOrReference.security_scheme:type_name -> openapi.v3.SecurityScheme - 55, // 155: openapi.v3.SecuritySchemeOrReference.reference:type_name -> openapi.v3.Reference - 41, // 156: openapi.v3.SecuritySchemesOrReferences.additional_properties:type_name -> openapi.v3.NamedSecuritySchemeOrReference - 72, // 157: openapi.v3.Server.variables:type_name -> openapi.v3.ServerVariables - 29, // 158: openapi.v3.Server.specification_extension:type_name -> openapi.v3.NamedAny - 29, // 159: openapi.v3.ServerVariable.specification_extension:type_name -> openapi.v3.NamedAny - 42, // 160: openapi.v3.ServerVariables.additional_properties:type_name -> openapi.v3.NamedServerVariable - 43, // 161: openapi.v3.Strings.additional_properties:type_name -> openapi.v3.NamedString - 17, // 162: openapi.v3.Tag.external_docs:type_name -> openapi.v3.ExternalDocs - 29, // 163: openapi.v3.Tag.specification_extension:type_name -> openapi.v3.NamedAny - 29, // 164: openapi.v3.Xml.specification_extension:type_name -> openapi.v3.NamedAny - 165, // [165:165] is the sub-list for method output_type - 165, // [165:165] is the sub-list for method input_type - 165, // [165:165] is the sub-list for extension type_name - 165, // [165:165] is the sub-list for extension extendee - 0, // [0:165] is the sub-list for field type_name -} - -func init() { file_openapiv3_OpenAPIv3_proto_init() } -func file_openapiv3_OpenAPIv3_proto_init() { - if File_openapiv3_OpenAPIv3_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_openapiv3_OpenAPIv3_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdditionalPropertiesItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Any); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AnyOrExpression); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Callback); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallbackOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallbacksOrReferences); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Components); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Contact); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DefaultType); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Discriminator); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Document); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Encoding); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Encodings); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Example); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExampleOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExamplesOrReferences); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Expression); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExternalDocs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Header); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HeaderOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HeadersOrReferences); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ItemsItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*License); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Link); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LinkOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LinksOrReferences); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MediaType); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MediaTypes); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedAny); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedCallbackOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedEncoding); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedExampleOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedHeaderOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedLinkOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedMediaType); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedParameterOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedPathItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedRequestBodyOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedResponseOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedSchemaOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedSecuritySchemeOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedServerVariable); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedString); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedStringArray); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*OauthFlow); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*OauthFlows); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Object); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Operation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Parameter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[50].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParameterOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[51].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParametersOrReferences); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[52].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PathItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[53].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Paths); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[54].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Properties); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[55].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Reference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[56].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RequestBodiesOrReferences); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[57].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RequestBody); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[58].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RequestBodyOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[59].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Response); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[60].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResponseOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[61].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Responses); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[62].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResponsesOrReferences); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[63].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Schema); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[64].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SchemaOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[65].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SchemasOrReferences); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[66].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SecurityRequirement); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[67].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SecurityScheme); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[68].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SecuritySchemeOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[69].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SecuritySchemesOrReferences); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[70].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Server); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[71].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServerVariable); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[72].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServerVariables); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[73].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SpecificationExtension); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[74].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StringArray); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[75].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Strings); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[76].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Tag); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[77].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Xml); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*AdditionalPropertiesItem_SchemaOrReference)(nil), - (*AdditionalPropertiesItem_Boolean)(nil), - } - file_openapiv3_OpenAPIv3_proto_msgTypes[2].OneofWrappers = []interface{}{ - (*AnyOrExpression_Any)(nil), - (*AnyOrExpression_Expression)(nil), - } - file_openapiv3_OpenAPIv3_proto_msgTypes[4].OneofWrappers = []interface{}{ - (*CallbackOrReference_Callback)(nil), - (*CallbackOrReference_Reference)(nil), - } - file_openapiv3_OpenAPIv3_proto_msgTypes[8].OneofWrappers = []interface{}{ - (*DefaultType_Number)(nil), - (*DefaultType_Boolean)(nil), - (*DefaultType_String_)(nil), - } - file_openapiv3_OpenAPIv3_proto_msgTypes[14].OneofWrappers = []interface{}{ - (*ExampleOrReference_Example)(nil), - (*ExampleOrReference_Reference)(nil), - } - file_openapiv3_OpenAPIv3_proto_msgTypes[19].OneofWrappers = []interface{}{ - (*HeaderOrReference_Header)(nil), - (*HeaderOrReference_Reference)(nil), - } - file_openapiv3_OpenAPIv3_proto_msgTypes[25].OneofWrappers = []interface{}{ - (*LinkOrReference_Link)(nil), - (*LinkOrReference_Reference)(nil), - } - file_openapiv3_OpenAPIv3_proto_msgTypes[50].OneofWrappers = []interface{}{ - (*ParameterOrReference_Parameter)(nil), - (*ParameterOrReference_Reference)(nil), - } - file_openapiv3_OpenAPIv3_proto_msgTypes[58].OneofWrappers = []interface{}{ - (*RequestBodyOrReference_RequestBody)(nil), - (*RequestBodyOrReference_Reference)(nil), - } - file_openapiv3_OpenAPIv3_proto_msgTypes[60].OneofWrappers = []interface{}{ - (*ResponseOrReference_Response)(nil), - (*ResponseOrReference_Reference)(nil), - } - file_openapiv3_OpenAPIv3_proto_msgTypes[64].OneofWrappers = []interface{}{ - (*SchemaOrReference_Schema)(nil), - (*SchemaOrReference_Reference)(nil), - } - file_openapiv3_OpenAPIv3_proto_msgTypes[68].OneofWrappers = []interface{}{ - (*SecuritySchemeOrReference_SecurityScheme)(nil), - (*SecuritySchemeOrReference_Reference)(nil), - } - file_openapiv3_OpenAPIv3_proto_msgTypes[73].OneofWrappers = []interface{}{ - (*SpecificationExtension_Number)(nil), - (*SpecificationExtension_Boolean)(nil), - (*SpecificationExtension_String_)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_openapiv3_OpenAPIv3_proto_rawDesc, - NumEnums: 0, - NumMessages: 78, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_openapiv3_OpenAPIv3_proto_goTypes, - DependencyIndexes: file_openapiv3_OpenAPIv3_proto_depIdxs, - MessageInfos: file_openapiv3_OpenAPIv3_proto_msgTypes, - }.Build() - File_openapiv3_OpenAPIv3_proto = out.File - file_openapiv3_OpenAPIv3_proto_rawDesc = nil - file_openapiv3_OpenAPIv3_proto_goTypes = nil - file_openapiv3_OpenAPIv3_proto_depIdxs = nil -} diff --git a/vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.proto b/vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.proto deleted file mode 100644 index 1be335b89..000000000 --- a/vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.proto +++ /dev/null @@ -1,672 +0,0 @@ -// Copyright 2020 Google LLC. All Rights Reserved. -// -// 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. - -// THIS FILE IS AUTOMATICALLY GENERATED. - -syntax = "proto3"; - -package openapi.v3; - -import "google/protobuf/any.proto"; - -// This option lets the proto compiler generate Java code inside the package -// name (see below) instead of inside an outer class. It creates a simpler -// developer experience by reducing one-level of name nesting and be -// consistent with most programming languages that don't support outer classes. -option java_multiple_files = true; - -// The Java outer classname should be the filename in UpperCamelCase. This -// class is only used to hold proto descriptor, so developers don't need to -// work with it directly. -option java_outer_classname = "OpenAPIProto"; - -// The Java package name must be proto package name with proper prefix. -option java_package = "org.openapi_v3"; - -// A reasonable prefix for the Objective-C symbols generated from the package. -// It should at a minimum be 3 characters long, all uppercase, and convention -// is to use an abbreviation of the package name. Something short, but -// hopefully unique enough to not conflict with things that may come along in -// the future. 'GPB' is reserved for the protocol buffer implementation itself. -option objc_class_prefix = "OAS"; - -// The Go package name. -option go_package = "./openapiv3;openapi_v3"; - -message AdditionalPropertiesItem { - oneof oneof { - SchemaOrReference schema_or_reference = 1; - bool boolean = 2; - } -} - -message Any { - google.protobuf.Any value = 1; - string yaml = 2; -} - -message AnyOrExpression { - oneof oneof { - Any any = 1; - Expression expression = 2; - } -} - -// A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. -message Callback { - repeated NamedPathItem path = 1; - repeated NamedAny specification_extension = 2; -} - -message CallbackOrReference { - oneof oneof { - Callback callback = 1; - Reference reference = 2; - } -} - -message CallbacksOrReferences { - repeated NamedCallbackOrReference additional_properties = 1; -} - -// Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object. -message Components { - SchemasOrReferences schemas = 1; - ResponsesOrReferences responses = 2; - ParametersOrReferences parameters = 3; - ExamplesOrReferences examples = 4; - RequestBodiesOrReferences request_bodies = 5; - HeadersOrReferences headers = 6; - SecuritySchemesOrReferences security_schemes = 7; - LinksOrReferences links = 8; - CallbacksOrReferences callbacks = 9; - repeated NamedAny specification_extension = 10; -} - -// Contact information for the exposed API. -message Contact { - string name = 1; - string url = 2; - string email = 3; - repeated NamedAny specification_extension = 4; -} - -message DefaultType { - oneof oneof { - double number = 1; - bool boolean = 2; - string string = 3; - } -} - -// When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it. When using the discriminator, _inline_ schemas will not be considered. -message Discriminator { - string property_name = 1; - Strings mapping = 2; - repeated NamedAny specification_extension = 3; -} - -message Document { - string openapi = 1; - Info info = 2; - repeated Server servers = 3; - Paths paths = 4; - Components components = 5; - repeated SecurityRequirement security = 6; - repeated Tag tags = 7; - ExternalDocs external_docs = 8; - repeated NamedAny specification_extension = 9; -} - -// A single encoding definition applied to a single schema property. -message Encoding { - string content_type = 1; - HeadersOrReferences headers = 2; - string style = 3; - bool explode = 4; - bool allow_reserved = 5; - repeated NamedAny specification_extension = 6; -} - -message Encodings { - repeated NamedEncoding additional_properties = 1; -} - -message Example { - string summary = 1; - string description = 2; - Any value = 3; - string external_value = 4; - repeated NamedAny specification_extension = 5; -} - -message ExampleOrReference { - oneof oneof { - Example example = 1; - Reference reference = 2; - } -} - -message ExamplesOrReferences { - repeated NamedExampleOrReference additional_properties = 1; -} - -message Expression { - repeated NamedAny additional_properties = 1; -} - -// Allows referencing an external resource for extended documentation. -message ExternalDocs { - string description = 1; - string url = 2; - repeated NamedAny specification_extension = 3; -} - -// The Header Object follows the structure of the Parameter Object with the following changes: 1. `name` MUST NOT be specified, it is given in the corresponding `headers` map. 1. `in` MUST NOT be specified, it is implicitly in `header`. 1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, `style`). -message Header { - string description = 1; - bool required = 2; - bool deprecated = 3; - bool allow_empty_value = 4; - string style = 5; - bool explode = 6; - bool allow_reserved = 7; - SchemaOrReference schema = 8; - Any example = 9; - ExamplesOrReferences examples = 10; - MediaTypes content = 11; - repeated NamedAny specification_extension = 12; -} - -message HeaderOrReference { - oneof oneof { - Header header = 1; - Reference reference = 2; - } -} - -message HeadersOrReferences { - repeated NamedHeaderOrReference additional_properties = 1; -} - -// The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience. -message Info { - string title = 1; - string description = 2; - string terms_of_service = 3; - Contact contact = 4; - License license = 5; - string version = 6; - repeated NamedAny specification_extension = 7; - string summary = 8; -} - -message ItemsItem { - repeated SchemaOrReference schema_or_reference = 1; -} - -// License information for the exposed API. -message License { - string name = 1; - string url = 2; - repeated NamedAny specification_extension = 3; -} - -// The `Link object` represents a possible design-time link for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. Unlike _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require link information in the runtime response. For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation. -message Link { - string operation_ref = 1; - string operation_id = 2; - AnyOrExpression parameters = 3; - AnyOrExpression request_body = 4; - string description = 5; - Server server = 6; - repeated NamedAny specification_extension = 7; -} - -message LinkOrReference { - oneof oneof { - Link link = 1; - Reference reference = 2; - } -} - -message LinksOrReferences { - repeated NamedLinkOrReference additional_properties = 1; -} - -// Each Media Type Object provides schema and examples for the media type identified by its key. -message MediaType { - SchemaOrReference schema = 1; - Any example = 2; - ExamplesOrReferences examples = 3; - Encodings encoding = 4; - repeated NamedAny specification_extension = 5; -} - -message MediaTypes { - repeated NamedMediaType additional_properties = 1; -} - -// Automatically-generated message used to represent maps of Any as ordered (name,value) pairs. -message NamedAny { - // Map key - string name = 1; - // Mapped value - Any value = 2; -} - -// Automatically-generated message used to represent maps of CallbackOrReference as ordered (name,value) pairs. -message NamedCallbackOrReference { - // Map key - string name = 1; - // Mapped value - CallbackOrReference value = 2; -} - -// Automatically-generated message used to represent maps of Encoding as ordered (name,value) pairs. -message NamedEncoding { - // Map key - string name = 1; - // Mapped value - Encoding value = 2; -} - -// Automatically-generated message used to represent maps of ExampleOrReference as ordered (name,value) pairs. -message NamedExampleOrReference { - // Map key - string name = 1; - // Mapped value - ExampleOrReference value = 2; -} - -// Automatically-generated message used to represent maps of HeaderOrReference as ordered (name,value) pairs. -message NamedHeaderOrReference { - // Map key - string name = 1; - // Mapped value - HeaderOrReference value = 2; -} - -// Automatically-generated message used to represent maps of LinkOrReference as ordered (name,value) pairs. -message NamedLinkOrReference { - // Map key - string name = 1; - // Mapped value - LinkOrReference value = 2; -} - -// Automatically-generated message used to represent maps of MediaType as ordered (name,value) pairs. -message NamedMediaType { - // Map key - string name = 1; - // Mapped value - MediaType value = 2; -} - -// Automatically-generated message used to represent maps of ParameterOrReference as ordered (name,value) pairs. -message NamedParameterOrReference { - // Map key - string name = 1; - // Mapped value - ParameterOrReference value = 2; -} - -// Automatically-generated message used to represent maps of PathItem as ordered (name,value) pairs. -message NamedPathItem { - // Map key - string name = 1; - // Mapped value - PathItem value = 2; -} - -// Automatically-generated message used to represent maps of RequestBodyOrReference as ordered (name,value) pairs. -message NamedRequestBodyOrReference { - // Map key - string name = 1; - // Mapped value - RequestBodyOrReference value = 2; -} - -// Automatically-generated message used to represent maps of ResponseOrReference as ordered (name,value) pairs. -message NamedResponseOrReference { - // Map key - string name = 1; - // Mapped value - ResponseOrReference value = 2; -} - -// Automatically-generated message used to represent maps of SchemaOrReference as ordered (name,value) pairs. -message NamedSchemaOrReference { - // Map key - string name = 1; - // Mapped value - SchemaOrReference value = 2; -} - -// Automatically-generated message used to represent maps of SecuritySchemeOrReference as ordered (name,value) pairs. -message NamedSecuritySchemeOrReference { - // Map key - string name = 1; - // Mapped value - SecuritySchemeOrReference value = 2; -} - -// Automatically-generated message used to represent maps of ServerVariable as ordered (name,value) pairs. -message NamedServerVariable { - // Map key - string name = 1; - // Mapped value - ServerVariable value = 2; -} - -// Automatically-generated message used to represent maps of string as ordered (name,value) pairs. -message NamedString { - // Map key - string name = 1; - // Mapped value - string value = 2; -} - -// Automatically-generated message used to represent maps of StringArray as ordered (name,value) pairs. -message NamedStringArray { - // Map key - string name = 1; - // Mapped value - StringArray value = 2; -} - -// Configuration details for a supported OAuth Flow -message OauthFlow { - string authorization_url = 1; - string token_url = 2; - string refresh_url = 3; - Strings scopes = 4; - repeated NamedAny specification_extension = 5; -} - -// Allows configuration of the supported OAuth Flows. -message OauthFlows { - OauthFlow implicit = 1; - OauthFlow password = 2; - OauthFlow client_credentials = 3; - OauthFlow authorization_code = 4; - repeated NamedAny specification_extension = 5; -} - -message Object { - repeated NamedAny additional_properties = 1; -} - -// Describes a single API operation on a path. -message Operation { - repeated string tags = 1; - string summary = 2; - string description = 3; - ExternalDocs external_docs = 4; - string operation_id = 5; - repeated ParameterOrReference parameters = 6; - RequestBodyOrReference request_body = 7; - Responses responses = 8; - CallbacksOrReferences callbacks = 9; - bool deprecated = 10; - repeated SecurityRequirement security = 11; - repeated Server servers = 12; - repeated NamedAny specification_extension = 13; -} - -// Describes a single operation parameter. A unique parameter is defined by a combination of a name and location. -message Parameter { - string name = 1; - string in = 2; - string description = 3; - bool required = 4; - bool deprecated = 5; - bool allow_empty_value = 6; - string style = 7; - bool explode = 8; - bool allow_reserved = 9; - SchemaOrReference schema = 10; - Any example = 11; - ExamplesOrReferences examples = 12; - MediaTypes content = 13; - repeated NamedAny specification_extension = 14; -} - -message ParameterOrReference { - oneof oneof { - Parameter parameter = 1; - Reference reference = 2; - } -} - -message ParametersOrReferences { - repeated NamedParameterOrReference additional_properties = 1; -} - -// Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available. -message PathItem { - string _ref = 1; - string summary = 2; - string description = 3; - Operation get = 4; - Operation put = 5; - Operation post = 6; - Operation delete = 7; - Operation options = 8; - Operation head = 9; - Operation patch = 10; - Operation trace = 11; - repeated Server servers = 12; - repeated ParameterOrReference parameters = 13; - repeated NamedAny specification_extension = 14; -} - -// Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the `Server Object` in order to construct the full URL. The Paths MAY be empty, due to ACL constraints. -message Paths { - repeated NamedPathItem path = 1; - repeated NamedAny specification_extension = 2; -} - -message Properties { - repeated NamedSchemaOrReference additional_properties = 1; -} - -// A simple object to allow referencing other components in the specification, internally and externally. The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules. For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification. -message Reference { - string _ref = 1; - string summary = 2; - string description = 3; -} - -message RequestBodiesOrReferences { - repeated NamedRequestBodyOrReference additional_properties = 1; -} - -// Describes a single request body. -message RequestBody { - string description = 1; - MediaTypes content = 2; - bool required = 3; - repeated NamedAny specification_extension = 4; -} - -message RequestBodyOrReference { - oneof oneof { - RequestBody request_body = 1; - Reference reference = 2; - } -} - -// Describes a single response from an API Operation, including design-time, static `links` to operations based on the response. -message Response { - string description = 1; - HeadersOrReferences headers = 2; - MediaTypes content = 3; - LinksOrReferences links = 4; - repeated NamedAny specification_extension = 5; -} - -message ResponseOrReference { - oneof oneof { - Response response = 1; - Reference reference = 2; - } -} - -// A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. However, documentation is expected to cover a successful operation response and any known errors. The `default` MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. The `Responses Object` MUST contain at least one response code, and it SHOULD be the response for a successful operation call. -message Responses { - ResponseOrReference default = 1; - repeated NamedResponseOrReference response_or_reference = 2; - repeated NamedAny specification_extension = 3; -} - -message ResponsesOrReferences { - repeated NamedResponseOrReference additional_properties = 1; -} - -// The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is an extended subset of the JSON Schema Specification Wright Draft 00. For more information about the properties, see JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema. -message Schema { - bool nullable = 1; - Discriminator discriminator = 2; - bool read_only = 3; - bool write_only = 4; - Xml xml = 5; - ExternalDocs external_docs = 6; - Any example = 7; - bool deprecated = 8; - string title = 9; - double multiple_of = 10; - double maximum = 11; - bool exclusive_maximum = 12; - double minimum = 13; - bool exclusive_minimum = 14; - int64 max_length = 15; - int64 min_length = 16; - string pattern = 17; - int64 max_items = 18; - int64 min_items = 19; - bool unique_items = 20; - int64 max_properties = 21; - int64 min_properties = 22; - repeated string required = 23; - repeated Any enum = 24; - string type = 25; - repeated SchemaOrReference all_of = 26; - repeated SchemaOrReference one_of = 27; - repeated SchemaOrReference any_of = 28; - Schema not = 29; - ItemsItem items = 30; - Properties properties = 31; - AdditionalPropertiesItem additional_properties = 32; - DefaultType default = 33; - string description = 34; - string format = 35; - repeated NamedAny specification_extension = 36; -} - -message SchemaOrReference { - oneof oneof { - Schema schema = 1; - Reference reference = 2; - } -} - -message SchemasOrReferences { - repeated NamedSchemaOrReference additional_properties = 1; -} - -// Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object. Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information. When a list of Security Requirement Objects is defined on the OpenAPI Object or Operation Object, only one of the Security Requirement Objects in the list needs to be satisfied to authorize the request. -message SecurityRequirement { - repeated NamedStringArray additional_properties = 1; -} - -// Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header, a cookie parameter or as a query parameter), mutual TLS (use of a client certificate), OAuth2's common flows (implicit, password, application and access code) as defined in RFC6749, and OpenID Connect. Please note that currently (2019) the implicit flow is about to be deprecated OAuth 2.0 Security Best Current Practice. Recommended for most use case is Authorization Code Grant flow with PKCE. -message SecurityScheme { - string type = 1; - string description = 2; - string name = 3; - string in = 4; - string scheme = 5; - string bearer_format = 6; - OauthFlows flows = 7; - string open_id_connect_url = 8; - repeated NamedAny specification_extension = 9; -} - -message SecuritySchemeOrReference { - oneof oneof { - SecurityScheme security_scheme = 1; - Reference reference = 2; - } -} - -message SecuritySchemesOrReferences { - repeated NamedSecuritySchemeOrReference additional_properties = 1; -} - -// An object representing a Server. -message Server { - string url = 1; - string description = 2; - ServerVariables variables = 3; - repeated NamedAny specification_extension = 4; -} - -// An object representing a Server Variable for server URL template substitution. -message ServerVariable { - repeated string enum = 1; - string default = 2; - string description = 3; - repeated NamedAny specification_extension = 4; -} - -message ServerVariables { - repeated NamedServerVariable additional_properties = 1; -} - -// Any property starting with x- is valid. -message SpecificationExtension { - oneof oneof { - double number = 1; - bool boolean = 2; - string string = 3; - } -} - -message StringArray { - repeated string value = 1; -} - -message Strings { - repeated NamedString additional_properties = 1; -} - -// Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances. -message Tag { - string name = 1; - string description = 2; - ExternalDocs external_docs = 3; - repeated NamedAny specification_extension = 4; -} - -// A metadata object that allows for more fine-tuned XML model definitions. When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property SHOULD be used to add that information. See examples for expected behavior. -message Xml { - string name = 1; - string namespace = 2; - string prefix = 3; - bool attribute = 4; - bool wrapped = 5; - repeated NamedAny specification_extension = 6; -} - diff --git a/vendor/github.com/google/gnostic-models/openapiv3/README.md b/vendor/github.com/google/gnostic-models/openapiv3/README.md deleted file mode 100644 index 5ee12d92e..000000000 --- a/vendor/github.com/google/gnostic-models/openapiv3/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# OpenAPI v3 Protocol Buffer Models - -This directory contains a Protocol Buffer-language model and related code for -supporting OpenAPI v3. - -Gnostic applications and plugins can use OpenAPIv3.proto to generate Protocol -Buffer support code for their preferred languages. - -OpenAPIv3.go is used by Gnostic to read JSON and YAML OpenAPI descriptions into -the Protocol Buffer-based datastructures generated from OpenAPIv3.proto. - -OpenAPIv3.proto and OpenAPIv3.go are generated by the Gnostic compiler -generator, and OpenAPIv3.pb.go is generated by protoc, the Protocol Buffer -compiler, and protoc-gen-go, the Protocol Buffer Go code generation plugin. - -openapi-3.1.json is a JSON schema for OpenAPI 3.1 that is automatically -generated from the OpenAPI 3.1 specification. It is not an official JSON Schema -for OpenAPI. - -The schema-generator directory contains support code which generates -openapi-3.1.json from the OpenAPI 3.1 specification document (Markdown). diff --git a/vendor/github.com/google/gnostic-models/openapiv3/document.go b/vendor/github.com/google/gnostic-models/openapiv3/document.go deleted file mode 100644 index 1cee46773..000000000 --- a/vendor/github.com/google/gnostic-models/openapiv3/document.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2020 Google LLC. All Rights Reserved. -// -// 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 openapi_v3 - -import ( - "gopkg.in/yaml.v3" - - "github.com/google/gnostic-models/compiler" -) - -// ParseDocument reads an OpenAPI v3 description from a YAML/JSON representation. -func ParseDocument(b []byte) (*Document, error) { - info, err := compiler.ReadInfoFromBytes("", b) - if err != nil { - return nil, err - } - root := info.Content[0] - return NewDocument(root, compiler.NewContextWithExtensions("$root", root, nil, nil)) -} - -// YAMLValue produces a serialized YAML representation of the document. -func (d *Document) YAMLValue(comment string) ([]byte, error) { - rawInfo := d.ToRawInfo() - rawInfo = &yaml.Node{ - Kind: yaml.DocumentNode, - Content: []*yaml.Node{rawInfo}, - HeadComment: comment, - } - return yaml.Marshal(rawInfo) -} diff --git a/vendor/github.com/google/go-cmp/LICENSE b/vendor/github.com/google/go-cmp/LICENSE deleted file mode 100644 index 32017f8fa..000000000 --- a/vendor/github.com/google/go-cmp/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2017 The Go Authors. 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 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. diff --git a/vendor/github.com/google/go-cmp/cmp/compare.go b/vendor/github.com/google/go-cmp/cmp/compare.go deleted file mode 100644 index 0f5b8a48c..000000000 --- a/vendor/github.com/google/go-cmp/cmp/compare.go +++ /dev/null @@ -1,671 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package cmp determines equality of values. -// -// This package is intended to be a more powerful and safer alternative to -// [reflect.DeepEqual] for comparing whether two values are semantically equal. -// It is intended to only be used in tests, as performance is not a goal and -// it may panic if it cannot compare the values. Its propensity towards -// panicking means that its unsuitable for production environments where a -// spurious panic may be fatal. -// -// The primary features of cmp are: -// -// - When the default behavior of equality does not suit the test's needs, -// custom equality functions can override the equality operation. -// For example, an equality function may report floats as equal so long as -// they are within some tolerance of each other. -// -// - Types with an Equal method (e.g., [time.Time.Equal]) may use that method -// to determine equality. This allows package authors to determine -// the equality operation for the types that they define. -// -// - If no custom equality functions are used and no Equal method is defined, -// equality is determined by recursively comparing the primitive kinds on -// both values, much like [reflect.DeepEqual]. Unlike [reflect.DeepEqual], -// unexported fields are not compared by default; they result in panics -// unless suppressed by using an [Ignore] option -// (see [github.com/google/go-cmp/cmp/cmpopts.IgnoreUnexported]) -// or explicitly compared using the [Exporter] option. -package cmp - -import ( - "fmt" - "reflect" - "strings" - - "github.com/google/go-cmp/cmp/internal/diff" - "github.com/google/go-cmp/cmp/internal/function" - "github.com/google/go-cmp/cmp/internal/value" -) - -// TODO(≥go1.18): Use any instead of interface{}. - -// Equal reports whether x and y are equal by recursively applying the -// following rules in the given order to x and y and all of their sub-values: -// -// - Let S be the set of all [Ignore], [Transformer], and [Comparer] options that -// remain after applying all path filters, value filters, and type filters. -// If at least one [Ignore] exists in S, then the comparison is ignored. -// If the number of [Transformer] and [Comparer] options in S is non-zero, -// then Equal panics because it is ambiguous which option to use. -// If S contains a single [Transformer], then use that to transform -// the current values and recursively call Equal on the output values. -// If S contains a single [Comparer], then use that to compare the current values. -// Otherwise, evaluation proceeds to the next rule. -// -// - If the values have an Equal method of the form "(T) Equal(T) bool" or -// "(T) Equal(I) bool" where T is assignable to I, then use the result of -// x.Equal(y) even if x or y is nil. Otherwise, no such method exists and -// evaluation proceeds to the next rule. -// -// - Lastly, try to compare x and y based on their basic kinds. -// Simple kinds like booleans, integers, floats, complex numbers, strings, -// and channels are compared using the equivalent of the == operator in Go. -// Functions are only equal if they are both nil, otherwise they are unequal. -// -// Structs are equal if recursively calling Equal on all fields report equal. -// If a struct contains unexported fields, Equal panics unless an [Ignore] option -// (e.g., [github.com/google/go-cmp/cmp/cmpopts.IgnoreUnexported]) ignores that field -// or the [Exporter] option explicitly permits comparing the unexported field. -// -// Slices are equal if they are both nil or both non-nil, where recursively -// calling Equal on all non-ignored slice or array elements report equal. -// Empty non-nil slices and nil slices are not equal; to equate empty slices, -// consider using [github.com/google/go-cmp/cmp/cmpopts.EquateEmpty]. -// -// Maps are equal if they are both nil or both non-nil, where recursively -// calling Equal on all non-ignored map entries report equal. -// Map keys are equal according to the == operator. -// To use custom comparisons for map keys, consider using -// [github.com/google/go-cmp/cmp/cmpopts.SortMaps]. -// Empty non-nil maps and nil maps are not equal; to equate empty maps, -// consider using [github.com/google/go-cmp/cmp/cmpopts.EquateEmpty]. -// -// Pointers and interfaces are equal if they are both nil or both non-nil, -// where they have the same underlying concrete type and recursively -// calling Equal on the underlying values reports equal. -// -// Before recursing into a pointer, slice element, or map, the current path -// is checked to detect whether the address has already been visited. -// If there is a cycle, then the pointed at values are considered equal -// only if both addresses were previously visited in the same path step. -func Equal(x, y interface{}, opts ...Option) bool { - s := newState(opts) - s.compareAny(rootStep(x, y)) - return s.result.Equal() -} - -// Diff returns a human-readable report of the differences between two values: -// y - x. It returns an empty string if and only if Equal returns true for the -// same input values and options. -// -// The output is displayed as a literal in pseudo-Go syntax. -// At the start of each line, a "-" prefix indicates an element removed from x, -// a "+" prefix to indicates an element added from y, and the lack of a prefix -// indicates an element common to both x and y. If possible, the output -// uses fmt.Stringer.String or error.Error methods to produce more humanly -// readable outputs. In such cases, the string is prefixed with either an -// 's' or 'e' character, respectively, to indicate that the method was called. -// -// Do not depend on this output being stable. If you need the ability to -// programmatically interpret the difference, consider using a custom Reporter. -func Diff(x, y interface{}, opts ...Option) string { - s := newState(opts) - - // Optimization: If there are no other reporters, we can optimize for the - // common case where the result is equal (and thus no reported difference). - // This avoids the expensive construction of a difference tree. - if len(s.reporters) == 0 { - s.compareAny(rootStep(x, y)) - if s.result.Equal() { - return "" - } - s.result = diff.Result{} // Reset results - } - - r := new(defaultReporter) - s.reporters = append(s.reporters, reporter{r}) - s.compareAny(rootStep(x, y)) - d := r.String() - if (d == "") != s.result.Equal() { - panic("inconsistent difference and equality results") - } - return d -} - -// rootStep constructs the first path step. If x and y have differing types, -// then they are stored within an empty interface type. -func rootStep(x, y interface{}) PathStep { - vx := reflect.ValueOf(x) - vy := reflect.ValueOf(y) - - // If the inputs are different types, auto-wrap them in an empty interface - // so that they have the same parent type. - var t reflect.Type - if !vx.IsValid() || !vy.IsValid() || vx.Type() != vy.Type() { - t = anyType - if vx.IsValid() { - vvx := reflect.New(t).Elem() - vvx.Set(vx) - vx = vvx - } - if vy.IsValid() { - vvy := reflect.New(t).Elem() - vvy.Set(vy) - vy = vvy - } - } else { - t = vx.Type() - } - - return &pathStep{t, vx, vy} -} - -type state struct { - // These fields represent the "comparison state". - // Calling statelessCompare must not result in observable changes to these. - result diff.Result // The current result of comparison - curPath Path // The current path in the value tree - curPtrs pointerPath // The current set of visited pointers - reporters []reporter // Optional reporters - - // recChecker checks for infinite cycles applying the same set of - // transformers upon the output of itself. - recChecker recChecker - - // dynChecker triggers pseudo-random checks for option correctness. - // It is safe for statelessCompare to mutate this value. - dynChecker dynChecker - - // These fields, once set by processOption, will not change. - exporters []exporter // List of exporters for structs with unexported fields - opts Options // List of all fundamental and filter options -} - -func newState(opts []Option) *state { - // Always ensure a validator option exists to validate the inputs. - s := &state{opts: Options{validator{}}} - s.curPtrs.Init() - s.processOption(Options(opts)) - return s -} - -func (s *state) processOption(opt Option) { - switch opt := opt.(type) { - case nil: - case Options: - for _, o := range opt { - s.processOption(o) - } - case coreOption: - type filtered interface { - isFiltered() bool - } - if fopt, ok := opt.(filtered); ok && !fopt.isFiltered() { - panic(fmt.Sprintf("cannot use an unfiltered option: %v", opt)) - } - s.opts = append(s.opts, opt) - case exporter: - s.exporters = append(s.exporters, opt) - case reporter: - s.reporters = append(s.reporters, opt) - default: - panic(fmt.Sprintf("unknown option %T", opt)) - } -} - -// statelessCompare compares two values and returns the result. -// This function is stateless in that it does not alter the current result, -// or output to any registered reporters. -func (s *state) statelessCompare(step PathStep) diff.Result { - // We do not save and restore curPath and curPtrs because all of the - // compareX methods should properly push and pop from them. - // It is an implementation bug if the contents of the paths differ from - // when calling this function to when returning from it. - - oldResult, oldReporters := s.result, s.reporters - s.result = diff.Result{} // Reset result - s.reporters = nil // Remove reporters to avoid spurious printouts - s.compareAny(step) - res := s.result - s.result, s.reporters = oldResult, oldReporters - return res -} - -func (s *state) compareAny(step PathStep) { - // Update the path stack. - s.curPath.push(step) - defer s.curPath.pop() - for _, r := range s.reporters { - r.PushStep(step) - defer r.PopStep() - } - s.recChecker.Check(s.curPath) - - // Cycle-detection for slice elements (see NOTE in compareSlice). - t := step.Type() - vx, vy := step.Values() - if si, ok := step.(SliceIndex); ok && si.isSlice && vx.IsValid() && vy.IsValid() { - px, py := vx.Addr(), vy.Addr() - if eq, visited := s.curPtrs.Push(px, py); visited { - s.report(eq, reportByCycle) - return - } - defer s.curPtrs.Pop(px, py) - } - - // Rule 1: Check whether an option applies on this node in the value tree. - if s.tryOptions(t, vx, vy) { - return - } - - // Rule 2: Check whether the type has a valid Equal method. - if s.tryMethod(t, vx, vy) { - return - } - - // Rule 3: Compare based on the underlying kind. - switch t.Kind() { - case reflect.Bool: - s.report(vx.Bool() == vy.Bool(), 0) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - s.report(vx.Int() == vy.Int(), 0) - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - s.report(vx.Uint() == vy.Uint(), 0) - case reflect.Float32, reflect.Float64: - s.report(vx.Float() == vy.Float(), 0) - case reflect.Complex64, reflect.Complex128: - s.report(vx.Complex() == vy.Complex(), 0) - case reflect.String: - s.report(vx.String() == vy.String(), 0) - case reflect.Chan, reflect.UnsafePointer: - s.report(vx.Pointer() == vy.Pointer(), 0) - case reflect.Func: - s.report(vx.IsNil() && vy.IsNil(), 0) - case reflect.Struct: - s.compareStruct(t, vx, vy) - case reflect.Slice, reflect.Array: - s.compareSlice(t, vx, vy) - case reflect.Map: - s.compareMap(t, vx, vy) - case reflect.Ptr: - s.comparePtr(t, vx, vy) - case reflect.Interface: - s.compareInterface(t, vx, vy) - default: - panic(fmt.Sprintf("%v kind not handled", t.Kind())) - } -} - -func (s *state) tryOptions(t reflect.Type, vx, vy reflect.Value) bool { - // Evaluate all filters and apply the remaining options. - if opt := s.opts.filter(s, t, vx, vy); opt != nil { - opt.apply(s, vx, vy) - return true - } - return false -} - -func (s *state) tryMethod(t reflect.Type, vx, vy reflect.Value) bool { - // Check if this type even has an Equal method. - m, ok := t.MethodByName("Equal") - if !ok || !function.IsType(m.Type, function.EqualAssignable) { - return false - } - - eq := s.callTTBFunc(m.Func, vx, vy) - s.report(eq, reportByMethod) - return true -} - -func (s *state) callTRFunc(f, v reflect.Value, step Transform) reflect.Value { - if !s.dynChecker.Next() { - return f.Call([]reflect.Value{v})[0] - } - - // Run the function twice and ensure that we get the same results back. - // We run in goroutines so that the race detector (if enabled) can detect - // unsafe mutations to the input. - c := make(chan reflect.Value) - go detectRaces(c, f, v) - got := <-c - want := f.Call([]reflect.Value{v})[0] - if step.vx, step.vy = got, want; !s.statelessCompare(step).Equal() { - // To avoid false-positives with non-reflexive equality operations, - // we sanity check whether a value is equal to itself. - if step.vx, step.vy = want, want; !s.statelessCompare(step).Equal() { - return want - } - panic(fmt.Sprintf("non-deterministic function detected: %s", function.NameOf(f))) - } - return want -} - -func (s *state) callTTBFunc(f, x, y reflect.Value) bool { - if !s.dynChecker.Next() { - return f.Call([]reflect.Value{x, y})[0].Bool() - } - - // Swapping the input arguments is sufficient to check that - // f is symmetric and deterministic. - // We run in goroutines so that the race detector (if enabled) can detect - // unsafe mutations to the input. - c := make(chan reflect.Value) - go detectRaces(c, f, y, x) - got := <-c - want := f.Call([]reflect.Value{x, y})[0].Bool() - if !got.IsValid() || got.Bool() != want { - panic(fmt.Sprintf("non-deterministic or non-symmetric function detected: %s", function.NameOf(f))) - } - return want -} - -func detectRaces(c chan<- reflect.Value, f reflect.Value, vs ...reflect.Value) { - var ret reflect.Value - defer func() { - recover() // Ignore panics, let the other call to f panic instead - c <- ret - }() - ret = f.Call(vs)[0] -} - -func (s *state) compareStruct(t reflect.Type, vx, vy reflect.Value) { - var addr bool - var vax, vay reflect.Value // Addressable versions of vx and vy - - var mayForce, mayForceInit bool - step := StructField{&structField{}} - for i := 0; i < t.NumField(); i++ { - step.typ = t.Field(i).Type - step.vx = vx.Field(i) - step.vy = vy.Field(i) - step.name = t.Field(i).Name - step.idx = i - step.unexported = !isExported(step.name) - if step.unexported { - if step.name == "_" { - continue - } - // Defer checking of unexported fields until later to give an - // Ignore a chance to ignore the field. - if !vax.IsValid() || !vay.IsValid() { - // For retrieveUnexportedField to work, the parent struct must - // be addressable. Create a new copy of the values if - // necessary to make them addressable. - addr = vx.CanAddr() || vy.CanAddr() - vax = makeAddressable(vx) - vay = makeAddressable(vy) - } - if !mayForceInit { - for _, xf := range s.exporters { - mayForce = mayForce || xf(t) - } - mayForceInit = true - } - step.mayForce = mayForce - step.paddr = addr - step.pvx = vax - step.pvy = vay - step.field = t.Field(i) - } - s.compareAny(step) - } -} - -func (s *state) compareSlice(t reflect.Type, vx, vy reflect.Value) { - isSlice := t.Kind() == reflect.Slice - if isSlice && (vx.IsNil() || vy.IsNil()) { - s.report(vx.IsNil() && vy.IsNil(), 0) - return - } - - // NOTE: It is incorrect to call curPtrs.Push on the slice header pointer - // since slices represents a list of pointers, rather than a single pointer. - // The pointer checking logic must be handled on a per-element basis - // in compareAny. - // - // A slice header (see reflect.SliceHeader) in Go is a tuple of a starting - // pointer P, a length N, and a capacity C. Supposing each slice element has - // a memory size of M, then the slice is equivalent to the list of pointers: - // [P+i*M for i in range(N)] - // - // For example, v[:0] and v[:1] are slices with the same starting pointer, - // but they are clearly different values. Using the slice pointer alone - // violates the assumption that equal pointers implies equal values. - - step := SliceIndex{&sliceIndex{pathStep: pathStep{typ: t.Elem()}, isSlice: isSlice}} - withIndexes := func(ix, iy int) SliceIndex { - if ix >= 0 { - step.vx, step.xkey = vx.Index(ix), ix - } else { - step.vx, step.xkey = reflect.Value{}, -1 - } - if iy >= 0 { - step.vy, step.ykey = vy.Index(iy), iy - } else { - step.vy, step.ykey = reflect.Value{}, -1 - } - return step - } - - // Ignore options are able to ignore missing elements in a slice. - // However, detecting these reliably requires an optimal differencing - // algorithm, for which diff.Difference is not. - // - // Instead, we first iterate through both slices to detect which elements - // would be ignored if standing alone. The index of non-discarded elements - // are stored in a separate slice, which diffing is then performed on. - var indexesX, indexesY []int - var ignoredX, ignoredY []bool - for ix := 0; ix < vx.Len(); ix++ { - ignored := s.statelessCompare(withIndexes(ix, -1)).NumDiff == 0 - if !ignored { - indexesX = append(indexesX, ix) - } - ignoredX = append(ignoredX, ignored) - } - for iy := 0; iy < vy.Len(); iy++ { - ignored := s.statelessCompare(withIndexes(-1, iy)).NumDiff == 0 - if !ignored { - indexesY = append(indexesY, iy) - } - ignoredY = append(ignoredY, ignored) - } - - // Compute an edit-script for slices vx and vy (excluding ignored elements). - edits := diff.Difference(len(indexesX), len(indexesY), func(ix, iy int) diff.Result { - return s.statelessCompare(withIndexes(indexesX[ix], indexesY[iy])) - }) - - // Replay the ignore-scripts and the edit-script. - var ix, iy int - for ix < vx.Len() || iy < vy.Len() { - var e diff.EditType - switch { - case ix < len(ignoredX) && ignoredX[ix]: - e = diff.UniqueX - case iy < len(ignoredY) && ignoredY[iy]: - e = diff.UniqueY - default: - e, edits = edits[0], edits[1:] - } - switch e { - case diff.UniqueX: - s.compareAny(withIndexes(ix, -1)) - ix++ - case diff.UniqueY: - s.compareAny(withIndexes(-1, iy)) - iy++ - default: - s.compareAny(withIndexes(ix, iy)) - ix++ - iy++ - } - } -} - -func (s *state) compareMap(t reflect.Type, vx, vy reflect.Value) { - if vx.IsNil() || vy.IsNil() { - s.report(vx.IsNil() && vy.IsNil(), 0) - return - } - - // Cycle-detection for maps. - if eq, visited := s.curPtrs.Push(vx, vy); visited { - s.report(eq, reportByCycle) - return - } - defer s.curPtrs.Pop(vx, vy) - - // We combine and sort the two map keys so that we can perform the - // comparisons in a deterministic order. - step := MapIndex{&mapIndex{pathStep: pathStep{typ: t.Elem()}}} - for _, k := range value.SortKeys(append(vx.MapKeys(), vy.MapKeys()...)) { - step.vx = vx.MapIndex(k) - step.vy = vy.MapIndex(k) - step.key = k - if !step.vx.IsValid() && !step.vy.IsValid() { - // It is possible for both vx and vy to be invalid if the - // key contained a NaN value in it. - // - // Even with the ability to retrieve NaN keys in Go 1.12, - // there still isn't a sensible way to compare the values since - // a NaN key may map to multiple unordered values. - // The most reasonable way to compare NaNs would be to compare the - // set of values. However, this is impossible to do efficiently - // since set equality is provably an O(n^2) operation given only - // an Equal function. If we had a Less function or Hash function, - // this could be done in O(n*log(n)) or O(n), respectively. - // - // Rather than adding complex logic to deal with NaNs, make it - // the user's responsibility to compare such obscure maps. - const help = "consider providing a Comparer to compare the map" - panic(fmt.Sprintf("%#v has map key with NaNs\n%s", s.curPath, help)) - } - s.compareAny(step) - } -} - -func (s *state) comparePtr(t reflect.Type, vx, vy reflect.Value) { - if vx.IsNil() || vy.IsNil() { - s.report(vx.IsNil() && vy.IsNil(), 0) - return - } - - // Cycle-detection for pointers. - if eq, visited := s.curPtrs.Push(vx, vy); visited { - s.report(eq, reportByCycle) - return - } - defer s.curPtrs.Pop(vx, vy) - - vx, vy = vx.Elem(), vy.Elem() - s.compareAny(Indirect{&indirect{pathStep{t.Elem(), vx, vy}}}) -} - -func (s *state) compareInterface(t reflect.Type, vx, vy reflect.Value) { - if vx.IsNil() || vy.IsNil() { - s.report(vx.IsNil() && vy.IsNil(), 0) - return - } - vx, vy = vx.Elem(), vy.Elem() - if vx.Type() != vy.Type() { - s.report(false, 0) - return - } - s.compareAny(TypeAssertion{&typeAssertion{pathStep{vx.Type(), vx, vy}}}) -} - -func (s *state) report(eq bool, rf resultFlags) { - if rf&reportByIgnore == 0 { - if eq { - s.result.NumSame++ - rf |= reportEqual - } else { - s.result.NumDiff++ - rf |= reportUnequal - } - } - for _, r := range s.reporters { - r.Report(Result{flags: rf}) - } -} - -// recChecker tracks the state needed to periodically perform checks that -// user provided transformers are not stuck in an infinitely recursive cycle. -type recChecker struct{ next int } - -// Check scans the Path for any recursive transformers and panics when any -// recursive transformers are detected. Note that the presence of a -// recursive Transformer does not necessarily imply an infinite cycle. -// As such, this check only activates after some minimal number of path steps. -func (rc *recChecker) Check(p Path) { - const minLen = 1 << 16 - if rc.next == 0 { - rc.next = minLen - } - if len(p) < rc.next { - return - } - rc.next <<= 1 - - // Check whether the same transformer has appeared at least twice. - var ss []string - m := map[Option]int{} - for _, ps := range p { - if t, ok := ps.(Transform); ok { - t := t.Option() - if m[t] == 1 { // Transformer was used exactly once before - tf := t.(*transformer).fnc.Type() - ss = append(ss, fmt.Sprintf("%v: %v => %v", t, tf.In(0), tf.Out(0))) - } - m[t]++ - } - } - if len(ss) > 0 { - const warning = "recursive set of Transformers detected" - const help = "consider using cmpopts.AcyclicTransformer" - set := strings.Join(ss, "\n\t") - panic(fmt.Sprintf("%s:\n\t%s\n%s", warning, set, help)) - } -} - -// dynChecker tracks the state needed to periodically perform checks that -// user provided functions are symmetric and deterministic. -// The zero value is safe for immediate use. -type dynChecker struct{ curr, next int } - -// Next increments the state and reports whether a check should be performed. -// -// Checks occur every Nth function call, where N is a triangular number: -// -// 0 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 ... -// -// See https://en.wikipedia.org/wiki/Triangular_number -// -// This sequence ensures that the cost of checks drops significantly as -// the number of functions calls grows larger. -func (dc *dynChecker) Next() bool { - ok := dc.curr == dc.next - if ok { - dc.curr = 0 - dc.next++ - } - dc.curr++ - return ok -} - -// makeAddressable returns a value that is always addressable. -// It returns the input verbatim if it is already addressable, -// otherwise it creates a new value and returns an addressable copy. -func makeAddressable(v reflect.Value) reflect.Value { - if v.CanAddr() { - return v - } - vc := reflect.New(v.Type()).Elem() - vc.Set(v) - return vc -} diff --git a/vendor/github.com/google/go-cmp/cmp/export.go b/vendor/github.com/google/go-cmp/cmp/export.go deleted file mode 100644 index 29f82fe6b..000000000 --- a/vendor/github.com/google/go-cmp/cmp/export.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cmp - -import ( - "reflect" - "unsafe" -) - -// retrieveUnexportedField uses unsafe to forcibly retrieve any field from -// a struct such that the value has read-write permissions. -// -// The parent struct, v, must be addressable, while f must be a StructField -// describing the field to retrieve. If addr is false, -// then the returned value will be shallowed copied to be non-addressable. -func retrieveUnexportedField(v reflect.Value, f reflect.StructField, addr bool) reflect.Value { - ve := reflect.NewAt(f.Type, unsafe.Pointer(uintptr(unsafe.Pointer(v.UnsafeAddr()))+f.Offset)).Elem() - if !addr { - // A field is addressable if and only if the struct is addressable. - // If the original parent value was not addressable, shallow copy the - // value to make it non-addressable to avoid leaking an implementation - // detail of how forcibly exporting a field works. - if ve.Kind() == reflect.Interface && ve.IsNil() { - return reflect.Zero(f.Type) - } - return reflect.ValueOf(ve.Interface()).Convert(f.Type) - } - return ve -} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go b/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go deleted file mode 100644 index 36062a604..000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !cmp_debug -// +build !cmp_debug - -package diff - -var debug debugger - -type debugger struct{} - -func (debugger) Begin(_, _ int, f EqualFunc, _, _ *EditScript) EqualFunc { - return f -} -func (debugger) Update() {} -func (debugger) Finish() {} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_enable.go b/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_enable.go deleted file mode 100644 index a3b97a1ad..000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_enable.go +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build cmp_debug -// +build cmp_debug - -package diff - -import ( - "fmt" - "strings" - "sync" - "time" -) - -// The algorithm can be seen running in real-time by enabling debugging: -// go test -tags=cmp_debug -v -// -// Example output: -// === RUN TestDifference/#34 -// ┌───────────────────────────────┐ -// │ \ · · · · · · · · · · · · · · │ -// │ · # · · · · · · · · · · · · · │ -// │ · \ · · · · · · · · · · · · · │ -// │ · · \ · · · · · · · · · · · · │ -// │ · · · X # · · · · · · · · · · │ -// │ · · · # \ · · · · · · · · · · │ -// │ · · · · · # # · · · · · · · · │ -// │ · · · · · # \ · · · · · · · · │ -// │ · · · · · · · \ · · · · · · · │ -// │ · · · · · · · · \ · · · · · · │ -// │ · · · · · · · · · \ · · · · · │ -// │ · · · · · · · · · · \ · · # · │ -// │ · · · · · · · · · · · \ # # · │ -// │ · · · · · · · · · · · # # # · │ -// │ · · · · · · · · · · # # # # · │ -// │ · · · · · · · · · # # # # # · │ -// │ · · · · · · · · · · · · · · \ │ -// └───────────────────────────────┘ -// [.Y..M.XY......YXYXY.|] -// -// The grid represents the edit-graph where the horizontal axis represents -// list X and the vertical axis represents list Y. The start of the two lists -// is the top-left, while the ends are the bottom-right. The '·' represents -// an unexplored node in the graph. The '\' indicates that the two symbols -// from list X and Y are equal. The 'X' indicates that two symbols are similar -// (but not exactly equal) to each other. The '#' indicates that the two symbols -// are different (and not similar). The algorithm traverses this graph trying to -// make the paths starting in the top-left and the bottom-right connect. -// -// The series of '.', 'X', 'Y', and 'M' characters at the bottom represents -// the currently established path from the forward and reverse searches, -// separated by a '|' character. - -const ( - updateDelay = 100 * time.Millisecond - finishDelay = 500 * time.Millisecond - ansiTerminal = true // ANSI escape codes used to move terminal cursor -) - -var debug debugger - -type debugger struct { - sync.Mutex - p1, p2 EditScript - fwdPath, revPath *EditScript - grid []byte - lines int -} - -func (dbg *debugger) Begin(nx, ny int, f EqualFunc, p1, p2 *EditScript) EqualFunc { - dbg.Lock() - dbg.fwdPath, dbg.revPath = p1, p2 - top := "┌─" + strings.Repeat("──", nx) + "┐\n" - row := "│ " + strings.Repeat("· ", nx) + "│\n" - btm := "└─" + strings.Repeat("──", nx) + "┘\n" - dbg.grid = []byte(top + strings.Repeat(row, ny) + btm) - dbg.lines = strings.Count(dbg.String(), "\n") - fmt.Print(dbg) - - // Wrap the EqualFunc so that we can intercept each result. - return func(ix, iy int) (r Result) { - cell := dbg.grid[len(top)+iy*len(row):][len("│ ")+len("· ")*ix:][:len("·")] - for i := range cell { - cell[i] = 0 // Zero out the multiple bytes of UTF-8 middle-dot - } - switch r = f(ix, iy); { - case r.Equal(): - cell[0] = '\\' - case r.Similar(): - cell[0] = 'X' - default: - cell[0] = '#' - } - return - } -} - -func (dbg *debugger) Update() { - dbg.print(updateDelay) -} - -func (dbg *debugger) Finish() { - dbg.print(finishDelay) - dbg.Unlock() -} - -func (dbg *debugger) String() string { - dbg.p1, dbg.p2 = *dbg.fwdPath, dbg.p2[:0] - for i := len(*dbg.revPath) - 1; i >= 0; i-- { - dbg.p2 = append(dbg.p2, (*dbg.revPath)[i]) - } - return fmt.Sprintf("%s[%v|%v]\n\n", dbg.grid, dbg.p1, dbg.p2) -} - -func (dbg *debugger) print(d time.Duration) { - if ansiTerminal { - fmt.Printf("\x1b[%dA", dbg.lines) // Reset terminal cursor - } - fmt.Print(dbg) - time.Sleep(d) -} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go b/vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go deleted file mode 100644 index a248e5436..000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go +++ /dev/null @@ -1,402 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package diff implements an algorithm for producing edit-scripts. -// The edit-script is a sequence of operations needed to transform one list -// of symbols into another (or vice-versa). The edits allowed are insertions, -// deletions, and modifications. The summation of all edits is called the -// Levenshtein distance as this problem is well-known in computer science. -// -// This package prioritizes performance over accuracy. That is, the run time -// is more important than obtaining a minimal Levenshtein distance. -package diff - -import ( - "math/rand" - "time" - - "github.com/google/go-cmp/cmp/internal/flags" -) - -// EditType represents a single operation within an edit-script. -type EditType uint8 - -const ( - // Identity indicates that a symbol pair is identical in both list X and Y. - Identity EditType = iota - // UniqueX indicates that a symbol only exists in X and not Y. - UniqueX - // UniqueY indicates that a symbol only exists in Y and not X. - UniqueY - // Modified indicates that a symbol pair is a modification of each other. - Modified -) - -// EditScript represents the series of differences between two lists. -type EditScript []EditType - -// String returns a human-readable string representing the edit-script where -// Identity, UniqueX, UniqueY, and Modified are represented by the -// '.', 'X', 'Y', and 'M' characters, respectively. -func (es EditScript) String() string { - b := make([]byte, len(es)) - for i, e := range es { - switch e { - case Identity: - b[i] = '.' - case UniqueX: - b[i] = 'X' - case UniqueY: - b[i] = 'Y' - case Modified: - b[i] = 'M' - default: - panic("invalid edit-type") - } - } - return string(b) -} - -// stats returns a histogram of the number of each type of edit operation. -func (es EditScript) stats() (s struct{ NI, NX, NY, NM int }) { - for _, e := range es { - switch e { - case Identity: - s.NI++ - case UniqueX: - s.NX++ - case UniqueY: - s.NY++ - case Modified: - s.NM++ - default: - panic("invalid edit-type") - } - } - return -} - -// Dist is the Levenshtein distance and is guaranteed to be 0 if and only if -// lists X and Y are equal. -func (es EditScript) Dist() int { return len(es) - es.stats().NI } - -// LenX is the length of the X list. -func (es EditScript) LenX() int { return len(es) - es.stats().NY } - -// LenY is the length of the Y list. -func (es EditScript) LenY() int { return len(es) - es.stats().NX } - -// EqualFunc reports whether the symbols at indexes ix and iy are equal. -// When called by Difference, the index is guaranteed to be within nx and ny. -type EqualFunc func(ix int, iy int) Result - -// Result is the result of comparison. -// NumSame is the number of sub-elements that are equal. -// NumDiff is the number of sub-elements that are not equal. -type Result struct{ NumSame, NumDiff int } - -// BoolResult returns a Result that is either Equal or not Equal. -func BoolResult(b bool) Result { - if b { - return Result{NumSame: 1} // Equal, Similar - } else { - return Result{NumDiff: 2} // Not Equal, not Similar - } -} - -// Equal indicates whether the symbols are equal. Two symbols are equal -// if and only if NumDiff == 0. If Equal, then they are also Similar. -func (r Result) Equal() bool { return r.NumDiff == 0 } - -// Similar indicates whether two symbols are similar and may be represented -// by using the Modified type. As a special case, we consider binary comparisons -// (i.e., those that return Result{1, 0} or Result{0, 1}) to be similar. -// -// The exact ratio of NumSame to NumDiff to determine similarity may change. -func (r Result) Similar() bool { - // Use NumSame+1 to offset NumSame so that binary comparisons are similar. - return r.NumSame+1 >= r.NumDiff -} - -var randBool = rand.New(rand.NewSource(time.Now().Unix())).Intn(2) == 0 - -// Difference reports whether two lists of lengths nx and ny are equal -// given the definition of equality provided as f. -// -// This function returns an edit-script, which is a sequence of operations -// needed to convert one list into the other. The following invariants for -// the edit-script are maintained: -// - eq == (es.Dist()==0) -// - nx == es.LenX() -// - ny == es.LenY() -// -// This algorithm is not guaranteed to be an optimal solution (i.e., one that -// produces an edit-script with a minimal Levenshtein distance). This algorithm -// favors performance over optimality. The exact output is not guaranteed to -// be stable and may change over time. -func Difference(nx, ny int, f EqualFunc) (es EditScript) { - // This algorithm is based on traversing what is known as an "edit-graph". - // See Figure 1 from "An O(ND) Difference Algorithm and Its Variations" - // by Eugene W. Myers. Since D can be as large as N itself, this is - // effectively O(N^2). Unlike the algorithm from that paper, we are not - // interested in the optimal path, but at least some "decent" path. - // - // For example, let X and Y be lists of symbols: - // X = [A B C A B B A] - // Y = [C B A B A C] - // - // The edit-graph can be drawn as the following: - // A B C A B B A - // ┌─────────────┐ - // C │_|_|\|_|_|_|_│ 0 - // B │_|\|_|_|\|\|_│ 1 - // A │\|_|_|\|_|_|\│ 2 - // B │_|\|_|_|\|\|_│ 3 - // A │\|_|_|\|_|_|\│ 4 - // C │ | |\| | | | │ 5 - // └─────────────┘ 6 - // 0 1 2 3 4 5 6 7 - // - // List X is written along the horizontal axis, while list Y is written - // along the vertical axis. At any point on this grid, if the symbol in - // list X matches the corresponding symbol in list Y, then a '\' is drawn. - // The goal of any minimal edit-script algorithm is to find a path from the - // top-left corner to the bottom-right corner, while traveling through the - // fewest horizontal or vertical edges. - // A horizontal edge is equivalent to inserting a symbol from list X. - // A vertical edge is equivalent to inserting a symbol from list Y. - // A diagonal edge is equivalent to a matching symbol between both X and Y. - - // Invariants: - // - 0 ≤ fwdPath.X ≤ (fwdFrontier.X, revFrontier.X) ≤ revPath.X ≤ nx - // - 0 ≤ fwdPath.Y ≤ (fwdFrontier.Y, revFrontier.Y) ≤ revPath.Y ≤ ny - // - // In general: - // - fwdFrontier.X < revFrontier.X - // - fwdFrontier.Y < revFrontier.Y - // - // Unless, it is time for the algorithm to terminate. - fwdPath := path{+1, point{0, 0}, make(EditScript, 0, (nx+ny)/2)} - revPath := path{-1, point{nx, ny}, make(EditScript, 0)} - fwdFrontier := fwdPath.point // Forward search frontier - revFrontier := revPath.point // Reverse search frontier - - // Search budget bounds the cost of searching for better paths. - // The longest sequence of non-matching symbols that can be tolerated is - // approximately the square-root of the search budget. - searchBudget := 4 * (nx + ny) // O(n) - - // Running the tests with the "cmp_debug" build tag prints a visualization - // of the algorithm running in real-time. This is educational for - // understanding how the algorithm works. See debug_enable.go. - f = debug.Begin(nx, ny, f, &fwdPath.es, &revPath.es) - - // The algorithm below is a greedy, meet-in-the-middle algorithm for - // computing sub-optimal edit-scripts between two lists. - // - // The algorithm is approximately as follows: - // - Searching for differences switches back-and-forth between - // a search that starts at the beginning (the top-left corner), and - // a search that starts at the end (the bottom-right corner). - // The goal of the search is connect with the search - // from the opposite corner. - // - As we search, we build a path in a greedy manner, - // where the first match seen is added to the path (this is sub-optimal, - // but provides a decent result in practice). When matches are found, - // we try the next pair of symbols in the lists and follow all matches - // as far as possible. - // - When searching for matches, we search along a diagonal going through - // through the "frontier" point. If no matches are found, - // we advance the frontier towards the opposite corner. - // - This algorithm terminates when either the X coordinates or the - // Y coordinates of the forward and reverse frontier points ever intersect. - - // This algorithm is correct even if searching only in the forward direction - // or in the reverse direction. We do both because it is commonly observed - // that two lists commonly differ because elements were added to the front - // or end of the other list. - // - // Non-deterministically start with either the forward or reverse direction - // to introduce some deliberate instability so that we have the flexibility - // to change this algorithm in the future. - if flags.Deterministic || randBool { - goto forwardSearch - } else { - goto reverseSearch - } - -forwardSearch: - { - // Forward search from the beginning. - if fwdFrontier.X >= revFrontier.X || fwdFrontier.Y >= revFrontier.Y || searchBudget == 0 { - goto finishSearch - } - for stop1, stop2, i := false, false, 0; !(stop1 && stop2) && searchBudget > 0; i++ { - // Search in a diagonal pattern for a match. - z := zigzag(i) - p := point{fwdFrontier.X + z, fwdFrontier.Y - z} - switch { - case p.X >= revPath.X || p.Y < fwdPath.Y: - stop1 = true // Hit top-right corner - case p.Y >= revPath.Y || p.X < fwdPath.X: - stop2 = true // Hit bottom-left corner - case f(p.X, p.Y).Equal(): - // Match found, so connect the path to this point. - fwdPath.connect(p, f) - fwdPath.append(Identity) - // Follow sequence of matches as far as possible. - for fwdPath.X < revPath.X && fwdPath.Y < revPath.Y { - if !f(fwdPath.X, fwdPath.Y).Equal() { - break - } - fwdPath.append(Identity) - } - fwdFrontier = fwdPath.point - stop1, stop2 = true, true - default: - searchBudget-- // Match not found - } - debug.Update() - } - // Advance the frontier towards reverse point. - if revPath.X-fwdFrontier.X >= revPath.Y-fwdFrontier.Y { - fwdFrontier.X++ - } else { - fwdFrontier.Y++ - } - goto reverseSearch - } - -reverseSearch: - { - // Reverse search from the end. - if fwdFrontier.X >= revFrontier.X || fwdFrontier.Y >= revFrontier.Y || searchBudget == 0 { - goto finishSearch - } - for stop1, stop2, i := false, false, 0; !(stop1 && stop2) && searchBudget > 0; i++ { - // Search in a diagonal pattern for a match. - z := zigzag(i) - p := point{revFrontier.X - z, revFrontier.Y + z} - switch { - case fwdPath.X >= p.X || revPath.Y < p.Y: - stop1 = true // Hit bottom-left corner - case fwdPath.Y >= p.Y || revPath.X < p.X: - stop2 = true // Hit top-right corner - case f(p.X-1, p.Y-1).Equal(): - // Match found, so connect the path to this point. - revPath.connect(p, f) - revPath.append(Identity) - // Follow sequence of matches as far as possible. - for fwdPath.X < revPath.X && fwdPath.Y < revPath.Y { - if !f(revPath.X-1, revPath.Y-1).Equal() { - break - } - revPath.append(Identity) - } - revFrontier = revPath.point - stop1, stop2 = true, true - default: - searchBudget-- // Match not found - } - debug.Update() - } - // Advance the frontier towards forward point. - if revFrontier.X-fwdPath.X >= revFrontier.Y-fwdPath.Y { - revFrontier.X-- - } else { - revFrontier.Y-- - } - goto forwardSearch - } - -finishSearch: - // Join the forward and reverse paths and then append the reverse path. - fwdPath.connect(revPath.point, f) - for i := len(revPath.es) - 1; i >= 0; i-- { - t := revPath.es[i] - revPath.es = revPath.es[:i] - fwdPath.append(t) - } - debug.Finish() - return fwdPath.es -} - -type path struct { - dir int // +1 if forward, -1 if reverse - point // Leading point of the EditScript path - es EditScript -} - -// connect appends any necessary Identity, Modified, UniqueX, or UniqueY types -// to the edit-script to connect p.point to dst. -func (p *path) connect(dst point, f EqualFunc) { - if p.dir > 0 { - // Connect in forward direction. - for dst.X > p.X && dst.Y > p.Y { - switch r := f(p.X, p.Y); { - case r.Equal(): - p.append(Identity) - case r.Similar(): - p.append(Modified) - case dst.X-p.X >= dst.Y-p.Y: - p.append(UniqueX) - default: - p.append(UniqueY) - } - } - for dst.X > p.X { - p.append(UniqueX) - } - for dst.Y > p.Y { - p.append(UniqueY) - } - } else { - // Connect in reverse direction. - for p.X > dst.X && p.Y > dst.Y { - switch r := f(p.X-1, p.Y-1); { - case r.Equal(): - p.append(Identity) - case r.Similar(): - p.append(Modified) - case p.Y-dst.Y >= p.X-dst.X: - p.append(UniqueY) - default: - p.append(UniqueX) - } - } - for p.X > dst.X { - p.append(UniqueX) - } - for p.Y > dst.Y { - p.append(UniqueY) - } - } -} - -func (p *path) append(t EditType) { - p.es = append(p.es, t) - switch t { - case Identity, Modified: - p.add(p.dir, p.dir) - case UniqueX: - p.add(p.dir, 0) - case UniqueY: - p.add(0, p.dir) - } - debug.Update() -} - -type point struct{ X, Y int } - -func (p *point) add(dx, dy int) { p.X += dx; p.Y += dy } - -// zigzag maps a consecutive sequence of integers to a zig-zag sequence. -// -// [0 1 2 3 4 5 ...] => [0 -1 +1 -2 +2 ...] -func zigzag(x int) int { - if x&1 != 0 { - x = ^x - } - return x >> 1 -} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/flags/flags.go b/vendor/github.com/google/go-cmp/cmp/internal/flags/flags.go deleted file mode 100644 index d8e459c9b..000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/flags/flags.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2019, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package flags - -// Deterministic controls whether the output of Diff should be deterministic. -// This is only used for testing. -var Deterministic bool diff --git a/vendor/github.com/google/go-cmp/cmp/internal/function/func.go b/vendor/github.com/google/go-cmp/cmp/internal/function/func.go deleted file mode 100644 index d127d4362..000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/function/func.go +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package function provides functionality for identifying function types. -package function - -import ( - "reflect" - "regexp" - "runtime" - "strings" -) - -type funcType int - -const ( - _ funcType = iota - - tbFunc // func(T) bool - ttbFunc // func(T, T) bool - trbFunc // func(T, R) bool - tibFunc // func(T, I) bool - trFunc // func(T) R - - Equal = ttbFunc // func(T, T) bool - EqualAssignable = tibFunc // func(T, I) bool; encapsulates func(T, T) bool - Transformer = trFunc // func(T) R - ValueFilter = ttbFunc // func(T, T) bool - Less = ttbFunc // func(T, T) bool - ValuePredicate = tbFunc // func(T) bool - KeyValuePredicate = trbFunc // func(T, R) bool -) - -var boolType = reflect.TypeOf(true) - -// IsType reports whether the reflect.Type is of the specified function type. -func IsType(t reflect.Type, ft funcType) bool { - if t == nil || t.Kind() != reflect.Func || t.IsVariadic() { - return false - } - ni, no := t.NumIn(), t.NumOut() - switch ft { - case tbFunc: // func(T) bool - if ni == 1 && no == 1 && t.Out(0) == boolType { - return true - } - case ttbFunc: // func(T, T) bool - if ni == 2 && no == 1 && t.In(0) == t.In(1) && t.Out(0) == boolType { - return true - } - case trbFunc: // func(T, R) bool - if ni == 2 && no == 1 && t.Out(0) == boolType { - return true - } - case tibFunc: // func(T, I) bool - if ni == 2 && no == 1 && t.In(0).AssignableTo(t.In(1)) && t.Out(0) == boolType { - return true - } - case trFunc: // func(T) R - if ni == 1 && no == 1 { - return true - } - } - return false -} - -var lastIdentRx = regexp.MustCompile(`[_\p{L}][_\p{L}\p{N}]*$`) - -// NameOf returns the name of the function value. -func NameOf(v reflect.Value) string { - fnc := runtime.FuncForPC(v.Pointer()) - if fnc == nil { - return "" - } - fullName := fnc.Name() // e.g., "long/path/name/mypkg.(*MyType).(long/path/name/mypkg.myMethod)-fm" - - // Method closures have a "-fm" suffix. - fullName = strings.TrimSuffix(fullName, "-fm") - - var name string - for len(fullName) > 0 { - inParen := strings.HasSuffix(fullName, ")") - fullName = strings.TrimSuffix(fullName, ")") - - s := lastIdentRx.FindString(fullName) - if s == "" { - break - } - name = s + "." + name - fullName = strings.TrimSuffix(fullName, s) - - if i := strings.LastIndexByte(fullName, '('); inParen && i >= 0 { - fullName = fullName[:i] - } - fullName = strings.TrimSuffix(fullName, ".") - } - return strings.TrimSuffix(name, ".") -} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/name.go b/vendor/github.com/google/go-cmp/cmp/internal/value/name.go deleted file mode 100644 index 7b498bb2c..000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/value/name.go +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright 2020, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package value - -import ( - "reflect" - "strconv" -) - -var anyType = reflect.TypeOf((*interface{})(nil)).Elem() - -// TypeString is nearly identical to reflect.Type.String, -// but has an additional option to specify that full type names be used. -func TypeString(t reflect.Type, qualified bool) string { - return string(appendTypeName(nil, t, qualified, false)) -} - -func appendTypeName(b []byte, t reflect.Type, qualified, elideFunc bool) []byte { - // BUG: Go reflection provides no way to disambiguate two named types - // of the same name and within the same package, - // but declared within the namespace of different functions. - - // Use the "any" alias instead of "interface{}" for better readability. - if t == anyType { - return append(b, "any"...) - } - - // Named type. - if t.Name() != "" { - if qualified && t.PkgPath() != "" { - b = append(b, '"') - b = append(b, t.PkgPath()...) - b = append(b, '"') - b = append(b, '.') - b = append(b, t.Name()...) - } else { - b = append(b, t.String()...) - } - return b - } - - // Unnamed type. - switch k := t.Kind(); k { - case reflect.Bool, reflect.String, reflect.UnsafePointer, - reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, - reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, - reflect.Float32, reflect.Float64, reflect.Complex64, reflect.Complex128: - b = append(b, k.String()...) - case reflect.Chan: - if t.ChanDir() == reflect.RecvDir { - b = append(b, "<-"...) - } - b = append(b, "chan"...) - if t.ChanDir() == reflect.SendDir { - b = append(b, "<-"...) - } - b = append(b, ' ') - b = appendTypeName(b, t.Elem(), qualified, false) - case reflect.Func: - if !elideFunc { - b = append(b, "func"...) - } - b = append(b, '(') - for i := 0; i < t.NumIn(); i++ { - if i > 0 { - b = append(b, ", "...) - } - if i == t.NumIn()-1 && t.IsVariadic() { - b = append(b, "..."...) - b = appendTypeName(b, t.In(i).Elem(), qualified, false) - } else { - b = appendTypeName(b, t.In(i), qualified, false) - } - } - b = append(b, ')') - switch t.NumOut() { - case 0: - // Do nothing - case 1: - b = append(b, ' ') - b = appendTypeName(b, t.Out(0), qualified, false) - default: - b = append(b, " ("...) - for i := 0; i < t.NumOut(); i++ { - if i > 0 { - b = append(b, ", "...) - } - b = appendTypeName(b, t.Out(i), qualified, false) - } - b = append(b, ')') - } - case reflect.Struct: - b = append(b, "struct{ "...) - for i := 0; i < t.NumField(); i++ { - if i > 0 { - b = append(b, "; "...) - } - sf := t.Field(i) - if !sf.Anonymous { - if qualified && sf.PkgPath != "" { - b = append(b, '"') - b = append(b, sf.PkgPath...) - b = append(b, '"') - b = append(b, '.') - } - b = append(b, sf.Name...) - b = append(b, ' ') - } - b = appendTypeName(b, sf.Type, qualified, false) - if sf.Tag != "" { - b = append(b, ' ') - b = strconv.AppendQuote(b, string(sf.Tag)) - } - } - if b[len(b)-1] == ' ' { - b = b[:len(b)-1] - } else { - b = append(b, ' ') - } - b = append(b, '}') - case reflect.Slice, reflect.Array: - b = append(b, '[') - if k == reflect.Array { - b = strconv.AppendUint(b, uint64(t.Len()), 10) - } - b = append(b, ']') - b = appendTypeName(b, t.Elem(), qualified, false) - case reflect.Map: - b = append(b, "map["...) - b = appendTypeName(b, t.Key(), qualified, false) - b = append(b, ']') - b = appendTypeName(b, t.Elem(), qualified, false) - case reflect.Ptr: - b = append(b, '*') - b = appendTypeName(b, t.Elem(), qualified, false) - case reflect.Interface: - b = append(b, "interface{ "...) - for i := 0; i < t.NumMethod(); i++ { - if i > 0 { - b = append(b, "; "...) - } - m := t.Method(i) - if qualified && m.PkgPath != "" { - b = append(b, '"') - b = append(b, m.PkgPath...) - b = append(b, '"') - b = append(b, '.') - } - b = append(b, m.Name...) - b = appendTypeName(b, m.Type, qualified, true) - } - if b[len(b)-1] == ' ' { - b = b[:len(b)-1] - } else { - b = append(b, ' ') - } - b = append(b, '}') - default: - panic("invalid kind: " + k.String()) - } - return b -} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer.go b/vendor/github.com/google/go-cmp/cmp/internal/value/pointer.go deleted file mode 100644 index e5dfff69a..000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2018, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package value - -import ( - "reflect" - "unsafe" -) - -// Pointer is an opaque typed pointer and is guaranteed to be comparable. -type Pointer struct { - p unsafe.Pointer - t reflect.Type -} - -// PointerOf returns a Pointer from v, which must be a -// reflect.Ptr, reflect.Slice, or reflect.Map. -func PointerOf(v reflect.Value) Pointer { - // The proper representation of a pointer is unsafe.Pointer, - // which is necessary if the GC ever uses a moving collector. - return Pointer{unsafe.Pointer(v.Pointer()), v.Type()} -} - -// IsNil reports whether the pointer is nil. -func (p Pointer) IsNil() bool { - return p.p == nil -} - -// Uintptr returns the pointer as a uintptr. -func (p Pointer) Uintptr() uintptr { - return uintptr(p.p) -} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/sort.go b/vendor/github.com/google/go-cmp/cmp/internal/value/sort.go deleted file mode 100644 index 98533b036..000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/value/sort.go +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package value - -import ( - "fmt" - "math" - "reflect" - "sort" -) - -// SortKeys sorts a list of map keys, deduplicating keys if necessary. -// The type of each value must be comparable. -func SortKeys(vs []reflect.Value) []reflect.Value { - if len(vs) == 0 { - return vs - } - - // Sort the map keys. - sort.SliceStable(vs, func(i, j int) bool { return isLess(vs[i], vs[j]) }) - - // Deduplicate keys (fails for NaNs). - vs2 := vs[:1] - for _, v := range vs[1:] { - if isLess(vs2[len(vs2)-1], v) { - vs2 = append(vs2, v) - } - } - return vs2 -} - -// isLess is a generic function for sorting arbitrary map keys. -// The inputs must be of the same type and must be comparable. -func isLess(x, y reflect.Value) bool { - switch x.Type().Kind() { - case reflect.Bool: - return !x.Bool() && y.Bool() - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return x.Int() < y.Int() - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return x.Uint() < y.Uint() - case reflect.Float32, reflect.Float64: - // NOTE: This does not sort -0 as less than +0 - // since Go maps treat -0 and +0 as equal keys. - fx, fy := x.Float(), y.Float() - return fx < fy || math.IsNaN(fx) && !math.IsNaN(fy) - case reflect.Complex64, reflect.Complex128: - cx, cy := x.Complex(), y.Complex() - rx, ix, ry, iy := real(cx), imag(cx), real(cy), imag(cy) - if rx == ry || (math.IsNaN(rx) && math.IsNaN(ry)) { - return ix < iy || math.IsNaN(ix) && !math.IsNaN(iy) - } - return rx < ry || math.IsNaN(rx) && !math.IsNaN(ry) - case reflect.Ptr, reflect.UnsafePointer, reflect.Chan: - return x.Pointer() < y.Pointer() - case reflect.String: - return x.String() < y.String() - case reflect.Array: - for i := 0; i < x.Len(); i++ { - if isLess(x.Index(i), y.Index(i)) { - return true - } - if isLess(y.Index(i), x.Index(i)) { - return false - } - } - return false - case reflect.Struct: - for i := 0; i < x.NumField(); i++ { - if isLess(x.Field(i), y.Field(i)) { - return true - } - if isLess(y.Field(i), x.Field(i)) { - return false - } - } - return false - case reflect.Interface: - vx, vy := x.Elem(), y.Elem() - if !vx.IsValid() || !vy.IsValid() { - return !vx.IsValid() && vy.IsValid() - } - tx, ty := vx.Type(), vy.Type() - if tx == ty { - return isLess(x.Elem(), y.Elem()) - } - if tx.Kind() != ty.Kind() { - return vx.Kind() < vy.Kind() - } - if tx.String() != ty.String() { - return tx.String() < ty.String() - } - if tx.PkgPath() != ty.PkgPath() { - return tx.PkgPath() < ty.PkgPath() - } - // This can happen in rare situations, so we fallback to just comparing - // the unique pointer for a reflect.Type. This guarantees deterministic - // ordering within a program, but it is obviously not stable. - return reflect.ValueOf(vx.Type()).Pointer() < reflect.ValueOf(vy.Type()).Pointer() - default: - // Must be Func, Map, or Slice; which are not comparable. - panic(fmt.Sprintf("%T is not comparable", x.Type())) - } -} diff --git a/vendor/github.com/google/go-cmp/cmp/options.go b/vendor/github.com/google/go-cmp/cmp/options.go deleted file mode 100644 index 754496f3b..000000000 --- a/vendor/github.com/google/go-cmp/cmp/options.go +++ /dev/null @@ -1,554 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cmp - -import ( - "fmt" - "reflect" - "regexp" - "strings" - - "github.com/google/go-cmp/cmp/internal/function" -) - -// Option configures for specific behavior of [Equal] and [Diff]. In particular, -// the fundamental Option functions ([Ignore], [Transformer], and [Comparer]), -// configure how equality is determined. -// -// The fundamental options may be composed with filters ([FilterPath] and -// [FilterValues]) to control the scope over which they are applied. -// -// The [github.com/google/go-cmp/cmp/cmpopts] package provides helper functions -// for creating options that may be used with [Equal] and [Diff]. -type Option interface { - // filter applies all filters and returns the option that remains. - // Each option may only read s.curPath and call s.callTTBFunc. - // - // An Options is returned only if multiple comparers or transformers - // can apply simultaneously and will only contain values of those types - // or sub-Options containing values of those types. - filter(s *state, t reflect.Type, vx, vy reflect.Value) applicableOption -} - -// applicableOption represents the following types: -// -// Fundamental: ignore | validator | *comparer | *transformer -// Grouping: Options -type applicableOption interface { - Option - - // apply executes the option, which may mutate s or panic. - apply(s *state, vx, vy reflect.Value) -} - -// coreOption represents the following types: -// -// Fundamental: ignore | validator | *comparer | *transformer -// Filters: *pathFilter | *valuesFilter -type coreOption interface { - Option - isCore() -} - -type core struct{} - -func (core) isCore() {} - -// Options is a list of [Option] values that also satisfies the [Option] interface. -// Helper comparison packages may return an Options value when packing multiple -// [Option] values into a single [Option]. When this package processes an Options, -// it will be implicitly expanded into a flat list. -// -// Applying a filter on an Options is equivalent to applying that same filter -// on all individual options held within. -type Options []Option - -func (opts Options) filter(s *state, t reflect.Type, vx, vy reflect.Value) (out applicableOption) { - for _, opt := range opts { - switch opt := opt.filter(s, t, vx, vy); opt.(type) { - case ignore: - return ignore{} // Only ignore can short-circuit evaluation - case validator: - out = validator{} // Takes precedence over comparer or transformer - case *comparer, *transformer, Options: - switch out.(type) { - case nil: - out = opt - case validator: - // Keep validator - case *comparer, *transformer, Options: - out = Options{out, opt} // Conflicting comparers or transformers - } - } - } - return out -} - -func (opts Options) apply(s *state, _, _ reflect.Value) { - const warning = "ambiguous set of applicable options" - const help = "consider using filters to ensure at most one Comparer or Transformer may apply" - var ss []string - for _, opt := range flattenOptions(nil, opts) { - ss = append(ss, fmt.Sprint(opt)) - } - set := strings.Join(ss, "\n\t") - panic(fmt.Sprintf("%s at %#v:\n\t%s\n%s", warning, s.curPath, set, help)) -} - -func (opts Options) String() string { - var ss []string - for _, opt := range opts { - ss = append(ss, fmt.Sprint(opt)) - } - return fmt.Sprintf("Options{%s}", strings.Join(ss, ", ")) -} - -// FilterPath returns a new [Option] where opt is only evaluated if filter f -// returns true for the current [Path] in the value tree. -// -// This filter is called even if a slice element or map entry is missing and -// provides an opportunity to ignore such cases. The filter function must be -// symmetric such that the filter result is identical regardless of whether the -// missing value is from x or y. -// -// The option passed in may be an [Ignore], [Transformer], [Comparer], [Options], or -// a previously filtered [Option]. -func FilterPath(f func(Path) bool, opt Option) Option { - if f == nil { - panic("invalid path filter function") - } - if opt := normalizeOption(opt); opt != nil { - return &pathFilter{fnc: f, opt: opt} - } - return nil -} - -type pathFilter struct { - core - fnc func(Path) bool - opt Option -} - -func (f pathFilter) filter(s *state, t reflect.Type, vx, vy reflect.Value) applicableOption { - if f.fnc(s.curPath) { - return f.opt.filter(s, t, vx, vy) - } - return nil -} - -func (f pathFilter) String() string { - return fmt.Sprintf("FilterPath(%s, %v)", function.NameOf(reflect.ValueOf(f.fnc)), f.opt) -} - -// FilterValues returns a new [Option] where opt is only evaluated if filter f, -// which is a function of the form "func(T, T) bool", returns true for the -// current pair of values being compared. If either value is invalid or -// the type of the values is not assignable to T, then this filter implicitly -// returns false. -// -// The filter function must be -// symmetric (i.e., agnostic to the order of the inputs) and -// deterministic (i.e., produces the same result when given the same inputs). -// If T is an interface, it is possible that f is called with two values with -// different concrete types that both implement T. -// -// The option passed in may be an [Ignore], [Transformer], [Comparer], [Options], or -// a previously filtered [Option]. -func FilterValues(f interface{}, opt Option) Option { - v := reflect.ValueOf(f) - if !function.IsType(v.Type(), function.ValueFilter) || v.IsNil() { - panic(fmt.Sprintf("invalid values filter function: %T", f)) - } - if opt := normalizeOption(opt); opt != nil { - vf := &valuesFilter{fnc: v, opt: opt} - if ti := v.Type().In(0); ti.Kind() != reflect.Interface || ti.NumMethod() > 0 { - vf.typ = ti - } - return vf - } - return nil -} - -type valuesFilter struct { - core - typ reflect.Type // T - fnc reflect.Value // func(T, T) bool - opt Option -} - -func (f valuesFilter) filter(s *state, t reflect.Type, vx, vy reflect.Value) applicableOption { - if !vx.IsValid() || !vx.CanInterface() || !vy.IsValid() || !vy.CanInterface() { - return nil - } - if (f.typ == nil || t.AssignableTo(f.typ)) && s.callTTBFunc(f.fnc, vx, vy) { - return f.opt.filter(s, t, vx, vy) - } - return nil -} - -func (f valuesFilter) String() string { - return fmt.Sprintf("FilterValues(%s, %v)", function.NameOf(f.fnc), f.opt) -} - -// Ignore is an [Option] that causes all comparisons to be ignored. -// This value is intended to be combined with [FilterPath] or [FilterValues]. -// It is an error to pass an unfiltered Ignore option to [Equal]. -func Ignore() Option { return ignore{} } - -type ignore struct{ core } - -func (ignore) isFiltered() bool { return false } -func (ignore) filter(_ *state, _ reflect.Type, _, _ reflect.Value) applicableOption { return ignore{} } -func (ignore) apply(s *state, _, _ reflect.Value) { s.report(true, reportByIgnore) } -func (ignore) String() string { return "Ignore()" } - -// validator is a sentinel Option type to indicate that some options could not -// be evaluated due to unexported fields, missing slice elements, or -// missing map entries. Both values are validator only for unexported fields. -type validator struct{ core } - -func (validator) filter(_ *state, _ reflect.Type, vx, vy reflect.Value) applicableOption { - if !vx.IsValid() || !vy.IsValid() { - return validator{} - } - if !vx.CanInterface() || !vy.CanInterface() { - return validator{} - } - return nil -} -func (validator) apply(s *state, vx, vy reflect.Value) { - // Implies missing slice element or map entry. - if !vx.IsValid() || !vy.IsValid() { - s.report(vx.IsValid() == vy.IsValid(), 0) - return - } - - // Unable to Interface implies unexported field without visibility access. - if !vx.CanInterface() || !vy.CanInterface() { - help := "consider using a custom Comparer; if you control the implementation of type, you can also consider using an Exporter, AllowUnexported, or cmpopts.IgnoreUnexported" - var name string - if t := s.curPath.Index(-2).Type(); t.Name() != "" { - // Named type with unexported fields. - name = fmt.Sprintf("%q.%v", t.PkgPath(), t.Name()) // e.g., "path/to/package".MyType - if _, ok := reflect.New(t).Interface().(error); ok { - help = "consider using cmpopts.EquateErrors to compare error values" - } else if t.Comparable() { - help = "consider using cmpopts.EquateComparable to compare comparable Go types" - } - } else { - // Unnamed type with unexported fields. Derive PkgPath from field. - var pkgPath string - for i := 0; i < t.NumField() && pkgPath == ""; i++ { - pkgPath = t.Field(i).PkgPath - } - name = fmt.Sprintf("%q.(%v)", pkgPath, t.String()) // e.g., "path/to/package".(struct { a int }) - } - panic(fmt.Sprintf("cannot handle unexported field at %#v:\n\t%v\n%s", s.curPath, name, help)) - } - - panic("not reachable") -} - -// identRx represents a valid identifier according to the Go specification. -const identRx = `[_\p{L}][_\p{L}\p{N}]*` - -var identsRx = regexp.MustCompile(`^` + identRx + `(\.` + identRx + `)*$`) - -// Transformer returns an [Option] that applies a transformation function that -// converts values of a certain type into that of another. -// -// The transformer f must be a function "func(T) R" that converts values of -// type T to those of type R and is implicitly filtered to input values -// assignable to T. The transformer must not mutate T in any way. -// -// To help prevent some cases of infinite recursive cycles applying the -// same transform to the output of itself (e.g., in the case where the -// input and output types are the same), an implicit filter is added such that -// a transformer is applicable only if that exact transformer is not already -// in the tail of the [Path] since the last non-[Transform] step. -// For situations where the implicit filter is still insufficient, -// consider using [github.com/google/go-cmp/cmp/cmpopts.AcyclicTransformer], -// which adds a filter to prevent the transformer from -// being recursively applied upon itself. -// -// The name is a user provided label that is used as the [Transform.Name] in the -// transformation [PathStep] (and eventually shown in the [Diff] output). -// The name must be a valid identifier or qualified identifier in Go syntax. -// If empty, an arbitrary name is used. -func Transformer(name string, f interface{}) Option { - v := reflect.ValueOf(f) - if !function.IsType(v.Type(), function.Transformer) || v.IsNil() { - panic(fmt.Sprintf("invalid transformer function: %T", f)) - } - if name == "" { - name = function.NameOf(v) - if !identsRx.MatchString(name) { - name = "λ" // Lambda-symbol as placeholder name - } - } else if !identsRx.MatchString(name) { - panic(fmt.Sprintf("invalid name: %q", name)) - } - tr := &transformer{name: name, fnc: reflect.ValueOf(f)} - if ti := v.Type().In(0); ti.Kind() != reflect.Interface || ti.NumMethod() > 0 { - tr.typ = ti - } - return tr -} - -type transformer struct { - core - name string - typ reflect.Type // T - fnc reflect.Value // func(T) R -} - -func (tr *transformer) isFiltered() bool { return tr.typ != nil } - -func (tr *transformer) filter(s *state, t reflect.Type, _, _ reflect.Value) applicableOption { - for i := len(s.curPath) - 1; i >= 0; i-- { - if t, ok := s.curPath[i].(Transform); !ok { - break // Hit most recent non-Transform step - } else if tr == t.trans { - return nil // Cannot directly use same Transform - } - } - if tr.typ == nil || t.AssignableTo(tr.typ) { - return tr - } - return nil -} - -func (tr *transformer) apply(s *state, vx, vy reflect.Value) { - step := Transform{&transform{pathStep{typ: tr.fnc.Type().Out(0)}, tr}} - vvx := s.callTRFunc(tr.fnc, vx, step) - vvy := s.callTRFunc(tr.fnc, vy, step) - step.vx, step.vy = vvx, vvy - s.compareAny(step) -} - -func (tr transformer) String() string { - return fmt.Sprintf("Transformer(%s, %s)", tr.name, function.NameOf(tr.fnc)) -} - -// Comparer returns an [Option] that determines whether two values are equal -// to each other. -// -// The comparer f must be a function "func(T, T) bool" and is implicitly -// filtered to input values assignable to T. If T is an interface, it is -// possible that f is called with two values of different concrete types that -// both implement T. -// -// The equality function must be: -// - Symmetric: equal(x, y) == equal(y, x) -// - Deterministic: equal(x, y) == equal(x, y) -// - Pure: equal(x, y) does not modify x or y -func Comparer(f interface{}) Option { - v := reflect.ValueOf(f) - if !function.IsType(v.Type(), function.Equal) || v.IsNil() { - panic(fmt.Sprintf("invalid comparer function: %T", f)) - } - cm := &comparer{fnc: v} - if ti := v.Type().In(0); ti.Kind() != reflect.Interface || ti.NumMethod() > 0 { - cm.typ = ti - } - return cm -} - -type comparer struct { - core - typ reflect.Type // T - fnc reflect.Value // func(T, T) bool -} - -func (cm *comparer) isFiltered() bool { return cm.typ != nil } - -func (cm *comparer) filter(_ *state, t reflect.Type, _, _ reflect.Value) applicableOption { - if cm.typ == nil || t.AssignableTo(cm.typ) { - return cm - } - return nil -} - -func (cm *comparer) apply(s *state, vx, vy reflect.Value) { - eq := s.callTTBFunc(cm.fnc, vx, vy) - s.report(eq, reportByFunc) -} - -func (cm comparer) String() string { - return fmt.Sprintf("Comparer(%s)", function.NameOf(cm.fnc)) -} - -// Exporter returns an [Option] that specifies whether [Equal] is allowed to -// introspect into the unexported fields of certain struct types. -// -// Users of this option must understand that comparing on unexported fields -// from external packages is not safe since changes in the internal -// implementation of some external package may cause the result of [Equal] -// to unexpectedly change. However, it may be valid to use this option on types -// defined in an internal package where the semantic meaning of an unexported -// field is in the control of the user. -// -// In many cases, a custom [Comparer] should be used instead that defines -// equality as a function of the public API of a type rather than the underlying -// unexported implementation. -// -// For example, the [reflect.Type] documentation defines equality to be determined -// by the == operator on the interface (essentially performing a shallow pointer -// comparison) and most attempts to compare *[regexp.Regexp] types are interested -// in only checking that the regular expression strings are equal. -// Both of these are accomplished using [Comparer] options: -// -// Comparer(func(x, y reflect.Type) bool { return x == y }) -// Comparer(func(x, y *regexp.Regexp) bool { return x.String() == y.String() }) -// -// In other cases, the [github.com/google/go-cmp/cmp/cmpopts.IgnoreUnexported] -// option can be used to ignore all unexported fields on specified struct types. -func Exporter(f func(reflect.Type) bool) Option { - return exporter(f) -} - -type exporter func(reflect.Type) bool - -func (exporter) filter(_ *state, _ reflect.Type, _, _ reflect.Value) applicableOption { - panic("not implemented") -} - -// AllowUnexported returns an [Option] that allows [Equal] to forcibly introspect -// unexported fields of the specified struct types. -// -// See [Exporter] for the proper use of this option. -func AllowUnexported(types ...interface{}) Option { - m := make(map[reflect.Type]bool) - for _, typ := range types { - t := reflect.TypeOf(typ) - if t.Kind() != reflect.Struct { - panic(fmt.Sprintf("invalid struct type: %T", typ)) - } - m[t] = true - } - return exporter(func(t reflect.Type) bool { return m[t] }) -} - -// Result represents the comparison result for a single node and -// is provided by cmp when calling Report (see [Reporter]). -type Result struct { - _ [0]func() // Make Result incomparable - flags resultFlags -} - -// Equal reports whether the node was determined to be equal or not. -// As a special case, ignored nodes are considered equal. -func (r Result) Equal() bool { - return r.flags&(reportEqual|reportByIgnore) != 0 -} - -// ByIgnore reports whether the node is equal because it was ignored. -// This never reports true if [Result.Equal] reports false. -func (r Result) ByIgnore() bool { - return r.flags&reportByIgnore != 0 -} - -// ByMethod reports whether the Equal method determined equality. -func (r Result) ByMethod() bool { - return r.flags&reportByMethod != 0 -} - -// ByFunc reports whether a [Comparer] function determined equality. -func (r Result) ByFunc() bool { - return r.flags&reportByFunc != 0 -} - -// ByCycle reports whether a reference cycle was detected. -func (r Result) ByCycle() bool { - return r.flags&reportByCycle != 0 -} - -type resultFlags uint - -const ( - _ resultFlags = (1 << iota) / 2 - - reportEqual - reportUnequal - reportByIgnore - reportByMethod - reportByFunc - reportByCycle -) - -// Reporter is an [Option] that can be passed to [Equal]. When [Equal] traverses -// the value trees, it calls PushStep as it descends into each node in the -// tree and PopStep as it ascend out of the node. The leaves of the tree are -// either compared (determined to be equal or not equal) or ignored and reported -// as such by calling the Report method. -func Reporter(r interface { - // PushStep is called when a tree-traversal operation is performed. - // The PathStep itself is only valid until the step is popped. - // The PathStep.Values are valid for the duration of the entire traversal - // and must not be mutated. - // - // Equal always calls PushStep at the start to provide an operation-less - // PathStep used to report the root values. - // - // Within a slice, the exact set of inserted, removed, or modified elements - // is unspecified and may change in future implementations. - // The entries of a map are iterated through in an unspecified order. - PushStep(PathStep) - - // Report is called exactly once on leaf nodes to report whether the - // comparison identified the node as equal, unequal, or ignored. - // A leaf node is one that is immediately preceded by and followed by - // a pair of PushStep and PopStep calls. - Report(Result) - - // PopStep ascends back up the value tree. - // There is always a matching pop call for every push call. - PopStep() -}) Option { - return reporter{r} -} - -type reporter struct{ reporterIface } -type reporterIface interface { - PushStep(PathStep) - Report(Result) - PopStep() -} - -func (reporter) filter(_ *state, _ reflect.Type, _, _ reflect.Value) applicableOption { - panic("not implemented") -} - -// normalizeOption normalizes the input options such that all Options groups -// are flattened and groups with a single element are reduced to that element. -// Only coreOptions and Options containing coreOptions are allowed. -func normalizeOption(src Option) Option { - switch opts := flattenOptions(nil, Options{src}); len(opts) { - case 0: - return nil - case 1: - return opts[0] - default: - return opts - } -} - -// flattenOptions copies all options in src to dst as a flat list. -// Only coreOptions and Options containing coreOptions are allowed. -func flattenOptions(dst, src Options) Options { - for _, opt := range src { - switch opt := opt.(type) { - case nil: - continue - case Options: - dst = flattenOptions(dst, opt) - case coreOption: - dst = append(dst, opt) - default: - panic(fmt.Sprintf("invalid option type: %T", opt)) - } - } - return dst -} diff --git a/vendor/github.com/google/go-cmp/cmp/path.go b/vendor/github.com/google/go-cmp/cmp/path.go deleted file mode 100644 index c3c145642..000000000 --- a/vendor/github.com/google/go-cmp/cmp/path.go +++ /dev/null @@ -1,390 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cmp - -import ( - "fmt" - "reflect" - "strings" - "unicode" - "unicode/utf8" - - "github.com/google/go-cmp/cmp/internal/value" -) - -// Path is a list of [PathStep] describing the sequence of operations to get -// from some root type to the current position in the value tree. -// The first Path element is always an operation-less [PathStep] that exists -// simply to identify the initial type. -// -// When traversing structs with embedded structs, the embedded struct will -// always be accessed as a field before traversing the fields of the -// embedded struct themselves. That is, an exported field from the -// embedded struct will never be accessed directly from the parent struct. -type Path []PathStep - -// PathStep is a union-type for specific operations to traverse -// a value's tree structure. Users of this package never need to implement -// these types as values of this type will be returned by this package. -// -// Implementations of this interface: -// - [StructField] -// - [SliceIndex] -// - [MapIndex] -// - [Indirect] -// - [TypeAssertion] -// - [Transform] -type PathStep interface { - String() string - - // Type is the resulting type after performing the path step. - Type() reflect.Type - - // Values is the resulting values after performing the path step. - // The type of each valid value is guaranteed to be identical to Type. - // - // In some cases, one or both may be invalid or have restrictions: - // - For StructField, both are not interface-able if the current field - // is unexported and the struct type is not explicitly permitted by - // an Exporter to traverse unexported fields. - // - For SliceIndex, one may be invalid if an element is missing from - // either the x or y slice. - // - For MapIndex, one may be invalid if an entry is missing from - // either the x or y map. - // - // The provided values must not be mutated. - Values() (vx, vy reflect.Value) -} - -var ( - _ PathStep = StructField{} - _ PathStep = SliceIndex{} - _ PathStep = MapIndex{} - _ PathStep = Indirect{} - _ PathStep = TypeAssertion{} - _ PathStep = Transform{} -) - -func (pa *Path) push(s PathStep) { - *pa = append(*pa, s) -} - -func (pa *Path) pop() { - *pa = (*pa)[:len(*pa)-1] -} - -// Last returns the last [PathStep] in the Path. -// If the path is empty, this returns a non-nil [PathStep] -// that reports a nil [PathStep.Type]. -func (pa Path) Last() PathStep { - return pa.Index(-1) -} - -// Index returns the ith step in the Path and supports negative indexing. -// A negative index starts counting from the tail of the Path such that -1 -// refers to the last step, -2 refers to the second-to-last step, and so on. -// If index is invalid, this returns a non-nil [PathStep] -// that reports a nil [PathStep.Type]. -func (pa Path) Index(i int) PathStep { - if i < 0 { - i = len(pa) + i - } - if i < 0 || i >= len(pa) { - return pathStep{} - } - return pa[i] -} - -// String returns the simplified path to a node. -// The simplified path only contains struct field accesses. -// -// For example: -// -// MyMap.MySlices.MyField -func (pa Path) String() string { - var ss []string - for _, s := range pa { - if _, ok := s.(StructField); ok { - ss = append(ss, s.String()) - } - } - return strings.TrimPrefix(strings.Join(ss, ""), ".") -} - -// GoString returns the path to a specific node using Go syntax. -// -// For example: -// -// (*root.MyMap["key"].(*mypkg.MyStruct).MySlices)[2][3].MyField -func (pa Path) GoString() string { - var ssPre, ssPost []string - var numIndirect int - for i, s := range pa { - var nextStep PathStep - if i+1 < len(pa) { - nextStep = pa[i+1] - } - switch s := s.(type) { - case Indirect: - numIndirect++ - pPre, pPost := "(", ")" - switch nextStep.(type) { - case Indirect: - continue // Next step is indirection, so let them batch up - case StructField: - numIndirect-- // Automatic indirection on struct fields - case nil: - pPre, pPost = "", "" // Last step; no need for parenthesis - } - if numIndirect > 0 { - ssPre = append(ssPre, pPre+strings.Repeat("*", numIndirect)) - ssPost = append(ssPost, pPost) - } - numIndirect = 0 - continue - case Transform: - ssPre = append(ssPre, s.trans.name+"(") - ssPost = append(ssPost, ")") - continue - } - ssPost = append(ssPost, s.String()) - } - for i, j := 0, len(ssPre)-1; i < j; i, j = i+1, j-1 { - ssPre[i], ssPre[j] = ssPre[j], ssPre[i] - } - return strings.Join(ssPre, "") + strings.Join(ssPost, "") -} - -type pathStep struct { - typ reflect.Type - vx, vy reflect.Value -} - -func (ps pathStep) Type() reflect.Type { return ps.typ } -func (ps pathStep) Values() (vx, vy reflect.Value) { return ps.vx, ps.vy } -func (ps pathStep) String() string { - if ps.typ == nil { - return "" - } - s := value.TypeString(ps.typ, false) - if s == "" || strings.ContainsAny(s, "{}\n") { - return "root" // Type too simple or complex to print - } - return fmt.Sprintf("{%s}", s) -} - -// StructField is a [PathStep] that represents a struct field access -// on a field called [StructField.Name]. -type StructField struct{ *structField } -type structField struct { - pathStep - name string - idx int - - // These fields are used for forcibly accessing an unexported field. - // pvx, pvy, and field are only valid if unexported is true. - unexported bool - mayForce bool // Forcibly allow visibility - paddr bool // Was parent addressable? - pvx, pvy reflect.Value // Parent values (always addressable) - field reflect.StructField // Field information -} - -func (sf StructField) Type() reflect.Type { return sf.typ } -func (sf StructField) Values() (vx, vy reflect.Value) { - if !sf.unexported { - return sf.vx, sf.vy // CanInterface reports true - } - - // Forcibly obtain read-write access to an unexported struct field. - if sf.mayForce { - vx = retrieveUnexportedField(sf.pvx, sf.field, sf.paddr) - vy = retrieveUnexportedField(sf.pvy, sf.field, sf.paddr) - return vx, vy // CanInterface reports true - } - return sf.vx, sf.vy // CanInterface reports false -} -func (sf StructField) String() string { return fmt.Sprintf(".%s", sf.name) } - -// Name is the field name. -func (sf StructField) Name() string { return sf.name } - -// Index is the index of the field in the parent struct type. -// See [reflect.Type.Field]. -func (sf StructField) Index() int { return sf.idx } - -// SliceIndex is a [PathStep] that represents an index operation on -// a slice or array at some index [SliceIndex.Key]. -type SliceIndex struct{ *sliceIndex } -type sliceIndex struct { - pathStep - xkey, ykey int - isSlice bool // False for reflect.Array -} - -func (si SliceIndex) Type() reflect.Type { return si.typ } -func (si SliceIndex) Values() (vx, vy reflect.Value) { return si.vx, si.vy } -func (si SliceIndex) String() string { - switch { - case si.xkey == si.ykey: - return fmt.Sprintf("[%d]", si.xkey) - case si.ykey == -1: - // [5->?] means "I don't know where X[5] went" - return fmt.Sprintf("[%d->?]", si.xkey) - case si.xkey == -1: - // [?->3] means "I don't know where Y[3] came from" - return fmt.Sprintf("[?->%d]", si.ykey) - default: - // [5->3] means "X[5] moved to Y[3]" - return fmt.Sprintf("[%d->%d]", si.xkey, si.ykey) - } -} - -// Key is the index key; it may return -1 if in a split state -func (si SliceIndex) Key() int { - if si.xkey != si.ykey { - return -1 - } - return si.xkey -} - -// SplitKeys are the indexes for indexing into slices in the -// x and y values, respectively. These indexes may differ due to the -// insertion or removal of an element in one of the slices, causing -// all of the indexes to be shifted. If an index is -1, then that -// indicates that the element does not exist in the associated slice. -// -// [SliceIndex.Key] is guaranteed to return -1 if and only if the indexes -// returned by SplitKeys are not the same. SplitKeys will never return -1 for -// both indexes. -func (si SliceIndex) SplitKeys() (ix, iy int) { return si.xkey, si.ykey } - -// MapIndex is a [PathStep] that represents an index operation on a map at some index Key. -type MapIndex struct{ *mapIndex } -type mapIndex struct { - pathStep - key reflect.Value -} - -func (mi MapIndex) Type() reflect.Type { return mi.typ } -func (mi MapIndex) Values() (vx, vy reflect.Value) { return mi.vx, mi.vy } -func (mi MapIndex) String() string { return fmt.Sprintf("[%#v]", mi.key) } - -// Key is the value of the map key. -func (mi MapIndex) Key() reflect.Value { return mi.key } - -// Indirect is a [PathStep] that represents pointer indirection on the parent type. -type Indirect struct{ *indirect } -type indirect struct { - pathStep -} - -func (in Indirect) Type() reflect.Type { return in.typ } -func (in Indirect) Values() (vx, vy reflect.Value) { return in.vx, in.vy } -func (in Indirect) String() string { return "*" } - -// TypeAssertion is a [PathStep] that represents a type assertion on an interface. -type TypeAssertion struct{ *typeAssertion } -type typeAssertion struct { - pathStep -} - -func (ta TypeAssertion) Type() reflect.Type { return ta.typ } -func (ta TypeAssertion) Values() (vx, vy reflect.Value) { return ta.vx, ta.vy } -func (ta TypeAssertion) String() string { return fmt.Sprintf(".(%v)", value.TypeString(ta.typ, false)) } - -// Transform is a [PathStep] that represents a transformation -// from the parent type to the current type. -type Transform struct{ *transform } -type transform struct { - pathStep - trans *transformer -} - -func (tf Transform) Type() reflect.Type { return tf.typ } -func (tf Transform) Values() (vx, vy reflect.Value) { return tf.vx, tf.vy } -func (tf Transform) String() string { return fmt.Sprintf("%s()", tf.trans.name) } - -// Name is the name of the [Transformer]. -func (tf Transform) Name() string { return tf.trans.name } - -// Func is the function pointer to the transformer function. -func (tf Transform) Func() reflect.Value { return tf.trans.fnc } - -// Option returns the originally constructed [Transformer] option. -// The == operator can be used to detect the exact option used. -func (tf Transform) Option() Option { return tf.trans } - -// pointerPath represents a dual-stack of pointers encountered when -// recursively traversing the x and y values. This data structure supports -// detection of cycles and determining whether the cycles are equal. -// In Go, cycles can occur via pointers, slices, and maps. -// -// The pointerPath uses a map to represent a stack; where descension into a -// pointer pushes the address onto the stack, and ascension from a pointer -// pops the address from the stack. Thus, when traversing into a pointer from -// reflect.Ptr, reflect.Slice element, or reflect.Map, we can detect cycles -// by checking whether the pointer has already been visited. The cycle detection -// uses a separate stack for the x and y values. -// -// If a cycle is detected we need to determine whether the two pointers -// should be considered equal. The definition of equality chosen by Equal -// requires two graphs to have the same structure. To determine this, both the -// x and y values must have a cycle where the previous pointers were also -// encountered together as a pair. -// -// Semantically, this is equivalent to augmenting Indirect, SliceIndex, and -// MapIndex with pointer information for the x and y values. -// Suppose px and py are two pointers to compare, we then search the -// Path for whether px was ever encountered in the Path history of x, and -// similarly so with py. If either side has a cycle, the comparison is only -// equal if both px and py have a cycle resulting from the same PathStep. -// -// Using a map as a stack is more performant as we can perform cycle detection -// in O(1) instead of O(N) where N is len(Path). -type pointerPath struct { - // mx is keyed by x pointers, where the value is the associated y pointer. - mx map[value.Pointer]value.Pointer - // my is keyed by y pointers, where the value is the associated x pointer. - my map[value.Pointer]value.Pointer -} - -func (p *pointerPath) Init() { - p.mx = make(map[value.Pointer]value.Pointer) - p.my = make(map[value.Pointer]value.Pointer) -} - -// Push indicates intent to descend into pointers vx and vy where -// visited reports whether either has been seen before. If visited before, -// equal reports whether both pointers were encountered together. -// Pop must be called if and only if the pointers were never visited. -// -// The pointers vx and vy must be a reflect.Ptr, reflect.Slice, or reflect.Map -// and be non-nil. -func (p pointerPath) Push(vx, vy reflect.Value) (equal, visited bool) { - px := value.PointerOf(vx) - py := value.PointerOf(vy) - _, ok1 := p.mx[px] - _, ok2 := p.my[py] - if ok1 || ok2 { - equal = p.mx[px] == py && p.my[py] == px // Pointers paired together - return equal, true - } - p.mx[px] = py - p.my[py] = px - return false, false -} - -// Pop ascends from pointers vx and vy. -func (p pointerPath) Pop(vx, vy reflect.Value) { - delete(p.mx, value.PointerOf(vx)) - delete(p.my, value.PointerOf(vy)) -} - -// isExported reports whether the identifier is exported. -func isExported(id string) bool { - r, _ := utf8.DecodeRuneInString(id) - return unicode.IsUpper(r) -} diff --git a/vendor/github.com/google/go-cmp/cmp/report.go b/vendor/github.com/google/go-cmp/cmp/report.go deleted file mode 100644 index f43cd12eb..000000000 --- a/vendor/github.com/google/go-cmp/cmp/report.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cmp - -// defaultReporter implements the reporter interface. -// -// As Equal serially calls the PushStep, Report, and PopStep methods, the -// defaultReporter constructs a tree-based representation of the compared value -// and the result of each comparison (see valueNode). -// -// When the String method is called, the FormatDiff method transforms the -// valueNode tree into a textNode tree, which is a tree-based representation -// of the textual output (see textNode). -// -// Lastly, the textNode.String method produces the final report as a string. -type defaultReporter struct { - root *valueNode - curr *valueNode -} - -func (r *defaultReporter) PushStep(ps PathStep) { - r.curr = r.curr.PushStep(ps) - if r.root == nil { - r.root = r.curr - } -} -func (r *defaultReporter) Report(rs Result) { - r.curr.Report(rs) -} -func (r *defaultReporter) PopStep() { - r.curr = r.curr.PopStep() -} - -// String provides a full report of the differences detected as a structured -// literal in pseudo-Go syntax. String may only be called after the entire tree -// has been traversed. -func (r *defaultReporter) String() string { - assert(r.root != nil && r.curr == nil) - if r.root.NumDiff == 0 { - return "" - } - ptrs := new(pointerReferences) - text := formatOptions{}.FormatDiff(r.root, ptrs) - resolveReferences(text) - return text.String() -} - -func assert(ok bool) { - if !ok { - panic("assertion failure") - } -} diff --git a/vendor/github.com/google/go-cmp/cmp/report_compare.go b/vendor/github.com/google/go-cmp/cmp/report_compare.go deleted file mode 100644 index 2050bf6b4..000000000 --- a/vendor/github.com/google/go-cmp/cmp/report_compare.go +++ /dev/null @@ -1,433 +0,0 @@ -// Copyright 2019, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cmp - -import ( - "fmt" - "reflect" -) - -// numContextRecords is the number of surrounding equal records to print. -const numContextRecords = 2 - -type diffMode byte - -const ( - diffUnknown diffMode = 0 - diffIdentical diffMode = ' ' - diffRemoved diffMode = '-' - diffInserted diffMode = '+' -) - -type typeMode int - -const ( - // emitType always prints the type. - emitType typeMode = iota - // elideType never prints the type. - elideType - // autoType prints the type only for composite kinds - // (i.e., structs, slices, arrays, and maps). - autoType -) - -type formatOptions struct { - // DiffMode controls the output mode of FormatDiff. - // - // If diffUnknown, then produce a diff of the x and y values. - // If diffIdentical, then emit values as if they were equal. - // If diffRemoved, then only emit x values (ignoring y values). - // If diffInserted, then only emit y values (ignoring x values). - DiffMode diffMode - - // TypeMode controls whether to print the type for the current node. - // - // As a general rule of thumb, we always print the type of the next node - // after an interface, and always elide the type of the next node after - // a slice or map node. - TypeMode typeMode - - // formatValueOptions are options specific to printing reflect.Values. - formatValueOptions -} - -func (opts formatOptions) WithDiffMode(d diffMode) formatOptions { - opts.DiffMode = d - return opts -} -func (opts formatOptions) WithTypeMode(t typeMode) formatOptions { - opts.TypeMode = t - return opts -} -func (opts formatOptions) WithVerbosity(level int) formatOptions { - opts.VerbosityLevel = level - opts.LimitVerbosity = true - return opts -} -func (opts formatOptions) verbosity() uint { - switch { - case opts.VerbosityLevel < 0: - return 0 - case opts.VerbosityLevel > 16: - return 16 // some reasonable maximum to avoid shift overflow - default: - return uint(opts.VerbosityLevel) - } -} - -const maxVerbosityPreset = 6 - -// verbosityPreset modifies the verbosity settings given an index -// between 0 and maxVerbosityPreset, inclusive. -func verbosityPreset(opts formatOptions, i int) formatOptions { - opts.VerbosityLevel = int(opts.verbosity()) + 2*i - if i > 0 { - opts.AvoidStringer = true - } - if i >= maxVerbosityPreset { - opts.PrintAddresses = true - opts.QualifiedNames = true - } - return opts -} - -// FormatDiff converts a valueNode tree into a textNode tree, where the later -// is a textual representation of the differences detected in the former. -func (opts formatOptions) FormatDiff(v *valueNode, ptrs *pointerReferences) (out textNode) { - if opts.DiffMode == diffIdentical { - opts = opts.WithVerbosity(1) - } else if opts.verbosity() < 3 { - opts = opts.WithVerbosity(3) - } - - // Check whether we have specialized formatting for this node. - // This is not necessary, but helpful for producing more readable outputs. - if opts.CanFormatDiffSlice(v) { - return opts.FormatDiffSlice(v) - } - - var parentKind reflect.Kind - if v.parent != nil && v.parent.TransformerName == "" { - parentKind = v.parent.Type.Kind() - } - - // For leaf nodes, format the value based on the reflect.Values alone. - // As a special case, treat equal []byte as a leaf nodes. - isBytes := v.Type.Kind() == reflect.Slice && v.Type.Elem() == byteType - isEqualBytes := isBytes && v.NumDiff+v.NumIgnored+v.NumTransformed == 0 - if v.MaxDepth == 0 || isEqualBytes { - switch opts.DiffMode { - case diffUnknown, diffIdentical: - // Format Equal. - if v.NumDiff == 0 { - outx := opts.FormatValue(v.ValueX, parentKind, ptrs) - outy := opts.FormatValue(v.ValueY, parentKind, ptrs) - if v.NumIgnored > 0 && v.NumSame == 0 { - return textEllipsis - } else if outx.Len() < outy.Len() { - return outx - } else { - return outy - } - } - - // Format unequal. - assert(opts.DiffMode == diffUnknown) - var list textList - outx := opts.WithTypeMode(elideType).FormatValue(v.ValueX, parentKind, ptrs) - outy := opts.WithTypeMode(elideType).FormatValue(v.ValueY, parentKind, ptrs) - for i := 0; i <= maxVerbosityPreset && outx != nil && outy != nil && outx.Equal(outy); i++ { - opts2 := verbosityPreset(opts, i).WithTypeMode(elideType) - outx = opts2.FormatValue(v.ValueX, parentKind, ptrs) - outy = opts2.FormatValue(v.ValueY, parentKind, ptrs) - } - if outx != nil { - list = append(list, textRecord{Diff: '-', Value: outx}) - } - if outy != nil { - list = append(list, textRecord{Diff: '+', Value: outy}) - } - return opts.WithTypeMode(emitType).FormatType(v.Type, list) - case diffRemoved: - return opts.FormatValue(v.ValueX, parentKind, ptrs) - case diffInserted: - return opts.FormatValue(v.ValueY, parentKind, ptrs) - default: - panic("invalid diff mode") - } - } - - // Register slice element to support cycle detection. - if parentKind == reflect.Slice { - ptrRefs := ptrs.PushPair(v.ValueX, v.ValueY, opts.DiffMode, true) - defer ptrs.Pop() - defer func() { out = wrapTrunkReferences(ptrRefs, out) }() - } - - // Descend into the child value node. - if v.TransformerName != "" { - out := opts.WithTypeMode(emitType).FormatDiff(v.Value, ptrs) - out = &textWrap{Prefix: "Inverse(" + v.TransformerName + ", ", Value: out, Suffix: ")"} - return opts.FormatType(v.Type, out) - } else { - switch k := v.Type.Kind(); k { - case reflect.Struct, reflect.Array, reflect.Slice: - out = opts.formatDiffList(v.Records, k, ptrs) - out = opts.FormatType(v.Type, out) - case reflect.Map: - // Register map to support cycle detection. - ptrRefs := ptrs.PushPair(v.ValueX, v.ValueY, opts.DiffMode, false) - defer ptrs.Pop() - - out = opts.formatDiffList(v.Records, k, ptrs) - out = wrapTrunkReferences(ptrRefs, out) - out = opts.FormatType(v.Type, out) - case reflect.Ptr: - // Register pointer to support cycle detection. - ptrRefs := ptrs.PushPair(v.ValueX, v.ValueY, opts.DiffMode, false) - defer ptrs.Pop() - - out = opts.FormatDiff(v.Value, ptrs) - out = wrapTrunkReferences(ptrRefs, out) - out = &textWrap{Prefix: "&", Value: out} - case reflect.Interface: - out = opts.WithTypeMode(emitType).FormatDiff(v.Value, ptrs) - default: - panic(fmt.Sprintf("%v cannot have children", k)) - } - return out - } -} - -func (opts formatOptions) formatDiffList(recs []reportRecord, k reflect.Kind, ptrs *pointerReferences) textNode { - // Derive record name based on the data structure kind. - var name string - var formatKey func(reflect.Value) string - switch k { - case reflect.Struct: - name = "field" - opts = opts.WithTypeMode(autoType) - formatKey = func(v reflect.Value) string { return v.String() } - case reflect.Slice, reflect.Array: - name = "element" - opts = opts.WithTypeMode(elideType) - formatKey = func(reflect.Value) string { return "" } - case reflect.Map: - name = "entry" - opts = opts.WithTypeMode(elideType) - formatKey = func(v reflect.Value) string { return formatMapKey(v, false, ptrs) } - } - - maxLen := -1 - if opts.LimitVerbosity { - if opts.DiffMode == diffIdentical { - maxLen = ((1 << opts.verbosity()) >> 1) << 2 // 0, 4, 8, 16, 32, etc... - } else { - maxLen = (1 << opts.verbosity()) << 1 // 2, 4, 8, 16, 32, 64, etc... - } - opts.VerbosityLevel-- - } - - // Handle unification. - switch opts.DiffMode { - case diffIdentical, diffRemoved, diffInserted: - var list textList - var deferredEllipsis bool // Add final "..." to indicate records were dropped - for _, r := range recs { - if len(list) == maxLen { - deferredEllipsis = true - break - } - - // Elide struct fields that are zero value. - if k == reflect.Struct { - var isZero bool - switch opts.DiffMode { - case diffIdentical: - isZero = r.Value.ValueX.IsZero() || r.Value.ValueY.IsZero() - case diffRemoved: - isZero = r.Value.ValueX.IsZero() - case diffInserted: - isZero = r.Value.ValueY.IsZero() - } - if isZero { - continue - } - } - // Elide ignored nodes. - if r.Value.NumIgnored > 0 && r.Value.NumSame+r.Value.NumDiff == 0 { - deferredEllipsis = !(k == reflect.Slice || k == reflect.Array) - if !deferredEllipsis { - list.AppendEllipsis(diffStats{}) - } - continue - } - if out := opts.FormatDiff(r.Value, ptrs); out != nil { - list = append(list, textRecord{Key: formatKey(r.Key), Value: out}) - } - } - if deferredEllipsis { - list.AppendEllipsis(diffStats{}) - } - return &textWrap{Prefix: "{", Value: list, Suffix: "}"} - case diffUnknown: - default: - panic("invalid diff mode") - } - - // Handle differencing. - var numDiffs int - var list textList - var keys []reflect.Value // invariant: len(list) == len(keys) - groups := coalesceAdjacentRecords(name, recs) - maxGroup := diffStats{Name: name} - for i, ds := range groups { - if maxLen >= 0 && numDiffs >= maxLen { - maxGroup = maxGroup.Append(ds) - continue - } - - // Handle equal records. - if ds.NumDiff() == 0 { - // Compute the number of leading and trailing records to print. - var numLo, numHi int - numEqual := ds.NumIgnored + ds.NumIdentical - for numLo < numContextRecords && numLo+numHi < numEqual && i != 0 { - if r := recs[numLo].Value; r.NumIgnored > 0 && r.NumSame+r.NumDiff == 0 { - break - } - numLo++ - } - for numHi < numContextRecords && numLo+numHi < numEqual && i != len(groups)-1 { - if r := recs[numEqual-numHi-1].Value; r.NumIgnored > 0 && r.NumSame+r.NumDiff == 0 { - break - } - numHi++ - } - if numEqual-(numLo+numHi) == 1 && ds.NumIgnored == 0 { - numHi++ // Avoid pointless coalescing of a single equal record - } - - // Format the equal values. - for _, r := range recs[:numLo] { - out := opts.WithDiffMode(diffIdentical).FormatDiff(r.Value, ptrs) - list = append(list, textRecord{Key: formatKey(r.Key), Value: out}) - keys = append(keys, r.Key) - } - if numEqual > numLo+numHi { - ds.NumIdentical -= numLo + numHi - list.AppendEllipsis(ds) - for len(keys) < len(list) { - keys = append(keys, reflect.Value{}) - } - } - for _, r := range recs[numEqual-numHi : numEqual] { - out := opts.WithDiffMode(diffIdentical).FormatDiff(r.Value, ptrs) - list = append(list, textRecord{Key: formatKey(r.Key), Value: out}) - keys = append(keys, r.Key) - } - recs = recs[numEqual:] - continue - } - - // Handle unequal records. - for _, r := range recs[:ds.NumDiff()] { - switch { - case opts.CanFormatDiffSlice(r.Value): - out := opts.FormatDiffSlice(r.Value) - list = append(list, textRecord{Key: formatKey(r.Key), Value: out}) - keys = append(keys, r.Key) - case r.Value.NumChildren == r.Value.MaxDepth: - outx := opts.WithDiffMode(diffRemoved).FormatDiff(r.Value, ptrs) - outy := opts.WithDiffMode(diffInserted).FormatDiff(r.Value, ptrs) - for i := 0; i <= maxVerbosityPreset && outx != nil && outy != nil && outx.Equal(outy); i++ { - opts2 := verbosityPreset(opts, i) - outx = opts2.WithDiffMode(diffRemoved).FormatDiff(r.Value, ptrs) - outy = opts2.WithDiffMode(diffInserted).FormatDiff(r.Value, ptrs) - } - if outx != nil { - list = append(list, textRecord{Diff: diffRemoved, Key: formatKey(r.Key), Value: outx}) - keys = append(keys, r.Key) - } - if outy != nil { - list = append(list, textRecord{Diff: diffInserted, Key: formatKey(r.Key), Value: outy}) - keys = append(keys, r.Key) - } - default: - out := opts.FormatDiff(r.Value, ptrs) - list = append(list, textRecord{Key: formatKey(r.Key), Value: out}) - keys = append(keys, r.Key) - } - } - recs = recs[ds.NumDiff():] - numDiffs += ds.NumDiff() - } - if maxGroup.IsZero() { - assert(len(recs) == 0) - } else { - list.AppendEllipsis(maxGroup) - for len(keys) < len(list) { - keys = append(keys, reflect.Value{}) - } - } - assert(len(list) == len(keys)) - - // For maps, the default formatting logic uses fmt.Stringer which may - // produce ambiguous output. Avoid calling String to disambiguate. - if k == reflect.Map { - var ambiguous bool - seenKeys := map[string]reflect.Value{} - for i, currKey := range keys { - if currKey.IsValid() { - strKey := list[i].Key - prevKey, seen := seenKeys[strKey] - if seen && prevKey.CanInterface() && currKey.CanInterface() { - ambiguous = prevKey.Interface() != currKey.Interface() - if ambiguous { - break - } - } - seenKeys[strKey] = currKey - } - } - if ambiguous { - for i, k := range keys { - if k.IsValid() { - list[i].Key = formatMapKey(k, true, ptrs) - } - } - } - } - - return &textWrap{Prefix: "{", Value: list, Suffix: "}"} -} - -// coalesceAdjacentRecords coalesces the list of records into groups of -// adjacent equal, or unequal counts. -func coalesceAdjacentRecords(name string, recs []reportRecord) (groups []diffStats) { - var prevCase int // Arbitrary index into which case last occurred - lastStats := func(i int) *diffStats { - if prevCase != i { - groups = append(groups, diffStats{Name: name}) - prevCase = i - } - return &groups[len(groups)-1] - } - for _, r := range recs { - switch rv := r.Value; { - case rv.NumIgnored > 0 && rv.NumSame+rv.NumDiff == 0: - lastStats(1).NumIgnored++ - case rv.NumDiff == 0: - lastStats(1).NumIdentical++ - case rv.NumDiff > 0 && !rv.ValueY.IsValid(): - lastStats(2).NumRemoved++ - case rv.NumDiff > 0 && !rv.ValueX.IsValid(): - lastStats(2).NumInserted++ - default: - lastStats(2).NumModified++ - } - } - return groups -} diff --git a/vendor/github.com/google/go-cmp/cmp/report_references.go b/vendor/github.com/google/go-cmp/cmp/report_references.go deleted file mode 100644 index be31b33a9..000000000 --- a/vendor/github.com/google/go-cmp/cmp/report_references.go +++ /dev/null @@ -1,264 +0,0 @@ -// Copyright 2020, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cmp - -import ( - "fmt" - "reflect" - "strings" - - "github.com/google/go-cmp/cmp/internal/flags" - "github.com/google/go-cmp/cmp/internal/value" -) - -const ( - pointerDelimPrefix = "⟪" - pointerDelimSuffix = "⟫" -) - -// formatPointer prints the address of the pointer. -func formatPointer(p value.Pointer, withDelims bool) string { - v := p.Uintptr() - if flags.Deterministic { - v = 0xdeadf00f // Only used for stable testing purposes - } - if withDelims { - return pointerDelimPrefix + formatHex(uint64(v)) + pointerDelimSuffix - } - return formatHex(uint64(v)) -} - -// pointerReferences is a stack of pointers visited so far. -type pointerReferences [][2]value.Pointer - -func (ps *pointerReferences) PushPair(vx, vy reflect.Value, d diffMode, deref bool) (pp [2]value.Pointer) { - if deref && vx.IsValid() { - vx = vx.Addr() - } - if deref && vy.IsValid() { - vy = vy.Addr() - } - switch d { - case diffUnknown, diffIdentical: - pp = [2]value.Pointer{value.PointerOf(vx), value.PointerOf(vy)} - case diffRemoved: - pp = [2]value.Pointer{value.PointerOf(vx), value.Pointer{}} - case diffInserted: - pp = [2]value.Pointer{value.Pointer{}, value.PointerOf(vy)} - } - *ps = append(*ps, pp) - return pp -} - -func (ps *pointerReferences) Push(v reflect.Value) (p value.Pointer, seen bool) { - p = value.PointerOf(v) - for _, pp := range *ps { - if p == pp[0] || p == pp[1] { - return p, true - } - } - *ps = append(*ps, [2]value.Pointer{p, p}) - return p, false -} - -func (ps *pointerReferences) Pop() { - *ps = (*ps)[:len(*ps)-1] -} - -// trunkReferences is metadata for a textNode indicating that the sub-tree -// represents the value for either pointer in a pair of references. -type trunkReferences struct{ pp [2]value.Pointer } - -// trunkReference is metadata for a textNode indicating that the sub-tree -// represents the value for the given pointer reference. -type trunkReference struct{ p value.Pointer } - -// leafReference is metadata for a textNode indicating that the value is -// truncated as it refers to another part of the tree (i.e., a trunk). -type leafReference struct{ p value.Pointer } - -func wrapTrunkReferences(pp [2]value.Pointer, s textNode) textNode { - switch { - case pp[0].IsNil(): - return &textWrap{Value: s, Metadata: trunkReference{pp[1]}} - case pp[1].IsNil(): - return &textWrap{Value: s, Metadata: trunkReference{pp[0]}} - case pp[0] == pp[1]: - return &textWrap{Value: s, Metadata: trunkReference{pp[0]}} - default: - return &textWrap{Value: s, Metadata: trunkReferences{pp}} - } -} -func wrapTrunkReference(p value.Pointer, printAddress bool, s textNode) textNode { - var prefix string - if printAddress { - prefix = formatPointer(p, true) - } - return &textWrap{Prefix: prefix, Value: s, Metadata: trunkReference{p}} -} -func makeLeafReference(p value.Pointer, printAddress bool) textNode { - out := &textWrap{Prefix: "(", Value: textEllipsis, Suffix: ")"} - var prefix string - if printAddress { - prefix = formatPointer(p, true) - } - return &textWrap{Prefix: prefix, Value: out, Metadata: leafReference{p}} -} - -// resolveReferences walks the textNode tree searching for any leaf reference -// metadata and resolves each against the corresponding trunk references. -// Since pointer addresses in memory are not particularly readable to the user, -// it replaces each pointer value with an arbitrary and unique reference ID. -func resolveReferences(s textNode) { - var walkNodes func(textNode, func(textNode)) - walkNodes = func(s textNode, f func(textNode)) { - f(s) - switch s := s.(type) { - case *textWrap: - walkNodes(s.Value, f) - case textList: - for _, r := range s { - walkNodes(r.Value, f) - } - } - } - - // Collect all trunks and leaves with reference metadata. - var trunks, leaves []*textWrap - walkNodes(s, func(s textNode) { - if s, ok := s.(*textWrap); ok { - switch s.Metadata.(type) { - case leafReference: - leaves = append(leaves, s) - case trunkReference, trunkReferences: - trunks = append(trunks, s) - } - } - }) - - // No leaf references to resolve. - if len(leaves) == 0 { - return - } - - // Collect the set of all leaf references to resolve. - leafPtrs := make(map[value.Pointer]bool) - for _, leaf := range leaves { - leafPtrs[leaf.Metadata.(leafReference).p] = true - } - - // Collect the set of trunk pointers that are always paired together. - // This allows us to assign a single ID to both pointers for brevity. - // If a pointer in a pair ever occurs by itself or as a different pair, - // then the pair is broken. - pairedTrunkPtrs := make(map[value.Pointer]value.Pointer) - unpair := func(p value.Pointer) { - if !pairedTrunkPtrs[p].IsNil() { - pairedTrunkPtrs[pairedTrunkPtrs[p]] = value.Pointer{} // invalidate other half - } - pairedTrunkPtrs[p] = value.Pointer{} // invalidate this half - } - for _, trunk := range trunks { - switch p := trunk.Metadata.(type) { - case trunkReference: - unpair(p.p) // standalone pointer cannot be part of a pair - case trunkReferences: - p0, ok0 := pairedTrunkPtrs[p.pp[0]] - p1, ok1 := pairedTrunkPtrs[p.pp[1]] - switch { - case !ok0 && !ok1: - // Register the newly seen pair. - pairedTrunkPtrs[p.pp[0]] = p.pp[1] - pairedTrunkPtrs[p.pp[1]] = p.pp[0] - case ok0 && ok1 && p0 == p.pp[1] && p1 == p.pp[0]: - // Exact pair already seen; do nothing. - default: - // Pair conflicts with some other pair; break all pairs. - unpair(p.pp[0]) - unpair(p.pp[1]) - } - } - } - - // Correlate each pointer referenced by leaves to a unique identifier, - // and print the IDs for each trunk that matches those pointers. - var nextID uint - ptrIDs := make(map[value.Pointer]uint) - newID := func() uint { - id := nextID - nextID++ - return id - } - for _, trunk := range trunks { - switch p := trunk.Metadata.(type) { - case trunkReference: - if print := leafPtrs[p.p]; print { - id, ok := ptrIDs[p.p] - if !ok { - id = newID() - ptrIDs[p.p] = id - } - trunk.Prefix = updateReferencePrefix(trunk.Prefix, formatReference(id)) - } - case trunkReferences: - print0 := leafPtrs[p.pp[0]] - print1 := leafPtrs[p.pp[1]] - if print0 || print1 { - id0, ok0 := ptrIDs[p.pp[0]] - id1, ok1 := ptrIDs[p.pp[1]] - isPair := pairedTrunkPtrs[p.pp[0]] == p.pp[1] && pairedTrunkPtrs[p.pp[1]] == p.pp[0] - if isPair { - var id uint - assert(ok0 == ok1) // must be seen together or not at all - if ok0 { - assert(id0 == id1) // must have the same ID - id = id0 - } else { - id = newID() - ptrIDs[p.pp[0]] = id - ptrIDs[p.pp[1]] = id - } - trunk.Prefix = updateReferencePrefix(trunk.Prefix, formatReference(id)) - } else { - if print0 && !ok0 { - id0 = newID() - ptrIDs[p.pp[0]] = id0 - } - if print1 && !ok1 { - id1 = newID() - ptrIDs[p.pp[1]] = id1 - } - switch { - case print0 && print1: - trunk.Prefix = updateReferencePrefix(trunk.Prefix, formatReference(id0)+","+formatReference(id1)) - case print0: - trunk.Prefix = updateReferencePrefix(trunk.Prefix, formatReference(id0)) - case print1: - trunk.Prefix = updateReferencePrefix(trunk.Prefix, formatReference(id1)) - } - } - } - } - } - - // Update all leaf references with the unique identifier. - for _, leaf := range leaves { - if id, ok := ptrIDs[leaf.Metadata.(leafReference).p]; ok { - leaf.Prefix = updateReferencePrefix(leaf.Prefix, formatReference(id)) - } - } -} - -func formatReference(id uint) string { - return fmt.Sprintf("ref#%d", id) -} - -func updateReferencePrefix(prefix, ref string) string { - if prefix == "" { - return pointerDelimPrefix + ref + pointerDelimSuffix - } - suffix := strings.TrimPrefix(prefix, pointerDelimPrefix) - return pointerDelimPrefix + ref + ": " + suffix -} diff --git a/vendor/github.com/google/go-cmp/cmp/report_reflect.go b/vendor/github.com/google/go-cmp/cmp/report_reflect.go deleted file mode 100644 index e39f42284..000000000 --- a/vendor/github.com/google/go-cmp/cmp/report_reflect.go +++ /dev/null @@ -1,414 +0,0 @@ -// Copyright 2019, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cmp - -import ( - "bytes" - "fmt" - "reflect" - "strconv" - "strings" - "unicode" - "unicode/utf8" - - "github.com/google/go-cmp/cmp/internal/value" -) - -var ( - anyType = reflect.TypeOf((*interface{})(nil)).Elem() - stringType = reflect.TypeOf((*string)(nil)).Elem() - bytesType = reflect.TypeOf((*[]byte)(nil)).Elem() - byteType = reflect.TypeOf((*byte)(nil)).Elem() -) - -type formatValueOptions struct { - // AvoidStringer controls whether to avoid calling custom stringer - // methods like error.Error or fmt.Stringer.String. - AvoidStringer bool - - // PrintAddresses controls whether to print the address of all pointers, - // slice elements, and maps. - PrintAddresses bool - - // QualifiedNames controls whether FormatType uses the fully qualified name - // (including the full package path as opposed to just the package name). - QualifiedNames bool - - // VerbosityLevel controls the amount of output to produce. - // A higher value produces more output. A value of zero or lower produces - // no output (represented using an ellipsis). - // If LimitVerbosity is false, then the level is treated as infinite. - VerbosityLevel int - - // LimitVerbosity specifies that formatting should respect VerbosityLevel. - LimitVerbosity bool -} - -// FormatType prints the type as if it were wrapping s. -// This may return s as-is depending on the current type and TypeMode mode. -func (opts formatOptions) FormatType(t reflect.Type, s textNode) textNode { - // Check whether to emit the type or not. - switch opts.TypeMode { - case autoType: - switch t.Kind() { - case reflect.Struct, reflect.Slice, reflect.Array, reflect.Map: - if s.Equal(textNil) { - return s - } - default: - return s - } - if opts.DiffMode == diffIdentical { - return s // elide type for identical nodes - } - case elideType: - return s - } - - // Determine the type label, applying special handling for unnamed types. - typeName := value.TypeString(t, opts.QualifiedNames) - if t.Name() == "" { - // According to Go grammar, certain type literals contain symbols that - // do not strongly bind to the next lexicographical token (e.g., *T). - switch t.Kind() { - case reflect.Chan, reflect.Func, reflect.Ptr: - typeName = "(" + typeName + ")" - } - } - return &textWrap{Prefix: typeName, Value: wrapParens(s)} -} - -// wrapParens wraps s with a set of parenthesis, but avoids it if the -// wrapped node itself is already surrounded by a pair of parenthesis or braces. -// It handles unwrapping one level of pointer-reference nodes. -func wrapParens(s textNode) textNode { - var refNode *textWrap - if s2, ok := s.(*textWrap); ok { - // Unwrap a single pointer reference node. - switch s2.Metadata.(type) { - case leafReference, trunkReference, trunkReferences: - refNode = s2 - if s3, ok := refNode.Value.(*textWrap); ok { - s2 = s3 - } - } - - // Already has delimiters that make parenthesis unnecessary. - hasParens := strings.HasPrefix(s2.Prefix, "(") && strings.HasSuffix(s2.Suffix, ")") - hasBraces := strings.HasPrefix(s2.Prefix, "{") && strings.HasSuffix(s2.Suffix, "}") - if hasParens || hasBraces { - return s - } - } - if refNode != nil { - refNode.Value = &textWrap{Prefix: "(", Value: refNode.Value, Suffix: ")"} - return s - } - return &textWrap{Prefix: "(", Value: s, Suffix: ")"} -} - -// FormatValue prints the reflect.Value, taking extra care to avoid descending -// into pointers already in ptrs. As pointers are visited, ptrs is also updated. -func (opts formatOptions) FormatValue(v reflect.Value, parentKind reflect.Kind, ptrs *pointerReferences) (out textNode) { - if !v.IsValid() { - return nil - } - t := v.Type() - - // Check slice element for cycles. - if parentKind == reflect.Slice { - ptrRef, visited := ptrs.Push(v.Addr()) - if visited { - return makeLeafReference(ptrRef, false) - } - defer ptrs.Pop() - defer func() { out = wrapTrunkReference(ptrRef, false, out) }() - } - - // Check whether there is an Error or String method to call. - if !opts.AvoidStringer && v.CanInterface() { - // Avoid calling Error or String methods on nil receivers since many - // implementations crash when doing so. - if (t.Kind() != reflect.Ptr && t.Kind() != reflect.Interface) || !v.IsNil() { - var prefix, strVal string - func() { - // Swallow and ignore any panics from String or Error. - defer func() { recover() }() - switch v := v.Interface().(type) { - case error: - strVal = v.Error() - prefix = "e" - case fmt.Stringer: - strVal = v.String() - prefix = "s" - } - }() - if prefix != "" { - return opts.formatString(prefix, strVal) - } - } - } - - // Check whether to explicitly wrap the result with the type. - var skipType bool - defer func() { - if !skipType { - out = opts.FormatType(t, out) - } - }() - - switch t.Kind() { - case reflect.Bool: - return textLine(fmt.Sprint(v.Bool())) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return textLine(fmt.Sprint(v.Int())) - case reflect.Uint, reflect.Uint16, reflect.Uint32, reflect.Uint64: - return textLine(fmt.Sprint(v.Uint())) - case reflect.Uint8: - if parentKind == reflect.Slice || parentKind == reflect.Array { - return textLine(formatHex(v.Uint())) - } - return textLine(fmt.Sprint(v.Uint())) - case reflect.Uintptr: - return textLine(formatHex(v.Uint())) - case reflect.Float32, reflect.Float64: - return textLine(fmt.Sprint(v.Float())) - case reflect.Complex64, reflect.Complex128: - return textLine(fmt.Sprint(v.Complex())) - case reflect.String: - return opts.formatString("", v.String()) - case reflect.UnsafePointer, reflect.Chan, reflect.Func: - return textLine(formatPointer(value.PointerOf(v), true)) - case reflect.Struct: - var list textList - v := makeAddressable(v) // needed for retrieveUnexportedField - maxLen := v.NumField() - if opts.LimitVerbosity { - maxLen = ((1 << opts.verbosity()) >> 1) << 2 // 0, 4, 8, 16, 32, etc... - opts.VerbosityLevel-- - } - for i := 0; i < v.NumField(); i++ { - vv := v.Field(i) - if vv.IsZero() { - continue // Elide fields with zero values - } - if len(list) == maxLen { - list.AppendEllipsis(diffStats{}) - break - } - sf := t.Field(i) - if !isExported(sf.Name) { - vv = retrieveUnexportedField(v, sf, true) - } - s := opts.WithTypeMode(autoType).FormatValue(vv, t.Kind(), ptrs) - list = append(list, textRecord{Key: sf.Name, Value: s}) - } - return &textWrap{Prefix: "{", Value: list, Suffix: "}"} - case reflect.Slice: - if v.IsNil() { - return textNil - } - - // Check whether this is a []byte of text data. - if t.Elem() == byteType { - b := v.Bytes() - isPrintSpace := func(r rune) bool { return unicode.IsPrint(r) || unicode.IsSpace(r) } - if len(b) > 0 && utf8.Valid(b) && len(bytes.TrimFunc(b, isPrintSpace)) == 0 { - out = opts.formatString("", string(b)) - skipType = true - return opts.FormatType(t, out) - } - } - - fallthrough - case reflect.Array: - maxLen := v.Len() - if opts.LimitVerbosity { - maxLen = ((1 << opts.verbosity()) >> 1) << 2 // 0, 4, 8, 16, 32, etc... - opts.VerbosityLevel-- - } - var list textList - for i := 0; i < v.Len(); i++ { - if len(list) == maxLen { - list.AppendEllipsis(diffStats{}) - break - } - s := opts.WithTypeMode(elideType).FormatValue(v.Index(i), t.Kind(), ptrs) - list = append(list, textRecord{Value: s}) - } - - out = &textWrap{Prefix: "{", Value: list, Suffix: "}"} - if t.Kind() == reflect.Slice && opts.PrintAddresses { - header := fmt.Sprintf("ptr:%v, len:%d, cap:%d", formatPointer(value.PointerOf(v), false), v.Len(), v.Cap()) - out = &textWrap{Prefix: pointerDelimPrefix + header + pointerDelimSuffix, Value: out} - } - return out - case reflect.Map: - if v.IsNil() { - return textNil - } - - // Check pointer for cycles. - ptrRef, visited := ptrs.Push(v) - if visited { - return makeLeafReference(ptrRef, opts.PrintAddresses) - } - defer ptrs.Pop() - - maxLen := v.Len() - if opts.LimitVerbosity { - maxLen = ((1 << opts.verbosity()) >> 1) << 2 // 0, 4, 8, 16, 32, etc... - opts.VerbosityLevel-- - } - var list textList - for _, k := range value.SortKeys(v.MapKeys()) { - if len(list) == maxLen { - list.AppendEllipsis(diffStats{}) - break - } - sk := formatMapKey(k, false, ptrs) - sv := opts.WithTypeMode(elideType).FormatValue(v.MapIndex(k), t.Kind(), ptrs) - list = append(list, textRecord{Key: sk, Value: sv}) - } - - out = &textWrap{Prefix: "{", Value: list, Suffix: "}"} - out = wrapTrunkReference(ptrRef, opts.PrintAddresses, out) - return out - case reflect.Ptr: - if v.IsNil() { - return textNil - } - - // Check pointer for cycles. - ptrRef, visited := ptrs.Push(v) - if visited { - out = makeLeafReference(ptrRef, opts.PrintAddresses) - return &textWrap{Prefix: "&", Value: out} - } - defer ptrs.Pop() - - // Skip the name only if this is an unnamed pointer type. - // Otherwise taking the address of a value does not reproduce - // the named pointer type. - if v.Type().Name() == "" { - skipType = true // Let the underlying value print the type instead - } - out = opts.FormatValue(v.Elem(), t.Kind(), ptrs) - out = wrapTrunkReference(ptrRef, opts.PrintAddresses, out) - out = &textWrap{Prefix: "&", Value: out} - return out - case reflect.Interface: - if v.IsNil() { - return textNil - } - // Interfaces accept different concrete types, - // so configure the underlying value to explicitly print the type. - return opts.WithTypeMode(emitType).FormatValue(v.Elem(), t.Kind(), ptrs) - default: - panic(fmt.Sprintf("%v kind not handled", v.Kind())) - } -} - -func (opts formatOptions) formatString(prefix, s string) textNode { - maxLen := len(s) - maxLines := strings.Count(s, "\n") + 1 - if opts.LimitVerbosity { - maxLen = (1 << opts.verbosity()) << 5 // 32, 64, 128, 256, etc... - maxLines = (1 << opts.verbosity()) << 2 // 4, 8, 16, 32, 64, etc... - } - - // For multiline strings, use the triple-quote syntax, - // but only use it when printing removed or inserted nodes since - // we only want the extra verbosity for those cases. - lines := strings.Split(strings.TrimSuffix(s, "\n"), "\n") - isTripleQuoted := len(lines) >= 4 && (opts.DiffMode == '-' || opts.DiffMode == '+') - for i := 0; i < len(lines) && isTripleQuoted; i++ { - lines[i] = strings.TrimPrefix(strings.TrimSuffix(lines[i], "\r"), "\r") // trim leading/trailing carriage returns for legacy Windows endline support - isPrintable := func(r rune) bool { - return unicode.IsPrint(r) || r == '\t' // specially treat tab as printable - } - line := lines[i] - isTripleQuoted = !strings.HasPrefix(strings.TrimPrefix(line, prefix), `"""`) && !strings.HasPrefix(line, "...") && strings.TrimFunc(line, isPrintable) == "" && len(line) <= maxLen - } - if isTripleQuoted { - var list textList - list = append(list, textRecord{Diff: opts.DiffMode, Value: textLine(prefix + `"""`), ElideComma: true}) - for i, line := range lines { - if numElided := len(lines) - i; i == maxLines-1 && numElided > 1 { - comment := commentString(fmt.Sprintf("%d elided lines", numElided)) - list = append(list, textRecord{Diff: opts.DiffMode, Value: textEllipsis, ElideComma: true, Comment: comment}) - break - } - list = append(list, textRecord{Diff: opts.DiffMode, Value: textLine(line), ElideComma: true}) - } - list = append(list, textRecord{Diff: opts.DiffMode, Value: textLine(prefix + `"""`), ElideComma: true}) - return &textWrap{Prefix: "(", Value: list, Suffix: ")"} - } - - // Format the string as a single-line quoted string. - if len(s) > maxLen+len(textEllipsis) { - return textLine(prefix + formatString(s[:maxLen]) + string(textEllipsis)) - } - return textLine(prefix + formatString(s)) -} - -// formatMapKey formats v as if it were a map key. -// The result is guaranteed to be a single line. -func formatMapKey(v reflect.Value, disambiguate bool, ptrs *pointerReferences) string { - var opts formatOptions - opts.DiffMode = diffIdentical - opts.TypeMode = elideType - opts.PrintAddresses = disambiguate - opts.AvoidStringer = disambiguate - opts.QualifiedNames = disambiguate - opts.VerbosityLevel = maxVerbosityPreset - opts.LimitVerbosity = true - s := opts.FormatValue(v, reflect.Map, ptrs).String() - return strings.TrimSpace(s) -} - -// formatString prints s as a double-quoted or backtick-quoted string. -func formatString(s string) string { - // Use quoted string if it the same length as a raw string literal. - // Otherwise, attempt to use the raw string form. - qs := strconv.Quote(s) - if len(qs) == 1+len(s)+1 { - return qs - } - - // Disallow newlines to ensure output is a single line. - // Only allow printable runes for readability purposes. - rawInvalid := func(r rune) bool { - return r == '`' || r == '\n' || !(unicode.IsPrint(r) || r == '\t') - } - if utf8.ValidString(s) && strings.IndexFunc(s, rawInvalid) < 0 { - return "`" + s + "`" - } - return qs -} - -// formatHex prints u as a hexadecimal integer in Go notation. -func formatHex(u uint64) string { - var f string - switch { - case u <= 0xff: - f = "0x%02x" - case u <= 0xffff: - f = "0x%04x" - case u <= 0xffffff: - f = "0x%06x" - case u <= 0xffffffff: - f = "0x%08x" - case u <= 0xffffffffff: - f = "0x%010x" - case u <= 0xffffffffffff: - f = "0x%012x" - case u <= 0xffffffffffffff: - f = "0x%014x" - case u <= 0xffffffffffffffff: - f = "0x%016x" - } - return fmt.Sprintf(f, u) -} diff --git a/vendor/github.com/google/go-cmp/cmp/report_slices.go b/vendor/github.com/google/go-cmp/cmp/report_slices.go deleted file mode 100644 index 23e444f62..000000000 --- a/vendor/github.com/google/go-cmp/cmp/report_slices.go +++ /dev/null @@ -1,614 +0,0 @@ -// Copyright 2019, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cmp - -import ( - "bytes" - "fmt" - "math" - "reflect" - "strconv" - "strings" - "unicode" - "unicode/utf8" - - "github.com/google/go-cmp/cmp/internal/diff" -) - -// CanFormatDiffSlice reports whether we support custom formatting for nodes -// that are slices of primitive kinds or strings. -func (opts formatOptions) CanFormatDiffSlice(v *valueNode) bool { - switch { - case opts.DiffMode != diffUnknown: - return false // Must be formatting in diff mode - case v.NumDiff == 0: - return false // No differences detected - case !v.ValueX.IsValid() || !v.ValueY.IsValid(): - return false // Both values must be valid - case v.NumIgnored > 0: - return false // Some ignore option was used - case v.NumTransformed > 0: - return false // Some transform option was used - case v.NumCompared > 1: - return false // More than one comparison was used - case v.NumCompared == 1 && v.Type.Name() != "": - // The need for cmp to check applicability of options on every element - // in a slice is a significant performance detriment for large []byte. - // The workaround is to specify Comparer(bytes.Equal), - // which enables cmp to compare []byte more efficiently. - // If they differ, we still want to provide batched diffing. - // The logic disallows named types since they tend to have their own - // String method, with nicer formatting than what this provides. - return false - } - - // Check whether this is an interface with the same concrete types. - t := v.Type - vx, vy := v.ValueX, v.ValueY - if t.Kind() == reflect.Interface && !vx.IsNil() && !vy.IsNil() && vx.Elem().Type() == vy.Elem().Type() { - vx, vy = vx.Elem(), vy.Elem() - t = vx.Type() - } - - // Check whether we provide specialized diffing for this type. - switch t.Kind() { - case reflect.String: - case reflect.Array, reflect.Slice: - // Only slices of primitive types have specialized handling. - switch t.Elem().Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, - reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, - reflect.Bool, reflect.Float32, reflect.Float64, reflect.Complex64, reflect.Complex128: - default: - return false - } - - // Both slice values have to be non-empty. - if t.Kind() == reflect.Slice && (vx.Len() == 0 || vy.Len() == 0) { - return false - } - - // If a sufficient number of elements already differ, - // use specialized formatting even if length requirement is not met. - if v.NumDiff > v.NumSame { - return true - } - default: - return false - } - - // Use specialized string diffing for longer slices or strings. - const minLength = 32 - return vx.Len() >= minLength && vy.Len() >= minLength -} - -// FormatDiffSlice prints a diff for the slices (or strings) represented by v. -// This provides custom-tailored logic to make printing of differences in -// textual strings and slices of primitive kinds more readable. -func (opts formatOptions) FormatDiffSlice(v *valueNode) textNode { - assert(opts.DiffMode == diffUnknown) - t, vx, vy := v.Type, v.ValueX, v.ValueY - if t.Kind() == reflect.Interface { - vx, vy = vx.Elem(), vy.Elem() - t = vx.Type() - opts = opts.WithTypeMode(emitType) - } - - // Auto-detect the type of the data. - var sx, sy string - var ssx, ssy []string - var isString, isMostlyText, isPureLinedText, isBinary bool - switch { - case t.Kind() == reflect.String: - sx, sy = vx.String(), vy.String() - isString = true - case t.Kind() == reflect.Slice && t.Elem() == byteType: - sx, sy = string(vx.Bytes()), string(vy.Bytes()) - isString = true - case t.Kind() == reflect.Array: - // Arrays need to be addressable for slice operations to work. - vx2, vy2 := reflect.New(t).Elem(), reflect.New(t).Elem() - vx2.Set(vx) - vy2.Set(vy) - vx, vy = vx2, vy2 - } - if isString { - var numTotalRunes, numValidRunes, numLines, lastLineIdx, maxLineLen int - for i, r := range sx + sy { - numTotalRunes++ - if (unicode.IsPrint(r) || unicode.IsSpace(r)) && r != utf8.RuneError { - numValidRunes++ - } - if r == '\n' { - if maxLineLen < i-lastLineIdx { - maxLineLen = i - lastLineIdx - } - lastLineIdx = i + 1 - numLines++ - } - } - isPureText := numValidRunes == numTotalRunes - isMostlyText = float64(numValidRunes) > math.Floor(0.90*float64(numTotalRunes)) - isPureLinedText = isPureText && numLines >= 4 && maxLineLen <= 1024 - isBinary = !isMostlyText - - // Avoid diffing by lines if it produces a significantly more complex - // edit script than diffing by bytes. - if isPureLinedText { - ssx = strings.Split(sx, "\n") - ssy = strings.Split(sy, "\n") - esLines := diff.Difference(len(ssx), len(ssy), func(ix, iy int) diff.Result { - return diff.BoolResult(ssx[ix] == ssy[iy]) - }) - esBytes := diff.Difference(len(sx), len(sy), func(ix, iy int) diff.Result { - return diff.BoolResult(sx[ix] == sy[iy]) - }) - efficiencyLines := float64(esLines.Dist()) / float64(len(esLines)) - efficiencyBytes := float64(esBytes.Dist()) / float64(len(esBytes)) - quotedLength := len(strconv.Quote(sx + sy)) - unquotedLength := len(sx) + len(sy) - escapeExpansionRatio := float64(quotedLength) / float64(unquotedLength) - isPureLinedText = efficiencyLines < 4*efficiencyBytes || escapeExpansionRatio > 1.1 - } - } - - // Format the string into printable records. - var list textList - var delim string - switch { - // If the text appears to be multi-lined text, - // then perform differencing across individual lines. - case isPureLinedText: - list = opts.formatDiffSlice( - reflect.ValueOf(ssx), reflect.ValueOf(ssy), 1, "line", - func(v reflect.Value, d diffMode) textRecord { - s := formatString(v.Index(0).String()) - return textRecord{Diff: d, Value: textLine(s)} - }, - ) - delim = "\n" - - // If possible, use a custom triple-quote (""") syntax for printing - // differences in a string literal. This format is more readable, - // but has edge-cases where differences are visually indistinguishable. - // This format is avoided under the following conditions: - // - A line starts with `"""` - // - A line starts with "..." - // - A line contains non-printable characters - // - Adjacent different lines differ only by whitespace - // - // For example: - // - // """ - // ... // 3 identical lines - // foo - // bar - // - baz - // + BAZ - // """ - isTripleQuoted := true - prevRemoveLines := map[string]bool{} - prevInsertLines := map[string]bool{} - var list2 textList - list2 = append(list2, textRecord{Value: textLine(`"""`), ElideComma: true}) - for _, r := range list { - if !r.Value.Equal(textEllipsis) { - line, _ := strconv.Unquote(string(r.Value.(textLine))) - line = strings.TrimPrefix(strings.TrimSuffix(line, "\r"), "\r") // trim leading/trailing carriage returns for legacy Windows endline support - normLine := strings.Map(func(r rune) rune { - if unicode.IsSpace(r) { - return -1 // drop whitespace to avoid visually indistinguishable output - } - return r - }, line) - isPrintable := func(r rune) bool { - return unicode.IsPrint(r) || r == '\t' // specially treat tab as printable - } - isTripleQuoted = !strings.HasPrefix(line, `"""`) && !strings.HasPrefix(line, "...") && strings.TrimFunc(line, isPrintable) == "" - switch r.Diff { - case diffRemoved: - isTripleQuoted = isTripleQuoted && !prevInsertLines[normLine] - prevRemoveLines[normLine] = true - case diffInserted: - isTripleQuoted = isTripleQuoted && !prevRemoveLines[normLine] - prevInsertLines[normLine] = true - } - if !isTripleQuoted { - break - } - r.Value = textLine(line) - r.ElideComma = true - } - if !(r.Diff == diffRemoved || r.Diff == diffInserted) { // start a new non-adjacent difference group - prevRemoveLines = map[string]bool{} - prevInsertLines = map[string]bool{} - } - list2 = append(list2, r) - } - if r := list2[len(list2)-1]; r.Diff == diffIdentical && len(r.Value.(textLine)) == 0 { - list2 = list2[:len(list2)-1] // elide single empty line at the end - } - list2 = append(list2, textRecord{Value: textLine(`"""`), ElideComma: true}) - if isTripleQuoted { - var out textNode = &textWrap{Prefix: "(", Value: list2, Suffix: ")"} - switch t.Kind() { - case reflect.String: - if t != stringType { - out = opts.FormatType(t, out) - } - case reflect.Slice: - // Always emit type for slices since the triple-quote syntax - // looks like a string (not a slice). - opts = opts.WithTypeMode(emitType) - out = opts.FormatType(t, out) - } - return out - } - - // If the text appears to be single-lined text, - // then perform differencing in approximately fixed-sized chunks. - // The output is printed as quoted strings. - case isMostlyText: - list = opts.formatDiffSlice( - reflect.ValueOf(sx), reflect.ValueOf(sy), 64, "byte", - func(v reflect.Value, d diffMode) textRecord { - s := formatString(v.String()) - return textRecord{Diff: d, Value: textLine(s)} - }, - ) - - // If the text appears to be binary data, - // then perform differencing in approximately fixed-sized chunks. - // The output is inspired by hexdump. - case isBinary: - list = opts.formatDiffSlice( - reflect.ValueOf(sx), reflect.ValueOf(sy), 16, "byte", - func(v reflect.Value, d diffMode) textRecord { - var ss []string - for i := 0; i < v.Len(); i++ { - ss = append(ss, formatHex(v.Index(i).Uint())) - } - s := strings.Join(ss, ", ") - comment := commentString(fmt.Sprintf("%c|%v|", d, formatASCII(v.String()))) - return textRecord{Diff: d, Value: textLine(s), Comment: comment} - }, - ) - - // For all other slices of primitive types, - // then perform differencing in approximately fixed-sized chunks. - // The size of each chunk depends on the width of the element kind. - default: - var chunkSize int - if t.Elem().Kind() == reflect.Bool { - chunkSize = 16 - } else { - switch t.Elem().Bits() { - case 8: - chunkSize = 16 - case 16: - chunkSize = 12 - case 32: - chunkSize = 8 - default: - chunkSize = 8 - } - } - list = opts.formatDiffSlice( - vx, vy, chunkSize, t.Elem().Kind().String(), - func(v reflect.Value, d diffMode) textRecord { - var ss []string - for i := 0; i < v.Len(); i++ { - switch t.Elem().Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - ss = append(ss, fmt.Sprint(v.Index(i).Int())) - case reflect.Uint, reflect.Uint16, reflect.Uint32, reflect.Uint64: - ss = append(ss, fmt.Sprint(v.Index(i).Uint())) - case reflect.Uint8, reflect.Uintptr: - ss = append(ss, formatHex(v.Index(i).Uint())) - case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Complex64, reflect.Complex128: - ss = append(ss, fmt.Sprint(v.Index(i).Interface())) - } - } - s := strings.Join(ss, ", ") - return textRecord{Diff: d, Value: textLine(s)} - }, - ) - } - - // Wrap the output with appropriate type information. - var out textNode = &textWrap{Prefix: "{", Value: list, Suffix: "}"} - if !isMostlyText { - // The "{...}" byte-sequence literal is not valid Go syntax for strings. - // Emit the type for extra clarity (e.g. "string{...}"). - if t.Kind() == reflect.String { - opts = opts.WithTypeMode(emitType) - } - return opts.FormatType(t, out) - } - switch t.Kind() { - case reflect.String: - out = &textWrap{Prefix: "strings.Join(", Value: out, Suffix: fmt.Sprintf(", %q)", delim)} - if t != stringType { - out = opts.FormatType(t, out) - } - case reflect.Slice: - out = &textWrap{Prefix: "bytes.Join(", Value: out, Suffix: fmt.Sprintf(", %q)", delim)} - if t != bytesType { - out = opts.FormatType(t, out) - } - } - return out -} - -// formatASCII formats s as an ASCII string. -// This is useful for printing binary strings in a semi-legible way. -func formatASCII(s string) string { - b := bytes.Repeat([]byte{'.'}, len(s)) - for i := 0; i < len(s); i++ { - if ' ' <= s[i] && s[i] <= '~' { - b[i] = s[i] - } - } - return string(b) -} - -func (opts formatOptions) formatDiffSlice( - vx, vy reflect.Value, chunkSize int, name string, - makeRec func(reflect.Value, diffMode) textRecord, -) (list textList) { - eq := func(ix, iy int) bool { - return vx.Index(ix).Interface() == vy.Index(iy).Interface() - } - es := diff.Difference(vx.Len(), vy.Len(), func(ix, iy int) diff.Result { - return diff.BoolResult(eq(ix, iy)) - }) - - appendChunks := func(v reflect.Value, d diffMode) int { - n0 := v.Len() - for v.Len() > 0 { - n := chunkSize - if n > v.Len() { - n = v.Len() - } - list = append(list, makeRec(v.Slice(0, n), d)) - v = v.Slice(n, v.Len()) - } - return n0 - v.Len() - } - - var numDiffs int - maxLen := -1 - if opts.LimitVerbosity { - maxLen = (1 << opts.verbosity()) << 2 // 4, 8, 16, 32, 64, etc... - opts.VerbosityLevel-- - } - - groups := coalesceAdjacentEdits(name, es) - groups = coalesceInterveningIdentical(groups, chunkSize/4) - groups = cleanupSurroundingIdentical(groups, eq) - maxGroup := diffStats{Name: name} - for i, ds := range groups { - if maxLen >= 0 && numDiffs >= maxLen { - maxGroup = maxGroup.Append(ds) - continue - } - - // Print equal. - if ds.NumDiff() == 0 { - // Compute the number of leading and trailing equal bytes to print. - var numLo, numHi int - numEqual := ds.NumIgnored + ds.NumIdentical - for numLo < chunkSize*numContextRecords && numLo+numHi < numEqual && i != 0 { - numLo++ - } - for numHi < chunkSize*numContextRecords && numLo+numHi < numEqual && i != len(groups)-1 { - numHi++ - } - if numEqual-(numLo+numHi) <= chunkSize && ds.NumIgnored == 0 { - numHi = numEqual - numLo // Avoid pointless coalescing of single equal row - } - - // Print the equal bytes. - appendChunks(vx.Slice(0, numLo), diffIdentical) - if numEqual > numLo+numHi { - ds.NumIdentical -= numLo + numHi - list.AppendEllipsis(ds) - } - appendChunks(vx.Slice(numEqual-numHi, numEqual), diffIdentical) - vx = vx.Slice(numEqual, vx.Len()) - vy = vy.Slice(numEqual, vy.Len()) - continue - } - - // Print unequal. - len0 := len(list) - nx := appendChunks(vx.Slice(0, ds.NumIdentical+ds.NumRemoved+ds.NumModified), diffRemoved) - vx = vx.Slice(nx, vx.Len()) - ny := appendChunks(vy.Slice(0, ds.NumIdentical+ds.NumInserted+ds.NumModified), diffInserted) - vy = vy.Slice(ny, vy.Len()) - numDiffs += len(list) - len0 - } - if maxGroup.IsZero() { - assert(vx.Len() == 0 && vy.Len() == 0) - } else { - list.AppendEllipsis(maxGroup) - } - return list -} - -// coalesceAdjacentEdits coalesces the list of edits into groups of adjacent -// equal or unequal counts. -// -// Example: -// -// Input: "..XXY...Y" -// Output: [ -// {NumIdentical: 2}, -// {NumRemoved: 2, NumInserted 1}, -// {NumIdentical: 3}, -// {NumInserted: 1}, -// ] -func coalesceAdjacentEdits(name string, es diff.EditScript) (groups []diffStats) { - var prevMode byte - lastStats := func(mode byte) *diffStats { - if prevMode != mode { - groups = append(groups, diffStats{Name: name}) - prevMode = mode - } - return &groups[len(groups)-1] - } - for _, e := range es { - switch e { - case diff.Identity: - lastStats('=').NumIdentical++ - case diff.UniqueX: - lastStats('!').NumRemoved++ - case diff.UniqueY: - lastStats('!').NumInserted++ - case diff.Modified: - lastStats('!').NumModified++ - } - } - return groups -} - -// coalesceInterveningIdentical coalesces sufficiently short (<= windowSize) -// equal groups into adjacent unequal groups that currently result in a -// dual inserted/removed printout. This acts as a high-pass filter to smooth -// out high-frequency changes within the windowSize. -// -// Example: -// -// WindowSize: 16, -// Input: [ -// {NumIdentical: 61}, // group 0 -// {NumRemoved: 3, NumInserted: 1}, // group 1 -// {NumIdentical: 6}, // ├── coalesce -// {NumInserted: 2}, // ├── coalesce -// {NumIdentical: 1}, // ├── coalesce -// {NumRemoved: 9}, // └── coalesce -// {NumIdentical: 64}, // group 2 -// {NumRemoved: 3, NumInserted: 1}, // group 3 -// {NumIdentical: 6}, // ├── coalesce -// {NumInserted: 2}, // ├── coalesce -// {NumIdentical: 1}, // ├── coalesce -// {NumRemoved: 7}, // ├── coalesce -// {NumIdentical: 1}, // ├── coalesce -// {NumRemoved: 2}, // └── coalesce -// {NumIdentical: 63}, // group 4 -// ] -// Output: [ -// {NumIdentical: 61}, -// {NumIdentical: 7, NumRemoved: 12, NumInserted: 3}, -// {NumIdentical: 64}, -// {NumIdentical: 8, NumRemoved: 12, NumInserted: 3}, -// {NumIdentical: 63}, -// ] -func coalesceInterveningIdentical(groups []diffStats, windowSize int) []diffStats { - groups, groupsOrig := groups[:0], groups - for i, ds := range groupsOrig { - if len(groups) >= 2 && ds.NumDiff() > 0 { - prev := &groups[len(groups)-2] // Unequal group - curr := &groups[len(groups)-1] // Equal group - next := &groupsOrig[i] // Unequal group - hadX, hadY := prev.NumRemoved > 0, prev.NumInserted > 0 - hasX, hasY := next.NumRemoved > 0, next.NumInserted > 0 - if ((hadX || hasX) && (hadY || hasY)) && curr.NumIdentical <= windowSize { - *prev = prev.Append(*curr).Append(*next) - groups = groups[:len(groups)-1] // Truncate off equal group - continue - } - } - groups = append(groups, ds) - } - return groups -} - -// cleanupSurroundingIdentical scans through all unequal groups, and -// moves any leading sequence of equal elements to the preceding equal group and -// moves and trailing sequence of equal elements to the succeeding equal group. -// -// This is necessary since coalesceInterveningIdentical may coalesce edit groups -// together such that leading/trailing spans of equal elements becomes possible. -// Note that this can occur even with an optimal diffing algorithm. -// -// Example: -// -// Input: [ -// {NumIdentical: 61}, -// {NumIdentical: 1 , NumRemoved: 11, NumInserted: 2}, // assume 3 leading identical elements -// {NumIdentical: 67}, -// {NumIdentical: 7, NumRemoved: 12, NumInserted: 3}, // assume 10 trailing identical elements -// {NumIdentical: 54}, -// ] -// Output: [ -// {NumIdentical: 64}, // incremented by 3 -// {NumRemoved: 9}, -// {NumIdentical: 67}, -// {NumRemoved: 9}, -// {NumIdentical: 64}, // incremented by 10 -// ] -func cleanupSurroundingIdentical(groups []diffStats, eq func(i, j int) bool) []diffStats { - var ix, iy int // indexes into sequence x and y - for i, ds := range groups { - // Handle equal group. - if ds.NumDiff() == 0 { - ix += ds.NumIdentical - iy += ds.NumIdentical - continue - } - - // Handle unequal group. - nx := ds.NumIdentical + ds.NumRemoved + ds.NumModified - ny := ds.NumIdentical + ds.NumInserted + ds.NumModified - var numLeadingIdentical, numTrailingIdentical int - for j := 0; j < nx && j < ny && eq(ix+j, iy+j); j++ { - numLeadingIdentical++ - } - for j := 0; j < nx && j < ny && eq(ix+nx-1-j, iy+ny-1-j); j++ { - numTrailingIdentical++ - } - if numIdentical := numLeadingIdentical + numTrailingIdentical; numIdentical > 0 { - if numLeadingIdentical > 0 { - // Remove leading identical span from this group and - // insert it into the preceding group. - if i-1 >= 0 { - groups[i-1].NumIdentical += numLeadingIdentical - } else { - // No preceding group exists, so prepend a new group, - // but do so after we finish iterating over all groups. - defer func() { - groups = append([]diffStats{{Name: groups[0].Name, NumIdentical: numLeadingIdentical}}, groups...) - }() - } - // Increment indexes since the preceding group would have handled this. - ix += numLeadingIdentical - iy += numLeadingIdentical - } - if numTrailingIdentical > 0 { - // Remove trailing identical span from this group and - // insert it into the succeeding group. - if i+1 < len(groups) { - groups[i+1].NumIdentical += numTrailingIdentical - } else { - // No succeeding group exists, so append a new group, - // but do so after we finish iterating over all groups. - defer func() { - groups = append(groups, diffStats{Name: groups[len(groups)-1].Name, NumIdentical: numTrailingIdentical}) - }() - } - // Do not increment indexes since the succeeding group will handle this. - } - - // Update this group since some identical elements were removed. - nx -= numIdentical - ny -= numIdentical - groups[i] = diffStats{Name: ds.Name, NumRemoved: nx, NumInserted: ny} - } - ix += nx - iy += ny - } - return groups -} diff --git a/vendor/github.com/google/go-cmp/cmp/report_text.go b/vendor/github.com/google/go-cmp/cmp/report_text.go deleted file mode 100644 index 388fcf571..000000000 --- a/vendor/github.com/google/go-cmp/cmp/report_text.go +++ /dev/null @@ -1,432 +0,0 @@ -// Copyright 2019, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cmp - -import ( - "bytes" - "fmt" - "math/rand" - "strings" - "time" - "unicode/utf8" - - "github.com/google/go-cmp/cmp/internal/flags" -) - -var randBool = rand.New(rand.NewSource(time.Now().Unix())).Intn(2) == 0 - -const maxColumnLength = 80 - -type indentMode int - -func (n indentMode) appendIndent(b []byte, d diffMode) []byte { - // The output of Diff is documented as being unstable to provide future - // flexibility in changing the output for more humanly readable reports. - // This logic intentionally introduces instability to the exact output - // so that users can detect accidental reliance on stability early on, - // rather than much later when an actual change to the format occurs. - if flags.Deterministic || randBool { - // Use regular spaces (U+0020). - switch d { - case diffUnknown, diffIdentical: - b = append(b, " "...) - case diffRemoved: - b = append(b, "- "...) - case diffInserted: - b = append(b, "+ "...) - } - } else { - // Use non-breaking spaces (U+00a0). - switch d { - case diffUnknown, diffIdentical: - b = append(b, "  "...) - case diffRemoved: - b = append(b, "- "...) - case diffInserted: - b = append(b, "+ "...) - } - } - return repeatCount(n).appendChar(b, '\t') -} - -type repeatCount int - -func (n repeatCount) appendChar(b []byte, c byte) []byte { - for ; n > 0; n-- { - b = append(b, c) - } - return b -} - -// textNode is a simplified tree-based representation of structured text. -// Possible node types are textWrap, textList, or textLine. -type textNode interface { - // Len reports the length in bytes of a single-line version of the tree. - // Nested textRecord.Diff and textRecord.Comment fields are ignored. - Len() int - // Equal reports whether the two trees are structurally identical. - // Nested textRecord.Diff and textRecord.Comment fields are compared. - Equal(textNode) bool - // String returns the string representation of the text tree. - // It is not guaranteed that len(x.String()) == x.Len(), - // nor that x.String() == y.String() implies that x.Equal(y). - String() string - - // formatCompactTo formats the contents of the tree as a single-line string - // to the provided buffer. Any nested textRecord.Diff and textRecord.Comment - // fields are ignored. - // - // However, not all nodes in the tree should be collapsed as a single-line. - // If a node can be collapsed as a single-line, it is replaced by a textLine - // node. Since the top-level node cannot replace itself, this also returns - // the current node itself. - // - // This does not mutate the receiver. - formatCompactTo([]byte, diffMode) ([]byte, textNode) - // formatExpandedTo formats the contents of the tree as a multi-line string - // to the provided buffer. In order for column alignment to operate well, - // formatCompactTo must be called before calling formatExpandedTo. - formatExpandedTo([]byte, diffMode, indentMode) []byte -} - -// textWrap is a wrapper that concatenates a prefix and/or a suffix -// to the underlying node. -type textWrap struct { - Prefix string // e.g., "bytes.Buffer{" - Value textNode // textWrap | textList | textLine - Suffix string // e.g., "}" - Metadata interface{} // arbitrary metadata; has no effect on formatting -} - -func (s *textWrap) Len() int { - return len(s.Prefix) + s.Value.Len() + len(s.Suffix) -} -func (s1 *textWrap) Equal(s2 textNode) bool { - if s2, ok := s2.(*textWrap); ok { - return s1.Prefix == s2.Prefix && s1.Value.Equal(s2.Value) && s1.Suffix == s2.Suffix - } - return false -} -func (s *textWrap) String() string { - var d diffMode - var n indentMode - _, s2 := s.formatCompactTo(nil, d) - b := n.appendIndent(nil, d) // Leading indent - b = s2.formatExpandedTo(b, d, n) // Main body - b = append(b, '\n') // Trailing newline - return string(b) -} -func (s *textWrap) formatCompactTo(b []byte, d diffMode) ([]byte, textNode) { - n0 := len(b) // Original buffer length - b = append(b, s.Prefix...) - b, s.Value = s.Value.formatCompactTo(b, d) - b = append(b, s.Suffix...) - if _, ok := s.Value.(textLine); ok { - return b, textLine(b[n0:]) - } - return b, s -} -func (s *textWrap) formatExpandedTo(b []byte, d diffMode, n indentMode) []byte { - b = append(b, s.Prefix...) - b = s.Value.formatExpandedTo(b, d, n) - b = append(b, s.Suffix...) - return b -} - -// textList is a comma-separated list of textWrap or textLine nodes. -// The list may be formatted as multi-lines or single-line at the discretion -// of the textList.formatCompactTo method. -type textList []textRecord -type textRecord struct { - Diff diffMode // e.g., 0 or '-' or '+' - Key string // e.g., "MyField" - Value textNode // textWrap | textLine - ElideComma bool // avoid trailing comma - Comment fmt.Stringer // e.g., "6 identical fields" -} - -// AppendEllipsis appends a new ellipsis node to the list if none already -// exists at the end. If cs is non-zero it coalesces the statistics with the -// previous diffStats. -func (s *textList) AppendEllipsis(ds diffStats) { - hasStats := !ds.IsZero() - if len(*s) == 0 || !(*s)[len(*s)-1].Value.Equal(textEllipsis) { - if hasStats { - *s = append(*s, textRecord{Value: textEllipsis, ElideComma: true, Comment: ds}) - } else { - *s = append(*s, textRecord{Value: textEllipsis, ElideComma: true}) - } - return - } - if hasStats { - (*s)[len(*s)-1].Comment = (*s)[len(*s)-1].Comment.(diffStats).Append(ds) - } -} - -func (s textList) Len() (n int) { - for i, r := range s { - n += len(r.Key) - if r.Key != "" { - n += len(": ") - } - n += r.Value.Len() - if i < len(s)-1 { - n += len(", ") - } - } - return n -} - -func (s1 textList) Equal(s2 textNode) bool { - if s2, ok := s2.(textList); ok { - if len(s1) != len(s2) { - return false - } - for i := range s1 { - r1, r2 := s1[i], s2[i] - if !(r1.Diff == r2.Diff && r1.Key == r2.Key && r1.Value.Equal(r2.Value) && r1.Comment == r2.Comment) { - return false - } - } - return true - } - return false -} - -func (s textList) String() string { - return (&textWrap{Prefix: "{", Value: s, Suffix: "}"}).String() -} - -func (s textList) formatCompactTo(b []byte, d diffMode) ([]byte, textNode) { - s = append(textList(nil), s...) // Avoid mutating original - - // Determine whether we can collapse this list as a single line. - n0 := len(b) // Original buffer length - var multiLine bool - for i, r := range s { - if r.Diff == diffInserted || r.Diff == diffRemoved { - multiLine = true - } - b = append(b, r.Key...) - if r.Key != "" { - b = append(b, ": "...) - } - b, s[i].Value = r.Value.formatCompactTo(b, d|r.Diff) - if _, ok := s[i].Value.(textLine); !ok { - multiLine = true - } - if r.Comment != nil { - multiLine = true - } - if i < len(s)-1 { - b = append(b, ", "...) - } - } - // Force multi-lined output when printing a removed/inserted node that - // is sufficiently long. - if (d == diffInserted || d == diffRemoved) && len(b[n0:]) > maxColumnLength { - multiLine = true - } - if !multiLine { - return b, textLine(b[n0:]) - } - return b, s -} - -func (s textList) formatExpandedTo(b []byte, d diffMode, n indentMode) []byte { - alignKeyLens := s.alignLens( - func(r textRecord) bool { - _, isLine := r.Value.(textLine) - return r.Key == "" || !isLine - }, - func(r textRecord) int { return utf8.RuneCountInString(r.Key) }, - ) - alignValueLens := s.alignLens( - func(r textRecord) bool { - _, isLine := r.Value.(textLine) - return !isLine || r.Value.Equal(textEllipsis) || r.Comment == nil - }, - func(r textRecord) int { return utf8.RuneCount(r.Value.(textLine)) }, - ) - - // Format lists of simple lists in a batched form. - // If the list is sequence of only textLine values, - // then batch multiple values on a single line. - var isSimple bool - for _, r := range s { - _, isLine := r.Value.(textLine) - isSimple = r.Diff == 0 && r.Key == "" && isLine && r.Comment == nil - if !isSimple { - break - } - } - if isSimple { - n++ - var batch []byte - emitBatch := func() { - if len(batch) > 0 { - b = n.appendIndent(append(b, '\n'), d) - b = append(b, bytes.TrimRight(batch, " ")...) - batch = batch[:0] - } - } - for _, r := range s { - line := r.Value.(textLine) - if len(batch)+len(line)+len(", ") > maxColumnLength { - emitBatch() - } - batch = append(batch, line...) - batch = append(batch, ", "...) - } - emitBatch() - n-- - return n.appendIndent(append(b, '\n'), d) - } - - // Format the list as a multi-lined output. - n++ - for i, r := range s { - b = n.appendIndent(append(b, '\n'), d|r.Diff) - if r.Key != "" { - b = append(b, r.Key+": "...) - } - b = alignKeyLens[i].appendChar(b, ' ') - - b = r.Value.formatExpandedTo(b, d|r.Diff, n) - if !r.ElideComma { - b = append(b, ',') - } - b = alignValueLens[i].appendChar(b, ' ') - - if r.Comment != nil { - b = append(b, " // "+r.Comment.String()...) - } - } - n-- - - return n.appendIndent(append(b, '\n'), d) -} - -func (s textList) alignLens( - skipFunc func(textRecord) bool, - lenFunc func(textRecord) int, -) []repeatCount { - var startIdx, endIdx, maxLen int - lens := make([]repeatCount, len(s)) - for i, r := range s { - if skipFunc(r) { - for j := startIdx; j < endIdx && j < len(s); j++ { - lens[j] = repeatCount(maxLen - lenFunc(s[j])) - } - startIdx, endIdx, maxLen = i+1, i+1, 0 - } else { - if maxLen < lenFunc(r) { - maxLen = lenFunc(r) - } - endIdx = i + 1 - } - } - for j := startIdx; j < endIdx && j < len(s); j++ { - lens[j] = repeatCount(maxLen - lenFunc(s[j])) - } - return lens -} - -// textLine is a single-line segment of text and is always a leaf node -// in the textNode tree. -type textLine []byte - -var ( - textNil = textLine("nil") - textEllipsis = textLine("...") -) - -func (s textLine) Len() int { - return len(s) -} -func (s1 textLine) Equal(s2 textNode) bool { - if s2, ok := s2.(textLine); ok { - return bytes.Equal([]byte(s1), []byte(s2)) - } - return false -} -func (s textLine) String() string { - return string(s) -} -func (s textLine) formatCompactTo(b []byte, d diffMode) ([]byte, textNode) { - return append(b, s...), s -} -func (s textLine) formatExpandedTo(b []byte, _ diffMode, _ indentMode) []byte { - return append(b, s...) -} - -type diffStats struct { - Name string - NumIgnored int - NumIdentical int - NumRemoved int - NumInserted int - NumModified int -} - -func (s diffStats) IsZero() bool { - s.Name = "" - return s == diffStats{} -} - -func (s diffStats) NumDiff() int { - return s.NumRemoved + s.NumInserted + s.NumModified -} - -func (s diffStats) Append(ds diffStats) diffStats { - assert(s.Name == ds.Name) - s.NumIgnored += ds.NumIgnored - s.NumIdentical += ds.NumIdentical - s.NumRemoved += ds.NumRemoved - s.NumInserted += ds.NumInserted - s.NumModified += ds.NumModified - return s -} - -// String prints a humanly-readable summary of coalesced records. -// -// Example: -// -// diffStats{Name: "Field", NumIgnored: 5}.String() => "5 ignored fields" -func (s diffStats) String() string { - var ss []string - var sum int - labels := [...]string{"ignored", "identical", "removed", "inserted", "modified"} - counts := [...]int{s.NumIgnored, s.NumIdentical, s.NumRemoved, s.NumInserted, s.NumModified} - for i, n := range counts { - if n > 0 { - ss = append(ss, fmt.Sprintf("%d %v", n, labels[i])) - } - sum += n - } - - // Pluralize the name (adjusting for some obscure English grammar rules). - name := s.Name - if sum > 1 { - name += "s" - if strings.HasSuffix(name, "ys") { - name = name[:len(name)-2] + "ies" // e.g., "entrys" => "entries" - } - } - - // Format the list according to English grammar (with Oxford comma). - switch n := len(ss); n { - case 0: - return "" - case 1, 2: - return strings.Join(ss, " and ") + " " + name - default: - return strings.Join(ss[:n-1], ", ") + ", and " + ss[n-1] + " " + name - } -} - -type commentString string - -func (s commentString) String() string { return string(s) } diff --git a/vendor/github.com/google/go-cmp/cmp/report_value.go b/vendor/github.com/google/go-cmp/cmp/report_value.go deleted file mode 100644 index 668d470fd..000000000 --- a/vendor/github.com/google/go-cmp/cmp/report_value.go +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright 2019, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cmp - -import "reflect" - -// valueNode represents a single node within a report, which is a -// structured representation of the value tree, containing information -// regarding which nodes are equal or not. -type valueNode struct { - parent *valueNode - - Type reflect.Type - ValueX reflect.Value - ValueY reflect.Value - - // NumSame is the number of leaf nodes that are equal. - // All descendants are equal only if NumDiff is 0. - NumSame int - // NumDiff is the number of leaf nodes that are not equal. - NumDiff int - // NumIgnored is the number of leaf nodes that are ignored. - NumIgnored int - // NumCompared is the number of leaf nodes that were compared - // using an Equal method or Comparer function. - NumCompared int - // NumTransformed is the number of non-leaf nodes that were transformed. - NumTransformed int - // NumChildren is the number of transitive descendants of this node. - // This counts from zero; thus, leaf nodes have no descendants. - NumChildren int - // MaxDepth is the maximum depth of the tree. This counts from zero; - // thus, leaf nodes have a depth of zero. - MaxDepth int - - // Records is a list of struct fields, slice elements, or map entries. - Records []reportRecord // If populated, implies Value is not populated - - // Value is the result of a transformation, pointer indirect, of - // type assertion. - Value *valueNode // If populated, implies Records is not populated - - // TransformerName is the name of the transformer. - TransformerName string // If non-empty, implies Value is populated -} -type reportRecord struct { - Key reflect.Value // Invalid for slice element - Value *valueNode -} - -func (parent *valueNode) PushStep(ps PathStep) (child *valueNode) { - vx, vy := ps.Values() - child = &valueNode{parent: parent, Type: ps.Type(), ValueX: vx, ValueY: vy} - switch s := ps.(type) { - case StructField: - assert(parent.Value == nil) - parent.Records = append(parent.Records, reportRecord{Key: reflect.ValueOf(s.Name()), Value: child}) - case SliceIndex: - assert(parent.Value == nil) - parent.Records = append(parent.Records, reportRecord{Value: child}) - case MapIndex: - assert(parent.Value == nil) - parent.Records = append(parent.Records, reportRecord{Key: s.Key(), Value: child}) - case Indirect: - assert(parent.Value == nil && parent.Records == nil) - parent.Value = child - case TypeAssertion: - assert(parent.Value == nil && parent.Records == nil) - parent.Value = child - case Transform: - assert(parent.Value == nil && parent.Records == nil) - parent.Value = child - parent.TransformerName = s.Name() - parent.NumTransformed++ - default: - assert(parent == nil) // Must be the root step - } - return child -} - -func (r *valueNode) Report(rs Result) { - assert(r.MaxDepth == 0) // May only be called on leaf nodes - - if rs.ByIgnore() { - r.NumIgnored++ - } else { - if rs.Equal() { - r.NumSame++ - } else { - r.NumDiff++ - } - } - assert(r.NumSame+r.NumDiff+r.NumIgnored == 1) - - if rs.ByMethod() { - r.NumCompared++ - } - if rs.ByFunc() { - r.NumCompared++ - } - assert(r.NumCompared <= 1) -} - -func (child *valueNode) PopStep() (parent *valueNode) { - if child.parent == nil { - return nil - } - parent = child.parent - parent.NumSame += child.NumSame - parent.NumDiff += child.NumDiff - parent.NumIgnored += child.NumIgnored - parent.NumCompared += child.NumCompared - parent.NumTransformed += child.NumTransformed - parent.NumChildren += child.NumChildren + 1 - if parent.MaxDepth < child.MaxDepth+1 { - parent.MaxDepth = child.MaxDepth + 1 - } - return parent -} diff --git a/vendor/github.com/google/gofuzz/.travis.yml b/vendor/github.com/google/gofuzz/.travis.yml deleted file mode 100644 index 061d72ae0..000000000 --- a/vendor/github.com/google/gofuzz/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -language: go - -go: - - 1.11.x - - 1.12.x - - 1.13.x - - master - -script: - - go test -cover diff --git a/vendor/github.com/google/gofuzz/CONTRIBUTING.md b/vendor/github.com/google/gofuzz/CONTRIBUTING.md deleted file mode 100644 index 97c1b34fd..000000000 --- a/vendor/github.com/google/gofuzz/CONTRIBUTING.md +++ /dev/null @@ -1,67 +0,0 @@ -# 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 any Google project must be accompanied by a Contributor -License Agreement. This is not a copyright **assignment**, it simply gives -Google permission to use and redistribute your contributions as part of the -project. - - * If you are an individual writing original source code and you're sure you - own the intellectual property, then you'll need to sign an [individual - CLA][]. - - * If you work for a company that wants to allow you to contribute your work, - then you'll need to sign a [corporate CLA][]. - -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. - -[individual CLA]: https://developers.google.com/open-source/cla/individual -[corporate CLA]: https://developers.google.com/open-source/cla/corporate - - -## Submitting a patch ## - - 1. It's generally best to start by opening a new issue describing the bug or - feature you're intending to fix. Even if you think it's relatively minor, - it's helpful to know what people are working on. Mention in the initial - issue that you are planning to work on that bug or feature so that it can - be assigned to you. - - 1. Follow the normal process of [forking][] the project, and setup a new - branch to work in. It's important that each group of changes be done in - separate branches in order to ensure that a pull request only includes the - commits related to that bug or feature. - - 1. Go makes it very simple to ensure properly formatted code, so always run - `go fmt` on your code before committing it. You should also run - [golint][] over your code. As noted in the [golint readme][], it's not - strictly necessary that your code be completely "lint-free", but this will - help you find common style issues. - - 1. Any significant changes should almost always be accompanied by tests. The - project already has good test coverage, so look at some of the existing - tests if you're unsure how to go about it. [gocov][] and [gocov-html][] - are invaluable tools for seeing which parts of your code aren't being - exercised by your tests. - - 1. Do your best to have [well-formed commit messages][] for each change. - This provides consistency throughout the project, and ensures that commit - messages are able to be formatted properly by various git tools. - - 1. Finally, push the commits to your fork and submit a [pull request][]. - -[forking]: https://help.github.com/articles/fork-a-repo -[golint]: https://github.com/golang/lint -[golint readme]: https://github.com/golang/lint/blob/master/README -[gocov]: https://github.com/axw/gocov -[gocov-html]: https://github.com/matm/gocov-html -[well-formed commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html -[squash]: http://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits -[pull request]: https://help.github.com/articles/creating-a-pull-request diff --git a/vendor/github.com/google/gofuzz/LICENSE b/vendor/github.com/google/gofuzz/LICENSE deleted file mode 100644 index d64569567..000000000 --- a/vendor/github.com/google/gofuzz/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - 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. diff --git a/vendor/github.com/google/gofuzz/README.md b/vendor/github.com/google/gofuzz/README.md deleted file mode 100644 index b503aae7d..000000000 --- a/vendor/github.com/google/gofuzz/README.md +++ /dev/null @@ -1,89 +0,0 @@ -gofuzz -====== - -gofuzz is a library for populating go objects with random values. - -[![GoDoc](https://godoc.org/github.com/google/gofuzz?status.svg)](https://godoc.org/github.com/google/gofuzz) -[![Travis](https://travis-ci.org/google/gofuzz.svg?branch=master)](https://travis-ci.org/google/gofuzz) - -This is useful for testing: - -* Do your project's objects really serialize/unserialize correctly in all cases? -* Is there an incorrectly formatted object that will cause your project to panic? - -Import with ```import "github.com/google/gofuzz"``` - -You can use it on single variables: -```go -f := fuzz.New() -var myInt int -f.Fuzz(&myInt) // myInt gets a random value. -``` - -You can use it on maps: -```go -f := fuzz.New().NilChance(0).NumElements(1, 1) -var myMap map[ComplexKeyType]string -f.Fuzz(&myMap) // myMap will have exactly one element. -``` - -Customize the chance of getting a nil pointer: -```go -f := fuzz.New().NilChance(.5) -var fancyStruct struct { - A, B, C, D *string -} -f.Fuzz(&fancyStruct) // About half the pointers should be set. -``` - -You can even customize the randomization completely if needed: -```go -type MyEnum string -const ( - A MyEnum = "A" - B MyEnum = "B" -) -type MyInfo struct { - Type MyEnum - AInfo *string - BInfo *string -} - -f := fuzz.New().NilChance(0).Funcs( - func(e *MyInfo, c fuzz.Continue) { - switch c.Intn(2) { - case 0: - e.Type = A - c.Fuzz(&e.AInfo) - case 1: - e.Type = B - c.Fuzz(&e.BInfo) - } - }, -) - -var myObject MyInfo -f.Fuzz(&myObject) // Type will correspond to whether A or B info is set. -``` - -See more examples in ```example_test.go```. - -You can use this library for easier [go-fuzz](https://github.com/dvyukov/go-fuzz)ing. -go-fuzz provides the user a byte-slice, which should be converted to different inputs -for the tested function. This library can help convert the byte slice. Consider for -example a fuzz test for a the function `mypackage.MyFunc` that takes an int arguments: -```go -// +build gofuzz -package mypackage - -import fuzz "github.com/google/gofuzz" - -func Fuzz(data []byte) int { - var i int - fuzz.NewFromGoFuzz(data).Fuzz(&i) - MyFunc(i) - return 0 -} -``` - -Happy testing! diff --git a/vendor/github.com/google/gofuzz/bytesource/bytesource.go b/vendor/github.com/google/gofuzz/bytesource/bytesource.go deleted file mode 100644 index 5bb365949..000000000 --- a/vendor/github.com/google/gofuzz/bytesource/bytesource.go +++ /dev/null @@ -1,81 +0,0 @@ -/* -Copyright 2014 Google Inc. All rights reserved. - -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 bytesource provides a rand.Source64 that is determined by a slice of bytes. -package bytesource - -import ( - "bytes" - "encoding/binary" - "io" - "math/rand" -) - -// ByteSource implements rand.Source64 determined by a slice of bytes. The random numbers are -// generated from each 8 bytes in the slice, until the last bytes are consumed, from which a -// fallback pseudo random source is created in case more random numbers are required. -// It also exposes a `bytes.Reader` API, which lets callers consume the bytes directly. -type ByteSource struct { - *bytes.Reader - fallback rand.Source -} - -// New returns a new ByteSource from a given slice of bytes. -func New(input []byte) *ByteSource { - s := &ByteSource{ - Reader: bytes.NewReader(input), - fallback: rand.NewSource(0), - } - if len(input) > 0 { - s.fallback = rand.NewSource(int64(s.consumeUint64())) - } - return s -} - -func (s *ByteSource) Uint64() uint64 { - // Return from input if it was not exhausted. - if s.Len() > 0 { - return s.consumeUint64() - } - - // Input was exhausted, return random number from fallback (in this case fallback should not be - // nil). Try first having a Uint64 output (Should work in current rand implementation), - // otherwise return a conversion of Int63. - if s64, ok := s.fallback.(rand.Source64); ok { - return s64.Uint64() - } - return uint64(s.fallback.Int63()) -} - -func (s *ByteSource) Int63() int64 { - return int64(s.Uint64() >> 1) -} - -func (s *ByteSource) Seed(seed int64) { - s.fallback = rand.NewSource(seed) - s.Reader = bytes.NewReader(nil) -} - -// consumeUint64 reads 8 bytes from the input and convert them to a uint64. It assumes that the the -// bytes reader is not empty. -func (s *ByteSource) consumeUint64() uint64 { - var bytes [8]byte - _, err := s.Read(bytes[:]) - if err != nil && err != io.EOF { - panic("failed reading source") // Should not happen. - } - return binary.BigEndian.Uint64(bytes[:]) -} diff --git a/vendor/github.com/google/gofuzz/doc.go b/vendor/github.com/google/gofuzz/doc.go deleted file mode 100644 index 9f9956d4a..000000000 --- a/vendor/github.com/google/gofuzz/doc.go +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright 2014 Google Inc. All rights reserved. - -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 fuzz is a library for populating go objects with random values. -package fuzz diff --git a/vendor/github.com/google/gofuzz/fuzz.go b/vendor/github.com/google/gofuzz/fuzz.go deleted file mode 100644 index 761520a8c..000000000 --- a/vendor/github.com/google/gofuzz/fuzz.go +++ /dev/null @@ -1,605 +0,0 @@ -/* -Copyright 2014 Google Inc. All rights reserved. - -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 fuzz - -import ( - "fmt" - "math/rand" - "reflect" - "regexp" - "time" - - "github.com/google/gofuzz/bytesource" - "strings" -) - -// fuzzFuncMap is a map from a type to a fuzzFunc that handles that type. -type fuzzFuncMap map[reflect.Type]reflect.Value - -// Fuzzer knows how to fill any object with random fields. -type Fuzzer struct { - fuzzFuncs fuzzFuncMap - defaultFuzzFuncs fuzzFuncMap - r *rand.Rand - nilChance float64 - minElements int - maxElements int - maxDepth int - skipFieldPatterns []*regexp.Regexp -} - -// New returns a new Fuzzer. Customize your Fuzzer further by calling Funcs, -// RandSource, NilChance, or NumElements in any order. -func New() *Fuzzer { - return NewWithSeed(time.Now().UnixNano()) -} - -func NewWithSeed(seed int64) *Fuzzer { - f := &Fuzzer{ - defaultFuzzFuncs: fuzzFuncMap{ - reflect.TypeOf(&time.Time{}): reflect.ValueOf(fuzzTime), - }, - - fuzzFuncs: fuzzFuncMap{}, - r: rand.New(rand.NewSource(seed)), - nilChance: .2, - minElements: 1, - maxElements: 10, - maxDepth: 100, - } - return f -} - -// NewFromGoFuzz is a helper function that enables using gofuzz (this -// project) with go-fuzz (https://github.com/dvyukov/go-fuzz) for continuous -// fuzzing. Essentially, it enables translating the fuzzing bytes from -// go-fuzz to any Go object using this library. -// -// This implementation promises a constant translation from a given slice of -// bytes to the fuzzed objects. This promise will remain over future -// versions of Go and of this library. -// -// Note: the returned Fuzzer should not be shared between multiple goroutines, -// as its deterministic output will no longer be available. -// -// Example: use go-fuzz to test the function `MyFunc(int)` in the package -// `mypackage`. Add the file: "mypacakge_fuzz.go" with the content: -// -// // +build gofuzz -// package mypacakge -// import fuzz "github.com/google/gofuzz" -// func Fuzz(data []byte) int { -// var i int -// fuzz.NewFromGoFuzz(data).Fuzz(&i) -// MyFunc(i) -// return 0 -// } -func NewFromGoFuzz(data []byte) *Fuzzer { - return New().RandSource(bytesource.New(data)) -} - -// Funcs adds each entry in fuzzFuncs as a custom fuzzing function. -// -// Each entry in fuzzFuncs must be a function taking two parameters. -// The first parameter must be a pointer or map. It is the variable that -// function will fill with random data. The second parameter must be a -// fuzz.Continue, which will provide a source of randomness and a way -// to automatically continue fuzzing smaller pieces of the first parameter. -// -// These functions are called sensibly, e.g., if you wanted custom string -// fuzzing, the function `func(s *string, c fuzz.Continue)` would get -// called and passed the address of strings. Maps and pointers will always -// be made/new'd for you, ignoring the NilChange option. For slices, it -// doesn't make much sense to pre-create them--Fuzzer doesn't know how -// long you want your slice--so take a pointer to a slice, and make it -// yourself. (If you don't want your map/pointer type pre-made, take a -// pointer to it, and make it yourself.) See the examples for a range of -// custom functions. -func (f *Fuzzer) Funcs(fuzzFuncs ...interface{}) *Fuzzer { - for i := range fuzzFuncs { - v := reflect.ValueOf(fuzzFuncs[i]) - if v.Kind() != reflect.Func { - panic("Need only funcs!") - } - t := v.Type() - if t.NumIn() != 2 || t.NumOut() != 0 { - panic("Need 2 in and 0 out params!") - } - argT := t.In(0) - switch argT.Kind() { - case reflect.Ptr, reflect.Map: - default: - panic("fuzzFunc must take pointer or map type") - } - if t.In(1) != reflect.TypeOf(Continue{}) { - panic("fuzzFunc's second parameter must be type fuzz.Continue") - } - f.fuzzFuncs[argT] = v - } - return f -} - -// RandSource causes f to get values from the given source of randomness. -// Use if you want deterministic fuzzing. -func (f *Fuzzer) RandSource(s rand.Source) *Fuzzer { - f.r = rand.New(s) - return f -} - -// NilChance sets the probability of creating a nil pointer, map, or slice to -// 'p'. 'p' should be between 0 (no nils) and 1 (all nils), inclusive. -func (f *Fuzzer) NilChance(p float64) *Fuzzer { - if p < 0 || p > 1 { - panic("p should be between 0 and 1, inclusive.") - } - f.nilChance = p - return f -} - -// NumElements sets the minimum and maximum number of elements that will be -// added to a non-nil map or slice. -func (f *Fuzzer) NumElements(atLeast, atMost int) *Fuzzer { - if atLeast > atMost { - panic("atLeast must be <= atMost") - } - if atLeast < 0 { - panic("atLeast must be >= 0") - } - f.minElements = atLeast - f.maxElements = atMost - return f -} - -func (f *Fuzzer) genElementCount() int { - if f.minElements == f.maxElements { - return f.minElements - } - return f.minElements + f.r.Intn(f.maxElements-f.minElements+1) -} - -func (f *Fuzzer) genShouldFill() bool { - return f.r.Float64() >= f.nilChance -} - -// MaxDepth sets the maximum number of recursive fuzz calls that will be made -// before stopping. This includes struct members, pointers, and map and slice -// elements. -func (f *Fuzzer) MaxDepth(d int) *Fuzzer { - f.maxDepth = d - return f -} - -// Skip fields which match the supplied pattern. Call this multiple times if needed -// This is useful to skip XXX_ fields generated by protobuf -func (f *Fuzzer) SkipFieldsWithPattern(pattern *regexp.Regexp) *Fuzzer { - f.skipFieldPatterns = append(f.skipFieldPatterns, pattern) - return f -} - -// Fuzz recursively fills all of obj's fields with something random. First -// this tries to find a custom fuzz function (see Funcs). If there is no -// custom function this tests whether the object implements fuzz.Interface and, -// if so, calls Fuzz on it to fuzz itself. If that fails, this will see if -// there is a default fuzz function provided by this package. If all of that -// fails, this will generate random values for all primitive fields and then -// recurse for all non-primitives. -// -// This is safe for cyclic or tree-like structs, up to a limit. Use the -// MaxDepth method to adjust how deep you need it to recurse. -// -// obj must be a pointer. Only exported (public) fields can be set (thanks, -// golang :/ ) Intended for tests, so will panic on bad input or unimplemented -// fields. -func (f *Fuzzer) Fuzz(obj interface{}) { - v := reflect.ValueOf(obj) - if v.Kind() != reflect.Ptr { - panic("needed ptr!") - } - v = v.Elem() - f.fuzzWithContext(v, 0) -} - -// FuzzNoCustom is just like Fuzz, except that any custom fuzz function for -// obj's type will not be called and obj will not be tested for fuzz.Interface -// conformance. This applies only to obj and not other instances of obj's -// type. -// Not safe for cyclic or tree-like structs! -// obj must be a pointer. Only exported (public) fields can be set (thanks, golang :/ ) -// Intended for tests, so will panic on bad input or unimplemented fields. -func (f *Fuzzer) FuzzNoCustom(obj interface{}) { - v := reflect.ValueOf(obj) - if v.Kind() != reflect.Ptr { - panic("needed ptr!") - } - v = v.Elem() - f.fuzzWithContext(v, flagNoCustomFuzz) -} - -const ( - // Do not try to find a custom fuzz function. Does not apply recursively. - flagNoCustomFuzz uint64 = 1 << iota -) - -func (f *Fuzzer) fuzzWithContext(v reflect.Value, flags uint64) { - fc := &fuzzerContext{fuzzer: f} - fc.doFuzz(v, flags) -} - -// fuzzerContext carries context about a single fuzzing run, which lets Fuzzer -// be thread-safe. -type fuzzerContext struct { - fuzzer *Fuzzer - curDepth int -} - -func (fc *fuzzerContext) doFuzz(v reflect.Value, flags uint64) { - if fc.curDepth >= fc.fuzzer.maxDepth { - return - } - fc.curDepth++ - defer func() { fc.curDepth-- }() - - if !v.CanSet() { - return - } - - if flags&flagNoCustomFuzz == 0 { - // Check for both pointer and non-pointer custom functions. - if v.CanAddr() && fc.tryCustom(v.Addr()) { - return - } - if fc.tryCustom(v) { - return - } - } - - if fn, ok := fillFuncMap[v.Kind()]; ok { - fn(v, fc.fuzzer.r) - return - } - - switch v.Kind() { - case reflect.Map: - if fc.fuzzer.genShouldFill() { - v.Set(reflect.MakeMap(v.Type())) - n := fc.fuzzer.genElementCount() - for i := 0; i < n; i++ { - key := reflect.New(v.Type().Key()).Elem() - fc.doFuzz(key, 0) - val := reflect.New(v.Type().Elem()).Elem() - fc.doFuzz(val, 0) - v.SetMapIndex(key, val) - } - return - } - v.Set(reflect.Zero(v.Type())) - case reflect.Ptr: - if fc.fuzzer.genShouldFill() { - v.Set(reflect.New(v.Type().Elem())) - fc.doFuzz(v.Elem(), 0) - return - } - v.Set(reflect.Zero(v.Type())) - case reflect.Slice: - if fc.fuzzer.genShouldFill() { - n := fc.fuzzer.genElementCount() - v.Set(reflect.MakeSlice(v.Type(), n, n)) - for i := 0; i < n; i++ { - fc.doFuzz(v.Index(i), 0) - } - return - } - v.Set(reflect.Zero(v.Type())) - case reflect.Array: - if fc.fuzzer.genShouldFill() { - n := v.Len() - for i := 0; i < n; i++ { - fc.doFuzz(v.Index(i), 0) - } - return - } - v.Set(reflect.Zero(v.Type())) - case reflect.Struct: - for i := 0; i < v.NumField(); i++ { - skipField := false - fieldName := v.Type().Field(i).Name - for _, pattern := range fc.fuzzer.skipFieldPatterns { - if pattern.MatchString(fieldName) { - skipField = true - break - } - } - if !skipField { - fc.doFuzz(v.Field(i), 0) - } - } - case reflect.Chan: - fallthrough - case reflect.Func: - fallthrough - case reflect.Interface: - fallthrough - default: - panic(fmt.Sprintf("Can't handle %#v", v.Interface())) - } -} - -// tryCustom searches for custom handlers, and returns true iff it finds a match -// and successfully randomizes v. -func (fc *fuzzerContext) tryCustom(v reflect.Value) bool { - // First: see if we have a fuzz function for it. - doCustom, ok := fc.fuzzer.fuzzFuncs[v.Type()] - if !ok { - // Second: see if it can fuzz itself. - if v.CanInterface() { - intf := v.Interface() - if fuzzable, ok := intf.(Interface); ok { - fuzzable.Fuzz(Continue{fc: fc, Rand: fc.fuzzer.r}) - return true - } - } - // Finally: see if there is a default fuzz function. - doCustom, ok = fc.fuzzer.defaultFuzzFuncs[v.Type()] - if !ok { - return false - } - } - - switch v.Kind() { - case reflect.Ptr: - if v.IsNil() { - if !v.CanSet() { - return false - } - v.Set(reflect.New(v.Type().Elem())) - } - case reflect.Map: - if v.IsNil() { - if !v.CanSet() { - return false - } - v.Set(reflect.MakeMap(v.Type())) - } - default: - return false - } - - doCustom.Call([]reflect.Value{v, reflect.ValueOf(Continue{ - fc: fc, - Rand: fc.fuzzer.r, - })}) - return true -} - -// Interface represents an object that knows how to fuzz itself. Any time we -// find a type that implements this interface we will delegate the act of -// fuzzing itself. -type Interface interface { - Fuzz(c Continue) -} - -// Continue can be passed to custom fuzzing functions to allow them to use -// the correct source of randomness and to continue fuzzing their members. -type Continue struct { - fc *fuzzerContext - - // For convenience, Continue implements rand.Rand via embedding. - // Use this for generating any randomness if you want your fuzzing - // to be repeatable for a given seed. - *rand.Rand -} - -// Fuzz continues fuzzing obj. obj must be a pointer. -func (c Continue) Fuzz(obj interface{}) { - v := reflect.ValueOf(obj) - if v.Kind() != reflect.Ptr { - panic("needed ptr!") - } - v = v.Elem() - c.fc.doFuzz(v, 0) -} - -// FuzzNoCustom continues fuzzing obj, except that any custom fuzz function for -// obj's type will not be called and obj will not be tested for fuzz.Interface -// conformance. This applies only to obj and not other instances of obj's -// type. -func (c Continue) FuzzNoCustom(obj interface{}) { - v := reflect.ValueOf(obj) - if v.Kind() != reflect.Ptr { - panic("needed ptr!") - } - v = v.Elem() - c.fc.doFuzz(v, flagNoCustomFuzz) -} - -// RandString makes a random string up to 20 characters long. The returned string -// may include a variety of (valid) UTF-8 encodings. -func (c Continue) RandString() string { - return randString(c.Rand) -} - -// RandUint64 makes random 64 bit numbers. -// Weirdly, rand doesn't have a function that gives you 64 random bits. -func (c Continue) RandUint64() uint64 { - return randUint64(c.Rand) -} - -// RandBool returns true or false randomly. -func (c Continue) RandBool() bool { - return randBool(c.Rand) -} - -func fuzzInt(v reflect.Value, r *rand.Rand) { - v.SetInt(int64(randUint64(r))) -} - -func fuzzUint(v reflect.Value, r *rand.Rand) { - v.SetUint(randUint64(r)) -} - -func fuzzTime(t *time.Time, c Continue) { - var sec, nsec int64 - // Allow for about 1000 years of random time values, which keeps things - // like JSON parsing reasonably happy. - sec = c.Rand.Int63n(1000 * 365 * 24 * 60 * 60) - c.Fuzz(&nsec) - *t = time.Unix(sec, nsec) -} - -var fillFuncMap = map[reflect.Kind]func(reflect.Value, *rand.Rand){ - reflect.Bool: func(v reflect.Value, r *rand.Rand) { - v.SetBool(randBool(r)) - }, - reflect.Int: fuzzInt, - reflect.Int8: fuzzInt, - reflect.Int16: fuzzInt, - reflect.Int32: fuzzInt, - reflect.Int64: fuzzInt, - reflect.Uint: fuzzUint, - reflect.Uint8: fuzzUint, - reflect.Uint16: fuzzUint, - reflect.Uint32: fuzzUint, - reflect.Uint64: fuzzUint, - reflect.Uintptr: fuzzUint, - reflect.Float32: func(v reflect.Value, r *rand.Rand) { - v.SetFloat(float64(r.Float32())) - }, - reflect.Float64: func(v reflect.Value, r *rand.Rand) { - v.SetFloat(r.Float64()) - }, - reflect.Complex64: func(v reflect.Value, r *rand.Rand) { - v.SetComplex(complex128(complex(r.Float32(), r.Float32()))) - }, - reflect.Complex128: func(v reflect.Value, r *rand.Rand) { - v.SetComplex(complex(r.Float64(), r.Float64())) - }, - reflect.String: func(v reflect.Value, r *rand.Rand) { - v.SetString(randString(r)) - }, - reflect.UnsafePointer: func(v reflect.Value, r *rand.Rand) { - panic("unimplemented") - }, -} - -// randBool returns true or false randomly. -func randBool(r *rand.Rand) bool { - return r.Int31()&(1<<30) == 0 -} - -type int63nPicker interface { - Int63n(int64) int64 -} - -// UnicodeRange describes a sequential range of unicode characters. -// Last must be numerically greater than First. -type UnicodeRange struct { - First, Last rune -} - -// UnicodeRanges describes an arbitrary number of sequential ranges of unicode characters. -// To be useful, each range must have at least one character (First <= Last) and -// there must be at least one range. -type UnicodeRanges []UnicodeRange - -// choose returns a random unicode character from the given range, using the -// given randomness source. -func (ur UnicodeRange) choose(r int63nPicker) rune { - count := int64(ur.Last - ur.First + 1) - return ur.First + rune(r.Int63n(count)) -} - -// CustomStringFuzzFunc constructs a FuzzFunc which produces random strings. -// Each character is selected from the range ur. If there are no characters -// in the range (cr.Last < cr.First), this will panic. -func (ur UnicodeRange) CustomStringFuzzFunc() func(s *string, c Continue) { - ur.check() - return func(s *string, c Continue) { - *s = ur.randString(c.Rand) - } -} - -// check is a function that used to check whether the first of ur(UnicodeRange) -// is greater than the last one. -func (ur UnicodeRange) check() { - if ur.Last < ur.First { - panic("The last encoding must be greater than the first one.") - } -} - -// randString of UnicodeRange makes a random string up to 20 characters long. -// Each character is selected form ur(UnicodeRange). -func (ur UnicodeRange) randString(r *rand.Rand) string { - n := r.Intn(20) - sb := strings.Builder{} - sb.Grow(n) - for i := 0; i < n; i++ { - sb.WriteRune(ur.choose(r)) - } - return sb.String() -} - -// defaultUnicodeRanges sets a default unicode range when user do not set -// CustomStringFuzzFunc() but wants fuzz string. -var defaultUnicodeRanges = UnicodeRanges{ - {' ', '~'}, // ASCII characters - {'\u00a0', '\u02af'}, // Multi-byte encoded characters - {'\u4e00', '\u9fff'}, // Common CJK (even longer encodings) -} - -// CustomStringFuzzFunc constructs a FuzzFunc which produces random strings. -// Each character is selected from one of the ranges of ur(UnicodeRanges). -// Each range has an equal probability of being chosen. If there are no ranges, -// or a selected range has no characters (.Last < .First), this will panic. -// Do not modify any of the ranges in ur after calling this function. -func (ur UnicodeRanges) CustomStringFuzzFunc() func(s *string, c Continue) { - // Check unicode ranges slice is empty. - if len(ur) == 0 { - panic("UnicodeRanges is empty.") - } - // if not empty, each range should be checked. - for i := range ur { - ur[i].check() - } - return func(s *string, c Continue) { - *s = ur.randString(c.Rand) - } -} - -// randString of UnicodeRanges makes a random string up to 20 characters long. -// Each character is selected form one of the ranges of ur(UnicodeRanges), -// and each range has an equal probability of being chosen. -func (ur UnicodeRanges) randString(r *rand.Rand) string { - n := r.Intn(20) - sb := strings.Builder{} - sb.Grow(n) - for i := 0; i < n; i++ { - sb.WriteRune(ur[r.Intn(len(ur))].choose(r)) - } - return sb.String() -} - -// randString makes a random string up to 20 characters long. The returned string -// may include a variety of (valid) UTF-8 encodings. -func randString(r *rand.Rand) string { - return defaultUnicodeRanges.randString(r) -} - -// randUint64 makes random 64 bit numbers. -// Weirdly, rand doesn't have a function that gives you 64 random bits. -func randUint64(r *rand.Rand) uint64 { - return uint64(r.Uint32())<<32 | uint64(r.Uint32()) -} diff --git a/vendor/github.com/google/gopacket/.gitignore b/vendor/github.com/google/gopacket/.gitignore deleted file mode 100644 index 149266fdb..000000000 --- a/vendor/github.com/google/gopacket/.gitignore +++ /dev/null @@ -1,38 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -#* -*~ - -# examples binaries -examples/synscan/synscan -examples/pfdump/pfdump -examples/pcapdump/pcapdump -examples/httpassembly/httpassembly -examples/statsassembly/statsassembly -examples/arpscan/arpscan -examples/bidirectional/bidirectional -examples/bytediff/bytediff -examples/reassemblydump/reassemblydump -layers/gen -macs/gen -pcap/pcap_tester diff --git a/vendor/github.com/google/gopacket/.travis.gofmt.sh b/vendor/github.com/google/gopacket/.travis.gofmt.sh deleted file mode 100644 index e341a1cb7..000000000 --- a/vendor/github.com/google/gopacket/.travis.gofmt.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -cd "$(dirname $0)" -if [ -n "$(go fmt ./...)" ]; then - echo "Go code is not formatted, run 'go fmt github.com/google/stenographer/...'" >&2 - exit 1 -fi diff --git a/vendor/github.com/google/gopacket/.travis.golint.sh b/vendor/github.com/google/gopacket/.travis.golint.sh deleted file mode 100644 index 0e267f521..000000000 --- a/vendor/github.com/google/gopacket/.travis.golint.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -cd "$(dirname $0)" - -go get golang.org/x/lint/golint -DIRS=". tcpassembly tcpassembly/tcpreader ip4defrag reassembly macs pcapgo pcap afpacket pfring routing defrag/lcmdefrag" -# Add subdirectories here as we clean up golint on each. -for subdir in $DIRS; do - pushd $subdir - if golint | - grep -v CannotSetRFMon | # pcap exported error name - grep -v DataLost | # tcpassembly/tcpreader exported error name - grep .; then - exit 1 - fi - popd -done - -pushd layers -for file in *.go; do - if cat .lint_blacklist | grep -q $file; then - echo "Skipping lint of $file due to .lint_blacklist" - elif golint $file | grep .; then - echo "Lint error in file $file" - exit 1 - fi -done -popd diff --git a/vendor/github.com/google/gopacket/.travis.govet.sh b/vendor/github.com/google/gopacket/.travis.govet.sh deleted file mode 100644 index a5c13544c..000000000 --- a/vendor/github.com/google/gopacket/.travis.govet.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -cd "$(dirname $0)" -DIRS=". layers pcap pcapgo tcpassembly tcpassembly/tcpreader routing ip4defrag bytediff macs defrag/lcmdefrag" -set -e -for subdir in $DIRS; do - pushd $subdir - go vet - popd -done diff --git a/vendor/github.com/google/gopacket/.travis.install.sh b/vendor/github.com/google/gopacket/.travis.install.sh deleted file mode 100644 index 648c90163..000000000 --- a/vendor/github.com/google/gopacket/.travis.install.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -set -ev - -go get github.com/google/gopacket -go get github.com/google/gopacket/layers -go get github.com/google/gopacket/tcpassembly -go get github.com/google/gopacket/reassembly -go get github.com/google/gopacket/pcapgo diff --git a/vendor/github.com/google/gopacket/.travis.script.sh b/vendor/github.com/google/gopacket/.travis.script.sh deleted file mode 100644 index a483f4f7c..000000000 --- a/vendor/github.com/google/gopacket/.travis.script.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -set -ev - -go test github.com/google/gopacket -go test github.com/google/gopacket/layers -go test github.com/google/gopacket/tcpassembly -go test github.com/google/gopacket/reassembly -go test github.com/google/gopacket/pcapgo -go test github.com/google/gopacket/pcap diff --git a/vendor/github.com/google/gopacket/.travis.yml b/vendor/github.com/google/gopacket/.travis.yml deleted file mode 100644 index 84f1f4945..000000000 --- a/vendor/github.com/google/gopacket/.travis.yml +++ /dev/null @@ -1,57 +0,0 @@ -language: go -go: - - 1.11.x - - 1.12.x - - 1.13.x - - master - -addons: - apt: - packages: - libpcap-dev - -# use modules except for older versions (see below) -install: true - -env: - - GO111MODULE=on - -script: ./.travis.script.sh - -matrix: - fast_finish: true - allow_failures: - - go: master - -jobs: - include: - - go: 1.5.x - install: ./.travis.install.sh - - go: 1.6.x - install: ./.travis.install.sh - - go: 1.7.x - install: ./.travis.install.sh - - go: 1.8.x - install: ./.travis.install.sh - - go: 1.9.x - install: ./.travis.install.sh - - go: 1.10.x - install: ./.travis.install.sh - - os: osx - go: 1.x -# windows doesn't work on travis (package installation just hangs and then errors out) -# - os: windows -# go: 1.x -# # We don't need nmap - but that's the only way to get npcap: -# before_install: choco install npcap --version 0.86 -y - - stage: style - name: "fmt/vet/lint" - go: 1.x - script: - - ./.travis.gofmt.sh - - ./.travis.govet.sh - - ./.travis.golint.sh - -stages: - - style - - test diff --git a/vendor/github.com/google/gopacket/AUTHORS b/vendor/github.com/google/gopacket/AUTHORS deleted file mode 100644 index 24e834e45..000000000 --- a/vendor/github.com/google/gopacket/AUTHORS +++ /dev/null @@ -1,54 +0,0 @@ -AUTHORS AND MAINTAINERS: - -MAIN DEVELOPERS: -Graeme Connell - -AUTHORS: -Nigel Tao -Cole Mickens -Ben Daglish -Luis Martinez -Remco Verhoef -Hiroaki Kawai -Lukas Lueg -Laurent Hausermann -Bill Green -Christian Mäder -Gernot Vormayr -Vitor Garcia Graveto -Elias Chavarria Reyes -Daniel Rittweiler - -CONTRIBUTORS: -Attila Oláh -Vittus Mikiassen -Matthias Radestock -Matthew Sackman -Loic Prylli -Alexandre Fiori -Adrian Tam -Satoshi Matsumoto -David Stainton -Jesse Ward -Kane Mathers -Jose Selvi -Yerden Zhumabekov -Jensen Hwa - ------------------------------------------------ -FORKED FROM github.com/akrennmair/gopcap -ALL THE FOLLOWING ARE FOR THAT PROJECT - -MAIN DEVELOPERS: -Andreas Krennmair - -CONTRIBUTORS: -Andrea Nall -Daniel Arndt -Dustin Sallings -Graeme Connell -Guillaume Savary -Mark Smith -Miek Gieben -Mike Bell -Trevor Strohman diff --git a/vendor/github.com/google/gopacket/CONTRIBUTING.md b/vendor/github.com/google/gopacket/CONTRIBUTING.md deleted file mode 100644 index 99ab7a2e4..000000000 --- a/vendor/github.com/google/gopacket/CONTRIBUTING.md +++ /dev/null @@ -1,215 +0,0 @@ -Contributing To gopacket -======================== - -So you've got some code and you'd like it to be part of gopacket... wonderful! -We're happy to accept contributions, whether they're fixes to old protocols, new -protocols entirely, or anything else you think would improve the gopacket -library. This document is designed to help you to do just that. - -The first section deals with the plumbing: how to actually get a change -submitted. - -The second section deals with coding style... Go is great in that it -has a uniform style implemented by 'go fmt', but there's still some decisions -we've made that go above and beyond, and if you follow them, they won't come up -in your code review. - -The third section deals with some of the implementation decisions we've made, -which may help you to understand the current code and which we may ask you to -conform to (or provide compelling reasons for ignoring). - -Overall, we hope this document will help you to understand our system and write -great code which fits in, and help us to turn around on your code review quickly -so the code can make it into the master branch as quickly as possible. - - -How To Submit Code ------------------- - -We use github.com's Pull Request feature to receive code contributions from -external contributors. See -https://help.github.com/articles/creating-a-pull-request/ for details on -how to create a request. - -Also, there's a local script `gc` in the base directory of GoPacket that -runs a local set of checks, which should give you relatively high confidence -that your pull won't fail github pull checks. - -```sh -go get github.com/google/gopacket -cd $GOROOT/src/pkg/github.com/google/gopacket -git checkout -b # create a new branch to work from -... code code code ... -./gc # Run this to do local commits, it performs a number of checks -``` - -To sum up: - -* DO - + Pull down the latest version. - + Make a feature-specific branch. - + Code using the style and methods discussed in the rest of this document. - + Use the ./gc command to do local commits or check correctness. - + Push your new feature branch up to github.com, as a pull request. - + Handle comments and requests from reviewers, pushing new commits up to - your feature branch as problems are addressed. - + Put interesting comments and discussions into commit comments. -* DON'T - + Push to someone else's branch without their permission. - - -Coding Style ------------- - -* Go code must be run through `go fmt`, `go vet`, and `golint` -* Follow http://golang.org/doc/effective_go.html as much as possible. - + In particular, http://golang.org/doc/effective_go.html#mixed-caps. Enums - should be be CamelCase, with acronyms capitalized (TCPSourcePort, vs. - TcpSourcePort or TCP_SOURCE_PORT). -* Bonus points for giving enum types a String() field. -* Any exported types or functions should have commentary - (http://golang.org/doc/effective_go.html#commentary) - - -Coding Methods And Implementation Notes ---------------------------------------- - -### Error Handling - -Many times, you'll be decoding a protocol and run across something bad, a packet -corruption or the like. How do you handle this? First off, ALWAYS report the -error. You can do this either by returning the error from the decode() function -(most common), or if you're up for it you can implement and add an ErrorLayer -through the packet builder (the first method is a simple shortcut that does -exactly this, then stops any future decoding). - -Often, you'll already have decode some part of your protocol by the time you hit -your error. Use your own discretion to determine whether the stuff you've -already decoded should be returned to the caller or not: - -```go -func decodeMyProtocol(data []byte, p gopacket.PacketBuilder) error { - prot := &MyProtocol{} - if len(data) < 10 { - // This error occurred before we did ANYTHING, so there's nothing in my - // protocol that the caller could possibly want. Just return the error. - return fmt.Errorf("Length %d less than 10", len(data)) - } - prot.ImportantField1 = data[:5] - prot.ImportantField2 = data[5:10] - // At this point, we've already got enough information in 'prot' to - // warrant returning it to the caller, so we'll add it now. - p.AddLayer(prot) - if len(data) < 15 { - // We encountered an error later in the packet, but the caller already - // has the important info we've gleaned so far. - return fmt.Errorf("Length %d less than 15", len(data)) - } - prot.ImportantField3 = data[10:15] - return nil // We've already added the layer, we can just return success. -} -``` - -In general, our code follows the approach of returning the first error it -encounters. In general, we don't trust any bytes after the first error we see. - -### What Is A Layer? - -The definition of a layer is up to the discretion of the coder. It should be -something important enough that it's actually useful to the caller (IE: every -TLV value should probably NOT be a layer). However, it can be more granular -than a single protocol... IPv6 and SCTP both implement many layers to handle the -various parts of the protocol. Use your best judgement, and prepare to defend -your decisions during code review. ;) - -### Performance - -We strive to make gopacket as fast as possible while still providing lots of -features. In general, this means: - -* Focus performance tuning on common protocols (IP4/6, TCP, etc), and optimize - others on an as-needed basis (tons of MPLS on your network? Time to optimize - MPLS!) -* Use fast operations. See the toplevel benchmark_test for benchmarks of some - of Go's underlying features and types. -* Test your performance changes! You should use the ./gc script's --benchmark - flag to submit any performance-related changes. Use pcap/gopacket_benchmark - to test your change against a PCAP file based on your traffic patterns. -* Don't be TOO hacky. Sometimes, removing an unused struct from a field causes - a huge performance hit, due to the way that Go currently handles its segmented - stack... don't be afraid to clean it up anyway. We'll trust the Go compiler - to get good enough over time to handle this. Also, this type of - compiler-specific optimization is very fragile; someone adding a field to an - entirely different struct elsewhere in the codebase could reverse any gains - you might achieve by aligning your allocations. -* Try to minimize memory allocations. If possible, use []byte to reference - pieces of the input, instead of using string, which requires copying the bytes - into a new memory allocation. -* Think hard about what should be evaluated lazily vs. not. In general, a - layer's struct should almost exactly mirror the layer's frame. Anything - that's more interesting should be a function. This may not always be - possible, but it's a good rule of thumb. -* Don't fear micro-optimizations. With the above in mind, we welcome - micro-optimizations that we think will have positive/neutral impacts on the - majority of workloads. A prime example of this is pre-allocating certain - structs within a larger one: - -```go -type MyProtocol struct { - // Most packets have 1-4 of VeryCommon, so we preallocate it here. - initialAllocation [4]uint32 - VeryCommon []uint32 -} - -func decodeMyProtocol(data []byte, p gopacket.PacketBuilder) error { - prot := &MyProtocol{} - prot.VeryCommon = proto.initialAllocation[:0] - for len(data) > 4 { - field := binary.BigEndian.Uint32(data[:4]) - data = data[4:] - // Since we're using the underlying initialAllocation, we won't need to - // allocate new memory for the following append unless we more than 16 - // bytes of data, which should be the uncommon case. - prot.VeryCommon = append(prot.VeryCommon, field) - } - p.AddLayer(prot) - if len(data) > 0 { - return fmt.Errorf("MyProtocol packet has %d bytes left after decoding", len(data)) - } - return nil -} -``` - -### Slices And Data - -If you're pulling a slice from the data you're decoding, don't copy it. Just -use the slice itself. - -```go -type MyProtocol struct { - A, B net.IP -} -func decodeMyProtocol(data []byte, p gopacket.PacketBuilder) error { - p.AddLayer(&MyProtocol{ - A: data[:4], - B: data[4:8], - }) - return nil -} -``` - -The caller has already agreed, by using this library, that they won't modify the -set of bytes they pass in to the decoder, or the library has already copied the -set of bytes to a read-only location. See DecodeOptions.NoCopy for more -information. - -### Enums/Types - -If a protocol has an integer field (uint8, uint16, etc) with a couple of known -values that mean something special, make it a type. This allows us to do really -nice things like adding a String() function to them, so we can more easily -display those to users. Check out layers/enums.go for one example, as well as -layers/icmp.go for layer-specific enums. - -When naming things, try for descriptiveness over suscinctness. For example, -choose DNSResponseRecord over DNSRR. diff --git a/vendor/github.com/google/gopacket/LICENSE b/vendor/github.com/google/gopacket/LICENSE deleted file mode 100644 index 2100d524d..000000000 --- a/vendor/github.com/google/gopacket/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ -Copyright (c) 2012 Google, Inc. All rights reserved. -Copyright (c) 2009-2011 Andreas Krennmair. 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 Andreas Krennmair, Google, 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. diff --git a/vendor/github.com/google/gopacket/README.md b/vendor/github.com/google/gopacket/README.md deleted file mode 100644 index efe462ee1..000000000 --- a/vendor/github.com/google/gopacket/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# GoPacket - -This library provides packet decoding capabilities for Go. -See [godoc](https://godoc.org/github.com/google/gopacket) for more details. - -[![Build Status](https://travis-ci.org/google/gopacket.svg?branch=master)](https://travis-ci.org/google/gopacket) -[![GoDoc](https://godoc.org/github.com/google/gopacket?status.svg)](https://godoc.org/github.com/google/gopacket) - -Minimum Go version required is 1.5 except for pcapgo/EthernetHandle, afpacket, and bsdbpf which need at least 1.9 due to x/sys/unix dependencies. - -Originally forked from the gopcap project written by Andreas -Krennmair (http://github.com/akrennmair/gopcap). diff --git a/vendor/github.com/google/gopacket/base.go b/vendor/github.com/google/gopacket/base.go deleted file mode 100644 index 91e150c21..000000000 --- a/vendor/github.com/google/gopacket/base.go +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package gopacket - -import ( - "fmt" -) - -// Layer represents a single decoded packet layer (using either the -// OSI or TCP/IP definition of a layer). When decoding, a packet's data is -// broken up into a number of layers. The caller may call LayerType() to -// figure out which type of layer they've received from the packet. Optionally, -// they may then use a type assertion to get the actual layer type for deep -// inspection of the data. -type Layer interface { - // LayerType is the gopacket type for this layer. - LayerType() LayerType - // LayerContents returns the set of bytes that make up this layer. - LayerContents() []byte - // LayerPayload returns the set of bytes contained within this layer, not - // including the layer itself. - LayerPayload() []byte -} - -// Payload is a Layer containing the payload of a packet. The definition of -// what constitutes the payload of a packet depends on previous layers; for -// TCP and UDP, we stop decoding above layer 4 and return the remaining -// bytes as a Payload. Payload is an ApplicationLayer. -type Payload []byte - -// LayerType returns LayerTypePayload -func (p Payload) LayerType() LayerType { return LayerTypePayload } - -// LayerContents returns the bytes making up this layer. -func (p Payload) LayerContents() []byte { return []byte(p) } - -// LayerPayload returns the payload within this layer. -func (p Payload) LayerPayload() []byte { return nil } - -// Payload returns this layer as bytes. -func (p Payload) Payload() []byte { return []byte(p) } - -// String implements fmt.Stringer. -func (p Payload) String() string { return fmt.Sprintf("%d byte(s)", len(p)) } - -// GoString implements fmt.GoStringer. -func (p Payload) GoString() string { return LongBytesGoString([]byte(p)) } - -// CanDecode implements DecodingLayer. -func (p Payload) CanDecode() LayerClass { return LayerTypePayload } - -// NextLayerType implements DecodingLayer. -func (p Payload) NextLayerType() LayerType { return LayerTypeZero } - -// DecodeFromBytes implements DecodingLayer. -func (p *Payload) DecodeFromBytes(data []byte, df DecodeFeedback) error { - *p = Payload(data) - return nil -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (p Payload) SerializeTo(b SerializeBuffer, opts SerializeOptions) error { - bytes, err := b.PrependBytes(len(p)) - if err != nil { - return err - } - copy(bytes, p) - return nil -} - -// decodePayload decodes data by returning it all in a Payload layer. -func decodePayload(data []byte, p PacketBuilder) error { - payload := &Payload{} - if err := payload.DecodeFromBytes(data, p); err != nil { - return err - } - p.AddLayer(payload) - p.SetApplicationLayer(payload) - return nil -} - -// Fragment is a Layer containing a fragment of a larger frame, used by layers -// like IPv4 and IPv6 that allow for fragmentation of their payloads. -type Fragment []byte - -// LayerType returns LayerTypeFragment -func (p *Fragment) LayerType() LayerType { return LayerTypeFragment } - -// LayerContents implements Layer. -func (p *Fragment) LayerContents() []byte { return []byte(*p) } - -// LayerPayload implements Layer. -func (p *Fragment) LayerPayload() []byte { return nil } - -// Payload returns this layer as a byte slice. -func (p *Fragment) Payload() []byte { return []byte(*p) } - -// String implements fmt.Stringer. -func (p *Fragment) String() string { return fmt.Sprintf("%d byte(s)", len(*p)) } - -// CanDecode implements DecodingLayer. -func (p *Fragment) CanDecode() LayerClass { return LayerTypeFragment } - -// NextLayerType implements DecodingLayer. -func (p *Fragment) NextLayerType() LayerType { return LayerTypeZero } - -// DecodeFromBytes implements DecodingLayer. -func (p *Fragment) DecodeFromBytes(data []byte, df DecodeFeedback) error { - *p = Fragment(data) - return nil -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (p *Fragment) SerializeTo(b SerializeBuffer, opts SerializeOptions) error { - bytes, err := b.PrependBytes(len(*p)) - if err != nil { - return err - } - copy(bytes, *p) - return nil -} - -// decodeFragment decodes data by returning it all in a Fragment layer. -func decodeFragment(data []byte, p PacketBuilder) error { - payload := &Fragment{} - if err := payload.DecodeFromBytes(data, p); err != nil { - return err - } - p.AddLayer(payload) - p.SetApplicationLayer(payload) - return nil -} - -// These layers correspond to Internet Protocol Suite (TCP/IP) layers, and their -// corresponding OSI layers, as best as possible. - -// LinkLayer is the packet layer corresponding to TCP/IP layer 1 (OSI layer 2) -type LinkLayer interface { - Layer - LinkFlow() Flow -} - -// NetworkLayer is the packet layer corresponding to TCP/IP layer 2 (OSI -// layer 3) -type NetworkLayer interface { - Layer - NetworkFlow() Flow -} - -// TransportLayer is the packet layer corresponding to the TCP/IP layer 3 (OSI -// layer 4) -type TransportLayer interface { - Layer - TransportFlow() Flow -} - -// ApplicationLayer is the packet layer corresponding to the TCP/IP layer 4 (OSI -// layer 7), also known as the packet payload. -type ApplicationLayer interface { - Layer - Payload() []byte -} - -// ErrorLayer is a packet layer created when decoding of the packet has failed. -// Its payload is all the bytes that we were unable to decode, and the returned -// error details why the decoding failed. -type ErrorLayer interface { - Layer - Error() error -} diff --git a/vendor/github.com/google/gopacket/decode.go b/vendor/github.com/google/gopacket/decode.go deleted file mode 100644 index 2633f848e..000000000 --- a/vendor/github.com/google/gopacket/decode.go +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package gopacket - -import ( - "errors" -) - -// DecodeFeedback is used by DecodingLayer layers to provide decoding metadata. -type DecodeFeedback interface { - // SetTruncated should be called if during decoding you notice that a packet - // is shorter than internal layer variables (HeaderLength, or the like) say it - // should be. It sets packet.Metadata().Truncated. - SetTruncated() -} - -type nilDecodeFeedback struct{} - -func (nilDecodeFeedback) SetTruncated() {} - -// NilDecodeFeedback implements DecodeFeedback by doing nothing. -var NilDecodeFeedback DecodeFeedback = nilDecodeFeedback{} - -// PacketBuilder is used by layer decoders to store the layers they've decoded, -// and to defer future decoding via NextDecoder. -// Typically, the pattern for use is: -// func (m *myDecoder) Decode(data []byte, p PacketBuilder) error { -// if myLayer, err := myDecodingLogic(data); err != nil { -// return err -// } else { -// p.AddLayer(myLayer) -// } -// // maybe do this, if myLayer is a LinkLayer -// p.SetLinkLayer(myLayer) -// return p.NextDecoder(nextDecoder) -// } -type PacketBuilder interface { - DecodeFeedback - // AddLayer should be called by a decoder immediately upon successful - // decoding of a layer. - AddLayer(l Layer) - // The following functions set the various specific layers in the final - // packet. Note that if many layers call SetX, the first call is kept and all - // other calls are ignored. - SetLinkLayer(LinkLayer) - SetNetworkLayer(NetworkLayer) - SetTransportLayer(TransportLayer) - SetApplicationLayer(ApplicationLayer) - SetErrorLayer(ErrorLayer) - // NextDecoder should be called by a decoder when they're done decoding a - // packet layer but not done with decoding the entire packet. The next - // decoder will be called to decode the last AddLayer's LayerPayload. - // Because of this, NextDecoder must only be called once all other - // PacketBuilder calls have been made. Set*Layer and AddLayer calls after - // NextDecoder calls will behave incorrectly. - NextDecoder(next Decoder) error - // DumpPacketData is used solely for decoding. If you come across an error - // you need to diagnose while processing a packet, call this and your packet's - // data will be dumped to stderr so you can create a test. This should never - // be called from a production decoder. - DumpPacketData() - // DecodeOptions returns the decode options - DecodeOptions() *DecodeOptions -} - -// Decoder is an interface for logic to decode a packet layer. Users may -// implement a Decoder to handle their own strange packet types, or may use one -// of the many decoders available in the 'layers' subpackage to decode things -// for them. -type Decoder interface { - // Decode decodes the bytes of a packet, sending decoded values and other - // information to PacketBuilder, and returning an error if unsuccessful. See - // the PacketBuilder documentation for more details. - Decode([]byte, PacketBuilder) error -} - -// DecodeFunc wraps a function to make it a Decoder. -type DecodeFunc func([]byte, PacketBuilder) error - -// Decode implements Decoder by calling itself. -func (d DecodeFunc) Decode(data []byte, p PacketBuilder) error { - // function, call thyself. - return d(data, p) -} - -// DecodePayload is a Decoder that returns a Payload layer containing all -// remaining bytes. -var DecodePayload Decoder = DecodeFunc(decodePayload) - -// DecodeUnknown is a Decoder that returns an Unknown layer containing all -// remaining bytes, useful if you run up against a layer that you're unable to -// decode yet. This layer is considered an ErrorLayer. -var DecodeUnknown Decoder = DecodeFunc(decodeUnknown) - -// DecodeFragment is a Decoder that returns a Fragment layer containing all -// remaining bytes. -var DecodeFragment Decoder = DecodeFunc(decodeFragment) - -// LayerTypeZero is an invalid layer type, but can be used to determine whether -// layer type has actually been set correctly. -var LayerTypeZero = RegisterLayerType(0, LayerTypeMetadata{Name: "Unknown", Decoder: DecodeUnknown}) - -// LayerTypeDecodeFailure is the layer type for the default error layer. -var LayerTypeDecodeFailure = RegisterLayerType(1, LayerTypeMetadata{Name: "DecodeFailure", Decoder: DecodeUnknown}) - -// LayerTypePayload is the layer type for a payload that we don't try to decode -// but treat as a success, IE: an application-level payload. -var LayerTypePayload = RegisterLayerType(2, LayerTypeMetadata{Name: "Payload", Decoder: DecodePayload}) - -// LayerTypeFragment is the layer type for a fragment of a layer transported -// by an underlying layer that supports fragmentation. -var LayerTypeFragment = RegisterLayerType(3, LayerTypeMetadata{Name: "Fragment", Decoder: DecodeFragment}) - -// DecodeFailure is a packet layer created if decoding of the packet data failed -// for some reason. It implements ErrorLayer. LayerContents will be the entire -// set of bytes that failed to parse, and Error will return the reason parsing -// failed. -type DecodeFailure struct { - data []byte - err error - stack []byte -} - -// Error returns the error encountered during decoding. -func (d *DecodeFailure) Error() error { return d.err } - -// LayerContents implements Layer. -func (d *DecodeFailure) LayerContents() []byte { return d.data } - -// LayerPayload implements Layer. -func (d *DecodeFailure) LayerPayload() []byte { return nil } - -// String implements fmt.Stringer. -func (d *DecodeFailure) String() string { - return "Packet decoding error: " + d.Error().Error() -} - -// Dump implements Dumper. -func (d *DecodeFailure) Dump() (s string) { - if d.stack != nil { - s = string(d.stack) - } - return -} - -// LayerType returns LayerTypeDecodeFailure -func (d *DecodeFailure) LayerType() LayerType { return LayerTypeDecodeFailure } - -// decodeUnknown "decodes" unsupported data types by returning an error. -// This decoder will thus always return a DecodeFailure layer. -func decodeUnknown(data []byte, p PacketBuilder) error { - return errors.New("Layer type not currently supported") -} diff --git a/vendor/github.com/google/gopacket/doc.go b/vendor/github.com/google/gopacket/doc.go deleted file mode 100644 index b46e43dfa..000000000 --- a/vendor/github.com/google/gopacket/doc.go +++ /dev/null @@ -1,432 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -/* -Package gopacket provides packet decoding for the Go language. - -gopacket contains many sub-packages with additional functionality you may find -useful, including: - - * layers: You'll probably use this every time. This contains of the logic - built into gopacket for decoding packet protocols. Note that all example - code below assumes that you have imported both gopacket and - gopacket/layers. - * pcap: C bindings to use libpcap to read packets off the wire. - * pfring: C bindings to use PF_RING to read packets off the wire. - * afpacket: C bindings for Linux's AF_PACKET to read packets off the wire. - * tcpassembly: TCP stream reassembly - -Also, if you're looking to dive right into code, see the examples subdirectory -for numerous simple binaries built using gopacket libraries. - -Minimum go version required is 1.5 except for pcapgo/EthernetHandle, afpacket, -and bsdbpf which need at least 1.7 due to x/sys/unix dependencies. - -Basic Usage - -gopacket takes in packet data as a []byte and decodes it into a packet with -a non-zero number of "layers". Each layer corresponds to a protocol -within the bytes. Once a packet has been decoded, the layers of the packet -can be requested from the packet. - - // Decode a packet - packet := gopacket.NewPacket(myPacketData, layers.LayerTypeEthernet, gopacket.Default) - // Get the TCP layer from this packet - if tcpLayer := packet.Layer(layers.LayerTypeTCP); tcpLayer != nil { - fmt.Println("This is a TCP packet!") - // Get actual TCP data from this layer - tcp, _ := tcpLayer.(*layers.TCP) - fmt.Printf("From src port %d to dst port %d\n", tcp.SrcPort, tcp.DstPort) - } - // Iterate over all layers, printing out each layer type - for _, layer := range packet.Layers() { - fmt.Println("PACKET LAYER:", layer.LayerType()) - } - -Packets can be decoded from a number of starting points. Many of our base -types implement Decoder, which allow us to decode packets for which -we don't have full data. - - // Decode an ethernet packet - ethP := gopacket.NewPacket(p1, layers.LayerTypeEthernet, gopacket.Default) - // Decode an IPv6 header and everything it contains - ipP := gopacket.NewPacket(p2, layers.LayerTypeIPv6, gopacket.Default) - // Decode a TCP header and its payload - tcpP := gopacket.NewPacket(p3, layers.LayerTypeTCP, gopacket.Default) - - -Reading Packets From A Source - -Most of the time, you won't just have a []byte of packet data lying around. -Instead, you'll want to read packets in from somewhere (file, interface, etc) -and process them. To do that, you'll want to build a PacketSource. - -First, you'll need to construct an object that implements the PacketDataSource -interface. There are implementations of this interface bundled with gopacket -in the gopacket/pcap and gopacket/pfring subpackages... see their documentation -for more information on their usage. Once you have a PacketDataSource, you can -pass it into NewPacketSource, along with a Decoder of your choice, to create -a PacketSource. - -Once you have a PacketSource, you can read packets from it in multiple ways. -See the docs for PacketSource for more details. The easiest method is the -Packets function, which returns a channel, then asynchronously writes new -packets into that channel, closing the channel if the packetSource hits an -end-of-file. - - packetSource := ... // construct using pcap or pfring - for packet := range packetSource.Packets() { - handlePacket(packet) // do something with each packet - } - -You can change the decoding options of the packetSource by setting fields in -packetSource.DecodeOptions... see the following sections for more details. - - -Lazy Decoding - -gopacket optionally decodes packet data lazily, meaning it -only decodes a packet layer when it needs to handle a function call. - - // Create a packet, but don't actually decode anything yet - packet := gopacket.NewPacket(myPacketData, layers.LayerTypeEthernet, gopacket.Lazy) - // Now, decode the packet up to the first IPv4 layer found but no further. - // If no IPv4 layer was found, the whole packet will be decoded looking for - // it. - ip4 := packet.Layer(layers.LayerTypeIPv4) - // Decode all layers and return them. The layers up to the first IPv4 layer - // are already decoded, and will not require decoding a second time. - layers := packet.Layers() - -Lazily-decoded packets are not concurrency-safe. Since layers have not all been -decoded, each call to Layer() or Layers() has the potential to mutate the packet -in order to decode the next layer. If a packet is used -in multiple goroutines concurrently, don't use gopacket.Lazy. Then gopacket -will decode the packet fully, and all future function calls won't mutate the -object. - - -NoCopy Decoding - -By default, gopacket will copy the slice passed to NewPacket and store the -copy within the packet, so future mutations to the bytes underlying the slice -don't affect the packet and its layers. If you can guarantee that the -underlying slice bytes won't be changed, you can use NoCopy to tell -gopacket.NewPacket, and it'll use the passed-in slice itself. - - // This channel returns new byte slices, each of which points to a new - // memory location that's guaranteed immutable for the duration of the - // packet. - for data := range myByteSliceChannel { - p := gopacket.NewPacket(data, layers.LayerTypeEthernet, gopacket.NoCopy) - doSomethingWithPacket(p) - } - -The fastest method of decoding is to use both Lazy and NoCopy, but note from -the many caveats above that for some implementations either or both may be -dangerous. - - -Pointers To Known Layers - -During decoding, certain layers are stored in the packet as well-known -layer types. For example, IPv4 and IPv6 are both considered NetworkLayer -layers, while TCP and UDP are both TransportLayer layers. We support 4 -layers, corresponding to the 4 layers of the TCP/IP layering scheme (roughly -anagalous to layers 2, 3, 4, and 7 of the OSI model). To access these, -you can use the packet.LinkLayer, packet.NetworkLayer, -packet.TransportLayer, and packet.ApplicationLayer functions. Each of -these functions returns a corresponding interface -(gopacket.{Link,Network,Transport,Application}Layer). The first three -provide methods for getting src/dst addresses for that particular layer, -while the final layer provides a Payload function to get payload data. -This is helpful, for example, to get payloads for all packets regardless -of their underlying data type: - - // Get packets from some source - for packet := range someSource { - if app := packet.ApplicationLayer(); app != nil { - if strings.Contains(string(app.Payload()), "magic string") { - fmt.Println("Found magic string in a packet!") - } - } - } - -A particularly useful layer is ErrorLayer, which is set whenever there's -an error parsing part of the packet. - - packet := gopacket.NewPacket(myPacketData, layers.LayerTypeEthernet, gopacket.Default) - if err := packet.ErrorLayer(); err != nil { - fmt.Println("Error decoding some part of the packet:", err) - } - -Note that we don't return an error from NewPacket because we may have decoded -a number of layers successfully before running into our erroneous layer. You -may still be able to get your Ethernet and IPv4 layers correctly, even if -your TCP layer is malformed. - - -Flow And Endpoint - -gopacket has two useful objects, Flow and Endpoint, for communicating in a protocol -independent manner the fact that a packet is coming from A and going to B. -The general layer types LinkLayer, NetworkLayer, and TransportLayer all provide -methods for extracting their flow information, without worrying about the type -of the underlying Layer. - -A Flow is a simple object made up of a set of two Endpoints, one source and one -destination. It details the sender and receiver of the Layer of the Packet. - -An Endpoint is a hashable representation of a source or destination. For -example, for LayerTypeIPv4, an Endpoint contains the IP address bytes for a v4 -IP packet. A Flow can be broken into Endpoints, and Endpoints can be combined -into Flows: - - packet := gopacket.NewPacket(myPacketData, layers.LayerTypeEthernet, gopacket.Lazy) - netFlow := packet.NetworkLayer().NetworkFlow() - src, dst := netFlow.Endpoints() - reverseFlow := gopacket.NewFlow(dst, src) - -Both Endpoint and Flow objects can be used as map keys, and the equality -operator can compare them, so you can easily group together all packets -based on endpoint criteria: - - flows := map[gopacket.Endpoint]chan gopacket.Packet - packet := gopacket.NewPacket(myPacketData, layers.LayerTypeEthernet, gopacket.Lazy) - // Send all TCP packets to channels based on their destination port. - if tcp := packet.Layer(layers.LayerTypeTCP); tcp != nil { - flows[tcp.TransportFlow().Dst()] <- packet - } - // Look for all packets with the same source and destination network address - if net := packet.NetworkLayer(); net != nil { - src, dst := net.NetworkFlow().Endpoints() - if src == dst { - fmt.Println("Fishy packet has same network source and dst: %s", src) - } - } - // Find all packets coming from UDP port 1000 to UDP port 500 - interestingFlow := gopacket.FlowFromEndpoints(layers.NewUDPPortEndpoint(1000), layers.NewUDPPortEndpoint(500)) - if t := packet.NetworkLayer(); t != nil && t.TransportFlow() == interestingFlow { - fmt.Println("Found that UDP flow I was looking for!") - } - -For load-balancing purposes, both Flow and Endpoint have FastHash() functions, -which provide quick, non-cryptographic hashes of their contents. Of particular -importance is the fact that Flow FastHash() is symmetric: A->B will have the same -hash as B->A. An example usage could be: - - channels := [8]chan gopacket.Packet - for i := 0; i < 8; i++ { - channels[i] = make(chan gopacket.Packet) - go packetHandler(channels[i]) - } - for packet := range getPackets() { - if net := packet.NetworkLayer(); net != nil { - channels[int(net.NetworkFlow().FastHash()) & 0x7] <- packet - } - } - -This allows us to split up a packet stream while still making sure that each -stream sees all packets for a flow (and its bidirectional opposite). - - -Implementing Your Own Decoder - -If your network has some strange encapsulation, you can implement your own -decoder. In this example, we handle Ethernet packets which are encapsulated -in a 4-byte header. - - // Create a layer type, should be unique and high, so it doesn't conflict, - // giving it a name and a decoder to use. - var MyLayerType = gopacket.RegisterLayerType(12345, gopacket.LayerTypeMetadata{Name: "MyLayerType", Decoder: gopacket.DecodeFunc(decodeMyLayer)}) - - // Implement my layer - type MyLayer struct { - StrangeHeader []byte - payload []byte - } - func (m MyLayer) LayerType() gopacket.LayerType { return MyLayerType } - func (m MyLayer) LayerContents() []byte { return m.StrangeHeader } - func (m MyLayer) LayerPayload() []byte { return m.payload } - - // Now implement a decoder... this one strips off the first 4 bytes of the - // packet. - func decodeMyLayer(data []byte, p gopacket.PacketBuilder) error { - // Create my layer - p.AddLayer(&MyLayer{data[:4], data[4:]}) - // Determine how to handle the rest of the packet - return p.NextDecoder(layers.LayerTypeEthernet) - } - - // Finally, decode your packets: - p := gopacket.NewPacket(data, MyLayerType, gopacket.Lazy) - -See the docs for Decoder and PacketBuilder for more details on how coding -decoders works, or look at RegisterLayerType and RegisterEndpointType to see how -to add layer/endpoint types to gopacket. - - -Fast Decoding With DecodingLayerParser - -TLDR: DecodingLayerParser takes about 10% of the time as NewPacket to decode -packet data, but only for known packet stacks. - -Basic decoding using gopacket.NewPacket or PacketSource.Packets is somewhat slow -due to its need to allocate a new packet and every respective layer. It's very -versatile and can handle all known layer types, but sometimes you really only -care about a specific set of layers regardless, so that versatility is wasted. - -DecodingLayerParser avoids memory allocation altogether by decoding packet -layers directly into preallocated objects, which you can then reference to get -the packet's information. A quick example: - - func main() { - var eth layers.Ethernet - var ip4 layers.IPv4 - var ip6 layers.IPv6 - var tcp layers.TCP - parser := gopacket.NewDecodingLayerParser(layers.LayerTypeEthernet, ð, &ip4, &ip6, &tcp) - decoded := []gopacket.LayerType{} - for packetData := range somehowGetPacketData() { - if err := parser.DecodeLayers(packetData, &decoded); err != nil { - fmt.Fprintf(os.Stderr, "Could not decode layers: %v\n", err) - continue - } - for _, layerType := range decoded { - switch layerType { - case layers.LayerTypeIPv6: - fmt.Println(" IP6 ", ip6.SrcIP, ip6.DstIP) - case layers.LayerTypeIPv4: - fmt.Println(" IP4 ", ip4.SrcIP, ip4.DstIP) - } - } - } - } - -The important thing to note here is that the parser is modifying the passed in -layers (eth, ip4, ip6, tcp) instead of allocating new ones, thus greatly -speeding up the decoding process. It's even branching based on layer type... -it'll handle an (eth, ip4, tcp) or (eth, ip6, tcp) stack. However, it won't -handle any other type... since no other decoders were passed in, an (eth, ip4, -udp) stack will stop decoding after ip4, and only pass back [LayerTypeEthernet, -LayerTypeIPv4] through the 'decoded' slice (along with an error saying it can't -decode a UDP packet). - -Unfortunately, not all layers can be used by DecodingLayerParser... only those -implementing the DecodingLayer interface are usable. Also, it's possible to -create DecodingLayers that are not themselves Layers... see -layers.IPv6ExtensionSkipper for an example of this. - -Faster And Customized Decoding with DecodingLayerContainer - -By default, DecodingLayerParser uses native map to store and search for a layer -to decode. Though being versatile, in some cases this solution may be not so -optimal. For example, if you have only few layers faster operations may be -provided by sparse array indexing or linear array scan. - -To accomodate these scenarios, DecodingLayerContainer interface is introduced -along with its implementations: DecodingLayerSparse, DecodingLayerArray and -DecodingLayerMap. You can specify a container implementation to -DecodingLayerParser with SetDecodingLayerContainer method. Example: - - dlp := gopacket.NewDecodingLayerParser(LayerTypeEthernet) - dlp.SetDecodingLayerContainer(gopacket.DecodingLayerSparse(nil)) - var eth layers.Ethernet - dlp.AddDecodingLayer(ð) - // ... add layers and use DecodingLayerParser as usual... - -To skip one level of indirection (though sacrificing some capabilities) you may -also use DecodingLayerContainer as a decoding tool as it is. In this case you have to -handle unknown layer types and layer panics by yourself. Example: - - func main() { - var eth layers.Ethernet - var ip4 layers.IPv4 - var ip6 layers.IPv6 - var tcp layers.TCP - dlc := gopacket.DecodingLayerContainer(gopacket.DecodingLayerArray(nil)) - dlc = dlc.Put(ð) - dlc = dlc.Put(&ip4) - dlc = dlc.Put(&ip6) - dlc = dlc.Put(&tcp) - // you may specify some meaningful DecodeFeedback - decoder := dlc.LayersDecoder(LayerTypeEthernet, gopacket.NilDecodeFeedback) - decoded := make([]gopacket.LayerType, 0, 20) - for packetData := range somehowGetPacketData() { - lt, err := decoder(packetData, &decoded) - if err != nil { - fmt.Fprintf(os.Stderr, "Could not decode layers: %v\n", err) - continue - } - if lt != gopacket.LayerTypeZero { - fmt.Fprintf(os.Stderr, "unknown layer type: %v\n", lt) - continue - } - for _, layerType := range decoded { - // examine decoded layertypes just as already shown above - } - } - } - -DecodingLayerSparse is the fastest but most effective when LayerType values -that layers in use can decode are not large because otherwise that would lead -to bigger memory footprint. DecodingLayerArray is very compact and primarily -usable if the number of decoding layers is not big (up to ~10-15, but please do -your own benchmarks). DecodingLayerMap is the most versatile one and used by -DecodingLayerParser by default. Please refer to tests and benchmarks in layers -subpackage to further examine usage examples and performance measurements. - -You may also choose to implement your own DecodingLayerContainer if you want to -make use of your own internal packet decoding logic. - -Creating Packet Data - -As well as offering the ability to decode packet data, gopacket will allow you -to create packets from scratch, as well. A number of gopacket layers implement -the SerializableLayer interface; these layers can be serialized to a []byte in -the following manner: - - ip := &layers.IPv4{ - SrcIP: net.IP{1, 2, 3, 4}, - DstIP: net.IP{5, 6, 7, 8}, - // etc... - } - buf := gopacket.NewSerializeBuffer() - opts := gopacket.SerializeOptions{} // See SerializeOptions for more details. - err := ip.SerializeTo(buf, opts) - if err != nil { panic(err) } - fmt.Println(buf.Bytes()) // prints out a byte slice containing the serialized IPv4 layer. - -SerializeTo PREPENDS the given layer onto the SerializeBuffer, and they treat -the current buffer's Bytes() slice as the payload of the serializing layer. -Therefore, you can serialize an entire packet by serializing a set of layers in -reverse order (Payload, then TCP, then IP, then Ethernet, for example). The -SerializeBuffer's SerializeLayers function is a helper that does exactly that. - -To generate a (empty and useless, because no fields are set) -Ethernet(IPv4(TCP(Payload))) packet, for example, you can run: - - buf := gopacket.NewSerializeBuffer() - opts := gopacket.SerializeOptions{} - gopacket.SerializeLayers(buf, opts, - &layers.Ethernet{}, - &layers.IPv4{}, - &layers.TCP{}, - gopacket.Payload([]byte{1, 2, 3, 4})) - packetData := buf.Bytes() - -A Final Note - -If you use gopacket, you'll almost definitely want to make sure gopacket/layers -is imported, since when imported it sets all the LayerType variables and fills -in a lot of interesting variables/maps (DecodersByLayerName, etc). Therefore, -it's recommended that even if you don't use any layers functions directly, you still import with: - - import ( - _ "github.com/google/gopacket/layers" - ) -*/ -package gopacket diff --git a/vendor/github.com/google/gopacket/flows.go b/vendor/github.com/google/gopacket/flows.go deleted file mode 100644 index a00c88398..000000000 --- a/vendor/github.com/google/gopacket/flows.go +++ /dev/null @@ -1,236 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package gopacket - -import ( - "bytes" - "fmt" - "strconv" -) - -// MaxEndpointSize determines the maximum size in bytes of an endpoint address. -// -// Endpoints/Flows have a problem: They need to be hashable. Therefore, they -// can't use a byte slice. The two obvious choices are to use a string or a -// byte array. Strings work great, but string creation requires memory -// allocation, which can be slow. Arrays work great, but have a fixed size. We -// originally used the former, now we've switched to the latter. Use of a fixed -// byte-array doubles the speed of constructing a flow (due to not needing to -// allocate). This is a huge increase... too much for us to pass up. -// -// The end result of this, though, is that an endpoint/flow can't be created -// using more than MaxEndpointSize bytes per address. -const MaxEndpointSize = 16 - -// Endpoint is the set of bytes used to address packets at various layers. -// See LinkLayer, NetworkLayer, and TransportLayer specifications. -// Endpoints are usable as map keys. -type Endpoint struct { - typ EndpointType - len int - raw [MaxEndpointSize]byte -} - -// EndpointType returns the endpoint type associated with this endpoint. -func (a Endpoint) EndpointType() EndpointType { return a.typ } - -// Raw returns the raw bytes of this endpoint. These aren't human-readable -// most of the time, but they are faster than calling String. -func (a Endpoint) Raw() []byte { return a.raw[:a.len] } - -// LessThan provides a stable ordering for all endpoints. It sorts first based -// on the EndpointType of an endpoint, then based on the raw bytes of that -// endpoint. -// -// For some endpoints, the actual comparison may not make sense, however this -// ordering does provide useful information for most Endpoint types. -// Ordering is based first on endpoint type, then on raw endpoint bytes. -// Endpoint bytes are sorted lexicographically. -func (a Endpoint) LessThan(b Endpoint) bool { - return a.typ < b.typ || (a.typ == b.typ && bytes.Compare(a.raw[:a.len], b.raw[:b.len]) < 0) -} - -// fnvHash is used by our FastHash functions, and implements the FNV hash -// created by Glenn Fowler, Landon Curt Noll, and Phong Vo. -// See http://isthe.com/chongo/tech/comp/fnv/. -func fnvHash(s []byte) (h uint64) { - h = fnvBasis - for i := 0; i < len(s); i++ { - h ^= uint64(s[i]) - h *= fnvPrime - } - return -} - -const fnvBasis = 14695981039346656037 -const fnvPrime = 1099511628211 - -// FastHash provides a quick hashing function for an endpoint, useful if you'd -// like to split up endpoints by modulos or other load-balancing techniques. -// It uses a variant of Fowler-Noll-Vo hashing. -// -// The output of FastHash is not guaranteed to remain the same through future -// code revisions, so should not be used to key values in persistent storage. -func (a Endpoint) FastHash() (h uint64) { - h = fnvHash(a.raw[:a.len]) - h ^= uint64(a.typ) - h *= fnvPrime - return -} - -// NewEndpoint creates a new Endpoint object. -// -// The size of raw must be less than MaxEndpointSize, otherwise this function -// will panic. -func NewEndpoint(typ EndpointType, raw []byte) (e Endpoint) { - e.len = len(raw) - if e.len > MaxEndpointSize { - panic("raw byte length greater than MaxEndpointSize") - } - e.typ = typ - copy(e.raw[:], raw) - return -} - -// EndpointTypeMetadata is used to register a new endpoint type. -type EndpointTypeMetadata struct { - // Name is the string returned by an EndpointType's String function. - Name string - // Formatter is called from an Endpoint's String function to format the raw - // bytes in an Endpoint into a human-readable string. - Formatter func([]byte) string -} - -// EndpointType is the type of a gopacket Endpoint. This type determines how -// the bytes stored in the endpoint should be interpreted. -type EndpointType int64 - -var endpointTypes = map[EndpointType]EndpointTypeMetadata{} - -// RegisterEndpointType creates a new EndpointType and registers it globally. -// It MUST be passed a unique number, or it will panic. Numbers 0-999 are -// reserved for gopacket's use. -func RegisterEndpointType(num int, meta EndpointTypeMetadata) EndpointType { - t := EndpointType(num) - if _, ok := endpointTypes[t]; ok { - panic("Endpoint type number already in use") - } - endpointTypes[t] = meta - return t -} - -func (e EndpointType) String() string { - if t, ok := endpointTypes[e]; ok { - return t.Name - } - return strconv.Itoa(int(e)) -} - -func (a Endpoint) String() string { - if t, ok := endpointTypes[a.typ]; ok && t.Formatter != nil { - return t.Formatter(a.raw[:a.len]) - } - return fmt.Sprintf("%v:%v", a.typ, a.raw) -} - -// Flow represents the direction of traffic for a packet layer, as a source and destination Endpoint. -// Flows are usable as map keys. -type Flow struct { - typ EndpointType - slen, dlen int - src, dst [MaxEndpointSize]byte -} - -// FlowFromEndpoints creates a new flow by pasting together two endpoints. -// The endpoints must have the same EndpointType, or this function will return -// an error. -func FlowFromEndpoints(src, dst Endpoint) (_ Flow, err error) { - if src.typ != dst.typ { - err = fmt.Errorf("Mismatched endpoint types: %v->%v", src.typ, dst.typ) - return - } - return Flow{src.typ, src.len, dst.len, src.raw, dst.raw}, nil -} - -// FastHash provides a quick hashing function for a flow, useful if you'd -// like to split up flows by modulos or other load-balancing techniques. -// It uses a variant of Fowler-Noll-Vo hashing, and is guaranteed to collide -// with its reverse flow. IE: the flow A->B will have the same hash as the flow -// B->A. -// -// The output of FastHash is not guaranteed to remain the same through future -// code revisions, so should not be used to key values in persistent storage. -func (f Flow) FastHash() (h uint64) { - // This combination must be commutative. We don't use ^, since that would - // give the same hash for all A->A flows. - h = fnvHash(f.src[:f.slen]) + fnvHash(f.dst[:f.dlen]) - h ^= uint64(f.typ) - h *= fnvPrime - return -} - -// String returns a human-readable representation of this flow, in the form -// "Src->Dst" -func (f Flow) String() string { - s, d := f.Endpoints() - return fmt.Sprintf("%v->%v", s, d) -} - -// EndpointType returns the EndpointType for this Flow. -func (f Flow) EndpointType() EndpointType { - return f.typ -} - -// Endpoints returns the two Endpoints for this flow. -func (f Flow) Endpoints() (src, dst Endpoint) { - return Endpoint{f.typ, f.slen, f.src}, Endpoint{f.typ, f.dlen, f.dst} -} - -// Src returns the source Endpoint for this flow. -func (f Flow) Src() (src Endpoint) { - src, _ = f.Endpoints() - return -} - -// Dst returns the destination Endpoint for this flow. -func (f Flow) Dst() (dst Endpoint) { - _, dst = f.Endpoints() - return -} - -// Reverse returns a new flow with endpoints reversed. -func (f Flow) Reverse() Flow { - return Flow{f.typ, f.dlen, f.slen, f.dst, f.src} -} - -// NewFlow creates a new flow. -// -// src and dst must have length <= MaxEndpointSize, otherwise NewFlow will -// panic. -func NewFlow(t EndpointType, src, dst []byte) (f Flow) { - f.slen = len(src) - f.dlen = len(dst) - if f.slen > MaxEndpointSize || f.dlen > MaxEndpointSize { - panic("flow raw byte length greater than MaxEndpointSize") - } - f.typ = t - copy(f.src[:], src) - copy(f.dst[:], dst) - return -} - -// EndpointInvalid is an endpoint type used for invalid endpoints, IE endpoints -// that are specified incorrectly during creation. -var EndpointInvalid = RegisterEndpointType(0, EndpointTypeMetadata{Name: "invalid", Formatter: func(b []byte) string { - return fmt.Sprintf("%v", b) -}}) - -// InvalidEndpoint is a singleton Endpoint of type EndpointInvalid. -var InvalidEndpoint = NewEndpoint(EndpointInvalid, nil) - -// InvalidFlow is a singleton Flow of type EndpointInvalid. -var InvalidFlow = NewFlow(EndpointInvalid, nil, nil) diff --git a/vendor/github.com/google/gopacket/gc b/vendor/github.com/google/gopacket/gc deleted file mode 100644 index b1d8d2e1f..000000000 --- a/vendor/github.com/google/gopacket/gc +++ /dev/null @@ -1,288 +0,0 @@ -#!/bin/bash -# Copyright 2012 Google, Inc. All rights reserved. - -# This script provides a simple way to run benchmarks against previous code and -# keep a log of how benchmarks change over time. When used with the --benchmark -# flag, it runs benchmarks from the current code and from the last commit run -# with --benchmark, then stores the results in the git commit description. We -# rerun the old benchmarks along with the new ones, since there's no guarantee -# that git commits will happen on the same machine, so machine differences could -# cause wildly inaccurate results. -# -# If you're making changes to 'gopacket' which could cause performance changes, -# you may be requested to use this commit script to make sure your changes don't -# have large detrimental effects (or to show off how awesome your performance -# improvements are). -# -# If not run with the --benchmark flag, this script is still very useful... it -# makes sure all the correct go formatting, building, and testing work as -# expected. - -function Usage { - cat < - ---benchmark: Run benchmark comparisons against last benchmark'd commit ---root: Run tests that require root priviledges ---gen: Generate code for MACs/ports by pulling down external data - -Note, some 'git commit' flags are necessary, if all else fails, pass in -a -EOF - exit 1 -} - -BENCH="" -GEN="" -ROOT="" -while [ ! -z "$1" ]; do - case "$1" in - "--benchmark") - BENCH="$2" - shift - shift - ;; - "--gen") - GEN="yes" - shift - ;; - "--root") - ROOT="yes" - shift - ;; - "--help") - Usage - ;; - "-h") - Usage - ;; - "help") - Usage - ;; - *) - break - ;; - esac -done - -function Root { - if [ ! -z "$ROOT" ]; then - local exec="$1" - # Some folks (like me) keep source code in places inaccessible by root (like - # NFS), so to make sure things run smoothly we copy them to a /tmp location. - local tmpfile="$(mktemp -t gopacket_XXXXXXXX)" - echo "Running root test executable $exec as $tmpfile" - cp "$exec" "$tmpfile" - chmod a+x "$tmpfile" - shift - sudo "$tmpfile" "$@" - fi -} - -if [ "$#" -eq "0" ]; then - Usage -fi - -cd $(dirname $0) - -# Check for copyright notices. -for filename in $(find ./ -type f -name '*.go'); do - if ! head -n 1 "$filename" | grep -q Copyright; then - echo "File '$filename' may not have copyright notice" - exit 1 - fi -done - -set -e -set -x - -if [ ! -z "$ROOT" ]; then - echo "Running SUDO to get root priviledges for root tests" - sudo echo "have root" -fi - -if [ ! -z "$GEN" ]; then - pushd macs - go run gen.go | gofmt > valid_mac_prefixes.go - popd - pushd layers - go run gen.go | gofmt > iana_ports.go - go run gen2.go | gofmt > enums_generated.go - popd -fi - -# Make sure everything is formatted, compiles, and tests pass. -go fmt ./... -go test -i ./... 2>/dev/null >/dev/null || true -go test -go build -pushd examples/bytediff -go build -popd -if [ -f /usr/include/pcap.h ]; then - pushd pcap - go test ./... - go build ./... - go build pcap_tester.go - Root pcap_tester --mode=basic - Root pcap_tester --mode=filtered - Root pcap_tester --mode=timestamp || echo "You might not support timestamp sources" - popd - pushd examples/afpacket - go build - popd - pushd examples/pcapdump - go build - popd - pushd examples/arpscan - go build - popd - pushd examples/bidirectional - go build - popd - pushd examples/synscan - go build - popd - pushd examples/httpassembly - go build - popd - pushd examples/statsassembly - go build - popd -fi -pushd macs -go test ./... -gofmt -w gen.go -go build gen.go -popd -pushd tcpassembly -go test ./... -popd -pushd reassembly -go test ./... -popd -pushd layers -gofmt -w gen.go -go build gen.go -go test ./... -popd -pushd pcapgo -go test ./... -go build ./... -popd -if [ -f /usr/include/linux/if_packet.h ]; then - if grep -q TPACKET_V3 /usr/include/linux/if_packet.h; then - pushd afpacket - go build ./... - go test ./... - popd - fi -fi -if [ -f /usr/include/pfring.h ]; then - pushd pfring - go test ./... - go build ./... - popd - pushd examples/pfdump - go build - popd -fi -pushd ip4defrag -go test ./... -popd -pushd defrag -go test ./... -popd - -for travis_script in `ls .travis.*.sh`; do - ./$travis_script -done - -# Run our initial commit -git commit "$@" - -if [ -z "$BENCH" ]; then - set +x - echo "We're not benchmarking and we've committed... we're done!" - exit -fi - -### If we get here, we want to run benchmarks from current commit, and compare -### then to benchmarks from the last --benchmark commit. - -# Get our current branch. -BRANCH="$(git branch | grep '^*' | awk '{print $2}')" - -# File we're going to build our commit description in. -COMMIT_FILE="$(mktemp /tmp/tmp.XXXXXXXX)" - -# Add the word "BENCH" to the start of the git commit. -echo -n "BENCH " > $COMMIT_FILE - -# Get the current description... there must be an easier way. -git log -n 1 | grep '^ ' | sed 's/^ //' >> $COMMIT_FILE - -# Get the commit sha for the last benchmark commit -PREV=$(git log -n 1 --grep='BENCHMARK_MARKER_DO_NOT_CHANGE' | head -n 1 | awk '{print $2}') - -## Run current benchmarks - -cat >> $COMMIT_FILE <&1 | tee -a $COMMIT_FILE -pushd layers -go test --test.bench="$BENCH" 2>&1 | tee -a $COMMIT_FILE -popd -cat >> $COMMIT_FILE <&1 | tee -a $COMMIT_FILE -fi - - - -## Reset to last benchmark commit, run benchmarks - -git checkout $PREV - -cat >> $COMMIT_FILE <&1 | tee -a $COMMIT_FILE -pushd layers -go test --test.bench="$BENCH" 2>&1 | tee -a $COMMIT_FILE -popd -cat >> $COMMIT_FILE <&1 | tee -a $COMMIT_FILE -fi - - - -## Reset back to the most recent commit, edit the commit message by appending -## benchmark results. -git checkout $BRANCH -git commit --amend -F $COMMIT_FILE diff --git a/vendor/github.com/google/gopacket/layerclass.go b/vendor/github.com/google/gopacket/layerclass.go deleted file mode 100644 index 775cd0987..000000000 --- a/vendor/github.com/google/gopacket/layerclass.go +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package gopacket - -// LayerClass is a set of LayerTypes, used for grabbing one of a number of -// different types from a packet. -type LayerClass interface { - // Contains returns true if the given layer type should be considered part - // of this layer class. - Contains(LayerType) bool - // LayerTypes returns the set of all layer types in this layer class. - // Note that this may not be a fast operation on all LayerClass - // implementations. - LayerTypes() []LayerType -} - -// Contains implements LayerClass. -func (l LayerType) Contains(a LayerType) bool { - return l == a -} - -// LayerTypes implements LayerClass. -func (l LayerType) LayerTypes() []LayerType { - return []LayerType{l} -} - -// LayerClassSlice implements a LayerClass with a slice. -type LayerClassSlice []bool - -// Contains returns true if the given layer type should be considered part -// of this layer class. -func (s LayerClassSlice) Contains(t LayerType) bool { - return int(t) < len(s) && s[t] -} - -// LayerTypes returns all layer types in this LayerClassSlice. -// Because of LayerClassSlice's implementation, this could be quite slow. -func (s LayerClassSlice) LayerTypes() (all []LayerType) { - for i := 0; i < len(s); i++ { - if s[i] { - all = append(all, LayerType(i)) - } - } - return -} - -// NewLayerClassSlice creates a new LayerClassSlice by creating a slice of -// size max(types) and setting slice[t] to true for each type t. Note, if -// you implement your own LayerType and give it a high value, this WILL create -// a very large slice. -func NewLayerClassSlice(types []LayerType) LayerClassSlice { - var max LayerType - for _, typ := range types { - if typ > max { - max = typ - } - } - t := make([]bool, int(max+1)) - for _, typ := range types { - t[typ] = true - } - return t -} - -// LayerClassMap implements a LayerClass with a map. -type LayerClassMap map[LayerType]bool - -// Contains returns true if the given layer type should be considered part -// of this layer class. -func (m LayerClassMap) Contains(t LayerType) bool { - return m[t] -} - -// LayerTypes returns all layer types in this LayerClassMap. -func (m LayerClassMap) LayerTypes() (all []LayerType) { - for t := range m { - all = append(all, t) - } - return -} - -// NewLayerClassMap creates a LayerClassMap and sets map[t] to true for each -// type in types. -func NewLayerClassMap(types []LayerType) LayerClassMap { - m := LayerClassMap{} - for _, typ := range types { - m[typ] = true - } - return m -} - -// NewLayerClass creates a LayerClass, attempting to be smart about which type -// it creates based on which types are passed in. -func NewLayerClass(types []LayerType) LayerClass { - for _, typ := range types { - if typ > maxLayerType { - // NewLayerClassSlice could create a very large object, so instead create - // a map. - return NewLayerClassMap(types) - } - } - return NewLayerClassSlice(types) -} diff --git a/vendor/github.com/google/gopacket/layers/.lint_blacklist b/vendor/github.com/google/gopacket/layers/.lint_blacklist deleted file mode 100644 index fded4f665..000000000 --- a/vendor/github.com/google/gopacket/layers/.lint_blacklist +++ /dev/null @@ -1,39 +0,0 @@ -dot11.go -eap.go -endpoints.go -enums_generated.go -enums.go -ethernet.go -geneve.go -icmp4.go -icmp6.go -igmp.go -ip4.go -ip6.go -layertypes.go -linux_sll.go -llc.go -lldp.go -mpls.go -ndp.go -ntp.go -ospf.go -pflog.go -pppoe.go -prism.go -radiotap.go -rudp.go -sctp.go -sflow.go -tcp.go -tcpip.go -tls.go -tls_alert.go -tls_appdata.go -tls_cipherspec.go -tls_hanshake.go -tls_test.go -udp.go -udplite.go -usb.go -vrrp.go diff --git a/vendor/github.com/google/gopacket/layers/arp.go b/vendor/github.com/google/gopacket/layers/arp.go deleted file mode 100644 index 0775ac0b6..000000000 --- a/vendor/github.com/google/gopacket/layers/arp.go +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// Copyright 2009-2011 Andreas Krennmair. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - "fmt" - - "github.com/google/gopacket" -) - -// Potential values for ARP.Operation. -const ( - ARPRequest = 1 - ARPReply = 2 -) - -// ARP is a ARP packet header. -type ARP struct { - BaseLayer - AddrType LinkType - Protocol EthernetType - HwAddressSize uint8 - ProtAddressSize uint8 - Operation uint16 - SourceHwAddress []byte - SourceProtAddress []byte - DstHwAddress []byte - DstProtAddress []byte -} - -// LayerType returns LayerTypeARP -func (arp *ARP) LayerType() gopacket.LayerType { return LayerTypeARP } - -// DecodeFromBytes decodes the given bytes into this layer. -func (arp *ARP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 8 { - df.SetTruncated() - return fmt.Errorf("ARP length %d too short", len(data)) - } - arp.AddrType = LinkType(binary.BigEndian.Uint16(data[0:2])) - arp.Protocol = EthernetType(binary.BigEndian.Uint16(data[2:4])) - arp.HwAddressSize = data[4] - arp.ProtAddressSize = data[5] - arp.Operation = binary.BigEndian.Uint16(data[6:8]) - arpLength := 8 + 2*arp.HwAddressSize + 2*arp.ProtAddressSize - if len(data) < int(arpLength) { - df.SetTruncated() - return fmt.Errorf("ARP length %d too short, %d expected", len(data), arpLength) - } - arp.SourceHwAddress = data[8 : 8+arp.HwAddressSize] - arp.SourceProtAddress = data[8+arp.HwAddressSize : 8+arp.HwAddressSize+arp.ProtAddressSize] - arp.DstHwAddress = data[8+arp.HwAddressSize+arp.ProtAddressSize : 8+2*arp.HwAddressSize+arp.ProtAddressSize] - arp.DstProtAddress = data[8+2*arp.HwAddressSize+arp.ProtAddressSize : 8+2*arp.HwAddressSize+2*arp.ProtAddressSize] - - arp.Contents = data[:arpLength] - arp.Payload = data[arpLength:] - return nil -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (arp *ARP) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - size := 8 + len(arp.SourceHwAddress) + len(arp.SourceProtAddress) + len(arp.DstHwAddress) + len(arp.DstProtAddress) - bytes, err := b.PrependBytes(size) - if err != nil { - return err - } - if opts.FixLengths { - if len(arp.SourceHwAddress) != len(arp.DstHwAddress) { - return errors.New("mismatched hardware address sizes") - } - arp.HwAddressSize = uint8(len(arp.SourceHwAddress)) - if len(arp.SourceProtAddress) != len(arp.DstProtAddress) { - return errors.New("mismatched prot address sizes") - } - arp.ProtAddressSize = uint8(len(arp.SourceProtAddress)) - } - binary.BigEndian.PutUint16(bytes, uint16(arp.AddrType)) - binary.BigEndian.PutUint16(bytes[2:], uint16(arp.Protocol)) - bytes[4] = arp.HwAddressSize - bytes[5] = arp.ProtAddressSize - binary.BigEndian.PutUint16(bytes[6:], arp.Operation) - start := 8 - for _, addr := range [][]byte{ - arp.SourceHwAddress, - arp.SourceProtAddress, - arp.DstHwAddress, - arp.DstProtAddress, - } { - copy(bytes[start:], addr) - start += len(addr) - } - return nil -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (arp *ARP) CanDecode() gopacket.LayerClass { - return LayerTypeARP -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (arp *ARP) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypePayload -} - -func decodeARP(data []byte, p gopacket.PacketBuilder) error { - - arp := &ARP{} - return decodingLayerDecoder(arp, data, p) -} diff --git a/vendor/github.com/google/gopacket/layers/asf.go b/vendor/github.com/google/gopacket/layers/asf.go deleted file mode 100644 index d698bd0e5..000000000 --- a/vendor/github.com/google/gopacket/layers/asf.go +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright 2019 The GoPacket Authors. All rights reserved. -// -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file in the root of the source tree. - -package layers - -// This file implements the ASF RMCP payload specified in section 3.2.2.3 of -// https://www.dmtf.org/sites/default/files/standards/documents/DSP0136.pdf - -import ( - "encoding/binary" - "fmt" - - "github.com/google/gopacket" -) - -const ( - // ASFRMCPEnterprise is the IANA-assigned Enterprise Number of the ASF-RMCP. - ASFRMCPEnterprise uint32 = 4542 -) - -// ASFDataIdentifier encapsulates fields used to uniquely identify the format of -// the data block. -// -// While the enterprise number is almost always 4542 (ASF-RMCP), we support -// registering layers using structs of this type as a key in case any users are -// using OEM-extensions. -type ASFDataIdentifier struct { - - // Enterprise is the IANA Enterprise Number associated with the entity that - // defines the message type. A list can be found at - // https://www.iana.org/assignments/enterprise-numbers/enterprise-numbers. - // This can be thought of as the namespace for the message type. - Enterprise uint32 - - // Type is the message type, defined by the entity associated with the - // enterprise above. No pressure, but in the context of EN 4542, 1 byte is - // the difference between sending a ping and telling a machine to do an - // unconditional power down (0x80 and 0x12 respectively). - Type uint8 -} - -// LayerType returns the payload layer type corresponding to an ASF message -// type. -func (a ASFDataIdentifier) LayerType() gopacket.LayerType { - if lt := asfDataLayerTypes[a]; lt != 0 { - return lt - } - - // some layer types don't have a payload, e.g. ASF-RMCP Presence Ping. - return gopacket.LayerTypePayload -} - -// RegisterASFLayerType allows specifying that the data block of ASF packets -// with a given enterprise number and type should be processed by a given layer -// type. This overrides any existing registrations, including defaults. -func RegisterASFLayerType(a ASFDataIdentifier, l gopacket.LayerType) { - asfDataLayerTypes[a] = l -} - -var ( - // ASFDataIdentifierPresencePong is the message type of the response to a - // Presence Ping message. It indicates the sender is ASF-RMCP-aware. - ASFDataIdentifierPresencePong = ASFDataIdentifier{ - Enterprise: ASFRMCPEnterprise, - Type: 0x40, - } - - // ASFDataIdentifierPresencePing is a message type sent to a managed client - // to solicit a Presence Pong response. Clients may ignore this if the RMCP - // version is unsupported. Sending this message with a sequence number <255 - // is the recommended way of finding out whether an implementation sends - // RMCP ACKs (e.g. iDRAC does, Super Micro does not). - // - // Systems implementing IPMI must respond to this ping to conform to the - // spec, so it is a good substitute for an ICMP ping. - ASFDataIdentifierPresencePing = ASFDataIdentifier{ - Enterprise: ASFRMCPEnterprise, - Type: 0x80, - } - - // asfDataLayerTypes is used to find the next layer for a given ASF header. - asfDataLayerTypes = map[ASFDataIdentifier]gopacket.LayerType{ - ASFDataIdentifierPresencePong: LayerTypeASFPresencePong, - } -) - -// ASF defines ASF's generic RMCP message Data block format. See section -// 3.2.2.3. -type ASF struct { - BaseLayer - ASFDataIdentifier - - // Tag is used to match request/response pairs. The tag of a response is set - // to that of the message it is responding to. If a message is - // unidirectional, i.e. not part of a request/response pair, this is set to - // 255. - Tag uint8 - - // 1 byte reserved, set to 0x00. - - // Length is the length of this layer's payload in bytes. - Length uint8 -} - -// LayerType returns LayerTypeASF. It partially satisfies Layer and -// SerializableLayer. -func (*ASF) LayerType() gopacket.LayerType { - return LayerTypeASF -} - -// CanDecode returns LayerTypeASF. It partially satisfies DecodingLayer. -func (a *ASF) CanDecode() gopacket.LayerClass { - return a.LayerType() -} - -// DecodeFromBytes makes the layer represent the provided bytes. It partially -// satisfies DecodingLayer. -func (a *ASF) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 8 { - df.SetTruncated() - return fmt.Errorf("invalid ASF data header, length %v less than 8", - len(data)) - } - - a.BaseLayer.Contents = data[:8] - a.BaseLayer.Payload = data[8:] - - a.Enterprise = binary.BigEndian.Uint32(data[:4]) - a.Type = uint8(data[4]) - a.Tag = uint8(data[5]) - // 1 byte reserved - a.Length = uint8(data[7]) - return nil -} - -// NextLayerType returns the layer type corresponding to the message type of -// this ASF data layer. This partially satisfies DecodingLayer. -func (a *ASF) NextLayerType() gopacket.LayerType { - return a.ASFDataIdentifier.LayerType() -} - -// SerializeTo writes the serialized fom of this layer into the SerializeBuffer, -// partially satisfying SerializableLayer. -func (a *ASF) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - payload := b.Bytes() - bytes, err := b.PrependBytes(8) - if err != nil { - return err - } - binary.BigEndian.PutUint32(bytes[:4], a.Enterprise) - bytes[4] = uint8(a.Type) - bytes[5] = a.Tag - bytes[6] = 0x00 - if opts.FixLengths { - a.Length = uint8(len(payload)) - } - bytes[7] = a.Length - return nil -} - -// decodeASF decodes the byte slice into an RMCP-ASF data struct. -func decodeASF(data []byte, p gopacket.PacketBuilder) error { - return decodingLayerDecoder(&ASF{}, data, p) -} diff --git a/vendor/github.com/google/gopacket/layers/asf_presencepong.go b/vendor/github.com/google/gopacket/layers/asf_presencepong.go deleted file mode 100644 index e9a8baf16..000000000 --- a/vendor/github.com/google/gopacket/layers/asf_presencepong.go +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright 2019 The GoPacket Authors. All rights reserved. -// -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file in the root of the source tree. - -package layers - -// This file implements the RMCP ASF Presence Pong message, specified in section -// 3.2.4.3 of -// https://www.dmtf.org/sites/default/files/standards/documents/DSP0136.pdf. It -// also contains non-competing elements from IPMI v2.0, specified in section -// 13.2.4 of -// https://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/ipmi-intelligent-platform-mgt-interface-spec-2nd-gen-v2-0-spec-update.pdf. - -import ( - "encoding/binary" - "fmt" - - "github.com/google/gopacket" -) - -type ( - // ASFEntity is the type of individual entities that a Presence Pong - // response can indicate support of. The entities currently implemented by - // the spec are IPMI and ASFv1. - ASFEntity uint8 - - // ASFInteraction is the type of individual interactions that a Presence - // Pong response can indicate support for. The interactions currently - // implemented by the spec are RMCP security extensions. Although not - // specified, IPMI uses this field to indicate support for DASH, which is - // supported as well. - ASFInteraction uint8 -) - -const ( - // ASFDCMIEnterprise is the IANA-assigned Enterprise Number of the Data - // Center Manageability Interface Forum. The Presence Pong response's - // Enterprise field being set to this value indicates support for DCMI. The - // DCMI spec regards the OEM field as reserved, so these should be null. - ASFDCMIEnterprise uint32 = 36465 - - // ASFPresencePongEntityIPMI ANDs with Presence Pong's supported entities - // field if the managed system supports IPMI. - ASFPresencePongEntityIPMI ASFEntity = 1 << 7 - - // ASFPresencePongEntityASFv1 ANDs with Presence Pong's supported entities - // field if the managed system supports ASF v1.0. - ASFPresencePongEntityASFv1 ASFEntity = 1 - - // ASFPresencePongInteractionSecurityExtensions ANDs with Presence Pong's - // supported interactions field if the managed system supports RMCP v2.0 - // security extensions. See section 3.2.3. - ASFPresencePongInteractionSecurityExtensions ASFInteraction = 1 << 7 - - // ASFPresencePongInteractionDASH ANDs with Presence Pong's supported - // interactions field if the managed system supports DMTF DASH. See - // https://www.dmtf.org/standards/dash. - ASFPresencePongInteractionDASH ASFInteraction = 1 << 5 -) - -// ASFPresencePong defines the structure of a Presence Pong message's payload. -// See section 3.2.4.3. -type ASFPresencePong struct { - BaseLayer - - // Enterprise is the IANA Enterprise Number of an entity that has defined - // OEM-specific capabilities for the managed client. If no such capabilities - // exist, this is set to ASF's IANA Enterprise Number. - Enterprise uint32 - - // OEM identifies OEM-specific capabilities. Its structure is defined by the - // OEM. This is set to 0s if no OEM-specific capabilities exist. This - // implementation does not change byte order from the wire for this field. - OEM [4]byte - - // We break out entities and interactions into separate booleans as - // discovery is the entire point of this type of message, so we assume they - // are accessed. It also makes gopacket's default layer printing more - // useful. - - // IPMI is true if IPMI is supported by the managed system. There is no - // explicit version in the specification, however given the dates, this is - // assumed to be IPMI v1.0. Support for IPMI is contained in the "supported - // entities" field of the presence pong payload. - IPMI bool - - // ASFv1 indicates support for ASF v1.0. This seems somewhat redundant as - // ASF must be supported in order to receive a response. This is contained - // in the "supported entities" field of the presence pong payload. - ASFv1 bool - - // SecurityExtensions indicates support for RMCP Security Extensions, - // specified in ASF v2.0. This will always be false for v1.x - // implementations. This is contained in the "supported interactions" field - // of the presence pong payload. This field is defined in ASF v1.0, but has - // no useful value. - SecurityExtensions bool - - // DASH is true if DMTF DASH is supported. This is not specified in ASF - // v2.0, but in IPMI v2.0, however the former does not preclude it, so we - // support it. - DASH bool - - // 6 bytes reserved after the entities and interactions fields, set to 0s. -} - -// SupportsDCMI returns whether the Presence Pong message indicates support for -// the Data Center Management Interface, which is an extension of IPMI v2.0. -func (a *ASFPresencePong) SupportsDCMI() bool { - return a.Enterprise == ASFDCMIEnterprise && a.IPMI && a.ASFv1 -} - -// LayerType returns LayerTypeASFPresencePong. It partially satisfies Layer and -// SerializableLayer. -func (*ASFPresencePong) LayerType() gopacket.LayerType { - return LayerTypeASFPresencePong -} - -// CanDecode returns LayerTypeASFPresencePong. It partially satisfies -// DecodingLayer. -func (a *ASFPresencePong) CanDecode() gopacket.LayerClass { - return a.LayerType() -} - -// DecodeFromBytes makes the layer represent the provided bytes. It partially -// satisfies DecodingLayer. -func (a *ASFPresencePong) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 16 { - df.SetTruncated() - return fmt.Errorf("invalid ASF presence pong payload, length %v less than 16", - len(data)) - } - - a.BaseLayer.Contents = data[:16] - a.BaseLayer.Payload = data[16:] - - a.Enterprise = binary.BigEndian.Uint32(data[:4]) - copy(a.OEM[:], data[4:8]) // N.B. no byte order change - a.IPMI = data[8]&uint8(ASFPresencePongEntityIPMI) != 0 - a.ASFv1 = data[8]&uint8(ASFPresencePongEntityASFv1) != 0 - a.SecurityExtensions = data[9]&uint8(ASFPresencePongInteractionSecurityExtensions) != 0 - a.DASH = data[9]&uint8(ASFPresencePongInteractionDASH) != 0 - // ignore remaining 6 bytes; should be set to 0s - return nil -} - -// NextLayerType returns LayerTypePayload, as there are no further layers to -// decode. This partially satisfies DecodingLayer. -func (a *ASFPresencePong) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypePayload -} - -// SerializeTo writes the serialized fom of this layer into the SerializeBuffer, -// partially satisfying SerializableLayer. -func (a *ASFPresencePong) SerializeTo(b gopacket.SerializeBuffer, _ gopacket.SerializeOptions) error { - bytes, err := b.PrependBytes(16) - if err != nil { - return err - } - - binary.BigEndian.PutUint32(bytes[:4], a.Enterprise) - - copy(bytes[4:8], a.OEM[:]) - - bytes[8] = 0 - if a.IPMI { - bytes[8] |= uint8(ASFPresencePongEntityIPMI) - } - if a.ASFv1 { - bytes[8] |= uint8(ASFPresencePongEntityASFv1) - } - - bytes[9] = 0 - if a.SecurityExtensions { - bytes[9] |= uint8(ASFPresencePongInteractionSecurityExtensions) - } - if a.DASH { - bytes[9] |= uint8(ASFPresencePongInteractionDASH) - } - - // zero-out remaining 6 bytes - for i := 10; i < len(bytes); i++ { - bytes[i] = 0x00 - } - - return nil -} - -// decodeASFPresencePong decodes the byte slice into an RMCP-ASF Presence Pong -// struct. -func decodeASFPresencePong(data []byte, p gopacket.PacketBuilder) error { - return decodingLayerDecoder(&ASFPresencePong{}, data, p) -} diff --git a/vendor/github.com/google/gopacket/layers/base.go b/vendor/github.com/google/gopacket/layers/base.go deleted file mode 100644 index cd59b4678..000000000 --- a/vendor/github.com/google/gopacket/layers/base.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "github.com/google/gopacket" -) - -// BaseLayer is a convenience struct which implements the LayerData and -// LayerPayload functions of the Layer interface. -type BaseLayer struct { - // Contents is the set of bytes that make up this layer. IE: for an - // Ethernet packet, this would be the set of bytes making up the - // Ethernet frame. - Contents []byte - // Payload is the set of bytes contained by (but not part of) this - // Layer. Again, to take Ethernet as an example, this would be the - // set of bytes encapsulated by the Ethernet protocol. - Payload []byte -} - -// LayerContents returns the bytes of the packet layer. -func (b *BaseLayer) LayerContents() []byte { return b.Contents } - -// LayerPayload returns the bytes contained within the packet layer. -func (b *BaseLayer) LayerPayload() []byte { return b.Payload } - -type layerDecodingLayer interface { - gopacket.Layer - DecodeFromBytes([]byte, gopacket.DecodeFeedback) error - NextLayerType() gopacket.LayerType -} - -func decodingLayerDecoder(d layerDecodingLayer, data []byte, p gopacket.PacketBuilder) error { - err := d.DecodeFromBytes(data, p) - if err != nil { - return err - } - p.AddLayer(d) - next := d.NextLayerType() - if next == gopacket.LayerTypeZero { - return nil - } - return p.NextDecoder(next) -} - -// hacky way to zero out memory... there must be a better way? -var lotsOfZeros [1024]byte diff --git a/vendor/github.com/google/gopacket/layers/bfd.go b/vendor/github.com/google/gopacket/layers/bfd.go deleted file mode 100644 index 43030fb6a..000000000 --- a/vendor/github.com/google/gopacket/layers/bfd.go +++ /dev/null @@ -1,481 +0,0 @@ -// Copyright 2017 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. -// - -package layers - -import ( - "encoding/binary" - "errors" - - "github.com/google/gopacket" -) - -// BFD Control Packet Format -// ------------------------- -// The current version of BFD's RFC (RFC 5880) contains the following -// diagram for the BFD Control packet format: -// -// 0 1 2 3 -// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// |Vers | Diag |Sta|P|F|C|A|D|M| Detect Mult | Length | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | My Discriminator | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Your Discriminator | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Desired Min TX Interval | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Required Min RX Interval | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Required Min Echo RX Interval | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// -// An optional Authentication Section MAY be present: -// -// 0 1 2 3 -// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Auth Type | Auth Len | Authentication Data... | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// -// -// Simple Password Authentication Section Format -// --------------------------------------------- -// 0 1 2 3 -// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Auth Type | Auth Len | Auth Key ID | Password... | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | ... | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// -// -// Keyed MD5 and Meticulous Keyed MD5 Authentication Section Format -// ---------------------------------------------------------------- -// 0 1 2 3 -// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Auth Type | Auth Len | Auth Key ID | Reserved | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Sequence Number | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Auth Key/Digest... | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | ... | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// -// -// Keyed SHA1 and Meticulous Keyed SHA1 Authentication Section Format -// ------------------------------------------------------------------ -// 0 1 2 3 -// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Auth Type | Auth Len | Auth Key ID | Reserved | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Sequence Number | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Auth Key/Hash... | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | ... | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// -// From https://tools.ietf.org/rfc/rfc5880.txt -const bfdMinimumRecordSizeInBytes int = 24 - -// BFDVersion represents the version as decoded from the BFD control message -type BFDVersion uint8 - -// BFDDiagnostic represents diagnostic infomation about a BFD session -type BFDDiagnostic uint8 - -// constants that define BFDDiagnostic flags -const ( - BFDDiagnosticNone BFDDiagnostic = 0 // No Diagnostic - BFDDiagnosticTimeExpired BFDDiagnostic = 1 // Control Detection Time Expired - BFDDiagnosticEchoFailed BFDDiagnostic = 2 // Echo Function Failed - BFDDiagnosticNeighborSignalDown BFDDiagnostic = 3 // Neighbor Signaled Session Down - BFDDiagnosticForwardPlaneReset BFDDiagnostic = 4 // Forwarding Plane Reset - BFDDiagnosticPathDown BFDDiagnostic = 5 // Path Down - BFDDiagnosticConcatPathDown BFDDiagnostic = 6 // Concatenated Path Down - BFDDiagnosticAdminDown BFDDiagnostic = 7 // Administratively Down - BFDDiagnosticRevConcatPathDown BFDDiagnostic = 8 // Reverse Concatenated Path Dow -) - -// String returns a string version of BFDDiagnostic -func (bd BFDDiagnostic) String() string { - switch bd { - default: - return "Unknown" - case BFDDiagnosticNone: - return "None" - case BFDDiagnosticTimeExpired: - return "Control Detection Time Expired" - case BFDDiagnosticEchoFailed: - return "Echo Function Failed" - case BFDDiagnosticNeighborSignalDown: - return "Neighbor Signaled Session Down" - case BFDDiagnosticForwardPlaneReset: - return "Forwarding Plane Reset" - case BFDDiagnosticPathDown: - return "Path Down" - case BFDDiagnosticConcatPathDown: - return "Concatenated Path Down" - case BFDDiagnosticAdminDown: - return "Administratively Down" - case BFDDiagnosticRevConcatPathDown: - return "Reverse Concatenated Path Down" - } -} - -// BFDState represents the state of a BFD session -type BFDState uint8 - -// constants that define BFDState -const ( - BFDStateAdminDown BFDState = 0 - BFDStateDown BFDState = 1 - BFDStateInit BFDState = 2 - BFDStateUp BFDState = 3 -) - -// String returns a string version of BFDState -func (s BFDState) String() string { - switch s { - default: - return "Unknown" - case BFDStateAdminDown: - return "Admin Down" - case BFDStateDown: - return "Down" - case BFDStateInit: - return "Init" - case BFDStateUp: - return "Up" - } -} - -// BFDDetectMultiplier represents the negotiated transmit interval, -// multiplied by this value, provides the Detection Time for the -// receiving system in Asynchronous mode. -type BFDDetectMultiplier uint8 - -// BFDDiscriminator is a unique, nonzero discriminator value used -// to demultiplex multiple BFD sessions between the same pair of systems. -type BFDDiscriminator uint32 - -// BFDTimeInterval represents a time interval in microseconds -type BFDTimeInterval uint32 - -// BFDAuthType represents the authentication used in the BFD session -type BFDAuthType uint8 - -// constants that define the BFDAuthType -const ( - BFDAuthTypeNone BFDAuthType = 0 // No Auth - BFDAuthTypePassword BFDAuthType = 1 // Simple Password - BFDAuthTypeKeyedMD5 BFDAuthType = 2 // Keyed MD5 - BFDAuthTypeMeticulousKeyedMD5 BFDAuthType = 3 // Meticulous Keyed MD5 - BFDAuthTypeKeyedSHA1 BFDAuthType = 4 // Keyed SHA1 - BFDAuthTypeMeticulousKeyedSHA1 BFDAuthType = 5 // Meticulous Keyed SHA1 -) - -// String returns a string version of BFDAuthType -func (at BFDAuthType) String() string { - switch at { - default: - return "Unknown" - case BFDAuthTypeNone: - return "No Authentication" - case BFDAuthTypePassword: - return "Simple Password" - case BFDAuthTypeKeyedMD5: - return "Keyed MD5" - case BFDAuthTypeMeticulousKeyedMD5: - return "Meticulous Keyed MD5" - case BFDAuthTypeKeyedSHA1: - return "Keyed SHA1" - case BFDAuthTypeMeticulousKeyedSHA1: - return "Meticulous Keyed SHA1" - } -} - -// BFDAuthKeyID represents the authentication key ID in use for -// this packet. This allows multiple keys to be active simultaneously. -type BFDAuthKeyID uint8 - -// BFDAuthSequenceNumber represents the sequence number for this packet. -// For Keyed Authentication, this value is incremented occasionally. For -// Meticulous Keyed Authentication, this value is incremented for each -// successive packet transmitted for a session. This provides protection -// against replay attacks. -type BFDAuthSequenceNumber uint32 - -// BFDAuthData represents the authentication key or digest -type BFDAuthData []byte - -// BFDAuthHeader represents authentication data used in the BFD session -type BFDAuthHeader struct { - AuthType BFDAuthType - KeyID BFDAuthKeyID - SequenceNumber BFDAuthSequenceNumber - Data BFDAuthData -} - -// Length returns the data length of the BFDAuthHeader based on the -// authentication type -func (h *BFDAuthHeader) Length() int { - switch h.AuthType { - case BFDAuthTypePassword: - return 3 + len(h.Data) - case BFDAuthTypeKeyedMD5, BFDAuthTypeMeticulousKeyedMD5: - return 8 + len(h.Data) - case BFDAuthTypeKeyedSHA1, BFDAuthTypeMeticulousKeyedSHA1: - return 8 + len(h.Data) - default: - return 0 - } -} - -// BFD represents a BFD control message packet whose payload contains -// the control information required to for a BFD session. -// -// References -// ---------- -// -// Wikipedia's BFD entry: -// https://en.wikipedia.org/wiki/Bidirectional_Forwarding_Detection -// This is the best place to get an overview of BFD. -// -// RFC 5880 "Bidirectional Forwarding Detection (BFD)" (2010) -// https://tools.ietf.org/html/rfc5880 -// This is the original BFD specification. -// -// RFC 5881 "Bidirectional Forwarding Detection (BFD) for IPv4 and IPv6 (Single Hop)" (2010) -// https://tools.ietf.org/html/rfc5881 -// Describes the use of the Bidirectional Forwarding Detection (BFD) -// protocol over IPv4 and IPv6 for single IP hops. -type BFD struct { - BaseLayer // Stores the packet bytes and payload bytes. - - Version BFDVersion // Version of the BFD protocol. - Diagnostic BFDDiagnostic // Diagnostic code for last state change - State BFDState // Current state - Poll bool // Requesting verification - Final bool // Responding to a received BFD Control packet that had the Poll (P) bit set. - ControlPlaneIndependent bool // BFD implementation does not share fate with its control plane - AuthPresent bool // Authentication Section is present and the session is to be authenticated - Demand bool // Demand mode is active - Multipoint bool // For future point-to-multipoint extensions. Must always be zero - DetectMultiplier BFDDetectMultiplier // Detection time multiplier - MyDiscriminator BFDDiscriminator // A unique, nonzero discriminator value - YourDiscriminator BFDDiscriminator // discriminator received from the remote system. - DesiredMinTxInterval BFDTimeInterval // Minimum interval, in microseconds, the local system would like to use when transmitting BFD Control packets - RequiredMinRxInterval BFDTimeInterval // Minimum interval, in microseconds, between received BFD Control packets that this system is capable of supporting - RequiredMinEchoRxInterval BFDTimeInterval // Minimum interval, in microseconds, between received BFD Echo packets that this system is capable of supporting - AuthHeader *BFDAuthHeader // Authentication data, variable length. -} - -// Length returns the data length of a BFD Control message which -// changes based on the presence and type of authentication -// contained in the message -func (d *BFD) Length() int { - if d.AuthPresent && (d.AuthHeader != nil) { - return bfdMinimumRecordSizeInBytes + d.AuthHeader.Length() - } - - return bfdMinimumRecordSizeInBytes -} - -// LayerType returns the layer type of the BFD object, which is LayerTypeBFD. -func (d *BFD) LayerType() gopacket.LayerType { - return LayerTypeBFD -} - -// decodeBFD analyses a byte slice and attempts to decode it as a BFD -// control packet -// -// If it succeeds, it loads p with information about the packet and returns nil. -// If it fails, it returns an error (non nil). -// -// This function is employed in layertypes.go to register the BFD layer. -func decodeBFD(data []byte, p gopacket.PacketBuilder) error { - - // Attempt to decode the byte slice. - d := &BFD{} - err := d.DecodeFromBytes(data, p) - if err != nil { - return err - } - - // If the decoding worked, add the layer to the packet and set it - // as the application layer too, if there isn't already one. - p.AddLayer(d) - p.SetApplicationLayer(d) - - return nil -} - -// DecodeFromBytes analyses a byte slice and attempts to decode it as a BFD -// control packet. -// -// Upon succeeds, it loads the BFD object with information about the packet -// and returns nil. -// Upon failure, it returns an error (non nil). -func (d *BFD) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - - // If the data block is too short to be a BFD record, then return an error. - if len(data) < bfdMinimumRecordSizeInBytes { - df.SetTruncated() - return errors.New("BFD packet too short") - } - - pLen := uint8(data[3]) - if len(data) != int(pLen) { - return errors.New("BFD packet length does not match") - } - - // BFD type embeds type BaseLayer which contains two fields: - // Contents is supposed to contain the bytes of the data at this level. - // Payload is supposed to contain the payload of this level. - // Here we set the baselayer to be the bytes of the BFD record. - d.BaseLayer = BaseLayer{Contents: data[:len(data)]} - - // Extract the fields from the block of bytes. - // To make sense of this, refer to the packet diagram - // above and the section on endian conventions. - - // The first few fields are all packed into the first 32 bits. Unpack them. - d.Version = BFDVersion(((data[0] & 0xE0) >> 5)) - d.Diagnostic = BFDDiagnostic(data[0] & 0x1F) - data = data[1:] - - d.State = BFDState((data[0] & 0xC0) >> 6) - d.Poll = data[0]&0x20 != 0 - d.Final = data[0]&0x10 != 0 - d.ControlPlaneIndependent = data[0]&0x08 != 0 - d.AuthPresent = data[0]&0x04 != 0 - d.Demand = data[0]&0x02 != 0 - d.Multipoint = data[0]&0x01 != 0 - data = data[1:] - - data, d.DetectMultiplier = data[1:], BFDDetectMultiplier(data[0]) - data, _ = data[1:], uint8(data[0]) // Consume length - - // The remaining fields can just be copied in big endian order. - data, d.MyDiscriminator = data[4:], BFDDiscriminator(binary.BigEndian.Uint32(data[:4])) - data, d.YourDiscriminator = data[4:], BFDDiscriminator(binary.BigEndian.Uint32(data[:4])) - data, d.DesiredMinTxInterval = data[4:], BFDTimeInterval(binary.BigEndian.Uint32(data[:4])) - data, d.RequiredMinRxInterval = data[4:], BFDTimeInterval(binary.BigEndian.Uint32(data[:4])) - data, d.RequiredMinEchoRxInterval = data[4:], BFDTimeInterval(binary.BigEndian.Uint32(data[:4])) - - if d.AuthPresent && (len(data) > 2) { - d.AuthHeader = &BFDAuthHeader{} - data, d.AuthHeader.AuthType = data[1:], BFDAuthType(data[0]) - data, _ = data[1:], uint8(data[0]) // Consume length - data, d.AuthHeader.KeyID = data[1:], BFDAuthKeyID(data[0]) - - switch d.AuthHeader.AuthType { - case BFDAuthTypePassword: - d.AuthHeader.Data = BFDAuthData(data) - case BFDAuthTypeKeyedMD5, BFDAuthTypeMeticulousKeyedMD5: - // Skipped reserved byte - data, d.AuthHeader.SequenceNumber = data[5:], BFDAuthSequenceNumber(binary.BigEndian.Uint32(data[1:5])) - d.AuthHeader.Data = BFDAuthData(data) - case BFDAuthTypeKeyedSHA1, BFDAuthTypeMeticulousKeyedSHA1: - // Skipped reserved byte - data, d.AuthHeader.SequenceNumber = data[5:], BFDAuthSequenceNumber(binary.BigEndian.Uint32(data[1:5])) - d.AuthHeader.Data = BFDAuthData(data) - } - } - - return nil -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (d *BFD) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - data, err := b.PrependBytes(bfdMinimumRecordSizeInBytes) - if err != nil { - return err - } - - // Pack the first few fields into the first 32 bits. - data[0] = byte(byte(d.Version<<5) | byte(d.Diagnostic)) - h := uint8(0) - h |= (uint8(d.State) << 6) - h |= (uint8(bool2uint8(d.Poll)) << 5) - h |= (uint8(bool2uint8(d.Final)) << 4) - h |= (uint8(bool2uint8(d.ControlPlaneIndependent)) << 3) - h |= (uint8(bool2uint8(d.AuthPresent)) << 2) - h |= (uint8(bool2uint8(d.Demand)) << 1) - h |= uint8(bool2uint8(d.Multipoint)) - data[1] = byte(h) - data[2] = byte(d.DetectMultiplier) - data[3] = byte(d.Length()) - - // The remaining fields can just be copied in big endian order. - binary.BigEndian.PutUint32(data[4:], uint32(d.MyDiscriminator)) - binary.BigEndian.PutUint32(data[8:], uint32(d.YourDiscriminator)) - binary.BigEndian.PutUint32(data[12:], uint32(d.DesiredMinTxInterval)) - binary.BigEndian.PutUint32(data[16:], uint32(d.RequiredMinRxInterval)) - binary.BigEndian.PutUint32(data[20:], uint32(d.RequiredMinEchoRxInterval)) - - if d.AuthPresent && (d.AuthHeader != nil) { - auth, err := b.AppendBytes(int(d.AuthHeader.Length())) - if err != nil { - return err - } - - auth[0] = byte(d.AuthHeader.AuthType) - auth[1] = byte(d.AuthHeader.Length()) - auth[2] = byte(d.AuthHeader.KeyID) - - switch d.AuthHeader.AuthType { - case BFDAuthTypePassword: - copy(auth[3:], d.AuthHeader.Data) - case BFDAuthTypeKeyedMD5, BFDAuthTypeMeticulousKeyedMD5: - auth[3] = byte(0) - binary.BigEndian.PutUint32(auth[4:], uint32(d.AuthHeader.SequenceNumber)) - copy(auth[8:], d.AuthHeader.Data) - case BFDAuthTypeKeyedSHA1, BFDAuthTypeMeticulousKeyedSHA1: - auth[3] = byte(0) - binary.BigEndian.PutUint32(auth[4:], uint32(d.AuthHeader.SequenceNumber)) - copy(auth[8:], d.AuthHeader.Data) - } - } - - return nil -} - -// CanDecode returns a set of layers that BFD objects can decode. -// As BFD objects can only decide the BFD layer, we can return just that layer. -// Apparently a single layer type implements LayerClass. -func (d *BFD) CanDecode() gopacket.LayerClass { - return LayerTypeBFD -} - -// NextLayerType specifies the next layer that GoPacket should attempt to -// analyse after this (BFD) layer. As BFD packets do not contain any payload -// bytes, there are no further layers to analyse. -func (d *BFD) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypeZero -} - -// Payload returns an empty byte slice as BFD packets do not carry a payload -func (d *BFD) Payload() []byte { - return nil -} - -// bool2uint8 converts a bool to uint8 -func bool2uint8(b bool) uint8 { - if b { - return 1 - } - return 0 -} diff --git a/vendor/github.com/google/gopacket/layers/cdp.go b/vendor/github.com/google/gopacket/layers/cdp.go deleted file mode 100644 index 095f92612..000000000 --- a/vendor/github.com/google/gopacket/layers/cdp.go +++ /dev/null @@ -1,659 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -// Enum types courtesy of... -// http://search.cpan.org/~mchapman/Net-CDP-0.09/lib/Net/CDP.pm -// https://code.google.com/p/ladvd/ -// http://anonsvn.wireshark.org/viewvc/releases/wireshark-1.8.6/epan/dissectors/packet-cdp.c - -package layers - -import ( - "encoding/binary" - "errors" - "fmt" - "net" - - "github.com/google/gopacket" -) - -// CDPTLVType is the type of each TLV value in a CiscoDiscovery packet. -type CDPTLVType uint16 - -// CDPTLVType values. -const ( - CDPTLVDevID CDPTLVType = 0x0001 - CDPTLVAddress CDPTLVType = 0x0002 - CDPTLVPortID CDPTLVType = 0x0003 - CDPTLVCapabilities CDPTLVType = 0x0004 - CDPTLVVersion CDPTLVType = 0x0005 - CDPTLVPlatform CDPTLVType = 0x0006 - CDPTLVIPPrefix CDPTLVType = 0x0007 - CDPTLVHello CDPTLVType = 0x0008 - CDPTLVVTPDomain CDPTLVType = 0x0009 - CDPTLVNativeVLAN CDPTLVType = 0x000a - CDPTLVFullDuplex CDPTLVType = 0x000b - CDPTLVVLANReply CDPTLVType = 0x000e - CDPTLVVLANQuery CDPTLVType = 0x000f - CDPTLVPower CDPTLVType = 0x0010 - CDPTLVMTU CDPTLVType = 0x0011 - CDPTLVExtendedTrust CDPTLVType = 0x0012 - CDPTLVUntrustedCOS CDPTLVType = 0x0013 - CDPTLVSysName CDPTLVType = 0x0014 - CDPTLVSysOID CDPTLVType = 0x0015 - CDPTLVMgmtAddresses CDPTLVType = 0x0016 - CDPTLVLocation CDPTLVType = 0x0017 - CDPTLVExternalPortID CDPTLVType = 0x0018 - CDPTLVPowerRequested CDPTLVType = 0x0019 - CDPTLVPowerAvailable CDPTLVType = 0x001a - CDPTLVPortUnidirectional CDPTLVType = 0x001b - CDPTLVEnergyWise CDPTLVType = 0x001d - CDPTLVSparePairPOE CDPTLVType = 0x001f -) - -// CiscoDiscoveryValue is a TLV value inside a CiscoDiscovery packet layer. -type CiscoDiscoveryValue struct { - Type CDPTLVType - Length uint16 - Value []byte -} - -// CiscoDiscovery is a packet layer containing the Cisco Discovery Protocol. -// See http://www.cisco.com/univercd/cc/td/doc/product/lan/trsrb/frames.htm#31885 -type CiscoDiscovery struct { - BaseLayer - Version byte - TTL byte - Checksum uint16 - Values []CiscoDiscoveryValue -} - -// CDPCapability is the set of capabilities advertised by a CDP device. -type CDPCapability uint32 - -// CDPCapability values. -const ( - CDPCapMaskRouter CDPCapability = 0x0001 - CDPCapMaskTBBridge CDPCapability = 0x0002 - CDPCapMaskSPBridge CDPCapability = 0x0004 - CDPCapMaskSwitch CDPCapability = 0x0008 - CDPCapMaskHost CDPCapability = 0x0010 - CDPCapMaskIGMPFilter CDPCapability = 0x0020 - CDPCapMaskRepeater CDPCapability = 0x0040 - CDPCapMaskPhone CDPCapability = 0x0080 - CDPCapMaskRemote CDPCapability = 0x0100 -) - -// CDPCapabilities represents the capabilities of a device -type CDPCapabilities struct { - L3Router bool - TBBridge bool - SPBridge bool - L2Switch bool - IsHost bool - IGMPFilter bool - L1Repeater bool - IsPhone bool - RemotelyManaged bool -} - -// CDP Power-over-Ethernet values. -const ( - CDPPoEFourWire byte = 0x01 - CDPPoEPDArch byte = 0x02 - CDPPoEPDRequest byte = 0x04 - CDPPoEPSE byte = 0x08 -) - -// CDPSparePairPoE provides information on PoE. -type CDPSparePairPoE struct { - PSEFourWire bool // Supported / Not supported - PDArchShared bool // Shared / Independent - PDRequestOn bool // On / Off - PSEOn bool // On / Off -} - -// CDPVLANDialogue encapsulates a VLAN Query/Reply -type CDPVLANDialogue struct { - ID uint8 - VLAN uint16 -} - -// CDPPowerDialogue encapsulates a Power Query/Reply -type CDPPowerDialogue struct { - ID uint16 - MgmtID uint16 - Values []uint32 -} - -// CDPLocation provides location information for a CDP device. -type CDPLocation struct { - Type uint8 // Undocumented - Location string -} - -// CDPHello is a Cisco Hello message (undocumented, hence the "Unknown" fields) -type CDPHello struct { - OUI []byte - ProtocolID uint16 - ClusterMaster net.IP - Unknown1 net.IP - Version byte - SubVersion byte - Status byte - Unknown2 byte - ClusterCommander net.HardwareAddr - SwitchMAC net.HardwareAddr - Unknown3 byte - ManagementVLAN uint16 -} - -// CDPEnergyWiseSubtype is used within CDP to define TLV values. -type CDPEnergyWiseSubtype uint32 - -// CDPEnergyWiseSubtype values. -const ( - CDPEnergyWiseRole CDPEnergyWiseSubtype = 0x00000007 - CDPEnergyWiseDomain CDPEnergyWiseSubtype = 0x00000008 - CDPEnergyWiseName CDPEnergyWiseSubtype = 0x00000009 - CDPEnergyWiseReplyTo CDPEnergyWiseSubtype = 0x00000017 -) - -// CDPEnergyWise is used by CDP to monitor and control power usage. -type CDPEnergyWise struct { - EncryptedData []byte - Unknown1 uint32 - SequenceNumber uint32 - ModelNumber string - Unknown2 uint16 - HardwareID string - SerialNum string - Unknown3 []byte - Role string - Domain string - Name string - ReplyUnknown1 []byte - ReplyPort []byte - ReplyAddress []byte - ReplyUnknown2 []byte - ReplyUnknown3 []byte -} - -// CiscoDiscoveryInfo represents the decoded details for a set of CiscoDiscoveryValues -type CiscoDiscoveryInfo struct { - BaseLayer - CDPHello - DeviceID string - Addresses []net.IP - PortID string - Capabilities CDPCapabilities - Version string - Platform string - IPPrefixes []net.IPNet - VTPDomain string - NativeVLAN uint16 - FullDuplex bool - VLANReply CDPVLANDialogue - VLANQuery CDPVLANDialogue - PowerConsumption uint16 - MTU uint32 - ExtendedTrust uint8 - UntrustedCOS uint8 - SysName string - SysOID string - MgmtAddresses []net.IP - Location CDPLocation - PowerRequest CDPPowerDialogue - PowerAvailable CDPPowerDialogue - SparePairPoe CDPSparePairPoE - EnergyWise CDPEnergyWise - Unknown []CiscoDiscoveryValue -} - -// LayerType returns gopacket.LayerTypeCiscoDiscovery. -func (c *CiscoDiscovery) LayerType() gopacket.LayerType { - return LayerTypeCiscoDiscovery -} - -func decodeCiscoDiscovery(data []byte, p gopacket.PacketBuilder) error { - c := &CiscoDiscovery{ - Version: data[0], - TTL: data[1], - Checksum: binary.BigEndian.Uint16(data[2:4]), - } - if c.Version != 1 && c.Version != 2 { - return fmt.Errorf("Invalid CiscoDiscovery version number %d", c.Version) - } - var err error - c.Values, err = decodeCiscoDiscoveryTLVs(data[4:], p) - if err != nil { - return err - } - c.Contents = data[0:4] - c.Payload = data[4:] - p.AddLayer(c) - return p.NextDecoder(gopacket.DecodeFunc(decodeCiscoDiscoveryInfo)) -} - -// LayerType returns gopacket.LayerTypeCiscoDiscoveryInfo. -func (c *CiscoDiscoveryInfo) LayerType() gopacket.LayerType { - return LayerTypeCiscoDiscoveryInfo -} - -func decodeCiscoDiscoveryTLVs(data []byte, p gopacket.PacketBuilder) (values []CiscoDiscoveryValue, err error) { - for len(data) > 0 { - if len(data) < 4 { - p.SetTruncated() - return nil, errors.New("CDP TLV < 4 bytes") - } - val := CiscoDiscoveryValue{ - Type: CDPTLVType(binary.BigEndian.Uint16(data[:2])), - Length: binary.BigEndian.Uint16(data[2:4]), - } - if val.Length < 4 { - err = fmt.Errorf("Invalid CiscoDiscovery value length %d", val.Length) - break - } else if len(data) < int(val.Length) { - p.SetTruncated() - return nil, fmt.Errorf("CDP TLV < length %d", val.Length) - } - val.Value = data[4:val.Length] - values = append(values, val) - data = data[val.Length:] - } - return -} - -func decodeCiscoDiscoveryInfo(data []byte, p gopacket.PacketBuilder) error { - var err error - info := &CiscoDiscoveryInfo{BaseLayer: BaseLayer{Contents: data}} - p.AddLayer(info) - values, err := decodeCiscoDiscoveryTLVs(data, p) - if err != nil { // Unlikely, as parent decode will fail, but better safe... - return err - } - for _, val := range values { - switch val.Type { - case CDPTLVDevID: - info.DeviceID = string(val.Value) - case CDPTLVAddress: - if err = checkCDPTLVLen(val, 4); err != nil { - return err - } - info.Addresses, err = decodeAddresses(val.Value) - if err != nil { - return err - } - case CDPTLVPortID: - info.PortID = string(val.Value) - case CDPTLVCapabilities: - if err = checkCDPTLVLen(val, 4); err != nil { - return err - } - val := CDPCapability(binary.BigEndian.Uint32(val.Value[0:4])) - info.Capabilities.L3Router = (val&CDPCapMaskRouter > 0) - info.Capabilities.TBBridge = (val&CDPCapMaskTBBridge > 0) - info.Capabilities.SPBridge = (val&CDPCapMaskSPBridge > 0) - info.Capabilities.L2Switch = (val&CDPCapMaskSwitch > 0) - info.Capabilities.IsHost = (val&CDPCapMaskHost > 0) - info.Capabilities.IGMPFilter = (val&CDPCapMaskIGMPFilter > 0) - info.Capabilities.L1Repeater = (val&CDPCapMaskRepeater > 0) - info.Capabilities.IsPhone = (val&CDPCapMaskPhone > 0) - info.Capabilities.RemotelyManaged = (val&CDPCapMaskRemote > 0) - case CDPTLVVersion: - info.Version = string(val.Value) - case CDPTLVPlatform: - info.Platform = string(val.Value) - case CDPTLVIPPrefix: - v := val.Value - l := len(v) - if l%5 == 0 && l >= 5 { - for len(v) > 0 { - _, ipnet, _ := net.ParseCIDR(fmt.Sprintf("%d.%d.%d.%d/%d", v[0], v[1], v[2], v[3], v[4])) - info.IPPrefixes = append(info.IPPrefixes, *ipnet) - v = v[5:] - } - } else { - return fmt.Errorf("Invalid TLV %v length %d", val.Type, len(val.Value)) - } - case CDPTLVHello: - if err = checkCDPTLVLen(val, 32); err != nil { - return err - } - v := val.Value - info.CDPHello.OUI = v[0:3] - info.CDPHello.ProtocolID = binary.BigEndian.Uint16(v[3:5]) - info.CDPHello.ClusterMaster = v[5:9] - info.CDPHello.Unknown1 = v[9:13] - info.CDPHello.Version = v[13] - info.CDPHello.SubVersion = v[14] - info.CDPHello.Status = v[15] - info.CDPHello.Unknown2 = v[16] - info.CDPHello.ClusterCommander = v[17:23] - info.CDPHello.SwitchMAC = v[23:29] - info.CDPHello.Unknown3 = v[29] - info.CDPHello.ManagementVLAN = binary.BigEndian.Uint16(v[30:32]) - case CDPTLVVTPDomain: - info.VTPDomain = string(val.Value) - case CDPTLVNativeVLAN: - if err = checkCDPTLVLen(val, 2); err != nil { - return err - } - info.NativeVLAN = binary.BigEndian.Uint16(val.Value[0:2]) - case CDPTLVFullDuplex: - if err = checkCDPTLVLen(val, 1); err != nil { - return err - } - info.FullDuplex = (val.Value[0] == 1) - case CDPTLVVLANReply: - if err = checkCDPTLVLen(val, 3); err != nil { - return err - } - info.VLANReply.ID = uint8(val.Value[0]) - info.VLANReply.VLAN = binary.BigEndian.Uint16(val.Value[1:3]) - case CDPTLVVLANQuery: - if err = checkCDPTLVLen(val, 3); err != nil { - return err - } - info.VLANQuery.ID = uint8(val.Value[0]) - info.VLANQuery.VLAN = binary.BigEndian.Uint16(val.Value[1:3]) - case CDPTLVPower: - if err = checkCDPTLVLen(val, 2); err != nil { - return err - } - info.PowerConsumption = binary.BigEndian.Uint16(val.Value[0:2]) - case CDPTLVMTU: - if err = checkCDPTLVLen(val, 4); err != nil { - return err - } - info.MTU = binary.BigEndian.Uint32(val.Value[0:4]) - case CDPTLVExtendedTrust: - if err = checkCDPTLVLen(val, 1); err != nil { - return err - } - info.ExtendedTrust = uint8(val.Value[0]) - case CDPTLVUntrustedCOS: - if err = checkCDPTLVLen(val, 1); err != nil { - return err - } - info.UntrustedCOS = uint8(val.Value[0]) - case CDPTLVSysName: - info.SysName = string(val.Value) - case CDPTLVSysOID: - info.SysOID = string(val.Value) - case CDPTLVMgmtAddresses: - if err = checkCDPTLVLen(val, 4); err != nil { - return err - } - info.MgmtAddresses, err = decodeAddresses(val.Value) - if err != nil { - return err - } - case CDPTLVLocation: - if err = checkCDPTLVLen(val, 2); err != nil { - return err - } - info.Location.Type = uint8(val.Value[0]) - info.Location.Location = string(val.Value[1:]) - - // case CDPTLVLExternalPortID: - // Undocumented - case CDPTLVPowerRequested: - if err = checkCDPTLVLen(val, 4); err != nil { - return err - } - info.PowerRequest.ID = binary.BigEndian.Uint16(val.Value[0:2]) - info.PowerRequest.MgmtID = binary.BigEndian.Uint16(val.Value[2:4]) - for n := 4; n < len(val.Value); n += 4 { - info.PowerRequest.Values = append(info.PowerRequest.Values, binary.BigEndian.Uint32(val.Value[n:n+4])) - } - case CDPTLVPowerAvailable: - if err = checkCDPTLVLen(val, 4); err != nil { - return err - } - info.PowerAvailable.ID = binary.BigEndian.Uint16(val.Value[0:2]) - info.PowerAvailable.MgmtID = binary.BigEndian.Uint16(val.Value[2:4]) - for n := 4; n < len(val.Value); n += 4 { - info.PowerAvailable.Values = append(info.PowerAvailable.Values, binary.BigEndian.Uint32(val.Value[n:n+4])) - } - // case CDPTLVPortUnidirectional - // Undocumented - case CDPTLVEnergyWise: - if err = checkCDPTLVLen(val, 72); err != nil { - return err - } - info.EnergyWise.EncryptedData = val.Value[0:20] - info.EnergyWise.Unknown1 = binary.BigEndian.Uint32(val.Value[20:24]) - info.EnergyWise.SequenceNumber = binary.BigEndian.Uint32(val.Value[24:28]) - info.EnergyWise.ModelNumber = string(val.Value[28:44]) - info.EnergyWise.Unknown2 = binary.BigEndian.Uint16(val.Value[44:46]) - info.EnergyWise.HardwareID = string(val.Value[46:49]) - info.EnergyWise.SerialNum = string(val.Value[49:60]) - info.EnergyWise.Unknown3 = val.Value[60:68] - tlvLen := binary.BigEndian.Uint16(val.Value[68:70]) - tlvNum := binary.BigEndian.Uint16(val.Value[70:72]) - data := val.Value[72:] - if len(data) < int(tlvLen) { - return fmt.Errorf("Invalid TLV length %d vs %d", tlvLen, len(data)) - } - numSeen := 0 - for len(data) > 8 { - numSeen++ - if numSeen > int(tlvNum) { // Too many TLV's ? - return fmt.Errorf("Too many TLV's - wanted %d, saw %d", tlvNum, numSeen) - } - tType := CDPEnergyWiseSubtype(binary.BigEndian.Uint32(data[0:4])) - tLen := int(binary.BigEndian.Uint32(data[4:8])) - if tLen > len(data)-8 { - return fmt.Errorf("Invalid TLV length %d vs %d", tLen, len(data)-8) - } - data = data[8:] - switch tType { - case CDPEnergyWiseRole: - info.EnergyWise.Role = string(data[:]) - case CDPEnergyWiseDomain: - info.EnergyWise.Domain = string(data[:]) - case CDPEnergyWiseName: - info.EnergyWise.Name = string(data[:]) - case CDPEnergyWiseReplyTo: - if len(data) >= 18 { - info.EnergyWise.ReplyUnknown1 = data[0:2] - info.EnergyWise.ReplyPort = data[2:4] - info.EnergyWise.ReplyAddress = data[4:8] - info.EnergyWise.ReplyUnknown2 = data[8:10] - info.EnergyWise.ReplyUnknown3 = data[10:14] - } - } - data = data[tLen:] - } - case CDPTLVSparePairPOE: - if err = checkCDPTLVLen(val, 1); err != nil { - return err - } - v := val.Value[0] - info.SparePairPoe.PSEFourWire = (v&CDPPoEFourWire > 0) - info.SparePairPoe.PDArchShared = (v&CDPPoEPDArch > 0) - info.SparePairPoe.PDRequestOn = (v&CDPPoEPDRequest > 0) - info.SparePairPoe.PSEOn = (v&CDPPoEPSE > 0) - default: - info.Unknown = append(info.Unknown, val) - } - } - return nil -} - -// CDP Protocol Types -const ( - CDPProtocolTypeNLPID byte = 1 - CDPProtocolType802_2 byte = 2 -) - -// CDPAddressType is used to define TLV values within CDP addresses. -type CDPAddressType uint64 - -// CDP Address types. -const ( - CDPAddressTypeCLNP CDPAddressType = 0x81 - CDPAddressTypeIPV4 CDPAddressType = 0xcc - CDPAddressTypeIPV6 CDPAddressType = 0xaaaa030000000800 - CDPAddressTypeDECNET CDPAddressType = 0xaaaa030000006003 - CDPAddressTypeAPPLETALK CDPAddressType = 0xaaaa03000000809b - CDPAddressTypeIPX CDPAddressType = 0xaaaa030000008137 - CDPAddressTypeVINES CDPAddressType = 0xaaaa0300000080c4 - CDPAddressTypeXNS CDPAddressType = 0xaaaa030000000600 - CDPAddressTypeAPOLLO CDPAddressType = 0xaaaa030000008019 -) - -func decodeAddresses(v []byte) (addresses []net.IP, err error) { - numaddr := int(binary.BigEndian.Uint32(v[0:4])) - if numaddr < 1 { - return nil, fmt.Errorf("Invalid Address TLV number %d", numaddr) - } - v = v[4:] - if len(v) < numaddr*8 { - return nil, fmt.Errorf("Invalid Address TLV length %d", len(v)) - } - for i := 0; i < numaddr; i++ { - prottype := v[0] - if prottype != CDPProtocolTypeNLPID && prottype != CDPProtocolType802_2 { // invalid protocol type - return nil, fmt.Errorf("Invalid Address Protocol %d", prottype) - } - protlen := int(v[1]) - if (prottype == CDPProtocolTypeNLPID && protlen != 1) || - (prottype == CDPProtocolType802_2 && protlen != 3 && protlen != 8) { // invalid length - return nil, fmt.Errorf("Invalid Address Protocol length %d", protlen) - } - plen := make([]byte, 8) - copy(plen[8-protlen:], v[2:2+protlen]) - protocol := CDPAddressType(binary.BigEndian.Uint64(plen)) - v = v[2+protlen:] - addrlen := binary.BigEndian.Uint16(v[0:2]) - ab := v[2 : 2+addrlen] - if protocol == CDPAddressTypeIPV4 && addrlen == 4 { - addresses = append(addresses, net.IPv4(ab[0], ab[1], ab[2], ab[3])) - } else if protocol == CDPAddressTypeIPV6 && addrlen == 16 { - addresses = append(addresses, net.IP(ab)) - } else { - // only handle IPV4 & IPV6 for now - } - v = v[2+addrlen:] - if len(v) < 8 { - break - } - } - return -} - -func (t CDPTLVType) String() (s string) { - switch t { - case CDPTLVDevID: - s = "Device ID" - case CDPTLVAddress: - s = "Addresses" - case CDPTLVPortID: - s = "Port ID" - case CDPTLVCapabilities: - s = "Capabilities" - case CDPTLVVersion: - s = "Software Version" - case CDPTLVPlatform: - s = "Platform" - case CDPTLVIPPrefix: - s = "IP Prefix" - case CDPTLVHello: - s = "Protocol Hello" - case CDPTLVVTPDomain: - s = "VTP Management Domain" - case CDPTLVNativeVLAN: - s = "Native VLAN" - case CDPTLVFullDuplex: - s = "Full Duplex" - case CDPTLVVLANReply: - s = "VoIP VLAN Reply" - case CDPTLVVLANQuery: - s = "VLANQuery" - case CDPTLVPower: - s = "Power consumption" - case CDPTLVMTU: - s = "MTU" - case CDPTLVExtendedTrust: - s = "Extended Trust Bitmap" - case CDPTLVUntrustedCOS: - s = "Untrusted Port CoS" - case CDPTLVSysName: - s = "System Name" - case CDPTLVSysOID: - s = "System OID" - case CDPTLVMgmtAddresses: - s = "Management Addresses" - case CDPTLVLocation: - s = "Location" - case CDPTLVExternalPortID: - s = "External Port ID" - case CDPTLVPowerRequested: - s = "Power Requested" - case CDPTLVPowerAvailable: - s = "Power Available" - case CDPTLVPortUnidirectional: - s = "Port Unidirectional" - case CDPTLVEnergyWise: - s = "Energy Wise" - case CDPTLVSparePairPOE: - s = "Spare Pair POE" - default: - s = "Unknown" - } - return -} - -func (a CDPAddressType) String() (s string) { - switch a { - case CDPAddressTypeCLNP: - s = "Connectionless Network Protocol" - case CDPAddressTypeIPV4: - s = "IPv4" - case CDPAddressTypeIPV6: - s = "IPv6" - case CDPAddressTypeDECNET: - s = "DECnet Phase IV" - case CDPAddressTypeAPPLETALK: - s = "Apple Talk" - case CDPAddressTypeIPX: - s = "Novell IPX" - case CDPAddressTypeVINES: - s = "Banyan VINES" - case CDPAddressTypeXNS: - s = "Xerox Network Systems" - case CDPAddressTypeAPOLLO: - s = "Apollo" - default: - s = "Unknown" - } - return -} - -func (t CDPEnergyWiseSubtype) String() (s string) { - switch t { - case CDPEnergyWiseRole: - s = "Role" - case CDPEnergyWiseDomain: - s = "Domain" - case CDPEnergyWiseName: - s = "Name" - case CDPEnergyWiseReplyTo: - s = "ReplyTo" - default: - s = "Unknown" - } - return -} - -func checkCDPTLVLen(v CiscoDiscoveryValue, l int) (err error) { - if len(v.Value) < l { - err = fmt.Errorf("Invalid TLV %v length %d", v.Type, len(v.Value)) - } - return -} diff --git a/vendor/github.com/google/gopacket/layers/ctp.go b/vendor/github.com/google/gopacket/layers/ctp.go deleted file mode 100644 index 82875845a..000000000 --- a/vendor/github.com/google/gopacket/layers/ctp.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "fmt" - "github.com/google/gopacket" -) - -// EthernetCTPFunction is the function code used by the EthernetCTP protocol to identify each -// EthernetCTP layer. -type EthernetCTPFunction uint16 - -// EthernetCTPFunction values. -const ( - EthernetCTPFunctionReply EthernetCTPFunction = 1 - EthernetCTPFunctionForwardData EthernetCTPFunction = 2 -) - -// EthernetCTP implements the EthernetCTP protocol, see http://www.mit.edu/people/jhawk/ctp.html. -// We split EthernetCTP up into the top-level EthernetCTP layer, followed by zero or more -// EthernetCTPForwardData layers, followed by a final EthernetCTPReply layer. -type EthernetCTP struct { - BaseLayer - SkipCount uint16 -} - -// LayerType returns gopacket.LayerTypeEthernetCTP. -func (c *EthernetCTP) LayerType() gopacket.LayerType { - return LayerTypeEthernetCTP -} - -// EthernetCTPForwardData is the ForwardData layer inside EthernetCTP. See EthernetCTP's docs for more -// details. -type EthernetCTPForwardData struct { - BaseLayer - Function EthernetCTPFunction - ForwardAddress []byte -} - -// LayerType returns gopacket.LayerTypeEthernetCTPForwardData. -func (c *EthernetCTPForwardData) LayerType() gopacket.LayerType { - return LayerTypeEthernetCTPForwardData -} - -// ForwardEndpoint returns the EthernetCTPForwardData ForwardAddress as an endpoint. -func (c *EthernetCTPForwardData) ForwardEndpoint() gopacket.Endpoint { - return gopacket.NewEndpoint(EndpointMAC, c.ForwardAddress) -} - -// EthernetCTPReply is the Reply layer inside EthernetCTP. See EthernetCTP's docs for more details. -type EthernetCTPReply struct { - BaseLayer - Function EthernetCTPFunction - ReceiptNumber uint16 - Data []byte -} - -// LayerType returns gopacket.LayerTypeEthernetCTPReply. -func (c *EthernetCTPReply) LayerType() gopacket.LayerType { - return LayerTypeEthernetCTPReply -} - -// Payload returns the EthernetCTP reply's Data bytes. -func (c *EthernetCTPReply) Payload() []byte { return c.Data } - -func decodeEthernetCTP(data []byte, p gopacket.PacketBuilder) error { - c := &EthernetCTP{ - SkipCount: binary.LittleEndian.Uint16(data[:2]), - BaseLayer: BaseLayer{data[:2], data[2:]}, - } - if c.SkipCount%2 != 0 { - return fmt.Errorf("EthernetCTP skip count is odd: %d", c.SkipCount) - } - p.AddLayer(c) - return p.NextDecoder(gopacket.DecodeFunc(decodeEthernetCTPFromFunctionType)) -} - -// decodeEthernetCTPFromFunctionType reads in the first 2 bytes to determine the EthernetCTP -// layer type to decode next, then decodes based on that. -func decodeEthernetCTPFromFunctionType(data []byte, p gopacket.PacketBuilder) error { - function := EthernetCTPFunction(binary.LittleEndian.Uint16(data[:2])) - switch function { - case EthernetCTPFunctionReply: - reply := &EthernetCTPReply{ - Function: function, - ReceiptNumber: binary.LittleEndian.Uint16(data[2:4]), - Data: data[4:], - BaseLayer: BaseLayer{data, nil}, - } - p.AddLayer(reply) - p.SetApplicationLayer(reply) - return nil - case EthernetCTPFunctionForwardData: - forward := &EthernetCTPForwardData{ - Function: function, - ForwardAddress: data[2:8], - BaseLayer: BaseLayer{data[:8], data[8:]}, - } - p.AddLayer(forward) - return p.NextDecoder(gopacket.DecodeFunc(decodeEthernetCTPFromFunctionType)) - } - return fmt.Errorf("Unknown EthernetCTP function type %v", function) -} diff --git a/vendor/github.com/google/gopacket/layers/dhcpv4.go b/vendor/github.com/google/gopacket/layers/dhcpv4.go deleted file mode 100644 index d79c59150..000000000 --- a/vendor/github.com/google/gopacket/layers/dhcpv4.go +++ /dev/null @@ -1,592 +0,0 @@ -// Copyright 2016 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "bytes" - "encoding/binary" - "fmt" - "net" - - "github.com/google/gopacket" -) - -// DHCPOp rerprents a bootp operation -type DHCPOp byte - -// bootp operations -const ( - DHCPOpRequest DHCPOp = 1 - DHCPOpReply DHCPOp = 2 -) - -// String returns a string version of a DHCPOp. -func (o DHCPOp) String() string { - switch o { - case DHCPOpRequest: - return "Request" - case DHCPOpReply: - return "Reply" - default: - return "Unknown" - } -} - -// DHCPMsgType represents a DHCP operation -type DHCPMsgType byte - -// Constants that represent DHCP operations -const ( - DHCPMsgTypeUnspecified DHCPMsgType = iota - DHCPMsgTypeDiscover - DHCPMsgTypeOffer - DHCPMsgTypeRequest - DHCPMsgTypeDecline - DHCPMsgTypeAck - DHCPMsgTypeNak - DHCPMsgTypeRelease - DHCPMsgTypeInform -) - -// String returns a string version of a DHCPMsgType. -func (o DHCPMsgType) String() string { - switch o { - case DHCPMsgTypeUnspecified: - return "Unspecified" - case DHCPMsgTypeDiscover: - return "Discover" - case DHCPMsgTypeOffer: - return "Offer" - case DHCPMsgTypeRequest: - return "Request" - case DHCPMsgTypeDecline: - return "Decline" - case DHCPMsgTypeAck: - return "Ack" - case DHCPMsgTypeNak: - return "Nak" - case DHCPMsgTypeRelease: - return "Release" - case DHCPMsgTypeInform: - return "Inform" - default: - return "Unknown" - } -} - -//DHCPMagic is the RFC 2131 "magic cooke" for DHCP. -var DHCPMagic uint32 = 0x63825363 - -// DHCPv4 contains data for a single DHCP packet. -type DHCPv4 struct { - BaseLayer - Operation DHCPOp - HardwareType LinkType - HardwareLen uint8 - HardwareOpts uint8 - Xid uint32 - Secs uint16 - Flags uint16 - ClientIP net.IP - YourClientIP net.IP - NextServerIP net.IP - RelayAgentIP net.IP - ClientHWAddr net.HardwareAddr - ServerName []byte - File []byte - Options DHCPOptions -} - -// DHCPOptions is used to get nicely printed option lists which would normally -// be cut off after 5 options. -type DHCPOptions []DHCPOption - -// String returns a string version of the options list. -func (o DHCPOptions) String() string { - buf := &bytes.Buffer{} - buf.WriteByte('[') - for i, opt := range o { - buf.WriteString(opt.String()) - if i+1 != len(o) { - buf.WriteString(", ") - } - } - buf.WriteByte(']') - return buf.String() -} - -// LayerType returns gopacket.LayerTypeDHCPv4 -func (d *DHCPv4) LayerType() gopacket.LayerType { return LayerTypeDHCPv4 } - -// DecodeFromBytes decodes the given bytes into this layer. -func (d *DHCPv4) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 240 { - df.SetTruncated() - return fmt.Errorf("DHCPv4 length %d too short", len(data)) - } - d.Options = d.Options[:0] - d.Operation = DHCPOp(data[0]) - d.HardwareType = LinkType(data[1]) - d.HardwareLen = data[2] - d.HardwareOpts = data[3] - d.Xid = binary.BigEndian.Uint32(data[4:8]) - d.Secs = binary.BigEndian.Uint16(data[8:10]) - d.Flags = binary.BigEndian.Uint16(data[10:12]) - d.ClientIP = net.IP(data[12:16]) - d.YourClientIP = net.IP(data[16:20]) - d.NextServerIP = net.IP(data[20:24]) - d.RelayAgentIP = net.IP(data[24:28]) - d.ClientHWAddr = net.HardwareAddr(data[28 : 28+d.HardwareLen]) - d.ServerName = data[44:108] - d.File = data[108:236] - if binary.BigEndian.Uint32(data[236:240]) != DHCPMagic { - return InvalidMagicCookie - } - - if len(data) <= 240 { - // DHCP Packet could have no option (??) - return nil - } - - options := data[240:] - - stop := len(options) - start := 0 - for start < stop { - o := DHCPOption{} - if err := o.decode(options[start:]); err != nil { - return err - } - if o.Type == DHCPOptEnd { - break - } - d.Options = append(d.Options, o) - // Check if the option is a single byte pad - if o.Type == DHCPOptPad { - start++ - } else { - start += int(o.Length) + 2 - } - } - - d.Contents = data - - return nil -} - -// Len returns the length of a DHCPv4 packet. -func (d *DHCPv4) Len() uint16 { - n := uint16(240) - for _, o := range d.Options { - if o.Type == DHCPOptPad { - n++ - } else { - n += uint16(o.Length) + 2 - } - } - n++ // for opt end - return n -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (d *DHCPv4) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - plen := int(d.Len()) - - data, err := b.PrependBytes(plen) - if err != nil { - return err - } - - data[0] = byte(d.Operation) - data[1] = byte(d.HardwareType) - if opts.FixLengths { - d.HardwareLen = uint8(len(d.ClientHWAddr)) - } - data[2] = d.HardwareLen - data[3] = d.HardwareOpts - binary.BigEndian.PutUint32(data[4:8], d.Xid) - binary.BigEndian.PutUint16(data[8:10], d.Secs) - binary.BigEndian.PutUint16(data[10:12], d.Flags) - copy(data[12:16], d.ClientIP.To4()) - copy(data[16:20], d.YourClientIP.To4()) - copy(data[20:24], d.NextServerIP.To4()) - copy(data[24:28], d.RelayAgentIP.To4()) - copy(data[28:44], d.ClientHWAddr) - copy(data[44:108], d.ServerName) - copy(data[108:236], d.File) - binary.BigEndian.PutUint32(data[236:240], DHCPMagic) - - if len(d.Options) > 0 { - offset := 240 - for _, o := range d.Options { - if err := o.encode(data[offset:]); err != nil { - return err - } - // A pad option is only a single byte - if o.Type == DHCPOptPad { - offset++ - } else { - offset += 2 + len(o.Data) - } - } - optend := NewDHCPOption(DHCPOptEnd, nil) - if err := optend.encode(data[offset:]); err != nil { - return err - } - } - return nil -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (d *DHCPv4) CanDecode() gopacket.LayerClass { - return LayerTypeDHCPv4 -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (d *DHCPv4) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypePayload -} - -func decodeDHCPv4(data []byte, p gopacket.PacketBuilder) error { - dhcp := &DHCPv4{} - err := dhcp.DecodeFromBytes(data, p) - if err != nil { - return err - } - p.AddLayer(dhcp) - return p.NextDecoder(gopacket.LayerTypePayload) -} - -// DHCPOpt represents a DHCP option or parameter from RFC-2132 -type DHCPOpt byte - -// Constants for the DHCPOpt options. -const ( - DHCPOptPad DHCPOpt = 0 - DHCPOptSubnetMask DHCPOpt = 1 // 4, net.IP - DHCPOptTimeOffset DHCPOpt = 2 // 4, int32 (signed seconds from UTC) - DHCPOptRouter DHCPOpt = 3 // n*4, [n]net.IP - DHCPOptTimeServer DHCPOpt = 4 // n*4, [n]net.IP - DHCPOptNameServer DHCPOpt = 5 // n*4, [n]net.IP - DHCPOptDNS DHCPOpt = 6 // n*4, [n]net.IP - DHCPOptLogServer DHCPOpt = 7 // n*4, [n]net.IP - DHCPOptCookieServer DHCPOpt = 8 // n*4, [n]net.IP - DHCPOptLPRServer DHCPOpt = 9 // n*4, [n]net.IP - DHCPOptImpressServer DHCPOpt = 10 // n*4, [n]net.IP - DHCPOptResLocServer DHCPOpt = 11 // n*4, [n]net.IP - DHCPOptHostname DHCPOpt = 12 // n, string - DHCPOptBootfileSize DHCPOpt = 13 // 2, uint16 - DHCPOptMeritDumpFile DHCPOpt = 14 // >1, string - DHCPOptDomainName DHCPOpt = 15 // n, string - DHCPOptSwapServer DHCPOpt = 16 // n*4, [n]net.IP - DHCPOptRootPath DHCPOpt = 17 // n, string - DHCPOptExtensionsPath DHCPOpt = 18 // n, string - DHCPOptIPForwarding DHCPOpt = 19 // 1, bool - DHCPOptSourceRouting DHCPOpt = 20 // 1, bool - DHCPOptPolicyFilter DHCPOpt = 21 // 8*n, [n]{net.IP/net.IP} - DHCPOptDatagramMTU DHCPOpt = 22 // 2, uint16 - DHCPOptDefaultTTL DHCPOpt = 23 // 1, byte - DHCPOptPathMTUAgingTimeout DHCPOpt = 24 // 4, uint32 - DHCPOptPathPlateuTableOption DHCPOpt = 25 // 2*n, []uint16 - DHCPOptInterfaceMTU DHCPOpt = 26 // 2, uint16 - DHCPOptAllSubsLocal DHCPOpt = 27 // 1, bool - DHCPOptBroadcastAddr DHCPOpt = 28 // 4, net.IP - DHCPOptMaskDiscovery DHCPOpt = 29 // 1, bool - DHCPOptMaskSupplier DHCPOpt = 30 // 1, bool - DHCPOptRouterDiscovery DHCPOpt = 31 // 1, bool - DHCPOptSolicitAddr DHCPOpt = 32 // 4, net.IP - DHCPOptStaticRoute DHCPOpt = 33 // n*8, [n]{net.IP/net.IP} -- note the 2nd is router not mask - DHCPOptARPTrailers DHCPOpt = 34 // 1, bool - DHCPOptARPTimeout DHCPOpt = 35 // 4, uint32 - DHCPOptEthernetEncap DHCPOpt = 36 // 1, bool - DHCPOptTCPTTL DHCPOpt = 37 // 1, byte - DHCPOptTCPKeepAliveInt DHCPOpt = 38 // 4, uint32 - DHCPOptTCPKeepAliveGarbage DHCPOpt = 39 // 1, bool - DHCPOptNISDomain DHCPOpt = 40 // n, string - DHCPOptNISServers DHCPOpt = 41 // 4*n, [n]net.IP - DHCPOptNTPServers DHCPOpt = 42 // 4*n, [n]net.IP - DHCPOptVendorOption DHCPOpt = 43 // n, [n]byte // may be encapsulated. - DHCPOptNetBIOSTCPNS DHCPOpt = 44 // 4*n, [n]net.IP - DHCPOptNetBIOSTCPDDS DHCPOpt = 45 // 4*n, [n]net.IP - DHCPOptNETBIOSTCPNodeType DHCPOpt = 46 // 1, magic byte - DHCPOptNetBIOSTCPScope DHCPOpt = 47 // n, string - DHCPOptXFontServer DHCPOpt = 48 // n, string - DHCPOptXDisplayManager DHCPOpt = 49 // n, string - DHCPOptRequestIP DHCPOpt = 50 // 4, net.IP - DHCPOptLeaseTime DHCPOpt = 51 // 4, uint32 - DHCPOptExtOptions DHCPOpt = 52 // 1, 1/2/3 - DHCPOptMessageType DHCPOpt = 53 // 1, 1-7 - DHCPOptServerID DHCPOpt = 54 // 4, net.IP - DHCPOptParamsRequest DHCPOpt = 55 // n, []byte - DHCPOptMessage DHCPOpt = 56 // n, 3 - DHCPOptMaxMessageSize DHCPOpt = 57 // 2, uint16 - DHCPOptT1 DHCPOpt = 58 // 4, uint32 - DHCPOptT2 DHCPOpt = 59 // 4, uint32 - DHCPOptClassID DHCPOpt = 60 // n, []byte - DHCPOptClientID DHCPOpt = 61 // n >= 2, []byte - DHCPOptDomainSearch DHCPOpt = 119 // n, string - DHCPOptSIPServers DHCPOpt = 120 // n, url - DHCPOptClasslessStaticRoute DHCPOpt = 121 // - DHCPOptEnd DHCPOpt = 255 -) - -// String returns a string version of a DHCPOpt. -func (o DHCPOpt) String() string { - switch o { - case DHCPOptPad: - return "(padding)" - case DHCPOptSubnetMask: - return "SubnetMask" - case DHCPOptTimeOffset: - return "TimeOffset" - case DHCPOptRouter: - return "Router" - case DHCPOptTimeServer: - return "rfc868" // old time server protocol stringified to dissuade confusion w. NTP - case DHCPOptNameServer: - return "ien116" // obscure nameserver protocol stringified to dissuade confusion w. DNS - case DHCPOptDNS: - return "DNS" - case DHCPOptLogServer: - return "mitLCS" // MIT LCS server protocol yada yada w. Syslog - case DHCPOptCookieServer: - return "CookieServer" - case DHCPOptLPRServer: - return "LPRServer" - case DHCPOptImpressServer: - return "ImpressServer" - case DHCPOptResLocServer: - return "ResourceLocationServer" - case DHCPOptHostname: - return "Hostname" - case DHCPOptBootfileSize: - return "BootfileSize" - case DHCPOptMeritDumpFile: - return "MeritDumpFile" - case DHCPOptDomainName: - return "DomainName" - case DHCPOptSwapServer: - return "SwapServer" - case DHCPOptRootPath: - return "RootPath" - case DHCPOptExtensionsPath: - return "ExtensionsPath" - case DHCPOptIPForwarding: - return "IPForwarding" - case DHCPOptSourceRouting: - return "SourceRouting" - case DHCPOptPolicyFilter: - return "PolicyFilter" - case DHCPOptDatagramMTU: - return "DatagramMTU" - case DHCPOptDefaultTTL: - return "DefaultTTL" - case DHCPOptPathMTUAgingTimeout: - return "PathMTUAgingTimeout" - case DHCPOptPathPlateuTableOption: - return "PathPlateuTableOption" - case DHCPOptInterfaceMTU: - return "InterfaceMTU" - case DHCPOptAllSubsLocal: - return "AllSubsLocal" - case DHCPOptBroadcastAddr: - return "BroadcastAddress" - case DHCPOptMaskDiscovery: - return "MaskDiscovery" - case DHCPOptMaskSupplier: - return "MaskSupplier" - case DHCPOptRouterDiscovery: - return "RouterDiscovery" - case DHCPOptSolicitAddr: - return "SolicitAddr" - case DHCPOptStaticRoute: - return "StaticRoute" - case DHCPOptARPTrailers: - return "ARPTrailers" - case DHCPOptARPTimeout: - return "ARPTimeout" - case DHCPOptEthernetEncap: - return "EthernetEncap" - case DHCPOptTCPTTL: - return "TCPTTL" - case DHCPOptTCPKeepAliveInt: - return "TCPKeepAliveInt" - case DHCPOptTCPKeepAliveGarbage: - return "TCPKeepAliveGarbage" - case DHCPOptNISDomain: - return "NISDomain" - case DHCPOptNISServers: - return "NISServers" - case DHCPOptNTPServers: - return "NTPServers" - case DHCPOptVendorOption: - return "VendorOption" - case DHCPOptNetBIOSTCPNS: - return "NetBIOSOverTCPNS" - case DHCPOptNetBIOSTCPDDS: - return "NetBiosOverTCPDDS" - case DHCPOptNETBIOSTCPNodeType: - return "NetBIOSOverTCPNodeType" - case DHCPOptNetBIOSTCPScope: - return "NetBIOSOverTCPScope" - case DHCPOptXFontServer: - return "XFontServer" - case DHCPOptXDisplayManager: - return "XDisplayManager" - case DHCPOptEnd: - return "(end)" - case DHCPOptSIPServers: - return "SipServers" - case DHCPOptRequestIP: - return "RequestIP" - case DHCPOptLeaseTime: - return "LeaseTime" - case DHCPOptExtOptions: - return "ExtOpts" - case DHCPOptMessageType: - return "MessageType" - case DHCPOptServerID: - return "ServerID" - case DHCPOptParamsRequest: - return "ParamsRequest" - case DHCPOptMessage: - return "Message" - case DHCPOptMaxMessageSize: - return "MaxDHCPSize" - case DHCPOptT1: - return "Timer1" - case DHCPOptT2: - return "Timer2" - case DHCPOptClassID: - return "ClassID" - case DHCPOptClientID: - return "ClientID" - case DHCPOptDomainSearch: - return "DomainSearch" - case DHCPOptClasslessStaticRoute: - return "ClasslessStaticRoute" - default: - return "Unknown" - } -} - -// DHCPOption rerpresents a DHCP option. -type DHCPOption struct { - Type DHCPOpt - Length uint8 - Data []byte -} - -// String returns a string version of a DHCP Option. -func (o DHCPOption) String() string { - switch o.Type { - - case DHCPOptHostname, DHCPOptMeritDumpFile, DHCPOptDomainName, DHCPOptRootPath, - DHCPOptExtensionsPath, DHCPOptNISDomain, DHCPOptNetBIOSTCPScope, DHCPOptXFontServer, - DHCPOptXDisplayManager, DHCPOptMessage, DHCPOptDomainSearch: // string - return fmt.Sprintf("Option(%s:%s)", o.Type, string(o.Data)) - - case DHCPOptMessageType: - if len(o.Data) != 1 { - return fmt.Sprintf("Option(%s:INVALID)", o.Type) - } - return fmt.Sprintf("Option(%s:%s)", o.Type, DHCPMsgType(o.Data[0])) - - case DHCPOptSubnetMask, DHCPOptServerID, DHCPOptBroadcastAddr, - DHCPOptSolicitAddr, DHCPOptRequestIP: // net.IP - if len(o.Data) < 4 { - return fmt.Sprintf("Option(%s:INVALID)", o.Type) - } - return fmt.Sprintf("Option(%s:%s)", o.Type, net.IP(o.Data)) - - case DHCPOptT1, DHCPOptT2, DHCPOptLeaseTime, DHCPOptPathMTUAgingTimeout, - DHCPOptARPTimeout, DHCPOptTCPKeepAliveInt: // uint32 - if len(o.Data) != 4 { - return fmt.Sprintf("Option(%s:INVALID)", o.Type) - } - return fmt.Sprintf("Option(%s:%d)", o.Type, - uint32(o.Data[0])<<24|uint32(o.Data[1])<<16|uint32(o.Data[2])<<8|uint32(o.Data[3])) - - case DHCPOptParamsRequest: - buf := &bytes.Buffer{} - buf.WriteString(fmt.Sprintf("Option(%s:", o.Type)) - for i, v := range o.Data { - buf.WriteString(DHCPOpt(v).String()) - if i+1 != len(o.Data) { - buf.WriteByte(',') - } - } - buf.WriteString(")") - return buf.String() - - default: - return fmt.Sprintf("Option(%s:%v)", o.Type, o.Data) - } -} - -// NewDHCPOption constructs a new DHCPOption with a given type and data. -func NewDHCPOption(t DHCPOpt, data []byte) DHCPOption { - o := DHCPOption{Type: t} - if data != nil { - o.Data = data - o.Length = uint8(len(data)) - } - return o -} - -func (o *DHCPOption) encode(b []byte) error { - switch o.Type { - case DHCPOptPad, DHCPOptEnd: - b[0] = byte(o.Type) - default: - b[0] = byte(o.Type) - b[1] = o.Length - copy(b[2:], o.Data) - } - return nil -} - -func (o *DHCPOption) decode(data []byte) error { - if len(data) < 1 { - // Pad/End have a length of 1 - return DecOptionNotEnoughData - } - o.Type = DHCPOpt(data[0]) - switch o.Type { - case DHCPOptPad, DHCPOptEnd: - o.Data = nil - default: - if len(data) < 2 { - return DecOptionNotEnoughData - } - o.Length = data[1] - if int(o.Length) > len(data[2:]) { - return DecOptionMalformed - } - o.Data = data[2 : 2+int(o.Length)] - } - return nil -} - -// DHCPv4Error is used for constant errors for DHCPv4. It is needed for test asserts. -type DHCPv4Error string - -// DHCPv4Error implements error interface. -func (d DHCPv4Error) Error() string { - return string(d) -} - -const ( - // DecOptionNotEnoughData is returned when there is not enough data during option's decode process - DecOptionNotEnoughData = DHCPv4Error("Not enough data to decode") - // DecOptionMalformed is returned when the option is malformed - DecOptionMalformed = DHCPv4Error("Option is malformed") - // InvalidMagicCookie is returned when Magic cookie is missing into BOOTP header - InvalidMagicCookie = DHCPv4Error("Bad DHCP header") -) diff --git a/vendor/github.com/google/gopacket/layers/dhcpv6.go b/vendor/github.com/google/gopacket/layers/dhcpv6.go deleted file mode 100644 index 2698cfb19..000000000 --- a/vendor/github.com/google/gopacket/layers/dhcpv6.go +++ /dev/null @@ -1,360 +0,0 @@ -// Copyright 2018 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "fmt" - "net" - - "github.com/google/gopacket" -) - -// DHCPv6MsgType represents a DHCPv6 operation -type DHCPv6MsgType byte - -// Constants that represent DHCP operations -const ( - DHCPv6MsgTypeUnspecified DHCPv6MsgType = iota - DHCPv6MsgTypeSolicit - DHCPv6MsgTypeAdverstise - DHCPv6MsgTypeRequest - DHCPv6MsgTypeConfirm - DHCPv6MsgTypeRenew - DHCPv6MsgTypeRebind - DHCPv6MsgTypeReply - DHCPv6MsgTypeRelease - DHCPv6MsgTypeDecline - DHCPv6MsgTypeReconfigure - DHCPv6MsgTypeInformationRequest - DHCPv6MsgTypeRelayForward - DHCPv6MsgTypeRelayReply -) - -// String returns a string version of a DHCPv6MsgType. -func (o DHCPv6MsgType) String() string { - switch o { - case DHCPv6MsgTypeUnspecified: - return "Unspecified" - case DHCPv6MsgTypeSolicit: - return "Solicit" - case DHCPv6MsgTypeAdverstise: - return "Adverstise" - case DHCPv6MsgTypeRequest: - return "Request" - case DHCPv6MsgTypeConfirm: - return "Confirm" - case DHCPv6MsgTypeRenew: - return "Renew" - case DHCPv6MsgTypeRebind: - return "Rebind" - case DHCPv6MsgTypeReply: - return "Reply" - case DHCPv6MsgTypeRelease: - return "Release" - case DHCPv6MsgTypeDecline: - return "Decline" - case DHCPv6MsgTypeReconfigure: - return "Reconfigure" - case DHCPv6MsgTypeInformationRequest: - return "InformationRequest" - case DHCPv6MsgTypeRelayForward: - return "RelayForward" - case DHCPv6MsgTypeRelayReply: - return "RelayReply" - default: - return "Unknown" - } -} - -// DHCPv6 contains data for a single DHCP packet. -type DHCPv6 struct { - BaseLayer - MsgType DHCPv6MsgType - HopCount uint8 - LinkAddr net.IP - PeerAddr net.IP - TransactionID []byte - Options DHCPv6Options -} - -// LayerType returns gopacket.LayerTypeDHCPv6 -func (d *DHCPv6) LayerType() gopacket.LayerType { return LayerTypeDHCPv6 } - -// DecodeFromBytes decodes the given bytes into this layer. -func (d *DHCPv6) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 4 { - df.SetTruncated() - return fmt.Errorf("DHCPv6 length %d too short", len(data)) - } - d.BaseLayer = BaseLayer{Contents: data} - d.Options = d.Options[:0] - d.MsgType = DHCPv6MsgType(data[0]) - - offset := 0 - if d.MsgType == DHCPv6MsgTypeRelayForward || d.MsgType == DHCPv6MsgTypeRelayReply { - if len(data) < 34 { - df.SetTruncated() - return fmt.Errorf("DHCPv6 length %d too short for message type %d", len(data), d.MsgType) - } - d.HopCount = data[1] - d.LinkAddr = net.IP(data[2:18]) - d.PeerAddr = net.IP(data[18:34]) - offset = 34 - } else { - d.TransactionID = data[1:4] - offset = 4 - } - - stop := len(data) - for offset < stop { - o := DHCPv6Option{} - if err := o.decode(data[offset:]); err != nil { - return err - } - d.Options = append(d.Options, o) - offset += int(o.Length) + 4 // 2 from option code, 2 from option length - } - - return nil -} - -// Len returns the length of a DHCPv6 packet. -func (d *DHCPv6) Len() int { - n := 1 - if d.MsgType == DHCPv6MsgTypeRelayForward || d.MsgType == DHCPv6MsgTypeRelayReply { - n += 33 - } else { - n += 3 - } - - for _, o := range d.Options { - n += int(o.Length) + 4 // 2 from option code, 2 from option length - } - - return n -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (d *DHCPv6) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - plen := int(d.Len()) - - data, err := b.PrependBytes(plen) - if err != nil { - return err - } - - offset := 0 - data[0] = byte(d.MsgType) - if d.MsgType == DHCPv6MsgTypeRelayForward || d.MsgType == DHCPv6MsgTypeRelayReply { - data[1] = byte(d.HopCount) - copy(data[2:18], d.LinkAddr.To16()) - copy(data[18:34], d.PeerAddr.To16()) - offset = 34 - } else { - copy(data[1:4], d.TransactionID) - offset = 4 - } - - if len(d.Options) > 0 { - for _, o := range d.Options { - if err := o.encode(data[offset:], opts); err != nil { - return err - } - offset += int(o.Length) + 4 // 2 from option code, 2 from option length - } - } - return nil -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (d *DHCPv6) CanDecode() gopacket.LayerClass { - return LayerTypeDHCPv6 -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (d *DHCPv6) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypePayload -} - -func decodeDHCPv6(data []byte, p gopacket.PacketBuilder) error { - dhcp := &DHCPv6{} - err := dhcp.DecodeFromBytes(data, p) - if err != nil { - return err - } - p.AddLayer(dhcp) - return p.NextDecoder(gopacket.LayerTypePayload) -} - -// DHCPv6StatusCode represents a DHCP status code - RFC-3315 -type DHCPv6StatusCode uint16 - -// Constants for the DHCPv6StatusCode. -const ( - DHCPv6StatusCodeSuccess DHCPv6StatusCode = iota - DHCPv6StatusCodeUnspecFail - DHCPv6StatusCodeNoAddrsAvail - DHCPv6StatusCodeNoBinding - DHCPv6StatusCodeNotOnLink - DHCPv6StatusCodeUseMulticast -) - -// String returns a string version of a DHCPv6StatusCode. -func (o DHCPv6StatusCode) String() string { - switch o { - case DHCPv6StatusCodeSuccess: - return "Success" - case DHCPv6StatusCodeUnspecFail: - return "UnspecifiedFailure" - case DHCPv6StatusCodeNoAddrsAvail: - return "NoAddressAvailable" - case DHCPv6StatusCodeNoBinding: - return "NoBinding" - case DHCPv6StatusCodeNotOnLink: - return "NotOnLink" - case DHCPv6StatusCodeUseMulticast: - return "UseMulticast" - default: - return "Unknown" - } -} - -// DHCPv6DUIDType represents a DHCP DUID - RFC-3315 -type DHCPv6DUIDType uint16 - -// Constants for the DHCPv6DUIDType. -const ( - DHCPv6DUIDTypeLLT DHCPv6DUIDType = iota + 1 - DHCPv6DUIDTypeEN - DHCPv6DUIDTypeLL -) - -// String returns a string version of a DHCPv6DUIDType. -func (o DHCPv6DUIDType) String() string { - switch o { - case DHCPv6DUIDTypeLLT: - return "LLT" - case DHCPv6DUIDTypeEN: - return "EN" - case DHCPv6DUIDTypeLL: - return "LL" - default: - return "Unknown" - } -} - -// DHCPv6DUID means DHCP Unique Identifier as stated in RFC 3315, section 9 (https://tools.ietf.org/html/rfc3315#page-19) -type DHCPv6DUID struct { - Type DHCPv6DUIDType - // LLT, LL - HardwareType []byte - // EN - EnterpriseNumber []byte - // LLT - Time []byte - // LLT, LL - LinkLayerAddress net.HardwareAddr - // EN - Identifier []byte -} - -// DecodeFromBytes decodes the given bytes into a DHCPv6DUID -func (d *DHCPv6DUID) DecodeFromBytes(data []byte) error { - if len(data) < 2 { - return fmt.Errorf("Not enough bytes to decode: %d", len(data)) - } - - d.Type = DHCPv6DUIDType(binary.BigEndian.Uint16(data[:2])) - if d.Type == DHCPv6DUIDTypeLLT || d.Type == DHCPv6DUIDTypeLL { - if len(data) < 4 { - return fmt.Errorf("Not enough bytes to decode: %d", len(data)) - } - d.HardwareType = data[2:4] - } - - if d.Type == DHCPv6DUIDTypeLLT { - if len(data) < 8 { - return fmt.Errorf("Not enough bytes to decode: %d", len(data)) - } - d.Time = data[4:8] - d.LinkLayerAddress = net.HardwareAddr(data[8:]) - } else if d.Type == DHCPv6DUIDTypeEN { - if len(data) < 6 { - return fmt.Errorf("Not enough bytes to decode: %d", len(data)) - } - d.EnterpriseNumber = data[2:6] - d.Identifier = data[6:] - } else { // DHCPv6DUIDTypeLL - if len(data) < 4 { - return fmt.Errorf("Not enough bytes to decode: %d", len(data)) - } - d.LinkLayerAddress = net.HardwareAddr(data[4:]) - } - - return nil -} - -// Encode encodes the DHCPv6DUID in a slice of bytes -func (d *DHCPv6DUID) Encode() []byte { - length := d.Len() - data := make([]byte, length) - binary.BigEndian.PutUint16(data[0:2], uint16(d.Type)) - - if d.Type == DHCPv6DUIDTypeLLT || d.Type == DHCPv6DUIDTypeLL { - copy(data[2:4], d.HardwareType) - } - - if d.Type == DHCPv6DUIDTypeLLT { - copy(data[4:8], d.Time) - copy(data[8:], d.LinkLayerAddress) - } else if d.Type == DHCPv6DUIDTypeEN { - copy(data[2:6], d.EnterpriseNumber) - copy(data[6:], d.Identifier) - } else { - copy(data[4:], d.LinkLayerAddress) - } - - return data -} - -// Len returns the length of the DHCPv6DUID, respecting the type -func (d *DHCPv6DUID) Len() int { - length := 2 // d.Type - if d.Type == DHCPv6DUIDTypeLLT { - length += 2 /*HardwareType*/ + 4 /*d.Time*/ + len(d.LinkLayerAddress) - } else if d.Type == DHCPv6DUIDTypeEN { - length += 4 /*d.EnterpriseNumber*/ + len(d.Identifier) - } else { // LL - length += 2 /*d.HardwareType*/ + len(d.LinkLayerAddress) - } - - return length -} - -func (d *DHCPv6DUID) String() string { - duid := "Type: " + d.Type.String() + ", " - if d.Type == DHCPv6DUIDTypeLLT { - duid += fmt.Sprintf("HardwareType: %v, Time: %v, LinkLayerAddress: %v", d.HardwareType, d.Time, d.LinkLayerAddress) - } else if d.Type == DHCPv6DUIDTypeEN { - duid += fmt.Sprintf("EnterpriseNumber: %v, Identifier: %v", d.EnterpriseNumber, d.Identifier) - } else { // DHCPv6DUIDTypeLL - duid += fmt.Sprintf("HardwareType: %v, LinkLayerAddress: %v", d.HardwareType, d.LinkLayerAddress) - } - return duid -} - -func decodeDHCPv6DUID(data []byte) (*DHCPv6DUID, error) { - duid := &DHCPv6DUID{} - err := duid.DecodeFromBytes(data) - if err != nil { - return nil, err - } - return duid, nil -} diff --git a/vendor/github.com/google/gopacket/layers/dhcpv6_options.go b/vendor/github.com/google/gopacket/layers/dhcpv6_options.go deleted file mode 100644 index 5a1f9919b..000000000 --- a/vendor/github.com/google/gopacket/layers/dhcpv6_options.go +++ /dev/null @@ -1,621 +0,0 @@ -// Copyright 2018 The GoPacket Authors. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "bytes" - "encoding/binary" - "errors" - "fmt" - "github.com/google/gopacket" -) - -// DHCPv6Opt represents a DHCP option or parameter from RFC-3315 -type DHCPv6Opt uint16 - -// Constants for the DHCPv6Opt options. -const ( - DHCPv6OptClientID DHCPv6Opt = 1 - DHCPv6OptServerID DHCPv6Opt = 2 - DHCPv6OptIANA DHCPv6Opt = 3 - DHCPv6OptIATA DHCPv6Opt = 4 - DHCPv6OptIAAddr DHCPv6Opt = 5 - DHCPv6OptOro DHCPv6Opt = 6 - DHCPv6OptPreference DHCPv6Opt = 7 - DHCPv6OptElapsedTime DHCPv6Opt = 8 - DHCPv6OptRelayMessage DHCPv6Opt = 9 - DHCPv6OptAuth DHCPv6Opt = 11 - DHCPv6OptUnicast DHCPv6Opt = 12 - DHCPv6OptStatusCode DHCPv6Opt = 13 - DHCPv6OptRapidCommit DHCPv6Opt = 14 - DHCPv6OptUserClass DHCPv6Opt = 15 - DHCPv6OptVendorClass DHCPv6Opt = 16 - DHCPv6OptVendorOpts DHCPv6Opt = 17 - DHCPv6OptInterfaceID DHCPv6Opt = 18 - DHCPv6OptReconfigureMessage DHCPv6Opt = 19 - DHCPv6OptReconfigureAccept DHCPv6Opt = 20 - - // RFC 3319 Session Initiation Protocol (SIP) - DHCPv6OptSIPServersDomainList DHCPv6Opt = 21 - DHCPv6OptSIPServersAddressList DHCPv6Opt = 22 - - // RFC 3646 DNS Configuration - DHCPv6OptDNSServers DHCPv6Opt = 23 - DHCPv6OptDomainList DHCPv6Opt = 24 - - // RFC 3633 Prefix Delegation - DHCPv6OptIAPD DHCPv6Opt = 25 - DHCPv6OptIAPrefix DHCPv6Opt = 26 - - // RFC 3898 Network Information Service (NIS) - DHCPv6OptNISServers DHCPv6Opt = 27 - DHCPv6OptNISPServers DHCPv6Opt = 28 - DHCPv6OptNISDomainName DHCPv6Opt = 29 - DHCPv6OptNISPDomainName DHCPv6Opt = 30 - - // RFC 4075 Simple Network Time Protocol (SNTP) - DHCPv6OptSNTPServers DHCPv6Opt = 31 - - // RFC 4242 Information Refresh Time Option - DHCPv6OptInformationRefreshTime DHCPv6Opt = 32 - - // RFC 4280 Broadcast and Multicast Control Servers - DHCPv6OptBCMCSServerDomainNameList DHCPv6Opt = 33 - DHCPv6OptBCMCSServerAddressList DHCPv6Opt = 34 - - // RFC 4776 Civic Address ConfigurationOption - DHCPv6OptGeoconfCivic DHCPv6Opt = 36 - - // RFC 4649 Relay Agent Remote-ID - DHCPv6OptRemoteID DHCPv6Opt = 37 - - // RFC 4580 Relay Agent Subscriber-ID - DHCPv6OptSubscriberID DHCPv6Opt = 38 - - // RFC 4704 Client Full Qualified Domain Name (FQDN) - DHCPv6OptClientFQDN DHCPv6Opt = 39 - - // RFC 5192 Protocol for Carrying Authentication for Network Access (PANA) - DHCPv6OptPanaAgent DHCPv6Opt = 40 - - // RFC 4833 Timezone Options - DHCPv6OptNewPOSIXTimezone DHCPv6Opt = 41 - DHCPv6OptNewTZDBTimezone DHCPv6Opt = 42 - - // RFC 4994 Relay Agent Echo Request - DHCPv6OptEchoRequestOption DHCPv6Opt = 43 - - // RFC 5007 Leasequery - DHCPv6OptLQQuery DHCPv6Opt = 44 - DHCPv6OptCLTTime DHCPv6Opt = 45 - DHCPv6OptClientData DHCPv6Opt = 46 - DHCPv6OptLQRelayData DHCPv6Opt = 47 - DHCPv6OptLQClientLink DHCPv6Opt = 48 - - // RFC 6610 Home Information Discovery in Mobile IPv6 (MIPv6) - DHCPv6OptMIP6HNIDF DHCPv6Opt = 49 - DHCPv6OptMIP6VDINF DHCPv6Opt = 50 - DHCPv6OptMIP6IDINF DHCPv6Opt = 69 - DHCPv6OptMIP6UDINF DHCPv6Opt = 70 - DHCPv6OptMIP6HNP DHCPv6Opt = 71 - DHCPv6OptMIP6HAA DHCPv6Opt = 72 - DHCPv6OptMIP6HAF DHCPv6Opt = 73 - - // RFC 5223 Discovering Location-to-Service Translation (LoST) Servers - DHCPv6OptV6LOST DHCPv6Opt = 51 - - // RFC 5417 Control And Provisioning of Wireless Access Points (CAPWAP) - DHCPv6OptCAPWAPACV6 DHCPv6Opt = 52 - - // RFC 5460 Bulk Leasequery - DHCPv6OptRelayID DHCPv6Opt = 53 - - // RFC 5678 IEEE 802.21 Mobility Services (MoS) Discovery - DHCPv6OptIPv6AddressMoS DHCPv6Opt = 54 - DHCPv6OptIPv6FQDNMoS DHCPv6Opt = 55 - - // RFC 5908 NTP Server Option - DHCPv6OptNTPServer DHCPv6Opt = 56 - - // RFC 5986 Discovering the Local Location Information Server (LIS) - DHCPv6OptV6AccessDomain DHCPv6Opt = 57 - - // RFC 5986 SIP User Agent - DHCPv6OptSIPUACSList DHCPv6Opt = 58 - - // RFC 5970 Options for Network Boot - DHCPv6OptBootFileURL DHCPv6Opt = 59 - DHCPv6OptBootFileParam DHCPv6Opt = 60 - DHCPv6OptClientArchType DHCPv6Opt = 61 - DHCPv6OptNII DHCPv6Opt = 62 - - // RFC 6225 Coordinate-Based Location Configuration Information - DHCPv6OptGeolocation DHCPv6Opt = 63 - - // RFC 6334 Dual-Stack Lite - DHCPv6OptAFTRName DHCPv6Opt = 64 - - // RFC 6440 EAP Re-authentication Protocol (ERP) - DHCPv6OptERPLocalDomainName DHCPv6Opt = 65 - - // RFC 6422 Relay-Supplied DHCP Options - DHCPv6OptRSOO DHCPv6Opt = 66 - - // RFC 6603 Prefix Exclude Option for DHCPv6-based Prefix Delegation - DHCPv6OptPDExclude DHCPv6Opt = 67 - - // RFC 6607 Virtual Subnet Selection - DHCPv6OptVSS DHCPv6Opt = 68 - - // RFC 6731 Improved Recursive DNS Server Selection for Multi-Interfaced Nodes - DHCPv6OptRDNSSSelection DHCPv6Opt = 74 - - // RFC 6784 Kerberos Options for DHCPv6 - DHCPv6OptKRBPrincipalName DHCPv6Opt = 75 - DHCPv6OptKRBRealmName DHCPv6Opt = 76 - DHCPv6OptKRBKDC DHCPv6Opt = 77 - - // RFC 6939 Client Link-Layer Address Option - DHCPv6OptClientLinkLayerAddress DHCPv6Opt = 79 - - // RFC 6977 Triggering DHCPv6 Reconfiguration from Relay Agents - DHCPv6OptLinkAddress DHCPv6Opt = 80 - - // RFC 7037 RADIUS Option for the DHCPv6 Relay Agent - DHCPv6OptRADIUS DHCPv6Opt = 81 - - // RFC 7083 Modification to Default Values of SOL_MAX_RT and INF_MAX_RT - DHCPv6OptSolMaxRt DHCPv6Opt = 82 - DHCPv6OptInfMaxRt DHCPv6Opt = 83 - - // RFC 7078 Distributing Address Selection Policy - DHCPv6OptAddrSel DHCPv6Opt = 84 - DHCPv6OptAddrSelTable DHCPv6Opt = 85 - - // RFC 7291 DHCP Options for the Port Control Protocol (PCP) - DHCPv6OptV6PCPServer DHCPv6Opt = 86 - - // RFC 7341 DHCPv4-over-DHCPv6 (DHCP 4o6) Transport - DHCPv6OptDHCPv4Message DHCPv6Opt = 87 - DHCPv6OptDHCPv4OverDHCPv6Server DHCPv6Opt = 88 - - // RFC 7598 Configuration of Softwire Address and Port-Mapped Clients - DHCPv6OptS46Rule DHCPv6Opt = 89 - DHCPv6OptS46BR DHCPv6Opt = 90 - DHCPv6OptS46DMR DHCPv6Opt = 91 - DHCPv6OptS46V4V4Bind DHCPv6Opt = 92 - DHCPv6OptS46PortParameters DHCPv6Opt = 93 - DHCPv6OptS46ContMAPE DHCPv6Opt = 94 - DHCPv6OptS46ContMAPT DHCPv6Opt = 95 - DHCPv6OptS46ContLW DHCPv6Opt = 96 - - // RFC 7600 IPv4 Residual Deployment via IPv6 - DHCPv6Opt4RD DHCPv6Opt = 97 - DHCPv6Opt4RDMapRule DHCPv6Opt = 98 - DHCPv6Opt4RDNonMapRule DHCPv6Opt = 99 - - // RFC 7653 Active Leasequery - DHCPv6OptLQBaseTime DHCPv6Opt = 100 - DHCPv6OptLQStartTime DHCPv6Opt = 101 - DHCPv6OptLQEndTime DHCPv6Opt = 102 - - // RFC 7710 Captive-Portal Identification - DHCPv6OptCaptivePortal DHCPv6Opt = 103 - - // RFC 7774 Multicast Protocol for Low-Power and Lossy Networks (MPL) Parameter Configuration - DHCPv6OptMPLParameters DHCPv6Opt = 104 - - // RFC 7839 Access-Network-Identifier (ANI) - DHCPv6OptANIATT DHCPv6Opt = 105 - DHCPv6OptANINetworkName DHCPv6Opt = 106 - DHCPv6OptANIAPName DHCPv6Opt = 107 - DHCPv6OptANIAPBSSID DHCPv6Opt = 108 - DHCPv6OptANIOperatorID DHCPv6Opt = 109 - DHCPv6OptANIOperatorRealm DHCPv6Opt = 110 - - // RFC 8026 Unified IPv4-in-IPv6 Softwire Customer Premises Equipment (CPE) - DHCPv6OptS46Priority DHCPv6Opt = 111 - - // draft-ietf-opsawg-mud-25 Manufacturer Usage Description (MUD) - DHCPv6OptMUDURLV6 DHCPv6Opt = 112 - - // RFC 8115 IPv4-Embedded Multicast and Unicast IPv6 Prefixes - DHCPv6OptV6Prefix64 DHCPv6Opt = 113 - - // RFC 8156 DHCPv6 Failover Protocol - DHCPv6OptFBindingStatus DHCPv6Opt = 114 - DHCPv6OptFConnectFlags DHCPv6Opt = 115 - DHCPv6OptFDNSRemovalInfo DHCPv6Opt = 116 - DHCPv6OptFDNSHostName DHCPv6Opt = 117 - DHCPv6OptFDNSZoneName DHCPv6Opt = 118 - DHCPv6OptFDNSFlags DHCPv6Opt = 119 - DHCPv6OptFExpirationTime DHCPv6Opt = 120 - DHCPv6OptFMaxUnacknowledgedBNDUPD DHCPv6Opt = 121 - DHCPv6OptFMCLT DHCPv6Opt = 122 - DHCPv6OptFPartnerLifetime DHCPv6Opt = 123 - DHCPv6OptFPartnerLifetimeSent DHCPv6Opt = 124 - DHCPv6OptFPartnerDownTime DHCPv6Opt = 125 - DHCPv6OptFPartnerRawCltTime DHCPv6Opt = 126 - DHCPv6OptFProtocolVersion DHCPv6Opt = 127 - DHCPv6OptFKeepaliveTime DHCPv6Opt = 128 - DHCPv6OptFReconfigureData DHCPv6Opt = 129 - DHCPv6OptFRelationshipName DHCPv6Opt = 130 - DHCPv6OptFServerFlags DHCPv6Opt = 131 - DHCPv6OptFServerState DHCPv6Opt = 132 - DHCPv6OptFStartTimeOfState DHCPv6Opt = 133 - DHCPv6OptFStateExpirationTime DHCPv6Opt = 134 - - // RFC 8357 Generalized UDP Source Port for DHCP Relay - DHCPv6OptRelayPort DHCPv6Opt = 135 - - // draft-ietf-netconf-zerotouch-25 Zero Touch Provisioning for Networking Devices - DHCPv6OptV6ZeroTouchRedirect DHCPv6Opt = 136 - - // RFC 6153 Access Network Discovery and Selection Function (ANDSF) Discovery - DHCPv6OptIPV6AddressANDSF DHCPv6Opt = 143 -) - -// String returns a string version of a DHCPv6Opt. -func (o DHCPv6Opt) String() string { - switch o { - case DHCPv6OptClientID: - return "ClientID" - case DHCPv6OptServerID: - return "ServerID" - case DHCPv6OptIANA: - return "IA_NA" - case DHCPv6OptIATA: - return "IA_TA" - case DHCPv6OptIAAddr: - return "IAAddr" - case DHCPv6OptOro: - return "Oro" - case DHCPv6OptPreference: - return "Preference" - case DHCPv6OptElapsedTime: - return "ElapsedTime" - case DHCPv6OptRelayMessage: - return "RelayMessage" - case DHCPv6OptAuth: - return "Auth" - case DHCPv6OptUnicast: - return "Unicast" - case DHCPv6OptStatusCode: - return "StatusCode" - case DHCPv6OptRapidCommit: - return "RapidCommit" - case DHCPv6OptUserClass: - return "UserClass" - case DHCPv6OptVendorClass: - return "VendorClass" - case DHCPv6OptVendorOpts: - return "VendorOpts" - case DHCPv6OptInterfaceID: - return "InterfaceID" - case DHCPv6OptReconfigureMessage: - return "ReconfigureMessage" - case DHCPv6OptReconfigureAccept: - return "ReconfigureAccept" - case DHCPv6OptSIPServersDomainList: - return "SIPServersDomainList" - case DHCPv6OptSIPServersAddressList: - return "SIPServersAddressList" - case DHCPv6OptDNSServers: - return "DNSRecursiveNameServer" - case DHCPv6OptDomainList: - return "DomainSearchList" - case DHCPv6OptIAPD: - return "IdentityAssociationPrefixDelegation" - case DHCPv6OptIAPrefix: - return "IAPDPrefix" - case DHCPv6OptNISServers: - return "NISServers" - case DHCPv6OptNISPServers: - return "NISv2Servers" - case DHCPv6OptNISDomainName: - return "NISDomainName" - case DHCPv6OptNISPDomainName: - return "NISv2DomainName" - case DHCPv6OptSNTPServers: - return "SNTPServers" - case DHCPv6OptInformationRefreshTime: - return "InformationRefreshTime" - case DHCPv6OptBCMCSServerDomainNameList: - return "BCMCSControlServersDomainNameList" - case DHCPv6OptBCMCSServerAddressList: - return "BCMCSControlServersAddressList" - case DHCPv6OptGeoconfCivic: - return "CivicAddress" - case DHCPv6OptRemoteID: - return "RelayAgentRemoteID" - case DHCPv6OptSubscriberID: - return "RelayAgentSubscriberID" - case DHCPv6OptClientFQDN: - return "ClientFQDN" - case DHCPv6OptPanaAgent: - return "PANAAuthenticationAgent" - case DHCPv6OptNewPOSIXTimezone: - return "NewPOSIXTimezone" - case DHCPv6OptNewTZDBTimezone: - return "NewTZDBTimezone" - case DHCPv6OptEchoRequestOption: - return "EchoRequest" - case DHCPv6OptLQQuery: - return "LeasequeryQuery" - case DHCPv6OptClientData: - return "LeasequeryClientData" - case DHCPv6OptCLTTime: - return "LeasequeryClientLastTransactionTime" - case DHCPv6OptLQRelayData: - return "LeasequeryRelayData" - case DHCPv6OptLQClientLink: - return "LeasequeryClientLink" - case DHCPv6OptMIP6HNIDF: - return "MIPv6HomeNetworkIDFQDN" - case DHCPv6OptMIP6VDINF: - return "MIPv6VisitedHomeNetworkInformation" - case DHCPv6OptMIP6IDINF: - return "MIPv6IdentifiedHomeNetworkInformation" - case DHCPv6OptMIP6UDINF: - return "MIPv6UnrestrictedHomeNetworkInformation" - case DHCPv6OptMIP6HNP: - return "MIPv6HomeNetworkPrefix" - case DHCPv6OptMIP6HAA: - return "MIPv6HomeAgentAddress" - case DHCPv6OptMIP6HAF: - return "MIPv6HomeAgentFQDN" - case DHCPv6OptV6LOST: - return "LoST Server" - case DHCPv6OptCAPWAPACV6: - return "CAPWAPAccessControllerV6" - case DHCPv6OptRelayID: - return "LeasequeryRelayID" - case DHCPv6OptIPv6AddressMoS: - return "MoSIPv6Address" - case DHCPv6OptIPv6FQDNMoS: - return "MoSDomainNameList" - case DHCPv6OptNTPServer: - return "NTPServer" - case DHCPv6OptV6AccessDomain: - return "AccessNetworkDomainName" - case DHCPv6OptSIPUACSList: - return "SIPUserAgentConfigurationServiceDomains" - case DHCPv6OptBootFileURL: - return "BootFileURL" - case DHCPv6OptBootFileParam: - return "BootFileParameters" - case DHCPv6OptClientArchType: - return "ClientSystemArchitectureType" - case DHCPv6OptNII: - return "ClientNetworkInterfaceIdentifier" - case DHCPv6OptGeolocation: - return "Geolocation" - case DHCPv6OptAFTRName: - return "AFTRName" - case DHCPv6OptERPLocalDomainName: - return "AFTRName" - case DHCPv6OptRSOO: - return "RSOOption" - case DHCPv6OptPDExclude: - return "PrefixExclude" - case DHCPv6OptVSS: - return "VirtualSubnetSelection" - case DHCPv6OptRDNSSSelection: - return "RDNSSSelection" - case DHCPv6OptKRBPrincipalName: - return "KerberosPrincipalName" - case DHCPv6OptKRBRealmName: - return "KerberosRealmName" - case DHCPv6OptKRBKDC: - return "KerberosKDC" - case DHCPv6OptClientLinkLayerAddress: - return "ClientLinkLayerAddress" - case DHCPv6OptLinkAddress: - return "LinkAddress" - case DHCPv6OptRADIUS: - return "RADIUS" - case DHCPv6OptSolMaxRt: - return "SolMaxRt" - case DHCPv6OptInfMaxRt: - return "InfMaxRt" - case DHCPv6OptAddrSel: - return "AddressSelection" - case DHCPv6OptAddrSelTable: - return "AddressSelectionTable" - case DHCPv6OptV6PCPServer: - return "PCPServer" - case DHCPv6OptDHCPv4Message: - return "DHCPv4Message" - case DHCPv6OptDHCPv4OverDHCPv6Server: - return "DHCP4o6ServerAddress" - case DHCPv6OptS46Rule: - return "S46Rule" - case DHCPv6OptS46BR: - return "S46BR" - case DHCPv6OptS46DMR: - return "S46DMR" - case DHCPv6OptS46V4V4Bind: - return "S46IPv4IPv6AddressBinding" - case DHCPv6OptS46PortParameters: - return "S46PortParameters" - case DHCPv6OptS46ContMAPE: - return "S46MAPEContainer" - case DHCPv6OptS46ContMAPT: - return "S46MAPTContainer" - case DHCPv6OptS46ContLW: - return "S46Lightweight4Over6Container" - case DHCPv6Opt4RD: - return "4RD" - case DHCPv6Opt4RDMapRule: - return "4RDMapRule" - case DHCPv6Opt4RDNonMapRule: - return "4RDNonMapRule" - case DHCPv6OptLQBaseTime: - return "LQBaseTime" - case DHCPv6OptLQStartTime: - return "LQStartTime" - case DHCPv6OptLQEndTime: - return "LQEndTime" - case DHCPv6OptCaptivePortal: - return "CaptivePortal" - case DHCPv6OptMPLParameters: - return "MPLParameterConfiguration" - case DHCPv6OptANIATT: - return "ANIAccessTechnologyType" - case DHCPv6OptANINetworkName: - return "ANINetworkName" - case DHCPv6OptANIAPName: - return "ANIAccessPointName" - case DHCPv6OptANIAPBSSID: - return "ANIAccessPointBSSID" - case DHCPv6OptANIOperatorID: - return "ANIOperatorIdentifier" - case DHCPv6OptANIOperatorRealm: - return "ANIOperatorRealm" - case DHCPv6OptS46Priority: - return "S64Priority" - case DHCPv6OptMUDURLV6: - return "ManufacturerUsageDescriptionURL" - case DHCPv6OptV6Prefix64: - return "V6Prefix64" - case DHCPv6OptFBindingStatus: - return "FailoverBindingStatus" - case DHCPv6OptFConnectFlags: - return "FailoverConnectFlags" - case DHCPv6OptFDNSRemovalInfo: - return "FailoverDNSRemovalInfo" - case DHCPv6OptFDNSHostName: - return "FailoverDNSHostName" - case DHCPv6OptFDNSZoneName: - return "FailoverDNSZoneName" - case DHCPv6OptFDNSFlags: - return "FailoverDNSFlags" - case DHCPv6OptFExpirationTime: - return "FailoverExpirationTime" - case DHCPv6OptFMaxUnacknowledgedBNDUPD: - return "FailoverMaxUnacknowledgedBNDUPDMessages" - case DHCPv6OptFMCLT: - return "FailoverMaximumClientLeadTime" - case DHCPv6OptFPartnerLifetime: - return "FailoverPartnerLifetime" - case DHCPv6OptFPartnerLifetimeSent: - return "FailoverPartnerLifetimeSent" - case DHCPv6OptFPartnerDownTime: - return "FailoverPartnerDownTime" - case DHCPv6OptFPartnerRawCltTime: - return "FailoverPartnerRawClientLeadTime" - case DHCPv6OptFProtocolVersion: - return "FailoverProtocolVersion" - case DHCPv6OptFKeepaliveTime: - return "FailoverKeepaliveTime" - case DHCPv6OptFReconfigureData: - return "FailoverReconfigureData" - case DHCPv6OptFRelationshipName: - return "FailoverRelationshipName" - case DHCPv6OptFServerFlags: - return "FailoverServerFlags" - case DHCPv6OptFServerState: - return "FailoverServerState" - case DHCPv6OptFStartTimeOfState: - return "FailoverStartTimeOfState" - case DHCPv6OptFStateExpirationTime: - return "FailoverStateExpirationTime" - case DHCPv6OptRelayPort: - return "RelayPort" - case DHCPv6OptV6ZeroTouchRedirect: - return "ZeroTouch" - case DHCPv6OptIPV6AddressANDSF: - return "ANDSFIPv6Address" - default: - return fmt.Sprintf("Unknown(%d)", uint16(o)) - } -} - -// DHCPv6Options is used to get nicely printed option lists which would normally -// be cut off after 5 options. -type DHCPv6Options []DHCPv6Option - -// String returns a string version of the options list. -func (o DHCPv6Options) String() string { - buf := &bytes.Buffer{} - buf.WriteByte('[') - for i, opt := range o { - buf.WriteString(opt.String()) - if i+1 != len(o) { - buf.WriteString(", ") - } - } - buf.WriteByte(']') - return buf.String() -} - -// DHCPv6Option rerpresents a DHCP option. -type DHCPv6Option struct { - Code DHCPv6Opt - Length uint16 - Data []byte -} - -// String returns a string version of a DHCP Option. -func (o DHCPv6Option) String() string { - switch o.Code { - case DHCPv6OptClientID, DHCPv6OptServerID: - duid, err := decodeDHCPv6DUID(o.Data) - if err != nil { - return fmt.Sprintf("Option(%s:INVALID)", o.Code) - } - return fmt.Sprintf("Option(%s:[%s])", o.Code, duid.String()) - case DHCPv6OptOro: - options := "" - for i := 0; i < int(o.Length); i += 2 { - if options != "" { - options += "," - } - option := DHCPv6Opt(binary.BigEndian.Uint16(o.Data[i : i+2])) - options += option.String() - } - return fmt.Sprintf("Option(%s:[%s])", o.Code, options) - default: - return fmt.Sprintf("Option(%s:%v)", o.Code, o.Data) - } -} - -// NewDHCPv6Option constructs a new DHCPv6Option with a given type and data. -func NewDHCPv6Option(code DHCPv6Opt, data []byte) DHCPv6Option { - o := DHCPv6Option{Code: code} - if data != nil { - o.Data = data - o.Length = uint16(len(data)) - } - - return o -} - -func (o *DHCPv6Option) encode(b []byte, opts gopacket.SerializeOptions) error { - binary.BigEndian.PutUint16(b[0:2], uint16(o.Code)) - if opts.FixLengths { - binary.BigEndian.PutUint16(b[2:4], uint16(len(o.Data))) - } else { - binary.BigEndian.PutUint16(b[2:4], o.Length) - } - copy(b[4:], o.Data) - - return nil -} - -func (o *DHCPv6Option) decode(data []byte) error { - if len(data) < 4 { - return errors.New("not enough data to decode") - } - o.Code = DHCPv6Opt(binary.BigEndian.Uint16(data[0:2])) - o.Length = binary.BigEndian.Uint16(data[2:4]) - if len(data) < 4+int(o.Length) { - return fmt.Errorf("dhcpv6 option size < length %d", 4+o.Length) - } - o.Data = data[4 : 4+o.Length] - return nil -} diff --git a/vendor/github.com/google/gopacket/layers/dns.go b/vendor/github.com/google/gopacket/layers/dns.go deleted file mode 100644 index de55294b5..000000000 --- a/vendor/github.com/google/gopacket/layers/dns.go +++ /dev/null @@ -1,1098 +0,0 @@ -// Copyright 2014, 2018 GoPacket Authors. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - "fmt" - "net" - "strings" - - "github.com/google/gopacket" -) - -// DNSClass defines the class associated with a request/response. Different DNS -// classes can be thought of as an array of parallel namespace trees. -type DNSClass uint16 - -// DNSClass known values. -const ( - DNSClassIN DNSClass = 1 // Internet - DNSClassCS DNSClass = 2 // the CSNET class (Obsolete) - DNSClassCH DNSClass = 3 // the CHAOS class - DNSClassHS DNSClass = 4 // Hesiod [Dyer 87] - DNSClassAny DNSClass = 255 // AnyClass -) - -func (dc DNSClass) String() string { - switch dc { - default: - return "Unknown" - case DNSClassIN: - return "IN" - case DNSClassCS: - return "CS" - case DNSClassCH: - return "CH" - case DNSClassHS: - return "HS" - case DNSClassAny: - return "Any" - } -} - -// DNSType defines the type of data being requested/returned in a -// question/answer. -type DNSType uint16 - -// DNSType known values. -const ( - DNSTypeA DNSType = 1 // a host address - DNSTypeNS DNSType = 2 // an authoritative name server - DNSTypeMD DNSType = 3 // a mail destination (Obsolete - use MX) - DNSTypeMF DNSType = 4 // a mail forwarder (Obsolete - use MX) - DNSTypeCNAME DNSType = 5 // the canonical name for an alias - DNSTypeSOA DNSType = 6 // marks the start of a zone of authority - DNSTypeMB DNSType = 7 // a mailbox domain name (EXPERIMENTAL) - DNSTypeMG DNSType = 8 // a mail group member (EXPERIMENTAL) - DNSTypeMR DNSType = 9 // a mail rename domain name (EXPERIMENTAL) - DNSTypeNULL DNSType = 10 // a null RR (EXPERIMENTAL) - DNSTypeWKS DNSType = 11 // a well known service description - DNSTypePTR DNSType = 12 // a domain name pointer - DNSTypeHINFO DNSType = 13 // host information - DNSTypeMINFO DNSType = 14 // mailbox or mail list information - DNSTypeMX DNSType = 15 // mail exchange - DNSTypeTXT DNSType = 16 // text strings - DNSTypeAAAA DNSType = 28 // a IPv6 host address [RFC3596] - DNSTypeSRV DNSType = 33 // server discovery [RFC2782] [RFC6195] - DNSTypeOPT DNSType = 41 // OPT Pseudo-RR [RFC6891] - DNSTypeURI DNSType = 256 // URI RR [RFC7553] -) - -func (dt DNSType) String() string { - switch dt { - default: - return "Unknown" - case DNSTypeA: - return "A" - case DNSTypeNS: - return "NS" - case DNSTypeMD: - return "MD" - case DNSTypeMF: - return "MF" - case DNSTypeCNAME: - return "CNAME" - case DNSTypeSOA: - return "SOA" - case DNSTypeMB: - return "MB" - case DNSTypeMG: - return "MG" - case DNSTypeMR: - return "MR" - case DNSTypeNULL: - return "NULL" - case DNSTypeWKS: - return "WKS" - case DNSTypePTR: - return "PTR" - case DNSTypeHINFO: - return "HINFO" - case DNSTypeMINFO: - return "MINFO" - case DNSTypeMX: - return "MX" - case DNSTypeTXT: - return "TXT" - case DNSTypeAAAA: - return "AAAA" - case DNSTypeSRV: - return "SRV" - case DNSTypeOPT: - return "OPT" - case DNSTypeURI: - return "URI" - } -} - -// DNSResponseCode provides response codes for question answers. -type DNSResponseCode uint8 - -// DNSResponseCode known values. -const ( - DNSResponseCodeNoErr DNSResponseCode = 0 // No error - DNSResponseCodeFormErr DNSResponseCode = 1 // Format Error [RFC1035] - DNSResponseCodeServFail DNSResponseCode = 2 // Server Failure [RFC1035] - DNSResponseCodeNXDomain DNSResponseCode = 3 // Non-Existent Domain [RFC1035] - DNSResponseCodeNotImp DNSResponseCode = 4 // Not Implemented [RFC1035] - DNSResponseCodeRefused DNSResponseCode = 5 // Query Refused [RFC1035] - DNSResponseCodeYXDomain DNSResponseCode = 6 // Name Exists when it should not [RFC2136] - DNSResponseCodeYXRRSet DNSResponseCode = 7 // RR Set Exists when it should not [RFC2136] - DNSResponseCodeNXRRSet DNSResponseCode = 8 // RR Set that should exist does not [RFC2136] - DNSResponseCodeNotAuth DNSResponseCode = 9 // Server Not Authoritative for zone [RFC2136] - DNSResponseCodeNotZone DNSResponseCode = 10 // Name not contained in zone [RFC2136] - DNSResponseCodeBadVers DNSResponseCode = 16 // Bad OPT Version [RFC2671] - DNSResponseCodeBadSig DNSResponseCode = 16 // TSIG Signature Failure [RFC2845] - DNSResponseCodeBadKey DNSResponseCode = 17 // Key not recognized [RFC2845] - DNSResponseCodeBadTime DNSResponseCode = 18 // Signature out of time window [RFC2845] - DNSResponseCodeBadMode DNSResponseCode = 19 // Bad TKEY Mode [RFC2930] - DNSResponseCodeBadName DNSResponseCode = 20 // Duplicate key name [RFC2930] - DNSResponseCodeBadAlg DNSResponseCode = 21 // Algorithm not supported [RFC2930] - DNSResponseCodeBadTruc DNSResponseCode = 22 // Bad Truncation [RFC4635] - DNSResponseCodeBadCookie DNSResponseCode = 23 // Bad/missing Server Cookie [RFC7873] -) - -func (drc DNSResponseCode) String() string { - switch drc { - default: - return "Unknown" - case DNSResponseCodeNoErr: - return "No Error" - case DNSResponseCodeFormErr: - return "Format Error" - case DNSResponseCodeServFail: - return "Server Failure " - case DNSResponseCodeNXDomain: - return "Non-Existent Domain" - case DNSResponseCodeNotImp: - return "Not Implemented" - case DNSResponseCodeRefused: - return "Query Refused" - case DNSResponseCodeYXDomain: - return "Name Exists when it should not" - case DNSResponseCodeYXRRSet: - return "RR Set Exists when it should not" - case DNSResponseCodeNXRRSet: - return "RR Set that should exist does not" - case DNSResponseCodeNotAuth: - return "Server Not Authoritative for zone" - case DNSResponseCodeNotZone: - return "Name not contained in zone" - case DNSResponseCodeBadVers: - return "Bad OPT Version" - case DNSResponseCodeBadKey: - return "Key not recognized" - case DNSResponseCodeBadTime: - return "Signature out of time window" - case DNSResponseCodeBadMode: - return "Bad TKEY Mode" - case DNSResponseCodeBadName: - return "Duplicate key name" - case DNSResponseCodeBadAlg: - return "Algorithm not supported" - case DNSResponseCodeBadTruc: - return "Bad Truncation" - case DNSResponseCodeBadCookie: - return "Bad Cookie" - } -} - -// DNSOpCode defines a set of different operation types. -type DNSOpCode uint8 - -// DNSOpCode known values. -const ( - DNSOpCodeQuery DNSOpCode = 0 // Query [RFC1035] - DNSOpCodeIQuery DNSOpCode = 1 // Inverse Query Obsolete [RFC3425] - DNSOpCodeStatus DNSOpCode = 2 // Status [RFC1035] - DNSOpCodeNotify DNSOpCode = 4 // Notify [RFC1996] - DNSOpCodeUpdate DNSOpCode = 5 // Update [RFC2136] -) - -func (doc DNSOpCode) String() string { - switch doc { - default: - return "Unknown" - case DNSOpCodeQuery: - return "Query" - case DNSOpCodeIQuery: - return "Inverse Query" - case DNSOpCodeStatus: - return "Status" - case DNSOpCodeNotify: - return "Notify" - case DNSOpCodeUpdate: - return "Update" - } -} - -// DNS is specified in RFC 1034 / RFC 1035 -// +---------------------+ -// | Header | -// +---------------------+ -// | Question | the question for the name server -// +---------------------+ -// | Answer | RRs answering the question -// +---------------------+ -// | Authority | RRs pointing toward an authority -// +---------------------+ -// | Additional | RRs holding additional information -// +---------------------+ -// -// DNS Header -// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | ID | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// |QR| Opcode |AA|TC|RD|RA| Z | RCODE | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | QDCOUNT | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | ANCOUNT | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | NSCOUNT | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | ARCOUNT | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - -// DNS contains data from a single Domain Name Service packet. -type DNS struct { - BaseLayer - - // Header fields - ID uint16 - QR bool - OpCode DNSOpCode - - AA bool // Authoritative answer - TC bool // Truncated - RD bool // Recursion desired - RA bool // Recursion available - Z uint8 // Reserved for future use - - ResponseCode DNSResponseCode - QDCount uint16 // Number of questions to expect - ANCount uint16 // Number of answers to expect - NSCount uint16 // Number of authorities to expect - ARCount uint16 // Number of additional records to expect - - // Entries - Questions []DNSQuestion - Answers []DNSResourceRecord - Authorities []DNSResourceRecord - Additionals []DNSResourceRecord - - // buffer for doing name decoding. We use a single reusable buffer to avoid - // name decoding on a single object via multiple DecodeFromBytes calls - // requiring constant allocation of small byte slices. - buffer []byte -} - -// LayerType returns gopacket.LayerTypeDNS. -func (d *DNS) LayerType() gopacket.LayerType { return LayerTypeDNS } - -// decodeDNS decodes the byte slice into a DNS type. It also -// setups the application Layer in PacketBuilder. -func decodeDNS(data []byte, p gopacket.PacketBuilder) error { - d := &DNS{} - err := d.DecodeFromBytes(data, p) - if err != nil { - return err - } - p.AddLayer(d) - p.SetApplicationLayer(d) - return nil -} - -// DecodeFromBytes decodes the slice into the DNS struct. -func (d *DNS) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - d.buffer = d.buffer[:0] - - if len(data) < 12 { - df.SetTruncated() - return errDNSPacketTooShort - } - - // since there are no further layers, the baselayer's content is - // pointing to this layer - d.BaseLayer = BaseLayer{Contents: data[:len(data)]} - d.ID = binary.BigEndian.Uint16(data[:2]) - d.QR = data[2]&0x80 != 0 - d.OpCode = DNSOpCode(data[2]>>3) & 0x0F - d.AA = data[2]&0x04 != 0 - d.TC = data[2]&0x02 != 0 - d.RD = data[2]&0x01 != 0 - d.RA = data[3]&0x80 != 0 - d.Z = uint8(data[3]>>4) & 0x7 - d.ResponseCode = DNSResponseCode(data[3] & 0xF) - d.QDCount = binary.BigEndian.Uint16(data[4:6]) - d.ANCount = binary.BigEndian.Uint16(data[6:8]) - d.NSCount = binary.BigEndian.Uint16(data[8:10]) - d.ARCount = binary.BigEndian.Uint16(data[10:12]) - - d.Questions = d.Questions[:0] - d.Answers = d.Answers[:0] - d.Authorities = d.Authorities[:0] - d.Additionals = d.Additionals[:0] - - offset := 12 - var err error - for i := 0; i < int(d.QDCount); i++ { - var q DNSQuestion - if offset, err = q.decode(data, offset, df, &d.buffer); err != nil { - return err - } - d.Questions = append(d.Questions, q) - } - - // For some horrible reason, if we do the obvious thing in this loop: - // var r DNSResourceRecord - // if blah := r.decode(blah); err != nil { - // return err - // } - // d.Foo = append(d.Foo, r) - // the Go compiler thinks that 'r' escapes to the heap, causing a malloc for - // every Answer, Authority, and Additional. To get around this, we do - // something really silly: we append an empty resource record to our slice, - // then use the last value in the slice to call decode. Since the value is - // already in the slice, there's no WAY it can escape... on the other hand our - // code is MUCH uglier :( - for i := 0; i < int(d.ANCount); i++ { - d.Answers = append(d.Answers, DNSResourceRecord{}) - if offset, err = d.Answers[i].decode(data, offset, df, &d.buffer); err != nil { - d.Answers = d.Answers[:i] // strip off erroneous value - return err - } - } - for i := 0; i < int(d.NSCount); i++ { - d.Authorities = append(d.Authorities, DNSResourceRecord{}) - if offset, err = d.Authorities[i].decode(data, offset, df, &d.buffer); err != nil { - d.Authorities = d.Authorities[:i] // strip off erroneous value - return err - } - } - for i := 0; i < int(d.ARCount); i++ { - d.Additionals = append(d.Additionals, DNSResourceRecord{}) - if offset, err = d.Additionals[i].decode(data, offset, df, &d.buffer); err != nil { - d.Additionals = d.Additionals[:i] // strip off erroneous value - return err - } - // extract extended RCODE from OPT RRs, RFC 6891 section 6.1.3 - if d.Additionals[i].Type == DNSTypeOPT { - d.ResponseCode = DNSResponseCode(uint8(d.ResponseCode) | uint8(d.Additionals[i].TTL>>20&0xF0)) - } - } - - if uint16(len(d.Questions)) != d.QDCount { - return errDecodeQueryBadQDCount - } else if uint16(len(d.Answers)) != d.ANCount { - return errDecodeQueryBadANCount - } else if uint16(len(d.Authorities)) != d.NSCount { - return errDecodeQueryBadNSCount - } else if uint16(len(d.Additionals)) != d.ARCount { - return errDecodeQueryBadARCount - } - return nil -} - -// CanDecode implements gopacket.DecodingLayer. -func (d *DNS) CanDecode() gopacket.LayerClass { - return LayerTypeDNS -} - -// NextLayerType implements gopacket.DecodingLayer. -func (d *DNS) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypePayload -} - -// Payload returns nil. -func (d *DNS) Payload() []byte { - return nil -} - -func b2i(b bool) int { - if b { - return 1 - } - return 0 -} - -func recSize(rr *DNSResourceRecord) int { - switch rr.Type { - case DNSTypeA: - return 4 - case DNSTypeAAAA: - return 16 - case DNSTypeNS: - return len(rr.NS) + 2 - case DNSTypeCNAME: - return len(rr.CNAME) + 2 - case DNSTypePTR: - return len(rr.PTR) + 2 - case DNSTypeSOA: - return len(rr.SOA.MName) + 2 + len(rr.SOA.RName) + 2 + 20 - case DNSTypeMX: - return 2 + len(rr.MX.Name) + 2 - case DNSTypeTXT: - l := len(rr.TXTs) - for _, txt := range rr.TXTs { - l += len(txt) - } - return l - case DNSTypeSRV: - return 6 + len(rr.SRV.Name) + 2 - case DNSTypeURI: - return 4 + len(rr.URI.Target) - case DNSTypeOPT: - l := len(rr.OPT) * 4 - for _, opt := range rr.OPT { - l += len(opt.Data) - } - return l - } - - return 0 -} - -func computeSize(recs []DNSResourceRecord) int { - sz := 0 - for _, rr := range recs { - v := len(rr.Name) - - if v == 0 { - sz += v + 11 - } else { - sz += v + 12 - } - - sz += recSize(&rr) - } - return sz -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -func (d *DNS) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - dsz := 0 - for _, q := range d.Questions { - dsz += len(q.Name) + 6 - } - dsz += computeSize(d.Answers) - dsz += computeSize(d.Authorities) - dsz += computeSize(d.Additionals) - - bytes, err := b.PrependBytes(12 + dsz) - if err != nil { - return err - } - binary.BigEndian.PutUint16(bytes, d.ID) - bytes[2] = byte((b2i(d.QR) << 7) | (int(d.OpCode) << 3) | (b2i(d.AA) << 2) | (b2i(d.TC) << 1) | b2i(d.RD)) - bytes[3] = byte((b2i(d.RA) << 7) | (int(d.Z) << 4) | int(d.ResponseCode)) - - if opts.FixLengths { - d.QDCount = uint16(len(d.Questions)) - d.ANCount = uint16(len(d.Answers)) - d.NSCount = uint16(len(d.Authorities)) - d.ARCount = uint16(len(d.Additionals)) - } - binary.BigEndian.PutUint16(bytes[4:], d.QDCount) - binary.BigEndian.PutUint16(bytes[6:], d.ANCount) - binary.BigEndian.PutUint16(bytes[8:], d.NSCount) - binary.BigEndian.PutUint16(bytes[10:], d.ARCount) - - off := 12 - for _, qd := range d.Questions { - n := qd.encode(bytes, off) - off += n - } - - for i := range d.Answers { - // done this way so we can modify DNSResourceRecord to fix - // lengths if requested - qa := &d.Answers[i] - n, err := qa.encode(bytes, off, opts) - if err != nil { - return err - } - off += n - } - - for i := range d.Authorities { - qa := &d.Authorities[i] - n, err := qa.encode(bytes, off, opts) - if err != nil { - return err - } - off += n - } - for i := range d.Additionals { - qa := &d.Additionals[i] - n, err := qa.encode(bytes, off, opts) - if err != nil { - return err - } - off += n - } - - return nil -} - -const maxRecursionLevel = 255 - -func decodeName(data []byte, offset int, buffer *[]byte, level int) ([]byte, int, error) { - if level > maxRecursionLevel { - return nil, 0, errMaxRecursion - } else if offset >= len(data) { - return nil, 0, errDNSNameOffsetTooHigh - } else if offset < 0 { - return nil, 0, errDNSNameOffsetNegative - } - start := len(*buffer) - index := offset - if data[index] == 0x00 { - return nil, index + 1, nil - } -loop: - for data[index] != 0x00 { - switch data[index] & 0xc0 { - default: - /* RFC 1035 - A domain name represented as a sequence of labels, where - each label consists of a length octet followed by that - number of octets. The domain name terminates with the - zero length octet for the null label of the root. Note - that this field may be an odd number of octets; no - padding is used. - */ - index2 := index + int(data[index]) + 1 - if index2-offset > 255 { - return nil, 0, errDNSNameTooLong - } else if index2 < index+1 || index2 > len(data) { - return nil, 0, errDNSNameInvalidIndex - } - *buffer = append(*buffer, '.') - *buffer = append(*buffer, data[index+1:index2]...) - index = index2 - - case 0xc0: - /* RFC 1035 - The pointer takes the form of a two octet sequence. - - The first two bits are ones. This allows a pointer to - be distinguished from a label, since the label must - begin with two zero bits because labels are restricted - to 63 octets or less. (The 10 and 01 combinations are - reserved for future use.) The OFFSET field specifies - an offset from the start of the message (i.e., the - first octet of the ID field in the domain header). A - zero offset specifies the first byte of the ID field, - etc. - - The compression scheme allows a domain name in a message to be - represented as either: - - a sequence of labels ending in a zero octet - - a pointer - - a sequence of labels ending with a pointer - */ - if index+2 > len(data) { - return nil, 0, errDNSPointerOffsetTooHigh - } - offsetp := int(binary.BigEndian.Uint16(data[index:index+2]) & 0x3fff) - if offsetp > len(data) { - return nil, 0, errDNSPointerOffsetTooHigh - } - // This looks a little tricky, but actually isn't. Because of how - // decodeName is written, calling it appends the decoded name to the - // current buffer. We already have the start of the buffer, then, so - // once this call is done buffer[start:] will contain our full name. - _, _, err := decodeName(data, offsetp, buffer, level+1) - if err != nil { - return nil, 0, err - } - index++ // pointer is two bytes, so add an extra byte here. - break loop - /* EDNS, or other DNS option ? */ - case 0x40: // RFC 2673 - return nil, 0, fmt.Errorf("qname '0x40' - RFC 2673 unsupported yet (data=%x index=%d)", - data[index], index) - - case 0x80: - return nil, 0, fmt.Errorf("qname '0x80' unsupported yet (data=%x index=%d)", - data[index], index) - } - if index >= len(data) { - return nil, 0, errDNSIndexOutOfRange - } - } - if len(*buffer) <= start { - return (*buffer)[start:], index + 1, nil - } - return (*buffer)[start+1:], index + 1, nil -} - -// DNSQuestion wraps a single request (question) within a DNS query. -type DNSQuestion struct { - Name []byte - Type DNSType - Class DNSClass -} - -func (q *DNSQuestion) decode(data []byte, offset int, df gopacket.DecodeFeedback, buffer *[]byte) (int, error) { - name, endq, err := decodeName(data, offset, buffer, 1) - if err != nil { - return 0, err - } - - q.Name = name - q.Type = DNSType(binary.BigEndian.Uint16(data[endq : endq+2])) - q.Class = DNSClass(binary.BigEndian.Uint16(data[endq+2 : endq+4])) - - return endq + 4, nil -} - -func (q *DNSQuestion) encode(data []byte, offset int) int { - noff := encodeName(q.Name, data, offset) - nSz := noff - offset - binary.BigEndian.PutUint16(data[noff:], uint16(q.Type)) - binary.BigEndian.PutUint16(data[noff+2:], uint16(q.Class)) - return nSz + 4 -} - -// DNSResourceRecord -// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | | -// / / -// / NAME / -// | | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | TYPE | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | CLASS | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | TTL | -// | | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | RDLENGTH | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| -// / RDATA / -// / / -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - -// DNSResourceRecord wraps the data from a single DNS resource within a -// response. -type DNSResourceRecord struct { - // Header - Name []byte - Type DNSType - Class DNSClass - TTL uint32 - - // RDATA Raw Values - DataLength uint16 - Data []byte - - // RDATA Decoded Values - IP net.IP - NS, CNAME, PTR []byte - TXTs [][]byte - SOA DNSSOA - SRV DNSSRV - MX DNSMX - OPT []DNSOPT // See RFC 6891, section 6.1.2 - URI DNSURI - - // Undecoded TXT for backward compatibility - TXT []byte -} - -// decode decodes the resource record, returning the total length of the record. -func (rr *DNSResourceRecord) decode(data []byte, offset int, df gopacket.DecodeFeedback, buffer *[]byte) (int, error) { - name, endq, err := decodeName(data, offset, buffer, 1) - if err != nil { - return 0, err - } - - rr.Name = name - rr.Type = DNSType(binary.BigEndian.Uint16(data[endq : endq+2])) - rr.Class = DNSClass(binary.BigEndian.Uint16(data[endq+2 : endq+4])) - rr.TTL = binary.BigEndian.Uint32(data[endq+4 : endq+8]) - rr.DataLength = binary.BigEndian.Uint16(data[endq+8 : endq+10]) - end := endq + 10 + int(rr.DataLength) - if end > len(data) { - return 0, errDecodeRecordLength - } - rr.Data = data[endq+10 : end] - - if err = rr.decodeRData(data[:end], endq+10, buffer); err != nil { - return 0, err - } - - return endq + 10 + int(rr.DataLength), nil -} - -func encodeName(name []byte, data []byte, offset int) int { - l := 0 - for i := range name { - if name[i] == '.' { - data[offset+i-l] = byte(l) - l = 0 - } else { - // skip one to write the length - data[offset+i+1] = name[i] - l++ - } - } - - if len(name) == 0 { - data[offset] = 0x00 // terminal - return offset + 1 - } - - // length for final portion - data[offset+len(name)-l] = byte(l) - data[offset+len(name)+1] = 0x00 // terminal - return offset + len(name) + 2 -} - -func (rr *DNSResourceRecord) encode(data []byte, offset int, opts gopacket.SerializeOptions) (int, error) { - - noff := encodeName(rr.Name, data, offset) - nSz := noff - offset - - binary.BigEndian.PutUint16(data[noff:], uint16(rr.Type)) - binary.BigEndian.PutUint16(data[noff+2:], uint16(rr.Class)) - binary.BigEndian.PutUint32(data[noff+4:], uint32(rr.TTL)) - - switch rr.Type { - case DNSTypeA: - copy(data[noff+10:], rr.IP.To4()) - case DNSTypeAAAA: - copy(data[noff+10:], rr.IP) - case DNSTypeNS: - encodeName(rr.NS, data, noff+10) - case DNSTypeCNAME: - encodeName(rr.CNAME, data, noff+10) - case DNSTypePTR: - encodeName(rr.PTR, data, noff+10) - case DNSTypeSOA: - noff2 := encodeName(rr.SOA.MName, data, noff+10) - noff2 = encodeName(rr.SOA.RName, data, noff2) - binary.BigEndian.PutUint32(data[noff2:], rr.SOA.Serial) - binary.BigEndian.PutUint32(data[noff2+4:], rr.SOA.Refresh) - binary.BigEndian.PutUint32(data[noff2+8:], rr.SOA.Retry) - binary.BigEndian.PutUint32(data[noff2+12:], rr.SOA.Expire) - binary.BigEndian.PutUint32(data[noff2+16:], rr.SOA.Minimum) - case DNSTypeMX: - binary.BigEndian.PutUint16(data[noff+10:], rr.MX.Preference) - encodeName(rr.MX.Name, data, noff+12) - case DNSTypeTXT: - noff2 := noff + 10 - for _, txt := range rr.TXTs { - data[noff2] = byte(len(txt)) - copy(data[noff2+1:], txt) - noff2 += 1 + len(txt) - } - case DNSTypeSRV: - binary.BigEndian.PutUint16(data[noff+10:], rr.SRV.Priority) - binary.BigEndian.PutUint16(data[noff+12:], rr.SRV.Weight) - binary.BigEndian.PutUint16(data[noff+14:], rr.SRV.Port) - encodeName(rr.SRV.Name, data, noff+16) - case DNSTypeURI: - binary.BigEndian.PutUint16(data[noff+10:], rr.URI.Priority) - binary.BigEndian.PutUint16(data[noff+12:], rr.URI.Weight) - copy(data[noff+14:], rr.URI.Target) - case DNSTypeOPT: - noff2 := noff + 10 - for _, opt := range rr.OPT { - binary.BigEndian.PutUint16(data[noff2:], uint16(opt.Code)) - binary.BigEndian.PutUint16(data[noff2+2:], uint16(len(opt.Data))) - copy(data[noff2+4:], opt.Data) - noff2 += 4 + len(opt.Data) - } - default: - return 0, fmt.Errorf("serializing resource record of type %v not supported", rr.Type) - } - - // DataLength - dSz := recSize(rr) - binary.BigEndian.PutUint16(data[noff+8:], uint16(dSz)) - - if opts.FixLengths { - rr.DataLength = uint16(dSz) - } - - return nSz + 10 + dSz, nil -} - -func (rr *DNSResourceRecord) String() string { - - if rr.Type == DNSTypeOPT { - opts := make([]string, len(rr.OPT)) - for i, opt := range rr.OPT { - opts[i] = opt.String() - } - return "OPT " + strings.Join(opts, ",") - } - if rr.Type == DNSTypeURI { - return fmt.Sprintf("URI %d %d %s", rr.URI.Priority, rr.URI.Weight, string(rr.URI.Target)) - } - if rr.Class == DNSClassIN { - switch rr.Type { - case DNSTypeA, DNSTypeAAAA: - return rr.IP.String() - case DNSTypeNS: - return "NS " + string(rr.NS) - case DNSTypeCNAME: - return "CNAME " + string(rr.CNAME) - case DNSTypePTR: - return "PTR " + string(rr.PTR) - case DNSTypeTXT: - return "TXT " + string(rr.TXT) - } - } - - return fmt.Sprintf("<%v, %v>", rr.Class, rr.Type) -} - -func decodeCharacterStrings(data []byte) ([][]byte, error) { - strings := make([][]byte, 0, 1) - end := len(data) - for index, index2 := 0, 0; index != end; index = index2 { - index2 = index + 1 + int(data[index]) // index increases by 1..256 and does not overflow - if index2 > end { - return nil, errCharStringMissData - } - strings = append(strings, data[index+1:index2]) - } - return strings, nil -} - -func decodeOPTs(data []byte, offset int) ([]DNSOPT, error) { - allOPT := []DNSOPT{} - end := len(data) - - if offset == end { - return allOPT, nil // There is no data to read - } - - if offset+4 > end { - return allOPT, fmt.Errorf("DNSOPT record is of length %d, it should be at least length 4", end-offset) - } - - for i := offset; i < end; { - opt := DNSOPT{} - if len(data) < i+4 { - return allOPT, fmt.Errorf("Malformed DNSOPT record. Length %d < %d", len(data), i+4) - } - opt.Code = DNSOptionCode(binary.BigEndian.Uint16(data[i : i+2])) - l := binary.BigEndian.Uint16(data[i+2 : i+4]) - if i+4+int(l) > end { - return allOPT, fmt.Errorf("Malformed DNSOPT record. The length (%d) field implies a packet larger than the one received", l) - } - opt.Data = data[i+4 : i+4+int(l)] - allOPT = append(allOPT, opt) - i += int(l) + 4 - } - return allOPT, nil -} - -func (rr *DNSResourceRecord) decodeRData(data []byte, offset int, buffer *[]byte) error { - switch rr.Type { - case DNSTypeA: - rr.IP = rr.Data - case DNSTypeAAAA: - rr.IP = rr.Data - case DNSTypeTXT, DNSTypeHINFO: - rr.TXT = rr.Data - txts, err := decodeCharacterStrings(rr.Data) - if err != nil { - return err - } - rr.TXTs = txts - case DNSTypeNS: - name, _, err := decodeName(data, offset, buffer, 1) - if err != nil { - return err - } - rr.NS = name - case DNSTypeCNAME: - name, _, err := decodeName(data, offset, buffer, 1) - if err != nil { - return err - } - rr.CNAME = name - case DNSTypePTR: - name, _, err := decodeName(data, offset, buffer, 1) - if err != nil { - return err - } - rr.PTR = name - case DNSTypeSOA: - name, endq, err := decodeName(data, offset, buffer, 1) - if err != nil { - return err - } - rr.SOA.MName = name - name, endq, err = decodeName(data, endq, buffer, 1) - if err != nil { - return err - } - if len(data) < endq+20 { - return errors.New("SOA too small") - } - rr.SOA.RName = name - rr.SOA.Serial = binary.BigEndian.Uint32(data[endq : endq+4]) - rr.SOA.Refresh = binary.BigEndian.Uint32(data[endq+4 : endq+8]) - rr.SOA.Retry = binary.BigEndian.Uint32(data[endq+8 : endq+12]) - rr.SOA.Expire = binary.BigEndian.Uint32(data[endq+12 : endq+16]) - rr.SOA.Minimum = binary.BigEndian.Uint32(data[endq+16 : endq+20]) - case DNSTypeMX: - if len(data) < offset+2 { - return errors.New("MX too small") - } - rr.MX.Preference = binary.BigEndian.Uint16(data[offset : offset+2]) - name, _, err := decodeName(data, offset+2, buffer, 1) - if err != nil { - return err - } - rr.MX.Name = name - case DNSTypeURI: - if len(rr.Data) < 4 { - return errors.New("URI too small") - } - rr.URI.Priority = binary.BigEndian.Uint16(data[offset : offset+2]) - rr.URI.Weight = binary.BigEndian.Uint16(data[offset+2 : offset+4]) - rr.URI.Target = rr.Data[4:] - case DNSTypeSRV: - if len(data) < offset+6 { - return errors.New("SRV too small") - } - rr.SRV.Priority = binary.BigEndian.Uint16(data[offset : offset+2]) - rr.SRV.Weight = binary.BigEndian.Uint16(data[offset+2 : offset+4]) - rr.SRV.Port = binary.BigEndian.Uint16(data[offset+4 : offset+6]) - name, _, err := decodeName(data, offset+6, buffer, 1) - if err != nil { - return err - } - rr.SRV.Name = name - case DNSTypeOPT: - allOPT, err := decodeOPTs(data, offset) - if err != nil { - return err - } - rr.OPT = allOPT - } - return nil -} - -// DNSSOA is a Start of Authority record. Each domain requires a SOA record at -// the cutover where a domain is delegated from its parent. -type DNSSOA struct { - MName, RName []byte - Serial, Refresh, Retry, Expire, Minimum uint32 -} - -// DNSSRV is a Service record, defining a location (hostname/port) of a -// server/service. -type DNSSRV struct { - Priority, Weight, Port uint16 - Name []byte -} - -// DNSMX is a mail exchange record, defining a mail server for a recipient's -// domain. -type DNSMX struct { - Preference uint16 - Name []byte -} - -// DNSURI is a URI record, defining a target (URI) of a server/service -type DNSURI struct { - Priority, Weight uint16 - Target []byte -} - -// DNSOptionCode represents the code of a DNS Option, see RFC6891, section 6.1.2 -type DNSOptionCode uint16 - -func (doc DNSOptionCode) String() string { - switch doc { - default: - return "Unknown" - case DNSOptionCodeNSID: - return "NSID" - case DNSOptionCodeDAU: - return "DAU" - case DNSOptionCodeDHU: - return "DHU" - case DNSOptionCodeN3U: - return "N3U" - case DNSOptionCodeEDNSClientSubnet: - return "EDNSClientSubnet" - case DNSOptionCodeEDNSExpire: - return "EDNSExpire" - case DNSOptionCodeCookie: - return "Cookie" - case DNSOptionCodeEDNSKeepAlive: - return "EDNSKeepAlive" - case DNSOptionCodePadding: - return "CodePadding" - case DNSOptionCodeChain: - return "CodeChain" - case DNSOptionCodeEDNSKeyTag: - return "CodeEDNSKeyTag" - case DNSOptionCodeEDNSClientTag: - return "EDNSClientTag" - case DNSOptionCodeEDNSServerTag: - return "EDNSServerTag" - case DNSOptionCodeDeviceID: - return "DeviceID" - } -} - -// DNSOptionCode known values. See IANA -const ( - DNSOptionCodeNSID DNSOptionCode = 3 - DNSOptionCodeDAU DNSOptionCode = 5 - DNSOptionCodeDHU DNSOptionCode = 6 - DNSOptionCodeN3U DNSOptionCode = 7 - DNSOptionCodeEDNSClientSubnet DNSOptionCode = 8 - DNSOptionCodeEDNSExpire DNSOptionCode = 9 - DNSOptionCodeCookie DNSOptionCode = 10 - DNSOptionCodeEDNSKeepAlive DNSOptionCode = 11 - DNSOptionCodePadding DNSOptionCode = 12 - DNSOptionCodeChain DNSOptionCode = 13 - DNSOptionCodeEDNSKeyTag DNSOptionCode = 14 - DNSOptionCodeEDNSClientTag DNSOptionCode = 16 - DNSOptionCodeEDNSServerTag DNSOptionCode = 17 - DNSOptionCodeDeviceID DNSOptionCode = 26946 -) - -// DNSOPT is a DNS Option, see RFC6891, section 6.1.2 -type DNSOPT struct { - Code DNSOptionCode - Data []byte -} - -func (opt DNSOPT) String() string { - return fmt.Sprintf("%s=%x", opt.Code, opt.Data) -} - -var ( - errMaxRecursion = errors.New("max DNS recursion level hit") - - errDNSNameOffsetTooHigh = errors.New("dns name offset too high") - errDNSNameOffsetNegative = errors.New("dns name offset is negative") - errDNSPacketTooShort = errors.New("DNS packet too short") - errDNSNameTooLong = errors.New("dns name is too long") - errDNSNameInvalidIndex = errors.New("dns name uncomputable: invalid index") - errDNSPointerOffsetTooHigh = errors.New("dns offset pointer too high") - errDNSIndexOutOfRange = errors.New("dns index walked out of range") - errDNSNameHasNoData = errors.New("no dns data found for name") - - errCharStringMissData = errors.New("Insufficient data for a ") - - errDecodeRecordLength = errors.New("resource record length exceeds data") - - errDecodeQueryBadQDCount = errors.New("Invalid query decoding, not the right number of questions") - errDecodeQueryBadANCount = errors.New("Invalid query decoding, not the right number of answers") - errDecodeQueryBadNSCount = errors.New("Invalid query decoding, not the right number of authorities") - errDecodeQueryBadARCount = errors.New("Invalid query decoding, not the right number of additionals info") -) diff --git a/vendor/github.com/google/gopacket/layers/doc.go b/vendor/github.com/google/gopacket/layers/doc.go deleted file mode 100644 index 3c882c3fa..000000000 --- a/vendor/github.com/google/gopacket/layers/doc.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -/* -Package layers provides decoding layers for many common protocols. - -The layers package contains decode implementations for a number of different -types of packet layers. Users of gopacket will almost always want to also use -layers to actually decode packet data into useful pieces. To see the set of -protocols that gopacket/layers is currently able to decode, -look at the set of LayerTypes defined in the Variables sections. The -layers package also defines endpoints for many of the common packet layers -that have source/destination addresses associated with them, for example IPv4/6 -(IPs) and TCP/UDP (ports). -Finally, layers contains a number of useful enumerations (IPProtocol, -EthernetType, LinkType, PPPType, etc...). Many of these implement the -gopacket.Decoder interface, so they can be passed into gopacket as decoders. - -Most common protocol layers are named using acronyms or other industry-common -names (IPv4, TCP, PPP). Some of the less common ones have their names expanded -(CiscoDiscoveryProtocol). -For certain protocols, sub-parts of the protocol are split out into their own -layers (SCTP, for example). This is done mostly in cases where portions of the -protocol may fulfill the capabilities of interesting layers (SCTPData implements -ApplicationLayer, while base SCTP implements TransportLayer), or possibly -because splitting a protocol into a few layers makes decoding easier. - -This package is meant to be used with its parent, -http://github.com/google/gopacket. - -Port Types - -Instead of using raw uint16 or uint8 values for ports, we use a different port -type for every protocol, for example TCPPort and UDPPort. This allows us to -override string behavior for each port, which we do by setting up port name -maps (TCPPortNames, UDPPortNames, etc...). Well-known ports are annotated with -their protocol names, and their String function displays these names: - - p := TCPPort(80) - fmt.Printf("Number: %d String: %v", p, p) - // Prints: "Number: 80 String: 80(http)" - -Modifying Decode Behavior - -layers links together decoding through its enumerations. For example, after -decoding layer type Ethernet, it uses Ethernet.EthernetType as its next decoder. -All enumerations that act as decoders, like EthernetType, can be modified by -users depending on their preferences. For example, if you have a spiffy new -IPv4 decoder that works way better than the one built into layers, you can do -this: - - var mySpiffyIPv4Decoder gopacket.Decoder = ... - layers.EthernetTypeMetadata[EthernetTypeIPv4].DecodeWith = mySpiffyIPv4Decoder - -This will make all future ethernet packets use your new decoder to decode IPv4 -packets, instead of the built-in decoder used by gopacket. -*/ -package layers diff --git a/vendor/github.com/google/gopacket/layers/dot11.go b/vendor/github.com/google/gopacket/layers/dot11.go deleted file mode 100644 index 3e6491061..000000000 --- a/vendor/github.com/google/gopacket/layers/dot11.go +++ /dev/null @@ -1,2118 +0,0 @@ -// Copyright 2014 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -// See http://standards.ieee.org/findstds/standard/802.11-2012.html for info on -// all of the layers in this file. - -package layers - -import ( - "bytes" - "encoding/binary" - "fmt" - "hash/crc32" - "net" - - "github.com/google/gopacket" -) - -// Dot11Flags contains the set of 8 flags in the IEEE 802.11 frame control -// header, all in one place. -type Dot11Flags uint8 - -const ( - Dot11FlagsToDS Dot11Flags = 1 << iota - Dot11FlagsFromDS - Dot11FlagsMF - Dot11FlagsRetry - Dot11FlagsPowerManagement - Dot11FlagsMD - Dot11FlagsWEP - Dot11FlagsOrder -) - -func (d Dot11Flags) ToDS() bool { - return d&Dot11FlagsToDS != 0 -} -func (d Dot11Flags) FromDS() bool { - return d&Dot11FlagsFromDS != 0 -} -func (d Dot11Flags) MF() bool { - return d&Dot11FlagsMF != 0 -} -func (d Dot11Flags) Retry() bool { - return d&Dot11FlagsRetry != 0 -} -func (d Dot11Flags) PowerManagement() bool { - return d&Dot11FlagsPowerManagement != 0 -} -func (d Dot11Flags) MD() bool { - return d&Dot11FlagsMD != 0 -} -func (d Dot11Flags) WEP() bool { - return d&Dot11FlagsWEP != 0 -} -func (d Dot11Flags) Order() bool { - return d&Dot11FlagsOrder != 0 -} - -// String provides a human readable string for Dot11Flags. -// This string is possibly subject to change over time; if you're storing this -// persistently, you should probably store the Dot11Flags value, not its string. -func (a Dot11Flags) String() string { - var out bytes.Buffer - if a.ToDS() { - out.WriteString("TO-DS,") - } - if a.FromDS() { - out.WriteString("FROM-DS,") - } - if a.MF() { - out.WriteString("MF,") - } - if a.Retry() { - out.WriteString("Retry,") - } - if a.PowerManagement() { - out.WriteString("PowerManagement,") - } - if a.MD() { - out.WriteString("MD,") - } - if a.WEP() { - out.WriteString("WEP,") - } - if a.Order() { - out.WriteString("Order,") - } - - if length := out.Len(); length > 0 { - return string(out.Bytes()[:length-1]) // strip final comma - } - return "" -} - -type Dot11Reason uint16 - -// TODO: Verify these reasons, and append more reasons if necessary. - -const ( - Dot11ReasonReserved Dot11Reason = 1 - Dot11ReasonUnspecified Dot11Reason = 2 - Dot11ReasonAuthExpired Dot11Reason = 3 - Dot11ReasonDeauthStLeaving Dot11Reason = 4 - Dot11ReasonInactivity Dot11Reason = 5 - Dot11ReasonApFull Dot11Reason = 6 - Dot11ReasonClass2FromNonAuth Dot11Reason = 7 - Dot11ReasonClass3FromNonAss Dot11Reason = 8 - Dot11ReasonDisasStLeaving Dot11Reason = 9 - Dot11ReasonStNotAuth Dot11Reason = 10 -) - -// String provides a human readable string for Dot11Reason. -// This string is possibly subject to change over time; if you're storing this -// persistently, you should probably store the Dot11Reason value, not its string. -func (a Dot11Reason) String() string { - switch a { - case Dot11ReasonReserved: - return "Reserved" - case Dot11ReasonUnspecified: - return "Unspecified" - case Dot11ReasonAuthExpired: - return "Auth. expired" - case Dot11ReasonDeauthStLeaving: - return "Deauth. st. leaving" - case Dot11ReasonInactivity: - return "Inactivity" - case Dot11ReasonApFull: - return "Ap. full" - case Dot11ReasonClass2FromNonAuth: - return "Class2 from non auth." - case Dot11ReasonClass3FromNonAss: - return "Class3 from non ass." - case Dot11ReasonDisasStLeaving: - return "Disass st. leaving" - case Dot11ReasonStNotAuth: - return "St. not auth." - default: - return "Unknown reason" - } -} - -type Dot11Status uint16 - -const ( - Dot11StatusSuccess Dot11Status = 0 - Dot11StatusFailure Dot11Status = 1 // Unspecified failure - Dot11StatusCannotSupportAllCapabilities Dot11Status = 10 // Cannot support all requested capabilities in the Capability Information field - Dot11StatusInabilityExistsAssociation Dot11Status = 11 // Reassociation denied due to inability to confirm that association exists - Dot11StatusAssociationDenied Dot11Status = 12 // Association denied due to reason outside the scope of this standard - Dot11StatusAlgorithmUnsupported Dot11Status = 13 // Responding station does not support the specified authentication algorithm - Dot11StatusOufOfExpectedSequence Dot11Status = 14 // Received an Authentication frame with authentication transaction sequence number out of expected sequence - Dot11StatusChallengeFailure Dot11Status = 15 // Authentication rejected because of challenge failure - Dot11StatusTimeout Dot11Status = 16 // Authentication rejected due to timeout waiting for next frame in sequence - Dot11StatusAPUnableToHandle Dot11Status = 17 // Association denied because AP is unable to handle additional associated stations - Dot11StatusRateUnsupported Dot11Status = 18 // Association denied due to requesting station not supporting all of the data rates in the BSSBasicRateSet parameter -) - -// String provides a human readable string for Dot11Status. -// This string is possibly subject to change over time; if you're storing this -// persistently, you should probably store the Dot11Status value, not its string. -func (a Dot11Status) String() string { - switch a { - case Dot11StatusSuccess: - return "success" - case Dot11StatusFailure: - return "failure" - case Dot11StatusCannotSupportAllCapabilities: - return "cannot-support-all-capabilities" - case Dot11StatusInabilityExistsAssociation: - return "inability-exists-association" - case Dot11StatusAssociationDenied: - return "association-denied" - case Dot11StatusAlgorithmUnsupported: - return "algorithm-unsupported" - case Dot11StatusOufOfExpectedSequence: - return "out-of-expected-sequence" - case Dot11StatusChallengeFailure: - return "challenge-failure" - case Dot11StatusTimeout: - return "timeout" - case Dot11StatusAPUnableToHandle: - return "ap-unable-to-handle" - case Dot11StatusRateUnsupported: - return "rate-unsupported" - default: - return "unknown status" - } -} - -type Dot11AckPolicy uint8 - -const ( - Dot11AckPolicyNormal Dot11AckPolicy = 0 - Dot11AckPolicyNone Dot11AckPolicy = 1 - Dot11AckPolicyNoExplicit Dot11AckPolicy = 2 - Dot11AckPolicyBlock Dot11AckPolicy = 3 -) - -// String provides a human readable string for Dot11AckPolicy. -// This string is possibly subject to change over time; if you're storing this -// persistently, you should probably store the Dot11AckPolicy value, not its string. -func (a Dot11AckPolicy) String() string { - switch a { - case Dot11AckPolicyNormal: - return "normal-ack" - case Dot11AckPolicyNone: - return "no-ack" - case Dot11AckPolicyNoExplicit: - return "no-explicit-ack" - case Dot11AckPolicyBlock: - return "block-ack" - default: - return "unknown-ack-policy" - } -} - -type Dot11Algorithm uint16 - -const ( - Dot11AlgorithmOpen Dot11Algorithm = 0 - Dot11AlgorithmSharedKey Dot11Algorithm = 1 -) - -// String provides a human readable string for Dot11Algorithm. -// This string is possibly subject to change over time; if you're storing this -// persistently, you should probably store the Dot11Algorithm value, not its string. -func (a Dot11Algorithm) String() string { - switch a { - case Dot11AlgorithmOpen: - return "open" - case Dot11AlgorithmSharedKey: - return "shared-key" - default: - return "unknown-algorithm" - } -} - -type Dot11InformationElementID uint8 - -const ( - Dot11InformationElementIDSSID Dot11InformationElementID = 0 - Dot11InformationElementIDRates Dot11InformationElementID = 1 - Dot11InformationElementIDFHSet Dot11InformationElementID = 2 - Dot11InformationElementIDDSSet Dot11InformationElementID = 3 - Dot11InformationElementIDCFSet Dot11InformationElementID = 4 - Dot11InformationElementIDTIM Dot11InformationElementID = 5 - Dot11InformationElementIDIBSSSet Dot11InformationElementID = 6 - Dot11InformationElementIDCountryInfo Dot11InformationElementID = 7 - Dot11InformationElementIDHoppingPatternParam Dot11InformationElementID = 8 - Dot11InformationElementIDHoppingPatternTable Dot11InformationElementID = 9 - Dot11InformationElementIDRequest Dot11InformationElementID = 10 - Dot11InformationElementIDQBSSLoadElem Dot11InformationElementID = 11 - Dot11InformationElementIDEDCAParamSet Dot11InformationElementID = 12 - Dot11InformationElementIDTrafficSpec Dot11InformationElementID = 13 - Dot11InformationElementIDTrafficClass Dot11InformationElementID = 14 - Dot11InformationElementIDSchedule Dot11InformationElementID = 15 - Dot11InformationElementIDChallenge Dot11InformationElementID = 16 - Dot11InformationElementIDPowerConst Dot11InformationElementID = 32 - Dot11InformationElementIDPowerCapability Dot11InformationElementID = 33 - Dot11InformationElementIDTPCRequest Dot11InformationElementID = 34 - Dot11InformationElementIDTPCReport Dot11InformationElementID = 35 - Dot11InformationElementIDSupportedChannels Dot11InformationElementID = 36 - Dot11InformationElementIDSwitchChannelAnnounce Dot11InformationElementID = 37 - Dot11InformationElementIDMeasureRequest Dot11InformationElementID = 38 - Dot11InformationElementIDMeasureReport Dot11InformationElementID = 39 - Dot11InformationElementIDQuiet Dot11InformationElementID = 40 - Dot11InformationElementIDIBSSDFS Dot11InformationElementID = 41 - Dot11InformationElementIDERPInfo Dot11InformationElementID = 42 - Dot11InformationElementIDTSDelay Dot11InformationElementID = 43 - Dot11InformationElementIDTCLASProcessing Dot11InformationElementID = 44 - Dot11InformationElementIDHTCapabilities Dot11InformationElementID = 45 - Dot11InformationElementIDQOSCapability Dot11InformationElementID = 46 - Dot11InformationElementIDERPInfo2 Dot11InformationElementID = 47 - Dot11InformationElementIDRSNInfo Dot11InformationElementID = 48 - Dot11InformationElementIDESRates Dot11InformationElementID = 50 - Dot11InformationElementIDAPChannelReport Dot11InformationElementID = 51 - Dot11InformationElementIDNeighborReport Dot11InformationElementID = 52 - Dot11InformationElementIDRCPI Dot11InformationElementID = 53 - Dot11InformationElementIDMobilityDomain Dot11InformationElementID = 54 - Dot11InformationElementIDFastBSSTrans Dot11InformationElementID = 55 - Dot11InformationElementIDTimeoutInt Dot11InformationElementID = 56 - Dot11InformationElementIDRICData Dot11InformationElementID = 57 - Dot11InformationElementIDDSERegisteredLoc Dot11InformationElementID = 58 - Dot11InformationElementIDSuppOperatingClass Dot11InformationElementID = 59 - Dot11InformationElementIDExtChanSwitchAnnounce Dot11InformationElementID = 60 - Dot11InformationElementIDHTInfo Dot11InformationElementID = 61 - Dot11InformationElementIDSecChanOffset Dot11InformationElementID = 62 - Dot11InformationElementIDBSSAverageAccessDelay Dot11InformationElementID = 63 - Dot11InformationElementIDAntenna Dot11InformationElementID = 64 - Dot11InformationElementIDRSNI Dot11InformationElementID = 65 - Dot11InformationElementIDMeasurePilotTrans Dot11InformationElementID = 66 - Dot11InformationElementIDBSSAvailAdmCapacity Dot11InformationElementID = 67 - Dot11InformationElementIDBSSACAccDelayWAPIParam Dot11InformationElementID = 68 - Dot11InformationElementIDTimeAdvertisement Dot11InformationElementID = 69 - Dot11InformationElementIDRMEnabledCapabilities Dot11InformationElementID = 70 - Dot11InformationElementIDMultipleBSSID Dot11InformationElementID = 71 - Dot11InformationElementID2040BSSCoExist Dot11InformationElementID = 72 - Dot11InformationElementID2040BSSIntChanReport Dot11InformationElementID = 73 - Dot11InformationElementIDOverlapBSSScanParam Dot11InformationElementID = 74 - Dot11InformationElementIDRICDescriptor Dot11InformationElementID = 75 - Dot11InformationElementIDManagementMIC Dot11InformationElementID = 76 - Dot11InformationElementIDEventRequest Dot11InformationElementID = 78 - Dot11InformationElementIDEventReport Dot11InformationElementID = 79 - Dot11InformationElementIDDiagnosticRequest Dot11InformationElementID = 80 - Dot11InformationElementIDDiagnosticReport Dot11InformationElementID = 81 - Dot11InformationElementIDLocationParam Dot11InformationElementID = 82 - Dot11InformationElementIDNonTransBSSIDCapability Dot11InformationElementID = 83 - Dot11InformationElementIDSSIDList Dot11InformationElementID = 84 - Dot11InformationElementIDMultipleBSSIDIndex Dot11InformationElementID = 85 - Dot11InformationElementIDFMSDescriptor Dot11InformationElementID = 86 - Dot11InformationElementIDFMSRequest Dot11InformationElementID = 87 - Dot11InformationElementIDFMSResponse Dot11InformationElementID = 88 - Dot11InformationElementIDQOSTrafficCapability Dot11InformationElementID = 89 - Dot11InformationElementIDBSSMaxIdlePeriod Dot11InformationElementID = 90 - Dot11InformationElementIDTFSRequest Dot11InformationElementID = 91 - Dot11InformationElementIDTFSResponse Dot11InformationElementID = 92 - Dot11InformationElementIDWNMSleepMode Dot11InformationElementID = 93 - Dot11InformationElementIDTIMBroadcastRequest Dot11InformationElementID = 94 - Dot11InformationElementIDTIMBroadcastResponse Dot11InformationElementID = 95 - Dot11InformationElementIDCollInterferenceReport Dot11InformationElementID = 96 - Dot11InformationElementIDChannelUsage Dot11InformationElementID = 97 - Dot11InformationElementIDTimeZone Dot11InformationElementID = 98 - Dot11InformationElementIDDMSRequest Dot11InformationElementID = 99 - Dot11InformationElementIDDMSResponse Dot11InformationElementID = 100 - Dot11InformationElementIDLinkIdentifier Dot11InformationElementID = 101 - Dot11InformationElementIDWakeupSchedule Dot11InformationElementID = 102 - Dot11InformationElementIDChannelSwitchTiming Dot11InformationElementID = 104 - Dot11InformationElementIDPTIControl Dot11InformationElementID = 105 - Dot11InformationElementIDPUBufferStatus Dot11InformationElementID = 106 - Dot11InformationElementIDInterworking Dot11InformationElementID = 107 - Dot11InformationElementIDAdvertisementProtocol Dot11InformationElementID = 108 - Dot11InformationElementIDExpBWRequest Dot11InformationElementID = 109 - Dot11InformationElementIDQOSMapSet Dot11InformationElementID = 110 - Dot11InformationElementIDRoamingConsortium Dot11InformationElementID = 111 - Dot11InformationElementIDEmergencyAlertIdentifier Dot11InformationElementID = 112 - Dot11InformationElementIDMeshConfiguration Dot11InformationElementID = 113 - Dot11InformationElementIDMeshID Dot11InformationElementID = 114 - Dot11InformationElementIDMeshLinkMetricReport Dot11InformationElementID = 115 - Dot11InformationElementIDCongestionNotification Dot11InformationElementID = 116 - Dot11InformationElementIDMeshPeeringManagement Dot11InformationElementID = 117 - Dot11InformationElementIDMeshChannelSwitchParam Dot11InformationElementID = 118 - Dot11InformationElementIDMeshAwakeWindows Dot11InformationElementID = 119 - Dot11InformationElementIDBeaconTiming Dot11InformationElementID = 120 - Dot11InformationElementIDMCCAOPSetupRequest Dot11InformationElementID = 121 - Dot11InformationElementIDMCCAOPSetupReply Dot11InformationElementID = 122 - Dot11InformationElementIDMCCAOPAdvertisement Dot11InformationElementID = 123 - Dot11InformationElementIDMCCAOPTeardown Dot11InformationElementID = 124 - Dot11InformationElementIDGateAnnouncement Dot11InformationElementID = 125 - Dot11InformationElementIDRootAnnouncement Dot11InformationElementID = 126 - Dot11InformationElementIDExtCapability Dot11InformationElementID = 127 - Dot11InformationElementIDAgereProprietary Dot11InformationElementID = 128 - Dot11InformationElementIDPathRequest Dot11InformationElementID = 130 - Dot11InformationElementIDPathReply Dot11InformationElementID = 131 - Dot11InformationElementIDPathError Dot11InformationElementID = 132 - Dot11InformationElementIDCiscoCCX1CKIPDeviceName Dot11InformationElementID = 133 - Dot11InformationElementIDCiscoCCX2 Dot11InformationElementID = 136 - Dot11InformationElementIDProxyUpdate Dot11InformationElementID = 137 - Dot11InformationElementIDProxyUpdateConfirmation Dot11InformationElementID = 138 - Dot11InformationElementIDAuthMeshPerringExch Dot11InformationElementID = 139 - Dot11InformationElementIDMIC Dot11InformationElementID = 140 - Dot11InformationElementIDDestinationURI Dot11InformationElementID = 141 - Dot11InformationElementIDUAPSDCoexistence Dot11InformationElementID = 142 - Dot11InformationElementIDWakeupSchedule80211ad Dot11InformationElementID = 143 - Dot11InformationElementIDExtendedSchedule Dot11InformationElementID = 144 - Dot11InformationElementIDSTAAvailability Dot11InformationElementID = 145 - Dot11InformationElementIDDMGTSPEC Dot11InformationElementID = 146 - Dot11InformationElementIDNextDMGATI Dot11InformationElementID = 147 - Dot11InformationElementIDDMSCapabilities Dot11InformationElementID = 148 - Dot11InformationElementIDCiscoUnknown95 Dot11InformationElementID = 149 - Dot11InformationElementIDVendor2 Dot11InformationElementID = 150 - Dot11InformationElementIDDMGOperating Dot11InformationElementID = 151 - Dot11InformationElementIDDMGBSSParamChange Dot11InformationElementID = 152 - Dot11InformationElementIDDMGBeamRefinement Dot11InformationElementID = 153 - Dot11InformationElementIDChannelMeasFeedback Dot11InformationElementID = 154 - Dot11InformationElementIDAwakeWindow Dot11InformationElementID = 157 - Dot11InformationElementIDMultiBand Dot11InformationElementID = 158 - Dot11InformationElementIDADDBAExtension Dot11InformationElementID = 159 - Dot11InformationElementIDNEXTPCPList Dot11InformationElementID = 160 - Dot11InformationElementIDPCPHandover Dot11InformationElementID = 161 - Dot11InformationElementIDDMGLinkMargin Dot11InformationElementID = 162 - Dot11InformationElementIDSwitchingStream Dot11InformationElementID = 163 - Dot11InformationElementIDSessionTransmission Dot11InformationElementID = 164 - Dot11InformationElementIDDynamicTonePairReport Dot11InformationElementID = 165 - Dot11InformationElementIDClusterReport Dot11InformationElementID = 166 - Dot11InformationElementIDRelayCapabilities Dot11InformationElementID = 167 - Dot11InformationElementIDRelayTransferParameter Dot11InformationElementID = 168 - Dot11InformationElementIDBeamlinkMaintenance Dot11InformationElementID = 169 - Dot11InformationElementIDMultipleMacSublayers Dot11InformationElementID = 170 - Dot11InformationElementIDUPID Dot11InformationElementID = 171 - Dot11InformationElementIDDMGLinkAdaptionAck Dot11InformationElementID = 172 - Dot11InformationElementIDSymbolProprietary Dot11InformationElementID = 173 - Dot11InformationElementIDMCCAOPAdvertOverview Dot11InformationElementID = 174 - Dot11InformationElementIDQuietPeriodRequest Dot11InformationElementID = 175 - Dot11InformationElementIDQuietPeriodResponse Dot11InformationElementID = 177 - Dot11InformationElementIDECPACPolicy Dot11InformationElementID = 182 - Dot11InformationElementIDClusterTimeOffset Dot11InformationElementID = 183 - Dot11InformationElementIDAntennaSectorID Dot11InformationElementID = 190 - Dot11InformationElementIDVHTCapabilities Dot11InformationElementID = 191 - Dot11InformationElementIDVHTOperation Dot11InformationElementID = 192 - Dot11InformationElementIDExtendedBSSLoad Dot11InformationElementID = 193 - Dot11InformationElementIDWideBWChannelSwitch Dot11InformationElementID = 194 - Dot11InformationElementIDVHTTxPowerEnvelope Dot11InformationElementID = 195 - Dot11InformationElementIDChannelSwitchWrapper Dot11InformationElementID = 196 - Dot11InformationElementIDOperatingModeNotification Dot11InformationElementID = 199 - Dot11InformationElementIDUPSIM Dot11InformationElementID = 200 - Dot11InformationElementIDReducedNeighborReport Dot11InformationElementID = 201 - Dot11InformationElementIDTVHTOperation Dot11InformationElementID = 202 - Dot11InformationElementIDDeviceLocation Dot11InformationElementID = 204 - Dot11InformationElementIDWhiteSpaceMap Dot11InformationElementID = 205 - Dot11InformationElementIDFineTuningMeasureParams Dot11InformationElementID = 206 - Dot11InformationElementIDVendor Dot11InformationElementID = 221 -) - -// String provides a human readable string for Dot11InformationElementID. -// This string is possibly subject to change over time; if you're storing this -// persistently, you should probably store the Dot11InformationElementID value, -// not its string. -func (a Dot11InformationElementID) String() string { - switch a { - case Dot11InformationElementIDSSID: - return "SSID parameter set" - case Dot11InformationElementIDRates: - return "Supported Rates" - case Dot11InformationElementIDFHSet: - return "FH Parameter set" - case Dot11InformationElementIDDSSet: - return "DS Parameter set" - case Dot11InformationElementIDCFSet: - return "CF Parameter set" - case Dot11InformationElementIDTIM: - return "Traffic Indication Map (TIM)" - case Dot11InformationElementIDIBSSSet: - return "IBSS Parameter set" - case Dot11InformationElementIDCountryInfo: - return "Country Information" - case Dot11InformationElementIDHoppingPatternParam: - return "Hopping Pattern Parameters" - case Dot11InformationElementIDHoppingPatternTable: - return "Hopping Pattern Table" - case Dot11InformationElementIDRequest: - return "Request" - case Dot11InformationElementIDQBSSLoadElem: - return "QBSS Load Element" - case Dot11InformationElementIDEDCAParamSet: - return "EDCA Parameter Set" - case Dot11InformationElementIDTrafficSpec: - return "Traffic Specification" - case Dot11InformationElementIDTrafficClass: - return "Traffic Classification" - case Dot11InformationElementIDSchedule: - return "Schedule" - case Dot11InformationElementIDChallenge: - return "Challenge text" - case Dot11InformationElementIDPowerConst: - return "Power Constraint" - case Dot11InformationElementIDPowerCapability: - return "Power Capability" - case Dot11InformationElementIDTPCRequest: - return "TPC Request" - case Dot11InformationElementIDTPCReport: - return "TPC Report" - case Dot11InformationElementIDSupportedChannels: - return "Supported Channels" - case Dot11InformationElementIDSwitchChannelAnnounce: - return "Channel Switch Announcement" - case Dot11InformationElementIDMeasureRequest: - return "Measurement Request" - case Dot11InformationElementIDMeasureReport: - return "Measurement Report" - case Dot11InformationElementIDQuiet: - return "Quiet" - case Dot11InformationElementIDIBSSDFS: - return "IBSS DFS" - case Dot11InformationElementIDERPInfo: - return "ERP Information" - case Dot11InformationElementIDTSDelay: - return "TS Delay" - case Dot11InformationElementIDTCLASProcessing: - return "TCLAS Processing" - case Dot11InformationElementIDHTCapabilities: - return "HT Capabilities (802.11n D1.10)" - case Dot11InformationElementIDQOSCapability: - return "QOS Capability" - case Dot11InformationElementIDERPInfo2: - return "ERP Information-2" - case Dot11InformationElementIDRSNInfo: - return "RSN Information" - case Dot11InformationElementIDESRates: - return "Extended Supported Rates" - case Dot11InformationElementIDAPChannelReport: - return "AP Channel Report" - case Dot11InformationElementIDNeighborReport: - return "Neighbor Report" - case Dot11InformationElementIDRCPI: - return "RCPI" - case Dot11InformationElementIDMobilityDomain: - return "Mobility Domain" - case Dot11InformationElementIDFastBSSTrans: - return "Fast BSS Transition" - case Dot11InformationElementIDTimeoutInt: - return "Timeout Interval" - case Dot11InformationElementIDRICData: - return "RIC Data" - case Dot11InformationElementIDDSERegisteredLoc: - return "DSE Registered Location" - case Dot11InformationElementIDSuppOperatingClass: - return "Supported Operating Classes" - case Dot11InformationElementIDExtChanSwitchAnnounce: - return "Extended Channel Switch Announcement" - case Dot11InformationElementIDHTInfo: - return "HT Information (802.11n D1.10)" - case Dot11InformationElementIDSecChanOffset: - return "Secondary Channel Offset (802.11n D1.10)" - case Dot11InformationElementIDBSSAverageAccessDelay: - return "BSS Average Access Delay" - case Dot11InformationElementIDAntenna: - return "Antenna" - case Dot11InformationElementIDRSNI: - return "RSNI" - case Dot11InformationElementIDMeasurePilotTrans: - return "Measurement Pilot Transmission" - case Dot11InformationElementIDBSSAvailAdmCapacity: - return "BSS Available Admission Capacity" - case Dot11InformationElementIDBSSACAccDelayWAPIParam: - return "BSS AC Access Delay/WAPI Parameter Set" - case Dot11InformationElementIDTimeAdvertisement: - return "Time Advertisement" - case Dot11InformationElementIDRMEnabledCapabilities: - return "RM Enabled Capabilities" - case Dot11InformationElementIDMultipleBSSID: - return "Multiple BSSID" - case Dot11InformationElementID2040BSSCoExist: - return "20/40 BSS Coexistence" - case Dot11InformationElementID2040BSSIntChanReport: - return "20/40 BSS Intolerant Channel Report" - case Dot11InformationElementIDOverlapBSSScanParam: - return "Overlapping BSS Scan Parameters" - case Dot11InformationElementIDRICDescriptor: - return "RIC Descriptor" - case Dot11InformationElementIDManagementMIC: - return "Management MIC" - case Dot11InformationElementIDEventRequest: - return "Event Request" - case Dot11InformationElementIDEventReport: - return "Event Report" - case Dot11InformationElementIDDiagnosticRequest: - return "Diagnostic Request" - case Dot11InformationElementIDDiagnosticReport: - return "Diagnostic Report" - case Dot11InformationElementIDLocationParam: - return "Location Parameters" - case Dot11InformationElementIDNonTransBSSIDCapability: - return "Non Transmitted BSSID Capability" - case Dot11InformationElementIDSSIDList: - return "SSID List" - case Dot11InformationElementIDMultipleBSSIDIndex: - return "Multiple BSSID Index" - case Dot11InformationElementIDFMSDescriptor: - return "FMS Descriptor" - case Dot11InformationElementIDFMSRequest: - return "FMS Request" - case Dot11InformationElementIDFMSResponse: - return "FMS Response" - case Dot11InformationElementIDQOSTrafficCapability: - return "QoS Traffic Capability" - case Dot11InformationElementIDBSSMaxIdlePeriod: - return "BSS Max Idle Period" - case Dot11InformationElementIDTFSRequest: - return "TFS Request" - case Dot11InformationElementIDTFSResponse: - return "TFS Response" - case Dot11InformationElementIDWNMSleepMode: - return "WNM-Sleep Mode" - case Dot11InformationElementIDTIMBroadcastRequest: - return "TIM Broadcast Request" - case Dot11InformationElementIDTIMBroadcastResponse: - return "TIM Broadcast Response" - case Dot11InformationElementIDCollInterferenceReport: - return "Collocated Interference Report" - case Dot11InformationElementIDChannelUsage: - return "Channel Usage" - case Dot11InformationElementIDTimeZone: - return "Time Zone" - case Dot11InformationElementIDDMSRequest: - return "DMS Request" - case Dot11InformationElementIDDMSResponse: - return "DMS Response" - case Dot11InformationElementIDLinkIdentifier: - return "Link Identifier" - case Dot11InformationElementIDWakeupSchedule: - return "Wakeup Schedule" - case Dot11InformationElementIDChannelSwitchTiming: - return "Channel Switch Timing" - case Dot11InformationElementIDPTIControl: - return "PTI Control" - case Dot11InformationElementIDPUBufferStatus: - return "PU Buffer Status" - case Dot11InformationElementIDInterworking: - return "Interworking" - case Dot11InformationElementIDAdvertisementProtocol: - return "Advertisement Protocol" - case Dot11InformationElementIDExpBWRequest: - return "Expedited Bandwidth Request" - case Dot11InformationElementIDQOSMapSet: - return "QoS Map Set" - case Dot11InformationElementIDRoamingConsortium: - return "Roaming Consortium" - case Dot11InformationElementIDEmergencyAlertIdentifier: - return "Emergency Alert Identifier" - case Dot11InformationElementIDMeshConfiguration: - return "Mesh Configuration" - case Dot11InformationElementIDMeshID: - return "Mesh ID" - case Dot11InformationElementIDMeshLinkMetricReport: - return "Mesh Link Metric Report" - case Dot11InformationElementIDCongestionNotification: - return "Congestion Notification" - case Dot11InformationElementIDMeshPeeringManagement: - return "Mesh Peering Management" - case Dot11InformationElementIDMeshChannelSwitchParam: - return "Mesh Channel Switch Parameters" - case Dot11InformationElementIDMeshAwakeWindows: - return "Mesh Awake Windows" - case Dot11InformationElementIDBeaconTiming: - return "Beacon Timing" - case Dot11InformationElementIDMCCAOPSetupRequest: - return "MCCAOP Setup Request" - case Dot11InformationElementIDMCCAOPSetupReply: - return "MCCAOP SETUP Reply" - case Dot11InformationElementIDMCCAOPAdvertisement: - return "MCCAOP Advertisement" - case Dot11InformationElementIDMCCAOPTeardown: - return "MCCAOP Teardown" - case Dot11InformationElementIDGateAnnouncement: - return "Gate Announcement" - case Dot11InformationElementIDRootAnnouncement: - return "Root Announcement" - case Dot11InformationElementIDExtCapability: - return "Extended Capabilities" - case Dot11InformationElementIDAgereProprietary: - return "Agere Proprietary" - case Dot11InformationElementIDPathRequest: - return "Path Request" - case Dot11InformationElementIDPathReply: - return "Path Reply" - case Dot11InformationElementIDPathError: - return "Path Error" - case Dot11InformationElementIDCiscoCCX1CKIPDeviceName: - return "Cisco CCX1 CKIP + Device Name" - case Dot11InformationElementIDCiscoCCX2: - return "Cisco CCX2" - case Dot11InformationElementIDProxyUpdate: - return "Proxy Update" - case Dot11InformationElementIDProxyUpdateConfirmation: - return "Proxy Update Confirmation" - case Dot11InformationElementIDAuthMeshPerringExch: - return "Auhenticated Mesh Perring Exchange" - case Dot11InformationElementIDMIC: - return "MIC (Message Integrity Code)" - case Dot11InformationElementIDDestinationURI: - return "Destination URI" - case Dot11InformationElementIDUAPSDCoexistence: - return "U-APSD Coexistence" - case Dot11InformationElementIDWakeupSchedule80211ad: - return "Wakeup Schedule 802.11ad" - case Dot11InformationElementIDExtendedSchedule: - return "Extended Schedule" - case Dot11InformationElementIDSTAAvailability: - return "STA Availability" - case Dot11InformationElementIDDMGTSPEC: - return "DMG TSPEC" - case Dot11InformationElementIDNextDMGATI: - return "Next DMG ATI" - case Dot11InformationElementIDDMSCapabilities: - return "DMG Capabilities" - case Dot11InformationElementIDCiscoUnknown95: - return "Cisco Unknown 95" - case Dot11InformationElementIDVendor2: - return "Vendor Specific" - case Dot11InformationElementIDDMGOperating: - return "DMG Operating" - case Dot11InformationElementIDDMGBSSParamChange: - return "DMG BSS Parameter Change" - case Dot11InformationElementIDDMGBeamRefinement: - return "DMG Beam Refinement" - case Dot11InformationElementIDChannelMeasFeedback: - return "Channel Measurement Feedback" - case Dot11InformationElementIDAwakeWindow: - return "Awake Window" - case Dot11InformationElementIDMultiBand: - return "Multi Band" - case Dot11InformationElementIDADDBAExtension: - return "ADDBA Extension" - case Dot11InformationElementIDNEXTPCPList: - return "NEXTPCP List" - case Dot11InformationElementIDPCPHandover: - return "PCP Handover" - case Dot11InformationElementIDDMGLinkMargin: - return "DMG Link Margin" - case Dot11InformationElementIDSwitchingStream: - return "Switching Stream" - case Dot11InformationElementIDSessionTransmission: - return "Session Transmission" - case Dot11InformationElementIDDynamicTonePairReport: - return "Dynamic Tone Pairing Report" - case Dot11InformationElementIDClusterReport: - return "Cluster Report" - case Dot11InformationElementIDRelayCapabilities: - return "Relay Capabilities" - case Dot11InformationElementIDRelayTransferParameter: - return "Relay Transfer Parameter" - case Dot11InformationElementIDBeamlinkMaintenance: - return "Beamlink Maintenance" - case Dot11InformationElementIDMultipleMacSublayers: - return "Multiple MAC Sublayers" - case Dot11InformationElementIDUPID: - return "U-PID" - case Dot11InformationElementIDDMGLinkAdaptionAck: - return "DMG Link Adaption Acknowledgment" - case Dot11InformationElementIDSymbolProprietary: - return "Symbol Proprietary" - case Dot11InformationElementIDMCCAOPAdvertOverview: - return "MCCAOP Advertisement Overview" - case Dot11InformationElementIDQuietPeriodRequest: - return "Quiet Period Request" - case Dot11InformationElementIDQuietPeriodResponse: - return "Quiet Period Response" - case Dot11InformationElementIDECPACPolicy: - return "ECPAC Policy" - case Dot11InformationElementIDClusterTimeOffset: - return "Cluster Time Offset" - case Dot11InformationElementIDAntennaSectorID: - return "Antenna Sector ID" - case Dot11InformationElementIDVHTCapabilities: - return "VHT Capabilities (IEEE Std 802.11ac/D3.1)" - case Dot11InformationElementIDVHTOperation: - return "VHT Operation (IEEE Std 802.11ac/D3.1)" - case Dot11InformationElementIDExtendedBSSLoad: - return "Extended BSS Load" - case Dot11InformationElementIDWideBWChannelSwitch: - return "Wide Bandwidth Channel Switch" - case Dot11InformationElementIDVHTTxPowerEnvelope: - return "VHT Tx Power Envelope (IEEE Std 802.11ac/D5.0)" - case Dot11InformationElementIDChannelSwitchWrapper: - return "Channel Switch Wrapper" - case Dot11InformationElementIDOperatingModeNotification: - return "Operating Mode Notification" - case Dot11InformationElementIDUPSIM: - return "UP SIM" - case Dot11InformationElementIDReducedNeighborReport: - return "Reduced Neighbor Report" - case Dot11InformationElementIDTVHTOperation: - return "TVHT Op" - case Dot11InformationElementIDDeviceLocation: - return "Device Location" - case Dot11InformationElementIDWhiteSpaceMap: - return "White Space Map" - case Dot11InformationElementIDFineTuningMeasureParams: - return "Fine Tuning Measure Parameters" - case Dot11InformationElementIDVendor: - return "Vendor" - default: - return "Unknown information element id" - } -} - -// Dot11 provides an IEEE 802.11 base packet header. -// See http://standards.ieee.org/findstds/standard/802.11-2012.html -// for excruciating detail. -type Dot11 struct { - BaseLayer - Type Dot11Type - Proto uint8 - Flags Dot11Flags - DurationID uint16 - Address1 net.HardwareAddr - Address2 net.HardwareAddr - Address3 net.HardwareAddr - Address4 net.HardwareAddr - SequenceNumber uint16 - FragmentNumber uint16 - Checksum uint32 - QOS *Dot11QOS - HTControl *Dot11HTControl - DataLayer gopacket.Layer -} - -type Dot11QOS struct { - TID uint8 /* Traffic IDentifier */ - EOSP bool /* End of service period */ - AckPolicy Dot11AckPolicy - TXOP uint8 -} - -type Dot11HTControl struct { - ACConstraint bool - RDGMorePPDU bool - - VHT *Dot11HTControlVHT - HT *Dot11HTControlHT -} - -type Dot11HTControlHT struct { - LinkAdapationControl *Dot11LinkAdapationControl - CalibrationPosition uint8 - CalibrationSequence uint8 - CSISteering uint8 - NDPAnnouncement bool - DEI bool -} - -type Dot11HTControlVHT struct { - MRQ bool - UnsolicitedMFB bool - MSI *uint8 - MFB Dot11HTControlMFB - CompressedMSI *uint8 - STBCIndication bool - MFSI *uint8 - GID *uint8 - CodingType *Dot11CodingType - FbTXBeamformed bool -} - -type Dot11HTControlMFB struct { - NumSTS uint8 - VHTMCS uint8 - BW uint8 - SNR int8 -} - -type Dot11LinkAdapationControl struct { - TRQ bool - MRQ bool - MSI uint8 - MFSI uint8 - ASEL *Dot11ASEL - MFB *uint8 -} - -type Dot11ASEL struct { - Command uint8 - Data uint8 -} - -type Dot11CodingType uint8 - -const ( - Dot11CodingTypeBCC = 0 - Dot11CodingTypeLDPC = 1 -) - -func (a Dot11CodingType) String() string { - switch a { - case Dot11CodingTypeBCC: - return "BCC" - case Dot11CodingTypeLDPC: - return "LDPC" - default: - return "Unknown coding type" - } -} - -func (m *Dot11HTControlMFB) NoFeedBackPresent() bool { - return m.VHTMCS == 15 && m.NumSTS == 7 -} - -func decodeDot11(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11{} - err := d.DecodeFromBytes(data, p) - if err != nil { - return err - } - p.AddLayer(d) - if d.DataLayer != nil { - p.AddLayer(d.DataLayer) - } - return p.NextDecoder(d.NextLayerType()) -} - -func (m *Dot11) LayerType() gopacket.LayerType { return LayerTypeDot11 } -func (m *Dot11) CanDecode() gopacket.LayerClass { return LayerTypeDot11 } -func (m *Dot11) NextLayerType() gopacket.LayerType { - if m.DataLayer != nil { - if m.Flags.WEP() { - return LayerTypeDot11WEP - } - return m.DataLayer.(gopacket.DecodingLayer).NextLayerType() - } - return m.Type.LayerType() -} - -func createU8(x uint8) *uint8 { - return &x -} - -var dataDecodeMap = map[Dot11Type]func() gopacket.DecodingLayer{ - Dot11TypeData: func() gopacket.DecodingLayer { return &Dot11Data{} }, - Dot11TypeDataCFAck: func() gopacket.DecodingLayer { return &Dot11DataCFAck{} }, - Dot11TypeDataCFPoll: func() gopacket.DecodingLayer { return &Dot11DataCFPoll{} }, - Dot11TypeDataCFAckPoll: func() gopacket.DecodingLayer { return &Dot11DataCFAckPoll{} }, - Dot11TypeDataNull: func() gopacket.DecodingLayer { return &Dot11DataNull{} }, - Dot11TypeDataCFAckNoData: func() gopacket.DecodingLayer { return &Dot11DataCFAckNoData{} }, - Dot11TypeDataCFPollNoData: func() gopacket.DecodingLayer { return &Dot11DataCFPollNoData{} }, - Dot11TypeDataCFAckPollNoData: func() gopacket.DecodingLayer { return &Dot11DataCFAckPollNoData{} }, - Dot11TypeDataQOSData: func() gopacket.DecodingLayer { return &Dot11DataQOSData{} }, - Dot11TypeDataQOSDataCFAck: func() gopacket.DecodingLayer { return &Dot11DataQOSDataCFAck{} }, - Dot11TypeDataQOSDataCFPoll: func() gopacket.DecodingLayer { return &Dot11DataQOSDataCFPoll{} }, - Dot11TypeDataQOSDataCFAckPoll: func() gopacket.DecodingLayer { return &Dot11DataQOSDataCFAckPoll{} }, - Dot11TypeDataQOSNull: func() gopacket.DecodingLayer { return &Dot11DataQOSNull{} }, - Dot11TypeDataQOSCFPollNoData: func() gopacket.DecodingLayer { return &Dot11DataQOSCFPollNoData{} }, - Dot11TypeDataQOSCFAckPollNoData: func() gopacket.DecodingLayer { return &Dot11DataQOSCFAckPollNoData{} }, -} - -func (m *Dot11) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 10 { - df.SetTruncated() - return fmt.Errorf("Dot11 length %v too short, %v required", len(data), 10) - } - m.Type = Dot11Type((data[0])&0xFC) >> 2 - - m.DataLayer = nil - m.Proto = uint8(data[0]) & 0x0003 - m.Flags = Dot11Flags(data[1]) - m.DurationID = binary.LittleEndian.Uint16(data[2:4]) - m.Address1 = net.HardwareAddr(data[4:10]) - - offset := 10 - - mainType := m.Type.MainType() - - switch mainType { - case Dot11TypeCtrl: - switch m.Type { - case Dot11TypeCtrlRTS, Dot11TypeCtrlPowersavePoll, Dot11TypeCtrlCFEnd, Dot11TypeCtrlCFEndAck: - if len(data) < offset+6 { - df.SetTruncated() - return fmt.Errorf("Dot11 length %v too short, %v required", len(data), offset+6) - } - m.Address2 = net.HardwareAddr(data[offset : offset+6]) - offset += 6 - } - case Dot11TypeMgmt, Dot11TypeData: - if len(data) < offset+14 { - df.SetTruncated() - return fmt.Errorf("Dot11 length %v too short, %v required", len(data), offset+14) - } - m.Address2 = net.HardwareAddr(data[offset : offset+6]) - offset += 6 - m.Address3 = net.HardwareAddr(data[offset : offset+6]) - offset += 6 - - m.SequenceNumber = (binary.LittleEndian.Uint16(data[offset:offset+2]) & 0xFFF0) >> 4 - m.FragmentNumber = (binary.LittleEndian.Uint16(data[offset:offset+2]) & 0x000F) - offset += 2 - } - - if mainType == Dot11TypeData && m.Flags.FromDS() && m.Flags.ToDS() { - if len(data) < offset+6 { - df.SetTruncated() - return fmt.Errorf("Dot11 length %v too short, %v required", len(data), offset+6) - } - m.Address4 = net.HardwareAddr(data[offset : offset+6]) - offset += 6 - } - - if m.Type.QOS() { - if len(data) < offset+2 { - df.SetTruncated() - return fmt.Errorf("Dot11 length %v too short, %v required", len(data), offset+6) - } - m.QOS = &Dot11QOS{ - TID: (uint8(data[offset]) & 0x0F), - EOSP: (uint8(data[offset]) & 0x10) == 0x10, - AckPolicy: Dot11AckPolicy((uint8(data[offset]) & 0x60) >> 5), - TXOP: uint8(data[offset+1]), - } - offset += 2 - } - if m.Flags.Order() && (m.Type.QOS() || mainType == Dot11TypeMgmt) { - if len(data) < offset+4 { - df.SetTruncated() - return fmt.Errorf("Dot11 length %v too short, %v required", len(data), offset+6) - } - - htc := &Dot11HTControl{ - ACConstraint: data[offset+3]&0x40 != 0, - RDGMorePPDU: data[offset+3]&0x80 != 0, - } - m.HTControl = htc - - if data[offset]&0x1 != 0 { // VHT Variant - vht := &Dot11HTControlVHT{} - htc.VHT = vht - vht.MRQ = data[offset]&0x4 != 0 - vht.UnsolicitedMFB = data[offset+3]&0x20 != 0 - vht.MFB = Dot11HTControlMFB{ - NumSTS: uint8(data[offset+1] >> 1 & 0x7), - VHTMCS: uint8(data[offset+1] >> 4 & 0xF), - BW: uint8(data[offset+2] & 0x3), - SNR: int8((-(data[offset+2] >> 2 & 0x20))+data[offset+2]>>2&0x1F) + 22, - } - - if vht.UnsolicitedMFB { - if !vht.MFB.NoFeedBackPresent() { - vht.CompressedMSI = createU8(data[offset] >> 3 & 0x3) - vht.STBCIndication = data[offset]&0x20 != 0 - vht.CodingType = (*Dot11CodingType)(createU8(data[offset+3] >> 3 & 0x1)) - vht.FbTXBeamformed = data[offset+3]&0x10 != 0 - vht.GID = createU8( - data[offset]>>6 + - (data[offset+1] & 0x1 << 2) + - data[offset+3]&0x7<<3) - } - } else { - if vht.MRQ { - vht.MSI = createU8((data[offset] >> 3) & 0x07) - } - vht.MFSI = createU8(data[offset]>>6 + (data[offset+1] & 0x1 << 2)) - } - - } else { // HT Variant - ht := &Dot11HTControlHT{} - htc.HT = ht - - lac := &Dot11LinkAdapationControl{} - ht.LinkAdapationControl = lac - lac.TRQ = data[offset]&0x2 != 0 - lac.MFSI = data[offset]>>6&0x3 + data[offset+1]&0x1<<3 - if data[offset]&0x3C == 0x38 { // ASEL - lac.ASEL = &Dot11ASEL{ - Command: data[offset+1] >> 1 & 0x7, - Data: data[offset+1] >> 4 & 0xF, - } - } else { - lac.MRQ = data[offset]&0x4 != 0 - if lac.MRQ { - lac.MSI = data[offset] >> 3 & 0x7 - } - lac.MFB = createU8(data[offset+1] >> 1) - } - ht.CalibrationPosition = data[offset+2] & 0x3 - ht.CalibrationSequence = data[offset+2] >> 2 & 0x3 - ht.CSISteering = data[offset+2] >> 6 & 0x3 - ht.NDPAnnouncement = data[offset+3]&0x1 != 0 - if mainType != Dot11TypeMgmt { - ht.DEI = data[offset+3]&0x20 != 0 - } - } - - offset += 4 - } - - if len(data) < offset+4 { - df.SetTruncated() - return fmt.Errorf("Dot11 length %v too short, %v required", len(data), offset+4) - } - - m.BaseLayer = BaseLayer{ - Contents: data[0:offset], - Payload: data[offset : len(data)-4], - } - - if mainType == Dot11TypeData { - d := dataDecodeMap[m.Type] - if d == nil { - return fmt.Errorf("unsupported type: %v", m.Type) - } - l := d() - err := l.DecodeFromBytes(m.BaseLayer.Payload, df) - if err != nil { - return err - } - m.DataLayer = l.(gopacket.Layer) - } - - m.Checksum = binary.LittleEndian.Uint32(data[len(data)-4 : len(data)]) - return nil -} - -func (m *Dot11) ChecksumValid() bool { - // only for CTRL and MGMT frames - h := crc32.NewIEEE() - h.Write(m.Contents) - h.Write(m.Payload) - return m.Checksum == h.Sum32() -} - -func (m Dot11) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - buf, err := b.PrependBytes(24) - - if err != nil { - return err - } - - buf[0] = (uint8(m.Type) << 2) | m.Proto - buf[1] = uint8(m.Flags) - - binary.LittleEndian.PutUint16(buf[2:4], m.DurationID) - - copy(buf[4:10], m.Address1) - - offset := 10 - - switch m.Type.MainType() { - case Dot11TypeCtrl: - switch m.Type { - case Dot11TypeCtrlRTS, Dot11TypeCtrlPowersavePoll, Dot11TypeCtrlCFEnd, Dot11TypeCtrlCFEndAck: - copy(buf[offset:offset+6], m.Address2) - offset += 6 - } - case Dot11TypeMgmt, Dot11TypeData: - copy(buf[offset:offset+6], m.Address2) - offset += 6 - copy(buf[offset:offset+6], m.Address3) - offset += 6 - - binary.LittleEndian.PutUint16(buf[offset:offset+2], (m.SequenceNumber<<4)|m.FragmentNumber) - offset += 2 - } - - if m.Type.MainType() == Dot11TypeData && m.Flags.FromDS() && m.Flags.ToDS() { - copy(buf[offset:offset+6], m.Address4) - offset += 6 - } - - return nil -} - -// Dot11Mgmt is a base for all IEEE 802.11 management layers. -type Dot11Mgmt struct { - BaseLayer -} - -func (m *Dot11Mgmt) NextLayerType() gopacket.LayerType { return gopacket.LayerTypePayload } -func (m *Dot11Mgmt) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - m.Contents = data - return nil -} - -// Dot11Ctrl is a base for all IEEE 802.11 control layers. -type Dot11Ctrl struct { - BaseLayer -} - -func (m *Dot11Ctrl) NextLayerType() gopacket.LayerType { return gopacket.LayerTypePayload } - -func (m *Dot11Ctrl) LayerType() gopacket.LayerType { return LayerTypeDot11Ctrl } -func (m *Dot11Ctrl) CanDecode() gopacket.LayerClass { return LayerTypeDot11Ctrl } -func (m *Dot11Ctrl) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - m.Contents = data - return nil -} - -func decodeDot11Ctrl(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11Ctrl{} - return decodingLayerDecoder(d, data, p) -} - -// Dot11WEP contains WEP encrpted IEEE 802.11 data. -type Dot11WEP struct { - BaseLayer -} - -func (m *Dot11WEP) NextLayerType() gopacket.LayerType { return gopacket.LayerTypePayload } - -func (m *Dot11WEP) LayerType() gopacket.LayerType { return LayerTypeDot11WEP } -func (m *Dot11WEP) CanDecode() gopacket.LayerClass { return LayerTypeDot11WEP } -func (m *Dot11WEP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - m.Contents = data - return nil -} - -func decodeDot11WEP(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11WEP{} - return decodingLayerDecoder(d, data, p) -} - -// Dot11Data is a base for all IEEE 802.11 data layers. -type Dot11Data struct { - BaseLayer -} - -func (m *Dot11Data) NextLayerType() gopacket.LayerType { - return LayerTypeLLC -} - -func (m *Dot11Data) LayerType() gopacket.LayerType { return LayerTypeDot11Data } -func (m *Dot11Data) CanDecode() gopacket.LayerClass { return LayerTypeDot11Data } -func (m *Dot11Data) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - m.Payload = data - return nil -} - -func decodeDot11Data(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11Data{} - return decodingLayerDecoder(d, data, p) -} - -type Dot11DataCFAck struct { - Dot11Data -} - -func decodeDot11DataCFAck(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11DataCFAck{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11DataCFAck) LayerType() gopacket.LayerType { return LayerTypeDot11DataCFAck } -func (m *Dot11DataCFAck) CanDecode() gopacket.LayerClass { return LayerTypeDot11DataCFAck } -func (m *Dot11DataCFAck) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - return m.Dot11Data.DecodeFromBytes(data, df) -} - -type Dot11DataCFPoll struct { - Dot11Data -} - -func decodeDot11DataCFPoll(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11DataCFPoll{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11DataCFPoll) LayerType() gopacket.LayerType { return LayerTypeDot11DataCFPoll } -func (m *Dot11DataCFPoll) CanDecode() gopacket.LayerClass { return LayerTypeDot11DataCFPoll } -func (m *Dot11DataCFPoll) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - return m.Dot11Data.DecodeFromBytes(data, df) -} - -type Dot11DataCFAckPoll struct { - Dot11Data -} - -func decodeDot11DataCFAckPoll(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11DataCFAckPoll{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11DataCFAckPoll) LayerType() gopacket.LayerType { return LayerTypeDot11DataCFAckPoll } -func (m *Dot11DataCFAckPoll) CanDecode() gopacket.LayerClass { return LayerTypeDot11DataCFAckPoll } -func (m *Dot11DataCFAckPoll) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - return m.Dot11Data.DecodeFromBytes(data, df) -} - -type Dot11DataNull struct { - Dot11Data -} - -func decodeDot11DataNull(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11DataNull{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11DataNull) LayerType() gopacket.LayerType { return LayerTypeDot11DataNull } -func (m *Dot11DataNull) CanDecode() gopacket.LayerClass { return LayerTypeDot11DataNull } -func (m *Dot11DataNull) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - return m.Dot11Data.DecodeFromBytes(data, df) -} - -type Dot11DataCFAckNoData struct { - Dot11Data -} - -func decodeDot11DataCFAckNoData(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11DataCFAckNoData{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11DataCFAckNoData) LayerType() gopacket.LayerType { return LayerTypeDot11DataCFAckNoData } -func (m *Dot11DataCFAckNoData) CanDecode() gopacket.LayerClass { return LayerTypeDot11DataCFAckNoData } -func (m *Dot11DataCFAckNoData) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - return m.Dot11Data.DecodeFromBytes(data, df) -} - -type Dot11DataCFPollNoData struct { - Dot11Data -} - -func decodeDot11DataCFPollNoData(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11DataCFPollNoData{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11DataCFPollNoData) LayerType() gopacket.LayerType { return LayerTypeDot11DataCFPollNoData } -func (m *Dot11DataCFPollNoData) CanDecode() gopacket.LayerClass { - return LayerTypeDot11DataCFPollNoData -} -func (m *Dot11DataCFPollNoData) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - return m.Dot11Data.DecodeFromBytes(data, df) -} - -type Dot11DataCFAckPollNoData struct { - Dot11Data -} - -func decodeDot11DataCFAckPollNoData(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11DataCFAckPollNoData{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11DataCFAckPollNoData) LayerType() gopacket.LayerType { - return LayerTypeDot11DataCFAckPollNoData -} -func (m *Dot11DataCFAckPollNoData) CanDecode() gopacket.LayerClass { - return LayerTypeDot11DataCFAckPollNoData -} -func (m *Dot11DataCFAckPollNoData) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - return m.Dot11Data.DecodeFromBytes(data, df) -} - -type Dot11DataQOS struct { - Dot11Ctrl -} - -func (m *Dot11DataQOS) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - m.BaseLayer = BaseLayer{Payload: data} - return nil -} - -type Dot11DataQOSData struct { - Dot11DataQOS -} - -func decodeDot11DataQOSData(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11DataQOSData{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11DataQOSData) LayerType() gopacket.LayerType { return LayerTypeDot11DataQOSData } -func (m *Dot11DataQOSData) CanDecode() gopacket.LayerClass { return LayerTypeDot11DataQOSData } - -func (m *Dot11DataQOSData) NextLayerType() gopacket.LayerType { - return LayerTypeDot11Data -} - -type Dot11DataQOSDataCFAck struct { - Dot11DataQOS -} - -func decodeDot11DataQOSDataCFAck(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11DataQOSDataCFAck{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11DataQOSDataCFAck) LayerType() gopacket.LayerType { return LayerTypeDot11DataQOSDataCFAck } -func (m *Dot11DataQOSDataCFAck) CanDecode() gopacket.LayerClass { - return LayerTypeDot11DataQOSDataCFAck -} -func (m *Dot11DataQOSDataCFAck) NextLayerType() gopacket.LayerType { return LayerTypeDot11DataCFAck } - -type Dot11DataQOSDataCFPoll struct { - Dot11DataQOS -} - -func decodeDot11DataQOSDataCFPoll(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11DataQOSDataCFPoll{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11DataQOSDataCFPoll) LayerType() gopacket.LayerType { - return LayerTypeDot11DataQOSDataCFPoll -} -func (m *Dot11DataQOSDataCFPoll) CanDecode() gopacket.LayerClass { - return LayerTypeDot11DataQOSDataCFPoll -} -func (m *Dot11DataQOSDataCFPoll) NextLayerType() gopacket.LayerType { return LayerTypeDot11DataCFPoll } - -type Dot11DataQOSDataCFAckPoll struct { - Dot11DataQOS -} - -func decodeDot11DataQOSDataCFAckPoll(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11DataQOSDataCFAckPoll{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11DataQOSDataCFAckPoll) LayerType() gopacket.LayerType { - return LayerTypeDot11DataQOSDataCFAckPoll -} -func (m *Dot11DataQOSDataCFAckPoll) CanDecode() gopacket.LayerClass { - return LayerTypeDot11DataQOSDataCFAckPoll -} -func (m *Dot11DataQOSDataCFAckPoll) NextLayerType() gopacket.LayerType { - return LayerTypeDot11DataCFAckPoll -} - -type Dot11DataQOSNull struct { - Dot11DataQOS -} - -func decodeDot11DataQOSNull(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11DataQOSNull{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11DataQOSNull) LayerType() gopacket.LayerType { return LayerTypeDot11DataQOSNull } -func (m *Dot11DataQOSNull) CanDecode() gopacket.LayerClass { return LayerTypeDot11DataQOSNull } -func (m *Dot11DataQOSNull) NextLayerType() gopacket.LayerType { return LayerTypeDot11DataNull } - -type Dot11DataQOSCFPollNoData struct { - Dot11DataQOS -} - -func decodeDot11DataQOSCFPollNoData(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11DataQOSCFPollNoData{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11DataQOSCFPollNoData) LayerType() gopacket.LayerType { - return LayerTypeDot11DataQOSCFPollNoData -} -func (m *Dot11DataQOSCFPollNoData) CanDecode() gopacket.LayerClass { - return LayerTypeDot11DataQOSCFPollNoData -} -func (m *Dot11DataQOSCFPollNoData) NextLayerType() gopacket.LayerType { - return LayerTypeDot11DataCFPollNoData -} - -type Dot11DataQOSCFAckPollNoData struct { - Dot11DataQOS -} - -func decodeDot11DataQOSCFAckPollNoData(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11DataQOSCFAckPollNoData{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11DataQOSCFAckPollNoData) LayerType() gopacket.LayerType { - return LayerTypeDot11DataQOSCFAckPollNoData -} -func (m *Dot11DataQOSCFAckPollNoData) CanDecode() gopacket.LayerClass { - return LayerTypeDot11DataQOSCFAckPollNoData -} -func (m *Dot11DataQOSCFAckPollNoData) NextLayerType() gopacket.LayerType { - return LayerTypeDot11DataCFAckPollNoData -} - -type Dot11InformationElement struct { - BaseLayer - ID Dot11InformationElementID - Length uint8 - OUI []byte - Info []byte -} - -func (m *Dot11InformationElement) LayerType() gopacket.LayerType { - return LayerTypeDot11InformationElement -} -func (m *Dot11InformationElement) CanDecode() gopacket.LayerClass { - return LayerTypeDot11InformationElement -} - -func (m *Dot11InformationElement) NextLayerType() gopacket.LayerType { - return LayerTypeDot11InformationElement -} - -func (m *Dot11InformationElement) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 2 { - df.SetTruncated() - return fmt.Errorf("Dot11InformationElement length %v too short, %v required", len(data), 2) - } - m.ID = Dot11InformationElementID(data[0]) - m.Length = data[1] - offset := int(2) - - if len(data) < offset+int(m.Length) { - df.SetTruncated() - return fmt.Errorf("Dot11InformationElement length %v too short, %v required", len(data), offset+int(m.Length)) - } - if len(data) < offset+4 { - df.SetTruncated() - return fmt.Errorf("vendor extension size < %d", offset+int(m.Length)) - } - if m.ID == 221 { - // Vendor extension - m.OUI = data[offset : offset+4] - m.Info = data[offset+4 : offset+int(m.Length)] - } else { - m.Info = data[offset : offset+int(m.Length)] - } - - offset += int(m.Length) - - m.BaseLayer = BaseLayer{Contents: data[:offset], Payload: data[offset:]} - return nil -} - -func (d *Dot11InformationElement) String() string { - if d.ID == 0 { - return fmt.Sprintf("802.11 Information Element (ID: %v, Length: %v, SSID: %v)", d.ID, d.Length, string(d.Info)) - } else if d.ID == 1 { - rates := "" - for i := 0; i < len(d.Info); i++ { - if d.Info[i]&0x80 == 0 { - rates += fmt.Sprintf("%.1f ", float32(d.Info[i])*0.5) - } else { - rates += fmt.Sprintf("%.1f* ", float32(d.Info[i]&0x7F)*0.5) - } - } - return fmt.Sprintf("802.11 Information Element (ID: %v, Length: %v, Rates: %s Mbit)", d.ID, d.Length, rates) - } else if d.ID == 221 { - return fmt.Sprintf("802.11 Information Element (ID: %v, Length: %v, OUI: %X, Info: %X)", d.ID, d.Length, d.OUI, d.Info) - } else { - return fmt.Sprintf("802.11 Information Element (ID: %v, Length: %v, Info: %X)", d.ID, d.Length, d.Info) - } -} - -func (m Dot11InformationElement) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - length := len(m.Info) + len(m.OUI) - if buf, err := b.PrependBytes(2 + length); err != nil { - return err - } else { - buf[0] = uint8(m.ID) - buf[1] = uint8(length) - copy(buf[2:], m.OUI) - copy(buf[2+len(m.OUI):], m.Info) - } - return nil -} - -func decodeDot11InformationElement(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11InformationElement{} - return decodingLayerDecoder(d, data, p) -} - -type Dot11CtrlCTS struct { - Dot11Ctrl -} - -func decodeDot11CtrlCTS(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11CtrlCTS{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11CtrlCTS) LayerType() gopacket.LayerType { - return LayerTypeDot11CtrlCTS -} -func (m *Dot11CtrlCTS) CanDecode() gopacket.LayerClass { - return LayerTypeDot11CtrlCTS -} -func (m *Dot11CtrlCTS) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - return m.Dot11Ctrl.DecodeFromBytes(data, df) -} - -type Dot11CtrlRTS struct { - Dot11Ctrl -} - -func decodeDot11CtrlRTS(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11CtrlRTS{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11CtrlRTS) LayerType() gopacket.LayerType { - return LayerTypeDot11CtrlRTS -} -func (m *Dot11CtrlRTS) CanDecode() gopacket.LayerClass { - return LayerTypeDot11CtrlRTS -} -func (m *Dot11CtrlRTS) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - return m.Dot11Ctrl.DecodeFromBytes(data, df) -} - -type Dot11CtrlBlockAckReq struct { - Dot11Ctrl -} - -func decodeDot11CtrlBlockAckReq(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11CtrlBlockAckReq{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11CtrlBlockAckReq) LayerType() gopacket.LayerType { - return LayerTypeDot11CtrlBlockAckReq -} -func (m *Dot11CtrlBlockAckReq) CanDecode() gopacket.LayerClass { - return LayerTypeDot11CtrlBlockAckReq -} -func (m *Dot11CtrlBlockAckReq) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - return m.Dot11Ctrl.DecodeFromBytes(data, df) -} - -type Dot11CtrlBlockAck struct { - Dot11Ctrl -} - -func decodeDot11CtrlBlockAck(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11CtrlBlockAck{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11CtrlBlockAck) LayerType() gopacket.LayerType { return LayerTypeDot11CtrlBlockAck } -func (m *Dot11CtrlBlockAck) CanDecode() gopacket.LayerClass { return LayerTypeDot11CtrlBlockAck } -func (m *Dot11CtrlBlockAck) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - return m.Dot11Ctrl.DecodeFromBytes(data, df) -} - -type Dot11CtrlPowersavePoll struct { - Dot11Ctrl -} - -func decodeDot11CtrlPowersavePoll(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11CtrlPowersavePoll{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11CtrlPowersavePoll) LayerType() gopacket.LayerType { - return LayerTypeDot11CtrlPowersavePoll -} -func (m *Dot11CtrlPowersavePoll) CanDecode() gopacket.LayerClass { - return LayerTypeDot11CtrlPowersavePoll -} -func (m *Dot11CtrlPowersavePoll) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - return m.Dot11Ctrl.DecodeFromBytes(data, df) -} - -type Dot11CtrlAck struct { - Dot11Ctrl -} - -func decodeDot11CtrlAck(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11CtrlAck{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11CtrlAck) LayerType() gopacket.LayerType { return LayerTypeDot11CtrlAck } -func (m *Dot11CtrlAck) CanDecode() gopacket.LayerClass { return LayerTypeDot11CtrlAck } -func (m *Dot11CtrlAck) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - return m.Dot11Ctrl.DecodeFromBytes(data, df) -} - -type Dot11CtrlCFEnd struct { - Dot11Ctrl -} - -func decodeDot11CtrlCFEnd(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11CtrlCFEnd{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11CtrlCFEnd) LayerType() gopacket.LayerType { - return LayerTypeDot11CtrlCFEnd -} -func (m *Dot11CtrlCFEnd) CanDecode() gopacket.LayerClass { - return LayerTypeDot11CtrlCFEnd -} -func (m *Dot11CtrlCFEnd) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - return m.Dot11Ctrl.DecodeFromBytes(data, df) -} - -type Dot11CtrlCFEndAck struct { - Dot11Ctrl -} - -func decodeDot11CtrlCFEndAck(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11CtrlCFEndAck{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11CtrlCFEndAck) LayerType() gopacket.LayerType { - return LayerTypeDot11CtrlCFEndAck -} -func (m *Dot11CtrlCFEndAck) CanDecode() gopacket.LayerClass { - return LayerTypeDot11CtrlCFEndAck -} -func (m *Dot11CtrlCFEndAck) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - return m.Dot11Ctrl.DecodeFromBytes(data, df) -} - -type Dot11MgmtAssociationReq struct { - Dot11Mgmt - CapabilityInfo uint16 - ListenInterval uint16 -} - -func decodeDot11MgmtAssociationReq(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11MgmtAssociationReq{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11MgmtAssociationReq) LayerType() gopacket.LayerType { - return LayerTypeDot11MgmtAssociationReq -} -func (m *Dot11MgmtAssociationReq) CanDecode() gopacket.LayerClass { - return LayerTypeDot11MgmtAssociationReq -} -func (m *Dot11MgmtAssociationReq) NextLayerType() gopacket.LayerType { - return LayerTypeDot11InformationElement -} -func (m *Dot11MgmtAssociationReq) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 4 { - df.SetTruncated() - return fmt.Errorf("Dot11MgmtAssociationReq length %v too short, %v required", len(data), 4) - } - m.CapabilityInfo = binary.LittleEndian.Uint16(data[0:2]) - m.ListenInterval = binary.LittleEndian.Uint16(data[2:4]) - m.Payload = data[4:] - return m.Dot11Mgmt.DecodeFromBytes(data, df) -} - -func (m Dot11MgmtAssociationReq) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - buf, err := b.PrependBytes(4) - - if err != nil { - return err - } - - binary.LittleEndian.PutUint16(buf[0:2], m.CapabilityInfo) - binary.LittleEndian.PutUint16(buf[2:4], m.ListenInterval) - - return nil -} - -type Dot11MgmtAssociationResp struct { - Dot11Mgmt - CapabilityInfo uint16 - Status Dot11Status - AID uint16 -} - -func decodeDot11MgmtAssociationResp(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11MgmtAssociationResp{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11MgmtAssociationResp) CanDecode() gopacket.LayerClass { - return LayerTypeDot11MgmtAssociationResp -} -func (m *Dot11MgmtAssociationResp) LayerType() gopacket.LayerType { - return LayerTypeDot11MgmtAssociationResp -} -func (m *Dot11MgmtAssociationResp) NextLayerType() gopacket.LayerType { - return LayerTypeDot11InformationElement -} -func (m *Dot11MgmtAssociationResp) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 6 { - df.SetTruncated() - return fmt.Errorf("Dot11MgmtAssociationResp length %v too short, %v required", len(data), 6) - } - m.CapabilityInfo = binary.LittleEndian.Uint16(data[0:2]) - m.Status = Dot11Status(binary.LittleEndian.Uint16(data[2:4])) - m.AID = binary.LittleEndian.Uint16(data[4:6]) - m.Payload = data[6:] - return m.Dot11Mgmt.DecodeFromBytes(data, df) -} - -func (m Dot11MgmtAssociationResp) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - buf, err := b.PrependBytes(6) - - if err != nil { - return err - } - - binary.LittleEndian.PutUint16(buf[0:2], m.CapabilityInfo) - binary.LittleEndian.PutUint16(buf[2:4], uint16(m.Status)) - binary.LittleEndian.PutUint16(buf[4:6], m.AID) - - return nil -} - -type Dot11MgmtReassociationReq struct { - Dot11Mgmt - CapabilityInfo uint16 - ListenInterval uint16 - CurrentApAddress net.HardwareAddr -} - -func decodeDot11MgmtReassociationReq(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11MgmtReassociationReq{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11MgmtReassociationReq) LayerType() gopacket.LayerType { - return LayerTypeDot11MgmtReassociationReq -} -func (m *Dot11MgmtReassociationReq) CanDecode() gopacket.LayerClass { - return LayerTypeDot11MgmtReassociationReq -} -func (m *Dot11MgmtReassociationReq) NextLayerType() gopacket.LayerType { - return LayerTypeDot11InformationElement -} -func (m *Dot11MgmtReassociationReq) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 10 { - df.SetTruncated() - return fmt.Errorf("Dot11MgmtReassociationReq length %v too short, %v required", len(data), 10) - } - m.CapabilityInfo = binary.LittleEndian.Uint16(data[0:2]) - m.ListenInterval = binary.LittleEndian.Uint16(data[2:4]) - m.CurrentApAddress = net.HardwareAddr(data[4:10]) - m.Payload = data[10:] - return m.Dot11Mgmt.DecodeFromBytes(data, df) -} - -func (m Dot11MgmtReassociationReq) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - buf, err := b.PrependBytes(10) - - if err != nil { - return err - } - - binary.LittleEndian.PutUint16(buf[0:2], m.CapabilityInfo) - binary.LittleEndian.PutUint16(buf[2:4], m.ListenInterval) - - copy(buf[4:10], m.CurrentApAddress) - - return nil -} - -type Dot11MgmtReassociationResp struct { - Dot11Mgmt -} - -func decodeDot11MgmtReassociationResp(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11MgmtReassociationResp{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11MgmtReassociationResp) LayerType() gopacket.LayerType { - return LayerTypeDot11MgmtReassociationResp -} -func (m *Dot11MgmtReassociationResp) CanDecode() gopacket.LayerClass { - return LayerTypeDot11MgmtReassociationResp -} -func (m *Dot11MgmtReassociationResp) NextLayerType() gopacket.LayerType { - return LayerTypeDot11InformationElement -} - -type Dot11MgmtProbeReq struct { - Dot11Mgmt -} - -func decodeDot11MgmtProbeReq(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11MgmtProbeReq{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11MgmtProbeReq) LayerType() gopacket.LayerType { return LayerTypeDot11MgmtProbeReq } -func (m *Dot11MgmtProbeReq) CanDecode() gopacket.LayerClass { return LayerTypeDot11MgmtProbeReq } -func (m *Dot11MgmtProbeReq) NextLayerType() gopacket.LayerType { - return LayerTypeDot11InformationElement -} - -type Dot11MgmtProbeResp struct { - Dot11Mgmt - Timestamp uint64 - Interval uint16 - Flags uint16 -} - -func decodeDot11MgmtProbeResp(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11MgmtProbeResp{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11MgmtProbeResp) LayerType() gopacket.LayerType { return LayerTypeDot11MgmtProbeResp } -func (m *Dot11MgmtProbeResp) CanDecode() gopacket.LayerClass { return LayerTypeDot11MgmtProbeResp } -func (m *Dot11MgmtProbeResp) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 12 { - df.SetTruncated() - - return fmt.Errorf("Dot11MgmtProbeResp length %v too short, %v required", len(data), 12) - } - - m.Timestamp = binary.LittleEndian.Uint64(data[0:8]) - m.Interval = binary.LittleEndian.Uint16(data[8:10]) - m.Flags = binary.LittleEndian.Uint16(data[10:12]) - m.Payload = data[12:] - - return m.Dot11Mgmt.DecodeFromBytes(data, df) -} - -func (m *Dot11MgmtProbeResp) NextLayerType() gopacket.LayerType { - return LayerTypeDot11InformationElement -} - -func (m Dot11MgmtProbeResp) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - buf, err := b.PrependBytes(12) - - if err != nil { - return err - } - - binary.LittleEndian.PutUint64(buf[0:8], m.Timestamp) - binary.LittleEndian.PutUint16(buf[8:10], m.Interval) - binary.LittleEndian.PutUint16(buf[10:12], m.Flags) - - return nil -} - -type Dot11MgmtMeasurementPilot struct { - Dot11Mgmt -} - -func decodeDot11MgmtMeasurementPilot(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11MgmtMeasurementPilot{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11MgmtMeasurementPilot) LayerType() gopacket.LayerType { - return LayerTypeDot11MgmtMeasurementPilot -} -func (m *Dot11MgmtMeasurementPilot) CanDecode() gopacket.LayerClass { - return LayerTypeDot11MgmtMeasurementPilot -} - -type Dot11MgmtBeacon struct { - Dot11Mgmt - Timestamp uint64 - Interval uint16 - Flags uint16 -} - -func decodeDot11MgmtBeacon(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11MgmtBeacon{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11MgmtBeacon) LayerType() gopacket.LayerType { return LayerTypeDot11MgmtBeacon } -func (m *Dot11MgmtBeacon) CanDecode() gopacket.LayerClass { return LayerTypeDot11MgmtBeacon } -func (m *Dot11MgmtBeacon) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 12 { - df.SetTruncated() - return fmt.Errorf("Dot11MgmtBeacon length %v too short, %v required", len(data), 12) - } - m.Timestamp = binary.LittleEndian.Uint64(data[0:8]) - m.Interval = binary.LittleEndian.Uint16(data[8:10]) - m.Flags = binary.LittleEndian.Uint16(data[10:12]) - m.Payload = data[12:] - return m.Dot11Mgmt.DecodeFromBytes(data, df) -} - -func (m *Dot11MgmtBeacon) NextLayerType() gopacket.LayerType { return LayerTypeDot11InformationElement } - -func (m Dot11MgmtBeacon) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - buf, err := b.PrependBytes(12) - - if err != nil { - return err - } - - binary.LittleEndian.PutUint64(buf[0:8], m.Timestamp) - binary.LittleEndian.PutUint16(buf[8:10], m.Interval) - binary.LittleEndian.PutUint16(buf[10:12], m.Flags) - - return nil -} - -type Dot11MgmtATIM struct { - Dot11Mgmt -} - -func decodeDot11MgmtATIM(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11MgmtATIM{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11MgmtATIM) LayerType() gopacket.LayerType { return LayerTypeDot11MgmtATIM } -func (m *Dot11MgmtATIM) CanDecode() gopacket.LayerClass { return LayerTypeDot11MgmtATIM } - -type Dot11MgmtDisassociation struct { - Dot11Mgmt - Reason Dot11Reason -} - -func decodeDot11MgmtDisassociation(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11MgmtDisassociation{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11MgmtDisassociation) LayerType() gopacket.LayerType { - return LayerTypeDot11MgmtDisassociation -} -func (m *Dot11MgmtDisassociation) CanDecode() gopacket.LayerClass { - return LayerTypeDot11MgmtDisassociation -} -func (m *Dot11MgmtDisassociation) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 2 { - df.SetTruncated() - return fmt.Errorf("Dot11MgmtDisassociation length %v too short, %v required", len(data), 2) - } - m.Reason = Dot11Reason(binary.LittleEndian.Uint16(data[0:2])) - return m.Dot11Mgmt.DecodeFromBytes(data, df) -} - -func (m Dot11MgmtDisassociation) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - buf, err := b.PrependBytes(2) - - if err != nil { - return err - } - - binary.LittleEndian.PutUint16(buf[0:2], uint16(m.Reason)) - - return nil -} - -type Dot11MgmtAuthentication struct { - Dot11Mgmt - Algorithm Dot11Algorithm - Sequence uint16 - Status Dot11Status -} - -func decodeDot11MgmtAuthentication(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11MgmtAuthentication{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11MgmtAuthentication) LayerType() gopacket.LayerType { - return LayerTypeDot11MgmtAuthentication -} -func (m *Dot11MgmtAuthentication) CanDecode() gopacket.LayerClass { - return LayerTypeDot11MgmtAuthentication -} -func (m *Dot11MgmtAuthentication) NextLayerType() gopacket.LayerType { - return LayerTypeDot11InformationElement -} -func (m *Dot11MgmtAuthentication) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 6 { - df.SetTruncated() - return fmt.Errorf("Dot11MgmtAuthentication length %v too short, %v required", len(data), 6) - } - m.Algorithm = Dot11Algorithm(binary.LittleEndian.Uint16(data[0:2])) - m.Sequence = binary.LittleEndian.Uint16(data[2:4]) - m.Status = Dot11Status(binary.LittleEndian.Uint16(data[4:6])) - m.Payload = data[6:] - return m.Dot11Mgmt.DecodeFromBytes(data, df) -} - -func (m Dot11MgmtAuthentication) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - buf, err := b.PrependBytes(6) - - if err != nil { - return err - } - - binary.LittleEndian.PutUint16(buf[0:2], uint16(m.Algorithm)) - binary.LittleEndian.PutUint16(buf[2:4], m.Sequence) - binary.LittleEndian.PutUint16(buf[4:6], uint16(m.Status)) - - return nil -} - -type Dot11MgmtDeauthentication struct { - Dot11Mgmt - Reason Dot11Reason -} - -func decodeDot11MgmtDeauthentication(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11MgmtDeauthentication{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11MgmtDeauthentication) LayerType() gopacket.LayerType { - return LayerTypeDot11MgmtDeauthentication -} -func (m *Dot11MgmtDeauthentication) CanDecode() gopacket.LayerClass { - return LayerTypeDot11MgmtDeauthentication -} -func (m *Dot11MgmtDeauthentication) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 2 { - df.SetTruncated() - return fmt.Errorf("Dot11MgmtDeauthentication length %v too short, %v required", len(data), 2) - } - m.Reason = Dot11Reason(binary.LittleEndian.Uint16(data[0:2])) - return m.Dot11Mgmt.DecodeFromBytes(data, df) -} - -func (m Dot11MgmtDeauthentication) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - buf, err := b.PrependBytes(2) - - if err != nil { - return err - } - - binary.LittleEndian.PutUint16(buf[0:2], uint16(m.Reason)) - - return nil -} - -type Dot11MgmtAction struct { - Dot11Mgmt -} - -func decodeDot11MgmtAction(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11MgmtAction{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11MgmtAction) LayerType() gopacket.LayerType { return LayerTypeDot11MgmtAction } -func (m *Dot11MgmtAction) CanDecode() gopacket.LayerClass { return LayerTypeDot11MgmtAction } - -type Dot11MgmtActionNoAck struct { - Dot11Mgmt -} - -func decodeDot11MgmtActionNoAck(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11MgmtActionNoAck{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11MgmtActionNoAck) LayerType() gopacket.LayerType { return LayerTypeDot11MgmtActionNoAck } -func (m *Dot11MgmtActionNoAck) CanDecode() gopacket.LayerClass { return LayerTypeDot11MgmtActionNoAck } - -type Dot11MgmtArubaWLAN struct { - Dot11Mgmt -} - -func decodeDot11MgmtArubaWLAN(data []byte, p gopacket.PacketBuilder) error { - d := &Dot11MgmtArubaWLAN{} - return decodingLayerDecoder(d, data, p) -} - -func (m *Dot11MgmtArubaWLAN) LayerType() gopacket.LayerType { return LayerTypeDot11MgmtArubaWLAN } -func (m *Dot11MgmtArubaWLAN) CanDecode() gopacket.LayerClass { return LayerTypeDot11MgmtArubaWLAN } diff --git a/vendor/github.com/google/gopacket/layers/dot1q.go b/vendor/github.com/google/gopacket/layers/dot1q.go deleted file mode 100644 index 5cdd2f8d6..000000000 --- a/vendor/github.com/google/gopacket/layers/dot1q.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// Copyright 2009-2011 Andreas Krennmair. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "fmt" - "github.com/google/gopacket" -) - -// Dot1Q is the packet layer for 802.1Q VLAN headers. -type Dot1Q struct { - BaseLayer - Priority uint8 - DropEligible bool - VLANIdentifier uint16 - Type EthernetType -} - -// LayerType returns gopacket.LayerTypeDot1Q -func (d *Dot1Q) LayerType() gopacket.LayerType { return LayerTypeDot1Q } - -// DecodeFromBytes decodes the given bytes into this layer. -func (d *Dot1Q) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 4 { - df.SetTruncated() - return fmt.Errorf("802.1Q tag length %d too short", len(data)) - } - d.Priority = (data[0] & 0xE0) >> 5 - d.DropEligible = data[0]&0x10 != 0 - d.VLANIdentifier = binary.BigEndian.Uint16(data[:2]) & 0x0FFF - d.Type = EthernetType(binary.BigEndian.Uint16(data[2:4])) - d.BaseLayer = BaseLayer{Contents: data[:4], Payload: data[4:]} - return nil -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (d *Dot1Q) CanDecode() gopacket.LayerClass { - return LayerTypeDot1Q -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (d *Dot1Q) NextLayerType() gopacket.LayerType { - return d.Type.LayerType() -} - -func decodeDot1Q(data []byte, p gopacket.PacketBuilder) error { - d := &Dot1Q{} - return decodingLayerDecoder(d, data, p) -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (d *Dot1Q) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - bytes, err := b.PrependBytes(4) - if err != nil { - return err - } - if d.VLANIdentifier > 0xFFF { - return fmt.Errorf("vlan identifier %v is too high", d.VLANIdentifier) - } - firstBytes := uint16(d.Priority)<<13 | d.VLANIdentifier - if d.DropEligible { - firstBytes |= 0x1000 - } - binary.BigEndian.PutUint16(bytes, firstBytes) - binary.BigEndian.PutUint16(bytes[2:], uint16(d.Type)) - return nil -} diff --git a/vendor/github.com/google/gopacket/layers/eap.go b/vendor/github.com/google/gopacket/layers/eap.go deleted file mode 100644 index 54238e8c7..000000000 --- a/vendor/github.com/google/gopacket/layers/eap.go +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "fmt" - "github.com/google/gopacket" -) - -type EAPCode uint8 -type EAPType uint8 - -const ( - EAPCodeRequest EAPCode = 1 - EAPCodeResponse EAPCode = 2 - EAPCodeSuccess EAPCode = 3 - EAPCodeFailure EAPCode = 4 - - // EAPTypeNone means that this EAP layer has no Type or TypeData. - // Success and Failure EAPs will have this set. - EAPTypeNone EAPType = 0 - - EAPTypeIdentity EAPType = 1 - EAPTypeNotification EAPType = 2 - EAPTypeNACK EAPType = 3 - EAPTypeOTP EAPType = 4 - EAPTypeTokenCard EAPType = 5 -) - -// EAP defines an Extensible Authentication Protocol (rfc 3748) layer. -type EAP struct { - BaseLayer - Code EAPCode - Id uint8 - Length uint16 - Type EAPType - TypeData []byte -} - -// LayerType returns LayerTypeEAP. -func (e *EAP) LayerType() gopacket.LayerType { return LayerTypeEAP } - -// DecodeFromBytes decodes the given bytes into this layer. -func (e *EAP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 4 { - df.SetTruncated() - return fmt.Errorf("EAP length %d too short", len(data)) - } - e.Code = EAPCode(data[0]) - e.Id = data[1] - e.Length = binary.BigEndian.Uint16(data[2:4]) - if len(data) < int(e.Length) { - df.SetTruncated() - return fmt.Errorf("EAP length %d too short, %d expected", len(data), e.Length) - } - switch { - case e.Length > 4: - e.Type = EAPType(data[4]) - e.TypeData = data[5:] - case e.Length == 4: - e.Type = 0 - e.TypeData = nil - default: - return fmt.Errorf("invalid EAP length %d", e.Length) - } - e.BaseLayer.Contents = data[:e.Length] - e.BaseLayer.Payload = data[e.Length:] // Should be 0 bytes - return nil -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (e *EAP) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - if opts.FixLengths { - e.Length = uint16(len(e.TypeData) + 1) - } - size := len(e.TypeData) + 4 - if size > 4 { - size++ - } - bytes, err := b.PrependBytes(size) - if err != nil { - return err - } - bytes[0] = byte(e.Code) - bytes[1] = e.Id - binary.BigEndian.PutUint16(bytes[2:], e.Length) - if size > 4 { - bytes[4] = byte(e.Type) - copy(bytes[5:], e.TypeData) - } - return nil -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (e *EAP) CanDecode() gopacket.LayerClass { - return LayerTypeEAP -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (e *EAP) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypeZero -} - -func decodeEAP(data []byte, p gopacket.PacketBuilder) error { - e := &EAP{} - return decodingLayerDecoder(e, data, p) -} diff --git a/vendor/github.com/google/gopacket/layers/eapol.go b/vendor/github.com/google/gopacket/layers/eapol.go deleted file mode 100644 index 902598a20..000000000 --- a/vendor/github.com/google/gopacket/layers/eapol.go +++ /dev/null @@ -1,302 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "fmt" - "github.com/google/gopacket" -) - -// EAPOL defines an EAP over LAN (802.1x) layer. -type EAPOL struct { - BaseLayer - Version uint8 - Type EAPOLType - Length uint16 -} - -// LayerType returns LayerTypeEAPOL. -func (e *EAPOL) LayerType() gopacket.LayerType { return LayerTypeEAPOL } - -// DecodeFromBytes decodes the given bytes into this layer. -func (e *EAPOL) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 4 { - df.SetTruncated() - return fmt.Errorf("EAPOL length %d too short", len(data)) - } - e.Version = data[0] - e.Type = EAPOLType(data[1]) - e.Length = binary.BigEndian.Uint16(data[2:4]) - e.BaseLayer = BaseLayer{data[:4], data[4:]} - return nil -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer -func (e *EAPOL) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - bytes, _ := b.PrependBytes(4) - bytes[0] = e.Version - bytes[1] = byte(e.Type) - binary.BigEndian.PutUint16(bytes[2:], e.Length) - return nil -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (e *EAPOL) CanDecode() gopacket.LayerClass { - return LayerTypeEAPOL -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (e *EAPOL) NextLayerType() gopacket.LayerType { - return e.Type.LayerType() -} - -func decodeEAPOL(data []byte, p gopacket.PacketBuilder) error { - e := &EAPOL{} - return decodingLayerDecoder(e, data, p) -} - -// EAPOLKeyDescriptorType is an enumeration of key descriptor types -// as specified by 802.1x in the EAPOL-Key frame -type EAPOLKeyDescriptorType uint8 - -// Enumeration of EAPOLKeyDescriptorType -const ( - EAPOLKeyDescriptorTypeRC4 EAPOLKeyDescriptorType = 1 - EAPOLKeyDescriptorTypeDot11 EAPOLKeyDescriptorType = 2 - EAPOLKeyDescriptorTypeWPA EAPOLKeyDescriptorType = 254 -) - -func (kdt EAPOLKeyDescriptorType) String() string { - switch kdt { - case EAPOLKeyDescriptorTypeRC4: - return "RC4" - case EAPOLKeyDescriptorTypeDot11: - return "802.11" - case EAPOLKeyDescriptorTypeWPA: - return "WPA" - default: - return fmt.Sprintf("unknown descriptor type %d", kdt) - } -} - -// EAPOLKeyDescriptorVersion is an enumeration of versions specifying the -// encryption algorithm for the key data and the authentication for the -// message integrity code (MIC) -type EAPOLKeyDescriptorVersion uint8 - -// Enumeration of EAPOLKeyDescriptorVersion -const ( - EAPOLKeyDescriptorVersionOther EAPOLKeyDescriptorVersion = 0 - EAPOLKeyDescriptorVersionRC4HMACMD5 EAPOLKeyDescriptorVersion = 1 - EAPOLKeyDescriptorVersionAESHMACSHA1 EAPOLKeyDescriptorVersion = 2 - EAPOLKeyDescriptorVersionAES128CMAC EAPOLKeyDescriptorVersion = 3 -) - -func (v EAPOLKeyDescriptorVersion) String() string { - switch v { - case EAPOLKeyDescriptorVersionOther: - return "Other" - case EAPOLKeyDescriptorVersionRC4HMACMD5: - return "RC4-HMAC-MD5" - case EAPOLKeyDescriptorVersionAESHMACSHA1: - return "AES-HMAC-SHA1-128" - case EAPOLKeyDescriptorVersionAES128CMAC: - return "AES-128-CMAC" - default: - return fmt.Sprintf("unknown version %d", v) - } -} - -// EAPOLKeyType is an enumeration of key derivation types describing -// the purpose of the keys being derived. -type EAPOLKeyType uint8 - -// Enumeration of EAPOLKeyType -const ( - EAPOLKeyTypeGroupSMK EAPOLKeyType = 0 - EAPOLKeyTypePairwise EAPOLKeyType = 1 -) - -func (kt EAPOLKeyType) String() string { - switch kt { - case EAPOLKeyTypeGroupSMK: - return "Group/SMK" - case EAPOLKeyTypePairwise: - return "Pairwise" - default: - return fmt.Sprintf("unknown key type %d", kt) - } -} - -// EAPOLKey defines an EAPOL-Key frame for 802.1x authentication -type EAPOLKey struct { - BaseLayer - KeyDescriptorType EAPOLKeyDescriptorType - KeyDescriptorVersion EAPOLKeyDescriptorVersion - KeyType EAPOLKeyType - KeyIndex uint8 - Install bool - KeyACK bool - KeyMIC bool - Secure bool - MICError bool - Request bool - HasEncryptedKeyData bool - SMKMessage bool - KeyLength uint16 - ReplayCounter uint64 - Nonce []byte - IV []byte - RSC uint64 - ID uint64 - MIC []byte - KeyDataLength uint16 - EncryptedKeyData []byte -} - -// LayerType returns LayerTypeEAPOLKey. -func (ek *EAPOLKey) LayerType() gopacket.LayerType { - return LayerTypeEAPOLKey -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (ek *EAPOLKey) CanDecode() gopacket.LayerType { - return LayerTypeEAPOLKey -} - -// NextLayerType returns layers.LayerTypeDot11InformationElement if the key -// data exists and is unencrypted, otherwise it does not expect a next layer. -func (ek *EAPOLKey) NextLayerType() gopacket.LayerType { - if !ek.HasEncryptedKeyData && ek.KeyDataLength > 0 { - return LayerTypeDot11InformationElement - } - return gopacket.LayerTypePayload -} - -const eapolKeyFrameLen = 95 - -// DecodeFromBytes decodes the given bytes into this layer. -func (ek *EAPOLKey) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < eapolKeyFrameLen { - df.SetTruncated() - return fmt.Errorf("EAPOLKey length %v too short, %v required", - len(data), eapolKeyFrameLen) - } - - ek.KeyDescriptorType = EAPOLKeyDescriptorType(data[0]) - - info := binary.BigEndian.Uint16(data[1:3]) - ek.KeyDescriptorVersion = EAPOLKeyDescriptorVersion(info & 0x0007) - ek.KeyType = EAPOLKeyType((info & 0x0008) >> 3) - ek.KeyIndex = uint8((info & 0x0030) >> 4) - ek.Install = (info & 0x0040) != 0 - ek.KeyACK = (info & 0x0080) != 0 - ek.KeyMIC = (info & 0x0100) != 0 - ek.Secure = (info & 0x0200) != 0 - ek.MICError = (info & 0x0400) != 0 - ek.Request = (info & 0x0800) != 0 - ek.HasEncryptedKeyData = (info & 0x1000) != 0 - ek.SMKMessage = (info & 0x2000) != 0 - - ek.KeyLength = binary.BigEndian.Uint16(data[3:5]) - ek.ReplayCounter = binary.BigEndian.Uint64(data[5:13]) - - ek.Nonce = data[13:45] - ek.IV = data[45:61] - ek.RSC = binary.BigEndian.Uint64(data[61:69]) - ek.ID = binary.BigEndian.Uint64(data[69:77]) - ek.MIC = data[77:93] - - ek.KeyDataLength = binary.BigEndian.Uint16(data[93:95]) - - totalLength := eapolKeyFrameLen + int(ek.KeyDataLength) - if len(data) < totalLength { - df.SetTruncated() - return fmt.Errorf("EAPOLKey data length %d too short, %d required", - len(data)-eapolKeyFrameLen, ek.KeyDataLength) - } - - if ek.HasEncryptedKeyData { - ek.EncryptedKeyData = data[eapolKeyFrameLen:totalLength] - ek.BaseLayer = BaseLayer{ - Contents: data[:totalLength], - Payload: data[totalLength:], - } - } else { - ek.BaseLayer = BaseLayer{ - Contents: data[:eapolKeyFrameLen], - Payload: data[eapolKeyFrameLen:], - } - } - - return nil -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (ek *EAPOLKey) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - buf, err := b.PrependBytes(eapolKeyFrameLen + len(ek.EncryptedKeyData)) - if err != nil { - return err - } - - buf[0] = byte(ek.KeyDescriptorType) - - var info uint16 - info |= uint16(ek.KeyDescriptorVersion) - info |= uint16(ek.KeyType) << 3 - info |= uint16(ek.KeyIndex) << 4 - if ek.Install { - info |= 0x0040 - } - if ek.KeyACK { - info |= 0x0080 - } - if ek.KeyMIC { - info |= 0x0100 - } - if ek.Secure { - info |= 0x0200 - } - if ek.MICError { - info |= 0x0400 - } - if ek.Request { - info |= 0x0800 - } - if ek.HasEncryptedKeyData { - info |= 0x1000 - } - if ek.SMKMessage { - info |= 0x2000 - } - binary.BigEndian.PutUint16(buf[1:3], info) - - binary.BigEndian.PutUint16(buf[3:5], ek.KeyLength) - binary.BigEndian.PutUint64(buf[5:13], ek.ReplayCounter) - - copy(buf[13:45], ek.Nonce) - copy(buf[45:61], ek.IV) - binary.BigEndian.PutUint64(buf[61:69], ek.RSC) - binary.BigEndian.PutUint64(buf[69:77], ek.ID) - copy(buf[77:93], ek.MIC) - - binary.BigEndian.PutUint16(buf[93:95], ek.KeyDataLength) - if len(ek.EncryptedKeyData) > 0 { - copy(buf[95:95+len(ek.EncryptedKeyData)], ek.EncryptedKeyData) - } - - return nil -} - -func decodeEAPOLKey(data []byte, p gopacket.PacketBuilder) error { - ek := &EAPOLKey{} - return decodingLayerDecoder(ek, data, p) -} diff --git a/vendor/github.com/google/gopacket/layers/endpoints.go b/vendor/github.com/google/gopacket/layers/endpoints.go deleted file mode 100644 index 4c91cc332..000000000 --- a/vendor/github.com/google/gopacket/layers/endpoints.go +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "github.com/google/gopacket" - "net" - "strconv" -) - -var ( - // We use two different endpoint types for IPv4 vs IPv6 addresses, so that - // ordering with endpointA.LessThan(endpointB) sanely groups all IPv4 - // addresses and all IPv6 addresses, such that IPv6 > IPv4 for all addresses. - EndpointIPv4 = gopacket.RegisterEndpointType(1, gopacket.EndpointTypeMetadata{Name: "IPv4", Formatter: func(b []byte) string { - return net.IP(b).String() - }}) - EndpointIPv6 = gopacket.RegisterEndpointType(2, gopacket.EndpointTypeMetadata{Name: "IPv6", Formatter: func(b []byte) string { - return net.IP(b).String() - }}) - - EndpointMAC = gopacket.RegisterEndpointType(3, gopacket.EndpointTypeMetadata{Name: "MAC", Formatter: func(b []byte) string { - return net.HardwareAddr(b).String() - }}) - EndpointTCPPort = gopacket.RegisterEndpointType(4, gopacket.EndpointTypeMetadata{Name: "TCP", Formatter: func(b []byte) string { - return strconv.Itoa(int(binary.BigEndian.Uint16(b))) - }}) - EndpointUDPPort = gopacket.RegisterEndpointType(5, gopacket.EndpointTypeMetadata{Name: "UDP", Formatter: func(b []byte) string { - return strconv.Itoa(int(binary.BigEndian.Uint16(b))) - }}) - EndpointSCTPPort = gopacket.RegisterEndpointType(6, gopacket.EndpointTypeMetadata{Name: "SCTP", Formatter: func(b []byte) string { - return strconv.Itoa(int(binary.BigEndian.Uint16(b))) - }}) - EndpointRUDPPort = gopacket.RegisterEndpointType(7, gopacket.EndpointTypeMetadata{Name: "RUDP", Formatter: func(b []byte) string { - return strconv.Itoa(int(b[0])) - }}) - EndpointUDPLitePort = gopacket.RegisterEndpointType(8, gopacket.EndpointTypeMetadata{Name: "UDPLite", Formatter: func(b []byte) string { - return strconv.Itoa(int(binary.BigEndian.Uint16(b))) - }}) - EndpointPPP = gopacket.RegisterEndpointType(9, gopacket.EndpointTypeMetadata{Name: "PPP", Formatter: func([]byte) string { - return "point" - }}) -) - -// NewIPEndpoint creates a new IP (v4 or v6) endpoint from a net.IP address. -// It returns gopacket.InvalidEndpoint if the IP address is invalid. -func NewIPEndpoint(a net.IP) gopacket.Endpoint { - ipv4 := a.To4() - if ipv4 != nil { - return gopacket.NewEndpoint(EndpointIPv4, []byte(ipv4)) - } - - ipv6 := a.To16() - if ipv6 != nil { - return gopacket.NewEndpoint(EndpointIPv6, []byte(ipv6)) - } - - return gopacket.InvalidEndpoint -} - -// NewMACEndpoint returns a new MAC address endpoint. -func NewMACEndpoint(a net.HardwareAddr) gopacket.Endpoint { - return gopacket.NewEndpoint(EndpointMAC, []byte(a)) -} -func newPortEndpoint(t gopacket.EndpointType, p uint16) gopacket.Endpoint { - return gopacket.NewEndpoint(t, []byte{byte(p >> 8), byte(p)}) -} - -// NewTCPPortEndpoint returns an endpoint based on a TCP port. -func NewTCPPortEndpoint(p TCPPort) gopacket.Endpoint { - return newPortEndpoint(EndpointTCPPort, uint16(p)) -} - -// NewUDPPortEndpoint returns an endpoint based on a UDP port. -func NewUDPPortEndpoint(p UDPPort) gopacket.Endpoint { - return newPortEndpoint(EndpointUDPPort, uint16(p)) -} - -// NewSCTPPortEndpoint returns an endpoint based on a SCTP port. -func NewSCTPPortEndpoint(p SCTPPort) gopacket.Endpoint { - return newPortEndpoint(EndpointSCTPPort, uint16(p)) -} - -// NewRUDPPortEndpoint returns an endpoint based on a RUDP port. -func NewRUDPPortEndpoint(p RUDPPort) gopacket.Endpoint { - return gopacket.NewEndpoint(EndpointRUDPPort, []byte{byte(p)}) -} - -// NewUDPLitePortEndpoint returns an endpoint based on a UDPLite port. -func NewUDPLitePortEndpoint(p UDPLitePort) gopacket.Endpoint { - return newPortEndpoint(EndpointUDPLitePort, uint16(p)) -} diff --git a/vendor/github.com/google/gopacket/layers/enums.go b/vendor/github.com/google/gopacket/layers/enums.go deleted file mode 100644 index 8427bdaf4..000000000 --- a/vendor/github.com/google/gopacket/layers/enums.go +++ /dev/null @@ -1,443 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// Copyright 2009-2011 Andreas Krennmair. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "fmt" - "runtime" - - "github.com/google/gopacket" -) - -// EnumMetadata keeps track of a set of metadata for each enumeration value -// for protocol enumerations. -type EnumMetadata struct { - // DecodeWith is the decoder to use to decode this protocol's data. - DecodeWith gopacket.Decoder - // Name is the name of the enumeration value. - Name string - // LayerType is the layer type implied by the given enum. - LayerType gopacket.LayerType -} - -// EthernetType is an enumeration of ethernet type values, and acts as a decoder -// for any type it supports. -type EthernetType uint16 - -const ( - // EthernetTypeLLC is not an actual ethernet type. It is instead a - // placeholder we use in Ethernet frames that use the 802.3 standard of - // srcmac|dstmac|length|LLC instead of srcmac|dstmac|ethertype. - EthernetTypeLLC EthernetType = 0 - EthernetTypeIPv4 EthernetType = 0x0800 - EthernetTypeARP EthernetType = 0x0806 - EthernetTypeIPv6 EthernetType = 0x86DD - EthernetTypeCiscoDiscovery EthernetType = 0x2000 - EthernetTypeNortelDiscovery EthernetType = 0x01a2 - EthernetTypeTransparentEthernetBridging EthernetType = 0x6558 - EthernetTypeDot1Q EthernetType = 0x8100 - EthernetTypePPP EthernetType = 0x880b - EthernetTypePPPoEDiscovery EthernetType = 0x8863 - EthernetTypePPPoESession EthernetType = 0x8864 - EthernetTypeMPLSUnicast EthernetType = 0x8847 - EthernetTypeMPLSMulticast EthernetType = 0x8848 - EthernetTypeEAPOL EthernetType = 0x888e - EthernetTypeERSPAN EthernetType = 0x88be - EthernetTypeQinQ EthernetType = 0x88a8 - EthernetTypeLinkLayerDiscovery EthernetType = 0x88cc - EthernetTypeEthernetCTP EthernetType = 0x9000 -) - -// IPProtocol is an enumeration of IP protocol values, and acts as a decoder -// for any type it supports. -type IPProtocol uint8 - -const ( - IPProtocolIPv6HopByHop IPProtocol = 0 - IPProtocolICMPv4 IPProtocol = 1 - IPProtocolIGMP IPProtocol = 2 - IPProtocolIPv4 IPProtocol = 4 - IPProtocolTCP IPProtocol = 6 - IPProtocolUDP IPProtocol = 17 - IPProtocolRUDP IPProtocol = 27 - IPProtocolIPv6 IPProtocol = 41 - IPProtocolIPv6Routing IPProtocol = 43 - IPProtocolIPv6Fragment IPProtocol = 44 - IPProtocolGRE IPProtocol = 47 - IPProtocolESP IPProtocol = 50 - IPProtocolAH IPProtocol = 51 - IPProtocolICMPv6 IPProtocol = 58 - IPProtocolNoNextHeader IPProtocol = 59 - IPProtocolIPv6Destination IPProtocol = 60 - IPProtocolOSPF IPProtocol = 89 - IPProtocolIPIP IPProtocol = 94 - IPProtocolEtherIP IPProtocol = 97 - IPProtocolVRRP IPProtocol = 112 - IPProtocolSCTP IPProtocol = 132 - IPProtocolUDPLite IPProtocol = 136 - IPProtocolMPLSInIP IPProtocol = 137 -) - -// LinkType is an enumeration of link types, and acts as a decoder for any -// link type it supports. -type LinkType uint8 - -const ( - // According to pcap-linktype(7) and http://www.tcpdump.org/linktypes.html - LinkTypeNull LinkType = 0 - LinkTypeEthernet LinkType = 1 - LinkTypeAX25 LinkType = 3 - LinkTypeTokenRing LinkType = 6 - LinkTypeArcNet LinkType = 7 - LinkTypeSLIP LinkType = 8 - LinkTypePPP LinkType = 9 - LinkTypeFDDI LinkType = 10 - LinkTypePPP_HDLC LinkType = 50 - LinkTypePPPEthernet LinkType = 51 - LinkTypeATM_RFC1483 LinkType = 100 - LinkTypeRaw LinkType = 101 - LinkTypeC_HDLC LinkType = 104 - LinkTypeIEEE802_11 LinkType = 105 - LinkTypeFRelay LinkType = 107 - LinkTypeLoop LinkType = 108 - LinkTypeLinuxSLL LinkType = 113 - LinkTypeLTalk LinkType = 114 - LinkTypePFLog LinkType = 117 - LinkTypePrismHeader LinkType = 119 - LinkTypeIPOverFC LinkType = 122 - LinkTypeSunATM LinkType = 123 - LinkTypeIEEE80211Radio LinkType = 127 - LinkTypeARCNetLinux LinkType = 129 - LinkTypeIPOver1394 LinkType = 138 - LinkTypeMTP2Phdr LinkType = 139 - LinkTypeMTP2 LinkType = 140 - LinkTypeMTP3 LinkType = 141 - LinkTypeSCCP LinkType = 142 - LinkTypeDOCSIS LinkType = 143 - LinkTypeLinuxIRDA LinkType = 144 - LinkTypeLinuxLAPD LinkType = 177 - LinkTypeLinuxUSB LinkType = 220 - LinkTypeFC2 LinkType = 224 - LinkTypeFC2Framed LinkType = 225 - LinkTypeIPv4 LinkType = 228 - LinkTypeIPv6 LinkType = 229 -) - -// PPPoECode is the PPPoE code enum, taken from http://tools.ietf.org/html/rfc2516 -type PPPoECode uint8 - -const ( - PPPoECodePADI PPPoECode = 0x09 - PPPoECodePADO PPPoECode = 0x07 - PPPoECodePADR PPPoECode = 0x19 - PPPoECodePADS PPPoECode = 0x65 - PPPoECodePADT PPPoECode = 0xA7 - PPPoECodeSession PPPoECode = 0x00 -) - -// PPPType is an enumeration of PPP type values, and acts as a decoder for any -// type it supports. -type PPPType uint16 - -const ( - PPPTypeIPv4 PPPType = 0x0021 - PPPTypeIPv6 PPPType = 0x0057 - PPPTypeMPLSUnicast PPPType = 0x0281 - PPPTypeMPLSMulticast PPPType = 0x0283 -) - -// SCTPChunkType is an enumeration of chunk types inside SCTP packets. -type SCTPChunkType uint8 - -const ( - SCTPChunkTypeData SCTPChunkType = 0 - SCTPChunkTypeInit SCTPChunkType = 1 - SCTPChunkTypeInitAck SCTPChunkType = 2 - SCTPChunkTypeSack SCTPChunkType = 3 - SCTPChunkTypeHeartbeat SCTPChunkType = 4 - SCTPChunkTypeHeartbeatAck SCTPChunkType = 5 - SCTPChunkTypeAbort SCTPChunkType = 6 - SCTPChunkTypeShutdown SCTPChunkType = 7 - SCTPChunkTypeShutdownAck SCTPChunkType = 8 - SCTPChunkTypeError SCTPChunkType = 9 - SCTPChunkTypeCookieEcho SCTPChunkType = 10 - SCTPChunkTypeCookieAck SCTPChunkType = 11 - SCTPChunkTypeShutdownComplete SCTPChunkType = 14 -) - -// FDDIFrameControl is an enumeration of FDDI frame control bytes. -type FDDIFrameControl uint8 - -const ( - FDDIFrameControlLLC FDDIFrameControl = 0x50 -) - -// EAPOLType is an enumeration of EAPOL packet types. -type EAPOLType uint8 - -const ( - EAPOLTypeEAP EAPOLType = 0 - EAPOLTypeStart EAPOLType = 1 - EAPOLTypeLogOff EAPOLType = 2 - EAPOLTypeKey EAPOLType = 3 - EAPOLTypeASFAlert EAPOLType = 4 -) - -// ProtocolFamily is the set of values defined as PF_* in sys/socket.h -type ProtocolFamily uint8 - -const ( - ProtocolFamilyIPv4 ProtocolFamily = 2 - // BSDs use different values for INET6... glory be. These values taken from - // tcpdump 4.3.0. - ProtocolFamilyIPv6BSD ProtocolFamily = 24 - ProtocolFamilyIPv6FreeBSD ProtocolFamily = 28 - ProtocolFamilyIPv6Darwin ProtocolFamily = 30 - ProtocolFamilyIPv6Linux ProtocolFamily = 10 -) - -// Dot11Type is a combination of IEEE 802.11 frame's Type and Subtype fields. -// By combining these two fields together into a single type, we're able to -// provide a String function that correctly displays the subtype given the -// top-level type. -// -// If you just care about the top-level type, use the MainType function. -type Dot11Type uint8 - -// MainType strips the subtype information from the given type, -// returning just the overarching type (Mgmt, Ctrl, Data, Reserved). -func (d Dot11Type) MainType() Dot11Type { - return d & dot11TypeMask -} - -func (d Dot11Type) QOS() bool { - return d&dot11QOSMask == Dot11TypeDataQOSData -} - -const ( - Dot11TypeMgmt Dot11Type = 0x00 - Dot11TypeCtrl Dot11Type = 0x01 - Dot11TypeData Dot11Type = 0x02 - Dot11TypeReserved Dot11Type = 0x03 - dot11TypeMask = 0x03 - dot11QOSMask = 0x23 - - // The following are type/subtype conglomerations. - - // Management - Dot11TypeMgmtAssociationReq Dot11Type = 0x00 - Dot11TypeMgmtAssociationResp Dot11Type = 0x04 - Dot11TypeMgmtReassociationReq Dot11Type = 0x08 - Dot11TypeMgmtReassociationResp Dot11Type = 0x0c - Dot11TypeMgmtProbeReq Dot11Type = 0x10 - Dot11TypeMgmtProbeResp Dot11Type = 0x14 - Dot11TypeMgmtMeasurementPilot Dot11Type = 0x18 - Dot11TypeMgmtBeacon Dot11Type = 0x20 - Dot11TypeMgmtATIM Dot11Type = 0x24 - Dot11TypeMgmtDisassociation Dot11Type = 0x28 - Dot11TypeMgmtAuthentication Dot11Type = 0x2c - Dot11TypeMgmtDeauthentication Dot11Type = 0x30 - Dot11TypeMgmtAction Dot11Type = 0x34 - Dot11TypeMgmtActionNoAck Dot11Type = 0x38 - - // Control - Dot11TypeCtrlWrapper Dot11Type = 0x1d - Dot11TypeCtrlBlockAckReq Dot11Type = 0x21 - Dot11TypeCtrlBlockAck Dot11Type = 0x25 - Dot11TypeCtrlPowersavePoll Dot11Type = 0x29 - Dot11TypeCtrlRTS Dot11Type = 0x2d - Dot11TypeCtrlCTS Dot11Type = 0x31 - Dot11TypeCtrlAck Dot11Type = 0x35 - Dot11TypeCtrlCFEnd Dot11Type = 0x39 - Dot11TypeCtrlCFEndAck Dot11Type = 0x3d - - // Data - Dot11TypeDataCFAck Dot11Type = 0x06 - Dot11TypeDataCFPoll Dot11Type = 0x0a - Dot11TypeDataCFAckPoll Dot11Type = 0x0e - Dot11TypeDataNull Dot11Type = 0x12 - Dot11TypeDataCFAckNoData Dot11Type = 0x16 - Dot11TypeDataCFPollNoData Dot11Type = 0x1a - Dot11TypeDataCFAckPollNoData Dot11Type = 0x1e - Dot11TypeDataQOSData Dot11Type = 0x22 - Dot11TypeDataQOSDataCFAck Dot11Type = 0x26 - Dot11TypeDataQOSDataCFPoll Dot11Type = 0x2a - Dot11TypeDataQOSDataCFAckPoll Dot11Type = 0x2e - Dot11TypeDataQOSNull Dot11Type = 0x32 - Dot11TypeDataQOSCFPollNoData Dot11Type = 0x3a - Dot11TypeDataQOSCFAckPollNoData Dot11Type = 0x3e -) - -// Decode a raw v4 or v6 IP packet. -func decodeIPv4or6(data []byte, p gopacket.PacketBuilder) error { - version := data[0] >> 4 - switch version { - case 4: - return decodeIPv4(data, p) - case 6: - return decodeIPv6(data, p) - } - return fmt.Errorf("Invalid IP packet version %v", version) -} - -func initActualTypeData() { - // Each of the XXXTypeMetadata arrays contains mappings of how to handle enum - // values for various enum types in gopacket/layers. - // These arrays are actually created by gen2.go and stored in - // enums_generated.go. - // - // So, EthernetTypeMetadata[2] contains information on how to handle EthernetType - // 2, including which name to give it and which decoder to use to decode - // packet data of that type. These arrays are filled by default with all of the - // protocols gopacket/layers knows how to handle, but users of the library can - // add new decoders or override existing ones. For example, if you write a better - // TCP decoder, you can override IPProtocolMetadata[IPProtocolTCP].DecodeWith - // with your new decoder, and all gopacket/layers decoding will use your new - // decoder whenever they encounter that IPProtocol. - - // Here we link up all enumerations with their respective names and decoders. - EthernetTypeMetadata[EthernetTypeLLC] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeLLC), Name: "LLC", LayerType: LayerTypeLLC} - EthernetTypeMetadata[EthernetTypeIPv4] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeIPv4), Name: "IPv4", LayerType: LayerTypeIPv4} - EthernetTypeMetadata[EthernetTypeIPv6] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeIPv6), Name: "IPv6", LayerType: LayerTypeIPv6} - EthernetTypeMetadata[EthernetTypeARP] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeARP), Name: "ARP", LayerType: LayerTypeARP} - EthernetTypeMetadata[EthernetTypeDot1Q] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot1Q), Name: "Dot1Q", LayerType: LayerTypeDot1Q} - EthernetTypeMetadata[EthernetTypePPP] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodePPP), Name: "PPP", LayerType: LayerTypePPP} - EthernetTypeMetadata[EthernetTypePPPoEDiscovery] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodePPPoE), Name: "PPPoEDiscovery", LayerType: LayerTypePPPoE} - EthernetTypeMetadata[EthernetTypePPPoESession] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodePPPoE), Name: "PPPoESession", LayerType: LayerTypePPPoE} - EthernetTypeMetadata[EthernetTypeEthernetCTP] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeEthernetCTP), Name: "EthernetCTP", LayerType: LayerTypeEthernetCTP} - EthernetTypeMetadata[EthernetTypeCiscoDiscovery] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeCiscoDiscovery), Name: "CiscoDiscovery", LayerType: LayerTypeCiscoDiscovery} - EthernetTypeMetadata[EthernetTypeNortelDiscovery] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeNortelDiscovery), Name: "NortelDiscovery", LayerType: LayerTypeNortelDiscovery} - EthernetTypeMetadata[EthernetTypeLinkLayerDiscovery] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeLinkLayerDiscovery), Name: "LinkLayerDiscovery", LayerType: LayerTypeLinkLayerDiscovery} - EthernetTypeMetadata[EthernetTypeMPLSUnicast] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeMPLS), Name: "MPLSUnicast", LayerType: LayerTypeMPLS} - EthernetTypeMetadata[EthernetTypeMPLSMulticast] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeMPLS), Name: "MPLSMulticast", LayerType: LayerTypeMPLS} - EthernetTypeMetadata[EthernetTypeEAPOL] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeEAPOL), Name: "EAPOL", LayerType: LayerTypeEAPOL} - EthernetTypeMetadata[EthernetTypeQinQ] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot1Q), Name: "Dot1Q", LayerType: LayerTypeDot1Q} - EthernetTypeMetadata[EthernetTypeTransparentEthernetBridging] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeEthernet), Name: "TransparentEthernetBridging", LayerType: LayerTypeEthernet} - EthernetTypeMetadata[EthernetTypeERSPAN] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeERSPANII), Name: "ERSPAN Type II", LayerType: LayerTypeERSPANII} - - IPProtocolMetadata[IPProtocolIPv4] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeIPv4), Name: "IPv4", LayerType: LayerTypeIPv4} - IPProtocolMetadata[IPProtocolTCP] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeTCP), Name: "TCP", LayerType: LayerTypeTCP} - IPProtocolMetadata[IPProtocolUDP] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeUDP), Name: "UDP", LayerType: LayerTypeUDP} - IPProtocolMetadata[IPProtocolICMPv4] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeICMPv4), Name: "ICMPv4", LayerType: LayerTypeICMPv4} - IPProtocolMetadata[IPProtocolICMPv6] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeICMPv6), Name: "ICMPv6", LayerType: LayerTypeICMPv6} - IPProtocolMetadata[IPProtocolSCTP] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeSCTP), Name: "SCTP", LayerType: LayerTypeSCTP} - IPProtocolMetadata[IPProtocolIPv6] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeIPv6), Name: "IPv6", LayerType: LayerTypeIPv6} - IPProtocolMetadata[IPProtocolIPIP] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeIPv4), Name: "IPv4", LayerType: LayerTypeIPv4} - IPProtocolMetadata[IPProtocolEtherIP] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeEtherIP), Name: "EtherIP", LayerType: LayerTypeEtherIP} - IPProtocolMetadata[IPProtocolRUDP] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeRUDP), Name: "RUDP", LayerType: LayerTypeRUDP} - IPProtocolMetadata[IPProtocolGRE] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeGRE), Name: "GRE", LayerType: LayerTypeGRE} - IPProtocolMetadata[IPProtocolIPv6HopByHop] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeIPv6HopByHop), Name: "IPv6HopByHop", LayerType: LayerTypeIPv6HopByHop} - IPProtocolMetadata[IPProtocolIPv6Routing] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeIPv6Routing), Name: "IPv6Routing", LayerType: LayerTypeIPv6Routing} - IPProtocolMetadata[IPProtocolIPv6Fragment] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeIPv6Fragment), Name: "IPv6Fragment", LayerType: LayerTypeIPv6Fragment} - IPProtocolMetadata[IPProtocolIPv6Destination] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeIPv6Destination), Name: "IPv6Destination", LayerType: LayerTypeIPv6Destination} - IPProtocolMetadata[IPProtocolOSPF] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeOSPF), Name: "OSPF", LayerType: LayerTypeOSPF} - IPProtocolMetadata[IPProtocolAH] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeIPSecAH), Name: "IPSecAH", LayerType: LayerTypeIPSecAH} - IPProtocolMetadata[IPProtocolESP] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeIPSecESP), Name: "IPSecESP", LayerType: LayerTypeIPSecESP} - IPProtocolMetadata[IPProtocolUDPLite] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeUDPLite), Name: "UDPLite", LayerType: LayerTypeUDPLite} - IPProtocolMetadata[IPProtocolMPLSInIP] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeMPLS), Name: "MPLS", LayerType: LayerTypeMPLS} - IPProtocolMetadata[IPProtocolNoNextHeader] = EnumMetadata{DecodeWith: gopacket.DecodePayload, Name: "NoNextHeader", LayerType: gopacket.LayerTypePayload} - IPProtocolMetadata[IPProtocolIGMP] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeIGMP), Name: "IGMP", LayerType: LayerTypeIGMP} - IPProtocolMetadata[IPProtocolVRRP] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeVRRP), Name: "VRRP", LayerType: LayerTypeVRRP} - - SCTPChunkTypeMetadata[SCTPChunkTypeData] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeSCTPData), Name: "Data"} - SCTPChunkTypeMetadata[SCTPChunkTypeInit] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeSCTPInit), Name: "Init"} - SCTPChunkTypeMetadata[SCTPChunkTypeInitAck] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeSCTPInit), Name: "InitAck"} - SCTPChunkTypeMetadata[SCTPChunkTypeSack] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeSCTPSack), Name: "Sack"} - SCTPChunkTypeMetadata[SCTPChunkTypeHeartbeat] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeSCTPHeartbeat), Name: "Heartbeat"} - SCTPChunkTypeMetadata[SCTPChunkTypeHeartbeatAck] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeSCTPHeartbeat), Name: "HeartbeatAck"} - SCTPChunkTypeMetadata[SCTPChunkTypeAbort] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeSCTPError), Name: "Abort"} - SCTPChunkTypeMetadata[SCTPChunkTypeError] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeSCTPError), Name: "Error"} - SCTPChunkTypeMetadata[SCTPChunkTypeShutdown] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeSCTPShutdown), Name: "Shutdown"} - SCTPChunkTypeMetadata[SCTPChunkTypeShutdownAck] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeSCTPShutdownAck), Name: "ShutdownAck"} - SCTPChunkTypeMetadata[SCTPChunkTypeCookieEcho] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeSCTPCookieEcho), Name: "CookieEcho"} - SCTPChunkTypeMetadata[SCTPChunkTypeCookieAck] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeSCTPEmptyLayer), Name: "CookieAck"} - SCTPChunkTypeMetadata[SCTPChunkTypeShutdownComplete] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeSCTPEmptyLayer), Name: "ShutdownComplete"} - - PPPTypeMetadata[PPPTypeIPv4] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeIPv4), Name: "IPv4"} - PPPTypeMetadata[PPPTypeIPv6] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeIPv6), Name: "IPv6"} - PPPTypeMetadata[PPPTypeMPLSUnicast] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeMPLS), Name: "MPLSUnicast"} - PPPTypeMetadata[PPPTypeMPLSMulticast] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeMPLS), Name: "MPLSMulticast"} - - PPPoECodeMetadata[PPPoECodeSession] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodePPP), Name: "PPP"} - - LinkTypeMetadata[LinkTypeEthernet] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeEthernet), Name: "Ethernet"} - LinkTypeMetadata[LinkTypePPP] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodePPP), Name: "PPP"} - LinkTypeMetadata[LinkTypeFDDI] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeFDDI), Name: "FDDI"} - LinkTypeMetadata[LinkTypeNull] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeLoopback), Name: "Null"} - LinkTypeMetadata[LinkTypeIEEE802_11] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11), Name: "Dot11"} - LinkTypeMetadata[LinkTypeLoop] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeLoopback), Name: "Loop"} - LinkTypeMetadata[LinkTypeIEEE802_11] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11), Name: "802.11"} - LinkTypeMetadata[LinkTypeRaw] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeIPv4or6), Name: "Raw"} - // See https://github.com/the-tcpdump-group/libpcap/blob/170f717e6e818cdc4bcbbfd906b63088eaa88fa0/pcap/dlt.h#L85 - // Or https://github.com/wireshark/wireshark/blob/854cfe53efe44080609c78053ecfb2342ad84a08/wiretap/pcap-common.c#L508 - if runtime.GOOS == "openbsd" { - LinkTypeMetadata[14] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeIPv4or6), Name: "Raw"} - } else { - LinkTypeMetadata[12] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeIPv4or6), Name: "Raw"} - } - LinkTypeMetadata[LinkTypePFLog] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodePFLog), Name: "PFLog"} - LinkTypeMetadata[LinkTypeIEEE80211Radio] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeRadioTap), Name: "RadioTap"} - LinkTypeMetadata[LinkTypeLinuxUSB] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeUSB), Name: "USB"} - LinkTypeMetadata[LinkTypeLinuxSLL] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeLinuxSLL), Name: "Linux SLL"} - LinkTypeMetadata[LinkTypePrismHeader] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodePrismHeader), Name: "Prism"} - - FDDIFrameControlMetadata[FDDIFrameControlLLC] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeLLC), Name: "LLC"} - - EAPOLTypeMetadata[EAPOLTypeEAP] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeEAP), Name: "EAP", LayerType: LayerTypeEAP} - EAPOLTypeMetadata[EAPOLTypeKey] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeEAPOLKey), Name: "EAPOLKey", LayerType: LayerTypeEAPOLKey} - - ProtocolFamilyMetadata[ProtocolFamilyIPv4] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeIPv4), Name: "IPv4", LayerType: LayerTypeIPv4} - ProtocolFamilyMetadata[ProtocolFamilyIPv6BSD] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeIPv6), Name: "IPv6", LayerType: LayerTypeIPv6} - ProtocolFamilyMetadata[ProtocolFamilyIPv6FreeBSD] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeIPv6), Name: "IPv6", LayerType: LayerTypeIPv6} - ProtocolFamilyMetadata[ProtocolFamilyIPv6Darwin] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeIPv6), Name: "IPv6", LayerType: LayerTypeIPv6} - ProtocolFamilyMetadata[ProtocolFamilyIPv6Linux] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeIPv6), Name: "IPv6", LayerType: LayerTypeIPv6} - - Dot11TypeMetadata[Dot11TypeMgmtAssociationReq] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11MgmtAssociationReq), Name: "MgmtAssociationReq", LayerType: LayerTypeDot11MgmtAssociationReq} - Dot11TypeMetadata[Dot11TypeMgmtAssociationResp] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11MgmtAssociationResp), Name: "MgmtAssociationResp", LayerType: LayerTypeDot11MgmtAssociationResp} - Dot11TypeMetadata[Dot11TypeMgmtReassociationReq] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11MgmtReassociationReq), Name: "MgmtReassociationReq", LayerType: LayerTypeDot11MgmtReassociationReq} - Dot11TypeMetadata[Dot11TypeMgmtReassociationResp] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11MgmtReassociationResp), Name: "MgmtReassociationResp", LayerType: LayerTypeDot11MgmtReassociationResp} - Dot11TypeMetadata[Dot11TypeMgmtProbeReq] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11MgmtProbeReq), Name: "MgmtProbeReq", LayerType: LayerTypeDot11MgmtProbeReq} - Dot11TypeMetadata[Dot11TypeMgmtProbeResp] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11MgmtProbeResp), Name: "MgmtProbeResp", LayerType: LayerTypeDot11MgmtProbeResp} - Dot11TypeMetadata[Dot11TypeMgmtMeasurementPilot] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11MgmtMeasurementPilot), Name: "MgmtMeasurementPilot", LayerType: LayerTypeDot11MgmtMeasurementPilot} - Dot11TypeMetadata[Dot11TypeMgmtBeacon] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11MgmtBeacon), Name: "MgmtBeacon", LayerType: LayerTypeDot11MgmtBeacon} - Dot11TypeMetadata[Dot11TypeMgmtATIM] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11MgmtATIM), Name: "MgmtATIM", LayerType: LayerTypeDot11MgmtATIM} - Dot11TypeMetadata[Dot11TypeMgmtDisassociation] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11MgmtDisassociation), Name: "MgmtDisassociation", LayerType: LayerTypeDot11MgmtDisassociation} - Dot11TypeMetadata[Dot11TypeMgmtAuthentication] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11MgmtAuthentication), Name: "MgmtAuthentication", LayerType: LayerTypeDot11MgmtAuthentication} - Dot11TypeMetadata[Dot11TypeMgmtDeauthentication] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11MgmtDeauthentication), Name: "MgmtDeauthentication", LayerType: LayerTypeDot11MgmtDeauthentication} - Dot11TypeMetadata[Dot11TypeMgmtAction] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11MgmtAction), Name: "MgmtAction", LayerType: LayerTypeDot11MgmtAction} - Dot11TypeMetadata[Dot11TypeMgmtActionNoAck] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11MgmtActionNoAck), Name: "MgmtActionNoAck", LayerType: LayerTypeDot11MgmtActionNoAck} - Dot11TypeMetadata[Dot11TypeCtrl] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11Ctrl), Name: "Ctrl", LayerType: LayerTypeDot11Ctrl} - Dot11TypeMetadata[Dot11TypeCtrlWrapper] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11Ctrl), Name: "CtrlWrapper", LayerType: LayerTypeDot11Ctrl} - Dot11TypeMetadata[Dot11TypeCtrlBlockAckReq] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11CtrlBlockAckReq), Name: "CtrlBlockAckReq", LayerType: LayerTypeDot11CtrlBlockAckReq} - Dot11TypeMetadata[Dot11TypeCtrlBlockAck] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11CtrlBlockAck), Name: "CtrlBlockAck", LayerType: LayerTypeDot11CtrlBlockAck} - Dot11TypeMetadata[Dot11TypeCtrlPowersavePoll] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11CtrlPowersavePoll), Name: "CtrlPowersavePoll", LayerType: LayerTypeDot11CtrlPowersavePoll} - Dot11TypeMetadata[Dot11TypeCtrlRTS] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11CtrlRTS), Name: "CtrlRTS", LayerType: LayerTypeDot11CtrlRTS} - Dot11TypeMetadata[Dot11TypeCtrlCTS] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11CtrlCTS), Name: "CtrlCTS", LayerType: LayerTypeDot11CtrlCTS} - Dot11TypeMetadata[Dot11TypeCtrlAck] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11CtrlAck), Name: "CtrlAck", LayerType: LayerTypeDot11CtrlAck} - Dot11TypeMetadata[Dot11TypeCtrlCFEnd] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11CtrlCFEnd), Name: "CtrlCFEnd", LayerType: LayerTypeDot11CtrlCFEnd} - Dot11TypeMetadata[Dot11TypeCtrlCFEndAck] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11CtrlCFEndAck), Name: "CtrlCFEndAck", LayerType: LayerTypeDot11CtrlCFEndAck} - Dot11TypeMetadata[Dot11TypeData] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11Data), Name: "Data", LayerType: LayerTypeDot11Data} - Dot11TypeMetadata[Dot11TypeDataCFAck] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11DataCFAck), Name: "DataCFAck", LayerType: LayerTypeDot11DataCFAck} - Dot11TypeMetadata[Dot11TypeDataCFPoll] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11DataCFPoll), Name: "DataCFPoll", LayerType: LayerTypeDot11DataCFPoll} - Dot11TypeMetadata[Dot11TypeDataCFAckPoll] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11DataCFAckPoll), Name: "DataCFAckPoll", LayerType: LayerTypeDot11DataCFAckPoll} - Dot11TypeMetadata[Dot11TypeDataNull] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11DataNull), Name: "DataNull", LayerType: LayerTypeDot11DataNull} - Dot11TypeMetadata[Dot11TypeDataCFAckNoData] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11DataCFAckNoData), Name: "DataCFAckNoData", LayerType: LayerTypeDot11DataCFAckNoData} - Dot11TypeMetadata[Dot11TypeDataCFPollNoData] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11DataCFPollNoData), Name: "DataCFPollNoData", LayerType: LayerTypeDot11DataCFPollNoData} - Dot11TypeMetadata[Dot11TypeDataCFAckPollNoData] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11DataCFAckPollNoData), Name: "DataCFAckPollNoData", LayerType: LayerTypeDot11DataCFAckPollNoData} - Dot11TypeMetadata[Dot11TypeDataQOSData] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11DataQOSData), Name: "DataQOSData", LayerType: LayerTypeDot11DataQOSData} - Dot11TypeMetadata[Dot11TypeDataQOSDataCFAck] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11DataQOSDataCFAck), Name: "DataQOSDataCFAck", LayerType: LayerTypeDot11DataQOSDataCFAck} - Dot11TypeMetadata[Dot11TypeDataQOSDataCFPoll] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11DataQOSDataCFPoll), Name: "DataQOSDataCFPoll", LayerType: LayerTypeDot11DataQOSDataCFPoll} - Dot11TypeMetadata[Dot11TypeDataQOSDataCFAckPoll] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11DataQOSDataCFAckPoll), Name: "DataQOSDataCFAckPoll", LayerType: LayerTypeDot11DataQOSDataCFAckPoll} - Dot11TypeMetadata[Dot11TypeDataQOSNull] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11DataQOSNull), Name: "DataQOSNull", LayerType: LayerTypeDot11DataQOSNull} - Dot11TypeMetadata[Dot11TypeDataQOSCFPollNoData] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11DataQOSCFPollNoData), Name: "DataQOSCFPollNoData", LayerType: LayerTypeDot11DataQOSCFPollNoData} - Dot11TypeMetadata[Dot11TypeDataQOSCFAckPollNoData] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeDot11DataQOSCFAckPollNoData), Name: "DataQOSCFAckPollNoData", LayerType: LayerTypeDot11DataQOSCFAckPollNoData} - - USBTransportTypeMetadata[USBTransportTypeInterrupt] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeUSBInterrupt), Name: "Interrupt", LayerType: LayerTypeUSBInterrupt} - USBTransportTypeMetadata[USBTransportTypeControl] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeUSBControl), Name: "Control", LayerType: LayerTypeUSBControl} - USBTransportTypeMetadata[USBTransportTypeBulk] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(decodeUSBBulk), Name: "Bulk", LayerType: LayerTypeUSBBulk} -} diff --git a/vendor/github.com/google/gopacket/layers/enums_generated.go b/vendor/github.com/google/gopacket/layers/enums_generated.go deleted file mode 100644 index bf77aac50..000000000 --- a/vendor/github.com/google/gopacket/layers/enums_generated.go +++ /dev/null @@ -1,434 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. - -package layers - -// Created by gen2.go, don't edit manually -// Generated at 2017-10-23 10:20:24.458771856 -0600 MDT m=+0.001159033 - -import ( - "fmt" - - "github.com/google/gopacket" -) - -func init() { - initUnknownTypesForLinkType() - initUnknownTypesForEthernetType() - initUnknownTypesForPPPType() - initUnknownTypesForIPProtocol() - initUnknownTypesForSCTPChunkType() - initUnknownTypesForPPPoECode() - initUnknownTypesForFDDIFrameControl() - initUnknownTypesForEAPOLType() - initUnknownTypesForProtocolFamily() - initUnknownTypesForDot11Type() - initUnknownTypesForUSBTransportType() - initActualTypeData() -} - -// Decoder calls LinkTypeMetadata.DecodeWith's decoder. -func (a LinkType) Decode(data []byte, p gopacket.PacketBuilder) error { - return LinkTypeMetadata[a].DecodeWith.Decode(data, p) -} - -// String returns LinkTypeMetadata.Name. -func (a LinkType) String() string { - return LinkTypeMetadata[a].Name -} - -// LayerType returns LinkTypeMetadata.LayerType. -func (a LinkType) LayerType() gopacket.LayerType { - return LinkTypeMetadata[a].LayerType -} - -type errorDecoderForLinkType int - -func (a *errorDecoderForLinkType) Decode(data []byte, p gopacket.PacketBuilder) error { - return a -} -func (a *errorDecoderForLinkType) Error() string { - return fmt.Sprintf("Unable to decode LinkType %d", int(*a)) -} - -var errorDecodersForLinkType [256]errorDecoderForLinkType -var LinkTypeMetadata [256]EnumMetadata - -func initUnknownTypesForLinkType() { - for i := 0; i < 256; i++ { - errorDecodersForLinkType[i] = errorDecoderForLinkType(i) - LinkTypeMetadata[i] = EnumMetadata{ - DecodeWith: &errorDecodersForLinkType[i], - Name: "UnknownLinkType", - } - } -} - -// Decoder calls EthernetTypeMetadata.DecodeWith's decoder. -func (a EthernetType) Decode(data []byte, p gopacket.PacketBuilder) error { - return EthernetTypeMetadata[a].DecodeWith.Decode(data, p) -} - -// String returns EthernetTypeMetadata.Name. -func (a EthernetType) String() string { - return EthernetTypeMetadata[a].Name -} - -// LayerType returns EthernetTypeMetadata.LayerType. -func (a EthernetType) LayerType() gopacket.LayerType { - return EthernetTypeMetadata[a].LayerType -} - -type errorDecoderForEthernetType int - -func (a *errorDecoderForEthernetType) Decode(data []byte, p gopacket.PacketBuilder) error { - return a -} -func (a *errorDecoderForEthernetType) Error() string { - return fmt.Sprintf("Unable to decode EthernetType %d", int(*a)) -} - -var errorDecodersForEthernetType [65536]errorDecoderForEthernetType -var EthernetTypeMetadata [65536]EnumMetadata - -func initUnknownTypesForEthernetType() { - for i := 0; i < 65536; i++ { - errorDecodersForEthernetType[i] = errorDecoderForEthernetType(i) - EthernetTypeMetadata[i] = EnumMetadata{ - DecodeWith: &errorDecodersForEthernetType[i], - Name: "UnknownEthernetType", - } - } -} - -// Decoder calls PPPTypeMetadata.DecodeWith's decoder. -func (a PPPType) Decode(data []byte, p gopacket.PacketBuilder) error { - return PPPTypeMetadata[a].DecodeWith.Decode(data, p) -} - -// String returns PPPTypeMetadata.Name. -func (a PPPType) String() string { - return PPPTypeMetadata[a].Name -} - -// LayerType returns PPPTypeMetadata.LayerType. -func (a PPPType) LayerType() gopacket.LayerType { - return PPPTypeMetadata[a].LayerType -} - -type errorDecoderForPPPType int - -func (a *errorDecoderForPPPType) Decode(data []byte, p gopacket.PacketBuilder) error { - return a -} -func (a *errorDecoderForPPPType) Error() string { - return fmt.Sprintf("Unable to decode PPPType %d", int(*a)) -} - -var errorDecodersForPPPType [65536]errorDecoderForPPPType -var PPPTypeMetadata [65536]EnumMetadata - -func initUnknownTypesForPPPType() { - for i := 0; i < 65536; i++ { - errorDecodersForPPPType[i] = errorDecoderForPPPType(i) - PPPTypeMetadata[i] = EnumMetadata{ - DecodeWith: &errorDecodersForPPPType[i], - Name: "UnknownPPPType", - } - } -} - -// Decoder calls IPProtocolMetadata.DecodeWith's decoder. -func (a IPProtocol) Decode(data []byte, p gopacket.PacketBuilder) error { - return IPProtocolMetadata[a].DecodeWith.Decode(data, p) -} - -// String returns IPProtocolMetadata.Name. -func (a IPProtocol) String() string { - return IPProtocolMetadata[a].Name -} - -// LayerType returns IPProtocolMetadata.LayerType. -func (a IPProtocol) LayerType() gopacket.LayerType { - return IPProtocolMetadata[a].LayerType -} - -type errorDecoderForIPProtocol int - -func (a *errorDecoderForIPProtocol) Decode(data []byte, p gopacket.PacketBuilder) error { - return a -} -func (a *errorDecoderForIPProtocol) Error() string { - return fmt.Sprintf("Unable to decode IPProtocol %d", int(*a)) -} - -var errorDecodersForIPProtocol [256]errorDecoderForIPProtocol -var IPProtocolMetadata [256]EnumMetadata - -func initUnknownTypesForIPProtocol() { - for i := 0; i < 256; i++ { - errorDecodersForIPProtocol[i] = errorDecoderForIPProtocol(i) - IPProtocolMetadata[i] = EnumMetadata{ - DecodeWith: &errorDecodersForIPProtocol[i], - Name: "UnknownIPProtocol", - } - } -} - -// Decoder calls SCTPChunkTypeMetadata.DecodeWith's decoder. -func (a SCTPChunkType) Decode(data []byte, p gopacket.PacketBuilder) error { - return SCTPChunkTypeMetadata[a].DecodeWith.Decode(data, p) -} - -// String returns SCTPChunkTypeMetadata.Name. -func (a SCTPChunkType) String() string { - return SCTPChunkTypeMetadata[a].Name -} - -// LayerType returns SCTPChunkTypeMetadata.LayerType. -func (a SCTPChunkType) LayerType() gopacket.LayerType { - return SCTPChunkTypeMetadata[a].LayerType -} - -type errorDecoderForSCTPChunkType int - -func (a *errorDecoderForSCTPChunkType) Decode(data []byte, p gopacket.PacketBuilder) error { - return a -} -func (a *errorDecoderForSCTPChunkType) Error() string { - return fmt.Sprintf("Unable to decode SCTPChunkType %d", int(*a)) -} - -var errorDecodersForSCTPChunkType [256]errorDecoderForSCTPChunkType -var SCTPChunkTypeMetadata [256]EnumMetadata - -func initUnknownTypesForSCTPChunkType() { - for i := 0; i < 256; i++ { - errorDecodersForSCTPChunkType[i] = errorDecoderForSCTPChunkType(i) - SCTPChunkTypeMetadata[i] = EnumMetadata{ - DecodeWith: &errorDecodersForSCTPChunkType[i], - Name: "UnknownSCTPChunkType", - } - } -} - -// Decoder calls PPPoECodeMetadata.DecodeWith's decoder. -func (a PPPoECode) Decode(data []byte, p gopacket.PacketBuilder) error { - return PPPoECodeMetadata[a].DecodeWith.Decode(data, p) -} - -// String returns PPPoECodeMetadata.Name. -func (a PPPoECode) String() string { - return PPPoECodeMetadata[a].Name -} - -// LayerType returns PPPoECodeMetadata.LayerType. -func (a PPPoECode) LayerType() gopacket.LayerType { - return PPPoECodeMetadata[a].LayerType -} - -type errorDecoderForPPPoECode int - -func (a *errorDecoderForPPPoECode) Decode(data []byte, p gopacket.PacketBuilder) error { - return a -} -func (a *errorDecoderForPPPoECode) Error() string { - return fmt.Sprintf("Unable to decode PPPoECode %d", int(*a)) -} - -var errorDecodersForPPPoECode [256]errorDecoderForPPPoECode -var PPPoECodeMetadata [256]EnumMetadata - -func initUnknownTypesForPPPoECode() { - for i := 0; i < 256; i++ { - errorDecodersForPPPoECode[i] = errorDecoderForPPPoECode(i) - PPPoECodeMetadata[i] = EnumMetadata{ - DecodeWith: &errorDecodersForPPPoECode[i], - Name: "UnknownPPPoECode", - } - } -} - -// Decoder calls FDDIFrameControlMetadata.DecodeWith's decoder. -func (a FDDIFrameControl) Decode(data []byte, p gopacket.PacketBuilder) error { - return FDDIFrameControlMetadata[a].DecodeWith.Decode(data, p) -} - -// String returns FDDIFrameControlMetadata.Name. -func (a FDDIFrameControl) String() string { - return FDDIFrameControlMetadata[a].Name -} - -// LayerType returns FDDIFrameControlMetadata.LayerType. -func (a FDDIFrameControl) LayerType() gopacket.LayerType { - return FDDIFrameControlMetadata[a].LayerType -} - -type errorDecoderForFDDIFrameControl int - -func (a *errorDecoderForFDDIFrameControl) Decode(data []byte, p gopacket.PacketBuilder) error { - return a -} -func (a *errorDecoderForFDDIFrameControl) Error() string { - return fmt.Sprintf("Unable to decode FDDIFrameControl %d", int(*a)) -} - -var errorDecodersForFDDIFrameControl [256]errorDecoderForFDDIFrameControl -var FDDIFrameControlMetadata [256]EnumMetadata - -func initUnknownTypesForFDDIFrameControl() { - for i := 0; i < 256; i++ { - errorDecodersForFDDIFrameControl[i] = errorDecoderForFDDIFrameControl(i) - FDDIFrameControlMetadata[i] = EnumMetadata{ - DecodeWith: &errorDecodersForFDDIFrameControl[i], - Name: "UnknownFDDIFrameControl", - } - } -} - -// Decoder calls EAPOLTypeMetadata.DecodeWith's decoder. -func (a EAPOLType) Decode(data []byte, p gopacket.PacketBuilder) error { - return EAPOLTypeMetadata[a].DecodeWith.Decode(data, p) -} - -// String returns EAPOLTypeMetadata.Name. -func (a EAPOLType) String() string { - return EAPOLTypeMetadata[a].Name -} - -// LayerType returns EAPOLTypeMetadata.LayerType. -func (a EAPOLType) LayerType() gopacket.LayerType { - return EAPOLTypeMetadata[a].LayerType -} - -type errorDecoderForEAPOLType int - -func (a *errorDecoderForEAPOLType) Decode(data []byte, p gopacket.PacketBuilder) error { - return a -} -func (a *errorDecoderForEAPOLType) Error() string { - return fmt.Sprintf("Unable to decode EAPOLType %d", int(*a)) -} - -var errorDecodersForEAPOLType [256]errorDecoderForEAPOLType -var EAPOLTypeMetadata [256]EnumMetadata - -func initUnknownTypesForEAPOLType() { - for i := 0; i < 256; i++ { - errorDecodersForEAPOLType[i] = errorDecoderForEAPOLType(i) - EAPOLTypeMetadata[i] = EnumMetadata{ - DecodeWith: &errorDecodersForEAPOLType[i], - Name: "UnknownEAPOLType", - } - } -} - -// Decoder calls ProtocolFamilyMetadata.DecodeWith's decoder. -func (a ProtocolFamily) Decode(data []byte, p gopacket.PacketBuilder) error { - return ProtocolFamilyMetadata[a].DecodeWith.Decode(data, p) -} - -// String returns ProtocolFamilyMetadata.Name. -func (a ProtocolFamily) String() string { - return ProtocolFamilyMetadata[a].Name -} - -// LayerType returns ProtocolFamilyMetadata.LayerType. -func (a ProtocolFamily) LayerType() gopacket.LayerType { - return ProtocolFamilyMetadata[a].LayerType -} - -type errorDecoderForProtocolFamily int - -func (a *errorDecoderForProtocolFamily) Decode(data []byte, p gopacket.PacketBuilder) error { - return a -} -func (a *errorDecoderForProtocolFamily) Error() string { - return fmt.Sprintf("Unable to decode ProtocolFamily %d", int(*a)) -} - -var errorDecodersForProtocolFamily [256]errorDecoderForProtocolFamily -var ProtocolFamilyMetadata [256]EnumMetadata - -func initUnknownTypesForProtocolFamily() { - for i := 0; i < 256; i++ { - errorDecodersForProtocolFamily[i] = errorDecoderForProtocolFamily(i) - ProtocolFamilyMetadata[i] = EnumMetadata{ - DecodeWith: &errorDecodersForProtocolFamily[i], - Name: "UnknownProtocolFamily", - } - } -} - -// Decoder calls Dot11TypeMetadata.DecodeWith's decoder. -func (a Dot11Type) Decode(data []byte, p gopacket.PacketBuilder) error { - return Dot11TypeMetadata[a].DecodeWith.Decode(data, p) -} - -// String returns Dot11TypeMetadata.Name. -func (a Dot11Type) String() string { - return Dot11TypeMetadata[a].Name -} - -// LayerType returns Dot11TypeMetadata.LayerType. -func (a Dot11Type) LayerType() gopacket.LayerType { - return Dot11TypeMetadata[a].LayerType -} - -type errorDecoderForDot11Type int - -func (a *errorDecoderForDot11Type) Decode(data []byte, p gopacket.PacketBuilder) error { - return a -} -func (a *errorDecoderForDot11Type) Error() string { - return fmt.Sprintf("Unable to decode Dot11Type %d", int(*a)) -} - -var errorDecodersForDot11Type [256]errorDecoderForDot11Type -var Dot11TypeMetadata [256]EnumMetadata - -func initUnknownTypesForDot11Type() { - for i := 0; i < 256; i++ { - errorDecodersForDot11Type[i] = errorDecoderForDot11Type(i) - Dot11TypeMetadata[i] = EnumMetadata{ - DecodeWith: &errorDecodersForDot11Type[i], - Name: "UnknownDot11Type", - } - } -} - -// Decoder calls USBTransportTypeMetadata.DecodeWith's decoder. -func (a USBTransportType) Decode(data []byte, p gopacket.PacketBuilder) error { - return USBTransportTypeMetadata[a].DecodeWith.Decode(data, p) -} - -// String returns USBTransportTypeMetadata.Name. -func (a USBTransportType) String() string { - return USBTransportTypeMetadata[a].Name -} - -// LayerType returns USBTransportTypeMetadata.LayerType. -func (a USBTransportType) LayerType() gopacket.LayerType { - return USBTransportTypeMetadata[a].LayerType -} - -type errorDecoderForUSBTransportType int - -func (a *errorDecoderForUSBTransportType) Decode(data []byte, p gopacket.PacketBuilder) error { - return a -} -func (a *errorDecoderForUSBTransportType) Error() string { - return fmt.Sprintf("Unable to decode USBTransportType %d", int(*a)) -} - -var errorDecodersForUSBTransportType [256]errorDecoderForUSBTransportType -var USBTransportTypeMetadata [256]EnumMetadata - -func initUnknownTypesForUSBTransportType() { - for i := 0; i < 256; i++ { - errorDecodersForUSBTransportType[i] = errorDecoderForUSBTransportType(i) - USBTransportTypeMetadata[i] = EnumMetadata{ - DecodeWith: &errorDecodersForUSBTransportType[i], - Name: "UnknownUSBTransportType", - } - } -} diff --git a/vendor/github.com/google/gopacket/layers/erspan2.go b/vendor/github.com/google/gopacket/layers/erspan2.go deleted file mode 100644 index 154436205..000000000 --- a/vendor/github.com/google/gopacket/layers/erspan2.go +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2018 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - - "github.com/google/gopacket" -) - -const ( - //ERSPANIIVersionObsolete - The obsolete value for the version field - ERSPANIIVersionObsolete = 0x0 - // ERSPANIIVersion - The current value for the version field - ERSPANIIVersion = 0x1 -) - -// ERSPANII contains all of the fields found in an ERSPAN Type II header -// https://tools.ietf.org/html/draft-foschiano-erspan-03 -type ERSPANII struct { - BaseLayer - IsTruncated bool - Version, CoS, TrunkEncap uint8 - VLANIdentifier, SessionID, Reserved uint16 - Index uint32 -} - -func (erspan2 *ERSPANII) LayerType() gopacket.LayerType { return LayerTypeERSPANII } - -// DecodeFromBytes decodes the given bytes into this layer. -func (erspan2 *ERSPANII) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - erspan2Length := 8 - erspan2.Version = data[0] & 0xF0 >> 4 - erspan2.VLANIdentifier = binary.BigEndian.Uint16(data[:2]) & 0x0FFF - erspan2.CoS = data[2] & 0xE0 >> 5 - erspan2.TrunkEncap = data[2] & 0x18 >> 3 - erspan2.IsTruncated = data[2]&0x4>>2 != 0 - erspan2.SessionID = binary.BigEndian.Uint16(data[2:4]) & 0x03FF - erspan2.Reserved = binary.BigEndian.Uint16(data[4:6]) & 0xFFF0 >> 4 - erspan2.Index = binary.BigEndian.Uint32(data[4:8]) & 0x000FFFFF - erspan2.Contents = data[:erspan2Length] - erspan2.Payload = data[erspan2Length:] - return nil -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (erspan2 *ERSPANII) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - bytes, err := b.PrependBytes(8) - if err != nil { - return err - } - - twoByteInt := uint16(erspan2.Version&0xF)<<12 | erspan2.VLANIdentifier&0x0FFF - binary.BigEndian.PutUint16(bytes, twoByteInt) - - twoByteInt = uint16(erspan2.CoS&0x7)<<13 | uint16(erspan2.TrunkEncap&0x3)<<11 | erspan2.SessionID&0x03FF - if erspan2.IsTruncated { - twoByteInt |= 0x400 - } - binary.BigEndian.PutUint16(bytes[2:], twoByteInt) - - fourByteInt := uint32(erspan2.Reserved&0x0FFF)<<20 | erspan2.Index&0x000FFFFF - binary.BigEndian.PutUint32(bytes[4:], fourByteInt) - return nil -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (erspan2 *ERSPANII) CanDecode() gopacket.LayerClass { - return LayerTypeERSPANII -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (erspan2 *ERSPANII) NextLayerType() gopacket.LayerType { - return LayerTypeEthernet -} - -func decodeERSPANII(data []byte, p gopacket.PacketBuilder) error { - erspan2 := &ERSPANII{} - return decodingLayerDecoder(erspan2, data, p) -} diff --git a/vendor/github.com/google/gopacket/layers/etherip.go b/vendor/github.com/google/gopacket/layers/etherip.go deleted file mode 100644 index 5b7b7229e..000000000 --- a/vendor/github.com/google/gopacket/layers/etherip.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "github.com/google/gopacket" -) - -// EtherIP is the struct for storing RFC 3378 EtherIP packet headers. -type EtherIP struct { - BaseLayer - Version uint8 - Reserved uint16 -} - -// LayerType returns gopacket.LayerTypeEtherIP. -func (e *EtherIP) LayerType() gopacket.LayerType { return LayerTypeEtherIP } - -// DecodeFromBytes decodes the given bytes into this layer. -func (e *EtherIP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - e.Version = data[0] >> 4 - e.Reserved = binary.BigEndian.Uint16(data[:2]) & 0x0fff - e.BaseLayer = BaseLayer{data[:2], data[2:]} - return nil -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (e *EtherIP) CanDecode() gopacket.LayerClass { - return LayerTypeEtherIP -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (e *EtherIP) NextLayerType() gopacket.LayerType { - return LayerTypeEthernet -} - -func decodeEtherIP(data []byte, p gopacket.PacketBuilder) error { - e := &EtherIP{} - return decodingLayerDecoder(e, data, p) -} diff --git a/vendor/github.com/google/gopacket/layers/ethernet.go b/vendor/github.com/google/gopacket/layers/ethernet.go deleted file mode 100644 index b73748f2f..000000000 --- a/vendor/github.com/google/gopacket/layers/ethernet.go +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// Copyright 2009-2011 Andreas Krennmair. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - "fmt" - "github.com/google/gopacket" - "net" -) - -// EthernetBroadcast is the broadcast MAC address used by Ethernet. -var EthernetBroadcast = net.HardwareAddr{0xff, 0xff, 0xff, 0xff, 0xff, 0xff} - -// Ethernet is the layer for Ethernet frame headers. -type Ethernet struct { - BaseLayer - SrcMAC, DstMAC net.HardwareAddr - EthernetType EthernetType - // Length is only set if a length field exists within this header. Ethernet - // headers follow two different standards, one that uses an EthernetType, the - // other which defines a length the follows with a LLC header (802.3). If the - // former is the case, we set EthernetType and Length stays 0. In the latter - // case, we set Length and EthernetType = EthernetTypeLLC. - Length uint16 -} - -// LayerType returns LayerTypeEthernet -func (e *Ethernet) LayerType() gopacket.LayerType { return LayerTypeEthernet } - -func (e *Ethernet) LinkFlow() gopacket.Flow { - return gopacket.NewFlow(EndpointMAC, e.SrcMAC, e.DstMAC) -} - -func (eth *Ethernet) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 14 { - return errors.New("Ethernet packet too small") - } - eth.DstMAC = net.HardwareAddr(data[0:6]) - eth.SrcMAC = net.HardwareAddr(data[6:12]) - eth.EthernetType = EthernetType(binary.BigEndian.Uint16(data[12:14])) - eth.BaseLayer = BaseLayer{data[:14], data[14:]} - eth.Length = 0 - if eth.EthernetType < 0x0600 { - eth.Length = uint16(eth.EthernetType) - eth.EthernetType = EthernetTypeLLC - if cmp := len(eth.Payload) - int(eth.Length); cmp < 0 { - df.SetTruncated() - } else if cmp > 0 { - // Strip off bytes at the end, since we have too many bytes - eth.Payload = eth.Payload[:len(eth.Payload)-cmp] - } - // fmt.Println(eth) - } - return nil -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (eth *Ethernet) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - if len(eth.DstMAC) != 6 { - return fmt.Errorf("invalid dst MAC: %v", eth.DstMAC) - } - if len(eth.SrcMAC) != 6 { - return fmt.Errorf("invalid src MAC: %v", eth.SrcMAC) - } - payload := b.Bytes() - bytes, err := b.PrependBytes(14) - if err != nil { - return err - } - copy(bytes, eth.DstMAC) - copy(bytes[6:], eth.SrcMAC) - if eth.Length != 0 || eth.EthernetType == EthernetTypeLLC { - if opts.FixLengths { - eth.Length = uint16(len(payload)) - } - if eth.EthernetType != EthernetTypeLLC { - return fmt.Errorf("ethernet type %v not compatible with length value %v", eth.EthernetType, eth.Length) - } else if eth.Length > 0x0600 { - return fmt.Errorf("invalid ethernet length %v", eth.Length) - } - binary.BigEndian.PutUint16(bytes[12:], eth.Length) - } else { - binary.BigEndian.PutUint16(bytes[12:], uint16(eth.EthernetType)) - } - length := len(b.Bytes()) - if length < 60 { - // Pad out to 60 bytes. - padding, err := b.AppendBytes(60 - length) - if err != nil { - return err - } - copy(padding, lotsOfZeros[:]) - } - return nil -} - -func (eth *Ethernet) CanDecode() gopacket.LayerClass { - return LayerTypeEthernet -} - -func (eth *Ethernet) NextLayerType() gopacket.LayerType { - return eth.EthernetType.LayerType() -} - -func decodeEthernet(data []byte, p gopacket.PacketBuilder) error { - eth := &Ethernet{} - err := eth.DecodeFromBytes(data, p) - if err != nil { - return err - } - p.AddLayer(eth) - p.SetLinkLayer(eth) - return p.NextDecoder(eth.EthernetType) -} diff --git a/vendor/github.com/google/gopacket/layers/fddi.go b/vendor/github.com/google/gopacket/layers/fddi.go deleted file mode 100644 index ed9e1957b..000000000 --- a/vendor/github.com/google/gopacket/layers/fddi.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "github.com/google/gopacket" - "net" -) - -// FDDI contains the header for FDDI frames. -type FDDI struct { - BaseLayer - FrameControl FDDIFrameControl - Priority uint8 - SrcMAC, DstMAC net.HardwareAddr -} - -// LayerType returns LayerTypeFDDI. -func (f *FDDI) LayerType() gopacket.LayerType { return LayerTypeFDDI } - -// LinkFlow returns a new flow of type EndpointMAC. -func (f *FDDI) LinkFlow() gopacket.Flow { - return gopacket.NewFlow(EndpointMAC, f.SrcMAC, f.DstMAC) -} - -func decodeFDDI(data []byte, p gopacket.PacketBuilder) error { - f := &FDDI{ - FrameControl: FDDIFrameControl(data[0] & 0xF8), - Priority: data[0] & 0x07, - SrcMAC: net.HardwareAddr(data[1:7]), - DstMAC: net.HardwareAddr(data[7:13]), - BaseLayer: BaseLayer{data[:13], data[13:]}, - } - p.SetLinkLayer(f) - p.AddLayer(f) - return p.NextDecoder(f.FrameControl) -} diff --git a/vendor/github.com/google/gopacket/layers/fuzz_layer.go b/vendor/github.com/google/gopacket/layers/fuzz_layer.go deleted file mode 100644 index 606e45d24..000000000 --- a/vendor/github.com/google/gopacket/layers/fuzz_layer.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2019 The GoPacket Authors. All rights reserved. -// -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file in the root of the source tree. - -package layers - -import ( - "encoding/binary" - - "github.com/google/gopacket" -) - -// FuzzLayer is a fuzz target for the layers package of gopacket -// A fuzz target is a function processing a binary blob (byte slice) -// The process here is to interpret this data as a packet, and print the layers contents. -// The decoding options and the starting layer are encoded in the first bytes. -// The function returns 1 if this is a valid packet (no error layer) -func FuzzLayer(data []byte) int { - if len(data) < 3 { - return 0 - } - // use the first two bytes to choose the top level layer - startLayer := binary.BigEndian.Uint16(data[:2]) - var fuzzOpts = gopacket.DecodeOptions{ - Lazy: data[2]&0x1 != 0, - NoCopy: data[2]&0x2 != 0, - SkipDecodeRecovery: data[2]&0x4 != 0, - DecodeStreamsAsDatagrams: data[2]&0x8 != 0, - } - p := gopacket.NewPacket(data[3:], gopacket.LayerType(startLayer), fuzzOpts) - for _, l := range p.Layers() { - gopacket.LayerString(l) - } - if p.ErrorLayer() != nil { - return 0 - } - return 1 -} diff --git a/vendor/github.com/google/gopacket/layers/gen_linted.sh b/vendor/github.com/google/gopacket/layers/gen_linted.sh deleted file mode 100644 index 75c701f4d..000000000 --- a/vendor/github.com/google/gopacket/layers/gen_linted.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -for i in *.go; do golint $i | grep -q . || echo $i; done > .linted diff --git a/vendor/github.com/google/gopacket/layers/geneve.go b/vendor/github.com/google/gopacket/layers/geneve.go deleted file mode 100644 index e9a142880..000000000 --- a/vendor/github.com/google/gopacket/layers/geneve.go +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright 2016 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - - "github.com/google/gopacket" -) - -// Geneve is specifed here https://tools.ietf.org/html/draft-ietf-nvo3-geneve-03 -// Geneve Header: -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// |Ver| Opt Len |O|C| Rsvd. | Protocol Type | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Virtual Network Identifier (VNI) | Reserved | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Variable Length Options | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -type Geneve struct { - BaseLayer - Version uint8 // 2 bits - OptionsLength uint8 // 6 bits - OAMPacket bool // 1 bits - CriticalOption bool // 1 bits - Protocol EthernetType // 16 bits - VNI uint32 // 24bits - Options []*GeneveOption -} - -// Geneve Tunnel Options -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Option Class | Type |R|R|R| Length | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Variable Option Data | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -type GeneveOption struct { - Class uint16 // 16 bits - Type uint8 // 8 bits - Flags uint8 // 3 bits - Length uint8 // 5 bits - Data []byte -} - -// LayerType returns LayerTypeGeneve -func (gn *Geneve) LayerType() gopacket.LayerType { return LayerTypeGeneve } - -func decodeGeneveOption(data []byte, gn *Geneve, df gopacket.DecodeFeedback) (*GeneveOption, uint8, error) { - if len(data) < 3 { - df.SetTruncated() - return nil, 0, errors.New("geneve option too small") - } - opt := &GeneveOption{} - - opt.Class = binary.BigEndian.Uint16(data[0:2]) - opt.Type = data[2] - opt.Flags = data[3] >> 4 - opt.Length = (data[3]&0xf)*4 + 4 - - if len(data) < int(opt.Length) { - df.SetTruncated() - return nil, 0, errors.New("geneve option too small") - } - opt.Data = make([]byte, opt.Length-4) - copy(opt.Data, data[4:opt.Length]) - - return opt, opt.Length, nil -} - -func (gn *Geneve) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 7 { - df.SetTruncated() - return errors.New("geneve packet too short") - } - - gn.Version = data[0] >> 7 - gn.OptionsLength = (data[0] & 0x3f) * 4 - - gn.OAMPacket = data[1]&0x80 > 0 - gn.CriticalOption = data[1]&0x40 > 0 - gn.Protocol = EthernetType(binary.BigEndian.Uint16(data[2:4])) - - var buf [4]byte - copy(buf[1:], data[4:7]) - gn.VNI = binary.BigEndian.Uint32(buf[:]) - - offset, length := uint8(8), int32(gn.OptionsLength) - if len(data) < int(length+7) { - df.SetTruncated() - return errors.New("geneve packet too short") - } - - for length > 0 { - opt, len, err := decodeGeneveOption(data[offset:], gn, df) - if err != nil { - return err - } - gn.Options = append(gn.Options, opt) - - length -= int32(len) - offset += len - } - - gn.BaseLayer = BaseLayer{data[:offset], data[offset:]} - - return nil -} - -func (gn *Geneve) NextLayerType() gopacket.LayerType { - return gn.Protocol.LayerType() -} - -func decodeGeneve(data []byte, p gopacket.PacketBuilder) error { - gn := &Geneve{} - return decodingLayerDecoder(gn, data, p) -} diff --git a/vendor/github.com/google/gopacket/layers/gre.go b/vendor/github.com/google/gopacket/layers/gre.go deleted file mode 100644 index 9c5e7d246..000000000 --- a/vendor/github.com/google/gopacket/layers/gre.go +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - - "github.com/google/gopacket" -) - -// GRE is a Generic Routing Encapsulation header. -type GRE struct { - BaseLayer - ChecksumPresent, RoutingPresent, KeyPresent, SeqPresent, StrictSourceRoute, AckPresent bool - RecursionControl, Flags, Version uint8 - Protocol EthernetType - Checksum, Offset uint16 - Key, Seq, Ack uint32 - *GRERouting -} - -// GRERouting is GRE routing information, present if the RoutingPresent flag is -// set. -type GRERouting struct { - AddressFamily uint16 - SREOffset, SRELength uint8 - RoutingInformation []byte - Next *GRERouting -} - -// LayerType returns gopacket.LayerTypeGRE. -func (g *GRE) LayerType() gopacket.LayerType { return LayerTypeGRE } - -// DecodeFromBytes decodes the given bytes into this layer. -func (g *GRE) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - g.ChecksumPresent = data[0]&0x80 != 0 - g.RoutingPresent = data[0]&0x40 != 0 - g.KeyPresent = data[0]&0x20 != 0 - g.SeqPresent = data[0]&0x10 != 0 - g.StrictSourceRoute = data[0]&0x08 != 0 - g.AckPresent = data[1]&0x80 != 0 - g.RecursionControl = data[0] & 0x7 - g.Flags = data[1] >> 3 - g.Version = data[1] & 0x7 - g.Protocol = EthernetType(binary.BigEndian.Uint16(data[2:4])) - offset := 4 - if g.ChecksumPresent || g.RoutingPresent { - g.Checksum = binary.BigEndian.Uint16(data[offset : offset+2]) - g.Offset = binary.BigEndian.Uint16(data[offset+2 : offset+4]) - offset += 4 - } - if g.KeyPresent { - g.Key = binary.BigEndian.Uint32(data[offset : offset+4]) - offset += 4 - } - if g.SeqPresent { - g.Seq = binary.BigEndian.Uint32(data[offset : offset+4]) - offset += 4 - } - if g.RoutingPresent { - tail := &g.GRERouting - for { - sre := &GRERouting{ - AddressFamily: binary.BigEndian.Uint16(data[offset : offset+2]), - SREOffset: data[offset+2], - SRELength: data[offset+3], - } - sre.RoutingInformation = data[offset+4 : offset+4+int(sre.SRELength)] - offset += 4 + int(sre.SRELength) - if sre.AddressFamily == 0 && sre.SRELength == 0 { - break - } - (*tail) = sre - tail = &sre.Next - } - } - if g.AckPresent { - g.Ack = binary.BigEndian.Uint32(data[offset : offset+4]) - offset += 4 - } - g.BaseLayer = BaseLayer{data[:offset], data[offset:]} - return nil -} - -// SerializeTo writes the serialized form of this layer into the SerializationBuffer, -// implementing gopacket.SerializableLayer. See the docs for gopacket.SerializableLayer for more info. -func (g *GRE) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - size := 4 - if g.ChecksumPresent || g.RoutingPresent { - size += 4 - } - if g.KeyPresent { - size += 4 - } - if g.SeqPresent { - size += 4 - } - if g.RoutingPresent { - r := g.GRERouting - for r != nil { - size += 4 + int(r.SRELength) - r = r.Next - } - size += 4 - } - if g.AckPresent { - size += 4 - } - buf, err := b.PrependBytes(size) - if err != nil { - return err - } - // Reset any potentially dirty memory in the first 2 bytes, as these use OR to set flags. - buf[0] = 0 - buf[1] = 0 - if g.ChecksumPresent { - buf[0] |= 0x80 - } - if g.RoutingPresent { - buf[0] |= 0x40 - } - if g.KeyPresent { - buf[0] |= 0x20 - } - if g.SeqPresent { - buf[0] |= 0x10 - } - if g.StrictSourceRoute { - buf[0] |= 0x08 - } - if g.AckPresent { - buf[1] |= 0x80 - } - buf[0] |= g.RecursionControl - buf[1] |= g.Flags << 3 - buf[1] |= g.Version - binary.BigEndian.PutUint16(buf[2:4], uint16(g.Protocol)) - offset := 4 - if g.ChecksumPresent || g.RoutingPresent { - // Don't write the checksum value yet, as we may need to compute it, - // which requires the entire header be complete. - // Instead we zeroize the memory in case it is dirty. - buf[offset] = 0 - buf[offset+1] = 0 - binary.BigEndian.PutUint16(buf[offset+2:offset+4], g.Offset) - offset += 4 - } - if g.KeyPresent { - binary.BigEndian.PutUint32(buf[offset:offset+4], g.Key) - offset += 4 - } - if g.SeqPresent { - binary.BigEndian.PutUint32(buf[offset:offset+4], g.Seq) - offset += 4 - } - if g.RoutingPresent { - sre := g.GRERouting - for sre != nil { - binary.BigEndian.PutUint16(buf[offset:offset+2], sre.AddressFamily) - buf[offset+2] = sre.SREOffset - buf[offset+3] = sre.SRELength - copy(buf[offset+4:offset+4+int(sre.SRELength)], sre.RoutingInformation) - offset += 4 + int(sre.SRELength) - sre = sre.Next - } - // Terminate routing field with a "NULL" SRE. - binary.BigEndian.PutUint32(buf[offset:offset+4], 0) - } - if g.AckPresent { - binary.BigEndian.PutUint32(buf[offset:offset+4], g.Ack) - offset += 4 - } - if g.ChecksumPresent { - if opts.ComputeChecksums { - g.Checksum = tcpipChecksum(b.Bytes(), 0) - } - - binary.BigEndian.PutUint16(buf[4:6], g.Checksum) - } - return nil -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (g *GRE) CanDecode() gopacket.LayerClass { - return LayerTypeGRE -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (g *GRE) NextLayerType() gopacket.LayerType { - return g.Protocol.LayerType() -} - -func decodeGRE(data []byte, p gopacket.PacketBuilder) error { - g := &GRE{} - return decodingLayerDecoder(g, data, p) -} diff --git a/vendor/github.com/google/gopacket/layers/gtp.go b/vendor/github.com/google/gopacket/layers/gtp.go deleted file mode 100644 index fe3054a6d..000000000 --- a/vendor/github.com/google/gopacket/layers/gtp.go +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright 2017 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. -// - -package layers - -import ( - "encoding/binary" - "fmt" - "github.com/google/gopacket" -) - -const gtpMinimumSizeInBytes int = 8 - -// GTPExtensionHeader is used to carry extra data and enable future extensions of the GTP without the need to use another version number. -type GTPExtensionHeader struct { - Type uint8 - Content []byte -} - -// GTPv1U protocol is used to exchange user data over GTP tunnels across the Sx interfaces. -// Defined in https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1595 -type GTPv1U struct { - BaseLayer - Version uint8 - ProtocolType uint8 - Reserved uint8 - ExtensionHeaderFlag bool - SequenceNumberFlag bool - NPDUFlag bool - MessageType uint8 - MessageLength uint16 - TEID uint32 - SequenceNumber uint16 - NPDU uint8 - GTPExtensionHeaders []GTPExtensionHeader -} - -// LayerType returns LayerTypeGTPV1U -func (g *GTPv1U) LayerType() gopacket.LayerType { return LayerTypeGTPv1U } - -// DecodeFromBytes analyses a byte slice and attempts to decode it as a GTPv1U packet -func (g *GTPv1U) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - hLen := gtpMinimumSizeInBytes - dLen := len(data) - if dLen < hLen { - return fmt.Errorf("GTP packet too small: %d bytes", dLen) - } - g.Version = (data[0] >> 5) & 0x07 - g.ProtocolType = (data[0] >> 4) & 0x01 - g.Reserved = (data[0] >> 3) & 0x01 - g.SequenceNumberFlag = ((data[0] >> 1) & 0x01) == 1 - g.NPDUFlag = (data[0] & 0x01) == 1 - g.ExtensionHeaderFlag = ((data[0] >> 2) & 0x01) == 1 - g.MessageType = data[1] - g.MessageLength = binary.BigEndian.Uint16(data[2:4]) - pLen := 8 + g.MessageLength - if uint16(dLen) < pLen { - return fmt.Errorf("GTP packet too small: %d bytes", dLen) - } - // Field used to multiplex different connections in the same GTP tunnel. - g.TEID = binary.BigEndian.Uint32(data[4:8]) - cIndex := uint16(hLen) - if g.SequenceNumberFlag || g.NPDUFlag || g.ExtensionHeaderFlag { - hLen += 4 - cIndex += 4 - if dLen < hLen { - return fmt.Errorf("GTP packet too small: %d bytes", dLen) - } - if g.SequenceNumberFlag { - g.SequenceNumber = binary.BigEndian.Uint16(data[8:10]) - } - if g.NPDUFlag { - g.NPDU = data[10] - } - if g.ExtensionHeaderFlag { - extensionFlag := true - for extensionFlag { - extensionType := uint8(data[cIndex-1]) - extensionLength := uint(data[cIndex]) - if extensionLength == 0 { - return fmt.Errorf("GTP packet with invalid extension header") - } - // extensionLength is in 4-octet units - lIndex := cIndex + (uint16(extensionLength) * 4) - if uint16(dLen) < lIndex { - fmt.Println(dLen, lIndex) - return fmt.Errorf("GTP packet with small extension header: %d bytes", dLen) - } - content := data[cIndex+1 : lIndex-1] - eh := GTPExtensionHeader{Type: extensionType, Content: content} - g.GTPExtensionHeaders = append(g.GTPExtensionHeaders, eh) - cIndex = lIndex - // Check if coming bytes are from an extension header - extensionFlag = data[cIndex-1] != 0 - - } - } - } - g.BaseLayer = BaseLayer{Contents: data[:cIndex], Payload: data[cIndex:]} - return nil - -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (g *GTPv1U) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - data, err := b.PrependBytes(gtpMinimumSizeInBytes) - if err != nil { - return err - } - data[0] |= (g.Version << 5) - data[0] |= (1 << 4) - if len(g.GTPExtensionHeaders) > 0 { - data[0] |= 0x04 - g.ExtensionHeaderFlag = true - } - if g.SequenceNumberFlag { - data[0] |= 0x02 - } - if g.NPDUFlag { - data[0] |= 0x01 - } - data[1] = g.MessageType - binary.BigEndian.PutUint16(data[2:4], g.MessageLength) - binary.BigEndian.PutUint32(data[4:8], g.TEID) - if g.ExtensionHeaderFlag || g.SequenceNumberFlag || g.NPDUFlag { - data, err := b.AppendBytes(4) - if err != nil { - return err - } - binary.BigEndian.PutUint16(data[:2], g.SequenceNumber) - data[2] = g.NPDU - for _, eh := range g.GTPExtensionHeaders { - data[len(data)-1] = eh.Type - lContent := len(eh.Content) - // extensionLength is in 4-octet units - extensionLength := (lContent + 2) / 4 - // Get two extra byte for the next extension header type and length - data, err = b.AppendBytes(lContent + 2) - if err != nil { - return err - } - data[0] = byte(extensionLength) - copy(data[1:lContent+1], eh.Content) - } - } - return nil - -} - -// CanDecode returns a set of layers that GTP objects can decode. -func (g *GTPv1U) CanDecode() gopacket.LayerClass { - return LayerTypeGTPv1U -} - -// NextLayerType specifies the next layer that GoPacket should attempt to -func (g *GTPv1U) NextLayerType() gopacket.LayerType { - if len(g.LayerPayload()) == 0 { - return gopacket.LayerTypeZero - } - version := uint8(g.LayerPayload()[0]) >> 4 - if version == 4 { - return LayerTypeIPv4 - } else if version == 6 { - return LayerTypeIPv6 - } else { - return LayerTypePPP - } -} - -func decodeGTPv1u(data []byte, p gopacket.PacketBuilder) error { - gtp := >Pv1U{} - err := gtp.DecodeFromBytes(data, p) - if err != nil { - return err - } - p.AddLayer(gtp) - return p.NextDecoder(gtp.NextLayerType()) -} diff --git a/vendor/github.com/google/gopacket/layers/iana_ports.go b/vendor/github.com/google/gopacket/layers/iana_ports.go deleted file mode 100644 index ddcf3ecdb..000000000 --- a/vendor/github.com/google/gopacket/layers/iana_ports.go +++ /dev/null @@ -1,11351 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. - -package layers - -// Created by gen.go, don't edit manually -// Generated at 2017-10-23 09:57:28.214859163 -0600 MDT m=+1.011679290 -// Fetched from "http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml" - -// TCPPortNames contains the port names for all TCP ports. -var TCPPortNames = tcpPortNames - -// UDPPortNames contains the port names for all UDP ports. -var UDPPortNames = udpPortNames - -// SCTPPortNames contains the port names for all SCTP ports. -var SCTPPortNames = sctpPortNames - -var tcpPortNames = map[TCPPort]string{ - 1: "tcpmux", - 2: "compressnet", - 3: "compressnet", - 5: "rje", - 7: "echo", - 9: "discard", - 11: "systat", - 13: "daytime", - 17: "qotd", - 18: "msp", - 19: "chargen", - 20: "ftp-data", - 21: "ftp", - 22: "ssh", - 23: "telnet", - 25: "smtp", - 27: "nsw-fe", - 29: "msg-icp", - 31: "msg-auth", - 33: "dsp", - 37: "time", - 38: "rap", - 39: "rlp", - 41: "graphics", - 42: "name", - 43: "nicname", - 44: "mpm-flags", - 45: "mpm", - 46: "mpm-snd", - 48: "auditd", - 49: "tacacs", - 50: "re-mail-ck", - 52: "xns-time", - 53: "domain", - 54: "xns-ch", - 55: "isi-gl", - 56: "xns-auth", - 58: "xns-mail", - 62: "acas", - 63: "whoispp", - 64: "covia", - 65: "tacacs-ds", - 66: "sql-net", - 67: "bootps", - 68: "bootpc", - 69: "tftp", - 70: "gopher", - 71: "netrjs-1", - 72: "netrjs-2", - 73: "netrjs-3", - 74: "netrjs-4", - 76: "deos", - 78: "vettcp", - 79: "finger", - 80: "http", - 82: "xfer", - 83: "mit-ml-dev", - 84: "ctf", - 85: "mit-ml-dev", - 86: "mfcobol", - 88: "kerberos", - 89: "su-mit-tg", - 90: "dnsix", - 91: "mit-dov", - 92: "npp", - 93: "dcp", - 94: "objcall", - 95: "supdup", - 96: "dixie", - 97: "swift-rvf", - 98: "tacnews", - 99: "metagram", - 101: "hostname", - 102: "iso-tsap", - 103: "gppitnp", - 104: "acr-nema", - 105: "cso", - 106: "3com-tsmux", - 107: "rtelnet", - 108: "snagas", - 109: "pop2", - 110: "pop3", - 111: "sunrpc", - 112: "mcidas", - 113: "ident", - 115: "sftp", - 116: "ansanotify", - 117: "uucp-path", - 118: "sqlserv", - 119: "nntp", - 120: "cfdptkt", - 121: "erpc", - 122: "smakynet", - 123: "ntp", - 124: "ansatrader", - 125: "locus-map", - 126: "nxedit", - 127: "locus-con", - 128: "gss-xlicen", - 129: "pwdgen", - 130: "cisco-fna", - 131: "cisco-tna", - 132: "cisco-sys", - 133: "statsrv", - 134: "ingres-net", - 135: "epmap", - 136: "profile", - 137: "netbios-ns", - 138: "netbios-dgm", - 139: "netbios-ssn", - 140: "emfis-data", - 141: "emfis-cntl", - 142: "bl-idm", - 143: "imap", - 144: "uma", - 145: "uaac", - 146: "iso-tp0", - 147: "iso-ip", - 148: "jargon", - 149: "aed-512", - 150: "sql-net", - 151: "hems", - 152: "bftp", - 153: "sgmp", - 154: "netsc-prod", - 155: "netsc-dev", - 156: "sqlsrv", - 157: "knet-cmp", - 158: "pcmail-srv", - 159: "nss-routing", - 160: "sgmp-traps", - 161: "snmp", - 162: "snmptrap", - 163: "cmip-man", - 164: "cmip-agent", - 165: "xns-courier", - 166: "s-net", - 167: "namp", - 168: "rsvd", - 169: "send", - 170: "print-srv", - 171: "multiplex", - 172: "cl-1", - 173: "xyplex-mux", - 174: "mailq", - 175: "vmnet", - 176: "genrad-mux", - 177: "xdmcp", - 178: "nextstep", - 179: "bgp", - 180: "ris", - 181: "unify", - 182: "audit", - 183: "ocbinder", - 184: "ocserver", - 185: "remote-kis", - 186: "kis", - 187: "aci", - 188: "mumps", - 189: "qft", - 190: "gacp", - 191: "prospero", - 192: "osu-nms", - 193: "srmp", - 194: "irc", - 195: "dn6-nlm-aud", - 196: "dn6-smm-red", - 197: "dls", - 198: "dls-mon", - 199: "smux", - 200: "src", - 201: "at-rtmp", - 202: "at-nbp", - 203: "at-3", - 204: "at-echo", - 205: "at-5", - 206: "at-zis", - 207: "at-7", - 208: "at-8", - 209: "qmtp", - 210: "z39-50", - 211: "914c-g", - 212: "anet", - 213: "ipx", - 214: "vmpwscs", - 215: "softpc", - 216: "CAIlic", - 217: "dbase", - 218: "mpp", - 219: "uarps", - 220: "imap3", - 221: "fln-spx", - 222: "rsh-spx", - 223: "cdc", - 224: "masqdialer", - 242: "direct", - 243: "sur-meas", - 244: "inbusiness", - 245: "link", - 246: "dsp3270", - 247: "subntbcst-tftp", - 248: "bhfhs", - 256: "rap", - 257: "set", - 259: "esro-gen", - 260: "openport", - 261: "nsiiops", - 262: "arcisdms", - 263: "hdap", - 264: "bgmp", - 265: "x-bone-ctl", - 266: "sst", - 267: "td-service", - 268: "td-replica", - 269: "manet", - 271: "pt-tls", - 280: "http-mgmt", - 281: "personal-link", - 282: "cableport-ax", - 283: "rescap", - 284: "corerjd", - 286: "fxp", - 287: "k-block", - 308: "novastorbakcup", - 309: "entrusttime", - 310: "bhmds", - 311: "asip-webadmin", - 312: "vslmp", - 313: "magenta-logic", - 314: "opalis-robot", - 315: "dpsi", - 316: "decauth", - 317: "zannet", - 318: "pkix-timestamp", - 319: "ptp-event", - 320: "ptp-general", - 321: "pip", - 322: "rtsps", - 323: "rpki-rtr", - 324: "rpki-rtr-tls", - 333: "texar", - 344: "pdap", - 345: "pawserv", - 346: "zserv", - 347: "fatserv", - 348: "csi-sgwp", - 349: "mftp", - 350: "matip-type-a", - 351: "matip-type-b", - 352: "dtag-ste-sb", - 353: "ndsauth", - 354: "bh611", - 355: "datex-asn", - 356: "cloanto-net-1", - 357: "bhevent", - 358: "shrinkwrap", - 359: "nsrmp", - 360: "scoi2odialog", - 361: "semantix", - 362: "srssend", - 363: "rsvp-tunnel", - 364: "aurora-cmgr", - 365: "dtk", - 366: "odmr", - 367: "mortgageware", - 368: "qbikgdp", - 369: "rpc2portmap", - 370: "codaauth2", - 371: "clearcase", - 372: "ulistproc", - 373: "legent-1", - 374: "legent-2", - 375: "hassle", - 376: "nip", - 377: "tnETOS", - 378: "dsETOS", - 379: "is99c", - 380: "is99s", - 381: "hp-collector", - 382: "hp-managed-node", - 383: "hp-alarm-mgr", - 384: "arns", - 385: "ibm-app", - 386: "asa", - 387: "aurp", - 388: "unidata-ldm", - 389: "ldap", - 390: "uis", - 391: "synotics-relay", - 392: "synotics-broker", - 393: "meta5", - 394: "embl-ndt", - 395: "netcp", - 396: "netware-ip", - 397: "mptn", - 398: "kryptolan", - 399: "iso-tsap-c2", - 400: "osb-sd", - 401: "ups", - 402: "genie", - 403: "decap", - 404: "nced", - 405: "ncld", - 406: "imsp", - 407: "timbuktu", - 408: "prm-sm", - 409: "prm-nm", - 410: "decladebug", - 411: "rmt", - 412: "synoptics-trap", - 413: "smsp", - 414: "infoseek", - 415: "bnet", - 416: "silverplatter", - 417: "onmux", - 418: "hyper-g", - 419: "ariel1", - 420: "smpte", - 421: "ariel2", - 422: "ariel3", - 423: "opc-job-start", - 424: "opc-job-track", - 425: "icad-el", - 426: "smartsdp", - 427: "svrloc", - 428: "ocs-cmu", - 429: "ocs-amu", - 430: "utmpsd", - 431: "utmpcd", - 432: "iasd", - 433: "nnsp", - 434: "mobileip-agent", - 435: "mobilip-mn", - 436: "dna-cml", - 437: "comscm", - 438: "dsfgw", - 439: "dasp", - 440: "sgcp", - 441: "decvms-sysmgt", - 442: "cvc-hostd", - 443: "https", - 444: "snpp", - 445: "microsoft-ds", - 446: "ddm-rdb", - 447: "ddm-dfm", - 448: "ddm-ssl", - 449: "as-servermap", - 450: "tserver", - 451: "sfs-smp-net", - 452: "sfs-config", - 453: "creativeserver", - 454: "contentserver", - 455: "creativepartnr", - 456: "macon-tcp", - 457: "scohelp", - 458: "appleqtc", - 459: "ampr-rcmd", - 460: "skronk", - 461: "datasurfsrv", - 462: "datasurfsrvsec", - 463: "alpes", - 464: "kpasswd", - 465: "urd", - 466: "digital-vrc", - 467: "mylex-mapd", - 468: "photuris", - 469: "rcp", - 470: "scx-proxy", - 471: "mondex", - 472: "ljk-login", - 473: "hybrid-pop", - 474: "tn-tl-w1", - 475: "tcpnethaspsrv", - 476: "tn-tl-fd1", - 477: "ss7ns", - 478: "spsc", - 479: "iafserver", - 480: "iafdbase", - 481: "ph", - 482: "bgs-nsi", - 483: "ulpnet", - 484: "integra-sme", - 485: "powerburst", - 486: "avian", - 487: "saft", - 488: "gss-http", - 489: "nest-protocol", - 490: "micom-pfs", - 491: "go-login", - 492: "ticf-1", - 493: "ticf-2", - 494: "pov-ray", - 495: "intecourier", - 496: "pim-rp-disc", - 497: "retrospect", - 498: "siam", - 499: "iso-ill", - 500: "isakmp", - 501: "stmf", - 502: "mbap", - 503: "intrinsa", - 504: "citadel", - 505: "mailbox-lm", - 506: "ohimsrv", - 507: "crs", - 508: "xvttp", - 509: "snare", - 510: "fcp", - 511: "passgo", - 512: "exec", - 513: "login", - 514: "shell", - 515: "printer", - 516: "videotex", - 517: "talk", - 518: "ntalk", - 519: "utime", - 520: "efs", - 521: "ripng", - 522: "ulp", - 523: "ibm-db2", - 524: "ncp", - 525: "timed", - 526: "tempo", - 527: "stx", - 528: "custix", - 529: "irc-serv", - 530: "courier", - 531: "conference", - 532: "netnews", - 533: "netwall", - 534: "windream", - 535: "iiop", - 536: "opalis-rdv", - 537: "nmsp", - 538: "gdomap", - 539: "apertus-ldp", - 540: "uucp", - 541: "uucp-rlogin", - 542: "commerce", - 543: "klogin", - 544: "kshell", - 545: "appleqtcsrvr", - 546: "dhcpv6-client", - 547: "dhcpv6-server", - 548: "afpovertcp", - 549: "idfp", - 550: "new-rwho", - 551: "cybercash", - 552: "devshr-nts", - 553: "pirp", - 554: "rtsp", - 555: "dsf", - 556: "remotefs", - 557: "openvms-sysipc", - 558: "sdnskmp", - 559: "teedtap", - 560: "rmonitor", - 561: "monitor", - 562: "chshell", - 563: "nntps", - 564: "9pfs", - 565: "whoami", - 566: "streettalk", - 567: "banyan-rpc", - 568: "ms-shuttle", - 569: "ms-rome", - 570: "meter", - 571: "meter", - 572: "sonar", - 573: "banyan-vip", - 574: "ftp-agent", - 575: "vemmi", - 576: "ipcd", - 577: "vnas", - 578: "ipdd", - 579: "decbsrv", - 580: "sntp-heartbeat", - 581: "bdp", - 582: "scc-security", - 583: "philips-vc", - 584: "keyserver", - 586: "password-chg", - 587: "submission", - 588: "cal", - 589: "eyelink", - 590: "tns-cml", - 591: "http-alt", - 592: "eudora-set", - 593: "http-rpc-epmap", - 594: "tpip", - 595: "cab-protocol", - 596: "smsd", - 597: "ptcnameservice", - 598: "sco-websrvrmg3", - 599: "acp", - 600: "ipcserver", - 601: "syslog-conn", - 602: "xmlrpc-beep", - 603: "idxp", - 604: "tunnel", - 605: "soap-beep", - 606: "urm", - 607: "nqs", - 608: "sift-uft", - 609: "npmp-trap", - 610: "npmp-local", - 611: "npmp-gui", - 612: "hmmp-ind", - 613: "hmmp-op", - 614: "sshell", - 615: "sco-inetmgr", - 616: "sco-sysmgr", - 617: "sco-dtmgr", - 618: "dei-icda", - 619: "compaq-evm", - 620: "sco-websrvrmgr", - 621: "escp-ip", - 622: "collaborator", - 623: "oob-ws-http", - 624: "cryptoadmin", - 625: "dec-dlm", - 626: "asia", - 627: "passgo-tivoli", - 628: "qmqp", - 629: "3com-amp3", - 630: "rda", - 631: "ipp", - 632: "bmpp", - 633: "servstat", - 634: "ginad", - 635: "rlzdbase", - 636: "ldaps", - 637: "lanserver", - 638: "mcns-sec", - 639: "msdp", - 640: "entrust-sps", - 641: "repcmd", - 642: "esro-emsdp", - 643: "sanity", - 644: "dwr", - 645: "pssc", - 646: "ldp", - 647: "dhcp-failover", - 648: "rrp", - 649: "cadview-3d", - 650: "obex", - 651: "ieee-mms", - 652: "hello-port", - 653: "repscmd", - 654: "aodv", - 655: "tinc", - 656: "spmp", - 657: "rmc", - 658: "tenfold", - 660: "mac-srvr-admin", - 661: "hap", - 662: "pftp", - 663: "purenoise", - 664: "oob-ws-https", - 665: "sun-dr", - 666: "mdqs", - 667: "disclose", - 668: "mecomm", - 669: "meregister", - 670: "vacdsm-sws", - 671: "vacdsm-app", - 672: "vpps-qua", - 673: "cimplex", - 674: "acap", - 675: "dctp", - 676: "vpps-via", - 677: "vpp", - 678: "ggf-ncp", - 679: "mrm", - 680: "entrust-aaas", - 681: "entrust-aams", - 682: "xfr", - 683: "corba-iiop", - 684: "corba-iiop-ssl", - 685: "mdc-portmapper", - 686: "hcp-wismar", - 687: "asipregistry", - 688: "realm-rusd", - 689: "nmap", - 690: "vatp", - 691: "msexch-routing", - 692: "hyperwave-isp", - 693: "connendp", - 694: "ha-cluster", - 695: "ieee-mms-ssl", - 696: "rushd", - 697: "uuidgen", - 698: "olsr", - 699: "accessnetwork", - 700: "epp", - 701: "lmp", - 702: "iris-beep", - 704: "elcsd", - 705: "agentx", - 706: "silc", - 707: "borland-dsj", - 709: "entrust-kmsh", - 710: "entrust-ash", - 711: "cisco-tdp", - 712: "tbrpf", - 713: "iris-xpc", - 714: "iris-xpcs", - 715: "iris-lwz", - 729: "netviewdm1", - 730: "netviewdm2", - 731: "netviewdm3", - 741: "netgw", - 742: "netrcs", - 744: "flexlm", - 747: "fujitsu-dev", - 748: "ris-cm", - 749: "kerberos-adm", - 750: "rfile", - 751: "pump", - 752: "qrh", - 753: "rrh", - 754: "tell", - 758: "nlogin", - 759: "con", - 760: "ns", - 761: "rxe", - 762: "quotad", - 763: "cycleserv", - 764: "omserv", - 765: "webster", - 767: "phonebook", - 769: "vid", - 770: "cadlock", - 771: "rtip", - 772: "cycleserv2", - 773: "submit", - 774: "rpasswd", - 775: "entomb", - 776: "wpages", - 777: "multiling-http", - 780: "wpgs", - 800: "mdbs-daemon", - 801: "device", - 802: "mbap-s", - 810: "fcp-udp", - 828: "itm-mcell-s", - 829: "pkix-3-ca-ra", - 830: "netconf-ssh", - 831: "netconf-beep", - 832: "netconfsoaphttp", - 833: "netconfsoapbeep", - 847: "dhcp-failover2", - 848: "gdoi", - 853: "domain-s", - 854: "dlep", - 860: "iscsi", - 861: "owamp-control", - 862: "twamp-control", - 873: "rsync", - 886: "iclcnet-locate", - 887: "iclcnet-svinfo", - 888: "accessbuilder", - 900: "omginitialrefs", - 901: "smpnameres", - 902: "ideafarm-door", - 903: "ideafarm-panic", - 910: "kink", - 911: "xact-backup", - 912: "apex-mesh", - 913: "apex-edge", - 953: "rndc", - 989: "ftps-data", - 990: "ftps", - 991: "nas", - 992: "telnets", - 993: "imaps", - 995: "pop3s", - 996: "vsinet", - 997: "maitrd", - 998: "busboy", - 999: "garcon", - 1000: "cadlock2", - 1001: "webpush", - 1010: "surf", - 1021: "exp1", - 1022: "exp2", - 1025: "blackjack", - 1026: "cap", - 1029: "solid-mux", - 1033: "netinfo-local", - 1034: "activesync", - 1035: "mxxrlogin", - 1036: "nsstp", - 1037: "ams", - 1038: "mtqp", - 1039: "sbl", - 1040: "netarx", - 1041: "danf-ak2", - 1042: "afrog", - 1043: "boinc-client", - 1044: "dcutility", - 1045: "fpitp", - 1046: "wfremotertm", - 1047: "neod1", - 1048: "neod2", - 1049: "td-postman", - 1050: "cma", - 1051: "optima-vnet", - 1052: "ddt", - 1053: "remote-as", - 1054: "brvread", - 1055: "ansyslmd", - 1056: "vfo", - 1057: "startron", - 1058: "nim", - 1059: "nimreg", - 1060: "polestar", - 1061: "kiosk", - 1062: "veracity", - 1063: "kyoceranetdev", - 1064: "jstel", - 1065: "syscomlan", - 1066: "fpo-fns", - 1067: "instl-boots", - 1068: "instl-bootc", - 1069: "cognex-insight", - 1070: "gmrupdateserv", - 1071: "bsquare-voip", - 1072: "cardax", - 1073: "bridgecontrol", - 1074: "warmspotMgmt", - 1075: "rdrmshc", - 1076: "dab-sti-c", - 1077: "imgames", - 1078: "avocent-proxy", - 1079: "asprovatalk", - 1080: "socks", - 1081: "pvuniwien", - 1082: "amt-esd-prot", - 1083: "ansoft-lm-1", - 1084: "ansoft-lm-2", - 1085: "webobjects", - 1086: "cplscrambler-lg", - 1087: "cplscrambler-in", - 1088: "cplscrambler-al", - 1089: "ff-annunc", - 1090: "ff-fms", - 1091: "ff-sm", - 1092: "obrpd", - 1093: "proofd", - 1094: "rootd", - 1095: "nicelink", - 1096: "cnrprotocol", - 1097: "sunclustermgr", - 1098: "rmiactivation", - 1099: "rmiregistry", - 1100: "mctp", - 1101: "pt2-discover", - 1102: "adobeserver-1", - 1103: "adobeserver-2", - 1104: "xrl", - 1105: "ftranhc", - 1106: "isoipsigport-1", - 1107: "isoipsigport-2", - 1108: "ratio-adp", - 1110: "webadmstart", - 1111: "lmsocialserver", - 1112: "icp", - 1113: "ltp-deepspace", - 1114: "mini-sql", - 1115: "ardus-trns", - 1116: "ardus-cntl", - 1117: "ardus-mtrns", - 1118: "sacred", - 1119: "bnetgame", - 1120: "bnetfile", - 1121: "rmpp", - 1122: "availant-mgr", - 1123: "murray", - 1124: "hpvmmcontrol", - 1125: "hpvmmagent", - 1126: "hpvmmdata", - 1127: "kwdb-commn", - 1128: "saphostctrl", - 1129: "saphostctrls", - 1130: "casp", - 1131: "caspssl", - 1132: "kvm-via-ip", - 1133: "dfn", - 1134: "aplx", - 1135: "omnivision", - 1136: "hhb-gateway", - 1137: "trim", - 1138: "encrypted-admin", - 1139: "evm", - 1140: "autonoc", - 1141: "mxomss", - 1142: "edtools", - 1143: "imyx", - 1144: "fuscript", - 1145: "x9-icue", - 1146: "audit-transfer", - 1147: "capioverlan", - 1148: "elfiq-repl", - 1149: "bvtsonar", - 1150: "blaze", - 1151: "unizensus", - 1152: "winpoplanmess", - 1153: "c1222-acse", - 1154: "resacommunity", - 1155: "nfa", - 1156: "iascontrol-oms", - 1157: "iascontrol", - 1158: "dbcontrol-oms", - 1159: "oracle-oms", - 1160: "olsv", - 1161: "health-polling", - 1162: "health-trap", - 1163: "sddp", - 1164: "qsm-proxy", - 1165: "qsm-gui", - 1166: "qsm-remote", - 1167: "cisco-ipsla", - 1168: "vchat", - 1169: "tripwire", - 1170: "atc-lm", - 1171: "atc-appserver", - 1172: "dnap", - 1173: "d-cinema-rrp", - 1174: "fnet-remote-ui", - 1175: "dossier", - 1176: "indigo-server", - 1177: "dkmessenger", - 1178: "sgi-storman", - 1179: "b2n", - 1180: "mc-client", - 1181: "3comnetman", - 1182: "accelenet", - 1183: "llsurfup-http", - 1184: "llsurfup-https", - 1185: "catchpole", - 1186: "mysql-cluster", - 1187: "alias", - 1188: "hp-webadmin", - 1189: "unet", - 1190: "commlinx-avl", - 1191: "gpfs", - 1192: "caids-sensor", - 1193: "fiveacross", - 1194: "openvpn", - 1195: "rsf-1", - 1196: "netmagic", - 1197: "carrius-rshell", - 1198: "cajo-discovery", - 1199: "dmidi", - 1200: "scol", - 1201: "nucleus-sand", - 1202: "caiccipc", - 1203: "ssslic-mgr", - 1204: "ssslog-mgr", - 1205: "accord-mgc", - 1206: "anthony-data", - 1207: "metasage", - 1208: "seagull-ais", - 1209: "ipcd3", - 1210: "eoss", - 1211: "groove-dpp", - 1212: "lupa", - 1213: "mpc-lifenet", - 1214: "kazaa", - 1215: "scanstat-1", - 1216: "etebac5", - 1217: "hpss-ndapi", - 1218: "aeroflight-ads", - 1219: "aeroflight-ret", - 1220: "qt-serveradmin", - 1221: "sweetware-apps", - 1222: "nerv", - 1223: "tgp", - 1224: "vpnz", - 1225: "slinkysearch", - 1226: "stgxfws", - 1227: "dns2go", - 1228: "florence", - 1229: "zented", - 1230: "periscope", - 1231: "menandmice-lpm", - 1232: "first-defense", - 1233: "univ-appserver", - 1234: "search-agent", - 1235: "mosaicsyssvc1", - 1236: "bvcontrol", - 1237: "tsdos390", - 1238: "hacl-qs", - 1239: "nmsd", - 1240: "instantia", - 1241: "nessus", - 1242: "nmasoverip", - 1243: "serialgateway", - 1244: "isbconference1", - 1245: "isbconference2", - 1246: "payrouter", - 1247: "visionpyramid", - 1248: "hermes", - 1249: "mesavistaco", - 1250: "swldy-sias", - 1251: "servergraph", - 1252: "bspne-pcc", - 1253: "q55-pcc", - 1254: "de-noc", - 1255: "de-cache-query", - 1256: "de-server", - 1257: "shockwave2", - 1258: "opennl", - 1259: "opennl-voice", - 1260: "ibm-ssd", - 1261: "mpshrsv", - 1262: "qnts-orb", - 1263: "dka", - 1264: "prat", - 1265: "dssiapi", - 1266: "dellpwrappks", - 1267: "epc", - 1268: "propel-msgsys", - 1269: "watilapp", - 1270: "opsmgr", - 1271: "excw", - 1272: "cspmlockmgr", - 1273: "emc-gateway", - 1274: "t1distproc", - 1275: "ivcollector", - 1277: "miva-mqs", - 1278: "dellwebadmin-1", - 1279: "dellwebadmin-2", - 1280: "pictrography", - 1281: "healthd", - 1282: "emperion", - 1283: "productinfo", - 1284: "iee-qfx", - 1285: "neoiface", - 1286: "netuitive", - 1287: "routematch", - 1288: "navbuddy", - 1289: "jwalkserver", - 1290: "winjaserver", - 1291: "seagulllms", - 1292: "dsdn", - 1293: "pkt-krb-ipsec", - 1294: "cmmdriver", - 1295: "ehtp", - 1296: "dproxy", - 1297: "sdproxy", - 1298: "lpcp", - 1299: "hp-sci", - 1300: "h323hostcallsc", - 1301: "ci3-software-1", - 1302: "ci3-software-2", - 1303: "sftsrv", - 1304: "boomerang", - 1305: "pe-mike", - 1306: "re-conn-proto", - 1307: "pacmand", - 1308: "odsi", - 1309: "jtag-server", - 1310: "husky", - 1311: "rxmon", - 1312: "sti-envision", - 1313: "bmc-patroldb", - 1314: "pdps", - 1315: "els", - 1316: "exbit-escp", - 1317: "vrts-ipcserver", - 1318: "krb5gatekeeper", - 1319: "amx-icsp", - 1320: "amx-axbnet", - 1321: "pip", - 1322: "novation", - 1323: "brcd", - 1324: "delta-mcp", - 1325: "dx-instrument", - 1326: "wimsic", - 1327: "ultrex", - 1328: "ewall", - 1329: "netdb-export", - 1330: "streetperfect", - 1331: "intersan", - 1332: "pcia-rxp-b", - 1333: "passwrd-policy", - 1334: "writesrv", - 1335: "digital-notary", - 1336: "ischat", - 1337: "menandmice-dns", - 1338: "wmc-log-svc", - 1339: "kjtsiteserver", - 1340: "naap", - 1341: "qubes", - 1342: "esbroker", - 1343: "re101", - 1344: "icap", - 1345: "vpjp", - 1346: "alta-ana-lm", - 1347: "bbn-mmc", - 1348: "bbn-mmx", - 1349: "sbook", - 1350: "editbench", - 1351: "equationbuilder", - 1352: "lotusnote", - 1353: "relief", - 1354: "XSIP-network", - 1355: "intuitive-edge", - 1356: "cuillamartin", - 1357: "pegboard", - 1358: "connlcli", - 1359: "ftsrv", - 1360: "mimer", - 1361: "linx", - 1362: "timeflies", - 1363: "ndm-requester", - 1364: "ndm-server", - 1365: "adapt-sna", - 1366: "netware-csp", - 1367: "dcs", - 1368: "screencast", - 1369: "gv-us", - 1370: "us-gv", - 1371: "fc-cli", - 1372: "fc-ser", - 1373: "chromagrafx", - 1374: "molly", - 1375: "bytex", - 1376: "ibm-pps", - 1377: "cichlid", - 1378: "elan", - 1379: "dbreporter", - 1380: "telesis-licman", - 1381: "apple-licman", - 1382: "udt-os", - 1383: "gwha", - 1384: "os-licman", - 1385: "atex-elmd", - 1386: "checksum", - 1387: "cadsi-lm", - 1388: "objective-dbc", - 1389: "iclpv-dm", - 1390: "iclpv-sc", - 1391: "iclpv-sas", - 1392: "iclpv-pm", - 1393: "iclpv-nls", - 1394: "iclpv-nlc", - 1395: "iclpv-wsm", - 1396: "dvl-activemail", - 1397: "audio-activmail", - 1398: "video-activmail", - 1399: "cadkey-licman", - 1400: "cadkey-tablet", - 1401: "goldleaf-licman", - 1402: "prm-sm-np", - 1403: "prm-nm-np", - 1404: "igi-lm", - 1405: "ibm-res", - 1406: "netlabs-lm", - 1407: "tibet-server", - 1408: "sophia-lm", - 1409: "here-lm", - 1410: "hiq", - 1411: "af", - 1412: "innosys", - 1413: "innosys-acl", - 1414: "ibm-mqseries", - 1415: "dbstar", - 1416: "novell-lu6-2", - 1417: "timbuktu-srv1", - 1418: "timbuktu-srv2", - 1419: "timbuktu-srv3", - 1420: "timbuktu-srv4", - 1421: "gandalf-lm", - 1422: "autodesk-lm", - 1423: "essbase", - 1424: "hybrid", - 1425: "zion-lm", - 1426: "sais", - 1427: "mloadd", - 1428: "informatik-lm", - 1429: "nms", - 1430: "tpdu", - 1431: "rgtp", - 1432: "blueberry-lm", - 1433: "ms-sql-s", - 1434: "ms-sql-m", - 1435: "ibm-cics", - 1436: "saism", - 1437: "tabula", - 1438: "eicon-server", - 1439: "eicon-x25", - 1440: "eicon-slp", - 1441: "cadis-1", - 1442: "cadis-2", - 1443: "ies-lm", - 1444: "marcam-lm", - 1445: "proxima-lm", - 1446: "ora-lm", - 1447: "apri-lm", - 1448: "oc-lm", - 1449: "peport", - 1450: "dwf", - 1451: "infoman", - 1452: "gtegsc-lm", - 1453: "genie-lm", - 1454: "interhdl-elmd", - 1455: "esl-lm", - 1456: "dca", - 1457: "valisys-lm", - 1458: "nrcabq-lm", - 1459: "proshare1", - 1460: "proshare2", - 1461: "ibm-wrless-lan", - 1462: "world-lm", - 1463: "nucleus", - 1464: "msl-lmd", - 1465: "pipes", - 1466: "oceansoft-lm", - 1467: "csdmbase", - 1468: "csdm", - 1469: "aal-lm", - 1470: "uaiact", - 1471: "csdmbase", - 1472: "csdm", - 1473: "openmath", - 1474: "telefinder", - 1475: "taligent-lm", - 1476: "clvm-cfg", - 1477: "ms-sna-server", - 1478: "ms-sna-base", - 1479: "dberegister", - 1480: "pacerforum", - 1481: "airs", - 1482: "miteksys-lm", - 1483: "afs", - 1484: "confluent", - 1485: "lansource", - 1486: "nms-topo-serv", - 1487: "localinfosrvr", - 1488: "docstor", - 1489: "dmdocbroker", - 1490: "insitu-conf", - 1492: "stone-design-1", - 1493: "netmap-lm", - 1494: "ica", - 1495: "cvc", - 1496: "liberty-lm", - 1497: "rfx-lm", - 1498: "sybase-sqlany", - 1499: "fhc", - 1500: "vlsi-lm", - 1501: "saiscm", - 1502: "shivadiscovery", - 1503: "imtc-mcs", - 1504: "evb-elm", - 1505: "funkproxy", - 1506: "utcd", - 1507: "symplex", - 1508: "diagmond", - 1509: "robcad-lm", - 1510: "mvx-lm", - 1511: "3l-l1", - 1512: "wins", - 1513: "fujitsu-dtc", - 1514: "fujitsu-dtcns", - 1515: "ifor-protocol", - 1516: "vpad", - 1517: "vpac", - 1518: "vpvd", - 1519: "vpvc", - 1520: "atm-zip-office", - 1521: "ncube-lm", - 1522: "ricardo-lm", - 1523: "cichild-lm", - 1524: "ingreslock", - 1525: "orasrv", - 1526: "pdap-np", - 1527: "tlisrv", - 1529: "coauthor", - 1530: "rap-service", - 1531: "rap-listen", - 1532: "miroconnect", - 1533: "virtual-places", - 1534: "micromuse-lm", - 1535: "ampr-info", - 1536: "ampr-inter", - 1537: "sdsc-lm", - 1538: "3ds-lm", - 1539: "intellistor-lm", - 1540: "rds", - 1541: "rds2", - 1542: "gridgen-elmd", - 1543: "simba-cs", - 1544: "aspeclmd", - 1545: "vistium-share", - 1546: "abbaccuray", - 1547: "laplink", - 1548: "axon-lm", - 1549: "shivahose", - 1550: "3m-image-lm", - 1551: "hecmtl-db", - 1552: "pciarray", - 1553: "sna-cs", - 1554: "caci-lm", - 1555: "livelan", - 1556: "veritas-pbx", - 1557: "arbortext-lm", - 1558: "xingmpeg", - 1559: "web2host", - 1560: "asci-val", - 1561: "facilityview", - 1562: "pconnectmgr", - 1563: "cadabra-lm", - 1564: "pay-per-view", - 1565: "winddlb", - 1566: "corelvideo", - 1567: "jlicelmd", - 1568: "tsspmap", - 1569: "ets", - 1570: "orbixd", - 1571: "rdb-dbs-disp", - 1572: "chip-lm", - 1573: "itscomm-ns", - 1574: "mvel-lm", - 1575: "oraclenames", - 1576: "moldflow-lm", - 1577: "hypercube-lm", - 1578: "jacobus-lm", - 1579: "ioc-sea-lm", - 1580: "tn-tl-r1", - 1581: "mil-2045-47001", - 1582: "msims", - 1583: "simbaexpress", - 1584: "tn-tl-fd2", - 1585: "intv", - 1586: "ibm-abtact", - 1587: "pra-elmd", - 1588: "triquest-lm", - 1589: "vqp", - 1590: "gemini-lm", - 1591: "ncpm-pm", - 1592: "commonspace", - 1593: "mainsoft-lm", - 1594: "sixtrak", - 1595: "radio", - 1596: "radio-sm", - 1597: "orbplus-iiop", - 1598: "picknfs", - 1599: "simbaservices", - 1600: "issd", - 1601: "aas", - 1602: "inspect", - 1603: "picodbc", - 1604: "icabrowser", - 1605: "slp", - 1606: "slm-api", - 1607: "stt", - 1608: "smart-lm", - 1609: "isysg-lm", - 1610: "taurus-wh", - 1611: "ill", - 1612: "netbill-trans", - 1613: "netbill-keyrep", - 1614: "netbill-cred", - 1615: "netbill-auth", - 1616: "netbill-prod", - 1617: "nimrod-agent", - 1618: "skytelnet", - 1619: "xs-openstorage", - 1620: "faxportwinport", - 1621: "softdataphone", - 1622: "ontime", - 1623: "jaleosnd", - 1624: "udp-sr-port", - 1625: "svs-omagent", - 1626: "shockwave", - 1627: "t128-gateway", - 1628: "lontalk-norm", - 1629: "lontalk-urgnt", - 1630: "oraclenet8cman", - 1631: "visitview", - 1632: "pammratc", - 1633: "pammrpc", - 1634: "loaprobe", - 1635: "edb-server1", - 1636: "isdc", - 1637: "islc", - 1638: "ismc", - 1639: "cert-initiator", - 1640: "cert-responder", - 1641: "invision", - 1642: "isis-am", - 1643: "isis-ambc", - 1644: "saiseh", - 1645: "sightline", - 1646: "sa-msg-port", - 1647: "rsap", - 1648: "concurrent-lm", - 1649: "kermit", - 1650: "nkd", - 1651: "shiva-confsrvr", - 1652: "xnmp", - 1653: "alphatech-lm", - 1654: "stargatealerts", - 1655: "dec-mbadmin", - 1656: "dec-mbadmin-h", - 1657: "fujitsu-mmpdc", - 1658: "sixnetudr", - 1659: "sg-lm", - 1660: "skip-mc-gikreq", - 1661: "netview-aix-1", - 1662: "netview-aix-2", - 1663: "netview-aix-3", - 1664: "netview-aix-4", - 1665: "netview-aix-5", - 1666: "netview-aix-6", - 1667: "netview-aix-7", - 1668: "netview-aix-8", - 1669: "netview-aix-9", - 1670: "netview-aix-10", - 1671: "netview-aix-11", - 1672: "netview-aix-12", - 1673: "proshare-mc-1", - 1674: "proshare-mc-2", - 1675: "pdp", - 1676: "netcomm1", - 1677: "groupwise", - 1678: "prolink", - 1679: "darcorp-lm", - 1680: "microcom-sbp", - 1681: "sd-elmd", - 1682: "lanyon-lantern", - 1683: "ncpm-hip", - 1684: "snaresecure", - 1685: "n2nremote", - 1686: "cvmon", - 1687: "nsjtp-ctrl", - 1688: "nsjtp-data", - 1689: "firefox", - 1690: "ng-umds", - 1691: "empire-empuma", - 1692: "sstsys-lm", - 1693: "rrirtr", - 1694: "rrimwm", - 1695: "rrilwm", - 1696: "rrifmm", - 1697: "rrisat", - 1698: "rsvp-encap-1", - 1699: "rsvp-encap-2", - 1700: "mps-raft", - 1701: "l2f", - 1702: "deskshare", - 1703: "hb-engine", - 1704: "bcs-broker", - 1705: "slingshot", - 1706: "jetform", - 1707: "vdmplay", - 1708: "gat-lmd", - 1709: "centra", - 1710: "impera", - 1711: "pptconference", - 1712: "registrar", - 1713: "conferencetalk", - 1714: "sesi-lm", - 1715: "houdini-lm", - 1716: "xmsg", - 1717: "fj-hdnet", - 1718: "h323gatedisc", - 1719: "h323gatestat", - 1720: "h323hostcall", - 1721: "caicci", - 1722: "hks-lm", - 1723: "pptp", - 1724: "csbphonemaster", - 1725: "iden-ralp", - 1726: "iberiagames", - 1727: "winddx", - 1728: "telindus", - 1729: "citynl", - 1730: "roketz", - 1731: "msiccp", - 1732: "proxim", - 1733: "siipat", - 1734: "cambertx-lm", - 1735: "privatechat", - 1736: "street-stream", - 1737: "ultimad", - 1738: "gamegen1", - 1739: "webaccess", - 1740: "encore", - 1741: "cisco-net-mgmt", - 1742: "3Com-nsd", - 1743: "cinegrfx-lm", - 1744: "ncpm-ft", - 1745: "remote-winsock", - 1746: "ftrapid-1", - 1747: "ftrapid-2", - 1748: "oracle-em1", - 1749: "aspen-services", - 1750: "sslp", - 1751: "swiftnet", - 1752: "lofr-lm", - 1753: "predatar-comms", - 1754: "oracle-em2", - 1755: "ms-streaming", - 1756: "capfast-lmd", - 1757: "cnhrp", - 1758: "tftp-mcast", - 1759: "spss-lm", - 1760: "www-ldap-gw", - 1761: "cft-0", - 1762: "cft-1", - 1763: "cft-2", - 1764: "cft-3", - 1765: "cft-4", - 1766: "cft-5", - 1767: "cft-6", - 1768: "cft-7", - 1769: "bmc-net-adm", - 1770: "bmc-net-svc", - 1771: "vaultbase", - 1772: "essweb-gw", - 1773: "kmscontrol", - 1774: "global-dtserv", - 1775: "vdab", - 1776: "femis", - 1777: "powerguardian", - 1778: "prodigy-intrnet", - 1779: "pharmasoft", - 1780: "dpkeyserv", - 1781: "answersoft-lm", - 1782: "hp-hcip", - 1784: "finle-lm", - 1785: "windlm", - 1786: "funk-logger", - 1787: "funk-license", - 1788: "psmond", - 1789: "hello", - 1790: "nmsp", - 1791: "ea1", - 1792: "ibm-dt-2", - 1793: "rsc-robot", - 1794: "cera-bcm", - 1795: "dpi-proxy", - 1796: "vocaltec-admin", - 1797: "uma", - 1798: "etp", - 1799: "netrisk", - 1800: "ansys-lm", - 1801: "msmq", - 1802: "concomp1", - 1803: "hp-hcip-gwy", - 1804: "enl", - 1805: "enl-name", - 1806: "musiconline", - 1807: "fhsp", - 1808: "oracle-vp2", - 1809: "oracle-vp1", - 1810: "jerand-lm", - 1811: "scientia-sdb", - 1812: "radius", - 1813: "radius-acct", - 1814: "tdp-suite", - 1815: "mmpft", - 1816: "harp", - 1817: "rkb-oscs", - 1818: "etftp", - 1819: "plato-lm", - 1820: "mcagent", - 1821: "donnyworld", - 1822: "es-elmd", - 1823: "unisys-lm", - 1824: "metrics-pas", - 1825: "direcpc-video", - 1826: "ardt", - 1827: "asi", - 1828: "itm-mcell-u", - 1829: "optika-emedia", - 1830: "net8-cman", - 1831: "myrtle", - 1832: "tht-treasure", - 1833: "udpradio", - 1834: "ardusuni", - 1835: "ardusmul", - 1836: "ste-smsc", - 1837: "csoft1", - 1838: "talnet", - 1839: "netopia-vo1", - 1840: "netopia-vo2", - 1841: "netopia-vo3", - 1842: "netopia-vo4", - 1843: "netopia-vo5", - 1844: "direcpc-dll", - 1845: "altalink", - 1846: "tunstall-pnc", - 1847: "slp-notify", - 1848: "fjdocdist", - 1849: "alpha-sms", - 1850: "gsi", - 1851: "ctcd", - 1852: "virtual-time", - 1853: "vids-avtp", - 1854: "buddy-draw", - 1855: "fiorano-rtrsvc", - 1856: "fiorano-msgsvc", - 1857: "datacaptor", - 1858: "privateark", - 1859: "gammafetchsvr", - 1860: "sunscalar-svc", - 1861: "lecroy-vicp", - 1862: "mysql-cm-agent", - 1863: "msnp", - 1864: "paradym-31port", - 1865: "entp", - 1866: "swrmi", - 1867: "udrive", - 1868: "viziblebrowser", - 1869: "transact", - 1870: "sunscalar-dns", - 1871: "canocentral0", - 1872: "canocentral1", - 1873: "fjmpjps", - 1874: "fjswapsnp", - 1875: "westell-stats", - 1876: "ewcappsrv", - 1877: "hp-webqosdb", - 1878: "drmsmc", - 1879: "nettgain-nms", - 1880: "vsat-control", - 1881: "ibm-mqseries2", - 1882: "ecsqdmn", - 1883: "mqtt", - 1884: "idmaps", - 1885: "vrtstrapserver", - 1886: "leoip", - 1887: "filex-lport", - 1888: "ncconfig", - 1889: "unify-adapter", - 1890: "wilkenlistener", - 1891: "childkey-notif", - 1892: "childkey-ctrl", - 1893: "elad", - 1894: "o2server-port", - 1896: "b-novative-ls", - 1897: "metaagent", - 1898: "cymtec-port", - 1899: "mc2studios", - 1900: "ssdp", - 1901: "fjicl-tep-a", - 1902: "fjicl-tep-b", - 1903: "linkname", - 1904: "fjicl-tep-c", - 1905: "sugp", - 1906: "tpmd", - 1907: "intrastar", - 1908: "dawn", - 1909: "global-wlink", - 1910: "ultrabac", - 1911: "mtp", - 1912: "rhp-iibp", - 1913: "armadp", - 1914: "elm-momentum", - 1915: "facelink", - 1916: "persona", - 1917: "noagent", - 1918: "can-nds", - 1919: "can-dch", - 1920: "can-ferret", - 1921: "noadmin", - 1922: "tapestry", - 1923: "spice", - 1924: "xiip", - 1925: "discovery-port", - 1926: "egs", - 1927: "videte-cipc", - 1928: "emsd-port", - 1929: "bandwiz-system", - 1930: "driveappserver", - 1931: "amdsched", - 1932: "ctt-broker", - 1933: "xmapi", - 1934: "xaapi", - 1935: "macromedia-fcs", - 1936: "jetcmeserver", - 1937: "jwserver", - 1938: "jwclient", - 1939: "jvserver", - 1940: "jvclient", - 1941: "dic-aida", - 1942: "res", - 1943: "beeyond-media", - 1944: "close-combat", - 1945: "dialogic-elmd", - 1946: "tekpls", - 1947: "sentinelsrm", - 1948: "eye2eye", - 1949: "ismaeasdaqlive", - 1950: "ismaeasdaqtest", - 1951: "bcs-lmserver", - 1952: "mpnjsc", - 1953: "rapidbase", - 1954: "abr-api", - 1955: "abr-secure", - 1956: "vrtl-vmf-ds", - 1957: "unix-status", - 1958: "dxadmind", - 1959: "simp-all", - 1960: "nasmanager", - 1961: "bts-appserver", - 1962: "biap-mp", - 1963: "webmachine", - 1964: "solid-e-engine", - 1965: "tivoli-npm", - 1966: "slush", - 1967: "sns-quote", - 1968: "lipsinc", - 1969: "lipsinc1", - 1970: "netop-rc", - 1971: "netop-school", - 1972: "intersys-cache", - 1973: "dlsrap", - 1974: "drp", - 1975: "tcoflashagent", - 1976: "tcoregagent", - 1977: "tcoaddressbook", - 1978: "unisql", - 1979: "unisql-java", - 1980: "pearldoc-xact", - 1981: "p2pq", - 1982: "estamp", - 1983: "lhtp", - 1984: "bb", - 1985: "hsrp", - 1986: "licensedaemon", - 1987: "tr-rsrb-p1", - 1988: "tr-rsrb-p2", - 1989: "tr-rsrb-p3", - 1990: "stun-p1", - 1991: "stun-p2", - 1992: "stun-p3", - 1993: "snmp-tcp-port", - 1994: "stun-port", - 1995: "perf-port", - 1996: "tr-rsrb-port", - 1997: "gdp-port", - 1998: "x25-svc-port", - 1999: "tcp-id-port", - 2000: "cisco-sccp", - 2001: "dc", - 2002: "globe", - 2003: "brutus", - 2004: "mailbox", - 2005: "berknet", - 2006: "invokator", - 2007: "dectalk", - 2008: "conf", - 2009: "news", - 2010: "search", - 2011: "raid-cc", - 2012: "ttyinfo", - 2013: "raid-am", - 2014: "troff", - 2015: "cypress", - 2016: "bootserver", - 2017: "cypress-stat", - 2018: "terminaldb", - 2019: "whosockami", - 2020: "xinupageserver", - 2021: "servexec", - 2022: "down", - 2023: "xinuexpansion3", - 2024: "xinuexpansion4", - 2025: "ellpack", - 2026: "scrabble", - 2027: "shadowserver", - 2028: "submitserver", - 2029: "hsrpv6", - 2030: "device2", - 2031: "mobrien-chat", - 2032: "blackboard", - 2033: "glogger", - 2034: "scoremgr", - 2035: "imsldoc", - 2036: "e-dpnet", - 2037: "applus", - 2038: "objectmanager", - 2039: "prizma", - 2040: "lam", - 2041: "interbase", - 2042: "isis", - 2043: "isis-bcast", - 2044: "rimsl", - 2045: "cdfunc", - 2046: "sdfunc", - 2047: "dls", - 2048: "dls-monitor", - 2049: "shilp", - 2050: "av-emb-config", - 2051: "epnsdp", - 2052: "clearvisn", - 2053: "lot105-ds-upd", - 2054: "weblogin", - 2055: "iop", - 2056: "omnisky", - 2057: "rich-cp", - 2058: "newwavesearch", - 2059: "bmc-messaging", - 2060: "teleniumdaemon", - 2061: "netmount", - 2062: "icg-swp", - 2063: "icg-bridge", - 2064: "icg-iprelay", - 2065: "dlsrpn", - 2066: "aura", - 2067: "dlswpn", - 2068: "avauthsrvprtcl", - 2069: "event-port", - 2070: "ah-esp-encap", - 2071: "acp-port", - 2072: "msync", - 2073: "gxs-data-port", - 2074: "vrtl-vmf-sa", - 2075: "newlixengine", - 2076: "newlixconfig", - 2077: "tsrmagt", - 2078: "tpcsrvr", - 2079: "idware-router", - 2080: "autodesk-nlm", - 2081: "kme-trap-port", - 2082: "infowave", - 2083: "radsec", - 2084: "sunclustergeo", - 2085: "ada-cip", - 2086: "gnunet", - 2087: "eli", - 2088: "ip-blf", - 2089: "sep", - 2090: "lrp", - 2091: "prp", - 2092: "descent3", - 2093: "nbx-cc", - 2094: "nbx-au", - 2095: "nbx-ser", - 2096: "nbx-dir", - 2097: "jetformpreview", - 2098: "dialog-port", - 2099: "h2250-annex-g", - 2100: "amiganetfs", - 2101: "rtcm-sc104", - 2102: "zephyr-srv", - 2103: "zephyr-clt", - 2104: "zephyr-hm", - 2105: "minipay", - 2106: "mzap", - 2107: "bintec-admin", - 2108: "comcam", - 2109: "ergolight", - 2110: "umsp", - 2111: "dsatp", - 2112: "idonix-metanet", - 2113: "hsl-storm", - 2114: "newheights", - 2115: "kdm", - 2116: "ccowcmr", - 2117: "mentaclient", - 2118: "mentaserver", - 2119: "gsigatekeeper", - 2120: "qencp", - 2121: "scientia-ssdb", - 2122: "caupc-remote", - 2123: "gtp-control", - 2124: "elatelink", - 2125: "lockstep", - 2126: "pktcable-cops", - 2127: "index-pc-wb", - 2128: "net-steward", - 2129: "cs-live", - 2130: "xds", - 2131: "avantageb2b", - 2132: "solera-epmap", - 2133: "zymed-zpp", - 2134: "avenue", - 2135: "gris", - 2136: "appworxsrv", - 2137: "connect", - 2138: "unbind-cluster", - 2139: "ias-auth", - 2140: "ias-reg", - 2141: "ias-admind", - 2142: "tdmoip", - 2143: "lv-jc", - 2144: "lv-ffx", - 2145: "lv-pici", - 2146: "lv-not", - 2147: "lv-auth", - 2148: "veritas-ucl", - 2149: "acptsys", - 2150: "dynamic3d", - 2151: "docent", - 2152: "gtp-user", - 2153: "ctlptc", - 2154: "stdptc", - 2155: "brdptc", - 2156: "trp", - 2157: "xnds", - 2158: "touchnetplus", - 2159: "gdbremote", - 2160: "apc-2160", - 2161: "apc-2161", - 2162: "navisphere", - 2163: "navisphere-sec", - 2164: "ddns-v3", - 2165: "x-bone-api", - 2166: "iwserver", - 2167: "raw-serial", - 2168: "easy-soft-mux", - 2169: "brain", - 2170: "eyetv", - 2171: "msfw-storage", - 2172: "msfw-s-storage", - 2173: "msfw-replica", - 2174: "msfw-array", - 2175: "airsync", - 2176: "rapi", - 2177: "qwave", - 2178: "bitspeer", - 2179: "vmrdp", - 2180: "mc-gt-srv", - 2181: "eforward", - 2182: "cgn-stat", - 2183: "cgn-config", - 2184: "nvd", - 2185: "onbase-dds", - 2186: "gtaua", - 2187: "ssmc", - 2188: "radware-rpm", - 2189: "radware-rpm-s", - 2190: "tivoconnect", - 2191: "tvbus", - 2192: "asdis", - 2193: "drwcs", - 2197: "mnp-exchange", - 2198: "onehome-remote", - 2199: "onehome-help", - 2200: "ici", - 2201: "ats", - 2202: "imtc-map", - 2203: "b2-runtime", - 2204: "b2-license", - 2205: "jps", - 2206: "hpocbus", - 2207: "hpssd", - 2208: "hpiod", - 2209: "rimf-ps", - 2210: "noaaport", - 2211: "emwin", - 2212: "leecoposserver", - 2213: "kali", - 2214: "rpi", - 2215: "ipcore", - 2216: "vtu-comms", - 2217: "gotodevice", - 2218: "bounzza", - 2219: "netiq-ncap", - 2220: "netiq", - 2221: "ethernet-ip-s", - 2222: "EtherNet-IP-1", - 2223: "rockwell-csp2", - 2224: "efi-mg", - 2225: "rcip-itu", - 2226: "di-drm", - 2227: "di-msg", - 2228: "ehome-ms", - 2229: "datalens", - 2230: "queueadm", - 2231: "wimaxasncp", - 2232: "ivs-video", - 2233: "infocrypt", - 2234: "directplay", - 2235: "sercomm-wlink", - 2236: "nani", - 2237: "optech-port1-lm", - 2238: "aviva-sna", - 2239: "imagequery", - 2240: "recipe", - 2241: "ivsd", - 2242: "foliocorp", - 2243: "magicom", - 2244: "nmsserver", - 2245: "hao", - 2246: "pc-mta-addrmap", - 2247: "antidotemgrsvr", - 2248: "ums", - 2249: "rfmp", - 2250: "remote-collab", - 2251: "dif-port", - 2252: "njenet-ssl", - 2253: "dtv-chan-req", - 2254: "seispoc", - 2255: "vrtp", - 2256: "pcc-mfp", - 2257: "simple-tx-rx", - 2258: "rcts", - 2260: "apc-2260", - 2261: "comotionmaster", - 2262: "comotionback", - 2263: "ecwcfg", - 2264: "apx500api-1", - 2265: "apx500api-2", - 2266: "mfserver", - 2267: "ontobroker", - 2268: "amt", - 2269: "mikey", - 2270: "starschool", - 2271: "mmcals", - 2272: "mmcal", - 2273: "mysql-im", - 2274: "pcttunnell", - 2275: "ibridge-data", - 2276: "ibridge-mgmt", - 2277: "bluectrlproxy", - 2278: "s3db", - 2279: "xmquery", - 2280: "lnvpoller", - 2281: "lnvconsole", - 2282: "lnvalarm", - 2283: "lnvstatus", - 2284: "lnvmaps", - 2285: "lnvmailmon", - 2286: "nas-metering", - 2287: "dna", - 2288: "netml", - 2289: "dict-lookup", - 2290: "sonus-logging", - 2291: "eapsp", - 2292: "mib-streaming", - 2293: "npdbgmngr", - 2294: "konshus-lm", - 2295: "advant-lm", - 2296: "theta-lm", - 2297: "d2k-datamover1", - 2298: "d2k-datamover2", - 2299: "pc-telecommute", - 2300: "cvmmon", - 2301: "cpq-wbem", - 2302: "binderysupport", - 2303: "proxy-gateway", - 2304: "attachmate-uts", - 2305: "mt-scaleserver", - 2306: "tappi-boxnet", - 2307: "pehelp", - 2308: "sdhelp", - 2309: "sdserver", - 2310: "sdclient", - 2311: "messageservice", - 2312: "wanscaler", - 2313: "iapp", - 2314: "cr-websystems", - 2315: "precise-sft", - 2316: "sent-lm", - 2317: "attachmate-g32", - 2318: "cadencecontrol", - 2319: "infolibria", - 2320: "siebel-ns", - 2321: "rdlap", - 2322: "ofsd", - 2323: "3d-nfsd", - 2324: "cosmocall", - 2325: "ansysli", - 2326: "idcp", - 2327: "xingcsm", - 2328: "netrix-sftm", - 2329: "nvd", - 2330: "tscchat", - 2331: "agentview", - 2332: "rcc-host", - 2333: "snapp", - 2334: "ace-client", - 2335: "ace-proxy", - 2336: "appleugcontrol", - 2337: "ideesrv", - 2338: "norton-lambert", - 2339: "3com-webview", - 2340: "wrs-registry", - 2341: "xiostatus", - 2342: "manage-exec", - 2343: "nati-logos", - 2344: "fcmsys", - 2345: "dbm", - 2346: "redstorm-join", - 2347: "redstorm-find", - 2348: "redstorm-info", - 2349: "redstorm-diag", - 2350: "psbserver", - 2351: "psrserver", - 2352: "pslserver", - 2353: "pspserver", - 2354: "psprserver", - 2355: "psdbserver", - 2356: "gxtelmd", - 2357: "unihub-server", - 2358: "futrix", - 2359: "flukeserver", - 2360: "nexstorindltd", - 2361: "tl1", - 2362: "digiman", - 2363: "mediacntrlnfsd", - 2364: "oi-2000", - 2365: "dbref", - 2366: "qip-login", - 2367: "service-ctrl", - 2368: "opentable", - 2370: "l3-hbmon", - 2371: "hp-rda", - 2372: "lanmessenger", - 2373: "remographlm", - 2374: "hydra", - 2375: "docker", - 2376: "docker-s", - 2377: "swarm", - 2379: "etcd-client", - 2380: "etcd-server", - 2381: "compaq-https", - 2382: "ms-olap3", - 2383: "ms-olap4", - 2384: "sd-request", - 2385: "sd-data", - 2386: "virtualtape", - 2387: "vsamredirector", - 2388: "mynahautostart", - 2389: "ovsessionmgr", - 2390: "rsmtp", - 2391: "3com-net-mgmt", - 2392: "tacticalauth", - 2393: "ms-olap1", - 2394: "ms-olap2", - 2395: "lan900-remote", - 2396: "wusage", - 2397: "ncl", - 2398: "orbiter", - 2399: "fmpro-fdal", - 2400: "opequus-server", - 2401: "cvspserver", - 2402: "taskmaster2000", - 2403: "taskmaster2000", - 2404: "iec-104", - 2405: "trc-netpoll", - 2406: "jediserver", - 2407: "orion", - 2408: "railgun-webaccl", - 2409: "sns-protocol", - 2410: "vrts-registry", - 2411: "netwave-ap-mgmt", - 2412: "cdn", - 2413: "orion-rmi-reg", - 2414: "beeyond", - 2415: "codima-rtp", - 2416: "rmtserver", - 2417: "composit-server", - 2418: "cas", - 2419: "attachmate-s2s", - 2420: "dslremote-mgmt", - 2421: "g-talk", - 2422: "crmsbits", - 2423: "rnrp", - 2424: "kofax-svr", - 2425: "fjitsuappmgr", - 2426: "vcmp", - 2427: "mgcp-gateway", - 2428: "ott", - 2429: "ft-role", - 2430: "venus", - 2431: "venus-se", - 2432: "codasrv", - 2433: "codasrv-se", - 2434: "pxc-epmap", - 2435: "optilogic", - 2436: "topx", - 2437: "unicontrol", - 2438: "msp", - 2439: "sybasedbsynch", - 2440: "spearway", - 2441: "pvsw-inet", - 2442: "netangel", - 2443: "powerclientcsf", - 2444: "btpp2sectrans", - 2445: "dtn1", - 2446: "bues-service", - 2447: "ovwdb", - 2448: "hpppssvr", - 2449: "ratl", - 2450: "netadmin", - 2451: "netchat", - 2452: "snifferclient", - 2453: "madge-ltd", - 2454: "indx-dds", - 2455: "wago-io-system", - 2456: "altav-remmgt", - 2457: "rapido-ip", - 2458: "griffin", - 2459: "community", - 2460: "ms-theater", - 2461: "qadmifoper", - 2462: "qadmifevent", - 2463: "lsi-raid-mgmt", - 2464: "direcpc-si", - 2465: "lbm", - 2466: "lbf", - 2467: "high-criteria", - 2468: "qip-msgd", - 2469: "mti-tcs-comm", - 2470: "taskman-port", - 2471: "seaodbc", - 2472: "c3", - 2473: "aker-cdp", - 2474: "vitalanalysis", - 2475: "ace-server", - 2476: "ace-svr-prop", - 2477: "ssm-cvs", - 2478: "ssm-cssps", - 2479: "ssm-els", - 2480: "powerexchange", - 2481: "giop", - 2482: "giop-ssl", - 2483: "ttc", - 2484: "ttc-ssl", - 2485: "netobjects1", - 2486: "netobjects2", - 2487: "pns", - 2488: "moy-corp", - 2489: "tsilb", - 2490: "qip-qdhcp", - 2491: "conclave-cpp", - 2492: "groove", - 2493: "talarian-mqs", - 2494: "bmc-ar", - 2495: "fast-rem-serv", - 2496: "dirgis", - 2497: "quaddb", - 2498: "odn-castraq", - 2499: "unicontrol", - 2500: "rtsserv", - 2501: "rtsclient", - 2502: "kentrox-prot", - 2503: "nms-dpnss", - 2504: "wlbs", - 2505: "ppcontrol", - 2506: "jbroker", - 2507: "spock", - 2508: "jdatastore", - 2509: "fjmpss", - 2510: "fjappmgrbulk", - 2511: "metastorm", - 2512: "citrixima", - 2513: "citrixadmin", - 2514: "facsys-ntp", - 2515: "facsys-router", - 2516: "maincontrol", - 2517: "call-sig-trans", - 2518: "willy", - 2519: "globmsgsvc", - 2520: "pvsw", - 2521: "adaptecmgr", - 2522: "windb", - 2523: "qke-llc-v3", - 2524: "optiwave-lm", - 2525: "ms-v-worlds", - 2526: "ema-sent-lm", - 2527: "iqserver", - 2528: "ncr-ccl", - 2529: "utsftp", - 2530: "vrcommerce", - 2531: "ito-e-gui", - 2532: "ovtopmd", - 2533: "snifferserver", - 2534: "combox-web-acc", - 2535: "madcap", - 2536: "btpp2audctr1", - 2537: "upgrade", - 2538: "vnwk-prapi", - 2539: "vsiadmin", - 2540: "lonworks", - 2541: "lonworks2", - 2542: "udrawgraph", - 2543: "reftek", - 2544: "novell-zen", - 2545: "sis-emt", - 2546: "vytalvaultbrtp", - 2547: "vytalvaultvsmp", - 2548: "vytalvaultpipe", - 2549: "ipass", - 2550: "ads", - 2551: "isg-uda-server", - 2552: "call-logging", - 2553: "efidiningport", - 2554: "vcnet-link-v10", - 2555: "compaq-wcp", - 2556: "nicetec-nmsvc", - 2557: "nicetec-mgmt", - 2558: "pclemultimedia", - 2559: "lstp", - 2560: "labrat", - 2561: "mosaixcc", - 2562: "delibo", - 2563: "cti-redwood", - 2564: "hp-3000-telnet", - 2565: "coord-svr", - 2566: "pcs-pcw", - 2567: "clp", - 2568: "spamtrap", - 2569: "sonuscallsig", - 2570: "hs-port", - 2571: "cecsvc", - 2572: "ibp", - 2573: "trustestablish", - 2574: "blockade-bpsp", - 2575: "hl7", - 2576: "tclprodebugger", - 2577: "scipticslsrvr", - 2578: "rvs-isdn-dcp", - 2579: "mpfoncl", - 2580: "tributary", - 2581: "argis-te", - 2582: "argis-ds", - 2583: "mon", - 2584: "cyaserv", - 2585: "netx-server", - 2586: "netx-agent", - 2587: "masc", - 2588: "privilege", - 2589: "quartus-tcl", - 2590: "idotdist", - 2591: "maytagshuffle", - 2592: "netrek", - 2593: "mns-mail", - 2594: "dts", - 2595: "worldfusion1", - 2596: "worldfusion2", - 2597: "homesteadglory", - 2598: "citriximaclient", - 2599: "snapd", - 2600: "hpstgmgr", - 2601: "discp-client", - 2602: "discp-server", - 2603: "servicemeter", - 2604: "nsc-ccs", - 2605: "nsc-posa", - 2606: "netmon", - 2607: "connection", - 2608: "wag-service", - 2609: "system-monitor", - 2610: "versa-tek", - 2611: "lionhead", - 2612: "qpasa-agent", - 2613: "smntubootstrap", - 2614: "neveroffline", - 2615: "firepower", - 2616: "appswitch-emp", - 2617: "cmadmin", - 2618: "priority-e-com", - 2619: "bruce", - 2620: "lpsrecommender", - 2621: "miles-apart", - 2622: "metricadbc", - 2623: "lmdp", - 2624: "aria", - 2625: "blwnkl-port", - 2626: "gbjd816", - 2627: "moshebeeri", - 2628: "dict", - 2629: "sitaraserver", - 2630: "sitaramgmt", - 2631: "sitaradir", - 2632: "irdg-post", - 2633: "interintelli", - 2634: "pk-electronics", - 2635: "backburner", - 2636: "solve", - 2637: "imdocsvc", - 2638: "sybaseanywhere", - 2639: "aminet", - 2640: "ami-control", - 2641: "hdl-srv", - 2642: "tragic", - 2643: "gte-samp", - 2644: "travsoft-ipx-t", - 2645: "novell-ipx-cmd", - 2646: "and-lm", - 2647: "syncserver", - 2648: "upsnotifyprot", - 2649: "vpsipport", - 2650: "eristwoguns", - 2651: "ebinsite", - 2652: "interpathpanel", - 2653: "sonus", - 2654: "corel-vncadmin", - 2655: "unglue", - 2656: "kana", - 2657: "sns-dispatcher", - 2658: "sns-admin", - 2659: "sns-query", - 2660: "gcmonitor", - 2661: "olhost", - 2662: "bintec-capi", - 2663: "bintec-tapi", - 2664: "patrol-mq-gm", - 2665: "patrol-mq-nm", - 2666: "extensis", - 2667: "alarm-clock-s", - 2668: "alarm-clock-c", - 2669: "toad", - 2670: "tve-announce", - 2671: "newlixreg", - 2672: "nhserver", - 2673: "firstcall42", - 2674: "ewnn", - 2675: "ttc-etap", - 2676: "simslink", - 2677: "gadgetgate1way", - 2678: "gadgetgate2way", - 2679: "syncserverssl", - 2680: "pxc-sapxom", - 2681: "mpnjsomb", - 2683: "ncdloadbalance", - 2684: "mpnjsosv", - 2685: "mpnjsocl", - 2686: "mpnjsomg", - 2687: "pq-lic-mgmt", - 2688: "md-cg-http", - 2689: "fastlynx", - 2690: "hp-nnm-data", - 2691: "itinternet", - 2692: "admins-lms", - 2694: "pwrsevent", - 2695: "vspread", - 2696: "unifyadmin", - 2697: "oce-snmp-trap", - 2698: "mck-ivpip", - 2699: "csoft-plusclnt", - 2700: "tqdata", - 2701: "sms-rcinfo", - 2702: "sms-xfer", - 2703: "sms-chat", - 2704: "sms-remctrl", - 2705: "sds-admin", - 2706: "ncdmirroring", - 2707: "emcsymapiport", - 2708: "banyan-net", - 2709: "supermon", - 2710: "sso-service", - 2711: "sso-control", - 2712: "aocp", - 2713: "raventbs", - 2714: "raventdm", - 2715: "hpstgmgr2", - 2716: "inova-ip-disco", - 2717: "pn-requester", - 2718: "pn-requester2", - 2719: "scan-change", - 2720: "wkars", - 2721: "smart-diagnose", - 2722: "proactivesrvr", - 2723: "watchdog-nt", - 2724: "qotps", - 2725: "msolap-ptp2", - 2726: "tams", - 2727: "mgcp-callagent", - 2728: "sqdr", - 2729: "tcim-control", - 2730: "nec-raidplus", - 2731: "fyre-messanger", - 2732: "g5m", - 2733: "signet-ctf", - 2734: "ccs-software", - 2735: "netiq-mc", - 2736: "radwiz-nms-srv", - 2737: "srp-feedback", - 2738: "ndl-tcp-ois-gw", - 2739: "tn-timing", - 2740: "alarm", - 2741: "tsb", - 2742: "tsb2", - 2743: "murx", - 2744: "honyaku", - 2745: "urbisnet", - 2746: "cpudpencap", - 2747: "fjippol-swrly", - 2748: "fjippol-polsvr", - 2749: "fjippol-cnsl", - 2750: "fjippol-port1", - 2751: "fjippol-port2", - 2752: "rsisysaccess", - 2753: "de-spot", - 2754: "apollo-cc", - 2755: "expresspay", - 2756: "simplement-tie", - 2757: "cnrp", - 2758: "apollo-status", - 2759: "apollo-gms", - 2760: "sabams", - 2761: "dicom-iscl", - 2762: "dicom-tls", - 2763: "desktop-dna", - 2764: "data-insurance", - 2765: "qip-audup", - 2766: "compaq-scp", - 2767: "uadtc", - 2768: "uacs", - 2769: "exce", - 2770: "veronica", - 2771: "vergencecm", - 2772: "auris", - 2773: "rbakcup1", - 2774: "rbakcup2", - 2775: "smpp", - 2776: "ridgeway1", - 2777: "ridgeway2", - 2778: "gwen-sonya", - 2779: "lbc-sync", - 2780: "lbc-control", - 2781: "whosells", - 2782: "everydayrc", - 2783: "aises", - 2784: "www-dev", - 2785: "aic-np", - 2786: "aic-oncrpc", - 2787: "piccolo", - 2788: "fryeserv", - 2789: "media-agent", - 2790: "plgproxy", - 2791: "mtport-regist", - 2792: "f5-globalsite", - 2793: "initlsmsad", - 2795: "livestats", - 2796: "ac-tech", - 2797: "esp-encap", - 2798: "tmesis-upshot", - 2799: "icon-discover", - 2800: "acc-raid", - 2801: "igcp", - 2802: "veritas-tcp1", - 2803: "btprjctrl", - 2804: "dvr-esm", - 2805: "wta-wsp-s", - 2806: "cspuni", - 2807: "cspmulti", - 2808: "j-lan-p", - 2809: "corbaloc", - 2810: "netsteward", - 2811: "gsiftp", - 2812: "atmtcp", - 2813: "llm-pass", - 2814: "llm-csv", - 2815: "lbc-measure", - 2816: "lbc-watchdog", - 2817: "nmsigport", - 2818: "rmlnk", - 2819: "fc-faultnotify", - 2820: "univision", - 2821: "vrts-at-port", - 2822: "ka0wuc", - 2823: "cqg-netlan", - 2824: "cqg-netlan-1", - 2826: "slc-systemlog", - 2827: "slc-ctrlrloops", - 2828: "itm-lm", - 2829: "silkp1", - 2830: "silkp2", - 2831: "silkp3", - 2832: "silkp4", - 2833: "glishd", - 2834: "evtp", - 2835: "evtp-data", - 2836: "catalyst", - 2837: "repliweb", - 2838: "starbot", - 2839: "nmsigport", - 2840: "l3-exprt", - 2841: "l3-ranger", - 2842: "l3-hawk", - 2843: "pdnet", - 2844: "bpcp-poll", - 2845: "bpcp-trap", - 2846: "aimpp-hello", - 2847: "aimpp-port-req", - 2848: "amt-blc-port", - 2849: "fxp", - 2850: "metaconsole", - 2851: "webemshttp", - 2852: "bears-01", - 2853: "ispipes", - 2854: "infomover", - 2855: "msrp", - 2856: "cesdinv", - 2857: "simctlp", - 2858: "ecnp", - 2859: "activememory", - 2860: "dialpad-voice1", - 2861: "dialpad-voice2", - 2862: "ttg-protocol", - 2863: "sonardata", - 2864: "astromed-main", - 2865: "pit-vpn", - 2866: "iwlistener", - 2867: "esps-portal", - 2868: "npep-messaging", - 2869: "icslap", - 2870: "daishi", - 2871: "msi-selectplay", - 2872: "radix", - 2874: "dxmessagebase1", - 2875: "dxmessagebase2", - 2876: "sps-tunnel", - 2877: "bluelance", - 2878: "aap", - 2879: "ucentric-ds", - 2880: "synapse", - 2881: "ndsp", - 2882: "ndtp", - 2883: "ndnp", - 2884: "flashmsg", - 2885: "topflow", - 2886: "responselogic", - 2887: "aironetddp", - 2888: "spcsdlobby", - 2889: "rsom", - 2890: "cspclmulti", - 2891: "cinegrfx-elmd", - 2892: "snifferdata", - 2893: "vseconnector", - 2894: "abacus-remote", - 2895: "natuslink", - 2896: "ecovisiong6-1", - 2897: "citrix-rtmp", - 2898: "appliance-cfg", - 2899: "powergemplus", - 2900: "quicksuite", - 2901: "allstorcns", - 2902: "netaspi", - 2903: "suitcase", - 2904: "m2ua", - 2905: "m3ua", - 2906: "caller9", - 2907: "webmethods-b2b", - 2908: "mao", - 2909: "funk-dialout", - 2910: "tdaccess", - 2911: "blockade", - 2912: "epicon", - 2913: "boosterware", - 2914: "gamelobby", - 2915: "tksocket", - 2916: "elvin-server", - 2917: "elvin-client", - 2918: "kastenchasepad", - 2919: "roboer", - 2920: "roboeda", - 2921: "cesdcdman", - 2922: "cesdcdtrn", - 2923: "wta-wsp-wtp-s", - 2924: "precise-vip", - 2926: "mobile-file-dl", - 2927: "unimobilectrl", - 2928: "redstone-cpss", - 2929: "amx-webadmin", - 2930: "amx-weblinx", - 2931: "circle-x", - 2932: "incp", - 2933: "4-tieropmgw", - 2934: "4-tieropmcli", - 2935: "qtp", - 2936: "otpatch", - 2937: "pnaconsult-lm", - 2938: "sm-pas-1", - 2939: "sm-pas-2", - 2940: "sm-pas-3", - 2941: "sm-pas-4", - 2942: "sm-pas-5", - 2943: "ttnrepository", - 2944: "megaco-h248", - 2945: "h248-binary", - 2946: "fjsvmpor", - 2947: "gpsd", - 2948: "wap-push", - 2949: "wap-pushsecure", - 2950: "esip", - 2951: "ottp", - 2952: "mpfwsas", - 2953: "ovalarmsrv", - 2954: "ovalarmsrv-cmd", - 2955: "csnotify", - 2956: "ovrimosdbman", - 2957: "jmact5", - 2958: "jmact6", - 2959: "rmopagt", - 2960: "dfoxserver", - 2961: "boldsoft-lm", - 2962: "iph-policy-cli", - 2963: "iph-policy-adm", - 2964: "bullant-srap", - 2965: "bullant-rap", - 2966: "idp-infotrieve", - 2967: "ssc-agent", - 2968: "enpp", - 2969: "essp", - 2970: "index-net", - 2971: "netclip", - 2972: "pmsm-webrctl", - 2973: "svnetworks", - 2974: "signal", - 2975: "fjmpcm", - 2976: "cns-srv-port", - 2977: "ttc-etap-ns", - 2978: "ttc-etap-ds", - 2979: "h263-video", - 2980: "wimd", - 2981: "mylxamport", - 2982: "iwb-whiteboard", - 2983: "netplan", - 2984: "hpidsadmin", - 2985: "hpidsagent", - 2986: "stonefalls", - 2987: "identify", - 2988: "hippad", - 2989: "zarkov", - 2990: "boscap", - 2991: "wkstn-mon", - 2992: "avenyo", - 2993: "veritas-vis1", - 2994: "veritas-vis2", - 2995: "idrs", - 2996: "vsixml", - 2997: "rebol", - 2998: "realsecure", - 2999: "remoteware-un", - 3000: "hbci", - 3001: "origo-native", - 3002: "exlm-agent", - 3003: "cgms", - 3004: "csoftragent", - 3005: "geniuslm", - 3006: "ii-admin", - 3007: "lotusmtap", - 3008: "midnight-tech", - 3009: "pxc-ntfy", - 3010: "gw", - 3011: "trusted-web", - 3012: "twsdss", - 3013: "gilatskysurfer", - 3014: "broker-service", - 3015: "nati-dstp", - 3016: "notify-srvr", - 3017: "event-listener", - 3018: "srvc-registry", - 3019: "resource-mgr", - 3020: "cifs", - 3021: "agriserver", - 3022: "csregagent", - 3023: "magicnotes", - 3024: "nds-sso", - 3025: "arepa-raft", - 3026: "agri-gateway", - 3027: "LiebDevMgmt-C", - 3028: "LiebDevMgmt-DM", - 3029: "LiebDevMgmt-A", - 3030: "arepa-cas", - 3031: "eppc", - 3032: "redwood-chat", - 3033: "pdb", - 3034: "osmosis-aeea", - 3035: "fjsv-gssagt", - 3036: "hagel-dump", - 3037: "hp-san-mgmt", - 3038: "santak-ups", - 3039: "cogitate", - 3040: "tomato-springs", - 3041: "di-traceware", - 3042: "journee", - 3043: "brp", - 3044: "epp", - 3045: "responsenet", - 3046: "di-ase", - 3047: "hlserver", - 3048: "pctrader", - 3049: "nsws", - 3050: "gds-db", - 3051: "galaxy-server", - 3052: "apc-3052", - 3053: "dsom-server", - 3054: "amt-cnf-prot", - 3055: "policyserver", - 3056: "cdl-server", - 3057: "goahead-fldup", - 3058: "videobeans", - 3059: "qsoft", - 3060: "interserver", - 3061: "cautcpd", - 3062: "ncacn-ip-tcp", - 3063: "ncadg-ip-udp", - 3064: "rprt", - 3065: "slinterbase", - 3066: "netattachsdmp", - 3067: "fjhpjp", - 3068: "ls3bcast", - 3069: "ls3", - 3070: "mgxswitch", - 3071: "xplat-replicate", - 3072: "csd-monitor", - 3073: "vcrp", - 3074: "xbox", - 3075: "orbix-locator", - 3076: "orbix-config", - 3077: "orbix-loc-ssl", - 3078: "orbix-cfg-ssl", - 3079: "lv-frontpanel", - 3080: "stm-pproc", - 3081: "tl1-lv", - 3082: "tl1-raw", - 3083: "tl1-telnet", - 3084: "itm-mccs", - 3085: "pcihreq", - 3086: "jdl-dbkitchen", - 3087: "asoki-sma", - 3088: "xdtp", - 3089: "ptk-alink", - 3090: "stss", - 3091: "1ci-smcs", - 3093: "rapidmq-center", - 3094: "rapidmq-reg", - 3095: "panasas", - 3096: "ndl-aps", - 3098: "umm-port", - 3099: "chmd", - 3100: "opcon-xps", - 3101: "hp-pxpib", - 3102: "slslavemon", - 3103: "autocuesmi", - 3104: "autocuelog", - 3105: "cardbox", - 3106: "cardbox-http", - 3107: "business", - 3108: "geolocate", - 3109: "personnel", - 3110: "sim-control", - 3111: "wsynch", - 3112: "ksysguard", - 3113: "cs-auth-svr", - 3114: "ccmad", - 3115: "mctet-master", - 3116: "mctet-gateway", - 3117: "mctet-jserv", - 3118: "pkagent", - 3119: "d2000kernel", - 3120: "d2000webserver", - 3121: "pcmk-remote", - 3122: "vtr-emulator", - 3123: "edix", - 3124: "beacon-port", - 3125: "a13-an", - 3127: "ctx-bridge", - 3128: "ndl-aas", - 3129: "netport-id", - 3130: "icpv2", - 3131: "netbookmark", - 3132: "ms-rule-engine", - 3133: "prism-deploy", - 3134: "ecp", - 3135: "peerbook-port", - 3136: "grubd", - 3137: "rtnt-1", - 3138: "rtnt-2", - 3139: "incognitorv", - 3140: "ariliamulti", - 3141: "vmodem", - 3142: "rdc-wh-eos", - 3143: "seaview", - 3144: "tarantella", - 3145: "csi-lfap", - 3146: "bears-02", - 3147: "rfio", - 3148: "nm-game-admin", - 3149: "nm-game-server", - 3150: "nm-asses-admin", - 3151: "nm-assessor", - 3152: "feitianrockey", - 3153: "s8-client-port", - 3154: "ccmrmi", - 3155: "jpegmpeg", - 3156: "indura", - 3157: "e3consultants", - 3158: "stvp", - 3159: "navegaweb-port", - 3160: "tip-app-server", - 3161: "doc1lm", - 3162: "sflm", - 3163: "res-sap", - 3164: "imprs", - 3165: "newgenpay", - 3166: "sossecollector", - 3167: "nowcontact", - 3168: "poweronnud", - 3169: "serverview-as", - 3170: "serverview-asn", - 3171: "serverview-gf", - 3172: "serverview-rm", - 3173: "serverview-icc", - 3174: "armi-server", - 3175: "t1-e1-over-ip", - 3176: "ars-master", - 3177: "phonex-port", - 3178: "radclientport", - 3179: "h2gf-w-2m", - 3180: "mc-brk-srv", - 3181: "bmcpatrolagent", - 3182: "bmcpatrolrnvu", - 3183: "cops-tls", - 3184: "apogeex-port", - 3185: "smpppd", - 3186: "iiw-port", - 3187: "odi-port", - 3188: "brcm-comm-port", - 3189: "pcle-infex", - 3190: "csvr-proxy", - 3191: "csvr-sslproxy", - 3192: "firemonrcc", - 3193: "spandataport", - 3194: "magbind", - 3195: "ncu-1", - 3196: "ncu-2", - 3197: "embrace-dp-s", - 3198: "embrace-dp-c", - 3199: "dmod-workspace", - 3200: "tick-port", - 3201: "cpq-tasksmart", - 3202: "intraintra", - 3203: "netwatcher-mon", - 3204: "netwatcher-db", - 3205: "isns", - 3206: "ironmail", - 3207: "vx-auth-port", - 3208: "pfu-prcallback", - 3209: "netwkpathengine", - 3210: "flamenco-proxy", - 3211: "avsecuremgmt", - 3212: "surveyinst", - 3213: "neon24x7", - 3214: "jmq-daemon-1", - 3215: "jmq-daemon-2", - 3216: "ferrari-foam", - 3217: "unite", - 3218: "smartpackets", - 3219: "wms-messenger", - 3220: "xnm-ssl", - 3221: "xnm-clear-text", - 3222: "glbp", - 3223: "digivote", - 3224: "aes-discovery", - 3225: "fcip-port", - 3226: "isi-irp", - 3227: "dwnmshttp", - 3228: "dwmsgserver", - 3229: "global-cd-port", - 3230: "sftdst-port", - 3231: "vidigo", - 3232: "mdtp", - 3233: "whisker", - 3234: "alchemy", - 3235: "mdap-port", - 3236: "apparenet-ts", - 3237: "apparenet-tps", - 3238: "apparenet-as", - 3239: "apparenet-ui", - 3240: "triomotion", - 3241: "sysorb", - 3242: "sdp-id-port", - 3243: "timelot", - 3244: "onesaf", - 3245: "vieo-fe", - 3246: "dvt-system", - 3247: "dvt-data", - 3248: "procos-lm", - 3249: "ssp", - 3250: "hicp", - 3251: "sysscanner", - 3252: "dhe", - 3253: "pda-data", - 3254: "pda-sys", - 3255: "semaphore", - 3256: "cpqrpm-agent", - 3257: "cpqrpm-server", - 3258: "ivecon-port", - 3259: "epncdp2", - 3260: "iscsi-target", - 3261: "winshadow", - 3262: "necp", - 3263: "ecolor-imager", - 3264: "ccmail", - 3265: "altav-tunnel", - 3266: "ns-cfg-server", - 3267: "ibm-dial-out", - 3268: "msft-gc", - 3269: "msft-gc-ssl", - 3270: "verismart", - 3271: "csoft-prev", - 3272: "user-manager", - 3273: "sxmp", - 3274: "ordinox-server", - 3275: "samd", - 3276: "maxim-asics", - 3277: "awg-proxy", - 3278: "lkcmserver", - 3279: "admind", - 3280: "vs-server", - 3281: "sysopt", - 3282: "datusorb", - 3283: "Apple Remote Desktop (Net Assistant)", - 3284: "4talk", - 3285: "plato", - 3286: "e-net", - 3287: "directvdata", - 3288: "cops", - 3289: "enpc", - 3290: "caps-lm", - 3291: "sah-lm", - 3292: "cart-o-rama", - 3293: "fg-fps", - 3294: "fg-gip", - 3295: "dyniplookup", - 3296: "rib-slm", - 3297: "cytel-lm", - 3298: "deskview", - 3299: "pdrncs", - 3300: "ceph", - 3302: "mcs-fastmail", - 3303: "opsession-clnt", - 3304: "opsession-srvr", - 3305: "odette-ftp", - 3306: "mysql", - 3307: "opsession-prxy", - 3308: "tns-server", - 3309: "tns-adv", - 3310: "dyna-access", - 3311: "mcns-tel-ret", - 3312: "appman-server", - 3313: "uorb", - 3314: "uohost", - 3315: "cdid", - 3316: "aicc-cmi", - 3317: "vsaiport", - 3318: "ssrip", - 3319: "sdt-lmd", - 3320: "officelink2000", - 3321: "vnsstr", - 3326: "sftu", - 3327: "bbars", - 3328: "egptlm", - 3329: "hp-device-disc", - 3330: "mcs-calypsoicf", - 3331: "mcs-messaging", - 3332: "mcs-mailsvr", - 3333: "dec-notes", - 3334: "directv-web", - 3335: "directv-soft", - 3336: "directv-tick", - 3337: "directv-catlg", - 3338: "anet-b", - 3339: "anet-l", - 3340: "anet-m", - 3341: "anet-h", - 3342: "webtie", - 3343: "ms-cluster-net", - 3344: "bnt-manager", - 3345: "influence", - 3346: "trnsprntproxy", - 3347: "phoenix-rpc", - 3348: "pangolin-laser", - 3349: "chevinservices", - 3350: "findviatv", - 3351: "btrieve", - 3352: "ssql", - 3353: "fatpipe", - 3354: "suitjd", - 3355: "ordinox-dbase", - 3356: "upnotifyps", - 3357: "adtech-test", - 3358: "mpsysrmsvr", - 3359: "wg-netforce", - 3360: "kv-server", - 3361: "kv-agent", - 3362: "dj-ilm", - 3363: "nati-vi-server", - 3364: "creativeserver", - 3365: "contentserver", - 3366: "creativepartnr", - 3372: "tip2", - 3373: "lavenir-lm", - 3374: "cluster-disc", - 3375: "vsnm-agent", - 3376: "cdbroker", - 3377: "cogsys-lm", - 3378: "wsicopy", - 3379: "socorfs", - 3380: "sns-channels", - 3381: "geneous", - 3382: "fujitsu-neat", - 3383: "esp-lm", - 3384: "hp-clic", - 3385: "qnxnetman", - 3386: "gprs-data", - 3387: "backroomnet", - 3388: "cbserver", - 3389: "ms-wbt-server", - 3390: "dsc", - 3391: "savant", - 3392: "efi-lm", - 3393: "d2k-tapestry1", - 3394: "d2k-tapestry2", - 3395: "dyna-lm", - 3396: "printer-agent", - 3397: "cloanto-lm", - 3398: "mercantile", - 3399: "csms", - 3400: "csms2", - 3401: "filecast", - 3402: "fxaengine-net", - 3405: "nokia-ann-ch1", - 3406: "nokia-ann-ch2", - 3407: "ldap-admin", - 3408: "BESApi", - 3409: "networklens", - 3410: "networklenss", - 3411: "biolink-auth", - 3412: "xmlblaster", - 3413: "svnet", - 3414: "wip-port", - 3415: "bcinameservice", - 3416: "commandport", - 3417: "csvr", - 3418: "rnmap", - 3419: "softaudit", - 3420: "ifcp-port", - 3421: "bmap", - 3422: "rusb-sys-port", - 3423: "xtrm", - 3424: "xtrms", - 3425: "agps-port", - 3426: "arkivio", - 3427: "websphere-snmp", - 3428: "twcss", - 3429: "gcsp", - 3430: "ssdispatch", - 3431: "ndl-als", - 3432: "osdcp", - 3433: "opnet-smp", - 3434: "opencm", - 3435: "pacom", - 3436: "gc-config", - 3437: "autocueds", - 3438: "spiral-admin", - 3439: "hri-port", - 3440: "ans-console", - 3441: "connect-client", - 3442: "connect-server", - 3443: "ov-nnm-websrv", - 3444: "denali-server", - 3445: "monp", - 3446: "3comfaxrpc", - 3447: "directnet", - 3448: "dnc-port", - 3449: "hotu-chat", - 3450: "castorproxy", - 3451: "asam", - 3452: "sabp-signal", - 3453: "pscupd", - 3454: "mira", - 3455: "prsvp", - 3456: "vat", - 3457: "vat-control", - 3458: "d3winosfi", - 3459: "integral", - 3460: "edm-manager", - 3461: "edm-stager", - 3462: "edm-std-notify", - 3463: "edm-adm-notify", - 3464: "edm-mgr-sync", - 3465: "edm-mgr-cntrl", - 3466: "workflow", - 3467: "rcst", - 3468: "ttcmremotectrl", - 3469: "pluribus", - 3470: "jt400", - 3471: "jt400-ssl", - 3472: "jaugsremotec-1", - 3473: "jaugsremotec-2", - 3474: "ttntspauto", - 3475: "genisar-port", - 3476: "nppmp", - 3477: "ecomm", - 3478: "stun", - 3479: "twrpc", - 3480: "plethora", - 3481: "cleanerliverc", - 3482: "vulture", - 3483: "slim-devices", - 3484: "gbs-stp", - 3485: "celatalk", - 3486: "ifsf-hb-port", - 3487: "ltctcp", - 3488: "fs-rh-srv", - 3489: "dtp-dia", - 3490: "colubris", - 3491: "swr-port", - 3492: "tvdumtray-port", - 3493: "nut", - 3494: "ibm3494", - 3495: "seclayer-tcp", - 3496: "seclayer-tls", - 3497: "ipether232port", - 3498: "dashpas-port", - 3499: "sccip-media", - 3500: "rtmp-port", - 3501: "isoft-p2p", - 3502: "avinstalldisc", - 3503: "lsp-ping", - 3504: "ironstorm", - 3505: "ccmcomm", - 3506: "apc-3506", - 3507: "nesh-broker", - 3508: "interactionweb", - 3509: "vt-ssl", - 3510: "xss-port", - 3511: "webmail-2", - 3512: "aztec", - 3513: "arcpd", - 3514: "must-p2p", - 3515: "must-backplane", - 3516: "smartcard-port", - 3517: "802-11-iapp", - 3518: "artifact-msg", - 3519: "nvmsgd", - 3520: "galileolog", - 3521: "mc3ss", - 3522: "nssocketport", - 3523: "odeumservlink", - 3524: "ecmport", - 3525: "eisport", - 3526: "starquiz-port", - 3527: "beserver-msg-q", - 3528: "jboss-iiop", - 3529: "jboss-iiop-ssl", - 3530: "gf", - 3531: "joltid", - 3532: "raven-rmp", - 3533: "raven-rdp", - 3534: "urld-port", - 3535: "ms-la", - 3536: "snac", - 3537: "ni-visa-remote", - 3538: "ibm-diradm", - 3539: "ibm-diradm-ssl", - 3540: "pnrp-port", - 3541: "voispeed-port", - 3542: "hacl-monitor", - 3543: "qftest-lookup", - 3544: "teredo", - 3545: "camac", - 3547: "symantec-sim", - 3548: "interworld", - 3549: "tellumat-nms", - 3550: "ssmpp", - 3551: "apcupsd", - 3552: "taserver", - 3553: "rbr-discovery", - 3554: "questnotify", - 3555: "razor", - 3556: "sky-transport", - 3557: "personalos-001", - 3558: "mcp-port", - 3559: "cctv-port", - 3560: "iniserve-port", - 3561: "bmc-onekey", - 3562: "sdbproxy", - 3563: "watcomdebug", - 3564: "esimport", - 3565: "m2pa", - 3566: "quest-data-hub", - 3567: "dof-eps", - 3568: "dof-tunnel-sec", - 3569: "mbg-ctrl", - 3570: "mccwebsvr-port", - 3571: "megardsvr-port", - 3572: "megaregsvrport", - 3573: "tag-ups-1", - 3574: "dmaf-server", - 3575: "ccm-port", - 3576: "cmc-port", - 3577: "config-port", - 3578: "data-port", - 3579: "ttat3lb", - 3580: "nati-svrloc", - 3581: "kfxaclicensing", - 3582: "press", - 3583: "canex-watch", - 3584: "u-dbap", - 3585: "emprise-lls", - 3586: "emprise-lsc", - 3587: "p2pgroup", - 3588: "sentinel", - 3589: "isomair", - 3590: "wv-csp-sms", - 3591: "gtrack-server", - 3592: "gtrack-ne", - 3593: "bpmd", - 3594: "mediaspace", - 3595: "shareapp", - 3596: "iw-mmogame", - 3597: "a14", - 3598: "a15", - 3599: "quasar-server", - 3600: "trap-daemon", - 3601: "visinet-gui", - 3602: "infiniswitchcl", - 3603: "int-rcv-cntrl", - 3604: "bmc-jmx-port", - 3605: "comcam-io", - 3606: "splitlock", - 3607: "precise-i3", - 3608: "trendchip-dcp", - 3609: "cpdi-pidas-cm", - 3610: "echonet", - 3611: "six-degrees", - 3612: "hp-dataprotect", - 3613: "alaris-disc", - 3614: "sigma-port", - 3615: "start-network", - 3616: "cd3o-protocol", - 3617: "sharp-server", - 3618: "aairnet-1", - 3619: "aairnet-2", - 3620: "ep-pcp", - 3621: "ep-nsp", - 3622: "ff-lr-port", - 3623: "haipe-discover", - 3624: "dist-upgrade", - 3625: "volley", - 3626: "bvcdaemon-port", - 3627: "jamserverport", - 3628: "ept-machine", - 3629: "escvpnet", - 3630: "cs-remote-db", - 3631: "cs-services", - 3632: "distcc", - 3633: "wacp", - 3634: "hlibmgr", - 3635: "sdo", - 3636: "servistaitsm", - 3637: "scservp", - 3638: "ehp-backup", - 3639: "xap-ha", - 3640: "netplay-port1", - 3641: "netplay-port2", - 3642: "juxml-port", - 3643: "audiojuggler", - 3644: "ssowatch", - 3645: "cyc", - 3646: "xss-srv-port", - 3647: "splitlock-gw", - 3648: "fjcp", - 3649: "nmmp", - 3650: "prismiq-plugin", - 3651: "xrpc-registry", - 3652: "vxcrnbuport", - 3653: "tsp", - 3654: "vaprtm", - 3655: "abatemgr", - 3656: "abatjss", - 3657: "immedianet-bcn", - 3658: "ps-ams", - 3659: "apple-sasl", - 3660: "can-nds-ssl", - 3661: "can-ferret-ssl", - 3662: "pserver", - 3663: "dtp", - 3664: "ups-engine", - 3665: "ent-engine", - 3666: "eserver-pap", - 3667: "infoexch", - 3668: "dell-rm-port", - 3669: "casanswmgmt", - 3670: "smile", - 3671: "efcp", - 3672: "lispworks-orb", - 3673: "mediavault-gui", - 3674: "wininstall-ipc", - 3675: "calltrax", - 3676: "va-pacbase", - 3677: "roverlog", - 3678: "ipr-dglt", - 3679: "Escale (Newton Dock)", - 3680: "npds-tracker", - 3681: "bts-x73", - 3682: "cas-mapi", - 3683: "bmc-ea", - 3684: "faxstfx-port", - 3685: "dsx-agent", - 3686: "tnmpv2", - 3687: "simple-push", - 3688: "simple-push-s", - 3689: "daap", - 3690: "svn", - 3691: "magaya-network", - 3692: "intelsync", - 3693: "easl", - 3695: "bmc-data-coll", - 3696: "telnetcpcd", - 3697: "nw-license", - 3698: "sagectlpanel", - 3699: "kpn-icw", - 3700: "lrs-paging", - 3701: "netcelera", - 3702: "ws-discovery", - 3703: "adobeserver-3", - 3704: "adobeserver-4", - 3705: "adobeserver-5", - 3706: "rt-event", - 3707: "rt-event-s", - 3708: "sun-as-iiops", - 3709: "ca-idms", - 3710: "portgate-auth", - 3711: "edb-server2", - 3712: "sentinel-ent", - 3713: "tftps", - 3714: "delos-dms", - 3715: "anoto-rendezv", - 3716: "wv-csp-sms-cir", - 3717: "wv-csp-udp-cir", - 3718: "opus-services", - 3719: "itelserverport", - 3720: "ufastro-instr", - 3721: "xsync", - 3722: "xserveraid", - 3723: "sychrond", - 3724: "blizwow", - 3725: "na-er-tip", - 3726: "array-manager", - 3727: "e-mdu", - 3728: "e-woa", - 3729: "fksp-audit", - 3730: "client-ctrl", - 3731: "smap", - 3732: "m-wnn", - 3733: "multip-msg", - 3734: "synel-data", - 3735: "pwdis", - 3736: "rs-rmi", - 3737: "xpanel", - 3738: "versatalk", - 3739: "launchbird-lm", - 3740: "heartbeat", - 3741: "wysdma", - 3742: "cst-port", - 3743: "ipcs-command", - 3744: "sasg", - 3745: "gw-call-port", - 3746: "linktest", - 3747: "linktest-s", - 3748: "webdata", - 3749: "cimtrak", - 3750: "cbos-ip-port", - 3751: "gprs-cube", - 3752: "vipremoteagent", - 3753: "nattyserver", - 3754: "timestenbroker", - 3755: "sas-remote-hlp", - 3756: "canon-capt", - 3757: "grf-port", - 3758: "apw-registry", - 3759: "exapt-lmgr", - 3760: "adtempusclient", - 3761: "gsakmp", - 3762: "gbs-smp", - 3763: "xo-wave", - 3764: "mni-prot-rout", - 3765: "rtraceroute", - 3766: "sitewatch-s", - 3767: "listmgr-port", - 3768: "rblcheckd", - 3769: "haipe-otnk", - 3770: "cindycollab", - 3771: "paging-port", - 3772: "ctp", - 3773: "ctdhercules", - 3774: "zicom", - 3775: "ispmmgr", - 3776: "dvcprov-port", - 3777: "jibe-eb", - 3778: "c-h-it-port", - 3779: "cognima", - 3780: "nnp", - 3781: "abcvoice-port", - 3782: "iso-tp0s", - 3783: "bim-pem", - 3784: "bfd-control", - 3785: "bfd-echo", - 3786: "upstriggervsw", - 3787: "fintrx", - 3788: "isrp-port", - 3789: "remotedeploy", - 3790: "quickbooksrds", - 3791: "tvnetworkvideo", - 3792: "sitewatch", - 3793: "dcsoftware", - 3794: "jaus", - 3795: "myblast", - 3796: "spw-dialer", - 3797: "idps", - 3798: "minilock", - 3799: "radius-dynauth", - 3800: "pwgpsi", - 3801: "ibm-mgr", - 3802: "vhd", - 3803: "soniqsync", - 3804: "iqnet-port", - 3805: "tcpdataserver", - 3806: "wsmlb", - 3807: "spugna", - 3808: "sun-as-iiops-ca", - 3809: "apocd", - 3810: "wlanauth", - 3811: "amp", - 3812: "neto-wol-server", - 3813: "rap-ip", - 3814: "neto-dcs", - 3815: "lansurveyorxml", - 3816: "sunlps-http", - 3817: "tapeware", - 3818: "crinis-hb", - 3819: "epl-slp", - 3820: "scp", - 3821: "pmcp", - 3822: "acp-discovery", - 3823: "acp-conduit", - 3824: "acp-policy", - 3825: "ffserver", - 3826: "warmux", - 3827: "netmpi", - 3828: "neteh", - 3829: "neteh-ext", - 3830: "cernsysmgmtagt", - 3831: "dvapps", - 3832: "xxnetserver", - 3833: "aipn-auth", - 3834: "spectardata", - 3835: "spectardb", - 3836: "markem-dcp", - 3837: "mkm-discovery", - 3838: "sos", - 3839: "amx-rms", - 3840: "flirtmitmir", - 3841: "shiprush-db-svr", - 3842: "nhci", - 3843: "quest-agent", - 3844: "rnm", - 3845: "v-one-spp", - 3846: "an-pcp", - 3847: "msfw-control", - 3848: "item", - 3849: "spw-dnspreload", - 3850: "qtms-bootstrap", - 3851: "spectraport", - 3852: "sse-app-config", - 3853: "sscan", - 3854: "stryker-com", - 3855: "opentrac", - 3856: "informer", - 3857: "trap-port", - 3858: "trap-port-mom", - 3859: "nav-port", - 3860: "sasp", - 3861: "winshadow-hd", - 3862: "giga-pocket", - 3863: "asap-tcp", - 3864: "asap-tcp-tls", - 3865: "xpl", - 3866: "dzdaemon", - 3867: "dzoglserver", - 3868: "diameter", - 3869: "ovsam-mgmt", - 3870: "ovsam-d-agent", - 3871: "avocent-adsap", - 3872: "oem-agent", - 3873: "fagordnc", - 3874: "sixxsconfig", - 3875: "pnbscada", - 3876: "dl-agent", - 3877: "xmpcr-interface", - 3878: "fotogcad", - 3879: "appss-lm", - 3880: "igrs", - 3881: "idac", - 3882: "msdts1", - 3883: "vrpn", - 3884: "softrack-meter", - 3885: "topflow-ssl", - 3886: "nei-management", - 3887: "ciphire-data", - 3888: "ciphire-serv", - 3889: "dandv-tester", - 3890: "ndsconnect", - 3891: "rtc-pm-port", - 3892: "pcc-image-port", - 3893: "cgi-starapi", - 3894: "syam-agent", - 3895: "syam-smc", - 3896: "sdo-tls", - 3897: "sdo-ssh", - 3898: "senip", - 3899: "itv-control", - 3900: "udt-os", - 3901: "nimsh", - 3902: "nimaux", - 3903: "charsetmgr", - 3904: "omnilink-port", - 3905: "mupdate", - 3906: "topovista-data", - 3907: "imoguia-port", - 3908: "hppronetman", - 3909: "surfcontrolcpa", - 3910: "prnrequest", - 3911: "prnstatus", - 3912: "gbmt-stars", - 3913: "listcrt-port", - 3914: "listcrt-port-2", - 3915: "agcat", - 3916: "wysdmc", - 3917: "aftmux", - 3918: "pktcablemmcops", - 3919: "hyperip", - 3920: "exasoftport1", - 3921: "herodotus-net", - 3922: "sor-update", - 3923: "symb-sb-port", - 3924: "mpl-gprs-port", - 3925: "zmp", - 3926: "winport", - 3927: "natdataservice", - 3928: "netboot-pxe", - 3929: "smauth-port", - 3930: "syam-webserver", - 3931: "msr-plugin-port", - 3932: "dyn-site", - 3933: "plbserve-port", - 3934: "sunfm-port", - 3935: "sdp-portmapper", - 3936: "mailprox", - 3937: "dvbservdsc", - 3938: "dbcontrol-agent", - 3939: "aamp", - 3940: "xecp-node", - 3941: "homeportal-web", - 3942: "srdp", - 3943: "tig", - 3944: "sops", - 3945: "emcads", - 3946: "backupedge", - 3947: "ccp", - 3948: "apdap", - 3949: "drip", - 3950: "namemunge", - 3951: "pwgippfax", - 3952: "i3-sessionmgr", - 3953: "xmlink-connect", - 3954: "adrep", - 3955: "p2pcommunity", - 3956: "gvcp", - 3957: "mqe-broker", - 3958: "mqe-agent", - 3959: "treehopper", - 3960: "bess", - 3961: "proaxess", - 3962: "sbi-agent", - 3963: "thrp", - 3964: "sasggprs", - 3965: "ati-ip-to-ncpe", - 3966: "bflckmgr", - 3967: "ppsms", - 3968: "ianywhere-dbns", - 3969: "landmarks", - 3970: "lanrevagent", - 3971: "lanrevserver", - 3972: "iconp", - 3973: "progistics", - 3974: "citysearch", - 3975: "airshot", - 3976: "opswagent", - 3977: "opswmanager", - 3978: "secure-cfg-svr", - 3979: "smwan", - 3980: "acms", - 3981: "starfish", - 3982: "eis", - 3983: "eisp", - 3984: "mapper-nodemgr", - 3985: "mapper-mapethd", - 3986: "mapper-ws-ethd", - 3987: "centerline", - 3988: "dcs-config", - 3989: "bv-queryengine", - 3990: "bv-is", - 3991: "bv-smcsrv", - 3992: "bv-ds", - 3993: "bv-agent", - 3995: "iss-mgmt-ssl", - 3996: "abcsoftware", - 3997: "agentsease-db", - 3998: "dnx", - 3999: "nvcnet", - 4000: "terabase", - 4001: "newoak", - 4002: "pxc-spvr-ft", - 4003: "pxc-splr-ft", - 4004: "pxc-roid", - 4005: "pxc-pin", - 4006: "pxc-spvr", - 4007: "pxc-splr", - 4008: "netcheque", - 4009: "chimera-hwm", - 4010: "samsung-unidex", - 4011: "altserviceboot", - 4012: "pda-gate", - 4013: "acl-manager", - 4014: "taiclock", - 4015: "talarian-mcast1", - 4016: "talarian-mcast2", - 4017: "talarian-mcast3", - 4018: "talarian-mcast4", - 4019: "talarian-mcast5", - 4020: "trap", - 4021: "nexus-portal", - 4022: "dnox", - 4023: "esnm-zoning", - 4024: "tnp1-port", - 4025: "partimage", - 4026: "as-debug", - 4027: "bxp", - 4028: "dtserver-port", - 4029: "ip-qsig", - 4030: "jdmn-port", - 4031: "suucp", - 4032: "vrts-auth-port", - 4033: "sanavigator", - 4034: "ubxd", - 4035: "wap-push-http", - 4036: "wap-push-https", - 4037: "ravehd", - 4038: "fazzt-ptp", - 4039: "fazzt-admin", - 4040: "yo-main", - 4041: "houston", - 4042: "ldxp", - 4043: "nirp", - 4044: "ltp", - 4045: "npp", - 4046: "acp-proto", - 4047: "ctp-state", - 4049: "wafs", - 4050: "cisco-wafs", - 4051: "cppdp", - 4052: "interact", - 4053: "ccu-comm-1", - 4054: "ccu-comm-2", - 4055: "ccu-comm-3", - 4056: "lms", - 4057: "wfm", - 4058: "kingfisher", - 4059: "dlms-cosem", - 4060: "dsmeter-iatc", - 4061: "ice-location", - 4062: "ice-slocation", - 4063: "ice-router", - 4064: "ice-srouter", - 4065: "avanti-cdp", - 4066: "pmas", - 4067: "idp", - 4068: "ipfltbcst", - 4069: "minger", - 4070: "tripe", - 4071: "aibkup", - 4072: "zieto-sock", - 4073: "iRAPP", - 4074: "cequint-cityid", - 4075: "perimlan", - 4076: "seraph", - 4078: "cssp", - 4079: "santools", - 4080: "lorica-in", - 4081: "lorica-in-sec", - 4082: "lorica-out", - 4083: "lorica-out-sec", - 4085: "ezmessagesrv", - 4087: "applusservice", - 4088: "npsp", - 4089: "opencore", - 4090: "omasgport", - 4091: "ewinstaller", - 4092: "ewdgs", - 4093: "pvxpluscs", - 4094: "sysrqd", - 4095: "xtgui", - 4096: "bre", - 4097: "patrolview", - 4098: "drmsfsd", - 4099: "dpcp", - 4100: "igo-incognito", - 4101: "brlp-0", - 4102: "brlp-1", - 4103: "brlp-2", - 4104: "brlp-3", - 4105: "shofar", - 4106: "synchronite", - 4107: "j-ac", - 4108: "accel", - 4109: "izm", - 4110: "g2tag", - 4111: "xgrid", - 4112: "apple-vpns-rp", - 4113: "aipn-reg", - 4114: "jomamqmonitor", - 4115: "cds", - 4116: "smartcard-tls", - 4117: "hillrserv", - 4118: "netscript", - 4119: "assuria-slm", - 4120: "minirem", - 4121: "e-builder", - 4122: "fprams", - 4123: "z-wave", - 4124: "tigv2", - 4125: "opsview-envoy", - 4126: "ddrepl", - 4127: "unikeypro", - 4128: "nufw", - 4129: "nuauth", - 4130: "fronet", - 4131: "stars", - 4132: "nuts-dem", - 4133: "nuts-bootp", - 4134: "nifty-hmi", - 4135: "cl-db-attach", - 4136: "cl-db-request", - 4137: "cl-db-remote", - 4138: "nettest", - 4139: "thrtx", - 4140: "cedros-fds", - 4141: "oirtgsvc", - 4142: "oidocsvc", - 4143: "oidsr", - 4145: "vvr-control", - 4146: "tgcconnect", - 4147: "vrxpservman", - 4148: "hhb-handheld", - 4149: "agslb", - 4150: "PowerAlert-nsa", - 4151: "menandmice-noh", - 4152: "idig-mux", - 4153: "mbl-battd", - 4154: "atlinks", - 4155: "bzr", - 4156: "stat-results", - 4157: "stat-scanner", - 4158: "stat-cc", - 4159: "nss", - 4160: "jini-discovery", - 4161: "omscontact", - 4162: "omstopology", - 4163: "silverpeakpeer", - 4164: "silverpeakcomm", - 4165: "altcp", - 4166: "joost", - 4167: "ddgn", - 4168: "pslicser", - 4169: "iadt", - 4170: "d-cinema-csp", - 4171: "ml-svnet", - 4172: "pcoip", - 4174: "smcluster", - 4175: "bccp", - 4176: "tl-ipcproxy", - 4177: "wello", - 4178: "storman", - 4179: "MaxumSP", - 4180: "httpx", - 4181: "macbak", - 4182: "pcptcpservice", - 4183: "cyborgnet", - 4184: "universe-suite", - 4185: "wcpp", - 4186: "boxbackupstore", - 4187: "csc-proxy", - 4188: "vatata", - 4189: "pcep", - 4190: "sieve", - 4192: "azeti", - 4193: "pvxplusio", - 4197: "hctl", - 4199: "eims-admin", - 4300: "corelccam", - 4301: "d-data", - 4302: "d-data-control", - 4303: "srcp", - 4304: "owserver", - 4305: "batman", - 4306: "pinghgl", - 4307: "trueconf", - 4308: "compx-lockview", - 4309: "dserver", - 4310: "mirrtex", - 4311: "p6ssmc", - 4312: "pscl-mgt", - 4313: "perrla", - 4314: "choiceview-agt", - 4316: "choiceview-clt", - 4320: "fdt-rcatp", - 4321: "rwhois", - 4322: "trim-event", - 4323: "trim-ice", - 4325: "geognosisman", - 4326: "geognosis", - 4327: "jaxer-web", - 4328: "jaxer-manager", - 4329: "publiqare-sync", - 4330: "dey-sapi", - 4331: "ktickets-rest", - 4333: "ahsp", - 4334: "netconf-ch-ssh", - 4335: "netconf-ch-tls", - 4336: "restconf-ch-tls", - 4340: "gaia", - 4341: "lisp-data", - 4342: "lisp-cons", - 4343: "unicall", - 4344: "vinainstall", - 4345: "m4-network-as", - 4346: "elanlm", - 4347: "lansurveyor", - 4348: "itose", - 4349: "fsportmap", - 4350: "net-device", - 4351: "plcy-net-svcs", - 4352: "pjlink", - 4353: "f5-iquery", - 4354: "qsnet-trans", - 4355: "qsnet-workst", - 4356: "qsnet-assist", - 4357: "qsnet-cond", - 4358: "qsnet-nucl", - 4359: "omabcastltkm", - 4360: "matrix-vnet", - 4368: "wxbrief", - 4369: "epmd", - 4370: "elpro-tunnel", - 4371: "l2c-control", - 4372: "l2c-data", - 4373: "remctl", - 4374: "psi-ptt", - 4375: "tolteces", - 4376: "bip", - 4377: "cp-spxsvr", - 4378: "cp-spxdpy", - 4379: "ctdb", - 4389: "xandros-cms", - 4390: "wiegand", - 4391: "apwi-imserver", - 4392: "apwi-rxserver", - 4393: "apwi-rxspooler", - 4395: "omnivisionesx", - 4396: "fly", - 4400: "ds-srv", - 4401: "ds-srvr", - 4402: "ds-clnt", - 4403: "ds-user", - 4404: "ds-admin", - 4405: "ds-mail", - 4406: "ds-slp", - 4407: "nacagent", - 4408: "slscc", - 4409: "netcabinet-com", - 4410: "itwo-server", - 4411: "found", - 4413: "avi-nms", - 4414: "updog", - 4415: "brcd-vr-req", - 4416: "pjj-player", - 4417: "workflowdir", - 4419: "cbp", - 4420: "nvm-express", - 4421: "scaleft", - 4422: "tsepisp", - 4423: "thingkit", - 4425: "netrockey6", - 4426: "beacon-port-2", - 4427: "drizzle", - 4428: "omviserver", - 4429: "omviagent", - 4430: "rsqlserver", - 4431: "wspipe", - 4432: "l-acoustics", - 4433: "vop", - 4442: "saris", - 4443: "pharos", - 4444: "krb524", - 4445: "upnotifyp", - 4446: "n1-fwp", - 4447: "n1-rmgmt", - 4448: "asc-slmd", - 4449: "privatewire", - 4450: "camp", - 4451: "ctisystemmsg", - 4452: "ctiprogramload", - 4453: "nssalertmgr", - 4454: "nssagentmgr", - 4455: "prchat-user", - 4456: "prchat-server", - 4457: "prRegister", - 4458: "mcp", - 4484: "hpssmgmt", - 4485: "assyst-dr", - 4486: "icms", - 4487: "prex-tcp", - 4488: "awacs-ice", - 4500: "ipsec-nat-t", - 4535: "ehs", - 4536: "ehs-ssl", - 4537: "wssauthsvc", - 4538: "swx-gate", - 4545: "worldscores", - 4546: "sf-lm", - 4547: "lanner-lm", - 4548: "synchromesh", - 4549: "aegate", - 4550: "gds-adppiw-db", - 4551: "ieee-mih", - 4552: "menandmice-mon", - 4553: "icshostsvc", - 4554: "msfrs", - 4555: "rsip", - 4556: "dtn-bundle", - 4559: "hylafax", - 4563: "amahi-anywhere", - 4566: "kwtc", - 4567: "tram", - 4568: "bmc-reporting", - 4569: "iax", - 4570: "deploymentmap", - 4573: "cardifftec-back", - 4590: "rid", - 4591: "l3t-at-an", - 4593: "ipt-anri-anri", - 4594: "ias-session", - 4595: "ias-paging", - 4596: "ias-neighbor", - 4597: "a21-an-1xbs", - 4598: "a16-an-an", - 4599: "a17-an-an", - 4600: "piranha1", - 4601: "piranha2", - 4602: "mtsserver", - 4603: "menandmice-upg", - 4604: "irp", - 4605: "sixchat", - 4658: "playsta2-app", - 4659: "playsta2-lob", - 4660: "smaclmgr", - 4661: "kar2ouche", - 4662: "oms", - 4663: "noteit", - 4664: "ems", - 4665: "contclientms", - 4666: "eportcomm", - 4667: "mmacomm", - 4668: "mmaeds", - 4669: "eportcommdata", - 4670: "light", - 4671: "acter", - 4672: "rfa", - 4673: "cxws", - 4674: "appiq-mgmt", - 4675: "dhct-status", - 4676: "dhct-alerts", - 4677: "bcs", - 4678: "traversal", - 4679: "mgesupervision", - 4680: "mgemanagement", - 4681: "parliant", - 4682: "finisar", - 4683: "spike", - 4684: "rfid-rp1", - 4685: "autopac", - 4686: "msp-os", - 4687: "nst", - 4688: "mobile-p2p", - 4689: "altovacentral", - 4690: "prelude", - 4691: "mtn", - 4692: "conspiracy", - 4700: "netxms-agent", - 4701: "netxms-mgmt", - 4702: "netxms-sync", - 4703: "npqes-test", - 4704: "assuria-ins", - 4711: "trinity-dist", - 4725: "truckstar", - 4727: "fcis", - 4728: "capmux", - 4730: "gearman", - 4731: "remcap", - 4733: "resorcs", - 4737: "ipdr-sp", - 4738: "solera-lpn", - 4739: "ipfix", - 4740: "ipfixs", - 4741: "lumimgrd", - 4742: "sicct", - 4743: "openhpid", - 4744: "ifsp", - 4745: "fmp", - 4749: "profilemac", - 4750: "ssad", - 4751: "spocp", - 4752: "snap", - 4753: "simon", - 4756: "RDCenter", - 4774: "converge", - 4784: "bfd-multi-ctl", - 4786: "smart-install", - 4787: "sia-ctrl-plane", - 4788: "xmcp", - 4800: "iims", - 4801: "iwec", - 4802: "ilss", - 4803: "notateit", - 4827: "htcp", - 4837: "varadero-0", - 4838: "varadero-1", - 4839: "varadero-2", - 4840: "opcua-tcp", - 4841: "quosa", - 4842: "gw-asv", - 4843: "opcua-tls", - 4844: "gw-log", - 4845: "wcr-remlib", - 4846: "contamac-icm", - 4847: "wfc", - 4848: "appserv-http", - 4849: "appserv-https", - 4850: "sun-as-nodeagt", - 4851: "derby-repli", - 4867: "unify-debug", - 4868: "phrelay", - 4869: "phrelaydbg", - 4870: "cc-tracking", - 4871: "wired", - 4876: "tritium-can", - 4877: "lmcs", - 4879: "wsdl-event", - 4880: "hislip", - 4883: "wmlserver", - 4884: "hivestor", - 4885: "abbs", - 4894: "lyskom", - 4899: "radmin-port", - 4900: "hfcs", - 4901: "flr-agent", - 4902: "magiccontrol", - 4912: "lutap", - 4913: "lutcp", - 4914: "bones", - 4915: "frcs", - 4940: "eq-office-4940", - 4941: "eq-office-4941", - 4942: "eq-office-4942", - 4949: "munin", - 4950: "sybasesrvmon", - 4951: "pwgwims", - 4952: "sagxtsds", - 4953: "dbsyncarbiter", - 4969: "ccss-qmm", - 4970: "ccss-qsm", - 4971: "burp", - 4984: "webyast", - 4985: "gerhcs", - 4986: "mrip", - 4987: "smar-se-port1", - 4988: "smar-se-port2", - 4989: "parallel", - 4990: "busycal", - 4991: "vrt", - 4999: "hfcs-manager", - 5000: "commplex-main", - 5001: "commplex-link", - 5002: "rfe", - 5003: "fmpro-internal", - 5004: "avt-profile-1", - 5005: "avt-profile-2", - 5006: "wsm-server", - 5007: "wsm-server-ssl", - 5008: "synapsis-edge", - 5009: "winfs", - 5010: "telelpathstart", - 5011: "telelpathattack", - 5012: "nsp", - 5013: "fmpro-v6", - 5015: "fmwp", - 5020: "zenginkyo-1", - 5021: "zenginkyo-2", - 5022: "mice", - 5023: "htuilsrv", - 5024: "scpi-telnet", - 5025: "scpi-raw", - 5026: "strexec-d", - 5027: "strexec-s", - 5028: "qvr", - 5029: "infobright", - 5030: "surfpass", - 5032: "signacert-agent", - 5033: "jtnetd-server", - 5034: "jtnetd-status", - 5042: "asnaacceler8db", - 5043: "swxadmin", - 5044: "lxi-evntsvc", - 5045: "osp", - 5048: "texai", - 5049: "ivocalize", - 5050: "mmcc", - 5051: "ita-agent", - 5052: "ita-manager", - 5053: "rlm", - 5054: "rlm-admin", - 5055: "unot", - 5056: "intecom-ps1", - 5057: "intecom-ps2", - 5059: "sds", - 5060: "sip", - 5061: "sips", - 5062: "na-localise", - 5063: "csrpc", - 5064: "ca-1", - 5065: "ca-2", - 5066: "stanag-5066", - 5067: "authentx", - 5068: "bitforestsrv", - 5069: "i-net-2000-npr", - 5070: "vtsas", - 5071: "powerschool", - 5072: "ayiya", - 5073: "tag-pm", - 5074: "alesquery", - 5075: "pvaccess", - 5080: "onscreen", - 5081: "sdl-ets", - 5082: "qcp", - 5083: "qfp", - 5084: "llrp", - 5085: "encrypted-llrp", - 5086: "aprigo-cs", - 5087: "biotic", - 5093: "sentinel-lm", - 5094: "hart-ip", - 5099: "sentlm-srv2srv", - 5100: "socalia", - 5101: "talarian-tcp", - 5102: "oms-nonsecure", - 5103: "actifio-c2c", - 5106: "actifioudsagent", - 5107: "actifioreplic", - 5111: "taep-as-svc", - 5112: "pm-cmdsvr", - 5114: "ev-services", - 5115: "autobuild", - 5117: "gradecam", - 5120: "barracuda-bbs", - 5133: "nbt-pc", - 5134: "ppactivation", - 5135: "erp-scale", - 5137: "ctsd", - 5145: "rmonitor-secure", - 5146: "social-alarm", - 5150: "atmp", - 5151: "esri-sde", - 5152: "sde-discovery", - 5153: "toruxserver", - 5154: "bzflag", - 5155: "asctrl-agent", - 5156: "rugameonline", - 5157: "mediat", - 5161: "snmpssh", - 5162: "snmpssh-trap", - 5163: "sbackup", - 5164: "vpa", - 5165: "ife-icorp", - 5166: "winpcs", - 5167: "scte104", - 5168: "scte30", - 5172: "pcoip-mgmt", - 5190: "aol", - 5191: "aol-1", - 5192: "aol-2", - 5193: "aol-3", - 5194: "cpscomm", - 5195: "ampl-lic", - 5196: "ampl-tableproxy", - 5197: "tunstall-lwp", - 5200: "targus-getdata", - 5201: "targus-getdata1", - 5202: "targus-getdata2", - 5203: "targus-getdata3", - 5209: "nomad", - 5215: "noteza", - 5221: "3exmp", - 5222: "xmpp-client", - 5223: "hpvirtgrp", - 5224: "hpvirtctrl", - 5225: "hp-server", - 5226: "hp-status", - 5227: "perfd", - 5228: "hpvroom", - 5229: "jaxflow", - 5230: "jaxflow-data", - 5231: "crusecontrol", - 5232: "csedaemon", - 5233: "enfs", - 5234: "eenet", - 5235: "galaxy-network", - 5236: "padl2sim", - 5237: "mnet-discovery", - 5245: "downtools", - 5248: "caacws", - 5249: "caaclang2", - 5250: "soagateway", - 5251: "caevms", - 5252: "movaz-ssc", - 5253: "kpdp", - 5254: "logcabin", - 5264: "3com-njack-1", - 5265: "3com-njack-2", - 5269: "xmpp-server", - 5270: "cartographerxmp", - 5271: "cuelink", - 5272: "pk", - 5280: "xmpp-bosh", - 5281: "undo-lm", - 5282: "transmit-port", - 5298: "presence", - 5299: "nlg-data", - 5300: "hacl-hb", - 5301: "hacl-gs", - 5302: "hacl-cfg", - 5303: "hacl-probe", - 5304: "hacl-local", - 5305: "hacl-test", - 5306: "sun-mc-grp", - 5307: "sco-aip", - 5308: "cfengine", - 5309: "jprinter", - 5310: "outlaws", - 5312: "permabit-cs", - 5313: "rrdp", - 5314: "opalis-rbt-ipc", - 5315: "hacl-poll", - 5316: "hpbladems", - 5317: "hpdevms", - 5318: "pkix-cmc", - 5320: "bsfserver-zn", - 5321: "bsfsvr-zn-ssl", - 5343: "kfserver", - 5344: "xkotodrcp", - 5349: "stuns", - 5352: "dns-llq", - 5353: "mdns", - 5354: "mdnsresponder", - 5355: "llmnr", - 5356: "ms-smlbiz", - 5357: "wsdapi", - 5358: "wsdapi-s", - 5359: "ms-alerter", - 5360: "ms-sideshow", - 5361: "ms-s-sideshow", - 5362: "serverwsd2", - 5363: "net-projection", - 5397: "stresstester", - 5398: "elektron-admin", - 5399: "securitychase", - 5400: "excerpt", - 5401: "excerpts", - 5402: "mftp", - 5403: "hpoms-ci-lstn", - 5404: "hpoms-dps-lstn", - 5405: "netsupport", - 5406: "systemics-sox", - 5407: "foresyte-clear", - 5408: "foresyte-sec", - 5409: "salient-dtasrv", - 5410: "salient-usrmgr", - 5411: "actnet", - 5412: "continuus", - 5413: "wwiotalk", - 5414: "statusd", - 5415: "ns-server", - 5416: "sns-gateway", - 5417: "sns-agent", - 5418: "mcntp", - 5419: "dj-ice", - 5420: "cylink-c", - 5421: "netsupport2", - 5422: "salient-mux", - 5423: "virtualuser", - 5424: "beyond-remote", - 5425: "br-channel", - 5426: "devbasic", - 5427: "sco-peer-tta", - 5428: "telaconsole", - 5429: "base", - 5430: "radec-corp", - 5431: "park-agent", - 5432: "postgresql", - 5433: "pyrrho", - 5434: "sgi-arrayd", - 5435: "sceanics", - 5443: "spss", - 5445: "smbdirect", - 5450: "tiepie", - 5453: "surebox", - 5454: "apc-5454", - 5455: "apc-5455", - 5456: "apc-5456", - 5461: "silkmeter", - 5462: "ttl-publisher", - 5463: "ttlpriceproxy", - 5464: "quailnet", - 5465: "netops-broker", - 5470: "apsolab-col", - 5471: "apsolab-cols", - 5472: "apsolab-tag", - 5473: "apsolab-tags", - 5475: "apsolab-data", - 5500: "fcp-addr-srvr1", - 5501: "fcp-addr-srvr2", - 5502: "fcp-srvr-inst1", - 5503: "fcp-srvr-inst2", - 5504: "fcp-cics-gw1", - 5505: "checkoutdb", - 5506: "amc", - 5507: "psl-management", - 5550: "cbus", - 5553: "sgi-eventmond", - 5554: "sgi-esphttp", - 5555: "personal-agent", - 5556: "freeciv", - 5557: "farenet", - 5565: "hpe-dp-bura", - 5566: "westec-connect", - 5567: "dof-dps-mc-sec", - 5568: "sdt", - 5569: "rdmnet-ctrl", - 5573: "sdmmp", - 5574: "lsi-bobcat", - 5575: "ora-oap", - 5579: "fdtracks", - 5580: "tmosms0", - 5581: "tmosms1", - 5582: "fac-restore", - 5583: "tmo-icon-sync", - 5584: "bis-web", - 5585: "bis-sync", - 5586: "att-mt-sms", - 5597: "ininmessaging", - 5598: "mctfeed", - 5599: "esinstall", - 5600: "esmmanager", - 5601: "esmagent", - 5602: "a1-msc", - 5603: "a1-bs", - 5604: "a3-sdunode", - 5605: "a4-sdunode", - 5618: "efr", - 5627: "ninaf", - 5628: "htrust", - 5629: "symantec-sfdb", - 5630: "precise-comm", - 5631: "pcanywheredata", - 5632: "pcanywherestat", - 5633: "beorl", - 5634: "xprtld", - 5635: "sfmsso", - 5636: "sfm-db-server", - 5637: "cssc", - 5638: "flcrs", - 5639: "ics", - 5646: "vfmobile", - 5666: "nrpe", - 5670: "filemq", - 5671: "amqps", - 5672: "amqp", - 5673: "jms", - 5674: "hyperscsi-port", - 5675: "v5ua", - 5676: "raadmin", - 5677: "questdb2-lnchr", - 5678: "rrac", - 5679: "dccm", - 5680: "auriga-router", - 5681: "ncxcp", - 5688: "ggz", - 5689: "qmvideo", - 5693: "rbsystem", - 5696: "kmip", - 5700: "supportassist", - 5705: "storageos", - 5713: "proshareaudio", - 5714: "prosharevideo", - 5715: "prosharedata", - 5716: "prosharerequest", - 5717: "prosharenotify", - 5718: "dpm", - 5719: "dpm-agent", - 5720: "ms-licensing", - 5721: "dtpt", - 5722: "msdfsr", - 5723: "omhs", - 5724: "omsdk", - 5725: "ms-ilm", - 5726: "ms-ilm-sts", - 5727: "asgenf", - 5728: "io-dist-data", - 5729: "openmail", - 5730: "unieng", - 5741: "ida-discover1", - 5742: "ida-discover2", - 5743: "watchdoc-pod", - 5744: "watchdoc", - 5745: "fcopy-server", - 5746: "fcopys-server", - 5747: "tunatic", - 5748: "tunalyzer", - 5750: "rscd", - 5755: "openmailg", - 5757: "x500ms", - 5766: "openmailns", - 5767: "s-openmail", - 5768: "openmailpxy", - 5769: "spramsca", - 5770: "spramsd", - 5771: "netagent", - 5777: "dali-port", - 5780: "vts-rpc", - 5781: "3par-evts", - 5782: "3par-mgmt", - 5783: "3par-mgmt-ssl", - 5785: "3par-rcopy", - 5793: "xtreamx", - 5813: "icmpd", - 5814: "spt-automation", - 5841: "shiprush-d-ch", - 5842: "reversion", - 5859: "wherehoo", - 5863: "ppsuitemsg", - 5868: "diameters", - 5883: "jute", - 5900: "rfb", - 5910: "cm", - 5911: "cpdlc", - 5912: "fis", - 5913: "ads-c", - 5963: "indy", - 5968: "mppolicy-v5", - 5969: "mppolicy-mgr", - 5984: "couchdb", - 5985: "wsman", - 5986: "wsmans", - 5987: "wbem-rmi", - 5988: "wbem-http", - 5989: "wbem-https", - 5990: "wbem-exp-https", - 5991: "nuxsl", - 5992: "consul-insight", - 5993: "cim-rs", - 5999: "cvsup", - 6064: "ndl-ahp-svc", - 6065: "winpharaoh", - 6066: "ewctsp", - 6068: "gsmp-ancp", - 6069: "trip", - 6070: "messageasap", - 6071: "ssdtp", - 6072: "diagnose-proc", - 6073: "directplay8", - 6074: "max", - 6075: "dpm-acm", - 6076: "msft-dpm-cert", - 6077: "iconstructsrv", - 6084: "reload-config", - 6085: "konspire2b", - 6086: "pdtp", - 6087: "ldss", - 6088: "doglms", - 6099: "raxa-mgmt", - 6100: "synchronet-db", - 6101: "synchronet-rtc", - 6102: "synchronet-upd", - 6103: "rets", - 6104: "dbdb", - 6105: "primaserver", - 6106: "mpsserver", - 6107: "etc-control", - 6108: "sercomm-scadmin", - 6109: "globecast-id", - 6110: "softcm", - 6111: "spc", - 6112: "dtspcd", - 6113: "dayliteserver", - 6114: "wrspice", - 6115: "xic", - 6116: "xtlserv", - 6117: "daylitetouch", - 6121: "spdy", - 6122: "bex-webadmin", - 6123: "backup-express", - 6124: "pnbs", - 6130: "damewaremobgtwy", - 6133: "nbt-wol", - 6140: "pulsonixnls", - 6141: "meta-corp", - 6142: "aspentec-lm", - 6143: "watershed-lm", - 6144: "statsci1-lm", - 6145: "statsci2-lm", - 6146: "lonewolf-lm", - 6147: "montage-lm", - 6148: "ricardo-lm", - 6149: "tal-pod", - 6159: "efb-aci", - 6160: "ecmp", - 6161: "patrol-ism", - 6162: "patrol-coll", - 6163: "pscribe", - 6200: "lm-x", - 6209: "qmtps", - 6222: "radmind", - 6241: "jeol-nsdtp-1", - 6242: "jeol-nsdtp-2", - 6243: "jeol-nsdtp-3", - 6244: "jeol-nsdtp-4", - 6251: "tl1-raw-ssl", - 6252: "tl1-ssh", - 6253: "crip", - 6267: "gld", - 6268: "grid", - 6269: "grid-alt", - 6300: "bmc-grx", - 6301: "bmc-ctd-ldap", - 6306: "ufmp", - 6315: "scup", - 6316: "abb-escp", - 6317: "nav-data-cmd", - 6320: "repsvc", - 6321: "emp-server1", - 6322: "emp-server2", - 6324: "hrd-ncs", - 6325: "dt-mgmtsvc", - 6326: "dt-vra", - 6343: "sflow", - 6344: "streletz", - 6346: "gnutella-svc", - 6347: "gnutella-rtr", - 6350: "adap", - 6355: "pmcs", - 6360: "metaedit-mu", - 6370: "metaedit-se", - 6379: "redis", - 6382: "metatude-mds", - 6389: "clariion-evr01", - 6390: "metaedit-ws", - 6417: "faxcomservice", - 6418: "syserverremote", - 6419: "svdrp", - 6420: "nim-vdrshell", - 6421: "nim-wan", - 6432: "pgbouncer", - 6442: "tarp", - 6443: "sun-sr-https", - 6444: "sge-qmaster", - 6445: "sge-execd", - 6446: "mysql-proxy", - 6455: "skip-cert-recv", - 6456: "skip-cert-send", - 6464: "ieee11073-20701", - 6471: "lvision-lm", - 6480: "sun-sr-http", - 6481: "servicetags", - 6482: "ldoms-mgmt", - 6483: "SunVTS-RMI", - 6484: "sun-sr-jms", - 6485: "sun-sr-iiop", - 6486: "sun-sr-iiops", - 6487: "sun-sr-iiop-aut", - 6488: "sun-sr-jmx", - 6489: "sun-sr-admin", - 6500: "boks", - 6501: "boks-servc", - 6502: "boks-servm", - 6503: "boks-clntd", - 6505: "badm-priv", - 6506: "badm-pub", - 6507: "bdir-priv", - 6508: "bdir-pub", - 6509: "mgcs-mfp-port", - 6510: "mcer-port", - 6513: "netconf-tls", - 6514: "syslog-tls", - 6515: "elipse-rec", - 6543: "lds-distrib", - 6544: "lds-dump", - 6547: "apc-6547", - 6548: "apc-6548", - 6549: "apc-6549", - 6550: "fg-sysupdate", - 6551: "sum", - 6558: "xdsxdm", - 6566: "sane-port", - 6568: "canit-store", - 6579: "affiliate", - 6580: "parsec-master", - 6581: "parsec-peer", - 6582: "parsec-game", - 6583: "joaJewelSuite", - 6600: "mshvlm", - 6601: "mstmg-sstp", - 6602: "wsscomfrmwk", - 6619: "odette-ftps", - 6620: "kftp-data", - 6621: "kftp", - 6622: "mcftp", - 6623: "ktelnet", - 6624: "datascaler-db", - 6625: "datascaler-ctl", - 6626: "wago-service", - 6627: "nexgen", - 6628: "afesc-mc", - 6629: "nexgen-aux", - 6632: "mxodbc-connect", - 6640: "ovsdb", - 6653: "openflow", - 6655: "pcs-sf-ui-man", - 6656: "emgmsg", - 6670: "vocaltec-gold", - 6671: "p4p-portal", - 6672: "vision-server", - 6673: "vision-elmd", - 6678: "vfbp", - 6679: "osaut", - 6687: "clever-ctrace", - 6688: "clever-tcpip", - 6689: "tsa", - 6690: "cleverdetect", - 6697: "ircs-u", - 6701: "kti-icad-srvr", - 6702: "e-design-net", - 6703: "e-design-web", - 6714: "ibprotocol", - 6715: "fibotrader-com", - 6716: "princity-agent", - 6767: "bmc-perf-agent", - 6768: "bmc-perf-mgrd", - 6769: "adi-gxp-srvprt", - 6770: "plysrv-http", - 6771: "plysrv-https", - 6777: "ntz-tracker", - 6778: "ntz-p2p-storage", - 6785: "dgpf-exchg", - 6786: "smc-jmx", - 6787: "smc-admin", - 6788: "smc-http", - 6789: "radg", - 6790: "hnmp", - 6791: "hnm", - 6801: "acnet", - 6817: "pentbox-sim", - 6831: "ambit-lm", - 6841: "netmo-default", - 6842: "netmo-http", - 6850: "iccrushmore", - 6868: "acctopus-cc", - 6888: "muse", - 6900: "rtimeviewer", - 6901: "jetstream", - 6935: "ethoscan", - 6936: "xsmsvc", - 6946: "bioserver", - 6951: "otlp", - 6961: "jmact3", - 6962: "jmevt2", - 6963: "swismgr1", - 6964: "swismgr2", - 6965: "swistrap", - 6966: "swispol", - 6969: "acmsoda", - 6970: "conductor", - 6997: "MobilitySrv", - 6998: "iatp-highpri", - 6999: "iatp-normalpri", - 7000: "afs3-fileserver", - 7001: "afs3-callback", - 7002: "afs3-prserver", - 7003: "afs3-vlserver", - 7004: "afs3-kaserver", - 7005: "afs3-volser", - 7006: "afs3-errors", - 7007: "afs3-bos", - 7008: "afs3-update", - 7009: "afs3-rmtsys", - 7010: "ups-onlinet", - 7011: "talon-disc", - 7012: "talon-engine", - 7013: "microtalon-dis", - 7014: "microtalon-com", - 7015: "talon-webserver", - 7016: "spg", - 7017: "grasp", - 7018: "fisa-svc", - 7019: "doceri-ctl", - 7020: "dpserve", - 7021: "dpserveadmin", - 7022: "ctdp", - 7023: "ct2nmcs", - 7024: "vmsvc", - 7025: "vmsvc-2", - 7030: "op-probe", - 7031: "iposplanet", - 7070: "arcp", - 7071: "iwg1", - 7073: "martalk", - 7080: "empowerid", - 7099: "lazy-ptop", - 7100: "font-service", - 7101: "elcn", - 7117: "rothaga", - 7121: "virprot-lm", - 7128: "scenidm", - 7129: "scenccs", - 7161: "cabsm-comm", - 7162: "caistoragemgr", - 7163: "cacsambroker", - 7164: "fsr", - 7165: "doc-server", - 7166: "aruba-server", - 7167: "casrmagent", - 7168: "cnckadserver", - 7169: "ccag-pib", - 7170: "nsrp", - 7171: "drm-production", - 7172: "metalbend", - 7173: "zsecure", - 7174: "clutild", - 7200: "fodms", - 7201: "dlip", - 7202: "pon-ictp", - 7215: "PS-Server", - 7216: "PS-Capture-Pro", - 7227: "ramp", - 7228: "citrixupp", - 7229: "citrixuppg", - 7236: "display", - 7237: "pads", - 7244: "frc-hicp", - 7262: "cnap", - 7272: "watchme-7272", - 7273: "oma-rlp", - 7274: "oma-rlp-s", - 7275: "oma-ulp", - 7276: "oma-ilp", - 7277: "oma-ilp-s", - 7278: "oma-dcdocbs", - 7279: "ctxlic", - 7280: "itactionserver1", - 7281: "itactionserver2", - 7282: "mzca-action", - 7283: "genstat", - 7365: "lcm-server", - 7391: "mindfilesys", - 7392: "mrssrendezvous", - 7393: "nfoldman", - 7394: "fse", - 7395: "winqedit", - 7397: "hexarc", - 7400: "rtps-discovery", - 7401: "rtps-dd-ut", - 7402: "rtps-dd-mt", - 7410: "ionixnetmon", - 7411: "daqstream", - 7421: "mtportmon", - 7426: "pmdmgr", - 7427: "oveadmgr", - 7428: "ovladmgr", - 7429: "opi-sock", - 7430: "xmpv7", - 7431: "pmd", - 7437: "faximum", - 7443: "oracleas-https", - 7471: "sttunnel", - 7473: "rise", - 7474: "neo4j", - 7478: "openit", - 7491: "telops-lmd", - 7500: "silhouette", - 7501: "ovbus", - 7508: "adcp", - 7509: "acplt", - 7510: "ovhpas", - 7511: "pafec-lm", - 7542: "saratoga", - 7543: "atul", - 7544: "nta-ds", - 7545: "nta-us", - 7546: "cfs", - 7547: "cwmp", - 7548: "tidp", - 7549: "nls-tl", - 7551: "controlone-con", - 7560: "sncp", - 7563: "cfw", - 7566: "vsi-omega", - 7569: "dell-eql-asm", - 7570: "aries-kfinder", - 7574: "coherence", - 7588: "sun-lm", - 7606: "mipi-debug", - 7624: "indi", - 7626: "simco", - 7627: "soap-http", - 7628: "zen-pawn", - 7629: "xdas", - 7630: "hawk", - 7631: "tesla-sys-msg", - 7633: "pmdfmgt", - 7648: "cuseeme", - 7672: "imqstomp", - 7673: "imqstomps", - 7674: "imqtunnels", - 7675: "imqtunnel", - 7676: "imqbrokerd", - 7677: "sun-user-https", - 7680: "pando-pub", - 7683: "dmt", - 7687: "bolt", - 7689: "collaber", - 7697: "klio", - 7700: "em7-secom", - 7707: "sync-em7", - 7708: "scinet", - 7720: "medimageportal", - 7724: "nsdeepfreezectl", - 7725: "nitrogen", - 7726: "freezexservice", - 7727: "trident-data", - 7728: "osvr", - 7734: "smip", - 7738: "aiagent", - 7741: "scriptview", - 7742: "msss", - 7743: "sstp-1", - 7744: "raqmon-pdu", - 7747: "prgp", - 7775: "inetfs", - 7777: "cbt", - 7778: "interwise", - 7779: "vstat", - 7781: "accu-lmgr", - 7786: "minivend", - 7787: "popup-reminders", - 7789: "office-tools", - 7794: "q3ade", - 7797: "pnet-conn", - 7798: "pnet-enc", - 7799: "altbsdp", - 7800: "asr", - 7801: "ssp-client", - 7810: "rbt-wanopt", - 7845: "apc-7845", - 7846: "apc-7846", - 7847: "csoauth", - 7869: "mobileanalyzer", - 7870: "rbt-smc", - 7871: "mdm", - 7878: "owms", - 7880: "pss", - 7887: "ubroker", - 7900: "mevent", - 7901: "tnos-sp", - 7902: "tnos-dp", - 7903: "tnos-dps", - 7913: "qo-secure", - 7932: "t2-drm", - 7933: "t2-brm", - 7962: "generalsync", - 7967: "supercell", - 7979: "micromuse-ncps", - 7980: "quest-vista", - 7981: "sossd-collect", - 7982: "sossd-agent", - 7997: "pushns", - 7999: "irdmi2", - 8000: "irdmi", - 8001: "vcom-tunnel", - 8002: "teradataordbms", - 8003: "mcreport", - 8005: "mxi", - 8006: "wpl-analytics", - 8007: "warppipe", - 8008: "http-alt", - 8019: "qbdb", - 8020: "intu-ec-svcdisc", - 8021: "intu-ec-client", - 8022: "oa-system", - 8025: "ca-audit-da", - 8026: "ca-audit-ds", - 8032: "pro-ed", - 8033: "mindprint", - 8034: "vantronix-mgmt", - 8040: "ampify", - 8041: "enguity-xccetp", - 8042: "fs-agent", - 8043: "fs-server", - 8044: "fs-mgmt", - 8051: "rocrail", - 8052: "senomix01", - 8053: "senomix02", - 8054: "senomix03", - 8055: "senomix04", - 8056: "senomix05", - 8057: "senomix06", - 8058: "senomix07", - 8059: "senomix08", - 8066: "toad-bi-appsrvr", - 8067: "infi-async", - 8070: "ucs-isc", - 8074: "gadugadu", - 8077: "mles", - 8080: "http-alt", - 8081: "sunproxyadmin", - 8082: "us-cli", - 8083: "us-srv", - 8086: "d-s-n", - 8087: "simplifymedia", - 8088: "radan-http", - 8090: "opsmessaging", - 8091: "jamlink", - 8097: "sac", - 8100: "xprint-server", - 8101: "ldoms-migr", - 8102: "kz-migr", - 8115: "mtl8000-matrix", - 8116: "cp-cluster", - 8117: "purityrpc", - 8118: "privoxy", - 8121: "apollo-data", - 8122: "apollo-admin", - 8128: "paycash-online", - 8129: "paycash-wbp", - 8130: "indigo-vrmi", - 8131: "indigo-vbcp", - 8132: "dbabble", - 8140: "puppet", - 8148: "isdd", - 8153: "quantastor", - 8160: "patrol", - 8161: "patrol-snmp", - 8162: "lpar2rrd", - 8181: "intermapper", - 8182: "vmware-fdm", - 8183: "proremote", - 8184: "itach", - 8190: "gcp-rphy", - 8191: "limnerpressure", - 8192: "spytechphone", - 8194: "blp1", - 8195: "blp2", - 8199: "vvr-data", - 8200: "trivnet1", - 8201: "trivnet2", - 8204: "lm-perfworks", - 8205: "lm-instmgr", - 8206: "lm-dta", - 8207: "lm-sserver", - 8208: "lm-webwatcher", - 8230: "rexecj", - 8243: "synapse-nhttps", - 8270: "robot-remote", - 8276: "pando-sec", - 8280: "synapse-nhttp", - 8282: "libelle", - 8292: "blp3", - 8293: "hiperscan-id", - 8294: "blp4", - 8300: "tmi", - 8301: "amberon", - 8313: "hub-open-net", - 8320: "tnp-discover", - 8321: "tnp", - 8322: "garmin-marine", - 8351: "server-find", - 8376: "cruise-enum", - 8377: "cruise-swroute", - 8378: "cruise-config", - 8379: "cruise-diags", - 8380: "cruise-update", - 8383: "m2mservices", - 8400: "cvd", - 8401: "sabarsd", - 8402: "abarsd", - 8403: "admind", - 8404: "svcloud", - 8405: "svbackup", - 8415: "dlpx-sp", - 8416: "espeech", - 8417: "espeech-rtp", - 8423: "aritts", - 8442: "cybro-a-bus", - 8443: "pcsync-https", - 8444: "pcsync-http", - 8445: "copy", - 8450: "npmp", - 8457: "nexentamv", - 8470: "cisco-avp", - 8471: "pim-port", - 8472: "otv", - 8473: "vp2p", - 8474: "noteshare", - 8500: "fmtp", - 8501: "cmtp-mgt", - 8502: "ftnmtp", - 8554: "rtsp-alt", - 8555: "d-fence", - 8567: "dof-tunnel", - 8600: "asterix", - 8610: "canon-mfnp", - 8611: "canon-bjnp1", - 8612: "canon-bjnp2", - 8613: "canon-bjnp3", - 8614: "canon-bjnp4", - 8615: "imink", - 8665: "monetra", - 8666: "monetra-admin", - 8675: "msi-cps-rm", - 8686: "sun-as-jmxrmi", - 8688: "openremote-ctrl", - 8699: "vnyx", - 8711: "nvc", - 8733: "ibus", - 8750: "dey-keyneg", - 8763: "mc-appserver", - 8764: "openqueue", - 8765: "ultraseek-http", - 8766: "amcs", - 8770: "dpap", - 8778: "uec", - 8786: "msgclnt", - 8787: "msgsrvr", - 8793: "acd-pm", - 8800: "sunwebadmin", - 8804: "truecm", - 8873: "dxspider", - 8880: "cddbp-alt", - 8881: "galaxy4d", - 8883: "secure-mqtt", - 8888: "ddi-tcp-1", - 8889: "ddi-tcp-2", - 8890: "ddi-tcp-3", - 8891: "ddi-tcp-4", - 8892: "ddi-tcp-5", - 8893: "ddi-tcp-6", - 8894: "ddi-tcp-7", - 8899: "ospf-lite", - 8900: "jmb-cds1", - 8901: "jmb-cds2", - 8910: "manyone-http", - 8911: "manyone-xml", - 8912: "wcbackup", - 8913: "dragonfly", - 8937: "twds", - 8953: "ub-dns-control", - 8954: "cumulus-admin", - 8980: "nod-provider", - 8989: "sunwebadmins", - 8990: "http-wmap", - 8991: "https-wmap", - 8997: "oracle-ms-ens", - 8998: "canto-roboflow", - 8999: "bctp", - 9000: "cslistener", - 9001: "etlservicemgr", - 9002: "dynamid", - 9005: "golem", - 9008: "ogs-server", - 9009: "pichat", - 9010: "sdr", - 9020: "tambora", - 9021: "panagolin-ident", - 9022: "paragent", - 9023: "swa-1", - 9024: "swa-2", - 9025: "swa-3", - 9026: "swa-4", - 9050: "versiera", - 9051: "fio-cmgmt", - 9060: "CardWeb-IO", - 9080: "glrpc", - 9083: "emc-pp-mgmtsvc", - 9084: "aurora", - 9085: "ibm-rsyscon", - 9086: "net2display", - 9087: "classic", - 9088: "sqlexec", - 9089: "sqlexec-ssl", - 9090: "websm", - 9091: "xmltec-xmlmail", - 9092: "XmlIpcRegSvc", - 9093: "copycat", - 9100: "hp-pdl-datastr", - 9101: "bacula-dir", - 9102: "bacula-fd", - 9103: "bacula-sd", - 9104: "peerwire", - 9105: "xadmin", - 9106: "astergate", - 9107: "astergatefax", - 9119: "mxit", - 9122: "grcmp", - 9123: "grcp", - 9131: "dddp", - 9160: "apani1", - 9161: "apani2", - 9162: "apani3", - 9163: "apani4", - 9164: "apani5", - 9191: "sun-as-jpda", - 9200: "wap-wsp", - 9201: "wap-wsp-wtp", - 9202: "wap-wsp-s", - 9203: "wap-wsp-wtp-s", - 9204: "wap-vcard", - 9205: "wap-vcal", - 9206: "wap-vcard-s", - 9207: "wap-vcal-s", - 9208: "rjcdb-vcards", - 9209: "almobile-system", - 9210: "oma-mlp", - 9211: "oma-mlp-s", - 9212: "serverviewdbms", - 9213: "serverstart", - 9214: "ipdcesgbs", - 9215: "insis", - 9216: "acme", - 9217: "fsc-port", - 9222: "teamcoherence", - 9255: "mon", - 9278: "pegasus", - 9279: "pegasus-ctl", - 9280: "pgps", - 9281: "swtp-port1", - 9282: "swtp-port2", - 9283: "callwaveiam", - 9284: "visd", - 9285: "n2h2server", - 9287: "cumulus", - 9292: "armtechdaemon", - 9293: "storview", - 9294: "armcenterhttp", - 9295: "armcenterhttps", - 9300: "vrace", - 9306: "sphinxql", - 9312: "sphinxapi", - 9318: "secure-ts", - 9321: "guibase", - 9343: "mpidcmgr", - 9344: "mphlpdmc", - 9345: "rancher", - 9346: "ctechlicensing", - 9374: "fjdmimgr", - 9380: "boxp", - 9387: "d2dconfig", - 9388: "d2ddatatrans", - 9389: "adws", - 9390: "otp", - 9396: "fjinvmgr", - 9397: "mpidcagt", - 9400: "sec-t4net-srv", - 9401: "sec-t4net-clt", - 9402: "sec-pc2fax-srv", - 9418: "git", - 9443: "tungsten-https", - 9444: "wso2esb-console", - 9445: "mindarray-ca", - 9450: "sntlkeyssrvr", - 9500: "ismserver", - 9535: "mngsuite", - 9536: "laes-bf", - 9555: "trispen-sra", - 9592: "ldgateway", - 9593: "cba8", - 9594: "msgsys", - 9595: "pds", - 9596: "mercury-disc", - 9597: "pd-admin", - 9598: "vscp", - 9599: "robix", - 9600: "micromuse-ncpw", - 9612: "streamcomm-ds", - 9614: "iadt-tls", - 9616: "erunbook-agent", - 9617: "erunbook-server", - 9618: "condor", - 9628: "odbcpathway", - 9629: "uniport", - 9630: "peoctlr", - 9631: "peocoll", - 9640: "pqsflows", - 9666: "zoomcp", - 9667: "xmms2", - 9668: "tec5-sdctp", - 9694: "client-wakeup", - 9695: "ccnx", - 9700: "board-roar", - 9747: "l5nas-parchan", - 9750: "board-voip", - 9753: "rasadv", - 9762: "tungsten-http", - 9800: "davsrc", - 9801: "sstp-2", - 9802: "davsrcs", - 9875: "sapv1", - 9876: "sd", - 9888: "cyborg-systems", - 9889: "gt-proxy", - 9898: "monkeycom", - 9900: "iua", - 9909: "domaintime", - 9911: "sype-transport", - 9925: "xybrid-cloud", - 9950: "apc-9950", - 9951: "apc-9951", - 9952: "apc-9952", - 9953: "acis", - 9954: "hinp", - 9955: "alljoyn-stm", - 9966: "odnsp", - 9978: "xybrid-rt", - 9979: "visweather", - 9981: "pumpkindb", - 9987: "dsm-scm-target", - 9988: "nsesrvr", - 9990: "osm-appsrvr", - 9991: "osm-oev", - 9992: "palace-1", - 9993: "palace-2", - 9994: "palace-3", - 9995: "palace-4", - 9996: "palace-5", - 9997: "palace-6", - 9998: "distinct32", - 9999: "distinct", - 10000: "ndmp", - 10001: "scp-config", - 10002: "documentum", - 10003: "documentum-s", - 10004: "emcrmirccd", - 10005: "emcrmird", - 10006: "netapp-sync", - 10007: "mvs-capacity", - 10008: "octopus", - 10009: "swdtp-sv", - 10010: "rxapi", - 10020: "abb-hw", - 10050: "zabbix-agent", - 10051: "zabbix-trapper", - 10055: "qptlmd", - 10080: "amanda", - 10081: "famdc", - 10100: "itap-ddtp", - 10101: "ezmeeting-2", - 10102: "ezproxy-2", - 10103: "ezrelay", - 10104: "swdtp", - 10107: "bctp-server", - 10110: "nmea-0183", - 10113: "netiq-endpoint", - 10114: "netiq-qcheck", - 10115: "netiq-endpt", - 10116: "netiq-voipa", - 10117: "iqrm", - 10125: "cimple", - 10128: "bmc-perf-sd", - 10129: "bmc-gms", - 10160: "qb-db-server", - 10161: "snmptls", - 10162: "snmptls-trap", - 10200: "trisoap", - 10201: "rsms", - 10252: "apollo-relay", - 10260: "axis-wimp-port", - 10261: "tile-ml", - 10288: "blocks", - 10321: "cosir", - 10540: "MOS-lower", - 10541: "MOS-upper", - 10542: "MOS-aux", - 10543: "MOS-soap", - 10544: "MOS-soap-opt", - 10548: "serverdocs", - 10631: "printopia", - 10800: "gap", - 10805: "lpdg", - 10809: "nbd", - 10860: "helix", - 10880: "bveapi", - 10933: "octopustentacle", - 10990: "rmiaux", - 11000: "irisa", - 11001: "metasys", - 11095: "weave", - 11103: "origo-sync", - 11104: "netapp-icmgmt", - 11105: "netapp-icdata", - 11106: "sgi-lk", - 11109: "sgi-dmfmgr", - 11110: "sgi-soap", - 11111: "vce", - 11112: "dicom", - 11161: "suncacao-snmp", - 11162: "suncacao-jmxmp", - 11163: "suncacao-rmi", - 11164: "suncacao-csa", - 11165: "suncacao-websvc", - 11172: "oemcacao-jmxmp", - 11173: "t5-straton", - 11174: "oemcacao-rmi", - 11175: "oemcacao-websvc", - 11201: "smsqp", - 11202: "dcsl-backup", - 11208: "wifree", - 11211: "memcache", - 11319: "imip", - 11320: "imip-channels", - 11321: "arena-server", - 11367: "atm-uhas", - 11371: "hkp", - 11489: "asgcypresstcps", - 11600: "tempest-port", - 11623: "emc-xsw-dconfig", - 11720: "h323callsigalt", - 11723: "emc-xsw-dcache", - 11751: "intrepid-ssl", - 11796: "lanschool", - 11876: "xoraya", - 11967: "sysinfo-sp", - 12000: "entextxid", - 12001: "entextnetwk", - 12002: "entexthigh", - 12003: "entextmed", - 12004: "entextlow", - 12005: "dbisamserver1", - 12006: "dbisamserver2", - 12007: "accuracer", - 12008: "accuracer-dbms", - 12010: "edbsrvr", - 12012: "vipera", - 12013: "vipera-ssl", - 12109: "rets-ssl", - 12121: "nupaper-ss", - 12168: "cawas", - 12172: "hivep", - 12300: "linogridengine", - 12302: "rads", - 12321: "warehouse-sss", - 12322: "warehouse", - 12345: "italk", - 12753: "tsaf", - 12865: "netperf", - 13160: "i-zipqd", - 13216: "bcslogc", - 13217: "rs-pias", - 13218: "emc-vcas-tcp", - 13223: "powwow-client", - 13224: "powwow-server", - 13400: "doip-data", - 13720: "bprd", - 13721: "bpdbm", - 13722: "bpjava-msvc", - 13724: "vnetd", - 13782: "bpcd", - 13783: "vopied", - 13785: "nbdb", - 13786: "nomdb", - 13818: "dsmcc-config", - 13819: "dsmcc-session", - 13820: "dsmcc-passthru", - 13821: "dsmcc-download", - 13822: "dsmcc-ccp", - 13823: "bmdss", - 13894: "ucontrol", - 13929: "dta-systems", - 13930: "medevolve", - 14000: "scotty-ft", - 14001: "sua", - 14033: "sage-best-com1", - 14034: "sage-best-com2", - 14141: "vcs-app", - 14142: "icpp", - 14143: "icpps", - 14145: "gcm-app", - 14149: "vrts-tdd", - 14150: "vcscmd", - 14154: "vad", - 14250: "cps", - 14414: "ca-web-update", - 14500: "xpra", - 14936: "hde-lcesrvr-1", - 14937: "hde-lcesrvr-2", - 15000: "hydap", - 15002: "onep-tls", - 15345: "xpilot", - 15363: "3link", - 15555: "cisco-snat", - 15660: "bex-xr", - 15740: "ptp", - 15999: "programmar", - 16000: "fmsas", - 16001: "fmsascon", - 16002: "gsms", - 16020: "jwpc", - 16021: "jwpc-bin", - 16161: "sun-sea-port", - 16162: "solaris-audit", - 16309: "etb4j", - 16310: "pduncs", - 16311: "pdefmns", - 16360: "netserialext1", - 16361: "netserialext2", - 16367: "netserialext3", - 16368: "netserialext4", - 16384: "connected", - 16385: "rdgs", - 16619: "xoms", - 16665: "axon-tunnel", - 16789: "cadsisvr", - 16900: "newbay-snc-mc", - 16950: "sgcip", - 16991: "intel-rci-mp", - 16992: "amt-soap-http", - 16993: "amt-soap-https", - 16994: "amt-redir-tcp", - 16995: "amt-redir-tls", - 17007: "isode-dua", - 17184: "vestasdlp", - 17185: "soundsvirtual", - 17219: "chipper", - 17220: "avtp", - 17221: "avdecc", - 17223: "isa100-gci", - 17225: "trdp-md", - 17234: "integrius-stp", - 17235: "ssh-mgmt", - 17500: "db-lsp", - 17555: "ailith", - 17729: "ea", - 17754: "zep", - 17755: "zigbee-ip", - 17756: "zigbee-ips", - 17777: "sw-orion", - 18000: "biimenu", - 18104: "radpdf", - 18136: "racf", - 18181: "opsec-cvp", - 18182: "opsec-ufp", - 18183: "opsec-sam", - 18184: "opsec-lea", - 18185: "opsec-omi", - 18186: "ohsc", - 18187: "opsec-ela", - 18241: "checkpoint-rtm", - 18242: "iclid", - 18243: "clusterxl", - 18262: "gv-pf", - 18463: "ac-cluster", - 18634: "rds-ib", - 18635: "rds-ip", - 18668: "vdmmesh", - 18769: "ique", - 18881: "infotos", - 18888: "apc-necmp", - 19000: "igrid", - 19007: "scintilla", - 19020: "j-link", - 19191: "opsec-uaa", - 19194: "ua-secureagent", - 19220: "cora", - 19283: "keysrvr", - 19315: "keyshadow", - 19398: "mtrgtrans", - 19410: "hp-sco", - 19411: "hp-sca", - 19412: "hp-sessmon", - 19539: "fxuptp", - 19540: "sxuptp", - 19541: "jcp", - 19998: "iec-104-sec", - 19999: "dnp-sec", - 20000: "dnp", - 20001: "microsan", - 20002: "commtact-http", - 20003: "commtact-https", - 20005: "openwebnet", - 20013: "ss-idi", - 20014: "opendeploy", - 20034: "nburn-id", - 20046: "tmophl7mts", - 20048: "mountd", - 20049: "nfsrdma", - 20057: "avesterra", - 20167: "tolfab", - 20202: "ipdtp-port", - 20222: "ipulse-ics", - 20480: "emwavemsg", - 20670: "track", - 20999: "athand-mmp", - 21000: "irtrans", - 21010: "notezilla-lan", - 21221: "aigairserver", - 21553: "rdm-tfs", - 21554: "dfserver", - 21590: "vofr-gateway", - 21800: "tvpm", - 21845: "webphone", - 21846: "netspeak-is", - 21847: "netspeak-cs", - 21848: "netspeak-acd", - 21849: "netspeak-cps", - 22000: "snapenetio", - 22001: "optocontrol", - 22002: "optohost002", - 22003: "optohost003", - 22004: "optohost004", - 22005: "optohost004", - 22125: "dcap", - 22128: "gsidcap", - 22222: "easyengine", - 22273: "wnn6", - 22305: "cis", - 22335: "shrewd-control", - 22343: "cis-secure", - 22347: "wibukey", - 22350: "codemeter", - 22351: "codemeter-cmwan", - 22537: "caldsoft-backup", - 22555: "vocaltec-wconf", - 22763: "talikaserver", - 22800: "aws-brf", - 22951: "brf-gw", - 23000: "inovaport1", - 23001: "inovaport2", - 23002: "inovaport3", - 23003: "inovaport4", - 23004: "inovaport5", - 23005: "inovaport6", - 23053: "gntp", - 23294: "5afe-dir", - 23333: "elxmgmt", - 23400: "novar-dbase", - 23401: "novar-alarm", - 23402: "novar-global", - 23456: "aequus", - 23457: "aequus-alt", - 23546: "areaguard-neo", - 24000: "med-ltp", - 24001: "med-fsp-rx", - 24002: "med-fsp-tx", - 24003: "med-supp", - 24004: "med-ovw", - 24005: "med-ci", - 24006: "med-net-svc", - 24242: "filesphere", - 24249: "vista-4gl", - 24321: "ild", - 24386: "intel-rci", - 24465: "tonidods", - 24554: "binkp", - 24577: "bilobit", - 24666: "sdtvwcam", - 24676: "canditv", - 24677: "flashfiler", - 24678: "proactivate", - 24680: "tcc-http", - 24754: "cslg", - 24922: "find", - 25000: "icl-twobase1", - 25001: "icl-twobase2", - 25002: "icl-twobase3", - 25003: "icl-twobase4", - 25004: "icl-twobase5", - 25005: "icl-twobase6", - 25006: "icl-twobase7", - 25007: "icl-twobase8", - 25008: "icl-twobase9", - 25009: "icl-twobase10", - 25576: "sauterdongle", - 25604: "idtp", - 25793: "vocaltec-hos", - 25900: "tasp-net", - 25901: "niobserver", - 25902: "nilinkanalyst", - 25903: "niprobe", - 26000: "quake", - 26133: "scscp", - 26208: "wnn6-ds", - 26257: "cockroach", - 26260: "ezproxy", - 26261: "ezmeeting", - 26262: "k3software-svr", - 26263: "k3software-cli", - 26486: "exoline-tcp", - 26487: "exoconfig", - 26489: "exonet", - 27345: "imagepump", - 27442: "jesmsjc", - 27504: "kopek-httphead", - 27782: "ars-vista", - 27876: "astrolink", - 27999: "tw-auth-key", - 28000: "nxlmd", - 28001: "pqsp", - 28200: "voxelstorm", - 28240: "siemensgsm", - 28589: "bosswave", - 29167: "otmp", - 29999: "bingbang", - 30000: "ndmps", - 30001: "pago-services1", - 30002: "pago-services2", - 30003: "amicon-fpsu-ra", - 30100: "rwp", - 30260: "kingdomsonline", - 30400: "gs-realtime", - 30999: "ovobs", - 31016: "ka-sddp", - 31020: "autotrac-acp", - 31400: "pace-licensed", - 31416: "xqosd", - 31457: "tetrinet", - 31620: "lm-mon", - 31685: "dsx-monitor", - 31765: "gamesmith-port", - 31948: "iceedcp-tx", - 31949: "iceedcp-rx", - 32034: "iracinghelper", - 32249: "t1distproc60", - 32400: "plex", - 32483: "apm-link", - 32635: "sec-ntb-clnt", - 32636: "DMExpress", - 32767: "filenet-powsrm", - 32768: "filenet-tms", - 32769: "filenet-rpc", - 32770: "filenet-nch", - 32771: "filenet-rmi", - 32772: "filenet-pa", - 32773: "filenet-cm", - 32774: "filenet-re", - 32775: "filenet-pch", - 32776: "filenet-peior", - 32777: "filenet-obrok", - 32801: "mlsn", - 32811: "retp", - 32896: "idmgratm", - 33060: "mysqlx", - 33123: "aurora-balaena", - 33331: "diamondport", - 33333: "dgi-serv", - 33334: "speedtrace", - 33434: "traceroute", - 33656: "snip-slave", - 34249: "turbonote-2", - 34378: "p-net-local", - 34379: "p-net-remote", - 34567: "dhanalakshmi", - 34962: "profinet-rt", - 34963: "profinet-rtm", - 34964: "profinet-cm", - 34980: "ethercat", - 35000: "heathview", - 35001: "rt-viewer", - 35002: "rt-sound", - 35003: "rt-devicemapper", - 35004: "rt-classmanager", - 35005: "rt-labtracker", - 35006: "rt-helper", - 35100: "axio-disc", - 35354: "kitim", - 35355: "altova-lm", - 35356: "guttersnex", - 35357: "openstack-id", - 36001: "allpeers", - 36524: "febooti-aw", - 36602: "observium-agent", - 36700: "mapx", - 36865: "kastenxpipe", - 37475: "neckar", - 37483: "gdrive-sync", - 37601: "eftp", - 37654: "unisys-eportal", - 38000: "ivs-database", - 38001: "ivs-insertion", - 38002: "cresco-control", - 38201: "galaxy7-data", - 38202: "fairview", - 38203: "agpolicy", - 38800: "sruth", - 38865: "secrmmsafecopya", - 39681: "turbonote-1", - 40000: "safetynetp", - 40404: "sptx", - 40841: "cscp", - 40842: "csccredir", - 40843: "csccfirewall", - 41111: "fs-qos", - 41121: "tentacle", - 41230: "z-wave-s", - 41794: "crestron-cip", - 41795: "crestron-ctp", - 41796: "crestron-cips", - 41797: "crestron-ctps", - 42508: "candp", - 42509: "candrp", - 42510: "caerpc", - 43000: "recvr-rc", - 43188: "reachout", - 43189: "ndm-agent-port", - 43190: "ip-provision", - 43191: "noit-transport", - 43210: "shaperai", - 43439: "eq3-update", - 43440: "ew-mgmt", - 43441: "ciscocsdb", - 44123: "z-wave-tunnel", - 44321: "pmcd", - 44322: "pmcdproxy", - 44323: "pmwebapi", - 44444: "cognex-dataman", - 44553: "rbr-debug", - 44818: "EtherNet-IP-2", - 44900: "m3da", - 45000: "asmp", - 45001: "asmps", - 45002: "rs-status", - 45045: "synctest", - 45054: "invision-ag", - 45514: "cloudcheck", - 45678: "eba", - 45824: "dai-shell", - 45825: "qdb2service", - 45966: "ssr-servermgr", - 46336: "inedo", - 46998: "spremotetablet", - 46999: "mediabox", - 47000: "mbus", - 47001: "winrm", - 47557: "dbbrowse", - 47624: "directplaysrvr", - 47806: "ap", - 47808: "bacnet", - 48000: "nimcontroller", - 48001: "nimspooler", - 48002: "nimhub", - 48003: "nimgtw", - 48004: "nimbusdb", - 48005: "nimbusdbctrl", - 48049: "3gpp-cbsp", - 48050: "weandsf", - 48128: "isnetserv", - 48129: "blp5", - 48556: "com-bardac-dw", - 48619: "iqobject", - 48653: "robotraconteur", - 49000: "matahari", - 49001: "nusrp", -} -var udpPortNames = map[UDPPort]string{ - 1: "tcpmux", - 2: "compressnet", - 3: "compressnet", - 5: "rje", - 7: "echo", - 9: "discard", - 11: "systat", - 13: "daytime", - 17: "qotd", - 18: "msp", - 19: "chargen", - 20: "ftp-data", - 21: "ftp", - 22: "ssh", - 23: "telnet", - 25: "smtp", - 27: "nsw-fe", - 29: "msg-icp", - 31: "msg-auth", - 33: "dsp", - 37: "time", - 38: "rap", - 39: "rlp", - 41: "graphics", - 42: "name", - 43: "nicname", - 44: "mpm-flags", - 45: "mpm", - 46: "mpm-snd", - 48: "auditd", - 49: "tacacs", - 50: "re-mail-ck", - 52: "xns-time", - 53: "domain", - 54: "xns-ch", - 55: "isi-gl", - 56: "xns-auth", - 58: "xns-mail", - 62: "acas", - 63: "whoispp", - 64: "covia", - 65: "tacacs-ds", - 66: "sql-net", - 67: "bootps", - 68: "bootpc", - 69: "tftp", - 70: "gopher", - 71: "netrjs-1", - 72: "netrjs-2", - 73: "netrjs-3", - 74: "netrjs-4", - 76: "deos", - 78: "vettcp", - 79: "finger", - 80: "http", - 82: "xfer", - 83: "mit-ml-dev", - 84: "ctf", - 85: "mit-ml-dev", - 86: "mfcobol", - 88: "kerberos", - 89: "su-mit-tg", - 90: "dnsix", - 91: "mit-dov", - 92: "npp", - 93: "dcp", - 94: "objcall", - 95: "supdup", - 96: "dixie", - 97: "swift-rvf", - 98: "tacnews", - 99: "metagram", - 101: "hostname", - 102: "iso-tsap", - 103: "gppitnp", - 104: "acr-nema", - 105: "cso", - 106: "3com-tsmux", - 107: "rtelnet", - 108: "snagas", - 109: "pop2", - 110: "pop3", - 111: "sunrpc", - 112: "mcidas", - 113: "auth", - 115: "sftp", - 116: "ansanotify", - 117: "uucp-path", - 118: "sqlserv", - 119: "nntp", - 120: "cfdptkt", - 121: "erpc", - 122: "smakynet", - 123: "ntp", - 124: "ansatrader", - 125: "locus-map", - 126: "nxedit", - 127: "locus-con", - 128: "gss-xlicen", - 129: "pwdgen", - 130: "cisco-fna", - 131: "cisco-tna", - 132: "cisco-sys", - 133: "statsrv", - 134: "ingres-net", - 135: "epmap", - 136: "profile", - 137: "netbios-ns", - 138: "netbios-dgm", - 139: "netbios-ssn", - 140: "emfis-data", - 141: "emfis-cntl", - 142: "bl-idm", - 143: "imap", - 144: "uma", - 145: "uaac", - 146: "iso-tp0", - 147: "iso-ip", - 148: "jargon", - 149: "aed-512", - 150: "sql-net", - 151: "hems", - 152: "bftp", - 153: "sgmp", - 154: "netsc-prod", - 155: "netsc-dev", - 156: "sqlsrv", - 157: "knet-cmp", - 158: "pcmail-srv", - 159: "nss-routing", - 160: "sgmp-traps", - 161: "snmp", - 162: "snmptrap", - 163: "cmip-man", - 164: "cmip-agent", - 165: "xns-courier", - 166: "s-net", - 167: "namp", - 168: "rsvd", - 169: "send", - 170: "print-srv", - 171: "multiplex", - 172: "cl-1", - 173: "xyplex-mux", - 174: "mailq", - 175: "vmnet", - 176: "genrad-mux", - 177: "xdmcp", - 178: "nextstep", - 179: "bgp", - 180: "ris", - 181: "unify", - 182: "audit", - 183: "ocbinder", - 184: "ocserver", - 185: "remote-kis", - 186: "kis", - 187: "aci", - 188: "mumps", - 189: "qft", - 190: "gacp", - 191: "prospero", - 192: "osu-nms", - 193: "srmp", - 194: "irc", - 195: "dn6-nlm-aud", - 196: "dn6-smm-red", - 197: "dls", - 198: "dls-mon", - 199: "smux", - 200: "src", - 201: "at-rtmp", - 202: "at-nbp", - 203: "at-3", - 204: "at-echo", - 205: "at-5", - 206: "at-zis", - 207: "at-7", - 208: "at-8", - 209: "qmtp", - 210: "z39-50", - 211: "914c-g", - 212: "anet", - 213: "ipx", - 214: "vmpwscs", - 215: "softpc", - 216: "CAIlic", - 217: "dbase", - 218: "mpp", - 219: "uarps", - 220: "imap3", - 221: "fln-spx", - 222: "rsh-spx", - 223: "cdc", - 224: "masqdialer", - 242: "direct", - 243: "sur-meas", - 244: "inbusiness", - 245: "link", - 246: "dsp3270", - 247: "subntbcst-tftp", - 248: "bhfhs", - 256: "rap", - 257: "set", - 259: "esro-gen", - 260: "openport", - 261: "nsiiops", - 262: "arcisdms", - 263: "hdap", - 264: "bgmp", - 265: "x-bone-ctl", - 266: "sst", - 267: "td-service", - 268: "td-replica", - 269: "manet", - 270: "gist", - 280: "http-mgmt", - 281: "personal-link", - 282: "cableport-ax", - 283: "rescap", - 284: "corerjd", - 286: "fxp", - 287: "k-block", - 308: "novastorbakcup", - 309: "entrusttime", - 310: "bhmds", - 311: "asip-webadmin", - 312: "vslmp", - 313: "magenta-logic", - 314: "opalis-robot", - 315: "dpsi", - 316: "decauth", - 317: "zannet", - 318: "pkix-timestamp", - 319: "ptp-event", - 320: "ptp-general", - 321: "pip", - 322: "rtsps", - 333: "texar", - 344: "pdap", - 345: "pawserv", - 346: "zserv", - 347: "fatserv", - 348: "csi-sgwp", - 349: "mftp", - 350: "matip-type-a", - 351: "matip-type-b", - 352: "dtag-ste-sb", - 353: "ndsauth", - 354: "bh611", - 355: "datex-asn", - 356: "cloanto-net-1", - 357: "bhevent", - 358: "shrinkwrap", - 359: "nsrmp", - 360: "scoi2odialog", - 361: "semantix", - 362: "srssend", - 363: "rsvp-tunnel", - 364: "aurora-cmgr", - 365: "dtk", - 366: "odmr", - 367: "mortgageware", - 368: "qbikgdp", - 369: "rpc2portmap", - 370: "codaauth2", - 371: "clearcase", - 372: "ulistproc", - 373: "legent-1", - 374: "legent-2", - 375: "hassle", - 376: "nip", - 377: "tnETOS", - 378: "dsETOS", - 379: "is99c", - 380: "is99s", - 381: "hp-collector", - 382: "hp-managed-node", - 383: "hp-alarm-mgr", - 384: "arns", - 385: "ibm-app", - 386: "asa", - 387: "aurp", - 388: "unidata-ldm", - 389: "ldap", - 390: "uis", - 391: "synotics-relay", - 392: "synotics-broker", - 393: "meta5", - 394: "embl-ndt", - 395: "netcp", - 396: "netware-ip", - 397: "mptn", - 398: "kryptolan", - 399: "iso-tsap-c2", - 400: "osb-sd", - 401: "ups", - 402: "genie", - 403: "decap", - 404: "nced", - 405: "ncld", - 406: "imsp", - 407: "timbuktu", - 408: "prm-sm", - 409: "prm-nm", - 410: "decladebug", - 411: "rmt", - 412: "synoptics-trap", - 413: "smsp", - 414: "infoseek", - 415: "bnet", - 416: "silverplatter", - 417: "onmux", - 418: "hyper-g", - 419: "ariel1", - 420: "smpte", - 421: "ariel2", - 422: "ariel3", - 423: "opc-job-start", - 424: "opc-job-track", - 425: "icad-el", - 426: "smartsdp", - 427: "svrloc", - 428: "ocs-cmu", - 429: "ocs-amu", - 430: "utmpsd", - 431: "utmpcd", - 432: "iasd", - 433: "nnsp", - 434: "mobileip-agent", - 435: "mobilip-mn", - 436: "dna-cml", - 437: "comscm", - 438: "dsfgw", - 439: "dasp", - 440: "sgcp", - 441: "decvms-sysmgt", - 442: "cvc-hostd", - 443: "https", - 444: "snpp", - 445: "microsoft-ds", - 446: "ddm-rdb", - 447: "ddm-dfm", - 448: "ddm-ssl", - 449: "as-servermap", - 450: "tserver", - 451: "sfs-smp-net", - 452: "sfs-config", - 453: "creativeserver", - 454: "contentserver", - 455: "creativepartnr", - 456: "macon-udp", - 457: "scohelp", - 458: "appleqtc", - 459: "ampr-rcmd", - 460: "skronk", - 461: "datasurfsrv", - 462: "datasurfsrvsec", - 463: "alpes", - 464: "kpasswd", - 465: "igmpv3lite", - 466: "digital-vrc", - 467: "mylex-mapd", - 468: "photuris", - 469: "rcp", - 470: "scx-proxy", - 471: "mondex", - 472: "ljk-login", - 473: "hybrid-pop", - 474: "tn-tl-w2", - 475: "tcpnethaspsrv", - 476: "tn-tl-fd1", - 477: "ss7ns", - 478: "spsc", - 479: "iafserver", - 480: "iafdbase", - 481: "ph", - 482: "bgs-nsi", - 483: "ulpnet", - 484: "integra-sme", - 485: "powerburst", - 486: "avian", - 487: "saft", - 488: "gss-http", - 489: "nest-protocol", - 490: "micom-pfs", - 491: "go-login", - 492: "ticf-1", - 493: "ticf-2", - 494: "pov-ray", - 495: "intecourier", - 496: "pim-rp-disc", - 497: "retrospect", - 498: "siam", - 499: "iso-ill", - 500: "isakmp", - 501: "stmf", - 502: "mbap", - 503: "intrinsa", - 504: "citadel", - 505: "mailbox-lm", - 506: "ohimsrv", - 507: "crs", - 508: "xvttp", - 509: "snare", - 510: "fcp", - 511: "passgo", - 512: "comsat", - 513: "who", - 514: "syslog", - 515: "printer", - 516: "videotex", - 517: "talk", - 518: "ntalk", - 519: "utime", - 520: "router", - 521: "ripng", - 522: "ulp", - 523: "ibm-db2", - 524: "ncp", - 525: "timed", - 526: "tempo", - 527: "stx", - 528: "custix", - 529: "irc-serv", - 530: "courier", - 531: "conference", - 532: "netnews", - 533: "netwall", - 534: "windream", - 535: "iiop", - 536: "opalis-rdv", - 537: "nmsp", - 538: "gdomap", - 539: "apertus-ldp", - 540: "uucp", - 541: "uucp-rlogin", - 542: "commerce", - 543: "klogin", - 544: "kshell", - 545: "appleqtcsrvr", - 546: "dhcpv6-client", - 547: "dhcpv6-server", - 548: "afpovertcp", - 549: "idfp", - 550: "new-rwho", - 551: "cybercash", - 552: "devshr-nts", - 553: "pirp", - 554: "rtsp", - 555: "dsf", - 556: "remotefs", - 557: "openvms-sysipc", - 558: "sdnskmp", - 559: "teedtap", - 560: "rmonitor", - 561: "monitor", - 562: "chshell", - 563: "nntps", - 564: "9pfs", - 565: "whoami", - 566: "streettalk", - 567: "banyan-rpc", - 568: "ms-shuttle", - 569: "ms-rome", - 570: "meter", - 571: "meter", - 572: "sonar", - 573: "banyan-vip", - 574: "ftp-agent", - 575: "vemmi", - 576: "ipcd", - 577: "vnas", - 578: "ipdd", - 579: "decbsrv", - 580: "sntp-heartbeat", - 581: "bdp", - 582: "scc-security", - 583: "philips-vc", - 584: "keyserver", - 586: "password-chg", - 587: "submission", - 588: "cal", - 589: "eyelink", - 590: "tns-cml", - 591: "http-alt", - 592: "eudora-set", - 593: "http-rpc-epmap", - 594: "tpip", - 595: "cab-protocol", - 596: "smsd", - 597: "ptcnameservice", - 598: "sco-websrvrmg3", - 599: "acp", - 600: "ipcserver", - 601: "syslog-conn", - 602: "xmlrpc-beep", - 603: "idxp", - 604: "tunnel", - 605: "soap-beep", - 606: "urm", - 607: "nqs", - 608: "sift-uft", - 609: "npmp-trap", - 610: "npmp-local", - 611: "npmp-gui", - 612: "hmmp-ind", - 613: "hmmp-op", - 614: "sshell", - 615: "sco-inetmgr", - 616: "sco-sysmgr", - 617: "sco-dtmgr", - 618: "dei-icda", - 619: "compaq-evm", - 620: "sco-websrvrmgr", - 621: "escp-ip", - 622: "collaborator", - 623: "asf-rmcp", - 624: "cryptoadmin", - 625: "dec-dlm", - 626: "asia", - 627: "passgo-tivoli", - 628: "qmqp", - 629: "3com-amp3", - 630: "rda", - 631: "ipp", - 632: "bmpp", - 633: "servstat", - 634: "ginad", - 635: "rlzdbase", - 636: "ldaps", - 637: "lanserver", - 638: "mcns-sec", - 639: "msdp", - 640: "entrust-sps", - 641: "repcmd", - 642: "esro-emsdp", - 643: "sanity", - 644: "dwr", - 645: "pssc", - 646: "ldp", - 647: "dhcp-failover", - 648: "rrp", - 649: "cadview-3d", - 650: "obex", - 651: "ieee-mms", - 652: "hello-port", - 653: "repscmd", - 654: "aodv", - 655: "tinc", - 656: "spmp", - 657: "rmc", - 658: "tenfold", - 660: "mac-srvr-admin", - 661: "hap", - 662: "pftp", - 663: "purenoise", - 664: "asf-secure-rmcp", - 665: "sun-dr", - 666: "mdqs", - 667: "disclose", - 668: "mecomm", - 669: "meregister", - 670: "vacdsm-sws", - 671: "vacdsm-app", - 672: "vpps-qua", - 673: "cimplex", - 674: "acap", - 675: "dctp", - 676: "vpps-via", - 677: "vpp", - 678: "ggf-ncp", - 679: "mrm", - 680: "entrust-aaas", - 681: "entrust-aams", - 682: "xfr", - 683: "corba-iiop", - 684: "corba-iiop-ssl", - 685: "mdc-portmapper", - 686: "hcp-wismar", - 687: "asipregistry", - 688: "realm-rusd", - 689: "nmap", - 690: "vatp", - 691: "msexch-routing", - 692: "hyperwave-isp", - 693: "connendp", - 694: "ha-cluster", - 695: "ieee-mms-ssl", - 696: "rushd", - 697: "uuidgen", - 698: "olsr", - 699: "accessnetwork", - 700: "epp", - 701: "lmp", - 702: "iris-beep", - 704: "elcsd", - 705: "agentx", - 706: "silc", - 707: "borland-dsj", - 709: "entrust-kmsh", - 710: "entrust-ash", - 711: "cisco-tdp", - 712: "tbrpf", - 713: "iris-xpc", - 714: "iris-xpcs", - 715: "iris-lwz", - 716: "pana", - 729: "netviewdm1", - 730: "netviewdm2", - 731: "netviewdm3", - 741: "netgw", - 742: "netrcs", - 744: "flexlm", - 747: "fujitsu-dev", - 748: "ris-cm", - 749: "kerberos-adm", - 750: "loadav", - 751: "pump", - 752: "qrh", - 753: "rrh", - 754: "tell", - 758: "nlogin", - 759: "con", - 760: "ns", - 761: "rxe", - 762: "quotad", - 763: "cycleserv", - 764: "omserv", - 765: "webster", - 767: "phonebook", - 769: "vid", - 770: "cadlock", - 771: "rtip", - 772: "cycleserv2", - 773: "notify", - 774: "acmaint-dbd", - 775: "acmaint-transd", - 776: "wpages", - 777: "multiling-http", - 780: "wpgs", - 800: "mdbs-daemon", - 801: "device", - 802: "mbap-s", - 810: "fcp-udp", - 828: "itm-mcell-s", - 829: "pkix-3-ca-ra", - 830: "netconf-ssh", - 831: "netconf-beep", - 832: "netconfsoaphttp", - 833: "netconfsoapbeep", - 847: "dhcp-failover2", - 848: "gdoi", - 853: "domain-s", - 854: "dlep", - 860: "iscsi", - 861: "owamp-control", - 862: "twamp-control", - 873: "rsync", - 886: "iclcnet-locate", - 887: "iclcnet-svinfo", - 888: "accessbuilder", - 900: "omginitialrefs", - 901: "smpnameres", - 902: "ideafarm-door", - 903: "ideafarm-panic", - 910: "kink", - 911: "xact-backup", - 912: "apex-mesh", - 913: "apex-edge", - 989: "ftps-data", - 990: "ftps", - 991: "nas", - 992: "telnets", - 993: "imaps", - 995: "pop3s", - 996: "vsinet", - 997: "maitrd", - 998: "puparp", - 999: "applix", - 1000: "cadlock2", - 1010: "surf", - 1021: "exp1", - 1022: "exp2", - 1025: "blackjack", - 1026: "cap", - 1027: "6a44", - 1029: "solid-mux", - 1033: "netinfo-local", - 1034: "activesync", - 1035: "mxxrlogin", - 1036: "nsstp", - 1037: "ams", - 1038: "mtqp", - 1039: "sbl", - 1040: "netarx", - 1041: "danf-ak2", - 1042: "afrog", - 1043: "boinc-client", - 1044: "dcutility", - 1045: "fpitp", - 1046: "wfremotertm", - 1047: "neod1", - 1048: "neod2", - 1049: "td-postman", - 1050: "cma", - 1051: "optima-vnet", - 1052: "ddt", - 1053: "remote-as", - 1054: "brvread", - 1055: "ansyslmd", - 1056: "vfo", - 1057: "startron", - 1058: "nim", - 1059: "nimreg", - 1060: "polestar", - 1061: "kiosk", - 1062: "veracity", - 1063: "kyoceranetdev", - 1064: "jstel", - 1065: "syscomlan", - 1066: "fpo-fns", - 1067: "instl-boots", - 1068: "instl-bootc", - 1069: "cognex-insight", - 1070: "gmrupdateserv", - 1071: "bsquare-voip", - 1072: "cardax", - 1073: "bridgecontrol", - 1074: "warmspotMgmt", - 1075: "rdrmshc", - 1076: "dab-sti-c", - 1077: "imgames", - 1078: "avocent-proxy", - 1079: "asprovatalk", - 1080: "socks", - 1081: "pvuniwien", - 1082: "amt-esd-prot", - 1083: "ansoft-lm-1", - 1084: "ansoft-lm-2", - 1085: "webobjects", - 1086: "cplscrambler-lg", - 1087: "cplscrambler-in", - 1088: "cplscrambler-al", - 1089: "ff-annunc", - 1090: "ff-fms", - 1091: "ff-sm", - 1092: "obrpd", - 1093: "proofd", - 1094: "rootd", - 1095: "nicelink", - 1096: "cnrprotocol", - 1097: "sunclustermgr", - 1098: "rmiactivation", - 1099: "rmiregistry", - 1100: "mctp", - 1101: "pt2-discover", - 1102: "adobeserver-1", - 1103: "adobeserver-2", - 1104: "xrl", - 1105: "ftranhc", - 1106: "isoipsigport-1", - 1107: "isoipsigport-2", - 1108: "ratio-adp", - 1110: "nfsd-keepalive", - 1111: "lmsocialserver", - 1112: "icp", - 1113: "ltp-deepspace", - 1114: "mini-sql", - 1115: "ardus-trns", - 1116: "ardus-cntl", - 1117: "ardus-mtrns", - 1118: "sacred", - 1119: "bnetgame", - 1120: "bnetfile", - 1121: "rmpp", - 1122: "availant-mgr", - 1123: "murray", - 1124: "hpvmmcontrol", - 1125: "hpvmmagent", - 1126: "hpvmmdata", - 1127: "kwdb-commn", - 1128: "saphostctrl", - 1129: "saphostctrls", - 1130: "casp", - 1131: "caspssl", - 1132: "kvm-via-ip", - 1133: "dfn", - 1134: "aplx", - 1135: "omnivision", - 1136: "hhb-gateway", - 1137: "trim", - 1138: "encrypted-admin", - 1139: "evm", - 1140: "autonoc", - 1141: "mxomss", - 1142: "edtools", - 1143: "imyx", - 1144: "fuscript", - 1145: "x9-icue", - 1146: "audit-transfer", - 1147: "capioverlan", - 1148: "elfiq-repl", - 1149: "bvtsonar", - 1150: "blaze", - 1151: "unizensus", - 1152: "winpoplanmess", - 1153: "c1222-acse", - 1154: "resacommunity", - 1155: "nfa", - 1156: "iascontrol-oms", - 1157: "iascontrol", - 1158: "dbcontrol-oms", - 1159: "oracle-oms", - 1160: "olsv", - 1161: "health-polling", - 1162: "health-trap", - 1163: "sddp", - 1164: "qsm-proxy", - 1165: "qsm-gui", - 1166: "qsm-remote", - 1167: "cisco-ipsla", - 1168: "vchat", - 1169: "tripwire", - 1170: "atc-lm", - 1171: "atc-appserver", - 1172: "dnap", - 1173: "d-cinema-rrp", - 1174: "fnet-remote-ui", - 1175: "dossier", - 1176: "indigo-server", - 1177: "dkmessenger", - 1178: "sgi-storman", - 1179: "b2n", - 1180: "mc-client", - 1181: "3comnetman", - 1182: "accelenet-data", - 1183: "llsurfup-http", - 1184: "llsurfup-https", - 1185: "catchpole", - 1186: "mysql-cluster", - 1187: "alias", - 1188: "hp-webadmin", - 1189: "unet", - 1190: "commlinx-avl", - 1191: "gpfs", - 1192: "caids-sensor", - 1193: "fiveacross", - 1194: "openvpn", - 1195: "rsf-1", - 1196: "netmagic", - 1197: "carrius-rshell", - 1198: "cajo-discovery", - 1199: "dmidi", - 1200: "scol", - 1201: "nucleus-sand", - 1202: "caiccipc", - 1203: "ssslic-mgr", - 1204: "ssslog-mgr", - 1205: "accord-mgc", - 1206: "anthony-data", - 1207: "metasage", - 1208: "seagull-ais", - 1209: "ipcd3", - 1210: "eoss", - 1211: "groove-dpp", - 1212: "lupa", - 1213: "mpc-lifenet", - 1214: "kazaa", - 1215: "scanstat-1", - 1216: "etebac5", - 1217: "hpss-ndapi", - 1218: "aeroflight-ads", - 1219: "aeroflight-ret", - 1220: "qt-serveradmin", - 1221: "sweetware-apps", - 1222: "nerv", - 1223: "tgp", - 1224: "vpnz", - 1225: "slinkysearch", - 1226: "stgxfws", - 1227: "dns2go", - 1228: "florence", - 1229: "zented", - 1230: "periscope", - 1231: "menandmice-lpm", - 1232: "first-defense", - 1233: "univ-appserver", - 1234: "search-agent", - 1235: "mosaicsyssvc1", - 1236: "bvcontrol", - 1237: "tsdos390", - 1238: "hacl-qs", - 1239: "nmsd", - 1240: "instantia", - 1241: "nessus", - 1242: "nmasoverip", - 1243: "serialgateway", - 1244: "isbconference1", - 1245: "isbconference2", - 1246: "payrouter", - 1247: "visionpyramid", - 1248: "hermes", - 1249: "mesavistaco", - 1250: "swldy-sias", - 1251: "servergraph", - 1252: "bspne-pcc", - 1253: "q55-pcc", - 1254: "de-noc", - 1255: "de-cache-query", - 1256: "de-server", - 1257: "shockwave2", - 1258: "opennl", - 1259: "opennl-voice", - 1260: "ibm-ssd", - 1261: "mpshrsv", - 1262: "qnts-orb", - 1263: "dka", - 1264: "prat", - 1265: "dssiapi", - 1266: "dellpwrappks", - 1267: "epc", - 1268: "propel-msgsys", - 1269: "watilapp", - 1270: "opsmgr", - 1271: "excw", - 1272: "cspmlockmgr", - 1273: "emc-gateway", - 1274: "t1distproc", - 1275: "ivcollector", - 1277: "miva-mqs", - 1278: "dellwebadmin-1", - 1279: "dellwebadmin-2", - 1280: "pictrography", - 1281: "healthd", - 1282: "emperion", - 1283: "productinfo", - 1284: "iee-qfx", - 1285: "neoiface", - 1286: "netuitive", - 1287: "routematch", - 1288: "navbuddy", - 1289: "jwalkserver", - 1290: "winjaserver", - 1291: "seagulllms", - 1292: "dsdn", - 1293: "pkt-krb-ipsec", - 1294: "cmmdriver", - 1295: "ehtp", - 1296: "dproxy", - 1297: "sdproxy", - 1298: "lpcp", - 1299: "hp-sci", - 1300: "h323hostcallsc", - 1301: "ci3-software-1", - 1302: "ci3-software-2", - 1303: "sftsrv", - 1304: "boomerang", - 1305: "pe-mike", - 1306: "re-conn-proto", - 1307: "pacmand", - 1308: "odsi", - 1309: "jtag-server", - 1310: "husky", - 1311: "rxmon", - 1312: "sti-envision", - 1313: "bmc-patroldb", - 1314: "pdps", - 1315: "els", - 1316: "exbit-escp", - 1317: "vrts-ipcserver", - 1318: "krb5gatekeeper", - 1319: "amx-icsp", - 1320: "amx-axbnet", - 1321: "pip", - 1322: "novation", - 1323: "brcd", - 1324: "delta-mcp", - 1325: "dx-instrument", - 1326: "wimsic", - 1327: "ultrex", - 1328: "ewall", - 1329: "netdb-export", - 1330: "streetperfect", - 1331: "intersan", - 1332: "pcia-rxp-b", - 1333: "passwrd-policy", - 1334: "writesrv", - 1335: "digital-notary", - 1336: "ischat", - 1337: "menandmice-dns", - 1338: "wmc-log-svc", - 1339: "kjtsiteserver", - 1340: "naap", - 1341: "qubes", - 1342: "esbroker", - 1343: "re101", - 1344: "icap", - 1345: "vpjp", - 1346: "alta-ana-lm", - 1347: "bbn-mmc", - 1348: "bbn-mmx", - 1349: "sbook", - 1350: "editbench", - 1351: "equationbuilder", - 1352: "lotusnote", - 1353: "relief", - 1354: "XSIP-network", - 1355: "intuitive-edge", - 1356: "cuillamartin", - 1357: "pegboard", - 1358: "connlcli", - 1359: "ftsrv", - 1360: "mimer", - 1361: "linx", - 1362: "timeflies", - 1363: "ndm-requester", - 1364: "ndm-server", - 1365: "adapt-sna", - 1366: "netware-csp", - 1367: "dcs", - 1368: "screencast", - 1369: "gv-us", - 1370: "us-gv", - 1371: "fc-cli", - 1372: "fc-ser", - 1373: "chromagrafx", - 1374: "molly", - 1375: "bytex", - 1376: "ibm-pps", - 1377: "cichlid", - 1378: "elan", - 1379: "dbreporter", - 1380: "telesis-licman", - 1381: "apple-licman", - 1382: "udt-os", - 1383: "gwha", - 1384: "os-licman", - 1385: "atex-elmd", - 1386: "checksum", - 1387: "cadsi-lm", - 1388: "objective-dbc", - 1389: "iclpv-dm", - 1390: "iclpv-sc", - 1391: "iclpv-sas", - 1392: "iclpv-pm", - 1393: "iclpv-nls", - 1394: "iclpv-nlc", - 1395: "iclpv-wsm", - 1396: "dvl-activemail", - 1397: "audio-activmail", - 1398: "video-activmail", - 1399: "cadkey-licman", - 1400: "cadkey-tablet", - 1401: "goldleaf-licman", - 1402: "prm-sm-np", - 1403: "prm-nm-np", - 1404: "igi-lm", - 1405: "ibm-res", - 1406: "netlabs-lm", - 1408: "sophia-lm", - 1409: "here-lm", - 1410: "hiq", - 1411: "af", - 1412: "innosys", - 1413: "innosys-acl", - 1414: "ibm-mqseries", - 1415: "dbstar", - 1416: "novell-lu6-2", - 1417: "timbuktu-srv1", - 1418: "timbuktu-srv2", - 1419: "timbuktu-srv3", - 1420: "timbuktu-srv4", - 1421: "gandalf-lm", - 1422: "autodesk-lm", - 1423: "essbase", - 1424: "hybrid", - 1425: "zion-lm", - 1426: "sais", - 1427: "mloadd", - 1428: "informatik-lm", - 1429: "nms", - 1430: "tpdu", - 1431: "rgtp", - 1432: "blueberry-lm", - 1433: "ms-sql-s", - 1434: "ms-sql-m", - 1435: "ibm-cics", - 1436: "saism", - 1437: "tabula", - 1438: "eicon-server", - 1439: "eicon-x25", - 1440: "eicon-slp", - 1441: "cadis-1", - 1442: "cadis-2", - 1443: "ies-lm", - 1444: "marcam-lm", - 1445: "proxima-lm", - 1446: "ora-lm", - 1447: "apri-lm", - 1448: "oc-lm", - 1449: "peport", - 1450: "dwf", - 1451: "infoman", - 1452: "gtegsc-lm", - 1453: "genie-lm", - 1454: "interhdl-elmd", - 1455: "esl-lm", - 1456: "dca", - 1457: "valisys-lm", - 1458: "nrcabq-lm", - 1459: "proshare1", - 1460: "proshare2", - 1461: "ibm-wrless-lan", - 1462: "world-lm", - 1463: "nucleus", - 1464: "msl-lmd", - 1465: "pipes", - 1466: "oceansoft-lm", - 1467: "csdmbase", - 1468: "csdm", - 1469: "aal-lm", - 1470: "uaiact", - 1471: "csdmbase", - 1472: "csdm", - 1473: "openmath", - 1474: "telefinder", - 1475: "taligent-lm", - 1476: "clvm-cfg", - 1477: "ms-sna-server", - 1478: "ms-sna-base", - 1479: "dberegister", - 1480: "pacerforum", - 1481: "airs", - 1482: "miteksys-lm", - 1483: "afs", - 1484: "confluent", - 1485: "lansource", - 1486: "nms-topo-serv", - 1487: "localinfosrvr", - 1488: "docstor", - 1489: "dmdocbroker", - 1490: "insitu-conf", - 1492: "stone-design-1", - 1493: "netmap-lm", - 1494: "ica", - 1495: "cvc", - 1496: "liberty-lm", - 1497: "rfx-lm", - 1498: "sybase-sqlany", - 1499: "fhc", - 1500: "vlsi-lm", - 1501: "saiscm", - 1502: "shivadiscovery", - 1503: "imtc-mcs", - 1504: "evb-elm", - 1505: "funkproxy", - 1506: "utcd", - 1507: "symplex", - 1508: "diagmond", - 1509: "robcad-lm", - 1510: "mvx-lm", - 1511: "3l-l1", - 1512: "wins", - 1513: "fujitsu-dtc", - 1514: "fujitsu-dtcns", - 1515: "ifor-protocol", - 1516: "vpad", - 1517: "vpac", - 1518: "vpvd", - 1519: "vpvc", - 1520: "atm-zip-office", - 1521: "ncube-lm", - 1522: "ricardo-lm", - 1523: "cichild-lm", - 1524: "ingreslock", - 1525: "orasrv", - 1526: "pdap-np", - 1527: "tlisrv", - 1528: "ngr-t", - 1529: "coauthor", - 1530: "rap-service", - 1531: "rap-listen", - 1532: "miroconnect", - 1533: "virtual-places", - 1534: "micromuse-lm", - 1535: "ampr-info", - 1536: "ampr-inter", - 1537: "sdsc-lm", - 1538: "3ds-lm", - 1539: "intellistor-lm", - 1540: "rds", - 1541: "rds2", - 1542: "gridgen-elmd", - 1543: "simba-cs", - 1544: "aspeclmd", - 1545: "vistium-share", - 1546: "abbaccuray", - 1547: "laplink", - 1548: "axon-lm", - 1549: "shivasound", - 1550: "3m-image-lm", - 1551: "hecmtl-db", - 1552: "pciarray", - 1553: "sna-cs", - 1554: "caci-lm", - 1555: "livelan", - 1556: "veritas-pbx", - 1557: "arbortext-lm", - 1558: "xingmpeg", - 1559: "web2host", - 1560: "asci-val", - 1561: "facilityview", - 1562: "pconnectmgr", - 1563: "cadabra-lm", - 1564: "pay-per-view", - 1565: "winddlb", - 1566: "corelvideo", - 1567: "jlicelmd", - 1568: "tsspmap", - 1569: "ets", - 1570: "orbixd", - 1571: "rdb-dbs-disp", - 1572: "chip-lm", - 1573: "itscomm-ns", - 1574: "mvel-lm", - 1575: "oraclenames", - 1576: "moldflow-lm", - 1577: "hypercube-lm", - 1578: "jacobus-lm", - 1579: "ioc-sea-lm", - 1580: "tn-tl-r2", - 1581: "mil-2045-47001", - 1582: "msims", - 1583: "simbaexpress", - 1584: "tn-tl-fd2", - 1585: "intv", - 1586: "ibm-abtact", - 1587: "pra-elmd", - 1588: "triquest-lm", - 1589: "vqp", - 1590: "gemini-lm", - 1591: "ncpm-pm", - 1592: "commonspace", - 1593: "mainsoft-lm", - 1594: "sixtrak", - 1595: "radio", - 1596: "radio-bc", - 1597: "orbplus-iiop", - 1598: "picknfs", - 1599: "simbaservices", - 1600: "issd", - 1601: "aas", - 1602: "inspect", - 1603: "picodbc", - 1604: "icabrowser", - 1605: "slp", - 1606: "slm-api", - 1607: "stt", - 1608: "smart-lm", - 1609: "isysg-lm", - 1610: "taurus-wh", - 1611: "ill", - 1612: "netbill-trans", - 1613: "netbill-keyrep", - 1614: "netbill-cred", - 1615: "netbill-auth", - 1616: "netbill-prod", - 1617: "nimrod-agent", - 1618: "skytelnet", - 1619: "xs-openstorage", - 1620: "faxportwinport", - 1621: "softdataphone", - 1622: "ontime", - 1623: "jaleosnd", - 1624: "udp-sr-port", - 1625: "svs-omagent", - 1626: "shockwave", - 1627: "t128-gateway", - 1628: "lontalk-norm", - 1629: "lontalk-urgnt", - 1630: "oraclenet8cman", - 1631: "visitview", - 1632: "pammratc", - 1633: "pammrpc", - 1634: "loaprobe", - 1635: "edb-server1", - 1636: "isdc", - 1637: "islc", - 1638: "ismc", - 1639: "cert-initiator", - 1640: "cert-responder", - 1641: "invision", - 1642: "isis-am", - 1643: "isis-ambc", - 1644: "saiseh", - 1645: "sightline", - 1646: "sa-msg-port", - 1647: "rsap", - 1648: "concurrent-lm", - 1649: "kermit", - 1650: "nkd", - 1651: "shiva-confsrvr", - 1652: "xnmp", - 1653: "alphatech-lm", - 1654: "stargatealerts", - 1655: "dec-mbadmin", - 1656: "dec-mbadmin-h", - 1657: "fujitsu-mmpdc", - 1658: "sixnetudr", - 1659: "sg-lm", - 1660: "skip-mc-gikreq", - 1661: "netview-aix-1", - 1662: "netview-aix-2", - 1663: "netview-aix-3", - 1664: "netview-aix-4", - 1665: "netview-aix-5", - 1666: "netview-aix-6", - 1667: "netview-aix-7", - 1668: "netview-aix-8", - 1669: "netview-aix-9", - 1670: "netview-aix-10", - 1671: "netview-aix-11", - 1672: "netview-aix-12", - 1673: "proshare-mc-1", - 1674: "proshare-mc-2", - 1675: "pdp", - 1676: "netcomm2", - 1677: "groupwise", - 1678: "prolink", - 1679: "darcorp-lm", - 1680: "microcom-sbp", - 1681: "sd-elmd", - 1682: "lanyon-lantern", - 1683: "ncpm-hip", - 1684: "snaresecure", - 1685: "n2nremote", - 1686: "cvmon", - 1687: "nsjtp-ctrl", - 1688: "nsjtp-data", - 1689: "firefox", - 1690: "ng-umds", - 1691: "empire-empuma", - 1692: "sstsys-lm", - 1693: "rrirtr", - 1694: "rrimwm", - 1695: "rrilwm", - 1696: "rrifmm", - 1697: "rrisat", - 1698: "rsvp-encap-1", - 1699: "rsvp-encap-2", - 1700: "mps-raft", - 1701: "l2f", - 1702: "deskshare", - 1703: "hb-engine", - 1704: "bcs-broker", - 1705: "slingshot", - 1706: "jetform", - 1707: "vdmplay", - 1708: "gat-lmd", - 1709: "centra", - 1710: "impera", - 1711: "pptconference", - 1712: "registrar", - 1713: "conferencetalk", - 1714: "sesi-lm", - 1715: "houdini-lm", - 1716: "xmsg", - 1717: "fj-hdnet", - 1718: "h323gatedisc", - 1719: "h323gatestat", - 1720: "h323hostcall", - 1721: "caicci", - 1722: "hks-lm", - 1723: "pptp", - 1724: "csbphonemaster", - 1725: "iden-ralp", - 1726: "iberiagames", - 1727: "winddx", - 1728: "telindus", - 1729: "citynl", - 1730: "roketz", - 1731: "msiccp", - 1732: "proxim", - 1733: "siipat", - 1734: "cambertx-lm", - 1735: "privatechat", - 1736: "street-stream", - 1737: "ultimad", - 1738: "gamegen1", - 1739: "webaccess", - 1740: "encore", - 1741: "cisco-net-mgmt", - 1742: "3Com-nsd", - 1743: "cinegrfx-lm", - 1744: "ncpm-ft", - 1745: "remote-winsock", - 1746: "ftrapid-1", - 1747: "ftrapid-2", - 1748: "oracle-em1", - 1749: "aspen-services", - 1750: "sslp", - 1751: "swiftnet", - 1752: "lofr-lm", - 1754: "oracle-em2", - 1755: "ms-streaming", - 1756: "capfast-lmd", - 1757: "cnhrp", - 1758: "tftp-mcast", - 1759: "spss-lm", - 1760: "www-ldap-gw", - 1761: "cft-0", - 1762: "cft-1", - 1763: "cft-2", - 1764: "cft-3", - 1765: "cft-4", - 1766: "cft-5", - 1767: "cft-6", - 1768: "cft-7", - 1769: "bmc-net-adm", - 1770: "bmc-net-svc", - 1771: "vaultbase", - 1772: "essweb-gw", - 1773: "kmscontrol", - 1774: "global-dtserv", - 1776: "femis", - 1777: "powerguardian", - 1778: "prodigy-intrnet", - 1779: "pharmasoft", - 1780: "dpkeyserv", - 1781: "answersoft-lm", - 1782: "hp-hcip", - 1784: "finle-lm", - 1785: "windlm", - 1786: "funk-logger", - 1787: "funk-license", - 1788: "psmond", - 1789: "hello", - 1790: "nmsp", - 1791: "ea1", - 1792: "ibm-dt-2", - 1793: "rsc-robot", - 1794: "cera-bcm", - 1795: "dpi-proxy", - 1796: "vocaltec-admin", - 1797: "uma", - 1798: "etp", - 1799: "netrisk", - 1800: "ansys-lm", - 1801: "msmq", - 1802: "concomp1", - 1803: "hp-hcip-gwy", - 1804: "enl", - 1805: "enl-name", - 1806: "musiconline", - 1807: "fhsp", - 1808: "oracle-vp2", - 1809: "oracle-vp1", - 1810: "jerand-lm", - 1811: "scientia-sdb", - 1812: "radius", - 1813: "radius-acct", - 1814: "tdp-suite", - 1815: "mmpft", - 1816: "harp", - 1817: "rkb-oscs", - 1818: "etftp", - 1819: "plato-lm", - 1820: "mcagent", - 1821: "donnyworld", - 1822: "es-elmd", - 1823: "unisys-lm", - 1824: "metrics-pas", - 1825: "direcpc-video", - 1826: "ardt", - 1827: "asi", - 1828: "itm-mcell-u", - 1829: "optika-emedia", - 1830: "net8-cman", - 1831: "myrtle", - 1832: "tht-treasure", - 1833: "udpradio", - 1834: "ardusuni", - 1835: "ardusmul", - 1836: "ste-smsc", - 1837: "csoft1", - 1838: "talnet", - 1839: "netopia-vo1", - 1840: "netopia-vo2", - 1841: "netopia-vo3", - 1842: "netopia-vo4", - 1843: "netopia-vo5", - 1844: "direcpc-dll", - 1845: "altalink", - 1846: "tunstall-pnc", - 1847: "slp-notify", - 1848: "fjdocdist", - 1849: "alpha-sms", - 1850: "gsi", - 1851: "ctcd", - 1852: "virtual-time", - 1853: "vids-avtp", - 1854: "buddy-draw", - 1855: "fiorano-rtrsvc", - 1856: "fiorano-msgsvc", - 1857: "datacaptor", - 1858: "privateark", - 1859: "gammafetchsvr", - 1860: "sunscalar-svc", - 1861: "lecroy-vicp", - 1862: "mysql-cm-agent", - 1863: "msnp", - 1864: "paradym-31port", - 1865: "entp", - 1866: "swrmi", - 1867: "udrive", - 1868: "viziblebrowser", - 1869: "transact", - 1870: "sunscalar-dns", - 1871: "canocentral0", - 1872: "canocentral1", - 1873: "fjmpjps", - 1874: "fjswapsnp", - 1875: "westell-stats", - 1876: "ewcappsrv", - 1877: "hp-webqosdb", - 1878: "drmsmc", - 1879: "nettgain-nms", - 1880: "vsat-control", - 1881: "ibm-mqseries2", - 1882: "ecsqdmn", - 1883: "mqtt", - 1884: "idmaps", - 1885: "vrtstrapserver", - 1886: "leoip", - 1887: "filex-lport", - 1888: "ncconfig", - 1889: "unify-adapter", - 1890: "wilkenlistener", - 1891: "childkey-notif", - 1892: "childkey-ctrl", - 1893: "elad", - 1894: "o2server-port", - 1896: "b-novative-ls", - 1897: "metaagent", - 1898: "cymtec-port", - 1899: "mc2studios", - 1900: "ssdp", - 1901: "fjicl-tep-a", - 1902: "fjicl-tep-b", - 1903: "linkname", - 1904: "fjicl-tep-c", - 1905: "sugp", - 1906: "tpmd", - 1907: "intrastar", - 1908: "dawn", - 1909: "global-wlink", - 1910: "ultrabac", - 1911: "mtp", - 1912: "rhp-iibp", - 1913: "armadp", - 1914: "elm-momentum", - 1915: "facelink", - 1916: "persona", - 1917: "noagent", - 1918: "can-nds", - 1919: "can-dch", - 1920: "can-ferret", - 1921: "noadmin", - 1922: "tapestry", - 1923: "spice", - 1924: "xiip", - 1925: "discovery-port", - 1926: "egs", - 1927: "videte-cipc", - 1928: "emsd-port", - 1929: "bandwiz-system", - 1930: "driveappserver", - 1931: "amdsched", - 1932: "ctt-broker", - 1933: "xmapi", - 1934: "xaapi", - 1935: "macromedia-fcs", - 1936: "jetcmeserver", - 1937: "jwserver", - 1938: "jwclient", - 1939: "jvserver", - 1940: "jvclient", - 1941: "dic-aida", - 1942: "res", - 1943: "beeyond-media", - 1944: "close-combat", - 1945: "dialogic-elmd", - 1946: "tekpls", - 1947: "sentinelsrm", - 1948: "eye2eye", - 1949: "ismaeasdaqlive", - 1950: "ismaeasdaqtest", - 1951: "bcs-lmserver", - 1952: "mpnjsc", - 1953: "rapidbase", - 1954: "abr-api", - 1955: "abr-secure", - 1956: "vrtl-vmf-ds", - 1957: "unix-status", - 1958: "dxadmind", - 1959: "simp-all", - 1960: "nasmanager", - 1961: "bts-appserver", - 1962: "biap-mp", - 1963: "webmachine", - 1964: "solid-e-engine", - 1965: "tivoli-npm", - 1966: "slush", - 1967: "sns-quote", - 1968: "lipsinc", - 1969: "lipsinc1", - 1970: "netop-rc", - 1971: "netop-school", - 1972: "intersys-cache", - 1973: "dlsrap", - 1974: "drp", - 1975: "tcoflashagent", - 1976: "tcoregagent", - 1977: "tcoaddressbook", - 1978: "unisql", - 1979: "unisql-java", - 1980: "pearldoc-xact", - 1981: "p2pq", - 1982: "estamp", - 1983: "lhtp", - 1984: "bb", - 1985: "hsrp", - 1986: "licensedaemon", - 1987: "tr-rsrb-p1", - 1988: "tr-rsrb-p2", - 1989: "tr-rsrb-p3", - 1990: "stun-p1", - 1991: "stun-p2", - 1992: "stun-p3", - 1993: "snmp-tcp-port", - 1994: "stun-port", - 1995: "perf-port", - 1996: "tr-rsrb-port", - 1997: "gdp-port", - 1998: "x25-svc-port", - 1999: "tcp-id-port", - 2000: "cisco-sccp", - 2001: "wizard", - 2002: "globe", - 2003: "brutus", - 2004: "emce", - 2005: "oracle", - 2006: "raid-cd", - 2007: "raid-am", - 2008: "terminaldb", - 2009: "whosockami", - 2010: "pipe-server", - 2011: "servserv", - 2012: "raid-ac", - 2013: "raid-cd", - 2014: "raid-sf", - 2015: "raid-cs", - 2016: "bootserver", - 2017: "bootclient", - 2018: "rellpack", - 2019: "about", - 2020: "xinupageserver", - 2021: "xinuexpansion1", - 2022: "xinuexpansion2", - 2023: "xinuexpansion3", - 2024: "xinuexpansion4", - 2025: "xribs", - 2026: "scrabble", - 2027: "shadowserver", - 2028: "submitserver", - 2029: "hsrpv6", - 2030: "device2", - 2031: "mobrien-chat", - 2032: "blackboard", - 2033: "glogger", - 2034: "scoremgr", - 2035: "imsldoc", - 2036: "e-dpnet", - 2037: "applus", - 2038: "objectmanager", - 2039: "prizma", - 2040: "lam", - 2041: "interbase", - 2042: "isis", - 2043: "isis-bcast", - 2044: "rimsl", - 2045: "cdfunc", - 2046: "sdfunc", - 2047: "dls", - 2048: "dls-monitor", - 2049: "shilp", - 2050: "av-emb-config", - 2051: "epnsdp", - 2052: "clearvisn", - 2053: "lot105-ds-upd", - 2054: "weblogin", - 2055: "iop", - 2056: "omnisky", - 2057: "rich-cp", - 2058: "newwavesearch", - 2059: "bmc-messaging", - 2060: "teleniumdaemon", - 2061: "netmount", - 2062: "icg-swp", - 2063: "icg-bridge", - 2064: "icg-iprelay", - 2065: "dlsrpn", - 2066: "aura", - 2067: "dlswpn", - 2068: "avauthsrvprtcl", - 2069: "event-port", - 2070: "ah-esp-encap", - 2071: "acp-port", - 2072: "msync", - 2073: "gxs-data-port", - 2074: "vrtl-vmf-sa", - 2075: "newlixengine", - 2076: "newlixconfig", - 2077: "tsrmagt", - 2078: "tpcsrvr", - 2079: "idware-router", - 2080: "autodesk-nlm", - 2081: "kme-trap-port", - 2082: "infowave", - 2083: "radsec", - 2084: "sunclustergeo", - 2085: "ada-cip", - 2086: "gnunet", - 2087: "eli", - 2088: "ip-blf", - 2089: "sep", - 2090: "lrp", - 2091: "prp", - 2092: "descent3", - 2093: "nbx-cc", - 2094: "nbx-au", - 2095: "nbx-ser", - 2096: "nbx-dir", - 2097: "jetformpreview", - 2098: "dialog-port", - 2099: "h2250-annex-g", - 2100: "amiganetfs", - 2101: "rtcm-sc104", - 2102: "zephyr-srv", - 2103: "zephyr-clt", - 2104: "zephyr-hm", - 2105: "minipay", - 2106: "mzap", - 2107: "bintec-admin", - 2108: "comcam", - 2109: "ergolight", - 2110: "umsp", - 2111: "dsatp", - 2112: "idonix-metanet", - 2113: "hsl-storm", - 2114: "newheights", - 2115: "kdm", - 2116: "ccowcmr", - 2117: "mentaclient", - 2118: "mentaserver", - 2119: "gsigatekeeper", - 2120: "qencp", - 2121: "scientia-ssdb", - 2122: "caupc-remote", - 2123: "gtp-control", - 2124: "elatelink", - 2125: "lockstep", - 2126: "pktcable-cops", - 2127: "index-pc-wb", - 2128: "net-steward", - 2129: "cs-live", - 2130: "xds", - 2131: "avantageb2b", - 2132: "solera-epmap", - 2133: "zymed-zpp", - 2134: "avenue", - 2135: "gris", - 2136: "appworxsrv", - 2137: "connect", - 2138: "unbind-cluster", - 2139: "ias-auth", - 2140: "ias-reg", - 2141: "ias-admind", - 2142: "tdmoip", - 2143: "lv-jc", - 2144: "lv-ffx", - 2145: "lv-pici", - 2146: "lv-not", - 2147: "lv-auth", - 2148: "veritas-ucl", - 2149: "acptsys", - 2150: "dynamic3d", - 2151: "docent", - 2152: "gtp-user", - 2153: "ctlptc", - 2154: "stdptc", - 2155: "brdptc", - 2156: "trp", - 2157: "xnds", - 2158: "touchnetplus", - 2159: "gdbremote", - 2160: "apc-2160", - 2161: "apc-2161", - 2162: "navisphere", - 2163: "navisphere-sec", - 2164: "ddns-v3", - 2165: "x-bone-api", - 2166: "iwserver", - 2167: "raw-serial", - 2168: "easy-soft-mux", - 2169: "brain", - 2170: "eyetv", - 2171: "msfw-storage", - 2172: "msfw-s-storage", - 2173: "msfw-replica", - 2174: "msfw-array", - 2175: "airsync", - 2176: "rapi", - 2177: "qwave", - 2178: "bitspeer", - 2179: "vmrdp", - 2180: "mc-gt-srv", - 2181: "eforward", - 2182: "cgn-stat", - 2183: "cgn-config", - 2184: "nvd", - 2185: "onbase-dds", - 2186: "gtaua", - 2187: "ssmd", - 2190: "tivoconnect", - 2191: "tvbus", - 2192: "asdis", - 2193: "drwcs", - 2197: "mnp-exchange", - 2198: "onehome-remote", - 2199: "onehome-help", - 2200: "ici", - 2201: "ats", - 2202: "imtc-map", - 2203: "b2-runtime", - 2204: "b2-license", - 2205: "jps", - 2206: "hpocbus", - 2207: "hpssd", - 2208: "hpiod", - 2209: "rimf-ps", - 2210: "noaaport", - 2211: "emwin", - 2212: "leecoposserver", - 2213: "kali", - 2214: "rpi", - 2215: "ipcore", - 2216: "vtu-comms", - 2217: "gotodevice", - 2218: "bounzza", - 2219: "netiq-ncap", - 2220: "netiq", - 2221: "ethernet-ip-s", - 2222: "EtherNet-IP-1", - 2223: "rockwell-csp2", - 2224: "efi-mg", - 2226: "di-drm", - 2227: "di-msg", - 2228: "ehome-ms", - 2229: "datalens", - 2230: "queueadm", - 2231: "wimaxasncp", - 2232: "ivs-video", - 2233: "infocrypt", - 2234: "directplay", - 2235: "sercomm-wlink", - 2236: "nani", - 2237: "optech-port1-lm", - 2238: "aviva-sna", - 2239: "imagequery", - 2240: "recipe", - 2241: "ivsd", - 2242: "foliocorp", - 2243: "magicom", - 2244: "nmsserver", - 2245: "hao", - 2246: "pc-mta-addrmap", - 2247: "antidotemgrsvr", - 2248: "ums", - 2249: "rfmp", - 2250: "remote-collab", - 2251: "dif-port", - 2252: "njenet-ssl", - 2253: "dtv-chan-req", - 2254: "seispoc", - 2255: "vrtp", - 2256: "pcc-mfp", - 2257: "simple-tx-rx", - 2258: "rcts", - 2260: "apc-2260", - 2261: "comotionmaster", - 2262: "comotionback", - 2263: "ecwcfg", - 2264: "apx500api-1", - 2265: "apx500api-2", - 2266: "mfserver", - 2267: "ontobroker", - 2268: "amt", - 2269: "mikey", - 2270: "starschool", - 2271: "mmcals", - 2272: "mmcal", - 2273: "mysql-im", - 2274: "pcttunnell", - 2275: "ibridge-data", - 2276: "ibridge-mgmt", - 2277: "bluectrlproxy", - 2278: "s3db", - 2279: "xmquery", - 2280: "lnvpoller", - 2281: "lnvconsole", - 2282: "lnvalarm", - 2283: "lnvstatus", - 2284: "lnvmaps", - 2285: "lnvmailmon", - 2286: "nas-metering", - 2287: "dna", - 2288: "netml", - 2289: "dict-lookup", - 2290: "sonus-logging", - 2291: "eapsp", - 2292: "mib-streaming", - 2293: "npdbgmngr", - 2294: "konshus-lm", - 2295: "advant-lm", - 2296: "theta-lm", - 2297: "d2k-datamover1", - 2298: "d2k-datamover2", - 2299: "pc-telecommute", - 2300: "cvmmon", - 2301: "cpq-wbem", - 2302: "binderysupport", - 2303: "proxy-gateway", - 2304: "attachmate-uts", - 2305: "mt-scaleserver", - 2306: "tappi-boxnet", - 2307: "pehelp", - 2308: "sdhelp", - 2309: "sdserver", - 2310: "sdclient", - 2311: "messageservice", - 2312: "wanscaler", - 2313: "iapp", - 2314: "cr-websystems", - 2315: "precise-sft", - 2316: "sent-lm", - 2317: "attachmate-g32", - 2318: "cadencecontrol", - 2319: "infolibria", - 2320: "siebel-ns", - 2321: "rdlap", - 2322: "ofsd", - 2323: "3d-nfsd", - 2324: "cosmocall", - 2325: "ansysli", - 2326: "idcp", - 2327: "xingcsm", - 2328: "netrix-sftm", - 2329: "nvd", - 2330: "tscchat", - 2331: "agentview", - 2332: "rcc-host", - 2333: "snapp", - 2334: "ace-client", - 2335: "ace-proxy", - 2336: "appleugcontrol", - 2337: "ideesrv", - 2338: "norton-lambert", - 2339: "3com-webview", - 2340: "wrs-registry", - 2341: "xiostatus", - 2342: "manage-exec", - 2343: "nati-logos", - 2344: "fcmsys", - 2345: "dbm", - 2346: "redstorm-join", - 2347: "redstorm-find", - 2348: "redstorm-info", - 2349: "redstorm-diag", - 2350: "psbserver", - 2351: "psrserver", - 2352: "pslserver", - 2353: "pspserver", - 2354: "psprserver", - 2355: "psdbserver", - 2356: "gxtelmd", - 2357: "unihub-server", - 2358: "futrix", - 2359: "flukeserver", - 2360: "nexstorindltd", - 2361: "tl1", - 2362: "digiman", - 2363: "mediacntrlnfsd", - 2364: "oi-2000", - 2365: "dbref", - 2366: "qip-login", - 2367: "service-ctrl", - 2368: "opentable", - 2370: "l3-hbmon", - 2372: "lanmessenger", - 2381: "compaq-https", - 2382: "ms-olap3", - 2383: "ms-olap4", - 2384: "sd-capacity", - 2385: "sd-data", - 2386: "virtualtape", - 2387: "vsamredirector", - 2388: "mynahautostart", - 2389: "ovsessionmgr", - 2390: "rsmtp", - 2391: "3com-net-mgmt", - 2392: "tacticalauth", - 2393: "ms-olap1", - 2394: "ms-olap2", - 2395: "lan900-remote", - 2396: "wusage", - 2397: "ncl", - 2398: "orbiter", - 2399: "fmpro-fdal", - 2400: "opequus-server", - 2401: "cvspserver", - 2402: "taskmaster2000", - 2403: "taskmaster2000", - 2404: "iec-104", - 2405: "trc-netpoll", - 2406: "jediserver", - 2407: "orion", - 2409: "sns-protocol", - 2410: "vrts-registry", - 2411: "netwave-ap-mgmt", - 2412: "cdn", - 2413: "orion-rmi-reg", - 2414: "beeyond", - 2415: "codima-rtp", - 2416: "rmtserver", - 2417: "composit-server", - 2418: "cas", - 2419: "attachmate-s2s", - 2420: "dslremote-mgmt", - 2421: "g-talk", - 2422: "crmsbits", - 2423: "rnrp", - 2424: "kofax-svr", - 2425: "fjitsuappmgr", - 2426: "vcmp", - 2427: "mgcp-gateway", - 2428: "ott", - 2429: "ft-role", - 2430: "venus", - 2431: "venus-se", - 2432: "codasrv", - 2433: "codasrv-se", - 2434: "pxc-epmap", - 2435: "optilogic", - 2436: "topx", - 2437: "unicontrol", - 2438: "msp", - 2439: "sybasedbsynch", - 2440: "spearway", - 2441: "pvsw-inet", - 2442: "netangel", - 2443: "powerclientcsf", - 2444: "btpp2sectrans", - 2445: "dtn1", - 2446: "bues-service", - 2447: "ovwdb", - 2448: "hpppssvr", - 2449: "ratl", - 2450: "netadmin", - 2451: "netchat", - 2452: "snifferclient", - 2453: "madge-ltd", - 2454: "indx-dds", - 2455: "wago-io-system", - 2456: "altav-remmgt", - 2457: "rapido-ip", - 2458: "griffin", - 2459: "community", - 2460: "ms-theater", - 2461: "qadmifoper", - 2462: "qadmifevent", - 2463: "lsi-raid-mgmt", - 2464: "direcpc-si", - 2465: "lbm", - 2466: "lbf", - 2467: "high-criteria", - 2468: "qip-msgd", - 2469: "mti-tcs-comm", - 2470: "taskman-port", - 2471: "seaodbc", - 2472: "c3", - 2473: "aker-cdp", - 2474: "vitalanalysis", - 2475: "ace-server", - 2476: "ace-svr-prop", - 2477: "ssm-cvs", - 2478: "ssm-cssps", - 2479: "ssm-els", - 2480: "powerexchange", - 2481: "giop", - 2482: "giop-ssl", - 2483: "ttc", - 2484: "ttc-ssl", - 2485: "netobjects1", - 2486: "netobjects2", - 2487: "pns", - 2488: "moy-corp", - 2489: "tsilb", - 2490: "qip-qdhcp", - 2491: "conclave-cpp", - 2492: "groove", - 2493: "talarian-mqs", - 2494: "bmc-ar", - 2495: "fast-rem-serv", - 2496: "dirgis", - 2497: "quaddb", - 2498: "odn-castraq", - 2499: "unicontrol", - 2500: "rtsserv", - 2501: "rtsclient", - 2502: "kentrox-prot", - 2503: "nms-dpnss", - 2504: "wlbs", - 2505: "ppcontrol", - 2506: "jbroker", - 2507: "spock", - 2508: "jdatastore", - 2509: "fjmpss", - 2510: "fjappmgrbulk", - 2511: "metastorm", - 2512: "citrixima", - 2513: "citrixadmin", - 2514: "facsys-ntp", - 2515: "facsys-router", - 2516: "maincontrol", - 2517: "call-sig-trans", - 2518: "willy", - 2519: "globmsgsvc", - 2520: "pvsw", - 2521: "adaptecmgr", - 2522: "windb", - 2523: "qke-llc-v3", - 2524: "optiwave-lm", - 2525: "ms-v-worlds", - 2526: "ema-sent-lm", - 2527: "iqserver", - 2528: "ncr-ccl", - 2529: "utsftp", - 2530: "vrcommerce", - 2531: "ito-e-gui", - 2532: "ovtopmd", - 2533: "snifferserver", - 2534: "combox-web-acc", - 2535: "madcap", - 2536: "btpp2audctr1", - 2537: "upgrade", - 2538: "vnwk-prapi", - 2539: "vsiadmin", - 2540: "lonworks", - 2541: "lonworks2", - 2542: "udrawgraph", - 2543: "reftek", - 2544: "novell-zen", - 2545: "sis-emt", - 2546: "vytalvaultbrtp", - 2547: "vytalvaultvsmp", - 2548: "vytalvaultpipe", - 2549: "ipass", - 2550: "ads", - 2551: "isg-uda-server", - 2552: "call-logging", - 2553: "efidiningport", - 2554: "vcnet-link-v10", - 2555: "compaq-wcp", - 2556: "nicetec-nmsvc", - 2557: "nicetec-mgmt", - 2558: "pclemultimedia", - 2559: "lstp", - 2560: "labrat", - 2561: "mosaixcc", - 2562: "delibo", - 2563: "cti-redwood", - 2564: "hp-3000-telnet", - 2565: "coord-svr", - 2566: "pcs-pcw", - 2567: "clp", - 2568: "spamtrap", - 2569: "sonuscallsig", - 2570: "hs-port", - 2571: "cecsvc", - 2572: "ibp", - 2573: "trustestablish", - 2574: "blockade-bpsp", - 2575: "hl7", - 2576: "tclprodebugger", - 2577: "scipticslsrvr", - 2578: "rvs-isdn-dcp", - 2579: "mpfoncl", - 2580: "tributary", - 2581: "argis-te", - 2582: "argis-ds", - 2583: "mon", - 2584: "cyaserv", - 2585: "netx-server", - 2586: "netx-agent", - 2587: "masc", - 2588: "privilege", - 2589: "quartus-tcl", - 2590: "idotdist", - 2591: "maytagshuffle", - 2592: "netrek", - 2593: "mns-mail", - 2594: "dts", - 2595: "worldfusion1", - 2596: "worldfusion2", - 2597: "homesteadglory", - 2598: "citriximaclient", - 2599: "snapd", - 2600: "hpstgmgr", - 2601: "discp-client", - 2602: "discp-server", - 2603: "servicemeter", - 2604: "nsc-ccs", - 2605: "nsc-posa", - 2606: "netmon", - 2607: "connection", - 2608: "wag-service", - 2609: "system-monitor", - 2610: "versa-tek", - 2611: "lionhead", - 2612: "qpasa-agent", - 2613: "smntubootstrap", - 2614: "neveroffline", - 2615: "firepower", - 2616: "appswitch-emp", - 2617: "cmadmin", - 2618: "priority-e-com", - 2619: "bruce", - 2620: "lpsrecommender", - 2621: "miles-apart", - 2622: "metricadbc", - 2623: "lmdp", - 2624: "aria", - 2625: "blwnkl-port", - 2626: "gbjd816", - 2627: "moshebeeri", - 2628: "dict", - 2629: "sitaraserver", - 2630: "sitaramgmt", - 2631: "sitaradir", - 2632: "irdg-post", - 2633: "interintelli", - 2634: "pk-electronics", - 2635: "backburner", - 2636: "solve", - 2637: "imdocsvc", - 2638: "sybaseanywhere", - 2639: "aminet", - 2640: "ami-control", - 2641: "hdl-srv", - 2642: "tragic", - 2643: "gte-samp", - 2644: "travsoft-ipx-t", - 2645: "novell-ipx-cmd", - 2646: "and-lm", - 2647: "syncserver", - 2648: "upsnotifyprot", - 2649: "vpsipport", - 2650: "eristwoguns", - 2651: "ebinsite", - 2652: "interpathpanel", - 2653: "sonus", - 2654: "corel-vncadmin", - 2655: "unglue", - 2656: "kana", - 2657: "sns-dispatcher", - 2658: "sns-admin", - 2659: "sns-query", - 2660: "gcmonitor", - 2661: "olhost", - 2662: "bintec-capi", - 2663: "bintec-tapi", - 2664: "patrol-mq-gm", - 2665: "patrol-mq-nm", - 2666: "extensis", - 2667: "alarm-clock-s", - 2668: "alarm-clock-c", - 2669: "toad", - 2670: "tve-announce", - 2671: "newlixreg", - 2672: "nhserver", - 2673: "firstcall42", - 2674: "ewnn", - 2675: "ttc-etap", - 2676: "simslink", - 2677: "gadgetgate1way", - 2678: "gadgetgate2way", - 2679: "syncserverssl", - 2680: "pxc-sapxom", - 2681: "mpnjsomb", - 2683: "ncdloadbalance", - 2684: "mpnjsosv", - 2685: "mpnjsocl", - 2686: "mpnjsomg", - 2687: "pq-lic-mgmt", - 2688: "md-cg-http", - 2689: "fastlynx", - 2690: "hp-nnm-data", - 2691: "itinternet", - 2692: "admins-lms", - 2694: "pwrsevent", - 2695: "vspread", - 2696: "unifyadmin", - 2697: "oce-snmp-trap", - 2698: "mck-ivpip", - 2699: "csoft-plusclnt", - 2700: "tqdata", - 2701: "sms-rcinfo", - 2702: "sms-xfer", - 2703: "sms-chat", - 2704: "sms-remctrl", - 2705: "sds-admin", - 2706: "ncdmirroring", - 2707: "emcsymapiport", - 2708: "banyan-net", - 2709: "supermon", - 2710: "sso-service", - 2711: "sso-control", - 2712: "aocp", - 2713: "raventbs", - 2714: "raventdm", - 2715: "hpstgmgr2", - 2716: "inova-ip-disco", - 2717: "pn-requester", - 2718: "pn-requester2", - 2719: "scan-change", - 2720: "wkars", - 2721: "smart-diagnose", - 2722: "proactivesrvr", - 2723: "watchdog-nt", - 2724: "qotps", - 2725: "msolap-ptp2", - 2726: "tams", - 2727: "mgcp-callagent", - 2728: "sqdr", - 2729: "tcim-control", - 2730: "nec-raidplus", - 2731: "fyre-messanger", - 2732: "g5m", - 2733: "signet-ctf", - 2734: "ccs-software", - 2735: "netiq-mc", - 2736: "radwiz-nms-srv", - 2737: "srp-feedback", - 2738: "ndl-tcp-ois-gw", - 2739: "tn-timing", - 2740: "alarm", - 2741: "tsb", - 2742: "tsb2", - 2743: "murx", - 2744: "honyaku", - 2745: "urbisnet", - 2746: "cpudpencap", - 2747: "fjippol-swrly", - 2748: "fjippol-polsvr", - 2749: "fjippol-cnsl", - 2750: "fjippol-port1", - 2751: "fjippol-port2", - 2752: "rsisysaccess", - 2753: "de-spot", - 2754: "apollo-cc", - 2755: "expresspay", - 2756: "simplement-tie", - 2757: "cnrp", - 2758: "apollo-status", - 2759: "apollo-gms", - 2760: "sabams", - 2761: "dicom-iscl", - 2762: "dicom-tls", - 2763: "desktop-dna", - 2764: "data-insurance", - 2765: "qip-audup", - 2766: "compaq-scp", - 2767: "uadtc", - 2768: "uacs", - 2769: "exce", - 2770: "veronica", - 2771: "vergencecm", - 2772: "auris", - 2773: "rbakcup1", - 2774: "rbakcup2", - 2775: "smpp", - 2776: "ridgeway1", - 2777: "ridgeway2", - 2778: "gwen-sonya", - 2779: "lbc-sync", - 2780: "lbc-control", - 2781: "whosells", - 2782: "everydayrc", - 2783: "aises", - 2784: "www-dev", - 2785: "aic-np", - 2786: "aic-oncrpc", - 2787: "piccolo", - 2788: "fryeserv", - 2789: "media-agent", - 2790: "plgproxy", - 2791: "mtport-regist", - 2792: "f5-globalsite", - 2793: "initlsmsad", - 2795: "livestats", - 2796: "ac-tech", - 2797: "esp-encap", - 2798: "tmesis-upshot", - 2799: "icon-discover", - 2800: "acc-raid", - 2801: "igcp", - 2802: "veritas-udp1", - 2803: "btprjctrl", - 2804: "dvr-esm", - 2805: "wta-wsp-s", - 2806: "cspuni", - 2807: "cspmulti", - 2808: "j-lan-p", - 2809: "corbaloc", - 2810: "netsteward", - 2811: "gsiftp", - 2812: "atmtcp", - 2813: "llm-pass", - 2814: "llm-csv", - 2815: "lbc-measure", - 2816: "lbc-watchdog", - 2817: "nmsigport", - 2818: "rmlnk", - 2819: "fc-faultnotify", - 2820: "univision", - 2821: "vrts-at-port", - 2822: "ka0wuc", - 2823: "cqg-netlan", - 2824: "cqg-netlan-1", - 2826: "slc-systemlog", - 2827: "slc-ctrlrloops", - 2828: "itm-lm", - 2829: "silkp1", - 2830: "silkp2", - 2831: "silkp3", - 2832: "silkp4", - 2833: "glishd", - 2834: "evtp", - 2835: "evtp-data", - 2836: "catalyst", - 2837: "repliweb", - 2838: "starbot", - 2839: "nmsigport", - 2840: "l3-exprt", - 2841: "l3-ranger", - 2842: "l3-hawk", - 2843: "pdnet", - 2844: "bpcp-poll", - 2845: "bpcp-trap", - 2846: "aimpp-hello", - 2847: "aimpp-port-req", - 2848: "amt-blc-port", - 2849: "fxp", - 2850: "metaconsole", - 2851: "webemshttp", - 2852: "bears-01", - 2853: "ispipes", - 2854: "infomover", - 2856: "cesdinv", - 2857: "simctlp", - 2858: "ecnp", - 2859: "activememory", - 2860: "dialpad-voice1", - 2861: "dialpad-voice2", - 2862: "ttg-protocol", - 2863: "sonardata", - 2864: "astromed-main", - 2865: "pit-vpn", - 2866: "iwlistener", - 2867: "esps-portal", - 2868: "npep-messaging", - 2869: "icslap", - 2870: "daishi", - 2871: "msi-selectplay", - 2872: "radix", - 2874: "dxmessagebase1", - 2875: "dxmessagebase2", - 2876: "sps-tunnel", - 2877: "bluelance", - 2878: "aap", - 2879: "ucentric-ds", - 2880: "synapse", - 2881: "ndsp", - 2882: "ndtp", - 2883: "ndnp", - 2884: "flashmsg", - 2885: "topflow", - 2886: "responselogic", - 2887: "aironetddp", - 2888: "spcsdlobby", - 2889: "rsom", - 2890: "cspclmulti", - 2891: "cinegrfx-elmd", - 2892: "snifferdata", - 2893: "vseconnector", - 2894: "abacus-remote", - 2895: "natuslink", - 2896: "ecovisiong6-1", - 2897: "citrix-rtmp", - 2898: "appliance-cfg", - 2899: "powergemplus", - 2900: "quicksuite", - 2901: "allstorcns", - 2902: "netaspi", - 2903: "suitcase", - 2904: "m2ua", - 2906: "caller9", - 2907: "webmethods-b2b", - 2908: "mao", - 2909: "funk-dialout", - 2910: "tdaccess", - 2911: "blockade", - 2912: "epicon", - 2913: "boosterware", - 2914: "gamelobby", - 2915: "tksocket", - 2916: "elvin-server", - 2917: "elvin-client", - 2918: "kastenchasepad", - 2919: "roboer", - 2920: "roboeda", - 2921: "cesdcdman", - 2922: "cesdcdtrn", - 2923: "wta-wsp-wtp-s", - 2924: "precise-vip", - 2926: "mobile-file-dl", - 2927: "unimobilectrl", - 2928: "redstone-cpss", - 2929: "amx-webadmin", - 2930: "amx-weblinx", - 2931: "circle-x", - 2932: "incp", - 2933: "4-tieropmgw", - 2934: "4-tieropmcli", - 2935: "qtp", - 2936: "otpatch", - 2937: "pnaconsult-lm", - 2938: "sm-pas-1", - 2939: "sm-pas-2", - 2940: "sm-pas-3", - 2941: "sm-pas-4", - 2942: "sm-pas-5", - 2943: "ttnrepository", - 2944: "megaco-h248", - 2945: "h248-binary", - 2946: "fjsvmpor", - 2947: "gpsd", - 2948: "wap-push", - 2949: "wap-pushsecure", - 2950: "esip", - 2951: "ottp", - 2952: "mpfwsas", - 2953: "ovalarmsrv", - 2954: "ovalarmsrv-cmd", - 2955: "csnotify", - 2956: "ovrimosdbman", - 2957: "jmact5", - 2958: "jmact6", - 2959: "rmopagt", - 2960: "dfoxserver", - 2961: "boldsoft-lm", - 2962: "iph-policy-cli", - 2963: "iph-policy-adm", - 2964: "bullant-srap", - 2965: "bullant-rap", - 2966: "idp-infotrieve", - 2967: "ssc-agent", - 2968: "enpp", - 2969: "essp", - 2970: "index-net", - 2971: "netclip", - 2972: "pmsm-webrctl", - 2973: "svnetworks", - 2974: "signal", - 2975: "fjmpcm", - 2976: "cns-srv-port", - 2977: "ttc-etap-ns", - 2978: "ttc-etap-ds", - 2979: "h263-video", - 2980: "wimd", - 2981: "mylxamport", - 2982: "iwb-whiteboard", - 2983: "netplan", - 2984: "hpidsadmin", - 2985: "hpidsagent", - 2986: "stonefalls", - 2987: "identify", - 2988: "hippad", - 2989: "zarkov", - 2990: "boscap", - 2991: "wkstn-mon", - 2992: "avenyo", - 2993: "veritas-vis1", - 2994: "veritas-vis2", - 2995: "idrs", - 2996: "vsixml", - 2997: "rebol", - 2998: "realsecure", - 2999: "remoteware-un", - 3000: "hbci", - 3002: "exlm-agent", - 3003: "cgms", - 3004: "csoftragent", - 3005: "geniuslm", - 3006: "ii-admin", - 3007: "lotusmtap", - 3008: "midnight-tech", - 3009: "pxc-ntfy", - 3010: "ping-pong", - 3011: "trusted-web", - 3012: "twsdss", - 3013: "gilatskysurfer", - 3014: "broker-service", - 3015: "nati-dstp", - 3016: "notify-srvr", - 3017: "event-listener", - 3018: "srvc-registry", - 3019: "resource-mgr", - 3020: "cifs", - 3021: "agriserver", - 3022: "csregagent", - 3023: "magicnotes", - 3024: "nds-sso", - 3025: "arepa-raft", - 3026: "agri-gateway", - 3027: "LiebDevMgmt-C", - 3028: "LiebDevMgmt-DM", - 3029: "LiebDevMgmt-A", - 3030: "arepa-cas", - 3031: "eppc", - 3032: "redwood-chat", - 3033: "pdb", - 3034: "osmosis-aeea", - 3035: "fjsv-gssagt", - 3036: "hagel-dump", - 3037: "hp-san-mgmt", - 3038: "santak-ups", - 3039: "cogitate", - 3040: "tomato-springs", - 3041: "di-traceware", - 3042: "journee", - 3043: "brp", - 3044: "epp", - 3045: "responsenet", - 3046: "di-ase", - 3047: "hlserver", - 3048: "pctrader", - 3049: "nsws", - 3050: "gds-db", - 3051: "galaxy-server", - 3052: "apc-3052", - 3053: "dsom-server", - 3054: "amt-cnf-prot", - 3055: "policyserver", - 3056: "cdl-server", - 3057: "goahead-fldup", - 3058: "videobeans", - 3059: "qsoft", - 3060: "interserver", - 3061: "cautcpd", - 3062: "ncacn-ip-tcp", - 3063: "ncadg-ip-udp", - 3064: "rprt", - 3065: "slinterbase", - 3066: "netattachsdmp", - 3067: "fjhpjp", - 3068: "ls3bcast", - 3069: "ls3", - 3070: "mgxswitch", - 3072: "csd-monitor", - 3073: "vcrp", - 3074: "xbox", - 3075: "orbix-locator", - 3076: "orbix-config", - 3077: "orbix-loc-ssl", - 3078: "orbix-cfg-ssl", - 3079: "lv-frontpanel", - 3080: "stm-pproc", - 3081: "tl1-lv", - 3082: "tl1-raw", - 3083: "tl1-telnet", - 3084: "itm-mccs", - 3085: "pcihreq", - 3086: "jdl-dbkitchen", - 3087: "asoki-sma", - 3088: "xdtp", - 3089: "ptk-alink", - 3090: "stss", - 3091: "1ci-smcs", - 3093: "rapidmq-center", - 3094: "rapidmq-reg", - 3095: "panasas", - 3096: "ndl-aps", - 3098: "umm-port", - 3099: "chmd", - 3100: "opcon-xps", - 3101: "hp-pxpib", - 3102: "slslavemon", - 3103: "autocuesmi", - 3104: "autocuetime", - 3105: "cardbox", - 3106: "cardbox-http", - 3107: "business", - 3108: "geolocate", - 3109: "personnel", - 3110: "sim-control", - 3111: "wsynch", - 3112: "ksysguard", - 3113: "cs-auth-svr", - 3114: "ccmad", - 3115: "mctet-master", - 3116: "mctet-gateway", - 3117: "mctet-jserv", - 3118: "pkagent", - 3119: "d2000kernel", - 3120: "d2000webserver", - 3122: "vtr-emulator", - 3123: "edix", - 3124: "beacon-port", - 3125: "a13-an", - 3127: "ctx-bridge", - 3128: "ndl-aas", - 3129: "netport-id", - 3130: "icpv2", - 3131: "netbookmark", - 3132: "ms-rule-engine", - 3133: "prism-deploy", - 3134: "ecp", - 3135: "peerbook-port", - 3136: "grubd", - 3137: "rtnt-1", - 3138: "rtnt-2", - 3139: "incognitorv", - 3140: "ariliamulti", - 3141: "vmodem", - 3142: "rdc-wh-eos", - 3143: "seaview", - 3144: "tarantella", - 3145: "csi-lfap", - 3146: "bears-02", - 3147: "rfio", - 3148: "nm-game-admin", - 3149: "nm-game-server", - 3150: "nm-asses-admin", - 3151: "nm-assessor", - 3152: "feitianrockey", - 3153: "s8-client-port", - 3154: "ccmrmi", - 3155: "jpegmpeg", - 3156: "indura", - 3157: "e3consultants", - 3158: "stvp", - 3159: "navegaweb-port", - 3160: "tip-app-server", - 3161: "doc1lm", - 3162: "sflm", - 3163: "res-sap", - 3164: "imprs", - 3165: "newgenpay", - 3166: "sossecollector", - 3167: "nowcontact", - 3168: "poweronnud", - 3169: "serverview-as", - 3170: "serverview-asn", - 3171: "serverview-gf", - 3172: "serverview-rm", - 3173: "serverview-icc", - 3174: "armi-server", - 3175: "t1-e1-over-ip", - 3176: "ars-master", - 3177: "phonex-port", - 3178: "radclientport", - 3179: "h2gf-w-2m", - 3180: "mc-brk-srv", - 3181: "bmcpatrolagent", - 3182: "bmcpatrolrnvu", - 3183: "cops-tls", - 3184: "apogeex-port", - 3185: "smpppd", - 3186: "iiw-port", - 3187: "odi-port", - 3188: "brcm-comm-port", - 3189: "pcle-infex", - 3190: "csvr-proxy", - 3191: "csvr-sslproxy", - 3192: "firemonrcc", - 3193: "spandataport", - 3194: "magbind", - 3195: "ncu-1", - 3196: "ncu-2", - 3197: "embrace-dp-s", - 3198: "embrace-dp-c", - 3199: "dmod-workspace", - 3200: "tick-port", - 3201: "cpq-tasksmart", - 3202: "intraintra", - 3203: "netwatcher-mon", - 3204: "netwatcher-db", - 3205: "isns", - 3206: "ironmail", - 3207: "vx-auth-port", - 3208: "pfu-prcallback", - 3209: "netwkpathengine", - 3210: "flamenco-proxy", - 3211: "avsecuremgmt", - 3212: "surveyinst", - 3213: "neon24x7", - 3214: "jmq-daemon-1", - 3215: "jmq-daemon-2", - 3216: "ferrari-foam", - 3217: "unite", - 3218: "smartpackets", - 3219: "wms-messenger", - 3220: "xnm-ssl", - 3221: "xnm-clear-text", - 3222: "glbp", - 3223: "digivote", - 3224: "aes-discovery", - 3225: "fcip-port", - 3226: "isi-irp", - 3227: "dwnmshttp", - 3228: "dwmsgserver", - 3229: "global-cd-port", - 3230: "sftdst-port", - 3231: "vidigo", - 3232: "mdtp", - 3233: "whisker", - 3234: "alchemy", - 3235: "mdap-port", - 3236: "apparenet-ts", - 3237: "apparenet-tps", - 3238: "apparenet-as", - 3239: "apparenet-ui", - 3240: "triomotion", - 3241: "sysorb", - 3242: "sdp-id-port", - 3243: "timelot", - 3244: "onesaf", - 3245: "vieo-fe", - 3246: "dvt-system", - 3247: "dvt-data", - 3248: "procos-lm", - 3249: "ssp", - 3250: "hicp", - 3251: "sysscanner", - 3252: "dhe", - 3253: "pda-data", - 3254: "pda-sys", - 3255: "semaphore", - 3256: "cpqrpm-agent", - 3257: "cpqrpm-server", - 3258: "ivecon-port", - 3259: "epncdp2", - 3260: "iscsi-target", - 3261: "winshadow", - 3262: "necp", - 3263: "ecolor-imager", - 3264: "ccmail", - 3265: "altav-tunnel", - 3266: "ns-cfg-server", - 3267: "ibm-dial-out", - 3268: "msft-gc", - 3269: "msft-gc-ssl", - 3270: "verismart", - 3271: "csoft-prev", - 3272: "user-manager", - 3273: "sxmp", - 3274: "ordinox-server", - 3275: "samd", - 3276: "maxim-asics", - 3277: "awg-proxy", - 3278: "lkcmserver", - 3279: "admind", - 3280: "vs-server", - 3281: "sysopt", - 3282: "datusorb", - 3283: "Apple Remote Desktop (Net Assistant)", - 3284: "4talk", - 3285: "plato", - 3286: "e-net", - 3287: "directvdata", - 3288: "cops", - 3289: "enpc", - 3290: "caps-lm", - 3291: "sah-lm", - 3292: "cart-o-rama", - 3293: "fg-fps", - 3294: "fg-gip", - 3295: "dyniplookup", - 3296: "rib-slm", - 3297: "cytel-lm", - 3298: "deskview", - 3299: "pdrncs", - 3302: "mcs-fastmail", - 3303: "opsession-clnt", - 3304: "opsession-srvr", - 3305: "odette-ftp", - 3306: "mysql", - 3307: "opsession-prxy", - 3308: "tns-server", - 3309: "tns-adv", - 3310: "dyna-access", - 3311: "mcns-tel-ret", - 3312: "appman-server", - 3313: "uorb", - 3314: "uohost", - 3315: "cdid", - 3316: "aicc-cmi", - 3317: "vsaiport", - 3318: "ssrip", - 3319: "sdt-lmd", - 3320: "officelink2000", - 3321: "vnsstr", - 3326: "sftu", - 3327: "bbars", - 3328: "egptlm", - 3329: "hp-device-disc", - 3330: "mcs-calypsoicf", - 3331: "mcs-messaging", - 3332: "mcs-mailsvr", - 3333: "dec-notes", - 3334: "directv-web", - 3335: "directv-soft", - 3336: "directv-tick", - 3337: "directv-catlg", - 3338: "anet-b", - 3339: "anet-l", - 3340: "anet-m", - 3341: "anet-h", - 3342: "webtie", - 3343: "ms-cluster-net", - 3344: "bnt-manager", - 3345: "influence", - 3346: "trnsprntproxy", - 3347: "phoenix-rpc", - 3348: "pangolin-laser", - 3349: "chevinservices", - 3350: "findviatv", - 3351: "btrieve", - 3352: "ssql", - 3353: "fatpipe", - 3354: "suitjd", - 3355: "ordinox-dbase", - 3356: "upnotifyps", - 3357: "adtech-test", - 3358: "mpsysrmsvr", - 3359: "wg-netforce", - 3360: "kv-server", - 3361: "kv-agent", - 3362: "dj-ilm", - 3363: "nati-vi-server", - 3364: "creativeserver", - 3365: "contentserver", - 3366: "creativepartnr", - 3372: "tip2", - 3373: "lavenir-lm", - 3374: "cluster-disc", - 3375: "vsnm-agent", - 3376: "cdbroker", - 3377: "cogsys-lm", - 3378: "wsicopy", - 3379: "socorfs", - 3380: "sns-channels", - 3381: "geneous", - 3382: "fujitsu-neat", - 3383: "esp-lm", - 3384: "hp-clic", - 3385: "qnxnetman", - 3386: "gprs-sig", - 3387: "backroomnet", - 3388: "cbserver", - 3389: "ms-wbt-server", - 3390: "dsc", - 3391: "savant", - 3392: "efi-lm", - 3393: "d2k-tapestry1", - 3394: "d2k-tapestry2", - 3395: "dyna-lm", - 3396: "printer-agent", - 3397: "cloanto-lm", - 3398: "mercantile", - 3399: "csms", - 3400: "csms2", - 3401: "filecast", - 3402: "fxaengine-net", - 3405: "nokia-ann-ch1", - 3406: "nokia-ann-ch2", - 3407: "ldap-admin", - 3408: "BESApi", - 3409: "networklens", - 3410: "networklenss", - 3411: "biolink-auth", - 3412: "xmlblaster", - 3413: "svnet", - 3414: "wip-port", - 3415: "bcinameservice", - 3416: "commandport", - 3417: "csvr", - 3418: "rnmap", - 3419: "softaudit", - 3420: "ifcp-port", - 3421: "bmap", - 3422: "rusb-sys-port", - 3423: "xtrm", - 3424: "xtrms", - 3425: "agps-port", - 3426: "arkivio", - 3427: "websphere-snmp", - 3428: "twcss", - 3429: "gcsp", - 3430: "ssdispatch", - 3431: "ndl-als", - 3432: "osdcp", - 3433: "opnet-smp", - 3434: "opencm", - 3435: "pacom", - 3436: "gc-config", - 3437: "autocueds", - 3438: "spiral-admin", - 3439: "hri-port", - 3440: "ans-console", - 3441: "connect-client", - 3442: "connect-server", - 3443: "ov-nnm-websrv", - 3444: "denali-server", - 3445: "monp", - 3446: "3comfaxrpc", - 3447: "directnet", - 3448: "dnc-port", - 3449: "hotu-chat", - 3450: "castorproxy", - 3451: "asam", - 3452: "sabp-signal", - 3453: "pscupd", - 3454: "mira", - 3455: "prsvp", - 3456: "vat", - 3457: "vat-control", - 3458: "d3winosfi", - 3459: "integral", - 3460: "edm-manager", - 3461: "edm-stager", - 3462: "edm-std-notify", - 3463: "edm-adm-notify", - 3464: "edm-mgr-sync", - 3465: "edm-mgr-cntrl", - 3466: "workflow", - 3467: "rcst", - 3468: "ttcmremotectrl", - 3469: "pluribus", - 3470: "jt400", - 3471: "jt400-ssl", - 3472: "jaugsremotec-1", - 3473: "jaugsremotec-2", - 3474: "ttntspauto", - 3475: "genisar-port", - 3476: "nppmp", - 3477: "ecomm", - 3478: "stun", - 3479: "twrpc", - 3480: "plethora", - 3481: "cleanerliverc", - 3482: "vulture", - 3483: "slim-devices", - 3484: "gbs-stp", - 3485: "celatalk", - 3486: "ifsf-hb-port", - 3487: "ltcudp", - 3488: "fs-rh-srv", - 3489: "dtp-dia", - 3490: "colubris", - 3491: "swr-port", - 3492: "tvdumtray-port", - 3493: "nut", - 3494: "ibm3494", - 3495: "seclayer-tcp", - 3496: "seclayer-tls", - 3497: "ipether232port", - 3498: "dashpas-port", - 3499: "sccip-media", - 3500: "rtmp-port", - 3501: "isoft-p2p", - 3502: "avinstalldisc", - 3503: "lsp-ping", - 3504: "ironstorm", - 3505: "ccmcomm", - 3506: "apc-3506", - 3507: "nesh-broker", - 3508: "interactionweb", - 3509: "vt-ssl", - 3510: "xss-port", - 3511: "webmail-2", - 3512: "aztec", - 3513: "arcpd", - 3514: "must-p2p", - 3515: "must-backplane", - 3516: "smartcard-port", - 3517: "802-11-iapp", - 3518: "artifact-msg", - 3519: "galileo", - 3520: "galileolog", - 3521: "mc3ss", - 3522: "nssocketport", - 3523: "odeumservlink", - 3524: "ecmport", - 3525: "eisport", - 3526: "starquiz-port", - 3527: "beserver-msg-q", - 3528: "jboss-iiop", - 3529: "jboss-iiop-ssl", - 3530: "gf", - 3531: "joltid", - 3532: "raven-rmp", - 3533: "raven-rdp", - 3534: "urld-port", - 3535: "ms-la", - 3536: "snac", - 3537: "ni-visa-remote", - 3538: "ibm-diradm", - 3539: "ibm-diradm-ssl", - 3540: "pnrp-port", - 3541: "voispeed-port", - 3542: "hacl-monitor", - 3543: "qftest-lookup", - 3544: "teredo", - 3545: "camac", - 3547: "symantec-sim", - 3548: "interworld", - 3549: "tellumat-nms", - 3550: "ssmpp", - 3551: "apcupsd", - 3552: "taserver", - 3553: "rbr-discovery", - 3554: "questnotify", - 3555: "razor", - 3556: "sky-transport", - 3557: "personalos-001", - 3558: "mcp-port", - 3559: "cctv-port", - 3560: "iniserve-port", - 3561: "bmc-onekey", - 3562: "sdbproxy", - 3563: "watcomdebug", - 3564: "esimport", - 3567: "dof-eps", - 3568: "dof-tunnel-sec", - 3569: "mbg-ctrl", - 3570: "mccwebsvr-port", - 3571: "megardsvr-port", - 3572: "megaregsvrport", - 3573: "tag-ups-1", - 3574: "dmaf-caster", - 3575: "ccm-port", - 3576: "cmc-port", - 3577: "config-port", - 3578: "data-port", - 3579: "ttat3lb", - 3580: "nati-svrloc", - 3581: "kfxaclicensing", - 3582: "press", - 3583: "canex-watch", - 3584: "u-dbap", - 3585: "emprise-lls", - 3586: "emprise-lsc", - 3587: "p2pgroup", - 3588: "sentinel", - 3589: "isomair", - 3590: "wv-csp-sms", - 3591: "gtrack-server", - 3592: "gtrack-ne", - 3593: "bpmd", - 3594: "mediaspace", - 3595: "shareapp", - 3596: "iw-mmogame", - 3597: "a14", - 3598: "a15", - 3599: "quasar-server", - 3600: "trap-daemon", - 3601: "visinet-gui", - 3602: "infiniswitchcl", - 3603: "int-rcv-cntrl", - 3604: "bmc-jmx-port", - 3605: "comcam-io", - 3606: "splitlock", - 3607: "precise-i3", - 3608: "trendchip-dcp", - 3609: "cpdi-pidas-cm", - 3610: "echonet", - 3611: "six-degrees", - 3612: "hp-dataprotect", - 3613: "alaris-disc", - 3614: "sigma-port", - 3615: "start-network", - 3616: "cd3o-protocol", - 3617: "sharp-server", - 3618: "aairnet-1", - 3619: "aairnet-2", - 3620: "ep-pcp", - 3621: "ep-nsp", - 3622: "ff-lr-port", - 3623: "haipe-discover", - 3624: "dist-upgrade", - 3625: "volley", - 3626: "bvcdaemon-port", - 3627: "jamserverport", - 3628: "ept-machine", - 3629: "escvpnet", - 3630: "cs-remote-db", - 3631: "cs-services", - 3632: "distcc", - 3633: "wacp", - 3634: "hlibmgr", - 3635: "sdo", - 3636: "servistaitsm", - 3637: "scservp", - 3638: "ehp-backup", - 3639: "xap-ha", - 3640: "netplay-port1", - 3641: "netplay-port2", - 3642: "juxml-port", - 3643: "audiojuggler", - 3644: "ssowatch", - 3645: "cyc", - 3646: "xss-srv-port", - 3647: "splitlock-gw", - 3648: "fjcp", - 3649: "nmmp", - 3650: "prismiq-plugin", - 3651: "xrpc-registry", - 3652: "vxcrnbuport", - 3653: "tsp", - 3654: "vaprtm", - 3655: "abatemgr", - 3656: "abatjss", - 3657: "immedianet-bcn", - 3658: "ps-ams", - 3659: "apple-sasl", - 3660: "can-nds-ssl", - 3661: "can-ferret-ssl", - 3662: "pserver", - 3663: "dtp", - 3664: "ups-engine", - 3665: "ent-engine", - 3666: "eserver-pap", - 3667: "infoexch", - 3668: "dell-rm-port", - 3669: "casanswmgmt", - 3670: "smile", - 3671: "efcp", - 3672: "lispworks-orb", - 3673: "mediavault-gui", - 3674: "wininstall-ipc", - 3675: "calltrax", - 3676: "va-pacbase", - 3677: "roverlog", - 3678: "ipr-dglt", - 3679: "Escale (Newton Dock)", - 3680: "npds-tracker", - 3681: "bts-x73", - 3682: "cas-mapi", - 3683: "bmc-ea", - 3684: "faxstfx-port", - 3685: "dsx-agent", - 3686: "tnmpv2", - 3687: "simple-push", - 3688: "simple-push-s", - 3689: "daap", - 3690: "svn", - 3691: "magaya-network", - 3692: "intelsync", - 3695: "bmc-data-coll", - 3696: "telnetcpcd", - 3697: "nw-license", - 3698: "sagectlpanel", - 3699: "kpn-icw", - 3700: "lrs-paging", - 3701: "netcelera", - 3702: "ws-discovery", - 3703: "adobeserver-3", - 3704: "adobeserver-4", - 3705: "adobeserver-5", - 3706: "rt-event", - 3707: "rt-event-s", - 3708: "sun-as-iiops", - 3709: "ca-idms", - 3710: "portgate-auth", - 3711: "edb-server2", - 3712: "sentinel-ent", - 3713: "tftps", - 3714: "delos-dms", - 3715: "anoto-rendezv", - 3716: "wv-csp-sms-cir", - 3717: "wv-csp-udp-cir", - 3718: "opus-services", - 3719: "itelserverport", - 3720: "ufastro-instr", - 3721: "xsync", - 3722: "xserveraid", - 3723: "sychrond", - 3724: "blizwow", - 3725: "na-er-tip", - 3726: "array-manager", - 3727: "e-mdu", - 3728: "e-woa", - 3729: "fksp-audit", - 3730: "client-ctrl", - 3731: "smap", - 3732: "m-wnn", - 3733: "multip-msg", - 3734: "synel-data", - 3735: "pwdis", - 3736: "rs-rmi", - 3738: "versatalk", - 3739: "launchbird-lm", - 3740: "heartbeat", - 3741: "wysdma", - 3742: "cst-port", - 3743: "ipcs-command", - 3744: "sasg", - 3745: "gw-call-port", - 3746: "linktest", - 3747: "linktest-s", - 3748: "webdata", - 3749: "cimtrak", - 3750: "cbos-ip-port", - 3751: "gprs-cube", - 3752: "vipremoteagent", - 3753: "nattyserver", - 3754: "timestenbroker", - 3755: "sas-remote-hlp", - 3756: "canon-capt", - 3757: "grf-port", - 3758: "apw-registry", - 3759: "exapt-lmgr", - 3760: "adtempusclient", - 3761: "gsakmp", - 3762: "gbs-smp", - 3763: "xo-wave", - 3764: "mni-prot-rout", - 3765: "rtraceroute", - 3767: "listmgr-port", - 3768: "rblcheckd", - 3769: "haipe-otnk", - 3770: "cindycollab", - 3771: "paging-port", - 3772: "ctp", - 3773: "ctdhercules", - 3774: "zicom", - 3775: "ispmmgr", - 3776: "dvcprov-port", - 3777: "jibe-eb", - 3778: "c-h-it-port", - 3779: "cognima", - 3780: "nnp", - 3781: "abcvoice-port", - 3782: "iso-tp0s", - 3783: "bim-pem", - 3784: "bfd-control", - 3785: "bfd-echo", - 3786: "upstriggervsw", - 3787: "fintrx", - 3788: "isrp-port", - 3789: "remotedeploy", - 3790: "quickbooksrds", - 3791: "tvnetworkvideo", - 3792: "sitewatch", - 3793: "dcsoftware", - 3794: "jaus", - 3795: "myblast", - 3796: "spw-dialer", - 3797: "idps", - 3798: "minilock", - 3799: "radius-dynauth", - 3800: "pwgpsi", - 3801: "ibm-mgr", - 3802: "vhd", - 3803: "soniqsync", - 3804: "iqnet-port", - 3805: "tcpdataserver", - 3806: "wsmlb", - 3807: "spugna", - 3808: "sun-as-iiops-ca", - 3809: "apocd", - 3810: "wlanauth", - 3811: "amp", - 3812: "neto-wol-server", - 3813: "rap-ip", - 3814: "neto-dcs", - 3815: "lansurveyorxml", - 3816: "sunlps-http", - 3817: "tapeware", - 3818: "crinis-hb", - 3819: "epl-slp", - 3820: "scp", - 3821: "pmcp", - 3822: "acp-discovery", - 3823: "acp-conduit", - 3824: "acp-policy", - 3825: "ffserver", - 3826: "warmux", - 3827: "netmpi", - 3828: "neteh", - 3829: "neteh-ext", - 3830: "cernsysmgmtagt", - 3831: "dvapps", - 3832: "xxnetserver", - 3833: "aipn-auth", - 3834: "spectardata", - 3835: "spectardb", - 3836: "markem-dcp", - 3837: "mkm-discovery", - 3838: "sos", - 3839: "amx-rms", - 3840: "flirtmitmir", - 3842: "nhci", - 3843: "quest-agent", - 3844: "rnm", - 3845: "v-one-spp", - 3846: "an-pcp", - 3847: "msfw-control", - 3848: "item", - 3849: "spw-dnspreload", - 3850: "qtms-bootstrap", - 3851: "spectraport", - 3852: "sse-app-config", - 3853: "sscan", - 3854: "stryker-com", - 3855: "opentrac", - 3856: "informer", - 3857: "trap-port", - 3858: "trap-port-mom", - 3859: "nav-port", - 3860: "sasp", - 3861: "winshadow-hd", - 3862: "giga-pocket", - 3863: "asap-udp", - 3865: "xpl", - 3866: "dzdaemon", - 3867: "dzoglserver", - 3869: "ovsam-mgmt", - 3870: "ovsam-d-agent", - 3871: "avocent-adsap", - 3872: "oem-agent", - 3873: "fagordnc", - 3874: "sixxsconfig", - 3875: "pnbscada", - 3876: "dl-agent", - 3877: "xmpcr-interface", - 3878: "fotogcad", - 3879: "appss-lm", - 3880: "igrs", - 3881: "idac", - 3882: "msdts1", - 3883: "vrpn", - 3884: "softrack-meter", - 3885: "topflow-ssl", - 3886: "nei-management", - 3887: "ciphire-data", - 3888: "ciphire-serv", - 3889: "dandv-tester", - 3890: "ndsconnect", - 3891: "rtc-pm-port", - 3892: "pcc-image-port", - 3893: "cgi-starapi", - 3894: "syam-agent", - 3895: "syam-smc", - 3896: "sdo-tls", - 3897: "sdo-ssh", - 3898: "senip", - 3899: "itv-control", - 3900: "udt-os", - 3901: "nimsh", - 3902: "nimaux", - 3903: "charsetmgr", - 3904: "omnilink-port", - 3905: "mupdate", - 3906: "topovista-data", - 3907: "imoguia-port", - 3908: "hppronetman", - 3909: "surfcontrolcpa", - 3910: "prnrequest", - 3911: "prnstatus", - 3912: "gbmt-stars", - 3913: "listcrt-port", - 3914: "listcrt-port-2", - 3915: "agcat", - 3916: "wysdmc", - 3917: "aftmux", - 3918: "pktcablemmcops", - 3919: "hyperip", - 3920: "exasoftport1", - 3921: "herodotus-net", - 3922: "sor-update", - 3923: "symb-sb-port", - 3924: "mpl-gprs-port", - 3925: "zmp", - 3926: "winport", - 3927: "natdataservice", - 3928: "netboot-pxe", - 3929: "smauth-port", - 3930: "syam-webserver", - 3931: "msr-plugin-port", - 3932: "dyn-site", - 3933: "plbserve-port", - 3934: "sunfm-port", - 3935: "sdp-portmapper", - 3936: "mailprox", - 3937: "dvbservdsc", - 3938: "dbcontrol-agent", - 3939: "aamp", - 3940: "xecp-node", - 3941: "homeportal-web", - 3942: "srdp", - 3943: "tig", - 3944: "sops", - 3945: "emcads", - 3946: "backupedge", - 3947: "ccp", - 3948: "apdap", - 3949: "drip", - 3950: "namemunge", - 3951: "pwgippfax", - 3952: "i3-sessionmgr", - 3953: "xmlink-connect", - 3954: "adrep", - 3955: "p2pcommunity", - 3956: "gvcp", - 3957: "mqe-broker", - 3958: "mqe-agent", - 3959: "treehopper", - 3960: "bess", - 3961: "proaxess", - 3962: "sbi-agent", - 3963: "thrp", - 3964: "sasggprs", - 3965: "ati-ip-to-ncpe", - 3966: "bflckmgr", - 3967: "ppsms", - 3968: "ianywhere-dbns", - 3969: "landmarks", - 3970: "lanrevagent", - 3971: "lanrevserver", - 3972: "iconp", - 3973: "progistics", - 3974: "citysearch", - 3975: "airshot", - 3976: "opswagent", - 3977: "opswmanager", - 3978: "secure-cfg-svr", - 3979: "smwan", - 3980: "acms", - 3981: "starfish", - 3982: "eis", - 3983: "eisp", - 3984: "mapper-nodemgr", - 3985: "mapper-mapethd", - 3986: "mapper-ws-ethd", - 3987: "centerline", - 3988: "dcs-config", - 3989: "bv-queryengine", - 3990: "bv-is", - 3991: "bv-smcsrv", - 3992: "bv-ds", - 3993: "bv-agent", - 3995: "iss-mgmt-ssl", - 3996: "abcsoftware", - 3997: "agentsease-db", - 3998: "dnx", - 3999: "nvcnet", - 4000: "terabase", - 4001: "newoak", - 4002: "pxc-spvr-ft", - 4003: "pxc-splr-ft", - 4004: "pxc-roid", - 4005: "pxc-pin", - 4006: "pxc-spvr", - 4007: "pxc-splr", - 4008: "netcheque", - 4009: "chimera-hwm", - 4010: "samsung-unidex", - 4011: "altserviceboot", - 4012: "pda-gate", - 4013: "acl-manager", - 4014: "taiclock", - 4015: "talarian-mcast1", - 4016: "talarian-mcast2", - 4017: "talarian-mcast3", - 4018: "talarian-mcast4", - 4019: "talarian-mcast5", - 4020: "trap", - 4021: "nexus-portal", - 4022: "dnox", - 4023: "esnm-zoning", - 4024: "tnp1-port", - 4025: "partimage", - 4026: "as-debug", - 4027: "bxp", - 4028: "dtserver-port", - 4029: "ip-qsig", - 4030: "jdmn-port", - 4031: "suucp", - 4032: "vrts-auth-port", - 4033: "sanavigator", - 4034: "ubxd", - 4035: "wap-push-http", - 4036: "wap-push-https", - 4037: "ravehd", - 4038: "fazzt-ptp", - 4039: "fazzt-admin", - 4040: "yo-main", - 4041: "houston", - 4042: "ldxp", - 4043: "nirp", - 4044: "ltp", - 4045: "npp", - 4046: "acp-proto", - 4047: "ctp-state", - 4049: "wafs", - 4050: "cisco-wafs", - 4051: "cppdp", - 4052: "interact", - 4053: "ccu-comm-1", - 4054: "ccu-comm-2", - 4055: "ccu-comm-3", - 4056: "lms", - 4057: "wfm", - 4058: "kingfisher", - 4059: "dlms-cosem", - 4060: "dsmeter-iatc", - 4061: "ice-location", - 4062: "ice-slocation", - 4063: "ice-router", - 4064: "ice-srouter", - 4065: "avanti-cdp", - 4066: "pmas", - 4067: "idp", - 4068: "ipfltbcst", - 4069: "minger", - 4070: "tripe", - 4071: "aibkup", - 4072: "zieto-sock", - 4073: "iRAPP", - 4074: "cequint-cityid", - 4075: "perimlan", - 4076: "seraph", - 4077: "ascomalarm", - 4079: "santools", - 4080: "lorica-in", - 4081: "lorica-in-sec", - 4082: "lorica-out", - 4083: "lorica-out-sec", - 4084: "fortisphere-vm", - 4086: "ftsync", - 4089: "opencore", - 4090: "omasgport", - 4091: "ewinstaller", - 4092: "ewdgs", - 4093: "pvxpluscs", - 4094: "sysrqd", - 4095: "xtgui", - 4096: "bre", - 4097: "patrolview", - 4098: "drmsfsd", - 4099: "dpcp", - 4100: "igo-incognito", - 4101: "brlp-0", - 4102: "brlp-1", - 4103: "brlp-2", - 4104: "brlp-3", - 4105: "shofar", - 4106: "synchronite", - 4107: "j-ac", - 4108: "accel", - 4109: "izm", - 4110: "g2tag", - 4111: "xgrid", - 4112: "apple-vpns-rp", - 4113: "aipn-reg", - 4114: "jomamqmonitor", - 4115: "cds", - 4116: "smartcard-tls", - 4117: "hillrserv", - 4118: "netscript", - 4119: "assuria-slm", - 4121: "e-builder", - 4122: "fprams", - 4123: "z-wave", - 4124: "tigv2", - 4125: "opsview-envoy", - 4126: "ddrepl", - 4127: "unikeypro", - 4128: "nufw", - 4129: "nuauth", - 4130: "fronet", - 4131: "stars", - 4132: "nuts-dem", - 4133: "nuts-bootp", - 4134: "nifty-hmi", - 4135: "cl-db-attach", - 4136: "cl-db-request", - 4137: "cl-db-remote", - 4138: "nettest", - 4139: "thrtx", - 4140: "cedros-fds", - 4141: "oirtgsvc", - 4142: "oidocsvc", - 4143: "oidsr", - 4145: "vvr-control", - 4146: "tgcconnect", - 4147: "vrxpservman", - 4148: "hhb-handheld", - 4149: "agslb", - 4150: "PowerAlert-nsa", - 4151: "menandmice-noh", - 4152: "idig-mux", - 4153: "mbl-battd", - 4154: "atlinks", - 4155: "bzr", - 4156: "stat-results", - 4157: "stat-scanner", - 4158: "stat-cc", - 4159: "nss", - 4160: "jini-discovery", - 4161: "omscontact", - 4162: "omstopology", - 4163: "silverpeakpeer", - 4164: "silverpeakcomm", - 4165: "altcp", - 4166: "joost", - 4167: "ddgn", - 4168: "pslicser", - 4169: "iadt-disc", - 4172: "pcoip", - 4173: "mma-discovery", - 4174: "sm-disc", - 4177: "wello", - 4178: "storman", - 4179: "MaxumSP", - 4180: "httpx", - 4181: "macbak", - 4182: "pcptcpservice", - 4183: "cyborgnet", - 4184: "universe-suite", - 4185: "wcpp", - 4188: "vatata", - 4191: "dsmipv6", - 4192: "azeti-bd", - 4197: "hctl", - 4199: "eims-admin", - 4300: "corelccam", - 4301: "d-data", - 4302: "d-data-control", - 4303: "srcp", - 4304: "owserver", - 4305: "batman", - 4306: "pinghgl", - 4307: "trueconf", - 4308: "compx-lockview", - 4309: "dserver", - 4310: "mirrtex", - 4320: "fdt-rcatp", - 4321: "rwhois", - 4322: "trim-event", - 4323: "trim-ice", - 4325: "geognosisman", - 4326: "geognosis", - 4327: "jaxer-web", - 4328: "jaxer-manager", - 4333: "ahsp", - 4340: "gaia", - 4341: "lisp-data", - 4342: "lisp-control", - 4343: "unicall", - 4344: "vinainstall", - 4345: "m4-network-as", - 4346: "elanlm", - 4347: "lansurveyor", - 4348: "itose", - 4349: "fsportmap", - 4350: "net-device", - 4351: "plcy-net-svcs", - 4352: "pjlink", - 4353: "f5-iquery", - 4354: "qsnet-trans", - 4355: "qsnet-workst", - 4356: "qsnet-assist", - 4357: "qsnet-cond", - 4358: "qsnet-nucl", - 4359: "omabcastltkm", - 4361: "nacnl", - 4362: "afore-vdp-disc", - 4366: "shadowstream", - 4368: "wxbrief", - 4369: "epmd", - 4370: "elpro-tunnel", - 4371: "l2c-disc", - 4372: "l2c-data", - 4373: "remctl", - 4375: "tolteces", - 4376: "bip", - 4377: "cp-spxsvr", - 4378: "cp-spxdpy", - 4379: "ctdb", - 4389: "xandros-cms", - 4390: "wiegand", - 4394: "apwi-disc", - 4395: "omnivisionesx", - 4400: "ds-srv", - 4401: "ds-srvr", - 4402: "ds-clnt", - 4403: "ds-user", - 4404: "ds-admin", - 4405: "ds-mail", - 4406: "ds-slp", - 4412: "smallchat", - 4413: "avi-nms-disc", - 4416: "pjj-player-disc", - 4418: "axysbridge", - 4420: "nvm-express", - 4425: "netrockey6", - 4426: "beacon-port-2", - 4430: "rsqlserver", - 4432: "l-acoustics", - 4441: "netblox", - 4442: "saris", - 4443: "pharos", - 4444: "krb524", - 4445: "upnotifyp", - 4446: "n1-fwp", - 4447: "n1-rmgmt", - 4448: "asc-slmd", - 4449: "privatewire", - 4450: "camp", - 4451: "ctisystemmsg", - 4452: "ctiprogramload", - 4453: "nssalertmgr", - 4454: "nssagentmgr", - 4455: "prchat-user", - 4456: "prchat-server", - 4457: "prRegister", - 4458: "mcp", - 4484: "hpssmgmt", - 4486: "icms", - 4488: "awacs-ice", - 4500: "ipsec-nat-t", - 4534: "armagetronad", - 4535: "ehs", - 4536: "ehs-ssl", - 4537: "wssauthsvc", - 4538: "swx-gate", - 4545: "worldscores", - 4546: "sf-lm", - 4547: "lanner-lm", - 4548: "synchromesh", - 4549: "aegate", - 4550: "gds-adppiw-db", - 4551: "ieee-mih", - 4552: "menandmice-mon", - 4554: "msfrs", - 4555: "rsip", - 4556: "dtn-bundle", - 4557: "mtcevrunqss", - 4558: "mtcevrunqman", - 4559: "hylafax", - 4566: "kwtc", - 4567: "tram", - 4568: "bmc-reporting", - 4569: "iax", - 4591: "l3t-at-an", - 4592: "hrpd-ith-at-an", - 4593: "ipt-anri-anri", - 4594: "ias-session", - 4595: "ias-paging", - 4596: "ias-neighbor", - 4597: "a21-an-1xbs", - 4598: "a16-an-an", - 4599: "a17-an-an", - 4600: "piranha1", - 4601: "piranha2", - 4621: "ventoso", - 4658: "playsta2-app", - 4659: "playsta2-lob", - 4660: "smaclmgr", - 4661: "kar2ouche", - 4662: "oms", - 4663: "noteit", - 4664: "ems", - 4665: "contclientms", - 4666: "eportcomm", - 4667: "mmacomm", - 4668: "mmaeds", - 4669: "eportcommdata", - 4670: "light", - 4671: "acter", - 4672: "rfa", - 4673: "cxws", - 4674: "appiq-mgmt", - 4675: "dhct-status", - 4676: "dhct-alerts", - 4677: "bcs", - 4678: "traversal", - 4679: "mgesupervision", - 4680: "mgemanagement", - 4681: "parliant", - 4682: "finisar", - 4683: "spike", - 4684: "rfid-rp1", - 4685: "autopac", - 4686: "msp-os", - 4687: "nst", - 4688: "mobile-p2p", - 4689: "altovacentral", - 4690: "prelude", - 4691: "mtn", - 4692: "conspiracy", - 4700: "netxms-agent", - 4701: "netxms-mgmt", - 4702: "netxms-sync", - 4711: "trinity-dist", - 4725: "truckstar", - 4726: "a26-fap-fgw", - 4727: "fcis-disc", - 4728: "capmux", - 4729: "gsmtap", - 4730: "gearman", - 4732: "ohmtrigger", - 4737: "ipdr-sp", - 4738: "solera-lpn", - 4739: "ipfix", - 4740: "ipfixs", - 4741: "lumimgrd", - 4742: "sicct-sdp", - 4743: "openhpid", - 4744: "ifsp", - 4745: "fmp", - 4746: "intelliadm-disc", - 4747: "buschtrommel", - 4749: "profilemac", - 4750: "ssad", - 4751: "spocp", - 4752: "snap", - 4753: "simon-disc", - 4754: "gre-in-udp", - 4755: "gre-udp-dtls", - 4784: "bfd-multi-ctl", - 4785: "cncp", - 4789: "vxlan", - 4790: "vxlan-gpe", - 4791: "roce", - 4800: "iims", - 4801: "iwec", - 4802: "ilss", - 4803: "notateit-disc", - 4804: "aja-ntv4-disc", - 4827: "htcp", - 4837: "varadero-0", - 4838: "varadero-1", - 4839: "varadero-2", - 4840: "opcua-udp", - 4841: "quosa", - 4842: "gw-asv", - 4843: "opcua-tls", - 4844: "gw-log", - 4845: "wcr-remlib", - 4846: "contamac-icm", - 4847: "wfc", - 4848: "appserv-http", - 4849: "appserv-https", - 4850: "sun-as-nodeagt", - 4851: "derby-repli", - 4867: "unify-debug", - 4868: "phrelay", - 4869: "phrelaydbg", - 4870: "cc-tracking", - 4871: "wired", - 4876: "tritium-can", - 4877: "lmcs", - 4878: "inst-discovery", - 4881: "socp-t", - 4882: "socp-c", - 4884: "hivestor", - 4885: "abbs", - 4894: "lyskom", - 4899: "radmin-port", - 4900: "hfcs", - 4914: "bones", - 4936: "an-signaling", - 4937: "atsc-mh-ssc", - 4940: "eq-office-4940", - 4941: "eq-office-4941", - 4942: "eq-office-4942", - 4949: "munin", - 4950: "sybasesrvmon", - 4951: "pwgwims", - 4952: "sagxtsds", - 4969: "ccss-qmm", - 4970: "ccss-qsm", - 4980: "ctxs-vpp", - 4986: "mrip", - 4987: "smar-se-port1", - 4988: "smar-se-port2", - 4989: "parallel", - 4990: "busycal", - 4991: "vrt", - 4999: "hfcs-manager", - 5000: "commplex-main", - 5001: "commplex-link", - 5002: "rfe", - 5003: "fmpro-internal", - 5004: "avt-profile-1", - 5005: "avt-profile-2", - 5006: "wsm-server", - 5007: "wsm-server-ssl", - 5008: "synapsis-edge", - 5009: "winfs", - 5010: "telelpathstart", - 5011: "telelpathattack", - 5012: "nsp", - 5013: "fmpro-v6", - 5014: "onpsocket", - 5020: "zenginkyo-1", - 5021: "zenginkyo-2", - 5022: "mice", - 5023: "htuilsrv", - 5024: "scpi-telnet", - 5025: "scpi-raw", - 5026: "strexec-d", - 5027: "strexec-s", - 5029: "infobright", - 5030: "surfpass", - 5031: "dmp", - 5042: "asnaacceler8db", - 5043: "swxadmin", - 5044: "lxi-evntsvc", - 5046: "vpm-udp", - 5047: "iscape", - 5049: "ivocalize", - 5050: "mmcc", - 5051: "ita-agent", - 5052: "ita-manager", - 5053: "rlm-disc", - 5055: "unot", - 5056: "intecom-ps1", - 5057: "intecom-ps2", - 5058: "locus-disc", - 5059: "sds", - 5060: "sip", - 5061: "sips", - 5062: "na-localise", - 5064: "ca-1", - 5065: "ca-2", - 5066: "stanag-5066", - 5067: "authentx", - 5069: "i-net-2000-npr", - 5070: "vtsas", - 5071: "powerschool", - 5072: "ayiya", - 5073: "tag-pm", - 5074: "alesquery", - 5078: "pixelpusher", - 5079: "cp-spxrpts", - 5080: "onscreen", - 5081: "sdl-ets", - 5082: "qcp", - 5083: "qfp", - 5084: "llrp", - 5085: "encrypted-llrp", - 5092: "magpie", - 5093: "sentinel-lm", - 5094: "hart-ip", - 5099: "sentlm-srv2srv", - 5100: "socalia", - 5101: "talarian-udp", - 5102: "oms-nonsecure", - 5104: "tinymessage", - 5105: "hughes-ap", - 5111: "taep-as-svc", - 5112: "pm-cmdsvr", - 5116: "emb-proj-cmd", - 5120: "barracuda-bbs", - 5133: "nbt-pc", - 5136: "minotaur-sa", - 5137: "ctsd", - 5145: "rmonitor-secure", - 5150: "atmp", - 5151: "esri-sde", - 5152: "sde-discovery", - 5154: "bzflag", - 5155: "asctrl-agent", - 5164: "vpa-disc", - 5165: "ife-icorp", - 5166: "winpcs", - 5167: "scte104", - 5168: "scte30", - 5190: "aol", - 5191: "aol-1", - 5192: "aol-2", - 5193: "aol-3", - 5200: "targus-getdata", - 5201: "targus-getdata1", - 5202: "targus-getdata2", - 5203: "targus-getdata3", - 5223: "hpvirtgrp", - 5224: "hpvirtctrl", - 5225: "hp-server", - 5226: "hp-status", - 5227: "perfd", - 5234: "eenet", - 5235: "galaxy-network", - 5236: "padl2sim", - 5237: "mnet-discovery", - 5245: "downtools-disc", - 5246: "capwap-control", - 5247: "capwap-data", - 5248: "caacws", - 5249: "caaclang2", - 5250: "soagateway", - 5251: "caevms", - 5252: "movaz-ssc", - 5264: "3com-njack-1", - 5265: "3com-njack-2", - 5270: "cartographerxmp", - 5271: "cuelink-disc", - 5272: "pk", - 5282: "transmit-port", - 5298: "presence", - 5299: "nlg-data", - 5300: "hacl-hb", - 5301: "hacl-gs", - 5302: "hacl-cfg", - 5303: "hacl-probe", - 5304: "hacl-local", - 5305: "hacl-test", - 5306: "sun-mc-grp", - 5307: "sco-aip", - 5308: "cfengine", - 5309: "jprinter", - 5310: "outlaws", - 5312: "permabit-cs", - 5313: "rrdp", - 5314: "opalis-rbt-ipc", - 5315: "hacl-poll", - 5343: "kfserver", - 5344: "xkotodrcp", - 5349: "stuns", - 5350: "pcp-multicast", - 5351: "pcp", - 5352: "dns-llq", - 5353: "mdns", - 5354: "mdnsresponder", - 5355: "llmnr", - 5356: "ms-smlbiz", - 5357: "wsdapi", - 5358: "wsdapi-s", - 5359: "ms-alerter", - 5360: "ms-sideshow", - 5361: "ms-s-sideshow", - 5362: "serverwsd2", - 5363: "net-projection", - 5364: "kdnet", - 5397: "stresstester", - 5398: "elektron-admin", - 5399: "securitychase", - 5400: "excerpt", - 5401: "excerpts", - 5402: "mftp", - 5403: "hpoms-ci-lstn", - 5404: "hpoms-dps-lstn", - 5405: "netsupport", - 5406: "systemics-sox", - 5407: "foresyte-clear", - 5408: "foresyte-sec", - 5409: "salient-dtasrv", - 5410: "salient-usrmgr", - 5411: "actnet", - 5412: "continuus", - 5413: "wwiotalk", - 5414: "statusd", - 5415: "ns-server", - 5416: "sns-gateway", - 5417: "sns-agent", - 5418: "mcntp", - 5419: "dj-ice", - 5420: "cylink-c", - 5421: "netsupport2", - 5422: "salient-mux", - 5423: "virtualuser", - 5424: "beyond-remote", - 5425: "br-channel", - 5426: "devbasic", - 5427: "sco-peer-tta", - 5428: "telaconsole", - 5429: "base", - 5430: "radec-corp", - 5431: "park-agent", - 5432: "postgresql", - 5433: "pyrrho", - 5434: "sgi-arrayd", - 5435: "sceanics", - 5436: "pmip6-cntl", - 5437: "pmip6-data", - 5443: "spss", - 5450: "tiepie-disc", - 5453: "surebox", - 5454: "apc-5454", - 5455: "apc-5455", - 5456: "apc-5456", - 5461: "silkmeter", - 5462: "ttl-publisher", - 5463: "ttlpriceproxy", - 5464: "quailnet", - 5465: "netops-broker", - 5474: "apsolab-rpc", - 5500: "fcp-addr-srvr1", - 5501: "fcp-addr-srvr2", - 5502: "fcp-srvr-inst1", - 5503: "fcp-srvr-inst2", - 5504: "fcp-cics-gw1", - 5505: "checkoutdb", - 5506: "amc", - 5553: "sgi-eventmond", - 5554: "sgi-esphttp", - 5555: "personal-agent", - 5556: "freeciv", - 5567: "dof-dps-mc-sec", - 5568: "sdt", - 5569: "rdmnet-device", - 5573: "sdmmp", - 5580: "tmosms0", - 5581: "tmosms1", - 5582: "fac-restore", - 5583: "tmo-icon-sync", - 5584: "bis-web", - 5585: "bis-sync", - 5597: "ininmessaging", - 5598: "mctfeed", - 5599: "esinstall", - 5600: "esmmanager", - 5601: "esmagent", - 5602: "a1-msc", - 5603: "a1-bs", - 5604: "a3-sdunode", - 5605: "a4-sdunode", - 5627: "ninaf", - 5628: "htrust", - 5629: "symantec-sfdb", - 5630: "precise-comm", - 5631: "pcanywheredata", - 5632: "pcanywherestat", - 5633: "beorl", - 5634: "xprtld", - 5670: "zre-disc", - 5671: "amqps", - 5672: "amqp", - 5673: "jms", - 5674: "hyperscsi-port", - 5675: "v5ua", - 5676: "raadmin", - 5677: "questdb2-lnchr", - 5678: "rrac", - 5679: "dccm", - 5680: "auriga-router", - 5681: "ncxcp", - 5682: "brightcore", - 5683: "coap", - 5684: "coaps", - 5687: "gog-multiplayer", - 5688: "ggz", - 5689: "qmvideo", - 5713: "proshareaudio", - 5714: "prosharevideo", - 5715: "prosharedata", - 5716: "prosharerequest", - 5717: "prosharenotify", - 5718: "dpm", - 5719: "dpm-agent", - 5720: "ms-licensing", - 5721: "dtpt", - 5722: "msdfsr", - 5723: "omhs", - 5724: "omsdk", - 5728: "io-dist-group", - 5729: "openmail", - 5730: "unieng", - 5741: "ida-discover1", - 5742: "ida-discover2", - 5743: "watchdoc-pod", - 5744: "watchdoc", - 5745: "fcopy-server", - 5746: "fcopys-server", - 5747: "tunatic", - 5748: "tunalyzer", - 5750: "rscd", - 5755: "openmailg", - 5757: "x500ms", - 5766: "openmailns", - 5767: "s-openmail", - 5768: "openmailpxy", - 5769: "spramsca", - 5770: "spramsd", - 5771: "netagent", - 5777: "dali-port", - 5781: "3par-evts", - 5782: "3par-mgmt", - 5783: "3par-mgmt-ssl", - 5784: "ibar", - 5785: "3par-rcopy", - 5786: "cisco-redu", - 5787: "waascluster", - 5793: "xtreamx", - 5794: "spdp", - 5813: "icmpd", - 5814: "spt-automation", - 5859: "wherehoo", - 5863: "ppsuitemsg", - 5900: "rfb", - 5910: "cm", - 5911: "cpdlc", - 5912: "fis", - 5913: "ads-c", - 5963: "indy", - 5968: "mppolicy-v5", - 5969: "mppolicy-mgr", - 5984: "couchdb", - 5985: "wsman", - 5986: "wsmans", - 5987: "wbem-rmi", - 5988: "wbem-http", - 5989: "wbem-https", - 5990: "wbem-exp-https", - 5991: "nuxsl", - 5992: "consul-insight", - 5999: "cvsup", - 6064: "ndl-ahp-svc", - 6065: "winpharaoh", - 6066: "ewctsp", - 6069: "trip", - 6070: "messageasap", - 6071: "ssdtp", - 6072: "diagnose-proc", - 6073: "directplay8", - 6074: "max", - 6080: "gue", - 6081: "geneve", - 6082: "p25cai", - 6083: "miami-bcast", - 6085: "konspire2b", - 6086: "pdtp", - 6087: "ldss", - 6088: "doglms-notify", - 6100: "synchronet-db", - 6101: "synchronet-rtc", - 6102: "synchronet-upd", - 6103: "rets", - 6104: "dbdb", - 6105: "primaserver", - 6106: "mpsserver", - 6107: "etc-control", - 6108: "sercomm-scadmin", - 6109: "globecast-id", - 6110: "softcm", - 6111: "spc", - 6112: "dtspcd", - 6118: "tipc", - 6122: "bex-webadmin", - 6123: "backup-express", - 6124: "pnbs", - 6133: "nbt-wol", - 6140: "pulsonixnls", - 6141: "meta-corp", - 6142: "aspentec-lm", - 6143: "watershed-lm", - 6144: "statsci1-lm", - 6145: "statsci2-lm", - 6146: "lonewolf-lm", - 6147: "montage-lm", - 6148: "ricardo-lm", - 6149: "tal-pod", - 6160: "ecmp-data", - 6161: "patrol-ism", - 6162: "patrol-coll", - 6163: "pscribe", - 6200: "lm-x", - 6201: "thermo-calc", - 6209: "qmtps", - 6222: "radmind", - 6241: "jeol-nsddp-1", - 6242: "jeol-nsddp-2", - 6243: "jeol-nsddp-3", - 6244: "jeol-nsddp-4", - 6251: "tl1-raw-ssl", - 6252: "tl1-ssh", - 6253: "crip", - 6268: "grid", - 6269: "grid-alt", - 6300: "bmc-grx", - 6301: "bmc-ctd-ldap", - 6306: "ufmp", - 6315: "scup-disc", - 6316: "abb-escp", - 6317: "nav-data", - 6320: "repsvc", - 6321: "emp-server1", - 6322: "emp-server2", - 6324: "hrd-ns-disc", - 6343: "sflow", - 6346: "gnutella-svc", - 6347: "gnutella-rtr", - 6350: "adap", - 6355: "pmcs", - 6360: "metaedit-mu", - 6363: "ndn", - 6370: "metaedit-se", - 6382: "metatude-mds", - 6389: "clariion-evr01", - 6390: "metaedit-ws", - 6417: "faxcomservice", - 6419: "svdrp-disc", - 6420: "nim-vdrshell", - 6421: "nim-wan", - 6443: "sun-sr-https", - 6444: "sge-qmaster", - 6445: "sge-execd", - 6446: "mysql-proxy", - 6455: "skip-cert-recv", - 6456: "skip-cert-send", - 6464: "ieee11073-20701", - 6471: "lvision-lm", - 6480: "sun-sr-http", - 6481: "servicetags", - 6482: "ldoms-mgmt", - 6483: "SunVTS-RMI", - 6484: "sun-sr-jms", - 6485: "sun-sr-iiop", - 6486: "sun-sr-iiops", - 6487: "sun-sr-iiop-aut", - 6488: "sun-sr-jmx", - 6489: "sun-sr-admin", - 6500: "boks", - 6501: "boks-servc", - 6502: "boks-servm", - 6503: "boks-clntd", - 6505: "badm-priv", - 6506: "badm-pub", - 6507: "bdir-priv", - 6508: "bdir-pub", - 6509: "mgcs-mfp-port", - 6510: "mcer-port", - 6511: "dccp-udp", - 6514: "syslog-tls", - 6515: "elipse-rec", - 6543: "lds-distrib", - 6544: "lds-dump", - 6547: "apc-6547", - 6548: "apc-6548", - 6549: "apc-6549", - 6550: "fg-sysupdate", - 6551: "sum", - 6558: "xdsxdm", - 6566: "sane-port", - 6568: "rp-reputation", - 6579: "affiliate", - 6580: "parsec-master", - 6581: "parsec-peer", - 6582: "parsec-game", - 6583: "joaJewelSuite", - 6619: "odette-ftps", - 6620: "kftp-data", - 6621: "kftp", - 6622: "mcftp", - 6623: "ktelnet", - 6626: "wago-service", - 6627: "nexgen", - 6628: "afesc-mc", - 6629: "nexgen-aux", - 6633: "cisco-vpath-tun", - 6634: "mpls-pm", - 6635: "mpls-udp", - 6636: "mpls-udp-dtls", - 6653: "openflow", - 6657: "palcom-disc", - 6670: "vocaltec-gold", - 6671: "p4p-portal", - 6672: "vision-server", - 6673: "vision-elmd", - 6678: "vfbp-disc", - 6679: "osaut", - 6689: "tsa", - 6696: "babel", - 6701: "kti-icad-srvr", - 6702: "e-design-net", - 6703: "e-design-web", - 6714: "ibprotocol", - 6715: "fibotrader-com", - 6767: "bmc-perf-agent", - 6768: "bmc-perf-mgrd", - 6769: "adi-gxp-srvprt", - 6770: "plysrv-http", - 6771: "plysrv-https", - 6784: "bfd-lag", - 6785: "dgpf-exchg", - 6786: "smc-jmx", - 6787: "smc-admin", - 6788: "smc-http", - 6790: "hnmp", - 6791: "hnm", - 6801: "acnet", - 6831: "ambit-lm", - 6841: "netmo-default", - 6842: "netmo-http", - 6850: "iccrushmore", - 6868: "acctopus-st", - 6888: "muse", - 6935: "ethoscan", - 6936: "xsmsvc", - 6946: "bioserver", - 6951: "otlp", - 6961: "jmact3", - 6962: "jmevt2", - 6963: "swismgr1", - 6964: "swismgr2", - 6965: "swistrap", - 6966: "swispol", - 6969: "acmsoda", - 6997: "MobilitySrv", - 6998: "iatp-highpri", - 6999: "iatp-normalpri", - 7000: "afs3-fileserver", - 7001: "afs3-callback", - 7002: "afs3-prserver", - 7003: "afs3-vlserver", - 7004: "afs3-kaserver", - 7005: "afs3-volser", - 7006: "afs3-errors", - 7007: "afs3-bos", - 7008: "afs3-update", - 7009: "afs3-rmtsys", - 7010: "ups-onlinet", - 7011: "talon-disc", - 7012: "talon-engine", - 7013: "microtalon-dis", - 7014: "microtalon-com", - 7015: "talon-webserver", - 7016: "spg", - 7017: "grasp", - 7019: "doceri-view", - 7020: "dpserve", - 7021: "dpserveadmin", - 7022: "ctdp", - 7023: "ct2nmcs", - 7024: "vmsvc", - 7025: "vmsvc-2", - 7030: "op-probe", - 7040: "quest-disc", - 7070: "arcp", - 7071: "iwg1", - 7080: "empowerid", - 7088: "zixi-transport", - 7095: "jdp-disc", - 7099: "lazy-ptop", - 7100: "font-service", - 7101: "elcn", - 7107: "aes-x170", - 7121: "virprot-lm", - 7128: "scenidm", - 7129: "scenccs", - 7161: "cabsm-comm", - 7162: "caistoragemgr", - 7163: "cacsambroker", - 7164: "fsr", - 7165: "doc-server", - 7166: "aruba-server", - 7169: "ccag-pib", - 7170: "nsrp", - 7171: "drm-production", - 7174: "clutild", - 7181: "janus-disc", - 7200: "fodms", - 7201: "dlip", - 7227: "ramp", - 7235: "aspcoordination", - 7244: "frc-hicp-disc", - 7262: "cnap", - 7272: "watchme-7272", - 7273: "oma-rlp", - 7274: "oma-rlp-s", - 7275: "oma-ulp", - 7276: "oma-ilp", - 7277: "oma-ilp-s", - 7278: "oma-dcdocbs", - 7279: "ctxlic", - 7280: "itactionserver1", - 7281: "itactionserver2", - 7282: "mzca-alert", - 7365: "lcm-server", - 7391: "mindfilesys", - 7392: "mrssrendezvous", - 7393: "nfoldman", - 7394: "fse", - 7395: "winqedit", - 7397: "hexarc", - 7400: "rtps-discovery", - 7401: "rtps-dd-ut", - 7402: "rtps-dd-mt", - 7410: "ionixnetmon", - 7411: "daqstream", - 7421: "mtportmon", - 7426: "pmdmgr", - 7427: "oveadmgr", - 7428: "ovladmgr", - 7429: "opi-sock", - 7430: "xmpv7", - 7431: "pmd", - 7437: "faximum", - 7443: "oracleas-https", - 7473: "rise", - 7491: "telops-lmd", - 7500: "silhouette", - 7501: "ovbus", - 7510: "ovhpas", - 7511: "pafec-lm", - 7542: "saratoga", - 7543: "atul", - 7544: "nta-ds", - 7545: "nta-us", - 7546: "cfs", - 7547: "cwmp", - 7548: "tidp", - 7549: "nls-tl", - 7550: "cloudsignaling", - 7560: "sncp", - 7566: "vsi-omega", - 7570: "aries-kfinder", - 7574: "coherence-disc", - 7588: "sun-lm", - 7606: "mipi-debug", - 7624: "indi", - 7627: "soap-http", - 7628: "zen-pawn", - 7629: "xdas", - 7633: "pmdfmgt", - 7648: "cuseeme", - 7674: "imqtunnels", - 7675: "imqtunnel", - 7676: "imqbrokerd", - 7677: "sun-user-https", - 7680: "pando-pub", - 7689: "collaber", - 7697: "klio", - 7707: "sync-em7", - 7708: "scinet", - 7720: "medimageportal", - 7724: "nsdeepfreezectl", - 7725: "nitrogen", - 7726: "freezexservice", - 7727: "trident-data", - 7728: "osvr", - 7734: "smip", - 7738: "aiagent", - 7741: "scriptview", - 7743: "sstp-1", - 7744: "raqmon-pdu", - 7747: "prgp", - 7777: "cbt", - 7778: "interwise", - 7779: "vstat", - 7781: "accu-lmgr", - 7784: "s-bfd", - 7786: "minivend", - 7787: "popup-reminders", - 7789: "office-tools", - 7794: "q3ade", - 7797: "pnet-conn", - 7798: "pnet-enc", - 7799: "altbsdp", - 7800: "asr", - 7801: "ssp-client", - 7802: "vns-tp", - 7810: "rbt-wanopt", - 7845: "apc-7845", - 7846: "apc-7846", - 7872: "mipv6tls", - 7880: "pss", - 7887: "ubroker", - 7900: "mevent", - 7901: "tnos-sp", - 7902: "tnos-dp", - 7903: "tnos-dps", - 7913: "qo-secure", - 7932: "t2-drm", - 7933: "t2-brm", - 7962: "generalsync", - 7967: "supercell", - 7979: "micromuse-ncps", - 7980: "quest-vista", - 7982: "sossd-disc", - 7998: "usicontentpush", - 7999: "irdmi2", - 8000: "irdmi", - 8001: "vcom-tunnel", - 8002: "teradataordbms", - 8003: "mcreport", - 8005: "mxi", - 8006: "wpl-disc", - 8007: "warppipe", - 8008: "http-alt", - 8019: "qbdb", - 8020: "intu-ec-svcdisc", - 8021: "intu-ec-client", - 8022: "oa-system", - 8025: "ca-audit-da", - 8026: "ca-audit-ds", - 8032: "pro-ed", - 8033: "mindprint", - 8034: "vantronix-mgmt", - 8040: "ampify", - 8041: "enguity-xccetp", - 8052: "senomix01", - 8053: "senomix02", - 8054: "senomix03", - 8055: "senomix04", - 8056: "senomix05", - 8057: "senomix06", - 8058: "senomix07", - 8059: "senomix08", - 8060: "aero", - 8074: "gadugadu", - 8080: "http-alt", - 8081: "sunproxyadmin", - 8082: "us-cli", - 8083: "us-srv", - 8086: "d-s-n", - 8087: "simplifymedia", - 8088: "radan-http", - 8097: "sac", - 8100: "xprint-server", - 8115: "mtl8000-matrix", - 8116: "cp-cluster", - 8118: "privoxy", - 8121: "apollo-data", - 8122: "apollo-admin", - 8128: "paycash-online", - 8129: "paycash-wbp", - 8130: "indigo-vrmi", - 8131: "indigo-vbcp", - 8132: "dbabble", - 8148: "isdd", - 8149: "eor-game", - 8160: "patrol", - 8161: "patrol-snmp", - 8182: "vmware-fdm", - 8184: "itach", - 8192: "spytechphone", - 8194: "blp1", - 8195: "blp2", - 8199: "vvr-data", - 8200: "trivnet1", - 8201: "trivnet2", - 8202: "aesop", - 8204: "lm-perfworks", - 8205: "lm-instmgr", - 8206: "lm-dta", - 8207: "lm-sserver", - 8208: "lm-webwatcher", - 8230: "rexecj", - 8231: "hncp-udp-port", - 8232: "hncp-dtls-port", - 8243: "synapse-nhttps", - 8276: "pando-sec", - 8280: "synapse-nhttp", - 8282: "libelle-disc", - 8292: "blp3", - 8294: "blp4", - 8300: "tmi", - 8301: "amberon", - 8320: "tnp-discover", - 8321: "tnp", - 8322: "garmin-marine", - 8351: "server-find", - 8376: "cruise-enum", - 8377: "cruise-swroute", - 8378: "cruise-config", - 8379: "cruise-diags", - 8380: "cruise-update", - 8383: "m2mservices", - 8384: "marathontp", - 8400: "cvd", - 8401: "sabarsd", - 8402: "abarsd", - 8403: "admind", - 8416: "espeech", - 8417: "espeech-rtp", - 8442: "cybro-a-bus", - 8443: "pcsync-https", - 8444: "pcsync-http", - 8445: "copy-disc", - 8450: "npmp", - 8472: "otv", - 8473: "vp2p", - 8474: "noteshare", - 8500: "fmtp", - 8501: "cmtp-av", - 8503: "lsp-self-ping", - 8554: "rtsp-alt", - 8555: "d-fence", - 8567: "dof-tunnel", - 8600: "asterix", - 8609: "canon-cpp-disc", - 8610: "canon-mfnp", - 8611: "canon-bjnp1", - 8612: "canon-bjnp2", - 8613: "canon-bjnp3", - 8614: "canon-bjnp4", - 8675: "msi-cps-rm-disc", - 8686: "sun-as-jmxrmi", - 8732: "dtp-net", - 8733: "ibus", - 8763: "mc-appserver", - 8764: "openqueue", - 8765: "ultraseek-http", - 8766: "amcs", - 8770: "dpap", - 8786: "msgclnt", - 8787: "msgsrvr", - 8793: "acd-pm", - 8800: "sunwebadmin", - 8804: "truecm", - 8805: "pfcp", - 8808: "ssports-bcast", - 8873: "dxspider", - 8880: "cddbp-alt", - 8883: "secure-mqtt", - 8888: "ddi-udp-1", - 8889: "ddi-udp-2", - 8890: "ddi-udp-3", - 8891: "ddi-udp-4", - 8892: "ddi-udp-5", - 8893: "ddi-udp-6", - 8894: "ddi-udp-7", - 8899: "ospf-lite", - 8900: "jmb-cds1", - 8901: "jmb-cds2", - 8910: "manyone-http", - 8911: "manyone-xml", - 8912: "wcbackup", - 8913: "dragonfly", - 8954: "cumulus-admin", - 8980: "nod-provider", - 8981: "nod-client", - 8989: "sunwebadmins", - 8990: "http-wmap", - 8991: "https-wmap", - 8999: "bctp", - 9000: "cslistener", - 9001: "etlservicemgr", - 9002: "dynamid", - 9007: "ogs-client", - 9009: "pichat", - 9020: "tambora", - 9021: "panagolin-ident", - 9022: "paragent", - 9023: "swa-1", - 9024: "swa-2", - 9025: "swa-3", - 9026: "swa-4", - 9060: "CardWeb-RT", - 9080: "glrpc", - 9084: "aurora", - 9085: "ibm-rsyscon", - 9086: "net2display", - 9087: "classic", - 9088: "sqlexec", - 9089: "sqlexec-ssl", - 9090: "websm", - 9091: "xmltec-xmlmail", - 9092: "XmlIpcRegSvc", - 9100: "hp-pdl-datastr", - 9101: "bacula-dir", - 9102: "bacula-fd", - 9103: "bacula-sd", - 9104: "peerwire", - 9105: "xadmin", - 9106: "astergate-disc", - 9119: "mxit", - 9131: "dddp", - 9160: "apani1", - 9161: "apani2", - 9162: "apani3", - 9163: "apani4", - 9164: "apani5", - 9191: "sun-as-jpda", - 9200: "wap-wsp", - 9201: "wap-wsp-wtp", - 9202: "wap-wsp-s", - 9203: "wap-wsp-wtp-s", - 9204: "wap-vcard", - 9205: "wap-vcal", - 9206: "wap-vcard-s", - 9207: "wap-vcal-s", - 9208: "rjcdb-vcards", - 9209: "almobile-system", - 9210: "oma-mlp", - 9211: "oma-mlp-s", - 9212: "serverviewdbms", - 9213: "serverstart", - 9214: "ipdcesgbs", - 9215: "insis", - 9216: "acme", - 9217: "fsc-port", - 9222: "teamcoherence", - 9255: "mon", - 9277: "traingpsdata", - 9278: "pegasus", - 9279: "pegasus-ctl", - 9280: "pgps", - 9281: "swtp-port1", - 9282: "swtp-port2", - 9283: "callwaveiam", - 9284: "visd", - 9285: "n2h2server", - 9286: "n2receive", - 9287: "cumulus", - 9292: "armtechdaemon", - 9293: "storview", - 9294: "armcenterhttp", - 9295: "armcenterhttps", - 9300: "vrace", - 9318: "secure-ts", - 9321: "guibase", - 9343: "mpidcmgr", - 9344: "mphlpdmc", - 9346: "ctechlicensing", - 9374: "fjdmimgr", - 9380: "boxp", - 9396: "fjinvmgr", - 9397: "mpidcagt", - 9400: "sec-t4net-srv", - 9401: "sec-t4net-clt", - 9402: "sec-pc2fax-srv", - 9418: "git", - 9443: "tungsten-https", - 9444: "wso2esb-console", - 9450: "sntlkeyssrvr", - 9500: "ismserver", - 9522: "sma-spw", - 9535: "mngsuite", - 9536: "laes-bf", - 9555: "trispen-sra", - 9592: "ldgateway", - 9593: "cba8", - 9594: "msgsys", - 9595: "pds", - 9596: "mercury-disc", - 9597: "pd-admin", - 9598: "vscp", - 9599: "robix", - 9600: "micromuse-ncpw", - 9612: "streamcomm-ds", - 9618: "condor", - 9628: "odbcpathway", - 9629: "uniport", - 9632: "mc-comm", - 9667: "xmms2", - 9668: "tec5-sdctp", - 9694: "client-wakeup", - 9695: "ccnx", - 9700: "board-roar", - 9747: "l5nas-parchan", - 9750: "board-voip", - 9753: "rasadv", - 9762: "tungsten-http", - 9800: "davsrc", - 9801: "sstp-2", - 9802: "davsrcs", - 9875: "sapv1", - 9878: "kca-service", - 9888: "cyborg-systems", - 9889: "gt-proxy", - 9898: "monkeycom", - 9899: "sctp-tunneling", - 9900: "iua", - 9901: "enrp", - 9903: "multicast-ping", - 9909: "domaintime", - 9911: "sype-transport", - 9950: "apc-9950", - 9951: "apc-9951", - 9952: "apc-9952", - 9953: "acis", - 9955: "alljoyn-mcm", - 9956: "alljoyn", - 9966: "odnsp", - 9987: "dsm-scm-target", - 9990: "osm-appsrvr", - 9991: "osm-oev", - 9992: "palace-1", - 9993: "palace-2", - 9994: "palace-3", - 9995: "palace-4", - 9996: "palace-5", - 9997: "palace-6", - 9998: "distinct32", - 9999: "distinct", - 10000: "ndmp", - 10001: "scp-config", - 10002: "documentum", - 10003: "documentum-s", - 10007: "mvs-capacity", - 10008: "octopus", - 10009: "swdtp-sv", - 10050: "zabbix-agent", - 10051: "zabbix-trapper", - 10080: "amanda", - 10081: "famdc", - 10100: "itap-ddtp", - 10101: "ezmeeting-2", - 10102: "ezproxy-2", - 10103: "ezrelay", - 10104: "swdtp", - 10107: "bctp-server", - 10110: "nmea-0183", - 10111: "nmea-onenet", - 10113: "netiq-endpoint", - 10114: "netiq-qcheck", - 10115: "netiq-endpt", - 10116: "netiq-voipa", - 10117: "iqrm", - 10128: "bmc-perf-sd", - 10160: "qb-db-server", - 10161: "snmpdtls", - 10162: "snmpdtls-trap", - 10200: "trisoap", - 10201: "rscs", - 10252: "apollo-relay", - 10253: "eapol-relay", - 10260: "axis-wimp-port", - 10288: "blocks", - 10439: "bngsync", - 10500: "hip-nat-t", - 10540: "MOS-lower", - 10541: "MOS-upper", - 10542: "MOS-aux", - 10543: "MOS-soap", - 10544: "MOS-soap-opt", - 10800: "gap", - 10805: "lpdg", - 10810: "nmc-disc", - 10860: "helix", - 10880: "bveapi", - 10990: "rmiaux", - 11000: "irisa", - 11001: "metasys", - 10023: "cefd-vmp", - 11095: "weave", - 11106: "sgi-lk", - 11108: "myq-termlink", - 11111: "vce", - 11112: "dicom", - 11161: "suncacao-snmp", - 11162: "suncacao-jmxmp", - 11163: "suncacao-rmi", - 11164: "suncacao-csa", - 11165: "suncacao-websvc", - 11171: "snss", - 11201: "smsqp", - 11208: "wifree", - 11211: "memcache", - 11319: "imip", - 11320: "imip-channels", - 11321: "arena-server", - 11367: "atm-uhas", - 11371: "hkp", - 11430: "lsdp", - 11600: "tempest-port", - 11720: "h323callsigalt", - 11723: "emc-xsw-dcache", - 11751: "intrepid-ssl", - 11796: "lanschool-mpt", - 11876: "xoraya", - 11877: "x2e-disc", - 11967: "sysinfo-sp", - 12000: "entextxid", - 12001: "entextnetwk", - 12002: "entexthigh", - 12003: "entextmed", - 12004: "entextlow", - 12005: "dbisamserver1", - 12006: "dbisamserver2", - 12007: "accuracer", - 12008: "accuracer-dbms", - 12009: "ghvpn", - 12012: "vipera", - 12013: "vipera-ssl", - 12109: "rets-ssl", - 12121: "nupaper-ss", - 12168: "cawas", - 12172: "hivep", - 12300: "linogridengine", - 12321: "warehouse-sss", - 12322: "warehouse", - 12345: "italk", - 12753: "tsaf", - 13160: "i-zipqd", - 13216: "bcslogc", - 13217: "rs-pias", - 13218: "emc-vcas-udp", - 13223: "powwow-client", - 13224: "powwow-server", - 13400: "doip-disc", - 13720: "bprd", - 13721: "bpdbm", - 13722: "bpjava-msvc", - 13724: "vnetd", - 13782: "bpcd", - 13783: "vopied", - 13785: "nbdb", - 13786: "nomdb", - 13818: "dsmcc-config", - 13819: "dsmcc-session", - 13820: "dsmcc-passthru", - 13821: "dsmcc-download", - 13822: "dsmcc-ccp", - 13894: "ucontrol", - 13929: "dta-systems", - 14000: "scotty-ft", - 14001: "sua", - 14002: "scotty-disc", - 14033: "sage-best-com1", - 14034: "sage-best-com2", - 14141: "vcs-app", - 14142: "icpp", - 14145: "gcm-app", - 14149: "vrts-tdd", - 14154: "vad", - 14250: "cps", - 14414: "ca-web-update", - 14936: "hde-lcesrvr-1", - 14937: "hde-lcesrvr-2", - 15000: "hydap", - 15118: "v2g-secc", - 15345: "xpilot", - 15363: "3link", - 15555: "cisco-snat", - 15660: "bex-xr", - 15740: "ptp", - 15998: "2ping", - 16003: "alfin", - 16161: "sun-sea-port", - 16309: "etb4j", - 16310: "pduncs", - 16311: "pdefmns", - 16360: "netserialext1", - 16361: "netserialext2", - 16367: "netserialext3", - 16368: "netserialext4", - 16384: "connected", - 16666: "vtp", - 16900: "newbay-snc-mc", - 16950: "sgcip", - 16991: "intel-rci-mp", - 16992: "amt-soap-http", - 16993: "amt-soap-https", - 16994: "amt-redir-tcp", - 16995: "amt-redir-tls", - 17007: "isode-dua", - 17185: "soundsvirtual", - 17219: "chipper", - 17220: "avtp", - 17221: "avdecc", - 17222: "cpsp", - 17224: "trdp-pd", - 17225: "trdp-md", - 17234: "integrius-stp", - 17235: "ssh-mgmt", - 17500: "db-lsp-disc", - 17729: "ea", - 17754: "zep", - 17755: "zigbee-ip", - 17756: "zigbee-ips", - 18000: "biimenu", - 18181: "opsec-cvp", - 18182: "opsec-ufp", - 18183: "opsec-sam", - 18184: "opsec-lea", - 18185: "opsec-omi", - 18186: "ohsc", - 18187: "opsec-ela", - 18241: "checkpoint-rtm", - 18262: "gv-pf", - 18463: "ac-cluster", - 18634: "rds-ib", - 18635: "rds-ip", - 18668: "vdmmesh-disc", - 18769: "ique", - 18881: "infotos", - 18888: "apc-necmp", - 19000: "igrid", - 19007: "scintilla", - 19191: "opsec-uaa", - 19194: "ua-secureagent", - 19220: "cora-disc", - 19283: "keysrvr", - 19315: "keyshadow", - 19398: "mtrgtrans", - 19410: "hp-sco", - 19411: "hp-sca", - 19412: "hp-sessmon", - 19539: "fxuptp", - 19540: "sxuptp", - 19541: "jcp", - 19788: "mle", - 19999: "dnp-sec", - 20000: "dnp", - 20001: "microsan", - 20002: "commtact-http", - 20003: "commtact-https", - 20005: "openwebnet", - 20012: "ss-idi-disc", - 20014: "opendeploy", - 20034: "nburn-id", - 20046: "tmophl7mts", - 20048: "mountd", - 20049: "nfsrdma", - 20167: "tolfab", - 20202: "ipdtp-port", - 20222: "ipulse-ics", - 20480: "emwavemsg", - 20670: "track", - 20999: "athand-mmp", - 21000: "irtrans", - 21554: "dfserver", - 21590: "vofr-gateway", - 21800: "tvpm", - 21845: "webphone", - 21846: "netspeak-is", - 21847: "netspeak-cs", - 21848: "netspeak-acd", - 21849: "netspeak-cps", - 22000: "snapenetio", - 22001: "optocontrol", - 22002: "optohost002", - 22003: "optohost003", - 22004: "optohost004", - 22005: "optohost004", - 22273: "wnn6", - 22305: "cis", - 22335: "shrewd-stream", - 22343: "cis-secure", - 22347: "wibukey", - 22350: "codemeter", - 22555: "vocaltec-phone", - 22763: "talikaserver", - 22800: "aws-brf", - 22951: "brf-gw", - 23000: "inovaport1", - 23001: "inovaport2", - 23002: "inovaport3", - 23003: "inovaport4", - 23004: "inovaport5", - 23005: "inovaport6", - 23272: "s102", - 23294: "5afe-disc", - 23333: "elxmgmt", - 23400: "novar-dbase", - 23401: "novar-alarm", - 23402: "novar-global", - 24000: "med-ltp", - 24001: "med-fsp-rx", - 24002: "med-fsp-tx", - 24003: "med-supp", - 24004: "med-ovw", - 24005: "med-ci", - 24006: "med-net-svc", - 24242: "filesphere", - 24249: "vista-4gl", - 24321: "ild", - 24322: "hid", - 24386: "intel-rci", - 24465: "tonidods", - 24554: "binkp", - 24577: "bilobit-update", - 24676: "canditv", - 24677: "flashfiler", - 24678: "proactivate", - 24680: "tcc-http", - 24850: "assoc-disc", - 24922: "find", - 25000: "icl-twobase1", - 25001: "icl-twobase2", - 25002: "icl-twobase3", - 25003: "icl-twobase4", - 25004: "icl-twobase5", - 25005: "icl-twobase6", - 25006: "icl-twobase7", - 25007: "icl-twobase8", - 25008: "icl-twobase9", - 25009: "icl-twobase10", - 25793: "vocaltec-hos", - 25900: "tasp-net", - 25901: "niobserver", - 25902: "nilinkanalyst", - 25903: "niprobe", - 25954: "bf-game", - 25955: "bf-master", - 26000: "quake", - 26133: "scscp", - 26208: "wnn6-ds", - 26260: "ezproxy", - 26261: "ezmeeting", - 26262: "k3software-svr", - 26263: "k3software-cli", - 26486: "exoline-udp", - 26487: "exoconfig", - 26489: "exonet", - 27345: "imagepump", - 27442: "jesmsjc", - 27504: "kopek-httphead", - 27782: "ars-vista", - 27999: "tw-auth-key", - 28000: "nxlmd", - 28119: "a27-ran-ran", - 28200: "voxelstorm", - 28240: "siemensgsm", - 29167: "otmp", - 30001: "pago-services1", - 30002: "pago-services2", - 30003: "amicon-fpsu-ra", - 30004: "amicon-fpsu-s", - 30260: "kingdomsonline", - 30832: "samsung-disc", - 30999: "ovobs", - 31016: "ka-kdp", - 31029: "yawn", - 31416: "xqosd", - 31457: "tetrinet", - 31620: "lm-mon", - 31765: "gamesmith-port", - 31948: "iceedcp-tx", - 31949: "iceedcp-rx", - 32034: "iracinghelper", - 32249: "t1distproc60", - 32483: "apm-link", - 32635: "sec-ntb-clnt", - 32636: "DMExpress", - 32767: "filenet-powsrm", - 32768: "filenet-tms", - 32769: "filenet-rpc", - 32770: "filenet-nch", - 32771: "filenet-rmi", - 32772: "filenet-pa", - 32773: "filenet-cm", - 32774: "filenet-re", - 32775: "filenet-pch", - 32776: "filenet-peior", - 32777: "filenet-obrok", - 32801: "mlsn", - 32896: "idmgratm", - 33123: "aurora-balaena", - 33331: "diamondport", - 33334: "speedtrace-disc", - 33434: "traceroute", - 33656: "snip-slave", - 34249: "turbonote-2", - 34378: "p-net-local", - 34379: "p-net-remote", - 34567: "edi_service", - 34962: "profinet-rt", - 34963: "profinet-rtm", - 34964: "profinet-cm", - 34980: "ethercat", - 35001: "rt-viewer", - 35004: "rt-classmanager", - 35100: "axio-disc", - 35355: "altova-lm-disc", - 36001: "allpeers", - 36411: "wlcp", - 36865: "kastenxpipe", - 37475: "neckar", - 37654: "unisys-eportal", - 38002: "crescoctrl-disc", - 38201: "galaxy7-data", - 38202: "fairview", - 38203: "agpolicy", - 39681: "turbonote-1", - 40000: "safetynetp", - 40023: "k-patentssensor", - 40841: "cscp", - 40842: "csccredir", - 40843: "csccfirewall", - 40853: "ortec-disc", - 41111: "fs-qos", - 41230: "z-wave-s", - 41794: "crestron-cip", - 41795: "crestron-ctp", - 42508: "candp", - 42509: "candrp", - 42510: "caerpc", - 43000: "recvr-rc-disc", - 43188: "reachout", - 43189: "ndm-agent-port", - 43190: "ip-provision", - 43210: "shaperai-disc", - 43439: "eq3-config", - 43440: "ew-disc-cmd", - 43441: "ciscocsdb", - 44321: "pmcd", - 44322: "pmcdproxy", - 44544: "domiq", - 44553: "rbr-debug", - 44600: "asihpi", - 44818: "EtherNet-IP-2", - 44900: "m3da-disc", - 45000: "asmp-mon", - 45054: "invision-ag", - 45514: "cloudcheck-ping", - 45678: "eba", - 45825: "qdb2service", - 45966: "ssr-servermgr", - 46999: "mediabox", - 47000: "mbus", - 47100: "jvl-mactalk", - 47557: "dbbrowse", - 47624: "directplaysrvr", - 47806: "ap", - 47808: "bacnet", - 47809: "presonus-ucnet", - 48000: "nimcontroller", - 48001: "nimspooler", - 48002: "nimhub", - 48003: "nimgtw", - 48128: "isnetserv", - 48129: "blp5", - 48556: "com-bardac-dw", - 48619: "iqobject", - 48653: "robotraconteur", - 49001: "nusdp-disc", -} -var sctpPortNames = map[SCTPPort]string{ - 9: "discard", - 20: "ftp-data", - 21: "ftp", - 22: "ssh", - 80: "http", - 179: "bgp", - 443: "https", - 1021: "exp1", - 1022: "exp2", - 1167: "cisco-ipsla", - 1720: "h323hostcall", - 2049: "nfs", - 2225: "rcip-itu", - 2904: "m2ua", - 2905: "m3ua", - 2944: "megaco-h248", - 2945: "h248-binary", - 3097: "itu-bicc-stc", - 3565: "m2pa", - 3863: "asap-sctp", - 3864: "asap-sctp-tls", - 3868: "diameter", - 4333: "ahsp", - 4502: "a25-fap-fgw", - 4711: "trinity-dist", - 4739: "ipfix", - 4740: "ipfixs", - 5060: "sip", - 5061: "sips", - 5090: "car", - 5091: "cxtp", - 5215: "noteza", - 5445: "smbdirect", - 5672: "amqp", - 5675: "v5ua", - 5868: "diameters", - 5910: "cm", - 5911: "cpdlc", - 5912: "fis", - 5913: "ads-c", - 6704: "frc-hp", - 6705: "frc-mp", - 6706: "frc-lp", - 6970: "conductor-mpx", - 7626: "simco", - 7701: "nfapi", - 7728: "osvr", - 8471: "pim-port", - 9082: "lcs-ap", - 9084: "aurora", - 9900: "iua", - 9901: "enrp-sctp", - 9902: "enrp-sctp-tls", - 11997: "wmereceiving", - 11998: "wmedistribution", - 11999: "wmereporting", - 14001: "sua", - 20049: "nfsrdma", - 25471: "rna", - 29118: "sgsap", - 29168: "sbcap", - 29169: "iuhsctpassoc", - 30100: "rwp", - 36412: "s1-control", - 36422: "x2-control", - 36423: "slmap", - 36424: "nq-ap", - 36443: "m2ap", - 36444: "m3ap", - 36462: "xw-control", - 38412: "ng-control", - 38422: "xn-control", - 38472: "f1-control", -} diff --git a/vendor/github.com/google/gopacket/layers/icmp4.go b/vendor/github.com/google/gopacket/layers/icmp4.go deleted file mode 100644 index bd3f03f00..000000000 --- a/vendor/github.com/google/gopacket/layers/icmp4.go +++ /dev/null @@ -1,267 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// Copyright 2009-2011 Andreas Krennmair. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - "fmt" - "reflect" - - "github.com/google/gopacket" -) - -const ( - ICMPv4TypeEchoReply = 0 - ICMPv4TypeDestinationUnreachable = 3 - ICMPv4TypeSourceQuench = 4 - ICMPv4TypeRedirect = 5 - ICMPv4TypeEchoRequest = 8 - ICMPv4TypeRouterAdvertisement = 9 - ICMPv4TypeRouterSolicitation = 10 - ICMPv4TypeTimeExceeded = 11 - ICMPv4TypeParameterProblem = 12 - ICMPv4TypeTimestampRequest = 13 - ICMPv4TypeTimestampReply = 14 - ICMPv4TypeInfoRequest = 15 - ICMPv4TypeInfoReply = 16 - ICMPv4TypeAddressMaskRequest = 17 - ICMPv4TypeAddressMaskReply = 18 -) - -const ( - // DestinationUnreachable - ICMPv4CodeNet = 0 - ICMPv4CodeHost = 1 - ICMPv4CodeProtocol = 2 - ICMPv4CodePort = 3 - ICMPv4CodeFragmentationNeeded = 4 - ICMPv4CodeSourceRoutingFailed = 5 - ICMPv4CodeNetUnknown = 6 - ICMPv4CodeHostUnknown = 7 - ICMPv4CodeSourceIsolated = 8 - ICMPv4CodeNetAdminProhibited = 9 - ICMPv4CodeHostAdminProhibited = 10 - ICMPv4CodeNetTOS = 11 - ICMPv4CodeHostTOS = 12 - ICMPv4CodeCommAdminProhibited = 13 - ICMPv4CodeHostPrecedence = 14 - ICMPv4CodePrecedenceCutoff = 15 - - // TimeExceeded - ICMPv4CodeTTLExceeded = 0 - ICMPv4CodeFragmentReassemblyTimeExceeded = 1 - - // ParameterProblem - ICMPv4CodePointerIndicatesError = 0 - ICMPv4CodeMissingOption = 1 - ICMPv4CodeBadLength = 2 - - // Redirect - // ICMPv4CodeNet = same as for DestinationUnreachable - // ICMPv4CodeHost = same as for DestinationUnreachable - ICMPv4CodeTOSNet = 2 - ICMPv4CodeTOSHost = 3 -) - -type icmpv4TypeCodeInfoStruct struct { - typeStr string - codeStr *map[uint8]string -} - -var ( - icmpv4TypeCodeInfo = map[uint8]icmpv4TypeCodeInfoStruct{ - ICMPv4TypeDestinationUnreachable: icmpv4TypeCodeInfoStruct{ - "DestinationUnreachable", &map[uint8]string{ - ICMPv4CodeNet: "Net", - ICMPv4CodeHost: "Host", - ICMPv4CodeProtocol: "Protocol", - ICMPv4CodePort: "Port", - ICMPv4CodeFragmentationNeeded: "FragmentationNeeded", - ICMPv4CodeSourceRoutingFailed: "SourceRoutingFailed", - ICMPv4CodeNetUnknown: "NetUnknown", - ICMPv4CodeHostUnknown: "HostUnknown", - ICMPv4CodeSourceIsolated: "SourceIsolated", - ICMPv4CodeNetAdminProhibited: "NetAdminProhibited", - ICMPv4CodeHostAdminProhibited: "HostAdminProhibited", - ICMPv4CodeNetTOS: "NetTOS", - ICMPv4CodeHostTOS: "HostTOS", - ICMPv4CodeCommAdminProhibited: "CommAdminProhibited", - ICMPv4CodeHostPrecedence: "HostPrecedence", - ICMPv4CodePrecedenceCutoff: "PrecedenceCutoff", - }, - }, - ICMPv4TypeTimeExceeded: icmpv4TypeCodeInfoStruct{ - "TimeExceeded", &map[uint8]string{ - ICMPv4CodeTTLExceeded: "TTLExceeded", - ICMPv4CodeFragmentReassemblyTimeExceeded: "FragmentReassemblyTimeExceeded", - }, - }, - ICMPv4TypeParameterProblem: icmpv4TypeCodeInfoStruct{ - "ParameterProblem", &map[uint8]string{ - ICMPv4CodePointerIndicatesError: "PointerIndicatesError", - ICMPv4CodeMissingOption: "MissingOption", - ICMPv4CodeBadLength: "BadLength", - }, - }, - ICMPv4TypeSourceQuench: icmpv4TypeCodeInfoStruct{ - "SourceQuench", nil, - }, - ICMPv4TypeRedirect: icmpv4TypeCodeInfoStruct{ - "Redirect", &map[uint8]string{ - ICMPv4CodeNet: "Net", - ICMPv4CodeHost: "Host", - ICMPv4CodeTOSNet: "TOS+Net", - ICMPv4CodeTOSHost: "TOS+Host", - }, - }, - ICMPv4TypeEchoRequest: icmpv4TypeCodeInfoStruct{ - "EchoRequest", nil, - }, - ICMPv4TypeEchoReply: icmpv4TypeCodeInfoStruct{ - "EchoReply", nil, - }, - ICMPv4TypeTimestampRequest: icmpv4TypeCodeInfoStruct{ - "TimestampRequest", nil, - }, - ICMPv4TypeTimestampReply: icmpv4TypeCodeInfoStruct{ - "TimestampReply", nil, - }, - ICMPv4TypeInfoRequest: icmpv4TypeCodeInfoStruct{ - "InfoRequest", nil, - }, - ICMPv4TypeInfoReply: icmpv4TypeCodeInfoStruct{ - "InfoReply", nil, - }, - ICMPv4TypeRouterSolicitation: icmpv4TypeCodeInfoStruct{ - "RouterSolicitation", nil, - }, - ICMPv4TypeRouterAdvertisement: icmpv4TypeCodeInfoStruct{ - "RouterAdvertisement", nil, - }, - ICMPv4TypeAddressMaskRequest: icmpv4TypeCodeInfoStruct{ - "AddressMaskRequest", nil, - }, - ICMPv4TypeAddressMaskReply: icmpv4TypeCodeInfoStruct{ - "AddressMaskReply", nil, - }, - } -) - -type ICMPv4TypeCode uint16 - -// Type returns the ICMPv4 type field. -func (a ICMPv4TypeCode) Type() uint8 { - return uint8(a >> 8) -} - -// Code returns the ICMPv4 code field. -func (a ICMPv4TypeCode) Code() uint8 { - return uint8(a) -} - -func (a ICMPv4TypeCode) String() string { - t, c := a.Type(), a.Code() - strInfo, ok := icmpv4TypeCodeInfo[t] - if !ok { - // Unknown ICMPv4 type field - return fmt.Sprintf("%d(%d)", t, c) - } - typeStr := strInfo.typeStr - if strInfo.codeStr == nil && c == 0 { - // The ICMPv4 type does not make use of the code field - return fmt.Sprintf("%s", strInfo.typeStr) - } - if strInfo.codeStr == nil && c != 0 { - // The ICMPv4 type does not make use of the code field, but it is present anyway - return fmt.Sprintf("%s(Code: %d)", typeStr, c) - } - codeStr, ok := (*strInfo.codeStr)[c] - if !ok { - // We don't know this ICMPv4 code; print the numerical value - return fmt.Sprintf("%s(Code: %d)", typeStr, c) - } - return fmt.Sprintf("%s(%s)", typeStr, codeStr) -} - -func (a ICMPv4TypeCode) GoString() string { - t := reflect.TypeOf(a) - return fmt.Sprintf("%s(%d, %d)", t.String(), a.Type(), a.Code()) -} - -// SerializeTo writes the ICMPv4TypeCode value to the 'bytes' buffer. -func (a ICMPv4TypeCode) SerializeTo(bytes []byte) { - binary.BigEndian.PutUint16(bytes, uint16(a)) -} - -// CreateICMPv4TypeCode is a convenience function to create an ICMPv4TypeCode -// gopacket type from the ICMPv4 type and code values. -func CreateICMPv4TypeCode(typ uint8, code uint8) ICMPv4TypeCode { - return ICMPv4TypeCode(binary.BigEndian.Uint16([]byte{typ, code})) -} - -// ICMPv4 is the layer for IPv4 ICMP packet data. -type ICMPv4 struct { - BaseLayer - TypeCode ICMPv4TypeCode - Checksum uint16 - Id uint16 - Seq uint16 -} - -// LayerType returns LayerTypeICMPv4. -func (i *ICMPv4) LayerType() gopacket.LayerType { return LayerTypeICMPv4 } - -// DecodeFromBytes decodes the given bytes into this layer. -func (i *ICMPv4) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 8 { - df.SetTruncated() - return errors.New("ICMP layer less then 8 bytes for ICMPv4 packet") - } - i.TypeCode = CreateICMPv4TypeCode(data[0], data[1]) - i.Checksum = binary.BigEndian.Uint16(data[2:4]) - i.Id = binary.BigEndian.Uint16(data[4:6]) - i.Seq = binary.BigEndian.Uint16(data[6:8]) - i.BaseLayer = BaseLayer{data[:8], data[8:]} - return nil -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (i *ICMPv4) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - bytes, err := b.PrependBytes(8) - if err != nil { - return err - } - i.TypeCode.SerializeTo(bytes) - binary.BigEndian.PutUint16(bytes[4:], i.Id) - binary.BigEndian.PutUint16(bytes[6:], i.Seq) - if opts.ComputeChecksums { - bytes[2] = 0 - bytes[3] = 0 - i.Checksum = tcpipChecksum(b.Bytes(), 0) - } - binary.BigEndian.PutUint16(bytes[2:], i.Checksum) - return nil -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (i *ICMPv4) CanDecode() gopacket.LayerClass { - return LayerTypeICMPv4 -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (i *ICMPv4) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypePayload -} - -func decodeICMPv4(data []byte, p gopacket.PacketBuilder) error { - i := &ICMPv4{} - return decodingLayerDecoder(i, data, p) -} diff --git a/vendor/github.com/google/gopacket/layers/icmp6.go b/vendor/github.com/google/gopacket/layers/icmp6.go deleted file mode 100644 index 09afd11a6..000000000 --- a/vendor/github.com/google/gopacket/layers/icmp6.go +++ /dev/null @@ -1,266 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// Copyright 2009-2011 Andreas Krennmair. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - "fmt" - "reflect" - - "github.com/google/gopacket" -) - -const ( - // The following are from RFC 4443 - ICMPv6TypeDestinationUnreachable = 1 - ICMPv6TypePacketTooBig = 2 - ICMPv6TypeTimeExceeded = 3 - ICMPv6TypeParameterProblem = 4 - ICMPv6TypeEchoRequest = 128 - ICMPv6TypeEchoReply = 129 - - // The following are from RFC 4861 - ICMPv6TypeRouterSolicitation = 133 - ICMPv6TypeRouterAdvertisement = 134 - ICMPv6TypeNeighborSolicitation = 135 - ICMPv6TypeNeighborAdvertisement = 136 - ICMPv6TypeRedirect = 137 - - // The following are from RFC 2710 - ICMPv6TypeMLDv1MulticastListenerQueryMessage = 130 - ICMPv6TypeMLDv1MulticastListenerReportMessage = 131 - ICMPv6TypeMLDv1MulticastListenerDoneMessage = 132 - - // The following are from RFC 3810 - ICMPv6TypeMLDv2MulticastListenerReportMessageV2 = 143 -) - -const ( - // DestinationUnreachable - ICMPv6CodeNoRouteToDst = 0 - ICMPv6CodeAdminProhibited = 1 - ICMPv6CodeBeyondScopeOfSrc = 2 - ICMPv6CodeAddressUnreachable = 3 - ICMPv6CodePortUnreachable = 4 - ICMPv6CodeSrcAddressFailedPolicy = 5 - ICMPv6CodeRejectRouteToDst = 6 - - // TimeExceeded - ICMPv6CodeHopLimitExceeded = 0 - ICMPv6CodeFragmentReassemblyTimeExceeded = 1 - - // ParameterProblem - ICMPv6CodeErroneousHeaderField = 0 - ICMPv6CodeUnrecognizedNextHeader = 1 - ICMPv6CodeUnrecognizedIPv6Option = 2 -) - -type icmpv6TypeCodeInfoStruct struct { - typeStr string - codeStr *map[uint8]string -} - -var ( - icmpv6TypeCodeInfo = map[uint8]icmpv6TypeCodeInfoStruct{ - ICMPv6TypeDestinationUnreachable: icmpv6TypeCodeInfoStruct{ - "DestinationUnreachable", &map[uint8]string{ - ICMPv6CodeNoRouteToDst: "NoRouteToDst", - ICMPv6CodeAdminProhibited: "AdminProhibited", - ICMPv6CodeBeyondScopeOfSrc: "BeyondScopeOfSrc", - ICMPv6CodeAddressUnreachable: "AddressUnreachable", - ICMPv6CodePortUnreachable: "PortUnreachable", - ICMPv6CodeSrcAddressFailedPolicy: "SrcAddressFailedPolicy", - ICMPv6CodeRejectRouteToDst: "RejectRouteToDst", - }, - }, - ICMPv6TypePacketTooBig: icmpv6TypeCodeInfoStruct{ - "PacketTooBig", nil, - }, - ICMPv6TypeTimeExceeded: icmpv6TypeCodeInfoStruct{ - "TimeExceeded", &map[uint8]string{ - ICMPv6CodeHopLimitExceeded: "HopLimitExceeded", - ICMPv6CodeFragmentReassemblyTimeExceeded: "FragmentReassemblyTimeExceeded", - }, - }, - ICMPv6TypeParameterProblem: icmpv6TypeCodeInfoStruct{ - "ParameterProblem", &map[uint8]string{ - ICMPv6CodeErroneousHeaderField: "ErroneousHeaderField", - ICMPv6CodeUnrecognizedNextHeader: "UnrecognizedNextHeader", - ICMPv6CodeUnrecognizedIPv6Option: "UnrecognizedIPv6Option", - }, - }, - ICMPv6TypeEchoRequest: icmpv6TypeCodeInfoStruct{ - "EchoRequest", nil, - }, - ICMPv6TypeEchoReply: icmpv6TypeCodeInfoStruct{ - "EchoReply", nil, - }, - ICMPv6TypeRouterSolicitation: icmpv6TypeCodeInfoStruct{ - "RouterSolicitation", nil, - }, - ICMPv6TypeRouterAdvertisement: icmpv6TypeCodeInfoStruct{ - "RouterAdvertisement", nil, - }, - ICMPv6TypeNeighborSolicitation: icmpv6TypeCodeInfoStruct{ - "NeighborSolicitation", nil, - }, - ICMPv6TypeNeighborAdvertisement: icmpv6TypeCodeInfoStruct{ - "NeighborAdvertisement", nil, - }, - ICMPv6TypeRedirect: icmpv6TypeCodeInfoStruct{ - "Redirect", nil, - }, - } -) - -type ICMPv6TypeCode uint16 - -// Type returns the ICMPv6 type field. -func (a ICMPv6TypeCode) Type() uint8 { - return uint8(a >> 8) -} - -// Code returns the ICMPv6 code field. -func (a ICMPv6TypeCode) Code() uint8 { - return uint8(a) -} - -func (a ICMPv6TypeCode) String() string { - t, c := a.Type(), a.Code() - strInfo, ok := icmpv6TypeCodeInfo[t] - if !ok { - // Unknown ICMPv6 type field - return fmt.Sprintf("%d(%d)", t, c) - } - typeStr := strInfo.typeStr - if strInfo.codeStr == nil && c == 0 { - // The ICMPv6 type does not make use of the code field - return fmt.Sprintf("%s", strInfo.typeStr) - } - if strInfo.codeStr == nil && c != 0 { - // The ICMPv6 type does not make use of the code field, but it is present anyway - return fmt.Sprintf("%s(Code: %d)", typeStr, c) - } - codeStr, ok := (*strInfo.codeStr)[c] - if !ok { - // We don't know this ICMPv6 code; print the numerical value - return fmt.Sprintf("%s(Code: %d)", typeStr, c) - } - return fmt.Sprintf("%s(%s)", typeStr, codeStr) -} - -func (a ICMPv6TypeCode) GoString() string { - t := reflect.TypeOf(a) - return fmt.Sprintf("%s(%d, %d)", t.String(), a.Type(), a.Code()) -} - -// SerializeTo writes the ICMPv6TypeCode value to the 'bytes' buffer. -func (a ICMPv6TypeCode) SerializeTo(bytes []byte) { - binary.BigEndian.PutUint16(bytes, uint16(a)) -} - -// CreateICMPv6TypeCode is a convenience function to create an ICMPv6TypeCode -// gopacket type from the ICMPv6 type and code values. -func CreateICMPv6TypeCode(typ uint8, code uint8) ICMPv6TypeCode { - return ICMPv6TypeCode(binary.BigEndian.Uint16([]byte{typ, code})) -} - -// ICMPv6 is the layer for IPv6 ICMP packet data -type ICMPv6 struct { - BaseLayer - TypeCode ICMPv6TypeCode - Checksum uint16 - // TypeBytes is deprecated and always nil. See the different ICMPv6 message types - // instead (e.g. ICMPv6TypeRouterSolicitation). - TypeBytes []byte - tcpipchecksum -} - -// LayerType returns LayerTypeICMPv6. -func (i *ICMPv6) LayerType() gopacket.LayerType { return LayerTypeICMPv6 } - -// DecodeFromBytes decodes the given bytes into this layer. -func (i *ICMPv6) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 4 { - df.SetTruncated() - return errors.New("ICMP layer less then 4 bytes for ICMPv6 packet") - } - i.TypeCode = CreateICMPv6TypeCode(data[0], data[1]) - i.Checksum = binary.BigEndian.Uint16(data[2:4]) - i.BaseLayer = BaseLayer{data[:4], data[4:]} - return nil -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (i *ICMPv6) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - bytes, err := b.PrependBytes(4) - if err != nil { - return err - } - i.TypeCode.SerializeTo(bytes) - - if opts.ComputeChecksums { - bytes[2] = 0 - bytes[3] = 0 - csum, err := i.computeChecksum(b.Bytes(), IPProtocolICMPv6) - if err != nil { - return err - } - i.Checksum = csum - } - binary.BigEndian.PutUint16(bytes[2:], i.Checksum) - - return nil -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (i *ICMPv6) CanDecode() gopacket.LayerClass { - return LayerTypeICMPv6 -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (i *ICMPv6) NextLayerType() gopacket.LayerType { - switch i.TypeCode.Type() { - case ICMPv6TypeEchoRequest: - return LayerTypeICMPv6Echo - case ICMPv6TypeEchoReply: - return LayerTypeICMPv6Echo - case ICMPv6TypeRouterSolicitation: - return LayerTypeICMPv6RouterSolicitation - case ICMPv6TypeRouterAdvertisement: - return LayerTypeICMPv6RouterAdvertisement - case ICMPv6TypeNeighborSolicitation: - return LayerTypeICMPv6NeighborSolicitation - case ICMPv6TypeNeighborAdvertisement: - return LayerTypeICMPv6NeighborAdvertisement - case ICMPv6TypeRedirect: - return LayerTypeICMPv6Redirect - case ICMPv6TypeMLDv1MulticastListenerQueryMessage: // Same Code for MLDv1 Query and MLDv2 Query - if len(i.Payload) > 20 { // Only payload size differs - return LayerTypeMLDv2MulticastListenerQuery - } else { - return LayerTypeMLDv1MulticastListenerQuery - } - case ICMPv6TypeMLDv1MulticastListenerDoneMessage: - return LayerTypeMLDv1MulticastListenerDone - case ICMPv6TypeMLDv1MulticastListenerReportMessage: - return LayerTypeMLDv1MulticastListenerReport - case ICMPv6TypeMLDv2MulticastListenerReportMessageV2: - return LayerTypeMLDv2MulticastListenerReport - } - - return gopacket.LayerTypePayload -} - -func decodeICMPv6(data []byte, p gopacket.PacketBuilder) error { - i := &ICMPv6{} - return decodingLayerDecoder(i, data, p) -} diff --git a/vendor/github.com/google/gopacket/layers/icmp6msg.go b/vendor/github.com/google/gopacket/layers/icmp6msg.go deleted file mode 100644 index d9268db05..000000000 --- a/vendor/github.com/google/gopacket/layers/icmp6msg.go +++ /dev/null @@ -1,578 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// Copyright 2009-2011 Andreas Krennmair. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "encoding/hex" - "errors" - "fmt" - "net" - "time" - - "github.com/google/gopacket" -) - -// Based on RFC 4861 - -// ICMPv6Opt indicate how to decode the data associated with each ICMPv6Option. -type ICMPv6Opt uint8 - -const ( - _ ICMPv6Opt = iota - - // ICMPv6OptSourceAddress contains the link-layer address of the sender of - // the packet. It is used in the Neighbor Solicitation, Router - // Solicitation, and Router Advertisement packets. Must be ignored for other - // Neighbor discovery messages. - ICMPv6OptSourceAddress - - // ICMPv6OptTargetAddress contains the link-layer address of the target. It - // is used in Neighbor Advertisement and Redirect packets. Must be ignored - // for other Neighbor discovery messages. - ICMPv6OptTargetAddress - - // ICMPv6OptPrefixInfo provides hosts with on-link prefixes and prefixes - // for Address Autoconfiguration. The Prefix Information option appears in - // Router Advertisement packets and MUST be silently ignored for other - // messages. - ICMPv6OptPrefixInfo - - // ICMPv6OptRedirectedHeader is used in Redirect messages and contains all - // or part of the packet that is being redirected. - ICMPv6OptRedirectedHeader - - // ICMPv6OptMTU is used in Router Advertisement messages to ensure that all - // nodes on a link use the same MTU value in those cases where the link MTU - // is not well known. This option MUST be silently ignored for other - // Neighbor Discovery messages. - ICMPv6OptMTU -) - -// ICMPv6Echo represents the structure of a ping. -type ICMPv6Echo struct { - BaseLayer - Identifier uint16 - SeqNumber uint16 -} - -// ICMPv6RouterSolicitation is sent by hosts to find routers. -type ICMPv6RouterSolicitation struct { - BaseLayer - Options ICMPv6Options -} - -// ICMPv6RouterAdvertisement is sent by routers in response to Solicitation. -type ICMPv6RouterAdvertisement struct { - BaseLayer - HopLimit uint8 - Flags uint8 - RouterLifetime uint16 - ReachableTime uint32 - RetransTimer uint32 - Options ICMPv6Options -} - -// ICMPv6NeighborSolicitation is sent to request the link-layer address of a -// target node. -type ICMPv6NeighborSolicitation struct { - BaseLayer - TargetAddress net.IP - Options ICMPv6Options -} - -// ICMPv6NeighborAdvertisement is sent by nodes in response to Solicitation. -type ICMPv6NeighborAdvertisement struct { - BaseLayer - Flags uint8 - TargetAddress net.IP - Options ICMPv6Options -} - -// ICMPv6Redirect is sent by routers to inform hosts of a better first-hop node -// on the path to a destination. -type ICMPv6Redirect struct { - BaseLayer - TargetAddress net.IP - DestinationAddress net.IP - Options ICMPv6Options -} - -// ICMPv6Option contains the type and data for a single option. -type ICMPv6Option struct { - Type ICMPv6Opt - Data []byte -} - -// ICMPv6Options is a slice of ICMPv6Option. -type ICMPv6Options []ICMPv6Option - -func (i ICMPv6Opt) String() string { - switch i { - case ICMPv6OptSourceAddress: - return "SourceAddress" - case ICMPv6OptTargetAddress: - return "TargetAddress" - case ICMPv6OptPrefixInfo: - return "PrefixInfo" - case ICMPv6OptRedirectedHeader: - return "RedirectedHeader" - case ICMPv6OptMTU: - return "MTU" - default: - return fmt.Sprintf("Unknown(%d)", i) - } -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (i *ICMPv6Echo) CanDecode() gopacket.LayerClass { - return LayerTypeICMPv6Echo -} - -// LayerType returns LayerTypeICMPv6Echo. -func (i *ICMPv6Echo) LayerType() gopacket.LayerType { - return LayerTypeICMPv6Echo -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (i *ICMPv6Echo) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypePayload -} - -// DecodeFromBytes decodes the given bytes into this layer. -func (i *ICMPv6Echo) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 4 { - df.SetTruncated() - return errors.New("ICMP layer less then 4 bytes for ICMPv6 Echo") - } - i.Identifier = binary.BigEndian.Uint16(data[0:2]) - i.SeqNumber = binary.BigEndian.Uint16(data[2:4]) - - return nil -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (i *ICMPv6Echo) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - buf, err := b.PrependBytes(4) - if err != nil { - return err - } - - binary.BigEndian.PutUint16(buf, i.Identifier) - binary.BigEndian.PutUint16(buf[2:], i.SeqNumber) - return nil -} - -// LayerType returns LayerTypeICMPv6. -func (i *ICMPv6RouterSolicitation) LayerType() gopacket.LayerType { - return LayerTypeICMPv6RouterSolicitation -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (i *ICMPv6RouterSolicitation) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypePayload -} - -// DecodeFromBytes decodes the given bytes into this layer. -func (i *ICMPv6RouterSolicitation) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - // first 4 bytes are reserved followed by options - if len(data) < 4 { - df.SetTruncated() - return errors.New("ICMP layer less then 4 bytes for ICMPv6 router solicitation") - } - - // truncate old options - i.Options = i.Options[:0] - - return i.Options.DecodeFromBytes(data[4:], df) -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (i *ICMPv6RouterSolicitation) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - if err := i.Options.SerializeTo(b, opts); err != nil { - return err - } - - buf, err := b.PrependBytes(4) - if err != nil { - return err - } - - copy(buf, lotsOfZeros[:4]) - return nil -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (i *ICMPv6RouterSolicitation) CanDecode() gopacket.LayerClass { - return LayerTypeICMPv6RouterSolicitation -} - -// LayerType returns LayerTypeICMPv6RouterAdvertisement. -func (i *ICMPv6RouterAdvertisement) LayerType() gopacket.LayerType { - return LayerTypeICMPv6RouterAdvertisement -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (i *ICMPv6RouterAdvertisement) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypePayload -} - -// DecodeFromBytes decodes the given bytes into this layer. -func (i *ICMPv6RouterAdvertisement) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 12 { - df.SetTruncated() - return errors.New("ICMP layer less then 12 bytes for ICMPv6 router advertisement") - } - - i.HopLimit = uint8(data[0]) - // M, O bit followed by 6 reserved bits - i.Flags = uint8(data[1]) - i.RouterLifetime = binary.BigEndian.Uint16(data[2:4]) - i.ReachableTime = binary.BigEndian.Uint32(data[4:8]) - i.RetransTimer = binary.BigEndian.Uint32(data[8:12]) - i.BaseLayer = BaseLayer{data, nil} // assume no payload - - // truncate old options - i.Options = i.Options[:0] - - return i.Options.DecodeFromBytes(data[12:], df) -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (i *ICMPv6RouterAdvertisement) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - if err := i.Options.SerializeTo(b, opts); err != nil { - return err - } - - buf, err := b.PrependBytes(12) - if err != nil { - return err - } - - buf[0] = byte(i.HopLimit) - buf[1] = byte(i.Flags) - binary.BigEndian.PutUint16(buf[2:], i.RouterLifetime) - binary.BigEndian.PutUint32(buf[4:], i.ReachableTime) - binary.BigEndian.PutUint32(buf[8:], i.RetransTimer) - return nil -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (i *ICMPv6RouterAdvertisement) CanDecode() gopacket.LayerClass { - return LayerTypeICMPv6RouterAdvertisement -} - -// ManagedAddressConfig is true when addresses are available via DHCPv6. If -// set, the OtherConfig flag is redundant. -func (i *ICMPv6RouterAdvertisement) ManagedAddressConfig() bool { - return i.Flags&0x80 != 0 -} - -// OtherConfig is true when there is other configuration information available -// via DHCPv6. For example, DNS-related information. -func (i *ICMPv6RouterAdvertisement) OtherConfig() bool { - return i.Flags&0x40 != 0 -} - -// LayerType returns LayerTypeICMPv6NeighborSolicitation. -func (i *ICMPv6NeighborSolicitation) LayerType() gopacket.LayerType { - return LayerTypeICMPv6NeighborSolicitation -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (i *ICMPv6NeighborSolicitation) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypePayload -} - -// DecodeFromBytes decodes the given bytes into this layer. -func (i *ICMPv6NeighborSolicitation) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 20 { - df.SetTruncated() - return errors.New("ICMP layer less then 20 bytes for ICMPv6 neighbor solicitation") - } - - i.TargetAddress = net.IP(data[4:20]) - i.BaseLayer = BaseLayer{data, nil} // assume no payload - - // truncate old options - i.Options = i.Options[:0] - - return i.Options.DecodeFromBytes(data[20:], df) -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (i *ICMPv6NeighborSolicitation) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - if err := i.Options.SerializeTo(b, opts); err != nil { - return err - } - - buf, err := b.PrependBytes(20) - if err != nil { - return err - } - - copy(buf, lotsOfZeros[:4]) - copy(buf[4:], i.TargetAddress) - return nil -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (i *ICMPv6NeighborSolicitation) CanDecode() gopacket.LayerClass { - return LayerTypeICMPv6NeighborSolicitation -} - -// LayerType returns LayerTypeICMPv6NeighborAdvertisement. -func (i *ICMPv6NeighborAdvertisement) LayerType() gopacket.LayerType { - return LayerTypeICMPv6NeighborAdvertisement -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (i *ICMPv6NeighborAdvertisement) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypePayload -} - -// DecodeFromBytes decodes the given bytes into this layer. -func (i *ICMPv6NeighborAdvertisement) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 20 { - df.SetTruncated() - return errors.New("ICMP layer less then 20 bytes for ICMPv6 neighbor advertisement") - } - - i.Flags = uint8(data[0]) - i.TargetAddress = net.IP(data[4:20]) - i.BaseLayer = BaseLayer{data, nil} // assume no payload - - // truncate old options - i.Options = i.Options[:0] - - return i.Options.DecodeFromBytes(data[20:], df) -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (i *ICMPv6NeighborAdvertisement) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - if err := i.Options.SerializeTo(b, opts); err != nil { - return err - } - - buf, err := b.PrependBytes(20) - if err != nil { - return err - } - - buf[0] = byte(i.Flags) - copy(buf[1:], lotsOfZeros[:3]) - copy(buf[4:], i.TargetAddress) - return nil -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (i *ICMPv6NeighborAdvertisement) CanDecode() gopacket.LayerClass { - return LayerTypeICMPv6NeighborAdvertisement -} - -// Router indicates whether the sender is a router or not. -func (i *ICMPv6NeighborAdvertisement) Router() bool { - return i.Flags&0x80 != 0 -} - -// Solicited indicates whether the advertisement was solicited or not. -func (i *ICMPv6NeighborAdvertisement) Solicited() bool { - return i.Flags&0x40 != 0 -} - -// Override indicates whether the advertisement should Override an existing -// cache entry. -func (i *ICMPv6NeighborAdvertisement) Override() bool { - return i.Flags&0x20 != 0 -} - -// LayerType returns LayerTypeICMPv6Redirect. -func (i *ICMPv6Redirect) LayerType() gopacket.LayerType { - return LayerTypeICMPv6Redirect -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (i *ICMPv6Redirect) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypePayload -} - -// DecodeFromBytes decodes the given bytes into this layer. -func (i *ICMPv6Redirect) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 36 { - df.SetTruncated() - return errors.New("ICMP layer less then 36 bytes for ICMPv6 redirect") - } - - i.TargetAddress = net.IP(data[4:20]) - i.DestinationAddress = net.IP(data[20:36]) - i.BaseLayer = BaseLayer{data, nil} // assume no payload - - // truncate old options - i.Options = i.Options[:0] - - return i.Options.DecodeFromBytes(data[36:], df) -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (i *ICMPv6Redirect) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - if err := i.Options.SerializeTo(b, opts); err != nil { - return err - } - - buf, err := b.PrependBytes(36) - if err != nil { - return err - } - - copy(buf, lotsOfZeros[:4]) - copy(buf[4:], i.TargetAddress) - copy(buf[20:], i.DestinationAddress) - return nil -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (i *ICMPv6Redirect) CanDecode() gopacket.LayerClass { - return LayerTypeICMPv6Redirect -} - -func (i ICMPv6Option) String() string { - hd := hex.EncodeToString(i.Data) - if len(hd) > 0 { - hd = " 0x" + hd - } - - switch i.Type { - case ICMPv6OptSourceAddress, ICMPv6OptTargetAddress: - return fmt.Sprintf("ICMPv6Option(%s:%v)", - i.Type, - net.HardwareAddr(i.Data)) - case ICMPv6OptPrefixInfo: - if len(i.Data) == 30 { - prefixLen := uint8(i.Data[0]) - onLink := (i.Data[1]&0x80 != 0) - autonomous := (i.Data[1]&0x40 != 0) - validLifetime := time.Duration(binary.BigEndian.Uint32(i.Data[2:6])) * time.Second - preferredLifetime := time.Duration(binary.BigEndian.Uint32(i.Data[6:10])) * time.Second - - prefix := net.IP(i.Data[14:]) - - return fmt.Sprintf("ICMPv6Option(%s:%v/%v:%t:%t:%v:%v)", - i.Type, - prefix, prefixLen, - onLink, autonomous, - validLifetime, preferredLifetime) - } - case ICMPv6OptRedirectedHeader: - // could invoke IP decoder on data... probably best not to - break - case ICMPv6OptMTU: - if len(i.Data) == 6 { - return fmt.Sprintf("ICMPv6Option(%s:%v)", - i.Type, - binary.BigEndian.Uint32(i.Data[2:])) - } - - } - return fmt.Sprintf("ICMPv6Option(%s:%s)", i.Type, hd) -} - -// DecodeFromBytes decodes the given bytes into this layer. -func (i *ICMPv6Options) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - for len(data) > 0 { - if len(data) < 2 { - df.SetTruncated() - return errors.New("ICMP layer less then 2 bytes for ICMPv6 message option") - } - - // unit is 8 octets, convert to bytes - length := int(data[1]) * 8 - - if length == 0 { - df.SetTruncated() - return errors.New("ICMPv6 message option with length 0") - } - - if len(data) < length { - df.SetTruncated() - return fmt.Errorf("ICMP layer only %v bytes for ICMPv6 message option with length %v", len(data), length) - } - - o := ICMPv6Option{ - Type: ICMPv6Opt(data[0]), - Data: data[2:length], - } - - // chop off option we just consumed - data = data[length:] - - *i = append(*i, o) - } - - return nil -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (i *ICMPv6Options) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - for _, opt := range []ICMPv6Option(*i) { - length := len(opt.Data) + 2 - buf, err := b.PrependBytes(length) - if err != nil { - return err - } - - buf[0] = byte(opt.Type) - buf[1] = byte(length / 8) - copy(buf[2:], opt.Data) - } - - return nil -} - -func decodeICMPv6Echo(data []byte, p gopacket.PacketBuilder) error { - i := &ICMPv6Echo{} - return decodingLayerDecoder(i, data, p) -} - -func decodeICMPv6RouterSolicitation(data []byte, p gopacket.PacketBuilder) error { - i := &ICMPv6RouterSolicitation{} - return decodingLayerDecoder(i, data, p) -} - -func decodeICMPv6RouterAdvertisement(data []byte, p gopacket.PacketBuilder) error { - i := &ICMPv6RouterAdvertisement{} - return decodingLayerDecoder(i, data, p) -} - -func decodeICMPv6NeighborSolicitation(data []byte, p gopacket.PacketBuilder) error { - i := &ICMPv6NeighborSolicitation{} - return decodingLayerDecoder(i, data, p) -} - -func decodeICMPv6NeighborAdvertisement(data []byte, p gopacket.PacketBuilder) error { - i := &ICMPv6NeighborAdvertisement{} - return decodingLayerDecoder(i, data, p) -} - -func decodeICMPv6Redirect(data []byte, p gopacket.PacketBuilder) error { - i := &ICMPv6Redirect{} - return decodingLayerDecoder(i, data, p) -} diff --git a/vendor/github.com/google/gopacket/layers/igmp.go b/vendor/github.com/google/gopacket/layers/igmp.go deleted file mode 100644 index d00841535..000000000 --- a/vendor/github.com/google/gopacket/layers/igmp.go +++ /dev/null @@ -1,355 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// Copyright 2009-2011 Andreas Krennmair. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - "net" - "time" - - "github.com/google/gopacket" -) - -type IGMPType uint8 - -const ( - IGMPMembershipQuery IGMPType = 0x11 // General or group specific query - IGMPMembershipReportV1 IGMPType = 0x12 // Version 1 Membership Report - IGMPMembershipReportV2 IGMPType = 0x16 // Version 2 Membership Report - IGMPLeaveGroup IGMPType = 0x17 // Leave Group - IGMPMembershipReportV3 IGMPType = 0x22 // Version 3 Membership Report -) - -// String conversions for IGMP message types -func (i IGMPType) String() string { - switch i { - case IGMPMembershipQuery: - return "IGMP Membership Query" - case IGMPMembershipReportV1: - return "IGMPv1 Membership Report" - case IGMPMembershipReportV2: - return "IGMPv2 Membership Report" - case IGMPMembershipReportV3: - return "IGMPv3 Membership Report" - case IGMPLeaveGroup: - return "Leave Group" - default: - return "" - } -} - -type IGMPv3GroupRecordType uint8 - -const ( - IGMPIsIn IGMPv3GroupRecordType = 0x01 // Type MODE_IS_INCLUDE, source addresses x - IGMPIsEx IGMPv3GroupRecordType = 0x02 // Type MODE_IS_EXCLUDE, source addresses x - IGMPToIn IGMPv3GroupRecordType = 0x03 // Type CHANGE_TO_INCLUDE_MODE, source addresses x - IGMPToEx IGMPv3GroupRecordType = 0x04 // Type CHANGE_TO_EXCLUDE_MODE, source addresses x - IGMPAllow IGMPv3GroupRecordType = 0x05 // Type ALLOW_NEW_SOURCES, source addresses x - IGMPBlock IGMPv3GroupRecordType = 0x06 // Type BLOCK_OLD_SOURCES, source addresses x -) - -func (i IGMPv3GroupRecordType) String() string { - switch i { - case IGMPIsIn: - return "MODE_IS_INCLUDE" - case IGMPIsEx: - return "MODE_IS_EXCLUDE" - case IGMPToIn: - return "CHANGE_TO_INCLUDE_MODE" - case IGMPToEx: - return "CHANGE_TO_EXCLUDE_MODE" - case IGMPAllow: - return "ALLOW_NEW_SOURCES" - case IGMPBlock: - return "BLOCK_OLD_SOURCES" - default: - return "" - } -} - -// IGMP represents an IGMPv3 message. -type IGMP struct { - BaseLayer - Type IGMPType - MaxResponseTime time.Duration - Checksum uint16 - GroupAddress net.IP - SupressRouterProcessing bool - RobustnessValue uint8 - IntervalTime time.Duration - SourceAddresses []net.IP - NumberOfGroupRecords uint16 - NumberOfSources uint16 - GroupRecords []IGMPv3GroupRecord - Version uint8 // IGMP protocol version -} - -// IGMPv1or2 stores header details for an IGMPv1 or IGMPv2 packet. -// -// 0 1 2 3 -// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Type | Max Resp Time | Checksum | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Group Address | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -type IGMPv1or2 struct { - BaseLayer - Type IGMPType // IGMP message type - MaxResponseTime time.Duration // meaningful only in Membership Query messages - Checksum uint16 // 16-bit checksum of entire ip payload - GroupAddress net.IP // either 0 or an IP multicast address - Version uint8 -} - -// decodeResponse dissects IGMPv1 or IGMPv2 packet. -func (i *IGMPv1or2) decodeResponse(data []byte) error { - if len(data) < 8 { - return errors.New("IGMP packet too small") - } - - i.MaxResponseTime = igmpTimeDecode(data[1]) - i.Checksum = binary.BigEndian.Uint16(data[2:4]) - i.GroupAddress = net.IP(data[4:8]) - - return nil -} - -// 0 1 2 3 -// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Type = 0x22 | Reserved | Checksum | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Reserved | Number of Group Records (M) | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | | -// . Group Record [1] . -// | | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | | -// . Group Record [2] . -// | | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | | -// . Group Record [M] . -// | | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Record Type | Aux Data Len | Number of Sources (N) | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Multicast Address | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Source Address [1] | -// +- -+ -// | Source Address [2] | -// +- -+ -// | Source Address [N] | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | | -// . Auxiliary Data . -// | | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - -// IGMPv3GroupRecord stores individual group records for a V3 Membership Report message. -type IGMPv3GroupRecord struct { - Type IGMPv3GroupRecordType - AuxDataLen uint8 // this should always be 0 as per IGMPv3 spec. - NumberOfSources uint16 - MulticastAddress net.IP - SourceAddresses []net.IP - AuxData uint32 // NOT USED -} - -func (i *IGMP) decodeIGMPv3MembershipReport(data []byte) error { - if len(data) < 8 { - return errors.New("IGMPv3 Membership Report too small #1") - } - - i.Checksum = binary.BigEndian.Uint16(data[2:4]) - i.NumberOfGroupRecords = binary.BigEndian.Uint16(data[6:8]) - - recordOffset := 8 - for j := 0; j < int(i.NumberOfGroupRecords); j++ { - if len(data) < recordOffset+8 { - return errors.New("IGMPv3 Membership Report too small #2") - } - - var gr IGMPv3GroupRecord - gr.Type = IGMPv3GroupRecordType(data[recordOffset]) - gr.AuxDataLen = data[recordOffset+1] - gr.NumberOfSources = binary.BigEndian.Uint16(data[recordOffset+2 : recordOffset+4]) - gr.MulticastAddress = net.IP(data[recordOffset+4 : recordOffset+8]) - - if len(data) < recordOffset+8+int(gr.NumberOfSources)*4 { - return errors.New("IGMPv3 Membership Report too small #3") - } - - // append source address records. - for i := 0; i < int(gr.NumberOfSources); i++ { - sourceAddr := net.IP(data[recordOffset+8+i*4 : recordOffset+12+i*4]) - gr.SourceAddresses = append(gr.SourceAddresses, sourceAddr) - } - - i.GroupRecords = append(i.GroupRecords, gr) - recordOffset += 8 + 4*int(gr.NumberOfSources) - } - return nil -} - -// 0 1 2 3 -// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Type = 0x11 | Max Resp Code | Checksum | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Group Address | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Resv |S| QRV | QQIC | Number of Sources (N) | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Source Address [1] | -// +- -+ -// | Source Address [2] | -// +- . -+ -// | Source Address [N] | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// -// decodeIGMPv3MembershipQuery parses the IGMPv3 message of type 0x11 -func (i *IGMP) decodeIGMPv3MembershipQuery(data []byte) error { - if len(data) < 12 { - return errors.New("IGMPv3 Membership Query too small #1") - } - - i.MaxResponseTime = igmpTimeDecode(data[1]) - i.Checksum = binary.BigEndian.Uint16(data[2:4]) - i.SupressRouterProcessing = data[8]&0x8 != 0 - i.GroupAddress = net.IP(data[4:8]) - i.RobustnessValue = data[8] & 0x7 - i.IntervalTime = igmpTimeDecode(data[9]) - i.NumberOfSources = binary.BigEndian.Uint16(data[10:12]) - - if len(data) < 12+int(i.NumberOfSources)*4 { - return errors.New("IGMPv3 Membership Query too small #2") - } - - for j := 0; j < int(i.NumberOfSources); j++ { - i.SourceAddresses = append(i.SourceAddresses, net.IP(data[12+j*4:16+j*4])) - } - - return nil -} - -// igmpTimeDecode decodes the duration created by the given byte, using the -// algorithm in http://www.rfc-base.org/txt/rfc-3376.txt section 4.1.1. -func igmpTimeDecode(t uint8) time.Duration { - if t&0x80 == 0 { - return time.Millisecond * 100 * time.Duration(t) - } - mant := (t & 0x70) >> 4 - exp := t & 0x0F - return time.Millisecond * 100 * time.Duration((mant|0x10)<<(exp+3)) -} - -// LayerType returns LayerTypeIGMP for the V1,2,3 message protocol formats. -func (i *IGMP) LayerType() gopacket.LayerType { return LayerTypeIGMP } -func (i *IGMPv1or2) LayerType() gopacket.LayerType { return LayerTypeIGMP } - -func (i *IGMPv1or2) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 8 { - return errors.New("IGMP Packet too small") - } - - i.Type = IGMPType(data[0]) - i.MaxResponseTime = igmpTimeDecode(data[1]) - i.Checksum = binary.BigEndian.Uint16(data[2:4]) - i.GroupAddress = net.IP(data[4:8]) - - return nil -} - -func (i *IGMPv1or2) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypeZero -} - -func (i *IGMPv1or2) CanDecode() gopacket.LayerClass { - return LayerTypeIGMP -} - -// DecodeFromBytes decodes the given bytes into this layer. -func (i *IGMP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 1 { - return errors.New("IGMP packet is too small") - } - - // common IGMP header values between versions 1..3 of IGMP specification.. - i.Type = IGMPType(data[0]) - - switch i.Type { - case IGMPMembershipQuery: - i.decodeIGMPv3MembershipQuery(data) - case IGMPMembershipReportV3: - i.decodeIGMPv3MembershipReport(data) - default: - return errors.New("unsupported IGMP type") - } - - return nil -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (i *IGMP) CanDecode() gopacket.LayerClass { - return LayerTypeIGMP -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (i *IGMP) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypeZero -} - -// decodeIGMP will parse IGMP v1,2 or 3 protocols. Checks against the -// IGMP type are performed against byte[0], logic then iniitalizes and -// passes the appropriate struct (IGMP or IGMPv1or2) to -// decodingLayerDecoder. -func decodeIGMP(data []byte, p gopacket.PacketBuilder) error { - if len(data) < 1 { - return errors.New("IGMP packet is too small") - } - - // byte 0 contains IGMP message type. - switch IGMPType(data[0]) { - case IGMPMembershipQuery: - // IGMPv3 Membership Query payload is >= 12 - if len(data) >= 12 { - i := &IGMP{Version: 3} - return decodingLayerDecoder(i, data, p) - } else if len(data) == 8 { - i := &IGMPv1or2{} - if data[1] == 0x00 { - i.Version = 1 // IGMPv1 has a query length of 8 and MaxResp = 0 - } else { - i.Version = 2 // IGMPv2 has a query length of 8 and MaxResp != 0 - } - - return decodingLayerDecoder(i, data, p) - } - case IGMPMembershipReportV3: - i := &IGMP{Version: 3} - return decodingLayerDecoder(i, data, p) - case IGMPMembershipReportV1: - i := &IGMPv1or2{Version: 1} - return decodingLayerDecoder(i, data, p) - case IGMPLeaveGroup, IGMPMembershipReportV2: - // leave group and Query Report v2 used in IGMPv2 only. - i := &IGMPv1or2{Version: 2} - return decodingLayerDecoder(i, data, p) - default: - } - - return errors.New("Unable to determine IGMP type.") -} diff --git a/vendor/github.com/google/gopacket/layers/ip4.go b/vendor/github.com/google/gopacket/layers/ip4.go deleted file mode 100644 index 2b3c0c6bf..000000000 --- a/vendor/github.com/google/gopacket/layers/ip4.go +++ /dev/null @@ -1,325 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// Copyright 2009-2011 Andreas Krennmair. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - "fmt" - "net" - "strings" - - "github.com/google/gopacket" -) - -type IPv4Flag uint8 - -const ( - IPv4EvilBit IPv4Flag = 1 << 2 // http://tools.ietf.org/html/rfc3514 ;) - IPv4DontFragment IPv4Flag = 1 << 1 - IPv4MoreFragments IPv4Flag = 1 << 0 -) - -func (f IPv4Flag) String() string { - var s []string - if f&IPv4EvilBit != 0 { - s = append(s, "Evil") - } - if f&IPv4DontFragment != 0 { - s = append(s, "DF") - } - if f&IPv4MoreFragments != 0 { - s = append(s, "MF") - } - return strings.Join(s, "|") -} - -// IPv4 is the header of an IP packet. -type IPv4 struct { - BaseLayer - Version uint8 - IHL uint8 - TOS uint8 - Length uint16 - Id uint16 - Flags IPv4Flag - FragOffset uint16 - TTL uint8 - Protocol IPProtocol - Checksum uint16 - SrcIP net.IP - DstIP net.IP - Options []IPv4Option - Padding []byte -} - -// LayerType returns LayerTypeIPv4 -func (i *IPv4) LayerType() gopacket.LayerType { return LayerTypeIPv4 } -func (i *IPv4) NetworkFlow() gopacket.Flow { - return gopacket.NewFlow(EndpointIPv4, i.SrcIP, i.DstIP) -} - -type IPv4Option struct { - OptionType uint8 - OptionLength uint8 - OptionData []byte -} - -func (i IPv4Option) String() string { - return fmt.Sprintf("IPv4Option(%v:%v)", i.OptionType, i.OptionData) -} - -// for the current ipv4 options, return the number of bytes (including -// padding that the options used) -func (ip *IPv4) getIPv4OptionSize() uint8 { - optionSize := uint8(0) - for _, opt := range ip.Options { - switch opt.OptionType { - case 0: - // this is the end of option lists - optionSize++ - case 1: - // this is the padding - optionSize++ - default: - optionSize += opt.OptionLength - - } - } - // make sure the options are aligned to 32 bit boundary - if (optionSize % 4) != 0 { - optionSize += 4 - (optionSize % 4) - } - return optionSize -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -func (ip *IPv4) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - optionLength := ip.getIPv4OptionSize() - bytes, err := b.PrependBytes(20 + int(optionLength)) - if err != nil { - return err - } - if opts.FixLengths { - ip.IHL = 5 + (optionLength / 4) - ip.Length = uint16(len(b.Bytes())) - } - bytes[0] = (ip.Version << 4) | ip.IHL - bytes[1] = ip.TOS - binary.BigEndian.PutUint16(bytes[2:], ip.Length) - binary.BigEndian.PutUint16(bytes[4:], ip.Id) - binary.BigEndian.PutUint16(bytes[6:], ip.flagsfrags()) - bytes[8] = ip.TTL - bytes[9] = byte(ip.Protocol) - if err := ip.AddressTo4(); err != nil { - return err - } - copy(bytes[12:16], ip.SrcIP) - copy(bytes[16:20], ip.DstIP) - - curLocation := 20 - // Now, we will encode the options - for _, opt := range ip.Options { - switch opt.OptionType { - case 0: - // this is the end of option lists - bytes[curLocation] = 0 - curLocation++ - case 1: - // this is the padding - bytes[curLocation] = 1 - curLocation++ - default: - bytes[curLocation] = opt.OptionType - bytes[curLocation+1] = opt.OptionLength - - // sanity checking to protect us from buffer overrun - if len(opt.OptionData) > int(opt.OptionLength-2) { - return errors.New("option length is smaller than length of option data") - } - copy(bytes[curLocation+2:curLocation+int(opt.OptionLength)], opt.OptionData) - curLocation += int(opt.OptionLength) - } - } - - if opts.ComputeChecksums { - ip.Checksum = checksum(bytes) - } - binary.BigEndian.PutUint16(bytes[10:], ip.Checksum) - return nil -} - -func checksum(bytes []byte) uint16 { - // Clear checksum bytes - bytes[10] = 0 - bytes[11] = 0 - - // Compute checksum - var csum uint32 - for i := 0; i < len(bytes); i += 2 { - csum += uint32(bytes[i]) << 8 - csum += uint32(bytes[i+1]) - } - for { - // Break when sum is less or equals to 0xFFFF - if csum <= 65535 { - break - } - // Add carry to the sum - csum = (csum >> 16) + uint32(uint16(csum)) - } - // Flip all the bits - return ^uint16(csum) -} - -func (ip *IPv4) flagsfrags() (ff uint16) { - ff |= uint16(ip.Flags) << 13 - ff |= ip.FragOffset - return -} - -// DecodeFromBytes decodes the given bytes into this layer. -func (ip *IPv4) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 20 { - df.SetTruncated() - return fmt.Errorf("Invalid ip4 header. Length %d less than 20", len(data)) - } - flagsfrags := binary.BigEndian.Uint16(data[6:8]) - - ip.Version = uint8(data[0]) >> 4 - ip.IHL = uint8(data[0]) & 0x0F - ip.TOS = data[1] - ip.Length = binary.BigEndian.Uint16(data[2:4]) - ip.Id = binary.BigEndian.Uint16(data[4:6]) - ip.Flags = IPv4Flag(flagsfrags >> 13) - ip.FragOffset = flagsfrags & 0x1FFF - ip.TTL = data[8] - ip.Protocol = IPProtocol(data[9]) - ip.Checksum = binary.BigEndian.Uint16(data[10:12]) - ip.SrcIP = data[12:16] - ip.DstIP = data[16:20] - ip.Options = ip.Options[:0] - ip.Padding = nil - // Set up an initial guess for contents/payload... we'll reset these soon. - ip.BaseLayer = BaseLayer{Contents: data} - - // This code is added for the following enviroment: - // * Windows 10 with TSO option activated. ( tested on Hyper-V, RealTek ethernet driver ) - if ip.Length == 0 { - // If using TSO(TCP Segmentation Offload), length is zero. - // The actual packet length is the length of data. - ip.Length = uint16(len(data)) - } - - if ip.Length < 20 { - return fmt.Errorf("Invalid (too small) IP length (%d < 20)", ip.Length) - } else if ip.IHL < 5 { - return fmt.Errorf("Invalid (too small) IP header length (%d < 5)", ip.IHL) - } else if int(ip.IHL*4) > int(ip.Length) { - return fmt.Errorf("Invalid IP header length > IP length (%d > %d)", ip.IHL, ip.Length) - } - if cmp := len(data) - int(ip.Length); cmp > 0 { - data = data[:ip.Length] - } else if cmp < 0 { - df.SetTruncated() - if int(ip.IHL)*4 > len(data) { - return errors.New("Not all IP header bytes available") - } - } - ip.Contents = data[:ip.IHL*4] - ip.Payload = data[ip.IHL*4:] - // From here on, data contains the header options. - data = data[20 : ip.IHL*4] - // Pull out IP options - for len(data) > 0 { - if ip.Options == nil { - // Pre-allocate to avoid growing the slice too much. - ip.Options = make([]IPv4Option, 0, 4) - } - opt := IPv4Option{OptionType: data[0]} - switch opt.OptionType { - case 0: // End of options - opt.OptionLength = 1 - ip.Options = append(ip.Options, opt) - ip.Padding = data[1:] - return nil - case 1: // 1 byte padding - opt.OptionLength = 1 - data = data[1:] - ip.Options = append(ip.Options, opt) - default: - if len(data) < 2 { - df.SetTruncated() - return fmt.Errorf("Invalid ip4 option length. Length %d less than 2", len(data)) - } - opt.OptionLength = data[1] - if len(data) < int(opt.OptionLength) { - df.SetTruncated() - return fmt.Errorf("IP option length exceeds remaining IP header size, option type %v length %v", opt.OptionType, opt.OptionLength) - } - if opt.OptionLength <= 2 { - return fmt.Errorf("Invalid IP option type %v length %d. Must be greater than 2", opt.OptionType, opt.OptionLength) - } - opt.OptionData = data[2:opt.OptionLength] - data = data[opt.OptionLength:] - ip.Options = append(ip.Options, opt) - } - } - return nil -} - -func (i *IPv4) CanDecode() gopacket.LayerClass { - return LayerTypeIPv4 -} - -func (i *IPv4) NextLayerType() gopacket.LayerType { - if i.Flags&IPv4MoreFragments != 0 || i.FragOffset != 0 { - return gopacket.LayerTypeFragment - } - return i.Protocol.LayerType() -} - -func decodeIPv4(data []byte, p gopacket.PacketBuilder) error { - ip := &IPv4{} - err := ip.DecodeFromBytes(data, p) - p.AddLayer(ip) - p.SetNetworkLayer(ip) - if err != nil { - return err - } - return p.NextDecoder(ip.NextLayerType()) -} - -func checkIPv4Address(addr net.IP) (net.IP, error) { - if c := addr.To4(); c != nil { - return c, nil - } - if len(addr) == net.IPv6len { - return nil, errors.New("address is IPv6") - } - return nil, fmt.Errorf("wrong length of %d bytes instead of %d", len(addr), net.IPv4len) -} - -func (ip *IPv4) AddressTo4() error { - var src, dst net.IP - - if addr, err := checkIPv4Address(ip.SrcIP); err != nil { - return fmt.Errorf("Invalid source IPv4 address (%s)", err) - } else { - src = addr - } - if addr, err := checkIPv4Address(ip.DstIP); err != nil { - return fmt.Errorf("Invalid destination IPv4 address (%s)", err) - } else { - dst = addr - } - ip.SrcIP = src - ip.DstIP = dst - return nil -} diff --git a/vendor/github.com/google/gopacket/layers/ip6.go b/vendor/github.com/google/gopacket/layers/ip6.go deleted file mode 100644 index 87b9d33d5..000000000 --- a/vendor/github.com/google/gopacket/layers/ip6.go +++ /dev/null @@ -1,722 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// Copyright 2009-2011 Andreas Krennmair. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - "fmt" - "net" - - "github.com/google/gopacket" -) - -const ( - // IPv6HopByHopOptionJumbogram code as defined in RFC 2675 - IPv6HopByHopOptionJumbogram = 0xC2 -) - -const ( - ipv6MaxPayloadLength = 65535 -) - -// IPv6 is the layer for the IPv6 header. -type IPv6 struct { - // http://www.networksorcery.com/enp/protocol/ipv6.htm - BaseLayer - Version uint8 - TrafficClass uint8 - FlowLabel uint32 - Length uint16 - NextHeader IPProtocol - HopLimit uint8 - SrcIP net.IP - DstIP net.IP - HopByHop *IPv6HopByHop - // hbh will be pointed to by HopByHop if that layer exists. - hbh IPv6HopByHop -} - -// LayerType returns LayerTypeIPv6 -func (ipv6 *IPv6) LayerType() gopacket.LayerType { return LayerTypeIPv6 } - -// NetworkFlow returns this new Flow (EndpointIPv6, SrcIP, DstIP) -func (ipv6 *IPv6) NetworkFlow() gopacket.Flow { - return gopacket.NewFlow(EndpointIPv6, ipv6.SrcIP, ipv6.DstIP) -} - -// Search for Jumbo Payload TLV in IPv6HopByHop and return (length, true) if found -func getIPv6HopByHopJumboLength(hopopts *IPv6HopByHop) (uint32, bool, error) { - var tlv *IPv6HopByHopOption - - for _, t := range hopopts.Options { - if t.OptionType == IPv6HopByHopOptionJumbogram { - tlv = t - break - } - } - if tlv == nil { - // Not found - return 0, false, nil - } - if len(tlv.OptionData) != 4 { - return 0, false, errors.New("Jumbo length TLV data must have length 4") - } - l := binary.BigEndian.Uint32(tlv.OptionData) - if l <= ipv6MaxPayloadLength { - return 0, false, fmt.Errorf("Jumbo length cannot be less than %d", ipv6MaxPayloadLength+1) - } - // Found - return l, true, nil -} - -// Adds zero-valued Jumbo TLV to IPv6 header if it does not exist -// (if necessary add hop-by-hop header) -func addIPv6JumboOption(ip6 *IPv6) { - var tlv *IPv6HopByHopOption - - if ip6.HopByHop == nil { - // Add IPv6 HopByHop - ip6.HopByHop = &IPv6HopByHop{} - ip6.HopByHop.NextHeader = ip6.NextHeader - ip6.HopByHop.HeaderLength = 0 - ip6.NextHeader = IPProtocolIPv6HopByHop - } - for _, t := range ip6.HopByHop.Options { - if t.OptionType == IPv6HopByHopOptionJumbogram { - tlv = t - break - } - } - if tlv == nil { - // Add Jumbo TLV - tlv = &IPv6HopByHopOption{} - ip6.HopByHop.Options = append(ip6.HopByHop.Options, tlv) - } - tlv.SetJumboLength(0) -} - -// Set jumbo length in serialized IPv6 payload (starting with HopByHop header) -func setIPv6PayloadJumboLength(hbh []byte) error { - pLen := len(hbh) - if pLen < 8 { - //HopByHop is minimum 8 bytes - return fmt.Errorf("Invalid IPv6 payload (length %d)", pLen) - } - hbhLen := int((hbh[1] + 1) * 8) - if hbhLen > pLen { - return fmt.Errorf("Invalid hop-by-hop length (length: %d, payload: %d", hbhLen, pLen) - } - offset := 2 //start with options - for offset < hbhLen { - opt := hbh[offset] - if opt == 0 { - //Pad1 - offset++ - continue - } - optLen := int(hbh[offset+1]) - if opt == IPv6HopByHopOptionJumbogram { - if optLen == 4 { - binary.BigEndian.PutUint32(hbh[offset+2:], uint32(pLen)) - return nil - } - return fmt.Errorf("Jumbo TLV too short (%d bytes)", optLen) - } - offset += 2 + optLen - } - return errors.New("Jumbo TLV not found") -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (ipv6 *IPv6) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - var jumbo bool - var err error - - payload := b.Bytes() - pLen := len(payload) - if pLen > ipv6MaxPayloadLength { - jumbo = true - if opts.FixLengths { - // We need to set the length later because the hop-by-hop header may - // not exist or else need padding, so pLen may yet change - addIPv6JumboOption(ipv6) - } else if ipv6.HopByHop == nil { - return fmt.Errorf("Cannot fit payload length of %d into IPv6 packet", pLen) - } else { - _, ok, err := getIPv6HopByHopJumboLength(ipv6.HopByHop) - if err != nil { - return err - } - if !ok { - return errors.New("Missing jumbo length hop-by-hop option") - } - } - } - - hbhAlreadySerialized := false - if ipv6.HopByHop != nil { - for _, l := range b.Layers() { - if l == LayerTypeIPv6HopByHop { - hbhAlreadySerialized = true - break - } - } - } - if ipv6.HopByHop != nil && !hbhAlreadySerialized { - if ipv6.NextHeader != IPProtocolIPv6HopByHop { - // Just fix it instead of throwing an error - ipv6.NextHeader = IPProtocolIPv6HopByHop - } - err = ipv6.HopByHop.SerializeTo(b, opts) - if err != nil { - return err - } - payload = b.Bytes() - pLen = len(payload) - if opts.FixLengths && jumbo { - err := setIPv6PayloadJumboLength(payload) - if err != nil { - return err - } - } - } - - if !jumbo && pLen > ipv6MaxPayloadLength { - return errors.New("Cannot fit payload into IPv6 header") - } - bytes, err := b.PrependBytes(40) - if err != nil { - return err - } - bytes[0] = (ipv6.Version << 4) | (ipv6.TrafficClass >> 4) - bytes[1] = (ipv6.TrafficClass << 4) | uint8(ipv6.FlowLabel>>16) - binary.BigEndian.PutUint16(bytes[2:], uint16(ipv6.FlowLabel)) - if opts.FixLengths { - if jumbo { - ipv6.Length = 0 - } else { - ipv6.Length = uint16(pLen) - } - } - binary.BigEndian.PutUint16(bytes[4:], ipv6.Length) - bytes[6] = byte(ipv6.NextHeader) - bytes[7] = byte(ipv6.HopLimit) - if err := ipv6.AddressTo16(); err != nil { - return err - } - copy(bytes[8:], ipv6.SrcIP) - copy(bytes[24:], ipv6.DstIP) - return nil -} - -// DecodeFromBytes implementation according to gopacket.DecodingLayer -func (ipv6 *IPv6) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 40 { - df.SetTruncated() - return fmt.Errorf("Invalid ip6 header. Length %d less than 40", len(data)) - } - ipv6.Version = uint8(data[0]) >> 4 - ipv6.TrafficClass = uint8((binary.BigEndian.Uint16(data[0:2]) >> 4) & 0x00FF) - ipv6.FlowLabel = binary.BigEndian.Uint32(data[0:4]) & 0x000FFFFF - ipv6.Length = binary.BigEndian.Uint16(data[4:6]) - ipv6.NextHeader = IPProtocol(data[6]) - ipv6.HopLimit = data[7] - ipv6.SrcIP = data[8:24] - ipv6.DstIP = data[24:40] - ipv6.HopByHop = nil - ipv6.BaseLayer = BaseLayer{data[:40], data[40:]} - - // We treat a HopByHop IPv6 option as part of the IPv6 packet, since its - // options are crucial for understanding what's actually happening per packet. - if ipv6.NextHeader == IPProtocolIPv6HopByHop { - err := ipv6.hbh.DecodeFromBytes(ipv6.Payload, df) - if err != nil { - return err - } - ipv6.HopByHop = &ipv6.hbh - pEnd, jumbo, err := getIPv6HopByHopJumboLength(ipv6.HopByHop) - if err != nil { - return err - } - if jumbo && ipv6.Length == 0 { - pEnd := int(pEnd) - if pEnd > len(ipv6.Payload) { - df.SetTruncated() - pEnd = len(ipv6.Payload) - } - ipv6.Payload = ipv6.Payload[:pEnd] - return nil - } else if jumbo && ipv6.Length != 0 { - return errors.New("IPv6 has jumbo length and IPv6 length is not 0") - } else if !jumbo && ipv6.Length == 0 { - return errors.New("IPv6 length 0, but HopByHop header does not have jumbogram option") - } else { - ipv6.Payload = ipv6.Payload[ipv6.hbh.ActualLength:] - } - } - - if ipv6.Length == 0 { - return fmt.Errorf("IPv6 length 0, but next header is %v, not HopByHop", ipv6.NextHeader) - } - - pEnd := int(ipv6.Length) - if pEnd > len(ipv6.Payload) { - df.SetTruncated() - pEnd = len(ipv6.Payload) - } - ipv6.Payload = ipv6.Payload[:pEnd] - - return nil -} - -// CanDecode implementation according to gopacket.DecodingLayer -func (ipv6 *IPv6) CanDecode() gopacket.LayerClass { - return LayerTypeIPv6 -} - -// NextLayerType implementation according to gopacket.DecodingLayer -func (ipv6 *IPv6) NextLayerType() gopacket.LayerType { - if ipv6.HopByHop != nil { - return ipv6.HopByHop.NextHeader.LayerType() - } - return ipv6.NextHeader.LayerType() -} - -func decodeIPv6(data []byte, p gopacket.PacketBuilder) error { - ip6 := &IPv6{} - err := ip6.DecodeFromBytes(data, p) - p.AddLayer(ip6) - p.SetNetworkLayer(ip6) - if ip6.HopByHop != nil { - p.AddLayer(ip6.HopByHop) - } - if err != nil { - return err - } - return p.NextDecoder(ip6.NextLayerType()) -} - -type ipv6HeaderTLVOption struct { - OptionType, OptionLength uint8 - ActualLength int - OptionData []byte - OptionAlignment [2]uint8 // Xn+Y = [2]uint8{X, Y} -} - -func (h *ipv6HeaderTLVOption) serializeTo(data []byte, fixLengths bool, dryrun bool) int { - if fixLengths { - h.OptionLength = uint8(len(h.OptionData)) - } - length := int(h.OptionLength) + 2 - if !dryrun { - data[0] = h.OptionType - data[1] = h.OptionLength - copy(data[2:], h.OptionData) - } - return length -} - -func decodeIPv6HeaderTLVOption(data []byte, df gopacket.DecodeFeedback) (h *ipv6HeaderTLVOption, _ error) { - if len(data) < 2 { - df.SetTruncated() - return nil, errors.New("IPv6 header option too small") - } - h = &ipv6HeaderTLVOption{} - if data[0] == 0 { - h.ActualLength = 1 - return - } - h.OptionType = data[0] - h.OptionLength = data[1] - h.ActualLength = int(h.OptionLength) + 2 - if len(data) < h.ActualLength { - df.SetTruncated() - return nil, errors.New("IPv6 header TLV option too small") - } - h.OptionData = data[2:h.ActualLength] - return -} - -func serializeTLVOptionPadding(data []byte, padLength int) { - if padLength <= 0 { - return - } - if padLength == 1 { - data[0] = 0x0 - return - } - tlvLength := uint8(padLength) - 2 - data[0] = 0x1 - data[1] = tlvLength - if tlvLength != 0 { - for k := range data[2:] { - data[k+2] = 0x0 - } - } - return -} - -// If buf is 'nil' do a serialize dry run -func serializeIPv6HeaderTLVOptions(buf []byte, options []*ipv6HeaderTLVOption, fixLengths bool) int { - var l int - - dryrun := buf == nil - length := 2 - for _, opt := range options { - if fixLengths { - x := int(opt.OptionAlignment[0]) - y := int(opt.OptionAlignment[1]) - if x != 0 { - n := length / x - offset := x*n + y - if offset < length { - offset += x - } - if length != offset { - pad := offset - length - if !dryrun { - serializeTLVOptionPadding(buf[length-2:], pad) - } - length += pad - } - } - } - if dryrun { - l = opt.serializeTo(nil, fixLengths, true) - } else { - l = opt.serializeTo(buf[length-2:], fixLengths, false) - } - length += l - } - if fixLengths { - pad := length % 8 - if pad != 0 { - if !dryrun { - serializeTLVOptionPadding(buf[length-2:], pad) - } - length += pad - } - } - return length - 2 -} - -type ipv6ExtensionBase struct { - BaseLayer - NextHeader IPProtocol - HeaderLength uint8 - ActualLength int -} - -func decodeIPv6ExtensionBase(data []byte, df gopacket.DecodeFeedback) (i ipv6ExtensionBase, returnedErr error) { - if len(data) < 2 { - df.SetTruncated() - return ipv6ExtensionBase{}, fmt.Errorf("Invalid ip6-extension header. Length %d less than 2", len(data)) - } - i.NextHeader = IPProtocol(data[0]) - i.HeaderLength = data[1] - i.ActualLength = int(i.HeaderLength)*8 + 8 - if len(data) < i.ActualLength { - return ipv6ExtensionBase{}, fmt.Errorf("Invalid ip6-extension header. Length %d less than specified length %d", len(data), i.ActualLength) - } - i.Contents = data[:i.ActualLength] - i.Payload = data[i.ActualLength:] - return -} - -// IPv6ExtensionSkipper is a DecodingLayer which decodes and ignores v6 -// extensions. You can use it with a DecodingLayerParser to handle IPv6 stacks -// which may or may not have extensions. -type IPv6ExtensionSkipper struct { - NextHeader IPProtocol - BaseLayer -} - -// DecodeFromBytes implementation according to gopacket.DecodingLayer -func (i *IPv6ExtensionSkipper) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - extension, err := decodeIPv6ExtensionBase(data, df) - if err != nil { - return err - } - i.BaseLayer = BaseLayer{data[:extension.ActualLength], data[extension.ActualLength:]} - i.NextHeader = extension.NextHeader - return nil -} - -// CanDecode implementation according to gopacket.DecodingLayer -func (i *IPv6ExtensionSkipper) CanDecode() gopacket.LayerClass { - return LayerClassIPv6Extension -} - -// NextLayerType implementation according to gopacket.DecodingLayer -func (i *IPv6ExtensionSkipper) NextLayerType() gopacket.LayerType { - return i.NextHeader.LayerType() -} - -// IPv6HopByHopOption is a TLV option present in an IPv6 hop-by-hop extension. -type IPv6HopByHopOption ipv6HeaderTLVOption - -// IPv6HopByHop is the IPv6 hop-by-hop extension. -type IPv6HopByHop struct { - ipv6ExtensionBase - Options []*IPv6HopByHopOption -} - -// LayerType returns LayerTypeIPv6HopByHop. -func (i *IPv6HopByHop) LayerType() gopacket.LayerType { return LayerTypeIPv6HopByHop } - -// SerializeTo implementation according to gopacket.SerializableLayer -func (i *IPv6HopByHop) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - var bytes []byte - var err error - - o := make([]*ipv6HeaderTLVOption, 0, len(i.Options)) - for _, v := range i.Options { - o = append(o, (*ipv6HeaderTLVOption)(v)) - } - - l := serializeIPv6HeaderTLVOptions(nil, o, opts.FixLengths) - bytes, err = b.PrependBytes(l) - if err != nil { - return err - } - serializeIPv6HeaderTLVOptions(bytes, o, opts.FixLengths) - - length := len(bytes) + 2 - if length%8 != 0 { - return errors.New("IPv6HopByHop actual length must be multiple of 8") - } - bytes, err = b.PrependBytes(2) - if err != nil { - return err - } - bytes[0] = uint8(i.NextHeader) - if opts.FixLengths { - i.HeaderLength = uint8((length / 8) - 1) - } - bytes[1] = uint8(i.HeaderLength) - return nil -} - -// DecodeFromBytes implementation according to gopacket.DecodingLayer -func (i *IPv6HopByHop) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - var err error - i.ipv6ExtensionBase, err = decodeIPv6ExtensionBase(data, df) - if err != nil { - return err - } - i.Options = i.Options[:0] - offset := 2 - for offset < i.ActualLength { - opt, err := decodeIPv6HeaderTLVOption(data[offset:], df) - if err != nil { - return err - } - i.Options = append(i.Options, (*IPv6HopByHopOption)(opt)) - offset += opt.ActualLength - } - return nil -} - -func decodeIPv6HopByHop(data []byte, p gopacket.PacketBuilder) error { - i := &IPv6HopByHop{} - err := i.DecodeFromBytes(data, p) - p.AddLayer(i) - if err != nil { - return err - } - return p.NextDecoder(i.NextHeader) -} - -// SetJumboLength adds the IPv6HopByHopOptionJumbogram with the given length -func (o *IPv6HopByHopOption) SetJumboLength(len uint32) { - o.OptionType = IPv6HopByHopOptionJumbogram - o.OptionLength = 4 - o.ActualLength = 6 - if o.OptionData == nil { - o.OptionData = make([]byte, 4) - } - binary.BigEndian.PutUint32(o.OptionData, len) - o.OptionAlignment = [2]uint8{4, 2} -} - -// IPv6Routing is the IPv6 routing extension. -type IPv6Routing struct { - ipv6ExtensionBase - RoutingType uint8 - SegmentsLeft uint8 - // This segment is supposed to be zero according to RFC2460, the second set of - // 4 bytes in the extension. - Reserved []byte - // SourceRoutingIPs is the set of IPv6 addresses requested for source routing, - // set only if RoutingType == 0. - SourceRoutingIPs []net.IP -} - -// LayerType returns LayerTypeIPv6Routing. -func (i *IPv6Routing) LayerType() gopacket.LayerType { return LayerTypeIPv6Routing } - -func decodeIPv6Routing(data []byte, p gopacket.PacketBuilder) error { - base, err := decodeIPv6ExtensionBase(data, p) - if err != nil { - return err - } - i := &IPv6Routing{ - ipv6ExtensionBase: base, - RoutingType: data[2], - SegmentsLeft: data[3], - Reserved: data[4:8], - } - switch i.RoutingType { - case 0: // Source routing - if (i.ActualLength-8)%16 != 0 { - return fmt.Errorf("Invalid IPv6 source routing, length of type 0 packet %d", i.ActualLength) - } - for d := i.Contents[8:]; len(d) >= 16; d = d[16:] { - i.SourceRoutingIPs = append(i.SourceRoutingIPs, net.IP(d[:16])) - } - default: - return fmt.Errorf("Unknown IPv6 routing header type %d", i.RoutingType) - } - p.AddLayer(i) - return p.NextDecoder(i.NextHeader) -} - -// IPv6Fragment is the IPv6 fragment header, used for packet -// fragmentation/defragmentation. -type IPv6Fragment struct { - BaseLayer - NextHeader IPProtocol - // Reserved1 is bits [8-16), from least to most significant, 0-indexed - Reserved1 uint8 - FragmentOffset uint16 - // Reserved2 is bits [29-31), from least to most significant, 0-indexed - Reserved2 uint8 - MoreFragments bool - Identification uint32 -} - -// LayerType returns LayerTypeIPv6Fragment. -func (i *IPv6Fragment) LayerType() gopacket.LayerType { return LayerTypeIPv6Fragment } - -func decodeIPv6Fragment(data []byte, p gopacket.PacketBuilder) error { - if len(data) < 8 { - p.SetTruncated() - return fmt.Errorf("Invalid ip6-fragment header. Length %d less than 8", len(data)) - } - i := &IPv6Fragment{ - BaseLayer: BaseLayer{data[:8], data[8:]}, - NextHeader: IPProtocol(data[0]), - Reserved1: data[1], - FragmentOffset: binary.BigEndian.Uint16(data[2:4]) >> 3, - Reserved2: data[3] & 0x6 >> 1, - MoreFragments: data[3]&0x1 != 0, - Identification: binary.BigEndian.Uint32(data[4:8]), - } - p.AddLayer(i) - return p.NextDecoder(gopacket.DecodeFragment) -} - -// IPv6DestinationOption is a TLV option present in an IPv6 destination options extension. -type IPv6DestinationOption ipv6HeaderTLVOption - -// IPv6Destination is the IPv6 destination options header. -type IPv6Destination struct { - ipv6ExtensionBase - Options []*IPv6DestinationOption -} - -// LayerType returns LayerTypeIPv6Destination. -func (i *IPv6Destination) LayerType() gopacket.LayerType { return LayerTypeIPv6Destination } - -// DecodeFromBytes implementation according to gopacket.DecodingLayer -func (i *IPv6Destination) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - var err error - i.ipv6ExtensionBase, err = decodeIPv6ExtensionBase(data, df) - if err != nil { - return err - } - offset := 2 - for offset < i.ActualLength { - opt, err := decodeIPv6HeaderTLVOption(data[offset:], df) - if err != nil { - return err - } - i.Options = append(i.Options, (*IPv6DestinationOption)(opt)) - offset += opt.ActualLength - } - return nil -} - -func decodeIPv6Destination(data []byte, p gopacket.PacketBuilder) error { - i := &IPv6Destination{} - err := i.DecodeFromBytes(data, p) - p.AddLayer(i) - if err != nil { - return err - } - return p.NextDecoder(i.NextHeader) -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (i *IPv6Destination) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - var bytes []byte - var err error - - o := make([]*ipv6HeaderTLVOption, 0, len(i.Options)) - for _, v := range i.Options { - o = append(o, (*ipv6HeaderTLVOption)(v)) - } - - l := serializeIPv6HeaderTLVOptions(nil, o, opts.FixLengths) - bytes, err = b.PrependBytes(l) - if err != nil { - return err - } - serializeIPv6HeaderTLVOptions(bytes, o, opts.FixLengths) - - length := len(bytes) + 2 - if length%8 != 0 { - return errors.New("IPv6Destination actual length must be multiple of 8") - } - bytes, err = b.PrependBytes(2) - if err != nil { - return err - } - bytes[0] = uint8(i.NextHeader) - if opts.FixLengths { - i.HeaderLength = uint8((length / 8) - 1) - } - bytes[1] = uint8(i.HeaderLength) - return nil -} - -func checkIPv6Address(addr net.IP) error { - if len(addr) == net.IPv6len { - return nil - } - if len(addr) == net.IPv4len { - return errors.New("address is IPv4") - } - return fmt.Errorf("wrong length of %d bytes instead of %d", len(addr), net.IPv6len) -} - -// AddressTo16 ensures IPv6.SrcIP and IPv6.DstIP are actually IPv6 addresses (i.e. 16 byte addresses) -func (ipv6 *IPv6) AddressTo16() error { - if err := checkIPv6Address(ipv6.SrcIP); err != nil { - return fmt.Errorf("Invalid source IPv6 address (%s)", err) - } - if err := checkIPv6Address(ipv6.DstIP); err != nil { - return fmt.Errorf("Invalid destination IPv6 address (%s)", err) - } - return nil -} diff --git a/vendor/github.com/google/gopacket/layers/ipsec.go b/vendor/github.com/google/gopacket/layers/ipsec.go deleted file mode 100644 index 12f31caf6..000000000 --- a/vendor/github.com/google/gopacket/layers/ipsec.go +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - "github.com/google/gopacket" -) - -// IPSecAH is the authentication header for IPv4/6 defined in -// http://tools.ietf.org/html/rfc2402 -type IPSecAH struct { - // While the auth header can be used for both IPv4 and v6, its format is that of - // an IPv6 extension (NextHeader, PayloadLength, etc...), so we use ipv6ExtensionBase - // to build it. - ipv6ExtensionBase - Reserved uint16 - SPI, Seq uint32 - AuthenticationData []byte -} - -// LayerType returns LayerTypeIPSecAH. -func (i *IPSecAH) LayerType() gopacket.LayerType { return LayerTypeIPSecAH } - -func decodeIPSecAH(data []byte, p gopacket.PacketBuilder) error { - if len(data) < 12 { - p.SetTruncated() - return errors.New("IPSec AH packet less than 12 bytes") - } - i := &IPSecAH{ - ipv6ExtensionBase: ipv6ExtensionBase{ - NextHeader: IPProtocol(data[0]), - HeaderLength: data[1], - }, - Reserved: binary.BigEndian.Uint16(data[2:4]), - SPI: binary.BigEndian.Uint32(data[4:8]), - Seq: binary.BigEndian.Uint32(data[8:12]), - } - i.ActualLength = (int(i.HeaderLength) + 2) * 4 - if len(data) < i.ActualLength { - p.SetTruncated() - return errors.New("Truncated AH packet < ActualLength") - } - i.AuthenticationData = data[12:i.ActualLength] - i.Contents = data[:i.ActualLength] - i.Payload = data[i.ActualLength:] - p.AddLayer(i) - return p.NextDecoder(i.NextHeader) -} - -// IPSecESP is the encapsulating security payload defined in -// http://tools.ietf.org/html/rfc2406 -type IPSecESP struct { - BaseLayer - SPI, Seq uint32 - // Encrypted contains the encrypted set of bytes sent in an ESP - Encrypted []byte -} - -// LayerType returns LayerTypeIPSecESP. -func (i *IPSecESP) LayerType() gopacket.LayerType { return LayerTypeIPSecESP } - -func decodeIPSecESP(data []byte, p gopacket.PacketBuilder) error { - i := &IPSecESP{ - BaseLayer: BaseLayer{data, nil}, - SPI: binary.BigEndian.Uint32(data[:4]), - Seq: binary.BigEndian.Uint32(data[4:8]), - Encrypted: data[8:], - } - p.AddLayer(i) - return nil -} diff --git a/vendor/github.com/google/gopacket/layers/layertypes.go b/vendor/github.com/google/gopacket/layers/layertypes.go deleted file mode 100644 index 69d25ae80..000000000 --- a/vendor/github.com/google/gopacket/layers/layertypes.go +++ /dev/null @@ -1,223 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "github.com/google/gopacket" -) - -var ( - LayerTypeARP = gopacket.RegisterLayerType(10, gopacket.LayerTypeMetadata{Name: "ARP", Decoder: gopacket.DecodeFunc(decodeARP)}) - LayerTypeCiscoDiscovery = gopacket.RegisterLayerType(11, gopacket.LayerTypeMetadata{Name: "CiscoDiscovery", Decoder: gopacket.DecodeFunc(decodeCiscoDiscovery)}) - LayerTypeEthernetCTP = gopacket.RegisterLayerType(12, gopacket.LayerTypeMetadata{Name: "EthernetCTP", Decoder: gopacket.DecodeFunc(decodeEthernetCTP)}) - LayerTypeEthernetCTPForwardData = gopacket.RegisterLayerType(13, gopacket.LayerTypeMetadata{Name: "EthernetCTPForwardData", Decoder: nil}) - LayerTypeEthernetCTPReply = gopacket.RegisterLayerType(14, gopacket.LayerTypeMetadata{Name: "EthernetCTPReply", Decoder: nil}) - LayerTypeDot1Q = gopacket.RegisterLayerType(15, gopacket.LayerTypeMetadata{Name: "Dot1Q", Decoder: gopacket.DecodeFunc(decodeDot1Q)}) - LayerTypeEtherIP = gopacket.RegisterLayerType(16, gopacket.LayerTypeMetadata{Name: "EtherIP", Decoder: gopacket.DecodeFunc(decodeEtherIP)}) - LayerTypeEthernet = gopacket.RegisterLayerType(17, gopacket.LayerTypeMetadata{Name: "Ethernet", Decoder: gopacket.DecodeFunc(decodeEthernet)}) - LayerTypeGRE = gopacket.RegisterLayerType(18, gopacket.LayerTypeMetadata{Name: "GRE", Decoder: gopacket.DecodeFunc(decodeGRE)}) - LayerTypeICMPv4 = gopacket.RegisterLayerType(19, gopacket.LayerTypeMetadata{Name: "ICMPv4", Decoder: gopacket.DecodeFunc(decodeICMPv4)}) - LayerTypeIPv4 = gopacket.RegisterLayerType(20, gopacket.LayerTypeMetadata{Name: "IPv4", Decoder: gopacket.DecodeFunc(decodeIPv4)}) - LayerTypeIPv6 = gopacket.RegisterLayerType(21, gopacket.LayerTypeMetadata{Name: "IPv6", Decoder: gopacket.DecodeFunc(decodeIPv6)}) - LayerTypeLLC = gopacket.RegisterLayerType(22, gopacket.LayerTypeMetadata{Name: "LLC", Decoder: gopacket.DecodeFunc(decodeLLC)}) - LayerTypeSNAP = gopacket.RegisterLayerType(23, gopacket.LayerTypeMetadata{Name: "SNAP", Decoder: gopacket.DecodeFunc(decodeSNAP)}) - LayerTypeMPLS = gopacket.RegisterLayerType(24, gopacket.LayerTypeMetadata{Name: "MPLS", Decoder: gopacket.DecodeFunc(decodeMPLS)}) - LayerTypePPP = gopacket.RegisterLayerType(25, gopacket.LayerTypeMetadata{Name: "PPP", Decoder: gopacket.DecodeFunc(decodePPP)}) - LayerTypePPPoE = gopacket.RegisterLayerType(26, gopacket.LayerTypeMetadata{Name: "PPPoE", Decoder: gopacket.DecodeFunc(decodePPPoE)}) - LayerTypeRUDP = gopacket.RegisterLayerType(27, gopacket.LayerTypeMetadata{Name: "RUDP", Decoder: gopacket.DecodeFunc(decodeRUDP)}) - LayerTypeSCTP = gopacket.RegisterLayerType(28, gopacket.LayerTypeMetadata{Name: "SCTP", Decoder: gopacket.DecodeFunc(decodeSCTP)}) - LayerTypeSCTPUnknownChunkType = gopacket.RegisterLayerType(29, gopacket.LayerTypeMetadata{Name: "SCTPUnknownChunkType", Decoder: nil}) - LayerTypeSCTPData = gopacket.RegisterLayerType(30, gopacket.LayerTypeMetadata{Name: "SCTPData", Decoder: nil}) - LayerTypeSCTPInit = gopacket.RegisterLayerType(31, gopacket.LayerTypeMetadata{Name: "SCTPInit", Decoder: nil}) - LayerTypeSCTPSack = gopacket.RegisterLayerType(32, gopacket.LayerTypeMetadata{Name: "SCTPSack", Decoder: nil}) - LayerTypeSCTPHeartbeat = gopacket.RegisterLayerType(33, gopacket.LayerTypeMetadata{Name: "SCTPHeartbeat", Decoder: nil}) - LayerTypeSCTPError = gopacket.RegisterLayerType(34, gopacket.LayerTypeMetadata{Name: "SCTPError", Decoder: nil}) - LayerTypeSCTPShutdown = gopacket.RegisterLayerType(35, gopacket.LayerTypeMetadata{Name: "SCTPShutdown", Decoder: nil}) - LayerTypeSCTPShutdownAck = gopacket.RegisterLayerType(36, gopacket.LayerTypeMetadata{Name: "SCTPShutdownAck", Decoder: nil}) - LayerTypeSCTPCookieEcho = gopacket.RegisterLayerType(37, gopacket.LayerTypeMetadata{Name: "SCTPCookieEcho", Decoder: nil}) - LayerTypeSCTPEmptyLayer = gopacket.RegisterLayerType(38, gopacket.LayerTypeMetadata{Name: "SCTPEmptyLayer", Decoder: nil}) - LayerTypeSCTPInitAck = gopacket.RegisterLayerType(39, gopacket.LayerTypeMetadata{Name: "SCTPInitAck", Decoder: nil}) - LayerTypeSCTPHeartbeatAck = gopacket.RegisterLayerType(40, gopacket.LayerTypeMetadata{Name: "SCTPHeartbeatAck", Decoder: nil}) - LayerTypeSCTPAbort = gopacket.RegisterLayerType(41, gopacket.LayerTypeMetadata{Name: "SCTPAbort", Decoder: nil}) - LayerTypeSCTPShutdownComplete = gopacket.RegisterLayerType(42, gopacket.LayerTypeMetadata{Name: "SCTPShutdownComplete", Decoder: nil}) - LayerTypeSCTPCookieAck = gopacket.RegisterLayerType(43, gopacket.LayerTypeMetadata{Name: "SCTPCookieAck", Decoder: nil}) - LayerTypeTCP = gopacket.RegisterLayerType(44, gopacket.LayerTypeMetadata{Name: "TCP", Decoder: gopacket.DecodeFunc(decodeTCP)}) - LayerTypeUDP = gopacket.RegisterLayerType(45, gopacket.LayerTypeMetadata{Name: "UDP", Decoder: gopacket.DecodeFunc(decodeUDP)}) - LayerTypeIPv6HopByHop = gopacket.RegisterLayerType(46, gopacket.LayerTypeMetadata{Name: "IPv6HopByHop", Decoder: gopacket.DecodeFunc(decodeIPv6HopByHop)}) - LayerTypeIPv6Routing = gopacket.RegisterLayerType(47, gopacket.LayerTypeMetadata{Name: "IPv6Routing", Decoder: gopacket.DecodeFunc(decodeIPv6Routing)}) - LayerTypeIPv6Fragment = gopacket.RegisterLayerType(48, gopacket.LayerTypeMetadata{Name: "IPv6Fragment", Decoder: gopacket.DecodeFunc(decodeIPv6Fragment)}) - LayerTypeIPv6Destination = gopacket.RegisterLayerType(49, gopacket.LayerTypeMetadata{Name: "IPv6Destination", Decoder: gopacket.DecodeFunc(decodeIPv6Destination)}) - LayerTypeIPSecAH = gopacket.RegisterLayerType(50, gopacket.LayerTypeMetadata{Name: "IPSecAH", Decoder: gopacket.DecodeFunc(decodeIPSecAH)}) - LayerTypeIPSecESP = gopacket.RegisterLayerType(51, gopacket.LayerTypeMetadata{Name: "IPSecESP", Decoder: gopacket.DecodeFunc(decodeIPSecESP)}) - LayerTypeUDPLite = gopacket.RegisterLayerType(52, gopacket.LayerTypeMetadata{Name: "UDPLite", Decoder: gopacket.DecodeFunc(decodeUDPLite)}) - LayerTypeFDDI = gopacket.RegisterLayerType(53, gopacket.LayerTypeMetadata{Name: "FDDI", Decoder: gopacket.DecodeFunc(decodeFDDI)}) - LayerTypeLoopback = gopacket.RegisterLayerType(54, gopacket.LayerTypeMetadata{Name: "Loopback", Decoder: gopacket.DecodeFunc(decodeLoopback)}) - LayerTypeEAP = gopacket.RegisterLayerType(55, gopacket.LayerTypeMetadata{Name: "EAP", Decoder: gopacket.DecodeFunc(decodeEAP)}) - LayerTypeEAPOL = gopacket.RegisterLayerType(56, gopacket.LayerTypeMetadata{Name: "EAPOL", Decoder: gopacket.DecodeFunc(decodeEAPOL)}) - LayerTypeICMPv6 = gopacket.RegisterLayerType(57, gopacket.LayerTypeMetadata{Name: "ICMPv6", Decoder: gopacket.DecodeFunc(decodeICMPv6)}) - LayerTypeLinkLayerDiscovery = gopacket.RegisterLayerType(58, gopacket.LayerTypeMetadata{Name: "LinkLayerDiscovery", Decoder: gopacket.DecodeFunc(decodeLinkLayerDiscovery)}) - LayerTypeCiscoDiscoveryInfo = gopacket.RegisterLayerType(59, gopacket.LayerTypeMetadata{Name: "CiscoDiscoveryInfo", Decoder: gopacket.DecodeFunc(decodeCiscoDiscoveryInfo)}) - LayerTypeLinkLayerDiscoveryInfo = gopacket.RegisterLayerType(60, gopacket.LayerTypeMetadata{Name: "LinkLayerDiscoveryInfo", Decoder: nil}) - LayerTypeNortelDiscovery = gopacket.RegisterLayerType(61, gopacket.LayerTypeMetadata{Name: "NortelDiscovery", Decoder: gopacket.DecodeFunc(decodeNortelDiscovery)}) - LayerTypeIGMP = gopacket.RegisterLayerType(62, gopacket.LayerTypeMetadata{Name: "IGMP", Decoder: gopacket.DecodeFunc(decodeIGMP)}) - LayerTypePFLog = gopacket.RegisterLayerType(63, gopacket.LayerTypeMetadata{Name: "PFLog", Decoder: gopacket.DecodeFunc(decodePFLog)}) - LayerTypeRadioTap = gopacket.RegisterLayerType(64, gopacket.LayerTypeMetadata{Name: "RadioTap", Decoder: gopacket.DecodeFunc(decodeRadioTap)}) - LayerTypeDot11 = gopacket.RegisterLayerType(65, gopacket.LayerTypeMetadata{Name: "Dot11", Decoder: gopacket.DecodeFunc(decodeDot11)}) - LayerTypeDot11Ctrl = gopacket.RegisterLayerType(66, gopacket.LayerTypeMetadata{Name: "Dot11Ctrl", Decoder: gopacket.DecodeFunc(decodeDot11Ctrl)}) - LayerTypeDot11Data = gopacket.RegisterLayerType(67, gopacket.LayerTypeMetadata{Name: "Dot11Data", Decoder: gopacket.DecodeFunc(decodeDot11Data)}) - LayerTypeDot11DataCFAck = gopacket.RegisterLayerType(68, gopacket.LayerTypeMetadata{Name: "Dot11DataCFAck", Decoder: gopacket.DecodeFunc(decodeDot11DataCFAck)}) - LayerTypeDot11DataCFPoll = gopacket.RegisterLayerType(69, gopacket.LayerTypeMetadata{Name: "Dot11DataCFPoll", Decoder: gopacket.DecodeFunc(decodeDot11DataCFPoll)}) - LayerTypeDot11DataCFAckPoll = gopacket.RegisterLayerType(70, gopacket.LayerTypeMetadata{Name: "Dot11DataCFAckPoll", Decoder: gopacket.DecodeFunc(decodeDot11DataCFAckPoll)}) - LayerTypeDot11DataNull = gopacket.RegisterLayerType(71, gopacket.LayerTypeMetadata{Name: "Dot11DataNull", Decoder: gopacket.DecodeFunc(decodeDot11DataNull)}) - LayerTypeDot11DataCFAckNoData = gopacket.RegisterLayerType(72, gopacket.LayerTypeMetadata{Name: "Dot11DataCFAck", Decoder: gopacket.DecodeFunc(decodeDot11DataCFAck)}) - LayerTypeDot11DataCFPollNoData = gopacket.RegisterLayerType(73, gopacket.LayerTypeMetadata{Name: "Dot11DataCFPoll", Decoder: gopacket.DecodeFunc(decodeDot11DataCFPoll)}) - LayerTypeDot11DataCFAckPollNoData = gopacket.RegisterLayerType(74, gopacket.LayerTypeMetadata{Name: "Dot11DataCFAckPoll", Decoder: gopacket.DecodeFunc(decodeDot11DataCFAckPoll)}) - LayerTypeDot11DataQOSData = gopacket.RegisterLayerType(75, gopacket.LayerTypeMetadata{Name: "Dot11DataQOSData", Decoder: gopacket.DecodeFunc(decodeDot11DataQOSData)}) - LayerTypeDot11DataQOSDataCFAck = gopacket.RegisterLayerType(76, gopacket.LayerTypeMetadata{Name: "Dot11DataQOSDataCFAck", Decoder: gopacket.DecodeFunc(decodeDot11DataQOSDataCFAck)}) - LayerTypeDot11DataQOSDataCFPoll = gopacket.RegisterLayerType(77, gopacket.LayerTypeMetadata{Name: "Dot11DataQOSDataCFPoll", Decoder: gopacket.DecodeFunc(decodeDot11DataQOSDataCFPoll)}) - LayerTypeDot11DataQOSDataCFAckPoll = gopacket.RegisterLayerType(78, gopacket.LayerTypeMetadata{Name: "Dot11DataQOSDataCFAckPoll", Decoder: gopacket.DecodeFunc(decodeDot11DataQOSDataCFAckPoll)}) - LayerTypeDot11DataQOSNull = gopacket.RegisterLayerType(79, gopacket.LayerTypeMetadata{Name: "Dot11DataQOSNull", Decoder: gopacket.DecodeFunc(decodeDot11DataQOSNull)}) - LayerTypeDot11DataQOSCFPollNoData = gopacket.RegisterLayerType(80, gopacket.LayerTypeMetadata{Name: "Dot11DataQOSCFPoll", Decoder: gopacket.DecodeFunc(decodeDot11DataQOSCFPollNoData)}) - LayerTypeDot11DataQOSCFAckPollNoData = gopacket.RegisterLayerType(81, gopacket.LayerTypeMetadata{Name: "Dot11DataQOSCFAckPoll", Decoder: gopacket.DecodeFunc(decodeDot11DataQOSCFAckPollNoData)}) - LayerTypeDot11InformationElement = gopacket.RegisterLayerType(82, gopacket.LayerTypeMetadata{Name: "Dot11InformationElement", Decoder: gopacket.DecodeFunc(decodeDot11InformationElement)}) - LayerTypeDot11CtrlCTS = gopacket.RegisterLayerType(83, gopacket.LayerTypeMetadata{Name: "Dot11CtrlCTS", Decoder: gopacket.DecodeFunc(decodeDot11CtrlCTS)}) - LayerTypeDot11CtrlRTS = gopacket.RegisterLayerType(84, gopacket.LayerTypeMetadata{Name: "Dot11CtrlRTS", Decoder: gopacket.DecodeFunc(decodeDot11CtrlRTS)}) - LayerTypeDot11CtrlBlockAckReq = gopacket.RegisterLayerType(85, gopacket.LayerTypeMetadata{Name: "Dot11CtrlBlockAckReq", Decoder: gopacket.DecodeFunc(decodeDot11CtrlBlockAckReq)}) - LayerTypeDot11CtrlBlockAck = gopacket.RegisterLayerType(86, gopacket.LayerTypeMetadata{Name: "Dot11CtrlBlockAck", Decoder: gopacket.DecodeFunc(decodeDot11CtrlBlockAck)}) - LayerTypeDot11CtrlPowersavePoll = gopacket.RegisterLayerType(87, gopacket.LayerTypeMetadata{Name: "Dot11CtrlPowersavePoll", Decoder: gopacket.DecodeFunc(decodeDot11CtrlPowersavePoll)}) - LayerTypeDot11CtrlAck = gopacket.RegisterLayerType(88, gopacket.LayerTypeMetadata{Name: "Dot11CtrlAck", Decoder: gopacket.DecodeFunc(decodeDot11CtrlAck)}) - LayerTypeDot11CtrlCFEnd = gopacket.RegisterLayerType(89, gopacket.LayerTypeMetadata{Name: "Dot11CtrlCFEnd", Decoder: gopacket.DecodeFunc(decodeDot11CtrlCFEnd)}) - LayerTypeDot11CtrlCFEndAck = gopacket.RegisterLayerType(90, gopacket.LayerTypeMetadata{Name: "Dot11CtrlCFEndAck", Decoder: gopacket.DecodeFunc(decodeDot11CtrlCFEndAck)}) - LayerTypeDot11MgmtAssociationReq = gopacket.RegisterLayerType(91, gopacket.LayerTypeMetadata{Name: "Dot11MgmtAssociationReq", Decoder: gopacket.DecodeFunc(decodeDot11MgmtAssociationReq)}) - LayerTypeDot11MgmtAssociationResp = gopacket.RegisterLayerType(92, gopacket.LayerTypeMetadata{Name: "Dot11MgmtAssociationResp", Decoder: gopacket.DecodeFunc(decodeDot11MgmtAssociationResp)}) - LayerTypeDot11MgmtReassociationReq = gopacket.RegisterLayerType(93, gopacket.LayerTypeMetadata{Name: "Dot11MgmtReassociationReq", Decoder: gopacket.DecodeFunc(decodeDot11MgmtReassociationReq)}) - LayerTypeDot11MgmtReassociationResp = gopacket.RegisterLayerType(94, gopacket.LayerTypeMetadata{Name: "Dot11MgmtReassociationResp", Decoder: gopacket.DecodeFunc(decodeDot11MgmtReassociationResp)}) - LayerTypeDot11MgmtProbeReq = gopacket.RegisterLayerType(95, gopacket.LayerTypeMetadata{Name: "Dot11MgmtProbeReq", Decoder: gopacket.DecodeFunc(decodeDot11MgmtProbeReq)}) - LayerTypeDot11MgmtProbeResp = gopacket.RegisterLayerType(96, gopacket.LayerTypeMetadata{Name: "Dot11MgmtProbeResp", Decoder: gopacket.DecodeFunc(decodeDot11MgmtProbeResp)}) - LayerTypeDot11MgmtMeasurementPilot = gopacket.RegisterLayerType(97, gopacket.LayerTypeMetadata{Name: "Dot11MgmtMeasurementPilot", Decoder: gopacket.DecodeFunc(decodeDot11MgmtMeasurementPilot)}) - LayerTypeDot11MgmtBeacon = gopacket.RegisterLayerType(98, gopacket.LayerTypeMetadata{Name: "Dot11MgmtBeacon", Decoder: gopacket.DecodeFunc(decodeDot11MgmtBeacon)}) - LayerTypeDot11MgmtATIM = gopacket.RegisterLayerType(99, gopacket.LayerTypeMetadata{Name: "Dot11MgmtATIM", Decoder: gopacket.DecodeFunc(decodeDot11MgmtATIM)}) - LayerTypeDot11MgmtDisassociation = gopacket.RegisterLayerType(100, gopacket.LayerTypeMetadata{Name: "Dot11MgmtDisassociation", Decoder: gopacket.DecodeFunc(decodeDot11MgmtDisassociation)}) - LayerTypeDot11MgmtAuthentication = gopacket.RegisterLayerType(101, gopacket.LayerTypeMetadata{Name: "Dot11MgmtAuthentication", Decoder: gopacket.DecodeFunc(decodeDot11MgmtAuthentication)}) - LayerTypeDot11MgmtDeauthentication = gopacket.RegisterLayerType(102, gopacket.LayerTypeMetadata{Name: "Dot11MgmtDeauthentication", Decoder: gopacket.DecodeFunc(decodeDot11MgmtDeauthentication)}) - LayerTypeDot11MgmtAction = gopacket.RegisterLayerType(103, gopacket.LayerTypeMetadata{Name: "Dot11MgmtAction", Decoder: gopacket.DecodeFunc(decodeDot11MgmtAction)}) - LayerTypeDot11MgmtActionNoAck = gopacket.RegisterLayerType(104, gopacket.LayerTypeMetadata{Name: "Dot11MgmtActionNoAck", Decoder: gopacket.DecodeFunc(decodeDot11MgmtActionNoAck)}) - LayerTypeDot11MgmtArubaWLAN = gopacket.RegisterLayerType(105, gopacket.LayerTypeMetadata{Name: "Dot11MgmtArubaWLAN", Decoder: gopacket.DecodeFunc(decodeDot11MgmtArubaWLAN)}) - LayerTypeDot11WEP = gopacket.RegisterLayerType(106, gopacket.LayerTypeMetadata{Name: "Dot11WEP", Decoder: gopacket.DecodeFunc(decodeDot11WEP)}) - LayerTypeDNS = gopacket.RegisterLayerType(107, gopacket.LayerTypeMetadata{Name: "DNS", Decoder: gopacket.DecodeFunc(decodeDNS)}) - LayerTypeUSB = gopacket.RegisterLayerType(108, gopacket.LayerTypeMetadata{Name: "USB", Decoder: gopacket.DecodeFunc(decodeUSB)}) - LayerTypeUSBRequestBlockSetup = gopacket.RegisterLayerType(109, gopacket.LayerTypeMetadata{Name: "USBRequestBlockSetup", Decoder: gopacket.DecodeFunc(decodeUSBRequestBlockSetup)}) - LayerTypeUSBControl = gopacket.RegisterLayerType(110, gopacket.LayerTypeMetadata{Name: "USBControl", Decoder: gopacket.DecodeFunc(decodeUSBControl)}) - LayerTypeUSBInterrupt = gopacket.RegisterLayerType(111, gopacket.LayerTypeMetadata{Name: "USBInterrupt", Decoder: gopacket.DecodeFunc(decodeUSBInterrupt)}) - LayerTypeUSBBulk = gopacket.RegisterLayerType(112, gopacket.LayerTypeMetadata{Name: "USBBulk", Decoder: gopacket.DecodeFunc(decodeUSBBulk)}) - LayerTypeLinuxSLL = gopacket.RegisterLayerType(113, gopacket.LayerTypeMetadata{Name: "Linux SLL", Decoder: gopacket.DecodeFunc(decodeLinuxSLL)}) - LayerTypeSFlow = gopacket.RegisterLayerType(114, gopacket.LayerTypeMetadata{Name: "SFlow", Decoder: gopacket.DecodeFunc(decodeSFlow)}) - LayerTypePrismHeader = gopacket.RegisterLayerType(115, gopacket.LayerTypeMetadata{Name: "Prism monitor mode header", Decoder: gopacket.DecodeFunc(decodePrismHeader)}) - LayerTypeVXLAN = gopacket.RegisterLayerType(116, gopacket.LayerTypeMetadata{Name: "VXLAN", Decoder: gopacket.DecodeFunc(decodeVXLAN)}) - LayerTypeNTP = gopacket.RegisterLayerType(117, gopacket.LayerTypeMetadata{Name: "NTP", Decoder: gopacket.DecodeFunc(decodeNTP)}) - LayerTypeDHCPv4 = gopacket.RegisterLayerType(118, gopacket.LayerTypeMetadata{Name: "DHCPv4", Decoder: gopacket.DecodeFunc(decodeDHCPv4)}) - LayerTypeVRRP = gopacket.RegisterLayerType(119, gopacket.LayerTypeMetadata{Name: "VRRP", Decoder: gopacket.DecodeFunc(decodeVRRP)}) - LayerTypeGeneve = gopacket.RegisterLayerType(120, gopacket.LayerTypeMetadata{Name: "Geneve", Decoder: gopacket.DecodeFunc(decodeGeneve)}) - LayerTypeSTP = gopacket.RegisterLayerType(121, gopacket.LayerTypeMetadata{Name: "STP", Decoder: gopacket.DecodeFunc(decodeSTP)}) - LayerTypeBFD = gopacket.RegisterLayerType(122, gopacket.LayerTypeMetadata{Name: "BFD", Decoder: gopacket.DecodeFunc(decodeBFD)}) - LayerTypeOSPF = gopacket.RegisterLayerType(123, gopacket.LayerTypeMetadata{Name: "OSPF", Decoder: gopacket.DecodeFunc(decodeOSPF)}) - LayerTypeICMPv6RouterSolicitation = gopacket.RegisterLayerType(124, gopacket.LayerTypeMetadata{Name: "ICMPv6RouterSolicitation", Decoder: gopacket.DecodeFunc(decodeICMPv6RouterSolicitation)}) - LayerTypeICMPv6RouterAdvertisement = gopacket.RegisterLayerType(125, gopacket.LayerTypeMetadata{Name: "ICMPv6RouterAdvertisement", Decoder: gopacket.DecodeFunc(decodeICMPv6RouterAdvertisement)}) - LayerTypeICMPv6NeighborSolicitation = gopacket.RegisterLayerType(126, gopacket.LayerTypeMetadata{Name: "ICMPv6NeighborSolicitation", Decoder: gopacket.DecodeFunc(decodeICMPv6NeighborSolicitation)}) - LayerTypeICMPv6NeighborAdvertisement = gopacket.RegisterLayerType(127, gopacket.LayerTypeMetadata{Name: "ICMPv6NeighborAdvertisement", Decoder: gopacket.DecodeFunc(decodeICMPv6NeighborAdvertisement)}) - LayerTypeICMPv6Redirect = gopacket.RegisterLayerType(128, gopacket.LayerTypeMetadata{Name: "ICMPv6Redirect", Decoder: gopacket.DecodeFunc(decodeICMPv6Redirect)}) - LayerTypeGTPv1U = gopacket.RegisterLayerType(129, gopacket.LayerTypeMetadata{Name: "GTPv1U", Decoder: gopacket.DecodeFunc(decodeGTPv1u)}) - LayerTypeEAPOLKey = gopacket.RegisterLayerType(130, gopacket.LayerTypeMetadata{Name: "EAPOLKey", Decoder: gopacket.DecodeFunc(decodeEAPOLKey)}) - LayerTypeLCM = gopacket.RegisterLayerType(131, gopacket.LayerTypeMetadata{Name: "LCM", Decoder: gopacket.DecodeFunc(decodeLCM)}) - LayerTypeICMPv6Echo = gopacket.RegisterLayerType(132, gopacket.LayerTypeMetadata{Name: "ICMPv6Echo", Decoder: gopacket.DecodeFunc(decodeICMPv6Echo)}) - LayerTypeSIP = gopacket.RegisterLayerType(133, gopacket.LayerTypeMetadata{Name: "SIP", Decoder: gopacket.DecodeFunc(decodeSIP)}) - LayerTypeDHCPv6 = gopacket.RegisterLayerType(134, gopacket.LayerTypeMetadata{Name: "DHCPv6", Decoder: gopacket.DecodeFunc(decodeDHCPv6)}) - LayerTypeMLDv1MulticastListenerReport = gopacket.RegisterLayerType(135, gopacket.LayerTypeMetadata{Name: "MLDv1MulticastListenerReport", Decoder: gopacket.DecodeFunc(decodeMLDv1MulticastListenerReport)}) - LayerTypeMLDv1MulticastListenerDone = gopacket.RegisterLayerType(136, gopacket.LayerTypeMetadata{Name: "MLDv1MulticastListenerDone", Decoder: gopacket.DecodeFunc(decodeMLDv1MulticastListenerDone)}) - LayerTypeMLDv1MulticastListenerQuery = gopacket.RegisterLayerType(137, gopacket.LayerTypeMetadata{Name: "MLDv1MulticastListenerQuery", Decoder: gopacket.DecodeFunc(decodeMLDv1MulticastListenerQuery)}) - LayerTypeMLDv2MulticastListenerReport = gopacket.RegisterLayerType(138, gopacket.LayerTypeMetadata{Name: "MLDv2MulticastListenerReport", Decoder: gopacket.DecodeFunc(decodeMLDv2MulticastListenerReport)}) - LayerTypeMLDv2MulticastListenerQuery = gopacket.RegisterLayerType(139, gopacket.LayerTypeMetadata{Name: "MLDv2MulticastListenerQuery", Decoder: gopacket.DecodeFunc(decodeMLDv2MulticastListenerQuery)}) - LayerTypeTLS = gopacket.RegisterLayerType(140, gopacket.LayerTypeMetadata{Name: "TLS", Decoder: gopacket.DecodeFunc(decodeTLS)}) - LayerTypeModbusTCP = gopacket.RegisterLayerType(141, gopacket.LayerTypeMetadata{Name: "ModbusTCP", Decoder: gopacket.DecodeFunc(decodeModbusTCP)}) - LayerTypeRMCP = gopacket.RegisterLayerType(142, gopacket.LayerTypeMetadata{Name: "RMCP", Decoder: gopacket.DecodeFunc(decodeRMCP)}) - LayerTypeASF = gopacket.RegisterLayerType(143, gopacket.LayerTypeMetadata{Name: "ASF", Decoder: gopacket.DecodeFunc(decodeASF)}) - LayerTypeASFPresencePong = gopacket.RegisterLayerType(144, gopacket.LayerTypeMetadata{Name: "ASFPresencePong", Decoder: gopacket.DecodeFunc(decodeASFPresencePong)}) - LayerTypeERSPANII = gopacket.RegisterLayerType(145, gopacket.LayerTypeMetadata{Name: "ERSPAN Type II", Decoder: gopacket.DecodeFunc(decodeERSPANII)}) - LayerTypeRADIUS = gopacket.RegisterLayerType(146, gopacket.LayerTypeMetadata{Name: "RADIUS", Decoder: gopacket.DecodeFunc(decodeRADIUS)}) -) - -var ( - // LayerClassIPNetwork contains TCP/IP network layer types. - LayerClassIPNetwork = gopacket.NewLayerClass([]gopacket.LayerType{ - LayerTypeIPv4, - LayerTypeIPv6, - }) - // LayerClassIPTransport contains TCP/IP transport layer types. - LayerClassIPTransport = gopacket.NewLayerClass([]gopacket.LayerType{ - LayerTypeTCP, - LayerTypeUDP, - LayerTypeSCTP, - }) - // LayerClassIPControl contains TCP/IP control protocols. - LayerClassIPControl = gopacket.NewLayerClass([]gopacket.LayerType{ - LayerTypeICMPv4, - LayerTypeICMPv6, - }) - // LayerClassSCTPChunk contains SCTP chunk types (not the top-level SCTP - // layer). - LayerClassSCTPChunk = gopacket.NewLayerClass([]gopacket.LayerType{ - LayerTypeSCTPUnknownChunkType, - LayerTypeSCTPData, - LayerTypeSCTPInit, - LayerTypeSCTPSack, - LayerTypeSCTPHeartbeat, - LayerTypeSCTPError, - LayerTypeSCTPShutdown, - LayerTypeSCTPShutdownAck, - LayerTypeSCTPCookieEcho, - LayerTypeSCTPEmptyLayer, - LayerTypeSCTPInitAck, - LayerTypeSCTPHeartbeatAck, - LayerTypeSCTPAbort, - LayerTypeSCTPShutdownComplete, - LayerTypeSCTPCookieAck, - }) - // LayerClassIPv6Extension contains IPv6 extension headers. - LayerClassIPv6Extension = gopacket.NewLayerClass([]gopacket.LayerType{ - LayerTypeIPv6HopByHop, - LayerTypeIPv6Routing, - LayerTypeIPv6Fragment, - LayerTypeIPv6Destination, - }) - LayerClassIPSec = gopacket.NewLayerClass([]gopacket.LayerType{ - LayerTypeIPSecAH, - LayerTypeIPSecESP, - }) - // LayerClassICMPv6NDP contains ICMPv6 neighbor discovery protocol - // messages. - LayerClassICMPv6NDP = gopacket.NewLayerClass([]gopacket.LayerType{ - LayerTypeICMPv6RouterSolicitation, - LayerTypeICMPv6RouterAdvertisement, - LayerTypeICMPv6NeighborSolicitation, - LayerTypeICMPv6NeighborAdvertisement, - LayerTypeICMPv6Redirect, - }) - // LayerClassMLDv1 contains multicast listener discovery protocol - LayerClassMLDv1 = gopacket.NewLayerClass([]gopacket.LayerType{ - LayerTypeMLDv1MulticastListenerQuery, - LayerTypeMLDv1MulticastListenerReport, - LayerTypeMLDv1MulticastListenerDone, - }) - // LayerClassMLDv2 contains multicast listener discovery protocol v2 - LayerClassMLDv2 = gopacket.NewLayerClass([]gopacket.LayerType{ - LayerTypeMLDv1MulticastListenerReport, - LayerTypeMLDv1MulticastListenerDone, - LayerTypeMLDv2MulticastListenerReport, - LayerTypeMLDv1MulticastListenerQuery, - LayerTypeMLDv2MulticastListenerQuery, - }) -) diff --git a/vendor/github.com/google/gopacket/layers/lcm.go b/vendor/github.com/google/gopacket/layers/lcm.go deleted file mode 100644 index 58a4b8289..000000000 --- a/vendor/github.com/google/gopacket/layers/lcm.go +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright 2018 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - "fmt" - - "github.com/google/gopacket" -) - -const ( - // LCMShortHeaderMagic is the LCM small message header magic number - LCMShortHeaderMagic uint32 = 0x4c433032 - // LCMFragmentedHeaderMagic is the LCM fragmented message header magic number - LCMFragmentedHeaderMagic uint32 = 0x4c433033 -) - -// LCM (Lightweight Communications and Marshalling) is a set of libraries and -// tools for message passing and data marshalling, targeted at real-time systems -// where high-bandwidth and low latency are critical. It provides a -// publish/subscribe message passing model and automatic -// marshalling/unmarshalling code generation with bindings for applications in a -// variety of programming languages. -// -// References -// https://lcm-proj.github.io/ -// https://github.com/lcm-proj/lcm -type LCM struct { - // Common (short & fragmented header) fields - Magic uint32 - SequenceNumber uint32 - // Fragmented header only fields - PayloadSize uint32 - FragmentOffset uint32 - FragmentNumber uint16 - TotalFragments uint16 - // Common field - ChannelName string - // Gopacket helper fields - Fragmented bool - fingerprint LCMFingerprint - contents []byte - payload []byte -} - -// LCMFingerprint is the type of a LCM fingerprint. -type LCMFingerprint uint64 - -var ( - // lcmLayerTypes contains a map of all LCM fingerprints that we support and - // their LayerType - lcmLayerTypes = map[LCMFingerprint]gopacket.LayerType{} - layerTypeIndex = 1001 -) - -// RegisterLCMLayerType allows users to register decoders for the underlying -// LCM payload. This is done based on the fingerprint that every LCM message -// contains and which identifies it uniquely. If num is not the zero value it -// will be used when registering with RegisterLayerType towards gopacket, -// otherwise an incremental value starting from 1001 will be used. -func RegisterLCMLayerType(num int, name string, fingerprint LCMFingerprint, - decoder gopacket.Decoder) gopacket.LayerType { - metadata := gopacket.LayerTypeMetadata{Name: name, Decoder: decoder} - - if num == 0 { - num = layerTypeIndex - layerTypeIndex++ - } - - lcmLayerTypes[fingerprint] = gopacket.RegisterLayerType(num, metadata) - - return lcmLayerTypes[fingerprint] -} - -// SupportedLCMFingerprints returns a slice of all LCM fingerprints that has -// been registered so far. -func SupportedLCMFingerprints() []LCMFingerprint { - fingerprints := make([]LCMFingerprint, 0, len(lcmLayerTypes)) - for fp := range lcmLayerTypes { - fingerprints = append(fingerprints, fp) - } - return fingerprints -} - -// GetLCMLayerType returns the underlying LCM message's LayerType. -// This LayerType has to be registered by using RegisterLCMLayerType. -func GetLCMLayerType(fingerprint LCMFingerprint) gopacket.LayerType { - layerType, ok := lcmLayerTypes[fingerprint] - if !ok { - return gopacket.LayerTypePayload - } - - return layerType -} - -func decodeLCM(data []byte, p gopacket.PacketBuilder) error { - lcm := &LCM{} - - err := lcm.DecodeFromBytes(data, p) - if err != nil { - return err - } - - p.AddLayer(lcm) - p.SetApplicationLayer(lcm) - - return p.NextDecoder(lcm.NextLayerType()) -} - -// DecodeFromBytes decodes the given bytes into this layer. -func (lcm *LCM) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 8 { - df.SetTruncated() - return errors.New("LCM < 8 bytes") - } - offset := 0 - - lcm.Magic = binary.BigEndian.Uint32(data[offset:4]) - offset += 4 - - if lcm.Magic != LCMShortHeaderMagic && lcm.Magic != LCMFragmentedHeaderMagic { - return fmt.Errorf("Received LCM header magic %v does not match know "+ - "LCM magic numbers. Dropping packet.", lcm.Magic) - } - - lcm.SequenceNumber = binary.BigEndian.Uint32(data[offset:8]) - offset += 4 - - if lcm.Magic == LCMFragmentedHeaderMagic { - lcm.Fragmented = true - - lcm.PayloadSize = binary.BigEndian.Uint32(data[offset : offset+4]) - offset += 4 - - lcm.FragmentOffset = binary.BigEndian.Uint32(data[offset : offset+4]) - offset += 4 - - lcm.FragmentNumber = binary.BigEndian.Uint16(data[offset : offset+2]) - offset += 2 - - lcm.TotalFragments = binary.BigEndian.Uint16(data[offset : offset+2]) - offset += 2 - } else { - lcm.Fragmented = false - } - - if !lcm.Fragmented || (lcm.Fragmented && lcm.FragmentNumber == 0) { - buffer := make([]byte, 0) - for _, b := range data[offset:] { - offset++ - - if b == 0 { - break - } - - buffer = append(buffer, b) - } - - lcm.ChannelName = string(buffer) - } - - lcm.fingerprint = LCMFingerprint( - binary.BigEndian.Uint64(data[offset : offset+8])) - - lcm.contents = data[:offset] - lcm.payload = data[offset:] - - return nil -} - -// CanDecode returns a set of layers that LCM objects can decode. -// As LCM objects can only decode the LCM layer, we just return that layer. -func (lcm LCM) CanDecode() gopacket.LayerClass { - return LayerTypeLCM -} - -// NextLayerType specifies the LCM payload layer type following this header. -// As LCM packets are serialized structs with uniq fingerprints for each uniq -// combination of data types, lookup of correct layer type is based on that -// fingerprint. -func (lcm LCM) NextLayerType() gopacket.LayerType { - if !lcm.Fragmented || (lcm.Fragmented && lcm.FragmentNumber == 0) { - return GetLCMLayerType(lcm.fingerprint) - } - - return gopacket.LayerTypeFragment -} - -// LayerType returns LayerTypeLCM -func (lcm LCM) LayerType() gopacket.LayerType { - return LayerTypeLCM -} - -// LayerContents returns the contents of the LCM header. -func (lcm LCM) LayerContents() []byte { - return lcm.contents -} - -// LayerPayload returns the payload following this LCM header. -func (lcm LCM) LayerPayload() []byte { - return lcm.payload -} - -// Payload returns the payload following this LCM header. -func (lcm LCM) Payload() []byte { - return lcm.LayerPayload() -} - -// Fingerprint returns the LCM fingerprint of the underlying message. -func (lcm LCM) Fingerprint() LCMFingerprint { - return lcm.fingerprint -} diff --git a/vendor/github.com/google/gopacket/layers/linux_sll.go b/vendor/github.com/google/gopacket/layers/linux_sll.go deleted file mode 100644 index 85a4f8bdd..000000000 --- a/vendor/github.com/google/gopacket/layers/linux_sll.go +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - "fmt" - "net" - - "github.com/google/gopacket" -) - -type LinuxSLLPacketType uint16 - -const ( - LinuxSLLPacketTypeHost LinuxSLLPacketType = 0 // To us - LinuxSLLPacketTypeBroadcast LinuxSLLPacketType = 1 // To all - LinuxSLLPacketTypeMulticast LinuxSLLPacketType = 2 // To group - LinuxSLLPacketTypeOtherhost LinuxSLLPacketType = 3 // To someone else - LinuxSLLPacketTypeOutgoing LinuxSLLPacketType = 4 // Outgoing of any type - // These ones are invisible by user level - LinuxSLLPacketTypeLoopback LinuxSLLPacketType = 5 // MC/BRD frame looped back - LinuxSLLPacketTypeFastroute LinuxSLLPacketType = 6 // Fastrouted frame -) - -func (l LinuxSLLPacketType) String() string { - switch l { - case LinuxSLLPacketTypeHost: - return "host" - case LinuxSLLPacketTypeBroadcast: - return "broadcast" - case LinuxSLLPacketTypeMulticast: - return "multicast" - case LinuxSLLPacketTypeOtherhost: - return "otherhost" - case LinuxSLLPacketTypeOutgoing: - return "outgoing" - case LinuxSLLPacketTypeLoopback: - return "loopback" - case LinuxSLLPacketTypeFastroute: - return "fastroute" - } - return fmt.Sprintf("Unknown(%d)", int(l)) -} - -type LinuxSLL struct { - BaseLayer - PacketType LinuxSLLPacketType - AddrLen uint16 - Addr net.HardwareAddr - EthernetType EthernetType - AddrType uint16 -} - -// LayerType returns LayerTypeLinuxSLL. -func (sll *LinuxSLL) LayerType() gopacket.LayerType { return LayerTypeLinuxSLL } - -func (sll *LinuxSLL) CanDecode() gopacket.LayerClass { - return LayerTypeLinuxSLL -} - -func (sll *LinuxSLL) LinkFlow() gopacket.Flow { - return gopacket.NewFlow(EndpointMAC, sll.Addr, nil) -} - -func (sll *LinuxSLL) NextLayerType() gopacket.LayerType { - return sll.EthernetType.LayerType() -} - -func (sll *LinuxSLL) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 16 { - return errors.New("Linux SLL packet too small") - } - sll.PacketType = LinuxSLLPacketType(binary.BigEndian.Uint16(data[0:2])) - sll.AddrType = binary.BigEndian.Uint16(data[2:4]) - sll.AddrLen = binary.BigEndian.Uint16(data[4:6]) - - sll.Addr = net.HardwareAddr(data[6 : sll.AddrLen+6]) - sll.EthernetType = EthernetType(binary.BigEndian.Uint16(data[14:16])) - sll.BaseLayer = BaseLayer{data[:16], data[16:]} - - return nil -} - -func decodeLinuxSLL(data []byte, p gopacket.PacketBuilder) error { - sll := &LinuxSLL{} - if err := sll.DecodeFromBytes(data, p); err != nil { - return err - } - p.AddLayer(sll) - p.SetLinkLayer(sll) - return p.NextDecoder(sll.EthernetType) -} diff --git a/vendor/github.com/google/gopacket/layers/llc.go b/vendor/github.com/google/gopacket/layers/llc.go deleted file mode 100644 index cad680367..000000000 --- a/vendor/github.com/google/gopacket/layers/llc.go +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - - "github.com/google/gopacket" -) - -// LLC is the layer used for 802.2 Logical Link Control headers. -// See http://standards.ieee.org/getieee802/download/802.2-1998.pdf -type LLC struct { - BaseLayer - DSAP uint8 - IG bool // true means group, false means individual - SSAP uint8 - CR bool // true means response, false means command - Control uint16 -} - -// LayerType returns gopacket.LayerTypeLLC. -func (l *LLC) LayerType() gopacket.LayerType { return LayerTypeLLC } - -// DecodeFromBytes decodes the given bytes into this layer. -func (l *LLC) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 3 { - return errors.New("LLC header too small") - } - l.DSAP = data[0] & 0xFE - l.IG = data[0]&0x1 != 0 - l.SSAP = data[1] & 0xFE - l.CR = data[1]&0x1 != 0 - l.Control = uint16(data[2]) - - if l.Control&0x1 == 0 || l.Control&0x3 == 0x1 { - if len(data) < 4 { - return errors.New("LLC header too small") - } - l.Control = l.Control<<8 | uint16(data[3]) - l.Contents = data[:4] - l.Payload = data[4:] - } else { - l.Contents = data[:3] - l.Payload = data[3:] - } - return nil -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (l *LLC) CanDecode() gopacket.LayerClass { - return LayerTypeLLC -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (l *LLC) NextLayerType() gopacket.LayerType { - switch { - case l.DSAP == 0xAA && l.SSAP == 0xAA: - return LayerTypeSNAP - case l.DSAP == 0x42 && l.SSAP == 0x42: - return LayerTypeSTP - } - return gopacket.LayerTypeZero // Not implemented -} - -// SNAP is used inside LLC. See -// http://standards.ieee.org/getieee802/download/802-2001.pdf. -// From http://en.wikipedia.org/wiki/Subnetwork_Access_Protocol: -// "[T]he Subnetwork Access Protocol (SNAP) is a mechanism for multiplexing, -// on networks using IEEE 802.2 LLC, more protocols than can be distinguished -// by the 8-bit 802.2 Service Access Point (SAP) fields." -type SNAP struct { - BaseLayer - OrganizationalCode []byte - Type EthernetType -} - -// LayerType returns gopacket.LayerTypeSNAP. -func (s *SNAP) LayerType() gopacket.LayerType { return LayerTypeSNAP } - -// DecodeFromBytes decodes the given bytes into this layer. -func (s *SNAP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 5 { - return errors.New("SNAP header too small") - } - s.OrganizationalCode = data[:3] - s.Type = EthernetType(binary.BigEndian.Uint16(data[3:5])) - s.BaseLayer = BaseLayer{data[:5], data[5:]} - return nil -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (s *SNAP) CanDecode() gopacket.LayerClass { - return LayerTypeSNAP -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (s *SNAP) NextLayerType() gopacket.LayerType { - // See BUG(gconnel) in decodeSNAP - return s.Type.LayerType() -} - -func decodeLLC(data []byte, p gopacket.PacketBuilder) error { - l := &LLC{} - err := l.DecodeFromBytes(data, p) - if err != nil { - return err - } - p.AddLayer(l) - return p.NextDecoder(l.NextLayerType()) -} - -func decodeSNAP(data []byte, p gopacket.PacketBuilder) error { - s := &SNAP{} - err := s.DecodeFromBytes(data, p) - if err != nil { - return err - } - p.AddLayer(s) - // BUG(gconnell): When decoding SNAP, we treat the SNAP type as an Ethernet - // type. This may not actually be an ethernet type in all cases, - // depending on the organizational code. Right now, we don't check. - return p.NextDecoder(s.Type) -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (l *LLC) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - var igFlag, crFlag byte - var length int - - if l.Control&0xFF00 != 0 { - length = 4 - } else { - length = 3 - } - - if l.DSAP&0x1 != 0 { - return errors.New("DSAP value invalid, should not include IG flag bit") - } - - if l.SSAP&0x1 != 0 { - return errors.New("SSAP value invalid, should not include CR flag bit") - } - - if buf, err := b.PrependBytes(length); err != nil { - return err - } else { - igFlag = 0 - if l.IG { - igFlag = 0x1 - } - - crFlag = 0 - if l.CR { - crFlag = 0x1 - } - - buf[0] = l.DSAP + igFlag - buf[1] = l.SSAP + crFlag - - if length == 4 { - buf[2] = uint8(l.Control >> 8) - buf[3] = uint8(l.Control) - } else { - buf[2] = uint8(l.Control) - } - } - - return nil -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (s *SNAP) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - if buf, err := b.PrependBytes(5); err != nil { - return err - } else { - buf[0] = s.OrganizationalCode[0] - buf[1] = s.OrganizationalCode[1] - buf[2] = s.OrganizationalCode[2] - binary.BigEndian.PutUint16(buf[3:5], uint16(s.Type)) - } - - return nil -} diff --git a/vendor/github.com/google/gopacket/layers/lldp.go b/vendor/github.com/google/gopacket/layers/lldp.go deleted file mode 100644 index 16a5bbada..000000000 --- a/vendor/github.com/google/gopacket/layers/lldp.go +++ /dev/null @@ -1,1603 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - "fmt" - - "github.com/google/gopacket" -) - -// LLDPTLVType is the type of each TLV value in a LinkLayerDiscovery packet. -type LLDPTLVType byte - -const ( - LLDPTLVEnd LLDPTLVType = 0 - LLDPTLVChassisID LLDPTLVType = 1 - LLDPTLVPortID LLDPTLVType = 2 - LLDPTLVTTL LLDPTLVType = 3 - LLDPTLVPortDescription LLDPTLVType = 4 - LLDPTLVSysName LLDPTLVType = 5 - LLDPTLVSysDescription LLDPTLVType = 6 - LLDPTLVSysCapabilities LLDPTLVType = 7 - LLDPTLVMgmtAddress LLDPTLVType = 8 - LLDPTLVOrgSpecific LLDPTLVType = 127 -) - -// LinkLayerDiscoveryValue is a TLV value inside a LinkLayerDiscovery packet layer. -type LinkLayerDiscoveryValue struct { - Type LLDPTLVType - Length uint16 - Value []byte -} - -func (c *LinkLayerDiscoveryValue) len() int { - return 0 -} - -// LLDPChassisIDSubType specifies the value type for a single LLDPChassisID.ID -type LLDPChassisIDSubType byte - -// LLDP Chassis Types -const ( - LLDPChassisIDSubTypeReserved LLDPChassisIDSubType = 0 - LLDPChassisIDSubTypeChassisComp LLDPChassisIDSubType = 1 - LLDPChassisIDSubtypeIfaceAlias LLDPChassisIDSubType = 2 - LLDPChassisIDSubTypePortComp LLDPChassisIDSubType = 3 - LLDPChassisIDSubTypeMACAddr LLDPChassisIDSubType = 4 - LLDPChassisIDSubTypeNetworkAddr LLDPChassisIDSubType = 5 - LLDPChassisIDSubtypeIfaceName LLDPChassisIDSubType = 6 - LLDPChassisIDSubTypeLocal LLDPChassisIDSubType = 7 -) - -type LLDPChassisID struct { - Subtype LLDPChassisIDSubType - ID []byte -} - -func (c *LLDPChassisID) serialize() []byte { - - var buf = make([]byte, c.serializedLen()) - idLen := uint16(LLDPTLVChassisID)<<9 | uint16(len(c.ID)+1) //id should take 7 bits, length should take 9 bits, +1 for subtype - binary.BigEndian.PutUint16(buf[0:2], idLen) - buf[2] = byte(c.Subtype) - copy(buf[3:], c.ID) - return buf -} - -func (c *LLDPChassisID) serializedLen() int { - return len(c.ID) + 3 // +2 for id and length, +1 for subtype -} - -// LLDPPortIDSubType specifies the value type for a single LLDPPortID.ID -type LLDPPortIDSubType byte - -// LLDP PortID types -const ( - LLDPPortIDSubtypeReserved LLDPPortIDSubType = 0 - LLDPPortIDSubtypeIfaceAlias LLDPPortIDSubType = 1 - LLDPPortIDSubtypePortComp LLDPPortIDSubType = 2 - LLDPPortIDSubtypeMACAddr LLDPPortIDSubType = 3 - LLDPPortIDSubtypeNetworkAddr LLDPPortIDSubType = 4 - LLDPPortIDSubtypeIfaceName LLDPPortIDSubType = 5 - LLDPPortIDSubtypeAgentCircuitID LLDPPortIDSubType = 6 - LLDPPortIDSubtypeLocal LLDPPortIDSubType = 7 -) - -type LLDPPortID struct { - Subtype LLDPPortIDSubType - ID []byte -} - -func (c *LLDPPortID) serialize() []byte { - - var buf = make([]byte, c.serializedLen()) - idLen := uint16(LLDPTLVPortID)<<9 | uint16(len(c.ID)+1) //id should take 7 bits, length should take 9 bits, +1 for subtype - binary.BigEndian.PutUint16(buf[0:2], idLen) - buf[2] = byte(c.Subtype) - copy(buf[3:], c.ID) - return buf -} - -func (c *LLDPPortID) serializedLen() int { - return len(c.ID) + 3 // +2 for id and length, +1 for subtype -} - -// LinkLayerDiscovery is a packet layer containing the LinkLayer Discovery Protocol. -// See http:http://standards.ieee.org/getieee802/download/802.1AB-2009.pdf -// ChassisID, PortID and TTL are mandatory TLV's. Other values can be decoded -// with DecodeValues() -type LinkLayerDiscovery struct { - BaseLayer - ChassisID LLDPChassisID - PortID LLDPPortID - TTL uint16 - Values []LinkLayerDiscoveryValue -} - -type IEEEOUI uint32 - -// http://standards.ieee.org/develop/regauth/oui/oui.txt -const ( - IEEEOUI8021 IEEEOUI = 0x0080c2 - IEEEOUI8023 IEEEOUI = 0x00120f - IEEEOUI80211 IEEEOUI = 0x000fac - IEEEOUI8021Qbg IEEEOUI = 0x0013BF - IEEEOUICisco2 IEEEOUI = 0x000142 - IEEEOUIMedia IEEEOUI = 0x0012bb // TR-41 - IEEEOUIProfinet IEEEOUI = 0x000ecf - IEEEOUIDCBX IEEEOUI = 0x001b21 -) - -// LLDPOrgSpecificTLV is an Organisation-specific TLV -type LLDPOrgSpecificTLV struct { - OUI IEEEOUI - SubType uint8 - Info []byte -} - -// LLDPCapabilities Types -const ( - LLDPCapsOther uint16 = 1 << 0 - LLDPCapsRepeater uint16 = 1 << 1 - LLDPCapsBridge uint16 = 1 << 2 - LLDPCapsWLANAP uint16 = 1 << 3 - LLDPCapsRouter uint16 = 1 << 4 - LLDPCapsPhone uint16 = 1 << 5 - LLDPCapsDocSis uint16 = 1 << 6 - LLDPCapsStationOnly uint16 = 1 << 7 - LLDPCapsCVLAN uint16 = 1 << 8 - LLDPCapsSVLAN uint16 = 1 << 9 - LLDPCapsTmpr uint16 = 1 << 10 -) - -// LLDPCapabilities represents the capabilities of a device -type LLDPCapabilities struct { - Other bool - Repeater bool - Bridge bool - WLANAP bool - Router bool - Phone bool - DocSis bool - StationOnly bool - CVLAN bool - SVLAN bool - TMPR bool -} - -type LLDPSysCapabilities struct { - SystemCap LLDPCapabilities - EnabledCap LLDPCapabilities -} - -type IANAAddressFamily byte - -// LLDP Management Address Subtypes -// http://www.iana.org/assignments/address-family-numbers/address-family-numbers.xml -const ( - IANAAddressFamilyReserved IANAAddressFamily = 0 - IANAAddressFamilyIPV4 IANAAddressFamily = 1 - IANAAddressFamilyIPV6 IANAAddressFamily = 2 - IANAAddressFamilyNSAP IANAAddressFamily = 3 - IANAAddressFamilyHDLC IANAAddressFamily = 4 - IANAAddressFamilyBBN1822 IANAAddressFamily = 5 - IANAAddressFamily802 IANAAddressFamily = 6 - IANAAddressFamilyE163 IANAAddressFamily = 7 - IANAAddressFamilyE164 IANAAddressFamily = 8 - IANAAddressFamilyF69 IANAAddressFamily = 9 - IANAAddressFamilyX121 IANAAddressFamily = 10 - IANAAddressFamilyIPX IANAAddressFamily = 11 - IANAAddressFamilyAtalk IANAAddressFamily = 12 - IANAAddressFamilyDecnet IANAAddressFamily = 13 - IANAAddressFamilyBanyan IANAAddressFamily = 14 - IANAAddressFamilyE164NSAP IANAAddressFamily = 15 - IANAAddressFamilyDNS IANAAddressFamily = 16 - IANAAddressFamilyDistname IANAAddressFamily = 17 - IANAAddressFamilyASNumber IANAAddressFamily = 18 - IANAAddressFamilyXTPIPV4 IANAAddressFamily = 19 - IANAAddressFamilyXTPIPV6 IANAAddressFamily = 20 - IANAAddressFamilyXTP IANAAddressFamily = 21 - IANAAddressFamilyFcWWPN IANAAddressFamily = 22 - IANAAddressFamilyFcWWNN IANAAddressFamily = 23 - IANAAddressFamilyGWID IANAAddressFamily = 24 - IANAAddressFamilyL2VPN IANAAddressFamily = 25 -) - -type LLDPInterfaceSubtype byte - -// LLDP Interface Subtypes -const ( - LLDPInterfaceSubtypeUnknown LLDPInterfaceSubtype = 1 - LLDPInterfaceSubtypeifIndex LLDPInterfaceSubtype = 2 - LLDPInterfaceSubtypeSysPort LLDPInterfaceSubtype = 3 -) - -type LLDPMgmtAddress struct { - Subtype IANAAddressFamily - Address []byte - InterfaceSubtype LLDPInterfaceSubtype - InterfaceNumber uint32 - OID string -} - -// LinkLayerDiscoveryInfo represents the decoded details for a set of LinkLayerDiscoveryValues -// Organisation-specific TLV's can be decoded using the various Decode() methods -type LinkLayerDiscoveryInfo struct { - BaseLayer - PortDescription string - SysName string - SysDescription string - SysCapabilities LLDPSysCapabilities - MgmtAddress LLDPMgmtAddress - OrgTLVs []LLDPOrgSpecificTLV // Private TLVs - Unknown []LinkLayerDiscoveryValue // undecoded TLVs -} - -/// IEEE 802.1 TLV Subtypes -const ( - LLDP8021SubtypePortVLANID uint8 = 1 - LLDP8021SubtypeProtocolVLANID uint8 = 2 - LLDP8021SubtypeVLANName uint8 = 3 - LLDP8021SubtypeProtocolIdentity uint8 = 4 - LLDP8021SubtypeVDIUsageDigest uint8 = 5 - LLDP8021SubtypeManagementVID uint8 = 6 - LLDP8021SubtypeLinkAggregation uint8 = 7 -) - -// VLAN Port Protocol ID options -const ( - LLDPProtocolVLANIDCapability byte = 1 << 1 - LLDPProtocolVLANIDStatus byte = 1 << 2 -) - -type PortProtocolVLANID struct { - Supported bool - Enabled bool - ID uint16 -} - -type VLANName struct { - ID uint16 - Name string -} - -type ProtocolIdentity []byte - -// LACP options -const ( - LLDPAggregationCapability byte = 1 << 0 - LLDPAggregationStatus byte = 1 << 1 -) - -// IEEE 802 Link Aggregation parameters -type LLDPLinkAggregation struct { - Supported bool - Enabled bool - PortID uint32 -} - -// LLDPInfo8021 represents the information carried in 802.1 Org-specific TLVs -type LLDPInfo8021 struct { - PVID uint16 - PPVIDs []PortProtocolVLANID - VLANNames []VLANName - ProtocolIdentities []ProtocolIdentity - VIDUsageDigest uint32 - ManagementVID uint16 - LinkAggregation LLDPLinkAggregation -} - -// IEEE 802.3 TLV Subtypes -const ( - LLDP8023SubtypeMACPHY uint8 = 1 - LLDP8023SubtypeMDIPower uint8 = 2 - LLDP8023SubtypeLinkAggregation uint8 = 3 - LLDP8023SubtypeMTU uint8 = 4 -) - -// MACPHY options -const ( - LLDPMACPHYCapability byte = 1 << 0 - LLDPMACPHYStatus byte = 1 << 1 -) - -// From IANA-MAU-MIB (introduced by RFC 4836) - dot3MauType -const ( - LLDPMAUTypeUnknown uint16 = 0 - LLDPMAUTypeAUI uint16 = 1 - LLDPMAUType10Base5 uint16 = 2 - LLDPMAUTypeFOIRL uint16 = 3 - LLDPMAUType10Base2 uint16 = 4 - LLDPMAUType10BaseT uint16 = 5 - LLDPMAUType10BaseFP uint16 = 6 - LLDPMAUType10BaseFB uint16 = 7 - LLDPMAUType10BaseFL uint16 = 8 - LLDPMAUType10BROAD36 uint16 = 9 - LLDPMAUType10BaseT_HD uint16 = 10 - LLDPMAUType10BaseT_FD uint16 = 11 - LLDPMAUType10BaseFL_HD uint16 = 12 - LLDPMAUType10BaseFL_FD uint16 = 13 - LLDPMAUType100BaseT4 uint16 = 14 - LLDPMAUType100BaseTX_HD uint16 = 15 - LLDPMAUType100BaseTX_FD uint16 = 16 - LLDPMAUType100BaseFX_HD uint16 = 17 - LLDPMAUType100BaseFX_FD uint16 = 18 - LLDPMAUType100BaseT2_HD uint16 = 19 - LLDPMAUType100BaseT2_FD uint16 = 20 - LLDPMAUType1000BaseX_HD uint16 = 21 - LLDPMAUType1000BaseX_FD uint16 = 22 - LLDPMAUType1000BaseLX_HD uint16 = 23 - LLDPMAUType1000BaseLX_FD uint16 = 24 - LLDPMAUType1000BaseSX_HD uint16 = 25 - LLDPMAUType1000BaseSX_FD uint16 = 26 - LLDPMAUType1000BaseCX_HD uint16 = 27 - LLDPMAUType1000BaseCX_FD uint16 = 28 - LLDPMAUType1000BaseT_HD uint16 = 29 - LLDPMAUType1000BaseT_FD uint16 = 30 - LLDPMAUType10GBaseX uint16 = 31 - LLDPMAUType10GBaseLX4 uint16 = 32 - LLDPMAUType10GBaseR uint16 = 33 - LLDPMAUType10GBaseER uint16 = 34 - LLDPMAUType10GBaseLR uint16 = 35 - LLDPMAUType10GBaseSR uint16 = 36 - LLDPMAUType10GBaseW uint16 = 37 - LLDPMAUType10GBaseEW uint16 = 38 - LLDPMAUType10GBaseLW uint16 = 39 - LLDPMAUType10GBaseSW uint16 = 40 - LLDPMAUType10GBaseCX4 uint16 = 41 - LLDPMAUType2BaseTL uint16 = 42 - LLDPMAUType10PASS_TS uint16 = 43 - LLDPMAUType100BaseBX10D uint16 = 44 - LLDPMAUType100BaseBX10U uint16 = 45 - LLDPMAUType100BaseLX10 uint16 = 46 - LLDPMAUType1000BaseBX10D uint16 = 47 - LLDPMAUType1000BaseBX10U uint16 = 48 - LLDPMAUType1000BaseLX10 uint16 = 49 - LLDPMAUType1000BasePX10D uint16 = 50 - LLDPMAUType1000BasePX10U uint16 = 51 - LLDPMAUType1000BasePX20D uint16 = 52 - LLDPMAUType1000BasePX20U uint16 = 53 - LLDPMAUType10GBaseT uint16 = 54 - LLDPMAUType10GBaseLRM uint16 = 55 - LLDPMAUType1000BaseKX uint16 = 56 - LLDPMAUType10GBaseKX4 uint16 = 57 - LLDPMAUType10GBaseKR uint16 = 58 - LLDPMAUType10_1GBasePRX_D1 uint16 = 59 - LLDPMAUType10_1GBasePRX_D2 uint16 = 60 - LLDPMAUType10_1GBasePRX_D3 uint16 = 61 - LLDPMAUType10_1GBasePRX_U1 uint16 = 62 - LLDPMAUType10_1GBasePRX_U2 uint16 = 63 - LLDPMAUType10_1GBasePRX_U3 uint16 = 64 - LLDPMAUType10GBasePR_D1 uint16 = 65 - LLDPMAUType10GBasePR_D2 uint16 = 66 - LLDPMAUType10GBasePR_D3 uint16 = 67 - LLDPMAUType10GBasePR_U1 uint16 = 68 - LLDPMAUType10GBasePR_U3 uint16 = 69 -) - -// From RFC 3636 - ifMauAutoNegCapAdvertisedBits -const ( - LLDPMAUPMDOther uint16 = 1 << 15 - LLDPMAUPMD10BaseT uint16 = 1 << 14 - LLDPMAUPMD10BaseT_FD uint16 = 1 << 13 - LLDPMAUPMD100BaseT4 uint16 = 1 << 12 - LLDPMAUPMD100BaseTX uint16 = 1 << 11 - LLDPMAUPMD100BaseTX_FD uint16 = 1 << 10 - LLDPMAUPMD100BaseT2 uint16 = 1 << 9 - LLDPMAUPMD100BaseT2_FD uint16 = 1 << 8 - LLDPMAUPMDFDXPAUSE uint16 = 1 << 7 - LLDPMAUPMDFDXAPAUSE uint16 = 1 << 6 - LLDPMAUPMDFDXSPAUSE uint16 = 1 << 5 - LLDPMAUPMDFDXBPAUSE uint16 = 1 << 4 - LLDPMAUPMD1000BaseX uint16 = 1 << 3 - LLDPMAUPMD1000BaseX_FD uint16 = 1 << 2 - LLDPMAUPMD1000BaseT uint16 = 1 << 1 - LLDPMAUPMD1000BaseT_FD uint16 = 1 << 0 -) - -// Inverted ifMauAutoNegCapAdvertisedBits if required -// (Some manufacturers misinterpreted the spec - -// see https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1455) -const ( - LLDPMAUPMDOtherInv uint16 = 1 << 0 - LLDPMAUPMD10BaseTInv uint16 = 1 << 1 - LLDPMAUPMD10BaseT_FDInv uint16 = 1 << 2 - LLDPMAUPMD100BaseT4Inv uint16 = 1 << 3 - LLDPMAUPMD100BaseTXInv uint16 = 1 << 4 - LLDPMAUPMD100BaseTX_FDInv uint16 = 1 << 5 - LLDPMAUPMD100BaseT2Inv uint16 = 1 << 6 - LLDPMAUPMD100BaseT2_FDInv uint16 = 1 << 7 - LLDPMAUPMDFDXPAUSEInv uint16 = 1 << 8 - LLDPMAUPMDFDXAPAUSEInv uint16 = 1 << 9 - LLDPMAUPMDFDXSPAUSEInv uint16 = 1 << 10 - LLDPMAUPMDFDXBPAUSEInv uint16 = 1 << 11 - LLDPMAUPMD1000BaseXInv uint16 = 1 << 12 - LLDPMAUPMD1000BaseX_FDInv uint16 = 1 << 13 - LLDPMAUPMD1000BaseTInv uint16 = 1 << 14 - LLDPMAUPMD1000BaseT_FDInv uint16 = 1 << 15 -) - -type LLDPMACPHYConfigStatus struct { - AutoNegSupported bool - AutoNegEnabled bool - AutoNegCapability uint16 - MAUType uint16 -} - -// MDI Power options -const ( - LLDPMDIPowerPortClass byte = 1 << 0 - LLDPMDIPowerCapability byte = 1 << 1 - LLDPMDIPowerStatus byte = 1 << 2 - LLDPMDIPowerPairsAbility byte = 1 << 3 -) - -type LLDPPowerType byte - -type LLDPPowerSource byte - -type LLDPPowerPriority byte - -const ( - LLDPPowerPriorityUnknown LLDPPowerPriority = 0 - LLDPPowerPriorityMedium LLDPPowerPriority = 1 - LLDPPowerPriorityHigh LLDPPowerPriority = 2 - LLDPPowerPriorityLow LLDPPowerPriority = 3 -) - -type LLDPPowerViaMDI8023 struct { - PortClassPSE bool // false = PD - PSESupported bool - PSEEnabled bool - PSEPairsAbility bool - PSEPowerPair uint8 - PSEClass uint8 - Type LLDPPowerType - Source LLDPPowerSource - Priority LLDPPowerPriority - Requested uint16 // 1-510 Watts - Allocated uint16 // 1-510 Watts -} - -// LLDPInfo8023 represents the information carried in 802.3 Org-specific TLVs -type LLDPInfo8023 struct { - MACPHYConfigStatus LLDPMACPHYConfigStatus - PowerViaMDI LLDPPowerViaMDI8023 - LinkAggregation LLDPLinkAggregation - MTU uint16 -} - -// IEEE 802.1Qbg TLV Subtypes -const ( - LLDP8021QbgEVB uint8 = 0 - LLDP8021QbgCDCP uint8 = 1 - LLDP8021QbgVDP uint8 = 2 - LLDP8021QbgEVB22 uint8 = 13 -) - -// LLDPEVBCapabilities Types -const ( - LLDPEVBCapsSTD uint16 = 1 << 7 - LLDPEVBCapsRR uint16 = 1 << 6 - LLDPEVBCapsRTE uint16 = 1 << 2 - LLDPEVBCapsECP uint16 = 1 << 1 - LLDPEVBCapsVDP uint16 = 1 << 0 -) - -// LLDPEVBCapabilities represents the EVB capabilities of a device -type LLDPEVBCapabilities struct { - StandardBridging bool - ReflectiveRelay bool - RetransmissionTimerExponent bool - EdgeControlProtocol bool - VSIDiscoveryProtocol bool -} - -type LLDPEVBSettings struct { - Supported LLDPEVBCapabilities - Enabled LLDPEVBCapabilities - SupportedVSIs uint16 - ConfiguredVSIs uint16 - RTEExponent uint8 -} - -// LLDPInfo8021Qbg represents the information carried in 802.1Qbg Org-specific TLVs -type LLDPInfo8021Qbg struct { - EVBSettings LLDPEVBSettings -} - -type LLDPMediaSubtype uint8 - -// Media TLV Subtypes -const ( - LLDPMediaTypeCapabilities LLDPMediaSubtype = 1 - LLDPMediaTypeNetwork LLDPMediaSubtype = 2 - LLDPMediaTypeLocation LLDPMediaSubtype = 3 - LLDPMediaTypePower LLDPMediaSubtype = 4 - LLDPMediaTypeHardware LLDPMediaSubtype = 5 - LLDPMediaTypeFirmware LLDPMediaSubtype = 6 - LLDPMediaTypeSoftware LLDPMediaSubtype = 7 - LLDPMediaTypeSerial LLDPMediaSubtype = 8 - LLDPMediaTypeManufacturer LLDPMediaSubtype = 9 - LLDPMediaTypeModel LLDPMediaSubtype = 10 - LLDPMediaTypeAssetID LLDPMediaSubtype = 11 -) - -type LLDPMediaClass uint8 - -// Media Class Values -const ( - LLDPMediaClassUndefined LLDPMediaClass = 0 - LLDPMediaClassEndpointI LLDPMediaClass = 1 - LLDPMediaClassEndpointII LLDPMediaClass = 2 - LLDPMediaClassEndpointIII LLDPMediaClass = 3 - LLDPMediaClassNetwork LLDPMediaClass = 4 -) - -// LLDPMediaCapabilities Types -const ( - LLDPMediaCapsLLDP uint16 = 1 << 0 - LLDPMediaCapsNetwork uint16 = 1 << 1 - LLDPMediaCapsLocation uint16 = 1 << 2 - LLDPMediaCapsPowerPSE uint16 = 1 << 3 - LLDPMediaCapsPowerPD uint16 = 1 << 4 - LLDPMediaCapsInventory uint16 = 1 << 5 -) - -// LLDPMediaCapabilities represents the LLDP Media capabilities of a device -type LLDPMediaCapabilities struct { - Capabilities bool - NetworkPolicy bool - Location bool - PowerPSE bool - PowerPD bool - Inventory bool - Class LLDPMediaClass -} - -type LLDPApplicationType uint8 - -const ( - LLDPAppTypeReserved LLDPApplicationType = 0 - LLDPAppTypeVoice LLDPApplicationType = 1 - LLDPappTypeVoiceSignaling LLDPApplicationType = 2 - LLDPappTypeGuestVoice LLDPApplicationType = 3 - LLDPappTypeGuestVoiceSignaling LLDPApplicationType = 4 - LLDPappTypeSoftphoneVoice LLDPApplicationType = 5 - LLDPappTypeVideoConferencing LLDPApplicationType = 6 - LLDPappTypeStreamingVideo LLDPApplicationType = 7 - LLDPappTypeVideoSignaling LLDPApplicationType = 8 -) - -type LLDPNetworkPolicy struct { - ApplicationType LLDPApplicationType - Defined bool - Tagged bool - VLANId uint16 - L2Priority uint16 - DSCPValue uint8 -} - -type LLDPLocationFormat uint8 - -const ( - LLDPLocationFormatInvalid LLDPLocationFormat = 0 - LLDPLocationFormatCoordinate LLDPLocationFormat = 1 - LLDPLocationFormatAddress LLDPLocationFormat = 2 - LLDPLocationFormatECS LLDPLocationFormat = 3 -) - -type LLDPLocationAddressWhat uint8 - -const ( - LLDPLocationAddressWhatDHCP LLDPLocationAddressWhat = 0 - LLDPLocationAddressWhatNetwork LLDPLocationAddressWhat = 1 - LLDPLocationAddressWhatClient LLDPLocationAddressWhat = 2 -) - -type LLDPLocationAddressType uint8 - -const ( - LLDPLocationAddressTypeLanguage LLDPLocationAddressType = 0 - LLDPLocationAddressTypeNational LLDPLocationAddressType = 1 - LLDPLocationAddressTypeCounty LLDPLocationAddressType = 2 - LLDPLocationAddressTypeCity LLDPLocationAddressType = 3 - LLDPLocationAddressTypeCityDivision LLDPLocationAddressType = 4 - LLDPLocationAddressTypeNeighborhood LLDPLocationAddressType = 5 - LLDPLocationAddressTypeStreet LLDPLocationAddressType = 6 - LLDPLocationAddressTypeLeadingStreet LLDPLocationAddressType = 16 - LLDPLocationAddressTypeTrailingStreet LLDPLocationAddressType = 17 - LLDPLocationAddressTypeStreetSuffix LLDPLocationAddressType = 18 - LLDPLocationAddressTypeHouseNum LLDPLocationAddressType = 19 - LLDPLocationAddressTypeHouseSuffix LLDPLocationAddressType = 20 - LLDPLocationAddressTypeLandmark LLDPLocationAddressType = 21 - LLDPLocationAddressTypeAdditional LLDPLocationAddressType = 22 - LLDPLocationAddressTypeName LLDPLocationAddressType = 23 - LLDPLocationAddressTypePostal LLDPLocationAddressType = 24 - LLDPLocationAddressTypeBuilding LLDPLocationAddressType = 25 - LLDPLocationAddressTypeUnit LLDPLocationAddressType = 26 - LLDPLocationAddressTypeFloor LLDPLocationAddressType = 27 - LLDPLocationAddressTypeRoom LLDPLocationAddressType = 28 - LLDPLocationAddressTypePlace LLDPLocationAddressType = 29 - LLDPLocationAddressTypeScript LLDPLocationAddressType = 128 -) - -type LLDPLocationCoordinate struct { - LatitudeResolution uint8 - Latitude uint64 - LongitudeResolution uint8 - Longitude uint64 - AltitudeType uint8 - AltitudeResolution uint16 - Altitude uint32 - Datum uint8 -} - -type LLDPLocationAddressLine struct { - Type LLDPLocationAddressType - Value string -} - -type LLDPLocationAddress struct { - What LLDPLocationAddressWhat - CountryCode string - AddressLines []LLDPLocationAddressLine -} - -type LLDPLocationECS struct { - ELIN string -} - -// LLDP represents a physical location. -// Only one of the embedded types will contain values, depending on Format. -type LLDPLocation struct { - Format LLDPLocationFormat - Coordinate LLDPLocationCoordinate - Address LLDPLocationAddress - ECS LLDPLocationECS -} - -type LLDPPowerViaMDI struct { - Type LLDPPowerType - Source LLDPPowerSource - Priority LLDPPowerPriority - Value uint16 -} - -// LLDPInfoMedia represents the information carried in TR-41 Org-specific TLVs -type LLDPInfoMedia struct { - MediaCapabilities LLDPMediaCapabilities - NetworkPolicy LLDPNetworkPolicy - Location LLDPLocation - PowerViaMDI LLDPPowerViaMDI - HardwareRevision string - FirmwareRevision string - SoftwareRevision string - SerialNumber string - Manufacturer string - Model string - AssetID string -} - -type LLDPCisco2Subtype uint8 - -// Cisco2 TLV Subtypes -const ( - LLDPCisco2PowerViaMDI LLDPCisco2Subtype = 1 -) - -const ( - LLDPCiscoPSESupport uint8 = 1 << 0 - LLDPCiscoArchShared uint8 = 1 << 1 - LLDPCiscoPDSparePair uint8 = 1 << 2 - LLDPCiscoPSESparePair uint8 = 1 << 3 -) - -// LLDPInfoCisco2 represents the information carried in Cisco Org-specific TLVs -type LLDPInfoCisco2 struct { - PSEFourWirePoESupported bool - PDSparePairArchitectureShared bool - PDRequestSparePairPoEOn bool - PSESparePairPoEOn bool -} - -// Profinet Subtypes -type LLDPProfinetSubtype uint8 - -const ( - LLDPProfinetPNIODelay LLDPProfinetSubtype = 1 - LLDPProfinetPNIOPortStatus LLDPProfinetSubtype = 2 - LLDPProfinetPNIOMRPPortStatus LLDPProfinetSubtype = 4 - LLDPProfinetPNIOChassisMAC LLDPProfinetSubtype = 5 - LLDPProfinetPNIOPTCPStatus LLDPProfinetSubtype = 6 -) - -type LLDPPNIODelay struct { - RXLocal uint32 - RXRemote uint32 - TXLocal uint32 - TXRemote uint32 - CableLocal uint32 -} - -type LLDPPNIOPortStatus struct { - Class2 uint16 - Class3 uint16 -} - -type LLDPPNIOMRPPortStatus struct { - UUID []byte - Status uint16 -} - -type LLDPPNIOPTCPStatus struct { - MasterAddress []byte - SubdomainUUID []byte - IRDataUUID []byte - PeriodValid bool - PeriodLength uint32 - RedPeriodValid bool - RedPeriodBegin uint32 - OrangePeriodValid bool - OrangePeriodBegin uint32 - GreenPeriodValid bool - GreenPeriodBegin uint32 -} - -// LLDPInfoProfinet represents the information carried in Profinet Org-specific TLVs -type LLDPInfoProfinet struct { - PNIODelay LLDPPNIODelay - PNIOPortStatus LLDPPNIOPortStatus - PNIOMRPPortStatus LLDPPNIOMRPPortStatus - ChassisMAC []byte - PNIOPTCPStatus LLDPPNIOPTCPStatus -} - -// LayerType returns gopacket.LayerTypeLinkLayerDiscovery. -func (c *LinkLayerDiscovery) LayerType() gopacket.LayerType { - return LayerTypeLinkLayerDiscovery -} - -// SerializeTo serializes LLDP packet to bytes and writes on SerializeBuffer. -func (c *LinkLayerDiscovery) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - chassIDLen := c.ChassisID.serializedLen() - portIDLen := c.PortID.serializedLen() - vb, err := b.AppendBytes(chassIDLen + portIDLen + 4) // +4 for TTL - if err != nil { - return err - } - copy(vb[:chassIDLen], c.ChassisID.serialize()) - copy(vb[chassIDLen:], c.PortID.serialize()) - ttlIDLen := uint16(LLDPTLVTTL)<<9 | uint16(2) - binary.BigEndian.PutUint16(vb[chassIDLen+portIDLen:], ttlIDLen) - binary.BigEndian.PutUint16(vb[chassIDLen+portIDLen+2:], c.TTL) - - for _, v := range c.Values { - vb, err := b.AppendBytes(int(v.Length) + 2) // +2 for TLV type and length; 1 byte for subtype is included in v.Value - if err != nil { - return err - } - idLen := ((uint16(v.Type) << 9) | v.Length) - binary.BigEndian.PutUint16(vb[0:2], idLen) - copy(vb[2:], v.Value) - } - - vb, err = b.AppendBytes(2) // End Tlv, 2 bytes - if err != nil { - return err - } - binary.BigEndian.PutUint16(vb[len(vb)-2:], uint16(0)) //End tlv, 2 bytes, all zero - return nil - -} - -func decodeLinkLayerDiscovery(data []byte, p gopacket.PacketBuilder) error { - var vals []LinkLayerDiscoveryValue - vData := data[0:] - for len(vData) > 0 { - if len(vData) < 2 { - p.SetTruncated() - return errors.New("LLDP vdata < 2 bytes") - } - nbit := vData[0] & 0x01 - t := LLDPTLVType(vData[0] >> 1) - val := LinkLayerDiscoveryValue{Type: t, Length: uint16(nbit)<<8 + uint16(vData[1])} - if val.Length > 0 { - if len(vData) < int(val.Length+2) { - p.SetTruncated() - return fmt.Errorf("LLDP VData < %d bytes", val.Length+2) - } - val.Value = vData[2 : val.Length+2] - } - vals = append(vals, val) - if t == LLDPTLVEnd { - break - } - if len(vData) < int(2+val.Length) { - return errors.New("Malformed LinkLayerDiscovery Header") - } - vData = vData[2+val.Length:] - } - if len(vals) < 4 { - return errors.New("Missing mandatory LinkLayerDiscovery TLV") - } - c := &LinkLayerDiscovery{} - gotEnd := false - for _, v := range vals { - switch v.Type { - case LLDPTLVEnd: - gotEnd = true - case LLDPTLVChassisID: - if len(v.Value) < 2 { - return errors.New("Malformed LinkLayerDiscovery ChassisID TLV") - } - c.ChassisID.Subtype = LLDPChassisIDSubType(v.Value[0]) - c.ChassisID.ID = v.Value[1:] - case LLDPTLVPortID: - if len(v.Value) < 2 { - return errors.New("Malformed LinkLayerDiscovery PortID TLV") - } - c.PortID.Subtype = LLDPPortIDSubType(v.Value[0]) - c.PortID.ID = v.Value[1:] - case LLDPTLVTTL: - if len(v.Value) < 2 { - return errors.New("Malformed LinkLayerDiscovery TTL TLV") - } - c.TTL = binary.BigEndian.Uint16(v.Value[0:2]) - default: - c.Values = append(c.Values, v) - } - } - if c.ChassisID.Subtype == 0 || c.PortID.Subtype == 0 || !gotEnd { - return errors.New("Missing mandatory LinkLayerDiscovery TLV") - } - c.Contents = data - p.AddLayer(c) - - info := &LinkLayerDiscoveryInfo{} - p.AddLayer(info) - for _, v := range c.Values { - switch v.Type { - case LLDPTLVPortDescription: - info.PortDescription = string(v.Value) - case LLDPTLVSysName: - info.SysName = string(v.Value) - case LLDPTLVSysDescription: - info.SysDescription = string(v.Value) - case LLDPTLVSysCapabilities: - if err := checkLLDPTLVLen(v, 4); err != nil { - return err - } - info.SysCapabilities.SystemCap = getCapabilities(binary.BigEndian.Uint16(v.Value[0:2])) - info.SysCapabilities.EnabledCap = getCapabilities(binary.BigEndian.Uint16(v.Value[2:4])) - case LLDPTLVMgmtAddress: - if err := checkLLDPTLVLen(v, 9); err != nil { - return err - } - mlen := v.Value[0] - if err := checkLLDPTLVLen(v, int(mlen+7)); err != nil { - return err - } - info.MgmtAddress.Subtype = IANAAddressFamily(v.Value[1]) - info.MgmtAddress.Address = v.Value[2 : mlen+1] - info.MgmtAddress.InterfaceSubtype = LLDPInterfaceSubtype(v.Value[mlen+1]) - info.MgmtAddress.InterfaceNumber = binary.BigEndian.Uint32(v.Value[mlen+2 : mlen+6]) - olen := v.Value[mlen+6] - if err := checkLLDPTLVLen(v, int(mlen+7+olen)); err != nil { - return err - } - info.MgmtAddress.OID = string(v.Value[mlen+7 : mlen+7+olen]) - case LLDPTLVOrgSpecific: - if err := checkLLDPTLVLen(v, 4); err != nil { - return err - } - info.OrgTLVs = append(info.OrgTLVs, LLDPOrgSpecificTLV{IEEEOUI(binary.BigEndian.Uint32(append([]byte{byte(0)}, v.Value[0:3]...))), uint8(v.Value[3]), v.Value[4:]}) - } - } - return nil -} - -func (l *LinkLayerDiscoveryInfo) Decode8021() (info LLDPInfo8021, err error) { - for _, o := range l.OrgTLVs { - if o.OUI != IEEEOUI8021 { - continue - } - switch o.SubType { - case LLDP8021SubtypePortVLANID: - if err = checkLLDPOrgSpecificLen(o, 2); err != nil { - return - } - info.PVID = binary.BigEndian.Uint16(o.Info[0:2]) - case LLDP8021SubtypeProtocolVLANID: - if err = checkLLDPOrgSpecificLen(o, 3); err != nil { - return - } - sup := (o.Info[0]&LLDPProtocolVLANIDCapability > 0) - en := (o.Info[0]&LLDPProtocolVLANIDStatus > 0) - id := binary.BigEndian.Uint16(o.Info[1:3]) - info.PPVIDs = append(info.PPVIDs, PortProtocolVLANID{sup, en, id}) - case LLDP8021SubtypeVLANName: - if err = checkLLDPOrgSpecificLen(o, 2); err != nil { - return - } - id := binary.BigEndian.Uint16(o.Info[0:2]) - info.VLANNames = append(info.VLANNames, VLANName{id, string(o.Info[3:])}) - case LLDP8021SubtypeProtocolIdentity: - if err = checkLLDPOrgSpecificLen(o, 1); err != nil { - return - } - l := int(o.Info[0]) - if l > 0 { - info.ProtocolIdentities = append(info.ProtocolIdentities, o.Info[1:1+l]) - } - case LLDP8021SubtypeVDIUsageDigest: - if err = checkLLDPOrgSpecificLen(o, 4); err != nil { - return - } - info.VIDUsageDigest = binary.BigEndian.Uint32(o.Info[0:4]) - case LLDP8021SubtypeManagementVID: - if err = checkLLDPOrgSpecificLen(o, 2); err != nil { - return - } - info.ManagementVID = binary.BigEndian.Uint16(o.Info[0:2]) - case LLDP8021SubtypeLinkAggregation: - if err = checkLLDPOrgSpecificLen(o, 5); err != nil { - return - } - sup := (o.Info[0]&LLDPAggregationCapability > 0) - en := (o.Info[0]&LLDPAggregationStatus > 0) - info.LinkAggregation = LLDPLinkAggregation{sup, en, binary.BigEndian.Uint32(o.Info[1:5])} - } - } - return -} - -func (l *LinkLayerDiscoveryInfo) Decode8023() (info LLDPInfo8023, err error) { - for _, o := range l.OrgTLVs { - if o.OUI != IEEEOUI8023 { - continue - } - switch o.SubType { - case LLDP8023SubtypeMACPHY: - if err = checkLLDPOrgSpecificLen(o, 5); err != nil { - return - } - sup := (o.Info[0]&LLDPMACPHYCapability > 0) - en := (o.Info[0]&LLDPMACPHYStatus > 0) - ca := binary.BigEndian.Uint16(o.Info[1:3]) - mau := binary.BigEndian.Uint16(o.Info[3:5]) - info.MACPHYConfigStatus = LLDPMACPHYConfigStatus{sup, en, ca, mau} - case LLDP8023SubtypeMDIPower: - if err = checkLLDPOrgSpecificLen(o, 3); err != nil { - return - } - info.PowerViaMDI.PortClassPSE = (o.Info[0]&LLDPMDIPowerPortClass > 0) - info.PowerViaMDI.PSESupported = (o.Info[0]&LLDPMDIPowerCapability > 0) - info.PowerViaMDI.PSEEnabled = (o.Info[0]&LLDPMDIPowerStatus > 0) - info.PowerViaMDI.PSEPairsAbility = (o.Info[0]&LLDPMDIPowerPairsAbility > 0) - info.PowerViaMDI.PSEPowerPair = uint8(o.Info[1]) - info.PowerViaMDI.PSEClass = uint8(o.Info[2]) - if len(o.Info) >= 7 { - info.PowerViaMDI.Type = LLDPPowerType((o.Info[3] & 0xc0) >> 6) - info.PowerViaMDI.Source = LLDPPowerSource((o.Info[3] & 0x30) >> 4) - if info.PowerViaMDI.Type == 1 || info.PowerViaMDI.Type == 3 { - info.PowerViaMDI.Source += 128 // For Stringify purposes - } - info.PowerViaMDI.Priority = LLDPPowerPriority(o.Info[3] & 0x0f) - info.PowerViaMDI.Requested = binary.BigEndian.Uint16(o.Info[4:6]) - info.PowerViaMDI.Allocated = binary.BigEndian.Uint16(o.Info[6:8]) - } - case LLDP8023SubtypeLinkAggregation: - if err = checkLLDPOrgSpecificLen(o, 5); err != nil { - return - } - sup := (o.Info[0]&LLDPAggregationCapability > 0) - en := (o.Info[0]&LLDPAggregationStatus > 0) - info.LinkAggregation = LLDPLinkAggregation{sup, en, binary.BigEndian.Uint32(o.Info[1:5])} - case LLDP8023SubtypeMTU: - if err = checkLLDPOrgSpecificLen(o, 2); err != nil { - return - } - info.MTU = binary.BigEndian.Uint16(o.Info[0:2]) - } - } - return -} - -func (l *LinkLayerDiscoveryInfo) Decode8021Qbg() (info LLDPInfo8021Qbg, err error) { - for _, o := range l.OrgTLVs { - if o.OUI != IEEEOUI8021Qbg { - continue - } - switch o.SubType { - case LLDP8021QbgEVB: - if err = checkLLDPOrgSpecificLen(o, 9); err != nil { - return - } - info.EVBSettings.Supported = getEVBCapabilities(binary.BigEndian.Uint16(o.Info[0:2])) - info.EVBSettings.Enabled = getEVBCapabilities(binary.BigEndian.Uint16(o.Info[2:4])) - info.EVBSettings.SupportedVSIs = binary.BigEndian.Uint16(o.Info[4:6]) - info.EVBSettings.ConfiguredVSIs = binary.BigEndian.Uint16(o.Info[6:8]) - info.EVBSettings.RTEExponent = uint8(o.Info[8]) - } - } - return -} - -func (l *LinkLayerDiscoveryInfo) DecodeMedia() (info LLDPInfoMedia, err error) { - for _, o := range l.OrgTLVs { - if o.OUI != IEEEOUIMedia { - continue - } - switch LLDPMediaSubtype(o.SubType) { - case LLDPMediaTypeCapabilities: - if err = checkLLDPOrgSpecificLen(o, 3); err != nil { - return - } - b := binary.BigEndian.Uint16(o.Info[0:2]) - info.MediaCapabilities.Capabilities = (b & LLDPMediaCapsLLDP) > 0 - info.MediaCapabilities.NetworkPolicy = (b & LLDPMediaCapsNetwork) > 0 - info.MediaCapabilities.Location = (b & LLDPMediaCapsLocation) > 0 - info.MediaCapabilities.PowerPSE = (b & LLDPMediaCapsPowerPSE) > 0 - info.MediaCapabilities.PowerPD = (b & LLDPMediaCapsPowerPD) > 0 - info.MediaCapabilities.Inventory = (b & LLDPMediaCapsInventory) > 0 - info.MediaCapabilities.Class = LLDPMediaClass(o.Info[2]) - case LLDPMediaTypeNetwork: - if err = checkLLDPOrgSpecificLen(o, 4); err != nil { - return - } - info.NetworkPolicy.ApplicationType = LLDPApplicationType(o.Info[0]) - b := binary.BigEndian.Uint16(o.Info[1:3]) - info.NetworkPolicy.Defined = (b & 0x8000) == 0 - info.NetworkPolicy.Tagged = (b & 0x4000) > 0 - info.NetworkPolicy.VLANId = (b & 0x1ffe) >> 1 - b = binary.BigEndian.Uint16(o.Info[2:4]) - info.NetworkPolicy.L2Priority = (b & 0x01c0) >> 6 - info.NetworkPolicy.DSCPValue = uint8(o.Info[3] & 0x3f) - case LLDPMediaTypeLocation: - if err = checkLLDPOrgSpecificLen(o, 1); err != nil { - return - } - info.Location.Format = LLDPLocationFormat(o.Info[0]) - o.Info = o.Info[1:] - switch info.Location.Format { - case LLDPLocationFormatCoordinate: - if err = checkLLDPOrgSpecificLen(o, 16); err != nil { - return - } - info.Location.Coordinate.LatitudeResolution = uint8(o.Info[0]&0xfc) >> 2 - b := binary.BigEndian.Uint64(o.Info[0:8]) - info.Location.Coordinate.Latitude = (b & 0x03ffffffff000000) >> 24 - info.Location.Coordinate.LongitudeResolution = uint8(o.Info[5]&0xfc) >> 2 - b = binary.BigEndian.Uint64(o.Info[5:13]) - info.Location.Coordinate.Longitude = (b & 0x03ffffffff000000) >> 24 - info.Location.Coordinate.AltitudeType = uint8((o.Info[10] & 0x30) >> 4) - b1 := binary.BigEndian.Uint16(o.Info[10:12]) - info.Location.Coordinate.AltitudeResolution = (b1 & 0xfc0) >> 6 - b2 := binary.BigEndian.Uint32(o.Info[11:15]) - info.Location.Coordinate.Altitude = b2 & 0x3fffffff - info.Location.Coordinate.Datum = uint8(o.Info[15]) - case LLDPLocationFormatAddress: - if err = checkLLDPOrgSpecificLen(o, 3); err != nil { - return - } - //ll := uint8(o.Info[0]) - info.Location.Address.What = LLDPLocationAddressWhat(o.Info[1]) - info.Location.Address.CountryCode = string(o.Info[2:4]) - data := o.Info[4:] - for len(data) > 1 { - aType := LLDPLocationAddressType(data[0]) - aLen := int(data[1]) - if len(data) >= aLen+2 { - info.Location.Address.AddressLines = append(info.Location.Address.AddressLines, LLDPLocationAddressLine{aType, string(data[2 : aLen+2])}) - data = data[aLen+2:] - } else { - break - } - } - case LLDPLocationFormatECS: - info.Location.ECS.ELIN = string(o.Info) - } - case LLDPMediaTypePower: - if err = checkLLDPOrgSpecificLen(o, 3); err != nil { - return - } - info.PowerViaMDI.Type = LLDPPowerType((o.Info[0] & 0xc0) >> 6) - info.PowerViaMDI.Source = LLDPPowerSource((o.Info[0] & 0x30) >> 4) - if info.PowerViaMDI.Type == 1 || info.PowerViaMDI.Type == 3 { - info.PowerViaMDI.Source += 128 // For Stringify purposes - } - info.PowerViaMDI.Priority = LLDPPowerPriority(o.Info[0] & 0x0f) - info.PowerViaMDI.Value = binary.BigEndian.Uint16(o.Info[1:3]) * 100 // 0 to 102.3 w, 0.1W increments - case LLDPMediaTypeHardware: - info.HardwareRevision = string(o.Info) - case LLDPMediaTypeFirmware: - info.FirmwareRevision = string(o.Info) - case LLDPMediaTypeSoftware: - info.SoftwareRevision = string(o.Info) - case LLDPMediaTypeSerial: - info.SerialNumber = string(o.Info) - case LLDPMediaTypeManufacturer: - info.Manufacturer = string(o.Info) - case LLDPMediaTypeModel: - info.Model = string(o.Info) - case LLDPMediaTypeAssetID: - info.AssetID = string(o.Info) - } - } - return -} - -func (l *LinkLayerDiscoveryInfo) DecodeCisco2() (info LLDPInfoCisco2, err error) { - for _, o := range l.OrgTLVs { - if o.OUI != IEEEOUICisco2 { - continue - } - switch LLDPCisco2Subtype(o.SubType) { - case LLDPCisco2PowerViaMDI: - if err = checkLLDPOrgSpecificLen(o, 1); err != nil { - return - } - info.PSEFourWirePoESupported = (o.Info[0] & LLDPCiscoPSESupport) > 0 - info.PDSparePairArchitectureShared = (o.Info[0] & LLDPCiscoArchShared) > 0 - info.PDRequestSparePairPoEOn = (o.Info[0] & LLDPCiscoPDSparePair) > 0 - info.PSESparePairPoEOn = (o.Info[0] & LLDPCiscoPSESparePair) > 0 - } - } - return -} - -func (l *LinkLayerDiscoveryInfo) DecodeProfinet() (info LLDPInfoProfinet, err error) { - for _, o := range l.OrgTLVs { - if o.OUI != IEEEOUIProfinet { - continue - } - switch LLDPProfinetSubtype(o.SubType) { - case LLDPProfinetPNIODelay: - if err = checkLLDPOrgSpecificLen(o, 20); err != nil { - return - } - info.PNIODelay.RXLocal = binary.BigEndian.Uint32(o.Info[0:4]) - info.PNIODelay.RXRemote = binary.BigEndian.Uint32(o.Info[4:8]) - info.PNIODelay.TXLocal = binary.BigEndian.Uint32(o.Info[8:12]) - info.PNIODelay.TXRemote = binary.BigEndian.Uint32(o.Info[12:16]) - info.PNIODelay.CableLocal = binary.BigEndian.Uint32(o.Info[16:20]) - case LLDPProfinetPNIOPortStatus: - if err = checkLLDPOrgSpecificLen(o, 4); err != nil { - return - } - info.PNIOPortStatus.Class2 = binary.BigEndian.Uint16(o.Info[0:2]) - info.PNIOPortStatus.Class3 = binary.BigEndian.Uint16(o.Info[2:4]) - case LLDPProfinetPNIOMRPPortStatus: - if err = checkLLDPOrgSpecificLen(o, 18); err != nil { - return - } - info.PNIOMRPPortStatus.UUID = o.Info[0:16] - info.PNIOMRPPortStatus.Status = binary.BigEndian.Uint16(o.Info[16:18]) - case LLDPProfinetPNIOChassisMAC: - if err = checkLLDPOrgSpecificLen(o, 6); err != nil { - return - } - info.ChassisMAC = o.Info[0:6] - case LLDPProfinetPNIOPTCPStatus: - if err = checkLLDPOrgSpecificLen(o, 54); err != nil { - return - } - info.PNIOPTCPStatus.MasterAddress = o.Info[0:6] - info.PNIOPTCPStatus.SubdomainUUID = o.Info[6:22] - info.PNIOPTCPStatus.IRDataUUID = o.Info[22:38] - b := binary.BigEndian.Uint32(o.Info[38:42]) - info.PNIOPTCPStatus.PeriodValid = (b & 0x80000000) > 0 - info.PNIOPTCPStatus.PeriodLength = b & 0x7fffffff - b = binary.BigEndian.Uint32(o.Info[42:46]) - info.PNIOPTCPStatus.RedPeriodValid = (b & 0x80000000) > 0 - info.PNIOPTCPStatus.RedPeriodBegin = b & 0x7fffffff - b = binary.BigEndian.Uint32(o.Info[46:50]) - info.PNIOPTCPStatus.OrangePeriodValid = (b & 0x80000000) > 0 - info.PNIOPTCPStatus.OrangePeriodBegin = b & 0x7fffffff - b = binary.BigEndian.Uint32(o.Info[50:54]) - info.PNIOPTCPStatus.GreenPeriodValid = (b & 0x80000000) > 0 - info.PNIOPTCPStatus.GreenPeriodBegin = b & 0x7fffffff - } - } - return -} - -// LayerType returns gopacket.LayerTypeLinkLayerDiscoveryInfo. -func (c *LinkLayerDiscoveryInfo) LayerType() gopacket.LayerType { - return LayerTypeLinkLayerDiscoveryInfo -} - -func getCapabilities(v uint16) (c LLDPCapabilities) { - c.Other = (v&LLDPCapsOther > 0) - c.Repeater = (v&LLDPCapsRepeater > 0) - c.Bridge = (v&LLDPCapsBridge > 0) - c.WLANAP = (v&LLDPCapsWLANAP > 0) - c.Router = (v&LLDPCapsRouter > 0) - c.Phone = (v&LLDPCapsPhone > 0) - c.DocSis = (v&LLDPCapsDocSis > 0) - c.StationOnly = (v&LLDPCapsStationOnly > 0) - c.CVLAN = (v&LLDPCapsCVLAN > 0) - c.SVLAN = (v&LLDPCapsSVLAN > 0) - c.TMPR = (v&LLDPCapsTmpr > 0) - return -} - -func getEVBCapabilities(v uint16) (c LLDPEVBCapabilities) { - c.StandardBridging = (v & LLDPEVBCapsSTD) > 0 - c.StandardBridging = (v & LLDPEVBCapsSTD) > 0 - c.ReflectiveRelay = (v & LLDPEVBCapsRR) > 0 - c.RetransmissionTimerExponent = (v & LLDPEVBCapsRTE) > 0 - c.EdgeControlProtocol = (v & LLDPEVBCapsECP) > 0 - c.VSIDiscoveryProtocol = (v & LLDPEVBCapsVDP) > 0 - return -} - -func (t LLDPTLVType) String() (s string) { - switch t { - case LLDPTLVEnd: - s = "TLV End" - case LLDPTLVChassisID: - s = "Chassis ID" - case LLDPTLVPortID: - s = "Port ID" - case LLDPTLVTTL: - s = "TTL" - case LLDPTLVPortDescription: - s = "Port Description" - case LLDPTLVSysName: - s = "System Name" - case LLDPTLVSysDescription: - s = "System Description" - case LLDPTLVSysCapabilities: - s = "System Capabilities" - case LLDPTLVMgmtAddress: - s = "Management Address" - case LLDPTLVOrgSpecific: - s = "Organisation Specific" - default: - s = "Unknown" - } - return -} - -func (t LLDPChassisIDSubType) String() (s string) { - switch t { - case LLDPChassisIDSubTypeReserved: - s = "Reserved" - case LLDPChassisIDSubTypeChassisComp: - s = "Chassis Component" - case LLDPChassisIDSubtypeIfaceAlias: - s = "Interface Alias" - case LLDPChassisIDSubTypePortComp: - s = "Port Component" - case LLDPChassisIDSubTypeMACAddr: - s = "MAC Address" - case LLDPChassisIDSubTypeNetworkAddr: - s = "Network Address" - case LLDPChassisIDSubtypeIfaceName: - s = "Interface Name" - case LLDPChassisIDSubTypeLocal: - s = "Local" - default: - s = "Unknown" - } - return -} - -func (t LLDPPortIDSubType) String() (s string) { - switch t { - case LLDPPortIDSubtypeReserved: - s = "Reserved" - case LLDPPortIDSubtypeIfaceAlias: - s = "Interface Alias" - case LLDPPortIDSubtypePortComp: - s = "Port Component" - case LLDPPortIDSubtypeMACAddr: - s = "MAC Address" - case LLDPPortIDSubtypeNetworkAddr: - s = "Network Address" - case LLDPPortIDSubtypeIfaceName: - s = "Interface Name" - case LLDPPortIDSubtypeAgentCircuitID: - s = "Agent Circuit ID" - case LLDPPortIDSubtypeLocal: - s = "Local" - default: - s = "Unknown" - } - return -} - -func (t IANAAddressFamily) String() (s string) { - switch t { - case IANAAddressFamilyReserved: - s = "Reserved" - case IANAAddressFamilyIPV4: - s = "IPv4" - case IANAAddressFamilyIPV6: - s = "IPv6" - case IANAAddressFamilyNSAP: - s = "NSAP" - case IANAAddressFamilyHDLC: - s = "HDLC" - case IANAAddressFamilyBBN1822: - s = "BBN 1822" - case IANAAddressFamily802: - s = "802 media plus Ethernet 'canonical format'" - case IANAAddressFamilyE163: - s = "E.163" - case IANAAddressFamilyE164: - s = "E.164 (SMDS, Frame Relay, ATM)" - case IANAAddressFamilyF69: - s = "F.69 (Telex)" - case IANAAddressFamilyX121: - s = "X.121, X.25, Frame Relay" - case IANAAddressFamilyIPX: - s = "IPX" - case IANAAddressFamilyAtalk: - s = "Appletalk" - case IANAAddressFamilyDecnet: - s = "Decnet IV" - case IANAAddressFamilyBanyan: - s = "Banyan Vines" - case IANAAddressFamilyE164NSAP: - s = "E.164 with NSAP format subaddress" - case IANAAddressFamilyDNS: - s = "DNS" - case IANAAddressFamilyDistname: - s = "Distinguished Name" - case IANAAddressFamilyASNumber: - s = "AS Number" - case IANAAddressFamilyXTPIPV4: - s = "XTP over IP version 4" - case IANAAddressFamilyXTPIPV6: - s = "XTP over IP version 6" - case IANAAddressFamilyXTP: - s = "XTP native mode XTP" - case IANAAddressFamilyFcWWPN: - s = "Fibre Channel World-Wide Port Name" - case IANAAddressFamilyFcWWNN: - s = "Fibre Channel World-Wide Node Name" - case IANAAddressFamilyGWID: - s = "GWID" - case IANAAddressFamilyL2VPN: - s = "AFI for Layer 2 VPN" - default: - s = "Unknown" - } - return -} - -func (t LLDPInterfaceSubtype) String() (s string) { - switch t { - case LLDPInterfaceSubtypeUnknown: - s = "Unknown" - case LLDPInterfaceSubtypeifIndex: - s = "IfIndex" - case LLDPInterfaceSubtypeSysPort: - s = "System Port Number" - default: - s = "Unknown" - } - return -} - -func (t LLDPPowerType) String() (s string) { - switch t { - case 0: - s = "Type 2 PSE Device" - case 1: - s = "Type 2 PD Device" - case 2: - s = "Type 1 PSE Device" - case 3: - s = "Type 1 PD Device" - default: - s = "Unknown" - } - return -} - -func (t LLDPPowerSource) String() (s string) { - switch t { - // PD Device - case 0: - s = "Unknown" - case 1: - s = "PSE" - case 2: - s = "Local" - case 3: - s = "PSE and Local" - // PSE Device (Actual value + 128) - case 128: - s = "Unknown" - case 129: - s = "Primary Power Source" - case 130: - s = "Backup Power Source" - default: - s = "Unknown" - } - return -} - -func (t LLDPPowerPriority) String() (s string) { - switch t { - case 0: - s = "Unknown" - case 1: - s = "Critical" - case 2: - s = "High" - case 3: - s = "Low" - default: - s = "Unknown" - } - return -} - -func (t LLDPMediaSubtype) String() (s string) { - switch t { - case LLDPMediaTypeCapabilities: - s = "Media Capabilities " - case LLDPMediaTypeNetwork: - s = "Network Policy" - case LLDPMediaTypeLocation: - s = "Location Identification" - case LLDPMediaTypePower: - s = "Extended Power-via-MDI" - case LLDPMediaTypeHardware: - s = "Hardware Revision" - case LLDPMediaTypeFirmware: - s = "Firmware Revision" - case LLDPMediaTypeSoftware: - s = "Software Revision" - case LLDPMediaTypeSerial: - s = "Serial Number" - case LLDPMediaTypeManufacturer: - s = "Manufacturer" - case LLDPMediaTypeModel: - s = "Model" - case LLDPMediaTypeAssetID: - s = "Asset ID" - default: - s = "Unknown" - } - return -} - -func (t LLDPMediaClass) String() (s string) { - switch t { - case LLDPMediaClassUndefined: - s = "Undefined" - case LLDPMediaClassEndpointI: - s = "Endpoint Class I" - case LLDPMediaClassEndpointII: - s = "Endpoint Class II" - case LLDPMediaClassEndpointIII: - s = "Endpoint Class III" - case LLDPMediaClassNetwork: - s = "Network connectivity " - default: - s = "Unknown" - } - return -} - -func (t LLDPApplicationType) String() (s string) { - switch t { - case LLDPAppTypeReserved: - s = "Reserved" - case LLDPAppTypeVoice: - s = "Voice" - case LLDPappTypeVoiceSignaling: - s = "Voice Signaling" - case LLDPappTypeGuestVoice: - s = "Guest Voice" - case LLDPappTypeGuestVoiceSignaling: - s = "Guest Voice Signaling" - case LLDPappTypeSoftphoneVoice: - s = "Softphone Voice" - case LLDPappTypeVideoConferencing: - s = "Video Conferencing" - case LLDPappTypeStreamingVideo: - s = "Streaming Video" - case LLDPappTypeVideoSignaling: - s = "Video Signaling" - default: - s = "Unknown" - } - return -} - -func (t LLDPLocationFormat) String() (s string) { - switch t { - case LLDPLocationFormatInvalid: - s = "Invalid" - case LLDPLocationFormatCoordinate: - s = "Coordinate-based LCI" - case LLDPLocationFormatAddress: - s = "Address-based LCO" - case LLDPLocationFormatECS: - s = "ECS ELIN" - default: - s = "Unknown" - } - return -} - -func (t LLDPLocationAddressType) String() (s string) { - switch t { - case LLDPLocationAddressTypeLanguage: - s = "Language" - case LLDPLocationAddressTypeNational: - s = "National subdivisions (province, state, etc)" - case LLDPLocationAddressTypeCounty: - s = "County, parish, district" - case LLDPLocationAddressTypeCity: - s = "City, township" - case LLDPLocationAddressTypeCityDivision: - s = "City division, borough, ward" - case LLDPLocationAddressTypeNeighborhood: - s = "Neighborhood, block" - case LLDPLocationAddressTypeStreet: - s = "Street" - case LLDPLocationAddressTypeLeadingStreet: - s = "Leading street direction" - case LLDPLocationAddressTypeTrailingStreet: - s = "Trailing street suffix" - case LLDPLocationAddressTypeStreetSuffix: - s = "Street suffix" - case LLDPLocationAddressTypeHouseNum: - s = "House number" - case LLDPLocationAddressTypeHouseSuffix: - s = "House number suffix" - case LLDPLocationAddressTypeLandmark: - s = "Landmark or vanity address" - case LLDPLocationAddressTypeAdditional: - s = "Additional location information" - case LLDPLocationAddressTypeName: - s = "Name" - case LLDPLocationAddressTypePostal: - s = "Postal/ZIP code" - case LLDPLocationAddressTypeBuilding: - s = "Building" - case LLDPLocationAddressTypeUnit: - s = "Unit" - case LLDPLocationAddressTypeFloor: - s = "Floor" - case LLDPLocationAddressTypeRoom: - s = "Room number" - case LLDPLocationAddressTypePlace: - s = "Place type" - case LLDPLocationAddressTypeScript: - s = "Script" - default: - s = "Unknown" - } - return -} - -func checkLLDPTLVLen(v LinkLayerDiscoveryValue, l int) (err error) { - if len(v.Value) < l { - err = fmt.Errorf("Invalid TLV %v length %d (wanted mimimum %v", v.Type, len(v.Value), l) - } - return -} - -func checkLLDPOrgSpecificLen(o LLDPOrgSpecificTLV, l int) (err error) { - if len(o.Info) < l { - err = fmt.Errorf("Invalid Org Specific TLV %v length %d (wanted minimum %v)", o.SubType, len(o.Info), l) - } - return -} diff --git a/vendor/github.com/google/gopacket/layers/loopback.go b/vendor/github.com/google/gopacket/layers/loopback.go deleted file mode 100644 index 839f76073..000000000 --- a/vendor/github.com/google/gopacket/layers/loopback.go +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - "fmt" - - "github.com/google/gopacket" -) - -// Loopback contains the header for loopback encapsulation. This header is -// used by both BSD and OpenBSD style loopback decoding (pcap's DLT_NULL -// and DLT_LOOP, respectively). -type Loopback struct { - BaseLayer - Family ProtocolFamily -} - -// LayerType returns LayerTypeLoopback. -func (l *Loopback) LayerType() gopacket.LayerType { return LayerTypeLoopback } - -// DecodeFromBytes decodes the given bytes into this layer. -func (l *Loopback) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 4 { - return errors.New("Loopback packet too small") - } - - // The protocol could be either big-endian or little-endian, we're - // not sure. But we're PRETTY sure that the value is less than - // 256, so we can check the first two bytes. - var prot uint32 - if data[0] == 0 && data[1] == 0 { - prot = binary.BigEndian.Uint32(data[:4]) - } else { - prot = binary.LittleEndian.Uint32(data[:4]) - } - if prot > 0xFF { - return fmt.Errorf("Invalid loopback protocol %q", data[:4]) - } - - l.Family = ProtocolFamily(prot) - l.BaseLayer = BaseLayer{data[:4], data[4:]} - return nil -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (l *Loopback) CanDecode() gopacket.LayerClass { - return LayerTypeLoopback -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (l *Loopback) NextLayerType() gopacket.LayerType { - return l.Family.LayerType() -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -func (l *Loopback) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - bytes, err := b.PrependBytes(4) - if err != nil { - return err - } - binary.LittleEndian.PutUint32(bytes, uint32(l.Family)) - return nil -} - -func decodeLoopback(data []byte, p gopacket.PacketBuilder) error { - l := Loopback{} - if err := l.DecodeFromBytes(data, gopacket.NilDecodeFeedback); err != nil { - return err - } - p.AddLayer(&l) - return p.NextDecoder(l.Family) -} diff --git a/vendor/github.com/google/gopacket/layers/mldv1.go b/vendor/github.com/google/gopacket/layers/mldv1.go deleted file mode 100644 index e1bb1dc00..000000000 --- a/vendor/github.com/google/gopacket/layers/mldv1.go +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright 2018 GoPacket Authors. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - "fmt" - "math" - "net" - "time" - - "github.com/google/gopacket" -) - -// MLDv1Message represents the common structure of all MLDv1 messages -type MLDv1Message struct { - BaseLayer - // 3.4. Maximum Response Delay - MaximumResponseDelay time.Duration - // 3.6. Multicast Address - // Zero in general query - // Specific IPv6 multicast address otherwise - MulticastAddress net.IP -} - -// DecodeFromBytes decodes the given bytes into this layer. -func (m *MLDv1Message) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 20 { - df.SetTruncated() - return errors.New("ICMP layer less than 20 bytes for Multicast Listener Query Message V1") - } - - m.MaximumResponseDelay = time.Duration(binary.BigEndian.Uint16(data[0:2])) * time.Millisecond - // data[2:4] is reserved and not used in mldv1 - m.MulticastAddress = data[4:20] - - return nil -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (*MLDv1Message) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypeZero -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (m *MLDv1Message) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - buf, err := b.PrependBytes(20) - if err != nil { - return err - } - - if m.MaximumResponseDelay < 0 { - return errors.New("maximum response delay must not be negative") - } - dms := m.MaximumResponseDelay / time.Millisecond - if dms > math.MaxUint16 { - return fmt.Errorf("maximum response delay %dms is more than the allowed 65535ms", dms) - } - binary.BigEndian.PutUint16(buf[0:2], uint16(dms)) - - copy(buf[2:4], []byte{0x0, 0x0}) - - ma16 := m.MulticastAddress.To16() - if ma16 == nil { - return fmt.Errorf("invalid multicast address '%s'", m.MulticastAddress) - } - copy(buf[4:20], ma16) - - return nil -} - -// Sums this layer up nicely formatted -func (m *MLDv1Message) String() string { - return fmt.Sprintf( - "Maximum Response Delay: %dms, Multicast Address: %s", - m.MaximumResponseDelay/time.Millisecond, - m.MulticastAddress) -} - -// MLDv1MulticastListenerQueryMessage are sent by the router to determine -// whether there are multicast listeners on the link. -// https://tools.ietf.org/html/rfc2710 Page 5 -type MLDv1MulticastListenerQueryMessage struct { - MLDv1Message -} - -// DecodeFromBytes decodes the given bytes into this layer. -func (m *MLDv1MulticastListenerQueryMessage) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - err := m.MLDv1Message.DecodeFromBytes(data, df) - if err != nil { - return err - } - - if len(data) > 20 { - m.Payload = data[20:] - } - - return nil -} - -// LayerType returns LayerTypeMLDv1MulticastListenerQuery. -func (*MLDv1MulticastListenerQueryMessage) LayerType() gopacket.LayerType { - return LayerTypeMLDv1MulticastListenerQuery -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (*MLDv1MulticastListenerQueryMessage) CanDecode() gopacket.LayerClass { - return LayerTypeMLDv1MulticastListenerQuery -} - -// IsGeneralQuery is true when this is a general query. -// In a Query message, the Multicast Address field is set to zero when -// sending a General Query. -// https://tools.ietf.org/html/rfc2710#section-3.6 -func (m *MLDv1MulticastListenerQueryMessage) IsGeneralQuery() bool { - return net.IPv6zero.Equal(m.MulticastAddress) -} - -// IsSpecificQuery is true when this is not a general query. -// In a Query message, the Multicast Address field is set to a specific -// IPv6 multicast address when sending a Multicast-Address-Specific Query. -// https://tools.ietf.org/html/rfc2710#section-3.6 -func (m *MLDv1MulticastListenerQueryMessage) IsSpecificQuery() bool { - return !m.IsGeneralQuery() -} - -// MLDv1MulticastListenerReportMessage is sent by a client listening on -// a specific multicast address to indicate that it is (still) listening -// on the specific multicast address. -// https://tools.ietf.org/html/rfc2710 Page 6 -type MLDv1MulticastListenerReportMessage struct { - MLDv1Message -} - -// LayerType returns LayerTypeMLDv1MulticastListenerReport. -func (*MLDv1MulticastListenerReportMessage) LayerType() gopacket.LayerType { - return LayerTypeMLDv1MulticastListenerReport -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (*MLDv1MulticastListenerReportMessage) CanDecode() gopacket.LayerClass { - return LayerTypeMLDv1MulticastListenerReport -} - -// MLDv1MulticastListenerDoneMessage should be sent by a client when it ceases -// to listen to a multicast address on an interface. -// https://tools.ietf.org/html/rfc2710 Page 7 -type MLDv1MulticastListenerDoneMessage struct { - MLDv1Message -} - -// LayerType returns LayerTypeMLDv1MulticastListenerDone. -func (*MLDv1MulticastListenerDoneMessage) LayerType() gopacket.LayerType { - return LayerTypeMLDv1MulticastListenerDone -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (*MLDv1MulticastListenerDoneMessage) CanDecode() gopacket.LayerClass { - return LayerTypeMLDv1MulticastListenerDone -} - -func decodeMLDv1MulticastListenerReport(data []byte, p gopacket.PacketBuilder) error { - m := &MLDv1MulticastListenerReportMessage{} - return decodingLayerDecoder(m, data, p) -} - -func decodeMLDv1MulticastListenerQuery(data []byte, p gopacket.PacketBuilder) error { - m := &MLDv1MulticastListenerQueryMessage{} - return decodingLayerDecoder(m, data, p) -} - -func decodeMLDv1MulticastListenerDone(data []byte, p gopacket.PacketBuilder) error { - m := &MLDv1MulticastListenerDoneMessage{} - return decodingLayerDecoder(m, data, p) -} diff --git a/vendor/github.com/google/gopacket/layers/mldv2.go b/vendor/github.com/google/gopacket/layers/mldv2.go deleted file mode 100644 index 05100a52d..000000000 --- a/vendor/github.com/google/gopacket/layers/mldv2.go +++ /dev/null @@ -1,619 +0,0 @@ -// Copyright 2018 GoPacket Authors. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - "fmt" - "math" - "net" - "time" - - "github.com/google/gopacket" -) - -const ( - // S Flag bit is 1 - mldv2STrue uint8 = 0x8 - - // S Flag value mask - // mldv2STrue & mldv2SMask == mldv2STrue // true - // 0x1 & mldv2SMask == mldv2STrue // true - // 0x0 & mldv2SMask == mldv2STrue // false - mldv2SMask uint8 = 0x8 - - // QRV value mask - mldv2QRVMask uint8 = 0x7 -) - -// MLDv2MulticastListenerQueryMessage are sent by multicast routers to query the -// multicast listening state of neighboring interfaces. -// https://tools.ietf.org/html/rfc3810#section-5.1 -// -// Some information, like Maximum Response Code and Multicast Address are in the -// previous layer LayerTypeMLDv1MulticastListenerQuery -type MLDv2MulticastListenerQueryMessage struct { - BaseLayer - // 5.1.3. Maximum Response Delay COde - MaximumResponseCode uint16 - // 5.1.5. Multicast Address - // Zero in general query - // Specific IPv6 multicast address otherwise - MulticastAddress net.IP - // 5.1.7. S Flag (Suppress Router-Side Processing) - SuppressRoutersideProcessing bool - // 5.1.8. QRV (Querier's Robustness Variable) - QueriersRobustnessVariable uint8 - // 5.1.9. QQIC (Querier's Query Interval Code) - QueriersQueryIntervalCode uint8 - // 5.1.10. Number of Sources (N) - NumberOfSources uint16 - // 5.1.11 Source Address [i] - SourceAddresses []net.IP -} - -// DecodeFromBytes decodes the given bytes into this layer. -func (m *MLDv2MulticastListenerQueryMessage) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 24 { - df.SetTruncated() - return errors.New("ICMP layer less than 24 bytes for Multicast Listener Query Message V2") - } - - m.MaximumResponseCode = binary.BigEndian.Uint16(data[0:2]) - // ignore data[2:4] as per https://tools.ietf.org/html/rfc3810#section-5.1.4 - m.MulticastAddress = data[4:20] - m.SuppressRoutersideProcessing = (data[20] & mldv2SMask) == mldv2STrue - m.QueriersRobustnessVariable = data[20] & mldv2QRVMask - m.QueriersQueryIntervalCode = data[21] - - m.NumberOfSources = binary.BigEndian.Uint16(data[22:24]) - - var end int - for i := uint16(0); i < m.NumberOfSources; i++ { - begin := 24 + (int(i) * 16) - end = begin + 16 - - if end > len(data) { - df.SetTruncated() - return fmt.Errorf("ICMP layer less than %d bytes for Multicast Listener Query Message V2", end) - } - - m.SourceAddresses = append(m.SourceAddresses, data[begin:end]) - } - - return nil -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (*MLDv2MulticastListenerQueryMessage) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypeZero -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (m *MLDv2MulticastListenerQueryMessage) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - if err := m.serializeSourceAddressesTo(b, opts); err != nil { - return err - } - - buf, err := b.PrependBytes(24) - if err != nil { - return err - } - - binary.BigEndian.PutUint16(buf[0:2], m.MaximumResponseCode) - copy(buf[2:4], []byte{0x00, 0x00}) // set reserved bytes to zero - - ma16 := m.MulticastAddress.To16() - if ma16 == nil { - return fmt.Errorf("invalid MulticastAddress '%s'", m.MulticastAddress) - } - copy(buf[4:20], ma16) - - byte20 := m.QueriersRobustnessVariable & mldv2QRVMask - if m.SuppressRoutersideProcessing { - byte20 |= mldv2STrue - } else { - byte20 &= ^mldv2STrue // the complement of mldv2STrue - } - byte20 &= 0x0F // set reserved bits to zero - buf[20] = byte20 - - binary.BigEndian.PutUint16(buf[22:24], m.NumberOfSources) - buf[21] = m.QueriersQueryIntervalCode - - return nil -} - -// writes each source address to the buffer preserving the order -func (m *MLDv2MulticastListenerQueryMessage) serializeSourceAddressesTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - numberOfSourceAddresses := len(m.SourceAddresses) - if numberOfSourceAddresses > math.MaxUint16 { - return fmt.Errorf( - "there are more than %d source addresses, but 65535 is the maximum number of supported addresses", - numberOfSourceAddresses) - } - - if opts.FixLengths { - m.NumberOfSources = uint16(numberOfSourceAddresses) - } - - lastSAIdx := numberOfSourceAddresses - 1 - for k := range m.SourceAddresses { - i := lastSAIdx - k // reverse order - - buf, err := b.PrependBytes(16) - if err != nil { - return err - } - - sa16 := m.SourceAddresses[i].To16() - if sa16 == nil { - return fmt.Errorf("invalid source address [%d] '%s'", i, m.SourceAddresses[i]) - } - copy(buf[0:16], sa16) - } - - return nil -} - -// String sums this layer up nicely formatted -func (m *MLDv2MulticastListenerQueryMessage) String() string { - return fmt.Sprintf( - "Maximum Response Code: %#x (%dms), Multicast Address: %s, Suppress Routerside Processing: %t, QRV: %#x, QQIC: %#x (%ds), Number of Source Address: %d (actual: %d), Source Addresses: %s", - m.MaximumResponseCode, - m.MaximumResponseDelay(), - m.MulticastAddress, - m.SuppressRoutersideProcessing, - m.QueriersRobustnessVariable, - m.QueriersQueryIntervalCode, - m.QQI()/time.Second, - m.NumberOfSources, - len(m.SourceAddresses), - m.SourceAddresses) -} - -// LayerType returns LayerTypeMLDv2MulticastListenerQuery. -func (*MLDv2MulticastListenerQueryMessage) LayerType() gopacket.LayerType { - return LayerTypeMLDv2MulticastListenerQuery -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (*MLDv2MulticastListenerQueryMessage) CanDecode() gopacket.LayerClass { - return LayerTypeMLDv2MulticastListenerQuery -} - -// QQI calculates the Querier's Query Interval based on the QQIC -// according to https://tools.ietf.org/html/rfc3810#section-5.1.9 -func (m *MLDv2MulticastListenerQueryMessage) QQI() time.Duration { - data := m.QueriersQueryIntervalCode - if data < 128 { - return time.Second * time.Duration(data) - } - - exp := uint16(data) & 0x70 >> 4 - mant := uint16(data) & 0x0F - return time.Second * time.Duration(mant|0x1000<<(exp+3)) -} - -// SetQQI calculates and updates the Querier's Query Interval Code (QQIC) -// according to https://tools.ietf.org/html/rfc3810#section-5.1.9 -func (m *MLDv2MulticastListenerQueryMessage) SetQQI(d time.Duration) error { - if d < 0 { - m.QueriersQueryIntervalCode = 0 - return errors.New("QQI duration is negative") - } - - if d == 0 { - m.QueriersQueryIntervalCode = 0 - return nil - } - - dms := d / time.Second - if dms < 128 { - m.QueriersQueryIntervalCode = uint8(dms) - } - - if dms > 31744 { // mant=0xF, exp=0x7 - m.QueriersQueryIntervalCode = 0xFF - return fmt.Errorf("QQI duration %ds is, maximum allowed is 31744s", dms) - } - - value := uint16(dms) // ok, because 31744 < math.MaxUint16 - exp := uint8(7) - for mask := uint16(0x4000); exp > 0; exp-- { - if mask&value != 0 { - break - } - - mask >>= 1 - } - - mant := uint8(0x000F & (value >> (exp + 3))) - sig := uint8(0x10) - m.QueriersQueryIntervalCode = sig | exp<<4 | mant - - return nil -} - -// MaximumResponseDelay returns the Maximum Response Delay based on the -// Maximum Response Code according to -// https://tools.ietf.org/html/rfc3810#section-5.1.3 -func (m *MLDv2MulticastListenerQueryMessage) MaximumResponseDelay() time.Duration { - if m.MaximumResponseCode < 0x8000 { - return time.Duration(m.MaximumResponseCode) - } - - exp := m.MaximumResponseCode & 0x7000 >> 12 - mant := m.MaximumResponseCode & 0x0FFF - - return time.Millisecond * time.Duration(mant|0x1000<<(exp+3)) -} - -// SetMLDv2MaximumResponseDelay updates the Maximum Response Code according to -// https://tools.ietf.org/html/rfc3810#section-5.1.3 -func (m *MLDv2MulticastListenerQueryMessage) SetMLDv2MaximumResponseDelay(d time.Duration) error { - if d == 0 { - m.MaximumResponseCode = 0 - return nil - } - - if d < 0 { - return errors.New("maximum response delay must not be negative") - } - - dms := d / time.Millisecond - - if dms < 32768 { - m.MaximumResponseCode = uint16(dms) - } - - if dms > 4193280 { // mant=0xFFF, exp=0x7 - return fmt.Errorf("maximum response delay %dms is bigger the than maximum of 4193280ms", dms) - } - - value := uint32(dms) // ok, because 4193280 < math.MaxUint32 - exp := uint8(7) - for mask := uint32(0x40000000); exp > 0; exp-- { - if mask&value != 0 { - break - } - - mask >>= 1 - } - - mant := uint16(0x00000FFF & (value >> (exp + 3))) - sig := uint16(0x1000) - m.MaximumResponseCode = sig | uint16(exp)<<12 | mant - return nil -} - -// MLDv2MulticastListenerReportMessage is sent by an IP node to report the -// current multicast listening state, or changes therein. -// https://tools.ietf.org/html/rfc3810#section-5.2 -type MLDv2MulticastListenerReportMessage struct { - BaseLayer - // 5.2.3. Nr of Mcast Address Records - NumberOfMulticastAddressRecords uint16 - // 5.2.4. Multicast Address Record [i] - MulticastAddressRecords []MLDv2MulticastAddressRecord -} - -// DecodeFromBytes decodes the given bytes into this layer. -func (m *MLDv2MulticastListenerReportMessage) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 4 { - df.SetTruncated() - return errors.New("ICMP layer less than 4 bytes for Multicast Listener Report Message V2") - } - - // ignore data[0:2] as per RFC - // https://tools.ietf.org/html/rfc3810#section-5.2.1 - m.NumberOfMulticastAddressRecords = binary.BigEndian.Uint16(data[2:4]) - - begin := 4 - for i := uint16(0); i < m.NumberOfMulticastAddressRecords; i++ { - mar := MLDv2MulticastAddressRecord{} - read, err := mar.decode(data[begin:], df) - if err != nil { - return err - } - - m.MulticastAddressRecords = append(m.MulticastAddressRecords, mar) - - begin += read - } - - return nil -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (m *MLDv2MulticastListenerReportMessage) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - lastItemIdx := len(m.MulticastAddressRecords) - 1 - for k := range m.MulticastAddressRecords { - i := lastItemIdx - k // reverse order - - err := m.MulticastAddressRecords[i].serializeTo(b, opts) - if err != nil { - return err - } - } - - if opts.FixLengths { - numberOfMAR := len(m.MulticastAddressRecords) - if numberOfMAR > math.MaxUint16 { - return fmt.Errorf( - "%d multicast address records added, but the maximum is 65535", - numberOfMAR) - } - - m.NumberOfMulticastAddressRecords = uint16(numberOfMAR) - } - - buf, err := b.PrependBytes(4) - if err != nil { - return err - } - - copy(buf[0:2], []byte{0x0, 0x0}) - binary.BigEndian.PutUint16(buf[2:4], m.NumberOfMulticastAddressRecords) - return nil -} - -// Sums this layer up nicely formatted -func (m *MLDv2MulticastListenerReportMessage) String() string { - return fmt.Sprintf( - "Number of Mcast Addr Records: %d (actual %d), Multicast Address Records: %+v", - m.NumberOfMulticastAddressRecords, - len(m.MulticastAddressRecords), - m.MulticastAddressRecords) -} - -// LayerType returns LayerTypeMLDv2MulticastListenerQuery. -func (*MLDv2MulticastListenerReportMessage) LayerType() gopacket.LayerType { - return LayerTypeMLDv2MulticastListenerReport -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (*MLDv2MulticastListenerReportMessage) CanDecode() gopacket.LayerClass { - return LayerTypeMLDv2MulticastListenerReport -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (*MLDv2MulticastListenerReportMessage) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypePayload -} - -// MLDv2MulticastAddressRecordType holds the type of a -// Multicast Address Record, according to -// https://tools.ietf.org/html/rfc3810#section-5.2.5 and -// https://tools.ietf.org/html/rfc3810#section-5.2.12 -type MLDv2MulticastAddressRecordType uint8 - -const ( - // MLDv2MulticastAddressRecordTypeModeIsIncluded stands for - // MODE_IS_INCLUDE - indicates that the interface has a filter - // mode of INCLUDE for the specified multicast address. - MLDv2MulticastAddressRecordTypeModeIsIncluded MLDv2MulticastAddressRecordType = 1 - // MLDv2MulticastAddressRecordTypeModeIsExcluded stands for - // MODE_IS_EXCLUDE - indicates that the interface has a filter - // mode of EXCLUDE for the specified multicast address. - MLDv2MulticastAddressRecordTypeModeIsExcluded MLDv2MulticastAddressRecordType = 2 - // MLDv2MulticastAddressRecordTypeChangeToIncludeMode stands for - // CHANGE_TO_INCLUDE_MODE - indicates that the interface has - // changed to INCLUDE filter mode for the specified multicast - // address. - MLDv2MulticastAddressRecordTypeChangeToIncludeMode MLDv2MulticastAddressRecordType = 3 - // MLDv2MulticastAddressRecordTypeChangeToExcludeMode stands for - // CHANGE_TO_EXCLUDE_MODE - indicates that the interface has - // changed to EXCLUDE filter mode for the specified multicast - // address - MLDv2MulticastAddressRecordTypeChangeToExcludeMode MLDv2MulticastAddressRecordType = 4 - // MLDv2MulticastAddressRecordTypeAllowNewSources stands for - // ALLOW_NEW_SOURCES - indicates that the Source Address [i] - // fields in this Multicast Address Record contain a list of - // the additional sources that the node wishes to listen to, - // for packets sent to the specified multicast address. - MLDv2MulticastAddressRecordTypeAllowNewSources MLDv2MulticastAddressRecordType = 5 - // MLDv2MulticastAddressRecordTypeBlockOldSources stands for - // BLOCK_OLD_SOURCES - indicates that the Source Address [i] - // fields in this Multicast Address Record contain a list of - // the sources that the node no longer wishes to listen to, - // for packets sent to the specified multicast address. - MLDv2MulticastAddressRecordTypeBlockOldSources MLDv2MulticastAddressRecordType = 6 -) - -// Human readable record types -// Naming follows https://tools.ietf.org/html/rfc3810#section-5.2.12 -func (m MLDv2MulticastAddressRecordType) String() string { - switch m { - case MLDv2MulticastAddressRecordTypeModeIsIncluded: - return "MODE_IS_INCLUDE" - case MLDv2MulticastAddressRecordTypeModeIsExcluded: - return "MODE_IS_EXCLUDE" - case MLDv2MulticastAddressRecordTypeChangeToIncludeMode: - return "CHANGE_TO_INCLUDE_MODE" - case MLDv2MulticastAddressRecordTypeChangeToExcludeMode: - return "CHANGE_TO_EXCLUDE_MODE" - case MLDv2MulticastAddressRecordTypeAllowNewSources: - return "ALLOW_NEW_SOURCES" - case MLDv2MulticastAddressRecordTypeBlockOldSources: - return "BLOCK_OLD_SOURCES" - default: - return fmt.Sprintf("UNKNOWN(%d)", m) - } -} - -// MLDv2MulticastAddressRecord contains information on the sender listening to a -// single multicast address on the interface the report is sent. -// https://tools.ietf.org/html/rfc3810#section-5.2.4 -type MLDv2MulticastAddressRecord struct { - // 5.2.5. Record Type - RecordType MLDv2MulticastAddressRecordType - // 5.2.6. Auxiliary Data Length (number of 32-bit words) - AuxDataLen uint8 - // 5.2.7. Number Of Sources (N) - N uint16 - // 5.2.8. Multicast Address - MulticastAddress net.IP - // 5.2.9 Source Address [i] - SourceAddresses []net.IP - // 5.2.10 Auxiliary Data - AuxiliaryData []byte -} - -// decodes a multicast address record from bytes -func (m *MLDv2MulticastAddressRecord) decode(data []byte, df gopacket.DecodeFeedback) (int, error) { - if len(data) < 20 { - df.SetTruncated() - return 0, errors.New( - "Multicast Listener Report Message V2 layer less than 4 bytes for Multicast Address Record") - } - - m.RecordType = MLDv2MulticastAddressRecordType(data[0]) - m.AuxDataLen = data[1] - m.N = binary.BigEndian.Uint16(data[2:4]) - m.MulticastAddress = data[4:20] - - for i := uint16(0); i < m.N; i++ { - begin := 20 + (int(i) * 16) - end := begin + 16 - - if len(data) < end { - df.SetTruncated() - return begin, fmt.Errorf( - "Multicast Listener Report Message V2 layer less than %d bytes for Multicast Address Record", end) - } - - m.SourceAddresses = append(m.SourceAddresses, data[begin:end]) - } - - expectedLengthWithouAuxData := 20 + (int(m.N) * 16) - expectedTotalLength := (int(m.AuxDataLen) * 4) + expectedLengthWithouAuxData // *4 because AuxDataLen are 32bit words - if len(data) < expectedTotalLength { - return expectedLengthWithouAuxData, fmt.Errorf( - "Multicast Listener Report Message V2 layer less than %d bytes for Multicast Address Record", - expectedLengthWithouAuxData) - } - - m.AuxiliaryData = data[expectedLengthWithouAuxData:expectedTotalLength] - - return expectedTotalLength, nil -} - -// String sums this layer up nicely formatted -func (m *MLDv2MulticastAddressRecord) String() string { - return fmt.Sprintf( - "RecordType: %d (%s), AuxDataLen: %d [32-bit words], N: %d, Multicast Address: %s, SourceAddresses: %s, Auxiliary Data: %#x", - m.RecordType, - m.RecordType.String(), - m.AuxDataLen, - m.N, - m.MulticastAddress.To16(), - m.SourceAddresses, - m.AuxiliaryData) -} - -// serializes a multicast address record -func (m *MLDv2MulticastAddressRecord) serializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - if err := m.serializeAuxiliaryDataTo(b, opts); err != nil { - return err - } - - if err := m.serializeSourceAddressesTo(b, opts); err != nil { - return err - } - - buf, err := b.PrependBytes(20) - if err != nil { - return err - } - - buf[0] = uint8(m.RecordType) - buf[1] = m.AuxDataLen - binary.BigEndian.PutUint16(buf[2:4], m.N) - - ma16 := m.MulticastAddress.To16() - if ma16 == nil { - return fmt.Errorf("invalid multicast address '%s'", m.MulticastAddress) - } - copy(buf[4:20], ma16) - - return nil -} - -// serializes the auxiliary data of a multicast address record -func (m *MLDv2MulticastAddressRecord) serializeAuxiliaryDataTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - if remainder := len(m.AuxiliaryData) % 4; remainder != 0 { - zeroWord := []byte{0x0, 0x0, 0x0, 0x0} - m.AuxiliaryData = append(m.AuxiliaryData, zeroWord[:remainder]...) - } - - if opts.FixLengths { - auxDataLen := len(m.AuxiliaryData) / 4 - - if auxDataLen > math.MaxUint8 { - return fmt.Errorf("auxilary data is %d 32-bit words, but the maximum is 255 32-bit words", auxDataLen) - } - - m.AuxDataLen = uint8(auxDataLen) - } - - buf, err := b.PrependBytes(len(m.AuxiliaryData)) - if err != nil { - return err - } - - copy(buf, m.AuxiliaryData) - return nil -} - -// serializes the source addresses of a multicast address record preserving the order -func (m *MLDv2MulticastAddressRecord) serializeSourceAddressesTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - if opts.FixLengths { - numberOfSourceAddresses := len(m.SourceAddresses) - - if numberOfSourceAddresses > math.MaxUint16 { - return fmt.Errorf( - "%d source addresses added, but the maximum is 65535", - numberOfSourceAddresses) - } - - m.N = uint16(numberOfSourceAddresses) - } - - lastItemIdx := len(m.SourceAddresses) - 1 - for k := range m.SourceAddresses { - i := lastItemIdx - k // reverse order - - buf, err := b.PrependBytes(16) - if err != nil { - return err - } - - sa16 := m.SourceAddresses[i].To16() - if sa16 == nil { - return fmt.Errorf("invalid source address [%d] '%s'", i, m.SourceAddresses[i]) - } - copy(buf, sa16) - } - - return nil -} - -func decodeMLDv2MulticastListenerReport(data []byte, p gopacket.PacketBuilder) error { - m := &MLDv2MulticastListenerReportMessage{} - return decodingLayerDecoder(m, data, p) -} - -func decodeMLDv2MulticastListenerQuery(data []byte, p gopacket.PacketBuilder) error { - m := &MLDv2MulticastListenerQueryMessage{} - return decodingLayerDecoder(m, data, p) -} diff --git a/vendor/github.com/google/gopacket/layers/modbustcp.go b/vendor/github.com/google/gopacket/layers/modbustcp.go deleted file mode 100644 index bafbd7436..000000000 --- a/vendor/github.com/google/gopacket/layers/modbustcp.go +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright 2018, The GoPacket Authors, All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. -// -//****************************************************************************** - -package layers - -import ( - "encoding/binary" - "errors" - "github.com/google/gopacket" -) - -//****************************************************************************** -// -// ModbusTCP Decoding Layer -// ------------------------------------------ -// This file provides a GoPacket decoding layer for ModbusTCP. -// -//****************************************************************************** - -const mbapRecordSizeInBytes int = 7 -const modbusPDUMinimumRecordSizeInBytes int = 2 -const modbusPDUMaximumRecordSizeInBytes int = 253 - -// ModbusProtocol type -type ModbusProtocol uint16 - -// ModbusProtocol known values. -const ( - ModbusProtocolModbus ModbusProtocol = 0 -) - -func (mp ModbusProtocol) String() string { - switch mp { - default: - return "Unknown" - case ModbusProtocolModbus: - return "Modbus" - } -} - -//****************************************************************************** - -// ModbusTCP Type -// -------- -// Type ModbusTCP implements the DecodingLayer interface. Each ModbusTCP object -// represents in a structured form the MODBUS Application Protocol header (MBAP) record present as the TCP -// payload in an ModbusTCP TCP packet. -// -type ModbusTCP struct { - BaseLayer // Stores the packet bytes and payload (Modbus PDU) bytes . - - TransactionIdentifier uint16 // Identification of a MODBUS Request/Response transaction - ProtocolIdentifier ModbusProtocol // It is used for intra-system multiplexing - Length uint16 // Number of following bytes (includes 1 byte for UnitIdentifier + Modbus data length - UnitIdentifier uint8 // Identification of a remote slave connected on a serial line or on other buses -} - -//****************************************************************************** - -// LayerType returns the layer type of the ModbusTCP object, which is LayerTypeModbusTCP. -func (d *ModbusTCP) LayerType() gopacket.LayerType { - return LayerTypeModbusTCP -} - -//****************************************************************************** - -// decodeModbusTCP analyses a byte slice and attempts to decode it as an ModbusTCP -// record of a TCP packet. -// -// If it succeeds, it loads p with information about the packet and returns nil. -// If it fails, it returns an error (non nil). -// -// This function is employed in layertypes.go to register the ModbusTCP layer. -func decodeModbusTCP(data []byte, p gopacket.PacketBuilder) error { - - // Attempt to decode the byte slice. - d := &ModbusTCP{} - err := d.DecodeFromBytes(data, p) - if err != nil { - return err - } - // If the decoding worked, add the layer to the packet and set it - // as the application layer too, if there isn't already one. - p.AddLayer(d) - p.SetApplicationLayer(d) - - return p.NextDecoder(d.NextLayerType()) - -} - -//****************************************************************************** - -// DecodeFromBytes analyses a byte slice and attempts to decode it as an ModbusTCP -// record of a TCP packet. -// -// Upon succeeds, it loads the ModbusTCP object with information about the packet -// and returns nil. -// Upon failure, it returns an error (non nil). -func (d *ModbusTCP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - - // If the data block is too short to be a MBAP record, then return an error. - if len(data) < mbapRecordSizeInBytes+modbusPDUMinimumRecordSizeInBytes { - df.SetTruncated() - return errors.New("ModbusTCP packet too short") - } - - if len(data) > mbapRecordSizeInBytes+modbusPDUMaximumRecordSizeInBytes { - df.SetTruncated() - return errors.New("ModbusTCP packet too long") - } - - // ModbusTCP type embeds type BaseLayer which contains two fields: - // Contents is supposed to contain the bytes of the data at this level (MPBA). - // Payload is supposed to contain the payload of this level (PDU). - d.BaseLayer = BaseLayer{Contents: data[:mbapRecordSizeInBytes], Payload: data[mbapRecordSizeInBytes:len(data)]} - - // Extract the fields from the block of bytes. - // The fields can just be copied in big endian order. - d.TransactionIdentifier = binary.BigEndian.Uint16(data[:2]) - d.ProtocolIdentifier = ModbusProtocol(binary.BigEndian.Uint16(data[2:4])) - d.Length = binary.BigEndian.Uint16(data[4:6]) - - // Length should have the size of the payload plus one byte (size of UnitIdentifier) - if d.Length != uint16(len(d.BaseLayer.Payload)+1) { - df.SetTruncated() - return errors.New("ModbusTCP packet with wrong field value (Length)") - } - d.UnitIdentifier = uint8(data[6]) - - return nil -} - -//****************************************************************************** - -// NextLayerType returns the layer type of the ModbusTCP payload, which is LayerTypePayload. -func (d *ModbusTCP) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypePayload -} - -//****************************************************************************** - -// Payload returns Modbus Protocol Data Unit (PDU) composed by Function Code and Data, it is carried within ModbusTCP packets -func (d *ModbusTCP) Payload() []byte { - return d.BaseLayer.Payload -} diff --git a/vendor/github.com/google/gopacket/layers/mpls.go b/vendor/github.com/google/gopacket/layers/mpls.go deleted file mode 100644 index 83079a09b..000000000 --- a/vendor/github.com/google/gopacket/layers/mpls.go +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - "github.com/google/gopacket" -) - -// MPLS is the MPLS packet header. -type MPLS struct { - BaseLayer - Label uint32 - TrafficClass uint8 - StackBottom bool - TTL uint8 -} - -// LayerType returns gopacket.LayerTypeMPLS. -func (m *MPLS) LayerType() gopacket.LayerType { return LayerTypeMPLS } - -// ProtocolGuessingDecoder attempts to guess the protocol of the bytes it's -// given, then decode the packet accordingly. Its algorithm for guessing is: -// If the packet starts with byte 0x45-0x4F: IPv4 -// If the packet starts with byte 0x60-0x6F: IPv6 -// Otherwise: Error -// See draft-hsmit-isis-aal5mux-00.txt for more detail on this approach. -type ProtocolGuessingDecoder struct{} - -func (ProtocolGuessingDecoder) Decode(data []byte, p gopacket.PacketBuilder) error { - switch data[0] { - // 0x40 | header_len, where header_len is at least 5. - case 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f: - return decodeIPv4(data, p) - // IPv6 can start with any byte whose first 4 bits are 0x6. - case 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f: - return decodeIPv6(data, p) - } - return errors.New("Unable to guess protocol of packet data") -} - -// MPLSPayloadDecoder is the decoder used to data encapsulated by each MPLS -// layer. MPLS contains no type information, so we have to explicitly decide -// which decoder to use. This is initially set to ProtocolGuessingDecoder, our -// simple attempt at guessing protocols based on the first few bytes of data -// available to us. However, if you know that in your environment MPLS always -// encapsulates a specific protocol, you may reset this. -var MPLSPayloadDecoder gopacket.Decoder = ProtocolGuessingDecoder{} - -func decodeMPLS(data []byte, p gopacket.PacketBuilder) error { - decoded := binary.BigEndian.Uint32(data[:4]) - mpls := &MPLS{ - Label: decoded >> 12, - TrafficClass: uint8(decoded>>9) & 0x7, - StackBottom: decoded&0x100 != 0, - TTL: uint8(decoded), - BaseLayer: BaseLayer{data[:4], data[4:]}, - } - p.AddLayer(mpls) - if mpls.StackBottom { - return p.NextDecoder(MPLSPayloadDecoder) - } - return p.NextDecoder(gopacket.DecodeFunc(decodeMPLS)) -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (m *MPLS) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - bytes, err := b.PrependBytes(4) - if err != nil { - return err - } - encoded := m.Label << 12 - encoded |= uint32(m.TrafficClass) << 9 - encoded |= uint32(m.TTL) - if m.StackBottom { - encoded |= 0x100 - } - binary.BigEndian.PutUint32(bytes, encoded) - return nil -} diff --git a/vendor/github.com/google/gopacket/layers/ndp.go b/vendor/github.com/google/gopacket/layers/ndp.go deleted file mode 100644 index f7ca1b26b..000000000 --- a/vendor/github.com/google/gopacket/layers/ndp.go +++ /dev/null @@ -1,611 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -// Enum types courtesy of... -// http://anonsvn.wireshark.org/wireshark/trunk/epan/dissectors/packet-ndp.c - -package layers - -import ( - "fmt" - "github.com/google/gopacket" - "net" -) - -type NDPChassisType uint8 - -// Nortel Chassis Types -const ( - NDPChassisother NDPChassisType = 1 - NDPChassis3000 NDPChassisType = 2 - NDPChassis3030 NDPChassisType = 3 - NDPChassis2310 NDPChassisType = 4 - NDPChassis2810 NDPChassisType = 5 - NDPChassis2912 NDPChassisType = 6 - NDPChassis2914 NDPChassisType = 7 - NDPChassis271x NDPChassisType = 8 - NDPChassis2813 NDPChassisType = 9 - NDPChassis2814 NDPChassisType = 10 - NDPChassis2915 NDPChassisType = 11 - NDPChassis5000 NDPChassisType = 12 - NDPChassis2813SA NDPChassisType = 13 - NDPChassis2814SA NDPChassisType = 14 - NDPChassis810M NDPChassisType = 15 - NDPChassisEthercell NDPChassisType = 16 - NDPChassis5005 NDPChassisType = 17 - NDPChassisAlcatelEWC NDPChassisType = 18 - NDPChassis2715SA NDPChassisType = 20 - NDPChassis2486 NDPChassisType = 21 - NDPChassis28000series NDPChassisType = 22 - NDPChassis23000series NDPChassisType = 23 - NDPChassis5DN00xseries NDPChassisType = 24 - NDPChassisBayStackEthernet NDPChassisType = 25 - NDPChassis23100series NDPChassisType = 26 - NDPChassis100BaseTHub NDPChassisType = 27 - NDPChassis3000FastEthernet NDPChassisType = 28 - NDPChassisOrionSwitch NDPChassisType = 29 - NDPChassisDDS NDPChassisType = 31 - NDPChassisCentillion6slot NDPChassisType = 32 - NDPChassisCentillion12slot NDPChassisType = 33 - NDPChassisCentillion1slot NDPChassisType = 34 - NDPChassisBayStack301 NDPChassisType = 35 - NDPChassisBayStackTokenRingHub NDPChassisType = 36 - NDPChassisFVCMultimediaSwitch NDPChassisType = 37 - NDPChassisSwitchNode NDPChassisType = 38 - NDPChassisBayStack302Switch NDPChassisType = 39 - NDPChassisBayStack350Switch NDPChassisType = 40 - NDPChassisBayStack150EthernetHub NDPChassisType = 41 - NDPChassisCentillion50NSwitch NDPChassisType = 42 - NDPChassisCentillion50TSwitch NDPChassisType = 43 - NDPChassisBayStack303304Switches NDPChassisType = 44 - NDPChassisBayStack200EthernetHub NDPChassisType = 45 - NDPChassisBayStack25010100EthernetHub NDPChassisType = 46 - NDPChassisBayStack450101001000Switches NDPChassisType = 48 - NDPChassisBayStack41010100Switches NDPChassisType = 49 - NDPChassisPassport1200L3Switch NDPChassisType = 50 - NDPChassisPassport1250L3Switch NDPChassisType = 51 - NDPChassisPassport1100L3Switch NDPChassisType = 52 - NDPChassisPassport1150L3Switch NDPChassisType = 53 - NDPChassisPassport1050L3Switch NDPChassisType = 54 - NDPChassisPassport1051L3Switch NDPChassisType = 55 - NDPChassisPassport8610L3Switch NDPChassisType = 56 - NDPChassisPassport8606L3Switch NDPChassisType = 57 - NDPChassisPassport8010 NDPChassisType = 58 - NDPChassisPassport8006 NDPChassisType = 59 - NDPChassisBayStack670wirelessaccesspoint NDPChassisType = 60 - NDPChassisPassport740 NDPChassisType = 61 - NDPChassisPassport750 NDPChassisType = 62 - NDPChassisPassport790 NDPChassisType = 63 - NDPChassisBusinessPolicySwitch200010100Switches NDPChassisType = 64 - NDPChassisPassport8110L2Switch NDPChassisType = 65 - NDPChassisPassport8106L2Switch NDPChassisType = 66 - NDPChassisBayStack3580GigSwitch NDPChassisType = 67 - NDPChassisBayStack10PowerSupplyUnit NDPChassisType = 68 - NDPChassisBayStack42010100Switch NDPChassisType = 69 - NDPChassisOPTeraMetro1200EthernetServiceModule NDPChassisType = 70 - NDPChassisOPTera8010co NDPChassisType = 71 - NDPChassisOPTera8610coL3Switch NDPChassisType = 72 - NDPChassisOPTera8110coL2Switch NDPChassisType = 73 - NDPChassisOPTera8003 NDPChassisType = 74 - NDPChassisOPTera8603L3Switch NDPChassisType = 75 - NDPChassisOPTera8103L2Switch NDPChassisType = 76 - NDPChassisBayStack380101001000Switch NDPChassisType = 77 - NDPChassisEthernetSwitch47048T NDPChassisType = 78 - NDPChassisOPTeraMetro1450EthernetServiceModule NDPChassisType = 79 - NDPChassisOPTeraMetro1400EthernetServiceModule NDPChassisType = 80 - NDPChassisAlteonSwitchFamily NDPChassisType = 81 - NDPChassisEthernetSwitch46024TPWR NDPChassisType = 82 - NDPChassisOPTeraMetro8010OPML2Switch NDPChassisType = 83 - NDPChassisOPTeraMetro8010coOPML2Switch NDPChassisType = 84 - NDPChassisOPTeraMetro8006OPML2Switch NDPChassisType = 85 - NDPChassisOPTeraMetro8003OPML2Switch NDPChassisType = 86 - NDPChassisAlteon180e NDPChassisType = 87 - NDPChassisAlteonAD3 NDPChassisType = 88 - NDPChassisAlteon184 NDPChassisType = 89 - NDPChassisAlteonAD4 NDPChassisType = 90 - NDPChassisPassport1424L3Switch NDPChassisType = 91 - NDPChassisPassport1648L3Switch NDPChassisType = 92 - NDPChassisPassport1612L3Switch NDPChassisType = 93 - NDPChassisPassport1624L3Switch NDPChassisType = 94 - NDPChassisBayStack38024FFiber1000Switch NDPChassisType = 95 - NDPChassisEthernetRoutingSwitch551024T NDPChassisType = 96 - NDPChassisEthernetRoutingSwitch551048T NDPChassisType = 97 - NDPChassisEthernetSwitch47024T NDPChassisType = 98 - NDPChassisNortelNetworksWirelessLANAccessPoint2220 NDPChassisType = 99 - NDPChassisPassportRBS2402L3Switch NDPChassisType = 100 - NDPChassisAlteonApplicationSwitch2424 NDPChassisType = 101 - NDPChassisAlteonApplicationSwitch2224 NDPChassisType = 102 - NDPChassisAlteonApplicationSwitch2208 NDPChassisType = 103 - NDPChassisAlteonApplicationSwitch2216 NDPChassisType = 104 - NDPChassisAlteonApplicationSwitch3408 NDPChassisType = 105 - NDPChassisAlteonApplicationSwitch3416 NDPChassisType = 106 - NDPChassisNortelNetworksWirelessLANSecuritySwitch2250 NDPChassisType = 107 - NDPChassisEthernetSwitch42548T NDPChassisType = 108 - NDPChassisEthernetSwitch42524T NDPChassisType = 109 - NDPChassisNortelNetworksWirelessLANAccessPoint2221 NDPChassisType = 110 - NDPChassisNortelMetroEthernetServiceUnit24TSPFswitch NDPChassisType = 111 - NDPChassisNortelMetroEthernetServiceUnit24TLXDCswitch NDPChassisType = 112 - NDPChassisPassport830010slotchassis NDPChassisType = 113 - NDPChassisPassport83006slotchassis NDPChassisType = 114 - NDPChassisEthernetRoutingSwitch552024TPWR NDPChassisType = 115 - NDPChassisEthernetRoutingSwitch552048TPWR NDPChassisType = 116 - NDPChassisNortelNetworksVPNGateway3050 NDPChassisType = 117 - NDPChassisAlteonSSL31010100 NDPChassisType = 118 - NDPChassisAlteonSSL31010100Fiber NDPChassisType = 119 - NDPChassisAlteonSSL31010100FIPS NDPChassisType = 120 - NDPChassisAlteonSSL410101001000 NDPChassisType = 121 - NDPChassisAlteonSSL410101001000Fiber NDPChassisType = 122 - NDPChassisAlteonApplicationSwitch2424SSL NDPChassisType = 123 - NDPChassisEthernetSwitch32524T NDPChassisType = 124 - NDPChassisEthernetSwitch32524G NDPChassisType = 125 - NDPChassisNortelNetworksWirelessLANAccessPoint2225 NDPChassisType = 126 - NDPChassisNortelNetworksWirelessLANSecuritySwitch2270 NDPChassisType = 127 - NDPChassis24portEthernetSwitch47024TPWR NDPChassisType = 128 - NDPChassis48portEthernetSwitch47048TPWR NDPChassisType = 129 - NDPChassisEthernetRoutingSwitch553024TFD NDPChassisType = 130 - NDPChassisEthernetSwitch351024T NDPChassisType = 131 - NDPChassisNortelMetroEthernetServiceUnit12GACL3Switch NDPChassisType = 132 - NDPChassisNortelMetroEthernetServiceUnit12GDCL3Switch NDPChassisType = 133 - NDPChassisNortelSecureAccessSwitch NDPChassisType = 134 - NDPChassisNortelNetworksVPNGateway3070 NDPChassisType = 135 - NDPChassisOPTeraMetro3500 NDPChassisType = 136 - NDPChassisSMBBES101024T NDPChassisType = 137 - NDPChassisSMBBES101048T NDPChassisType = 138 - NDPChassisSMBBES102024TPWR NDPChassisType = 139 - NDPChassisSMBBES102048TPWR NDPChassisType = 140 - NDPChassisSMBBES201024T NDPChassisType = 141 - NDPChassisSMBBES201048T NDPChassisType = 142 - NDPChassisSMBBES202024TPWR NDPChassisType = 143 - NDPChassisSMBBES202048TPWR NDPChassisType = 144 - NDPChassisSMBBES11024T NDPChassisType = 145 - NDPChassisSMBBES11048T NDPChassisType = 146 - NDPChassisSMBBES12024TPWR NDPChassisType = 147 - NDPChassisSMBBES12048TPWR NDPChassisType = 148 - NDPChassisSMBBES21024T NDPChassisType = 149 - NDPChassisSMBBES21048T NDPChassisType = 150 - NDPChassisSMBBES22024TPWR NDPChassisType = 151 - NDPChassisSMBBES22048TPWR NDPChassisType = 152 - NDPChassisOME6500 NDPChassisType = 153 - NDPChassisEthernetRoutingSwitch4548GT NDPChassisType = 154 - NDPChassisEthernetRoutingSwitch4548GTPWR NDPChassisType = 155 - NDPChassisEthernetRoutingSwitch4550T NDPChassisType = 156 - NDPChassisEthernetRoutingSwitch4550TPWR NDPChassisType = 157 - NDPChassisEthernetRoutingSwitch4526FX NDPChassisType = 158 - NDPChassisEthernetRoutingSwitch250026T NDPChassisType = 159 - NDPChassisEthernetRoutingSwitch250026TPWR NDPChassisType = 160 - NDPChassisEthernetRoutingSwitch250050T NDPChassisType = 161 - NDPChassisEthernetRoutingSwitch250050TPWR NDPChassisType = 162 -) - -type NDPBackplaneType uint8 - -// Nortel Backplane Types -const ( - NDPBackplaneOther NDPBackplaneType = 1 - NDPBackplaneEthernet NDPBackplaneType = 2 - NDPBackplaneEthernetTokenring NDPBackplaneType = 3 - NDPBackplaneEthernetFDDI NDPBackplaneType = 4 - NDPBackplaneEthernetTokenringFDDI NDPBackplaneType = 5 - NDPBackplaneEthernetTokenringRedundantPower NDPBackplaneType = 6 - NDPBackplaneEthernetTokenringFDDIRedundantPower NDPBackplaneType = 7 - NDPBackplaneTokenRing NDPBackplaneType = 8 - NDPBackplaneEthernetTokenringFastEthernet NDPBackplaneType = 9 - NDPBackplaneEthernetFastEthernet NDPBackplaneType = 10 - NDPBackplaneEthernetTokenringFastEthernetRedundantPower NDPBackplaneType = 11 - NDPBackplaneEthernetFastEthernetGigabitEthernet NDPBackplaneType = 12 -) - -type NDPState uint8 - -// Device State -const ( - NDPStateTopology NDPState = 1 - NDPStateHeartbeat NDPState = 2 - NDPStateNew NDPState = 3 -) - -// NortelDiscovery is a packet layer containing the Nortel Discovery Protocol. -type NortelDiscovery struct { - BaseLayer - IPAddress net.IP - SegmentID []byte - Chassis NDPChassisType - Backplane NDPBackplaneType - State NDPState - NumLinks uint8 -} - -// LayerType returns gopacket.LayerTypeNortelDiscovery. -func (c *NortelDiscovery) LayerType() gopacket.LayerType { - return LayerTypeNortelDiscovery -} - -func decodeNortelDiscovery(data []byte, p gopacket.PacketBuilder) error { - c := &NortelDiscovery{} - if len(data) < 11 { - return fmt.Errorf("Invalid NortelDiscovery packet length %d", len(data)) - } - c.IPAddress = data[0:4] - c.SegmentID = data[4:7] - c.Chassis = NDPChassisType(data[7]) - c.Backplane = NDPBackplaneType(data[8]) - c.State = NDPState(data[9]) - c.NumLinks = uint8(data[10]) - p.AddLayer(c) - return nil -} - -func (t NDPChassisType) String() (s string) { - switch t { - case NDPChassisother: - s = "other" - case NDPChassis3000: - s = "3000" - case NDPChassis3030: - s = "3030" - case NDPChassis2310: - s = "2310" - case NDPChassis2810: - s = "2810" - case NDPChassis2912: - s = "2912" - case NDPChassis2914: - s = "2914" - case NDPChassis271x: - s = "271x" - case NDPChassis2813: - s = "2813" - case NDPChassis2814: - s = "2814" - case NDPChassis2915: - s = "2915" - case NDPChassis5000: - s = "5000" - case NDPChassis2813SA: - s = "2813SA" - case NDPChassis2814SA: - s = "2814SA" - case NDPChassis810M: - s = "810M" - case NDPChassisEthercell: - s = "Ethercell" - case NDPChassis5005: - s = "5005" - case NDPChassisAlcatelEWC: - s = "Alcatel Ethernet workgroup conc." - case NDPChassis2715SA: - s = "2715SA" - case NDPChassis2486: - s = "2486" - case NDPChassis28000series: - s = "28000 series" - case NDPChassis23000series: - s = "23000 series" - case NDPChassis5DN00xseries: - s = "5DN00x series" - case NDPChassisBayStackEthernet: - s = "BayStack Ethernet" - case NDPChassis23100series: - s = "23100 series" - case NDPChassis100BaseTHub: - s = "100Base-T Hub" - case NDPChassis3000FastEthernet: - s = "3000 Fast Ethernet" - case NDPChassisOrionSwitch: - s = "Orion switch" - case NDPChassisDDS: - s = "DDS" - case NDPChassisCentillion6slot: - s = "Centillion (6 slot)" - case NDPChassisCentillion12slot: - s = "Centillion (12 slot)" - case NDPChassisCentillion1slot: - s = "Centillion (1 slot)" - case NDPChassisBayStack301: - s = "BayStack 301" - case NDPChassisBayStackTokenRingHub: - s = "BayStack TokenRing Hub" - case NDPChassisFVCMultimediaSwitch: - s = "FVC Multimedia Switch" - case NDPChassisSwitchNode: - s = "Switch Node" - case NDPChassisBayStack302Switch: - s = "BayStack 302 Switch" - case NDPChassisBayStack350Switch: - s = "BayStack 350 Switch" - case NDPChassisBayStack150EthernetHub: - s = "BayStack 150 Ethernet Hub" - case NDPChassisCentillion50NSwitch: - s = "Centillion 50N switch" - case NDPChassisCentillion50TSwitch: - s = "Centillion 50T switch" - case NDPChassisBayStack303304Switches: - s = "BayStack 303 and 304 Switches" - case NDPChassisBayStack200EthernetHub: - s = "BayStack 200 Ethernet Hub" - case NDPChassisBayStack25010100EthernetHub: - s = "BayStack 250 10/100 Ethernet Hub" - case NDPChassisBayStack450101001000Switches: - s = "BayStack 450 10/100/1000 Switches" - case NDPChassisBayStack41010100Switches: - s = "BayStack 410 10/100 Switches" - case NDPChassisPassport1200L3Switch: - s = "Passport 1200 L3 Switch" - case NDPChassisPassport1250L3Switch: - s = "Passport 1250 L3 Switch" - case NDPChassisPassport1100L3Switch: - s = "Passport 1100 L3 Switch" - case NDPChassisPassport1150L3Switch: - s = "Passport 1150 L3 Switch" - case NDPChassisPassport1050L3Switch: - s = "Passport 1050 L3 Switch" - case NDPChassisPassport1051L3Switch: - s = "Passport 1051 L3 Switch" - case NDPChassisPassport8610L3Switch: - s = "Passport 8610 L3 Switch" - case NDPChassisPassport8606L3Switch: - s = "Passport 8606 L3 Switch" - case NDPChassisPassport8010: - s = "Passport 8010" - case NDPChassisPassport8006: - s = "Passport 8006" - case NDPChassisBayStack670wirelessaccesspoint: - s = "BayStack 670 wireless access point" - case NDPChassisPassport740: - s = "Passport 740" - case NDPChassisPassport750: - s = "Passport 750" - case NDPChassisPassport790: - s = "Passport 790" - case NDPChassisBusinessPolicySwitch200010100Switches: - s = "Business Policy Switch 2000 10/100 Switches" - case NDPChassisPassport8110L2Switch: - s = "Passport 8110 L2 Switch" - case NDPChassisPassport8106L2Switch: - s = "Passport 8106 L2 Switch" - case NDPChassisBayStack3580GigSwitch: - s = "BayStack 3580 Gig Switch" - case NDPChassisBayStack10PowerSupplyUnit: - s = "BayStack 10 Power Supply Unit" - case NDPChassisBayStack42010100Switch: - s = "BayStack 420 10/100 Switch" - case NDPChassisOPTeraMetro1200EthernetServiceModule: - s = "OPTera Metro 1200 Ethernet Service Module" - case NDPChassisOPTera8010co: - s = "OPTera 8010co" - case NDPChassisOPTera8610coL3Switch: - s = "OPTera 8610co L3 switch" - case NDPChassisOPTera8110coL2Switch: - s = "OPTera 8110co L2 switch" - case NDPChassisOPTera8003: - s = "OPTera 8003" - case NDPChassisOPTera8603L3Switch: - s = "OPTera 8603 L3 switch" - case NDPChassisOPTera8103L2Switch: - s = "OPTera 8103 L2 switch" - case NDPChassisBayStack380101001000Switch: - s = "BayStack 380 10/100/1000 Switch" - case NDPChassisEthernetSwitch47048T: - s = "Ethernet Switch 470-48T" - case NDPChassisOPTeraMetro1450EthernetServiceModule: - s = "OPTera Metro 1450 Ethernet Service Module" - case NDPChassisOPTeraMetro1400EthernetServiceModule: - s = "OPTera Metro 1400 Ethernet Service Module" - case NDPChassisAlteonSwitchFamily: - s = "Alteon Switch Family" - case NDPChassisEthernetSwitch46024TPWR: - s = "Ethernet Switch 460-24T-PWR" - case NDPChassisOPTeraMetro8010OPML2Switch: - s = "OPTera Metro 8010 OPM L2 Switch" - case NDPChassisOPTeraMetro8010coOPML2Switch: - s = "OPTera Metro 8010co OPM L2 Switch" - case NDPChassisOPTeraMetro8006OPML2Switch: - s = "OPTera Metro 8006 OPM L2 Switch" - case NDPChassisOPTeraMetro8003OPML2Switch: - s = "OPTera Metro 8003 OPM L2 Switch" - case NDPChassisAlteon180e: - s = "Alteon 180e" - case NDPChassisAlteonAD3: - s = "Alteon AD3" - case NDPChassisAlteon184: - s = "Alteon 184" - case NDPChassisAlteonAD4: - s = "Alteon AD4" - case NDPChassisPassport1424L3Switch: - s = "Passport 1424 L3 switch" - case NDPChassisPassport1648L3Switch: - s = "Passport 1648 L3 switch" - case NDPChassisPassport1612L3Switch: - s = "Passport 1612 L3 switch" - case NDPChassisPassport1624L3Switch: - s = "Passport 1624 L3 switch" - case NDPChassisBayStack38024FFiber1000Switch: - s = "BayStack 380-24F Fiber 1000 Switch" - case NDPChassisEthernetRoutingSwitch551024T: - s = "Ethernet Routing Switch 5510-24T" - case NDPChassisEthernetRoutingSwitch551048T: - s = "Ethernet Routing Switch 5510-48T" - case NDPChassisEthernetSwitch47024T: - s = "Ethernet Switch 470-24T" - case NDPChassisNortelNetworksWirelessLANAccessPoint2220: - s = "Nortel Networks Wireless LAN Access Point 2220" - case NDPChassisPassportRBS2402L3Switch: - s = "Passport RBS 2402 L3 switch" - case NDPChassisAlteonApplicationSwitch2424: - s = "Alteon Application Switch 2424" - case NDPChassisAlteonApplicationSwitch2224: - s = "Alteon Application Switch 2224" - case NDPChassisAlteonApplicationSwitch2208: - s = "Alteon Application Switch 2208" - case NDPChassisAlteonApplicationSwitch2216: - s = "Alteon Application Switch 2216" - case NDPChassisAlteonApplicationSwitch3408: - s = "Alteon Application Switch 3408" - case NDPChassisAlteonApplicationSwitch3416: - s = "Alteon Application Switch 3416" - case NDPChassisNortelNetworksWirelessLANSecuritySwitch2250: - s = "Nortel Networks Wireless LAN SecuritySwitch 2250" - case NDPChassisEthernetSwitch42548T: - s = "Ethernet Switch 425-48T" - case NDPChassisEthernetSwitch42524T: - s = "Ethernet Switch 425-24T" - case NDPChassisNortelNetworksWirelessLANAccessPoint2221: - s = "Nortel Networks Wireless LAN Access Point 2221" - case NDPChassisNortelMetroEthernetServiceUnit24TSPFswitch: - s = "Nortel Metro Ethernet Service Unit 24-T SPF switch" - case NDPChassisNortelMetroEthernetServiceUnit24TLXDCswitch: - s = " Nortel Metro Ethernet Service Unit 24-T LX DC switch" - case NDPChassisPassport830010slotchassis: - s = "Passport 8300 10-slot chassis" - case NDPChassisPassport83006slotchassis: - s = "Passport 8300 6-slot chassis" - case NDPChassisEthernetRoutingSwitch552024TPWR: - s = "Ethernet Routing Switch 5520-24T-PWR" - case NDPChassisEthernetRoutingSwitch552048TPWR: - s = "Ethernet Routing Switch 5520-48T-PWR" - case NDPChassisNortelNetworksVPNGateway3050: - s = "Nortel Networks VPN Gateway 3050" - case NDPChassisAlteonSSL31010100: - s = "Alteon SSL 310 10/100" - case NDPChassisAlteonSSL31010100Fiber: - s = "Alteon SSL 310 10/100 Fiber" - case NDPChassisAlteonSSL31010100FIPS: - s = "Alteon SSL 310 10/100 FIPS" - case NDPChassisAlteonSSL410101001000: - s = "Alteon SSL 410 10/100/1000" - case NDPChassisAlteonSSL410101001000Fiber: - s = "Alteon SSL 410 10/100/1000 Fiber" - case NDPChassisAlteonApplicationSwitch2424SSL: - s = "Alteon Application Switch 2424-SSL" - case NDPChassisEthernetSwitch32524T: - s = "Ethernet Switch 325-24T" - case NDPChassisEthernetSwitch32524G: - s = "Ethernet Switch 325-24G" - case NDPChassisNortelNetworksWirelessLANAccessPoint2225: - s = "Nortel Networks Wireless LAN Access Point 2225" - case NDPChassisNortelNetworksWirelessLANSecuritySwitch2270: - s = "Nortel Networks Wireless LAN SecuritySwitch 2270" - case NDPChassis24portEthernetSwitch47024TPWR: - s = "24-port Ethernet Switch 470-24T-PWR" - case NDPChassis48portEthernetSwitch47048TPWR: - s = "48-port Ethernet Switch 470-48T-PWR" - case NDPChassisEthernetRoutingSwitch553024TFD: - s = "Ethernet Routing Switch 5530-24TFD" - case NDPChassisEthernetSwitch351024T: - s = "Ethernet Switch 3510-24T" - case NDPChassisNortelMetroEthernetServiceUnit12GACL3Switch: - s = "Nortel Metro Ethernet Service Unit 12G AC L3 switch" - case NDPChassisNortelMetroEthernetServiceUnit12GDCL3Switch: - s = "Nortel Metro Ethernet Service Unit 12G DC L3 switch" - case NDPChassisNortelSecureAccessSwitch: - s = "Nortel Secure Access Switch" - case NDPChassisNortelNetworksVPNGateway3070: - s = "Nortel Networks VPN Gateway 3070" - case NDPChassisOPTeraMetro3500: - s = "OPTera Metro 3500" - case NDPChassisSMBBES101024T: - s = "SMB BES 1010 24T" - case NDPChassisSMBBES101048T: - s = "SMB BES 1010 48T" - case NDPChassisSMBBES102024TPWR: - s = "SMB BES 1020 24T PWR" - case NDPChassisSMBBES102048TPWR: - s = "SMB BES 1020 48T PWR" - case NDPChassisSMBBES201024T: - s = "SMB BES 2010 24T" - case NDPChassisSMBBES201048T: - s = "SMB BES 2010 48T" - case NDPChassisSMBBES202024TPWR: - s = "SMB BES 2020 24T PWR" - case NDPChassisSMBBES202048TPWR: - s = "SMB BES 2020 48T PWR" - case NDPChassisSMBBES11024T: - s = "SMB BES 110 24T" - case NDPChassisSMBBES11048T: - s = "SMB BES 110 48T" - case NDPChassisSMBBES12024TPWR: - s = "SMB BES 120 24T PWR" - case NDPChassisSMBBES12048TPWR: - s = "SMB BES 120 48T PWR" - case NDPChassisSMBBES21024T: - s = "SMB BES 210 24T" - case NDPChassisSMBBES21048T: - s = "SMB BES 210 48T" - case NDPChassisSMBBES22024TPWR: - s = "SMB BES 220 24T PWR" - case NDPChassisSMBBES22048TPWR: - s = "SMB BES 220 48T PWR" - case NDPChassisOME6500: - s = "OME 6500" - case NDPChassisEthernetRoutingSwitch4548GT: - s = "Ethernet Routing Switch 4548GT" - case NDPChassisEthernetRoutingSwitch4548GTPWR: - s = "Ethernet Routing Switch 4548GT-PWR" - case NDPChassisEthernetRoutingSwitch4550T: - s = "Ethernet Routing Switch 4550T" - case NDPChassisEthernetRoutingSwitch4550TPWR: - s = "Ethernet Routing Switch 4550T-PWR" - case NDPChassisEthernetRoutingSwitch4526FX: - s = "Ethernet Routing Switch 4526FX" - case NDPChassisEthernetRoutingSwitch250026T: - s = "Ethernet Routing Switch 2500-26T" - case NDPChassisEthernetRoutingSwitch250026TPWR: - s = "Ethernet Routing Switch 2500-26T-PWR" - case NDPChassisEthernetRoutingSwitch250050T: - s = "Ethernet Routing Switch 2500-50T" - case NDPChassisEthernetRoutingSwitch250050TPWR: - s = "Ethernet Routing Switch 2500-50T-PWR" - default: - s = "Unknown" - } - return -} - -func (t NDPBackplaneType) String() (s string) { - switch t { - case NDPBackplaneOther: - s = "Other" - case NDPBackplaneEthernet: - s = "Ethernet" - case NDPBackplaneEthernetTokenring: - s = "Ethernet and Tokenring" - case NDPBackplaneEthernetFDDI: - s = "Ethernet and FDDI" - case NDPBackplaneEthernetTokenringFDDI: - s = "Ethernet, Tokenring and FDDI" - case NDPBackplaneEthernetTokenringRedundantPower: - s = "Ethernet and Tokenring with redundant power" - case NDPBackplaneEthernetTokenringFDDIRedundantPower: - s = "Ethernet, Tokenring, FDDI with redundant power" - case NDPBackplaneTokenRing: - s = "Token Ring" - case NDPBackplaneEthernetTokenringFastEthernet: - s = "Ethernet, Tokenring and Fast Ethernet" - case NDPBackplaneEthernetFastEthernet: - s = "Ethernet and Fast Ethernet" - case NDPBackplaneEthernetTokenringFastEthernetRedundantPower: - s = "Ethernet, Tokenring, Fast Ethernet with redundant power" - case NDPBackplaneEthernetFastEthernetGigabitEthernet: - s = "Ethernet, Fast Ethernet and Gigabit Ethernet" - default: - s = "Unknown" - } - return -} - -func (t NDPState) String() (s string) { - switch t { - case NDPStateTopology: - s = "Topology Change" - case NDPStateHeartbeat: - s = "Heartbeat" - case NDPStateNew: - s = "New" - default: - s = "Unknown" - } - return -} diff --git a/vendor/github.com/google/gopacket/layers/ntp.go b/vendor/github.com/google/gopacket/layers/ntp.go deleted file mode 100644 index 33c15b3b3..000000000 --- a/vendor/github.com/google/gopacket/layers/ntp.go +++ /dev/null @@ -1,416 +0,0 @@ -// Copyright 2016 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. -// -//****************************************************************************** - -package layers - -import ( - "encoding/binary" - "errors" - - "github.com/google/gopacket" -) - -//****************************************************************************** -// -// Network Time Protocol (NTP) Decoding Layer -// ------------------------------------------ -// This file provides a GoPacket decoding layer for NTP. -// -//****************************************************************************** -// -// About The Network Time Protocol (NTP) -// ------------------------------------- -// NTP is a protocol that enables computers on the internet to set their -// clocks to the correct time (or to a time that is acceptably close to the -// correct time). NTP runs on top of UDP. -// -// There have been a series of versions of the NTP protocol. The latest -// version is V4 and is specified in RFC 5905: -// http://www.ietf.org/rfc/rfc5905.txt -// -//****************************************************************************** -// -// References -// ---------- -// -// Wikipedia's NTP entry: -// https://en.wikipedia.org/wiki/Network_Time_Protocol -// This is the best place to get an overview of NTP. -// -// Network Time Protocol Home Website: -// http://www.ntp.org/ -// This appears to be the official website of NTP. -// -// List of current NTP Protocol RFCs: -// http://www.ntp.org/rfc.html -// -// RFC 958: "Network Time Protocol (NTP)" (1985) -// https://tools.ietf.org/html/rfc958 -// This is the original NTP specification. -// -// RFC 1305: "Network Time Protocol (Version 3) Specification, Implementation and Analysis" (1992) -// https://tools.ietf.org/html/rfc1305 -// The protocol was updated in 1992 yielding NTP V3. -// -// RFC 5905: "Network Time Protocol Version 4: Protocol and Algorithms Specification" (2010) -// https://www.ietf.org/rfc/rfc5905.txt -// The protocol was updated in 2010 yielding NTP V4. -// V4 is backwards compatible with all previous versions of NTP. -// -// RFC 5906: "Network Time Protocol Version 4: Autokey Specification" -// https://tools.ietf.org/html/rfc5906 -// This document addresses the security of the NTP protocol -// and is probably not relevant to this package. -// -// RFC 5907: "Definitions of Managed Objects for Network Time Protocol Version 4 (NTPv4)" -// https://tools.ietf.org/html/rfc5907 -// This document addresses the management of NTP servers and -// is probably not relevant to this package. -// -// RFC 5908: "Network Time Protocol (NTP) Server Option for DHCPv6" -// https://tools.ietf.org/html/rfc5908 -// This document addresses the use of NTP in DHCPv6 and is -// probably not relevant to this package. -// -// "Let's make a NTP Client in C" -// https://lettier.github.io/posts/2016-04-26-lets-make-a-ntp-client-in-c.html -// This web page contains useful information about the details of NTP, -// including an NTP record struture in C, and C code. -// -// "NTP Packet Header (NTP Reference Implementation) (Computer Network Time Synchronization)" -// http://what-when-how.com/computer-network-time-synchronization/ -// ntp-packet-header-ntp-reference-implementation-computer-network-time-synchronization/ -// This web page contains useful information on the details of NTP. -// -// "Technical information - NTP Data Packet" -// https://www.meinbergglobal.com/english/info/ntp-packet.htm -// This page has a helpful diagram of an NTP V4 packet. -// -//****************************************************************************** -// -// Obsolete References -// ------------------- -// -// RFC 1119: "RFC-1119 "Network Time Protocol (Version 2) Specification and Implementation" (1989) -// https://tools.ietf.org/html/rfc1119 -// Version 2 was drafted in 1989. -// It is unclear whether V2 was ever implememented or whether the -// ideas ended up in V3 (which was implemented in 1992). -// -// RFC 1361: "Simple Network Time Protocol (SNTP)" -// https://tools.ietf.org/html/rfc1361 -// This document is obsoleted by RFC 1769 and is included only for completeness. -// -// RFC 1769: "Simple Network Time Protocol (SNTP)" -// https://tools.ietf.org/html/rfc1769 -// This document is obsoleted by RFC 2030 and RFC 4330 and is included only for completeness. -// -// RFC 2030: "Simple Network Time Protocol (SNTP) Version 4 for IPv4, IPv6 and OSI" -// https://tools.ietf.org/html/rfc2030 -// This document is obsoleted by RFC 4330 and is included only for completeness. -// -// RFC 4330: "Simple Network Time Protocol (SNTP) Version 4 for IPv4, IPv6 and OSI" -// https://tools.ietf.org/html/rfc4330 -// This document is obsoleted by RFC 5905 and is included only for completeness. -// -//****************************************************************************** -// -// Endian And Bit Numbering Issues -// ------------------------------- -// -// Endian and bit numbering issues can be confusing. Here is some -// clarification: -// -// ENDIAN: Values are sent big endian. -// https://en.wikipedia.org/wiki/Endianness -// -// BIT NUMBERING: Bits are numbered 0 upwards from the most significant -// bit to the least significant bit. This means that if there is a 32-bit -// value, the most significant bit is called bit 0 and the least -// significant bit is called bit 31. -// -// See RFC 791 Appendix B for more discussion. -// -//****************************************************************************** -// -// NTP V3 and V4 Packet Format -// --------------------------- -// NTP packets are UDP packets whose payload contains an NTP record. -// -// The NTP RFC defines the format of the NTP record. -// -// There have been four versions of the protocol: -// -// V1 in 1985 -// V2 in 1989 -// V3 in 1992 -// V4 in 2010 -// -// It is clear that V1 and V2 are obsolete, and there is no need to -// cater for these formats. -// -// V3 and V4 essentially use the same format, with V4 adding some optional -// fields on the end. So this package supports the V3 and V4 formats. -// -// The current version of NTP (NTP V4)'s RFC (V4 - RFC 5905) contains -// the following diagram for the NTP record format: - -// 0 1 2 3 -// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// |LI | VN |Mode | Stratum | Poll | Precision | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Root Delay | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Root Dispersion | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Reference ID | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | | -// + Reference Timestamp (64) + -// | | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | | -// + Origin Timestamp (64) + -// | | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | | -// + Receive Timestamp (64) + -// | | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | | -// + Transmit Timestamp (64) + -// | | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | | -// . . -// . Extension Field 1 (variable) . -// . . -// | | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | | -// . . -// . Extension Field 2 (variable) . -// . . -// | | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Key Identifier | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | | -// | dgst (128) | -// | | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// From http://www.ietf.org/rfc/rfc5905.txt -// -// The fields "Extension Field 1 (variable)" and later are optional fields, -// and so we can set a minimum NTP record size of 48 bytes. -// -const ntpMinimumRecordSizeInBytes int = 48 - -//****************************************************************************** - -// NTP Type -// -------- -// Type NTP implements the DecodingLayer interface. Each NTP object -// represents in a structured form the NTP record present as the UDP -// payload in an NTP UDP packet. -// - -type NTPLeapIndicator uint8 -type NTPVersion uint8 -type NTPMode uint8 -type NTPStratum uint8 -type NTPLog2Seconds int8 -type NTPFixed16Seconds uint32 -type NTPReferenceID uint32 -type NTPTimestamp uint64 - -type NTP struct { - BaseLayer // Stores the packet bytes and payload bytes. - - LeapIndicator NTPLeapIndicator // [0,3]. Indicates whether leap second(s) is to be added. - Version NTPVersion // [0,7]. Version of the NTP protocol. - Mode NTPMode // [0,7]. Mode. - Stratum NTPStratum // [0,255]. Stratum of time server in the server tree. - Poll NTPLog2Seconds // [-128,127]. The maximum interval between successive messages, in log2 seconds. - Precision NTPLog2Seconds // [-128,127]. The precision of the system clock, in log2 seconds. - RootDelay NTPFixed16Seconds // [0,2^32-1]. Total round trip delay to the reference clock in seconds times 2^16. - RootDispersion NTPFixed16Seconds // [0,2^32-1]. Total dispersion to the reference clock, in seconds times 2^16. - ReferenceID NTPReferenceID // ID code of reference clock [0,2^32-1]. - ReferenceTimestamp NTPTimestamp // Most recent timestamp from the reference clock. - OriginTimestamp NTPTimestamp // Local time when request was sent from local host. - ReceiveTimestamp NTPTimestamp // Local time (on server) that request arrived at server host. - TransmitTimestamp NTPTimestamp // Local time (on server) that request departed server host. - - // FIX: This package should analyse the extension fields and represent the extension fields too. - ExtensionBytes []byte // Just put extensions in a byte slice. -} - -//****************************************************************************** - -// LayerType returns the layer type of the NTP object, which is LayerTypeNTP. -func (d *NTP) LayerType() gopacket.LayerType { - return LayerTypeNTP -} - -//****************************************************************************** - -// decodeNTP analyses a byte slice and attempts to decode it as an NTP -// record of a UDP packet. -// -// If it succeeds, it loads p with information about the packet and returns nil. -// If it fails, it returns an error (non nil). -// -// This function is employed in layertypes.go to register the NTP layer. -func decodeNTP(data []byte, p gopacket.PacketBuilder) error { - - // Attempt to decode the byte slice. - d := &NTP{} - err := d.DecodeFromBytes(data, p) - if err != nil { - return err - } - - // If the decoding worked, add the layer to the packet and set it - // as the application layer too, if there isn't already one. - p.AddLayer(d) - p.SetApplicationLayer(d) - - return nil -} - -//****************************************************************************** - -// DecodeFromBytes analyses a byte slice and attempts to decode it as an NTP -// record of a UDP packet. -// -// Upon succeeds, it loads the NTP object with information about the packet -// and returns nil. -// Upon failure, it returns an error (non nil). -func (d *NTP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - - // If the data block is too short to be a NTP record, then return an error. - if len(data) < ntpMinimumRecordSizeInBytes { - df.SetTruncated() - return errors.New("NTP packet too short") - } - - // RFC 5905 does not appear to define a maximum NTP record length. - // The protocol allows "extension fields" to be included in the record, - // and states about these fields:" - // - // "While the minimum field length containing required fields is - // four words (16 octets), a maximum field length remains to be - // established." - // - // For this reason, the packet length is not checked here for being too long. - - // NTP type embeds type BaseLayer which contains two fields: - // Contents is supposed to contain the bytes of the data at this level. - // Payload is supposed to contain the payload of this level. - // Here we set the baselayer to be the bytes of the NTP record. - d.BaseLayer = BaseLayer{Contents: data[:len(data)]} - - // Extract the fields from the block of bytes. - // To make sense of this, refer to the packet diagram - // above and the section on endian conventions. - - // The first few fields are all packed into the first 32 bits. Unpack them. - f := data[0] - d.LeapIndicator = NTPLeapIndicator((f & 0xC0) >> 6) - d.Version = NTPVersion((f & 0x38) >> 3) - d.Mode = NTPMode(f & 0x07) - d.Stratum = NTPStratum(data[1]) - d.Poll = NTPLog2Seconds(data[2]) - d.Precision = NTPLog2Seconds(data[3]) - - // The remaining fields can just be copied in big endian order. - d.RootDelay = NTPFixed16Seconds(binary.BigEndian.Uint32(data[4:8])) - d.RootDispersion = NTPFixed16Seconds(binary.BigEndian.Uint32(data[8:12])) - d.ReferenceID = NTPReferenceID(binary.BigEndian.Uint32(data[12:16])) - d.ReferenceTimestamp = NTPTimestamp(binary.BigEndian.Uint64(data[16:24])) - d.OriginTimestamp = NTPTimestamp(binary.BigEndian.Uint64(data[24:32])) - d.ReceiveTimestamp = NTPTimestamp(binary.BigEndian.Uint64(data[32:40])) - d.TransmitTimestamp = NTPTimestamp(binary.BigEndian.Uint64(data[40:48])) - - // This layer does not attempt to analyse the extension bytes. - // But if there are any, we'd like the user to know. So we just - // place them all in an ExtensionBytes field. - d.ExtensionBytes = data[48:] - - // Return no error. - return nil -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (d *NTP) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - data, err := b.PrependBytes(ntpMinimumRecordSizeInBytes) - if err != nil { - return err - } - - // Pack the first few fields into the first 32 bits. - h := uint8(0) - h |= (uint8(d.LeapIndicator) << 6) & 0xC0 - h |= (uint8(d.Version) << 3) & 0x38 - h |= (uint8(d.Mode)) & 0x07 - data[0] = byte(h) - data[1] = byte(d.Stratum) - data[2] = byte(d.Poll) - data[3] = byte(d.Precision) - - // The remaining fields can just be copied in big endian order. - binary.BigEndian.PutUint32(data[4:8], uint32(d.RootDelay)) - binary.BigEndian.PutUint32(data[8:12], uint32(d.RootDispersion)) - binary.BigEndian.PutUint32(data[12:16], uint32(d.ReferenceID)) - binary.BigEndian.PutUint64(data[16:24], uint64(d.ReferenceTimestamp)) - binary.BigEndian.PutUint64(data[24:32], uint64(d.OriginTimestamp)) - binary.BigEndian.PutUint64(data[32:40], uint64(d.ReceiveTimestamp)) - binary.BigEndian.PutUint64(data[40:48], uint64(d.TransmitTimestamp)) - - ex, err := b.AppendBytes(len(d.ExtensionBytes)) - if err != nil { - return err - } - copy(ex, d.ExtensionBytes) - - return nil -} - -//****************************************************************************** - -// CanDecode returns a set of layers that NTP objects can decode. -// As NTP objects can only decide the NTP layer, we can return just that layer. -// Apparently a single layer type implements LayerClass. -func (d *NTP) CanDecode() gopacket.LayerClass { - return LayerTypeNTP -} - -//****************************************************************************** - -// NextLayerType specifies the next layer that GoPacket should attempt to -// analyse after this (NTP) layer. As NTP packets do not contain any payload -// bytes, there are no further layers to analyse. -func (d *NTP) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypeZero -} - -//****************************************************************************** - -// NTP packets do not carry any data payload, so the empty byte slice is retured. -// In Go, a nil slice is functionally identical to an empty slice, so we -// return nil to avoid a heap allocation. -func (d *NTP) Payload() []byte { - return nil -} - -//****************************************************************************** -//* End Of NTP File * -//****************************************************************************** diff --git a/vendor/github.com/google/gopacket/layers/ospf.go b/vendor/github.com/google/gopacket/layers/ospf.go deleted file mode 100644 index 4f5473d06..000000000 --- a/vendor/github.com/google/gopacket/layers/ospf.go +++ /dev/null @@ -1,715 +0,0 @@ -// Copyright 2017 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - "fmt" - - "github.com/google/gopacket" -) - -// OSPFType denotes what kind of OSPF type it is -type OSPFType uint8 - -// Potential values for OSPF.Type. -const ( - OSPFHello OSPFType = 1 - OSPFDatabaseDescription OSPFType = 2 - OSPFLinkStateRequest OSPFType = 3 - OSPFLinkStateUpdate OSPFType = 4 - OSPFLinkStateAcknowledgment OSPFType = 5 -) - -// LSA Function Codes for LSAheader.LSType -const ( - RouterLSAtypeV2 = 0x1 - RouterLSAtype = 0x2001 - NetworkLSAtypeV2 = 0x2 - NetworkLSAtype = 0x2002 - SummaryLSANetworktypeV2 = 0x3 - InterAreaPrefixLSAtype = 0x2003 - SummaryLSAASBRtypeV2 = 0x4 - InterAreaRouterLSAtype = 0x2004 - ASExternalLSAtypeV2 = 0x5 - ASExternalLSAtype = 0x4005 - NSSALSAtype = 0x2007 - NSSALSAtypeV2 = 0x7 - LinkLSAtype = 0x0008 - IntraAreaPrefixLSAtype = 0x2009 -) - -// String conversions for OSPFType -func (i OSPFType) String() string { - switch i { - case OSPFHello: - return "Hello" - case OSPFDatabaseDescription: - return "Database Description" - case OSPFLinkStateRequest: - return "Link State Request" - case OSPFLinkStateUpdate: - return "Link State Update" - case OSPFLinkStateAcknowledgment: - return "Link State Acknowledgment" - default: - return "" - } -} - -// Prefix extends IntraAreaPrefixLSA -type Prefix struct { - PrefixLength uint8 - PrefixOptions uint8 - Metric uint16 - AddressPrefix []byte -} - -// IntraAreaPrefixLSA is the struct from RFC 5340 A.4.10. -type IntraAreaPrefixLSA struct { - NumOfPrefixes uint16 - RefLSType uint16 - RefLinkStateID uint32 - RefAdvRouter uint32 - Prefixes []Prefix -} - -// LinkLSA is the struct from RFC 5340 A.4.9. -type LinkLSA struct { - RtrPriority uint8 - Options uint32 - LinkLocalAddress []byte - NumOfPrefixes uint32 - Prefixes []Prefix -} - -// ASExternalLSAV2 is the struct from RFC 2328 A.4.5. -type ASExternalLSAV2 struct { - NetworkMask uint32 - ExternalBit uint8 - Metric uint32 - ForwardingAddress uint32 - ExternalRouteTag uint32 -} - -// ASExternalLSA is the struct from RFC 5340 A.4.7. -type ASExternalLSA struct { - Flags uint8 - Metric uint32 - PrefixLength uint8 - PrefixOptions uint8 - RefLSType uint16 - AddressPrefix []byte - ForwardingAddress []byte - ExternalRouteTag uint32 - RefLinkStateID uint32 -} - -// InterAreaRouterLSA is the struct from RFC 5340 A.4.6. -type InterAreaRouterLSA struct { - Options uint32 - Metric uint32 - DestinationRouterID uint32 -} - -// InterAreaPrefixLSA is the struct from RFC 5340 A.4.5. -type InterAreaPrefixLSA struct { - Metric uint32 - PrefixLength uint8 - PrefixOptions uint8 - AddressPrefix []byte -} - -// NetworkLSA is the struct from RFC 5340 A.4.4. -type NetworkLSA struct { - Options uint32 - AttachedRouter []uint32 -} - -// NetworkLSAV2 is the struct from RFC 2328 A.4.3. -type NetworkLSAV2 struct { - NetworkMask uint32 - AttachedRouter []uint32 -} - -// RouterV2 extends RouterLSAV2 -type RouterV2 struct { - Type uint8 - LinkID uint32 - LinkData uint32 - Metric uint16 -} - -// RouterLSAV2 is the struct from RFC 2328 A.4.2. -type RouterLSAV2 struct { - Flags uint8 - Links uint16 - Routers []RouterV2 -} - -// Router extends RouterLSA -type Router struct { - Type uint8 - Metric uint16 - InterfaceID uint32 - NeighborInterfaceID uint32 - NeighborRouterID uint32 -} - -// RouterLSA is the struct from RFC 5340 A.4.3. -type RouterLSA struct { - Flags uint8 - Options uint32 - Routers []Router -} - -// LSAheader is the struct from RFC 5340 A.4.2 and RFC 2328 A.4.1. -type LSAheader struct { - LSAge uint16 - LSType uint16 - LinkStateID uint32 - AdvRouter uint32 - LSSeqNumber uint32 - LSChecksum uint16 - Length uint16 - LSOptions uint8 -} - -// LSA links LSAheader with the structs from RFC 5340 A.4. -type LSA struct { - LSAheader - Content interface{} -} - -// LSUpdate is the struct from RFC 5340 A.3.5. -type LSUpdate struct { - NumOfLSAs uint32 - LSAs []LSA -} - -// LSReq is the struct from RFC 5340 A.3.4. -type LSReq struct { - LSType uint16 - LSID uint32 - AdvRouter uint32 -} - -// DbDescPkg is the struct from RFC 5340 A.3.3. -type DbDescPkg struct { - Options uint32 - InterfaceMTU uint16 - Flags uint16 - DDSeqNumber uint32 - LSAinfo []LSAheader -} - -// HelloPkg is the struct from RFC 5340 A.3.2. -type HelloPkg struct { - InterfaceID uint32 - RtrPriority uint8 - Options uint32 - HelloInterval uint16 - RouterDeadInterval uint32 - DesignatedRouterID uint32 - BackupDesignatedRouterID uint32 - NeighborID []uint32 -} - -// HelloPkgV2 extends the HelloPkg struct with OSPFv2 information -type HelloPkgV2 struct { - HelloPkg - NetworkMask uint32 -} - -// OSPF is a basic OSPF packet header with common fields of Version 2 and Version 3. -type OSPF struct { - Version uint8 - Type OSPFType - PacketLength uint16 - RouterID uint32 - AreaID uint32 - Checksum uint16 - Content interface{} -} - -//OSPFv2 extend the OSPF head with version 2 specific fields -type OSPFv2 struct { - BaseLayer - OSPF - AuType uint16 - Authentication uint64 -} - -// OSPFv3 extend the OSPF head with version 3 specific fields -type OSPFv3 struct { - BaseLayer - OSPF - Instance uint8 - Reserved uint8 -} - -// getLSAsv2 parses the LSA information from the packet for OSPFv2 -func getLSAsv2(num uint32, data []byte) ([]LSA, error) { - var lsas []LSA - var i uint32 = 0 - var offset uint32 = 0 - for ; i < num; i++ { - lstype := uint16(data[offset+3]) - lsalength := binary.BigEndian.Uint16(data[offset+18 : offset+20]) - content, err := extractLSAInformation(lstype, lsalength, data[offset:]) - if err != nil { - return nil, fmt.Errorf("Could not extract Link State type.") - } - lsa := LSA{ - LSAheader: LSAheader{ - LSAge: binary.BigEndian.Uint16(data[offset : offset+2]), - LSOptions: data[offset+2], - LSType: lstype, - LinkStateID: binary.BigEndian.Uint32(data[offset+4 : offset+8]), - AdvRouter: binary.BigEndian.Uint32(data[offset+8 : offset+12]), - LSSeqNumber: binary.BigEndian.Uint32(data[offset+12 : offset+16]), - LSChecksum: binary.BigEndian.Uint16(data[offset+16 : offset+18]), - Length: lsalength, - }, - Content: content, - } - lsas = append(lsas, lsa) - offset += uint32(lsalength) - } - return lsas, nil -} - -// extractLSAInformation extracts all the LSA information -func extractLSAInformation(lstype, lsalength uint16, data []byte) (interface{}, error) { - if lsalength < 20 { - return nil, fmt.Errorf("Link State header length %v too short, %v required", lsalength, 20) - } - if len(data) < int(lsalength) { - return nil, fmt.Errorf("Link State header length %v too short, %v required", len(data), lsalength) - } - var content interface{} - switch lstype { - case RouterLSAtypeV2: - var routers []RouterV2 - var j uint32 - for j = 24; j < uint32(lsalength); j += 12 { - if len(data) < int(j+12) { - return nil, errors.New("LSAtypeV2 too small") - } - router := RouterV2{ - LinkID: binary.BigEndian.Uint32(data[j : j+4]), - LinkData: binary.BigEndian.Uint32(data[j+4 : j+8]), - Type: uint8(data[j+8]), - Metric: binary.BigEndian.Uint16(data[j+10 : j+12]), - } - routers = append(routers, router) - } - if len(data) < 24 { - return nil, errors.New("LSAtypeV2 too small") - } - links := binary.BigEndian.Uint16(data[22:24]) - content = RouterLSAV2{ - Flags: data[20], - Links: links, - Routers: routers, - } - case NSSALSAtypeV2: - fallthrough - case ASExternalLSAtypeV2: - content = ASExternalLSAV2{ - NetworkMask: binary.BigEndian.Uint32(data[20:24]), - ExternalBit: data[24] & 0x80, - Metric: binary.BigEndian.Uint32(data[24:28]) & 0x00FFFFFF, - ForwardingAddress: binary.BigEndian.Uint32(data[28:32]), - ExternalRouteTag: binary.BigEndian.Uint32(data[32:36]), - } - case NetworkLSAtypeV2: - var routers []uint32 - var j uint32 - for j = 24; j < uint32(lsalength); j += 4 { - routers = append(routers, binary.BigEndian.Uint32(data[j:j+4])) - } - content = NetworkLSAV2{ - NetworkMask: binary.BigEndian.Uint32(data[20:24]), - AttachedRouter: routers, - } - case RouterLSAtype: - var routers []Router - var j uint32 - for j = 24; j < uint32(lsalength); j += 16 { - router := Router{ - Type: uint8(data[j]), - Metric: binary.BigEndian.Uint16(data[j+2 : j+4]), - InterfaceID: binary.BigEndian.Uint32(data[j+4 : j+8]), - NeighborInterfaceID: binary.BigEndian.Uint32(data[j+8 : j+12]), - NeighborRouterID: binary.BigEndian.Uint32(data[j+12 : j+16]), - } - routers = append(routers, router) - } - content = RouterLSA{ - Flags: uint8(data[20]), - Options: binary.BigEndian.Uint32(data[20:24]) & 0x00FFFFFF, - Routers: routers, - } - case NetworkLSAtype: - var routers []uint32 - var j uint32 - for j = 24; j < uint32(lsalength); j += 4 { - routers = append(routers, binary.BigEndian.Uint32(data[j:j+4])) - } - content = NetworkLSA{ - Options: binary.BigEndian.Uint32(data[20:24]) & 0x00FFFFFF, - AttachedRouter: routers, - } - case InterAreaPrefixLSAtype: - content = InterAreaPrefixLSA{ - Metric: binary.BigEndian.Uint32(data[20:24]) & 0x00FFFFFF, - PrefixLength: uint8(data[24]), - PrefixOptions: uint8(data[25]), - AddressPrefix: data[28:uint32(lsalength)], - } - case InterAreaRouterLSAtype: - content = InterAreaRouterLSA{ - Options: binary.BigEndian.Uint32(data[20:24]) & 0x00FFFFFF, - Metric: binary.BigEndian.Uint32(data[24:28]) & 0x00FFFFFF, - DestinationRouterID: binary.BigEndian.Uint32(data[28:32]), - } - case ASExternalLSAtype: - fallthrough - case NSSALSAtype: - flags := uint8(data[20]) - prefixLen := uint8(data[24]) / 8 - var forwardingAddress []byte - if (flags & 0x02) == 0x02 { - forwardingAddress = data[28+uint32(prefixLen) : 28+uint32(prefixLen)+16] - } - content = ASExternalLSA{ - Flags: flags, - Metric: binary.BigEndian.Uint32(data[20:24]) & 0x00FFFFFF, - PrefixLength: prefixLen, - PrefixOptions: uint8(data[25]), - RefLSType: binary.BigEndian.Uint16(data[26:28]), - AddressPrefix: data[28 : 28+uint32(prefixLen)], - ForwardingAddress: forwardingAddress, - } - case LinkLSAtype: - var prefixes []Prefix - var prefixOffset uint32 = 44 - var j uint32 - numOfPrefixes := binary.BigEndian.Uint32(data[40:44]) - for j = 0; j < numOfPrefixes; j++ { - prefixLen := uint8(data[prefixOffset]) - prefix := Prefix{ - PrefixLength: prefixLen, - PrefixOptions: uint8(data[prefixOffset+1]), - AddressPrefix: data[prefixOffset+4 : prefixOffset+4+uint32(prefixLen)/8], - } - prefixes = append(prefixes, prefix) - prefixOffset = prefixOffset + 4 + uint32(prefixLen)/8 - } - content = LinkLSA{ - RtrPriority: uint8(data[20]), - Options: binary.BigEndian.Uint32(data[20:24]) & 0x00FFFFFF, - LinkLocalAddress: data[24:40], - NumOfPrefixes: numOfPrefixes, - Prefixes: prefixes, - } - case IntraAreaPrefixLSAtype: - var prefixes []Prefix - var prefixOffset uint32 = 32 - var j uint16 - numOfPrefixes := binary.BigEndian.Uint16(data[20:22]) - for j = 0; j < numOfPrefixes; j++ { - prefixLen := uint8(data[prefixOffset]) - prefix := Prefix{ - PrefixLength: prefixLen, - PrefixOptions: uint8(data[prefixOffset+1]), - Metric: binary.BigEndian.Uint16(data[prefixOffset+2 : prefixOffset+4]), - AddressPrefix: data[prefixOffset+4 : prefixOffset+4+uint32(prefixLen)/8], - } - prefixes = append(prefixes, prefix) - prefixOffset = prefixOffset + 4 + uint32(prefixLen) - } - content = IntraAreaPrefixLSA{ - NumOfPrefixes: numOfPrefixes, - RefLSType: binary.BigEndian.Uint16(data[22:24]), - RefLinkStateID: binary.BigEndian.Uint32(data[24:28]), - RefAdvRouter: binary.BigEndian.Uint32(data[28:32]), - Prefixes: prefixes, - } - default: - return nil, fmt.Errorf("Unknown Link State type.") - } - return content, nil -} - -// getLSAs parses the LSA information from the packet for OSPFv3 -func getLSAs(num uint32, data []byte) ([]LSA, error) { - var lsas []LSA - var i uint32 = 0 - var offset uint32 = 0 - for ; i < num; i++ { - var content interface{} - lstype := binary.BigEndian.Uint16(data[offset+2 : offset+4]) - lsalength := binary.BigEndian.Uint16(data[offset+18 : offset+20]) - - content, err := extractLSAInformation(lstype, lsalength, data[offset:]) - if err != nil { - return nil, fmt.Errorf("Could not extract Link State type.") - } - lsa := LSA{ - LSAheader: LSAheader{ - LSAge: binary.BigEndian.Uint16(data[offset : offset+2]), - LSType: lstype, - LinkStateID: binary.BigEndian.Uint32(data[offset+4 : offset+8]), - AdvRouter: binary.BigEndian.Uint32(data[offset+8 : offset+12]), - LSSeqNumber: binary.BigEndian.Uint32(data[offset+12 : offset+16]), - LSChecksum: binary.BigEndian.Uint16(data[offset+16 : offset+18]), - Length: lsalength, - }, - Content: content, - } - lsas = append(lsas, lsa) - offset += uint32(lsalength) - } - return lsas, nil -} - -// DecodeFromBytes decodes the given bytes into the OSPF layer. -func (ospf *OSPFv2) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 24 { - return fmt.Errorf("Packet too smal for OSPF Version 2") - } - - ospf.Version = uint8(data[0]) - ospf.Type = OSPFType(data[1]) - ospf.PacketLength = binary.BigEndian.Uint16(data[2:4]) - ospf.RouterID = binary.BigEndian.Uint32(data[4:8]) - ospf.AreaID = binary.BigEndian.Uint32(data[8:12]) - ospf.Checksum = binary.BigEndian.Uint16(data[12:14]) - ospf.AuType = binary.BigEndian.Uint16(data[14:16]) - ospf.Authentication = binary.BigEndian.Uint64(data[16:24]) - - switch ospf.Type { - case OSPFHello: - var neighbors []uint32 - for i := 44; uint16(i+4) <= ospf.PacketLength; i += 4 { - neighbors = append(neighbors, binary.BigEndian.Uint32(data[i:i+4])) - } - ospf.Content = HelloPkgV2{ - NetworkMask: binary.BigEndian.Uint32(data[24:28]), - HelloPkg: HelloPkg{ - HelloInterval: binary.BigEndian.Uint16(data[28:30]), - Options: uint32(data[30]), - RtrPriority: uint8(data[31]), - RouterDeadInterval: binary.BigEndian.Uint32(data[32:36]), - DesignatedRouterID: binary.BigEndian.Uint32(data[36:40]), - BackupDesignatedRouterID: binary.BigEndian.Uint32(data[40:44]), - NeighborID: neighbors, - }, - } - case OSPFDatabaseDescription: - var lsas []LSAheader - for i := 32; uint16(i+20) <= ospf.PacketLength; i += 20 { - lsa := LSAheader{ - LSAge: binary.BigEndian.Uint16(data[i : i+2]), - LSType: binary.BigEndian.Uint16(data[i+2 : i+4]), - LinkStateID: binary.BigEndian.Uint32(data[i+4 : i+8]), - AdvRouter: binary.BigEndian.Uint32(data[i+8 : i+12]), - LSSeqNumber: binary.BigEndian.Uint32(data[i+12 : i+16]), - LSChecksum: binary.BigEndian.Uint16(data[i+16 : i+18]), - Length: binary.BigEndian.Uint16(data[i+18 : i+20]), - } - lsas = append(lsas, lsa) - } - ospf.Content = DbDescPkg{ - InterfaceMTU: binary.BigEndian.Uint16(data[24:26]), - Options: uint32(data[26]), - Flags: uint16(data[27]), - DDSeqNumber: binary.BigEndian.Uint32(data[28:32]), - LSAinfo: lsas, - } - case OSPFLinkStateRequest: - var lsrs []LSReq - for i := 24; uint16(i+12) <= ospf.PacketLength; i += 12 { - lsr := LSReq{ - LSType: binary.BigEndian.Uint16(data[i+2 : i+4]), - LSID: binary.BigEndian.Uint32(data[i+4 : i+8]), - AdvRouter: binary.BigEndian.Uint32(data[i+8 : i+12]), - } - lsrs = append(lsrs, lsr) - } - ospf.Content = lsrs - case OSPFLinkStateUpdate: - num := binary.BigEndian.Uint32(data[24:28]) - - lsas, err := getLSAsv2(num, data[28:]) - if err != nil { - return fmt.Errorf("Cannot parse Link State Update packet: %v", err) - } - ospf.Content = LSUpdate{ - NumOfLSAs: num, - LSAs: lsas, - } - case OSPFLinkStateAcknowledgment: - var lsas []LSAheader - for i := 24; uint16(i+20) <= ospf.PacketLength; i += 20 { - lsa := LSAheader{ - LSAge: binary.BigEndian.Uint16(data[i : i+2]), - LSOptions: data[i+2], - LSType: uint16(data[i+3]), - LinkStateID: binary.BigEndian.Uint32(data[i+4 : i+8]), - AdvRouter: binary.BigEndian.Uint32(data[i+8 : i+12]), - LSSeqNumber: binary.BigEndian.Uint32(data[i+12 : i+16]), - LSChecksum: binary.BigEndian.Uint16(data[i+16 : i+18]), - Length: binary.BigEndian.Uint16(data[i+18 : i+20]), - } - lsas = append(lsas, lsa) - } - ospf.Content = lsas - } - return nil -} - -// DecodeFromBytes decodes the given bytes into the OSPF layer. -func (ospf *OSPFv3) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - - if len(data) < 16 { - return fmt.Errorf("Packet too smal for OSPF Version 3") - } - - ospf.Version = uint8(data[0]) - ospf.Type = OSPFType(data[1]) - ospf.PacketLength = binary.BigEndian.Uint16(data[2:4]) - ospf.RouterID = binary.BigEndian.Uint32(data[4:8]) - ospf.AreaID = binary.BigEndian.Uint32(data[8:12]) - ospf.Checksum = binary.BigEndian.Uint16(data[12:14]) - ospf.Instance = uint8(data[14]) - ospf.Reserved = uint8(data[15]) - - switch ospf.Type { - case OSPFHello: - var neighbors []uint32 - for i := 36; uint16(i+4) <= ospf.PacketLength; i += 4 { - neighbors = append(neighbors, binary.BigEndian.Uint32(data[i:i+4])) - } - ospf.Content = HelloPkg{ - InterfaceID: binary.BigEndian.Uint32(data[16:20]), - RtrPriority: uint8(data[20]), - Options: binary.BigEndian.Uint32(data[21:25]) >> 8, - HelloInterval: binary.BigEndian.Uint16(data[24:26]), - RouterDeadInterval: uint32(binary.BigEndian.Uint16(data[26:28])), - DesignatedRouterID: binary.BigEndian.Uint32(data[28:32]), - BackupDesignatedRouterID: binary.BigEndian.Uint32(data[32:36]), - NeighborID: neighbors, - } - case OSPFDatabaseDescription: - var lsas []LSAheader - for i := 28; uint16(i+20) <= ospf.PacketLength; i += 20 { - lsa := LSAheader{ - LSAge: binary.BigEndian.Uint16(data[i : i+2]), - LSType: binary.BigEndian.Uint16(data[i+2 : i+4]), - LinkStateID: binary.BigEndian.Uint32(data[i+4 : i+8]), - AdvRouter: binary.BigEndian.Uint32(data[i+8 : i+12]), - LSSeqNumber: binary.BigEndian.Uint32(data[i+12 : i+16]), - LSChecksum: binary.BigEndian.Uint16(data[i+16 : i+18]), - Length: binary.BigEndian.Uint16(data[i+18 : i+20]), - } - lsas = append(lsas, lsa) - } - ospf.Content = DbDescPkg{ - Options: binary.BigEndian.Uint32(data[16:20]) & 0x00FFFFFF, - InterfaceMTU: binary.BigEndian.Uint16(data[20:22]), - Flags: binary.BigEndian.Uint16(data[22:24]), - DDSeqNumber: binary.BigEndian.Uint32(data[24:28]), - LSAinfo: lsas, - } - case OSPFLinkStateRequest: - var lsrs []LSReq - for i := 16; uint16(i+12) <= ospf.PacketLength; i += 12 { - lsr := LSReq{ - LSType: binary.BigEndian.Uint16(data[i+2 : i+4]), - LSID: binary.BigEndian.Uint32(data[i+4 : i+8]), - AdvRouter: binary.BigEndian.Uint32(data[i+8 : i+12]), - } - lsrs = append(lsrs, lsr) - } - ospf.Content = lsrs - case OSPFLinkStateUpdate: - num := binary.BigEndian.Uint32(data[16:20]) - lsas, err := getLSAs(num, data[20:]) - if err != nil { - return fmt.Errorf("Cannot parse Link State Update packet: %v", err) - } - ospf.Content = LSUpdate{ - NumOfLSAs: num, - LSAs: lsas, - } - - case OSPFLinkStateAcknowledgment: - var lsas []LSAheader - for i := 16; uint16(i+20) <= ospf.PacketLength; i += 20 { - lsa := LSAheader{ - LSAge: binary.BigEndian.Uint16(data[i : i+2]), - LSType: binary.BigEndian.Uint16(data[i+2 : i+4]), - LinkStateID: binary.BigEndian.Uint32(data[i+4 : i+8]), - AdvRouter: binary.BigEndian.Uint32(data[i+8 : i+12]), - LSSeqNumber: binary.BigEndian.Uint32(data[i+12 : i+16]), - LSChecksum: binary.BigEndian.Uint16(data[i+16 : i+18]), - Length: binary.BigEndian.Uint16(data[i+18 : i+20]), - } - lsas = append(lsas, lsa) - } - ospf.Content = lsas - default: - } - - return nil -} - -// LayerType returns LayerTypeOSPF -func (ospf *OSPFv2) LayerType() gopacket.LayerType { - return LayerTypeOSPF -} -func (ospf *OSPFv3) LayerType() gopacket.LayerType { - return LayerTypeOSPF -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (ospf *OSPFv2) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypeZero -} -func (ospf *OSPFv3) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypeZero -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (ospf *OSPFv2) CanDecode() gopacket.LayerClass { - return LayerTypeOSPF -} -func (ospf *OSPFv3) CanDecode() gopacket.LayerClass { - return LayerTypeOSPF -} - -func decodeOSPF(data []byte, p gopacket.PacketBuilder) error { - if len(data) < 14 { - return fmt.Errorf("Packet too smal for OSPF") - } - - switch uint8(data[0]) { - case 2: - ospf := &OSPFv2{} - return decodingLayerDecoder(ospf, data, p) - case 3: - ospf := &OSPFv3{} - return decodingLayerDecoder(ospf, data, p) - default: - } - - return fmt.Errorf("Unable to determine OSPF type.") -} diff --git a/vendor/github.com/google/gopacket/layers/pflog.go b/vendor/github.com/google/gopacket/layers/pflog.go deleted file mode 100644 index 9dbbd90d1..000000000 --- a/vendor/github.com/google/gopacket/layers/pflog.go +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - "fmt" - - "github.com/google/gopacket" -) - -type PFDirection uint8 - -const ( - PFDirectionInOut PFDirection = 0 - PFDirectionIn PFDirection = 1 - PFDirectionOut PFDirection = 2 -) - -// PFLog provides the layer for 'pf' packet-filter logging, as described at -// http://www.freebsd.org/cgi/man.cgi?query=pflog&sektion=4 -type PFLog struct { - BaseLayer - Length uint8 - Family ProtocolFamily - Action, Reason uint8 - IFName, Ruleset []byte - RuleNum, SubruleNum uint32 - UID uint32 - PID int32 - RuleUID uint32 - RulePID int32 - Direction PFDirection - // The remainder is padding -} - -func (pf *PFLog) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 60 { - df.SetTruncated() - return errors.New("PFLog data less than 60 bytes") - } - pf.Length = data[0] - pf.Family = ProtocolFamily(data[1]) - pf.Action = data[2] - pf.Reason = data[3] - pf.IFName = data[4:20] - pf.Ruleset = data[20:36] - pf.RuleNum = binary.BigEndian.Uint32(data[36:40]) - pf.SubruleNum = binary.BigEndian.Uint32(data[40:44]) - pf.UID = binary.BigEndian.Uint32(data[44:48]) - pf.PID = int32(binary.BigEndian.Uint32(data[48:52])) - pf.RuleUID = binary.BigEndian.Uint32(data[52:56]) - pf.RulePID = int32(binary.BigEndian.Uint32(data[56:60])) - pf.Direction = PFDirection(data[60]) - if pf.Length%4 != 1 { - return errors.New("PFLog header length should be 3 less than multiple of 4") - } - actualLength := int(pf.Length) + 3 - if len(data) < actualLength { - return fmt.Errorf("PFLog data size < %d", actualLength) - } - pf.Contents = data[:actualLength] - pf.Payload = data[actualLength:] - return nil -} - -// LayerType returns layers.LayerTypePFLog -func (pf *PFLog) LayerType() gopacket.LayerType { return LayerTypePFLog } - -func (pf *PFLog) CanDecode() gopacket.LayerClass { return LayerTypePFLog } - -func (pf *PFLog) NextLayerType() gopacket.LayerType { - return pf.Family.LayerType() -} - -func decodePFLog(data []byte, p gopacket.PacketBuilder) error { - pf := &PFLog{} - return decodingLayerDecoder(pf, data, p) -} diff --git a/vendor/github.com/google/gopacket/layers/ports.go b/vendor/github.com/google/gopacket/layers/ports.go deleted file mode 100644 index 1e3f42efc..000000000 --- a/vendor/github.com/google/gopacket/layers/ports.go +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "fmt" - "strconv" - - "github.com/google/gopacket" -) - -// TCPPort is a port in a TCP layer. -type TCPPort uint16 - -// UDPPort is a port in a UDP layer. -type UDPPort uint16 - -// RUDPPort is a port in a RUDP layer. -type RUDPPort uint8 - -// SCTPPort is a port in a SCTP layer. -type SCTPPort uint16 - -// UDPLitePort is a port in a UDPLite layer. -type UDPLitePort uint16 - -// RUDPPortNames contains the string names for all RUDP ports. -var RUDPPortNames = map[RUDPPort]string{} - -// UDPLitePortNames contains the string names for all UDPLite ports. -var UDPLitePortNames = map[UDPLitePort]string{} - -// {TCP,UDP,SCTP}PortNames can be found in iana_ports.go - -// String returns the port as "number(name)" if there's a well-known port name, -// or just "number" if there isn't. Well-known names are stored in -// TCPPortNames. -func (a TCPPort) String() string { - if name, ok := TCPPortNames[a]; ok { - return fmt.Sprintf("%d(%s)", a, name) - } - return strconv.Itoa(int(a)) -} - -// LayerType returns a LayerType that would be able to decode the -// application payload. It uses some well-known ports such as 53 for -// DNS. -// -// Returns gopacket.LayerTypePayload for unknown/unsupported port numbers. -func (a TCPPort) LayerType() gopacket.LayerType { - lt := tcpPortLayerType[uint16(a)] - if lt != 0 { - return lt - } - return gopacket.LayerTypePayload -} - -var tcpPortLayerType = [65536]gopacket.LayerType{ - 53: LayerTypeDNS, - 443: LayerTypeTLS, // https - 502: LayerTypeModbusTCP, // modbustcp - 636: LayerTypeTLS, // ldaps - 989: LayerTypeTLS, // ftps-data - 990: LayerTypeTLS, // ftps - 992: LayerTypeTLS, // telnets - 993: LayerTypeTLS, // imaps - 994: LayerTypeTLS, // ircs - 995: LayerTypeTLS, // pop3s - 5061: LayerTypeTLS, // ips -} - -// RegisterTCPPortLayerType creates a new mapping between a TCPPort -// and an underlaying LayerType. -func RegisterTCPPortLayerType(port TCPPort, layerType gopacket.LayerType) { - tcpPortLayerType[port] = layerType -} - -// String returns the port as "number(name)" if there's a well-known port name, -// or just "number" if there isn't. Well-known names are stored in -// UDPPortNames. -func (a UDPPort) String() string { - if name, ok := UDPPortNames[a]; ok { - return fmt.Sprintf("%d(%s)", a, name) - } - return strconv.Itoa(int(a)) -} - -// LayerType returns a LayerType that would be able to decode the -// application payload. It uses some well-known ports such as 53 for -// DNS. -// -// Returns gopacket.LayerTypePayload for unknown/unsupported port numbers. -func (a UDPPort) LayerType() gopacket.LayerType { - lt := udpPortLayerType[uint16(a)] - if lt != 0 { - return lt - } - return gopacket.LayerTypePayload -} - -var udpPortLayerType = [65536]gopacket.LayerType{ - 53: LayerTypeDNS, - 123: LayerTypeNTP, - 4789: LayerTypeVXLAN, - 67: LayerTypeDHCPv4, - 68: LayerTypeDHCPv4, - 546: LayerTypeDHCPv6, - 547: LayerTypeDHCPv6, - 5060: LayerTypeSIP, - 6343: LayerTypeSFlow, - 6081: LayerTypeGeneve, - 3784: LayerTypeBFD, - 2152: LayerTypeGTPv1U, - 623: LayerTypeRMCP, - 1812: LayerTypeRADIUS, -} - -// RegisterUDPPortLayerType creates a new mapping between a UDPPort -// and an underlaying LayerType. -func RegisterUDPPortLayerType(port UDPPort, layerType gopacket.LayerType) { - udpPortLayerType[port] = layerType -} - -// String returns the port as "number(name)" if there's a well-known port name, -// or just "number" if there isn't. Well-known names are stored in -// RUDPPortNames. -func (a RUDPPort) String() string { - if name, ok := RUDPPortNames[a]; ok { - return fmt.Sprintf("%d(%s)", a, name) - } - return strconv.Itoa(int(a)) -} - -// String returns the port as "number(name)" if there's a well-known port name, -// or just "number" if there isn't. Well-known names are stored in -// SCTPPortNames. -func (a SCTPPort) String() string { - if name, ok := SCTPPortNames[a]; ok { - return fmt.Sprintf("%d(%s)", a, name) - } - return strconv.Itoa(int(a)) -} - -// String returns the port as "number(name)" if there's a well-known port name, -// or just "number" if there isn't. Well-known names are stored in -// UDPLitePortNames. -func (a UDPLitePort) String() string { - if name, ok := UDPLitePortNames[a]; ok { - return fmt.Sprintf("%d(%s)", a, name) - } - return strconv.Itoa(int(a)) -} diff --git a/vendor/github.com/google/gopacket/layers/ppp.go b/vendor/github.com/google/gopacket/layers/ppp.go deleted file mode 100644 index e534d698c..000000000 --- a/vendor/github.com/google/gopacket/layers/ppp.go +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - "github.com/google/gopacket" -) - -// PPP is the layer for PPP encapsulation headers. -type PPP struct { - BaseLayer - PPPType PPPType - HasPPTPHeader bool -} - -// PPPEndpoint is a singleton endpoint for PPP. Since there is no actual -// addressing for the two ends of a PPP connection, we use a singleton value -// named 'point' for each endpoint. -var PPPEndpoint = gopacket.NewEndpoint(EndpointPPP, nil) - -// PPPFlow is a singleton flow for PPP. Since there is no actual addressing for -// the two ends of a PPP connection, we use a singleton value to represent the -// flow for all PPP connections. -var PPPFlow = gopacket.NewFlow(EndpointPPP, nil, nil) - -// LayerType returns LayerTypePPP -func (p *PPP) LayerType() gopacket.LayerType { return LayerTypePPP } - -// LinkFlow returns PPPFlow. -func (p *PPP) LinkFlow() gopacket.Flow { return PPPFlow } - -func decodePPP(data []byte, p gopacket.PacketBuilder) error { - ppp := &PPP{} - offset := 0 - if data[0] == 0xff && data[1] == 0x03 { - offset = 2 - ppp.HasPPTPHeader = true - } - if data[offset]&0x1 == 0 { - if data[offset+1]&0x1 == 0 { - return errors.New("PPP has invalid type") - } - ppp.PPPType = PPPType(binary.BigEndian.Uint16(data[offset : offset+2])) - ppp.Contents = data[offset : offset+2] - ppp.Payload = data[offset+2:] - } else { - ppp.PPPType = PPPType(data[offset]) - ppp.Contents = data[offset : offset+1] - ppp.Payload = data[offset+1:] - } - p.AddLayer(ppp) - p.SetLinkLayer(ppp) - return p.NextDecoder(ppp.PPPType) -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (p *PPP) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - if p.PPPType&0x100 == 0 { - bytes, err := b.PrependBytes(2) - if err != nil { - return err - } - binary.BigEndian.PutUint16(bytes, uint16(p.PPPType)) - } else { - bytes, err := b.PrependBytes(1) - if err != nil { - return err - } - bytes[0] = uint8(p.PPPType) - } - if p.HasPPTPHeader { - bytes, err := b.PrependBytes(2) - if err != nil { - return err - } - bytes[0] = 0xff - bytes[1] = 0x03 - } - return nil -} diff --git a/vendor/github.com/google/gopacket/layers/pppoe.go b/vendor/github.com/google/gopacket/layers/pppoe.go deleted file mode 100644 index 14cd63a18..000000000 --- a/vendor/github.com/google/gopacket/layers/pppoe.go +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "github.com/google/gopacket" -) - -// PPPoE is the layer for PPPoE encapsulation headers. -type PPPoE struct { - BaseLayer - Version uint8 - Type uint8 - Code PPPoECode - SessionId uint16 - Length uint16 -} - -// LayerType returns gopacket.LayerTypePPPoE. -func (p *PPPoE) LayerType() gopacket.LayerType { - return LayerTypePPPoE -} - -// decodePPPoE decodes the PPPoE header (see http://tools.ietf.org/html/rfc2516). -func decodePPPoE(data []byte, p gopacket.PacketBuilder) error { - pppoe := &PPPoE{ - Version: data[0] >> 4, - Type: data[0] & 0x0F, - Code: PPPoECode(data[1]), - SessionId: binary.BigEndian.Uint16(data[2:4]), - Length: binary.BigEndian.Uint16(data[4:6]), - } - pppoe.BaseLayer = BaseLayer{data[:6], data[6 : 6+pppoe.Length]} - p.AddLayer(pppoe) - return p.NextDecoder(pppoe.Code) -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (p *PPPoE) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - payload := b.Bytes() - bytes, err := b.PrependBytes(6) - if err != nil { - return err - } - bytes[0] = (p.Version << 4) | p.Type - bytes[1] = byte(p.Code) - binary.BigEndian.PutUint16(bytes[2:], p.SessionId) - if opts.FixLengths { - p.Length = uint16(len(payload)) - } - binary.BigEndian.PutUint16(bytes[4:], p.Length) - return nil -} diff --git a/vendor/github.com/google/gopacket/layers/prism.go b/vendor/github.com/google/gopacket/layers/prism.go deleted file mode 100644 index e1711e7f5..000000000 --- a/vendor/github.com/google/gopacket/layers/prism.go +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright 2015 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -// http://www.tcpdump.org/linktypes/LINKTYPE_IEEE802_11_PRISM.html - -package layers - -import ( - "encoding/binary" - "errors" - - "github.com/google/gopacket" -) - -func decodePrismValue(data []byte, pv *PrismValue) { - pv.DID = PrismDID(binary.LittleEndian.Uint32(data[0:4])) - pv.Status = binary.LittleEndian.Uint16(data[4:6]) - pv.Length = binary.LittleEndian.Uint16(data[6:8]) - pv.Data = data[8 : 8+pv.Length] -} - -type PrismDID uint32 - -const ( - PrismDIDType1HostTime PrismDID = 0x10044 - PrismDIDType2HostTime PrismDID = 0x01041 - PrismDIDType1MACTime PrismDID = 0x20044 - PrismDIDType2MACTime PrismDID = 0x02041 - PrismDIDType1Channel PrismDID = 0x30044 - PrismDIDType2Channel PrismDID = 0x03041 - PrismDIDType1RSSI PrismDID = 0x40044 - PrismDIDType2RSSI PrismDID = 0x04041 - PrismDIDType1SignalQuality PrismDID = 0x50044 - PrismDIDType2SignalQuality PrismDID = 0x05041 - PrismDIDType1Signal PrismDID = 0x60044 - PrismDIDType2Signal PrismDID = 0x06041 - PrismDIDType1Noise PrismDID = 0x70044 - PrismDIDType2Noise PrismDID = 0x07041 - PrismDIDType1Rate PrismDID = 0x80044 - PrismDIDType2Rate PrismDID = 0x08041 - PrismDIDType1TransmittedFrameIndicator PrismDID = 0x90044 - PrismDIDType2TransmittedFrameIndicator PrismDID = 0x09041 - PrismDIDType1FrameLength PrismDID = 0xA0044 - PrismDIDType2FrameLength PrismDID = 0x0A041 -) - -const ( - PrismType1MessageCode uint16 = 0x00000044 - PrismType2MessageCode uint16 = 0x00000041 -) - -func (p PrismDID) String() string { - dids := map[PrismDID]string{ - PrismDIDType1HostTime: "Host Time", - PrismDIDType2HostTime: "Host Time", - PrismDIDType1MACTime: "MAC Time", - PrismDIDType2MACTime: "MAC Time", - PrismDIDType1Channel: "Channel", - PrismDIDType2Channel: "Channel", - PrismDIDType1RSSI: "RSSI", - PrismDIDType2RSSI: "RSSI", - PrismDIDType1SignalQuality: "Signal Quality", - PrismDIDType2SignalQuality: "Signal Quality", - PrismDIDType1Signal: "Signal", - PrismDIDType2Signal: "Signal", - PrismDIDType1Noise: "Noise", - PrismDIDType2Noise: "Noise", - PrismDIDType1Rate: "Rate", - PrismDIDType2Rate: "Rate", - PrismDIDType1TransmittedFrameIndicator: "Transmitted Frame Indicator", - PrismDIDType2TransmittedFrameIndicator: "Transmitted Frame Indicator", - PrismDIDType1FrameLength: "Frame Length", - PrismDIDType2FrameLength: "Frame Length", - } - - if str, ok := dids[p]; ok { - return str - } - - return "Unknown DID" -} - -type PrismValue struct { - DID PrismDID - Status uint16 - Length uint16 - Data []byte -} - -func (pv *PrismValue) IsSupplied() bool { - return pv.Status == 1 -} - -var ErrPrismExpectedMoreData = errors.New("Expected more data.") -var ErrPrismInvalidCode = errors.New("Invalid header code.") - -func decodePrismHeader(data []byte, p gopacket.PacketBuilder) error { - d := &PrismHeader{} - return decodingLayerDecoder(d, data, p) -} - -type PrismHeader struct { - BaseLayer - Code uint16 - Length uint16 - DeviceName string - Values []PrismValue -} - -func (m *PrismHeader) LayerType() gopacket.LayerType { return LayerTypePrismHeader } - -func (m *PrismHeader) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - m.Code = binary.LittleEndian.Uint16(data[0:4]) - m.Length = binary.LittleEndian.Uint16(data[4:8]) - m.DeviceName = string(data[8:24]) - m.BaseLayer = BaseLayer{Contents: data[:m.Length], Payload: data[m.Length:len(data)]} - - switch m.Code { - case PrismType1MessageCode: - fallthrough - case PrismType2MessageCode: - // valid message code - default: - return ErrPrismInvalidCode - } - - offset := uint16(24) - - m.Values = make([]PrismValue, (m.Length-offset)/12) - for i := 0; i < len(m.Values); i++ { - decodePrismValue(data[offset:offset+12], &m.Values[i]) - offset += 12 - } - - if offset != m.Length { - return ErrPrismExpectedMoreData - } - - return nil -} - -func (m *PrismHeader) CanDecode() gopacket.LayerClass { return LayerTypePrismHeader } -func (m *PrismHeader) NextLayerType() gopacket.LayerType { return LayerTypeDot11 } diff --git a/vendor/github.com/google/gopacket/layers/radiotap.go b/vendor/github.com/google/gopacket/layers/radiotap.go deleted file mode 100644 index d09559f79..000000000 --- a/vendor/github.com/google/gopacket/layers/radiotap.go +++ /dev/null @@ -1,1076 +0,0 @@ -// Copyright 2014 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "bytes" - "encoding/binary" - "errors" - "fmt" - "hash/crc32" - "strings" - - "github.com/google/gopacket" -) - -// align calculates the number of bytes needed to align with the width -// on the offset, returning the number of bytes we need to skip to -// align to the offset (width). -func align(offset uint16, width uint16) uint16 { - return ((((offset) + ((width) - 1)) & (^((width) - 1))) - offset) -} - -type RadioTapPresent uint32 - -const ( - RadioTapPresentTSFT RadioTapPresent = 1 << iota - RadioTapPresentFlags - RadioTapPresentRate - RadioTapPresentChannel - RadioTapPresentFHSS - RadioTapPresentDBMAntennaSignal - RadioTapPresentDBMAntennaNoise - RadioTapPresentLockQuality - RadioTapPresentTxAttenuation - RadioTapPresentDBTxAttenuation - RadioTapPresentDBMTxPower - RadioTapPresentAntenna - RadioTapPresentDBAntennaSignal - RadioTapPresentDBAntennaNoise - RadioTapPresentRxFlags - RadioTapPresentTxFlags - RadioTapPresentRtsRetries - RadioTapPresentDataRetries - _ - RadioTapPresentMCS - RadioTapPresentAMPDUStatus - RadioTapPresentVHT - RadioTapPresentEXT RadioTapPresent = 1 << 31 -) - -func (r RadioTapPresent) TSFT() bool { - return r&RadioTapPresentTSFT != 0 -} -func (r RadioTapPresent) Flags() bool { - return r&RadioTapPresentFlags != 0 -} -func (r RadioTapPresent) Rate() bool { - return r&RadioTapPresentRate != 0 -} -func (r RadioTapPresent) Channel() bool { - return r&RadioTapPresentChannel != 0 -} -func (r RadioTapPresent) FHSS() bool { - return r&RadioTapPresentFHSS != 0 -} -func (r RadioTapPresent) DBMAntennaSignal() bool { - return r&RadioTapPresentDBMAntennaSignal != 0 -} -func (r RadioTapPresent) DBMAntennaNoise() bool { - return r&RadioTapPresentDBMAntennaNoise != 0 -} -func (r RadioTapPresent) LockQuality() bool { - return r&RadioTapPresentLockQuality != 0 -} -func (r RadioTapPresent) TxAttenuation() bool { - return r&RadioTapPresentTxAttenuation != 0 -} -func (r RadioTapPresent) DBTxAttenuation() bool { - return r&RadioTapPresentDBTxAttenuation != 0 -} -func (r RadioTapPresent) DBMTxPower() bool { - return r&RadioTapPresentDBMTxPower != 0 -} -func (r RadioTapPresent) Antenna() bool { - return r&RadioTapPresentAntenna != 0 -} -func (r RadioTapPresent) DBAntennaSignal() bool { - return r&RadioTapPresentDBAntennaSignal != 0 -} -func (r RadioTapPresent) DBAntennaNoise() bool { - return r&RadioTapPresentDBAntennaNoise != 0 -} -func (r RadioTapPresent) RxFlags() bool { - return r&RadioTapPresentRxFlags != 0 -} -func (r RadioTapPresent) TxFlags() bool { - return r&RadioTapPresentTxFlags != 0 -} -func (r RadioTapPresent) RtsRetries() bool { - return r&RadioTapPresentRtsRetries != 0 -} -func (r RadioTapPresent) DataRetries() bool { - return r&RadioTapPresentDataRetries != 0 -} -func (r RadioTapPresent) MCS() bool { - return r&RadioTapPresentMCS != 0 -} -func (r RadioTapPresent) AMPDUStatus() bool { - return r&RadioTapPresentAMPDUStatus != 0 -} -func (r RadioTapPresent) VHT() bool { - return r&RadioTapPresentVHT != 0 -} -func (r RadioTapPresent) EXT() bool { - return r&RadioTapPresentEXT != 0 -} - -type RadioTapChannelFlags uint16 - -const ( - RadioTapChannelFlagsTurbo RadioTapChannelFlags = 0x0010 // Turbo channel - RadioTapChannelFlagsCCK RadioTapChannelFlags = 0x0020 // CCK channel - RadioTapChannelFlagsOFDM RadioTapChannelFlags = 0x0040 // OFDM channel - RadioTapChannelFlagsGhz2 RadioTapChannelFlags = 0x0080 // 2 GHz spectrum channel. - RadioTapChannelFlagsGhz5 RadioTapChannelFlags = 0x0100 // 5 GHz spectrum channel - RadioTapChannelFlagsPassive RadioTapChannelFlags = 0x0200 // Only passive scan allowed - RadioTapChannelFlagsDynamic RadioTapChannelFlags = 0x0400 // Dynamic CCK-OFDM channel - RadioTapChannelFlagsGFSK RadioTapChannelFlags = 0x0800 // GFSK channel (FHSS PHY) -) - -func (r RadioTapChannelFlags) Turbo() bool { - return r&RadioTapChannelFlagsTurbo != 0 -} -func (r RadioTapChannelFlags) CCK() bool { - return r&RadioTapChannelFlagsCCK != 0 -} -func (r RadioTapChannelFlags) OFDM() bool { - return r&RadioTapChannelFlagsOFDM != 0 -} -func (r RadioTapChannelFlags) Ghz2() bool { - return r&RadioTapChannelFlagsGhz2 != 0 -} -func (r RadioTapChannelFlags) Ghz5() bool { - return r&RadioTapChannelFlagsGhz5 != 0 -} -func (r RadioTapChannelFlags) Passive() bool { - return r&RadioTapChannelFlagsPassive != 0 -} -func (r RadioTapChannelFlags) Dynamic() bool { - return r&RadioTapChannelFlagsDynamic != 0 -} -func (r RadioTapChannelFlags) GFSK() bool { - return r&RadioTapChannelFlagsGFSK != 0 -} - -// String provides a human readable string for RadioTapChannelFlags. -// This string is possibly subject to change over time; if you're storing this -// persistently, you should probably store the RadioTapChannelFlags value, not its string. -func (a RadioTapChannelFlags) String() string { - var out bytes.Buffer - if a.Turbo() { - out.WriteString("Turbo,") - } - if a.CCK() { - out.WriteString("CCK,") - } - if a.OFDM() { - out.WriteString("OFDM,") - } - if a.Ghz2() { - out.WriteString("Ghz2,") - } - if a.Ghz5() { - out.WriteString("Ghz5,") - } - if a.Passive() { - out.WriteString("Passive,") - } - if a.Dynamic() { - out.WriteString("Dynamic,") - } - if a.GFSK() { - out.WriteString("GFSK,") - } - - if length := out.Len(); length > 0 { - return string(out.Bytes()[:length-1]) // strip final comma - } - return "" -} - -type RadioTapFlags uint8 - -const ( - RadioTapFlagsCFP RadioTapFlags = 1 << iota // sent/received during CFP - RadioTapFlagsShortPreamble // sent/received * with short * preamble - RadioTapFlagsWEP // sent/received * with WEP encryption - RadioTapFlagsFrag // sent/received * with fragmentation - RadioTapFlagsFCS // frame includes FCS - RadioTapFlagsDatapad // frame has padding between * 802.11 header and payload * (to 32-bit boundary) - RadioTapFlagsBadFCS // does not pass FCS check - RadioTapFlagsShortGI // HT short GI -) - -func (r RadioTapFlags) CFP() bool { - return r&RadioTapFlagsCFP != 0 -} -func (r RadioTapFlags) ShortPreamble() bool { - return r&RadioTapFlagsShortPreamble != 0 -} -func (r RadioTapFlags) WEP() bool { - return r&RadioTapFlagsWEP != 0 -} -func (r RadioTapFlags) Frag() bool { - return r&RadioTapFlagsFrag != 0 -} -func (r RadioTapFlags) FCS() bool { - return r&RadioTapFlagsFCS != 0 -} -func (r RadioTapFlags) Datapad() bool { - return r&RadioTapFlagsDatapad != 0 -} -func (r RadioTapFlags) BadFCS() bool { - return r&RadioTapFlagsBadFCS != 0 -} -func (r RadioTapFlags) ShortGI() bool { - return r&RadioTapFlagsShortGI != 0 -} - -// String provides a human readable string for RadioTapFlags. -// This string is possibly subject to change over time; if you're storing this -// persistently, you should probably store the RadioTapFlags value, not its string. -func (a RadioTapFlags) String() string { - var out bytes.Buffer - if a.CFP() { - out.WriteString("CFP,") - } - if a.ShortPreamble() { - out.WriteString("SHORT-PREAMBLE,") - } - if a.WEP() { - out.WriteString("WEP,") - } - if a.Frag() { - out.WriteString("FRAG,") - } - if a.FCS() { - out.WriteString("FCS,") - } - if a.Datapad() { - out.WriteString("DATAPAD,") - } - if a.ShortGI() { - out.WriteString("SHORT-GI,") - } - - if length := out.Len(); length > 0 { - return string(out.Bytes()[:length-1]) // strip final comma - } - return "" -} - -type RadioTapRate uint8 - -func (a RadioTapRate) String() string { - return fmt.Sprintf("%v Mb/s", 0.5*float32(a)) -} - -type RadioTapChannelFrequency uint16 - -func (a RadioTapChannelFrequency) String() string { - return fmt.Sprintf("%d MHz", a) -} - -type RadioTapRxFlags uint16 - -const ( - RadioTapRxFlagsBadPlcp RadioTapRxFlags = 0x0002 -) - -func (self RadioTapRxFlags) BadPlcp() bool { - return self&RadioTapRxFlagsBadPlcp != 0 -} - -func (self RadioTapRxFlags) String() string { - if self.BadPlcp() { - return "BADPLCP" - } - return "" -} - -type RadioTapTxFlags uint16 - -const ( - RadioTapTxFlagsFail RadioTapTxFlags = 1 << iota - RadioTapTxFlagsCTS - RadioTapTxFlagsRTS - RadioTapTxFlagsNoACK -) - -func (self RadioTapTxFlags) Fail() bool { return self&RadioTapTxFlagsFail != 0 } -func (self RadioTapTxFlags) CTS() bool { return self&RadioTapTxFlagsCTS != 0 } -func (self RadioTapTxFlags) RTS() bool { return self&RadioTapTxFlagsRTS != 0 } -func (self RadioTapTxFlags) NoACK() bool { return self&RadioTapTxFlagsNoACK != 0 } - -func (self RadioTapTxFlags) String() string { - var tokens []string - if self.Fail() { - tokens = append(tokens, "Fail") - } - if self.CTS() { - tokens = append(tokens, "CTS") - } - if self.RTS() { - tokens = append(tokens, "RTS") - } - if self.NoACK() { - tokens = append(tokens, "NoACK") - } - return strings.Join(tokens, ",") -} - -type RadioTapMCS struct { - Known RadioTapMCSKnown - Flags RadioTapMCSFlags - MCS uint8 -} - -func (self RadioTapMCS) String() string { - var tokens []string - if self.Known.Bandwidth() { - token := "?" - switch self.Flags.Bandwidth() { - case 0: - token = "20" - case 1: - token = "40" - case 2: - token = "40(20L)" - case 3: - token = "40(20U)" - } - tokens = append(tokens, token) - } - if self.Known.MCSIndex() { - tokens = append(tokens, fmt.Sprintf("MCSIndex#%d", self.MCS)) - } - if self.Known.GuardInterval() { - if self.Flags.ShortGI() { - tokens = append(tokens, fmt.Sprintf("shortGI")) - } else { - tokens = append(tokens, fmt.Sprintf("longGI")) - } - } - if self.Known.HTFormat() { - if self.Flags.Greenfield() { - tokens = append(tokens, fmt.Sprintf("HT-greenfield")) - } else { - tokens = append(tokens, fmt.Sprintf("HT-mixed")) - } - } - if self.Known.FECType() { - if self.Flags.FECLDPC() { - tokens = append(tokens, fmt.Sprintf("LDPC")) - } else { - tokens = append(tokens, fmt.Sprintf("BCC")) - } - } - if self.Known.STBC() { - tokens = append(tokens, fmt.Sprintf("STBC#%d", self.Flags.STBC())) - } - if self.Known.NESS() { - num := 0 - if self.Known.NESS1() { - num |= 0x02 - } - if self.Flags.NESS0() { - num |= 0x01 - } - tokens = append(tokens, fmt.Sprintf("num-of-ESS#%d", num)) - } - return strings.Join(tokens, ",") -} - -type RadioTapMCSKnown uint8 - -const ( - RadioTapMCSKnownBandwidth RadioTapMCSKnown = 1 << iota - RadioTapMCSKnownMCSIndex - RadioTapMCSKnownGuardInterval - RadioTapMCSKnownHTFormat - RadioTapMCSKnownFECType - RadioTapMCSKnownSTBC - RadioTapMCSKnownNESS - RadioTapMCSKnownNESS1 -) - -func (self RadioTapMCSKnown) Bandwidth() bool { return self&RadioTapMCSKnownBandwidth != 0 } -func (self RadioTapMCSKnown) MCSIndex() bool { return self&RadioTapMCSKnownMCSIndex != 0 } -func (self RadioTapMCSKnown) GuardInterval() bool { return self&RadioTapMCSKnownGuardInterval != 0 } -func (self RadioTapMCSKnown) HTFormat() bool { return self&RadioTapMCSKnownHTFormat != 0 } -func (self RadioTapMCSKnown) FECType() bool { return self&RadioTapMCSKnownFECType != 0 } -func (self RadioTapMCSKnown) STBC() bool { return self&RadioTapMCSKnownSTBC != 0 } -func (self RadioTapMCSKnown) NESS() bool { return self&RadioTapMCSKnownNESS != 0 } -func (self RadioTapMCSKnown) NESS1() bool { return self&RadioTapMCSKnownNESS1 != 0 } - -type RadioTapMCSFlags uint8 - -const ( - RadioTapMCSFlagsBandwidthMask RadioTapMCSFlags = 0x03 - RadioTapMCSFlagsShortGI = 0x04 - RadioTapMCSFlagsGreenfield = 0x08 - RadioTapMCSFlagsFECLDPC = 0x10 - RadioTapMCSFlagsSTBCMask = 0x60 - RadioTapMCSFlagsNESS0 = 0x80 -) - -func (self RadioTapMCSFlags) Bandwidth() int { - return int(self & RadioTapMCSFlagsBandwidthMask) -} -func (self RadioTapMCSFlags) ShortGI() bool { return self&RadioTapMCSFlagsShortGI != 0 } -func (self RadioTapMCSFlags) Greenfield() bool { return self&RadioTapMCSFlagsGreenfield != 0 } -func (self RadioTapMCSFlags) FECLDPC() bool { return self&RadioTapMCSFlagsFECLDPC != 0 } -func (self RadioTapMCSFlags) STBC() int { - return int(self&RadioTapMCSFlagsSTBCMask) >> 5 -} -func (self RadioTapMCSFlags) NESS0() bool { return self&RadioTapMCSFlagsNESS0 != 0 } - -type RadioTapAMPDUStatus struct { - Reference uint32 - Flags RadioTapAMPDUStatusFlags - CRC uint8 -} - -func (self RadioTapAMPDUStatus) String() string { - tokens := []string{ - fmt.Sprintf("ref#%x", self.Reference), - } - if self.Flags.ReportZerolen() && self.Flags.IsZerolen() { - tokens = append(tokens, fmt.Sprintf("zero-length")) - } - if self.Flags.LastKnown() && self.Flags.IsLast() { - tokens = append(tokens, "last") - } - if self.Flags.DelimCRCErr() { - tokens = append(tokens, "delimiter CRC error") - } - if self.Flags.DelimCRCKnown() { - tokens = append(tokens, fmt.Sprintf("delimiter-CRC=%02x", self.CRC)) - } - return strings.Join(tokens, ",") -} - -type RadioTapAMPDUStatusFlags uint16 - -const ( - RadioTapAMPDUStatusFlagsReportZerolen RadioTapAMPDUStatusFlags = 1 << iota - RadioTapAMPDUIsZerolen - RadioTapAMPDULastKnown - RadioTapAMPDUIsLast - RadioTapAMPDUDelimCRCErr - RadioTapAMPDUDelimCRCKnown -) - -func (self RadioTapAMPDUStatusFlags) ReportZerolen() bool { - return self&RadioTapAMPDUStatusFlagsReportZerolen != 0 -} -func (self RadioTapAMPDUStatusFlags) IsZerolen() bool { return self&RadioTapAMPDUIsZerolen != 0 } -func (self RadioTapAMPDUStatusFlags) LastKnown() bool { return self&RadioTapAMPDULastKnown != 0 } -func (self RadioTapAMPDUStatusFlags) IsLast() bool { return self&RadioTapAMPDUIsLast != 0 } -func (self RadioTapAMPDUStatusFlags) DelimCRCErr() bool { return self&RadioTapAMPDUDelimCRCErr != 0 } -func (self RadioTapAMPDUStatusFlags) DelimCRCKnown() bool { - return self&RadioTapAMPDUDelimCRCKnown != 0 -} - -type RadioTapVHT struct { - Known RadioTapVHTKnown - Flags RadioTapVHTFlags - Bandwidth uint8 - MCSNSS [4]RadioTapVHTMCSNSS - Coding uint8 - GroupId uint8 - PartialAID uint16 -} - -func (self RadioTapVHT) String() string { - var tokens []string - if self.Known.STBC() { - if self.Flags.STBC() { - tokens = append(tokens, "STBC") - } else { - tokens = append(tokens, "no STBC") - } - } - if self.Known.TXOPPSNotAllowed() { - if self.Flags.TXOPPSNotAllowed() { - tokens = append(tokens, "TXOP doze not allowed") - } else { - tokens = append(tokens, "TXOP doze allowed") - } - } - if self.Known.GI() { - if self.Flags.SGI() { - tokens = append(tokens, "short GI") - } else { - tokens = append(tokens, "long GI") - } - } - if self.Known.SGINSYMDisambiguation() { - if self.Flags.SGINSYMMod() { - tokens = append(tokens, "NSYM mod 10=9") - } else { - tokens = append(tokens, "NSYM mod 10!=9 or no short GI") - } - } - if self.Known.LDPCExtraOFDMSymbol() { - if self.Flags.LDPCExtraOFDMSymbol() { - tokens = append(tokens, "LDPC extra OFDM symbols") - } else { - tokens = append(tokens, "no LDPC extra OFDM symbols") - } - } - if self.Known.Beamformed() { - if self.Flags.Beamformed() { - tokens = append(tokens, "beamformed") - } else { - tokens = append(tokens, "no beamformed") - } - } - if self.Known.Bandwidth() { - token := "?" - switch self.Bandwidth & 0x1f { - case 0: - token = "20" - case 1: - token = "40" - case 2: - token = "40(20L)" - case 3: - token = "40(20U)" - case 4: - token = "80" - case 5: - token = "80(40L)" - case 6: - token = "80(40U)" - case 7: - token = "80(20LL)" - case 8: - token = "80(20LU)" - case 9: - token = "80(20UL)" - case 10: - token = "80(20UU)" - case 11: - token = "160" - case 12: - token = "160(80L)" - case 13: - token = "160(80U)" - case 14: - token = "160(40LL)" - case 15: - token = "160(40LU)" - case 16: - token = "160(40UL)" - case 17: - token = "160(40UU)" - case 18: - token = "160(20LLL)" - case 19: - token = "160(20LLU)" - case 20: - token = "160(20LUL)" - case 21: - token = "160(20LUU)" - case 22: - token = "160(20ULL)" - case 23: - token = "160(20ULU)" - case 24: - token = "160(20UUL)" - case 25: - token = "160(20UUU)" - } - tokens = append(tokens, token) - } - for i, MCSNSS := range self.MCSNSS { - if MCSNSS.Present() { - fec := "?" - switch self.Coding & (1 << uint8(i)) { - case 0: - fec = "BCC" - case 1: - fec = "LDPC" - } - tokens = append(tokens, fmt.Sprintf("user%d(%s,%s)", i, MCSNSS.String(), fec)) - } - } - if self.Known.GroupId() { - tokens = append(tokens, - fmt.Sprintf("group=%d", self.GroupId)) - } - if self.Known.PartialAID() { - tokens = append(tokens, - fmt.Sprintf("partial-AID=%d", self.PartialAID)) - } - return strings.Join(tokens, ",") -} - -type RadioTapVHTKnown uint16 - -const ( - RadioTapVHTKnownSTBC RadioTapVHTKnown = 1 << iota - RadioTapVHTKnownTXOPPSNotAllowed - RadioTapVHTKnownGI - RadioTapVHTKnownSGINSYMDisambiguation - RadioTapVHTKnownLDPCExtraOFDMSymbol - RadioTapVHTKnownBeamformed - RadioTapVHTKnownBandwidth - RadioTapVHTKnownGroupId - RadioTapVHTKnownPartialAID -) - -func (self RadioTapVHTKnown) STBC() bool { return self&RadioTapVHTKnownSTBC != 0 } -func (self RadioTapVHTKnown) TXOPPSNotAllowed() bool { - return self&RadioTapVHTKnownTXOPPSNotAllowed != 0 -} -func (self RadioTapVHTKnown) GI() bool { return self&RadioTapVHTKnownGI != 0 } -func (self RadioTapVHTKnown) SGINSYMDisambiguation() bool { - return self&RadioTapVHTKnownSGINSYMDisambiguation != 0 -} -func (self RadioTapVHTKnown) LDPCExtraOFDMSymbol() bool { - return self&RadioTapVHTKnownLDPCExtraOFDMSymbol != 0 -} -func (self RadioTapVHTKnown) Beamformed() bool { return self&RadioTapVHTKnownBeamformed != 0 } -func (self RadioTapVHTKnown) Bandwidth() bool { return self&RadioTapVHTKnownBandwidth != 0 } -func (self RadioTapVHTKnown) GroupId() bool { return self&RadioTapVHTKnownGroupId != 0 } -func (self RadioTapVHTKnown) PartialAID() bool { return self&RadioTapVHTKnownPartialAID != 0 } - -type RadioTapVHTFlags uint8 - -const ( - RadioTapVHTFlagsSTBC RadioTapVHTFlags = 1 << iota - RadioTapVHTFlagsTXOPPSNotAllowed - RadioTapVHTFlagsSGI - RadioTapVHTFlagsSGINSYMMod - RadioTapVHTFlagsLDPCExtraOFDMSymbol - RadioTapVHTFlagsBeamformed -) - -func (self RadioTapVHTFlags) STBC() bool { return self&RadioTapVHTFlagsSTBC != 0 } -func (self RadioTapVHTFlags) TXOPPSNotAllowed() bool { - return self&RadioTapVHTFlagsTXOPPSNotAllowed != 0 -} -func (self RadioTapVHTFlags) SGI() bool { return self&RadioTapVHTFlagsSGI != 0 } -func (self RadioTapVHTFlags) SGINSYMMod() bool { return self&RadioTapVHTFlagsSGINSYMMod != 0 } -func (self RadioTapVHTFlags) LDPCExtraOFDMSymbol() bool { - return self&RadioTapVHTFlagsLDPCExtraOFDMSymbol != 0 -} -func (self RadioTapVHTFlags) Beamformed() bool { return self&RadioTapVHTFlagsBeamformed != 0 } - -type RadioTapVHTMCSNSS uint8 - -func (self RadioTapVHTMCSNSS) Present() bool { - return self&0x0F != 0 -} - -func (self RadioTapVHTMCSNSS) String() string { - return fmt.Sprintf("NSS#%dMCS#%d", uint32(self&0xf), uint32(self>>4)) -} - -func decodeRadioTap(data []byte, p gopacket.PacketBuilder) error { - d := &RadioTap{} - // TODO: Should we set LinkLayer here? And implement LinkFlow - return decodingLayerDecoder(d, data, p) -} - -type RadioTap struct { - BaseLayer - - // Version 0. Only increases for drastic changes, introduction of compatible new fields does not count. - Version uint8 - // Length of the whole header in bytes, including it_version, it_pad, it_len, and data fields. - Length uint16 - // Present is a bitmap telling which fields are present. Set bit 31 (0x80000000) to extend the bitmap by another 32 bits. Additional extensions are made by setting bit 31. - Present RadioTapPresent - // TSFT: value in microseconds of the MAC's 64-bit 802.11 Time Synchronization Function timer when the first bit of the MPDU arrived at the MAC. For received frames, only. - TSFT uint64 - Flags RadioTapFlags - // Rate Tx/Rx data rate - Rate RadioTapRate - // ChannelFrequency Tx/Rx frequency in MHz, followed by flags - ChannelFrequency RadioTapChannelFrequency - ChannelFlags RadioTapChannelFlags - // FHSS For frequency-hopping radios, the hop set (first byte) and pattern (second byte). - FHSS uint16 - // DBMAntennaSignal RF signal power at the antenna, decibel difference from one milliwatt. - DBMAntennaSignal int8 - // DBMAntennaNoise RF noise power at the antenna, decibel difference from one milliwatt. - DBMAntennaNoise int8 - // LockQuality Quality of Barker code lock. Unitless. Monotonically nondecreasing with "better" lock strength. Called "Signal Quality" in datasheets. - LockQuality uint16 - // TxAttenuation Transmit power expressed as unitless distance from max power set at factory calibration. 0 is max power. Monotonically nondecreasing with lower power levels. - TxAttenuation uint16 - // DBTxAttenuation Transmit power expressed as decibel distance from max power set at factory calibration. 0 is max power. Monotonically nondecreasing with lower power levels. - DBTxAttenuation uint16 - // DBMTxPower Transmit power expressed as dBm (decibels from a 1 milliwatt reference). This is the absolute power level measured at the antenna port. - DBMTxPower int8 - // Antenna Unitless indication of the Rx/Tx antenna for this packet. The first antenna is antenna 0. - Antenna uint8 - // DBAntennaSignal RF signal power at the antenna, decibel difference from an arbitrary, fixed reference. - DBAntennaSignal uint8 - // DBAntennaNoise RF noise power at the antenna, decibel difference from an arbitrary, fixed reference point. - DBAntennaNoise uint8 - // - RxFlags RadioTapRxFlags - TxFlags RadioTapTxFlags - RtsRetries uint8 - DataRetries uint8 - MCS RadioTapMCS - AMPDUStatus RadioTapAMPDUStatus - VHT RadioTapVHT -} - -func (m *RadioTap) LayerType() gopacket.LayerType { return LayerTypeRadioTap } - -func (m *RadioTap) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 8 { - df.SetTruncated() - return errors.New("RadioTap too small") - } - m.Version = uint8(data[0]) - m.Length = binary.LittleEndian.Uint16(data[2:4]) - m.Present = RadioTapPresent(binary.LittleEndian.Uint32(data[4:8])) - - offset := uint16(4) - - for (binary.LittleEndian.Uint32(data[offset:offset+4]) & 0x80000000) != 0 { - // This parser only handles standard radiotap namespace, - // and expects all fields are packed in the first it_present. - // Extended bitmap will be just ignored. - offset += 4 - } - offset += 4 // skip the bitmap - - if m.Present.TSFT() { - offset += align(offset, 8) - m.TSFT = binary.LittleEndian.Uint64(data[offset : offset+8]) - offset += 8 - } - if m.Present.Flags() { - m.Flags = RadioTapFlags(data[offset]) - offset++ - } - if m.Present.Rate() { - m.Rate = RadioTapRate(data[offset]) - offset++ - } - if m.Present.Channel() { - offset += align(offset, 2) - m.ChannelFrequency = RadioTapChannelFrequency(binary.LittleEndian.Uint16(data[offset : offset+2])) - offset += 2 - m.ChannelFlags = RadioTapChannelFlags(binary.LittleEndian.Uint16(data[offset : offset+2])) - offset += 2 - } - if m.Present.FHSS() { - m.FHSS = binary.LittleEndian.Uint16(data[offset : offset+2]) - offset += 2 - } - if m.Present.DBMAntennaSignal() { - m.DBMAntennaSignal = int8(data[offset]) - offset++ - } - if m.Present.DBMAntennaNoise() { - m.DBMAntennaNoise = int8(data[offset]) - offset++ - } - if m.Present.LockQuality() { - offset += align(offset, 2) - m.LockQuality = binary.LittleEndian.Uint16(data[offset : offset+2]) - offset += 2 - } - if m.Present.TxAttenuation() { - offset += align(offset, 2) - m.TxAttenuation = binary.LittleEndian.Uint16(data[offset : offset+2]) - offset += 2 - } - if m.Present.DBTxAttenuation() { - offset += align(offset, 2) - m.DBTxAttenuation = binary.LittleEndian.Uint16(data[offset : offset+2]) - offset += 2 - } - if m.Present.DBMTxPower() { - m.DBMTxPower = int8(data[offset]) - offset++ - } - if m.Present.Antenna() { - m.Antenna = uint8(data[offset]) - offset++ - } - if m.Present.DBAntennaSignal() { - m.DBAntennaSignal = uint8(data[offset]) - offset++ - } - if m.Present.DBAntennaNoise() { - m.DBAntennaNoise = uint8(data[offset]) - offset++ - } - if m.Present.RxFlags() { - offset += align(offset, 2) - m.RxFlags = RadioTapRxFlags(binary.LittleEndian.Uint16(data[offset:])) - offset += 2 - } - if m.Present.TxFlags() { - offset += align(offset, 2) - m.TxFlags = RadioTapTxFlags(binary.LittleEndian.Uint16(data[offset:])) - offset += 2 - } - if m.Present.RtsRetries() { - m.RtsRetries = uint8(data[offset]) - offset++ - } - if m.Present.DataRetries() { - m.DataRetries = uint8(data[offset]) - offset++ - } - if m.Present.MCS() { - m.MCS = RadioTapMCS{ - RadioTapMCSKnown(data[offset]), - RadioTapMCSFlags(data[offset+1]), - uint8(data[offset+2]), - } - offset += 3 - } - if m.Present.AMPDUStatus() { - offset += align(offset, 4) - m.AMPDUStatus = RadioTapAMPDUStatus{ - Reference: binary.LittleEndian.Uint32(data[offset:]), - Flags: RadioTapAMPDUStatusFlags(binary.LittleEndian.Uint16(data[offset+4:])), - CRC: uint8(data[offset+6]), - } - offset += 8 - } - if m.Present.VHT() { - offset += align(offset, 2) - m.VHT = RadioTapVHT{ - Known: RadioTapVHTKnown(binary.LittleEndian.Uint16(data[offset:])), - Flags: RadioTapVHTFlags(data[offset+2]), - Bandwidth: uint8(data[offset+3]), - MCSNSS: [4]RadioTapVHTMCSNSS{ - RadioTapVHTMCSNSS(data[offset+4]), - RadioTapVHTMCSNSS(data[offset+5]), - RadioTapVHTMCSNSS(data[offset+6]), - RadioTapVHTMCSNSS(data[offset+7]), - }, - Coding: uint8(data[offset+8]), - GroupId: uint8(data[offset+9]), - PartialAID: binary.LittleEndian.Uint16(data[offset+10:]), - } - offset += 12 - } - - payload := data[m.Length:] - - // Remove non standard padding used by some Wi-Fi drivers - if m.Flags.Datapad() && - payload[0]&0xC == 0x8 { //&& // Data frame - headlen := 24 - if payload[0]&0x8C == 0x88 { // QoS - headlen += 2 - } - if payload[1]&0x3 == 0x3 { // 4 addresses - headlen += 2 - } - if headlen%4 == 2 { - payload = append(payload[:headlen], payload[headlen+2:len(payload)]...) - } - } - - if !m.Flags.FCS() { - // Dot11.DecodeFromBytes() expects FCS present and performs a hard chop on the checksum - // If a user is handing in subslices or packets from a buffered stream, the capacity of the slice - // may extend beyond the len, rather than expecting callers to enforce cap==len on every packet - // we take the hit in this one case and do a reallocation. If the user DOES enforce cap==len - // then the reallocation will happen anyway on the append. This is requried because the append - // write to the memory directly after the payload if there is sufficient capacity, which callers - // may not expect. - reallocPayload := make([]byte, len(payload)+4) - copy(reallocPayload[0:len(payload)], payload) - h := crc32.NewIEEE() - h.Write(payload) - binary.LittleEndian.PutUint32(reallocPayload[len(payload):], h.Sum32()) - payload = reallocPayload - } - m.BaseLayer = BaseLayer{Contents: data[:m.Length], Payload: payload} - - return nil -} - -func (m RadioTap) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - buf := make([]byte, 1024) - - buf[0] = m.Version - buf[1] = 0 - - binary.LittleEndian.PutUint32(buf[4:8], uint32(m.Present)) - - offset := uint16(4) - - for (binary.LittleEndian.Uint32(buf[offset:offset+4]) & 0x80000000) != 0 { - offset += 4 - } - - offset += 4 - - if m.Present.TSFT() { - offset += align(offset, 8) - binary.LittleEndian.PutUint64(buf[offset:offset+8], m.TSFT) - offset += 8 - } - - if m.Present.Flags() { - buf[offset] = uint8(m.Flags) - offset++ - } - - if m.Present.Rate() { - buf[offset] = uint8(m.Rate) - offset++ - } - - if m.Present.Channel() { - offset += align(offset, 2) - binary.LittleEndian.PutUint16(buf[offset:offset+2], uint16(m.ChannelFrequency)) - offset += 2 - binary.LittleEndian.PutUint16(buf[offset:offset+2], uint16(m.ChannelFlags)) - offset += 2 - } - - if m.Present.FHSS() { - binary.LittleEndian.PutUint16(buf[offset:offset+2], m.FHSS) - offset += 2 - } - - if m.Present.DBMAntennaSignal() { - buf[offset] = byte(m.DBMAntennaSignal) - offset++ - } - - if m.Present.DBMAntennaNoise() { - buf[offset] = byte(m.DBMAntennaNoise) - offset++ - } - - if m.Present.LockQuality() { - offset += align(offset, 2) - binary.LittleEndian.PutUint16(buf[offset:offset+2], m.LockQuality) - offset += 2 - } - - if m.Present.TxAttenuation() { - offset += align(offset, 2) - binary.LittleEndian.PutUint16(buf[offset:offset+2], m.TxAttenuation) - offset += 2 - } - - if m.Present.DBTxAttenuation() { - offset += align(offset, 2) - binary.LittleEndian.PutUint16(buf[offset:offset+2], m.DBTxAttenuation) - offset += 2 - } - - if m.Present.DBMTxPower() { - buf[offset] = byte(m.DBMTxPower) - offset++ - } - - if m.Present.Antenna() { - buf[offset] = uint8(m.Antenna) - offset++ - } - - if m.Present.DBAntennaSignal() { - buf[offset] = uint8(m.DBAntennaSignal) - offset++ - } - - if m.Present.DBAntennaNoise() { - buf[offset] = uint8(m.DBAntennaNoise) - offset++ - } - - if m.Present.RxFlags() { - offset += align(offset, 2) - binary.LittleEndian.PutUint16(buf[offset:offset+2], uint16(m.RxFlags)) - offset += 2 - } - - if m.Present.TxFlags() { - offset += align(offset, 2) - binary.LittleEndian.PutUint16(buf[offset:offset+2], uint16(m.TxFlags)) - offset += 2 - } - - if m.Present.RtsRetries() { - buf[offset] = m.RtsRetries - offset++ - } - - if m.Present.DataRetries() { - buf[offset] = m.DataRetries - offset++ - } - - if m.Present.MCS() { - buf[offset] = uint8(m.MCS.Known) - buf[offset+1] = uint8(m.MCS.Flags) - buf[offset+2] = uint8(m.MCS.MCS) - - offset += 3 - } - - if m.Present.AMPDUStatus() { - offset += align(offset, 4) - - binary.LittleEndian.PutUint32(buf[offset:offset+4], m.AMPDUStatus.Reference) - binary.LittleEndian.PutUint16(buf[offset+4:offset+6], uint16(m.AMPDUStatus.Flags)) - - buf[offset+6] = m.AMPDUStatus.CRC - - offset += 8 - } - - if m.Present.VHT() { - offset += align(offset, 2) - - binary.LittleEndian.PutUint16(buf[offset:], uint16(m.VHT.Known)) - - buf[offset+2] = uint8(m.VHT.Flags) - buf[offset+3] = uint8(m.VHT.Bandwidth) - buf[offset+4] = uint8(m.VHT.MCSNSS[0]) - buf[offset+5] = uint8(m.VHT.MCSNSS[1]) - buf[offset+6] = uint8(m.VHT.MCSNSS[2]) - buf[offset+7] = uint8(m.VHT.MCSNSS[3]) - buf[offset+8] = uint8(m.VHT.Coding) - buf[offset+9] = uint8(m.VHT.GroupId) - - binary.LittleEndian.PutUint16(buf[offset+10:offset+12], m.VHT.PartialAID) - - offset += 12 - } - - packetBuf, err := b.PrependBytes(int(offset)) - - if err != nil { - return err - } - - if opts.FixLengths { - m.Length = offset - } - - binary.LittleEndian.PutUint16(buf[2:4], m.Length) - - copy(packetBuf, buf) - - return nil -} - -func (m *RadioTap) CanDecode() gopacket.LayerClass { return LayerTypeRadioTap } -func (m *RadioTap) NextLayerType() gopacket.LayerType { return LayerTypeDot11 } diff --git a/vendor/github.com/google/gopacket/layers/radius.go b/vendor/github.com/google/gopacket/layers/radius.go deleted file mode 100644 index c43ea2945..000000000 --- a/vendor/github.com/google/gopacket/layers/radius.go +++ /dev/null @@ -1,560 +0,0 @@ -// Copyright 2020 The GoPacket Authors. All rights reserved. -// -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file in the root of the source tree. - -package layers - -import ( - "encoding/binary" - "fmt" - - "github.com/google/gopacket" -) - -const ( - // RFC 2865 3. Packet Format - // `The minimum length is 20 and maximum length is 4096.` - radiusMinimumRecordSizeInBytes int = 20 - radiusMaximumRecordSizeInBytes int = 4096 - - // RFC 2865 5. Attributes - // `The Length field is one octet, and indicates the length of this Attribute including the Type, Length and Value fields.` - // `The Value field is zero or more octets and contains information specific to the Attribute.` - radiusAttributesMinimumRecordSizeInBytes int = 2 -) - -// RADIUS represents a Remote Authentication Dial In User Service layer. -type RADIUS struct { - BaseLayer - - Code RADIUSCode - Identifier RADIUSIdentifier - Length RADIUSLength - Authenticator RADIUSAuthenticator - Attributes []RADIUSAttribute -} - -// RADIUSCode represents packet type. -type RADIUSCode uint8 - -// constants that define RADIUSCode. -const ( - RADIUSCodeAccessRequest RADIUSCode = 1 // RFC2865 3. Packet Format - RADIUSCodeAccessAccept RADIUSCode = 2 // RFC2865 3. Packet Format - RADIUSCodeAccessReject RADIUSCode = 3 // RFC2865 3. Packet Format - RADIUSCodeAccountingRequest RADIUSCode = 4 // RFC2865 3. Packet Format - RADIUSCodeAccountingResponse RADIUSCode = 5 // RFC2865 3. Packet Format - RADIUSCodeAccessChallenge RADIUSCode = 11 // RFC2865 3. Packet Format - RADIUSCodeStatusServer RADIUSCode = 12 // RFC2865 3. Packet Format (experimental) - RADIUSCodeStatusClient RADIUSCode = 13 // RFC2865 3. Packet Format (experimental) - RADIUSCodeReserved RADIUSCode = 255 // RFC2865 3. Packet Format -) - -// String returns a string version of a RADIUSCode. -func (t RADIUSCode) String() (s string) { - switch t { - case RADIUSCodeAccessRequest: - s = "Access-Request" - case RADIUSCodeAccessAccept: - s = "Access-Accept" - case RADIUSCodeAccessReject: - s = "Access-Reject" - case RADIUSCodeAccountingRequest: - s = "Accounting-Request" - case RADIUSCodeAccountingResponse: - s = "Accounting-Response" - case RADIUSCodeAccessChallenge: - s = "Access-Challenge" - case RADIUSCodeStatusServer: - s = "Status-Server" - case RADIUSCodeStatusClient: - s = "Status-Client" - case RADIUSCodeReserved: - s = "Reserved" - default: - s = fmt.Sprintf("Unknown(%d)", t) - } - return -} - -// RADIUSIdentifier represents packet identifier. -type RADIUSIdentifier uint8 - -// RADIUSLength represents packet length. -type RADIUSLength uint16 - -// RADIUSAuthenticator represents authenticator. -type RADIUSAuthenticator [16]byte - -// RADIUSAttribute represents attributes. -type RADIUSAttribute struct { - Type RADIUSAttributeType - Length RADIUSAttributeLength - Value RADIUSAttributeValue -} - -// RADIUSAttributeType represents attribute type. -type RADIUSAttributeType uint8 - -// constants that define RADIUSAttributeType. -const ( - RADIUSAttributeTypeUserName RADIUSAttributeType = 1 // RFC2865 5.1. User-Name - RADIUSAttributeTypeUserPassword RADIUSAttributeType = 2 // RFC2865 5.2. User-Password - RADIUSAttributeTypeCHAPPassword RADIUSAttributeType = 3 // RFC2865 5.3. CHAP-Password - RADIUSAttributeTypeNASIPAddress RADIUSAttributeType = 4 // RFC2865 5.4. NAS-IP-Address - RADIUSAttributeTypeNASPort RADIUSAttributeType = 5 // RFC2865 5.5. NAS-Port - RADIUSAttributeTypeServiceType RADIUSAttributeType = 6 // RFC2865 5.6. Service-Type - RADIUSAttributeTypeFramedProtocol RADIUSAttributeType = 7 // RFC2865 5.7. Framed-Protocol - RADIUSAttributeTypeFramedIPAddress RADIUSAttributeType = 8 // RFC2865 5.8. Framed-IP-Address - RADIUSAttributeTypeFramedIPNetmask RADIUSAttributeType = 9 // RFC2865 5.9. Framed-IP-Netmask - RADIUSAttributeTypeFramedRouting RADIUSAttributeType = 10 // RFC2865 5.10. Framed-Routing - RADIUSAttributeTypeFilterId RADIUSAttributeType = 11 // RFC2865 5.11. Filter-Id - RADIUSAttributeTypeFramedMTU RADIUSAttributeType = 12 // RFC2865 5.12. Framed-MTU - RADIUSAttributeTypeFramedCompression RADIUSAttributeType = 13 // RFC2865 5.13. Framed-Compression - RADIUSAttributeTypeLoginIPHost RADIUSAttributeType = 14 // RFC2865 5.14. Login-IP-Host - RADIUSAttributeTypeLoginService RADIUSAttributeType = 15 // RFC2865 5.15. Login-Service - RADIUSAttributeTypeLoginTCPPort RADIUSAttributeType = 16 // RFC2865 5.16. Login-TCP-Port - RADIUSAttributeTypeReplyMessage RADIUSAttributeType = 18 // RFC2865 5.18. Reply-Message - RADIUSAttributeTypeCallbackNumber RADIUSAttributeType = 19 // RFC2865 5.19. Callback-Number - RADIUSAttributeTypeCallbackId RADIUSAttributeType = 20 // RFC2865 5.20. Callback-Id - RADIUSAttributeTypeFramedRoute RADIUSAttributeType = 22 // RFC2865 5.22. Framed-Route - RADIUSAttributeTypeFramedIPXNetwork RADIUSAttributeType = 23 // RFC2865 5.23. Framed-IPX-Network - RADIUSAttributeTypeState RADIUSAttributeType = 24 // RFC2865 5.24. State - RADIUSAttributeTypeClass RADIUSAttributeType = 25 // RFC2865 5.25. Class - RADIUSAttributeTypeVendorSpecific RADIUSAttributeType = 26 // RFC2865 5.26. Vendor-Specific - RADIUSAttributeTypeSessionTimeout RADIUSAttributeType = 27 // RFC2865 5.27. Session-Timeout - RADIUSAttributeTypeIdleTimeout RADIUSAttributeType = 28 // RFC2865 5.28. Idle-Timeout - RADIUSAttributeTypeTerminationAction RADIUSAttributeType = 29 // RFC2865 5.29. Termination-Action - RADIUSAttributeTypeCalledStationId RADIUSAttributeType = 30 // RFC2865 5.30. Called-Station-Id - RADIUSAttributeTypeCallingStationId RADIUSAttributeType = 31 // RFC2865 5.31. Calling-Station-Id - RADIUSAttributeTypeNASIdentifier RADIUSAttributeType = 32 // RFC2865 5.32. NAS-Identifier - RADIUSAttributeTypeProxyState RADIUSAttributeType = 33 // RFC2865 5.33. Proxy-State - RADIUSAttributeTypeLoginLATService RADIUSAttributeType = 34 // RFC2865 5.34. Login-LAT-Service - RADIUSAttributeTypeLoginLATNode RADIUSAttributeType = 35 // RFC2865 5.35. Login-LAT-Node - RADIUSAttributeTypeLoginLATGroup RADIUSAttributeType = 36 // RFC2865 5.36. Login-LAT-Group - RADIUSAttributeTypeFramedAppleTalkLink RADIUSAttributeType = 37 // RFC2865 5.37. Framed-AppleTalk-Link - RADIUSAttributeTypeFramedAppleTalkNetwork RADIUSAttributeType = 38 // RFC2865 5.38. Framed-AppleTalk-Network - RADIUSAttributeTypeFramedAppleTalkZone RADIUSAttributeType = 39 // RFC2865 5.39. Framed-AppleTalk-Zone - RADIUSAttributeTypeAcctStatusType RADIUSAttributeType = 40 // RFC2866 5.1. Acct-Status-Type - RADIUSAttributeTypeAcctDelayTime RADIUSAttributeType = 41 // RFC2866 5.2. Acct-Delay-Time - RADIUSAttributeTypeAcctInputOctets RADIUSAttributeType = 42 // RFC2866 5.3. Acct-Input-Octets - RADIUSAttributeTypeAcctOutputOctets RADIUSAttributeType = 43 // RFC2866 5.4. Acct-Output-Octets - RADIUSAttributeTypeAcctSessionId RADIUSAttributeType = 44 // RFC2866 5.5. Acct-Session-Id - RADIUSAttributeTypeAcctAuthentic RADIUSAttributeType = 45 // RFC2866 5.6. Acct-Authentic - RADIUSAttributeTypeAcctSessionTime RADIUSAttributeType = 46 // RFC2866 5.7. Acct-Session-Time - RADIUSAttributeTypeAcctInputPackets RADIUSAttributeType = 47 // RFC2866 5.8. Acct-Input-Packets - RADIUSAttributeTypeAcctOutputPackets RADIUSAttributeType = 48 // RFC2866 5.9. Acct-Output-Packets - RADIUSAttributeTypeAcctTerminateCause RADIUSAttributeType = 49 // RFC2866 5.10. Acct-Terminate-Cause - RADIUSAttributeTypeAcctMultiSessionId RADIUSAttributeType = 50 // RFC2866 5.11. Acct-Multi-Session-Id - RADIUSAttributeTypeAcctLinkCount RADIUSAttributeType = 51 // RFC2866 5.12. Acct-Link-Count - RADIUSAttributeTypeAcctInputGigawords RADIUSAttributeType = 52 // RFC2869 5.1. Acct-Input-Gigawords - RADIUSAttributeTypeAcctOutputGigawords RADIUSAttributeType = 53 // RFC2869 5.2. Acct-Output-Gigawords - RADIUSAttributeTypeEventTimestamp RADIUSAttributeType = 55 // RFC2869 5.3. Event-Timestamp - RADIUSAttributeTypeCHAPChallenge RADIUSAttributeType = 60 // RFC2865 5.40. CHAP-Challenge - RADIUSAttributeTypeNASPortType RADIUSAttributeType = 61 // RFC2865 5.41. NAS-Port-Type - RADIUSAttributeTypePortLimit RADIUSAttributeType = 62 // RFC2865 5.42. Port-Limit - RADIUSAttributeTypeLoginLATPort RADIUSAttributeType = 63 // RFC2865 5.43. Login-LAT-Port - RADIUSAttributeTypeTunnelType RADIUSAttributeType = 64 // RFC2868 3.1. Tunnel-Type - RADIUSAttributeTypeTunnelMediumType RADIUSAttributeType = 65 // RFC2868 3.2. Tunnel-Medium-Type - RADIUSAttributeTypeTunnelClientEndpoint RADIUSAttributeType = 66 // RFC2868 3.3. Tunnel-Client-Endpoint - RADIUSAttributeTypeTunnelServerEndpoint RADIUSAttributeType = 67 // RFC2868 3.4. Tunnel-Server-Endpoint - RADIUSAttributeTypeAcctTunnelConnection RADIUSAttributeType = 68 // RFC2867 4.1. Acct-Tunnel-Connection - RADIUSAttributeTypeTunnelPassword RADIUSAttributeType = 69 // RFC2868 3.5. Tunnel-Password - RADIUSAttributeTypeARAPPassword RADIUSAttributeType = 70 // RFC2869 5.4. ARAP-Password - RADIUSAttributeTypeARAPFeatures RADIUSAttributeType = 71 // RFC2869 5.5. ARAP-Features - RADIUSAttributeTypeARAPZoneAccess RADIUSAttributeType = 72 // RFC2869 5.6. ARAP-Zone-Access - RADIUSAttributeTypeARAPSecurity RADIUSAttributeType = 73 // RFC2869 5.7. ARAP-Security - RADIUSAttributeTypeARAPSecurityData RADIUSAttributeType = 74 // RFC2869 5.8. ARAP-Security-Data - RADIUSAttributeTypePasswordRetry RADIUSAttributeType = 75 // RFC2869 5.9. Password-Retry - RADIUSAttributeTypePrompt RADIUSAttributeType = 76 // RFC2869 5.10. Prompt - RADIUSAttributeTypeConnectInfo RADIUSAttributeType = 77 // RFC2869 5.11. Connect-Info - RADIUSAttributeTypeConfigurationToken RADIUSAttributeType = 78 // RFC2869 5.12. Configuration-Token - RADIUSAttributeTypeEAPMessage RADIUSAttributeType = 79 // RFC2869 5.13. EAP-Message - RADIUSAttributeTypeMessageAuthenticator RADIUSAttributeType = 80 // RFC2869 5.14. Message-Authenticator - RADIUSAttributeTypeTunnelPrivateGroupID RADIUSAttributeType = 81 // RFC2868 3.6. Tunnel-Private-Group-ID - RADIUSAttributeTypeTunnelAssignmentID RADIUSAttributeType = 82 // RFC2868 3.7. Tunnel-Assignment-ID - RADIUSAttributeTypeTunnelPreference RADIUSAttributeType = 83 // RFC2868 3.8. Tunnel-Preference - RADIUSAttributeTypeARAPChallengeResponse RADIUSAttributeType = 84 // RFC2869 5.15. ARAP-Challenge-Response - RADIUSAttributeTypeAcctInterimInterval RADIUSAttributeType = 85 // RFC2869 5.16. Acct-Interim-Interval - RADIUSAttributeTypeAcctTunnelPacketsLost RADIUSAttributeType = 86 // RFC2867 4.2. Acct-Tunnel-Packets-Lost - RADIUSAttributeTypeNASPortId RADIUSAttributeType = 87 // RFC2869 5.17. NAS-Port-Id - RADIUSAttributeTypeFramedPool RADIUSAttributeType = 88 // RFC2869 5.18. Framed-Pool - RADIUSAttributeTypeTunnelClientAuthID RADIUSAttributeType = 90 // RFC2868 3.9. Tunnel-Client-Auth-ID - RADIUSAttributeTypeTunnelServerAuthID RADIUSAttributeType = 91 // RFC2868 3.10. Tunnel-Server-Auth-ID -) - -// RADIUSAttributeType represents attribute length. -type RADIUSAttributeLength uint8 - -// RADIUSAttributeType represents attribute value. -type RADIUSAttributeValue []byte - -// String returns a string version of a RADIUSAttributeType. -func (t RADIUSAttributeType) String() (s string) { - switch t { - case RADIUSAttributeTypeUserName: - s = "User-Name" - case RADIUSAttributeTypeUserPassword: - s = "User-Password" - case RADIUSAttributeTypeCHAPPassword: - s = "CHAP-Password" - case RADIUSAttributeTypeNASIPAddress: - s = "NAS-IP-Address" - case RADIUSAttributeTypeNASPort: - s = "NAS-Port" - case RADIUSAttributeTypeServiceType: - s = "Service-Type" - case RADIUSAttributeTypeFramedProtocol: - s = "Framed-Protocol" - case RADIUSAttributeTypeFramedIPAddress: - s = "Framed-IP-Address" - case RADIUSAttributeTypeFramedIPNetmask: - s = "Framed-IP-Netmask" - case RADIUSAttributeTypeFramedRouting: - s = "Framed-Routing" - case RADIUSAttributeTypeFilterId: - s = "Filter-Id" - case RADIUSAttributeTypeFramedMTU: - s = "Framed-MTU" - case RADIUSAttributeTypeFramedCompression: - s = "Framed-Compression" - case RADIUSAttributeTypeLoginIPHost: - s = "Login-IP-Host" - case RADIUSAttributeTypeLoginService: - s = "Login-Service" - case RADIUSAttributeTypeLoginTCPPort: - s = "Login-TCP-Port" - case RADIUSAttributeTypeReplyMessage: - s = "Reply-Message" - case RADIUSAttributeTypeCallbackNumber: - s = "Callback-Number" - case RADIUSAttributeTypeCallbackId: - s = "Callback-Id" - case RADIUSAttributeTypeFramedRoute: - s = "Framed-Route" - case RADIUSAttributeTypeFramedIPXNetwork: - s = "Framed-IPX-Network" - case RADIUSAttributeTypeState: - s = "State" - case RADIUSAttributeTypeClass: - s = "Class" - case RADIUSAttributeTypeVendorSpecific: - s = "Vendor-Specific" - case RADIUSAttributeTypeSessionTimeout: - s = "Session-Timeout" - case RADIUSAttributeTypeIdleTimeout: - s = "Idle-Timeout" - case RADIUSAttributeTypeTerminationAction: - s = "Termination-Action" - case RADIUSAttributeTypeCalledStationId: - s = "Called-Station-Id" - case RADIUSAttributeTypeCallingStationId: - s = "Calling-Station-Id" - case RADIUSAttributeTypeNASIdentifier: - s = "NAS-Identifier" - case RADIUSAttributeTypeProxyState: - s = "Proxy-State" - case RADIUSAttributeTypeLoginLATService: - s = "Login-LAT-Service" - case RADIUSAttributeTypeLoginLATNode: - s = "Login-LAT-Node" - case RADIUSAttributeTypeLoginLATGroup: - s = "Login-LAT-Group" - case RADIUSAttributeTypeFramedAppleTalkLink: - s = "Framed-AppleTalk-Link" - case RADIUSAttributeTypeFramedAppleTalkNetwork: - s = "Framed-AppleTalk-Network" - case RADIUSAttributeTypeFramedAppleTalkZone: - s = "Framed-AppleTalk-Zone" - case RADIUSAttributeTypeAcctStatusType: - s = "Acct-Status-Type" - case RADIUSAttributeTypeAcctDelayTime: - s = "Acct-Delay-Time" - case RADIUSAttributeTypeAcctInputOctets: - s = "Acct-Input-Octets" - case RADIUSAttributeTypeAcctOutputOctets: - s = "Acct-Output-Octets" - case RADIUSAttributeTypeAcctSessionId: - s = "Acct-Session-Id" - case RADIUSAttributeTypeAcctAuthentic: - s = "Acct-Authentic" - case RADIUSAttributeTypeAcctSessionTime: - s = "Acct-Session-Time" - case RADIUSAttributeTypeAcctInputPackets: - s = "Acct-Input-Packets" - case RADIUSAttributeTypeAcctOutputPackets: - s = "Acct-Output-Packets" - case RADIUSAttributeTypeAcctTerminateCause: - s = "Acct-Terminate-Cause" - case RADIUSAttributeTypeAcctMultiSessionId: - s = "Acct-Multi-Session-Id" - case RADIUSAttributeTypeAcctLinkCount: - s = "Acct-Link-Count" - case RADIUSAttributeTypeAcctInputGigawords: - s = "Acct-Input-Gigawords" - case RADIUSAttributeTypeAcctOutputGigawords: - s = "Acct-Output-Gigawords" - case RADIUSAttributeTypeEventTimestamp: - s = "Event-Timestamp" - case RADIUSAttributeTypeCHAPChallenge: - s = "CHAP-Challenge" - case RADIUSAttributeTypeNASPortType: - s = "NAS-Port-Type" - case RADIUSAttributeTypePortLimit: - s = "Port-Limit" - case RADIUSAttributeTypeLoginLATPort: - s = "Login-LAT-Port" - case RADIUSAttributeTypeTunnelType: - s = "Tunnel-Type" - case RADIUSAttributeTypeTunnelMediumType: - s = "Tunnel-Medium-Type" - case RADIUSAttributeTypeTunnelClientEndpoint: - s = "Tunnel-Client-Endpoint" - case RADIUSAttributeTypeTunnelServerEndpoint: - s = "Tunnel-Server-Endpoint" - case RADIUSAttributeTypeAcctTunnelConnection: - s = "Acct-Tunnel-Connection" - case RADIUSAttributeTypeTunnelPassword: - s = "Tunnel-Password" - case RADIUSAttributeTypeARAPPassword: - s = "ARAP-Password" - case RADIUSAttributeTypeARAPFeatures: - s = "ARAP-Features" - case RADIUSAttributeTypeARAPZoneAccess: - s = "ARAP-Zone-Access" - case RADIUSAttributeTypeARAPSecurity: - s = "ARAP-Security" - case RADIUSAttributeTypeARAPSecurityData: - s = "ARAP-Security-Data" - case RADIUSAttributeTypePasswordRetry: - s = "Password-Retry" - case RADIUSAttributeTypePrompt: - s = "Prompt" - case RADIUSAttributeTypeConnectInfo: - s = "Connect-Info" - case RADIUSAttributeTypeConfigurationToken: - s = "Configuration-Token" - case RADIUSAttributeTypeEAPMessage: - s = "EAP-Message" - case RADIUSAttributeTypeMessageAuthenticator: - s = "Message-Authenticator" - case RADIUSAttributeTypeTunnelPrivateGroupID: - s = "Tunnel-Private-Group-ID" - case RADIUSAttributeTypeTunnelAssignmentID: - s = "Tunnel-Assignment-ID" - case RADIUSAttributeTypeTunnelPreference: - s = "Tunnel-Preference" - case RADIUSAttributeTypeARAPChallengeResponse: - s = "ARAP-Challenge-Response" - case RADIUSAttributeTypeAcctInterimInterval: - s = "Acct-Interim-Interval" - case RADIUSAttributeTypeAcctTunnelPacketsLost: - s = "Acct-Tunnel-Packets-Lost" - case RADIUSAttributeTypeNASPortId: - s = "NAS-Port-Id" - case RADIUSAttributeTypeFramedPool: - s = "Framed-Pool" - case RADIUSAttributeTypeTunnelClientAuthID: - s = "Tunnel-Client-Auth-ID" - case RADIUSAttributeTypeTunnelServerAuthID: - s = "Tunnel-Server-Auth-ID" - default: - s = fmt.Sprintf("Unknown(%d)", t) - } - return -} - -// Len returns the length of a RADIUS packet. -func (radius *RADIUS) Len() (int, error) { - n := radiusMinimumRecordSizeInBytes - for _, v := range radius.Attributes { - alen, err := attributeValueLength(v.Value) - if err != nil { - return 0, err - } - n += int(alen) + 2 // Added Type and Length - } - return n, nil -} - -// LayerType returns LayerTypeRADIUS. -func (radius *RADIUS) LayerType() gopacket.LayerType { - return LayerTypeRADIUS -} - -// DecodeFromBytes decodes the given bytes into this layer. -func (radius *RADIUS) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) > radiusMaximumRecordSizeInBytes { - df.SetTruncated() - return fmt.Errorf("RADIUS length %d too big", len(data)) - } - - if len(data) < radiusMinimumRecordSizeInBytes { - df.SetTruncated() - return fmt.Errorf("RADIUS length %d too short", len(data)) - } - - radius.BaseLayer = BaseLayer{Contents: data} - - radius.Code = RADIUSCode(data[0]) - radius.Identifier = RADIUSIdentifier(data[1]) - radius.Length = RADIUSLength(binary.BigEndian.Uint16(data[2:4])) - - if int(radius.Length) > radiusMaximumRecordSizeInBytes { - df.SetTruncated() - return fmt.Errorf("RADIUS length %d too big", radius.Length) - } - - if int(radius.Length) < radiusMinimumRecordSizeInBytes { - df.SetTruncated() - return fmt.Errorf("RADIUS length %d too short", radius.Length) - } - - // RFC 2865 3. Packet Format - // `If the packet is shorter than the Length field indicates, it MUST be silently discarded.` - if int(radius.Length) > len(data) { - df.SetTruncated() - return fmt.Errorf("RADIUS length %d too big", radius.Length) - } - - // RFC 2865 3. Packet Format - // `Octets outside the range of the Length field MUST be treated as padding and ignored on reception.` - if int(radius.Length) < len(data) { - df.SetTruncated() - data = data[:radius.Length] - } - - copy(radius.Authenticator[:], data[4:20]) - - if len(data) == radiusMinimumRecordSizeInBytes { - return nil - } - - pos := radiusMinimumRecordSizeInBytes - for { - if len(data) == pos { - break - } - - if len(data[pos:]) < radiusAttributesMinimumRecordSizeInBytes { - df.SetTruncated() - return fmt.Errorf("RADIUS attributes length %d too short", len(data[pos:])) - } - - attr := RADIUSAttribute{} - attr.Type = RADIUSAttributeType(data[pos]) - attr.Length = RADIUSAttributeLength(data[pos+1]) - - if int(attr.Length) > len(data[pos:]) { - df.SetTruncated() - return fmt.Errorf("RADIUS attributes length %d too big", attr.Length) - } - - if int(attr.Length) < radiusAttributesMinimumRecordSizeInBytes { - df.SetTruncated() - return fmt.Errorf("RADIUS attributes length %d too short", attr.Length) - } - - if int(attr.Length) > radiusAttributesMinimumRecordSizeInBytes { - attr.Value = make([]byte, attr.Length-2) - copy(attr.Value[:], data[pos+2:pos+int(attr.Length)]) - radius.Attributes = append(radius.Attributes, attr) - } - - pos += int(attr.Length) - } - - for _, v := range radius.Attributes { - if v.Type == RADIUSAttributeTypeEAPMessage { - radius.BaseLayer.Payload = append(radius.BaseLayer.Payload, v.Value...) - } - } - - return nil -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (radius *RADIUS) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - plen, err := radius.Len() - if err != nil { - return err - } - - if opts.FixLengths { - radius.Length = RADIUSLength(plen) - } - - data, err := b.PrependBytes(plen) - if err != nil { - return err - } - - data[0] = byte(radius.Code) - data[1] = byte(radius.Identifier) - binary.BigEndian.PutUint16(data[2:], uint16(radius.Length)) - copy(data[4:20], radius.Authenticator[:]) - - pos := radiusMinimumRecordSizeInBytes - for _, v := range radius.Attributes { - if opts.FixLengths { - v.Length, err = attributeValueLength(v.Value) - if err != nil { - return err - } - } - - data[pos] = byte(v.Type) - data[pos+1] = byte(v.Length) - copy(data[pos+2:], v.Value[:]) - - pos += len(v.Value) + 2 // Added Type and Length - } - - return nil -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode. -func (radius *RADIUS) CanDecode() gopacket.LayerClass { - return LayerTypeRADIUS -} - -// NextLayerType returns the layer type contained by this DecodingLayer. -func (radius *RADIUS) NextLayerType() gopacket.LayerType { - if len(radius.BaseLayer.Payload) > 0 { - return LayerTypeEAP - } else { - return gopacket.LayerTypeZero - } -} - -// Payload returns the EAP Type-Data for EAP-Message attributes. -func (radius *RADIUS) Payload() []byte { - return radius.BaseLayer.Payload -} - -func decodeRADIUS(data []byte, p gopacket.PacketBuilder) error { - radius := &RADIUS{} - err := radius.DecodeFromBytes(data, p) - if err != nil { - return err - } - p.AddLayer(radius) - p.SetApplicationLayer(radius) - next := radius.NextLayerType() - if next == gopacket.LayerTypeZero { - return nil - } - return p.NextDecoder(next) -} - -func attributeValueLength(v []byte) (RADIUSAttributeLength, error) { - n := len(v) - if n > 255 { - return 0, fmt.Errorf("RADIUS attribute value length %d too long", n) - } else { - return RADIUSAttributeLength(n), nil - } -} diff --git a/vendor/github.com/google/gopacket/layers/rmcp.go b/vendor/github.com/google/gopacket/layers/rmcp.go deleted file mode 100644 index 5474fee4a..000000000 --- a/vendor/github.com/google/gopacket/layers/rmcp.go +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright 2019 The GoPacket Authors. All rights reserved. -// -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file in the root of the source tree. - -package layers - -// This file implements the ASF-RMCP header specified in section 3.2.2.2 of -// https://www.dmtf.org/sites/default/files/standards/documents/DSP0136.pdf - -import ( - "fmt" - - "github.com/google/gopacket" -) - -// RMCPClass is the class of a RMCP layer's payload, e.g. ASF or IPMI. This is a -// 4-bit unsigned int on the wire; all but 6 (ASF), 7 (IPMI) and 8 (OEM-defined) -// are currently reserved. -type RMCPClass uint8 - -// LayerType returns the payload layer type corresponding to a RMCP class. -func (c RMCPClass) LayerType() gopacket.LayerType { - if lt := rmcpClassLayerTypes[uint8(c)]; lt != 0 { - return lt - } - return gopacket.LayerTypePayload -} - -func (c RMCPClass) String() string { - return fmt.Sprintf("%v(%v)", uint8(c), c.LayerType()) -} - -const ( - // RMCPVersion1 identifies RMCP v1.0 in the Version header field. Lower - // values are considered legacy, while higher values are reserved by the - // specification. - RMCPVersion1 uint8 = 0x06 - - // RMCPNormal indicates a "normal" message, i.e. not an acknowledgement. - RMCPNormal uint8 = 0 - - // RMCPAck indicates a message is acknowledging a received normal message. - RMCPAck uint8 = 1 << 7 - - // RMCPClassASF identifies an RMCP message as containing an ASF-RMCP - // payload. - RMCPClassASF RMCPClass = 0x06 - - // RMCPClassIPMI identifies an RMCP message as containing an IPMI payload. - RMCPClassIPMI RMCPClass = 0x07 - - // RMCPClassOEM identifies an RMCP message as containing an OEM-defined - // payload. - RMCPClassOEM RMCPClass = 0x08 -) - -var ( - rmcpClassLayerTypes = [16]gopacket.LayerType{ - RMCPClassASF: LayerTypeASF, - // RMCPClassIPMI is to implement; RMCPClassOEM is deliberately not - // implemented, so we return LayerTypePayload - } -) - -// RegisterRMCPLayerType allows specifying that the payload of a RMCP packet of -// a certain class should processed by the provided layer type. This overrides -// any existing registrations, including defaults. -func RegisterRMCPLayerType(c RMCPClass, l gopacket.LayerType) { - rmcpClassLayerTypes[c] = l -} - -// RMCP describes the format of an RMCP header, which forms a UDP payload. See -// section 3.2.2.2. -type RMCP struct { - BaseLayer - - // Version identifies the version of the RMCP header. 0x06 indicates RMCP - // v1.0; lower values are legacy, higher values are reserved. - Version uint8 - - // Sequence is the sequence number assicated with the message. Note that - // this rolls over to 0 after 254, not 255. Seq num 255 indicates the - // receiver must not send an ACK. - Sequence uint8 - - // Ack indicates whether this packet is an acknowledgement. If it is, the - // payload will be empty. - Ack bool - - // Class idicates the structure of the payload. There are only 2^4 valid - // values, however there is no uint4 data type. N.B. the Ack bit has been - // split off into another field. The most significant 4 bits of this field - // will always be 0. - Class RMCPClass -} - -// LayerType returns LayerTypeRMCP. It partially satisfies Layer and -// SerializableLayer. -func (*RMCP) LayerType() gopacket.LayerType { - return LayerTypeRMCP -} - -// CanDecode returns LayerTypeRMCP. It partially satisfies DecodingLayer. -func (r *RMCP) CanDecode() gopacket.LayerClass { - return r.LayerType() -} - -// DecodeFromBytes makes the layer represent the provided bytes. It partially -// satisfies DecodingLayer. -func (r *RMCP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 4 { - df.SetTruncated() - return fmt.Errorf("invalid RMCP header, length %v less than 4", - len(data)) - } - - r.BaseLayer.Contents = data[:4] - r.BaseLayer.Payload = data[4:] - - r.Version = uint8(data[0]) - // 1 byte reserved - r.Sequence = uint8(data[2]) - r.Ack = data[3]&RMCPAck != 0 - r.Class = RMCPClass(data[3] & 0xF) - return nil -} - -// NextLayerType returns the data layer of this RMCP layer. This partially -// satisfies DecodingLayer. -func (r *RMCP) NextLayerType() gopacket.LayerType { - return r.Class.LayerType() -} - -// Payload returns the data layer. It partially satisfies ApplicationLayer. -func (r *RMCP) Payload() []byte { - return r.BaseLayer.Payload -} - -// SerializeTo writes the serialized fom of this layer into the SerializeBuffer, -// partially satisfying SerializableLayer. -func (r *RMCP) SerializeTo(b gopacket.SerializeBuffer, _ gopacket.SerializeOptions) error { - // The IPMI v1.5 spec contains a pad byte for frame sizes of certain lengths - // to work around issues in LAN chips. This is no longer necessary as of - // IPMI v2.0 (renamed to "legacy pad") so we do not attempt to add it. The - // same approach is taken by FreeIPMI: - // http://git.savannah.gnu.org/cgit/freeipmi.git/tree/libfreeipmi/interface/ipmi-lan-interface.c?id=b5ffcd38317daf42074458879f4c55ba6804a595#n836 - bytes, err := b.PrependBytes(4) - if err != nil { - return err - } - bytes[0] = r.Version - bytes[1] = 0x00 - bytes[2] = r.Sequence - bytes[3] = bool2uint8(r.Ack)<<7 | uint8(r.Class) // thanks, BFD layer - return nil -} - -// decodeRMCP decodes the byte slice into an RMCP type, and sets the application -// layer to it. -func decodeRMCP(data []byte, p gopacket.PacketBuilder) error { - rmcp := &RMCP{} - err := rmcp.DecodeFromBytes(data, p) - p.AddLayer(rmcp) - p.SetApplicationLayer(rmcp) - if err != nil { - return err - } - return p.NextDecoder(rmcp.NextLayerType()) -} diff --git a/vendor/github.com/google/gopacket/layers/rudp.go b/vendor/github.com/google/gopacket/layers/rudp.go deleted file mode 100644 index 8435129b9..000000000 --- a/vendor/github.com/google/gopacket/layers/rudp.go +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "fmt" - "github.com/google/gopacket" -) - -type RUDP struct { - BaseLayer - SYN, ACK, EACK, RST, NUL bool - Version uint8 - HeaderLength uint8 - SrcPort, DstPort RUDPPort - DataLength uint16 - Seq, Ack, Checksum uint32 - VariableHeaderArea []byte - // RUDPHeaderSyn contains SYN information for the RUDP packet, - // if the SYN flag is set - *RUDPHeaderSYN - // RUDPHeaderEack contains EACK information for the RUDP packet, - // if the EACK flag is set. - *RUDPHeaderEACK -} - -type RUDPHeaderSYN struct { - MaxOutstandingSegments, MaxSegmentSize, OptionFlags uint16 -} - -type RUDPHeaderEACK struct { - SeqsReceivedOK []uint32 -} - -// LayerType returns gopacket.LayerTypeRUDP. -func (r *RUDP) LayerType() gopacket.LayerType { return LayerTypeRUDP } - -func decodeRUDP(data []byte, p gopacket.PacketBuilder) error { - r := &RUDP{ - SYN: data[0]&0x80 != 0, - ACK: data[0]&0x40 != 0, - EACK: data[0]&0x20 != 0, - RST: data[0]&0x10 != 0, - NUL: data[0]&0x08 != 0, - Version: data[0] & 0x3, - HeaderLength: data[1], - SrcPort: RUDPPort(data[2]), - DstPort: RUDPPort(data[3]), - DataLength: binary.BigEndian.Uint16(data[4:6]), - Seq: binary.BigEndian.Uint32(data[6:10]), - Ack: binary.BigEndian.Uint32(data[10:14]), - Checksum: binary.BigEndian.Uint32(data[14:18]), - } - if r.HeaderLength < 9 { - return fmt.Errorf("RUDP packet with too-short header length %d", r.HeaderLength) - } - hlen := int(r.HeaderLength) * 2 - r.Contents = data[:hlen] - r.Payload = data[hlen : hlen+int(r.DataLength)] - r.VariableHeaderArea = data[18:hlen] - headerData := r.VariableHeaderArea - switch { - case r.SYN: - if len(headerData) != 6 { - return fmt.Errorf("RUDP packet invalid SYN header length: %d", len(headerData)) - } - r.RUDPHeaderSYN = &RUDPHeaderSYN{ - MaxOutstandingSegments: binary.BigEndian.Uint16(headerData[:2]), - MaxSegmentSize: binary.BigEndian.Uint16(headerData[2:4]), - OptionFlags: binary.BigEndian.Uint16(headerData[4:6]), - } - case r.EACK: - if len(headerData)%4 != 0 { - return fmt.Errorf("RUDP packet invalid EACK header length: %d", len(headerData)) - } - r.RUDPHeaderEACK = &RUDPHeaderEACK{make([]uint32, len(headerData)/4)} - for i := 0; i < len(headerData); i += 4 { - r.SeqsReceivedOK[i/4] = binary.BigEndian.Uint32(headerData[i : i+4]) - } - } - p.AddLayer(r) - p.SetTransportLayer(r) - return p.NextDecoder(gopacket.LayerTypePayload) -} - -func (r *RUDP) TransportFlow() gopacket.Flow { - return gopacket.NewFlow(EndpointRUDPPort, []byte{byte(r.SrcPort)}, []byte{byte(r.DstPort)}) -} diff --git a/vendor/github.com/google/gopacket/layers/sctp.go b/vendor/github.com/google/gopacket/layers/sctp.go deleted file mode 100644 index 511176e56..000000000 --- a/vendor/github.com/google/gopacket/layers/sctp.go +++ /dev/null @@ -1,746 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - "fmt" - "hash/crc32" - - "github.com/google/gopacket" -) - -// SCTP contains information on the top level of an SCTP packet. -type SCTP struct { - BaseLayer - SrcPort, DstPort SCTPPort - VerificationTag uint32 - Checksum uint32 - sPort, dPort []byte -} - -// LayerType returns gopacket.LayerTypeSCTP -func (s *SCTP) LayerType() gopacket.LayerType { return LayerTypeSCTP } - -func decodeSCTP(data []byte, p gopacket.PacketBuilder) error { - sctp := &SCTP{} - err := sctp.DecodeFromBytes(data, p) - p.AddLayer(sctp) - p.SetTransportLayer(sctp) - if err != nil { - return err - } - return p.NextDecoder(sctpChunkTypePrefixDecoder) -} - -var sctpChunkTypePrefixDecoder = gopacket.DecodeFunc(decodeWithSCTPChunkTypePrefix) - -// TransportFlow returns a flow based on the source and destination SCTP port. -func (s *SCTP) TransportFlow() gopacket.Flow { - return gopacket.NewFlow(EndpointSCTPPort, s.sPort, s.dPort) -} - -func decodeWithSCTPChunkTypePrefix(data []byte, p gopacket.PacketBuilder) error { - chunkType := SCTPChunkType(data[0]) - return chunkType.Decode(data, p) -} - -// SerializeTo is for gopacket.SerializableLayer. -func (s SCTP) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - bytes, err := b.PrependBytes(12) - if err != nil { - return err - } - binary.BigEndian.PutUint16(bytes[0:2], uint16(s.SrcPort)) - binary.BigEndian.PutUint16(bytes[2:4], uint16(s.DstPort)) - binary.BigEndian.PutUint32(bytes[4:8], s.VerificationTag) - if opts.ComputeChecksums { - // Note: MakeTable(Castagnoli) actually only creates the table once, then - // passes back a singleton on every other call, so this shouldn't cause - // excessive memory allocation. - binary.LittleEndian.PutUint32(bytes[8:12], crc32.Checksum(b.Bytes(), crc32.MakeTable(crc32.Castagnoli))) - } - return nil -} - -func (sctp *SCTP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 12 { - return errors.New("Invalid SCTP common header length") - } - sctp.SrcPort = SCTPPort(binary.BigEndian.Uint16(data[:2])) - sctp.sPort = data[:2] - sctp.DstPort = SCTPPort(binary.BigEndian.Uint16(data[2:4])) - sctp.dPort = data[2:4] - sctp.VerificationTag = binary.BigEndian.Uint32(data[4:8]) - sctp.Checksum = binary.BigEndian.Uint32(data[8:12]) - sctp.BaseLayer = BaseLayer{data[:12], data[12:]} - - return nil -} - -func (t *SCTP) CanDecode() gopacket.LayerClass { - return LayerTypeSCTP -} - -func (t *SCTP) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypePayload -} - -// SCTPChunk contains the common fields in all SCTP chunks. -type SCTPChunk struct { - BaseLayer - Type SCTPChunkType - Flags uint8 - Length uint16 - // ActualLength is the total length of an SCTP chunk, including padding. - // SCTP chunks start and end on 4-byte boundaries. So if a chunk has a length - // of 18, it means that it has data up to and including byte 18, then padding - // up to the next 4-byte boundary, 20. In this case, Length would be 18, and - // ActualLength would be 20. - ActualLength int -} - -func roundUpToNearest4(i int) int { - if i%4 == 0 { - return i - } - return i + 4 - (i % 4) -} - -func decodeSCTPChunk(data []byte) (SCTPChunk, error) { - length := binary.BigEndian.Uint16(data[2:4]) - if length < 4 { - return SCTPChunk{}, errors.New("invalid SCTP chunk length") - } - actual := roundUpToNearest4(int(length)) - ct := SCTPChunkType(data[0]) - - // For SCTP Data, use a separate layer for the payload - delta := 0 - if ct == SCTPChunkTypeData { - delta = int(actual) - int(length) - actual = 16 - } - - return SCTPChunk{ - Type: ct, - Flags: data[1], - Length: length, - ActualLength: actual, - BaseLayer: BaseLayer{data[:actual], data[actual : len(data)-delta]}, - }, nil -} - -// SCTPParameter is a TLV parameter inside a SCTPChunk. -type SCTPParameter struct { - Type uint16 - Length uint16 - ActualLength int - Value []byte -} - -func decodeSCTPParameter(data []byte) SCTPParameter { - length := binary.BigEndian.Uint16(data[2:4]) - return SCTPParameter{ - Type: binary.BigEndian.Uint16(data[0:2]), - Length: length, - Value: data[4:length], - ActualLength: roundUpToNearest4(int(length)), - } -} - -func (p SCTPParameter) Bytes() []byte { - length := 4 + len(p.Value) - data := make([]byte, roundUpToNearest4(length)) - binary.BigEndian.PutUint16(data[0:2], p.Type) - binary.BigEndian.PutUint16(data[2:4], uint16(length)) - copy(data[4:], p.Value) - return data -} - -// SCTPUnknownChunkType is the layer type returned when we don't recognize the -// chunk type. Since there's a length in a known location, we can skip over -// it even if we don't know what it is, and continue parsing the rest of the -// chunks. This chunk is stored as an ErrorLayer in the packet. -type SCTPUnknownChunkType struct { - SCTPChunk - bytes []byte -} - -func decodeSCTPChunkTypeUnknown(data []byte, p gopacket.PacketBuilder) error { - chunk, err := decodeSCTPChunk(data) - if err != nil { - return err - } - sc := &SCTPUnknownChunkType{SCTPChunk: chunk} - sc.bytes = data[:sc.ActualLength] - p.AddLayer(sc) - p.SetErrorLayer(sc) - return p.NextDecoder(gopacket.DecodeFunc(decodeWithSCTPChunkTypePrefix)) -} - -// SerializeTo is for gopacket.SerializableLayer. -func (s SCTPUnknownChunkType) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - bytes, err := b.PrependBytes(s.ActualLength) - if err != nil { - return err - } - copy(bytes, s.bytes) - return nil -} - -// LayerType returns gopacket.LayerTypeSCTPUnknownChunkType. -func (s *SCTPUnknownChunkType) LayerType() gopacket.LayerType { return LayerTypeSCTPUnknownChunkType } - -// Payload returns all bytes in this header, including the decoded Type, Length, -// and Flags. -func (s *SCTPUnknownChunkType) Payload() []byte { return s.bytes } - -// Error implements ErrorLayer. -func (s *SCTPUnknownChunkType) Error() error { - return fmt.Errorf("No decode method available for SCTP chunk type %s", s.Type) -} - -// SCTPData is the SCTP Data chunk layer. -type SCTPData struct { - SCTPChunk - Unordered, BeginFragment, EndFragment bool - TSN uint32 - StreamId uint16 - StreamSequence uint16 - PayloadProtocol SCTPPayloadProtocol -} - -// LayerType returns gopacket.LayerTypeSCTPData. -func (s *SCTPData) LayerType() gopacket.LayerType { return LayerTypeSCTPData } - -// SCTPPayloadProtocol represents a payload protocol -type SCTPPayloadProtocol uint32 - -// SCTPPayloadProtocol constonts from http://www.iana.org/assignments/sctp-parameters/sctp-parameters.xhtml -const ( - SCTPProtocolReserved SCTPPayloadProtocol = 0 - SCTPPayloadUIA = 1 - SCTPPayloadM2UA = 2 - SCTPPayloadM3UA = 3 - SCTPPayloadSUA = 4 - SCTPPayloadM2PA = 5 - SCTPPayloadV5UA = 6 - SCTPPayloadH248 = 7 - SCTPPayloadBICC = 8 - SCTPPayloadTALI = 9 - SCTPPayloadDUA = 10 - SCTPPayloadASAP = 11 - SCTPPayloadENRP = 12 - SCTPPayloadH323 = 13 - SCTPPayloadQIPC = 14 - SCTPPayloadSIMCO = 15 - SCTPPayloadDDPSegment = 16 - SCTPPayloadDDPStream = 17 - SCTPPayloadS1AP = 18 -) - -func (p SCTPPayloadProtocol) String() string { - switch p { - case SCTPProtocolReserved: - return "Reserved" - case SCTPPayloadUIA: - return "UIA" - case SCTPPayloadM2UA: - return "M2UA" - case SCTPPayloadM3UA: - return "M3UA" - case SCTPPayloadSUA: - return "SUA" - case SCTPPayloadM2PA: - return "M2PA" - case SCTPPayloadV5UA: - return "V5UA" - case SCTPPayloadH248: - return "H.248" - case SCTPPayloadBICC: - return "BICC" - case SCTPPayloadTALI: - return "TALI" - case SCTPPayloadDUA: - return "DUA" - case SCTPPayloadASAP: - return "ASAP" - case SCTPPayloadENRP: - return "ENRP" - case SCTPPayloadH323: - return "H.323" - case SCTPPayloadQIPC: - return "QIPC" - case SCTPPayloadSIMCO: - return "SIMCO" - case SCTPPayloadDDPSegment: - return "DDPSegment" - case SCTPPayloadDDPStream: - return "DDPStream" - case SCTPPayloadS1AP: - return "S1AP" - } - return fmt.Sprintf("Unknown(%d)", p) -} - -func decodeSCTPData(data []byte, p gopacket.PacketBuilder) error { - chunk, err := decodeSCTPChunk(data) - if err != nil { - return err - } - sc := &SCTPData{ - SCTPChunk: chunk, - Unordered: data[1]&0x4 != 0, - BeginFragment: data[1]&0x2 != 0, - EndFragment: data[1]&0x1 != 0, - TSN: binary.BigEndian.Uint32(data[4:8]), - StreamId: binary.BigEndian.Uint16(data[8:10]), - StreamSequence: binary.BigEndian.Uint16(data[10:12]), - PayloadProtocol: SCTPPayloadProtocol(binary.BigEndian.Uint32(data[12:16])), - } - // Length is the length in bytes of the data, INCLUDING the 16-byte header. - p.AddLayer(sc) - return p.NextDecoder(gopacket.LayerTypePayload) -} - -// SerializeTo is for gopacket.SerializableLayer. -func (sc SCTPData) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - payload := b.Bytes() - // Pad the payload to a 32 bit boundary - if rem := len(payload) % 4; rem != 0 { - b.AppendBytes(4 - rem) - } - length := 16 - bytes, err := b.PrependBytes(length) - if err != nil { - return err - } - bytes[0] = uint8(sc.Type) - flags := uint8(0) - if sc.Unordered { - flags |= 0x4 - } - if sc.BeginFragment { - flags |= 0x2 - } - if sc.EndFragment { - flags |= 0x1 - } - bytes[1] = flags - binary.BigEndian.PutUint16(bytes[2:4], uint16(length+len(payload))) - binary.BigEndian.PutUint32(bytes[4:8], sc.TSN) - binary.BigEndian.PutUint16(bytes[8:10], sc.StreamId) - binary.BigEndian.PutUint16(bytes[10:12], sc.StreamSequence) - binary.BigEndian.PutUint32(bytes[12:16], uint32(sc.PayloadProtocol)) - return nil -} - -// SCTPInitParameter is a parameter for an SCTP Init or InitAck packet. -type SCTPInitParameter SCTPParameter - -// SCTPInit is used as the return value for both SCTPInit and SCTPInitAck -// messages. -type SCTPInit struct { - SCTPChunk - InitiateTag uint32 - AdvertisedReceiverWindowCredit uint32 - OutboundStreams, InboundStreams uint16 - InitialTSN uint32 - Parameters []SCTPInitParameter -} - -// LayerType returns either gopacket.LayerTypeSCTPInit or gopacket.LayerTypeSCTPInitAck. -func (sc *SCTPInit) LayerType() gopacket.LayerType { - if sc.Type == SCTPChunkTypeInitAck { - return LayerTypeSCTPInitAck - } - // sc.Type == SCTPChunkTypeInit - return LayerTypeSCTPInit -} - -func decodeSCTPInit(data []byte, p gopacket.PacketBuilder) error { - chunk, err := decodeSCTPChunk(data) - if err != nil { - return err - } - sc := &SCTPInit{ - SCTPChunk: chunk, - InitiateTag: binary.BigEndian.Uint32(data[4:8]), - AdvertisedReceiverWindowCredit: binary.BigEndian.Uint32(data[8:12]), - OutboundStreams: binary.BigEndian.Uint16(data[12:14]), - InboundStreams: binary.BigEndian.Uint16(data[14:16]), - InitialTSN: binary.BigEndian.Uint32(data[16:20]), - } - paramData := data[20:sc.ActualLength] - for len(paramData) > 0 { - p := SCTPInitParameter(decodeSCTPParameter(paramData)) - paramData = paramData[p.ActualLength:] - sc.Parameters = append(sc.Parameters, p) - } - p.AddLayer(sc) - return p.NextDecoder(gopacket.DecodeFunc(decodeWithSCTPChunkTypePrefix)) -} - -// SerializeTo is for gopacket.SerializableLayer. -func (sc SCTPInit) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - var payload []byte - for _, param := range sc.Parameters { - payload = append(payload, SCTPParameter(param).Bytes()...) - } - length := 20 + len(payload) - bytes, err := b.PrependBytes(roundUpToNearest4(length)) - if err != nil { - return err - } - bytes[0] = uint8(sc.Type) - bytes[1] = sc.Flags - binary.BigEndian.PutUint16(bytes[2:4], uint16(length)) - binary.BigEndian.PutUint32(bytes[4:8], sc.InitiateTag) - binary.BigEndian.PutUint32(bytes[8:12], sc.AdvertisedReceiverWindowCredit) - binary.BigEndian.PutUint16(bytes[12:14], sc.OutboundStreams) - binary.BigEndian.PutUint16(bytes[14:16], sc.InboundStreams) - binary.BigEndian.PutUint32(bytes[16:20], sc.InitialTSN) - copy(bytes[20:], payload) - return nil -} - -// SCTPSack is the SCTP Selective ACK chunk layer. -type SCTPSack struct { - SCTPChunk - CumulativeTSNAck uint32 - AdvertisedReceiverWindowCredit uint32 - NumGapACKs, NumDuplicateTSNs uint16 - GapACKs []uint16 - DuplicateTSNs []uint32 -} - -// LayerType return LayerTypeSCTPSack -func (sc *SCTPSack) LayerType() gopacket.LayerType { - return LayerTypeSCTPSack -} - -func decodeSCTPSack(data []byte, p gopacket.PacketBuilder) error { - chunk, err := decodeSCTPChunk(data) - if err != nil { - return err - } - sc := &SCTPSack{ - SCTPChunk: chunk, - CumulativeTSNAck: binary.BigEndian.Uint32(data[4:8]), - AdvertisedReceiverWindowCredit: binary.BigEndian.Uint32(data[8:12]), - NumGapACKs: binary.BigEndian.Uint16(data[12:14]), - NumDuplicateTSNs: binary.BigEndian.Uint16(data[14:16]), - } - // We maximize gapAcks and dupTSNs here so we're not allocating tons - // of memory based on a user-controlable field. Our maximums are not exact, - // but should give us sane defaults... we'll still hit slice boundaries and - // fail if the user-supplied values are too high (in the for loops below), but - // the amount of memory we'll have allocated because of that should be small - // (< sc.ActualLength) - gapAcks := sc.SCTPChunk.ActualLength / 2 - dupTSNs := (sc.SCTPChunk.ActualLength - gapAcks*2) / 4 - if gapAcks > int(sc.NumGapACKs) { - gapAcks = int(sc.NumGapACKs) - } - if dupTSNs > int(sc.NumDuplicateTSNs) { - dupTSNs = int(sc.NumDuplicateTSNs) - } - sc.GapACKs = make([]uint16, 0, gapAcks) - sc.DuplicateTSNs = make([]uint32, 0, dupTSNs) - bytesRemaining := data[16:] - for i := 0; i < int(sc.NumGapACKs); i++ { - sc.GapACKs = append(sc.GapACKs, binary.BigEndian.Uint16(bytesRemaining[:2])) - bytesRemaining = bytesRemaining[2:] - } - for i := 0; i < int(sc.NumDuplicateTSNs); i++ { - sc.DuplicateTSNs = append(sc.DuplicateTSNs, binary.BigEndian.Uint32(bytesRemaining[:4])) - bytesRemaining = bytesRemaining[4:] - } - p.AddLayer(sc) - return p.NextDecoder(gopacket.DecodeFunc(decodeWithSCTPChunkTypePrefix)) -} - -// SerializeTo is for gopacket.SerializableLayer. -func (sc SCTPSack) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - length := 16 + 2*len(sc.GapACKs) + 4*len(sc.DuplicateTSNs) - bytes, err := b.PrependBytes(roundUpToNearest4(length)) - if err != nil { - return err - } - bytes[0] = uint8(sc.Type) - bytes[1] = sc.Flags - binary.BigEndian.PutUint16(bytes[2:4], uint16(length)) - binary.BigEndian.PutUint32(bytes[4:8], sc.CumulativeTSNAck) - binary.BigEndian.PutUint32(bytes[8:12], sc.AdvertisedReceiverWindowCredit) - binary.BigEndian.PutUint16(bytes[12:14], uint16(len(sc.GapACKs))) - binary.BigEndian.PutUint16(bytes[14:16], uint16(len(sc.DuplicateTSNs))) - for i, v := range sc.GapACKs { - binary.BigEndian.PutUint16(bytes[16+i*2:], v) - } - offset := 16 + 2*len(sc.GapACKs) - for i, v := range sc.DuplicateTSNs { - binary.BigEndian.PutUint32(bytes[offset+i*4:], v) - } - return nil -} - -// SCTPHeartbeatParameter is the parameter type used by SCTP heartbeat and -// heartbeat ack layers. -type SCTPHeartbeatParameter SCTPParameter - -// SCTPHeartbeat is the SCTP heartbeat layer, also used for heatbeat ack. -type SCTPHeartbeat struct { - SCTPChunk - Parameters []SCTPHeartbeatParameter -} - -// LayerType returns gopacket.LayerTypeSCTPHeartbeat. -func (sc *SCTPHeartbeat) LayerType() gopacket.LayerType { - if sc.Type == SCTPChunkTypeHeartbeatAck { - return LayerTypeSCTPHeartbeatAck - } - // sc.Type == SCTPChunkTypeHeartbeat - return LayerTypeSCTPHeartbeat -} - -func decodeSCTPHeartbeat(data []byte, p gopacket.PacketBuilder) error { - chunk, err := decodeSCTPChunk(data) - if err != nil { - return err - } - sc := &SCTPHeartbeat{ - SCTPChunk: chunk, - } - paramData := data[4:sc.Length] - for len(paramData) > 0 { - p := SCTPHeartbeatParameter(decodeSCTPParameter(paramData)) - paramData = paramData[p.ActualLength:] - sc.Parameters = append(sc.Parameters, p) - } - p.AddLayer(sc) - return p.NextDecoder(gopacket.DecodeFunc(decodeWithSCTPChunkTypePrefix)) -} - -// SerializeTo is for gopacket.SerializableLayer. -func (sc SCTPHeartbeat) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - var payload []byte - for _, param := range sc.Parameters { - payload = append(payload, SCTPParameter(param).Bytes()...) - } - length := 4 + len(payload) - - bytes, err := b.PrependBytes(roundUpToNearest4(length)) - if err != nil { - return err - } - bytes[0] = uint8(sc.Type) - bytes[1] = sc.Flags - binary.BigEndian.PutUint16(bytes[2:4], uint16(length)) - copy(bytes[4:], payload) - return nil -} - -// SCTPErrorParameter is the parameter type used by SCTP Abort and Error layers. -type SCTPErrorParameter SCTPParameter - -// SCTPError is the SCTP error layer, also used for SCTP aborts. -type SCTPError struct { - SCTPChunk - Parameters []SCTPErrorParameter -} - -// LayerType returns LayerTypeSCTPAbort or LayerTypeSCTPError. -func (sc *SCTPError) LayerType() gopacket.LayerType { - if sc.Type == SCTPChunkTypeAbort { - return LayerTypeSCTPAbort - } - // sc.Type == SCTPChunkTypeError - return LayerTypeSCTPError -} - -func decodeSCTPError(data []byte, p gopacket.PacketBuilder) error { - // remarkably similar to decodeSCTPHeartbeat ;) - chunk, err := decodeSCTPChunk(data) - if err != nil { - return err - } - sc := &SCTPError{ - SCTPChunk: chunk, - } - paramData := data[4:sc.Length] - for len(paramData) > 0 { - p := SCTPErrorParameter(decodeSCTPParameter(paramData)) - paramData = paramData[p.ActualLength:] - sc.Parameters = append(sc.Parameters, p) - } - p.AddLayer(sc) - return p.NextDecoder(gopacket.DecodeFunc(decodeWithSCTPChunkTypePrefix)) -} - -// SerializeTo is for gopacket.SerializableLayer. -func (sc SCTPError) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - var payload []byte - for _, param := range sc.Parameters { - payload = append(payload, SCTPParameter(param).Bytes()...) - } - length := 4 + len(payload) - - bytes, err := b.PrependBytes(roundUpToNearest4(length)) - if err != nil { - return err - } - bytes[0] = uint8(sc.Type) - bytes[1] = sc.Flags - binary.BigEndian.PutUint16(bytes[2:4], uint16(length)) - copy(bytes[4:], payload) - return nil -} - -// SCTPShutdown is the SCTP shutdown layer. -type SCTPShutdown struct { - SCTPChunk - CumulativeTSNAck uint32 -} - -// LayerType returns gopacket.LayerTypeSCTPShutdown. -func (sc *SCTPShutdown) LayerType() gopacket.LayerType { return LayerTypeSCTPShutdown } - -func decodeSCTPShutdown(data []byte, p gopacket.PacketBuilder) error { - chunk, err := decodeSCTPChunk(data) - if err != nil { - return err - } - sc := &SCTPShutdown{ - SCTPChunk: chunk, - CumulativeTSNAck: binary.BigEndian.Uint32(data[4:8]), - } - p.AddLayer(sc) - return p.NextDecoder(gopacket.DecodeFunc(decodeWithSCTPChunkTypePrefix)) -} - -// SerializeTo is for gopacket.SerializableLayer. -func (sc SCTPShutdown) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - bytes, err := b.PrependBytes(8) - if err != nil { - return err - } - bytes[0] = uint8(sc.Type) - bytes[1] = sc.Flags - binary.BigEndian.PutUint16(bytes[2:4], 8) - binary.BigEndian.PutUint32(bytes[4:8], sc.CumulativeTSNAck) - return nil -} - -// SCTPShutdownAck is the SCTP shutdown layer. -type SCTPShutdownAck struct { - SCTPChunk -} - -// LayerType returns gopacket.LayerTypeSCTPShutdownAck. -func (sc *SCTPShutdownAck) LayerType() gopacket.LayerType { return LayerTypeSCTPShutdownAck } - -func decodeSCTPShutdownAck(data []byte, p gopacket.PacketBuilder) error { - chunk, err := decodeSCTPChunk(data) - if err != nil { - return err - } - sc := &SCTPShutdownAck{ - SCTPChunk: chunk, - } - p.AddLayer(sc) - return p.NextDecoder(gopacket.DecodeFunc(decodeWithSCTPChunkTypePrefix)) -} - -// SerializeTo is for gopacket.SerializableLayer. -func (sc SCTPShutdownAck) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - bytes, err := b.PrependBytes(4) - if err != nil { - return err - } - bytes[0] = uint8(sc.Type) - bytes[1] = sc.Flags - binary.BigEndian.PutUint16(bytes[2:4], 4) - return nil -} - -// SCTPCookieEcho is the SCTP Cookie Echo layer. -type SCTPCookieEcho struct { - SCTPChunk - Cookie []byte -} - -// LayerType returns gopacket.LayerTypeSCTPCookieEcho. -func (sc *SCTPCookieEcho) LayerType() gopacket.LayerType { return LayerTypeSCTPCookieEcho } - -func decodeSCTPCookieEcho(data []byte, p gopacket.PacketBuilder) error { - chunk, err := decodeSCTPChunk(data) - if err != nil { - return err - } - sc := &SCTPCookieEcho{ - SCTPChunk: chunk, - } - sc.Cookie = data[4:sc.Length] - p.AddLayer(sc) - return p.NextDecoder(gopacket.DecodeFunc(decodeWithSCTPChunkTypePrefix)) -} - -// SerializeTo is for gopacket.SerializableLayer. -func (sc SCTPCookieEcho) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - length := 4 + len(sc.Cookie) - bytes, err := b.PrependBytes(roundUpToNearest4(length)) - if err != nil { - return err - } - bytes[0] = uint8(sc.Type) - bytes[1] = sc.Flags - binary.BigEndian.PutUint16(bytes[2:4], uint16(length)) - copy(bytes[4:], sc.Cookie) - return nil -} - -// This struct is used by all empty SCTP chunks (currently CookieAck and -// ShutdownComplete). -type SCTPEmptyLayer struct { - SCTPChunk -} - -// LayerType returns either gopacket.LayerTypeSCTPShutdownComplete or -// LayerTypeSCTPCookieAck. -func (sc *SCTPEmptyLayer) LayerType() gopacket.LayerType { - if sc.Type == SCTPChunkTypeShutdownComplete { - return LayerTypeSCTPShutdownComplete - } - // sc.Type == SCTPChunkTypeCookieAck - return LayerTypeSCTPCookieAck -} - -func decodeSCTPEmptyLayer(data []byte, p gopacket.PacketBuilder) error { - chunk, err := decodeSCTPChunk(data) - if err != nil { - return err - } - sc := &SCTPEmptyLayer{ - SCTPChunk: chunk, - } - p.AddLayer(sc) - return p.NextDecoder(gopacket.DecodeFunc(decodeWithSCTPChunkTypePrefix)) -} - -// SerializeTo is for gopacket.SerializableLayer. -func (sc SCTPEmptyLayer) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - bytes, err := b.PrependBytes(4) - if err != nil { - return err - } - bytes[0] = uint8(sc.Type) - bytes[1] = sc.Flags - binary.BigEndian.PutUint16(bytes[2:4], 4) - return nil -} diff --git a/vendor/github.com/google/gopacket/layers/sflow.go b/vendor/github.com/google/gopacket/layers/sflow.go deleted file mode 100644 index bc1c9733b..000000000 --- a/vendor/github.com/google/gopacket/layers/sflow.go +++ /dev/null @@ -1,2567 +0,0 @@ -// Copyright 2014 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -/* -This layer decodes SFlow version 5 datagrams. - -The specification can be found here: http://sflow.org/sflow_version_5.txt - -Additional developer information about sflow can be found at: -http://sflow.org/developers/specifications.php - -And SFlow in general: -http://sflow.org/index.php - -Two forms of sample data are defined: compact and expanded. The -Specification has this to say: - - Compact and expand forms of counter and flow samples are defined. - An agent must not mix compact/expanded encodings. If an agent - will never use ifIndex numbers >= 2^24 then it must use compact - encodings for all interfaces. Otherwise the expanded formats must - be used for all interfaces. - -This decoder only supports the compact form, because that is the only -one for which data was available. - -The datagram is composed of one or more samples of type flow or counter, -and each sample is composed of one or more records describing the sample. -A sample is a single instance of sampled inforamtion, and each record in -the sample gives additional / supplimentary information about the sample. - -The following sample record types are supported: - - Raw Packet Header - opaque = flow_data; enterprise = 0; format = 1 - - Extended Switch Data - opaque = flow_data; enterprise = 0; format = 1001 - - Extended Router Data - opaque = flow_data; enterprise = 0; format = 1002 - - Extended Gateway Data - opaque = flow_data; enterprise = 0; format = 1003 - - Extended User Data - opaque = flow_data; enterprise = 0; format = 1004 - - Extended URL Data - opaque = flow_data; enterprise = 0; format = 1005 - -The following types of counter records are supported: - - Generic Interface Counters - see RFC 2233 - opaque = counter_data; enterprise = 0; format = 1 - - Ethernet Interface Counters - see RFC 2358 - opaque = counter_data; enterprise = 0; format = 2 - -SFlow is encoded using XDR (RFC4506). There are a few places -where the standard 4-byte fields are partitioned into two -bitfields of different lengths. I'm not sure why the designers -chose to pack together two values like this in some places, and -in others they use the entire 4-byte value to store a number that -will never be more than a few bits. In any case, there are a couple -of types defined to handle the decoding of these bitfields, and -that's why they're there. */ - -package layers - -import ( - "encoding/binary" - "errors" - "fmt" - "net" - - "github.com/google/gopacket" -) - -// SFlowRecord holds both flow sample records and counter sample records. -// A Record is the structure that actually holds the sampled data -// and / or counters. -type SFlowRecord interface { -} - -// SFlowDataSource encodes a 2-bit SFlowSourceFormat in its most significant -// 2 bits, and an SFlowSourceValue in its least significant 30 bits. -// These types and values define the meaning of the inteface information -// presented in the sample metadata. -type SFlowDataSource int32 - -func (sdc SFlowDataSource) decode() (SFlowSourceFormat, SFlowSourceValue) { - leftField := sdc >> 30 - rightField := uint32(0x3FFFFFFF) & uint32(sdc) - return SFlowSourceFormat(leftField), SFlowSourceValue(rightField) -} - -type SFlowDataSourceExpanded struct { - SourceIDClass SFlowSourceFormat - SourceIDIndex SFlowSourceValue -} - -func (sdce SFlowDataSourceExpanded) decode() (SFlowSourceFormat, SFlowSourceValue) { - leftField := sdce.SourceIDClass >> 30 - rightField := uint32(0x3FFFFFFF) & uint32(sdce.SourceIDIndex) - return SFlowSourceFormat(leftField), SFlowSourceValue(rightField) -} - -type SFlowSourceFormat uint32 - -type SFlowSourceValue uint32 - -const ( - SFlowTypeSingleInterface SFlowSourceFormat = 0 - SFlowTypePacketDiscarded SFlowSourceFormat = 1 - SFlowTypeMultipleDestinations SFlowSourceFormat = 2 -) - -func (sdf SFlowSourceFormat) String() string { - switch sdf { - case SFlowTypeSingleInterface: - return "Single Interface" - case SFlowTypePacketDiscarded: - return "Packet Discarded" - case SFlowTypeMultipleDestinations: - return "Multiple Destinations" - default: - return "UNKNOWN" - } -} - -func decodeSFlow(data []byte, p gopacket.PacketBuilder) error { - s := &SFlowDatagram{} - err := s.DecodeFromBytes(data, p) - if err != nil { - return err - } - p.AddLayer(s) - p.SetApplicationLayer(s) - return nil -} - -// SFlowDatagram is the outermost container which holds some basic information -// about the reporting agent, and holds at least one sample record -type SFlowDatagram struct { - BaseLayer - - DatagramVersion uint32 - AgentAddress net.IP - SubAgentID uint32 - SequenceNumber uint32 - AgentUptime uint32 - SampleCount uint32 - FlowSamples []SFlowFlowSample - CounterSamples []SFlowCounterSample -} - -// An SFlow datagram's outer container has the following -// structure: - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int sFlow version (2|4|5) | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int IP version of the Agent (1=v4|2=v6) | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// / Agent IP address (v4=4byte|v6=16byte) / -// / / -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int sub agent id | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int datagram sequence number | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int switch uptime in ms | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int n samples in datagram | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// / n samples / -// / / -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - -// SFlowDataFormat encodes the EnterpriseID in the most -// significant 12 bits, and the SampleType in the least significant -// 20 bits. -type SFlowDataFormat uint32 - -func (sdf SFlowDataFormat) decode() (SFlowEnterpriseID, SFlowSampleType) { - leftField := sdf >> 12 - rightField := uint32(0xFFF) & uint32(sdf) - return SFlowEnterpriseID(leftField), SFlowSampleType(rightField) -} - -// SFlowEnterpriseID is used to differentiate between the -// official SFlow standard, and other, vendor-specific -// types of flow data. (Similiar to SNMP's enterprise MIB -// OIDs) Only the office SFlow Enterprise ID is decoded -// here. -type SFlowEnterpriseID uint32 - -const ( - SFlowStandard SFlowEnterpriseID = 0 -) - -func (eid SFlowEnterpriseID) String() string { - switch eid { - case SFlowStandard: - return "Standard SFlow" - default: - return "" - } -} - -func (eid SFlowEnterpriseID) GetType() SFlowEnterpriseID { - return SFlowStandard -} - -// SFlowSampleType specifies the type of sample. Only flow samples -// and counter samples are supported -type SFlowSampleType uint32 - -const ( - SFlowTypeFlowSample SFlowSampleType = 1 - SFlowTypeCounterSample SFlowSampleType = 2 - SFlowTypeExpandedFlowSample SFlowSampleType = 3 - SFlowTypeExpandedCounterSample SFlowSampleType = 4 -) - -func (st SFlowSampleType) GetType() SFlowSampleType { - switch st { - case SFlowTypeFlowSample: - return SFlowTypeFlowSample - case SFlowTypeCounterSample: - return SFlowTypeCounterSample - case SFlowTypeExpandedFlowSample: - return SFlowTypeExpandedFlowSample - case SFlowTypeExpandedCounterSample: - return SFlowTypeExpandedCounterSample - default: - panic("Invalid Sample Type") - } -} - -func (st SFlowSampleType) String() string { - switch st { - case SFlowTypeFlowSample: - return "Flow Sample" - case SFlowTypeCounterSample: - return "Counter Sample" - case SFlowTypeExpandedFlowSample: - return "Expanded Flow Sample" - case SFlowTypeExpandedCounterSample: - return "Expanded Counter Sample" - default: - return "" - } -} - -func (s *SFlowDatagram) LayerType() gopacket.LayerType { return LayerTypeSFlow } - -func (d *SFlowDatagram) Payload() []byte { return nil } - -func (d *SFlowDatagram) CanDecode() gopacket.LayerClass { return LayerTypeSFlow } - -func (d *SFlowDatagram) NextLayerType() gopacket.LayerType { return gopacket.LayerTypePayload } - -// SFlowIPType determines what form the IP address being decoded will -// take. This is an XDR union type allowing for both IPv4 and IPv6 -type SFlowIPType uint32 - -const ( - SFlowIPv4 SFlowIPType = 1 - SFlowIPv6 SFlowIPType = 2 -) - -func (s SFlowIPType) String() string { - switch s { - case SFlowIPv4: - return "IPv4" - case SFlowIPv6: - return "IPv6" - default: - return "" - } -} - -func (s SFlowIPType) Length() int { - switch s { - case SFlowIPv4: - return 4 - case SFlowIPv6: - return 16 - default: - return 0 - } -} - -func (s *SFlowDatagram) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - var agentAddressType SFlowIPType - - data, s.DatagramVersion = data[4:], binary.BigEndian.Uint32(data[:4]) - data, agentAddressType = data[4:], SFlowIPType(binary.BigEndian.Uint32(data[:4])) - data, s.AgentAddress = data[agentAddressType.Length():], data[:agentAddressType.Length()] - data, s.SubAgentID = data[4:], binary.BigEndian.Uint32(data[:4]) - data, s.SequenceNumber = data[4:], binary.BigEndian.Uint32(data[:4]) - data, s.AgentUptime = data[4:], binary.BigEndian.Uint32(data[:4]) - data, s.SampleCount = data[4:], binary.BigEndian.Uint32(data[:4]) - - if s.SampleCount < 1 { - return fmt.Errorf("SFlow Datagram has invalid sample length: %d", s.SampleCount) - } - for i := uint32(0); i < s.SampleCount; i++ { - sdf := SFlowDataFormat(binary.BigEndian.Uint32(data[:4])) - _, sampleType := sdf.decode() - switch sampleType { - case SFlowTypeFlowSample: - if flowSample, err := decodeFlowSample(&data, false); err == nil { - s.FlowSamples = append(s.FlowSamples, flowSample) - } else { - return err - } - case SFlowTypeCounterSample: - if counterSample, err := decodeCounterSample(&data, false); err == nil { - s.CounterSamples = append(s.CounterSamples, counterSample) - } else { - return err - } - case SFlowTypeExpandedFlowSample: - if flowSample, err := decodeFlowSample(&data, true); err == nil { - s.FlowSamples = append(s.FlowSamples, flowSample) - } else { - return err - } - case SFlowTypeExpandedCounterSample: - if counterSample, err := decodeCounterSample(&data, true); err == nil { - s.CounterSamples = append(s.CounterSamples, counterSample) - } else { - return err - } - - default: - return fmt.Errorf("Unsupported SFlow sample type %d", sampleType) - } - } - return nil -} - -// SFlowFlowSample represents a sampled packet and contains -// one or more records describing the packet -type SFlowFlowSample struct { - EnterpriseID SFlowEnterpriseID - Format SFlowSampleType - SampleLength uint32 - SequenceNumber uint32 - SourceIDClass SFlowSourceFormat - SourceIDIndex SFlowSourceValue - SamplingRate uint32 - SamplePool uint32 - Dropped uint32 - InputInterfaceFormat uint32 - InputInterface uint32 - OutputInterfaceFormat uint32 - OutputInterface uint32 - RecordCount uint32 - Records []SFlowRecord -} - -// Flow samples have the following structure. Note -// the bit fields to encode the Enterprise ID and the -// Flow record format: type 1 - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | 20 bit Interprise (0) |12 bit format | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | sample length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int sample sequence number | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// |id type | src id index value | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int sampling rate | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int sample pool | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int drops | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int input ifIndex | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int output ifIndex | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int number of records | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// / flow records / -// / / -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - -// Flow samples have the following structure. -// Flow record format: type 3 - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | 20 bit Interprise (0) |12 bit format | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | sample length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int sample sequence number | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int src id type | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int src id index value | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int sampling rate | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int sample pool | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int drops | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int input interface format | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int input interface value | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int output interface format | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int output interface value | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int number of records | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// / flow records / -// / / -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - -type SFlowFlowDataFormat uint32 - -func (fdf SFlowFlowDataFormat) decode() (SFlowEnterpriseID, SFlowFlowRecordType) { - leftField := fdf >> 12 - rightField := uint32(0xFFF) & uint32(fdf) - return SFlowEnterpriseID(leftField), SFlowFlowRecordType(rightField) -} - -func (fs SFlowFlowSample) GetRecords() []SFlowRecord { - return fs.Records -} - -func (fs SFlowFlowSample) GetType() SFlowSampleType { - return SFlowTypeFlowSample -} - -func skipRecord(data *[]byte) { - recordLength := int(binary.BigEndian.Uint32((*data)[4:])) - *data = (*data)[(recordLength+((4-recordLength)%4))+8:] -} - -func decodeFlowSample(data *[]byte, expanded bool) (SFlowFlowSample, error) { - s := SFlowFlowSample{} - var sdf SFlowDataFormat - *data, sdf = (*data)[4:], SFlowDataFormat(binary.BigEndian.Uint32((*data)[:4])) - var sdc SFlowDataSource - - s.EnterpriseID, s.Format = sdf.decode() - if len(*data) < 4 { - return SFlowFlowSample{}, errors.New("ethernet counters too small") - } - *data, s.SampleLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - if len(*data) < 4 { - return SFlowFlowSample{}, errors.New("ethernet counters too small") - } - *data, s.SequenceNumber = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - if expanded { - if len(*data) < 4 { - return SFlowFlowSample{}, errors.New("ethernet counters too small") - } - *data, s.SourceIDClass = (*data)[4:], SFlowSourceFormat(binary.BigEndian.Uint32((*data)[:4])) - if len(*data) < 4 { - return SFlowFlowSample{}, errors.New("ethernet counters too small") - } - *data, s.SourceIDIndex = (*data)[4:], SFlowSourceValue(binary.BigEndian.Uint32((*data)[:4])) - } else { - if len(*data) < 4 { - return SFlowFlowSample{}, errors.New("ethernet counters too small") - } - *data, sdc = (*data)[4:], SFlowDataSource(binary.BigEndian.Uint32((*data)[:4])) - s.SourceIDClass, s.SourceIDIndex = sdc.decode() - } - if len(*data) < 4 { - return SFlowFlowSample{}, errors.New("ethernet counters too small") - } - *data, s.SamplingRate = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - if len(*data) < 4 { - return SFlowFlowSample{}, errors.New("ethernet counters too small") - } - *data, s.SamplePool = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - if len(*data) < 4 { - return SFlowFlowSample{}, errors.New("ethernet counters too small") - } - *data, s.Dropped = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - - if expanded { - if len(*data) < 4 { - return SFlowFlowSample{}, errors.New("ethernet counters too small") - } - *data, s.InputInterfaceFormat = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - if len(*data) < 4 { - return SFlowFlowSample{}, errors.New("ethernet counters too small") - } - *data, s.InputInterface = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - if len(*data) < 4 { - return SFlowFlowSample{}, errors.New("ethernet counters too small") - } - *data, s.OutputInterfaceFormat = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - if len(*data) < 4 { - return SFlowFlowSample{}, errors.New("ethernet counters too small") - } - *data, s.OutputInterface = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - } else { - if len(*data) < 4 { - return SFlowFlowSample{}, errors.New("ethernet counters too small") - } - *data, s.InputInterface = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - if len(*data) < 4 { - return SFlowFlowSample{}, errors.New("ethernet counters too small") - } - *data, s.OutputInterface = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - } - if len(*data) < 4 { - return SFlowFlowSample{}, errors.New("ethernet counters too small") - } - *data, s.RecordCount = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - - for i := uint32(0); i < s.RecordCount; i++ { - rdf := SFlowFlowDataFormat(binary.BigEndian.Uint32((*data)[:4])) - enterpriseID, flowRecordType := rdf.decode() - - // Try to decode when EnterpriseID is 0 signaling - // default sflow structs are used according specification - // Unexpected behavior detected for e.g. with pmacct - if enterpriseID == 0 { - switch flowRecordType { - case SFlowTypeRawPacketFlow: - if record, err := decodeRawPacketFlowRecord(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - case SFlowTypeExtendedUserFlow: - if record, err := decodeExtendedUserFlow(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - case SFlowTypeExtendedUrlFlow: - if record, err := decodeExtendedURLRecord(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - case SFlowTypeExtendedSwitchFlow: - if record, err := decodeExtendedSwitchFlowRecord(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - case SFlowTypeExtendedRouterFlow: - if record, err := decodeExtendedRouterFlowRecord(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - case SFlowTypeExtendedGatewayFlow: - if record, err := decodeExtendedGatewayFlowRecord(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - case SFlowTypeEthernetFrameFlow: - if record, err := decodeEthernetFrameFlowRecord(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - case SFlowTypeIpv4Flow: - if record, err := decodeSFlowIpv4Record(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - case SFlowTypeIpv6Flow: - if record, err := decodeSFlowIpv6Record(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - case SFlowTypeExtendedMlpsFlow: - // TODO - skipRecord(data) - return s, errors.New("skipping TypeExtendedMlpsFlow") - case SFlowTypeExtendedNatFlow: - // TODO - skipRecord(data) - return s, errors.New("skipping TypeExtendedNatFlow") - case SFlowTypeExtendedMlpsTunnelFlow: - // TODO - skipRecord(data) - return s, errors.New("skipping TypeExtendedMlpsTunnelFlow") - case SFlowTypeExtendedMlpsVcFlow: - // TODO - skipRecord(data) - return s, errors.New("skipping TypeExtendedMlpsVcFlow") - case SFlowTypeExtendedMlpsFecFlow: - // TODO - skipRecord(data) - return s, errors.New("skipping TypeExtendedMlpsFecFlow") - case SFlowTypeExtendedMlpsLvpFecFlow: - // TODO - skipRecord(data) - return s, errors.New("skipping TypeExtendedMlpsLvpFecFlow") - case SFlowTypeExtendedVlanFlow: - // TODO - skipRecord(data) - return s, errors.New("skipping TypeExtendedVlanFlow") - case SFlowTypeExtendedIpv4TunnelEgressFlow: - if record, err := decodeExtendedIpv4TunnelEgress(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - case SFlowTypeExtendedIpv4TunnelIngressFlow: - if record, err := decodeExtendedIpv4TunnelIngress(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - case SFlowTypeExtendedIpv6TunnelEgressFlow: - if record, err := decodeExtendedIpv6TunnelEgress(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - case SFlowTypeExtendedIpv6TunnelIngressFlow: - if record, err := decodeExtendedIpv6TunnelIngress(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - case SFlowTypeExtendedDecapsulateEgressFlow: - if record, err := decodeExtendedDecapsulateEgress(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - case SFlowTypeExtendedDecapsulateIngressFlow: - if record, err := decodeExtendedDecapsulateIngress(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - case SFlowTypeExtendedVniEgressFlow: - if record, err := decodeExtendedVniEgress(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - case SFlowTypeExtendedVniIngressFlow: - if record, err := decodeExtendedVniIngress(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - default: - return s, fmt.Errorf("Unsupported flow record type: %d", flowRecordType) - } - } else { - skipRecord(data) - } - } - return s, nil -} - -// Counter samples report information about various counter -// objects. Typically these are items like IfInOctets, or -// CPU / Memory stats, etc. SFlow will report these at regular -// intervals as configured on the agent. If one were sufficiently -// industrious, this could be used to replace the typical -// SNMP polling used for such things. -type SFlowCounterSample struct { - EnterpriseID SFlowEnterpriseID - Format SFlowSampleType - SampleLength uint32 - SequenceNumber uint32 - SourceIDClass SFlowSourceFormat - SourceIDIndex SFlowSourceValue - RecordCount uint32 - Records []SFlowRecord -} - -// Counter samples have the following structure: - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int sample sequence number | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// |id type | src id index value | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | int number of records | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// / counter records / -// / / -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - -type SFlowCounterDataFormat uint32 - -func (cdf SFlowCounterDataFormat) decode() (SFlowEnterpriseID, SFlowCounterRecordType) { - leftField := cdf >> 12 - rightField := uint32(0xFFF) & uint32(cdf) - return SFlowEnterpriseID(leftField), SFlowCounterRecordType(rightField) -} - -// GetRecords will return a slice of interface types -// representing records. A type switch can be used to -// get at the underlying SFlowCounterRecordType. -func (cs SFlowCounterSample) GetRecords() []SFlowRecord { - return cs.Records -} - -// GetType will report the type of sample. Only the -// compact form of counter samples is supported -func (cs SFlowCounterSample) GetType() SFlowSampleType { - return SFlowTypeCounterSample -} - -type SFlowCounterRecordType uint32 - -const ( - SFlowTypeGenericInterfaceCounters SFlowCounterRecordType = 1 - SFlowTypeEthernetInterfaceCounters SFlowCounterRecordType = 2 - SFlowTypeTokenRingInterfaceCounters SFlowCounterRecordType = 3 - SFlowType100BaseVGInterfaceCounters SFlowCounterRecordType = 4 - SFlowTypeVLANCounters SFlowCounterRecordType = 5 - SFlowTypeLACPCounters SFlowCounterRecordType = 7 - SFlowTypeProcessorCounters SFlowCounterRecordType = 1001 - SFlowTypeOpenflowPortCounters SFlowCounterRecordType = 1004 - SFlowTypePORTNAMECounters SFlowCounterRecordType = 1005 - SFLowTypeAPPRESOURCESCounters SFlowCounterRecordType = 2203 - SFlowTypeOVSDPCounters SFlowCounterRecordType = 2207 -) - -func (cr SFlowCounterRecordType) String() string { - switch cr { - case SFlowTypeGenericInterfaceCounters: - return "Generic Interface Counters" - case SFlowTypeEthernetInterfaceCounters: - return "Ethernet Interface Counters" - case SFlowTypeTokenRingInterfaceCounters: - return "Token Ring Interface Counters" - case SFlowType100BaseVGInterfaceCounters: - return "100BaseVG Interface Counters" - case SFlowTypeVLANCounters: - return "VLAN Counters" - case SFlowTypeLACPCounters: - return "LACP Counters" - case SFlowTypeProcessorCounters: - return "Processor Counters" - case SFlowTypeOpenflowPortCounters: - return "Openflow Port Counters" - case SFlowTypePORTNAMECounters: - return "PORT NAME Counters" - case SFLowTypeAPPRESOURCESCounters: - return "App Resources Counters" - case SFlowTypeOVSDPCounters: - return "OVSDP Counters" - default: - return "" - - } -} - -func decodeCounterSample(data *[]byte, expanded bool) (SFlowCounterSample, error) { - s := SFlowCounterSample{} - var sdc SFlowDataSource - var sdce SFlowDataSourceExpanded - var sdf SFlowDataFormat - - *data, sdf = (*data)[4:], SFlowDataFormat(binary.BigEndian.Uint32((*data)[:4])) - s.EnterpriseID, s.Format = sdf.decode() - *data, s.SampleLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, s.SequenceNumber = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - if expanded { - *data, sdce = (*data)[8:], SFlowDataSourceExpanded{SFlowSourceFormat(binary.BigEndian.Uint32((*data)[:4])), SFlowSourceValue(binary.BigEndian.Uint32((*data)[4:8]))} - s.SourceIDClass, s.SourceIDIndex = sdce.decode() - } else { - *data, sdc = (*data)[4:], SFlowDataSource(binary.BigEndian.Uint32((*data)[:4])) - s.SourceIDClass, s.SourceIDIndex = sdc.decode() - } - *data, s.RecordCount = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - - for i := uint32(0); i < s.RecordCount; i++ { - cdf := SFlowCounterDataFormat(binary.BigEndian.Uint32((*data)[:4])) - _, counterRecordType := cdf.decode() - switch counterRecordType { - case SFlowTypeGenericInterfaceCounters: - if record, err := decodeGenericInterfaceCounters(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - case SFlowTypeEthernetInterfaceCounters: - if record, err := decodeEthernetCounters(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - case SFlowTypeTokenRingInterfaceCounters: - skipRecord(data) - return s, errors.New("skipping TypeTokenRingInterfaceCounters") - case SFlowType100BaseVGInterfaceCounters: - skipRecord(data) - return s, errors.New("skipping Type100BaseVGInterfaceCounters") - case SFlowTypeVLANCounters: - if record, err := decodeVLANCounters(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - case SFlowTypeLACPCounters: - if record, err := decodeLACPCounters(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - case SFlowTypeProcessorCounters: - if record, err := decodeProcessorCounters(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - case SFlowTypeOpenflowPortCounters: - if record, err := decodeOpenflowportCounters(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - case SFlowTypePORTNAMECounters: - if record, err := decodePortnameCounters(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - case SFLowTypeAPPRESOURCESCounters: - if record, err := decodeAppresourcesCounters(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - case SFlowTypeOVSDPCounters: - if record, err := decodeOVSDPCounters(data); err == nil { - s.Records = append(s.Records, record) - } else { - return s, err - } - default: - return s, fmt.Errorf("Invalid counter record type: %d", counterRecordType) - } - } - return s, nil -} - -// SFlowBaseFlowRecord holds the fields common to all records -// of type SFlowFlowRecordType -type SFlowBaseFlowRecord struct { - EnterpriseID SFlowEnterpriseID - Format SFlowFlowRecordType - FlowDataLength uint32 -} - -func (bfr SFlowBaseFlowRecord) GetType() SFlowFlowRecordType { - return bfr.Format -} - -// SFlowFlowRecordType denotes what kind of Flow Record is -// represented. See RFC 3176 -type SFlowFlowRecordType uint32 - -const ( - SFlowTypeRawPacketFlow SFlowFlowRecordType = 1 - SFlowTypeEthernetFrameFlow SFlowFlowRecordType = 2 - SFlowTypeIpv4Flow SFlowFlowRecordType = 3 - SFlowTypeIpv6Flow SFlowFlowRecordType = 4 - SFlowTypeExtendedSwitchFlow SFlowFlowRecordType = 1001 - SFlowTypeExtendedRouterFlow SFlowFlowRecordType = 1002 - SFlowTypeExtendedGatewayFlow SFlowFlowRecordType = 1003 - SFlowTypeExtendedUserFlow SFlowFlowRecordType = 1004 - SFlowTypeExtendedUrlFlow SFlowFlowRecordType = 1005 - SFlowTypeExtendedMlpsFlow SFlowFlowRecordType = 1006 - SFlowTypeExtendedNatFlow SFlowFlowRecordType = 1007 - SFlowTypeExtendedMlpsTunnelFlow SFlowFlowRecordType = 1008 - SFlowTypeExtendedMlpsVcFlow SFlowFlowRecordType = 1009 - SFlowTypeExtendedMlpsFecFlow SFlowFlowRecordType = 1010 - SFlowTypeExtendedMlpsLvpFecFlow SFlowFlowRecordType = 1011 - SFlowTypeExtendedVlanFlow SFlowFlowRecordType = 1012 - SFlowTypeExtendedIpv4TunnelEgressFlow SFlowFlowRecordType = 1023 - SFlowTypeExtendedIpv4TunnelIngressFlow SFlowFlowRecordType = 1024 - SFlowTypeExtendedIpv6TunnelEgressFlow SFlowFlowRecordType = 1025 - SFlowTypeExtendedIpv6TunnelIngressFlow SFlowFlowRecordType = 1026 - SFlowTypeExtendedDecapsulateEgressFlow SFlowFlowRecordType = 1027 - SFlowTypeExtendedDecapsulateIngressFlow SFlowFlowRecordType = 1028 - SFlowTypeExtendedVniEgressFlow SFlowFlowRecordType = 1029 - SFlowTypeExtendedVniIngressFlow SFlowFlowRecordType = 1030 -) - -func (rt SFlowFlowRecordType) String() string { - switch rt { - case SFlowTypeRawPacketFlow: - return "Raw Packet Flow Record" - case SFlowTypeEthernetFrameFlow: - return "Ethernet Frame Flow Record" - case SFlowTypeIpv4Flow: - return "IPv4 Flow Record" - case SFlowTypeIpv6Flow: - return "IPv6 Flow Record" - case SFlowTypeExtendedSwitchFlow: - return "Extended Switch Flow Record" - case SFlowTypeExtendedRouterFlow: - return "Extended Router Flow Record" - case SFlowTypeExtendedGatewayFlow: - return "Extended Gateway Flow Record" - case SFlowTypeExtendedUserFlow: - return "Extended User Flow Record" - case SFlowTypeExtendedUrlFlow: - return "Extended URL Flow Record" - case SFlowTypeExtendedMlpsFlow: - return "Extended MPLS Flow Record" - case SFlowTypeExtendedNatFlow: - return "Extended NAT Flow Record" - case SFlowTypeExtendedMlpsTunnelFlow: - return "Extended MPLS Tunnel Flow Record" - case SFlowTypeExtendedMlpsVcFlow: - return "Extended MPLS VC Flow Record" - case SFlowTypeExtendedMlpsFecFlow: - return "Extended MPLS FEC Flow Record" - case SFlowTypeExtendedMlpsLvpFecFlow: - return "Extended MPLS LVP FEC Flow Record" - case SFlowTypeExtendedVlanFlow: - return "Extended VLAN Flow Record" - case SFlowTypeExtendedIpv4TunnelEgressFlow: - return "Extended IPv4 Tunnel Egress Record" - case SFlowTypeExtendedIpv4TunnelIngressFlow: - return "Extended IPv4 Tunnel Ingress Record" - case SFlowTypeExtendedIpv6TunnelEgressFlow: - return "Extended IPv6 Tunnel Egress Record" - case SFlowTypeExtendedIpv6TunnelIngressFlow: - return "Extended IPv6 Tunnel Ingress Record" - case SFlowTypeExtendedDecapsulateEgressFlow: - return "Extended Decapsulate Egress Record" - case SFlowTypeExtendedDecapsulateIngressFlow: - return "Extended Decapsulate Ingress Record" - case SFlowTypeExtendedVniEgressFlow: - return "Extended VNI Ingress Record" - case SFlowTypeExtendedVniIngressFlow: - return "Extended VNI Ingress Record" - default: - return "" - } -} - -// SFlowRawPacketFlowRecords hold information about a sampled -// packet grabbed as it transited the agent. This is -// perhaps the most useful and interesting record type, -// as it holds the headers of the sampled packet and -// can be used to build up a complete picture of the -// traffic patterns on a network. -// -// The raw packet header is sent back into gopacket for -// decoding, and the resulting gopackt.Packet is stored -// in the Header member -type SFlowRawPacketFlowRecord struct { - SFlowBaseFlowRecord - HeaderProtocol SFlowRawHeaderProtocol - FrameLength uint32 - PayloadRemoved uint32 - HeaderLength uint32 - Header gopacket.Packet -} - -// Raw packet record types have the following structure: - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | 20 bit Interprise (0) |12 bit format | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | record length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Header Protocol | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Frame Length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Payload Removed | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Header Length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// \ Header \ -// \ \ -// \ \ -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - -type SFlowRawHeaderProtocol uint32 - -const ( - SFlowProtoEthernet SFlowRawHeaderProtocol = 1 - SFlowProtoISO88024 SFlowRawHeaderProtocol = 2 - SFlowProtoISO88025 SFlowRawHeaderProtocol = 3 - SFlowProtoFDDI SFlowRawHeaderProtocol = 4 - SFlowProtoFrameRelay SFlowRawHeaderProtocol = 5 - SFlowProtoX25 SFlowRawHeaderProtocol = 6 - SFlowProtoPPP SFlowRawHeaderProtocol = 7 - SFlowProtoSMDS SFlowRawHeaderProtocol = 8 - SFlowProtoAAL5 SFlowRawHeaderProtocol = 9 - SFlowProtoAAL5_IP SFlowRawHeaderProtocol = 10 /* e.g. Cisco AAL5 mux */ - SFlowProtoIPv4 SFlowRawHeaderProtocol = 11 - SFlowProtoIPv6 SFlowRawHeaderProtocol = 12 - SFlowProtoMPLS SFlowRawHeaderProtocol = 13 - SFlowProtoPOS SFlowRawHeaderProtocol = 14 /* RFC 1662, 2615 */ -) - -func (sfhp SFlowRawHeaderProtocol) String() string { - switch sfhp { - case SFlowProtoEthernet: - return "ETHERNET-ISO88023" - case SFlowProtoISO88024: - return "ISO88024-TOKENBUS" - case SFlowProtoISO88025: - return "ISO88025-TOKENRING" - case SFlowProtoFDDI: - return "FDDI" - case SFlowProtoFrameRelay: - return "FRAME-RELAY" - case SFlowProtoX25: - return "X25" - case SFlowProtoPPP: - return "PPP" - case SFlowProtoSMDS: - return "SMDS" - case SFlowProtoAAL5: - return "AAL5" - case SFlowProtoAAL5_IP: - return "AAL5-IP" - case SFlowProtoIPv4: - return "IPv4" - case SFlowProtoIPv6: - return "IPv6" - case SFlowProtoMPLS: - return "MPLS" - case SFlowProtoPOS: - return "POS" - } - return "UNKNOWN" -} - -func decodeRawPacketFlowRecord(data *[]byte) (SFlowRawPacketFlowRecord, error) { - rec := SFlowRawPacketFlowRecord{} - header := []byte{} - var fdf SFlowFlowDataFormat - - *data, fdf = (*data)[4:], SFlowFlowDataFormat(binary.BigEndian.Uint32((*data)[:4])) - rec.EnterpriseID, rec.Format = fdf.decode() - *data, rec.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, rec.HeaderProtocol = (*data)[4:], SFlowRawHeaderProtocol(binary.BigEndian.Uint32((*data)[:4])) - *data, rec.FrameLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, rec.PayloadRemoved = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, rec.HeaderLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - headerLenWithPadding := int(rec.HeaderLength + ((4 - rec.HeaderLength) % 4)) - *data, header = (*data)[headerLenWithPadding:], (*data)[:headerLenWithPadding] - rec.Header = gopacket.NewPacket(header, LayerTypeEthernet, gopacket.Default) - return rec, nil -} - -// SFlowExtendedSwitchFlowRecord give additional information -// about the sampled packet if it's available. It's mainly -// useful for getting at the incoming and outgoing VLANs -// An agent may or may not provide this information. -type SFlowExtendedSwitchFlowRecord struct { - SFlowBaseFlowRecord - IncomingVLAN uint32 - IncomingVLANPriority uint32 - OutgoingVLAN uint32 - OutgoingVLANPriority uint32 -} - -// Extended switch records have the following structure: - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | 20 bit Interprise (0) |12 bit format | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | record length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Incoming VLAN | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Incoming VLAN Priority | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Outgoing VLAN | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Outgoing VLAN Priority | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - -func decodeExtendedSwitchFlowRecord(data *[]byte) (SFlowExtendedSwitchFlowRecord, error) { - es := SFlowExtendedSwitchFlowRecord{} - var fdf SFlowFlowDataFormat - - *data, fdf = (*data)[4:], SFlowFlowDataFormat(binary.BigEndian.Uint32((*data)[:4])) - es.EnterpriseID, es.Format = fdf.decode() - *data, es.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, es.IncomingVLAN = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, es.IncomingVLANPriority = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, es.OutgoingVLAN = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, es.OutgoingVLANPriority = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - return es, nil -} - -// SFlowExtendedRouterFlowRecord gives additional information -// about the layer 3 routing information used to forward -// the packet -type SFlowExtendedRouterFlowRecord struct { - SFlowBaseFlowRecord - NextHop net.IP - NextHopSourceMask uint32 - NextHopDestinationMask uint32 -} - -// Extended router records have the following structure: - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | 20 bit Interprise (0) |12 bit format | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | record length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | IP version of next hop router (1=v4|2=v6) | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// / Next Hop address (v4=4byte|v6=16byte) / -// / / -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Next Hop Source Mask | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Next Hop Destination Mask | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - -func decodeExtendedRouterFlowRecord(data *[]byte) (SFlowExtendedRouterFlowRecord, error) { - er := SFlowExtendedRouterFlowRecord{} - var fdf SFlowFlowDataFormat - var extendedRouterAddressType SFlowIPType - - *data, fdf = (*data)[4:], SFlowFlowDataFormat(binary.BigEndian.Uint32((*data)[:4])) - er.EnterpriseID, er.Format = fdf.decode() - *data, er.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, extendedRouterAddressType = (*data)[4:], SFlowIPType(binary.BigEndian.Uint32((*data)[:4])) - *data, er.NextHop = (*data)[extendedRouterAddressType.Length():], (*data)[:extendedRouterAddressType.Length()] - *data, er.NextHopSourceMask = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, er.NextHopDestinationMask = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - return er, nil -} - -// SFlowExtendedGatewayFlowRecord describes information treasured by -// nework engineers everywhere: AS path information listing which -// BGP peer sent the packet, and various other BGP related info. -// This information is vital because it gives a picture of how much -// traffic is being sent from / received by various BGP peers. - -// Extended gateway records have the following structure: - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | 20 bit Interprise (0) |12 bit format | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | record length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | IP version of next hop router (1=v4|2=v6) | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// / Next Hop address (v4=4byte|v6=16byte) / -// / / -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | AS | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Source AS | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Peer AS | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | AS Path Count | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// / AS Path / Sequence / -// / / -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// / Communities / -// / / -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Local Pref | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - -// AS Path / Sequence: - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | AS Source Type (Path=1 / Sequence=2) | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Path / Sequence length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// / Path / Sequence Members / -// / / -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - -// Communities: - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | communitiy length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// / communitiy Members / -// / / -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - -type SFlowExtendedGatewayFlowRecord struct { - SFlowBaseFlowRecord - NextHop net.IP - AS uint32 - SourceAS uint32 - PeerAS uint32 - ASPathCount uint32 - ASPath []SFlowASDestination - Communities []uint32 - LocalPref uint32 -} - -type SFlowASPathType uint32 - -const ( - SFlowASSet SFlowASPathType = 1 - SFlowASSequence SFlowASPathType = 2 -) - -func (apt SFlowASPathType) String() string { - switch apt { - case SFlowASSet: - return "AS Set" - case SFlowASSequence: - return "AS Sequence" - default: - return "" - } -} - -type SFlowASDestination struct { - Type SFlowASPathType - Count uint32 - Members []uint32 -} - -func (asd SFlowASDestination) String() string { - switch asd.Type { - case SFlowASSet: - return fmt.Sprint("AS Set:", asd.Members) - case SFlowASSequence: - return fmt.Sprint("AS Sequence:", asd.Members) - default: - return "" - } -} - -func (ad *SFlowASDestination) decodePath(data *[]byte) { - *data, ad.Type = (*data)[4:], SFlowASPathType(binary.BigEndian.Uint32((*data)[:4])) - *data, ad.Count = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - ad.Members = make([]uint32, ad.Count) - for i := uint32(0); i < ad.Count; i++ { - var member uint32 - *data, member = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - ad.Members[i] = member - } -} - -func decodeExtendedGatewayFlowRecord(data *[]byte) (SFlowExtendedGatewayFlowRecord, error) { - eg := SFlowExtendedGatewayFlowRecord{} - var fdf SFlowFlowDataFormat - var extendedGatewayAddressType SFlowIPType - var communitiesLength uint32 - var community uint32 - - *data, fdf = (*data)[4:], SFlowFlowDataFormat(binary.BigEndian.Uint32((*data)[:4])) - eg.EnterpriseID, eg.Format = fdf.decode() - *data, eg.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, extendedGatewayAddressType = (*data)[4:], SFlowIPType(binary.BigEndian.Uint32((*data)[:4])) - *data, eg.NextHop = (*data)[extendedGatewayAddressType.Length():], (*data)[:extendedGatewayAddressType.Length()] - *data, eg.AS = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, eg.SourceAS = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, eg.PeerAS = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, eg.ASPathCount = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - for i := uint32(0); i < eg.ASPathCount; i++ { - asPath := SFlowASDestination{} - asPath.decodePath(data) - eg.ASPath = append(eg.ASPath, asPath) - } - *data, communitiesLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - eg.Communities = make([]uint32, communitiesLength) - for j := uint32(0); j < communitiesLength; j++ { - *data, community = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - eg.Communities[j] = community - } - *data, eg.LocalPref = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - return eg, nil -} - -// ************************************************** -// Extended URL Flow Record -// ************************************************** - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | 20 bit Interprise (0) |12 bit format | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | record length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | direction | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | URL | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Host | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - -type SFlowURLDirection uint32 - -const ( - SFlowURLsrc SFlowURLDirection = 1 - SFlowURLdst SFlowURLDirection = 2 -) - -func (urld SFlowURLDirection) String() string { - switch urld { - case SFlowURLsrc: - return "Source address is the server" - case SFlowURLdst: - return "Destination address is the server" - default: - return "" - } -} - -type SFlowExtendedURLRecord struct { - SFlowBaseFlowRecord - Direction SFlowURLDirection - URL string - Host string -} - -func decodeExtendedURLRecord(data *[]byte) (SFlowExtendedURLRecord, error) { - eur := SFlowExtendedURLRecord{} - var fdf SFlowFlowDataFormat - var urlLen uint32 - var urlLenWithPad int - var hostLen uint32 - var hostLenWithPad int - var urlBytes []byte - var hostBytes []byte - - *data, fdf = (*data)[4:], SFlowFlowDataFormat(binary.BigEndian.Uint32((*data)[:4])) - eur.EnterpriseID, eur.Format = fdf.decode() - *data, eur.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, eur.Direction = (*data)[4:], SFlowURLDirection(binary.BigEndian.Uint32((*data)[:4])) - *data, urlLen = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - urlLenWithPad = int(urlLen + ((4 - urlLen) % 4)) - *data, urlBytes = (*data)[urlLenWithPad:], (*data)[:urlLenWithPad] - eur.URL = string(urlBytes[:urlLen]) - *data, hostLen = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - hostLenWithPad = int(hostLen + ((4 - hostLen) % 4)) - *data, hostBytes = (*data)[hostLenWithPad:], (*data)[:hostLenWithPad] - eur.Host = string(hostBytes[:hostLen]) - return eur, nil -} - -// ************************************************** -// Extended User Flow Record -// ************************************************** - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | 20 bit Interprise (0) |12 bit format | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | record length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Source Character Set | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Source User Id | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Destination Character Set | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Destination User ID | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - -type SFlowExtendedUserFlow struct { - SFlowBaseFlowRecord - SourceCharSet SFlowCharSet - SourceUserID string - DestinationCharSet SFlowCharSet - DestinationUserID string -} - -type SFlowCharSet uint32 - -const ( - SFlowCSunknown SFlowCharSet = 2 - SFlowCSASCII SFlowCharSet = 3 - SFlowCSISOLatin1 SFlowCharSet = 4 - SFlowCSISOLatin2 SFlowCharSet = 5 - SFlowCSISOLatin3 SFlowCharSet = 6 - SFlowCSISOLatin4 SFlowCharSet = 7 - SFlowCSISOLatinCyrillic SFlowCharSet = 8 - SFlowCSISOLatinArabic SFlowCharSet = 9 - SFlowCSISOLatinGreek SFlowCharSet = 10 - SFlowCSISOLatinHebrew SFlowCharSet = 11 - SFlowCSISOLatin5 SFlowCharSet = 12 - SFlowCSISOLatin6 SFlowCharSet = 13 - SFlowCSISOTextComm SFlowCharSet = 14 - SFlowCSHalfWidthKatakana SFlowCharSet = 15 - SFlowCSJISEncoding SFlowCharSet = 16 - SFlowCSShiftJIS SFlowCharSet = 17 - SFlowCSEUCPkdFmtJapanese SFlowCharSet = 18 - SFlowCSEUCFixWidJapanese SFlowCharSet = 19 - SFlowCSISO4UnitedKingdom SFlowCharSet = 20 - SFlowCSISO11SwedishForNames SFlowCharSet = 21 - SFlowCSISO15Italian SFlowCharSet = 22 - SFlowCSISO17Spanish SFlowCharSet = 23 - SFlowCSISO21German SFlowCharSet = 24 - SFlowCSISO60DanishNorwegian SFlowCharSet = 25 - SFlowCSISO69French SFlowCharSet = 26 - SFlowCSISO10646UTF1 SFlowCharSet = 27 - SFlowCSISO646basic1983 SFlowCharSet = 28 - SFlowCSINVARIANT SFlowCharSet = 29 - SFlowCSISO2IntlRefVersion SFlowCharSet = 30 - SFlowCSNATSSEFI SFlowCharSet = 31 - SFlowCSNATSSEFIADD SFlowCharSet = 32 - SFlowCSNATSDANO SFlowCharSet = 33 - SFlowCSNATSDANOADD SFlowCharSet = 34 - SFlowCSISO10Swedish SFlowCharSet = 35 - SFlowCSKSC56011987 SFlowCharSet = 36 - SFlowCSISO2022KR SFlowCharSet = 37 - SFlowCSEUCKR SFlowCharSet = 38 - SFlowCSISO2022JP SFlowCharSet = 39 - SFlowCSISO2022JP2 SFlowCharSet = 40 - SFlowCSISO13JISC6220jp SFlowCharSet = 41 - SFlowCSISO14JISC6220ro SFlowCharSet = 42 - SFlowCSISO16Portuguese SFlowCharSet = 43 - SFlowCSISO18Greek7Old SFlowCharSet = 44 - SFlowCSISO19LatinGreek SFlowCharSet = 45 - SFlowCSISO25French SFlowCharSet = 46 - SFlowCSISO27LatinGreek1 SFlowCharSet = 47 - SFlowCSISO5427Cyrillic SFlowCharSet = 48 - SFlowCSISO42JISC62261978 SFlowCharSet = 49 - SFlowCSISO47BSViewdata SFlowCharSet = 50 - SFlowCSISO49INIS SFlowCharSet = 51 - SFlowCSISO50INIS8 SFlowCharSet = 52 - SFlowCSISO51INISCyrillic SFlowCharSet = 53 - SFlowCSISO54271981 SFlowCharSet = 54 - SFlowCSISO5428Greek SFlowCharSet = 55 - SFlowCSISO57GB1988 SFlowCharSet = 56 - SFlowCSISO58GB231280 SFlowCharSet = 57 - SFlowCSISO61Norwegian2 SFlowCharSet = 58 - SFlowCSISO70VideotexSupp1 SFlowCharSet = 59 - SFlowCSISO84Portuguese2 SFlowCharSet = 60 - SFlowCSISO85Spanish2 SFlowCharSet = 61 - SFlowCSISO86Hungarian SFlowCharSet = 62 - SFlowCSISO87JISX0208 SFlowCharSet = 63 - SFlowCSISO88Greek7 SFlowCharSet = 64 - SFlowCSISO89ASMO449 SFlowCharSet = 65 - SFlowCSISO90 SFlowCharSet = 66 - SFlowCSISO91JISC62291984a SFlowCharSet = 67 - SFlowCSISO92JISC62991984b SFlowCharSet = 68 - SFlowCSISO93JIS62291984badd SFlowCharSet = 69 - SFlowCSISO94JIS62291984hand SFlowCharSet = 70 - SFlowCSISO95JIS62291984handadd SFlowCharSet = 71 - SFlowCSISO96JISC62291984kana SFlowCharSet = 72 - SFlowCSISO2033 SFlowCharSet = 73 - SFlowCSISO99NAPLPS SFlowCharSet = 74 - SFlowCSISO102T617bit SFlowCharSet = 75 - SFlowCSISO103T618bit SFlowCharSet = 76 - SFlowCSISO111ECMACyrillic SFlowCharSet = 77 - SFlowCSa71 SFlowCharSet = 78 - SFlowCSa72 SFlowCharSet = 79 - SFlowCSISO123CSAZ24341985gr SFlowCharSet = 80 - SFlowCSISO88596E SFlowCharSet = 81 - SFlowCSISO88596I SFlowCharSet = 82 - SFlowCSISO128T101G2 SFlowCharSet = 83 - SFlowCSISO88598E SFlowCharSet = 84 - SFlowCSISO88598I SFlowCharSet = 85 - SFlowCSISO139CSN369103 SFlowCharSet = 86 - SFlowCSISO141JUSIB1002 SFlowCharSet = 87 - SFlowCSISO143IECP271 SFlowCharSet = 88 - SFlowCSISO146Serbian SFlowCharSet = 89 - SFlowCSISO147Macedonian SFlowCharSet = 90 - SFlowCSISO150 SFlowCharSet = 91 - SFlowCSISO151Cuba SFlowCharSet = 92 - SFlowCSISO6937Add SFlowCharSet = 93 - SFlowCSISO153GOST1976874 SFlowCharSet = 94 - SFlowCSISO8859Supp SFlowCharSet = 95 - SFlowCSISO10367Box SFlowCharSet = 96 - SFlowCSISO158Lap SFlowCharSet = 97 - SFlowCSISO159JISX02121990 SFlowCharSet = 98 - SFlowCSISO646Danish SFlowCharSet = 99 - SFlowCSUSDK SFlowCharSet = 100 - SFlowCSDKUS SFlowCharSet = 101 - SFlowCSKSC5636 SFlowCharSet = 102 - SFlowCSUnicode11UTF7 SFlowCharSet = 103 - SFlowCSISO2022CN SFlowCharSet = 104 - SFlowCSISO2022CNEXT SFlowCharSet = 105 - SFlowCSUTF8 SFlowCharSet = 106 - SFlowCSISO885913 SFlowCharSet = 109 - SFlowCSISO885914 SFlowCharSet = 110 - SFlowCSISO885915 SFlowCharSet = 111 - SFlowCSISO885916 SFlowCharSet = 112 - SFlowCSGBK SFlowCharSet = 113 - SFlowCSGB18030 SFlowCharSet = 114 - SFlowCSOSDEBCDICDF0415 SFlowCharSet = 115 - SFlowCSOSDEBCDICDF03IRV SFlowCharSet = 116 - SFlowCSOSDEBCDICDF041 SFlowCharSet = 117 - SFlowCSISO115481 SFlowCharSet = 118 - SFlowCSKZ1048 SFlowCharSet = 119 - SFlowCSUnicode SFlowCharSet = 1000 - SFlowCSUCS4 SFlowCharSet = 1001 - SFlowCSUnicodeASCII SFlowCharSet = 1002 - SFlowCSUnicodeLatin1 SFlowCharSet = 1003 - SFlowCSUnicodeJapanese SFlowCharSet = 1004 - SFlowCSUnicodeIBM1261 SFlowCharSet = 1005 - SFlowCSUnicodeIBM1268 SFlowCharSet = 1006 - SFlowCSUnicodeIBM1276 SFlowCharSet = 1007 - SFlowCSUnicodeIBM1264 SFlowCharSet = 1008 - SFlowCSUnicodeIBM1265 SFlowCharSet = 1009 - SFlowCSUnicode11 SFlowCharSet = 1010 - SFlowCSSCSU SFlowCharSet = 1011 - SFlowCSUTF7 SFlowCharSet = 1012 - SFlowCSUTF16BE SFlowCharSet = 1013 - SFlowCSUTF16LE SFlowCharSet = 1014 - SFlowCSUTF16 SFlowCharSet = 1015 - SFlowCSCESU8 SFlowCharSet = 1016 - SFlowCSUTF32 SFlowCharSet = 1017 - SFlowCSUTF32BE SFlowCharSet = 1018 - SFlowCSUTF32LE SFlowCharSet = 1019 - SFlowCSBOCU1 SFlowCharSet = 1020 - SFlowCSWindows30Latin1 SFlowCharSet = 2000 - SFlowCSWindows31Latin1 SFlowCharSet = 2001 - SFlowCSWindows31Latin2 SFlowCharSet = 2002 - SFlowCSWindows31Latin5 SFlowCharSet = 2003 - SFlowCSHPRoman8 SFlowCharSet = 2004 - SFlowCSAdobeStandardEncoding SFlowCharSet = 2005 - SFlowCSVenturaUS SFlowCharSet = 2006 - SFlowCSVenturaInternational SFlowCharSet = 2007 - SFlowCSDECMCS SFlowCharSet = 2008 - SFlowCSPC850Multilingual SFlowCharSet = 2009 - SFlowCSPCp852 SFlowCharSet = 2010 - SFlowCSPC8CodePage437 SFlowCharSet = 2011 - SFlowCSPC8DanishNorwegian SFlowCharSet = 2012 - SFlowCSPC862LatinHebrew SFlowCharSet = 2013 - SFlowCSPC8Turkish SFlowCharSet = 2014 - SFlowCSIBMSymbols SFlowCharSet = 2015 - SFlowCSIBMThai SFlowCharSet = 2016 - SFlowCSHPLegal SFlowCharSet = 2017 - SFlowCSHPPiFont SFlowCharSet = 2018 - SFlowCSHPMath8 SFlowCharSet = 2019 - SFlowCSHPPSMath SFlowCharSet = 2020 - SFlowCSHPDesktop SFlowCharSet = 2021 - SFlowCSVenturaMath SFlowCharSet = 2022 - SFlowCSMicrosoftPublishing SFlowCharSet = 2023 - SFlowCSWindows31J SFlowCharSet = 2024 - SFlowCSGB2312 SFlowCharSet = 2025 - SFlowCSBig5 SFlowCharSet = 2026 - SFlowCSMacintosh SFlowCharSet = 2027 - SFlowCSIBM037 SFlowCharSet = 2028 - SFlowCSIBM038 SFlowCharSet = 2029 - SFlowCSIBM273 SFlowCharSet = 2030 - SFlowCSIBM274 SFlowCharSet = 2031 - SFlowCSIBM275 SFlowCharSet = 2032 - SFlowCSIBM277 SFlowCharSet = 2033 - SFlowCSIBM278 SFlowCharSet = 2034 - SFlowCSIBM280 SFlowCharSet = 2035 - SFlowCSIBM281 SFlowCharSet = 2036 - SFlowCSIBM284 SFlowCharSet = 2037 - SFlowCSIBM285 SFlowCharSet = 2038 - SFlowCSIBM290 SFlowCharSet = 2039 - SFlowCSIBM297 SFlowCharSet = 2040 - SFlowCSIBM420 SFlowCharSet = 2041 - SFlowCSIBM423 SFlowCharSet = 2042 - SFlowCSIBM424 SFlowCharSet = 2043 - SFlowCSIBM500 SFlowCharSet = 2044 - SFlowCSIBM851 SFlowCharSet = 2045 - SFlowCSIBM855 SFlowCharSet = 2046 - SFlowCSIBM857 SFlowCharSet = 2047 - SFlowCSIBM860 SFlowCharSet = 2048 - SFlowCSIBM861 SFlowCharSet = 2049 - SFlowCSIBM863 SFlowCharSet = 2050 - SFlowCSIBM864 SFlowCharSet = 2051 - SFlowCSIBM865 SFlowCharSet = 2052 - SFlowCSIBM868 SFlowCharSet = 2053 - SFlowCSIBM869 SFlowCharSet = 2054 - SFlowCSIBM870 SFlowCharSet = 2055 - SFlowCSIBM871 SFlowCharSet = 2056 - SFlowCSIBM880 SFlowCharSet = 2057 - SFlowCSIBM891 SFlowCharSet = 2058 - SFlowCSIBM903 SFlowCharSet = 2059 - SFlowCSIBBM904 SFlowCharSet = 2060 - SFlowCSIBM905 SFlowCharSet = 2061 - SFlowCSIBM918 SFlowCharSet = 2062 - SFlowCSIBM1026 SFlowCharSet = 2063 - SFlowCSIBMEBCDICATDE SFlowCharSet = 2064 - SFlowCSEBCDICATDEA SFlowCharSet = 2065 - SFlowCSEBCDICCAFR SFlowCharSet = 2066 - SFlowCSEBCDICDKNO SFlowCharSet = 2067 - SFlowCSEBCDICDKNOA SFlowCharSet = 2068 - SFlowCSEBCDICFISE SFlowCharSet = 2069 - SFlowCSEBCDICFISEA SFlowCharSet = 2070 - SFlowCSEBCDICFR SFlowCharSet = 2071 - SFlowCSEBCDICIT SFlowCharSet = 2072 - SFlowCSEBCDICPT SFlowCharSet = 2073 - SFlowCSEBCDICES SFlowCharSet = 2074 - SFlowCSEBCDICESA SFlowCharSet = 2075 - SFlowCSEBCDICESS SFlowCharSet = 2076 - SFlowCSEBCDICUK SFlowCharSet = 2077 - SFlowCSEBCDICUS SFlowCharSet = 2078 - SFlowCSUnknown8BiT SFlowCharSet = 2079 - SFlowCSMnemonic SFlowCharSet = 2080 - SFlowCSMnem SFlowCharSet = 2081 - SFlowCSVISCII SFlowCharSet = 2082 - SFlowCSVIQR SFlowCharSet = 2083 - SFlowCSKOI8R SFlowCharSet = 2084 - SFlowCSHZGB2312 SFlowCharSet = 2085 - SFlowCSIBM866 SFlowCharSet = 2086 - SFlowCSPC775Baltic SFlowCharSet = 2087 - SFlowCSKOI8U SFlowCharSet = 2088 - SFlowCSIBM00858 SFlowCharSet = 2089 - SFlowCSIBM00924 SFlowCharSet = 2090 - SFlowCSIBM01140 SFlowCharSet = 2091 - SFlowCSIBM01141 SFlowCharSet = 2092 - SFlowCSIBM01142 SFlowCharSet = 2093 - SFlowCSIBM01143 SFlowCharSet = 2094 - SFlowCSIBM01144 SFlowCharSet = 2095 - SFlowCSIBM01145 SFlowCharSet = 2096 - SFlowCSIBM01146 SFlowCharSet = 2097 - SFlowCSIBM01147 SFlowCharSet = 2098 - SFlowCSIBM01148 SFlowCharSet = 2099 - SFlowCSIBM01149 SFlowCharSet = 2100 - SFlowCSBig5HKSCS SFlowCharSet = 2101 - SFlowCSIBM1047 SFlowCharSet = 2102 - SFlowCSPTCP154 SFlowCharSet = 2103 - SFlowCSAmiga1251 SFlowCharSet = 2104 - SFlowCSKOI7switched SFlowCharSet = 2105 - SFlowCSBRF SFlowCharSet = 2106 - SFlowCSTSCII SFlowCharSet = 2107 - SFlowCSCP51932 SFlowCharSet = 2108 - SFlowCSWindows874 SFlowCharSet = 2109 - SFlowCSWindows1250 SFlowCharSet = 2250 - SFlowCSWindows1251 SFlowCharSet = 2251 - SFlowCSWindows1252 SFlowCharSet = 2252 - SFlowCSWindows1253 SFlowCharSet = 2253 - SFlowCSWindows1254 SFlowCharSet = 2254 - SFlowCSWindows1255 SFlowCharSet = 2255 - SFlowCSWindows1256 SFlowCharSet = 2256 - SFlowCSWindows1257 SFlowCharSet = 2257 - SFlowCSWindows1258 SFlowCharSet = 2258 - SFlowCSTIS620 SFlowCharSet = 2259 - SFlowCS50220 SFlowCharSet = 2260 - SFlowCSreserved SFlowCharSet = 3000 -) - -func decodeExtendedUserFlow(data *[]byte) (SFlowExtendedUserFlow, error) { - eu := SFlowExtendedUserFlow{} - var fdf SFlowFlowDataFormat - var srcUserLen uint32 - var srcUserLenWithPad int - var srcUserBytes []byte - var dstUserLen uint32 - var dstUserLenWithPad int - var dstUserBytes []byte - - *data, fdf = (*data)[4:], SFlowFlowDataFormat(binary.BigEndian.Uint32((*data)[:4])) - eu.EnterpriseID, eu.Format = fdf.decode() - *data, eu.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, eu.SourceCharSet = (*data)[4:], SFlowCharSet(binary.BigEndian.Uint32((*data)[:4])) - *data, srcUserLen = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - srcUserLenWithPad = int(srcUserLen + ((4 - srcUserLen) % 4)) - *data, srcUserBytes = (*data)[srcUserLenWithPad:], (*data)[:srcUserLenWithPad] - eu.SourceUserID = string(srcUserBytes[:srcUserLen]) - *data, eu.DestinationCharSet = (*data)[4:], SFlowCharSet(binary.BigEndian.Uint32((*data)[:4])) - *data, dstUserLen = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - dstUserLenWithPad = int(dstUserLen + ((4 - dstUserLen) % 4)) - *data, dstUserBytes = (*data)[dstUserLenWithPad:], (*data)[:dstUserLenWithPad] - eu.DestinationUserID = string(dstUserBytes[:dstUserLen]) - return eu, nil -} - -// ************************************************** -// Packet IP version 4 Record -// ************************************************** - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Protocol | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Source IPv4 | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Destination IPv4 | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Source Port | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Destionation Port | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | TCP Flags | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | TOS | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -type SFlowIpv4Record struct { - // The length of the IP packet excluding ower layer encapsulations - Length uint32 - // IP Protocol type (for example, TCP = 6, UDP = 17) - Protocol uint32 - // Source IP Address - IPSrc net.IP - // Destination IP Address - IPDst net.IP - // TCP/UDP source port number or equivalent - PortSrc uint32 - // TCP/UDP destination port number or equivalent - PortDst uint32 - // TCP flags - TCPFlags uint32 - // IP type of service - TOS uint32 -} - -func decodeSFlowIpv4Record(data *[]byte) (SFlowIpv4Record, error) { - si := SFlowIpv4Record{} - - *data, si.Length = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, si.Protocol = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, si.IPSrc = (*data)[4:], net.IP((*data)[:4]) - *data, si.IPDst = (*data)[4:], net.IP((*data)[:4]) - *data, si.PortSrc = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, si.PortDst = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, si.TCPFlags = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, si.TOS = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - - return si, nil -} - -// ************************************************** -// Packet IP version 6 Record -// ************************************************** - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Protocol | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Source IPv4 | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Destination IPv4 | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Source Port | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Destionation Port | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | TCP Flags | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Priority | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -type SFlowIpv6Record struct { - // The length of the IP packet excluding ower layer encapsulations - Length uint32 - // IP Protocol type (for example, TCP = 6, UDP = 17) - Protocol uint32 - // Source IP Address - IPSrc net.IP - // Destination IP Address - IPDst net.IP - // TCP/UDP source port number or equivalent - PortSrc uint32 - // TCP/UDP destination port number or equivalent - PortDst uint32 - // TCP flags - TCPFlags uint32 - // IP priority - Priority uint32 -} - -func decodeSFlowIpv6Record(data *[]byte) (SFlowIpv6Record, error) { - si := SFlowIpv6Record{} - - *data, si.Length = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, si.Protocol = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, si.IPSrc = (*data)[16:], net.IP((*data)[:16]) - *data, si.IPDst = (*data)[16:], net.IP((*data)[:16]) - *data, si.PortSrc = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, si.PortDst = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, si.TCPFlags = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, si.Priority = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - - return si, nil -} - -// ************************************************** -// Extended IPv4 Tunnel Egress -// ************************************************** - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | 20 bit Interprise (0) |12 bit format | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | record length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// / Packet IP version 4 Record / -// / / -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -type SFlowExtendedIpv4TunnelEgressRecord struct { - SFlowBaseFlowRecord - SFlowIpv4Record SFlowIpv4Record -} - -func decodeExtendedIpv4TunnelEgress(data *[]byte) (SFlowExtendedIpv4TunnelEgressRecord, error) { - rec := SFlowExtendedIpv4TunnelEgressRecord{} - var fdf SFlowFlowDataFormat - - *data, fdf = (*data)[4:], SFlowFlowDataFormat(binary.BigEndian.Uint32((*data)[:4])) - rec.EnterpriseID, rec.Format = fdf.decode() - *data, rec.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - rec.SFlowIpv4Record, _ = decodeSFlowIpv4Record(data) - - return rec, nil -} - -// ************************************************** -// Extended IPv4 Tunnel Ingress -// ************************************************** - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | 20 bit Interprise (0) |12 bit format | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | record length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// / Packet IP version 4 Record / -// / / -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -type SFlowExtendedIpv4TunnelIngressRecord struct { - SFlowBaseFlowRecord - SFlowIpv4Record SFlowIpv4Record -} - -func decodeExtendedIpv4TunnelIngress(data *[]byte) (SFlowExtendedIpv4TunnelIngressRecord, error) { - rec := SFlowExtendedIpv4TunnelIngressRecord{} - var fdf SFlowFlowDataFormat - - *data, fdf = (*data)[4:], SFlowFlowDataFormat(binary.BigEndian.Uint32((*data)[:4])) - rec.EnterpriseID, rec.Format = fdf.decode() - *data, rec.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - rec.SFlowIpv4Record, _ = decodeSFlowIpv4Record(data) - - return rec, nil -} - -// ************************************************** -// Extended IPv6 Tunnel Egress -// ************************************************** - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | 20 bit Interprise (0) |12 bit format | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | record length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// / Packet IP version 6 Record / -// / / -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -type SFlowExtendedIpv6TunnelEgressRecord struct { - SFlowBaseFlowRecord - SFlowIpv6Record -} - -func decodeExtendedIpv6TunnelEgress(data *[]byte) (SFlowExtendedIpv6TunnelEgressRecord, error) { - rec := SFlowExtendedIpv6TunnelEgressRecord{} - var fdf SFlowFlowDataFormat - - *data, fdf = (*data)[4:], SFlowFlowDataFormat(binary.BigEndian.Uint32((*data)[:4])) - rec.EnterpriseID, rec.Format = fdf.decode() - *data, rec.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - rec.SFlowIpv6Record, _ = decodeSFlowIpv6Record(data) - - return rec, nil -} - -// ************************************************** -// Extended IPv6 Tunnel Ingress -// ************************************************** - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | 20 bit Interprise (0) |12 bit format | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | record length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// / Packet IP version 6 Record / -// / / -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -type SFlowExtendedIpv6TunnelIngressRecord struct { - SFlowBaseFlowRecord - SFlowIpv6Record -} - -func decodeExtendedIpv6TunnelIngress(data *[]byte) (SFlowExtendedIpv6TunnelIngressRecord, error) { - rec := SFlowExtendedIpv6TunnelIngressRecord{} - var fdf SFlowFlowDataFormat - - *data, fdf = (*data)[4:], SFlowFlowDataFormat(binary.BigEndian.Uint32((*data)[:4])) - rec.EnterpriseID, rec.Format = fdf.decode() - *data, rec.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - rec.SFlowIpv6Record, _ = decodeSFlowIpv6Record(data) - - return rec, nil -} - -// ************************************************** -// Extended Decapsulate Egress -// ************************************************** - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | 20 bit Interprise (0) |12 bit format | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | record length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Inner Header Offset | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -type SFlowExtendedDecapsulateEgressRecord struct { - SFlowBaseFlowRecord - InnerHeaderOffset uint32 -} - -func decodeExtendedDecapsulateEgress(data *[]byte) (SFlowExtendedDecapsulateEgressRecord, error) { - rec := SFlowExtendedDecapsulateEgressRecord{} - var fdf SFlowFlowDataFormat - - *data, fdf = (*data)[4:], SFlowFlowDataFormat(binary.BigEndian.Uint32((*data)[:4])) - rec.EnterpriseID, rec.Format = fdf.decode() - *data, rec.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, rec.InnerHeaderOffset = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - - return rec, nil -} - -// ************************************************** -// Extended Decapsulate Ingress -// ************************************************** - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | 20 bit Interprise (0) |12 bit format | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | record length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Inner Header Offset | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -type SFlowExtendedDecapsulateIngressRecord struct { - SFlowBaseFlowRecord - InnerHeaderOffset uint32 -} - -func decodeExtendedDecapsulateIngress(data *[]byte) (SFlowExtendedDecapsulateIngressRecord, error) { - rec := SFlowExtendedDecapsulateIngressRecord{} - var fdf SFlowFlowDataFormat - - *data, fdf = (*data)[4:], SFlowFlowDataFormat(binary.BigEndian.Uint32((*data)[:4])) - rec.EnterpriseID, rec.Format = fdf.decode() - *data, rec.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, rec.InnerHeaderOffset = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - - return rec, nil -} - -// ************************************************** -// Extended VNI Egress -// ************************************************** - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | 20 bit Interprise (0) |12 bit format | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | record length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | VNI | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -type SFlowExtendedVniEgressRecord struct { - SFlowBaseFlowRecord - VNI uint32 -} - -func decodeExtendedVniEgress(data *[]byte) (SFlowExtendedVniEgressRecord, error) { - rec := SFlowExtendedVniEgressRecord{} - var fdf SFlowFlowDataFormat - - *data, fdf = (*data)[4:], SFlowFlowDataFormat(binary.BigEndian.Uint32((*data)[:4])) - rec.EnterpriseID, rec.Format = fdf.decode() - *data, rec.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, rec.VNI = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - - return rec, nil -} - -// ************************************************** -// Extended VNI Ingress -// ************************************************** - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | 20 bit Interprise (0) |12 bit format | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | record length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | VNI | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -type SFlowExtendedVniIngressRecord struct { - SFlowBaseFlowRecord - VNI uint32 -} - -func decodeExtendedVniIngress(data *[]byte) (SFlowExtendedVniIngressRecord, error) { - rec := SFlowExtendedVniIngressRecord{} - var fdf SFlowFlowDataFormat - - *data, fdf = (*data)[4:], SFlowFlowDataFormat(binary.BigEndian.Uint32((*data)[:4])) - rec.EnterpriseID, rec.Format = fdf.decode() - *data, rec.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, rec.VNI = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - - return rec, nil -} - -// ************************************************** -// Counter Record -// ************************************************** - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | 20 bit Interprise (0) |12 bit format | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | counter length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// / counter data / -// / / -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - -type SFlowBaseCounterRecord struct { - EnterpriseID SFlowEnterpriseID - Format SFlowCounterRecordType - FlowDataLength uint32 -} - -func (bcr SFlowBaseCounterRecord) GetType() SFlowCounterRecordType { - switch bcr.Format { - case SFlowTypeGenericInterfaceCounters: - return SFlowTypeGenericInterfaceCounters - case SFlowTypeEthernetInterfaceCounters: - return SFlowTypeEthernetInterfaceCounters - case SFlowTypeTokenRingInterfaceCounters: - return SFlowTypeTokenRingInterfaceCounters - case SFlowType100BaseVGInterfaceCounters: - return SFlowType100BaseVGInterfaceCounters - case SFlowTypeVLANCounters: - return SFlowTypeVLANCounters - case SFlowTypeLACPCounters: - return SFlowTypeLACPCounters - case SFlowTypeProcessorCounters: - return SFlowTypeProcessorCounters - case SFlowTypeOpenflowPortCounters: - return SFlowTypeOpenflowPortCounters - case SFlowTypePORTNAMECounters: - return SFlowTypePORTNAMECounters - case SFLowTypeAPPRESOURCESCounters: - return SFLowTypeAPPRESOURCESCounters - case SFlowTypeOVSDPCounters: - return SFlowTypeOVSDPCounters - } - unrecognized := fmt.Sprint("Unrecognized counter record type:", bcr.Format) - panic(unrecognized) -} - -// ************************************************** -// Counter Record -// ************************************************** - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | 20 bit Interprise (0) |12 bit format | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | counter length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | IfIndex | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | IfType | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | IfSpeed | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | IfDirection | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | IfStatus | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | IFInOctets | -// | | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | IfInUcastPkts | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | IfInMulticastPkts | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | IfInBroadcastPkts | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | IfInDiscards | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | InInErrors | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | IfInUnknownProtos | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | IfOutOctets | -// | | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | IfOutUcastPkts | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | IfOutMulticastPkts | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | IfOutBroadcastPkts | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | IfOutDiscards | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | IfOUtErrors | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | IfPromiscouousMode | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - -type SFlowGenericInterfaceCounters struct { - SFlowBaseCounterRecord - IfIndex uint32 - IfType uint32 - IfSpeed uint64 - IfDirection uint32 - IfStatus uint32 - IfInOctets uint64 - IfInUcastPkts uint32 - IfInMulticastPkts uint32 - IfInBroadcastPkts uint32 - IfInDiscards uint32 - IfInErrors uint32 - IfInUnknownProtos uint32 - IfOutOctets uint64 - IfOutUcastPkts uint32 - IfOutMulticastPkts uint32 - IfOutBroadcastPkts uint32 - IfOutDiscards uint32 - IfOutErrors uint32 - IfPromiscuousMode uint32 -} - -func decodeGenericInterfaceCounters(data *[]byte) (SFlowGenericInterfaceCounters, error) { - gic := SFlowGenericInterfaceCounters{} - var cdf SFlowCounterDataFormat - - *data, cdf = (*data)[4:], SFlowCounterDataFormat(binary.BigEndian.Uint32((*data)[:4])) - gic.EnterpriseID, gic.Format = cdf.decode() - *data, gic.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, gic.IfIndex = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, gic.IfType = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, gic.IfSpeed = (*data)[8:], binary.BigEndian.Uint64((*data)[:8]) - *data, gic.IfDirection = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, gic.IfStatus = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, gic.IfInOctets = (*data)[8:], binary.BigEndian.Uint64((*data)[:8]) - *data, gic.IfInUcastPkts = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, gic.IfInMulticastPkts = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, gic.IfInBroadcastPkts = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, gic.IfInDiscards = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, gic.IfInErrors = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, gic.IfInUnknownProtos = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, gic.IfOutOctets = (*data)[8:], binary.BigEndian.Uint64((*data)[:8]) - *data, gic.IfOutUcastPkts = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, gic.IfOutMulticastPkts = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, gic.IfOutBroadcastPkts = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, gic.IfOutDiscards = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, gic.IfOutErrors = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, gic.IfPromiscuousMode = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - return gic, nil -} - -// ************************************************** -// Counter Record -// ************************************************** - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | 20 bit Interprise (0) |12 bit format | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | counter length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// / counter data / -// / / -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - -type SFlowEthernetCounters struct { - SFlowBaseCounterRecord - AlignmentErrors uint32 - FCSErrors uint32 - SingleCollisionFrames uint32 - MultipleCollisionFrames uint32 - SQETestErrors uint32 - DeferredTransmissions uint32 - LateCollisions uint32 - ExcessiveCollisions uint32 - InternalMacTransmitErrors uint32 - CarrierSenseErrors uint32 - FrameTooLongs uint32 - InternalMacReceiveErrors uint32 - SymbolErrors uint32 -} - -func decodeEthernetCounters(data *[]byte) (SFlowEthernetCounters, error) { - ec := SFlowEthernetCounters{} - var cdf SFlowCounterDataFormat - - *data, cdf = (*data)[4:], SFlowCounterDataFormat(binary.BigEndian.Uint32((*data)[:4])) - ec.EnterpriseID, ec.Format = cdf.decode() - if len(*data) < 4 { - return SFlowEthernetCounters{}, errors.New("ethernet counters too small") - } - *data, ec.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - if len(*data) < 4 { - return SFlowEthernetCounters{}, errors.New("ethernet counters too small") - } - *data, ec.AlignmentErrors = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - if len(*data) < 4 { - return SFlowEthernetCounters{}, errors.New("ethernet counters too small") - } - *data, ec.FCSErrors = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - if len(*data) < 4 { - return SFlowEthernetCounters{}, errors.New("ethernet counters too small") - } - *data, ec.SingleCollisionFrames = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - if len(*data) < 4 { - return SFlowEthernetCounters{}, errors.New("ethernet counters too small") - } - *data, ec.MultipleCollisionFrames = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - if len(*data) < 4 { - return SFlowEthernetCounters{}, errors.New("ethernet counters too small") - } - *data, ec.SQETestErrors = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - if len(*data) < 4 { - return SFlowEthernetCounters{}, errors.New("ethernet counters too small") - } - *data, ec.DeferredTransmissions = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - if len(*data) < 4 { - return SFlowEthernetCounters{}, errors.New("ethernet counters too small") - } - *data, ec.LateCollisions = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - if len(*data) < 4 { - return SFlowEthernetCounters{}, errors.New("ethernet counters too small") - } - *data, ec.ExcessiveCollisions = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - if len(*data) < 4 { - return SFlowEthernetCounters{}, errors.New("ethernet counters too small") - } - *data, ec.InternalMacTransmitErrors = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - if len(*data) < 4 { - return SFlowEthernetCounters{}, errors.New("ethernet counters too small") - } - *data, ec.CarrierSenseErrors = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - if len(*data) < 4 { - return SFlowEthernetCounters{}, errors.New("ethernet counters too small") - } - *data, ec.FrameTooLongs = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - if len(*data) < 4 { - return SFlowEthernetCounters{}, errors.New("ethernet counters too small") - } - *data, ec.InternalMacReceiveErrors = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - if len(*data) < 4 { - return SFlowEthernetCounters{}, errors.New("ethernet counters too small") - } - *data, ec.SymbolErrors = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - return ec, nil -} - -// VLAN Counter - -type SFlowVLANCounters struct { - SFlowBaseCounterRecord - VlanID uint32 - Octets uint64 - UcastPkts uint32 - MulticastPkts uint32 - BroadcastPkts uint32 - Discards uint32 -} - -func decodeVLANCounters(data *[]byte) (SFlowVLANCounters, error) { - vc := SFlowVLANCounters{} - var cdf SFlowCounterDataFormat - - *data, cdf = (*data)[4:], SFlowCounterDataFormat(binary.BigEndian.Uint32((*data)[:4])) - vc.EnterpriseID, vc.Format = cdf.decode() - vc.EnterpriseID, vc.Format = cdf.decode() - *data, vc.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, vc.VlanID = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, vc.Octets = (*data)[8:], binary.BigEndian.Uint64((*data)[:8]) - *data, vc.UcastPkts = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, vc.MulticastPkts = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, vc.BroadcastPkts = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, vc.Discards = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - return vc, nil -} - -//SFLLACPportState : SFlow LACP Port State (All(4) - 32 bit) -type SFLLACPPortState struct { - PortStateAll uint32 -} - -//LACPcounters : LACP SFlow Counters ( 64 Bytes ) -type SFlowLACPCounters struct { - SFlowBaseCounterRecord - ActorSystemID net.HardwareAddr - PartnerSystemID net.HardwareAddr - AttachedAggID uint32 - LacpPortState SFLLACPPortState - LACPDUsRx uint32 - MarkerPDUsRx uint32 - MarkerResponsePDUsRx uint32 - UnknownRx uint32 - IllegalRx uint32 - LACPDUsTx uint32 - MarkerPDUsTx uint32 - MarkerResponsePDUsTx uint32 -} - -func decodeLACPCounters(data *[]byte) (SFlowLACPCounters, error) { - la := SFlowLACPCounters{} - var cdf SFlowCounterDataFormat - - *data, cdf = (*data)[4:], SFlowCounterDataFormat(binary.BigEndian.Uint32((*data)[:4])) - la.EnterpriseID, la.Format = cdf.decode() - *data, la.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, la.ActorSystemID = (*data)[6:], (*data)[:6] - *data = (*data)[2:] // remove padding - *data, la.PartnerSystemID = (*data)[6:], (*data)[:6] - *data = (*data)[2:] //remove padding - *data, la.AttachedAggID = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, la.LacpPortState.PortStateAll = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, la.LACPDUsRx = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, la.MarkerPDUsRx = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, la.MarkerResponsePDUsRx = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, la.UnknownRx = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, la.IllegalRx = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, la.LACPDUsTx = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, la.MarkerPDUsTx = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, la.MarkerResponsePDUsTx = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - - return la, nil - -} - -// ************************************************** -// Processor Counter Record -// ************************************************** -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | 20 bit Interprise (0) |12 bit format | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | counter length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | FiveSecCpu | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | OneMinCpu | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | GiveMinCpu | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | TotalMemory | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | FreeMemory | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - -type SFlowProcessorCounters struct { - SFlowBaseCounterRecord - FiveSecCpu uint32 // 5 second average CPU utilization - OneMinCpu uint32 // 1 minute average CPU utilization - FiveMinCpu uint32 // 5 minute average CPU utilization - TotalMemory uint64 // total memory (in bytes) - FreeMemory uint64 // free memory (in bytes) -} - -func decodeProcessorCounters(data *[]byte) (SFlowProcessorCounters, error) { - pc := SFlowProcessorCounters{} - var cdf SFlowCounterDataFormat - var high32, low32 uint32 - - *data, cdf = (*data)[4:], SFlowCounterDataFormat(binary.BigEndian.Uint32((*data)[:4])) - pc.EnterpriseID, pc.Format = cdf.decode() - *data, pc.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - - *data, pc.FiveSecCpu = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, pc.OneMinCpu = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, pc.FiveMinCpu = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, high32 = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, low32 = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - pc.TotalMemory = (uint64(high32) << 32) + uint64(low32) - *data, high32 = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, low32 = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - pc.FreeMemory = (uint64(high32)) + uint64(low32) - - return pc, nil -} - -// SFlowEthernetFrameFlowRecord give additional information -// about the sampled packet if it's available. -// An agent may or may not provide this information. -type SFlowEthernetFrameFlowRecord struct { - SFlowBaseFlowRecord - FrameLength uint32 - SrcMac net.HardwareAddr - DstMac net.HardwareAddr - Type uint32 -} - -// Ethernet frame flow records have the following structure: - -// 0 15 31 -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | 20 bit Interprise (0) |12 bit format | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | record length | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Source Mac Address | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Destination Mac Address | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -// | Ethernet Packet Type | -// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - -func decodeEthernetFrameFlowRecord(data *[]byte) (SFlowEthernetFrameFlowRecord, error) { - es := SFlowEthernetFrameFlowRecord{} - var fdf SFlowFlowDataFormat - - *data, fdf = (*data)[4:], SFlowFlowDataFormat(binary.BigEndian.Uint32((*data)[:4])) - es.EnterpriseID, es.Format = fdf.decode() - *data, es.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - - *data, es.FrameLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, es.SrcMac = (*data)[8:], net.HardwareAddr((*data)[:6]) - *data, es.DstMac = (*data)[8:], net.HardwareAddr((*data)[:6]) - *data, es.Type = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - return es, nil -} - -//SFlowOpenflowPortCounters : OVS-Sflow OpenFlow Port Counter ( 20 Bytes ) -type SFlowOpenflowPortCounters struct { - SFlowBaseCounterRecord - DatapathID uint64 - PortNo uint32 -} - -func decodeOpenflowportCounters(data *[]byte) (SFlowOpenflowPortCounters, error) { - ofp := SFlowOpenflowPortCounters{} - var cdf SFlowCounterDataFormat - - *data, cdf = (*data)[4:], SFlowCounterDataFormat(binary.BigEndian.Uint32((*data)[:4])) - ofp.EnterpriseID, ofp.Format = cdf.decode() - *data, ofp.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, ofp.DatapathID = (*data)[8:], binary.BigEndian.Uint64((*data)[:8]) - *data, ofp.PortNo = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - - return ofp, nil -} - -//SFlowAppresourcesCounters : OVS_Sflow App Resources Counter ( 48 Bytes ) -type SFlowAppresourcesCounters struct { - SFlowBaseCounterRecord - UserTime uint32 - SystemTime uint32 - MemUsed uint64 - MemMax uint64 - FdOpen uint32 - FdMax uint32 - ConnOpen uint32 - ConnMax uint32 -} - -func decodeAppresourcesCounters(data *[]byte) (SFlowAppresourcesCounters, error) { - app := SFlowAppresourcesCounters{} - var cdf SFlowCounterDataFormat - - *data, cdf = (*data)[4:], SFlowCounterDataFormat(binary.BigEndian.Uint32((*data)[:4])) - app.EnterpriseID, app.Format = cdf.decode() - *data, app.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, app.UserTime = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, app.SystemTime = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, app.MemUsed = (*data)[8:], binary.BigEndian.Uint64((*data)[:8]) - *data, app.MemMax = (*data)[8:], binary.BigEndian.Uint64((*data)[:8]) - *data, app.FdOpen = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, app.FdMax = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, app.ConnOpen = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, app.ConnMax = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - - return app, nil -} - -//SFlowOVSDPCounters : OVS-Sflow DataPath Counter ( 32 Bytes ) -type SFlowOVSDPCounters struct { - SFlowBaseCounterRecord - NHit uint32 - NMissed uint32 - NLost uint32 - NMaskHit uint32 - NFlows uint32 - NMasks uint32 -} - -func decodeOVSDPCounters(data *[]byte) (SFlowOVSDPCounters, error) { - dp := SFlowOVSDPCounters{} - var cdf SFlowCounterDataFormat - - *data, cdf = (*data)[4:], SFlowCounterDataFormat(binary.BigEndian.Uint32((*data)[:4])) - dp.EnterpriseID, dp.Format = cdf.decode() - *data, dp.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, dp.NHit = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, dp.NMissed = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, dp.NLost = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, dp.NMaskHit = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, dp.NFlows = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - *data, dp.NMasks = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - - return dp, nil -} - -//SFlowPORTNAME : OVS-Sflow PORTNAME Counter Sampletype ( 20 Bytes ) -type SFlowPORTNAME struct { - SFlowBaseCounterRecord - Len uint32 - Str string -} - -func decodeString(data *[]byte) (len uint32, str string) { - *data, len = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - str = string((*data)[:len]) - if (len % 4) != 0 { - len += 4 - len%4 - } - *data = (*data)[len:] - return -} - -func decodePortnameCounters(data *[]byte) (SFlowPORTNAME, error) { - pn := SFlowPORTNAME{} - var cdf SFlowCounterDataFormat - - *data, cdf = (*data)[4:], SFlowCounterDataFormat(binary.BigEndian.Uint32((*data)[:4])) - pn.EnterpriseID, pn.Format = cdf.decode() - *data, pn.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4]) - pn.Len, pn.Str = decodeString(data) - - return pn, nil -} diff --git a/vendor/github.com/google/gopacket/layers/sip.go b/vendor/github.com/google/gopacket/layers/sip.go deleted file mode 100644 index 70afdb5c0..000000000 --- a/vendor/github.com/google/gopacket/layers/sip.go +++ /dev/null @@ -1,542 +0,0 @@ -// Copyright 2017 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "bytes" - "fmt" - "io" - "strconv" - "strings" - - "github.com/google/gopacket" -) - -// SIPVersion defines the different versions of the SIP Protocol -type SIPVersion uint8 - -// Represents all the versions of SIP protocol -const ( - SIPVersion1 SIPVersion = 1 - SIPVersion2 SIPVersion = 2 -) - -func (sv SIPVersion) String() string { - switch sv { - default: - // Defaulting to SIP/2.0 - return "SIP/2.0" - case SIPVersion1: - return "SIP/1.0" - case SIPVersion2: - return "SIP/2.0" - } -} - -// GetSIPVersion is used to get SIP version constant -func GetSIPVersion(version string) (SIPVersion, error) { - switch strings.ToUpper(version) { - case "SIP/1.0": - return SIPVersion1, nil - case "SIP/2.0": - return SIPVersion2, nil - default: - return 0, fmt.Errorf("Unknown SIP version: '%s'", version) - - } -} - -// SIPMethod defines the different methods of the SIP Protocol -// defined in the different RFC's -type SIPMethod uint16 - -// Here are all the SIP methods -const ( - SIPMethodInvite SIPMethod = 1 // INVITE [RFC3261] - SIPMethodAck SIPMethod = 2 // ACK [RFC3261] - SIPMethodBye SIPMethod = 3 // BYE [RFC3261] - SIPMethodCancel SIPMethod = 4 // CANCEL [RFC3261] - SIPMethodOptions SIPMethod = 5 // OPTIONS [RFC3261] - SIPMethodRegister SIPMethod = 6 // REGISTER [RFC3261] - SIPMethodPrack SIPMethod = 7 // PRACK [RFC3262] - SIPMethodSubscribe SIPMethod = 8 // SUBSCRIBE [RFC6665] - SIPMethodNotify SIPMethod = 9 // NOTIFY [RFC6665] - SIPMethodPublish SIPMethod = 10 // PUBLISH [RFC3903] - SIPMethodInfo SIPMethod = 11 // INFO [RFC6086] - SIPMethodRefer SIPMethod = 12 // REFER [RFC3515] - SIPMethodMessage SIPMethod = 13 // MESSAGE [RFC3428] - SIPMethodUpdate SIPMethod = 14 // UPDATE [RFC3311] - SIPMethodPing SIPMethod = 15 // PING [https://tools.ietf.org/html/draft-fwmiller-ping-03] -) - -func (sm SIPMethod) String() string { - switch sm { - default: - return "Unknown method" - case SIPMethodInvite: - return "INVITE" - case SIPMethodAck: - return "ACK" - case SIPMethodBye: - return "BYE" - case SIPMethodCancel: - return "CANCEL" - case SIPMethodOptions: - return "OPTIONS" - case SIPMethodRegister: - return "REGISTER" - case SIPMethodPrack: - return "PRACK" - case SIPMethodSubscribe: - return "SUBSCRIBE" - case SIPMethodNotify: - return "NOTIFY" - case SIPMethodPublish: - return "PUBLISH" - case SIPMethodInfo: - return "INFO" - case SIPMethodRefer: - return "REFER" - case SIPMethodMessage: - return "MESSAGE" - case SIPMethodUpdate: - return "UPDATE" - case SIPMethodPing: - return "PING" - } -} - -// GetSIPMethod returns the constant of a SIP method -// from its string -func GetSIPMethod(method string) (SIPMethod, error) { - switch strings.ToUpper(method) { - case "INVITE": - return SIPMethodInvite, nil - case "ACK": - return SIPMethodAck, nil - case "BYE": - return SIPMethodBye, nil - case "CANCEL": - return SIPMethodCancel, nil - case "OPTIONS": - return SIPMethodOptions, nil - case "REGISTER": - return SIPMethodRegister, nil - case "PRACK": - return SIPMethodPrack, nil - case "SUBSCRIBE": - return SIPMethodSubscribe, nil - case "NOTIFY": - return SIPMethodNotify, nil - case "PUBLISH": - return SIPMethodPublish, nil - case "INFO": - return SIPMethodInfo, nil - case "REFER": - return SIPMethodRefer, nil - case "MESSAGE": - return SIPMethodMessage, nil - case "UPDATE": - return SIPMethodUpdate, nil - case "PING": - return SIPMethodPing, nil - default: - return 0, fmt.Errorf("Unknown SIP method: '%s'", method) - } -} - -// Here is a correspondance between long header names and short -// as defined in rfc3261 in section 20 -var compactSipHeadersCorrespondance = map[string]string{ - "accept-contact": "a", - "allow-events": "u", - "call-id": "i", - "contact": "m", - "content-encoding": "e", - "content-length": "l", - "content-type": "c", - "event": "o", - "from": "f", - "identity": "y", - "refer-to": "r", - "referred-by": "b", - "reject-contact": "j", - "request-disposition": "d", - "session-expires": "x", - "subject": "s", - "supported": "k", - "to": "t", - "via": "v", -} - -// SIP object will contains information about decoded SIP packet. -// -> The SIP Version -// -> The SIP Headers (in a map[string][]string because of multiple headers with the same name -// -> The SIP Method -// -> The SIP Response code (if it's a response) -// -> The SIP Status line (if it's a response) -// You can easily know the type of the packet with the IsResponse boolean -// -type SIP struct { - BaseLayer - - // Base information - Version SIPVersion - Method SIPMethod - Headers map[string][]string - - // Request - RequestURI string - - // Response - IsResponse bool - ResponseCode int - ResponseStatus string - - // Private fields - cseq int64 - contentLength int64 - lastHeaderParsed string -} - -// decodeSIP decodes the byte slice into a SIP type. It also -// setups the application Layer in PacketBuilder. -func decodeSIP(data []byte, p gopacket.PacketBuilder) error { - s := NewSIP() - err := s.DecodeFromBytes(data, p) - if err != nil { - return err - } - p.AddLayer(s) - p.SetApplicationLayer(s) - return nil -} - -// NewSIP instantiates a new empty SIP object -func NewSIP() *SIP { - s := new(SIP) - s.Headers = make(map[string][]string) - return s -} - -// LayerType returns gopacket.LayerTypeSIP. -func (s *SIP) LayerType() gopacket.LayerType { - return LayerTypeSIP -} - -// Payload returns the base layer payload -func (s *SIP) Payload() []byte { - return s.BaseLayer.Payload -} - -// CanDecode returns the set of layer types that this DecodingLayer can decode -func (s *SIP) CanDecode() gopacket.LayerClass { - return LayerTypeSIP -} - -// NextLayerType returns the layer type contained by this DecodingLayer -func (s *SIP) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypePayload -} - -// DecodeFromBytes decodes the slice into the SIP struct. -func (s *SIP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - // Init some vars for parsing follow-up - var countLines int - var line []byte - var err error - var offset int - - // Iterate on all lines of the SIP Headers - // and stop when we reach the SDP (aka when the new line - // is at index 0 of the remaining packet) - buffer := bytes.NewBuffer(data) - - for { - - // Read next line - line, err = buffer.ReadBytes(byte('\n')) - if err != nil { - if err == io.EOF { - if len(bytes.Trim(line, "\r\n")) > 0 { - df.SetTruncated() - } - break - } else { - return err - } - } - offset += len(line) - - // Trim the new line delimiters - line = bytes.Trim(line, "\r\n") - - // Empty line, we hit Body - if len(line) == 0 { - break - } - - // First line is the SIP request/response line - // Other lines are headers - if countLines == 0 { - err = s.ParseFirstLine(line) - if err != nil { - return err - } - - } else { - err = s.ParseHeader(line) - if err != nil { - return err - } - } - - countLines++ - } - s.BaseLayer = BaseLayer{Contents: data[:offset], Payload: data[offset:]} - - return nil -} - -// ParseFirstLine will compute the first line of a SIP packet. -// The first line will tell us if it's a request or a response. -// -// Examples of first line of SIP Prococol : -// -// Request : INVITE bob@example.com SIP/2.0 -// Response : SIP/2.0 200 OK -// Response : SIP/2.0 501 Not Implemented -// -func (s *SIP) ParseFirstLine(firstLine []byte) error { - - var err error - - // Splits line by space - splits := strings.SplitN(string(firstLine), " ", 3) - - // We must have at least 3 parts - if len(splits) < 3 { - return fmt.Errorf("invalid first SIP line: '%s'", string(firstLine)) - } - - // Determine the SIP packet type - if strings.HasPrefix(splits[0], "SIP") { - - // --> Response - s.IsResponse = true - - // Validate SIP Version - s.Version, err = GetSIPVersion(splits[0]) - if err != nil { - return err - } - - // Compute code - s.ResponseCode, err = strconv.Atoi(splits[1]) - if err != nil { - return err - } - - // Compute status line - s.ResponseStatus = splits[2] - - } else { - - // --> Request - - // Validate method - s.Method, err = GetSIPMethod(splits[0]) - if err != nil { - return err - } - - s.RequestURI = splits[1] - - // Validate SIP Version - s.Version, err = GetSIPVersion(splits[2]) - if err != nil { - return err - } - } - - return nil -} - -// ParseHeader will parse a SIP Header -// SIP Headers are quite simple, there are colon separated name and value -// Headers can be spread over multiple lines -// -// Examples of header : -// -// CSeq: 1 REGISTER -// Via: SIP/2.0/UDP there.com:5060 -// Authorization:Digest username="UserB", -// realm="MCI WorldCom SIP", -// nonce="1cec4341ae6cbe5a359ea9c8e88df84f", opaque="", -// uri="sip:ss2.wcom.com", response="71ba27c64bd01de719686aa4590d5824" -// -func (s *SIP) ParseHeader(header []byte) (err error) { - - // Ignore empty headers - if len(header) == 0 { - return - } - - // Check if this is the following of last header - // RFC 3261 - 7.3.1 - Header Field Format specify that following lines of - // multiline headers must begin by SP or TAB - if header[0] == '\t' || header[0] == ' ' { - - header = bytes.TrimSpace(header) - s.Headers[s.lastHeaderParsed][len(s.Headers[s.lastHeaderParsed])-1] += fmt.Sprintf(" %s", string(header)) - return - } - - // Find the ':' to separate header name and value - index := bytes.Index(header, []byte(":")) - if index >= 0 { - - headerName := strings.ToLower(string(bytes.Trim(header[:index], " "))) - headerValue := string(bytes.Trim(header[index+1:], " ")) - - // Add header to object - s.Headers[headerName] = append(s.Headers[headerName], headerValue) - s.lastHeaderParsed = headerName - - // Compute specific headers - err = s.ParseSpecificHeaders(headerName, headerValue) - if err != nil { - return err - } - } - - return nil -} - -// ParseSpecificHeaders will parse some specific key values from -// specific headers like CSeq or Content-Length integer values -func (s *SIP) ParseSpecificHeaders(headerName string, headerValue string) (err error) { - - switch headerName { - case "cseq": - - // CSeq header value is formatted like that : - // CSeq: 123 INVITE - // We split the value to parse Cseq integer value, and method - splits := strings.Split(headerValue, " ") - if len(splits) > 1 { - - // Parse Cseq - s.cseq, err = strconv.ParseInt(splits[0], 10, 64) - if err != nil { - return err - } - - // Validate method - if s.IsResponse { - s.Method, err = GetSIPMethod(splits[1]) - if err != nil { - return err - } - } - } - - case "content-length": - - // Parse Content-Length - s.contentLength, err = strconv.ParseInt(headerValue, 10, 64) - if err != nil { - return err - } - } - - return nil -} - -// GetAllHeaders will return the full headers of the -// current SIP packets in a map[string][]string -func (s *SIP) GetAllHeaders() map[string][]string { - return s.Headers -} - -// GetHeader will return all the headers with -// the specified name. -func (s *SIP) GetHeader(headerName string) []string { - headerName = strings.ToLower(headerName) - h := make([]string, 0) - if _, ok := s.Headers[headerName]; ok { - return s.Headers[headerName] - } - compactHeader := compactSipHeadersCorrespondance[headerName] - if _, ok := s.Headers[compactHeader]; ok { - return s.Headers[compactHeader] - } - return h -} - -// GetFirstHeader will return the first header with -// the specified name. If the current SIP packet has multiple -// headers with the same name, it returns the first. -func (s *SIP) GetFirstHeader(headerName string) string { - headers := s.GetHeader(headerName) - if len(headers) > 0 { - return headers[0] - } - return "" -} - -// -// Some handy getters for most used SIP headers -// - -// GetAuthorization will return the Authorization -// header of the current SIP packet -func (s *SIP) GetAuthorization() string { - return s.GetFirstHeader("Authorization") -} - -// GetFrom will return the From -// header of the current SIP packet -func (s *SIP) GetFrom() string { - return s.GetFirstHeader("From") -} - -// GetTo will return the To -// header of the current SIP packet -func (s *SIP) GetTo() string { - return s.GetFirstHeader("To") -} - -// GetContact will return the Contact -// header of the current SIP packet -func (s *SIP) GetContact() string { - return s.GetFirstHeader("Contact") -} - -// GetCallID will return the Call-ID -// header of the current SIP packet -func (s *SIP) GetCallID() string { - return s.GetFirstHeader("Call-ID") -} - -// GetUserAgent will return the User-Agent -// header of the current SIP packet -func (s *SIP) GetUserAgent() string { - return s.GetFirstHeader("User-Agent") -} - -// GetContentLength will return the parsed integer -// Content-Length header of the current SIP packet -func (s *SIP) GetContentLength() int64 { - return s.contentLength -} - -// GetCSeq will return the parsed integer CSeq header -// header of the current SIP packet -func (s *SIP) GetCSeq() int64 { - return s.cseq -} diff --git a/vendor/github.com/google/gopacket/layers/stp.go b/vendor/github.com/google/gopacket/layers/stp.go deleted file mode 100644 index bde7d7c8e..000000000 --- a/vendor/github.com/google/gopacket/layers/stp.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2017 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "github.com/google/gopacket" -) - -// STP decode spanning tree protocol packets to transport BPDU (bridge protocol data unit) message. -type STP struct { - BaseLayer -} - -// LayerType returns gopacket.LayerTypeSTP. -func (s *STP) LayerType() gopacket.LayerType { return LayerTypeSTP } - -func decodeSTP(data []byte, p gopacket.PacketBuilder) error { - stp := &STP{} - stp.Contents = data[:] - // TODO: parse the STP protocol into actual subfields. - p.AddLayer(stp) - return nil -} diff --git a/vendor/github.com/google/gopacket/layers/tcp.go b/vendor/github.com/google/gopacket/layers/tcp.go deleted file mode 100644 index bcdeb4b3c..000000000 --- a/vendor/github.com/google/gopacket/layers/tcp.go +++ /dev/null @@ -1,341 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// Copyright 2009-2011 Andreas Krennmair. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "encoding/hex" - "errors" - "fmt" - - "github.com/google/gopacket" -) - -// TCP is the layer for TCP headers. -type TCP struct { - BaseLayer - SrcPort, DstPort TCPPort - Seq uint32 - Ack uint32 - DataOffset uint8 - FIN, SYN, RST, PSH, ACK, URG, ECE, CWR, NS bool - Window uint16 - Checksum uint16 - Urgent uint16 - sPort, dPort []byte - Options []TCPOption - Padding []byte - opts [4]TCPOption - tcpipchecksum -} - -// TCPOptionKind represents a TCP option code. -type TCPOptionKind uint8 - -const ( - TCPOptionKindEndList = 0 - TCPOptionKindNop = 1 - TCPOptionKindMSS = 2 // len = 4 - TCPOptionKindWindowScale = 3 // len = 3 - TCPOptionKindSACKPermitted = 4 // len = 2 - TCPOptionKindSACK = 5 // len = n - TCPOptionKindEcho = 6 // len = 6, obsolete - TCPOptionKindEchoReply = 7 // len = 6, obsolete - TCPOptionKindTimestamps = 8 // len = 10 - TCPOptionKindPartialOrderConnectionPermitted = 9 // len = 2, obsolete - TCPOptionKindPartialOrderServiceProfile = 10 // len = 3, obsolete - TCPOptionKindCC = 11 // obsolete - TCPOptionKindCCNew = 12 // obsolete - TCPOptionKindCCEcho = 13 // obsolete - TCPOptionKindAltChecksum = 14 // len = 3, obsolete - TCPOptionKindAltChecksumData = 15 // len = n, obsolete -) - -func (k TCPOptionKind) String() string { - switch k { - case TCPOptionKindEndList: - return "EndList" - case TCPOptionKindNop: - return "NOP" - case TCPOptionKindMSS: - return "MSS" - case TCPOptionKindWindowScale: - return "WindowScale" - case TCPOptionKindSACKPermitted: - return "SACKPermitted" - case TCPOptionKindSACK: - return "SACK" - case TCPOptionKindEcho: - return "Echo" - case TCPOptionKindEchoReply: - return "EchoReply" - case TCPOptionKindTimestamps: - return "Timestamps" - case TCPOptionKindPartialOrderConnectionPermitted: - return "PartialOrderConnectionPermitted" - case TCPOptionKindPartialOrderServiceProfile: - return "PartialOrderServiceProfile" - case TCPOptionKindCC: - return "CC" - case TCPOptionKindCCNew: - return "CCNew" - case TCPOptionKindCCEcho: - return "CCEcho" - case TCPOptionKindAltChecksum: - return "AltChecksum" - case TCPOptionKindAltChecksumData: - return "AltChecksumData" - default: - return fmt.Sprintf("Unknown(%d)", k) - } -} - -type TCPOption struct { - OptionType TCPOptionKind - OptionLength uint8 - OptionData []byte -} - -func (t TCPOption) String() string { - hd := hex.EncodeToString(t.OptionData) - if len(hd) > 0 { - hd = " 0x" + hd - } - switch t.OptionType { - case TCPOptionKindMSS: - if len(t.OptionData) >= 2 { - return fmt.Sprintf("TCPOption(%s:%v%s)", - t.OptionType, - binary.BigEndian.Uint16(t.OptionData), - hd) - } - - case TCPOptionKindTimestamps: - if len(t.OptionData) == 8 { - return fmt.Sprintf("TCPOption(%s:%v/%v%s)", - t.OptionType, - binary.BigEndian.Uint32(t.OptionData[:4]), - binary.BigEndian.Uint32(t.OptionData[4:8]), - hd) - } - } - return fmt.Sprintf("TCPOption(%s:%s)", t.OptionType, hd) -} - -// LayerType returns gopacket.LayerTypeTCP -func (t *TCP) LayerType() gopacket.LayerType { return LayerTypeTCP } - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (t *TCP) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - var optionLength int - for _, o := range t.Options { - switch o.OptionType { - case 0, 1: - optionLength += 1 - default: - optionLength += 2 + len(o.OptionData) - } - } - if opts.FixLengths { - if rem := optionLength % 4; rem != 0 { - t.Padding = lotsOfZeros[:4-rem] - } - t.DataOffset = uint8((len(t.Padding) + optionLength + 20) / 4) - } - bytes, err := b.PrependBytes(20 + optionLength + len(t.Padding)) - if err != nil { - return err - } - binary.BigEndian.PutUint16(bytes, uint16(t.SrcPort)) - binary.BigEndian.PutUint16(bytes[2:], uint16(t.DstPort)) - binary.BigEndian.PutUint32(bytes[4:], t.Seq) - binary.BigEndian.PutUint32(bytes[8:], t.Ack) - binary.BigEndian.PutUint16(bytes[12:], t.flagsAndOffset()) - binary.BigEndian.PutUint16(bytes[14:], t.Window) - binary.BigEndian.PutUint16(bytes[18:], t.Urgent) - start := 20 - for _, o := range t.Options { - bytes[start] = byte(o.OptionType) - switch o.OptionType { - case 0, 1: - start++ - default: - if opts.FixLengths { - o.OptionLength = uint8(len(o.OptionData) + 2) - } - bytes[start+1] = o.OptionLength - copy(bytes[start+2:start+len(o.OptionData)+2], o.OptionData) - start += len(o.OptionData) + 2 - } - } - copy(bytes[start:], t.Padding) - if opts.ComputeChecksums { - // zero out checksum bytes in current serialization. - bytes[16] = 0 - bytes[17] = 0 - csum, err := t.computeChecksum(b.Bytes(), IPProtocolTCP) - if err != nil { - return err - } - t.Checksum = csum - } - binary.BigEndian.PutUint16(bytes[16:], t.Checksum) - return nil -} - -func (t *TCP) ComputeChecksum() (uint16, error) { - return t.computeChecksum(append(t.Contents, t.Payload...), IPProtocolTCP) -} - -func (t *TCP) flagsAndOffset() uint16 { - f := uint16(t.DataOffset) << 12 - if t.FIN { - f |= 0x0001 - } - if t.SYN { - f |= 0x0002 - } - if t.RST { - f |= 0x0004 - } - if t.PSH { - f |= 0x0008 - } - if t.ACK { - f |= 0x0010 - } - if t.URG { - f |= 0x0020 - } - if t.ECE { - f |= 0x0040 - } - if t.CWR { - f |= 0x0080 - } - if t.NS { - f |= 0x0100 - } - return f -} - -func (tcp *TCP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 20 { - df.SetTruncated() - return fmt.Errorf("Invalid TCP header. Length %d less than 20", len(data)) - } - tcp.SrcPort = TCPPort(binary.BigEndian.Uint16(data[0:2])) - tcp.sPort = data[0:2] - tcp.DstPort = TCPPort(binary.BigEndian.Uint16(data[2:4])) - tcp.dPort = data[2:4] - tcp.Seq = binary.BigEndian.Uint32(data[4:8]) - tcp.Ack = binary.BigEndian.Uint32(data[8:12]) - tcp.DataOffset = data[12] >> 4 - tcp.FIN = data[13]&0x01 != 0 - tcp.SYN = data[13]&0x02 != 0 - tcp.RST = data[13]&0x04 != 0 - tcp.PSH = data[13]&0x08 != 0 - tcp.ACK = data[13]&0x10 != 0 - tcp.URG = data[13]&0x20 != 0 - tcp.ECE = data[13]&0x40 != 0 - tcp.CWR = data[13]&0x80 != 0 - tcp.NS = data[12]&0x01 != 0 - tcp.Window = binary.BigEndian.Uint16(data[14:16]) - tcp.Checksum = binary.BigEndian.Uint16(data[16:18]) - tcp.Urgent = binary.BigEndian.Uint16(data[18:20]) - if tcp.Options == nil { - // Pre-allocate to avoid allocating a slice. - tcp.Options = tcp.opts[:0] - } else { - tcp.Options = tcp.Options[:0] - } - tcp.Padding = tcp.Padding[:0] - if tcp.DataOffset < 5 { - return fmt.Errorf("Invalid TCP data offset %d < 5", tcp.DataOffset) - } - dataStart := int(tcp.DataOffset) * 4 - if dataStart > len(data) { - df.SetTruncated() - tcp.Payload = nil - tcp.Contents = data - return errors.New("TCP data offset greater than packet length") - } - tcp.Contents = data[:dataStart] - tcp.Payload = data[dataStart:] - // From here on, data points just to the header options. - data = data[20:dataStart] -OPTIONS: - for len(data) > 0 { - tcp.Options = append(tcp.Options, TCPOption{OptionType: TCPOptionKind(data[0])}) - opt := &tcp.Options[len(tcp.Options)-1] - switch opt.OptionType { - case TCPOptionKindEndList: // End of options - opt.OptionLength = 1 - tcp.Padding = data[1:] - break OPTIONS - case TCPOptionKindNop: // 1 byte padding - opt.OptionLength = 1 - default: - if len(data) < 2 { - df.SetTruncated() - return fmt.Errorf("Invalid TCP option length. Length %d less than 2", len(data)) - } - opt.OptionLength = data[1] - if opt.OptionLength < 2 { - return fmt.Errorf("Invalid TCP option length %d < 2", opt.OptionLength) - } else if int(opt.OptionLength) > len(data) { - df.SetTruncated() - return fmt.Errorf("Invalid TCP option length %d exceeds remaining %d bytes", opt.OptionLength, len(data)) - } - opt.OptionData = data[2:opt.OptionLength] - } - data = data[opt.OptionLength:] - } - return nil -} - -func (t *TCP) CanDecode() gopacket.LayerClass { - return LayerTypeTCP -} - -func (t *TCP) NextLayerType() gopacket.LayerType { - lt := t.DstPort.LayerType() - if lt == gopacket.LayerTypePayload { - lt = t.SrcPort.LayerType() - } - return lt -} - -func decodeTCP(data []byte, p gopacket.PacketBuilder) error { - tcp := &TCP{} - err := tcp.DecodeFromBytes(data, p) - p.AddLayer(tcp) - p.SetTransportLayer(tcp) - if err != nil { - return err - } - if p.DecodeOptions().DecodeStreamsAsDatagrams { - return p.NextDecoder(tcp.NextLayerType()) - } else { - return p.NextDecoder(gopacket.LayerTypePayload) - } -} - -func (t *TCP) TransportFlow() gopacket.Flow { - return gopacket.NewFlow(EndpointTCPPort, t.sPort, t.dPort) -} - -// For testing only -func (t *TCP) SetInternalPortsForTesting() { - t.sPort = make([]byte, 2) - t.dPort = make([]byte, 2) - binary.BigEndian.PutUint16(t.sPort, uint16(t.SrcPort)) - binary.BigEndian.PutUint16(t.dPort, uint16(t.DstPort)) -} diff --git a/vendor/github.com/google/gopacket/layers/tcpip.go b/vendor/github.com/google/gopacket/layers/tcpip.go deleted file mode 100644 index 64ba51cc7..000000000 --- a/vendor/github.com/google/gopacket/layers/tcpip.go +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// Copyright 2009-2011 Andreas Krennmair. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "errors" - "fmt" - - "github.com/google/gopacket" -) - -// Checksum computation for TCP/UDP. -type tcpipchecksum struct { - pseudoheader tcpipPseudoHeader -} - -type tcpipPseudoHeader interface { - pseudoheaderChecksum() (uint32, error) -} - -func (ip *IPv4) pseudoheaderChecksum() (csum uint32, err error) { - if err := ip.AddressTo4(); err != nil { - return 0, err - } - csum += (uint32(ip.SrcIP[0]) + uint32(ip.SrcIP[2])) << 8 - csum += uint32(ip.SrcIP[1]) + uint32(ip.SrcIP[3]) - csum += (uint32(ip.DstIP[0]) + uint32(ip.DstIP[2])) << 8 - csum += uint32(ip.DstIP[1]) + uint32(ip.DstIP[3]) - return csum, nil -} - -func (ip *IPv6) pseudoheaderChecksum() (csum uint32, err error) { - if err := ip.AddressTo16(); err != nil { - return 0, err - } - for i := 0; i < 16; i += 2 { - csum += uint32(ip.SrcIP[i]) << 8 - csum += uint32(ip.SrcIP[i+1]) - csum += uint32(ip.DstIP[i]) << 8 - csum += uint32(ip.DstIP[i+1]) - } - return csum, nil -} - -// Calculate the TCP/IP checksum defined in rfc1071. The passed-in csum is any -// initial checksum data that's already been computed. -func tcpipChecksum(data []byte, csum uint32) uint16 { - // to handle odd lengths, we loop to length - 1, incrementing by 2, then - // handle the last byte specifically by checking against the original - // length. - length := len(data) - 1 - for i := 0; i < length; i += 2 { - // For our test packet, doing this manually is about 25% faster - // (740 ns vs. 1000ns) than doing it by calling binary.BigEndian.Uint16. - csum += uint32(data[i]) << 8 - csum += uint32(data[i+1]) - } - if len(data)%2 == 1 { - csum += uint32(data[length]) << 8 - } - for csum > 0xffff { - csum = (csum >> 16) + (csum & 0xffff) - } - return ^uint16(csum) -} - -// computeChecksum computes a TCP or UDP checksum. headerAndPayload is the -// serialized TCP or UDP header plus its payload, with the checksum zero'd -// out. headerProtocol is the IP protocol number of the upper-layer header. -func (c *tcpipchecksum) computeChecksum(headerAndPayload []byte, headerProtocol IPProtocol) (uint16, error) { - if c.pseudoheader == nil { - return 0, errors.New("TCP/IP layer 4 checksum cannot be computed without network layer... call SetNetworkLayerForChecksum to set which layer to use") - } - length := uint32(len(headerAndPayload)) - csum, err := c.pseudoheader.pseudoheaderChecksum() - if err != nil { - return 0, err - } - csum += uint32(headerProtocol) - csum += length & 0xffff - csum += length >> 16 - return tcpipChecksum(headerAndPayload, csum), nil -} - -// SetNetworkLayerForChecksum tells this layer which network layer is wrapping it. -// This is needed for computing the checksum when serializing, since TCP/IP transport -// layer checksums depends on fields in the IPv4 or IPv6 layer that contains it. -// The passed in layer must be an *IPv4 or *IPv6. -func (i *tcpipchecksum) SetNetworkLayerForChecksum(l gopacket.NetworkLayer) error { - switch v := l.(type) { - case *IPv4: - i.pseudoheader = v - case *IPv6: - i.pseudoheader = v - default: - return fmt.Errorf("cannot use layer type %v for tcp checksum network layer", l.LayerType()) - } - return nil -} diff --git a/vendor/github.com/google/gopacket/layers/test_creator.py b/vendor/github.com/google/gopacket/layers/test_creator.py deleted file mode 100644 index c92d2765a..000000000 --- a/vendor/github.com/google/gopacket/layers/test_creator.py +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/python -# Copyright 2012 Google, Inc. All rights reserved. - -"""TestCreator creates test templates from pcap files.""" - -import argparse -import base64 -import glob -import re -import string -import subprocess -import sys - - -class Packet(object): - """Helper class encapsulating packet from a pcap file.""" - - def __init__(self, packet_lines): - self.packet_lines = packet_lines - self.data = self._DecodeText(packet_lines) - - @classmethod - def _DecodeText(cls, packet_lines): - packet_bytes = [] - # First line is timestamp and stuff, skip it. - # Format: 0x0010: 0000 0020 3aff 3ffe 0000 0000 0000 0000 ....:.?......... - - for line in packet_lines[1:]: - m = re.match(r'\s+0x[a-f\d]+:\s+((?:[\da-f]{2,4}\s)*)', line, re.IGNORECASE) - if m is None: continue - for hexpart in m.group(1).split(): - packet_bytes.append(base64.b16decode(hexpart.upper())) - return ''.join(packet_bytes) - - def Test(self, name, link_type): - """Yields a test using this packet, as a set of lines.""" - yield '// testPacket%s is the packet:' % name - for line in self.packet_lines: - yield '// ' + line - yield 'var testPacket%s = []byte{' % name - data = list(self.data) - while data: - linebytes, data = data[:16], data[16:] - yield ''.join(['\t'] + ['0x%02x, ' % ord(c) for c in linebytes]) - yield '}' - yield 'func TestPacket%s(t *testing.T) {' % name - yield '\tp := gopacket.NewPacket(testPacket%s, LinkType%s, gopacket.Default)' % (name, link_type) - yield '\tif p.ErrorLayer() != nil {' - yield '\t\tt.Error("Failed to decode packet:", p.ErrorLayer().Error())' - yield '\t}' - yield '\tcheckLayers(p, []gopacket.LayerType{LayerType%s, FILL_ME_IN_WITH_ACTUAL_LAYERS}, t)' % link_type - yield '}' - yield 'func BenchmarkDecodePacket%s(b *testing.B) {' % name - yield '\tfor i := 0; i < b.N; i++ {' - yield '\t\tgopacket.NewPacket(testPacket%s, LinkType%s, gopacket.NoCopy)' % (name, link_type) - yield '\t}' - yield '}' - - - -def GetTcpdumpOutput(filename): - """Runs tcpdump on the given file, returning output as string.""" - return subprocess.check_output( - ['tcpdump', '-XX', '-s', '0', '-n', '-r', filename]) - - -def TcpdumpOutputToPackets(output): - """Reads a pcap file with TCPDump, yielding Packet objects.""" - pdata = [] - for line in output.splitlines(): - if line[0] not in string.whitespace and pdata: - yield Packet(pdata) - pdata = [] - pdata.append(line) - if pdata: - yield Packet(pdata) - - -def main(): - class CustomHelpFormatter(argparse.ArgumentDefaultsHelpFormatter): - def _format_usage(self, usage, actions, groups, prefix=None): - header =('TestCreator creates gopacket tests using a pcap file.\n\n' - 'Tests are written to standard out... they can then be \n' - 'copied into the file of your choice and modified as \n' - 'you see.\n\n') - return header + argparse.ArgumentDefaultsHelpFormatter._format_usage( - self, usage, actions, groups, prefix) - - parser = argparse.ArgumentParser(formatter_class=CustomHelpFormatter) - parser.add_argument('--link_type', default='Ethernet', help='the link type (default: %(default)s)') - parser.add_argument('--name', default='Packet%d', help='the layer type, must have "%d" inside it') - parser.add_argument('files', metavar='file.pcap', type=str, nargs='+', help='the files to process') - - args = parser.parse_args() - - for arg in args.files: - for path in glob.glob(arg): - for i, packet in enumerate(TcpdumpOutputToPackets(GetTcpdumpOutput(path))): - print '\n'.join(packet.Test( - args.name % i, args.link_type)) - -if __name__ == '__main__': - main() diff --git a/vendor/github.com/google/gopacket/layers/tls.go b/vendor/github.com/google/gopacket/layers/tls.go deleted file mode 100644 index 5a155d455..000000000 --- a/vendor/github.com/google/gopacket/layers/tls.go +++ /dev/null @@ -1,283 +0,0 @@ -// Copyright 2018 The GoPacket Authors. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - - "github.com/google/gopacket" -) - -// TLSType defines the type of data after the TLS Record -type TLSType uint8 - -// TLSType known values. -const ( - TLSChangeCipherSpec TLSType = 20 - TLSAlert TLSType = 21 - TLSHandshake TLSType = 22 - TLSApplicationData TLSType = 23 - TLSUnknown TLSType = 255 -) - -// String shows the register type nicely formatted -func (tt TLSType) String() string { - switch tt { - default: - return "Unknown" - case TLSChangeCipherSpec: - return "Change Cipher Spec" - case TLSAlert: - return "Alert" - case TLSHandshake: - return "Handshake" - case TLSApplicationData: - return "Application Data" - } -} - -// TLSVersion represents the TLS version in numeric format -type TLSVersion uint16 - -// Strings shows the TLS version nicely formatted -func (tv TLSVersion) String() string { - switch tv { - default: - return "Unknown" - case 0x0200: - return "SSL 2.0" - case 0x0300: - return "SSL 3.0" - case 0x0301: - return "TLS 1.0" - case 0x0302: - return "TLS 1.1" - case 0x0303: - return "TLS 1.2" - case 0x0304: - return "TLS 1.3" - } -} - -// TLS is specified in RFC 5246 -// -// TLS Record Protocol -// 0 1 2 3 4 5 6 7 8 -// +--+--+--+--+--+--+--+--+ -// | Content Type | -// +--+--+--+--+--+--+--+--+ -// | Version (major) | -// +--+--+--+--+--+--+--+--+ -// | Version (minor) | -// +--+--+--+--+--+--+--+--+ -// | Length | -// +--+--+--+--+--+--+--+--+ -// | Length | -// +--+--+--+--+--+--+--+--+ - -// TLS is actually a slide of TLSrecord structures -type TLS struct { - BaseLayer - - // TLS Records - ChangeCipherSpec []TLSChangeCipherSpecRecord - Handshake []TLSHandshakeRecord - AppData []TLSAppDataRecord - Alert []TLSAlertRecord -} - -// TLSRecordHeader contains all the information that each TLS Record types should have -type TLSRecordHeader struct { - ContentType TLSType - Version TLSVersion - Length uint16 -} - -// LayerType returns gopacket.LayerTypeTLS. -func (t *TLS) LayerType() gopacket.LayerType { return LayerTypeTLS } - -// decodeTLS decodes the byte slice into a TLS type. It also -// setups the application Layer in PacketBuilder. -func decodeTLS(data []byte, p gopacket.PacketBuilder) error { - t := &TLS{} - err := t.DecodeFromBytes(data, p) - if err != nil { - return err - } - p.AddLayer(t) - p.SetApplicationLayer(t) - return nil -} - -// DecodeFromBytes decodes the slice into the TLS struct. -func (t *TLS) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - t.BaseLayer.Contents = data - t.BaseLayer.Payload = nil - - t.ChangeCipherSpec = t.ChangeCipherSpec[:0] - t.Handshake = t.Handshake[:0] - t.AppData = t.AppData[:0] - t.Alert = t.Alert[:0] - - return t.decodeTLSRecords(data, df) -} - -func (t *TLS) decodeTLSRecords(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 5 { - df.SetTruncated() - return errors.New("TLS record too short") - } - - // since there are no further layers, the baselayer's content is - // pointing to this layer - // TODO: Consider removing this - t.BaseLayer = BaseLayer{Contents: data[:len(data)]} - - var h TLSRecordHeader - h.ContentType = TLSType(data[0]) - h.Version = TLSVersion(binary.BigEndian.Uint16(data[1:3])) - h.Length = binary.BigEndian.Uint16(data[3:5]) - - if h.ContentType.String() == "Unknown" { - return errors.New("Unknown TLS record type") - } - - hl := 5 // header length - tl := hl + int(h.Length) - if len(data) < tl { - df.SetTruncated() - return errors.New("TLS packet length mismatch") - } - - switch h.ContentType { - default: - return errors.New("Unknown TLS record type") - case TLSChangeCipherSpec: - var r TLSChangeCipherSpecRecord - e := r.decodeFromBytes(h, data[hl:tl], df) - if e != nil { - return e - } - t.ChangeCipherSpec = append(t.ChangeCipherSpec, r) - case TLSAlert: - var r TLSAlertRecord - e := r.decodeFromBytes(h, data[hl:tl], df) - if e != nil { - return e - } - t.Alert = append(t.Alert, r) - case TLSHandshake: - var r TLSHandshakeRecord - e := r.decodeFromBytes(h, data[hl:tl], df) - if e != nil { - return e - } - t.Handshake = append(t.Handshake, r) - case TLSApplicationData: - var r TLSAppDataRecord - e := r.decodeFromBytes(h, data[hl:tl], df) - if e != nil { - return e - } - t.AppData = append(t.AppData, r) - } - - if len(data) == tl { - return nil - } - return t.decodeTLSRecords(data[tl:len(data)], df) -} - -// CanDecode implements gopacket.DecodingLayer. -func (t *TLS) CanDecode() gopacket.LayerClass { - return LayerTypeTLS -} - -// NextLayerType implements gopacket.DecodingLayer. -func (t *TLS) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypeZero -} - -// Payload returns nil, since TLS encrypted payload is inside TLSAppDataRecord -func (t *TLS) Payload() []byte { - return nil -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -func (t *TLS) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - totalLength := 0 - for _, record := range t.ChangeCipherSpec { - if opts.FixLengths { - record.Length = 1 - } - totalLength += 5 + 1 // length of header + record - } - for range t.Handshake { - totalLength += 5 - // TODO - } - for _, record := range t.AppData { - if opts.FixLengths { - record.Length = uint16(len(record.Payload)) - } - totalLength += 5 + len(record.Payload) - } - for _, record := range t.Alert { - if len(record.EncryptedMsg) == 0 { - if opts.FixLengths { - record.Length = 2 - } - totalLength += 5 + 2 - } else { - if opts.FixLengths { - record.Length = uint16(len(record.EncryptedMsg)) - } - totalLength += 5 + len(record.EncryptedMsg) - } - } - data, err := b.PrependBytes(totalLength) - if err != nil { - return err - } - off := 0 - for _, record := range t.ChangeCipherSpec { - off = encodeHeader(record.TLSRecordHeader, data, off) - data[off] = byte(record.Message) - off++ - } - for _, record := range t.Handshake { - off = encodeHeader(record.TLSRecordHeader, data, off) - // TODO - } - for _, record := range t.AppData { - off = encodeHeader(record.TLSRecordHeader, data, off) - copy(data[off:], record.Payload) - off += len(record.Payload) - } - for _, record := range t.Alert { - off = encodeHeader(record.TLSRecordHeader, data, off) - if len(record.EncryptedMsg) == 0 { - data[off] = byte(record.Level) - data[off+1] = byte(record.Description) - off += 2 - } else { - copy(data[off:], record.EncryptedMsg) - off += len(record.EncryptedMsg) - } - } - return nil -} - -func encodeHeader(header TLSRecordHeader, data []byte, offset int) int { - data[offset] = byte(header.ContentType) - binary.BigEndian.PutUint16(data[offset+1:], uint16(header.Version)) - binary.BigEndian.PutUint16(data[offset+3:], header.Length) - - return offset + 5 -} diff --git a/vendor/github.com/google/gopacket/layers/tls_alert.go b/vendor/github.com/google/gopacket/layers/tls_alert.go deleted file mode 100644 index 0c5aee021..000000000 --- a/vendor/github.com/google/gopacket/layers/tls_alert.go +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright 2018 The GoPacket Authors. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "errors" - "fmt" - - "github.com/google/gopacket" -) - -// TLSAlertLevel defines the alert level data type -type TLSAlertLevel uint8 - -// TLSAlertDescr defines the alert descrption data type -type TLSAlertDescr uint8 - -const ( - TLSAlertWarning TLSAlertLevel = 1 - TLSAlertFatal TLSAlertLevel = 2 - TLSAlertUnknownLevel TLSAlertLevel = 255 - - TLSAlertCloseNotify TLSAlertDescr = 0 - TLSAlertUnexpectedMessage TLSAlertDescr = 10 - TLSAlertBadRecordMac TLSAlertDescr = 20 - TLSAlertDecryptionFailedRESERVED TLSAlertDescr = 21 - TLSAlertRecordOverflow TLSAlertDescr = 22 - TLSAlertDecompressionFailure TLSAlertDescr = 30 - TLSAlertHandshakeFailure TLSAlertDescr = 40 - TLSAlertNoCertificateRESERVED TLSAlertDescr = 41 - TLSAlertBadCertificate TLSAlertDescr = 42 - TLSAlertUnsupportedCertificate TLSAlertDescr = 43 - TLSAlertCertificateRevoked TLSAlertDescr = 44 - TLSAlertCertificateExpired TLSAlertDescr = 45 - TLSAlertCertificateUnknown TLSAlertDescr = 46 - TLSAlertIllegalParameter TLSAlertDescr = 47 - TLSAlertUnknownCa TLSAlertDescr = 48 - TLSAlertAccessDenied TLSAlertDescr = 49 - TLSAlertDecodeError TLSAlertDescr = 50 - TLSAlertDecryptError TLSAlertDescr = 51 - TLSAlertExportRestrictionRESERVED TLSAlertDescr = 60 - TLSAlertProtocolVersion TLSAlertDescr = 70 - TLSAlertInsufficientSecurity TLSAlertDescr = 71 - TLSAlertInternalError TLSAlertDescr = 80 - TLSAlertUserCanceled TLSAlertDescr = 90 - TLSAlertNoRenegotiation TLSAlertDescr = 100 - TLSAlertUnsupportedExtension TLSAlertDescr = 110 - TLSAlertUnknownDescription TLSAlertDescr = 255 -) - -// TLS Alert -// 0 1 2 3 4 5 6 7 8 -// +--+--+--+--+--+--+--+--+ -// | Level | -// +--+--+--+--+--+--+--+--+ -// | Description | -// +--+--+--+--+--+--+--+--+ - -// TLSAlertRecord contains all the information that each Alert Record type should have -type TLSAlertRecord struct { - TLSRecordHeader - - Level TLSAlertLevel - Description TLSAlertDescr - - EncryptedMsg []byte -} - -// DecodeFromBytes decodes the slice into the TLS struct. -func (t *TLSAlertRecord) decodeFromBytes(h TLSRecordHeader, data []byte, df gopacket.DecodeFeedback) error { - // TLS Record Header - t.ContentType = h.ContentType - t.Version = h.Version - t.Length = h.Length - - if len(data) < 2 { - df.SetTruncated() - return errors.New("TLS Alert packet too short") - } - - if t.Length == 2 { - t.Level = TLSAlertLevel(data[0]) - t.Description = TLSAlertDescr(data[1]) - } else { - t.Level = TLSAlertUnknownLevel - t.Description = TLSAlertUnknownDescription - t.EncryptedMsg = data - } - - return nil -} - -// Strings shows the TLS alert level nicely formatted -func (al TLSAlertLevel) String() string { - switch al { - default: - return fmt.Sprintf("Unknown(%d)", al) - case TLSAlertWarning: - return "Warning" - case TLSAlertFatal: - return "Fatal" - } -} - -// Strings shows the TLS alert description nicely formatted -func (ad TLSAlertDescr) String() string { - switch ad { - default: - return "Unknown" - case TLSAlertCloseNotify: - return "close_notify" - case TLSAlertUnexpectedMessage: - return "unexpected_message" - case TLSAlertBadRecordMac: - return "bad_record_mac" - case TLSAlertDecryptionFailedRESERVED: - return "decryption_failed_RESERVED" - case TLSAlertRecordOverflow: - return "record_overflow" - case TLSAlertDecompressionFailure: - return "decompression_failure" - case TLSAlertHandshakeFailure: - return "handshake_failure" - case TLSAlertNoCertificateRESERVED: - return "no_certificate_RESERVED" - case TLSAlertBadCertificate: - return "bad_certificate" - case TLSAlertUnsupportedCertificate: - return "unsupported_certificate" - case TLSAlertCertificateRevoked: - return "certificate_revoked" - case TLSAlertCertificateExpired: - return "certificate_expired" - case TLSAlertCertificateUnknown: - return "certificate_unknown" - case TLSAlertIllegalParameter: - return "illegal_parameter" - case TLSAlertUnknownCa: - return "unknown_ca" - case TLSAlertAccessDenied: - return "access_denied" - case TLSAlertDecodeError: - return "decode_error" - case TLSAlertDecryptError: - return "decrypt_error" - case TLSAlertExportRestrictionRESERVED: - return "export_restriction_RESERVED" - case TLSAlertProtocolVersion: - return "protocol_version" - case TLSAlertInsufficientSecurity: - return "insufficient_security" - case TLSAlertInternalError: - return "internal_error" - case TLSAlertUserCanceled: - return "user_canceled" - case TLSAlertNoRenegotiation: - return "no_renegotiation" - case TLSAlertUnsupportedExtension: - return "unsupported_extension" - } -} diff --git a/vendor/github.com/google/gopacket/layers/tls_appdata.go b/vendor/github.com/google/gopacket/layers/tls_appdata.go deleted file mode 100644 index dedd1d587..000000000 --- a/vendor/github.com/google/gopacket/layers/tls_appdata.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2018 The GoPacket Authors. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "errors" - - "github.com/google/gopacket" -) - -// TLSAppDataRecord contains all the information that each AppData Record types should have -type TLSAppDataRecord struct { - TLSRecordHeader - Payload []byte -} - -// DecodeFromBytes decodes the slice into the TLS struct. -func (t *TLSAppDataRecord) decodeFromBytes(h TLSRecordHeader, data []byte, df gopacket.DecodeFeedback) error { - // TLS Record Header - t.ContentType = h.ContentType - t.Version = h.Version - t.Length = h.Length - - if len(data) != int(t.Length) { - return errors.New("TLS Application Data length mismatch") - } - - t.Payload = data - return nil -} diff --git a/vendor/github.com/google/gopacket/layers/tls_cipherspec.go b/vendor/github.com/google/gopacket/layers/tls_cipherspec.go deleted file mode 100644 index 8f3dc62ba..000000000 --- a/vendor/github.com/google/gopacket/layers/tls_cipherspec.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2018 The GoPacket Authors. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "errors" - - "github.com/google/gopacket" -) - -// TLSchangeCipherSpec defines the message value inside ChangeCipherSpec Record -type TLSchangeCipherSpec uint8 - -const ( - TLSChangecipherspecMessage TLSchangeCipherSpec = 1 - TLSChangecipherspecUnknown TLSchangeCipherSpec = 255 -) - -// TLS Change Cipher Spec -// 0 1 2 3 4 5 6 7 8 -// +--+--+--+--+--+--+--+--+ -// | Message | -// +--+--+--+--+--+--+--+--+ - -// TLSChangeCipherSpecRecord defines the type of data inside ChangeCipherSpec Record -type TLSChangeCipherSpecRecord struct { - TLSRecordHeader - - Message TLSchangeCipherSpec -} - -// DecodeFromBytes decodes the slice into the TLS struct. -func (t *TLSChangeCipherSpecRecord) decodeFromBytes(h TLSRecordHeader, data []byte, df gopacket.DecodeFeedback) error { - // TLS Record Header - t.ContentType = h.ContentType - t.Version = h.Version - t.Length = h.Length - - if len(data) != 1 { - df.SetTruncated() - return errors.New("TLS Change Cipher Spec record incorrect length") - } - - t.Message = TLSchangeCipherSpec(data[0]) - if t.Message != TLSChangecipherspecMessage { - t.Message = TLSChangecipherspecUnknown - } - - return nil -} - -// String shows the message value nicely formatted -func (ccs TLSchangeCipherSpec) String() string { - switch ccs { - default: - return "Unknown" - case TLSChangecipherspecMessage: - return "Change Cipher Spec Message" - } -} diff --git a/vendor/github.com/google/gopacket/layers/tls_handshake.go b/vendor/github.com/google/gopacket/layers/tls_handshake.go deleted file mode 100644 index e45e2c7cb..000000000 --- a/vendor/github.com/google/gopacket/layers/tls_handshake.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2018 The GoPacket Authors. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "github.com/google/gopacket" -) - -// TLSHandshakeRecord defines the structure of a Handshare Record -type TLSHandshakeRecord struct { - TLSRecordHeader -} - -// DecodeFromBytes decodes the slice into the TLS struct. -func (t *TLSHandshakeRecord) decodeFromBytes(h TLSRecordHeader, data []byte, df gopacket.DecodeFeedback) error { - // TLS Record Header - t.ContentType = h.ContentType - t.Version = h.Version - t.Length = h.Length - - // TODO - - return nil -} diff --git a/vendor/github.com/google/gopacket/layers/udp.go b/vendor/github.com/google/gopacket/layers/udp.go deleted file mode 100644 index 97e81c69f..000000000 --- a/vendor/github.com/google/gopacket/layers/udp.go +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// Copyright 2009-2011 Andreas Krennmair. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "fmt" - - "github.com/google/gopacket" -) - -// UDP is the layer for UDP headers. -type UDP struct { - BaseLayer - SrcPort, DstPort UDPPort - Length uint16 - Checksum uint16 - sPort, dPort []byte - tcpipchecksum -} - -// LayerType returns gopacket.LayerTypeUDP -func (u *UDP) LayerType() gopacket.LayerType { return LayerTypeUDP } - -func (udp *UDP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 8 { - df.SetTruncated() - return fmt.Errorf("Invalid UDP header. Length %d less than 8", len(data)) - } - udp.SrcPort = UDPPort(binary.BigEndian.Uint16(data[0:2])) - udp.sPort = data[0:2] - udp.DstPort = UDPPort(binary.BigEndian.Uint16(data[2:4])) - udp.dPort = data[2:4] - udp.Length = binary.BigEndian.Uint16(data[4:6]) - udp.Checksum = binary.BigEndian.Uint16(data[6:8]) - udp.BaseLayer = BaseLayer{Contents: data[:8]} - switch { - case udp.Length >= 8: - hlen := int(udp.Length) - if hlen > len(data) { - df.SetTruncated() - hlen = len(data) - } - udp.Payload = data[8:hlen] - case udp.Length == 0: // Jumbogram, use entire rest of data - udp.Payload = data[8:] - default: - return fmt.Errorf("UDP packet too small: %d bytes", udp.Length) - } - return nil -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (u *UDP) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - var jumbo bool - - payload := b.Bytes() - if _, ok := u.pseudoheader.(*IPv6); ok { - if len(payload)+8 > 65535 { - jumbo = true - } - } - bytes, err := b.PrependBytes(8) - if err != nil { - return err - } - binary.BigEndian.PutUint16(bytes, uint16(u.SrcPort)) - binary.BigEndian.PutUint16(bytes[2:], uint16(u.DstPort)) - if opts.FixLengths { - if jumbo { - u.Length = 0 - } else { - u.Length = uint16(len(payload)) + 8 - } - } - binary.BigEndian.PutUint16(bytes[4:], u.Length) - if opts.ComputeChecksums { - // zero out checksum bytes - bytes[6] = 0 - bytes[7] = 0 - csum, err := u.computeChecksum(b.Bytes(), IPProtocolUDP) - if err != nil { - return err - } - u.Checksum = csum - } - binary.BigEndian.PutUint16(bytes[6:], u.Checksum) - return nil -} - -func (u *UDP) CanDecode() gopacket.LayerClass { - return LayerTypeUDP -} - -// NextLayerType use the destination port to select the -// right next decoder. It tries first to decode via the -// destination port, then the source port. -func (u *UDP) NextLayerType() gopacket.LayerType { - if lt := u.DstPort.LayerType(); lt != gopacket.LayerTypePayload { - return lt - } - return u.SrcPort.LayerType() -} - -func decodeUDP(data []byte, p gopacket.PacketBuilder) error { - udp := &UDP{} - err := udp.DecodeFromBytes(data, p) - p.AddLayer(udp) - p.SetTransportLayer(udp) - if err != nil { - return err - } - return p.NextDecoder(udp.NextLayerType()) -} - -func (u *UDP) TransportFlow() gopacket.Flow { - return gopacket.NewFlow(EndpointUDPPort, u.sPort, u.dPort) -} - -// For testing only -func (u *UDP) SetInternalPortsForTesting() { - u.sPort = make([]byte, 2) - u.dPort = make([]byte, 2) - binary.BigEndian.PutUint16(u.sPort, uint16(u.SrcPort)) - binary.BigEndian.PutUint16(u.dPort, uint16(u.DstPort)) -} diff --git a/vendor/github.com/google/gopacket/layers/udplite.go b/vendor/github.com/google/gopacket/layers/udplite.go deleted file mode 100644 index 7d84c5146..000000000 --- a/vendor/github.com/google/gopacket/layers/udplite.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// Copyright 2009-2011 Andreas Krennmair. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "github.com/google/gopacket" -) - -// UDPLite is the layer for UDP-Lite headers (rfc 3828). -type UDPLite struct { - BaseLayer - SrcPort, DstPort UDPLitePort - ChecksumCoverage uint16 - Checksum uint16 - sPort, dPort []byte -} - -// LayerType returns gopacket.LayerTypeUDPLite -func (u *UDPLite) LayerType() gopacket.LayerType { return LayerTypeUDPLite } - -func decodeUDPLite(data []byte, p gopacket.PacketBuilder) error { - udp := &UDPLite{ - SrcPort: UDPLitePort(binary.BigEndian.Uint16(data[0:2])), - sPort: data[0:2], - DstPort: UDPLitePort(binary.BigEndian.Uint16(data[2:4])), - dPort: data[2:4], - ChecksumCoverage: binary.BigEndian.Uint16(data[4:6]), - Checksum: binary.BigEndian.Uint16(data[6:8]), - BaseLayer: BaseLayer{data[:8], data[8:]}, - } - p.AddLayer(udp) - p.SetTransportLayer(udp) - return p.NextDecoder(gopacket.LayerTypePayload) -} - -func (u *UDPLite) TransportFlow() gopacket.Flow { - return gopacket.NewFlow(EndpointUDPLitePort, u.sPort, u.dPort) -} diff --git a/vendor/github.com/google/gopacket/layers/usb.go b/vendor/github.com/google/gopacket/layers/usb.go deleted file mode 100644 index d611e0fd0..000000000 --- a/vendor/github.com/google/gopacket/layers/usb.go +++ /dev/null @@ -1,292 +0,0 @@ -// Copyright 2014 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - "github.com/google/gopacket" -) - -type USBEventType uint8 - -const ( - USBEventTypeSubmit USBEventType = 'S' - USBEventTypeComplete USBEventType = 'C' - USBEventTypeError USBEventType = 'E' -) - -func (a USBEventType) String() string { - switch a { - case USBEventTypeSubmit: - return "SUBMIT" - case USBEventTypeComplete: - return "COMPLETE" - case USBEventTypeError: - return "ERROR" - default: - return "Unknown event type" - } -} - -type USBRequestBlockSetupRequest uint8 - -const ( - USBRequestBlockSetupRequestGetStatus USBRequestBlockSetupRequest = 0x00 - USBRequestBlockSetupRequestClearFeature USBRequestBlockSetupRequest = 0x01 - USBRequestBlockSetupRequestSetFeature USBRequestBlockSetupRequest = 0x03 - USBRequestBlockSetupRequestSetAddress USBRequestBlockSetupRequest = 0x05 - USBRequestBlockSetupRequestGetDescriptor USBRequestBlockSetupRequest = 0x06 - USBRequestBlockSetupRequestSetDescriptor USBRequestBlockSetupRequest = 0x07 - USBRequestBlockSetupRequestGetConfiguration USBRequestBlockSetupRequest = 0x08 - USBRequestBlockSetupRequestSetConfiguration USBRequestBlockSetupRequest = 0x09 - USBRequestBlockSetupRequestSetIdle USBRequestBlockSetupRequest = 0x0a -) - -func (a USBRequestBlockSetupRequest) String() string { - switch a { - case USBRequestBlockSetupRequestGetStatus: - return "GET_STATUS" - case USBRequestBlockSetupRequestClearFeature: - return "CLEAR_FEATURE" - case USBRequestBlockSetupRequestSetFeature: - return "SET_FEATURE" - case USBRequestBlockSetupRequestSetAddress: - return "SET_ADDRESS" - case USBRequestBlockSetupRequestGetDescriptor: - return "GET_DESCRIPTOR" - case USBRequestBlockSetupRequestSetDescriptor: - return "SET_DESCRIPTOR" - case USBRequestBlockSetupRequestGetConfiguration: - return "GET_CONFIGURATION" - case USBRequestBlockSetupRequestSetConfiguration: - return "SET_CONFIGURATION" - case USBRequestBlockSetupRequestSetIdle: - return "SET_IDLE" - default: - return "UNKNOWN" - } -} - -type USBTransportType uint8 - -const ( - USBTransportTypeTransferIn USBTransportType = 0x80 // Indicates send or receive - USBTransportTypeIsochronous USBTransportType = 0x00 // Isochronous transfers occur continuously and periodically. They typically contain time sensitive information, such as an audio or video stream. - USBTransportTypeInterrupt USBTransportType = 0x01 // Interrupt transfers are typically non-periodic, small device "initiated" communication requiring bounded latency, such as pointing devices or keyboards. - USBTransportTypeControl USBTransportType = 0x02 // Control transfers are typically used for command and status operations. - USBTransportTypeBulk USBTransportType = 0x03 // Bulk transfers can be used for large bursty data, using all remaining available bandwidth, no guarantees on bandwidth or latency, such as file transfers. -) - -type USBDirectionType uint8 - -const ( - USBDirectionTypeUnknown USBDirectionType = iota - USBDirectionTypeIn - USBDirectionTypeOut -) - -func (a USBDirectionType) String() string { - switch a { - case USBDirectionTypeIn: - return "In" - case USBDirectionTypeOut: - return "Out" - default: - return "Unknown direction type" - } -} - -// The reference at http://www.beyondlogic.org/usbnutshell/usb1.shtml contains more information about the protocol. -type USB struct { - BaseLayer - ID uint64 - EventType USBEventType - TransferType USBTransportType - Direction USBDirectionType - EndpointNumber uint8 - DeviceAddress uint8 - BusID uint16 - TimestampSec int64 - TimestampUsec int32 - Setup bool - Data bool - Status int32 - UrbLength uint32 - UrbDataLength uint32 - - UrbInterval uint32 - UrbStartFrame uint32 - UrbCopyOfTransferFlags uint32 - IsoNumDesc uint32 -} - -func (u *USB) LayerType() gopacket.LayerType { return LayerTypeUSB } - -func (m *USB) NextLayerType() gopacket.LayerType { - if m.Setup { - return LayerTypeUSBRequestBlockSetup - } else if m.Data { - } - - return m.TransferType.LayerType() -} - -func decodeUSB(data []byte, p gopacket.PacketBuilder) error { - d := &USB{} - - return decodingLayerDecoder(d, data, p) -} - -func (m *USB) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 40 { - df.SetTruncated() - return errors.New("USB < 40 bytes") - } - m.ID = binary.LittleEndian.Uint64(data[0:8]) - m.EventType = USBEventType(data[8]) - m.TransferType = USBTransportType(data[9]) - - m.EndpointNumber = data[10] & 0x7f - if data[10]&uint8(USBTransportTypeTransferIn) > 0 { - m.Direction = USBDirectionTypeIn - } else { - m.Direction = USBDirectionTypeOut - } - - m.DeviceAddress = data[11] - m.BusID = binary.LittleEndian.Uint16(data[12:14]) - - if uint(data[14]) == 0 { - m.Setup = true - } - - if uint(data[15]) == 0 { - m.Data = true - } - - m.TimestampSec = int64(binary.LittleEndian.Uint64(data[16:24])) - m.TimestampUsec = int32(binary.LittleEndian.Uint32(data[24:28])) - m.Status = int32(binary.LittleEndian.Uint32(data[28:32])) - m.UrbLength = binary.LittleEndian.Uint32(data[32:36]) - m.UrbDataLength = binary.LittleEndian.Uint32(data[36:40]) - - m.Contents = data[:40] - m.Payload = data[40:] - - if m.Setup { - m.Payload = data[40:] - } else if m.Data { - m.Payload = data[uint32(len(data))-m.UrbDataLength:] - } - - // if 64 bit, dissect_linux_usb_pseudo_header_ext - if false { - m.UrbInterval = binary.LittleEndian.Uint32(data[40:44]) - m.UrbStartFrame = binary.LittleEndian.Uint32(data[44:48]) - m.UrbDataLength = binary.LittleEndian.Uint32(data[48:52]) - m.IsoNumDesc = binary.LittleEndian.Uint32(data[52:56]) - m.Contents = data[:56] - m.Payload = data[56:] - } - - // crc5 or crc16 - // eop (end of packet) - - return nil -} - -type USBRequestBlockSetup struct { - BaseLayer - RequestType uint8 - Request USBRequestBlockSetupRequest - Value uint16 - Index uint16 - Length uint16 -} - -func (u *USBRequestBlockSetup) LayerType() gopacket.LayerType { return LayerTypeUSBRequestBlockSetup } - -func (m *USBRequestBlockSetup) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypePayload -} - -func (m *USBRequestBlockSetup) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - m.RequestType = data[0] - m.Request = USBRequestBlockSetupRequest(data[1]) - m.Value = binary.LittleEndian.Uint16(data[2:4]) - m.Index = binary.LittleEndian.Uint16(data[4:6]) - m.Length = binary.LittleEndian.Uint16(data[6:8]) - m.Contents = data[:8] - m.Payload = data[8:] - return nil -} - -func decodeUSBRequestBlockSetup(data []byte, p gopacket.PacketBuilder) error { - d := &USBRequestBlockSetup{} - return decodingLayerDecoder(d, data, p) -} - -type USBControl struct { - BaseLayer -} - -func (u *USBControl) LayerType() gopacket.LayerType { return LayerTypeUSBControl } - -func (m *USBControl) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypePayload -} - -func (m *USBControl) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - m.Contents = data - return nil -} - -func decodeUSBControl(data []byte, p gopacket.PacketBuilder) error { - d := &USBControl{} - return decodingLayerDecoder(d, data, p) -} - -type USBInterrupt struct { - BaseLayer -} - -func (u *USBInterrupt) LayerType() gopacket.LayerType { return LayerTypeUSBInterrupt } - -func (m *USBInterrupt) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypePayload -} - -func (m *USBInterrupt) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - m.Contents = data - return nil -} - -func decodeUSBInterrupt(data []byte, p gopacket.PacketBuilder) error { - d := &USBInterrupt{} - return decodingLayerDecoder(d, data, p) -} - -type USBBulk struct { - BaseLayer -} - -func (u *USBBulk) LayerType() gopacket.LayerType { return LayerTypeUSBBulk } - -func (m *USBBulk) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypePayload -} - -func (m *USBBulk) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - m.Contents = data - return nil -} - -func decodeUSBBulk(data []byte, p gopacket.PacketBuilder) error { - d := &USBBulk{} - return decodingLayerDecoder(d, data, p) -} diff --git a/vendor/github.com/google/gopacket/layers/vrrp.go b/vendor/github.com/google/gopacket/layers/vrrp.go deleted file mode 100644 index ffaafe6a7..000000000 --- a/vendor/github.com/google/gopacket/layers/vrrp.go +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright 2016 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - "net" - - "github.com/google/gopacket" -) - -/* - This layer provides decoding for Virtual Router Redundancy Protocol (VRRP) v2. - https://tools.ietf.org/html/rfc3768#section-5 - 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - |Version| Type | Virtual Rtr ID| Priority | Count IP Addrs| - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Auth Type | Adver Int | Checksum | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | IP Address (1) | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | . | - | . | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | IP Address (n) | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Authentication Data (1) | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Authentication Data (2) | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -*/ - -type VRRPv2Type uint8 -type VRRPv2AuthType uint8 - -const ( - VRRPv2Advertisement VRRPv2Type = 0x01 // router advertisement -) - -// String conversions for VRRP message types -func (v VRRPv2Type) String() string { - switch v { - case VRRPv2Advertisement: - return "VRRPv2 Advertisement" - default: - return "" - } -} - -const ( - VRRPv2AuthNoAuth VRRPv2AuthType = 0x00 // No Authentication - VRRPv2AuthReserved1 VRRPv2AuthType = 0x01 // Reserved field 1 - VRRPv2AuthReserved2 VRRPv2AuthType = 0x02 // Reserved field 2 -) - -func (v VRRPv2AuthType) String() string { - switch v { - case VRRPv2AuthNoAuth: - return "No Authentication" - case VRRPv2AuthReserved1: - return "Reserved" - case VRRPv2AuthReserved2: - return "Reserved" - default: - return "" - } -} - -// VRRPv2 represents an VRRP v2 message. -type VRRPv2 struct { - BaseLayer - Version uint8 // The version field specifies the VRRP protocol version of this packet (v2) - Type VRRPv2Type // The type field specifies the type of this VRRP packet. The only type defined in v2 is ADVERTISEMENT - VirtualRtrID uint8 // identifies the virtual router this packet is reporting status for - Priority uint8 // specifies the sending VRRP router's priority for the virtual router (100 = default) - CountIPAddr uint8 // The number of IP addresses contained in this VRRP advertisement. - AuthType VRRPv2AuthType // identifies the authentication method being utilized - AdverInt uint8 // The Advertisement interval indicates the time interval (in seconds) between ADVERTISEMENTS. The default is 1 second - Checksum uint16 // used to detect data corruption in the VRRP message. - IPAddress []net.IP // one or more IP addresses associated with the virtual router. Specified in the CountIPAddr field. -} - -// LayerType returns LayerTypeVRRP for VRRP v2 message. -func (v *VRRPv2) LayerType() gopacket.LayerType { return LayerTypeVRRP } - -func (v *VRRPv2) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - - v.BaseLayer = BaseLayer{Contents: data[:len(data)]} - v.Version = data[0] >> 4 // high nibble == VRRP version. We're expecting v2 - - v.Type = VRRPv2Type(data[0] & 0x0F) // low nibble == VRRP type. Expecting 1 (advertisement) - if v.Type != 1 { - // rfc3768: A packet with unknown type MUST be discarded. - return errors.New("Unrecognized VRRPv2 type field.") - } - - v.VirtualRtrID = data[1] - v.Priority = data[2] - - v.CountIPAddr = data[3] - if v.CountIPAddr < 1 { - return errors.New("VRRPv2 number of IP addresses is not valid.") - } - - v.AuthType = VRRPv2AuthType(data[4]) - v.AdverInt = uint8(data[5]) - v.Checksum = binary.BigEndian.Uint16(data[6:8]) - - // populate the IPAddress field. The number of addresses is specified in the v.CountIPAddr field - // offset references the starting byte containing the list of ip addresses - offset := 8 - for i := uint8(0); i < v.CountIPAddr; i++ { - v.IPAddress = append(v.IPAddress, data[offset:offset+4]) - offset += 4 - } - - // any trailing packets here may be authentication data and *should* be ignored in v2 as per RFC - // - // 5.3.10. Authentication Data - // - // The authentication string is currently only used to maintain - // backwards compatibility with RFC 2338. It SHOULD be set to zero on - // transmission and ignored on reception. - return nil -} - -// CanDecode specifies the layer type in which we are attempting to unwrap. -func (v *VRRPv2) CanDecode() gopacket.LayerClass { - return LayerTypeVRRP -} - -// NextLayerType specifies the next layer that should be decoded. VRRP does not contain any further payload, so we set to 0 -func (v *VRRPv2) NextLayerType() gopacket.LayerType { - return gopacket.LayerTypeZero -} - -// The VRRP packet does not include payload data. Setting byte slice to nil -func (v *VRRPv2) Payload() []byte { - return nil -} - -// decodeVRRP will parse VRRP v2 -func decodeVRRP(data []byte, p gopacket.PacketBuilder) error { - if len(data) < 8 { - return errors.New("Not a valid VRRP packet. Packet length is too small.") - } - v := &VRRPv2{} - return decodingLayerDecoder(v, data, p) -} diff --git a/vendor/github.com/google/gopacket/layers/vxlan.go b/vendor/github.com/google/gopacket/layers/vxlan.go deleted file mode 100644 index e479cd81f..000000000 --- a/vendor/github.com/google/gopacket/layers/vxlan.go +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright 2016 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package layers - -import ( - "encoding/binary" - "errors" - "fmt" - - "github.com/google/gopacket" -) - -// VXLAN is specifed in RFC 7348 https://tools.ietf.org/html/rfc7348 -// G, D, A, Group Policy ID from https://tools.ietf.org/html/draft-smith-vxlan-group-policy-00 -// 0 1 2 3 -// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -// 0 8 16 24 32 -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// |G|R|R|R|I|R|R|R|R|D|R|R|A|R|R|R| Group Policy ID | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | 24 bit VXLAN Network Identifier | Reserved | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - -// VXLAN is a VXLAN packet header -type VXLAN struct { - BaseLayer - ValidIDFlag bool // 'I' bit per RFC 7348 - VNI uint32 // 'VXLAN Network Identifier' 24 bits per RFC 7348 - GBPExtension bool // 'G' bit per Group Policy https://tools.ietf.org/html/draft-smith-vxlan-group-policy-00 - GBPDontLearn bool // 'D' bit per Group Policy - GBPApplied bool // 'A' bit per Group Policy - GBPGroupPolicyID uint16 // 'Group Policy ID' 16 bits per Group Policy -} - -// LayerType returns LayerTypeVXLAN -func (vx *VXLAN) LayerType() gopacket.LayerType { return LayerTypeVXLAN } - -// CanDecode returns the layer type this DecodingLayer can decode -func (vx *VXLAN) CanDecode() gopacket.LayerClass { - return LayerTypeVXLAN -} - -// NextLayerType retuns the next layer we should see after vxlan -func (vx *VXLAN) NextLayerType() gopacket.LayerType { - return LayerTypeEthernet -} - -// DecodeFromBytes takes a byte buffer and decodes -func (vx *VXLAN) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { - if len(data) < 8 { - return errors.New("vxlan packet too small") - } - // VNI is a 24bit number, Uint32 requires 32 bits - var buf [4]byte - copy(buf[1:], data[4:7]) - - // RFC 7348 https://tools.ietf.org/html/rfc7348 - vx.ValidIDFlag = data[0]&0x08 > 0 // 'I' bit per RFC7348 - vx.VNI = binary.BigEndian.Uint32(buf[:]) // VXLAN Network Identifier per RFC7348 - - // Group Based Policy https://tools.ietf.org/html/draft-smith-vxlan-group-policy-00 - vx.GBPExtension = data[0]&0x80 > 0 // 'G' bit per the group policy draft - vx.GBPDontLearn = data[1]&0x40 > 0 // 'D' bit - the egress VTEP MUST NOT learn the source address of the encapsulated frame. - vx.GBPApplied = data[1]&0x80 > 0 // 'A' bit - indicates that the group policy has already been applied to this packet. - vx.GBPGroupPolicyID = binary.BigEndian.Uint16(data[2:4]) // Policy ID as per the group policy draft - - // Layer information - const vxlanLength = 8 - vx.Contents = data[:vxlanLength] - vx.Payload = data[vxlanLength:] - - return nil - -} - -func decodeVXLAN(data []byte, p gopacket.PacketBuilder) error { - vx := &VXLAN{} - err := vx.DecodeFromBytes(data, p) - if err != nil { - return err - } - - p.AddLayer(vx) - return p.NextDecoder(LinkTypeEthernet) -} - -// SerializeTo writes the serialized form of this layer into the -// SerializationBuffer, implementing gopacket.SerializableLayer. -// See the docs for gopacket.SerializableLayer for more info. -func (vx *VXLAN) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { - bytes, err := b.PrependBytes(8) - if err != nil { - return err - } - - // PrependBytes does not guarantee that bytes are zeroed. Setting flags via OR requires that they start off at zero - bytes[0] = 0 - bytes[1] = 0 - - if vx.ValidIDFlag { - bytes[0] |= 0x08 - } - if vx.GBPExtension { - bytes[0] |= 0x80 - } - if vx.GBPDontLearn { - bytes[1] |= 0x40 - } - if vx.GBPApplied { - bytes[1] |= 0x80 - } - - binary.BigEndian.PutUint16(bytes[2:4], vx.GBPGroupPolicyID) - if vx.VNI >= 1<<24 { - return fmt.Errorf("Virtual Network Identifier = %x exceeds max for 24-bit uint", vx.VNI) - } - binary.BigEndian.PutUint32(bytes[4:8], vx.VNI<<8) - return nil -} diff --git a/vendor/github.com/google/gopacket/layers_decoder.go b/vendor/github.com/google/gopacket/layers_decoder.go deleted file mode 100644 index 8c1f108cf..000000000 --- a/vendor/github.com/google/gopacket/layers_decoder.go +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2019 The GoPacket Authors. All rights reserved. - -package gopacket - -// Created by gen.go, don't edit manually -// Generated at 2019-06-18 11:37:31.308731293 +0600 +06 m=+0.000842599 - -// LayersDecoder returns DecodingLayerFunc for specified -// DecodingLayerContainer, LayerType value to start decoding with and -// some DecodeFeedback. -func LayersDecoder(dl DecodingLayerContainer, first LayerType, df DecodeFeedback) DecodingLayerFunc { - firstDec, ok := dl.Decoder(first) - if !ok { - return func([]byte, *[]LayerType) (LayerType, error) { - return first, nil - } - } - if dlc, ok := dl.(DecodingLayerSparse); ok { - return func(data []byte, decoded *[]LayerType) (LayerType, error) { - *decoded = (*decoded)[:0] // Truncated decoded layers. - typ := first - decoder := firstDec - for { - if err := decoder.DecodeFromBytes(data, df); err != nil { - return LayerTypeZero, err - } - *decoded = append(*decoded, typ) - typ = decoder.NextLayerType() - if data = decoder.LayerPayload(); len(data) == 0 { - break - } - if decoder, ok = dlc.Decoder(typ); !ok { - return typ, nil - } - } - return LayerTypeZero, nil - } - } - if dlc, ok := dl.(DecodingLayerArray); ok { - return func(data []byte, decoded *[]LayerType) (LayerType, error) { - *decoded = (*decoded)[:0] // Truncated decoded layers. - typ := first - decoder := firstDec - for { - if err := decoder.DecodeFromBytes(data, df); err != nil { - return LayerTypeZero, err - } - *decoded = append(*decoded, typ) - typ = decoder.NextLayerType() - if data = decoder.LayerPayload(); len(data) == 0 { - break - } - if decoder, ok = dlc.Decoder(typ); !ok { - return typ, nil - } - } - return LayerTypeZero, nil - } - } - if dlc, ok := dl.(DecodingLayerMap); ok { - return func(data []byte, decoded *[]LayerType) (LayerType, error) { - *decoded = (*decoded)[:0] // Truncated decoded layers. - typ := first - decoder := firstDec - for { - if err := decoder.DecodeFromBytes(data, df); err != nil { - return LayerTypeZero, err - } - *decoded = append(*decoded, typ) - typ = decoder.NextLayerType() - if data = decoder.LayerPayload(); len(data) == 0 { - break - } - if decoder, ok = dlc.Decoder(typ); !ok { - return typ, nil - } - } - return LayerTypeZero, nil - } - } - dlc := dl - return func(data []byte, decoded *[]LayerType) (LayerType, error) { - *decoded = (*decoded)[:0] // Truncated decoded layers. - typ := first - decoder := firstDec - for { - if err := decoder.DecodeFromBytes(data, df); err != nil { - return LayerTypeZero, err - } - *decoded = append(*decoded, typ) - typ = decoder.NextLayerType() - if data = decoder.LayerPayload(); len(data) == 0 { - break - } - if decoder, ok = dlc.Decoder(typ); !ok { - return typ, nil - } - } - return LayerTypeZero, nil - } -} diff --git a/vendor/github.com/google/gopacket/layertype.go b/vendor/github.com/google/gopacket/layertype.go deleted file mode 100644 index 3abfee1e9..000000000 --- a/vendor/github.com/google/gopacket/layertype.go +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package gopacket - -import ( - "fmt" - "strconv" -) - -// LayerType is a unique identifier for each type of layer. This enumeration -// does not match with any externally available numbering scheme... it's solely -// usable/useful within this library as a means for requesting layer types -// (see Packet.Layer) and determining which types of layers have been decoded. -// -// New LayerTypes may be created by calling gopacket.RegisterLayerType. -type LayerType int64 - -// LayerTypeMetadata contains metadata associated with each LayerType. -type LayerTypeMetadata struct { - // Name is the string returned by each layer type's String method. - Name string - // Decoder is the decoder to use when the layer type is passed in as a - // Decoder. - Decoder Decoder -} - -type layerTypeMetadata struct { - inUse bool - LayerTypeMetadata -} - -// DecodersByLayerName maps layer names to decoders for those layers. -// This allows users to specify decoders by name to a program and have that -// program pick the correct decoder accordingly. -var DecodersByLayerName = map[string]Decoder{} - -const maxLayerType = 2000 - -var ltMeta [maxLayerType]layerTypeMetadata -var ltMetaMap = map[LayerType]layerTypeMetadata{} - -// RegisterLayerType creates a new layer type and registers it globally. -// The number passed in must be unique, or a runtime panic will occur. Numbers -// 0-999 are reserved for the gopacket library. Numbers 1000-1999 should be -// used for common application-specific types, and are very fast. Any other -// number (negative or >= 2000) may be used for uncommon application-specific -// types, and are somewhat slower (they require a map lookup over an array -// index). -func RegisterLayerType(num int, meta LayerTypeMetadata) LayerType { - if 0 <= num && num < maxLayerType { - if ltMeta[num].inUse { - panic("Layer type already exists") - } - } else { - if ltMetaMap[LayerType(num)].inUse { - panic("Layer type already exists") - } - } - return OverrideLayerType(num, meta) -} - -// OverrideLayerType acts like RegisterLayerType, except that if the layer type -// has already been registered, it overrides the metadata with the passed-in -// metadata intead of panicing. -func OverrideLayerType(num int, meta LayerTypeMetadata) LayerType { - if 0 <= num && num < maxLayerType { - ltMeta[num] = layerTypeMetadata{ - inUse: true, - LayerTypeMetadata: meta, - } - } else { - ltMetaMap[LayerType(num)] = layerTypeMetadata{ - inUse: true, - LayerTypeMetadata: meta, - } - } - DecodersByLayerName[meta.Name] = meta.Decoder - return LayerType(num) -} - -// Decode decodes the given data using the decoder registered with the layer -// type. -func (t LayerType) Decode(data []byte, c PacketBuilder) error { - var d Decoder - if 0 <= int(t) && int(t) < maxLayerType { - d = ltMeta[int(t)].Decoder - } else { - d = ltMetaMap[t].Decoder - } - if d != nil { - return d.Decode(data, c) - } - return fmt.Errorf("Layer type %v has no associated decoder", t) -} - -// String returns the string associated with this layer type. -func (t LayerType) String() (s string) { - if 0 <= int(t) && int(t) < maxLayerType { - s = ltMeta[int(t)].Name - } else { - s = ltMetaMap[t].Name - } - if s == "" { - s = strconv.Itoa(int(t)) - } - return -} diff --git a/vendor/github.com/google/gopacket/packet.go b/vendor/github.com/google/gopacket/packet.go deleted file mode 100644 index 3a7c4b3d8..000000000 --- a/vendor/github.com/google/gopacket/packet.go +++ /dev/null @@ -1,864 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package gopacket - -import ( - "bytes" - "encoding/hex" - "errors" - "fmt" - "io" - "net" - "os" - "reflect" - "runtime/debug" - "strings" - "syscall" - "time" -) - -// CaptureInfo provides standardized information about a packet captured off -// the wire or read from a file. -type CaptureInfo struct { - // Timestamp is the time the packet was captured, if that is known. - Timestamp time.Time - // CaptureLength is the total number of bytes read off of the wire. - CaptureLength int - // Length is the size of the original packet. Should always be >= - // CaptureLength. - Length int - // InterfaceIndex - InterfaceIndex int - // The packet source can place ancillary data of various types here. - // For example, the afpacket source can report the VLAN of captured - // packets this way. - AncillaryData []interface{} -} - -// PacketMetadata contains metadata for a packet. -type PacketMetadata struct { - CaptureInfo - // Truncated is true if packet decoding logic detects that there are fewer - // bytes in the packet than are detailed in various headers (for example, if - // the number of bytes in the IPv4 contents/payload is less than IPv4.Length). - // This is also set automatically for packets captured off the wire if - // CaptureInfo.CaptureLength < CaptureInfo.Length. - Truncated bool -} - -// Packet is the primary object used by gopacket. Packets are created by a -// Decoder's Decode call. A packet is made up of a set of Data, which -// is broken into a number of Layers as it is decoded. -type Packet interface { - //// Functions for outputting the packet as a human-readable string: - //// ------------------------------------------------------------------ - // String returns a human-readable string representation of the packet. - // It uses LayerString on each layer to output the layer. - String() string - // Dump returns a verbose human-readable string representation of the packet, - // including a hex dump of all layers. It uses LayerDump on each layer to - // output the layer. - Dump() string - - //// Functions for accessing arbitrary packet layers: - //// ------------------------------------------------------------------ - // Layers returns all layers in this packet, computing them as necessary - Layers() []Layer - // Layer returns the first layer in this packet of the given type, or nil - Layer(LayerType) Layer - // LayerClass returns the first layer in this packet of the given class, - // or nil. - LayerClass(LayerClass) Layer - - //// Functions for accessing specific types of packet layers. These functions - //// return the first layer of each type found within the packet. - //// ------------------------------------------------------------------ - // LinkLayer returns the first link layer in the packet - LinkLayer() LinkLayer - // NetworkLayer returns the first network layer in the packet - NetworkLayer() NetworkLayer - // TransportLayer returns the first transport layer in the packet - TransportLayer() TransportLayer - // ApplicationLayer returns the first application layer in the packet - ApplicationLayer() ApplicationLayer - // ErrorLayer is particularly useful, since it returns nil if the packet - // was fully decoded successfully, and non-nil if an error was encountered - // in decoding and the packet was only partially decoded. Thus, its output - // can be used to determine if the entire packet was able to be decoded. - ErrorLayer() ErrorLayer - - //// Functions for accessing data specific to the packet: - //// ------------------------------------------------------------------ - // Data returns the set of bytes that make up this entire packet. - Data() []byte - // Metadata returns packet metadata associated with this packet. - Metadata() *PacketMetadata -} - -// packet contains all the information we need to fulfill the Packet interface, -// and its two "subclasses" (yes, no such thing in Go, bear with me), -// eagerPacket and lazyPacket, provide eager and lazy decoding logic around the -// various functions needed to access this information. -type packet struct { - // data contains the entire packet data for a packet - data []byte - // initialLayers is space for an initial set of layers already created inside - // the packet. - initialLayers [6]Layer - // layers contains each layer we've already decoded - layers []Layer - // last is the last layer added to the packet - last Layer - // metadata is the PacketMetadata for this packet - metadata PacketMetadata - - decodeOptions DecodeOptions - - // Pointers to the various important layers - link LinkLayer - network NetworkLayer - transport TransportLayer - application ApplicationLayer - failure ErrorLayer -} - -func (p *packet) SetTruncated() { - p.metadata.Truncated = true -} - -func (p *packet) SetLinkLayer(l LinkLayer) { - if p.link == nil { - p.link = l - } -} - -func (p *packet) SetNetworkLayer(l NetworkLayer) { - if p.network == nil { - p.network = l - } -} - -func (p *packet) SetTransportLayer(l TransportLayer) { - if p.transport == nil { - p.transport = l - } -} - -func (p *packet) SetApplicationLayer(l ApplicationLayer) { - if p.application == nil { - p.application = l - } -} - -func (p *packet) SetErrorLayer(l ErrorLayer) { - if p.failure == nil { - p.failure = l - } -} - -func (p *packet) AddLayer(l Layer) { - p.layers = append(p.layers, l) - p.last = l -} - -func (p *packet) DumpPacketData() { - fmt.Fprint(os.Stderr, p.packetDump()) - os.Stderr.Sync() -} - -func (p *packet) Metadata() *PacketMetadata { - return &p.metadata -} - -func (p *packet) Data() []byte { - return p.data -} - -func (p *packet) DecodeOptions() *DecodeOptions { - return &p.decodeOptions -} - -func (p *packet) addFinalDecodeError(err error, stack []byte) { - fail := &DecodeFailure{err: err, stack: stack} - if p.last == nil { - fail.data = p.data - } else { - fail.data = p.last.LayerPayload() - } - p.AddLayer(fail) - p.SetErrorLayer(fail) -} - -func (p *packet) recoverDecodeError() { - if !p.decodeOptions.SkipDecodeRecovery { - if r := recover(); r != nil { - p.addFinalDecodeError(fmt.Errorf("%v", r), debug.Stack()) - } - } -} - -// LayerString outputs an individual layer as a string. The layer is output -// in a single line, with no trailing newline. This function is specifically -// designed to do the right thing for most layers... it follows the following -// rules: -// * If the Layer has a String function, just output that. -// * Otherwise, output all exported fields in the layer, recursing into -// exported slices and structs. -// NOTE: This is NOT THE SAME AS fmt's "%#v". %#v will output both exported -// and unexported fields... many times packet layers contain unexported stuff -// that would just mess up the output of the layer, see for example the -// Payload layer and it's internal 'data' field, which contains a large byte -// array that would really mess up formatting. -func LayerString(l Layer) string { - return fmt.Sprintf("%v\t%s", l.LayerType(), layerString(reflect.ValueOf(l), false, false)) -} - -// Dumper dumps verbose information on a value. If a layer type implements -// Dumper, then its LayerDump() string will include the results in its output. -type Dumper interface { - Dump() string -} - -// LayerDump outputs a very verbose string representation of a layer. Its -// output is a concatenation of LayerString(l) and hex.Dump(l.LayerContents()). -// It contains newlines and ends with a newline. -func LayerDump(l Layer) string { - var b bytes.Buffer - b.WriteString(LayerString(l)) - b.WriteByte('\n') - if d, ok := l.(Dumper); ok { - dump := d.Dump() - if dump != "" { - b.WriteString(dump) - if dump[len(dump)-1] != '\n' { - b.WriteByte('\n') - } - } - } - b.WriteString(hex.Dump(l.LayerContents())) - return b.String() -} - -// layerString outputs, recursively, a layer in a "smart" way. See docs for -// LayerString for more details. -// -// Params: -// i - value to write out -// anonymous: if we're currently recursing an anonymous member of a struct -// writeSpace: if we've already written a value in a struct, and need to -// write a space before writing more. This happens when we write various -// anonymous values, and need to keep writing more. -func layerString(v reflect.Value, anonymous bool, writeSpace bool) string { - // Let String() functions take precedence. - if v.CanInterface() { - if s, ok := v.Interface().(fmt.Stringer); ok { - return s.String() - } - } - // Reflect, and spit out all the exported fields as key=value. - switch v.Type().Kind() { - case reflect.Interface, reflect.Ptr: - if v.IsNil() { - return "nil" - } - r := v.Elem() - return layerString(r, anonymous, writeSpace) - case reflect.Struct: - var b bytes.Buffer - typ := v.Type() - if !anonymous { - b.WriteByte('{') - } - for i := 0; i < v.NumField(); i++ { - // Check if this is upper-case. - ftype := typ.Field(i) - f := v.Field(i) - if ftype.Anonymous { - anonStr := layerString(f, true, writeSpace) - writeSpace = writeSpace || anonStr != "" - b.WriteString(anonStr) - } else if ftype.PkgPath == "" { // exported - if writeSpace { - b.WriteByte(' ') - } - writeSpace = true - fmt.Fprintf(&b, "%s=%s", typ.Field(i).Name, layerString(f, false, writeSpace)) - } - } - if !anonymous { - b.WriteByte('}') - } - return b.String() - case reflect.Slice: - var b bytes.Buffer - b.WriteByte('[') - if v.Len() > 4 { - fmt.Fprintf(&b, "..%d..", v.Len()) - } else { - for j := 0; j < v.Len(); j++ { - if j != 0 { - b.WriteString(", ") - } - b.WriteString(layerString(v.Index(j), false, false)) - } - } - b.WriteByte(']') - return b.String() - } - return fmt.Sprintf("%v", v.Interface()) -} - -const ( - longBytesLength = 128 -) - -// LongBytesGoString returns a string representation of the byte slice shortened -// using the format '{ ... ( bytes)}' if it -// exceeds a predetermined length. Can be used to avoid filling the display with -// very long byte strings. -func LongBytesGoString(buf []byte) string { - if len(buf) < longBytesLength { - return fmt.Sprintf("%#v", buf) - } - s := fmt.Sprintf("%#v", buf[:longBytesLength-1]) - s = strings.TrimSuffix(s, "}") - return fmt.Sprintf("%s ... (%d bytes)}", s, len(buf)) -} - -func baseLayerString(value reflect.Value) string { - t := value.Type() - content := value.Field(0) - c := make([]byte, content.Len()) - for i := range c { - c[i] = byte(content.Index(i).Uint()) - } - payload := value.Field(1) - p := make([]byte, payload.Len()) - for i := range p { - p[i] = byte(payload.Index(i).Uint()) - } - return fmt.Sprintf("%s{Contents:%s, Payload:%s}", t.String(), - LongBytesGoString(c), - LongBytesGoString(p)) -} - -func layerGoString(i interface{}, b *bytes.Buffer) { - if s, ok := i.(fmt.GoStringer); ok { - b.WriteString(s.GoString()) - return - } - - var v reflect.Value - var ok bool - if v, ok = i.(reflect.Value); !ok { - v = reflect.ValueOf(i) - } - switch v.Kind() { - case reflect.Ptr, reflect.Interface: - if v.Kind() == reflect.Ptr { - b.WriteByte('&') - } - layerGoString(v.Elem().Interface(), b) - case reflect.Struct: - t := v.Type() - b.WriteString(t.String()) - b.WriteByte('{') - for i := 0; i < v.NumField(); i++ { - if i > 0 { - b.WriteString(", ") - } - if t.Field(i).Name == "BaseLayer" { - fmt.Fprintf(b, "BaseLayer:%s", baseLayerString(v.Field(i))) - } else if v.Field(i).Kind() == reflect.Struct { - fmt.Fprintf(b, "%s:", t.Field(i).Name) - layerGoString(v.Field(i), b) - } else if v.Field(i).Kind() == reflect.Ptr { - b.WriteByte('&') - layerGoString(v.Field(i), b) - } else { - fmt.Fprintf(b, "%s:%#v", t.Field(i).Name, v.Field(i)) - } - } - b.WriteByte('}') - default: - fmt.Fprintf(b, "%#v", i) - } -} - -// LayerGoString returns a representation of the layer in Go syntax, -// taking care to shorten "very long" BaseLayer byte slices -func LayerGoString(l Layer) string { - b := new(bytes.Buffer) - layerGoString(l, b) - return b.String() -} - -func (p *packet) packetString() string { - var b bytes.Buffer - fmt.Fprintf(&b, "PACKET: %d bytes", len(p.Data())) - if p.metadata.Truncated { - b.WriteString(", truncated") - } - if p.metadata.Length > 0 { - fmt.Fprintf(&b, ", wire length %d cap length %d", p.metadata.Length, p.metadata.CaptureLength) - } - if !p.metadata.Timestamp.IsZero() { - fmt.Fprintf(&b, " @ %v", p.metadata.Timestamp) - } - b.WriteByte('\n') - for i, l := range p.layers { - fmt.Fprintf(&b, "- Layer %d (%02d bytes) = %s\n", i+1, len(l.LayerContents()), LayerString(l)) - } - return b.String() -} - -func (p *packet) packetDump() string { - var b bytes.Buffer - fmt.Fprintf(&b, "-- FULL PACKET DATA (%d bytes) ------------------------------------\n%s", len(p.data), hex.Dump(p.data)) - for i, l := range p.layers { - fmt.Fprintf(&b, "--- Layer %d ---\n%s", i+1, LayerDump(l)) - } - return b.String() -} - -// eagerPacket is a packet implementation that does eager decoding. Upon -// initial construction, it decodes all the layers it can from packet data. -// eagerPacket implements Packet and PacketBuilder. -type eagerPacket struct { - packet -} - -var errNilDecoder = errors.New("NextDecoder passed nil decoder, probably an unsupported decode type") - -func (p *eagerPacket) NextDecoder(next Decoder) error { - if next == nil { - return errNilDecoder - } - if p.last == nil { - return errors.New("NextDecoder called, but no layers added yet") - } - d := p.last.LayerPayload() - if len(d) == 0 { - return nil - } - // Since we're eager, immediately call the next decoder. - return next.Decode(d, p) -} -func (p *eagerPacket) initialDecode(dec Decoder) { - defer p.recoverDecodeError() - err := dec.Decode(p.data, p) - if err != nil { - p.addFinalDecodeError(err, nil) - } -} -func (p *eagerPacket) LinkLayer() LinkLayer { - return p.link -} -func (p *eagerPacket) NetworkLayer() NetworkLayer { - return p.network -} -func (p *eagerPacket) TransportLayer() TransportLayer { - return p.transport -} -func (p *eagerPacket) ApplicationLayer() ApplicationLayer { - return p.application -} -func (p *eagerPacket) ErrorLayer() ErrorLayer { - return p.failure -} -func (p *eagerPacket) Layers() []Layer { - return p.layers -} -func (p *eagerPacket) Layer(t LayerType) Layer { - for _, l := range p.layers { - if l.LayerType() == t { - return l - } - } - return nil -} -func (p *eagerPacket) LayerClass(lc LayerClass) Layer { - for _, l := range p.layers { - if lc.Contains(l.LayerType()) { - return l - } - } - return nil -} -func (p *eagerPacket) String() string { return p.packetString() } -func (p *eagerPacket) Dump() string { return p.packetDump() } - -// lazyPacket does lazy decoding on its packet data. On construction it does -// no initial decoding. For each function call, it decodes only as many layers -// as are necessary to compute the return value for that function. -// lazyPacket implements Packet and PacketBuilder. -type lazyPacket struct { - packet - next Decoder -} - -func (p *lazyPacket) NextDecoder(next Decoder) error { - if next == nil { - return errNilDecoder - } - p.next = next - return nil -} -func (p *lazyPacket) decodeNextLayer() { - if p.next == nil { - return - } - d := p.data - if p.last != nil { - d = p.last.LayerPayload() - } - next := p.next - p.next = nil - // We've just set p.next to nil, so if we see we have no data, this should be - // the final call we get to decodeNextLayer if we return here. - if len(d) == 0 { - return - } - defer p.recoverDecodeError() - err := next.Decode(d, p) - if err != nil { - p.addFinalDecodeError(err, nil) - } -} -func (p *lazyPacket) LinkLayer() LinkLayer { - for p.link == nil && p.next != nil { - p.decodeNextLayer() - } - return p.link -} -func (p *lazyPacket) NetworkLayer() NetworkLayer { - for p.network == nil && p.next != nil { - p.decodeNextLayer() - } - return p.network -} -func (p *lazyPacket) TransportLayer() TransportLayer { - for p.transport == nil && p.next != nil { - p.decodeNextLayer() - } - return p.transport -} -func (p *lazyPacket) ApplicationLayer() ApplicationLayer { - for p.application == nil && p.next != nil { - p.decodeNextLayer() - } - return p.application -} -func (p *lazyPacket) ErrorLayer() ErrorLayer { - for p.failure == nil && p.next != nil { - p.decodeNextLayer() - } - return p.failure -} -func (p *lazyPacket) Layers() []Layer { - for p.next != nil { - p.decodeNextLayer() - } - return p.layers -} -func (p *lazyPacket) Layer(t LayerType) Layer { - for _, l := range p.layers { - if l.LayerType() == t { - return l - } - } - numLayers := len(p.layers) - for p.next != nil { - p.decodeNextLayer() - for _, l := range p.layers[numLayers:] { - if l.LayerType() == t { - return l - } - } - numLayers = len(p.layers) - } - return nil -} -func (p *lazyPacket) LayerClass(lc LayerClass) Layer { - for _, l := range p.layers { - if lc.Contains(l.LayerType()) { - return l - } - } - numLayers := len(p.layers) - for p.next != nil { - p.decodeNextLayer() - for _, l := range p.layers[numLayers:] { - if lc.Contains(l.LayerType()) { - return l - } - } - numLayers = len(p.layers) - } - return nil -} -func (p *lazyPacket) String() string { p.Layers(); return p.packetString() } -func (p *lazyPacket) Dump() string { p.Layers(); return p.packetDump() } - -// DecodeOptions tells gopacket how to decode a packet. -type DecodeOptions struct { - // Lazy decoding decodes the minimum number of layers needed to return data - // for a packet at each function call. Be careful using this with concurrent - // packet processors, as each call to packet.* could mutate the packet, and - // two concurrent function calls could interact poorly. - Lazy bool - // NoCopy decoding doesn't copy its input buffer into storage that's owned by - // the packet. If you can guarantee that the bytes underlying the slice - // passed into NewPacket aren't going to be modified, this can be faster. If - // there's any chance that those bytes WILL be changed, this will invalidate - // your packets. - NoCopy bool - // SkipDecodeRecovery skips over panic recovery during packet decoding. - // Normally, when packets decode, if a panic occurs, that panic is captured - // by a recover(), and a DecodeFailure layer is added to the packet detailing - // the issue. If this flag is set, panics are instead allowed to continue up - // the stack. - SkipDecodeRecovery bool - // DecodeStreamsAsDatagrams enables routing of application-level layers in the TCP - // decoder. If true, we should try to decode layers after TCP in single packets. - // This is disabled by default because the reassembly package drives the decoding - // of TCP payload data after reassembly. - DecodeStreamsAsDatagrams bool -} - -// Default decoding provides the safest (but slowest) method for decoding -// packets. It eagerly processes all layers (so it's concurrency-safe) and it -// copies its input buffer upon creation of the packet (so the packet remains -// valid if the underlying slice is modified. Both of these take time, -// though, so beware. If you can guarantee that the packet will only be used -// by one goroutine at a time, set Lazy decoding. If you can guarantee that -// the underlying slice won't change, set NoCopy decoding. -var Default = DecodeOptions{} - -// Lazy is a DecodeOptions with just Lazy set. -var Lazy = DecodeOptions{Lazy: true} - -// NoCopy is a DecodeOptions with just NoCopy set. -var NoCopy = DecodeOptions{NoCopy: true} - -// DecodeStreamsAsDatagrams is a DecodeOptions with just DecodeStreamsAsDatagrams set. -var DecodeStreamsAsDatagrams = DecodeOptions{DecodeStreamsAsDatagrams: true} - -// NewPacket creates a new Packet object from a set of bytes. The -// firstLayerDecoder tells it how to interpret the first layer from the bytes, -// future layers will be generated from that first layer automatically. -func NewPacket(data []byte, firstLayerDecoder Decoder, options DecodeOptions) Packet { - if !options.NoCopy { - dataCopy := make([]byte, len(data)) - copy(dataCopy, data) - data = dataCopy - } - if options.Lazy { - p := &lazyPacket{ - packet: packet{data: data, decodeOptions: options}, - next: firstLayerDecoder, - } - p.layers = p.initialLayers[:0] - // Crazy craziness: - // If the following return statemet is REMOVED, and Lazy is FALSE, then - // eager packet processing becomes 17% FASTER. No, there is no logical - // explanation for this. However, it's such a hacky micro-optimization that - // we really can't rely on it. It appears to have to do with the size the - // compiler guesses for this function's stack space, since one symptom is - // that with the return statement in place, we more than double calls to - // runtime.morestack/runtime.lessstack. We'll hope the compiler gets better - // over time and we get this optimization for free. Until then, we'll have - // to live with slower packet processing. - return p - } - p := &eagerPacket{ - packet: packet{data: data, decodeOptions: options}, - } - p.layers = p.initialLayers[:0] - p.initialDecode(firstLayerDecoder) - return p -} - -// PacketDataSource is an interface for some source of packet data. Users may -// create their own implementations, or use the existing implementations in -// gopacket/pcap (libpcap, allows reading from live interfaces or from -// pcap files) or gopacket/pfring (PF_RING, allows reading from live -// interfaces). -type PacketDataSource interface { - // ReadPacketData returns the next packet available from this data source. - // It returns: - // data: The bytes of an individual packet. - // ci: Metadata about the capture - // err: An error encountered while reading packet data. If err != nil, - // then data/ci will be ignored. - ReadPacketData() (data []byte, ci CaptureInfo, err error) -} - -// ConcatFinitePacketDataSources returns a PacketDataSource that wraps a set -// of internal PacketDataSources, each of which will stop with io.EOF after -// reading a finite number of packets. The returned PacketDataSource will -// return all packets from the first finite source, followed by all packets from -// the second, etc. Once all finite sources have returned io.EOF, the returned -// source will as well. -func ConcatFinitePacketDataSources(pds ...PacketDataSource) PacketDataSource { - c := concat(pds) - return &c -} - -type concat []PacketDataSource - -func (c *concat) ReadPacketData() (data []byte, ci CaptureInfo, err error) { - for len(*c) > 0 { - data, ci, err = (*c)[0].ReadPacketData() - if err == io.EOF { - *c = (*c)[1:] - continue - } - return - } - return nil, CaptureInfo{}, io.EOF -} - -// ZeroCopyPacketDataSource is an interface to pull packet data from sources -// that allow data to be returned without copying to a user-controlled buffer. -// It's very similar to PacketDataSource, except that the caller must be more -// careful in how the returned buffer is handled. -type ZeroCopyPacketDataSource interface { - // ZeroCopyReadPacketData returns the next packet available from this data source. - // It returns: - // data: The bytes of an individual packet. Unlike with - // PacketDataSource's ReadPacketData, the slice returned here points - // to a buffer owned by the data source. In particular, the bytes in - // this buffer may be changed by future calls to - // ZeroCopyReadPacketData. Do not use the returned buffer after - // subsequent ZeroCopyReadPacketData calls. - // ci: Metadata about the capture - // err: An error encountered while reading packet data. If err != nil, - // then data/ci will be ignored. - ZeroCopyReadPacketData() (data []byte, ci CaptureInfo, err error) -} - -// PacketSource reads in packets from a PacketDataSource, decodes them, and -// returns them. -// -// There are currently two different methods for reading packets in through -// a PacketSource: -// -// Reading With Packets Function -// -// This method is the most convenient and easiest to code, but lacks -// flexibility. Packets returns a 'chan Packet', then asynchronously writes -// packets into that channel. Packets uses a blocking channel, and closes -// it if an io.EOF is returned by the underlying PacketDataSource. All other -// PacketDataSource errors are ignored and discarded. -// for packet := range packetSource.Packets() { -// ... -// } -// -// Reading With NextPacket Function -// -// This method is the most flexible, and exposes errors that may be -// encountered by the underlying PacketDataSource. It's also the fastest -// in a tight loop, since it doesn't have the overhead of a channel -// read/write. However, it requires the user to handle errors, most -// importantly the io.EOF error in cases where packets are being read from -// a file. -// for { -// packet, err := packetSource.NextPacket() -// if err == io.EOF { -// break -// } else if err != nil { -// log.Println("Error:", err) -// continue -// } -// handlePacket(packet) // Do something with each packet. -// } -type PacketSource struct { - source PacketDataSource - decoder Decoder - // DecodeOptions is the set of options to use for decoding each piece - // of packet data. This can/should be changed by the user to reflect the - // way packets should be decoded. - DecodeOptions - c chan Packet -} - -// NewPacketSource creates a packet data source. -func NewPacketSource(source PacketDataSource, decoder Decoder) *PacketSource { - return &PacketSource{ - source: source, - decoder: decoder, - } -} - -// NextPacket returns the next decoded packet from the PacketSource. On error, -// it returns a nil packet and a non-nil error. -func (p *PacketSource) NextPacket() (Packet, error) { - data, ci, err := p.source.ReadPacketData() - if err != nil { - return nil, err - } - packet := NewPacket(data, p.decoder, p.DecodeOptions) - m := packet.Metadata() - m.CaptureInfo = ci - m.Truncated = m.Truncated || ci.CaptureLength < ci.Length - return packet, nil -} - -// packetsToChannel reads in all packets from the packet source and sends them -// to the given channel. This routine terminates when a non-temporary error -// is returned by NextPacket(). -func (p *PacketSource) packetsToChannel() { - defer close(p.c) - for { - packet, err := p.NextPacket() - if err == nil { - p.c <- packet - continue - } - - // Immediately retry for temporary network errors - if nerr, ok := err.(net.Error); ok && nerr.Temporary() { - continue - } - - // Immediately retry for EAGAIN - if err == syscall.EAGAIN { - continue - } - - // Immediately break for known unrecoverable errors - if err == io.EOF || err == io.ErrUnexpectedEOF || - err == io.ErrNoProgress || err == io.ErrClosedPipe || err == io.ErrShortBuffer || - err == syscall.EBADF || - strings.Contains(err.Error(), "use of closed file") { - break - } - - // Sleep briefly and try again - time.Sleep(time.Millisecond * time.Duration(5)) - } -} - -// Packets returns a channel of packets, allowing easy iterating over -// packets. Packets will be asynchronously read in from the underlying -// PacketDataSource and written to the returned channel. If the underlying -// PacketDataSource returns an io.EOF error, the channel will be closed. -// If any other error is encountered, it is ignored. -// -// for packet := range packetSource.Packets() { -// handlePacket(packet) // Do something with each packet. -// } -// -// If called more than once, returns the same channel. -func (p *PacketSource) Packets() chan Packet { - if p.c == nil { - p.c = make(chan Packet, 1000) - go p.packetsToChannel() - } - return p.c -} diff --git a/vendor/github.com/google/gopacket/parser.go b/vendor/github.com/google/gopacket/parser.go deleted file mode 100644 index 4a4676f1c..000000000 --- a/vendor/github.com/google/gopacket/parser.go +++ /dev/null @@ -1,350 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package gopacket - -import ( - "fmt" -) - -// A container for single LayerType->DecodingLayer mapping. -type decodingLayerElem struct { - typ LayerType - dec DecodingLayer -} - -// DecodingLayer is an interface for packet layers that can decode themselves. -// -// The important part of DecodingLayer is that they decode themselves in-place. -// Calling DecodeFromBytes on a DecodingLayer totally resets the entire layer to -// the new state defined by the data passed in. A returned error leaves the -// DecodingLayer in an unknown intermediate state, thus its fields should not be -// trusted. -// -// Because the DecodingLayer is resetting its own fields, a call to -// DecodeFromBytes should normally not require any memory allocation. -type DecodingLayer interface { - // DecodeFromBytes resets the internal state of this layer to the state - // defined by the passed-in bytes. Slices in the DecodingLayer may - // reference the passed-in data, so care should be taken to copy it - // first should later modification of data be required before the - // DecodingLayer is discarded. - DecodeFromBytes(data []byte, df DecodeFeedback) error - // CanDecode returns the set of LayerTypes this DecodingLayer can - // decode. For Layers that are also DecodingLayers, this will most - // often be that Layer's LayerType(). - CanDecode() LayerClass - // NextLayerType returns the LayerType which should be used to decode - // the LayerPayload. - NextLayerType() LayerType - // LayerPayload is the set of bytes remaining to decode after a call to - // DecodeFromBytes. - LayerPayload() []byte -} - -// DecodingLayerFunc decodes given packet and stores decoded LayerType -// values into specified slice. Returns either first encountered -// unsupported LayerType value or decoding error. In case of success, -// returns (LayerTypeZero, nil). -type DecodingLayerFunc func([]byte, *[]LayerType) (LayerType, error) - -// DecodingLayerContainer stores all DecodingLayer-s and serves as a -// searching tool for DecodingLayerParser. -type DecodingLayerContainer interface { - // Put adds new DecodingLayer to container. The new instance of - // the same DecodingLayerContainer is returned so it may be - // implemented as a value receiver. - Put(DecodingLayer) DecodingLayerContainer - // Decoder returns DecodingLayer to decode given LayerType and - // true if it was found. If no decoder found, return false. - Decoder(LayerType) (DecodingLayer, bool) - // LayersDecoder returns DecodingLayerFunc which decodes given - // packet, starting with specified LayerType and DecodeFeedback. - LayersDecoder(first LayerType, df DecodeFeedback) DecodingLayerFunc -} - -// DecodingLayerSparse is a sparse array-based implementation of -// DecodingLayerContainer. Each DecodingLayer is addressed in an -// allocated slice by LayerType value itself. Though this is the -// fastest container it may be memory-consuming if used with big -// LayerType values. -type DecodingLayerSparse []DecodingLayer - -// Put implements DecodingLayerContainer interface. -func (dl DecodingLayerSparse) Put(d DecodingLayer) DecodingLayerContainer { - maxLayerType := LayerType(len(dl) - 1) - for _, typ := range d.CanDecode().LayerTypes() { - if typ > maxLayerType { - maxLayerType = typ - } - } - - if extra := maxLayerType - LayerType(len(dl)) + 1; extra > 0 { - dl = append(dl, make([]DecodingLayer, extra)...) - } - - for _, typ := range d.CanDecode().LayerTypes() { - dl[typ] = d - } - return dl -} - -// LayersDecoder implements DecodingLayerContainer interface. -func (dl DecodingLayerSparse) LayersDecoder(first LayerType, df DecodeFeedback) DecodingLayerFunc { - return LayersDecoder(dl, first, df) -} - -// Decoder implements DecodingLayerContainer interface. -func (dl DecodingLayerSparse) Decoder(typ LayerType) (DecodingLayer, bool) { - if int64(typ) < int64(len(dl)) { - decoder := dl[typ] - return decoder, decoder != nil - } - return nil, false -} - -// DecodingLayerArray is an array-based implementation of -// DecodingLayerContainer. Each DecodingLayer is searched linearly in -// an allocated slice in one-by-one fashion. -type DecodingLayerArray []decodingLayerElem - -// Put implements DecodingLayerContainer interface. -func (dl DecodingLayerArray) Put(d DecodingLayer) DecodingLayerContainer { -TYPES: - for _, typ := range d.CanDecode().LayerTypes() { - for i := range dl { - if dl[i].typ == typ { - dl[i].dec = d - continue TYPES - } - } - dl = append(dl, decodingLayerElem{typ, d}) - } - return dl -} - -// Decoder implements DecodingLayerContainer interface. -func (dl DecodingLayerArray) Decoder(typ LayerType) (DecodingLayer, bool) { - for i := range dl { - if dl[i].typ == typ { - return dl[i].dec, true - } - } - return nil, false -} - -// LayersDecoder implements DecodingLayerContainer interface. -func (dl DecodingLayerArray) LayersDecoder(first LayerType, df DecodeFeedback) DecodingLayerFunc { - return LayersDecoder(dl, first, df) -} - -// DecodingLayerMap is an map-based implementation of -// DecodingLayerContainer. Each DecodingLayer is searched in a map -// hashed by LayerType value. -type DecodingLayerMap map[LayerType]DecodingLayer - -// Put implements DecodingLayerContainer interface. -func (dl DecodingLayerMap) Put(d DecodingLayer) DecodingLayerContainer { - for _, typ := range d.CanDecode().LayerTypes() { - if dl == nil { - dl = make(map[LayerType]DecodingLayer) - } - dl[typ] = d - } - return dl -} - -// Decoder implements DecodingLayerContainer interface. -func (dl DecodingLayerMap) Decoder(typ LayerType) (DecodingLayer, bool) { - d, ok := dl[typ] - return d, ok -} - -// LayersDecoder implements DecodingLayerContainer interface. -func (dl DecodingLayerMap) LayersDecoder(first LayerType, df DecodeFeedback) DecodingLayerFunc { - return LayersDecoder(dl, first, df) -} - -// Static code check. -var ( - _ = []DecodingLayerContainer{ - DecodingLayerSparse(nil), - DecodingLayerMap(nil), - DecodingLayerArray(nil), - } -) - -// DecodingLayerParser parses a given set of layer types. See DecodeLayers for -// more information on how DecodingLayerParser should be used. -type DecodingLayerParser struct { - // DecodingLayerParserOptions is the set of options available to the - // user to define the parser's behavior. - DecodingLayerParserOptions - dlc DecodingLayerContainer - first LayerType - df DecodeFeedback - - decodeFunc DecodingLayerFunc - - // Truncated is set when a decode layer detects that the packet has been - // truncated. - Truncated bool -} - -// AddDecodingLayer adds a decoding layer to the parser. This adds support for -// the decoding layer's CanDecode layers to the parser... should they be -// encountered, they'll be parsed. -func (l *DecodingLayerParser) AddDecodingLayer(d DecodingLayer) { - l.SetDecodingLayerContainer(l.dlc.Put(d)) -} - -// SetTruncated is used by DecodingLayers to set the Truncated boolean in the -// DecodingLayerParser. Users should simply read Truncated after calling -// DecodeLayers. -func (l *DecodingLayerParser) SetTruncated() { - l.Truncated = true -} - -// NewDecodingLayerParser creates a new DecodingLayerParser and adds in all -// of the given DecodingLayers with AddDecodingLayer. -// -// Each call to DecodeLayers will attempt to decode the given bytes first by -// treating them as a 'first'-type layer, then by using NextLayerType on -// subsequently decoded layers to find the next relevant decoder. Should a -// deoder not be available for the layer type returned by NextLayerType, -// decoding will stop. -// -// NewDecodingLayerParser uses DecodingLayerMap container by -// default. -func NewDecodingLayerParser(first LayerType, decoders ...DecodingLayer) *DecodingLayerParser { - dlp := &DecodingLayerParser{first: first} - dlp.df = dlp // Cast this once to the interface - // default container - dlc := DecodingLayerContainer(DecodingLayerMap(make(map[LayerType]DecodingLayer))) - for _, d := range decoders { - dlc = dlc.Put(d) - } - - dlp.SetDecodingLayerContainer(dlc) - return dlp -} - -// SetDecodingLayerContainer specifies container with decoders. This -// call replaces all decoders already registered in given instance of -// DecodingLayerParser. -func (l *DecodingLayerParser) SetDecodingLayerContainer(dlc DecodingLayerContainer) { - l.dlc = dlc - l.decodeFunc = l.dlc.LayersDecoder(l.first, l.df) -} - -// DecodeLayers decodes as many layers as possible from the given data. It -// initially treats the data as layer type 'typ', then uses NextLayerType on -// each subsequent decoded layer until it gets to a layer type it doesn't know -// how to parse. -// -// For each layer successfully decoded, DecodeLayers appends the layer type to -// the decoded slice. DecodeLayers truncates the 'decoded' slice initially, so -// there's no need to empty it yourself. -// -// This decoding method is about an order of magnitude faster than packet -// decoding, because it only decodes known layers that have already been -// allocated. This means it doesn't need to allocate each layer it returns... -// instead it overwrites the layers that already exist. -// -// Example usage: -// func main() { -// var eth layers.Ethernet -// var ip4 layers.IPv4 -// var ip6 layers.IPv6 -// var tcp layers.TCP -// var udp layers.UDP -// var payload gopacket.Payload -// parser := gopacket.NewDecodingLayerParser(layers.LayerTypeEthernet, ð, &ip4, &ip6, &tcp, &udp, &payload) -// var source gopacket.PacketDataSource = getMyDataSource() -// decodedLayers := make([]gopacket.LayerType, 0, 10) -// for { -// data, _, err := source.ReadPacketData() -// if err != nil { -// fmt.Println("Error reading packet data: ", err) -// continue -// } -// fmt.Println("Decoding packet") -// err = parser.DecodeLayers(data, &decodedLayers) -// for _, typ := range decodedLayers { -// fmt.Println(" Successfully decoded layer type", typ) -// switch typ { -// case layers.LayerTypeEthernet: -// fmt.Println(" Eth ", eth.SrcMAC, eth.DstMAC) -// case layers.LayerTypeIPv4: -// fmt.Println(" IP4 ", ip4.SrcIP, ip4.DstIP) -// case layers.LayerTypeIPv6: -// fmt.Println(" IP6 ", ip6.SrcIP, ip6.DstIP) -// case layers.LayerTypeTCP: -// fmt.Println(" TCP ", tcp.SrcPort, tcp.DstPort) -// case layers.LayerTypeUDP: -// fmt.Println(" UDP ", udp.SrcPort, udp.DstPort) -// } -// } -// if decodedLayers.Truncated { -// fmt.Println(" Packet has been truncated") -// } -// if err != nil { -// fmt.Println(" Error encountered:", err) -// } -// } -// } -// -// If DecodeLayers is unable to decode the next layer type, it will return the -// error UnsupportedLayerType. -func (l *DecodingLayerParser) DecodeLayers(data []byte, decoded *[]LayerType) (err error) { - l.Truncated = false - if !l.IgnorePanic { - defer panicToError(&err) - } - typ, err := l.decodeFunc(data, decoded) - if typ != LayerTypeZero { - // no decoder - if l.IgnoreUnsupported { - return nil - } - return UnsupportedLayerType(typ) - } - return err -} - -// UnsupportedLayerType is returned by DecodingLayerParser if DecodeLayers -// encounters a layer type that the DecodingLayerParser has no decoder for. -type UnsupportedLayerType LayerType - -// Error implements the error interface, returning a string to say that the -// given layer type is unsupported. -func (e UnsupportedLayerType) Error() string { - return fmt.Sprintf("No decoder for layer type %v", LayerType(e)) -} - -func panicToError(e *error) { - if r := recover(); r != nil { - *e = fmt.Errorf("panic: %v", r) - } -} - -// DecodingLayerParserOptions provides options to affect the behavior of a given -// DecodingLayerParser. -type DecodingLayerParserOptions struct { - // IgnorePanic determines whether a DecodingLayerParser should stop - // panics on its own (by returning them as an error from DecodeLayers) - // or should allow them to raise up the stack. Handling errors does add - // latency to the process of decoding layers, but is much safer for - // callers. IgnorePanic defaults to false, thus if the caller does - // nothing decode panics will be returned as errors. - IgnorePanic bool - // IgnoreUnsupported will stop parsing and return a nil error when it - // encounters a layer it doesn't have a parser for, instead of returning an - // UnsupportedLayerType error. If this is true, it's up to the caller to make - // sure that all expected layers have been parsed (by checking the decoded - // slice). - IgnoreUnsupported bool -} diff --git a/vendor/github.com/google/gopacket/time.go b/vendor/github.com/google/gopacket/time.go deleted file mode 100644 index 6d116cdfb..000000000 --- a/vendor/github.com/google/gopacket/time.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2018 The GoPacket Authors. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package gopacket - -import ( - "fmt" - "math" - "time" -) - -// TimestampResolution represents the resolution of timestamps in Base^Exponent. -type TimestampResolution struct { - Base, Exponent int -} - -func (t TimestampResolution) String() string { - return fmt.Sprintf("%d^%d", t.Base, t.Exponent) -} - -// ToDuration returns the smallest representable time difference as a time.Duration -func (t TimestampResolution) ToDuration() time.Duration { - if t.Base == 0 { - return 0 - } - if t.Exponent == 0 { - return time.Second - } - switch t.Base { - case 10: - return time.Duration(math.Pow10(t.Exponent + 9)) - case 2: - if t.Exponent < 0 { - return time.Second >> uint(-t.Exponent) - } - return time.Second << uint(t.Exponent) - default: - // this might loose precision - return time.Duration(float64(time.Second) * math.Pow(float64(t.Base), float64(t.Exponent))) - } -} - -// TimestampResolutionInvalid represents an invalid timestamp resolution -var TimestampResolutionInvalid = TimestampResolution{} - -// TimestampResolutionMillisecond is a resolution of 10^-3s -var TimestampResolutionMillisecond = TimestampResolution{10, -3} - -// TimestampResolutionMicrosecond is a resolution of 10^-6s -var TimestampResolutionMicrosecond = TimestampResolution{10, -6} - -// TimestampResolutionNanosecond is a resolution of 10^-9s -var TimestampResolutionNanosecond = TimestampResolution{10, -9} - -// TimestampResolutionNTP is the resolution of NTP timestamps which is 2^-32 ≈ 233 picoseconds -var TimestampResolutionNTP = TimestampResolution{2, -32} - -// TimestampResolutionCaptureInfo is the resolution used in CaptureInfo, which his currently nanosecond -var TimestampResolutionCaptureInfo = TimestampResolutionNanosecond - -// PacketSourceResolution is an interface for packet data sources that -// support reporting the timestamp resolution of the aqcuired timestamps. -// Returned timestamps will always have NanosecondTimestampResolution due -// to the use of time.Time, but scaling might have occured if acquired -// timestamps have a different resolution. -type PacketSourceResolution interface { - // Resolution returns the timestamp resolution of acquired timestamps before scaling to NanosecondTimestampResolution. - Resolution() TimestampResolution -} diff --git a/vendor/github.com/google/gopacket/writer.go b/vendor/github.com/google/gopacket/writer.go deleted file mode 100644 index 5d303dc4a..000000000 --- a/vendor/github.com/google/gopacket/writer.go +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package gopacket - -import ( - "fmt" -) - -// SerializableLayer allows its implementations to be written out as a set of bytes, -// so those bytes may be sent on the wire or otherwise used by the caller. -// SerializableLayer is implemented by certain Layer types, and can be encoded to -// bytes using the LayerWriter object. -type SerializableLayer interface { - // SerializeTo writes this layer to a slice, growing that slice if necessary - // to make it fit the layer's data. - // Args: - // b: SerializeBuffer to write this layer on to. When called, b.Bytes() - // is the payload this layer should wrap, if any. Note that this - // layer can either prepend itself (common), append itself - // (uncommon), or both (sometimes padding or footers are required at - // the end of packet data). It's also possible (though probably very - // rarely needed) to overwrite any bytes in the current payload. - // After this call, b.Bytes() should return the byte encoding of - // this layer wrapping the original b.Bytes() payload. - // opts: options to use while writing out data. - // Returns: - // error if a problem was encountered during encoding. If an error is - // returned, the bytes in data should be considered invalidated, and - // not used. - // - // SerializeTo calls SHOULD entirely ignore LayerContents and - // LayerPayload. It just serializes based on struct fields, neither - // modifying nor using contents/payload. - SerializeTo(b SerializeBuffer, opts SerializeOptions) error - // LayerType returns the type of the layer that is being serialized to the buffer - LayerType() LayerType -} - -// SerializeOptions provides options for behaviors that SerializableLayers may want to -// implement. -type SerializeOptions struct { - // FixLengths determines whether, during serialization, layers should fix - // the values for any length field that depends on the payload. - FixLengths bool - // ComputeChecksums determines whether, during serialization, layers - // should recompute checksums based on their payloads. - ComputeChecksums bool -} - -// SerializeBuffer is a helper used by gopacket for writing out packet layers. -// SerializeBuffer starts off as an empty []byte. Subsequent calls to PrependBytes -// return byte slices before the current Bytes(), AppendBytes returns byte -// slices after. -// -// Byte slices returned by PrependBytes/AppendBytes are NOT zero'd out, so if -// you want to make sure they're all zeros, set them as such. -// -// SerializeBuffer is specifically designed to handle packet writing, where unlike -// with normal writes it's easier to start writing at the inner-most layer and -// work out, meaning that we often need to prepend bytes. This runs counter to -// typical writes to byte slices using append(), where we only write at the end -// of the buffer. -// -// It can be reused via Clear. Note, however, that a Clear call will invalidate the -// byte slices returned by any previous Bytes() call (the same buffer is -// reused). -// -// 1) Reusing a write buffer is generally much faster than creating a new one, -// and with the default implementation it avoids additional memory allocations. -// 2) If a byte slice from a previous Bytes() call will continue to be used, -// it's better to create a new SerializeBuffer. -// -// The Clear method is specifically designed to minimize memory allocations for -// similar later workloads on the SerializeBuffer. IE: if you make a set of -// Prepend/Append calls, then clear, then make the same calls with the same -// sizes, the second round (and all future similar rounds) shouldn't allocate -// any new memory. -type SerializeBuffer interface { - // Bytes returns the contiguous set of bytes collected so far by Prepend/Append - // calls. The slice returned by Bytes will be modified by future Clear calls, - // so if you're planning on clearing this SerializeBuffer, you may want to copy - // Bytes somewhere safe first. - Bytes() []byte - // PrependBytes returns a set of bytes which prepends the current bytes in this - // buffer. These bytes start in an indeterminate state, so they should be - // overwritten by the caller. The caller must only call PrependBytes if they - // know they're going to immediately overwrite all bytes returned. - PrependBytes(num int) ([]byte, error) - // AppendBytes returns a set of bytes which appends the current bytes in this - // buffer. These bytes start in an indeterminate state, so they should be - // overwritten by the caller. The caller must only call AppendBytes if they - // know they're going to immediately overwrite all bytes returned. - AppendBytes(num int) ([]byte, error) - // Clear resets the SerializeBuffer to a new, empty buffer. After a call to clear, - // the byte slice returned by any previous call to Bytes() for this buffer - // should be considered invalidated. - Clear() error - // Layers returns all the Layers that have been successfully serialized into this buffer - // already. - Layers() []LayerType - // PushLayer adds the current Layer to the list of Layers that have been serialized - // into this buffer. - PushLayer(LayerType) -} - -type serializeBuffer struct { - data []byte - start int - prepended, appended int - layers []LayerType -} - -// NewSerializeBuffer creates a new instance of the default implementation of -// the SerializeBuffer interface. -func NewSerializeBuffer() SerializeBuffer { - return &serializeBuffer{} -} - -// NewSerializeBufferExpectedSize creates a new buffer for serialization, optimized for an -// expected number of bytes prepended/appended. This tends to decrease the -// number of memory allocations made by the buffer during writes. -func NewSerializeBufferExpectedSize(expectedPrependLength, expectedAppendLength int) SerializeBuffer { - return &serializeBuffer{ - data: make([]byte, expectedPrependLength, expectedPrependLength+expectedAppendLength), - start: expectedPrependLength, - prepended: expectedPrependLength, - appended: expectedAppendLength, - } -} - -func (w *serializeBuffer) Bytes() []byte { - return w.data[w.start:] -} - -func (w *serializeBuffer) PrependBytes(num int) ([]byte, error) { - if num < 0 { - panic("num < 0") - } - if w.start < num { - toPrepend := w.prepended - if toPrepend < num { - toPrepend = num - } - w.prepended += toPrepend - length := cap(w.data) + toPrepend - newData := make([]byte, length) - newStart := w.start + toPrepend - copy(newData[newStart:], w.data[w.start:]) - w.start = newStart - w.data = newData[:toPrepend+len(w.data)] - } - w.start -= num - return w.data[w.start : w.start+num], nil -} - -func (w *serializeBuffer) AppendBytes(num int) ([]byte, error) { - if num < 0 { - panic("num < 0") - } - initialLength := len(w.data) - if cap(w.data)-initialLength < num { - toAppend := w.appended - if toAppend < num { - toAppend = num - } - w.appended += toAppend - newData := make([]byte, cap(w.data)+toAppend) - copy(newData[w.start:], w.data[w.start:]) - w.data = newData[:initialLength] - } - // Grow the buffer. We know it'll be under capacity given above. - w.data = w.data[:initialLength+num] - return w.data[initialLength:], nil -} - -func (w *serializeBuffer) Clear() error { - w.start = w.prepended - w.data = w.data[:w.start] - w.layers = w.layers[:0] - return nil -} - -func (w *serializeBuffer) Layers() []LayerType { - return w.layers -} - -func (w *serializeBuffer) PushLayer(l LayerType) { - w.layers = append(w.layers, l) -} - -// SerializeLayers clears the given write buffer, then writes all layers into it so -// they correctly wrap each other. Note that by clearing the buffer, it -// invalidates all slices previously returned by w.Bytes() -// -// Example: -// buf := gopacket.NewSerializeBuffer() -// opts := gopacket.SerializeOptions{} -// gopacket.SerializeLayers(buf, opts, a, b, c) -// firstPayload := buf.Bytes() // contains byte representation of a(b(c)) -// gopacket.SerializeLayers(buf, opts, d, e, f) -// secondPayload := buf.Bytes() // contains byte representation of d(e(f)). firstPayload is now invalidated, since the SerializeLayers call Clears buf. -func SerializeLayers(w SerializeBuffer, opts SerializeOptions, layers ...SerializableLayer) error { - w.Clear() - for i := len(layers) - 1; i >= 0; i-- { - layer := layers[i] - err := layer.SerializeTo(w, opts) - if err != nil { - return err - } - w.PushLayer(layer.LayerType()) - } - return nil -} - -// SerializePacket is a convenience function that calls SerializeLayers -// on packet's Layers(). -// It returns an error if one of the packet layers is not a SerializableLayer. -func SerializePacket(buf SerializeBuffer, opts SerializeOptions, packet Packet) error { - sls := []SerializableLayer{} - for _, layer := range packet.Layers() { - sl, ok := layer.(SerializableLayer) - if !ok { - return fmt.Errorf("layer %s is not serializable", layer.LayerType().String()) - } - sls = append(sls, sl) - } - return SerializeLayers(buf, opts, sls...) -} diff --git a/vendor/github.com/hashicorp/consul/api/.copywrite.hcl b/vendor/github.com/hashicorp/consul/api/.copywrite.hcl deleted file mode 100644 index 7e4c0b58a..000000000 --- a/vendor/github.com/hashicorp/consul/api/.copywrite.hcl +++ /dev/null @@ -1,8 +0,0 @@ -schema_version = 1 - -project { - license = "MPL-2.0" - copyright_year = 2024 - - header_ignore = [] -} diff --git a/vendor/github.com/hashicorp/consul/api/LICENSE b/vendor/github.com/hashicorp/consul/api/LICENSE deleted file mode 100644 index 7c5baa45e..000000000 --- a/vendor/github.com/hashicorp/consul/api/LICENSE +++ /dev/null @@ -1,365 +0,0 @@ -Copyright (c) 2020 HashiCorp, Inc. - -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. "Contributor" - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. "Contributor Version" - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the terms of - a Secondary License. - -1.6. "Executable Form" - - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - - means a work that combines Covered Software with other material, in a - separate file or files, that is not Covered Software. - -1.8. "License" - - means this document. - -1.9. "Licensable" - - means having the right to grant, to the maximum extent possible, whether - at the time of the initial grant or subsequently, any and all of the - rights conveyed by this License. - -1.10. "Modifications" - - means any of the following: - - a. any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. "Patent Claims" of a Contributor - - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the License, - by the making, using, selling, offering for sale, having made, import, - or transfer of either its Contributions or its Contributor Version. - -1.12. "Secondary License" - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. "Source Code Form" - - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, "control" means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution - become effective for each Contribution on the date the Contributor first - distributes such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under - this License. No additional rights or licenses will be implied from the - distribution or licensing of Covered Software under this License. - Notwithstanding Section 2.1(b) above, no patent license is granted by a - Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of - its Contributions. - - This License does not grant any rights in the trademarks, service marks, - or logos of any Contributor (except as may be necessary to comply with - the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this - License (see Section 10.2) or under the terms of a Secondary License (if - permitted under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its - Contributions are its original creation(s) or it has sufficient rights to - grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under - applicable copyright doctrines of fair use, fair dealing, or other - equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under - the terms of this License. You must inform recipients that the Source - Code Form of the Covered Software is governed by the terms of this - License, and how they can obtain a copy of this License. You may not - attempt to alter or restrict the recipients' rights in the Source Code - Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter the - recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for - the Covered Software. If the Larger Work is a combination of Covered - Software with a work governed by one or more Secondary Licenses, and the - Covered Software is not Incompatible With Secondary Licenses, this - License permits You to additionally distribute such Covered Software - under the terms of such Secondary License(s), so that the recipient of - the Larger Work may, at their option, further distribute the Covered - Software under the terms of either this License or such Secondary - License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices - (including copyright notices, patent notices, disclaimers of warranty, or - limitations of liability) contained within the Source Code Form of the - Covered Software, except that You may alter any license notices to the - extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on - behalf of any Contributor. You must make it absolutely clear that any - such warranty, support, indemnity, or liability obligation is offered by - You alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, - judicial order, or regulation then You must: (a) comply with the terms of - this License to the maximum extent possible; and (b) describe the - limitations and the code they affect. Such description must be placed in a - text file included with all distributions of the Covered Software under - this License. Except to the extent prohibited by statute or regulation, - such description must be sufficiently detailed for a recipient of ordinary - skill to be able to understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing - basis, if such Contributor fails to notify You of the non-compliance by - some reasonable means prior to 60 days after You have come back into - compliance. Moreover, Your grants from a particular Contributor are - reinstated on an ongoing basis if such Contributor notifies You of the - non-compliance by some reasonable means, this is the first time You have - received notice of non-compliance with this License from such - Contributor, and You become compliant prior to 30 days after Your receipt - of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, - counter-claims, and cross-claims) alleging that a Contributor Version - directly or indirectly infringes any patent, then the rights granted to - You by any and all Contributors for the Covered Software under Section - 2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an "as is" basis, - without warranty of any kind, either expressed, implied, or statutory, - including, without limitation, warranties that the Covered Software is free - of defects, merchantable, fit for a particular purpose or non-infringing. - The entire risk as to the quality and performance of the Covered Software - is with You. Should any Covered Software prove defective in any respect, - You (not any Contributor) assume the cost of any necessary servicing, - repair, or correction. This disclaimer of warranty constitutes an essential - part of this License. No use of any Covered Software is authorized under - this License except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from - such party's negligence to the extent applicable law prohibits such - limitation. Some jurisdictions do not allow the exclusion or limitation of - incidental or consequential damages, so this exclusion and limitation may - not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts - of a jurisdiction where the defendant maintains its principal place of - business and such litigation shall be governed by laws of that - jurisdiction, without reference to its conflict-of-law provisions. Nothing - in this Section shall prevent a party's ability to bring cross-claims or - counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. Any law or regulation which provides that - the language of a contract shall be construed against the drafter shall not - be used to construe this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version - of the License under which You originally received the Covered Software, - or under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a - modified version of this License if you rename the license and remove - any references to the name of the license steward (except to note that - such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary - Licenses If You choose to distribute Source Code Form that is - Incompatible With Secondary Licenses under the terms of this version of - the License, the notice described in Exhibit B of this License must be - attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, -then You may include the notice in a location (such as a LICENSE file in a -relevant directory) where a recipient would be likely to look for such a -notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice - - This Source Code Form is "Incompatible - With Secondary Licenses", as defined by - the Mozilla Public License, v. 2.0. - diff --git a/vendor/github.com/hashicorp/consul/api/README.md b/vendor/github.com/hashicorp/consul/api/README.md deleted file mode 100644 index 96a867f27..000000000 --- a/vendor/github.com/hashicorp/consul/api/README.md +++ /dev/null @@ -1,77 +0,0 @@ -# Consul API Client - -This package provides the `api` package which provides programmatic access to the full Consul API. - -The full documentation is available on [Godoc](https://godoc.org/github.com/hashicorp/consul/api). - -## Usage - -Below is an example of using the Consul client. To run the example, you must first -[install Consul](https://developer.hashicorp.com/consul/downloads) and -[Go](https://go.dev/doc/install). - -To run the client API, create a new Go module. - -```shell -go mod init consul-demo -``` - -Copy the example code into a file called `main.go` in the directory where the module is defined. -As seen in the example, the Consul API is often imported with the alias `capi`. - -```go -package main - -import ( - "fmt" - - capi "github.com/hashicorp/consul/api" -) - -func main() { - // Get a new client - client, err := capi.NewClient(capi.DefaultConfig()) - if err != nil { - panic(err) - } - - // Get a handle to the KV API - kv := client.KV() - - // PUT a new KV pair - p := &capi.KVPair{Key: "REDIS_MAXCLIENTS", Value: []byte("1000")} - _, err = kv.Put(p, nil) - if err != nil { - panic(err) - } - - // Lookup the pair - pair, _, err := kv.Get("REDIS_MAXCLIENTS", nil) - if err != nil { - panic(err) - } - fmt.Printf("KV: %v %s\n", pair.Key, pair.Value) -} -``` - -Install the Consul API dependency with `go mod tidy`. - -In a separate terminal window, start a local Consul server. - -```shell -consul agent -dev -node machine -``` - -Run the example. - -```shell -go run . -``` - -You should get the following result printed to the terminal. - -```shell -KV: REDIS_MAXCLIENTS 1000 -``` - -After running the code, you can also view the values in the Consul UI on your local machine at http://localhost:8500/ui/dc1/kv diff --git a/vendor/github.com/hashicorp/consul/api/acl.go b/vendor/github.com/hashicorp/consul/api/acl.go deleted file mode 100644 index fcea0fdde..000000000 --- a/vendor/github.com/hashicorp/consul/api/acl.go +++ /dev/null @@ -1,1744 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "encoding/json" - "fmt" - "io" - "net/url" - "time" - - "github.com/mitchellh/mapstructure" -) - -const ( - // ACLClientType is the client type token - ACLClientType = "client" - - // ACLManagementType is the management type token - ACLManagementType = "management" - - // ACLTemplatedPolicy names - ACLTemplatedPolicyServiceName = "builtin/service" - ACLTemplatedPolicyNodeName = "builtin/node" - ACLTemplatedPolicyDNSName = "builtin/dns" - ACLTemplatedPolicyNomadServerName = "builtin/nomad-server" - ACLTemplatedPolicyWorkloadIdentityName = "builtin/workload-identity" - ACLTemplatedPolicyAPIGatewayName = "builtin/api-gateway" - ACLTemplatedPolicyNomadClientName = "builtin/nomad-client" -) - -type ACLLink struct { - ID string - Name string -} - -type ACLTokenPolicyLink = ACLLink -type ACLTokenRoleLink = ACLLink - -// ACLToken represents an ACL Token -type ACLToken struct { - CreateIndex uint64 - ModifyIndex uint64 - AccessorID string - SecretID string - Description string - Policies []*ACLTokenPolicyLink `json:",omitempty"` - Roles []*ACLTokenRoleLink `json:",omitempty"` - ServiceIdentities []*ACLServiceIdentity `json:",omitempty"` - NodeIdentities []*ACLNodeIdentity `json:",omitempty"` - TemplatedPolicies []*ACLTemplatedPolicy `json:",omitempty"` - Local bool - AuthMethod string `json:",omitempty"` - ExpirationTTL time.Duration `json:",omitempty"` - ExpirationTime *time.Time `json:",omitempty"` - CreateTime time.Time `json:",omitempty"` - Hash []byte `json:",omitempty"` - - // DEPRECATED (ACL-Legacy-Compat) - // Rules are an artifact of legacy tokens deprecated in Consul 1.4 - Rules string `json:"-"` - - // Namespace is the namespace the ACLToken is associated with. - // Namespaces are a Consul Enterprise feature. - Namespace string `json:",omitempty"` - - // Partition is the partition the ACLToken is associated with. - // Partitions are a Consul Enterprise feature. - Partition string `json:",omitempty"` - - // AuthMethodNamespace is the namespace the token's AuthMethod is associated with. - // Namespacing is a Consul Enterprise feature. - AuthMethodNamespace string `json:",omitempty"` -} - -type ACLTokenExpanded struct { - ExpandedPolicies []ACLPolicy - ExpandedRoles []ACLRole - - NamespaceDefaultPolicyIDs []string - NamespaceDefaultRoleIDs []string - - AgentACLDefaultPolicy string - AgentACLDownPolicy string - ResolvedByAgent string - - ACLToken -} - -type ACLTokenListEntry struct { - CreateIndex uint64 - ModifyIndex uint64 - AccessorID string - SecretID string - Description string - Policies []*ACLTokenPolicyLink `json:",omitempty"` - Roles []*ACLTokenRoleLink `json:",omitempty"` - ServiceIdentities []*ACLServiceIdentity `json:",omitempty"` - NodeIdentities []*ACLNodeIdentity `json:",omitempty"` - TemplatedPolicies []*ACLTemplatedPolicy `json:",omitempty"` - Local bool - AuthMethod string `json:",omitempty"` - ExpirationTime *time.Time `json:",omitempty"` - CreateTime time.Time - Hash []byte - Legacy bool `json:"-"` // DEPRECATED - - // Namespace is the namespace the ACLTokenListEntry is associated with. - // Namespacing is a Consul Enterprise feature. - Namespace string `json:",omitempty"` - - // Partition is the partition the ACLTokenListEntry is associated with. - // Partitions are a Consul Enterprise feature. - Partition string `json:",omitempty"` - - // AuthMethodNamespace is the namespace the token's AuthMethod is associated with. - // Namespacing is a Consul Enterprise feature. - AuthMethodNamespace string `json:",omitempty"` -} - -// ACLEntry is used to represent a legacy ACL token -// The legacy tokens are deprecated. -type ACLEntry struct { - CreateIndex uint64 - ModifyIndex uint64 - ID string - Name string - Type string - Rules string -} - -// ACLReplicationStatus is used to represent the status of ACL replication. -type ACLReplicationStatus struct { - Enabled bool - Running bool - SourceDatacenter string - ReplicationType string - ReplicatedIndex uint64 - ReplicatedRoleIndex uint64 - ReplicatedTokenIndex uint64 - LastSuccess time.Time - LastError time.Time - LastErrorMessage string -} - -// ACLServiceIdentity represents a high-level grant of all necessary privileges -// to assume the identity of the named Service in the Catalog and within -// Connect. -type ACLServiceIdentity struct { - ServiceName string - Datacenters []string `json:",omitempty"` -} - -// ACLNodeIdentity represents a high-level grant of all necessary privileges -// to assume the identity of the named Node in the Catalog and within Connect. -type ACLNodeIdentity struct { - NodeName string - Datacenter string -} - -// ACLTemplatedPolicy represents a template used to generate a `synthetic` policy -// given some input variables. -type ACLTemplatedPolicy struct { - TemplateName string - TemplateVariables *ACLTemplatedPolicyVariables `json:",omitempty"` - - // Datacenters are an artifact of Nodeidentity & ServiceIdentity. - // It is used to facilitate the future migration away from both - Datacenters []string `json:",omitempty"` -} - -type ACLTemplatedPolicyResponse struct { - TemplateName string - Schema string - Template string - Description string -} - -type ACLTemplatedPolicyVariables struct { - Name string -} - -// ACLPolicy represents an ACL Policy. -type ACLPolicy struct { - ID string - Name string - Description string - Rules string - Datacenters []string - Hash []byte - CreateIndex uint64 - ModifyIndex uint64 - - // Namespace is the namespace the ACLPolicy is associated with. - // Namespacing is a Consul Enterprise feature. - Namespace string `json:",omitempty"` - - // Partition is the partition the ACLPolicy is associated with. - // Partitions are a Consul Enterprise feature. - Partition string `json:",omitempty"` -} - -type ACLPolicyListEntry struct { - ID string - Name string - Description string - Datacenters []string - Hash []byte - CreateIndex uint64 - ModifyIndex uint64 - - // Namespace is the namespace the ACLPolicyListEntry is associated with. - // Namespacing is a Consul Enterprise feature. - Namespace string `json:",omitempty"` - - // Partition is the partition the ACLPolicyListEntry is associated with. - // Partitions are a Consul Enterprise feature. - Partition string `json:",omitempty"` -} - -type ACLRolePolicyLink = ACLLink - -// ACLRole represents an ACL Role. -type ACLRole struct { - ID string - Name string - Description string - Policies []*ACLRolePolicyLink `json:",omitempty"` - ServiceIdentities []*ACLServiceIdentity `json:",omitempty"` - NodeIdentities []*ACLNodeIdentity `json:",omitempty"` - TemplatedPolicies []*ACLTemplatedPolicy `json:",omitempty"` - Hash []byte - CreateIndex uint64 - ModifyIndex uint64 - - // Namespace is the namespace the ACLRole is associated with. - // Namespacing is a Consul Enterprise feature. - Namespace string `json:",omitempty"` - - // Partition is the partition the ACLRole is associated with. - // Partitions are a Consul Enterprise feature. - Partition string `json:",omitempty"` -} - -// BindingRuleBindType is the type of binding rule mechanism used. -type BindingRuleBindType string - -const ( - // BindingRuleBindTypeService binds to a service identity with the given name. - BindingRuleBindTypeService BindingRuleBindType = "service" - - // BindingRuleBindTypeRole binds to pre-existing roles with the given name. - BindingRuleBindTypeRole BindingRuleBindType = "role" - - // BindingRuleBindTypeNode binds to a node identity with given name. - BindingRuleBindTypeNode BindingRuleBindType = "node" - - // BindingRuleBindTypePolicy binds to a specific policy with given name. - BindingRuleBindTypePolicy BindingRuleBindType = "policy" - - // BindingRuleBindTypeTemplatedPolicy binds to a templated policy with given template name and variables. - BindingRuleBindTypeTemplatedPolicy BindingRuleBindType = "templated-policy" -) - -type ACLBindingRule struct { - ID string - Description string - AuthMethod string - Selector string - BindType BindingRuleBindType - BindName string - BindVars *ACLTemplatedPolicyVariables `json:",omitempty"` - - CreateIndex uint64 - ModifyIndex uint64 - - // Namespace is the namespace the ACLBindingRule is associated with. - // Namespacing is a Consul Enterprise feature. - Namespace string `json:",omitempty"` - - // Partition is the partition the ACLBindingRule is associated with. - // Partitions are a Consul Enterprise feature. - Partition string `json:",omitempty"` -} - -type ACLAuthMethod struct { - Name string - Type string - DisplayName string `json:",omitempty"` - Description string `json:",omitempty"` - MaxTokenTTL time.Duration `json:",omitempty"` - - // TokenLocality defines the kind of token that this auth method produces. - // This can be either 'local' or 'global'. If empty 'local' is assumed. - TokenLocality string `json:",omitempty"` - - // Configuration is arbitrary configuration for the auth method. This - // should only contain primitive values and containers (such as lists and - // maps). - Config map[string]interface{} - - CreateIndex uint64 - ModifyIndex uint64 - - // NamespaceRules apply only on auth methods defined in the default namespace. - // Namespacing is a Consul Enterprise feature. - NamespaceRules []*ACLAuthMethodNamespaceRule `json:",omitempty"` - - // Namespace is the namespace the ACLAuthMethod is associated with. - // Namespacing is a Consul Enterprise feature. - Namespace string `json:",omitempty"` - - // Partition is the partition the ACLAuthMethod is associated with. - // Partitions are a Consul Enterprise feature. - Partition string `json:",omitempty"` -} - -type ACLTokenFilterOptions struct { - AuthMethod string `json:",omitempty"` - Policy string `json:",omitempty"` - Role string `json:",omitempty"` - ServiceName string `json:",omitempty"` -} - -func (m *ACLAuthMethod) MarshalJSON() ([]byte, error) { - type Alias ACLAuthMethod - exported := &struct { - MaxTokenTTL string `json:",omitempty"` - *Alias - }{ - MaxTokenTTL: m.MaxTokenTTL.String(), - Alias: (*Alias)(m), - } - if m.MaxTokenTTL == 0 { - exported.MaxTokenTTL = "" - } - - return json.Marshal(exported) -} - -func (m *ACLAuthMethod) UnmarshalJSON(data []byte) error { - type Alias ACLAuthMethod - aux := &struct { - MaxTokenTTL string - *Alias - }{ - Alias: (*Alias)(m), - } - if err := json.Unmarshal(data, &aux); err != nil { - return err - } - var err error - if aux.MaxTokenTTL != "" { - if m.MaxTokenTTL, err = time.ParseDuration(aux.MaxTokenTTL); err != nil { - return err - } - } - - return nil -} - -type ACLAuthMethodNamespaceRule struct { - // Selector is an expression that matches against verified identity - // attributes returned from the auth method during login. - Selector string `json:",omitempty"` - - // BindNamespace is the target namespace of the binding. Can be lightly - // templated using HIL ${foo} syntax from available field names. - // - // If empty it's created in the same namespace as the auth method. - BindNamespace string `json:",omitempty"` -} - -type ACLAuthMethodListEntry struct { - Name string - Type string - DisplayName string `json:",omitempty"` - Description string `json:",omitempty"` - MaxTokenTTL time.Duration `json:",omitempty"` - - // TokenLocality defines the kind of token that this auth method produces. - // This can be either 'local' or 'global'. If empty 'local' is assumed. - TokenLocality string `json:",omitempty"` - CreateIndex uint64 - ModifyIndex uint64 - - // Namespace is the namespace the ACLAuthMethodListEntry is associated with. - // Namespacing is a Consul Enterprise feature. - Namespace string `json:",omitempty"` - - // Partition is the partition the ACLAuthMethodListEntry is associated with. - // Partitions are a Consul Enterprise feature. - Partition string `json:",omitempty"` -} - -// This is nearly identical to the ACLAuthMethod MarshalJSON -func (m *ACLAuthMethodListEntry) MarshalJSON() ([]byte, error) { - type Alias ACLAuthMethodListEntry - exported := &struct { - MaxTokenTTL string `json:",omitempty"` - *Alias - }{ - MaxTokenTTL: m.MaxTokenTTL.String(), - Alias: (*Alias)(m), - } - if m.MaxTokenTTL == 0 { - exported.MaxTokenTTL = "" - } - - return json.Marshal(exported) -} - -// This is nearly identical to the ACLAuthMethod UnmarshalJSON -func (m *ACLAuthMethodListEntry) UnmarshalJSON(data []byte) error { - type Alias ACLAuthMethodListEntry - aux := &struct { - MaxTokenTTL string - *Alias - }{ - Alias: (*Alias)(m), - } - - if err := json.Unmarshal(data, &aux); err != nil { - return err - } - var err error - if aux.MaxTokenTTL != "" { - if m.MaxTokenTTL, err = time.ParseDuration(aux.MaxTokenTTL); err != nil { - return err - } - } - - return nil -} - -// ParseKubernetesAuthMethodConfig takes a raw config map and returns a parsed -// KubernetesAuthMethodConfig. -func ParseKubernetesAuthMethodConfig(raw map[string]interface{}) (*KubernetesAuthMethodConfig, error) { - var config KubernetesAuthMethodConfig - decodeConf := &mapstructure.DecoderConfig{ - Result: &config, - WeaklyTypedInput: true, - } - - decoder, err := mapstructure.NewDecoder(decodeConf) - if err != nil { - return nil, err - } - - if err := decoder.Decode(raw); err != nil { - return nil, fmt.Errorf("error decoding config: %s", err) - } - - return &config, nil -} - -// KubernetesAuthMethodConfig is the config for the built-in Consul auth method -// for Kubernetes. -type KubernetesAuthMethodConfig struct { - Host string `json:",omitempty"` - CACert string `json:",omitempty"` - ServiceAccountJWT string `json:",omitempty"` -} - -// RenderToConfig converts this into a map[string]interface{} suitable for use -// in the ACLAuthMethod.Config field. -func (c *KubernetesAuthMethodConfig) RenderToConfig() map[string]interface{} { - return map[string]interface{}{ - "Host": c.Host, - "CACert": c.CACert, - "ServiceAccountJWT": c.ServiceAccountJWT, - } -} - -// OIDCAuthMethodConfig is the config for the built-in Consul auth method for -// OIDC and JWT. -type OIDCAuthMethodConfig struct { - // common for type=oidc and type=jwt - JWTSupportedAlgs []string `json:",omitempty"` - BoundAudiences []string `json:",omitempty"` - ClaimMappings map[string]string `json:",omitempty"` - ListClaimMappings map[string]string `json:",omitempty"` - OIDCDiscoveryURL string `json:",omitempty"` - OIDCDiscoveryCACert string `json:",omitempty"` - // just for type=oidc - OIDCClientID string `json:",omitempty"` - OIDCClientSecret string `json:",omitempty"` - OIDCScopes []string `json:",omitempty"` - OIDCACRValues []string `json:",omitempty"` - AllowedRedirectURIs []string `json:",omitempty"` - VerboseOIDCLogging bool `json:",omitempty"` - // just for type=jwt - JWKSURL string `json:",omitempty"` - JWKSCACert string `json:",omitempty"` - JWTValidationPubKeys []string `json:",omitempty"` - BoundIssuer string `json:",omitempty"` - ExpirationLeeway time.Duration `json:",omitempty"` - NotBeforeLeeway time.Duration `json:",omitempty"` - ClockSkewLeeway time.Duration `json:",omitempty"` -} - -// RenderToConfig converts this into a map[string]interface{} suitable for use -// in the ACLAuthMethod.Config field. -func (c *OIDCAuthMethodConfig) RenderToConfig() map[string]interface{} { - return map[string]interface{}{ - // common for type=oidc and type=jwt - "JWTSupportedAlgs": c.JWTSupportedAlgs, - "BoundAudiences": c.BoundAudiences, - "ClaimMappings": c.ClaimMappings, - "ListClaimMappings": c.ListClaimMappings, - "OIDCDiscoveryURL": c.OIDCDiscoveryURL, - "OIDCDiscoveryCACert": c.OIDCDiscoveryCACert, - // just for type=oidc - "OIDCClientID": c.OIDCClientID, - "OIDCClientSecret": c.OIDCClientSecret, - "OIDCScopes": c.OIDCScopes, - "OIDCACRValues": c.OIDCACRValues, - "AllowedRedirectURIs": c.AllowedRedirectURIs, - "VerboseOIDCLogging": c.VerboseOIDCLogging, - // just for type=jwt - "JWKSURL": c.JWKSURL, - "JWKSCACert": c.JWKSCACert, - "JWTValidationPubKeys": c.JWTValidationPubKeys, - "BoundIssuer": c.BoundIssuer, - "ExpirationLeeway": c.ExpirationLeeway, - "NotBeforeLeeway": c.NotBeforeLeeway, - "ClockSkewLeeway": c.ClockSkewLeeway, - } -} - -type ACLLoginParams struct { - AuthMethod string - BearerToken string - Meta map[string]string `json:",omitempty"` -} - -type ACLOIDCAuthURLParams struct { - AuthMethod string - RedirectURI string - ClientNonce string - Meta map[string]string `json:",omitempty"` -} - -// ACL can be used to query the ACL endpoints -type ACL struct { - c *Client -} - -// ACL returns a handle to the ACL endpoints -func (c *Client) ACL() *ACL { - return &ACL{c} -} - -// BootstrapRequest is used for when operators provide an ACL Bootstrap Token -type BootstrapRequest struct { - BootstrapSecret string -} - -// Bootstrap is used to perform a one-time ACL bootstrap operation on a cluster -// to get the first management token. -func (a *ACL) Bootstrap() (*ACLToken, *WriteMeta, error) { - return a.BootstrapWithToken("") -} - -// BootstrapWithToken is used to get the initial bootstrap token or pass in the one that was provided in the API -func (a *ACL) BootstrapWithToken(btoken string) (*ACLToken, *WriteMeta, error) { - r := a.c.newRequest("PUT", "/v1/acl/bootstrap") - if btoken != "" { - r.obj = &BootstrapRequest{ - BootstrapSecret: btoken, - } - } - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - wm := &WriteMeta{RequestTime: rtt} - var out ACLToken - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return &out, wm, nil -} - -// Create is used to generate a new token with the given parameters -// -// Deprecated: Use TokenCreate instead. -func (a *ACL) Create(acl *ACLEntry, q *WriteOptions) (string, *WriteMeta, error) { - r := a.c.newRequest("PUT", "/v1/acl/create") - r.setWriteOptions(q) - r.obj = acl - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return "", nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return "", nil, err - } - - wm := &WriteMeta{RequestTime: rtt} - var out struct{ ID string } - if err := decodeBody(resp, &out); err != nil { - return "", nil, err - } - return out.ID, wm, nil -} - -// Update is used to update the rules of an existing token -// -// Deprecated: Use TokenUpdate instead. -func (a *ACL) Update(acl *ACLEntry, q *WriteOptions) (*WriteMeta, error) { - r := a.c.newRequest("PUT", "/v1/acl/update") - r.setWriteOptions(q) - r.obj = acl - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - wm := &WriteMeta{RequestTime: rtt} - return wm, nil -} - -// Destroy is used to destroy a given ACL token ID -// -// Deprecated: Use TokenDelete instead. -func (a *ACL) Destroy(id string, q *WriteOptions) (*WriteMeta, error) { - r := a.c.newRequest("PUT", "/v1/acl/destroy/"+id) - r.setWriteOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, err - } - if err := requireOK(resp); err != nil { - return nil, err - } - closeResponseBody(resp) - - wm := &WriteMeta{RequestTime: rtt} - return wm, nil -} - -// Clone is used to return a new token cloned from an existing one -// -// Deprecated: Use TokenClone instead. -func (a *ACL) Clone(id string, q *WriteOptions) (string, *WriteMeta, error) { - r := a.c.newRequest("PUT", "/v1/acl/clone/"+id) - r.setWriteOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return "", nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return "", nil, err - } - - wm := &WriteMeta{RequestTime: rtt} - var out struct{ ID string } - if err := decodeBody(resp, &out); err != nil { - return "", nil, err - } - return out.ID, wm, nil -} - -// Info is used to query for information about an ACL token -// -// Deprecated: Use TokenRead instead. -func (a *ACL) Info(id string, q *QueryOptions) (*ACLEntry, *QueryMeta, error) { - r := a.c.newRequest("GET", "/v1/acl/info/"+id) - r.setQueryOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var entries []*ACLEntry - if err := decodeBody(resp, &entries); err != nil { - return nil, nil, err - } - if len(entries) > 0 { - return entries[0], qm, nil - } - return nil, qm, nil -} - -// List is used to get all the ACL tokens -// -// Deprecated: Use TokenList instead. -func (a *ACL) List(q *QueryOptions) ([]*ACLEntry, *QueryMeta, error) { - r := a.c.newRequest("GET", "/v1/acl/list") - r.setQueryOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var entries []*ACLEntry - if err := decodeBody(resp, &entries); err != nil { - return nil, nil, err - } - return entries, qm, nil -} - -// Replication returns the status of the ACL replication process in the datacenter -func (a *ACL) Replication(q *QueryOptions) (*ACLReplicationStatus, *QueryMeta, error) { - r := a.c.newRequest("GET", "/v1/acl/replication") - r.setQueryOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var entries *ACLReplicationStatus - if err := decodeBody(resp, &entries); err != nil { - return nil, nil, err - } - return entries, qm, nil -} - -// TokenCreate creates a new ACL token. If either the AccessorID or SecretID fields -// of the ACLToken structure are empty they will be filled in by Consul. -func (a *ACL) TokenCreate(token *ACLToken, q *WriteOptions) (*ACLToken, *WriteMeta, error) { - r := a.c.newRequest("PUT", "/v1/acl/token") - r.setWriteOptions(q) - r.obj = token - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - wm := &WriteMeta{RequestTime: rtt} - var out ACLToken - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, wm, nil -} - -// TokenUpdate updates a token in place without modifying its AccessorID or SecretID. A valid -// AccessorID must be set in the ACLToken structure passed to this function but the SecretID may -// be omitted and will be filled in by Consul with its existing value. -func (a *ACL) TokenUpdate(token *ACLToken, q *WriteOptions) (*ACLToken, *WriteMeta, error) { - if token.AccessorID == "" { - return nil, nil, fmt.Errorf("Must specify an AccessorID for Token Updating") - } - r := a.c.newRequest("PUT", "/v1/acl/token/"+token.AccessorID) - r.setWriteOptions(q) - r.obj = token - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - wm := &WriteMeta{RequestTime: rtt} - var out ACLToken - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, wm, nil -} - -// TokenClone will create a new token with the same policies and locality as the original -// token but will have its own auto-generated AccessorID and SecretID as well having the -// description passed to this function. The accessorID parameter must be a valid Accessor ID -// of an existing token. -func (a *ACL) TokenClone(accessorID string, description string, q *WriteOptions) (*ACLToken, *WriteMeta, error) { - if accessorID == "" { - return nil, nil, fmt.Errorf("Must specify a token AccessorID for Token Cloning") - } - - r := a.c.newRequest("PUT", "/v1/acl/token/"+accessorID+"/clone") - r.setWriteOptions(q) - r.obj = struct{ Description string }{description} - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - wm := &WriteMeta{RequestTime: rtt} - var out ACLToken - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, wm, nil -} - -// TokenDelete removes a single ACL token. The accessorID parameter must be a valid -// Accessor ID of an existing token. -func (a *ACL) TokenDelete(accessorID string, q *WriteOptions) (*WriteMeta, error) { - r := a.c.newRequest("DELETE", "/v1/acl/token/"+accessorID) - r.setWriteOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, err - } - if err := requireOK(resp); err != nil { - return nil, err - } - closeResponseBody(resp) - - wm := &WriteMeta{RequestTime: rtt} - return wm, nil -} - -// TokenRead retrieves the full token details. The accessorID parameter must be a valid -// Accessor ID of an existing token. -func (a *ACL) TokenRead(accessorID string, q *QueryOptions) (*ACLToken, *QueryMeta, error) { - r := a.c.newRequest("GET", "/v1/acl/token/"+accessorID) - r.setQueryOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out ACLToken - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, qm, nil -} - -// TokenReadExpanded retrieves the full token details, as well as the contents of any policies affecting the token. -// The accessorID parameter must be a valid Accessor ID of an existing token. -func (a *ACL) TokenReadExpanded(accessorID string, q *QueryOptions) (*ACLTokenExpanded, *QueryMeta, error) { - r := a.c.newRequest("GET", "/v1/acl/token/"+accessorID) - r.setQueryOptions(q) - r.params.Set("expanded", "true") - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out ACLTokenExpanded - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, qm, nil -} - -// TokenReadSelf retrieves the full token details of the token currently -// assigned to the API Client. In this manner its possible to read a token -// by its Secret ID. -func (a *ACL) TokenReadSelf(q *QueryOptions) (*ACLToken, *QueryMeta, error) { - r := a.c.newRequest("GET", "/v1/acl/token/self") - r.setQueryOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out ACLToken - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, qm, nil -} - -// TokenList lists all tokens. The listing does not contain any SecretIDs as those -// may only be retrieved by a call to TokenRead. -func (a *ACL) TokenList(q *QueryOptions) ([]*ACLTokenListEntry, *QueryMeta, error) { - r := a.c.newRequest("GET", "/v1/acl/tokens") - r.setQueryOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var entries []*ACLTokenListEntry - if err := decodeBody(resp, &entries); err != nil { - return nil, nil, err - } - return entries, qm, nil -} - -// TokenListFiltered lists all tokens that match the given filter options. -// The listing does not contain any SecretIDs as those may only be retrieved by a call to TokenRead. -func (a *ACL) TokenListFiltered(t ACLTokenFilterOptions, q *QueryOptions) ([]*ACLTokenListEntry, *QueryMeta, error) { - r := a.c.newRequest("GET", "/v1/acl/tokens") - r.setQueryOptions(q) - - if t.AuthMethod != "" { - r.params.Set("authmethod", t.AuthMethod) - } - if t.Policy != "" { - r.params.Set("policy", t.Policy) - } - if t.Role != "" { - r.params.Set("role", t.Role) - } - if t.ServiceName != "" { - r.params.Set("servicename", t.ServiceName) - } - - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var entries []*ACLTokenListEntry - if err := decodeBody(resp, &entries); err != nil { - return nil, nil, err - } - return entries, qm, nil -} - -// PolicyCreate will create a new policy. It is not allowed for the policy parameters -// ID field to be set as this will be generated by Consul while processing the request. -func (a *ACL) PolicyCreate(policy *ACLPolicy, q *WriteOptions) (*ACLPolicy, *WriteMeta, error) { - if policy.ID != "" { - return nil, nil, fmt.Errorf("Cannot specify an ID in Policy Creation") - } - r := a.c.newRequest("PUT", "/v1/acl/policy") - r.setWriteOptions(q) - r.obj = policy - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - wm := &WriteMeta{RequestTime: rtt} - var out ACLPolicy - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, wm, nil -} - -// PolicyUpdate updates a policy. The ID field of the policy parameter must be set to an -// existing policy ID -func (a *ACL) PolicyUpdate(policy *ACLPolicy, q *WriteOptions) (*ACLPolicy, *WriteMeta, error) { - if policy.ID == "" { - return nil, nil, fmt.Errorf("Must specify an ID in Policy Update") - } - - r := a.c.newRequest("PUT", "/v1/acl/policy/"+policy.ID) - r.setWriteOptions(q) - r.obj = policy - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - wm := &WriteMeta{RequestTime: rtt} - var out ACLPolicy - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, wm, nil -} - -// PolicyDelete deletes a policy given its ID. -func (a *ACL) PolicyDelete(policyID string, q *WriteOptions) (*WriteMeta, error) { - r := a.c.newRequest("DELETE", "/v1/acl/policy/"+policyID) - r.setWriteOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, err - } - closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - wm := &WriteMeta{RequestTime: rtt} - return wm, nil -} - -// PolicyRead retrieves the policy details including the rule set. -func (a *ACL) PolicyRead(policyID string, q *QueryOptions) (*ACLPolicy, *QueryMeta, error) { - r := a.c.newRequest("GET", "/v1/acl/policy/"+policyID) - r.setQueryOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out ACLPolicy - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, qm, nil -} - -// PolicyReadByName retrieves the policy details including the rule set with name. -func (a *ACL) PolicyReadByName(policyName string, q *QueryOptions) (*ACLPolicy, *QueryMeta, error) { - r := a.c.newRequest("GET", "/v1/acl/policy/name/"+url.QueryEscape(policyName)) - r.setQueryOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - found, resp, err := requireNotFoundOrOK(resp) - if err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - if !found { - return nil, qm, nil - } - - var out ACLPolicy - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, qm, nil -} - -// PolicyList retrieves a listing of all policies. The listing does not include the -// rules for any policy as those should be retrieved by subsequent calls to PolicyRead. -func (a *ACL) PolicyList(q *QueryOptions) ([]*ACLPolicyListEntry, *QueryMeta, error) { - r := a.c.newRequest("GET", "/v1/acl/policies") - r.setQueryOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var entries []*ACLPolicyListEntry - if err := decodeBody(resp, &entries); err != nil { - return nil, nil, err - } - return entries, qm, nil -} - -// RulesTranslate translates the legacy rule syntax into the current syntax. -// -// Deprecated: Support for the legacy syntax translation has been removed. -// This function always returns an error. -func (a *ACL) RulesTranslate(rules io.Reader) (string, error) { - return "", fmt.Errorf("Legacy ACL rules were deprecated in Consul 1.4") -} - -// RulesTranslateToken translates the rules associated with the legacy syntax -// into the current syntax and returns the results. -// -// Deprecated: Support for the legacy syntax translation has been removed. -// This function always returns an error. -func (a *ACL) RulesTranslateToken(tokenID string) (string, error) { - return "", fmt.Errorf("Legacy ACL tokens and rules were deprecated in Consul 1.4") -} - -// RoleCreate will create a new role. It is not allowed for the role parameters -// ID field to be set as this will be generated by Consul while processing the request. -func (a *ACL) RoleCreate(role *ACLRole, q *WriteOptions) (*ACLRole, *WriteMeta, error) { - if role.ID != "" { - return nil, nil, fmt.Errorf("Cannot specify an ID in Role Creation") - } - - r := a.c.newRequest("PUT", "/v1/acl/role") - r.setWriteOptions(q) - r.obj = role - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - wm := &WriteMeta{RequestTime: rtt} - var out ACLRole - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, wm, nil -} - -// RoleUpdate updates a role. The ID field of the role parameter must be set to an -// existing role ID -func (a *ACL) RoleUpdate(role *ACLRole, q *WriteOptions) (*ACLRole, *WriteMeta, error) { - if role.ID == "" { - return nil, nil, fmt.Errorf("Must specify an ID in Role Update") - } - - r := a.c.newRequest("PUT", "/v1/acl/role/"+role.ID) - r.setWriteOptions(q) - r.obj = role - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - wm := &WriteMeta{RequestTime: rtt} - var out ACLRole - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, wm, nil -} - -// RoleDelete deletes a role given its ID. -func (a *ACL) RoleDelete(roleID string, q *WriteOptions) (*WriteMeta, error) { - r := a.c.newRequest("DELETE", "/v1/acl/role/"+roleID) - r.setWriteOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, err - } - if err := requireOK(resp); err != nil { - return nil, err - } - closeResponseBody(resp) - - wm := &WriteMeta{RequestTime: rtt} - return wm, nil -} - -// RoleRead retrieves the role details (by ID). Returns nil if not found. -func (a *ACL) RoleRead(roleID string, q *QueryOptions) (*ACLRole, *QueryMeta, error) { - r := a.c.newRequest("GET", "/v1/acl/role/"+roleID) - r.setQueryOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - found, resp, err := requireNotFoundOrOK(resp) - if err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - if !found { - return nil, qm, nil - } - - var out ACLRole - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, qm, nil -} - -// RoleReadByName retrieves the role details (by name). Returns nil if not found. -func (a *ACL) RoleReadByName(roleName string, q *QueryOptions) (*ACLRole, *QueryMeta, error) { - r := a.c.newRequest("GET", "/v1/acl/role/name/"+url.QueryEscape(roleName)) - r.setQueryOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - found, resp, err := requireNotFoundOrOK(resp) - if err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - if !found { - return nil, qm, nil - } - - var out ACLRole - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, qm, nil -} - -// RoleList retrieves a listing of all roles. The listing does not include some -// metadata for the role as those should be retrieved by subsequent calls to -// RoleRead. -func (a *ACL) RoleList(q *QueryOptions) ([]*ACLRole, *QueryMeta, error) { - r := a.c.newRequest("GET", "/v1/acl/roles") - r.setQueryOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var entries []*ACLRole - if err := decodeBody(resp, &entries); err != nil { - return nil, nil, err - } - return entries, qm, nil -} - -// AuthMethodCreate will create a new auth method. -func (a *ACL) AuthMethodCreate(method *ACLAuthMethod, q *WriteOptions) (*ACLAuthMethod, *WriteMeta, error) { - if method.Name == "" { - return nil, nil, fmt.Errorf("Must specify a Name in Auth Method Creation") - } - - r := a.c.newRequest("PUT", "/v1/acl/auth-method") - r.setWriteOptions(q) - r.obj = method - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - wm := &WriteMeta{RequestTime: rtt} - var out ACLAuthMethod - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, wm, nil -} - -// AuthMethodUpdate updates an auth method. -func (a *ACL) AuthMethodUpdate(method *ACLAuthMethod, q *WriteOptions) (*ACLAuthMethod, *WriteMeta, error) { - if method.Name == "" { - return nil, nil, fmt.Errorf("Must specify a Name in Auth Method Update") - } - - r := a.c.newRequest("PUT", "/v1/acl/auth-method/"+url.QueryEscape(method.Name)) - r.setWriteOptions(q) - r.obj = method - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - wm := &WriteMeta{RequestTime: rtt} - var out ACLAuthMethod - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, wm, nil -} - -// AuthMethodDelete deletes an auth method given its Name. -func (a *ACL) AuthMethodDelete(methodName string, q *WriteOptions) (*WriteMeta, error) { - if methodName == "" { - return nil, fmt.Errorf("Must specify a Name in Auth Method Delete") - } - - r := a.c.newRequest("DELETE", "/v1/acl/auth-method/"+url.QueryEscape(methodName)) - r.setWriteOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, err - } - if err := requireOK(resp); err != nil { - return nil, err - } - closeResponseBody(resp) - - wm := &WriteMeta{RequestTime: rtt} - return wm, nil -} - -// AuthMethodRead retrieves the auth method. Returns nil if not found. -func (a *ACL) AuthMethodRead(methodName string, q *QueryOptions) (*ACLAuthMethod, *QueryMeta, error) { - if methodName == "" { - return nil, nil, fmt.Errorf("Must specify a Name in Auth Method Read") - } - - r := a.c.newRequest("GET", "/v1/acl/auth-method/"+url.QueryEscape(methodName)) - r.setQueryOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - found, resp, err := requireNotFoundOrOK(resp) - if err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - if !found { - return nil, qm, nil - } - - var out ACLAuthMethod - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, qm, nil -} - -// AuthMethodList retrieves a listing of all auth methods. The listing does not -// include some metadata for the auth method as those should be retrieved by -// subsequent calls to AuthMethodRead. -func (a *ACL) AuthMethodList(q *QueryOptions) ([]*ACLAuthMethodListEntry, *QueryMeta, error) { - r := a.c.newRequest("GET", "/v1/acl/auth-methods") - r.setQueryOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var entries []*ACLAuthMethodListEntry - if err := decodeBody(resp, &entries); err != nil { - return nil, nil, err - } - return entries, qm, nil -} - -// BindingRuleCreate will create a new binding rule. It is not allowed for the -// binding rule parameter's ID field to be set as this will be generated by -// Consul while processing the request. -func (a *ACL) BindingRuleCreate(rule *ACLBindingRule, q *WriteOptions) (*ACLBindingRule, *WriteMeta, error) { - if rule.ID != "" { - return nil, nil, fmt.Errorf("Cannot specify an ID in Binding Rule Creation") - } - - r := a.c.newRequest("PUT", "/v1/acl/binding-rule") - r.setWriteOptions(q) - r.obj = rule - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - wm := &WriteMeta{RequestTime: rtt} - var out ACLBindingRule - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, wm, nil -} - -// BindingRuleUpdate updates a binding rule. The ID field of the role binding -// rule parameter must be set to an existing binding rule ID. -func (a *ACL) BindingRuleUpdate(rule *ACLBindingRule, q *WriteOptions) (*ACLBindingRule, *WriteMeta, error) { - if rule.ID == "" { - return nil, nil, fmt.Errorf("Must specify an ID in Binding Rule Update") - } - - r := a.c.newRequest("PUT", "/v1/acl/binding-rule/"+rule.ID) - r.setWriteOptions(q) - r.obj = rule - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - wm := &WriteMeta{RequestTime: rtt} - var out ACLBindingRule - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, wm, nil -} - -// BindingRuleDelete deletes a binding rule given its ID. -func (a *ACL) BindingRuleDelete(bindingRuleID string, q *WriteOptions) (*WriteMeta, error) { - r := a.c.newRequest("DELETE", "/v1/acl/binding-rule/"+bindingRuleID) - r.setWriteOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - wm := &WriteMeta{RequestTime: rtt} - return wm, nil -} - -// BindingRuleRead retrieves the binding rule details. Returns nil if not found. -func (a *ACL) BindingRuleRead(bindingRuleID string, q *QueryOptions) (*ACLBindingRule, *QueryMeta, error) { - r := a.c.newRequest("GET", "/v1/acl/binding-rule/"+bindingRuleID) - r.setQueryOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - found, resp, err := requireNotFoundOrOK(resp) - if err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - if !found { - return nil, qm, nil - } - - var out ACLBindingRule - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, qm, nil -} - -// BindingRuleList retrieves a listing of all binding rules. -func (a *ACL) BindingRuleList(methodName string, q *QueryOptions) ([]*ACLBindingRule, *QueryMeta, error) { - r := a.c.newRequest("GET", "/v1/acl/binding-rules") - if methodName != "" { - r.params.Set("authmethod", methodName) - } - r.setQueryOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var entries []*ACLBindingRule - if err := decodeBody(resp, &entries); err != nil { - return nil, nil, err - } - return entries, qm, nil -} - -// Login is used to exchange auth method credentials for a newly-minted Consul Token. -func (a *ACL) Login(auth *ACLLoginParams, q *WriteOptions) (*ACLToken, *WriteMeta, error) { - r := a.c.newRequest("POST", "/v1/acl/login") - r.setWriteOptions(q) - r.obj = auth - - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - wm := &WriteMeta{RequestTime: rtt} - var out ACLToken - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return &out, wm, nil -} - -// Logout is used to destroy a Consul Token created via Login(). -func (a *ACL) Logout(q *WriteOptions) (*WriteMeta, error) { - r := a.c.newRequest("POST", "/v1/acl/logout") - r.setWriteOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, err - } - if err := requireOK(resp); err != nil { - return nil, err - } - closeResponseBody(resp) - - wm := &WriteMeta{RequestTime: rtt} - return wm, nil -} - -// OIDCAuthURL requests an authorization URL to start an OIDC login flow. -func (a *ACL) OIDCAuthURL(auth *ACLOIDCAuthURLParams, q *WriteOptions) (string, *WriteMeta, error) { - if auth.AuthMethod == "" { - return "", nil, fmt.Errorf("Must specify an auth method name") - } - - r := a.c.newRequest("POST", "/v1/acl/oidc/auth-url") - r.setWriteOptions(q) - r.obj = auth - - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return "", nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return "", nil, err - } - - wm := &WriteMeta{RequestTime: rtt} - var out aclOIDCAuthURLResponse - if err := decodeBody(resp, &out); err != nil { - return "", nil, err - } - return out.AuthURL, wm, nil -} - -type aclOIDCAuthURLResponse struct { - AuthURL string -} - -type ACLOIDCCallbackParams struct { - AuthMethod string - State string - Code string - ClientNonce string -} - -// OIDCCallback is the callback endpoint to complete an OIDC login. -func (a *ACL) OIDCCallback(auth *ACLOIDCCallbackParams, q *WriteOptions) (*ACLToken, *WriteMeta, error) { - if auth.AuthMethod == "" { - return nil, nil, fmt.Errorf("Must specify an auth method name") - } - - r := a.c.newRequest("POST", "/v1/acl/oidc/callback") - r.setWriteOptions(q) - r.obj = auth - - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - wm := &WriteMeta{RequestTime: rtt} - var out ACLToken - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return &out, wm, nil -} - -// TemplatedPolicyReadByName retrieves the templated policy details (by name). Returns nil if not found. -func (a *ACL) TemplatedPolicyReadByName(templateName string, q *QueryOptions) (*ACLTemplatedPolicyResponse, *QueryMeta, error) { - r := a.c.newRequest("GET", "/v1/acl/templated-policy/name/"+templateName) - r.setQueryOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - found, resp, err := requireNotFoundOrOK(resp) - if err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - if !found { - return nil, qm, nil - } - - var out ACLTemplatedPolicyResponse - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, qm, nil -} - -// TemplatedPolicyList retrieves a listing of all templated policies. -func (a *ACL) TemplatedPolicyList(q *QueryOptions) (map[string]ACLTemplatedPolicyResponse, *QueryMeta, error) { - r := a.c.newRequest("GET", "/v1/acl/templated-policies") - r.setQueryOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var entries map[string]ACLTemplatedPolicyResponse - if err := decodeBody(resp, &entries); err != nil { - return nil, nil, err - } - return entries, qm, nil -} - -// TemplatedPolicyPreview is used to preview the policy rendered by the templated policy. -func (a *ACL) TemplatedPolicyPreview(tp *ACLTemplatedPolicy, q *WriteOptions) (*ACLPolicy, *WriteMeta, error) { - r := a.c.newRequest("POST", "/v1/acl/templated-policy/preview/"+tp.TemplateName) - r.setWriteOptions(q) - r.obj = tp.TemplateVariables - - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - wm := &WriteMeta{RequestTime: rtt} - var out ACLPolicy - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return &out, wm, nil -} diff --git a/vendor/github.com/hashicorp/consul/api/agent.go b/vendor/github.com/hashicorp/consul/api/agent.go deleted file mode 100644 index 24e2c50d6..000000000 --- a/vendor/github.com/hashicorp/consul/api/agent.go +++ /dev/null @@ -1,1446 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "bufio" - "context" - "errors" - "fmt" - "io" - "net/http" -) - -// ServiceKind is the kind of service being registered. -type ServiceKind string - -const ( - // ServiceKindTypical is a typical, classic Consul service. This is - // represented by the absence of a value. This was chosen for ease of - // backwards compatibility: existing services in the catalog would - // default to the typical service. - ServiceKindTypical ServiceKind = "" - - // ServiceKindConnectProxy is a proxy for the Connect feature. This - // service proxies another service within Consul and speaks the connect - // protocol. - ServiceKindConnectProxy ServiceKind = "connect-proxy" - - // ServiceKindMeshGateway is a Mesh Gateway for the Connect feature. This - // service will proxy connections based off the SNI header set by other - // connect proxies - ServiceKindMeshGateway ServiceKind = "mesh-gateway" - - // ServiceKindTerminatingGateway is a Terminating Gateway for the Connect - // feature. This service will proxy connections to services outside the mesh. - ServiceKindTerminatingGateway ServiceKind = "terminating-gateway" - - // ServiceKindIngressGateway is an Ingress Gateway for the Connect feature. - // This service will ingress connections based of configuration defined in - // the ingress-gateway config entry. - ServiceKindIngressGateway ServiceKind = "ingress-gateway" - - // ServiceKindAPIGateway is an API Gateway for the Connect feature. - // This service will ingress connections based of configuration defined in - // the api-gateway config entry. - ServiceKindAPIGateway ServiceKind = "api-gateway" -) - -// UpstreamDestType is the type of upstream discovery mechanism. -type UpstreamDestType string - -const ( - // UpstreamDestTypeService discovers instances via healthy service lookup. - UpstreamDestTypeService UpstreamDestType = "service" - - // UpstreamDestTypePreparedQuery discovers instances via prepared query - // execution. - UpstreamDestTypePreparedQuery UpstreamDestType = "prepared_query" -) - -// AgentCheck represents a check known to the agent -type AgentCheck struct { - Node string - CheckID string - Name string - Status string - Notes string - Output string - ServiceID string - ServiceName string - Type string - ExposedPort int - Definition HealthCheckDefinition - Namespace string `json:",omitempty"` - Partition string `json:",omitempty"` -} - -// AgentWeights represent optional weights for a service -type AgentWeights struct { - Passing int - Warning int -} - -// AgentService represents a service known to the agent -type AgentService struct { - Kind ServiceKind `json:",omitempty"` - ID string - Service string - Tags []string - Meta map[string]string - Port int - Address string - SocketPath string `json:",omitempty"` - TaggedAddresses map[string]ServiceAddress `json:",omitempty"` - Weights AgentWeights - EnableTagOverride bool - CreateIndex uint64 `json:",omitempty" bexpr:"-"` - ModifyIndex uint64 `json:",omitempty" bexpr:"-"` - ContentHash string `json:",omitempty" bexpr:"-"` - Proxy *AgentServiceConnectProxyConfig `json:",omitempty"` - Connect *AgentServiceConnect `json:",omitempty"` - PeerName string `json:",omitempty"` - // NOTE: If we ever set the ContentHash outside of singular service lookup then we may need - // to include the Namespace in the hash. When we do, then we are in for lots of fun with tests. - // For now though, ignoring it works well enough. - Namespace string `json:",omitempty" bexpr:"-" hash:"ignore"` - Partition string `json:",omitempty" bexpr:"-" hash:"ignore"` - // Datacenter is only ever returned and is ignored if presented. - Datacenter string `json:",omitempty" bexpr:"-" hash:"ignore"` - Locality *Locality `json:",omitempty" bexpr:"-" hash:"ignore"` -} - -// AgentServiceChecksInfo returns information about a Service and its checks -type AgentServiceChecksInfo struct { - AggregatedStatus string - Service *AgentService - Checks HealthChecks -} - -// AgentServiceConnect represents the Connect configuration of a service. -type AgentServiceConnect struct { - Native bool `json:",omitempty"` - SidecarService *AgentServiceRegistration `json:",omitempty" bexpr:"-"` -} - -// AgentServiceConnectProxyConfig is the proxy configuration in a connect-proxy -// ServiceDefinition or response. -type AgentServiceConnectProxyConfig struct { - EnvoyExtensions []EnvoyExtension `json:",omitempty"` - DestinationServiceName string `json:",omitempty"` - DestinationServiceID string `json:",omitempty"` - LocalServiceAddress string `json:",omitempty"` - LocalServicePort int `json:",omitempty"` - LocalServiceSocketPath string `json:",omitempty"` - Mode ProxyMode `json:",omitempty"` - TransparentProxy *TransparentProxyConfig `json:",omitempty"` - Config map[string]interface{} `json:",omitempty" bexpr:"-"` - Upstreams []Upstream `json:",omitempty"` - MeshGateway MeshGatewayConfig `json:",omitempty"` - Expose ExposeConfig `json:",omitempty"` - AccessLogs *AccessLogsConfig `json:",omitempty"` -} - -const ( - // MemberTagKeyACLMode is the key used to indicate what ACL mode the agent is - // operating in. The values of this key will be one of the MemberACLMode constants - // with the key not being present indicating ACLModeUnknown. - MemberTagKeyACLMode = "acls" - - // MemberTagRole is the key used to indicate that the member is a server or not. - MemberTagKeyRole = "role" - - // MemberTagValueRoleServer is the value of the MemberTagKeyRole used to indicate - // that the member represents a Consul server. - MemberTagValueRoleServer = "consul" - - // MemberTagValueRoleClient is the value of the MemberTagKeyRole used to indicate - // that the member represents a Consul client. - MemberTagValueRoleClient = "node" - - // MemberTagKeyDatacenter is the key used to indicate which datacenter this member is in. - MemberTagKeyDatacenter = "dc" - - // MemberTagKeySegment is the key name of the tag used to indicate which network - // segment this member is in. - // Network Segments are a Consul Enterprise feature. - MemberTagKeySegment = "segment" - - // MemberTagKeyPartition is the key name of the tag used to indicate which partition - // this member is in. - // Partitions are a Consul Enterprise feature. - MemberTagKeyPartition = "ap" - - // MemberTagKeyBootstrap is the key name of the tag used to indicate whether this - // agent was started with the "bootstrap" configuration enabled - MemberTagKeyBootstrap = "bootstrap" - // MemberTagValueBootstrap is the value of the MemberTagKeyBootstrap key when the - // agent was started with the "bootstrap" configuration enabled. - MemberTagValueBootstrap = "1" - - // MemberTagKeyBootstrapExpect is the key name of the tag used to indicate whether - // this agent was started with the "bootstrap_expect" configuration set to a non-zero - // value. The value of this key will be the string for of that configuration value. - MemberTagKeyBootstrapExpect = "expect" - - // MemberTagKeyUseTLS is the key name of the tag used to indicate whther this agent - // was configured to use TLS. - MemberTagKeyUseTLS = "use_tls" - // MemberTagValueUseTLS is the value of the MemberTagKeyUseTLS when the agent was - // configured to use TLS. Any other value indicates that it was not setup in - // that manner. - MemberTagValueUseTLS = "1" - - // MemberTagKeyReadReplica is the key used to indicate that the member is a read - // replica server (will remain a Raft non-voter). - // Read Replicas are a Consul Enterprise feature. - MemberTagKeyReadReplica = "read_replica" - // MemberTagValueReadReplica is the value of the MemberTagKeyReadReplica key when - // the member is in fact a read-replica. Any other value indicates that it is not. - // Read Replicas are a Consul Enterprise feature. - MemberTagValueReadReplica = "1" -) - -type MemberACLMode string - -const ( - // ACLModeDisables indicates that ACLs are disabled for this agent - ACLModeDisabled MemberACLMode = "0" - // ACLModeEnabled indicates that ACLs are enabled and operating in new ACL - // mode (v1.4.0+ ACLs) - ACLModeEnabled MemberACLMode = "1" - // ACLModeLegacy has been deprecated, and will be treated as ACLModeUnknown. - ACLModeLegacy MemberACLMode = "2" // DEPRECATED - // ACLModeUnkown is used to indicate that the AgentMember.Tags didn't advertise - // an ACL mode at all. This is the case for Consul versions before v1.4.0 and - // should be treated the same as ACLModeLegacy. - ACLModeUnknown MemberACLMode = "3" -) - -// AgentMember represents a cluster member known to the agent -type AgentMember struct { - Name string - Addr string - Port uint16 - Tags map[string]string - // Status of the Member which corresponds to github.com/hashicorp/serf/serf.MemberStatus - // Value is one of: - // - // AgentMemberNone = 0 - // AgentMemberAlive = 1 - // AgentMemberLeaving = 2 - // AgentMemberLeft = 3 - // AgentMemberFailed = 4 - Status int - ProtocolMin uint8 - ProtocolMax uint8 - ProtocolCur uint8 - DelegateMin uint8 - DelegateMax uint8 - DelegateCur uint8 -} - -// ACLMode returns the ACL mode this agent is operating in. -func (m *AgentMember) ACLMode() MemberACLMode { - mode := m.Tags[MemberTagKeyACLMode] - - // the key may not have existed but then an - // empty string will be returned and we will - // handle that in the default case of the switch - switch MemberACLMode(mode) { - case ACLModeDisabled: - return ACLModeDisabled - case ACLModeEnabled: - return ACLModeEnabled - default: - return ACLModeUnknown - } -} - -// IsConsulServer returns true when this member is a Consul server. -func (m *AgentMember) IsConsulServer() bool { - return m.Tags[MemberTagKeyRole] == MemberTagValueRoleServer -} - -// AllSegments is used to select for all segments in MembersOpts. -const AllSegments = "_all" - -// MembersOpts is used for querying member information. -type MembersOpts struct { - // WAN is whether to show members from the WAN. - WAN bool - - // Segment is the LAN segment to show members for. Setting this to the - // AllSegments value above will show members in all segments. - Segment string - - Filter string -} - -// AgentServiceRegistration is used to register a new service -type AgentServiceRegistration struct { - Kind ServiceKind `json:",omitempty"` - ID string `json:",omitempty"` - Name string `json:",omitempty"` - Tags []string `json:",omitempty"` - Port int `json:",omitempty"` - Address string `json:",omitempty"` - SocketPath string `json:",omitempty"` - TaggedAddresses map[string]ServiceAddress `json:",omitempty"` - EnableTagOverride bool `json:",omitempty"` - Meta map[string]string `json:",omitempty"` - Weights *AgentWeights `json:",omitempty"` - Check *AgentServiceCheck - Checks AgentServiceChecks - Proxy *AgentServiceConnectProxyConfig `json:",omitempty"` - Connect *AgentServiceConnect `json:",omitempty"` - Namespace string `json:",omitempty" bexpr:"-" hash:"ignore"` - Partition string `json:",omitempty" bexpr:"-" hash:"ignore"` - Locality *Locality `json:",omitempty" bexpr:"-" hash:"ignore"` -} - -// ServiceRegisterOpts is used to pass extra options to the service register. -type ServiceRegisterOpts struct { - // Missing healthchecks will be deleted from the agent. - // Using this parameter allows to idempotently register a service and its checks without - // having to manually deregister checks. - ReplaceExistingChecks bool - - // Token is used to provide a per-request ACL token - // which overrides the agent's default token. - Token string - - // ctx is an optional context pass through to the underlying HTTP - // request layer. Use WithContext() to set the context. - ctx context.Context -} - -// WithContext sets the context to be used for the request on a new ServiceRegisterOpts, -// and returns the opts. -func (o ServiceRegisterOpts) WithContext(ctx context.Context) ServiceRegisterOpts { - o.ctx = ctx - return o -} - -// AgentCheckRegistration is used to register a new check -type AgentCheckRegistration struct { - ID string `json:",omitempty"` - Name string `json:",omitempty"` - Notes string `json:",omitempty"` - ServiceID string `json:",omitempty"` - AgentServiceCheck - Namespace string `json:",omitempty"` - Partition string `json:",omitempty"` -} - -// AgentServiceCheck is used to define a node or service level check -type AgentServiceCheck struct { - CheckID string `json:",omitempty"` - Name string `json:",omitempty"` - Args []string `json:"ScriptArgs,omitempty"` - DockerContainerID string `json:",omitempty"` - Shell string `json:",omitempty"` // Only supported for Docker. - Interval string `json:",omitempty"` - Timeout string `json:",omitempty"` - TTL string `json:",omitempty"` - HTTP string `json:",omitempty"` - Header map[string][]string `json:",omitempty"` - Method string `json:",omitempty"` - Body string `json:",omitempty"` - TCP string `json:",omitempty"` - TCPUseTLS bool `json:",omitempty"` - UDP string `json:",omitempty"` - Status string `json:",omitempty"` - Notes string `json:",omitempty"` - TLSServerName string `json:",omitempty"` - TLSSkipVerify bool `json:",omitempty"` - GRPC string `json:",omitempty"` - GRPCUseTLS bool `json:",omitempty"` - H2PING string `json:",omitempty"` - H2PingUseTLS bool `json:",omitempty"` - AliasNode string `json:",omitempty"` - AliasService string `json:",omitempty"` - SuccessBeforePassing int `json:",omitempty"` - FailuresBeforeWarning int `json:",omitempty"` - FailuresBeforeCritical int `json:",omitempty"` - - // In Consul 0.7 and later, checks that are associated with a service - // may also contain this optional DeregisterCriticalServiceAfter field, - // which is a timeout in the same Go time format as Interval and TTL. If - // a check is in the critical state for more than this configured value, - // then its associated service (and all of its associated checks) will - // automatically be deregistered. - DeregisterCriticalServiceAfter string `json:",omitempty"` -} -type AgentServiceChecks []*AgentServiceCheck - -// AgentToken is used when updating ACL tokens for an agent. -type AgentToken struct { - Token string -} - -// Metrics info is used to store different types of metric values from the agent. -type MetricsInfo struct { - Timestamp string - Gauges []GaugeValue - Points []PointValue - Counters []SampledValue - Samples []SampledValue -} - -// GaugeValue stores one value that is updated as time goes on, such as -// the amount of memory allocated. -type GaugeValue struct { - Name string - Value float32 - Labels map[string]string -} - -// PointValue holds a series of points for a metric. -type PointValue struct { - Name string - Points []float32 -} - -// SampledValue stores info about a metric that is incremented over time, -// such as the number of requests to an HTTP endpoint. -type SampledValue struct { - Name string - Count int - Sum float64 - Min float64 - Max float64 - Mean float64 - Stddev float64 - Labels map[string]string -} - -// AgentAuthorizeParams are the request parameters for authorizing a request. -type AgentAuthorizeParams struct { - Target string - ClientCertURI string - ClientCertSerial string -} - -// AgentAuthorize is the response structure for Connect authorization. -type AgentAuthorize struct { - Authorized bool - Reason string -} - -// ConnectProxyConfig is the response structure for agent-local proxy -// configuration. -type ConnectProxyConfig struct { - ProxyServiceID string - TargetServiceID string - TargetServiceName string - ContentHash string - Config map[string]interface{} `bexpr:"-"` - Upstreams []Upstream -} - -// Upstream is the response structure for a proxy upstream configuration. -type Upstream struct { - DestinationType UpstreamDestType `json:",omitempty"` - DestinationPartition string `json:",omitempty"` - DestinationNamespace string `json:",omitempty"` - DestinationPeer string `json:",omitempty"` - DestinationName string - Datacenter string `json:",omitempty"` - LocalBindAddress string `json:",omitempty"` - LocalBindPort int `json:",omitempty"` - LocalBindSocketPath string `json:",omitempty"` - LocalBindSocketMode string `json:",omitempty"` - Config map[string]interface{} `json:",omitempty" bexpr:"-"` - MeshGateway MeshGatewayConfig `json:",omitempty"` - CentrallyConfigured bool `json:",omitempty" bexpr:"-"` -} - -// Agent can be used to query the Agent endpoints -type Agent struct { - c *Client - - // cache the node name - nodeName string -} - -// Agent returns a handle to the agent endpoints -func (c *Client) Agent() *Agent { - return &Agent{c: c} -} - -// Self is used to query the agent we are speaking to for -// information about itself -func (a *Agent) Self() (map[string]map[string]interface{}, error) { - r := a.c.newRequest("GET", "/v1/agent/self") - _, resp, err := a.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - var out map[string]map[string]interface{} - if err := decodeBody(resp, &out); err != nil { - return nil, err - } - return out, nil -} - -// Host is used to retrieve information about the host the -// agent is running on such as CPU, memory, and disk. Requires -// a operator:read ACL token. -func (a *Agent) Host() (map[string]interface{}, error) { - r := a.c.newRequest("GET", "/v1/agent/host") - _, resp, err := a.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - var out map[string]interface{} - if err := decodeBody(resp, &out); err != nil { - return nil, err - } - return out, nil -} - -// Version is used to retrieve information about the running Consul version and build. -func (a *Agent) Version() (map[string]interface{}, error) { - r := a.c.newRequest("GET", "/v1/agent/version") - _, resp, err := a.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - var out map[string]interface{} - if err := decodeBody(resp, &out); err != nil { - return nil, err - } - return out, nil -} - -// Metrics is used to query the agent we are speaking to for -// its current internal metric data -func (a *Agent) Metrics() (*MetricsInfo, error) { - r := a.c.newRequest("GET", "/v1/agent/metrics") - _, resp, err := a.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - var out *MetricsInfo - if err := decodeBody(resp, &out); err != nil { - return nil, err - } - return out, nil -} - -// MetricsStream returns an io.ReadCloser which will emit a stream of metrics -// until the context is cancelled. The metrics are json encoded. -// The caller is responsible for closing the returned io.ReadCloser. -func (a *Agent) MetricsStream(ctx context.Context) (io.ReadCloser, error) { - r := a.c.newRequest("GET", "/v1/agent/metrics/stream") - r.ctx = ctx - _, resp, err := a.c.doRequest(r) - if err != nil { - return nil, err - } - if err := requireOK(resp); err != nil { - return nil, err - } - return resp.Body, nil -} - -// Reload triggers a configuration reload for the agent we are connected to. -func (a *Agent) Reload() error { - r := a.c.newRequest("PUT", "/v1/agent/reload") - _, resp, err := a.c.doRequest(r) - if err != nil { - return err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return err - } - return nil -} - -// NodeName is used to get the node name of the agent -func (a *Agent) NodeName() (string, error) { - if a.nodeName != "" { - return a.nodeName, nil - } - info, err := a.Self() - if err != nil { - return "", err - } - name := info["Config"]["NodeName"].(string) - a.nodeName = name - return name, nil -} - -// Checks returns the locally registered checks -func (a *Agent) Checks() (map[string]*AgentCheck, error) { - return a.ChecksWithFilter("") -} - -// ChecksWithFilter returns a subset of the locally registered checks that match -// the given filter expression -func (a *Agent) ChecksWithFilter(filter string) (map[string]*AgentCheck, error) { - return a.ChecksWithFilterOpts(filter, nil) -} - -// ChecksWithFilterOpts returns a subset of the locally registered checks that match -// the given filter expression and QueryOptions. -func (a *Agent) ChecksWithFilterOpts(filter string, q *QueryOptions) (map[string]*AgentCheck, error) { - r := a.c.newRequest("GET", "/v1/agent/checks") - r.setQueryOptions(q) - r.filterQuery(filter) - _, resp, err := a.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - var out map[string]*AgentCheck - if err := decodeBody(resp, &out); err != nil { - return nil, err - } - return out, nil -} - -// Services returns the locally registered services -func (a *Agent) Services() (map[string]*AgentService, error) { - return a.ServicesWithFilter("") -} - -// ServicesWithFilter returns a subset of the locally registered services that match -// the given filter expression -func (a *Agent) ServicesWithFilter(filter string) (map[string]*AgentService, error) { - return a.ServicesWithFilterOpts(filter, nil) -} - -// ServicesWithFilterOpts returns a subset of the locally registered services that match -// the given filter expression and QueryOptions. -func (a *Agent) ServicesWithFilterOpts(filter string, q *QueryOptions) (map[string]*AgentService, error) { - r := a.c.newRequest("GET", "/v1/agent/services") - r.setQueryOptions(q) - r.filterQuery(filter) - _, resp, err := a.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - var out map[string]*AgentService - if err := decodeBody(resp, &out); err != nil { - return nil, err - } - - return out, nil -} - -// AgentHealthServiceByID returns for a given serviceID: the aggregated health status, the service definition or an error if any -// - If the service is not found, will return status (critical, nil, nil) -// - If the service is found, will return (critical|passing|warning), AgentServiceChecksInfo, nil) -// - In all other cases, will return an error -func (a *Agent) AgentHealthServiceByID(serviceID string) (string, *AgentServiceChecksInfo, error) { - return a.AgentHealthServiceByIDOpts(serviceID, nil) -} - -func (a *Agent) AgentHealthServiceByIDOpts(serviceID string, q *QueryOptions) (string, *AgentServiceChecksInfo, error) { - path := fmt.Sprintf("/v1/agent/health/service/id/%v", serviceID) - r := a.c.newRequest("GET", path) - r.setQueryOptions(q) - r.params.Add("format", "json") - r.header.Set("Accept", "application/json") - // not a lot of value in wrapping the doRequest call in a requireHttpCodes call - // we manipulate the resp body and the require calls "swallow" the content on err - _, resp, err := a.c.doRequest(r) - if err != nil { - return "", nil, err - } - defer closeResponseBody(resp) - // Service not Found - if resp.StatusCode == http.StatusNotFound { - return HealthCritical, nil, nil - } - var out *AgentServiceChecksInfo - if err := decodeBody(resp, &out); err != nil { - return HealthCritical, out, err - } - switch resp.StatusCode { - case http.StatusOK: - return HealthPassing, out, nil - case http.StatusTooManyRequests: - return HealthWarning, out, nil - case http.StatusServiceUnavailable: - return HealthCritical, out, nil - } - return HealthCritical, out, fmt.Errorf("Unexpected Error Code %v for %s", resp.StatusCode, path) -} - -// AgentHealthServiceByName returns for a given service name: the aggregated health status for all services -// having the specified name. -// - If no service is not found, will return status (critical, [], nil) -// - If the service is found, will return (critical|passing|warning), []api.AgentServiceChecksInfo, nil) -// - In all other cases, will return an error -func (a *Agent) AgentHealthServiceByName(service string) (string, []AgentServiceChecksInfo, error) { - return a.AgentHealthServiceByNameOpts(service, nil) -} - -func (a *Agent) AgentHealthServiceByNameOpts(service string, q *QueryOptions) (string, []AgentServiceChecksInfo, error) { - path := fmt.Sprintf("/v1/agent/health/service/name/%v", service) - r := a.c.newRequest("GET", path) - r.setQueryOptions(q) - r.params.Add("format", "json") - r.header.Set("Accept", "application/json") - // not a lot of value in wrapping the doRequest call in a requireHttpCodes call - // we manipulate the resp body and the require calls "swallow" the content on err - _, resp, err := a.c.doRequest(r) - if err != nil { - return "", nil, err - } - defer closeResponseBody(resp) - // Service not Found - if resp.StatusCode == http.StatusNotFound { - return HealthCritical, nil, nil - } - var out []AgentServiceChecksInfo - if err := decodeBody(resp, &out); err != nil { - return HealthCritical, out, err - } - switch resp.StatusCode { - case http.StatusOK: - return HealthPassing, out, nil - case http.StatusTooManyRequests: - return HealthWarning, out, nil - case http.StatusServiceUnavailable: - return HealthCritical, out, nil - } - return HealthCritical, out, fmt.Errorf("Unexpected Error Code %v for %s", resp.StatusCode, path) -} - -// Service returns a locally registered service instance and allows for -// hash-based blocking. -// -// Note that this uses an unconventional blocking mechanism since it's -// agent-local state. That means there is no persistent raft index so we block -// based on object hash instead. -func (a *Agent) Service(serviceID string, q *QueryOptions) (*AgentService, *QueryMeta, error) { - r := a.c.newRequest("GET", "/v1/agent/service/"+serviceID) - r.setQueryOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out *AgentService - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return out, qm, nil -} - -// Members returns the known gossip members. The WAN -// flag can be used to query a server for WAN members. -func (a *Agent) Members(wan bool) ([]*AgentMember, error) { - r := a.c.newRequest("GET", "/v1/agent/members") - if wan { - r.params.Set("wan", "1") - } - _, resp, err := a.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - var out []*AgentMember - if err := decodeBody(resp, &out); err != nil { - return nil, err - } - return out, nil -} - -// MembersOpts returns the known gossip members and can be passed -// additional options for WAN/segment filtering. -func (a *Agent) MembersOpts(opts MembersOpts) ([]*AgentMember, error) { - r := a.c.newRequest("GET", "/v1/agent/members") - r.params.Set("segment", opts.Segment) - if opts.WAN { - r.params.Set("wan", "1") - } - - if opts.Filter != "" { - r.params.Set("filter", opts.Filter) - } - - _, resp, err := a.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - var out []*AgentMember - if err := decodeBody(resp, &out); err != nil { - return nil, err - } - return out, nil -} - -// ServiceRegister is used to register a new service with -// the local agent -func (a *Agent) ServiceRegister(service *AgentServiceRegistration) error { - opts := ServiceRegisterOpts{ - ReplaceExistingChecks: false, - } - - return a.serviceRegister(service, opts) -} - -// ServiceRegister is used to register a new service with -// the local agent and can be passed additional options. -func (a *Agent) ServiceRegisterOpts(service *AgentServiceRegistration, opts ServiceRegisterOpts) error { - return a.serviceRegister(service, opts) -} - -func (a *Agent) serviceRegister(service *AgentServiceRegistration, opts ServiceRegisterOpts) error { - r := a.c.newRequest("PUT", "/v1/agent/service/register") - r.obj = service - r.ctx = opts.ctx - if opts.ReplaceExistingChecks { - r.params.Set("replace-existing-checks", "true") - } - if opts.Token != "" { - r.header.Set("X-Consul-Token", opts.Token) - } - _, resp, err := a.c.doRequest(r) - if err != nil { - return err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return err - } - return nil -} - -// ServiceDeregister is used to deregister a service with -// the local agent -func (a *Agent) ServiceDeregister(serviceID string) error { - r := a.c.newRequest("PUT", "/v1/agent/service/deregister/"+serviceID) - _, resp, err := a.c.doRequest(r) - if err != nil { - return err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return err - } - return nil -} - -// ServiceDeregisterOpts is used to deregister a service with -// the local agent with QueryOptions. -func (a *Agent) ServiceDeregisterOpts(serviceID string, q *QueryOptions) error { - r := a.c.newRequest("PUT", "/v1/agent/service/deregister/"+serviceID) - r.setQueryOptions(q) - _, resp, err := a.c.doRequest(r) - if err != nil { - return err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return err - } - return nil -} - -// PassTTL is used to set a TTL check to the passing state. -// -// DEPRECATION NOTICE: This interface is deprecated in favor of UpdateTTL(). -// The client interface will be removed in 0.8 or changed to use -// UpdateTTL()'s endpoint and the server endpoints will be removed in 0.9. -func (a *Agent) PassTTL(checkID, note string) error { - return a.updateTTL(checkID, note, "pass") -} - -// WarnTTL is used to set a TTL check to the warning state. -// -// DEPRECATION NOTICE: This interface is deprecated in favor of UpdateTTL(). -// The client interface will be removed in 0.8 or changed to use -// UpdateTTL()'s endpoint and the server endpoints will be removed in 0.9. -func (a *Agent) WarnTTL(checkID, note string) error { - return a.updateTTL(checkID, note, "warn") -} - -// FailTTL is used to set a TTL check to the failing state. -// -// DEPRECATION NOTICE: This interface is deprecated in favor of UpdateTTL(). -// The client interface will be removed in 0.8 or changed to use -// UpdateTTL()'s endpoint and the server endpoints will be removed in 0.9. -func (a *Agent) FailTTL(checkID, note string) error { - return a.updateTTL(checkID, note, "fail") -} - -// updateTTL is used to update the TTL of a check. This is the internal -// method that uses the old API that's present in Consul versions prior to -// 0.6.4. Since Consul didn't have an analogous "update" API before it seemed -// ok to break this (former) UpdateTTL in favor of the new UpdateTTL below, -// but keep the old Pass/Warn/Fail methods using the old API under the hood. -// -// DEPRECATION NOTICE: This interface is deprecated in favor of UpdateTTL(). -// The client interface will be removed in 0.8 and the server endpoints will -// be removed in 0.9. -func (a *Agent) updateTTL(checkID, note, status string) error { - switch status { - case "pass": - case "warn": - case "fail": - default: - return fmt.Errorf("Invalid status: %s", status) - } - endpoint := fmt.Sprintf("/v1/agent/check/%s/%s", status, checkID) - r := a.c.newRequest("PUT", endpoint) - r.params.Set("note", note) - _, resp, err := a.c.doRequest(r) - if err != nil { - return err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return err - } - return nil -} - -// checkUpdate is the payload for a PUT for a check update. -type checkUpdate struct { - // Status is one of the api.Health* states: HealthPassing - // ("passing"), HealthWarning ("warning"), or HealthCritical - // ("critical"). - Status string - - // Output is the information to post to the UI for operators as the - // output of the process that decided to hit the TTL check. This is - // different from the note field that's associated with the check - // itself. - Output string -} - -// UpdateTTL is used to update the TTL of a check. This uses the newer API -// that was introduced in Consul 0.6.4 and later. We translate the old status -// strings for compatibility (though a newer version of Consul will still be -// required to use this API). -func (a *Agent) UpdateTTL(checkID, output, status string) error { - return a.UpdateTTLOpts(checkID, output, status, nil) -} - -func (a *Agent) UpdateTTLOpts(checkID, output, status string, q *QueryOptions) error { - switch status { - case "pass", HealthPassing: - status = HealthPassing - case "warn", HealthWarning: - status = HealthWarning - case "fail", HealthCritical: - status = HealthCritical - default: - return fmt.Errorf("Invalid status: %s", status) - } - - endpoint := fmt.Sprintf("/v1/agent/check/update/%s", checkID) - r := a.c.newRequest("PUT", endpoint) - r.setQueryOptions(q) - r.obj = &checkUpdate{ - Status: status, - Output: output, - } - - _, resp, err := a.c.doRequest(r) - if err != nil { - return err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return err - } - return nil -} - -// CheckRegister is used to register a new check with -// the local agent -func (a *Agent) CheckRegister(check *AgentCheckRegistration) error { - return a.CheckRegisterOpts(check, nil) -} - -// CheckRegisterOpts is used to register a new check with -// the local agent using query options -func (a *Agent) CheckRegisterOpts(check *AgentCheckRegistration, q *QueryOptions) error { - r := a.c.newRequest("PUT", "/v1/agent/check/register") - r.setQueryOptions(q) - r.obj = check - _, resp, err := a.c.doRequest(r) - if err != nil { - return err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return err - } - return nil -} - -// CheckDeregister is used to deregister a check with -// the local agent -func (a *Agent) CheckDeregister(checkID string) error { - return a.CheckDeregisterOpts(checkID, nil) -} - -// CheckDeregisterOpts is used to deregister a check with -// the local agent using query options -func (a *Agent) CheckDeregisterOpts(checkID string, q *QueryOptions) error { - r := a.c.newRequest("PUT", "/v1/agent/check/deregister/"+checkID) - r.setQueryOptions(q) - _, resp, err := a.c.doRequest(r) - if err != nil { - return err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return err - } - return nil -} - -// Join is used to instruct the agent to attempt a join to -// another cluster member -func (a *Agent) Join(addr string, wan bool) error { - r := a.c.newRequest("PUT", "/v1/agent/join/"+addr) - if wan { - r.params.Set("wan", "1") - } - _, resp, err := a.c.doRequest(r) - if err != nil { - return err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return err - } - return nil -} - -// Leave is used to have the agent gracefully leave the cluster and shutdown -func (a *Agent) Leave() error { - r := a.c.newRequest("PUT", "/v1/agent/leave") - _, resp, err := a.c.doRequest(r) - if err != nil { - return err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return err - } - return nil -} - -type ForceLeaveOpts struct { - // Prune indicates if we should remove a failed agent from the list of - // members in addition to ejecting it. - Prune bool - - // WAN indicates that the request should exclusively target the WAN pool. - WAN bool -} - -// ForceLeave is used to have the agent eject a failed node -func (a *Agent) ForceLeave(node string) error { - return a.ForceLeaveOpts(node, ForceLeaveOpts{}) -} - -// ForceLeavePrune is used to have an a failed agent removed -// from the list of members -func (a *Agent) ForceLeavePrune(node string) error { - return a.ForceLeaveOpts(node, ForceLeaveOpts{Prune: true}) -} - -// ForceLeaveOpts is used to have the agent eject a failed node or remove it -// completely from the list of members. -// -// DEPRECATED - Use ForceLeaveOptions instead. -func (a *Agent) ForceLeaveOpts(node string, opts ForceLeaveOpts) error { - return a.ForceLeaveOptions(node, opts, nil) -} - -// ForceLeaveOptions is used to have the agent eject a failed node or remove it -// completely from the list of members. Allows usage of QueryOptions on-top of ForceLeaveOpts -func (a *Agent) ForceLeaveOptions(node string, opts ForceLeaveOpts, q *QueryOptions) error { - r := a.c.newRequest("PUT", "/v1/agent/force-leave/"+node) - r.setQueryOptions(q) - if opts.Prune { - r.params.Set("prune", "1") - } - if opts.WAN { - r.params.Set("wan", "1") - } - _, resp, err := a.c.doRequest(r) - if err != nil { - return err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return err - } - return nil -} - -// ConnectAuthorize is used to authorize an incoming connection -// to a natively integrated Connect service. -func (a *Agent) ConnectAuthorize(auth *AgentAuthorizeParams) (*AgentAuthorize, error) { - r := a.c.newRequest("POST", "/v1/agent/connect/authorize") - r.obj = auth - _, resp, err := a.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - var out AgentAuthorize - if err := decodeBody(resp, &out); err != nil { - return nil, err - } - return &out, nil -} - -// ConnectCARoots returns the list of roots. -func (a *Agent) ConnectCARoots(q *QueryOptions) (*CARootList, *QueryMeta, error) { - r := a.c.newRequest("GET", "/v1/agent/connect/ca/roots") - r.setQueryOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out CARootList - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return &out, qm, nil -} - -// ConnectCALeaf gets the leaf certificate for the given service ID. -func (a *Agent) ConnectCALeaf(serviceID string, q *QueryOptions) (*LeafCert, *QueryMeta, error) { - r := a.c.newRequest("GET", "/v1/agent/connect/ca/leaf/"+serviceID) - r.setQueryOptions(q) - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out LeafCert - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return &out, qm, nil -} - -// EnableServiceMaintenance toggles service maintenance mode on -// for the given service ID. -func (a *Agent) EnableServiceMaintenance(serviceID, reason string) error { - return a.EnableServiceMaintenanceOpts(serviceID, reason, nil) -} - -func (a *Agent) EnableServiceMaintenanceOpts(serviceID, reason string, q *QueryOptions) error { - r := a.c.newRequest("PUT", "/v1/agent/service/maintenance/"+serviceID) - r.setQueryOptions(q) - r.params.Set("enable", "true") - r.params.Set("reason", reason) - _, resp, err := a.c.doRequest(r) - if err != nil { - return err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return err - } - return nil -} - -// DisableServiceMaintenance toggles service maintenance mode off -// for the given service ID. -func (a *Agent) DisableServiceMaintenance(serviceID string) error { - return a.DisableServiceMaintenanceOpts(serviceID, nil) -} - -func (a *Agent) DisableServiceMaintenanceOpts(serviceID string, q *QueryOptions) error { - r := a.c.newRequest("PUT", "/v1/agent/service/maintenance/"+serviceID) - r.setQueryOptions(q) - r.params.Set("enable", "false") - _, resp, err := a.c.doRequest(r) - if err != nil { - return err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return err - } - return nil -} - -// EnableNodeMaintenance toggles node maintenance mode on for the -// agent we are connected to. -func (a *Agent) EnableNodeMaintenance(reason string) error { - r := a.c.newRequest("PUT", "/v1/agent/maintenance") - r.params.Set("enable", "true") - r.params.Set("reason", reason) - _, resp, err := a.c.doRequest(r) - if err != nil { - return err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return err - } - return nil -} - -// DisableNodeMaintenance toggles node maintenance mode off for the -// agent we are connected to. -func (a *Agent) DisableNodeMaintenance() error { - r := a.c.newRequest("PUT", "/v1/agent/maintenance") - r.params.Set("enable", "false") - _, resp, err := a.c.doRequest(r) - if err != nil { - return err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return err - } - return nil -} - -// Monitor returns a channel which will receive streaming logs from the agent -// Providing a non-nil stopCh can be used to close the connection and stop the -// log stream. An empty string will be sent down the given channel when there's -// nothing left to stream, after which the caller should close the stopCh. -func (a *Agent) Monitor(loglevel string, stopCh <-chan struct{}, q *QueryOptions) (chan string, error) { - return a.monitor(loglevel, false, stopCh, q) -} - -// MonitorJSON is like Monitor except it returns logs in JSON format. -func (a *Agent) MonitorJSON(loglevel string, stopCh <-chan struct{}, q *QueryOptions) (chan string, error) { - return a.monitor(loglevel, true, stopCh, q) -} - -func (a *Agent) monitor(loglevel string, logJSON bool, stopCh <-chan struct{}, q *QueryOptions) (chan string, error) { - r := a.c.newRequest("GET", "/v1/agent/monitor") - r.setQueryOptions(q) - if loglevel != "" { - r.params.Add("loglevel", loglevel) - } - if logJSON { - r.params.Set("logjson", "true") - } - _, resp, err := a.c.doRequest(r) - if err != nil { - return nil, err - } - if err := requireOK(resp); err != nil { - return nil, err - } - logCh := make(chan string, 64) - go func() { - defer closeResponseBody(resp) - scanner := bufio.NewScanner(resp.Body) - for { - select { - case <-stopCh: - close(logCh) - return - default: - } - if scanner.Scan() { - // An empty string signals to the caller that - // the scan is done, so make sure we only emit - // that when the scanner says it's done, not if - // we happen to ingest an empty line. - if text := scanner.Text(); text != "" { - logCh <- text - } else { - logCh <- " " - } - } else { - logCh <- "" - } - } - }() - return logCh, nil -} - -// UpdateACLToken updates the agent's "acl_token". See updateToken for more -// details. Deprecated in Consul 1.4. -// -// DEPRECATED (ACL-Legacy-Compat) - Prefer UpdateDefaultACLToken for v1.4.3 and above -func (a *Agent) UpdateACLToken(token string, q *WriteOptions) (*WriteMeta, error) { - return nil, fmt.Errorf("Legacy ACL Tokens were deprecated in Consul 1.4") -} - -// UpdateACLAgentToken updates the agent's "acl_agent_token". See updateToken -// for more details. Deprecated in Consul 1.4. -// -// DEPRECATED (ACL-Legacy-Compat) - Prefer UpdateAgentACLToken for v1.4.3 and above -func (a *Agent) UpdateACLAgentToken(token string, q *WriteOptions) (*WriteMeta, error) { - return nil, fmt.Errorf("Legacy ACL Tokens were deprecated in Consul 1.4") -} - -// UpdateACLAgentMasterToken updates the agent's "acl_agent_master_token". See -// updateToken for more details. Deprecated in Consul 1.4. -// -// DEPRECATED (ACL-Legacy-Compat) - Prefer UpdateAgentMasterACLToken for v1.4.3 and above -func (a *Agent) UpdateACLAgentMasterToken(token string, q *WriteOptions) (*WriteMeta, error) { - return nil, fmt.Errorf("Legacy ACL Tokens were deprecated in Consul 1.4") -} - -// UpdateACLReplicationToken updates the agent's "acl_replication_token". See -// updateToken for more details. Deprecated in Consul 1.4. -// -// DEPRECATED (ACL-Legacy-Compat) - Prefer UpdateReplicationACLToken for v1.4.3 and above -func (a *Agent) UpdateACLReplicationToken(token string, q *WriteOptions) (*WriteMeta, error) { - return nil, fmt.Errorf("Legacy ACL Tokens were deprecated in Consul 1.4") -} - -// UpdateDefaultACLToken updates the agent's "default" token. See updateToken -// for more details -func (a *Agent) UpdateDefaultACLToken(token string, q *WriteOptions) (*WriteMeta, error) { - return a.updateTokenFallback(token, q, "default", "acl_token") -} - -// UpdateAgentACLToken updates the agent's "agent" token. See updateToken -// for more details -func (a *Agent) UpdateAgentACLToken(token string, q *WriteOptions) (*WriteMeta, error) { - return a.updateTokenFallback(token, q, "agent", "acl_agent_token") -} - -// UpdateAgentRecoveryACLToken updates the agent's "agent_recovery" token. See updateToken -// for more details. -func (a *Agent) UpdateAgentRecoveryACLToken(token string, q *WriteOptions) (*WriteMeta, error) { - return a.updateTokenFallback(token, q, "agent_recovery", "agent_master", "acl_agent_master_token") -} - -// UpdateAgentMasterACLToken updates the agent's "agent_master" token. See updateToken -// for more details. -// -// DEPRECATED - Prefer UpdateAgentRecoveryACLToken for v1.11 and above. -func (a *Agent) UpdateAgentMasterACLToken(token string, q *WriteOptions) (*WriteMeta, error) { - return a.updateTokenFallback(token, q, "agent_master", "acl_agent_master_token") -} - -// UpdateReplicationACLToken updates the agent's "replication" token. See updateToken -// for more details -func (a *Agent) UpdateReplicationACLToken(token string, q *WriteOptions) (*WriteMeta, error) { - return a.updateTokenFallback(token, q, "replication", "acl_replication_token") -} - -// UpdateConfigFileRegistrationToken updates the agent's "replication" token. See updateToken -// for more details -func (a *Agent) UpdateConfigFileRegistrationToken(token string, q *WriteOptions) (*WriteMeta, error) { - return a.updateToken("config_file_service_registration", token, q) -} - -func (a *Agent) UpdateDNSToken(token string, q *WriteOptions) (*WriteMeta, error) { - return a.updateToken("dns", token, q) -} - -// updateToken can be used to update one of an agent's ACL tokens after the agent has -// started. The tokens are may not be persisted, so will need to be updated again if -// the agent is restarted unless the agent is configured to persist them. -func (a *Agent) updateToken(target, token string, q *WriteOptions) (*WriteMeta, error) { - meta, _, err := a.updateTokenOnce(target, token, q) - return meta, err -} - -func (a *Agent) updateTokenFallback(token string, q *WriteOptions, targets ...string) (*WriteMeta, error) { - if len(targets) == 0 { - panic("targets must not be empty") - } - - var ( - meta *WriteMeta - err error - ) - for _, target := range targets { - var status int - meta, status, err = a.updateTokenOnce(target, token, q) - if err == nil && status != http.StatusNotFound { - return meta, err - } - } - return meta, err -} - -func (a *Agent) updateTokenOnce(target, token string, q *WriteOptions) (*WriteMeta, int, error) { - r := a.c.newRequest("PUT", fmt.Sprintf("/v1/agent/token/%s", target)) - r.setWriteOptions(q) - r.obj = &AgentToken{Token: token} - - rtt, resp, err := a.c.doRequest(r) - if err != nil { - return nil, 500, err - } - defer closeResponseBody(resp) - wm := &WriteMeta{RequestTime: rtt} - if err := requireOK(resp); err != nil { - var statusE StatusError - if errors.As(err, &statusE) { - return wm, statusE.Code, statusE - } - return nil, 0, err - } - return wm, resp.StatusCode, nil -} diff --git a/vendor/github.com/hashicorp/consul/api/api.go b/vendor/github.com/hashicorp/consul/api/api.go deleted file mode 100644 index f62c0c5a1..000000000 --- a/vendor/github.com/hashicorp/consul/api/api.go +++ /dev/null @@ -1,1277 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "bytes" - "context" - "crypto/tls" - "encoding/json" - "fmt" - "io" - "net" - "net/http" - "net/url" - "os" - "strconv" - "strings" - "sync" - "time" - - "github.com/hashicorp/go-cleanhttp" - "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-rootcerts" -) - -const ( - // HTTPAddrEnvName defines an environment variable name which sets - // the HTTP address if there is no -http-addr specified. - HTTPAddrEnvName = "CONSUL_HTTP_ADDR" - - // HTTPTokenEnvName defines an environment variable name which sets - // the HTTP token. - HTTPTokenEnvName = "CONSUL_HTTP_TOKEN" - - // HTTPTokenFileEnvName defines an environment variable name which sets - // the HTTP token file. - HTTPTokenFileEnvName = "CONSUL_HTTP_TOKEN_FILE" - - // HTTPAuthEnvName defines an environment variable name which sets - // the HTTP authentication header. - HTTPAuthEnvName = "CONSUL_HTTP_AUTH" - - // HTTPSSLEnvName defines an environment variable name which sets - // whether or not to use HTTPS. - HTTPSSLEnvName = "CONSUL_HTTP_SSL" - - // HTTPCAFile defines an environment variable name which sets the - // CA file to use for talking to Consul over TLS. - HTTPCAFile = "CONSUL_CACERT" - - // HTTPCAPath defines an environment variable name which sets the - // path to a directory of CA certs to use for talking to Consul over TLS. - HTTPCAPath = "CONSUL_CAPATH" - - // HTTPClientCert defines an environment variable name which sets the - // client cert file to use for talking to Consul over TLS. - HTTPClientCert = "CONSUL_CLIENT_CERT" - - // HTTPClientKey defines an environment variable name which sets the - // client key file to use for talking to Consul over TLS. - HTTPClientKey = "CONSUL_CLIENT_KEY" - - // HTTPTLSServerName defines an environment variable name which sets the - // server name to use as the SNI host when connecting via TLS - HTTPTLSServerName = "CONSUL_TLS_SERVER_NAME" - - // HTTPSSLVerifyEnvName defines an environment variable name which sets - // whether or not to disable certificate checking. - HTTPSSLVerifyEnvName = "CONSUL_HTTP_SSL_VERIFY" - - // GRPCAddrEnvName defines an environment variable name which sets the gRPC - // address for consul connect envoy. Note this isn't actually used by the api - // client in this package but is defined here for consistency with all the - // other ENV names we use. - GRPCAddrEnvName = "CONSUL_GRPC_ADDR" - - // GRPCCAFileEnvName defines an environment variable name which sets the - // CA file to use for talking to Consul gRPC over TLS. - GRPCCAFileEnvName = "CONSUL_GRPC_CACERT" - - // GRPCCAPathEnvName defines an environment variable name which sets the - // path to a directory of CA certs to use for talking to Consul gRPC over TLS. - GRPCCAPathEnvName = "CONSUL_GRPC_CAPATH" - - // HTTPNamespaceEnvVar defines an environment variable name which sets - // the HTTP Namespace to be used by default. This can still be overridden. - HTTPNamespaceEnvName = "CONSUL_NAMESPACE" - - // HTTPPartitionEnvName defines an environment variable name which sets - // the HTTP Partition to be used by default. This can still be overridden. - HTTPPartitionEnvName = "CONSUL_PARTITION" - - // QueryBackendStreaming Query backend of type streaming - QueryBackendStreaming = "streaming" - - // QueryBackendBlockingQuery Query backend of type blocking query - QueryBackendBlockingQuery = "blocking-query" -) - -type StatusError struct { - Code int - Body string -} - -func (e StatusError) Error() string { - return fmt.Sprintf("Unexpected response code: %d (%s)", e.Code, e.Body) -} - -// QueryOptions are used to parameterize a query -type QueryOptions struct { - // Namespace overrides the `default` namespace - // Note: Namespaces are available only in Consul Enterprise - Namespace string - - // Partition overrides the `default` partition - // Note: Partitions are available only in Consul Enterprise - Partition string - - // Providing a datacenter overwrites the DC provided - // by the Config - Datacenter string - - // Providing a peer name in the query option - Peer string - - // AllowStale allows any Consul server (non-leader) to service - // a read. This allows for lower latency and higher throughput - AllowStale bool - - // RequireConsistent forces the read to be fully consistent. - // This is more expensive but prevents ever performing a stale - // read. - RequireConsistent bool - - // UseCache requests that the agent cache results locally. See - // https://www.consul.io/api/features/caching.html for more details on the - // semantics. - UseCache bool - - // MaxAge limits how old a cached value will be returned if UseCache is true. - // If there is a cached response that is older than the MaxAge, it is treated - // as a cache miss and a new fetch invoked. If the fetch fails, the error is - // returned. Clients that wish to allow for stale results on error can set - // StaleIfError to a longer duration to change this behavior. It is ignored - // if the endpoint supports background refresh caching. See - // https://www.consul.io/api/features/caching.html for more details. - MaxAge time.Duration - - // StaleIfError specifies how stale the client will accept a cached response - // if the servers are unavailable to fetch a fresh one. Only makes sense when - // UseCache is true and MaxAge is set to a lower, non-zero value. It is - // ignored if the endpoint supports background refresh caching. See - // https://www.consul.io/api/features/caching.html for more details. - StaleIfError time.Duration - - // WaitIndex is used to enable a blocking query. Waits - // until the timeout or the next index is reached - WaitIndex uint64 - - // WaitHash is used by some endpoints instead of WaitIndex to perform blocking - // on state based on a hash of the response rather than a monotonic index. - // This is required when the state being blocked on is not stored in Raft, for - // example agent-local proxy configuration. - WaitHash string - - // WaitTime is used to bound the duration of a wait. - // Defaults to that of the Config, but can be overridden. - WaitTime time.Duration - - // Token is used to provide a per-request ACL token - // which overrides the agent's default token. - Token string - - // Near is used to provide a node name that will sort the results - // in ascending order based on the estimated round trip time from - // that node. Setting this to "_agent" will use the agent's node - // for the sort. - Near string - - // NodeMeta is used to filter results by nodes with the given - // metadata key/value pairs. Currently, only one key/value pair can - // be provided for filtering. - NodeMeta map[string]string - - // RelayFactor is used in keyring operations to cause responses to be - // relayed back to the sender through N other random nodes. Must be - // a value from 0 to 5 (inclusive). - RelayFactor uint8 - - // LocalOnly is used in keyring list operation to force the keyring - // query to only hit local servers (no WAN traffic). - LocalOnly bool - - // Connect filters prepared query execution to only include Connect-capable - // services. This currently affects prepared query execution. - Connect bool - - // ctx is an optional context pass through to the underlying HTTP - // request layer. Use Context() and WithContext() to manage this. - ctx context.Context - - // Filter requests filtering data prior to it being returned. The string - // is a go-bexpr compatible expression. - Filter string - - // MergeCentralConfig returns a service definition merged with the - // proxy-defaults/global and service-defaults/:service config entries. - // This can be used to ensure a full service definition is returned in the response - // especially when the service might not be written into the catalog that way. - MergeCentralConfig bool - - // Global is used to request information from all datacenters. Currently only - // used for operator usage requests. - Global bool -} - -func (o *QueryOptions) Context() context.Context { - if o != nil && o.ctx != nil { - return o.ctx - } - return context.Background() -} - -func (o *QueryOptions) WithContext(ctx context.Context) *QueryOptions { - o2 := new(QueryOptions) - if o != nil { - *o2 = *o - } - o2.ctx = ctx - return o2 -} - -// WriteOptions are used to parameterize a write -type WriteOptions struct { - // Namespace overrides the `default` namespace - // Note: Namespaces are available only in Consul Enterprise - Namespace string - - // Partition overrides the `default` partition - // Note: Partitions are available only in Consul Enterprise - Partition string - - // Providing a datacenter overwrites the DC provided - // by the Config - Datacenter string - - // Token is used to provide a per-request ACL token - // which overrides the agent's default token. - Token string - - // RelayFactor is used in keyring operations to cause responses to be - // relayed back to the sender through N other random nodes. Must be - // a value from 0 to 5 (inclusive). - RelayFactor uint8 - - // ctx is an optional context pass through to the underlying HTTP - // request layer. Use Context() and WithContext() to manage this. - ctx context.Context -} - -func (o *WriteOptions) Context() context.Context { - if o != nil && o.ctx != nil { - return o.ctx - } - return context.Background() -} - -func (o *WriteOptions) WithContext(ctx context.Context) *WriteOptions { - o2 := new(WriteOptions) - if o != nil { - *o2 = *o - } - o2.ctx = ctx - return o2 -} - -// QueryMeta is used to return meta data about a query -type QueryMeta struct { - // LastIndex. This can be used as a WaitIndex to perform - // a blocking query - LastIndex uint64 - - // LastContentHash. This can be used as a WaitHash to perform a blocking query - // for endpoints that support hash-based blocking. Endpoints that do not - // support it will return an empty hash. - LastContentHash string - - // Time of last contact from the leader for the - // server servicing the request - LastContact time.Duration - - // Is there a known leader - KnownLeader bool - - // How long did the request take - RequestTime time.Duration - - // Is address translation enabled for HTTP responses on this agent - AddressTranslationEnabled bool - - // CacheHit is true if the result was served from agent-local cache. - CacheHit bool - - // CacheAge is set if request was ?cached and indicates how stale the cached - // response is. - CacheAge time.Duration - - // QueryBackend represent which backend served the request. - QueryBackend string - - // DefaultACLPolicy is used to control the ACL interaction when there is no - // defined policy. This can be "allow" which means ACLs are used to - // deny-list, or "deny" which means ACLs are allow-lists. - DefaultACLPolicy string - - // ResultsFilteredByACLs is true when some of the query's results were - // filtered out by enforcing ACLs. It may be false because nothing was - // removed, or because the endpoint does not yet support this flag. - ResultsFilteredByACLs bool -} - -// WriteMeta is used to return meta data about a write -type WriteMeta struct { - // How long did the request take - RequestTime time.Duration -} - -// HttpBasicAuth is used to authenticate http client with HTTP Basic Authentication -type HttpBasicAuth struct { - // Username to use for HTTP Basic Authentication - Username string - - // Password to use for HTTP Basic Authentication - Password string -} - -// Config is used to configure the creation of a client -type Config struct { - // Address is the address of the Consul server - Address string - - // Scheme is the URI scheme for the Consul server - Scheme string - - // Prefix for URIs for when consul is behind an API gateway (reverse - // proxy). The API gateway must strip off the PathPrefix before - // passing the request onto consul. - PathPrefix string - - // Datacenter to use. If not provided, the default agent datacenter is used. - Datacenter string - - // Transport is the Transport to use for the http client. - Transport *http.Transport - - // HttpClient is the client to use. Default will be - // used if not provided. - HttpClient *http.Client - - // HttpAuth is the auth info to use for http access. - HttpAuth *HttpBasicAuth - - // WaitTime limits how long a Watch will block. If not provided, - // the agent default values will be used. - WaitTime time.Duration - - // Token is used to provide a per-request ACL token - // which overrides the agent's default token. - Token string - - // TokenFile is a file containing the current token to use for this client. - // If provided it is read once at startup and never again. - TokenFile string - - // Namespace is the name of the namespace to send along for the request - // when no other Namespace is present in the QueryOptions - Namespace string - - // Partition is the name of the partition to send along for the request - // when no other Partition is present in the QueryOptions - Partition string - - TLSConfig TLSConfig -} - -// TLSConfig is used to generate a TLSClientConfig that's useful for talking to -// Consul using TLS. -type TLSConfig struct { - // Address is the optional address of the Consul server. The port, if any - // will be removed from here and this will be set to the ServerName of the - // resulting config. - Address string - - // CAFile is the optional path to the CA certificate used for Consul - // communication, defaults to the system bundle if not specified. - CAFile string - - // CAPath is the optional path to a directory of CA certificates to use for - // Consul communication, defaults to the system bundle if not specified. - CAPath string - - // CAPem is the optional PEM-encoded CA certificate used for Consul - // communication, defaults to the system bundle if not specified. - CAPem []byte - - // CertFile is the optional path to the certificate for Consul - // communication. If this is set then you need to also set KeyFile. - CertFile string - - // CertPEM is the optional PEM-encoded certificate for Consul - // communication. If this is set then you need to also set KeyPEM. - CertPEM []byte - - // KeyFile is the optional path to the private key for Consul communication. - // If this is set then you need to also set CertFile. - KeyFile string - - // KeyPEM is the optional PEM-encoded private key for Consul communication. - // If this is set then you need to also set CertPEM. - KeyPEM []byte - - // InsecureSkipVerify if set to true will disable TLS host verification. - InsecureSkipVerify bool -} - -// DefaultConfig returns a default configuration for the client. By default this -// will pool and reuse idle connections to Consul. If you have a long-lived -// client object, this is the desired behavior and should make the most efficient -// use of the connections to Consul. If you don't reuse a client object, which -// is not recommended, then you may notice idle connections building up over -// time. To avoid this, use the DefaultNonPooledConfig() instead. -func DefaultConfig() *Config { - return defaultConfig(nil, cleanhttp.DefaultPooledTransport) -} - -// DefaultConfigWithLogger returns a default configuration for the client. It -// is exactly the same as DefaultConfig, but allows for a pre-configured logger -// object to be passed through. -func DefaultConfigWithLogger(logger hclog.Logger) *Config { - return defaultConfig(logger, cleanhttp.DefaultPooledTransport) -} - -// DefaultNonPooledConfig returns a default configuration for the client which -// does not pool connections. This isn't a recommended configuration because it -// will reconnect to Consul on every request, but this is useful to avoid the -// accumulation of idle connections if you make many client objects during the -// lifetime of your application. -func DefaultNonPooledConfig() *Config { - return defaultConfig(nil, cleanhttp.DefaultTransport) -} - -// defaultConfig returns the default configuration for the client, using the -// given function to make the transport. -func defaultConfig(logger hclog.Logger, transportFn func() *http.Transport) *Config { - if logger == nil { - logger = hclog.New(&hclog.LoggerOptions{ - Name: "consul-api", - }) - } - - config := &Config{ - Address: "127.0.0.1:8500", - Scheme: "http", - Transport: transportFn(), - } - - if addr := os.Getenv(HTTPAddrEnvName); addr != "" { - config.Address = addr - } - - if tokenFile := os.Getenv(HTTPTokenFileEnvName); tokenFile != "" { - config.TokenFile = tokenFile - } - - if token := os.Getenv(HTTPTokenEnvName); token != "" { - config.Token = token - } - - if auth := os.Getenv(HTTPAuthEnvName); auth != "" { - var username, password string - if strings.Contains(auth, ":") { - split := strings.SplitN(auth, ":", 2) - username = split[0] - password = split[1] - } else { - username = auth - } - - config.HttpAuth = &HttpBasicAuth{ - Username: username, - Password: password, - } - } - - if ssl := os.Getenv(HTTPSSLEnvName); ssl != "" { - enabled, err := strconv.ParseBool(ssl) - if err != nil { - logger.Warn(fmt.Sprintf("could not parse %s", HTTPSSLEnvName), "error", err) - } - - if enabled { - config.Scheme = "https" - } - } - - if v := os.Getenv(HTTPTLSServerName); v != "" { - config.TLSConfig.Address = v - } - if v := os.Getenv(HTTPCAFile); v != "" { - config.TLSConfig.CAFile = v - } - if v := os.Getenv(HTTPCAPath); v != "" { - config.TLSConfig.CAPath = v - } - if v := os.Getenv(HTTPClientCert); v != "" { - config.TLSConfig.CertFile = v - } - if v := os.Getenv(HTTPClientKey); v != "" { - config.TLSConfig.KeyFile = v - } - if v := os.Getenv(HTTPSSLVerifyEnvName); v != "" { - doVerify, err := strconv.ParseBool(v) - if err != nil { - logger.Warn(fmt.Sprintf("could not parse %s", HTTPSSLVerifyEnvName), "error", err) - } - if !doVerify { - config.TLSConfig.InsecureSkipVerify = true - } - } - - if v := os.Getenv(HTTPNamespaceEnvName); v != "" { - config.Namespace = v - } - - if v := os.Getenv(HTTPPartitionEnvName); v != "" { - config.Partition = v - } - - return config -} - -// TLSConfig is used to generate a TLSClientConfig that's useful for talking to -// Consul using TLS. -func SetupTLSConfig(tlsConfig *TLSConfig) (*tls.Config, error) { - tlsClientConfig := &tls.Config{ - InsecureSkipVerify: tlsConfig.InsecureSkipVerify, - } - - if tlsConfig.Address != "" { - server := tlsConfig.Address - hasPort := strings.LastIndex(server, ":") > strings.LastIndex(server, "]") - if hasPort { - var err error - server, _, err = net.SplitHostPort(server) - if err != nil { - return nil, err - } - } - tlsClientConfig.ServerName = server - } - - if len(tlsConfig.CertPEM) != 0 && len(tlsConfig.KeyPEM) != 0 { - tlsCert, err := tls.X509KeyPair(tlsConfig.CertPEM, tlsConfig.KeyPEM) - if err != nil { - return nil, err - } - tlsClientConfig.Certificates = []tls.Certificate{tlsCert} - } else if len(tlsConfig.CertPEM) != 0 || len(tlsConfig.KeyPEM) != 0 { - return nil, fmt.Errorf("both client cert and client key must be provided") - } - - if tlsConfig.CertFile != "" && tlsConfig.KeyFile != "" { - tlsCert, err := tls.LoadX509KeyPair(tlsConfig.CertFile, tlsConfig.KeyFile) - if err != nil { - return nil, err - } - tlsClientConfig.Certificates = []tls.Certificate{tlsCert} - } else if tlsConfig.CertFile != "" || tlsConfig.KeyFile != "" { - return nil, fmt.Errorf("both client cert and client key must be provided") - } - - if tlsConfig.CAFile != "" || tlsConfig.CAPath != "" || len(tlsConfig.CAPem) != 0 { - rootConfig := &rootcerts.Config{ - CAFile: tlsConfig.CAFile, - CAPath: tlsConfig.CAPath, - CACertificate: tlsConfig.CAPem, - } - if err := rootcerts.ConfigureTLS(tlsClientConfig, rootConfig); err != nil { - return nil, err - } - } - - return tlsClientConfig, nil -} - -func (c *Config) GenerateEnv() []string { - env := make([]string, 0, 10) - - env = append(env, - fmt.Sprintf("%s=%s", HTTPAddrEnvName, c.Address), - fmt.Sprintf("%s=%s", HTTPTokenEnvName, c.Token), - fmt.Sprintf("%s=%s", HTTPTokenFileEnvName, c.TokenFile), - fmt.Sprintf("%s=%t", HTTPSSLEnvName, c.Scheme == "https"), - fmt.Sprintf("%s=%s", HTTPCAFile, c.TLSConfig.CAFile), - fmt.Sprintf("%s=%s", HTTPCAPath, c.TLSConfig.CAPath), - fmt.Sprintf("%s=%s", HTTPClientCert, c.TLSConfig.CertFile), - fmt.Sprintf("%s=%s", HTTPClientKey, c.TLSConfig.KeyFile), - fmt.Sprintf("%s=%s", HTTPTLSServerName, c.TLSConfig.Address), - fmt.Sprintf("%s=%t", HTTPSSLVerifyEnvName, !c.TLSConfig.InsecureSkipVerify)) - - if c.HttpAuth != nil { - env = append(env, fmt.Sprintf("%s=%s:%s", HTTPAuthEnvName, c.HttpAuth.Username, c.HttpAuth.Password)) - } else { - env = append(env, fmt.Sprintf("%s=", HTTPAuthEnvName)) - } - - return env -} - -// Client provides a client to the Consul API -type Client struct { - modifyLock sync.RWMutex - headers http.Header - - config Config -} - -// Headers gets the current set of headers used for requests. This returns a -// copy; to modify it call AddHeader or SetHeaders. -func (c *Client) Headers() http.Header { - c.modifyLock.RLock() - defer c.modifyLock.RUnlock() - - if c.headers == nil { - return nil - } - - ret := make(http.Header) - for k, v := range c.headers { - for _, val := range v { - ret[k] = append(ret[k], val) - } - } - - return ret -} - -// AddHeader allows a single header key/value pair to be added -// in a race-safe fashion. -func (c *Client) AddHeader(key, value string) { - c.modifyLock.Lock() - defer c.modifyLock.Unlock() - c.headers.Add(key, value) -} - -// SetHeaders clears all previous headers and uses only the given -// ones going forward. -func (c *Client) SetHeaders(headers http.Header) { - c.modifyLock.Lock() - defer c.modifyLock.Unlock() - c.headers = headers -} - -// NewClient returns a new client -func NewClient(config *Config) (*Client, error) { - // bootstrap the config - defConfig := DefaultConfig() - - if config.Address == "" { - config.Address = defConfig.Address - } - - if config.Scheme == "" { - config.Scheme = defConfig.Scheme - } - - if config.Transport == nil { - config.Transport = defConfig.Transport - } - - if config.TLSConfig.Address == "" { - config.TLSConfig.Address = defConfig.TLSConfig.Address - } - - if config.TLSConfig.CAFile == "" { - config.TLSConfig.CAFile = defConfig.TLSConfig.CAFile - } - - if config.TLSConfig.CAPath == "" { - config.TLSConfig.CAPath = defConfig.TLSConfig.CAPath - } - - if config.TLSConfig.CertFile == "" { - config.TLSConfig.CertFile = defConfig.TLSConfig.CertFile - } - - if config.TLSConfig.KeyFile == "" { - config.TLSConfig.KeyFile = defConfig.TLSConfig.KeyFile - } - - if !config.TLSConfig.InsecureSkipVerify { - config.TLSConfig.InsecureSkipVerify = defConfig.TLSConfig.InsecureSkipVerify - } - - if config.HttpClient == nil { - var err error - config.HttpClient, err = NewHttpClient(config.Transport, config.TLSConfig) - if err != nil { - return nil, err - } - } - - if config.Namespace == "" { - config.Namespace = defConfig.Namespace - } - - if config.Partition == "" { - config.Partition = defConfig.Partition - } - - parts := strings.SplitN(config.Address, "://", 2) - if len(parts) == 2 { - switch parts[0] { - case "http": - // Never revert to http if TLS was explicitly requested. - case "https": - config.Scheme = "https" - case "unix": - trans := cleanhttp.DefaultTransport() - trans.DialContext = func(_ context.Context, _, _ string) (net.Conn, error) { - return net.Dial("unix", parts[1]) - } - httpClient, err := NewHttpClient(trans, config.TLSConfig) - if err != nil { - return nil, err - } - config.HttpClient = httpClient - default: - return nil, fmt.Errorf("Unknown protocol scheme: %s", parts[0]) - } - config.Address = parts[1] - - // separate out a reverse proxy prefix, if it is present. - // NOTE: Rewriting this code to use url.Parse() instead of - // strings.SplitN() breaks existing test cases. - switch parts[0] { - case "http", "https": - parts := strings.SplitN(parts[1], "/", 2) - if len(parts) == 2 { - config.Address = parts[0] - config.PathPrefix = "/" + parts[1] - } - } - } - - // If the TokenFile is set, always use that, even if a Token is configured. - // This is because when TokenFile is set it is read into the Token field. - // We want any derived clients to have to re-read the token file. - // The precedence of ACL token should be: - // 1. -token-file cli option - // 2. -token cli option - // 3. CONSUL_HTTP_TOKEN_FILE environment variable - // 4. CONSUL_HTTP_TOKEN environment variable - if config.TokenFile != "" && config.TokenFile != defConfig.TokenFile { - data, err := os.ReadFile(config.TokenFile) - if err != nil { - return nil, fmt.Errorf("Error loading token file %s : %s", config.TokenFile, err) - } - - if token := strings.TrimSpace(string(data)); token != "" { - config.Token = token - } - } else if config.Token != "" && defConfig.Token != config.Token { - // Fall through - } else if defConfig.TokenFile != "" { - data, err := os.ReadFile(defConfig.TokenFile) - if err != nil { - return nil, fmt.Errorf("Error loading token file %s : %s", defConfig.TokenFile, err) - } - - if token := strings.TrimSpace(string(data)); token != "" { - config.Token = token - config.TokenFile = defConfig.TokenFile - } - } else { - config.Token = defConfig.Token - } - return &Client{config: *config, headers: make(http.Header)}, nil -} - -// NewHttpClient returns an http client configured with the given Transport and TLS -// config. -func NewHttpClient(transport *http.Transport, tlsConf TLSConfig) (*http.Client, error) { - client := &http.Client{ - Transport: transport, - } - - // TODO (slackpad) - Once we get some run time on the HTTP/2 support we - // should turn it on by default if TLS is enabled. We would basically - // just need to call http2.ConfigureTransport(transport) here. We also - // don't want to introduce another external dependency on - // golang.org/x/net/http2 at this time. For a complete recipe for how - // to enable HTTP/2 support on a transport suitable for the API client - // library see agent/http_test.go:TestHTTPServer_H2. - - if transport.TLSClientConfig == nil { - tlsClientConfig, err := SetupTLSConfig(&tlsConf) - - if err != nil { - return nil, err - } - - transport.TLSClientConfig = tlsClientConfig - } - - return client, nil -} - -// request is used to help build up a request -type request struct { - config *Config - method string - url *url.URL - params url.Values - body io.Reader - header http.Header - obj interface{} - ctx context.Context -} - -// setQueryOptions is used to annotate the request with -// additional query options -func (r *request) setQueryOptions(q *QueryOptions) { - if q == nil { - return - } - if q.Namespace != "" { - // For backwards-compatibility with existing tests, - // use the short-hand query param name "ns" - // rather than the alternative long-hand "namespace" - r.params.Set("ns", q.Namespace) - } - if q.Partition != "" { - // For backwards-compatibility with existing tests, - // use the long-hand query param name "partition" - // rather than the alternative short-hand "ap" - r.params.Set("partition", q.Partition) - } - if q.Datacenter != "" { - // For backwards-compatibility with existing tests, - // use the short-hand query param name "dc" - // rather than the alternative long-hand "datacenter" - r.params.Set("dc", q.Datacenter) - } - if q.Peer != "" { - r.params.Set("peer", q.Peer) - } - if q.AllowStale { - r.params.Set("stale", "") - } - if q.RequireConsistent { - r.params.Set("consistent", "") - } - if q.WaitIndex != 0 { - r.params.Set("index", strconv.FormatUint(q.WaitIndex, 10)) - } - if q.WaitTime != 0 { - r.params.Set("wait", durToMsec(q.WaitTime)) - } - if q.WaitHash != "" { - r.params.Set("hash", q.WaitHash) - } - if q.Token != "" { - r.header.Set("X-Consul-Token", q.Token) - } - if q.Near != "" { - r.params.Set("near", q.Near) - } - if q.Filter != "" { - r.params.Set("filter", q.Filter) - } - if len(q.NodeMeta) > 0 { - for key, value := range q.NodeMeta { - r.params.Add("node-meta", key+":"+value) - } - } - if q.RelayFactor != 0 { - r.params.Set("relay-factor", strconv.Itoa(int(q.RelayFactor))) - } - if q.LocalOnly { - r.params.Set("local-only", fmt.Sprintf("%t", q.LocalOnly)) - } - if q.Connect { - r.params.Set("connect", "true") - } - if q.UseCache && !q.RequireConsistent { - r.params.Set("cached", "") - - cc := []string{} - if q.MaxAge > 0 { - cc = append(cc, fmt.Sprintf("max-age=%.0f", q.MaxAge.Seconds())) - } - if q.StaleIfError > 0 { - cc = append(cc, fmt.Sprintf("stale-if-error=%.0f", q.StaleIfError.Seconds())) - } - if len(cc) > 0 { - r.header.Set("Cache-Control", strings.Join(cc, ", ")) - } - } - if q.MergeCentralConfig { - r.params.Set("merge-central-config", "") - } - if q.Global { - r.params.Set("global", "") - } - - r.ctx = q.ctx -} - -// durToMsec converts a duration to a millisecond specified string. If the -// user selected a positive value that rounds to 0 ms, then we will use 1 ms -// so they get a short delay, otherwise Consul will translate the 0 ms into -// a huge default delay. -func durToMsec(dur time.Duration) string { - ms := dur / time.Millisecond - if dur > 0 && ms == 0 { - ms = 1 - } - return fmt.Sprintf("%dms", ms) -} - -// serverError is a string we look for to detect 500 errors. -const serverError = "Unexpected response code: 500" - -// IsRetryableError returns true for 500 errors from the Consul servers, and -// network connection errors. These are usually retryable at a later time. -// This applies to reads but NOT to writes. This may return true for errors -// on writes that may have still gone through, so do not use this to retry -// any write operations. -func IsRetryableError(err error) bool { - if err == nil { - return false - } - - if _, ok := err.(net.Error); ok { - return true - } - - // TODO (slackpad) - Make a real error type here instead of using - // a string check. - return strings.Contains(err.Error(), serverError) -} - -// setWriteOptions is used to annotate the request with -// additional write options -func (r *request) setWriteOptions(q *WriteOptions) { - if q == nil { - return - } - // For backwards-compatibility, continue to use the shorthand "ns" - // rather than "namespace" - if q.Namespace != "" { - r.params.Set("ns", q.Namespace) - } - if q.Partition != "" { - r.params.Set("partition", q.Partition) - } - // For backwards-compatibility, continue to use the shorthand "dc" - // rather than "datacenter" - if q.Datacenter != "" { - r.params.Set("dc", q.Datacenter) - } - if q.Token != "" { - r.header.Set("X-Consul-Token", q.Token) - } - if q.RelayFactor != 0 { - r.params.Set("relay-factor", strconv.Itoa(int(q.RelayFactor))) - } - r.ctx = q.ctx -} - -// toHTTP converts the request to an HTTP request -func (r *request) toHTTP() (*http.Request, error) { - // Encode the query parameters - r.url.RawQuery = r.params.Encode() - - // Check if we should encode the body - if r.body == nil && r.obj != nil { - b, err := encodeBody(r.obj) - if err != nil { - return nil, err - } - r.body = b - } - - // Create the HTTP request - req, err := http.NewRequest(r.method, r.url.RequestURI(), r.body) - if err != nil { - return nil, err - } - - // validate that socket communications that do not use the host, detect - // slashes in the host name and replace it with local host. - // this is required since go started validating req.host in 1.20.6 and 1.19.11. - // prior to that they would strip out the slashes for you. They removed that - // behavior and added more strict validation as part of a CVE. - // This issue is being tracked by the Go team: - // https://github.com/golang/go/issues/61431 - // If there is a resolution in this issue, we will remove this code. - // In the time being, this is the accepted workaround. - if strings.HasPrefix(r.url.Host, "/") { - r.url.Host = "localhost" - } - - req.URL.Host = r.url.Host - req.URL.Scheme = r.url.Scheme - req.Host = r.url.Host - req.Header = r.header - - // Content-Type must always be set when a body is present - // See https://github.com/hashicorp/consul/issues/10011 - if req.Body != nil && req.Header.Get("Content-Type") == "" { - req.Header.Set("Content-Type", "application/json") - } - - // Setup auth - if r.config.HttpAuth != nil { - req.SetBasicAuth(r.config.HttpAuth.Username, r.config.HttpAuth.Password) - } - if r.ctx != nil { - return req.WithContext(r.ctx), nil - } - - return req, nil -} - -// newRequest is used to create a new request -func (c *Client) newRequest(method, path string) *request { - r := &request{ - config: &c.config, - method: method, - url: &url.URL{ - Scheme: c.config.Scheme, - Host: c.config.Address, - Path: c.config.PathPrefix + path, - }, - params: make(map[string][]string), - header: c.Headers(), - } - - if c.config.Datacenter != "" { - r.params.Set("dc", c.config.Datacenter) - } - if c.config.Namespace != "" { - r.params.Set("ns", c.config.Namespace) - } - if c.config.Partition != "" { - r.params.Set("partition", c.config.Partition) - } - if c.config.WaitTime != 0 { - r.params.Set("wait", durToMsec(r.config.WaitTime)) - } - if c.config.Token != "" { - r.header.Set("X-Consul-Token", r.config.Token) - } - return r -} - -// doRequest runs a request with our client -func (c *Client) doRequest(r *request) (time.Duration, *http.Response, error) { - req, err := r.toHTTP() - if err != nil { - return 0, nil, err - } - start := time.Now() - resp, err := c.config.HttpClient.Do(req) - diff := time.Since(start) - return diff, resp, err -} - -// Query is used to do a GET request against an endpoint -// and deserialize the response into an interface using -// standard Consul conventions. -func (c *Client) query(endpoint string, out interface{}, q *QueryOptions) (*QueryMeta, error) { - r := c.newRequest("GET", endpoint) - r.setQueryOptions(q) - rtt, resp, err := c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - if err := decodeBody(resp, out); err != nil { - return nil, err - } - return qm, nil -} - -// write is used to do a PUT request against an endpoint -// and serialize/deserialized using the standard Consul conventions. -func (c *Client) write(endpoint string, in, out interface{}, q *WriteOptions) (*WriteMeta, error) { - r := c.newRequest("PUT", endpoint) - r.setWriteOptions(q) - r.obj = in - rtt, resp, err := c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - wm := &WriteMeta{RequestTime: rtt} - if out != nil { - if err := decodeBody(resp, &out); err != nil { - return nil, err - } - } else if _, err := io.ReadAll(resp.Body); err != nil { - return nil, err - } - return wm, nil -} - -// parseQueryMeta is used to help parse query meta-data -// -// TODO(rb): bug? the error from this function is never handled -func parseQueryMeta(resp *http.Response, q *QueryMeta) error { - header := resp.Header - - // Parse the X-Consul-Index (if it's set - hash based blocking queries don't - // set this) - if indexStr := header.Get("X-Consul-Index"); indexStr != "" { - index, err := strconv.ParseUint(indexStr, 10, 64) - if err != nil { - return fmt.Errorf("Failed to parse X-Consul-Index: %v", err) - } - q.LastIndex = index - } - q.LastContentHash = header.Get("X-Consul-ContentHash") - - // Parse the X-Consul-LastContact - last, err := strconv.ParseUint(header.Get("X-Consul-LastContact"), 10, 64) - if err != nil { - return fmt.Errorf("Failed to parse X-Consul-LastContact: %v", err) - } - q.LastContact = time.Duration(last) * time.Millisecond - - // Parse the X-Consul-KnownLeader - switch header.Get("X-Consul-KnownLeader") { - case "true": - q.KnownLeader = true - default: - q.KnownLeader = false - } - - // Parse X-Consul-Translate-Addresses - switch header.Get("X-Consul-Translate-Addresses") { - case "true": - q.AddressTranslationEnabled = true - default: - q.AddressTranslationEnabled = false - } - - // Parse X-Consul-Default-ACL-Policy - switch v := header.Get("X-Consul-Default-ACL-Policy"); v { - case "allow", "deny": - q.DefaultACLPolicy = v - } - - // Parse the X-Consul-Results-Filtered-By-ACLs - switch header.Get("X-Consul-Results-Filtered-By-ACLs") { - case "true": - q.ResultsFilteredByACLs = true - default: - q.ResultsFilteredByACLs = false - } - - // Parse Cache info - if cacheStr := header.Get("X-Cache"); cacheStr != "" { - q.CacheHit = strings.EqualFold(cacheStr, "HIT") - } - if ageStr := header.Get("Age"); ageStr != "" { - age, err := strconv.ParseUint(ageStr, 10, 64) - if err != nil { - return fmt.Errorf("Failed to parse Age Header: %v", err) - } - q.CacheAge = time.Duration(age) * time.Second - } - - switch v := header.Get("X-Consul-Query-Backend"); v { - case QueryBackendStreaming, QueryBackendBlockingQuery: - q.QueryBackend = v - } - return nil -} - -// decodeBody is used to JSON decode a body -func decodeBody(resp *http.Response, out interface{}) error { - dec := json.NewDecoder(resp.Body) - return dec.Decode(out) -} - -// encodeBody is used to encode a request body -func encodeBody(obj interface{}) (io.Reader, error) { - buf := bytes.NewBuffer(nil) - enc := json.NewEncoder(buf) - if err := enc.Encode(obj); err != nil { - return nil, err - } - return buf, nil -} - -// requireOK is used to wrap doRequest and check for a 200 -func requireOK(resp *http.Response) error { - return requireHttpCodes(resp, 200) -} - -// requireHttpCodes checks for the "allowable" http codes for a response -func requireHttpCodes(resp *http.Response, httpCodes ...int) error { - // if there is an http code that we require, return w no error - for _, httpCode := range httpCodes { - if resp.StatusCode == httpCode { - return nil - } - } - - // if we reached here, then none of the http codes in resp matched any that we expected - // so err out - return generateUnexpectedResponseCodeError(resp) -} - -// closeResponseBody reads resp.Body until EOF, and then closes it. The read -// is necessary to ensure that the http.Client's underlying RoundTripper is able -// to re-use the TCP connection. See godoc on net/http.Client.Do. -func closeResponseBody(resp *http.Response) error { - _, _ = io.Copy(io.Discard, resp.Body) - return resp.Body.Close() -} - -func (req *request) filterQuery(filter string) { - if filter == "" { - return - } - - req.params.Set("filter", filter) -} - -// generateUnexpectedResponseCodeError consumes the rest of the body, closes -// the body stream and generates an error indicating the status code was -// unexpected. -func generateUnexpectedResponseCodeError(resp *http.Response) error { - var buf bytes.Buffer - io.Copy(&buf, resp.Body) - closeResponseBody(resp) - - trimmed := strings.TrimSpace(string(buf.Bytes())) - return StatusError{Code: resp.StatusCode, Body: trimmed} -} - -func requireNotFoundOrOK(resp *http.Response) (bool, *http.Response, error) { - switch resp.StatusCode { - case 200: - return true, resp, nil - case 404: - return false, resp, nil - default: - return false, nil, generateUnexpectedResponseCodeError(resp) - } -} diff --git a/vendor/github.com/hashicorp/consul/api/catalog.go b/vendor/github.com/hashicorp/consul/api/catalog.go deleted file mode 100644 index 0040ca6e7..000000000 --- a/vendor/github.com/hashicorp/consul/api/catalog.go +++ /dev/null @@ -1,377 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "net" - "strconv" -) - -type Weights struct { - Passing int - Warning int -} - -type Node struct { - ID string - Node string - Address string - Datacenter string - TaggedAddresses map[string]string - Meta map[string]string - CreateIndex uint64 - ModifyIndex uint64 - Partition string `json:",omitempty"` - PeerName string `json:",omitempty"` - Locality *Locality `json:",omitempty"` -} - -type ServiceAddress struct { - Address string - Port int -} - -type CatalogService struct { - ID string - Node string - Address string - Datacenter string - TaggedAddresses map[string]string - NodeMeta map[string]string - ServiceID string - ServiceName string - ServiceAddress string - ServiceTaggedAddresses map[string]ServiceAddress - ServiceTags []string - ServiceMeta map[string]string - ServicePort int - ServiceWeights Weights - ServiceEnableTagOverride bool - ServiceProxy *AgentServiceConnectProxyConfig - ServiceLocality *Locality `json:",omitempty"` - CreateIndex uint64 - Checks HealthChecks - ModifyIndex uint64 - Namespace string `json:",omitempty"` - Partition string `json:",omitempty"` -} - -type CatalogNode struct { - Node *Node - Services map[string]*AgentService -} - -type CatalogNodeServiceList struct { - Node *Node - Services []*AgentService -} - -type CatalogRegistration struct { - ID string - Node string - Address string - TaggedAddresses map[string]string - NodeMeta map[string]string - Datacenter string - Service *AgentService - Check *AgentCheck - Checks HealthChecks - SkipNodeUpdate bool - Partition string `json:",omitempty"` - Locality *Locality `json:",omitempty"` -} - -type CatalogDeregistration struct { - Node string - Address string `json:",omitempty"` // Obsolete. - Datacenter string - ServiceID string - CheckID string - Namespace string `json:",omitempty"` - Partition string `json:",omitempty"` -} - -type CompoundServiceName struct { - Name string - - // Namespacing is a Consul Enterprise feature. - Namespace string `json:",omitempty"` - // Partitions are a Consul Enterprise feature. - Partition string `json:",omitempty"` -} - -// GatewayService associates a gateway with a linked service. -// It also contains service-specific gateway configuration like ingress listener port and protocol. -type GatewayService struct { - Gateway CompoundServiceName - Service CompoundServiceName - GatewayKind ServiceKind - Port int `json:",omitempty"` - Protocol string `json:",omitempty"` - Hosts []string `json:",omitempty"` - CAFile string `json:",omitempty"` - CertFile string `json:",omitempty"` - KeyFile string `json:",omitempty"` - SNI string `json:",omitempty"` - FromWildcard bool `json:",omitempty"` -} - -// Catalog can be used to query the Catalog endpoints -type Catalog struct { - c *Client -} - -// Catalog returns a handle to the catalog endpoints -func (c *Client) Catalog() *Catalog { - return &Catalog{c} -} - -func (c *Catalog) Register(reg *CatalogRegistration, q *WriteOptions) (*WriteMeta, error) { - r := c.c.newRequest("PUT", "/v1/catalog/register") - r.setWriteOptions(q) - r.obj = reg - rtt, resp, err := c.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - wm := &WriteMeta{} - wm.RequestTime = rtt - - return wm, nil -} - -func (c *Catalog) Deregister(dereg *CatalogDeregistration, q *WriteOptions) (*WriteMeta, error) { - r := c.c.newRequest("PUT", "/v1/catalog/deregister") - r.setWriteOptions(q) - r.obj = dereg - rtt, resp, err := c.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - wm := &WriteMeta{} - wm.RequestTime = rtt - - return wm, nil -} - -// Datacenters is used to query for all the known datacenters -func (c *Catalog) Datacenters() ([]string, error) { - r := c.c.newRequest("GET", "/v1/catalog/datacenters") - _, resp, err := c.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - var out []string - if err := decodeBody(resp, &out); err != nil { - return nil, err - } - return out, nil -} - -// Nodes is used to query all the known nodes -func (c *Catalog) Nodes(q *QueryOptions) ([]*Node, *QueryMeta, error) { - r := c.c.newRequest("GET", "/v1/catalog/nodes") - r.setQueryOptions(q) - rtt, resp, err := c.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out []*Node - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return out, qm, nil -} - -// Services is used to query for all known services -func (c *Catalog) Services(q *QueryOptions) (map[string][]string, *QueryMeta, error) { - r := c.c.newRequest("GET", "/v1/catalog/services") - r.setQueryOptions(q) - rtt, resp, err := c.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out map[string][]string - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return out, qm, nil -} - -// Service is used to query catalog entries for a given service -func (c *Catalog) Service(service, tag string, q *QueryOptions) ([]*CatalogService, *QueryMeta, error) { - var tags []string - if tag != "" { - tags = []string{tag} - } - return c.service(service, tags, q, false) -} - -// Supports multiple tags for filtering -func (c *Catalog) ServiceMultipleTags(service string, tags []string, q *QueryOptions) ([]*CatalogService, *QueryMeta, error) { - return c.service(service, tags, q, false) -} - -// Connect is used to query catalog entries for a given Connect-enabled service -func (c *Catalog) Connect(service, tag string, q *QueryOptions) ([]*CatalogService, *QueryMeta, error) { - var tags []string - if tag != "" { - tags = []string{tag} - } - return c.service(service, tags, q, true) -} - -// Supports multiple tags for filtering -func (c *Catalog) ConnectMultipleTags(service string, tags []string, q *QueryOptions) ([]*CatalogService, *QueryMeta, error) { - return c.service(service, tags, q, true) -} - -func (c *Catalog) service(service string, tags []string, q *QueryOptions, connect bool) ([]*CatalogService, *QueryMeta, error) { - path := "/v1/catalog/service/" + service - if connect { - path = "/v1/catalog/connect/" + service - } - r := c.c.newRequest("GET", path) - r.setQueryOptions(q) - if len(tags) > 0 { - for _, tag := range tags { - r.params.Add("tag", tag) - } - } - rtt, resp, err := c.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out []*CatalogService - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return out, qm, nil -} - -// Node is used to query for service information about a single node -func (c *Catalog) Node(node string, q *QueryOptions) (*CatalogNode, *QueryMeta, error) { - r := c.c.newRequest("GET", "/v1/catalog/node/"+node) - r.setQueryOptions(q) - rtt, resp, err := c.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out *CatalogNode - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return out, qm, nil -} - -// NodeServiceList is used to query for service information about a single node. It differs from -// the Node function only in its return type which will contain a list of services as opposed to -// a map of service ids to services. This different structure allows for using the wildcard specifier -// '*' for the Namespace in the QueryOptions. -func (c *Catalog) NodeServiceList(node string, q *QueryOptions) (*CatalogNodeServiceList, *QueryMeta, error) { - r := c.c.newRequest("GET", "/v1/catalog/node-services/"+node) - r.setQueryOptions(q) - rtt, resp, err := c.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out *CatalogNodeServiceList - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return out, qm, nil -} - -// GatewayServices is used to query the services associated with an ingress gateway or terminating gateway. -func (c *Catalog) GatewayServices(gateway string, q *QueryOptions) ([]*GatewayService, *QueryMeta, error) { - r := c.c.newRequest("GET", "/v1/catalog/gateway-services/"+gateway) - r.setQueryOptions(q) - rtt, resp, err := c.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out []*GatewayService - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return out, qm, nil -} - -func ParseServiceAddr(addrPort string) (ServiceAddress, error) { - port := 0 - host, portStr, err := net.SplitHostPort(addrPort) - if err == nil { - port, err = strconv.Atoi(portStr) - } - return ServiceAddress{Address: host, Port: port}, err -} diff --git a/vendor/github.com/hashicorp/consul/api/config_entry.go b/vendor/github.com/hashicorp/consul/api/config_entry.go deleted file mode 100644 index ffc18a85e..000000000 --- a/vendor/github.com/hashicorp/consul/api/config_entry.go +++ /dev/null @@ -1,688 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "bytes" - "encoding/json" - "fmt" - "io" - "strconv" - "strings" - "time" - - "github.com/mitchellh/mapstructure" -) - -const ( - ServiceDefaults string = "service-defaults" - ProxyDefaults string = "proxy-defaults" - ServiceRouter string = "service-router" - ServiceSplitter string = "service-splitter" - ServiceResolver string = "service-resolver" - IngressGateway string = "ingress-gateway" - TerminatingGateway string = "terminating-gateway" - ServiceIntentions string = "service-intentions" - MeshConfig string = "mesh" - ExportedServices string = "exported-services" - SamenessGroup string = "sameness-group" - RateLimitIPConfig string = "control-plane-request-limit" - - ProxyConfigGlobal string = "global" - MeshConfigMesh string = "mesh" - APIGateway string = "api-gateway" - TCPRoute string = "tcp-route" - InlineCertificate string = "inline-certificate" - HTTPRoute string = "http-route" - JWTProvider string = "jwt-provider" -) - -const ( - BuiltinAWSLambdaExtension string = "builtin/aws/lambda" - BuiltinExtAuthzExtension string = "builtin/ext-authz" - BuiltinLuaExtension string = "builtin/lua" - BuiltinOTELAccessLoggingExtension string = "builtin/otel-access-logging" - BuiltinPropertyOverrideExtension string = "builtin/property-override" - BuiltinWasmExtension string = "builtin/wasm" - // BuiltinValidateExtension should not be exposed directly or accepted as a valid configured - // extension type, as it is only used indirectly via troubleshooting tools. It is included here - // for common reference alongside other builtin extensions. - BuiltinValidateExtension string = "builtin/proxy/validate" -) - -type ConfigEntry interface { - GetKind() string - GetName() string - GetPartition() string - GetNamespace() string - GetMeta() map[string]string - GetCreateIndex() uint64 - GetModifyIndex() uint64 -} - -type MeshGatewayMode string - -const ( - // MeshGatewayModeDefault represents no specific mode and should - // be used to indicate that a different layer of the configuration - // chain should take precedence - MeshGatewayModeDefault MeshGatewayMode = "" - - // MeshGatewayModeNone represents that the Upstream Connect connections - // should be direct and not flow through a mesh gateway. - MeshGatewayModeNone MeshGatewayMode = "none" - - // MeshGatewayModeLocal represents that the Upstream Connect connections - // should be made to a mesh gateway in the local datacenter. - MeshGatewayModeLocal MeshGatewayMode = "local" - - // MeshGatewayModeRemote represents that the Upstream Connect connections - // should be made to a mesh gateway in a remote datacenter. - MeshGatewayModeRemote MeshGatewayMode = "remote" -) - -// MeshGatewayConfig controls how Mesh Gateways are used for upstream Connect -// services -type MeshGatewayConfig struct { - // Mode is the mode that should be used for the upstream connection. - Mode MeshGatewayMode `json:",omitempty"` -} - -type ProxyMode string - -const ( - // ProxyModeDefault represents no specific mode and should - // be used to indicate that a different layer of the configuration - // chain should take precedence - ProxyModeDefault ProxyMode = "" - - // ProxyModeTransparent represents that inbound and outbound application - // traffic is being captured and redirected through the proxy. - ProxyModeTransparent ProxyMode = "transparent" - - // ProxyModeDirect represents that the proxy's listeners must be dialed directly - // by the local application and other proxies. - ProxyModeDirect ProxyMode = "direct" -) - -type TransparentProxyConfig struct { - // The port of the listener where outbound application traffic is being redirected to. - OutboundListenerPort int `json:",omitempty" alias:"outbound_listener_port"` - - // DialedDirectly indicates whether transparent proxies can dial this proxy instance directly. - // The discovery chain is not considered when dialing a service instance directly. - // This setting is useful when addressing stateful services, such as a database cluster with a leader node. - DialedDirectly bool `json:",omitempty" alias:"dialed_directly"` -} - -type MutualTLSMode string - -const ( - // MutualTLSModeDefault represents no specific mode and should - // be used to indicate that a different layer of the configuration - // chain should take precedence. - MutualTLSModeDefault MutualTLSMode = "" - - // MutualTLSModeStrict requires mTLS for incoming traffic. - MutualTLSModeStrict MutualTLSMode = "strict" - - // MutualTLSModePermissive allows incoming non-mTLS traffic. - MutualTLSModePermissive MutualTLSMode = "permissive" -) - -// ExposeConfig describes HTTP paths to expose through Envoy outside of Connect. -// Users can expose individual paths and/or all HTTP/GRPC paths for checks. -type ExposeConfig struct { - // Checks defines whether paths associated with Consul checks will be exposed. - // This flag triggers exposing all HTTP and GRPC check paths registered for the service. - Checks bool `json:",omitempty"` - - // Paths is the list of paths exposed through the proxy. - Paths []ExposePath `json:",omitempty"` -} - -// EnvoyExtension has configuration for an extension that patches Envoy resources. -type EnvoyExtension struct { - Name string - Required bool - Arguments map[string]interface{} `bexpr:"-"` - ConsulVersion string - EnvoyVersion string -} - -type ExposePath struct { - // ListenerPort defines the port of the proxy's listener for exposed paths. - ListenerPort int `json:",omitempty" alias:"listener_port"` - - // Path is the path to expose through the proxy, ie. "/metrics." - Path string `json:",omitempty"` - - // LocalPathPort is the port that the service is listening on for the given path. - LocalPathPort int `json:",omitempty" alias:"local_path_port"` - - // Protocol describes the upstream's service protocol. - // Valid values are "http" and "http2", defaults to "http" - Protocol string `json:",omitempty"` - - // ParsedFromCheck is set if this path was parsed from a registered check - ParsedFromCheck bool -} - -type LogSinkType string - -const ( - DefaultLogSinkType LogSinkType = "" - FileLogSinkType LogSinkType = "file" - StdErrLogSinkType LogSinkType = "stderr" - StdOutLogSinkType LogSinkType = "stdout" -) - -// AccessLogsConfig contains the associated default settings for all Envoy instances within the datacenter or partition -type AccessLogsConfig struct { - // Enabled turns off all access logging - Enabled bool `json:",omitempty" alias:"enabled"` - - // DisableListenerLogs turns off just listener logs for connections rejected by Envoy because they don't - // have a matching listener filter. - DisableListenerLogs bool `json:",omitempty" alias:"disable_listener_logs"` - - // Type selects the output for logs: "file", "stderr". "stdout" - Type LogSinkType `json:",omitempty" alias:"type"` - - // Path is the output file to write logs - Path string `json:",omitempty" alias:"path"` - - // The presence of one format string or the other implies the access log string encoding. - // Defining Both is invalid. - JSONFormat string `json:",omitempty" alias:"json_format"` - TextFormat string `json:",omitempty" alias:"text_format"` -} - -type UpstreamConfiguration struct { - // Overrides is a slice of per-service configuration. The name field is - // required. - Overrides []*UpstreamConfig `json:",omitempty"` - - // Defaults contains default configuration for all upstreams of a given - // service. The name field must be empty. - Defaults *UpstreamConfig `json:",omitempty"` -} - -type UpstreamConfig struct { - // Name is only accepted within service-defaults.upstreamConfig.overrides . - Name string `json:",omitempty"` - - // Partition is only accepted within service-defaults.upstreamConfig.overrides . - Partition string `json:",omitempty"` - - // Namespace is only accepted within service-defaults.upstreamConfig.overrides . - Namespace string `json:",omitempty"` - - // Peer is only accepted within service-defaults.upstreamConfig.overrides . - Peer string `json:",omitempty"` - - // EnvoyListenerJSON is a complete override ("escape hatch") for the upstream's - // listener. - // - // Note: This escape hatch is NOT compatible with the discovery chain and - // will be ignored if a discovery chain is active. - EnvoyListenerJSON string `json:",omitempty" alias:"envoy_listener_json"` - - // EnvoyClusterJSON is a complete override ("escape hatch") for the upstream's - // cluster. The Connect client TLS certificate and context will be injected - // overriding any TLS settings present. - // - // Note: This escape hatch is NOT compatible with the discovery chain and - // will be ignored if a discovery chain is active. - EnvoyClusterJSON string `json:",omitempty" alias:"envoy_cluster_json"` - - // Protocol describes the upstream's service protocol. Valid values are "tcp", - // "http" and "grpc". Anything else is treated as tcp. The enables protocol - // aware features like per-request metrics and connection pooling, tracing, - // routing etc. - Protocol string `json:",omitempty"` - - // ConnectTimeoutMs is the number of milliseconds to timeout making a new - // connection to this upstream. Defaults to 5000 (5 seconds) if not set. - ConnectTimeoutMs int `json:",omitempty" alias:"connect_timeout_ms"` - - // Limits are the set of limits that are applied to the proxy for a specific upstream of a - // service instance. - Limits *UpstreamLimits `json:",omitempty"` - - // PassiveHealthCheck configuration determines how upstream proxy instances will - // be monitored for removal from the load balancing pool. - PassiveHealthCheck *PassiveHealthCheck `json:",omitempty" alias:"passive_health_check"` - - // MeshGatewayConfig controls how Mesh Gateways are configured and used - MeshGateway MeshGatewayConfig `json:",omitempty" alias:"mesh_gateway" ` - - // BalanceOutboundConnections indicates that the proxy should attempt to evenly distribute - // outbound connections across worker threads. Only used by envoy proxies. - BalanceOutboundConnections string `json:",omitempty" alias:"balance_outbound_connections"` -} - -// DestinationConfig represents a virtual service, i.e. one that is external to Consul -type DestinationConfig struct { - // Addresses of the endpoint; hostname or IP - Addresses []string `json:",omitempty"` - - // Port allowed within this endpoint - Port int `json:",omitempty"` -} - -type PassiveHealthCheck struct { - // Interval between health check analysis sweeps. Each sweep may remove - // hosts or return hosts to the pool. - Interval time.Duration `json:",omitempty"` - - // MaxFailures is the count of consecutive failures that results in a host - // being removed from the pool. - MaxFailures uint32 `alias:"max_failures"` - - // EnforcingConsecutive5xx is the % chance that a host will be actually ejected - // when an outlier status is detected through consecutive 5xx. - // This setting can be used to disable ejection or to ramp it up slowly. - EnforcingConsecutive5xx *uint32 `json:",omitempty" alias:"enforcing_consecutive_5xx"` - - // The maximum % of an upstream cluster that can be ejected due to outlier detection. - // Defaults to 10% but will eject at least one host regardless of the value. - MaxEjectionPercent *uint32 `json:",omitempty" alias:"max_ejection_percent"` - - // The base time that a host is ejected for. The real time is equal to the base time - // multiplied by the number of times the host has been ejected and is capped by - // max_ejection_time (Default 300s). Defaults to 30000ms or 30s. - BaseEjectionTime *time.Duration `json:",omitempty" alias:"base_ejection_time"` -} - -// UpstreamLimits describes the limits that are associated with a specific -// upstream of a service instance. -type UpstreamLimits struct { - // MaxConnections is the maximum number of connections the local proxy can - // make to the upstream service. - MaxConnections *int `alias:"max_connections"` - - // MaxPendingRequests is the maximum number of requests that will be queued - // waiting for an available connection. This is mostly applicable to HTTP/1.1 - // clusters since all HTTP/2 requests are streamed over a single - // connection. - MaxPendingRequests *int `alias:"max_pending_requests"` - - // MaxConcurrentRequests is the maximum number of in-flight requests that will be allowed - // to the upstream cluster at a point in time. This is mostly applicable to HTTP/2 - // clusters since all HTTP/1.1 requests are limited by MaxConnections. - MaxConcurrentRequests *int `alias:"max_concurrent_requests"` -} - -// RateLimits is rate limiting configuration that is applied to -// inbound traffic for a service. -// Rate limiting is a Consul enterprise feature. -type RateLimits struct { - InstanceLevel InstanceLevelRateLimits `alias:"instance_level"` -} - -// InstanceLevelRateLimits represents rate limit configuration -// that are applied per service instance. -type InstanceLevelRateLimits struct { - // RequestsPerSecond is the average number of requests per second that can be - // made without being throttled. This field is required if RequestsMaxBurst - // is set. The allowed number of requests may exceed RequestsPerSecond up to - // the value specified in RequestsMaxBurst. - // - // Internally, this is the refill rate of the token bucket used for rate limiting. - RequestsPerSecond int `alias:"requests_per_second"` - - // RequestsMaxBurst is the maximum number of requests that can be sent - // in a burst. Should be equal to or greater than RequestsPerSecond. - // If unset, defaults to RequestsPerSecond. - // - // Internally, this is the maximum size of the token bucket used for rate limiting. - RequestsMaxBurst int `alias:"requests_max_burst"` - - // Routes is a list of rate limits applied to specific routes. - // For a given request, the first matching route will be applied, if any - // Overrides any top-level configuration. - Routes []InstanceLevelRouteRateLimits -} - -// InstanceLevelRouteRateLimits represents rate limit configuration -// applied to a route matching one of PathExact/PathPrefix/PathRegex. -type InstanceLevelRouteRateLimits struct { - PathExact string `alias:"path_exact"` - PathPrefix string `alias:"path_prefix"` - PathRegex string `alias:"path_regex"` - - RequestsPerSecond int `alias:"requests_per_second"` - RequestsMaxBurst int `alias:"requests_max_burst"` -} - -type ServiceConfigEntry struct { - Kind string - Name string - Partition string `json:",omitempty"` - Namespace string `json:",omitempty"` - Protocol string `json:",omitempty"` - Mode ProxyMode `json:",omitempty"` - TransparentProxy *TransparentProxyConfig `json:",omitempty" alias:"transparent_proxy"` - MutualTLSMode MutualTLSMode `json:",omitempty" alias:"mutual_tls_mode"` - MeshGateway MeshGatewayConfig `json:",omitempty" alias:"mesh_gateway"` - Expose ExposeConfig `json:",omitempty"` - ExternalSNI string `json:",omitempty" alias:"external_sni"` - UpstreamConfig *UpstreamConfiguration `json:",omitempty" alias:"upstream_config"` - Destination *DestinationConfig `json:",omitempty"` - MaxInboundConnections int `json:",omitempty" alias:"max_inbound_connections"` - LocalConnectTimeoutMs int `json:",omitempty" alias:"local_connect_timeout_ms"` - LocalRequestTimeoutMs int `json:",omitempty" alias:"local_request_timeout_ms"` - BalanceInboundConnections string `json:",omitempty" alias:"balance_inbound_connections"` - RateLimits *RateLimits `json:",omitempty" alias:"rate_limits"` - EnvoyExtensions []EnvoyExtension `json:",omitempty" alias:"envoy_extensions"` - Meta map[string]string `json:",omitempty"` - CreateIndex uint64 - ModifyIndex uint64 -} - -func (s *ServiceConfigEntry) GetKind() string { return s.Kind } -func (s *ServiceConfigEntry) GetName() string { return s.Name } -func (s *ServiceConfigEntry) GetPartition() string { return s.Partition } -func (s *ServiceConfigEntry) GetNamespace() string { return s.Namespace } -func (s *ServiceConfigEntry) GetMeta() map[string]string { return s.Meta } -func (s *ServiceConfigEntry) GetCreateIndex() uint64 { return s.CreateIndex } -func (s *ServiceConfigEntry) GetModifyIndex() uint64 { return s.ModifyIndex } - -type ProxyConfigEntry struct { - Kind string - Name string - Partition string `json:",omitempty"` - Namespace string `json:",omitempty"` - Mode ProxyMode `json:",omitempty"` - TransparentProxy *TransparentProxyConfig `json:",omitempty" alias:"transparent_proxy"` - MutualTLSMode MutualTLSMode `json:",omitempty" alias:"mutual_tls_mode"` - Config map[string]interface{} `json:",omitempty"` - MeshGateway MeshGatewayConfig `json:",omitempty" alias:"mesh_gateway"` - Expose ExposeConfig `json:",omitempty"` - AccessLogs *AccessLogsConfig `json:",omitempty" alias:"access_logs"` - EnvoyExtensions []EnvoyExtension `json:",omitempty" alias:"envoy_extensions"` - FailoverPolicy *ServiceResolverFailoverPolicy `json:",omitempty" alias:"failover_policy"` - PrioritizeByLocality *ServiceResolverPrioritizeByLocality `json:",omitempty" alias:"prioritize_by_locality"` - - Meta map[string]string `json:",omitempty"` - CreateIndex uint64 - ModifyIndex uint64 -} - -func (p *ProxyConfigEntry) GetKind() string { return p.Kind } -func (p *ProxyConfigEntry) GetName() string { return ProxyConfigGlobal } -func (p *ProxyConfigEntry) GetPartition() string { return p.Partition } -func (p *ProxyConfigEntry) GetNamespace() string { return p.Namespace } -func (p *ProxyConfigEntry) GetMeta() map[string]string { return p.Meta } -func (p *ProxyConfigEntry) GetCreateIndex() uint64 { return p.CreateIndex } -func (p *ProxyConfigEntry) GetModifyIndex() uint64 { return p.ModifyIndex } - -func makeConfigEntry(kind, name string) (ConfigEntry, error) { - switch kind { - case ServiceDefaults: - return &ServiceConfigEntry{Kind: kind, Name: name}, nil - case ProxyDefaults: - return &ProxyConfigEntry{Kind: kind, Name: name}, nil - case ServiceRouter: - return &ServiceRouterConfigEntry{Kind: kind, Name: name}, nil - case ServiceSplitter: - return &ServiceSplitterConfigEntry{Kind: kind, Name: name}, nil - case ServiceResolver: - return &ServiceResolverConfigEntry{Kind: kind, Name: name}, nil - case IngressGateway: - return &IngressGatewayConfigEntry{Kind: kind, Name: name}, nil - case TerminatingGateway: - return &TerminatingGatewayConfigEntry{Kind: kind, Name: name}, nil - case ServiceIntentions: - return &ServiceIntentionsConfigEntry{Kind: kind, Name: name}, nil - case MeshConfig: - return &MeshConfigEntry{}, nil - case ExportedServices: - return &ExportedServicesConfigEntry{Name: name}, nil - case SamenessGroup: - return &SamenessGroupConfigEntry{Kind: kind, Name: name}, nil - case APIGateway: - return &APIGatewayConfigEntry{Kind: kind, Name: name}, nil - case TCPRoute: - return &TCPRouteConfigEntry{Kind: kind, Name: name}, nil - case InlineCertificate: - return &InlineCertificateConfigEntry{Kind: kind, Name: name}, nil - case HTTPRoute: - return &HTTPRouteConfigEntry{Kind: kind, Name: name}, nil - case RateLimitIPConfig: - return &RateLimitIPConfigEntry{Kind: kind, Name: name}, nil - case JWTProvider: - return &JWTProviderConfigEntry{Kind: kind, Name: name}, nil - default: - return nil, fmt.Errorf("invalid config entry kind: %s", kind) - } -} - -func MakeConfigEntry(kind, name string) (ConfigEntry, error) { - return makeConfigEntry(kind, name) -} - -// DecodeConfigEntry will decode the result of using json.Unmarshal of a config -// entry into a map[string]interface{}. -// -// Important caveats: -// -// - This will NOT work if the map[string]interface{} was produced using HCL -// decoding as that requires more extensive parsing to work around the issues -// with map[string][]interface{} that arise. -// -// - This will only decode fields using their camel case json field -// representations. -func DecodeConfigEntry(raw map[string]interface{}) (ConfigEntry, error) { - var entry ConfigEntry - - kindVal, ok := raw["Kind"] - if !ok { - kindVal, ok = raw["kind"] - } - if !ok { - return nil, fmt.Errorf("Payload does not contain a kind/Kind key at the top level") - } - - if kindStr, ok := kindVal.(string); ok { - newEntry, err := makeConfigEntry(kindStr, "") - if err != nil { - return nil, err - } - entry = newEntry - } else { - return nil, fmt.Errorf("Kind value in payload is not a string") - } - - decodeConf := &mapstructure.DecoderConfig{ - DecodeHook: mapstructure.ComposeDecodeHookFunc( - mapstructure.StringToTimeDurationHookFunc(), - mapstructure.StringToTimeHookFunc(time.RFC3339), - ), - Result: &entry, - WeaklyTypedInput: true, - } - - decoder, err := mapstructure.NewDecoder(decodeConf) - if err != nil { - return nil, err - } - - return entry, decoder.Decode(raw) -} - -func DecodeConfigEntryFromJSON(data []byte) (ConfigEntry, error) { - var raw map[string]interface{} - if err := json.Unmarshal(data, &raw); err != nil { - return nil, err - } - - return DecodeConfigEntry(raw) -} - -func decodeConfigEntrySlice(raw []map[string]interface{}) ([]ConfigEntry, error) { - var entries []ConfigEntry - for _, rawEntry := range raw { - entry, err := DecodeConfigEntry(rawEntry) - if err != nil { - return nil, err - } - entries = append(entries, entry) - } - return entries, nil -} - -// ConfigEntries can be used to query the Config endpoints -type ConfigEntries struct { - c *Client -} - -// Config returns a handle to the Config endpoints -func (c *Client) ConfigEntries() *ConfigEntries { - return &ConfigEntries{c} -} - -func (conf *ConfigEntries) Get(kind string, name string, q *QueryOptions) (ConfigEntry, *QueryMeta, error) { - if kind == "" || name == "" { - return nil, nil, fmt.Errorf("Both kind and name parameters must not be empty") - } - - entry, err := makeConfigEntry(kind, name) - if err != nil { - return nil, nil, err - } - - r := conf.c.newRequest("GET", fmt.Sprintf("/v1/config/%s/%s", kind, name)) - r.setQueryOptions(q) - rtt, resp, err := conf.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - if err := decodeBody(resp, entry); err != nil { - return nil, nil, err - } - - return entry, qm, nil -} - -func (conf *ConfigEntries) List(kind string, q *QueryOptions) ([]ConfigEntry, *QueryMeta, error) { - if kind == "" { - return nil, nil, fmt.Errorf("The kind parameter must not be empty") - } - - r := conf.c.newRequest("GET", fmt.Sprintf("/v1/config/%s", kind)) - r.setQueryOptions(q) - rtt, resp, err := conf.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var raw []map[string]interface{} - if err := decodeBody(resp, &raw); err != nil { - return nil, nil, err - } - - entries, err := decodeConfigEntrySlice(raw) - if err != nil { - return nil, nil, err - } - - return entries, qm, nil -} - -func (conf *ConfigEntries) Set(entry ConfigEntry, w *WriteOptions) (bool, *WriteMeta, error) { - return conf.set(entry, nil, w) -} - -func (conf *ConfigEntries) CAS(entry ConfigEntry, index uint64, w *WriteOptions) (bool, *WriteMeta, error) { - return conf.set(entry, map[string]string{"cas": strconv.FormatUint(index, 10)}, w) -} - -func (conf *ConfigEntries) set(entry ConfigEntry, params map[string]string, w *WriteOptions) (bool, *WriteMeta, error) { - r := conf.c.newRequest("PUT", "/v1/config") - r.setWriteOptions(w) - for param, value := range params { - r.params.Set(param, value) - } - r.obj = entry - rtt, resp, err := conf.c.doRequest(r) - if err != nil { - return false, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return false, nil, err - } - - var buf bytes.Buffer - if _, err := io.Copy(&buf, resp.Body); err != nil { - return false, nil, fmt.Errorf("Failed to read response: %v", err) - } - res := strings.Contains(buf.String(), "true") - - wm := &WriteMeta{RequestTime: rtt} - return res, wm, nil -} - -func (conf *ConfigEntries) Delete(kind string, name string, w *WriteOptions) (*WriteMeta, error) { - _, wm, err := conf.delete(kind, name, nil, w) - return wm, err -} - -// DeleteCAS performs a Check-And-Set deletion of the given config entry, and -// returns true if it was successful. If the provided index no longer matches -// the entry's ModifyIndex (i.e. it was modified by another process) then the -// operation will fail and return false. -func (conf *ConfigEntries) DeleteCAS(kind, name string, index uint64, w *WriteOptions) (bool, *WriteMeta, error) { - return conf.delete(kind, name, map[string]string{"cas": strconv.FormatUint(index, 10)}, w) -} - -func (conf *ConfigEntries) delete(kind, name string, params map[string]string, w *WriteOptions) (bool, *WriteMeta, error) { - if kind == "" || name == "" { - return false, nil, fmt.Errorf("Both kind and name parameters must not be empty") - } - - r := conf.c.newRequest("DELETE", fmt.Sprintf("/v1/config/%s/%s", kind, name)) - r.setWriteOptions(w) - for param, value := range params { - r.params.Set(param, value) - } - - rtt, resp, err := conf.c.doRequest(r) - if err != nil { - return false, nil, err - } - defer closeResponseBody(resp) - - if err := requireOK(resp); err != nil { - return false, nil, err - } - - var buf bytes.Buffer - if _, err := io.Copy(&buf, resp.Body); err != nil { - return false, nil, fmt.Errorf("Failed to read response: %v", err) - } - - res := strings.Contains(buf.String(), "true") - wm := &WriteMeta{RequestTime: rtt} - return res, wm, nil -} diff --git a/vendor/github.com/hashicorp/consul/api/config_entry_discoverychain.go b/vendor/github.com/hashicorp/consul/api/config_entry_discoverychain.go deleted file mode 100644 index 572d9d2d5..000000000 --- a/vendor/github.com/hashicorp/consul/api/config_entry_discoverychain.go +++ /dev/null @@ -1,385 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "encoding/json" - "time" - - "github.com/hashicorp/go-multierror" -) - -type ServiceRouterConfigEntry struct { - Kind string - Name string - Partition string `json:",omitempty"` - Namespace string `json:",omitempty"` - - Routes []ServiceRoute `json:",omitempty"` - - Meta map[string]string `json:",omitempty"` - CreateIndex uint64 - ModifyIndex uint64 -} - -func (e *ServiceRouterConfigEntry) GetKind() string { return e.Kind } -func (e *ServiceRouterConfigEntry) GetName() string { return e.Name } -func (e *ServiceRouterConfigEntry) GetPartition() string { return e.Partition } -func (e *ServiceRouterConfigEntry) GetNamespace() string { return e.Namespace } -func (e *ServiceRouterConfigEntry) GetMeta() map[string]string { return e.Meta } -func (e *ServiceRouterConfigEntry) GetCreateIndex() uint64 { return e.CreateIndex } -func (e *ServiceRouterConfigEntry) GetModifyIndex() uint64 { return e.ModifyIndex } - -type ServiceRoute struct { - Match *ServiceRouteMatch `json:",omitempty"` - Destination *ServiceRouteDestination `json:",omitempty"` -} - -type ServiceRouteMatch struct { - HTTP *ServiceRouteHTTPMatch `json:",omitempty"` -} - -type ServiceRouteHTTPMatch struct { - PathExact string `json:",omitempty" alias:"path_exact"` - PathPrefix string `json:",omitempty" alias:"path_prefix"` - PathRegex string `json:",omitempty" alias:"path_regex"` - CaseInsensitive bool `json:",omitempty" alias:"case_insensitive"` - - Header []ServiceRouteHTTPMatchHeader `json:",omitempty"` - QueryParam []ServiceRouteHTTPMatchQueryParam `json:",omitempty" alias:"query_param"` - Methods []string `json:",omitempty"` -} - -type ServiceRouteHTTPMatchHeader struct { - Name string - Present bool `json:",omitempty"` - Exact string `json:",omitempty"` - Prefix string `json:",omitempty"` - Suffix string `json:",omitempty"` - Regex string `json:",omitempty"` - Invert bool `json:",omitempty"` -} - -type ServiceRouteHTTPMatchQueryParam struct { - Name string - Present bool `json:",omitempty"` - Exact string `json:",omitempty"` - Regex string `json:",omitempty"` -} - -type ServiceRouteDestination struct { - Service string `json:",omitempty"` - ServiceSubset string `json:",omitempty" alias:"service_subset"` - Namespace string `json:",omitempty"` - Partition string `json:",omitempty"` - PrefixRewrite string `json:",omitempty" alias:"prefix_rewrite"` - RequestTimeout time.Duration `json:",omitempty" alias:"request_timeout"` - IdleTimeout time.Duration `json:",omitempty" alias:"idle_timeout"` - NumRetries uint32 `json:",omitempty" alias:"num_retries"` - RetryOnConnectFailure bool `json:",omitempty" alias:"retry_on_connect_failure"` - RetryOnStatusCodes []uint32 `json:",omitempty" alias:"retry_on_status_codes"` - RetryOn []string `json:",omitempty" alias:"retry_on"` - RequestHeaders *HTTPHeaderModifiers `json:",omitempty" alias:"request_headers"` - ResponseHeaders *HTTPHeaderModifiers `json:",omitempty" alias:"response_headers"` -} - -func (e *ServiceRouteDestination) MarshalJSON() ([]byte, error) { - type Alias ServiceRouteDestination - exported := &struct { - RequestTimeout string `json:",omitempty"` - IdleTimeout string `json:",omitempty"` - *Alias - }{ - RequestTimeout: e.RequestTimeout.String(), - IdleTimeout: e.IdleTimeout.String(), - Alias: (*Alias)(e), - } - if e.RequestTimeout == 0 { - exported.RequestTimeout = "" - } - if e.IdleTimeout == 0 { - exported.IdleTimeout = "" - } - - return json.Marshal(exported) -} - -func (e *ServiceRouteDestination) UnmarshalJSON(data []byte) error { - type Alias ServiceRouteDestination - aux := &struct { - RequestTimeout string - IdleTimeout string - *Alias - }{ - Alias: (*Alias)(e), - } - if err := json.Unmarshal(data, &aux); err != nil { - return err - } - var err error - if aux.RequestTimeout != "" { - if e.RequestTimeout, err = time.ParseDuration(aux.RequestTimeout); err != nil { - return err - } - } - if aux.IdleTimeout != "" { - if e.IdleTimeout, err = time.ParseDuration(aux.IdleTimeout); err != nil { - return err - } - } - return nil -} - -type ServiceSplitterConfigEntry struct { - Kind string - Name string - Partition string `json:",omitempty"` - Namespace string `json:",omitempty"` - - Splits []ServiceSplit `json:",omitempty"` - - Meta map[string]string `json:",omitempty"` - CreateIndex uint64 - ModifyIndex uint64 -} - -func (e *ServiceSplitterConfigEntry) GetKind() string { return e.Kind } -func (e *ServiceSplitterConfigEntry) GetName() string { return e.Name } -func (e *ServiceSplitterConfigEntry) GetPartition() string { return e.Partition } -func (e *ServiceSplitterConfigEntry) GetNamespace() string { return e.Namespace } -func (e *ServiceSplitterConfigEntry) GetMeta() map[string]string { return e.Meta } -func (e *ServiceSplitterConfigEntry) GetCreateIndex() uint64 { return e.CreateIndex } -func (e *ServiceSplitterConfigEntry) GetModifyIndex() uint64 { return e.ModifyIndex } - -type ServiceSplit struct { - Weight float32 - Service string `json:",omitempty"` - ServiceSubset string `json:",omitempty" alias:"service_subset"` - Namespace string `json:",omitempty"` - Partition string `json:",omitempty"` - RequestHeaders *HTTPHeaderModifiers `json:",omitempty" alias:"request_headers"` - ResponseHeaders *HTTPHeaderModifiers `json:",omitempty" alias:"response_headers"` -} - -type ServiceResolverConfigEntry struct { - Kind string - Name string - Partition string `json:",omitempty"` - Namespace string `json:",omitempty"` - - DefaultSubset string `json:",omitempty" alias:"default_subset"` - Subsets map[string]ServiceResolverSubset `json:",omitempty"` - Redirect *ServiceResolverRedirect `json:",omitempty"` - Failover map[string]ServiceResolverFailover `json:",omitempty"` - ConnectTimeout time.Duration `json:",omitempty" alias:"connect_timeout"` - RequestTimeout time.Duration `json:",omitempty" alias:"request_timeout"` - - // PrioritizeByLocality controls whether the locality of services within the - // local partition will be used to prioritize connectivity. - PrioritizeByLocality *ServiceResolverPrioritizeByLocality `json:",omitempty" alias:"prioritize_by_locality"` - - // LoadBalancer determines the load balancing policy and configuration for services - // issuing requests to this upstream service. - LoadBalancer *LoadBalancer `json:",omitempty" alias:"load_balancer"` - - Meta map[string]string `json:",omitempty"` - CreateIndex uint64 - ModifyIndex uint64 -} - -func (e *ServiceResolverConfigEntry) MarshalJSON() ([]byte, error) { - type Alias ServiceResolverConfigEntry - exported := &struct { - ConnectTimeout string `json:",omitempty"` - RequestTimeout string `json:",omitempty"` - *Alias - }{ - ConnectTimeout: e.ConnectTimeout.String(), - RequestTimeout: e.RequestTimeout.String(), - Alias: (*Alias)(e), - } - if e.ConnectTimeout == 0 { - exported.ConnectTimeout = "" - } - if e.RequestTimeout == 0 { - exported.RequestTimeout = "" - } - - return json.Marshal(exported) -} - -func (e *ServiceResolverConfigEntry) UnmarshalJSON(data []byte) error { - type Alias ServiceResolverConfigEntry - aux := &struct { - ConnectTimeout string - RequestTimeout string - *Alias - }{ - Alias: (*Alias)(e), - } - var err error - if err = json.Unmarshal(data, &aux); err != nil { - return err - } - var merr *multierror.Error - if aux.ConnectTimeout != "" { - if e.ConnectTimeout, err = time.ParseDuration(aux.ConnectTimeout); err != nil { - merr = multierror.Append(merr, err) - } - } - if aux.RequestTimeout != "" { - if e.RequestTimeout, err = time.ParseDuration(aux.RequestTimeout); err != nil { - merr = multierror.Append(merr, err) - } - } - return merr.ErrorOrNil() -} - -func (e *ServiceResolverConfigEntry) GetKind() string { return e.Kind } -func (e *ServiceResolverConfigEntry) GetName() string { return e.Name } -func (e *ServiceResolverConfigEntry) GetPartition() string { return e.Partition } -func (e *ServiceResolverConfigEntry) GetNamespace() string { return e.Namespace } -func (e *ServiceResolverConfigEntry) GetMeta() map[string]string { return e.Meta } -func (e *ServiceResolverConfigEntry) GetCreateIndex() uint64 { return e.CreateIndex } -func (e *ServiceResolverConfigEntry) GetModifyIndex() uint64 { return e.ModifyIndex } - -type ServiceResolverSubset struct { - Filter string `json:",omitempty"` - OnlyPassing bool `json:",omitempty" alias:"only_passing"` -} - -type ServiceResolverRedirect struct { - Service string `json:",omitempty"` - ServiceSubset string `json:",omitempty" alias:"service_subset"` - Namespace string `json:",omitempty"` - Partition string `json:",omitempty"` - Datacenter string `json:",omitempty"` - Peer string `json:",omitempty"` - SamenessGroup string `json:",omitempty" alias:"sameness_group"` -} - -type ServiceResolverFailover struct { - Service string `json:",omitempty"` - ServiceSubset string `json:",omitempty" alias:"service_subset"` - // Referencing other partitions is not supported. - Namespace string `json:",omitempty"` - Datacenters []string `json:",omitempty"` - Targets []ServiceResolverFailoverTarget `json:",omitempty"` - Policy *ServiceResolverFailoverPolicy `json:",omitempty"` - SamenessGroup string `json:",omitempty" alias:"sameness_group"` -} - -type ServiceResolverFailoverTarget struct { - Service string `json:",omitempty"` - ServiceSubset string `json:",omitempty" alias:"service_subset"` - Partition string `json:",omitempty"` - Namespace string `json:",omitempty"` - Datacenter string `json:",omitempty"` - Peer string `json:",omitempty"` -} - -type ServiceResolverFailoverPolicy struct { - // Mode specifies the type of failover that will be performed. Valid values are - // "sequential", "" (equivalent to "sequential") and "order-by-locality". - Mode string `json:",omitempty"` - Regions []string `json:",omitempty"` -} - -type ServiceResolverPrioritizeByLocality struct { - // Mode specifies the type of prioritization that will be performed - // when selecting nodes in the local partition. - // Valid values are: "" (default "none"), "none", and "failover". - Mode string `json:",omitempty"` -} - -// LoadBalancer determines the load balancing policy and configuration for services -// issuing requests to this upstream service. -type LoadBalancer struct { - // Policy is the load balancing policy used to select a host - Policy string `json:",omitempty"` - - // RingHashConfig contains configuration for the "ring_hash" policy type - RingHashConfig *RingHashConfig `json:",omitempty" alias:"ring_hash_config"` - - // LeastRequestConfig contains configuration for the "least_request" policy type - LeastRequestConfig *LeastRequestConfig `json:",omitempty" alias:"least_request_config"` - - // HashPolicies is a list of hash policies to use for hashing load balancing algorithms. - // Hash policies are evaluated individually and combined such that identical lists - // result in the same hash. - // If no hash policies are present, or none are successfully evaluated, - // then a random backend host will be selected. - HashPolicies []HashPolicy `json:",omitempty" alias:"hash_policies"` -} - -// RingHashConfig contains configuration for the "ring_hash" policy type -type RingHashConfig struct { - // MinimumRingSize determines the minimum number of entries in the hash ring - MinimumRingSize uint64 `json:",omitempty" alias:"minimum_ring_size"` - - // MaximumRingSize determines the maximum number of entries in the hash ring - MaximumRingSize uint64 `json:",omitempty" alias:"maximum_ring_size"` -} - -// LeastRequestConfig contains configuration for the "least_request" policy type -type LeastRequestConfig struct { - // ChoiceCount determines the number of random healthy hosts from which to select the one with the least requests. - ChoiceCount uint32 `json:",omitempty" alias:"choice_count"` -} - -// HashPolicy defines which attributes will be hashed by hash-based LB algorithms -type HashPolicy struct { - // Field is the attribute type to hash on. - // Must be one of "header","cookie", or "query_parameter". - // Cannot be specified along with SourceIP. - Field string `json:",omitempty"` - - // FieldValue is the value to hash. - // ie. header name, cookie name, URL query parameter name - // Cannot be specified along with SourceIP. - FieldValue string `json:",omitempty" alias:"field_value"` - - // CookieConfig contains configuration for the "cookie" hash policy type. - CookieConfig *CookieConfig `json:",omitempty" alias:"cookie_config"` - - // SourceIP determines whether the hash should be of the source IP rather than of a field and field value. - // Cannot be specified along with Field or FieldValue. - SourceIP bool `json:",omitempty" alias:"source_ip"` - - // Terminal will short circuit the computation of the hash when multiple hash policies are present. - // If a hash is computed when a Terminal policy is evaluated, - // then that hash will be used and subsequent hash policies will be ignored. - Terminal bool `json:",omitempty"` -} - -// CookieConfig contains configuration for the "cookie" hash policy type. -// This is specified to have Envoy generate a cookie for a client on its first request. -type CookieConfig struct { - // Generates a session cookie with no expiration. - Session bool `json:",omitempty"` - - // TTL for generated cookies. Cannot be specified for session cookies. - TTL time.Duration `json:",omitempty"` - - // The path to set for the cookie - Path string `json:",omitempty"` -} - -// HTTPHeaderModifiers is a set of rules for HTTP header modification that -// should be performed by proxies as the request passes through them. It can -// operate on either request or response headers depending on the context in -// which it is used. -type HTTPHeaderModifiers struct { - // Add is a set of name -> value pairs that should be appended to the request - // or response (i.e. allowing duplicates if the same header already exists). - Add map[string]string `json:",omitempty"` - - // Set is a set of name -> value pairs that should be added to the request or - // response, overwriting any existing header values of the same name. - Set map[string]string `json:",omitempty"` - - // Remove is the set of header names that should be stripped from the request - // or response. - Remove []string `json:",omitempty"` -} diff --git a/vendor/github.com/hashicorp/consul/api/config_entry_exports.go b/vendor/github.com/hashicorp/consul/api/config_entry_exports.go deleted file mode 100644 index b8e9830e6..000000000 --- a/vendor/github.com/hashicorp/consul/api/config_entry_exports.go +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "encoding/json" -) - -// ExportedServicesConfigEntry manages the exported services for a single admin partition. -// Admin Partitions are a Consul Enterprise feature. -type ExportedServicesConfigEntry struct { - // Name is the name of the partition the ExportedServicesConfigEntry applies to. - // Partitioning is a Consul Enterprise feature. - Name string `json:",omitempty"` - - // Partition is the partition where the ExportedServicesConfigEntry is stored. - // If the partition does not match the name, the name will overwrite the partition. - // Partitioning is a Consul Enterprise feature. - Partition string `json:",omitempty"` - - // Services is a list of services to be exported and the list of partitions - // to expose them to. - Services []ExportedService `json:",omitempty"` - - Meta map[string]string `json:",omitempty"` - - // CreateIndex is the Raft index this entry was created at. This is a - // read-only field. - CreateIndex uint64 - - // ModifyIndex is used for the Check-And-Set operations and can also be fed - // back into the WaitIndex of the QueryOptions in order to perform blocking - // queries. - ModifyIndex uint64 -} - -// ExportedService manages the exporting of a service in the local partition to -// other partitions. -type ExportedService struct { - // Name is the name of the service to be exported. - Name string - - // Namespace is the namespace to export the service from. - Namespace string `json:",omitempty"` - - // Consumers is a list of downstream consumers of the service to be exported. - Consumers []ServiceConsumer `json:",omitempty"` -} - -// ServiceConsumer represents a downstream consumer of the service to be exported. -// At most one of Partition or Peer must be specified. -type ServiceConsumer struct { - // Partition is the admin partition to export the service to. - Partition string `json:",omitempty"` - - // Peer is the name of the peer to export the service to. - Peer string `json:",omitempty" alias:"peer_name"` - - // SamenessGroup is the name of the sameness group to export the service to. - SamenessGroup string `json:",omitempty" alias:"sameness_group"` -} - -func (e *ExportedServicesConfigEntry) GetKind() string { return ExportedServices } -func (e *ExportedServicesConfigEntry) GetName() string { return e.Name } -func (e *ExportedServicesConfigEntry) GetPartition() string { return e.Name } -func (e *ExportedServicesConfigEntry) GetNamespace() string { return "" } -func (e *ExportedServicesConfigEntry) GetMeta() map[string]string { return e.Meta } -func (e *ExportedServicesConfigEntry) GetCreateIndex() uint64 { return e.CreateIndex } -func (e *ExportedServicesConfigEntry) GetModifyIndex() uint64 { return e.ModifyIndex } - -// MarshalJSON adds the Kind field so that the JSON can be decoded back into the -// correct type. -func (e *ExportedServicesConfigEntry) MarshalJSON() ([]byte, error) { - type Alias ExportedServicesConfigEntry - source := &struct { - Kind string - *Alias - }{ - Kind: ExportedServices, - Alias: (*Alias)(e), - } - return json.Marshal(source) -} diff --git a/vendor/github.com/hashicorp/consul/api/config_entry_gateways.go b/vendor/github.com/hashicorp/consul/api/config_entry_gateways.go deleted file mode 100644 index baf274e2d..000000000 --- a/vendor/github.com/hashicorp/consul/api/config_entry_gateways.go +++ /dev/null @@ -1,344 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -// IngressGatewayConfigEntry manages the configuration for an ingress service -// with the given name. -type IngressGatewayConfigEntry struct { - // Kind of the config entry. This should be set to api.IngressGateway. - Kind string - - // Name is used to match the config entry with its associated ingress gateway - // service. This should match the name provided in the service definition. - Name string - - // Partition is the partition the IngressGateway is associated with. - // Partitioning is a Consul Enterprise feature. - Partition string `json:",omitempty"` - - // Namespace is the namespace the IngressGateway is associated with. - // Namespacing is a Consul Enterprise feature. - Namespace string `json:",omitempty"` - - // TLS holds the TLS configuration for this gateway. - TLS GatewayTLSConfig - - // Listeners declares what ports the ingress gateway should listen on, and - // what services to associated to those ports. - Listeners []IngressListener - - Meta map[string]string `json:",omitempty"` - - // Defaults is default configuration for all upstream services - Defaults *IngressServiceConfig `json:",omitempty"` - - // CreateIndex is the Raft index this entry was created at. This is a - // read-only field. - CreateIndex uint64 - - // ModifyIndex is used for the Check-And-Set operations and can also be fed - // back into the WaitIndex of the QueryOptions in order to perform blocking - // queries. - ModifyIndex uint64 -} - -type IngressServiceConfig struct { - MaxConnections *uint32 - MaxPendingRequests *uint32 - MaxConcurrentRequests *uint32 - - // PassiveHealthCheck configuration determines how upstream proxy instances will - // be monitored for removal from the load balancing pool. - PassiveHealthCheck *PassiveHealthCheck `json:",omitempty" alias:"passive_health_check"` -} - -type GatewayTLSConfig struct { - // Indicates that TLS should be enabled for this gateway service. - Enabled bool - - // SDS allows configuring TLS certificate from an SDS service. - SDS *GatewayTLSSDSConfig `json:",omitempty"` - - TLSMinVersion string `json:",omitempty" alias:"tls_min_version"` - TLSMaxVersion string `json:",omitempty" alias:"tls_max_version"` - - // Define a subset of cipher suites to restrict - // Only applicable to connections negotiated via TLS 1.2 or earlier - CipherSuites []string `json:",omitempty" alias:"cipher_suites"` -} - -type GatewayServiceTLSConfig struct { - // SDS allows configuring TLS certificate from an SDS service. - SDS *GatewayTLSSDSConfig `json:",omitempty"` -} - -type GatewayTLSSDSConfig struct { - ClusterName string `json:",omitempty" alias:"cluster_name"` - CertResource string `json:",omitempty" alias:"cert_resource"` -} - -// IngressListener manages the configuration for a listener on a specific port. -type IngressListener struct { - // Port declares the port on which the ingress gateway should listen for traffic. - Port int - - // Protocol declares what type of traffic this listener is expected to - // receive. Depending on the protocol, a listener might support multiplexing - // services over a single port, or additional discovery chain features. The - // current supported values are: (tcp | http | http2 | grpc). - Protocol string - - // Services declares the set of services to which the listener forwards - // traffic. - // - // For "tcp" protocol listeners, only a single service is allowed. - // For "http" listeners, multiple services can be declared. - Services []IngressService - - // TLS allows specifying some TLS configuration per listener. - TLS *GatewayTLSConfig `json:",omitempty"` -} - -// IngressService manages configuration for services that are exposed to -// ingress traffic. -type IngressService struct { - // Name declares the service to which traffic should be forwarded. - // - // This can either be a specific service, or the wildcard specifier, - // "*". If the wildcard specifier is provided, the listener must be of "http" - // protocol and means that the listener will forward traffic to all services. - // - // A name can be specified on multiple listeners, and will be exposed on both - // of the listeners. - Name string - - // Hosts is a list of hostnames which should be associated to this service on - // the defined listener. Only allowed on layer 7 protocols, this will be used - // to route traffic to the service by matching the Host header of the HTTP - // request. - // - // If a host is provided for a service that also has a wildcard specifier - // defined, the host will override the wildcard-specifier-provided - // ".*" domain for that listener. - // - // This cannot be specified when using the wildcard specifier, "*", or when - // using a "tcp" listener. - Hosts []string - - // Namespace is the namespace where the service is located. - // Namespacing is a Consul Enterprise feature. - Namespace string `json:",omitempty"` - - // Partition is the partition where the service is located. - // Partitioning is a Consul Enterprise feature. - Partition string `json:",omitempty"` - - // TLS allows specifying some TLS configuration per listener. - TLS *GatewayServiceTLSConfig `json:",omitempty"` - - // Allow HTTP header manipulation to be configured. - RequestHeaders *HTTPHeaderModifiers `json:",omitempty" alias:"request_headers"` - ResponseHeaders *HTTPHeaderModifiers `json:",omitempty" alias:"response_headers"` - - MaxConnections *uint32 `json:",omitempty" alias:"max_connections"` - MaxPendingRequests *uint32 `json:",omitempty" alias:"max_pending_requests"` - MaxConcurrentRequests *uint32 `json:",omitempty" alias:"max_concurrent_requests"` - - // PassiveHealthCheck configuration determines how upstream proxy instances will - // be monitored for removal from the load balancing pool. - PassiveHealthCheck *PassiveHealthCheck `json:",omitempty" alias:"passive_health_check"` -} - -func (i *IngressGatewayConfigEntry) GetKind() string { return i.Kind } -func (i *IngressGatewayConfigEntry) GetName() string { return i.Name } -func (i *IngressGatewayConfigEntry) GetPartition() string { return i.Partition } -func (i *IngressGatewayConfigEntry) GetNamespace() string { return i.Namespace } -func (i *IngressGatewayConfigEntry) GetMeta() map[string]string { return i.Meta } -func (i *IngressGatewayConfigEntry) GetCreateIndex() uint64 { return i.CreateIndex } -func (i *IngressGatewayConfigEntry) GetModifyIndex() uint64 { return i.ModifyIndex } - -// TerminatingGatewayConfigEntry manages the configuration for a terminating gateway -// with the given name. -type TerminatingGatewayConfigEntry struct { - // Kind of the config entry. This should be set to api.TerminatingGateway. - Kind string - - // Name is used to match the config entry with its associated terminating gateway - // service. This should match the name provided in the service definition. - Name string - - // Services is a list of service names represented by the terminating gateway. - Services []LinkedService `json:",omitempty"` - - Meta map[string]string `json:",omitempty"` - - // CreateIndex is the Raft index this entry was created at. This is a - // read-only field. - CreateIndex uint64 - - // ModifyIndex is used for the Check-And-Set operations and can also be fed - // back into the WaitIndex of the QueryOptions in order to perform blocking - // queries. - ModifyIndex uint64 - - // Partition is the partition the config entry is associated with. - // Partitioning is a Consul Enterprise feature. - Partition string `json:",omitempty"` - - // Namespace is the namespace the config entry is associated with. - // Namespacing is a Consul Enterprise feature. - Namespace string `json:",omitempty"` -} - -// A LinkedService is a service represented by a terminating gateway -type LinkedService struct { - // Referencing other partitions is not supported. - - // Namespace is where the service is registered. - Namespace string `json:",omitempty"` - - // Name is the name of the service, as defined in Consul's catalog. - Name string `json:",omitempty"` - - // CAFile is the optional path to a CA certificate to use for TLS connections - // from the gateway to the linked service. - CAFile string `json:",omitempty" alias:"ca_file"` - - // CertFile is the optional path to a client certificate to use for TLS connections - // from the gateway to the linked service. - CertFile string `json:",omitempty" alias:"cert_file"` - - // KeyFile is the optional path to a private key to use for TLS connections - // from the gateway to the linked service. - KeyFile string `json:",omitempty" alias:"key_file"` - - // SNI is the optional name to specify during the TLS handshake with a linked service. - SNI string `json:",omitempty"` -} - -func (g *TerminatingGatewayConfigEntry) GetKind() string { return g.Kind } -func (g *TerminatingGatewayConfigEntry) GetName() string { return g.Name } -func (g *TerminatingGatewayConfigEntry) GetPartition() string { return g.Partition } -func (g *TerminatingGatewayConfigEntry) GetNamespace() string { return g.Namespace } -func (g *TerminatingGatewayConfigEntry) GetMeta() map[string]string { return g.Meta } -func (g *TerminatingGatewayConfigEntry) GetCreateIndex() uint64 { return g.CreateIndex } -func (g *TerminatingGatewayConfigEntry) GetModifyIndex() uint64 { return g.ModifyIndex } - -// APIGatewayConfigEntry manages the configuration for an API gateway -// with the given name. -type APIGatewayConfigEntry struct { - // Kind of the config entry. This should be set to api.APIGateway. - Kind string - - // Name is used to match the config entry with its associated api gateway - // service. This should match the name provided in the service definition. - Name string - - Meta map[string]string `json:",omitempty"` - - // Listeners is the set of listener configuration to which an API Gateway - // might bind. - Listeners []APIGatewayListener - // Status is the asynchronous status which an APIGateway propagates to the user. - Status ConfigEntryStatus - - // CreateIndex is the Raft index this entry was created at. This is a - // read-only field. - CreateIndex uint64 - - // ModifyIndex is used for the Check-And-Set operations and can also be fed - // back into the WaitIndex of the QueryOptions in order to perform blocking - // queries. - ModifyIndex uint64 - - // Partition is the partition the config entry is associated with. - // Partitioning is a Consul Enterprise feature. - Partition string `json:",omitempty"` - - // Namespace is the namespace the config entry is associated with. - // Namespacing is a Consul Enterprise feature. - Namespace string `json:",omitempty"` -} - -func (g *APIGatewayConfigEntry) GetKind() string { return g.Kind } -func (g *APIGatewayConfigEntry) GetName() string { return g.Name } -func (g *APIGatewayConfigEntry) GetPartition() string { return g.Partition } -func (g *APIGatewayConfigEntry) GetNamespace() string { return g.Namespace } -func (g *APIGatewayConfigEntry) GetMeta() map[string]string { return g.Meta } -func (g *APIGatewayConfigEntry) GetCreateIndex() uint64 { return g.CreateIndex } -func (g *APIGatewayConfigEntry) GetModifyIndex() uint64 { return g.ModifyIndex } - -// APIGatewayListener represents an individual listener for an APIGateway -type APIGatewayListener struct { - // Name is the name of the listener in a given gateway. This must be - // unique within a gateway. - Name string - // Hostname is the host name that a listener should be bound to, if - // unspecified, the listener accepts requests for all hostnames. - Hostname string - // Port is the port at which this listener should bind. - Port int - // Protocol is the protocol that a listener should use, it must - // either be "http" or "tcp" - Protocol string - // TLS is the TLS settings for the listener. - TLS APIGatewayTLSConfiguration - // Override is the policy that overrides all other policy and route specific configuration - Override *APIGatewayPolicy `json:",omitempty"` - // Default is the policy that is the default for the listener and route, routes can override this behavior - Default *APIGatewayPolicy `json:",omitempty"` -} - -// APIGatewayTLSConfiguration specifies the configuration of a listener’s -// TLS settings. -type APIGatewayTLSConfiguration struct { - // Certificates is a set of references to certificates - // that a gateway listener uses for TLS termination. - Certificates []ResourceReference - // MaxVersion is the maximum TLS version that the listener - // should support. - MaxVersion string `json:",omitempty" alias:"tls_max_version"` - // MinVersion is the minimum TLS version that the listener - // should support. - MinVersion string `json:",omitempty" alias:"tls_min_version"` - // Define a subset of cipher suites to restrict - // Only applicable to connections negotiated via TLS 1.2 or earlier - CipherSuites []string `json:",omitempty" alias:"cipher_suites"` -} - -// APIGatewayPolicy holds the policy that configures the gateway listener, this is used in the `Override` and `Default` fields of a listener -type APIGatewayPolicy struct { - // JWT holds the JWT configuration for the Listener - JWT *APIGatewayJWTRequirement `json:",omitempty"` -} - -// APIGatewayJWTRequirement holds the list of JWT providers to be verified against -type APIGatewayJWTRequirement struct { - // Providers is a list of providers to consider when verifying a JWT. - Providers []*APIGatewayJWTProvider `json:",omitempty"` -} - -// APIGatewayJWTProvider holds the provider and claim verification information -type APIGatewayJWTProvider struct { - // Name is the name of the JWT provider. There MUST be a corresponding - // "jwt-provider" config entry with this name. - Name string `json:",omitempty"` - - // VerifyClaims is a list of additional claims to verify in a JWT's payload. - VerifyClaims []*APIGatewayJWTClaimVerification `json:",omitempty" alias:"verify_claims"` -} - -// APIGatewayJWTClaimVerification holds the actual claim information to be verified -type APIGatewayJWTClaimVerification struct { - // Path is the path to the claim in the token JSON. - Path []string `json:",omitempty"` - - // Value is the expected value at the given path: - // - If the type at the path is a list then we verify - // that this value is contained in the list. - // - // - If the type at the path is a string then we verify - // that this value matches. - Value string `json:",omitempty"` -} diff --git a/vendor/github.com/hashicorp/consul/api/config_entry_inline_certificate.go b/vendor/github.com/hashicorp/consul/api/config_entry_inline_certificate.go deleted file mode 100644 index 47a1ead05..000000000 --- a/vendor/github.com/hashicorp/consul/api/config_entry_inline_certificate.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -// InlineCertificateConfigEntry -- TODO stub -type InlineCertificateConfigEntry struct { - // Kind of the config entry. This should be set to api.InlineCertificate. - Kind string - - // Name is used to match the config entry with its associated tcp-route - // service. This should match the name provided in the service definition. - Name string - - // Certificate is the public certificate component of an x509 key pair encoded in raw PEM format. - Certificate string - // PrivateKey is the private key component of an x509 key pair encoded in raw PEM format. - PrivateKey string `alias:"private_key"` - - Meta map[string]string `json:",omitempty"` - - // CreateIndex is the Raft index this entry was created at. This is a - // read-only field. - CreateIndex uint64 - - // ModifyIndex is used for the Check-And-Set operations and can also be fed - // back into the WaitIndex of the QueryOptions in order to perform blocking - // queries. - ModifyIndex uint64 - - // Partition is the partition the config entry is associated with. - // Partitioning is a Consul Enterprise feature. - Partition string `json:",omitempty"` - - // Namespace is the namespace the config entry is associated with. - // Namespacing is a Consul Enterprise feature. - Namespace string `json:",omitempty"` -} - -func (a *InlineCertificateConfigEntry) GetKind() string { return InlineCertificate } -func (a *InlineCertificateConfigEntry) GetName() string { return a.Name } -func (a *InlineCertificateConfigEntry) GetPartition() string { return a.Partition } -func (a *InlineCertificateConfigEntry) GetNamespace() string { return a.Namespace } -func (a *InlineCertificateConfigEntry) GetMeta() map[string]string { return a.Meta } -func (a *InlineCertificateConfigEntry) GetCreateIndex() uint64 { return a.CreateIndex } -func (a *InlineCertificateConfigEntry) GetModifyIndex() uint64 { return a.ModifyIndex } diff --git a/vendor/github.com/hashicorp/consul/api/config_entry_intentions.go b/vendor/github.com/hashicorp/consul/api/config_entry_intentions.go deleted file mode 100644 index 3f03b0875..000000000 --- a/vendor/github.com/hashicorp/consul/api/config_entry_intentions.go +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import "time" - -type ServiceIntentionsConfigEntry struct { - Kind string - Name string - Partition string `json:",omitempty"` - Namespace string `json:",omitempty"` - - Sources []*SourceIntention - JWT *IntentionJWTRequirement `json:",omitempty"` - - Meta map[string]string `json:",omitempty"` - - CreateIndex uint64 - ModifyIndex uint64 -} - -type SourceIntention struct { - Name string - Peer string `json:",omitempty"` - Partition string `json:",omitempty"` - Namespace string `json:",omitempty"` - SamenessGroup string `json:",omitempty" alias:"sameness_group"` - Action IntentionAction `json:",omitempty"` - Permissions []*IntentionPermission `json:",omitempty"` - Precedence int - Type IntentionSourceType - Description string `json:",omitempty"` - - LegacyID string `json:",omitempty" alias:"legacy_id"` - LegacyMeta map[string]string `json:",omitempty" alias:"legacy_meta"` - LegacyCreateTime *time.Time `json:",omitempty" alias:"legacy_create_time"` - LegacyUpdateTime *time.Time `json:",omitempty" alias:"legacy_update_time"` -} - -func (e *ServiceIntentionsConfigEntry) GetKind() string { return e.Kind } -func (e *ServiceIntentionsConfigEntry) GetName() string { return e.Name } -func (e *ServiceIntentionsConfigEntry) GetPartition() string { return e.Partition } -func (e *ServiceIntentionsConfigEntry) GetNamespace() string { return e.Namespace } -func (e *ServiceIntentionsConfigEntry) GetMeta() map[string]string { return e.Meta } -func (e *ServiceIntentionsConfigEntry) GetCreateIndex() uint64 { return e.CreateIndex } -func (e *ServiceIntentionsConfigEntry) GetModifyIndex() uint64 { return e.ModifyIndex } - -type IntentionPermission struct { - Action IntentionAction - HTTP *IntentionHTTPPermission `json:",omitempty"` - JWT *IntentionJWTRequirement `json:",omitempty"` -} - -type IntentionHTTPPermission struct { - PathExact string `json:",omitempty" alias:"path_exact"` - PathPrefix string `json:",omitempty" alias:"path_prefix"` - PathRegex string `json:",omitempty" alias:"path_regex"` - - Header []IntentionHTTPHeaderPermission `json:",omitempty"` - - Methods []string `json:",omitempty"` -} - -type IntentionHTTPHeaderPermission struct { - Name string - Present bool `json:",omitempty"` - Exact string `json:",omitempty"` - Prefix string `json:",omitempty"` - Suffix string `json:",omitempty"` - Regex string `json:",omitempty"` - Invert bool `json:",omitempty"` -} - -type IntentionJWTRequirement struct { - // Providers is a list of providers to consider when verifying a JWT. - Providers []*IntentionJWTProvider `json:",omitempty"` -} - -type IntentionJWTProvider struct { - // Name is the name of the JWT provider. There MUST be a corresponding - // "jwt-provider" config entry with this name. - Name string `json:",omitempty"` - - // VerifyClaims is a list of additional claims to verify in a JWT's payload. - VerifyClaims []*IntentionJWTClaimVerification `json:",omitempty" alias:"verify_claims"` -} - -type IntentionJWTClaimVerification struct { - // Path is the path to the claim in the token JSON. - Path []string `json:",omitempty"` - - // Value is the expected value at the given path: - // - If the type at the path is a list then we verify - // that this value is contained in the list. - // - // - If the type at the path is a string then we verify - // that this value matches. - Value string `json:",omitempty"` -} diff --git a/vendor/github.com/hashicorp/consul/api/config_entry_jwt_provider.go b/vendor/github.com/hashicorp/consul/api/config_entry_jwt_provider.go deleted file mode 100644 index 270f0d564..000000000 --- a/vendor/github.com/hashicorp/consul/api/config_entry_jwt_provider.go +++ /dev/null @@ -1,310 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "time" -) - -const ( - DiscoveryTypeStrictDNS ClusterDiscoveryType = "STRICT_DNS" - DiscoveryTypeStatic ClusterDiscoveryType = "STATIC" - DiscoveryTypeLogicalDNS ClusterDiscoveryType = "LOGICAL_DNS" - DiscoveryTypeEDS ClusterDiscoveryType = "EDS" - DiscoveryTypeOriginalDST ClusterDiscoveryType = "ORIGINAL_DST" -) - -type JWTProviderConfigEntry struct { - // Kind is the kind of configuration entry and must be "jwt-provider". - Kind string `json:",omitempty"` - - // Name is the name of the provider being configured. - Name string `json:",omitempty"` - - // JSONWebKeySet defines a JSON Web Key Set, its location on disk, or the - // means with which to fetch a key set from a remote server. - JSONWebKeySet *JSONWebKeySet `json:",omitempty" alias:"json_web_key_set"` - - // Issuer is the entity that must have issued the JWT. - // This value must match the "iss" claim of the token. - Issuer string `json:",omitempty"` - - // Audiences is the set of audiences the JWT is allowed to access. - // If specified, all JWTs verified with this provider must address - // at least one of these to be considered valid. - Audiences []string `json:",omitempty"` - - // Locations where the JWT will be present in requests. - // Envoy will check all of these locations to extract a JWT. - // If no locations are specified Envoy will default to: - // 1. Authorization header with Bearer schema: - // "Authorization: Bearer " - // 2. access_token query parameter. - Locations []*JWTLocation `json:",omitempty"` - - // Forwarding defines rules for forwarding verified JWTs to the backend. - Forwarding *JWTForwardingConfig `json:",omitempty"` - - // ClockSkewSeconds specifies the maximum allowable time difference - // from clock skew when validating the "exp" (Expiration) and "nbf" - // (Not Before) claims. - // - // Default value is 30 seconds. - ClockSkewSeconds int `json:",omitempty" alias:"clock_skew_seconds"` - - // CacheConfig defines configuration for caching the validation - // result for previously seen JWTs. Caching results can speed up - // verification when individual tokens are expected to be handled - // multiple times. - CacheConfig *JWTCacheConfig `json:",omitempty" alias:"cache_config"` - - Meta map[string]string `json:",omitempty"` - - // CreateIndex is the Raft index this entry was created at. This is a - // read-only field. - CreateIndex uint64 `json:",omitempty"` - - // ModifyIndex is used for the Check-And-Set operations and can also be fed - // back into the WaitIndex of the QueryOptions in order to perform blocking - // queries. - ModifyIndex uint64 `json:",omitempty"` - - // Partition is the partition the JWTProviderConfigEntry applies to. - // Partitioning is a Consul Enterprise feature. - Partition string `json:",omitempty"` - - // Namespace is the namespace the JWTProviderConfigEntry applies to. - // Namespacing is a Consul Enterprise feature. - Namespace string `json:",omitempty"` -} - -// JWTLocation is a location where the JWT could be present in requests. -// -// Only one of Header, QueryParam, or Cookie can be specified. -type JWTLocation struct { - // Header defines how to extract a JWT from an HTTP request header. - Header *JWTLocationHeader `json:",omitempty"` - - // QueryParam defines how to extract a JWT from an HTTP request - // query parameter. - QueryParam *JWTLocationQueryParam `json:",omitempty" alias:"query_param"` - - // Cookie defines how to extract a JWT from an HTTP request cookie. - Cookie *JWTLocationCookie `json:",omitempty"` -} - -// JWTLocationHeader defines how to extract a JWT from an HTTP -// request header. -type JWTLocationHeader struct { - // Name is the name of the header containing the token. - Name string `json:",omitempty"` - - // ValuePrefix is an optional prefix that precedes the token in the - // header value. - // For example, "Bearer " is a standard value prefix for a header named - // "Authorization", but the prefix is not part of the token itself: - // "Authorization: Bearer " - ValuePrefix string `json:",omitempty" alias:"value_prefix"` - - // Forward defines whether the header with the JWT should be - // forwarded after the token has been verified. If false, the - // header will not be forwarded to the backend. - // - // Default value is false. - Forward bool `json:",omitempty"` -} - -// JWTLocationQueryParam defines how to extract a JWT from an HTTP request query parameter. -type JWTLocationQueryParam struct { - // Name is the name of the query param containing the token. - Name string `json:",omitempty"` -} - -// JWTLocationCookie defines how to extract a JWT from an HTTP request cookie. -type JWTLocationCookie struct { - // Name is the name of the cookie containing the token. - Name string `json:",omitempty"` -} - -type JWTForwardingConfig struct { - // HeaderName is a header name to use when forwarding a verified - // JWT to the backend. The verified JWT could have been extracted - // from any location (query param, header, or cookie). - // - // The header value will be base64-URL-encoded, and will not be - // padded unless PadForwardPayloadHeader is true. - HeaderName string `json:",omitempty" alias:"header_name"` - - // PadForwardPayloadHeader determines whether padding should be added - // to the base64 encoded token forwarded with ForwardPayloadHeader. - // - // Default value is false. - PadForwardPayloadHeader bool `json:",omitempty" alias:"pad_forward_payload_header"` -} - -// JSONWebKeySet defines a key set, its location on disk, or the -// means with which to fetch a key set from a remote server. -// -// Exactly one of Local or Remote must be specified. -type JSONWebKeySet struct { - // Local specifies a local source for the key set. - Local *LocalJWKS `json:",omitempty"` - - // Remote specifies how to fetch a key set from a remote server. - Remote *RemoteJWKS `json:",omitempty"` -} - -// LocalJWKS specifies a location for a local JWKS. -// -// Only one of String and Filename can be specified. -type LocalJWKS struct { - // JWKS contains a base64 encoded JWKS. - JWKS string `json:",omitempty"` - - // Filename configures a location on disk where the JWKS can be - // found. If specified, the file must be present on the disk of ALL - // proxies with intentions referencing this provider. - Filename string `json:",omitempty"` -} - -// RemoteJWKS specifies how to fetch a JWKS from a remote server. -type RemoteJWKS struct { - // URI is the URI of the server to query for the JWKS. - URI string `json:",omitempty"` - - // RequestTimeoutMs is the number of milliseconds to - // time out when making a request for the JWKS. - RequestTimeoutMs int `json:",omitempty" alias:"request_timeout_ms"` - - // CacheDuration is the duration after which cached keys - // should be expired. - // - // Default value is 5 minutes. - CacheDuration time.Duration `json:",omitempty" alias:"cache_duration"` - - // FetchAsynchronously indicates that the JWKS should be fetched - // when a client request arrives. Client requests will be paused - // until the JWKS is fetched. - // If false, the proxy listener will wait for the JWKS to be - // fetched before being activated. - // - // Default value is false. - FetchAsynchronously bool `json:",omitempty" alias:"fetch_asynchronously"` - - // RetryPolicy defines a retry policy for fetching JWKS. - // - // There is no retry by default. - RetryPolicy *JWKSRetryPolicy `json:",omitempty" alias:"retry_policy"` - - // JWKSCluster defines how the specified Remote JWKS URI is to be fetched. - JWKSCluster *JWKSCluster `json:",omitempty" alias:"jwks_cluster"` -} - -type JWKSCluster struct { - // DiscoveryType refers to the service discovery type to use for resolving the cluster. - // - // This defaults to STRICT_DNS. - // Other options include STATIC, LOGICAL_DNS, EDS or ORIGINAL_DST. - DiscoveryType ClusterDiscoveryType `json:",omitempty" alias:"discovery_type"` - - // TLSCertificates refers to the data containing certificate authority certificates to use - // in verifying a presented peer certificate. - // If not specified and a peer certificate is presented it will not be verified. - // - // Must be either CaCertificateProviderInstance or TrustedCA. - TLSCertificates *JWKSTLSCertificate `json:",omitempty" alias:"tls_certificates"` - - // The timeout for new network connections to hosts in the cluster. - // If not set, a default value of 5s will be used. - ConnectTimeout time.Duration `json:",omitempty" alias:"connect_timeout"` -} - -type ClusterDiscoveryType string - -// JWKSTLSCertificate refers to the data containing certificate authority certificates to use -// in verifying a presented peer certificate. -// If not specified and a peer certificate is presented it will not be verified. -// -// Must be either CaCertificateProviderInstance or TrustedCA. -type JWKSTLSCertificate struct { - // CaCertificateProviderInstance Certificate provider instance for fetching TLS certificates. - CaCertificateProviderInstance *JWKSTLSCertProviderInstance `json:",omitempty" alias:"ca_certificate_provider_instance"` - - // TrustedCA defines TLS certificate data containing certificate authority certificates - // to use in verifying a presented peer certificate. - // - // Exactly one of Filename, EnvironmentVariable, InlineString or InlineBytes must be specified. - TrustedCA *JWKSTLSCertTrustedCA `json:",omitempty" alias:"trusted_ca"` -} - -// JWKSTLSCertTrustedCA defines TLS certificate data containing certificate authority certificates -// to use in verifying a presented peer certificate. -// -// Exactly one of Filename, EnvironmentVariable, InlineString or InlineBytes must be specified. -type JWKSTLSCertTrustedCA struct { - Filename string `json:",omitempty" alias:"filename"` - EnvironmentVariable string `json:",omitempty" alias:"environment_variable"` - InlineString string `json:",omitempty" alias:"inline_string"` - InlineBytes []byte `json:",omitempty" alias:"inline_bytes"` -} - -type JWKSTLSCertProviderInstance struct { - // InstanceName refers to the certificate provider instance name - // - // The default value is "default". - InstanceName string `json:",omitempty" alias:"instance_name"` - - // CertificateName is used to specify certificate instances or types. For example, "ROOTCA" to specify - // a root-certificate (validation context) or "example.com" to specify a certificate for a - // particular domain. - // - // The default value is the empty string. - CertificateName string `json:",omitempty" alias:"certificate_name"` -} - -type JWKSRetryPolicy struct { - // NumRetries is the number of times to retry fetching the JWKS. - // The retry strategy uses jittered exponential backoff with - // a base interval of 1s and max of 10s. - // - // Default value is 0. - NumRetries int `json:",omitempty" alias:"num_retries"` - - // Backoff policy - // - // Defaults to Envoy's backoff policy - RetryPolicyBackOff *RetryPolicyBackOff `json:",omitempty" alias:"retry_policy_back_off"` -} - -type RetryPolicyBackOff struct { - // BaseInterval to be used for the next back off computation - // - // The default value from envoy is 1s - BaseInterval time.Duration `json:",omitempty" alias:"base_interval"` - - // MaxInternal to be used to specify the maximum interval between retries. - // Optional but should be greater or equal to BaseInterval. - // - // Defaults to 10 times BaseInterval - MaxInterval time.Duration `json:",omitempty" alias:"max_interval"` -} - -type JWTCacheConfig struct { - // Size specifies the maximum number of JWT verification - // results to cache. - // - // Defaults to 0, meaning that JWT caching is disabled. - Size int `json:",omitempty"` -} - -func (e *JWTProviderConfigEntry) GetKind() string { - return JWTProvider -} - -func (e *JWTProviderConfigEntry) GetName() string { return e.Name } -func (e *JWTProviderConfigEntry) GetMeta() map[string]string { return e.Meta } -func (e *JWTProviderConfigEntry) GetCreateIndex() uint64 { return e.CreateIndex } -func (e *JWTProviderConfigEntry) GetModifyIndex() uint64 { return e.ModifyIndex } -func (e *JWTProviderConfigEntry) GetPartition() string { return e.Partition } -func (e *JWTProviderConfigEntry) GetNamespace() string { return e.Namespace } diff --git a/vendor/github.com/hashicorp/consul/api/config_entry_mesh.go b/vendor/github.com/hashicorp/consul/api/config_entry_mesh.go deleted file mode 100644 index 1a1ebb8b5..000000000 --- a/vendor/github.com/hashicorp/consul/api/config_entry_mesh.go +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "encoding/json" -) - -// MeshConfigEntry manages the global configuration for all service mesh -// proxies. -type MeshConfigEntry struct { - // Partition is the partition the MeshConfigEntry applies to. - // Partitioning is a Consul Enterprise feature. - Partition string `json:",omitempty"` - - // Namespace is the namespace the MeshConfigEntry applies to. - // Namespacing is a Consul Enterprise feature. - Namespace string `json:",omitempty"` - - // TransparentProxy applies configuration specific to proxies - // in transparent mode. - TransparentProxy TransparentProxyMeshConfig `alias:"transparent_proxy"` - - // AllowEnablingPermissiveMutualTLS must be true in order to allow setting - // MutualTLSMode=permissive in either service-defaults or proxy-defaults. - AllowEnablingPermissiveMutualTLS bool `json:",omitempty" alias:"allow_enabling_permissive_mutual_tls"` - - TLS *MeshTLSConfig `json:",omitempty"` - - HTTP *MeshHTTPConfig `json:",omitempty"` - - Peering *PeeringMeshConfig `json:",omitempty"` - - Meta map[string]string `json:",omitempty"` - - // CreateIndex is the Raft index this entry was created at. This is a - // read-only field. - CreateIndex uint64 - - // ModifyIndex is used for the Check-And-Set operations and can also be fed - // back into the WaitIndex of the QueryOptions in order to perform blocking - // queries. - ModifyIndex uint64 -} - -type TransparentProxyMeshConfig struct { - MeshDestinationsOnly bool `alias:"mesh_destinations_only"` -} - -type MeshTLSConfig struct { - Incoming *MeshDirectionalTLSConfig `json:",omitempty"` - Outgoing *MeshDirectionalTLSConfig `json:",omitempty"` -} - -type MeshDirectionalTLSConfig struct { - TLSMinVersion string `json:",omitempty" alias:"tls_min_version"` - TLSMaxVersion string `json:",omitempty" alias:"tls_max_version"` - CipherSuites []string `json:",omitempty" alias:"cipher_suites"` -} - -type MeshHTTPConfig struct { - SanitizeXForwardedClientCert bool `alias:"sanitize_x_forwarded_client_cert"` -} - -type PeeringMeshConfig struct { - PeerThroughMeshGateways bool `json:",omitempty" alias:"peer_through_mesh_gateways"` -} - -func (e *MeshConfigEntry) GetKind() string { return MeshConfig } -func (e *MeshConfigEntry) GetName() string { return MeshConfigMesh } -func (e *MeshConfigEntry) GetPartition() string { return e.Partition } -func (e *MeshConfigEntry) GetNamespace() string { return e.Namespace } -func (e *MeshConfigEntry) GetMeta() map[string]string { return e.Meta } -func (e *MeshConfigEntry) GetCreateIndex() uint64 { return e.CreateIndex } -func (e *MeshConfigEntry) GetModifyIndex() uint64 { return e.ModifyIndex } - -// MarshalJSON adds the Kind field so that the JSON can be decoded back into the -// correct type. -func (e *MeshConfigEntry) MarshalJSON() ([]byte, error) { - type Alias MeshConfigEntry - source := &struct { - Kind string - *Alias - }{ - Kind: MeshConfig, - Alias: (*Alias)(e), - } - return json.Marshal(source) -} diff --git a/vendor/github.com/hashicorp/consul/api/config_entry_rate_limit_ip.go b/vendor/github.com/hashicorp/consul/api/config_entry_rate_limit_ip.go deleted file mode 100644 index 7af2a2658..000000000 --- a/vendor/github.com/hashicorp/consul/api/config_entry_rate_limit_ip.go +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -type ReadWriteRatesConfig struct { - ReadRate float64 `alias:"read_rate"` - WriteRate float64 `alias:"write_rate"` -} - -type RateLimitIPConfigEntry struct { - // Kind of the config entry. This will be set to structs.RateLimitIPConfig - Kind string - Name string - Mode string // {permissive, enforcing, disabled} - - Meta map[string]string `json:",omitempty"` - // overall limits - ReadRate float64 `alias:"read_rate"` - WriteRate float64 `alias:"write_rate"` - - //limits specific to a type of call - ACL *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryACL OperationCategory = "ACL" - Catalog *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryCatalog OperationCategory = "Catalog" - ConfigEntry *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryConfigEntry OperationCategory = "ConfigEntry" - ConnectCA *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryConnectCA OperationCategory = "ConnectCA" - Coordinate *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryCoordinate OperationCategory = "Coordinate" - DiscoveryChain *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryDiscoveryChain OperationCategory = "DiscoveryChain" - ServerDiscovery *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryServerDiscovery OperationCategory = "ServerDiscovery" - Health *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryHealth OperationCategory = "Health" - Intention *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryIntention OperationCategory = "Intention" - KV *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryKV OperationCategory = "KV" - Tenancy *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryPartition OperationCategory = "Tenancy" - PreparedQuery *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryPreparedQuery OperationCategory = "PreparedQuery" - Session *ReadWriteRatesConfig `json:",omitempty"` // OperationCategorySession OperationCategory = "Session" - Txn *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryTxn OperationCategory = "Txn" - AutoConfig *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryAutoConfig OperationCategory = "AutoConfig" - FederationState *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryFederationState OperationCategory = "FederationState" - Internal *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryInternal OperationCategory = "Internal" - PeerStream *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryPeerStream OperationCategory = "PeerStream" - Peering *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryPeering OperationCategory = "Peering" - DataPlane *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryDataPlane OperationCategory = "DataPlane" - DNS *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryDNS OperationCategory = "DNS" - Subscribe *ReadWriteRatesConfig `json:",omitempty"` // OperationCategorySubscribe OperationCategory = "Subscribe" - Resource *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryResource OperationCategory = "Resource" - - // Partition is the partition the config entry is associated with. - // Partitioning is a Consul Enterprise feature. - Partition string `json:",omitempty"` - - // Namespace is the namespace the config entry is associated with. - // Namespacing is a Consul Enterprise feature. - Namespace string `json:",omitempty"` - - // CreateIndex is the Raft index this entry was created at. This is a - // read-only field. - CreateIndex uint64 - - // ModifyIndex is used for the Check-And-Set operations and can also be fed - // back into the WaitIndex of the QueryOptions in order to perform blocking - // queries. - ModifyIndex uint64 -} - -func (r *RateLimitIPConfigEntry) GetKind() string { - return RateLimitIPConfig -} -func (r *RateLimitIPConfigEntry) GetName() string { - if r == nil { - return "" - } - return r.Name -} -func (r *RateLimitIPConfigEntry) GetPartition() string { - return r.Partition -} -func (r *RateLimitIPConfigEntry) GetNamespace() string { - return r.Namespace -} -func (r *RateLimitIPConfigEntry) GetMeta() map[string]string { - if r == nil { - return nil - } - return r.Meta -} -func (r *RateLimitIPConfigEntry) GetCreateIndex() uint64 { - return r.CreateIndex -} -func (r *RateLimitIPConfigEntry) GetModifyIndex() uint64 { - return r.ModifyIndex -} diff --git a/vendor/github.com/hashicorp/consul/api/config_entry_routes.go b/vendor/github.com/hashicorp/consul/api/config_entry_routes.go deleted file mode 100644 index bbaa032d5..000000000 --- a/vendor/github.com/hashicorp/consul/api/config_entry_routes.go +++ /dev/null @@ -1,281 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import "time" - -// TCPRouteConfigEntry -- TODO stub -type TCPRouteConfigEntry struct { - // Kind of the config entry. This should be set to api.TCPRoute. - Kind string - - // Name is used to match the config entry with its associated tcp-route - // service. This should match the name provided in the service definition. - Name string - - // Parents is a list of gateways that this route should be bound to. - Parents []ResourceReference - // Services is a list of TCP-based services that this should route to. - // Currently, this must specify at maximum one service. - Services []TCPService - - Meta map[string]string `json:",omitempty"` - - // Status is the asynchronous status which a TCPRoute propagates to the user. - Status ConfigEntryStatus - - // CreateIndex is the Raft index this entry was created at. This is a - // read-only field. - CreateIndex uint64 - - // ModifyIndex is used for the Check-And-Set operations and can also be fed - // back into the WaitIndex of the QueryOptions in order to perform blocking - // queries. - ModifyIndex uint64 - - // Partition is the partition the config entry is associated with. - // Partitioning is a Consul Enterprise feature. - Partition string `json:",omitempty"` - - // Namespace is the namespace the config entry is associated with. - // Namespacing is a Consul Enterprise feature. - Namespace string `json:",omitempty"` -} - -func (a *TCPRouteConfigEntry) GetKind() string { return TCPRoute } -func (a *TCPRouteConfigEntry) GetName() string { return a.Name } -func (a *TCPRouteConfigEntry) GetPartition() string { return a.Partition } -func (a *TCPRouteConfigEntry) GetNamespace() string { return a.Namespace } -func (a *TCPRouteConfigEntry) GetMeta() map[string]string { return a.Meta } -func (a *TCPRouteConfigEntry) GetCreateIndex() uint64 { return a.CreateIndex } -func (a *TCPRouteConfigEntry) GetModifyIndex() uint64 { return a.ModifyIndex } - -// TCPService is a service reference for a TCPRoute -type TCPService struct { - Name string - - // Partition is the partition the config entry is associated with. - // Partitioning is a Consul Enterprise feature. - Partition string `json:",omitempty"` - - // Namespace is the namespace the config entry is associated with. - // Namespacing is a Consul Enterprise feature. - Namespace string `json:",omitempty"` -} - -// HTTPRouteConfigEntry manages the configuration for a HTTP route -// with the given name. -type HTTPRouteConfigEntry struct { - // Kind of the config entry. This should be set to api.HTTPRoute. - Kind string - - // Name is used to match the config entry with its associated http-route. - Name string - - // Parents is a list of gateways that this route should be bound to - Parents []ResourceReference - // Rules are a list of HTTP-based routing rules that this route should - // use for constructing a routing table. - Rules []HTTPRouteRule - // Hostnames are the hostnames for which this HTTPRoute should respond to requests. - Hostnames []string - - Meta map[string]string `json:",omitempty"` - - // CreateIndex is the Raft index this entry was created at. This is a - // read-only field. - CreateIndex uint64 - - // ModifyIndex is used for the Check-And-Set operations and can also be fed - // back into the WaitIndex of the QueryOptions in order to perform blocking - // queries. - ModifyIndex uint64 - - // Partition is the partition the config entry is associated with. - // Partitioning is a Consul Enterprise feature. - Partition string `json:",omitempty"` - - // Namespace is the namespace the config entry is associated with. - // Namespacing is a Consul Enterprise feature. - Namespace string `json:",omitempty"` - - // Status is the asynchronous status which an HTTPRoute propagates to the user. - Status ConfigEntryStatus -} - -func (r *HTTPRouteConfigEntry) GetKind() string { return HTTPRoute } -func (r *HTTPRouteConfigEntry) GetName() string { return r.Name } -func (r *HTTPRouteConfigEntry) GetPartition() string { return r.Partition } -func (r *HTTPRouteConfigEntry) GetNamespace() string { return r.Namespace } -func (r *HTTPRouteConfigEntry) GetMeta() map[string]string { return r.Meta } -func (r *HTTPRouteConfigEntry) GetCreateIndex() uint64 { return r.CreateIndex } -func (r *HTTPRouteConfigEntry) GetModifyIndex() uint64 { return r.ModifyIndex } - -// HTTPMatch specifies the criteria that should be -// used in determining whether or not a request should -// be routed to a given set of services. -type HTTPMatch struct { - Headers []HTTPHeaderMatch - Method HTTPMatchMethod - Path HTTPPathMatch - Query []HTTPQueryMatch -} - -// HTTPMatchMethod specifies which type of HTTP verb should -// be used for matching a given request. -type HTTPMatchMethod string - -const ( - HTTPMatchMethodAll HTTPMatchMethod = "" - HTTPMatchMethodConnect HTTPMatchMethod = "CONNECT" - HTTPMatchMethodDelete HTTPMatchMethod = "DELETE" - HTTPMatchMethodGet HTTPMatchMethod = "GET" - HTTPMatchMethodHead HTTPMatchMethod = "HEAD" - HTTPMatchMethodOptions HTTPMatchMethod = "OPTIONS" - HTTPMatchMethodPatch HTTPMatchMethod = "PATCH" - HTTPMatchMethodPost HTTPMatchMethod = "POST" - HTTPMatchMethodPut HTTPMatchMethod = "PUT" - HTTPMatchMethodTrace HTTPMatchMethod = "TRACE" -) - -// HTTPHeaderMatchType specifies how header matching criteria -// should be applied to a request. -type HTTPHeaderMatchType string - -const ( - HTTPHeaderMatchExact HTTPHeaderMatchType = "exact" - HTTPHeaderMatchPrefix HTTPHeaderMatchType = "prefix" - HTTPHeaderMatchPresent HTTPHeaderMatchType = "present" - HTTPHeaderMatchRegularExpression HTTPHeaderMatchType = "regex" - HTTPHeaderMatchSuffix HTTPHeaderMatchType = "suffix" -) - -// HTTPHeaderMatch specifies how a match should be done -// on a request's headers. -type HTTPHeaderMatch struct { - Match HTTPHeaderMatchType - Name string - Value string -} - -// HTTPPathMatchType specifies how path matching criteria -// should be applied to a request. -type HTTPPathMatchType string - -const ( - HTTPPathMatchExact HTTPPathMatchType = "exact" - HTTPPathMatchPrefix HTTPPathMatchType = "prefix" - HTTPPathMatchRegularExpression HTTPPathMatchType = "regex" -) - -// HTTPPathMatch specifies how a match should be done -// on a request's path. -type HTTPPathMatch struct { - Match HTTPPathMatchType - Value string -} - -// HTTPQueryMatchType specifies how querys matching criteria -// should be applied to a request. -type HTTPQueryMatchType string - -const ( - HTTPQueryMatchExact HTTPQueryMatchType = "exact" - HTTPQueryMatchPresent HTTPQueryMatchType = "present" - HTTPQueryMatchRegularExpression HTTPQueryMatchType = "regex" -) - -// HTTPQueryMatch specifies how a match should be done -// on a request's query parameters. -type HTTPQueryMatch struct { - Match HTTPQueryMatchType - Name string - Value string -} - -// HTTPFilters specifies a list of filters used to modify a request -// before it is routed to an upstream. -type HTTPFilters struct { - Headers []HTTPHeaderFilter - URLRewrite *URLRewrite - RetryFilter *RetryFilter - TimeoutFilter *TimeoutFilter - JWT *JWTFilter -} - -// HTTPResponseFilters specifies a list of filters used to modify a -// response returned by an upstream -type HTTPResponseFilters struct { - Headers []HTTPHeaderFilter -} - -// HTTPHeaderFilter specifies how HTTP headers should be modified. -type HTTPHeaderFilter struct { - Add map[string]string - Remove []string - Set map[string]string -} - -type URLRewrite struct { - Path string -} - -type RetryFilter struct { - NumRetries uint32 - RetryOn []string - RetryOnStatusCodes []uint32 - RetryOnConnectFailure bool -} - -type TimeoutFilter struct { - RequestTimeout time.Duration - IdleTimeout time.Duration -} - -// JWTFilter specifies the JWT configuration for a route -type JWTFilter struct { - Providers []*APIGatewayJWTProvider `json:",omitempty"` -} - -// HTTPRouteRule specifies the routing rules used to determine what upstream -// service an HTTP request is routed to. -type HTTPRouteRule struct { - // Filters is a list of HTTP-based filters used to modify a request prior - // to routing it to the upstream service - Filters HTTPFilters - // ResponseFilters is a list of HTTP-based filters used to modify a response - // returned by the upstream service - ResponseFilters HTTPResponseFilters - // Matches specified the matching criteria used in the routing table. If a - // request matches the given HTTPMatch configuration, then traffic is routed - // to services specified in the Services field. - Matches []HTTPMatch - // Services is a list of HTTP-based services to route to if the request matches - // the rules specified in the Matches field. - Services []HTTPService -} - -// HTTPService is a service reference for HTTP-based routing rules -type HTTPService struct { - Name string - // Weight is an arbitrary integer used in calculating how much - // traffic should be sent to the given service. - Weight int - - // Filters is a list of HTTP-based filters used to modify a request prior - // to routing it to the upstream service - Filters HTTPFilters - - // ResponseFilters is a list of HTTP-based filters used to modify the - // response returned from the upstream service - ResponseFilters HTTPResponseFilters - - // Partition is the partition the config entry is associated with. - // Partitioning is a Consul Enterprise feature. - Partition string `json:",omitempty"` - - // Namespace is the namespace the config entry is associated with. - // Namespacing is a Consul Enterprise feature. - Namespace string `json:",omitempty"` -} diff --git a/vendor/github.com/hashicorp/consul/api/config_entry_sameness_group.go b/vendor/github.com/hashicorp/consul/api/config_entry_sameness_group.go deleted file mode 100644 index 1217efe7d..000000000 --- a/vendor/github.com/hashicorp/consul/api/config_entry_sameness_group.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -type SamenessGroupConfigEntry struct { - Kind string - Name string - Partition string `json:",omitempty"` - DefaultForFailover bool `json:",omitempty" alias:"default_for_failover"` - IncludeLocal bool `json:",omitempty" alias:"include_local"` - Members []SamenessGroupMember - Meta map[string]string `json:",omitempty"` - CreateIndex uint64 - ModifyIndex uint64 -} - -type SamenessGroupMember struct { - Partition string `json:",omitempty"` - Peer string `json:",omitempty"` -} - -func (s *SamenessGroupConfigEntry) GetKind() string { return s.Kind } -func (s *SamenessGroupConfigEntry) GetName() string { return s.Name } -func (s *SamenessGroupConfigEntry) GetPartition() string { return s.Partition } -func (s *SamenessGroupConfigEntry) GetNamespace() string { return "" } -func (s *SamenessGroupConfigEntry) GetCreateIndex() uint64 { return s.CreateIndex } -func (s *SamenessGroupConfigEntry) GetModifyIndex() uint64 { return s.ModifyIndex } -func (s *SamenessGroupConfigEntry) GetMeta() map[string]string { return s.Meta } diff --git a/vendor/github.com/hashicorp/consul/api/config_entry_status.go b/vendor/github.com/hashicorp/consul/api/config_entry_status.go deleted file mode 100644 index 997066f24..000000000 --- a/vendor/github.com/hashicorp/consul/api/config_entry_status.go +++ /dev/null @@ -1,358 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "fmt" - "time" - - "golang.org/x/exp/slices" -) - -// ResourceReference is a reference to a ConfigEntry -// with an optional reference to a subsection of that ConfigEntry -// that can be specified as SectionName -type ResourceReference struct { - // Kind is the kind of ConfigEntry that this resource refers to. - Kind string - // Name is the identifier for the ConfigEntry this resource refers to. - Name string - // SectionName is a generic subresource identifier that specifies - // a subset of the ConfigEntry to which this reference applies. Usage - // of this field should be up to the controller that leverages it. If - // unused, this should be blank. - SectionName string - - // Partition is the partition the config entry is associated with. - // Partitioning is a Consul Enterprise feature. - Partition string `json:",omitempty"` - - // Namespace is the namespace the config entry is associated with. - // Namespacing is a Consul Enterprise feature. - Namespace string `json:",omitempty"` -} - -// ConfigEntryStatus is used for propagating back asynchronously calculated -// messages from control loops to a user -type ConfigEntryStatus struct { - // Conditions is the set of condition objects associated with - // a ConfigEntry status. - Conditions []Condition -} - -// Condition is used for a single message and state associated -// with an object. For example, a ConfigEntry that references -// multiple other resources may have different statuses with -// respect to each of those resources. -type Condition struct { - // Type is a value from a bounded set of types that an object might have - Type string - // Status is a value from a bounded set of statuses that an object might have - Status ConditionStatus - // Reason is a value from a bounded set of reasons for a given status - Reason string - // Message is a message that gives more detailed information about - // why a Condition has a given status and reason - Message string - // Resource is an optional reference to a resource for which this - // condition applies - Resource *ResourceReference - // LastTransitionTime is the time at which this Condition was created - LastTransitionTime *time.Time -} - -type ( - ConditionStatus string -) - -const ( - ConditionStatusTrue ConditionStatus = "True" - ConditionStatusFalse ConditionStatus = "False" - ConditionStatusUnknown ConditionStatus = "Unknown" -) - -// GatewayConditionType is a type of condition associated with a -// Gateway. This type should be used with the GatewayStatus.Conditions -// field. -type GatewayConditionType string - -// GatewayConditionReason defines the set of reasons that explain why a -// particular Gateway condition type has been raised. -type GatewayConditionReason string - -// the following are directly from the k8s spec -const ( - // This condition is true when the controller managing the Gateway is - // syntactically and semantically valid enough to produce some configuration - // in the underlying data plane. This does not indicate whether or not the - // configuration has been propagated to the data plane. - // - // Possible reasons for this condition to be True are: - // - // * "Accepted" - // - // Possible reasons for this condition to be False are: - // - // * InvalidCertificates - // - GatewayConditionAccepted GatewayConditionType = "Accepted" - - // This reason is used with the "Accepted" condition when the condition is - // True. - GatewayReasonAccepted GatewayConditionReason = "Accepted" - - // This reason is used with the "Accepted" condition when the gateway has multiple invalid - // certificates and cannot bind to any routes - GatewayReasonInvalidCertificates GatewayConditionReason = "InvalidCertificates" - - // This reason is used with the "Accepted" condition when the gateway has multiple invalid - // JWT providers and cannot bind to any routes - GatewayReasonInvalidJWTProviders GatewayConditionReason = "InvalidJWTProviders" - - // This condition indicates that the gateway was unable to resolve - // conflicting specification requirements for this Listener. If a - // Listener is conflicted, its network port should not be configured - // on any network elements. - // - // Possible reasons for this condition to be true are: - // - // * "RouteConflict" - // - // Possible reasons for this condition to be False are: - // - // * "NoConflict" - // - // Controllers may raise this condition with other reasons, - // but should prefer to use the reasons listed above to improve - // interoperability. - GatewayConditionConflicted GatewayConditionType = "Conflicted" - // This reason is used with the "Conflicted" condition when the condition - // is False. - GatewayReasonNoConflict GatewayConditionReason = "NoConflict" - // This reason is used with the "Conflicted" condition when the route is - // in a conflicted state, such as when a TCPListener attempts to bind to two routes - GatewayReasonRouteConflict GatewayConditionReason = "RouteConflict" - - // This condition indicates whether the controller was able to - // resolve all the object references for the Gateway. When setting this - // condition to False, a ResourceReference to the misconfigured Listener should - // be provided. - // - // Possible reasons for this condition to be true are: - // - // * "ResolvedRefs" - // - // Possible reasons for this condition to be False are: - // - // * "InvalidCertificateRef" - // * "InvalidRouteKinds" - // * "RefNotPermitted" - // - GatewayConditionResolvedRefs GatewayConditionType = "ResolvedRefs" - - // This reason is used with the "ResolvedRefs" condition when the condition - // is true. - GatewayReasonResolvedRefs GatewayConditionReason = "ResolvedRefs" - - // This reason is used with the "ResolvedRefs" condition when a - // Listener has a TLS configuration with at least one TLS CertificateRef - // that is invalid or does not exist. - // A CertificateRef is considered invalid when it refers to a nonexistent - // or unsupported resource or kind, or when the data within that resource - // is malformed. - // This reason must be used only when the reference is allowed, either by - // referencing an object in the same namespace as the Gateway, or when - // a cross-namespace reference has been explicitly allowed by a ReferenceGrant. - // If the reference is not allowed, the reason RefNotPermitted must be used - // instead. - GatewayListenerReasonInvalidCertificateRef GatewayConditionReason = "InvalidCertificateRef" - - // This reason is used with the "ResolvedRefs" condition when a - // Listener has a JWT configuration with at least one JWTProvider - // that is invalid or does not exist. - // A JWTProvider is considered invalid when it refers to a nonexistent - // or unsupported resource or kind, or when the data within that resource - // is malformed. - GatewayListenerReasonInvalidJWTProviderRef GatewayConditionReason = "InvalidJWTProviderRef" -) - -var validGatewayConditionReasonsMapping = map[GatewayConditionType]map[ConditionStatus][]GatewayConditionReason{ - GatewayConditionAccepted: { - ConditionStatusTrue: { - GatewayReasonAccepted, - }, - ConditionStatusFalse: { - GatewayReasonInvalidCertificates, - GatewayReasonInvalidJWTProviders, - }, - ConditionStatusUnknown: {}, - }, - GatewayConditionConflicted: { - ConditionStatusTrue: { - GatewayReasonRouteConflict, - }, - ConditionStatusFalse: { - GatewayReasonNoConflict, - }, - ConditionStatusUnknown: {}, - }, - GatewayConditionResolvedRefs: { - ConditionStatusTrue: { - GatewayReasonResolvedRefs, - }, - ConditionStatusFalse: { - GatewayListenerReasonInvalidCertificateRef, - GatewayListenerReasonInvalidJWTProviderRef, - }, - ConditionStatusUnknown: {}, - }, -} - -func ValidateGatewayConditionReason(name GatewayConditionType, status ConditionStatus, reason GatewayConditionReason) error { - if err := checkConditionStatus(status); err != nil { - return err - } - - reasons, ok := validGatewayConditionReasonsMapping[name] - if !ok { - return fmt.Errorf("unrecognized GatewayConditionType %q", name) - } - - reasonsForStatus, ok := reasons[status] - if !ok { - return fmt.Errorf("unrecognized ConditionStatus %q", status) - } - - if !slices.Contains(reasonsForStatus, reason) { - return fmt.Errorf("gateway condition reason %q not allowed for gateway condition type %q with status %q", reason, name, status) - } - return nil -} - -// RouteConditionType is a type of condition for a route. -type RouteConditionType string - -// RouteConditionReason is a reason for a route condition. -type RouteConditionReason string - -// The following statuses are taken from the K8's Spec -// With the exception of: "RouteReasonInvalidDiscoveryChain" and "NoUpstreamServicesTargeted" -const ( - // This condition indicates whether the route has been accepted or rejected - // by a Gateway, and why. - // - // Possible reasons for this condition to be true are: - // - // * "Accepted" - // - // Possible reasons for this condition to be False are: - // - // * "InvalidDiscoveryChain" - // * "NoUpstreamServicesTargeted" - // - // - // Controllers may raise this condition with other reasons, - // but should prefer to use the reasons listed above to improve - // interoperability. - RouteConditionAccepted RouteConditionType = "Accepted" - - // This reason is used with the "Accepted" condition when the Route has been - // accepted by the Gateway. - RouteReasonAccepted RouteConditionReason = "Accepted" - - // This reason is used with the "Accepted" condition when the route has an - // invalid discovery chain, this includes conditions like the protocol being invalid - // or the discovery chain failing to compile - RouteReasonInvalidDiscoveryChain RouteConditionReason = "InvalidDiscoveryChain" - - // This reason is used with the "Accepted" condition when the route - RouteReasonNoUpstreamServicesTargeted RouteConditionReason = "NoUpstreamServicesTargeted" -) - -// the following statuses are custom to Consul -const ( - // This condition indicates whether the route was able to successfully bind the - // Listener on the gateway - // Possible reasons for this condition to be true are: - // - // * "Bound" - // - // Possible reasons for this condition to be false are: - // - // * "FailedToBind" - // * "GatewayNotFound" - // - RouteConditionBound RouteConditionType = "Bound" - - // This reason is used with the "Bound" condition when the condition - // is true - RouteReasonBound RouteConditionReason = "Bound" - - // This reason is used with the "Bound" condition when the route failed - // to bind to the gateway - RouteReasonFailedToBind RouteConditionReason = "FailedToBind" - - // This reason is used with the "Bound" condition when the route fails - // to find the gateway - RouteReasonGatewayNotFound RouteConditionReason = "GatewayNotFound" - - // This reason is used with the "Accepted" condition when the route references non-existent - // JWTProviders - RouteReasonJWTProvidersNotFound RouteConditionReason = "JWTProvidersNotFound" -) - -var validRouteConditionReasonsMapping = map[RouteConditionType]map[ConditionStatus][]RouteConditionReason{ - RouteConditionAccepted: { - ConditionStatusTrue: { - RouteReasonAccepted, - }, - ConditionStatusFalse: { - RouteReasonInvalidDiscoveryChain, - RouteReasonNoUpstreamServicesTargeted, - }, - ConditionStatusUnknown: {}, - }, - RouteConditionBound: { - ConditionStatusTrue: { - RouteReasonBound, - }, - ConditionStatusFalse: { - RouteReasonGatewayNotFound, - RouteReasonFailedToBind, - RouteReasonJWTProvidersNotFound, - }, - ConditionStatusUnknown: {}, - }, -} - -func ValidateRouteConditionReason(name RouteConditionType, status ConditionStatus, reason RouteConditionReason) error { - if err := checkConditionStatus(status); err != nil { - return err - } - - reasons, ok := validRouteConditionReasonsMapping[name] - if !ok { - return fmt.Errorf("unrecognized RouteConditionType %s", name) - } - - reasonsForStatus, ok := reasons[status] - if !ok { - return fmt.Errorf("unrecognized ConditionStatus %s", name) - } - - if !slices.Contains(reasonsForStatus, reason) { - return fmt.Errorf("route condition reason %s not allowed for route condition type %s with status %s", reason, name, status) - } - - return nil -} - -func checkConditionStatus(status ConditionStatus) error { - switch status { - case ConditionStatusTrue, ConditionStatusFalse, ConditionStatusUnknown: - return nil - default: - return fmt.Errorf("unrecognized condition status: %q", status) - } -} diff --git a/vendor/github.com/hashicorp/consul/api/connect.go b/vendor/github.com/hashicorp/consul/api/connect.go deleted file mode 100644 index 77be00034..000000000 --- a/vendor/github.com/hashicorp/consul/api/connect.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -// TelemetryCollectorName is the service name for the Consul Telemetry Collector -const TelemetryCollectorName string = "consul-telemetry-collector" - -// Connect can be used to work with endpoints related to Connect, the -// feature for securely connecting services within Consul. -type Connect struct { - c *Client -} - -// Connect returns a handle to the connect-related endpoints -func (c *Client) Connect() *Connect { - return &Connect{c} -} diff --git a/vendor/github.com/hashicorp/consul/api/connect_ca.go b/vendor/github.com/hashicorp/consul/api/connect_ca.go deleted file mode 100644 index 8a5c9f870..000000000 --- a/vendor/github.com/hashicorp/consul/api/connect_ca.go +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "fmt" - "time" - - "github.com/mitchellh/mapstructure" -) - -// CAConfig is the structure for the Connect CA configuration. -type CAConfig struct { - // Provider is the CA provider implementation to use. - Provider string - - // Configuration is arbitrary configuration for the provider. This - // should only contain primitive values and containers (such as lists - // and maps). - Config map[string]interface{} - - // State is read-only data that the provider might have persisted for use - // after restart or leadership transition. For example this might include - // UUIDs of resources it has created. Setting this when writing a - // configuration is an error. - State map[string]string - - // ForceWithoutCrossSigning indicates that the CA reconfiguration should go - // ahead even if the current CA is unable to cross sign certificates. This - // risks temporary connection failures during the rollout as new leafs will be - // rejected by proxies that have not yet observed the new root cert but is the - // only option if a CA that doesn't support cross signing needs to be - // reconfigured or mirated away from. - ForceWithoutCrossSigning bool - - CreateIndex uint64 - ModifyIndex uint64 -} - -// CommonCAProviderConfig is the common options available to all CA providers. -type CommonCAProviderConfig struct { - LeafCertTTL time.Duration - RootCertTTL time.Duration - SkipValidate bool - CSRMaxPerSecond float32 - CSRMaxConcurrent int -} - -// ConsulCAProviderConfig is the config for the built-in Consul CA provider. -type ConsulCAProviderConfig struct { - CommonCAProviderConfig `mapstructure:",squash"` - - PrivateKey string - RootCert string - IntermediateCertTTL time.Duration -} - -// ParseConsulCAConfig takes a raw config map and returns a parsed -// ConsulCAProviderConfig. -func ParseConsulCAConfig(raw map[string]interface{}) (*ConsulCAProviderConfig, error) { - var config ConsulCAProviderConfig - decodeConf := &mapstructure.DecoderConfig{ - DecodeHook: mapstructure.StringToTimeDurationHookFunc(), - Result: &config, - WeaklyTypedInput: true, - } - - decoder, err := mapstructure.NewDecoder(decodeConf) - if err != nil { - return nil, err - } - - if err := decoder.Decode(raw); err != nil { - return nil, fmt.Errorf("error decoding config: %s", err) - } - - return &config, nil -} - -// CARootList is the structure for the results of listing roots. -type CARootList struct { - ActiveRootID string - TrustDomain string - Roots []*CARoot -} - -// CARoot represents a root CA certificate that is trusted. -type CARoot struct { - // ID is a globally unique ID (UUID) representing this CA root. - ID string - - // Name is a human-friendly name for this CA root. This value is - // opaque to Consul and is not used for anything internally. - Name string - - // RootCertPEM is the PEM-encoded public certificate. - RootCertPEM string `json:"RootCert"` - - // Active is true if this is the current active CA. This must only - // be true for exactly one CA. For any method that modifies roots in the - // state store, tests should be written to verify that multiple roots - // cannot be active. - Active bool - - CreateIndex uint64 - ModifyIndex uint64 -} - -// LeafCert is a certificate that has been issued by a Connect CA. -type LeafCert struct { - // SerialNumber is the unique serial number for this certificate. - // This is encoded in standard hex separated by :. - SerialNumber string - - // CertPEM and PrivateKeyPEM are the PEM-encoded certificate and private - // key for that cert, respectively. This should not be stored in the - // state store, but is present in the sign API response. - CertPEM string `json:",omitempty"` - PrivateKeyPEM string `json:",omitempty"` - - // Service is the name of the service for which the cert was issued. - // ServiceURI is the cert URI value. - Service string - ServiceURI string - - // ValidAfter and ValidBefore are the validity periods for the - // certificate. - ValidAfter time.Time - ValidBefore time.Time - - CreateIndex uint64 - ModifyIndex uint64 -} - -// CARoots queries the list of available roots. -func (h *Connect) CARoots(q *QueryOptions) (*CARootList, *QueryMeta, error) { - r := h.c.newRequest("GET", "/v1/connect/ca/roots") - r.setQueryOptions(q) - rtt, resp, err := h.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out CARootList - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return &out, qm, nil -} - -// CAGetConfig returns the current CA configuration. -func (h *Connect) CAGetConfig(q *QueryOptions) (*CAConfig, *QueryMeta, error) { - r := h.c.newRequest("GET", "/v1/connect/ca/configuration") - r.setQueryOptions(q) - rtt, resp, err := h.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out CAConfig - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return &out, qm, nil -} - -// CASetConfig sets the current CA configuration. -func (h *Connect) CASetConfig(conf *CAConfig, q *WriteOptions) (*WriteMeta, error) { - r := h.c.newRequest("PUT", "/v1/connect/ca/configuration") - r.setWriteOptions(q) - r.obj = conf - rtt, resp, err := h.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - wm := &WriteMeta{} - wm.RequestTime = rtt - return wm, nil -} diff --git a/vendor/github.com/hashicorp/consul/api/connect_intention.go b/vendor/github.com/hashicorp/consul/api/connect_intention.go deleted file mode 100644 index e91c03e8b..000000000 --- a/vendor/github.com/hashicorp/consul/api/connect_intention.go +++ /dev/null @@ -1,461 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "bytes" - "fmt" - "io" - "time" -) - -// Intention defines an intention for the Connect Service Graph. This defines -// the allowed or denied behavior of a connection between two services using -// Connect. -type Intention struct { - // ID is the UUID-based ID for the intention, always generated by Consul. - ID string `json:",omitempty"` - - // Description is a human-friendly description of this intention. - // It is opaque to Consul and is only stored and transferred in API - // requests. - Description string `json:",omitempty"` - - // SourceNS, SourceName are the namespace and name, respectively, of - // the source service. Either of these may be the wildcard "*", but only - // the full value can be a wildcard. Partial wildcards are not allowed. - // The source may also be a non-Consul service, as specified by SourceType. - // - // DestinationNS, DestinationName is the same, but for the destination - // service. The same rules apply. The destination is always a Consul - // service. - SourceNS, SourceName string - DestinationNS, DestinationName string - - // SourcePartition and DestinationPartition cannot be wildcards "*" and - // are not compatible with legacy intentions. - SourcePartition string `json:",omitempty"` - DestinationPartition string `json:",omitempty"` - - // SourcePeer cannot be a wildcard "*" and is not compatible with legacy - // intentions. Cannot be used with SourcePartition, as both represent the - // same level of tenancy (partition is local to cluster, peer is remote). - SourcePeer string `json:",omitempty"` - - // SourceSamenessGroup cannot be wildcards "*" and - // is not compatible with legacy intentions. - SourceSamenessGroup string `json:",omitempty"` - - // SourceType is the type of the value for the source. - SourceType IntentionSourceType - - // Action is whether this is an allowlist or denylist intention. - Action IntentionAction `json:",omitempty"` - - // Permissions is the list of additional L7 attributes that extend the - // intention definition. - // - // NOTE: This field is not editable unless editing the underlying - // service-intentions config entry directly. - Permissions []*IntentionPermission `json:",omitempty"` - - // DefaultAddr is not used. - // Deprecated: DefaultAddr is not used and may be removed in a future version. - DefaultAddr string `json:",omitempty"` - // DefaultPort is not used. - // Deprecated: DefaultPort is not used and may be removed in a future version. - DefaultPort int `json:",omitempty"` - - // Meta is arbitrary metadata associated with the intention. This is - // opaque to Consul but is served in API responses. - Meta map[string]string `json:",omitempty"` - - // Precedence is the order that the intention will be applied, with - // larger numbers being applied first. This is a read-only field, on - // any intention update it is updated. - Precedence int - - // CreatedAt and UpdatedAt keep track of when this record was created - // or modified. - CreatedAt, UpdatedAt time.Time - - // Hash of the contents of the intention - // - // This is needed mainly for replication purposes. When replicating from - // one DC to another keeping the content Hash will allow us to detect - // content changes more efficiently than checking every single field - Hash []byte `json:",omitempty"` - - CreateIndex uint64 - ModifyIndex uint64 -} - -// String returns human-friendly output describing ths intention. -func (i *Intention) String() string { - var detail string - switch n := len(i.Permissions); n { - case 0: - detail = string(i.Action) - case 1: - detail = "1 permission" - default: - detail = fmt.Sprintf("%d permissions", len(i.Permissions)) - } - - return fmt.Sprintf("%s => %s (%s)", - i.SourceString(), - i.DestinationString(), - detail) -} - -// SourceString returns the namespace/name format for the source, or -// just "name" if the namespace is the default namespace. -func (i *Intention) SourceString() string { - return i.partString(i.SourceNS, i.SourceName) -} - -// DestinationString returns the namespace/name format for the source, or -// just "name" if the namespace is the default namespace. -func (i *Intention) DestinationString() string { - return i.partString(i.DestinationNS, i.DestinationName) -} - -func (i *Intention) partString(ns, n string) string { - // For now we omit the default namespace from the output. In the future - // we might want to look at this and show this in a multi-namespace world. - if ns != "" && ns != IntentionDefaultNamespace { - n = ns + "/" + n - } - - return n -} - -// IntentionDefaultNamespace is the default namespace value. -const IntentionDefaultNamespace = "default" - -// IntentionAction is the action that the intention represents. This -// can be "allow" or "deny" to allowlist or denylist intentions. -type IntentionAction string - -const ( - IntentionActionAllow IntentionAction = "allow" - IntentionActionDeny IntentionAction = "deny" -) - -// IntentionSourceType is the type of the source within an intention. -type IntentionSourceType string - -const ( - // IntentionSourceConsul is a service within the Consul catalog. - IntentionSourceConsul IntentionSourceType = "consul" -) - -// IntentionMatch are the arguments for the intention match API. -type IntentionMatch struct { - By IntentionMatchType - Names []string -} - -// IntentionMatchType is the target for a match request. For example, -// matching by source will look for all intentions that match the given -// source value. -type IntentionMatchType string - -const ( - IntentionMatchSource IntentionMatchType = "source" - IntentionMatchDestination IntentionMatchType = "destination" -) - -// IntentionCheck are the arguments for the intention check API. For -// more documentation see the IntentionCheck function. -type IntentionCheck struct { - // Source and Destination are the source and destination values to - // check. The destination is always a Consul service, but the source - // may be other values as defined by the SourceType. - Source, Destination string - - // SourceType is the type of the value for the source. - SourceType IntentionSourceType -} - -// Intentions returns the list of intentions. -func (h *Connect) Intentions(q *QueryOptions) ([]*Intention, *QueryMeta, error) { - r := h.c.newRequest("GET", "/v1/connect/intentions") - r.setQueryOptions(q) - rtt, resp, err := h.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out []*Intention - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return out, qm, nil -} - -// IntentionGetExact retrieves a single intention by its unique name instead of -// its ID. -func (h *Connect) IntentionGetExact(source, destination string, q *QueryOptions) (*Intention, *QueryMeta, error) { - r := h.c.newRequest("GET", "/v1/connect/intentions/exact") - r.setQueryOptions(q) - r.params.Set("source", source) - r.params.Set("destination", destination) - rtt, resp, err := h.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - if resp.StatusCode == 404 { - return nil, qm, nil - } else if resp.StatusCode != 200 { - var buf bytes.Buffer - io.Copy(&buf, resp.Body) - return nil, nil, fmt.Errorf( - "Unexpected response %d: %s", resp.StatusCode, buf.String()) - } - - var out Intention - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return &out, qm, nil -} - -// IntentionGet retrieves a single intention. -// -// Deprecated: use IntentionGetExact instead -func (h *Connect) IntentionGet(id string, q *QueryOptions) (*Intention, *QueryMeta, error) { - r := h.c.newRequest("GET", "/v1/connect/intentions/"+id) - r.setQueryOptions(q) - rtt, resp, err := h.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - if resp.StatusCode == 404 { - return nil, qm, nil - } else if resp.StatusCode != 200 { - var buf bytes.Buffer - io.Copy(&buf, resp.Body) - return nil, nil, fmt.Errorf( - "Unexpected response %d: %s", resp.StatusCode, buf.String()) - } - - var out Intention - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return &out, qm, nil -} - -// IntentionDeleteExact deletes a single intention by its unique name instead of its ID. -func (h *Connect) IntentionDeleteExact(source, destination string, q *WriteOptions) (*WriteMeta, error) { - r := h.c.newRequest("DELETE", "/v1/connect/intentions/exact") - r.setWriteOptions(q) - r.params.Set("source", source) - r.params.Set("destination", destination) - - rtt, resp, err := h.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - qm := &WriteMeta{} - qm.RequestTime = rtt - - return qm, nil -} - -// IntentionDelete deletes a single intention. -// -// Deprecated: use IntentionDeleteExact instead -func (h *Connect) IntentionDelete(id string, q *WriteOptions) (*WriteMeta, error) { - r := h.c.newRequest("DELETE", "/v1/connect/intentions/"+id) - r.setWriteOptions(q) - rtt, resp, err := h.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - qm := &WriteMeta{} - qm.RequestTime = rtt - - return qm, nil -} - -// IntentionMatch returns the list of intentions that match a given source -// or destination. The returned intentions are ordered by precedence where -// result[0] is the highest precedence (if that matches, then that rule overrides -// all other rules). -// -// Matching can be done for multiple names at the same time. The resulting -// map is keyed by the given names. Casing is preserved. -func (h *Connect) IntentionMatch(args *IntentionMatch, q *QueryOptions) (map[string][]*Intention, *QueryMeta, error) { - r := h.c.newRequest("GET", "/v1/connect/intentions/match") - r.setQueryOptions(q) - r.params.Set("by", string(args.By)) - for _, name := range args.Names { - r.params.Add("name", name) - } - rtt, resp, err := h.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out map[string][]*Intention - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return out, qm, nil -} - -// IntentionCheck returns whether a given source/destination would be allowed -// or not given the current set of intentions and the configuration of Consul. -func (h *Connect) IntentionCheck(args *IntentionCheck, q *QueryOptions) (bool, *QueryMeta, error) { - r := h.c.newRequest("GET", "/v1/connect/intentions/check") - r.setQueryOptions(q) - r.params.Set("source", args.Source) - r.params.Set("destination", args.Destination) - if args.SourceType != "" { - r.params.Set("source-type", string(args.SourceType)) - } - rtt, resp, err := h.c.doRequest(r) - if err != nil { - return false, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return false, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out struct{ Allowed bool } - if err := decodeBody(resp, &out); err != nil { - return false, nil, err - } - return out.Allowed, qm, nil -} - -// IntentionUpsert will update an existing intention. The Source & Destination parameters -// in the structure must be non-empty. The ID must be empty. -func (c *Connect) IntentionUpsert(ixn *Intention, q *WriteOptions) (*WriteMeta, error) { - r := c.c.newRequest("PUT", "/v1/connect/intentions/exact") - r.setWriteOptions(q) - r.params.Set("source", maybePrefixNamespaceAndPartition(ixn.SourcePartition, ixn.SourceNS, ixn.SourceName)) - r.params.Set("destination", maybePrefixNamespaceAndPartition(ixn.DestinationPartition, ixn.DestinationNS, ixn.DestinationName)) - r.obj = ixn - rtt, resp, err := c.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - wm := &WriteMeta{} - wm.RequestTime = rtt - return wm, nil -} - -func maybePrefixNamespaceAndPartition(part, ns, name string) string { - switch { - case part == "" && ns == "": - return name - case part == "" && ns != "": - return ns + "/" + name - case part != "" && ns == "": - return part + "/" + IntentionDefaultNamespace + "/" + name - default: - return part + "/" + ns + "/" + name - } -} - -// IntentionCreate will create a new intention. The ID in the given -// structure must be empty and a generate ID will be returned on -// success. -// -// Deprecated: use IntentionUpsert instead -func (c *Connect) IntentionCreate(ixn *Intention, q *WriteOptions) (string, *WriteMeta, error) { - r := c.c.newRequest("POST", "/v1/connect/intentions") - r.setWriteOptions(q) - r.obj = ixn - rtt, resp, err := c.c.doRequest(r) - if err != nil { - return "", nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return "", nil, err - } - - wm := &WriteMeta{} - wm.RequestTime = rtt - - var out struct{ ID string } - if err := decodeBody(resp, &out); err != nil { - return "", nil, err - } - return out.ID, wm, nil -} - -// IntentionUpdate will update an existing intention. The ID in the given -// structure must be non-empty. -// -// Deprecated: use IntentionUpsert instead -func (c *Connect) IntentionUpdate(ixn *Intention, q *WriteOptions) (*WriteMeta, error) { - r := c.c.newRequest("PUT", "/v1/connect/intentions/"+ixn.ID) - r.setWriteOptions(q) - r.obj = ixn - rtt, resp, err := c.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - wm := &WriteMeta{} - wm.RequestTime = rtt - return wm, nil -} diff --git a/vendor/github.com/hashicorp/consul/api/coordinate.go b/vendor/github.com/hashicorp/consul/api/coordinate.go deleted file mode 100644 index b0269adae..000000000 --- a/vendor/github.com/hashicorp/consul/api/coordinate.go +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "github.com/hashicorp/serf/coordinate" -) - -// CoordinateEntry represents a node and its associated network coordinate. -type CoordinateEntry struct { - Node string - Segment string - Partition string `json:",omitempty"` - Coord *coordinate.Coordinate -} - -// CoordinateDatacenterMap has the coordinates for servers in a given datacenter -// and area. Network coordinates are only compatible within the same area. -type CoordinateDatacenterMap struct { - Datacenter string - AreaID string - Coordinates []CoordinateEntry -} - -// Coordinate can be used to query the coordinate endpoints -type Coordinate struct { - c *Client -} - -// Coordinate returns a handle to the coordinate endpoints -func (c *Client) Coordinate() *Coordinate { - return &Coordinate{c} -} - -// Datacenters is used to return the coordinates of all the servers in the WAN -// pool. -func (c *Coordinate) Datacenters() ([]*CoordinateDatacenterMap, error) { - r := c.c.newRequest("GET", "/v1/coordinate/datacenters") - _, resp, err := c.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - var out []*CoordinateDatacenterMap - if err := decodeBody(resp, &out); err != nil { - return nil, err - } - return out, nil -} - -// Nodes is used to return the coordinates of all the nodes in the LAN pool. -func (c *Coordinate) Nodes(q *QueryOptions) ([]*CoordinateEntry, *QueryMeta, error) { - r := c.c.newRequest("GET", "/v1/coordinate/nodes") - r.setQueryOptions(q) - rtt, resp, err := c.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out []*CoordinateEntry - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return out, qm, nil -} - -// Update inserts or updates the LAN coordinate of a node. -func (c *Coordinate) Update(coord *CoordinateEntry, q *WriteOptions) (*WriteMeta, error) { - r := c.c.newRequest("PUT", "/v1/coordinate/update") - r.setWriteOptions(q) - r.obj = coord - rtt, resp, err := c.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - wm := &WriteMeta{} - wm.RequestTime = rtt - - return wm, nil -} - -// Node is used to return the coordinates of a single node in the LAN pool. -func (c *Coordinate) Node(node string, q *QueryOptions) ([]*CoordinateEntry, *QueryMeta, error) { - r := c.c.newRequest("GET", "/v1/coordinate/node/"+node) - r.setQueryOptions(q) - rtt, resp, err := c.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out []*CoordinateEntry - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return out, qm, nil -} diff --git a/vendor/github.com/hashicorp/consul/api/debug.go b/vendor/github.com/hashicorp/consul/api/debug.go deleted file mode 100644 index e6b5dc52d..000000000 --- a/vendor/github.com/hashicorp/consul/api/debug.go +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "context" - "fmt" - "io" - "strconv" -) - -// Debug can be used to query the /debug/pprof endpoints to gather -// profiling information about the target agent.Debug -// -// The agent must have enable_debug set to true for profiling to be enabled -// and for these endpoints to function. -type Debug struct { - c *Client -} - -// Debug returns a handle that exposes the internal debug endpoints. -func (c *Client) Debug() *Debug { - return &Debug{c} -} - -// Heap returns a pprof heap dump -func (d *Debug) Heap() ([]byte, error) { - r := d.c.newRequest("GET", "/debug/pprof/heap") - _, resp, err := d.c.doRequest(r) - if err != nil { - return nil, fmt.Errorf("error making request: %s", err) - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - // We return a raw response because we're just passing through a response - // from the pprof handlers - body, err := io.ReadAll(resp.Body) - if err != nil { - return nil, fmt.Errorf("error decoding body: %s", err) - } - - return body, nil -} - -// Profile returns a pprof CPU profile for the specified number of seconds -func (d *Debug) Profile(seconds int) ([]byte, error) { - r := d.c.newRequest("GET", "/debug/pprof/profile") - - // Capture a profile for the specified number of seconds - r.params.Set("seconds", strconv.Itoa(seconds)) - - _, resp, err := d.c.doRequest(r) - if err != nil { - return nil, fmt.Errorf("error making request: %s", err) - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - // We return a raw response because we're just passing through a response - // from the pprof handlers - body, err := io.ReadAll(resp.Body) - if err != nil { - return nil, fmt.Errorf("error decoding body: %s", err) - } - - return body, nil -} - -// PProf returns a pprof profile for the specified number of seconds. The caller -// is responsible for closing the returned io.ReadCloser once all bytes are read. -func (d *Debug) PProf(ctx context.Context, name string, seconds int) (io.ReadCloser, error) { - r := d.c.newRequest("GET", "/debug/pprof/"+name) - r.ctx = ctx - - // Capture a profile for the specified number of seconds - r.params.Set("seconds", strconv.Itoa(seconds)) - - _, resp, err := d.c.doRequest(r) - if err != nil { - return nil, fmt.Errorf("error making request: %s", err) - } - if err := requireOK(resp); err != nil { - return nil, err - } - return resp.Body, nil -} - -// Trace returns an execution trace -func (d *Debug) Trace(seconds int) ([]byte, error) { - r := d.c.newRequest("GET", "/debug/pprof/trace") - - // Capture a trace for the specified number of seconds - r.params.Set("seconds", strconv.Itoa(seconds)) - - _, resp, err := d.c.doRequest(r) - if err != nil { - return nil, fmt.Errorf("error making request: %s", err) - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - // We return a raw response because we're just passing through a response - // from the pprof handlers - body, err := io.ReadAll(resp.Body) - if err != nil { - return nil, fmt.Errorf("error decoding body: %s", err) - } - - return body, nil -} - -// Goroutine returns a pprof goroutine profile -func (d *Debug) Goroutine() ([]byte, error) { - r := d.c.newRequest("GET", "/debug/pprof/goroutine") - - _, resp, err := d.c.doRequest(r) - if err != nil { - return nil, fmt.Errorf("error making request: %s", err) - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - // We return a raw response because we're just passing through a response - // from the pprof handlers - body, err := io.ReadAll(resp.Body) - if err != nil { - return nil, fmt.Errorf("error decoding body: %s", err) - } - - return body, nil -} diff --git a/vendor/github.com/hashicorp/consul/api/discovery_chain.go b/vendor/github.com/hashicorp/consul/api/discovery_chain.go deleted file mode 100644 index 4b6260cf3..000000000 --- a/vendor/github.com/hashicorp/consul/api/discovery_chain.go +++ /dev/null @@ -1,283 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "encoding/json" - "fmt" - "time" -) - -// DiscoveryChain can be used to query the discovery-chain endpoints -type DiscoveryChain struct { - c *Client -} - -// DiscoveryChain returns a handle to the discovery-chain endpoints -func (c *Client) DiscoveryChain() *DiscoveryChain { - return &DiscoveryChain{c} -} - -func (d *DiscoveryChain) Get(name string, opts *DiscoveryChainOptions, q *QueryOptions) (*DiscoveryChainResponse, *QueryMeta, error) { - if name == "" { - return nil, nil, fmt.Errorf("Name parameter must not be empty") - } - - method := "GET" - if opts != nil && opts.requiresPOST() { - method = "POST" - } - - r := d.c.newRequest(method, fmt.Sprintf("/v1/discovery-chain/%s", name)) - r.setQueryOptions(q) - - if opts != nil { - if opts.EvaluateInDatacenter != "" { - r.params.Set("compile-dc", opts.EvaluateInDatacenter) - } - } - - if method == "POST" { - r.obj = opts - } - rtt, resp, err := d.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out DiscoveryChainResponse - - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, qm, nil -} - -type DiscoveryChainOptions struct { - EvaluateInDatacenter string `json:"-"` - - // OverrideMeshGateway allows for the mesh gateway setting to be overridden - // for any resolver in the compiled chain. - OverrideMeshGateway MeshGatewayConfig `json:",omitempty"` - - // OverrideProtocol allows for the final protocol for the chain to be - // altered. - // - // - If the chain ordinarily would be TCP and an L7 protocol is passed here - // the chain will not include Routers or Splitters. - // - // - If the chain ordinarily would be L7 and TCP is passed here the chain - // will not include Routers or Splitters. - OverrideProtocol string `json:",omitempty"` - - // OverrideConnectTimeout allows for the ConnectTimeout setting to be - // overridden for any resolver in the compiled chain. - OverrideConnectTimeout time.Duration `json:",omitempty"` -} - -func (o *DiscoveryChainOptions) requiresPOST() bool { - if o == nil { - return false - } - return o.OverrideMeshGateway.Mode != "" || - o.OverrideProtocol != "" || - o.OverrideConnectTimeout != 0 -} - -type DiscoveryChainResponse struct { - Chain *CompiledDiscoveryChain -} - -type CompiledDiscoveryChain struct { - ServiceName string - Namespace string - Datacenter string - - // CustomizationHash is a unique hash of any data that affects the - // compilation of the discovery chain other than config entries or the - // name/namespace/datacenter evaluation criteria. - // - // If set, this value should be used to prefix/suffix any generated load - // balancer data plane objects to avoid sharing customized and - // non-customized versions. - CustomizationHash string - - // Default indicates if this discovery chain is based on no - // service-resolver, service-splitter, or service-router config entries. - Default bool - - // Protocol is the overall protocol shared by everything in the chain. - Protocol string - - // ServiceMeta is the metadata from the underlying service-defaults config - // entry for the service named ServiceName. - ServiceMeta map[string]string - - // StartNode is the first key into the Nodes map that should be followed - // when walking the discovery chain. - StartNode string - - // Nodes contains all nodes available for traversal in the chain keyed by a - // unique name. You can walk this by starting with StartNode. - // - // NOTE: The names should be treated as opaque values and are only - // guaranteed to be consistent within a single compilation. - Nodes map[string]*DiscoveryGraphNode - - // Targets is a list of all targets used in this chain. - // - // NOTE: The names should be treated as opaque values and are only - // guaranteed to be consistent within a single compilation. - Targets map[string]*DiscoveryTarget -} - -const ( - DiscoveryGraphNodeTypeRouter = "router" - DiscoveryGraphNodeTypeSplitter = "splitter" - DiscoveryGraphNodeTypeResolver = "resolver" -) - -// DiscoveryGraphNode is a single node in the compiled discovery chain. -type DiscoveryGraphNode struct { - Type string - Name string // this is NOT necessarily a service - - // fields for Type==router - Routes []*DiscoveryRoute - - // fields for Type==splitter - Splits []*DiscoverySplit - - // fields for Type==resolver - Resolver *DiscoveryResolver - - // shared by Type==resolver || Type==splitter - LoadBalancer *LoadBalancer `json:",omitempty"` -} - -// compiled form of ServiceRoute -type DiscoveryRoute struct { - Definition *ServiceRoute - NextNode string -} - -// compiled form of ServiceSplit -type DiscoverySplit struct { - Weight float32 - NextNode string -} - -// compiled form of ServiceResolverConfigEntry -type DiscoveryResolver struct { - Default bool - ConnectTimeout time.Duration - Target string - Failover *DiscoveryFailover -} - -func (r *DiscoveryResolver) MarshalJSON() ([]byte, error) { - type Alias DiscoveryResolver - exported := &struct { - ConnectTimeout string `json:",omitempty"` - *Alias - }{ - ConnectTimeout: r.ConnectTimeout.String(), - Alias: (*Alias)(r), - } - if r.ConnectTimeout == 0 { - exported.ConnectTimeout = "" - } - - return json.Marshal(exported) -} - -func (r *DiscoveryResolver) UnmarshalJSON(data []byte) error { - type Alias DiscoveryResolver - aux := &struct { - ConnectTimeout string - *Alias - }{ - Alias: (*Alias)(r), - } - if err := json.Unmarshal(data, &aux); err != nil { - return err - } - var err error - if aux.ConnectTimeout != "" { - if r.ConnectTimeout, err = time.ParseDuration(aux.ConnectTimeout); err != nil { - return err - } - } - return nil -} - -// compiled form of ServiceResolverFailover -type DiscoveryFailover struct { - Targets []string - Policy ServiceResolverFailoverPolicy `json:",omitempty"` -} - -// DiscoveryTarget represents all of the inputs necessary to use a resolver -// config entry to execute a catalog query to generate a list of service -// instances during discovery. -type DiscoveryTarget struct { - ID string - - Service string - ServiceSubset string - Namespace string - Datacenter string - - MeshGateway MeshGatewayConfig - Subset ServiceResolverSubset - ConnectTimeout time.Duration - External bool - SNI string - Name string -} - -func (t *DiscoveryTarget) MarshalJSON() ([]byte, error) { - type Alias DiscoveryTarget - exported := &struct { - ConnectTimeout string `json:",omitempty"` - *Alias - }{ - ConnectTimeout: t.ConnectTimeout.String(), - Alias: (*Alias)(t), - } - if t.ConnectTimeout == 0 { - exported.ConnectTimeout = "" - } - - return json.Marshal(exported) -} - -func (t *DiscoveryTarget) UnmarshalJSON(data []byte) error { - type Alias DiscoveryTarget - aux := &struct { - ConnectTimeout string - *Alias - }{ - Alias: (*Alias)(t), - } - if err := json.Unmarshal(data, &aux); err != nil { - return err - } - var err error - if aux.ConnectTimeout != "" { - if t.ConnectTimeout, err = time.ParseDuration(aux.ConnectTimeout); err != nil { - return err - } - } - return nil -} diff --git a/vendor/github.com/hashicorp/consul/api/event.go b/vendor/github.com/hashicorp/consul/api/event.go deleted file mode 100644 index efba89d3b..000000000 --- a/vendor/github.com/hashicorp/consul/api/event.go +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "bytes" - "strconv" -) - -// Event can be used to query the Event endpoints -type Event struct { - c *Client -} - -// UserEvent represents an event that was fired by the user -type UserEvent struct { - ID string - Name string - Payload []byte - NodeFilter string - ServiceFilter string - TagFilter string - Version int - LTime uint64 -} - -// Event returns a handle to the event endpoints -func (c *Client) Event() *Event { - return &Event{c} -} - -// Fire is used to fire a new user event. Only the Name, Payload and Filters -// are respected. This returns the ID or an associated error. Cross DC requests -// are supported. -func (e *Event) Fire(params *UserEvent, q *WriteOptions) (string, *WriteMeta, error) { - r := e.c.newRequest("PUT", "/v1/event/fire/"+params.Name) - r.setWriteOptions(q) - if params.NodeFilter != "" { - r.params.Set("node", params.NodeFilter) - } - if params.ServiceFilter != "" { - r.params.Set("service", params.ServiceFilter) - } - if params.TagFilter != "" { - r.params.Set("tag", params.TagFilter) - } - if params.Payload != nil { - r.body = bytes.NewReader(params.Payload) - } - r.header.Set("Content-Type", "application/octet-stream") - - rtt, resp, err := e.c.doRequest(r) - if err != nil { - return "", nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return "", nil, err - } - - wm := &WriteMeta{RequestTime: rtt} - var out UserEvent - if err := decodeBody(resp, &out); err != nil { - return "", nil, err - } - return out.ID, wm, nil -} - -// List is used to get the most recent events an agent has received. -// This list can be optionally filtered by the name. This endpoint supports -// quasi-blocking queries. The index is not monotonic, nor does it provide provide -// LastContact or KnownLeader. -func (e *Event) List(name string, q *QueryOptions) ([]*UserEvent, *QueryMeta, error) { - r := e.c.newRequest("GET", "/v1/event/list") - r.setQueryOptions(q) - if name != "" { - r.params.Set("name", name) - } - rtt, resp, err := e.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var entries []*UserEvent - if err := decodeBody(resp, &entries); err != nil { - return nil, nil, err - } - return entries, qm, nil -} - -// IDToIndex is a bit of a hack. This simulates the index generation to -// convert an event ID into a WaitIndex. -func (e *Event) IDToIndex(uuid string) uint64 { - lower := uuid[0:8] + uuid[9:13] + uuid[14:18] - upper := uuid[19:23] + uuid[24:36] - lowVal, err := strconv.ParseUint(lower, 16, 64) - if err != nil { - panic("Failed to convert " + lower) - } - highVal, err := strconv.ParseUint(upper, 16, 64) - if err != nil { - panic("Failed to convert " + upper) - } - return lowVal ^ highVal -} diff --git a/vendor/github.com/hashicorp/consul/api/exported_services.go b/vendor/github.com/hashicorp/consul/api/exported_services.go deleted file mode 100644 index 50483e9c8..000000000 --- a/vendor/github.com/hashicorp/consul/api/exported_services.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -type ResolvedExportedService struct { - // Service is the name of the service which is exported. - Service string - - // Partition of the service - Partition string `json:",omitempty"` - - // Namespace of the service - Namespace string `json:",omitempty"` - - // Consumers is a list of downstream consumers of the service. - Consumers ResolvedConsumers -} - -type ResolvedConsumers struct { - Peers []string `json:",omitempty"` - Partitions []string `json:",omitempty"` -} - -func (c *Client) ExportedServices(q *QueryOptions) ([]ResolvedExportedService, *QueryMeta, error) { - - r := c.newRequest("GET", "/v1/exported-services") - r.setQueryOptions(q) - rtt, resp, err := c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var expSvcs []ResolvedExportedService - - if err := decodeBody(resp, &expSvcs); err != nil { - return nil, nil, err - } - - return expSvcs, qm, nil -} diff --git a/vendor/github.com/hashicorp/consul/api/health.go b/vendor/github.com/hashicorp/consul/api/health.go deleted file mode 100644 index a02300204..000000000 --- a/vendor/github.com/hashicorp/consul/api/health.go +++ /dev/null @@ -1,398 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "encoding/json" - "fmt" - "strings" - "time" -) - -const ( - // HealthAny is special, and is used as a wild card, - // not as a specific state. - HealthAny = "any" - HealthPassing = "passing" - HealthWarning = "warning" - HealthCritical = "critical" - HealthMaint = "maintenance" -) - -const ( - serviceHealth = "service" - connectHealth = "connect" - ingressHealth = "ingress" -) - -const ( - // NodeMaint is the special key set by a node in maintenance mode. - NodeMaint = "_node_maintenance" - - // ServiceMaintPrefix is the prefix for a service in maintenance mode. - ServiceMaintPrefix = "_service_maintenance:" -) - -// HealthCheck is used to represent a single check -type HealthCheck struct { - Node string - CheckID string - Name string - Status string - Notes string - Output string - ServiceID string - ServiceName string - ServiceTags []string - Type string - Namespace string `json:",omitempty"` - Partition string `json:",omitempty"` - ExposedPort int - PeerName string `json:",omitempty"` - - Definition HealthCheckDefinition - - CreateIndex uint64 - ModifyIndex uint64 -} - -// HealthCheckDefinition is used to store the details about -// a health check's execution. -type HealthCheckDefinition struct { - HTTP string - Header map[string][]string - Method string - Body string - TLSServerName string - TLSSkipVerify bool - TCP string - TCPUseTLS bool - UDP string - GRPC string - OSService string - GRPCUseTLS bool - IntervalDuration time.Duration `json:"-"` - TimeoutDuration time.Duration `json:"-"` - DeregisterCriticalServiceAfterDuration time.Duration `json:"-"` - - // DEPRECATED in Consul 1.4.1. Use the above time.Duration fields instead. - Interval ReadableDuration - Timeout ReadableDuration - DeregisterCriticalServiceAfter ReadableDuration -} - -func (d *HealthCheckDefinition) MarshalJSON() ([]byte, error) { - type Alias HealthCheckDefinition - out := &struct { - Interval string - Timeout string - DeregisterCriticalServiceAfter string - *Alias - }{ - Interval: d.Interval.String(), - Timeout: d.Timeout.String(), - DeregisterCriticalServiceAfter: d.DeregisterCriticalServiceAfter.String(), - Alias: (*Alias)(d), - } - - if d.IntervalDuration != 0 { - out.Interval = d.IntervalDuration.String() - } else if d.Interval != 0 { - out.Interval = d.Interval.String() - } - if d.TimeoutDuration != 0 { - out.Timeout = d.TimeoutDuration.String() - } else if d.Timeout != 0 { - out.Timeout = d.Timeout.String() - } - if d.DeregisterCriticalServiceAfterDuration != 0 { - out.DeregisterCriticalServiceAfter = d.DeregisterCriticalServiceAfterDuration.String() - } else if d.DeregisterCriticalServiceAfter != 0 { - out.DeregisterCriticalServiceAfter = d.DeregisterCriticalServiceAfter.String() - } - - return json.Marshal(out) -} - -func (t *HealthCheckDefinition) UnmarshalJSON(data []byte) (err error) { - type Alias HealthCheckDefinition - aux := &struct { - IntervalDuration interface{} - TimeoutDuration interface{} - DeregisterCriticalServiceAfterDuration interface{} - *Alias - }{ - Alias: (*Alias)(t), - } - if err := json.Unmarshal(data, &aux); err != nil { - return err - } - - // Parse the values into both the time.Duration and old ReadableDuration fields. - - if aux.IntervalDuration == nil { - t.IntervalDuration = time.Duration(t.Interval) - } else { - switch v := aux.IntervalDuration.(type) { - case string: - if t.IntervalDuration, err = time.ParseDuration(v); err != nil { - return err - } - case float64: - t.IntervalDuration = time.Duration(v) - } - t.Interval = ReadableDuration(t.IntervalDuration) - } - - if aux.TimeoutDuration == nil { - t.TimeoutDuration = time.Duration(t.Timeout) - } else { - switch v := aux.TimeoutDuration.(type) { - case string: - if t.TimeoutDuration, err = time.ParseDuration(v); err != nil { - return err - } - case float64: - t.TimeoutDuration = time.Duration(v) - } - t.Timeout = ReadableDuration(t.TimeoutDuration) - } - if aux.DeregisterCriticalServiceAfterDuration == nil { - t.DeregisterCriticalServiceAfterDuration = time.Duration(t.DeregisterCriticalServiceAfter) - } else { - switch v := aux.DeregisterCriticalServiceAfterDuration.(type) { - case string: - if t.DeregisterCriticalServiceAfterDuration, err = time.ParseDuration(v); err != nil { - return err - } - case float64: - t.DeregisterCriticalServiceAfterDuration = time.Duration(v) - } - t.DeregisterCriticalServiceAfter = ReadableDuration(t.DeregisterCriticalServiceAfterDuration) - } - - return nil -} - -// HealthChecks is a collection of HealthCheck structs. -type HealthChecks []*HealthCheck - -// AggregatedStatus returns the "best" status for the list of health checks. -// Because a given entry may have many service and node-level health checks -// attached, this function determines the best representative of the status as -// as single string using the following heuristic: -// -// maintenance > critical > warning > passing -func (c HealthChecks) AggregatedStatus() string { - var passing, warning, critical, maintenance bool - for _, check := range c { - id := check.CheckID - if id == NodeMaint || strings.HasPrefix(id, ServiceMaintPrefix) { - maintenance = true - continue - } - - switch check.Status { - case HealthPassing: - passing = true - case HealthWarning: - warning = true - case HealthCritical: - critical = true - default: - return "" - } - } - - switch { - case maintenance: - return HealthMaint - case critical: - return HealthCritical - case warning: - return HealthWarning - case passing: - return HealthPassing - default: - return HealthPassing - } -} - -// ServiceEntry is used for the health service endpoint -type ServiceEntry struct { - Node *Node - Service *AgentService - Checks HealthChecks -} - -// Health can be used to query the Health endpoints -type Health struct { - c *Client -} - -// Health returns a handle to the health endpoints -func (c *Client) Health() *Health { - return &Health{c} -} - -// Node is used to query for checks belonging to a given node -func (h *Health) Node(node string, q *QueryOptions) (HealthChecks, *QueryMeta, error) { - r := h.c.newRequest("GET", "/v1/health/node/"+node) - r.setQueryOptions(q) - rtt, resp, err := h.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out HealthChecks - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return out, qm, nil -} - -// Checks is used to return the checks associated with a service -func (h *Health) Checks(service string, q *QueryOptions) (HealthChecks, *QueryMeta, error) { - r := h.c.newRequest("GET", "/v1/health/checks/"+service) - r.setQueryOptions(q) - rtt, resp, err := h.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out HealthChecks - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return out, qm, nil -} - -// Service is used to query health information along with service info -// for a given service. It can optionally do server-side filtering on a tag -// or nodes with passing health checks only. -func (h *Health) Service(service, tag string, passingOnly bool, q *QueryOptions) ([]*ServiceEntry, *QueryMeta, error) { - var tags []string - if tag != "" { - tags = []string{tag} - } - return h.service(service, tags, passingOnly, q, serviceHealth) -} - -func (h *Health) ServiceMultipleTags(service string, tags []string, passingOnly bool, q *QueryOptions) ([]*ServiceEntry, *QueryMeta, error) { - return h.service(service, tags, passingOnly, q, serviceHealth) -} - -// Connect is equivalent to Service except that it will only return services -// which are Connect-enabled and will returns the connection address for Connect -// client's to use which may be a proxy in front of the named service. If -// passingOnly is true only instances where both the service and any proxy are -// healthy will be returned. -func (h *Health) Connect(service, tag string, passingOnly bool, q *QueryOptions) ([]*ServiceEntry, *QueryMeta, error) { - var tags []string - if tag != "" { - tags = []string{tag} - } - return h.service(service, tags, passingOnly, q, connectHealth) -} - -func (h *Health) ConnectMultipleTags(service string, tags []string, passingOnly bool, q *QueryOptions) ([]*ServiceEntry, *QueryMeta, error) { - return h.service(service, tags, passingOnly, q, connectHealth) -} - -// Ingress is equivalent to Connect except that it will only return associated -// ingress gateways for the requested service. -func (h *Health) Ingress(service string, passingOnly bool, q *QueryOptions) ([]*ServiceEntry, *QueryMeta, error) { - var tags []string - return h.service(service, tags, passingOnly, q, ingressHealth) -} - -func (h *Health) service(service string, tags []string, passingOnly bool, q *QueryOptions, healthType string) ([]*ServiceEntry, *QueryMeta, error) { - var path string - switch healthType { - case connectHealth: - path = "/v1/health/connect/" + service - case ingressHealth: - path = "/v1/health/ingress/" + service - default: - path = "/v1/health/service/" + service - } - - r := h.c.newRequest("GET", path) - r.setQueryOptions(q) - if len(tags) > 0 { - for _, tag := range tags { - r.params.Add("tag", tag) - } - } - if passingOnly { - r.params.Set(HealthPassing, "1") - } - rtt, resp, err := h.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out []*ServiceEntry - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return out, qm, nil -} - -// State is used to retrieve all the checks in a given state. -// The wildcard "any" state can also be used for all checks. -func (h *Health) State(state string, q *QueryOptions) (HealthChecks, *QueryMeta, error) { - switch state { - case HealthAny: - case HealthWarning: - case HealthCritical: - case HealthPassing: - default: - return nil, nil, fmt.Errorf("Unsupported state: %v", state) - } - r := h.c.newRequest("GET", "/v1/health/state/"+state) - r.setQueryOptions(q) - rtt, resp, err := h.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out HealthChecks - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return out, qm, nil -} diff --git a/vendor/github.com/hashicorp/consul/api/internal.go b/vendor/github.com/hashicorp/consul/api/internal.go deleted file mode 100644 index b5f400f4b..000000000 --- a/vendor/github.com/hashicorp/consul/api/internal.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import "context" - -// Internal can be used to query endpoints that are intended for -// Hashicorp internal-use only. -type Internal struct { - c *Client -} - -// Internal returns a handle to endpoints that are for internal -// Hashicorp usage only. There is not guarantee that these will -// be backwards-compatible or supported, so usage of these is -// not encouraged. -func (c *Client) Internal() *Internal { - return &Internal{c} -} - -type AssignServiceManualVIPsRequest struct { - Service string - ManualVIPs []string -} - -type AssignServiceManualVIPsResponse struct { - ServiceFound bool `json:"Found"` - UnassignedFrom []PeeredServiceName -} - -type PeeredServiceName struct { - ServiceName CompoundServiceName - Peer string -} - -func (i *Internal) AssignServiceVirtualIP( - ctx context.Context, - service string, - manualVIPs []string, - wo *WriteOptions, -) (*AssignServiceManualVIPsResponse, *QueryMeta, error) { - req := i.c.newRequest("PUT", "/v1/internal/service-virtual-ip") - req.setWriteOptions(wo) - req.ctx = ctx - req.obj = AssignServiceManualVIPsRequest{ - Service: service, - ManualVIPs: manualVIPs, - } - rtt, resp, err := i.c.doRequest(req) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{RequestTime: rtt} - parseQueryMeta(resp, qm) - - var out AssignServiceManualVIPsResponse - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return &out, qm, nil -} diff --git a/vendor/github.com/hashicorp/consul/api/kv.go b/vendor/github.com/hashicorp/consul/api/kv.go deleted file mode 100644 index b9d330a6f..000000000 --- a/vendor/github.com/hashicorp/consul/api/kv.go +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "bytes" - "fmt" - "io" - "net/http" - "strconv" - "strings" -) - -// KVPair is used to represent a single K/V entry -type KVPair struct { - // Key is the name of the key. It is also part of the URL path when accessed - // via the API. - Key string - - // CreateIndex holds the index corresponding the creation of this KVPair. This - // is a read-only field. - CreateIndex uint64 - - // ModifyIndex is used for the Check-And-Set operations and can also be fed - // back into the WaitIndex of the QueryOptions in order to perform blocking - // queries. - ModifyIndex uint64 - - // LockIndex holds the index corresponding to a lock on this key, if any. This - // is a read-only field. - LockIndex uint64 - - // Flags are any user-defined flags on the key. It is up to the implementer - // to check these values, since Consul does not treat them specially. - Flags uint64 - - // Value is the value for the key. This can be any value, but it will be - // base64 encoded upon transport. - Value []byte - - // Session is a string representing the ID of the session. Any other - // interactions with this key over the same session must specify the same - // session ID. - Session string - - // Namespace is the namespace the KVPair is associated with - // Namespacing is a Consul Enterprise feature. - Namespace string `json:",omitempty"` - - // Partition is the partition the KVPair is associated with - // Admin Partition is a Consul Enterprise feature. - Partition string `json:",omitempty"` -} - -// KVPairs is a list of KVPair objects -type KVPairs []*KVPair - -// KV is used to manipulate the K/V API -type KV struct { - c *Client -} - -// KV is used to return a handle to the K/V apis -func (c *Client) KV() *KV { - return &KV{c} -} - -// Get is used to lookup a single key. The returned pointer -// to the KVPair will be nil if the key does not exist. -func (k *KV) Get(key string, q *QueryOptions) (*KVPair, *QueryMeta, error) { - resp, qm, err := k.getInternal(key, nil, q) - if err != nil { - return nil, nil, err - } - if resp == nil { - return nil, qm, nil - } - defer closeResponseBody(resp) - - var entries []*KVPair - if err := decodeBody(resp, &entries); err != nil { - return nil, nil, err - } - if len(entries) > 0 { - return entries[0], qm, nil - } - return nil, qm, nil -} - -// List is used to lookup all keys under a prefix -func (k *KV) List(prefix string, q *QueryOptions) (KVPairs, *QueryMeta, error) { - resp, qm, err := k.getInternal(prefix, map[string]string{"recurse": ""}, q) - if err != nil { - return nil, nil, err - } - if resp == nil { - return nil, qm, nil - } - defer closeResponseBody(resp) - - var entries []*KVPair - if err := decodeBody(resp, &entries); err != nil { - return nil, nil, err - } - return entries, qm, nil -} - -// Keys is used to list all the keys under a prefix. Optionally, -// a separator can be used to limit the responses. -func (k *KV) Keys(prefix, separator string, q *QueryOptions) ([]string, *QueryMeta, error) { - params := map[string]string{"keys": ""} - if separator != "" { - params["separator"] = separator - } - resp, qm, err := k.getInternal(prefix, params, q) - if err != nil { - return nil, nil, err - } - if resp == nil { - return nil, qm, nil - } - defer closeResponseBody(resp) - - var entries []string - if err := decodeBody(resp, &entries); err != nil { - return nil, nil, err - } - return entries, qm, nil -} - -func (k *KV) getInternal(key string, params map[string]string, q *QueryOptions) (*http.Response, *QueryMeta, error) { - r := k.c.newRequest("GET", "/v1/kv/"+strings.TrimPrefix(key, "/")) - r.setQueryOptions(q) - for param, val := range params { - r.params.Set(param, val) - } - rtt, resp, err := k.c.doRequest(r) - if err != nil { - return nil, nil, err - } - - err = requireHttpCodes(resp, 200, 404) - if err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - if resp.StatusCode == 404 { - closeResponseBody(resp) - return nil, qm, nil - } - - return resp, qm, nil -} - -// Put is used to write a new value. Only the -// Key, Flags and Value is respected. -func (k *KV) Put(p *KVPair, q *WriteOptions) (*WriteMeta, error) { - params := make(map[string]string, 1) - if p.Flags != 0 { - params["flags"] = strconv.FormatUint(p.Flags, 10) - } - _, wm, err := k.put(p.Key, params, p.Value, q) - return wm, err -} - -// CAS is used for a Check-And-Set operation. The Key, -// ModifyIndex, Flags and Value are respected. Returns true -// on success or false on failures. -func (k *KV) CAS(p *KVPair, q *WriteOptions) (bool, *WriteMeta, error) { - params := make(map[string]string, 2) - if p.Flags != 0 { - params["flags"] = strconv.FormatUint(p.Flags, 10) - } - params["cas"] = strconv.FormatUint(p.ModifyIndex, 10) - return k.put(p.Key, params, p.Value, q) -} - -// Acquire is used for a lock acquisition operation. The Key, -// Flags, Value and Session are respected. Returns true -// on success or false on failures. -func (k *KV) Acquire(p *KVPair, q *WriteOptions) (bool, *WriteMeta, error) { - params := make(map[string]string, 2) - if p.Flags != 0 { - params["flags"] = strconv.FormatUint(p.Flags, 10) - } - params["acquire"] = p.Session - return k.put(p.Key, params, p.Value, q) -} - -// Release is used for a lock release operation. The Key, -// Flags, Value and Session are respected. Returns true -// on success or false on failures. -func (k *KV) Release(p *KVPair, q *WriteOptions) (bool, *WriteMeta, error) { - params := make(map[string]string, 2) - if p.Flags != 0 { - params["flags"] = strconv.FormatUint(p.Flags, 10) - } - params["release"] = p.Session - return k.put(p.Key, params, p.Value, q) -} - -func (k *KV) put(key string, params map[string]string, body []byte, q *WriteOptions) (bool, *WriteMeta, error) { - if len(key) > 0 && key[0] == '/' { - return false, nil, fmt.Errorf("Invalid key. Key must not begin with a '/': %s", key) - } - - r := k.c.newRequest("PUT", "/v1/kv/"+key) - r.setWriteOptions(q) - for param, val := range params { - r.params.Set(param, val) - } - r.body = bytes.NewReader(body) - r.header.Set("Content-Type", "application/octet-stream") - rtt, resp, err := k.c.doRequest(r) - if err != nil { - return false, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return false, nil, err - } - - qm := &WriteMeta{} - qm.RequestTime = rtt - - var buf bytes.Buffer - if _, err := io.Copy(&buf, resp.Body); err != nil { - return false, nil, fmt.Errorf("Failed to read response: %v", err) - } - res := strings.Contains(buf.String(), "true") - return res, qm, nil -} - -// Delete is used to delete a single key -func (k *KV) Delete(key string, w *WriteOptions) (*WriteMeta, error) { - _, qm, err := k.deleteInternal(key, nil, w) - return qm, err -} - -// DeleteCAS is used for a Delete Check-And-Set operation. The Key -// and ModifyIndex are respected. Returns true on success or false on failures. -func (k *KV) DeleteCAS(p *KVPair, q *WriteOptions) (bool, *WriteMeta, error) { - params := map[string]string{ - "cas": strconv.FormatUint(p.ModifyIndex, 10), - } - return k.deleteInternal(p.Key, params, q) -} - -// DeleteTree is used to delete all keys under a prefix -func (k *KV) DeleteTree(prefix string, w *WriteOptions) (*WriteMeta, error) { - _, qm, err := k.deleteInternal(prefix, map[string]string{"recurse": ""}, w) - return qm, err -} - -func (k *KV) deleteInternal(key string, params map[string]string, q *WriteOptions) (bool, *WriteMeta, error) { - r := k.c.newRequest("DELETE", "/v1/kv/"+strings.TrimPrefix(key, "/")) - r.setWriteOptions(q) - for param, val := range params { - r.params.Set(param, val) - } - rtt, resp, err := k.c.doRequest(r) - if err != nil { - return false, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return false, nil, err - } - - qm := &WriteMeta{} - qm.RequestTime = rtt - - var buf bytes.Buffer - if _, err := io.Copy(&buf, resp.Body); err != nil { - return false, nil, fmt.Errorf("Failed to read response: %v", err) - } - res := strings.Contains(buf.String(), "true") - return res, qm, nil -} - -// The Txn function has been deprecated from the KV object; please see the Txn -// object for more information about Transactions. -func (k *KV) Txn(txn KVTxnOps, q *QueryOptions) (bool, *KVTxnResponse, *QueryMeta, error) { - var ops TxnOps - for _, op := range txn { - ops = append(ops, &TxnOp{KV: op}) - } - - respOk, txnResp, qm, err := k.c.txn(ops, q) - if err != nil { - return false, nil, nil, err - } - - // Convert from the internal format. - kvResp := KVTxnResponse{ - Errors: txnResp.Errors, - } - for _, result := range txnResp.Results { - kvResp.Results = append(kvResp.Results, result.KV) - } - return respOk, &kvResp, qm, nil -} diff --git a/vendor/github.com/hashicorp/consul/api/lock.go b/vendor/github.com/hashicorp/consul/api/lock.go deleted file mode 100644 index e9529f7bd..000000000 --- a/vendor/github.com/hashicorp/consul/api/lock.go +++ /dev/null @@ -1,411 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "fmt" - "sync" - "time" -) - -const ( - // DefaultLockSessionName is the Session Name we assign if none is provided - DefaultLockSessionName = "Consul API Lock" - - // DefaultLockSessionTTL is the default session TTL if no Session is provided - // when creating a new Lock. This is used because we do not have another - // other check to depend upon. - DefaultLockSessionTTL = "15s" - - // DefaultLockWaitTime is how long we block for at a time to check if lock - // acquisition is possible. This affects the minimum time it takes to cancel - // a Lock acquisition. - DefaultLockWaitTime = 15 * time.Second - - // DefaultLockRetryTime is how long we wait after a failed lock acquisition - // before attempting to do the lock again. This is so that once a lock-delay - // is in effect, we do not hot loop retrying the acquisition. - DefaultLockRetryTime = 5 * time.Second - - // DefaultMonitorRetryTime is how long we wait after a failed monitor check - // of a lock (500 response code). This allows the monitor to ride out brief - // periods of unavailability, subject to the MonitorRetries setting in the - // lock options which is by default set to 0, disabling this feature. This - // affects locks and semaphores. - DefaultMonitorRetryTime = 2 * time.Second - - // LockFlagValue is a magic flag we set to indicate a key - // is being used for a lock. It is used to detect a potential - // conflict with a semaphore. - LockFlagValue = 0x2ddccbc058a50c18 -) - -var ( - // ErrLockHeld is returned if we attempt to double lock - ErrLockHeld = fmt.Errorf("Lock already held") - - // ErrLockNotHeld is returned if we attempt to unlock a lock - // that we do not hold. - ErrLockNotHeld = fmt.Errorf("Lock not held") - - // ErrLockInUse is returned if we attempt to destroy a lock - // that is in use. - ErrLockInUse = fmt.Errorf("Lock in use") - - // ErrLockConflict is returned if the flags on a key - // used for a lock do not match expectation - ErrLockConflict = fmt.Errorf("Existing key does not match lock use") -) - -// Lock is used to implement client-side leader election. It is follows the -// algorithm as described here: https://www.consul.io/docs/guides/leader-election.html. -type Lock struct { - c *Client - opts *LockOptions - - isHeld bool - sessionRenew chan struct{} - lockSession string - l sync.Mutex -} - -// LockOptions is used to parameterize the Lock behavior. -type LockOptions struct { - Key string // Must be set and have write permissions - Value []byte // Optional, value to associate with the lock - Session string // Optional, created if not specified - SessionOpts *SessionEntry // Optional, options to use when creating a session - SessionName string // Optional, defaults to DefaultLockSessionName (ignored if SessionOpts is given) - SessionTTL string // Optional, defaults to DefaultLockSessionTTL (ignored if SessionOpts is given) - MonitorRetries int // Optional, defaults to 0 which means no retries - MonitorRetryTime time.Duration // Optional, defaults to DefaultMonitorRetryTime - LockWaitTime time.Duration // Optional, defaults to DefaultLockWaitTime - LockTryOnce bool // Optional, defaults to false which means try forever - LockDelay time.Duration // Optional, defaults to 15s - Namespace string `json:",omitempty"` // Optional, defaults to API client config, namespace of ACL token, or "default" namespace -} - -// LockKey returns a handle to a lock struct which can be used -// to acquire and release the mutex. The key used must have -// write permissions. -func (c *Client) LockKey(key string) (*Lock, error) { - opts := &LockOptions{ - Key: key, - } - return c.LockOpts(opts) -} - -// LockOpts returns a handle to a lock struct which can be used -// to acquire and release the mutex. The key used must have -// write permissions. -func (c *Client) LockOpts(opts *LockOptions) (*Lock, error) { - if opts.Key == "" { - return nil, fmt.Errorf("missing key") - } - if opts.SessionName == "" { - opts.SessionName = DefaultLockSessionName - } - if opts.SessionTTL == "" { - opts.SessionTTL = DefaultLockSessionTTL - } else { - if _, err := time.ParseDuration(opts.SessionTTL); err != nil { - return nil, fmt.Errorf("invalid SessionTTL: %v", err) - } - } - if opts.MonitorRetryTime == 0 { - opts.MonitorRetryTime = DefaultMonitorRetryTime - } - if opts.LockWaitTime == 0 { - opts.LockWaitTime = DefaultLockWaitTime - } - l := &Lock{ - c: c, - opts: opts, - } - return l, nil -} - -// Lock attempts to acquire the lock and blocks while doing so. -// Providing a non-nil stopCh can be used to abort the lock attempt. -// Returns a channel that is closed if our lock is lost or an error. -// This channel could be closed at any time due to session invalidation, -// communication errors, operator intervention, etc. It is NOT safe to -// assume that the lock is held until Unlock() unless the Session is specifically -// created without any associated health checks. By default Consul sessions -// prefer liveness over safety and an application must be able to handle -// the lock being lost. -func (l *Lock) Lock(stopCh <-chan struct{}) (<-chan struct{}, error) { - // Hold the lock as we try to acquire - l.l.Lock() - defer l.l.Unlock() - - // Check if we already hold the lock - if l.isHeld { - return nil, ErrLockHeld - } - - wOpts := WriteOptions{ - Namespace: l.opts.Namespace, - } - - // Check if we need to create a session first - l.lockSession = l.opts.Session - if l.lockSession == "" { - s, err := l.createSession() - if err != nil { - return nil, fmt.Errorf("failed to create session: %v", err) - } - - l.sessionRenew = make(chan struct{}) - l.lockSession = s - - session := l.c.Session() - go session.RenewPeriodic(l.opts.SessionTTL, s, &wOpts, l.sessionRenew) - - // If we fail to acquire the lock, cleanup the session - defer func() { - if !l.isHeld { - close(l.sessionRenew) - l.sessionRenew = nil - } - }() - } - - // Setup the query options - kv := l.c.KV() - qOpts := QueryOptions{ - WaitTime: l.opts.LockWaitTime, - Namespace: l.opts.Namespace, - } - - start := time.Now() - attempts := 0 -WAIT: - // Check if we should quit - select { - case <-stopCh: - return nil, nil - default: - } - - // Handle the one-shot mode. - if l.opts.LockTryOnce && attempts > 0 { - elapsed := time.Since(start) - if elapsed > l.opts.LockWaitTime { - return nil, nil - } - - // Query wait time should not exceed the lock wait time - qOpts.WaitTime = l.opts.LockWaitTime - elapsed - } - attempts++ - - // Look for an existing lock, blocking until not taken - pair, meta, err := kv.Get(l.opts.Key, &qOpts) - if err != nil { - return nil, fmt.Errorf("failed to read lock: %v", err) - } - if pair != nil && pair.Flags != LockFlagValue { - return nil, ErrLockConflict - } - locked := false - if pair != nil && pair.Session == l.lockSession { - goto HELD - } - if pair != nil && pair.Session != "" { - qOpts.WaitIndex = meta.LastIndex - goto WAIT - } - - // Try to acquire the lock - pair = l.lockEntry(l.lockSession) - - locked, _, err = kv.Acquire(pair, &wOpts) - if err != nil { - return nil, fmt.Errorf("failed to acquire lock: %v", err) - } - - // Handle the case of not getting the lock - if !locked { - // Determine why the lock failed - qOpts.WaitIndex = 0 - pair, meta, err = kv.Get(l.opts.Key, &qOpts) - if err != nil { - return nil, err - } - if pair != nil && pair.Session != "" { - //If the session is not null, this means that a wait can safely happen - //using a long poll - qOpts.WaitIndex = meta.LastIndex - goto WAIT - } else { - // If the session is empty and the lock failed to acquire, then it means - // a lock-delay is in effect and a timed wait must be used - select { - case <-time.After(DefaultLockRetryTime): - goto WAIT - case <-stopCh: - return nil, nil - } - } - } - -HELD: - // Watch to ensure we maintain leadership - leaderCh := make(chan struct{}) - go l.monitorLock(l.lockSession, leaderCh) - - // Set that we own the lock - l.isHeld = true - - // Locked! All done - return leaderCh, nil -} - -// Unlock released the lock. It is an error to call this -// if the lock is not currently held. -func (l *Lock) Unlock() error { - // Hold the lock as we try to release - l.l.Lock() - defer l.l.Unlock() - - // Ensure the lock is actually held - if !l.isHeld { - return ErrLockNotHeld - } - - // Set that we no longer own the lock - l.isHeld = false - - // Stop the session renew - if l.sessionRenew != nil { - defer func() { - close(l.sessionRenew) - l.sessionRenew = nil - }() - } - - // Get the lock entry, and clear the lock session - lockEnt := l.lockEntry(l.lockSession) - l.lockSession = "" - - // Release the lock explicitly - kv := l.c.KV() - w := WriteOptions{Namespace: l.opts.Namespace} - - _, _, err := kv.Release(lockEnt, &w) - if err != nil { - return fmt.Errorf("failed to release lock: %v", err) - } - return nil -} - -// Destroy is used to cleanup the lock entry. It is not necessary -// to invoke. It will fail if the lock is in use. -func (l *Lock) Destroy() error { - // Hold the lock as we try to release - l.l.Lock() - defer l.l.Unlock() - - // Check if we already hold the lock - if l.isHeld { - return ErrLockHeld - } - - // Look for an existing lock - kv := l.c.KV() - q := QueryOptions{Namespace: l.opts.Namespace} - - pair, _, err := kv.Get(l.opts.Key, &q) - if err != nil { - return fmt.Errorf("failed to read lock: %v", err) - } - - // Nothing to do if the lock does not exist - if pair == nil { - return nil - } - - // Check for possible flag conflict - if pair.Flags != LockFlagValue { - return ErrLockConflict - } - - // Check if it is in use - if pair.Session != "" { - return ErrLockInUse - } - - // Attempt the delete - w := WriteOptions{Namespace: l.opts.Namespace} - didRemove, _, err := kv.DeleteCAS(pair, &w) - if err != nil { - return fmt.Errorf("failed to remove lock: %v", err) - } - if !didRemove { - return ErrLockInUse - } - return nil -} - -// createSession is used to create a new managed session -func (l *Lock) createSession() (string, error) { - session := l.c.Session() - se := l.opts.SessionOpts - if se == nil { - se = &SessionEntry{ - Name: l.opts.SessionName, - TTL: l.opts.SessionTTL, - LockDelay: l.opts.LockDelay, - } - } - w := WriteOptions{Namespace: l.opts.Namespace} - id, _, err := session.Create(se, &w) - if err != nil { - return "", err - } - return id, nil -} - -// lockEntry returns a formatted KVPair for the lock -func (l *Lock) lockEntry(session string) *KVPair { - return &KVPair{ - Key: l.opts.Key, - Value: l.opts.Value, - Session: session, - Flags: LockFlagValue, - } -} - -// monitorLock is a long running routine to monitor a lock ownership -// It closes the stopCh if we lose our leadership. -func (l *Lock) monitorLock(session string, stopCh chan struct{}) { - defer close(stopCh) - kv := l.c.KV() - opts := QueryOptions{ - RequireConsistent: true, - Namespace: l.opts.Namespace, - } -WAIT: - retries := l.opts.MonitorRetries -RETRY: - pair, meta, err := kv.Get(l.opts.Key, &opts) - if err != nil { - // If configured we can try to ride out a brief Consul unavailability - // by doing retries. Note that we have to attempt the retry in a non- - // blocking fashion so that we have a clean place to reset the retry - // counter if service is restored. - if retries > 0 && IsRetryableError(err) { - time.Sleep(l.opts.MonitorRetryTime) - retries-- - opts.WaitIndex = 0 - goto RETRY - } - return - } - if pair != nil && pair.Session == session { - opts.WaitIndex = meta.LastIndex - goto WAIT - } -} diff --git a/vendor/github.com/hashicorp/consul/api/namespace.go b/vendor/github.com/hashicorp/consul/api/namespace.go deleted file mode 100644 index 98afd2299..000000000 --- a/vendor/github.com/hashicorp/consul/api/namespace.go +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "encoding/json" - "fmt" - "time" -) - -// Namespace is the configuration of a single namespace. Namespacing is a Consul Enterprise feature. -type Namespace struct { - // Name is the name of the Namespace. It must be unique and - // must be a DNS hostname. There are also other reserved names - // that may not be used. - Name string `json:"Name"` - - // Description is where the user puts any information they want - // about the namespace. It is not used internally. - Description string `json:"Description,omitempty"` - - // ACLs is the configuration of ACLs for this namespace. It has its - // own struct so that we can add more to it in the future. - // This is nullable so that we can omit if empty when encoding in JSON - ACLs *NamespaceACLConfig `json:"ACLs,omitempty"` - - // Meta is a map that can be used to add kv metadata to the namespace definition - Meta map[string]string `json:"Meta,omitempty"` - - // DeletedAt is the time when the Namespace was marked for deletion - // This is nullable so that we can omit if empty when encoding in JSON - DeletedAt *time.Time `json:"DeletedAt,omitempty" alias:"deleted_at"` - - // Partition which contains the Namespace. - Partition string `json:"Partition,omitempty"` - - // CreateIndex is the Raft index at which the Namespace was created - CreateIndex uint64 `json:"CreateIndex,omitempty"` - - // ModifyIndex is the latest Raft index at which the Namespace was modified. - ModifyIndex uint64 `json:"ModifyIndex,omitempty"` -} - -func (n *Namespace) UnmarshalJSON(data []byte) error { - type Alias Namespace - aux := struct { - DeletedAtSnake *time.Time `json:"deleted_at"` - *Alias - }{ - Alias: (*Alias)(n), - } - if err := json.Unmarshal(data, &aux); err != nil { - return err - } - - if n.DeletedAt == nil && aux.DeletedAtSnake != nil { - n.DeletedAt = aux.DeletedAtSnake - } - - return nil -} - -// NamespaceACLConfig is the Namespace specific ACL configuration container -type NamespaceACLConfig struct { - // PolicyDefaults is the list of policies that should be used for the parent authorizer - // of all tokens in the associated namespace. - PolicyDefaults []ACLLink `json:"PolicyDefaults" alias:"policy_defaults"` - // RoleDefaults is the list of roles that should be used for the parent authorizer - // of all tokens in the associated namespace. - RoleDefaults []ACLLink `json:"RoleDefaults" alias:"role_defaults"` -} - -func (n *NamespaceACLConfig) UnmarshalJSON(data []byte) error { - type Alias NamespaceACLConfig - aux := struct { - PolicyDefaultsSnake []ACLLink `json:"policy_defaults"` - RoleDefaultsSnake []ACLLink `json:"role_defaults"` - *Alias - }{ - Alias: (*Alias)(n), - } - if err := json.Unmarshal(data, &aux); err != nil { - return err - } - - if n.PolicyDefaults == nil { - for _, pd := range aux.PolicyDefaultsSnake { - n.PolicyDefaults = append(n.PolicyDefaults, pd) - } - } - if n.RoleDefaults == nil { - for _, pd := range aux.RoleDefaultsSnake { - n.RoleDefaults = append(n.RoleDefaults, pd) - } - } - return nil -} - -// Namespaces can be used to manage Namespaces in Consul Enterprise.. -type Namespaces struct { - c *Client -} - -// Namespaces returns a handle to the namespaces endpoints. -func (c *Client) Namespaces() *Namespaces { - return &Namespaces{c} -} - -func (n *Namespaces) Create(ns *Namespace, q *WriteOptions) (*Namespace, *WriteMeta, error) { - if ns.Name == "" { - return nil, nil, fmt.Errorf("Must specify a Name for Namespace creation") - } - - r := n.c.newRequest("PUT", "/v1/namespace") - r.setWriteOptions(q) - r.obj = ns - rtt, resp, err := n.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - wm := &WriteMeta{RequestTime: rtt} - var out Namespace - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, wm, nil -} - -func (n *Namespaces) Update(ns *Namespace, q *WriteOptions) (*Namespace, *WriteMeta, error) { - if ns.Name == "" { - return nil, nil, fmt.Errorf("Must specify a Name for Namespace updating") - } - - r := n.c.newRequest("PUT", "/v1/namespace/"+ns.Name) - r.setWriteOptions(q) - r.obj = ns - rtt, resp, err := n.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - wm := &WriteMeta{RequestTime: rtt} - var out Namespace - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, wm, nil -} - -func (n *Namespaces) Read(name string, q *QueryOptions) (*Namespace, *QueryMeta, error) { - var out Namespace - r := n.c.newRequest("GET", "/v1/namespace/"+name) - r.setQueryOptions(q) - rtt, resp, err := n.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - found, resp, err := requireNotFoundOrOK(resp) - if err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - if !found { - return nil, qm, nil - } - - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return &out, qm, nil -} - -func (n *Namespaces) Delete(name string, q *WriteOptions) (*WriteMeta, error) { - r := n.c.newRequest("DELETE", "/v1/namespace/"+name) - r.setWriteOptions(q) - rtt, resp, err := n.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - wm := &WriteMeta{RequestTime: rtt} - return wm, nil -} - -func (n *Namespaces) List(q *QueryOptions) ([]*Namespace, *QueryMeta, error) { - var out []*Namespace - r := n.c.newRequest("GET", "/v1/namespaces") - r.setQueryOptions(q) - rtt, resp, err := n.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return out, qm, nil -} diff --git a/vendor/github.com/hashicorp/consul/api/operator.go b/vendor/github.com/hashicorp/consul/api/operator.go deleted file mode 100644 index 667dcd872..000000000 --- a/vendor/github.com/hashicorp/consul/api/operator.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -// Operator can be used to perform low-level operator tasks for Consul. -type Operator struct { - c *Client -} - -// Operator returns a handle to the operator endpoints. -func (c *Client) Operator() *Operator { - return &Operator{c} -} diff --git a/vendor/github.com/hashicorp/consul/api/operator_area.go b/vendor/github.com/hashicorp/consul/api/operator_area.go deleted file mode 100644 index 9228d89b4..000000000 --- a/vendor/github.com/hashicorp/consul/api/operator_area.go +++ /dev/null @@ -1,209 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -// The /v1/operator/area endpoints are available only in Consul Enterprise and -// interact with its network area subsystem. Network areas are used to link -// together Consul servers in different Consul datacenters. With network areas, -// Consul datacenters can be linked together in ways other than a fully-connected -// mesh, as is required for Consul's WAN. - -import ( - "net" - "time" -) - -// Area defines a network area. -type Area struct { - // ID is this identifier for an area (a UUID). This must be left empty - // when creating a new area. - ID string - - // PeerDatacenter is the peer Consul datacenter that will make up the - // other side of this network area. Network areas always involve a pair - // of datacenters: the datacenter where the area was created, and the - // peer datacenter. This is required. - PeerDatacenter string - - // RetryJoin specifies the address of Consul servers to join to, such as - // an IPs or hostnames with an optional port number. This is optional. - RetryJoin []string - - // UseTLS specifies whether gossip over this area should be encrypted with TLS - // if possible. - UseTLS bool -} - -// AreaJoinResponse is returned when a join occurs and gives the result for each -// address. -type AreaJoinResponse struct { - // The address that was joined. - Address string - - // Whether or not the join was a success. - Joined bool - - // If we couldn't join, this is the message with information. - Error string -} - -// SerfMember is a generic structure for reporting information about members in -// a Serf cluster. This is only used by the area endpoints right now, but this -// could be expanded to other endpoints in the future. -type SerfMember struct { - // ID is the node identifier (a UUID). - ID string - - // Name is the node name. - Name string - - // Addr has the IP address. - Addr net.IP - - // Port is the RPC port. - Port uint16 - - // Datacenter is the DC name. - Datacenter string - - // Role is "client", "server", or "unknown". - Role string - - // Build has the version of the Consul agent. - Build string - - // Protocol is the protocol of the Consul agent. - Protocol int - - // Status is the Serf health status "none", "alive", "leaving", "left", - // or "failed". - Status string - - // RTT is the estimated round trip time from the server handling the - // request to the this member. This will be negative if no RTT estimate - // is available. - RTT time.Duration -} - -// AreaCreate will create a new network area. The ID in the given structure must -// be empty and a generated ID will be returned on success. -func (op *Operator) AreaCreate(area *Area, q *WriteOptions) (string, *WriteMeta, error) { - r := op.c.newRequest("POST", "/v1/operator/area") - r.setWriteOptions(q) - r.obj = area - rtt, resp, err := op.c.doRequest(r) - if err != nil { - return "", nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return "", nil, err - } - - wm := &WriteMeta{} - wm.RequestTime = rtt - - var out struct{ ID string } - if err := decodeBody(resp, &out); err != nil { - return "", nil, err - } - return out.ID, wm, nil -} - -// AreaUpdate will update the configuration of the network area with the given ID. -func (op *Operator) AreaUpdate(areaID string, area *Area, q *WriteOptions) (string, *WriteMeta, error) { - r := op.c.newRequest("PUT", "/v1/operator/area/"+areaID) - r.setWriteOptions(q) - r.obj = area - rtt, resp, err := op.c.doRequest(r) - if err != nil { - return "", nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return "", nil, err - } - - wm := &WriteMeta{} - wm.RequestTime = rtt - - var out struct{ ID string } - if err := decodeBody(resp, &out); err != nil { - return "", nil, err - } - return out.ID, wm, nil -} - -// AreaGet returns a single network area. -func (op *Operator) AreaGet(areaID string, q *QueryOptions) ([]*Area, *QueryMeta, error) { - var out []*Area - qm, err := op.c.query("/v1/operator/area/"+areaID, &out, q) - if err != nil { - return nil, nil, err - } - return out, qm, nil -} - -// AreaList returns all the available network areas. -func (op *Operator) AreaList(q *QueryOptions) ([]*Area, *QueryMeta, error) { - var out []*Area - qm, err := op.c.query("/v1/operator/area", &out, q) - if err != nil { - return nil, nil, err - } - return out, qm, nil -} - -// AreaDelete deletes the given network area. -func (op *Operator) AreaDelete(areaID string, q *WriteOptions) (*WriteMeta, error) { - r := op.c.newRequest("DELETE", "/v1/operator/area/"+areaID) - r.setWriteOptions(q) - rtt, resp, err := op.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - wm := &WriteMeta{} - wm.RequestTime = rtt - return wm, nil -} - -// AreaJoin attempts to join the given set of join addresses to the given -// network area. See the Area structure for details about join addresses. -func (op *Operator) AreaJoin(areaID string, addresses []string, q *WriteOptions) ([]*AreaJoinResponse, *WriteMeta, error) { - r := op.c.newRequest("PUT", "/v1/operator/area/"+areaID+"/join") - r.setWriteOptions(q) - r.obj = addresses - rtt, resp, err := op.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - wm := &WriteMeta{} - wm.RequestTime = rtt - - var out []*AreaJoinResponse - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return out, wm, nil -} - -// AreaMembers lists the Serf information about the members in the given area. -func (op *Operator) AreaMembers(areaID string, q *QueryOptions) ([]*SerfMember, *QueryMeta, error) { - var out []*SerfMember - qm, err := op.c.query("/v1/operator/area/"+areaID+"/members", &out, q) - if err != nil { - return nil, nil, err - } - return out, qm, nil -} diff --git a/vendor/github.com/hashicorp/consul/api/operator_audit.go b/vendor/github.com/hashicorp/consul/api/operator_audit.go deleted file mode 100644 index 5240d38a7..000000000 --- a/vendor/github.com/hashicorp/consul/api/operator_audit.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -// The /v1/operator/audit-hash endpoint is available only in Consul Enterprise and -// interact with its audit logging subsystem. - -package api - -type AuditHashRequest struct { - Input string -} - -type AuditHashResponse struct { - Hash string -} - -func (op *Operator) AuditHash(a *AuditHashRequest, q *QueryOptions) (*AuditHashResponse, error) { - r := op.c.newRequest("POST", "/v1/operator/audit-hash") - r.setQueryOptions(q) - r.obj = a - - rtt, resp, err := op.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - wm := &WriteMeta{} - wm.RequestTime = rtt - - var out AuditHashResponse - if err := decodeBody(resp, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/vendor/github.com/hashicorp/consul/api/operator_autopilot.go b/vendor/github.com/hashicorp/consul/api/operator_autopilot.go deleted file mode 100644 index 7628bf6f2..000000000 --- a/vendor/github.com/hashicorp/consul/api/operator_autopilot.go +++ /dev/null @@ -1,404 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "bytes" - "fmt" - "io" - "strconv" - "strings" - "time" -) - -// AutopilotConfiguration is used for querying/setting the Autopilot configuration. -// Autopilot helps manage operator tasks related to Consul servers like removing -// failed servers from the Raft quorum. -type AutopilotConfiguration struct { - // CleanupDeadServers controls whether to remove dead servers from the Raft - // peer list when a new server joins - CleanupDeadServers bool - - // LastContactThreshold is the limit on the amount of time a server can go - // without leader contact before being considered unhealthy. - LastContactThreshold *ReadableDuration - - // MaxTrailingLogs is the amount of entries in the Raft Log that a server can - // be behind before being considered unhealthy. - MaxTrailingLogs uint64 - - // MinQuorum sets the minimum number of servers allowed in a cluster before - // autopilot can prune dead servers. - MinQuorum uint - - // ServerStabilizationTime is the minimum amount of time a server must be - // in a stable, healthy state before it can be added to the cluster. Only - // applicable with Raft protocol version 3 or higher. - ServerStabilizationTime *ReadableDuration - - // (Enterprise-only) RedundancyZoneTag is the node tag to use for separating - // servers into zones for redundancy. If left blank, this feature will be disabled. - RedundancyZoneTag string - - // (Enterprise-only) DisableUpgradeMigration will disable Autopilot's upgrade migration - // strategy of waiting until enough newer-versioned servers have been added to the - // cluster before promoting them to voters. - DisableUpgradeMigration bool - - // (Enterprise-only) UpgradeVersionTag is the node tag to use for version info when - // performing upgrade migrations. If left blank, the Consul version will be used. - UpgradeVersionTag string - - // CreateIndex holds the index corresponding the creation of this configuration. - // This is a read-only field. - CreateIndex uint64 - - // ModifyIndex will be set to the index of the last update when retrieving the - // Autopilot configuration. Resubmitting a configuration with - // AutopilotCASConfiguration will perform a check-and-set operation which ensures - // there hasn't been a subsequent update since the configuration was retrieved. - ModifyIndex uint64 -} - -// Defines default values for the AutopilotConfiguration type, consistent with -// https://www.consul.io/api-docs/operator/autopilot#parameters-1 -func NewAutopilotConfiguration() AutopilotConfiguration { - cfg := AutopilotConfiguration{ - CleanupDeadServers: true, - LastContactThreshold: NewReadableDuration(200 * time.Millisecond), - MaxTrailingLogs: 250, - MinQuorum: 0, - ServerStabilizationTime: NewReadableDuration(10 * time.Second), - RedundancyZoneTag: "", - DisableUpgradeMigration: false, - UpgradeVersionTag: "", - } - - return cfg -} - -// ServerHealth is the health (from the leader's point of view) of a server. -type ServerHealth struct { - // ID is the raft ID of the server. - ID string - - // Name is the node name of the server. - Name string - - // Address is the address of the server. - Address string - - // The status of the SerfHealth check for the server. - SerfStatus string - - // Version is the Consul version of the server. - Version string - - // Leader is whether this server is currently the leader. - Leader bool - - // LastContact is the time since this node's last contact with the leader. - LastContact *ReadableDuration - - // LastTerm is the highest leader term this server has a record of in its Raft log. - LastTerm uint64 - - // LastIndex is the last log index this server has a record of in its Raft log. - LastIndex uint64 - - // Healthy is whether or not the server is healthy according to the current - // Autopilot config. - Healthy bool - - // Voter is whether this is a voting server. - Voter bool - - // StableSince is the last time this server's Healthy value changed. - StableSince time.Time -} - -// OperatorHealthReply is a representation of the overall health of the cluster -type OperatorHealthReply struct { - // Healthy is true if all the servers in the cluster are healthy. - Healthy bool - - // FailureTolerance is the number of healthy servers that could be lost without - // an outage occurring. - FailureTolerance int - - // Servers holds the health of each server. - Servers []ServerHealth -} - -type AutopilotState struct { - Healthy bool - FailureTolerance int - OptimisticFailureTolerance int - - Servers map[string]AutopilotServer - Leader string - Voters []string - ReadReplicas []string `json:",omitempty"` - RedundancyZones map[string]AutopilotZone `json:",omitempty"` - Upgrade *AutopilotUpgrade `json:",omitempty"` -} - -type AutopilotServer struct { - ID string - Name string - Address string - NodeStatus string - Version string - LastContact *ReadableDuration - LastTerm uint64 - LastIndex uint64 - Healthy bool - StableSince time.Time - RedundancyZone string `json:",omitempty"` - UpgradeVersion string `json:",omitempty"` - ReadReplica bool - Status AutopilotServerStatus - Meta map[string]string - NodeType AutopilotServerType -} - -type AutopilotServerStatus string - -const ( - AutopilotServerNone AutopilotServerStatus = "none" - AutopilotServerLeader AutopilotServerStatus = "leader" - AutopilotServerVoter AutopilotServerStatus = "voter" - AutopilotServerNonVoter AutopilotServerStatus = "non-voter" - AutopilotServerStaging AutopilotServerStatus = "staging" -) - -type AutopilotServerType string - -const ( - AutopilotTypeVoter AutopilotServerType = "voter" - AutopilotTypeReadReplica AutopilotServerType = "read-replica" - AutopilotTypeZoneVoter AutopilotServerType = "zone-voter" - AutopilotTypeZoneExtraVoter AutopilotServerType = "zone-extra-voter" - AutopilotTypeZoneStandby AutopilotServerType = "zone-standby" -) - -type AutopilotZone struct { - Servers []string - Voters []string - FailureTolerance int -} - -type AutopilotZoneUpgradeVersions struct { - TargetVersionVoters []string `json:",omitempty"` - TargetVersionNonVoters []string `json:",omitempty"` - OtherVersionVoters []string `json:",omitempty"` - OtherVersionNonVoters []string `json:",omitempty"` -} - -type AutopilotUpgrade struct { - Status AutopilotUpgradeStatus - TargetVersion string `json:",omitempty"` - TargetVersionVoters []string `json:",omitempty"` - TargetVersionNonVoters []string `json:",omitempty"` - TargetVersionReadReplicas []string `json:",omitempty"` - OtherVersionVoters []string `json:",omitempty"` - OtherVersionNonVoters []string `json:",omitempty"` - OtherVersionReadReplicas []string `json:",omitempty"` - RedundancyZones map[string]AutopilotZoneUpgradeVersions `json:",omitempty"` -} - -type AutopilotUpgradeStatus string - -const ( - // AutopilotUpgradeIdle is the status when no upgrade is in progress. - AutopilotUpgradeIdle AutopilotUpgradeStatus = "idle" - - // AutopilotUpgradeAwaitNewVoters is the status when more servers of - // the target version must be added in order to start the promotion - // phase of the upgrade - AutopilotUpgradeAwaitNewVoters AutopilotUpgradeStatus = "await-new-voters" - - // AutopilotUpgradePromoting is the status when autopilot is promoting - // servers of the target version. - AutopilotUpgradePromoting AutopilotUpgradeStatus = "promoting" - - // AutopilotUpgradeDemoting is the status when autopilot is demoting - // servers not on the target version - AutopilotUpgradeDemoting AutopilotUpgradeStatus = "demoting" - - // AutopilotUpgradeLeaderTransfer is the status when autopilot is transferring - // leadership from a server running an older version to a server - // using the target version. - AutopilotUpgradeLeaderTransfer AutopilotUpgradeStatus = "leader-transfer" - - // AutopilotUpgradeAwaitNewServers is the status when autpilot has finished - // transferring leadership and has demoted all the other versioned - // servers but wants to indicate that more target version servers - // are needed to replace all the existing other version servers. - AutopilotUpgradeAwaitNewServers AutopilotUpgradeStatus = "await-new-servers" - - // AutopilotUpgradeAwaitServerRemoval is the status when autopilot is waiting - // for the servers on non-target versions to be removed - AutopilotUpgradeAwaitServerRemoval AutopilotUpgradeStatus = "await-server-removal" - - // AutopilotUpgradeDisabled is the status when automated ugprades are - // disabled in the autopilot configuration - AutopilotUpgradeDisabled AutopilotUpgradeStatus = "disabled" -) - -// ReadableDuration is a duration type that is serialized to JSON in human readable format. -type ReadableDuration time.Duration - -func NewReadableDuration(dur time.Duration) *ReadableDuration { - d := ReadableDuration(dur) - return &d -} - -func (d *ReadableDuration) String() string { - return d.Duration().String() -} - -func (d *ReadableDuration) Duration() time.Duration { - if d == nil { - return time.Duration(0) - } - return time.Duration(*d) -} - -func (d *ReadableDuration) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf(`"%s"`, d.Duration().String())), nil -} - -func (d *ReadableDuration) UnmarshalJSON(raw []byte) (err error) { - if d == nil { - return fmt.Errorf("cannot unmarshal to nil pointer") - } - - var dur time.Duration - str := string(raw) - if len(str) >= 2 && str[0] == '"' && str[len(str)-1] == '"' { - // quoted string - dur, err = time.ParseDuration(str[1 : len(str)-1]) - if err != nil { - return err - } - } else { - // no quotes, not a string - v, err := strconv.ParseFloat(str, 64) - if err != nil { - return err - } - dur = time.Duration(v) - } - - *d = ReadableDuration(dur) - return nil -} - -// AutopilotGetConfiguration is used to query the current Autopilot configuration. -func (op *Operator) AutopilotGetConfiguration(q *QueryOptions) (*AutopilotConfiguration, error) { - r := op.c.newRequest("GET", "/v1/operator/autopilot/configuration") - r.setQueryOptions(q) - _, resp, err := op.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - var out AutopilotConfiguration - if err := decodeBody(resp, &out); err != nil { - return nil, err - } - - return &out, nil -} - -// AutopilotSetConfiguration is used to set the current Autopilot configuration. -func (op *Operator) AutopilotSetConfiguration(conf *AutopilotConfiguration, q *WriteOptions) error { - r := op.c.newRequest("PUT", "/v1/operator/autopilot/configuration") - r.setWriteOptions(q) - r.obj = conf - _, resp, err := op.c.doRequest(r) - if err != nil { - return err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return err - } - return nil -} - -// AutopilotCASConfiguration is used to perform a Check-And-Set update on the -// Autopilot configuration. The ModifyIndex value will be respected. Returns -// true on success or false on failures. -func (op *Operator) AutopilotCASConfiguration(conf *AutopilotConfiguration, q *WriteOptions) (bool, error) { - r := op.c.newRequest("PUT", "/v1/operator/autopilot/configuration") - r.setWriteOptions(q) - r.params.Set("cas", strconv.FormatUint(conf.ModifyIndex, 10)) - r.obj = conf - _, resp, err := op.c.doRequest(r) - if err != nil { - return false, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return false, err - } - - var buf bytes.Buffer - if _, err := io.Copy(&buf, resp.Body); err != nil { - return false, fmt.Errorf("Failed to read response: %v", err) - } - res := strings.Contains(buf.String(), "true") - - return res, nil -} - -// AutopilotServerHealth -func (op *Operator) AutopilotServerHealth(q *QueryOptions) (*OperatorHealthReply, error) { - r := op.c.newRequest("GET", "/v1/operator/autopilot/health") - r.setQueryOptions(q) - - // we use 429 status to indicate unhealthiness - _, resp, err := op.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - err = requireHttpCodes(resp, 200, 429) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - - var out OperatorHealthReply - if err := decodeBody(resp, &out); err != nil { - return nil, err - } - return &out, nil -} - -func (op *Operator) AutopilotState(q *QueryOptions) (*AutopilotState, error) { - r := op.c.newRequest("GET", "/v1/operator/autopilot/state") - r.setQueryOptions(q) - _, resp, err := op.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - var out AutopilotState - if err := decodeBody(resp, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/vendor/github.com/hashicorp/consul/api/operator_keyring.go b/vendor/github.com/hashicorp/consul/api/operator_keyring.go deleted file mode 100644 index aefec9e27..000000000 --- a/vendor/github.com/hashicorp/consul/api/operator_keyring.go +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -// keyringRequest is used for performing Keyring operations -type keyringRequest struct { - Key string -} - -// KeyringResponse is returned when listing the gossip encryption keys -type KeyringResponse struct { - // Whether this response is for a WAN ring - WAN bool - - // The datacenter name this request corresponds to - Datacenter string - - // Segment has the network segment this request corresponds to. - Segment string - - // Partition has the admin partition this request corresponds to. - Partition string `json:",omitempty"` - - // Messages has information or errors from serf - Messages map[string]string `json:",omitempty"` - - // A map of the encryption keys to the number of nodes they're installed on - Keys map[string]int - - // A map of the encryption primary keys to the number of nodes they're installed on - PrimaryKeys map[string]int - - // The total number of nodes in this ring - NumNodes int -} - -// KeyringInstall is used to install a new gossip encryption key into the cluster -func (op *Operator) KeyringInstall(key string, q *WriteOptions) error { - r := op.c.newRequest("POST", "/v1/operator/keyring") - r.setWriteOptions(q) - r.obj = keyringRequest{ - Key: key, - } - _, resp, err := op.c.doRequest(r) - if err != nil { - return err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return err - } - return nil -} - -// KeyringList is used to list the gossip keys installed in the cluster -func (op *Operator) KeyringList(q *QueryOptions) ([]*KeyringResponse, error) { - r := op.c.newRequest("GET", "/v1/operator/keyring") - r.setQueryOptions(q) - _, resp, err := op.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - var out []*KeyringResponse - if err := decodeBody(resp, &out); err != nil { - return nil, err - } - return out, nil -} - -// KeyringRemove is used to remove a gossip encryption key from the cluster -func (op *Operator) KeyringRemove(key string, q *WriteOptions) error { - r := op.c.newRequest("DELETE", "/v1/operator/keyring") - r.setWriteOptions(q) - r.obj = keyringRequest{ - Key: key, - } - _, resp, err := op.c.doRequest(r) - if err != nil { - return err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return err - } - return nil -} - -// KeyringUse is used to change the active gossip encryption key -func (op *Operator) KeyringUse(key string, q *WriteOptions) error { - r := op.c.newRequest("PUT", "/v1/operator/keyring") - r.setWriteOptions(q) - r.obj = keyringRequest{ - Key: key, - } - _, resp, err := op.c.doRequest(r) - if err != nil { - return err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return err - } - return nil -} diff --git a/vendor/github.com/hashicorp/consul/api/operator_license.go b/vendor/github.com/hashicorp/consul/api/operator_license.go deleted file mode 100644 index 1e3496da0..000000000 --- a/vendor/github.com/hashicorp/consul/api/operator_license.go +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "io" - "strings" - "time" -) - -type License struct { - // The unique identifier of the license - LicenseID string `json:"license_id"` - - // The customer ID associated with the license - CustomerID string `json:"customer_id"` - - // If set, an identifier that should be used to lock the license to a - // particular site, cluster, etc. - InstallationID string `json:"installation_id"` - - // The time at which the license was issued - IssueTime time.Time `json:"issue_time"` - - // The time at which the license starts being valid - StartTime time.Time `json:"start_time"` - - // The time after which the license expires - ExpirationTime time.Time `json:"expiration_time"` - - // The time at which the license ceases to function and can - // no longer be used in any capacity - TerminationTime time.Time `json:"termination_time"` - - // Whether the license will ignore termination - IgnoreTermination bool `json:"ignore_termination"` - - // The product the license is valid for - Product string `json:"product"` - - // License Specific Flags - Flags map[string]interface{} `json:"flags"` - - // Modules is a list of the licensed enterprise modules - Modules []string `json:"modules"` - - // List of features enabled by the license - Features []string `json:"features"` -} - -type LicenseReply struct { - Valid bool - License *License - Warnings []string -} - -func (op *Operator) LicenseGet(q *QueryOptions) (*LicenseReply, error) { - var reply LicenseReply - if _, err := op.c.query("/v1/operator/license", &reply, q); err != nil { - return nil, err - } else { - return &reply, nil - } -} - -func (op *Operator) LicenseGetSigned(q *QueryOptions) (string, error) { - r := op.c.newRequest("GET", "/v1/operator/license") - r.params.Set("signed", "1") - r.setQueryOptions(q) - _, resp, err := op.c.doRequest(r) - if err != nil { - return "", err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return "", err - } - - data, err := io.ReadAll(resp.Body) - if err != nil { - return "", err - } - - return string(data), nil -} - -// LicenseReset will reset the license to the builtin one if it is still valid. -// If the builtin license is invalid, the current license stays active. -// -// DEPRECATED: Consul 1.10 removes the corresponding HTTP endpoint as licenses -// are now set via agent configuration instead of through the API -func (op *Operator) LicenseReset(opts *WriteOptions) (*LicenseReply, error) { - var reply LicenseReply - r := op.c.newRequest("DELETE", "/v1/operator/license") - r.setWriteOptions(opts) - _, resp, err := op.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - if err := decodeBody(resp, &reply); err != nil { - return nil, err - } - return &reply, nil -} - -// LicensePut will configure the Consul Enterprise license for the target datacenter -// -// DEPRECATED: Consul 1.10 removes the corresponding HTTP endpoint as licenses -// are now set via agent configuration instead of through the API -func (op *Operator) LicensePut(license string, opts *WriteOptions) (*LicenseReply, error) { - var reply LicenseReply - r := op.c.newRequest("PUT", "/v1/operator/license") - r.setWriteOptions(opts) - r.body = strings.NewReader(license) - _, resp, err := op.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - if err := decodeBody(resp, &reply); err != nil { - return nil, err - } - - return &reply, nil -} diff --git a/vendor/github.com/hashicorp/consul/api/operator_raft.go b/vendor/github.com/hashicorp/consul/api/operator_raft.go deleted file mode 100644 index f0f5794aa..000000000 --- a/vendor/github.com/hashicorp/consul/api/operator_raft.go +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -// RaftServer has information about a server in the Raft configuration. -type RaftServer struct { - // ID is the unique ID for the server. These are currently the same - // as the address, but they will be changed to a real GUID in a future - // release of Consul. - ID string - - // Node is the node name of the server, as known by Consul, or this - // will be set to "(unknown)" otherwise. - Node string - - // Address is the IP:port of the server, used for Raft communications. - Address string - - // Leader is true if this server is the current cluster leader. - Leader bool - - // Protocol version is the raft protocol version used by the server - ProtocolVersion string - - // Voter is true if this server has a vote in the cluster. This might - // be false if the server is staging and still coming online, or if - // it's a non-voting server, which will be added in a future release of - // Consul. - Voter bool - - // LastIndex is the last log index this server has a record of in its Raft log. - LastIndex uint64 -} - -// RaftConfiguration is returned when querying for the current Raft configuration. -type RaftConfiguration struct { - // Servers has the list of servers in the Raft configuration. - Servers []*RaftServer - - // Index has the Raft index of this configuration. - Index uint64 -} - -// TransferLeaderResponse is returned when querying for the current Raft configuration. -type TransferLeaderResponse struct { - Success bool -} - -// RaftGetConfiguration is used to query the current Raft peer set. -func (op *Operator) RaftGetConfiguration(q *QueryOptions) (*RaftConfiguration, error) { - r := op.c.newRequest("GET", "/v1/operator/raft/configuration") - r.setQueryOptions(q) - _, resp, err := op.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - var out RaftConfiguration - if err := decodeBody(resp, &out); err != nil { - return nil, err - } - return &out, nil -} - -// RaftLeaderTransfer is used to transfer the current raft leader to another node -// Optionally accepts a non-empty id of another node to transfer leadership to. -func (op *Operator) RaftLeaderTransfer(id string, q *QueryOptions) (*TransferLeaderResponse, error) { - r := op.c.newRequest("POST", "/v1/operator/raft/transfer-leader") - r.setQueryOptions(q) - - if id != "" { - r.params.Set("id", id) - } - _, resp, err := op.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - var out TransferLeaderResponse - if err := decodeBody(resp, &out); err != nil { - return nil, err - } - return &out, nil -} - -// RaftRemovePeerByAddress is used to kick a stale peer (one that it in the Raft -// quorum but no longer known to Serf or the catalog) by address in the form of -// "IP:port". -func (op *Operator) RaftRemovePeerByAddress(address string, q *WriteOptions) error { - r := op.c.newRequest("DELETE", "/v1/operator/raft/peer") - r.setWriteOptions(q) - - r.params.Set("address", address) - - _, resp, err := op.c.doRequest(r) - if err != nil { - return err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return err - } - return nil -} - -// RaftRemovePeerByID is used to kick a stale peer (one that it in the Raft -// quorum but no longer known to Serf or the catalog) by ID. -func (op *Operator) RaftRemovePeerByID(id string, q *WriteOptions) error { - r := op.c.newRequest("DELETE", "/v1/operator/raft/peer") - r.setWriteOptions(q) - - r.params.Set("id", id) - - _, resp, err := op.c.doRequest(r) - if err != nil { - return err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return err - } - return nil -} diff --git a/vendor/github.com/hashicorp/consul/api/operator_segment.go b/vendor/github.com/hashicorp/consul/api/operator_segment.go deleted file mode 100644 index 6115a7ab4..000000000 --- a/vendor/github.com/hashicorp/consul/api/operator_segment.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -// SegmentList returns all the available LAN segments. -func (op *Operator) SegmentList(q *QueryOptions) ([]string, *QueryMeta, error) { - var out []string - qm, err := op.c.query("/v1/operator/segment", &out, q) - if err != nil { - return nil, nil, err - } - return out, qm, nil -} diff --git a/vendor/github.com/hashicorp/consul/api/operator_usage.go b/vendor/github.com/hashicorp/consul/api/operator_usage.go deleted file mode 100644 index 8977449dd..000000000 --- a/vendor/github.com/hashicorp/consul/api/operator_usage.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -type Usage struct { - // Usage is a map of datacenter -> usage information - Usage map[string]ServiceUsage -} - -// ServiceUsage contains information about the number of services and service instances for a datacenter. -type ServiceUsage struct { - Nodes int - Services int - ServiceInstances int - ConnectServiceInstances map[string]int - - // Billable services are of "typical" service kind (i.e. non-connect or connect-native), - // excluding the "consul" service. - BillableServiceInstances int - - // A map of partition+namespace to number of unique services registered in that namespace - PartitionNamespaceServices map[string]map[string]int - - // A map of partition+namespace to number of service instances registered in that namespace - PartitionNamespaceServiceInstances map[string]map[string]int - - // A map of partition+namespace+kind to number of service-mesh instances registered in that namespace - PartitionNamespaceConnectServiceInstances map[string]map[string]map[string]int - - // A map of partition+namespace to number of billable instances registered in that namespace - PartitionNamespaceBillableServiceInstances map[string]map[string]int -} - -// Usage is used to query for usage information in the given datacenter. -func (op *Operator) Usage(q *QueryOptions) (*Usage, *QueryMeta, error) { - r := op.c.newRequest("GET", "/v1/operator/usage") - r.setQueryOptions(q) - rtt, resp, err := op.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out *Usage - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return out, qm, nil -} diff --git a/vendor/github.com/hashicorp/consul/api/partition.go b/vendor/github.com/hashicorp/consul/api/partition.go deleted file mode 100644 index 8467c3118..000000000 --- a/vendor/github.com/hashicorp/consul/api/partition.go +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "context" - "fmt" - "time" -) - -// Partition is the configuration of a single admin partition. Admin Partitions are a Consul Enterprise feature. -type Partition struct { - // Name is the name of the Partition. - Name string `json:"Name"` - - // Description is where the user puts any information they want - // about the admin partition. It is not used internally. - Description string `json:"Description,omitempty"` - - // DeletedAt is the time when the Partition was marked for deletion - // This is nullable so that we can omit if empty when encoding in JSON - DeletedAt *time.Time `json:"DeletedAt,omitempty" alias:"deleted_at"` - - // CreateIndex is the Raft index at which the Partition was created - CreateIndex uint64 `json:"CreateIndex,omitempty"` - - // ModifyIndex is the latest Raft index at which the Partition was modified. - ModifyIndex uint64 `json:"ModifyIndex,omitempty"` -} - -// PartitionDefaultName is the default partition value. -const PartitionDefaultName = "default" - -// Partitions can be used to manage Partitions in Consul Enterprise. -type Partitions struct { - c *Client -} - -// Operator returns a handle to the operator endpoints. -func (c *Client) Partitions() *Partitions { - return &Partitions{c} -} - -func (p *Partitions) Create(ctx context.Context, partition *Partition, q *WriteOptions) (*Partition, *WriteMeta, error) { - if partition.Name == "" { - return nil, nil, fmt.Errorf("Must specify a Name for Partition creation") - } - - r := p.c.newRequest("PUT", "/v1/partition") - r.setWriteOptions(q) - r.ctx = ctx - r.obj = partition - rtt, resp, err := p.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - wm := &WriteMeta{RequestTime: rtt} - var out Partition - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, wm, nil -} - -func (p *Partitions) Update(ctx context.Context, partition *Partition, q *WriteOptions) (*Partition, *WriteMeta, error) { - if partition.Name == "" { - return nil, nil, fmt.Errorf("Must specify a Name for Partition updating") - } - - r := p.c.newRequest("PUT", "/v1/partition/"+partition.Name) - r.setWriteOptions(q) - r.ctx = ctx - r.obj = partition - rtt, resp, err := p.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - wm := &WriteMeta{RequestTime: rtt} - var out Partition - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, wm, nil -} - -func (p *Partitions) Read(ctx context.Context, name string, q *QueryOptions) (*Partition, *QueryMeta, error) { - var out Partition - r := p.c.newRequest("GET", "/v1/partition/"+name) - r.setQueryOptions(q) - r.ctx = ctx - rtt, resp, err := p.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - found, resp, err := requireNotFoundOrOK(resp) - if err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - if !found { - return nil, qm, nil - } - - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return &out, qm, nil -} - -func (p *Partitions) Delete(ctx context.Context, name string, q *WriteOptions) (*WriteMeta, error) { - r := p.c.newRequest("DELETE", "/v1/partition/"+name) - r.setWriteOptions(q) - r.ctx = ctx - rtt, resp, err := p.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - wm := &WriteMeta{RequestTime: rtt} - return wm, nil -} - -func (p *Partitions) List(ctx context.Context, q *QueryOptions) ([]*Partition, *QueryMeta, error) { - var out []*Partition - r := p.c.newRequest("GET", "/v1/partitions") - r.setQueryOptions(q) - r.ctx = ctx - rtt, resp, err := p.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - return out, qm, nil -} diff --git a/vendor/github.com/hashicorp/consul/api/peering.go b/vendor/github.com/hashicorp/consul/api/peering.go deleted file mode 100644 index dd7780f63..000000000 --- a/vendor/github.com/hashicorp/consul/api/peering.go +++ /dev/null @@ -1,295 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "context" - "fmt" - "time" -) - -// PeeringState enumerates all the states a peering can be in -type PeeringState string - -const ( - // PeeringStateUndefined represents an unset value for PeeringState during - // writes. - PeeringStateUndefined PeeringState = "UNDEFINED" - - // PeeringStatePending means the peering was created by generating a peering token. - // Peerings stay in a pending state until the peer uses the token to dial - // the local cluster. - PeeringStatePending PeeringState = "PENDING" - - // PeeringStateEstablishing means the peering is being established from a peering token. - // This is the initial state for dialing peers. - PeeringStateEstablishing PeeringState = "ESTABLISHING" - - // PeeringStateActive means that the peering connection is active and - // healthy. - PeeringStateActive PeeringState = "ACTIVE" - - // PeeringStateFailing means the peering connection has been interrupted - // but has not yet been terminated. - PeeringStateFailing PeeringState = "FAILING" - - // PeeringStateDeleting means a peering was marked for deletion and is in the process - // of being deleted. - PeeringStateDeleting PeeringState = "DELETING" - - // PeeringStateTerminated means the peering relationship has been removed. - PeeringStateTerminated PeeringState = "TERMINATED" -) - -type PeeringRemoteInfo struct { - // Partition is the remote peer's partition. - Partition string - // Datacenter is the remote peer's datacenter. - Datacenter string - Locality *Locality `json:",omitempty"` -} - -// Locality identifies where a given entity is running. -type Locality struct { - // Region is region the zone belongs to. - Region string - - // Zone is the zone the entity is running in. - Zone string -} - -type Peering struct { - // ID is a datacenter-scoped UUID for the peering. - ID string - // Name is the local alias for the peering relationship. - Name string - // Partition is the local partition connecting to the peer. - Partition string `json:",omitempty"` - // DeletedAt is the time when the Peering was marked for deletion - DeletedAt *time.Time `json:",omitempty" alias:"deleted_at"` - // Meta is a mapping of some string value to any other string value - Meta map[string]string `json:",omitempty"` - // State is one of the valid PeeringState values to represent the status of - // peering relationship. - State PeeringState - // PeerID is the ID that our peer assigned to this peering. This ID is to - // be used when dialing the peer, so that it can know who dialed it. - PeerID string `json:",omitempty"` - // PeerCAPems contains all the CA certificates for the remote peer. - PeerCAPems []string `json:",omitempty"` - // PeerServerName is the name of the remote server as it relates to TLS. - PeerServerName string `json:",omitempty"` - // PeerServerAddresses contains all the connection addresses for the remote peer. - PeerServerAddresses []string `json:",omitempty"` - // StreamStatus contains information computed on read based on the state of the stream. - StreamStatus PeeringStreamStatus - // CreateIndex is the Raft index at which the Peering was created. - CreateIndex uint64 - // ModifyIndex is the latest Raft index at which the Peering was modified. - ModifyIndex uint64 - // Remote contains metadata for the remote peer. - Remote PeeringRemoteInfo -} - -type PeeringStreamStatus struct { - // ImportedServices is the list of services imported from this peering. - ImportedServices []string - // ExportedServices is the list of services exported to this peering. - ExportedServices []string - // LastHeartbeat represents when the last heartbeat message was received. - LastHeartbeat *time.Time - // LastReceive represents when any message was last received, regardless of success or error. - LastReceive *time.Time - // LastSend represents when any message was last sent, regardless of success or error. - LastSend *time.Time -} - -type PeeringReadResponse struct { - Peering *Peering -} - -type PeeringGenerateTokenRequest struct { - // PeerName is the name of the remote peer. - PeerName string - // Partition to be peered. - Partition string `json:",omitempty"` - // Meta is a mapping of some string value to any other string value - Meta map[string]string `json:",omitempty"` - // ServerExternalAddresses is a list of addresses to put into the generated token. This could be used to specify - // load balancer(s) or external IPs to reach the servers from the dialing side, and will override any server - // addresses obtained from the "consul" service. - ServerExternalAddresses []string `json:",omitempty"` -} - -type PeeringGenerateTokenResponse struct { - // PeeringToken is an opaque string provided to the remote peer for it to complete - // the peering initialization handshake. - PeeringToken string -} - -type PeeringEstablishRequest struct { - // Name of the remote peer. - PeerName string - // The peering token returned from the peer's GenerateToken endpoint. - PeeringToken string `json:",omitempty"` - // Partition to be peered. - Partition string `json:",omitempty"` - // Meta is a mapping of some string value to any other string value - Meta map[string]string `json:",omitempty"` -} - -type PeeringEstablishResponse struct { -} - -type PeeringListRequest struct { - // future proofing in case we extend List functionality -} - -type Peerings struct { - c *Client -} - -// Peerings returns a handle to the operator endpoints. -func (c *Client) Peerings() *Peerings { - return &Peerings{c: c} -} - -func (p *Peerings) Read(ctx context.Context, name string, q *QueryOptions) (*Peering, *QueryMeta, error) { - if name == "" { - return nil, nil, fmt.Errorf("peering name cannot be empty") - } - - req := p.c.newRequest("GET", fmt.Sprintf("/v1/peering/%s", name)) - req.setQueryOptions(q) - req.ctx = ctx - - rtt, resp, err := p.c.doRequest(req) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - found, resp, err := requireNotFoundOrOK(resp) - if err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - if !found { - return nil, qm, nil - } - - var out Peering - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, qm, nil -} - -func (p *Peerings) Delete(ctx context.Context, name string, q *WriteOptions) (*WriteMeta, error) { - if name == "" { - return nil, fmt.Errorf("peering name cannot be empty") - } - - req := p.c.newRequest("DELETE", fmt.Sprintf("/v1/peering/%s", name)) - req.setWriteOptions(q) - req.ctx = ctx - - rtt, resp, err := p.c.doRequest(req) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - wm := &WriteMeta{RequestTime: rtt} - return wm, nil -} - -// TODO(peering): verify this is the ultimate signature we want -func (p *Peerings) GenerateToken(ctx context.Context, g PeeringGenerateTokenRequest, wq *WriteOptions) (*PeeringGenerateTokenResponse, *WriteMeta, error) { - if g.PeerName == "" { - return nil, nil, fmt.Errorf("peer name cannot be empty") - } - - req := p.c.newRequest("POST", fmt.Sprint("/v1/peering/token")) - req.setWriteOptions(wq) - req.ctx = ctx - req.obj = g - - rtt, resp, err := p.c.doRequest(req) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - wm := &WriteMeta{RequestTime: rtt} - - var out PeeringGenerateTokenResponse - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, wm, nil -} - -// TODO(peering): verify this is the ultimate signature we want -func (p *Peerings) Establish(ctx context.Context, i PeeringEstablishRequest, wq *WriteOptions) (*PeeringEstablishResponse, *WriteMeta, error) { - req := p.c.newRequest("POST", fmt.Sprint("/v1/peering/establish")) - req.setWriteOptions(wq) - req.ctx = ctx - req.obj = i - - rtt, resp, err := p.c.doRequest(req) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - wm := &WriteMeta{RequestTime: rtt} - - var out PeeringEstablishResponse - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return &out, wm, nil -} - -func (p *Peerings) List(ctx context.Context, q *QueryOptions) ([]*Peering, *QueryMeta, error) { - req := p.c.newRequest("GET", "/v1/peerings") - req.setQueryOptions(q) - req.ctx = ctx - - rtt, resp, err := p.c.doRequest(req) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - var out []*Peering - if err := decodeBody(resp, &out); err != nil { - return nil, nil, err - } - - return out, qm, nil -} diff --git a/vendor/github.com/hashicorp/consul/api/prepared_query.go b/vendor/github.com/hashicorp/consul/api/prepared_query.go deleted file mode 100644 index 8ebc852f3..000000000 --- a/vendor/github.com/hashicorp/consul/api/prepared_query.go +++ /dev/null @@ -1,269 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -// QueryFailoverOptions sets options about how we fail over if there are no -// healthy nodes in the local datacenter. -type QueryFailoverOptions struct { - // NearestN is set to the number of remote datacenters to try, based on - // network coordinates. - NearestN int - - // Datacenters is a fixed list of datacenters to try after NearestN. We - // never try a datacenter multiple times, so those are subtracted from - // this list before proceeding. - Datacenters []string - - // Targets is a fixed list of datacenters and peers to try. This field cannot - // be populated with NearestN or Datacenters. - Targets []QueryFailoverTarget -} - -// Deprecated: use QueryFailoverOptions instead. -type QueryDatacenterOptions = QueryFailoverOptions - -type QueryFailoverTarget struct { - // Peer specifies a peer to try during failover. - Peer string - - // Datacenter specifies a datacenter to try during failover. - Datacenter string - - // Partition specifies a partition to try during failover - // Note: Partition are available only in Consul Enterprise - Partition string `json:",omitempty"` - - // Namespace specifies a namespace to try during failover - // Note: Namespaces are available only in Consul Enterprise - Namespace string `json:",omitempty"` -} - -// QueryDNSOptions controls settings when query results are served over DNS. -type QueryDNSOptions struct { - // TTL is the time to live for the served DNS results. - TTL string -} - -// ServiceQuery is used to query for a set of healthy nodes offering a specific -// service. -type ServiceQuery struct { - // Service is the service to query. - Service string - - // SamenessGroup specifies a sameness group to query. The first member of the Sameness Group will - // be targeted first on PQ execution and subsequent members will be targeted during failover scenarios. - // This field is mutually exclusive with Failover. - SamenessGroup string `json:",omitempty"` - - // Namespace of the service to query - Namespace string `json:",omitempty"` - - // Partition of the service to query - Partition string `json:",omitempty"` - - // Near allows baking in the name of a node to automatically distance- - // sort from. The magic "_agent" value is supported, which sorts near - // the agent which initiated the request by default. - Near string - - // Failover controls what we do if there are no healthy nodes in the - // local datacenter. - Failover QueryFailoverOptions `json:",omitempty"` - - // IgnoreCheckIDs is an optional list of health check IDs to ignore when - // considering which nodes are healthy. It is useful as an emergency measure - // to temporarily override some health check that is producing false negatives - // for example. - IgnoreCheckIDs []string - - // If OnlyPassing is true then we will only include nodes with passing - // health checks (critical AND warning checks will cause a node to be - // discarded) - OnlyPassing bool - - // Tags are a set of required and/or disallowed tags. If a tag is in - // this list it must be present. If the tag is preceded with "!" then - // it is disallowed. - Tags []string - - // NodeMeta is a map of required node metadata fields. If a key/value - // pair is in this map it must be present on the node in order for the - // service entry to be returned. - NodeMeta map[string]string - - // ServiceMeta is a map of required service metadata fields. If a key/value - // pair is in this map it must be present on the node in order for the - // service entry to be returned. - ServiceMeta map[string]string - - // Connect if true will filter the prepared query results to only - // include Connect-capable services. These include both native services - // and proxies for matching services. Note that if a proxy matches, - // the constraints in the query above (Near, OnlyPassing, etc.) apply - // to the _proxy_ and not the service being proxied. In practice, proxies - // should be directly next to their services so this isn't an issue. - Connect bool -} - -// QueryTemplate carries the arguments for creating a templated query. -type QueryTemplate struct { - // Type specifies the type of the query template. Currently only - // "name_prefix_match" is supported. This field is required. - Type string - - // Regexp allows specifying a regex pattern to match against the name - // of the query being executed. - Regexp string - - // RemoveEmptyTags if set to true, will cause the Tags list inside - // the Service structure to be stripped of any empty strings. This is useful - // when interpolating into tags in a way where the tag is optional, and - // where searching for an empty tag would yield no results from the query. - RemoveEmptyTags bool -} - -// PreparedQueryDefinition defines a complete prepared query. -type PreparedQueryDefinition struct { - // ID is this UUID-based ID for the query, always generated by Consul. - ID string - - // Name is an optional friendly name for the query supplied by the - // user. NOTE - if this feature is used then it will reduce the security - // of any read ACL associated with this query/service since this name - // can be used to locate nodes with supplying any ACL. - Name string - - // Session is an optional session to tie this query's lifetime to. If - // this is omitted then the query will not expire. - Session string - - // Token is the ACL token used when the query was created, and it is - // used when a query is subsequently executed. This token, or a token - // with management privileges, must be used to change the query later. - Token string - - // Service defines a service query (leaving things open for other types - // later). - Service ServiceQuery - - // DNS has options that control how the results of this query are - // served over DNS. - DNS QueryDNSOptions - - // Template is used to pass through the arguments for creating a - // prepared query with an attached template. If a template is given, - // interpolations are possible in other struct fields. - Template QueryTemplate -} - -// PreparedQueryExecuteResponse has the results of executing a query. -type PreparedQueryExecuteResponse struct { - // Service is the service that was queried. - Service string - - // Namespace of the service that was queried - Namespace string `json:",omitempty"` - - // Nodes has the nodes that were output by the query. - Nodes []ServiceEntry - - // DNS has the options for serving these results over DNS. - DNS QueryDNSOptions - - // Datacenter is the datacenter that these results came from. - Datacenter string - - // Failovers is a count of how many times we had to query a remote - // datacenter. - Failovers int -} - -// PreparedQuery can be used to query the prepared query endpoints. -type PreparedQuery struct { - c *Client -} - -// PreparedQuery returns a handle to the prepared query endpoints. -func (c *Client) PreparedQuery() *PreparedQuery { - return &PreparedQuery{c} -} - -// Create makes a new prepared query. The ID of the new query is returned. -func (c *PreparedQuery) Create(query *PreparedQueryDefinition, q *WriteOptions) (string, *WriteMeta, error) { - r := c.c.newRequest("POST", "/v1/query") - r.setWriteOptions(q) - r.obj = query - rtt, resp, err := c.c.doRequest(r) - if err != nil { - return "", nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return "", nil, err - } - - wm := &WriteMeta{} - wm.RequestTime = rtt - - var out struct{ ID string } - if err := decodeBody(resp, &out); err != nil { - return "", nil, err - } - return out.ID, wm, nil -} - -// Update makes updates to an existing prepared query. -func (c *PreparedQuery) Update(query *PreparedQueryDefinition, q *WriteOptions) (*WriteMeta, error) { - return c.c.write("/v1/query/"+query.ID, query, nil, q) -} - -// List is used to fetch all the prepared queries (always requires a management -// token). -func (c *PreparedQuery) List(q *QueryOptions) ([]*PreparedQueryDefinition, *QueryMeta, error) { - var out []*PreparedQueryDefinition - qm, err := c.c.query("/v1/query", &out, q) - if err != nil { - return nil, nil, err - } - return out, qm, nil -} - -// Get is used to fetch a specific prepared query. -func (c *PreparedQuery) Get(queryID string, q *QueryOptions) ([]*PreparedQueryDefinition, *QueryMeta, error) { - var out []*PreparedQueryDefinition - qm, err := c.c.query("/v1/query/"+queryID, &out, q) - if err != nil { - return nil, nil, err - } - return out, qm, nil -} - -// Delete is used to delete a specific prepared query. -func (c *PreparedQuery) Delete(queryID string, q *WriteOptions) (*WriteMeta, error) { - r := c.c.newRequest("DELETE", "/v1/query/"+queryID) - r.setWriteOptions(q) - rtt, resp, err := c.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - wm := &WriteMeta{} - wm.RequestTime = rtt - return wm, nil -} - -// Execute is used to execute a specific prepared query. You can execute using -// a query ID or name. -func (c *PreparedQuery) Execute(queryIDOrName string, q *QueryOptions) (*PreparedQueryExecuteResponse, *QueryMeta, error) { - var out *PreparedQueryExecuteResponse - qm, err := c.c.query("/v1/query/"+queryIDOrName+"/execute", &out, q) - if err != nil { - return nil, nil, err - } - return out, qm, nil -} diff --git a/vendor/github.com/hashicorp/consul/api/raw.go b/vendor/github.com/hashicorp/consul/api/raw.go deleted file mode 100644 index 639513d29..000000000 --- a/vendor/github.com/hashicorp/consul/api/raw.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -// Raw can be used to do raw queries against custom endpoints -type Raw struct { - c *Client -} - -// Raw returns a handle to query endpoints -func (c *Client) Raw() *Raw { - return &Raw{c} -} - -// Query is used to do a GET request against an endpoint -// and deserialize the response into an interface using -// standard Consul conventions. -func (raw *Raw) Query(endpoint string, out interface{}, q *QueryOptions) (*QueryMeta, error) { - return raw.c.query(endpoint, out, q) -} - -// Write is used to do a PUT request against an endpoint -// and serialize/deserialized using the standard Consul conventions. -func (raw *Raw) Write(endpoint string, in, out interface{}, q *WriteOptions) (*WriteMeta, error) { - return raw.c.write(endpoint, in, out, q) -} diff --git a/vendor/github.com/hashicorp/consul/api/semaphore.go b/vendor/github.com/hashicorp/consul/api/semaphore.go deleted file mode 100644 index 9d98ff5c2..000000000 --- a/vendor/github.com/hashicorp/consul/api/semaphore.go +++ /dev/null @@ -1,533 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "encoding/json" - "fmt" - "path" - "sync" - "time" -) - -const ( - // DefaultSemaphoreSessionName is the Session Name we assign if none is provided - DefaultSemaphoreSessionName = "Consul API Semaphore" - - // DefaultSemaphoreSessionTTL is the default session TTL if no Session is provided - // when creating a new Semaphore. This is used because we do not have another - // other check to depend upon. - DefaultSemaphoreSessionTTL = "15s" - - // DefaultSemaphoreWaitTime is how long we block for at a time to check if semaphore - // acquisition is possible. This affects the minimum time it takes to cancel - // a Semaphore acquisition. - DefaultSemaphoreWaitTime = 15 * time.Second - - // DefaultSemaphoreKey is the key used within the prefix to - // use for coordination between all the contenders. - DefaultSemaphoreKey = ".lock" - - // SemaphoreFlagValue is a magic flag we set to indicate a key - // is being used for a semaphore. It is used to detect a potential - // conflict with a lock. - SemaphoreFlagValue = 0xe0f69a2baa414de0 -) - -var ( - // ErrSemaphoreHeld is returned if we attempt to double lock - ErrSemaphoreHeld = fmt.Errorf("Semaphore already held") - - // ErrSemaphoreNotHeld is returned if we attempt to unlock a semaphore - // that we do not hold. - ErrSemaphoreNotHeld = fmt.Errorf("Semaphore not held") - - // ErrSemaphoreInUse is returned if we attempt to destroy a semaphore - // that is in use. - ErrSemaphoreInUse = fmt.Errorf("Semaphore in use") - - // ErrSemaphoreConflict is returned if the flags on a key - // used for a semaphore do not match expectation - ErrSemaphoreConflict = fmt.Errorf("Existing key does not match semaphore use") -) - -// Semaphore is used to implement a distributed semaphore -// using the Consul KV primitives. -type Semaphore struct { - c *Client - opts *SemaphoreOptions - - isHeld bool - sessionRenew chan struct{} - lockSession string - l sync.Mutex -} - -// SemaphoreOptions is used to parameterize the Semaphore -type SemaphoreOptions struct { - Prefix string // Must be set and have write permissions - Limit int // Must be set, and be positive - Value []byte // Optional, value to associate with the contender entry - Session string // Optional, created if not specified - SessionName string // Optional, defaults to DefaultLockSessionName - SessionTTL string // Optional, defaults to DefaultLockSessionTTL - MonitorRetries int // Optional, defaults to 0 which means no retries - MonitorRetryTime time.Duration // Optional, defaults to DefaultMonitorRetryTime - SemaphoreWaitTime time.Duration // Optional, defaults to DefaultSemaphoreWaitTime - SemaphoreTryOnce bool // Optional, defaults to false which means try forever - Namespace string `json:",omitempty"` // Optional, defaults to API client config, namespace of ACL token, or "default" namespace -} - -// semaphoreLock is written under the DefaultSemaphoreKey and -// is used to coordinate between all the contenders. -type semaphoreLock struct { - // Limit is the integer limit of holders. This is used to - // verify that all the holders agree on the value. - Limit int - - // Holders is a list of all the semaphore holders. - // It maps the session ID to true. It is used as a set effectively. - Holders map[string]bool -} - -// SemaphorePrefix is used to created a Semaphore which will operate -// at the given KV prefix and uses the given limit for the semaphore. -// The prefix must have write privileges, and the limit must be agreed -// upon by all contenders. -func (c *Client) SemaphorePrefix(prefix string, limit int) (*Semaphore, error) { - opts := &SemaphoreOptions{ - Prefix: prefix, - Limit: limit, - } - return c.SemaphoreOpts(opts) -} - -// SemaphoreOpts is used to create a Semaphore with the given options. -// The prefix must have write privileges, and the limit must be agreed -// upon by all contenders. If a Session is not provided, one will be created. -func (c *Client) SemaphoreOpts(opts *SemaphoreOptions) (*Semaphore, error) { - if opts.Prefix == "" { - return nil, fmt.Errorf("missing prefix") - } - if opts.Limit <= 0 { - return nil, fmt.Errorf("semaphore limit must be positive") - } - if opts.SessionName == "" { - opts.SessionName = DefaultSemaphoreSessionName - } - if opts.SessionTTL == "" { - opts.SessionTTL = DefaultSemaphoreSessionTTL - } else { - if _, err := time.ParseDuration(opts.SessionTTL); err != nil { - return nil, fmt.Errorf("invalid SessionTTL: %v", err) - } - } - if opts.MonitorRetryTime == 0 { - opts.MonitorRetryTime = DefaultMonitorRetryTime - } - if opts.SemaphoreWaitTime == 0 { - opts.SemaphoreWaitTime = DefaultSemaphoreWaitTime - } - s := &Semaphore{ - c: c, - opts: opts, - } - return s, nil -} - -// Acquire attempts to reserve a slot in the semaphore, blocking until -// success, interrupted via the stopCh or an error is encountered. -// Providing a non-nil stopCh can be used to abort the attempt. -// On success, a channel is returned that represents our slot. -// This channel could be closed at any time due to session invalidation, -// communication errors, operator intervention, etc. It is NOT safe to -// assume that the slot is held until Release() unless the Session is specifically -// created without any associated health checks. By default Consul sessions -// prefer liveness over safety and an application must be able to handle -// the session being lost. -func (s *Semaphore) Acquire(stopCh <-chan struct{}) (<-chan struct{}, error) { - // Hold the lock as we try to acquire - s.l.Lock() - defer s.l.Unlock() - - // Check if we already hold the semaphore - if s.isHeld { - return nil, ErrSemaphoreHeld - } - - // Check if we need to create a session first - s.lockSession = s.opts.Session - if s.lockSession == "" { - sess, err := s.createSession() - if err != nil { - return nil, fmt.Errorf("failed to create session: %v", err) - } - - s.sessionRenew = make(chan struct{}) - s.lockSession = sess - session := s.c.Session() - go session.RenewPeriodic(s.opts.SessionTTL, sess, nil, s.sessionRenew) - - // If we fail to acquire the lock, cleanup the session - defer func() { - if !s.isHeld { - close(s.sessionRenew) - s.sessionRenew = nil - } - }() - } - - // Create the contender entry - kv := s.c.KV() - wOpts := WriteOptions{Namespace: s.opts.Namespace} - - made, _, err := kv.Acquire(s.contenderEntry(s.lockSession), &wOpts) - if err != nil || !made { - return nil, fmt.Errorf("failed to make contender entry: %v", err) - } - - // Setup the query options - qOpts := QueryOptions{ - WaitTime: s.opts.SemaphoreWaitTime, - Namespace: s.opts.Namespace, - } - - start := time.Now() - attempts := 0 -WAIT: - // Check if we should quit - select { - case <-stopCh: - return nil, nil - default: - } - - // Handle the one-shot mode. - if s.opts.SemaphoreTryOnce && attempts > 0 { - elapsed := time.Since(start) - if elapsed > s.opts.SemaphoreWaitTime { - return nil, nil - } - - // Query wait time should not exceed the semaphore wait time - qOpts.WaitTime = s.opts.SemaphoreWaitTime - elapsed - } - attempts++ - - // Read the prefix - pairs, meta, err := kv.List(s.opts.Prefix, &qOpts) - if err != nil { - return nil, fmt.Errorf("failed to read prefix: %v", err) - } - - // Decode the lock - lockPair := s.findLock(pairs) - if lockPair.Flags != SemaphoreFlagValue { - return nil, ErrSemaphoreConflict - } - lock, err := s.decodeLock(lockPair) - if err != nil { - return nil, err - } - - // Verify we agree with the limit - if lock.Limit != s.opts.Limit { - return nil, fmt.Errorf("semaphore limit conflict (lock: %d, local: %d)", - lock.Limit, s.opts.Limit) - } - - // Prune the dead holders - s.pruneDeadHolders(lock, pairs) - - // Check if the lock is held - if len(lock.Holders) >= lock.Limit { - qOpts.WaitIndex = meta.LastIndex - goto WAIT - } - - // Create a new lock with us as a holder - lock.Holders[s.lockSession] = true - newLock, err := s.encodeLock(lock, lockPair.ModifyIndex) - if err != nil { - return nil, err - } - - // Attempt the acquisition - didSet, _, err := kv.CAS(newLock, &wOpts) - if err != nil { - return nil, fmt.Errorf("failed to update lock: %v", err) - } - if !didSet { - // Update failed, could have been a race with another contender, - // retry the operation - goto WAIT - } - - // Watch to ensure we maintain ownership of the slot - lockCh := make(chan struct{}) - go s.monitorLock(s.lockSession, lockCh) - - // Set that we own the lock - s.isHeld = true - - // Acquired! All done - return lockCh, nil -} - -// Release is used to voluntarily give up our semaphore slot. It is -// an error to call this if the semaphore has not been acquired. -func (s *Semaphore) Release() error { - // Hold the lock as we try to release - s.l.Lock() - defer s.l.Unlock() - - // Ensure the lock is actually held - if !s.isHeld { - return ErrSemaphoreNotHeld - } - - // Set that we no longer own the lock - s.isHeld = false - - // Stop the session renew - if s.sessionRenew != nil { - defer func() { - close(s.sessionRenew) - s.sessionRenew = nil - }() - } - - // Get and clear the lock session - lockSession := s.lockSession - s.lockSession = "" - - // Remove ourselves as a lock holder - kv := s.c.KV() - key := path.Join(s.opts.Prefix, DefaultSemaphoreKey) - - wOpts := WriteOptions{Namespace: s.opts.Namespace} - qOpts := QueryOptions{Namespace: s.opts.Namespace} - -READ: - pair, _, err := kv.Get(key, &qOpts) - if err != nil { - return err - } - if pair == nil { - pair = &KVPair{} - } - lock, err := s.decodeLock(pair) - if err != nil { - return err - } - - // Create a new lock without us as a holder - if _, ok := lock.Holders[lockSession]; ok { - delete(lock.Holders, lockSession) - newLock, err := s.encodeLock(lock, pair.ModifyIndex) - if err != nil { - return err - } - - // Swap the locks - didSet, _, err := kv.CAS(newLock, &wOpts) - if err != nil { - return fmt.Errorf("failed to update lock: %v", err) - } - if !didSet { - goto READ - } - } - - // Destroy the contender entry - contenderKey := path.Join(s.opts.Prefix, lockSession) - if _, err := kv.Delete(contenderKey, &wOpts); err != nil { - return err - } - return nil -} - -// Destroy is used to cleanup the semaphore entry. It is not necessary -// to invoke. It will fail if the semaphore is in use. -func (s *Semaphore) Destroy() error { - // Hold the lock as we try to acquire - s.l.Lock() - defer s.l.Unlock() - - // Check if we already hold the semaphore - if s.isHeld { - return ErrSemaphoreHeld - } - - // List for the semaphore - kv := s.c.KV() - - q := QueryOptions{Namespace: s.opts.Namespace} - pairs, _, err := kv.List(s.opts.Prefix, &q) - if err != nil { - return fmt.Errorf("failed to read prefix: %v", err) - } - - // Find the lock pair, bail if it doesn't exist - lockPair := s.findLock(pairs) - if lockPair.ModifyIndex == 0 { - return nil - } - if lockPair.Flags != SemaphoreFlagValue { - return ErrSemaphoreConflict - } - - // Decode the lock - lock, err := s.decodeLock(lockPair) - if err != nil { - return err - } - - // Prune the dead holders - s.pruneDeadHolders(lock, pairs) - - // Check if there are any holders - if len(lock.Holders) > 0 { - return ErrSemaphoreInUse - } - - // Attempt the delete - w := WriteOptions{Namespace: s.opts.Namespace} - didRemove, _, err := kv.DeleteCAS(lockPair, &w) - if err != nil { - return fmt.Errorf("failed to remove semaphore: %v", err) - } - if !didRemove { - return ErrSemaphoreInUse - } - return nil -} - -// createSession is used to create a new managed session -func (s *Semaphore) createSession() (string, error) { - session := s.c.Session() - se := &SessionEntry{ - Name: s.opts.SessionName, - TTL: s.opts.SessionTTL, - Behavior: SessionBehaviorDelete, - } - - w := WriteOptions{Namespace: s.opts.Namespace} - id, _, err := session.Create(se, &w) - if err != nil { - return "", err - } - return id, nil -} - -// contenderEntry returns a formatted KVPair for the contender -func (s *Semaphore) contenderEntry(session string) *KVPair { - return &KVPair{ - Key: path.Join(s.opts.Prefix, session), - Value: s.opts.Value, - Session: session, - Flags: SemaphoreFlagValue, - } -} - -// findLock is used to find the KV Pair which is used for coordination -func (s *Semaphore) findLock(pairs KVPairs) *KVPair { - key := path.Join(s.opts.Prefix, DefaultSemaphoreKey) - for _, pair := range pairs { - if pair.Key == key { - return pair - } - } - return &KVPair{Flags: SemaphoreFlagValue} -} - -// decodeLock is used to decode a semaphoreLock from an -// entry in Consul -func (s *Semaphore) decodeLock(pair *KVPair) (*semaphoreLock, error) { - // Handle if there is no lock - if pair == nil || pair.Value == nil { - return &semaphoreLock{ - Limit: s.opts.Limit, - Holders: make(map[string]bool), - }, nil - } - - l := &semaphoreLock{} - if err := json.Unmarshal(pair.Value, l); err != nil { - return nil, fmt.Errorf("lock decoding failed: %v", err) - } - return l, nil -} - -// encodeLock is used to encode a semaphoreLock into a KVPair -// that can be PUT -func (s *Semaphore) encodeLock(l *semaphoreLock, oldIndex uint64) (*KVPair, error) { - enc, err := json.Marshal(l) - if err != nil { - return nil, fmt.Errorf("lock encoding failed: %v", err) - } - pair := &KVPair{ - Key: path.Join(s.opts.Prefix, DefaultSemaphoreKey), - Value: enc, - Flags: SemaphoreFlagValue, - ModifyIndex: oldIndex, - } - return pair, nil -} - -// pruneDeadHolders is used to remove all the dead lock holders -func (s *Semaphore) pruneDeadHolders(lock *semaphoreLock, pairs KVPairs) { - // Gather all the live holders - alive := make(map[string]struct{}, len(pairs)) - for _, pair := range pairs { - if pair.Session != "" { - alive[pair.Session] = struct{}{} - } - } - - // Remove any holders that are dead - for holder := range lock.Holders { - if _, ok := alive[holder]; !ok { - delete(lock.Holders, holder) - } - } -} - -// monitorLock is a long running routine to monitor a semaphore ownership -// It closes the stopCh if we lose our slot. -func (s *Semaphore) monitorLock(session string, stopCh chan struct{}) { - defer close(stopCh) - kv := s.c.KV() - opts := QueryOptions{ - RequireConsistent: true, - Namespace: s.opts.Namespace, - } -WAIT: - retries := s.opts.MonitorRetries -RETRY: - pairs, meta, err := kv.List(s.opts.Prefix, &opts) - if err != nil { - // If configured we can try to ride out a brief Consul unavailability - // by doing retries. Note that we have to attempt the retry in a non- - // blocking fashion so that we have a clean place to reset the retry - // counter if service is restored. - if retries > 0 && IsRetryableError(err) { - time.Sleep(s.opts.MonitorRetryTime) - retries-- - opts.WaitIndex = 0 - goto RETRY - } - return - } - lockPair := s.findLock(pairs) - lock, err := s.decodeLock(lockPair) - if err != nil { - return - } - s.pruneDeadHolders(lock, pairs) - if _, ok := lock.Holders[session]; ok { - opts.WaitIndex = meta.LastIndex - goto WAIT - } -} diff --git a/vendor/github.com/hashicorp/consul/api/session.go b/vendor/github.com/hashicorp/consul/api/session.go deleted file mode 100644 index 69fd77d27..000000000 --- a/vendor/github.com/hashicorp/consul/api/session.go +++ /dev/null @@ -1,246 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "errors" - "fmt" - "time" -) - -const ( - // SessionBehaviorRelease is the default behavior and causes - // all associated locks to be released on session invalidation. - SessionBehaviorRelease = "release" - - // SessionBehaviorDelete is new in Consul 0.5 and changes the - // behavior to delete all associated locks on session invalidation. - // It can be used in a way similar to Ephemeral Nodes in ZooKeeper. - SessionBehaviorDelete = "delete" -) - -var ErrSessionExpired = errors.New("session expired") - -// SessionEntry represents a session in consul -type SessionEntry struct { - CreateIndex uint64 - ID string - Name string - Node string - LockDelay time.Duration - Behavior string - TTL string - Namespace string `json:",omitempty"` - - // Deprecated for Consul Enterprise in v1.7.0. - Checks []string - - // NodeChecks and ServiceChecks are new in Consul 1.7.0. - // When associating checks with sessions, namespaces can be specified for service checks. - NodeChecks []string - ServiceChecks []ServiceCheck -} - -type ServiceCheck struct { - ID string - Namespace string -} - -// Session can be used to query the Session endpoints -type Session struct { - c *Client -} - -// Session returns a handle to the session endpoints -func (c *Client) Session() *Session { - return &Session{c} -} - -// CreateNoChecks is like Create but is used specifically to create -// a session with no associated health checks. -func (s *Session) CreateNoChecks(se *SessionEntry, q *WriteOptions) (string, *WriteMeta, error) { - body := make(map[string]interface{}) - body["NodeChecks"] = []string{} - if se != nil { - if se.Name != "" { - body["Name"] = se.Name - } - if se.Node != "" { - body["Node"] = se.Node - } - if se.LockDelay != 0 { - body["LockDelay"] = durToMsec(se.LockDelay) - } - if se.Behavior != "" { - body["Behavior"] = se.Behavior - } - if se.TTL != "" { - body["TTL"] = se.TTL - } - } - return s.create(body, q) - -} - -// Create makes a new session. Providing a session entry can -// customize the session. It can also be nil to use defaults. -func (s *Session) Create(se *SessionEntry, q *WriteOptions) (string, *WriteMeta, error) { - var obj interface{} - if se != nil { - body := make(map[string]interface{}) - obj = body - if se.Name != "" { - body["Name"] = se.Name - } - if se.Node != "" { - body["Node"] = se.Node - } - if se.LockDelay != 0 { - body["LockDelay"] = durToMsec(se.LockDelay) - } - if len(se.Checks) > 0 { - body["Checks"] = se.Checks - } - if len(se.NodeChecks) > 0 { - body["NodeChecks"] = se.NodeChecks - } - if len(se.ServiceChecks) > 0 { - body["ServiceChecks"] = se.ServiceChecks - } - if se.Behavior != "" { - body["Behavior"] = se.Behavior - } - if se.TTL != "" { - body["TTL"] = se.TTL - } - } - return s.create(obj, q) -} - -func (s *Session) create(obj interface{}, q *WriteOptions) (string, *WriteMeta, error) { - var out struct{ ID string } - wm, err := s.c.write("/v1/session/create", obj, &out, q) - if err != nil { - return "", nil, err - } - return out.ID, wm, nil -} - -// Destroy invalidates a given session -func (s *Session) Destroy(id string, q *WriteOptions) (*WriteMeta, error) { - wm, err := s.c.write("/v1/session/destroy/"+id, nil, nil, q) - if err != nil { - return nil, err - } - return wm, nil -} - -// Renew renews the TTL on a given session -func (s *Session) Renew(id string, q *WriteOptions) (*SessionEntry, *WriteMeta, error) { - r := s.c.newRequest("PUT", "/v1/session/renew/"+id) - r.setWriteOptions(q) - rtt, resp, err := s.c.doRequest(r) - if err != nil { - return nil, nil, err - } - defer closeResponseBody(resp) - - wm := &WriteMeta{RequestTime: rtt} - - if resp.StatusCode == 404 { - return nil, wm, nil - } else if resp.StatusCode != 200 { - return nil, nil, fmt.Errorf("Unexpected response code: %d", resp.StatusCode) - } - - var entries []*SessionEntry - if err := decodeBody(resp, &entries); err != nil { - return nil, nil, fmt.Errorf("Failed to read response: %v", err) - } - if len(entries) > 0 { - return entries[0], wm, nil - } - return nil, wm, nil -} - -// RenewPeriodic is used to periodically invoke Session.Renew on a -// session until a doneCh is closed. This is meant to be used in a long running -// goroutine to ensure a session stays valid. -func (s *Session) RenewPeriodic(initialTTL string, id string, q *WriteOptions, doneCh <-chan struct{}) error { - ctx := q.Context() - - ttl, err := time.ParseDuration(initialTTL) - if err != nil { - return err - } - - waitDur := ttl / 2 - lastRenewTime := time.Now() - var lastErr error - for { - if time.Since(lastRenewTime) > ttl { - return lastErr - } - select { - case <-time.After(waitDur): - entry, _, err := s.Renew(id, q) - if err != nil { - waitDur = time.Second - lastErr = err - continue - } - if entry == nil { - return ErrSessionExpired - } - - // Handle the server updating the TTL - ttl, _ = time.ParseDuration(entry.TTL) - waitDur = ttl / 2 - lastRenewTime = time.Now() - - case <-doneCh: - // Attempt a session destroy - s.Destroy(id, q) - return nil - - case <-ctx.Done(): - // Bail immediately since attempting the destroy would - // use the canceled context in q, which would just bail. - return ctx.Err() - } - } -} - -// Info looks up a single session -func (s *Session) Info(id string, q *QueryOptions) (*SessionEntry, *QueryMeta, error) { - var entries []*SessionEntry - qm, err := s.c.query("/v1/session/info/"+id, &entries, q) - if err != nil { - return nil, nil, err - } - if len(entries) > 0 { - return entries[0], qm, nil - } - return nil, qm, nil -} - -// List gets sessions for a node -func (s *Session) Node(node string, q *QueryOptions) ([]*SessionEntry, *QueryMeta, error) { - var entries []*SessionEntry - qm, err := s.c.query("/v1/session/node/"+node, &entries, q) - if err != nil { - return nil, nil, err - } - return entries, qm, nil -} - -// List gets all active sessions -func (s *Session) List(q *QueryOptions) ([]*SessionEntry, *QueryMeta, error) { - var entries []*SessionEntry - qm, err := s.c.query("/v1/session/list", &entries, q) - if err != nil { - return nil, nil, err - } - return entries, qm, nil -} diff --git a/vendor/github.com/hashicorp/consul/api/snapshot.go b/vendor/github.com/hashicorp/consul/api/snapshot.go deleted file mode 100644 index bcc80e5b3..000000000 --- a/vendor/github.com/hashicorp/consul/api/snapshot.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "io" -) - -// Snapshot can be used to query the /v1/snapshot endpoint to take snapshots of -// Consul's internal state and restore snapshots for disaster recovery. -type Snapshot struct { - c *Client -} - -// Snapshot returns a handle that exposes the snapshot endpoints. -func (c *Client) Snapshot() *Snapshot { - return &Snapshot{c} -} - -// Save requests a new snapshot and provides an io.ReadCloser with the snapshot -// data to save. If this doesn't return an error, then it's the responsibility -// of the caller to close it. Only a subset of the QueryOptions are supported: -// Datacenter, AllowStale, and Token. -func (s *Snapshot) Save(q *QueryOptions) (io.ReadCloser, *QueryMeta, error) { - r := s.c.newRequest("GET", "/v1/snapshot") - r.setQueryOptions(q) - - rtt, resp, err := s.c.doRequest(r) - if err != nil { - return nil, nil, err - } - if err := requireOK(resp); err != nil { - return nil, nil, err - } - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - return resp.Body, qm, nil -} - -// Restore streams in an existing snapshot and attempts to restore it. -func (s *Snapshot) Restore(q *WriteOptions, in io.Reader) error { - r := s.c.newRequest("PUT", "/v1/snapshot") - r.body = in - r.header.Set("Content-Type", "application/octet-stream") - r.setWriteOptions(q) - _, resp, err := s.c.doRequest(r) - if err != nil { - return err - } - if err := requireOK(resp); err != nil { - return err - } - return nil -} diff --git a/vendor/github.com/hashicorp/consul/api/status.go b/vendor/github.com/hashicorp/consul/api/status.go deleted file mode 100644 index 8c52eb222..000000000 --- a/vendor/github.com/hashicorp/consul/api/status.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -// Status can be used to query the Status endpoints -type Status struct { - c *Client -} - -// Status returns a handle to the status endpoints -func (c *Client) Status() *Status { - return &Status{c} -} - -// Leader is used to query for a known leader -func (s *Status) LeaderWithQueryOptions(q *QueryOptions) (string, error) { - r := s.c.newRequest("GET", "/v1/status/leader") - - if q != nil { - r.setQueryOptions(q) - } - - _, resp, err := s.c.doRequest(r) - if err != nil { - return "", err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return "", err - } - - var leader string - if err := decodeBody(resp, &leader); err != nil { - return "", err - } - return leader, nil -} - -func (s *Status) Leader() (string, error) { - return s.LeaderWithQueryOptions(nil) -} - -// Peers is used to query for a known raft peers -func (s *Status) PeersWithQueryOptions(q *QueryOptions) ([]string, error) { - r := s.c.newRequest("GET", "/v1/status/peers") - - if q != nil { - r.setQueryOptions(q) - } - - _, resp, err := s.c.doRequest(r) - if err != nil { - return nil, err - } - defer closeResponseBody(resp) - if err := requireOK(resp); err != nil { - return nil, err - } - - var peers []string - if err := decodeBody(resp, &peers); err != nil { - return nil, err - } - return peers, nil -} - -func (s *Status) Peers() ([]string, error) { - return s.PeersWithQueryOptions(nil) -} diff --git a/vendor/github.com/hashicorp/consul/api/txn.go b/vendor/github.com/hashicorp/consul/api/txn.go deleted file mode 100644 index 59adafdac..000000000 --- a/vendor/github.com/hashicorp/consul/api/txn.go +++ /dev/null @@ -1,249 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package api - -import ( - "bytes" - "fmt" - "io" - "net/http" -) - -// Txn is used to manipulate the Txn API -type Txn struct { - c *Client -} - -// Txn is used to return a handle to the K/V apis -func (c *Client) Txn() *Txn { - return &Txn{c} -} - -// TxnOp is the internal format we send to Consul. Currently only K/V and -// check operations are supported. -type TxnOp struct { - KV *KVTxnOp - Node *NodeTxnOp - Service *ServiceTxnOp - Check *CheckTxnOp -} - -// TxnOps is a list of transaction operations. -type TxnOps []*TxnOp - -// TxnResult is the internal format we receive from Consul. -type TxnResult struct { - KV *KVPair - Node *Node - Service *CatalogService - Check *HealthCheck -} - -// TxnResults is a list of TxnResult objects. -type TxnResults []*TxnResult - -// TxnError is used to return information about an operation in a transaction. -type TxnError struct { - OpIndex int - What string -} - -// TxnErrors is a list of TxnError objects. -type TxnErrors []*TxnError - -// TxnResponse is the internal format we receive from Consul. -type TxnResponse struct { - Results TxnResults - Errors TxnErrors -} - -// KVOp constants give possible operations available in a transaction. -type KVOp string - -const ( - KVSet KVOp = "set" - KVDelete KVOp = "delete" - KVDeleteCAS KVOp = "delete-cas" - KVDeleteTree KVOp = "delete-tree" - KVCAS KVOp = "cas" - KVLock KVOp = "lock" - KVUnlock KVOp = "unlock" - KVGet KVOp = "get" - KVGetOrEmpty KVOp = "get-or-empty" - KVGetTree KVOp = "get-tree" - KVCheckSession KVOp = "check-session" - KVCheckIndex KVOp = "check-index" - KVCheckNotExists KVOp = "check-not-exists" -) - -// KVTxnOp defines a single operation inside a transaction. -type KVTxnOp struct { - Verb KVOp - Key string - Value []byte - Flags uint64 - Index uint64 - Session string - Namespace string `json:",omitempty"` - Partition string `json:",omitempty"` -} - -// KVTxnOps defines a set of operations to be performed inside a single -// transaction. -type KVTxnOps []*KVTxnOp - -// KVTxnResponse has the outcome of a transaction. -type KVTxnResponse struct { - Results []*KVPair - Errors TxnErrors -} - -// SessionOp constants give possible operations available in a transaction. -type SessionOp string - -const ( - SessionDelete SessionOp = "delete" -) - -// SessionTxnOp defines a single operation inside a transaction. -type SessionTxnOp struct { - Verb SessionOp - Session Session -} - -// NodeOp constants give possible operations available in a transaction. -type NodeOp string - -const ( - NodeGet NodeOp = "get" - NodeSet NodeOp = "set" - NodeCAS NodeOp = "cas" - NodeDelete NodeOp = "delete" - NodeDeleteCAS NodeOp = "delete-cas" -) - -// NodeTxnOp defines a single operation inside a transaction. -type NodeTxnOp struct { - Verb NodeOp - Node Node -} - -// ServiceOp constants give possible operations available in a transaction. -type ServiceOp string - -const ( - ServiceGet ServiceOp = "get" - ServiceSet ServiceOp = "set" - ServiceCAS ServiceOp = "cas" - ServiceDelete ServiceOp = "delete" - ServiceDeleteCAS ServiceOp = "delete-cas" -) - -// ServiceTxnOp defines a single operation inside a transaction. -type ServiceTxnOp struct { - Verb ServiceOp - Node string - Service AgentService -} - -// CheckOp constants give possible operations available in a transaction. -type CheckOp string - -const ( - CheckGet CheckOp = "get" - CheckSet CheckOp = "set" - CheckCAS CheckOp = "cas" - CheckDelete CheckOp = "delete" - CheckDeleteCAS CheckOp = "delete-cas" -) - -// CheckTxnOp defines a single operation inside a transaction. -type CheckTxnOp struct { - Verb CheckOp - Check HealthCheck -} - -// Txn is used to apply multiple Consul operations in a single, atomic transaction. -// -// Note that Go will perform the required base64 encoding on the values -// automatically because the type is a byte slice. Transactions are defined as a -// list of operations to perform, using the different fields in the TxnOp structure -// to define operations. If any operation fails, none of the changes are applied -// to the state store. -// -// Even though this is generally a write operation, we take a QueryOptions input -// and return a QueryMeta output. If the transaction contains only read ops, then -// Consul will fast-path it to a different endpoint internally which supports -// consistency controls, but not blocking. If there are write operations then -// the request will always be routed through raft and any consistency settings -// will be ignored. -// -// Here's an example: -// -// ops := KVTxnOps{ -// &KVTxnOp{ -// Verb: KVLock, -// Key: "test/lock", -// Session: "adf4238a-882b-9ddc-4a9d-5b6758e4159e", -// Value: []byte("hello"), -// }, -// &KVTxnOp{ -// Verb: KVGet, -// Key: "another/key", -// }, -// &CheckTxnOp{ -// Verb: CheckSet, -// HealthCheck: HealthCheck{ -// Node: "foo", -// CheckID: "redis:a", -// Name: "Redis Health Check", -// Status: "passing", -// }, -// } -// } -// ok, response, _, err := kv.Txn(&ops, nil) -// -// If there is a problem making the transaction request then an error will be -// returned. Otherwise, the ok value will be true if the transaction succeeded -// or false if it was rolled back. The response is a structured return value which -// will have the outcome of the transaction. Its Results member will have entries -// for each operation. For KV operations, Deleted keys will have a nil entry in the -// results, and to save space, the Value of each key in the Results will be nil -// unless the operation is a KVGet. If the transaction was rolled back, the Errors -// member will have entries referencing the index of the operation that failed -// along with an error message. -func (t *Txn) Txn(txn TxnOps, q *QueryOptions) (bool, *TxnResponse, *QueryMeta, error) { - return t.c.txn(txn, q) -} - -func (c *Client) txn(txn TxnOps, q *QueryOptions) (bool, *TxnResponse, *QueryMeta, error) { - r := c.newRequest("PUT", "/v1/txn") - r.setQueryOptions(q) - - r.obj = txn - rtt, resp, err := c.doRequest(r) - if err != nil { - return false, nil, nil, err - } - defer closeResponseBody(resp) - - qm := &QueryMeta{} - parseQueryMeta(resp, qm) - qm.RequestTime = rtt - - if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusConflict { - var txnResp TxnResponse - if err := decodeBody(resp, &txnResp); err != nil { - return false, nil, nil, err - } - - return resp.StatusCode == http.StatusOK, &txnResp, qm, nil - } - - var buf bytes.Buffer - if _, err := io.Copy(&buf, resp.Body); err != nil { - return false, nil, nil, fmt.Errorf("Failed to read response: %v", err) - } - return false, nil, nil, fmt.Errorf("Failed request: %s", buf.String()) -} diff --git a/vendor/github.com/hashicorp/errwrap/LICENSE b/vendor/github.com/hashicorp/errwrap/LICENSE deleted file mode 100644 index c33dcc7c9..000000000 --- a/vendor/github.com/hashicorp/errwrap/LICENSE +++ /dev/null @@ -1,354 +0,0 @@ -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. “Contributor” - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. “Contributor Version” - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor’s Contribution. - -1.3. “Contribution” - - means Covered Software of a particular Contributor. - -1.4. “Covered Software” - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. “Incompatible With Secondary Licenses” - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of version - 1.1 or earlier of the License, but not also under the terms of a - Secondary License. - -1.6. “Executable Form” - - means any form of the work other than Source Code Form. - -1.7. “Larger Work” - - means a work that combines Covered Software with other material, in a separate - file or files, that is not Covered Software. - -1.8. “License” - - means this document. - -1.9. “Licensable” - - means having the right to grant, to the maximum extent possible, whether at the - time of the initial grant or subsequently, any and all of the rights conveyed by - this License. - -1.10. “Modifications” - - means any of the following: - - a. any file in Source Code Form that results from an addition to, deletion - from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. “Patent Claims” of a Contributor - - means any patent claim(s), including without limitation, method, process, - and apparatus claims, in any patent Licensable by such Contributor that - would be infringed, but for the grant of the License, by the making, - using, selling, offering for sale, having made, import, or transfer of - either its Contributions or its Contributor Version. - -1.12. “Secondary License” - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. “Source Code Form” - - means the form of the work preferred for making modifications. - -1.14. “You” (or “Your”) - - means an individual or a legal entity exercising rights under this - License. For legal entities, “You” includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, “control” means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or as - part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its Contributions - or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution become - effective for each Contribution on the date the Contributor first distributes - such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under this - License. No additional rights or licenses will be implied from the distribution - or licensing of Covered Software under this License. Notwithstanding Section - 2.1(b) above, no patent license is granted by a Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party’s - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of its - Contributions. - - This License does not grant any rights in the trademarks, service marks, or - logos of any Contributor (except as may be necessary to comply with the - notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this License - (see Section 10.2) or under the terms of a Secondary License (if permitted - under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its Contributions - are its original creation(s) or it has sufficient rights to grant the - rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under applicable - copyright doctrines of fair use, fair dealing, or other equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under the - terms of this License. You must inform recipients that the Source Code Form - of the Covered Software is governed by the terms of this License, and how - they can obtain a copy of this License. You may not attempt to alter or - restrict the recipients’ rights in the Source Code Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this License, - or sublicense it under different terms, provided that the license for - the Executable Form does not attempt to limit or alter the recipients’ - rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for the - Covered Software. If the Larger Work is a combination of Covered Software - with a work governed by one or more Secondary Licenses, and the Covered - Software is not Incompatible With Secondary Licenses, this License permits - You to additionally distribute such Covered Software under the terms of - such Secondary License(s), so that the recipient of the Larger Work may, at - their option, further distribute the Covered Software under the terms of - either this License or such Secondary License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices (including - copyright notices, patent notices, disclaimers of warranty, or limitations - of liability) contained within the Source Code Form of the Covered - Software, except that You may alter any license notices to the extent - required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on behalf - of any Contributor. You must make it absolutely clear that any such - warranty, support, indemnity, or liability obligation is offered by You - alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, judicial - order, or regulation then You must: (a) comply with the terms of this License - to the maximum extent possible; and (b) describe the limitations and the code - they affect. Such description must be placed in a text file included with all - distributions of the Covered Software under this License. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing basis, - if such Contributor fails to notify You of the non-compliance by some - reasonable means prior to 60 days after You have come back into compliance. - Moreover, Your grants from a particular Contributor are reinstated on an - ongoing basis if such Contributor notifies You of the non-compliance by - some reasonable means, this is the first time You have received notice of - non-compliance with this License from such Contributor, and You become - compliant prior to 30 days after Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, counter-claims, - and cross-claims) alleging that a Contributor Version directly or - indirectly infringes any patent, then the rights granted to You by any and - all Contributors for the Covered Software under Section 2.1 of this License - shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an “as is” basis, without - warranty of any kind, either expressed, implied, or statutory, including, - without limitation, warranties that the Covered Software is free of defects, - merchantable, fit for a particular purpose or non-infringing. The entire - risk as to the quality and performance of the Covered Software is with You. - Should any Covered Software prove defective in any respect, You (not any - Contributor) assume the cost of any necessary servicing, repair, or - correction. This disclaimer of warranty constitutes an essential part of this - License. No use of any Covered Software is authorized under this License - except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from such - party’s negligence to the extent applicable law prohibits such limitation. - Some jurisdictions do not allow the exclusion or limitation of incidental or - consequential damages, so this exclusion and limitation may not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts of - a jurisdiction where the defendant maintains its principal place of business - and such litigation shall be governed by laws of that jurisdiction, without - reference to its conflict-of-law provisions. Nothing in this Section shall - prevent a party’s ability to bring cross-claims or counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject matter - hereof. If any provision of this License is held to be unenforceable, such - provision shall be reformed only to the extent necessary to make it - enforceable. Any law or regulation which provides that the language of a - contract shall be construed against the drafter shall not be used to construe - this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version of - the License under which You originally received the Covered Software, or - under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a modified - version of this License if you rename the license and remove any - references to the name of the license steward (except to note that such - modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses - If You choose to distribute Source Code Form that is Incompatible With - Secondary Licenses under the terms of this version of the License, the - notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, then -You may include the notice in a location (such as a LICENSE file in a relevant -directory) where a recipient would be likely to look for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - “Incompatible With Secondary Licenses” Notice - - This Source Code Form is “Incompatible - With Secondary Licenses”, as defined by - the Mozilla Public License, v. 2.0. - diff --git a/vendor/github.com/hashicorp/errwrap/README.md b/vendor/github.com/hashicorp/errwrap/README.md deleted file mode 100644 index 444df08f8..000000000 --- a/vendor/github.com/hashicorp/errwrap/README.md +++ /dev/null @@ -1,89 +0,0 @@ -# errwrap - -`errwrap` is a package for Go that formalizes the pattern of wrapping errors -and checking if an error contains another error. - -There is a common pattern in Go of taking a returned `error` value and -then wrapping it (such as with `fmt.Errorf`) before returning it. The problem -with this pattern is that you completely lose the original `error` structure. - -Arguably the _correct_ approach is that you should make a custom structure -implementing the `error` interface, and have the original error as a field -on that structure, such [as this example](http://golang.org/pkg/os/#PathError). -This is a good approach, but you have to know the entire chain of possible -rewrapping that happens, when you might just care about one. - -`errwrap` formalizes this pattern (it doesn't matter what approach you use -above) by giving a single interface for wrapping errors, checking if a specific -error is wrapped, and extracting that error. - -## Installation and Docs - -Install using `go get github.com/hashicorp/errwrap`. - -Full documentation is available at -http://godoc.org/github.com/hashicorp/errwrap - -## Usage - -#### Basic Usage - -Below is a very basic example of its usage: - -```go -// A function that always returns an error, but wraps it, like a real -// function might. -func tryOpen() error { - _, err := os.Open("/i/dont/exist") - if err != nil { - return errwrap.Wrapf("Doesn't exist: {{err}}", err) - } - - return nil -} - -func main() { - err := tryOpen() - - // We can use the Contains helpers to check if an error contains - // another error. It is safe to do this with a nil error, or with - // an error that doesn't even use the errwrap package. - if errwrap.Contains(err, "does not exist") { - // Do something - } - if errwrap.ContainsType(err, new(os.PathError)) { - // Do something - } - - // Or we can use the associated `Get` functions to just extract - // a specific error. This would return nil if that specific error doesn't - // exist. - perr := errwrap.GetType(err, new(os.PathError)) -} -``` - -#### Custom Types - -If you're already making custom types that properly wrap errors, then -you can get all the functionality of `errwraps.Contains` and such by -implementing the `Wrapper` interface with just one function. Example: - -```go -type AppError { - Code ErrorCode - Err error -} - -func (e *AppError) WrappedErrors() []error { - return []error{e.Err} -} -``` - -Now this works: - -```go -err := &AppError{Err: fmt.Errorf("an error")} -if errwrap.ContainsType(err, fmt.Errorf("")) { - // This will work! -} -``` diff --git a/vendor/github.com/hashicorp/errwrap/errwrap.go b/vendor/github.com/hashicorp/errwrap/errwrap.go deleted file mode 100644 index 44e368e56..000000000 --- a/vendor/github.com/hashicorp/errwrap/errwrap.go +++ /dev/null @@ -1,178 +0,0 @@ -// Package errwrap implements methods to formalize error wrapping in Go. -// -// All of the top-level functions that take an `error` are built to be able -// to take any error, not just wrapped errors. This allows you to use errwrap -// without having to type-check and type-cast everywhere. -package errwrap - -import ( - "errors" - "reflect" - "strings" -) - -// WalkFunc is the callback called for Walk. -type WalkFunc func(error) - -// Wrapper is an interface that can be implemented by custom types to -// have all the Contains, Get, etc. functions in errwrap work. -// -// When Walk reaches a Wrapper, it will call the callback for every -// wrapped error in addition to the wrapper itself. Since all the top-level -// functions in errwrap use Walk, this means that all those functions work -// with your custom type. -type Wrapper interface { - WrappedErrors() []error -} - -// Wrap defines that outer wraps inner, returning an error type that -// can be cleanly used with the other methods in this package, such as -// Contains, GetAll, etc. -// -// This function won't modify the error message at all (the outer message -// will be used). -func Wrap(outer, inner error) error { - return &wrappedError{ - Outer: outer, - Inner: inner, - } -} - -// Wrapf wraps an error with a formatting message. This is similar to using -// `fmt.Errorf` to wrap an error. If you're using `fmt.Errorf` to wrap -// errors, you should replace it with this. -// -// format is the format of the error message. The string '{{err}}' will -// be replaced with the original error message. -// -// Deprecated: Use fmt.Errorf() -func Wrapf(format string, err error) error { - outerMsg := "" - if err != nil { - outerMsg = err.Error() - } - - outer := errors.New(strings.Replace( - format, "{{err}}", outerMsg, -1)) - - return Wrap(outer, err) -} - -// Contains checks if the given error contains an error with the -// message msg. If err is not a wrapped error, this will always return -// false unless the error itself happens to match this msg. -func Contains(err error, msg string) bool { - return len(GetAll(err, msg)) > 0 -} - -// ContainsType checks if the given error contains an error with -// the same concrete type as v. If err is not a wrapped error, this will -// check the err itself. -func ContainsType(err error, v interface{}) bool { - return len(GetAllType(err, v)) > 0 -} - -// Get is the same as GetAll but returns the deepest matching error. -func Get(err error, msg string) error { - es := GetAll(err, msg) - if len(es) > 0 { - return es[len(es)-1] - } - - return nil -} - -// GetType is the same as GetAllType but returns the deepest matching error. -func GetType(err error, v interface{}) error { - es := GetAllType(err, v) - if len(es) > 0 { - return es[len(es)-1] - } - - return nil -} - -// GetAll gets all the errors that might be wrapped in err with the -// given message. The order of the errors is such that the outermost -// matching error (the most recent wrap) is index zero, and so on. -func GetAll(err error, msg string) []error { - var result []error - - Walk(err, func(err error) { - if err.Error() == msg { - result = append(result, err) - } - }) - - return result -} - -// GetAllType gets all the errors that are the same type as v. -// -// The order of the return value is the same as described in GetAll. -func GetAllType(err error, v interface{}) []error { - var result []error - - var search string - if v != nil { - search = reflect.TypeOf(v).String() - } - Walk(err, func(err error) { - var needle string - if err != nil { - needle = reflect.TypeOf(err).String() - } - - if needle == search { - result = append(result, err) - } - }) - - return result -} - -// Walk walks all the wrapped errors in err and calls the callback. If -// err isn't a wrapped error, this will be called once for err. If err -// is a wrapped error, the callback will be called for both the wrapper -// that implements error as well as the wrapped error itself. -func Walk(err error, cb WalkFunc) { - if err == nil { - return - } - - switch e := err.(type) { - case *wrappedError: - cb(e.Outer) - Walk(e.Inner, cb) - case Wrapper: - cb(err) - - for _, err := range e.WrappedErrors() { - Walk(err, cb) - } - case interface{ Unwrap() error }: - cb(err) - Walk(e.Unwrap(), cb) - default: - cb(err) - } -} - -// wrappedError is an implementation of error that has both the -// outer and inner errors. -type wrappedError struct { - Outer error - Inner error -} - -func (w *wrappedError) Error() string { - return w.Outer.Error() -} - -func (w *wrappedError) WrappedErrors() []error { - return []error{w.Outer, w.Inner} -} - -func (w *wrappedError) Unwrap() error { - return w.Inner -} diff --git a/vendor/github.com/hashicorp/go-cleanhttp/LICENSE b/vendor/github.com/hashicorp/go-cleanhttp/LICENSE deleted file mode 100644 index e87a115e4..000000000 --- a/vendor/github.com/hashicorp/go-cleanhttp/LICENSE +++ /dev/null @@ -1,363 +0,0 @@ -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. "Contributor" - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. "Contributor Version" - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the terms of - a Secondary License. - -1.6. "Executable Form" - - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - - means a work that combines Covered Software with other material, in a - separate file or files, that is not Covered Software. - -1.8. "License" - - means this document. - -1.9. "Licensable" - - means having the right to grant, to the maximum extent possible, whether - at the time of the initial grant or subsequently, any and all of the - rights conveyed by this License. - -1.10. "Modifications" - - means any of the following: - - a. any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. "Patent Claims" of a Contributor - - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the License, - by the making, using, selling, offering for sale, having made, import, - or transfer of either its Contributions or its Contributor Version. - -1.12. "Secondary License" - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. "Source Code Form" - - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, "control" means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution - become effective for each Contribution on the date the Contributor first - distributes such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under - this License. No additional rights or licenses will be implied from the - distribution or licensing of Covered Software under this License. - Notwithstanding Section 2.1(b) above, no patent license is granted by a - Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of - its Contributions. - - This License does not grant any rights in the trademarks, service marks, - or logos of any Contributor (except as may be necessary to comply with - the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this - License (see Section 10.2) or under the terms of a Secondary License (if - permitted under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its - Contributions are its original creation(s) or it has sufficient rights to - grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under - applicable copyright doctrines of fair use, fair dealing, or other - equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under - the terms of this License. You must inform recipients that the Source - Code Form of the Covered Software is governed by the terms of this - License, and how they can obtain a copy of this License. You may not - attempt to alter or restrict the recipients' rights in the Source Code - Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter the - recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for - the Covered Software. If the Larger Work is a combination of Covered - Software with a work governed by one or more Secondary Licenses, and the - Covered Software is not Incompatible With Secondary Licenses, this - License permits You to additionally distribute such Covered Software - under the terms of such Secondary License(s), so that the recipient of - the Larger Work may, at their option, further distribute the Covered - Software under the terms of either this License or such Secondary - License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices - (including copyright notices, patent notices, disclaimers of warranty, or - limitations of liability) contained within the Source Code Form of the - Covered Software, except that You may alter any license notices to the - extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on - behalf of any Contributor. You must make it absolutely clear that any - such warranty, support, indemnity, or liability obligation is offered by - You alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, - judicial order, or regulation then You must: (a) comply with the terms of - this License to the maximum extent possible; and (b) describe the - limitations and the code they affect. Such description must be placed in a - text file included with all distributions of the Covered Software under - this License. Except to the extent prohibited by statute or regulation, - such description must be sufficiently detailed for a recipient of ordinary - skill to be able to understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing - basis, if such Contributor fails to notify You of the non-compliance by - some reasonable means prior to 60 days after You have come back into - compliance. Moreover, Your grants from a particular Contributor are - reinstated on an ongoing basis if such Contributor notifies You of the - non-compliance by some reasonable means, this is the first time You have - received notice of non-compliance with this License from such - Contributor, and You become compliant prior to 30 days after Your receipt - of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, - counter-claims, and cross-claims) alleging that a Contributor Version - directly or indirectly infringes any patent, then the rights granted to - You by any and all Contributors for the Covered Software under Section - 2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an "as is" basis, - without warranty of any kind, either expressed, implied, or statutory, - including, without limitation, warranties that the Covered Software is free - of defects, merchantable, fit for a particular purpose or non-infringing. - The entire risk as to the quality and performance of the Covered Software - is with You. Should any Covered Software prove defective in any respect, - You (not any Contributor) assume the cost of any necessary servicing, - repair, or correction. This disclaimer of warranty constitutes an essential - part of this License. No use of any Covered Software is authorized under - this License except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from - such party's negligence to the extent applicable law prohibits such - limitation. Some jurisdictions do not allow the exclusion or limitation of - incidental or consequential damages, so this exclusion and limitation may - not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts - of a jurisdiction where the defendant maintains its principal place of - business and such litigation shall be governed by laws of that - jurisdiction, without reference to its conflict-of-law provisions. Nothing - in this Section shall prevent a party's ability to bring cross-claims or - counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. Any law or regulation which provides that - the language of a contract shall be construed against the drafter shall not - be used to construe this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version - of the License under which You originally received the Covered Software, - or under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a - modified version of this License if you rename the license and remove - any references to the name of the license steward (except to note that - such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary - Licenses If You choose to distribute Source Code Form that is - Incompatible With Secondary Licenses under the terms of this version of - the License, the notice described in Exhibit B of this License must be - attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, -then You may include the notice in a location (such as a LICENSE file in a -relevant directory) where a recipient would be likely to look for such a -notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice - - This Source Code Form is "Incompatible - With Secondary Licenses", as defined by - the Mozilla Public License, v. 2.0. - diff --git a/vendor/github.com/hashicorp/go-cleanhttp/README.md b/vendor/github.com/hashicorp/go-cleanhttp/README.md deleted file mode 100644 index 036e5313f..000000000 --- a/vendor/github.com/hashicorp/go-cleanhttp/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# cleanhttp - -Functions for accessing "clean" Go http.Client values - -------------- - -The Go standard library contains a default `http.Client` called -`http.DefaultClient`. It is a common idiom in Go code to start with -`http.DefaultClient` and tweak it as necessary, and in fact, this is -encouraged; from the `http` package documentation: - -> The Client's Transport typically has internal state (cached TCP connections), -so Clients should be reused instead of created as needed. Clients are safe for -concurrent use by multiple goroutines. - -Unfortunately, this is a shared value, and it is not uncommon for libraries to -assume that they are free to modify it at will. With enough dependencies, it -can be very easy to encounter strange problems and race conditions due to -manipulation of this shared value across libraries and goroutines (clients are -safe for concurrent use, but writing values to the client struct itself is not -protected). - -Making things worse is the fact that a bare `http.Client` will use a default -`http.Transport` called `http.DefaultTransport`, which is another global value -that behaves the same way. So it is not simply enough to replace -`http.DefaultClient` with `&http.Client{}`. - -This repository provides some simple functions to get a "clean" `http.Client` --- one that uses the same default values as the Go standard library, but -returns a client that does not share any state with other clients. diff --git a/vendor/github.com/hashicorp/go-cleanhttp/cleanhttp.go b/vendor/github.com/hashicorp/go-cleanhttp/cleanhttp.go deleted file mode 100644 index fe28d15b6..000000000 --- a/vendor/github.com/hashicorp/go-cleanhttp/cleanhttp.go +++ /dev/null @@ -1,58 +0,0 @@ -package cleanhttp - -import ( - "net" - "net/http" - "runtime" - "time" -) - -// DefaultTransport returns a new http.Transport with similar default values to -// http.DefaultTransport, but with idle connections and keepalives disabled. -func DefaultTransport() *http.Transport { - transport := DefaultPooledTransport() - transport.DisableKeepAlives = true - transport.MaxIdleConnsPerHost = -1 - return transport -} - -// DefaultPooledTransport returns a new http.Transport with similar default -// values to http.DefaultTransport. Do not use this for transient transports as -// it can leak file descriptors over time. Only use this for transports that -// will be re-used for the same host(s). -func DefaultPooledTransport() *http.Transport { - transport := &http.Transport{ - Proxy: http.ProxyFromEnvironment, - DialContext: (&net.Dialer{ - Timeout: 30 * time.Second, - KeepAlive: 30 * time.Second, - DualStack: true, - }).DialContext, - MaxIdleConns: 100, - IdleConnTimeout: 90 * time.Second, - TLSHandshakeTimeout: 10 * time.Second, - ExpectContinueTimeout: 1 * time.Second, - ForceAttemptHTTP2: true, - MaxIdleConnsPerHost: runtime.GOMAXPROCS(0) + 1, - } - return transport -} - -// DefaultClient returns a new http.Client with similar default values to -// http.Client, but with a non-shared Transport, idle connections disabled, and -// keepalives disabled. -func DefaultClient() *http.Client { - return &http.Client{ - Transport: DefaultTransport(), - } -} - -// DefaultPooledClient returns a new http.Client with similar default values to -// http.Client, but with a shared Transport. Do not use this function for -// transient clients as it can leak file descriptors over time. Only use this -// for clients that will be re-used for the same host(s). -func DefaultPooledClient() *http.Client { - return &http.Client{ - Transport: DefaultPooledTransport(), - } -} diff --git a/vendor/github.com/hashicorp/go-cleanhttp/doc.go b/vendor/github.com/hashicorp/go-cleanhttp/doc.go deleted file mode 100644 index 05841092a..000000000 --- a/vendor/github.com/hashicorp/go-cleanhttp/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -// Package cleanhttp offers convenience utilities for acquiring "clean" -// http.Transport and http.Client structs. -// -// Values set on http.DefaultClient and http.DefaultTransport affect all -// callers. This can have detrimental effects, esepcially in TLS contexts, -// where client or root certificates set to talk to multiple endpoints can end -// up displacing each other, leading to hard-to-debug issues. This package -// provides non-shared http.Client and http.Transport structs to ensure that -// the configuration will not be overwritten by other parts of the application -// or dependencies. -// -// The DefaultClient and DefaultTransport functions disable idle connections -// and keepalives. Without ensuring that idle connections are closed before -// garbage collection, short-term clients/transports can leak file descriptors, -// eventually leading to "too many open files" errors. If you will be -// connecting to the same hosts repeatedly from the same client, you can use -// DefaultPooledClient to receive a client that has connection pooling -// semantics similar to http.DefaultClient. -// -package cleanhttp diff --git a/vendor/github.com/hashicorp/go-cleanhttp/handlers.go b/vendor/github.com/hashicorp/go-cleanhttp/handlers.go deleted file mode 100644 index 3c845dc0d..000000000 --- a/vendor/github.com/hashicorp/go-cleanhttp/handlers.go +++ /dev/null @@ -1,48 +0,0 @@ -package cleanhttp - -import ( - "net/http" - "strings" - "unicode" -) - -// HandlerInput provides input options to cleanhttp's handlers -type HandlerInput struct { - ErrStatus int -} - -// PrintablePathCheckHandler is a middleware that ensures the request path -// contains only printable runes. -func PrintablePathCheckHandler(next http.Handler, input *HandlerInput) http.Handler { - // Nil-check on input to make it optional - if input == nil { - input = &HandlerInput{ - ErrStatus: http.StatusBadRequest, - } - } - - // Default to http.StatusBadRequest on error - if input.ErrStatus == 0 { - input.ErrStatus = http.StatusBadRequest - } - - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r != nil { - // Check URL path for non-printable characters - idx := strings.IndexFunc(r.URL.Path, func(c rune) bool { - return !unicode.IsPrint(c) - }) - - if idx != -1 { - w.WriteHeader(input.ErrStatus) - return - } - - if next != nil { - next.ServeHTTP(w, r) - } - } - - return - }) -} diff --git a/vendor/github.com/hashicorp/go-hclog/.gitignore b/vendor/github.com/hashicorp/go-hclog/.gitignore deleted file mode 100644 index 42cc4105f..000000000 --- a/vendor/github.com/hashicorp/go-hclog/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.idea* \ No newline at end of file diff --git a/vendor/github.com/hashicorp/go-hclog/LICENSE b/vendor/github.com/hashicorp/go-hclog/LICENSE deleted file mode 100644 index 9938fb50e..000000000 --- a/vendor/github.com/hashicorp/go-hclog/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2017 HashiCorp, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/hashicorp/go-hclog/README.md b/vendor/github.com/hashicorp/go-hclog/README.md deleted file mode 100644 index 21a17c5af..000000000 --- a/vendor/github.com/hashicorp/go-hclog/README.md +++ /dev/null @@ -1,148 +0,0 @@ -# go-hclog - -[![Go Documentation](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)][godocs] - -[godocs]: https://godoc.org/github.com/hashicorp/go-hclog - -`go-hclog` is a package for Go that provides a simple key/value logging -interface for use in development and production environments. - -It provides logging levels that provide decreased output based upon the -desired amount of output, unlike the standard library `log` package. - -It provides `Printf` style logging of values via `hclog.Fmt()`. - -It provides a human readable output mode for use in development as well as -JSON output mode for production. - -## Stability Note - -This library has reached 1.0 stability. Its API can be considered solidified -and promised through future versions. - -## Installation and Docs - -Install using `go get github.com/hashicorp/go-hclog`. - -Full documentation is available at -http://godoc.org/github.com/hashicorp/go-hclog - -## Usage - -### Use the global logger - -```go -hclog.Default().Info("hello world") -``` - -```text -2017-07-05T16:15:55.167-0700 [INFO ] hello world -``` - -(Note timestamps are removed in future examples for brevity.) - -### Create a new logger - -```go -appLogger := hclog.New(&hclog.LoggerOptions{ - Name: "my-app", - Level: hclog.LevelFromString("DEBUG"), -}) -``` - -### Emit an Info level message with 2 key/value pairs - -```go -input := "5.5" -_, err := strconv.ParseInt(input, 10, 32) -if err != nil { - appLogger.Info("Invalid input for ParseInt", "input", input, "error", err) -} -``` - -```text -... [INFO ] my-app: Invalid input for ParseInt: input=5.5 error="strconv.ParseInt: parsing "5.5": invalid syntax" -``` - -### Create a new Logger for a major subsystem - -```go -subsystemLogger := appLogger.Named("transport") -subsystemLogger.Info("we are transporting something") -``` - -```text -... [INFO ] my-app.transport: we are transporting something -``` - -Notice that logs emitted by `subsystemLogger` contain `my-app.transport`, -reflecting both the application and subsystem names. - -### Create a new Logger with fixed key/value pairs - -Using `With()` will include a specific key-value pair in all messages emitted -by that logger. - -```go -requestID := "5fb446b6-6eba-821d-df1b-cd7501b6a363" -requestLogger := subsystemLogger.With("request", requestID) -requestLogger.Info("we are transporting a request") -``` - -```text -... [INFO ] my-app.transport: we are transporting a request: request=5fb446b6-6eba-821d-df1b-cd7501b6a363 -``` - -This allows sub Loggers to be context specific without having to thread that -into all the callers. - -### Using `hclog.Fmt()` - -```go -totalBandwidth := 200 -appLogger.Info("total bandwidth exceeded", "bandwidth", hclog.Fmt("%d GB/s", totalBandwidth)) -``` - -```text -... [INFO ] my-app: total bandwidth exceeded: bandwidth="200 GB/s" -``` - -### Use this with code that uses the standard library logger - -If you want to use the standard library's `log.Logger` interface you can wrap -`hclog.Logger` by calling the `StandardLogger()` method. This allows you to use -it with the familiar `Println()`, `Printf()`, etc. For example: - -```go -stdLogger := appLogger.StandardLogger(&hclog.StandardLoggerOptions{ - InferLevels: true, -}) -// Printf() is provided by stdlib log.Logger interface, not hclog.Logger -stdLogger.Printf("[DEBUG] %+v", stdLogger) -``` - -```text -... [DEBUG] my-app: &{mu:{state:0 sema:0} prefix: flag:0 out:0xc42000a0a0 buf:[]} -``` - -Alternatively, you may configure the system-wide logger: - -```go -// log the standard logger from 'import "log"' -log.SetOutput(appLogger.StandardWriter(&hclog.StandardLoggerOptions{InferLevels: true})) -log.SetPrefix("") -log.SetFlags(0) - -log.Printf("[DEBUG] %d", 42) -``` - -```text -... [DEBUG] my-app: 42 -``` - -Notice that if `appLogger` is initialized with the `INFO` log level _and_ you -specify `InferLevels: true`, you will not see any output here. You must change -`appLogger` to `DEBUG` to see output. See the docs for more information. - -If the log lines start with a timestamp you can use the -`InferLevelsWithTimestamp` option to try and ignore them. diff --git a/vendor/github.com/hashicorp/go-hclog/colorize_unix.go b/vendor/github.com/hashicorp/go-hclog/colorize_unix.go deleted file mode 100644 index d00816b38..000000000 --- a/vendor/github.com/hashicorp/go-hclog/colorize_unix.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MIT - -//go:build !windows -// +build !windows - -package hclog - -import ( - "github.com/mattn/go-isatty" -) - -// hasFD is used to check if the writer has an Fd value to check -// if it's a terminal. -type hasFD interface { - Fd() uintptr -} - -// setColorization will mutate the values of this logger -// to appropriately configure colorization options. It provides -// a wrapper to the output stream on Windows systems. -func (l *intLogger) setColorization(opts *LoggerOptions) { - if opts.Color != AutoColor { - return - } - - if sc, ok := l.writer.w.(SupportsColor); ok { - if !sc.SupportsColor() { - l.headerColor = ColorOff - l.writer.color = ColorOff - } - return - } - - fi, ok := l.writer.w.(hasFD) - if !ok { - return - } - - if !isatty.IsTerminal(fi.Fd()) { - l.headerColor = ColorOff - l.writer.color = ColorOff - } -} diff --git a/vendor/github.com/hashicorp/go-hclog/colorize_windows.go b/vendor/github.com/hashicorp/go-hclog/colorize_windows.go deleted file mode 100644 index 2c3fb9ea6..000000000 --- a/vendor/github.com/hashicorp/go-hclog/colorize_windows.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MIT - -//go:build windows -// +build windows - -package hclog - -import ( - "os" - - colorable "github.com/mattn/go-colorable" -) - -// setColorization will mutate the values of this logger -// to appropriately configure colorization options. It provides -// a wrapper to the output stream on Windows systems. -func (l *intLogger) setColorization(opts *LoggerOptions) { - if opts.Color == ColorOff { - return - } - - fi, ok := l.writer.w.(*os.File) - if !ok { - l.writer.color = ColorOff - l.headerColor = ColorOff - return - } - - cfi := colorable.NewColorable(fi) - - // NewColorable detects if color is possible and if it's not, then it - // returns the original value. So we can test if we got the original - // value back to know if color is possible. - if cfi == fi { - l.writer.color = ColorOff - l.headerColor = ColorOff - } else { - l.writer.w = cfi - } -} diff --git a/vendor/github.com/hashicorp/go-hclog/context.go b/vendor/github.com/hashicorp/go-hclog/context.go deleted file mode 100644 index eb5aba556..000000000 --- a/vendor/github.com/hashicorp/go-hclog/context.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MIT - -package hclog - -import ( - "context" -) - -// WithContext inserts a logger into the context and is retrievable -// with FromContext. The optional args can be set with the same syntax as -// Logger.With to set fields on the inserted logger. This will not modify -// the logger argument in-place. -func WithContext(ctx context.Context, logger Logger, args ...interface{}) context.Context { - // While we could call logger.With even with zero args, we have this - // check to avoid unnecessary allocations around creating a copy of a - // logger. - if len(args) > 0 { - logger = logger.With(args...) - } - - return context.WithValue(ctx, contextKey, logger) -} - -// FromContext returns a logger from the context. This will return L() -// (the default logger) if no logger is found in the context. Therefore, -// this will never return a nil value. -func FromContext(ctx context.Context) Logger { - logger, _ := ctx.Value(contextKey).(Logger) - if logger == nil { - return L() - } - - return logger -} - -// Unexported new type so that our context key never collides with another. -type contextKeyType struct{} - -// contextKey is the key used for the context to store the logger. -var contextKey = contextKeyType{} diff --git a/vendor/github.com/hashicorp/go-hclog/exclude.go b/vendor/github.com/hashicorp/go-hclog/exclude.go deleted file mode 100644 index 4b73ba553..000000000 --- a/vendor/github.com/hashicorp/go-hclog/exclude.go +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MIT - -package hclog - -import ( - "regexp" - "strings" -) - -// ExcludeByMessage provides a simple way to build a list of log messages that -// can be queried and matched. This is meant to be used with the Exclude -// option on Options to suppress log messages. This does not hold any mutexs -// within itself, so normal usage would be to Add entries at setup and none after -// Exclude is going to be called. Exclude is called with a mutex held within -// the Logger, so that doesn't need to use a mutex. Example usage: -// -// f := new(ExcludeByMessage) -// f.Add("Noisy log message text") -// appLogger.Exclude = f.Exclude -type ExcludeByMessage struct { - messages map[string]struct{} -} - -// Add a message to be filtered. Do not call this after Exclude is to be called -// due to concurrency issues. -func (f *ExcludeByMessage) Add(msg string) { - if f.messages == nil { - f.messages = make(map[string]struct{}) - } - - f.messages[msg] = struct{}{} -} - -// Return true if the given message should be included -func (f *ExcludeByMessage) Exclude(level Level, msg string, args ...interface{}) bool { - _, ok := f.messages[msg] - return ok -} - -// ExcludeByPrefix is a simple type to match a message string that has a common prefix. -type ExcludeByPrefix string - -// Matches an message that starts with the prefix. -func (p ExcludeByPrefix) Exclude(level Level, msg string, args ...interface{}) bool { - return strings.HasPrefix(msg, string(p)) -} - -// ExcludeByRegexp takes a regexp and uses it to match a log message string. If it matches -// the log entry is excluded. -type ExcludeByRegexp struct { - Regexp *regexp.Regexp -} - -// Exclude the log message if the message string matches the regexp -func (e ExcludeByRegexp) Exclude(level Level, msg string, args ...interface{}) bool { - return e.Regexp.MatchString(msg) -} - -// ExcludeFuncs is a slice of functions that will called to see if a log entry -// should be filtered or not. It stops calling functions once at least one returns -// true. -type ExcludeFuncs []func(level Level, msg string, args ...interface{}) bool - -// Calls each function until one of them returns true -func (ff ExcludeFuncs) Exclude(level Level, msg string, args ...interface{}) bool { - for _, f := range ff { - if f(level, msg, args...) { - return true - } - } - - return false -} diff --git a/vendor/github.com/hashicorp/go-hclog/global.go b/vendor/github.com/hashicorp/go-hclog/global.go deleted file mode 100644 index a7403f593..000000000 --- a/vendor/github.com/hashicorp/go-hclog/global.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MIT - -package hclog - -import ( - "sync" - "time" -) - -var ( - protect sync.Once - def Logger - - // DefaultOptions is used to create the Default logger. These are read - // only when the Default logger is created, so set them as soon as the - // process starts. - DefaultOptions = &LoggerOptions{ - Level: DefaultLevel, - Output: DefaultOutput, - TimeFn: time.Now, - } -) - -// Default returns a globally held logger. This can be a good starting -// place, and then you can use .With() and .Named() to create sub-loggers -// to be used in more specific contexts. -// The value of the Default logger can be set via SetDefault() or by -// changing the options in DefaultOptions. -// -// This method is goroutine safe, returning a global from memory, but -// care should be used if SetDefault() is called it random times -// in the program as that may result in race conditions and an unexpected -// Logger being returned. -func Default() Logger { - protect.Do(func() { - // If SetDefault was used before Default() was called, we need to - // detect that here. - if def == nil { - def = New(DefaultOptions) - } - }) - - return def -} - -// L is a short alias for Default(). -func L() Logger { - return Default() -} - -// SetDefault changes the logger to be returned by Default()and L() -// to the one given. This allows packages to use the default logger -// and have higher level packages change it to match the execution -// environment. It returns any old default if there is one. -// -// NOTE: This is expected to be called early in the program to setup -// a default logger. As such, it does not attempt to make itself -// not racy with regard to the value of the default logger. Ergo -// if it is called in goroutines, you may experience race conditions -// with other goroutines retrieving the default logger. Basically, -// don't do that. -func SetDefault(log Logger) Logger { - old := def - def = log - return old -} diff --git a/vendor/github.com/hashicorp/go-hclog/interceptlogger.go b/vendor/github.com/hashicorp/go-hclog/interceptlogger.go deleted file mode 100644 index e9b1c1885..000000000 --- a/vendor/github.com/hashicorp/go-hclog/interceptlogger.go +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MIT - -package hclog - -import ( - "io" - "log" - "sync" - "sync/atomic" -) - -var _ Logger = &interceptLogger{} - -type interceptLogger struct { - Logger - - mu *sync.Mutex - sinkCount *int32 - Sinks map[SinkAdapter]struct{} -} - -func NewInterceptLogger(opts *LoggerOptions) InterceptLogger { - l := newLogger(opts) - if l.callerOffset > 0 { - // extra frames for interceptLogger.{Warn,Info,Log,etc...}, and interceptLogger.log - l.callerOffset += 2 - } - intercept := &interceptLogger{ - Logger: l, - mu: new(sync.Mutex), - sinkCount: new(int32), - Sinks: make(map[SinkAdapter]struct{}), - } - - atomic.StoreInt32(intercept.sinkCount, 0) - - return intercept -} - -func (i *interceptLogger) Log(level Level, msg string, args ...interface{}) { - i.log(level, msg, args...) -} - -// log is used to make the caller stack frame lookup consistent. If Warn,Info,etc -// all called Log then direct calls to Log would have a different stack frame -// depth. By having all the methods call the same helper we ensure the stack -// frame depth is the same. -func (i *interceptLogger) log(level Level, msg string, args ...interface{}) { - i.Logger.Log(level, msg, args...) - if atomic.LoadInt32(i.sinkCount) == 0 { - return - } - - i.mu.Lock() - defer i.mu.Unlock() - for s := range i.Sinks { - s.Accept(i.Name(), level, msg, i.retrieveImplied(args...)...) - } -} - -// Emit the message and args at TRACE level to log and sinks -func (i *interceptLogger) Trace(msg string, args ...interface{}) { - i.log(Trace, msg, args...) -} - -// Emit the message and args at DEBUG level to log and sinks -func (i *interceptLogger) Debug(msg string, args ...interface{}) { - i.log(Debug, msg, args...) -} - -// Emit the message and args at INFO level to log and sinks -func (i *interceptLogger) Info(msg string, args ...interface{}) { - i.log(Info, msg, args...) -} - -// Emit the message and args at WARN level to log and sinks -func (i *interceptLogger) Warn(msg string, args ...interface{}) { - i.log(Warn, msg, args...) -} - -// Emit the message and args at ERROR level to log and sinks -func (i *interceptLogger) Error(msg string, args ...interface{}) { - i.log(Error, msg, args...) -} - -func (i *interceptLogger) retrieveImplied(args ...interface{}) []interface{} { - top := i.Logger.ImpliedArgs() - - cp := make([]interface{}, len(top)+len(args)) - copy(cp, top) - copy(cp[len(top):], args) - - return cp -} - -// Create a new sub-Logger that a name descending from the current name. -// This is used to create a subsystem specific Logger. -// Registered sinks will subscribe to these messages as well. -func (i *interceptLogger) Named(name string) Logger { - return i.NamedIntercept(name) -} - -// Create a new sub-Logger with an explicit name. This ignores the current -// name. This is used to create a standalone logger that doesn't fall -// within the normal hierarchy. Registered sinks will subscribe -// to these messages as well. -func (i *interceptLogger) ResetNamed(name string) Logger { - return i.ResetNamedIntercept(name) -} - -// Create a new sub-Logger that a name decending from the current name. -// This is used to create a subsystem specific Logger. -// Registered sinks will subscribe to these messages as well. -func (i *interceptLogger) NamedIntercept(name string) InterceptLogger { - var sub interceptLogger - - sub = *i - sub.Logger = i.Logger.Named(name) - return &sub -} - -// Create a new sub-Logger with an explicit name. This ignores the current -// name. This is used to create a standalone logger that doesn't fall -// within the normal hierarchy. Registered sinks will subscribe -// to these messages as well. -func (i *interceptLogger) ResetNamedIntercept(name string) InterceptLogger { - var sub interceptLogger - - sub = *i - sub.Logger = i.Logger.ResetNamed(name) - return &sub -} - -// Return a sub-Logger for which every emitted log message will contain -// the given key/value pairs. This is used to create a context specific -// Logger. -func (i *interceptLogger) With(args ...interface{}) Logger { - var sub interceptLogger - - sub = *i - - sub.Logger = i.Logger.With(args...) - - return &sub -} - -// RegisterSink attaches a SinkAdapter to interceptLoggers sinks. -func (i *interceptLogger) RegisterSink(sink SinkAdapter) { - i.mu.Lock() - defer i.mu.Unlock() - - i.Sinks[sink] = struct{}{} - - atomic.AddInt32(i.sinkCount, 1) -} - -// DeregisterSink removes a SinkAdapter from interceptLoggers sinks. -func (i *interceptLogger) DeregisterSink(sink SinkAdapter) { - i.mu.Lock() - defer i.mu.Unlock() - - delete(i.Sinks, sink) - - atomic.AddInt32(i.sinkCount, -1) -} - -func (i *interceptLogger) StandardLoggerIntercept(opts *StandardLoggerOptions) *log.Logger { - return i.StandardLogger(opts) -} - -func (i *interceptLogger) StandardLogger(opts *StandardLoggerOptions) *log.Logger { - if opts == nil { - opts = &StandardLoggerOptions{} - } - - return log.New(i.StandardWriter(opts), "", 0) -} - -func (i *interceptLogger) StandardWriterIntercept(opts *StandardLoggerOptions) io.Writer { - return i.StandardWriter(opts) -} - -func (i *interceptLogger) StandardWriter(opts *StandardLoggerOptions) io.Writer { - return &stdlogAdapter{ - log: i, - inferLevels: opts.InferLevels, - inferLevelsWithTimestamp: opts.InferLevelsWithTimestamp, - forceLevel: opts.ForceLevel, - } -} - -func (i *interceptLogger) ResetOutput(opts *LoggerOptions) error { - if or, ok := i.Logger.(OutputResettable); ok { - return or.ResetOutput(opts) - } else { - return nil - } -} - -func (i *interceptLogger) ResetOutputWithFlush(opts *LoggerOptions, flushable Flushable) error { - if or, ok := i.Logger.(OutputResettable); ok { - return or.ResetOutputWithFlush(opts, flushable) - } else { - return nil - } -} diff --git a/vendor/github.com/hashicorp/go-hclog/intlogger.go b/vendor/github.com/hashicorp/go-hclog/intlogger.go deleted file mode 100644 index b45064acf..000000000 --- a/vendor/github.com/hashicorp/go-hclog/intlogger.go +++ /dev/null @@ -1,918 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MIT - -package hclog - -import ( - "bytes" - "encoding" - "encoding/json" - "errors" - "fmt" - "io" - "log" - "reflect" - "runtime" - "sort" - "strconv" - "strings" - "sync" - "sync/atomic" - "time" - "unicode" - "unicode/utf8" - - "github.com/fatih/color" -) - -// TimeFormat is the time format to use for plain (non-JSON) output. -// This is a version of RFC3339 that contains millisecond precision. -const TimeFormat = "2006-01-02T15:04:05.000Z0700" - -// TimeFormatJSON is the time format to use for JSON output. -// This is a version of RFC3339 that contains microsecond precision. -const TimeFormatJSON = "2006-01-02T15:04:05.000000Z07:00" - -// errJsonUnsupportedTypeMsg is included in log json entries, if an arg cannot be serialized to json -const errJsonUnsupportedTypeMsg = "logging contained values that don't serialize to json" - -var ( - _levelToBracket = map[Level]string{ - Debug: "[DEBUG]", - Trace: "[TRACE]", - Info: "[INFO] ", - Warn: "[WARN] ", - Error: "[ERROR]", - } - - _levelToColor = map[Level]*color.Color{ - Debug: color.New(color.FgHiWhite), - Trace: color.New(color.FgHiGreen), - Info: color.New(color.FgHiBlue), - Warn: color.New(color.FgHiYellow), - Error: color.New(color.FgHiRed), - } - - faintBoldColor = color.New(color.Faint, color.Bold) - faintColor = color.New(color.Faint) - faintMultiLinePrefix = faintColor.Sprint(" | ") - faintFieldSeparator = faintColor.Sprint("=") - faintFieldSeparatorWithNewLine = faintColor.Sprint("=\n") -) - -// Make sure that intLogger is a Logger -var _ Logger = &intLogger{} - -// intLogger is an internal logger implementation. Internal in that it is -// defined entirely by this package. -type intLogger struct { - json bool - callerOffset int - name string - timeFormat string - timeFn TimeFunction - disableTime bool - - // This is an interface so that it's shared by any derived loggers, since - // those derived loggers share the bufio.Writer as well. - mutex Locker - writer *writer - level *int32 - - headerColor ColorOption - fieldColor ColorOption - - implied []interface{} - - exclude func(level Level, msg string, args ...interface{}) bool - - // create subloggers with their own level setting - independentLevels bool - - subloggerHook func(sub Logger) Logger -} - -// New returns a configured logger. -func New(opts *LoggerOptions) Logger { - return newLogger(opts) -} - -// NewSinkAdapter returns a SinkAdapter with configured settings -// defined by LoggerOptions -func NewSinkAdapter(opts *LoggerOptions) SinkAdapter { - l := newLogger(opts) - if l.callerOffset > 0 { - // extra frames for interceptLogger.{Warn,Info,Log,etc...}, and SinkAdapter.Accept - l.callerOffset += 2 - } - return l -} - -func newLogger(opts *LoggerOptions) *intLogger { - if opts == nil { - opts = &LoggerOptions{} - } - - output := opts.Output - if output == nil { - output = DefaultOutput - } - - level := opts.Level - if level == NoLevel { - level = DefaultLevel - } - - mutex := opts.Mutex - if mutex == nil { - mutex = new(sync.Mutex) - } - - var ( - primaryColor ColorOption = ColorOff - headerColor ColorOption = ColorOff - fieldColor ColorOption = ColorOff - ) - switch { - case opts.ColorHeaderOnly: - headerColor = opts.Color - case opts.ColorHeaderAndFields: - fieldColor = opts.Color - headerColor = opts.Color - default: - primaryColor = opts.Color - } - - l := &intLogger{ - json: opts.JSONFormat, - name: opts.Name, - timeFormat: TimeFormat, - timeFn: time.Now, - disableTime: opts.DisableTime, - mutex: mutex, - writer: newWriter(output, primaryColor), - level: new(int32), - exclude: opts.Exclude, - independentLevels: opts.IndependentLevels, - headerColor: headerColor, - fieldColor: fieldColor, - subloggerHook: opts.SubloggerHook, - } - if opts.IncludeLocation { - l.callerOffset = offsetIntLogger + opts.AdditionalLocationOffset - } - - if l.json { - l.timeFormat = TimeFormatJSON - } - if opts.TimeFn != nil { - l.timeFn = opts.TimeFn - } - if opts.TimeFormat != "" { - l.timeFormat = opts.TimeFormat - } - - if l.subloggerHook == nil { - l.subloggerHook = identityHook - } - - l.setColorization(opts) - - atomic.StoreInt32(l.level, int32(level)) - - return l -} - -func identityHook(logger Logger) Logger { - return logger -} - -// offsetIntLogger is the stack frame offset in the call stack for the caller to -// one of the Warn, Info, Log, etc methods. -const offsetIntLogger = 3 - -// Log a message and a set of key/value pairs if the given level is at -// or more severe that the threshold configured in the Logger. -func (l *intLogger) log(name string, level Level, msg string, args ...interface{}) { - if level < Level(atomic.LoadInt32(l.level)) { - return - } - - t := l.timeFn() - - l.mutex.Lock() - defer l.mutex.Unlock() - - if l.exclude != nil && l.exclude(level, msg, args...) { - return - } - - if l.json { - l.logJSON(t, name, level, msg, args...) - } else { - l.logPlain(t, name, level, msg, args...) - } - - l.writer.Flush(level) -} - -// Cleanup a path by returning the last 2 segments of the path only. -func trimCallerPath(path string) string { - // lovely borrowed from zap - // nb. To make sure we trim the path correctly on Windows too, we - // counter-intuitively need to use '/' and *not* os.PathSeparator here, - // because the path given originates from Go stdlib, specifically - // runtime.Caller() which (as of Mar/17) returns forward slashes even on - // Windows. - // - // See https://github.com/golang/go/issues/3335 - // and https://github.com/golang/go/issues/18151 - // - // for discussion on the issue on Go side. - - // Find the last separator. - idx := strings.LastIndexByte(path, '/') - if idx == -1 { - return path - } - - // Find the penultimate separator. - idx = strings.LastIndexByte(path[:idx], '/') - if idx == -1 { - return path - } - - return path[idx+1:] -} - -// isNormal indicates if the rune is one allowed to exist as an unquoted -// string value. This is a subset of ASCII, `-` through `~`. -func isNormal(r rune) bool { - return 0x2D <= r && r <= 0x7E // - through ~ -} - -// needsQuoting returns false if all the runes in string are normal, according -// to isNormal -func needsQuoting(str string) bool { - for _, r := range str { - if !isNormal(r) { - return true - } - } - - return false -} - -// logPlain is the non-JSON logging format function which writes directly -// to the underlying writer the logger was initialized with. -// -// If the logger was initialized with a color function, it also handles -// applying the color to the log message. -// -// Color Options -// 1. No color. -// 2. Color the whole log line, based on the level. -// 3. Color only the header (level) part of the log line. -// 4. Color both the header and fields of the log line. -func (l *intLogger) logPlain(t time.Time, name string, level Level, msg string, args ...interface{}) { - - if !l.disableTime { - l.writer.WriteString(t.Format(l.timeFormat)) - l.writer.WriteByte(' ') - } - - s, ok := _levelToBracket[level] - if ok { - if l.headerColor != ColorOff { - color := _levelToColor[level] - color.Fprint(l.writer, s) - } else { - l.writer.WriteString(s) - } - } else { - l.writer.WriteString("[?????]") - } - - if l.callerOffset > 0 { - if _, file, line, ok := runtime.Caller(l.callerOffset); ok { - l.writer.WriteByte(' ') - l.writer.WriteString(trimCallerPath(file)) - l.writer.WriteByte(':') - l.writer.WriteString(strconv.Itoa(line)) - l.writer.WriteByte(':') - } - } - - l.writer.WriteByte(' ') - - if name != "" { - l.writer.WriteString(name) - if msg != "" { - l.writer.WriteString(": ") - l.writer.WriteString(msg) - } - } else if msg != "" { - l.writer.WriteString(msg) - } - - args = append(l.implied, args...) - - var stacktrace CapturedStacktrace - - if len(args) > 0 { - if len(args)%2 != 0 { - cs, ok := args[len(args)-1].(CapturedStacktrace) - if ok { - args = args[:len(args)-1] - stacktrace = cs - } else { - extra := args[len(args)-1] - args = append(args[:len(args)-1], MissingKey, extra) - } - } - - l.writer.WriteByte(':') - - // Handle the field arguments, which come in pairs (key=val). - FOR: - for i := 0; i < len(args); i = i + 2 { - var ( - key string - val string - raw bool - ) - - // Convert the field value to a string. - switch st := args[i+1].(type) { - case string: - val = st - if st == "" { - val = `""` - raw = true - } - case int: - val = strconv.FormatInt(int64(st), 10) - case int64: - val = strconv.FormatInt(int64(st), 10) - case int32: - val = strconv.FormatInt(int64(st), 10) - case int16: - val = strconv.FormatInt(int64(st), 10) - case int8: - val = strconv.FormatInt(int64(st), 10) - case uint: - val = strconv.FormatUint(uint64(st), 10) - case uint64: - val = strconv.FormatUint(uint64(st), 10) - case uint32: - val = strconv.FormatUint(uint64(st), 10) - case uint16: - val = strconv.FormatUint(uint64(st), 10) - case uint8: - val = strconv.FormatUint(uint64(st), 10) - case Hex: - val = "0x" + strconv.FormatUint(uint64(st), 16) - case Octal: - val = "0" + strconv.FormatUint(uint64(st), 8) - case Binary: - val = "0b" + strconv.FormatUint(uint64(st), 2) - case CapturedStacktrace: - stacktrace = st - continue FOR - case Format: - val = fmt.Sprintf(st[0].(string), st[1:]...) - case Quote: - raw = true - val = strconv.Quote(string(st)) - default: - v := reflect.ValueOf(st) - if v.Kind() == reflect.Slice { - val = l.renderSlice(v) - raw = true - } else { - val = fmt.Sprintf("%v", st) - } - } - - // Convert the field key to a string. - switch st := args[i].(type) { - case string: - key = st - default: - key = fmt.Sprintf("%s", st) - } - - // Optionally apply the ANSI "faint" and "bold" - // SGR values to the key. - if l.fieldColor != ColorOff { - key = faintBoldColor.Sprint(key) - } - - // Values may contain multiple lines, and that format - // is preserved, with each line prefixed with a " | " - // to show it's part of a collection of lines. - // - // Values may also need quoting, if not all the runes - // in the value string are "normal", like if they - // contain ANSI escape sequences. - if strings.Contains(val, "\n") { - l.writer.WriteString("\n ") - l.writer.WriteString(key) - if l.fieldColor != ColorOff { - l.writer.WriteString(faintFieldSeparatorWithNewLine) - writeIndent(l.writer, val, faintMultiLinePrefix) - } else { - l.writer.WriteString("=\n") - writeIndent(l.writer, val, " | ") - } - l.writer.WriteString(" ") - } else if !raw && needsQuoting(val) { - l.writer.WriteByte(' ') - l.writer.WriteString(key) - if l.fieldColor != ColorOff { - l.writer.WriteString(faintFieldSeparator) - } else { - l.writer.WriteByte('=') - } - l.writer.WriteByte('"') - writeEscapedForOutput(l.writer, val, true) - l.writer.WriteByte('"') - } else { - l.writer.WriteByte(' ') - l.writer.WriteString(key) - if l.fieldColor != ColorOff { - l.writer.WriteString(faintFieldSeparator) - } else { - l.writer.WriteByte('=') - } - l.writer.WriteString(val) - } - } - } - - l.writer.WriteString("\n") - - if stacktrace != "" { - l.writer.WriteString(string(stacktrace)) - l.writer.WriteString("\n") - } -} - -func writeIndent(w *writer, str string, indent string) { - for { - nl := strings.IndexByte(str, "\n"[0]) - if nl == -1 { - if str != "" { - w.WriteString(indent) - writeEscapedForOutput(w, str, false) - w.WriteString("\n") - } - return - } - - w.WriteString(indent) - writeEscapedForOutput(w, str[:nl], false) - w.WriteString("\n") - str = str[nl+1:] - } -} - -func needsEscaping(str string) bool { - for _, b := range str { - if !unicode.IsPrint(b) || b == '"' { - return true - } - } - - return false -} - -const ( - lowerhex = "0123456789abcdef" -) - -var bufPool = sync.Pool{ - New: func() interface{} { - return new(bytes.Buffer) - }, -} - -func writeEscapedForOutput(w io.Writer, str string, escapeQuotes bool) { - if !needsEscaping(str) { - w.Write([]byte(str)) - return - } - - bb := bufPool.Get().(*bytes.Buffer) - bb.Reset() - - defer bufPool.Put(bb) - - for _, r := range str { - if escapeQuotes && r == '"' { - bb.WriteString(`\"`) - } else if unicode.IsPrint(r) { - bb.WriteRune(r) - } else { - switch r { - case '\a': - bb.WriteString(`\a`) - case '\b': - bb.WriteString(`\b`) - case '\f': - bb.WriteString(`\f`) - case '\n': - bb.WriteString(`\n`) - case '\r': - bb.WriteString(`\r`) - case '\t': - bb.WriteString(`\t`) - case '\v': - bb.WriteString(`\v`) - default: - switch { - case r < ' ': - bb.WriteString(`\x`) - bb.WriteByte(lowerhex[byte(r)>>4]) - bb.WriteByte(lowerhex[byte(r)&0xF]) - case !utf8.ValidRune(r): - r = 0xFFFD - fallthrough - case r < 0x10000: - bb.WriteString(`\u`) - for s := 12; s >= 0; s -= 4 { - bb.WriteByte(lowerhex[r>>uint(s)&0xF]) - } - default: - bb.WriteString(`\U`) - for s := 28; s >= 0; s -= 4 { - bb.WriteByte(lowerhex[r>>uint(s)&0xF]) - } - } - } - } - } - - w.Write(bb.Bytes()) -} - -func (l *intLogger) renderSlice(v reflect.Value) string { - var buf bytes.Buffer - - buf.WriteRune('[') - - for i := 0; i < v.Len(); i++ { - if i > 0 { - buf.WriteString(", ") - } - - sv := v.Index(i) - - var val string - - switch sv.Kind() { - case reflect.String: - val = strconv.Quote(sv.String()) - case reflect.Int, reflect.Int16, reflect.Int32, reflect.Int64: - val = strconv.FormatInt(sv.Int(), 10) - case reflect.Uint, reflect.Uint16, reflect.Uint32, reflect.Uint64: - val = strconv.FormatUint(sv.Uint(), 10) - default: - val = fmt.Sprintf("%v", sv.Interface()) - if strings.ContainsAny(val, " \t\n\r") { - val = strconv.Quote(val) - } - } - - buf.WriteString(val) - } - - buf.WriteRune(']') - - return buf.String() -} - -// JSON logging function -func (l *intLogger) logJSON(t time.Time, name string, level Level, msg string, args ...interface{}) { - vals := l.jsonMapEntry(t, name, level, msg) - args = append(l.implied, args...) - - if args != nil && len(args) > 0 { - if len(args)%2 != 0 { - cs, ok := args[len(args)-1].(CapturedStacktrace) - if ok { - args = args[:len(args)-1] - vals["stacktrace"] = cs - } else { - extra := args[len(args)-1] - args = append(args[:len(args)-1], MissingKey, extra) - } - } - - for i := 0; i < len(args); i = i + 2 { - val := args[i+1] - switch sv := val.(type) { - case error: - // Check if val is of type error. If error type doesn't - // implement json.Marshaler or encoding.TextMarshaler - // then set val to err.Error() so that it gets marshaled - switch sv.(type) { - case json.Marshaler, encoding.TextMarshaler: - default: - val = sv.Error() - } - case Format: - val = fmt.Sprintf(sv[0].(string), sv[1:]...) - } - - var key string - - switch st := args[i].(type) { - case string: - key = st - default: - key = fmt.Sprintf("%s", st) - } - vals[key] = val - } - } - - err := json.NewEncoder(l.writer).Encode(vals) - if err != nil { - if _, ok := err.(*json.UnsupportedTypeError); ok { - plainVal := l.jsonMapEntry(t, name, level, msg) - plainVal["@warn"] = errJsonUnsupportedTypeMsg - - json.NewEncoder(l.writer).Encode(plainVal) - } - } -} - -func (l intLogger) jsonMapEntry(t time.Time, name string, level Level, msg string) map[string]interface{} { - vals := map[string]interface{}{ - "@message": msg, - } - if !l.disableTime { - vals["@timestamp"] = t.Format(l.timeFormat) - } - - var levelStr string - switch level { - case Error: - levelStr = "error" - case Warn: - levelStr = "warn" - case Info: - levelStr = "info" - case Debug: - levelStr = "debug" - case Trace: - levelStr = "trace" - default: - levelStr = "all" - } - - vals["@level"] = levelStr - - if name != "" { - vals["@module"] = name - } - - if l.callerOffset > 0 { - if _, file, line, ok := runtime.Caller(l.callerOffset + 1); ok { - vals["@caller"] = fmt.Sprintf("%s:%d", file, line) - } - } - return vals -} - -// Emit the message and args at the provided level -func (l *intLogger) Log(level Level, msg string, args ...interface{}) { - l.log(l.Name(), level, msg, args...) -} - -// Emit the message and args at DEBUG level -func (l *intLogger) Debug(msg string, args ...interface{}) { - l.log(l.Name(), Debug, msg, args...) -} - -// Emit the message and args at TRACE level -func (l *intLogger) Trace(msg string, args ...interface{}) { - l.log(l.Name(), Trace, msg, args...) -} - -// Emit the message and args at INFO level -func (l *intLogger) Info(msg string, args ...interface{}) { - l.log(l.Name(), Info, msg, args...) -} - -// Emit the message and args at WARN level -func (l *intLogger) Warn(msg string, args ...interface{}) { - l.log(l.Name(), Warn, msg, args...) -} - -// Emit the message and args at ERROR level -func (l *intLogger) Error(msg string, args ...interface{}) { - l.log(l.Name(), Error, msg, args...) -} - -// Indicate that the logger would emit TRACE level logs -func (l *intLogger) IsTrace() bool { - return Level(atomic.LoadInt32(l.level)) == Trace -} - -// Indicate that the logger would emit DEBUG level logs -func (l *intLogger) IsDebug() bool { - return Level(atomic.LoadInt32(l.level)) <= Debug -} - -// Indicate that the logger would emit INFO level logs -func (l *intLogger) IsInfo() bool { - return Level(atomic.LoadInt32(l.level)) <= Info -} - -// Indicate that the logger would emit WARN level logs -func (l *intLogger) IsWarn() bool { - return Level(atomic.LoadInt32(l.level)) <= Warn -} - -// Indicate that the logger would emit ERROR level logs -func (l *intLogger) IsError() bool { - return Level(atomic.LoadInt32(l.level)) <= Error -} - -const MissingKey = "EXTRA_VALUE_AT_END" - -// Return a sub-Logger for which every emitted log message will contain -// the given key/value pairs. This is used to create a context specific -// Logger. -func (l *intLogger) With(args ...interface{}) Logger { - var extra interface{} - - if len(args)%2 != 0 { - extra = args[len(args)-1] - args = args[:len(args)-1] - } - - sl := l.copy() - - result := make(map[string]interface{}, len(l.implied)+len(args)) - keys := make([]string, 0, len(l.implied)+len(args)) - - // Read existing args, store map and key for consistent sorting - for i := 0; i < len(l.implied); i += 2 { - key := l.implied[i].(string) - keys = append(keys, key) - result[key] = l.implied[i+1] - } - // Read new args, store map and key for consistent sorting - for i := 0; i < len(args); i += 2 { - key := args[i].(string) - _, exists := result[key] - if !exists { - keys = append(keys, key) - } - result[key] = args[i+1] - } - - // Sort keys to be consistent - sort.Strings(keys) - - sl.implied = make([]interface{}, 0, len(l.implied)+len(args)) - for _, k := range keys { - sl.implied = append(sl.implied, k) - sl.implied = append(sl.implied, result[k]) - } - - if extra != nil { - sl.implied = append(sl.implied, MissingKey, extra) - } - - return l.subloggerHook(sl) -} - -// Create a new sub-Logger that a name decending from the current name. -// This is used to create a subsystem specific Logger. -func (l *intLogger) Named(name string) Logger { - sl := l.copy() - - if sl.name != "" { - sl.name = sl.name + "." + name - } else { - sl.name = name - } - - return l.subloggerHook(sl) -} - -// Create a new sub-Logger with an explicit name. This ignores the current -// name. This is used to create a standalone logger that doesn't fall -// within the normal hierarchy. -func (l *intLogger) ResetNamed(name string) Logger { - sl := l.copy() - - sl.name = name - - return l.subloggerHook(sl) -} - -func (l *intLogger) ResetOutput(opts *LoggerOptions) error { - if opts.Output == nil { - return errors.New("given output is nil") - } - - l.mutex.Lock() - defer l.mutex.Unlock() - - return l.resetOutput(opts) -} - -func (l *intLogger) ResetOutputWithFlush(opts *LoggerOptions, flushable Flushable) error { - if opts.Output == nil { - return errors.New("given output is nil") - } - if flushable == nil { - return errors.New("flushable is nil") - } - - l.mutex.Lock() - defer l.mutex.Unlock() - - if err := flushable.Flush(); err != nil { - return err - } - - return l.resetOutput(opts) -} - -func (l *intLogger) resetOutput(opts *LoggerOptions) error { - l.writer = newWriter(opts.Output, opts.Color) - l.setColorization(opts) - return nil -} - -// Update the logging level on-the-fly. This will affect all subloggers as -// well. -func (l *intLogger) SetLevel(level Level) { - atomic.StoreInt32(l.level, int32(level)) -} - -// Returns the current level -func (l *intLogger) GetLevel() Level { - return Level(atomic.LoadInt32(l.level)) -} - -// Create a *log.Logger that will send it's data through this Logger. This -// allows packages that expect to be using the standard library log to actually -// use this logger. -func (l *intLogger) StandardLogger(opts *StandardLoggerOptions) *log.Logger { - if opts == nil { - opts = &StandardLoggerOptions{} - } - - return log.New(l.StandardWriter(opts), "", 0) -} - -func (l *intLogger) StandardWriter(opts *StandardLoggerOptions) io.Writer { - newLog := *l - if l.callerOffset > 0 { - // the stack is - // logger.printf() -> l.Output() ->l.out.writer(hclog:stdlogAdaptor.write) -> hclog:stdlogAdaptor.dispatch() - // So plus 4. - newLog.callerOffset = l.callerOffset + 4 - } - return &stdlogAdapter{ - log: &newLog, - inferLevels: opts.InferLevels, - inferLevelsWithTimestamp: opts.InferLevelsWithTimestamp, - forceLevel: opts.ForceLevel, - } -} - -// Accept implements the SinkAdapter interface -func (i *intLogger) Accept(name string, level Level, msg string, args ...interface{}) { - i.log(name, level, msg, args...) -} - -// ImpliedArgs returns the loggers implied args -func (i *intLogger) ImpliedArgs() []interface{} { - return i.implied -} - -// Name returns the loggers name -func (i *intLogger) Name() string { - return i.name -} - -// copy returns a shallow copy of the intLogger, replacing the level pointer -// when necessary -func (l *intLogger) copy() *intLogger { - sl := *l - - if l.independentLevels { - sl.level = new(int32) - *sl.level = *l.level - } - - return &sl -} diff --git a/vendor/github.com/hashicorp/go-hclog/logger.go b/vendor/github.com/hashicorp/go-hclog/logger.go deleted file mode 100644 index 947ac0c9a..000000000 --- a/vendor/github.com/hashicorp/go-hclog/logger.go +++ /dev/null @@ -1,393 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MIT - -package hclog - -import ( - "io" - "log" - "os" - "strings" - "time" -) - -var ( - // DefaultOutput is used as the default log output. - DefaultOutput io.Writer = os.Stderr - - // DefaultLevel is used as the default log level. - DefaultLevel = Info -) - -// Level represents a log level. -type Level int32 - -const ( - // NoLevel is a special level used to indicate that no level has been - // set and allow for a default to be used. - NoLevel Level = 0 - - // Trace is the most verbose level. Intended to be used for the tracing - // of actions in code, such as function enters/exits, etc. - Trace Level = 1 - - // Debug information for programmer low-level analysis. - Debug Level = 2 - - // Info information about steady state operations. - Info Level = 3 - - // Warn information about rare but handled events. - Warn Level = 4 - - // Error information about unrecoverable events. - Error Level = 5 - - // Off disables all logging output. - Off Level = 6 -) - -// Format is a simple convenience type for when formatting is required. When -// processing a value of this type, the logger automatically treats the first -// argument as a Printf formatting string and passes the rest as the values -// to be formatted. For example: L.Info(Fmt{"%d beans/day", beans}). -type Format []interface{} - -// Fmt returns a Format type. This is a convenience function for creating a Format -// type. -func Fmt(str string, args ...interface{}) Format { - return append(Format{str}, args...) -} - -// A simple shortcut to format numbers in hex when displayed with the normal -// text output. For example: L.Info("header value", Hex(17)) -type Hex int - -// A simple shortcut to format numbers in octal when displayed with the normal -// text output. For example: L.Info("perms", Octal(17)) -type Octal int - -// A simple shortcut to format numbers in binary when displayed with the normal -// text output. For example: L.Info("bits", Binary(17)) -type Binary int - -// A simple shortcut to format strings with Go quoting. Control and -// non-printable characters will be escaped with their backslash equivalents in -// output. Intended for untrusted or multiline strings which should be logged -// as concisely as possible. -type Quote string - -// ColorOption expresses how the output should be colored, if at all. -type ColorOption uint8 - -const ( - // ColorOff is the default coloration, and does not - // inject color codes into the io.Writer. - ColorOff ColorOption = iota - // AutoColor checks if the io.Writer is a tty, - // and if so enables coloring. - AutoColor - // ForceColor will enable coloring, regardless of whether - // the io.Writer is a tty or not. - ForceColor -) - -// SupportsColor is an optional interface that can be implemented by the output -// value. If implemented and SupportsColor() returns true, then AutoColor will -// enable colorization. -type SupportsColor interface { - SupportsColor() bool -} - -// LevelFromString returns a Level type for the named log level, or "NoLevel" if -// the level string is invalid. This facilitates setting the log level via -// config or environment variable by name in a predictable way. -func LevelFromString(levelStr string) Level { - // We don't care about case. Accept both "INFO" and "info". - levelStr = strings.ToLower(strings.TrimSpace(levelStr)) - switch levelStr { - case "trace": - return Trace - case "debug": - return Debug - case "info": - return Info - case "warn": - return Warn - case "error": - return Error - case "off": - return Off - default: - return NoLevel - } -} - -func (l Level) String() string { - switch l { - case Trace: - return "trace" - case Debug: - return "debug" - case Info: - return "info" - case Warn: - return "warn" - case Error: - return "error" - case NoLevel: - return "none" - case Off: - return "off" - default: - return "unknown" - } -} - -// Logger describes the interface that must be implemented by all loggers. -type Logger interface { - // Args are alternating key, val pairs - // keys must be strings - // vals can be any type, but display is implementation specific - // Emit a message and key/value pairs at a provided log level - Log(level Level, msg string, args ...interface{}) - - // Emit a message and key/value pairs at the TRACE level - Trace(msg string, args ...interface{}) - - // Emit a message and key/value pairs at the DEBUG level - Debug(msg string, args ...interface{}) - - // Emit a message and key/value pairs at the INFO level - Info(msg string, args ...interface{}) - - // Emit a message and key/value pairs at the WARN level - Warn(msg string, args ...interface{}) - - // Emit a message and key/value pairs at the ERROR level - Error(msg string, args ...interface{}) - - // Indicate if TRACE logs would be emitted. This and the other Is* guards - // are used to elide expensive logging code based on the current level. - IsTrace() bool - - // Indicate if DEBUG logs would be emitted. This and the other Is* guards - IsDebug() bool - - // Indicate if INFO logs would be emitted. This and the other Is* guards - IsInfo() bool - - // Indicate if WARN logs would be emitted. This and the other Is* guards - IsWarn() bool - - // Indicate if ERROR logs would be emitted. This and the other Is* guards - IsError() bool - - // ImpliedArgs returns With key/value pairs - ImpliedArgs() []interface{} - - // Creates a sublogger that will always have the given key/value pairs - With(args ...interface{}) Logger - - // Returns the Name of the logger - Name() string - - // Create a logger that will prepend the name string on the front of all messages. - // If the logger already has a name, the new value will be appended to the current - // name. That way, a major subsystem can use this to decorate all it's own logs - // without losing context. - Named(name string) Logger - - // Create a logger that will prepend the name string on the front of all messages. - // This sets the name of the logger to the value directly, unlike Named which honor - // the current name as well. - ResetNamed(name string) Logger - - // Updates the level. This should affect all related loggers as well, - // unless they were created with IndependentLevels. If an - // implementation cannot update the level on the fly, it should no-op. - SetLevel(level Level) - - // Returns the current level - GetLevel() Level - - // Return a value that conforms to the stdlib log.Logger interface - StandardLogger(opts *StandardLoggerOptions) *log.Logger - - // Return a value that conforms to io.Writer, which can be passed into log.SetOutput() - StandardWriter(opts *StandardLoggerOptions) io.Writer -} - -// StandardLoggerOptions can be used to configure a new standard logger. -type StandardLoggerOptions struct { - // Indicate that some minimal parsing should be done on strings to try - // and detect their level and re-emit them. - // This supports the strings like [ERROR], [ERR] [TRACE], [WARN], [INFO], - // [DEBUG] and strip it off before reapplying it. - InferLevels bool - - // Indicate that some minimal parsing should be done on strings to try - // and detect their level and re-emit them while ignoring possible - // timestamp values in the beginning of the string. - // This supports the strings like [ERROR], [ERR] [TRACE], [WARN], [INFO], - // [DEBUG] and strip it off before reapplying it. - // The timestamp detection may result in false positives and incomplete - // string outputs. - InferLevelsWithTimestamp bool - - // ForceLevel is used to force all output from the standard logger to be at - // the specified level. Similar to InferLevels, this will strip any level - // prefix contained in the logged string before applying the forced level. - // If set, this override InferLevels. - ForceLevel Level -} - -type TimeFunction = func() time.Time - -// LoggerOptions can be used to configure a new logger. -type LoggerOptions struct { - // Name of the subsystem to prefix logs with - Name string - - // The threshold for the logger. Anything less severe is suppressed - Level Level - - // Where to write the logs to. Defaults to os.Stderr if nil - Output io.Writer - - // An optional Locker in case Output is shared. This can be a sync.Mutex or - // a NoopLocker if the caller wants control over output, e.g. for batching - // log lines. - Mutex Locker - - // Control if the output should be in JSON. - JSONFormat bool - - // Include file and line information in each log line - IncludeLocation bool - - // AdditionalLocationOffset is the number of additional stack levels to skip - // when finding the file and line information for the log line - AdditionalLocationOffset int - - // The time format to use instead of the default - TimeFormat string - - // A function which is called to get the time object that is formatted using `TimeFormat` - TimeFn TimeFunction - - // Control whether or not to display the time at all. This is required - // because setting TimeFormat to empty assumes the default format. - DisableTime bool - - // Color the output. On Windows, colored logs are only available for io.Writers that - // are concretely instances of *os.File. - Color ColorOption - - // Only color the header, not the body. This can help with readability of long messages. - ColorHeaderOnly bool - - // Color the header and message body fields. This can help with readability - // of long messages with multiple fields. - ColorHeaderAndFields bool - - // A function which is called with the log information and if it returns true the value - // should not be logged. - // This is useful when interacting with a system that you wish to suppress the log - // message for (because it's too noisy, etc) - Exclude func(level Level, msg string, args ...interface{}) bool - - // IndependentLevels causes subloggers to be created with an independent - // copy of this logger's level. This means that using SetLevel on this - // logger will not affect any subloggers, and SetLevel on any subloggers - // will not affect the parent or sibling loggers. - IndependentLevels bool - - // SubloggerHook registers a function that is called when a sublogger via - // Named, With, or ResetNamed is created. If defined, the function is passed - // the newly created Logger and the returned Logger is returned from the - // original function. This option allows customization via interception and - // wrapping of Logger instances. - SubloggerHook func(sub Logger) Logger -} - -// InterceptLogger describes the interface for using a logger -// that can register different output sinks. -// This is useful for sending lower level log messages -// to a different output while keeping the root logger -// at a higher one. -type InterceptLogger interface { - // Logger is the root logger for an InterceptLogger - Logger - - // RegisterSink adds a SinkAdapter to the InterceptLogger - RegisterSink(sink SinkAdapter) - - // DeregisterSink removes a SinkAdapter from the InterceptLogger - DeregisterSink(sink SinkAdapter) - - // Create a interceptlogger that will prepend the name string on the front of all messages. - // If the logger already has a name, the new value will be appended to the current - // name. That way, a major subsystem can use this to decorate all it's own logs - // without losing context. - NamedIntercept(name string) InterceptLogger - - // Create a interceptlogger that will prepend the name string on the front of all messages. - // This sets the name of the logger to the value directly, unlike Named which honor - // the current name as well. - ResetNamedIntercept(name string) InterceptLogger - - // Deprecated: use StandardLogger - StandardLoggerIntercept(opts *StandardLoggerOptions) *log.Logger - - // Deprecated: use StandardWriter - StandardWriterIntercept(opts *StandardLoggerOptions) io.Writer -} - -// SinkAdapter describes the interface that must be implemented -// in order to Register a new sink to an InterceptLogger -type SinkAdapter interface { - Accept(name string, level Level, msg string, args ...interface{}) -} - -// Flushable represents a method for flushing an output buffer. It can be used -// if Resetting the log to use a new output, in order to flush the writes to -// the existing output beforehand. -type Flushable interface { - Flush() error -} - -// OutputResettable provides ways to swap the output in use at runtime -type OutputResettable interface { - // ResetOutput swaps the current output writer with the one given in the - // opts. Color options given in opts will be used for the new output. - ResetOutput(opts *LoggerOptions) error - - // ResetOutputWithFlush swaps the current output writer with the one given - // in the opts, first calling Flush on the given Flushable. Color options - // given in opts will be used for the new output. - ResetOutputWithFlush(opts *LoggerOptions, flushable Flushable) error -} - -// Locker is used for locking output. If not set when creating a logger, a -// sync.Mutex will be used internally. -type Locker interface { - // Lock is called when the output is going to be changed or written to - Lock() - - // Unlock is called when the operation that called Lock() completes - Unlock() -} - -// NoopLocker implements locker but does nothing. This is useful if the client -// wants tight control over locking, in order to provide grouping of log -// entries or other functionality. -type NoopLocker struct{} - -// Lock does nothing -func (n NoopLocker) Lock() {} - -// Unlock does nothing -func (n NoopLocker) Unlock() {} - -var _ Locker = (*NoopLocker)(nil) diff --git a/vendor/github.com/hashicorp/go-hclog/nulllogger.go b/vendor/github.com/hashicorp/go-hclog/nulllogger.go deleted file mode 100644 index d43da809e..000000000 --- a/vendor/github.com/hashicorp/go-hclog/nulllogger.go +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MIT - -package hclog - -import ( - "io" - "io/ioutil" - "log" -) - -// NewNullLogger instantiates a Logger for which all calls -// will succeed without doing anything. -// Useful for testing purposes. -func NewNullLogger() Logger { - return &nullLogger{} -} - -type nullLogger struct{} - -func (l *nullLogger) Log(level Level, msg string, args ...interface{}) {} - -func (l *nullLogger) Trace(msg string, args ...interface{}) {} - -func (l *nullLogger) Debug(msg string, args ...interface{}) {} - -func (l *nullLogger) Info(msg string, args ...interface{}) {} - -func (l *nullLogger) Warn(msg string, args ...interface{}) {} - -func (l *nullLogger) Error(msg string, args ...interface{}) {} - -func (l *nullLogger) IsTrace() bool { return false } - -func (l *nullLogger) IsDebug() bool { return false } - -func (l *nullLogger) IsInfo() bool { return false } - -func (l *nullLogger) IsWarn() bool { return false } - -func (l *nullLogger) IsError() bool { return false } - -func (l *nullLogger) ImpliedArgs() []interface{} { return []interface{}{} } - -func (l *nullLogger) With(args ...interface{}) Logger { return l } - -func (l *nullLogger) Name() string { return "" } - -func (l *nullLogger) Named(name string) Logger { return l } - -func (l *nullLogger) ResetNamed(name string) Logger { return l } - -func (l *nullLogger) SetLevel(level Level) {} - -func (l *nullLogger) GetLevel() Level { return NoLevel } - -func (l *nullLogger) StandardLogger(opts *StandardLoggerOptions) *log.Logger { - return log.New(l.StandardWriter(opts), "", log.LstdFlags) -} - -func (l *nullLogger) StandardWriter(opts *StandardLoggerOptions) io.Writer { - return ioutil.Discard -} diff --git a/vendor/github.com/hashicorp/go-hclog/stacktrace.go b/vendor/github.com/hashicorp/go-hclog/stacktrace.go deleted file mode 100644 index 9b27bd3d3..000000000 --- a/vendor/github.com/hashicorp/go-hclog/stacktrace.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package hclog - -import ( - "bytes" - "runtime" - "strconv" - "strings" - "sync" -) - -var ( - _stacktraceIgnorePrefixes = []string{ - "runtime.goexit", - "runtime.main", - } - _stacktracePool = sync.Pool{ - New: func() interface{} { - return newProgramCounters(64) - }, - } -) - -// CapturedStacktrace represents a stacktrace captured by a previous call -// to log.Stacktrace. If passed to a logging function, the stacktrace -// will be appended. -type CapturedStacktrace string - -// Stacktrace captures a stacktrace of the current goroutine and returns -// it to be passed to a logging function. -func Stacktrace() CapturedStacktrace { - return CapturedStacktrace(takeStacktrace()) -} - -func takeStacktrace() string { - programCounters := _stacktracePool.Get().(*programCounters) - defer _stacktracePool.Put(programCounters) - - var buffer bytes.Buffer - - for { - // Skip the call to runtime.Counters and takeStacktrace so that the - // program counters start at the caller of takeStacktrace. - n := runtime.Callers(2, programCounters.pcs) - if n < cap(programCounters.pcs) { - programCounters.pcs = programCounters.pcs[:n] - break - } - // Don't put the too-short counter slice back into the pool; this lets - // the pool adjust if we consistently take deep stacktraces. - programCounters = newProgramCounters(len(programCounters.pcs) * 2) - } - - i := 0 - frames := runtime.CallersFrames(programCounters.pcs) - for frame, more := frames.Next(); more; frame, more = frames.Next() { - if shouldIgnoreStacktraceFunction(frame.Function) { - continue - } - if i != 0 { - buffer.WriteByte('\n') - } - i++ - buffer.WriteString(frame.Function) - buffer.WriteByte('\n') - buffer.WriteByte('\t') - buffer.WriteString(frame.File) - buffer.WriteByte(':') - buffer.WriteString(strconv.Itoa(int(frame.Line))) - } - - return buffer.String() -} - -func shouldIgnoreStacktraceFunction(function string) bool { - for _, prefix := range _stacktraceIgnorePrefixes { - if strings.HasPrefix(function, prefix) { - return true - } - } - return false -} - -type programCounters struct { - pcs []uintptr -} - -func newProgramCounters(size int) *programCounters { - return &programCounters{make([]uintptr, size)} -} diff --git a/vendor/github.com/hashicorp/go-hclog/stdlog.go b/vendor/github.com/hashicorp/go-hclog/stdlog.go deleted file mode 100644 index 03739b61f..000000000 --- a/vendor/github.com/hashicorp/go-hclog/stdlog.go +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MIT - -package hclog - -import ( - "bytes" - "log" - "regexp" - "strings" -) - -// Regex to ignore characters commonly found in timestamp formats from the -// beginning of inputs. -var logTimestampRegexp = regexp.MustCompile(`^[\d\s\:\/\.\+-TZ]*`) - -// Provides a io.Writer to shim the data out of *log.Logger -// and back into our Logger. This is basically the only way to -// build upon *log.Logger. -type stdlogAdapter struct { - log Logger - inferLevels bool - inferLevelsWithTimestamp bool - forceLevel Level -} - -// Take the data, infer the levels if configured, and send it through -// a regular Logger. -func (s *stdlogAdapter) Write(data []byte) (int, error) { - str := string(bytes.TrimRight(data, " \t\n")) - - if s.forceLevel != NoLevel { - // Use pickLevel to strip log levels included in the line since we are - // forcing the level - _, str := s.pickLevel(str) - - // Log at the forced level - s.dispatch(str, s.forceLevel) - } else if s.inferLevels { - if s.inferLevelsWithTimestamp { - str = s.trimTimestamp(str) - } - - level, str := s.pickLevel(str) - s.dispatch(str, level) - } else { - s.log.Info(str) - } - - return len(data), nil -} - -func (s *stdlogAdapter) dispatch(str string, level Level) { - switch level { - case Trace: - s.log.Trace(str) - case Debug: - s.log.Debug(str) - case Info: - s.log.Info(str) - case Warn: - s.log.Warn(str) - case Error: - s.log.Error(str) - default: - s.log.Info(str) - } -} - -// Detect, based on conventions, what log level this is. -func (s *stdlogAdapter) pickLevel(str string) (Level, string) { - switch { - case strings.HasPrefix(str, "[DEBUG]"): - return Debug, strings.TrimSpace(str[7:]) - case strings.HasPrefix(str, "[TRACE]"): - return Trace, strings.TrimSpace(str[7:]) - case strings.HasPrefix(str, "[INFO]"): - return Info, strings.TrimSpace(str[6:]) - case strings.HasPrefix(str, "[WARN]"): - return Warn, strings.TrimSpace(str[6:]) - case strings.HasPrefix(str, "[ERROR]"): - return Error, strings.TrimSpace(str[7:]) - case strings.HasPrefix(str, "[ERR]"): - return Error, strings.TrimSpace(str[5:]) - default: - return Info, str - } -} - -func (s *stdlogAdapter) trimTimestamp(str string) string { - idx := logTimestampRegexp.FindStringIndex(str) - return str[idx[1]:] -} - -type logWriter struct { - l *log.Logger -} - -func (l *logWriter) Write(b []byte) (int, error) { - l.l.Println(string(bytes.TrimRight(b, " \n\t"))) - return len(b), nil -} - -// Takes a standard library logger and returns a Logger that will write to it -func FromStandardLogger(l *log.Logger, opts *LoggerOptions) Logger { - var dl LoggerOptions = *opts - - // Use the time format that log.Logger uses - dl.DisableTime = true - dl.Output = &logWriter{l} - - return New(&dl) -} diff --git a/vendor/github.com/hashicorp/go-hclog/writer.go b/vendor/github.com/hashicorp/go-hclog/writer.go deleted file mode 100644 index 4ee219bf0..000000000 --- a/vendor/github.com/hashicorp/go-hclog/writer.go +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MIT - -package hclog - -import ( - "bytes" - "io" -) - -type writer struct { - b bytes.Buffer - w io.Writer - color ColorOption -} - -func newWriter(w io.Writer, color ColorOption) *writer { - return &writer{w: w, color: color} -} - -func (w *writer) Flush(level Level) (err error) { - var unwritten = w.b.Bytes() - - if w.color != ColorOff { - color := _levelToColor[level] - unwritten = []byte(color.Sprintf("%s", unwritten)) - } - - if lw, ok := w.w.(LevelWriter); ok { - _, err = lw.LevelWrite(level, unwritten) - } else { - _, err = w.w.Write(unwritten) - } - w.b.Reset() - return err -} - -func (w *writer) Write(p []byte) (int, error) { - return w.b.Write(p) -} - -func (w *writer) WriteByte(c byte) error { - return w.b.WriteByte(c) -} - -func (w *writer) WriteString(s string) (int, error) { - return w.b.WriteString(s) -} - -// LevelWriter is the interface that wraps the LevelWrite method. -type LevelWriter interface { - LevelWrite(level Level, p []byte) (n int, err error) -} - -// LeveledWriter writes all log messages to the standard writer, -// except for log levels that are defined in the overrides map. -type LeveledWriter struct { - standard io.Writer - overrides map[Level]io.Writer -} - -// NewLeveledWriter returns an initialized LeveledWriter. -// -// standard will be used as the default writer for all log levels, -// except for log levels that are defined in the overrides map. -func NewLeveledWriter(standard io.Writer, overrides map[Level]io.Writer) *LeveledWriter { - return &LeveledWriter{ - standard: standard, - overrides: overrides, - } -} - -// Write implements io.Writer. -func (lw *LeveledWriter) Write(p []byte) (int, error) { - return lw.standard.Write(p) -} - -// LevelWrite implements LevelWriter. -func (lw *LeveledWriter) LevelWrite(level Level, p []byte) (int, error) { - w, ok := lw.overrides[level] - if !ok { - w = lw.standard - } - return w.Write(p) -} diff --git a/vendor/github.com/hashicorp/go-immutable-radix/.gitignore b/vendor/github.com/hashicorp/go-immutable-radix/.gitignore deleted file mode 100644 index daf913b1b..000000000 --- a/vendor/github.com/hashicorp/go-immutable-radix/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test -*.prof diff --git a/vendor/github.com/hashicorp/go-immutable-radix/CHANGELOG.md b/vendor/github.com/hashicorp/go-immutable-radix/CHANGELOG.md deleted file mode 100644 index 86c6d03fb..000000000 --- a/vendor/github.com/hashicorp/go-immutable-radix/CHANGELOG.md +++ /dev/null @@ -1,23 +0,0 @@ -# UNRELEASED - -# 1.3.0 (September 17th, 2020) - -FEATURES - -* Add reverse tree traversal [[GH-30](https://github.com/hashicorp/go-immutable-radix/pull/30)] - -# 1.2.0 (March 18th, 2020) - -FEATURES - -* Adds a `Clone` method to `Txn` allowing transactions to be split either into two independently mutable trees. [[GH-26](https://github.com/hashicorp/go-immutable-radix/pull/26)] - -# 1.1.0 (May 22nd, 2019) - -FEATURES - -* Add `SeekLowerBound` to allow for range scans. [[GH-24](https://github.com/hashicorp/go-immutable-radix/pull/24)] - -# 1.0.0 (August 30th, 2018) - -* go mod adopted diff --git a/vendor/github.com/hashicorp/go-immutable-radix/LICENSE b/vendor/github.com/hashicorp/go-immutable-radix/LICENSE deleted file mode 100644 index e87a115e4..000000000 --- a/vendor/github.com/hashicorp/go-immutable-radix/LICENSE +++ /dev/null @@ -1,363 +0,0 @@ -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. "Contributor" - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. "Contributor Version" - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the terms of - a Secondary License. - -1.6. "Executable Form" - - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - - means a work that combines Covered Software with other material, in a - separate file or files, that is not Covered Software. - -1.8. "License" - - means this document. - -1.9. "Licensable" - - means having the right to grant, to the maximum extent possible, whether - at the time of the initial grant or subsequently, any and all of the - rights conveyed by this License. - -1.10. "Modifications" - - means any of the following: - - a. any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. "Patent Claims" of a Contributor - - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the License, - by the making, using, selling, offering for sale, having made, import, - or transfer of either its Contributions or its Contributor Version. - -1.12. "Secondary License" - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. "Source Code Form" - - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, "control" means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution - become effective for each Contribution on the date the Contributor first - distributes such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under - this License. No additional rights or licenses will be implied from the - distribution or licensing of Covered Software under this License. - Notwithstanding Section 2.1(b) above, no patent license is granted by a - Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of - its Contributions. - - This License does not grant any rights in the trademarks, service marks, - or logos of any Contributor (except as may be necessary to comply with - the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this - License (see Section 10.2) or under the terms of a Secondary License (if - permitted under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its - Contributions are its original creation(s) or it has sufficient rights to - grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under - applicable copyright doctrines of fair use, fair dealing, or other - equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under - the terms of this License. You must inform recipients that the Source - Code Form of the Covered Software is governed by the terms of this - License, and how they can obtain a copy of this License. You may not - attempt to alter or restrict the recipients' rights in the Source Code - Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter the - recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for - the Covered Software. If the Larger Work is a combination of Covered - Software with a work governed by one or more Secondary Licenses, and the - Covered Software is not Incompatible With Secondary Licenses, this - License permits You to additionally distribute such Covered Software - under the terms of such Secondary License(s), so that the recipient of - the Larger Work may, at their option, further distribute the Covered - Software under the terms of either this License or such Secondary - License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices - (including copyright notices, patent notices, disclaimers of warranty, or - limitations of liability) contained within the Source Code Form of the - Covered Software, except that You may alter any license notices to the - extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on - behalf of any Contributor. You must make it absolutely clear that any - such warranty, support, indemnity, or liability obligation is offered by - You alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, - judicial order, or regulation then You must: (a) comply with the terms of - this License to the maximum extent possible; and (b) describe the - limitations and the code they affect. Such description must be placed in a - text file included with all distributions of the Covered Software under - this License. Except to the extent prohibited by statute or regulation, - such description must be sufficiently detailed for a recipient of ordinary - skill to be able to understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing - basis, if such Contributor fails to notify You of the non-compliance by - some reasonable means prior to 60 days after You have come back into - compliance. Moreover, Your grants from a particular Contributor are - reinstated on an ongoing basis if such Contributor notifies You of the - non-compliance by some reasonable means, this is the first time You have - received notice of non-compliance with this License from such - Contributor, and You become compliant prior to 30 days after Your receipt - of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, - counter-claims, and cross-claims) alleging that a Contributor Version - directly or indirectly infringes any patent, then the rights granted to - You by any and all Contributors for the Covered Software under Section - 2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an "as is" basis, - without warranty of any kind, either expressed, implied, or statutory, - including, without limitation, warranties that the Covered Software is free - of defects, merchantable, fit for a particular purpose or non-infringing. - The entire risk as to the quality and performance of the Covered Software - is with You. Should any Covered Software prove defective in any respect, - You (not any Contributor) assume the cost of any necessary servicing, - repair, or correction. This disclaimer of warranty constitutes an essential - part of this License. No use of any Covered Software is authorized under - this License except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from - such party's negligence to the extent applicable law prohibits such - limitation. Some jurisdictions do not allow the exclusion or limitation of - incidental or consequential damages, so this exclusion and limitation may - not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts - of a jurisdiction where the defendant maintains its principal place of - business and such litigation shall be governed by laws of that - jurisdiction, without reference to its conflict-of-law provisions. Nothing - in this Section shall prevent a party's ability to bring cross-claims or - counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. Any law or regulation which provides that - the language of a contract shall be construed against the drafter shall not - be used to construe this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version - of the License under which You originally received the Covered Software, - or under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a - modified version of this License if you rename the license and remove - any references to the name of the license steward (except to note that - such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary - Licenses If You choose to distribute Source Code Form that is - Incompatible With Secondary Licenses under the terms of this version of - the License, the notice described in Exhibit B of this License must be - attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, -then You may include the notice in a location (such as a LICENSE file in a -relevant directory) where a recipient would be likely to look for such a -notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice - - This Source Code Form is "Incompatible - With Secondary Licenses", as defined by - the Mozilla Public License, v. 2.0. - diff --git a/vendor/github.com/hashicorp/go-immutable-radix/README.md b/vendor/github.com/hashicorp/go-immutable-radix/README.md deleted file mode 100644 index aca15a642..000000000 --- a/vendor/github.com/hashicorp/go-immutable-radix/README.md +++ /dev/null @@ -1,66 +0,0 @@ -go-immutable-radix [![CircleCI](https://circleci.com/gh/hashicorp/go-immutable-radix/tree/master.svg?style=svg)](https://circleci.com/gh/hashicorp/go-immutable-radix/tree/master) -========= - -Provides the `iradix` package that implements an immutable [radix tree](http://en.wikipedia.org/wiki/Radix_tree). -The package only provides a single `Tree` implementation, optimized for sparse nodes. - -As a radix tree, it provides the following: - * O(k) operations. In many cases, this can be faster than a hash table since - the hash function is an O(k) operation, and hash tables have very poor cache locality. - * Minimum / Maximum value lookups - * Ordered iteration - -A tree supports using a transaction to batch multiple updates (insert, delete) -in a more efficient manner than performing each operation one at a time. - -For a mutable variant, see [go-radix](https://github.com/armon/go-radix). - -Documentation -============= - -The full documentation is available on [Godoc](http://godoc.org/github.com/hashicorp/go-immutable-radix). - -Example -======= - -Below is a simple example of usage - -```go -// Create a tree -r := iradix.New() -r, _, _ = r.Insert([]byte("foo"), 1) -r, _, _ = r.Insert([]byte("bar"), 2) -r, _, _ = r.Insert([]byte("foobar"), 2) - -// Find the longest prefix match -m, _, _ := r.Root().LongestPrefix([]byte("foozip")) -if string(m) != "foo" { - panic("should be foo") -} -``` - -Here is an example of performing a range scan of the keys. - -```go -// Create a tree -r := iradix.New() -r, _, _ = r.Insert([]byte("001"), 1) -r, _, _ = r.Insert([]byte("002"), 2) -r, _, _ = r.Insert([]byte("005"), 5) -r, _, _ = r.Insert([]byte("010"), 10) -r, _, _ = r.Insert([]byte("100"), 10) - -// Range scan over the keys that sort lexicographically between [003, 050) -it := r.Root().Iterator() -it.SeekLowerBound([]byte("003")) -for key, _, ok := it.Next(); ok; key, _, ok = it.Next() { - if key >= "050" { - break - } - fmt.Println(key) -} -// Output: -// 005 -// 010 -``` - diff --git a/vendor/github.com/hashicorp/go-immutable-radix/edges.go b/vendor/github.com/hashicorp/go-immutable-radix/edges.go deleted file mode 100644 index a63674775..000000000 --- a/vendor/github.com/hashicorp/go-immutable-radix/edges.go +++ /dev/null @@ -1,21 +0,0 @@ -package iradix - -import "sort" - -type edges []edge - -func (e edges) Len() int { - return len(e) -} - -func (e edges) Less(i, j int) bool { - return e[i].label < e[j].label -} - -func (e edges) Swap(i, j int) { - e[i], e[j] = e[j], e[i] -} - -func (e edges) Sort() { - sort.Sort(e) -} diff --git a/vendor/github.com/hashicorp/go-immutable-radix/iradix.go b/vendor/github.com/hashicorp/go-immutable-radix/iradix.go deleted file mode 100644 index 168bda76d..000000000 --- a/vendor/github.com/hashicorp/go-immutable-radix/iradix.go +++ /dev/null @@ -1,676 +0,0 @@ -package iradix - -import ( - "bytes" - "strings" - - "github.com/hashicorp/golang-lru/simplelru" -) - -const ( - // defaultModifiedCache is the default size of the modified node - // cache used per transaction. This is used to cache the updates - // to the nodes near the root, while the leaves do not need to be - // cached. This is important for very large transactions to prevent - // the modified cache from growing to be enormous. This is also used - // to set the max size of the mutation notify maps since those should - // also be bounded in a similar way. - defaultModifiedCache = 8192 -) - -// Tree implements an immutable radix tree. This can be treated as a -// Dictionary abstract data type. The main advantage over a standard -// hash map is prefix-based lookups and ordered iteration. The immutability -// means that it is safe to concurrently read from a Tree without any -// coordination. -type Tree struct { - root *Node - size int -} - -// New returns an empty Tree -func New() *Tree { - t := &Tree{ - root: &Node{ - mutateCh: make(chan struct{}), - }, - } - return t -} - -// Len is used to return the number of elements in the tree -func (t *Tree) Len() int { - return t.size -} - -// Txn is a transaction on the tree. This transaction is applied -// atomically and returns a new tree when committed. A transaction -// is not thread safe, and should only be used by a single goroutine. -type Txn struct { - // root is the modified root for the transaction. - root *Node - - // snap is a snapshot of the root node for use if we have to run the - // slow notify algorithm. - snap *Node - - // size tracks the size of the tree as it is modified during the - // transaction. - size int - - // writable is a cache of writable nodes that have been created during - // the course of the transaction. This allows us to re-use the same - // nodes for further writes and avoid unnecessary copies of nodes that - // have never been exposed outside the transaction. This will only hold - // up to defaultModifiedCache number of entries. - writable *simplelru.LRU - - // trackChannels is used to hold channels that need to be notified to - // signal mutation of the tree. This will only hold up to - // defaultModifiedCache number of entries, after which we will set the - // trackOverflow flag, which will cause us to use a more expensive - // algorithm to perform the notifications. Mutation tracking is only - // performed if trackMutate is true. - trackChannels map[chan struct{}]struct{} - trackOverflow bool - trackMutate bool -} - -// Txn starts a new transaction that can be used to mutate the tree -func (t *Tree) Txn() *Txn { - txn := &Txn{ - root: t.root, - snap: t.root, - size: t.size, - } - return txn -} - -// Clone makes an independent copy of the transaction. The new transaction -// does not track any nodes and has TrackMutate turned off. The cloned transaction will contain any uncommitted writes in the original transaction but further mutations to either will be independent and result in different radix trees on Commit. A cloned transaction may be passed to another goroutine and mutated there independently however each transaction may only be mutated in a single thread. -func (t *Txn) Clone() *Txn { - // reset the writable node cache to avoid leaking future writes into the clone - t.writable = nil - - txn := &Txn{ - root: t.root, - snap: t.snap, - size: t.size, - } - return txn -} - -// TrackMutate can be used to toggle if mutations are tracked. If this is enabled -// then notifications will be issued for affected internal nodes and leaves when -// the transaction is committed. -func (t *Txn) TrackMutate(track bool) { - t.trackMutate = track -} - -// trackChannel safely attempts to track the given mutation channel, setting the -// overflow flag if we can no longer track any more. This limits the amount of -// state that will accumulate during a transaction and we have a slower algorithm -// to switch to if we overflow. -func (t *Txn) trackChannel(ch chan struct{}) { - // In overflow, make sure we don't store any more objects. - if t.trackOverflow { - return - } - - // If this would overflow the state we reject it and set the flag (since - // we aren't tracking everything that's required any longer). - if len(t.trackChannels) >= defaultModifiedCache { - // Mark that we are in the overflow state - t.trackOverflow = true - - // Clear the map so that the channels can be garbage collected. It is - // safe to do this since we have already overflowed and will be using - // the slow notify algorithm. - t.trackChannels = nil - return - } - - // Create the map on the fly when we need it. - if t.trackChannels == nil { - t.trackChannels = make(map[chan struct{}]struct{}) - } - - // Otherwise we are good to track it. - t.trackChannels[ch] = struct{}{} -} - -// writeNode returns a node to be modified, if the current node has already been -// modified during the course of the transaction, it is used in-place. Set -// forLeafUpdate to true if you are getting a write node to update the leaf, -// which will set leaf mutation tracking appropriately as well. -func (t *Txn) writeNode(n *Node, forLeafUpdate bool) *Node { - // Ensure the writable set exists. - if t.writable == nil { - lru, err := simplelru.NewLRU(defaultModifiedCache, nil) - if err != nil { - panic(err) - } - t.writable = lru - } - - // If this node has already been modified, we can continue to use it - // during this transaction. We know that we don't need to track it for - // a node update since the node is writable, but if this is for a leaf - // update we track it, in case the initial write to this node didn't - // update the leaf. - if _, ok := t.writable.Get(n); ok { - if t.trackMutate && forLeafUpdate && n.leaf != nil { - t.trackChannel(n.leaf.mutateCh) - } - return n - } - - // Mark this node as being mutated. - if t.trackMutate { - t.trackChannel(n.mutateCh) - } - - // Mark its leaf as being mutated, if appropriate. - if t.trackMutate && forLeafUpdate && n.leaf != nil { - t.trackChannel(n.leaf.mutateCh) - } - - // Copy the existing node. If you have set forLeafUpdate it will be - // safe to replace this leaf with another after you get your node for - // writing. You MUST replace it, because the channel associated with - // this leaf will be closed when this transaction is committed. - nc := &Node{ - mutateCh: make(chan struct{}), - leaf: n.leaf, - } - if n.prefix != nil { - nc.prefix = make([]byte, len(n.prefix)) - copy(nc.prefix, n.prefix) - } - if len(n.edges) != 0 { - nc.edges = make([]edge, len(n.edges)) - copy(nc.edges, n.edges) - } - - // Mark this node as writable. - t.writable.Add(nc, nil) - return nc -} - -// Visit all the nodes in the tree under n, and add their mutateChannels to the transaction -// Returns the size of the subtree visited -func (t *Txn) trackChannelsAndCount(n *Node) int { - // Count only leaf nodes - leaves := 0 - if n.leaf != nil { - leaves = 1 - } - // Mark this node as being mutated. - if t.trackMutate { - t.trackChannel(n.mutateCh) - } - - // Mark its leaf as being mutated, if appropriate. - if t.trackMutate && n.leaf != nil { - t.trackChannel(n.leaf.mutateCh) - } - - // Recurse on the children - for _, e := range n.edges { - leaves += t.trackChannelsAndCount(e.node) - } - return leaves -} - -// mergeChild is called to collapse the given node with its child. This is only -// called when the given node is not a leaf and has a single edge. -func (t *Txn) mergeChild(n *Node) { - // Mark the child node as being mutated since we are about to abandon - // it. We don't need to mark the leaf since we are retaining it if it - // is there. - e := n.edges[0] - child := e.node - if t.trackMutate { - t.trackChannel(child.mutateCh) - } - - // Merge the nodes. - n.prefix = concat(n.prefix, child.prefix) - n.leaf = child.leaf - if len(child.edges) != 0 { - n.edges = make([]edge, len(child.edges)) - copy(n.edges, child.edges) - } else { - n.edges = nil - } -} - -// insert does a recursive insertion -func (t *Txn) insert(n *Node, k, search []byte, v interface{}) (*Node, interface{}, bool) { - // Handle key exhaustion - if len(search) == 0 { - var oldVal interface{} - didUpdate := false - if n.isLeaf() { - oldVal = n.leaf.val - didUpdate = true - } - - nc := t.writeNode(n, true) - nc.leaf = &leafNode{ - mutateCh: make(chan struct{}), - key: k, - val: v, - } - return nc, oldVal, didUpdate - } - - // Look for the edge - idx, child := n.getEdge(search[0]) - - // No edge, create one - if child == nil { - e := edge{ - label: search[0], - node: &Node{ - mutateCh: make(chan struct{}), - leaf: &leafNode{ - mutateCh: make(chan struct{}), - key: k, - val: v, - }, - prefix: search, - }, - } - nc := t.writeNode(n, false) - nc.addEdge(e) - return nc, nil, false - } - - // Determine longest prefix of the search key on match - commonPrefix := longestPrefix(search, child.prefix) - if commonPrefix == len(child.prefix) { - search = search[commonPrefix:] - newChild, oldVal, didUpdate := t.insert(child, k, search, v) - if newChild != nil { - nc := t.writeNode(n, false) - nc.edges[idx].node = newChild - return nc, oldVal, didUpdate - } - return nil, oldVal, didUpdate - } - - // Split the node - nc := t.writeNode(n, false) - splitNode := &Node{ - mutateCh: make(chan struct{}), - prefix: search[:commonPrefix], - } - nc.replaceEdge(edge{ - label: search[0], - node: splitNode, - }) - - // Restore the existing child node - modChild := t.writeNode(child, false) - splitNode.addEdge(edge{ - label: modChild.prefix[commonPrefix], - node: modChild, - }) - modChild.prefix = modChild.prefix[commonPrefix:] - - // Create a new leaf node - leaf := &leafNode{ - mutateCh: make(chan struct{}), - key: k, - val: v, - } - - // If the new key is a subset, add to to this node - search = search[commonPrefix:] - if len(search) == 0 { - splitNode.leaf = leaf - return nc, nil, false - } - - // Create a new edge for the node - splitNode.addEdge(edge{ - label: search[0], - node: &Node{ - mutateCh: make(chan struct{}), - leaf: leaf, - prefix: search, - }, - }) - return nc, nil, false -} - -// delete does a recursive deletion -func (t *Txn) delete(parent, n *Node, search []byte) (*Node, *leafNode) { - // Check for key exhaustion - if len(search) == 0 { - if !n.isLeaf() { - return nil, nil - } - // Copy the pointer in case we are in a transaction that already - // modified this node since the node will be reused. Any changes - // made to the node will not affect returning the original leaf - // value. - oldLeaf := n.leaf - - // Remove the leaf node - nc := t.writeNode(n, true) - nc.leaf = nil - - // Check if this node should be merged - if n != t.root && len(nc.edges) == 1 { - t.mergeChild(nc) - } - return nc, oldLeaf - } - - // Look for an edge - label := search[0] - idx, child := n.getEdge(label) - if child == nil || !bytes.HasPrefix(search, child.prefix) { - return nil, nil - } - - // Consume the search prefix - search = search[len(child.prefix):] - newChild, leaf := t.delete(n, child, search) - if newChild == nil { - return nil, nil - } - - // Copy this node. WATCH OUT - it's safe to pass "false" here because we - // will only ADD a leaf via nc.mergeChild() if there isn't one due to - // the !nc.isLeaf() check in the logic just below. This is pretty subtle, - // so be careful if you change any of the logic here. - nc := t.writeNode(n, false) - - // Delete the edge if the node has no edges - if newChild.leaf == nil && len(newChild.edges) == 0 { - nc.delEdge(label) - if n != t.root && len(nc.edges) == 1 && !nc.isLeaf() { - t.mergeChild(nc) - } - } else { - nc.edges[idx].node = newChild - } - return nc, leaf -} - -// delete does a recursive deletion -func (t *Txn) deletePrefix(parent, n *Node, search []byte) (*Node, int) { - // Check for key exhaustion - if len(search) == 0 { - nc := t.writeNode(n, true) - if n.isLeaf() { - nc.leaf = nil - } - nc.edges = nil - return nc, t.trackChannelsAndCount(n) - } - - // Look for an edge - label := search[0] - idx, child := n.getEdge(label) - // We make sure that either the child node's prefix starts with the search term, or the search term starts with the child node's prefix - // Need to do both so that we can delete prefixes that don't correspond to any node in the tree - if child == nil || (!bytes.HasPrefix(child.prefix, search) && !bytes.HasPrefix(search, child.prefix)) { - return nil, 0 - } - - // Consume the search prefix - if len(child.prefix) > len(search) { - search = []byte("") - } else { - search = search[len(child.prefix):] - } - newChild, numDeletions := t.deletePrefix(n, child, search) - if newChild == nil { - return nil, 0 - } - // Copy this node. WATCH OUT - it's safe to pass "false" here because we - // will only ADD a leaf via nc.mergeChild() if there isn't one due to - // the !nc.isLeaf() check in the logic just below. This is pretty subtle, - // so be careful if you change any of the logic here. - - nc := t.writeNode(n, false) - - // Delete the edge if the node has no edges - if newChild.leaf == nil && len(newChild.edges) == 0 { - nc.delEdge(label) - if n != t.root && len(nc.edges) == 1 && !nc.isLeaf() { - t.mergeChild(nc) - } - } else { - nc.edges[idx].node = newChild - } - return nc, numDeletions -} - -// Insert is used to add or update a given key. The return provides -// the previous value and a bool indicating if any was set. -func (t *Txn) Insert(k []byte, v interface{}) (interface{}, bool) { - newRoot, oldVal, didUpdate := t.insert(t.root, k, k, v) - if newRoot != nil { - t.root = newRoot - } - if !didUpdate { - t.size++ - } - return oldVal, didUpdate -} - -// Delete is used to delete a given key. Returns the old value if any, -// and a bool indicating if the key was set. -func (t *Txn) Delete(k []byte) (interface{}, bool) { - newRoot, leaf := t.delete(nil, t.root, k) - if newRoot != nil { - t.root = newRoot - } - if leaf != nil { - t.size-- - return leaf.val, true - } - return nil, false -} - -// DeletePrefix is used to delete an entire subtree that matches the prefix -// This will delete all nodes under that prefix -func (t *Txn) DeletePrefix(prefix []byte) bool { - newRoot, numDeletions := t.deletePrefix(nil, t.root, prefix) - if newRoot != nil { - t.root = newRoot - t.size = t.size - numDeletions - return true - } - return false - -} - -// Root returns the current root of the radix tree within this -// transaction. The root is not safe across insert and delete operations, -// but can be used to read the current state during a transaction. -func (t *Txn) Root() *Node { - return t.root -} - -// Get is used to lookup a specific key, returning -// the value and if it was found -func (t *Txn) Get(k []byte) (interface{}, bool) { - return t.root.Get(k) -} - -// GetWatch is used to lookup a specific key, returning -// the watch channel, value and if it was found -func (t *Txn) GetWatch(k []byte) (<-chan struct{}, interface{}, bool) { - return t.root.GetWatch(k) -} - -// Commit is used to finalize the transaction and return a new tree. If mutation -// tracking is turned on then notifications will also be issued. -func (t *Txn) Commit() *Tree { - nt := t.CommitOnly() - if t.trackMutate { - t.Notify() - } - return nt -} - -// CommitOnly is used to finalize the transaction and return a new tree, but -// does not issue any notifications until Notify is called. -func (t *Txn) CommitOnly() *Tree { - nt := &Tree{t.root, t.size} - t.writable = nil - return nt -} - -// slowNotify does a complete comparison of the before and after trees in order -// to trigger notifications. This doesn't require any additional state but it -// is very expensive to compute. -func (t *Txn) slowNotify() { - snapIter := t.snap.rawIterator() - rootIter := t.root.rawIterator() - for snapIter.Front() != nil || rootIter.Front() != nil { - // If we've exhausted the nodes in the old snapshot, we know - // there's nothing remaining to notify. - if snapIter.Front() == nil { - return - } - snapElem := snapIter.Front() - - // If we've exhausted the nodes in the new root, we know we need - // to invalidate everything that remains in the old snapshot. We - // know from the loop condition there's something in the old - // snapshot. - if rootIter.Front() == nil { - close(snapElem.mutateCh) - if snapElem.isLeaf() { - close(snapElem.leaf.mutateCh) - } - snapIter.Next() - continue - } - - // Do one string compare so we can check the various conditions - // below without repeating the compare. - cmp := strings.Compare(snapIter.Path(), rootIter.Path()) - - // If the snapshot is behind the root, then we must have deleted - // this node during the transaction. - if cmp < 0 { - close(snapElem.mutateCh) - if snapElem.isLeaf() { - close(snapElem.leaf.mutateCh) - } - snapIter.Next() - continue - } - - // If the snapshot is ahead of the root, then we must have added - // this node during the transaction. - if cmp > 0 { - rootIter.Next() - continue - } - - // If we have the same path, then we need to see if we mutated a - // node and possibly the leaf. - rootElem := rootIter.Front() - if snapElem != rootElem { - close(snapElem.mutateCh) - if snapElem.leaf != nil && (snapElem.leaf != rootElem.leaf) { - close(snapElem.leaf.mutateCh) - } - } - snapIter.Next() - rootIter.Next() - } -} - -// Notify is used along with TrackMutate to trigger notifications. This must -// only be done once a transaction is committed via CommitOnly, and it is called -// automatically by Commit. -func (t *Txn) Notify() { - if !t.trackMutate { - return - } - - // If we've overflowed the tracking state we can't use it in any way and - // need to do a full tree compare. - if t.trackOverflow { - t.slowNotify() - } else { - for ch := range t.trackChannels { - close(ch) - } - } - - // Clean up the tracking state so that a re-notify is safe (will trigger - // the else clause above which will be a no-op). - t.trackChannels = nil - t.trackOverflow = false -} - -// Insert is used to add or update a given key. The return provides -// the new tree, previous value and a bool indicating if any was set. -func (t *Tree) Insert(k []byte, v interface{}) (*Tree, interface{}, bool) { - txn := t.Txn() - old, ok := txn.Insert(k, v) - return txn.Commit(), old, ok -} - -// Delete is used to delete a given key. Returns the new tree, -// old value if any, and a bool indicating if the key was set. -func (t *Tree) Delete(k []byte) (*Tree, interface{}, bool) { - txn := t.Txn() - old, ok := txn.Delete(k) - return txn.Commit(), old, ok -} - -// DeletePrefix is used to delete all nodes starting with a given prefix. Returns the new tree, -// and a bool indicating if the prefix matched any nodes -func (t *Tree) DeletePrefix(k []byte) (*Tree, bool) { - txn := t.Txn() - ok := txn.DeletePrefix(k) - return txn.Commit(), ok -} - -// Root returns the root node of the tree which can be used for richer -// query operations. -func (t *Tree) Root() *Node { - return t.root -} - -// Get is used to lookup a specific key, returning -// the value and if it was found -func (t *Tree) Get(k []byte) (interface{}, bool) { - return t.root.Get(k) -} - -// longestPrefix finds the length of the shared prefix -// of two strings -func longestPrefix(k1, k2 []byte) int { - max := len(k1) - if l := len(k2); l < max { - max = l - } - var i int - for i = 0; i < max; i++ { - if k1[i] != k2[i] { - break - } - } - return i -} - -// concat two byte slices, returning a third new copy -func concat(a, b []byte) []byte { - c := make([]byte, len(a)+len(b)) - copy(c, a) - copy(c[len(a):], b) - return c -} diff --git a/vendor/github.com/hashicorp/go-immutable-radix/iter.go b/vendor/github.com/hashicorp/go-immutable-radix/iter.go deleted file mode 100644 index f17d0a644..000000000 --- a/vendor/github.com/hashicorp/go-immutable-radix/iter.go +++ /dev/null @@ -1,205 +0,0 @@ -package iradix - -import ( - "bytes" -) - -// Iterator is used to iterate over a set of nodes -// in pre-order -type Iterator struct { - node *Node - stack []edges -} - -// SeekPrefixWatch is used to seek the iterator to a given prefix -// and returns the watch channel of the finest granularity -func (i *Iterator) SeekPrefixWatch(prefix []byte) (watch <-chan struct{}) { - // Wipe the stack - i.stack = nil - n := i.node - watch = n.mutateCh - search := prefix - for { - // Check for key exhaustion - if len(search) == 0 { - i.node = n - return - } - - // Look for an edge - _, n = n.getEdge(search[0]) - if n == nil { - i.node = nil - return - } - - // Update to the finest granularity as the search makes progress - watch = n.mutateCh - - // Consume the search prefix - if bytes.HasPrefix(search, n.prefix) { - search = search[len(n.prefix):] - - } else if bytes.HasPrefix(n.prefix, search) { - i.node = n - return - } else { - i.node = nil - return - } - } -} - -// SeekPrefix is used to seek the iterator to a given prefix -func (i *Iterator) SeekPrefix(prefix []byte) { - i.SeekPrefixWatch(prefix) -} - -func (i *Iterator) recurseMin(n *Node) *Node { - // Traverse to the minimum child - if n.leaf != nil { - return n - } - nEdges := len(n.edges) - if nEdges > 1 { - // Add all the other edges to the stack (the min node will be added as - // we recurse) - i.stack = append(i.stack, n.edges[1:]) - } - if nEdges > 0 { - return i.recurseMin(n.edges[0].node) - } - // Shouldn't be possible - return nil -} - -// SeekLowerBound is used to seek the iterator to the smallest key that is -// greater or equal to the given key. There is no watch variant as it's hard to -// predict based on the radix structure which node(s) changes might affect the -// result. -func (i *Iterator) SeekLowerBound(key []byte) { - // Wipe the stack. Unlike Prefix iteration, we need to build the stack as we - // go because we need only a subset of edges of many nodes in the path to the - // leaf with the lower bound. Note that the iterator will still recurse into - // children that we don't traverse on the way to the reverse lower bound as it - // walks the stack. - i.stack = []edges{} - // i.node starts off in the common case as pointing to the root node of the - // tree. By the time we return we have either found a lower bound and setup - // the stack to traverse all larger keys, or we have not and the stack and - // node should both be nil to prevent the iterator from assuming it is just - // iterating the whole tree from the root node. Either way this needs to end - // up as nil so just set it here. - n := i.node - i.node = nil - search := key - - found := func(n *Node) { - i.stack = append(i.stack, edges{edge{node: n}}) - } - - findMin := func(n *Node) { - n = i.recurseMin(n) - if n != nil { - found(n) - return - } - } - - for { - // Compare current prefix with the search key's same-length prefix. - var prefixCmp int - if len(n.prefix) < len(search) { - prefixCmp = bytes.Compare(n.prefix, search[0:len(n.prefix)]) - } else { - prefixCmp = bytes.Compare(n.prefix, search) - } - - if prefixCmp > 0 { - // Prefix is larger, that means the lower bound is greater than the search - // and from now on we need to follow the minimum path to the smallest - // leaf under this subtree. - findMin(n) - return - } - - if prefixCmp < 0 { - // Prefix is smaller than search prefix, that means there is no lower - // bound - i.node = nil - return - } - - // Prefix is equal, we are still heading for an exact match. If this is a - // leaf and an exact match we're done. - if n.leaf != nil && bytes.Equal(n.leaf.key, key) { - found(n) - return - } - - // Consume the search prefix if the current node has one. Note that this is - // safe because if n.prefix is longer than the search slice prefixCmp would - // have been > 0 above and the method would have already returned. - search = search[len(n.prefix):] - - if len(search) == 0 { - // We've exhausted the search key, but the current node is not an exact - // match or not a leaf. That means that the leaf value if it exists, and - // all child nodes must be strictly greater, the smallest key in this - // subtree must be the lower bound. - findMin(n) - return - } - - // Otherwise, take the lower bound next edge. - idx, lbNode := n.getLowerBoundEdge(search[0]) - if lbNode == nil { - return - } - - // Create stack edges for the all strictly higher edges in this node. - if idx+1 < len(n.edges) { - i.stack = append(i.stack, n.edges[idx+1:]) - } - - // Recurse - n = lbNode - } -} - -// Next returns the next node in order -func (i *Iterator) Next() ([]byte, interface{}, bool) { - // Initialize our stack if needed - if i.stack == nil && i.node != nil { - i.stack = []edges{ - { - edge{node: i.node}, - }, - } - } - - for len(i.stack) > 0 { - // Inspect the last element of the stack - n := len(i.stack) - last := i.stack[n-1] - elem := last[0].node - - // Update the stack - if len(last) > 1 { - i.stack[n-1] = last[1:] - } else { - i.stack = i.stack[:n-1] - } - - // Push the edges onto the frontier - if len(elem.edges) > 0 { - i.stack = append(i.stack, elem.edges) - } - - // Return the leaf values if any - if elem.leaf != nil { - return elem.leaf.key, elem.leaf.val, true - } - } - return nil, nil, false -} diff --git a/vendor/github.com/hashicorp/go-immutable-radix/node.go b/vendor/github.com/hashicorp/go-immutable-radix/node.go deleted file mode 100644 index 359854808..000000000 --- a/vendor/github.com/hashicorp/go-immutable-radix/node.go +++ /dev/null @@ -1,334 +0,0 @@ -package iradix - -import ( - "bytes" - "sort" -) - -// WalkFn is used when walking the tree. Takes a -// key and value, returning if iteration should -// be terminated. -type WalkFn func(k []byte, v interface{}) bool - -// leafNode is used to represent a value -type leafNode struct { - mutateCh chan struct{} - key []byte - val interface{} -} - -// edge is used to represent an edge node -type edge struct { - label byte - node *Node -} - -// Node is an immutable node in the radix tree -type Node struct { - // mutateCh is closed if this node is modified - mutateCh chan struct{} - - // leaf is used to store possible leaf - leaf *leafNode - - // prefix is the common prefix we ignore - prefix []byte - - // Edges should be stored in-order for iteration. - // We avoid a fully materialized slice to save memory, - // since in most cases we expect to be sparse - edges edges -} - -func (n *Node) isLeaf() bool { - return n.leaf != nil -} - -func (n *Node) addEdge(e edge) { - num := len(n.edges) - idx := sort.Search(num, func(i int) bool { - return n.edges[i].label >= e.label - }) - n.edges = append(n.edges, e) - if idx != num { - copy(n.edges[idx+1:], n.edges[idx:num]) - n.edges[idx] = e - } -} - -func (n *Node) replaceEdge(e edge) { - num := len(n.edges) - idx := sort.Search(num, func(i int) bool { - return n.edges[i].label >= e.label - }) - if idx < num && n.edges[idx].label == e.label { - n.edges[idx].node = e.node - return - } - panic("replacing missing edge") -} - -func (n *Node) getEdge(label byte) (int, *Node) { - num := len(n.edges) - idx := sort.Search(num, func(i int) bool { - return n.edges[i].label >= label - }) - if idx < num && n.edges[idx].label == label { - return idx, n.edges[idx].node - } - return -1, nil -} - -func (n *Node) getLowerBoundEdge(label byte) (int, *Node) { - num := len(n.edges) - idx := sort.Search(num, func(i int) bool { - return n.edges[i].label >= label - }) - // we want lower bound behavior so return even if it's not an exact match - if idx < num { - return idx, n.edges[idx].node - } - return -1, nil -} - -func (n *Node) delEdge(label byte) { - num := len(n.edges) - idx := sort.Search(num, func(i int) bool { - return n.edges[i].label >= label - }) - if idx < num && n.edges[idx].label == label { - copy(n.edges[idx:], n.edges[idx+1:]) - n.edges[len(n.edges)-1] = edge{} - n.edges = n.edges[:len(n.edges)-1] - } -} - -func (n *Node) GetWatch(k []byte) (<-chan struct{}, interface{}, bool) { - search := k - watch := n.mutateCh - for { - // Check for key exhaustion - if len(search) == 0 { - if n.isLeaf() { - return n.leaf.mutateCh, n.leaf.val, true - } - break - } - - // Look for an edge - _, n = n.getEdge(search[0]) - if n == nil { - break - } - - // Update to the finest granularity as the search makes progress - watch = n.mutateCh - - // Consume the search prefix - if bytes.HasPrefix(search, n.prefix) { - search = search[len(n.prefix):] - } else { - break - } - } - return watch, nil, false -} - -func (n *Node) Get(k []byte) (interface{}, bool) { - _, val, ok := n.GetWatch(k) - return val, ok -} - -// LongestPrefix is like Get, but instead of an -// exact match, it will return the longest prefix match. -func (n *Node) LongestPrefix(k []byte) ([]byte, interface{}, bool) { - var last *leafNode - search := k - for { - // Look for a leaf node - if n.isLeaf() { - last = n.leaf - } - - // Check for key exhaution - if len(search) == 0 { - break - } - - // Look for an edge - _, n = n.getEdge(search[0]) - if n == nil { - break - } - - // Consume the search prefix - if bytes.HasPrefix(search, n.prefix) { - search = search[len(n.prefix):] - } else { - break - } - } - if last != nil { - return last.key, last.val, true - } - return nil, nil, false -} - -// Minimum is used to return the minimum value in the tree -func (n *Node) Minimum() ([]byte, interface{}, bool) { - for { - if n.isLeaf() { - return n.leaf.key, n.leaf.val, true - } - if len(n.edges) > 0 { - n = n.edges[0].node - } else { - break - } - } - return nil, nil, false -} - -// Maximum is used to return the maximum value in the tree -func (n *Node) Maximum() ([]byte, interface{}, bool) { - for { - if num := len(n.edges); num > 0 { - n = n.edges[num-1].node - continue - } - if n.isLeaf() { - return n.leaf.key, n.leaf.val, true - } else { - break - } - } - return nil, nil, false -} - -// Iterator is used to return an iterator at -// the given node to walk the tree -func (n *Node) Iterator() *Iterator { - return &Iterator{node: n} -} - -// ReverseIterator is used to return an iterator at -// the given node to walk the tree backwards -func (n *Node) ReverseIterator() *ReverseIterator { - return NewReverseIterator(n) -} - -// rawIterator is used to return a raw iterator at the given node to walk the -// tree. -func (n *Node) rawIterator() *rawIterator { - iter := &rawIterator{node: n} - iter.Next() - return iter -} - -// Walk is used to walk the tree -func (n *Node) Walk(fn WalkFn) { - recursiveWalk(n, fn) -} - -// WalkBackwards is used to walk the tree in reverse order -func (n *Node) WalkBackwards(fn WalkFn) { - reverseRecursiveWalk(n, fn) -} - -// WalkPrefix is used to walk the tree under a prefix -func (n *Node) WalkPrefix(prefix []byte, fn WalkFn) { - search := prefix - for { - // Check for key exhaution - if len(search) == 0 { - recursiveWalk(n, fn) - return - } - - // Look for an edge - _, n = n.getEdge(search[0]) - if n == nil { - break - } - - // Consume the search prefix - if bytes.HasPrefix(search, n.prefix) { - search = search[len(n.prefix):] - - } else if bytes.HasPrefix(n.prefix, search) { - // Child may be under our search prefix - recursiveWalk(n, fn) - return - } else { - break - } - } -} - -// WalkPath is used to walk the tree, but only visiting nodes -// from the root down to a given leaf. Where WalkPrefix walks -// all the entries *under* the given prefix, this walks the -// entries *above* the given prefix. -func (n *Node) WalkPath(path []byte, fn WalkFn) { - search := path - for { - // Visit the leaf values if any - if n.leaf != nil && fn(n.leaf.key, n.leaf.val) { - return - } - - // Check for key exhaution - if len(search) == 0 { - return - } - - // Look for an edge - _, n = n.getEdge(search[0]) - if n == nil { - return - } - - // Consume the search prefix - if bytes.HasPrefix(search, n.prefix) { - search = search[len(n.prefix):] - } else { - break - } - } -} - -// recursiveWalk is used to do a pre-order walk of a node -// recursively. Returns true if the walk should be aborted -func recursiveWalk(n *Node, fn WalkFn) bool { - // Visit the leaf values if any - if n.leaf != nil && fn(n.leaf.key, n.leaf.val) { - return true - } - - // Recurse on the children - for _, e := range n.edges { - if recursiveWalk(e.node, fn) { - return true - } - } - return false -} - -// reverseRecursiveWalk is used to do a reverse pre-order -// walk of a node recursively. Returns true if the walk -// should be aborted -func reverseRecursiveWalk(n *Node, fn WalkFn) bool { - // Visit the leaf values if any - if n.leaf != nil && fn(n.leaf.key, n.leaf.val) { - return true - } - - // Recurse on the children in reverse order - for i := len(n.edges) - 1; i >= 0; i-- { - e := n.edges[i] - if reverseRecursiveWalk(e.node, fn) { - return true - } - } - return false -} diff --git a/vendor/github.com/hashicorp/go-immutable-radix/raw_iter.go b/vendor/github.com/hashicorp/go-immutable-radix/raw_iter.go deleted file mode 100644 index 3c6a22525..000000000 --- a/vendor/github.com/hashicorp/go-immutable-radix/raw_iter.go +++ /dev/null @@ -1,78 +0,0 @@ -package iradix - -// rawIterator visits each of the nodes in the tree, even the ones that are not -// leaves. It keeps track of the effective path (what a leaf at a given node -// would be called), which is useful for comparing trees. -type rawIterator struct { - // node is the starting node in the tree for the iterator. - node *Node - - // stack keeps track of edges in the frontier. - stack []rawStackEntry - - // pos is the current position of the iterator. - pos *Node - - // path is the effective path of the current iterator position, - // regardless of whether the current node is a leaf. - path string -} - -// rawStackEntry is used to keep track of the cumulative common path as well as -// its associated edges in the frontier. -type rawStackEntry struct { - path string - edges edges -} - -// Front returns the current node that has been iterated to. -func (i *rawIterator) Front() *Node { - return i.pos -} - -// Path returns the effective path of the current node, even if it's not actually -// a leaf. -func (i *rawIterator) Path() string { - return i.path -} - -// Next advances the iterator to the next node. -func (i *rawIterator) Next() { - // Initialize our stack if needed. - if i.stack == nil && i.node != nil { - i.stack = []rawStackEntry{ - { - edges: edges{ - edge{node: i.node}, - }, - }, - } - } - - for len(i.stack) > 0 { - // Inspect the last element of the stack. - n := len(i.stack) - last := i.stack[n-1] - elem := last.edges[0].node - - // Update the stack. - if len(last.edges) > 1 { - i.stack[n-1].edges = last.edges[1:] - } else { - i.stack = i.stack[:n-1] - } - - // Push the edges onto the frontier. - if len(elem.edges) > 0 { - path := last.path + string(elem.prefix) - i.stack = append(i.stack, rawStackEntry{path, elem.edges}) - } - - i.pos = elem - i.path = last.path + string(elem.prefix) - return - } - - i.pos = nil - i.path = "" -} diff --git a/vendor/github.com/hashicorp/go-immutable-radix/reverse_iter.go b/vendor/github.com/hashicorp/go-immutable-radix/reverse_iter.go deleted file mode 100644 index 554fa7129..000000000 --- a/vendor/github.com/hashicorp/go-immutable-radix/reverse_iter.go +++ /dev/null @@ -1,239 +0,0 @@ -package iradix - -import ( - "bytes" -) - -// ReverseIterator is used to iterate over a set of nodes -// in reverse in-order -type ReverseIterator struct { - i *Iterator - - // expandedParents stores the set of parent nodes whose relevant children have - // already been pushed into the stack. This can happen during seek or during - // iteration. - // - // Unlike forward iteration we need to recurse into children before we can - // output the value stored in an internal leaf since all children are greater. - // We use this to track whether we have already ensured all the children are - // in the stack. - expandedParents map[*Node]struct{} -} - -// NewReverseIterator returns a new ReverseIterator at a node -func NewReverseIterator(n *Node) *ReverseIterator { - return &ReverseIterator{ - i: &Iterator{node: n}, - } -} - -// SeekPrefixWatch is used to seek the iterator to a given prefix -// and returns the watch channel of the finest granularity -func (ri *ReverseIterator) SeekPrefixWatch(prefix []byte) (watch <-chan struct{}) { - return ri.i.SeekPrefixWatch(prefix) -} - -// SeekPrefix is used to seek the iterator to a given prefix -func (ri *ReverseIterator) SeekPrefix(prefix []byte) { - ri.i.SeekPrefixWatch(prefix) -} - -// SeekReverseLowerBound is used to seek the iterator to the largest key that is -// lower or equal to the given key. There is no watch variant as it's hard to -// predict based on the radix structure which node(s) changes might affect the -// result. -func (ri *ReverseIterator) SeekReverseLowerBound(key []byte) { - // Wipe the stack. Unlike Prefix iteration, we need to build the stack as we - // go because we need only a subset of edges of many nodes in the path to the - // leaf with the lower bound. Note that the iterator will still recurse into - // children that we don't traverse on the way to the reverse lower bound as it - // walks the stack. - ri.i.stack = []edges{} - // ri.i.node starts off in the common case as pointing to the root node of the - // tree. By the time we return we have either found a lower bound and setup - // the stack to traverse all larger keys, or we have not and the stack and - // node should both be nil to prevent the iterator from assuming it is just - // iterating the whole tree from the root node. Either way this needs to end - // up as nil so just set it here. - n := ri.i.node - ri.i.node = nil - search := key - - if ri.expandedParents == nil { - ri.expandedParents = make(map[*Node]struct{}) - } - - found := func(n *Node) { - ri.i.stack = append(ri.i.stack, edges{edge{node: n}}) - // We need to mark this node as expanded in advance too otherwise the - // iterator will attempt to walk all of its children even though they are - // greater than the lower bound we have found. We've expanded it in the - // sense that all of its children that we want to walk are already in the - // stack (i.e. none of them). - ri.expandedParents[n] = struct{}{} - } - - for { - // Compare current prefix with the search key's same-length prefix. - var prefixCmp int - if len(n.prefix) < len(search) { - prefixCmp = bytes.Compare(n.prefix, search[0:len(n.prefix)]) - } else { - prefixCmp = bytes.Compare(n.prefix, search) - } - - if prefixCmp < 0 { - // Prefix is smaller than search prefix, that means there is no exact - // match for the search key. But we are looking in reverse, so the reverse - // lower bound will be the largest leaf under this subtree, since it is - // the value that would come right before the current search key if it - // were in the tree. So we need to follow the maximum path in this subtree - // to find it. Note that this is exactly what the iterator will already do - // if it finds a node in the stack that has _not_ been marked as expanded - // so in this one case we don't call `found` and instead let the iterator - // do the expansion and recursion through all the children. - ri.i.stack = append(ri.i.stack, edges{edge{node: n}}) - return - } - - if prefixCmp > 0 { - // Prefix is larger than search prefix, or there is no prefix but we've - // also exhausted the search key. Either way, that means there is no - // reverse lower bound since nothing comes before our current search - // prefix. - return - } - - // If this is a leaf, something needs to happen! Note that if it's a leaf - // and prefixCmp was zero (which it must be to get here) then the leaf value - // is either an exact match for the search, or it's lower. It can't be - // greater. - if n.isLeaf() { - - // Firstly, if it's an exact match, we're done! - if bytes.Equal(n.leaf.key, key) { - found(n) - return - } - - // It's not so this node's leaf value must be lower and could still be a - // valid contender for reverse lower bound. - - // If it has no children then we are also done. - if len(n.edges) == 0 { - // This leaf is the lower bound. - found(n) - return - } - - // Finally, this leaf is internal (has children) so we'll keep searching, - // but we need to add it to the iterator's stack since it has a leaf value - // that needs to be iterated over. It needs to be added to the stack - // before its children below as it comes first. - ri.i.stack = append(ri.i.stack, edges{edge{node: n}}) - // We also need to mark it as expanded since we'll be adding any of its - // relevant children below and so don't want the iterator to re-add them - // on its way back up the stack. - ri.expandedParents[n] = struct{}{} - } - - // Consume the search prefix. Note that this is safe because if n.prefix is - // longer than the search slice prefixCmp would have been > 0 above and the - // method would have already returned. - search = search[len(n.prefix):] - - if len(search) == 0 { - // We've exhausted the search key but we are not at a leaf. That means all - // children are greater than the search key so a reverse lower bound - // doesn't exist in this subtree. Note that there might still be one in - // the whole radix tree by following a different path somewhere further - // up. If that's the case then the iterator's stack will contain all the - // smaller nodes already and Previous will walk through them correctly. - return - } - - // Otherwise, take the lower bound next edge. - idx, lbNode := n.getLowerBoundEdge(search[0]) - - // From here, we need to update the stack with all values lower than - // the lower bound edge. Since getLowerBoundEdge() returns -1 when the - // search prefix is larger than all edges, we need to place idx at the - // last edge index so they can all be place in the stack, since they - // come before our search prefix. - if idx == -1 { - idx = len(n.edges) - } - - // Create stack edges for the all strictly lower edges in this node. - if len(n.edges[:idx]) > 0 { - ri.i.stack = append(ri.i.stack, n.edges[:idx]) - } - - // Exit if there's no lower bound edge. The stack will have the previous - // nodes already. - if lbNode == nil { - return - } - - // Recurse - n = lbNode - } -} - -// Previous returns the previous node in reverse order -func (ri *ReverseIterator) Previous() ([]byte, interface{}, bool) { - // Initialize our stack if needed - if ri.i.stack == nil && ri.i.node != nil { - ri.i.stack = []edges{ - { - edge{node: ri.i.node}, - }, - } - } - - if ri.expandedParents == nil { - ri.expandedParents = make(map[*Node]struct{}) - } - - for len(ri.i.stack) > 0 { - // Inspect the last element of the stack - n := len(ri.i.stack) - last := ri.i.stack[n-1] - m := len(last) - elem := last[m-1].node - - _, alreadyExpanded := ri.expandedParents[elem] - - // If this is an internal node and we've not seen it already, we need to - // leave it in the stack so we can return its possible leaf value _after_ - // we've recursed through all its children. - if len(elem.edges) > 0 && !alreadyExpanded { - // record that we've seen this node! - ri.expandedParents[elem] = struct{}{} - // push child edges onto stack and skip the rest of the loop to recurse - // into the largest one. - ri.i.stack = append(ri.i.stack, elem.edges) - continue - } - - // Remove the node from the stack - if m > 1 { - ri.i.stack[n-1] = last[:m-1] - } else { - ri.i.stack = ri.i.stack[:n-1] - } - // We don't need this state any more as it's no longer in the stack so we - // won't visit it again - if alreadyExpanded { - delete(ri.expandedParents, elem) - } - - // If this is a leaf, return it - if elem.leaf != nil { - return elem.leaf.key, elem.leaf.val, true - } - - // it's not a leaf so keep walking the stack to find the previous leaf - } - return nil, nil, false -} diff --git a/vendor/github.com/hashicorp/go-immutable-radix/v2/.gitignore b/vendor/github.com/hashicorp/go-immutable-radix/v2/.gitignore deleted file mode 100644 index daf913b1b..000000000 --- a/vendor/github.com/hashicorp/go-immutable-radix/v2/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test -*.prof diff --git a/vendor/github.com/hashicorp/go-immutable-radix/v2/CHANGELOG.md b/vendor/github.com/hashicorp/go-immutable-radix/v2/CHANGELOG.md deleted file mode 100644 index 556f1a67b..000000000 --- a/vendor/github.com/hashicorp/go-immutable-radix/v2/CHANGELOG.md +++ /dev/null @@ -1,27 +0,0 @@ -# UNRELEASED - -# 2.0.0 (December 15th, 2022) - -* Update API to use generics [[GH-43](https://github.com/hashicorp/go-immutable-radix/pull/43)) - -# 1.3.0 (September 17th, 2020) - -FEATURES - -* Add reverse tree traversal [[GH-30](https://github.com/hashicorp/go-immutable-radix/pull/30)] - -# 1.2.0 (March 18th, 2020) - -FEATURES - -* Adds a `Clone` method to `Txn` allowing transactions to be split either into two independently mutable trees. [[GH-26](https://github.com/hashicorp/go-immutable-radix/pull/26)] - -# 1.1.0 (May 22nd, 2019) - -FEATURES - -* Add `SeekLowerBound` to allow for range scans. [[GH-24](https://github.com/hashicorp/go-immutable-radix/pull/24)] - -# 1.0.0 (August 30th, 2018) - -* go mod adopted diff --git a/vendor/github.com/hashicorp/go-immutable-radix/v2/LICENSE b/vendor/github.com/hashicorp/go-immutable-radix/v2/LICENSE deleted file mode 100644 index f4f97ee58..000000000 --- a/vendor/github.com/hashicorp/go-immutable-radix/v2/LICENSE +++ /dev/null @@ -1,365 +0,0 @@ -Copyright (c) 2015 HashiCorp, Inc. - -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. "Contributor" - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. "Contributor Version" - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the terms of - a Secondary License. - -1.6. "Executable Form" - - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - - means a work that combines Covered Software with other material, in a - separate file or files, that is not Covered Software. - -1.8. "License" - - means this document. - -1.9. "Licensable" - - means having the right to grant, to the maximum extent possible, whether - at the time of the initial grant or subsequently, any and all of the - rights conveyed by this License. - -1.10. "Modifications" - - means any of the following: - - a. any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. "Patent Claims" of a Contributor - - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the License, - by the making, using, selling, offering for sale, having made, import, - or transfer of either its Contributions or its Contributor Version. - -1.12. "Secondary License" - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. "Source Code Form" - - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, "control" means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution - become effective for each Contribution on the date the Contributor first - distributes such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under - this License. No additional rights or licenses will be implied from the - distribution or licensing of Covered Software under this License. - Notwithstanding Section 2.1(b) above, no patent license is granted by a - Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of - its Contributions. - - This License does not grant any rights in the trademarks, service marks, - or logos of any Contributor (except as may be necessary to comply with - the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this - License (see Section 10.2) or under the terms of a Secondary License (if - permitted under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its - Contributions are its original creation(s) or it has sufficient rights to - grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under - applicable copyright doctrines of fair use, fair dealing, or other - equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under - the terms of this License. You must inform recipients that the Source - Code Form of the Covered Software is governed by the terms of this - License, and how they can obtain a copy of this License. You may not - attempt to alter or restrict the recipients' rights in the Source Code - Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter the - recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for - the Covered Software. If the Larger Work is a combination of Covered - Software with a work governed by one or more Secondary Licenses, and the - Covered Software is not Incompatible With Secondary Licenses, this - License permits You to additionally distribute such Covered Software - under the terms of such Secondary License(s), so that the recipient of - the Larger Work may, at their option, further distribute the Covered - Software under the terms of either this License or such Secondary - License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices - (including copyright notices, patent notices, disclaimers of warranty, or - limitations of liability) contained within the Source Code Form of the - Covered Software, except that You may alter any license notices to the - extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on - behalf of any Contributor. You must make it absolutely clear that any - such warranty, support, indemnity, or liability obligation is offered by - You alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, - judicial order, or regulation then You must: (a) comply with the terms of - this License to the maximum extent possible; and (b) describe the - limitations and the code they affect. Such description must be placed in a - text file included with all distributions of the Covered Software under - this License. Except to the extent prohibited by statute or regulation, - such description must be sufficiently detailed for a recipient of ordinary - skill to be able to understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing - basis, if such Contributor fails to notify You of the non-compliance by - some reasonable means prior to 60 days after You have come back into - compliance. Moreover, Your grants from a particular Contributor are - reinstated on an ongoing basis if such Contributor notifies You of the - non-compliance by some reasonable means, this is the first time You have - received notice of non-compliance with this License from such - Contributor, and You become compliant prior to 30 days after Your receipt - of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, - counter-claims, and cross-claims) alleging that a Contributor Version - directly or indirectly infringes any patent, then the rights granted to - You by any and all Contributors for the Covered Software under Section - 2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an "as is" basis, - without warranty of any kind, either expressed, implied, or statutory, - including, without limitation, warranties that the Covered Software is free - of defects, merchantable, fit for a particular purpose or non-infringing. - The entire risk as to the quality and performance of the Covered Software - is with You. Should any Covered Software prove defective in any respect, - You (not any Contributor) assume the cost of any necessary servicing, - repair, or correction. This disclaimer of warranty constitutes an essential - part of this License. No use of any Covered Software is authorized under - this License except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from - such party's negligence to the extent applicable law prohibits such - limitation. Some jurisdictions do not allow the exclusion or limitation of - incidental or consequential damages, so this exclusion and limitation may - not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts - of a jurisdiction where the defendant maintains its principal place of - business and such litigation shall be governed by laws of that - jurisdiction, without reference to its conflict-of-law provisions. Nothing - in this Section shall prevent a party's ability to bring cross-claims or - counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. Any law or regulation which provides that - the language of a contract shall be construed against the drafter shall not - be used to construe this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version - of the License under which You originally received the Covered Software, - or under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a - modified version of this License if you rename the license and remove - any references to the name of the license steward (except to note that - such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary - Licenses If You choose to distribute Source Code Form that is - Incompatible With Secondary Licenses under the terms of this version of - the License, the notice described in Exhibit B of this License must be - attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, -then You may include the notice in a location (such as a LICENSE file in a -relevant directory) where a recipient would be likely to look for such a -notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice - - This Source Code Form is "Incompatible - With Secondary Licenses", as defined by - the Mozilla Public License, v. 2.0. - diff --git a/vendor/github.com/hashicorp/go-immutable-radix/v2/README.md b/vendor/github.com/hashicorp/go-immutable-radix/v2/README.md deleted file mode 100644 index e17ccf4d1..000000000 --- a/vendor/github.com/hashicorp/go-immutable-radix/v2/README.md +++ /dev/null @@ -1,73 +0,0 @@ -go-immutable-radix [![Run CI Tests](https://github.com/hashicorp/go-immutable-radix/actions/workflows/ci.yaml/badge.svg)](https://github.com/hashicorp/go-immutable-radix/actions/workflows/ci.yaml) -========= - -Provides the `iradix` package that implements an immutable [radix tree](http://en.wikipedia.org/wiki/Radix_tree). -The package only provides a single `Tree` implementation, optimized for sparse nodes. - -As a radix tree, it provides the following: - * O(k) operations. In many cases, this can be faster than a hash table since - the hash function is an O(k) operation, and hash tables have very poor cache locality. - * Minimum / Maximum value lookups - * Ordered iteration - -A tree supports using a transaction to batch multiple updates (insert, delete) -in a more efficient manner than performing each operation one at a time. - -For a mutable variant, see [go-radix](https://github.com/armon/go-radix). - -V2 -== - -The v2 of go-immutable-radix introduces generics to improve compile-time type -safety for users of the package. The module name for v2 is -`github.com/hashicorp/go-immutable-radix/v2`. - -Documentation -============= - -The full documentation is available on [Godoc](http://godoc.org/github.com/hashicorp/go-immutable-radix). - -Example -======= - -Below is a simple example of usage - -```go -// Create a tree -r := iradix.New[int]() -r, _, _ = r.Insert([]byte("foo"), 1) -r, _, _ = r.Insert([]byte("bar"), 2) -r, _, _ = r.Insert([]byte("foobar"), 2) - -// Find the longest prefix match -m, _, _ := r.Root().LongestPrefix([]byte("foozip")) -if string(m) != "foo" { - panic("should be foo") -} -``` - -Here is an example of performing a range scan of the keys. - -```go -// Create a tree -r := iradix.New[int]() -r, _, _ = r.Insert([]byte("001"), 1) -r, _, _ = r.Insert([]byte("002"), 2) -r, _, _ = r.Insert([]byte("005"), 5) -r, _, _ = r.Insert([]byte("010"), 10) -r, _, _ = r.Insert([]byte("100"), 10) - -// Range scan over the keys that sort lexicographically between [003, 050) -it := r.Root().Iterator() -it.SeekLowerBound([]byte("003")) -for key, _, ok := it.Next(); ok; key, _, ok = it.Next() { - if string(key) >= "050" { - break - } - fmt.Println(string(key)) -} -// Output: -// 005 -// 010 -``` - diff --git a/vendor/github.com/hashicorp/go-immutable-radix/v2/edges.go b/vendor/github.com/hashicorp/go-immutable-radix/v2/edges.go deleted file mode 100644 index 2e452f3e6..000000000 --- a/vendor/github.com/hashicorp/go-immutable-radix/v2/edges.go +++ /dev/null @@ -1,21 +0,0 @@ -package iradix - -import "sort" - -type edges[T any] []edge[T] - -func (e edges[T]) Len() int { - return len(e) -} - -func (e edges[T]) Less(i, j int) bool { - return e[i].label < e[j].label -} - -func (e edges[T]) Swap(i, j int) { - e[i], e[j] = e[j], e[i] -} - -func (e edges[T]) Sort() { - sort.Sort(e) -} diff --git a/vendor/github.com/hashicorp/go-immutable-radix/v2/iradix.go b/vendor/github.com/hashicorp/go-immutable-radix/v2/iradix.go deleted file mode 100644 index 8774020bc..000000000 --- a/vendor/github.com/hashicorp/go-immutable-radix/v2/iradix.go +++ /dev/null @@ -1,679 +0,0 @@ -package iradix - -import ( - "bytes" - "strings" - - "github.com/hashicorp/golang-lru/v2/simplelru" -) - -const ( - // defaultModifiedCache is the default size of the modified node - // cache used per transaction. This is used to cache the updates - // to the nodes near the root, while the leaves do not need to be - // cached. This is important for very large transactions to prevent - // the modified cache from growing to be enormous. This is also used - // to set the max size of the mutation notify maps since those should - // also be bounded in a similar way. - defaultModifiedCache = 8192 -) - -// Tree implements an immutable radix tree. This can be treated as a -// Dictionary abstract data type. The main advantage over a standard -// hash map is prefix-based lookups and ordered iteration. The immutability -// means that it is safe to concurrently read from a Tree without any -// coordination. -type Tree[T any] struct { - root *Node[T] - size int -} - -// New returns an empty Tree -func New[T any]() *Tree[T] { - t := &Tree[T]{ - root: &Node[T]{ - mutateCh: make(chan struct{}), - }, - } - return t -} - -// Len is used to return the number of elements in the tree -func (t *Tree[T]) Len() int { - return t.size -} - -// Txn is a transaction on the tree. This transaction is applied -// atomically and returns a new tree when committed. A transaction -// is not thread safe, and should only be used by a single goroutine. -type Txn[T any] struct { - // root is the modified root for the transaction. - root *Node[T] - - // snap is a snapshot of the root node for use if we have to run the - // slow notify algorithm. - snap *Node[T] - - // size tracks the size of the tree as it is modified during the - // transaction. - size int - - // writable is a cache of writable nodes that have been created during - // the course of the transaction. This allows us to re-use the same - // nodes for further writes and avoid unnecessary copies of nodes that - // have never been exposed outside the transaction. This will only hold - // up to defaultModifiedCache number of entries. - writable *simplelru.LRU[*Node[T], any] - - // trackChannels is used to hold channels that need to be notified to - // signal mutation of the tree. This will only hold up to - // defaultModifiedCache number of entries, after which we will set the - // trackOverflow flag, which will cause us to use a more expensive - // algorithm to perform the notifications. Mutation tracking is only - // performed if trackMutate is true. - trackChannels map[chan struct{}]struct{} - trackOverflow bool - trackMutate bool -} - -// Txn starts a new transaction that can be used to mutate the tree -func (t *Tree[T]) Txn() *Txn[T] { - txn := &Txn[T]{ - root: t.root, - snap: t.root, - size: t.size, - } - return txn -} - -// Clone makes an independent copy of the transaction. The new transaction -// does not track any nodes and has TrackMutate turned off. The cloned transaction will contain any uncommitted writes in the original transaction but further mutations to either will be independent and result in different radix trees on Commit. A cloned transaction may be passed to another goroutine and mutated there independently however each transaction may only be mutated in a single thread. -func (t *Txn[T]) Clone() *Txn[T] { - // reset the writable node cache to avoid leaking future writes into the clone - t.writable = nil - - txn := &Txn[T]{ - root: t.root, - snap: t.snap, - size: t.size, - } - return txn -} - -// TrackMutate can be used to toggle if mutations are tracked. If this is enabled -// then notifications will be issued for affected internal nodes and leaves when -// the transaction is committed. -func (t *Txn[T]) TrackMutate(track bool) { - t.trackMutate = track -} - -// trackChannel safely attempts to track the given mutation channel, setting the -// overflow flag if we can no longer track any more. This limits the amount of -// state that will accumulate during a transaction and we have a slower algorithm -// to switch to if we overflow. -func (t *Txn[T]) trackChannel(ch chan struct{}) { - // In overflow, make sure we don't store any more objects. - if t.trackOverflow { - return - } - - // If this would overflow the state we reject it and set the flag (since - // we aren't tracking everything that's required any longer). - if len(t.trackChannels) >= defaultModifiedCache { - // Mark that we are in the overflow state - t.trackOverflow = true - - // Clear the map so that the channels can be garbage collected. It is - // safe to do this since we have already overflowed and will be using - // the slow notify algorithm. - t.trackChannels = nil - return - } - - // Create the map on the fly when we need it. - if t.trackChannels == nil { - t.trackChannels = make(map[chan struct{}]struct{}) - } - - // Otherwise we are good to track it. - t.trackChannels[ch] = struct{}{} -} - -// writeNode returns a node to be modified, if the current node has already been -// modified during the course of the transaction, it is used in-place. Set -// forLeafUpdate to true if you are getting a write node to update the leaf, -// which will set leaf mutation tracking appropriately as well. -func (t *Txn[T]) writeNode(n *Node[T], forLeafUpdate bool) *Node[T] { - // Ensure the writable set exists. - if t.writable == nil { - lru, err := simplelru.NewLRU[*Node[T], any](defaultModifiedCache, nil) - if err != nil { - panic(err) - } - t.writable = lru - } - - // If this node has already been modified, we can continue to use it - // during this transaction. We know that we don't need to track it for - // a node update since the node is writable, but if this is for a leaf - // update we track it, in case the initial write to this node didn't - // update the leaf. - if _, ok := t.writable.Get(n); ok { - if t.trackMutate && forLeafUpdate && n.leaf != nil { - t.trackChannel(n.leaf.mutateCh) - } - return n - } - - // Mark this node as being mutated. - if t.trackMutate { - t.trackChannel(n.mutateCh) - } - - // Mark its leaf as being mutated, if appropriate. - if t.trackMutate && forLeafUpdate && n.leaf != nil { - t.trackChannel(n.leaf.mutateCh) - } - - // Copy the existing node. If you have set forLeafUpdate it will be - // safe to replace this leaf with another after you get your node for - // writing. You MUST replace it, because the channel associated with - // this leaf will be closed when this transaction is committed. - nc := &Node[T]{ - mutateCh: make(chan struct{}), - leaf: n.leaf, - } - if n.prefix != nil { - nc.prefix = make([]byte, len(n.prefix)) - copy(nc.prefix, n.prefix) - } - if len(n.edges) != 0 { - nc.edges = make([]edge[T], len(n.edges)) - copy(nc.edges, n.edges) - } - - // Mark this node as writable. - t.writable.Add(nc, nil) - return nc -} - -// Visit all the nodes in the tree under n, and add their mutateChannels to the transaction -// Returns the size of the subtree visited -func (t *Txn[T]) trackChannelsAndCount(n *Node[T]) int { - // Count only leaf nodes - leaves := 0 - if n.leaf != nil { - leaves = 1 - } - // Mark this node as being mutated. - if t.trackMutate { - t.trackChannel(n.mutateCh) - } - - // Mark its leaf as being mutated, if appropriate. - if t.trackMutate && n.leaf != nil { - t.trackChannel(n.leaf.mutateCh) - } - - // Recurse on the children - for _, e := range n.edges { - leaves += t.trackChannelsAndCount(e.node) - } - return leaves -} - -// mergeChild is called to collapse the given node with its child. This is only -// called when the given node is not a leaf and has a single edge. -func (t *Txn[T]) mergeChild(n *Node[T]) { - // Mark the child node as being mutated since we are about to abandon - // it. We don't need to mark the leaf since we are retaining it if it - // is there. - e := n.edges[0] - child := e.node - if t.trackMutate { - t.trackChannel(child.mutateCh) - } - - // Merge the nodes. - n.prefix = concat(n.prefix, child.prefix) - n.leaf = child.leaf - if len(child.edges) != 0 { - n.edges = make([]edge[T], len(child.edges)) - copy(n.edges, child.edges) - } else { - n.edges = nil - } -} - -// insert does a recursive insertion -func (t *Txn[T]) insert(n *Node[T], k, search []byte, v T) (*Node[T], T, bool) { - var zero T - - // Handle key exhaustion - if len(search) == 0 { - var oldVal T - didUpdate := false - if n.isLeaf() { - oldVal = n.leaf.val - didUpdate = true - } - - nc := t.writeNode(n, true) - nc.leaf = &leafNode[T]{ - mutateCh: make(chan struct{}), - key: k, - val: v, - } - return nc, oldVal, didUpdate - } - - // Look for the edge - idx, child := n.getEdge(search[0]) - - // No edge, create one - if child == nil { - e := edge[T]{ - label: search[0], - node: &Node[T]{ - mutateCh: make(chan struct{}), - leaf: &leafNode[T]{ - mutateCh: make(chan struct{}), - key: k, - val: v, - }, - prefix: search, - }, - } - nc := t.writeNode(n, false) - nc.addEdge(e) - return nc, zero, false - } - - // Determine longest prefix of the search key on match - commonPrefix := longestPrefix(search, child.prefix) - if commonPrefix == len(child.prefix) { - search = search[commonPrefix:] - newChild, oldVal, didUpdate := t.insert(child, k, search, v) - if newChild != nil { - nc := t.writeNode(n, false) - nc.edges[idx].node = newChild - return nc, oldVal, didUpdate - } - return nil, oldVal, didUpdate - } - - // Split the node - nc := t.writeNode(n, false) - splitNode := &Node[T]{ - mutateCh: make(chan struct{}), - prefix: search[:commonPrefix], - } - nc.replaceEdge(edge[T]{ - label: search[0], - node: splitNode, - }) - - // Restore the existing child node - modChild := t.writeNode(child, false) - splitNode.addEdge(edge[T]{ - label: modChild.prefix[commonPrefix], - node: modChild, - }) - modChild.prefix = modChild.prefix[commonPrefix:] - - // Create a new leaf node - leaf := &leafNode[T]{ - mutateCh: make(chan struct{}), - key: k, - val: v, - } - - // If the new key is a subset, add to to this node - search = search[commonPrefix:] - if len(search) == 0 { - splitNode.leaf = leaf - return nc, zero, false - } - - // Create a new edge for the node - splitNode.addEdge(edge[T]{ - label: search[0], - node: &Node[T]{ - mutateCh: make(chan struct{}), - leaf: leaf, - prefix: search, - }, - }) - return nc, zero, false -} - -// delete does a recursive deletion -func (t *Txn[T]) delete(n *Node[T], search []byte) (*Node[T], *leafNode[T]) { - // Check for key exhaustion - if len(search) == 0 { - if !n.isLeaf() { - return nil, nil - } - // Copy the pointer in case we are in a transaction that already - // modified this node since the node will be reused. Any changes - // made to the node will not affect returning the original leaf - // value. - oldLeaf := n.leaf - - // Remove the leaf node - nc := t.writeNode(n, true) - nc.leaf = nil - - // Check if this node should be merged - if n != t.root && len(nc.edges) == 1 { - t.mergeChild(nc) - } - return nc, oldLeaf - } - - // Look for an edge - label := search[0] - idx, child := n.getEdge(label) - if child == nil || !bytes.HasPrefix(search, child.prefix) { - return nil, nil - } - - // Consume the search prefix - search = search[len(child.prefix):] - newChild, leaf := t.delete(child, search) - if newChild == nil { - return nil, nil - } - - // Copy this node. WATCH OUT - it's safe to pass "false" here because we - // will only ADD a leaf via nc.mergeChild() if there isn't one due to - // the !nc.isLeaf() check in the logic just below. This is pretty subtle, - // so be careful if you change any of the logic here. - nc := t.writeNode(n, false) - - // Delete the edge if the node has no edges - if newChild.leaf == nil && len(newChild.edges) == 0 { - nc.delEdge(label) - if n != t.root && len(nc.edges) == 1 && !nc.isLeaf() { - t.mergeChild(nc) - } - } else { - nc.edges[idx].node = newChild - } - return nc, leaf -} - -// delete does a recursive deletion -func (t *Txn[T]) deletePrefix(n *Node[T], search []byte) (*Node[T], int) { - // Check for key exhaustion - if len(search) == 0 { - nc := t.writeNode(n, true) - if n.isLeaf() { - nc.leaf = nil - } - nc.edges = nil - return nc, t.trackChannelsAndCount(n) - } - - // Look for an edge - label := search[0] - idx, child := n.getEdge(label) - // We make sure that either the child node's prefix starts with the search term, or the search term starts with the child node's prefix - // Need to do both so that we can delete prefixes that don't correspond to any node in the tree - if child == nil || (!bytes.HasPrefix(child.prefix, search) && !bytes.HasPrefix(search, child.prefix)) { - return nil, 0 - } - - // Consume the search prefix - if len(child.prefix) > len(search) { - search = []byte("") - } else { - search = search[len(child.prefix):] - } - newChild, numDeletions := t.deletePrefix(child, search) - if newChild == nil { - return nil, 0 - } - // Copy this node. WATCH OUT - it's safe to pass "false" here because we - // will only ADD a leaf via nc.mergeChild() if there isn't one due to - // the !nc.isLeaf() check in the logic just below. This is pretty subtle, - // so be careful if you change any of the logic here. - - nc := t.writeNode(n, false) - - // Delete the edge if the node has no edges - if newChild.leaf == nil && len(newChild.edges) == 0 { - nc.delEdge(label) - if n != t.root && len(nc.edges) == 1 && !nc.isLeaf() { - t.mergeChild(nc) - } - } else { - nc.edges[idx].node = newChild - } - return nc, numDeletions -} - -// Insert is used to add or update a given key. The return provides -// the previous value and a bool indicating if any was set. -func (t *Txn[T]) Insert(k []byte, v T) (T, bool) { - newRoot, oldVal, didUpdate := t.insert(t.root, k, k, v) - if newRoot != nil { - t.root = newRoot - } - if !didUpdate { - t.size++ - } - return oldVal, didUpdate -} - -// Delete is used to delete a given key. Returns the old value if any, -// and a bool indicating if the key was set. -func (t *Txn[T]) Delete(k []byte) (T, bool) { - var zero T - newRoot, leaf := t.delete(t.root, k) - if newRoot != nil { - t.root = newRoot - } - if leaf != nil { - t.size-- - return leaf.val, true - } - return zero, false -} - -// DeletePrefix is used to delete an entire subtree that matches the prefix -// This will delete all nodes under that prefix -func (t *Txn[T]) DeletePrefix(prefix []byte) bool { - newRoot, numDeletions := t.deletePrefix(t.root, prefix) - if newRoot != nil { - t.root = newRoot - t.size = t.size - numDeletions - return true - } - return false - -} - -// Root returns the current root of the radix tree within this -// transaction. The root is not safe across insert and delete operations, -// but can be used to read the current state during a transaction. -func (t *Txn[T]) Root() *Node[T] { - return t.root -} - -// Get is used to lookup a specific key, returning -// the value and if it was found -func (t *Txn[T]) Get(k []byte) (T, bool) { - return t.root.Get(k) -} - -// GetWatch is used to lookup a specific key, returning -// the watch channel, value and if it was found -func (t *Txn[T]) GetWatch(k []byte) (<-chan struct{}, T, bool) { - return t.root.GetWatch(k) -} - -// Commit is used to finalize the transaction and return a new tree. If mutation -// tracking is turned on then notifications will also be issued. -func (t *Txn[T]) Commit() *Tree[T] { - nt := t.CommitOnly() - if t.trackMutate { - t.Notify() - } - return nt -} - -// CommitOnly is used to finalize the transaction and return a new tree, but -// does not issue any notifications until Notify is called. -func (t *Txn[T]) CommitOnly() *Tree[T] { - nt := &Tree[T]{t.root, t.size} - t.writable = nil - return nt -} - -// slowNotify does a complete comparison of the before and after trees in order -// to trigger notifications. This doesn't require any additional state but it -// is very expensive to compute. -func (t *Txn[T]) slowNotify() { - snapIter := t.snap.rawIterator() - rootIter := t.root.rawIterator() - for snapIter.Front() != nil || rootIter.Front() != nil { - // If we've exhausted the nodes in the old snapshot, we know - // there's nothing remaining to notify. - if snapIter.Front() == nil { - return - } - snapElem := snapIter.Front() - - // If we've exhausted the nodes in the new root, we know we need - // to invalidate everything that remains in the old snapshot. We - // know from the loop condition there's something in the old - // snapshot. - if rootIter.Front() == nil { - close(snapElem.mutateCh) - if snapElem.isLeaf() { - close(snapElem.leaf.mutateCh) - } - snapIter.Next() - continue - } - - // Do one string compare so we can check the various conditions - // below without repeating the compare. - cmp := strings.Compare(snapIter.Path(), rootIter.Path()) - - // If the snapshot is behind the root, then we must have deleted - // this node during the transaction. - if cmp < 0 { - close(snapElem.mutateCh) - if snapElem.isLeaf() { - close(snapElem.leaf.mutateCh) - } - snapIter.Next() - continue - } - - // If the snapshot is ahead of the root, then we must have added - // this node during the transaction. - if cmp > 0 { - rootIter.Next() - continue - } - - // If we have the same path, then we need to see if we mutated a - // node and possibly the leaf. - rootElem := rootIter.Front() - if snapElem != rootElem { - close(snapElem.mutateCh) - if snapElem.leaf != nil && (snapElem.leaf != rootElem.leaf) { - close(snapElem.leaf.mutateCh) - } - } - snapIter.Next() - rootIter.Next() - } -} - -// Notify is used along with TrackMutate to trigger notifications. This must -// only be done once a transaction is committed via CommitOnly, and it is called -// automatically by Commit. -func (t *Txn[T]) Notify() { - if !t.trackMutate { - return - } - - // If we've overflowed the tracking state we can't use it in any way and - // need to do a full tree compare. - if t.trackOverflow { - t.slowNotify() - } else { - for ch := range t.trackChannels { - close(ch) - } - } - - // Clean up the tracking state so that a re-notify is safe (will trigger - // the else clause above which will be a no-op). - t.trackChannels = nil - t.trackOverflow = false -} - -// Insert is used to add or update a given key. The return provides -// the new tree, previous value and a bool indicating if any was set. -func (t *Tree[T]) Insert(k []byte, v T) (*Tree[T], T, bool) { - txn := t.Txn() - old, ok := txn.Insert(k, v) - return txn.Commit(), old, ok -} - -// Delete is used to delete a given key. Returns the new tree, -// old value if any, and a bool indicating if the key was set. -func (t *Tree[T]) Delete(k []byte) (*Tree[T], T, bool) { - txn := t.Txn() - old, ok := txn.Delete(k) - return txn.Commit(), old, ok -} - -// DeletePrefix is used to delete all nodes starting with a given prefix. Returns the new tree, -// and a bool indicating if the prefix matched any nodes -func (t *Tree[T]) DeletePrefix(k []byte) (*Tree[T], bool) { - txn := t.Txn() - ok := txn.DeletePrefix(k) - return txn.Commit(), ok -} - -// Root returns the root node of the tree which can be used for richer -// query operations. -func (t *Tree[T]) Root() *Node[T] { - return t.root -} - -// Get is used to lookup a specific key, returning -// the value and if it was found -func (t *Tree[T]) Get(k []byte) (T, bool) { - return t.root.Get(k) -} - -// longestPrefix finds the length of the shared prefix -// of two strings -func longestPrefix(k1, k2 []byte) int { - max := len(k1) - if l := len(k2); l < max { - max = l - } - var i int - for i = 0; i < max; i++ { - if k1[i] != k2[i] { - break - } - } - return i -} - -// concat two byte slices, returning a third new copy -func concat(a, b []byte) []byte { - c := make([]byte, len(a)+len(b)) - copy(c, a) - copy(c[len(a):], b) - return c -} diff --git a/vendor/github.com/hashicorp/go-immutable-radix/v2/iter.go b/vendor/github.com/hashicorp/go-immutable-radix/v2/iter.go deleted file mode 100644 index ffd2721c1..000000000 --- a/vendor/github.com/hashicorp/go-immutable-radix/v2/iter.go +++ /dev/null @@ -1,205 +0,0 @@ -package iradix - -import ( - "bytes" -) - -// Iterator is used to iterate over a set of nodes -// in pre-order -type Iterator[T any] struct { - node *Node[T] - stack []edges[T] -} - -// SeekPrefixWatch is used to seek the iterator to a given prefix -// and returns the watch channel of the finest granularity -func (i *Iterator[T]) SeekPrefixWatch(prefix []byte) (watch <-chan struct{}) { - // Wipe the stack - i.stack = nil - n := i.node - watch = n.mutateCh - search := prefix - for { - // Check for key exhaustion - if len(search) == 0 { - i.node = n - return - } - - // Look for an edge - _, n = n.getEdge(search[0]) - if n == nil { - i.node = nil - return - } - - // Update to the finest granularity as the search makes progress - watch = n.mutateCh - - // Consume the search prefix - if bytes.HasPrefix(search, n.prefix) { - search = search[len(n.prefix):] - - } else if bytes.HasPrefix(n.prefix, search) { - i.node = n - return - } else { - i.node = nil - return - } - } -} - -// SeekPrefix is used to seek the iterator to a given prefix -func (i *Iterator[T]) SeekPrefix(prefix []byte) { - i.SeekPrefixWatch(prefix) -} - -func (i *Iterator[T]) recurseMin(n *Node[T]) *Node[T] { - // Traverse to the minimum child - if n.leaf != nil { - return n - } - nEdges := len(n.edges) - if nEdges > 1 { - // Add all the other edges to the stack (the min node will be added as - // we recurse) - i.stack = append(i.stack, n.edges[1:]) - } - if nEdges > 0 { - return i.recurseMin(n.edges[0].node) - } - // Shouldn't be possible - return nil -} - -// SeekLowerBound is used to seek the iterator to the smallest key that is -// greater or equal to the given key. There is no watch variant as it's hard to -// predict based on the radix structure which node(s) changes might affect the -// result. -func (i *Iterator[T]) SeekLowerBound(key []byte) { - // Wipe the stack. Unlike Prefix iteration, we need to build the stack as we - // go because we need only a subset of edges of many nodes in the path to the - // leaf with the lower bound. Note that the iterator will still recurse into - // children that we don't traverse on the way to the reverse lower bound as it - // walks the stack. - i.stack = []edges[T]{} - // i.node starts off in the common case as pointing to the root node of the - // tree. By the time we return we have either found a lower bound and setup - // the stack to traverse all larger keys, or we have not and the stack and - // node should both be nil to prevent the iterator from assuming it is just - // iterating the whole tree from the root node. Either way this needs to end - // up as nil so just set it here. - n := i.node - i.node = nil - search := key - - found := func(n *Node[T]) { - i.stack = append( - i.stack, - edges[T]{edge[T]{node: n}}, - ) - } - - findMin := func(n *Node[T]) { - n = i.recurseMin(n) - if n != nil { - found(n) - return - } - } - - for { - // Compare current prefix with the search key's same-length prefix. - var prefixCmp int - if len(n.prefix) < len(search) { - prefixCmp = bytes.Compare(n.prefix, search[0:len(n.prefix)]) - } else { - prefixCmp = bytes.Compare(n.prefix, search) - } - - if prefixCmp > 0 { - // Prefix is larger, that means the lower bound is greater than the search - // and from now on we need to follow the minimum path to the smallest - // leaf under this subtree. - findMin(n) - return - } - - if prefixCmp < 0 { - // Prefix is smaller than search prefix, that means there is no lower - // bound - i.node = nil - return - } - - // Prefix is equal, we are still heading for an exact match. If this is a - // leaf and an exact match we're done. - if n.leaf != nil && bytes.Equal(n.leaf.key, key) { - found(n) - return - } - - // Consume the search prefix if the current node has one. Note that this is - // safe because if n.prefix is longer than the search slice prefixCmp would - // have been > 0 above and the method would have already returned. - search = search[len(n.prefix):] - - if len(search) == 0 { - // We've exhausted the search key, but the current node is not an exact - // match or not a leaf. That means that the leaf value if it exists, and - // all child nodes must be strictly greater, the smallest key in this - // subtree must be the lower bound. - findMin(n) - return - } - - // Otherwise, take the lower bound next edge. - idx, lbNode := n.getLowerBoundEdge(search[0]) - if lbNode == nil { - return - } - - // Create stack edges for the all strictly higher edges in this node. - if idx+1 < len(n.edges) { - i.stack = append(i.stack, n.edges[idx+1:]) - } - - // Recurse - n = lbNode - } -} - -// Next returns the next node in order -func (i *Iterator[T]) Next() ([]byte, T, bool) { - var zero T - // Initialize our stack if needed - if i.stack == nil && i.node != nil { - i.stack = []edges[T]{{edge[T]{node: i.node}}} - } - - for len(i.stack) > 0 { - // Inspect the last element of the stack - n := len(i.stack) - last := i.stack[n-1] - elem := last[0].node - - // Update the stack - if len(last) > 1 { - i.stack[n-1] = last[1:] - } else { - i.stack = i.stack[:n-1] - } - - // Push the edges onto the frontier - if len(elem.edges) > 0 { - i.stack = append(i.stack, elem.edges) - } - - // Return the leaf values if any - if elem.leaf != nil { - return elem.leaf.key, elem.leaf.val, true - } - } - return nil, zero, false -} diff --git a/vendor/github.com/hashicorp/go-immutable-radix/v2/node.go b/vendor/github.com/hashicorp/go-immutable-radix/v2/node.go deleted file mode 100644 index 1be963922..000000000 --- a/vendor/github.com/hashicorp/go-immutable-radix/v2/node.go +++ /dev/null @@ -1,326 +0,0 @@ -package iradix - -import ( - "bytes" - "sort" -) - -// WalkFn is used when walking the tree. Takes a -// key and value, returning if iteration should -// be terminated. -type WalkFn[T any] func(k []byte, v T) bool - -// leafNode is used to represent a value -type leafNode[T any] struct { - mutateCh chan struct{} - key []byte - val T -} - -// edge is used to represent an edge node -type edge[T any] struct { - label byte - node *Node[T] -} - -// Node is an immutable node in the radix tree -type Node[T any] struct { - // mutateCh is closed if this node is modified - mutateCh chan struct{} - - // leaf is used to store possible leaf - leaf *leafNode[T] - - // prefix is the common prefix we ignore - prefix []byte - - // Edges should be stored in-order for iteration. - // We avoid a fully materialized slice to save memory, - // since in most cases we expect to be sparse - edges edges[T] -} - -func (n *Node[T]) isLeaf() bool { - return n.leaf != nil -} - -func (n *Node[T]) addEdge(e edge[T]) { - num := len(n.edges) - idx := sort.Search(num, func(i int) bool { - return n.edges[i].label >= e.label - }) - n.edges = append(n.edges, e) - if idx != num { - copy(n.edges[idx+1:], n.edges[idx:num]) - n.edges[idx] = e - } -} - -func (n *Node[T]) replaceEdge(e edge[T]) { - num := len(n.edges) - idx := sort.Search(num, func(i int) bool { - return n.edges[i].label >= e.label - }) - if idx < num && n.edges[idx].label == e.label { - n.edges[idx].node = e.node - return - } - panic("replacing missing edge") -} - -func (n *Node[T]) getEdge(label byte) (int, *Node[T]) { - num := len(n.edges) - idx := sort.Search(num, func(i int) bool { - return n.edges[i].label >= label - }) - if idx < num && n.edges[idx].label == label { - return idx, n.edges[idx].node - } - return -1, nil -} - -func (n *Node[T]) getLowerBoundEdge(label byte) (int, *Node[T]) { - num := len(n.edges) - idx := sort.Search(num, func(i int) bool { - return n.edges[i].label >= label - }) - // we want lower bound behavior so return even if it's not an exact match - if idx < num { - return idx, n.edges[idx].node - } - return -1, nil -} - -func (n *Node[T]) delEdge(label byte) { - num := len(n.edges) - idx := sort.Search(num, func(i int) bool { - return n.edges[i].label >= label - }) - if idx < num && n.edges[idx].label == label { - copy(n.edges[idx:], n.edges[idx+1:]) - n.edges[len(n.edges)-1] = edge[T]{} - n.edges = n.edges[:len(n.edges)-1] - } -} - -func (n *Node[T]) GetWatch(k []byte) (<-chan struct{}, T, bool) { - search := k - watch := n.mutateCh - for { - // Check for key exhaustion - if len(search) == 0 { - if n.isLeaf() { - return n.leaf.mutateCh, n.leaf.val, true - } - break - } - - // Look for an edge - _, n = n.getEdge(search[0]) - if n == nil { - break - } - - // Update to the finest granularity as the search makes progress - watch = n.mutateCh - - // Consume the search prefix - if bytes.HasPrefix(search, n.prefix) { - search = search[len(n.prefix):] - } else { - break - } - } - var zero T - return watch, zero, false -} - -func (n *Node[T]) Get(k []byte) (T, bool) { - _, val, ok := n.GetWatch(k) - return val, ok -} - -// LongestPrefix is like Get, but instead of an -// exact match, it will return the longest prefix match. -func (n *Node[T]) LongestPrefix(k []byte) ([]byte, T, bool) { - var last *leafNode[T] - search := k - for { - // Look for a leaf node - if n.isLeaf() { - last = n.leaf - } - - // Check for key exhaustion - if len(search) == 0 { - break - } - - // Look for an edge - _, n = n.getEdge(search[0]) - if n == nil { - break - } - - // Consume the search prefix - if bytes.HasPrefix(search, n.prefix) { - search = search[len(n.prefix):] - } else { - break - } - } - if last != nil { - return last.key, last.val, true - } - var zero T - return nil, zero, false -} - -// Minimum is used to return the minimum value in the tree -func (n *Node[T]) Minimum() ([]byte, T, bool) { - for { - if n.isLeaf() { - return n.leaf.key, n.leaf.val, true - } - if len(n.edges) > 0 { - n = n.edges[0].node - } else { - break - } - } - var zero T - return nil, zero, false -} - -// Maximum is used to return the maximum value in the tree -func (n *Node[T]) Maximum() ([]byte, T, bool) { - for { - if num := len(n.edges); num > 0 { - n = n.edges[num-1].node // bug? - continue - } - if n.isLeaf() { - return n.leaf.key, n.leaf.val, true - } else { - break - } - } - var zero T - return nil, zero, false -} - -// Iterator is used to return an iterator at -// the given node to walk the tree -func (n *Node[T]) Iterator() *Iterator[T] { - return &Iterator[T]{node: n} -} - -// ReverseIterator is used to return an iterator at -// the given node to walk the tree backwards -func (n *Node[T]) ReverseIterator() *ReverseIterator[T] { - return NewReverseIterator(n) -} - -// Iterator is used to return an iterator at -// the given node to walk the tree -func (n *Node[T]) PathIterator(path []byte) *PathIterator[T] { - return &PathIterator[T]{node: n, path: path} -} - -// rawIterator is used to return a raw iterator at the given node to walk the -// tree. -func (n *Node[T]) rawIterator() *rawIterator[T] { - iter := &rawIterator[T]{node: n} - iter.Next() - return iter -} - -// Walk is used to walk the tree -func (n *Node[T]) Walk(fn WalkFn[T]) { - recursiveWalk(n, fn) -} - -// WalkBackwards is used to walk the tree in reverse order -func (n *Node[T]) WalkBackwards(fn WalkFn[T]) { - reverseRecursiveWalk(n, fn) -} - -// WalkPrefix is used to walk the tree under a prefix -func (n *Node[T]) WalkPrefix(prefix []byte, fn WalkFn[T]) { - search := prefix - for { - // Check for key exhaustion - if len(search) == 0 { - recursiveWalk(n, fn) - return - } - - // Look for an edge - _, n = n.getEdge(search[0]) - if n == nil { - break - } - - // Consume the search prefix - if bytes.HasPrefix(search, n.prefix) { - search = search[len(n.prefix):] - - } else if bytes.HasPrefix(n.prefix, search) { - // Child may be under our search prefix - recursiveWalk(n, fn) - return - } else { - break - } - } -} - -// WalkPath is used to walk the tree, but only visiting nodes -// from the root down to a given leaf. Where WalkPrefix walks -// all the entries *under* the given prefix, this walks the -// entries *above* the given prefix. -func (n *Node[T]) WalkPath(path []byte, fn WalkFn[T]) { - i := n.PathIterator(path) - - for path, val, ok := i.Next(); ok; path, val, ok = i.Next() { - if fn(path, val) { - return - } - } -} - -// recursiveWalk is used to do a pre-order walk of a node -// recursively. Returns true if the walk should be aborted -func recursiveWalk[T any](n *Node[T], fn WalkFn[T]) bool { - // Visit the leaf values if any - if n.leaf != nil && fn(n.leaf.key, n.leaf.val) { - return true - } - - // Recurse on the children - for _, e := range n.edges { - if recursiveWalk(e.node, fn) { - return true - } - } - return false -} - -// reverseRecursiveWalk is used to do a reverse pre-order -// walk of a node recursively. Returns true if the walk -// should be aborted -func reverseRecursiveWalk[T any](n *Node[T], fn WalkFn[T]) bool { - // Visit the leaf values if any - if n.leaf != nil && fn(n.leaf.key, n.leaf.val) { - return true - } - - // Recurse on the children in reverse order - for i := len(n.edges) - 1; i >= 0; i-- { - e := n.edges[i] - if reverseRecursiveWalk(e.node, fn) { - return true - } - } - return false -} diff --git a/vendor/github.com/hashicorp/go-immutable-radix/v2/path_iter.go b/vendor/github.com/hashicorp/go-immutable-radix/v2/path_iter.go deleted file mode 100644 index 21942afc8..000000000 --- a/vendor/github.com/hashicorp/go-immutable-radix/v2/path_iter.go +++ /dev/null @@ -1,59 +0,0 @@ -package iradix - -import "bytes" - -// PathIterator is used to iterate over a set of nodes from the root -// down to a specified path. This will iterate over the same values that -// the Node.WalkPath method will. -type PathIterator[T any] struct { - node *Node[T] - path []byte - done bool -} - -// Next returns the next node in order -func (i *PathIterator[T]) Next() ([]byte, T, bool) { - // This is mostly just an asynchronous implementation of the WalkPath - // method on the node. - var zero T - var leaf *leafNode[T] - - for leaf == nil && i.node != nil { - // visit the leaf values if any - if i.node.leaf != nil { - leaf = i.node.leaf - } - - i.iterate() - } - - if leaf != nil { - return leaf.key, leaf.val, true - } - - return nil, zero, false -} - -func (i *PathIterator[T]) iterate() { - // Check for key exhaustion - if len(i.path) == 0 { - i.node = nil - return - } - - // Look for an edge - _, i.node = i.node.getEdge(i.path[0]) - if i.node == nil { - return - } - - // Consume the search prefix - if bytes.HasPrefix(i.path, i.node.prefix) { - i.path = i.path[len(i.node.prefix):] - } else { - // there are no more nodes to iterate through so - // nil out the node to prevent returning results - // for subsequent calls to Next() - i.node = nil - } -} diff --git a/vendor/github.com/hashicorp/go-immutable-radix/v2/raw_iter.go b/vendor/github.com/hashicorp/go-immutable-radix/v2/raw_iter.go deleted file mode 100644 index dd84f089d..000000000 --- a/vendor/github.com/hashicorp/go-immutable-radix/v2/raw_iter.go +++ /dev/null @@ -1,78 +0,0 @@ -package iradix - -// rawIterator visits each of the nodes in the tree, even the ones that are not -// leaves. It keeps track of the effective path (what a leaf at a given node -// would be called), which is useful for comparing trees. -type rawIterator[T any] struct { - // node is the starting node in the tree for the iterator. - node *Node[T] - - // stack keeps track of edges in the frontier. - stack []rawStackEntry[T] - - // pos is the current position of the iterator. - pos *Node[T] - - // path is the effective path of the current iterator position, - // regardless of whether the current node is a leaf. - path string -} - -// rawStackEntry is used to keep track of the cumulative common path as well as -// its associated edges in the frontier. -type rawStackEntry[T any] struct { - path string - edges edges[T] -} - -// Front returns the current node that has been iterated to. -func (i *rawIterator[T]) Front() *Node[T] { - return i.pos -} - -// Path returns the effective path of the current node, even if it's not actually -// a leaf. -func (i *rawIterator[T]) Path() string { - return i.path -} - -// Next advances the iterator to the next node. -func (i *rawIterator[T]) Next() { - // Initialize our stack if needed. - if i.stack == nil && i.node != nil { - i.stack = []rawStackEntry[T]{ - { - edges: edges[T]{ - edge[T]{node: i.node}, - }, - }, - } - } - - for len(i.stack) > 0 { - // Inspect the last element of the stack. - n := len(i.stack) - last := i.stack[n-1] - elem := last.edges[0].node - - // Update the stack. - if len(last.edges) > 1 { - i.stack[n-1].edges = last.edges[1:] - } else { - i.stack = i.stack[:n-1] - } - - // Push the edges onto the frontier. - if len(elem.edges) > 0 { - path := last.path + string(elem.prefix) - i.stack = append(i.stack, rawStackEntry[T]{path, elem.edges}) - } - - i.pos = elem - i.path = last.path + string(elem.prefix) - return - } - - i.pos = nil - i.path = "" -} diff --git a/vendor/github.com/hashicorp/go-immutable-radix/v2/reverse_iter.go b/vendor/github.com/hashicorp/go-immutable-radix/v2/reverse_iter.go deleted file mode 100644 index 2a06cde7c..000000000 --- a/vendor/github.com/hashicorp/go-immutable-radix/v2/reverse_iter.go +++ /dev/null @@ -1,240 +0,0 @@ -package iradix - -import ( - "bytes" -) - -// ReverseIterator is used to iterate over a set of nodes -// in reverse in-order -type ReverseIterator[T any] struct { - i *Iterator[T] - - // expandedParents stores the set of parent nodes whose relevant children have - // already been pushed into the stack. This can happen during seek or during - // iteration. - // - // Unlike forward iteration we need to recurse into children before we can - // output the value stored in an internal leaf since all children are greater. - // We use this to track whether we have already ensured all the children are - // in the stack. - expandedParents map[*Node[T]]struct{} -} - -// NewReverseIterator returns a new ReverseIterator at a node -func NewReverseIterator[T any](n *Node[T]) *ReverseIterator[T] { - return &ReverseIterator[T]{ - i: &Iterator[T]{node: n}, - } -} - -// SeekPrefixWatch is used to seek the iterator to a given prefix -// and returns the watch channel of the finest granularity -func (ri *ReverseIterator[T]) SeekPrefixWatch(prefix []byte) (watch <-chan struct{}) { - return ri.i.SeekPrefixWatch(prefix) -} - -// SeekPrefix is used to seek the iterator to a given prefix -func (ri *ReverseIterator[T]) SeekPrefix(prefix []byte) { - ri.i.SeekPrefixWatch(prefix) -} - -// SeekReverseLowerBound is used to seek the iterator to the largest key that is -// lower or equal to the given key. There is no watch variant as it's hard to -// predict based on the radix structure which node(s) changes might affect the -// result. -func (ri *ReverseIterator[T]) SeekReverseLowerBound(key []byte) { - // Wipe the stack. Unlike Prefix iteration, we need to build the stack as we - // go because we need only a subset of edges of many nodes in the path to the - // leaf with the lower bound. Note that the iterator will still recurse into - // children that we don't traverse on the way to the reverse lower bound as it - // walks the stack. - ri.i.stack = []edges[T]{} - // ri.i.node starts off in the common case as pointing to the root node of the - // tree. By the time we return we have either found a lower bound and setup - // the stack to traverse all larger keys, or we have not and the stack and - // node should both be nil to prevent the iterator from assuming it is just - // iterating the whole tree from the root node. Either way this needs to end - // up as nil so just set it here. - n := ri.i.node - ri.i.node = nil - search := key - - if ri.expandedParents == nil { - ri.expandedParents = make(map[*Node[T]]struct{}) - } - - found := func(n *Node[T]) { - ri.i.stack = append(ri.i.stack, edges[T]{edge[T]{node: n}}) - // We need to mark this node as expanded in advance too otherwise the - // iterator will attempt to walk all of its children even though they are - // greater than the lower bound we have found. We've expanded it in the - // sense that all of its children that we want to walk are already in the - // stack (i.e. none of them). - ri.expandedParents[n] = struct{}{} - } - - for { - // Compare current prefix with the search key's same-length prefix. - var prefixCmp int - if len(n.prefix) < len(search) { - prefixCmp = bytes.Compare(n.prefix, search[0:len(n.prefix)]) - } else { - prefixCmp = bytes.Compare(n.prefix, search) - } - - if prefixCmp < 0 { - // Prefix is smaller than search prefix, that means there is no exact - // match for the search key. But we are looking in reverse, so the reverse - // lower bound will be the largest leaf under this subtree, since it is - // the value that would come right before the current search key if it - // were in the tree. So we need to follow the maximum path in this subtree - // to find it. Note that this is exactly what the iterator will already do - // if it finds a node in the stack that has _not_ been marked as expanded - // so in this one case we don't call `found` and instead let the iterator - // do the expansion and recursion through all the children. - ri.i.stack = append(ri.i.stack, edges[T]{edge[T]{node: n}}) - return - } - - if prefixCmp > 0 { - // Prefix is larger than search prefix, or there is no prefix but we've - // also exhausted the search key. Either way, that means there is no - // reverse lower bound since nothing comes before our current search - // prefix. - return - } - - // If this is a leaf, something needs to happen! Note that if it's a leaf - // and prefixCmp was zero (which it must be to get here) then the leaf value - // is either an exact match for the search, or it's lower. It can't be - // greater. - if n.isLeaf() { - - // Firstly, if it's an exact match, we're done! - if bytes.Equal(n.leaf.key, key) { - found(n) - return - } - - // It's not so this node's leaf value must be lower and could still be a - // valid contender for reverse lower bound. - - // If it has no children then we are also done. - if len(n.edges) == 0 { - // This leaf is the lower bound. - found(n) - return - } - - // Finally, this leaf is internal (has children) so we'll keep searching, - // but we need to add it to the iterator's stack since it has a leaf value - // that needs to be iterated over. It needs to be added to the stack - // before its children below as it comes first. - ri.i.stack = append(ri.i.stack, edges[T]{edge[T]{node: n}}) - // We also need to mark it as expanded since we'll be adding any of its - // relevant children below and so don't want the iterator to re-add them - // on its way back up the stack. - ri.expandedParents[n] = struct{}{} - } - - // Consume the search prefix. Note that this is safe because if n.prefix is - // longer than the search slice prefixCmp would have been > 0 above and the - // method would have already returned. - search = search[len(n.prefix):] - - if len(search) == 0 { - // We've exhausted the search key but we are not at a leaf. That means all - // children are greater than the search key so a reverse lower bound - // doesn't exist in this subtree. Note that there might still be one in - // the whole radix tree by following a different path somewhere further - // up. If that's the case then the iterator's stack will contain all the - // smaller nodes already and Previous will walk through them correctly. - return - } - - // Otherwise, take the lower bound next edge. - idx, lbNode := n.getLowerBoundEdge(search[0]) - - // From here, we need to update the stack with all values lower than - // the lower bound edge. Since getLowerBoundEdge() returns -1 when the - // search prefix is larger than all edges, we need to place idx at the - // last edge index so they can all be place in the stack, since they - // come before our search prefix. - if idx == -1 { - idx = len(n.edges) - } - - // Create stack edges for the all strictly lower edges in this node. - if len(n.edges[:idx]) > 0 { - ri.i.stack = append(ri.i.stack, n.edges[:idx]) - } - - // Exit if there's no lower bound edge. The stack will have the previous - // nodes already. - if lbNode == nil { - return - } - - // Recurse - n = lbNode - } -} - -// Previous returns the previous node in reverse order -func (ri *ReverseIterator[T]) Previous() ([]byte, T, bool) { - // Initialize our stack if needed - if ri.i.stack == nil && ri.i.node != nil { - ri.i.stack = []edges[T]{ - { - edge[T]{node: ri.i.node}, - }, - } - } - - if ri.expandedParents == nil { - ri.expandedParents = make(map[*Node[T]]struct{}) - } - - for len(ri.i.stack) > 0 { - // Inspect the last element of the stack - n := len(ri.i.stack) - last := ri.i.stack[n-1] - m := len(last) - elem := last[m-1].node - - _, alreadyExpanded := ri.expandedParents[elem] - - // If this is an internal node and we've not seen it already, we need to - // leave it in the stack so we can return its possible leaf value _after_ - // we've recursed through all its children. - if len(elem.edges) > 0 && !alreadyExpanded { - // record that we've seen this node! - ri.expandedParents[elem] = struct{}{} - // push child edges onto stack and skip the rest of the loop to recurse - // into the largest one. - ri.i.stack = append(ri.i.stack, elem.edges) - continue - } - - // Remove the node from the stack - if m > 1 { - ri.i.stack[n-1] = last[:m-1] - } else { - ri.i.stack = ri.i.stack[:n-1] - } - // We don't need this state any more as it's no longer in the stack so we - // won't visit it again - if alreadyExpanded { - delete(ri.expandedParents, elem) - } - - // If this is a leaf, return it - if elem.leaf != nil { - return elem.leaf.key, elem.leaf.val, true - } - - // it's not a leaf so keep walking the stack to find the previous leaf - } - var zero T - return nil, zero, false -} diff --git a/vendor/github.com/hashicorp/go-multierror/LICENSE b/vendor/github.com/hashicorp/go-multierror/LICENSE deleted file mode 100644 index 82b4de97c..000000000 --- a/vendor/github.com/hashicorp/go-multierror/LICENSE +++ /dev/null @@ -1,353 +0,0 @@ -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. “Contributor” - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. “Contributor Version” - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor’s Contribution. - -1.3. “Contribution” - - means Covered Software of a particular Contributor. - -1.4. “Covered Software” - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. “Incompatible With Secondary Licenses” - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of version - 1.1 or earlier of the License, but not also under the terms of a - Secondary License. - -1.6. “Executable Form” - - means any form of the work other than Source Code Form. - -1.7. “Larger Work” - - means a work that combines Covered Software with other material, in a separate - file or files, that is not Covered Software. - -1.8. “License” - - means this document. - -1.9. “Licensable” - - means having the right to grant, to the maximum extent possible, whether at the - time of the initial grant or subsequently, any and all of the rights conveyed by - this License. - -1.10. “Modifications” - - means any of the following: - - a. any file in Source Code Form that results from an addition to, deletion - from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. “Patent Claims” of a Contributor - - means any patent claim(s), including without limitation, method, process, - and apparatus claims, in any patent Licensable by such Contributor that - would be infringed, but for the grant of the License, by the making, - using, selling, offering for sale, having made, import, or transfer of - either its Contributions or its Contributor Version. - -1.12. “Secondary License” - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. “Source Code Form” - - means the form of the work preferred for making modifications. - -1.14. “You” (or “Your”) - - means an individual or a legal entity exercising rights under this - License. For legal entities, “You” includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, “control” means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or as - part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its Contributions - or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution become - effective for each Contribution on the date the Contributor first distributes - such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under this - License. No additional rights or licenses will be implied from the distribution - or licensing of Covered Software under this License. Notwithstanding Section - 2.1(b) above, no patent license is granted by a Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party’s - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of its - Contributions. - - This License does not grant any rights in the trademarks, service marks, or - logos of any Contributor (except as may be necessary to comply with the - notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this License - (see Section 10.2) or under the terms of a Secondary License (if permitted - under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its Contributions - are its original creation(s) or it has sufficient rights to grant the - rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under applicable - copyright doctrines of fair use, fair dealing, or other equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under the - terms of this License. You must inform recipients that the Source Code Form - of the Covered Software is governed by the terms of this License, and how - they can obtain a copy of this License. You may not attempt to alter or - restrict the recipients’ rights in the Source Code Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this License, - or sublicense it under different terms, provided that the license for - the Executable Form does not attempt to limit or alter the recipients’ - rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for the - Covered Software. If the Larger Work is a combination of Covered Software - with a work governed by one or more Secondary Licenses, and the Covered - Software is not Incompatible With Secondary Licenses, this License permits - You to additionally distribute such Covered Software under the terms of - such Secondary License(s), so that the recipient of the Larger Work may, at - their option, further distribute the Covered Software under the terms of - either this License or such Secondary License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices (including - copyright notices, patent notices, disclaimers of warranty, or limitations - of liability) contained within the Source Code Form of the Covered - Software, except that You may alter any license notices to the extent - required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on behalf - of any Contributor. You must make it absolutely clear that any such - warranty, support, indemnity, or liability obligation is offered by You - alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, judicial - order, or regulation then You must: (a) comply with the terms of this License - to the maximum extent possible; and (b) describe the limitations and the code - they affect. Such description must be placed in a text file included with all - distributions of the Covered Software under this License. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing basis, - if such Contributor fails to notify You of the non-compliance by some - reasonable means prior to 60 days after You have come back into compliance. - Moreover, Your grants from a particular Contributor are reinstated on an - ongoing basis if such Contributor notifies You of the non-compliance by - some reasonable means, this is the first time You have received notice of - non-compliance with this License from such Contributor, and You become - compliant prior to 30 days after Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, counter-claims, - and cross-claims) alleging that a Contributor Version directly or - indirectly infringes any patent, then the rights granted to You by any and - all Contributors for the Covered Software under Section 2.1 of this License - shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an “as is” basis, without - warranty of any kind, either expressed, implied, or statutory, including, - without limitation, warranties that the Covered Software is free of defects, - merchantable, fit for a particular purpose or non-infringing. The entire - risk as to the quality and performance of the Covered Software is with You. - Should any Covered Software prove defective in any respect, You (not any - Contributor) assume the cost of any necessary servicing, repair, or - correction. This disclaimer of warranty constitutes an essential part of this - License. No use of any Covered Software is authorized under this License - except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from such - party’s negligence to the extent applicable law prohibits such limitation. - Some jurisdictions do not allow the exclusion or limitation of incidental or - consequential damages, so this exclusion and limitation may not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts of - a jurisdiction where the defendant maintains its principal place of business - and such litigation shall be governed by laws of that jurisdiction, without - reference to its conflict-of-law provisions. Nothing in this Section shall - prevent a party’s ability to bring cross-claims or counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject matter - hereof. If any provision of this License is held to be unenforceable, such - provision shall be reformed only to the extent necessary to make it - enforceable. Any law or regulation which provides that the language of a - contract shall be construed against the drafter shall not be used to construe - this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version of - the License under which You originally received the Covered Software, or - under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a modified - version of this License if you rename the license and remove any - references to the name of the license steward (except to note that such - modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses - If You choose to distribute Source Code Form that is Incompatible With - Secondary Licenses under the terms of this version of the License, the - notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, then -You may include the notice in a location (such as a LICENSE file in a relevant -directory) where a recipient would be likely to look for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - “Incompatible With Secondary Licenses” Notice - - This Source Code Form is “Incompatible - With Secondary Licenses”, as defined by - the Mozilla Public License, v. 2.0. diff --git a/vendor/github.com/hashicorp/go-multierror/Makefile b/vendor/github.com/hashicorp/go-multierror/Makefile deleted file mode 100644 index b97cd6ed0..000000000 --- a/vendor/github.com/hashicorp/go-multierror/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -TEST?=./... - -default: test - -# test runs the test suite and vets the code. -test: generate - @echo "==> Running tests..." - @go list $(TEST) \ - | grep -v "/vendor/" \ - | xargs -n1 go test -timeout=60s -parallel=10 ${TESTARGS} - -# testrace runs the race checker -testrace: generate - @echo "==> Running tests (race)..." - @go list $(TEST) \ - | grep -v "/vendor/" \ - | xargs -n1 go test -timeout=60s -race ${TESTARGS} - -# updatedeps installs all the dependencies needed to run and build. -updatedeps: - @sh -c "'${CURDIR}/scripts/deps.sh' '${NAME}'" - -# generate runs `go generate` to build the dynamically generated source files. -generate: - @echo "==> Generating..." - @find . -type f -name '.DS_Store' -delete - @go list ./... \ - | grep -v "/vendor/" \ - | xargs -n1 go generate - -.PHONY: default test testrace updatedeps generate diff --git a/vendor/github.com/hashicorp/go-multierror/README.md b/vendor/github.com/hashicorp/go-multierror/README.md deleted file mode 100644 index 71dd308ed..000000000 --- a/vendor/github.com/hashicorp/go-multierror/README.md +++ /dev/null @@ -1,150 +0,0 @@ -# go-multierror - -[![CircleCI](https://img.shields.io/circleci/build/github/hashicorp/go-multierror/master)](https://circleci.com/gh/hashicorp/go-multierror) -[![Go Reference](https://pkg.go.dev/badge/github.com/hashicorp/go-multierror.svg)](https://pkg.go.dev/github.com/hashicorp/go-multierror) -![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/hashicorp/go-multierror) - -[circleci]: https://app.circleci.com/pipelines/github/hashicorp/go-multierror -[godocs]: https://pkg.go.dev/github.com/hashicorp/go-multierror - -`go-multierror` is a package for Go that provides a mechanism for -representing a list of `error` values as a single `error`. - -This allows a function in Go to return an `error` that might actually -be a list of errors. If the caller knows this, they can unwrap the -list and access the errors. If the caller doesn't know, the error -formats to a nice human-readable format. - -`go-multierror` is fully compatible with the Go standard library -[errors](https://golang.org/pkg/errors/) package, including the -functions `As`, `Is`, and `Unwrap`. This provides a standardized approach -for introspecting on error values. - -## Installation and Docs - -Install using `go get github.com/hashicorp/go-multierror`. - -Full documentation is available at -https://pkg.go.dev/github.com/hashicorp/go-multierror - -### Requires go version 1.13 or newer - -`go-multierror` requires go version 1.13 or newer. Go 1.13 introduced -[error wrapping](https://golang.org/doc/go1.13#error_wrapping), which -this library takes advantage of. - -If you need to use an earlier version of go, you can use the -[v1.0.0](https://github.com/hashicorp/go-multierror/tree/v1.0.0) -tag, which doesn't rely on features in go 1.13. - -If you see compile errors that look like the below, it's likely that -you're on an older version of go: - -``` -/go/src/github.com/hashicorp/go-multierror/multierror.go:112:9: undefined: errors.As -/go/src/github.com/hashicorp/go-multierror/multierror.go:117:9: undefined: errors.Is -``` - -## Usage - -go-multierror is easy to use and purposely built to be unobtrusive in -existing Go applications/libraries that may not be aware of it. - -**Building a list of errors** - -The `Append` function is used to create a list of errors. This function -behaves a lot like the Go built-in `append` function: it doesn't matter -if the first argument is nil, a `multierror.Error`, or any other `error`, -the function behaves as you would expect. - -```go -var result error - -if err := step1(); err != nil { - result = multierror.Append(result, err) -} -if err := step2(); err != nil { - result = multierror.Append(result, err) -} - -return result -``` - -**Customizing the formatting of the errors** - -By specifying a custom `ErrorFormat`, you can customize the format -of the `Error() string` function: - -```go -var result *multierror.Error - -// ... accumulate errors here, maybe using Append - -if result != nil { - result.ErrorFormat = func([]error) string { - return "errors!" - } -} -``` - -**Accessing the list of errors** - -`multierror.Error` implements `error` so if the caller doesn't know about -multierror, it will work just fine. But if you're aware a multierror might -be returned, you can use type switches to access the list of errors: - -```go -if err := something(); err != nil { - if merr, ok := err.(*multierror.Error); ok { - // Use merr.Errors - } -} -``` - -You can also use the standard [`errors.Unwrap`](https://golang.org/pkg/errors/#Unwrap) -function. This will continue to unwrap into subsequent errors until none exist. - -**Extracting an error** - -The standard library [`errors.As`](https://golang.org/pkg/errors/#As) -function can be used directly with a multierror to extract a specific error: - -```go -// Assume err is a multierror value -err := somefunc() - -// We want to know if "err" has a "RichErrorType" in it and extract it. -var errRich RichErrorType -if errors.As(err, &errRich) { - // It has it, and now errRich is populated. -} -``` - -**Checking for an exact error value** - -Some errors are returned as exact errors such as the [`ErrNotExist`](https://golang.org/pkg/os/#pkg-variables) -error in the `os` package. You can check if this error is present by using -the standard [`errors.Is`](https://golang.org/pkg/errors/#Is) function. - -```go -// Assume err is a multierror value -err := somefunc() -if errors.Is(err, os.ErrNotExist) { - // err contains os.ErrNotExist -} -``` - -**Returning a multierror only if there are errors** - -If you build a `multierror.Error`, you can use the `ErrorOrNil` function -to return an `error` implementation only if there are errors to return: - -```go -var result *multierror.Error - -// ... accumulate errors here - -// Return the `error` only if errors were added to the multierror, otherwise -// return nil since there are no errors. -return result.ErrorOrNil() -``` diff --git a/vendor/github.com/hashicorp/go-multierror/append.go b/vendor/github.com/hashicorp/go-multierror/append.go deleted file mode 100644 index 3e2589bfd..000000000 --- a/vendor/github.com/hashicorp/go-multierror/append.go +++ /dev/null @@ -1,43 +0,0 @@ -package multierror - -// Append is a helper function that will append more errors -// onto an Error in order to create a larger multi-error. -// -// If err is not a multierror.Error, then it will be turned into -// one. If any of the errs are multierr.Error, they will be flattened -// one level into err. -// Any nil errors within errs will be ignored. If err is nil, a new -// *Error will be returned. -func Append(err error, errs ...error) *Error { - switch err := err.(type) { - case *Error: - // Typed nils can reach here, so initialize if we are nil - if err == nil { - err = new(Error) - } - - // Go through each error and flatten - for _, e := range errs { - switch e := e.(type) { - case *Error: - if e != nil { - err.Errors = append(err.Errors, e.Errors...) - } - default: - if e != nil { - err.Errors = append(err.Errors, e) - } - } - } - - return err - default: - newErrs := make([]error, 0, len(errs)+1) - if err != nil { - newErrs = append(newErrs, err) - } - newErrs = append(newErrs, errs...) - - return Append(&Error{}, newErrs...) - } -} diff --git a/vendor/github.com/hashicorp/go-multierror/flatten.go b/vendor/github.com/hashicorp/go-multierror/flatten.go deleted file mode 100644 index aab8e9abe..000000000 --- a/vendor/github.com/hashicorp/go-multierror/flatten.go +++ /dev/null @@ -1,26 +0,0 @@ -package multierror - -// Flatten flattens the given error, merging any *Errors together into -// a single *Error. -func Flatten(err error) error { - // If it isn't an *Error, just return the error as-is - if _, ok := err.(*Error); !ok { - return err - } - - // Otherwise, make the result and flatten away! - flatErr := new(Error) - flatten(err, flatErr) - return flatErr -} - -func flatten(err error, flatErr *Error) { - switch err := err.(type) { - case *Error: - for _, e := range err.Errors { - flatten(e, flatErr) - } - default: - flatErr.Errors = append(flatErr.Errors, err) - } -} diff --git a/vendor/github.com/hashicorp/go-multierror/format.go b/vendor/github.com/hashicorp/go-multierror/format.go deleted file mode 100644 index 47f13c49a..000000000 --- a/vendor/github.com/hashicorp/go-multierror/format.go +++ /dev/null @@ -1,27 +0,0 @@ -package multierror - -import ( - "fmt" - "strings" -) - -// ErrorFormatFunc is a function callback that is called by Error to -// turn the list of errors into a string. -type ErrorFormatFunc func([]error) string - -// ListFormatFunc is a basic formatter that outputs the number of errors -// that occurred along with a bullet point list of the errors. -func ListFormatFunc(es []error) string { - if len(es) == 1 { - return fmt.Sprintf("1 error occurred:\n\t* %s\n\n", es[0]) - } - - points := make([]string, len(es)) - for i, err := range es { - points[i] = fmt.Sprintf("* %s", err) - } - - return fmt.Sprintf( - "%d errors occurred:\n\t%s\n\n", - len(es), strings.Join(points, "\n\t")) -} diff --git a/vendor/github.com/hashicorp/go-multierror/group.go b/vendor/github.com/hashicorp/go-multierror/group.go deleted file mode 100644 index 9c29efb7f..000000000 --- a/vendor/github.com/hashicorp/go-multierror/group.go +++ /dev/null @@ -1,38 +0,0 @@ -package multierror - -import "sync" - -// Group is a collection of goroutines which return errors that need to be -// coalesced. -type Group struct { - mutex sync.Mutex - err *Error - wg sync.WaitGroup -} - -// Go calls the given function in a new goroutine. -// -// If the function returns an error it is added to the group multierror which -// is returned by Wait. -func (g *Group) Go(f func() error) { - g.wg.Add(1) - - go func() { - defer g.wg.Done() - - if err := f(); err != nil { - g.mutex.Lock() - g.err = Append(g.err, err) - g.mutex.Unlock() - } - }() -} - -// Wait blocks until all function calls from the Go method have returned, then -// returns the multierror. -func (g *Group) Wait() *Error { - g.wg.Wait() - g.mutex.Lock() - defer g.mutex.Unlock() - return g.err -} diff --git a/vendor/github.com/hashicorp/go-multierror/multierror.go b/vendor/github.com/hashicorp/go-multierror/multierror.go deleted file mode 100644 index f54574326..000000000 --- a/vendor/github.com/hashicorp/go-multierror/multierror.go +++ /dev/null @@ -1,121 +0,0 @@ -package multierror - -import ( - "errors" - "fmt" -) - -// Error is an error type to track multiple errors. This is used to -// accumulate errors in cases and return them as a single "error". -type Error struct { - Errors []error - ErrorFormat ErrorFormatFunc -} - -func (e *Error) Error() string { - fn := e.ErrorFormat - if fn == nil { - fn = ListFormatFunc - } - - return fn(e.Errors) -} - -// ErrorOrNil returns an error interface if this Error represents -// a list of errors, or returns nil if the list of errors is empty. This -// function is useful at the end of accumulation to make sure that the value -// returned represents the existence of errors. -func (e *Error) ErrorOrNil() error { - if e == nil { - return nil - } - if len(e.Errors) == 0 { - return nil - } - - return e -} - -func (e *Error) GoString() string { - return fmt.Sprintf("*%#v", *e) -} - -// WrappedErrors returns the list of errors that this Error is wrapping. It is -// an implementation of the errwrap.Wrapper interface so that multierror.Error -// can be used with that library. -// -// This method is not safe to be called concurrently. Unlike accessing the -// Errors field directly, this function also checks if the multierror is nil to -// prevent a null-pointer panic. It satisfies the errwrap.Wrapper interface. -func (e *Error) WrappedErrors() []error { - if e == nil { - return nil - } - return e.Errors -} - -// Unwrap returns an error from Error (or nil if there are no errors). -// This error returned will further support Unwrap to get the next error, -// etc. The order will match the order of Errors in the multierror.Error -// at the time of calling. -// -// The resulting error supports errors.As/Is/Unwrap so you can continue -// to use the stdlib errors package to introspect further. -// -// This will perform a shallow copy of the errors slice. Any errors appended -// to this error after calling Unwrap will not be available until a new -// Unwrap is called on the multierror.Error. -func (e *Error) Unwrap() error { - // If we have no errors then we do nothing - if e == nil || len(e.Errors) == 0 { - return nil - } - - // If we have exactly one error, we can just return that directly. - if len(e.Errors) == 1 { - return e.Errors[0] - } - - // Shallow copy the slice - errs := make([]error, len(e.Errors)) - copy(errs, e.Errors) - return chain(errs) -} - -// chain implements the interfaces necessary for errors.Is/As/Unwrap to -// work in a deterministic way with multierror. A chain tracks a list of -// errors while accounting for the current represented error. This lets -// Is/As be meaningful. -// -// Unwrap returns the next error. In the cleanest form, Unwrap would return -// the wrapped error here but we can't do that if we want to properly -// get access to all the errors. Instead, users are recommended to use -// Is/As to get the correct error type out. -// -// Precondition: []error is non-empty (len > 0) -type chain []error - -// Error implements the error interface -func (e chain) Error() string { - return e[0].Error() -} - -// Unwrap implements errors.Unwrap by returning the next error in the -// chain or nil if there are no more errors. -func (e chain) Unwrap() error { - if len(e) == 1 { - return nil - } - - return e[1:] -} - -// As implements errors.As by attempting to map to the current value. -func (e chain) As(target interface{}) bool { - return errors.As(e[0], target) -} - -// Is implements errors.Is by comparing the current value directly. -func (e chain) Is(target error) bool { - return errors.Is(e[0], target) -} diff --git a/vendor/github.com/hashicorp/go-multierror/prefix.go b/vendor/github.com/hashicorp/go-multierror/prefix.go deleted file mode 100644 index 5c477abe4..000000000 --- a/vendor/github.com/hashicorp/go-multierror/prefix.go +++ /dev/null @@ -1,37 +0,0 @@ -package multierror - -import ( - "fmt" - - "github.com/hashicorp/errwrap" -) - -// Prefix is a helper function that will prefix some text -// to the given error. If the error is a multierror.Error, then -// it will be prefixed to each wrapped error. -// -// This is useful to use when appending multiple multierrors -// together in order to give better scoping. -func Prefix(err error, prefix string) error { - if err == nil { - return nil - } - - format := fmt.Sprintf("%s {{err}}", prefix) - switch err := err.(type) { - case *Error: - // Typed nils can reach here, so initialize if we are nil - if err == nil { - err = new(Error) - } - - // Wrap each of the errors - for i, e := range err.Errors { - err.Errors[i] = errwrap.Wrapf(format, e) - } - - return err - default: - return errwrap.Wrapf(format, err) - } -} diff --git a/vendor/github.com/hashicorp/go-multierror/sort.go b/vendor/github.com/hashicorp/go-multierror/sort.go deleted file mode 100644 index fecb14e81..000000000 --- a/vendor/github.com/hashicorp/go-multierror/sort.go +++ /dev/null @@ -1,16 +0,0 @@ -package multierror - -// Len implements sort.Interface function for length -func (err Error) Len() int { - return len(err.Errors) -} - -// Swap implements sort.Interface function for swapping elements -func (err Error) Swap(i, j int) { - err.Errors[i], err.Errors[j] = err.Errors[j], err.Errors[i] -} - -// Less implements sort.Interface function for determining order -func (err Error) Less(i, j int) bool { - return err.Errors[i].Error() < err.Errors[j].Error() -} diff --git a/vendor/github.com/hashicorp/go-rootcerts/.travis.yml b/vendor/github.com/hashicorp/go-rootcerts/.travis.yml deleted file mode 100644 index 80e1de44e..000000000 --- a/vendor/github.com/hashicorp/go-rootcerts/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -sudo: false - -language: go - -go: - - 1.6 - -branches: - only: - - master - -script: make test diff --git a/vendor/github.com/hashicorp/go-rootcerts/LICENSE b/vendor/github.com/hashicorp/go-rootcerts/LICENSE deleted file mode 100644 index e87a115e4..000000000 --- a/vendor/github.com/hashicorp/go-rootcerts/LICENSE +++ /dev/null @@ -1,363 +0,0 @@ -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. "Contributor" - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. "Contributor Version" - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the terms of - a Secondary License. - -1.6. "Executable Form" - - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - - means a work that combines Covered Software with other material, in a - separate file or files, that is not Covered Software. - -1.8. "License" - - means this document. - -1.9. "Licensable" - - means having the right to grant, to the maximum extent possible, whether - at the time of the initial grant or subsequently, any and all of the - rights conveyed by this License. - -1.10. "Modifications" - - means any of the following: - - a. any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. "Patent Claims" of a Contributor - - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the License, - by the making, using, selling, offering for sale, having made, import, - or transfer of either its Contributions or its Contributor Version. - -1.12. "Secondary License" - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. "Source Code Form" - - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, "control" means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution - become effective for each Contribution on the date the Contributor first - distributes such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under - this License. No additional rights or licenses will be implied from the - distribution or licensing of Covered Software under this License. - Notwithstanding Section 2.1(b) above, no patent license is granted by a - Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of - its Contributions. - - This License does not grant any rights in the trademarks, service marks, - or logos of any Contributor (except as may be necessary to comply with - the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this - License (see Section 10.2) or under the terms of a Secondary License (if - permitted under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its - Contributions are its original creation(s) or it has sufficient rights to - grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under - applicable copyright doctrines of fair use, fair dealing, or other - equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under - the terms of this License. You must inform recipients that the Source - Code Form of the Covered Software is governed by the terms of this - License, and how they can obtain a copy of this License. You may not - attempt to alter or restrict the recipients' rights in the Source Code - Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter the - recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for - the Covered Software. If the Larger Work is a combination of Covered - Software with a work governed by one or more Secondary Licenses, and the - Covered Software is not Incompatible With Secondary Licenses, this - License permits You to additionally distribute such Covered Software - under the terms of such Secondary License(s), so that the recipient of - the Larger Work may, at their option, further distribute the Covered - Software under the terms of either this License or such Secondary - License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices - (including copyright notices, patent notices, disclaimers of warranty, or - limitations of liability) contained within the Source Code Form of the - Covered Software, except that You may alter any license notices to the - extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on - behalf of any Contributor. You must make it absolutely clear that any - such warranty, support, indemnity, or liability obligation is offered by - You alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, - judicial order, or regulation then You must: (a) comply with the terms of - this License to the maximum extent possible; and (b) describe the - limitations and the code they affect. Such description must be placed in a - text file included with all distributions of the Covered Software under - this License. Except to the extent prohibited by statute or regulation, - such description must be sufficiently detailed for a recipient of ordinary - skill to be able to understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing - basis, if such Contributor fails to notify You of the non-compliance by - some reasonable means prior to 60 days after You have come back into - compliance. Moreover, Your grants from a particular Contributor are - reinstated on an ongoing basis if such Contributor notifies You of the - non-compliance by some reasonable means, this is the first time You have - received notice of non-compliance with this License from such - Contributor, and You become compliant prior to 30 days after Your receipt - of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, - counter-claims, and cross-claims) alleging that a Contributor Version - directly or indirectly infringes any patent, then the rights granted to - You by any and all Contributors for the Covered Software under Section - 2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an "as is" basis, - without warranty of any kind, either expressed, implied, or statutory, - including, without limitation, warranties that the Covered Software is free - of defects, merchantable, fit for a particular purpose or non-infringing. - The entire risk as to the quality and performance of the Covered Software - is with You. Should any Covered Software prove defective in any respect, - You (not any Contributor) assume the cost of any necessary servicing, - repair, or correction. This disclaimer of warranty constitutes an essential - part of this License. No use of any Covered Software is authorized under - this License except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from - such party's negligence to the extent applicable law prohibits such - limitation. Some jurisdictions do not allow the exclusion or limitation of - incidental or consequential damages, so this exclusion and limitation may - not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts - of a jurisdiction where the defendant maintains its principal place of - business and such litigation shall be governed by laws of that - jurisdiction, without reference to its conflict-of-law provisions. Nothing - in this Section shall prevent a party's ability to bring cross-claims or - counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. Any law or regulation which provides that - the language of a contract shall be construed against the drafter shall not - be used to construe this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version - of the License under which You originally received the Covered Software, - or under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a - modified version of this License if you rename the license and remove - any references to the name of the license steward (except to note that - such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary - Licenses If You choose to distribute Source Code Form that is - Incompatible With Secondary Licenses under the terms of this version of - the License, the notice described in Exhibit B of this License must be - attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, -then You may include the notice in a location (such as a LICENSE file in a -relevant directory) where a recipient would be likely to look for such a -notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice - - This Source Code Form is "Incompatible - With Secondary Licenses", as defined by - the Mozilla Public License, v. 2.0. - diff --git a/vendor/github.com/hashicorp/go-rootcerts/Makefile b/vendor/github.com/hashicorp/go-rootcerts/Makefile deleted file mode 100644 index c3989e789..000000000 --- a/vendor/github.com/hashicorp/go-rootcerts/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -TEST?=./... - -test: - go test $(TEST) $(TESTARGS) -timeout=3s -parallel=4 - go vet $(TEST) - go test $(TEST) -race - -.PHONY: test diff --git a/vendor/github.com/hashicorp/go-rootcerts/README.md b/vendor/github.com/hashicorp/go-rootcerts/README.md deleted file mode 100644 index 6a128e1e1..000000000 --- a/vendor/github.com/hashicorp/go-rootcerts/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# rootcerts - -Functions for loading root certificates for TLS connections. - ------ - -Go's standard library `crypto/tls` provides a common mechanism for configuring -TLS connections in `tls.Config`. The `RootCAs` field on this struct is a pool -of certificates for the client to use as a trust store when verifying server -certificates. - -This library contains utility functions for loading certificates destined for -that field, as well as one other important thing: - -When the `RootCAs` field is `nil`, the standard library attempts to load the -host's root CA set. This behavior is OS-specific, and the Darwin -implementation contains [a bug that prevents trusted certificates from the -System and Login keychains from being loaded][1]. This library contains -Darwin-specific behavior that works around that bug. - -[1]: https://github.com/golang/go/issues/14514 - -## Example Usage - -Here's a snippet demonstrating how this library is meant to be used: - -```go -func httpClient() (*http.Client, error) - tlsConfig := &tls.Config{} - err := rootcerts.ConfigureTLS(tlsConfig, &rootcerts.Config{ - CAFile: os.Getenv("MYAPP_CAFILE"), - CAPath: os.Getenv("MYAPP_CAPATH"), - Certificate: os.Getenv("MYAPP_CERTIFICATE"), - }) - if err != nil { - return nil, err - } - c := cleanhttp.DefaultClient() - t := cleanhttp.DefaultTransport() - t.TLSClientConfig = tlsConfig - c.Transport = t - return c, nil -} -``` diff --git a/vendor/github.com/hashicorp/go-rootcerts/doc.go b/vendor/github.com/hashicorp/go-rootcerts/doc.go deleted file mode 100644 index b55cc6284..000000000 --- a/vendor/github.com/hashicorp/go-rootcerts/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -// Package rootcerts contains functions to aid in loading CA certificates for -// TLS connections. -// -// In addition, its default behavior on Darwin works around an open issue [1] -// in Go's crypto/x509 that prevents certicates from being loaded from the -// System or Login keychains. -// -// [1] https://github.com/golang/go/issues/14514 -package rootcerts diff --git a/vendor/github.com/hashicorp/go-rootcerts/rootcerts.go b/vendor/github.com/hashicorp/go-rootcerts/rootcerts.go deleted file mode 100644 index 69aabd6bc..000000000 --- a/vendor/github.com/hashicorp/go-rootcerts/rootcerts.go +++ /dev/null @@ -1,123 +0,0 @@ -package rootcerts - -import ( - "crypto/tls" - "crypto/x509" - "errors" - "fmt" - "io/ioutil" - "os" - "path/filepath" -) - -// Config determines where LoadCACerts will load certificates from. When CAFile, -// CACertificate and CAPath are blank, this library's functions will either load -// system roots explicitly and return them, or set the CertPool to nil to allow -// Go's standard library to load system certs. -type Config struct { - // CAFile is a path to a PEM-encoded certificate file or bundle. Takes - // precedence over CACertificate and CAPath. - CAFile string - - // CACertificate is a PEM-encoded certificate or bundle. Takes precedence - // over CAPath. - CACertificate []byte - - // CAPath is a path to a directory populated with PEM-encoded certificates. - CAPath string -} - -// ConfigureTLS sets up the RootCAs on the provided tls.Config based on the -// Config specified. -func ConfigureTLS(t *tls.Config, c *Config) error { - if t == nil { - return nil - } - pool, err := LoadCACerts(c) - if err != nil { - return err - } - t.RootCAs = pool - return nil -} - -// LoadCACerts loads a CertPool based on the Config specified. -func LoadCACerts(c *Config) (*x509.CertPool, error) { - if c == nil { - c = &Config{} - } - if c.CAFile != "" { - return LoadCAFile(c.CAFile) - } - if len(c.CACertificate) != 0 { - return AppendCertificate(c.CACertificate) - } - if c.CAPath != "" { - return LoadCAPath(c.CAPath) - } - - return LoadSystemCAs() -} - -// LoadCAFile loads a single PEM-encoded file from the path specified. -func LoadCAFile(caFile string) (*x509.CertPool, error) { - pool := x509.NewCertPool() - - pem, err := ioutil.ReadFile(caFile) - if err != nil { - return nil, fmt.Errorf("Error loading CA File: %s", err) - } - - ok := pool.AppendCertsFromPEM(pem) - if !ok { - return nil, fmt.Errorf("Error loading CA File: Couldn't parse PEM in: %s", caFile) - } - - return pool, nil -} - -// AppendCertificate appends an in-memory PEM-encoded certificate or bundle and returns a pool. -func AppendCertificate(ca []byte) (*x509.CertPool, error) { - pool := x509.NewCertPool() - - ok := pool.AppendCertsFromPEM(ca) - if !ok { - return nil, errors.New("Error appending CA: Couldn't parse PEM") - } - - return pool, nil -} - -// LoadCAPath walks the provided path and loads all certificates encounted into -// a pool. -func LoadCAPath(caPath string) (*x509.CertPool, error) { - pool := x509.NewCertPool() - walkFn := func(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - - if info.IsDir() { - return nil - } - - pem, err := ioutil.ReadFile(path) - if err != nil { - return fmt.Errorf("Error loading file from CAPath: %s", err) - } - - ok := pool.AppendCertsFromPEM(pem) - if !ok { - return fmt.Errorf("Error loading CA Path: Couldn't parse PEM in: %s", path) - } - - return nil - } - - err := filepath.Walk(caPath, walkFn) - if err != nil { - return nil, err - } - - return pool, nil -} diff --git a/vendor/github.com/hashicorp/go-rootcerts/rootcerts_base.go b/vendor/github.com/hashicorp/go-rootcerts/rootcerts_base.go deleted file mode 100644 index 66b1472c4..000000000 --- a/vendor/github.com/hashicorp/go-rootcerts/rootcerts_base.go +++ /dev/null @@ -1,12 +0,0 @@ -// +build !darwin - -package rootcerts - -import "crypto/x509" - -// LoadSystemCAs does nothing on non-Darwin systems. We return nil so that -// default behavior of standard TLS config libraries is triggered, which is to -// load system certs. -func LoadSystemCAs() (*x509.CertPool, error) { - return nil, nil -} diff --git a/vendor/github.com/hashicorp/go-rootcerts/rootcerts_darwin.go b/vendor/github.com/hashicorp/go-rootcerts/rootcerts_darwin.go deleted file mode 100644 index a9a040657..000000000 --- a/vendor/github.com/hashicorp/go-rootcerts/rootcerts_darwin.go +++ /dev/null @@ -1,48 +0,0 @@ -package rootcerts - -import ( - "crypto/x509" - "os/exec" - "path" - - "github.com/mitchellh/go-homedir" -) - -// LoadSystemCAs has special behavior on Darwin systems to work around -func LoadSystemCAs() (*x509.CertPool, error) { - pool := x509.NewCertPool() - - for _, keychain := range certKeychains() { - err := addCertsFromKeychain(pool, keychain) - if err != nil { - return nil, err - } - } - - return pool, nil -} - -func addCertsFromKeychain(pool *x509.CertPool, keychain string) error { - cmd := exec.Command("/usr/bin/security", "find-certificate", "-a", "-p", keychain) - data, err := cmd.Output() - if err != nil { - return err - } - - pool.AppendCertsFromPEM(data) - - return nil -} - -func certKeychains() []string { - keychains := []string{ - "/System/Library/Keychains/SystemRootCertificates.keychain", - "/Library/Keychains/System.keychain", - } - home, err := homedir.Dir() - if err == nil { - loginKeychain := path.Join(home, "Library", "Keychains", "login.keychain") - keychains = append(keychains, loginKeychain) - } - return keychains -} diff --git a/vendor/github.com/hashicorp/golang-lru/LICENSE b/vendor/github.com/hashicorp/golang-lru/LICENSE deleted file mode 100644 index be2cc4dfb..000000000 --- a/vendor/github.com/hashicorp/golang-lru/LICENSE +++ /dev/null @@ -1,362 +0,0 @@ -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. "Contributor" - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. "Contributor Version" - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the terms of - a Secondary License. - -1.6. "Executable Form" - - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - - means a work that combines Covered Software with other material, in a - separate file or files, that is not Covered Software. - -1.8. "License" - - means this document. - -1.9. "Licensable" - - means having the right to grant, to the maximum extent possible, whether - at the time of the initial grant or subsequently, any and all of the - rights conveyed by this License. - -1.10. "Modifications" - - means any of the following: - - a. any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. "Patent Claims" of a Contributor - - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the License, - by the making, using, selling, offering for sale, having made, import, - or transfer of either its Contributions or its Contributor Version. - -1.12. "Secondary License" - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. "Source Code Form" - - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, "control" means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution - become effective for each Contribution on the date the Contributor first - distributes such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under - this License. No additional rights or licenses will be implied from the - distribution or licensing of Covered Software under this License. - Notwithstanding Section 2.1(b) above, no patent license is granted by a - Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of - its Contributions. - - This License does not grant any rights in the trademarks, service marks, - or logos of any Contributor (except as may be necessary to comply with - the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this - License (see Section 10.2) or under the terms of a Secondary License (if - permitted under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its - Contributions are its original creation(s) or it has sufficient rights to - grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under - applicable copyright doctrines of fair use, fair dealing, or other - equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under - the terms of this License. You must inform recipients that the Source - Code Form of the Covered Software is governed by the terms of this - License, and how they can obtain a copy of this License. You may not - attempt to alter or restrict the recipients' rights in the Source Code - Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter the - recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for - the Covered Software. If the Larger Work is a combination of Covered - Software with a work governed by one or more Secondary Licenses, and the - Covered Software is not Incompatible With Secondary Licenses, this - License permits You to additionally distribute such Covered Software - under the terms of such Secondary License(s), so that the recipient of - the Larger Work may, at their option, further distribute the Covered - Software under the terms of either this License or such Secondary - License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices - (including copyright notices, patent notices, disclaimers of warranty, or - limitations of liability) contained within the Source Code Form of the - Covered Software, except that You may alter any license notices to the - extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on - behalf of any Contributor. You must make it absolutely clear that any - such warranty, support, indemnity, or liability obligation is offered by - You alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, - judicial order, or regulation then You must: (a) comply with the terms of - this License to the maximum extent possible; and (b) describe the - limitations and the code they affect. Such description must be placed in a - text file included with all distributions of the Covered Software under - this License. Except to the extent prohibited by statute or regulation, - such description must be sufficiently detailed for a recipient of ordinary - skill to be able to understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing - basis, if such Contributor fails to notify You of the non-compliance by - some reasonable means prior to 60 days after You have come back into - compliance. Moreover, Your grants from a particular Contributor are - reinstated on an ongoing basis if such Contributor notifies You of the - non-compliance by some reasonable means, this is the first time You have - received notice of non-compliance with this License from such - Contributor, and You become compliant prior to 30 days after Your receipt - of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, - counter-claims, and cross-claims) alleging that a Contributor Version - directly or indirectly infringes any patent, then the rights granted to - You by any and all Contributors for the Covered Software under Section - 2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an "as is" basis, - without warranty of any kind, either expressed, implied, or statutory, - including, without limitation, warranties that the Covered Software is free - of defects, merchantable, fit for a particular purpose or non-infringing. - The entire risk as to the quality and performance of the Covered Software - is with You. Should any Covered Software prove defective in any respect, - You (not any Contributor) assume the cost of any necessary servicing, - repair, or correction. This disclaimer of warranty constitutes an essential - part of this License. No use of any Covered Software is authorized under - this License except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from - such party's negligence to the extent applicable law prohibits such - limitation. Some jurisdictions do not allow the exclusion or limitation of - incidental or consequential damages, so this exclusion and limitation may - not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts - of a jurisdiction where the defendant maintains its principal place of - business and such litigation shall be governed by laws of that - jurisdiction, without reference to its conflict-of-law provisions. Nothing - in this Section shall prevent a party's ability to bring cross-claims or - counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. Any law or regulation which provides that - the language of a contract shall be construed against the drafter shall not - be used to construe this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version - of the License under which You originally received the Covered Software, - or under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a - modified version of this License if you rename the license and remove - any references to the name of the license steward (except to note that - such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary - Licenses If You choose to distribute Source Code Form that is - Incompatible With Secondary Licenses under the terms of this version of - the License, the notice described in Exhibit B of this License must be - attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, -then You may include the notice in a location (such as a LICENSE file in a -relevant directory) where a recipient would be likely to look for such a -notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice - - This Source Code Form is "Incompatible - With Secondary Licenses", as defined by - the Mozilla Public License, v. 2.0. diff --git a/vendor/github.com/hashicorp/golang-lru/simplelru/lru.go b/vendor/github.com/hashicorp/golang-lru/simplelru/lru.go deleted file mode 100644 index a86c8539e..000000000 --- a/vendor/github.com/hashicorp/golang-lru/simplelru/lru.go +++ /dev/null @@ -1,177 +0,0 @@ -package simplelru - -import ( - "container/list" - "errors" -) - -// EvictCallback is used to get a callback when a cache entry is evicted -type EvictCallback func(key interface{}, value interface{}) - -// LRU implements a non-thread safe fixed size LRU cache -type LRU struct { - size int - evictList *list.List - items map[interface{}]*list.Element - onEvict EvictCallback -} - -// entry is used to hold a value in the evictList -type entry struct { - key interface{} - value interface{} -} - -// NewLRU constructs an LRU of the given size -func NewLRU(size int, onEvict EvictCallback) (*LRU, error) { - if size <= 0 { - return nil, errors.New("Must provide a positive size") - } - c := &LRU{ - size: size, - evictList: list.New(), - items: make(map[interface{}]*list.Element), - onEvict: onEvict, - } - return c, nil -} - -// Purge is used to completely clear the cache. -func (c *LRU) Purge() { - for k, v := range c.items { - if c.onEvict != nil { - c.onEvict(k, v.Value.(*entry).value) - } - delete(c.items, k) - } - c.evictList.Init() -} - -// Add adds a value to the cache. Returns true if an eviction occurred. -func (c *LRU) Add(key, value interface{}) (evicted bool) { - // Check for existing item - if ent, ok := c.items[key]; ok { - c.evictList.MoveToFront(ent) - ent.Value.(*entry).value = value - return false - } - - // Add new item - ent := &entry{key, value} - entry := c.evictList.PushFront(ent) - c.items[key] = entry - - evict := c.evictList.Len() > c.size - // Verify size not exceeded - if evict { - c.removeOldest() - } - return evict -} - -// Get looks up a key's value from the cache. -func (c *LRU) Get(key interface{}) (value interface{}, ok bool) { - if ent, ok := c.items[key]; ok { - c.evictList.MoveToFront(ent) - if ent.Value.(*entry) == nil { - return nil, false - } - return ent.Value.(*entry).value, true - } - return -} - -// Contains checks if a key is in the cache, without updating the recent-ness -// or deleting it for being stale. -func (c *LRU) Contains(key interface{}) (ok bool) { - _, ok = c.items[key] - return ok -} - -// Peek returns the key value (or undefined if not found) without updating -// the "recently used"-ness of the key. -func (c *LRU) Peek(key interface{}) (value interface{}, ok bool) { - var ent *list.Element - if ent, ok = c.items[key]; ok { - return ent.Value.(*entry).value, true - } - return nil, ok -} - -// Remove removes the provided key from the cache, returning if the -// key was contained. -func (c *LRU) Remove(key interface{}) (present bool) { - if ent, ok := c.items[key]; ok { - c.removeElement(ent) - return true - } - return false -} - -// RemoveOldest removes the oldest item from the cache. -func (c *LRU) RemoveOldest() (key interface{}, value interface{}, ok bool) { - ent := c.evictList.Back() - if ent != nil { - c.removeElement(ent) - kv := ent.Value.(*entry) - return kv.key, kv.value, true - } - return nil, nil, false -} - -// GetOldest returns the oldest entry -func (c *LRU) GetOldest() (key interface{}, value interface{}, ok bool) { - ent := c.evictList.Back() - if ent != nil { - kv := ent.Value.(*entry) - return kv.key, kv.value, true - } - return nil, nil, false -} - -// Keys returns a slice of the keys in the cache, from oldest to newest. -func (c *LRU) Keys() []interface{} { - keys := make([]interface{}, len(c.items)) - i := 0 - for ent := c.evictList.Back(); ent != nil; ent = ent.Prev() { - keys[i] = ent.Value.(*entry).key - i++ - } - return keys -} - -// Len returns the number of items in the cache. -func (c *LRU) Len() int { - return c.evictList.Len() -} - -// Resize changes the cache size. -func (c *LRU) Resize(size int) (evicted int) { - diff := c.Len() - size - if diff < 0 { - diff = 0 - } - for i := 0; i < diff; i++ { - c.removeOldest() - } - c.size = size - return diff -} - -// removeOldest removes the oldest item from the cache. -func (c *LRU) removeOldest() { - ent := c.evictList.Back() - if ent != nil { - c.removeElement(ent) - } -} - -// removeElement is used to remove a given list element from the cache -func (c *LRU) removeElement(e *list.Element) { - c.evictList.Remove(e) - kv := e.Value.(*entry) - delete(c.items, kv.key) - if c.onEvict != nil { - c.onEvict(kv.key, kv.value) - } -} diff --git a/vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go b/vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go deleted file mode 100644 index 92d70934d..000000000 --- a/vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go +++ /dev/null @@ -1,39 +0,0 @@ -package simplelru - -// LRUCache is the interface for simple LRU cache. -type LRUCache interface { - // Adds a value to the cache, returns true if an eviction occurred and - // updates the "recently used"-ness of the key. - Add(key, value interface{}) bool - - // Returns key's value from the cache and - // updates the "recently used"-ness of the key. #value, isFound - Get(key interface{}) (value interface{}, ok bool) - - // Checks if a key exists in cache without updating the recent-ness. - Contains(key interface{}) (ok bool) - - // Returns key's value without updating the "recently used"-ness of the key. - Peek(key interface{}) (value interface{}, ok bool) - - // Removes a key from the cache. - Remove(key interface{}) bool - - // Removes the oldest entry from cache. - RemoveOldest() (interface{}, interface{}, bool) - - // Returns the oldest entry from the cache. #key, value, isFound - GetOldest() (interface{}, interface{}, bool) - - // Returns a slice of the keys in the cache, from oldest to newest. - Keys() []interface{} - - // Returns the number of items in the cache. - Len() int - - // Clears all cache entries. - Purge() - - // Resizes cache, returning number evicted - Resize(int) int -} diff --git a/vendor/github.com/hashicorp/golang-lru/v2/LICENSE b/vendor/github.com/hashicorp/golang-lru/v2/LICENSE deleted file mode 100644 index 0e5d580e0..000000000 --- a/vendor/github.com/hashicorp/golang-lru/v2/LICENSE +++ /dev/null @@ -1,364 +0,0 @@ -Copyright (c) 2014 HashiCorp, Inc. - -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. "Contributor" - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. "Contributor Version" - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the terms of - a Secondary License. - -1.6. "Executable Form" - - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - - means a work that combines Covered Software with other material, in a - separate file or files, that is not Covered Software. - -1.8. "License" - - means this document. - -1.9. "Licensable" - - means having the right to grant, to the maximum extent possible, whether - at the time of the initial grant or subsequently, any and all of the - rights conveyed by this License. - -1.10. "Modifications" - - means any of the following: - - a. any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. "Patent Claims" of a Contributor - - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the License, - by the making, using, selling, offering for sale, having made, import, - or transfer of either its Contributions or its Contributor Version. - -1.12. "Secondary License" - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. "Source Code Form" - - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, "control" means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution - become effective for each Contribution on the date the Contributor first - distributes such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under - this License. No additional rights or licenses will be implied from the - distribution or licensing of Covered Software under this License. - Notwithstanding Section 2.1(b) above, no patent license is granted by a - Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of - its Contributions. - - This License does not grant any rights in the trademarks, service marks, - or logos of any Contributor (except as may be necessary to comply with - the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this - License (see Section 10.2) or under the terms of a Secondary License (if - permitted under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its - Contributions are its original creation(s) or it has sufficient rights to - grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under - applicable copyright doctrines of fair use, fair dealing, or other - equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under - the terms of this License. You must inform recipients that the Source - Code Form of the Covered Software is governed by the terms of this - License, and how they can obtain a copy of this License. You may not - attempt to alter or restrict the recipients' rights in the Source Code - Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter the - recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for - the Covered Software. If the Larger Work is a combination of Covered - Software with a work governed by one or more Secondary Licenses, and the - Covered Software is not Incompatible With Secondary Licenses, this - License permits You to additionally distribute such Covered Software - under the terms of such Secondary License(s), so that the recipient of - the Larger Work may, at their option, further distribute the Covered - Software under the terms of either this License or such Secondary - License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices - (including copyright notices, patent notices, disclaimers of warranty, or - limitations of liability) contained within the Source Code Form of the - Covered Software, except that You may alter any license notices to the - extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on - behalf of any Contributor. You must make it absolutely clear that any - such warranty, support, indemnity, or liability obligation is offered by - You alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, - judicial order, or regulation then You must: (a) comply with the terms of - this License to the maximum extent possible; and (b) describe the - limitations and the code they affect. Such description must be placed in a - text file included with all distributions of the Covered Software under - this License. Except to the extent prohibited by statute or regulation, - such description must be sufficiently detailed for a recipient of ordinary - skill to be able to understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing - basis, if such Contributor fails to notify You of the non-compliance by - some reasonable means prior to 60 days after You have come back into - compliance. Moreover, Your grants from a particular Contributor are - reinstated on an ongoing basis if such Contributor notifies You of the - non-compliance by some reasonable means, this is the first time You have - received notice of non-compliance with this License from such - Contributor, and You become compliant prior to 30 days after Your receipt - of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, - counter-claims, and cross-claims) alleging that a Contributor Version - directly or indirectly infringes any patent, then the rights granted to - You by any and all Contributors for the Covered Software under Section - 2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an "as is" basis, - without warranty of any kind, either expressed, implied, or statutory, - including, without limitation, warranties that the Covered Software is free - of defects, merchantable, fit for a particular purpose or non-infringing. - The entire risk as to the quality and performance of the Covered Software - is with You. Should any Covered Software prove defective in any respect, - You (not any Contributor) assume the cost of any necessary servicing, - repair, or correction. This disclaimer of warranty constitutes an essential - part of this License. No use of any Covered Software is authorized under - this License except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from - such party's negligence to the extent applicable law prohibits such - limitation. Some jurisdictions do not allow the exclusion or limitation of - incidental or consequential damages, so this exclusion and limitation may - not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts - of a jurisdiction where the defendant maintains its principal place of - business and such litigation shall be governed by laws of that - jurisdiction, without reference to its conflict-of-law provisions. Nothing - in this Section shall prevent a party's ability to bring cross-claims or - counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. Any law or regulation which provides that - the language of a contract shall be construed against the drafter shall not - be used to construe this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version - of the License under which You originally received the Covered Software, - or under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a - modified version of this License if you rename the license and remove - any references to the name of the license steward (except to note that - such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary - Licenses If You choose to distribute Source Code Form that is - Incompatible With Secondary Licenses under the terms of this version of - the License, the notice described in Exhibit B of this License must be - attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, -then You may include the notice in a location (such as a LICENSE file in a -relevant directory) where a recipient would be likely to look for such a -notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice - - This Source Code Form is "Incompatible - With Secondary Licenses", as defined by - the Mozilla Public License, v. 2.0. diff --git a/vendor/github.com/hashicorp/golang-lru/v2/internal/list.go b/vendor/github.com/hashicorp/golang-lru/v2/internal/list.go deleted file mode 100644 index 5cd74a034..000000000 --- a/vendor/github.com/hashicorp/golang-lru/v2/internal/list.go +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE_list file. - -package internal - -import "time" - -// Entry is an LRU Entry -type Entry[K comparable, V any] struct { - // Next and previous pointers in the doubly-linked list of elements. - // To simplify the implementation, internally a list l is implemented - // as a ring, such that &l.root is both the next element of the last - // list element (l.Back()) and the previous element of the first list - // element (l.Front()). - next, prev *Entry[K, V] - - // The list to which this element belongs. - list *LruList[K, V] - - // The LRU Key of this element. - Key K - - // The Value stored with this element. - Value V - - // The time this element would be cleaned up, optional - ExpiresAt time.Time - - // The expiry bucket item was put in, optional - ExpireBucket uint8 -} - -// PrevEntry returns the previous list element or nil. -func (e *Entry[K, V]) PrevEntry() *Entry[K, V] { - if p := e.prev; e.list != nil && p != &e.list.root { - return p - } - return nil -} - -// LruList represents a doubly linked list. -// The zero Value for LruList is an empty list ready to use. -type LruList[K comparable, V any] struct { - root Entry[K, V] // sentinel list element, only &root, root.prev, and root.next are used - len int // current list Length excluding (this) sentinel element -} - -// Init initializes or clears list l. -func (l *LruList[K, V]) Init() *LruList[K, V] { - l.root.next = &l.root - l.root.prev = &l.root - l.len = 0 - return l -} - -// NewList returns an initialized list. -func NewList[K comparable, V any]() *LruList[K, V] { return new(LruList[K, V]).Init() } - -// Length returns the number of elements of list l. -// The complexity is O(1). -func (l *LruList[K, V]) Length() int { return l.len } - -// Back returns the last element of list l or nil if the list is empty. -func (l *LruList[K, V]) Back() *Entry[K, V] { - if l.len == 0 { - return nil - } - return l.root.prev -} - -// lazyInit lazily initializes a zero List Value. -func (l *LruList[K, V]) lazyInit() { - if l.root.next == nil { - l.Init() - } -} - -// insert inserts e after at, increments l.len, and returns e. -func (l *LruList[K, V]) insert(e, at *Entry[K, V]) *Entry[K, V] { - e.prev = at - e.next = at.next - e.prev.next = e - e.next.prev = e - e.list = l - l.len++ - return e -} - -// insertValue is a convenience wrapper for insert(&Entry{Value: v, ExpiresAt: ExpiresAt}, at). -func (l *LruList[K, V]) insertValue(k K, v V, expiresAt time.Time, at *Entry[K, V]) *Entry[K, V] { - return l.insert(&Entry[K, V]{Value: v, Key: k, ExpiresAt: expiresAt}, at) -} - -// Remove removes e from its list, decrements l.len -func (l *LruList[K, V]) Remove(e *Entry[K, V]) V { - e.prev.next = e.next - e.next.prev = e.prev - e.next = nil // avoid memory leaks - e.prev = nil // avoid memory leaks - e.list = nil - l.len-- - - return e.Value -} - -// move moves e to next to at. -func (l *LruList[K, V]) move(e, at *Entry[K, V]) { - if e == at { - return - } - e.prev.next = e.next - e.next.prev = e.prev - - e.prev = at - e.next = at.next - e.prev.next = e - e.next.prev = e -} - -// PushFront inserts a new element e with value v at the front of list l and returns e. -func (l *LruList[K, V]) PushFront(k K, v V) *Entry[K, V] { - l.lazyInit() - return l.insertValue(k, v, time.Time{}, &l.root) -} - -// PushFrontExpirable inserts a new expirable element e with Value v at the front of list l and returns e. -func (l *LruList[K, V]) PushFrontExpirable(k K, v V, expiresAt time.Time) *Entry[K, V] { - l.lazyInit() - return l.insertValue(k, v, expiresAt, &l.root) -} - -// MoveToFront moves element e to the front of list l. -// If e is not an element of l, the list is not modified. -// The element must not be nil. -func (l *LruList[K, V]) MoveToFront(e *Entry[K, V]) { - if e.list != l || l.root.next == e { - return - } - // see comment in List.Remove about initialization of l - l.move(e, &l.root) -} diff --git a/vendor/github.com/hashicorp/golang-lru/v2/simplelru/LICENSE_list b/vendor/github.com/hashicorp/golang-lru/v2/simplelru/LICENSE_list deleted file mode 100644 index c4764e6b2..000000000 --- a/vendor/github.com/hashicorp/golang-lru/v2/simplelru/LICENSE_list +++ /dev/null @@ -1,29 +0,0 @@ -This license applies to simplelru/list.go - -Copyright (c) 2009 The Go Authors. 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 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. diff --git a/vendor/github.com/hashicorp/golang-lru/v2/simplelru/lru.go b/vendor/github.com/hashicorp/golang-lru/v2/simplelru/lru.go deleted file mode 100644 index f69792388..000000000 --- a/vendor/github.com/hashicorp/golang-lru/v2/simplelru/lru.go +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package simplelru - -import ( - "errors" - - "github.com/hashicorp/golang-lru/v2/internal" -) - -// EvictCallback is used to get a callback when a cache entry is evicted -type EvictCallback[K comparable, V any] func(key K, value V) - -// LRU implements a non-thread safe fixed size LRU cache -type LRU[K comparable, V any] struct { - size int - evictList *internal.LruList[K, V] - items map[K]*internal.Entry[K, V] - onEvict EvictCallback[K, V] -} - -// NewLRU constructs an LRU of the given size -func NewLRU[K comparable, V any](size int, onEvict EvictCallback[K, V]) (*LRU[K, V], error) { - if size <= 0 { - return nil, errors.New("must provide a positive size") - } - - c := &LRU[K, V]{ - size: size, - evictList: internal.NewList[K, V](), - items: make(map[K]*internal.Entry[K, V]), - onEvict: onEvict, - } - return c, nil -} - -// Purge is used to completely clear the cache. -func (c *LRU[K, V]) Purge() { - for k, v := range c.items { - if c.onEvict != nil { - c.onEvict(k, v.Value) - } - delete(c.items, k) - } - c.evictList.Init() -} - -// Add adds a value to the cache. Returns true if an eviction occurred. -func (c *LRU[K, V]) Add(key K, value V) (evicted bool) { - // Check for existing item - if ent, ok := c.items[key]; ok { - c.evictList.MoveToFront(ent) - ent.Value = value - return false - } - - // Add new item - ent := c.evictList.PushFront(key, value) - c.items[key] = ent - - evict := c.evictList.Length() > c.size - // Verify size not exceeded - if evict { - c.removeOldest() - } - return evict -} - -// Get looks up a key's value from the cache. -func (c *LRU[K, V]) Get(key K) (value V, ok bool) { - if ent, ok := c.items[key]; ok { - c.evictList.MoveToFront(ent) - return ent.Value, true - } - return -} - -// Contains checks if a key is in the cache, without updating the recent-ness -// or deleting it for being stale. -func (c *LRU[K, V]) Contains(key K) (ok bool) { - _, ok = c.items[key] - return ok -} - -// Peek returns the key value (or undefined if not found) without updating -// the "recently used"-ness of the key. -func (c *LRU[K, V]) Peek(key K) (value V, ok bool) { - var ent *internal.Entry[K, V] - if ent, ok = c.items[key]; ok { - return ent.Value, true - } - return -} - -// Remove removes the provided key from the cache, returning if the -// key was contained. -func (c *LRU[K, V]) Remove(key K) (present bool) { - if ent, ok := c.items[key]; ok { - c.removeElement(ent) - return true - } - return false -} - -// RemoveOldest removes the oldest item from the cache. -func (c *LRU[K, V]) RemoveOldest() (key K, value V, ok bool) { - if ent := c.evictList.Back(); ent != nil { - c.removeElement(ent) - return ent.Key, ent.Value, true - } - return -} - -// GetOldest returns the oldest entry -func (c *LRU[K, V]) GetOldest() (key K, value V, ok bool) { - if ent := c.evictList.Back(); ent != nil { - return ent.Key, ent.Value, true - } - return -} - -// Keys returns a slice of the keys in the cache, from oldest to newest. -func (c *LRU[K, V]) Keys() []K { - keys := make([]K, c.evictList.Length()) - i := 0 - for ent := c.evictList.Back(); ent != nil; ent = ent.PrevEntry() { - keys[i] = ent.Key - i++ - } - return keys -} - -// Values returns a slice of the values in the cache, from oldest to newest. -func (c *LRU[K, V]) Values() []V { - values := make([]V, len(c.items)) - i := 0 - for ent := c.evictList.Back(); ent != nil; ent = ent.PrevEntry() { - values[i] = ent.Value - i++ - } - return values -} - -// Len returns the number of items in the cache. -func (c *LRU[K, V]) Len() int { - return c.evictList.Length() -} - -// Resize changes the cache size. -func (c *LRU[K, V]) Resize(size int) (evicted int) { - diff := c.Len() - size - if diff < 0 { - diff = 0 - } - for i := 0; i < diff; i++ { - c.removeOldest() - } - c.size = size - return diff -} - -// removeOldest removes the oldest item from the cache. -func (c *LRU[K, V]) removeOldest() { - if ent := c.evictList.Back(); ent != nil { - c.removeElement(ent) - } -} - -// removeElement is used to remove a given list element from the cache -func (c *LRU[K, V]) removeElement(e *internal.Entry[K, V]) { - c.evictList.Remove(e) - delete(c.items, e.Key) - if c.onEvict != nil { - c.onEvict(e.Key, e.Value) - } -} diff --git a/vendor/github.com/hashicorp/golang-lru/v2/simplelru/lru_interface.go b/vendor/github.com/hashicorp/golang-lru/v2/simplelru/lru_interface.go deleted file mode 100644 index 043b8bcc3..000000000 --- a/vendor/github.com/hashicorp/golang-lru/v2/simplelru/lru_interface.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -// Package simplelru provides simple LRU implementation based on build-in container/list. -package simplelru - -// LRUCache is the interface for simple LRU cache. -type LRUCache[K comparable, V any] interface { - // Adds a value to the cache, returns true if an eviction occurred and - // updates the "recently used"-ness of the key. - Add(key K, value V) bool - - // Returns key's value from the cache and - // updates the "recently used"-ness of the key. #value, isFound - Get(key K) (value V, ok bool) - - // Checks if a key exists in cache without updating the recent-ness. - Contains(key K) (ok bool) - - // Returns key's value without updating the "recently used"-ness of the key. - Peek(key K) (value V, ok bool) - - // Removes a key from the cache. - Remove(key K) bool - - // Removes the oldest entry from cache. - RemoveOldest() (K, V, bool) - - // Returns the oldest entry from the cache. #key, value, isFound - GetOldest() (K, V, bool) - - // Returns a slice of the keys in the cache, from oldest to newest. - Keys() []K - - // Values returns a slice of the values in the cache, from oldest to newest. - Values() []V - - // Returns the number of items in the cache. - Len() int - - // Clears all cache entries. - Purge() - - // Resizes cache, returning number evicted - Resize(int) int -} diff --git a/vendor/github.com/hashicorp/serf/LICENSE b/vendor/github.com/hashicorp/serf/LICENSE deleted file mode 100644 index c33dcc7c9..000000000 --- a/vendor/github.com/hashicorp/serf/LICENSE +++ /dev/null @@ -1,354 +0,0 @@ -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. “Contributor” - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. “Contributor Version” - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor’s Contribution. - -1.3. “Contribution” - - means Covered Software of a particular Contributor. - -1.4. “Covered Software” - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. “Incompatible With Secondary Licenses” - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of version - 1.1 or earlier of the License, but not also under the terms of a - Secondary License. - -1.6. “Executable Form” - - means any form of the work other than Source Code Form. - -1.7. “Larger Work” - - means a work that combines Covered Software with other material, in a separate - file or files, that is not Covered Software. - -1.8. “License” - - means this document. - -1.9. “Licensable” - - means having the right to grant, to the maximum extent possible, whether at the - time of the initial grant or subsequently, any and all of the rights conveyed by - this License. - -1.10. “Modifications” - - means any of the following: - - a. any file in Source Code Form that results from an addition to, deletion - from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. “Patent Claims” of a Contributor - - means any patent claim(s), including without limitation, method, process, - and apparatus claims, in any patent Licensable by such Contributor that - would be infringed, but for the grant of the License, by the making, - using, selling, offering for sale, having made, import, or transfer of - either its Contributions or its Contributor Version. - -1.12. “Secondary License” - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. “Source Code Form” - - means the form of the work preferred for making modifications. - -1.14. “You” (or “Your”) - - means an individual or a legal entity exercising rights under this - License. For legal entities, “You” includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, “control” means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or as - part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its Contributions - or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution become - effective for each Contribution on the date the Contributor first distributes - such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under this - License. No additional rights or licenses will be implied from the distribution - or licensing of Covered Software under this License. Notwithstanding Section - 2.1(b) above, no patent license is granted by a Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party’s - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of its - Contributions. - - This License does not grant any rights in the trademarks, service marks, or - logos of any Contributor (except as may be necessary to comply with the - notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this License - (see Section 10.2) or under the terms of a Secondary License (if permitted - under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its Contributions - are its original creation(s) or it has sufficient rights to grant the - rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under applicable - copyright doctrines of fair use, fair dealing, or other equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under the - terms of this License. You must inform recipients that the Source Code Form - of the Covered Software is governed by the terms of this License, and how - they can obtain a copy of this License. You may not attempt to alter or - restrict the recipients’ rights in the Source Code Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this License, - or sublicense it under different terms, provided that the license for - the Executable Form does not attempt to limit or alter the recipients’ - rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for the - Covered Software. If the Larger Work is a combination of Covered Software - with a work governed by one or more Secondary Licenses, and the Covered - Software is not Incompatible With Secondary Licenses, this License permits - You to additionally distribute such Covered Software under the terms of - such Secondary License(s), so that the recipient of the Larger Work may, at - their option, further distribute the Covered Software under the terms of - either this License or such Secondary License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices (including - copyright notices, patent notices, disclaimers of warranty, or limitations - of liability) contained within the Source Code Form of the Covered - Software, except that You may alter any license notices to the extent - required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on behalf - of any Contributor. You must make it absolutely clear that any such - warranty, support, indemnity, or liability obligation is offered by You - alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, judicial - order, or regulation then You must: (a) comply with the terms of this License - to the maximum extent possible; and (b) describe the limitations and the code - they affect. Such description must be placed in a text file included with all - distributions of the Covered Software under this License. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing basis, - if such Contributor fails to notify You of the non-compliance by some - reasonable means prior to 60 days after You have come back into compliance. - Moreover, Your grants from a particular Contributor are reinstated on an - ongoing basis if such Contributor notifies You of the non-compliance by - some reasonable means, this is the first time You have received notice of - non-compliance with this License from such Contributor, and You become - compliant prior to 30 days after Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, counter-claims, - and cross-claims) alleging that a Contributor Version directly or - indirectly infringes any patent, then the rights granted to You by any and - all Contributors for the Covered Software under Section 2.1 of this License - shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an “as is” basis, without - warranty of any kind, either expressed, implied, or statutory, including, - without limitation, warranties that the Covered Software is free of defects, - merchantable, fit for a particular purpose or non-infringing. The entire - risk as to the quality and performance of the Covered Software is with You. - Should any Covered Software prove defective in any respect, You (not any - Contributor) assume the cost of any necessary servicing, repair, or - correction. This disclaimer of warranty constitutes an essential part of this - License. No use of any Covered Software is authorized under this License - except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from such - party’s negligence to the extent applicable law prohibits such limitation. - Some jurisdictions do not allow the exclusion or limitation of incidental or - consequential damages, so this exclusion and limitation may not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts of - a jurisdiction where the defendant maintains its principal place of business - and such litigation shall be governed by laws of that jurisdiction, without - reference to its conflict-of-law provisions. Nothing in this Section shall - prevent a party’s ability to bring cross-claims or counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject matter - hereof. If any provision of this License is held to be unenforceable, such - provision shall be reformed only to the extent necessary to make it - enforceable. Any law or regulation which provides that the language of a - contract shall be construed against the drafter shall not be used to construe - this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version of - the License under which You originally received the Covered Software, or - under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a modified - version of this License if you rename the license and remove any - references to the name of the license steward (except to note that such - modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses - If You choose to distribute Source Code Form that is Incompatible With - Secondary Licenses under the terms of this version of the License, the - notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, then -You may include the notice in a location (such as a LICENSE file in a relevant -directory) where a recipient would be likely to look for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - “Incompatible With Secondary Licenses” Notice - - This Source Code Form is “Incompatible - With Secondary Licenses”, as defined by - the Mozilla Public License, v. 2.0. - diff --git a/vendor/github.com/hashicorp/serf/coordinate/client.go b/vendor/github.com/hashicorp/serf/coordinate/client.go deleted file mode 100644 index 32124a73a..000000000 --- a/vendor/github.com/hashicorp/serf/coordinate/client.go +++ /dev/null @@ -1,243 +0,0 @@ -package coordinate - -import ( - "fmt" - "math" - "sort" - "sync" - "time" - - "github.com/armon/go-metrics" -) - -// Client manages the estimated network coordinate for a given node, and adjusts -// it as the node observes round trip times and estimated coordinates from other -// nodes. The core algorithm is based on Vivaldi, see the documentation for Config -// for more details. -type Client struct { - // coord is the current estimate of the client's network coordinate. - coord *Coordinate - - // origin is a coordinate sitting at the origin. - origin *Coordinate - - // config contains the tuning parameters that govern the performance of - // the algorithm. - config *Config - - // adjustmentIndex is the current index into the adjustmentSamples slice. - adjustmentIndex uint - - // adjustment is used to store samples for the adjustment calculation. - adjustmentSamples []float64 - - // latencyFilterSamples is used to store the last several RTT samples, - // keyed by node name. We will use the config's LatencyFilterSamples - // value to determine how many samples we keep, per node. - latencyFilterSamples map[string][]float64 - - // stats is used to record events that occur when updating coordinates. - stats ClientStats - - // mutex enables safe concurrent access to the client. - mutex sync.RWMutex -} - -// ClientStats is used to record events that occur when updating coordinates. -type ClientStats struct { - // Resets is incremented any time we reset our local coordinate because - // our calculations have resulted in an invalid state. - Resets int -} - -// NewClient creates a new Client and verifies the configuration is valid. -func NewClient(config *Config) (*Client, error) { - if !(config.Dimensionality > 0) { - return nil, fmt.Errorf("dimensionality must be >0") - } - - return &Client{ - coord: NewCoordinate(config), - origin: NewCoordinate(config), - config: config, - adjustmentIndex: 0, - adjustmentSamples: make([]float64, config.AdjustmentWindowSize), - latencyFilterSamples: make(map[string][]float64), - }, nil -} - -// GetCoordinate returns a copy of the coordinate for this client. -func (c *Client) GetCoordinate() *Coordinate { - c.mutex.RLock() - defer c.mutex.RUnlock() - - return c.coord.Clone() -} - -// SetCoordinate forces the client's coordinate to a known state. -func (c *Client) SetCoordinate(coord *Coordinate) error { - c.mutex.Lock() - defer c.mutex.Unlock() - - if err := c.checkCoordinate(coord); err != nil { - return err - } - - c.coord = coord.Clone() - return nil -} - -// ForgetNode removes any client state for the given node. -func (c *Client) ForgetNode(node string) { - c.mutex.Lock() - defer c.mutex.Unlock() - - delete(c.latencyFilterSamples, node) -} - -// Stats returns a copy of stats for the client. -func (c *Client) Stats() ClientStats { - c.mutex.Lock() - defer c.mutex.Unlock() - - return c.stats -} - -// checkCoordinate returns an error if the coordinate isn't compatible with -// this client, or if the coordinate itself isn't valid. This assumes the mutex -// has been locked already. -func (c *Client) checkCoordinate(coord *Coordinate) error { - if !c.coord.IsCompatibleWith(coord) { - return fmt.Errorf("dimensions aren't compatible") - } - - if !coord.IsValid() { - return fmt.Errorf("coordinate is invalid") - } - - return nil -} - -// latencyFilter applies a simple moving median filter with a new sample for -// a node. This assumes that the mutex has been locked already. -func (c *Client) latencyFilter(node string, rttSeconds float64) float64 { - samples, ok := c.latencyFilterSamples[node] - if !ok { - samples = make([]float64, 0, c.config.LatencyFilterSize) - } - - // Add the new sample and trim the list, if needed. - samples = append(samples, rttSeconds) - if len(samples) > int(c.config.LatencyFilterSize) { - samples = samples[1:] - } - c.latencyFilterSamples[node] = samples - - // Sort a copy of the samples and return the median. - sorted := make([]float64, len(samples)) - copy(sorted, samples) - sort.Float64s(sorted) - return sorted[len(sorted)/2] -} - -// updateVivialdi updates the Vivaldi portion of the client's coordinate. This -// assumes that the mutex has been locked already. -func (c *Client) updateVivaldi(other *Coordinate, rttSeconds float64) { - const zeroThreshold = 1.0e-6 - - dist := c.coord.DistanceTo(other).Seconds() - if rttSeconds < zeroThreshold { - rttSeconds = zeroThreshold - } - wrongness := math.Abs(dist-rttSeconds) / rttSeconds - - totalError := c.coord.Error + other.Error - if totalError < zeroThreshold { - totalError = zeroThreshold - } - weight := c.coord.Error / totalError - - c.coord.Error = c.config.VivaldiCE*weight*wrongness + c.coord.Error*(1.0-c.config.VivaldiCE*weight) - if c.coord.Error > c.config.VivaldiErrorMax { - c.coord.Error = c.config.VivaldiErrorMax - } - - delta := c.config.VivaldiCC * weight - force := delta * (rttSeconds - dist) - c.coord = c.coord.ApplyForce(c.config, force, other) -} - -// updateAdjustment updates the adjustment portion of the client's coordinate, if -// the feature is enabled. This assumes that the mutex has been locked already. -func (c *Client) updateAdjustment(other *Coordinate, rttSeconds float64) { - if c.config.AdjustmentWindowSize == 0 { - return - } - - // Note that the existing adjustment factors don't figure in to this - // calculation so we use the raw distance here. - dist := c.coord.rawDistanceTo(other) - c.adjustmentSamples[c.adjustmentIndex] = rttSeconds - dist - c.adjustmentIndex = (c.adjustmentIndex + 1) % c.config.AdjustmentWindowSize - - sum := 0.0 - for _, sample := range c.adjustmentSamples { - sum += sample - } - c.coord.Adjustment = sum / (2.0 * float64(c.config.AdjustmentWindowSize)) -} - -// updateGravity applies a small amount of gravity to pull coordinates towards -// the center of the coordinate system to combat drift. This assumes that the -// mutex is locked already. -func (c *Client) updateGravity() { - dist := c.origin.DistanceTo(c.coord).Seconds() - force := -1.0 * math.Pow(dist/c.config.GravityRho, 2.0) - c.coord = c.coord.ApplyForce(c.config, force, c.origin) -} - -// Update takes other, a coordinate for another node, and rtt, a round trip -// time observation for a ping to that node, and updates the estimated position of -// the client's coordinate. Returns the updated coordinate. -func (c *Client) Update(node string, other *Coordinate, rtt time.Duration) (*Coordinate, error) { - c.mutex.Lock() - defer c.mutex.Unlock() - - if err := c.checkCoordinate(other); err != nil { - return nil, err - } - - // The code down below can handle zero RTTs, which we have seen in - // https://github.com/hashicorp/consul/issues/3789, presumably in - // environments with coarse-grained monotonic clocks (we are still - // trying to pin this down). In any event, this is ok from a code PoV - // so we don't need to alert operators with spammy messages. We did - // add a counter so this is still observable, though. - const maxRTT = 10 * time.Second - if rtt < 0 || rtt > maxRTT { - return nil, fmt.Errorf("round trip time not in valid range, duration %v is not a positive value less than %v ", rtt, maxRTT) - } - if rtt == 0 { - metrics.IncrCounterWithLabels([]string{"serf", "coordinate", "zero-rtt"}, 1, c.config.MetricLabels) - } - - rttSeconds := c.latencyFilter(node, rtt.Seconds()) - c.updateVivaldi(other, rttSeconds) - c.updateAdjustment(other, rttSeconds) - c.updateGravity() - if !c.coord.IsValid() { - c.stats.Resets++ - c.coord = NewCoordinate(c.config) - } - - return c.coord.Clone(), nil -} - -// DistanceTo returns the estimated RTT from the client's coordinate to other, the -// coordinate for another node. -func (c *Client) DistanceTo(other *Coordinate) time.Duration { - c.mutex.RLock() - defer c.mutex.RUnlock() - - return c.coord.DistanceTo(other) -} diff --git a/vendor/github.com/hashicorp/serf/coordinate/config.go b/vendor/github.com/hashicorp/serf/coordinate/config.go deleted file mode 100644 index 09c0cafe8..000000000 --- a/vendor/github.com/hashicorp/serf/coordinate/config.go +++ /dev/null @@ -1,77 +0,0 @@ -package coordinate - -import ( - "github.com/armon/go-metrics" -) - -// Config is used to set the parameters of the Vivaldi-based coordinate mapping -// algorithm. -// -// The following references are called out at various points in the documentation -// here: -// -// [1] Dabek, Frank, et al. "Vivaldi: A decentralized network coordinate system." -// ACM SIGCOMM Computer Communication Review. Vol. 34. No. 4. ACM, 2004. -// [2] Ledlie, Jonathan, Paul Gardner, and Margo I. Seltzer. "Network Coordinates -// in the Wild." NSDI. Vol. 7. 2007. -// [3] Lee, Sanghwan, et al. "On suitability of Euclidean embedding for -// host-based network coordinate systems." Networking, IEEE/ACM Transactions -// on 18.1 (2010): 27-40. -type Config struct { - // The dimensionality of the coordinate system. As discussed in [2], more - // dimensions improves the accuracy of the estimates up to a point. Per [2] - // we chose 8 dimensions plus a non-Euclidean height. - Dimensionality uint - - // VivaldiErrorMax is the default error value when a node hasn't yet made - // any observations. It also serves as an upper limit on the error value in - // case observations cause the error value to increase without bound. - VivaldiErrorMax float64 - - // VivaldiCE is a tuning factor that controls the maximum impact an - // observation can have on a node's confidence. See [1] for more details. - VivaldiCE float64 - - // VivaldiCC is a tuning factor that controls the maximum impact an - // observation can have on a node's coordinate. See [1] for more details. - VivaldiCC float64 - - // AdjustmentWindowSize is a tuning factor that determines how many samples - // we retain to calculate the adjustment factor as discussed in [3]. Setting - // this to zero disables this feature. - AdjustmentWindowSize uint - - // HeightMin is the minimum value of the height parameter. Since this - // always must be positive, it will introduce a small amount error, so - // the chosen value should be relatively small compared to "normal" - // coordinates. - HeightMin float64 - - // LatencyFilterSamples is the maximum number of samples that are retained - // per node, in order to compute a median. The intent is to ride out blips - // but still keep the delay low, since our time to probe any given node is - // pretty infrequent. See [2] for more details. - LatencyFilterSize uint - - // GravityRho is a tuning factor that sets how much gravity has an effect - // to try to re-center coordinates. See [2] for more details. - GravityRho float64 - - // metricLabels is the slice of labels to put on all emitted metrics - MetricLabels []metrics.Label -} - -// DefaultConfig returns a Config that has some default values suitable for -// basic testing of the algorithm, but not tuned to any particular type of cluster. -func DefaultConfig() *Config { - return &Config{ - Dimensionality: 8, - VivaldiErrorMax: 1.5, - VivaldiCE: 0.25, - VivaldiCC: 0.25, - AdjustmentWindowSize: 20, - HeightMin: 10.0e-6, - LatencyFilterSize: 3, - GravityRho: 150.0, - } -} diff --git a/vendor/github.com/hashicorp/serf/coordinate/coordinate.go b/vendor/github.com/hashicorp/serf/coordinate/coordinate.go deleted file mode 100644 index fbe792c90..000000000 --- a/vendor/github.com/hashicorp/serf/coordinate/coordinate.go +++ /dev/null @@ -1,203 +0,0 @@ -package coordinate - -import ( - "math" - "math/rand" - "time" -) - -// Coordinate is a specialized structure for holding network coordinates for the -// Vivaldi-based coordinate mapping algorithm. All of the fields should be public -// to enable this to be serialized. All values in here are in units of seconds. -type Coordinate struct { - // Vec is the Euclidean portion of the coordinate. This is used along - // with the other fields to provide an overall distance estimate. The - // units here are seconds. - Vec []float64 - - // Err reflects the confidence in the given coordinate and is updated - // dynamically by the Vivaldi Client. This is dimensionless. - Error float64 - - // Adjustment is a distance offset computed based on a calculation over - // observations from all other nodes over a fixed window and is updated - // dynamically by the Vivaldi Client. The units here are seconds. - Adjustment float64 - - // Height is a distance offset that accounts for non-Euclidean effects - // which model the access links from nodes to the core Internet. The access - // links are usually set by bandwidth and congestion, and the core links - // usually follow distance based on geography. - Height float64 -} - -const ( - // secondsToNanoseconds is used to convert float seconds to nanoseconds. - secondsToNanoseconds = 1.0e9 - - // zeroThreshold is used to decide if two coordinates are on top of each - // other. - zeroThreshold = 1.0e-6 -) - -// ErrDimensionalityConflict will be panic-d if you try to perform operations -// with incompatible dimensions. -type DimensionalityConflictError struct{} - -// Adds the error interface. -func (e DimensionalityConflictError) Error() string { - return "coordinate dimensionality does not match" -} - -// NewCoordinate creates a new coordinate at the origin, using the given config -// to supply key initial values. -func NewCoordinate(config *Config) *Coordinate { - return &Coordinate{ - Vec: make([]float64, config.Dimensionality), - Error: config.VivaldiErrorMax, - Adjustment: 0.0, - Height: config.HeightMin, - } -} - -// Clone creates an independent copy of this coordinate. -func (c *Coordinate) Clone() *Coordinate { - vec := make([]float64, len(c.Vec)) - copy(vec, c.Vec) - return &Coordinate{ - Vec: vec, - Error: c.Error, - Adjustment: c.Adjustment, - Height: c.Height, - } -} - -// componentIsValid returns false if a floating point value is a NaN or an -// infinity. -func componentIsValid(f float64) bool { - return !math.IsInf(f, 0) && !math.IsNaN(f) -} - -// IsValid returns false if any component of a coordinate isn't valid, per the -// componentIsValid() helper above. -func (c *Coordinate) IsValid() bool { - for i := range c.Vec { - if !componentIsValid(c.Vec[i]) { - return false - } - } - - return componentIsValid(c.Error) && - componentIsValid(c.Adjustment) && - componentIsValid(c.Height) -} - -// IsCompatibleWith checks to see if the two coordinates are compatible -// dimensionally. If this returns true then you are guaranteed to not get -// any runtime errors operating on them. -func (c *Coordinate) IsCompatibleWith(other *Coordinate) bool { - return len(c.Vec) == len(other.Vec) -} - -// ApplyForce returns the result of applying the force from the direction of the -// other coordinate. -func (c *Coordinate) ApplyForce(config *Config, force float64, other *Coordinate) *Coordinate { - if !c.IsCompatibleWith(other) { - panic(DimensionalityConflictError{}) - } - - ret := c.Clone() - unit, mag := unitVectorAt(c.Vec, other.Vec) - ret.Vec = add(ret.Vec, mul(unit, force)) - if mag > zeroThreshold { - ret.Height = (ret.Height+other.Height)*force/mag + ret.Height - ret.Height = math.Max(ret.Height, config.HeightMin) - } - return ret -} - -// DistanceTo returns the distance between this coordinate and the other -// coordinate, including adjustments. -func (c *Coordinate) DistanceTo(other *Coordinate) time.Duration { - if !c.IsCompatibleWith(other) { - panic(DimensionalityConflictError{}) - } - - dist := c.rawDistanceTo(other) - adjustedDist := dist + c.Adjustment + other.Adjustment - if adjustedDist > 0.0 { - dist = adjustedDist - } - return time.Duration(dist * secondsToNanoseconds) -} - -// rawDistanceTo returns the Vivaldi distance between this coordinate and the -// other coordinate in seconds, not including adjustments. This assumes the -// dimensions have already been checked to be compatible. -func (c *Coordinate) rawDistanceTo(other *Coordinate) float64 { - return magnitude(diff(c.Vec, other.Vec)) + c.Height + other.Height -} - -// add returns the sum of vec1 and vec2. This assumes the dimensions have -// already been checked to be compatible. -func add(vec1 []float64, vec2 []float64) []float64 { - ret := make([]float64, len(vec1)) - for i := range ret { - ret[i] = vec1[i] + vec2[i] - } - return ret -} - -// diff returns the difference between the vec1 and vec2. This assumes the -// dimensions have already been checked to be compatible. -func diff(vec1 []float64, vec2 []float64) []float64 { - ret := make([]float64, len(vec1)) - for i := range ret { - ret[i] = vec1[i] - vec2[i] - } - return ret -} - -// mul returns vec multiplied by a scalar factor. -func mul(vec []float64, factor float64) []float64 { - ret := make([]float64, len(vec)) - for i := range vec { - ret[i] = vec[i] * factor - } - return ret -} - -// magnitude computes the magnitude of the vec. -func magnitude(vec []float64) float64 { - sum := 0.0 - for i := range vec { - sum += vec[i] * vec[i] - } - return math.Sqrt(sum) -} - -// unitVectorAt returns a unit vector pointing at vec1 from vec2. If the two -// positions are the same then a random unit vector is returned. We also return -// the distance between the points for use in the later height calculation. -func unitVectorAt(vec1 []float64, vec2 []float64) ([]float64, float64) { - ret := diff(vec1, vec2) - - // If the coordinates aren't on top of each other we can normalize. - if mag := magnitude(ret); mag > zeroThreshold { - return mul(ret, 1.0/mag), mag - } - - // Otherwise, just return a random unit vector. - for i := range ret { - ret[i] = rand.Float64() - 0.5 - } - if mag := magnitude(ret); mag > zeroThreshold { - return mul(ret, 1.0/mag), 0.0 - } - - // And finally just give up and make a unit vector along the first - // dimension. This should be exceedingly rare. - ret = make([]float64, len(ret)) - ret[0] = 1.0 - return ret, 0.0 -} diff --git a/vendor/github.com/hashicorp/serf/coordinate/phantom.go b/vendor/github.com/hashicorp/serf/coordinate/phantom.go deleted file mode 100644 index 66da4e2e9..000000000 --- a/vendor/github.com/hashicorp/serf/coordinate/phantom.go +++ /dev/null @@ -1,187 +0,0 @@ -package coordinate - -import ( - "fmt" - "math" - "math/rand" - "time" -) - -// GenerateClients returns a slice with nodes number of clients, all with the -// given config. -func GenerateClients(nodes int, config *Config) ([]*Client, error) { - clients := make([]*Client, nodes) - for i := range clients { - client, err := NewClient(config) - if err != nil { - return nil, err - } - - clients[i] = client - } - return clients, nil -} - -// GenerateLine returns a truth matrix as if all the nodes are in a straight linke -// with the given spacing between them. -func GenerateLine(nodes int, spacing time.Duration) [][]time.Duration { - truth := make([][]time.Duration, nodes) - for i := range truth { - truth[i] = make([]time.Duration, nodes) - } - - for i := 0; i < nodes; i++ { - for j := i + 1; j < nodes; j++ { - rtt := time.Duration(j-i) * spacing - truth[i][j], truth[j][i] = rtt, rtt - } - } - return truth -} - -// GenerateGrid returns a truth matrix as if all the nodes are in a two dimensional -// grid with the given spacing between them. -func GenerateGrid(nodes int, spacing time.Duration) [][]time.Duration { - truth := make([][]time.Duration, nodes) - for i := range truth { - truth[i] = make([]time.Duration, nodes) - } - - n := int(math.Sqrt(float64(nodes))) - for i := 0; i < nodes; i++ { - for j := i + 1; j < nodes; j++ { - x1, y1 := float64(i%n), float64(i/n) - x2, y2 := float64(j%n), float64(j/n) - dx, dy := x2-x1, y2-y1 - dist := math.Sqrt(dx*dx + dy*dy) - rtt := time.Duration(dist * float64(spacing)) - truth[i][j], truth[j][i] = rtt, rtt - } - } - return truth -} - -// GenerateSplit returns a truth matrix as if half the nodes are close together in -// one location and half the nodes are close together in another. The lan factor -// is used to separate the nodes locally and the wan factor represents the split -// between the two sides. -func GenerateSplit(nodes int, lan time.Duration, wan time.Duration) [][]time.Duration { - truth := make([][]time.Duration, nodes) - for i := range truth { - truth[i] = make([]time.Duration, nodes) - } - - split := nodes / 2 - for i := 0; i < nodes; i++ { - for j := i + 1; j < nodes; j++ { - rtt := lan - if (i <= split && j > split) || (i > split && j <= split) { - rtt += wan - } - truth[i][j], truth[j][i] = rtt, rtt - } - } - return truth -} - -// GenerateCircle returns a truth matrix for a set of nodes, evenly distributed -// around a circle with the given radius. The first node is at the "center" of the -// circle because it's equidistant from all the other nodes, but we place it at -// double the radius, so it should show up above all the other nodes in height. -func GenerateCircle(nodes int, radius time.Duration) [][]time.Duration { - truth := make([][]time.Duration, nodes) - for i := range truth { - truth[i] = make([]time.Duration, nodes) - } - - for i := 0; i < nodes; i++ { - for j := i + 1; j < nodes; j++ { - var rtt time.Duration - if i == 0 { - rtt = 2 * radius - } else { - t1 := 2.0 * math.Pi * float64(i) / float64(nodes) - x1, y1 := math.Cos(t1), math.Sin(t1) - t2 := 2.0 * math.Pi * float64(j) / float64(nodes) - x2, y2 := math.Cos(t2), math.Sin(t2) - dx, dy := x2-x1, y2-y1 - dist := math.Sqrt(dx*dx + dy*dy) - rtt = time.Duration(dist * float64(radius)) - } - truth[i][j], truth[j][i] = rtt, rtt - } - } - return truth -} - -// GenerateRandom returns a truth matrix for a set of nodes with normally -// distributed delays, with the given mean and deviation. The RNG is re-seeded -// so you always get the same matrix for a given size. -func GenerateRandom(nodes int, mean time.Duration, deviation time.Duration) [][]time.Duration { - rand.Seed(1) - - truth := make([][]time.Duration, nodes) - for i := range truth { - truth[i] = make([]time.Duration, nodes) - } - - for i := 0; i < nodes; i++ { - for j := i + 1; j < nodes; j++ { - rttSeconds := rand.NormFloat64()*deviation.Seconds() + mean.Seconds() - rtt := time.Duration(rttSeconds * secondsToNanoseconds) - truth[i][j], truth[j][i] = rtt, rtt - } - } - return truth -} - -// Simulate runs the given number of cycles using the given list of clients and -// truth matrix. On each cycle, each client will pick a random node and observe -// the truth RTT, updating its coordinate estimate. The RNG is re-seeded for -// each simulation run to get deterministic results (for this algorithm and the -// underlying algorithm which will use random numbers for position vectors when -// starting out with everything at the origin). -func Simulate(clients []*Client, truth [][]time.Duration, cycles int) { - rand.Seed(1) - - nodes := len(clients) - for cycle := 0; cycle < cycles; cycle++ { - for i := range clients { - if j := rand.Intn(nodes); j != i { - c := clients[j].GetCoordinate() - rtt := truth[i][j] - node := fmt.Sprintf("node_%d", j) - clients[i].Update(node, c, rtt) - } - } - } -} - -// Stats is returned from the Evaluate function with a summary of the algorithm -// performance. -type Stats struct { - ErrorMax float64 - ErrorAvg float64 -} - -// Evaluate uses the coordinates of the given clients to calculate estimated -// distances and compares them with the given truth matrix, returning summary -// stats. -func Evaluate(clients []*Client, truth [][]time.Duration) (stats Stats) { - nodes := len(clients) - count := 0 - for i := 0; i < nodes; i++ { - for j := i + 1; j < nodes; j++ { - est := clients[i].DistanceTo(clients[j].GetCoordinate()).Seconds() - actual := truth[i][j].Seconds() - error := math.Abs(est-actual) / actual - stats.ErrorMax = math.Max(stats.ErrorMax, error) - stats.ErrorAvg += error - count += 1 - } - } - - stats.ErrorAvg /= float64(count) - fmt.Printf("Error avg=%9.6f max=%9.6f\n", stats.ErrorAvg, stats.ErrorMax) - return -} diff --git a/vendor/github.com/imdario/mergo/.deepsource.toml b/vendor/github.com/imdario/mergo/.deepsource.toml deleted file mode 100644 index 8a0681af8..000000000 --- a/vendor/github.com/imdario/mergo/.deepsource.toml +++ /dev/null @@ -1,12 +0,0 @@ -version = 1 - -test_patterns = [ - "*_test.go" -] - -[[analyzers]] -name = "go" -enabled = true - - [analyzers.meta] - import_path = "github.com/imdario/mergo" \ No newline at end of file diff --git a/vendor/github.com/imdario/mergo/.gitignore b/vendor/github.com/imdario/mergo/.gitignore deleted file mode 100644 index 529c3412b..000000000 --- a/vendor/github.com/imdario/mergo/.gitignore +++ /dev/null @@ -1,33 +0,0 @@ -#### joe made this: http://goel.io/joe - -#### go #### -# Binaries for programs and plugins -*.exe -*.dll -*.so -*.dylib - -# Test binary, build with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 -.glide/ - -#### vim #### -# Swap -[._]*.s[a-v][a-z] -[._]*.sw[a-p] -[._]s[a-v][a-z] -[._]sw[a-p] - -# Session -Session.vim - -# Temporary -.netrwhist -*~ -# Auto-generated tag files -tags diff --git a/vendor/github.com/imdario/mergo/.travis.yml b/vendor/github.com/imdario/mergo/.travis.yml deleted file mode 100644 index d324c43ba..000000000 --- a/vendor/github.com/imdario/mergo/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: go -arch: - - amd64 - - ppc64le -install: - - go get -t - - go get golang.org/x/tools/cmd/cover - - go get github.com/mattn/goveralls -script: - - go test -race -v ./... -after_script: - - $HOME/gopath/bin/goveralls -service=travis-ci -repotoken $COVERALLS_TOKEN diff --git a/vendor/github.com/imdario/mergo/CODE_OF_CONDUCT.md b/vendor/github.com/imdario/mergo/CODE_OF_CONDUCT.md deleted file mode 100644 index 469b44907..000000000 --- a/vendor/github.com/imdario/mergo/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,46 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at i@dario.im. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] - -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/imdario/mergo/CONTRIBUTING.md b/vendor/github.com/imdario/mergo/CONTRIBUTING.md deleted file mode 100644 index 0a1ff9f94..000000000 --- a/vendor/github.com/imdario/mergo/CONTRIBUTING.md +++ /dev/null @@ -1,112 +0,0 @@ - -# Contributing to mergo - -First off, thanks for taking the time to contribute! ❤️ - -All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉 - -> And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about: -> - Star the project -> - Tweet about it -> - Refer this project in your project's readme -> - Mention the project at local meetups and tell your friends/colleagues - - -## Table of Contents - -- [Code of Conduct](#code-of-conduct) -- [I Have a Question](#i-have-a-question) -- [I Want To Contribute](#i-want-to-contribute) -- [Reporting Bugs](#reporting-bugs) -- [Suggesting Enhancements](#suggesting-enhancements) - -## Code of Conduct - -This project and everyone participating in it is governed by the -[mergo Code of Conduct](https://github.com/imdario/mergoblob/master/CODE_OF_CONDUCT.md). -By participating, you are expected to uphold this code. Please report unacceptable behavior -to <>. - - -## I Have a Question - -> If you want to ask a question, we assume that you have read the available [Documentation](https://pkg.go.dev/github.com/imdario/mergo). - -Before you ask a question, it is best to search for existing [Issues](https://github.com/imdario/mergo/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first. - -If you then still feel the need to ask a question and need clarification, we recommend the following: - -- Open an [Issue](https://github.com/imdario/mergo/issues/new). -- Provide as much context as you can about what you're running into. -- Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant. - -We will then take care of the issue as soon as possible. - -## I Want To Contribute - -> ### Legal Notice -> When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license. - -### Reporting Bugs - - -#### Before Submitting a Bug Report - -A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible. - -- Make sure that you are using the latest version. -- Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [documentation](). If you are looking for support, you might want to check [this section](#i-have-a-question)). -- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](https://github.com/imdario/mergoissues?q=label%3Abug). -- Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue. -- Collect information about the bug: -- Stack trace (Traceback) -- OS, Platform and Version (Windows, Linux, macOS, x86, ARM) -- Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on what seems relevant. -- Possibly your input and the output -- Can you reliably reproduce the issue? And can you also reproduce it with older versions? - - -#### How Do I Submit a Good Bug Report? - -> You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to . - - -We use GitHub issues to track bugs and errors. If you run into an issue with the project: - -- Open an [Issue](https://github.com/imdario/mergo/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.) -- Explain the behavior you would expect and the actual behavior. -- Please provide as much context as possible and describe the *reproduction steps* that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case. -- Provide the information you collected in the previous section. - -Once it's filed: - -- The project team will label the issue accordingly. -- A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs-repro`. Bugs with the `needs-repro` tag will not be addressed until they are reproduced. -- If the team is able to reproduce the issue, it will be marked `needs-fix`, as well as possibly other tags (such as `critical`), and the issue will be left to be implemented by someone. - -### Suggesting Enhancements - -This section guides you through submitting an enhancement suggestion for mergo, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions. - - -#### Before Submitting an Enhancement - -- Make sure that you are using the latest version. -- Read the [documentation]() carefully and find out if the functionality is already covered, maybe by an individual configuration. -- Perform a [search](https://github.com/imdario/mergo/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one. -- Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library. - - -#### How Do I Submit a Good Enhancement Suggestion? - -Enhancement suggestions are tracked as [GitHub issues](https://github.com/imdario/mergo/issues). - -- Use a **clear and descriptive title** for the issue to identify the suggestion. -- Provide a **step-by-step description of the suggested enhancement** in as many details as possible. -- **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you. -- You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux. -- **Explain why this enhancement would be useful** to most mergo users. You may also want to point out the other projects that solved it better and which could serve as inspiration. - - -## Attribution -This guide is based on the **contributing-gen**. [Make your own](https://github.com/bttger/contributing-gen)! diff --git a/vendor/github.com/imdario/mergo/LICENSE b/vendor/github.com/imdario/mergo/LICENSE deleted file mode 100644 index 686680298..000000000 --- a/vendor/github.com/imdario/mergo/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ -Copyright (c) 2013 Dario Castañé. All rights reserved. -Copyright (c) 2012 The Go Authors. 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 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. diff --git a/vendor/github.com/imdario/mergo/README.md b/vendor/github.com/imdario/mergo/README.md deleted file mode 100644 index ffbbb62c7..000000000 --- a/vendor/github.com/imdario/mergo/README.md +++ /dev/null @@ -1,242 +0,0 @@ -# Mergo - -[![GitHub release][5]][6] -[![GoCard][7]][8] -[![Test status][1]][2] -[![OpenSSF Scorecard][21]][22] -[![OpenSSF Best Practices][19]][20] -[![Coverage status][9]][10] -[![Sourcegraph][11]][12] -[![FOSSA status][13]][14] - -[![GoDoc][3]][4] -[![Become my sponsor][15]][16] -[![Tidelift][17]][18] - -[1]: https://github.com/imdario/mergo/workflows/tests/badge.svg?branch=master -[2]: https://github.com/imdario/mergo/actions/workflows/tests.yml -[3]: https://godoc.org/github.com/imdario/mergo?status.svg -[4]: https://godoc.org/github.com/imdario/mergo -[5]: https://img.shields.io/github/release/imdario/mergo.svg -[6]: https://github.com/imdario/mergo/releases -[7]: https://goreportcard.com/badge/imdario/mergo -[8]: https://goreportcard.com/report/github.com/imdario/mergo -[9]: https://coveralls.io/repos/github/imdario/mergo/badge.svg?branch=master -[10]: https://coveralls.io/github/imdario/mergo?branch=master -[11]: https://sourcegraph.com/github.com/imdario/mergo/-/badge.svg -[12]: https://sourcegraph.com/github.com/imdario/mergo?badge -[13]: https://app.fossa.io/api/projects/git%2Bgithub.com%2Fimdario%2Fmergo.svg?type=shield -[14]: https://app.fossa.io/projects/git%2Bgithub.com%2Fimdario%2Fmergo?ref=badge_shield -[15]: https://img.shields.io/github/sponsors/imdario -[16]: https://github.com/sponsors/imdario -[17]: https://tidelift.com/badges/package/go/github.com%2Fimdario%2Fmergo -[18]: https://tidelift.com/subscription/pkg/go-github.com-imdario-mergo -[19]: https://bestpractices.coreinfrastructure.org/projects/7177/badge -[20]: https://bestpractices.coreinfrastructure.org/projects/7177 -[21]: https://api.securityscorecards.dev/projects/github.com/imdario/mergo/badge -[22]: https://api.securityscorecards.dev/projects/github.com/imdario/mergo - -A helper to merge structs and maps in Golang. Useful for configuration default values, avoiding messy if-statements. - -Mergo merges same-type structs and maps by setting default values in zero-value fields. Mergo won't merge unexported (private) fields. It will do recursively any exported one. It also won't merge structs inside maps (because they are not addressable using Go reflection). - -Also a lovely [comune](http://en.wikipedia.org/wiki/Mergo) (municipality) in the Province of Ancona in the Italian region of Marche. - -## Status - -It is ready for production use. [It is used in several projects by Docker, Google, The Linux Foundation, VMWare, Shopify, Microsoft, etc](https://github.com/imdario/mergo#mergo-in-the-wild). - -### Important note - -Please keep in mind that a problematic PR broke [0.3.9](//github.com/imdario/mergo/releases/tag/0.3.9). I reverted it in [0.3.10](//github.com/imdario/mergo/releases/tag/0.3.10), and I consider it stable but not bug-free. Also, this version adds support for go modules. - -Keep in mind that in [0.3.2](//github.com/imdario/mergo/releases/tag/0.3.2), Mergo changed `Merge()`and `Map()` signatures to support [transformers](#transformers). I added an optional/variadic argument so that it won't break the existing code. - -If you were using Mergo before April 6th, 2015, please check your project works as intended after updating your local copy with ```go get -u github.com/imdario/mergo```. I apologize for any issue caused by its previous behavior and any future bug that Mergo could cause in existing projects after the change (release 0.2.0). - -### Donations - -If Mergo is useful to you, consider buying me a coffee, a beer, or making a monthly donation to allow me to keep building great free software. :heart_eyes: - -Buy Me a Coffee at ko-fi.com -Donate using Liberapay -Become my sponsor - -### Mergo in the wild - -- [moby/moby](https://github.com/moby/moby) -- [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes) -- [vmware/dispatch](https://github.com/vmware/dispatch) -- [Shopify/themekit](https://github.com/Shopify/themekit) -- [imdario/zas](https://github.com/imdario/zas) -- [matcornic/hermes](https://github.com/matcornic/hermes) -- [OpenBazaar/openbazaar-go](https://github.com/OpenBazaar/openbazaar-go) -- [kataras/iris](https://github.com/kataras/iris) -- [michaelsauter/crane](https://github.com/michaelsauter/crane) -- [go-task/task](https://github.com/go-task/task) -- [sensu/uchiwa](https://github.com/sensu/uchiwa) -- [ory/hydra](https://github.com/ory/hydra) -- [sisatech/vcli](https://github.com/sisatech/vcli) -- [dairycart/dairycart](https://github.com/dairycart/dairycart) -- [projectcalico/felix](https://github.com/projectcalico/felix) -- [resin-os/balena](https://github.com/resin-os/balena) -- [go-kivik/kivik](https://github.com/go-kivik/kivik) -- [Telefonica/govice](https://github.com/Telefonica/govice) -- [supergiant/supergiant](supergiant/supergiant) -- [SergeyTsalkov/brooce](https://github.com/SergeyTsalkov/brooce) -- [soniah/dnsmadeeasy](https://github.com/soniah/dnsmadeeasy) -- [ohsu-comp-bio/funnel](https://github.com/ohsu-comp-bio/funnel) -- [EagerIO/Stout](https://github.com/EagerIO/Stout) -- [lynndylanhurley/defsynth-api](https://github.com/lynndylanhurley/defsynth-api) -- [russross/canvasassignments](https://github.com/russross/canvasassignments) -- [rdegges/cryptly-api](https://github.com/rdegges/cryptly-api) -- [casualjim/exeggutor](https://github.com/casualjim/exeggutor) -- [divshot/gitling](https://github.com/divshot/gitling) -- [RWJMurphy/gorl](https://github.com/RWJMurphy/gorl) -- [andrerocker/deploy42](https://github.com/andrerocker/deploy42) -- [elwinar/rambler](https://github.com/elwinar/rambler) -- [tmaiaroto/gopartman](https://github.com/tmaiaroto/gopartman) -- [jfbus/impressionist](https://github.com/jfbus/impressionist) -- [Jmeyering/zealot](https://github.com/Jmeyering/zealot) -- [godep-migrator/rigger-host](https://github.com/godep-migrator/rigger-host) -- [Dronevery/MultiwaySwitch-Go](https://github.com/Dronevery/MultiwaySwitch-Go) -- [thoas/picfit](https://github.com/thoas/picfit) -- [mantasmatelis/whooplist-server](https://github.com/mantasmatelis/whooplist-server) -- [jnuthong/item_search](https://github.com/jnuthong/item_search) -- [bukalapak/snowboard](https://github.com/bukalapak/snowboard) -- [containerssh/containerssh](https://github.com/containerssh/containerssh) -- [goreleaser/goreleaser](https://github.com/goreleaser/goreleaser) -- [tjpnz/structbot](https://github.com/tjpnz/structbot) - -## Install - - go get github.com/imdario/mergo - - // use in your .go code - import ( - "github.com/imdario/mergo" - ) - -## Usage - -You can only merge same-type structs with exported fields initialized as zero value of their type and same-types maps. Mergo won't merge unexported (private) fields but will do recursively any exported one. It won't merge empty structs value as [they are zero values](https://golang.org/ref/spec#The_zero_value) too. Also, maps will be merged recursively except for structs inside maps (because they are not addressable using Go reflection). - -```go -if err := mergo.Merge(&dst, src); err != nil { - // ... -} -``` - -Also, you can merge overwriting values using the transformer `WithOverride`. - -```go -if err := mergo.Merge(&dst, src, mergo.WithOverride); err != nil { - // ... -} -``` - -Additionally, you can map a `map[string]interface{}` to a struct (and otherwise, from struct to map), following the same restrictions as in `Merge()`. Keys are capitalized to find each corresponding exported field. - -```go -if err := mergo.Map(&dst, srcMap); err != nil { - // ... -} -``` - -Warning: if you map a struct to map, it won't do it recursively. Don't expect Mergo to map struct members of your struct as `map[string]interface{}`. They will be just assigned as values. - -Here is a nice example: - -```go -package main - -import ( - "fmt" - "github.com/imdario/mergo" -) - -type Foo struct { - A string - B int64 -} - -func main() { - src := Foo{ - A: "one", - B: 2, - } - dest := Foo{ - A: "two", - } - mergo.Merge(&dest, src) - fmt.Println(dest) - // Will print - // {two 2} -} -``` - -Note: if test are failing due missing package, please execute: - - go get gopkg.in/yaml.v3 - -### Transformers - -Transformers allow to merge specific types differently than in the default behavior. In other words, now you can customize how some types are merged. For example, `time.Time` is a struct; it doesn't have zero value but IsZero can return true because it has fields with zero value. How can we merge a non-zero `time.Time`? - -```go -package main - -import ( - "fmt" - "github.com/imdario/mergo" - "reflect" - "time" -) - -type timeTransformer struct { -} - -func (t timeTransformer) Transformer(typ reflect.Type) func(dst, src reflect.Value) error { - if typ == reflect.TypeOf(time.Time{}) { - return func(dst, src reflect.Value) error { - if dst.CanSet() { - isZero := dst.MethodByName("IsZero") - result := isZero.Call([]reflect.Value{}) - if result[0].Bool() { - dst.Set(src) - } - } - return nil - } - } - return nil -} - -type Snapshot struct { - Time time.Time - // ... -} - -func main() { - src := Snapshot{time.Now()} - dest := Snapshot{} - mergo.Merge(&dest, src, mergo.WithTransformers(timeTransformer{})) - fmt.Println(dest) - // Will print - // { 2018-01-12 01:15:00 +0000 UTC m=+0.000000001 } -} -``` - -## Contact me - -If I can help you, you have an idea or you are using Mergo in your projects, don't hesitate to drop me a line (or a pull request): [@im_dario](https://twitter.com/im_dario) - -## About - -Written by [Dario Castañé](http://dario.im). - -## License - -[BSD 3-Clause](http://opensource.org/licenses/BSD-3-Clause) license, as [Go language](http://golang.org/LICENSE). - -[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fimdario%2Fmergo.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fimdario%2Fmergo?ref=badge_large) diff --git a/vendor/github.com/imdario/mergo/SECURITY.md b/vendor/github.com/imdario/mergo/SECURITY.md deleted file mode 100644 index a5de61f77..000000000 --- a/vendor/github.com/imdario/mergo/SECURITY.md +++ /dev/null @@ -1,14 +0,0 @@ -# Security Policy - -## Supported Versions - -| Version | Supported | -| ------- | ------------------ | -| 0.3.x | :white_check_mark: | -| < 0.3 | :x: | - -## Security contact information - -To report a security vulnerability, please use the -[Tidelift security contact](https://tidelift.com/security). -Tidelift will coordinate the fix and disclosure. diff --git a/vendor/github.com/imdario/mergo/doc.go b/vendor/github.com/imdario/mergo/doc.go deleted file mode 100644 index fcd985f99..000000000 --- a/vendor/github.com/imdario/mergo/doc.go +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright 2013 Dario Castañé. All rights reserved. -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -/* -A helper to merge structs and maps in Golang. Useful for configuration default values, avoiding messy if-statements. - -Mergo merges same-type structs and maps by setting default values in zero-value fields. Mergo won't merge unexported (private) fields. It will do recursively any exported one. It also won't merge structs inside maps (because they are not addressable using Go reflection). - -Status - -It is ready for production use. It is used in several projects by Docker, Google, The Linux Foundation, VMWare, Shopify, etc. - -Important note - -Please keep in mind that a problematic PR broke 0.3.9. We reverted it in 0.3.10. We consider 0.3.10 as stable but not bug-free. . Also, this version adds suppot for go modules. - -Keep in mind that in 0.3.2, Mergo changed Merge() and Map() signatures to support transformers. We added an optional/variadic argument so that it won't break the existing code. - -If you were using Mergo before April 6th, 2015, please check your project works as intended after updating your local copy with go get -u github.com/imdario/mergo. I apologize for any issue caused by its previous behavior and any future bug that Mergo could cause in existing projects after the change (release 0.2.0). - -Install - -Do your usual installation procedure: - - go get github.com/imdario/mergo - - // use in your .go code - import ( - "github.com/imdario/mergo" - ) - -Usage - -You can only merge same-type structs with exported fields initialized as zero value of their type and same-types maps. Mergo won't merge unexported (private) fields but will do recursively any exported one. It won't merge empty structs value as they are zero values too. Also, maps will be merged recursively except for structs inside maps (because they are not addressable using Go reflection). - - if err := mergo.Merge(&dst, src); err != nil { - // ... - } - -Also, you can merge overwriting values using the transformer WithOverride. - - if err := mergo.Merge(&dst, src, mergo.WithOverride); err != nil { - // ... - } - -Additionally, you can map a map[string]interface{} to a struct (and otherwise, from struct to map), following the same restrictions as in Merge(). Keys are capitalized to find each corresponding exported field. - - if err := mergo.Map(&dst, srcMap); err != nil { - // ... - } - -Warning: if you map a struct to map, it won't do it recursively. Don't expect Mergo to map struct members of your struct as map[string]interface{}. They will be just assigned as values. - -Here is a nice example: - - package main - - import ( - "fmt" - "github.com/imdario/mergo" - ) - - type Foo struct { - A string - B int64 - } - - func main() { - src := Foo{ - A: "one", - B: 2, - } - dest := Foo{ - A: "two", - } - mergo.Merge(&dest, src) - fmt.Println(dest) - // Will print - // {two 2} - } - -Transformers - -Transformers allow to merge specific types differently than in the default behavior. In other words, now you can customize how some types are merged. For example, time.Time is a struct; it doesn't have zero value but IsZero can return true because it has fields with zero value. How can we merge a non-zero time.Time? - - package main - - import ( - "fmt" - "github.com/imdario/mergo" - "reflect" - "time" - ) - - type timeTransformer struct { - } - - func (t timeTransformer) Transformer(typ reflect.Type) func(dst, src reflect.Value) error { - if typ == reflect.TypeOf(time.Time{}) { - return func(dst, src reflect.Value) error { - if dst.CanSet() { - isZero := dst.MethodByName("IsZero") - result := isZero.Call([]reflect.Value{}) - if result[0].Bool() { - dst.Set(src) - } - } - return nil - } - } - return nil - } - - type Snapshot struct { - Time time.Time - // ... - } - - func main() { - src := Snapshot{time.Now()} - dest := Snapshot{} - mergo.Merge(&dest, src, mergo.WithTransformers(timeTransformer{})) - fmt.Println(dest) - // Will print - // { 2018-01-12 01:15:00 +0000 UTC m=+0.000000001 } - } - -Contact me - -If I can help you, you have an idea or you are using Mergo in your projects, don't hesitate to drop me a line (or a pull request): https://twitter.com/im_dario - -About - -Written by Dario Castañé: https://da.rio.hn - -License - -BSD 3-Clause license, as Go language. - -*/ -package mergo diff --git a/vendor/github.com/imdario/mergo/map.go b/vendor/github.com/imdario/mergo/map.go deleted file mode 100644 index b50d5c2a4..000000000 --- a/vendor/github.com/imdario/mergo/map.go +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright 2014 Dario Castañé. All rights reserved. -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Based on src/pkg/reflect/deepequal.go from official -// golang's stdlib. - -package mergo - -import ( - "fmt" - "reflect" - "unicode" - "unicode/utf8" -) - -func changeInitialCase(s string, mapper func(rune) rune) string { - if s == "" { - return s - } - r, n := utf8.DecodeRuneInString(s) - return string(mapper(r)) + s[n:] -} - -func isExported(field reflect.StructField) bool { - r, _ := utf8.DecodeRuneInString(field.Name) - return r >= 'A' && r <= 'Z' -} - -// Traverses recursively both values, assigning src's fields values to dst. -// The map argument tracks comparisons that have already been seen, which allows -// short circuiting on recursive types. -func deepMap(dst, src reflect.Value, visited map[uintptr]*visit, depth int, config *Config) (err error) { - overwrite := config.Overwrite - if dst.CanAddr() { - addr := dst.UnsafeAddr() - h := 17 * addr - seen := visited[h] - typ := dst.Type() - for p := seen; p != nil; p = p.next { - if p.ptr == addr && p.typ == typ { - return nil - } - } - // Remember, remember... - visited[h] = &visit{typ, seen, addr} - } - zeroValue := reflect.Value{} - switch dst.Kind() { - case reflect.Map: - dstMap := dst.Interface().(map[string]interface{}) - for i, n := 0, src.NumField(); i < n; i++ { - srcType := src.Type() - field := srcType.Field(i) - if !isExported(field) { - continue - } - fieldName := field.Name - fieldName = changeInitialCase(fieldName, unicode.ToLower) - if v, ok := dstMap[fieldName]; !ok || (isEmptyValue(reflect.ValueOf(v), !config.ShouldNotDereference) || overwrite) { - dstMap[fieldName] = src.Field(i).Interface() - } - } - case reflect.Ptr: - if dst.IsNil() { - v := reflect.New(dst.Type().Elem()) - dst.Set(v) - } - dst = dst.Elem() - fallthrough - case reflect.Struct: - srcMap := src.Interface().(map[string]interface{}) - for key := range srcMap { - config.overwriteWithEmptyValue = true - srcValue := srcMap[key] - fieldName := changeInitialCase(key, unicode.ToUpper) - dstElement := dst.FieldByName(fieldName) - if dstElement == zeroValue { - // We discard it because the field doesn't exist. - continue - } - srcElement := reflect.ValueOf(srcValue) - dstKind := dstElement.Kind() - srcKind := srcElement.Kind() - if srcKind == reflect.Ptr && dstKind != reflect.Ptr { - srcElement = srcElement.Elem() - srcKind = reflect.TypeOf(srcElement.Interface()).Kind() - } else if dstKind == reflect.Ptr { - // Can this work? I guess it can't. - if srcKind != reflect.Ptr && srcElement.CanAddr() { - srcPtr := srcElement.Addr() - srcElement = reflect.ValueOf(srcPtr) - srcKind = reflect.Ptr - } - } - - if !srcElement.IsValid() { - continue - } - if srcKind == dstKind { - if err = deepMerge(dstElement, srcElement, visited, depth+1, config); err != nil { - return - } - } else if dstKind == reflect.Interface && dstElement.Kind() == reflect.Interface { - if err = deepMerge(dstElement, srcElement, visited, depth+1, config); err != nil { - return - } - } else if srcKind == reflect.Map { - if err = deepMap(dstElement, srcElement, visited, depth+1, config); err != nil { - return - } - } else { - return fmt.Errorf("type mismatch on %s field: found %v, expected %v", fieldName, srcKind, dstKind) - } - } - } - return -} - -// Map sets fields' values in dst from src. -// src can be a map with string keys or a struct. dst must be the opposite: -// if src is a map, dst must be a valid pointer to struct. If src is a struct, -// dst must be map[string]interface{}. -// It won't merge unexported (private) fields and will do recursively -// any exported field. -// If dst is a map, keys will be src fields' names in lower camel case. -// Missing key in src that doesn't match a field in dst will be skipped. This -// doesn't apply if dst is a map. -// This is separated method from Merge because it is cleaner and it keeps sane -// semantics: merging equal types, mapping different (restricted) types. -func Map(dst, src interface{}, opts ...func(*Config)) error { - return _map(dst, src, opts...) -} - -// MapWithOverwrite will do the same as Map except that non-empty dst attributes will be overridden by -// non-empty src attribute values. -// Deprecated: Use Map(…) with WithOverride -func MapWithOverwrite(dst, src interface{}, opts ...func(*Config)) error { - return _map(dst, src, append(opts, WithOverride)...) -} - -func _map(dst, src interface{}, opts ...func(*Config)) error { - if dst != nil && reflect.ValueOf(dst).Kind() != reflect.Ptr { - return ErrNonPointerArgument - } - var ( - vDst, vSrc reflect.Value - err error - ) - config := &Config{} - - for _, opt := range opts { - opt(config) - } - - if vDst, vSrc, err = resolveValues(dst, src); err != nil { - return err - } - // To be friction-less, we redirect equal-type arguments - // to deepMerge. Only because arguments can be anything. - if vSrc.Kind() == vDst.Kind() { - return deepMerge(vDst, vSrc, make(map[uintptr]*visit), 0, config) - } - switch vSrc.Kind() { - case reflect.Struct: - if vDst.Kind() != reflect.Map { - return ErrExpectedMapAsDestination - } - case reflect.Map: - if vDst.Kind() != reflect.Struct { - return ErrExpectedStructAsDestination - } - default: - return ErrNotSupported - } - return deepMap(vDst, vSrc, make(map[uintptr]*visit), 0, config) -} diff --git a/vendor/github.com/imdario/mergo/merge.go b/vendor/github.com/imdario/mergo/merge.go deleted file mode 100644 index 0ef9b2138..000000000 --- a/vendor/github.com/imdario/mergo/merge.go +++ /dev/null @@ -1,409 +0,0 @@ -// Copyright 2013 Dario Castañé. All rights reserved. -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Based on src/pkg/reflect/deepequal.go from official -// golang's stdlib. - -package mergo - -import ( - "fmt" - "reflect" -) - -func hasMergeableFields(dst reflect.Value) (exported bool) { - for i, n := 0, dst.NumField(); i < n; i++ { - field := dst.Type().Field(i) - if field.Anonymous && dst.Field(i).Kind() == reflect.Struct { - exported = exported || hasMergeableFields(dst.Field(i)) - } else if isExportedComponent(&field) { - exported = exported || len(field.PkgPath) == 0 - } - } - return -} - -func isExportedComponent(field *reflect.StructField) bool { - pkgPath := field.PkgPath - if len(pkgPath) > 0 { - return false - } - c := field.Name[0] - if 'a' <= c && c <= 'z' || c == '_' { - return false - } - return true -} - -type Config struct { - Transformers Transformers - Overwrite bool - ShouldNotDereference bool - AppendSlice bool - TypeCheck bool - overwriteWithEmptyValue bool - overwriteSliceWithEmptyValue bool - sliceDeepCopy bool - debug bool -} - -type Transformers interface { - Transformer(reflect.Type) func(dst, src reflect.Value) error -} - -// Traverses recursively both values, assigning src's fields values to dst. -// The map argument tracks comparisons that have already been seen, which allows -// short circuiting on recursive types. -func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, config *Config) (err error) { - overwrite := config.Overwrite - typeCheck := config.TypeCheck - overwriteWithEmptySrc := config.overwriteWithEmptyValue - overwriteSliceWithEmptySrc := config.overwriteSliceWithEmptyValue - sliceDeepCopy := config.sliceDeepCopy - - if !src.IsValid() { - return - } - if dst.CanAddr() { - addr := dst.UnsafeAddr() - h := 17 * addr - seen := visited[h] - typ := dst.Type() - for p := seen; p != nil; p = p.next { - if p.ptr == addr && p.typ == typ { - return nil - } - } - // Remember, remember... - visited[h] = &visit{typ, seen, addr} - } - - if config.Transformers != nil && !isReflectNil(dst) && dst.IsValid() { - if fn := config.Transformers.Transformer(dst.Type()); fn != nil { - err = fn(dst, src) - return - } - } - - switch dst.Kind() { - case reflect.Struct: - if hasMergeableFields(dst) { - for i, n := 0, dst.NumField(); i < n; i++ { - if err = deepMerge(dst.Field(i), src.Field(i), visited, depth+1, config); err != nil { - return - } - } - } else { - if dst.CanSet() && (isReflectNil(dst) || overwrite) && (!isEmptyValue(src, !config.ShouldNotDereference) || overwriteWithEmptySrc) { - dst.Set(src) - } - } - case reflect.Map: - if dst.IsNil() && !src.IsNil() { - if dst.CanSet() { - dst.Set(reflect.MakeMap(dst.Type())) - } else { - dst = src - return - } - } - - if src.Kind() != reflect.Map { - if overwrite && dst.CanSet() { - dst.Set(src) - } - return - } - - for _, key := range src.MapKeys() { - srcElement := src.MapIndex(key) - if !srcElement.IsValid() { - continue - } - dstElement := dst.MapIndex(key) - switch srcElement.Kind() { - case reflect.Chan, reflect.Func, reflect.Map, reflect.Interface, reflect.Slice: - if srcElement.IsNil() { - if overwrite { - dst.SetMapIndex(key, srcElement) - } - continue - } - fallthrough - default: - if !srcElement.CanInterface() { - continue - } - switch reflect.TypeOf(srcElement.Interface()).Kind() { - case reflect.Struct: - fallthrough - case reflect.Ptr: - fallthrough - case reflect.Map: - srcMapElm := srcElement - dstMapElm := dstElement - if srcMapElm.CanInterface() { - srcMapElm = reflect.ValueOf(srcMapElm.Interface()) - if dstMapElm.IsValid() { - dstMapElm = reflect.ValueOf(dstMapElm.Interface()) - } - } - if err = deepMerge(dstMapElm, srcMapElm, visited, depth+1, config); err != nil { - return - } - case reflect.Slice: - srcSlice := reflect.ValueOf(srcElement.Interface()) - - var dstSlice reflect.Value - if !dstElement.IsValid() || dstElement.IsNil() { - dstSlice = reflect.MakeSlice(srcSlice.Type(), 0, srcSlice.Len()) - } else { - dstSlice = reflect.ValueOf(dstElement.Interface()) - } - - if (!isEmptyValue(src, !config.ShouldNotDereference) || overwriteWithEmptySrc || overwriteSliceWithEmptySrc) && (overwrite || isEmptyValue(dst, !config.ShouldNotDereference)) && !config.AppendSlice && !sliceDeepCopy { - if typeCheck && srcSlice.Type() != dstSlice.Type() { - return fmt.Errorf("cannot override two slices with different type (%s, %s)", srcSlice.Type(), dstSlice.Type()) - } - dstSlice = srcSlice - } else if config.AppendSlice { - if srcSlice.Type() != dstSlice.Type() { - return fmt.Errorf("cannot append two slices with different type (%s, %s)", srcSlice.Type(), dstSlice.Type()) - } - dstSlice = reflect.AppendSlice(dstSlice, srcSlice) - } else if sliceDeepCopy { - i := 0 - for ; i < srcSlice.Len() && i < dstSlice.Len(); i++ { - srcElement := srcSlice.Index(i) - dstElement := dstSlice.Index(i) - - if srcElement.CanInterface() { - srcElement = reflect.ValueOf(srcElement.Interface()) - } - if dstElement.CanInterface() { - dstElement = reflect.ValueOf(dstElement.Interface()) - } - - if err = deepMerge(dstElement, srcElement, visited, depth+1, config); err != nil { - return - } - } - - } - dst.SetMapIndex(key, dstSlice) - } - } - - if dstElement.IsValid() && !isEmptyValue(dstElement, !config.ShouldNotDereference) { - if reflect.TypeOf(srcElement.Interface()).Kind() == reflect.Slice { - continue - } - if reflect.TypeOf(srcElement.Interface()).Kind() == reflect.Map && reflect.TypeOf(dstElement.Interface()).Kind() == reflect.Map { - continue - } - } - - if srcElement.IsValid() && ((srcElement.Kind() != reflect.Ptr && overwrite) || !dstElement.IsValid() || isEmptyValue(dstElement, !config.ShouldNotDereference)) { - if dst.IsNil() { - dst.Set(reflect.MakeMap(dst.Type())) - } - dst.SetMapIndex(key, srcElement) - } - } - - // Ensure that all keys in dst are deleted if they are not in src. - if overwriteWithEmptySrc { - for _, key := range dst.MapKeys() { - srcElement := src.MapIndex(key) - if !srcElement.IsValid() { - dst.SetMapIndex(key, reflect.Value{}) - } - } - } - case reflect.Slice: - if !dst.CanSet() { - break - } - if (!isEmptyValue(src, !config.ShouldNotDereference) || overwriteWithEmptySrc || overwriteSliceWithEmptySrc) && (overwrite || isEmptyValue(dst, !config.ShouldNotDereference)) && !config.AppendSlice && !sliceDeepCopy { - dst.Set(src) - } else if config.AppendSlice { - if src.Type() != dst.Type() { - return fmt.Errorf("cannot append two slice with different type (%s, %s)", src.Type(), dst.Type()) - } - dst.Set(reflect.AppendSlice(dst, src)) - } else if sliceDeepCopy { - for i := 0; i < src.Len() && i < dst.Len(); i++ { - srcElement := src.Index(i) - dstElement := dst.Index(i) - if srcElement.CanInterface() { - srcElement = reflect.ValueOf(srcElement.Interface()) - } - if dstElement.CanInterface() { - dstElement = reflect.ValueOf(dstElement.Interface()) - } - - if err = deepMerge(dstElement, srcElement, visited, depth+1, config); err != nil { - return - } - } - } - case reflect.Ptr: - fallthrough - case reflect.Interface: - if isReflectNil(src) { - if overwriteWithEmptySrc && dst.CanSet() && src.Type().AssignableTo(dst.Type()) { - dst.Set(src) - } - break - } - - if src.Kind() != reflect.Interface { - if dst.IsNil() || (src.Kind() != reflect.Ptr && overwrite) { - if dst.CanSet() && (overwrite || isEmptyValue(dst, !config.ShouldNotDereference)) { - dst.Set(src) - } - } else if src.Kind() == reflect.Ptr { - if !config.ShouldNotDereference { - if err = deepMerge(dst.Elem(), src.Elem(), visited, depth+1, config); err != nil { - return - } - } else { - if overwriteWithEmptySrc || (overwrite && !src.IsNil()) || dst.IsNil() { - dst.Set(src) - } - } - } else if dst.Elem().Type() == src.Type() { - if err = deepMerge(dst.Elem(), src, visited, depth+1, config); err != nil { - return - } - } else { - return ErrDifferentArgumentsTypes - } - break - } - - if dst.IsNil() || overwrite { - if dst.CanSet() && (overwrite || isEmptyValue(dst, !config.ShouldNotDereference)) { - dst.Set(src) - } - break - } - - if dst.Elem().Kind() == src.Elem().Kind() { - if err = deepMerge(dst.Elem(), src.Elem(), visited, depth+1, config); err != nil { - return - } - break - } - default: - mustSet := (isEmptyValue(dst, !config.ShouldNotDereference) || overwrite) && (!isEmptyValue(src, !config.ShouldNotDereference) || overwriteWithEmptySrc) - if mustSet { - if dst.CanSet() { - dst.Set(src) - } else { - dst = src - } - } - } - - return -} - -// Merge will fill any empty for value type attributes on the dst struct using corresponding -// src attributes if they themselves are not empty. dst and src must be valid same-type structs -// and dst must be a pointer to struct. -// It won't merge unexported (private) fields and will do recursively any exported field. -func Merge(dst, src interface{}, opts ...func(*Config)) error { - return merge(dst, src, opts...) -} - -// MergeWithOverwrite will do the same as Merge except that non-empty dst attributes will be overridden by -// non-empty src attribute values. -// Deprecated: use Merge(…) with WithOverride -func MergeWithOverwrite(dst, src interface{}, opts ...func(*Config)) error { - return merge(dst, src, append(opts, WithOverride)...) -} - -// WithTransformers adds transformers to merge, allowing to customize the merging of some types. -func WithTransformers(transformers Transformers) func(*Config) { - return func(config *Config) { - config.Transformers = transformers - } -} - -// WithOverride will make merge override non-empty dst attributes with non-empty src attributes values. -func WithOverride(config *Config) { - config.Overwrite = true -} - -// WithOverwriteWithEmptyValue will make merge override non empty dst attributes with empty src attributes values. -func WithOverwriteWithEmptyValue(config *Config) { - config.Overwrite = true - config.overwriteWithEmptyValue = true -} - -// WithOverrideEmptySlice will make merge override empty dst slice with empty src slice. -func WithOverrideEmptySlice(config *Config) { - config.overwriteSliceWithEmptyValue = true -} - -// WithoutDereference prevents dereferencing pointers when evaluating whether they are empty -// (i.e. a non-nil pointer is never considered empty). -func WithoutDereference(config *Config) { - config.ShouldNotDereference = true -} - -// WithAppendSlice will make merge append slices instead of overwriting it. -func WithAppendSlice(config *Config) { - config.AppendSlice = true -} - -// WithTypeCheck will make merge check types while overwriting it (must be used with WithOverride). -func WithTypeCheck(config *Config) { - config.TypeCheck = true -} - -// WithSliceDeepCopy will merge slice element one by one with Overwrite flag. -func WithSliceDeepCopy(config *Config) { - config.sliceDeepCopy = true - config.Overwrite = true -} - -func merge(dst, src interface{}, opts ...func(*Config)) error { - if dst != nil && reflect.ValueOf(dst).Kind() != reflect.Ptr { - return ErrNonPointerArgument - } - var ( - vDst, vSrc reflect.Value - err error - ) - - config := &Config{} - - for _, opt := range opts { - opt(config) - } - - if vDst, vSrc, err = resolveValues(dst, src); err != nil { - return err - } - if vDst.Type() != vSrc.Type() { - return ErrDifferentArgumentsTypes - } - return deepMerge(vDst, vSrc, make(map[uintptr]*visit), 0, config) -} - -// IsReflectNil is the reflect value provided nil -func isReflectNil(v reflect.Value) bool { - k := v.Kind() - switch k { - case reflect.Interface, reflect.Slice, reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr: - // Both interface and slice are nil if first word is 0. - // Both are always bigger than a word; assume flagIndir. - return v.IsNil() - default: - return false - } -} diff --git a/vendor/github.com/imdario/mergo/mergo.go b/vendor/github.com/imdario/mergo/mergo.go deleted file mode 100644 index 0a721e2d8..000000000 --- a/vendor/github.com/imdario/mergo/mergo.go +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2013 Dario Castañé. All rights reserved. -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Based on src/pkg/reflect/deepequal.go from official -// golang's stdlib. - -package mergo - -import ( - "errors" - "reflect" -) - -// Errors reported by Mergo when it finds invalid arguments. -var ( - ErrNilArguments = errors.New("src and dst must not be nil") - ErrDifferentArgumentsTypes = errors.New("src and dst must be of same type") - ErrNotSupported = errors.New("only structs, maps, and slices are supported") - ErrExpectedMapAsDestination = errors.New("dst was expected to be a map") - ErrExpectedStructAsDestination = errors.New("dst was expected to be a struct") - ErrNonPointerArgument = errors.New("dst must be a pointer") -) - -// During deepMerge, must keep track of checks that are -// in progress. The comparison algorithm assumes that all -// checks in progress are true when it reencounters them. -// Visited are stored in a map indexed by 17 * a1 + a2; -type visit struct { - typ reflect.Type - next *visit - ptr uintptr -} - -// From src/pkg/encoding/json/encode.go. -func isEmptyValue(v reflect.Value, shouldDereference bool) bool { - switch v.Kind() { - case reflect.Array, reflect.Map, reflect.Slice, reflect.String: - return v.Len() == 0 - case reflect.Bool: - return !v.Bool() - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.Interface, reflect.Ptr: - if v.IsNil() { - return true - } - if shouldDereference { - return isEmptyValue(v.Elem(), shouldDereference) - } - return false - case reflect.Func: - return v.IsNil() - case reflect.Invalid: - return true - } - return false -} - -func resolveValues(dst, src interface{}) (vDst, vSrc reflect.Value, err error) { - if dst == nil || src == nil { - err = ErrNilArguments - return - } - vDst = reflect.ValueOf(dst).Elem() - if vDst.Kind() != reflect.Struct && vDst.Kind() != reflect.Map && vDst.Kind() != reflect.Slice { - err = ErrNotSupported - return - } - vSrc = reflect.ValueOf(src) - // We check if vSrc is a pointer to dereference it. - if vSrc.Kind() == reflect.Ptr { - vSrc = vSrc.Elem() - } - return -} diff --git a/vendor/github.com/json-iterator/go/.codecov.yml b/vendor/github.com/json-iterator/go/.codecov.yml deleted file mode 100644 index 955dc0be5..000000000 --- a/vendor/github.com/json-iterator/go/.codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -ignore: - - "output_tests/.*" - diff --git a/vendor/github.com/json-iterator/go/.gitignore b/vendor/github.com/json-iterator/go/.gitignore deleted file mode 100644 index 15556530a..000000000 --- a/vendor/github.com/json-iterator/go/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/vendor -/bug_test.go -/coverage.txt -/.idea diff --git a/vendor/github.com/json-iterator/go/.travis.yml b/vendor/github.com/json-iterator/go/.travis.yml deleted file mode 100644 index 449e67cd0..000000000 --- a/vendor/github.com/json-iterator/go/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: go - -go: - - 1.8.x - - 1.x - -before_install: - - go get -t -v ./... - -script: - - ./test.sh - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/json-iterator/go/Gopkg.lock b/vendor/github.com/json-iterator/go/Gopkg.lock deleted file mode 100644 index c8a9fbb38..000000000 --- a/vendor/github.com/json-iterator/go/Gopkg.lock +++ /dev/null @@ -1,21 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - name = "github.com/modern-go/concurrent" - packages = ["."] - revision = "e0a39a4cb4216ea8db28e22a69f4ec25610d513a" - version = "1.0.0" - -[[projects]] - name = "github.com/modern-go/reflect2" - packages = ["."] - revision = "4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd" - version = "1.0.1" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - inputs-digest = "ea54a775e5a354cb015502d2e7aa4b74230fc77e894f34a838b268c25ec8eeb8" - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/vendor/github.com/json-iterator/go/Gopkg.toml b/vendor/github.com/json-iterator/go/Gopkg.toml deleted file mode 100644 index 313a0f887..000000000 --- a/vendor/github.com/json-iterator/go/Gopkg.toml +++ /dev/null @@ -1,26 +0,0 @@ -# Gopkg.toml example -# -# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md -# for detailed Gopkg.toml documentation. -# -# required = ["github.com/user/thing/cmd/thing"] -# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] -# -# [[constraint]] -# name = "github.com/user/project" -# version = "1.0.0" -# -# [[constraint]] -# name = "github.com/user/project2" -# branch = "dev" -# source = "github.com/myfork/project2" -# -# [[override]] -# name = "github.com/x/y" -# version = "2.4.0" - -ignored = ["github.com/davecgh/go-spew*","github.com/google/gofuzz*","github.com/stretchr/testify*"] - -[[constraint]] - name = "github.com/modern-go/reflect2" - version = "1.0.1" diff --git a/vendor/github.com/json-iterator/go/LICENSE b/vendor/github.com/json-iterator/go/LICENSE deleted file mode 100644 index 2cf4f5ab2..000000000 --- a/vendor/github.com/json-iterator/go/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2016 json-iterator - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/json-iterator/go/README.md b/vendor/github.com/json-iterator/go/README.md deleted file mode 100644 index c589addf9..000000000 --- a/vendor/github.com/json-iterator/go/README.md +++ /dev/null @@ -1,85 +0,0 @@ -[![Sourcegraph](https://sourcegraph.com/github.com/json-iterator/go/-/badge.svg)](https://sourcegraph.com/github.com/json-iterator/go?badge) -[![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](https://pkg.go.dev/github.com/json-iterator/go) -[![Build Status](https://travis-ci.org/json-iterator/go.svg?branch=master)](https://travis-ci.org/json-iterator/go) -[![codecov](https://codecov.io/gh/json-iterator/go/branch/master/graph/badge.svg)](https://codecov.io/gh/json-iterator/go) -[![rcard](https://goreportcard.com/badge/github.com/json-iterator/go)](https://goreportcard.com/report/github.com/json-iterator/go) -[![License](http://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://raw.githubusercontent.com/json-iterator/go/master/LICENSE) -[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/json-iterator/Lobby) - -A high-performance 100% compatible drop-in replacement of "encoding/json" - -# Benchmark - -![benchmark](http://jsoniter.com/benchmarks/go-benchmark.png) - -Source code: https://github.com/json-iterator/go-benchmark/blob/master/src/github.com/json-iterator/go-benchmark/benchmark_medium_payload_test.go - -Raw Result (easyjson requires static code generation) - -| | ns/op | allocation bytes | allocation times | -| --------------- | ----------- | ---------------- | ---------------- | -| std decode | 35510 ns/op | 1960 B/op | 99 allocs/op | -| easyjson decode | 8499 ns/op | 160 B/op | 4 allocs/op | -| jsoniter decode | 5623 ns/op | 160 B/op | 3 allocs/op | -| std encode | 2213 ns/op | 712 B/op | 5 allocs/op | -| easyjson encode | 883 ns/op | 576 B/op | 3 allocs/op | -| jsoniter encode | 837 ns/op | 384 B/op | 4 allocs/op | - -Always benchmark with your own workload. -The result depends heavily on the data input. - -# Usage - -100% compatibility with standard lib - -Replace - -```go -import "encoding/json" -json.Marshal(&data) -``` - -with - -```go -import jsoniter "github.com/json-iterator/go" - -var json = jsoniter.ConfigCompatibleWithStandardLibrary -json.Marshal(&data) -``` - -Replace - -```go -import "encoding/json" -json.Unmarshal(input, &data) -``` - -with - -```go -import jsoniter "github.com/json-iterator/go" - -var json = jsoniter.ConfigCompatibleWithStandardLibrary -json.Unmarshal(input, &data) -``` - -[More documentation](http://jsoniter.com/migrate-from-go-std.html) - -# How to get - -``` -go get github.com/json-iterator/go -``` - -# Contribution Welcomed ! - -Contributors - -- [thockin](https://github.com/thockin) -- [mattn](https://github.com/mattn) -- [cch123](https://github.com/cch123) -- [Oleg Shaldybin](https://github.com/olegshaldybin) -- [Jason Toffaletti](https://github.com/toffaletti) - -Report issue or pull request, or email taowen@gmail.com, or [![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/json-iterator/Lobby) diff --git a/vendor/github.com/json-iterator/go/adapter.go b/vendor/github.com/json-iterator/go/adapter.go deleted file mode 100644 index 92d2cc4a3..000000000 --- a/vendor/github.com/json-iterator/go/adapter.go +++ /dev/null @@ -1,150 +0,0 @@ -package jsoniter - -import ( - "bytes" - "io" -) - -// RawMessage to make replace json with jsoniter -type RawMessage []byte - -// Unmarshal adapts to json/encoding Unmarshal API -// -// Unmarshal parses the JSON-encoded data and stores the result in the value pointed to by v. -// Refer to https://godoc.org/encoding/json#Unmarshal for more information -func Unmarshal(data []byte, v interface{}) error { - return ConfigDefault.Unmarshal(data, v) -} - -// UnmarshalFromString is a convenient method to read from string instead of []byte -func UnmarshalFromString(str string, v interface{}) error { - return ConfigDefault.UnmarshalFromString(str, v) -} - -// Get quick method to get value from deeply nested JSON structure -func Get(data []byte, path ...interface{}) Any { - return ConfigDefault.Get(data, path...) -} - -// Marshal adapts to json/encoding Marshal API -// -// Marshal returns the JSON encoding of v, adapts to json/encoding Marshal API -// Refer to https://godoc.org/encoding/json#Marshal for more information -func Marshal(v interface{}) ([]byte, error) { - return ConfigDefault.Marshal(v) -} - -// MarshalIndent same as json.MarshalIndent. Prefix is not supported. -func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) { - return ConfigDefault.MarshalIndent(v, prefix, indent) -} - -// MarshalToString convenient method to write as string instead of []byte -func MarshalToString(v interface{}) (string, error) { - return ConfigDefault.MarshalToString(v) -} - -// NewDecoder adapts to json/stream NewDecoder API. -// -// NewDecoder returns a new decoder that reads from r. -// -// Instead of a json/encoding Decoder, an Decoder is returned -// Refer to https://godoc.org/encoding/json#NewDecoder for more information -func NewDecoder(reader io.Reader) *Decoder { - return ConfigDefault.NewDecoder(reader) -} - -// Decoder reads and decodes JSON values from an input stream. -// Decoder provides identical APIs with json/stream Decoder (Token() and UseNumber() are in progress) -type Decoder struct { - iter *Iterator -} - -// Decode decode JSON into interface{} -func (adapter *Decoder) Decode(obj interface{}) error { - if adapter.iter.head == adapter.iter.tail && adapter.iter.reader != nil { - if !adapter.iter.loadMore() { - return io.EOF - } - } - adapter.iter.ReadVal(obj) - err := adapter.iter.Error - if err == io.EOF { - return nil - } - return adapter.iter.Error -} - -// More is there more? -func (adapter *Decoder) More() bool { - iter := adapter.iter - if iter.Error != nil { - return false - } - c := iter.nextToken() - if c == 0 { - return false - } - iter.unreadByte() - return c != ']' && c != '}' -} - -// Buffered remaining buffer -func (adapter *Decoder) Buffered() io.Reader { - remaining := adapter.iter.buf[adapter.iter.head:adapter.iter.tail] - return bytes.NewReader(remaining) -} - -// UseNumber causes the Decoder to unmarshal a number into an interface{} as a -// Number instead of as a float64. -func (adapter *Decoder) UseNumber() { - cfg := adapter.iter.cfg.configBeforeFrozen - cfg.UseNumber = true - adapter.iter.cfg = cfg.frozeWithCacheReuse(adapter.iter.cfg.extraExtensions) -} - -// DisallowUnknownFields causes the Decoder to return an error when the destination -// is a struct and the input contains object keys which do not match any -// non-ignored, exported fields in the destination. -func (adapter *Decoder) DisallowUnknownFields() { - cfg := adapter.iter.cfg.configBeforeFrozen - cfg.DisallowUnknownFields = true - adapter.iter.cfg = cfg.frozeWithCacheReuse(adapter.iter.cfg.extraExtensions) -} - -// NewEncoder same as json.NewEncoder -func NewEncoder(writer io.Writer) *Encoder { - return ConfigDefault.NewEncoder(writer) -} - -// Encoder same as json.Encoder -type Encoder struct { - stream *Stream -} - -// Encode encode interface{} as JSON to io.Writer -func (adapter *Encoder) Encode(val interface{}) error { - adapter.stream.WriteVal(val) - adapter.stream.WriteRaw("\n") - adapter.stream.Flush() - return adapter.stream.Error -} - -// SetIndent set the indention. Prefix is not supported -func (adapter *Encoder) SetIndent(prefix, indent string) { - config := adapter.stream.cfg.configBeforeFrozen - config.IndentionStep = len(indent) - adapter.stream.cfg = config.frozeWithCacheReuse(adapter.stream.cfg.extraExtensions) -} - -// SetEscapeHTML escape html by default, set to false to disable -func (adapter *Encoder) SetEscapeHTML(escapeHTML bool) { - config := adapter.stream.cfg.configBeforeFrozen - config.EscapeHTML = escapeHTML - adapter.stream.cfg = config.frozeWithCacheReuse(adapter.stream.cfg.extraExtensions) -} - -// Valid reports whether data is a valid JSON encoding. -func Valid(data []byte) bool { - return ConfigDefault.Valid(data) -} diff --git a/vendor/github.com/json-iterator/go/any.go b/vendor/github.com/json-iterator/go/any.go deleted file mode 100644 index f6b8aeab0..000000000 --- a/vendor/github.com/json-iterator/go/any.go +++ /dev/null @@ -1,325 +0,0 @@ -package jsoniter - -import ( - "errors" - "fmt" - "github.com/modern-go/reflect2" - "io" - "reflect" - "strconv" - "unsafe" -) - -// Any generic object representation. -// The lazy json implementation holds []byte and parse lazily. -type Any interface { - LastError() error - ValueType() ValueType - MustBeValid() Any - ToBool() bool - ToInt() int - ToInt32() int32 - ToInt64() int64 - ToUint() uint - ToUint32() uint32 - ToUint64() uint64 - ToFloat32() float32 - ToFloat64() float64 - ToString() string - ToVal(val interface{}) - Get(path ...interface{}) Any - Size() int - Keys() []string - GetInterface() interface{} - WriteTo(stream *Stream) -} - -type baseAny struct{} - -func (any *baseAny) Get(path ...interface{}) Any { - return &invalidAny{baseAny{}, fmt.Errorf("GetIndex %v from simple value", path)} -} - -func (any *baseAny) Size() int { - return 0 -} - -func (any *baseAny) Keys() []string { - return []string{} -} - -func (any *baseAny) ToVal(obj interface{}) { - panic("not implemented") -} - -// WrapInt32 turn int32 into Any interface -func WrapInt32(val int32) Any { - return &int32Any{baseAny{}, val} -} - -// WrapInt64 turn int64 into Any interface -func WrapInt64(val int64) Any { - return &int64Any{baseAny{}, val} -} - -// WrapUint32 turn uint32 into Any interface -func WrapUint32(val uint32) Any { - return &uint32Any{baseAny{}, val} -} - -// WrapUint64 turn uint64 into Any interface -func WrapUint64(val uint64) Any { - return &uint64Any{baseAny{}, val} -} - -// WrapFloat64 turn float64 into Any interface -func WrapFloat64(val float64) Any { - return &floatAny{baseAny{}, val} -} - -// WrapString turn string into Any interface -func WrapString(val string) Any { - return &stringAny{baseAny{}, val} -} - -// Wrap turn a go object into Any interface -func Wrap(val interface{}) Any { - if val == nil { - return &nilAny{} - } - asAny, isAny := val.(Any) - if isAny { - return asAny - } - typ := reflect2.TypeOf(val) - switch typ.Kind() { - case reflect.Slice: - return wrapArray(val) - case reflect.Struct: - return wrapStruct(val) - case reflect.Map: - return wrapMap(val) - case reflect.String: - return WrapString(val.(string)) - case reflect.Int: - if strconv.IntSize == 32 { - return WrapInt32(int32(val.(int))) - } - return WrapInt64(int64(val.(int))) - case reflect.Int8: - return WrapInt32(int32(val.(int8))) - case reflect.Int16: - return WrapInt32(int32(val.(int16))) - case reflect.Int32: - return WrapInt32(val.(int32)) - case reflect.Int64: - return WrapInt64(val.(int64)) - case reflect.Uint: - if strconv.IntSize == 32 { - return WrapUint32(uint32(val.(uint))) - } - return WrapUint64(uint64(val.(uint))) - case reflect.Uintptr: - if ptrSize == 32 { - return WrapUint32(uint32(val.(uintptr))) - } - return WrapUint64(uint64(val.(uintptr))) - case reflect.Uint8: - return WrapUint32(uint32(val.(uint8))) - case reflect.Uint16: - return WrapUint32(uint32(val.(uint16))) - case reflect.Uint32: - return WrapUint32(uint32(val.(uint32))) - case reflect.Uint64: - return WrapUint64(val.(uint64)) - case reflect.Float32: - return WrapFloat64(float64(val.(float32))) - case reflect.Float64: - return WrapFloat64(val.(float64)) - case reflect.Bool: - if val.(bool) == true { - return &trueAny{} - } - return &falseAny{} - } - return &invalidAny{baseAny{}, fmt.Errorf("unsupported type: %v", typ)} -} - -// ReadAny read next JSON element as an Any object. It is a better json.RawMessage. -func (iter *Iterator) ReadAny() Any { - return iter.readAny() -} - -func (iter *Iterator) readAny() Any { - c := iter.nextToken() - switch c { - case '"': - iter.unreadByte() - return &stringAny{baseAny{}, iter.ReadString()} - case 'n': - iter.skipThreeBytes('u', 'l', 'l') // null - return &nilAny{} - case 't': - iter.skipThreeBytes('r', 'u', 'e') // true - return &trueAny{} - case 'f': - iter.skipFourBytes('a', 'l', 's', 'e') // false - return &falseAny{} - case '{': - return iter.readObjectAny() - case '[': - return iter.readArrayAny() - case '-': - return iter.readNumberAny(false) - case 0: - return &invalidAny{baseAny{}, errors.New("input is empty")} - default: - return iter.readNumberAny(true) - } -} - -func (iter *Iterator) readNumberAny(positive bool) Any { - iter.startCapture(iter.head - 1) - iter.skipNumber() - lazyBuf := iter.stopCapture() - return &numberLazyAny{baseAny{}, iter.cfg, lazyBuf, nil} -} - -func (iter *Iterator) readObjectAny() Any { - iter.startCapture(iter.head - 1) - iter.skipObject() - lazyBuf := iter.stopCapture() - return &objectLazyAny{baseAny{}, iter.cfg, lazyBuf, nil} -} - -func (iter *Iterator) readArrayAny() Any { - iter.startCapture(iter.head - 1) - iter.skipArray() - lazyBuf := iter.stopCapture() - return &arrayLazyAny{baseAny{}, iter.cfg, lazyBuf, nil} -} - -func locateObjectField(iter *Iterator, target string) []byte { - var found []byte - iter.ReadObjectCB(func(iter *Iterator, field string) bool { - if field == target { - found = iter.SkipAndReturnBytes() - return false - } - iter.Skip() - return true - }) - return found -} - -func locateArrayElement(iter *Iterator, target int) []byte { - var found []byte - n := 0 - iter.ReadArrayCB(func(iter *Iterator) bool { - if n == target { - found = iter.SkipAndReturnBytes() - return false - } - iter.Skip() - n++ - return true - }) - return found -} - -func locatePath(iter *Iterator, path []interface{}) Any { - for i, pathKeyObj := range path { - switch pathKey := pathKeyObj.(type) { - case string: - valueBytes := locateObjectField(iter, pathKey) - if valueBytes == nil { - return newInvalidAny(path[i:]) - } - iter.ResetBytes(valueBytes) - case int: - valueBytes := locateArrayElement(iter, pathKey) - if valueBytes == nil { - return newInvalidAny(path[i:]) - } - iter.ResetBytes(valueBytes) - case int32: - if '*' == pathKey { - return iter.readAny().Get(path[i:]...) - } - return newInvalidAny(path[i:]) - default: - return newInvalidAny(path[i:]) - } - } - if iter.Error != nil && iter.Error != io.EOF { - return &invalidAny{baseAny{}, iter.Error} - } - return iter.readAny() -} - -var anyType = reflect2.TypeOfPtr((*Any)(nil)).Elem() - -func createDecoderOfAny(ctx *ctx, typ reflect2.Type) ValDecoder { - if typ == anyType { - return &directAnyCodec{} - } - if typ.Implements(anyType) { - return &anyCodec{ - valType: typ, - } - } - return nil -} - -func createEncoderOfAny(ctx *ctx, typ reflect2.Type) ValEncoder { - if typ == anyType { - return &directAnyCodec{} - } - if typ.Implements(anyType) { - return &anyCodec{ - valType: typ, - } - } - return nil -} - -type anyCodec struct { - valType reflect2.Type -} - -func (codec *anyCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - panic("not implemented") -} - -func (codec *anyCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - obj := codec.valType.UnsafeIndirect(ptr) - any := obj.(Any) - any.WriteTo(stream) -} - -func (codec *anyCodec) IsEmpty(ptr unsafe.Pointer) bool { - obj := codec.valType.UnsafeIndirect(ptr) - any := obj.(Any) - return any.Size() == 0 -} - -type directAnyCodec struct { -} - -func (codec *directAnyCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - *(*Any)(ptr) = iter.readAny() -} - -func (codec *directAnyCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - any := *(*Any)(ptr) - if any == nil { - stream.WriteNil() - return - } - any.WriteTo(stream) -} - -func (codec *directAnyCodec) IsEmpty(ptr unsafe.Pointer) bool { - any := *(*Any)(ptr) - return any.Size() == 0 -} diff --git a/vendor/github.com/json-iterator/go/any_array.go b/vendor/github.com/json-iterator/go/any_array.go deleted file mode 100644 index 0449e9aa4..000000000 --- a/vendor/github.com/json-iterator/go/any_array.go +++ /dev/null @@ -1,278 +0,0 @@ -package jsoniter - -import ( - "reflect" - "unsafe" -) - -type arrayLazyAny struct { - baseAny - cfg *frozenConfig - buf []byte - err error -} - -func (any *arrayLazyAny) ValueType() ValueType { - return ArrayValue -} - -func (any *arrayLazyAny) MustBeValid() Any { - return any -} - -func (any *arrayLazyAny) LastError() error { - return any.err -} - -func (any *arrayLazyAny) ToBool() bool { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - return iter.ReadArray() -} - -func (any *arrayLazyAny) ToInt() int { - if any.ToBool() { - return 1 - } - return 0 -} - -func (any *arrayLazyAny) ToInt32() int32 { - if any.ToBool() { - return 1 - } - return 0 -} - -func (any *arrayLazyAny) ToInt64() int64 { - if any.ToBool() { - return 1 - } - return 0 -} - -func (any *arrayLazyAny) ToUint() uint { - if any.ToBool() { - return 1 - } - return 0 -} - -func (any *arrayLazyAny) ToUint32() uint32 { - if any.ToBool() { - return 1 - } - return 0 -} - -func (any *arrayLazyAny) ToUint64() uint64 { - if any.ToBool() { - return 1 - } - return 0 -} - -func (any *arrayLazyAny) ToFloat32() float32 { - if any.ToBool() { - return 1 - } - return 0 -} - -func (any *arrayLazyAny) ToFloat64() float64 { - if any.ToBool() { - return 1 - } - return 0 -} - -func (any *arrayLazyAny) ToString() string { - return *(*string)(unsafe.Pointer(&any.buf)) -} - -func (any *arrayLazyAny) ToVal(val interface{}) { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - iter.ReadVal(val) -} - -func (any *arrayLazyAny) Get(path ...interface{}) Any { - if len(path) == 0 { - return any - } - switch firstPath := path[0].(type) { - case int: - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - valueBytes := locateArrayElement(iter, firstPath) - if valueBytes == nil { - return newInvalidAny(path) - } - iter.ResetBytes(valueBytes) - return locatePath(iter, path[1:]) - case int32: - if '*' == firstPath { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - arr := make([]Any, 0) - iter.ReadArrayCB(func(iter *Iterator) bool { - found := iter.readAny().Get(path[1:]...) - if found.ValueType() != InvalidValue { - arr = append(arr, found) - } - return true - }) - return wrapArray(arr) - } - return newInvalidAny(path) - default: - return newInvalidAny(path) - } -} - -func (any *arrayLazyAny) Size() int { - size := 0 - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - iter.ReadArrayCB(func(iter *Iterator) bool { - size++ - iter.Skip() - return true - }) - return size -} - -func (any *arrayLazyAny) WriteTo(stream *Stream) { - stream.Write(any.buf) -} - -func (any *arrayLazyAny) GetInterface() interface{} { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - return iter.Read() -} - -type arrayAny struct { - baseAny - val reflect.Value -} - -func wrapArray(val interface{}) *arrayAny { - return &arrayAny{baseAny{}, reflect.ValueOf(val)} -} - -func (any *arrayAny) ValueType() ValueType { - return ArrayValue -} - -func (any *arrayAny) MustBeValid() Any { - return any -} - -func (any *arrayAny) LastError() error { - return nil -} - -func (any *arrayAny) ToBool() bool { - return any.val.Len() != 0 -} - -func (any *arrayAny) ToInt() int { - if any.val.Len() == 0 { - return 0 - } - return 1 -} - -func (any *arrayAny) ToInt32() int32 { - if any.val.Len() == 0 { - return 0 - } - return 1 -} - -func (any *arrayAny) ToInt64() int64 { - if any.val.Len() == 0 { - return 0 - } - return 1 -} - -func (any *arrayAny) ToUint() uint { - if any.val.Len() == 0 { - return 0 - } - return 1 -} - -func (any *arrayAny) ToUint32() uint32 { - if any.val.Len() == 0 { - return 0 - } - return 1 -} - -func (any *arrayAny) ToUint64() uint64 { - if any.val.Len() == 0 { - return 0 - } - return 1 -} - -func (any *arrayAny) ToFloat32() float32 { - if any.val.Len() == 0 { - return 0 - } - return 1 -} - -func (any *arrayAny) ToFloat64() float64 { - if any.val.Len() == 0 { - return 0 - } - return 1 -} - -func (any *arrayAny) ToString() string { - str, _ := MarshalToString(any.val.Interface()) - return str -} - -func (any *arrayAny) Get(path ...interface{}) Any { - if len(path) == 0 { - return any - } - switch firstPath := path[0].(type) { - case int: - if firstPath < 0 || firstPath >= any.val.Len() { - return newInvalidAny(path) - } - return Wrap(any.val.Index(firstPath).Interface()) - case int32: - if '*' == firstPath { - mappedAll := make([]Any, 0) - for i := 0; i < any.val.Len(); i++ { - mapped := Wrap(any.val.Index(i).Interface()).Get(path[1:]...) - if mapped.ValueType() != InvalidValue { - mappedAll = append(mappedAll, mapped) - } - } - return wrapArray(mappedAll) - } - return newInvalidAny(path) - default: - return newInvalidAny(path) - } -} - -func (any *arrayAny) Size() int { - return any.val.Len() -} - -func (any *arrayAny) WriteTo(stream *Stream) { - stream.WriteVal(any.val) -} - -func (any *arrayAny) GetInterface() interface{} { - return any.val.Interface() -} diff --git a/vendor/github.com/json-iterator/go/any_bool.go b/vendor/github.com/json-iterator/go/any_bool.go deleted file mode 100644 index 9452324af..000000000 --- a/vendor/github.com/json-iterator/go/any_bool.go +++ /dev/null @@ -1,137 +0,0 @@ -package jsoniter - -type trueAny struct { - baseAny -} - -func (any *trueAny) LastError() error { - return nil -} - -func (any *trueAny) ToBool() bool { - return true -} - -func (any *trueAny) ToInt() int { - return 1 -} - -func (any *trueAny) ToInt32() int32 { - return 1 -} - -func (any *trueAny) ToInt64() int64 { - return 1 -} - -func (any *trueAny) ToUint() uint { - return 1 -} - -func (any *trueAny) ToUint32() uint32 { - return 1 -} - -func (any *trueAny) ToUint64() uint64 { - return 1 -} - -func (any *trueAny) ToFloat32() float32 { - return 1 -} - -func (any *trueAny) ToFloat64() float64 { - return 1 -} - -func (any *trueAny) ToString() string { - return "true" -} - -func (any *trueAny) WriteTo(stream *Stream) { - stream.WriteTrue() -} - -func (any *trueAny) Parse() *Iterator { - return nil -} - -func (any *trueAny) GetInterface() interface{} { - return true -} - -func (any *trueAny) ValueType() ValueType { - return BoolValue -} - -func (any *trueAny) MustBeValid() Any { - return any -} - -type falseAny struct { - baseAny -} - -func (any *falseAny) LastError() error { - return nil -} - -func (any *falseAny) ToBool() bool { - return false -} - -func (any *falseAny) ToInt() int { - return 0 -} - -func (any *falseAny) ToInt32() int32 { - return 0 -} - -func (any *falseAny) ToInt64() int64 { - return 0 -} - -func (any *falseAny) ToUint() uint { - return 0 -} - -func (any *falseAny) ToUint32() uint32 { - return 0 -} - -func (any *falseAny) ToUint64() uint64 { - return 0 -} - -func (any *falseAny) ToFloat32() float32 { - return 0 -} - -func (any *falseAny) ToFloat64() float64 { - return 0 -} - -func (any *falseAny) ToString() string { - return "false" -} - -func (any *falseAny) WriteTo(stream *Stream) { - stream.WriteFalse() -} - -func (any *falseAny) Parse() *Iterator { - return nil -} - -func (any *falseAny) GetInterface() interface{} { - return false -} - -func (any *falseAny) ValueType() ValueType { - return BoolValue -} - -func (any *falseAny) MustBeValid() Any { - return any -} diff --git a/vendor/github.com/json-iterator/go/any_float.go b/vendor/github.com/json-iterator/go/any_float.go deleted file mode 100644 index 35fdb0949..000000000 --- a/vendor/github.com/json-iterator/go/any_float.go +++ /dev/null @@ -1,83 +0,0 @@ -package jsoniter - -import ( - "strconv" -) - -type floatAny struct { - baseAny - val float64 -} - -func (any *floatAny) Parse() *Iterator { - return nil -} - -func (any *floatAny) ValueType() ValueType { - return NumberValue -} - -func (any *floatAny) MustBeValid() Any { - return any -} - -func (any *floatAny) LastError() error { - return nil -} - -func (any *floatAny) ToBool() bool { - return any.ToFloat64() != 0 -} - -func (any *floatAny) ToInt() int { - return int(any.val) -} - -func (any *floatAny) ToInt32() int32 { - return int32(any.val) -} - -func (any *floatAny) ToInt64() int64 { - return int64(any.val) -} - -func (any *floatAny) ToUint() uint { - if any.val > 0 { - return uint(any.val) - } - return 0 -} - -func (any *floatAny) ToUint32() uint32 { - if any.val > 0 { - return uint32(any.val) - } - return 0 -} - -func (any *floatAny) ToUint64() uint64 { - if any.val > 0 { - return uint64(any.val) - } - return 0 -} - -func (any *floatAny) ToFloat32() float32 { - return float32(any.val) -} - -func (any *floatAny) ToFloat64() float64 { - return any.val -} - -func (any *floatAny) ToString() string { - return strconv.FormatFloat(any.val, 'E', -1, 64) -} - -func (any *floatAny) WriteTo(stream *Stream) { - stream.WriteFloat64(any.val) -} - -func (any *floatAny) GetInterface() interface{} { - return any.val -} diff --git a/vendor/github.com/json-iterator/go/any_int32.go b/vendor/github.com/json-iterator/go/any_int32.go deleted file mode 100644 index 1b56f3991..000000000 --- a/vendor/github.com/json-iterator/go/any_int32.go +++ /dev/null @@ -1,74 +0,0 @@ -package jsoniter - -import ( - "strconv" -) - -type int32Any struct { - baseAny - val int32 -} - -func (any *int32Any) LastError() error { - return nil -} - -func (any *int32Any) ValueType() ValueType { - return NumberValue -} - -func (any *int32Any) MustBeValid() Any { - return any -} - -func (any *int32Any) ToBool() bool { - return any.val != 0 -} - -func (any *int32Any) ToInt() int { - return int(any.val) -} - -func (any *int32Any) ToInt32() int32 { - return any.val -} - -func (any *int32Any) ToInt64() int64 { - return int64(any.val) -} - -func (any *int32Any) ToUint() uint { - return uint(any.val) -} - -func (any *int32Any) ToUint32() uint32 { - return uint32(any.val) -} - -func (any *int32Any) ToUint64() uint64 { - return uint64(any.val) -} - -func (any *int32Any) ToFloat32() float32 { - return float32(any.val) -} - -func (any *int32Any) ToFloat64() float64 { - return float64(any.val) -} - -func (any *int32Any) ToString() string { - return strconv.FormatInt(int64(any.val), 10) -} - -func (any *int32Any) WriteTo(stream *Stream) { - stream.WriteInt32(any.val) -} - -func (any *int32Any) Parse() *Iterator { - return nil -} - -func (any *int32Any) GetInterface() interface{} { - return any.val -} diff --git a/vendor/github.com/json-iterator/go/any_int64.go b/vendor/github.com/json-iterator/go/any_int64.go deleted file mode 100644 index c440d72b6..000000000 --- a/vendor/github.com/json-iterator/go/any_int64.go +++ /dev/null @@ -1,74 +0,0 @@ -package jsoniter - -import ( - "strconv" -) - -type int64Any struct { - baseAny - val int64 -} - -func (any *int64Any) LastError() error { - return nil -} - -func (any *int64Any) ValueType() ValueType { - return NumberValue -} - -func (any *int64Any) MustBeValid() Any { - return any -} - -func (any *int64Any) ToBool() bool { - return any.val != 0 -} - -func (any *int64Any) ToInt() int { - return int(any.val) -} - -func (any *int64Any) ToInt32() int32 { - return int32(any.val) -} - -func (any *int64Any) ToInt64() int64 { - return any.val -} - -func (any *int64Any) ToUint() uint { - return uint(any.val) -} - -func (any *int64Any) ToUint32() uint32 { - return uint32(any.val) -} - -func (any *int64Any) ToUint64() uint64 { - return uint64(any.val) -} - -func (any *int64Any) ToFloat32() float32 { - return float32(any.val) -} - -func (any *int64Any) ToFloat64() float64 { - return float64(any.val) -} - -func (any *int64Any) ToString() string { - return strconv.FormatInt(any.val, 10) -} - -func (any *int64Any) WriteTo(stream *Stream) { - stream.WriteInt64(any.val) -} - -func (any *int64Any) Parse() *Iterator { - return nil -} - -func (any *int64Any) GetInterface() interface{} { - return any.val -} diff --git a/vendor/github.com/json-iterator/go/any_invalid.go b/vendor/github.com/json-iterator/go/any_invalid.go deleted file mode 100644 index 1d859eac3..000000000 --- a/vendor/github.com/json-iterator/go/any_invalid.go +++ /dev/null @@ -1,82 +0,0 @@ -package jsoniter - -import "fmt" - -type invalidAny struct { - baseAny - err error -} - -func newInvalidAny(path []interface{}) *invalidAny { - return &invalidAny{baseAny{}, fmt.Errorf("%v not found", path)} -} - -func (any *invalidAny) LastError() error { - return any.err -} - -func (any *invalidAny) ValueType() ValueType { - return InvalidValue -} - -func (any *invalidAny) MustBeValid() Any { - panic(any.err) -} - -func (any *invalidAny) ToBool() bool { - return false -} - -func (any *invalidAny) ToInt() int { - return 0 -} - -func (any *invalidAny) ToInt32() int32 { - return 0 -} - -func (any *invalidAny) ToInt64() int64 { - return 0 -} - -func (any *invalidAny) ToUint() uint { - return 0 -} - -func (any *invalidAny) ToUint32() uint32 { - return 0 -} - -func (any *invalidAny) ToUint64() uint64 { - return 0 -} - -func (any *invalidAny) ToFloat32() float32 { - return 0 -} - -func (any *invalidAny) ToFloat64() float64 { - return 0 -} - -func (any *invalidAny) ToString() string { - return "" -} - -func (any *invalidAny) WriteTo(stream *Stream) { -} - -func (any *invalidAny) Get(path ...interface{}) Any { - if any.err == nil { - return &invalidAny{baseAny{}, fmt.Errorf("get %v from invalid", path)} - } - return &invalidAny{baseAny{}, fmt.Errorf("%v, get %v from invalid", any.err, path)} -} - -func (any *invalidAny) Parse() *Iterator { - return nil -} - -func (any *invalidAny) GetInterface() interface{} { - return nil -} diff --git a/vendor/github.com/json-iterator/go/any_nil.go b/vendor/github.com/json-iterator/go/any_nil.go deleted file mode 100644 index d04cb54c1..000000000 --- a/vendor/github.com/json-iterator/go/any_nil.go +++ /dev/null @@ -1,69 +0,0 @@ -package jsoniter - -type nilAny struct { - baseAny -} - -func (any *nilAny) LastError() error { - return nil -} - -func (any *nilAny) ValueType() ValueType { - return NilValue -} - -func (any *nilAny) MustBeValid() Any { - return any -} - -func (any *nilAny) ToBool() bool { - return false -} - -func (any *nilAny) ToInt() int { - return 0 -} - -func (any *nilAny) ToInt32() int32 { - return 0 -} - -func (any *nilAny) ToInt64() int64 { - return 0 -} - -func (any *nilAny) ToUint() uint { - return 0 -} - -func (any *nilAny) ToUint32() uint32 { - return 0 -} - -func (any *nilAny) ToUint64() uint64 { - return 0 -} - -func (any *nilAny) ToFloat32() float32 { - return 0 -} - -func (any *nilAny) ToFloat64() float64 { - return 0 -} - -func (any *nilAny) ToString() string { - return "" -} - -func (any *nilAny) WriteTo(stream *Stream) { - stream.WriteNil() -} - -func (any *nilAny) Parse() *Iterator { - return nil -} - -func (any *nilAny) GetInterface() interface{} { - return nil -} diff --git a/vendor/github.com/json-iterator/go/any_number.go b/vendor/github.com/json-iterator/go/any_number.go deleted file mode 100644 index 9d1e901a6..000000000 --- a/vendor/github.com/json-iterator/go/any_number.go +++ /dev/null @@ -1,123 +0,0 @@ -package jsoniter - -import ( - "io" - "unsafe" -) - -type numberLazyAny struct { - baseAny - cfg *frozenConfig - buf []byte - err error -} - -func (any *numberLazyAny) ValueType() ValueType { - return NumberValue -} - -func (any *numberLazyAny) MustBeValid() Any { - return any -} - -func (any *numberLazyAny) LastError() error { - return any.err -} - -func (any *numberLazyAny) ToBool() bool { - return any.ToFloat64() != 0 -} - -func (any *numberLazyAny) ToInt() int { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - val := iter.ReadInt() - if iter.Error != nil && iter.Error != io.EOF { - any.err = iter.Error - } - return val -} - -func (any *numberLazyAny) ToInt32() int32 { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - val := iter.ReadInt32() - if iter.Error != nil && iter.Error != io.EOF { - any.err = iter.Error - } - return val -} - -func (any *numberLazyAny) ToInt64() int64 { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - val := iter.ReadInt64() - if iter.Error != nil && iter.Error != io.EOF { - any.err = iter.Error - } - return val -} - -func (any *numberLazyAny) ToUint() uint { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - val := iter.ReadUint() - if iter.Error != nil && iter.Error != io.EOF { - any.err = iter.Error - } - return val -} - -func (any *numberLazyAny) ToUint32() uint32 { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - val := iter.ReadUint32() - if iter.Error != nil && iter.Error != io.EOF { - any.err = iter.Error - } - return val -} - -func (any *numberLazyAny) ToUint64() uint64 { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - val := iter.ReadUint64() - if iter.Error != nil && iter.Error != io.EOF { - any.err = iter.Error - } - return val -} - -func (any *numberLazyAny) ToFloat32() float32 { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - val := iter.ReadFloat32() - if iter.Error != nil && iter.Error != io.EOF { - any.err = iter.Error - } - return val -} - -func (any *numberLazyAny) ToFloat64() float64 { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - val := iter.ReadFloat64() - if iter.Error != nil && iter.Error != io.EOF { - any.err = iter.Error - } - return val -} - -func (any *numberLazyAny) ToString() string { - return *(*string)(unsafe.Pointer(&any.buf)) -} - -func (any *numberLazyAny) WriteTo(stream *Stream) { - stream.Write(any.buf) -} - -func (any *numberLazyAny) GetInterface() interface{} { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - return iter.Read() -} diff --git a/vendor/github.com/json-iterator/go/any_object.go b/vendor/github.com/json-iterator/go/any_object.go deleted file mode 100644 index c44ef5c98..000000000 --- a/vendor/github.com/json-iterator/go/any_object.go +++ /dev/null @@ -1,374 +0,0 @@ -package jsoniter - -import ( - "reflect" - "unsafe" -) - -type objectLazyAny struct { - baseAny - cfg *frozenConfig - buf []byte - err error -} - -func (any *objectLazyAny) ValueType() ValueType { - return ObjectValue -} - -func (any *objectLazyAny) MustBeValid() Any { - return any -} - -func (any *objectLazyAny) LastError() error { - return any.err -} - -func (any *objectLazyAny) ToBool() bool { - return true -} - -func (any *objectLazyAny) ToInt() int { - return 0 -} - -func (any *objectLazyAny) ToInt32() int32 { - return 0 -} - -func (any *objectLazyAny) ToInt64() int64 { - return 0 -} - -func (any *objectLazyAny) ToUint() uint { - return 0 -} - -func (any *objectLazyAny) ToUint32() uint32 { - return 0 -} - -func (any *objectLazyAny) ToUint64() uint64 { - return 0 -} - -func (any *objectLazyAny) ToFloat32() float32 { - return 0 -} - -func (any *objectLazyAny) ToFloat64() float64 { - return 0 -} - -func (any *objectLazyAny) ToString() string { - return *(*string)(unsafe.Pointer(&any.buf)) -} - -func (any *objectLazyAny) ToVal(obj interface{}) { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - iter.ReadVal(obj) -} - -func (any *objectLazyAny) Get(path ...interface{}) Any { - if len(path) == 0 { - return any - } - switch firstPath := path[0].(type) { - case string: - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - valueBytes := locateObjectField(iter, firstPath) - if valueBytes == nil { - return newInvalidAny(path) - } - iter.ResetBytes(valueBytes) - return locatePath(iter, path[1:]) - case int32: - if '*' == firstPath { - mappedAll := map[string]Any{} - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - iter.ReadMapCB(func(iter *Iterator, field string) bool { - mapped := locatePath(iter, path[1:]) - if mapped.ValueType() != InvalidValue { - mappedAll[field] = mapped - } - return true - }) - return wrapMap(mappedAll) - } - return newInvalidAny(path) - default: - return newInvalidAny(path) - } -} - -func (any *objectLazyAny) Keys() []string { - keys := []string{} - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - iter.ReadMapCB(func(iter *Iterator, field string) bool { - iter.Skip() - keys = append(keys, field) - return true - }) - return keys -} - -func (any *objectLazyAny) Size() int { - size := 0 - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - iter.ReadObjectCB(func(iter *Iterator, field string) bool { - iter.Skip() - size++ - return true - }) - return size -} - -func (any *objectLazyAny) WriteTo(stream *Stream) { - stream.Write(any.buf) -} - -func (any *objectLazyAny) GetInterface() interface{} { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - return iter.Read() -} - -type objectAny struct { - baseAny - err error - val reflect.Value -} - -func wrapStruct(val interface{}) *objectAny { - return &objectAny{baseAny{}, nil, reflect.ValueOf(val)} -} - -func (any *objectAny) ValueType() ValueType { - return ObjectValue -} - -func (any *objectAny) MustBeValid() Any { - return any -} - -func (any *objectAny) Parse() *Iterator { - return nil -} - -func (any *objectAny) LastError() error { - return any.err -} - -func (any *objectAny) ToBool() bool { - return any.val.NumField() != 0 -} - -func (any *objectAny) ToInt() int { - return 0 -} - -func (any *objectAny) ToInt32() int32 { - return 0 -} - -func (any *objectAny) ToInt64() int64 { - return 0 -} - -func (any *objectAny) ToUint() uint { - return 0 -} - -func (any *objectAny) ToUint32() uint32 { - return 0 -} - -func (any *objectAny) ToUint64() uint64 { - return 0 -} - -func (any *objectAny) ToFloat32() float32 { - return 0 -} - -func (any *objectAny) ToFloat64() float64 { - return 0 -} - -func (any *objectAny) ToString() string { - str, err := MarshalToString(any.val.Interface()) - any.err = err - return str -} - -func (any *objectAny) Get(path ...interface{}) Any { - if len(path) == 0 { - return any - } - switch firstPath := path[0].(type) { - case string: - field := any.val.FieldByName(firstPath) - if !field.IsValid() { - return newInvalidAny(path) - } - return Wrap(field.Interface()) - case int32: - if '*' == firstPath { - mappedAll := map[string]Any{} - for i := 0; i < any.val.NumField(); i++ { - field := any.val.Field(i) - if field.CanInterface() { - mapped := Wrap(field.Interface()).Get(path[1:]...) - if mapped.ValueType() != InvalidValue { - mappedAll[any.val.Type().Field(i).Name] = mapped - } - } - } - return wrapMap(mappedAll) - } - return newInvalidAny(path) - default: - return newInvalidAny(path) - } -} - -func (any *objectAny) Keys() []string { - keys := make([]string, 0, any.val.NumField()) - for i := 0; i < any.val.NumField(); i++ { - keys = append(keys, any.val.Type().Field(i).Name) - } - return keys -} - -func (any *objectAny) Size() int { - return any.val.NumField() -} - -func (any *objectAny) WriteTo(stream *Stream) { - stream.WriteVal(any.val) -} - -func (any *objectAny) GetInterface() interface{} { - return any.val.Interface() -} - -type mapAny struct { - baseAny - err error - val reflect.Value -} - -func wrapMap(val interface{}) *mapAny { - return &mapAny{baseAny{}, nil, reflect.ValueOf(val)} -} - -func (any *mapAny) ValueType() ValueType { - return ObjectValue -} - -func (any *mapAny) MustBeValid() Any { - return any -} - -func (any *mapAny) Parse() *Iterator { - return nil -} - -func (any *mapAny) LastError() error { - return any.err -} - -func (any *mapAny) ToBool() bool { - return true -} - -func (any *mapAny) ToInt() int { - return 0 -} - -func (any *mapAny) ToInt32() int32 { - return 0 -} - -func (any *mapAny) ToInt64() int64 { - return 0 -} - -func (any *mapAny) ToUint() uint { - return 0 -} - -func (any *mapAny) ToUint32() uint32 { - return 0 -} - -func (any *mapAny) ToUint64() uint64 { - return 0 -} - -func (any *mapAny) ToFloat32() float32 { - return 0 -} - -func (any *mapAny) ToFloat64() float64 { - return 0 -} - -func (any *mapAny) ToString() string { - str, err := MarshalToString(any.val.Interface()) - any.err = err - return str -} - -func (any *mapAny) Get(path ...interface{}) Any { - if len(path) == 0 { - return any - } - switch firstPath := path[0].(type) { - case int32: - if '*' == firstPath { - mappedAll := map[string]Any{} - for _, key := range any.val.MapKeys() { - keyAsStr := key.String() - element := Wrap(any.val.MapIndex(key).Interface()) - mapped := element.Get(path[1:]...) - if mapped.ValueType() != InvalidValue { - mappedAll[keyAsStr] = mapped - } - } - return wrapMap(mappedAll) - } - return newInvalidAny(path) - default: - value := any.val.MapIndex(reflect.ValueOf(firstPath)) - if !value.IsValid() { - return newInvalidAny(path) - } - return Wrap(value.Interface()) - } -} - -func (any *mapAny) Keys() []string { - keys := make([]string, 0, any.val.Len()) - for _, key := range any.val.MapKeys() { - keys = append(keys, key.String()) - } - return keys -} - -func (any *mapAny) Size() int { - return any.val.Len() -} - -func (any *mapAny) WriteTo(stream *Stream) { - stream.WriteVal(any.val) -} - -func (any *mapAny) GetInterface() interface{} { - return any.val.Interface() -} diff --git a/vendor/github.com/json-iterator/go/any_str.go b/vendor/github.com/json-iterator/go/any_str.go deleted file mode 100644 index 1f12f6612..000000000 --- a/vendor/github.com/json-iterator/go/any_str.go +++ /dev/null @@ -1,166 +0,0 @@ -package jsoniter - -import ( - "fmt" - "strconv" -) - -type stringAny struct { - baseAny - val string -} - -func (any *stringAny) Get(path ...interface{}) Any { - if len(path) == 0 { - return any - } - return &invalidAny{baseAny{}, fmt.Errorf("GetIndex %v from simple value", path)} -} - -func (any *stringAny) Parse() *Iterator { - return nil -} - -func (any *stringAny) ValueType() ValueType { - return StringValue -} - -func (any *stringAny) MustBeValid() Any { - return any -} - -func (any *stringAny) LastError() error { - return nil -} - -func (any *stringAny) ToBool() bool { - str := any.ToString() - if str == "0" { - return false - } - for _, c := range str { - switch c { - case ' ', '\n', '\r', '\t': - default: - return true - } - } - return false -} - -func (any *stringAny) ToInt() int { - return int(any.ToInt64()) - -} - -func (any *stringAny) ToInt32() int32 { - return int32(any.ToInt64()) -} - -func (any *stringAny) ToInt64() int64 { - if any.val == "" { - return 0 - } - - flag := 1 - startPos := 0 - if any.val[0] == '+' || any.val[0] == '-' { - startPos = 1 - } - - if any.val[0] == '-' { - flag = -1 - } - - endPos := startPos - for i := startPos; i < len(any.val); i++ { - if any.val[i] >= '0' && any.val[i] <= '9' { - endPos = i + 1 - } else { - break - } - } - parsed, _ := strconv.ParseInt(any.val[startPos:endPos], 10, 64) - return int64(flag) * parsed -} - -func (any *stringAny) ToUint() uint { - return uint(any.ToUint64()) -} - -func (any *stringAny) ToUint32() uint32 { - return uint32(any.ToUint64()) -} - -func (any *stringAny) ToUint64() uint64 { - if any.val == "" { - return 0 - } - - startPos := 0 - - if any.val[0] == '-' { - return 0 - } - if any.val[0] == '+' { - startPos = 1 - } - - endPos := startPos - for i := startPos; i < len(any.val); i++ { - if any.val[i] >= '0' && any.val[i] <= '9' { - endPos = i + 1 - } else { - break - } - } - parsed, _ := strconv.ParseUint(any.val[startPos:endPos], 10, 64) - return parsed -} - -func (any *stringAny) ToFloat32() float32 { - return float32(any.ToFloat64()) -} - -func (any *stringAny) ToFloat64() float64 { - if len(any.val) == 0 { - return 0 - } - - // first char invalid - if any.val[0] != '+' && any.val[0] != '-' && (any.val[0] > '9' || any.val[0] < '0') { - return 0 - } - - // extract valid num expression from string - // eg 123true => 123, -12.12xxa => -12.12 - endPos := 1 - for i := 1; i < len(any.val); i++ { - if any.val[i] == '.' || any.val[i] == 'e' || any.val[i] == 'E' || any.val[i] == '+' || any.val[i] == '-' { - endPos = i + 1 - continue - } - - // end position is the first char which is not digit - if any.val[i] >= '0' && any.val[i] <= '9' { - endPos = i + 1 - } else { - endPos = i - break - } - } - parsed, _ := strconv.ParseFloat(any.val[:endPos], 64) - return parsed -} - -func (any *stringAny) ToString() string { - return any.val -} - -func (any *stringAny) WriteTo(stream *Stream) { - stream.WriteString(any.val) -} - -func (any *stringAny) GetInterface() interface{} { - return any.val -} diff --git a/vendor/github.com/json-iterator/go/any_uint32.go b/vendor/github.com/json-iterator/go/any_uint32.go deleted file mode 100644 index 656bbd33d..000000000 --- a/vendor/github.com/json-iterator/go/any_uint32.go +++ /dev/null @@ -1,74 +0,0 @@ -package jsoniter - -import ( - "strconv" -) - -type uint32Any struct { - baseAny - val uint32 -} - -func (any *uint32Any) LastError() error { - return nil -} - -func (any *uint32Any) ValueType() ValueType { - return NumberValue -} - -func (any *uint32Any) MustBeValid() Any { - return any -} - -func (any *uint32Any) ToBool() bool { - return any.val != 0 -} - -func (any *uint32Any) ToInt() int { - return int(any.val) -} - -func (any *uint32Any) ToInt32() int32 { - return int32(any.val) -} - -func (any *uint32Any) ToInt64() int64 { - return int64(any.val) -} - -func (any *uint32Any) ToUint() uint { - return uint(any.val) -} - -func (any *uint32Any) ToUint32() uint32 { - return any.val -} - -func (any *uint32Any) ToUint64() uint64 { - return uint64(any.val) -} - -func (any *uint32Any) ToFloat32() float32 { - return float32(any.val) -} - -func (any *uint32Any) ToFloat64() float64 { - return float64(any.val) -} - -func (any *uint32Any) ToString() string { - return strconv.FormatInt(int64(any.val), 10) -} - -func (any *uint32Any) WriteTo(stream *Stream) { - stream.WriteUint32(any.val) -} - -func (any *uint32Any) Parse() *Iterator { - return nil -} - -func (any *uint32Any) GetInterface() interface{} { - return any.val -} diff --git a/vendor/github.com/json-iterator/go/any_uint64.go b/vendor/github.com/json-iterator/go/any_uint64.go deleted file mode 100644 index 7df2fce33..000000000 --- a/vendor/github.com/json-iterator/go/any_uint64.go +++ /dev/null @@ -1,74 +0,0 @@ -package jsoniter - -import ( - "strconv" -) - -type uint64Any struct { - baseAny - val uint64 -} - -func (any *uint64Any) LastError() error { - return nil -} - -func (any *uint64Any) ValueType() ValueType { - return NumberValue -} - -func (any *uint64Any) MustBeValid() Any { - return any -} - -func (any *uint64Any) ToBool() bool { - return any.val != 0 -} - -func (any *uint64Any) ToInt() int { - return int(any.val) -} - -func (any *uint64Any) ToInt32() int32 { - return int32(any.val) -} - -func (any *uint64Any) ToInt64() int64 { - return int64(any.val) -} - -func (any *uint64Any) ToUint() uint { - return uint(any.val) -} - -func (any *uint64Any) ToUint32() uint32 { - return uint32(any.val) -} - -func (any *uint64Any) ToUint64() uint64 { - return any.val -} - -func (any *uint64Any) ToFloat32() float32 { - return float32(any.val) -} - -func (any *uint64Any) ToFloat64() float64 { - return float64(any.val) -} - -func (any *uint64Any) ToString() string { - return strconv.FormatUint(any.val, 10) -} - -func (any *uint64Any) WriteTo(stream *Stream) { - stream.WriteUint64(any.val) -} - -func (any *uint64Any) Parse() *Iterator { - return nil -} - -func (any *uint64Any) GetInterface() interface{} { - return any.val -} diff --git a/vendor/github.com/json-iterator/go/build.sh b/vendor/github.com/json-iterator/go/build.sh deleted file mode 100644 index b45ef6883..000000000 --- a/vendor/github.com/json-iterator/go/build.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -set -e -set -x - -if [ ! -d /tmp/build-golang/src/github.com/json-iterator ]; then - mkdir -p /tmp/build-golang/src/github.com/json-iterator - ln -s $PWD /tmp/build-golang/src/github.com/json-iterator/go -fi -export GOPATH=/tmp/build-golang -go get -u github.com/golang/dep/cmd/dep -cd /tmp/build-golang/src/github.com/json-iterator/go -exec $GOPATH/bin/dep ensure -update diff --git a/vendor/github.com/json-iterator/go/config.go b/vendor/github.com/json-iterator/go/config.go deleted file mode 100644 index 2adcdc3b7..000000000 --- a/vendor/github.com/json-iterator/go/config.go +++ /dev/null @@ -1,375 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "io" - "reflect" - "sync" - "unsafe" - - "github.com/modern-go/concurrent" - "github.com/modern-go/reflect2" -) - -// Config customize how the API should behave. -// The API is created from Config by Froze. -type Config struct { - IndentionStep int - MarshalFloatWith6Digits bool - EscapeHTML bool - SortMapKeys bool - UseNumber bool - DisallowUnknownFields bool - TagKey string - OnlyTaggedField bool - ValidateJsonRawMessage bool - ObjectFieldMustBeSimpleString bool - CaseSensitive bool -} - -// API the public interface of this package. -// Primary Marshal and Unmarshal. -type API interface { - IteratorPool - StreamPool - MarshalToString(v interface{}) (string, error) - Marshal(v interface{}) ([]byte, error) - MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) - UnmarshalFromString(str string, v interface{}) error - Unmarshal(data []byte, v interface{}) error - Get(data []byte, path ...interface{}) Any - NewEncoder(writer io.Writer) *Encoder - NewDecoder(reader io.Reader) *Decoder - Valid(data []byte) bool - RegisterExtension(extension Extension) - DecoderOf(typ reflect2.Type) ValDecoder - EncoderOf(typ reflect2.Type) ValEncoder -} - -// ConfigDefault the default API -var ConfigDefault = Config{ - EscapeHTML: true, -}.Froze() - -// ConfigCompatibleWithStandardLibrary tries to be 100% compatible with standard library behavior -var ConfigCompatibleWithStandardLibrary = Config{ - EscapeHTML: true, - SortMapKeys: true, - ValidateJsonRawMessage: true, -}.Froze() - -// ConfigFastest marshals float with only 6 digits precision -var ConfigFastest = Config{ - EscapeHTML: false, - MarshalFloatWith6Digits: true, // will lose precession - ObjectFieldMustBeSimpleString: true, // do not unescape object field -}.Froze() - -type frozenConfig struct { - configBeforeFrozen Config - sortMapKeys bool - indentionStep int - objectFieldMustBeSimpleString bool - onlyTaggedField bool - disallowUnknownFields bool - decoderCache *concurrent.Map - encoderCache *concurrent.Map - encoderExtension Extension - decoderExtension Extension - extraExtensions []Extension - streamPool *sync.Pool - iteratorPool *sync.Pool - caseSensitive bool -} - -func (cfg *frozenConfig) initCache() { - cfg.decoderCache = concurrent.NewMap() - cfg.encoderCache = concurrent.NewMap() -} - -func (cfg *frozenConfig) addDecoderToCache(cacheKey uintptr, decoder ValDecoder) { - cfg.decoderCache.Store(cacheKey, decoder) -} - -func (cfg *frozenConfig) addEncoderToCache(cacheKey uintptr, encoder ValEncoder) { - cfg.encoderCache.Store(cacheKey, encoder) -} - -func (cfg *frozenConfig) getDecoderFromCache(cacheKey uintptr) ValDecoder { - decoder, found := cfg.decoderCache.Load(cacheKey) - if found { - return decoder.(ValDecoder) - } - return nil -} - -func (cfg *frozenConfig) getEncoderFromCache(cacheKey uintptr) ValEncoder { - encoder, found := cfg.encoderCache.Load(cacheKey) - if found { - return encoder.(ValEncoder) - } - return nil -} - -var cfgCache = concurrent.NewMap() - -func getFrozenConfigFromCache(cfg Config) *frozenConfig { - obj, found := cfgCache.Load(cfg) - if found { - return obj.(*frozenConfig) - } - return nil -} - -func addFrozenConfigToCache(cfg Config, frozenConfig *frozenConfig) { - cfgCache.Store(cfg, frozenConfig) -} - -// Froze forge API from config -func (cfg Config) Froze() API { - api := &frozenConfig{ - sortMapKeys: cfg.SortMapKeys, - indentionStep: cfg.IndentionStep, - objectFieldMustBeSimpleString: cfg.ObjectFieldMustBeSimpleString, - onlyTaggedField: cfg.OnlyTaggedField, - disallowUnknownFields: cfg.DisallowUnknownFields, - caseSensitive: cfg.CaseSensitive, - } - api.streamPool = &sync.Pool{ - New: func() interface{} { - return NewStream(api, nil, 512) - }, - } - api.iteratorPool = &sync.Pool{ - New: func() interface{} { - return NewIterator(api) - }, - } - api.initCache() - encoderExtension := EncoderExtension{} - decoderExtension := DecoderExtension{} - if cfg.MarshalFloatWith6Digits { - api.marshalFloatWith6Digits(encoderExtension) - } - if cfg.EscapeHTML { - api.escapeHTML(encoderExtension) - } - if cfg.UseNumber { - api.useNumber(decoderExtension) - } - if cfg.ValidateJsonRawMessage { - api.validateJsonRawMessage(encoderExtension) - } - api.encoderExtension = encoderExtension - api.decoderExtension = decoderExtension - api.configBeforeFrozen = cfg - return api -} - -func (cfg Config) frozeWithCacheReuse(extraExtensions []Extension) *frozenConfig { - api := getFrozenConfigFromCache(cfg) - if api != nil { - return api - } - api = cfg.Froze().(*frozenConfig) - for _, extension := range extraExtensions { - api.RegisterExtension(extension) - } - addFrozenConfigToCache(cfg, api) - return api -} - -func (cfg *frozenConfig) validateJsonRawMessage(extension EncoderExtension) { - encoder := &funcEncoder{func(ptr unsafe.Pointer, stream *Stream) { - rawMessage := *(*json.RawMessage)(ptr) - iter := cfg.BorrowIterator([]byte(rawMessage)) - defer cfg.ReturnIterator(iter) - iter.Read() - if iter.Error != nil && iter.Error != io.EOF { - stream.WriteRaw("null") - } else { - stream.WriteRaw(string(rawMessage)) - } - }, func(ptr unsafe.Pointer) bool { - return len(*((*json.RawMessage)(ptr))) == 0 - }} - extension[reflect2.TypeOfPtr((*json.RawMessage)(nil)).Elem()] = encoder - extension[reflect2.TypeOfPtr((*RawMessage)(nil)).Elem()] = encoder -} - -func (cfg *frozenConfig) useNumber(extension DecoderExtension) { - extension[reflect2.TypeOfPtr((*interface{})(nil)).Elem()] = &funcDecoder{func(ptr unsafe.Pointer, iter *Iterator) { - exitingValue := *((*interface{})(ptr)) - if exitingValue != nil && reflect.TypeOf(exitingValue).Kind() == reflect.Ptr { - iter.ReadVal(exitingValue) - return - } - if iter.WhatIsNext() == NumberValue { - *((*interface{})(ptr)) = json.Number(iter.readNumberAsString()) - } else { - *((*interface{})(ptr)) = iter.Read() - } - }} -} -func (cfg *frozenConfig) getTagKey() string { - tagKey := cfg.configBeforeFrozen.TagKey - if tagKey == "" { - return "json" - } - return tagKey -} - -func (cfg *frozenConfig) RegisterExtension(extension Extension) { - cfg.extraExtensions = append(cfg.extraExtensions, extension) - copied := cfg.configBeforeFrozen - cfg.configBeforeFrozen = copied -} - -type lossyFloat32Encoder struct { -} - -func (encoder *lossyFloat32Encoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteFloat32Lossy(*((*float32)(ptr))) -} - -func (encoder *lossyFloat32Encoder) IsEmpty(ptr unsafe.Pointer) bool { - return *((*float32)(ptr)) == 0 -} - -type lossyFloat64Encoder struct { -} - -func (encoder *lossyFloat64Encoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteFloat64Lossy(*((*float64)(ptr))) -} - -func (encoder *lossyFloat64Encoder) IsEmpty(ptr unsafe.Pointer) bool { - return *((*float64)(ptr)) == 0 -} - -// EnableLossyFloatMarshalling keeps 10**(-6) precision -// for float variables for better performance. -func (cfg *frozenConfig) marshalFloatWith6Digits(extension EncoderExtension) { - // for better performance - extension[reflect2.TypeOfPtr((*float32)(nil)).Elem()] = &lossyFloat32Encoder{} - extension[reflect2.TypeOfPtr((*float64)(nil)).Elem()] = &lossyFloat64Encoder{} -} - -type htmlEscapedStringEncoder struct { -} - -func (encoder *htmlEscapedStringEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - str := *((*string)(ptr)) - stream.WriteStringWithHTMLEscaped(str) -} - -func (encoder *htmlEscapedStringEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return *((*string)(ptr)) == "" -} - -func (cfg *frozenConfig) escapeHTML(encoderExtension EncoderExtension) { - encoderExtension[reflect2.TypeOfPtr((*string)(nil)).Elem()] = &htmlEscapedStringEncoder{} -} - -func (cfg *frozenConfig) cleanDecoders() { - typeDecoders = map[string]ValDecoder{} - fieldDecoders = map[string]ValDecoder{} - *cfg = *(cfg.configBeforeFrozen.Froze().(*frozenConfig)) -} - -func (cfg *frozenConfig) cleanEncoders() { - typeEncoders = map[string]ValEncoder{} - fieldEncoders = map[string]ValEncoder{} - *cfg = *(cfg.configBeforeFrozen.Froze().(*frozenConfig)) -} - -func (cfg *frozenConfig) MarshalToString(v interface{}) (string, error) { - stream := cfg.BorrowStream(nil) - defer cfg.ReturnStream(stream) - stream.WriteVal(v) - if stream.Error != nil { - return "", stream.Error - } - return string(stream.Buffer()), nil -} - -func (cfg *frozenConfig) Marshal(v interface{}) ([]byte, error) { - stream := cfg.BorrowStream(nil) - defer cfg.ReturnStream(stream) - stream.WriteVal(v) - if stream.Error != nil { - return nil, stream.Error - } - result := stream.Buffer() - copied := make([]byte, len(result)) - copy(copied, result) - return copied, nil -} - -func (cfg *frozenConfig) MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) { - if prefix != "" { - panic("prefix is not supported") - } - for _, r := range indent { - if r != ' ' { - panic("indent can only be space") - } - } - newCfg := cfg.configBeforeFrozen - newCfg.IndentionStep = len(indent) - return newCfg.frozeWithCacheReuse(cfg.extraExtensions).Marshal(v) -} - -func (cfg *frozenConfig) UnmarshalFromString(str string, v interface{}) error { - data := []byte(str) - iter := cfg.BorrowIterator(data) - defer cfg.ReturnIterator(iter) - iter.ReadVal(v) - c := iter.nextToken() - if c == 0 { - if iter.Error == io.EOF { - return nil - } - return iter.Error - } - iter.ReportError("Unmarshal", "there are bytes left after unmarshal") - return iter.Error -} - -func (cfg *frozenConfig) Get(data []byte, path ...interface{}) Any { - iter := cfg.BorrowIterator(data) - defer cfg.ReturnIterator(iter) - return locatePath(iter, path) -} - -func (cfg *frozenConfig) Unmarshal(data []byte, v interface{}) error { - iter := cfg.BorrowIterator(data) - defer cfg.ReturnIterator(iter) - iter.ReadVal(v) - c := iter.nextToken() - if c == 0 { - if iter.Error == io.EOF { - return nil - } - return iter.Error - } - iter.ReportError("Unmarshal", "there are bytes left after unmarshal") - return iter.Error -} - -func (cfg *frozenConfig) NewEncoder(writer io.Writer) *Encoder { - stream := NewStream(cfg, writer, 512) - return &Encoder{stream} -} - -func (cfg *frozenConfig) NewDecoder(reader io.Reader) *Decoder { - iter := Parse(cfg, reader, 512) - return &Decoder{iter} -} - -func (cfg *frozenConfig) Valid(data []byte) bool { - iter := cfg.BorrowIterator(data) - defer cfg.ReturnIterator(iter) - iter.Skip() - return iter.Error == nil -} diff --git a/vendor/github.com/json-iterator/go/fuzzy_mode_convert_table.md b/vendor/github.com/json-iterator/go/fuzzy_mode_convert_table.md deleted file mode 100644 index 3095662b0..000000000 --- a/vendor/github.com/json-iterator/go/fuzzy_mode_convert_table.md +++ /dev/null @@ -1,7 +0,0 @@ -| json type \ dest type | bool | int | uint | float |string| -| --- | --- | --- | --- |--|--| -| number | positive => true
negative => true
zero => false| 23.2 => 23
-32.1 => -32| 12.1 => 12
-12.1 => 0|as normal|same as origin| -| string | empty string => false
string "0" => false
other strings => true | "123.32" => 123
"-123.4" => -123
"123.23xxxw" => 123
"abcde12" => 0
"-32.1" => -32| 13.2 => 13
-1.1 => 0 |12.1 => 12.1
-12.3 => -12.3
12.4xxa => 12.4
+1.1e2 =>110 |same as origin| -| bool | true => true
false => false| true => 1
false => 0 | true => 1
false => 0 |true => 1
false => 0|true => "true"
false => "false"| -| object | true | 0 | 0 |0|originnal json| -| array | empty array => false
nonempty array => true| [] => 0
[1,2] => 1 | [] => 0
[1,2] => 1 |[] => 0
[1,2] => 1|original json| \ No newline at end of file diff --git a/vendor/github.com/json-iterator/go/iter.go b/vendor/github.com/json-iterator/go/iter.go deleted file mode 100644 index 29b31cf78..000000000 --- a/vendor/github.com/json-iterator/go/iter.go +++ /dev/null @@ -1,349 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "fmt" - "io" -) - -// ValueType the type for JSON element -type ValueType int - -const ( - // InvalidValue invalid JSON element - InvalidValue ValueType = iota - // StringValue JSON element "string" - StringValue - // NumberValue JSON element 100 or 0.10 - NumberValue - // NilValue JSON element null - NilValue - // BoolValue JSON element true or false - BoolValue - // ArrayValue JSON element [] - ArrayValue - // ObjectValue JSON element {} - ObjectValue -) - -var hexDigits []byte -var valueTypes []ValueType - -func init() { - hexDigits = make([]byte, 256) - for i := 0; i < len(hexDigits); i++ { - hexDigits[i] = 255 - } - for i := '0'; i <= '9'; i++ { - hexDigits[i] = byte(i - '0') - } - for i := 'a'; i <= 'f'; i++ { - hexDigits[i] = byte((i - 'a') + 10) - } - for i := 'A'; i <= 'F'; i++ { - hexDigits[i] = byte((i - 'A') + 10) - } - valueTypes = make([]ValueType, 256) - for i := 0; i < len(valueTypes); i++ { - valueTypes[i] = InvalidValue - } - valueTypes['"'] = StringValue - valueTypes['-'] = NumberValue - valueTypes['0'] = NumberValue - valueTypes['1'] = NumberValue - valueTypes['2'] = NumberValue - valueTypes['3'] = NumberValue - valueTypes['4'] = NumberValue - valueTypes['5'] = NumberValue - valueTypes['6'] = NumberValue - valueTypes['7'] = NumberValue - valueTypes['8'] = NumberValue - valueTypes['9'] = NumberValue - valueTypes['t'] = BoolValue - valueTypes['f'] = BoolValue - valueTypes['n'] = NilValue - valueTypes['['] = ArrayValue - valueTypes['{'] = ObjectValue -} - -// Iterator is a io.Reader like object, with JSON specific read functions. -// Error is not returned as return value, but stored as Error member on this iterator instance. -type Iterator struct { - cfg *frozenConfig - reader io.Reader - buf []byte - head int - tail int - depth int - captureStartedAt int - captured []byte - Error error - Attachment interface{} // open for customized decoder -} - -// NewIterator creates an empty Iterator instance -func NewIterator(cfg API) *Iterator { - return &Iterator{ - cfg: cfg.(*frozenConfig), - reader: nil, - buf: nil, - head: 0, - tail: 0, - depth: 0, - } -} - -// Parse creates an Iterator instance from io.Reader -func Parse(cfg API, reader io.Reader, bufSize int) *Iterator { - return &Iterator{ - cfg: cfg.(*frozenConfig), - reader: reader, - buf: make([]byte, bufSize), - head: 0, - tail: 0, - depth: 0, - } -} - -// ParseBytes creates an Iterator instance from byte array -func ParseBytes(cfg API, input []byte) *Iterator { - return &Iterator{ - cfg: cfg.(*frozenConfig), - reader: nil, - buf: input, - head: 0, - tail: len(input), - depth: 0, - } -} - -// ParseString creates an Iterator instance from string -func ParseString(cfg API, input string) *Iterator { - return ParseBytes(cfg, []byte(input)) -} - -// Pool returns a pool can provide more iterator with same configuration -func (iter *Iterator) Pool() IteratorPool { - return iter.cfg -} - -// Reset reuse iterator instance by specifying another reader -func (iter *Iterator) Reset(reader io.Reader) *Iterator { - iter.reader = reader - iter.head = 0 - iter.tail = 0 - iter.depth = 0 - return iter -} - -// ResetBytes reuse iterator instance by specifying another byte array as input -func (iter *Iterator) ResetBytes(input []byte) *Iterator { - iter.reader = nil - iter.buf = input - iter.head = 0 - iter.tail = len(input) - iter.depth = 0 - return iter -} - -// WhatIsNext gets ValueType of relatively next json element -func (iter *Iterator) WhatIsNext() ValueType { - valueType := valueTypes[iter.nextToken()] - iter.unreadByte() - return valueType -} - -func (iter *Iterator) skipWhitespacesWithoutLoadMore() bool { - for i := iter.head; i < iter.tail; i++ { - c := iter.buf[i] - switch c { - case ' ', '\n', '\t', '\r': - continue - } - iter.head = i - return false - } - return true -} - -func (iter *Iterator) isObjectEnd() bool { - c := iter.nextToken() - if c == ',' { - return false - } - if c == '}' { - return true - } - iter.ReportError("isObjectEnd", "object ended prematurely, unexpected char "+string([]byte{c})) - return true -} - -func (iter *Iterator) nextToken() byte { - // a variation of skip whitespaces, returning the next non-whitespace token - for { - for i := iter.head; i < iter.tail; i++ { - c := iter.buf[i] - switch c { - case ' ', '\n', '\t', '\r': - continue - } - iter.head = i + 1 - return c - } - if !iter.loadMore() { - return 0 - } - } -} - -// ReportError record a error in iterator instance with current position. -func (iter *Iterator) ReportError(operation string, msg string) { - if iter.Error != nil { - if iter.Error != io.EOF { - return - } - } - peekStart := iter.head - 10 - if peekStart < 0 { - peekStart = 0 - } - peekEnd := iter.head + 10 - if peekEnd > iter.tail { - peekEnd = iter.tail - } - parsing := string(iter.buf[peekStart:peekEnd]) - contextStart := iter.head - 50 - if contextStart < 0 { - contextStart = 0 - } - contextEnd := iter.head + 50 - if contextEnd > iter.tail { - contextEnd = iter.tail - } - context := string(iter.buf[contextStart:contextEnd]) - iter.Error = fmt.Errorf("%s: %s, error found in #%v byte of ...|%s|..., bigger context ...|%s|...", - operation, msg, iter.head-peekStart, parsing, context) -} - -// CurrentBuffer gets current buffer as string for debugging purpose -func (iter *Iterator) CurrentBuffer() string { - peekStart := iter.head - 10 - if peekStart < 0 { - peekStart = 0 - } - return fmt.Sprintf("parsing #%v byte, around ...|%s|..., whole buffer ...|%s|...", iter.head, - string(iter.buf[peekStart:iter.head]), string(iter.buf[0:iter.tail])) -} - -func (iter *Iterator) readByte() (ret byte) { - if iter.head == iter.tail { - if iter.loadMore() { - ret = iter.buf[iter.head] - iter.head++ - return ret - } - return 0 - } - ret = iter.buf[iter.head] - iter.head++ - return ret -} - -func (iter *Iterator) loadMore() bool { - if iter.reader == nil { - if iter.Error == nil { - iter.head = iter.tail - iter.Error = io.EOF - } - return false - } - if iter.captured != nil { - iter.captured = append(iter.captured, - iter.buf[iter.captureStartedAt:iter.tail]...) - iter.captureStartedAt = 0 - } - for { - n, err := iter.reader.Read(iter.buf) - if n == 0 { - if err != nil { - if iter.Error == nil { - iter.Error = err - } - return false - } - } else { - iter.head = 0 - iter.tail = n - return true - } - } -} - -func (iter *Iterator) unreadByte() { - if iter.Error != nil { - return - } - iter.head-- - return -} - -// Read read the next JSON element as generic interface{}. -func (iter *Iterator) Read() interface{} { - valueType := iter.WhatIsNext() - switch valueType { - case StringValue: - return iter.ReadString() - case NumberValue: - if iter.cfg.configBeforeFrozen.UseNumber { - return json.Number(iter.readNumberAsString()) - } - return iter.ReadFloat64() - case NilValue: - iter.skipFourBytes('n', 'u', 'l', 'l') - return nil - case BoolValue: - return iter.ReadBool() - case ArrayValue: - arr := []interface{}{} - iter.ReadArrayCB(func(iter *Iterator) bool { - var elem interface{} - iter.ReadVal(&elem) - arr = append(arr, elem) - return true - }) - return arr - case ObjectValue: - obj := map[string]interface{}{} - iter.ReadMapCB(func(Iter *Iterator, field string) bool { - var elem interface{} - iter.ReadVal(&elem) - obj[field] = elem - return true - }) - return obj - default: - iter.ReportError("Read", fmt.Sprintf("unexpected value type: %v", valueType)) - return nil - } -} - -// limit maximum depth of nesting, as allowed by https://tools.ietf.org/html/rfc7159#section-9 -const maxDepth = 10000 - -func (iter *Iterator) incrementDepth() (success bool) { - iter.depth++ - if iter.depth <= maxDepth { - return true - } - iter.ReportError("incrementDepth", "exceeded max depth") - return false -} - -func (iter *Iterator) decrementDepth() (success bool) { - iter.depth-- - if iter.depth >= 0 { - return true - } - iter.ReportError("decrementDepth", "unexpected negative nesting") - return false -} diff --git a/vendor/github.com/json-iterator/go/iter_array.go b/vendor/github.com/json-iterator/go/iter_array.go deleted file mode 100644 index 204fe0e09..000000000 --- a/vendor/github.com/json-iterator/go/iter_array.go +++ /dev/null @@ -1,64 +0,0 @@ -package jsoniter - -// ReadArray read array element, tells if the array has more element to read. -func (iter *Iterator) ReadArray() (ret bool) { - c := iter.nextToken() - switch c { - case 'n': - iter.skipThreeBytes('u', 'l', 'l') - return false // null - case '[': - c = iter.nextToken() - if c != ']' { - iter.unreadByte() - return true - } - return false - case ']': - return false - case ',': - return true - default: - iter.ReportError("ReadArray", "expect [ or , or ] or n, but found "+string([]byte{c})) - return - } -} - -// ReadArrayCB read array with callback -func (iter *Iterator) ReadArrayCB(callback func(*Iterator) bool) (ret bool) { - c := iter.nextToken() - if c == '[' { - if !iter.incrementDepth() { - return false - } - c = iter.nextToken() - if c != ']' { - iter.unreadByte() - if !callback(iter) { - iter.decrementDepth() - return false - } - c = iter.nextToken() - for c == ',' { - if !callback(iter) { - iter.decrementDepth() - return false - } - c = iter.nextToken() - } - if c != ']' { - iter.ReportError("ReadArrayCB", "expect ] in the end, but found "+string([]byte{c})) - iter.decrementDepth() - return false - } - return iter.decrementDepth() - } - return iter.decrementDepth() - } - if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') - return true // null - } - iter.ReportError("ReadArrayCB", "expect [ or n, but found "+string([]byte{c})) - return false -} diff --git a/vendor/github.com/json-iterator/go/iter_float.go b/vendor/github.com/json-iterator/go/iter_float.go deleted file mode 100644 index 8a3d8b6fb..000000000 --- a/vendor/github.com/json-iterator/go/iter_float.go +++ /dev/null @@ -1,342 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "io" - "math/big" - "strconv" - "strings" - "unsafe" -) - -var floatDigits []int8 - -const invalidCharForNumber = int8(-1) -const endOfNumber = int8(-2) -const dotInNumber = int8(-3) - -func init() { - floatDigits = make([]int8, 256) - for i := 0; i < len(floatDigits); i++ { - floatDigits[i] = invalidCharForNumber - } - for i := int8('0'); i <= int8('9'); i++ { - floatDigits[i] = i - int8('0') - } - floatDigits[','] = endOfNumber - floatDigits[']'] = endOfNumber - floatDigits['}'] = endOfNumber - floatDigits[' '] = endOfNumber - floatDigits['\t'] = endOfNumber - floatDigits['\n'] = endOfNumber - floatDigits['.'] = dotInNumber -} - -// ReadBigFloat read big.Float -func (iter *Iterator) ReadBigFloat() (ret *big.Float) { - str := iter.readNumberAsString() - if iter.Error != nil && iter.Error != io.EOF { - return nil - } - prec := 64 - if len(str) > prec { - prec = len(str) - } - val, _, err := big.ParseFloat(str, 10, uint(prec), big.ToZero) - if err != nil { - iter.Error = err - return nil - } - return val -} - -// ReadBigInt read big.Int -func (iter *Iterator) ReadBigInt() (ret *big.Int) { - str := iter.readNumberAsString() - if iter.Error != nil && iter.Error != io.EOF { - return nil - } - ret = big.NewInt(0) - var success bool - ret, success = ret.SetString(str, 10) - if !success { - iter.ReportError("ReadBigInt", "invalid big int") - return nil - } - return ret -} - -//ReadFloat32 read float32 -func (iter *Iterator) ReadFloat32() (ret float32) { - c := iter.nextToken() - if c == '-' { - return -iter.readPositiveFloat32() - } - iter.unreadByte() - return iter.readPositiveFloat32() -} - -func (iter *Iterator) readPositiveFloat32() (ret float32) { - i := iter.head - // first char - if i == iter.tail { - return iter.readFloat32SlowPath() - } - c := iter.buf[i] - i++ - ind := floatDigits[c] - switch ind { - case invalidCharForNumber: - return iter.readFloat32SlowPath() - case endOfNumber: - iter.ReportError("readFloat32", "empty number") - return - case dotInNumber: - iter.ReportError("readFloat32", "leading dot is invalid") - return - case 0: - if i == iter.tail { - return iter.readFloat32SlowPath() - } - c = iter.buf[i] - switch c { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - iter.ReportError("readFloat32", "leading zero is invalid") - return - } - } - value := uint64(ind) - // chars before dot -non_decimal_loop: - for ; i < iter.tail; i++ { - c = iter.buf[i] - ind := floatDigits[c] - switch ind { - case invalidCharForNumber: - return iter.readFloat32SlowPath() - case endOfNumber: - iter.head = i - return float32(value) - case dotInNumber: - break non_decimal_loop - } - if value > uint64SafeToMultiple10 { - return iter.readFloat32SlowPath() - } - value = (value << 3) + (value << 1) + uint64(ind) // value = value * 10 + ind; - } - // chars after dot - if c == '.' { - i++ - decimalPlaces := 0 - if i == iter.tail { - return iter.readFloat32SlowPath() - } - for ; i < iter.tail; i++ { - c = iter.buf[i] - ind := floatDigits[c] - switch ind { - case endOfNumber: - if decimalPlaces > 0 && decimalPlaces < len(pow10) { - iter.head = i - return float32(float64(value) / float64(pow10[decimalPlaces])) - } - // too many decimal places - return iter.readFloat32SlowPath() - case invalidCharForNumber, dotInNumber: - return iter.readFloat32SlowPath() - } - decimalPlaces++ - if value > uint64SafeToMultiple10 { - return iter.readFloat32SlowPath() - } - value = (value << 3) + (value << 1) + uint64(ind) - } - } - return iter.readFloat32SlowPath() -} - -func (iter *Iterator) readNumberAsString() (ret string) { - strBuf := [16]byte{} - str := strBuf[0:0] -load_loop: - for { - for i := iter.head; i < iter.tail; i++ { - c := iter.buf[i] - switch c { - case '+', '-', '.', 'e', 'E', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - str = append(str, c) - continue - default: - iter.head = i - break load_loop - } - } - if !iter.loadMore() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF { - return - } - if len(str) == 0 { - iter.ReportError("readNumberAsString", "invalid number") - } - return *(*string)(unsafe.Pointer(&str)) -} - -func (iter *Iterator) readFloat32SlowPath() (ret float32) { - str := iter.readNumberAsString() - if iter.Error != nil && iter.Error != io.EOF { - return - } - errMsg := validateFloat(str) - if errMsg != "" { - iter.ReportError("readFloat32SlowPath", errMsg) - return - } - val, err := strconv.ParseFloat(str, 32) - if err != nil { - iter.Error = err - return - } - return float32(val) -} - -// ReadFloat64 read float64 -func (iter *Iterator) ReadFloat64() (ret float64) { - c := iter.nextToken() - if c == '-' { - return -iter.readPositiveFloat64() - } - iter.unreadByte() - return iter.readPositiveFloat64() -} - -func (iter *Iterator) readPositiveFloat64() (ret float64) { - i := iter.head - // first char - if i == iter.tail { - return iter.readFloat64SlowPath() - } - c := iter.buf[i] - i++ - ind := floatDigits[c] - switch ind { - case invalidCharForNumber: - return iter.readFloat64SlowPath() - case endOfNumber: - iter.ReportError("readFloat64", "empty number") - return - case dotInNumber: - iter.ReportError("readFloat64", "leading dot is invalid") - return - case 0: - if i == iter.tail { - return iter.readFloat64SlowPath() - } - c = iter.buf[i] - switch c { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - iter.ReportError("readFloat64", "leading zero is invalid") - return - } - } - value := uint64(ind) - // chars before dot -non_decimal_loop: - for ; i < iter.tail; i++ { - c = iter.buf[i] - ind := floatDigits[c] - switch ind { - case invalidCharForNumber: - return iter.readFloat64SlowPath() - case endOfNumber: - iter.head = i - return float64(value) - case dotInNumber: - break non_decimal_loop - } - if value > uint64SafeToMultiple10 { - return iter.readFloat64SlowPath() - } - value = (value << 3) + (value << 1) + uint64(ind) // value = value * 10 + ind; - } - // chars after dot - if c == '.' { - i++ - decimalPlaces := 0 - if i == iter.tail { - return iter.readFloat64SlowPath() - } - for ; i < iter.tail; i++ { - c = iter.buf[i] - ind := floatDigits[c] - switch ind { - case endOfNumber: - if decimalPlaces > 0 && decimalPlaces < len(pow10) { - iter.head = i - return float64(value) / float64(pow10[decimalPlaces]) - } - // too many decimal places - return iter.readFloat64SlowPath() - case invalidCharForNumber, dotInNumber: - return iter.readFloat64SlowPath() - } - decimalPlaces++ - if value > uint64SafeToMultiple10 { - return iter.readFloat64SlowPath() - } - value = (value << 3) + (value << 1) + uint64(ind) - if value > maxFloat64 { - return iter.readFloat64SlowPath() - } - } - } - return iter.readFloat64SlowPath() -} - -func (iter *Iterator) readFloat64SlowPath() (ret float64) { - str := iter.readNumberAsString() - if iter.Error != nil && iter.Error != io.EOF { - return - } - errMsg := validateFloat(str) - if errMsg != "" { - iter.ReportError("readFloat64SlowPath", errMsg) - return - } - val, err := strconv.ParseFloat(str, 64) - if err != nil { - iter.Error = err - return - } - return val -} - -func validateFloat(str string) string { - // strconv.ParseFloat is not validating `1.` or `1.e1` - if len(str) == 0 { - return "empty number" - } - if str[0] == '-' { - return "-- is not valid" - } - dotPos := strings.IndexByte(str, '.') - if dotPos != -1 { - if dotPos == len(str)-1 { - return "dot can not be last character" - } - switch str[dotPos+1] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - default: - return "missing digit after dot" - } - } - return "" -} - -// ReadNumber read json.Number -func (iter *Iterator) ReadNumber() (ret json.Number) { - return json.Number(iter.readNumberAsString()) -} diff --git a/vendor/github.com/json-iterator/go/iter_int.go b/vendor/github.com/json-iterator/go/iter_int.go deleted file mode 100644 index d786a89fe..000000000 --- a/vendor/github.com/json-iterator/go/iter_int.go +++ /dev/null @@ -1,346 +0,0 @@ -package jsoniter - -import ( - "math" - "strconv" -) - -var intDigits []int8 - -const uint32SafeToMultiply10 = uint32(0xffffffff)/10 - 1 -const uint64SafeToMultiple10 = uint64(0xffffffffffffffff)/10 - 1 -const maxFloat64 = 1<<53 - 1 - -func init() { - intDigits = make([]int8, 256) - for i := 0; i < len(intDigits); i++ { - intDigits[i] = invalidCharForNumber - } - for i := int8('0'); i <= int8('9'); i++ { - intDigits[i] = i - int8('0') - } -} - -// ReadUint read uint -func (iter *Iterator) ReadUint() uint { - if strconv.IntSize == 32 { - return uint(iter.ReadUint32()) - } - return uint(iter.ReadUint64()) -} - -// ReadInt read int -func (iter *Iterator) ReadInt() int { - if strconv.IntSize == 32 { - return int(iter.ReadInt32()) - } - return int(iter.ReadInt64()) -} - -// ReadInt8 read int8 -func (iter *Iterator) ReadInt8() (ret int8) { - c := iter.nextToken() - if c == '-' { - val := iter.readUint32(iter.readByte()) - if val > math.MaxInt8+1 { - iter.ReportError("ReadInt8", "overflow: "+strconv.FormatInt(int64(val), 10)) - return - } - return -int8(val) - } - val := iter.readUint32(c) - if val > math.MaxInt8 { - iter.ReportError("ReadInt8", "overflow: "+strconv.FormatInt(int64(val), 10)) - return - } - return int8(val) -} - -// ReadUint8 read uint8 -func (iter *Iterator) ReadUint8() (ret uint8) { - val := iter.readUint32(iter.nextToken()) - if val > math.MaxUint8 { - iter.ReportError("ReadUint8", "overflow: "+strconv.FormatInt(int64(val), 10)) - return - } - return uint8(val) -} - -// ReadInt16 read int16 -func (iter *Iterator) ReadInt16() (ret int16) { - c := iter.nextToken() - if c == '-' { - val := iter.readUint32(iter.readByte()) - if val > math.MaxInt16+1 { - iter.ReportError("ReadInt16", "overflow: "+strconv.FormatInt(int64(val), 10)) - return - } - return -int16(val) - } - val := iter.readUint32(c) - if val > math.MaxInt16 { - iter.ReportError("ReadInt16", "overflow: "+strconv.FormatInt(int64(val), 10)) - return - } - return int16(val) -} - -// ReadUint16 read uint16 -func (iter *Iterator) ReadUint16() (ret uint16) { - val := iter.readUint32(iter.nextToken()) - if val > math.MaxUint16 { - iter.ReportError("ReadUint16", "overflow: "+strconv.FormatInt(int64(val), 10)) - return - } - return uint16(val) -} - -// ReadInt32 read int32 -func (iter *Iterator) ReadInt32() (ret int32) { - c := iter.nextToken() - if c == '-' { - val := iter.readUint32(iter.readByte()) - if val > math.MaxInt32+1 { - iter.ReportError("ReadInt32", "overflow: "+strconv.FormatInt(int64(val), 10)) - return - } - return -int32(val) - } - val := iter.readUint32(c) - if val > math.MaxInt32 { - iter.ReportError("ReadInt32", "overflow: "+strconv.FormatInt(int64(val), 10)) - return - } - return int32(val) -} - -// ReadUint32 read uint32 -func (iter *Iterator) ReadUint32() (ret uint32) { - return iter.readUint32(iter.nextToken()) -} - -func (iter *Iterator) readUint32(c byte) (ret uint32) { - ind := intDigits[c] - if ind == 0 { - iter.assertInteger() - return 0 // single zero - } - if ind == invalidCharForNumber { - iter.ReportError("readUint32", "unexpected character: "+string([]byte{byte(ind)})) - return - } - value := uint32(ind) - if iter.tail-iter.head > 10 { - i := iter.head - ind2 := intDigits[iter.buf[i]] - if ind2 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value - } - i++ - ind3 := intDigits[iter.buf[i]] - if ind3 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*10 + uint32(ind2) - } - //iter.head = i + 1 - //value = value * 100 + uint32(ind2) * 10 + uint32(ind3) - i++ - ind4 := intDigits[iter.buf[i]] - if ind4 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*100 + uint32(ind2)*10 + uint32(ind3) - } - i++ - ind5 := intDigits[iter.buf[i]] - if ind5 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*1000 + uint32(ind2)*100 + uint32(ind3)*10 + uint32(ind4) - } - i++ - ind6 := intDigits[iter.buf[i]] - if ind6 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*10000 + uint32(ind2)*1000 + uint32(ind3)*100 + uint32(ind4)*10 + uint32(ind5) - } - i++ - ind7 := intDigits[iter.buf[i]] - if ind7 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*100000 + uint32(ind2)*10000 + uint32(ind3)*1000 + uint32(ind4)*100 + uint32(ind5)*10 + uint32(ind6) - } - i++ - ind8 := intDigits[iter.buf[i]] - if ind8 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*1000000 + uint32(ind2)*100000 + uint32(ind3)*10000 + uint32(ind4)*1000 + uint32(ind5)*100 + uint32(ind6)*10 + uint32(ind7) - } - i++ - ind9 := intDigits[iter.buf[i]] - value = value*10000000 + uint32(ind2)*1000000 + uint32(ind3)*100000 + uint32(ind4)*10000 + uint32(ind5)*1000 + uint32(ind6)*100 + uint32(ind7)*10 + uint32(ind8) - iter.head = i - if ind9 == invalidCharForNumber { - iter.assertInteger() - return value - } - } - for { - for i := iter.head; i < iter.tail; i++ { - ind = intDigits[iter.buf[i]] - if ind == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value - } - if value > uint32SafeToMultiply10 { - value2 := (value << 3) + (value << 1) + uint32(ind) - if value2 < value { - iter.ReportError("readUint32", "overflow") - return - } - value = value2 - continue - } - value = (value << 3) + (value << 1) + uint32(ind) - } - if !iter.loadMore() { - iter.assertInteger() - return value - } - } -} - -// ReadInt64 read int64 -func (iter *Iterator) ReadInt64() (ret int64) { - c := iter.nextToken() - if c == '-' { - val := iter.readUint64(iter.readByte()) - if val > math.MaxInt64+1 { - iter.ReportError("ReadInt64", "overflow: "+strconv.FormatUint(uint64(val), 10)) - return - } - return -int64(val) - } - val := iter.readUint64(c) - if val > math.MaxInt64 { - iter.ReportError("ReadInt64", "overflow: "+strconv.FormatUint(uint64(val), 10)) - return - } - return int64(val) -} - -// ReadUint64 read uint64 -func (iter *Iterator) ReadUint64() uint64 { - return iter.readUint64(iter.nextToken()) -} - -func (iter *Iterator) readUint64(c byte) (ret uint64) { - ind := intDigits[c] - if ind == 0 { - iter.assertInteger() - return 0 // single zero - } - if ind == invalidCharForNumber { - iter.ReportError("readUint64", "unexpected character: "+string([]byte{byte(ind)})) - return - } - value := uint64(ind) - if iter.tail-iter.head > 10 { - i := iter.head - ind2 := intDigits[iter.buf[i]] - if ind2 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value - } - i++ - ind3 := intDigits[iter.buf[i]] - if ind3 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*10 + uint64(ind2) - } - //iter.head = i + 1 - //value = value * 100 + uint32(ind2) * 10 + uint32(ind3) - i++ - ind4 := intDigits[iter.buf[i]] - if ind4 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*100 + uint64(ind2)*10 + uint64(ind3) - } - i++ - ind5 := intDigits[iter.buf[i]] - if ind5 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*1000 + uint64(ind2)*100 + uint64(ind3)*10 + uint64(ind4) - } - i++ - ind6 := intDigits[iter.buf[i]] - if ind6 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*10000 + uint64(ind2)*1000 + uint64(ind3)*100 + uint64(ind4)*10 + uint64(ind5) - } - i++ - ind7 := intDigits[iter.buf[i]] - if ind7 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*100000 + uint64(ind2)*10000 + uint64(ind3)*1000 + uint64(ind4)*100 + uint64(ind5)*10 + uint64(ind6) - } - i++ - ind8 := intDigits[iter.buf[i]] - if ind8 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*1000000 + uint64(ind2)*100000 + uint64(ind3)*10000 + uint64(ind4)*1000 + uint64(ind5)*100 + uint64(ind6)*10 + uint64(ind7) - } - i++ - ind9 := intDigits[iter.buf[i]] - value = value*10000000 + uint64(ind2)*1000000 + uint64(ind3)*100000 + uint64(ind4)*10000 + uint64(ind5)*1000 + uint64(ind6)*100 + uint64(ind7)*10 + uint64(ind8) - iter.head = i - if ind9 == invalidCharForNumber { - iter.assertInteger() - return value - } - } - for { - for i := iter.head; i < iter.tail; i++ { - ind = intDigits[iter.buf[i]] - if ind == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value - } - if value > uint64SafeToMultiple10 { - value2 := (value << 3) + (value << 1) + uint64(ind) - if value2 < value { - iter.ReportError("readUint64", "overflow") - return - } - value = value2 - continue - } - value = (value << 3) + (value << 1) + uint64(ind) - } - if !iter.loadMore() { - iter.assertInteger() - return value - } - } -} - -func (iter *Iterator) assertInteger() { - if iter.head < iter.tail && iter.buf[iter.head] == '.' { - iter.ReportError("assertInteger", "can not decode float as int") - } -} diff --git a/vendor/github.com/json-iterator/go/iter_object.go b/vendor/github.com/json-iterator/go/iter_object.go deleted file mode 100644 index 58ee89c84..000000000 --- a/vendor/github.com/json-iterator/go/iter_object.go +++ /dev/null @@ -1,267 +0,0 @@ -package jsoniter - -import ( - "fmt" - "strings" -) - -// ReadObject read one field from object. -// If object ended, returns empty string. -// Otherwise, returns the field name. -func (iter *Iterator) ReadObject() (ret string) { - c := iter.nextToken() - switch c { - case 'n': - iter.skipThreeBytes('u', 'l', 'l') - return "" // null - case '{': - c = iter.nextToken() - if c == '"' { - iter.unreadByte() - field := iter.ReadString() - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } - return field - } - if c == '}' { - return "" // end of object - } - iter.ReportError("ReadObject", `expect " after {, but found `+string([]byte{c})) - return - case ',': - field := iter.ReadString() - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } - return field - case '}': - return "" // end of object - default: - iter.ReportError("ReadObject", fmt.Sprintf(`expect { or , or } or n, but found %s`, string([]byte{c}))) - return - } -} - -// CaseInsensitive -func (iter *Iterator) readFieldHash() int64 { - hash := int64(0x811c9dc5) - c := iter.nextToken() - if c != '"' { - iter.ReportError("readFieldHash", `expect ", but found `+string([]byte{c})) - return 0 - } - for { - for i := iter.head; i < iter.tail; i++ { - // require ascii string and no escape - b := iter.buf[i] - if b == '\\' { - iter.head = i - for _, b := range iter.readStringSlowPath() { - if 'A' <= b && b <= 'Z' && !iter.cfg.caseSensitive { - b += 'a' - 'A' - } - hash ^= int64(b) - hash *= 0x1000193 - } - c = iter.nextToken() - if c != ':' { - iter.ReportError("readFieldHash", `expect :, but found `+string([]byte{c})) - return 0 - } - return hash - } - if b == '"' { - iter.head = i + 1 - c = iter.nextToken() - if c != ':' { - iter.ReportError("readFieldHash", `expect :, but found `+string([]byte{c})) - return 0 - } - return hash - } - if 'A' <= b && b <= 'Z' && !iter.cfg.caseSensitive { - b += 'a' - 'A' - } - hash ^= int64(b) - hash *= 0x1000193 - } - if !iter.loadMore() { - iter.ReportError("readFieldHash", `incomplete field name`) - return 0 - } - } -} - -func calcHash(str string, caseSensitive bool) int64 { - if !caseSensitive { - str = strings.ToLower(str) - } - hash := int64(0x811c9dc5) - for _, b := range []byte(str) { - hash ^= int64(b) - hash *= 0x1000193 - } - return int64(hash) -} - -// ReadObjectCB read object with callback, the key is ascii only and field name not copied -func (iter *Iterator) ReadObjectCB(callback func(*Iterator, string) bool) bool { - c := iter.nextToken() - var field string - if c == '{' { - if !iter.incrementDepth() { - return false - } - c = iter.nextToken() - if c == '"' { - iter.unreadByte() - field = iter.ReadString() - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } - if !callback(iter, field) { - iter.decrementDepth() - return false - } - c = iter.nextToken() - for c == ',' { - field = iter.ReadString() - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } - if !callback(iter, field) { - iter.decrementDepth() - return false - } - c = iter.nextToken() - } - if c != '}' { - iter.ReportError("ReadObjectCB", `object not ended with }`) - iter.decrementDepth() - return false - } - return iter.decrementDepth() - } - if c == '}' { - return iter.decrementDepth() - } - iter.ReportError("ReadObjectCB", `expect " after {, but found `+string([]byte{c})) - iter.decrementDepth() - return false - } - if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') - return true // null - } - iter.ReportError("ReadObjectCB", `expect { or n, but found `+string([]byte{c})) - return false -} - -// ReadMapCB read map with callback, the key can be any string -func (iter *Iterator) ReadMapCB(callback func(*Iterator, string) bool) bool { - c := iter.nextToken() - if c == '{' { - if !iter.incrementDepth() { - return false - } - c = iter.nextToken() - if c == '"' { - iter.unreadByte() - field := iter.ReadString() - if iter.nextToken() != ':' { - iter.ReportError("ReadMapCB", "expect : after object field, but found "+string([]byte{c})) - iter.decrementDepth() - return false - } - if !callback(iter, field) { - iter.decrementDepth() - return false - } - c = iter.nextToken() - for c == ',' { - field = iter.ReadString() - if iter.nextToken() != ':' { - iter.ReportError("ReadMapCB", "expect : after object field, but found "+string([]byte{c})) - iter.decrementDepth() - return false - } - if !callback(iter, field) { - iter.decrementDepth() - return false - } - c = iter.nextToken() - } - if c != '}' { - iter.ReportError("ReadMapCB", `object not ended with }`) - iter.decrementDepth() - return false - } - return iter.decrementDepth() - } - if c == '}' { - return iter.decrementDepth() - } - iter.ReportError("ReadMapCB", `expect " after {, but found `+string([]byte{c})) - iter.decrementDepth() - return false - } - if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') - return true // null - } - iter.ReportError("ReadMapCB", `expect { or n, but found `+string([]byte{c})) - return false -} - -func (iter *Iterator) readObjectStart() bool { - c := iter.nextToken() - if c == '{' { - c = iter.nextToken() - if c == '}' { - return false - } - iter.unreadByte() - return true - } else if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') - return false - } - iter.ReportError("readObjectStart", "expect { or n, but found "+string([]byte{c})) - return false -} - -func (iter *Iterator) readObjectFieldAsBytes() (ret []byte) { - str := iter.ReadStringAsSlice() - if iter.skipWhitespacesWithoutLoadMore() { - if ret == nil { - ret = make([]byte, len(str)) - copy(ret, str) - } - if !iter.loadMore() { - return - } - } - if iter.buf[iter.head] != ':' { - iter.ReportError("readObjectFieldAsBytes", "expect : after object field, but found "+string([]byte{iter.buf[iter.head]})) - return - } - iter.head++ - if iter.skipWhitespacesWithoutLoadMore() { - if ret == nil { - ret = make([]byte, len(str)) - copy(ret, str) - } - if !iter.loadMore() { - return - } - } - if ret == nil { - return str - } - return ret -} diff --git a/vendor/github.com/json-iterator/go/iter_skip.go b/vendor/github.com/json-iterator/go/iter_skip.go deleted file mode 100644 index e91eefb15..000000000 --- a/vendor/github.com/json-iterator/go/iter_skip.go +++ /dev/null @@ -1,130 +0,0 @@ -package jsoniter - -import "fmt" - -// ReadNil reads a json object as nil and -// returns whether it's a nil or not -func (iter *Iterator) ReadNil() (ret bool) { - c := iter.nextToken() - if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') // null - return true - } - iter.unreadByte() - return false -} - -// ReadBool reads a json object as BoolValue -func (iter *Iterator) ReadBool() (ret bool) { - c := iter.nextToken() - if c == 't' { - iter.skipThreeBytes('r', 'u', 'e') - return true - } - if c == 'f' { - iter.skipFourBytes('a', 'l', 's', 'e') - return false - } - iter.ReportError("ReadBool", "expect t or f, but found "+string([]byte{c})) - return -} - -// SkipAndReturnBytes skip next JSON element, and return its content as []byte. -// The []byte can be kept, it is a copy of data. -func (iter *Iterator) SkipAndReturnBytes() []byte { - iter.startCapture(iter.head) - iter.Skip() - return iter.stopCapture() -} - -// SkipAndAppendBytes skips next JSON element and appends its content to -// buffer, returning the result. -func (iter *Iterator) SkipAndAppendBytes(buf []byte) []byte { - iter.startCaptureTo(buf, iter.head) - iter.Skip() - return iter.stopCapture() -} - -func (iter *Iterator) startCaptureTo(buf []byte, captureStartedAt int) { - if iter.captured != nil { - panic("already in capture mode") - } - iter.captureStartedAt = captureStartedAt - iter.captured = buf -} - -func (iter *Iterator) startCapture(captureStartedAt int) { - iter.startCaptureTo(make([]byte, 0, 32), captureStartedAt) -} - -func (iter *Iterator) stopCapture() []byte { - if iter.captured == nil { - panic("not in capture mode") - } - captured := iter.captured - remaining := iter.buf[iter.captureStartedAt:iter.head] - iter.captureStartedAt = -1 - iter.captured = nil - return append(captured, remaining...) -} - -// Skip skips a json object and positions to relatively the next json object -func (iter *Iterator) Skip() { - c := iter.nextToken() - switch c { - case '"': - iter.skipString() - case 'n': - iter.skipThreeBytes('u', 'l', 'l') // null - case 't': - iter.skipThreeBytes('r', 'u', 'e') // true - case 'f': - iter.skipFourBytes('a', 'l', 's', 'e') // false - case '0': - iter.unreadByte() - iter.ReadFloat32() - case '-', '1', '2', '3', '4', '5', '6', '7', '8', '9': - iter.skipNumber() - case '[': - iter.skipArray() - case '{': - iter.skipObject() - default: - iter.ReportError("Skip", fmt.Sprintf("do not know how to skip: %v", c)) - return - } -} - -func (iter *Iterator) skipFourBytes(b1, b2, b3, b4 byte) { - if iter.readByte() != b1 { - iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3, b4}))) - return - } - if iter.readByte() != b2 { - iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3, b4}))) - return - } - if iter.readByte() != b3 { - iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3, b4}))) - return - } - if iter.readByte() != b4 { - iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3, b4}))) - return - } -} - -func (iter *Iterator) skipThreeBytes(b1, b2, b3 byte) { - if iter.readByte() != b1 { - iter.ReportError("skipThreeBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3}))) - return - } - if iter.readByte() != b2 { - iter.ReportError("skipThreeBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3}))) - return - } - if iter.readByte() != b3 { - iter.ReportError("skipThreeBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3}))) - return - } -} diff --git a/vendor/github.com/json-iterator/go/iter_skip_sloppy.go b/vendor/github.com/json-iterator/go/iter_skip_sloppy.go deleted file mode 100644 index 9303de41e..000000000 --- a/vendor/github.com/json-iterator/go/iter_skip_sloppy.go +++ /dev/null @@ -1,163 +0,0 @@ -//+build jsoniter_sloppy - -package jsoniter - -// sloppy but faster implementation, do not validate the input json - -func (iter *Iterator) skipNumber() { - for { - for i := iter.head; i < iter.tail; i++ { - c := iter.buf[i] - switch c { - case ' ', '\n', '\r', '\t', ',', '}', ']': - iter.head = i - return - } - } - if !iter.loadMore() { - return - } - } -} - -func (iter *Iterator) skipArray() { - level := 1 - if !iter.incrementDepth() { - return - } - for { - for i := iter.head; i < iter.tail; i++ { - switch iter.buf[i] { - case '"': // If inside string, skip it - iter.head = i + 1 - iter.skipString() - i = iter.head - 1 // it will be i++ soon - case '[': // If open symbol, increase level - level++ - if !iter.incrementDepth() { - return - } - case ']': // If close symbol, increase level - level-- - if !iter.decrementDepth() { - return - } - - // If we have returned to the original level, we're done - if level == 0 { - iter.head = i + 1 - return - } - } - } - if !iter.loadMore() { - iter.ReportError("skipObject", "incomplete array") - return - } - } -} - -func (iter *Iterator) skipObject() { - level := 1 - if !iter.incrementDepth() { - return - } - - for { - for i := iter.head; i < iter.tail; i++ { - switch iter.buf[i] { - case '"': // If inside string, skip it - iter.head = i + 1 - iter.skipString() - i = iter.head - 1 // it will be i++ soon - case '{': // If open symbol, increase level - level++ - if !iter.incrementDepth() { - return - } - case '}': // If close symbol, increase level - level-- - if !iter.decrementDepth() { - return - } - - // If we have returned to the original level, we're done - if level == 0 { - iter.head = i + 1 - return - } - } - } - if !iter.loadMore() { - iter.ReportError("skipObject", "incomplete object") - return - } - } -} - -func (iter *Iterator) skipString() { - for { - end, escaped := iter.findStringEnd() - if end == -1 { - if !iter.loadMore() { - iter.ReportError("skipString", "incomplete string") - return - } - if escaped { - iter.head = 1 // skip the first char as last char read is \ - } - } else { - iter.head = end - return - } - } -} - -// adapted from: https://github.com/buger/jsonparser/blob/master/parser.go -// Tries to find the end of string -// Support if string contains escaped quote symbols. -func (iter *Iterator) findStringEnd() (int, bool) { - escaped := false - for i := iter.head; i < iter.tail; i++ { - c := iter.buf[i] - if c == '"' { - if !escaped { - return i + 1, false - } - j := i - 1 - for { - if j < iter.head || iter.buf[j] != '\\' { - // even number of backslashes - // either end of buffer, or " found - return i + 1, true - } - j-- - if j < iter.head || iter.buf[j] != '\\' { - // odd number of backslashes - // it is \" or \\\" - break - } - j-- - } - } else if c == '\\' { - escaped = true - } - } - j := iter.tail - 1 - for { - if j < iter.head || iter.buf[j] != '\\' { - // even number of backslashes - // either end of buffer, or " found - return -1, false // do not end with \ - } - j-- - if j < iter.head || iter.buf[j] != '\\' { - // odd number of backslashes - // it is \" or \\\" - break - } - j-- - - } - return -1, true // end with \ -} diff --git a/vendor/github.com/json-iterator/go/iter_skip_strict.go b/vendor/github.com/json-iterator/go/iter_skip_strict.go deleted file mode 100644 index 6cf66d043..000000000 --- a/vendor/github.com/json-iterator/go/iter_skip_strict.go +++ /dev/null @@ -1,99 +0,0 @@ -//+build !jsoniter_sloppy - -package jsoniter - -import ( - "fmt" - "io" -) - -func (iter *Iterator) skipNumber() { - if !iter.trySkipNumber() { - iter.unreadByte() - if iter.Error != nil && iter.Error != io.EOF { - return - } - iter.ReadFloat64() - if iter.Error != nil && iter.Error != io.EOF { - iter.Error = nil - iter.ReadBigFloat() - } - } -} - -func (iter *Iterator) trySkipNumber() bool { - dotFound := false - for i := iter.head; i < iter.tail; i++ { - c := iter.buf[i] - switch c { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - case '.': - if dotFound { - iter.ReportError("validateNumber", `more than one dot found in number`) - return true // already failed - } - if i+1 == iter.tail { - return false - } - c = iter.buf[i+1] - switch c { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - default: - iter.ReportError("validateNumber", `missing digit after dot`) - return true // already failed - } - dotFound = true - default: - switch c { - case ',', ']', '}', ' ', '\t', '\n', '\r': - if iter.head == i { - return false // if - without following digits - } - iter.head = i - return true // must be valid - } - return false // may be invalid - } - } - return false -} - -func (iter *Iterator) skipString() { - if !iter.trySkipString() { - iter.unreadByte() - iter.ReadString() - } -} - -func (iter *Iterator) trySkipString() bool { - for i := iter.head; i < iter.tail; i++ { - c := iter.buf[i] - if c == '"' { - iter.head = i + 1 - return true // valid - } else if c == '\\' { - return false - } else if c < ' ' { - iter.ReportError("trySkipString", - fmt.Sprintf(`invalid control character found: %d`, c)) - return true // already failed - } - } - return false -} - -func (iter *Iterator) skipObject() { - iter.unreadByte() - iter.ReadObjectCB(func(iter *Iterator, field string) bool { - iter.Skip() - return true - }) -} - -func (iter *Iterator) skipArray() { - iter.unreadByte() - iter.ReadArrayCB(func(iter *Iterator) bool { - iter.Skip() - return true - }) -} diff --git a/vendor/github.com/json-iterator/go/iter_str.go b/vendor/github.com/json-iterator/go/iter_str.go deleted file mode 100644 index adc487ea8..000000000 --- a/vendor/github.com/json-iterator/go/iter_str.go +++ /dev/null @@ -1,215 +0,0 @@ -package jsoniter - -import ( - "fmt" - "unicode/utf16" -) - -// ReadString read string from iterator -func (iter *Iterator) ReadString() (ret string) { - c := iter.nextToken() - if c == '"' { - for i := iter.head; i < iter.tail; i++ { - c := iter.buf[i] - if c == '"' { - ret = string(iter.buf[iter.head:i]) - iter.head = i + 1 - return ret - } else if c == '\\' { - break - } else if c < ' ' { - iter.ReportError("ReadString", - fmt.Sprintf(`invalid control character found: %d`, c)) - return - } - } - return iter.readStringSlowPath() - } else if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') - return "" - } - iter.ReportError("ReadString", `expects " or n, but found `+string([]byte{c})) - return -} - -func (iter *Iterator) readStringSlowPath() (ret string) { - var str []byte - var c byte - for iter.Error == nil { - c = iter.readByte() - if c == '"' { - return string(str) - } - if c == '\\' { - c = iter.readByte() - str = iter.readEscapedChar(c, str) - } else { - str = append(str, c) - } - } - iter.ReportError("readStringSlowPath", "unexpected end of input") - return -} - -func (iter *Iterator) readEscapedChar(c byte, str []byte) []byte { - switch c { - case 'u': - r := iter.readU4() - if utf16.IsSurrogate(r) { - c = iter.readByte() - if iter.Error != nil { - return nil - } - if c != '\\' { - iter.unreadByte() - str = appendRune(str, r) - return str - } - c = iter.readByte() - if iter.Error != nil { - return nil - } - if c != 'u' { - str = appendRune(str, r) - return iter.readEscapedChar(c, str) - } - r2 := iter.readU4() - if iter.Error != nil { - return nil - } - combined := utf16.DecodeRune(r, r2) - if combined == '\uFFFD' { - str = appendRune(str, r) - str = appendRune(str, r2) - } else { - str = appendRune(str, combined) - } - } else { - str = appendRune(str, r) - } - case '"': - str = append(str, '"') - case '\\': - str = append(str, '\\') - case '/': - str = append(str, '/') - case 'b': - str = append(str, '\b') - case 'f': - str = append(str, '\f') - case 'n': - str = append(str, '\n') - case 'r': - str = append(str, '\r') - case 't': - str = append(str, '\t') - default: - iter.ReportError("readEscapedChar", - `invalid escape char after \`) - return nil - } - return str -} - -// ReadStringAsSlice read string from iterator without copying into string form. -// The []byte can not be kept, as it will change after next iterator call. -func (iter *Iterator) ReadStringAsSlice() (ret []byte) { - c := iter.nextToken() - if c == '"' { - for i := iter.head; i < iter.tail; i++ { - // require ascii string and no escape - // for: field name, base64, number - if iter.buf[i] == '"' { - // fast path: reuse the underlying buffer - ret = iter.buf[iter.head:i] - iter.head = i + 1 - return ret - } - } - readLen := iter.tail - iter.head - copied := make([]byte, readLen, readLen*2) - copy(copied, iter.buf[iter.head:iter.tail]) - iter.head = iter.tail - for iter.Error == nil { - c := iter.readByte() - if c == '"' { - return copied - } - copied = append(copied, c) - } - return copied - } - iter.ReportError("ReadStringAsSlice", `expects " or n, but found `+string([]byte{c})) - return -} - -func (iter *Iterator) readU4() (ret rune) { - for i := 0; i < 4; i++ { - c := iter.readByte() - if iter.Error != nil { - return - } - if c >= '0' && c <= '9' { - ret = ret*16 + rune(c-'0') - } else if c >= 'a' && c <= 'f' { - ret = ret*16 + rune(c-'a'+10) - } else if c >= 'A' && c <= 'F' { - ret = ret*16 + rune(c-'A'+10) - } else { - iter.ReportError("readU4", "expects 0~9 or a~f, but found "+string([]byte{c})) - return - } - } - return ret -} - -const ( - t1 = 0x00 // 0000 0000 - tx = 0x80 // 1000 0000 - t2 = 0xC0 // 1100 0000 - t3 = 0xE0 // 1110 0000 - t4 = 0xF0 // 1111 0000 - t5 = 0xF8 // 1111 1000 - - maskx = 0x3F // 0011 1111 - mask2 = 0x1F // 0001 1111 - mask3 = 0x0F // 0000 1111 - mask4 = 0x07 // 0000 0111 - - rune1Max = 1<<7 - 1 - rune2Max = 1<<11 - 1 - rune3Max = 1<<16 - 1 - - surrogateMin = 0xD800 - surrogateMax = 0xDFFF - - maxRune = '\U0010FFFF' // Maximum valid Unicode code point. - runeError = '\uFFFD' // the "error" Rune or "Unicode replacement character" -) - -func appendRune(p []byte, r rune) []byte { - // Negative values are erroneous. Making it unsigned addresses the problem. - switch i := uint32(r); { - case i <= rune1Max: - p = append(p, byte(r)) - return p - case i <= rune2Max: - p = append(p, t2|byte(r>>6)) - p = append(p, tx|byte(r)&maskx) - return p - case i > maxRune, surrogateMin <= i && i <= surrogateMax: - r = runeError - fallthrough - case i <= rune3Max: - p = append(p, t3|byte(r>>12)) - p = append(p, tx|byte(r>>6)&maskx) - p = append(p, tx|byte(r)&maskx) - return p - default: - p = append(p, t4|byte(r>>18)) - p = append(p, tx|byte(r>>12)&maskx) - p = append(p, tx|byte(r>>6)&maskx) - p = append(p, tx|byte(r)&maskx) - return p - } -} diff --git a/vendor/github.com/json-iterator/go/jsoniter.go b/vendor/github.com/json-iterator/go/jsoniter.go deleted file mode 100644 index c2934f916..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter.go +++ /dev/null @@ -1,18 +0,0 @@ -// Package jsoniter implements encoding and decoding of JSON as defined in -// RFC 4627 and provides interfaces with identical syntax of standard lib encoding/json. -// Converting from encoding/json to jsoniter is no more than replacing the package with jsoniter -// and variable type declarations (if any). -// jsoniter interfaces gives 100% compatibility with code using standard lib. -// -// "JSON and Go" -// (https://golang.org/doc/articles/json_and_go.html) -// gives a description of how Marshal/Unmarshal operate -// between arbitrary or predefined json objects and bytes, -// and it applies to jsoniter.Marshal/Unmarshal as well. -// -// Besides, jsoniter.Iterator provides a different set of interfaces -// iterating given bytes/string/reader -// and yielding parsed elements one by one. -// This set of interfaces reads input as required and gives -// better performance. -package jsoniter diff --git a/vendor/github.com/json-iterator/go/pool.go b/vendor/github.com/json-iterator/go/pool.go deleted file mode 100644 index e2389b56c..000000000 --- a/vendor/github.com/json-iterator/go/pool.go +++ /dev/null @@ -1,42 +0,0 @@ -package jsoniter - -import ( - "io" -) - -// IteratorPool a thread safe pool of iterators with same configuration -type IteratorPool interface { - BorrowIterator(data []byte) *Iterator - ReturnIterator(iter *Iterator) -} - -// StreamPool a thread safe pool of streams with same configuration -type StreamPool interface { - BorrowStream(writer io.Writer) *Stream - ReturnStream(stream *Stream) -} - -func (cfg *frozenConfig) BorrowStream(writer io.Writer) *Stream { - stream := cfg.streamPool.Get().(*Stream) - stream.Reset(writer) - return stream -} - -func (cfg *frozenConfig) ReturnStream(stream *Stream) { - stream.out = nil - stream.Error = nil - stream.Attachment = nil - cfg.streamPool.Put(stream) -} - -func (cfg *frozenConfig) BorrowIterator(data []byte) *Iterator { - iter := cfg.iteratorPool.Get().(*Iterator) - iter.ResetBytes(data) - return iter -} - -func (cfg *frozenConfig) ReturnIterator(iter *Iterator) { - iter.Error = nil - iter.Attachment = nil - cfg.iteratorPool.Put(iter) -} diff --git a/vendor/github.com/json-iterator/go/reflect.go b/vendor/github.com/json-iterator/go/reflect.go deleted file mode 100644 index 39acb320a..000000000 --- a/vendor/github.com/json-iterator/go/reflect.go +++ /dev/null @@ -1,337 +0,0 @@ -package jsoniter - -import ( - "fmt" - "reflect" - "unsafe" - - "github.com/modern-go/reflect2" -) - -// ValDecoder is an internal type registered to cache as needed. -// Don't confuse jsoniter.ValDecoder with json.Decoder. -// For json.Decoder's adapter, refer to jsoniter.AdapterDecoder(todo link). -// -// Reflection on type to create decoders, which is then cached -// Reflection on value is avoided as we can, as the reflect.Value itself will allocate, with following exceptions -// 1. create instance of new value, for example *int will need a int to be allocated -// 2. append to slice, if the existing cap is not enough, allocate will be done using Reflect.New -// 3. assignment to map, both key and value will be reflect.Value -// For a simple struct binding, it will be reflect.Value free and allocation free -type ValDecoder interface { - Decode(ptr unsafe.Pointer, iter *Iterator) -} - -// ValEncoder is an internal type registered to cache as needed. -// Don't confuse jsoniter.ValEncoder with json.Encoder. -// For json.Encoder's adapter, refer to jsoniter.AdapterEncoder(todo godoc link). -type ValEncoder interface { - IsEmpty(ptr unsafe.Pointer) bool - Encode(ptr unsafe.Pointer, stream *Stream) -} - -type checkIsEmpty interface { - IsEmpty(ptr unsafe.Pointer) bool -} - -type ctx struct { - *frozenConfig - prefix string - encoders map[reflect2.Type]ValEncoder - decoders map[reflect2.Type]ValDecoder -} - -func (b *ctx) caseSensitive() bool { - if b.frozenConfig == nil { - // default is case-insensitive - return false - } - return b.frozenConfig.caseSensitive -} - -func (b *ctx) append(prefix string) *ctx { - return &ctx{ - frozenConfig: b.frozenConfig, - prefix: b.prefix + " " + prefix, - encoders: b.encoders, - decoders: b.decoders, - } -} - -// ReadVal copy the underlying JSON into go interface, same as json.Unmarshal -func (iter *Iterator) ReadVal(obj interface{}) { - depth := iter.depth - cacheKey := reflect2.RTypeOf(obj) - decoder := iter.cfg.getDecoderFromCache(cacheKey) - if decoder == nil { - typ := reflect2.TypeOf(obj) - if typ == nil || typ.Kind() != reflect.Ptr { - iter.ReportError("ReadVal", "can only unmarshal into pointer") - return - } - decoder = iter.cfg.DecoderOf(typ) - } - ptr := reflect2.PtrOf(obj) - if ptr == nil { - iter.ReportError("ReadVal", "can not read into nil pointer") - return - } - decoder.Decode(ptr, iter) - if iter.depth != depth { - iter.ReportError("ReadVal", "unexpected mismatched nesting") - return - } -} - -// WriteVal copy the go interface into underlying JSON, same as json.Marshal -func (stream *Stream) WriteVal(val interface{}) { - if nil == val { - stream.WriteNil() - return - } - cacheKey := reflect2.RTypeOf(val) - encoder := stream.cfg.getEncoderFromCache(cacheKey) - if encoder == nil { - typ := reflect2.TypeOf(val) - encoder = stream.cfg.EncoderOf(typ) - } - encoder.Encode(reflect2.PtrOf(val), stream) -} - -func (cfg *frozenConfig) DecoderOf(typ reflect2.Type) ValDecoder { - cacheKey := typ.RType() - decoder := cfg.getDecoderFromCache(cacheKey) - if decoder != nil { - return decoder - } - ctx := &ctx{ - frozenConfig: cfg, - prefix: "", - decoders: map[reflect2.Type]ValDecoder{}, - encoders: map[reflect2.Type]ValEncoder{}, - } - ptrType := typ.(*reflect2.UnsafePtrType) - decoder = decoderOfType(ctx, ptrType.Elem()) - cfg.addDecoderToCache(cacheKey, decoder) - return decoder -} - -func decoderOfType(ctx *ctx, typ reflect2.Type) ValDecoder { - decoder := getTypeDecoderFromExtension(ctx, typ) - if decoder != nil { - return decoder - } - decoder = createDecoderOfType(ctx, typ) - for _, extension := range extensions { - decoder = extension.DecorateDecoder(typ, decoder) - } - decoder = ctx.decoderExtension.DecorateDecoder(typ, decoder) - for _, extension := range ctx.extraExtensions { - decoder = extension.DecorateDecoder(typ, decoder) - } - return decoder -} - -func createDecoderOfType(ctx *ctx, typ reflect2.Type) ValDecoder { - decoder := ctx.decoders[typ] - if decoder != nil { - return decoder - } - placeholder := &placeholderDecoder{} - ctx.decoders[typ] = placeholder - decoder = _createDecoderOfType(ctx, typ) - placeholder.decoder = decoder - return decoder -} - -func _createDecoderOfType(ctx *ctx, typ reflect2.Type) ValDecoder { - decoder := createDecoderOfJsonRawMessage(ctx, typ) - if decoder != nil { - return decoder - } - decoder = createDecoderOfJsonNumber(ctx, typ) - if decoder != nil { - return decoder - } - decoder = createDecoderOfMarshaler(ctx, typ) - if decoder != nil { - return decoder - } - decoder = createDecoderOfAny(ctx, typ) - if decoder != nil { - return decoder - } - decoder = createDecoderOfNative(ctx, typ) - if decoder != nil { - return decoder - } - switch typ.Kind() { - case reflect.Interface: - ifaceType, isIFace := typ.(*reflect2.UnsafeIFaceType) - if isIFace { - return &ifaceDecoder{valType: ifaceType} - } - return &efaceDecoder{} - case reflect.Struct: - return decoderOfStruct(ctx, typ) - case reflect.Array: - return decoderOfArray(ctx, typ) - case reflect.Slice: - return decoderOfSlice(ctx, typ) - case reflect.Map: - return decoderOfMap(ctx, typ) - case reflect.Ptr: - return decoderOfOptional(ctx, typ) - default: - return &lazyErrorDecoder{err: fmt.Errorf("%s%s is unsupported type", ctx.prefix, typ.String())} - } -} - -func (cfg *frozenConfig) EncoderOf(typ reflect2.Type) ValEncoder { - cacheKey := typ.RType() - encoder := cfg.getEncoderFromCache(cacheKey) - if encoder != nil { - return encoder - } - ctx := &ctx{ - frozenConfig: cfg, - prefix: "", - decoders: map[reflect2.Type]ValDecoder{}, - encoders: map[reflect2.Type]ValEncoder{}, - } - encoder = encoderOfType(ctx, typ) - if typ.LikePtr() { - encoder = &onePtrEncoder{encoder} - } - cfg.addEncoderToCache(cacheKey, encoder) - return encoder -} - -type onePtrEncoder struct { - encoder ValEncoder -} - -func (encoder *onePtrEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.encoder.IsEmpty(unsafe.Pointer(&ptr)) -} - -func (encoder *onePtrEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - encoder.encoder.Encode(unsafe.Pointer(&ptr), stream) -} - -func encoderOfType(ctx *ctx, typ reflect2.Type) ValEncoder { - encoder := getTypeEncoderFromExtension(ctx, typ) - if encoder != nil { - return encoder - } - encoder = createEncoderOfType(ctx, typ) - for _, extension := range extensions { - encoder = extension.DecorateEncoder(typ, encoder) - } - encoder = ctx.encoderExtension.DecorateEncoder(typ, encoder) - for _, extension := range ctx.extraExtensions { - encoder = extension.DecorateEncoder(typ, encoder) - } - return encoder -} - -func createEncoderOfType(ctx *ctx, typ reflect2.Type) ValEncoder { - encoder := ctx.encoders[typ] - if encoder != nil { - return encoder - } - placeholder := &placeholderEncoder{} - ctx.encoders[typ] = placeholder - encoder = _createEncoderOfType(ctx, typ) - placeholder.encoder = encoder - return encoder -} -func _createEncoderOfType(ctx *ctx, typ reflect2.Type) ValEncoder { - encoder := createEncoderOfJsonRawMessage(ctx, typ) - if encoder != nil { - return encoder - } - encoder = createEncoderOfJsonNumber(ctx, typ) - if encoder != nil { - return encoder - } - encoder = createEncoderOfMarshaler(ctx, typ) - if encoder != nil { - return encoder - } - encoder = createEncoderOfAny(ctx, typ) - if encoder != nil { - return encoder - } - encoder = createEncoderOfNative(ctx, typ) - if encoder != nil { - return encoder - } - kind := typ.Kind() - switch kind { - case reflect.Interface: - return &dynamicEncoder{typ} - case reflect.Struct: - return encoderOfStruct(ctx, typ) - case reflect.Array: - return encoderOfArray(ctx, typ) - case reflect.Slice: - return encoderOfSlice(ctx, typ) - case reflect.Map: - return encoderOfMap(ctx, typ) - case reflect.Ptr: - return encoderOfOptional(ctx, typ) - default: - return &lazyErrorEncoder{err: fmt.Errorf("%s%s is unsupported type", ctx.prefix, typ.String())} - } -} - -type lazyErrorDecoder struct { - err error -} - -func (decoder *lazyErrorDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if iter.WhatIsNext() != NilValue { - if iter.Error == nil { - iter.Error = decoder.err - } - } else { - iter.Skip() - } -} - -type lazyErrorEncoder struct { - err error -} - -func (encoder *lazyErrorEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - if ptr == nil { - stream.WriteNil() - } else if stream.Error == nil { - stream.Error = encoder.err - } -} - -func (encoder *lazyErrorEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return false -} - -type placeholderDecoder struct { - decoder ValDecoder -} - -func (decoder *placeholderDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - decoder.decoder.Decode(ptr, iter) -} - -type placeholderEncoder struct { - encoder ValEncoder -} - -func (encoder *placeholderEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - encoder.encoder.Encode(ptr, stream) -} - -func (encoder *placeholderEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.encoder.IsEmpty(ptr) -} diff --git a/vendor/github.com/json-iterator/go/reflect_array.go b/vendor/github.com/json-iterator/go/reflect_array.go deleted file mode 100644 index 13a0b7b08..000000000 --- a/vendor/github.com/json-iterator/go/reflect_array.go +++ /dev/null @@ -1,104 +0,0 @@ -package jsoniter - -import ( - "fmt" - "github.com/modern-go/reflect2" - "io" - "unsafe" -) - -func decoderOfArray(ctx *ctx, typ reflect2.Type) ValDecoder { - arrayType := typ.(*reflect2.UnsafeArrayType) - decoder := decoderOfType(ctx.append("[arrayElem]"), arrayType.Elem()) - return &arrayDecoder{arrayType, decoder} -} - -func encoderOfArray(ctx *ctx, typ reflect2.Type) ValEncoder { - arrayType := typ.(*reflect2.UnsafeArrayType) - if arrayType.Len() == 0 { - return emptyArrayEncoder{} - } - encoder := encoderOfType(ctx.append("[arrayElem]"), arrayType.Elem()) - return &arrayEncoder{arrayType, encoder} -} - -type emptyArrayEncoder struct{} - -func (encoder emptyArrayEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteEmptyArray() -} - -func (encoder emptyArrayEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return true -} - -type arrayEncoder struct { - arrayType *reflect2.UnsafeArrayType - elemEncoder ValEncoder -} - -func (encoder *arrayEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteArrayStart() - elemPtr := unsafe.Pointer(ptr) - encoder.elemEncoder.Encode(elemPtr, stream) - for i := 1; i < encoder.arrayType.Len(); i++ { - stream.WriteMore() - elemPtr = encoder.arrayType.UnsafeGetIndex(ptr, i) - encoder.elemEncoder.Encode(elemPtr, stream) - } - stream.WriteArrayEnd() - if stream.Error != nil && stream.Error != io.EOF { - stream.Error = fmt.Errorf("%v: %s", encoder.arrayType, stream.Error.Error()) - } -} - -func (encoder *arrayEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return false -} - -type arrayDecoder struct { - arrayType *reflect2.UnsafeArrayType - elemDecoder ValDecoder -} - -func (decoder *arrayDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - decoder.doDecode(ptr, iter) - if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%v: %s", decoder.arrayType, iter.Error.Error()) - } -} - -func (decoder *arrayDecoder) doDecode(ptr unsafe.Pointer, iter *Iterator) { - c := iter.nextToken() - arrayType := decoder.arrayType - if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') - return - } - if c != '[' { - iter.ReportError("decode array", "expect [ or n, but found "+string([]byte{c})) - return - } - c = iter.nextToken() - if c == ']' { - return - } - iter.unreadByte() - elemPtr := arrayType.UnsafeGetIndex(ptr, 0) - decoder.elemDecoder.Decode(elemPtr, iter) - length := 1 - for c = iter.nextToken(); c == ','; c = iter.nextToken() { - if length >= arrayType.Len() { - iter.Skip() - continue - } - idx := length - length += 1 - elemPtr = arrayType.UnsafeGetIndex(ptr, idx) - decoder.elemDecoder.Decode(elemPtr, iter) - } - if c != ']' { - iter.ReportError("decode array", "expect ], but found "+string([]byte{c})) - return - } -} diff --git a/vendor/github.com/json-iterator/go/reflect_dynamic.go b/vendor/github.com/json-iterator/go/reflect_dynamic.go deleted file mode 100644 index 8b6bc8b43..000000000 --- a/vendor/github.com/json-iterator/go/reflect_dynamic.go +++ /dev/null @@ -1,70 +0,0 @@ -package jsoniter - -import ( - "github.com/modern-go/reflect2" - "reflect" - "unsafe" -) - -type dynamicEncoder struct { - valType reflect2.Type -} - -func (encoder *dynamicEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - obj := encoder.valType.UnsafeIndirect(ptr) - stream.WriteVal(obj) -} - -func (encoder *dynamicEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.valType.UnsafeIndirect(ptr) == nil -} - -type efaceDecoder struct { -} - -func (decoder *efaceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - pObj := (*interface{})(ptr) - obj := *pObj - if obj == nil { - *pObj = iter.Read() - return - } - typ := reflect2.TypeOf(obj) - if typ.Kind() != reflect.Ptr { - *pObj = iter.Read() - return - } - ptrType := typ.(*reflect2.UnsafePtrType) - ptrElemType := ptrType.Elem() - if iter.WhatIsNext() == NilValue { - if ptrElemType.Kind() != reflect.Ptr { - iter.skipFourBytes('n', 'u', 'l', 'l') - *pObj = nil - return - } - } - if reflect2.IsNil(obj) { - obj := ptrElemType.New() - iter.ReadVal(obj) - *pObj = obj - return - } - iter.ReadVal(obj) -} - -type ifaceDecoder struct { - valType *reflect2.UnsafeIFaceType -} - -func (decoder *ifaceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if iter.ReadNil() { - decoder.valType.UnsafeSet(ptr, decoder.valType.UnsafeNew()) - return - } - obj := decoder.valType.UnsafeIndirect(ptr) - if reflect2.IsNil(obj) { - iter.ReportError("decode non empty interface", "can not unmarshal into nil") - return - } - iter.ReadVal(obj) -} diff --git a/vendor/github.com/json-iterator/go/reflect_extension.go b/vendor/github.com/json-iterator/go/reflect_extension.go deleted file mode 100644 index 74a97bfe5..000000000 --- a/vendor/github.com/json-iterator/go/reflect_extension.go +++ /dev/null @@ -1,483 +0,0 @@ -package jsoniter - -import ( - "fmt" - "github.com/modern-go/reflect2" - "reflect" - "sort" - "strings" - "unicode" - "unsafe" -) - -var typeDecoders = map[string]ValDecoder{} -var fieldDecoders = map[string]ValDecoder{} -var typeEncoders = map[string]ValEncoder{} -var fieldEncoders = map[string]ValEncoder{} -var extensions = []Extension{} - -// StructDescriptor describe how should we encode/decode the struct -type StructDescriptor struct { - Type reflect2.Type - Fields []*Binding -} - -// GetField get one field from the descriptor by its name. -// Can not use map here to keep field orders. -func (structDescriptor *StructDescriptor) GetField(fieldName string) *Binding { - for _, binding := range structDescriptor.Fields { - if binding.Field.Name() == fieldName { - return binding - } - } - return nil -} - -// Binding describe how should we encode/decode the struct field -type Binding struct { - levels []int - Field reflect2.StructField - FromNames []string - ToNames []string - Encoder ValEncoder - Decoder ValDecoder -} - -// Extension the one for all SPI. Customize encoding/decoding by specifying alternate encoder/decoder. -// Can also rename fields by UpdateStructDescriptor. -type Extension interface { - UpdateStructDescriptor(structDescriptor *StructDescriptor) - CreateMapKeyDecoder(typ reflect2.Type) ValDecoder - CreateMapKeyEncoder(typ reflect2.Type) ValEncoder - CreateDecoder(typ reflect2.Type) ValDecoder - CreateEncoder(typ reflect2.Type) ValEncoder - DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder - DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder -} - -// DummyExtension embed this type get dummy implementation for all methods of Extension -type DummyExtension struct { -} - -// UpdateStructDescriptor No-op -func (extension *DummyExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) { -} - -// CreateMapKeyDecoder No-op -func (extension *DummyExtension) CreateMapKeyDecoder(typ reflect2.Type) ValDecoder { - return nil -} - -// CreateMapKeyEncoder No-op -func (extension *DummyExtension) CreateMapKeyEncoder(typ reflect2.Type) ValEncoder { - return nil -} - -// CreateDecoder No-op -func (extension *DummyExtension) CreateDecoder(typ reflect2.Type) ValDecoder { - return nil -} - -// CreateEncoder No-op -func (extension *DummyExtension) CreateEncoder(typ reflect2.Type) ValEncoder { - return nil -} - -// DecorateDecoder No-op -func (extension *DummyExtension) DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder { - return decoder -} - -// DecorateEncoder No-op -func (extension *DummyExtension) DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder { - return encoder -} - -type EncoderExtension map[reflect2.Type]ValEncoder - -// UpdateStructDescriptor No-op -func (extension EncoderExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) { -} - -// CreateDecoder No-op -func (extension EncoderExtension) CreateDecoder(typ reflect2.Type) ValDecoder { - return nil -} - -// CreateEncoder get encoder from map -func (extension EncoderExtension) CreateEncoder(typ reflect2.Type) ValEncoder { - return extension[typ] -} - -// CreateMapKeyDecoder No-op -func (extension EncoderExtension) CreateMapKeyDecoder(typ reflect2.Type) ValDecoder { - return nil -} - -// CreateMapKeyEncoder No-op -func (extension EncoderExtension) CreateMapKeyEncoder(typ reflect2.Type) ValEncoder { - return nil -} - -// DecorateDecoder No-op -func (extension EncoderExtension) DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder { - return decoder -} - -// DecorateEncoder No-op -func (extension EncoderExtension) DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder { - return encoder -} - -type DecoderExtension map[reflect2.Type]ValDecoder - -// UpdateStructDescriptor No-op -func (extension DecoderExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) { -} - -// CreateMapKeyDecoder No-op -func (extension DecoderExtension) CreateMapKeyDecoder(typ reflect2.Type) ValDecoder { - return nil -} - -// CreateMapKeyEncoder No-op -func (extension DecoderExtension) CreateMapKeyEncoder(typ reflect2.Type) ValEncoder { - return nil -} - -// CreateDecoder get decoder from map -func (extension DecoderExtension) CreateDecoder(typ reflect2.Type) ValDecoder { - return extension[typ] -} - -// CreateEncoder No-op -func (extension DecoderExtension) CreateEncoder(typ reflect2.Type) ValEncoder { - return nil -} - -// DecorateDecoder No-op -func (extension DecoderExtension) DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder { - return decoder -} - -// DecorateEncoder No-op -func (extension DecoderExtension) DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder { - return encoder -} - -type funcDecoder struct { - fun DecoderFunc -} - -func (decoder *funcDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - decoder.fun(ptr, iter) -} - -type funcEncoder struct { - fun EncoderFunc - isEmptyFunc func(ptr unsafe.Pointer) bool -} - -func (encoder *funcEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - encoder.fun(ptr, stream) -} - -func (encoder *funcEncoder) IsEmpty(ptr unsafe.Pointer) bool { - if encoder.isEmptyFunc == nil { - return false - } - return encoder.isEmptyFunc(ptr) -} - -// DecoderFunc the function form of TypeDecoder -type DecoderFunc func(ptr unsafe.Pointer, iter *Iterator) - -// EncoderFunc the function form of TypeEncoder -type EncoderFunc func(ptr unsafe.Pointer, stream *Stream) - -// RegisterTypeDecoderFunc register TypeDecoder for a type with function -func RegisterTypeDecoderFunc(typ string, fun DecoderFunc) { - typeDecoders[typ] = &funcDecoder{fun} -} - -// RegisterTypeDecoder register TypeDecoder for a typ -func RegisterTypeDecoder(typ string, decoder ValDecoder) { - typeDecoders[typ] = decoder -} - -// RegisterFieldDecoderFunc register TypeDecoder for a struct field with function -func RegisterFieldDecoderFunc(typ string, field string, fun DecoderFunc) { - RegisterFieldDecoder(typ, field, &funcDecoder{fun}) -} - -// RegisterFieldDecoder register TypeDecoder for a struct field -func RegisterFieldDecoder(typ string, field string, decoder ValDecoder) { - fieldDecoders[fmt.Sprintf("%s/%s", typ, field)] = decoder -} - -// RegisterTypeEncoderFunc register TypeEncoder for a type with encode/isEmpty function -func RegisterTypeEncoderFunc(typ string, fun EncoderFunc, isEmptyFunc func(unsafe.Pointer) bool) { - typeEncoders[typ] = &funcEncoder{fun, isEmptyFunc} -} - -// RegisterTypeEncoder register TypeEncoder for a type -func RegisterTypeEncoder(typ string, encoder ValEncoder) { - typeEncoders[typ] = encoder -} - -// RegisterFieldEncoderFunc register TypeEncoder for a struct field with encode/isEmpty function -func RegisterFieldEncoderFunc(typ string, field string, fun EncoderFunc, isEmptyFunc func(unsafe.Pointer) bool) { - RegisterFieldEncoder(typ, field, &funcEncoder{fun, isEmptyFunc}) -} - -// RegisterFieldEncoder register TypeEncoder for a struct field -func RegisterFieldEncoder(typ string, field string, encoder ValEncoder) { - fieldEncoders[fmt.Sprintf("%s/%s", typ, field)] = encoder -} - -// RegisterExtension register extension -func RegisterExtension(extension Extension) { - extensions = append(extensions, extension) -} - -func getTypeDecoderFromExtension(ctx *ctx, typ reflect2.Type) ValDecoder { - decoder := _getTypeDecoderFromExtension(ctx, typ) - if decoder != nil { - for _, extension := range extensions { - decoder = extension.DecorateDecoder(typ, decoder) - } - decoder = ctx.decoderExtension.DecorateDecoder(typ, decoder) - for _, extension := range ctx.extraExtensions { - decoder = extension.DecorateDecoder(typ, decoder) - } - } - return decoder -} -func _getTypeDecoderFromExtension(ctx *ctx, typ reflect2.Type) ValDecoder { - for _, extension := range extensions { - decoder := extension.CreateDecoder(typ) - if decoder != nil { - return decoder - } - } - decoder := ctx.decoderExtension.CreateDecoder(typ) - if decoder != nil { - return decoder - } - for _, extension := range ctx.extraExtensions { - decoder := extension.CreateDecoder(typ) - if decoder != nil { - return decoder - } - } - typeName := typ.String() - decoder = typeDecoders[typeName] - if decoder != nil { - return decoder - } - if typ.Kind() == reflect.Ptr { - ptrType := typ.(*reflect2.UnsafePtrType) - decoder := typeDecoders[ptrType.Elem().String()] - if decoder != nil { - return &OptionalDecoder{ptrType.Elem(), decoder} - } - } - return nil -} - -func getTypeEncoderFromExtension(ctx *ctx, typ reflect2.Type) ValEncoder { - encoder := _getTypeEncoderFromExtension(ctx, typ) - if encoder != nil { - for _, extension := range extensions { - encoder = extension.DecorateEncoder(typ, encoder) - } - encoder = ctx.encoderExtension.DecorateEncoder(typ, encoder) - for _, extension := range ctx.extraExtensions { - encoder = extension.DecorateEncoder(typ, encoder) - } - } - return encoder -} - -func _getTypeEncoderFromExtension(ctx *ctx, typ reflect2.Type) ValEncoder { - for _, extension := range extensions { - encoder := extension.CreateEncoder(typ) - if encoder != nil { - return encoder - } - } - encoder := ctx.encoderExtension.CreateEncoder(typ) - if encoder != nil { - return encoder - } - for _, extension := range ctx.extraExtensions { - encoder := extension.CreateEncoder(typ) - if encoder != nil { - return encoder - } - } - typeName := typ.String() - encoder = typeEncoders[typeName] - if encoder != nil { - return encoder - } - if typ.Kind() == reflect.Ptr { - typePtr := typ.(*reflect2.UnsafePtrType) - encoder := typeEncoders[typePtr.Elem().String()] - if encoder != nil { - return &OptionalEncoder{encoder} - } - } - return nil -} - -func describeStruct(ctx *ctx, typ reflect2.Type) *StructDescriptor { - structType := typ.(*reflect2.UnsafeStructType) - embeddedBindings := []*Binding{} - bindings := []*Binding{} - for i := 0; i < structType.NumField(); i++ { - field := structType.Field(i) - tag, hastag := field.Tag().Lookup(ctx.getTagKey()) - if ctx.onlyTaggedField && !hastag && !field.Anonymous() { - continue - } - if tag == "-" || field.Name() == "_" { - continue - } - tagParts := strings.Split(tag, ",") - if field.Anonymous() && (tag == "" || tagParts[0] == "") { - if field.Type().Kind() == reflect.Struct { - structDescriptor := describeStruct(ctx, field.Type()) - for _, binding := range structDescriptor.Fields { - binding.levels = append([]int{i}, binding.levels...) - omitempty := binding.Encoder.(*structFieldEncoder).omitempty - binding.Encoder = &structFieldEncoder{field, binding.Encoder, omitempty} - binding.Decoder = &structFieldDecoder{field, binding.Decoder} - embeddedBindings = append(embeddedBindings, binding) - } - continue - } else if field.Type().Kind() == reflect.Ptr { - ptrType := field.Type().(*reflect2.UnsafePtrType) - if ptrType.Elem().Kind() == reflect.Struct { - structDescriptor := describeStruct(ctx, ptrType.Elem()) - for _, binding := range structDescriptor.Fields { - binding.levels = append([]int{i}, binding.levels...) - omitempty := binding.Encoder.(*structFieldEncoder).omitempty - binding.Encoder = &dereferenceEncoder{binding.Encoder} - binding.Encoder = &structFieldEncoder{field, binding.Encoder, omitempty} - binding.Decoder = &dereferenceDecoder{ptrType.Elem(), binding.Decoder} - binding.Decoder = &structFieldDecoder{field, binding.Decoder} - embeddedBindings = append(embeddedBindings, binding) - } - continue - } - } - } - fieldNames := calcFieldNames(field.Name(), tagParts[0], tag) - fieldCacheKey := fmt.Sprintf("%s/%s", typ.String(), field.Name()) - decoder := fieldDecoders[fieldCacheKey] - if decoder == nil { - decoder = decoderOfType(ctx.append(field.Name()), field.Type()) - } - encoder := fieldEncoders[fieldCacheKey] - if encoder == nil { - encoder = encoderOfType(ctx.append(field.Name()), field.Type()) - } - binding := &Binding{ - Field: field, - FromNames: fieldNames, - ToNames: fieldNames, - Decoder: decoder, - Encoder: encoder, - } - binding.levels = []int{i} - bindings = append(bindings, binding) - } - return createStructDescriptor(ctx, typ, bindings, embeddedBindings) -} -func createStructDescriptor(ctx *ctx, typ reflect2.Type, bindings []*Binding, embeddedBindings []*Binding) *StructDescriptor { - structDescriptor := &StructDescriptor{ - Type: typ, - Fields: bindings, - } - for _, extension := range extensions { - extension.UpdateStructDescriptor(structDescriptor) - } - ctx.encoderExtension.UpdateStructDescriptor(structDescriptor) - ctx.decoderExtension.UpdateStructDescriptor(structDescriptor) - for _, extension := range ctx.extraExtensions { - extension.UpdateStructDescriptor(structDescriptor) - } - processTags(structDescriptor, ctx.frozenConfig) - // merge normal & embedded bindings & sort with original order - allBindings := sortableBindings(append(embeddedBindings, structDescriptor.Fields...)) - sort.Sort(allBindings) - structDescriptor.Fields = allBindings - return structDescriptor -} - -type sortableBindings []*Binding - -func (bindings sortableBindings) Len() int { - return len(bindings) -} - -func (bindings sortableBindings) Less(i, j int) bool { - left := bindings[i].levels - right := bindings[j].levels - k := 0 - for { - if left[k] < right[k] { - return true - } else if left[k] > right[k] { - return false - } - k++ - } -} - -func (bindings sortableBindings) Swap(i, j int) { - bindings[i], bindings[j] = bindings[j], bindings[i] -} - -func processTags(structDescriptor *StructDescriptor, cfg *frozenConfig) { - for _, binding := range structDescriptor.Fields { - shouldOmitEmpty := false - tagParts := strings.Split(binding.Field.Tag().Get(cfg.getTagKey()), ",") - for _, tagPart := range tagParts[1:] { - if tagPart == "omitempty" { - shouldOmitEmpty = true - } else if tagPart == "string" { - if binding.Field.Type().Kind() == reflect.String { - binding.Decoder = &stringModeStringDecoder{binding.Decoder, cfg} - binding.Encoder = &stringModeStringEncoder{binding.Encoder, cfg} - } else { - binding.Decoder = &stringModeNumberDecoder{binding.Decoder} - binding.Encoder = &stringModeNumberEncoder{binding.Encoder} - } - } - } - binding.Decoder = &structFieldDecoder{binding.Field, binding.Decoder} - binding.Encoder = &structFieldEncoder{binding.Field, binding.Encoder, shouldOmitEmpty} - } -} - -func calcFieldNames(originalFieldName string, tagProvidedFieldName string, wholeTag string) []string { - // ignore? - if wholeTag == "-" { - return []string{} - } - // rename? - var fieldNames []string - if tagProvidedFieldName == "" { - fieldNames = []string{originalFieldName} - } else { - fieldNames = []string{tagProvidedFieldName} - } - // private? - isNotExported := unicode.IsLower(rune(originalFieldName[0])) || originalFieldName[0] == '_' - if isNotExported { - fieldNames = []string{} - } - return fieldNames -} diff --git a/vendor/github.com/json-iterator/go/reflect_json_number.go b/vendor/github.com/json-iterator/go/reflect_json_number.go deleted file mode 100644 index 98d45c1ec..000000000 --- a/vendor/github.com/json-iterator/go/reflect_json_number.go +++ /dev/null @@ -1,112 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "github.com/modern-go/reflect2" - "strconv" - "unsafe" -) - -type Number string - -// String returns the literal text of the number. -func (n Number) String() string { return string(n) } - -// Float64 returns the number as a float64. -func (n Number) Float64() (float64, error) { - return strconv.ParseFloat(string(n), 64) -} - -// Int64 returns the number as an int64. -func (n Number) Int64() (int64, error) { - return strconv.ParseInt(string(n), 10, 64) -} - -func CastJsonNumber(val interface{}) (string, bool) { - switch typedVal := val.(type) { - case json.Number: - return string(typedVal), true - case Number: - return string(typedVal), true - } - return "", false -} - -var jsonNumberType = reflect2.TypeOfPtr((*json.Number)(nil)).Elem() -var jsoniterNumberType = reflect2.TypeOfPtr((*Number)(nil)).Elem() - -func createDecoderOfJsonNumber(ctx *ctx, typ reflect2.Type) ValDecoder { - if typ.AssignableTo(jsonNumberType) { - return &jsonNumberCodec{} - } - if typ.AssignableTo(jsoniterNumberType) { - return &jsoniterNumberCodec{} - } - return nil -} - -func createEncoderOfJsonNumber(ctx *ctx, typ reflect2.Type) ValEncoder { - if typ.AssignableTo(jsonNumberType) { - return &jsonNumberCodec{} - } - if typ.AssignableTo(jsoniterNumberType) { - return &jsoniterNumberCodec{} - } - return nil -} - -type jsonNumberCodec struct { -} - -func (codec *jsonNumberCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - switch iter.WhatIsNext() { - case StringValue: - *((*json.Number)(ptr)) = json.Number(iter.ReadString()) - case NilValue: - iter.skipFourBytes('n', 'u', 'l', 'l') - *((*json.Number)(ptr)) = "" - default: - *((*json.Number)(ptr)) = json.Number([]byte(iter.readNumberAsString())) - } -} - -func (codec *jsonNumberCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - number := *((*json.Number)(ptr)) - if len(number) == 0 { - stream.writeByte('0') - } else { - stream.WriteRaw(string(number)) - } -} - -func (codec *jsonNumberCodec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*json.Number)(ptr))) == 0 -} - -type jsoniterNumberCodec struct { -} - -func (codec *jsoniterNumberCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - switch iter.WhatIsNext() { - case StringValue: - *((*Number)(ptr)) = Number(iter.ReadString()) - case NilValue: - iter.skipFourBytes('n', 'u', 'l', 'l') - *((*Number)(ptr)) = "" - default: - *((*Number)(ptr)) = Number([]byte(iter.readNumberAsString())) - } -} - -func (codec *jsoniterNumberCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - number := *((*Number)(ptr)) - if len(number) == 0 { - stream.writeByte('0') - } else { - stream.WriteRaw(string(number)) - } -} - -func (codec *jsoniterNumberCodec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*Number)(ptr))) == 0 -} diff --git a/vendor/github.com/json-iterator/go/reflect_json_raw_message.go b/vendor/github.com/json-iterator/go/reflect_json_raw_message.go deleted file mode 100644 index eba434f2f..000000000 --- a/vendor/github.com/json-iterator/go/reflect_json_raw_message.go +++ /dev/null @@ -1,76 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "github.com/modern-go/reflect2" - "unsafe" -) - -var jsonRawMessageType = reflect2.TypeOfPtr((*json.RawMessage)(nil)).Elem() -var jsoniterRawMessageType = reflect2.TypeOfPtr((*RawMessage)(nil)).Elem() - -func createEncoderOfJsonRawMessage(ctx *ctx, typ reflect2.Type) ValEncoder { - if typ == jsonRawMessageType { - return &jsonRawMessageCodec{} - } - if typ == jsoniterRawMessageType { - return &jsoniterRawMessageCodec{} - } - return nil -} - -func createDecoderOfJsonRawMessage(ctx *ctx, typ reflect2.Type) ValDecoder { - if typ == jsonRawMessageType { - return &jsonRawMessageCodec{} - } - if typ == jsoniterRawMessageType { - return &jsoniterRawMessageCodec{} - } - return nil -} - -type jsonRawMessageCodec struct { -} - -func (codec *jsonRawMessageCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if iter.ReadNil() { - *((*json.RawMessage)(ptr)) = nil - } else { - *((*json.RawMessage)(ptr)) = iter.SkipAndReturnBytes() - } -} - -func (codec *jsonRawMessageCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - if *((*json.RawMessage)(ptr)) == nil { - stream.WriteNil() - } else { - stream.WriteRaw(string(*((*json.RawMessage)(ptr)))) - } -} - -func (codec *jsonRawMessageCodec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*json.RawMessage)(ptr))) == 0 -} - -type jsoniterRawMessageCodec struct { -} - -func (codec *jsoniterRawMessageCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if iter.ReadNil() { - *((*RawMessage)(ptr)) = nil - } else { - *((*RawMessage)(ptr)) = iter.SkipAndReturnBytes() - } -} - -func (codec *jsoniterRawMessageCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - if *((*RawMessage)(ptr)) == nil { - stream.WriteNil() - } else { - stream.WriteRaw(string(*((*RawMessage)(ptr)))) - } -} - -func (codec *jsoniterRawMessageCodec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*RawMessage)(ptr))) == 0 -} diff --git a/vendor/github.com/json-iterator/go/reflect_map.go b/vendor/github.com/json-iterator/go/reflect_map.go deleted file mode 100644 index 582967130..000000000 --- a/vendor/github.com/json-iterator/go/reflect_map.go +++ /dev/null @@ -1,346 +0,0 @@ -package jsoniter - -import ( - "fmt" - "github.com/modern-go/reflect2" - "io" - "reflect" - "sort" - "unsafe" -) - -func decoderOfMap(ctx *ctx, typ reflect2.Type) ValDecoder { - mapType := typ.(*reflect2.UnsafeMapType) - keyDecoder := decoderOfMapKey(ctx.append("[mapKey]"), mapType.Key()) - elemDecoder := decoderOfType(ctx.append("[mapElem]"), mapType.Elem()) - return &mapDecoder{ - mapType: mapType, - keyType: mapType.Key(), - elemType: mapType.Elem(), - keyDecoder: keyDecoder, - elemDecoder: elemDecoder, - } -} - -func encoderOfMap(ctx *ctx, typ reflect2.Type) ValEncoder { - mapType := typ.(*reflect2.UnsafeMapType) - if ctx.sortMapKeys { - return &sortKeysMapEncoder{ - mapType: mapType, - keyEncoder: encoderOfMapKey(ctx.append("[mapKey]"), mapType.Key()), - elemEncoder: encoderOfType(ctx.append("[mapElem]"), mapType.Elem()), - } - } - return &mapEncoder{ - mapType: mapType, - keyEncoder: encoderOfMapKey(ctx.append("[mapKey]"), mapType.Key()), - elemEncoder: encoderOfType(ctx.append("[mapElem]"), mapType.Elem()), - } -} - -func decoderOfMapKey(ctx *ctx, typ reflect2.Type) ValDecoder { - decoder := ctx.decoderExtension.CreateMapKeyDecoder(typ) - if decoder != nil { - return decoder - } - for _, extension := range ctx.extraExtensions { - decoder := extension.CreateMapKeyDecoder(typ) - if decoder != nil { - return decoder - } - } - - ptrType := reflect2.PtrTo(typ) - if ptrType.Implements(unmarshalerType) { - return &referenceDecoder{ - &unmarshalerDecoder{ - valType: ptrType, - }, - } - } - if typ.Implements(unmarshalerType) { - return &unmarshalerDecoder{ - valType: typ, - } - } - if ptrType.Implements(textUnmarshalerType) { - return &referenceDecoder{ - &textUnmarshalerDecoder{ - valType: ptrType, - }, - } - } - if typ.Implements(textUnmarshalerType) { - return &textUnmarshalerDecoder{ - valType: typ, - } - } - - switch typ.Kind() { - case reflect.String: - return decoderOfType(ctx, reflect2.DefaultTypeOfKind(reflect.String)) - case reflect.Bool, - reflect.Uint8, reflect.Int8, - reflect.Uint16, reflect.Int16, - reflect.Uint32, reflect.Int32, - reflect.Uint64, reflect.Int64, - reflect.Uint, reflect.Int, - reflect.Float32, reflect.Float64, - reflect.Uintptr: - typ = reflect2.DefaultTypeOfKind(typ.Kind()) - return &numericMapKeyDecoder{decoderOfType(ctx, typ)} - default: - return &lazyErrorDecoder{err: fmt.Errorf("unsupported map key type: %v", typ)} - } -} - -func encoderOfMapKey(ctx *ctx, typ reflect2.Type) ValEncoder { - encoder := ctx.encoderExtension.CreateMapKeyEncoder(typ) - if encoder != nil { - return encoder - } - for _, extension := range ctx.extraExtensions { - encoder := extension.CreateMapKeyEncoder(typ) - if encoder != nil { - return encoder - } - } - - if typ == textMarshalerType { - return &directTextMarshalerEncoder{ - stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), - } - } - if typ.Implements(textMarshalerType) { - return &textMarshalerEncoder{ - valType: typ, - stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), - } - } - - switch typ.Kind() { - case reflect.String: - return encoderOfType(ctx, reflect2.DefaultTypeOfKind(reflect.String)) - case reflect.Bool, - reflect.Uint8, reflect.Int8, - reflect.Uint16, reflect.Int16, - reflect.Uint32, reflect.Int32, - reflect.Uint64, reflect.Int64, - reflect.Uint, reflect.Int, - reflect.Float32, reflect.Float64, - reflect.Uintptr: - typ = reflect2.DefaultTypeOfKind(typ.Kind()) - return &numericMapKeyEncoder{encoderOfType(ctx, typ)} - default: - if typ.Kind() == reflect.Interface { - return &dynamicMapKeyEncoder{ctx, typ} - } - return &lazyErrorEncoder{err: fmt.Errorf("unsupported map key type: %v", typ)} - } -} - -type mapDecoder struct { - mapType *reflect2.UnsafeMapType - keyType reflect2.Type - elemType reflect2.Type - keyDecoder ValDecoder - elemDecoder ValDecoder -} - -func (decoder *mapDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - mapType := decoder.mapType - c := iter.nextToken() - if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') - *(*unsafe.Pointer)(ptr) = nil - mapType.UnsafeSet(ptr, mapType.UnsafeNew()) - return - } - if mapType.UnsafeIsNil(ptr) { - mapType.UnsafeSet(ptr, mapType.UnsafeMakeMap(0)) - } - if c != '{' { - iter.ReportError("ReadMapCB", `expect { or n, but found `+string([]byte{c})) - return - } - c = iter.nextToken() - if c == '}' { - return - } - iter.unreadByte() - key := decoder.keyType.UnsafeNew() - decoder.keyDecoder.Decode(key, iter) - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadMapCB", "expect : after object field, but found "+string([]byte{c})) - return - } - elem := decoder.elemType.UnsafeNew() - decoder.elemDecoder.Decode(elem, iter) - decoder.mapType.UnsafeSetIndex(ptr, key, elem) - for c = iter.nextToken(); c == ','; c = iter.nextToken() { - key := decoder.keyType.UnsafeNew() - decoder.keyDecoder.Decode(key, iter) - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadMapCB", "expect : after object field, but found "+string([]byte{c})) - return - } - elem := decoder.elemType.UnsafeNew() - decoder.elemDecoder.Decode(elem, iter) - decoder.mapType.UnsafeSetIndex(ptr, key, elem) - } - if c != '}' { - iter.ReportError("ReadMapCB", `expect }, but found `+string([]byte{c})) - } -} - -type numericMapKeyDecoder struct { - decoder ValDecoder -} - -func (decoder *numericMapKeyDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - c := iter.nextToken() - if c != '"' { - iter.ReportError("ReadMapCB", `expect ", but found `+string([]byte{c})) - return - } - decoder.decoder.Decode(ptr, iter) - c = iter.nextToken() - if c != '"' { - iter.ReportError("ReadMapCB", `expect ", but found `+string([]byte{c})) - return - } -} - -type numericMapKeyEncoder struct { - encoder ValEncoder -} - -func (encoder *numericMapKeyEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.writeByte('"') - encoder.encoder.Encode(ptr, stream) - stream.writeByte('"') -} - -func (encoder *numericMapKeyEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return false -} - -type dynamicMapKeyEncoder struct { - ctx *ctx - valType reflect2.Type -} - -func (encoder *dynamicMapKeyEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - obj := encoder.valType.UnsafeIndirect(ptr) - encoderOfMapKey(encoder.ctx, reflect2.TypeOf(obj)).Encode(reflect2.PtrOf(obj), stream) -} - -func (encoder *dynamicMapKeyEncoder) IsEmpty(ptr unsafe.Pointer) bool { - obj := encoder.valType.UnsafeIndirect(ptr) - return encoderOfMapKey(encoder.ctx, reflect2.TypeOf(obj)).IsEmpty(reflect2.PtrOf(obj)) -} - -type mapEncoder struct { - mapType *reflect2.UnsafeMapType - keyEncoder ValEncoder - elemEncoder ValEncoder -} - -func (encoder *mapEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - if *(*unsafe.Pointer)(ptr) == nil { - stream.WriteNil() - return - } - stream.WriteObjectStart() - iter := encoder.mapType.UnsafeIterate(ptr) - for i := 0; iter.HasNext(); i++ { - if i != 0 { - stream.WriteMore() - } - key, elem := iter.UnsafeNext() - encoder.keyEncoder.Encode(key, stream) - if stream.indention > 0 { - stream.writeTwoBytes(byte(':'), byte(' ')) - } else { - stream.writeByte(':') - } - encoder.elemEncoder.Encode(elem, stream) - } - stream.WriteObjectEnd() -} - -func (encoder *mapEncoder) IsEmpty(ptr unsafe.Pointer) bool { - iter := encoder.mapType.UnsafeIterate(ptr) - return !iter.HasNext() -} - -type sortKeysMapEncoder struct { - mapType *reflect2.UnsafeMapType - keyEncoder ValEncoder - elemEncoder ValEncoder -} - -func (encoder *sortKeysMapEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - if *(*unsafe.Pointer)(ptr) == nil { - stream.WriteNil() - return - } - stream.WriteObjectStart() - mapIter := encoder.mapType.UnsafeIterate(ptr) - subStream := stream.cfg.BorrowStream(nil) - subStream.Attachment = stream.Attachment - subIter := stream.cfg.BorrowIterator(nil) - keyValues := encodedKeyValues{} - for mapIter.HasNext() { - key, elem := mapIter.UnsafeNext() - subStreamIndex := subStream.Buffered() - encoder.keyEncoder.Encode(key, subStream) - if subStream.Error != nil && subStream.Error != io.EOF && stream.Error == nil { - stream.Error = subStream.Error - } - encodedKey := subStream.Buffer()[subStreamIndex:] - subIter.ResetBytes(encodedKey) - decodedKey := subIter.ReadString() - if stream.indention > 0 { - subStream.writeTwoBytes(byte(':'), byte(' ')) - } else { - subStream.writeByte(':') - } - encoder.elemEncoder.Encode(elem, subStream) - keyValues = append(keyValues, encodedKV{ - key: decodedKey, - keyValue: subStream.Buffer()[subStreamIndex:], - }) - } - sort.Sort(keyValues) - for i, keyValue := range keyValues { - if i != 0 { - stream.WriteMore() - } - stream.Write(keyValue.keyValue) - } - if subStream.Error != nil && stream.Error == nil { - stream.Error = subStream.Error - } - stream.WriteObjectEnd() - stream.cfg.ReturnStream(subStream) - stream.cfg.ReturnIterator(subIter) -} - -func (encoder *sortKeysMapEncoder) IsEmpty(ptr unsafe.Pointer) bool { - iter := encoder.mapType.UnsafeIterate(ptr) - return !iter.HasNext() -} - -type encodedKeyValues []encodedKV - -type encodedKV struct { - key string - keyValue []byte -} - -func (sv encodedKeyValues) Len() int { return len(sv) } -func (sv encodedKeyValues) Swap(i, j int) { sv[i], sv[j] = sv[j], sv[i] } -func (sv encodedKeyValues) Less(i, j int) bool { return sv[i].key < sv[j].key } diff --git a/vendor/github.com/json-iterator/go/reflect_marshaler.go b/vendor/github.com/json-iterator/go/reflect_marshaler.go deleted file mode 100644 index 3e21f3756..000000000 --- a/vendor/github.com/json-iterator/go/reflect_marshaler.go +++ /dev/null @@ -1,225 +0,0 @@ -package jsoniter - -import ( - "encoding" - "encoding/json" - "unsafe" - - "github.com/modern-go/reflect2" -) - -var marshalerType = reflect2.TypeOfPtr((*json.Marshaler)(nil)).Elem() -var unmarshalerType = reflect2.TypeOfPtr((*json.Unmarshaler)(nil)).Elem() -var textMarshalerType = reflect2.TypeOfPtr((*encoding.TextMarshaler)(nil)).Elem() -var textUnmarshalerType = reflect2.TypeOfPtr((*encoding.TextUnmarshaler)(nil)).Elem() - -func createDecoderOfMarshaler(ctx *ctx, typ reflect2.Type) ValDecoder { - ptrType := reflect2.PtrTo(typ) - if ptrType.Implements(unmarshalerType) { - return &referenceDecoder{ - &unmarshalerDecoder{ptrType}, - } - } - if ptrType.Implements(textUnmarshalerType) { - return &referenceDecoder{ - &textUnmarshalerDecoder{ptrType}, - } - } - return nil -} - -func createEncoderOfMarshaler(ctx *ctx, typ reflect2.Type) ValEncoder { - if typ == marshalerType { - checkIsEmpty := createCheckIsEmpty(ctx, typ) - var encoder ValEncoder = &directMarshalerEncoder{ - checkIsEmpty: checkIsEmpty, - } - return encoder - } - if typ.Implements(marshalerType) { - checkIsEmpty := createCheckIsEmpty(ctx, typ) - var encoder ValEncoder = &marshalerEncoder{ - valType: typ, - checkIsEmpty: checkIsEmpty, - } - return encoder - } - ptrType := reflect2.PtrTo(typ) - if ctx.prefix != "" && ptrType.Implements(marshalerType) { - checkIsEmpty := createCheckIsEmpty(ctx, ptrType) - var encoder ValEncoder = &marshalerEncoder{ - valType: ptrType, - checkIsEmpty: checkIsEmpty, - } - return &referenceEncoder{encoder} - } - if typ == textMarshalerType { - checkIsEmpty := createCheckIsEmpty(ctx, typ) - var encoder ValEncoder = &directTextMarshalerEncoder{ - checkIsEmpty: checkIsEmpty, - stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), - } - return encoder - } - if typ.Implements(textMarshalerType) { - checkIsEmpty := createCheckIsEmpty(ctx, typ) - var encoder ValEncoder = &textMarshalerEncoder{ - valType: typ, - stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), - checkIsEmpty: checkIsEmpty, - } - return encoder - } - // if prefix is empty, the type is the root type - if ctx.prefix != "" && ptrType.Implements(textMarshalerType) { - checkIsEmpty := createCheckIsEmpty(ctx, ptrType) - var encoder ValEncoder = &textMarshalerEncoder{ - valType: ptrType, - stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), - checkIsEmpty: checkIsEmpty, - } - return &referenceEncoder{encoder} - } - return nil -} - -type marshalerEncoder struct { - checkIsEmpty checkIsEmpty - valType reflect2.Type -} - -func (encoder *marshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - obj := encoder.valType.UnsafeIndirect(ptr) - if encoder.valType.IsNullable() && reflect2.IsNil(obj) { - stream.WriteNil() - return - } - marshaler := obj.(json.Marshaler) - bytes, err := marshaler.MarshalJSON() - if err != nil { - stream.Error = err - } else { - // html escape was already done by jsoniter - // but the extra '\n' should be trimed - l := len(bytes) - if l > 0 && bytes[l-1] == '\n' { - bytes = bytes[:l-1] - } - stream.Write(bytes) - } -} - -func (encoder *marshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.checkIsEmpty.IsEmpty(ptr) -} - -type directMarshalerEncoder struct { - checkIsEmpty checkIsEmpty -} - -func (encoder *directMarshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - marshaler := *(*json.Marshaler)(ptr) - if marshaler == nil { - stream.WriteNil() - return - } - bytes, err := marshaler.MarshalJSON() - if err != nil { - stream.Error = err - } else { - stream.Write(bytes) - } -} - -func (encoder *directMarshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.checkIsEmpty.IsEmpty(ptr) -} - -type textMarshalerEncoder struct { - valType reflect2.Type - stringEncoder ValEncoder - checkIsEmpty checkIsEmpty -} - -func (encoder *textMarshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - obj := encoder.valType.UnsafeIndirect(ptr) - if encoder.valType.IsNullable() && reflect2.IsNil(obj) { - stream.WriteNil() - return - } - marshaler := (obj).(encoding.TextMarshaler) - bytes, err := marshaler.MarshalText() - if err != nil { - stream.Error = err - } else { - str := string(bytes) - encoder.stringEncoder.Encode(unsafe.Pointer(&str), stream) - } -} - -func (encoder *textMarshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.checkIsEmpty.IsEmpty(ptr) -} - -type directTextMarshalerEncoder struct { - stringEncoder ValEncoder - checkIsEmpty checkIsEmpty -} - -func (encoder *directTextMarshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - marshaler := *(*encoding.TextMarshaler)(ptr) - if marshaler == nil { - stream.WriteNil() - return - } - bytes, err := marshaler.MarshalText() - if err != nil { - stream.Error = err - } else { - str := string(bytes) - encoder.stringEncoder.Encode(unsafe.Pointer(&str), stream) - } -} - -func (encoder *directTextMarshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.checkIsEmpty.IsEmpty(ptr) -} - -type unmarshalerDecoder struct { - valType reflect2.Type -} - -func (decoder *unmarshalerDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - valType := decoder.valType - obj := valType.UnsafeIndirect(ptr) - unmarshaler := obj.(json.Unmarshaler) - iter.nextToken() - iter.unreadByte() // skip spaces - bytes := iter.SkipAndReturnBytes() - err := unmarshaler.UnmarshalJSON(bytes) - if err != nil { - iter.ReportError("unmarshalerDecoder", err.Error()) - } -} - -type textUnmarshalerDecoder struct { - valType reflect2.Type -} - -func (decoder *textUnmarshalerDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - valType := decoder.valType - obj := valType.UnsafeIndirect(ptr) - if reflect2.IsNil(obj) { - ptrType := valType.(*reflect2.UnsafePtrType) - elemType := ptrType.Elem() - elem := elemType.UnsafeNew() - ptrType.UnsafeSet(ptr, unsafe.Pointer(&elem)) - obj = valType.UnsafeIndirect(ptr) - } - unmarshaler := (obj).(encoding.TextUnmarshaler) - str := iter.ReadString() - err := unmarshaler.UnmarshalText([]byte(str)) - if err != nil { - iter.ReportError("textUnmarshalerDecoder", err.Error()) - } -} diff --git a/vendor/github.com/json-iterator/go/reflect_native.go b/vendor/github.com/json-iterator/go/reflect_native.go deleted file mode 100644 index f88722d14..000000000 --- a/vendor/github.com/json-iterator/go/reflect_native.go +++ /dev/null @@ -1,453 +0,0 @@ -package jsoniter - -import ( - "encoding/base64" - "reflect" - "strconv" - "unsafe" - - "github.com/modern-go/reflect2" -) - -const ptrSize = 32 << uintptr(^uintptr(0)>>63) - -func createEncoderOfNative(ctx *ctx, typ reflect2.Type) ValEncoder { - if typ.Kind() == reflect.Slice && typ.(reflect2.SliceType).Elem().Kind() == reflect.Uint8 { - sliceDecoder := decoderOfSlice(ctx, typ) - return &base64Codec{sliceDecoder: sliceDecoder} - } - typeName := typ.String() - kind := typ.Kind() - switch kind { - case reflect.String: - if typeName != "string" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*string)(nil)).Elem()) - } - return &stringCodec{} - case reflect.Int: - if typeName != "int" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*int)(nil)).Elem()) - } - if strconv.IntSize == 32 { - return &int32Codec{} - } - return &int64Codec{} - case reflect.Int8: - if typeName != "int8" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*int8)(nil)).Elem()) - } - return &int8Codec{} - case reflect.Int16: - if typeName != "int16" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*int16)(nil)).Elem()) - } - return &int16Codec{} - case reflect.Int32: - if typeName != "int32" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*int32)(nil)).Elem()) - } - return &int32Codec{} - case reflect.Int64: - if typeName != "int64" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*int64)(nil)).Elem()) - } - return &int64Codec{} - case reflect.Uint: - if typeName != "uint" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*uint)(nil)).Elem()) - } - if strconv.IntSize == 32 { - return &uint32Codec{} - } - return &uint64Codec{} - case reflect.Uint8: - if typeName != "uint8" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*uint8)(nil)).Elem()) - } - return &uint8Codec{} - case reflect.Uint16: - if typeName != "uint16" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*uint16)(nil)).Elem()) - } - return &uint16Codec{} - case reflect.Uint32: - if typeName != "uint32" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*uint32)(nil)).Elem()) - } - return &uint32Codec{} - case reflect.Uintptr: - if typeName != "uintptr" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*uintptr)(nil)).Elem()) - } - if ptrSize == 32 { - return &uint32Codec{} - } - return &uint64Codec{} - case reflect.Uint64: - if typeName != "uint64" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*uint64)(nil)).Elem()) - } - return &uint64Codec{} - case reflect.Float32: - if typeName != "float32" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*float32)(nil)).Elem()) - } - return &float32Codec{} - case reflect.Float64: - if typeName != "float64" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*float64)(nil)).Elem()) - } - return &float64Codec{} - case reflect.Bool: - if typeName != "bool" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*bool)(nil)).Elem()) - } - return &boolCodec{} - } - return nil -} - -func createDecoderOfNative(ctx *ctx, typ reflect2.Type) ValDecoder { - if typ.Kind() == reflect.Slice && typ.(reflect2.SliceType).Elem().Kind() == reflect.Uint8 { - sliceDecoder := decoderOfSlice(ctx, typ) - return &base64Codec{sliceDecoder: sliceDecoder} - } - typeName := typ.String() - switch typ.Kind() { - case reflect.String: - if typeName != "string" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*string)(nil)).Elem()) - } - return &stringCodec{} - case reflect.Int: - if typeName != "int" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*int)(nil)).Elem()) - } - if strconv.IntSize == 32 { - return &int32Codec{} - } - return &int64Codec{} - case reflect.Int8: - if typeName != "int8" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*int8)(nil)).Elem()) - } - return &int8Codec{} - case reflect.Int16: - if typeName != "int16" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*int16)(nil)).Elem()) - } - return &int16Codec{} - case reflect.Int32: - if typeName != "int32" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*int32)(nil)).Elem()) - } - return &int32Codec{} - case reflect.Int64: - if typeName != "int64" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*int64)(nil)).Elem()) - } - return &int64Codec{} - case reflect.Uint: - if typeName != "uint" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*uint)(nil)).Elem()) - } - if strconv.IntSize == 32 { - return &uint32Codec{} - } - return &uint64Codec{} - case reflect.Uint8: - if typeName != "uint8" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*uint8)(nil)).Elem()) - } - return &uint8Codec{} - case reflect.Uint16: - if typeName != "uint16" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*uint16)(nil)).Elem()) - } - return &uint16Codec{} - case reflect.Uint32: - if typeName != "uint32" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*uint32)(nil)).Elem()) - } - return &uint32Codec{} - case reflect.Uintptr: - if typeName != "uintptr" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*uintptr)(nil)).Elem()) - } - if ptrSize == 32 { - return &uint32Codec{} - } - return &uint64Codec{} - case reflect.Uint64: - if typeName != "uint64" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*uint64)(nil)).Elem()) - } - return &uint64Codec{} - case reflect.Float32: - if typeName != "float32" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*float32)(nil)).Elem()) - } - return &float32Codec{} - case reflect.Float64: - if typeName != "float64" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*float64)(nil)).Elem()) - } - return &float64Codec{} - case reflect.Bool: - if typeName != "bool" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*bool)(nil)).Elem()) - } - return &boolCodec{} - } - return nil -} - -type stringCodec struct { -} - -func (codec *stringCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - *((*string)(ptr)) = iter.ReadString() -} - -func (codec *stringCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - str := *((*string)(ptr)) - stream.WriteString(str) -} - -func (codec *stringCodec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*string)(ptr)) == "" -} - -type int8Codec struct { -} - -func (codec *int8Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*int8)(ptr)) = iter.ReadInt8() - } -} - -func (codec *int8Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteInt8(*((*int8)(ptr))) -} - -func (codec *int8Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*int8)(ptr)) == 0 -} - -type int16Codec struct { -} - -func (codec *int16Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*int16)(ptr)) = iter.ReadInt16() - } -} - -func (codec *int16Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteInt16(*((*int16)(ptr))) -} - -func (codec *int16Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*int16)(ptr)) == 0 -} - -type int32Codec struct { -} - -func (codec *int32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*int32)(ptr)) = iter.ReadInt32() - } -} - -func (codec *int32Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteInt32(*((*int32)(ptr))) -} - -func (codec *int32Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*int32)(ptr)) == 0 -} - -type int64Codec struct { -} - -func (codec *int64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*int64)(ptr)) = iter.ReadInt64() - } -} - -func (codec *int64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteInt64(*((*int64)(ptr))) -} - -func (codec *int64Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*int64)(ptr)) == 0 -} - -type uint8Codec struct { -} - -func (codec *uint8Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*uint8)(ptr)) = iter.ReadUint8() - } -} - -func (codec *uint8Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteUint8(*((*uint8)(ptr))) -} - -func (codec *uint8Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*uint8)(ptr)) == 0 -} - -type uint16Codec struct { -} - -func (codec *uint16Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*uint16)(ptr)) = iter.ReadUint16() - } -} - -func (codec *uint16Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteUint16(*((*uint16)(ptr))) -} - -func (codec *uint16Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*uint16)(ptr)) == 0 -} - -type uint32Codec struct { -} - -func (codec *uint32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*uint32)(ptr)) = iter.ReadUint32() - } -} - -func (codec *uint32Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteUint32(*((*uint32)(ptr))) -} - -func (codec *uint32Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*uint32)(ptr)) == 0 -} - -type uint64Codec struct { -} - -func (codec *uint64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*uint64)(ptr)) = iter.ReadUint64() - } -} - -func (codec *uint64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteUint64(*((*uint64)(ptr))) -} - -func (codec *uint64Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*uint64)(ptr)) == 0 -} - -type float32Codec struct { -} - -func (codec *float32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*float32)(ptr)) = iter.ReadFloat32() - } -} - -func (codec *float32Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteFloat32(*((*float32)(ptr))) -} - -func (codec *float32Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*float32)(ptr)) == 0 -} - -type float64Codec struct { -} - -func (codec *float64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*float64)(ptr)) = iter.ReadFloat64() - } -} - -func (codec *float64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteFloat64(*((*float64)(ptr))) -} - -func (codec *float64Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*float64)(ptr)) == 0 -} - -type boolCodec struct { -} - -func (codec *boolCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*bool)(ptr)) = iter.ReadBool() - } -} - -func (codec *boolCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteBool(*((*bool)(ptr))) -} - -func (codec *boolCodec) IsEmpty(ptr unsafe.Pointer) bool { - return !(*((*bool)(ptr))) -} - -type base64Codec struct { - sliceType *reflect2.UnsafeSliceType - sliceDecoder ValDecoder -} - -func (codec *base64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if iter.ReadNil() { - codec.sliceType.UnsafeSetNil(ptr) - return - } - switch iter.WhatIsNext() { - case StringValue: - src := iter.ReadString() - dst, err := base64.StdEncoding.DecodeString(src) - if err != nil { - iter.ReportError("decode base64", err.Error()) - } else { - codec.sliceType.UnsafeSet(ptr, unsafe.Pointer(&dst)) - } - case ArrayValue: - codec.sliceDecoder.Decode(ptr, iter) - default: - iter.ReportError("base64Codec", "invalid input") - } -} - -func (codec *base64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - if codec.sliceType.UnsafeIsNil(ptr) { - stream.WriteNil() - return - } - src := *((*[]byte)(ptr)) - encoding := base64.StdEncoding - stream.writeByte('"') - if len(src) != 0 { - size := encoding.EncodedLen(len(src)) - buf := make([]byte, size) - encoding.Encode(buf, src) - stream.buf = append(stream.buf, buf...) - } - stream.writeByte('"') -} - -func (codec *base64Codec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*[]byte)(ptr))) == 0 -} diff --git a/vendor/github.com/json-iterator/go/reflect_optional.go b/vendor/github.com/json-iterator/go/reflect_optional.go deleted file mode 100644 index fa71f4748..000000000 --- a/vendor/github.com/json-iterator/go/reflect_optional.go +++ /dev/null @@ -1,129 +0,0 @@ -package jsoniter - -import ( - "github.com/modern-go/reflect2" - "unsafe" -) - -func decoderOfOptional(ctx *ctx, typ reflect2.Type) ValDecoder { - ptrType := typ.(*reflect2.UnsafePtrType) - elemType := ptrType.Elem() - decoder := decoderOfType(ctx, elemType) - return &OptionalDecoder{elemType, decoder} -} - -func encoderOfOptional(ctx *ctx, typ reflect2.Type) ValEncoder { - ptrType := typ.(*reflect2.UnsafePtrType) - elemType := ptrType.Elem() - elemEncoder := encoderOfType(ctx, elemType) - encoder := &OptionalEncoder{elemEncoder} - return encoder -} - -type OptionalDecoder struct { - ValueType reflect2.Type - ValueDecoder ValDecoder -} - -func (decoder *OptionalDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if iter.ReadNil() { - *((*unsafe.Pointer)(ptr)) = nil - } else { - if *((*unsafe.Pointer)(ptr)) == nil { - //pointer to null, we have to allocate memory to hold the value - newPtr := decoder.ValueType.UnsafeNew() - decoder.ValueDecoder.Decode(newPtr, iter) - *((*unsafe.Pointer)(ptr)) = newPtr - } else { - //reuse existing instance - decoder.ValueDecoder.Decode(*((*unsafe.Pointer)(ptr)), iter) - } - } -} - -type dereferenceDecoder struct { - // only to deference a pointer - valueType reflect2.Type - valueDecoder ValDecoder -} - -func (decoder *dereferenceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if *((*unsafe.Pointer)(ptr)) == nil { - //pointer to null, we have to allocate memory to hold the value - newPtr := decoder.valueType.UnsafeNew() - decoder.valueDecoder.Decode(newPtr, iter) - *((*unsafe.Pointer)(ptr)) = newPtr - } else { - //reuse existing instance - decoder.valueDecoder.Decode(*((*unsafe.Pointer)(ptr)), iter) - } -} - -type OptionalEncoder struct { - ValueEncoder ValEncoder -} - -func (encoder *OptionalEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - if *((*unsafe.Pointer)(ptr)) == nil { - stream.WriteNil() - } else { - encoder.ValueEncoder.Encode(*((*unsafe.Pointer)(ptr)), stream) - } -} - -func (encoder *OptionalEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return *((*unsafe.Pointer)(ptr)) == nil -} - -type dereferenceEncoder struct { - ValueEncoder ValEncoder -} - -func (encoder *dereferenceEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - if *((*unsafe.Pointer)(ptr)) == nil { - stream.WriteNil() - } else { - encoder.ValueEncoder.Encode(*((*unsafe.Pointer)(ptr)), stream) - } -} - -func (encoder *dereferenceEncoder) IsEmpty(ptr unsafe.Pointer) bool { - dePtr := *((*unsafe.Pointer)(ptr)) - if dePtr == nil { - return true - } - return encoder.ValueEncoder.IsEmpty(dePtr) -} - -func (encoder *dereferenceEncoder) IsEmbeddedPtrNil(ptr unsafe.Pointer) bool { - deReferenced := *((*unsafe.Pointer)(ptr)) - if deReferenced == nil { - return true - } - isEmbeddedPtrNil, converted := encoder.ValueEncoder.(IsEmbeddedPtrNil) - if !converted { - return false - } - fieldPtr := unsafe.Pointer(deReferenced) - return isEmbeddedPtrNil.IsEmbeddedPtrNil(fieldPtr) -} - -type referenceEncoder struct { - encoder ValEncoder -} - -func (encoder *referenceEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - encoder.encoder.Encode(unsafe.Pointer(&ptr), stream) -} - -func (encoder *referenceEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.encoder.IsEmpty(unsafe.Pointer(&ptr)) -} - -type referenceDecoder struct { - decoder ValDecoder -} - -func (decoder *referenceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - decoder.decoder.Decode(unsafe.Pointer(&ptr), iter) -} diff --git a/vendor/github.com/json-iterator/go/reflect_slice.go b/vendor/github.com/json-iterator/go/reflect_slice.go deleted file mode 100644 index 9441d79df..000000000 --- a/vendor/github.com/json-iterator/go/reflect_slice.go +++ /dev/null @@ -1,99 +0,0 @@ -package jsoniter - -import ( - "fmt" - "github.com/modern-go/reflect2" - "io" - "unsafe" -) - -func decoderOfSlice(ctx *ctx, typ reflect2.Type) ValDecoder { - sliceType := typ.(*reflect2.UnsafeSliceType) - decoder := decoderOfType(ctx.append("[sliceElem]"), sliceType.Elem()) - return &sliceDecoder{sliceType, decoder} -} - -func encoderOfSlice(ctx *ctx, typ reflect2.Type) ValEncoder { - sliceType := typ.(*reflect2.UnsafeSliceType) - encoder := encoderOfType(ctx.append("[sliceElem]"), sliceType.Elem()) - return &sliceEncoder{sliceType, encoder} -} - -type sliceEncoder struct { - sliceType *reflect2.UnsafeSliceType - elemEncoder ValEncoder -} - -func (encoder *sliceEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - if encoder.sliceType.UnsafeIsNil(ptr) { - stream.WriteNil() - return - } - length := encoder.sliceType.UnsafeLengthOf(ptr) - if length == 0 { - stream.WriteEmptyArray() - return - } - stream.WriteArrayStart() - encoder.elemEncoder.Encode(encoder.sliceType.UnsafeGetIndex(ptr, 0), stream) - for i := 1; i < length; i++ { - stream.WriteMore() - elemPtr := encoder.sliceType.UnsafeGetIndex(ptr, i) - encoder.elemEncoder.Encode(elemPtr, stream) - } - stream.WriteArrayEnd() - if stream.Error != nil && stream.Error != io.EOF { - stream.Error = fmt.Errorf("%v: %s", encoder.sliceType, stream.Error.Error()) - } -} - -func (encoder *sliceEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.sliceType.UnsafeLengthOf(ptr) == 0 -} - -type sliceDecoder struct { - sliceType *reflect2.UnsafeSliceType - elemDecoder ValDecoder -} - -func (decoder *sliceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - decoder.doDecode(ptr, iter) - if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%v: %s", decoder.sliceType, iter.Error.Error()) - } -} - -func (decoder *sliceDecoder) doDecode(ptr unsafe.Pointer, iter *Iterator) { - c := iter.nextToken() - sliceType := decoder.sliceType - if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') - sliceType.UnsafeSetNil(ptr) - return - } - if c != '[' { - iter.ReportError("decode slice", "expect [ or n, but found "+string([]byte{c})) - return - } - c = iter.nextToken() - if c == ']' { - sliceType.UnsafeSet(ptr, sliceType.UnsafeMakeSlice(0, 0)) - return - } - iter.unreadByte() - sliceType.UnsafeGrow(ptr, 1) - elemPtr := sliceType.UnsafeGetIndex(ptr, 0) - decoder.elemDecoder.Decode(elemPtr, iter) - length := 1 - for c = iter.nextToken(); c == ','; c = iter.nextToken() { - idx := length - length += 1 - sliceType.UnsafeGrow(ptr, length) - elemPtr = sliceType.UnsafeGetIndex(ptr, idx) - decoder.elemDecoder.Decode(elemPtr, iter) - } - if c != ']' { - iter.ReportError("decode slice", "expect ], but found "+string([]byte{c})) - return - } -} diff --git a/vendor/github.com/json-iterator/go/reflect_struct_decoder.go b/vendor/github.com/json-iterator/go/reflect_struct_decoder.go deleted file mode 100644 index 92ae912dc..000000000 --- a/vendor/github.com/json-iterator/go/reflect_struct_decoder.go +++ /dev/null @@ -1,1097 +0,0 @@ -package jsoniter - -import ( - "fmt" - "io" - "strings" - "unsafe" - - "github.com/modern-go/reflect2" -) - -func decoderOfStruct(ctx *ctx, typ reflect2.Type) ValDecoder { - bindings := map[string]*Binding{} - structDescriptor := describeStruct(ctx, typ) - for _, binding := range structDescriptor.Fields { - for _, fromName := range binding.FromNames { - old := bindings[fromName] - if old == nil { - bindings[fromName] = binding - continue - } - ignoreOld, ignoreNew := resolveConflictBinding(ctx.frozenConfig, old, binding) - if ignoreOld { - delete(bindings, fromName) - } - if !ignoreNew { - bindings[fromName] = binding - } - } - } - fields := map[string]*structFieldDecoder{} - for k, binding := range bindings { - fields[k] = binding.Decoder.(*structFieldDecoder) - } - - if !ctx.caseSensitive() { - for k, binding := range bindings { - if _, found := fields[strings.ToLower(k)]; !found { - fields[strings.ToLower(k)] = binding.Decoder.(*structFieldDecoder) - } - } - } - - return createStructDecoder(ctx, typ, fields) -} - -func createStructDecoder(ctx *ctx, typ reflect2.Type, fields map[string]*structFieldDecoder) ValDecoder { - if ctx.disallowUnknownFields { - return &generalStructDecoder{typ: typ, fields: fields, disallowUnknownFields: true} - } - knownHash := map[int64]struct{}{ - 0: {}, - } - - switch len(fields) { - case 0: - return &skipObjectDecoder{typ} - case 1: - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - return &oneFieldStructDecoder{typ, fieldHash, fieldDecoder} - } - case 2: - var fieldHash1 int64 - var fieldHash2 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldHash1 == 0 { - fieldHash1 = fieldHash - fieldDecoder1 = fieldDecoder - } else { - fieldHash2 = fieldHash - fieldDecoder2 = fieldDecoder - } - } - return &twoFieldsStructDecoder{typ, fieldHash1, fieldDecoder1, fieldHash2, fieldDecoder2} - case 3: - var fieldName1 int64 - var fieldName2 int64 - var fieldName3 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - var fieldDecoder3 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldName1 == 0 { - fieldName1 = fieldHash - fieldDecoder1 = fieldDecoder - } else if fieldName2 == 0 { - fieldName2 = fieldHash - fieldDecoder2 = fieldDecoder - } else { - fieldName3 = fieldHash - fieldDecoder3 = fieldDecoder - } - } - return &threeFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, - fieldName2, fieldDecoder2, - fieldName3, fieldDecoder3} - case 4: - var fieldName1 int64 - var fieldName2 int64 - var fieldName3 int64 - var fieldName4 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - var fieldDecoder3 *structFieldDecoder - var fieldDecoder4 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldName1 == 0 { - fieldName1 = fieldHash - fieldDecoder1 = fieldDecoder - } else if fieldName2 == 0 { - fieldName2 = fieldHash - fieldDecoder2 = fieldDecoder - } else if fieldName3 == 0 { - fieldName3 = fieldHash - fieldDecoder3 = fieldDecoder - } else { - fieldName4 = fieldHash - fieldDecoder4 = fieldDecoder - } - } - return &fourFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, - fieldName2, fieldDecoder2, - fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4} - case 5: - var fieldName1 int64 - var fieldName2 int64 - var fieldName3 int64 - var fieldName4 int64 - var fieldName5 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - var fieldDecoder3 *structFieldDecoder - var fieldDecoder4 *structFieldDecoder - var fieldDecoder5 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldName1 == 0 { - fieldName1 = fieldHash - fieldDecoder1 = fieldDecoder - } else if fieldName2 == 0 { - fieldName2 = fieldHash - fieldDecoder2 = fieldDecoder - } else if fieldName3 == 0 { - fieldName3 = fieldHash - fieldDecoder3 = fieldDecoder - } else if fieldName4 == 0 { - fieldName4 = fieldHash - fieldDecoder4 = fieldDecoder - } else { - fieldName5 = fieldHash - fieldDecoder5 = fieldDecoder - } - } - return &fiveFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, - fieldName2, fieldDecoder2, - fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4, - fieldName5, fieldDecoder5} - case 6: - var fieldName1 int64 - var fieldName2 int64 - var fieldName3 int64 - var fieldName4 int64 - var fieldName5 int64 - var fieldName6 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - var fieldDecoder3 *structFieldDecoder - var fieldDecoder4 *structFieldDecoder - var fieldDecoder5 *structFieldDecoder - var fieldDecoder6 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldName1 == 0 { - fieldName1 = fieldHash - fieldDecoder1 = fieldDecoder - } else if fieldName2 == 0 { - fieldName2 = fieldHash - fieldDecoder2 = fieldDecoder - } else if fieldName3 == 0 { - fieldName3 = fieldHash - fieldDecoder3 = fieldDecoder - } else if fieldName4 == 0 { - fieldName4 = fieldHash - fieldDecoder4 = fieldDecoder - } else if fieldName5 == 0 { - fieldName5 = fieldHash - fieldDecoder5 = fieldDecoder - } else { - fieldName6 = fieldHash - fieldDecoder6 = fieldDecoder - } - } - return &sixFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, - fieldName2, fieldDecoder2, - fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4, - fieldName5, fieldDecoder5, - fieldName6, fieldDecoder6} - case 7: - var fieldName1 int64 - var fieldName2 int64 - var fieldName3 int64 - var fieldName4 int64 - var fieldName5 int64 - var fieldName6 int64 - var fieldName7 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - var fieldDecoder3 *structFieldDecoder - var fieldDecoder4 *structFieldDecoder - var fieldDecoder5 *structFieldDecoder - var fieldDecoder6 *structFieldDecoder - var fieldDecoder7 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldName1 == 0 { - fieldName1 = fieldHash - fieldDecoder1 = fieldDecoder - } else if fieldName2 == 0 { - fieldName2 = fieldHash - fieldDecoder2 = fieldDecoder - } else if fieldName3 == 0 { - fieldName3 = fieldHash - fieldDecoder3 = fieldDecoder - } else if fieldName4 == 0 { - fieldName4 = fieldHash - fieldDecoder4 = fieldDecoder - } else if fieldName5 == 0 { - fieldName5 = fieldHash - fieldDecoder5 = fieldDecoder - } else if fieldName6 == 0 { - fieldName6 = fieldHash - fieldDecoder6 = fieldDecoder - } else { - fieldName7 = fieldHash - fieldDecoder7 = fieldDecoder - } - } - return &sevenFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, - fieldName2, fieldDecoder2, - fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4, - fieldName5, fieldDecoder5, - fieldName6, fieldDecoder6, - fieldName7, fieldDecoder7} - case 8: - var fieldName1 int64 - var fieldName2 int64 - var fieldName3 int64 - var fieldName4 int64 - var fieldName5 int64 - var fieldName6 int64 - var fieldName7 int64 - var fieldName8 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - var fieldDecoder3 *structFieldDecoder - var fieldDecoder4 *structFieldDecoder - var fieldDecoder5 *structFieldDecoder - var fieldDecoder6 *structFieldDecoder - var fieldDecoder7 *structFieldDecoder - var fieldDecoder8 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldName1 == 0 { - fieldName1 = fieldHash - fieldDecoder1 = fieldDecoder - } else if fieldName2 == 0 { - fieldName2 = fieldHash - fieldDecoder2 = fieldDecoder - } else if fieldName3 == 0 { - fieldName3 = fieldHash - fieldDecoder3 = fieldDecoder - } else if fieldName4 == 0 { - fieldName4 = fieldHash - fieldDecoder4 = fieldDecoder - } else if fieldName5 == 0 { - fieldName5 = fieldHash - fieldDecoder5 = fieldDecoder - } else if fieldName6 == 0 { - fieldName6 = fieldHash - fieldDecoder6 = fieldDecoder - } else if fieldName7 == 0 { - fieldName7 = fieldHash - fieldDecoder7 = fieldDecoder - } else { - fieldName8 = fieldHash - fieldDecoder8 = fieldDecoder - } - } - return &eightFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, - fieldName2, fieldDecoder2, - fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4, - fieldName5, fieldDecoder5, - fieldName6, fieldDecoder6, - fieldName7, fieldDecoder7, - fieldName8, fieldDecoder8} - case 9: - var fieldName1 int64 - var fieldName2 int64 - var fieldName3 int64 - var fieldName4 int64 - var fieldName5 int64 - var fieldName6 int64 - var fieldName7 int64 - var fieldName8 int64 - var fieldName9 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - var fieldDecoder3 *structFieldDecoder - var fieldDecoder4 *structFieldDecoder - var fieldDecoder5 *structFieldDecoder - var fieldDecoder6 *structFieldDecoder - var fieldDecoder7 *structFieldDecoder - var fieldDecoder8 *structFieldDecoder - var fieldDecoder9 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldName1 == 0 { - fieldName1 = fieldHash - fieldDecoder1 = fieldDecoder - } else if fieldName2 == 0 { - fieldName2 = fieldHash - fieldDecoder2 = fieldDecoder - } else if fieldName3 == 0 { - fieldName3 = fieldHash - fieldDecoder3 = fieldDecoder - } else if fieldName4 == 0 { - fieldName4 = fieldHash - fieldDecoder4 = fieldDecoder - } else if fieldName5 == 0 { - fieldName5 = fieldHash - fieldDecoder5 = fieldDecoder - } else if fieldName6 == 0 { - fieldName6 = fieldHash - fieldDecoder6 = fieldDecoder - } else if fieldName7 == 0 { - fieldName7 = fieldHash - fieldDecoder7 = fieldDecoder - } else if fieldName8 == 0 { - fieldName8 = fieldHash - fieldDecoder8 = fieldDecoder - } else { - fieldName9 = fieldHash - fieldDecoder9 = fieldDecoder - } - } - return &nineFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, - fieldName2, fieldDecoder2, - fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4, - fieldName5, fieldDecoder5, - fieldName6, fieldDecoder6, - fieldName7, fieldDecoder7, - fieldName8, fieldDecoder8, - fieldName9, fieldDecoder9} - case 10: - var fieldName1 int64 - var fieldName2 int64 - var fieldName3 int64 - var fieldName4 int64 - var fieldName5 int64 - var fieldName6 int64 - var fieldName7 int64 - var fieldName8 int64 - var fieldName9 int64 - var fieldName10 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - var fieldDecoder3 *structFieldDecoder - var fieldDecoder4 *structFieldDecoder - var fieldDecoder5 *structFieldDecoder - var fieldDecoder6 *structFieldDecoder - var fieldDecoder7 *structFieldDecoder - var fieldDecoder8 *structFieldDecoder - var fieldDecoder9 *structFieldDecoder - var fieldDecoder10 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldName1 == 0 { - fieldName1 = fieldHash - fieldDecoder1 = fieldDecoder - } else if fieldName2 == 0 { - fieldName2 = fieldHash - fieldDecoder2 = fieldDecoder - } else if fieldName3 == 0 { - fieldName3 = fieldHash - fieldDecoder3 = fieldDecoder - } else if fieldName4 == 0 { - fieldName4 = fieldHash - fieldDecoder4 = fieldDecoder - } else if fieldName5 == 0 { - fieldName5 = fieldHash - fieldDecoder5 = fieldDecoder - } else if fieldName6 == 0 { - fieldName6 = fieldHash - fieldDecoder6 = fieldDecoder - } else if fieldName7 == 0 { - fieldName7 = fieldHash - fieldDecoder7 = fieldDecoder - } else if fieldName8 == 0 { - fieldName8 = fieldHash - fieldDecoder8 = fieldDecoder - } else if fieldName9 == 0 { - fieldName9 = fieldHash - fieldDecoder9 = fieldDecoder - } else { - fieldName10 = fieldHash - fieldDecoder10 = fieldDecoder - } - } - return &tenFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, - fieldName2, fieldDecoder2, - fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4, - fieldName5, fieldDecoder5, - fieldName6, fieldDecoder6, - fieldName7, fieldDecoder7, - fieldName8, fieldDecoder8, - fieldName9, fieldDecoder9, - fieldName10, fieldDecoder10} - } - return &generalStructDecoder{typ, fields, false} -} - -type generalStructDecoder struct { - typ reflect2.Type - fields map[string]*structFieldDecoder - disallowUnknownFields bool -} - -func (decoder *generalStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - var c byte - for c = ','; c == ','; c = iter.nextToken() { - decoder.decodeOneField(ptr, iter) - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - if c != '}' { - iter.ReportError("struct Decode", `expect }, but found `+string([]byte{c})) - } - iter.decrementDepth() -} - -func (decoder *generalStructDecoder) decodeOneField(ptr unsafe.Pointer, iter *Iterator) { - var field string - var fieldDecoder *structFieldDecoder - if iter.cfg.objectFieldMustBeSimpleString { - fieldBytes := iter.ReadStringAsSlice() - field = *(*string)(unsafe.Pointer(&fieldBytes)) - fieldDecoder = decoder.fields[field] - if fieldDecoder == nil && !iter.cfg.caseSensitive { - fieldDecoder = decoder.fields[strings.ToLower(field)] - } - } else { - field = iter.ReadString() - fieldDecoder = decoder.fields[field] - if fieldDecoder == nil && !iter.cfg.caseSensitive { - fieldDecoder = decoder.fields[strings.ToLower(field)] - } - } - if fieldDecoder == nil { - if decoder.disallowUnknownFields { - msg := "found unknown field: " + field - iter.ReportError("ReadObject", msg) - } - c := iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } - iter.Skip() - return - } - c := iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } - fieldDecoder.Decode(ptr, iter) -} - -type skipObjectDecoder struct { - typ reflect2.Type -} - -func (decoder *skipObjectDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - valueType := iter.WhatIsNext() - if valueType != ObjectValue && valueType != NilValue { - iter.ReportError("skipObjectDecoder", "expect object or null") - return - } - iter.Skip() -} - -type oneFieldStructDecoder struct { - typ reflect2.Type - fieldHash int64 - fieldDecoder *structFieldDecoder -} - -func (decoder *oneFieldStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - if iter.readFieldHash() == decoder.fieldHash { - decoder.fieldDecoder.Decode(ptr, iter) - } else { - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type twoFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder -} - -func (decoder *twoFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type threeFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder - fieldHash3 int64 - fieldDecoder3 *structFieldDecoder -} - -func (decoder *threeFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - case decoder.fieldHash3: - decoder.fieldDecoder3.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type fourFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder - fieldHash3 int64 - fieldDecoder3 *structFieldDecoder - fieldHash4 int64 - fieldDecoder4 *structFieldDecoder -} - -func (decoder *fourFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - case decoder.fieldHash3: - decoder.fieldDecoder3.Decode(ptr, iter) - case decoder.fieldHash4: - decoder.fieldDecoder4.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type fiveFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder - fieldHash3 int64 - fieldDecoder3 *structFieldDecoder - fieldHash4 int64 - fieldDecoder4 *structFieldDecoder - fieldHash5 int64 - fieldDecoder5 *structFieldDecoder -} - -func (decoder *fiveFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - case decoder.fieldHash3: - decoder.fieldDecoder3.Decode(ptr, iter) - case decoder.fieldHash4: - decoder.fieldDecoder4.Decode(ptr, iter) - case decoder.fieldHash5: - decoder.fieldDecoder5.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type sixFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder - fieldHash3 int64 - fieldDecoder3 *structFieldDecoder - fieldHash4 int64 - fieldDecoder4 *structFieldDecoder - fieldHash5 int64 - fieldDecoder5 *structFieldDecoder - fieldHash6 int64 - fieldDecoder6 *structFieldDecoder -} - -func (decoder *sixFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - case decoder.fieldHash3: - decoder.fieldDecoder3.Decode(ptr, iter) - case decoder.fieldHash4: - decoder.fieldDecoder4.Decode(ptr, iter) - case decoder.fieldHash5: - decoder.fieldDecoder5.Decode(ptr, iter) - case decoder.fieldHash6: - decoder.fieldDecoder6.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type sevenFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder - fieldHash3 int64 - fieldDecoder3 *structFieldDecoder - fieldHash4 int64 - fieldDecoder4 *structFieldDecoder - fieldHash5 int64 - fieldDecoder5 *structFieldDecoder - fieldHash6 int64 - fieldDecoder6 *structFieldDecoder - fieldHash7 int64 - fieldDecoder7 *structFieldDecoder -} - -func (decoder *sevenFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - case decoder.fieldHash3: - decoder.fieldDecoder3.Decode(ptr, iter) - case decoder.fieldHash4: - decoder.fieldDecoder4.Decode(ptr, iter) - case decoder.fieldHash5: - decoder.fieldDecoder5.Decode(ptr, iter) - case decoder.fieldHash6: - decoder.fieldDecoder6.Decode(ptr, iter) - case decoder.fieldHash7: - decoder.fieldDecoder7.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type eightFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder - fieldHash3 int64 - fieldDecoder3 *structFieldDecoder - fieldHash4 int64 - fieldDecoder4 *structFieldDecoder - fieldHash5 int64 - fieldDecoder5 *structFieldDecoder - fieldHash6 int64 - fieldDecoder6 *structFieldDecoder - fieldHash7 int64 - fieldDecoder7 *structFieldDecoder - fieldHash8 int64 - fieldDecoder8 *structFieldDecoder -} - -func (decoder *eightFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - case decoder.fieldHash3: - decoder.fieldDecoder3.Decode(ptr, iter) - case decoder.fieldHash4: - decoder.fieldDecoder4.Decode(ptr, iter) - case decoder.fieldHash5: - decoder.fieldDecoder5.Decode(ptr, iter) - case decoder.fieldHash6: - decoder.fieldDecoder6.Decode(ptr, iter) - case decoder.fieldHash7: - decoder.fieldDecoder7.Decode(ptr, iter) - case decoder.fieldHash8: - decoder.fieldDecoder8.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type nineFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder - fieldHash3 int64 - fieldDecoder3 *structFieldDecoder - fieldHash4 int64 - fieldDecoder4 *structFieldDecoder - fieldHash5 int64 - fieldDecoder5 *structFieldDecoder - fieldHash6 int64 - fieldDecoder6 *structFieldDecoder - fieldHash7 int64 - fieldDecoder7 *structFieldDecoder - fieldHash8 int64 - fieldDecoder8 *structFieldDecoder - fieldHash9 int64 - fieldDecoder9 *structFieldDecoder -} - -func (decoder *nineFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - case decoder.fieldHash3: - decoder.fieldDecoder3.Decode(ptr, iter) - case decoder.fieldHash4: - decoder.fieldDecoder4.Decode(ptr, iter) - case decoder.fieldHash5: - decoder.fieldDecoder5.Decode(ptr, iter) - case decoder.fieldHash6: - decoder.fieldDecoder6.Decode(ptr, iter) - case decoder.fieldHash7: - decoder.fieldDecoder7.Decode(ptr, iter) - case decoder.fieldHash8: - decoder.fieldDecoder8.Decode(ptr, iter) - case decoder.fieldHash9: - decoder.fieldDecoder9.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type tenFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder - fieldHash3 int64 - fieldDecoder3 *structFieldDecoder - fieldHash4 int64 - fieldDecoder4 *structFieldDecoder - fieldHash5 int64 - fieldDecoder5 *structFieldDecoder - fieldHash6 int64 - fieldDecoder6 *structFieldDecoder - fieldHash7 int64 - fieldDecoder7 *structFieldDecoder - fieldHash8 int64 - fieldDecoder8 *structFieldDecoder - fieldHash9 int64 - fieldDecoder9 *structFieldDecoder - fieldHash10 int64 - fieldDecoder10 *structFieldDecoder -} - -func (decoder *tenFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - case decoder.fieldHash3: - decoder.fieldDecoder3.Decode(ptr, iter) - case decoder.fieldHash4: - decoder.fieldDecoder4.Decode(ptr, iter) - case decoder.fieldHash5: - decoder.fieldDecoder5.Decode(ptr, iter) - case decoder.fieldHash6: - decoder.fieldDecoder6.Decode(ptr, iter) - case decoder.fieldHash7: - decoder.fieldDecoder7.Decode(ptr, iter) - case decoder.fieldHash8: - decoder.fieldDecoder8.Decode(ptr, iter) - case decoder.fieldHash9: - decoder.fieldDecoder9.Decode(ptr, iter) - case decoder.fieldHash10: - decoder.fieldDecoder10.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type structFieldDecoder struct { - field reflect2.StructField - fieldDecoder ValDecoder -} - -func (decoder *structFieldDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - fieldPtr := decoder.field.UnsafeGet(ptr) - decoder.fieldDecoder.Decode(fieldPtr, iter) - if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%s: %s", decoder.field.Name(), iter.Error.Error()) - } -} - -type stringModeStringDecoder struct { - elemDecoder ValDecoder - cfg *frozenConfig -} - -func (decoder *stringModeStringDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - decoder.elemDecoder.Decode(ptr, iter) - str := *((*string)(ptr)) - tempIter := decoder.cfg.BorrowIterator([]byte(str)) - defer decoder.cfg.ReturnIterator(tempIter) - *((*string)(ptr)) = tempIter.ReadString() -} - -type stringModeNumberDecoder struct { - elemDecoder ValDecoder -} - -func (decoder *stringModeNumberDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if iter.WhatIsNext() == NilValue { - decoder.elemDecoder.Decode(ptr, iter) - return - } - - c := iter.nextToken() - if c != '"' { - iter.ReportError("stringModeNumberDecoder", `expect ", but found `+string([]byte{c})) - return - } - decoder.elemDecoder.Decode(ptr, iter) - if iter.Error != nil { - return - } - c = iter.readByte() - if c != '"' { - iter.ReportError("stringModeNumberDecoder", `expect ", but found `+string([]byte{c})) - return - } -} diff --git a/vendor/github.com/json-iterator/go/reflect_struct_encoder.go b/vendor/github.com/json-iterator/go/reflect_struct_encoder.go deleted file mode 100644 index 152e3ef5a..000000000 --- a/vendor/github.com/json-iterator/go/reflect_struct_encoder.go +++ /dev/null @@ -1,211 +0,0 @@ -package jsoniter - -import ( - "fmt" - "github.com/modern-go/reflect2" - "io" - "reflect" - "unsafe" -) - -func encoderOfStruct(ctx *ctx, typ reflect2.Type) ValEncoder { - type bindingTo struct { - binding *Binding - toName string - ignored bool - } - orderedBindings := []*bindingTo{} - structDescriptor := describeStruct(ctx, typ) - for _, binding := range structDescriptor.Fields { - for _, toName := range binding.ToNames { - new := &bindingTo{ - binding: binding, - toName: toName, - } - for _, old := range orderedBindings { - if old.toName != toName { - continue - } - old.ignored, new.ignored = resolveConflictBinding(ctx.frozenConfig, old.binding, new.binding) - } - orderedBindings = append(orderedBindings, new) - } - } - if len(orderedBindings) == 0 { - return &emptyStructEncoder{} - } - finalOrderedFields := []structFieldTo{} - for _, bindingTo := range orderedBindings { - if !bindingTo.ignored { - finalOrderedFields = append(finalOrderedFields, structFieldTo{ - encoder: bindingTo.binding.Encoder.(*structFieldEncoder), - toName: bindingTo.toName, - }) - } - } - return &structEncoder{typ, finalOrderedFields} -} - -func createCheckIsEmpty(ctx *ctx, typ reflect2.Type) checkIsEmpty { - encoder := createEncoderOfNative(ctx, typ) - if encoder != nil { - return encoder - } - kind := typ.Kind() - switch kind { - case reflect.Interface: - return &dynamicEncoder{typ} - case reflect.Struct: - return &structEncoder{typ: typ} - case reflect.Array: - return &arrayEncoder{} - case reflect.Slice: - return &sliceEncoder{} - case reflect.Map: - return encoderOfMap(ctx, typ) - case reflect.Ptr: - return &OptionalEncoder{} - default: - return &lazyErrorEncoder{err: fmt.Errorf("unsupported type: %v", typ)} - } -} - -func resolveConflictBinding(cfg *frozenConfig, old, new *Binding) (ignoreOld, ignoreNew bool) { - newTagged := new.Field.Tag().Get(cfg.getTagKey()) != "" - oldTagged := old.Field.Tag().Get(cfg.getTagKey()) != "" - if newTagged { - if oldTagged { - if len(old.levels) > len(new.levels) { - return true, false - } else if len(new.levels) > len(old.levels) { - return false, true - } else { - return true, true - } - } else { - return true, false - } - } else { - if oldTagged { - return true, false - } - if len(old.levels) > len(new.levels) { - return true, false - } else if len(new.levels) > len(old.levels) { - return false, true - } else { - return true, true - } - } -} - -type structFieldEncoder struct { - field reflect2.StructField - fieldEncoder ValEncoder - omitempty bool -} - -func (encoder *structFieldEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - fieldPtr := encoder.field.UnsafeGet(ptr) - encoder.fieldEncoder.Encode(fieldPtr, stream) - if stream.Error != nil && stream.Error != io.EOF { - stream.Error = fmt.Errorf("%s: %s", encoder.field.Name(), stream.Error.Error()) - } -} - -func (encoder *structFieldEncoder) IsEmpty(ptr unsafe.Pointer) bool { - fieldPtr := encoder.field.UnsafeGet(ptr) - return encoder.fieldEncoder.IsEmpty(fieldPtr) -} - -func (encoder *structFieldEncoder) IsEmbeddedPtrNil(ptr unsafe.Pointer) bool { - isEmbeddedPtrNil, converted := encoder.fieldEncoder.(IsEmbeddedPtrNil) - if !converted { - return false - } - fieldPtr := encoder.field.UnsafeGet(ptr) - return isEmbeddedPtrNil.IsEmbeddedPtrNil(fieldPtr) -} - -type IsEmbeddedPtrNil interface { - IsEmbeddedPtrNil(ptr unsafe.Pointer) bool -} - -type structEncoder struct { - typ reflect2.Type - fields []structFieldTo -} - -type structFieldTo struct { - encoder *structFieldEncoder - toName string -} - -func (encoder *structEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteObjectStart() - isNotFirst := false - for _, field := range encoder.fields { - if field.encoder.omitempty && field.encoder.IsEmpty(ptr) { - continue - } - if field.encoder.IsEmbeddedPtrNil(ptr) { - continue - } - if isNotFirst { - stream.WriteMore() - } - stream.WriteObjectField(field.toName) - field.encoder.Encode(ptr, stream) - isNotFirst = true - } - stream.WriteObjectEnd() - if stream.Error != nil && stream.Error != io.EOF { - stream.Error = fmt.Errorf("%v.%s", encoder.typ, stream.Error.Error()) - } -} - -func (encoder *structEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return false -} - -type emptyStructEncoder struct { -} - -func (encoder *emptyStructEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteEmptyObject() -} - -func (encoder *emptyStructEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return false -} - -type stringModeNumberEncoder struct { - elemEncoder ValEncoder -} - -func (encoder *stringModeNumberEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.writeByte('"') - encoder.elemEncoder.Encode(ptr, stream) - stream.writeByte('"') -} - -func (encoder *stringModeNumberEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.elemEncoder.IsEmpty(ptr) -} - -type stringModeStringEncoder struct { - elemEncoder ValEncoder - cfg *frozenConfig -} - -func (encoder *stringModeStringEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - tempStream := encoder.cfg.BorrowStream(nil) - tempStream.Attachment = stream.Attachment - defer encoder.cfg.ReturnStream(tempStream) - encoder.elemEncoder.Encode(ptr, tempStream) - stream.WriteString(string(tempStream.Buffer())) -} - -func (encoder *stringModeStringEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.elemEncoder.IsEmpty(ptr) -} diff --git a/vendor/github.com/json-iterator/go/stream.go b/vendor/github.com/json-iterator/go/stream.go deleted file mode 100644 index 23d8a3ad6..000000000 --- a/vendor/github.com/json-iterator/go/stream.go +++ /dev/null @@ -1,210 +0,0 @@ -package jsoniter - -import ( - "io" -) - -// stream is a io.Writer like object, with JSON specific write functions. -// Error is not returned as return value, but stored as Error member on this stream instance. -type Stream struct { - cfg *frozenConfig - out io.Writer - buf []byte - Error error - indention int - Attachment interface{} // open for customized encoder -} - -// NewStream create new stream instance. -// cfg can be jsoniter.ConfigDefault. -// out can be nil if write to internal buffer. -// bufSize is the initial size for the internal buffer in bytes. -func NewStream(cfg API, out io.Writer, bufSize int) *Stream { - return &Stream{ - cfg: cfg.(*frozenConfig), - out: out, - buf: make([]byte, 0, bufSize), - Error: nil, - indention: 0, - } -} - -// Pool returns a pool can provide more stream with same configuration -func (stream *Stream) Pool() StreamPool { - return stream.cfg -} - -// Reset reuse this stream instance by assign a new writer -func (stream *Stream) Reset(out io.Writer) { - stream.out = out - stream.buf = stream.buf[:0] -} - -// Available returns how many bytes are unused in the buffer. -func (stream *Stream) Available() int { - return cap(stream.buf) - len(stream.buf) -} - -// Buffered returns the number of bytes that have been written into the current buffer. -func (stream *Stream) Buffered() int { - return len(stream.buf) -} - -// Buffer if writer is nil, use this method to take the result -func (stream *Stream) Buffer() []byte { - return stream.buf -} - -// SetBuffer allows to append to the internal buffer directly -func (stream *Stream) SetBuffer(buf []byte) { - stream.buf = buf -} - -// Write writes the contents of p into the buffer. -// It returns the number of bytes written. -// If nn < len(p), it also returns an error explaining -// why the write is short. -func (stream *Stream) Write(p []byte) (nn int, err error) { - stream.buf = append(stream.buf, p...) - if stream.out != nil { - nn, err = stream.out.Write(stream.buf) - stream.buf = stream.buf[nn:] - return - } - return len(p), nil -} - -// WriteByte writes a single byte. -func (stream *Stream) writeByte(c byte) { - stream.buf = append(stream.buf, c) -} - -func (stream *Stream) writeTwoBytes(c1 byte, c2 byte) { - stream.buf = append(stream.buf, c1, c2) -} - -func (stream *Stream) writeThreeBytes(c1 byte, c2 byte, c3 byte) { - stream.buf = append(stream.buf, c1, c2, c3) -} - -func (stream *Stream) writeFourBytes(c1 byte, c2 byte, c3 byte, c4 byte) { - stream.buf = append(stream.buf, c1, c2, c3, c4) -} - -func (stream *Stream) writeFiveBytes(c1 byte, c2 byte, c3 byte, c4 byte, c5 byte) { - stream.buf = append(stream.buf, c1, c2, c3, c4, c5) -} - -// Flush writes any buffered data to the underlying io.Writer. -func (stream *Stream) Flush() error { - if stream.out == nil { - return nil - } - if stream.Error != nil { - return stream.Error - } - _, err := stream.out.Write(stream.buf) - if err != nil { - if stream.Error == nil { - stream.Error = err - } - return err - } - stream.buf = stream.buf[:0] - return nil -} - -// WriteRaw write string out without quotes, just like []byte -func (stream *Stream) WriteRaw(s string) { - stream.buf = append(stream.buf, s...) -} - -// WriteNil write null to stream -func (stream *Stream) WriteNil() { - stream.writeFourBytes('n', 'u', 'l', 'l') -} - -// WriteTrue write true to stream -func (stream *Stream) WriteTrue() { - stream.writeFourBytes('t', 'r', 'u', 'e') -} - -// WriteFalse write false to stream -func (stream *Stream) WriteFalse() { - stream.writeFiveBytes('f', 'a', 'l', 's', 'e') -} - -// WriteBool write true or false into stream -func (stream *Stream) WriteBool(val bool) { - if val { - stream.WriteTrue() - } else { - stream.WriteFalse() - } -} - -// WriteObjectStart write { with possible indention -func (stream *Stream) WriteObjectStart() { - stream.indention += stream.cfg.indentionStep - stream.writeByte('{') - stream.writeIndention(0) -} - -// WriteObjectField write "field": with possible indention -func (stream *Stream) WriteObjectField(field string) { - stream.WriteString(field) - if stream.indention > 0 { - stream.writeTwoBytes(':', ' ') - } else { - stream.writeByte(':') - } -} - -// WriteObjectEnd write } with possible indention -func (stream *Stream) WriteObjectEnd() { - stream.writeIndention(stream.cfg.indentionStep) - stream.indention -= stream.cfg.indentionStep - stream.writeByte('}') -} - -// WriteEmptyObject write {} -func (stream *Stream) WriteEmptyObject() { - stream.writeByte('{') - stream.writeByte('}') -} - -// WriteMore write , with possible indention -func (stream *Stream) WriteMore() { - stream.writeByte(',') - stream.writeIndention(0) -} - -// WriteArrayStart write [ with possible indention -func (stream *Stream) WriteArrayStart() { - stream.indention += stream.cfg.indentionStep - stream.writeByte('[') - stream.writeIndention(0) -} - -// WriteEmptyArray write [] -func (stream *Stream) WriteEmptyArray() { - stream.writeTwoBytes('[', ']') -} - -// WriteArrayEnd write ] with possible indention -func (stream *Stream) WriteArrayEnd() { - stream.writeIndention(stream.cfg.indentionStep) - stream.indention -= stream.cfg.indentionStep - stream.writeByte(']') -} - -func (stream *Stream) writeIndention(delta int) { - if stream.indention == 0 { - return - } - stream.writeByte('\n') - toWrite := stream.indention - delta - for i := 0; i < toWrite; i++ { - stream.buf = append(stream.buf, ' ') - } -} diff --git a/vendor/github.com/json-iterator/go/stream_float.go b/vendor/github.com/json-iterator/go/stream_float.go deleted file mode 100644 index 826aa594a..000000000 --- a/vendor/github.com/json-iterator/go/stream_float.go +++ /dev/null @@ -1,111 +0,0 @@ -package jsoniter - -import ( - "fmt" - "math" - "strconv" -) - -var pow10 []uint64 - -func init() { - pow10 = []uint64{1, 10, 100, 1000, 10000, 100000, 1000000} -} - -// WriteFloat32 write float32 to stream -func (stream *Stream) WriteFloat32(val float32) { - if math.IsInf(float64(val), 0) || math.IsNaN(float64(val)) { - stream.Error = fmt.Errorf("unsupported value: %f", val) - return - } - abs := math.Abs(float64(val)) - fmt := byte('f') - // Note: Must use float32 comparisons for underlying float32 value to get precise cutoffs right. - if abs != 0 { - if float32(abs) < 1e-6 || float32(abs) >= 1e21 { - fmt = 'e' - } - } - stream.buf = strconv.AppendFloat(stream.buf, float64(val), fmt, -1, 32) -} - -// WriteFloat32Lossy write float32 to stream with ONLY 6 digits precision although much much faster -func (stream *Stream) WriteFloat32Lossy(val float32) { - if math.IsInf(float64(val), 0) || math.IsNaN(float64(val)) { - stream.Error = fmt.Errorf("unsupported value: %f", val) - return - } - if val < 0 { - stream.writeByte('-') - val = -val - } - if val > 0x4ffffff { - stream.WriteFloat32(val) - return - } - precision := 6 - exp := uint64(1000000) // 6 - lval := uint64(float64(val)*float64(exp) + 0.5) - stream.WriteUint64(lval / exp) - fval := lval % exp - if fval == 0 { - return - } - stream.writeByte('.') - for p := precision - 1; p > 0 && fval < pow10[p]; p-- { - stream.writeByte('0') - } - stream.WriteUint64(fval) - for stream.buf[len(stream.buf)-1] == '0' { - stream.buf = stream.buf[:len(stream.buf)-1] - } -} - -// WriteFloat64 write float64 to stream -func (stream *Stream) WriteFloat64(val float64) { - if math.IsInf(val, 0) || math.IsNaN(val) { - stream.Error = fmt.Errorf("unsupported value: %f", val) - return - } - abs := math.Abs(val) - fmt := byte('f') - // Note: Must use float32 comparisons for underlying float32 value to get precise cutoffs right. - if abs != 0 { - if abs < 1e-6 || abs >= 1e21 { - fmt = 'e' - } - } - stream.buf = strconv.AppendFloat(stream.buf, float64(val), fmt, -1, 64) -} - -// WriteFloat64Lossy write float64 to stream with ONLY 6 digits precision although much much faster -func (stream *Stream) WriteFloat64Lossy(val float64) { - if math.IsInf(val, 0) || math.IsNaN(val) { - stream.Error = fmt.Errorf("unsupported value: %f", val) - return - } - if val < 0 { - stream.writeByte('-') - val = -val - } - if val > 0x4ffffff { - stream.WriteFloat64(val) - return - } - precision := 6 - exp := uint64(1000000) // 6 - lval := uint64(val*float64(exp) + 0.5) - stream.WriteUint64(lval / exp) - fval := lval % exp - if fval == 0 { - return - } - stream.writeByte('.') - for p := precision - 1; p > 0 && fval < pow10[p]; p-- { - stream.writeByte('0') - } - stream.WriteUint64(fval) - for stream.buf[len(stream.buf)-1] == '0' { - stream.buf = stream.buf[:len(stream.buf)-1] - } -} diff --git a/vendor/github.com/json-iterator/go/stream_int.go b/vendor/github.com/json-iterator/go/stream_int.go deleted file mode 100644 index d1059ee4c..000000000 --- a/vendor/github.com/json-iterator/go/stream_int.go +++ /dev/null @@ -1,190 +0,0 @@ -package jsoniter - -var digits []uint32 - -func init() { - digits = make([]uint32, 1000) - for i := uint32(0); i < 1000; i++ { - digits[i] = (((i / 100) + '0') << 16) + ((((i / 10) % 10) + '0') << 8) + i%10 + '0' - if i < 10 { - digits[i] += 2 << 24 - } else if i < 100 { - digits[i] += 1 << 24 - } - } -} - -func writeFirstBuf(space []byte, v uint32) []byte { - start := v >> 24 - if start == 0 { - space = append(space, byte(v>>16), byte(v>>8)) - } else if start == 1 { - space = append(space, byte(v>>8)) - } - space = append(space, byte(v)) - return space -} - -func writeBuf(buf []byte, v uint32) []byte { - return append(buf, byte(v>>16), byte(v>>8), byte(v)) -} - -// WriteUint8 write uint8 to stream -func (stream *Stream) WriteUint8(val uint8) { - stream.buf = writeFirstBuf(stream.buf, digits[val]) -} - -// WriteInt8 write int8 to stream -func (stream *Stream) WriteInt8(nval int8) { - var val uint8 - if nval < 0 { - val = uint8(-nval) - stream.buf = append(stream.buf, '-') - } else { - val = uint8(nval) - } - stream.buf = writeFirstBuf(stream.buf, digits[val]) -} - -// WriteUint16 write uint16 to stream -func (stream *Stream) WriteUint16(val uint16) { - q1 := val / 1000 - if q1 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[val]) - return - } - r1 := val - q1*1000 - stream.buf = writeFirstBuf(stream.buf, digits[q1]) - stream.buf = writeBuf(stream.buf, digits[r1]) - return -} - -// WriteInt16 write int16 to stream -func (stream *Stream) WriteInt16(nval int16) { - var val uint16 - if nval < 0 { - val = uint16(-nval) - stream.buf = append(stream.buf, '-') - } else { - val = uint16(nval) - } - stream.WriteUint16(val) -} - -// WriteUint32 write uint32 to stream -func (stream *Stream) WriteUint32(val uint32) { - q1 := val / 1000 - if q1 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[val]) - return - } - r1 := val - q1*1000 - q2 := q1 / 1000 - if q2 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[q1]) - stream.buf = writeBuf(stream.buf, digits[r1]) - return - } - r2 := q1 - q2*1000 - q3 := q2 / 1000 - if q3 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[q2]) - } else { - r3 := q2 - q3*1000 - stream.buf = append(stream.buf, byte(q3+'0')) - stream.buf = writeBuf(stream.buf, digits[r3]) - } - stream.buf = writeBuf(stream.buf, digits[r2]) - stream.buf = writeBuf(stream.buf, digits[r1]) -} - -// WriteInt32 write int32 to stream -func (stream *Stream) WriteInt32(nval int32) { - var val uint32 - if nval < 0 { - val = uint32(-nval) - stream.buf = append(stream.buf, '-') - } else { - val = uint32(nval) - } - stream.WriteUint32(val) -} - -// WriteUint64 write uint64 to stream -func (stream *Stream) WriteUint64(val uint64) { - q1 := val / 1000 - if q1 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[val]) - return - } - r1 := val - q1*1000 - q2 := q1 / 1000 - if q2 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[q1]) - stream.buf = writeBuf(stream.buf, digits[r1]) - return - } - r2 := q1 - q2*1000 - q3 := q2 / 1000 - if q3 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[q2]) - stream.buf = writeBuf(stream.buf, digits[r2]) - stream.buf = writeBuf(stream.buf, digits[r1]) - return - } - r3 := q2 - q3*1000 - q4 := q3 / 1000 - if q4 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[q3]) - stream.buf = writeBuf(stream.buf, digits[r3]) - stream.buf = writeBuf(stream.buf, digits[r2]) - stream.buf = writeBuf(stream.buf, digits[r1]) - return - } - r4 := q3 - q4*1000 - q5 := q4 / 1000 - if q5 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[q4]) - stream.buf = writeBuf(stream.buf, digits[r4]) - stream.buf = writeBuf(stream.buf, digits[r3]) - stream.buf = writeBuf(stream.buf, digits[r2]) - stream.buf = writeBuf(stream.buf, digits[r1]) - return - } - r5 := q4 - q5*1000 - q6 := q5 / 1000 - if q6 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[q5]) - } else { - stream.buf = writeFirstBuf(stream.buf, digits[q6]) - r6 := q5 - q6*1000 - stream.buf = writeBuf(stream.buf, digits[r6]) - } - stream.buf = writeBuf(stream.buf, digits[r5]) - stream.buf = writeBuf(stream.buf, digits[r4]) - stream.buf = writeBuf(stream.buf, digits[r3]) - stream.buf = writeBuf(stream.buf, digits[r2]) - stream.buf = writeBuf(stream.buf, digits[r1]) -} - -// WriteInt64 write int64 to stream -func (stream *Stream) WriteInt64(nval int64) { - var val uint64 - if nval < 0 { - val = uint64(-nval) - stream.buf = append(stream.buf, '-') - } else { - val = uint64(nval) - } - stream.WriteUint64(val) -} - -// WriteInt write int to stream -func (stream *Stream) WriteInt(val int) { - stream.WriteInt64(int64(val)) -} - -// WriteUint write uint to stream -func (stream *Stream) WriteUint(val uint) { - stream.WriteUint64(uint64(val)) -} diff --git a/vendor/github.com/json-iterator/go/stream_str.go b/vendor/github.com/json-iterator/go/stream_str.go deleted file mode 100644 index 54c2ba0b3..000000000 --- a/vendor/github.com/json-iterator/go/stream_str.go +++ /dev/null @@ -1,372 +0,0 @@ -package jsoniter - -import ( - "unicode/utf8" -) - -// htmlSafeSet holds the value true if the ASCII character with the given -// array position can be safely represented inside a JSON string, embedded -// inside of HTML